From: support Date: Mon, 18 Jul 2022 14:05:29 +0000 (+0000) Subject: Built motion from commit 2c0a2438.|2.6.12 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=841e72be0e016bb18c01ff233bf14193a5cc01ac;p=motion2.git Built motion from commit 2c0a2438.|2.6.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1c76efd..62e80dc 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-07-18T13:40:13.940Z", + "time": "2022-07-18T13:56:41.789Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e900163..66b8609 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-18T13:40:13.940Z", + "time": "2022-07-18T13:56:41.789Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index a948212..69c8ff4 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 _0x2b5e=['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]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','browser','bot'];(function(_0x187bb7,_0x420bab){var _0x2b356a=function(_0x40ee45){while(--_0x40ee45){_0x187bb7['push'](_0x187bb7['shift']());}};_0x2b356a(++_0x420bab);}(_0x2b5e,0xf4));var _0xe2b5=function(_0x1aae33,_0x110a80){_0x1aae33=_0x1aae33-0x0;var _0x2e91e9=_0x2b5e[_0x1aae33];return _0x2e91e9;};'use strict';var Sequelize=require(_0xe2b5('0x0'));module[_0xe2b5('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x56b3f2){return this[_0xe2b5('0x2')](_0xe2b5('0x3'));}},'action':{'type':Sequelize[_0xe2b5('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe2b5('0x5'),_0xe2b5('0x6'),_0xe2b5('0x7'),_0xe2b5('0x8'),'urlForward',_0xe2b5('0x9'),_0xe2b5('0xa'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xe2b5('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xe2b5('0xc')},'data2':{'type':Sequelize[_0xe2b5('0x4')](0x1000),'comment':_0xe2b5('0xd')},'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['STRING'](0x1000),'comments':_0xe2b5('0xe')},'data5':{'type':Sequelize[_0xe2b5('0x4')](0x1000),'comments':_0xe2b5('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xe2b5('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xb9fb=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser','bot','script'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0xb9fb,0xef));var _0xbb9f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb9fb[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xbb9f('0x0'));module[_0xbb9f('0x1')]={'name':{'type':Sequelize[_0xbb9f('0x2')],'get':function(_0x2bc64a){return this[_0xbb9f('0x3')](_0xbb9f('0x4'));}},'action':{'type':Sequelize[_0xbb9f('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xbb9f('0x6'),_0xbb9f('0x7'),'motionbar',_0xbb9f('0x8'),_0xbb9f('0x9'),_0xbb9f('0xa'),_0xbb9f('0xb'),_0xbb9f('0xc')]],'msg':_0xbb9f('0xd')}},'comment':_0xbb9f('0xd')},'data1':{'type':Sequelize[_0xbb9f('0x5')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0xbb9f('0x5')](0x1000),'comment':_0xbb9f('0xe')},'data3':{'type':Sequelize[_0xbb9f('0x5')](0x1000),'comment':_0xbb9f('0xf')},'data4':{'type':Sequelize[_0xbb9f('0x5')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xbb9f('0x10')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xbb9f('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5e85c1b..1f3451b 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 _0xcbe8=['apply','save','update','then','destroy','end','stack','name','send','body','find','Action','params','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set'];(function(_0xc7890c,_0xdc090d){var _0x406442=function(_0x1806d5){while(--_0x1806d5){_0xc7890c['push'](_0xc7890c['shift']());}};_0x406442(++_0xdc090d);}(_0xcbe8,0x116));var _0x8cbe=function(_0x17b4f9,_0x43410c){_0x17b4f9=_0x17b4f9-0x0;var _0x1e6897=_0xcbe8[_0x17b4f9];return _0x1e6897;};'use strict';var emlformat=require(_0x8cbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cbe('0x1'));var jsonpatch=require(_0x8cbe('0x2'));var rp=require('request-promise');var moment=require(_0x8cbe('0x3'));var BPromise=require(_0x8cbe('0x4'));var Mustache=require(_0x8cbe('0x5'));var util=require('util');var path=require(_0x8cbe('0x6'));var sox=require('sox');var csv=require(_0x8cbe('0x7'));var ejs=require(_0x8cbe('0x8'));var fs=require('fs');var fs_extra=require(_0x8cbe('0x9'));var _=require('lodash');var squel=require(_0x8cbe('0xa'));var crypto=require(_0x8cbe('0xb'));var jsforce=require(_0x8cbe('0xc'));var deskjs=require(_0x8cbe('0xd'));var toCsv=require(_0x8cbe('0x7'));var querystring=require('querystring');var Papa=require(_0x8cbe('0xe'));var Redis=require('ioredis');var authService=require(_0x8cbe('0xf'));var qs=require(_0x8cbe('0x10'));var as=require(_0x8cbe('0x11'));var hardwareService=require(_0x8cbe('0x12'));var logger=require(_0x8cbe('0x13'))(_0x8cbe('0x14'));var utils=require('../../config/utils');var config=require(_0x8cbe('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cbe('0x16'))['db'];function respondWithStatusCode(_0x3f3de7,_0x356b18){_0x356b18=_0x356b18||0xcc;return function(_0x58b518){if(_0x58b518){return _0x3f3de7['sendStatus'](_0x356b18);}return _0x3f3de7[_0x8cbe('0x17')](_0x356b18)['end']();};}function respondWithResult(_0x18b6a1,_0x1a0761){_0x1a0761=_0x1a0761||0xc8;return function(_0x13ea4d){if(_0x13ea4d){return _0x18b6a1[_0x8cbe('0x17')](_0x1a0761)[_0x8cbe('0x18')](_0x13ea4d);}};}function respondWithFilteredResult(_0x2bcb60,_0x314837){return function(_0x27e920){if(_0x27e920){var _0x52a4a8=typeof _0x314837[_0x8cbe('0x19')]===_0x8cbe('0x1a')&&typeof _0x314837[_0x8cbe('0x1b')]===_0x8cbe('0x1a');var _0x579f6f=_0x27e920[_0x8cbe('0x1c')];var _0x4bea34=_0x52a4a8?0x0:_0x314837[_0x8cbe('0x19')];var _0x15a9ae=_0x52a4a8?_0x27e920[_0x8cbe('0x1c')]:_0x314837['offset']+_0x314837[_0x8cbe('0x1b')];var _0x2a0454;if(_0x15a9ae>=_0x579f6f){_0x15a9ae=_0x579f6f;_0x2a0454=0xc8;}else{_0x2a0454=0xce;}_0x2bcb60[_0x8cbe('0x17')](_0x2a0454);return _0x2bcb60[_0x8cbe('0x1d')]('Content-Range',_0x4bea34+'-'+_0x15a9ae+'/'+_0x579f6f)[_0x8cbe('0x18')](_0x27e920);}return null;};}function patchUpdates(_0x5ca59c){return function(_0x1aee55){try{jsonpatch[_0x8cbe('0x1e')](_0x1aee55,_0x5ca59c,!![]);}catch(_0xb0394e){return BPromise['reject'](_0xb0394e);}return _0x1aee55[_0x8cbe('0x1f')]();};}function saveUpdates(_0x4842fb,_0x315fd6){return function(_0x1a7e29){if(_0x1a7e29){return _0x1a7e29[_0x8cbe('0x20')](_0x4842fb)[_0x8cbe('0x21')](function(_0x30b335){return _0x30b335;});}return null;};}function removeEntity(_0x4811f0,_0x480c5d){return function(_0x239a75){if(_0x239a75){return _0x239a75[_0x8cbe('0x22')]()[_0x8cbe('0x21')](function(){_0x4811f0[_0x8cbe('0x17')](0xcc)[_0x8cbe('0x23')]();});}};}function handleEntityNotFound(_0x46eaea,_0x2e816a){return function(_0x528a47){if(!_0x528a47){_0x46eaea['sendStatus'](0x194);}return _0x528a47;};}function handleError(_0x3ea82d,_0x4337b1){_0x4337b1=_0x4337b1||0x1f4;return function(_0xfb5d05){logger['error'](_0xfb5d05[_0x8cbe('0x24')]);if(_0xfb5d05[_0x8cbe('0x25')]){delete _0xfb5d05[_0x8cbe('0x25')];}_0x3ea82d[_0x8cbe('0x17')](_0x4337b1)[_0x8cbe('0x26')](_0xfb5d05);};}exports[_0x8cbe('0x20')]=function(_0x2914ae,_0x2e3144){if(_0x2914ae[_0x8cbe('0x27')]['id']){delete _0x2914ae[_0x8cbe('0x27')]['id'];}return db['Action'][_0x8cbe('0x28')]({'where':{'id':_0x2914ae['params']['id']}})['then'](handleEntityNotFound(_0x2e3144,null))[_0x8cbe('0x21')](saveUpdates(_0x2914ae[_0x8cbe('0x27')],null))[_0x8cbe('0x21')](respondWithResult(_0x2e3144,null))['catch'](handleError(_0x2e3144,null));};exports[_0x8cbe('0x22')]=function(_0xb4b8fb,_0x148bbd){return db[_0x8cbe('0x29')][_0x8cbe('0x28')]({'where':{'id':_0xb4b8fb[_0x8cbe('0x2a')]['id']}})[_0x8cbe('0x21')](handleEntityNotFound(_0x148bbd,null))[_0x8cbe('0x21')](removeEntity(_0x148bbd,null))[_0x8cbe('0x2b')](handleError(_0x148bbd,null));}; \ No newline at end of file +var _0xa7aa=['ejs','fs-extra','lodash','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','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3cfd8c,_0x23116b){var _0x9f0972=function(_0x40fb9f){while(--_0x40fb9f){_0x3cfd8c['push'](_0x3cfd8c['shift']());}};_0x9f0972(++_0x23116b);}(_0xa7aa,0x1c1));var _0xaa7a=function(_0x1a0848,_0x486d35){_0x1a0848=_0x1a0848-0x0;var _0x5c16b3=_0xa7aa[_0x1a0848];return _0x5c16b3;};'use strict';var emlformat=require(_0xaa7a('0x0'));var rimraf=require(_0xaa7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa7a('0x2'));var rp=require(_0xaa7a('0x3'));var moment=require('moment');var BPromise=require(_0xaa7a('0x4'));var Mustache=require(_0xaa7a('0x5'));var util=require(_0xaa7a('0x6'));var path=require(_0xaa7a('0x7'));var sox=require(_0xaa7a('0x8'));var csv=require(_0xaa7a('0x9'));var ejs=require(_0xaa7a('0xa'));var fs=require('fs');var fs_extra=require(_0xaa7a('0xb'));var _=require(_0xaa7a('0xc'));var squel=require(_0xaa7a('0xd'));var crypto=require(_0xaa7a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaa7a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaa7a('0x10'));var Redis=require(_0xaa7a('0x11'));var authService=require(_0xaa7a('0x12'));var qs=require(_0xaa7a('0x13'));var as=require(_0xaa7a('0x14'));var hardwareService=require(_0xaa7a('0x15'));var logger=require(_0xaa7a('0x16'))(_0xaa7a('0x17'));var utils=require(_0xaa7a('0x18'));var config=require(_0xaa7a('0x19'));var licenseUtil=require(_0xaa7a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b52e,_0x31019f){_0x31019f=_0x31019f||0xcc;return function(_0x32bfe8){if(_0x32bfe8){return _0x35b52e[_0xaa7a('0x1b')](_0x31019f);}return _0x35b52e[_0xaa7a('0x1c')](_0x31019f)[_0xaa7a('0x1d')]();};}function respondWithResult(_0x54a536,_0xeb7cc0){_0xeb7cc0=_0xeb7cc0||0xc8;return function(_0x1594ab){if(_0x1594ab){return _0x54a536['status'](_0xeb7cc0)['json'](_0x1594ab);}};}function respondWithFilteredResult(_0x5aaadc,_0x289c61){return function(_0x1bb90c){if(_0x1bb90c){var _0x53735b=typeof _0x289c61['offset']===_0xaa7a('0x1e')&&typeof _0x289c61[_0xaa7a('0x1f')]===_0xaa7a('0x1e');var _0x563533=_0x1bb90c['count'];var _0x3d17b8=_0x53735b?0x0:_0x289c61[_0xaa7a('0x20')];var _0x1f427e=_0x53735b?_0x1bb90c[_0xaa7a('0x21')]:_0x289c61[_0xaa7a('0x20')]+_0x289c61[_0xaa7a('0x1f')];var _0x330776;if(_0x1f427e>=_0x563533){_0x1f427e=_0x563533;_0x330776=0xc8;}else{_0x330776=0xce;}_0x5aaadc[_0xaa7a('0x1c')](_0x330776);return _0x5aaadc[_0xaa7a('0x22')](_0xaa7a('0x23'),_0x3d17b8+'-'+_0x1f427e+'/'+_0x563533)['json'](_0x1bb90c);}return null;};}function patchUpdates(_0x50fd57){return function(_0x5b9baa){try{jsonpatch[_0xaa7a('0x24')](_0x5b9baa,_0x50fd57,!![]);}catch(_0x30981b){return BPromise[_0xaa7a('0x25')](_0x30981b);}return _0x5b9baa[_0xaa7a('0x26')]();};}function saveUpdates(_0x262f9a,_0x53ab3d){return function(_0x38ec60){if(_0x38ec60){return _0x38ec60[_0xaa7a('0x27')](_0x262f9a)[_0xaa7a('0x28')](function(_0x3cc649){return _0x3cc649;});}return null;};}function removeEntity(_0x325506,_0x65f95){return function(_0x1235d0){if(_0x1235d0){return _0x1235d0[_0xaa7a('0x29')]()['then'](function(){_0x325506[_0xaa7a('0x1c')](0xcc)[_0xaa7a('0x1d')]();});}};}function handleEntityNotFound(_0x10bfca,_0x318cfd){return function(_0x4ea110){if(!_0x4ea110){_0x10bfca[_0xaa7a('0x1b')](0x194);}return _0x4ea110;};}function handleError(_0x2750d9,_0x33ad14){_0x33ad14=_0x33ad14||0x1f4;return function(_0x2ad835){logger[_0xaa7a('0x2a')](_0x2ad835[_0xaa7a('0x2b')]);if(_0x2ad835[_0xaa7a('0x2c')]){delete _0x2ad835[_0xaa7a('0x2c')];}_0x2750d9[_0xaa7a('0x1c')](_0x33ad14)[_0xaa7a('0x2d')](_0x2ad835);};}exports['update']=function(_0x160d45,_0x508c74){if(_0x160d45[_0xaa7a('0x2e')]['id']){delete _0x160d45[_0xaa7a('0x2e')]['id'];}return db[_0xaa7a('0x2f')][_0xaa7a('0x30')]({'where':{'id':_0x160d45[_0xaa7a('0x31')]['id']}})[_0xaa7a('0x28')](handleEntityNotFound(_0x508c74,null))[_0xaa7a('0x28')](saveUpdates(_0x160d45['body'],null))[_0xaa7a('0x28')](respondWithResult(_0x508c74,null))[_0xaa7a('0x32')](handleError(_0x508c74,null));};exports[_0xaa7a('0x29')]=function(_0x4589dc,_0x323dba){return db[_0xaa7a('0x2f')][_0xaa7a('0x30')]({'where':{'id':_0x4589dc[_0xaa7a('0x31')]['id']}})['then'](handleEntityNotFound(_0x323dba,null))[_0xaa7a('0x28')](removeEntity(_0x323dba,null))[_0xaa7a('0x32')](handleError(_0x323dba,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3ce45bd..681453d 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 _0xa11d=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash'];(function(_0x4f7588,_0x399e6b){var _0x535c70=function(_0x5c2bbb){while(--_0x5c2bbb){_0x4f7588['push'](_0x4f7588['shift']());}};_0x535c70(++_0x399e6b);}(_0xa11d,0xd1));var _0xda11=function(_0x21e97b,_0x65a77f){_0x21e97b=_0x21e97b-0x0;var _0x10ba44=_0xa11d[_0x21e97b];return _0x10ba44;};'use strict';var _=require(_0xda11('0x0'));var util=require(_0xda11('0x1'));var logger=require(_0xda11('0x2'))('api');var moment=require(_0xda11('0x3'));var BPromise=require(_0xda11('0x4'));var rp=require(_0xda11('0x5'));var fs=require('fs');var path=require(_0xda11('0x6'));var rimraf=require(_0xda11('0x7'));var config=require(_0xda11('0x8'));var attributes=require(_0xda11('0x9'));module[_0xda11('0xa')]=function(_0x4fcd94,_0x17852a){return _0x4fcd94[_0xda11('0xb')](_0xda11('0xc'),attributes,{'tableName':_0xda11('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x743e=['request-promise','path','../../config/environment','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x52b286,_0x4b4dd9){var _0x23942e=function(_0x58e688){while(--_0x58e688){_0x52b286['push'](_0x52b286['shift']());}};_0x23942e(++_0x4b4dd9);}(_0x743e,0x1c1));var _0xe743=function(_0x1e6861,_0x430894){_0x1e6861=_0x1e6861-0x0;var _0x335eb4=_0x743e[_0x1e6861];return _0x335eb4;};'use strict';var _=require(_0xe743('0x0'));var util=require(_0xe743('0x1'));var logger=require(_0xe743('0x2'))(_0xe743('0x3'));var moment=require(_0xe743('0x4'));var BPromise=require(_0xe743('0x5'));var rp=require(_0xe743('0x6'));var fs=require('fs');var path=require(_0xe743('0x7'));var rimraf=require('rimraf');var config=require(_0xe743('0x8'));var attributes=require('./action.attributes');module[_0xe743('0x9')]=function(_0x5ec0c8,_0x4934f7){return _0x5ec0c8[_0xe743('0xa')](_0xe743('0xb'),attributes,{'tableName':_0xe743('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 129ebc0..2207125 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(_0xffefe8,_0x52e7dc){var _0x581cec=function(_0x40776a){while(--_0x40776a){_0xffefe8['push'](_0xffefe8['shift']());}};_0x581cec(++_0x52e7dc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x5c6486,_0x14ddd5){var _0x10d57d=function(_0x7ecb89){while(--_0x7ecb89){_0x5c6486['push'](_0x5c6486['shift']());}};_0x10d57d(++_0x14ddd5);}(_0xabce,0x103));var _0xeabc=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xabce[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 321804d..f982f54 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 _0x75c3=['../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x120189,_0x3329b4){var _0x4018ad=function(_0x25ef74){while(--_0x25ef74){_0x120189['push'](_0x120189['shift']());}};_0x4018ad(++_0x3329b4);}(_0x75c3,0x1d8));var _0x375c=function(_0x4d4cf0,_0x1a00c8){_0x4d4cf0=_0x4d4cf0-0x0;var _0x1cbb1f=_0x75c3[_0x4d4cf0];return _0x1cbb1f;};'use strict';var multer=require(_0x375c('0x0'));var util=require(_0x375c('0x1'));var path=require('path');var timeout=require(_0x375c('0x2'));var express=require(_0x375c('0x3'));var router=express[_0x375c('0x4')]();var fs_extra=require(_0x375c('0x5'));var auth=require(_0x375c('0x6'));var interaction=require(_0x375c('0x7'));var config=require(_0x375c('0x8'));var controller=require(_0x375c('0x9'));router[_0x375c('0xa')](_0x375c('0xb'),auth[_0x375c('0xc')](),controller[_0x375c('0xd')]);router[_0x375c('0xe')](_0x375c('0xb'),auth[_0x375c('0xc')](),controller['destroy']);module[_0x375c('0xf')]=router; \ No newline at end of file +var _0x2eeb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x2eeb,0x13f));var _0xb2ee=function(_0x440de6,_0x2fbc65){_0x440de6=_0x440de6-0x0;var _0x4ce7d9=_0x2eeb[_0x440de6];return _0x4ce7d9;};'use strict';var multer=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var path=require(_0xb2ee('0x2'));var timeout=require(_0xb2ee('0x3'));var express=require(_0xb2ee('0x4'));var router=express[_0xb2ee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb2ee('0x6'));var interaction=require(_0xb2ee('0x7'));var config=require(_0xb2ee('0x8'));var controller=require(_0xb2ee('0x9'));router[_0xb2ee('0xa')](_0xb2ee('0xb'),auth['isAuthenticated'](),controller[_0xb2ee('0xc')]);router[_0xb2ee('0xd')](_0xb2ee('0xb'),auth[_0xb2ee('0xe')](),controller[_0xb2ee('0xf')]);module[_0xb2ee('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index af3a255..4de7c05 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 _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0xe3ada4,_0x25380f){var _0x2f3b33=function(_0x5ee167){while(--_0x5ee167){_0xe3ada4['push'](_0xe3ada4['shift']());}};_0x2f3b33(++_0x25380f);}(_0xeff8,0x186));var _0x8eff=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xeff8[_0x286726];return _0xcd4fe9;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0xa0e76b,_0x3fbdf0){var _0x15660a=function(_0x514c75){while(--_0x514c75){_0xa0e76b['push'](_0xa0e76b['shift']());}};_0x15660a(++_0x3fbdf0);}(_0xabce,0x103));var _0xeabc=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xabce[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d28e186..57d70d0 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 _0xd9ee=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','options','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','MetricId','metric','function','format','replace','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','table','groupBy','orderBy','output','web','fullPath','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','run','runReport','operator','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model'];(function(_0x100547,_0x3905d6){var _0x5d9aa7=function(_0x3bd161){while(--_0x3bd161){_0x100547['push'](_0x100547['shift']());}};_0x5d9aa7(++_0x3905d6);}(_0xd9ee,0x117));var _0xed9e=function(_0x3b4dd6,_0x392e80){_0x3b4dd6=_0x3b4dd6-0x0;var _0xc48377=_0xd9ee[_0x3b4dd6];return _0xc48377;};'use strict';var emlformat=require(_0xed9e('0x0'));var rimraf=require(_0xed9e('0x1'));var zipdir=require(_0xed9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed9e('0x3'));var moment=require('moment');var BPromise=require(_0xed9e('0x4'));var Mustache=require(_0xed9e('0x5'));var util=require(_0xed9e('0x6'));var path=require(_0xed9e('0x7'));var sox=require(_0xed9e('0x8'));var csv=require(_0xed9e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed9e('0xa'));var squel=require('squel');var crypto=require(_0xed9e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed9e('0x9'));var querystring=require('querystring');var Papa=require(_0xed9e('0xc'));var Redis=require(_0xed9e('0xd'));var authService=require(_0xed9e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xed9e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed9e('0x10'))(_0xed9e('0x11'));var utils=require(_0xed9e('0x12'));var config=require(_0xed9e('0x13'));var licenseUtil=require(_0xed9e('0x14'));var db=require(_0xed9e('0x15'))['db'];var dbH=require('../../mysqldb')[_0xed9e('0x16')];function respondWithStatusCode(_0x4c5048,_0x1c1a53){_0x1c1a53=_0x1c1a53||0xcc;return function(_0x1bb9ae){if(_0x1bb9ae){return _0x4c5048[_0xed9e('0x17')](_0x1c1a53);}return _0x4c5048['status'](_0x1c1a53)['end']();};}function respondWithResult(_0x39d56d,_0x271b21){_0x271b21=_0x271b21||0xc8;return function(_0x26122d){if(_0x26122d){return _0x39d56d[_0xed9e('0x18')](_0x271b21)[_0xed9e('0x19')](_0x26122d);}};}function respondWithFilteredResult(_0x4dc7f2,_0x4151d3){return function(_0x4d9edb){if(_0x4d9edb){var _0x49d0f4=typeof _0x4151d3[_0xed9e('0x1a')]===_0xed9e('0x1b')&&typeof _0x4151d3[_0xed9e('0x1c')]===_0xed9e('0x1b');var _0x30a142=_0x4d9edb['count'];var _0xed9987=_0x49d0f4?0x0:_0x4151d3['offset'];var _0x538827=_0x49d0f4?_0x4d9edb[_0xed9e('0x1d')]:_0x4151d3[_0xed9e('0x1a')]+_0x4151d3[_0xed9e('0x1c')];var _0x534d2d;if(_0x538827>=_0x30a142){_0x538827=_0x30a142;_0x534d2d=0xc8;}else{_0x534d2d=0xce;}_0x4dc7f2[_0xed9e('0x18')](_0x534d2d);return _0x4dc7f2[_0xed9e('0x1e')](_0xed9e('0x1f'),_0xed9987+'-'+_0x538827+'/'+_0x30a142)[_0xed9e('0x19')](_0x4d9edb);}return null;};}function patchUpdates(_0x6edce9){return function(_0x569d53){try{jsonpatch[_0xed9e('0x20')](_0x569d53,_0x6edce9,!![]);}catch(_0x37ed7c){return BPromise['reject'](_0x37ed7c);}return _0x569d53['save']();};}function saveUpdates(_0x52bbc0,_0x3bde31){return function(_0x3c1140){if(_0x3c1140){return _0x3c1140[_0xed9e('0x21')](_0x52bbc0)[_0xed9e('0x22')](function(_0x4a89c3){return _0x4a89c3;});}return null;};}function removeEntity(_0x119191,_0x2dbcb7){return function(_0x219231){if(_0x219231){return _0x219231[_0xed9e('0x23')]()[_0xed9e('0x22')](function(){var _0x46f652=_0x219231[_0xed9e('0x24')]({'plain':!![]});var _0x386b98='CustomReports';return db['UserProfileResource'][_0xed9e('0x23')]({'where':{'type':_0x386b98,'resourceId':_0x46f652['id']}})[_0xed9e('0x22')](function(){return _0x219231;});})[_0xed9e('0x22')](function(){_0x119191[_0xed9e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x310cac,_0x997983){return function(_0x8a2684){if(!_0x8a2684){_0x310cac[_0xed9e('0x17')](0x194);}return _0x8a2684;};}function handleError(_0x58800e,_0x578cc9){_0x578cc9=_0x578cc9||0x1f4;return function(_0x5ef638){logger['error'](_0x5ef638[_0xed9e('0x25')]);if(_0x5ef638[_0xed9e('0x26')]){delete _0x5ef638[_0xed9e('0x26')];}_0x58800e[_0xed9e('0x18')](_0x578cc9)['send'](_0x5ef638);};}exports[_0xed9e('0x27')]=function(_0x337899,_0x355d84){var _0x4c316a={},_0x1911df={},_0x363051={'count':0x0,'rows':[]};var _0x486884=_[_0xed9e('0x28')](db[_0xed9e('0x29')][_0xed9e('0x2a')],function(_0x1658c2){return{'name':_0x1658c2[_0xed9e('0x2b')],'type':_0x1658c2[_0xed9e('0x2c')][_0xed9e('0x2d')]};});_0x1911df[_0xed9e('0x2e')]=_[_0xed9e('0x28')](_0x486884,_0xed9e('0x26'));_0x1911df['query']=_['keys'](_0x337899[_0xed9e('0x2f')]);_0x1911df[_0xed9e('0x30')]=_[_0xed9e('0x31')](_0x1911df['model'],_0x1911df[_0xed9e('0x2f')]);_0x4c316a['attributes']=_[_0xed9e('0x31')](_0x1911df[_0xed9e('0x2e')],qs[_0xed9e('0x32')](_0x337899[_0xed9e('0x2f')][_0xed9e('0x32')]));_0x4c316a['attributes']=_0x4c316a[_0xed9e('0x33')][_0xed9e('0x34')]?_0x4c316a[_0xed9e('0x33')]:_0x1911df[_0xed9e('0x2e')];if(!_0x337899[_0xed9e('0x2f')][_0xed9e('0x35')](_0xed9e('0x36'))){_0x4c316a[_0xed9e('0x1c')]=qs['limit'](_0x337899[_0xed9e('0x2f')][_0xed9e('0x1c')]);_0x4c316a['offset']=qs[_0xed9e('0x1a')](_0x337899[_0xed9e('0x2f')][_0xed9e('0x1a')]);}_0x4c316a[_0xed9e('0x37')]=qs['sort'](_0x337899[_0xed9e('0x2f')][_0xed9e('0x38')]);_0x4c316a['where']=qs['filters'](_['pick'](_0x337899[_0xed9e('0x2f')],_0x1911df[_0xed9e('0x30')]),_0x486884);if(_0x337899[_0xed9e('0x2f')][_0xed9e('0x39')]){_0x4c316a[_0xed9e('0x3a')]=_[_0xed9e('0x3b')](_0x4c316a[_0xed9e('0x3a')],{'$or':_[_0xed9e('0x28')](_0x486884,function(_0x59d18e){if(_0x59d18e[_0xed9e('0x2c')]!==_0xed9e('0x3c')){var _0x5e10f7={};_0x5e10f7[_0x59d18e[_0xed9e('0x26')]]={'$like':'%'+_0x337899[_0xed9e('0x2f')][_0xed9e('0x39')]+'%'};return _0x5e10f7;}})});}_0x4c316a=_['merge']({},_0x4c316a,_0x337899['options']);var _0x463f0a={'where':_0x4c316a[_0xed9e('0x3a')]};return db[_0xed9e('0x29')][_0xed9e('0x1d')](_0x463f0a)[_0xed9e('0x22')](function(_0x5648c4){_0x363051[_0xed9e('0x1d')]=_0x5648c4;if(_0x337899[_0xed9e('0x2f')][_0xed9e('0x3d')]){_0x4c316a[_0xed9e('0x3e')]=[{'all':!![]}];}return db[_0xed9e('0x29')][_0xed9e('0x3f')](_0x4c316a);})[_0xed9e('0x22')](function(_0x471959){_0x363051[_0xed9e('0x40')]=_0x471959;return _0x363051;})['then'](respondWithFilteredResult(_0x355d84,_0x4c316a))[_0xed9e('0x41')](handleError(_0x355d84,null));};exports[_0xed9e('0x42')]=function(_0x3fc8ee,_0x42c35d){var _0x382c36={'raw':![],'where':{'id':_0x3fc8ee['params']['id']}},_0x44d50d={};_0x44d50d[_0xed9e('0x2e')]=_['keys'](db[_0xed9e('0x29')][_0xed9e('0x2a')]);_0x44d50d['query']=_['keys'](_0x3fc8ee[_0xed9e('0x2f')]);_0x44d50d[_0xed9e('0x30')]=_['intersection'](_0x44d50d[_0xed9e('0x2e')],_0x44d50d[_0xed9e('0x2f')]);_0x382c36[_0xed9e('0x33')]=_[_0xed9e('0x31')](_0x44d50d[_0xed9e('0x2e')],qs[_0xed9e('0x32')](_0x3fc8ee['query'][_0xed9e('0x32')]));_0x382c36[_0xed9e('0x33')]=_0x382c36[_0xed9e('0x33')][_0xed9e('0x34')]?_0x382c36[_0xed9e('0x33')]:_0x44d50d[_0xed9e('0x2e')];if(_0x3fc8ee[_0xed9e('0x2f')][_0xed9e('0x3d')]){_0x382c36[_0xed9e('0x3e')]=[{'all':!![]}];}_0x382c36=_[_0xed9e('0x3b')]({},_0x382c36,_0x3fc8ee['options']);return db[_0xed9e('0x29')][_0xed9e('0x43')](_0x382c36)[_0xed9e('0x22')](handleEntityNotFound(_0x42c35d,null))[_0xed9e('0x22')](respondWithResult(_0x42c35d,null))[_0xed9e('0x41')](handleError(_0x42c35d,null));};exports['create']=function(_0x5a6950,_0x407097){return db['AnalyticCustomReport'][_0xed9e('0x44')](_0x5a6950[_0xed9e('0x45')],{})['then'](function(_0x2ef3fb){var _0x5118c3=_0x5a6950['user']['get']({'plain':!![]});if(!_0x5118c3)throw new Error(_0xed9e('0x46'));if(_0x5118c3[_0xed9e('0x47')]===_0xed9e('0x48')){var _0x1a9ba2=_0x2ef3fb[_0xed9e('0x24')]({'plain':!![]});var _0x4d9f5a=_0xed9e('0x49');return db[_0xed9e('0x4a')]['find']({'where':{'name':_0x4d9f5a,'userProfileId':_0x5118c3[_0xed9e('0x4b')]},'raw':!![]})[_0xed9e('0x22')](function(_0x18eb85){if(_0x18eb85&&_0x18eb85['autoAssociation']===0x0){return db[_0xed9e('0x4c')][_0xed9e('0x44')]({'name':_0x1a9ba2[_0xed9e('0x26')],'resourceId':_0x1a9ba2['id'],'type':'CustomReports','sectionId':_0x18eb85['id']},{})[_0xed9e('0x22')](function(){return _0x2ef3fb;});}else{return _0x2ef3fb;}})[_0xed9e('0x41')](function(_0x3f6e5c){logger[_0xed9e('0x4d')](_0xed9e('0x4e'),_0x3f6e5c);throw _0x3f6e5c;});}return _0x2ef3fb;})[_0xed9e('0x22')](respondWithResult(_0x407097,0xc9))[_0xed9e('0x41')](handleError(_0x407097,null));};exports[_0xed9e('0x21')]=function(_0x4c1b07,_0x76e3f3){if(_0x4c1b07[_0xed9e('0x45')]['id']){delete _0x4c1b07[_0xed9e('0x45')]['id'];}return db[_0xed9e('0x29')][_0xed9e('0x43')]({'where':{'id':_0x4c1b07[_0xed9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x76e3f3,null))[_0xed9e('0x22')](saveUpdates(_0x4c1b07[_0xed9e('0x45')],null))[_0xed9e('0x22')](respondWithResult(_0x76e3f3,null))[_0xed9e('0x41')](handleError(_0x76e3f3,null));};exports[_0xed9e('0x23')]=function(_0x17e0b2,_0x9c02c9){return db[_0xed9e('0x29')][_0xed9e('0x43')]({'where':{'id':_0x17e0b2[_0xed9e('0x4f')]['id']}})[_0xed9e('0x22')](handleEntityNotFound(_0x9c02c9,null))['then'](removeEntity(_0x9c02c9,null))[_0xed9e('0x41')](handleError(_0x9c02c9,null));};exports[_0xed9e('0x50')]=function(_0xc0a05f,_0x390b95){var _0x417f06=0xa;var _0xcc1d70=[_0xed9e('0x51'),_0xed9e('0x52'),_0xed9e('0x53'),_0xed9e('0x54')];var _0x24e90d={'SUM':_0xed9e('0x55'),'COUNT':_0xed9e('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xed9e('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xed9e('0x58'),'GROUP_CONCAT ASC':_0xed9e('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x573249={'SEC_TO_TIME':_0xed9e('0x5a'),'DATE':_0xed9e('0x5b'),'HOUR':_0xed9e('0x5c'),'ROUND':_0xed9e('0x5d'),'UNIX_TIMESTAMP':_0xed9e('0x5e')};var _0x2d07f2=function(_0x3df906){return!_[_0xed9e('0x5f')](['IS\x20NULL',_0xed9e('0x60'),_0xed9e('0x61'),_0xed9e('0x62')],_0x3df906);};var _0x105896=function(_0x5a1c63){if(!_0x5a1c63||!_0x5a1c63['rules'][_0xed9e('0x34')]){return'';}for(var _0x5ef1f0='(',_0x29ac94=0x0;_0x29ac94<_0x5a1c63[_0xed9e('0x63')][_0xed9e('0x34')];_0x29ac94+=0x1){_0x29ac94>0x0&&(_0x5ef1f0+='\x20'+_0x5a1c63['operator']+'\x20');_0x5ef1f0+=_0x5a1c63[_0xed9e('0x63')][_0x29ac94][_0xed9e('0x64')]?_0x105896(_0x5a1c63[_0xed9e('0x63')][_0x29ac94][_0xed9e('0x64')]):_0x5a1c63[_0xed9e('0x63')][_0x29ac94][_0xed9e('0x65')]+'\x20'+_0x5a1c63[_0xed9e('0x63')][_0x29ac94][_0xed9e('0x66')]+(_0x2d07f2(_0x5a1c63[_0xed9e('0x63')][_0x29ac94][_0xed9e('0x66')])?'\x20'+_0x5a1c63[_0xed9e('0x63')][_0x29ac94][_0xed9e('0x67')]:'');}return _0x5ef1f0+')';};var _0x276ec5={'where':{'id':_0xc0a05f['params']['id']}},_0x558262,_0x56feeb,_0xdb29fa,_0x53f4c7,_0x433ade;_0x276ec5=_[_0xed9e('0x3b')]({},_0x276ec5,_0xc0a05f[_0xed9e('0x68')]);return db[_0xed9e('0x29')][_0xed9e('0x43')](_0x276ec5)[_0xed9e('0x22')](function(_0x386207){if(_0x386207){_0x558262=_0x386207;return _0x386207[_0xed9e('0x69')]();}return null;})[_0xed9e('0x22')](function(_0x160b12){if(_0x160b12){if(!_0x160b12[_0xed9e('0x34')]){throw new db[(_0xed9e('0x6a'))][(_0xed9e('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56feeb=_0x160b12;return db[_0xed9e('0x6c')][_0xed9e('0x3f')]({'raw':!![]});}return null;})[_0xed9e('0x22')](function(_0x317f4b){if(_0x317f4b){_0xdb29fa=_[_0xed9e('0x6d')](_0x317f4b,'id');var _0x45cd76;var _0x3c8060=squel[_0xed9e('0x6e')]();_0x3c8060[_0xed9e('0x6f')](_0x558262['table']);for(var _0x336527=0x0;_0x336527<_0x56feeb[_0xed9e('0x34')];_0x336527+=0x1){_0x45cd76=_0x56feeb[_0x336527]['MetricId']?_0xdb29fa[_0x56feeb[_0x336527][_0xed9e('0x70')]][_0xed9e('0x71')]:_0x56feeb[_0x336527]['field'];_0x45cd76=_0x56feeb[_0x336527][_0xed9e('0x72')]?_['replace'](_0x24e90d[_0x56feeb[_0x336527]['function']],'%s',_0x45cd76):_0x45cd76;_0x45cd76=_0x56feeb[_0x336527][_0xed9e('0x73')]?_[_0xed9e('0x74')](_0x573249[_0x56feeb[_0x336527][_0xed9e('0x73')]],'%s',_0x45cd76):_0x45cd76;if(_0x56feeb[_0x336527]['groupBy']){_0x3c8060[_0xed9e('0x64')](_0x45cd76);}_0x56feeb[_0x336527]['orderBy']&&_0x3c8060[_0xed9e('0x37')](_0x45cd76,_0x56feeb[_0x336527]['orderBy']===_0xed9e('0x75')?![]:!![]);_0x3c8060[_0xed9e('0x65')](_0x45cd76,_0x56feeb[_0x336527][_0xed9e('0x76')]||_0x45cd76);}if(_0x558262[_0xed9e('0x77')]){_0x558262['joins']=JSON[_0xed9e('0x78')](_0x558262['joins']);for(var _0x593778=0x0;_0x593778<_0x558262[_0xed9e('0x77')][_0xed9e('0x34')];_0x593778+=0x1){if(_0x558262[_0xed9e('0x77')][_0x593778][_0xed9e('0x2c')]&&_[_0xed9e('0x5f')](_0xcc1d70,_0x558262[_0xed9e('0x77')][_0x593778][_0xed9e('0x2c')])&&_0x558262['joins'][_0x593778][_0xed9e('0x79')]&&_0x558262['joins'][_0x593778]['foreignTable']&&_0x558262[_0xed9e('0x77')][_0x593778][_0xed9e('0x7a')]){_0x3c8060[_0x558262[_0xed9e('0x77')][_0x593778]['type']](_0x558262[_0xed9e('0x77')][_0x593778][_0xed9e('0x7b')],null,util['format'](_0xed9e('0x7c'),_0x558262['table'],_0x558262[_0xed9e('0x77')][_0x593778]['parentKey'],_0x558262[_0xed9e('0x77')][_0x593778][_0xed9e('0x7b')],_0x558262[_0xed9e('0x77')][_0x593778]['foreignKey']));}}}if(_0x558262['conditions']){_0x558262['conditions']=JSON[_0xed9e('0x78')](_0x558262[_0xed9e('0x7d')]);_0x3c8060[_0xed9e('0x3a')](_0x105896(_0x558262[_0xed9e('0x7d')][_0xed9e('0x64')]));}_0x433ade=_0x3c8060[_0xed9e('0x7e')]();_0x3c8060[_0xed9e('0x1c')](_0x417f06);_0x3c8060[_0xed9e('0x1a')](0x0);logger[_0xed9e('0x7f')](_0xed9e('0x80'),_0x3c8060[_0xed9e('0x81')]());return dbH[_0xed9e('0x82')][_0xed9e('0x2f')](_0x3c8060[_0xed9e('0x81')](),{'type':dbH[_0xed9e('0x82')][_0xed9e('0x83')][_0xed9e('0x84')]});}})[_0xed9e('0x22')](respondWithResult(_0x390b95,null))[_0xed9e('0x41')](handleError(_0x390b95,null));};function runReport(_0x4579df,_0x3c92fb,_0x52c6fe){var _0x141db2=_0x3c92fb[_0xed9e('0x26')];var _0x150754=0xa;var _0x4e9e9c=[_0xed9e('0x51'),_0xed9e('0x52'),_0xed9e('0x53'),_0xed9e('0x54')];var _0x338bd4={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xed9e('0x85'),'MAX':_0xed9e('0x86'),'MIN':_0xed9e('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xed9e('0x58'),'GROUP_CONCAT ASC':_0xed9e('0x59'),'GROUP_CONCAT DESC':_0xed9e('0x87')};var _0x46c5cd={'SEC_TO_TIME':_0xed9e('0x5a'),'DATE':_0xed9e('0x5b'),'HOUR':_0xed9e('0x5c'),'ROUND':_0xed9e('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x12fb13=function(_0x3e0afa){return!_[_0xed9e('0x5f')]([_0xed9e('0x88'),_0xed9e('0x60'),_0xed9e('0x61'),_0xed9e('0x62')],_0x3e0afa);};var _0x8cf0e1=function(_0x5b4033){if(!_0x5b4033||!_0x5b4033[_0xed9e('0x63')][_0xed9e('0x34')]){return'';}for(var _0x969c10='(',_0x16a9b8=0x0;_0x16a9b8<_0x5b4033[_0xed9e('0x63')][_0xed9e('0x34')];_0x16a9b8+=0x1){_0x16a9b8>0x0&&(_0x969c10+='\x20'+_0x5b4033['operator']+'\x20');_0x969c10+=_0x5b4033['rules'][_0x16a9b8][_0xed9e('0x64')]?_0x8cf0e1(_0x5b4033[_0xed9e('0x63')][_0x16a9b8][_0xed9e('0x64')]):_0x5b4033[_0xed9e('0x63')][_0x16a9b8][_0xed9e('0x65')]+'\x20'+_0x5b4033['rules'][_0x16a9b8][_0xed9e('0x66')]+(_0x12fb13(_0x5b4033['rules'][_0x16a9b8][_0xed9e('0x66')])?'\x20'+_0x5b4033[_0xed9e('0x63')][_0x16a9b8][_0xed9e('0x67')]:'');}return _0x969c10+')';};var _0x55a01e={'where':{'id':_0x4579df['id']}},_0x3fe1dc,_0x41a0df,_0x24dd83,_0x2f6eb7,_0x350e2f;_0x55a01e=_[_0xed9e('0x3b')]({},_0x55a01e,_0x52c6fe);return db[_0xed9e('0x29')]['find'](_0x55a01e)['then'](function(_0x1f83a5){if(_0x1f83a5){_0x3fe1dc=_0x1f83a5;return _0x1f83a5[_0xed9e('0x69')]();}return null;})[_0xed9e('0x22')](function(_0x28de3a){if(_0x28de3a){if(!_0x28de3a[_0xed9e('0x34')]){throw new db[(_0xed9e('0x6a'))][(_0xed9e('0x6b'))](_0xed9e('0x89'),0x193);}_0x41a0df=_0x28de3a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x4c56ac){if(_0x4c56ac){_0x24dd83=_['keyBy'](_0x4c56ac,'id');var _0x58ae0a;var _0x297e52=squel[_0xed9e('0x6e')]();_0x297e52[_0xed9e('0x6f')](_0x3fe1dc[_0xed9e('0x8a')]);for(var _0x3008eb=0x0;_0x3008eb<_0x41a0df[_0xed9e('0x34')];_0x3008eb+=0x1){_0x58ae0a=_0x41a0df[_0x3008eb][_0xed9e('0x70')]?_0x24dd83[_0x41a0df[_0x3008eb][_0xed9e('0x70')]][_0xed9e('0x71')]:_0x41a0df[_0x3008eb]['field'];_0x58ae0a=_0x41a0df[_0x3008eb][_0xed9e('0x72')]?_['replace'](_0x338bd4[_0x41a0df[_0x3008eb]['function']],'%s',_0x58ae0a):_0x58ae0a;_0x58ae0a=_0x41a0df[_0x3008eb][_0xed9e('0x73')]?_[_0xed9e('0x74')](_0x46c5cd[_0x41a0df[_0x3008eb][_0xed9e('0x73')]],'%s',_0x58ae0a):_0x58ae0a;if(_0x41a0df[_0x3008eb][_0xed9e('0x8b')]){_0x297e52[_0xed9e('0x64')](_0x58ae0a);}_0x41a0df[_0x3008eb][_0xed9e('0x8c')]&&_0x297e52[_0xed9e('0x37')](_0x58ae0a,_0x41a0df[_0x3008eb]['orderBy']===_0xed9e('0x75')?![]:!![]);_0x297e52['field'](_0x58ae0a,_0x41a0df[_0x3008eb][_0xed9e('0x76')]||_0x58ae0a);}if(_0x3fe1dc['joins']){_0x3fe1dc['joins']=JSON[_0xed9e('0x78')](_0x3fe1dc['joins']);for(var _0xce6027=0x0;_0xce6027<_0x3fe1dc[_0xed9e('0x77')]['length'];_0xce6027+=0x1){if(_0x3fe1dc['joins'][_0xce6027][_0xed9e('0x2c')]&&_['includes'](_0x4e9e9c,_0x3fe1dc[_0xed9e('0x77')][_0xce6027][_0xed9e('0x2c')])&&_0x3fe1dc[_0xed9e('0x77')][_0xce6027][_0xed9e('0x79')]&&_0x3fe1dc[_0xed9e('0x77')][_0xce6027]['foreignTable']&&_0x3fe1dc[_0xed9e('0x77')][_0xce6027][_0xed9e('0x7a')]){_0x297e52[_0x3fe1dc[_0xed9e('0x77')][_0xce6027]['type']](_0x3fe1dc[_0xed9e('0x77')][_0xce6027][_0xed9e('0x7b')],null,util[_0xed9e('0x73')](_0xed9e('0x7c'),_0x3fe1dc[_0xed9e('0x8a')],_0x3fe1dc['joins'][_0xce6027][_0xed9e('0x79')],_0x3fe1dc['joins'][_0xce6027]['foreignTable'],_0x3fe1dc[_0xed9e('0x77')][_0xce6027][_0xed9e('0x7a')]));}}}if(_0x3fe1dc[_0xed9e('0x7d')]){_0x3fe1dc[_0xed9e('0x7d')]=JSON[_0xed9e('0x78')](_0x3fe1dc[_0xed9e('0x7d')]);_0x297e52[_0xed9e('0x3a')](_0x8cf0e1(_0x3fe1dc['conditions'][_0xed9e('0x64')]));}_0x350e2f=_0x297e52[_0xed9e('0x7e')]();_0x297e52[_0xed9e('0x1c')](_0x150754);_0x297e52[_0xed9e('0x1a')](0x0);return;}})['then'](function(){if(_0x3c92fb[_0xed9e('0x8d')]===_0xed9e('0x8e')){return null;}var _0x226a42=_['merge'](_0x3c92fb,{'name':_0x3c92fb[_0xed9e('0x8f')]||_0x3c92fb['name']||_0x3fe1dc[_0xed9e('0x26')],'basename':_0x141db2,'savename':util[_0xed9e('0x73')]('%s-%s.%s',_0x3c92fb[_0xed9e('0x26')]||_0x3fe1dc[_0xed9e('0x26')],require(_0xed9e('0x90'))[_0xed9e('0x91')](0x4),_0x3c92fb['output']||_0xed9e('0x92')),'reportId':_0x3fe1dc['id'],'reportType':_0xed9e('0x93')});return db['AnalyticExtractedReport'][_0xed9e('0x44')](_0x226a42,{'raw':!![]});})[_0xed9e('0x22')](function(_0x1ea915){if(_0x3fe1dc['table']===_0xed9e('0x94')){_0x350e2f[_0xed9e('0x3a')](_0x3fe1dc[_0xed9e('0x8a')]+_0xed9e('0x95'),_0x3c92fb['startDate'],_0x3c92fb['endDate']);}else{_0x350e2f[_0xed9e('0x3a')](_0x3fe1dc[_0xed9e('0x8a')]+_0xed9e('0x96'),_0x3c92fb[_0xed9e('0x97')],_0x3c92fb[_0xed9e('0x98')]);}if(_0x1ea915){logger[_0xed9e('0x99')](_0xed9e('0x9a'),_0x350e2f[_0xed9e('0x81')]());require(_0xed9e('0x9b'))[_0xed9e('0x9c')](path[_0xed9e('0x51')](__dirname,_0xed9e('0x9d'),_0x1ea915['output']),[_0x1ea915['id'],_0x350e2f['toString'](),path[_0xed9e('0x51')](__dirname,_0xed9e('0x9e'),_0x1ea915['savename']),_0x141db2]);return _0x1ea915;}else{var _0x48ba92=squel[_0xed9e('0x6e')]();_0x48ba92['from']('('+_0x350e2f['toString']()+')',_0xed9e('0x9f'));_0x48ba92[_0xed9e('0x65')]('COUNT(*)',_0xed9e('0x1d'));_0x350e2f[_0xed9e('0x1c')](_0x3c92fb[_0xed9e('0x1c')]||_0x150754);_0x350e2f[_0xed9e('0x1a')](_0x3c92fb['offset']||0x0);return dbH[_0xed9e('0x82')][_0xed9e('0x2f')](_0x48ba92['toString'](),{'type':dbH[_0xed9e('0x82')]['QueryTypes'][_0xed9e('0x84')]})['then'](function(_0x28abd8){if(!_0x28abd8[_0xed9e('0x34')]){_0x2f6eb7=0x0;}else{_0x2f6eb7=_0x28abd8[0x0][_0xed9e('0x1d')]||0x0;}return dbH['sequelize'][_0xed9e('0x2f')](_0x350e2f['toString'](),{'type':dbH[_0xed9e('0x82')][_0xed9e('0x83')]['SELECT']});})[_0xed9e('0x22')](function(_0x24f3dd){return{'rows':_0x24f3dd||[],'count':_0x2f6eb7};});}});}exports[_0xed9e('0xa0')]=function(_0x44ffdf,_0x3732b8){return runReport(_0x44ffdf[_0xed9e('0x4f')],_0x44ffdf[_0xed9e('0x2f')],_0x44ffdf[_0xed9e('0x68')])['then'](respondWithResult(_0x3732b8,null))[_0xed9e('0x41')](handleError(_0x3732b8,null));};exports[_0xed9e('0xa1')]=runReport;exports[_0xed9e('0x2f')]=function(_0x287a2a,_0x1f4889){var _0x27b79b=0xa;var _0x560be4=[_0xed9e('0x51'),_0xed9e('0x52'),'right_join',_0xed9e('0x54')];var _0x3e3973={'SUM':_0xed9e('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xed9e('0x85'),'MAX':_0xed9e('0x86'),'MIN':_0xed9e('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xed9e('0x58'),'GROUP_CONCAT ASC':_0xed9e('0x59'),'GROUP_CONCAT DESC':_0xed9e('0x87')};var _0x38117e={'SEC_TO_TIME':_0xed9e('0x5a'),'DATE':_0xed9e('0x5b'),'HOUR':_0xed9e('0x5c'),'ROUND':_0xed9e('0x5d'),'UNIX_TIMESTAMP':_0xed9e('0x5e')};var _0x57d977=function(_0x7b487e){return!_[_0xed9e('0x5f')](['IS\x20NULL',_0xed9e('0x60'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x7b487e);};var _0x3b11ad=function(_0x55b648){if(!_0x55b648||!_0x55b648[_0xed9e('0x63')][_0xed9e('0x34')]){return'';}for(var _0x1d4b53='(',_0x87356a=0x0;_0x87356a<_0x55b648[_0xed9e('0x63')][_0xed9e('0x34')];_0x87356a+=0x1){_0x87356a>0x0&&(_0x1d4b53+='\x20'+_0x55b648[_0xed9e('0xa2')]+'\x20');_0x1d4b53+=_0x55b648[_0xed9e('0x63')][_0x87356a]['group']?_0x3b11ad(_0x55b648['rules'][_0x87356a][_0xed9e('0x64')]):_0x55b648['rules'][_0x87356a][_0xed9e('0x65')]+'\x20'+_0x55b648['rules'][_0x87356a][_0xed9e('0x66')]+(_0x57d977(_0x55b648['rules'][_0x87356a][_0xed9e('0x66')])?'\x20'+_0x55b648[_0xed9e('0x63')][_0x87356a][_0xed9e('0x67')]:'');}return _0x1d4b53+')';};var _0x4734f4={'where':{'id':_0x287a2a[_0xed9e('0x4f')]['id']}},_0x22c470,_0x2a863f,_0x2e04f0,_0x56406a,_0x27ece7;_0x4734f4=_[_0xed9e('0x3b')]({},_0x4734f4,_0x287a2a['options']);return db[_0xed9e('0x29')][_0xed9e('0x43')](_0x4734f4)[_0xed9e('0x22')](function(_0x2b4d72){if(_0x2b4d72){_0x22c470=_0x2b4d72;return _0x2b4d72[_0xed9e('0x69')]();}return null;})[_0xed9e('0x22')](function(_0x7b68d0){if(_0x7b68d0){if(!_0x7b68d0[_0xed9e('0x34')]){throw new db['Sequelize'][(_0xed9e('0x6b'))](_0xed9e('0x89'),0x193);}_0x2a863f=_0x7b68d0;return db[_0xed9e('0x6c')][_0xed9e('0x3f')]({'raw':!![]});}return null;})[_0xed9e('0x22')](function(_0xaa1450){if(_0xaa1450){_0x2e04f0=_['keyBy'](_0xaa1450,'id');var _0x2b68d5;var _0x18664e=squel[_0xed9e('0x6e')]();_0x18664e[_0xed9e('0x6f')](_0x22c470[_0xed9e('0x8a')]);for(var _0x594f78=0x0;_0x594f78<_0x2a863f[_0xed9e('0x34')];_0x594f78+=0x1){_0x2b68d5=_0x2a863f[_0x594f78][_0xed9e('0x70')]?_0x2e04f0[_0x2a863f[_0x594f78][_0xed9e('0x70')]][_0xed9e('0x71')]:_0x2a863f[_0x594f78][_0xed9e('0x65')];_0x2b68d5=_0x2a863f[_0x594f78][_0xed9e('0x72')]?_[_0xed9e('0x74')](_0x3e3973[_0x2a863f[_0x594f78]['function']],'%s',_0x2b68d5):_0x2b68d5;_0x2b68d5=_0x2a863f[_0x594f78]['format']?_['replace'](_0x38117e[_0x2a863f[_0x594f78][_0xed9e('0x73')]],'%s',_0x2b68d5):_0x2b68d5;if(_0x2a863f[_0x594f78][_0xed9e('0x8b')]){_0x18664e['group'](_0x2b68d5);}_0x2a863f[_0x594f78][_0xed9e('0x8c')]&&_0x18664e[_0xed9e('0x37')](_0x2b68d5,_0x2a863f[_0x594f78][_0xed9e('0x8c')]===_0xed9e('0x75')?![]:!![]);_0x18664e[_0xed9e('0x65')](_0x2b68d5,_0x2a863f[_0x594f78][_0xed9e('0x76')]||_0x2b68d5);}if(_0x22c470[_0xed9e('0x77')]){_0x22c470[_0xed9e('0x77')]=JSON[_0xed9e('0x78')](_0x22c470[_0xed9e('0x77')]);for(var _0x9845ac=0x0;_0x9845ac<_0x22c470[_0xed9e('0x77')][_0xed9e('0x34')];_0x9845ac+=0x1){if(_0x22c470[_0xed9e('0x77')][_0x9845ac][_0xed9e('0x2c')]&&_['includes'](_0x560be4,_0x22c470['joins'][_0x9845ac][_0xed9e('0x2c')])&&_0x22c470[_0xed9e('0x77')][_0x9845ac][_0xed9e('0x79')]&&_0x22c470[_0xed9e('0x77')][_0x9845ac][_0xed9e('0x7b')]&&_0x22c470[_0xed9e('0x77')][_0x9845ac][_0xed9e('0x7a')]){_0x18664e[_0x22c470[_0xed9e('0x77')][_0x9845ac][_0xed9e('0x2c')]](_0x22c470[_0xed9e('0x77')][_0x9845ac][_0xed9e('0x7b')],null,util[_0xed9e('0x73')]('%s.%s\x20=\x20%s.%s',_0x22c470[_0xed9e('0x8a')],_0x22c470[_0xed9e('0x77')][_0x9845ac]['parentKey'],_0x22c470[_0xed9e('0x77')][_0x9845ac]['foreignTable'],_0x22c470[_0xed9e('0x77')][_0x9845ac]['foreignKey']));}}}if(_0x22c470[_0xed9e('0x7d')]){_0x22c470['conditions']=JSON[_0xed9e('0x78')](_0x22c470[_0xed9e('0x7d')]);_0x18664e[_0xed9e('0x3a')](_0x3b11ad(_0x22c470[_0xed9e('0x7d')]['group']));}_0x27ece7=_0x18664e[_0xed9e('0x7e')]();_0x18664e['limit'](_0x27b79b);_0x18664e['offset'](0x0);logger['debug'](_0xed9e('0x80'),_0x18664e[_0xed9e('0x81')]());return dbH[_0xed9e('0x82')][_0xed9e('0x2f')](_0x18664e['toString'](),{'type':dbH[_0xed9e('0x82')]['QueryTypes'][_0xed9e('0x84')]});}})['then'](function(){return{'sql':_0x27ece7[_0xed9e('0x81')]()};})[_0xed9e('0x22')](respondWithResult(_0x1f4889,null))['catch'](handleError(_0x1f4889,null));}; \ No newline at end of file +var _0xf80a=['to-csv','ejs','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','include','findAll','params','length','includeAll','find','catch','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','output','fullPath','randomstring','generate','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','ValidationErrorItem','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox'];(function(_0x1f35f8,_0x31259c){var _0x2a8bea=function(_0x41b1d0){while(--_0x41b1d0){_0x1f35f8['push'](_0x1f35f8['shift']());}};_0x2a8bea(++_0x31259c);}(_0xf80a,0x13a));var _0xaf80=function(_0x5a5d97,_0x300be6){_0x5a5d97=_0x5a5d97-0x0;var _0x4c4d27=_0xf80a[_0x5a5d97];return _0x4c4d27;};'use strict';var emlformat=require(_0xaf80('0x0'));var rimraf=require(_0xaf80('0x1'));var zipdir=require(_0xaf80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaf80('0x3'));var BPromise=require(_0xaf80('0x4'));var Mustache=require(_0xaf80('0x5'));var util=require(_0xaf80('0x6'));var path=require('path');var sox=require(_0xaf80('0x7'));var csv=require(_0xaf80('0x8'));var ejs=require(_0xaf80('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf80('0xa'));var toCsv=require(_0xaf80('0x8'));var querystring=require(_0xaf80('0xb'));var Papa=require('papaparse');var Redis=require(_0xaf80('0xc'));var authService=require(_0xaf80('0xd'));var qs=require(_0xaf80('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf80('0xf'))(_0xaf80('0x10'));var utils=require(_0xaf80('0x11'));var config=require(_0xaf80('0x12'));var licenseUtil=require(_0xaf80('0x13'));var db=require(_0xaf80('0x14'))['db'];var dbH=require(_0xaf80('0x14'))[_0xaf80('0x15')];function respondWithStatusCode(_0x3d075a,_0x153539){_0x153539=_0x153539||0xcc;return function(_0x4256af){if(_0x4256af){return _0x3d075a[_0xaf80('0x16')](_0x153539);}return _0x3d075a[_0xaf80('0x17')](_0x153539)['end']();};}function respondWithResult(_0x3e64bf,_0x4f390c){_0x4f390c=_0x4f390c||0xc8;return function(_0x1e204f){if(_0x1e204f){return _0x3e64bf[_0xaf80('0x17')](_0x4f390c)[_0xaf80('0x18')](_0x1e204f);}};}function respondWithFilteredResult(_0x38b907,_0x118fba){return function(_0xcd948){if(_0xcd948){var _0x23ed48=typeof _0x118fba[_0xaf80('0x19')]==='undefined'&&typeof _0x118fba['limit']===_0xaf80('0x1a');var _0x1ba6f8=_0xcd948[_0xaf80('0x1b')];var _0x174a40=_0x23ed48?0x0:_0x118fba[_0xaf80('0x19')];var _0x31e2e0=_0x23ed48?_0xcd948[_0xaf80('0x1b')]:_0x118fba[_0xaf80('0x19')]+_0x118fba['limit'];var _0xe48bb1;if(_0x31e2e0>=_0x1ba6f8){_0x31e2e0=_0x1ba6f8;_0xe48bb1=0xc8;}else{_0xe48bb1=0xce;}_0x38b907[_0xaf80('0x17')](_0xe48bb1);return _0x38b907[_0xaf80('0x1c')](_0xaf80('0x1d'),_0x174a40+'-'+_0x31e2e0+'/'+_0x1ba6f8)[_0xaf80('0x18')](_0xcd948);}return null;};}function patchUpdates(_0x4b4a94){return function(_0x105ec1){try{jsonpatch[_0xaf80('0x1e')](_0x105ec1,_0x4b4a94,!![]);}catch(_0x2968cd){return BPromise[_0xaf80('0x1f')](_0x2968cd);}return _0x105ec1[_0xaf80('0x20')]();};}function saveUpdates(_0x2ae065,_0x2dec6a){return function(_0x33c661){if(_0x33c661){return _0x33c661[_0xaf80('0x21')](_0x2ae065)['then'](function(_0x2427c7){return _0x2427c7;});}return null;};}function removeEntity(_0x23d9d9,_0x3e8720){return function(_0x1c571d){if(_0x1c571d){return _0x1c571d[_0xaf80('0x22')]()[_0xaf80('0x23')](function(){var _0x1e4ff0=_0x1c571d[_0xaf80('0x24')]({'plain':!![]});var _0x2f2a99=_0xaf80('0x25');return db[_0xaf80('0x26')][_0xaf80('0x22')]({'where':{'type':_0x2f2a99,'resourceId':_0x1e4ff0['id']}})[_0xaf80('0x23')](function(){return _0x1c571d;});})[_0xaf80('0x23')](function(){_0x23d9d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fc0c1,_0x2cf638){return function(_0x407f1e){if(!_0x407f1e){_0x3fc0c1['sendStatus'](0x194);}return _0x407f1e;};}function handleError(_0x4c23be,_0x43bb8f){_0x43bb8f=_0x43bb8f||0x1f4;return function(_0xae5ff8){logger[_0xaf80('0x27')](_0xae5ff8[_0xaf80('0x28')]);if(_0xae5ff8[_0xaf80('0x29')]){delete _0xae5ff8['name'];}_0x4c23be[_0xaf80('0x17')](_0x43bb8f)[_0xaf80('0x2a')](_0xae5ff8);};}exports['index']=function(_0x2944ee,_0x3ea868){var _0x4069ea={},_0x2045dc={},_0x520d08={'count':0x0,'rows':[]};var _0x4a508=_['map'](db[_0xaf80('0x2b')][_0xaf80('0x2c')],function(_0x1a8f9e){return{'name':_0x1a8f9e[_0xaf80('0x2d')],'type':_0x1a8f9e[_0xaf80('0x2e')]['key']};});_0x2045dc[_0xaf80('0x2f')]=_[_0xaf80('0x30')](_0x4a508,_0xaf80('0x29'));_0x2045dc['query']=_[_0xaf80('0x31')](_0x2944ee[_0xaf80('0x32')]);_0x2045dc['filters']=_[_0xaf80('0x33')](_0x2045dc[_0xaf80('0x2f')],_0x2045dc[_0xaf80('0x32')]);_0x4069ea[_0xaf80('0x34')]=_[_0xaf80('0x33')](_0x2045dc['model'],qs[_0xaf80('0x35')](_0x2944ee[_0xaf80('0x32')]['fields']));_0x4069ea['attributes']=_0x4069ea[_0xaf80('0x34')]['length']?_0x4069ea[_0xaf80('0x34')]:_0x2045dc[_0xaf80('0x2f')];if(!_0x2944ee['query'][_0xaf80('0x36')](_0xaf80('0x37'))){_0x4069ea[_0xaf80('0x38')]=qs['limit'](_0x2944ee[_0xaf80('0x32')][_0xaf80('0x38')]);_0x4069ea[_0xaf80('0x19')]=qs[_0xaf80('0x19')](_0x2944ee['query']['offset']);}_0x4069ea[_0xaf80('0x39')]=qs[_0xaf80('0x3a')](_0x2944ee[_0xaf80('0x32')][_0xaf80('0x3a')]);_0x4069ea[_0xaf80('0x3b')]=qs[_0xaf80('0x3c')](_[_0xaf80('0x3d')](_0x2944ee[_0xaf80('0x32')],_0x2045dc[_0xaf80('0x3c')]),_0x4a508);if(_0x2944ee[_0xaf80('0x32')]['filter']){_0x4069ea['where']=_[_0xaf80('0x3e')](_0x4069ea[_0xaf80('0x3b')],{'$or':_[_0xaf80('0x30')](_0x4a508,function(_0x2d151b){if(_0x2d151b[_0xaf80('0x2e')]!=='VIRTUAL'){var _0x486f63={};_0x486f63[_0x2d151b[_0xaf80('0x29')]]={'$like':'%'+_0x2944ee[_0xaf80('0x32')][_0xaf80('0x3f')]+'%'};return _0x486f63;}})});}_0x4069ea=_[_0xaf80('0x3e')]({},_0x4069ea,_0x2944ee[_0xaf80('0x40')]);var _0x5b3e05={'where':_0x4069ea[_0xaf80('0x3b')]};return db[_0xaf80('0x2b')][_0xaf80('0x1b')](_0x5b3e05)[_0xaf80('0x23')](function(_0x1caf74){_0x520d08['count']=_0x1caf74;if(_0x2944ee[_0xaf80('0x32')]['includeAll']){_0x4069ea[_0xaf80('0x41')]=[{'all':!![]}];}return db[_0xaf80('0x2b')][_0xaf80('0x42')](_0x4069ea);})[_0xaf80('0x23')](function(_0x441170){_0x520d08['rows']=_0x441170;return _0x520d08;})[_0xaf80('0x23')](respondWithFilteredResult(_0x3ea868,_0x4069ea))['catch'](handleError(_0x3ea868,null));};exports['show']=function(_0x1e164e,_0x1c089a){var _0x42fc1d={'raw':![],'where':{'id':_0x1e164e[_0xaf80('0x43')]['id']}},_0x5cd3fb={};_0x5cd3fb[_0xaf80('0x2f')]=_[_0xaf80('0x31')](db['AnalyticCustomReport'][_0xaf80('0x2c')]);_0x5cd3fb[_0xaf80('0x32')]=_[_0xaf80('0x31')](_0x1e164e[_0xaf80('0x32')]);_0x5cd3fb[_0xaf80('0x3c')]=_[_0xaf80('0x33')](_0x5cd3fb[_0xaf80('0x2f')],_0x5cd3fb['query']);_0x42fc1d[_0xaf80('0x34')]=_[_0xaf80('0x33')](_0x5cd3fb['model'],qs[_0xaf80('0x35')](_0x1e164e[_0xaf80('0x32')]['fields']));_0x42fc1d[_0xaf80('0x34')]=_0x42fc1d[_0xaf80('0x34')][_0xaf80('0x44')]?_0x42fc1d['attributes']:_0x5cd3fb[_0xaf80('0x2f')];if(_0x1e164e[_0xaf80('0x32')][_0xaf80('0x45')]){_0x42fc1d[_0xaf80('0x41')]=[{'all':!![]}];}_0x42fc1d=_['merge']({},_0x42fc1d,_0x1e164e[_0xaf80('0x40')]);return db['AnalyticCustomReport'][_0xaf80('0x46')](_0x42fc1d)[_0xaf80('0x23')](handleEntityNotFound(_0x1c089a,null))[_0xaf80('0x23')](respondWithResult(_0x1c089a,null))[_0xaf80('0x47')](handleError(_0x1c089a,null));};exports[_0xaf80('0x48')]=function(_0x27a7eb,_0x5a61cc){return db[_0xaf80('0x2b')]['create'](_0x27a7eb[_0xaf80('0x49')],{})[_0xaf80('0x23')](function(_0x22ad9f){var _0x483f6c=_0x27a7eb[_0xaf80('0x4a')][_0xaf80('0x24')]({'plain':!![]});if(!_0x483f6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x483f6c[_0xaf80('0x4b')]==='user'){var _0x32c0bf=_0x22ad9f[_0xaf80('0x24')]({'plain':!![]});var _0x4363e7=_0xaf80('0x4c');return db[_0xaf80('0x4d')][_0xaf80('0x46')]({'where':{'name':_0x4363e7,'userProfileId':_0x483f6c[_0xaf80('0x4e')]},'raw':!![]})[_0xaf80('0x23')](function(_0x43d522){if(_0x43d522&&_0x43d522[_0xaf80('0x4f')]===0x0){return db[_0xaf80('0x26')][_0xaf80('0x48')]({'name':_0x32c0bf[_0xaf80('0x29')],'resourceId':_0x32c0bf['id'],'type':_0xaf80('0x25'),'sectionId':_0x43d522['id']},{})[_0xaf80('0x23')](function(){return _0x22ad9f;});}else{return _0x22ad9f;}})[_0xaf80('0x47')](function(_0x5529ed){logger['error'](_0xaf80('0x50'),_0x5529ed);throw _0x5529ed;});}return _0x22ad9f;})[_0xaf80('0x23')](respondWithResult(_0x5a61cc,0xc9))[_0xaf80('0x47')](handleError(_0x5a61cc,null));};exports[_0xaf80('0x21')]=function(_0xa3d8f8,_0x4b35c0){if(_0xa3d8f8['body']['id']){delete _0xa3d8f8[_0xaf80('0x49')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0xa3d8f8['params']['id']}})[_0xaf80('0x23')](handleEntityNotFound(_0x4b35c0,null))[_0xaf80('0x23')](saveUpdates(_0xa3d8f8[_0xaf80('0x49')],null))[_0xaf80('0x23')](respondWithResult(_0x4b35c0,null))[_0xaf80('0x47')](handleError(_0x4b35c0,null));};exports[_0xaf80('0x22')]=function(_0x37050b,_0x33a397){return db[_0xaf80('0x2b')][_0xaf80('0x46')]({'where':{'id':_0x37050b['params']['id']}})['then'](handleEntityNotFound(_0x33a397,null))[_0xaf80('0x23')](removeEntity(_0x33a397,null))[_0xaf80('0x47')](handleError(_0x33a397,null));};exports[_0xaf80('0x51')]=function(_0x269193,_0x5cdb3a){var _0xfe82af=0xa;var _0x1c4627=[_0xaf80('0x52'),_0xaf80('0x53'),_0xaf80('0x54'),_0xaf80('0x55')];var _0x3e0ba9={'SUM':_0xaf80('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xaf80('0x57'),'MAX':_0xaf80('0x58'),'MIN':_0xaf80('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xaf80('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x32bdff={'SEC_TO_TIME':_0xaf80('0x5b'),'DATE':'DATE(%s)','HOUR':_0xaf80('0x5c'),'ROUND':_0xaf80('0x5d'),'UNIX_TIMESTAMP':_0xaf80('0x5e')};var _0x46a5b2=function(_0x4a3f87){return!_[_0xaf80('0x5f')]([_0xaf80('0x60'),_0xaf80('0x61'),_0xaf80('0x62'),_0xaf80('0x63')],_0x4a3f87);};var _0x3baabf=function(_0x1b019c){if(!_0x1b019c||!_0x1b019c[_0xaf80('0x64')][_0xaf80('0x44')]){return'';}for(var _0x2a6206='(',_0xf95e74=0x0;_0xf95e74<_0x1b019c[_0xaf80('0x64')][_0xaf80('0x44')];_0xf95e74+=0x1){_0xf95e74>0x0&&(_0x2a6206+='\x20'+_0x1b019c[_0xaf80('0x65')]+'\x20');_0x2a6206+=_0x1b019c[_0xaf80('0x64')][_0xf95e74][_0xaf80('0x66')]?_0x3baabf(_0x1b019c[_0xaf80('0x64')][_0xf95e74]['group']):_0x1b019c[_0xaf80('0x64')][_0xf95e74][_0xaf80('0x67')]+'\x20'+_0x1b019c[_0xaf80('0x64')][_0xf95e74][_0xaf80('0x68')]+(_0x46a5b2(_0x1b019c[_0xaf80('0x64')][_0xf95e74][_0xaf80('0x68')])?'\x20'+_0x1b019c[_0xaf80('0x64')][_0xf95e74][_0xaf80('0x69')]:'');}return _0x2a6206+')';};var _0x26afd4={'where':{'id':_0x269193[_0xaf80('0x43')]['id']}},_0x575742,_0x25058b,_0x500222,_0xfc2f1c,_0x55fdf2;_0x26afd4=_[_0xaf80('0x3e')]({},_0x26afd4,_0x269193[_0xaf80('0x40')]);return db[_0xaf80('0x2b')]['find'](_0x26afd4)['then'](function(_0x1790f6){if(_0x1790f6){_0x575742=_0x1790f6;return _0x1790f6[_0xaf80('0x6a')]();}return null;})[_0xaf80('0x23')](function(_0x15e6a6){if(_0x15e6a6){if(!_0x15e6a6[_0xaf80('0x44')]){throw new db[(_0xaf80('0x6b'))]['ValidationErrorItem'](_0xaf80('0x6c'),0x193);}_0x25058b=_0x15e6a6;return db[_0xaf80('0x6d')][_0xaf80('0x42')]({'raw':!![]});}return null;})[_0xaf80('0x23')](function(_0x184413){if(_0x184413){_0x500222=_[_0xaf80('0x6e')](_0x184413,'id');var _0x1316c6;var _0x19d1aa=squel[_0xaf80('0x6f')]();_0x19d1aa[_0xaf80('0x70')](_0x575742[_0xaf80('0x71')]);for(var _0x1c4f03=0x0;_0x1c4f03<_0x25058b[_0xaf80('0x44')];_0x1c4f03+=0x1){_0x1316c6=_0x25058b[_0x1c4f03][_0xaf80('0x72')]?_0x500222[_0x25058b[_0x1c4f03][_0xaf80('0x72')]][_0xaf80('0x73')]:_0x25058b[_0x1c4f03]['field'];_0x1316c6=_0x25058b[_0x1c4f03][_0xaf80('0x74')]?_[_0xaf80('0x75')](_0x3e0ba9[_0x25058b[_0x1c4f03][_0xaf80('0x74')]],'%s',_0x1316c6):_0x1316c6;_0x1316c6=_0x25058b[_0x1c4f03][_0xaf80('0x76')]?_[_0xaf80('0x75')](_0x32bdff[_0x25058b[_0x1c4f03]['format']],'%s',_0x1316c6):_0x1316c6;if(_0x25058b[_0x1c4f03][_0xaf80('0x77')]){_0x19d1aa[_0xaf80('0x66')](_0x1316c6);}_0x25058b[_0x1c4f03][_0xaf80('0x78')]&&_0x19d1aa[_0xaf80('0x39')](_0x1316c6,_0x25058b[_0x1c4f03][_0xaf80('0x78')]===_0xaf80('0x79')?![]:!![]);_0x19d1aa['field'](_0x1316c6,_0x25058b[_0x1c4f03][_0xaf80('0x7a')]||_0x1316c6);}if(_0x575742[_0xaf80('0x7b')]){_0x575742['joins']=JSON[_0xaf80('0x7c')](_0x575742[_0xaf80('0x7b')]);for(var _0x49c840=0x0;_0x49c840<_0x575742['joins'][_0xaf80('0x44')];_0x49c840+=0x1){if(_0x575742[_0xaf80('0x7b')][_0x49c840][_0xaf80('0x2e')]&&_[_0xaf80('0x5f')](_0x1c4627,_0x575742['joins'][_0x49c840]['type'])&&_0x575742[_0xaf80('0x7b')][_0x49c840][_0xaf80('0x7d')]&&_0x575742['joins'][_0x49c840][_0xaf80('0x7e')]&&_0x575742[_0xaf80('0x7b')][_0x49c840]['foreignKey']){_0x19d1aa[_0x575742['joins'][_0x49c840][_0xaf80('0x2e')]](_0x575742[_0xaf80('0x7b')][_0x49c840]['foreignTable'],null,util[_0xaf80('0x76')]('%s.%s\x20=\x20%s.%s',_0x575742[_0xaf80('0x71')],_0x575742[_0xaf80('0x7b')][_0x49c840][_0xaf80('0x7d')],_0x575742[_0xaf80('0x7b')][_0x49c840]['foreignTable'],_0x575742['joins'][_0x49c840][_0xaf80('0x7f')]));}}}if(_0x575742[_0xaf80('0x80')]){_0x575742[_0xaf80('0x80')]=JSON[_0xaf80('0x7c')](_0x575742['conditions']);_0x19d1aa[_0xaf80('0x3b')](_0x3baabf(_0x575742[_0xaf80('0x80')][_0xaf80('0x66')]));}_0x55fdf2=_0x19d1aa[_0xaf80('0x81')]();_0x19d1aa[_0xaf80('0x38')](_0xfe82af);_0x19d1aa[_0xaf80('0x19')](0x0);logger[_0xaf80('0x82')](_0xaf80('0x83'),_0x19d1aa['toString']());return dbH[_0xaf80('0x84')][_0xaf80('0x32')](_0x19d1aa[_0xaf80('0x85')](),{'type':dbH[_0xaf80('0x84')][_0xaf80('0x86')]['SELECT']});}})['then'](respondWithResult(_0x5cdb3a,null))['catch'](handleError(_0x5cdb3a,null));};function runReport(_0x2685b0,_0x87bdd3,_0x1003d0){var _0x150863=_0x87bdd3[_0xaf80('0x29')];var _0x32b0c3=0xa;var _0x2bd18d=[_0xaf80('0x52'),'left_join',_0xaf80('0x54'),'cross_join'];var _0x289489={'SUM':'SUM(%s)','COUNT':_0xaf80('0x87'),'COUNT DISTINCT':_0xaf80('0x57'),'MAX':'MAX(%s)','MIN':_0xaf80('0x59'),'AVG':_0xaf80('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xaf80('0x89'),'GROUP_CONCAT DESC':_0xaf80('0x8a')};var _0xdd9d0a={'SEC_TO_TIME':_0xaf80('0x5b'),'DATE':_0xaf80('0x8b'),'HOUR':_0xaf80('0x5c'),'ROUND':_0xaf80('0x5d'),'UNIX_TIMESTAMP':_0xaf80('0x5e')};var _0xda488c=function(_0x335b69){return!_[_0xaf80('0x5f')]([_0xaf80('0x60'),'IS\x20NOT\x20NULL',_0xaf80('0x62'),_0xaf80('0x63')],_0x335b69);};var _0x2fd4c7=function(_0x401249){if(!_0x401249||!_0x401249[_0xaf80('0x64')][_0xaf80('0x44')]){return'';}for(var _0x2f1b00='(',_0x2fc719=0x0;_0x2fc719<_0x401249['rules']['length'];_0x2fc719+=0x1){_0x2fc719>0x0&&(_0x2f1b00+='\x20'+_0x401249[_0xaf80('0x65')]+'\x20');_0x2f1b00+=_0x401249[_0xaf80('0x64')][_0x2fc719][_0xaf80('0x66')]?_0x2fd4c7(_0x401249[_0xaf80('0x64')][_0x2fc719][_0xaf80('0x66')]):_0x401249[_0xaf80('0x64')][_0x2fc719]['field']+'\x20'+_0x401249[_0xaf80('0x64')][_0x2fc719][_0xaf80('0x68')]+(_0xda488c(_0x401249[_0xaf80('0x64')][_0x2fc719][_0xaf80('0x68')])?'\x20'+_0x401249['rules'][_0x2fc719]['value']:'');}return _0x2f1b00+')';};var _0x3d821f={'where':{'id':_0x2685b0['id']}},_0x69fcb8,_0x1fbfe3,_0x46f5eb,_0xbdeec1,_0x334358;_0x3d821f=_['merge']({},_0x3d821f,_0x1003d0);return db[_0xaf80('0x2b')][_0xaf80('0x46')](_0x3d821f)[_0xaf80('0x23')](function(_0x3b7d18){if(_0x3b7d18){_0x69fcb8=_0x3b7d18;return _0x3b7d18[_0xaf80('0x6a')]();}return null;})[_0xaf80('0x23')](function(_0x45e1eb){if(_0x45e1eb){if(!_0x45e1eb[_0xaf80('0x44')]){throw new db[(_0xaf80('0x6b'))]['ValidationErrorItem'](_0xaf80('0x6c'),0x193);}_0x1fbfe3=_0x45e1eb;return db[_0xaf80('0x6d')][_0xaf80('0x42')]({'raw':!![]});}return null;})['then'](function(_0x5569de){if(_0x5569de){_0x46f5eb=_['keyBy'](_0x5569de,'id');var _0x1004f5;var _0x46221a=squel['select']();_0x46221a[_0xaf80('0x70')](_0x69fcb8[_0xaf80('0x71')]);for(var _0x442b56=0x0;_0x442b56<_0x1fbfe3[_0xaf80('0x44')];_0x442b56+=0x1){_0x1004f5=_0x1fbfe3[_0x442b56]['MetricId']?_0x46f5eb[_0x1fbfe3[_0x442b56]['MetricId']][_0xaf80('0x73')]:_0x1fbfe3[_0x442b56]['field'];_0x1004f5=_0x1fbfe3[_0x442b56][_0xaf80('0x74')]?_[_0xaf80('0x75')](_0x289489[_0x1fbfe3[_0x442b56]['function']],'%s',_0x1004f5):_0x1004f5;_0x1004f5=_0x1fbfe3[_0x442b56][_0xaf80('0x76')]?_[_0xaf80('0x75')](_0xdd9d0a[_0x1fbfe3[_0x442b56]['format']],'%s',_0x1004f5):_0x1004f5;if(_0x1fbfe3[_0x442b56][_0xaf80('0x77')]){_0x46221a[_0xaf80('0x66')](_0x1004f5);}_0x1fbfe3[_0x442b56][_0xaf80('0x78')]&&_0x46221a[_0xaf80('0x39')](_0x1004f5,_0x1fbfe3[_0x442b56][_0xaf80('0x78')]===_0xaf80('0x79')?![]:!![]);_0x46221a[_0xaf80('0x67')](_0x1004f5,_0x1fbfe3[_0x442b56][_0xaf80('0x7a')]||_0x1004f5);}if(_0x69fcb8[_0xaf80('0x7b')]){_0x69fcb8[_0xaf80('0x7b')]=JSON[_0xaf80('0x7c')](_0x69fcb8[_0xaf80('0x7b')]);for(var _0x49b27e=0x0;_0x49b27e<_0x69fcb8[_0xaf80('0x7b')][_0xaf80('0x44')];_0x49b27e+=0x1){if(_0x69fcb8[_0xaf80('0x7b')][_0x49b27e][_0xaf80('0x2e')]&&_[_0xaf80('0x5f')](_0x2bd18d,_0x69fcb8[_0xaf80('0x7b')][_0x49b27e][_0xaf80('0x2e')])&&_0x69fcb8[_0xaf80('0x7b')][_0x49b27e][_0xaf80('0x7d')]&&_0x69fcb8[_0xaf80('0x7b')][_0x49b27e][_0xaf80('0x7e')]&&_0x69fcb8[_0xaf80('0x7b')][_0x49b27e][_0xaf80('0x7f')]){_0x46221a[_0x69fcb8['joins'][_0x49b27e][_0xaf80('0x2e')]](_0x69fcb8['joins'][_0x49b27e][_0xaf80('0x7e')],null,util[_0xaf80('0x76')]('%s.%s\x20=\x20%s.%s',_0x69fcb8[_0xaf80('0x71')],_0x69fcb8[_0xaf80('0x7b')][_0x49b27e]['parentKey'],_0x69fcb8[_0xaf80('0x7b')][_0x49b27e][_0xaf80('0x7e')],_0x69fcb8[_0xaf80('0x7b')][_0x49b27e][_0xaf80('0x7f')]));}}}if(_0x69fcb8['conditions']){_0x69fcb8[_0xaf80('0x80')]=JSON[_0xaf80('0x7c')](_0x69fcb8['conditions']);_0x46221a[_0xaf80('0x3b')](_0x2fd4c7(_0x69fcb8['conditions'][_0xaf80('0x66')]));}_0x334358=_0x46221a[_0xaf80('0x81')]();_0x46221a[_0xaf80('0x38')](_0x32b0c3);_0x46221a[_0xaf80('0x19')](0x0);return;}})[_0xaf80('0x23')](function(){if(_0x87bdd3[_0xaf80('0x8c')]==='web'){return null;}var _0x4c2dab=_[_0xaf80('0x3e')](_0x87bdd3,{'name':_0x87bdd3[_0xaf80('0x8d')]||_0x87bdd3['name']||_0x69fcb8[_0xaf80('0x29')],'basename':_0x150863,'savename':util[_0xaf80('0x76')]('%s-%s.%s',_0x87bdd3[_0xaf80('0x29')]||_0x69fcb8[_0xaf80('0x29')],require(_0xaf80('0x8e'))[_0xaf80('0x8f')](0x4),_0x87bdd3[_0xaf80('0x8c')]||_0xaf80('0x90')),'reportId':_0x69fcb8['id'],'reportType':'custom'});return db['AnalyticExtractedReport']['create'](_0x4c2dab,{'raw':!![]});})[_0xaf80('0x23')](function(_0x2f8798){if(_0x69fcb8[_0xaf80('0x71')]==='cdr'){_0x334358[_0xaf80('0x3b')](_0x69fcb8[_0xaf80('0x71')]+_0xaf80('0x91'),_0x87bdd3[_0xaf80('0x92')],_0x87bdd3[_0xaf80('0x93')]);}else{_0x334358[_0xaf80('0x3b')](_0x69fcb8[_0xaf80('0x71')]+_0xaf80('0x94'),_0x87bdd3[_0xaf80('0x92')],_0x87bdd3[_0xaf80('0x93')]);}if(_0x2f8798){logger[_0xaf80('0x95')]('Run\x20Query:',_0x334358[_0xaf80('0x85')]());require(_0xaf80('0x96'))[_0xaf80('0x97')](path['join'](__dirname,'../../components/export/',_0x2f8798[_0xaf80('0x8c')]),[_0x2f8798['id'],_0x334358['toString'](),path['join'](__dirname,_0xaf80('0x98'),_0x2f8798[_0xaf80('0x99')]),_0x150863]);return _0x2f8798;}else{var _0x40160d=squel[_0xaf80('0x6f')]();_0x40160d[_0xaf80('0x70')]('('+_0x334358['toString']()+')',_0xaf80('0x9a'));_0x40160d[_0xaf80('0x67')](_0xaf80('0x9b'),_0xaf80('0x1b'));_0x334358[_0xaf80('0x38')](_0x87bdd3[_0xaf80('0x38')]||_0x32b0c3);_0x334358[_0xaf80('0x19')](_0x87bdd3[_0xaf80('0x19')]||0x0);return dbH[_0xaf80('0x84')]['query'](_0x40160d[_0xaf80('0x85')](),{'type':dbH[_0xaf80('0x84')][_0xaf80('0x86')]['SELECT']})[_0xaf80('0x23')](function(_0x44d597){if(!_0x44d597[_0xaf80('0x44')]){_0xbdeec1=0x0;}else{_0xbdeec1=_0x44d597[0x0][_0xaf80('0x1b')]||0x0;}return dbH[_0xaf80('0x84')][_0xaf80('0x32')](_0x334358[_0xaf80('0x85')](),{'type':dbH[_0xaf80('0x84')][_0xaf80('0x86')][_0xaf80('0x9c')]});})['then'](function(_0x315bc5){return{'rows':_0x315bc5||[],'count':_0xbdeec1};});}});}exports[_0xaf80('0x9d')]=function(_0x1bb3fa,_0x202383){return runReport(_0x1bb3fa[_0xaf80('0x43')],_0x1bb3fa[_0xaf80('0x32')],_0x1bb3fa[_0xaf80('0x40')])[_0xaf80('0x23')](respondWithResult(_0x202383,null))[_0xaf80('0x47')](handleError(_0x202383,null));};exports[_0xaf80('0x9e')]=runReport;exports[_0xaf80('0x32')]=function(_0x4eebc8,_0x4de63b){var _0x265614=0xa;var _0x273224=['join','left_join',_0xaf80('0x54'),_0xaf80('0x55')];var _0x306808={'SUM':_0xaf80('0x56'),'COUNT':_0xaf80('0x87'),'COUNT DISTINCT':_0xaf80('0x57'),'MAX':_0xaf80('0x58'),'MIN':_0xaf80('0x59'),'AVG':_0xaf80('0x88'),'GROUP_CONCAT':_0xaf80('0x5a'),'GROUP_CONCAT ASC':_0xaf80('0x89'),'GROUP_CONCAT DESC':_0xaf80('0x8a')};var _0x47f386={'SEC_TO_TIME':_0xaf80('0x5b'),'DATE':_0xaf80('0x8b'),'HOUR':_0xaf80('0x5c'),'ROUND':_0xaf80('0x5d'),'UNIX_TIMESTAMP':_0xaf80('0x5e')};var _0x215e13=function(_0x532483){return!_[_0xaf80('0x5f')]([_0xaf80('0x60'),_0xaf80('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x532483);};var _0x544740=function(_0x594808){if(!_0x594808||!_0x594808[_0xaf80('0x64')][_0xaf80('0x44')]){return'';}for(var _0x470da8='(',_0x3ee65b=0x0;_0x3ee65b<_0x594808[_0xaf80('0x64')]['length'];_0x3ee65b+=0x1){_0x3ee65b>0x0&&(_0x470da8+='\x20'+_0x594808[_0xaf80('0x65')]+'\x20');_0x470da8+=_0x594808['rules'][_0x3ee65b][_0xaf80('0x66')]?_0x544740(_0x594808['rules'][_0x3ee65b]['group']):_0x594808[_0xaf80('0x64')][_0x3ee65b][_0xaf80('0x67')]+'\x20'+_0x594808[_0xaf80('0x64')][_0x3ee65b]['condition']+(_0x215e13(_0x594808[_0xaf80('0x64')][_0x3ee65b][_0xaf80('0x68')])?'\x20'+_0x594808[_0xaf80('0x64')][_0x3ee65b][_0xaf80('0x69')]:'');}return _0x470da8+')';};var _0x4fc9d2={'where':{'id':_0x4eebc8[_0xaf80('0x43')]['id']}},_0x533914,_0x3315f9,_0x2b1bfc,_0x540cc5,_0x44f8be;_0x4fc9d2=_[_0xaf80('0x3e')]({},_0x4fc9d2,_0x4eebc8[_0xaf80('0x40')]);return db[_0xaf80('0x2b')]['find'](_0x4fc9d2)[_0xaf80('0x23')](function(_0x4da8a5){if(_0x4da8a5){_0x533914=_0x4da8a5;return _0x4da8a5[_0xaf80('0x6a')]();}return null;})[_0xaf80('0x23')](function(_0x13d9c4){if(_0x13d9c4){if(!_0x13d9c4['length']){throw new db[(_0xaf80('0x6b'))][(_0xaf80('0x9f'))](_0xaf80('0x6c'),0x193);}_0x3315f9=_0x13d9c4;return db[_0xaf80('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xaf80('0x23')](function(_0x400612){if(_0x400612){_0x2b1bfc=_[_0xaf80('0x6e')](_0x400612,'id');var _0x5c5317;var _0x1bb887=squel[_0xaf80('0x6f')]();_0x1bb887['from'](_0x533914['table']);for(var _0x237f9f=0x0;_0x237f9f<_0x3315f9[_0xaf80('0x44')];_0x237f9f+=0x1){_0x5c5317=_0x3315f9[_0x237f9f][_0xaf80('0x72')]?_0x2b1bfc[_0x3315f9[_0x237f9f][_0xaf80('0x72')]]['metric']:_0x3315f9[_0x237f9f]['field'];_0x5c5317=_0x3315f9[_0x237f9f][_0xaf80('0x74')]?_[_0xaf80('0x75')](_0x306808[_0x3315f9[_0x237f9f][_0xaf80('0x74')]],'%s',_0x5c5317):_0x5c5317;_0x5c5317=_0x3315f9[_0x237f9f][_0xaf80('0x76')]?_[_0xaf80('0x75')](_0x47f386[_0x3315f9[_0x237f9f]['format']],'%s',_0x5c5317):_0x5c5317;if(_0x3315f9[_0x237f9f][_0xaf80('0x77')]){_0x1bb887[_0xaf80('0x66')](_0x5c5317);}_0x3315f9[_0x237f9f][_0xaf80('0x78')]&&_0x1bb887[_0xaf80('0x39')](_0x5c5317,_0x3315f9[_0x237f9f]['orderBy']===_0xaf80('0x79')?![]:!![]);_0x1bb887[_0xaf80('0x67')](_0x5c5317,_0x3315f9[_0x237f9f]['alias']||_0x5c5317);}if(_0x533914[_0xaf80('0x7b')]){_0x533914['joins']=JSON[_0xaf80('0x7c')](_0x533914[_0xaf80('0x7b')]);for(var _0x1cc9a7=0x0;_0x1cc9a7<_0x533914['joins']['length'];_0x1cc9a7+=0x1){if(_0x533914[_0xaf80('0x7b')][_0x1cc9a7][_0xaf80('0x2e')]&&_[_0xaf80('0x5f')](_0x273224,_0x533914[_0xaf80('0x7b')][_0x1cc9a7][_0xaf80('0x2e')])&&_0x533914[_0xaf80('0x7b')][_0x1cc9a7][_0xaf80('0x7d')]&&_0x533914[_0xaf80('0x7b')][_0x1cc9a7]['foreignTable']&&_0x533914['joins'][_0x1cc9a7][_0xaf80('0x7f')]){_0x1bb887[_0x533914[_0xaf80('0x7b')][_0x1cc9a7][_0xaf80('0x2e')]](_0x533914[_0xaf80('0x7b')][_0x1cc9a7][_0xaf80('0x7e')],null,util[_0xaf80('0x76')](_0xaf80('0xa0'),_0x533914[_0xaf80('0x71')],_0x533914['joins'][_0x1cc9a7][_0xaf80('0x7d')],_0x533914['joins'][_0x1cc9a7][_0xaf80('0x7e')],_0x533914[_0xaf80('0x7b')][_0x1cc9a7][_0xaf80('0x7f')]));}}}if(_0x533914[_0xaf80('0x80')]){_0x533914[_0xaf80('0x80')]=JSON[_0xaf80('0x7c')](_0x533914['conditions']);_0x1bb887[_0xaf80('0x3b')](_0x544740(_0x533914[_0xaf80('0x80')][_0xaf80('0x66')]));}_0x44f8be=_0x1bb887[_0xaf80('0x81')]();_0x1bb887['limit'](_0x265614);_0x1bb887['offset'](0x0);logger[_0xaf80('0x82')](_0xaf80('0x83'),_0x1bb887[_0xaf80('0x85')]());return dbH['sequelize'][_0xaf80('0x32')](_0x1bb887[_0xaf80('0x85')](),{'type':dbH[_0xaf80('0x84')][_0xaf80('0x86')][_0xaf80('0x9c')]});}})[_0xaf80('0x23')](function(){return{'sql':_0x44f8be[_0xaf80('0x85')]()};})[_0xaf80('0x23')](respondWithResult(_0x4de63b,null))['catch'](handleError(_0x4de63b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index c6cceb9..f4ba370 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 _0x2201=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2201,0x127));var _0x1220=function(_0x3465f4,_0x28b5d5){_0x3465f4=_0x3465f4-0x0;var _0xc2306c=_0x2201[_0x3465f4];return _0xc2306c;};'use strict';var _=require(_0x1220('0x0'));var util=require(_0x1220('0x1'));var logger=require(_0x1220('0x2'))('api');var moment=require(_0x1220('0x3'));var BPromise=require(_0x1220('0x4'));var rp=require(_0x1220('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1220('0x6'));var config=require(_0x1220('0x7'));var attributes=require(_0x1220('0x8'));module['exports']=function(_0x3b0b7e,_0x4fe3a6){return _0x3b0b7e['define'](_0x1220('0x9'),attributes,{'tableName':_0x1220('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04fb=['rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04fb,0xd2));var _0xb04f=function(_0x165c5c,_0x346405){_0x165c5c=_0x165c5c-0x0;var _0x3999ef=_0x04fb[_0x165c5c];return _0x3999ef;};'use strict';var _=require(_0xb04f('0x0'));var util=require(_0xb04f('0x1'));var logger=require(_0xb04f('0x2'))('api');var moment=require(_0xb04f('0x3'));var BPromise=require('bluebird');var rp=require(_0xb04f('0x4'));var fs=require('fs');var path=require(_0xb04f('0x5'));var rimraf=require(_0xb04f('0x6'));var config=require(_0xb04f('0x7'));var attributes=require(_0xb04f('0x8'));module['exports']=function(_0x537277,_0x5539e8){return _0x537277[_0xb04f('0x9')](_0xb04f('0xa'),attributes,{'tableName':_0xb04f('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 8f16d8b..2c9e3a4 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 _0xb5d2=['jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb5d2,0xd3));var _0x2b5d=function(_0x1d0cd2,_0x218b87){_0x1d0cd2=_0x1d0cd2-0x0;var _0x24a95f=_0xb5d2[_0x1d0cd2];return _0x24a95f;};'use strict';var _=require(_0x2b5d('0x0'));var util=require(_0x2b5d('0x1'));var moment=require(_0x2b5d('0x2'));var BPromise=require('bluebird');var rs=require(_0x2b5d('0x3'));var fs=require('fs');var Redis=require(_0x2b5d('0x4'));var db=require(_0x2b5d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b5d('0x6'))(_0x2b5d('0x7'));var config=require(_0x2b5d('0x8'));var jayson=require(_0x2b5d('0x9'));var client=jayson[_0x2b5d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5afebb,_0x422d3b,_0x17d7d4){return new BPromise(function(_0x1c68c5,_0x44d92c){return client[_0x2b5d('0xb')](_0x5afebb,_0x17d7d4)[_0x2b5d('0xc')](function(_0x8f249c){logger[_0x2b5d('0xd')](_0x2b5d('0xe'),_0x422d3b,_0x2b5d('0xf'));logger[_0x2b5d('0x10')](_0x2b5d('0x11'),_0x422d3b,_0x2b5d('0xf'),JSON['stringify'](_0x8f249c));if(_0x8f249c[_0x2b5d('0x12')]){if(_0x8f249c[_0x2b5d('0x12')][_0x2b5d('0x13')]===0x1f4){logger[_0x2b5d('0x12')](_0x2b5d('0xe'),_0x422d3b,_0x8f249c[_0x2b5d('0x12')]['message']);return _0x44d92c(_0x8f249c[_0x2b5d('0x12')][_0x2b5d('0x14')]);}logger['error'](_0x2b5d('0xe'),_0x422d3b,_0x8f249c['error'][_0x2b5d('0x14')]);return _0x1c68c5(_0x8f249c[_0x2b5d('0x12')]['message']);}else{logger[_0x2b5d('0xd')](_0x2b5d('0xe'),_0x422d3b,'request\x20sent');_0x1c68c5(_0x8f249c['result'][_0x2b5d('0x14')]);}})[_0x2b5d('0x15')](function(_0x1b2801){logger[_0x2b5d('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x422d3b,_0x1b2801);_0x44d92c(_0x1b2801);});});} \ No newline at end of file +var _0x6624=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','catch','lodash','moment','randomstring'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x6624,0x131));var _0x4662=function(_0x326ce1,_0x34a5b9){_0x326ce1=_0x326ce1-0x0;var _0x5c17fc=_0x6624[_0x326ce1];return _0x5c17fc;};'use strict';var _=require(_0x4662('0x0'));var util=require('util');var moment=require(_0x4662('0x1'));var BPromise=require('bluebird');var rs=require(_0x4662('0x2'));var fs=require('fs');var Redis=require(_0x4662('0x3'));var db=require(_0x4662('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4662('0x5'))(_0x4662('0x6'));var config=require('../../config/environment');var jayson=require(_0x4662('0x7'));var client=jayson[_0x4662('0x8')][_0x4662('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33239c,_0x23a3ca,_0x4739da){return new BPromise(function(_0x5a3175,_0x354c92){return client[_0x4662('0xa')](_0x33239c,_0x4739da)[_0x4662('0xb')](function(_0x5bdada){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x23a3ca,_0x4662('0xc'));logger[_0x4662('0xd')](_0x4662('0xe'),_0x23a3ca,_0x4662('0xc'),JSON[_0x4662('0xf')](_0x5bdada));if(_0x5bdada[_0x4662('0x10')]){if(_0x5bdada[_0x4662('0x10')][_0x4662('0x11')]===0x1f4){logger[_0x4662('0x10')](_0x4662('0x12'),_0x23a3ca,_0x5bdada[_0x4662('0x10')][_0x4662('0x13')]);return _0x354c92(_0x5bdada[_0x4662('0x10')][_0x4662('0x13')]);}logger['error'](_0x4662('0x12'),_0x23a3ca,_0x5bdada[_0x4662('0x10')][_0x4662('0x13')]);return _0x5a3175(_0x5bdada['error']['message']);}else{logger[_0x4662('0x14')](_0x4662('0x12'),_0x23a3ca,_0x4662('0xc'));_0x5a3175(_0x5bdada['result'][_0x4662('0x13')]);}})[_0x4662('0x15')](function(_0x55dd58){logger[_0x4662('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x23a3ca,_0x55dd58);_0x354c92(_0x55dd58);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 4db7ce7..2375fdc 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 _0x219a=['show','/:id/preview','preview','/:id/run','/:id/query','create','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id'];(function(_0x199b59,_0x25a5bc){var _0x179e10=function(_0x510342){while(--_0x510342){_0x199b59['push'](_0x199b59['shift']());}};_0x179e10(++_0x25a5bc);}(_0x219a,0xb3));var _0xa219=function(_0x517c97,_0x3fd275){_0x517c97=_0x517c97-0x0;var _0x244ef3=_0x219a[_0x517c97];return _0x244ef3;};'use strict';var multer=require('multer');var util=require(_0xa219('0x0'));var path=require(_0xa219('0x1'));var timeout=require(_0xa219('0x2'));var express=require('express');var router=express[_0xa219('0x3')]();var fs_extra=require(_0xa219('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa219('0x5'));var config=require(_0xa219('0x6'));var controller=require(_0xa219('0x7'));router['get']('/',auth[_0xa219('0x8')](),controller['index']);router[_0xa219('0x9')](_0xa219('0xa'),auth[_0xa219('0x8')](),controller[_0xa219('0xb')]);router[_0xa219('0x9')](_0xa219('0xc'),auth[_0xa219('0x8')](),controller[_0xa219('0xd')]);router[_0xa219('0x9')](_0xa219('0xe'),auth[_0xa219('0x8')](),controller['run']);router[_0xa219('0x9')](_0xa219('0xf'),auth[_0xa219('0x8')](),controller['query']);router['post']('/',auth[_0xa219('0x8')](),controller[_0xa219('0x10')]);router['put'](_0xa219('0xa'),auth[_0xa219('0x8')](),controller['update']);router[_0xa219('0x11')](_0xa219('0xa'),auth[_0xa219('0x8')](),controller['destroy']);module[_0xa219('0x12')]=router; \ No newline at end of file +var _0x903d=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','query','post','create','put','delete','multer','util'];(function(_0x1945ec,_0x17e9f9){var _0x5be70b=function(_0x571a97){while(--_0x571a97){_0x1945ec['push'](_0x1945ec['shift']());}};_0x5be70b(++_0x17e9f9);}(_0x903d,0x163));var _0xd903=function(_0x5aec18,_0xe60625){_0x5aec18=_0x5aec18-0x0;var _0x578370=_0x903d[_0x5aec18];return _0x578370;};'use strict';var multer=require(_0xd903('0x0'));var util=require(_0xd903('0x1'));var path=require(_0xd903('0x2'));var timeout=require('connect-timeout');var express=require(_0xd903('0x3'));var router=express['Router']();var fs_extra=require(_0xd903('0x4'));var auth=require(_0xd903('0x5'));var interaction=require(_0xd903('0x6'));var config=require('../../config/environment');var controller=require(_0xd903('0x7'));router[_0xd903('0x8')]('/',auth[_0xd903('0x9')](),controller[_0xd903('0xa')]);router['get'](_0xd903('0xb'),auth[_0xd903('0x9')](),controller[_0xd903('0xc')]);router[_0xd903('0x8')](_0xd903('0xd'),auth[_0xd903('0x9')](),controller[_0xd903('0xe')]);router[_0xd903('0x8')](_0xd903('0xf'),auth[_0xd903('0x9')](),controller['run']);router[_0xd903('0x8')]('/:id/query',auth[_0xd903('0x9')](),controller[_0xd903('0x10')]);router[_0xd903('0x11')]('/',auth['isAuthenticated'](),controller[_0xd903('0x12')]);router[_0xd903('0x13')](_0xd903('0xb'),auth[_0xd903('0x9')](),controller['update']);router[_0xd903('0x14')](_0xd903('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b6c95a6..fcce017 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 _0x7fbe=['STRING','TEXT'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x48cf09,_0x3b5f6c){_0x48cf09=_0x48cf09-0x0;var _0x203b57=_0x7fbe[_0x48cf09];return _0x203b57;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x27d408,_0x33967e){var _0x2187ee=function(_0x3b383e){while(--_0x3b383e){_0x27d408['push'](_0x27d408['shift']());}};_0x2187ee(++_0x33967e);}(_0xb138,0x1dd));var _0x8b13=function(_0x13f251,_0x50734d){_0x13f251=_0x13f251-0x0;var _0x3bbb59=_0xb138[_0x13f251];return _0x3bbb59;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 21eca00..e220744 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 _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x175e8b,_0x4944c6){var _0x379185=function(_0x4807e8){while(--_0x4807e8){_0x175e8b['push'](_0x175e8b['shift']());}};_0x379185(++_0x4944c6);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2ec699,_0x24e473){_0x2ec699=_0x2ec699-0x0;var _0x3c4349=_0x3f8a[_0x2ec699];return _0x3c4349;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file +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(_0x2c3f37,_0x5a46b6){var _0x12a453=function(_0x506351){while(--_0x506351){_0x2c3f37['push'](_0x2c3f37['shift']());}};_0x12a453(++_0x5a46b6);}(_0x4819,0xcd));var _0x9481=function(_0x27e321,_0x222eb5){_0x27e321=_0x27e321-0x0;var _0x19ac6c=_0x4819[_0x27e321];return _0x19ac6c;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 4edb641..6bc8b9e 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 _0x9110=['AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x5c6c2e,_0x86e980){var _0xd262ac=function(_0x2469a1){while(--_0x2469a1){_0x5c6c2e['push'](_0x5c6c2e['shift']());}};_0xd262ac(++_0x86e980);}(_0x9110,0x138));var _0x0911=function(_0x535336,_0x910777){_0x535336=_0x535336-0x0;var _0xd9ca7e=_0x9110[_0x535336];return _0xd9ca7e;};'use strict';var _=require('lodash');var util=require(_0x0911('0x0'));var logger=require(_0x0911('0x1'))(_0x0911('0x2'));var moment=require(_0x0911('0x3'));var BPromise=require(_0x0911('0x4'));var rp=require(_0x0911('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0911('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x0911('0x7')]=function(_0x7afff1,_0x99bf51){return _0x7afff1['define'](_0x0911('0x8'),attributes,{'tableName':_0x0911('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc253=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc253,0x1ad));var _0x3c25=function(_0x2bfd4f,_0x1bbf2c){_0x2bfd4f=_0x2bfd4f-0x0;var _0x341849=_0xc253[_0x2bfd4f];return _0x341849;};'use strict';var _=require(_0x3c25('0x0'));var util=require('util');var logger=require(_0x3c25('0x1'))(_0x3c25('0x2'));var moment=require('moment');var BPromise=require(_0x3c25('0x3'));var rp=require(_0x3c25('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c25('0x5'));var config=require(_0x3c25('0x6'));var attributes=require(_0x3c25('0x7'));module['exports']=function(_0x553435,_0x5754c5){return _0x553435[_0x3c25('0x8')](_0x3c25('0x9'),attributes,{'tableName':_0x3c25('0xa'),'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 bc709df..dcec7b8 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 _0x26ad=['jayson/promise','client','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0x26ad,0x67));var _0xd26a=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0x26ad[_0x1b6311];return _0x25aab6;};'use strict';var _=require(_0xd26a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd26a('0x1'));var rs=require(_0xd26a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd26a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd26a('0x4'));var config=require('../../config/environment');var jayson=require(_0xd26a('0x5'));var client=jayson[_0xd26a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x392b13,_0x63be48,_0x34406b){return new BPromise(function(_0x2c619e,_0x132a51){return client['request'](_0x392b13,_0x34406b)['then'](function(_0x3f09d4){logger[_0xd26a('0x7')](_0xd26a('0x8'),_0x63be48,'request\x20sent');logger[_0xd26a('0x9')](_0xd26a('0xa'),_0x63be48,_0xd26a('0xb'),JSON[_0xd26a('0xc')](_0x3f09d4));if(_0x3f09d4[_0xd26a('0xd')]){if(_0x3f09d4[_0xd26a('0xd')][_0xd26a('0xe')]===0x1f4){logger['error'](_0xd26a('0x8'),_0x63be48,_0x3f09d4[_0xd26a('0xd')]['message']);return _0x132a51(_0x3f09d4['error'][_0xd26a('0xf')]);}logger['error'](_0xd26a('0x8'),_0x63be48,_0x3f09d4['error'][_0xd26a('0xf')]);return _0x2c619e(_0x3f09d4[_0xd26a('0xd')][_0xd26a('0xf')]);}else{logger['info'](_0xd26a('0x8'),_0x63be48,_0xd26a('0xb'));_0x2c619e(_0x3f09d4[_0xd26a('0x10')][_0xd26a('0xf')]);}})[_0xd26a('0x11')](function(_0x15b57a){logger[_0xd26a('0xd')](_0xd26a('0x8'),_0x63be48,_0x15b57a);_0x132a51(_0x15b57a);});});} \ No newline at end of file +var _0x02cd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment'];(function(_0x5d5cc4,_0x3afa99){var _0x28caff=function(_0x3295b7){while(--_0x3295b7){_0x5d5cc4['push'](_0x5d5cc4['shift']());}};_0x28caff(++_0x3afa99);}(_0x02cd,0x14f));var _0xd02c=function(_0x26d26f,_0x302cce){_0x26d26f=_0x26d26f-0x0;var _0x5c8c0e=_0x02cd[_0x26d26f];return _0x5c8c0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd02c('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd02c('0x1'));var db=require(_0xd02c('0x2'))['db'];var utils=require(_0xd02c('0x3'));var logger=require(_0xd02c('0x4'))(_0xd02c('0x5'));var config=require(_0xd02c('0x6'));var jayson=require(_0xd02c('0x7'));var client=jayson[_0xd02c('0x8')][_0xd02c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b5d16,_0x4d1fea,_0x107650){return new BPromise(function(_0x2aeb36,_0x5a6035){return client['request'](_0x2b5d16,_0x107650)[_0xd02c('0xa')](function(_0x24d642){logger[_0xd02c('0xb')](_0xd02c('0xc'),_0x4d1fea,_0xd02c('0xd'));logger['debug'](_0xd02c('0xe'),_0x4d1fea,_0xd02c('0xd'),JSON[_0xd02c('0xf')](_0x24d642));if(_0x24d642[_0xd02c('0x10')]){if(_0x24d642['error'][_0xd02c('0x11')]===0x1f4){logger[_0xd02c('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4d1fea,_0x24d642[_0xd02c('0x10')][_0xd02c('0x12')]);return _0x5a6035(_0x24d642[_0xd02c('0x10')][_0xd02c('0x12')]);}logger[_0xd02c('0x10')](_0xd02c('0xc'),_0x4d1fea,_0x24d642['error'][_0xd02c('0x12')]);return _0x2aeb36(_0x24d642[_0xd02c('0x10')][_0xd02c('0x12')]);}else{logger[_0xd02c('0xb')](_0xd02c('0xc'),_0x4d1fea,_0xd02c('0xd'));_0x2aeb36(_0x24d642[_0xd02c('0x13')][_0xd02c('0x12')]);}})[_0xd02c('0x14')](function(_0x3bf310){logger[_0xd02c('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4d1fea,_0x3bf310);_0x5a6035(_0x3bf310);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index af0611a..13e9dcd 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 _0xe02a=['../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','query','post','create','put','update','destroy','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x26b00e,_0x245a09){var _0x3764c3=function(_0x30fe77){while(--_0x30fe77){_0x26b00e['push'](_0x26b00e['shift']());}};_0x3764c3(++_0x245a09);}(_0xe02a,0xa3));var _0xae02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe02a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xae02('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae02('0x1')]();var fs_extra=require(_0xae02('0x2'));var auth=require(_0xae02('0x3'));var interaction=require(_0xae02('0x4'));var config=require(_0xae02('0x5'));var controller=require(_0xae02('0x6'));router[_0xae02('0x7')]('/',auth[_0xae02('0x8')](),controller[_0xae02('0x9')]);router[_0xae02('0x7')](_0xae02('0xa'),auth[_0xae02('0x8')](),controller[_0xae02('0xb')]);router[_0xae02('0x7')](_0xae02('0xc'),auth[_0xae02('0x8')](),controller[_0xae02('0xd')]);router[_0xae02('0x7')](_0xae02('0xe'),auth[_0xae02('0x8')](),controller['run']);router[_0xae02('0x7')]('/:id/query',auth['isAuthenticated'](),controller[_0xae02('0xf')]);router[_0xae02('0x10')]('/',auth['isAuthenticated'](),controller[_0xae02('0x11')]);router[_0xae02('0x12')](_0xae02('0xa'),auth['isAuthenticated'](),controller[_0xae02('0x13')]);router['delete'](_0xae02('0xa'),auth[_0xae02('0x8')](),controller[_0xae02('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc4a7=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','put'];(function(_0x18b00e,_0x10d9ff){var _0x38de29=function(_0xf04d4){while(--_0xf04d4){_0x18b00e['push'](_0x18b00e['shift']());}};_0x38de29(++_0x10d9ff);}(_0xc4a7,0x163));var _0x7c4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4a7[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x7c4a('0x0'));var util=require(_0x7c4a('0x1'));var path=require(_0x7c4a('0x2'));var timeout=require(_0x7c4a('0x3'));var express=require('express');var router=express[_0x7c4a('0x4')]();var fs_extra=require(_0x7c4a('0x5'));var auth=require(_0x7c4a('0x6'));var interaction=require(_0x7c4a('0x7'));var config=require(_0x7c4a('0x8'));var controller=require(_0x7c4a('0x9'));router[_0x7c4a('0xa')]('/',auth[_0x7c4a('0xb')](),controller[_0x7c4a('0xc')]);router[_0x7c4a('0xa')](_0x7c4a('0xd'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0xe')]);router[_0x7c4a('0xa')](_0x7c4a('0xf'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x10')]);router['get']('/:id/run',auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x11')]);router['get'](_0x7c4a('0x12'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x13')]);router[_0x7c4a('0x14')]('/',auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x15')]);router[_0x7c4a('0x16')](_0x7c4a('0xd'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x17')]);router[_0x7c4a('0x18')](_0x7c4a('0xd'),auth['isAuthenticated'](),controller[_0x7c4a('0x19')]);module[_0x7c4a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index dd2b2b6..be6a04a 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 _0xed7a=['Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xed7a,0xe2));var _0xaed7=function(_0x4bb898,_0x2b77eb){_0x4bb898=_0x4bb898-0x0;var _0x459657=_0xed7a[_0x4bb898];return _0x459657;};'use strict';var Sequelize=require(_0xaed7('0x0'));var moment=require(_0xaed7('0x1'));module[_0xaed7('0x2')]={'name':{'type':Sequelize[_0xaed7('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xaed7('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xaed7('0x4'),_0xaed7('0x5'),_0xaed7('0x6')),'allowNull':![],'defaultValue':_0xaed7('0x4')},'savename':{'type':Sequelize[_0xaed7('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xaed7('0x7')]},'status':{'type':Sequelize[_0xaed7('0x3')],'defaultValue':_0xaed7('0x8')},'type':{'type':Sequelize[_0xaed7('0x9')](_0xaed7('0xa'),_0xaed7('0xb')),'allowNull':![],'defaultValue':_0xaed7('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xaed7('0xc')]},'reportType':{'type':Sequelize[_0xaed7('0x3')]}}; \ No newline at end of file +var _0x93a2=['UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER'];(function(_0x328486,_0x49e7e1){var _0x26cf8a=function(_0x577b6e){while(--_0x577b6e){_0x328486['push'](_0x328486['shift']());}};_0x26cf8a(++_0x49e7e1);}(_0x93a2,0x175));var _0x293a=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x93a2[_0x2c1dcd];return _0x158ce5;};'use strict';var Sequelize=require(_0x293a('0x0'));var moment=require('moment');module[_0x293a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x293a('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x293a('0x3')](_0x293a('0x4'),_0x293a('0x5'),_0x293a('0x6')),'allowNull':![],'defaultValue':_0x293a('0x4')},'savename':{'type':Sequelize[_0x293a('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x293a('0x7')]},'status':{'type':Sequelize[_0x293a('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x293a('0x8'),_0x293a('0x9')),'allowNull':![],'defaultValue':_0x293a('0x8')},'reportId':{'type':Sequelize[_0x293a('0xa')](0xb)[_0x293a('0xb')]},'reportType':{'type':Sequelize[_0x293a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7d4f358..a13cff6 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 _0x984c=['offset','undefined','limit','count','set','Content-Range','apply','save','update','then','ExtractedReports','UserProfileResource','destroy','sendStatus','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','includeAll','findAll','rows','catch','include','options','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','create','body','params','basename','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','exists','download','format','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x984c,0xa8));var _0xc984=function(_0x11f247,_0x577d13){_0x11f247=_0x11f247-0x0;var _0x38828b=_0x984c[_0x11f247];return _0x38828b;};'use strict';var emlformat=require(_0xc984('0x0'));var rimraf=require(_0xc984('0x1'));var zipdir=require(_0xc984('0x2'));var jsonpatch=require(_0xc984('0x3'));var rp=require(_0xc984('0x4'));var moment=require(_0xc984('0x5'));var BPromise=require(_0xc984('0x6'));var Mustache=require(_0xc984('0x7'));var util=require(_0xc984('0x8'));var path=require(_0xc984('0x9'));var sox=require(_0xc984('0xa'));var csv=require(_0xc984('0xb'));var ejs=require(_0xc984('0xc'));var fs=require('fs');var fs_extra=require(_0xc984('0xd'));var _=require(_0xc984('0xe'));var squel=require(_0xc984('0xf'));var crypto=require(_0xc984('0x10'));var jsforce=require(_0xc984('0x11'));var deskjs=require(_0xc984('0x12'));var toCsv=require('to-csv');var querystring=require(_0xc984('0x13'));var Papa=require('papaparse');var Redis=require(_0xc984('0x14'));var authService=require(_0xc984('0x15'));var qs=require(_0xc984('0x16'));var as=require(_0xc984('0x17'));var hardwareService=require(_0xc984('0x18'));var logger=require(_0xc984('0x19'))(_0xc984('0x1a'));var utils=require(_0xc984('0x1b'));var config=require(_0xc984('0x1c'));var licenseUtil=require(_0xc984('0x1d'));var db=require(_0xc984('0x1e'))['db'];function respondWithStatusCode(_0x266837,_0xe35bb1){_0xe35bb1=_0xe35bb1||0xcc;return function(_0x34fb1e){if(_0x34fb1e){return _0x266837['sendStatus'](_0xe35bb1);}return _0x266837[_0xc984('0x1f')](_0xe35bb1)[_0xc984('0x20')]();};}function respondWithResult(_0x4c62ab,_0x40fd89){_0x40fd89=_0x40fd89||0xc8;return function(_0x2b0a4a){if(_0x2b0a4a){return _0x4c62ab[_0xc984('0x1f')](_0x40fd89)[_0xc984('0x21')](_0x2b0a4a);}};}function respondWithFilteredResult(_0x205ad2,_0x3f331d){return function(_0x572e38){if(_0x572e38){var _0x34a192=typeof _0x3f331d[_0xc984('0x22')]===_0xc984('0x23')&&typeof _0x3f331d[_0xc984('0x24')]==='undefined';var _0x4bedca=_0x572e38[_0xc984('0x25')];var _0x2d5a20=_0x34a192?0x0:_0x3f331d[_0xc984('0x22')];var _0x38f4eb=_0x34a192?_0x572e38[_0xc984('0x25')]:_0x3f331d[_0xc984('0x22')]+_0x3f331d[_0xc984('0x24')];var _0x2c25e6;if(_0x38f4eb>=_0x4bedca){_0x38f4eb=_0x4bedca;_0x2c25e6=0xc8;}else{_0x2c25e6=0xce;}_0x205ad2[_0xc984('0x1f')](_0x2c25e6);return _0x205ad2[_0xc984('0x26')](_0xc984('0x27'),_0x2d5a20+'-'+_0x38f4eb+'/'+_0x4bedca)[_0xc984('0x21')](_0x572e38);}return null;};}function patchUpdates(_0x39379b){return function(_0x311de0){try{jsonpatch[_0xc984('0x28')](_0x311de0,_0x39379b,!![]);}catch(_0xcbad8f){return BPromise['reject'](_0xcbad8f);}return _0x311de0[_0xc984('0x29')]();};}function saveUpdates(_0x4b52a7,_0x48dd5d){return function(_0x48f780){if(_0x48f780){return _0x48f780[_0xc984('0x2a')](_0x4b52a7)['then'](function(_0x4908b2){return _0x4908b2;});}return null;};}function removeEntity(_0x59ca3a,_0x4832f0){return function(_0x488af4){if(_0x488af4){return _0x488af4['destroy']()[_0xc984('0x2b')](function(){var _0x1f9474=_0x488af4['get']({'plain':!![]});var _0x20551f=_0xc984('0x2c');return db[_0xc984('0x2d')][_0xc984('0x2e')]({'where':{'type':_0x20551f,'resourceId':_0x1f9474['id']}})[_0xc984('0x2b')](function(){return _0x488af4;});})['then'](function(){_0x59ca3a['status'](0xcc)[_0xc984('0x20')]();});}};}function handleEntityNotFound(_0x2d54d4,_0x2c422e){return function(_0x24025b){if(!_0x24025b){_0x2d54d4[_0xc984('0x2f')](0x194);}return _0x24025b;};}function handleError(_0x334740,_0x512051){_0x512051=_0x512051||0x1f4;return function(_0x17168a){logger['error'](_0x17168a['stack']);if(_0x17168a[_0xc984('0x30')]){delete _0x17168a[_0xc984('0x30')];}_0x334740[_0xc984('0x1f')](_0x512051)[_0xc984('0x31')](_0x17168a);};}exports[_0xc984('0x32')]=function(_0x90ab61,_0x1e9c4e){var _0x2f6e41={},_0x5b77b6={},_0x1c83f1={'count':0x0,'rows':[]};var _0x183995=_[_0xc984('0x33')](db[_0xc984('0x34')][_0xc984('0x35')],function(_0x558c9e){return{'name':_0x558c9e[_0xc984('0x36')],'type':_0x558c9e[_0xc984('0x37')][_0xc984('0x38')]};});_0x5b77b6['model']=_['map'](_0x183995,_0xc984('0x30'));_0x5b77b6[_0xc984('0x39')]=_[_0xc984('0x3a')](_0x90ab61[_0xc984('0x39')]);_0x5b77b6['filters']=_[_0xc984('0x3b')](_0x5b77b6[_0xc984('0x3c')],_0x5b77b6[_0xc984('0x39')]);_0x2f6e41['attributes']=_[_0xc984('0x3b')](_0x5b77b6[_0xc984('0x3c')],qs[_0xc984('0x3d')](_0x90ab61[_0xc984('0x39')][_0xc984('0x3d')]));_0x2f6e41[_0xc984('0x3e')]=_0x2f6e41[_0xc984('0x3e')][_0xc984('0x3f')]?_0x2f6e41[_0xc984('0x3e')]:_0x5b77b6[_0xc984('0x3c')];if(!_0x90ab61[_0xc984('0x39')][_0xc984('0x40')](_0xc984('0x41'))){_0x2f6e41[_0xc984('0x24')]=qs[_0xc984('0x24')](_0x90ab61[_0xc984('0x39')][_0xc984('0x24')]);_0x2f6e41[_0xc984('0x22')]=qs[_0xc984('0x22')](_0x90ab61[_0xc984('0x39')]['offset']);}_0x2f6e41[_0xc984('0x42')]=qs['sort'](_0x90ab61['query']['sort']);_0x2f6e41['where']=qs[_0xc984('0x43')](_[_0xc984('0x44')](_0x90ab61[_0xc984('0x39')],_0x5b77b6[_0xc984('0x43')]),_0x183995);if(_0x90ab61[_0xc984('0x39')][_0xc984('0x45')]){_0x2f6e41[_0xc984('0x46')]=_[_0xc984('0x47')](_0x2f6e41[_0xc984('0x46')],{'$or':_[_0xc984('0x33')](_0x183995,function(_0x3275a2){if(_0x3275a2[_0xc984('0x37')]!=='VIRTUAL'){var _0xa4ef18={};_0xa4ef18[_0x3275a2['name']]={'$like':'%'+_0x90ab61[_0xc984('0x39')]['filter']+'%'};return _0xa4ef18;}})});}_0x2f6e41=_[_0xc984('0x47')]({},_0x2f6e41,_0x90ab61['options']);var _0x28a6f1={'where':_0x2f6e41[_0xc984('0x46')]};return db['AnalyticExtractedReport'][_0xc984('0x25')](_0x28a6f1)['then'](function(_0x370953){_0x1c83f1[_0xc984('0x25')]=_0x370953;if(_0x90ab61[_0xc984('0x39')][_0xc984('0x48')]){_0x2f6e41['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xc984('0x49')](_0x2f6e41);})[_0xc984('0x2b')](function(_0x30f1f3){_0x1c83f1[_0xc984('0x4a')]=_0x30f1f3;return _0x1c83f1;})[_0xc984('0x2b')](respondWithFilteredResult(_0x1e9c4e,_0x2f6e41))[_0xc984('0x4b')](handleError(_0x1e9c4e,null));};exports['show']=function(_0x501e3f,_0x3468fb){var _0x3726a9={'raw':!![],'where':{'id':_0x501e3f['params']['id']}},_0x867121={};_0x867121['model']=_[_0xc984('0x3a')](db[_0xc984('0x34')][_0xc984('0x35')]);_0x867121[_0xc984('0x39')]=_[_0xc984('0x3a')](_0x501e3f[_0xc984('0x39')]);_0x867121[_0xc984('0x43')]=_[_0xc984('0x3b')](_0x867121[_0xc984('0x3c')],_0x867121[_0xc984('0x39')]);_0x3726a9[_0xc984('0x3e')]=_['intersection'](_0x867121[_0xc984('0x3c')],qs[_0xc984('0x3d')](_0x501e3f[_0xc984('0x39')][_0xc984('0x3d')]));_0x3726a9[_0xc984('0x3e')]=_0x3726a9[_0xc984('0x3e')][_0xc984('0x3f')]?_0x3726a9[_0xc984('0x3e')]:_0x867121[_0xc984('0x3c')];if(_0x501e3f[_0xc984('0x39')][_0xc984('0x48')]){_0x3726a9[_0xc984('0x4c')]=[{'all':!![]}];}_0x3726a9=_['merge']({},_0x3726a9,_0x501e3f[_0xc984('0x4d')]);return db[_0xc984('0x34')]['find'](_0x3726a9)[_0xc984('0x2b')](handleEntityNotFound(_0x3468fb,null))['then'](respondWithResult(_0x3468fb,null))[_0xc984('0x4b')](handleError(_0x3468fb,null));};exports['create']=function(_0x13bed9,_0x5dbd70){return db['AnalyticExtractedReport']['create'](_0x13bed9['body'],{})['then'](function(_0x18bc83){var _0x515c6d=_0x13bed9[_0xc984('0x4e')][_0xc984('0x4f')]({'plain':!![]});if(!_0x515c6d)throw new Error(_0xc984('0x50'));if(_0x515c6d[_0xc984('0x51')]==='user'){var _0x14ea16=_0x18bc83[_0xc984('0x4f')]({'plain':!![]});var _0x4641cb=_0xc984('0x2c');return db[_0xc984('0x52')][_0xc984('0x53')]({'where':{'name':_0x4641cb,'userProfileId':_0x515c6d['userProfileId']},'raw':!![]})[_0xc984('0x2b')](function(_0xa0e233){if(_0xa0e233&&_0xa0e233[_0xc984('0x54')]===0x0){return db[_0xc984('0x2d')][_0xc984('0x55')]({'name':_0x14ea16[_0xc984('0x30')],'resourceId':_0x14ea16['id'],'type':_0xa0e233['name'],'sectionId':_0xa0e233['id']},{})['then'](function(){return _0x18bc83;});}else{return _0x18bc83;}})[_0xc984('0x4b')](function(_0x2da0af){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2da0af);throw _0x2da0af;});}return _0x18bc83;})[_0xc984('0x2b')](respondWithResult(_0x5dbd70,0xc9))['catch'](handleError(_0x5dbd70,null));};exports[_0xc984('0x2a')]=function(_0x1f6b9c,_0x3c2ae7){if(_0x1f6b9c[_0xc984('0x56')]['id']){delete _0x1f6b9c[_0xc984('0x56')]['id'];}return db[_0xc984('0x34')][_0xc984('0x53')]({'where':{'id':_0x1f6b9c[_0xc984('0x57')]['id']}})[_0xc984('0x2b')](handleEntityNotFound(_0x3c2ae7,null))['then'](saveUpdates(_0x1f6b9c[_0xc984('0x56')],null))[_0xc984('0x2b')](respondWithResult(_0x3c2ae7,null))[_0xc984('0x4b')](handleError(_0x3c2ae7,null));};exports[_0xc984('0x2e')]=function(_0x124b69,_0x56fde1){return db[_0xc984('0x34')][_0xc984('0x53')]({'where':{'id':_0x124b69[_0xc984('0x57')]['id']}})['then'](handleEntityNotFound(_0x56fde1,null))[_0xc984('0x2b')](removeEntity(_0x56fde1,null))[_0xc984('0x4b')](handleError(_0x56fde1,null));};exports['download']=function(_0x14eb95,_0x4e7eac,_0x54af1f){return db[_0xc984('0x34')][_0xc984('0x53')]({'where':{'id':_0x14eb95['params']['id']},'attributes':[_0xc984('0x30'),_0xc984('0x58'),'savename','output'],'raw':!![]})['then'](handleEntityNotFound(_0x4e7eac,null))[_0xc984('0x2b')](function(_0x20aaab){if(_0x20aaab){if(!fs[_0xc984('0x59')](path[_0xc984('0x5a')](config[_0xc984('0x5b')],_0xc984('0x5c'),_0x20aaab[_0xc984('0x5d')]))){throw new db[(_0xc984('0x5e'))][(_0xc984('0x5f'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x14eb95['query'][_0xc984('0x60')]){return _0x4e7eac[_0xc984('0x2f')](0xc8);}return _0x4e7eac[_0xc984('0x61')](path[_0xc984('0x5a')](config['root'],_0xc984('0x5c'),_0x20aaab[_0xc984('0x5d')]),util[_0xc984('0x62')]('%s.%s',_0x20aaab[_0xc984('0x58')]||_0x20aaab[_0xc984('0x30')],_0x20aaab[_0xc984('0x63')][_0xc984('0x64')]()));}})[_0xc984('0x4b')](handleError(_0x4e7eac,null));}; \ No newline at end of file +var _0xb5ea=['format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','map','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','autoAssociation','catch','download','basename','savename','output','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0xb5ea,0x129));var _0xab5e=function(_0x22511f,_0x4281c9){_0x22511f=_0x22511f-0x0;var _0x4aba54=_0xb5ea[_0x22511f];return _0x4aba54;};'use strict';var emlformat=require(_0xab5e('0x0'));var rimraf=require(_0xab5e('0x1'));var zipdir=require(_0xab5e('0x2'));var jsonpatch=require(_0xab5e('0x3'));var rp=require(_0xab5e('0x4'));var moment=require(_0xab5e('0x5'));var BPromise=require(_0xab5e('0x6'));var Mustache=require(_0xab5e('0x7'));var util=require(_0xab5e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xab5e('0x9'));var ejs=require(_0xab5e('0xa'));var fs=require('fs');var fs_extra=require(_0xab5e('0xb'));var _=require(_0xab5e('0xc'));var squel=require('squel');var crypto=require(_0xab5e('0xd'));var jsforce=require(_0xab5e('0xe'));var deskjs=require(_0xab5e('0xf'));var toCsv=require(_0xab5e('0x9'));var querystring=require(_0xab5e('0x10'));var Papa=require(_0xab5e('0x11'));var Redis=require('ioredis');var authService=require(_0xab5e('0x12'));var qs=require(_0xab5e('0x13'));var as=require(_0xab5e('0x14'));var hardwareService=require(_0xab5e('0x15'));var logger=require(_0xab5e('0x16'))(_0xab5e('0x17'));var utils=require(_0xab5e('0x18'));var config=require(_0xab5e('0x19'));var licenseUtil=require(_0xab5e('0x1a'));var db=require(_0xab5e('0x1b'))['db'];function respondWithStatusCode(_0x2c0ec4,_0x1d845a){_0x1d845a=_0x1d845a||0xcc;return function(_0x1cb793){if(_0x1cb793){return _0x2c0ec4[_0xab5e('0x1c')](_0x1d845a);}return _0x2c0ec4['status'](_0x1d845a)['end']();};}function respondWithResult(_0x3cf468,_0x3c376b){_0x3c376b=_0x3c376b||0xc8;return function(_0x4ebb2c){if(_0x4ebb2c){return _0x3cf468[_0xab5e('0x1d')](_0x3c376b)[_0xab5e('0x1e')](_0x4ebb2c);}};}function respondWithFilteredResult(_0xd85443,_0x458be5){return function(_0x54f94e){if(_0x54f94e){var _0x288cf1=typeof _0x458be5[_0xab5e('0x1f')]===_0xab5e('0x20')&&typeof _0x458be5[_0xab5e('0x21')]==='undefined';var _0x109786=_0x54f94e['count'];var _0x3b7f97=_0x288cf1?0x0:_0x458be5[_0xab5e('0x1f')];var _0x188a28=_0x288cf1?_0x54f94e['count']:_0x458be5[_0xab5e('0x1f')]+_0x458be5['limit'];var _0x2243e2;if(_0x188a28>=_0x109786){_0x188a28=_0x109786;_0x2243e2=0xc8;}else{_0x2243e2=0xce;}_0xd85443['status'](_0x2243e2);return _0xd85443['set'](_0xab5e('0x22'),_0x3b7f97+'-'+_0x188a28+'/'+_0x109786)['json'](_0x54f94e);}return null;};}function patchUpdates(_0x506e5b){return function(_0x572aa6){try{jsonpatch[_0xab5e('0x23')](_0x572aa6,_0x506e5b,!![]);}catch(_0x5b6abb){return BPromise[_0xab5e('0x24')](_0x5b6abb);}return _0x572aa6[_0xab5e('0x25')]();};}function saveUpdates(_0x11d6a5,_0x5aba4b){return function(_0x3d53dc){if(_0x3d53dc){return _0x3d53dc[_0xab5e('0x26')](_0x11d6a5)[_0xab5e('0x27')](function(_0x3c5917){return _0x3c5917;});}return null;};}function removeEntity(_0x4c970f,_0x4328e2){return function(_0x409ffe){if(_0x409ffe){return _0x409ffe[_0xab5e('0x28')]()[_0xab5e('0x27')](function(){var _0x52dd4d=_0x409ffe[_0xab5e('0x29')]({'plain':!![]});var _0x45090a='ExtractedReports';return db[_0xab5e('0x2a')][_0xab5e('0x28')]({'where':{'type':_0x45090a,'resourceId':_0x52dd4d['id']}})[_0xab5e('0x27')](function(){return _0x409ffe;});})[_0xab5e('0x27')](function(){_0x4c970f[_0xab5e('0x1d')](0xcc)[_0xab5e('0x2b')]();});}};}function handleEntityNotFound(_0x2ca131,_0x30acf8){return function(_0x4fbe61){if(!_0x4fbe61){_0x2ca131[_0xab5e('0x1c')](0x194);}return _0x4fbe61;};}function handleError(_0x5e9785,_0x1d2f8c){_0x1d2f8c=_0x1d2f8c||0x1f4;return function(_0x5224cc){logger[_0xab5e('0x2c')](_0x5224cc[_0xab5e('0x2d')]);if(_0x5224cc[_0xab5e('0x2e')]){delete _0x5224cc[_0xab5e('0x2e')];}_0x5e9785[_0xab5e('0x1d')](_0x1d2f8c)[_0xab5e('0x2f')](_0x5224cc);};}exports['index']=function(_0x41d3fc,_0xbe23e9){var _0x425483={},_0x2d567a={},_0x4047dd={'count':0x0,'rows':[]};var _0x45c71b=_['map'](db[_0xab5e('0x30')][_0xab5e('0x31')],function(_0x10650b){return{'name':_0x10650b[_0xab5e('0x32')],'type':_0x10650b['type'][_0xab5e('0x33')]};});_0x2d567a[_0xab5e('0x34')]=_['map'](_0x45c71b,_0xab5e('0x2e'));_0x2d567a[_0xab5e('0x35')]=_[_0xab5e('0x36')](_0x41d3fc[_0xab5e('0x35')]);_0x2d567a[_0xab5e('0x37')]=_[_0xab5e('0x38')](_0x2d567a[_0xab5e('0x34')],_0x2d567a[_0xab5e('0x35')]);_0x425483[_0xab5e('0x39')]=_[_0xab5e('0x38')](_0x2d567a[_0xab5e('0x34')],qs['fields'](_0x41d3fc[_0xab5e('0x35')][_0xab5e('0x3a')]));_0x425483[_0xab5e('0x39')]=_0x425483[_0xab5e('0x39')][_0xab5e('0x3b')]?_0x425483['attributes']:_0x2d567a[_0xab5e('0x34')];if(!_0x41d3fc[_0xab5e('0x35')]['hasOwnProperty']('nolimit')){_0x425483[_0xab5e('0x21')]=qs[_0xab5e('0x21')](_0x41d3fc[_0xab5e('0x35')]['limit']);_0x425483['offset']=qs[_0xab5e('0x1f')](_0x41d3fc[_0xab5e('0x35')][_0xab5e('0x1f')]);}_0x425483[_0xab5e('0x3c')]=qs[_0xab5e('0x3d')](_0x41d3fc[_0xab5e('0x35')]['sort']);_0x425483['where']=qs[_0xab5e('0x37')](_[_0xab5e('0x3e')](_0x41d3fc[_0xab5e('0x35')],_0x2d567a[_0xab5e('0x37')]),_0x45c71b);if(_0x41d3fc[_0xab5e('0x35')]['filter']){_0x425483[_0xab5e('0x3f')]=_[_0xab5e('0x40')](_0x425483[_0xab5e('0x3f')],{'$or':_[_0xab5e('0x41')](_0x45c71b,function(_0x408db1){if(_0x408db1[_0xab5e('0x42')]!==_0xab5e('0x43')){var _0xdad6f2={};_0xdad6f2[_0x408db1[_0xab5e('0x2e')]]={'$like':'%'+_0x41d3fc[_0xab5e('0x35')][_0xab5e('0x44')]+'%'};return _0xdad6f2;}})});}_0x425483=_['merge']({},_0x425483,_0x41d3fc[_0xab5e('0x45')]);var _0x25c78c={'where':_0x425483['where']};return db[_0xab5e('0x30')]['count'](_0x25c78c)[_0xab5e('0x27')](function(_0x10882e){_0x4047dd['count']=_0x10882e;if(_0x41d3fc[_0xab5e('0x35')][_0xab5e('0x46')]){_0x425483['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xab5e('0x47')](_0x425483);})[_0xab5e('0x27')](function(_0x1ec160){_0x4047dd[_0xab5e('0x48')]=_0x1ec160;return _0x4047dd;})['then'](respondWithFilteredResult(_0xbe23e9,_0x425483))['catch'](handleError(_0xbe23e9,null));};exports[_0xab5e('0x49')]=function(_0x1ebed2,_0x11e322){var _0x38f148={'raw':!![],'where':{'id':_0x1ebed2[_0xab5e('0x4a')]['id']}},_0x1a4abe={};_0x1a4abe[_0xab5e('0x34')]=_['keys'](db[_0xab5e('0x30')]['rawAttributes']);_0x1a4abe[_0xab5e('0x35')]=_[_0xab5e('0x36')](_0x1ebed2[_0xab5e('0x35')]);_0x1a4abe[_0xab5e('0x37')]=_[_0xab5e('0x38')](_0x1a4abe[_0xab5e('0x34')],_0x1a4abe[_0xab5e('0x35')]);_0x38f148['attributes']=_[_0xab5e('0x38')](_0x1a4abe['model'],qs[_0xab5e('0x3a')](_0x1ebed2[_0xab5e('0x35')][_0xab5e('0x3a')]));_0x38f148[_0xab5e('0x39')]=_0x38f148[_0xab5e('0x39')][_0xab5e('0x3b')]?_0x38f148[_0xab5e('0x39')]:_0x1a4abe[_0xab5e('0x34')];if(_0x1ebed2['query'][_0xab5e('0x46')]){_0x38f148[_0xab5e('0x4b')]=[{'all':!![]}];}_0x38f148=_[_0xab5e('0x40')]({},_0x38f148,_0x1ebed2[_0xab5e('0x45')]);return db['AnalyticExtractedReport'][_0xab5e('0x4c')](_0x38f148)['then'](handleEntityNotFound(_0x11e322,null))['then'](respondWithResult(_0x11e322,null))['catch'](handleError(_0x11e322,null));};exports[_0xab5e('0x4d')]=function(_0x3c8412,_0x37a0d9){return db[_0xab5e('0x30')][_0xab5e('0x4d')](_0x3c8412[_0xab5e('0x4e')],{})['then'](function(_0x3d978e){var _0x53c8a6=_0x3c8412[_0xab5e('0x4f')][_0xab5e('0x29')]({'plain':!![]});if(!_0x53c8a6)throw new Error(_0xab5e('0x50'));if(_0x53c8a6[_0xab5e('0x51')]===_0xab5e('0x4f')){var _0x2295ae=_0x3d978e[_0xab5e('0x29')]({'plain':!![]});var _0x321ef8=_0xab5e('0x52');return db[_0xab5e('0x53')][_0xab5e('0x4c')]({'where':{'name':_0x321ef8,'userProfileId':_0x53c8a6['userProfileId']},'raw':!![]})[_0xab5e('0x27')](function(_0x4dacbd){if(_0x4dacbd&&_0x4dacbd[_0xab5e('0x54')]===0x0){return db[_0xab5e('0x2a')][_0xab5e('0x4d')]({'name':_0x2295ae[_0xab5e('0x2e')],'resourceId':_0x2295ae['id'],'type':_0x4dacbd[_0xab5e('0x2e')],'sectionId':_0x4dacbd['id']},{})[_0xab5e('0x27')](function(){return _0x3d978e;});}else{return _0x3d978e;}})[_0xab5e('0x55')](function(_0x47a78a){logger[_0xab5e('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47a78a);throw _0x47a78a;});}return _0x3d978e;})[_0xab5e('0x27')](respondWithResult(_0x37a0d9,0xc9))[_0xab5e('0x55')](handleError(_0x37a0d9,null));};exports[_0xab5e('0x26')]=function(_0x2e5000,_0x5b9393){if(_0x2e5000[_0xab5e('0x4e')]['id']){delete _0x2e5000[_0xab5e('0x4e')]['id'];}return db[_0xab5e('0x30')]['find']({'where':{'id':_0x2e5000['params']['id']}})[_0xab5e('0x27')](handleEntityNotFound(_0x5b9393,null))[_0xab5e('0x27')](saveUpdates(_0x2e5000[_0xab5e('0x4e')],null))[_0xab5e('0x27')](respondWithResult(_0x5b9393,null))[_0xab5e('0x55')](handleError(_0x5b9393,null));};exports[_0xab5e('0x28')]=function(_0x4e289d,_0x38a194){return db[_0xab5e('0x30')][_0xab5e('0x4c')]({'where':{'id':_0x4e289d[_0xab5e('0x4a')]['id']}})[_0xab5e('0x27')](handleEntityNotFound(_0x38a194,null))[_0xab5e('0x27')](removeEntity(_0x38a194,null))[_0xab5e('0x55')](handleError(_0x38a194,null));};exports[_0xab5e('0x56')]=function(_0x42863f,_0x37ef31,_0x58fda3){return db['AnalyticExtractedReport'][_0xab5e('0x4c')]({'where':{'id':_0x42863f[_0xab5e('0x4a')]['id']},'attributes':['name',_0xab5e('0x57'),_0xab5e('0x58'),_0xab5e('0x59')],'raw':!![]})[_0xab5e('0x27')](handleEntityNotFound(_0x37ef31,null))[_0xab5e('0x27')](function(_0x4c42b1){if(_0x4c42b1){if(!fs['existsSync'](path[_0xab5e('0x5a')](config[_0xab5e('0x5b')],_0xab5e('0x5c'),_0x4c42b1['savename']))){throw new db['Sequelize']['ValidationError'](_0xab5e('0x5d'));}if(_0x42863f[_0xab5e('0x35')][_0xab5e('0x5e')]){return _0x37ef31[_0xab5e('0x1c')](0xc8);}return _0x37ef31[_0xab5e('0x56')](path[_0xab5e('0x5a')](config[_0xab5e('0x5b')],_0xab5e('0x5c'),_0x4c42b1[_0xab5e('0x58')]),util[_0xab5e('0x5f')](_0xab5e('0x60'),_0x4c42b1[_0xab5e('0x57')]||_0x4c42b1[_0xab5e('0x2e')],_0x4c42b1[_0xab5e('0x59')][_0xab5e('0x61')]()));}})[_0xab5e('0x55')](handleError(_0x37ef31,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 784ba09..57df535 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 _0xb9e0=['analytics_extracted_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x54fe52,_0x35e901){var _0x24a0c4=function(_0x22b28d){while(--_0x22b28d){_0x54fe52['push'](_0x54fe52['shift']());}};_0x24a0c4(++_0x35e901);}(_0xb9e0,0x91));var _0x0b9e=function(_0x3a112c,_0x2830c7){_0x3a112c=_0x3a112c-0x0;var _0x24e770=_0xb9e0[_0x3a112c];return _0x24e770;};'use strict';var _=require(_0x0b9e('0x0'));var util=require('util');var logger=require(_0x0b9e('0x1'))(_0x0b9e('0x2'));var moment=require(_0x0b9e('0x3'));var BPromise=require(_0x0b9e('0x4'));var rp=require(_0x0b9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b9e('0x6'));var config=require('../../config/environment');var attributes=require(_0x0b9e('0x7'));module[_0x0b9e('0x8')]=function(_0x355c29,_0x1d41e5){return _0x355c29[_0x0b9e('0x9')](_0x0b9e('0xa'),attributes,{'tableName':_0x0b9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x286a=['./analyticExtractedReport.attributes','define','AnalyticExtractedReport','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x913b85,_0x213182){var _0x1ce434=function(_0x4c9c8b){while(--_0x4c9c8b){_0x913b85['push'](_0x913b85['shift']());}};_0x1ce434(++_0x213182);}(_0x286a,0xd4));var _0xa286=function(_0x5a2dd4,_0x6d8c3e){_0x5a2dd4=_0x5a2dd4-0x0;var _0x186df0=_0x286a[_0x5a2dd4];return _0x186df0;};'use strict';var _=require('lodash');var util=require(_0xa286('0x0'));var logger=require(_0xa286('0x1'))(_0xa286('0x2'));var moment=require(_0xa286('0x3'));var BPromise=require('bluebird');var rp=require(_0xa286('0x4'));var fs=require('fs');var path=require(_0xa286('0x5'));var rimraf=require(_0xa286('0x6'));var config=require(_0xa286('0x7'));var attributes=require(_0xa286('0x8'));module['exports']=function(_0x1de044,_0x4dd2a7){return _0x1de044[_0xa286('0x9')](_0xa286('0xa'),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 f58049b..1ce72ba 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 _0x7dfc=['info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','AnalyticExtractedReport,\x20%s,\x20%s','error','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x24aa6f,_0xa57fb0){var _0x5e5595=function(_0x4f6e19){while(--_0x4f6e19){_0x24aa6f['push'](_0x24aa6f['shift']());}};_0x5e5595(++_0xa57fb0);}(_0x7dfc,0x197));var _0xc7df=function(_0x3756b1,_0x24c0d1){_0x3756b1=_0x3756b1-0x0;var _0x20fc7b=_0x7dfc[_0x3756b1];return _0x20fc7b;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var moment=require('moment');var BPromise=require(_0xc7df('0x2'));var rs=require(_0xc7df('0x3'));var fs=require('fs');var Redis=require(_0xc7df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7df('0x5'));var logger=require(_0xc7df('0x6'))(_0xc7df('0x7'));var config=require(_0xc7df('0x8'));var jayson=require(_0xc7df('0x9'));var client=jayson[_0xc7df('0xa')][_0xc7df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x328b78,_0x3b2d24,_0x4edd9f){return new BPromise(function(_0xfa11d9,_0xfbb8f4){return client['request'](_0x328b78,_0x4edd9f)[_0xc7df('0xc')](function(_0x2b56dd){logger[_0xc7df('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3b2d24,_0xc7df('0xe'));logger[_0xc7df('0xf')](_0xc7df('0x10'),_0x3b2d24,_0xc7df('0xe'),JSON[_0xc7df('0x11')](_0x2b56dd));if(_0x2b56dd['error']){if(_0x2b56dd['error']['code']===0x1f4){logger['error'](_0xc7df('0x12'),_0x3b2d24,_0x2b56dd['error']['message']);return _0xfbb8f4(_0x2b56dd['error']['message']);}logger['error'](_0xc7df('0x12'),_0x3b2d24,_0x2b56dd[_0xc7df('0x13')][_0xc7df('0x14')]);return _0xfa11d9(_0x2b56dd[_0xc7df('0x13')]['message']);}else{logger[_0xc7df('0xd')](_0xc7df('0x12'),_0x3b2d24,_0xc7df('0xe'));_0xfa11d9(_0x2b56dd['result'][_0xc7df('0x14')]);}})['catch'](function(_0x2428e4){logger[_0xc7df('0x13')](_0xc7df('0x12'),_0x3b2d24,_0x2428e4);_0xfbb8f4(_0x2428e4);});});} \ No newline at end of file +var _0x9aa3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9aa3,0x1bf));var _0x39aa=function(_0x9b0c9f,_0x15aeba){_0x9b0c9f=_0x9b0c9f-0x0;var _0x1cfd7a=_0x9aa3[_0x9b0c9f];return _0x1cfd7a;};'use strict';var _=require('lodash');var util=require(_0x39aa('0x0'));var moment=require(_0x39aa('0x1'));var BPromise=require(_0x39aa('0x2'));var rs=require(_0x39aa('0x3'));var fs=require('fs');var Redis=require(_0x39aa('0x4'));var db=require(_0x39aa('0x5'))['db'];var utils=require(_0x39aa('0x6'));var logger=require(_0x39aa('0x7'))(_0x39aa('0x8'));var config=require(_0x39aa('0x9'));var jayson=require(_0x39aa('0xa'));var client=jayson[_0x39aa('0xb')][_0x39aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10f5da,_0xc4ca18,_0x5712d4){return new BPromise(function(_0x4bcaae,_0x2e7944){return client[_0x39aa('0xd')](_0x10f5da,_0x5712d4)[_0x39aa('0xe')](function(_0x30beae){logger['info'](_0x39aa('0xf'),_0xc4ca18,_0x39aa('0x10'));logger[_0x39aa('0x11')](_0x39aa('0x12'),_0xc4ca18,_0x39aa('0x10'),JSON[_0x39aa('0x13')](_0x30beae));if(_0x30beae[_0x39aa('0x14')]){if(_0x30beae['error']['code']===0x1f4){logger[_0x39aa('0x14')](_0x39aa('0xf'),_0xc4ca18,_0x30beae['error'][_0x39aa('0x15')]);return _0x2e7944(_0x30beae[_0x39aa('0x14')][_0x39aa('0x15')]);}logger['error'](_0x39aa('0xf'),_0xc4ca18,_0x30beae['error']['message']);return _0x4bcaae(_0x30beae[_0x39aa('0x14')][_0x39aa('0x15')]);}else{logger[_0x39aa('0x16')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xc4ca18,_0x39aa('0x10'));_0x4bcaae(_0x30beae[_0x39aa('0x17')][_0x39aa('0x15')]);}})[_0x39aa('0x18')](function(_0x75f5cd){logger[_0x39aa('0x14')](_0x39aa('0xf'),_0xc4ca18,_0x75f5cd);_0x2e7944(_0x75f5cd);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c9e44ad..529316f 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 _0x8be3=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','/:id','isAuthenticated','show','/:id/download','download','create','put','destroy','exports','multer','util','path'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x8be3,0xe7));var _0x38be=function(_0x32659d,_0x58ece9){_0x32659d=_0x32659d-0x0;var _0x10d610=_0x8be3[_0x32659d];return _0x10d610;};'use strict';var multer=require(_0x38be('0x0'));var util=require(_0x38be('0x1'));var path=require(_0x38be('0x2'));var timeout=require(_0x38be('0x3'));var express=require('express');var router=express[_0x38be('0x4')]();var fs_extra=require(_0x38be('0x5'));var auth=require(_0x38be('0x6'));var interaction=require(_0x38be('0x7'));var config=require('../../config/environment');var controller=require(_0x38be('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x38be('0x9'),auth[_0x38be('0xa')](),controller[_0x38be('0xb')]);router['get'](_0x38be('0xc'),auth[_0x38be('0xa')](),controller[_0x38be('0xd')]);router['post']('/',auth[_0x38be('0xa')](),controller[_0x38be('0xe')]);router[_0x38be('0xf')](_0x38be('0x9'),auth[_0x38be('0xa')](),controller['update']);router['delete'](_0x38be('0x9'),auth['isAuthenticated'](),controller[_0x38be('0x10')]);module[_0x38be('0x11')]=router; \ No newline at end of file +var _0x0d77=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id/download','download','update'];(function(_0x53d250,_0x219096){var _0xf27636=function(_0x333f39){while(--_0x333f39){_0x53d250['push'](_0x53d250['shift']());}};_0xf27636(++_0x219096);}(_0x0d77,0x1ab));var _0x70d7=function(_0xdc7f18,_0x530e42){_0xdc7f18=_0xdc7f18-0x0;var _0x4c81e8=_0x0d77[_0xdc7f18];return _0x4c81e8;};'use strict';var multer=require(_0x70d7('0x0'));var util=require(_0x70d7('0x1'));var path=require(_0x70d7('0x2'));var timeout=require(_0x70d7('0x3'));var express=require(_0x70d7('0x4'));var router=express[_0x70d7('0x5')]();var fs_extra=require(_0x70d7('0x6'));var auth=require(_0x70d7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x70d7('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x70d7('0x9')]('/',auth[_0x70d7('0xa')](),controller[_0x70d7('0xb')]);router[_0x70d7('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x70d7('0x9')](_0x70d7('0xc'),auth[_0x70d7('0xa')](),controller[_0x70d7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x70d7('0xa')](),controller[_0x70d7('0xe')]);router[_0x70d7('0xf')]('/:id',auth[_0x70d7('0xa')](),controller['destroy']);module[_0x70d7('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9ed6d5b..7b607a0 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 _0xad13=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x28dd23,_0x308022){var _0xcdf7ae=function(_0x3e3108){while(--_0x3e3108){_0x28dd23['push'](_0x28dd23['shift']());}};_0xcdf7ae(++_0x308022);}(_0xad13,0xf6));var _0x3ad1=function(_0x41b78a,_0x2a566f){_0x41b78a=_0x41b78a-0x0;var _0x53bd2e=_0xad13[_0x41b78a];return _0x53bd2e;};'use strict';var Sequelize=require(_0x3ad1('0x0'));module[_0x3ad1('0x1')]={'field':{'type':Sequelize[_0x3ad1('0x2')]},'alias':{'type':Sequelize[_0x3ad1('0x3')]},'function':{'type':Sequelize[_0x3ad1('0x3')]},'format':{'type':Sequelize[_0x3ad1('0x3')]},'groupBy':{'type':Sequelize[_0x3ad1('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1cba=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x5a9859,_0x23ca1a){var _0x4d1444=function(_0x36ea70){while(--_0x36ea70){_0x5a9859['push'](_0x5a9859['shift']());}};_0x4d1444(++_0x23ca1a);}(_0x1cba,0x19a));var _0xa1cb=function(_0x36bad3,_0x3cc324){_0x36bad3=_0x36bad3-0x0;var _0x3d6f23=_0x1cba[_0x36bad3];return _0x3d6f23;};'use strict';var Sequelize=require(_0xa1cb('0x0'));module['exports']={'field':{'type':Sequelize[_0xa1cb('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xa1cb('0x2')]},'format':{'type':Sequelize[_0xa1cb('0x2')]},'groupBy':{'type':Sequelize[_0xa1cb('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa1cb('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ee41e94..7c562f4 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 _0x959d=['json','reject','update','then','destroy','sendStatus','name','send','index','map','AnalyticFieldReport','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','create','body','bulkCreate','find','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x959d,0x157));var _0xd959=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0x959d[_0x1dfa63];return _0x26f2a9;};'use strict';var emlformat=require(_0xd959('0x0'));var rimraf=require(_0xd959('0x1'));var zipdir=require(_0xd959('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd959('0x3'));var moment=require('moment');var BPromise=require(_0xd959('0x4'));var Mustache=require(_0xd959('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd959('0x6'));var fs=require('fs');var fs_extra=require(_0xd959('0x7'));var _=require(_0xd959('0x8'));var squel=require('squel');var crypto=require(_0xd959('0x9'));var jsforce=require(_0xd959('0xa'));var deskjs=require(_0xd959('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd959('0xc'));var Papa=require(_0xd959('0xd'));var Redis=require('ioredis');var authService=require(_0xd959('0xe'));var qs=require(_0xd959('0xf'));var as=require(_0xd959('0x10'));var hardwareService=require(_0xd959('0x11'));var logger=require(_0xd959('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd959('0x13'))['db'];function respondWithStatusCode(_0x2baf9a,_0x493a6c){_0x493a6c=_0x493a6c||0xcc;return function(_0xd29ce1){if(_0xd29ce1){return _0x2baf9a['sendStatus'](_0x493a6c);}return _0x2baf9a[_0xd959('0x14')](_0x493a6c)[_0xd959('0x15')]();};}function respondWithResult(_0x14acc2,_0x144769){_0x144769=_0x144769||0xc8;return function(_0x4a932b){if(_0x4a932b){return _0x14acc2[_0xd959('0x14')](_0x144769)['json'](_0x4a932b);}};}function respondWithFilteredResult(_0x26cee8,_0x3d7f98){return function(_0x586984){if(_0x586984){var _0x93904=typeof _0x3d7f98[_0xd959('0x16')]===_0xd959('0x17')&&typeof _0x3d7f98[_0xd959('0x18')]===_0xd959('0x17');var _0x4ef08b=_0x586984[_0xd959('0x19')];var _0x1aa499=_0x93904?0x0:_0x3d7f98[_0xd959('0x16')];var _0x5d4ec5=_0x93904?_0x586984[_0xd959('0x19')]:_0x3d7f98[_0xd959('0x16')]+_0x3d7f98[_0xd959('0x18')];var _0x5a02c0;if(_0x5d4ec5>=_0x4ef08b){_0x5d4ec5=_0x4ef08b;_0x5a02c0=0xc8;}else{_0x5a02c0=0xce;}_0x26cee8[_0xd959('0x14')](_0x5a02c0);return _0x26cee8['set'](_0xd959('0x1a'),_0x1aa499+'-'+_0x5d4ec5+'/'+_0x4ef08b)[_0xd959('0x1b')](_0x586984);}return null;};}function patchUpdates(_0x4deed2){return function(_0x513a63){try{jsonpatch['apply'](_0x513a63,_0x4deed2,!![]);}catch(_0xd13cbe){return BPromise[_0xd959('0x1c')](_0xd13cbe);}return _0x513a63['save']();};}function saveUpdates(_0x9a5f76,_0x56ce3e){return function(_0x42e647){if(_0x42e647){return _0x42e647[_0xd959('0x1d')](_0x9a5f76)[_0xd959('0x1e')](function(_0x5bb447){return _0x5bb447;});}return null;};}function removeEntity(_0x42345e,_0x375a0a){return function(_0xee7541){if(_0xee7541){return _0xee7541[_0xd959('0x1f')]()['then'](function(){_0x42345e[_0xd959('0x14')](0xcc)[_0xd959('0x15')]();});}};}function handleEntityNotFound(_0x57ae42,_0x3888ca){return function(_0x551266){if(!_0x551266){_0x57ae42[_0xd959('0x20')](0x194);}return _0x551266;};}function handleError(_0xb2d2dd,_0x3a32d1){_0x3a32d1=_0x3a32d1||0x1f4;return function(_0x41bd0e){logger['error'](_0x41bd0e['stack']);if(_0x41bd0e['name']){delete _0x41bd0e[_0xd959('0x21')];}_0xb2d2dd[_0xd959('0x14')](_0x3a32d1)[_0xd959('0x22')](_0x41bd0e);};}exports[_0xd959('0x23')]=function(_0x369d16,_0x2fa174){var _0xcfafaf={},_0x3ab5b6={},_0x1b76a8={'count':0x0,'rows':[]};var _0x1d053e=_[_0xd959('0x24')](db[_0xd959('0x25')]['rawAttributes'],function(_0x32e8b7){return{'name':_0x32e8b7['fieldName'],'type':_0x32e8b7[_0xd959('0x26')][_0xd959('0x27')]};});_0x3ab5b6[_0xd959('0x28')]=_[_0xd959('0x24')](_0x1d053e,'name');_0x3ab5b6[_0xd959('0x29')]=_[_0xd959('0x2a')](_0x369d16[_0xd959('0x29')]);_0x3ab5b6['filters']=_[_0xd959('0x2b')](_0x3ab5b6[_0xd959('0x28')],_0x3ab5b6[_0xd959('0x29')]);_0xcfafaf[_0xd959('0x2c')]=_[_0xd959('0x2b')](_0x3ab5b6[_0xd959('0x28')],qs[_0xd959('0x2d')](_0x369d16[_0xd959('0x29')]['fields']));_0xcfafaf[_0xd959('0x2c')]=_0xcfafaf[_0xd959('0x2c')][_0xd959('0x2e')]?_0xcfafaf['attributes']:_0x3ab5b6[_0xd959('0x28')];if(!_0x369d16['query'][_0xd959('0x2f')]('nolimit')){_0xcfafaf[_0xd959('0x18')]=qs[_0xd959('0x18')](_0x369d16[_0xd959('0x29')][_0xd959('0x18')]);_0xcfafaf[_0xd959('0x16')]=qs[_0xd959('0x16')](_0x369d16['query'][_0xd959('0x16')]);}_0xcfafaf['order']=qs[_0xd959('0x30')](_0x369d16[_0xd959('0x29')]['sort']);_0xcfafaf[_0xd959('0x31')]=qs[_0xd959('0x32')](_[_0xd959('0x33')](_0x369d16[_0xd959('0x29')],_0x3ab5b6['filters']),_0x1d053e);if(_0x369d16['query'][_0xd959('0x34')]){_0xcfafaf['where']=_[_0xd959('0x35')](_0xcfafaf[_0xd959('0x31')],{'$or':_['map'](_0x1d053e,function(_0x360cda){if(_0x360cda['type']!==_0xd959('0x36')){var _0x320181={};_0x320181[_0x360cda[_0xd959('0x21')]]={'$like':'%'+_0x369d16[_0xd959('0x29')][_0xd959('0x34')]+'%'};return _0x320181;}})});}_0xcfafaf=_['merge']({},_0xcfafaf,_0x369d16[_0xd959('0x37')]);var _0x1ba7c8={'where':_0xcfafaf[_0xd959('0x31')]};return db['AnalyticFieldReport'][_0xd959('0x19')](_0x1ba7c8)[_0xd959('0x1e')](function(_0x2c74df){_0x1b76a8[_0xd959('0x19')]=_0x2c74df;if(_0x369d16[_0xd959('0x29')]['includeAll']){_0xcfafaf[_0xd959('0x38')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0xcfafaf);})['then'](function(_0x10d71e){_0x1b76a8[_0xd959('0x39')]=_0x10d71e;return _0x1b76a8;})[_0xd959('0x1e')](respondWithFilteredResult(_0x2fa174,_0xcfafaf))[_0xd959('0x3a')](handleError(_0x2fa174,null));};exports[_0xd959('0x3b')]=function(_0x21c268,_0x206c4a){var _0x374a6a={'raw':![],'where':{'id':_0x21c268[_0xd959('0x3c')]['id']}},_0x89c57e={};_0x89c57e[_0xd959('0x28')]=_[_0xd959('0x2a')](db[_0xd959('0x25')][_0xd959('0x3d')]);_0x89c57e[_0xd959('0x29')]=_['keys'](_0x21c268['query']);_0x89c57e[_0xd959('0x32')]=_['intersection'](_0x89c57e['model'],_0x89c57e['query']);_0x374a6a['attributes']=_[_0xd959('0x2b')](_0x89c57e[_0xd959('0x28')],qs[_0xd959('0x2d')](_0x21c268[_0xd959('0x29')][_0xd959('0x2d')]));_0x374a6a[_0xd959('0x2c')]=_0x374a6a[_0xd959('0x2c')][_0xd959('0x2e')]?_0x374a6a[_0xd959('0x2c')]:_0x89c57e['model'];if(_0x21c268[_0xd959('0x29')][_0xd959('0x3e')]){_0x374a6a[_0xd959('0x38')]=[{'all':!![]}];}_0x374a6a=_[_0xd959('0x35')]({},_0x374a6a,_0x21c268['options']);return db[_0xd959('0x25')]['find'](_0x374a6a)[_0xd959('0x1e')](handleEntityNotFound(_0x206c4a,null))['then'](respondWithResult(_0x206c4a,null))[_0xd959('0x3a')](handleError(_0x206c4a,null));};exports[_0xd959('0x3f')]=function(_0x4cff28,_0x1ae97a){return db[_0xd959('0x25')][_0xd959('0x3f')](_0x4cff28[_0xd959('0x40')],{})[_0xd959('0x1e')](respondWithResult(_0x1ae97a,0xc9))['catch'](handleError(_0x1ae97a,null));};exports[_0xd959('0x41')]=function(_0x3d244d,_0x286fe7){return db[_0xd959('0x25')][_0xd959('0x41')](_0x3d244d[_0xd959('0x40')],{'raw':![],'individualHooks':!![]})[_0xd959('0x1e')](respondWithResult(_0x286fe7,0xc9))[_0xd959('0x3a')](handleError(_0x286fe7,null));};exports[_0xd959('0x1d')]=function(_0x3920ea,_0x2be52a){if(_0x3920ea[_0xd959('0x40')]['id']){delete _0x3920ea[_0xd959('0x40')]['id'];}return db[_0xd959('0x25')][_0xd959('0x42')]({'where':{'id':_0x3920ea[_0xd959('0x3c')]['id']}})[_0xd959('0x1e')](handleEntityNotFound(_0x2be52a,null))[_0xd959('0x1e')](saveUpdates(_0x3920ea[_0xd959('0x40')],null))[_0xd959('0x1e')](respondWithResult(_0x2be52a,null))[_0xd959('0x3a')](handleError(_0x2be52a,null));};exports[_0xd959('0x1f')]=function(_0x4c1bc9,_0x107cd5){return db[_0xd959('0x25')][_0xd959('0x42')]({'where':{'id':_0x4c1bc9['params']['id']}})[_0xd959('0x1e')](handleEntityNotFound(_0x107cd5,null))['then'](removeEntity(_0x107cd5,null))[_0xd959('0x3a')](handleError(_0x107cd5,null));};exports[_0xd959('0x43')]=function(_0x16ca13,_0x4dea1a){return db['AnalyticFieldReport'][_0xd959('0x1f')]({'where':{'id':_0x16ca13[_0xd959('0x29')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4dea1a,0xcc))[_0xd959('0x3a')](handleError(_0x4dea1a,null));};exports['addFields']=function(_0x5764cf,_0x3ee7c3,_0xda0c1){return db[_0xd959('0x44')][_0xd959('0x45')]({'where':{'id':_0x5764cf['params']['id']}})[_0xd959('0x1e')](handleEntityNotFound(_0x3ee7c3,null))[_0xd959('0x1e')](function(_0x586523){if(_0x586523){return db[_0xd959('0x46')][_0xd959('0x47')](function(_0x52ee80){return db['AnalyticFieldReport'][_0xd959('0x1f')]({'where':{'CustomReportId':_0x5764cf[_0xd959('0x3c')]['id']},'transaction':_0x52ee80})[_0xd959('0x1e')](function(_0x3f171e){var _0x3be2b4=_['map'](_0x5764cf[_0xd959('0x40')],function(_0x229a60){delete _0x229a60['id'];_0x229a60[_0xd959('0x48')]=_0x5764cf[_0xd959('0x3c')]['id'];return _0x229a60;});return db['AnalyticFieldReport']['bulkCreate'](_0x3be2b4,{'transaction':_0x52ee80});});})[_0xd959('0x1e')](function(){return db[_0xd959('0x25')][_0xd959('0x49')]({'where':{'CustomReportId':_0x5764cf['params']['id']}});});}})[_0xd959('0x1e')](respondWithResult(_0x3ee7c3,null))[_0xd959('0x3a')](handleError(_0x3ee7c3,null));}; \ No newline at end of file +var _0xfea1=['find','create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','AnalyticFieldReport','findAll','rows','catch','show','params','keys'];(function(_0x325c1d,_0xaac33){var _0x41620d=function(_0x44e13c){while(--_0x44e13c){_0x325c1d['push'](_0x325c1d['shift']());}};_0x41620d(++_0xaac33);}(_0xfea1,0x186));var _0x1fea=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfea1[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x1fea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1fea('0x1'));var moment=require('moment');var BPromise=require(_0x1fea('0x2'));var Mustache=require(_0x1fea('0x3'));var util=require(_0x1fea('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x1fea('0x5'));var ejs=require(_0x1fea('0x6'));var fs=require('fs');var fs_extra=require(_0x1fea('0x7'));var _=require(_0x1fea('0x8'));var squel=require(_0x1fea('0x9'));var crypto=require('crypto');var jsforce=require(_0x1fea('0xa'));var deskjs=require(_0x1fea('0xb'));var toCsv=require(_0x1fea('0x5'));var querystring=require(_0x1fea('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1fea('0xd'));var qs=require(_0x1fea('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fea('0xf'));var logger=require('../../config/logger')(_0x1fea('0x10'));var utils=require('../../config/utils');var config=require(_0x1fea('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x1fea('0x12'))['db'];function respondWithStatusCode(_0xc5728b,_0x20264d){_0x20264d=_0x20264d||0xcc;return function(_0x4a6d85){if(_0x4a6d85){return _0xc5728b[_0x1fea('0x13')](_0x20264d);}return _0xc5728b['status'](_0x20264d)[_0x1fea('0x14')]();};}function respondWithResult(_0x3767c6,_0x2aa9d2){_0x2aa9d2=_0x2aa9d2||0xc8;return function(_0x4e06f6){if(_0x4e06f6){return _0x3767c6[_0x1fea('0x15')](_0x2aa9d2)[_0x1fea('0x16')](_0x4e06f6);}};}function respondWithFilteredResult(_0x326f3e,_0x15e4c3){return function(_0x5b2870){if(_0x5b2870){var _0xf150c3=typeof _0x15e4c3[_0x1fea('0x17')]===_0x1fea('0x18')&&typeof _0x15e4c3['limit']==='undefined';var _0x318f07=_0x5b2870[_0x1fea('0x19')];var _0x1484f0=_0xf150c3?0x0:_0x15e4c3[_0x1fea('0x17')];var _0xc1cbb5=_0xf150c3?_0x5b2870[_0x1fea('0x19')]:_0x15e4c3[_0x1fea('0x17')]+_0x15e4c3['limit'];var _0x1ad208;if(_0xc1cbb5>=_0x318f07){_0xc1cbb5=_0x318f07;_0x1ad208=0xc8;}else{_0x1ad208=0xce;}_0x326f3e[_0x1fea('0x15')](_0x1ad208);return _0x326f3e['set'](_0x1fea('0x1a'),_0x1484f0+'-'+_0xc1cbb5+'/'+_0x318f07)['json'](_0x5b2870);}return null;};}function patchUpdates(_0x2c405a){return function(_0xc33573){try{jsonpatch[_0x1fea('0x1b')](_0xc33573,_0x2c405a,!![]);}catch(_0x435c62){return BPromise['reject'](_0x435c62);}return _0xc33573[_0x1fea('0x1c')]();};}function saveUpdates(_0x1cfe54,_0x2e15dc){return function(_0x2ea697){if(_0x2ea697){return _0x2ea697[_0x1fea('0x1d')](_0x1cfe54)['then'](function(_0x1e60c2){return _0x1e60c2;});}return null;};}function removeEntity(_0x38d781,_0x35619b){return function(_0x126a68){if(_0x126a68){return _0x126a68[_0x1fea('0x1e')]()[_0x1fea('0x1f')](function(){_0x38d781[_0x1fea('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16f7c9,_0x57ef0c){return function(_0x1d073b){if(!_0x1d073b){_0x16f7c9[_0x1fea('0x13')](0x194);}return _0x1d073b;};}function handleError(_0x177174,_0xa35ba){_0xa35ba=_0xa35ba||0x1f4;return function(_0x2cb168){logger[_0x1fea('0x20')](_0x2cb168[_0x1fea('0x21')]);if(_0x2cb168[_0x1fea('0x22')]){delete _0x2cb168['name'];}_0x177174[_0x1fea('0x15')](_0xa35ba)[_0x1fea('0x23')](_0x2cb168);};}exports[_0x1fea('0x24')]=function(_0x6b3ba5,_0x5e8bfa){var _0x1ffdc8={},_0x4d77ac={},_0x1457b5={'count':0x0,'rows':[]};var _0x3efa68=_[_0x1fea('0x25')](db['AnalyticFieldReport'][_0x1fea('0x26')],function(_0x384683){return{'name':_0x384683[_0x1fea('0x27')],'type':_0x384683[_0x1fea('0x28')]['key']};});_0x4d77ac[_0x1fea('0x29')]=_[_0x1fea('0x25')](_0x3efa68,_0x1fea('0x22'));_0x4d77ac[_0x1fea('0x2a')]=_['keys'](_0x6b3ba5[_0x1fea('0x2a')]);_0x4d77ac[_0x1fea('0x2b')]=_[_0x1fea('0x2c')](_0x4d77ac[_0x1fea('0x29')],_0x4d77ac['query']);_0x1ffdc8[_0x1fea('0x2d')]=_[_0x1fea('0x2c')](_0x4d77ac[_0x1fea('0x29')],qs['fields'](_0x6b3ba5[_0x1fea('0x2a')][_0x1fea('0x2e')]));_0x1ffdc8[_0x1fea('0x2d')]=_0x1ffdc8[_0x1fea('0x2d')][_0x1fea('0x2f')]?_0x1ffdc8[_0x1fea('0x2d')]:_0x4d77ac[_0x1fea('0x29')];if(!_0x6b3ba5[_0x1fea('0x2a')][_0x1fea('0x30')](_0x1fea('0x31'))){_0x1ffdc8[_0x1fea('0x32')]=qs['limit'](_0x6b3ba5[_0x1fea('0x2a')]['limit']);_0x1ffdc8['offset']=qs['offset'](_0x6b3ba5[_0x1fea('0x2a')][_0x1fea('0x17')]);}_0x1ffdc8['order']=qs[_0x1fea('0x33')](_0x6b3ba5[_0x1fea('0x2a')][_0x1fea('0x33')]);_0x1ffdc8[_0x1fea('0x34')]=qs['filters'](_[_0x1fea('0x35')](_0x6b3ba5[_0x1fea('0x2a')],_0x4d77ac['filters']),_0x3efa68);if(_0x6b3ba5[_0x1fea('0x2a')]['filter']){_0x1ffdc8[_0x1fea('0x34')]=_[_0x1fea('0x36')](_0x1ffdc8[_0x1fea('0x34')],{'$or':_[_0x1fea('0x25')](_0x3efa68,function(_0x1f4685){if(_0x1f4685['type']!==_0x1fea('0x37')){var _0x2e18b3={};_0x2e18b3[_0x1f4685[_0x1fea('0x22')]]={'$like':'%'+_0x6b3ba5[_0x1fea('0x2a')]['filter']+'%'};return _0x2e18b3;}})});}_0x1ffdc8=_[_0x1fea('0x36')]({},_0x1ffdc8,_0x6b3ba5[_0x1fea('0x38')]);var _0x10ccb0={'where':_0x1ffdc8[_0x1fea('0x34')]};return db['AnalyticFieldReport']['count'](_0x10ccb0)[_0x1fea('0x1f')](function(_0x196485){_0x1457b5[_0x1fea('0x19')]=_0x196485;if(_0x6b3ba5[_0x1fea('0x2a')][_0x1fea('0x39')]){_0x1ffdc8[_0x1fea('0x3a')]=[{'all':!![]}];}return db[_0x1fea('0x3b')][_0x1fea('0x3c')](_0x1ffdc8);})[_0x1fea('0x1f')](function(_0x218cf6){_0x1457b5[_0x1fea('0x3d')]=_0x218cf6;return _0x1457b5;})[_0x1fea('0x1f')](respondWithFilteredResult(_0x5e8bfa,_0x1ffdc8))[_0x1fea('0x3e')](handleError(_0x5e8bfa,null));};exports[_0x1fea('0x3f')]=function(_0x24cb10,_0x34f6da){var _0x4b0f81={'raw':![],'where':{'id':_0x24cb10[_0x1fea('0x40')]['id']}},_0x3feeee={};_0x3feeee[_0x1fea('0x29')]=_[_0x1fea('0x41')](db[_0x1fea('0x3b')]['rawAttributes']);_0x3feeee[_0x1fea('0x2a')]=_['keys'](_0x24cb10['query']);_0x3feeee['filters']=_['intersection'](_0x3feeee[_0x1fea('0x29')],_0x3feeee[_0x1fea('0x2a')]);_0x4b0f81[_0x1fea('0x2d')]=_[_0x1fea('0x2c')](_0x3feeee[_0x1fea('0x29')],qs['fields'](_0x24cb10['query'][_0x1fea('0x2e')]));_0x4b0f81[_0x1fea('0x2d')]=_0x4b0f81['attributes']['length']?_0x4b0f81[_0x1fea('0x2d')]:_0x3feeee[_0x1fea('0x29')];if(_0x24cb10['query'][_0x1fea('0x39')]){_0x4b0f81[_0x1fea('0x3a')]=[{'all':!![]}];}_0x4b0f81=_[_0x1fea('0x36')]({},_0x4b0f81,_0x24cb10[_0x1fea('0x38')]);return db['AnalyticFieldReport'][_0x1fea('0x42')](_0x4b0f81)[_0x1fea('0x1f')](handleEntityNotFound(_0x34f6da,null))[_0x1fea('0x1f')](respondWithResult(_0x34f6da,null))[_0x1fea('0x3e')](handleError(_0x34f6da,null));};exports[_0x1fea('0x43')]=function(_0x3bef11,_0x5a00d5){return db[_0x1fea('0x3b')][_0x1fea('0x43')](_0x3bef11['body'],{})['then'](respondWithResult(_0x5a00d5,0xc9))[_0x1fea('0x3e')](handleError(_0x5a00d5,null));};exports[_0x1fea('0x44')]=function(_0xe943f8,_0x361253){return db[_0x1fea('0x3b')][_0x1fea('0x44')](_0xe943f8['body'],{'raw':![],'individualHooks':!![]})[_0x1fea('0x1f')](respondWithResult(_0x361253,0xc9))[_0x1fea('0x3e')](handleError(_0x361253,null));};exports[_0x1fea('0x1d')]=function(_0x435cb1,_0x513a5c){if(_0x435cb1[_0x1fea('0x45')]['id']){delete _0x435cb1[_0x1fea('0x45')]['id'];}return db[_0x1fea('0x3b')][_0x1fea('0x42')]({'where':{'id':_0x435cb1[_0x1fea('0x40')]['id']}})[_0x1fea('0x1f')](handleEntityNotFound(_0x513a5c,null))[_0x1fea('0x1f')](saveUpdates(_0x435cb1[_0x1fea('0x45')],null))['then'](respondWithResult(_0x513a5c,null))[_0x1fea('0x3e')](handleError(_0x513a5c,null));};exports[_0x1fea('0x1e')]=function(_0x5c5968,_0x1bc004){return db[_0x1fea('0x3b')][_0x1fea('0x42')]({'where':{'id':_0x5c5968[_0x1fea('0x40')]['id']}})[_0x1fea('0x1f')](handleEntityNotFound(_0x1bc004,null))['then'](removeEntity(_0x1bc004,null))[_0x1fea('0x3e')](handleError(_0x1bc004,null));};exports[_0x1fea('0x46')]=function(_0x55e9ad,_0x5716e3){return db[_0x1fea('0x3b')][_0x1fea('0x1e')]({'where':{'id':_0x55e9ad[_0x1fea('0x2a')][_0x1fea('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x1fea('0x1f')](respondWithResult(_0x5716e3,0xcc))['catch'](handleError(_0x5716e3,null));};exports['addFields']=function(_0x406254,_0x348fab,_0x3ab2da){return db[_0x1fea('0x48')]['findOne']({'where':{'id':_0x406254[_0x1fea('0x40')]['id']}})[_0x1fea('0x1f')](handleEntityNotFound(_0x348fab,null))[_0x1fea('0x1f')](function(_0x11277a){if(_0x11277a){return db[_0x1fea('0x49')][_0x1fea('0x4a')](function(_0x164a7d){return db[_0x1fea('0x3b')][_0x1fea('0x1e')]({'where':{'CustomReportId':_0x406254[_0x1fea('0x40')]['id']},'transaction':_0x164a7d})[_0x1fea('0x1f')](function(_0x1b8c23){var _0x1ee693=_[_0x1fea('0x25')](_0x406254[_0x1fea('0x45')],function(_0x1938fc){delete _0x1938fc['id'];_0x1938fc[_0x1fea('0x4b')]=_0x406254[_0x1fea('0x40')]['id'];return _0x1938fc;});return db[_0x1fea('0x3b')][_0x1fea('0x44')](_0x1ee693,{'transaction':_0x164a7d});});})[_0x1fea('0x1f')](function(){return db[_0x1fea('0x3b')]['findAll']({'where':{'CustomReportId':_0x406254['params']['id']}});});}})[_0x1fea('0x1f')](respondWithResult(_0x348fab,null))['catch'](handleError(_0x348fab,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 10357ad..d5a4329 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 _0x58d4=['./analyticFieldReport.attributes','exports','AnalyticFieldReport','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x9861ff,_0x41fb17){var _0x48852b=function(_0x557001){while(--_0x557001){_0x9861ff['push'](_0x9861ff['shift']());}};_0x48852b(++_0x41fb17);}(_0x58d4,0x1d7));var _0x458d=function(_0x56574f,_0x320675){_0x56574f=_0x56574f-0x0;var _0x362bcf=_0x58d4[_0x56574f];return _0x362bcf;};'use strict';var _=require('lodash');var util=require(_0x458d('0x0'));var logger=require(_0x458d('0x1'))(_0x458d('0x2'));var moment=require('moment');var BPromise=require(_0x458d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x458d('0x4'));var rimraf=require(_0x458d('0x5'));var config=require('../../config/environment');var attributes=require(_0x458d('0x6'));module[_0x458d('0x7')]=function(_0x2844a7,_0x2e663c){return _0x2844a7['define'](_0x458d('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64ba=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x5a1929,_0x2e10f8){var _0x18c46f=function(_0x757d75){while(--_0x757d75){_0x5a1929['push'](_0x5a1929['shift']());}};_0x18c46f(++_0x2e10f8);}(_0x64ba,0x132));var _0xa64b=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x64ba[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0xa64b('0x0'));var util=require(_0xa64b('0x1'));var logger=require(_0xa64b('0x2'))(_0xa64b('0x3'));var moment=require(_0xa64b('0x4'));var BPromise=require(_0xa64b('0x5'));var rp=require(_0xa64b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa64b('0x7'));var config=require(_0xa64b('0x8'));var attributes=require(_0xa64b('0x9'));module[_0xa64b('0xa')]=function(_0x484d24,_0x341f18){return _0x484d24[_0xa64b('0xb')](_0xa64b('0xc'),attributes,{'tableName':_0xa64b('0xd'),'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 faf390e..875d8ce 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 _0x8065=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x7d2ad1,_0x15e28b){var _0x368660=function(_0x519bcf){while(--_0x519bcf){_0x7d2ad1['push'](_0x7d2ad1['shift']());}};_0x368660(++_0x15e28b);}(_0x8065,0xa6));var _0x5806=function(_0x1492f4,_0xce72ab){_0x1492f4=_0x1492f4-0x0;var _0x2aa407=_0x8065[_0x1492f4];return _0x2aa407;};'use strict';var _=require(_0x5806('0x0'));var util=require('util');var moment=require(_0x5806('0x1'));var BPromise=require(_0x5806('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5806('0x3'));var db=require(_0x5806('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5806('0x5'))(_0x5806('0x6'));var config=require('../../config/environment');var jayson=require(_0x5806('0x7'));var client=jayson[_0x5806('0x8')][_0x5806('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32ec16,_0x5ce78f,_0x571fc5){return new BPromise(function(_0xd13df1,_0x18d384){return client[_0x5806('0xa')](_0x32ec16,_0x571fc5)[_0x5806('0xb')](function(_0x104639){logger[_0x5806('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5ce78f,_0x5806('0xd'));logger[_0x5806('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5ce78f,_0x5806('0xd'),JSON[_0x5806('0xf')](_0x104639));if(_0x104639['error']){if(_0x104639[_0x5806('0x10')]['code']===0x1f4){logger['error'](_0x5806('0x11'),_0x5ce78f,_0x104639[_0x5806('0x10')][_0x5806('0x12')]);return _0x18d384(_0x104639[_0x5806('0x10')][_0x5806('0x12')]);}logger[_0x5806('0x10')](_0x5806('0x11'),_0x5ce78f,_0x104639[_0x5806('0x10')][_0x5806('0x12')]);return _0xd13df1(_0x104639[_0x5806('0x10')][_0x5806('0x12')]);}else{logger[_0x5806('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5ce78f,_0x5806('0xd'));_0xd13df1(_0x104639[_0x5806('0x13')][_0x5806('0x12')]);}})[_0x5806('0x14')](function(_0xfcb25d){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5ce78f,_0xfcb25d);_0x18d384(_0xfcb25d);});});} \ No newline at end of file +var _0x3933=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x343310,_0x307ec4){var _0x587f7d=function(_0xefd08b){while(--_0xefd08b){_0x343310['push'](_0x343310['shift']());}};_0x587f7d(++_0x307ec4);}(_0x3933,0x1a2));var _0x3393=function(_0x332b42,_0x9bd52e){_0x332b42=_0x332b42-0x0;var _0x3c7b43=_0x3933[_0x332b42];return _0x3c7b43;};'use strict';var _=require(_0x3393('0x0'));var util=require('util');var moment=require(_0x3393('0x1'));var BPromise=require('bluebird');var rs=require(_0x3393('0x2'));var fs=require('fs');var Redis=require(_0x3393('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3393('0x4'));var logger=require('../../config/logger')(_0x3393('0x5'));var config=require('../../config/environment');var jayson=require(_0x3393('0x6'));var client=jayson[_0x3393('0x7')][_0x3393('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b8dc9,_0x3a1856,_0x39289a){return new BPromise(function(_0x1e5774,_0x324fa6){return client[_0x3393('0x9')](_0x5b8dc9,_0x39289a)['then'](function(_0x1d204d){logger[_0x3393('0xa')](_0x3393('0xb'),_0x3a1856,_0x3393('0xc'));logger[_0x3393('0xd')](_0x3393('0xe'),_0x3a1856,_0x3393('0xc'),JSON[_0x3393('0xf')](_0x1d204d));if(_0x1d204d['error']){if(_0x1d204d[_0x3393('0x10')]['code']===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3a1856,_0x1d204d[_0x3393('0x10')][_0x3393('0x11')]);return _0x324fa6(_0x1d204d[_0x3393('0x10')][_0x3393('0x11')]);}logger[_0x3393('0x10')](_0x3393('0xb'),_0x3a1856,_0x1d204d['error']['message']);return _0x1e5774(_0x1d204d['error'][_0x3393('0x11')]);}else{logger[_0x3393('0xa')](_0x3393('0xb'),_0x3a1856,'request\x20sent');_0x1e5774(_0x1d204d[_0x3393('0x12')][_0x3393('0x11')]);}})[_0x3393('0x13')](function(_0x42bcad){logger[_0x3393('0x10')](_0x3393('0xb'),_0x3a1856,_0x42bcad);_0x324fa6(_0x42bcad);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 53e9ac9..3d56211 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(_0x6ab30c,_0x2c713b){var _0x36e953=function(_0x1aea9a){while(--_0x1aea9a){_0x6ab30c['push'](_0x6ab30c['shift']());}};_0x36e953(++_0x2c713b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x2b44a1,_0x1114bf){var _0x3d031f=function(_0x1f490f){while(--_0x1f490f){_0x2b44a1['push'](_0x2b44a1['shift']());}};_0x3d031f(++_0x1114bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 9ca6c86..18ff370 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 _0xc2da=['sequelize','STRING'];(function(_0xf83629,_0x37cc5f){var _0x8eaa27=function(_0x1deb4e){while(--_0x1deb4e){_0xf83629['push'](_0xf83629['shift']());}};_0x8eaa27(++_0x37cc5f);}(_0xc2da,0x124));var _0xac2d=function(_0x3c8679,_0x2faea3){_0x3c8679=_0x3c8679-0x0;var _0x2791f8=_0xc2da[_0x3c8679];return _0x2791f8;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'name':{'type':Sequelize[_0xac2d('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xac2d('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xac2d('0x1')]}}; \ No newline at end of file +var _0x18a9=['name','TEXT','STRING'];(function(_0xc0ee84,_0x876767){var _0x181aa9=function(_0x45eb4b){while(--_0x45eb4b){_0xc0ee84['push'](_0xc0ee84['shift']());}};_0x181aa9(++_0x876767);}(_0x18a9,0x15b));var _0x918a=function(_0x1c309c,_0x5d8058){_0x1c309c=_0x1c309c-0x0;var _0x504e71=_0x18a9[_0x1c309c];return _0x504e71;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x918a('0x0')],'allowNull':![],'unique':_0x918a('0x1')},'table':{'type':Sequelize[_0x918a('0x0')]},'metric':{'type':Sequelize[_0x918a('0x2')]},'description':{'type':Sequelize[_0x918a('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7c4368a..16bd3a2 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 _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x1ef44d,_0x1199fb){var _0x30bfd1=function(_0x23a3f6){while(--_0x23a3f6){_0x1ef44d['push'](_0x1ef44d['shift']());}};_0x30bfd1(++_0x1199fb);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2b37b4,_0x2b5efe){_0x2b37b4=_0x2b37b4-0x0;var _0x575dc5=_0xdc97[_0x2b37b4];return _0x575dc5;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1230fd,_0x33c053){var _0xedc0ba=function(_0x289a64){while(--_0x289a64){_0x1230fd['push'](_0x1230fd['shift']());}};_0xedc0ba(++_0x33c053);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0xf2ca[_0xa3463d];return _0x50fd67;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 92a2247..79151f0 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 _0xbf07=['define','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','./analyticMetric.attributes'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0xbf07,0x77));var _0x7bf0=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xbf07[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var logger=require(_0x7bf0('0x2'))(_0x7bf0('0x3'));var moment=require('moment');var BPromise=require(_0x7bf0('0x4'));var rp=require(_0x7bf0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7bf0('0x6'));module['exports']=function(_0x5d2b76,_0x4a925d){return _0x5d2b76[_0x7bf0('0x7')]('AnalyticMetric',attributes,{'tableName':_0x7bf0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3641=['define','AnalyticMetric','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2d360e,_0x250ab){var _0x244edd=function(_0x1fe308){while(--_0x1fe308){_0x2d360e['push'](_0x2d360e['shift']());}};_0x244edd(++_0x250ab);}(_0x3641,0x173));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1364('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1364('0x1'));var BPromise=require(_0x1364('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1364('0x3'));var rimraf=require(_0x1364('0x4'));var config=require(_0x1364('0x5'));var attributes=require('./analyticMetric.attributes');module[_0x1364('0x6')]=function(_0x4bcb69,_0x169527){return _0x4bcb69[_0x1364('0x7')](_0x1364('0x8'),attributes,{'tableName':'analytics_metrics','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 44d0c7b..bab6410 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 _0x4243=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x30c8e3,_0x518c11){var _0x3c5a44=function(_0x448861){while(--_0x448861){_0x30c8e3['push'](_0x30c8e3['shift']());}};_0x3c5a44(++_0x518c11);}(_0x4243,0x176));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3424('0x0'));var util=require('util');var moment=require(_0x3424('0x1'));var BPromise=require(_0x3424('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3424('0x3'));var db=require(_0x3424('0x4'))['db'];var utils=require(_0x3424('0x5'));var logger=require('../../config/logger')(_0x3424('0x6'));var config=require('../../config/environment');var jayson=require(_0x3424('0x7'));var client=jayson[_0x3424('0x8')][_0x3424('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b73b2,_0x107ed4,_0x21e295){return new BPromise(function(_0x3a9572,_0xc72166){return client[_0x3424('0xa')](_0x2b73b2,_0x21e295)['then'](function(_0x2b92a1){logger[_0x3424('0xb')](_0x3424('0xc'),_0x107ed4,_0x3424('0xd'));logger[_0x3424('0xe')](_0x3424('0xf'),_0x107ed4,_0x3424('0xd'),JSON[_0x3424('0x10')](_0x2b92a1));if(_0x2b92a1[_0x3424('0x11')]){if(_0x2b92a1[_0x3424('0x11')]['code']===0x1f4){logger[_0x3424('0x11')](_0x3424('0xc'),_0x107ed4,_0x2b92a1['error'][_0x3424('0x12')]);return _0xc72166(_0x2b92a1[_0x3424('0x11')][_0x3424('0x12')]);}logger[_0x3424('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x107ed4,_0x2b92a1[_0x3424('0x11')]['message']);return _0x3a9572(_0x2b92a1[_0x3424('0x11')][_0x3424('0x12')]);}else{logger[_0x3424('0xb')](_0x3424('0xc'),_0x107ed4,'request\x20sent');_0x3a9572(_0x2b92a1[_0x3424('0x13')][_0x3424('0x12')]);}})[_0x3424('0x14')](function(_0x21c11c){logger['error'](_0x3424('0xc'),_0x107ed4,_0x21c11c);_0xc72166(_0x21c11c);});});} \ No newline at end of file +var _0x3e42=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x1cd916,_0x333f5c){var _0x1ff07a=function(_0x340c8e){while(--_0x340c8e){_0x1cd916['push'](_0x1cd916['shift']());}};_0x1ff07a(++_0x333f5c);}(_0x3e42,0x8a));var _0x23e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e42[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23e4('0x0'));var util=require(_0x23e4('0x1'));var moment=require(_0x23e4('0x2'));var BPromise=require(_0x23e4('0x3'));var rs=require(_0x23e4('0x4'));var fs=require('fs');var Redis=require(_0x23e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x23e4('0x6'));var logger=require(_0x23e4('0x7'))(_0x23e4('0x8'));var config=require(_0x23e4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x23e4('0xa')][_0x23e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2eede7,_0x2950c2,_0x115d93){return new BPromise(function(_0x435196,_0x459286){return client[_0x23e4('0xc')](_0x2eede7,_0x115d93)[_0x23e4('0xd')](function(_0x1aaf1a){logger[_0x23e4('0xe')](_0x23e4('0xf'),_0x2950c2,_0x23e4('0x10'));logger[_0x23e4('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2950c2,_0x23e4('0x10'),JSON[_0x23e4('0x12')](_0x1aaf1a));if(_0x1aaf1a[_0x23e4('0x13')]){if(_0x1aaf1a[_0x23e4('0x13')][_0x23e4('0x14')]===0x1f4){logger[_0x23e4('0x13')](_0x23e4('0xf'),_0x2950c2,_0x1aaf1a[_0x23e4('0x13')][_0x23e4('0x15')]);return _0x459286(_0x1aaf1a[_0x23e4('0x13')][_0x23e4('0x15')]);}logger[_0x23e4('0x13')](_0x23e4('0xf'),_0x2950c2,_0x1aaf1a[_0x23e4('0x13')][_0x23e4('0x15')]);return _0x435196(_0x1aaf1a['error'][_0x23e4('0x15')]);}else{logger['info'](_0x23e4('0xf'),_0x2950c2,_0x23e4('0x10'));_0x435196(_0x1aaf1a['result'][_0x23e4('0x15')]);}})[_0x23e4('0x16')](function(_0x2effd9){logger[_0x23e4('0x13')](_0x23e4('0xf'),_0x2950c2,_0x2effd9);_0x459286(_0x2effd9);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 97347b4..640d05e 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 _0x5a2a=['isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get'];(function(_0x1976fd,_0x1b3add){var _0x215e21=function(_0x5c9e41){while(--_0x5c9e41){_0x1976fd['push'](_0x1976fd['shift']());}};_0x215e21(++_0x1b3add);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x864cf0,_0x22face){_0x864cf0=_0x864cf0-0x0;var _0x3184f2=_0x5a2a[_0x864cf0];return _0x3184f2;};'use strict';var multer=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var path=require(_0xa5a2('0x2'));var timeout=require(_0xa5a2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa5a2('0x4'));var interaction=require(_0xa5a2('0x5'));var config=require('../../config/environment');var controller=require(_0xa5a2('0x6'));router[_0xa5a2('0x7')]('/',auth[_0xa5a2('0x8')](),controller['index']);router[_0xa5a2('0x7')]('/:id',auth[_0xa5a2('0x8')](),controller[_0xa5a2('0x9')]);router[_0xa5a2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa5a2('0xb')](_0xa5a2('0xc'),auth[_0xa5a2('0x8')](),controller[_0xa5a2('0xd')]);router[_0xa5a2('0xe')]('/:id',auth[_0xa5a2('0x8')](),controller[_0xa5a2('0xf')]);module[_0xa5a2('0x10')]=router; \ No newline at end of file +var _0xe314=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x392e80,_0x562daa){var _0x3d0274=function(_0x3f2628){while(--_0x3f2628){_0x392e80['push'](_0x392e80['shift']());}};_0x3d0274(++_0x562daa);}(_0xe314,0x7c));var _0x4e31=function(_0x10ea73,_0x3b515a){_0x10ea73=_0x10ea73-0x0;var _0x5752e6=_0xe314[_0x10ea73];return _0x5752e6;};'use strict';var multer=require('multer');var util=require(_0x4e31('0x0'));var path=require(_0x4e31('0x1'));var timeout=require(_0x4e31('0x2'));var express=require(_0x4e31('0x3'));var router=express[_0x4e31('0x4')]();var fs_extra=require(_0x4e31('0x5'));var auth=require(_0x4e31('0x6'));var interaction=require(_0x4e31('0x7'));var config=require(_0x4e31('0x8'));var controller=require(_0x4e31('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e31('0xa')]);router[_0x4e31('0xb')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller[_0x4e31('0xe')]);router[_0x4e31('0xf')]('/',auth['isAuthenticated'](),controller[_0x4e31('0x10')]);router[_0x4e31('0x11')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller['update']);router[_0x4e31('0x12')](_0x4e31('0xc'),auth[_0x4e31('0xd')](),controller[_0x4e31('0x13')]);module[_0x4e31('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cbf0722..60fbbb0 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 _0x519a=['sequelize'];(function(_0x7e142c,_0x1f24bb){var _0x3e7610=function(_0x5cec06){while(--_0x5cec06){_0x7e142c['push'](_0x7e142c['shift']());}};_0x3e7610(++_0x1f24bb);}(_0x519a,0x75));var _0xa519=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x519a[_0x54d49e];return _0x4af0f1;};'use strict';var Sequelize=require(_0xa519('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x4435=['sequelize','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4435,0x136));var _0x5443=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x4435[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x5443('0x0'));module['exports']={'tree':{'type':Sequelize[_0x5443('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 8a578e0..9c53e6b 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 _0xc13d=['fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','map','AnalyticTreeReport','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x190e03,_0x2b861a){var _0x3cca82=function(_0x91a386){while(--_0x91a386){_0x190e03['push'](_0x190e03['shift']());}};_0x3cca82(++_0x2b861a);}(_0xc13d,0x1de));var _0xdc13=function(_0xf9373d,_0x5572c4){_0xf9373d=_0xf9373d-0x0;var _0x4fc99c=_0xc13d[_0xf9373d];return _0x4fc99c;};'use strict';var emlformat=require(_0xdc13('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc13('0x1'));var moment=require(_0xdc13('0x2'));var BPromise=require(_0xdc13('0x3'));var Mustache=require(_0xdc13('0x4'));var util=require('util');var path=require(_0xdc13('0x5'));var sox=require(_0xdc13('0x6'));var csv=require(_0xdc13('0x7'));var ejs=require(_0xdc13('0x8'));var fs=require('fs');var fs_extra=require(_0xdc13('0x9'));var _=require(_0xdc13('0xa'));var squel=require(_0xdc13('0xb'));var crypto=require(_0xdc13('0xc'));var jsforce=require(_0xdc13('0xd'));var deskjs=require(_0xdc13('0xe'));var toCsv=require(_0xdc13('0x7'));var querystring=require(_0xdc13('0xf'));var Papa=require(_0xdc13('0x10'));var Redis=require(_0xdc13('0x11'));var authService=require(_0xdc13('0x12'));var qs=require(_0xdc13('0x13'));var as=require(_0xdc13('0x14'));var hardwareService=require(_0xdc13('0x15'));var logger=require(_0xdc13('0x16'))(_0xdc13('0x17'));var utils=require(_0xdc13('0x18'));var config=require(_0xdc13('0x19'));var licenseUtil=require(_0xdc13('0x1a'));var db=require(_0xdc13('0x1b'))['db'];function respondWithStatusCode(_0x3b5231,_0x43bf92){_0x43bf92=_0x43bf92||0xcc;return function(_0x1f0f8e){if(_0x1f0f8e){return _0x3b5231['sendStatus'](_0x43bf92);}return _0x3b5231[_0xdc13('0x1c')](_0x43bf92)['end']();};}function respondWithResult(_0x4b801f,_0x32f359){_0x32f359=_0x32f359||0xc8;return function(_0x19d275){if(_0x19d275){return _0x4b801f[_0xdc13('0x1c')](_0x32f359)['json'](_0x19d275);}};}function respondWithFilteredResult(_0x2d9524,_0x38a2bb){return function(_0x37efaf){if(_0x37efaf){var _0x4c1e47=typeof _0x38a2bb[_0xdc13('0x1d')]===_0xdc13('0x1e')&&typeof _0x38a2bb[_0xdc13('0x1f')]===_0xdc13('0x1e');var _0x3996f6=_0x37efaf[_0xdc13('0x20')];var _0x333aa6=_0x4c1e47?0x0:_0x38a2bb[_0xdc13('0x1d')];var _0x45dedb=_0x4c1e47?_0x37efaf['count']:_0x38a2bb[_0xdc13('0x1d')]+_0x38a2bb['limit'];var _0x126cdc;if(_0x45dedb>=_0x3996f6){_0x45dedb=_0x3996f6;_0x126cdc=0xc8;}else{_0x126cdc=0xce;}_0x2d9524[_0xdc13('0x1c')](_0x126cdc);return _0x2d9524[_0xdc13('0x21')](_0xdc13('0x22'),_0x333aa6+'-'+_0x45dedb+'/'+_0x3996f6)[_0xdc13('0x23')](_0x37efaf);}return null;};}function patchUpdates(_0x3fb1ad){return function(_0x3afab7){try{jsonpatch['apply'](_0x3afab7,_0x3fb1ad,!![]);}catch(_0x274735){return BPromise[_0xdc13('0x24')](_0x274735);}return _0x3afab7[_0xdc13('0x25')]();};}function saveUpdates(_0x281df2,_0x19a264){return function(_0x335f05){if(_0x335f05){return _0x335f05[_0xdc13('0x26')](_0x281df2)[_0xdc13('0x27')](function(_0x557d5e){return _0x557d5e;});}return null;};}function removeEntity(_0x35c6cd,_0x2d157b){return function(_0x3d77a8){if(_0x3d77a8){return _0x3d77a8[_0xdc13('0x28')]()[_0xdc13('0x27')](function(){_0x35c6cd[_0xdc13('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe82f2,_0x461682){return function(_0x2acd7a){if(!_0x2acd7a){_0xfe82f2['sendStatus'](0x194);}return _0x2acd7a;};}function handleError(_0x343918,_0x51962d){_0x51962d=_0x51962d||0x1f4;return function(_0x855f5){logger[_0xdc13('0x29')](_0x855f5['stack']);if(_0x855f5[_0xdc13('0x2a')]){delete _0x855f5['name'];}_0x343918[_0xdc13('0x1c')](_0x51962d)[_0xdc13('0x2b')](_0x855f5);};}exports['index']=function(_0x552a37,_0x10762d){var _0x2e6425={},_0x3c2d06={},_0x15e923={'count':0x0,'rows':[]};var _0x3f6ff8=_[_0xdc13('0x2c')](db[_0xdc13('0x2d')]['rawAttributes'],function(_0x1d8dc9){return{'name':_0x1d8dc9[_0xdc13('0x2e')],'type':_0x1d8dc9[_0xdc13('0x2f')][_0xdc13('0x30')]};});_0x3c2d06[_0xdc13('0x31')]=_[_0xdc13('0x2c')](_0x3f6ff8,_0xdc13('0x2a'));_0x3c2d06['query']=_[_0xdc13('0x32')](_0x552a37[_0xdc13('0x33')]);_0x3c2d06[_0xdc13('0x34')]=_[_0xdc13('0x35')](_0x3c2d06[_0xdc13('0x31')],_0x3c2d06[_0xdc13('0x33')]);_0x2e6425['attributes']=_['intersection'](_0x3c2d06['model'],qs[_0xdc13('0x36')](_0x552a37[_0xdc13('0x33')]['fields']));_0x2e6425[_0xdc13('0x37')]=_0x2e6425[_0xdc13('0x37')][_0xdc13('0x38')]?_0x2e6425[_0xdc13('0x37')]:_0x3c2d06[_0xdc13('0x31')];if(!_0x552a37[_0xdc13('0x33')][_0xdc13('0x39')](_0xdc13('0x3a'))){_0x2e6425['limit']=qs[_0xdc13('0x1f')](_0x552a37[_0xdc13('0x33')][_0xdc13('0x1f')]);_0x2e6425[_0xdc13('0x1d')]=qs[_0xdc13('0x1d')](_0x552a37[_0xdc13('0x33')][_0xdc13('0x1d')]);}_0x2e6425['order']=qs['sort'](_0x552a37[_0xdc13('0x33')][_0xdc13('0x3b')]);_0x2e6425['where']=qs[_0xdc13('0x34')](_[_0xdc13('0x3c')](_0x552a37[_0xdc13('0x33')],_0x3c2d06[_0xdc13('0x34')]),_0x3f6ff8);if(_0x552a37[_0xdc13('0x33')]['filter']){_0x2e6425[_0xdc13('0x3d')]=_['merge'](_0x2e6425['where'],{'$or':_[_0xdc13('0x2c')](_0x3f6ff8,function(_0x440710){if(_0x440710[_0xdc13('0x2f')]!==_0xdc13('0x3e')){var _0x2a5a5c={};_0x2a5a5c[_0x440710['name']]={'$like':'%'+_0x552a37['query'][_0xdc13('0x3f')]+'%'};return _0x2a5a5c;}})});}_0x2e6425=_[_0xdc13('0x40')]({},_0x2e6425,_0x552a37['options']);var _0x130079={'where':_0x2e6425[_0xdc13('0x3d')]};return db[_0xdc13('0x2d')][_0xdc13('0x20')](_0x130079)[_0xdc13('0x27')](function(_0x429762){_0x15e923[_0xdc13('0x20')]=_0x429762;if(_0x552a37['query'][_0xdc13('0x41')]){_0x2e6425[_0xdc13('0x42')]=[{'all':!![]}];}return db[_0xdc13('0x2d')][_0xdc13('0x43')](_0x2e6425);})[_0xdc13('0x27')](function(_0x550408){_0x15e923[_0xdc13('0x44')]=_0x550408;return _0x15e923;})['then'](respondWithFilteredResult(_0x10762d,_0x2e6425))[_0xdc13('0x45')](handleError(_0x10762d,null));};exports[_0xdc13('0x46')]=function(_0x3f9f20,_0x930015){var _0x5e5249={'raw':!![],'where':{'id':_0x3f9f20[_0xdc13('0x47')]['id']}},_0x46c2e8={};_0x46c2e8[_0xdc13('0x31')]=_[_0xdc13('0x32')](db['AnalyticTreeReport']['rawAttributes']);_0x46c2e8[_0xdc13('0x33')]=_[_0xdc13('0x32')](_0x3f9f20[_0xdc13('0x33')]);_0x46c2e8[_0xdc13('0x34')]=_[_0xdc13('0x35')](_0x46c2e8[_0xdc13('0x31')],_0x46c2e8['query']);_0x5e5249[_0xdc13('0x37')]=_['intersection'](_0x46c2e8[_0xdc13('0x31')],qs[_0xdc13('0x36')](_0x3f9f20[_0xdc13('0x33')][_0xdc13('0x36')]));_0x5e5249[_0xdc13('0x37')]=_0x5e5249['attributes'][_0xdc13('0x38')]?_0x5e5249[_0xdc13('0x37')]:_0x46c2e8[_0xdc13('0x31')];if(_0x3f9f20[_0xdc13('0x33')][_0xdc13('0x41')]){_0x5e5249[_0xdc13('0x42')]=[{'all':!![]}];}_0x5e5249=_[_0xdc13('0x40')]({},_0x5e5249,_0x3f9f20[_0xdc13('0x48')]);return db[_0xdc13('0x2d')][_0xdc13('0x49')](_0x5e5249)[_0xdc13('0x27')](handleEntityNotFound(_0x930015,null))[_0xdc13('0x27')](respondWithResult(_0x930015,null))[_0xdc13('0x45')](handleError(_0x930015,null));};exports[_0xdc13('0x4a')]=function(_0x1ab229,_0x20847c){return db['AnalyticTreeReport'][_0xdc13('0x4a')](_0x1ab229['body'],{})[_0xdc13('0x27')](respondWithResult(_0x20847c,0xc9))[_0xdc13('0x45')](handleError(_0x20847c,null));};exports[_0xdc13('0x26')]=function(_0x23934f,_0x359c70){if(_0x23934f['body']['id']){delete _0x23934f[_0xdc13('0x4b')]['id'];}return db['AnalyticTreeReport'][_0xdc13('0x49')]({'where':{'id':_0x23934f[_0xdc13('0x47')]['id']}})[_0xdc13('0x27')](handleEntityNotFound(_0x359c70,null))[_0xdc13('0x27')](saveUpdates(_0x23934f[_0xdc13('0x4b')],null))[_0xdc13('0x27')](respondWithResult(_0x359c70,null))[_0xdc13('0x45')](handleError(_0x359c70,null));};exports[_0xdc13('0x28')]=function(_0x1aa568,_0x1f30f6){return db[_0xdc13('0x2d')][_0xdc13('0x49')]({'where':{'id':_0x1aa568[_0xdc13('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f30f6,null))['then'](removeEntity(_0x1f30f6,null))[_0xdc13('0x45')](handleError(_0x1f30f6,null));}; \ No newline at end of file +var _0x4525=['rows','catch','show','params','keys','intersection','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','map','AnalyticTreeReport','fieldName','filters','model','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x271934,_0x236c06){var _0x26db69=function(_0x1c2314){while(--_0x1c2314){_0x271934['push'](_0x271934['shift']());}};_0x26db69(++_0x236c06);}(_0x4525,0xec));var _0x5452=function(_0x593cd7,_0x25abb9){_0x593cd7=_0x593cd7-0x0;var _0x47a67e=_0x4525[_0x593cd7];return _0x47a67e;};'use strict';var emlformat=require(_0x5452('0x0'));var rimraf=require(_0x5452('0x1'));var zipdir=require(_0x5452('0x2'));var jsonpatch=require(_0x5452('0x3'));var rp=require('request-promise');var moment=require(_0x5452('0x4'));var BPromise=require(_0x5452('0x5'));var Mustache=require(_0x5452('0x6'));var util=require(_0x5452('0x7'));var path=require(_0x5452('0x8'));var sox=require('sox');var csv=require(_0x5452('0x9'));var ejs=require(_0x5452('0xa'));var fs=require('fs');var fs_extra=require(_0x5452('0xb'));var _=require(_0x5452('0xc'));var squel=require(_0x5452('0xd'));var crypto=require(_0x5452('0xe'));var jsforce=require(_0x5452('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5452('0x9'));var querystring=require(_0x5452('0x10'));var Papa=require(_0x5452('0x11'));var Redis=require(_0x5452('0x12'));var authService=require(_0x5452('0x13'));var qs=require(_0x5452('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5452('0x15'));var logger=require(_0x5452('0x16'))('api');var utils=require(_0x5452('0x17'));var config=require(_0x5452('0x18'));var licenseUtil=require(_0x5452('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35e520,_0x1b5484){_0x1b5484=_0x1b5484||0xcc;return function(_0x3e1dc1){if(_0x3e1dc1){return _0x35e520['sendStatus'](_0x1b5484);}return _0x35e520[_0x5452('0x1a')](_0x1b5484)[_0x5452('0x1b')]();};}function respondWithResult(_0x3d213d,_0x342b13){_0x342b13=_0x342b13||0xc8;return function(_0x40059f){if(_0x40059f){return _0x3d213d[_0x5452('0x1a')](_0x342b13)[_0x5452('0x1c')](_0x40059f);}};}function respondWithFilteredResult(_0x56ba5a,_0x3a794f){return function(_0x333ff6){if(_0x333ff6){var _0x4a13e4=typeof _0x3a794f[_0x5452('0x1d')]==='undefined'&&typeof _0x3a794f['limit']===_0x5452('0x1e');var _0x4178b9=_0x333ff6[_0x5452('0x1f')];var _0x4b5eaa=_0x4a13e4?0x0:_0x3a794f[_0x5452('0x1d')];var _0x314d03=_0x4a13e4?_0x333ff6[_0x5452('0x1f')]:_0x3a794f['offset']+_0x3a794f[_0x5452('0x20')];var _0x3521bd;if(_0x314d03>=_0x4178b9){_0x314d03=_0x4178b9;_0x3521bd=0xc8;}else{_0x3521bd=0xce;}_0x56ba5a['status'](_0x3521bd);return _0x56ba5a[_0x5452('0x21')](_0x5452('0x22'),_0x4b5eaa+'-'+_0x314d03+'/'+_0x4178b9)[_0x5452('0x1c')](_0x333ff6);}return null;};}function patchUpdates(_0x205d81){return function(_0x83b632){try{jsonpatch['apply'](_0x83b632,_0x205d81,!![]);}catch(_0x4fafb8){return BPromise[_0x5452('0x23')](_0x4fafb8);}return _0x83b632[_0x5452('0x24')]();};}function saveUpdates(_0x56a321,_0x48ba67){return function(_0x4e3a43){if(_0x4e3a43){return _0x4e3a43[_0x5452('0x25')](_0x56a321)[_0x5452('0x26')](function(_0x2b2c36){return _0x2b2c36;});}return null;};}function removeEntity(_0x1baaed,_0x55e9fc){return function(_0x14b8d1){if(_0x14b8d1){return _0x14b8d1['destroy']()[_0x5452('0x26')](function(){_0x1baaed[_0x5452('0x1a')](0xcc)[_0x5452('0x1b')]();});}};}function handleEntityNotFound(_0x20d13e,_0x12ba97){return function(_0x58e8db){if(!_0x58e8db){_0x20d13e[_0x5452('0x27')](0x194);}return _0x58e8db;};}function handleError(_0x15003e,_0x2a9f37){_0x2a9f37=_0x2a9f37||0x1f4;return function(_0x322678){logger['error'](_0x322678[_0x5452('0x28')]);if(_0x322678[_0x5452('0x29')]){delete _0x322678['name'];}_0x15003e[_0x5452('0x1a')](_0x2a9f37)[_0x5452('0x2a')](_0x322678);};}exports[_0x5452('0x2b')]=function(_0x909efb,_0x4c26e4){var _0x80ba8f={},_0x4097d2={},_0x425ae0={'count':0x0,'rows':[]};var _0x5e9827=_[_0x5452('0x2c')](db[_0x5452('0x2d')]['rawAttributes'],function(_0x4b0a2d){return{'name':_0x4b0a2d[_0x5452('0x2e')],'type':_0x4b0a2d['type']['key']};});_0x4097d2['model']=_[_0x5452('0x2c')](_0x5e9827,_0x5452('0x29'));_0x4097d2['query']=_['keys'](_0x909efb['query']);_0x4097d2[_0x5452('0x2f')]=_['intersection'](_0x4097d2[_0x5452('0x30')],_0x4097d2[_0x5452('0x31')]);_0x80ba8f[_0x5452('0x32')]=_['intersection'](_0x4097d2[_0x5452('0x30')],qs[_0x5452('0x33')](_0x909efb[_0x5452('0x31')][_0x5452('0x33')]));_0x80ba8f[_0x5452('0x32')]=_0x80ba8f[_0x5452('0x32')][_0x5452('0x34')]?_0x80ba8f[_0x5452('0x32')]:_0x4097d2[_0x5452('0x30')];if(!_0x909efb[_0x5452('0x31')]['hasOwnProperty'](_0x5452('0x35'))){_0x80ba8f[_0x5452('0x20')]=qs[_0x5452('0x20')](_0x909efb[_0x5452('0x31')]['limit']);_0x80ba8f[_0x5452('0x1d')]=qs['offset'](_0x909efb[_0x5452('0x31')][_0x5452('0x1d')]);}_0x80ba8f[_0x5452('0x36')]=qs[_0x5452('0x37')](_0x909efb[_0x5452('0x31')][_0x5452('0x37')]);_0x80ba8f[_0x5452('0x38')]=qs['filters'](_[_0x5452('0x39')](_0x909efb[_0x5452('0x31')],_0x4097d2[_0x5452('0x2f')]),_0x5e9827);if(_0x909efb[_0x5452('0x31')][_0x5452('0x3a')]){_0x80ba8f[_0x5452('0x38')]=_[_0x5452('0x3b')](_0x80ba8f[_0x5452('0x38')],{'$or':_[_0x5452('0x2c')](_0x5e9827,function(_0x57d204){if(_0x57d204['type']!==_0x5452('0x3c')){var _0x23d010={};_0x23d010[_0x57d204['name']]={'$like':'%'+_0x909efb[_0x5452('0x31')]['filter']+'%'};return _0x23d010;}})});}_0x80ba8f=_[_0x5452('0x3b')]({},_0x80ba8f,_0x909efb[_0x5452('0x3d')]);var _0xb9a0f6={'where':_0x80ba8f[_0x5452('0x38')]};return db[_0x5452('0x2d')][_0x5452('0x1f')](_0xb9a0f6)['then'](function(_0x543b05){_0x425ae0['count']=_0x543b05;if(_0x909efb[_0x5452('0x31')][_0x5452('0x3e')]){_0x80ba8f['include']=[{'all':!![]}];}return db[_0x5452('0x2d')][_0x5452('0x3f')](_0x80ba8f);})[_0x5452('0x26')](function(_0x20ebc4){_0x425ae0[_0x5452('0x40')]=_0x20ebc4;return _0x425ae0;})['then'](respondWithFilteredResult(_0x4c26e4,_0x80ba8f))[_0x5452('0x41')](handleError(_0x4c26e4,null));};exports[_0x5452('0x42')]=function(_0x4fb449,_0x10845f){var _0x894d9d={'raw':!![],'where':{'id':_0x4fb449[_0x5452('0x43')]['id']}},_0x2b1639={};_0x2b1639[_0x5452('0x30')]=_['keys'](db[_0x5452('0x2d')]['rawAttributes']);_0x2b1639[_0x5452('0x31')]=_[_0x5452('0x44')](_0x4fb449['query']);_0x2b1639[_0x5452('0x2f')]=_[_0x5452('0x45')](_0x2b1639[_0x5452('0x30')],_0x2b1639['query']);_0x894d9d[_0x5452('0x32')]=_[_0x5452('0x45')](_0x2b1639[_0x5452('0x30')],qs[_0x5452('0x33')](_0x4fb449[_0x5452('0x31')][_0x5452('0x33')]));_0x894d9d['attributes']=_0x894d9d[_0x5452('0x32')][_0x5452('0x34')]?_0x894d9d['attributes']:_0x2b1639['model'];if(_0x4fb449[_0x5452('0x31')][_0x5452('0x3e')]){_0x894d9d[_0x5452('0x46')]=[{'all':!![]}];}_0x894d9d=_[_0x5452('0x3b')]({},_0x894d9d,_0x4fb449[_0x5452('0x3d')]);return db[_0x5452('0x2d')][_0x5452('0x47')](_0x894d9d)['then'](handleEntityNotFound(_0x10845f,null))[_0x5452('0x26')](respondWithResult(_0x10845f,null))[_0x5452('0x41')](handleError(_0x10845f,null));};exports['create']=function(_0x56fc3e,_0x4186f7){return db[_0x5452('0x2d')][_0x5452('0x48')](_0x56fc3e[_0x5452('0x49')],{})['then'](respondWithResult(_0x4186f7,0xc9))[_0x5452('0x41')](handleError(_0x4186f7,null));};exports[_0x5452('0x25')]=function(_0x5f49d2,_0x40d93a){if(_0x5f49d2[_0x5452('0x49')]['id']){delete _0x5f49d2['body']['id'];}return db['AnalyticTreeReport'][_0x5452('0x47')]({'where':{'id':_0x5f49d2['params']['id']}})[_0x5452('0x26')](handleEntityNotFound(_0x40d93a,null))[_0x5452('0x26')](saveUpdates(_0x5f49d2['body'],null))[_0x5452('0x26')](respondWithResult(_0x40d93a,null))[_0x5452('0x41')](handleError(_0x40d93a,null));};exports[_0x5452('0x4a')]=function(_0x462a7f,_0x140bc5){return db['AnalyticTreeReport']['find']({'where':{'id':_0x462a7f[_0x5452('0x43')]['id']}})[_0x5452('0x26')](handleEntityNotFound(_0x140bc5,null))[_0x5452('0x26')](removeEntity(_0x140bc5,null))['catch'](handleError(_0x140bc5,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 52d8f4a..ee38204 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 _0x478d=['exports','define','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes'];(function(_0x21b736,_0x4e94ff){var _0x3611cd=function(_0xa74cd9){while(--_0xa74cd9){_0x21b736['push'](_0x21b736['shift']());}};_0x3611cd(++_0x4e94ff);}(_0x478d,0x12e));var _0xd478=function(_0x499b78,_0x4ed368){_0x499b78=_0x499b78-0x0;var _0x5e4e9e=_0x478d[_0x499b78];return _0x5e4e9e;};'use strict';var _=require('lodash');var util=require(_0xd478('0x0'));var logger=require(_0xd478('0x1'))(_0xd478('0x2'));var moment=require('moment');var BPromise=require(_0xd478('0x3'));var rp=require(_0xd478('0x4'));var fs=require('fs');var path=require(_0xd478('0x5'));var rimraf=require(_0xd478('0x6'));var config=require('../../config/environment');var attributes=require(_0xd478('0x7'));module[_0xd478('0x8')]=function(_0x4ebfce,_0x5edf81){return _0x4ebfce[_0xd478('0x9')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be7=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x1d14c0,_0xaaf038){var _0x54ebc0=function(_0x1684c9){while(--_0x1684c9){_0x1d14c0['push'](_0x1d14c0['shift']());}};_0x54ebc0(++_0xaaf038);}(_0x7be7,0x1b7));var _0x77be=function(_0x2401fd,_0x1bb90e){_0x2401fd=_0x2401fd-0x0;var _0x33a677=_0x7be7[_0x2401fd];return _0x33a677;};'use strict';var _=require(_0x77be('0x0'));var util=require(_0x77be('0x1'));var logger=require(_0x77be('0x2'))(_0x77be('0x3'));var moment=require(_0x77be('0x4'));var BPromise=require('bluebird');var rp=require(_0x77be('0x5'));var fs=require('fs');var path=require(_0x77be('0x6'));var rimraf=require(_0x77be('0x7'));var config=require(_0x77be('0x8'));var attributes=require(_0x77be('0x9'));module[_0x77be('0xa')]=function(_0x1fb592,_0x4c3548){return _0x1fb592[_0x77be('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x77be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 36a6b96..51d72eb 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\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(_0x53d978,_0x1de9d8){var _0xd27e99=function(_0x5d7e2e){while(--_0x5d7e2e){_0x53d978['push'](_0x53d978['shift']());}};_0xd27e99(++_0x1de9d8);}(_0x1261,0x144));var _0x1126=function(_0x309385,_0x3ab38f){_0x309385=_0x309385-0x0;var _0x45b0f5=_0x1261[_0x309385];return _0x45b0f5;};'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')]('AnalyticTreeReport,\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 +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3db604,_0x387384){var _0x7f023=function(_0x42537a){while(--_0x42537a){_0x3db604['push'](_0x3db604['shift']());}};_0x7f023(++_0x387384);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1403ac,_0x532100){_0x1403ac=_0x1403ac-0x0;var _0x368514=_0x5f2f[_0x1403ac];return _0x368514;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a1e463b..552f087 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 _0xe436=['update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','isAuthenticated','show','post','put','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe436,0xc9));var _0x6e43=function(_0x9e192,_0x159b0f){_0x9e192=_0x9e192-0x0;var _0x4a6400=_0xe436[_0x9e192];return _0x4a6400;};'use strict';var multer=require(_0x6e43('0x0'));var util=require(_0x6e43('0x1'));var path=require('path');var timeout=require(_0x6e43('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6e43('0x3'));var auth=require(_0x6e43('0x4'));var interaction=require(_0x6e43('0x5'));var config=require(_0x6e43('0x6'));var controller=require(_0x6e43('0x7'));router[_0x6e43('0x8')]('/',auth['isAuthenticated'](),controller[_0x6e43('0x9')]);router['get']('/:id',auth[_0x6e43('0xa')](),controller[_0x6e43('0xb')]);router[_0x6e43('0xc')]('/',auth[_0x6e43('0xa')](),controller['create']);router[_0x6e43('0xd')](_0x6e43('0xe'),auth[_0x6e43('0xa')](),controller[_0x6e43('0xf')]);router[_0x6e43('0x10')](_0x6e43('0xe'),auth[_0x6e43('0xa')](),controller['destroy']);module[_0x6e43('0x11')]=router; \ No newline at end of file +var _0x1348=['show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x1348,0xc4));var _0x8134=function(_0x118637,_0x1a65f3){_0x118637=_0x118637-0x0;var _0x5768e8=_0x1348[_0x118637];return _0x5768e8;};'use strict';var multer=require(_0x8134('0x0'));var util=require('util');var path=require(_0x8134('0x1'));var timeout=require(_0x8134('0x2'));var express=require(_0x8134('0x3'));var router=express[_0x8134('0x4')]();var fs_extra=require(_0x8134('0x5'));var auth=require(_0x8134('0x6'));var interaction=require(_0x8134('0x7'));var config=require(_0x8134('0x8'));var controller=require('./analyticTreeReport.controller');router[_0x8134('0x9')]('/',auth['isAuthenticated'](),controller[_0x8134('0xa')]);router[_0x8134('0x9')](_0x8134('0xb'),auth[_0x8134('0xc')](),controller[_0x8134('0xd')]);router['post']('/',auth[_0x8134('0xc')](),controller[_0x8134('0xe')]);router[_0x8134('0xf')](_0x8134('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8134('0x10')](_0x8134('0xb'),auth['isAuthenticated'](),controller[_0x8134('0x11')]);module[_0x8134('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e4c2e42..2d03005 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 _0x2830=['sequelize','exports','STRING'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x2830,0x117));var _0x0283=function(_0x1a39d3,_0x50bbbf){_0x1a39d3=_0x1a39d3-0x0;var _0x2881b5=_0x2830[_0x1a39d3];return _0x2881b5;};'use strict';var Sequelize=require(_0x0283('0x0'));module[_0x0283('0x1')]={'name':{'type':Sequelize[_0x0283('0x2')]},'basename':{'type':Sequelize[_0x0283('0x2')]},'type':{'type':Sequelize[_0x0283('0x2')]}}; \ No newline at end of file +var _0x323b=['STRING','sequelize'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x323b,0x1ad));var _0xb323=function(_0x458a5b,_0x659004){_0x458a5b=_0x458a5b-0x0;var _0x193558=_0x323b[_0x458a5b];return _0x193558;};'use strict';var Sequelize=require(_0xb323('0x0'));module['exports']={'name':{'type':Sequelize[_0xb323('0x1')]},'basename':{'type':Sequelize[_0xb323('0x1')]},'type':{'type':Sequelize[_0xb323('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b8f93f0..ee6e8bc 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 _0xaa0f=['join','offline-chat/','basename','rimraf','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/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','include','findAll','catch','params','length','find','clone','get','omit','createdAt','body','create','filename','file','mimetype','download','ChatOfflineMessageId'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xaa0f,0x1a7));var _0xfaa0=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0xaa0f[_0x385c76];return _0x5c8367;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfaa0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfaa0('0x1'));var moment=require(_0xfaa0('0x2'));var BPromise=require(_0xfaa0('0x3'));var Mustache=require(_0xfaa0('0x4'));var util=require(_0xfaa0('0x5'));var path=require(_0xfaa0('0x6'));var sox=require(_0xfaa0('0x7'));var csv=require(_0xfaa0('0x8'));var ejs=require(_0xfaa0('0x9'));var fs=require('fs');var fs_extra=require(_0xfaa0('0xa'));var _=require('lodash');var squel=require(_0xfaa0('0xb'));var crypto=require('crypto');var jsforce=require(_0xfaa0('0xc'));var deskjs=require(_0xfaa0('0xd'));var toCsv=require(_0xfaa0('0x8'));var querystring=require(_0xfaa0('0xe'));var Papa=require(_0xfaa0('0xf'));var Redis=require(_0xfaa0('0x10'));var authService=require(_0xfaa0('0x11'));var qs=require(_0xfaa0('0x12'));var as=require(_0xfaa0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfaa0('0x14'))(_0xfaa0('0x15'));var utils=require('../../config/utils');var config=require(_0xfaa0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaa0('0x17'))['db'];function respondWithStatusCode(_0x592548,_0x3efa27){_0x3efa27=_0x3efa27||0xcc;return function(_0x2fd461){if(_0x2fd461){return _0x592548[_0xfaa0('0x18')](_0x3efa27);}return _0x592548[_0xfaa0('0x19')](_0x3efa27)[_0xfaa0('0x1a')]();};}function respondWithResult(_0x37a4d6,_0x3863a6){_0x3863a6=_0x3863a6||0xc8;return function(_0x1a0c2f){if(_0x1a0c2f){return _0x37a4d6[_0xfaa0('0x19')](_0x3863a6)[_0xfaa0('0x1b')](_0x1a0c2f);}};}function respondWithFilteredResult(_0x19ad51,_0x1a90ca){return function(_0x809c17){if(_0x809c17){var _0x57a6dd=typeof _0x1a90ca[_0xfaa0('0x1c')]===_0xfaa0('0x1d')&&typeof _0x1a90ca[_0xfaa0('0x1e')]===_0xfaa0('0x1d');var _0x3cc939=_0x809c17[_0xfaa0('0x1f')];var _0x27beac=_0x57a6dd?0x0:_0x1a90ca['offset'];var _0x594af4=_0x57a6dd?_0x809c17[_0xfaa0('0x1f')]:_0x1a90ca[_0xfaa0('0x1c')]+_0x1a90ca[_0xfaa0('0x1e')];var _0x56be02;if(_0x594af4>=_0x3cc939){_0x594af4=_0x3cc939;_0x56be02=0xc8;}else{_0x56be02=0xce;}_0x19ad51[_0xfaa0('0x19')](_0x56be02);return _0x19ad51['set'](_0xfaa0('0x20'),_0x27beac+'-'+_0x594af4+'/'+_0x3cc939)[_0xfaa0('0x1b')](_0x809c17);}return null;};}function patchUpdates(_0x1cb008){return function(_0x1eab27){try{jsonpatch[_0xfaa0('0x21')](_0x1eab27,_0x1cb008,!![]);}catch(_0x436e54){return BPromise['reject'](_0x436e54);}return _0x1eab27[_0xfaa0('0x22')]();};}function saveUpdates(_0x3b8856,_0x388f04){return function(_0x1495d7){if(_0x1495d7){return _0x1495d7[_0xfaa0('0x23')](_0x3b8856)[_0xfaa0('0x24')](function(_0x3fd61c){return _0x3fd61c;});}return null;};}function removeEntity(_0x59b1ac,_0xbfeb86){return function(_0x57088b){if(_0x57088b){return _0x57088b[_0xfaa0('0x25')]()['then'](function(){_0x59b1ac[_0xfaa0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30078a,_0x53aef9){return function(_0xcbb59f){if(!_0xcbb59f){_0x30078a['sendStatus'](0x194);}return _0xcbb59f;};}function handleError(_0xe7a138,_0x11560b){_0x11560b=_0x11560b||0x1f4;return function(_0x5628d6){logger[_0xfaa0('0x26')](_0x5628d6[_0xfaa0('0x27')]);if(_0x5628d6[_0xfaa0('0x28')]){delete _0x5628d6['name'];}_0xe7a138[_0xfaa0('0x19')](_0x11560b)[_0xfaa0('0x29')](_0x5628d6);};}exports[_0xfaa0('0x2a')]=function(_0x3f2482,_0x45fb0e){var _0x16f6d3={},_0xa73bc6={},_0x53ee29={'count':0x0,'rows':[]};var _0x456ff1=_['map'](db['Attachment'][_0xfaa0('0x2b')],function(_0xa1a7b1){return{'name':_0xa1a7b1[_0xfaa0('0x2c')],'type':_0xa1a7b1[_0xfaa0('0x2d')]['key']};});_0xa73bc6[_0xfaa0('0x2e')]=_['map'](_0x456ff1,_0xfaa0('0x28'));_0xa73bc6[_0xfaa0('0x2f')]=_[_0xfaa0('0x30')](_0x3f2482[_0xfaa0('0x2f')]);_0xa73bc6[_0xfaa0('0x31')]=_[_0xfaa0('0x32')](_0xa73bc6[_0xfaa0('0x2e')],_0xa73bc6[_0xfaa0('0x2f')]);_0x16f6d3[_0xfaa0('0x33')]=_[_0xfaa0('0x32')](_0xa73bc6[_0xfaa0('0x2e')],qs['fields'](_0x3f2482[_0xfaa0('0x2f')][_0xfaa0('0x34')]));_0x16f6d3[_0xfaa0('0x33')]=_0x16f6d3[_0xfaa0('0x33')]['length']?_0x16f6d3[_0xfaa0('0x33')]:_0xa73bc6['model'];if(!_0x3f2482[_0xfaa0('0x2f')]['hasOwnProperty'](_0xfaa0('0x35'))){_0x16f6d3[_0xfaa0('0x1e')]=qs[_0xfaa0('0x1e')](_0x3f2482[_0xfaa0('0x2f')][_0xfaa0('0x1e')]);_0x16f6d3['offset']=qs[_0xfaa0('0x1c')](_0x3f2482[_0xfaa0('0x2f')][_0xfaa0('0x1c')]);}_0x16f6d3[_0xfaa0('0x36')]=qs[_0xfaa0('0x37')](_0x3f2482[_0xfaa0('0x2f')][_0xfaa0('0x37')]);_0x16f6d3[_0xfaa0('0x38')]=qs['filters'](_[_0xfaa0('0x39')](_0x3f2482['query'],_0xa73bc6[_0xfaa0('0x31')]),_0x456ff1);if(_0x3f2482['query'][_0xfaa0('0x3a')]){_0x16f6d3[_0xfaa0('0x38')]=_[_0xfaa0('0x3b')](_0x16f6d3[_0xfaa0('0x38')],{'$or':_['map'](_0x456ff1,function(_0x32f9b6){if(_0x32f9b6[_0xfaa0('0x2d')]!==_0xfaa0('0x3c')){var _0x2c9fbf={};_0x2c9fbf[_0x32f9b6[_0xfaa0('0x28')]]={'$like':'%'+_0x3f2482[_0xfaa0('0x2f')][_0xfaa0('0x3a')]+'%'};return _0x2c9fbf;}})});}_0x16f6d3=_['merge']({},_0x16f6d3,_0x3f2482[_0xfaa0('0x3d')]);var _0x27cd92={'where':_0x16f6d3[_0xfaa0('0x38')]};return db[_0xfaa0('0x3e')][_0xfaa0('0x1f')](_0x27cd92)[_0xfaa0('0x24')](function(_0x877eb7){_0x53ee29[_0xfaa0('0x1f')]=_0x877eb7;if(_0x3f2482[_0xfaa0('0x2f')][_0xfaa0('0x3f')]){_0x16f6d3[_0xfaa0('0x40')]=[{'all':!![]}];}return db[_0xfaa0('0x3e')][_0xfaa0('0x41')](_0x16f6d3);})[_0xfaa0('0x24')](function(_0x1e1681){_0x53ee29['rows']=_0x1e1681;return _0x53ee29;})['then'](respondWithFilteredResult(_0x45fb0e,_0x16f6d3))[_0xfaa0('0x42')](handleError(_0x45fb0e,null));};exports['show']=function(_0x43d376,_0x541153){var _0x39810={'raw':!![],'where':{'id':_0x43d376[_0xfaa0('0x43')]['id']}},_0x1ccdf7={};_0x1ccdf7[_0xfaa0('0x2e')]=_[_0xfaa0('0x30')](db['Attachment'][_0xfaa0('0x2b')]);_0x1ccdf7[_0xfaa0('0x2f')]=_['keys'](_0x43d376[_0xfaa0('0x2f')]);_0x1ccdf7['filters']=_[_0xfaa0('0x32')](_0x1ccdf7['model'],_0x1ccdf7[_0xfaa0('0x2f')]);_0x39810['attributes']=_['intersection'](_0x1ccdf7[_0xfaa0('0x2e')],qs[_0xfaa0('0x34')](_0x43d376[_0xfaa0('0x2f')][_0xfaa0('0x34')]));_0x39810['attributes']=_0x39810['attributes'][_0xfaa0('0x44')]?_0x39810[_0xfaa0('0x33')]:_0x1ccdf7[_0xfaa0('0x2e')];if(_0x43d376[_0xfaa0('0x2f')][_0xfaa0('0x3f')]){_0x39810[_0xfaa0('0x40')]=[{'all':!![]}];}_0x39810=_['merge']({},_0x39810,_0x43d376[_0xfaa0('0x3d')]);return db[_0xfaa0('0x3e')][_0xfaa0('0x45')](_0x39810)[_0xfaa0('0x24')](handleEntityNotFound(_0x541153,null))[_0xfaa0('0x24')](respondWithResult(_0x541153,null))[_0xfaa0('0x42')](handleError(_0x541153,null));};exports[_0xfaa0('0x46')]=function(_0x5d6913,_0x1d0c67){var _0x489d87={'where':{'id':_0x5d6913[_0xfaa0('0x43')]['id']}},_0x1c02ff={};_0x1c02ff[_0xfaa0('0x2e')]=_[_0xfaa0('0x30')](db['Attachment'][_0xfaa0('0x2b')]);_0x489d87[_0xfaa0('0x33')]=_[_0xfaa0('0x32')](_0x1c02ff[_0xfaa0('0x2e')],qs[_0xfaa0('0x34')](_0x5d6913[_0xfaa0('0x2f')]['fields']));_0x489d87[_0xfaa0('0x33')]=_0x489d87[_0xfaa0('0x33')][_0xfaa0('0x44')]?_0x489d87['attributes']:_0x1c02ff['model'];if(_0x5d6913[_0xfaa0('0x2f')]['includeAll']){_0x489d87['include']=[{'all':!![]}];}_0x489d87=_['merge']({},_0x489d87,_0x5d6913[_0xfaa0('0x3d')]);return db[_0xfaa0('0x3e')][_0xfaa0('0x45')](_0x489d87)[_0xfaa0('0x24')](handleEntityNotFound(_0x1d0c67,null))['then'](function(_0x1ddb3c){if(_0x1ddb3c){var _0x2de155=_0x1ddb3c[_0xfaa0('0x47')]({'plain':!![]});_0x2de155=qs[_0xfaa0('0x48')](_0x2de155,['id',_0xfaa0('0x49'),'updatedAt']);_0x5d6913[_0xfaa0('0x4a')]=_[_0xfaa0('0x48')](_0x5d6913[_0xfaa0('0x4a')],['id','createdAt','updatedAt']);return db['Attachment'][_0xfaa0('0x4b')](_['merge'](_0x2de155,_0x5d6913[_0xfaa0('0x4a')]),{'include':_0x5d6913[_0xfaa0('0x2f')][_0xfaa0('0x3f')]?[{'all':!![]}]:undefined});}})[_0xfaa0('0x24')](respondWithResult(_0x1d0c67,0xc9))['catch'](handleError(_0x1d0c67,null));};exports[_0xfaa0('0x23')]=function(_0x497123,_0x1e628b){if(_0x497123[_0xfaa0('0x4a')]['id']){delete _0x497123[_0xfaa0('0x4a')]['id'];}return db[_0xfaa0('0x3e')][_0xfaa0('0x45')]({'where':{'id':_0x497123['params']['id']}})[_0xfaa0('0x24')](handleEntityNotFound(_0x1e628b,null))[_0xfaa0('0x24')](saveUpdates(_0x497123[_0xfaa0('0x4a')],null))[_0xfaa0('0x24')](respondWithResult(_0x1e628b,null))[_0xfaa0('0x42')](handleError(_0x1e628b,null));};exports[_0xfaa0('0x25')]=function(_0x699f72,_0x27c8db){return db['Attachment'][_0xfaa0('0x45')]({'where':{'id':_0x699f72[_0xfaa0('0x43')]['id']}})['then'](handleEntityNotFound(_0x27c8db,null))[_0xfaa0('0x24')](removeEntity(_0x27c8db,null))[_0xfaa0('0x42')](handleError(_0x27c8db,null));};exports[_0xfaa0('0x4b')]=function(_0x430e13,_0x241a07,_0x111f67){_0x430e13[_0xfaa0('0x4a')][_0xfaa0('0x28')]=_0x430e13['file']['originalname'];_0x430e13[_0xfaa0('0x4a')]['basename']=_0x430e13['file'][_0xfaa0('0x4c')];_0x430e13[_0xfaa0('0x4a')][_0xfaa0('0x2d')]=_0x430e13[_0xfaa0('0x4d')][_0xfaa0('0x4e')];return db['Attachment'][_0xfaa0('0x4b')](_0x430e13['body'])[_0xfaa0('0x24')](respondWithResult(_0x241a07,0xc9))[_0xfaa0('0x42')](handleError(_0x241a07,null));};exports[_0xfaa0('0x4f')]=function(_0x2ee27c,_0x360f3d,_0x5a175b){return db[_0xfaa0('0x3e')]['findOne']({'where':{'id':_0x2ee27c[_0xfaa0('0x43')]['id']},'raw':!![]})[_0xfaa0('0x24')](handleEntityNotFound(_0x360f3d,null))[_0xfaa0('0x24')](function(_0x556956){if(_0x556956){var _0x51c012=_0x556956[_0xfaa0('0x50')]!==null;var _0x5cad0c=path['join'](config['root'],'server/files/attachments/');if(_0x51c012){_0x5cad0c=path[_0xfaa0('0x51')](_0x5cad0c,_0xfaa0('0x52'));}var _0x29b943=path[_0xfaa0('0x51')](_0x5cad0c,_0x556956[_0xfaa0('0x53')]);return _0x360f3d['download'](_0x29b943);}})['catch'](handleError(_0x360f3d,null));}; \ No newline at end of file +var _0x70c8=['pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','clone','length','get','omit','body','createdAt','updatedAt','create','file','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','basename','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','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','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Attachment','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x70c8,0xd5));var _0x870c=function(_0x106518,_0x5d731f){_0x106518=_0x106518-0x0;var _0x1eaf90=_0x70c8[_0x106518];return _0x1eaf90;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x870c('0x0'));var zipdir=require(_0x870c('0x1'));var jsonpatch=require(_0x870c('0x2'));var rp=require(_0x870c('0x3'));var moment=require(_0x870c('0x4'));var BPromise=require(_0x870c('0x5'));var Mustache=require('mustache');var util=require(_0x870c('0x6'));var path=require('path');var sox=require(_0x870c('0x7'));var csv=require(_0x870c('0x8'));var ejs=require(_0x870c('0x9'));var fs=require('fs');var fs_extra=require(_0x870c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x870c('0xb'));var jsforce=require(_0x870c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x870c('0x8'));var querystring=require(_0x870c('0xd'));var Papa=require(_0x870c('0xe'));var Redis=require(_0x870c('0xf'));var authService=require(_0x870c('0x10'));var qs=require(_0x870c('0x11'));var as=require(_0x870c('0x12'));var hardwareService=require(_0x870c('0x13'));var logger=require(_0x870c('0x14'))(_0x870c('0x15'));var utils=require(_0x870c('0x16'));var config=require(_0x870c('0x17'));var licenseUtil=require(_0x870c('0x18'));var db=require(_0x870c('0x19'))['db'];function respondWithStatusCode(_0x3523f4,_0x1207d6){_0x1207d6=_0x1207d6||0xcc;return function(_0x3952a5){if(_0x3952a5){return _0x3523f4[_0x870c('0x1a')](_0x1207d6);}return _0x3523f4['status'](_0x1207d6)[_0x870c('0x1b')]();};}function respondWithResult(_0x66e324,_0x2570f0){_0x2570f0=_0x2570f0||0xc8;return function(_0x113cde){if(_0x113cde){return _0x66e324[_0x870c('0x1c')](_0x2570f0)[_0x870c('0x1d')](_0x113cde);}};}function respondWithFilteredResult(_0x2e1ec9,_0x240b9d){return function(_0xf473ad){if(_0xf473ad){var _0x542793=typeof _0x240b9d['offset']===_0x870c('0x1e')&&typeof _0x240b9d[_0x870c('0x1f')]===_0x870c('0x1e');var _0x474c24=_0xf473ad[_0x870c('0x20')];var _0x50e84b=_0x542793?0x0:_0x240b9d[_0x870c('0x21')];var _0x2f6cfa=_0x542793?_0xf473ad[_0x870c('0x20')]:_0x240b9d[_0x870c('0x21')]+_0x240b9d['limit'];var _0x30a09e;if(_0x2f6cfa>=_0x474c24){_0x2f6cfa=_0x474c24;_0x30a09e=0xc8;}else{_0x30a09e=0xce;}_0x2e1ec9[_0x870c('0x1c')](_0x30a09e);return _0x2e1ec9['set'](_0x870c('0x22'),_0x50e84b+'-'+_0x2f6cfa+'/'+_0x474c24)['json'](_0xf473ad);}return null;};}function patchUpdates(_0x1e8207){return function(_0x1c9075){try{jsonpatch[_0x870c('0x23')](_0x1c9075,_0x1e8207,!![]);}catch(_0x492f50){return BPromise[_0x870c('0x24')](_0x492f50);}return _0x1c9075[_0x870c('0x25')]();};}function saveUpdates(_0xbe3a12,_0x420e95){return function(_0x1d118d){if(_0x1d118d){return _0x1d118d[_0x870c('0x26')](_0xbe3a12)[_0x870c('0x27')](function(_0x3520fd){return _0x3520fd;});}return null;};}function removeEntity(_0x2a0acf,_0x21248b){return function(_0x2735b7){if(_0x2735b7){return _0x2735b7[_0x870c('0x28')]()[_0x870c('0x27')](function(){_0x2a0acf['status'](0xcc)[_0x870c('0x1b')]();});}};}function handleEntityNotFound(_0x506a1c,_0xda6fb){return function(_0x38a693){if(!_0x38a693){_0x506a1c[_0x870c('0x1a')](0x194);}return _0x38a693;};}function handleError(_0x2451ae,_0x1d5ae6){_0x1d5ae6=_0x1d5ae6||0x1f4;return function(_0x111c75){logger[_0x870c('0x29')](_0x111c75[_0x870c('0x2a')]);if(_0x111c75[_0x870c('0x2b')]){delete _0x111c75['name'];}_0x2451ae['status'](_0x1d5ae6)['send'](_0x111c75);};}exports['index']=function(_0x3870c0,_0x59991d){var _0x525486={},_0x12a433={},_0x3d1970={'count':0x0,'rows':[]};var _0x437491=_['map'](db[_0x870c('0x2c')][_0x870c('0x2d')],function(_0x9e7233){return{'name':_0x9e7233[_0x870c('0x2e')],'type':_0x9e7233[_0x870c('0x2f')]['key']};});_0x12a433[_0x870c('0x30')]=_[_0x870c('0x31')](_0x437491,_0x870c('0x2b'));_0x12a433[_0x870c('0x32')]=_[_0x870c('0x33')](_0x3870c0[_0x870c('0x32')]);_0x12a433[_0x870c('0x34')]=_[_0x870c('0x35')](_0x12a433[_0x870c('0x30')],_0x12a433[_0x870c('0x32')]);_0x525486[_0x870c('0x36')]=_[_0x870c('0x35')](_0x12a433[_0x870c('0x30')],qs[_0x870c('0x37')](_0x3870c0[_0x870c('0x32')]['fields']));_0x525486['attributes']=_0x525486[_0x870c('0x36')]['length']?_0x525486[_0x870c('0x36')]:_0x12a433[_0x870c('0x30')];if(!_0x3870c0[_0x870c('0x32')][_0x870c('0x38')](_0x870c('0x39'))){_0x525486['limit']=qs[_0x870c('0x1f')](_0x3870c0[_0x870c('0x32')]['limit']);_0x525486['offset']=qs[_0x870c('0x21')](_0x3870c0[_0x870c('0x32')][_0x870c('0x21')]);}_0x525486['order']=qs[_0x870c('0x3a')](_0x3870c0[_0x870c('0x32')][_0x870c('0x3a')]);_0x525486[_0x870c('0x3b')]=qs[_0x870c('0x34')](_[_0x870c('0x3c')](_0x3870c0[_0x870c('0x32')],_0x12a433[_0x870c('0x34')]),_0x437491);if(_0x3870c0['query'][_0x870c('0x3d')]){_0x525486[_0x870c('0x3b')]=_['merge'](_0x525486[_0x870c('0x3b')],{'$or':_[_0x870c('0x31')](_0x437491,function(_0x2c6d44){if(_0x2c6d44[_0x870c('0x2f')]!==_0x870c('0x3e')){var _0x4a091c={};_0x4a091c[_0x2c6d44['name']]={'$like':'%'+_0x3870c0[_0x870c('0x32')][_0x870c('0x3d')]+'%'};return _0x4a091c;}})});}_0x525486=_[_0x870c('0x3f')]({},_0x525486,_0x3870c0[_0x870c('0x40')]);var _0x2f5ecc={'where':_0x525486['where']};return db[_0x870c('0x2c')][_0x870c('0x20')](_0x2f5ecc)['then'](function(_0x5bc3a7){_0x3d1970[_0x870c('0x20')]=_0x5bc3a7;if(_0x3870c0[_0x870c('0x32')][_0x870c('0x41')]){_0x525486[_0x870c('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x870c('0x43')](_0x525486);})[_0x870c('0x27')](function(_0x2e32d1){_0x3d1970[_0x870c('0x44')]=_0x2e32d1;return _0x3d1970;})[_0x870c('0x27')](respondWithFilteredResult(_0x59991d,_0x525486))[_0x870c('0x45')](handleError(_0x59991d,null));};exports[_0x870c('0x46')]=function(_0x523b15,_0x1fa253){var _0x4600ff={'raw':!![],'where':{'id':_0x523b15[_0x870c('0x47')]['id']}},_0x397a31={};_0x397a31[_0x870c('0x30')]=_['keys'](db['Attachment'][_0x870c('0x2d')]);_0x397a31[_0x870c('0x32')]=_['keys'](_0x523b15['query']);_0x397a31[_0x870c('0x34')]=_[_0x870c('0x35')](_0x397a31[_0x870c('0x30')],_0x397a31[_0x870c('0x32')]);_0x4600ff[_0x870c('0x36')]=_[_0x870c('0x35')](_0x397a31[_0x870c('0x30')],qs[_0x870c('0x37')](_0x523b15[_0x870c('0x32')][_0x870c('0x37')]));_0x4600ff[_0x870c('0x36')]=_0x4600ff['attributes']['length']?_0x4600ff[_0x870c('0x36')]:_0x397a31[_0x870c('0x30')];if(_0x523b15['query']['includeAll']){_0x4600ff[_0x870c('0x42')]=[{'all':!![]}];}_0x4600ff=_[_0x870c('0x3f')]({},_0x4600ff,_0x523b15[_0x870c('0x40')]);return db['Attachment'][_0x870c('0x48')](_0x4600ff)[_0x870c('0x27')](handleEntityNotFound(_0x1fa253,null))[_0x870c('0x27')](respondWithResult(_0x1fa253,null))[_0x870c('0x45')](handleError(_0x1fa253,null));};exports[_0x870c('0x49')]=function(_0x116495,_0x1bb082){var _0x377a6e={'where':{'id':_0x116495[_0x870c('0x47')]['id']}},_0x3ba2c1={};_0x3ba2c1[_0x870c('0x30')]=_[_0x870c('0x33')](db[_0x870c('0x2c')][_0x870c('0x2d')]);_0x377a6e[_0x870c('0x36')]=_[_0x870c('0x35')](_0x3ba2c1['model'],qs[_0x870c('0x37')](_0x116495[_0x870c('0x32')][_0x870c('0x37')]));_0x377a6e[_0x870c('0x36')]=_0x377a6e[_0x870c('0x36')][_0x870c('0x4a')]?_0x377a6e[_0x870c('0x36')]:_0x3ba2c1[_0x870c('0x30')];if(_0x116495[_0x870c('0x32')]['includeAll']){_0x377a6e[_0x870c('0x42')]=[{'all':!![]}];}_0x377a6e=_[_0x870c('0x3f')]({},_0x377a6e,_0x116495['options']);return db['Attachment'][_0x870c('0x48')](_0x377a6e)['then'](handleEntityNotFound(_0x1bb082,null))[_0x870c('0x27')](function(_0x5a4a17){if(_0x5a4a17){var _0x16689f=_0x5a4a17[_0x870c('0x4b')]({'plain':!![]});_0x16689f=qs[_0x870c('0x4c')](_0x16689f,['id','createdAt','updatedAt']);_0x116495[_0x870c('0x4d')]=_['omit'](_0x116495['body'],['id',_0x870c('0x4e'),_0x870c('0x4f')]);return db['Attachment'][_0x870c('0x50')](_[_0x870c('0x3f')](_0x16689f,_0x116495[_0x870c('0x4d')]),{'include':_0x116495[_0x870c('0x32')][_0x870c('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1bb082,0xc9))['catch'](handleError(_0x1bb082,null));};exports['update']=function(_0x576ef9,_0x170a21){if(_0x576ef9[_0x870c('0x4d')]['id']){delete _0x576ef9[_0x870c('0x4d')]['id'];}return db['Attachment'][_0x870c('0x48')]({'where':{'id':_0x576ef9[_0x870c('0x47')]['id']}})[_0x870c('0x27')](handleEntityNotFound(_0x170a21,null))[_0x870c('0x27')](saveUpdates(_0x576ef9[_0x870c('0x4d')],null))[_0x870c('0x27')](respondWithResult(_0x170a21,null))['catch'](handleError(_0x170a21,null));};exports[_0x870c('0x28')]=function(_0x163218,_0x2e4f82){return db[_0x870c('0x2c')][_0x870c('0x48')]({'where':{'id':_0x163218['params']['id']}})[_0x870c('0x27')](handleEntityNotFound(_0x2e4f82,null))['then'](removeEntity(_0x2e4f82,null))[_0x870c('0x45')](handleError(_0x2e4f82,null));};exports[_0x870c('0x50')]=function(_0x256265,_0x2c03e2,_0x3626c4){_0x256265[_0x870c('0x4d')][_0x870c('0x2b')]=_0x256265[_0x870c('0x51')]['originalname'];_0x256265[_0x870c('0x4d')]['basename']=_0x256265[_0x870c('0x51')][_0x870c('0x52')];_0x256265[_0x870c('0x4d')]['type']=_0x256265[_0x870c('0x51')][_0x870c('0x53')];return db['Attachment'][_0x870c('0x50')](_0x256265[_0x870c('0x4d')])[_0x870c('0x27')](respondWithResult(_0x2c03e2,0xc9))[_0x870c('0x45')](handleError(_0x2c03e2,null));};exports['download']=function(_0x5671b8,_0x23887d,_0x514b96){return db[_0x870c('0x2c')][_0x870c('0x54')]({'where':{'id':_0x5671b8[_0x870c('0x47')]['id']},'raw':!![]})[_0x870c('0x27')](handleEntityNotFound(_0x23887d,null))[_0x870c('0x27')](function(_0x217e56){if(_0x217e56){var _0x203675=_0x217e56[_0x870c('0x55')]!==null;var _0x50aeb1=path[_0x870c('0x56')](config[_0x870c('0x57')],_0x870c('0x58'));if(_0x203675){_0x50aeb1=path[_0x870c('0x56')](_0x50aeb1,'offline-chat/');}var _0x519ad7=path[_0x870c('0x56')](_0x50aeb1,_0x217e56[_0x870c('0x59')]);return _0x23887d[_0x870c('0x5a')](_0x519ad7);}})['catch'](handleError(_0x23887d,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index abca8c7..9ac39bc 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 _0xb8a7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','define','Attachment','attachments','lodash'];(function(_0x2059df,_0x367401){var _0xdd848b=function(_0x13055b){while(--_0x13055b){_0x2059df['push'](_0x2059df['shift']());}};_0xdd848b(++_0x367401);}(_0xb8a7,0x81));var _0x7b8a=function(_0x535a87,_0x590522){_0x535a87=_0x535a87-0x0;var _0x1327c5=_0xb8a7[_0x535a87];return _0x1327c5;};'use strict';var _=require(_0x7b8a('0x0'));var util=require(_0x7b8a('0x1'));var logger=require(_0x7b8a('0x2'))(_0x7b8a('0x3'));var moment=require(_0x7b8a('0x4'));var BPromise=require(_0x7b8a('0x5'));var rp=require(_0x7b8a('0x6'));var fs=require('fs');var path=require(_0x7b8a('0x7'));var rimraf=require(_0x7b8a('0x8'));var config=require('../../config/environment');var attributes=require(_0x7b8a('0x9'));module['exports']=function(_0x3e3f24,_0x15572e){return _0x3e3f24[_0x7b8a('0xa')](_0x7b8a('0xb'),attributes,{'tableName':_0x7b8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b58=['bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','lodash','../../config/logger','moment'];(function(_0x2ccbfb,_0x39cb77){var _0x138826=function(_0x5ae547){while(--_0x5ae547){_0x2ccbfb['push'](_0x2ccbfb['shift']());}};_0x138826(++_0x39cb77);}(_0x6b58,0x17e));var _0x86b5=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0x6b58[_0x437d7f];return _0x31058c;};'use strict';var _=require(_0x86b5('0x0'));var util=require('util');var logger=require(_0x86b5('0x1'))('api');var moment=require(_0x86b5('0x2'));var BPromise=require(_0x86b5('0x3'));var rp=require(_0x86b5('0x4'));var fs=require('fs');var path=require(_0x86b5('0x5'));var rimraf=require(_0x86b5('0x6'));var config=require(_0x86b5('0x7'));var attributes=require(_0x86b5('0x8'));module[_0x86b5('0x9')]=function(_0x42863b,_0x1cc2d1){return _0x42863b[_0x86b5('0xa')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 3c473df..e29048e 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 _0xfaa4=['http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Attachment','create','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x2f2af,_0x572e68){var _0x163165=function(_0x5d35fa){while(--_0x5d35fa){_0x2f2af['push'](_0x2f2af['shift']());}};_0x163165(++_0x572e68);}(_0xfaa4,0x1a8));var _0x4faa=function(_0xdd087e,_0xb09416){_0xdd087e=_0xdd087e-0x0;var _0x1e59ed=_0xfaa4[_0xdd087e];return _0x1e59ed;};'use strict';var _=require(_0x4faa('0x0'));var util=require(_0x4faa('0x1'));var moment=require(_0x4faa('0x2'));var BPromise=require(_0x4faa('0x3'));var rs=require(_0x4faa('0x4'));var fs=require('fs');var Redis=require(_0x4faa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4faa('0x6'));var logger=require(_0x4faa('0x7'))(_0x4faa('0x8'));var config=require(_0x4faa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4faa('0xa')][_0x4faa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa46a7d,_0x504f83,_0x528871){return new BPromise(function(_0x5d476f,_0x159843){return client[_0x4faa('0xc')](_0xa46a7d,_0x528871)[_0x4faa('0xd')](function(_0x4dd4d4){logger[_0x4faa('0xe')](_0x4faa('0xf'),_0x504f83,_0x4faa('0x10'));logger[_0x4faa('0x11')](_0x4faa('0x12'),_0x504f83,'request\x20sent',JSON['stringify'](_0x4dd4d4));if(_0x4dd4d4[_0x4faa('0x13')]){if(_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x14')]===0x1f4){logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);return _0x159843(_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);}logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x4dd4d4[_0x4faa('0x13')][_0x4faa('0x15')]);return _0x5d476f(_0x4dd4d4['error'][_0x4faa('0x15')]);}else{logger[_0x4faa('0xe')](_0x4faa('0xf'),_0x504f83,'request\x20sent');_0x5d476f(_0x4dd4d4[_0x4faa('0x16')][_0x4faa('0x15')]);}})[_0x4faa('0x17')](function(_0x536a2b){logger[_0x4faa('0x13')](_0x4faa('0xf'),_0x504f83,_0x536a2b);_0x159843(_0x536a2b);});});}exports['CreateAttachment']=function(_0x5d8c8a){var _0x5444d9=this;return new Promise(function(_0x33592d,_0x361cdc){return db[_0x4faa('0x18')][_0x4faa('0x19')](_0x5d8c8a['body'],{'raw':_0x5d8c8a[_0x4faa('0x1a')]?_0x5d8c8a[_0x4faa('0x1a')][_0x4faa('0x1b')]===undefined?!![]:![]:!![]})[_0x4faa('0xd')](function(_0x492417){logger[_0x4faa('0xe')]('CreateAttachment',_0x5d8c8a);logger['debug'](_0x4faa('0x1c'),_0x5d8c8a,JSON['stringify'](_0x492417));_0x33592d(_0x492417);})['catch'](function(_0x14683b){logger[_0x4faa('0x13')](_0x4faa('0x1c'),_0x14683b[_0x4faa('0x15')],_0x5d8c8a);_0x361cdc(_0x5444d9[_0x4faa('0x13')](0x1f4,_0x14683b[_0x4faa('0x15')]));});});}; \ No newline at end of file +var _0xaaa2=['code','Attachment,\x20%s,\x20%s','message','info','result','CreateAttachment','create','body','options','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error'];(function(_0x246034,_0x20698a){var _0x55ea66=function(_0x34888f){while(--_0x34888f){_0x246034['push'](_0x246034['shift']());}};_0x55ea66(++_0x20698a);}(_0xaaa2,0xac));var _0x2aaa=function(_0x1167f3,_0x560ab1){_0x1167f3=_0x1167f3-0x0;var _0x355aea=_0xaaa2[_0x1167f3];return _0x355aea;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require(_0x2aaa('0x3'));var rs=require(_0x2aaa('0x4'));var fs=require('fs');var Redis=require(_0x2aaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x6'));var logger=require('../../config/logger')(_0x2aaa('0x7'));var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson[_0x2aaa('0xa')][_0x2aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106af9,_0x4f51e6,_0x2f16d7){return new BPromise(function(_0x514c32,_0x505fe8){return client[_0x2aaa('0xc')](_0x106af9,_0x2f16d7)['then'](function(_0x1ad6e9){logger['info']('Attachment,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));logger[_0x2aaa('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'),JSON[_0x2aaa('0xf')](_0x1ad6e9));if(_0x1ad6e9[_0x2aaa('0x10')]){if(_0x1ad6e9['error'][_0x2aaa('0x11')]===0x1f4){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x505fe8(_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);}logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x514c32(_0x1ad6e9[_0x2aaa('0x10')]['message']);}else{logger[_0x2aaa('0x14')]('Attachment,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));_0x514c32(_0x1ad6e9[_0x2aaa('0x15')]['message']);}})['catch'](function(_0x50a767){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x50a767);_0x505fe8(_0x50a767);});});}exports[_0x2aaa('0x16')]=function(_0x3b94bf){var _0x1cae3e=this;return new Promise(function(_0xdaa445,_0x38a049){return db['Attachment'][_0x2aaa('0x17')](_0x3b94bf[_0x2aaa('0x18')],{'raw':_0x3b94bf['options']?_0x3b94bf[_0x2aaa('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1ec32e){logger[_0x2aaa('0x14')](_0x2aaa('0x16'),_0x3b94bf);logger[_0x2aaa('0xe')](_0x2aaa('0x16'),_0x3b94bf,JSON[_0x2aaa('0xf')](_0x1ec32e));_0xdaa445(_0x1ec32e);})[_0x2aaa('0x1a')](function(_0x24da1e){logger['error'](_0x2aaa('0x16'),_0x24da1e[_0x2aaa('0x13')],_0x3b94bf);_0x38a049(_0x1cae3e['error'](0x1f4,_0x24da1e['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index cee2e14..d266cde 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x38e559,_0x512d53){var _0x39ee30=function(_0x2a5aaf){while(--_0x2a5aaf){_0x38e559['push'](_0x38e559['shift']());}};_0x39ee30(++_0x512d53);}(_0x2032,0xd9));var _0x2203=function(_0x72227e,_0x401f13){_0x72227e=_0x72227e-0x0;var _0x4f84bc=_0x2032[_0x72227e];return _0x4f84bc;};'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('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=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(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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 58af99f..7eaf215 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 _0x6b06=['minutes','clearBlockUser','getLicense','catch','status','send','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','passport','passport-local','Strategy','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','domain','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','blockDuration','then','name','disabled','blocked','blockedAt','online','user','agent','add'];(function(_0x56019f,_0x306a23){var _0x50a58c=function(_0x3de80f){while(--_0x3de80f){_0x56019f['push'](_0x56019f['shift']());}};_0x50a58c(++_0x306a23);}(_0x6b06,0xd4));var _0x66b0=function(_0x5c6900,_0xb078e3){_0x5c6900=_0x5c6900-0x0;var _0x1cb0ac=_0x6b06[_0x5c6900];return _0x1cb0ac;};'use strict';var passport=require(_0x66b0('0x0'));var LocalStrategy=require(_0x66b0('0x1'))[_0x66b0('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x66b0('0x3'));var config=require(_0x66b0('0x4'));var logger=require(_0x66b0('0x5'))(_0x66b0('0x6'));function isActiveDirectoryConfigured(_0xf58416){var _0x11e816=![];if(typeof _0xf58416['activedirectory']!==_0x66b0('0x7')){_0x11e816=_0xf58416[_0x66b0('0x8')][_0x66b0('0x9')]&&_0xf58416[_0x66b0('0x8')]['url']&&_0xf58416[_0x66b0('0x8')][_0x66b0('0xa')];}return _0x11e816;}function adAuthenticate(_0x5c7785,_0x46b369,_0x44fd99){return new BPromise(function(_0x37b1b6,_0x104a70){try{var _0x2b443b=new ActiveDirectory(_0x5c7785);_0x2b443b['authenticate'](_0x46b369,_0x44fd99,function(_0x51bfdd,_0x58c271){if(_0x51bfdd){logger[_0x66b0('0xb')]('Error\x20authenticate\x20%s:\x20%s',_0x46b369,util['inspect'](_0x51bfdd,{'showHidden':![],'depth':null}));_0x104a70(_0x66b0('0xc'));}else if(!_0x58c271){logger[_0x66b0('0xb')](_0x66b0('0xd'),_0x46b369);_0x104a70(_0x66b0('0xc'));}else{_0x37b1b6(_0x58c271);}});}catch(_0x3ad46e){_0x104a70(_0x3ad46e);}});}function ActiveDirectoryAuthenticate(_0x5c67df,_0x4214ee,_0x7f8263,_0xfc1415){var _0x3fa001,_0x2e1096;if(!isActiveDirectoryConfigured(config)){logger[_0x66b0('0xb')](_0x66b0('0xe'),_0x4214ee);return _0xfc1415(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x66b0('0xf')][_0x66b0('0x10')]({'where':{'id':0x1},'attributes':[_0x66b0('0x11'),_0x66b0('0x12')],'raw':!![]})[_0x66b0('0x13')](function(_0x27e5c4){_0x3fa001=_0x27e5c4;if(!_0x3fa001[_0x66b0('0x11')]){logger[_0x66b0('0xb')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x4214ee);throw new Error(_0x66b0('0xc'));}return _0x5c67df['findOne']({'attributes':['id',_0x66b0('0x14'),'password','salt','role',_0x66b0('0x15'),_0x66b0('0x16'),_0x66b0('0x17'),_0x66b0('0x18')],'where':{'name':_0x4214ee,'role':{'$or':['admin',_0x66b0('0x19'),_0x66b0('0x1a')]},'adSsoEnabled':!![]}});})[_0x66b0('0x13')](function(_0x92da2a){if(!_0x92da2a||_0x92da2a&&_0x92da2a[_0x66b0('0x14')]!==_0x4214ee){throw new Error(_0x66b0('0xc'));}_0x2e1096=_0x92da2a;var _0x4af0e1=_0x2e1096['name']+'@'+config[_0x66b0('0x8')]['domain'];return adAuthenticate(config['activedirectory'],_0x4af0e1,_0x7f8263);})[_0x66b0('0x13')](function(_0x96e126){if(_0x2e1096[_0x66b0('0x15')]){throw new Error(_0x66b0('0xc'));}if(_0x3fa001[_0x66b0('0x12')]>0x0){if(_0x2e1096[_0x66b0('0x16')]){if(moment(_0x2e1096[_0x66b0('0x17')])[_0x66b0('0x1b')](_0x3fa001[_0x66b0('0x12')],_0x66b0('0x1c'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x66b0('0x1d')](_0x2e1096,0x0,![],null)[_0x66b0('0x13')](function(){return utils[_0x66b0('0x1e')](_0x2e1096);})[_0x66b0('0x13')](function(){return _0xfc1415(null,_0x2e1096);});}else{return utils[_0x66b0('0x1e')](_0x2e1096)[_0x66b0('0x13')](function(){return _0xfc1415(null,_0x2e1096);});}}else{return utils[_0x66b0('0x1e')](_0x2e1096)[_0x66b0('0x13')](function(){return _0xfc1415(null,_0x2e1096);});}})[_0x66b0('0x1f')](function(_0x32b0e1){return _0xfc1415(null,![],_0x32b0e1);});}function handleError(_0x55c81c,_0x3a346d,_0x36df6f){return _0x55c81c[_0x66b0('0x20')](_0x3a346d||0x1f4)[_0x66b0('0x21')]({'message':_0x36df6f?_0x36df6f['message']||_0x36df6f:''});}exports[_0x66b0('0x22')]=function(_0x3e9c8c,_0x32b25b,_0x3fac95){passport[_0x66b0('0x23')](_0x66b0('0x24'),function(_0xfa12fb,_0xf64321,_0x3fcdde){var _0x3a6c67=_0xfa12fb||_0x3fcdde;if(_0x3a6c67){return handleError(_0x32b25b,0x191,_0x3a6c67);}if(!_0xf64321){return handleError(_0x32b25b,0x194,{'message':_0x66b0('0x25')});}else{var _0x40898a={'payload':{'id':_0xf64321['id'],'role':_0xf64321['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x40898a)[_0x66b0('0x13')](function(_0x5bdbbf){_0x32b25b[_0x66b0('0x26')]({'id':_0xf64321['id'],'token':_0x5bdbbf,'statusCall':'','isAlreadyLogged':_0xf64321[_0x66b0('0x18')]});});}})(_0x3e9c8c,_0x32b25b,_0x3fac95);};passport[_0x66b0('0x27')](_0x66b0('0x24'),new LocalStrategy({'usernameField':_0x66b0('0x14'),'passwordField':'password'},function(_0xe15666,_0x1cfb02,_0x5efd4e){return ActiveDirectoryAuthenticate(db['User'],_0xe15666,_0x1cfb02,_0x5efd4e);})); \ No newline at end of file +var _0x25ed=['disabled','blocked','online','user','agent','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','findOne','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role'];(function(_0x486aa7,_0x53f341){var _0x30133c=function(_0x2eff80){while(--_0x2eff80){_0x486aa7['push'](_0x486aa7['shift']());}};_0x30133c(++_0x53f341);}(_0x25ed,0x1e8));var _0xd25e=function(_0x4fc583,_0x1c9563){_0x4fc583=_0x4fc583-0x0;var _0x3b884d=_0x25ed[_0x4fc583];return _0x3b884d;};'use strict';var passport=require(_0xd25e('0x0'));var LocalStrategy=require(_0xd25e('0x1'))['Strategy'];var moment=require(_0xd25e('0x2'));var ActiveDirectory=require(_0xd25e('0x3'));var BPromise=require(_0xd25e('0x4'));var util=require(_0xd25e('0x5'));var db=require(_0xd25e('0x6'))['db'];var authService=require(_0xd25e('0x7'));var utils=require(_0xd25e('0x8'));var config=require(_0xd25e('0x9'));var logger=require(_0xd25e('0xa'))(_0xd25e('0xb'));function isActiveDirectoryConfigured(_0x3ebdc7){var _0x220902=![];if(typeof _0x3ebdc7[_0xd25e('0xc')]!==_0xd25e('0xd')){_0x220902=_0x3ebdc7[_0xd25e('0xc')]['baseDN']&&_0x3ebdc7[_0xd25e('0xc')][_0xd25e('0xe')]&&_0x3ebdc7[_0xd25e('0xc')][_0xd25e('0xf')];}return _0x220902;}function adAuthenticate(_0x474bab,_0x4f15ee,_0x57ce1a){return new BPromise(function(_0x5da1fc,_0x5490d8){try{var _0x3d2530=new ActiveDirectory(_0x474bab);_0x3d2530[_0xd25e('0x10')](_0x4f15ee,_0x57ce1a,function(_0x131c3a,_0x43d9d6){if(_0x131c3a){logger[_0xd25e('0x11')](_0xd25e('0x12'),_0x4f15ee,util[_0xd25e('0x13')](_0x131c3a,{'showHidden':![],'depth':null}));_0x5490d8(_0xd25e('0x14'));}else if(!_0x43d9d6){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x4f15ee);_0x5490d8(_0xd25e('0x14'));}else{_0x5da1fc(_0x43d9d6);}});}catch(_0xecae2e){_0x5490d8(_0xecae2e);}});}function ActiveDirectoryAuthenticate(_0x5e6369,_0x293388,_0x862015,_0x296cc7){var _0x2ebd2d,_0x5e9481;if(!isActiveDirectoryConfigured(config)){logger[_0xd25e('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x293388);return _0x296cc7(null,![],{'message':_0xd25e('0x14')});}return db['Setting'][_0xd25e('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xd25e('0x16')],'raw':!![]})[_0xd25e('0x17')](function(_0x3d3cfb){_0x2ebd2d=_0x3d3cfb;if(!_0x2ebd2d[_0xd25e('0x18')]){logger[_0xd25e('0x11')](_0xd25e('0x19'),_0x293388);throw new Error(_0xd25e('0x14'));}return _0x5e6369[_0xd25e('0x15')]({'attributes':['id',_0xd25e('0x1a'),_0xd25e('0x1b'),'salt',_0xd25e('0x1c'),_0xd25e('0x1d'),_0xd25e('0x1e'),'blockedAt',_0xd25e('0x1f')],'where':{'name':_0x293388,'role':{'$or':['admin',_0xd25e('0x20'),_0xd25e('0x21')]},'adSsoEnabled':!![]}});})[_0xd25e('0x17')](function(_0x217539){if(!_0x217539||_0x217539&&_0x217539[_0xd25e('0x1a')]!==_0x293388){throw new Error(_0xd25e('0x14'));}_0x5e9481=_0x217539;var _0x2d812f=_0x5e9481[_0xd25e('0x1a')]+'@'+config['activedirectory'][_0xd25e('0xf')];return adAuthenticate(config[_0xd25e('0xc')],_0x2d812f,_0x862015);})[_0xd25e('0x17')](function(_0x33d297){if(_0x5e9481[_0xd25e('0x1d')]){throw new Error(_0xd25e('0x14'));}if(_0x2ebd2d[_0xd25e('0x16')]>0x0){if(_0x5e9481['blocked']){if(moment(_0x5e9481[_0xd25e('0x22')])[_0xd25e('0x23')](_0x2ebd2d[_0xd25e('0x16')],_0xd25e('0x24'))>moment()){throw new Error(_0xd25e('0x14'));}return utils[_0xd25e('0x25')](_0x5e9481,0x0,![],null)['then'](function(){return utils[_0xd25e('0x26')](_0x5e9481);})[_0xd25e('0x17')](function(){return _0x296cc7(null,_0x5e9481);});}else{return utils['getLicense'](_0x5e9481)[_0xd25e('0x17')](function(){return _0x296cc7(null,_0x5e9481);});}}else{return utils[_0xd25e('0x26')](_0x5e9481)[_0xd25e('0x17')](function(){return _0x296cc7(null,_0x5e9481);});}})[_0xd25e('0x27')](function(_0x51742e){return _0x296cc7(null,![],_0x51742e);});}function handleError(_0x171630,_0x23d7e2,_0x381e21){return _0x171630[_0xd25e('0x28')](_0x23d7e2||0x1f4)[_0xd25e('0x29')]({'message':_0x381e21?_0x381e21['message']||_0x381e21:''});}exports['login']=function(_0x30642e,_0x489f68,_0x1baf32){passport[_0xd25e('0x10')](_0xd25e('0x2a'),function(_0x294e93,_0x39e1c8,_0xcff3af){var _0x94f360=_0x294e93||_0xcff3af;if(_0x94f360){return handleError(_0x489f68,0x191,_0x94f360);}if(!_0x39e1c8){return handleError(_0x489f68,0x194,{'message':_0xd25e('0x2b')});}else{var _0x461d9f={'payload':{'id':_0x39e1c8['id'],'role':_0x39e1c8[_0xd25e('0x1c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x461d9f)[_0xd25e('0x17')](function(_0xfcf88c){_0x489f68[_0xd25e('0x2c')]({'id':_0x39e1c8['id'],'token':_0xfcf88c,'statusCall':'','isAlreadyLogged':_0x39e1c8[_0xd25e('0x1f')]});});}})(_0x30642e,_0x489f68,_0x1baf32);};passport[_0xd25e('0x2d')](_0xd25e('0x2a'),new LocalStrategy({'usernameField':_0xd25e('0x1a'),'passwordField':'password'},function(_0x35a771,_0x1a670f,_0x5689de){return ActiveDirectoryAuthenticate(db[_0xd25e('0x2e')],_0x35a771,_0x1a670f,_0x5689de);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index c7f863b..73e74d5 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 _0x78c6=['Router','post','login','express'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x78c6,0xef));var _0x678c=function(_0xba4328,_0x26ca88){_0xba4328=_0xba4328-0x0;var _0x5a3fe3=_0x78c6[_0xba4328];return _0x5a3fe3;};'use strict';var express=require(_0x678c('0x0'));var router=express[_0x678c('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x678c('0x2')]('/',controller[_0x678c('0x3')]);module['exports']=router; \ No newline at end of file +var _0x2736=['express','Router','./authActiveDirectory.controller','post','login','exports'];(function(_0xee8b3b,_0x299d1b){var _0x2ec8ce=function(_0x343b9b){while(--_0x343b9b){_0xee8b3b['push'](_0xee8b3b['shift']());}};_0x2ec8ce(++_0x299d1b);}(_0x2736,0xd2));var _0x6273=function(_0x5480fd,_0x46600d){_0x5480fd=_0x5480fd-0x0;var _0x2ec312=_0x2736[_0x5480fd];return _0x2ec312;};'use strict';var express=require(_0x6273('0x0'));var router=express[_0x6273('0x1')]();var controller=require(_0x6273('0x2'));router[_0x6273('0x3')]('/',controller[_0x6273('0x4')]);module[_0x6273('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5e2ade8..21793a5 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(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x7a54,0x106));var _0x47a5=function(_0x43e023,_0x57c0da){_0x43e023=_0x43e023-0x0;var _0x336754=_0x7a54[_0x43e023];return _0x336754;};'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 _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(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x7a54,0x106));var _0x47a5=function(_0x118b16,_0x4b6d97){_0x118b16=_0x118b16-0x0;var _0x434deb=_0x7a54[_0x118b16];return _0x434deb;};'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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 0fa10a9..5bb80ed 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 _0x0787=['./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','exports','express','Router'];(function(_0x6acb69,_0xd36dbf){var _0x29a021=function(_0x374293){while(--_0x374293){_0x6acb69['push'](_0x6acb69['shift']());}};_0x29a021(++_0xd36dbf);}(_0x0787,0x115));var _0x7078=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x0787[_0x506172];return _0x2723c0;};'use strict';var express=require(_0x7078('0x0'));var passport=require('passport');var router=express[_0x7078('0x1')]();var controller=require(_0x7078('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x7078('0x3'));router[_0x7078('0x4')]('/',controller[_0x7078('0x5')]);router['get'](_0x7078('0x6'),controller[_0x7078('0x7')],authService['isMiddleware'],userController[_0x7078('0x5')],authService['setTokenCookie']);module[_0x7078('0x8')]=router; \ No newline at end of file +var _0x0571=['callback','setTokenCookie','express','passport','./authGoogle.controller','../../components/auth/service','get','login','/callback'];(function(_0x148cca,_0x2a682a){var _0xb72d55=function(_0x1eac15){while(--_0x1eac15){_0x148cca['push'](_0x148cca['shift']());}};_0xb72d55(++_0x2a682a);}(_0x0571,0xa4));var _0x1057=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x0571[_0x40b2ed];return _0x18397d;};'use strict';var express=require(_0x1057('0x0'));var passport=require(_0x1057('0x1'));var router=express['Router']();var controller=require(_0x1057('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x1057('0x3'));router[_0x1057('0x4')]('/',controller[_0x1057('0x5')]);router[_0x1057('0x4')](_0x1057('0x6'),controller[_0x1057('0x7')],authService['isMiddleware'],userController[_0x1057('0x5')],authService[_0x1057('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d279a1e..8529625 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 _0xe0ac=['status','send','local-login','role','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','params','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','disabled','blocked','blockedAt','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','MailAccount','find','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','email','Smtp','user','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message'];(function(_0x35d45f,_0x52249d){var _0x4475e8=function(_0x148acc){while(--_0x148acc){_0x35d45f['push'](_0x35d45f['shift']());}};_0x4475e8(++_0x52249d);}(_0xe0ac,0x15a));var _0xce0a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0ac[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xce0a('0x0'));var passport=require('passport');var LocalStrategy=require(_0xce0a('0x1'))[_0xce0a('0x2')];var jayson=require(_0xce0a('0x3'));var _=require(_0xce0a('0x4'));var rs=require(_0xce0a('0x5'));var moment=require(_0xce0a('0x6'));var db=require(_0xce0a('0x7'))['db'];var authService=require(_0xce0a('0x8'));var utils=require(_0xce0a('0x9'));var client=jayson[_0xce0a('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x4dc9a8,_0x1f023a,_0x25c2b8,_0x2f8ead){var _0x376fa5,_0x3e3556;return db[_0xce0a('0xb')][_0xce0a('0xc')]({'where':{'id':0x1},'attributes':[_0xce0a('0xd'),_0xce0a('0xe')],'raw':!![]})[_0xce0a('0xf')](function(_0x562b1b){_0x376fa5=_0x562b1b;return _0x4dc9a8[_0xce0a('0xc')]({'attributes':['id',_0xce0a('0x10'),_0xce0a('0x11'),'salt','role',_0xce0a('0x12'),_0xce0a('0x13'),_0xce0a('0x14'),_0xce0a('0x15')],'where':{'name':_0x1f023a,'role':{'$or':[_0xce0a('0x16'),'user','agent']}}});})[_0xce0a('0xf')](function(_0x1026ce){if(!_0x1026ce||_0x1026ce&&_0x1026ce[_0xce0a('0x10')]!==_0x1f023a){throw new Error(_0xce0a('0x17'));}else{_0x3e3556=_0x1026ce;return _0x3e3556;}})[_0xce0a('0xf')](function(){_0x3e3556[_0xce0a('0x18')](_0x25c2b8,function(_0xf24775,_0x33e1a0){var _0x2369f2=_0x3e3556['loginAttempts']+0x1;if(_0xf24775){return _0x2f8ead(_0xf24775);}else if(!_0x33e1a0){if(_0x3e3556['disabled']){return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});}else if(_0x376fa5[_0xce0a('0xd')]>0x0){if(_0x3e3556[_0xce0a('0x13')]){if(_0x376fa5['blockDuration']>0x0){if(moment(_0x3e3556[_0xce0a('0x14')])[_0xce0a('0x19')](_0x376fa5[_0xce0a('0xe')],_0xce0a('0x1a'))>moment()){return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});}else{return utils['clearBlockUser'](_0x3e3556,_0x2369f2,![],null)['then'](function(){return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});});}}else{return _0x2f8ead(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2369f2>=_0x376fa5[_0xce0a('0xd')]){return utils[_0xce0a('0x1b')](_0x3e3556,0x0,!![],moment())[_0xce0a('0xf')](function(){return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});});}else{return utils[_0xce0a('0x1b')](_0x3e3556,_0x2369f2,![],null)[_0xce0a('0xf')](function(){return _0x2f8ead(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});}}else{if(_0x3e3556[_0xce0a('0x12')]){return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});}else if(_0x376fa5[_0xce0a('0xd')]>0x0){if(_0x3e3556[_0xce0a('0x13')]){if(_0x376fa5[_0xce0a('0xe')]>0x0){if(moment(_0x3e3556['blockedAt'])[_0xce0a('0x19')](_0x376fa5[_0xce0a('0xe')],'minutes')>moment()){return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});}else{return utils[_0xce0a('0x1b')](_0x3e3556,0x0,![],null)[_0xce0a('0xf')](function(){return utils['getLicense'](_0x3e3556);})[_0xce0a('0xf')](function(){return _0x2f8ead(null,_0x3e3556);});}}else{return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});}}else{return utils[_0xce0a('0x1b')](_0x3e3556,0x0,![],null)['then'](function(){return utils[_0xce0a('0x1c')](_0x3e3556);})[_0xce0a('0xf')](function(){return _0x2f8ead(null,_0x3e3556);})['catch'](function(_0x5b8f72){return _0x2f8ead(null,![],_0x5b8f72);});}}else{if(_0x3e3556['blocked']){return _0x2f8ead(null,![],{'message':_0xce0a('0x17')});}else{return utils[_0xce0a('0x1c')](_0x3e3556)[_0xce0a('0xf')](function(){return _0x2f8ead(null,_0x3e3556);});}}}});})['catch'](function(_0x31b1fc){return _0x2f8ead(null,![],_0x31b1fc);});}function sendServiceMail(_0x34da06){return db[_0xce0a('0x1d')][_0xce0a('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xce0a('0x10'),'email'],'include':[{'model':db[_0xce0a('0x1f')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xce0a('0x20')}]}]})[_0xce0a('0xf')](function(_0x437509){if(!_0x437509){throw new Error(_0xce0a('0x21'));}var _0x431452=_0x437509[_0xce0a('0x22')]();var _0x443402={'account':_0x431452,'message':_[_0xce0a('0x23')]({'from':util['format'](_0xce0a('0x24'),_0x437509[_0xce0a('0x10')],_0x437509[_0xce0a('0x25')]||_0x437509[_0xce0a('0x26')][_0xce0a('0x27')])},_0x34da06)};return client['request']('SendMail',_0x443402);})[_0xce0a('0xf')](function(_0x1056c5){if(_0x1056c5[_0xce0a('0x28')]){throw new Error(util[_0xce0a('0x29')](_0xce0a('0x2a'),_0x1056c5['error'][_0xce0a('0x2b')]||JSON['stringify'](_0x1056c5[_0xce0a('0x28')])));}return!![];});}function handleError(_0x4a57b0,_0x5da0a4,_0x4c7497){return _0x4a57b0[_0xce0a('0x2c')](_0x5da0a4||0x1f4)[_0xce0a('0x2d')]({'message':_0x4c7497?_0x4c7497[_0xce0a('0x2b')]||_0x4c7497:''});}exports['login']=function(_0x462ff8,_0x18dcc2,_0x4028d2){passport[_0xce0a('0x18')](_0xce0a('0x2e'),function(_0x370d43,_0x50e316,_0x32005b){var _0x399257=_0x370d43||_0x32005b;if(_0x399257){return handleError(_0x18dcc2,0x191,_0x399257);}if(!_0x50e316){return handleError(_0x18dcc2,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x45e854={'payload':{'id':_0x50e316['id'],'role':_0x50e316[_0xce0a('0x2f')]},'options':{'expiresIn':0x15180}};return authService[_0xce0a('0x30')](_0x45e854)[_0xce0a('0xf')](function(_0x491d75){_0x18dcc2[_0xce0a('0x31')]({'id':_0x50e316['id'],'token':_0x491d75,'statusCall':'','isAlreadyLogged':_0x50e316[_0xce0a('0x32')]});});}})(_0x462ff8,_0x18dcc2,_0x4028d2);};exports[_0xce0a('0x33')]=function(_0x361385,_0x254dec){if(!_0x361385['body'][_0xce0a('0x25')]){return handleError(_0x254dec,0x1f4,{'message':_0xce0a('0x34')});}var _0x2026f9=rs[_0xce0a('0x35')]();_0x361385[_0xce0a('0x36')][_0xce0a('0x25')]=_0x361385[_0xce0a('0x36')][_0xce0a('0x25')][_0xce0a('0x37')]()[_0xce0a('0x38')]();var _0x1696b7;return db[_0xce0a('0xb')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xce0a('0xe')],'raw':!![]})[_0xce0a('0xf')](function(_0x27e09b){_0x1696b7=_0x27e09b;return db[_0xce0a('0x39')][_0xce0a('0x1e')]({'where':{'email':_0x361385[_0xce0a('0x36')]['email']}});})[_0xce0a('0xf')](function(_0x34743a){if(!_0x34743a){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x34743a[_0xce0a('0x12')]){throw new Error(_0xce0a('0x3a'));}if(_0x34743a[_0xce0a('0x13')]){if(moment(_0x34743a[_0xce0a('0x14')])['add'](_0x1696b7[_0xce0a('0xe')],_0xce0a('0x1a'))>moment()){throw new Error(_0xce0a('0x3b'));}else{_0x34743a[_0xce0a('0x13')]=![];_0x34743a[_0xce0a('0x14')]=null;}}_0x34743a[_0xce0a('0x3c')]=_0x2026f9;_0x34743a[_0xce0a('0x3d')]=Date[_0xce0a('0x3e')]()+0x36ee80;return _0x34743a[_0xce0a('0x3f')]();})[_0xce0a('0xf')](function(){return sendServiceMail({'to':_0x361385[_0xce0a('0x36')]['email'],'subject':_0xce0a('0x40'),'text':_0xce0a('0x41')+_0xce0a('0x42')+_0xce0a('0x43')+_0x361385['headers'][_0xce0a('0x44')]+_0xce0a('0x45')+_0x2026f9+'\x0a\x0a'+_0xce0a('0x46')});})[_0xce0a('0xf')](function(){_0x254dec[_0xce0a('0x2c')](0xc8)[_0xce0a('0x2d')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x104a8a){return handleError(_0x254dec,0x1f4,_0x104a8a);});};exports['reset']=function(_0x3ca26a,_0x124ccb){return db['User'][_0xce0a('0x1e')]({'where':{'resetPasswordToken':_0x3ca26a[_0xce0a('0x47')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xce0a('0xf')](function(_0x2e7b8c){if(!_0x2e7b8c){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xce0a('0xb')][_0xce0a('0xc')]({'attributes':['id',_0xce0a('0x48'),_0xce0a('0x49'),_0xce0a('0x4a')]})[_0xce0a('0xf')](function(_0x2a9309){if(_0x2a9309['securePassword'])authService[_0xce0a('0x4b')](_0x3ca26a['body']['password']);if(!_0x2a9309['enforcePasswordHistory']||!_0x2e7b8c[_0xce0a('0x4c')])return _0x2e7b8c;authService[_0xce0a('0x4d')](_0x3ca26a[_0xce0a('0x36')]['password'],_0x2e7b8c['previousPasswords'],_0x2a9309[_0xce0a('0x4a')]);return _0x2e7b8c;})[_0xce0a('0xf')](function(){_0x2e7b8c[_0xce0a('0x11')]=_0x3ca26a[_0xce0a('0x36')][_0xce0a('0x11')];_0x2e7b8c['resetPasswordToken']=null;_0x2e7b8c[_0xce0a('0x3d')]=null;return _0x2e7b8c[_0xce0a('0x3f')]();});})['then'](function(){_0x124ccb[_0xce0a('0x2c')](0xc8)[_0xce0a('0x2d')]({'message':'Password\x20reset!'});})['catch'](function(_0xae97a7){return handleError(_0x124ccb,0x1f4,_0xae97a7);});};passport['use'](_0xce0a('0x2e'),new LocalStrategy({'usernameField':_0xce0a('0x10'),'passwordField':_0xce0a('0x11')},function(_0x1f3be1,_0x5ee156,_0x5526c4){return localAuthenticate(db[_0xce0a('0x39')],_0x1f3be1,_0x5ee156,_0x5526c4);})); \ No newline at end of file +var _0x24fb=['Strategy','lodash','moment','../../components/auth/service','client','Setting','findOne','then','name','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','minutes','allowedLoginAttempts','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','Email\x20parameter\x20is\x20missing','body','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0x24fb,0xde));var _0xb24f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24fb[_0xa464c9];return _0x3d73c4;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')[_0xb24f('0x0')];var jayson=require('jayson/promise');var _=require(_0xb24f('0x1'));var rs=require('randomstring');var moment=require(_0xb24f('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0xb24f('0x3'));var utils=require('../../config/utils');var client=jayson[_0xb24f('0x4')]['http']({'port':0x232b});function localAuthenticate(_0x4ffc24,_0x214fe5,_0x2ac287,_0x1d1971){var _0x1fc31e,_0x17854e;return db[_0xb24f('0x5')][_0xb24f('0x6')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xb24f('0x7')](function(_0x18ba90){_0x1fc31e=_0x18ba90;return _0x4ffc24[_0xb24f('0x6')]({'attributes':['id',_0xb24f('0x8'),'password',_0xb24f('0x9'),_0xb24f('0xa'),_0xb24f('0xb'),_0xb24f('0xc'),_0xb24f('0xd'),_0xb24f('0xe')],'where':{'name':_0x214fe5,'role':{'$or':['admin',_0xb24f('0xf'),_0xb24f('0x10')]}}});})['then'](function(_0x393f8c){if(!_0x393f8c||_0x393f8c&&_0x393f8c['name']!==_0x214fe5){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x17854e=_0x393f8c;return _0x17854e;}})[_0xb24f('0x7')](function(){_0x17854e[_0xb24f('0x11')](_0x2ac287,function(_0x490468,_0xae7ac7){var _0xfbab5c=_0x17854e[_0xb24f('0xe')]+0x1;if(_0x490468){return _0x1d1971(_0x490468);}else if(!_0xae7ac7){if(_0x17854e['disabled']){return _0x1d1971(null,![],{'message':_0xb24f('0x12')});}else if(_0x1fc31e['allowedLoginAttempts']>0x0){if(_0x17854e[_0xb24f('0xc')]){if(_0x1fc31e[_0xb24f('0x13')]>0x0){if(moment(_0x17854e['blockedAt'])[_0xb24f('0x14')](_0x1fc31e[_0xb24f('0x13')],_0xb24f('0x15'))>moment()){return _0x1d1971(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x17854e,_0xfbab5c,![],null)['then'](function(){return _0x1d1971(null,![],{'message':_0xb24f('0x12')});});}}else{return _0x1d1971(null,![],{'message':_0xb24f('0x12')});}}else{if(_0xfbab5c>=_0x1fc31e[_0xb24f('0x16')]){return utils['clearBlockUser'](_0x17854e,0x0,!![],moment())['then'](function(){return _0x1d1971(null,![],{'message':_0xb24f('0x12')});});}else{return utils[_0xb24f('0x17')](_0x17854e,_0xfbab5c,![],null)['then'](function(){return _0x1d1971(null,![],{'message':_0xb24f('0x12')});});}}}else{return _0x1d1971(null,![],{'message':_0xb24f('0x12')});}}else{if(_0x17854e[_0xb24f('0xb')]){return _0x1d1971(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1fc31e[_0xb24f('0x16')]>0x0){if(_0x17854e[_0xb24f('0xc')]){if(_0x1fc31e[_0xb24f('0x13')]>0x0){if(moment(_0x17854e[_0xb24f('0xd')])['add'](_0x1fc31e[_0xb24f('0x13')],_0xb24f('0x15'))>moment()){return _0x1d1971(null,![],{'message':_0xb24f('0x12')});}else{return utils[_0xb24f('0x17')](_0x17854e,0x0,![],null)['then'](function(){return utils[_0xb24f('0x18')](_0x17854e);})[_0xb24f('0x7')](function(){return _0x1d1971(null,_0x17854e);});}}else{return _0x1d1971(null,![],{'message':_0xb24f('0x12')});}}else{return utils[_0xb24f('0x17')](_0x17854e,0x0,![],null)[_0xb24f('0x7')](function(){return utils[_0xb24f('0x18')](_0x17854e);})['then'](function(){return _0x1d1971(null,_0x17854e);})[_0xb24f('0x19')](function(_0x3cdf15){return _0x1d1971(null,![],_0x3cdf15);});}}else{if(_0x17854e[_0xb24f('0xc')]){return _0x1d1971(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x17854e)['then'](function(){return _0x1d1971(null,_0x17854e);});}}}});})['catch'](function(_0x118707){return _0x1d1971(null,![],_0x118707);});}function sendServiceMail(_0x7b4c90){return db[_0xb24f('0x1a')][_0xb24f('0x1b')]({'where':{'service':!![]},'attributes':['id','name',_0xb24f('0x1c')],'include':[{'model':db['MailServerOut'],'as':_0xb24f('0x1d'),'include':[{'model':db[_0xb24f('0x1e')],'as':'CloudProvider'}]}]})['then'](function(_0x2514f1){if(!_0x2514f1){throw new Error(_0xb24f('0x1f'));}var _0x2a43a2=_0x2514f1[_0xb24f('0x20')]();var _0x16b729={'account':_0x2a43a2,'message':_[_0xb24f('0x21')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x2514f1[_0xb24f('0x8')],_0x2514f1[_0xb24f('0x1c')]||_0x2514f1['Smtp'][_0xb24f('0xf')])},_0x7b4c90)};return client[_0xb24f('0x22')](_0xb24f('0x23'),_0x16b729);})[_0xb24f('0x7')](function(_0x38e596){if(_0x38e596[_0xb24f('0x24')]){throw new Error(util[_0xb24f('0x25')](_0xb24f('0x26'),_0x38e596[_0xb24f('0x24')][_0xb24f('0x27')]||JSON[_0xb24f('0x28')](_0x38e596[_0xb24f('0x24')])));}return!![];});}function handleError(_0x586850,_0x3aae5f,_0x1397b6){return _0x586850[_0xb24f('0x29')](_0x3aae5f||0x1f4)[_0xb24f('0x2a')]({'message':_0x1397b6?_0x1397b6[_0xb24f('0x27')]||_0x1397b6:''});}exports[_0xb24f('0x2b')]=function(_0x143ebe,_0x4f7747,_0x1b65a2){passport[_0xb24f('0x11')](_0xb24f('0x2c'),function(_0x31f209,_0x54f0b3,_0x1abac2){var _0x13614a=_0x31f209||_0x1abac2;if(_0x13614a){return handleError(_0x4f7747,0x191,_0x13614a);}if(!_0x54f0b3){return handleError(_0x4f7747,0x194,{'message':_0xb24f('0x2d')});}else{var _0x38711f={'payload':{'id':_0x54f0b3['id'],'role':_0x54f0b3[_0xb24f('0xa')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x38711f)[_0xb24f('0x7')](function(_0x374a13){_0x4f7747[_0xb24f('0x2e')]({'id':_0x54f0b3['id'],'token':_0x374a13,'statusCall':'','isAlreadyLogged':_0x54f0b3[_0xb24f('0x2f')]});});}})(_0x143ebe,_0x4f7747,_0x1b65a2);};exports['forgot']=function(_0x44983e,_0x1b6651){if(!_0x44983e['body'][_0xb24f('0x1c')]){return handleError(_0x1b6651,0x1f4,{'message':_0xb24f('0x30')});}var _0x5e7370=rs['generate']();_0x44983e[_0xb24f('0x31')][_0xb24f('0x1c')]=_0x44983e[_0xb24f('0x31')]['email']['trim']()['toLowerCase']();var _0x158689;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xb24f('0x16'),_0xb24f('0x13')],'raw':!![]})['then'](function(_0x50653b){_0x158689=_0x50653b;return db['User']['find']({'where':{'email':_0x44983e['body'][_0xb24f('0x1c')]}});})[_0xb24f('0x7')](function(_0x4ecd7e){if(!_0x4ecd7e){throw new Error(_0xb24f('0x32'));}if(_0x4ecd7e['disabled']){throw new Error(_0xb24f('0x33'));}if(_0x4ecd7e[_0xb24f('0xc')]){if(moment(_0x4ecd7e['blockedAt'])[_0xb24f('0x14')](_0x158689[_0xb24f('0x13')],_0xb24f('0x15'))>moment()){throw new Error(_0xb24f('0x34'));}else{_0x4ecd7e[_0xb24f('0xc')]=![];_0x4ecd7e['blockedAt']=null;}}_0x4ecd7e[_0xb24f('0x35')]=_0x5e7370;_0x4ecd7e[_0xb24f('0x36')]=Date['now']()+0x36ee80;return _0x4ecd7e['save']();})['then'](function(){return sendServiceMail({'to':_0x44983e[_0xb24f('0x31')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xb24f('0x37')+_0xb24f('0x38')+_0xb24f('0x39')+_0x44983e[_0xb24f('0x3a')]['host']+_0xb24f('0x3b')+_0x5e7370+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xb24f('0x7')](function(){_0x1b6651['status'](0xc8)[_0xb24f('0x2a')]({'message':'Reset\x20Email\x20sent!'});})[_0xb24f('0x19')](function(_0x136e93){return handleError(_0x1b6651,0x1f4,_0x136e93);});};exports['reset']=function(_0x191acc,_0x31d764){return db[_0xb24f('0x3c')]['find']({'where':{'resetPasswordToken':_0x191acc[_0xb24f('0x3d')][_0xb24f('0x3e')],'resetPasswordExpires':{'$gt':Date[_0xb24f('0x3f')]()}}})['then'](function(_0xd1cfb7){if(!_0xd1cfb7){throw new Error(_0xb24f('0x40'));}return db[_0xb24f('0x5')][_0xb24f('0x6')]({'attributes':['id',_0xb24f('0x41'),_0xb24f('0x42'),_0xb24f('0x43')]})[_0xb24f('0x7')](function(_0xea0887){if(_0xea0887[_0xb24f('0x41')])authService['validatePasswordPattern'](_0x191acc['body'][_0xb24f('0x44')]);if(!_0xea0887[_0xb24f('0x42')]||!_0xd1cfb7[_0xb24f('0x45')])return _0xd1cfb7;authService[_0xb24f('0x46')](_0x191acc[_0xb24f('0x31')]['password'],_0xd1cfb7[_0xb24f('0x45')],_0xea0887[_0xb24f('0x43')]);return _0xd1cfb7;})[_0xb24f('0x7')](function(){_0xd1cfb7['password']=_0x191acc[_0xb24f('0x31')][_0xb24f('0x44')];_0xd1cfb7[_0xb24f('0x35')]=null;_0xd1cfb7[_0xb24f('0x36')]=null;return _0xd1cfb7[_0xb24f('0x47')]();});})['then'](function(){_0x31d764[_0xb24f('0x29')](0xc8)['send']({'message':_0xb24f('0x48')});})[_0xb24f('0x19')](function(_0x355c8f){return handleError(_0x31d764,0x1f4,_0x355c8f);});};passport[_0xb24f('0x49')](_0xb24f('0x2c'),new LocalStrategy({'usernameField':_0xb24f('0x8'),'passwordField':'password'},function(_0x398686,_0x4348ef,_0x4a34cd){return localAuthenticate(db['User'],_0x398686,_0x4348ef,_0x4a34cd);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 63990bc..2e11401 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 _0x78d6=['forgot','reset','exports','express','Router','post','login','/forgot'];(function(_0x8ea5c9,_0x42336c){var _0x54b26f=function(_0x5ab6e6){while(--_0x5ab6e6){_0x8ea5c9['push'](_0x8ea5c9['shift']());}};_0x54b26f(++_0x42336c);}(_0x78d6,0xa3));var _0x678d=function(_0x4e58e0,_0x41edb5){_0x4e58e0=_0x4e58e0-0x0;var _0x1d9a44=_0x78d6[_0x4e58e0];return _0x1d9a44;};'use strict';var express=require(_0x678d('0x0'));var router=express[_0x678d('0x1')]();var controller=require('./authLocal.controller');router[_0x678d('0x2')]('/',controller[_0x678d('0x3')]);router['post'](_0x678d('0x4'),controller[_0x678d('0x5')]);router['post']('/reset/:token',controller[_0x678d('0x6')]);module[_0x678d('0x7')]=router; \ No newline at end of file +var _0x0dd1=['/reset/:token','reset','exports','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x1ac9e6,_0x32e25c){var _0x3b0218=function(_0x205ae3){while(--_0x205ae3){_0x1ac9e6['push'](_0x1ac9e6['shift']());}};_0x3b0218(++_0x32e25c);}(_0x0dd1,0x1a1));var _0x10dd=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x0dd1[_0xd22d95];return _0x15d7a3;};'use strict';var express=require('express');var router=express[_0x10dd('0x0')]();var controller=require(_0x10dd('0x1'));router[_0x10dd('0x2')]('/',controller[_0x10dd('0x3')]);router[_0x10dd('0x2')](_0x10dd('0x4'),controller[_0x10dd('0x5')]);router[_0x10dd('0x2')](_0x10dd('0x6'),controller[_0x10dd('0x7')]);module[_0x10dd('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 705bf1f..ecce620 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 _0x9393=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9393,0xcf));var _0x3939=function(_0x2c4724,_0x16b46e){_0x2c4724=_0x2c4724-0x0;var _0x238deb=_0x9393[_0x2c4724];return _0x238deb;};'use strict';var Sequelize=require('sequelize');module[_0x3939('0x0')]={'name':{'type':Sequelize[_0x3939('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3939('0x1')]},'status':{'type':Sequelize[_0x3939('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3939('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7147=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7147,0x8e));var _0x7714=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x7147[_0x671369];return _0x33f2b4;};'use strict';var Sequelize=require(_0x7714('0x0'));module[_0x7714('0x1')]={'name':{'type':Sequelize[_0x7714('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x7714('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7714('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 3d0917e..e18a445 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 _0x4f02=['sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','Automation','count','includeAll','findAll','rows','catch','show','params','find','create','body','addConditions','Condition','omit','ids','getConditions','findOne','pick','addActions','order','getActions','eml-format','rimraf','request-promise','moment','mustache','util'];(function(_0x11fbe2,_0x17a1dc){var _0x21a9ee=function(_0x773466){while(--_0x773466){_0x11fbe2['push'](_0x11fbe2['shift']());}};_0x21a9ee(++_0x17a1dc);}(_0x4f02,0x1da));var _0x24f0=function(_0x130efd,_0x5a97fe){_0x130efd=_0x130efd-0x0;var _0x5a1042=_0x4f02[_0x130efd];return _0x5a1042;};'use strict';var emlformat=require(_0x24f0('0x0'));var rimraf=require(_0x24f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x24f0('0x2'));var moment=require(_0x24f0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x24f0('0x4'));var util=require(_0x24f0('0x5'));var path=require('path');var sox=require(_0x24f0('0x6'));var csv=require('to-csv');var ejs=require(_0x24f0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24f0('0x8'));var squel=require(_0x24f0('0x9'));var crypto=require('crypto');var jsforce=require(_0x24f0('0xa'));var deskjs=require(_0x24f0('0xb'));var toCsv=require(_0x24f0('0xc'));var querystring=require(_0x24f0('0xd'));var Papa=require(_0x24f0('0xe'));var Redis=require('ioredis');var authService=require(_0x24f0('0xf'));var qs=require(_0x24f0('0x10'));var as=require(_0x24f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24f0('0x12'))(_0x24f0('0x13'));var utils=require(_0x24f0('0x14'));var config=require(_0x24f0('0x15'));var licenseUtil=require(_0x24f0('0x16'));var db=require(_0x24f0('0x17'))['db'];function respondWithStatusCode(_0x3a3999,_0x4b0959){_0x4b0959=_0x4b0959||0xcc;return function(_0x21ecbe){if(_0x21ecbe){return _0x3a3999[_0x24f0('0x18')](_0x4b0959);}return _0x3a3999[_0x24f0('0x19')](_0x4b0959)[_0x24f0('0x1a')]();};}function respondWithResult(_0x193ecc,_0x456f9b){_0x456f9b=_0x456f9b||0xc8;return function(_0x1aa246){if(_0x1aa246){return _0x193ecc[_0x24f0('0x19')](_0x456f9b)[_0x24f0('0x1b')](_0x1aa246);}};}function respondWithFilteredResult(_0x5a587f,_0x1213fc){return function(_0x4fcca4){if(_0x4fcca4){var _0x5c2267=typeof _0x1213fc[_0x24f0('0x1c')]==='undefined'&&typeof _0x1213fc['limit']==='undefined';var _0x14225c=_0x4fcca4['count'];var _0x2fa867=_0x5c2267?0x0:_0x1213fc[_0x24f0('0x1c')];var _0x5c4b5b=_0x5c2267?_0x4fcca4['count']:_0x1213fc['offset']+_0x1213fc[_0x24f0('0x1d')];var _0x33aca9;if(_0x5c4b5b>=_0x14225c){_0x5c4b5b=_0x14225c;_0x33aca9=0xc8;}else{_0x33aca9=0xce;}_0x5a587f['status'](_0x33aca9);return _0x5a587f['set']('Content-Range',_0x2fa867+'-'+_0x5c4b5b+'/'+_0x14225c)['json'](_0x4fcca4);}return null;};}function patchUpdates(_0x2a9836){return function(_0x35147c){try{jsonpatch[_0x24f0('0x1e')](_0x35147c,_0x2a9836,!![]);}catch(_0x483710){return BPromise[_0x24f0('0x1f')](_0x483710);}return _0x35147c[_0x24f0('0x20')]();};}function saveUpdates(_0xa27490,_0xf0c68e){return function(_0x4dd8e1){if(_0x4dd8e1){return _0x4dd8e1[_0x24f0('0x21')](_0xa27490)[_0x24f0('0x22')](function(_0x3f7127){return _0x3f7127;});}return null;};}function removeEntity(_0x4fa4a8,_0x101c1e){return function(_0x1ce0e1){if(_0x1ce0e1){return _0x1ce0e1[_0x24f0('0x23')]()[_0x24f0('0x22')](function(){_0x4fa4a8[_0x24f0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1928dc,_0x98b0cf){return function(_0x1de557){if(!_0x1de557){_0x1928dc[_0x24f0('0x18')](0x194);}return _0x1de557;};}function handleError(_0x3c2eb5,_0x28c9b6){_0x28c9b6=_0x28c9b6||0x1f4;return function(_0x301ada){logger['error'](_0x301ada[_0x24f0('0x24')]);if(_0x301ada[_0x24f0('0x25')]){delete _0x301ada[_0x24f0('0x25')];}_0x3c2eb5[_0x24f0('0x19')](_0x28c9b6)[_0x24f0('0x26')](_0x301ada);};}exports[_0x24f0('0x27')]=function(_0x541f09,_0x66478e){var _0x1ff6c4={},_0x3b1f71={},_0x5bcfaa={'count':0x0,'rows':[]};var _0x4df838=_[_0x24f0('0x28')](db['Automation'][_0x24f0('0x29')],function(_0x1f76c3){return{'name':_0x1f76c3['fieldName'],'type':_0x1f76c3['type']['key']};});_0x3b1f71['model']=_['map'](_0x4df838,_0x24f0('0x25'));_0x3b1f71[_0x24f0('0x2a')]=_[_0x24f0('0x2b')](_0x541f09[_0x24f0('0x2a')]);_0x3b1f71[_0x24f0('0x2c')]=_[_0x24f0('0x2d')](_0x3b1f71[_0x24f0('0x2e')],_0x3b1f71[_0x24f0('0x2a')]);_0x1ff6c4['attributes']=_[_0x24f0('0x2d')](_0x3b1f71[_0x24f0('0x2e')],qs['fields'](_0x541f09[_0x24f0('0x2a')][_0x24f0('0x2f')]));_0x1ff6c4[_0x24f0('0x30')]=_0x1ff6c4[_0x24f0('0x30')][_0x24f0('0x31')]?_0x1ff6c4[_0x24f0('0x30')]:_0x3b1f71[_0x24f0('0x2e')];if(!_0x541f09[_0x24f0('0x2a')][_0x24f0('0x32')](_0x24f0('0x33'))){_0x1ff6c4[_0x24f0('0x1d')]=qs['limit'](_0x541f09[_0x24f0('0x2a')][_0x24f0('0x1d')]);_0x1ff6c4[_0x24f0('0x1c')]=qs[_0x24f0('0x1c')](_0x541f09[_0x24f0('0x2a')][_0x24f0('0x1c')]);}_0x1ff6c4['order']=qs['sort'](_0x541f09[_0x24f0('0x2a')][_0x24f0('0x34')]);_0x1ff6c4[_0x24f0('0x35')]=qs['filters'](_['pick'](_0x541f09[_0x24f0('0x2a')],_0x3b1f71[_0x24f0('0x2c')]),_0x4df838);if(_0x541f09['query'][_0x24f0('0x36')]){_0x1ff6c4['where']=_[_0x24f0('0x37')](_0x1ff6c4[_0x24f0('0x35')],{'$or':_[_0x24f0('0x28')](_0x4df838,function(_0x9a1ba4){if(_0x9a1ba4[_0x24f0('0x38')]!==_0x24f0('0x39')){var _0x814acf={};_0x814acf[_0x9a1ba4[_0x24f0('0x25')]]={'$like':'%'+_0x541f09[_0x24f0('0x2a')][_0x24f0('0x36')]+'%'};return _0x814acf;}})});}_0x1ff6c4=_['merge']({},_0x1ff6c4,_0x541f09[_0x24f0('0x3a')]);var _0x43db35={'where':_0x1ff6c4[_0x24f0('0x35')]};return db[_0x24f0('0x3b')][_0x24f0('0x3c')](_0x43db35)[_0x24f0('0x22')](function(_0x4a6a9f){_0x5bcfaa[_0x24f0('0x3c')]=_0x4a6a9f;if(_0x541f09[_0x24f0('0x2a')][_0x24f0('0x3d')]){_0x1ff6c4['include']=[{'all':!![]}];}return db[_0x24f0('0x3b')][_0x24f0('0x3e')](_0x1ff6c4);})['then'](function(_0x3dc6b4){_0x5bcfaa[_0x24f0('0x3f')]=_0x3dc6b4;return _0x5bcfaa;})[_0x24f0('0x22')](respondWithFilteredResult(_0x66478e,_0x1ff6c4))[_0x24f0('0x40')](handleError(_0x66478e,null));};exports[_0x24f0('0x41')]=function(_0x489121,_0x2a8a7f){var _0x463e36={'raw':![],'where':{'id':_0x489121[_0x24f0('0x42')]['id']}},_0xf50ada={};_0xf50ada[_0x24f0('0x2e')]=_[_0x24f0('0x2b')](db['Automation']['rawAttributes']);_0xf50ada[_0x24f0('0x2a')]=_[_0x24f0('0x2b')](_0x489121['query']);_0xf50ada[_0x24f0('0x2c')]=_['intersection'](_0xf50ada[_0x24f0('0x2e')],_0xf50ada[_0x24f0('0x2a')]);_0x463e36[_0x24f0('0x30')]=_['intersection'](_0xf50ada[_0x24f0('0x2e')],qs[_0x24f0('0x2f')](_0x489121[_0x24f0('0x2a')][_0x24f0('0x2f')]));_0x463e36[_0x24f0('0x30')]=_0x463e36[_0x24f0('0x30')][_0x24f0('0x31')]?_0x463e36[_0x24f0('0x30')]:_0xf50ada[_0x24f0('0x2e')];if(_0x489121['query'][_0x24f0('0x3d')]){_0x463e36['include']=[{'all':!![]}];}_0x463e36=_[_0x24f0('0x37')]({},_0x463e36,_0x489121[_0x24f0('0x3a')]);return db[_0x24f0('0x3b')][_0x24f0('0x43')](_0x463e36)[_0x24f0('0x22')](handleEntityNotFound(_0x2a8a7f,null))[_0x24f0('0x22')](respondWithResult(_0x2a8a7f,null))['catch'](handleError(_0x2a8a7f,null));};exports['create']=function(_0x102835,_0x3de9c7){return db[_0x24f0('0x3b')][_0x24f0('0x44')](_0x102835[_0x24f0('0x45')],{})[_0x24f0('0x22')](respondWithResult(_0x3de9c7,0xc9))[_0x24f0('0x40')](handleError(_0x3de9c7,null));};exports[_0x24f0('0x21')]=function(_0x375012,_0x366827){if(_0x375012['body']['id']){delete _0x375012[_0x24f0('0x45')]['id'];}return db[_0x24f0('0x3b')][_0x24f0('0x43')]({'where':{'id':_0x375012[_0x24f0('0x42')]['id']}})['then'](handleEntityNotFound(_0x366827,null))['then'](saveUpdates(_0x375012['body'],null))[_0x24f0('0x22')](respondWithResult(_0x366827,null))['catch'](handleError(_0x366827,null));};exports['destroy']=function(_0x2d2eae,_0x291ff0){return db[_0x24f0('0x3b')][_0x24f0('0x43')]({'where':{'id':_0x2d2eae[_0x24f0('0x42')]['id']}})[_0x24f0('0x22')](handleEntityNotFound(_0x291ff0,null))['then'](removeEntity(_0x291ff0,null))[_0x24f0('0x40')](handleError(_0x291ff0,null));};exports[_0x24f0('0x46')]=function(_0x1d7da1,_0x3d6e16,_0x5c363d){return db[_0x24f0('0x47')][_0x24f0('0x43')]({'where':{'id':_0x1d7da1['params']['id']}})[_0x24f0('0x22')](handleEntityNotFound(_0x3d6e16,null))[_0x24f0('0x22')](function(_0x2e4cb6){if(_0x2e4cb6){return _0x2e4cb6[_0x24f0('0x46')](_0x1d7da1[_0x24f0('0x45')]['ids'],_[_0x24f0('0x48')](_0x1d7da1[_0x24f0('0x45')],[_0x24f0('0x49'),'id'])||{});}})[_0x24f0('0x22')](respondWithResult(_0x3d6e16,null))['catch'](handleError(_0x3d6e16,null));};exports[_0x24f0('0x4a')]=function(_0x41a8ef,_0x2ddca8,_0x4ee8e1){var _0x500d33={};var _0x423be9={};var _0x42c100;var _0x11894a;return db[_0x24f0('0x3b')][_0x24f0('0x4b')]({'where':{'id':_0x41a8ef[_0x24f0('0x42')]['id']}})[_0x24f0('0x22')](handleEntityNotFound(_0x2ddca8,null))[_0x24f0('0x22')](function(_0x3faa45){if(_0x3faa45){_0x42c100=_0x3faa45;_0x423be9['model']=_['keys'](db[_0x24f0('0x47')]['rawAttributes']);_0x423be9[_0x24f0('0x2a')]=_[_0x24f0('0x2b')](_0x41a8ef[_0x24f0('0x2a')]);_0x423be9[_0x24f0('0x2c')]=_['intersection'](_0x423be9[_0x24f0('0x2e')],_0x423be9['query']);_0x500d33['attributes']=_[_0x24f0('0x2d')](_0x423be9['model'],qs['fields'](_0x41a8ef[_0x24f0('0x2a')][_0x24f0('0x2f')]));_0x500d33['attributes']=_0x500d33[_0x24f0('0x30')][_0x24f0('0x31')]?_0x500d33['attributes']:_0x423be9[_0x24f0('0x2e')];_0x500d33['order']=qs[_0x24f0('0x34')](_0x41a8ef[_0x24f0('0x2a')][_0x24f0('0x34')]);_0x500d33[_0x24f0('0x35')]=qs[_0x24f0('0x2c')](_[_0x24f0('0x4c')](_0x41a8ef[_0x24f0('0x2a')],_0x423be9[_0x24f0('0x2c')]));if(_0x41a8ef[_0x24f0('0x2a')]['filter']){_0x500d33['where']=_[_0x24f0('0x37')](_0x500d33[_0x24f0('0x35')],{'$or':_[_0x24f0('0x28')](_0x500d33[_0x24f0('0x30')],function(_0x31818c){var _0xae5db9={};_0xae5db9[_0x31818c]={'$like':'%'+_0x41a8ef['query']['filter']+'%'};return _0xae5db9;})});}_0x500d33=_['merge']({},_0x500d33,_0x41a8ef[_0x24f0('0x3a')]);return _0x42c100[_0x24f0('0x4a')](_0x500d33);}})['then'](function(_0x2862b7){if(_0x2862b7){_0x11894a=_0x2862b7[_0x24f0('0x31')];if(!_0x41a8ef[_0x24f0('0x2a')][_0x24f0('0x32')](_0x24f0('0x33'))){_0x500d33[_0x24f0('0x1d')]=qs['limit'](_0x41a8ef[_0x24f0('0x2a')][_0x24f0('0x1d')]);_0x500d33['offset']=qs['offset'](_0x41a8ef[_0x24f0('0x2a')]['offset']);}return _0x42c100['getConditions'](_0x500d33);}})[_0x24f0('0x22')](function(_0x1da2e7){if(_0x1da2e7){return _0x1da2e7?{'count':_0x11894a,'rows':_0x1da2e7}:null;}})[_0x24f0('0x22')](respondWithResult(_0x2ddca8,null))[_0x24f0('0x40')](handleError(_0x2ddca8,null));};exports['addActions']=function(_0x201efd,_0x1800fb,_0x414029){return db['Action'][_0x24f0('0x43')]({'where':{'id':_0x201efd[_0x24f0('0x42')]['id']}})[_0x24f0('0x22')](handleEntityNotFound(_0x1800fb,null))[_0x24f0('0x22')](function(_0x5e4797){if(_0x5e4797){return _0x5e4797[_0x24f0('0x4d')](_0x201efd['body'][_0x24f0('0x49')],_['omit'](_0x201efd[_0x24f0('0x45')],['ids','id'])||{});}})[_0x24f0('0x22')](respondWithResult(_0x1800fb,null))[_0x24f0('0x40')](handleError(_0x1800fb,null));};exports['getActions']=function(_0x1fde66,_0x4f5c7f,_0x34dcaf){var _0x2fdce5={};var _0x2634d6={};var _0x5db3a2;var _0x4fbd51;return db[_0x24f0('0x3b')]['findOne']({'where':{'id':_0x1fde66[_0x24f0('0x42')]['id']}})[_0x24f0('0x22')](handleEntityNotFound(_0x4f5c7f,null))[_0x24f0('0x22')](function(_0x645c00){if(_0x645c00){_0x5db3a2=_0x645c00;_0x2634d6[_0x24f0('0x2e')]=_[_0x24f0('0x2b')](db['Action'][_0x24f0('0x29')]);_0x2634d6[_0x24f0('0x2a')]=_['keys'](_0x1fde66[_0x24f0('0x2a')]);_0x2634d6[_0x24f0('0x2c')]=_[_0x24f0('0x2d')](_0x2634d6[_0x24f0('0x2e')],_0x2634d6[_0x24f0('0x2a')]);_0x2fdce5[_0x24f0('0x30')]=_[_0x24f0('0x2d')](_0x2634d6[_0x24f0('0x2e')],qs[_0x24f0('0x2f')](_0x1fde66[_0x24f0('0x2a')]['fields']));_0x2fdce5[_0x24f0('0x30')]=_0x2fdce5['attributes']['length']?_0x2fdce5['attributes']:_0x2634d6[_0x24f0('0x2e')];_0x2fdce5[_0x24f0('0x4e')]=qs[_0x24f0('0x34')](_0x1fde66['query']['sort']);_0x2fdce5[_0x24f0('0x35')]=qs[_0x24f0('0x2c')](_['pick'](_0x1fde66[_0x24f0('0x2a')],_0x2634d6[_0x24f0('0x2c')]));if(_0x1fde66[_0x24f0('0x2a')]['filter']){_0x2fdce5['where']=_[_0x24f0('0x37')](_0x2fdce5[_0x24f0('0x35')],{'$or':_[_0x24f0('0x28')](_0x2fdce5['attributes'],function(_0x548010){var _0x3dbb4a={};_0x3dbb4a[_0x548010]={'$like':'%'+_0x1fde66[_0x24f0('0x2a')]['filter']+'%'};return _0x3dbb4a;})});}_0x2fdce5=_['merge']({},_0x2fdce5,_0x1fde66[_0x24f0('0x3a')]);return _0x5db3a2[_0x24f0('0x4f')](_0x2fdce5);}})[_0x24f0('0x22')](function(_0x34fe3c){if(_0x34fe3c){_0x4fbd51=_0x34fe3c[_0x24f0('0x31')];if(!_0x1fde66['query'][_0x24f0('0x32')](_0x24f0('0x33'))){_0x2fdce5[_0x24f0('0x1d')]=qs[_0x24f0('0x1d')](_0x1fde66[_0x24f0('0x2a')][_0x24f0('0x1d')]);_0x2fdce5[_0x24f0('0x1c')]=qs[_0x24f0('0x1c')](_0x1fde66[_0x24f0('0x2a')][_0x24f0('0x1c')]);}return _0x5db3a2[_0x24f0('0x4f')](_0x2fdce5);}})['then'](function(_0x1e3bb9){if(_0x1e3bb9){return _0x1e3bb9?{'count':_0x4fbd51,'rows':_0x1e3bb9}:null;}})['then'](respondWithResult(_0x4f5c7f,null))[_0x24f0('0x40')](handleError(_0x4f5c7f,null));}; \ No newline at end of file +var _0x9752=['error','stack','name','send','index','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','Automation','count','includeAll','include','findAll','rows','catch','merge','find','create','body','params','addConditions','Condition','ids','omit','getConditions','findOne','order','options','length','Action','addActions','getActions','rimraf','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x187466,_0x3ad0bb){var _0x34c0a2=function(_0x41d10b){while(--_0x41d10b){_0x187466['push'](_0x187466['shift']());}};_0x34c0a2(++_0x3ad0bb);}(_0x9752,0x7d));var _0x2975=function(_0x534ac9,_0x5c71ca){_0x534ac9=_0x534ac9-0x0;var _0x3cbbfe=_0x9752[_0x534ac9];return _0x3cbbfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2975('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2975('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2975('0x2'));var Mustache=require(_0x2975('0x3'));var util=require(_0x2975('0x4'));var path=require('path');var sox=require(_0x2975('0x5'));var csv=require('to-csv');var ejs=require(_0x2975('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2975('0x7'));var squel=require(_0x2975('0x8'));var crypto=require(_0x2975('0x9'));var jsforce=require(_0x2975('0xa'));var deskjs=require(_0x2975('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2975('0xc'));var Papa=require(_0x2975('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2975('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2975('0xf'));var utils=require(_0x2975('0x10'));var config=require(_0x2975('0x11'));var licenseUtil=require(_0x2975('0x12'));var db=require(_0x2975('0x13'))['db'];function respondWithStatusCode(_0x4c99bd,_0x10edab){_0x10edab=_0x10edab||0xcc;return function(_0x46ebce){if(_0x46ebce){return _0x4c99bd[_0x2975('0x14')](_0x10edab);}return _0x4c99bd[_0x2975('0x15')](_0x10edab)[_0x2975('0x16')]();};}function respondWithResult(_0x315910,_0x215d00){_0x215d00=_0x215d00||0xc8;return function(_0x25ced8){if(_0x25ced8){return _0x315910[_0x2975('0x15')](_0x215d00)[_0x2975('0x17')](_0x25ced8);}};}function respondWithFilteredResult(_0x21c3c1,_0x1361f6){return function(_0x18fb0f){if(_0x18fb0f){var _0x43ccf4=typeof _0x1361f6[_0x2975('0x18')]===_0x2975('0x19')&&typeof _0x1361f6['limit']===_0x2975('0x19');var _0x55b0c2=_0x18fb0f['count'];var _0x32bd12=_0x43ccf4?0x0:_0x1361f6['offset'];var _0x34f408=_0x43ccf4?_0x18fb0f['count']:_0x1361f6[_0x2975('0x18')]+_0x1361f6[_0x2975('0x1a')];var _0x56f1d5;if(_0x34f408>=_0x55b0c2){_0x34f408=_0x55b0c2;_0x56f1d5=0xc8;}else{_0x56f1d5=0xce;}_0x21c3c1[_0x2975('0x15')](_0x56f1d5);return _0x21c3c1[_0x2975('0x1b')](_0x2975('0x1c'),_0x32bd12+'-'+_0x34f408+'/'+_0x55b0c2)[_0x2975('0x17')](_0x18fb0f);}return null;};}function patchUpdates(_0x56f507){return function(_0x337e91){try{jsonpatch[_0x2975('0x1d')](_0x337e91,_0x56f507,!![]);}catch(_0x27323c){return BPromise[_0x2975('0x1e')](_0x27323c);}return _0x337e91[_0x2975('0x1f')]();};}function saveUpdates(_0x4acf3e,_0x4b287f){return function(_0x4072b0){if(_0x4072b0){return _0x4072b0[_0x2975('0x20')](_0x4acf3e)['then'](function(_0x36872c){return _0x36872c;});}return null;};}function removeEntity(_0xd26f58,_0x218efa){return function(_0x4399d1){if(_0x4399d1){return _0x4399d1[_0x2975('0x21')]()[_0x2975('0x22')](function(){_0xd26f58[_0x2975('0x15')](0xcc)[_0x2975('0x16')]();});}};}function handleEntityNotFound(_0x376d69,_0x13ac2a){return function(_0x9a55f8){if(!_0x9a55f8){_0x376d69[_0x2975('0x14')](0x194);}return _0x9a55f8;};}function handleError(_0x142719,_0x541ee7){_0x541ee7=_0x541ee7||0x1f4;return function(_0x13346c){logger[_0x2975('0x23')](_0x13346c[_0x2975('0x24')]);if(_0x13346c[_0x2975('0x25')]){delete _0x13346c[_0x2975('0x25')];}_0x142719[_0x2975('0x15')](_0x541ee7)[_0x2975('0x26')](_0x13346c);};}exports[_0x2975('0x27')]=function(_0x592fda,_0x357e28){var _0x2470d0={},_0x305160={},_0x466e03={'count':0x0,'rows':[]};var _0x18ced5=_['map'](db['Automation'][_0x2975('0x28')],function(_0x492c31){return{'name':_0x492c31[_0x2975('0x29')],'type':_0x492c31['type']['key']};});_0x305160['model']=_[_0x2975('0x2a')](_0x18ced5,_0x2975('0x25'));_0x305160[_0x2975('0x2b')]=_[_0x2975('0x2c')](_0x592fda[_0x2975('0x2b')]);_0x305160[_0x2975('0x2d')]=_[_0x2975('0x2e')](_0x305160[_0x2975('0x2f')],_0x305160[_0x2975('0x2b')]);_0x2470d0[_0x2975('0x30')]=_[_0x2975('0x2e')](_0x305160[_0x2975('0x2f')],qs[_0x2975('0x31')](_0x592fda[_0x2975('0x2b')]['fields']));_0x2470d0[_0x2975('0x30')]=_0x2470d0[_0x2975('0x30')]['length']?_0x2470d0[_0x2975('0x30')]:_0x305160[_0x2975('0x2f')];if(!_0x592fda[_0x2975('0x2b')][_0x2975('0x32')](_0x2975('0x33'))){_0x2470d0['limit']=qs['limit'](_0x592fda[_0x2975('0x2b')][_0x2975('0x1a')]);_0x2470d0[_0x2975('0x18')]=qs[_0x2975('0x18')](_0x592fda[_0x2975('0x2b')][_0x2975('0x18')]);}_0x2470d0['order']=qs[_0x2975('0x34')](_0x592fda[_0x2975('0x2b')][_0x2975('0x34')]);_0x2470d0[_0x2975('0x35')]=qs[_0x2975('0x2d')](_[_0x2975('0x36')](_0x592fda['query'],_0x305160[_0x2975('0x2d')]),_0x18ced5);if(_0x592fda[_0x2975('0x2b')][_0x2975('0x37')]){_0x2470d0[_0x2975('0x35')]=_['merge'](_0x2470d0[_0x2975('0x35')],{'$or':_[_0x2975('0x2a')](_0x18ced5,function(_0x1a97a4){if(_0x1a97a4['type']!=='VIRTUAL'){var _0x5cea80={};_0x5cea80[_0x1a97a4[_0x2975('0x25')]]={'$like':'%'+_0x592fda[_0x2975('0x2b')]['filter']+'%'};return _0x5cea80;}})});}_0x2470d0=_['merge']({},_0x2470d0,_0x592fda['options']);var _0x922ec9={'where':_0x2470d0[_0x2975('0x35')]};return db[_0x2975('0x38')][_0x2975('0x39')](_0x922ec9)[_0x2975('0x22')](function(_0x1480e1){_0x466e03[_0x2975('0x39')]=_0x1480e1;if(_0x592fda[_0x2975('0x2b')][_0x2975('0x3a')]){_0x2470d0[_0x2975('0x3b')]=[{'all':!![]}];}return db[_0x2975('0x38')][_0x2975('0x3c')](_0x2470d0);})[_0x2975('0x22')](function(_0x57d9cd){_0x466e03[_0x2975('0x3d')]=_0x57d9cd;return _0x466e03;})[_0x2975('0x22')](respondWithFilteredResult(_0x357e28,_0x2470d0))[_0x2975('0x3e')](handleError(_0x357e28,null));};exports['show']=function(_0x1253f2,_0x1f974e){var _0x4e7ec8={'raw':![],'where':{'id':_0x1253f2['params']['id']}},_0x3ba4a8={};_0x3ba4a8[_0x2975('0x2f')]=_[_0x2975('0x2c')](db[_0x2975('0x38')][_0x2975('0x28')]);_0x3ba4a8[_0x2975('0x2b')]=_[_0x2975('0x2c')](_0x1253f2['query']);_0x3ba4a8[_0x2975('0x2d')]=_[_0x2975('0x2e')](_0x3ba4a8['model'],_0x3ba4a8[_0x2975('0x2b')]);_0x4e7ec8[_0x2975('0x30')]=_[_0x2975('0x2e')](_0x3ba4a8[_0x2975('0x2f')],qs[_0x2975('0x31')](_0x1253f2[_0x2975('0x2b')][_0x2975('0x31')]));_0x4e7ec8['attributes']=_0x4e7ec8[_0x2975('0x30')]['length']?_0x4e7ec8['attributes']:_0x3ba4a8[_0x2975('0x2f')];if(_0x1253f2['query'][_0x2975('0x3a')]){_0x4e7ec8[_0x2975('0x3b')]=[{'all':!![]}];}_0x4e7ec8=_[_0x2975('0x3f')]({},_0x4e7ec8,_0x1253f2['options']);return db[_0x2975('0x38')][_0x2975('0x40')](_0x4e7ec8)[_0x2975('0x22')](handleEntityNotFound(_0x1f974e,null))[_0x2975('0x22')](respondWithResult(_0x1f974e,null))['catch'](handleError(_0x1f974e,null));};exports['create']=function(_0x316f04,_0x4dcb87){return db['Automation'][_0x2975('0x41')](_0x316f04[_0x2975('0x42')],{})[_0x2975('0x22')](respondWithResult(_0x4dcb87,0xc9))[_0x2975('0x3e')](handleError(_0x4dcb87,null));};exports[_0x2975('0x20')]=function(_0x47f0d8,_0x40cd47){if(_0x47f0d8[_0x2975('0x42')]['id']){delete _0x47f0d8['body']['id'];}return db[_0x2975('0x38')][_0x2975('0x40')]({'where':{'id':_0x47f0d8[_0x2975('0x43')]['id']}})['then'](handleEntityNotFound(_0x40cd47,null))[_0x2975('0x22')](saveUpdates(_0x47f0d8[_0x2975('0x42')],null))[_0x2975('0x22')](respondWithResult(_0x40cd47,null))[_0x2975('0x3e')](handleError(_0x40cd47,null));};exports[_0x2975('0x21')]=function(_0x52e9d5,_0x6750c4){return db[_0x2975('0x38')][_0x2975('0x40')]({'where':{'id':_0x52e9d5[_0x2975('0x43')]['id']}})[_0x2975('0x22')](handleEntityNotFound(_0x6750c4,null))[_0x2975('0x22')](removeEntity(_0x6750c4,null))[_0x2975('0x3e')](handleError(_0x6750c4,null));};exports[_0x2975('0x44')]=function(_0x160afd,_0x3b48d3,_0x4a09db){return db[_0x2975('0x45')][_0x2975('0x40')]({'where':{'id':_0x160afd[_0x2975('0x43')]['id']}})[_0x2975('0x22')](handleEntityNotFound(_0x3b48d3,null))[_0x2975('0x22')](function(_0xa005){if(_0xa005){return _0xa005['addConditions'](_0x160afd['body'][_0x2975('0x46')],_[_0x2975('0x47')](_0x160afd[_0x2975('0x42')],[_0x2975('0x46'),'id'])||{});}})[_0x2975('0x22')](respondWithResult(_0x3b48d3,null))[_0x2975('0x3e')](handleError(_0x3b48d3,null));};exports[_0x2975('0x48')]=function(_0x30af96,_0x2c76f6,_0x14463e){var _0x2cc5a8={};var _0x496278={};var _0x18842d;var _0xa18a5e;return db['Automation'][_0x2975('0x49')]({'where':{'id':_0x30af96[_0x2975('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c76f6,null))[_0x2975('0x22')](function(_0x4196aa){if(_0x4196aa){_0x18842d=_0x4196aa;_0x496278[_0x2975('0x2f')]=_['keys'](db[_0x2975('0x45')][_0x2975('0x28')]);_0x496278[_0x2975('0x2b')]=_[_0x2975('0x2c')](_0x30af96[_0x2975('0x2b')]);_0x496278[_0x2975('0x2d')]=_[_0x2975('0x2e')](_0x496278[_0x2975('0x2f')],_0x496278[_0x2975('0x2b')]);_0x2cc5a8[_0x2975('0x30')]=_['intersection'](_0x496278[_0x2975('0x2f')],qs[_0x2975('0x31')](_0x30af96[_0x2975('0x2b')]['fields']));_0x2cc5a8[_0x2975('0x30')]=_0x2cc5a8[_0x2975('0x30')]['length']?_0x2cc5a8[_0x2975('0x30')]:_0x496278[_0x2975('0x2f')];_0x2cc5a8[_0x2975('0x4a')]=qs[_0x2975('0x34')](_0x30af96[_0x2975('0x2b')][_0x2975('0x34')]);_0x2cc5a8[_0x2975('0x35')]=qs['filters'](_['pick'](_0x30af96[_0x2975('0x2b')],_0x496278['filters']));if(_0x30af96[_0x2975('0x2b')]['filter']){_0x2cc5a8[_0x2975('0x35')]=_[_0x2975('0x3f')](_0x2cc5a8[_0x2975('0x35')],{'$or':_['map'](_0x2cc5a8[_0x2975('0x30')],function(_0x556249){var _0xbe254c={};_0xbe254c[_0x556249]={'$like':'%'+_0x30af96[_0x2975('0x2b')][_0x2975('0x37')]+'%'};return _0xbe254c;})});}_0x2cc5a8=_[_0x2975('0x3f')]({},_0x2cc5a8,_0x30af96[_0x2975('0x4b')]);return _0x18842d[_0x2975('0x48')](_0x2cc5a8);}})[_0x2975('0x22')](function(_0x5801c5){if(_0x5801c5){_0xa18a5e=_0x5801c5[_0x2975('0x4c')];if(!_0x30af96['query'][_0x2975('0x32')](_0x2975('0x33'))){_0x2cc5a8[_0x2975('0x1a')]=qs[_0x2975('0x1a')](_0x30af96[_0x2975('0x2b')]['limit']);_0x2cc5a8[_0x2975('0x18')]=qs[_0x2975('0x18')](_0x30af96['query']['offset']);}return _0x18842d[_0x2975('0x48')](_0x2cc5a8);}})[_0x2975('0x22')](function(_0x1087c3){if(_0x1087c3){return _0x1087c3?{'count':_0xa18a5e,'rows':_0x1087c3}:null;}})[_0x2975('0x22')](respondWithResult(_0x2c76f6,null))[_0x2975('0x3e')](handleError(_0x2c76f6,null));};exports['addActions']=function(_0x532a34,_0x4b97ae,_0x736660){return db[_0x2975('0x4d')][_0x2975('0x40')]({'where':{'id':_0x532a34[_0x2975('0x43')]['id']}})[_0x2975('0x22')](handleEntityNotFound(_0x4b97ae,null))[_0x2975('0x22')](function(_0x342f29){if(_0x342f29){return _0x342f29[_0x2975('0x4e')](_0x532a34['body']['ids'],_['omit'](_0x532a34[_0x2975('0x42')],['ids','id'])||{});}})['then'](respondWithResult(_0x4b97ae,null))['catch'](handleError(_0x4b97ae,null));};exports[_0x2975('0x4f')]=function(_0x334c47,_0x38b193,_0x1b8437){var _0x2c4335={};var _0x596569={};var _0x2f1b89;var _0x2a1099;return db[_0x2975('0x38')][_0x2975('0x49')]({'where':{'id':_0x334c47[_0x2975('0x43')]['id']}})[_0x2975('0x22')](handleEntityNotFound(_0x38b193,null))[_0x2975('0x22')](function(_0x74ce86){if(_0x74ce86){_0x2f1b89=_0x74ce86;_0x596569[_0x2975('0x2f')]=_[_0x2975('0x2c')](db['Action'][_0x2975('0x28')]);_0x596569[_0x2975('0x2b')]=_[_0x2975('0x2c')](_0x334c47[_0x2975('0x2b')]);_0x596569[_0x2975('0x2d')]=_['intersection'](_0x596569[_0x2975('0x2f')],_0x596569[_0x2975('0x2b')]);_0x2c4335['attributes']=_[_0x2975('0x2e')](_0x596569[_0x2975('0x2f')],qs[_0x2975('0x31')](_0x334c47[_0x2975('0x2b')]['fields']));_0x2c4335[_0x2975('0x30')]=_0x2c4335[_0x2975('0x30')]['length']?_0x2c4335[_0x2975('0x30')]:_0x596569[_0x2975('0x2f')];_0x2c4335[_0x2975('0x4a')]=qs[_0x2975('0x34')](_0x334c47[_0x2975('0x2b')]['sort']);_0x2c4335[_0x2975('0x35')]=qs['filters'](_['pick'](_0x334c47[_0x2975('0x2b')],_0x596569[_0x2975('0x2d')]));if(_0x334c47[_0x2975('0x2b')][_0x2975('0x37')]){_0x2c4335['where']=_[_0x2975('0x3f')](_0x2c4335['where'],{'$or':_[_0x2975('0x2a')](_0x2c4335[_0x2975('0x30')],function(_0x214df5){var _0xa178bc={};_0xa178bc[_0x214df5]={'$like':'%'+_0x334c47[_0x2975('0x2b')]['filter']+'%'};return _0xa178bc;})});}_0x2c4335=_[_0x2975('0x3f')]({},_0x2c4335,_0x334c47[_0x2975('0x4b')]);return _0x2f1b89[_0x2975('0x4f')](_0x2c4335);}})['then'](function(_0x278a77){if(_0x278a77){_0x2a1099=_0x278a77[_0x2975('0x4c')];if(!_0x334c47['query']['hasOwnProperty'](_0x2975('0x33'))){_0x2c4335[_0x2975('0x1a')]=qs[_0x2975('0x1a')](_0x334c47[_0x2975('0x2b')]['limit']);_0x2c4335['offset']=qs['offset'](_0x334c47[_0x2975('0x2b')][_0x2975('0x18')]);}return _0x2f1b89[_0x2975('0x4f')](_0x2c4335);}})[_0x2975('0x22')](function(_0x3e5555){if(_0x3e5555){return _0x3e5555?{'count':_0x2a1099,'rows':_0x3e5555}:null;}})[_0x2975('0x22')](respondWithResult(_0x38b193,null))['catch'](handleError(_0x38b193,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6fbdda2..b7ffbfe 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 _0x9f86=['exports','Automation','tools_automations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x43a42a,_0x261cdb){var _0x1f363b=function(_0x4516f5){while(--_0x4516f5){_0x43a42a['push'](_0x43a42a['shift']());}};_0x1f363b(++_0x261cdb);}(_0x9f86,0xab));var _0x69f8=function(_0x7e3f06,_0x426f70){_0x7e3f06=_0x7e3f06-0x0;var _0x12b8ff=_0x9f86[_0x7e3f06];return _0x12b8ff;};'use strict';var _=require(_0x69f8('0x0'));var util=require(_0x69f8('0x1'));var logger=require('../../config/logger')(_0x69f8('0x2'));var moment=require(_0x69f8('0x3'));var BPromise=require(_0x69f8('0x4'));var rp=require(_0x69f8('0x5'));var fs=require('fs');var path=require(_0x69f8('0x6'));var rimraf=require(_0x69f8('0x7'));var config=require(_0x69f8('0x8'));var attributes=require('./automation.attributes');module[_0x69f8('0x9')]=function(_0x484c02,_0x5b0cfd){return _0x484c02['define'](_0x69f8('0xa'),attributes,{'tableName':_0x69f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcc3=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash'];(function(_0x2949c4,_0xad5c15){var _0x513f02=function(_0x599c13){while(--_0x599c13){_0x2949c4['push'](_0x2949c4['shift']());}};_0x513f02(++_0xad5c15);}(_0xbcc3,0x8f));var _0x3bcc=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xbcc3[_0x21de89];return _0x290b7e;};'use strict';var _=require(_0x3bcc('0x0'));var util=require(_0x3bcc('0x1'));var logger=require('../../config/logger')(_0x3bcc('0x2'));var moment=require(_0x3bcc('0x3'));var BPromise=require(_0x3bcc('0x4'));var rp=require(_0x3bcc('0x5'));var fs=require('fs');var path=require(_0x3bcc('0x6'));var rimraf=require(_0x3bcc('0x7'));var config=require(_0x3bcc('0x8'));var attributes=require(_0x3bcc('0x9'));module['exports']=function(_0xa5b33c,_0x2f2df2){return _0xa5b33c[_0x3bcc('0xa')]('Automation',attributes,{'tableName':_0x3bcc('0xb'),'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 7649412..e968557 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 _0xcac3=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x556b47,_0x53ffe5){var _0x101453=function(_0x301a79){while(--_0x301a79){_0x556b47['push'](_0x556b47['shift']());}};_0x101453(++_0x53ffe5);}(_0xcac3,0x193));var _0x3cac=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0xcac3[_0x317bf0];return _0x225932;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var moment=require(_0x3cac('0x1'));var BPromise=require(_0x3cac('0x2'));var rs=require(_0x3cac('0x3'));var fs=require('fs');var Redis=require(_0x3cac('0x4'));var db=require(_0x3cac('0x5'))['db'];var utils=require(_0x3cac('0x6'));var logger=require(_0x3cac('0x7'))(_0x3cac('0x8'));var config=require(_0x3cac('0x9'));var jayson=require(_0x3cac('0xa'));var client=jayson[_0x3cac('0xb')][_0x3cac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e2560,_0x14562c,_0x21365c){return new BPromise(function(_0x13c1b9,_0x55670d){return client[_0x3cac('0xd')](_0x1e2560,_0x21365c)[_0x3cac('0xe')](function(_0x3bcbed){logger[_0x3cac('0xf')](_0x3cac('0x10'),_0x14562c,'request\x20sent');logger[_0x3cac('0x11')](_0x3cac('0x12'),_0x14562c,_0x3cac('0x13'),JSON[_0x3cac('0x14')](_0x3bcbed));if(_0x3bcbed[_0x3cac('0x15')]){if(_0x3bcbed['error']['code']===0x1f4){logger[_0x3cac('0x15')](_0x3cac('0x10'),_0x14562c,_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);return _0x55670d(_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);}logger[_0x3cac('0x15')]('Automation,\x20%s,\x20%s',_0x14562c,_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);return _0x13c1b9(_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);}else{logger[_0x3cac('0xf')](_0x3cac('0x10'),_0x14562c,_0x3cac('0x13'));_0x13c1b9(_0x3bcbed[_0x3cac('0x17')][_0x3cac('0x16')]);}})[_0x3cac('0x18')](function(_0x4173ca){logger[_0x3cac('0x15')](_0x3cac('0x10'),_0x14562c,_0x4173ca);_0x55670d(_0x4173ca);});});} \ No newline at end of file +var _0x531a=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x5870a6,_0x39867c){var _0x2a9efb=function(_0x2060f5){while(--_0x2060f5){_0x5870a6['push'](_0x5870a6['shift']());}};_0x2a9efb(++_0x39867c);}(_0x531a,0x100));var _0xa531=function(_0x1bf3b8,_0x8edcaa){_0x1bf3b8=_0x1bf3b8-0x0;var _0x52fd20=_0x531a[_0x1bf3b8];return _0x52fd20;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('Automation,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('Automation,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('Automation,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3315115..797030b 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 _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(_0x2b9c0c,_0x4678a3){var _0xd8577b=function(_0x2dd9eb){while(--_0x2dd9eb){_0x2b9c0c['push'](_0x2b9c0c['shift']());}};_0xd8577b(++_0x4678a3);}(_0x7bbd,0x11f));var _0xd7bb=function(_0x2f05c7,_0x15b439){_0x2f05c7=_0x2f05c7-0x0;var _0x1533e3=_0x7bbd[_0x2f05c7];return _0x1533e3;};'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 +var _0xde6c=['../../config/environment','./automation.controller','isAuthenticated','index','get','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xde6c,0x119));var _0xcde6=function(_0x21b57f,_0x9ba5fb){_0x21b57f=_0x21b57f-0x0;var _0x3dac6f=_0xde6c[_0x21b57f];return _0x3dac6f;};'use strict';var multer=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var path=require('path');var timeout=require(_0xcde6('0x2'));var express=require(_0xcde6('0x3'));var router=express[_0xcde6('0x4')]();var fs_extra=require(_0xcde6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcde6('0x6'));var config=require(_0xcde6('0x7'));var controller=require(_0xcde6('0x8'));router['get']('/',auth[_0xcde6('0x9')](),controller[_0xcde6('0xa')]);router['get']('/:id',auth[_0xcde6('0x9')](),controller['show']);router[_0xcde6('0xb')](_0xcde6('0xc'),auth[_0xcde6('0x9')](),controller[_0xcde6('0xd')]);router['get'](_0xcde6('0xe'),auth[_0xcde6('0x9')](),controller['getActions']);router[_0xcde6('0xf')]('/',auth[_0xcde6('0x9')](),controller[_0xcde6('0x10')]);router[_0xcde6('0xf')](_0xcde6('0xc'),auth[_0xcde6('0x9')](),controller[_0xcde6('0x11')]);router[_0xcde6('0xf')](_0xcde6('0xe'),auth[_0xcde6('0x9')](),controller['addActions']);router[_0xcde6('0x12')](_0xcde6('0x13'),auth[_0xcde6('0x9')](),controller[_0xcde6('0x14')]);router[_0xcde6('0x15')](_0xcde6('0x13'),auth[_0xcde6('0x9')](),controller[_0xcde6('0x16')]);module[_0xcde6('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6eb83ae..c3ba9ea 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 _0xae39=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x2a44d3,_0x434aef){var _0x455b5f=function(_0x1e1ef5){while(--_0x1e1ef5){_0x2a44d3['push'](_0x2a44d3['shift']());}};_0x455b5f(++_0x434aef);}(_0xae39,0x165));var _0x9ae3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xae39[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9ae3('0x0')],'unique':_0x9ae3('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9ae3('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x9ae3('0x3')},'description':{'type':Sequelize[_0x9ae3('0x0')]},'active':{'type':Sequelize[_0x9ae3('0x4')],'defaultValue':0x0,'comment':_0x9ae3('0x5')},'limitCalls':{'type':Sequelize[_0x9ae3('0x6')](0x4)[_0x9ae3('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9ae3('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9ae3('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x9ae3('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ae3('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9ae3('0x6')](0x3)[_0x9ae3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ae3('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ae3('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x9ae3('0x6')](0x3)[_0x9ae3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ae3('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9ae3('0x6')](0x5)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ae3('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9ae3('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9ae3('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9ae3('0x6')](0x5)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ae3('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9ae3('0x6')](0x3)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9ae3('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9ae3('0x0')],'defaultValue':_0x9ae3('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x9ae3('0x2')](_0x9ae3('0x12'),'never',_0x9ae3('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9ae3('0x4')],'defaultValue':0x0,'comment':_0x9ae3('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x9ae3('0x6')](0x9)[_0x9ae3('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9ae3('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x9ae3('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9ae3('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9ae3('0x6')](0x9)[_0x9ae3('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9ae3('0x6')](0x9)[_0x9ae3('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9ae3('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9ae3('0x6')](0x9)[_0x9ae3('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9ae3('0x6')](0x9)[_0x9ae3('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9ae3('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9ae3('0x6')](0x5)[_0x9ae3('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9ae3('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9ae3('0x6')](0x9)[_0x9ae3('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9ae3('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9ae3('0x2')](_0x9ae3('0x1b'),_0x9ae3('0x1c')),'defaultValue':_0x9ae3('0x1b')},'dialPrefix':{'type':Sequelize[_0x9ae3('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9ae3('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9ae3('0x1d')},'dialCutDigit':{'type':Sequelize[_0x9ae3('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9ae3('0x6')](0x3)[_0x9ae3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ae3('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9ae3('0x6')](0x5)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ae3('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x9ae3('0x6')](0x3)[_0x9ae3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ae3('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x9ae3('0x6')](0x5)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ae3('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9ae3('0x6')](0x3)[_0x9ae3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ae3('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9ae3('0x6')](0x5)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x9ae3('0x6')](0x3)[_0x9ae3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ae3('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9ae3('0x6')](0x5)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ae3('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ae3('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9ae3('0x6')](0x5)[_0x9ae3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x34d7=['name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','DESC','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING'];(function(_0x46848e,_0xe1b792){var _0x3fcfcb=function(_0x2777dd){while(--_0x2777dd){_0x46848e['push'](_0x46848e['shift']());}};_0x3fcfcb(++_0xe1b792);}(_0x34d7,0x13c));var _0x734d=function(_0x34651c,_0xc8554c){_0x34651c=_0x34651c-0x0;var _0x3c5ada=_0x34d7[_0x34651c];return _0x3c5ada;};'use strict';var Sequelize=require(_0x734d('0x0'));module[_0x734d('0x1')]={'name':{'type':Sequelize[_0x734d('0x2')],'unique':_0x734d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x734d('0x4')](_0x734d('0x5')),'allowNull':![],'defaultValue':_0x734d('0x5')},'description':{'type':Sequelize[_0x734d('0x2')]},'active':{'type':Sequelize[_0x734d('0x6')],'defaultValue':0x0,'comment':_0x734d('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x734d('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x734d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x734d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x734d('0x9')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x734d('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x734d('0x9')](0x3)[_0x734d('0xb')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x734d('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x734d('0x9')](0x3)[_0x734d('0xb')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x734d('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x734d('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x734d('0x9')](0x3)[_0x734d('0xb')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x734d('0xb')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x734d('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x734d('0xd')},'dialTimezone':{'type':Sequelize[_0x734d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x734d('0x2')],'defaultValue':_0x734d('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x734d('0x4')](_0x734d('0xf'),'never',_0x734d('0x10')),'defaultValue':_0x734d('0xf')},'dialAMDActive':{'type':Sequelize[_0x734d('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x734d('0x9')](0x9)[_0x734d('0xb')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x734d('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x734d('0xb')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x734d('0x9')](0x9)[_0x734d('0xb')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x734d('0x9')](0x9)[_0x734d('0xb')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x734d('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0x734d('0x9')](0x9)[_0x734d('0xb')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x734d('0x9')](0x9)[_0x734d('0xb')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x734d('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x734d('0x9')](0x9)[_0x734d('0xb')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x734d('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x734d('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x734d('0x9')](0x9)[_0x734d('0xb')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0x734d('0x15')},'dialPrefix':{'type':Sequelize[_0x734d('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x734d('0x9')](0x3)[_0x734d('0xb')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x734d('0xb')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x734d('0x9')](0x5)[_0x734d('0xb')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x734d('0x16')},'dialDropMaxRetry':{'type':Sequelize[_0x734d('0x9')](0x3)[_0x734d('0xb')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x734d('0x9')](0x5)[_0x734d('0xb')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x734d('0x17')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x734d('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x734d('0x18')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x734d('0x9')](0x5)[_0x734d('0xb')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x734d('0x19')},'dialMachineMaxRetry':{'type':Sequelize[_0x734d('0x9')](0x3)[_0x734d('0xb')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x734d('0x1a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x734d('0x9')](0x5)[_0x734d('0xb')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x734d('0xb')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x734d('0x1b')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x734d('0xb')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x734d('0x1c')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 590de3c..168d078 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 _0x6988=['../../config/logger','api','../../config/utils','../../config/license/util','status','end','undefined','limit','count','offset','set','json','reject','save','then','get','IvrCampaigns','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','order','sort','where','filters','merge','VIRTUAL','filter','options','include','Campaign','findAll','rows','catch','show','params','intersection','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','field','phone','toString','from','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','getBlackLists','CmList','addBlackLists','spread','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xd135db,_0x154ab1){var _0x2099d6=function(_0x260519){while(--_0x260519){_0xd135db['push'](_0xd135db['shift']());}};_0x2099d6(++_0x154ab1);}(_0x6988,0x81));var _0x8698=function(_0x4551c7,_0x546fa3){_0x4551c7=_0x4551c7-0x0;var _0x1823d0=_0x6988[_0x4551c7];return _0x1823d0;};'use strict';var emlformat=require(_0x8698('0x0'));var rimraf=require(_0x8698('0x1'));var zipdir=require(_0x8698('0x2'));var jsonpatch=require(_0x8698('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8698('0x4'));var Mustache=require(_0x8698('0x5'));var util=require(_0x8698('0x6'));var path=require(_0x8698('0x7'));var sox=require('sox');var csv=require(_0x8698('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8698('0x9'));var _=require(_0x8698('0xa'));var squel=require(_0x8698('0xb'));var crypto=require(_0x8698('0xc'));var jsforce=require(_0x8698('0xd'));var deskjs=require(_0x8698('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8698('0xf'));var Papa=require(_0x8698('0x10'));var Redis=require(_0x8698('0x11'));var authService=require(_0x8698('0x12'));var qs=require(_0x8698('0x13'));var as=require(_0x8698('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8698('0x15'))(_0x8698('0x16'));var utils=require(_0x8698('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8698('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba336,_0x28587c){_0x28587c=_0x28587c||0xcc;return function(_0x510f8b){if(_0x510f8b){return _0x5ba336['sendStatus'](_0x28587c);}return _0x5ba336[_0x8698('0x19')](_0x28587c)[_0x8698('0x1a')]();};}function respondWithResult(_0x246d98,_0x2b0c5f){_0x2b0c5f=_0x2b0c5f||0xc8;return function(_0x21037d){if(_0x21037d){return _0x246d98['status'](_0x2b0c5f)['json'](_0x21037d);}};}function respondWithFilteredResult(_0x4e811d,_0x35de00){return function(_0x219b1a){if(_0x219b1a){var _0x4c59ba=typeof _0x35de00['offset']===_0x8698('0x1b')&&typeof _0x35de00[_0x8698('0x1c')]===_0x8698('0x1b');var _0x59722b=_0x219b1a[_0x8698('0x1d')];var _0x35f7ec=_0x4c59ba?0x0:_0x35de00[_0x8698('0x1e')];var _0x4a1da8=_0x4c59ba?_0x219b1a['count']:_0x35de00[_0x8698('0x1e')]+_0x35de00['limit'];var _0x1af6f9;if(_0x4a1da8>=_0x59722b){_0x4a1da8=_0x59722b;_0x1af6f9=0xc8;}else{_0x1af6f9=0xce;}_0x4e811d[_0x8698('0x19')](_0x1af6f9);return _0x4e811d[_0x8698('0x1f')]('Content-Range',_0x35f7ec+'-'+_0x4a1da8+'/'+_0x59722b)[_0x8698('0x20')](_0x219b1a);}return null;};}function patchUpdates(_0x20b2c7){return function(_0x3fdc69){try{jsonpatch['apply'](_0x3fdc69,_0x20b2c7,!![]);}catch(_0x5b7a04){return BPromise[_0x8698('0x21')](_0x5b7a04);}return _0x3fdc69[_0x8698('0x22')]();};}function saveUpdates(_0x8b702e,_0x101ab5){return function(_0x57cdc0){if(_0x57cdc0){return _0x57cdc0['update'](_0x8b702e)[_0x8698('0x23')](function(_0x3eebbd){return _0x3eebbd;});}return null;};}function removeEntity(_0x312558,_0x14e9f9){return function(_0x70db99){if(_0x70db99){return _0x70db99['destroy']()[_0x8698('0x23')](function(){var _0x29a7e0=_0x70db99[_0x8698('0x24')]({'plain':!![]});var _0x5d8766=_0x8698('0x25');return db['UserProfileResource'][_0x8698('0x26')]({'where':{'type':_0x5d8766,'resourceId':_0x29a7e0['id']}})['then'](function(){return _0x70db99;});})['then'](function(){_0x312558[_0x8698('0x19')](0xcc)[_0x8698('0x1a')]();});}};}function handleEntityNotFound(_0x2622d1,_0xc44fe8){return function(_0x10481a){if(!_0x10481a){_0x2622d1['sendStatus'](0x194);}return _0x10481a;};}function handleError(_0x3eb614,_0x53f4ce){_0x53f4ce=_0x53f4ce||0x1f4;return function(_0x423118){logger[_0x8698('0x27')](_0x423118[_0x8698('0x28')]);if(_0x423118[_0x8698('0x29')]){delete _0x423118[_0x8698('0x29')];}_0x3eb614['status'](_0x53f4ce)['send'](_0x423118);};}exports[_0x8698('0x2a')]=function(_0x5b4ce4,_0x3d596f){var _0x4d3bf4={},_0x3d26ec={},_0x20aca4={'count':0x0,'rows':[]};var _0x190c91=_[_0x8698('0x2b')](db['Campaign'][_0x8698('0x2c')],function(_0x54a294){return{'name':_0x54a294[_0x8698('0x2d')],'type':_0x54a294[_0x8698('0x2e')][_0x8698('0x2f')]};});_0x3d26ec[_0x8698('0x30')]=_[_0x8698('0x2b')](_0x190c91,_0x8698('0x29'));_0x3d26ec[_0x8698('0x31')]=_[_0x8698('0x32')](_0x5b4ce4[_0x8698('0x31')]);_0x3d26ec['filters']=_['intersection'](_0x3d26ec[_0x8698('0x30')],_0x3d26ec[_0x8698('0x31')]);_0x4d3bf4[_0x8698('0x33')]=_['intersection'](_0x3d26ec['model'],qs['fields'](_0x5b4ce4[_0x8698('0x31')]['fields']));_0x4d3bf4[_0x8698('0x33')]=_0x4d3bf4[_0x8698('0x33')]['length']?_0x4d3bf4[_0x8698('0x33')]:_0x3d26ec['model'];if(!_0x5b4ce4[_0x8698('0x31')]['hasOwnProperty']('nolimit')){_0x4d3bf4[_0x8698('0x1c')]=qs[_0x8698('0x1c')](_0x5b4ce4[_0x8698('0x31')][_0x8698('0x1c')]);_0x4d3bf4[_0x8698('0x1e')]=qs['offset'](_0x5b4ce4[_0x8698('0x31')]['offset']);}_0x4d3bf4[_0x8698('0x34')]=qs[_0x8698('0x35')](_0x5b4ce4['query'][_0x8698('0x35')]);_0x4d3bf4[_0x8698('0x36')]=qs[_0x8698('0x37')](_['pick'](_0x5b4ce4[_0x8698('0x31')],_0x3d26ec[_0x8698('0x37')]),_0x190c91);if(_0x5b4ce4[_0x8698('0x31')]['filter']){_0x4d3bf4[_0x8698('0x36')]=_[_0x8698('0x38')](_0x4d3bf4['where'],{'$or':_[_0x8698('0x2b')](_0x190c91,function(_0x17a9f0){if(_0x17a9f0[_0x8698('0x2e')]!==_0x8698('0x39')){var _0x190564={};_0x190564[_0x17a9f0['name']]={'$like':'%'+_0x5b4ce4[_0x8698('0x31')][_0x8698('0x3a')]+'%'};return _0x190564;}})});}_0x4d3bf4=_[_0x8698('0x38')]({},_0x4d3bf4,_0x5b4ce4[_0x8698('0x3b')]);var _0x3ca84f={'where':_0x4d3bf4[_0x8698('0x36')]};return db['Campaign'][_0x8698('0x1d')](_0x3ca84f)[_0x8698('0x23')](function(_0x5a7039){_0x20aca4['count']=_0x5a7039;if(_0x5b4ce4[_0x8698('0x31')]['includeAll']){_0x4d3bf4[_0x8698('0x3c')]=[{'all':!![]}];}return db[_0x8698('0x3d')][_0x8698('0x3e')](_0x4d3bf4);})[_0x8698('0x23')](function(_0x1bad4d){_0x20aca4[_0x8698('0x3f')]=_0x1bad4d;return _0x20aca4;})[_0x8698('0x23')](respondWithFilteredResult(_0x3d596f,_0x4d3bf4))[_0x8698('0x40')](handleError(_0x3d596f,null));};exports[_0x8698('0x41')]=function(_0x496d8e,_0x519ee3){var _0xdaa241={'raw':![],'where':{'id':_0x496d8e[_0x8698('0x42')]['id']}},_0x2224ac={};_0x2224ac['model']=_[_0x8698('0x32')](db[_0x8698('0x3d')][_0x8698('0x2c')]);_0x2224ac[_0x8698('0x31')]=_[_0x8698('0x32')](_0x496d8e[_0x8698('0x31')]);_0x2224ac[_0x8698('0x37')]=_[_0x8698('0x43')](_0x2224ac['model'],_0x2224ac[_0x8698('0x31')]);_0xdaa241[_0x8698('0x33')]=_[_0x8698('0x43')](_0x2224ac[_0x8698('0x30')],qs[_0x8698('0x44')](_0x496d8e[_0x8698('0x31')][_0x8698('0x44')]));_0xdaa241[_0x8698('0x33')]=_0xdaa241[_0x8698('0x33')][_0x8698('0x45')]?_0xdaa241[_0x8698('0x33')]:_0x2224ac[_0x8698('0x30')];if(_0x496d8e[_0x8698('0x31')][_0x8698('0x46')]){_0xdaa241[_0x8698('0x3c')]=[{'all':!![]}];}_0xdaa241=_[_0x8698('0x38')]({},_0xdaa241,_0x496d8e['options']);return db['Campaign'][_0x8698('0x47')](_0xdaa241)[_0x8698('0x23')](handleEntityNotFound(_0x519ee3,null))[_0x8698('0x23')](respondWithResult(_0x519ee3,null))['catch'](handleError(_0x519ee3,null));};exports[_0x8698('0x48')]=function(_0x1cb5d4,_0x124a52){return db['Campaign'][_0x8698('0x48')](_0x1cb5d4[_0x8698('0x49')],{})[_0x8698('0x23')](function(_0x5a3306){var _0x2ee8e1=_0x1cb5d4[_0x8698('0x4a')][_0x8698('0x24')]({'plain':!![]});if(!_0x2ee8e1)throw new Error(_0x8698('0x4b'));if(_0x2ee8e1[_0x8698('0x4c')]===_0x8698('0x4a')){var _0x47cc85=_0x5a3306[_0x8698('0x24')]({'plain':!![]});var _0x185799=_0x8698('0x25');return db['UserProfileSection'][_0x8698('0x47')]({'where':{'name':_0x185799,'userProfileId':_0x2ee8e1[_0x8698('0x4d')]},'raw':!![]})['then'](function(_0x59061b){if(_0x59061b&&_0x59061b[_0x8698('0x4e')]===0x0){return db[_0x8698('0x4f')][_0x8698('0x48')]({'name':_0x47cc85[_0x8698('0x29')],'resourceId':_0x47cc85['id'],'type':_0x59061b[_0x8698('0x29')],'sectionId':_0x59061b['id']},{})[_0x8698('0x23')](function(){return _0x5a3306;});}else{return _0x5a3306;}})[_0x8698('0x40')](function(_0x39780f){logger['error'](_0x8698('0x50'),_0x39780f);throw _0x39780f;});}return _0x5a3306;})[_0x8698('0x23')](respondWithResult(_0x124a52,0xc9))['catch'](handleError(_0x124a52,null));};exports[_0x8698('0x51')]=function(_0x50b522,_0x15e351){var _0x1d89d4={'where':{'id':_0x50b522[_0x8698('0x42')]['id']}},_0x33b02a={};_0x33b02a[_0x8698('0x30')]=_[_0x8698('0x32')](db[_0x8698('0x3d')][_0x8698('0x2c')]);_0x1d89d4['attributes']=_['intersection'](_0x33b02a['model'],qs[_0x8698('0x44')](_0x50b522[_0x8698('0x31')][_0x8698('0x44')]));_0x1d89d4[_0x8698('0x33')]=_0x1d89d4[_0x8698('0x33')][_0x8698('0x45')]?_0x1d89d4[_0x8698('0x33')]:_0x33b02a[_0x8698('0x30')];if(_0x50b522['query']['includeAll']){_0x1d89d4['include']=[{'all':!![]}];}_0x1d89d4=_['merge']({},_0x1d89d4,_0x50b522[_0x8698('0x3b')]);return db[_0x8698('0x3d')][_0x8698('0x47')](_0x1d89d4)[_0x8698('0x23')](handleEntityNotFound(_0x15e351,null))[_0x8698('0x23')](function(_0x5bc286){if(_0x5bc286){var _0x5cabf2=_0x5bc286[_0x8698('0x24')]({'plain':!![]});_0x5cabf2=qs[_0x8698('0x52')](_0x5cabf2,['id',_0x8698('0x53'),_0x8698('0x54')]);_0x50b522[_0x8698('0x49')]=_[_0x8698('0x52')](_0x50b522[_0x8698('0x49')],['id','createdAt',_0x8698('0x54')]);return db[_0x8698('0x3d')][_0x8698('0x48')](_[_0x8698('0x38')](_0x5cabf2,_0x50b522['body']),{'include':_0x50b522['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3a288b){var _0x1f3b6e=_0x50b522['user'][_0x8698('0x24')]({'plain':!![]});if(!_0x1f3b6e)throw new Error(_0x8698('0x4b'));if(_0x1f3b6e[_0x8698('0x4c')]===_0x8698('0x4a')){var _0x2a5159=_0x3a288b[_0x8698('0x24')]({'plain':!![]});var _0x49a22f=_0x8698('0x25');return db[_0x8698('0x55')][_0x8698('0x47')]({'where':{'name':_0x49a22f,'userProfileId':_0x1f3b6e[_0x8698('0x4d')]},'raw':!![]})[_0x8698('0x23')](function(_0x48bbe5){if(_0x48bbe5&&_0x48bbe5['autoAssociation']===0x0){return db[_0x8698('0x4f')]['create']({'name':_0x2a5159[_0x8698('0x29')],'resourceId':_0x2a5159['id'],'type':_0x48bbe5['name'],'sectionId':_0x48bbe5['id']},{})['then'](function(){return _0x3a288b;});}else{return _0x3a288b;}})[_0x8698('0x40')](function(_0x56e009){logger['error'](_0x8698('0x50'),_0x56e009);throw _0x56e009;});}return _0x3a288b;});}})[_0x8698('0x23')](respondWithResult(_0x15e351,0xc9))[_0x8698('0x40')](handleError(_0x15e351,null));};exports[_0x8698('0x56')]=function(_0x2fbc86,_0x31795f){if(_0x2fbc86[_0x8698('0x49')]['id']){delete _0x2fbc86[_0x8698('0x49')]['id'];}return db['Campaign'][_0x8698('0x47')]({'where':{'id':_0x2fbc86[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x31795f,null))[_0x8698('0x23')](saveUpdates(_0x2fbc86[_0x8698('0x49')],null))['then'](respondWithResult(_0x31795f,null))[_0x8698('0x40')](handleError(_0x31795f,null));};exports[_0x8698('0x26')]=function(_0x5789e8,_0x5a05a8){return db['Campaign']['find']({'where':{'id':_0x5789e8[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x5a05a8,null))[_0x8698('0x23')](removeEntity(_0x5a05a8,null))[_0x8698('0x40')](handleError(_0x5a05a8,null));};exports[_0x8698('0x57')]=function(_0x4c2547,_0x303171,_0x401194){var _0x577bbd={'raw':!![],'where':{}};var _0x396896={};var _0xb4d1ba={'count':0x0,'rows':[]};return db[_0x8698('0x3d')][_0x8698('0x58')]({'where':{'id':_0x4c2547[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x303171,null))['then'](function(_0x2928ae){if(_0x2928ae){_0x396896[_0x8698('0x30')]=_['keys'](db[_0x8698('0x59')][_0x8698('0x2c')]);_0x396896[_0x8698('0x31')]=_[_0x8698('0x32')](_0x4c2547[_0x8698('0x31')]);_0x396896[_0x8698('0x37')]=_[_0x8698('0x43')](_0x396896[_0x8698('0x30')],_0x396896[_0x8698('0x31')]);_0x577bbd['attributes']=_[_0x8698('0x43')](_0x396896[_0x8698('0x30')],qs[_0x8698('0x44')](_0x4c2547[_0x8698('0x31')][_0x8698('0x44')]));_0x577bbd[_0x8698('0x33')]=_0x577bbd[_0x8698('0x33')][_0x8698('0x45')]?_0x577bbd[_0x8698('0x33')]:_0x396896[_0x8698('0x30')];if(!_0x4c2547['query'][_0x8698('0x5a')](_0x8698('0x5b'))){_0x577bbd[_0x8698('0x1c')]=qs[_0x8698('0x1c')](_0x4c2547[_0x8698('0x31')][_0x8698('0x1c')]);_0x577bbd[_0x8698('0x1e')]=qs['offset'](_0x4c2547[_0x8698('0x31')][_0x8698('0x1e')]);}_0x577bbd[_0x8698('0x34')]=qs['sort'](_0x4c2547[_0x8698('0x31')]['sort']);_0x577bbd[_0x8698('0x36')]=qs[_0x8698('0x37')](_[_0x8698('0x5c')](_0x4c2547['query'],_0x396896[_0x8698('0x37')]));_0x577bbd[_0x8698('0x36')][_0x8698('0x5d')]=_0x2928ae['id'];if(_0x4c2547[_0x8698('0x31')][_0x8698('0x3a')]){_0x577bbd[_0x8698('0x36')]=_['merge'](_0x577bbd['where'],{'$or':_[_0x8698('0x2b')](_0x577bbd[_0x8698('0x33')],function(_0x5f3258){var _0x22e4b5={};_0x22e4b5[_0x5f3258]={'$like':'%'+_0x4c2547[_0x8698('0x31')]['filter']+'%'};return _0x22e4b5;})});}_0x577bbd=_[_0x8698('0x38')]({},_0x577bbd,_0x4c2547['options']);return db[_0x8698('0x59')][_0x8698('0x1d')]({'where':_0x577bbd[_0x8698('0x36')]})['then'](function(_0x483b8f){_0xb4d1ba['count']=_0x483b8f;if(_0x4c2547['query']['includeAll']){_0x577bbd[_0x8698('0x3c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x577bbd);})['then'](function(_0x4731ba){_0xb4d1ba[_0x8698('0x3f')]=_0x4731ba;return _0xb4d1ba;});}})['then'](respondWithFilteredResult(_0x303171,_0x577bbd))[_0x8698('0x40')](handleError(_0x303171,null));};exports[_0x8698('0x5e')]=function(_0x248faa,_0x747e07,_0x658b11){var _0x1c5631={'raw':!![],'where':{}};var _0x5369f8={};var _0x453d01={'count':0x0,'rows':[]};return db['Campaign'][_0x8698('0x58')]({'where':{'id':_0x248faa['params']['id']}})['then'](handleEntityNotFound(_0x747e07,null))[_0x8698('0x23')](function(_0x3c292c){if(_0x3c292c){_0x5369f8[_0x8698('0x30')]=_[_0x8698('0x32')](db['CmHopperHistory']['rawAttributes']);_0x5369f8[_0x8698('0x31')]=_[_0x8698('0x32')](_0x248faa[_0x8698('0x31')]);_0x5369f8[_0x8698('0x37')]=_[_0x8698('0x43')](_0x5369f8[_0x8698('0x30')],_0x5369f8['query']);_0x1c5631[_0x8698('0x33')]=_['intersection'](_0x5369f8[_0x8698('0x30')],qs[_0x8698('0x44')](_0x248faa[_0x8698('0x31')]['fields']));_0x1c5631[_0x8698('0x33')]=_0x1c5631[_0x8698('0x33')]['length']?_0x1c5631[_0x8698('0x33')]:_0x5369f8[_0x8698('0x30')];if(!_0x248faa[_0x8698('0x31')]['hasOwnProperty'](_0x8698('0x5b'))){_0x1c5631[_0x8698('0x1c')]=qs[_0x8698('0x1c')](_0x248faa[_0x8698('0x31')][_0x8698('0x1c')]);_0x1c5631[_0x8698('0x1e')]=qs[_0x8698('0x1e')](_0x248faa[_0x8698('0x31')]['offset']);}_0x1c5631[_0x8698('0x34')]=qs[_0x8698('0x35')](_0x248faa[_0x8698('0x31')][_0x8698('0x35')]);_0x1c5631[_0x8698('0x36')]=qs['filters'](_[_0x8698('0x5c')](_0x248faa[_0x8698('0x31')],_0x5369f8[_0x8698('0x37')]));_0x1c5631[_0x8698('0x36')][_0x8698('0x5d')]=_0x3c292c['id'];if(_0x248faa[_0x8698('0x31')][_0x8698('0x3a')]){_0x1c5631['where']=_[_0x8698('0x38')](_0x1c5631[_0x8698('0x36')],{'$or':_[_0x8698('0x2b')](_0x1c5631['attributes'],function(_0x340eff){var _0xae9ed8={};_0xae9ed8[_0x340eff]={'$like':'%'+_0x248faa[_0x8698('0x31')][_0x8698('0x3a')]+'%'};return _0xae9ed8;})});}_0x1c5631=_[_0x8698('0x38')]({},_0x1c5631,_0x248faa['options']);return db[_0x8698('0x5f')][_0x8698('0x1d')]({'where':_0x1c5631['where']})[_0x8698('0x23')](function(_0x150733){_0x453d01['count']=_0x150733;if(_0x248faa['query']['includeAll']){_0x1c5631[_0x8698('0x3c')]=[{'all':!![]}];}return db[_0x8698('0x5f')][_0x8698('0x3e')](_0x1c5631);})[_0x8698('0x23')](function(_0x557bb3){_0x453d01[_0x8698('0x3f')]=_0x557bb3;return _0x453d01;});}})[_0x8698('0x23')](respondWithFilteredResult(_0x747e07,_0x1c5631))[_0x8698('0x40')](handleError(_0x747e07,null));};exports[_0x8698('0x60')]=function(_0xe227c5,_0x97a5f5,_0x3e8b3b){var _0x114dd6={'raw':!![],'where':{}};var _0x28de9b={};var _0x354aca={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xe227c5[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x97a5f5,null))[_0x8698('0x23')](function(_0x2f7afa){if(_0x2f7afa){_0x28de9b[_0x8698('0x30')]=_[_0x8698('0x32')](db[_0x8698('0x61')][_0x8698('0x2c')]);_0x28de9b[_0x8698('0x31')]=_['keys'](_0xe227c5[_0x8698('0x31')]);_0x28de9b['filters']=_[_0x8698('0x43')](_0x28de9b['model'],_0x28de9b[_0x8698('0x31')]);_0x114dd6[_0x8698('0x33')]=_[_0x8698('0x43')](_0x28de9b[_0x8698('0x30')],qs[_0x8698('0x44')](_0xe227c5[_0x8698('0x31')][_0x8698('0x44')]));_0x114dd6[_0x8698('0x33')]=_0x114dd6[_0x8698('0x33')][_0x8698('0x45')]?_0x114dd6[_0x8698('0x33')]:_0x28de9b['model'];if(!_0xe227c5['query']['hasOwnProperty'](_0x8698('0x5b'))){_0x114dd6[_0x8698('0x1c')]=qs[_0x8698('0x1c')](_0xe227c5[_0x8698('0x31')]['limit']);_0x114dd6[_0x8698('0x1e')]=qs[_0x8698('0x1e')](_0xe227c5[_0x8698('0x31')]['offset']);}_0x114dd6['order']=qs[_0x8698('0x35')](_0xe227c5[_0x8698('0x31')][_0x8698('0x35')]);_0x114dd6[_0x8698('0x36')]=qs[_0x8698('0x37')](_[_0x8698('0x5c')](_0xe227c5[_0x8698('0x31')],_0x28de9b['filters']));_0x114dd6[_0x8698('0x36')][_0x8698('0x5d')]=_0x2f7afa['id'];if(_0xe227c5[_0x8698('0x31')][_0x8698('0x3a')]){_0x114dd6[_0x8698('0x36')]=_[_0x8698('0x38')](_0x114dd6[_0x8698('0x36')],{'$or':_[_0x8698('0x2b')](_0x114dd6[_0x8698('0x33')],function(_0x3ba63d){var _0x5bdd48={};_0x5bdd48[_0x3ba63d]={'$like':'%'+_0xe227c5[_0x8698('0x31')]['filter']+'%'};return _0x5bdd48;})});}_0x114dd6=_[_0x8698('0x38')]({},_0x114dd6,_0xe227c5[_0x8698('0x3b')]);return db[_0x8698('0x61')]['count']({'where':_0x114dd6['where']})[_0x8698('0x23')](function(_0x1c48dc){_0x354aca[_0x8698('0x1d')]=_0x1c48dc;if(_0xe227c5[_0x8698('0x31')][_0x8698('0x46')]){_0x114dd6[_0x8698('0x3c')]=[{'all':!![]}];}return db[_0x8698('0x61')][_0x8698('0x3e')](_0x114dd6);})['then'](function(_0x3145ce){_0x354aca[_0x8698('0x3f')]=_0x3145ce;return _0x354aca;});}})[_0x8698('0x23')](respondWithFilteredResult(_0x97a5f5,_0x114dd6))['catch'](handleError(_0x97a5f5,null));};exports[_0x8698('0x62')]=function(_0x2b20e3,_0x3ff664,_0x29a4bc){var _0x3f97d5={'raw':!![],'where':{}};var _0x48d77a={};var _0x446c13={'count':0x0,'rows':[]};return db[_0x8698('0x3d')][_0x8698('0x58')]({'where':{'id':_0x2b20e3[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x3ff664,null))[_0x8698('0x23')](function(_0x3d6243){if(_0x3d6243){_0x48d77a[_0x8698('0x30')]=_['keys'](db[_0x8698('0x63')]['rawAttributes']);_0x48d77a[_0x8698('0x31')]=_['keys'](_0x2b20e3[_0x8698('0x31')]);_0x48d77a[_0x8698('0x37')]=_[_0x8698('0x43')](_0x48d77a[_0x8698('0x30')],_0x48d77a[_0x8698('0x31')]);_0x3f97d5[_0x8698('0x33')]=_[_0x8698('0x43')](_0x48d77a[_0x8698('0x30')],qs[_0x8698('0x44')](_0x2b20e3['query'][_0x8698('0x44')]));_0x3f97d5['attributes']=_0x3f97d5[_0x8698('0x33')][_0x8698('0x45')]?_0x3f97d5[_0x8698('0x33')]:_0x48d77a['model'];if(!_0x2b20e3[_0x8698('0x31')][_0x8698('0x5a')]('nolimit')){_0x3f97d5[_0x8698('0x1c')]=qs[_0x8698('0x1c')](_0x2b20e3['query'][_0x8698('0x1c')]);_0x3f97d5['offset']=qs[_0x8698('0x1e')](_0x2b20e3['query'][_0x8698('0x1e')]);}_0x3f97d5[_0x8698('0x34')]=qs[_0x8698('0x35')](_0x2b20e3[_0x8698('0x31')][_0x8698('0x35')]);_0x3f97d5[_0x8698('0x36')]=qs['filters'](_[_0x8698('0x5c')](_0x2b20e3[_0x8698('0x31')],_0x48d77a[_0x8698('0x37')]));_0x3f97d5['where']['CampaignId']=_0x3d6243['id'];if(_0x2b20e3[_0x8698('0x31')]['filter']){_0x3f97d5[_0x8698('0x36')]=_[_0x8698('0x38')](_0x3f97d5[_0x8698('0x36')],{'$or':_[_0x8698('0x2b')](_0x3f97d5[_0x8698('0x33')],function(_0x1957b5){var _0x395531={};_0x395531[_0x1957b5]={'$like':'%'+_0x2b20e3[_0x8698('0x31')][_0x8698('0x3a')]+'%'};return _0x395531;})});}_0x3f97d5=_[_0x8698('0x38')]({},_0x3f97d5,_0x2b20e3[_0x8698('0x3b')]);return db[_0x8698('0x63')][_0x8698('0x1d')]({'where':_0x3f97d5[_0x8698('0x36')]})[_0x8698('0x23')](function(_0x56826e){_0x446c13[_0x8698('0x1d')]=_0x56826e;if(_0x2b20e3[_0x8698('0x31')]['includeAll']){_0x3f97d5[_0x8698('0x3c')]=[{'all':!![]}];}return db[_0x8698('0x63')]['findAll'](_0x3f97d5);})[_0x8698('0x23')](function(_0x4be769){_0x446c13['rows']=_0x4be769;return _0x446c13;});}})[_0x8698('0x23')](respondWithFilteredResult(_0x3ff664,_0x3f97d5))[_0x8698('0x40')](handleError(_0x3ff664,null));};exports['getLists']=function(_0x532fe7,_0x28e602,_0x4464ba){var _0x5015e4={};var _0x119af0={};var _0x164e0a;var _0x36a42e;return db[_0x8698('0x3d')][_0x8698('0x58')]({'where':{'id':_0x532fe7[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x28e602,null))['then'](function(_0x643672){if(_0x643672){_0x164e0a=_0x643672;_0x119af0[_0x8698('0x30')]=_[_0x8698('0x32')](db['CmList']['rawAttributes']);_0x119af0[_0x8698('0x31')]=_[_0x8698('0x32')](_0x532fe7['query']);_0x119af0['filters']=_[_0x8698('0x43')](_0x119af0['model'],_0x119af0[_0x8698('0x31')]);_0x5015e4[_0x8698('0x33')]=_[_0x8698('0x43')](_0x119af0['model'],qs[_0x8698('0x44')](_0x532fe7[_0x8698('0x31')]['fields']));_0x5015e4['attributes']=_0x5015e4[_0x8698('0x33')][_0x8698('0x45')]?_0x5015e4[_0x8698('0x33')]:_0x119af0[_0x8698('0x30')];_0x5015e4[_0x8698('0x34')]=qs['sort'](_0x532fe7[_0x8698('0x31')][_0x8698('0x35')]);_0x5015e4[_0x8698('0x36')]=qs[_0x8698('0x37')](_['pick'](_0x532fe7['query'],_0x119af0[_0x8698('0x37')]));if(_0x532fe7['query'][_0x8698('0x3a')]){_0x5015e4[_0x8698('0x36')]=_[_0x8698('0x38')](_0x5015e4[_0x8698('0x36')],{'$or':_[_0x8698('0x2b')](_0x5015e4[_0x8698('0x33')],function(_0x42f0cf){var _0x45ffcc={};_0x45ffcc[_0x42f0cf]={'$like':'%'+_0x532fe7[_0x8698('0x31')][_0x8698('0x3a')]+'%'};return _0x45ffcc;})});}_0x5015e4=_[_0x8698('0x38')]({},_0x5015e4,_0x532fe7[_0x8698('0x3b')]);return _0x164e0a[_0x8698('0x64')](_0x5015e4);}})[_0x8698('0x23')](function(_0x2f6fee){if(_0x2f6fee){_0x36a42e=_0x2f6fee[_0x8698('0x45')];if(!_0x532fe7[_0x8698('0x31')][_0x8698('0x5a')](_0x8698('0x5b'))){_0x5015e4[_0x8698('0x1c')]=qs[_0x8698('0x1c')](_0x532fe7[_0x8698('0x31')][_0x8698('0x1c')]);_0x5015e4[_0x8698('0x1e')]=qs[_0x8698('0x1e')](_0x532fe7[_0x8698('0x31')][_0x8698('0x1e')]);}return _0x164e0a[_0x8698('0x64')](_0x5015e4);}})[_0x8698('0x23')](function(_0x4c8506){if(_0x4c8506){return _0x4c8506?{'count':_0x36a42e,'rows':_0x4c8506}:null;}})[_0x8698('0x23')](respondWithResult(_0x28e602,null))[_0x8698('0x40')](handleError(_0x28e602,null));};exports[_0x8698('0x65')]=function(_0x576c0a,_0x3469b5,_0x326061){var _0x2daaff,_0x3c5036;var _0xd39a50=[];var _0x96cad=moment()[_0x8698('0x66')](_0x8698('0x67'));return db[_0x8698('0x3d')][_0x8698('0x47')]({'where':{'id':_0x576c0a[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x3469b5,null))[_0x8698('0x23')](function(_0x31fa98){if(_0x31fa98){_0x3c5036=_0x31fa98;return _0x31fa98[_0x8698('0x65')](_0x576c0a[_0x8698('0x49')][_0x8698('0x68')],_[_0x8698('0x52')](_0x576c0a[_0x8698('0x49')],['ids','id'])||{});}return null;})['spread'](function(_0x18b042){var _0x5ef1c5;var _0x2d27bc;_0x2daaff=_0x18b042||[];var _0x4b4fd3=[];if(_0x18b042){for(var _0xfa4b6=0x0;_0xfa4b6<_0x18b042[_0x8698('0x45')];_0xfa4b6+=0x1){var _0x3b581f=_0x18b042[_0xfa4b6][_0x8698('0x24')]({'plain':!![]});_0x3c5036[_0x8698('0x69')]=_0x576c0a['body'][_0x8698('0x69')]?_0x576c0a[_0x8698('0x49')][_0x8698('0x69')]:_0x3c5036[_0x8698('0x69')];switch(_0x3c5036[_0x8698('0x69')]){case _0x8698('0x6a'):_0x5ef1c5=squel[_0x8698('0x6b')]()[_0x8698('0x6c')](_0x8698('0x6d'))[_0x8698('0x6e')](['phone',_0x8698('0x6f'),_0x8698('0x70'),_0x8698('0x71'),_0x8698('0x5d'),'createdAt',_0x8698('0x54')],squel['select']()[_0x8698('0x72')](_0x8698('0x73'),_0x8698('0x73'))['field']('NOW()',_0x8698('0x6f'))[_0x8698('0x72')]('id',_0x8698('0x70'))[_0x8698('0x72')](_0x3b581f['CmListId']['toString'](),_0x8698('0x71'))[_0x8698('0x72')](_0x576c0a[_0x8698('0x42')]['id'][_0x8698('0x74')](),'CampaignId')[_0x8698('0x72')]('\x27'+_0x96cad+'\x27','createdAt')['field']('\x27'+_0x96cad+'\x27',_0x8698('0x54'))[_0x8698('0x75')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x8698('0x76'),_0x3b581f[_0x8698('0x77')][_0x8698('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x8698('0x78'),squel[_0x8698('0x79')]()['field'](_0x8698('0x7a'))[_0x8698('0x75')]('cm_hopper_final')['where'](_0x8698('0x7b'),_0x576c0a['params']['id'][_0x8698('0x74')]()))[_0x8698('0x36')](_0x8698('0x78'),squel[_0x8698('0x79')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x8698('0x6d'))[_0x8698('0x36')]('CampaignId\x20=\x20?',_0x576c0a[_0x8698('0x42')]['id'][_0x8698('0x74')]())))['toString']();break;case _0x8698('0x7c'):_0x5ef1c5=squel['insert']()[_0x8698('0x6c')](_0x8698('0x6d'))[_0x8698('0x6e')](['phone',_0x8698('0x6f'),_0x8698('0x70'),_0x8698('0x71'),_0x8698('0x5d'),_0x8698('0x53'),_0x8698('0x54')],squel[_0x8698('0x79')]()['field']('phone',_0x8698('0x73'))['field'](_0x8698('0x7d'),'scheduledAt')['field']('id',_0x8698('0x70'))['field'](_0x3b581f[_0x8698('0x77')][_0x8698('0x74')](),_0x8698('0x71'))[_0x8698('0x72')](_0x576c0a[_0x8698('0x42')]['id'][_0x8698('0x74')](),'CampaignId')[_0x8698('0x72')]('\x27'+_0x96cad+'\x27','createdAt')['field']('\x27'+_0x96cad+'\x27',_0x8698('0x54'))[_0x8698('0x75')](_0x8698('0x7e'))[_0x8698('0x36')](_0x8698('0x7f'))['where'](_0x8698('0x76'),_0x3b581f[_0x8698('0x77')][_0x8698('0x74')]())[_0x8698('0x36')]('phone\x20IS\x20NOT\x20NULL')[_0x8698('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8698('0x79')]()['field']('COALESCE(phone,\x27\x27)')[_0x8698('0x75')](_0x8698('0x6d'))[_0x8698('0x36')](_0x8698('0x7b'),_0x576c0a['params']['id']['toString']())))[_0x8698('0x74')]();break;default:_0x5ef1c5=squel[_0x8698('0x6b')]()[_0x8698('0x6c')]('cm_hopper')[_0x8698('0x6e')]([_0x8698('0x73'),_0x8698('0x6f'),'ContactId',_0x8698('0x71'),_0x8698('0x5d'),_0x8698('0x53'),_0x8698('0x54')],squel[_0x8698('0x79')]()['field'](_0x8698('0x73'),_0x8698('0x73'))[_0x8698('0x72')](_0x8698('0x7d'),_0x8698('0x6f'))[_0x8698('0x72')]('id',_0x8698('0x70'))[_0x8698('0x72')](_0x3b581f[_0x8698('0x77')][_0x8698('0x74')](),_0x8698('0x71'))[_0x8698('0x72')](_0x576c0a['params']['id']['toString'](),_0x8698('0x5d'))[_0x8698('0x72')]('\x27'+_0x96cad+'\x27',_0x8698('0x53'))[_0x8698('0x72')]('\x27'+_0x96cad+'\x27','updatedAt')['from'](_0x8698('0x7e'))['where'](_0x8698('0x7f'))[_0x8698('0x36')](_0x8698('0x76'),_0x3b581f[_0x8698('0x77')][_0x8698('0x74')]())['where'](_0x8698('0x80')))[_0x8698('0x74')]();}_0x2d27bc=squel[_0x8698('0x6b')]()[_0x8698('0x6c')](_0x8698('0x81'))[_0x8698('0x6e')]([_0x8698('0x82'),_0x8698('0x6f'),_0x8698('0x73'),_0x8698('0x83'),_0x8698('0x53'),_0x8698('0x54')],squel[_0x8698('0x79')]()[_0x8698('0x72')](_0x8698('0x84'),'id')[_0x8698('0x72')]('NOW()',_0x8698('0x6f'))[_0x8698('0x72')](_0x8698('0x85'),_0x8698('0x73'))['field'](_0x8698('0x86'),_0x8698('0x83'))[_0x8698('0x72')]('\x27'+_0x96cad+'\x27',_0x8698('0x53'))[_0x8698('0x72')]('\x27'+_0x96cad+'\x27','updatedAt')[_0x8698('0x75')](_0x8698('0x87'),'ci')[_0x8698('0x88')]('cm_hopper','h',_0x8698('0x89'))[_0x8698('0x36')](_0x8698('0x8a'),_0x3b581f[_0x8698('0x77')][_0x8698('0x74')]())[_0x8698('0x36')](_0x8698('0x8b'),_0x576c0a[_0x8698('0x42')]['id']['toString']())[_0x8698('0x36')](_0x8698('0x8c'),_0x96cad))[_0x8698('0x74')]();_0x4b4fd3[_0x8698('0x8d')](db[_0x8698('0x8e')][_0x8698('0x31')](_0x5ef1c5));_0xd39a50[_0x8698('0x8d')](db[_0x8698('0x8e')][_0x8698('0x31')](_0x2d27bc));}return BPromise['all'](_0x4b4fd3);}})['then'](function(){return BPromise['all'](_0xd39a50);})[_0x8698('0x23')](function(){return _0x2daaff;})[_0x8698('0x23')](respondWithResult(_0x3469b5,null))[_0x8698('0x40')](handleError(_0x3469b5,null));};exports['removeLists']=function(_0x58326c,_0x8dd7aa,_0xc4f368){return db[_0x8698('0x3d')][_0x8698('0x47')]({'where':{'id':_0x58326c[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x8dd7aa,null))['then'](function(_0x40c929){if(_0x40c929){return _0x40c929['removeLists'](_0x58326c[_0x8698('0x31')][_0x8698('0x68')]);}})['then'](function(_0x1d1325){if(_0x1d1325){return db['CmHopper']['destroy']({'where':{'ListId':_0x58326c[_0x8698('0x31')][_0x8698('0x68')],'CampaignId':_0x58326c[_0x8698('0x42')]['id']}})[_0x8698('0x23')](function(){return _0x1d1325;});}})[_0x8698('0x23')](respondWithStatusCode(_0x8dd7aa,null))[_0x8698('0x40')](handleError(_0x8dd7aa,null));};exports[_0x8698('0x8f')]=function(_0xb0fe31,_0x1ab0fe,_0x201253){var _0x5a160d={};var _0xd201b6={};var _0x3a5cf0;var _0x1ea451;return db['Campaign'][_0x8698('0x58')]({'where':{'id':_0xb0fe31[_0x8698('0x42')]['id']}})[_0x8698('0x23')](handleEntityNotFound(_0x1ab0fe,null))[_0x8698('0x23')](function(_0x4a340e){if(_0x4a340e){_0x3a5cf0=_0x4a340e;_0xd201b6[_0x8698('0x30')]=_[_0x8698('0x32')](db[_0x8698('0x90')]['rawAttributes']);_0xd201b6[_0x8698('0x31')]=_[_0x8698('0x32')](_0xb0fe31['query']);_0xd201b6[_0x8698('0x37')]=_['intersection'](_0xd201b6['model'],_0xd201b6['query']);_0x5a160d[_0x8698('0x33')]=_['intersection'](_0xd201b6[_0x8698('0x30')],qs['fields'](_0xb0fe31[_0x8698('0x31')]['fields']));_0x5a160d[_0x8698('0x33')]=_0x5a160d[_0x8698('0x33')][_0x8698('0x45')]?_0x5a160d[_0x8698('0x33')]:_0xd201b6[_0x8698('0x30')];_0x5a160d['order']=qs[_0x8698('0x35')](_0xb0fe31[_0x8698('0x31')]['sort']);_0x5a160d[_0x8698('0x36')]=qs['filters'](_[_0x8698('0x5c')](_0xb0fe31[_0x8698('0x31')],_0xd201b6[_0x8698('0x37')]));if(_0xb0fe31[_0x8698('0x31')][_0x8698('0x3a')]){_0x5a160d[_0x8698('0x36')]=_[_0x8698('0x38')](_0x5a160d[_0x8698('0x36')],{'$or':_['map'](_0x5a160d[_0x8698('0x33')],function(_0x1111cd){var _0x9d9399={};_0x9d9399[_0x1111cd]={'$like':'%'+_0xb0fe31[_0x8698('0x31')]['filter']+'%'};return _0x9d9399;})});}_0x5a160d=_[_0x8698('0x38')]({},_0x5a160d,_0xb0fe31[_0x8698('0x3b')]);return _0x3a5cf0[_0x8698('0x8f')](_0x5a160d);}})['then'](function(_0x164105){if(_0x164105){_0x1ea451=_0x164105[_0x8698('0x45')];if(!_0xb0fe31[_0x8698('0x31')][_0x8698('0x5a')](_0x8698('0x5b'))){_0x5a160d[_0x8698('0x1c')]=qs[_0x8698('0x1c')](_0xb0fe31[_0x8698('0x31')]['limit']);_0x5a160d[_0x8698('0x1e')]=qs['offset'](_0xb0fe31[_0x8698('0x31')][_0x8698('0x1e')]);}return _0x3a5cf0[_0x8698('0x8f')](_0x5a160d);}})['then'](function(_0x38a0b2){if(_0x38a0b2){return _0x38a0b2?{'count':_0x1ea451,'rows':_0x38a0b2}:null;}})[_0x8698('0x23')](respondWithResult(_0x1ab0fe,null))[_0x8698('0x40')](handleError(_0x1ab0fe,null));};exports['addBlackLists']=function(_0x35625a,_0x3327f6,_0x581316){var _0x52f43e,_0x1987ed;var _0x2c03f7=[];var _0x1fb708=moment()[_0x8698('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x8698('0x3d')][_0x8698('0x47')]({'where':{'id':_0x35625a['params']['id']}})['then'](handleEntityNotFound(_0x3327f6,null))['then'](function(_0x5c8154){if(_0x5c8154){_0x1987ed=_0x5c8154;return _0x5c8154[_0x8698('0x91')](_0x35625a[_0x8698('0x49')][_0x8698('0x68')],_[_0x8698('0x52')](_0x35625a['body'],[_0x8698('0x68'),'id'])||{});}return null;})[_0x8698('0x92')](function(_0x3e861f){var _0xab3c8a;var _0x41530c;_0x52f43e=_0x3e861f||[];var _0x239007=[];if(_0x3e861f){for(var _0x436961=0x0;_0x436961<_0x3e861f[_0x8698('0x45')];_0x436961+=0x1){var _0x3a8480=_0x3e861f[_0x436961]['get']({'plain':!![]});_0xab3c8a=squel[_0x8698('0x6b')]()[_0x8698('0x6c')](_0x8698('0x93'))[_0x8698('0x6e')]([_0x8698('0x73'),_0x8698('0x70'),'ListId',_0x8698('0x5d'),_0x8698('0x53'),_0x8698('0x54')],squel['select']()['field'](_0x8698('0x73'),_0x8698('0x73'))[_0x8698('0x72')]('id',_0x8698('0x70'))[_0x8698('0x72')](_0x3a8480[_0x8698('0x77')][_0x8698('0x74')](),_0x8698('0x71'))['field'](_0x35625a['params']['id'][_0x8698('0x74')](),'CampaignId')[_0x8698('0x72')]('NOW()','createdAt')[_0x8698('0x72')](_0x8698('0x7d'),_0x8698('0x54'))[_0x8698('0x75')](_0x8698('0x7e'))['where'](_0x8698('0x7f'))[_0x8698('0x36')](_0x8698('0x76'),_0x3a8480[_0x8698('0x77')][_0x8698('0x74')]())[_0x8698('0x36')](_0x8698('0x80')))['toString']();_0x239007[_0x8698('0x8d')](db[_0x8698('0x8e')][_0x8698('0x31')](_0xab3c8a));}return BPromise[_0x8698('0x94')](_0x239007);}})['then'](function(){return _0x52f43e;})[_0x8698('0x23')](respondWithResult(_0x3327f6,null))[_0x8698('0x40')](handleError(_0x3327f6,null));};exports[_0x8698('0x95')]=function(_0x1cef0e,_0x2c8815,_0x15001f){return db[_0x8698('0x3d')][_0x8698('0x47')]({'where':{'id':_0x1cef0e[_0x8698('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c8815,null))[_0x8698('0x23')](function(_0x40f8c5){if(_0x40f8c5){return _0x40f8c5[_0x8698('0x95')](_0x1cef0e[_0x8698('0x31')]['ids']);}})[_0x8698('0x23')](function(_0x3039a3){if(_0x3039a3){return db['CmHopperBlack'][_0x8698('0x26')]({'where':{'ListId':_0x1cef0e[_0x8698('0x31')][_0x8698('0x68')],'CampaignId':_0x1cef0e[_0x8698('0x42')]['id']}})[_0x8698('0x23')](function(){return _0x3039a3;});}})[_0x8698('0x23')](respondWithStatusCode(_0x2c8815,null))[_0x8698('0x40')](handleError(_0x2c8815,null));}; \ No newline at end of file +var _0x1042=['CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId'];(function(_0x2ad4c9,_0x2c6e67){var _0x2e4982=function(_0x418956){while(--_0x418956){_0x2ad4c9['push'](_0x2ad4c9['shift']());}};_0x2e4982(++_0x2c6e67);}(_0x1042,0x1de));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2104('0x0'));var rimraf=require(_0x2104('0x1'));var zipdir=require(_0x2104('0x2'));var jsonpatch=require(_0x2104('0x3'));var rp=require(_0x2104('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2104('0x5'));var util=require(_0x2104('0x6'));var path=require(_0x2104('0x7'));var sox=require(_0x2104('0x8'));var csv=require(_0x2104('0x9'));var ejs=require(_0x2104('0xa'));var fs=require('fs');var fs_extra=require(_0x2104('0xb'));var _=require(_0x2104('0xc'));var squel=require('squel');var crypto=require(_0x2104('0xd'));var jsforce=require(_0x2104('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2104('0x9'));var querystring=require(_0x2104('0xf'));var Papa=require(_0x2104('0x10'));var Redis=require(_0x2104('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2104('0x12'));var as=require(_0x2104('0x13'));var hardwareService=require(_0x2104('0x14'));var logger=require(_0x2104('0x15'))(_0x2104('0x16'));var utils=require('../../config/utils');var config=require(_0x2104('0x17'));var licenseUtil=require(_0x2104('0x18'));var db=require(_0x2104('0x19'))['db'];function respondWithStatusCode(_0x4c58a4,_0x43748d){_0x43748d=_0x43748d||0xcc;return function(_0x5c1299){if(_0x5c1299){return _0x4c58a4[_0x2104('0x1a')](_0x43748d);}return _0x4c58a4['status'](_0x43748d)[_0x2104('0x1b')]();};}function respondWithResult(_0xf1241d,_0xfd91e9){_0xfd91e9=_0xfd91e9||0xc8;return function(_0x4c16d4){if(_0x4c16d4){return _0xf1241d[_0x2104('0x1c')](_0xfd91e9)[_0x2104('0x1d')](_0x4c16d4);}};}function respondWithFilteredResult(_0x42bb8e,_0x528045){return function(_0x2a1779){if(_0x2a1779){var _0x143a4d=typeof _0x528045[_0x2104('0x1e')]==='undefined'&&typeof _0x528045[_0x2104('0x1f')]===_0x2104('0x20');var _0x2c3011=_0x2a1779[_0x2104('0x21')];var _0x39258d=_0x143a4d?0x0:_0x528045['offset'];var _0x10e9c7=_0x143a4d?_0x2a1779[_0x2104('0x21')]:_0x528045[_0x2104('0x1e')]+_0x528045['limit'];var _0x1fb257;if(_0x10e9c7>=_0x2c3011){_0x10e9c7=_0x2c3011;_0x1fb257=0xc8;}else{_0x1fb257=0xce;}_0x42bb8e['status'](_0x1fb257);return _0x42bb8e[_0x2104('0x22')]('Content-Range',_0x39258d+'-'+_0x10e9c7+'/'+_0x2c3011)[_0x2104('0x1d')](_0x2a1779);}return null;};}function patchUpdates(_0x2cedf5){return function(_0x396435){try{jsonpatch['apply'](_0x396435,_0x2cedf5,!![]);}catch(_0x1a2056){return BPromise[_0x2104('0x23')](_0x1a2056);}return _0x396435['save']();};}function saveUpdates(_0x41ef2e,_0x1f6330){return function(_0x571e0e){if(_0x571e0e){return _0x571e0e[_0x2104('0x24')](_0x41ef2e)[_0x2104('0x25')](function(_0x3ff645){return _0x3ff645;});}return null;};}function removeEntity(_0x121916,_0x56c3d9){return function(_0x44a457){if(_0x44a457){return _0x44a457[_0x2104('0x26')]()[_0x2104('0x25')](function(){var _0xfa2694=_0x44a457[_0x2104('0x27')]({'plain':!![]});var _0x56fc04='IvrCampaigns';return db[_0x2104('0x28')]['destroy']({'where':{'type':_0x56fc04,'resourceId':_0xfa2694['id']}})[_0x2104('0x25')](function(){return _0x44a457;});})[_0x2104('0x25')](function(){_0x121916[_0x2104('0x1c')](0xcc)[_0x2104('0x1b')]();});}};}function handleEntityNotFound(_0x18eb37,_0x185f44){return function(_0xf2e9fd){if(!_0xf2e9fd){_0x18eb37[_0x2104('0x1a')](0x194);}return _0xf2e9fd;};}function handleError(_0x2a47fa,_0x6a1897){_0x6a1897=_0x6a1897||0x1f4;return function(_0x525723){logger[_0x2104('0x29')](_0x525723[_0x2104('0x2a')]);if(_0x525723['name']){delete _0x525723[_0x2104('0x2b')];}_0x2a47fa[_0x2104('0x1c')](_0x6a1897)[_0x2104('0x2c')](_0x525723);};}exports['index']=function(_0x2f11e0,_0x412318){var _0x4cc61e={},_0x281e16={},_0xa4018e={'count':0x0,'rows':[]};var _0x52521c=_[_0x2104('0x2d')](db['Campaign'][_0x2104('0x2e')],function(_0x3abec0){return{'name':_0x3abec0[_0x2104('0x2f')],'type':_0x3abec0[_0x2104('0x30')][_0x2104('0x31')]};});_0x281e16['model']=_[_0x2104('0x2d')](_0x52521c,'name');_0x281e16[_0x2104('0x32')]=_[_0x2104('0x33')](_0x2f11e0[_0x2104('0x32')]);_0x281e16[_0x2104('0x34')]=_[_0x2104('0x35')](_0x281e16[_0x2104('0x36')],_0x281e16[_0x2104('0x32')]);_0x4cc61e[_0x2104('0x37')]=_[_0x2104('0x35')](_0x281e16['model'],qs[_0x2104('0x38')](_0x2f11e0['query'][_0x2104('0x38')]));_0x4cc61e[_0x2104('0x37')]=_0x4cc61e[_0x2104('0x37')]['length']?_0x4cc61e[_0x2104('0x37')]:_0x281e16['model'];if(!_0x2f11e0['query'][_0x2104('0x39')]('nolimit')){_0x4cc61e[_0x2104('0x1f')]=qs['limit'](_0x2f11e0['query'][_0x2104('0x1f')]);_0x4cc61e['offset']=qs[_0x2104('0x1e')](_0x2f11e0[_0x2104('0x32')][_0x2104('0x1e')]);}_0x4cc61e[_0x2104('0x3a')]=qs['sort'](_0x2f11e0['query'][_0x2104('0x3b')]);_0x4cc61e[_0x2104('0x3c')]=qs['filters'](_[_0x2104('0x3d')](_0x2f11e0['query'],_0x281e16[_0x2104('0x34')]),_0x52521c);if(_0x2f11e0[_0x2104('0x32')][_0x2104('0x3e')]){_0x4cc61e[_0x2104('0x3c')]=_[_0x2104('0x3f')](_0x4cc61e[_0x2104('0x3c')],{'$or':_[_0x2104('0x2d')](_0x52521c,function(_0x38bb51){if(_0x38bb51[_0x2104('0x30')]!==_0x2104('0x40')){var _0x303407={};_0x303407[_0x38bb51[_0x2104('0x2b')]]={'$like':'%'+_0x2f11e0['query'][_0x2104('0x3e')]+'%'};return _0x303407;}})});}_0x4cc61e=_['merge']({},_0x4cc61e,_0x2f11e0[_0x2104('0x41')]);var _0x32e3ac={'where':_0x4cc61e[_0x2104('0x3c')]};return db[_0x2104('0x42')][_0x2104('0x21')](_0x32e3ac)[_0x2104('0x25')](function(_0x38da30){_0xa4018e[_0x2104('0x21')]=_0x38da30;if(_0x2f11e0['query'][_0x2104('0x43')]){_0x4cc61e[_0x2104('0x44')]=[{'all':!![]}];}return db[_0x2104('0x42')][_0x2104('0x45')](_0x4cc61e);})[_0x2104('0x25')](function(_0x89327e){_0xa4018e[_0x2104('0x46')]=_0x89327e;return _0xa4018e;})['then'](respondWithFilteredResult(_0x412318,_0x4cc61e))[_0x2104('0x47')](handleError(_0x412318,null));};exports[_0x2104('0x48')]=function(_0x23fcdd,_0x29a943){var _0x1403ec={'raw':![],'where':{'id':_0x23fcdd[_0x2104('0x49')]['id']}},_0x5dd06d={};_0x5dd06d[_0x2104('0x36')]=_[_0x2104('0x33')](db[_0x2104('0x42')][_0x2104('0x2e')]);_0x5dd06d['query']=_[_0x2104('0x33')](_0x23fcdd[_0x2104('0x32')]);_0x5dd06d[_0x2104('0x34')]=_[_0x2104('0x35')](_0x5dd06d['model'],_0x5dd06d['query']);_0x1403ec[_0x2104('0x37')]=_[_0x2104('0x35')](_0x5dd06d[_0x2104('0x36')],qs[_0x2104('0x38')](_0x23fcdd[_0x2104('0x32')]['fields']));_0x1403ec[_0x2104('0x37')]=_0x1403ec['attributes'][_0x2104('0x4a')]?_0x1403ec[_0x2104('0x37')]:_0x5dd06d[_0x2104('0x36')];if(_0x23fcdd['query']['includeAll']){_0x1403ec[_0x2104('0x44')]=[{'all':!![]}];}_0x1403ec=_[_0x2104('0x3f')]({},_0x1403ec,_0x23fcdd[_0x2104('0x41')]);return db['Campaign']['find'](_0x1403ec)['then'](handleEntityNotFound(_0x29a943,null))['then'](respondWithResult(_0x29a943,null))[_0x2104('0x47')](handleError(_0x29a943,null));};exports[_0x2104('0x4b')]=function(_0x4178ea,_0x508fa8){return db[_0x2104('0x42')]['create'](_0x4178ea[_0x2104('0x4c')],{})['then'](function(_0x566a98){var _0x4f31c9=_0x4178ea['user'][_0x2104('0x27')]({'plain':!![]});if(!_0x4f31c9)throw new Error(_0x2104('0x4d'));if(_0x4f31c9[_0x2104('0x4e')]===_0x2104('0x4f')){var _0x55f49e=_0x566a98[_0x2104('0x27')]({'plain':!![]});var _0x2d51a2=_0x2104('0x50');return db[_0x2104('0x51')]['find']({'where':{'name':_0x2d51a2,'userProfileId':_0x4f31c9[_0x2104('0x52')]},'raw':!![]})[_0x2104('0x25')](function(_0x4fc5d8){if(_0x4fc5d8&&_0x4fc5d8[_0x2104('0x53')]===0x0){return db['UserProfileResource'][_0x2104('0x4b')]({'name':_0x55f49e[_0x2104('0x2b')],'resourceId':_0x55f49e['id'],'type':_0x4fc5d8[_0x2104('0x2b')],'sectionId':_0x4fc5d8['id']},{})['then'](function(){return _0x566a98;});}else{return _0x566a98;}})[_0x2104('0x47')](function(_0x2ca9b5){logger['error'](_0x2104('0x54'),_0x2ca9b5);throw _0x2ca9b5;});}return _0x566a98;})[_0x2104('0x25')](respondWithResult(_0x508fa8,0xc9))[_0x2104('0x47')](handleError(_0x508fa8,null));};exports[_0x2104('0x55')]=function(_0x1feb0f,_0x5362d4){var _0x15b114={'where':{'id':_0x1feb0f['params']['id']}},_0x1b9130={};_0x1b9130[_0x2104('0x36')]=_['keys'](db[_0x2104('0x42')][_0x2104('0x2e')]);_0x15b114[_0x2104('0x37')]=_[_0x2104('0x35')](_0x1b9130[_0x2104('0x36')],qs[_0x2104('0x38')](_0x1feb0f[_0x2104('0x32')][_0x2104('0x38')]));_0x15b114[_0x2104('0x37')]=_0x15b114['attributes']['length']?_0x15b114[_0x2104('0x37')]:_0x1b9130[_0x2104('0x36')];if(_0x1feb0f[_0x2104('0x32')][_0x2104('0x43')]){_0x15b114[_0x2104('0x44')]=[{'all':!![]}];}_0x15b114=_[_0x2104('0x3f')]({},_0x15b114,_0x1feb0f[_0x2104('0x41')]);return db[_0x2104('0x42')][_0x2104('0x56')](_0x15b114)[_0x2104('0x25')](handleEntityNotFound(_0x5362d4,null))[_0x2104('0x25')](function(_0x304b60){if(_0x304b60){var _0x4913ed=_0x304b60[_0x2104('0x27')]({'plain':!![]});_0x4913ed=qs[_0x2104('0x57')](_0x4913ed,['id',_0x2104('0x58'),_0x2104('0x59')]);_0x1feb0f[_0x2104('0x4c')]=_[_0x2104('0x57')](_0x1feb0f[_0x2104('0x4c')],['id',_0x2104('0x58'),_0x2104('0x59')]);return db[_0x2104('0x42')][_0x2104('0x4b')](_[_0x2104('0x3f')](_0x4913ed,_0x1feb0f[_0x2104('0x4c')]),{'include':_0x1feb0f[_0x2104('0x32')][_0x2104('0x43')]?[{'all':!![]}]:undefined})[_0x2104('0x25')](function(_0x27262e){var _0x6e16b0=_0x1feb0f[_0x2104('0x4f')]['get']({'plain':!![]});if(!_0x6e16b0)throw new Error(_0x2104('0x4d'));if(_0x6e16b0[_0x2104('0x4e')]===_0x2104('0x4f')){var _0x490535=_0x27262e['get']({'plain':!![]});var _0x390fca=_0x2104('0x50');return db[_0x2104('0x51')][_0x2104('0x56')]({'where':{'name':_0x390fca,'userProfileId':_0x6e16b0[_0x2104('0x52')]},'raw':!![]})[_0x2104('0x25')](function(_0x38bfd2){if(_0x38bfd2&&_0x38bfd2[_0x2104('0x53')]===0x0){return db[_0x2104('0x28')][_0x2104('0x4b')]({'name':_0x490535[_0x2104('0x2b')],'resourceId':_0x490535['id'],'type':_0x38bfd2[_0x2104('0x2b')],'sectionId':_0x38bfd2['id']},{})['then'](function(){return _0x27262e;});}else{return _0x27262e;}})[_0x2104('0x47')](function(_0x19ba88){logger[_0x2104('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19ba88);throw _0x19ba88;});}return _0x27262e;});}})[_0x2104('0x25')](respondWithResult(_0x5362d4,0xc9))[_0x2104('0x47')](handleError(_0x5362d4,null));};exports[_0x2104('0x24')]=function(_0xf8f3d1,_0x3de1d6){if(_0xf8f3d1['body']['id']){delete _0xf8f3d1['body']['id'];}return db[_0x2104('0x42')][_0x2104('0x56')]({'where':{'id':_0xf8f3d1['params']['id']}})[_0x2104('0x25')](handleEntityNotFound(_0x3de1d6,null))[_0x2104('0x25')](saveUpdates(_0xf8f3d1['body'],null))['then'](respondWithResult(_0x3de1d6,null))['catch'](handleError(_0x3de1d6,null));};exports[_0x2104('0x26')]=function(_0x17d3d9,_0x4b16d2){return db[_0x2104('0x42')][_0x2104('0x56')]({'where':{'id':_0x17d3d9[_0x2104('0x49')]['id']}})[_0x2104('0x25')](handleEntityNotFound(_0x4b16d2,null))['then'](removeEntity(_0x4b16d2,null))[_0x2104('0x47')](handleError(_0x4b16d2,null));};exports[_0x2104('0x5a')]=function(_0xae45d4,_0x177310,_0x367d42){var _0x52c0f4={'raw':!![],'where':{}};var _0xc5eaa9={};var _0x3f0c47={'count':0x0,'rows':[]};return db[_0x2104('0x42')][_0x2104('0x5b')]({'where':{'id':_0xae45d4[_0x2104('0x49')]['id']}})['then'](handleEntityNotFound(_0x177310,null))[_0x2104('0x25')](function(_0x14949d){if(_0x14949d){_0xc5eaa9['model']=_[_0x2104('0x33')](db[_0x2104('0x5c')][_0x2104('0x2e')]);_0xc5eaa9[_0x2104('0x32')]=_[_0x2104('0x33')](_0xae45d4[_0x2104('0x32')]);_0xc5eaa9[_0x2104('0x34')]=_[_0x2104('0x35')](_0xc5eaa9[_0x2104('0x36')],_0xc5eaa9['query']);_0x52c0f4['attributes']=_['intersection'](_0xc5eaa9['model'],qs['fields'](_0xae45d4[_0x2104('0x32')][_0x2104('0x38')]));_0x52c0f4['attributes']=_0x52c0f4[_0x2104('0x37')][_0x2104('0x4a')]?_0x52c0f4[_0x2104('0x37')]:_0xc5eaa9['model'];if(!_0xae45d4[_0x2104('0x32')][_0x2104('0x39')]('nolimit')){_0x52c0f4[_0x2104('0x1f')]=qs[_0x2104('0x1f')](_0xae45d4[_0x2104('0x32')]['limit']);_0x52c0f4[_0x2104('0x1e')]=qs[_0x2104('0x1e')](_0xae45d4[_0x2104('0x32')][_0x2104('0x1e')]);}_0x52c0f4['order']=qs[_0x2104('0x3b')](_0xae45d4[_0x2104('0x32')][_0x2104('0x3b')]);_0x52c0f4['where']=qs['filters'](_[_0x2104('0x3d')](_0xae45d4[_0x2104('0x32')],_0xc5eaa9[_0x2104('0x34')]));_0x52c0f4[_0x2104('0x3c')]['CampaignId']=_0x14949d['id'];if(_0xae45d4[_0x2104('0x32')]['filter']){_0x52c0f4[_0x2104('0x3c')]=_[_0x2104('0x3f')](_0x52c0f4['where'],{'$or':_['map'](_0x52c0f4[_0x2104('0x37')],function(_0x344c98){var _0x3f5dff={};_0x3f5dff[_0x344c98]={'$like':'%'+_0xae45d4[_0x2104('0x32')][_0x2104('0x3e')]+'%'};return _0x3f5dff;})});}_0x52c0f4=_[_0x2104('0x3f')]({},_0x52c0f4,_0xae45d4[_0x2104('0x41')]);return db['CmHopper']['count']({'where':_0x52c0f4[_0x2104('0x3c')]})[_0x2104('0x25')](function(_0x174c5c){_0x3f0c47[_0x2104('0x21')]=_0x174c5c;if(_0xae45d4['query']['includeAll']){_0x52c0f4['include']=[{'all':!![]}];}return db[_0x2104('0x5c')]['findAll'](_0x52c0f4);})[_0x2104('0x25')](function(_0x3cb686){_0x3f0c47[_0x2104('0x46')]=_0x3cb686;return _0x3f0c47;});}})[_0x2104('0x25')](respondWithFilteredResult(_0x177310,_0x52c0f4))[_0x2104('0x47')](handleError(_0x177310,null));};exports[_0x2104('0x5d')]=function(_0x3e383c,_0xe6455f,_0x2bd3c1){var _0x21f377={'raw':!![],'where':{}};var _0x41bfbc={};var _0x430528={'count':0x0,'rows':[]};return db['Campaign'][_0x2104('0x5b')]({'where':{'id':_0x3e383c[_0x2104('0x49')]['id']}})[_0x2104('0x25')](handleEntityNotFound(_0xe6455f,null))[_0x2104('0x25')](function(_0x9bd715){if(_0x9bd715){_0x41bfbc[_0x2104('0x36')]=_[_0x2104('0x33')](db['CmHopperHistory'][_0x2104('0x2e')]);_0x41bfbc[_0x2104('0x32')]=_['keys'](_0x3e383c['query']);_0x41bfbc['filters']=_[_0x2104('0x35')](_0x41bfbc[_0x2104('0x36')],_0x41bfbc['query']);_0x21f377['attributes']=_[_0x2104('0x35')](_0x41bfbc[_0x2104('0x36')],qs[_0x2104('0x38')](_0x3e383c[_0x2104('0x32')][_0x2104('0x38')]));_0x21f377['attributes']=_0x21f377['attributes'][_0x2104('0x4a')]?_0x21f377['attributes']:_0x41bfbc[_0x2104('0x36')];if(!_0x3e383c['query'][_0x2104('0x39')](_0x2104('0x5e'))){_0x21f377['limit']=qs['limit'](_0x3e383c[_0x2104('0x32')][_0x2104('0x1f')]);_0x21f377[_0x2104('0x1e')]=qs[_0x2104('0x1e')](_0x3e383c['query']['offset']);}_0x21f377[_0x2104('0x3a')]=qs[_0x2104('0x3b')](_0x3e383c['query'][_0x2104('0x3b')]);_0x21f377[_0x2104('0x3c')]=qs[_0x2104('0x34')](_[_0x2104('0x3d')](_0x3e383c['query'],_0x41bfbc[_0x2104('0x34')]));_0x21f377[_0x2104('0x3c')]['CampaignId']=_0x9bd715['id'];if(_0x3e383c['query'][_0x2104('0x3e')]){_0x21f377[_0x2104('0x3c')]=_[_0x2104('0x3f')](_0x21f377['where'],{'$or':_['map'](_0x21f377[_0x2104('0x37')],function(_0x2e15fd){var _0x5812e8={};_0x5812e8[_0x2e15fd]={'$like':'%'+_0x3e383c[_0x2104('0x32')][_0x2104('0x3e')]+'%'};return _0x5812e8;})});}_0x21f377=_[_0x2104('0x3f')]({},_0x21f377,_0x3e383c[_0x2104('0x41')]);return db[_0x2104('0x5f')]['count']({'where':_0x21f377[_0x2104('0x3c')]})[_0x2104('0x25')](function(_0x96b962){_0x430528[_0x2104('0x21')]=_0x96b962;if(_0x3e383c['query'][_0x2104('0x43')]){_0x21f377[_0x2104('0x44')]=[{'all':!![]}];}return db[_0x2104('0x5f')][_0x2104('0x45')](_0x21f377);})[_0x2104('0x25')](function(_0x1e27cd){_0x430528[_0x2104('0x46')]=_0x1e27cd;return _0x430528;});}})[_0x2104('0x25')](respondWithFilteredResult(_0xe6455f,_0x21f377))[_0x2104('0x47')](handleError(_0xe6455f,null));};exports[_0x2104('0x60')]=function(_0x9db88a,_0x1dd13b,_0x524093){var _0x25c77f={'raw':!![],'where':{}};var _0x8dc325={};var _0xdab1c5={'count':0x0,'rows':[]};return db[_0x2104('0x42')][_0x2104('0x5b')]({'where':{'id':_0x9db88a[_0x2104('0x49')]['id']}})[_0x2104('0x25')](handleEntityNotFound(_0x1dd13b,null))[_0x2104('0x25')](function(_0x20ac2d){if(_0x20ac2d){_0x8dc325[_0x2104('0x36')]=_[_0x2104('0x33')](db[_0x2104('0x61')]['rawAttributes']);_0x8dc325['query']=_[_0x2104('0x33')](_0x9db88a[_0x2104('0x32')]);_0x8dc325[_0x2104('0x34')]=_[_0x2104('0x35')](_0x8dc325[_0x2104('0x36')],_0x8dc325[_0x2104('0x32')]);_0x25c77f[_0x2104('0x37')]=_[_0x2104('0x35')](_0x8dc325[_0x2104('0x36')],qs['fields'](_0x9db88a[_0x2104('0x32')][_0x2104('0x38')]));_0x25c77f[_0x2104('0x37')]=_0x25c77f[_0x2104('0x37')]['length']?_0x25c77f[_0x2104('0x37')]:_0x8dc325[_0x2104('0x36')];if(!_0x9db88a[_0x2104('0x32')]['hasOwnProperty']('nolimit')){_0x25c77f[_0x2104('0x1f')]=qs[_0x2104('0x1f')](_0x9db88a[_0x2104('0x32')][_0x2104('0x1f')]);_0x25c77f[_0x2104('0x1e')]=qs['offset'](_0x9db88a[_0x2104('0x32')][_0x2104('0x1e')]);}_0x25c77f[_0x2104('0x3a')]=qs[_0x2104('0x3b')](_0x9db88a[_0x2104('0x32')][_0x2104('0x3b')]);_0x25c77f[_0x2104('0x3c')]=qs[_0x2104('0x34')](_[_0x2104('0x3d')](_0x9db88a['query'],_0x8dc325[_0x2104('0x34')]));_0x25c77f[_0x2104('0x3c')][_0x2104('0x62')]=_0x20ac2d['id'];if(_0x9db88a['query'][_0x2104('0x3e')]){_0x25c77f['where']=_[_0x2104('0x3f')](_0x25c77f['where'],{'$or':_[_0x2104('0x2d')](_0x25c77f['attributes'],function(_0x297a0e){var _0x5724c1={};_0x5724c1[_0x297a0e]={'$like':'%'+_0x9db88a[_0x2104('0x32')][_0x2104('0x3e')]+'%'};return _0x5724c1;})});}_0x25c77f=_[_0x2104('0x3f')]({},_0x25c77f,_0x9db88a['options']);return db[_0x2104('0x61')][_0x2104('0x21')]({'where':_0x25c77f[_0x2104('0x3c')]})[_0x2104('0x25')](function(_0x2299c1){_0xdab1c5[_0x2104('0x21')]=_0x2299c1;if(_0x9db88a[_0x2104('0x32')][_0x2104('0x43')]){_0x25c77f[_0x2104('0x44')]=[{'all':!![]}];}return db[_0x2104('0x61')][_0x2104('0x45')](_0x25c77f);})[_0x2104('0x25')](function(_0x303e6e){_0xdab1c5[_0x2104('0x46')]=_0x303e6e;return _0xdab1c5;});}})[_0x2104('0x25')](respondWithFilteredResult(_0x1dd13b,_0x25c77f))['catch'](handleError(_0x1dd13b,null));};exports[_0x2104('0x63')]=function(_0x2ab4c9,_0x13ada6,_0x2e3448){var _0x20763e={'raw':!![],'where':{}};var _0x5e166e={};var _0x16b2e7={'count':0x0,'rows':[]};return db[_0x2104('0x42')][_0x2104('0x5b')]({'where':{'id':_0x2ab4c9[_0x2104('0x49')]['id']}})[_0x2104('0x25')](handleEntityNotFound(_0x13ada6,null))[_0x2104('0x25')](function(_0x3170c4){if(_0x3170c4){_0x5e166e['model']=_[_0x2104('0x33')](db[_0x2104('0x64')]['rawAttributes']);_0x5e166e[_0x2104('0x32')]=_[_0x2104('0x33')](_0x2ab4c9[_0x2104('0x32')]);_0x5e166e['filters']=_[_0x2104('0x35')](_0x5e166e['model'],_0x5e166e[_0x2104('0x32')]);_0x20763e[_0x2104('0x37')]=_[_0x2104('0x35')](_0x5e166e[_0x2104('0x36')],qs[_0x2104('0x38')](_0x2ab4c9['query'][_0x2104('0x38')]));_0x20763e[_0x2104('0x37')]=_0x20763e[_0x2104('0x37')][_0x2104('0x4a')]?_0x20763e['attributes']:_0x5e166e[_0x2104('0x36')];if(!_0x2ab4c9[_0x2104('0x32')][_0x2104('0x39')](_0x2104('0x5e'))){_0x20763e[_0x2104('0x1f')]=qs[_0x2104('0x1f')](_0x2ab4c9[_0x2104('0x32')][_0x2104('0x1f')]);_0x20763e[_0x2104('0x1e')]=qs[_0x2104('0x1e')](_0x2ab4c9[_0x2104('0x32')][_0x2104('0x1e')]);}_0x20763e[_0x2104('0x3a')]=qs[_0x2104('0x3b')](_0x2ab4c9[_0x2104('0x32')][_0x2104('0x3b')]);_0x20763e[_0x2104('0x3c')]=qs[_0x2104('0x34')](_['pick'](_0x2ab4c9[_0x2104('0x32')],_0x5e166e['filters']));_0x20763e[_0x2104('0x3c')][_0x2104('0x62')]=_0x3170c4['id'];if(_0x2ab4c9[_0x2104('0x32')][_0x2104('0x3e')]){_0x20763e[_0x2104('0x3c')]=_['merge'](_0x20763e[_0x2104('0x3c')],{'$or':_[_0x2104('0x2d')](_0x20763e[_0x2104('0x37')],function(_0x720bb4){var _0x493ac4={};_0x493ac4[_0x720bb4]={'$like':'%'+_0x2ab4c9[_0x2104('0x32')]['filter']+'%'};return _0x493ac4;})});}_0x20763e=_['merge']({},_0x20763e,_0x2ab4c9['options']);return db['CmHopperBlack']['count']({'where':_0x20763e[_0x2104('0x3c')]})['then'](function(_0x3e29fd){_0x16b2e7['count']=_0x3e29fd;if(_0x2ab4c9[_0x2104('0x32')][_0x2104('0x43')]){_0x20763e['include']=[{'all':!![]}];}return db[_0x2104('0x64')]['findAll'](_0x20763e);})[_0x2104('0x25')](function(_0x3971b5){_0x16b2e7[_0x2104('0x46')]=_0x3971b5;return _0x16b2e7;});}})[_0x2104('0x25')](respondWithFilteredResult(_0x13ada6,_0x20763e))[_0x2104('0x47')](handleError(_0x13ada6,null));};exports[_0x2104('0x65')]=function(_0x23c4de,_0x2e405b,_0x4d5467){var _0x54d549={};var _0xa835c2={};var _0x2eebd2;var _0x27a7bc;return db['Campaign'][_0x2104('0x5b')]({'where':{'id':_0x23c4de[_0x2104('0x49')]['id']}})[_0x2104('0x25')](handleEntityNotFound(_0x2e405b,null))[_0x2104('0x25')](function(_0x3e8787){if(_0x3e8787){_0x2eebd2=_0x3e8787;_0xa835c2[_0x2104('0x36')]=_[_0x2104('0x33')](db[_0x2104('0x66')][_0x2104('0x2e')]);_0xa835c2[_0x2104('0x32')]=_['keys'](_0x23c4de[_0x2104('0x32')]);_0xa835c2[_0x2104('0x34')]=_['intersection'](_0xa835c2['model'],_0xa835c2['query']);_0x54d549[_0x2104('0x37')]=_[_0x2104('0x35')](_0xa835c2[_0x2104('0x36')],qs[_0x2104('0x38')](_0x23c4de[_0x2104('0x32')][_0x2104('0x38')]));_0x54d549[_0x2104('0x37')]=_0x54d549['attributes'][_0x2104('0x4a')]?_0x54d549[_0x2104('0x37')]:_0xa835c2[_0x2104('0x36')];_0x54d549[_0x2104('0x3a')]=qs[_0x2104('0x3b')](_0x23c4de[_0x2104('0x32')][_0x2104('0x3b')]);_0x54d549[_0x2104('0x3c')]=qs[_0x2104('0x34')](_[_0x2104('0x3d')](_0x23c4de[_0x2104('0x32')],_0xa835c2[_0x2104('0x34')]));if(_0x23c4de[_0x2104('0x32')][_0x2104('0x3e')]){_0x54d549[_0x2104('0x3c')]=_['merge'](_0x54d549[_0x2104('0x3c')],{'$or':_[_0x2104('0x2d')](_0x54d549[_0x2104('0x37')],function(_0x57042c){var _0xf220c8={};_0xf220c8[_0x57042c]={'$like':'%'+_0x23c4de[_0x2104('0x32')][_0x2104('0x3e')]+'%'};return _0xf220c8;})});}_0x54d549=_[_0x2104('0x3f')]({},_0x54d549,_0x23c4de[_0x2104('0x41')]);return _0x2eebd2['getLists'](_0x54d549);}})[_0x2104('0x25')](function(_0x39cb1d){if(_0x39cb1d){_0x27a7bc=_0x39cb1d[_0x2104('0x4a')];if(!_0x23c4de['query'][_0x2104('0x39')]('nolimit')){_0x54d549[_0x2104('0x1f')]=qs[_0x2104('0x1f')](_0x23c4de[_0x2104('0x32')][_0x2104('0x1f')]);_0x54d549[_0x2104('0x1e')]=qs[_0x2104('0x1e')](_0x23c4de['query'][_0x2104('0x1e')]);}return _0x2eebd2[_0x2104('0x65')](_0x54d549);}})[_0x2104('0x25')](function(_0x4dcc8f){if(_0x4dcc8f){return _0x4dcc8f?{'count':_0x27a7bc,'rows':_0x4dcc8f}:null;}})[_0x2104('0x25')](respondWithResult(_0x2e405b,null))[_0x2104('0x47')](handleError(_0x2e405b,null));};exports[_0x2104('0x67')]=function(_0xa8b76d,_0x48369f,_0x12deaa){var _0x4f4329,_0x49a5ff;var _0x4757c0=[];var _0x1c8d80=moment()[_0x2104('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x2104('0x42')][_0x2104('0x56')]({'where':{'id':_0xa8b76d[_0x2104('0x49')]['id']}})[_0x2104('0x25')](handleEntityNotFound(_0x48369f,null))[_0x2104('0x25')](function(_0xf43567){if(_0xf43567){_0x49a5ff=_0xf43567;return _0xf43567[_0x2104('0x67')](_0xa8b76d['body'][_0x2104('0x69')],_[_0x2104('0x57')](_0xa8b76d[_0x2104('0x4c')],[_0x2104('0x69'),'id'])||{});}return null;})[_0x2104('0x6a')](function(_0x35614e){var _0x234bc0;var _0x1b1446;_0x4f4329=_0x35614e||[];var _0x4e8a1e=[];if(_0x35614e){for(var _0x2c7e20=0x0;_0x2c7e20<_0x35614e['length'];_0x2c7e20+=0x1){var _0x5a426e=_0x35614e[_0x2c7e20][_0x2104('0x27')]({'plain':!![]});_0x49a5ff[_0x2104('0x6b')]=_0xa8b76d[_0x2104('0x4c')]['dialCheckDuplicateType']?_0xa8b76d[_0x2104('0x4c')]['dialCheckDuplicateType']:_0x49a5ff[_0x2104('0x6b')];switch(_0x49a5ff['dialCheckDuplicateType']){case'always':_0x234bc0=squel[_0x2104('0x6c')]()[_0x2104('0x6d')]('cm_hopper')[_0x2104('0x6e')]([_0x2104('0x6f'),_0x2104('0x70'),'ContactId',_0x2104('0x71'),_0x2104('0x62'),'createdAt',_0x2104('0x59')],squel[_0x2104('0x72')]()['field'](_0x2104('0x6f'),_0x2104('0x6f'))[_0x2104('0x73')](_0x2104('0x74'),_0x2104('0x70'))[_0x2104('0x73')]('id',_0x2104('0x75'))['field'](_0x5a426e[_0x2104('0x76')]['toString'](),_0x2104('0x71'))[_0x2104('0x73')](_0xa8b76d[_0x2104('0x49')]['id'][_0x2104('0x77')](),_0x2104('0x62'))['field']('\x27'+_0x1c8d80+'\x27','createdAt')[_0x2104('0x73')]('\x27'+_0x1c8d80+'\x27',_0x2104('0x59'))[_0x2104('0x78')](_0x2104('0x79'))[_0x2104('0x3c')](_0x2104('0x7a'))[_0x2104('0x3c')]('ListId\x20=\x20?',_0x5a426e['CmListId'][_0x2104('0x77')]())[_0x2104('0x3c')](_0x2104('0x7b'))[_0x2104('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2104('0x72')]()[_0x2104('0x73')](_0x2104('0x7c'))[_0x2104('0x78')]('cm_hopper_final')[_0x2104('0x3c')]('CampaignId\x20=\x20?',_0xa8b76d['params']['id'][_0x2104('0x77')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2104('0x72')]()[_0x2104('0x73')](_0x2104('0x7d'))[_0x2104('0x78')](_0x2104('0x7e'))[_0x2104('0x3c')](_0x2104('0x7f'),_0xa8b76d[_0x2104('0x49')]['id'][_0x2104('0x77')]())))['toString']();break;case _0x2104('0x80'):_0x234bc0=squel[_0x2104('0x6c')]()[_0x2104('0x6d')](_0x2104('0x7e'))[_0x2104('0x6e')]([_0x2104('0x6f'),_0x2104('0x70'),_0x2104('0x75'),'ListId',_0x2104('0x62'),_0x2104('0x58'),'updatedAt'],squel[_0x2104('0x72')]()[_0x2104('0x73')](_0x2104('0x6f'),_0x2104('0x6f'))['field'](_0x2104('0x74'),_0x2104('0x70'))['field']('id',_0x2104('0x75'))[_0x2104('0x73')](_0x5a426e['CmListId'][_0x2104('0x77')](),'ListId')[_0x2104('0x73')](_0xa8b76d['params']['id'][_0x2104('0x77')](),_0x2104('0x62'))[_0x2104('0x73')]('\x27'+_0x1c8d80+'\x27',_0x2104('0x58'))[_0x2104('0x73')]('\x27'+_0x1c8d80+'\x27','updatedAt')[_0x2104('0x78')](_0x2104('0x79'))[_0x2104('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0x2104('0x81'),_0x5a426e[_0x2104('0x76')][_0x2104('0x77')]())[_0x2104('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x2104('0x3c')](_0x2104('0x82'),squel[_0x2104('0x72')]()['field'](_0x2104('0x7d'))[_0x2104('0x78')](_0x2104('0x7e'))[_0x2104('0x3c')]('CampaignId\x20=\x20?',_0xa8b76d[_0x2104('0x49')]['id']['toString']())))[_0x2104('0x77')]();break;default:_0x234bc0=squel[_0x2104('0x6c')]()[_0x2104('0x6d')](_0x2104('0x7e'))[_0x2104('0x6e')]([_0x2104('0x6f'),'scheduledAt',_0x2104('0x75'),_0x2104('0x71'),_0x2104('0x62'),_0x2104('0x58'),'updatedAt'],squel[_0x2104('0x72')]()[_0x2104('0x73')](_0x2104('0x6f'),'phone')[_0x2104('0x73')](_0x2104('0x74'),'scheduledAt')[_0x2104('0x73')]('id',_0x2104('0x75'))['field'](_0x5a426e[_0x2104('0x76')]['toString'](),'ListId')[_0x2104('0x73')](_0xa8b76d[_0x2104('0x49')]['id'][_0x2104('0x77')](),'CampaignId')[_0x2104('0x73')]('\x27'+_0x1c8d80+'\x27',_0x2104('0x58'))[_0x2104('0x73')]('\x27'+_0x1c8d80+'\x27',_0x2104('0x59'))[_0x2104('0x78')](_0x2104('0x79'))[_0x2104('0x3c')](_0x2104('0x7a'))[_0x2104('0x3c')](_0x2104('0x81'),_0x5a426e['CmListId']['toString']())[_0x2104('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x1b1446=squel[_0x2104('0x6c')]()[_0x2104('0x6d')](_0x2104('0x83'))[_0x2104('0x6e')]([_0x2104('0x84'),'scheduledAt',_0x2104('0x6f'),_0x2104('0x85'),_0x2104('0x58'),_0x2104('0x59')],squel['select']()[_0x2104('0x73')](_0x2104('0x86'),'id')[_0x2104('0x73')](_0x2104('0x74'),'scheduledAt')['field'](_0x2104('0x87'),'phone')['field'](_0x2104('0x88'),_0x2104('0x85'))[_0x2104('0x73')]('\x27'+_0x1c8d80+'\x27',_0x2104('0x58'))[_0x2104('0x73')]('\x27'+_0x1c8d80+'\x27','updatedAt')[_0x2104('0x78')](_0x2104('0x89'),'ci')[_0x2104('0x8a')](_0x2104('0x7e'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x2104('0x3c')]('h.ListId\x20=\x20?',_0x5a426e['CmListId'][_0x2104('0x77')]())[_0x2104('0x3c')](_0x2104('0x8b'),_0xa8b76d[_0x2104('0x49')]['id'][_0x2104('0x77')]())[_0x2104('0x3c')](_0x2104('0x8c'),_0x1c8d80))[_0x2104('0x77')]();_0x4e8a1e['push'](db[_0x2104('0x8d')]['query'](_0x234bc0));_0x4757c0[_0x2104('0x8e')](db[_0x2104('0x8d')][_0x2104('0x32')](_0x1b1446));}return BPromise['all'](_0x4e8a1e);}})['then'](function(){return BPromise['all'](_0x4757c0);})[_0x2104('0x25')](function(){return _0x4f4329;})[_0x2104('0x25')](respondWithResult(_0x48369f,null))[_0x2104('0x47')](handleError(_0x48369f,null));};exports[_0x2104('0x8f')]=function(_0x4c58aa,_0x111c54,_0x399f3f){return db[_0x2104('0x42')][_0x2104('0x56')]({'where':{'id':_0x4c58aa[_0x2104('0x49')]['id']}})[_0x2104('0x25')](handleEntityNotFound(_0x111c54,null))[_0x2104('0x25')](function(_0xe40767){if(_0xe40767){return _0xe40767[_0x2104('0x8f')](_0x4c58aa[_0x2104('0x32')]['ids']);}})[_0x2104('0x25')](function(_0x5a22b7){if(_0x5a22b7){return db[_0x2104('0x5c')][_0x2104('0x26')]({'where':{'ListId':_0x4c58aa['query'][_0x2104('0x69')],'CampaignId':_0x4c58aa[_0x2104('0x49')]['id']}})['then'](function(){return _0x5a22b7;});}})[_0x2104('0x25')](respondWithStatusCode(_0x111c54,null))['catch'](handleError(_0x111c54,null));};exports[_0x2104('0x90')]=function(_0x41fdfd,_0xd80775,_0x14e146){var _0x5ece98={};var _0x557ae1={};var _0x8d2e42;var _0x3e47d7;return db[_0x2104('0x42')][_0x2104('0x5b')]({'where':{'id':_0x41fdfd[_0x2104('0x49')]['id']}})['then'](handleEntityNotFound(_0xd80775,null))['then'](function(_0x2a6d3d){if(_0x2a6d3d){_0x8d2e42=_0x2a6d3d;_0x557ae1[_0x2104('0x36')]=_[_0x2104('0x33')](db[_0x2104('0x66')][_0x2104('0x2e')]);_0x557ae1[_0x2104('0x32')]=_['keys'](_0x41fdfd[_0x2104('0x32')]);_0x557ae1[_0x2104('0x34')]=_['intersection'](_0x557ae1['model'],_0x557ae1[_0x2104('0x32')]);_0x5ece98[_0x2104('0x37')]=_[_0x2104('0x35')](_0x557ae1['model'],qs[_0x2104('0x38')](_0x41fdfd[_0x2104('0x32')]['fields']));_0x5ece98[_0x2104('0x37')]=_0x5ece98[_0x2104('0x37')][_0x2104('0x4a')]?_0x5ece98[_0x2104('0x37')]:_0x557ae1[_0x2104('0x36')];_0x5ece98[_0x2104('0x3a')]=qs[_0x2104('0x3b')](_0x41fdfd[_0x2104('0x32')][_0x2104('0x3b')]);_0x5ece98[_0x2104('0x3c')]=qs[_0x2104('0x34')](_[_0x2104('0x3d')](_0x41fdfd[_0x2104('0x32')],_0x557ae1[_0x2104('0x34')]));if(_0x41fdfd[_0x2104('0x32')]['filter']){_0x5ece98[_0x2104('0x3c')]=_['merge'](_0x5ece98[_0x2104('0x3c')],{'$or':_['map'](_0x5ece98['attributes'],function(_0x41622e){var _0x4e2256={};_0x4e2256[_0x41622e]={'$like':'%'+_0x41fdfd[_0x2104('0x32')]['filter']+'%'};return _0x4e2256;})});}_0x5ece98=_[_0x2104('0x3f')]({},_0x5ece98,_0x41fdfd[_0x2104('0x41')]);return _0x8d2e42['getBlackLists'](_0x5ece98);}})['then'](function(_0x557000){if(_0x557000){_0x3e47d7=_0x557000['length'];if(!_0x41fdfd[_0x2104('0x32')]['hasOwnProperty'](_0x2104('0x5e'))){_0x5ece98[_0x2104('0x1f')]=qs[_0x2104('0x1f')](_0x41fdfd[_0x2104('0x32')][_0x2104('0x1f')]);_0x5ece98[_0x2104('0x1e')]=qs[_0x2104('0x1e')](_0x41fdfd[_0x2104('0x32')][_0x2104('0x1e')]);}return _0x8d2e42[_0x2104('0x90')](_0x5ece98);}})[_0x2104('0x25')](function(_0xb5752b){if(_0xb5752b){return _0xb5752b?{'count':_0x3e47d7,'rows':_0xb5752b}:null;}})['then'](respondWithResult(_0xd80775,null))[_0x2104('0x47')](handleError(_0xd80775,null));};exports[_0x2104('0x91')]=function(_0x1560c0,_0x591791,_0x400bd2){var _0x56398f,_0x1792fc;var _0x234162=[];var _0x37f725=moment()[_0x2104('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x2104('0x42')][_0x2104('0x56')]({'where':{'id':_0x1560c0[_0x2104('0x49')]['id']}})['then'](handleEntityNotFound(_0x591791,null))['then'](function(_0x5db293){if(_0x5db293){_0x1792fc=_0x5db293;return _0x5db293[_0x2104('0x91')](_0x1560c0['body'][_0x2104('0x69')],_[_0x2104('0x57')](_0x1560c0['body'],['ids','id'])||{});}return null;})[_0x2104('0x6a')](function(_0x588d2b){var _0x32ff3c;var _0x2ceebe;_0x56398f=_0x588d2b||[];var _0x22bea8=[];if(_0x588d2b){for(var _0x56911b=0x0;_0x56911b<_0x588d2b['length'];_0x56911b+=0x1){var _0xccdd94=_0x588d2b[_0x56911b][_0x2104('0x27')]({'plain':!![]});_0x32ff3c=squel[_0x2104('0x6c')]()['into'](_0x2104('0x92'))[_0x2104('0x6e')]([_0x2104('0x6f'),_0x2104('0x75'),_0x2104('0x71'),'CampaignId','createdAt','updatedAt'],squel['select']()[_0x2104('0x73')](_0x2104('0x6f'),_0x2104('0x6f'))[_0x2104('0x73')]('id','ContactId')['field'](_0xccdd94[_0x2104('0x76')][_0x2104('0x77')](),_0x2104('0x71'))[_0x2104('0x73')](_0x1560c0[_0x2104('0x49')]['id']['toString'](),'CampaignId')['field'](_0x2104('0x74'),_0x2104('0x58'))[_0x2104('0x73')](_0x2104('0x74'),_0x2104('0x59'))[_0x2104('0x78')](_0x2104('0x79'))[_0x2104('0x3c')](_0x2104('0x7a'))[_0x2104('0x3c')](_0x2104('0x81'),_0xccdd94[_0x2104('0x76')][_0x2104('0x77')]())[_0x2104('0x3c')](_0x2104('0x7b')))[_0x2104('0x77')]();_0x22bea8['push'](db['sequelize'][_0x2104('0x32')](_0x32ff3c));}return BPromise[_0x2104('0x93')](_0x22bea8);}})[_0x2104('0x25')](function(){return _0x56398f;})[_0x2104('0x25')](respondWithResult(_0x591791,null))['catch'](handleError(_0x591791,null));};exports[_0x2104('0x94')]=function(_0x4c3065,_0x5cc95b,_0x1807a9){return db[_0x2104('0x42')][_0x2104('0x56')]({'where':{'id':_0x4c3065[_0x2104('0x49')]['id']}})[_0x2104('0x25')](handleEntityNotFound(_0x5cc95b,null))[_0x2104('0x25')](function(_0x1e0aa3){if(_0x1e0aa3){return _0x1e0aa3[_0x2104('0x94')](_0x4c3065['query'][_0x2104('0x69')]);}})[_0x2104('0x25')](function(_0x4a6b38){if(_0x4a6b38){return db[_0x2104('0x64')]['destroy']({'where':{'ListId':_0x4c3065[_0x2104('0x32')][_0x2104('0x69')],'CampaignId':_0x4c3065['params']['id']}})[_0x2104('0x25')](function(){return _0x4a6b38;});}})[_0x2104('0x25')](respondWithStatusCode(_0x5cc95b,null))[_0x2104('0x47')](handleError(_0x5cc95b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 411fafa..44a9656 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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xb6a6bf,_0x184dfd){var _0x4a36b5=function(_0xa10bf3){while(--_0xa10bf3){_0xb6a6bf['push'](_0xb6a6bf['shift']());}};_0x4a36b5(++_0x184dfd);}(_0x7a54,0x106));var _0x47a5=function(_0x5586be,_0x1d1838){_0x5586be=_0x5586be-0x0;var _0x15a658=_0x7a54[_0x5586be];return _0x15a658;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 6c7c039..3f048ab 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 _0x8ccb=['GetCampaign','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','debug','Campaign,\x20%s,\x20%s,\x20%s','error','Campaign,\x20%s,\x20%s','message','request\x20sent','result','Campaign','options','raw','where','attributes','limit','include','map','model'];(function(_0x4e581f,_0x3f939d){var _0x8ced8b=function(_0x4700b7){while(--_0x4700b7){_0x4e581f['push'](_0x4e581f['shift']());}};_0x8ced8b(++_0x3f939d);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0x8ccb[_0x1e03a6];return _0x295b64;};'use strict';var _=require(_0xb8cc('0x0'));var util=require(_0xb8cc('0x1'));var moment=require('moment');var BPromise=require(_0xb8cc('0x2'));var rs=require(_0xb8cc('0x3'));var fs=require('fs');var Redis=require(_0xb8cc('0x4'));var db=require(_0xb8cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8cc('0x6'));var config=require(_0xb8cc('0x7'));var jayson=require(_0xb8cc('0x8'));var client=jayson['client'][_0xb8cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349552,_0x139945,_0x56951f){return new BPromise(function(_0x35c86d,_0x2c338f){return client[_0xb8cc('0xa')](_0x349552,_0x56951f)['then'](function(_0x175473){logger[_0xb8cc('0xb')]('Campaign,\x20%s,\x20%s',_0x139945,'request\x20sent');logger[_0xb8cc('0xc')](_0xb8cc('0xd'),_0x139945,'request\x20sent',JSON['stringify'](_0x175473));if(_0x175473[_0xb8cc('0xe')]){if(_0x175473[_0xb8cc('0xe')]['code']===0x1f4){logger[_0xb8cc('0xe')](_0xb8cc('0xf'),_0x139945,_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);return _0x2c338f(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}logger[_0xb8cc('0xe')]('Campaign,\x20%s,\x20%s',_0x139945,_0x175473[_0xb8cc('0xe')]['message']);return _0x35c86d(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}else{logger[_0xb8cc('0xb')]('Campaign,\x20%s,\x20%s',_0x139945,_0xb8cc('0x11'));_0x35c86d(_0x175473[_0xb8cc('0x12')][_0xb8cc('0x10')]);}})['catch'](function(_0x2ba498){logger['error'](_0xb8cc('0xf'),_0x139945,_0x2ba498);_0x2c338f(_0x2ba498);});});}exports['GetCampaign']=function(_0x2ac4cc){var _0x259708=this;return new Promise(function(_0x2b7130,_0x3e1ba7){return db[_0xb8cc('0x13')]['findAll']({'raw':_0x2ac4cc[_0xb8cc('0x14')]?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x15')]===undefined?!![]:![]:!![],'where':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x16')]||null:null,'attributes':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x17')]||null:null,'limit':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x18')]||null:null,'include':_0x2ac4cc[_0xb8cc('0x14')]?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x19')]?_[_0xb8cc('0x1a')](_0x2ac4cc[_0xb8cc('0x14')]['include'],function(_0x50aa38){return{'model':db[_0x50aa38[_0xb8cc('0x1b')]],'as':_0x50aa38['as'],'attributes':_0x50aa38['attributes'],'include':_0x50aa38[_0xb8cc('0x19')]?_['map'](_0x50aa38[_0xb8cc('0x19')],function(_0xbb1918){return{'model':db[_0xbb1918[_0xb8cc('0x1b')]],'as':_0xbb1918['as'],'attributes':_0xbb1918[_0xb8cc('0x17')],'include':_0xbb1918['include']?_[_0xb8cc('0x1a')](_0xbb1918[_0xb8cc('0x19')],function(_0x400de6){return{'model':db[_0x400de6[_0xb8cc('0x1b')]],'as':_0x400de6['as'],'attributes':_0x400de6[_0xb8cc('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50ed6f){logger[_0xb8cc('0xb')](_0xb8cc('0x1c'),_0x2ac4cc);logger['debug'](_0xb8cc('0x1c'),_0x2ac4cc,JSON['stringify'](_0x50ed6f));_0x2b7130(_0x50ed6f);})[_0xb8cc('0x1d')](function(_0x2634a4){logger[_0xb8cc('0xe')](_0xb8cc('0x1c'),_0x2634a4['message'],_0x2ac4cc);_0x3e1ba7(_0x259708[_0xb8cc('0xe')](0x1f4,_0x2634a4[_0xb8cc('0x10')]));});});}; \ No newline at end of file +var _0x3299=['Campaign,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetCampaign','findAll','options','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug'];(function(_0x6dfd39,_0x1cb1ae){var _0xcb55b8=function(_0x32e62b){while(--_0x32e62b){_0x6dfd39['push'](_0x6dfd39['shift']());}};_0xcb55b8(++_0x1cb1ae);}(_0x3299,0x1bc));var _0x9329=function(_0x4674b7,_0x46e906){_0x4674b7=_0x4674b7-0x0;var _0x503198=_0x3299[_0x4674b7];return _0x503198;};'use strict';var _=require('lodash');var util=require(_0x9329('0x0'));var moment=require(_0x9329('0x1'));var BPromise=require(_0x9329('0x2'));var rs=require(_0x9329('0x3'));var fs=require('fs');var Redis=require(_0x9329('0x4'));var db=require(_0x9329('0x5'))['db'];var utils=require(_0x9329('0x6'));var logger=require(_0x9329('0x7'))(_0x9329('0x8'));var config=require(_0x9329('0x9'));var jayson=require(_0x9329('0xa'));var client=jayson[_0x9329('0xb')][_0x9329('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14bc45,_0x1fa6c4,_0x218cf3){return new BPromise(function(_0x182d15,_0x531cf1){return client[_0x9329('0xd')](_0x14bc45,_0x218cf3)[_0x9329('0xe')](function(_0x1c1033){logger[_0x9329('0xf')](_0x9329('0x10'),_0x1fa6c4,'request\x20sent');logger[_0x9329('0x11')](_0x9329('0x12'),_0x1fa6c4,'request\x20sent',JSON['stringify'](_0x1c1033));if(_0x1c1033['error']){if(_0x1c1033[_0x9329('0x13')][_0x9329('0x14')]===0x1f4){logger[_0x9329('0x13')](_0x9329('0x10'),_0x1fa6c4,_0x1c1033[_0x9329('0x13')]['message']);return _0x531cf1(_0x1c1033[_0x9329('0x13')][_0x9329('0x15')]);}logger[_0x9329('0x13')]('Campaign,\x20%s,\x20%s',_0x1fa6c4,_0x1c1033[_0x9329('0x13')][_0x9329('0x15')]);return _0x182d15(_0x1c1033['error'][_0x9329('0x15')]);}else{logger[_0x9329('0xf')]('Campaign,\x20%s,\x20%s',_0x1fa6c4,_0x9329('0x16'));_0x182d15(_0x1c1033[_0x9329('0x17')][_0x9329('0x15')]);}})[_0x9329('0x18')](function(_0x4dfbc1){logger[_0x9329('0x13')]('Campaign,\x20%s,\x20%s',_0x1fa6c4,_0x4dfbc1);_0x531cf1(_0x4dfbc1);});});}exports[_0x9329('0x19')]=function(_0x1b5eed){var _0x57718b=this;return new Promise(function(_0x41db73,_0x26a3c2){return db['Campaign'][_0x9329('0x1a')]({'raw':_0x1b5eed['options']?_0x1b5eed[_0x9329('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed['options'][_0x9329('0x1c')]||null:null,'attributes':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed[_0x9329('0x1b')][_0x9329('0x1d')]||null:null,'limit':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed[_0x9329('0x1b')]['limit']||null:null,'include':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed[_0x9329('0x1b')][_0x9329('0x1e')]?_[_0x9329('0x1f')](_0x1b5eed[_0x9329('0x1b')]['include'],function(_0x22caa4){return{'model':db[_0x22caa4[_0x9329('0x20')]],'as':_0x22caa4['as'],'attributes':_0x22caa4['attributes'],'include':_0x22caa4[_0x9329('0x1e')]?_[_0x9329('0x1f')](_0x22caa4[_0x9329('0x1e')],function(_0x2da39d){return{'model':db[_0x2da39d['model']],'as':_0x2da39d['as'],'attributes':_0x2da39d['attributes'],'include':_0x2da39d[_0x9329('0x1e')]?_[_0x9329('0x1f')](_0x2da39d[_0x9329('0x1e')],function(_0x4f5fbf){return{'model':db[_0x4f5fbf[_0x9329('0x20')]],'as':_0x4f5fbf['as'],'attributes':_0x4f5fbf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9329('0xe')](function(_0x192d0a){logger[_0x9329('0xf')]('GetCampaign',_0x1b5eed);logger['debug'](_0x9329('0x19'),_0x1b5eed,JSON['stringify'](_0x192d0a));_0x41db73(_0x192d0a);})[_0x9329('0x18')](function(_0x4a5d27){logger[_0x9329('0x13')]('GetCampaign',_0x4a5d27[_0x9329('0x15')],_0x1b5eed);_0x26a3c2(_0x57718b[_0x9329('0x13')](0x1f4,_0x4a5d27['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 834a59d..e80b932 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 _0x142c=['/:id/hopper_histories','/:id/hopper_black','getHopperBlacks','/:id/lists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./campaign.controller','isAuthenticated','get','/:id','/:id/hoppers'];(function(_0x8c27bc,_0x3d876b){var _0x58a502=function(_0x462298){while(--_0x462298){_0x8c27bc['push'](_0x8c27bc['shift']());}};_0x58a502(++_0x3d876b);}(_0x142c,0x86));var _0xc142=function(_0x2a95a0,_0xe5b698){_0x2a95a0=_0x2a95a0-0x0;var _0x2ac4bf=_0x142c[_0x2a95a0];return _0x2ac4bf;};'use strict';var multer=require(_0xc142('0x0'));var util=require('util');var path=require(_0xc142('0x1'));var timeout=require(_0xc142('0x2'));var express=require(_0xc142('0x3'));var router=express['Router']();var fs_extra=require(_0xc142('0x4'));var auth=require(_0xc142('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc142('0x6'));router['get']('/',auth[_0xc142('0x7')](),controller['index']);router[_0xc142('0x8')](_0xc142('0x9'),auth[_0xc142('0x7')](),controller['show']);router['get'](_0xc142('0xa'),auth[_0xc142('0x7')](),controller['getHoppers']);router['get'](_0xc142('0xb'),auth[_0xc142('0x7')](),controller['getHopperHistories']);router[_0xc142('0x8')]('/:id/hopper_finals',auth[_0xc142('0x7')](),controller['getHopperFinals']);router[_0xc142('0x8')](_0xc142('0xc'),auth[_0xc142('0x7')](),controller[_0xc142('0xd')]);router['get'](_0xc142('0xe'),auth[_0xc142('0x7')](),controller['getLists']);router[_0xc142('0x8')]('/:id/blacklists',auth[_0xc142('0x7')](),controller['getBlackLists']);router['post']('/',auth[_0xc142('0x7')](),controller[_0xc142('0xf')]);router[_0xc142('0x10')](_0xc142('0x11'),auth['isAuthenticated'](),controller[_0xc142('0x12')]);router[_0xc142('0x10')](_0xc142('0xe'),auth[_0xc142('0x7')](),controller[_0xc142('0x13')]);router[_0xc142('0x10')]('/:id/blacklists',auth[_0xc142('0x7')](),controller[_0xc142('0x14')]);router[_0xc142('0x15')](_0xc142('0x9'),auth[_0xc142('0x7')](),controller[_0xc142('0x16')]);router[_0xc142('0x17')](_0xc142('0x9'),auth[_0xc142('0x7')](),controller[_0xc142('0x18')]);router[_0xc142('0x17')]('/:id/lists',auth['isAuthenticated'](),controller[_0xc142('0x19')]);router['delete'](_0xc142('0x1a'),auth[_0xc142('0x7')](),controller[_0xc142('0x1b')]);module[_0xc142('0x1c')]=router; \ No newline at end of file +var _0x02e5=['getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0x230767,_0x5dc481){var _0x452ed4=function(_0x1349ea){while(--_0x1349ea){_0x230767['push'](_0x230767['shift']());}};_0x452ed4(++_0x5dc481);}(_0x02e5,0x132));var _0x502e=function(_0x1b0533,_0x4fd2d6){_0x1b0533=_0x1b0533-0x0;var _0x408c77=_0x02e5[_0x1b0533];return _0x408c77;};'use strict';var multer=require(_0x502e('0x0'));var util=require(_0x502e('0x1'));var path=require(_0x502e('0x2'));var timeout=require('connect-timeout');var express=require(_0x502e('0x3'));var router=express[_0x502e('0x4')]();var fs_extra=require(_0x502e('0x5'));var auth=require(_0x502e('0x6'));var interaction=require(_0x502e('0x7'));var config=require(_0x502e('0x8'));var controller=require(_0x502e('0x9'));router[_0x502e('0xa')]('/',auth[_0x502e('0xb')](),controller[_0x502e('0xc')]);router[_0x502e('0xa')](_0x502e('0xd'),auth[_0x502e('0xb')](),controller[_0x502e('0xe')]);router[_0x502e('0xa')](_0x502e('0xf'),auth[_0x502e('0xb')](),controller[_0x502e('0x10')]);router[_0x502e('0xa')](_0x502e('0x11'),auth[_0x502e('0xb')](),controller[_0x502e('0x12')]);router[_0x502e('0xa')]('/:id/hopper_finals',auth[_0x502e('0xb')](),controller['getHopperFinals']);router['get'](_0x502e('0x13'),auth[_0x502e('0xb')](),controller[_0x502e('0x14')]);router[_0x502e('0xa')](_0x502e('0x15'),auth[_0x502e('0xb')](),controller['getLists']);router[_0x502e('0xa')]('/:id/blacklists',auth[_0x502e('0xb')](),controller[_0x502e('0x16')]);router[_0x502e('0x17')]('/',auth[_0x502e('0xb')](),controller[_0x502e('0x18')]);router[_0x502e('0x17')](_0x502e('0x19'),auth['isAuthenticated'](),controller[_0x502e('0x1a')]);router[_0x502e('0x17')]('/:id/lists',auth[_0x502e('0xb')](),controller[_0x502e('0x1b')]);router[_0x502e('0x17')](_0x502e('0x1c'),auth[_0x502e('0xb')](),controller[_0x502e('0x1d')]);router[_0x502e('0x1e')]('/:id',auth[_0x502e('0xb')](),controller[_0x502e('0x1f')]);router[_0x502e('0x20')](_0x502e('0xd'),auth[_0x502e('0xb')](),controller['destroy']);router[_0x502e('0x20')](_0x502e('0x15'),auth[_0x502e('0xb')](),controller[_0x502e('0x21')]);router[_0x502e('0x20')](_0x502e('0x1c'),auth['isAuthenticated'](),controller[_0x502e('0x22')]);module[_0x502e('0x23')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index da8d44e..1690907 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 _0x5a06=['exports','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x5a06,0xb9));var _0x65a0=function(_0x492a9f,_0x28752e){_0x492a9f=_0x492a9f-0x0;var _0xa72548=_0x5a06[_0x492a9f];return _0xa72548;};'use strict';var Sequelize=require(_0x65a0('0x0'));module[_0x65a0('0x1')]={'key':{'type':Sequelize[_0x65a0('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x65a0('0x2')]},'name':{'type':Sequelize[_0x65a0('0x3')],'get':function(){return this[_0x65a0('0x4')](_0x65a0('0x5'));}}}; \ No newline at end of file +var _0xf332=['getDataValue','sequelize','exports','TEXT','STRING'];(function(_0x15d8bd,_0x515e30){var _0x3b57d7=function(_0x101f4e){while(--_0x101f4e){_0x15d8bd['push'](_0x15d8bd['shift']());}};_0x3b57d7(++_0x515e30);}(_0xf332,0x105));var _0x2f33=function(_0x3a3e9d,_0x42e092){_0x3a3e9d=_0x3a3e9d-0x0;var _0x26aaf7=_0xf332[_0x3a3e9d];return _0x26aaf7;};'use strict';var Sequelize=require(_0x2f33('0x0'));module[_0x2f33('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x2f33('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2f33('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2f33('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d33f443..099658a 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 _0x53fb=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','rows','catch','params','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0xe4850f,_0x1ae0ce){var _0x302c7e=function(_0x11f7bc){while(--_0x11f7bc){_0xe4850f['push'](_0xe4850f['shift']());}};_0x302c7e(++_0x1ae0ce);}(_0x53fb,0x71));var _0xb53f=function(_0x311a31,_0x126007){_0x311a31=_0x311a31-0x0;var _0x4bfbaf=_0x53fb[_0x311a31];return _0x4bfbaf;};'use strict';var emlformat=require(_0xb53f('0x0'));var rimraf=require(_0xb53f('0x1'));var zipdir=require(_0xb53f('0x2'));var jsonpatch=require(_0xb53f('0x3'));var rp=require(_0xb53f('0x4'));var moment=require(_0xb53f('0x5'));var BPromise=require(_0xb53f('0x6'));var Mustache=require(_0xb53f('0x7'));var util=require('util');var path=require(_0xb53f('0x8'));var sox=require(_0xb53f('0x9'));var csv=require(_0xb53f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb53f('0xb'));var _=require('lodash');var squel=require(_0xb53f('0xc'));var crypto=require('crypto');var jsforce=require(_0xb53f('0xd'));var deskjs=require(_0xb53f('0xe'));var toCsv=require(_0xb53f('0xa'));var querystring=require(_0xb53f('0xf'));var Papa=require('papaparse');var Redis=require(_0xb53f('0x10'));var authService=require(_0xb53f('0x11'));var qs=require(_0xb53f('0x12'));var as=require(_0xb53f('0x13'));var hardwareService=require(_0xb53f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb53f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb53f('0x16'));var db=require(_0xb53f('0x17'))['db'];function respondWithStatusCode(_0xc86d69,_0x3b4a53){_0x3b4a53=_0x3b4a53||0xcc;return function(_0x47d7e3){if(_0x47d7e3){return _0xc86d69['sendStatus'](_0x3b4a53);}return _0xc86d69[_0xb53f('0x18')](_0x3b4a53)['end']();};}function respondWithResult(_0x35cdd2,_0x118f51){_0x118f51=_0x118f51||0xc8;return function(_0x1f5058){if(_0x1f5058){return _0x35cdd2['status'](_0x118f51)[_0xb53f('0x19')](_0x1f5058);}};}function respondWithFilteredResult(_0x155a41,_0x2432e8){return function(_0x588a53){if(_0x588a53){var _0x44ad4e=typeof _0x2432e8[_0xb53f('0x1a')]===_0xb53f('0x1b')&&typeof _0x2432e8[_0xb53f('0x1c')]===_0xb53f('0x1b');var _0x5df88d=_0x588a53[_0xb53f('0x1d')];var _0x2ea69f=_0x44ad4e?0x0:_0x2432e8[_0xb53f('0x1a')];var _0x2b8106=_0x44ad4e?_0x588a53[_0xb53f('0x1d')]:_0x2432e8[_0xb53f('0x1a')]+_0x2432e8[_0xb53f('0x1c')];var _0x501b4c;if(_0x2b8106>=_0x5df88d){_0x2b8106=_0x5df88d;_0x501b4c=0xc8;}else{_0x501b4c=0xce;}_0x155a41[_0xb53f('0x18')](_0x501b4c);return _0x155a41['set'](_0xb53f('0x1e'),_0x2ea69f+'-'+_0x2b8106+'/'+_0x5df88d)[_0xb53f('0x19')](_0x588a53);}return null;};}function patchUpdates(_0x2fd320){return function(_0xc14c77){try{jsonpatch[_0xb53f('0x1f')](_0xc14c77,_0x2fd320,!![]);}catch(_0x515afa){return BPromise[_0xb53f('0x20')](_0x515afa);}return _0xc14c77[_0xb53f('0x21')]();};}function saveUpdates(_0x18f770,_0xe7d530){return function(_0x3ad7b2){if(_0x3ad7b2){return _0x3ad7b2[_0xb53f('0x22')](_0x18f770)[_0xb53f('0x23')](function(_0x42cf55){return _0x42cf55;});}return null;};}function removeEntity(_0x52e178,_0x49f79b){return function(_0x70bc9a){if(_0x70bc9a){return _0x70bc9a[_0xb53f('0x24')]()[_0xb53f('0x23')](function(){var _0x3dd755=_0x70bc9a['get']({'plain':!![]});var _0x5db380='CannedAnswers';return db[_0xb53f('0x25')][_0xb53f('0x24')]({'where':{'type':_0x5db380,'resourceId':_0x3dd755['id']}})[_0xb53f('0x23')](function(){return _0x70bc9a;});})[_0xb53f('0x23')](function(){_0x52e178[_0xb53f('0x18')](0xcc)[_0xb53f('0x26')]();});}};}function handleEntityNotFound(_0x47497c,_0x4e1a11){return function(_0xe607c8){if(!_0xe607c8){_0x47497c[_0xb53f('0x27')](0x194);}return _0xe607c8;};}function handleError(_0x14be81,_0x5069a3){_0x5069a3=_0x5069a3||0x1f4;return function(_0x3c26d5){logger[_0xb53f('0x28')](_0x3c26d5[_0xb53f('0x29')]);if(_0x3c26d5['name']){delete _0x3c26d5[_0xb53f('0x2a')];}_0x14be81['status'](_0x5069a3)[_0xb53f('0x2b')](_0x3c26d5);};}exports[_0xb53f('0x2c')]=function(_0x538d4c,_0x5c0ba6){var _0x35bffe={},_0x18d851={},_0x38054d={'count':0x0,'rows':[]};var _0x5334cb=_[_0xb53f('0x2d')](db[_0xb53f('0x2e')][_0xb53f('0x2f')],function(_0x12060a){return{'name':_0x12060a['fieldName'],'type':_0x12060a[_0xb53f('0x30')][_0xb53f('0x31')]};});_0x18d851[_0xb53f('0x32')]=_[_0xb53f('0x2d')](_0x5334cb,_0xb53f('0x2a'));_0x18d851['query']=_[_0xb53f('0x33')](_0x538d4c[_0xb53f('0x34')]);_0x18d851[_0xb53f('0x35')]=_[_0xb53f('0x36')](_0x18d851['model'],_0x18d851[_0xb53f('0x34')]);_0x35bffe[_0xb53f('0x37')]=_[_0xb53f('0x36')](_0x18d851[_0xb53f('0x32')],qs[_0xb53f('0x38')](_0x538d4c['query'][_0xb53f('0x38')]));_0x35bffe[_0xb53f('0x37')]=_0x35bffe[_0xb53f('0x37')][_0xb53f('0x39')]?_0x35bffe[_0xb53f('0x37')]:_0x18d851[_0xb53f('0x32')];if(!_0x538d4c[_0xb53f('0x34')][_0xb53f('0x3a')](_0xb53f('0x3b'))){_0x35bffe[_0xb53f('0x1c')]=qs[_0xb53f('0x1c')](_0x538d4c[_0xb53f('0x34')][_0xb53f('0x1c')]);_0x35bffe[_0xb53f('0x1a')]=qs[_0xb53f('0x1a')](_0x538d4c[_0xb53f('0x34')][_0xb53f('0x1a')]);}_0x35bffe[_0xb53f('0x3c')]=qs[_0xb53f('0x3d')](_0x538d4c['query'][_0xb53f('0x3d')]);_0x35bffe['where']=qs[_0xb53f('0x35')](_['pick'](_0x538d4c[_0xb53f('0x34')],_0x18d851['filters']),_0x5334cb);if(_0x538d4c[_0xb53f('0x34')]['filter']){_0x35bffe[_0xb53f('0x3e')]=_['merge'](_0x35bffe[_0xb53f('0x3e')],{'$or':[{'key':{'$like':'%'+_0x538d4c[_0xb53f('0x34')][_0xb53f('0x3f')]+'%'}},{'value':{'$like':'%'+_0x538d4c[_0xb53f('0x34')][_0xb53f('0x3f')]+'%'}}]});}_0x35bffe=_[_0xb53f('0x40')]({},_0x35bffe,_0x538d4c[_0xb53f('0x41')]);var _0x11a5ea={'where':_0x35bffe['where']};return db['CannedAnswer']['count'](_0x11a5ea)[_0xb53f('0x23')](function(_0x3b7a1c){_0x38054d[_0xb53f('0x1d')]=_0x3b7a1c;if(_0x538d4c[_0xb53f('0x34')][_0xb53f('0x42')]){_0x35bffe['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x35bffe);})[_0xb53f('0x23')](function(_0x187fb1){_0x38054d[_0xb53f('0x43')]=_0x187fb1;return _0x38054d;})[_0xb53f('0x23')](respondWithFilteredResult(_0x5c0ba6,_0x35bffe))[_0xb53f('0x44')](handleError(_0x5c0ba6,null));};exports['show']=function(_0xfdd42a,_0x350965){var _0x1eaa50={'raw':!![],'where':{'id':_0xfdd42a[_0xb53f('0x45')]['id']}},_0x5a4925={};_0x5a4925[_0xb53f('0x32')]=_[_0xb53f('0x33')](db[_0xb53f('0x2e')]['rawAttributes']);_0x5a4925['query']=_['keys'](_0xfdd42a['query']);_0x5a4925['filters']=_[_0xb53f('0x36')](_0x5a4925['model'],_0x5a4925[_0xb53f('0x34')]);_0x1eaa50[_0xb53f('0x37')]=_[_0xb53f('0x36')](_0x5a4925[_0xb53f('0x32')],qs['fields'](_0xfdd42a[_0xb53f('0x34')][_0xb53f('0x38')]));_0x1eaa50[_0xb53f('0x37')]=_0x1eaa50['attributes'][_0xb53f('0x39')]?_0x1eaa50[_0xb53f('0x37')]:_0x5a4925[_0xb53f('0x32')];if(_0xfdd42a[_0xb53f('0x34')][_0xb53f('0x42')]){_0x1eaa50[_0xb53f('0x46')]=[{'all':!![]}];}_0x1eaa50=_[_0xb53f('0x40')]({},_0x1eaa50,_0xfdd42a[_0xb53f('0x41')]);return db[_0xb53f('0x2e')][_0xb53f('0x47')](_0x1eaa50)[_0xb53f('0x23')](handleEntityNotFound(_0x350965,null))['then'](respondWithResult(_0x350965,null))[_0xb53f('0x44')](handleError(_0x350965,null));};exports[_0xb53f('0x22')]=function(_0x309ef2,_0x3e0a1d){if(_0x309ef2['body']['id']){delete _0x309ef2[_0xb53f('0x48')]['id'];}return db[_0xb53f('0x2e')][_0xb53f('0x47')]({'where':{'id':_0x309ef2['params']['id']}})[_0xb53f('0x23')](handleEntityNotFound(_0x3e0a1d,null))[_0xb53f('0x23')](saveUpdates(_0x309ef2['body'],null))[_0xb53f('0x23')](respondWithResult(_0x3e0a1d,null))[_0xb53f('0x44')](handleError(_0x3e0a1d,null));};exports[_0xb53f('0x24')]=function(_0x4ac3f8,_0x4866c8){return db['CannedAnswer'][_0xb53f('0x47')]({'where':{'id':_0x4ac3f8['params']['id']}})[_0xb53f('0x23')](handleEntityNotFound(_0x4866c8,null))[_0xb53f('0x23')](removeEntity(_0x4866c8,null))[_0xb53f('0x44')](handleError(_0x4866c8,null));};exports[_0xb53f('0x49')]=function(_0x472b68,_0x2900c3){var _0x573258={'key':_0x472b68[_0xb53f('0x48')][_0xb53f('0x31')]};if(_0x472b68[_0xb53f('0x48')][_0xb53f('0x4a')]){_0x573258[_0xb53f('0x4a')]=_0x472b68[_0xb53f('0x48')][_0xb53f('0x4a')];}else if(_0x472b68[_0xb53f('0x48')][_0xb53f('0x4b')]){_0x573258[_0xb53f('0x4b')]=_0x472b68[_0xb53f('0x48')][_0xb53f('0x4b')];}else if(_0x472b68[_0xb53f('0x48')]['OpenchannelAccountId']){_0x573258['OpenchannelAccountId']=_0x472b68['body'][_0xb53f('0x4c')];}else if(_0x472b68[_0xb53f('0x48')][_0xb53f('0x4d')]){_0x573258[_0xb53f('0x4d')]=_0x472b68[_0xb53f('0x48')][_0xb53f('0x4d')];}return db[_0xb53f('0x2e')][_0xb53f('0x47')]({'where':_0x573258})['then'](function(_0x4498cc){if(_0x4498cc){throw new db[(_0xb53f('0x4e'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xb53f('0x2e')][_0xb53f('0x49')](_0x472b68[_0xb53f('0x48')]);})[_0xb53f('0x23')](function(_0x3b9033){var _0x37ca69=_0x472b68[_0xb53f('0x4f')][_0xb53f('0x50')]({'plain':!![]});if(!_0x37ca69)throw new Error(_0xb53f('0x51'));if(_0x37ca69['role']===_0xb53f('0x4f')){var _0x154701=_0x3b9033[_0xb53f('0x50')]({'plain':!![]});return db[_0xb53f('0x52')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x37ca69[_0xb53f('0x53')]},'raw':!![]})['then'](function(_0x5ec5bf){if(_0x5ec5bf&&_0x5ec5bf[_0xb53f('0x54')]===0x0){return db['UserProfileResource'][_0xb53f('0x49')]({'name':_0x154701[_0xb53f('0x2a')],'resourceId':_0x154701['id'],'type':_0x5ec5bf[_0xb53f('0x2a')],'sectionId':_0x5ec5bf['id']},{})['then'](function(){return _0x3b9033;});}else{return _0x3b9033;}})[_0xb53f('0x44')](function(_0x18f849){logger[_0xb53f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18f849);throw _0x18f849;});}return _0x3b9033;})['then'](respondWithResult(_0x2900c3,0xc9))[_0xb53f('0x44')](handleError(_0x2900c3,null));}; \ No newline at end of file +var _0xe139=['send','map','CannedAnswer','rawAttributes','fieldName','type','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','body','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','name'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0xe139,0x13b));var _0x9e13=function(_0x315fab,_0x14c15d){_0x315fab=_0x315fab-0x0;var _0x5eb800=_0xe139[_0x315fab];return _0x5eb800;};'use strict';var emlformat=require(_0x9e13('0x0'));var rimraf=require(_0x9e13('0x1'));var zipdir=require(_0x9e13('0x2'));var jsonpatch=require(_0x9e13('0x3'));var rp=require(_0x9e13('0x4'));var moment=require(_0x9e13('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9e13('0x6'));var util=require(_0x9e13('0x7'));var path=require(_0x9e13('0x8'));var sox=require('sox');var csv=require(_0x9e13('0x9'));var ejs=require(_0x9e13('0xa'));var fs=require('fs');var fs_extra=require(_0x9e13('0xb'));var _=require(_0x9e13('0xc'));var squel=require(_0x9e13('0xd'));var crypto=require(_0x9e13('0xe'));var jsforce=require(_0x9e13('0xf'));var deskjs=require(_0x9e13('0x10'));var toCsv=require(_0x9e13('0x9'));var querystring=require(_0x9e13('0x11'));var Papa=require(_0x9e13('0x12'));var Redis=require('ioredis');var authService=require(_0x9e13('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9e13('0x14'));var hardwareService=require(_0x9e13('0x15'));var logger=require(_0x9e13('0x16'))(_0x9e13('0x17'));var utils=require(_0x9e13('0x18'));var config=require(_0x9e13('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12c458,_0x4c11a7){_0x4c11a7=_0x4c11a7||0xcc;return function(_0x34fb57){if(_0x34fb57){return _0x12c458['sendStatus'](_0x4c11a7);}return _0x12c458[_0x9e13('0x1a')](_0x4c11a7)[_0x9e13('0x1b')]();};}function respondWithResult(_0x2e5a17,_0x5368ad){_0x5368ad=_0x5368ad||0xc8;return function(_0x17f7bb){if(_0x17f7bb){return _0x2e5a17[_0x9e13('0x1a')](_0x5368ad)[_0x9e13('0x1c')](_0x17f7bb);}};}function respondWithFilteredResult(_0x2741a3,_0x1fc8c2){return function(_0x44f3a8){if(_0x44f3a8){var _0xdcffc8=typeof _0x1fc8c2[_0x9e13('0x1d')]===_0x9e13('0x1e')&&typeof _0x1fc8c2[_0x9e13('0x1f')]===_0x9e13('0x1e');var _0x26a285=_0x44f3a8[_0x9e13('0x20')];var _0x140267=_0xdcffc8?0x0:_0x1fc8c2[_0x9e13('0x1d')];var _0x2b9783=_0xdcffc8?_0x44f3a8[_0x9e13('0x20')]:_0x1fc8c2[_0x9e13('0x1d')]+_0x1fc8c2[_0x9e13('0x1f')];var _0x3502cf;if(_0x2b9783>=_0x26a285){_0x2b9783=_0x26a285;_0x3502cf=0xc8;}else{_0x3502cf=0xce;}_0x2741a3[_0x9e13('0x1a')](_0x3502cf);return _0x2741a3[_0x9e13('0x21')](_0x9e13('0x22'),_0x140267+'-'+_0x2b9783+'/'+_0x26a285)['json'](_0x44f3a8);}return null;};}function patchUpdates(_0x3159e1){return function(_0x11e1b2){try{jsonpatch[_0x9e13('0x23')](_0x11e1b2,_0x3159e1,!![]);}catch(_0x2b757c){return BPromise['reject'](_0x2b757c);}return _0x11e1b2['save']();};}function saveUpdates(_0x4e04ba,_0x4b3dcf){return function(_0x144f42){if(_0x144f42){return _0x144f42[_0x9e13('0x24')](_0x4e04ba)[_0x9e13('0x25')](function(_0x19e6ea){return _0x19e6ea;});}return null;};}function removeEntity(_0x40e3ef,_0x346f69){return function(_0x2db7ce){if(_0x2db7ce){return _0x2db7ce[_0x9e13('0x26')]()['then'](function(){var _0x39560e=_0x2db7ce[_0x9e13('0x27')]({'plain':!![]});var _0x48ccd5=_0x9e13('0x28');return db[_0x9e13('0x29')][_0x9e13('0x26')]({'where':{'type':_0x48ccd5,'resourceId':_0x39560e['id']}})['then'](function(){return _0x2db7ce;});})['then'](function(){_0x40e3ef[_0x9e13('0x1a')](0xcc)[_0x9e13('0x1b')]();});}};}function handleEntityNotFound(_0x53469f,_0x570fbf){return function(_0x274502){if(!_0x274502){_0x53469f[_0x9e13('0x2a')](0x194);}return _0x274502;};}function handleError(_0x2804b5,_0x4ef664){_0x4ef664=_0x4ef664||0x1f4;return function(_0x3b1df2){logger[_0x9e13('0x2b')](_0x3b1df2['stack']);if(_0x3b1df2[_0x9e13('0x2c')]){delete _0x3b1df2[_0x9e13('0x2c')];}_0x2804b5[_0x9e13('0x1a')](_0x4ef664)[_0x9e13('0x2d')](_0x3b1df2);};}exports['index']=function(_0x41ad75,_0x2e2b19){var _0x3d25ab={},_0x298777={},_0x3a8394={'count':0x0,'rows':[]};var _0x2d893c=_[_0x9e13('0x2e')](db[_0x9e13('0x2f')][_0x9e13('0x30')],function(_0x3a48cb){return{'name':_0x3a48cb[_0x9e13('0x31')],'type':_0x3a48cb[_0x9e13('0x32')]['key']};});_0x298777['model']=_[_0x9e13('0x2e')](_0x2d893c,_0x9e13('0x2c'));_0x298777[_0x9e13('0x33')]=_['keys'](_0x41ad75['query']);_0x298777['filters']=_['intersection'](_0x298777[_0x9e13('0x34')],_0x298777[_0x9e13('0x33')]);_0x3d25ab['attributes']=_[_0x9e13('0x35')](_0x298777[_0x9e13('0x34')],qs['fields'](_0x41ad75[_0x9e13('0x33')][_0x9e13('0x36')]));_0x3d25ab[_0x9e13('0x37')]=_0x3d25ab['attributes']['length']?_0x3d25ab['attributes']:_0x298777['model'];if(!_0x41ad75[_0x9e13('0x33')][_0x9e13('0x38')](_0x9e13('0x39'))){_0x3d25ab[_0x9e13('0x1f')]=qs['limit'](_0x41ad75[_0x9e13('0x33')]['limit']);_0x3d25ab['offset']=qs[_0x9e13('0x1d')](_0x41ad75[_0x9e13('0x33')]['offset']);}_0x3d25ab[_0x9e13('0x3a')]=qs[_0x9e13('0x3b')](_0x41ad75['query'][_0x9e13('0x3b')]);_0x3d25ab[_0x9e13('0x3c')]=qs[_0x9e13('0x3d')](_[_0x9e13('0x3e')](_0x41ad75[_0x9e13('0x33')],_0x298777[_0x9e13('0x3d')]),_0x2d893c);if(_0x41ad75[_0x9e13('0x33')][_0x9e13('0x3f')]){_0x3d25ab[_0x9e13('0x3c')]=_[_0x9e13('0x40')](_0x3d25ab[_0x9e13('0x3c')],{'$or':[{'key':{'$like':'%'+_0x41ad75[_0x9e13('0x33')][_0x9e13('0x3f')]+'%'}},{'value':{'$like':'%'+_0x41ad75[_0x9e13('0x33')][_0x9e13('0x3f')]+'%'}}]});}_0x3d25ab=_[_0x9e13('0x40')]({},_0x3d25ab,_0x41ad75[_0x9e13('0x41')]);var _0x20834a={'where':_0x3d25ab[_0x9e13('0x3c')]};return db[_0x9e13('0x2f')][_0x9e13('0x20')](_0x20834a)[_0x9e13('0x25')](function(_0x5283cf){_0x3a8394[_0x9e13('0x20')]=_0x5283cf;if(_0x41ad75[_0x9e13('0x33')][_0x9e13('0x42')]){_0x3d25ab[_0x9e13('0x43')]=[{'all':!![]}];}return db[_0x9e13('0x2f')][_0x9e13('0x44')](_0x3d25ab);})['then'](function(_0x516219){_0x3a8394[_0x9e13('0x45')]=_0x516219;return _0x3a8394;})[_0x9e13('0x25')](respondWithFilteredResult(_0x2e2b19,_0x3d25ab))[_0x9e13('0x46')](handleError(_0x2e2b19,null));};exports[_0x9e13('0x47')]=function(_0x557881,_0x443567){var _0x58bb36={'raw':!![],'where':{'id':_0x557881['params']['id']}},_0x4e4a22={};_0x4e4a22['model']=_[_0x9e13('0x48')](db[_0x9e13('0x2f')][_0x9e13('0x30')]);_0x4e4a22[_0x9e13('0x33')]=_[_0x9e13('0x48')](_0x557881['query']);_0x4e4a22['filters']=_[_0x9e13('0x35')](_0x4e4a22[_0x9e13('0x34')],_0x4e4a22[_0x9e13('0x33')]);_0x58bb36['attributes']=_['intersection'](_0x4e4a22[_0x9e13('0x34')],qs[_0x9e13('0x36')](_0x557881['query'][_0x9e13('0x36')]));_0x58bb36['attributes']=_0x58bb36[_0x9e13('0x37')][_0x9e13('0x49')]?_0x58bb36[_0x9e13('0x37')]:_0x4e4a22[_0x9e13('0x34')];if(_0x557881[_0x9e13('0x33')][_0x9e13('0x42')]){_0x58bb36[_0x9e13('0x43')]=[{'all':!![]}];}_0x58bb36=_['merge']({},_0x58bb36,_0x557881[_0x9e13('0x41')]);return db['CannedAnswer'][_0x9e13('0x4a')](_0x58bb36)[_0x9e13('0x25')](handleEntityNotFound(_0x443567,null))['then'](respondWithResult(_0x443567,null))[_0x9e13('0x46')](handleError(_0x443567,null));};exports[_0x9e13('0x24')]=function(_0x11bd34,_0x57a5e5){if(_0x11bd34[_0x9e13('0x4b')]['id']){delete _0x11bd34[_0x9e13('0x4b')]['id'];}return db['CannedAnswer'][_0x9e13('0x4a')]({'where':{'id':_0x11bd34[_0x9e13('0x4c')]['id']}})[_0x9e13('0x25')](handleEntityNotFound(_0x57a5e5,null))[_0x9e13('0x25')](saveUpdates(_0x11bd34['body'],null))[_0x9e13('0x25')](respondWithResult(_0x57a5e5,null))[_0x9e13('0x46')](handleError(_0x57a5e5,null));};exports[_0x9e13('0x26')]=function(_0x229c0c,_0x591487){return db[_0x9e13('0x2f')][_0x9e13('0x4a')]({'where':{'id':_0x229c0c[_0x9e13('0x4c')]['id']}})[_0x9e13('0x25')](handleEntityNotFound(_0x591487,null))['then'](removeEntity(_0x591487,null))[_0x9e13('0x46')](handleError(_0x591487,null));};exports[_0x9e13('0x4d')]=function(_0x360d77,_0x81a54b){var _0x532779={'key':_0x360d77[_0x9e13('0x4b')][_0x9e13('0x4e')]};if(_0x360d77['body'][_0x9e13('0x4f')]){_0x532779[_0x9e13('0x4f')]=_0x360d77[_0x9e13('0x4b')][_0x9e13('0x4f')];}else if(_0x360d77['body'][_0x9e13('0x50')]){_0x532779[_0x9e13('0x50')]=_0x360d77[_0x9e13('0x4b')][_0x9e13('0x50')];}else if(_0x360d77[_0x9e13('0x4b')][_0x9e13('0x51')]){_0x532779[_0x9e13('0x51')]=_0x360d77[_0x9e13('0x4b')]['OpenchannelAccountId'];}else if(_0x360d77['body']['ChatWebsiteId']){_0x532779['ChatWebsiteId']=_0x360d77['body']['ChatWebsiteId'];}return db[_0x9e13('0x2f')][_0x9e13('0x4a')]({'where':_0x532779})[_0x9e13('0x25')](function(_0x1a381d){if(_0x1a381d){throw new db[(_0x9e13('0x52'))][(_0x9e13('0x53'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x9e13('0x2f')][_0x9e13('0x4d')](_0x360d77[_0x9e13('0x4b')]);})[_0x9e13('0x25')](function(_0x58d188){var _0x2e0fec=_0x360d77[_0x9e13('0x54')][_0x9e13('0x27')]({'plain':!![]});if(!_0x2e0fec)throw new Error(_0x9e13('0x55'));if(_0x2e0fec[_0x9e13('0x56')]===_0x9e13('0x54')){var _0x180ee9=_0x58d188[_0x9e13('0x27')]({'plain':!![]});return db[_0x9e13('0x57')]['find']({'where':{'name':_0x9e13('0x28'),'userProfileId':_0x2e0fec[_0x9e13('0x58')]},'raw':!![]})[_0x9e13('0x25')](function(_0x2edd28){if(_0x2edd28&&_0x2edd28[_0x9e13('0x59')]===0x0){return db['UserProfileResource'][_0x9e13('0x4d')]({'name':_0x180ee9[_0x9e13('0x2c')],'resourceId':_0x180ee9['id'],'type':_0x2edd28[_0x9e13('0x2c')],'sectionId':_0x2edd28['id']},{})[_0x9e13('0x25')](function(){return _0x58d188;});}else{return _0x58d188;}})[_0x9e13('0x46')](function(_0x1e15e8){logger[_0x9e13('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e15e8);throw _0x1e15e8;});}return _0x58d188;})[_0x9e13('0x25')](respondWithResult(_0x81a54b,0xc9))['catch'](handleError(_0x81a54b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0ddc652..2e9146e 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 _0xdfe9=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xdfe9,0x6a));var _0x9dfe=function(_0x4986cf,_0x25005d){_0x4986cf=_0x4986cf-0x0;var _0x41afef=_0xdfe9[_0x4986cf];return _0x41afef;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var logger=require(_0x9dfe('0x1'))(_0x9dfe('0x2'));var moment=require(_0x9dfe('0x3'));var BPromise=require(_0x9dfe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dfe('0x5'));var rimraf=require(_0x9dfe('0x6'));var config=require(_0x9dfe('0x7'));var attributes=require(_0x9dfe('0x8'));module[_0x9dfe('0x9')]=function(_0x23fa00,_0x2130ac){return _0x23fa00['define'](_0x9dfe('0xa'),attributes,{'tableName':_0x9dfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9dfe('0xc'),'collate':_0x9dfe('0xd')});}; \ No newline at end of file +var _0x2dd1=['./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x446f48,_0x22f9ac){var _0x5ef460=function(_0x4a9b80){while(--_0x4a9b80){_0x446f48['push'](_0x446f48['shift']());}};_0x5ef460(++_0x22f9ac);}(_0x2dd1,0x18c));var _0x12dd=function(_0xe011f8,_0x5b7d7b){_0xe011f8=_0xe011f8-0x0;var _0xe95964=_0x2dd1[_0xe011f8];return _0xe95964;};'use strict';var _=require(_0x12dd('0x0'));var util=require(_0x12dd('0x1'));var logger=require(_0x12dd('0x2'))(_0x12dd('0x3'));var moment=require(_0x12dd('0x4'));var BPromise=require(_0x12dd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12dd('0x6'));var rimraf=require(_0x12dd('0x7'));var config=require(_0x12dd('0x8'));var attributes=require(_0x12dd('0x9'));module[_0x12dd('0xa')]=function(_0x42f4a0,_0x5bcb6e){return _0x42f4a0[_0x12dd('0xb')](_0x12dd('0xc'),attributes,{'tableName':_0x12dd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12dd('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 782d849..2f4cc69 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(_0x5b214a,_0x4833fc){var _0x44ec2d=function(_0x4e823b){while(--_0x4e823b){_0x5b214a['push'](_0x5b214a['shift']());}};_0x44ec2d(++_0x4833fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x2569b0,_0x59c064){var _0x336a0b=function(_0x4727e7){while(--_0x4727e7){_0x2569b0['push'](_0x2569b0['shift']());}};_0x336a0b(++_0x59c064);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 171fb35..96707ef 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 _0x0f82=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','express','Router'];(function(_0x52a505,_0x5dec98){var _0x1fc95e=function(_0xdc7744){while(--_0xdc7744){_0x52a505['push'](_0x52a505['shift']());}};_0x1fc95e(++_0x5dec98);}(_0x0f82,0x16e));var _0x20f8=function(_0xf34bcf,_0x41d6be){_0xf34bcf=_0xf34bcf-0x0;var _0x2b733b=_0x0f82[_0xf34bcf];return _0x2b733b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x20f8('0x0'));var router=express[_0x20f8('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x20f8('0x2'));var interaction=require(_0x20f8('0x3'));var config=require(_0x20f8('0x4'));var controller=require(_0x20f8('0x5'));router[_0x20f8('0x6')]('/',auth[_0x20f8('0x7')](),controller[_0x20f8('0x8')]);router[_0x20f8('0x6')](_0x20f8('0x9'),auth[_0x20f8('0x7')](),controller[_0x20f8('0xa')]);router[_0x20f8('0xb')]('/',auth[_0x20f8('0x7')](),controller[_0x20f8('0xc')]);router[_0x20f8('0xd')](_0x20f8('0x9'),auth[_0x20f8('0x7')](),controller[_0x20f8('0xe')]);router['delete']('/:id',auth[_0x20f8('0x7')](),controller['destroy']);module[_0x20f8('0xf')]=router; \ No newline at end of file +var _0x6296=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./cannedAnswer.controller','index','get','post','isAuthenticated','create','put','/:id'];(function(_0x981f03,_0x4644dc){var _0x5af90a=function(_0x2196cb){while(--_0x2196cb){_0x981f03['push'](_0x981f03['shift']());}};_0x5af90a(++_0x4644dc);}(_0x6296,0xff));var _0x6629=function(_0x359894,_0x985b16){_0x359894=_0x359894-0x0;var _0x35b794=_0x6296[_0x359894];return _0x35b794;};'use strict';var multer=require(_0x6629('0x0'));var util=require(_0x6629('0x1'));var path=require(_0x6629('0x2'));var timeout=require(_0x6629('0x3'));var express=require('express');var router=express[_0x6629('0x4')]();var fs_extra=require(_0x6629('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6629('0x6'));var config=require('../../config/environment');var controller=require(_0x6629('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6629('0x8')]);router[_0x6629('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6629('0xa')]('/',auth[_0x6629('0xb')](),controller[_0x6629('0xc')]);router[_0x6629('0xd')](_0x6629('0xe'),auth[_0x6629('0xb')](),controller[_0x6629('0xf')]);router['delete'](_0x6629('0xe'),auth[_0x6629('0xb')](),controller[_0x6629('0x10')]);module[_0x6629('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 27af811..92b6ffd 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 _0x115a=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x17b913,_0x599f34){var _0x432717=function(_0x336292){while(--_0x336292){_0x17b913['push'](_0x17b913['shift']());}};_0x432717(++_0x599f34);}(_0x115a,0x91));var _0xa115=function(_0x5c9bec,_0x132415){_0x5c9bec=_0x5c9bec-0x0;var _0x401a6b=_0x115a[_0x5c9bec];return _0x401a6b;};'use strict';var Sequelize=require(_0xa115('0x0'));module[_0xa115('0x1')]={'calldate':{'type':Sequelize[_0xa115('0x2')],'allowNull':![],'defaultValue':_0xa115('0x3')},'clid':{'type':Sequelize[_0xa115('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xa115('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa115('0x4')]},'dstchannel':{'type':Sequelize[_0xa115('0x4')]},'lastapp':{'type':Sequelize[_0xa115('0x4')]},'lastdata':{'type':Sequelize[_0xa115('0x4')]},'duration':{'type':Sequelize[_0xa115('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa115('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xa115('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa115('0x4')]},'userfield':{'type':Sequelize[_0xa115('0x4')]},'uniqueid':{'type':Sequelize[_0xa115('0x4')]},'linkedid':{'type':Sequelize[_0xa115('0x4')]},'sequence':{'type':Sequelize[_0xa115('0x4')]},'peeraccount':{'type':Sequelize[_0xa115('0x4')]},'type':{'type':Sequelize[_0xa115('0x4')]},'tag':{'type':Sequelize[_0xa115('0x4')]}}; \ No newline at end of file +var _0x7ec2=['DATE','STRING','INTEGER','sequelize','exports'];(function(_0x516309,_0x35a3ae){var _0x5a3abc=function(_0x4b5638){while(--_0x4b5638){_0x516309['push'](_0x516309['shift']());}};_0x5a3abc(++_0x35a3ae);}(_0x7ec2,0x15c));var _0x27ec=function(_0x4edc20,_0x4dffde){_0x4edc20=_0x4edc20-0x0;var _0xdd5847=_0x7ec2[_0x4edc20];return _0xdd5847;};'use strict';var Sequelize=require(_0x27ec('0x0'));module[_0x27ec('0x1')]={'calldate':{'type':Sequelize[_0x27ec('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x27ec('0x3')]},'src':{'type':Sequelize[_0x27ec('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x27ec('0x3')]},'channel':{'type':Sequelize[_0x27ec('0x3')]},'dstchannel':{'type':Sequelize[_0x27ec('0x3')]},'lastapp':{'type':Sequelize[_0x27ec('0x3')]},'lastdata':{'type':Sequelize[_0x27ec('0x3')]},'duration':{'type':Sequelize[_0x27ec('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x27ec('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x27ec('0x3')]},'amaflags':{'type':Sequelize[_0x27ec('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x27ec('0x3')]},'userfield':{'type':Sequelize[_0x27ec('0x3')]},'uniqueid':{'type':Sequelize[_0x27ec('0x3')]},'linkedid':{'type':Sequelize[_0x27ec('0x3')]},'sequence':{'type':Sequelize[_0x27ec('0x3')]},'peeraccount':{'type':Sequelize[_0x27ec('0x3')]},'type':{'type':Sequelize[_0x27ec('0x3')]},'tag':{'type':Sequelize[_0x27ec('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index a8c812b..3f11040 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 _0xbeea=['stack','name','index','map','Cdr','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','save','update','destroy','then','sendStatus'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0xbeea,0xb1));var _0xabee=function(_0x4459df,_0x536b55){_0x4459df=_0x4459df-0x0;var _0xb7e0f2=_0xbeea[_0x4459df];return _0xb7e0f2;};'use strict';var emlformat=require(_0xabee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabee('0x1'));var jsonpatch=require(_0xabee('0x2'));var rp=require(_0xabee('0x3'));var moment=require('moment');var BPromise=require(_0xabee('0x4'));var Mustache=require('mustache');var util=require(_0xabee('0x5'));var path=require(_0xabee('0x6'));var sox=require(_0xabee('0x7'));var csv=require(_0xabee('0x8'));var ejs=require(_0xabee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xabee('0xa'));var crypto=require(_0xabee('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xabee('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabee('0xd'));var Papa=require(_0xabee('0xe'));var Redis=require(_0xabee('0xf'));var authService=require(_0xabee('0x10'));var qs=require(_0xabee('0x11'));var as=require(_0xabee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabee('0x13'))(_0xabee('0x14'));var utils=require(_0xabee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabee('0x16'));var db=require(_0xabee('0x17'))['db'];function respondWithStatusCode(_0x16d6a5,_0x49fb73){_0x49fb73=_0x49fb73||0xcc;return function(_0x5915a1){if(_0x5915a1){return _0x16d6a5['sendStatus'](_0x49fb73);}return _0x16d6a5['status'](_0x49fb73)['end']();};}function respondWithResult(_0x113c5c,_0x370a4e){_0x370a4e=_0x370a4e||0xc8;return function(_0x38ba29){if(_0x38ba29){return _0x113c5c[_0xabee('0x18')](_0x370a4e)[_0xabee('0x19')](_0x38ba29);}};}function respondWithFilteredResult(_0x5e94ff,_0x177670){return function(_0x2d85a4){if(_0x2d85a4){var _0x2f1107=typeof _0x177670[_0xabee('0x1a')]===_0xabee('0x1b')&&typeof _0x177670[_0xabee('0x1c')]===_0xabee('0x1b');var _0x5a9562=_0x2d85a4[_0xabee('0x1d')];var _0x112bb9=_0x2f1107?0x0:_0x177670[_0xabee('0x1a')];var _0x471b24=_0x2f1107?_0x2d85a4[_0xabee('0x1d')]:_0x177670[_0xabee('0x1a')]+_0x177670['limit'];var _0x47fa3f;if(_0x471b24>=_0x5a9562){_0x471b24=_0x5a9562;_0x47fa3f=0xc8;}else{_0x47fa3f=0xce;}_0x5e94ff[_0xabee('0x18')](_0x47fa3f);return _0x5e94ff['set']('Content-Range',_0x112bb9+'-'+_0x471b24+'/'+_0x5a9562)[_0xabee('0x19')](_0x2d85a4);}return null;};}function patchUpdates(_0x443301){return function(_0x3dd1ff){try{jsonpatch[_0xabee('0x1e')](_0x3dd1ff,_0x443301,!![]);}catch(_0x2b66f5){return BPromise['reject'](_0x2b66f5);}return _0x3dd1ff[_0xabee('0x1f')]();};}function saveUpdates(_0x54014d,_0x4f5501){return function(_0x4926d7){if(_0x4926d7){return _0x4926d7[_0xabee('0x20')](_0x54014d)['then'](function(_0x870569){return _0x870569;});}return null;};}function removeEntity(_0x2834e3,_0x520bc){return function(_0x15a36c){if(_0x15a36c){return _0x15a36c[_0xabee('0x21')]()[_0xabee('0x22')](function(){_0x2834e3[_0xabee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdbbf57,_0xfc419d){return function(_0x42277e){if(!_0x42277e){_0xdbbf57[_0xabee('0x23')](0x194);}return _0x42277e;};}function handleError(_0x4ae65e,_0x2aa470){_0x2aa470=_0x2aa470||0x1f4;return function(_0x123d58){logger['error'](_0x123d58[_0xabee('0x24')]);if(_0x123d58[_0xabee('0x25')]){delete _0x123d58[_0xabee('0x25')];}_0x4ae65e[_0xabee('0x18')](_0x2aa470)['send'](_0x123d58);};}exports[_0xabee('0x26')]=function(_0x2b7464,_0x1b5aee){var _0x37e780={},_0x1c4f51={},_0x116e41={'count':0x0,'rows':[]};var _0x3df00d=_[_0xabee('0x27')](db[_0xabee('0x28')]['rawAttributes'],function(_0x2a2441){return{'name':_0x2a2441['fieldName'],'type':_0x2a2441[_0xabee('0x29')][_0xabee('0x2a')]};});_0x1c4f51[_0xabee('0x2b')]=_[_0xabee('0x27')](_0x3df00d,'name');_0x1c4f51[_0xabee('0x2c')]=_['keys'](_0x2b7464[_0xabee('0x2c')]);_0x1c4f51['filters']=_[_0xabee('0x2d')](_0x1c4f51['model'],_0x1c4f51['query']);_0x37e780[_0xabee('0x2e')]=_[_0xabee('0x2d')](_0x1c4f51[_0xabee('0x2b')],qs[_0xabee('0x2f')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x2f')]));_0x37e780[_0xabee('0x2e')]=_0x37e780[_0xabee('0x2e')]['length']?_0x37e780[_0xabee('0x2e')]:_0x1c4f51[_0xabee('0x2b')];if(!_0x2b7464[_0xabee('0x2c')][_0xabee('0x30')](_0xabee('0x31'))){_0x37e780[_0xabee('0x1c')]=qs[_0xabee('0x1c')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x1c')]);_0x37e780[_0xabee('0x1a')]=qs[_0xabee('0x1a')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x1a')]);}_0x37e780[_0xabee('0x32')]=qs[_0xabee('0x33')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x33')]);_0x37e780['where']=qs['filters'](_[_0xabee('0x34')](_0x2b7464[_0xabee('0x2c')],_0x1c4f51[_0xabee('0x35')]),_0x3df00d);if(_0x2b7464[_0xabee('0x2c')]['filter']){_0x37e780[_0xabee('0x36')]=_[_0xabee('0x37')](_0x37e780[_0xabee('0x36')],{'$or':_['map'](_0x3df00d,function(_0x1a48d5){if(_0x1a48d5['type']!==_0xabee('0x38')){var _0x879d31={};_0x879d31[_0x1a48d5[_0xabee('0x25')]]={'$like':'%'+_0x2b7464[_0xabee('0x2c')]['filter']+'%'};return _0x879d31;}})});}_0x37e780=_['merge']({},_0x37e780,_0x2b7464[_0xabee('0x39')]);var _0xb76b1d={'where':_0x37e780[_0xabee('0x36')]};return db[_0xabee('0x28')][_0xabee('0x1d')](_0xb76b1d)['then'](function(_0x229b00){_0x116e41[_0xabee('0x1d')]=_0x229b00;if(_0x2b7464['query'][_0xabee('0x3a')]){_0x37e780[_0xabee('0x3b')]=[{'all':!![]}];}return db['Cdr'][_0xabee('0x3c')](_0x37e780);})[_0xabee('0x22')](function(_0x3f05ee){_0x116e41[_0xabee('0x3d')]=_0x3f05ee;return _0x116e41;})[_0xabee('0x22')](respondWithFilteredResult(_0x1b5aee,_0x37e780))[_0xabee('0x3e')](handleError(_0x1b5aee,null));};exports[_0xabee('0x3f')]=function(_0x4ee7e6,_0x36fc07){var _0x22fc91={'raw':!![],'where':{'id':_0x4ee7e6['params']['id']}},_0x206350={};_0x206350[_0xabee('0x2b')]=_[_0xabee('0x40')](db['Cdr'][_0xabee('0x41')]);_0x206350[_0xabee('0x2c')]=_['keys'](_0x4ee7e6[_0xabee('0x2c')]);_0x206350[_0xabee('0x35')]=_[_0xabee('0x2d')](_0x206350[_0xabee('0x2b')],_0x206350[_0xabee('0x2c')]);_0x22fc91[_0xabee('0x2e')]=_[_0xabee('0x2d')](_0x206350['model'],qs[_0xabee('0x2f')](_0x4ee7e6[_0xabee('0x2c')][_0xabee('0x2f')]));_0x22fc91['attributes']=_0x22fc91[_0xabee('0x2e')][_0xabee('0x42')]?_0x22fc91['attributes']:_0x206350['model'];if(_0x4ee7e6['query'][_0xabee('0x3a')]){_0x22fc91[_0xabee('0x3b')]=[{'all':!![]}];}_0x22fc91=_['merge']({},_0x22fc91,_0x4ee7e6['options']);return db[_0xabee('0x28')][_0xabee('0x43')](_0x22fc91)[_0xabee('0x22')](handleEntityNotFound(_0x36fc07,null))[_0xabee('0x22')](respondWithResult(_0x36fc07,null))[_0xabee('0x3e')](handleError(_0x36fc07,null));};exports[_0xabee('0x44')]=function(_0x430b08,_0x307d34){return db[_0xabee('0x28')][_0xabee('0x44')](_0x430b08[_0xabee('0x45')],{})[_0xabee('0x22')](respondWithResult(_0x307d34,0xc9))[_0xabee('0x3e')](handleError(_0x307d34,null));};exports[_0xabee('0x20')]=function(_0x3e277d,_0x252f60){if(_0x3e277d[_0xabee('0x45')]['id']){delete _0x3e277d[_0xabee('0x45')]['id'];}return db['Cdr'][_0xabee('0x43')]({'where':{'id':_0x3e277d[_0xabee('0x46')]['id']}})['then'](handleEntityNotFound(_0x252f60,null))['then'](saveUpdates(_0x3e277d[_0xabee('0x45')],null))[_0xabee('0x22')](respondWithResult(_0x252f60,null))[_0xabee('0x3e')](handleError(_0x252f60,null));};exports[_0xabee('0x21')]=function(_0xe2433f,_0x3d819a){return db[_0xabee('0x28')]['find']({'where':{'id':_0xe2433f[_0xabee('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d819a,null))[_0xabee('0x22')](removeEntity(_0x3d819a,null))[_0xabee('0x3e')](handleError(_0x3d819a,null));};exports['describe']=function(_0x3ebd50,_0x3aaf14){return db[_0xabee('0x28')]['describe']()[_0xabee('0x22')](respondWithResult(_0x3aaf14,null))['catch'](handleError(_0x3aaf14,null));}; \ No newline at end of file +var _0x814b=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','Cdr','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x28e3c9,_0x598e15){var _0x1eb84b=function(_0x2c38f4){while(--_0x2c38f4){_0x28e3c9['push'](_0x28e3c9['shift']());}};_0x1eb84b(++_0x598e15);}(_0x814b,0x1a2));var _0xb814=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0x814b[_0x115d5b];return _0x6cfc50;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['Cdr'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['create']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')](_0x338e80[_0xb814('0x49')],{})[_0xb814('0x28')](respondWithResult(_0x55234d,0xc9))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x2cc806,_0x45480e){if(_0x2cc806[_0xb814('0x49')]['id']){delete _0x2cc806[_0xb814('0x49')]['id'];}return db['Cdr']['find']({'where':{'id':_0x2cc806[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45480e,null))[_0xb814('0x28')](saveUpdates(_0x2cc806[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x45480e,null))[_0xb814('0x45')](handleError(_0x45480e,null));};exports[_0xb814('0x29')]=function(_0x4a4f9a,_0x26fd0b){return db[_0xb814('0x41')][_0xb814('0x47')]({'where':{'id':_0x4a4f9a['params']['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x26fd0b,null))['then'](removeEntity(_0x26fd0b,null))[_0xb814('0x45')](handleError(_0x26fd0b,null));};exports['describe']=function(_0x403872,_0x3cf8f8){return db['Cdr'][_0xb814('0x4a')]()[_0xb814('0x28')](respondWithResult(_0x3cf8f8,null))[_0xb814('0x45')](handleError(_0x3cf8f8,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ca5b536..c78b7c1 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1dd7eb,_0x13b76a){var _0x3e6f1b=function(_0x2b5079){while(--_0x2b5079){_0x1dd7eb['push'](_0x1dd7eb['shift']());}};_0x3e6f1b(++_0x13b76a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x270e1a,_0x2fd54c){var _0x389968=function(_0x9ef776){while(--_0x9ef776){_0x270e1a['push'](_0x270e1a['shift']());}};_0x389968(++_0x2fd54c);}(_0x7a54,0x106));var _0x47a5=function(_0x5465f3,_0x3c8f6a){_0x5465f3=_0x5465f3-0x0;var _0x2f959c=_0x7a54[_0x5465f3];return _0x2f959c;};'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 824f198..ab39463 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 _0x9a7e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9a7e,0x121));var _0xe9a7=function(_0x44c57e,_0xc00d2f){_0x44c57e=_0x44c57e-0x0;var _0x44d5aa=_0x9a7e[_0x44c57e];return _0x44d5aa;};'use strict';var _=require(_0xe9a7('0x0'));var util=require(_0xe9a7('0x1'));var moment=require(_0xe9a7('0x2'));var BPromise=require(_0xe9a7('0x3'));var rs=require(_0xe9a7('0x4'));var fs=require('fs');var Redis=require(_0xe9a7('0x5'));var db=require(_0xe9a7('0x6'))['db'];var utils=require(_0xe9a7('0x7'));var logger=require(_0xe9a7('0x8'))(_0xe9a7('0x9'));var config=require(_0xe9a7('0xa'));var jayson=require(_0xe9a7('0xb'));var client=jayson['client'][_0xe9a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3793c9,_0xfcd3b9,_0x46068b){return new BPromise(function(_0x3361cc,_0x26ee89){return client[_0xe9a7('0xd')](_0x3793c9,_0x46068b)[_0xe9a7('0xe')](function(_0xfbf10a){logger[_0xe9a7('0xf')](_0xe9a7('0x10'),_0xfcd3b9,_0xe9a7('0x11'));logger[_0xe9a7('0x12')]('Cdr,\x20%s,\x20%s,\x20%s',_0xfcd3b9,_0xe9a7('0x11'),JSON[_0xe9a7('0x13')](_0xfbf10a));if(_0xfbf10a[_0xe9a7('0x14')]){if(_0xfbf10a['error']['code']===0x1f4){logger['error'](_0xe9a7('0x10'),_0xfcd3b9,_0xfbf10a[_0xe9a7('0x14')][_0xe9a7('0x15')]);return _0x26ee89(_0xfbf10a[_0xe9a7('0x14')]['message']);}logger[_0xe9a7('0x14')](_0xe9a7('0x10'),_0xfcd3b9,_0xfbf10a[_0xe9a7('0x14')]['message']);return _0x3361cc(_0xfbf10a[_0xe9a7('0x14')][_0xe9a7('0x15')]);}else{logger['info'](_0xe9a7('0x10'),_0xfcd3b9,_0xe9a7('0x11'));_0x3361cc(_0xfbf10a[_0xe9a7('0x16')][_0xe9a7('0x15')]);}})[_0xe9a7('0x17')](function(_0x513c46){logger[_0xe9a7('0x14')](_0xe9a7('0x10'),_0xfcd3b9,_0x513c46);_0x26ee89(_0x513c46);});});} \ No newline at end of file +var _0x8a8f=['error','code','Cdr,\x20%s,\x20%s','request\x20sent','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x8a8f,0xc2));var _0xf8a8=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x8a8f[_0x580647];return _0x5f0792;};'use strict';var _=require(_0xf8a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf8a8('0x1'));var rs=require(_0xf8a8('0x2'));var fs=require('fs');var Redis=require(_0xf8a8('0x3'));var db=require(_0xf8a8('0x4'))['db'];var utils=require(_0xf8a8('0x5'));var logger=require(_0xf8a8('0x6'))('rpc');var config=require(_0xf8a8('0x7'));var jayson=require(_0xf8a8('0x8'));var client=jayson[_0xf8a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440236,_0x1729ec,_0x5d106a){return new BPromise(function(_0x4760cd,_0xe058e6){return client[_0xf8a8('0xa')](_0x440236,_0x5d106a)[_0xf8a8('0xb')](function(_0x2e9116){logger[_0xf8a8('0xc')]('Cdr,\x20%s,\x20%s',_0x1729ec,'request\x20sent');logger[_0xf8a8('0xd')](_0xf8a8('0xe'),_0x1729ec,'request\x20sent',JSON[_0xf8a8('0xf')](_0x2e9116));if(_0x2e9116[_0xf8a8('0x10')]){if(_0x2e9116[_0xf8a8('0x10')][_0xf8a8('0x11')]===0x1f4){logger[_0xf8a8('0x10')](_0xf8a8('0x12'),_0x1729ec,_0x2e9116['error']['message']);return _0xe058e6(_0x2e9116[_0xf8a8('0x10')]['message']);}logger[_0xf8a8('0x10')](_0xf8a8('0x12'),_0x1729ec,_0x2e9116[_0xf8a8('0x10')]['message']);return _0x4760cd(_0x2e9116[_0xf8a8('0x10')]['message']);}else{logger[_0xf8a8('0xc')](_0xf8a8('0x12'),_0x1729ec,_0xf8a8('0x13'));_0x4760cd(_0x2e9116[_0xf8a8('0x14')]['message']);}})['catch'](function(_0x1c3eef){logger[_0xf8a8('0x10')](_0xf8a8('0x12'),_0x1729ec,_0x1c3eef);_0xe058e6(_0x1c3eef);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 25444b4..e9978a2 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4e41d0,_0x5e1e9c){var _0x338498=function(_0x47e31f){while(--_0x47e31f){_0x4e41d0['push'](_0x4e41d0['shift']());}};_0x338498(++_0x5e1e9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xb10b[_0x5cb1af];return _0x8d7940;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x33bf01,_0x1898f9){var _0x1d1cd2=function(_0x21dbc1){while(--_0x21dbc1){_0x33bf01['push'](_0x33bf01['shift']());}};_0x1d1cd2(++_0x1898f9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1b2220b..9d6c7b3 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 _0xdc06=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x168ad0,_0x45e98b){var _0x3596fc=function(_0x388510){while(--_0x388510){_0x168ad0['push'](_0x168ad0['shift']());}};_0x3596fc(++_0x45e98b);}(_0xdc06,0x112));var _0x6dc0=function(_0x19c1ca,_0x45d439){_0x19c1ca=_0x19c1ca-0x0;var _0x2c620f=_0xdc06[_0x19c1ca];return _0x2c620f;};'use strict';var Sequelize=require('sequelize');module[_0x6dc0('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6dc0('0x1')],'allowNull':![],'defaultValue':_0x6dc0('0x2')},'appdata':{'type':Sequelize[_0x6dc0('0x3')]()},'description':{'type':Sequelize[_0x6dc0('0x1')]},'interval':{'type':Sequelize[_0x6dc0('0x1')],'defaultValue':_0x6dc0('0x4')}}; \ No newline at end of file +var _0xe032=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x152aa1,_0x307718){var _0x1bc01a=function(_0xd3211e){while(--_0xd3211e){_0x152aa1['push'](_0x152aa1['shift']());}};_0x1bc01a(++_0x307718);}(_0xe032,0x6a));var _0x2e03=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0xe032[_0x214d54];return _0x44ca46;};'use strict';var Sequelize=require(_0x2e03('0x0'));module[_0x2e03('0x1')]={'priority':{'type':Sequelize[_0x2e03('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2e03('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2e03('0x4')]()},'description':{'type':Sequelize[_0x2e03('0x3')]},'interval':{'type':Sequelize[_0x2e03('0x3')],'defaultValue':_0x2e03('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 025cc91..b089d0b 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 _0x3f19=['send','show','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','includeAll','include','merge','options','find','then','body','params','catch','eml-format','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','stack','name'];(function(_0x21a188,_0x463d5f){var _0xa30c59=function(_0x3807c5){while(--_0x3807c5){_0x21a188['push'](_0x21a188['shift']());}};_0xa30c59(++_0x463d5f);}(_0x3f19,0xc0));var _0x93f1=function(_0x322652,_0x5a85c0){_0x322652=_0x322652-0x0;var _0x5d5e88=_0x3f19[_0x322652];return _0x5d5e88;};'use strict';var emlformat=require(_0x93f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x93f1('0x1'));var moment=require('moment');var BPromise=require(_0x93f1('0x2'));var Mustache=require(_0x93f1('0x3'));var util=require(_0x93f1('0x4'));var path=require(_0x93f1('0x5'));var sox=require('sox');var csv=require(_0x93f1('0x6'));var ejs=require(_0x93f1('0x7'));var fs=require('fs');var fs_extra=require(_0x93f1('0x8'));var _=require(_0x93f1('0x9'));var squel=require(_0x93f1('0xa'));var crypto=require(_0x93f1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x93f1('0xc'));var toCsv=require(_0x93f1('0x6'));var querystring=require(_0x93f1('0xd'));var Papa=require(_0x93f1('0xe'));var Redis=require(_0x93f1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x93f1('0x10'));var as=require(_0x93f1('0x11'));var hardwareService=require(_0x93f1('0x12'));var logger=require(_0x93f1('0x13'))(_0x93f1('0x14'));var utils=require(_0x93f1('0x15'));var config=require(_0x93f1('0x16'));var licenseUtil=require(_0x93f1('0x17'));var db=require(_0x93f1('0x18'))['db'];function respondWithStatusCode(_0x3348ab,_0x5b4aa3){_0x5b4aa3=_0x5b4aa3||0xcc;return function(_0x4080a8){if(_0x4080a8){return _0x3348ab[_0x93f1('0x19')](_0x5b4aa3);}return _0x3348ab[_0x93f1('0x1a')](_0x5b4aa3)[_0x93f1('0x1b')]();};}function respondWithResult(_0x552ae6,_0x391deb){_0x391deb=_0x391deb||0xc8;return function(_0x49f4c8){if(_0x49f4c8){return _0x552ae6[_0x93f1('0x1a')](_0x391deb)[_0x93f1('0x1c')](_0x49f4c8);}};}function respondWithFilteredResult(_0x176cf2,_0x43b0bc){return function(_0x120c83){if(_0x120c83){var _0x48e0a1=typeof _0x43b0bc[_0x93f1('0x1d')]===_0x93f1('0x1e')&&typeof _0x43b0bc[_0x93f1('0x1f')]===_0x93f1('0x1e');var _0x2ed400=_0x120c83[_0x93f1('0x20')];var _0xaed1b5=_0x48e0a1?0x0:_0x43b0bc[_0x93f1('0x1d')];var _0x15c213=_0x48e0a1?_0x120c83[_0x93f1('0x20')]:_0x43b0bc[_0x93f1('0x1d')]+_0x43b0bc['limit'];var _0x54880e;if(_0x15c213>=_0x2ed400){_0x15c213=_0x2ed400;_0x54880e=0xc8;}else{_0x54880e=0xce;}_0x176cf2['status'](_0x54880e);return _0x176cf2[_0x93f1('0x21')]('Content-Range',_0xaed1b5+'-'+_0x15c213+'/'+_0x2ed400)[_0x93f1('0x1c')](_0x120c83);}return null;};}function patchUpdates(_0x39ae13){return function(_0x3795b8){try{jsonpatch[_0x93f1('0x22')](_0x3795b8,_0x39ae13,!![]);}catch(_0x595943){return BPromise[_0x93f1('0x23')](_0x595943);}return _0x3795b8['save']();};}function saveUpdates(_0xe7cea3,_0x310e76){return function(_0x4b26bb){if(_0x4b26bb){return _0x4b26bb[_0x93f1('0x24')](_0xe7cea3)['then'](function(_0x578ccc){return _0x578ccc;});}return null;};}function removeEntity(_0x14313d,_0x2b2115){return function(_0x5c30a5){if(_0x5c30a5){return _0x5c30a5[_0x93f1('0x25')]()['then'](function(){_0x14313d[_0x93f1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5272ba,_0x2972cd){return function(_0x9ed8af){if(!_0x9ed8af){_0x5272ba[_0x93f1('0x19')](0x194);}return _0x9ed8af;};}function handleError(_0x46719c,_0x2e9444){_0x2e9444=_0x2e9444||0x1f4;return function(_0x3e8f2f){logger['error'](_0x3e8f2f[_0x93f1('0x26')]);if(_0x3e8f2f['name']){delete _0x3e8f2f[_0x93f1('0x27')];}_0x46719c[_0x93f1('0x1a')](_0x2e9444)[_0x93f1('0x28')](_0x3e8f2f);};}exports[_0x93f1('0x29')]=function(_0x29ec13,_0x27efcf){var _0x2e6661={'raw':!![],'where':{'id':_0x29ec13['params']['id']}},_0x35a2d5={};_0x35a2d5[_0x93f1('0x2a')]=_[_0x93f1('0x2b')](db[_0x93f1('0x2c')][_0x93f1('0x2d')]);_0x35a2d5['query']=_[_0x93f1('0x2b')](_0x29ec13[_0x93f1('0x2e')]);_0x35a2d5['filters']=_[_0x93f1('0x2f')](_0x35a2d5[_0x93f1('0x2a')],_0x35a2d5['query']);_0x2e6661['attributes']=_[_0x93f1('0x2f')](_0x35a2d5['model'],qs['fields'](_0x29ec13['query']['fields']));_0x2e6661[_0x93f1('0x30')]=_0x2e6661[_0x93f1('0x30')]['length']?_0x2e6661[_0x93f1('0x30')]:_0x35a2d5[_0x93f1('0x2a')];if(_0x29ec13[_0x93f1('0x2e')][_0x93f1('0x31')]){_0x2e6661[_0x93f1('0x32')]=[{'all':!![]}];}_0x2e6661=_[_0x93f1('0x33')]({},_0x2e6661,_0x29ec13[_0x93f1('0x34')]);return db[_0x93f1('0x2c')][_0x93f1('0x35')](_0x2e6661)[_0x93f1('0x36')](handleEntityNotFound(_0x27efcf,null))[_0x93f1('0x36')](respondWithResult(_0x27efcf,null))['catch'](handleError(_0x27efcf,null));};exports['update']=function(_0x35f23c,_0x22e526){if(_0x35f23c[_0x93f1('0x37')]['id']){delete _0x35f23c[_0x93f1('0x37')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x35f23c[_0x93f1('0x38')]['id']}})[_0x93f1('0x36')](handleEntityNotFound(_0x22e526,null))['then'](saveUpdates(_0x35f23c[_0x93f1('0x37')],null))[_0x93f1('0x36')](respondWithResult(_0x22e526,null))[_0x93f1('0x39')](handleError(_0x22e526,null));};exports[_0x93f1('0x25')]=function(_0x422336,_0xb5696e){return db[_0x93f1('0x2c')][_0x93f1('0x35')]({'where':{'id':_0x422336[_0x93f1('0x38')]['id']}})[_0x93f1('0x36')](handleEntityNotFound(_0xb5696e,null))['then'](removeEntity(_0xb5696e,null))['catch'](handleError(_0xb5696e,null));}; \ No newline at end of file +var _0xeb74=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x30cc4b,_0x2cf083){var _0x4f1539=function(_0x252045){while(--_0x252045){_0x30cc4b['push'](_0x30cc4b['shift']());}};_0x4f1539(++_0x2cf083);}(_0xeb74,0xe3));var _0x4eb7=function(_0x24699d,_0x59b9c9){_0x24699d=_0x24699d-0x0;var _0x579d4e=_0xeb74[_0x24699d];return _0x579d4e;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x27')]();});}};}function handleEntityNotFound(_0x3e0da2,_0x25eb74){return function(_0x365060){if(!_0x365060){_0x3e0da2[_0x4eb7('0x28')](0x194);}return _0x365060;};}function handleError(_0x80b804,_0x248759){_0x248759=_0x248759||0x1f4;return function(_0xf83c11){logger[_0x4eb7('0x29')](_0xf83c11[_0x4eb7('0x2a')]);if(_0xf83c11[_0x4eb7('0x2b')]){delete _0xf83c11[_0x4eb7('0x2b')];}_0x80b804[_0x4eb7('0x19')](_0x248759)[_0x4eb7('0x2c')](_0xf83c11);};}exports[_0x4eb7('0x2d')]=function(_0x33a2c1,_0x28fda8){var _0x114c68={'raw':!![],'where':{'id':_0x33a2c1[_0x4eb7('0x2e')]['id']}},_0x17030a={};_0x17030a['model']=_[_0x4eb7('0x2f')](db['ChatApplication'][_0x4eb7('0x30')]);_0x17030a[_0x4eb7('0x31')]=_[_0x4eb7('0x2f')](_0x33a2c1[_0x4eb7('0x31')]);_0x17030a[_0x4eb7('0x32')]=_[_0x4eb7('0x33')](_0x17030a[_0x4eb7('0x34')],_0x17030a[_0x4eb7('0x31')]);_0x114c68[_0x4eb7('0x35')]=_['intersection'](_0x17030a[_0x4eb7('0x34')],qs['fields'](_0x33a2c1[_0x4eb7('0x31')][_0x4eb7('0x36')]));_0x114c68['attributes']=_0x114c68['attributes'][_0x4eb7('0x37')]?_0x114c68[_0x4eb7('0x35')]:_0x17030a[_0x4eb7('0x34')];if(_0x33a2c1[_0x4eb7('0x31')]['includeAll']){_0x114c68[_0x4eb7('0x38')]=[{'all':!![]}];}_0x114c68=_[_0x4eb7('0x39')]({},_0x114c68,_0x33a2c1[_0x4eb7('0x3a')]);return db[_0x4eb7('0x3b')][_0x4eb7('0x3c')](_0x114c68)['then'](handleEntityNotFound(_0x28fda8,null))[_0x4eb7('0x25')](respondWithResult(_0x28fda8,null))[_0x4eb7('0x3d')](handleError(_0x28fda8,null));};exports[_0x4eb7('0x24')]=function(_0x59d70a,_0x115642){if(_0x59d70a[_0x4eb7('0x3e')]['id']){delete _0x59d70a[_0x4eb7('0x3e')]['id'];}return db['ChatApplication'][_0x4eb7('0x3c')]({'where':{'id':_0x59d70a['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x115642,null))[_0x4eb7('0x25')](saveUpdates(_0x59d70a[_0x4eb7('0x3e')],null))[_0x4eb7('0x25')](respondWithResult(_0x115642,null))['catch'](handleError(_0x115642,null));};exports[_0x4eb7('0x26')]=function(_0xfd2721,_0x9c44e9){return db[_0x4eb7('0x3b')]['find']({'where':{'id':_0xfd2721['params']['id']}})['then'](handleEntityNotFound(_0x9c44e9,null))[_0x4eb7('0x25')](removeEntity(_0x9c44e9,null))[_0x4eb7('0x3d')](handleError(_0x9c44e9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d409022..0c375f1 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 _0xbb7c=['ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x86c0ae,_0x402578){var _0x28bea5=function(_0x4359a2){while(--_0x4359a2){_0x86c0ae['push'](_0x86c0ae['shift']());}};_0x28bea5(++_0x402578);}(_0xbb7c,0x17a));var _0xcbb7=function(_0x3851a5,_0x5bd024){_0x3851a5=_0x3851a5-0x0;var _0x733106=_0xbb7c[_0x3851a5];return _0x733106;};'use strict';var _=require(_0xcbb7('0x0'));var util=require(_0xcbb7('0x1'));var logger=require(_0xcbb7('0x2'))(_0xcbb7('0x3'));var moment=require(_0xcbb7('0x4'));var BPromise=require(_0xcbb7('0x5'));var rp=require(_0xcbb7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbb7('0x7'));var config=require(_0xcbb7('0x8'));var attributes=require(_0xcbb7('0x9'));module[_0xcbb7('0xa')]=function(_0x397075,_0x3824f5){return _0x397075[_0xcbb7('0xb')](_0xcbb7('0xc'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcbb7('0xd'),'collate':_0xcbb7('0xe')});}; \ No newline at end of file +var _0xe4c7=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x238ce5,_0x36d4a4){var _0x5d6469=function(_0x206b98){while(--_0x206b98){_0x238ce5['push'](_0x238ce5['shift']());}};_0x5d6469(++_0x36d4a4);}(_0xe4c7,0x1d2));var _0x7e4c=function(_0x115f14,_0x1242e8){_0x115f14=_0x115f14-0x0;var _0x1785ee=_0xe4c7[_0x115f14];return _0x1785ee;};'use strict';var _=require(_0x7e4c('0x0'));var util=require(_0x7e4c('0x1'));var logger=require(_0x7e4c('0x2'))(_0x7e4c('0x3'));var moment=require(_0x7e4c('0x4'));var BPromise=require(_0x7e4c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e4c('0x6'));var rimraf=require(_0x7e4c('0x7'));var config=require(_0x7e4c('0x8'));var attributes=require('./chatApplication.attributes');module[_0x7e4c('0x9')]=function(_0x305963,_0x40b497){return _0x305963['define']('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e4c('0xa'),'collate':_0x7e4c('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d516fa1..e819123 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 _0x29ad=['info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x34bf85,_0x26b2f5){var _0x438e25=function(_0x1df525){while(--_0x1df525){_0x34bf85['push'](_0x34bf85['shift']());}};_0x438e25(++_0x26b2f5);}(_0x29ad,0x128));var _0xd29a=function(_0x133b08,_0x3a7aaf){_0x133b08=_0x133b08-0x0;var _0x967196=_0x29ad[_0x133b08];return _0x967196;};'use strict';var _=require(_0xd29a('0x0'));var util=require(_0xd29a('0x1'));var moment=require(_0xd29a('0x2'));var BPromise=require(_0xd29a('0x3'));var rs=require(_0xd29a('0x4'));var fs=require('fs');var Redis=require(_0xd29a('0x5'));var db=require(_0xd29a('0x6'))['db'];var utils=require(_0xd29a('0x7'));var logger=require(_0xd29a('0x8'))(_0xd29a('0x9'));var config=require(_0xd29a('0xa'));var jayson=require(_0xd29a('0xb'));var client=jayson[_0xd29a('0xc')][_0xd29a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5b4ee4,_0x31c9c2,_0x391e68){return new BPromise(function(_0x2bd10e,_0x3d9bc2){return client[_0xd29a('0xe')](_0x5b4ee4,_0x391e68)[_0xd29a('0xf')](function(_0x184538){logger[_0xd29a('0x10')]('ChatApplication,\x20%s,\x20%s',_0x31c9c2,_0xd29a('0x11'));logger[_0xd29a('0x12')](_0xd29a('0x13'),_0x31c9c2,_0xd29a('0x11'),JSON[_0xd29a('0x14')](_0x184538));if(_0x184538[_0xd29a('0x15')]){if(_0x184538['error']['code']===0x1f4){logger[_0xd29a('0x15')](_0xd29a('0x16'),_0x31c9c2,_0x184538[_0xd29a('0x15')]['message']);return _0x3d9bc2(_0x184538[_0xd29a('0x15')]['message']);}logger[_0xd29a('0x15')](_0xd29a('0x16'),_0x31c9c2,_0x184538[_0xd29a('0x15')][_0xd29a('0x17')]);return _0x2bd10e(_0x184538[_0xd29a('0x15')][_0xd29a('0x17')]);}else{logger[_0xd29a('0x10')](_0xd29a('0x16'),_0x31c9c2,_0xd29a('0x11'));_0x2bd10e(_0x184538[_0xd29a('0x18')][_0xd29a('0x17')]);}})[_0xd29a('0x19')](function(_0x26a163){logger[_0xd29a('0x15')]('ChatApplication,\x20%s,\x20%s',_0x31c9c2,_0x26a163);_0x3d9bc2(_0x26a163);});});} \ No newline at end of file +var _0x22fc=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x22fc,0x99));var _0xc22f=function(_0x4f6883,_0x5130fd){_0x4f6883=_0x4f6883-0x0;var _0x13dba6=_0x22fc[_0x4f6883];return _0x13dba6;};'use strict';var _=require(_0xc22f('0x0'));var util=require(_0xc22f('0x1'));var moment=require(_0xc22f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc22f('0x3'));var fs=require('fs');var Redis=require(_0xc22f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc22f('0x5'));var logger=require(_0xc22f('0x6'))('rpc');var config=require(_0xc22f('0x7'));var jayson=require(_0xc22f('0x8'));var client=jayson[_0xc22f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x367e52,_0x1dc7a4,_0x1faae9){return new BPromise(function(_0xe68a0b,_0x53581b){return client[_0xc22f('0xa')](_0x367e52,_0x1faae9)[_0xc22f('0xb')](function(_0x53cce8){logger[_0xc22f('0xc')](_0xc22f('0xd'),_0x1dc7a4,'request\x20sent');logger[_0xc22f('0xe')](_0xc22f('0xf'),_0x1dc7a4,_0xc22f('0x10'),JSON['stringify'](_0x53cce8));if(_0x53cce8[_0xc22f('0x11')]){if(_0x53cce8[_0xc22f('0x11')][_0xc22f('0x12')]===0x1f4){logger[_0xc22f('0x11')](_0xc22f('0xd'),_0x1dc7a4,_0x53cce8[_0xc22f('0x11')][_0xc22f('0x13')]);return _0x53581b(_0x53cce8[_0xc22f('0x11')][_0xc22f('0x13')]);}logger[_0xc22f('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1dc7a4,_0x53cce8[_0xc22f('0x11')][_0xc22f('0x13')]);return _0xe68a0b(_0x53cce8[_0xc22f('0x11')]['message']);}else{logger[_0xc22f('0xc')](_0xc22f('0xd'),_0x1dc7a4,_0xc22f('0x10'));_0xe68a0b(_0x53cce8[_0xc22f('0x14')]['message']);}})[_0xc22f('0x15')](function(_0x3e7810){logger['error'](_0xc22f('0xd'),_0x1dc7a4,_0x3e7810);_0x53581b(_0x3e7810);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0d55029..e0de3a9 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 _0xeb7d=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0xeb7d,0x158));var _0xdeb7=function(_0x1de94d,_0x30499c){_0x1de94d=_0x1de94d-0x0;var _0x507fed=_0xeb7d[_0x1de94d];return _0x507fed;};'use strict';var multer=require(_0xdeb7('0x0'));var util=require('util');var path=require(_0xdeb7('0x1'));var timeout=require(_0xdeb7('0x2'));var express=require(_0xdeb7('0x3'));var router=express[_0xdeb7('0x4')]();var fs_extra=require(_0xdeb7('0x5'));var auth=require(_0xdeb7('0x6'));var interaction=require(_0xdeb7('0x7'));var config=require(_0xdeb7('0x8'));var controller=require(_0xdeb7('0x9'));router[_0xdeb7('0xa')](_0xdeb7('0xb'),auth[_0xdeb7('0xc')](),controller[_0xdeb7('0xd')]);router[_0xdeb7('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xdeb7('0xf')]);router[_0xdeb7('0x10')]('/:id',auth[_0xdeb7('0xc')](),controller[_0xdeb7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x00e4=['/:id','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','isAuthenticated','show'];(function(_0x12094a,_0x36505c){var _0x24a900=function(_0x45e4ec){while(--_0x45e4ec){_0x12094a['push'](_0x12094a['shift']());}};_0x24a900(++_0x36505c);}(_0x00e4,0xbb));var _0x400e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x00e4[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x400e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x400e('0x1'));var router=express['Router']();var fs_extra=require(_0x400e('0x2'));var auth=require(_0x400e('0x3'));var interaction=require(_0x400e('0x4'));var config=require(_0x400e('0x5'));var controller=require(_0x400e('0x6'));router['get']('/:id',auth[_0x400e('0x7')](),controller[_0x400e('0x8')]);router['put'](_0x400e('0x9'),auth[_0x400e('0x7')](),controller[_0x400e('0xa')]);router[_0x400e('0xb')](_0x400e('0x9'),auth[_0x400e('0x7')](),controller[_0x400e('0xc')]);module[_0x400e('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 6a78488..d7a7181 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 _0xb101=['BOOLEAN','STRING'];(function(_0x3c7bf8,_0x1242a4){var _0x52eeb8=function(_0x24e1b1){while(--_0x24e1b1){_0x3c7bf8['push'](_0x3c7bf8['shift']());}};_0x52eeb8(++_0x1242a4);}(_0xb101,0x75));var _0x1b10=function(_0x1c778e,_0x30077a){_0x1c778e=_0x1c778e-0x0;var _0x54c6fd=_0xb101[_0x1c778e];return _0x54c6fd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1b10('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x1b10('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x67d1=['BOOLEAN','exports','STRING'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x67d1,0xf1));var _0x167d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x67d1[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module[_0x167d('0x0')]={'name':{'type':Sequelize[_0x167d('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x167d('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 3272694..a872d23 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 _0x3cd1=['catch','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','User','getMembers','nolimit','removeMembers','ChatGroupId','getMessages','findOne','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','end','json','offset','undefined','limit','count','status','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','findAll','show','params','keys','find','create','body'];(function(_0xfea32e,_0x4b012f){var _0x210cf3=function(_0x5848cb){while(--_0x5848cb){_0xfea32e['push'](_0xfea32e['shift']());}};_0x210cf3(++_0x4b012f);}(_0x3cd1,0x19a));var _0x13cd=function(_0x28b4ca,_0xd1069e){_0x28b4ca=_0x28b4ca-0x0;var _0x204e5b=_0x3cd1[_0x28b4ca];return _0x204e5b;};'use strict';var emlformat=require(_0x13cd('0x0'));var rimraf=require(_0x13cd('0x1'));var zipdir=require(_0x13cd('0x2'));var jsonpatch=require(_0x13cd('0x3'));var rp=require(_0x13cd('0x4'));var moment=require('moment');var BPromise=require(_0x13cd('0x5'));var Mustache=require(_0x13cd('0x6'));var util=require(_0x13cd('0x7'));var path=require('path');var sox=require(_0x13cd('0x8'));var csv=require('to-csv');var ejs=require(_0x13cd('0x9'));var fs=require('fs');var fs_extra=require(_0x13cd('0xa'));var _=require(_0x13cd('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x13cd('0xc'));var deskjs=require(_0x13cd('0xd'));var toCsv=require(_0x13cd('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x13cd('0xf'));var authService=require(_0x13cd('0x10'));var qs=require(_0x13cd('0x11'));var as=require(_0x13cd('0x12'));var hardwareService=require(_0x13cd('0x13'));var logger=require(_0x13cd('0x14'))(_0x13cd('0x15'));var utils=require(_0x13cd('0x16'));var config=require(_0x13cd('0x17'));var licenseUtil=require(_0x13cd('0x18'));var db=require(_0x13cd('0x19'))['db'];config[_0x13cd('0x1a')]=_[_0x13cd('0x1b')](config[_0x13cd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x13cd('0x1c'))(new Redis(config[_0x13cd('0x1a')]));require(_0x13cd('0x1d'))[_0x13cd('0x1e')](socket);function respondWithStatusCode(_0x207e88,_0x437359){_0x437359=_0x437359||0xcc;return function(_0x903a38){if(_0x903a38){return _0x207e88['sendStatus'](_0x437359);}return _0x207e88['status'](_0x437359)[_0x13cd('0x1f')]();};}function respondWithResult(_0x24452a,_0x367d37){_0x367d37=_0x367d37||0xc8;return function(_0x221c64){if(_0x221c64){return _0x24452a['status'](_0x367d37)[_0x13cd('0x20')](_0x221c64);}};}function respondWithFilteredResult(_0x13b848,_0x47c3d5){return function(_0x36de9d){if(_0x36de9d){var _0x31b01e=typeof _0x47c3d5[_0x13cd('0x21')]===_0x13cd('0x22')&&typeof _0x47c3d5[_0x13cd('0x23')]==='undefined';var _0xd8e77e=_0x36de9d[_0x13cd('0x24')];var _0x4ca246=_0x31b01e?0x0:_0x47c3d5[_0x13cd('0x21')];var _0xada2d0=_0x31b01e?_0x36de9d[_0x13cd('0x24')]:_0x47c3d5[_0x13cd('0x21')]+_0x47c3d5[_0x13cd('0x23')];var _0x3355a4;if(_0xada2d0>=_0xd8e77e){_0xada2d0=_0xd8e77e;_0x3355a4=0xc8;}else{_0x3355a4=0xce;}_0x13b848[_0x13cd('0x25')](_0x3355a4);return _0x13b848['set'](_0x13cd('0x26'),_0x4ca246+'-'+_0xada2d0+'/'+_0xd8e77e)[_0x13cd('0x20')](_0x36de9d);}return null;};}function patchUpdates(_0x24d9b3){return function(_0x5ad165){try{jsonpatch['apply'](_0x5ad165,_0x24d9b3,!![]);}catch(_0x33d88c){return BPromise[_0x13cd('0x27')](_0x33d88c);}return _0x5ad165['save']();};}function saveUpdates(_0x889a80,_0x3369e0){return function(_0x4af390){if(_0x4af390){return _0x4af390[_0x13cd('0x28')](_0x889a80)[_0x13cd('0x29')](function(_0x17bf16){return _0x17bf16;});}return null;};}function removeEntity(_0x391a26,_0x2eb190){return function(_0x161390){if(_0x161390){return _0x161390[_0x13cd('0x2a')]()['then'](function(){_0x391a26[_0x13cd('0x25')](0xcc)[_0x13cd('0x1f')]();});}};}function handleEntityNotFound(_0x75d486,_0x2a0aa2){return function(_0x2e12d5){if(!_0x2e12d5){_0x75d486[_0x13cd('0x2b')](0x194);}return _0x2e12d5;};}function handleError(_0x7c70e3,_0x5db2b7){_0x5db2b7=_0x5db2b7||0x1f4;return function(_0x319a3d){logger[_0x13cd('0x2c')](_0x319a3d[_0x13cd('0x2d')]);if(_0x319a3d[_0x13cd('0x2e')]){delete _0x319a3d[_0x13cd('0x2e')];}_0x7c70e3[_0x13cd('0x25')](_0x5db2b7)[_0x13cd('0x2f')](_0x319a3d);};}exports[_0x13cd('0x30')]=function(_0x4e78ec,_0x5e708d){var _0x24b07f={},_0x49c50d={},_0x1c56f5={'count':0x0,'rows':[]};var _0x4407f0=_[_0x13cd('0x31')](db['ChatGroup'][_0x13cd('0x32')],function(_0x5c53f8){return{'name':_0x5c53f8[_0x13cd('0x33')],'type':_0x5c53f8[_0x13cd('0x34')][_0x13cd('0x35')]};});_0x49c50d[_0x13cd('0x36')]=_['map'](_0x4407f0,_0x13cd('0x2e'));_0x49c50d[_0x13cd('0x37')]=_['keys'](_0x4e78ec[_0x13cd('0x37')]);_0x49c50d[_0x13cd('0x38')]=_[_0x13cd('0x39')](_0x49c50d['model'],_0x49c50d['query']);_0x24b07f['attributes']=_[_0x13cd('0x39')](_0x49c50d[_0x13cd('0x36')],qs[_0x13cd('0x3a')](_0x4e78ec[_0x13cd('0x37')][_0x13cd('0x3a')]));_0x24b07f[_0x13cd('0x3b')]=_0x24b07f['attributes'][_0x13cd('0x3c')]?_0x24b07f['attributes']:_0x49c50d[_0x13cd('0x36')];if(!_0x4e78ec['query'][_0x13cd('0x3d')]('nolimit')){_0x24b07f[_0x13cd('0x23')]=qs[_0x13cd('0x23')](_0x4e78ec[_0x13cd('0x37')][_0x13cd('0x23')]);_0x24b07f['offset']=qs['offset'](_0x4e78ec['query']['offset']);}_0x24b07f[_0x13cd('0x3e')]=qs[_0x13cd('0x3f')](_0x4e78ec[_0x13cd('0x37')][_0x13cd('0x3f')]);_0x24b07f[_0x13cd('0x40')]=qs[_0x13cd('0x38')](_[_0x13cd('0x41')](_0x4e78ec[_0x13cd('0x37')],_0x49c50d[_0x13cd('0x38')]),_0x4407f0);if(_0x4e78ec[_0x13cd('0x37')][_0x13cd('0x42')]){_0x24b07f[_0x13cd('0x40')]=_[_0x13cd('0x43')](_0x24b07f[_0x13cd('0x40')],{'$or':_[_0x13cd('0x31')](_0x4407f0,function(_0x10ef5f){if(_0x10ef5f[_0x13cd('0x34')]!==_0x13cd('0x44')){var _0xda71b={};_0xda71b[_0x10ef5f[_0x13cd('0x2e')]]={'$like':'%'+_0x4e78ec[_0x13cd('0x37')][_0x13cd('0x42')]+'%'};return _0xda71b;}})});}_0x24b07f=_[_0x13cd('0x43')]({},_0x24b07f,_0x4e78ec[_0x13cd('0x45')]);var _0x22fe2a={'where':_0x24b07f[_0x13cd('0x40')]};return db[_0x13cd('0x46')][_0x13cd('0x24')](_0x22fe2a)[_0x13cd('0x29')](function(_0x539047){_0x1c56f5['count']=_0x539047;if(_0x4e78ec[_0x13cd('0x37')][_0x13cd('0x47')]){_0x24b07f[_0x13cd('0x48')]=[{'all':!![]}];}return db[_0x13cd('0x46')][_0x13cd('0x49')](_0x24b07f);})[_0x13cd('0x29')](function(_0x1fe12a){_0x1c56f5['rows']=_0x1fe12a;return _0x1c56f5;})[_0x13cd('0x29')](respondWithFilteredResult(_0x5e708d,_0x24b07f))['catch'](handleError(_0x5e708d,null));};exports[_0x13cd('0x4a')]=function(_0x1516f6,_0x14033e){var _0x104967={'raw':!![],'where':{'id':_0x1516f6[_0x13cd('0x4b')]['id']}},_0x4129c5={};_0x4129c5['model']=_[_0x13cd('0x4c')](db[_0x13cd('0x46')][_0x13cd('0x32')]);_0x4129c5['query']=_['keys'](_0x1516f6[_0x13cd('0x37')]);_0x4129c5[_0x13cd('0x38')]=_[_0x13cd('0x39')](_0x4129c5[_0x13cd('0x36')],_0x4129c5['query']);_0x104967['attributes']=_[_0x13cd('0x39')](_0x4129c5[_0x13cd('0x36')],qs[_0x13cd('0x3a')](_0x1516f6[_0x13cd('0x37')]['fields']));_0x104967['attributes']=_0x104967['attributes']['length']?_0x104967[_0x13cd('0x3b')]:_0x4129c5['model'];if(_0x1516f6['query']['includeAll']){_0x104967['include']=[{'all':!![]}];}_0x104967=_['merge']({},_0x104967,_0x1516f6[_0x13cd('0x45')]);return db[_0x13cd('0x46')][_0x13cd('0x4d')](_0x104967)['then'](handleEntityNotFound(_0x14033e,null))['then'](respondWithResult(_0x14033e,null))['catch'](handleError(_0x14033e,null));};exports[_0x13cd('0x4e')]=function(_0x98f4f7,_0x5cca92){return db['ChatGroup'][_0x13cd('0x4e')](_0x98f4f7[_0x13cd('0x4f')],{})[_0x13cd('0x29')](respondWithResult(_0x5cca92,0xc9))[_0x13cd('0x50')](handleError(_0x5cca92,null));};exports[_0x13cd('0x28')]=function(_0x466171,_0x5ba2f9){if(_0x466171[_0x13cd('0x4f')]['id']){delete _0x466171[_0x13cd('0x4f')]['id'];}return db[_0x13cd('0x46')][_0x13cd('0x4d')]({'where':{'id':_0x466171[_0x13cd('0x4b')]['id']}})[_0x13cd('0x29')](handleEntityNotFound(_0x5ba2f9,null))[_0x13cd('0x29')](saveUpdates(_0x466171[_0x13cd('0x4f')],null))['then'](respondWithResult(_0x5ba2f9,null))[_0x13cd('0x50')](handleError(_0x5ba2f9,null));};exports[_0x13cd('0x2a')]=function(_0x248ab8,_0x337f26){return db[_0x13cd('0x46')][_0x13cd('0x4d')]({'where':{'id':_0x248ab8[_0x13cd('0x4b')]['id']}})[_0x13cd('0x29')](handleEntityNotFound(_0x337f26,null))[_0x13cd('0x29')](removeEntity(_0x337f26,null))[_0x13cd('0x50')](handleError(_0x337f26,null));};exports[_0x13cd('0x51')]=function(_0xc8fc27,_0x43e58c){return db[_0x13cd('0x46')][_0x13cd('0x51')]()[_0x13cd('0x29')](respondWithResult(_0x43e58c,null))['catch'](handleError(_0x43e58c,null));};exports[_0x13cd('0x52')]=function(_0x2d89c2,_0x145a0c,_0x33eab4){return db[_0x13cd('0x53')]['count']({'where':{'ChatGroupId':_0x2d89c2[_0x13cd('0x4b')]['id'],'ToId':_0x2d89c2[_0x13cd('0x54')]['id'],'read':![]}})[_0x13cd('0x29')](function(_0x44fbbb){return{'id':_['toInteger'](_0x2d89c2[_0x13cd('0x4b')]['id']),'count':_0x44fbbb};})['then'](respondWithResult(_0x145a0c,null))[_0x13cd('0x50')](handleError(_0x145a0c,null));};exports[_0x13cd('0x55')]=function(_0x328e70,_0x1be1e0,_0x347294){return db[_0x13cd('0x46')][_0x13cd('0x4d')]({'where':{'id':_0x328e70['params']['id']}})[_0x13cd('0x29')](handleEntityNotFound(_0x1be1e0,null))[_0x13cd('0x29')](function(_0x3bd58d){if(_0x3bd58d){return _0x3bd58d[_0x13cd('0x55')](_0x328e70['body'][_0x13cd('0x56')],_[_0x13cd('0x57')](_0x328e70['body'],[_0x13cd('0x56'),'id'])||{});}})[_0x13cd('0x29')](respondWithResult(_0x1be1e0,null))[_0x13cd('0x50')](handleError(_0x1be1e0,null));};exports['getMembers']=function(_0x3445be,_0x50c9a2,_0x2deaf9){var _0x1cf410={};var _0x44dd98={};var _0x3167b0;var _0x13c823;return db[_0x13cd('0x46')]['findOne']({'where':{'id':_0x3445be[_0x13cd('0x4b')]['id']}})[_0x13cd('0x29')](handleEntityNotFound(_0x50c9a2,null))[_0x13cd('0x29')](function(_0x599cae){if(_0x599cae){_0x3167b0=_0x599cae;_0x44dd98[_0x13cd('0x36')]=_['keys'](db[_0x13cd('0x58')][_0x13cd('0x32')]);_0x44dd98[_0x13cd('0x37')]=_['keys'](_0x3445be[_0x13cd('0x37')]);_0x44dd98['filters']=_[_0x13cd('0x39')](_0x44dd98[_0x13cd('0x36')],_0x44dd98[_0x13cd('0x37')]);_0x1cf410['attributes']=_['intersection'](_0x44dd98[_0x13cd('0x36')],qs[_0x13cd('0x3a')](_0x3445be['query'][_0x13cd('0x3a')]));_0x1cf410['attributes']=_0x1cf410[_0x13cd('0x3b')][_0x13cd('0x3c')]?_0x1cf410[_0x13cd('0x3b')]:_0x44dd98['model'];_0x1cf410['order']=qs[_0x13cd('0x3f')](_0x3445be[_0x13cd('0x37')][_0x13cd('0x3f')]);_0x1cf410[_0x13cd('0x40')]=qs[_0x13cd('0x38')](_[_0x13cd('0x41')](_0x3445be[_0x13cd('0x37')],_0x44dd98[_0x13cd('0x38')]));if(_0x3445be[_0x13cd('0x37')][_0x13cd('0x42')]){_0x1cf410[_0x13cd('0x40')]=_[_0x13cd('0x43')](_0x1cf410[_0x13cd('0x40')],{'$or':_[_0x13cd('0x31')](_0x1cf410[_0x13cd('0x3b')],function(_0x542ab5){var _0x5be241={};_0x5be241[_0x542ab5]={'$like':'%'+_0x3445be[_0x13cd('0x37')][_0x13cd('0x42')]+'%'};return _0x5be241;})});}_0x1cf410=_[_0x13cd('0x43')]({},_0x1cf410,_0x3445be[_0x13cd('0x45')]);return _0x3167b0[_0x13cd('0x59')](_0x1cf410);}})['then'](function(_0x469465){if(_0x469465){_0x13c823=_0x469465[_0x13cd('0x3c')];if(!_0x3445be[_0x13cd('0x37')][_0x13cd('0x3d')](_0x13cd('0x5a'))){_0x1cf410[_0x13cd('0x23')]=qs[_0x13cd('0x23')](_0x3445be[_0x13cd('0x37')][_0x13cd('0x23')]);_0x1cf410[_0x13cd('0x21')]=qs[_0x13cd('0x21')](_0x3445be[_0x13cd('0x37')][_0x13cd('0x21')]);}return _0x3167b0['getMembers'](_0x1cf410);}})[_0x13cd('0x29')](function(_0x26db40){if(_0x26db40){return _0x26db40?{'count':_0x13c823,'rows':_0x26db40}:null;}})[_0x13cd('0x29')](respondWithResult(_0x50c9a2,null))[_0x13cd('0x50')](handleError(_0x50c9a2,null));};exports[_0x13cd('0x5b')]=function(_0x83e96b,_0x472adc,_0x529656){return db[_0x13cd('0x46')][_0x13cd('0x4d')]({'where':{'id':_0x83e96b[_0x13cd('0x4b')]['id']}})[_0x13cd('0x29')](handleEntityNotFound(_0x472adc,null))[_0x13cd('0x29')](function(_0x27e57b){if(_0x27e57b){return _0x27e57b[_0x13cd('0x5b')](_0x83e96b[_0x13cd('0x37')][_0x13cd('0x56')]);}})[_0x13cd('0x29')](respondWithStatusCode(_0x472adc,null))[_0x13cd('0x50')](handleError(_0x472adc,null));};exports['addMessage']=function(_0x1909fe,_0x477c64,_0x3102d1){if(_0x1909fe[_0x13cd('0x4f')]['id']){delete _0x1909fe[_0x13cd('0x4f')]['id'];}return db[_0x13cd('0x46')][_0x13cd('0x4d')]({'where':{'id':_0x1909fe['params']['id']}})[_0x13cd('0x29')](handleEntityNotFound(_0x477c64,null))[_0x13cd('0x29')](function(_0xbcad38){if(_0xbcad38){_0x1909fe[_0x13cd('0x4f')][_0x13cd('0x5c')]=_0xbcad38['id'];return db[_0x13cd('0x53')]['create'](_0x1909fe[_0x13cd('0x4f')]);}})[_0x13cd('0x29')](respondWithResult(_0x477c64,null))[_0x13cd('0x50')](handleError(_0x477c64,null));};exports[_0x13cd('0x5d')]=function(_0x245e8b,_0x101ae5,_0x11b240){var _0x450153={};var _0x5e4aa5={};var _0x5c74be;var _0x5c1e18;return db[_0x13cd('0x46')][_0x13cd('0x5e')]({'where':{'id':_0x245e8b['params']['id']}})[_0x13cd('0x29')](handleEntityNotFound(_0x101ae5,null))['then'](function(_0x95dfb0){if(_0x95dfb0){_0x5c74be=_0x95dfb0;_0x5e4aa5[_0x13cd('0x36')]=_[_0x13cd('0x4c')](db['ChatInternalMessage'][_0x13cd('0x32')]);_0x5e4aa5['query']=_[_0x13cd('0x4c')](_0x245e8b[_0x13cd('0x37')]);_0x5e4aa5[_0x13cd('0x38')]=_[_0x13cd('0x39')](_0x5e4aa5[_0x13cd('0x36')],_0x5e4aa5[_0x13cd('0x37')]);_0x450153[_0x13cd('0x3b')]=_['intersection'](_0x5e4aa5['model'],qs['fields'](_0x245e8b['query'][_0x13cd('0x3a')]));_0x450153[_0x13cd('0x3b')]=_0x450153[_0x13cd('0x3b')]['length']?_0x450153['attributes']:_0x5e4aa5[_0x13cd('0x36')];_0x450153[_0x13cd('0x3e')]=qs[_0x13cd('0x3f')](_0x245e8b[_0x13cd('0x37')][_0x13cd('0x3f')]);_0x450153['where']=qs[_0x13cd('0x38')](_[_0x13cd('0x41')](_0x245e8b[_0x13cd('0x37')],_0x5e4aa5[_0x13cd('0x38')]));if(_0x245e8b[_0x13cd('0x37')][_0x13cd('0x42')]){_0x450153[_0x13cd('0x40')]=_[_0x13cd('0x43')](_0x450153[_0x13cd('0x40')],{'$or':_['map'](_0x450153[_0x13cd('0x3b')],function(_0x26831b){var _0x38282d={};_0x38282d[_0x26831b]={'$like':'%'+_0x245e8b['query']['filter']+'%'};return _0x38282d;})});}if(_0x245e8b[_0x13cd('0x37')]['$gte']){var _0x21ff63=_0x245e8b[_0x13cd('0x37')]['$gte'][_0x13cd('0x5f')](',');var _0x39fe95={};_0x39fe95[_0x21ff63[0x0]]={'$gte':moment(_0x21ff63[0x1])[_0x13cd('0x60')](_0x13cd('0x61'))};_0x450153[_0x13cd('0x40')]=_['merge'](_0x450153['where'],_0x39fe95);}_0x450153=_[_0x13cd('0x43')]({},_0x450153,_0x245e8b[_0x13cd('0x45')]);return _0x5c74be[_0x13cd('0x5d')](_0x450153);}})['then'](function(_0x55e20d){if(_0x55e20d){_0x5c1e18=_0x55e20d['length'];if(!_0x245e8b['query'][_0x13cd('0x3d')](_0x13cd('0x5a'))){_0x450153[_0x13cd('0x23')]=qs[_0x13cd('0x23')](_0x245e8b[_0x13cd('0x37')][_0x13cd('0x23')]);_0x450153[_0x13cd('0x21')]=qs[_0x13cd('0x21')](_0x245e8b['query'][_0x13cd('0x21')]);}return _0x5c74be['getMessages'](_0x450153);}})[_0x13cd('0x29')](function(_0x284906){if(_0x284906){return _0x284906?{'count':_0x5c1e18,'rows':_0x284906}:null;}})['then'](respondWithResult(_0x101ae5,null))[_0x13cd('0x50')](handleError(_0x101ae5,null));}; \ No newline at end of file +var _0xf9bb=['format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatGroup.socket','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','ChatGroup','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','update','destroy','describe','ChatInternalMessage','params','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','nolimit','removeMembers','addMessage','ChatGroupId','rawAttributes','$gte','split'];(function(_0x194d6d,_0x43781b){var _0x6d23cc=function(_0x6c57ad){while(--_0x6c57ad){_0x194d6d['push'](_0x194d6d['shift']());}};_0x6d23cc(++_0x43781b);}(_0xf9bb,0xcb));var _0xbf9b=function(_0x3419b0,_0x255acd){_0x3419b0=_0x3419b0-0x0;var _0x2fddb6=_0xf9bb[_0x3419b0];return _0x2fddb6;};'use strict';var emlformat=require(_0xbf9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf9b('0x1'));var jsonpatch=require(_0xbf9b('0x2'));var rp=require(_0xbf9b('0x3'));var moment=require(_0xbf9b('0x4'));var BPromise=require(_0xbf9b('0x5'));var Mustache=require('mustache');var util=require(_0xbf9b('0x6'));var path=require(_0xbf9b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf9b('0x8'));var fs=require('fs');var fs_extra=require(_0xbf9b('0x9'));var _=require(_0xbf9b('0xa'));var squel=require(_0xbf9b('0xb'));var crypto=require(_0xbf9b('0xc'));var jsforce=require(_0xbf9b('0xd'));var deskjs=require(_0xbf9b('0xe'));var toCsv=require(_0xbf9b('0xf'));var querystring=require(_0xbf9b('0x10'));var Papa=require(_0xbf9b('0x11'));var Redis=require('ioredis');var authService=require(_0xbf9b('0x12'));var qs=require(_0xbf9b('0x13'));var as=require(_0xbf9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf9b('0x15'))(_0xbf9b('0x16'));var utils=require(_0xbf9b('0x17'));var config=require(_0xbf9b('0x18'));var licenseUtil=require(_0xbf9b('0x19'));var db=require(_0xbf9b('0x1a'))['db'];config[_0xbf9b('0x1b')]=_[_0xbf9b('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf9b('0x1b')]));require(_0xbf9b('0x1d'))['register'](socket);function respondWithStatusCode(_0x57991b,_0x28d787){_0x28d787=_0x28d787||0xcc;return function(_0x5d6f97){if(_0x5d6f97){return _0x57991b['sendStatus'](_0x28d787);}return _0x57991b['status'](_0x28d787)[_0xbf9b('0x1e')]();};}function respondWithResult(_0x3ba5e4,_0x3664b8){_0x3664b8=_0x3664b8||0xc8;return function(_0x20cb15){if(_0x20cb15){return _0x3ba5e4[_0xbf9b('0x1f')](_0x3664b8)[_0xbf9b('0x20')](_0x20cb15);}};}function respondWithFilteredResult(_0x3c8aae,_0x17b3f6){return function(_0x4ca6cc){if(_0x4ca6cc){var _0x5950bf=typeof _0x17b3f6[_0xbf9b('0x21')]===_0xbf9b('0x22')&&typeof _0x17b3f6['limit']==='undefined';var _0x2f678b=_0x4ca6cc[_0xbf9b('0x23')];var _0x569807=_0x5950bf?0x0:_0x17b3f6['offset'];var _0x2bc07a=_0x5950bf?_0x4ca6cc[_0xbf9b('0x23')]:_0x17b3f6[_0xbf9b('0x21')]+_0x17b3f6[_0xbf9b('0x24')];var _0x25a5e7;if(_0x2bc07a>=_0x2f678b){_0x2bc07a=_0x2f678b;_0x25a5e7=0xc8;}else{_0x25a5e7=0xce;}_0x3c8aae[_0xbf9b('0x1f')](_0x25a5e7);return _0x3c8aae[_0xbf9b('0x25')](_0xbf9b('0x26'),_0x569807+'-'+_0x2bc07a+'/'+_0x2f678b)[_0xbf9b('0x20')](_0x4ca6cc);}return null;};}function patchUpdates(_0x23ed3e){return function(_0xeede8d){try{jsonpatch[_0xbf9b('0x27')](_0xeede8d,_0x23ed3e,!![]);}catch(_0x40866c){return BPromise[_0xbf9b('0x28')](_0x40866c);}return _0xeede8d[_0xbf9b('0x29')]();};}function saveUpdates(_0x3e55a1,_0x1b5f61){return function(_0x492c8d){if(_0x492c8d){return _0x492c8d['update'](_0x3e55a1)[_0xbf9b('0x2a')](function(_0x2e2594){return _0x2e2594;});}return null;};}function removeEntity(_0x3e387b,_0x50c030){return function(_0x53ba4e){if(_0x53ba4e){return _0x53ba4e['destroy']()[_0xbf9b('0x2a')](function(){_0x3e387b[_0xbf9b('0x1f')](0xcc)[_0xbf9b('0x1e')]();});}};}function handleEntityNotFound(_0x429814,_0x22a23b){return function(_0x56ee2c){if(!_0x56ee2c){_0x429814[_0xbf9b('0x2b')](0x194);}return _0x56ee2c;};}function handleError(_0x558e81,_0xd37e48){_0xd37e48=_0xd37e48||0x1f4;return function(_0xb9ed3f){logger[_0xbf9b('0x2c')](_0xb9ed3f[_0xbf9b('0x2d')]);if(_0xb9ed3f['name']){delete _0xb9ed3f[_0xbf9b('0x2e')];}_0x558e81['status'](_0xd37e48)[_0xbf9b('0x2f')](_0xb9ed3f);};}exports[_0xbf9b('0x30')]=function(_0x4b5aae,_0x2e799a){var _0x2c5bf5={},_0x5bc912={},_0x1db753={'count':0x0,'rows':[]};var _0x2e7aaf=_[_0xbf9b('0x31')](db[_0xbf9b('0x32')]['rawAttributes'],function(_0x18eb11){return{'name':_0x18eb11['fieldName'],'type':_0x18eb11[_0xbf9b('0x33')][_0xbf9b('0x34')]};});_0x5bc912['model']=_[_0xbf9b('0x31')](_0x2e7aaf,_0xbf9b('0x2e'));_0x5bc912[_0xbf9b('0x35')]=_['keys'](_0x4b5aae[_0xbf9b('0x35')]);_0x5bc912['filters']=_[_0xbf9b('0x36')](_0x5bc912['model'],_0x5bc912[_0xbf9b('0x35')]);_0x2c5bf5[_0xbf9b('0x37')]=_['intersection'](_0x5bc912[_0xbf9b('0x38')],qs[_0xbf9b('0x39')](_0x4b5aae[_0xbf9b('0x35')][_0xbf9b('0x39')]));_0x2c5bf5[_0xbf9b('0x37')]=_0x2c5bf5[_0xbf9b('0x37')][_0xbf9b('0x3a')]?_0x2c5bf5[_0xbf9b('0x37')]:_0x5bc912[_0xbf9b('0x38')];if(!_0x4b5aae['query'][_0xbf9b('0x3b')]('nolimit')){_0x2c5bf5[_0xbf9b('0x24')]=qs[_0xbf9b('0x24')](_0x4b5aae[_0xbf9b('0x35')][_0xbf9b('0x24')]);_0x2c5bf5['offset']=qs[_0xbf9b('0x21')](_0x4b5aae['query'][_0xbf9b('0x21')]);}_0x2c5bf5[_0xbf9b('0x3c')]=qs['sort'](_0x4b5aae[_0xbf9b('0x35')][_0xbf9b('0x3d')]);_0x2c5bf5[_0xbf9b('0x3e')]=qs[_0xbf9b('0x3f')](_[_0xbf9b('0x40')](_0x4b5aae[_0xbf9b('0x35')],_0x5bc912[_0xbf9b('0x3f')]),_0x2e7aaf);if(_0x4b5aae[_0xbf9b('0x35')][_0xbf9b('0x41')]){_0x2c5bf5['where']=_[_0xbf9b('0x42')](_0x2c5bf5[_0xbf9b('0x3e')],{'$or':_['map'](_0x2e7aaf,function(_0x3f4ae0){if(_0x3f4ae0[_0xbf9b('0x33')]!=='VIRTUAL'){var _0x176934={};_0x176934[_0x3f4ae0[_0xbf9b('0x2e')]]={'$like':'%'+_0x4b5aae[_0xbf9b('0x35')][_0xbf9b('0x41')]+'%'};return _0x176934;}})});}_0x2c5bf5=_[_0xbf9b('0x42')]({},_0x2c5bf5,_0x4b5aae[_0xbf9b('0x43')]);var _0x1fdaa8={'where':_0x2c5bf5[_0xbf9b('0x3e')]};return db[_0xbf9b('0x32')]['count'](_0x1fdaa8)[_0xbf9b('0x2a')](function(_0x21600e){_0x1db753[_0xbf9b('0x23')]=_0x21600e;if(_0x4b5aae[_0xbf9b('0x35')][_0xbf9b('0x44')]){_0x2c5bf5[_0xbf9b('0x45')]=[{'all':!![]}];}return db[_0xbf9b('0x32')][_0xbf9b('0x46')](_0x2c5bf5);})[_0xbf9b('0x2a')](function(_0x3dc743){_0x1db753[_0xbf9b('0x47')]=_0x3dc743;return _0x1db753;})[_0xbf9b('0x2a')](respondWithFilteredResult(_0x2e799a,_0x2c5bf5))[_0xbf9b('0x48')](handleError(_0x2e799a,null));};exports['show']=function(_0x18cd1d,_0x30042d){var _0x5269aa={'raw':!![],'where':{'id':_0x18cd1d['params']['id']}},_0xbdeba5={};_0xbdeba5[_0xbf9b('0x38')]=_[_0xbf9b('0x49')](db['ChatGroup']['rawAttributes']);_0xbdeba5[_0xbf9b('0x35')]=_[_0xbf9b('0x49')](_0x18cd1d[_0xbf9b('0x35')]);_0xbdeba5[_0xbf9b('0x3f')]=_['intersection'](_0xbdeba5[_0xbf9b('0x38')],_0xbdeba5[_0xbf9b('0x35')]);_0x5269aa['attributes']=_['intersection'](_0xbdeba5[_0xbf9b('0x38')],qs[_0xbf9b('0x39')](_0x18cd1d[_0xbf9b('0x35')][_0xbf9b('0x39')]));_0x5269aa['attributes']=_0x5269aa[_0xbf9b('0x37')]['length']?_0x5269aa[_0xbf9b('0x37')]:_0xbdeba5['model'];if(_0x18cd1d[_0xbf9b('0x35')][_0xbf9b('0x44')]){_0x5269aa[_0xbf9b('0x45')]=[{'all':!![]}];}_0x5269aa=_[_0xbf9b('0x42')]({},_0x5269aa,_0x18cd1d[_0xbf9b('0x43')]);return db[_0xbf9b('0x32')][_0xbf9b('0x4a')](_0x5269aa)[_0xbf9b('0x2a')](handleEntityNotFound(_0x30042d,null))['then'](respondWithResult(_0x30042d,null))['catch'](handleError(_0x30042d,null));};exports[_0xbf9b('0x4b')]=function(_0x55c507,_0x505477){return db[_0xbf9b('0x32')][_0xbf9b('0x4b')](_0x55c507[_0xbf9b('0x4c')],{})[_0xbf9b('0x2a')](respondWithResult(_0x505477,0xc9))[_0xbf9b('0x48')](handleError(_0x505477,null));};exports[_0xbf9b('0x4d')]=function(_0x115f1c,_0x594849){if(_0x115f1c['body']['id']){delete _0x115f1c[_0xbf9b('0x4c')]['id'];}return db[_0xbf9b('0x32')][_0xbf9b('0x4a')]({'where':{'id':_0x115f1c['params']['id']}})['then'](handleEntityNotFound(_0x594849,null))[_0xbf9b('0x2a')](saveUpdates(_0x115f1c[_0xbf9b('0x4c')],null))[_0xbf9b('0x2a')](respondWithResult(_0x594849,null))[_0xbf9b('0x48')](handleError(_0x594849,null));};exports[_0xbf9b('0x4e')]=function(_0x1f9601,_0x382dea){return db['ChatGroup'][_0xbf9b('0x4a')]({'where':{'id':_0x1f9601['params']['id']}})[_0xbf9b('0x2a')](handleEntityNotFound(_0x382dea,null))['then'](removeEntity(_0x382dea,null))['catch'](handleError(_0x382dea,null));};exports[_0xbf9b('0x4f')]=function(_0x172cac,_0x21841f){return db[_0xbf9b('0x32')][_0xbf9b('0x4f')]()[_0xbf9b('0x2a')](respondWithResult(_0x21841f,null))[_0xbf9b('0x48')](handleError(_0x21841f,null));};exports['getUnread']=function(_0x29fd0d,_0x478733,_0x34c4f1){return db[_0xbf9b('0x50')][_0xbf9b('0x23')]({'where':{'ChatGroupId':_0x29fd0d[_0xbf9b('0x51')]['id'],'ToId':_0x29fd0d[_0xbf9b('0x52')]['id'],'read':![]}})['then'](function(_0x2f2b92){return{'id':_[_0xbf9b('0x53')](_0x29fd0d[_0xbf9b('0x51')]['id']),'count':_0x2f2b92};})['then'](respondWithResult(_0x478733,null))['catch'](handleError(_0x478733,null));};exports[_0xbf9b('0x54')]=function(_0x19a9ca,_0x53a9e9,_0x28ee57){return db[_0xbf9b('0x32')][_0xbf9b('0x4a')]({'where':{'id':_0x19a9ca['params']['id']}})['then'](handleEntityNotFound(_0x53a9e9,null))[_0xbf9b('0x2a')](function(_0x44df83){if(_0x44df83){return _0x44df83[_0xbf9b('0x54')](_0x19a9ca['body']['ids'],_[_0xbf9b('0x55')](_0x19a9ca[_0xbf9b('0x4c')],[_0xbf9b('0x56'),'id'])||{});}})[_0xbf9b('0x2a')](respondWithResult(_0x53a9e9,null))[_0xbf9b('0x48')](handleError(_0x53a9e9,null));};exports[_0xbf9b('0x57')]=function(_0x5a2244,_0xe21d87,_0xf4489){var _0x23a167={};var _0x428b92={};var _0x53dfc7;var _0x11f2f4;return db[_0xbf9b('0x32')][_0xbf9b('0x58')]({'where':{'id':_0x5a2244[_0xbf9b('0x51')]['id']}})[_0xbf9b('0x2a')](handleEntityNotFound(_0xe21d87,null))[_0xbf9b('0x2a')](function(_0x3ad902){if(_0x3ad902){_0x53dfc7=_0x3ad902;_0x428b92[_0xbf9b('0x38')]=_[_0xbf9b('0x49')](db[_0xbf9b('0x59')]['rawAttributes']);_0x428b92['query']=_['keys'](_0x5a2244['query']);_0x428b92[_0xbf9b('0x3f')]=_['intersection'](_0x428b92['model'],_0x428b92[_0xbf9b('0x35')]);_0x23a167['attributes']=_[_0xbf9b('0x36')](_0x428b92[_0xbf9b('0x38')],qs['fields'](_0x5a2244['query'][_0xbf9b('0x39')]));_0x23a167[_0xbf9b('0x37')]=_0x23a167[_0xbf9b('0x37')][_0xbf9b('0x3a')]?_0x23a167[_0xbf9b('0x37')]:_0x428b92['model'];_0x23a167[_0xbf9b('0x3c')]=qs['sort'](_0x5a2244['query'][_0xbf9b('0x3d')]);_0x23a167[_0xbf9b('0x3e')]=qs['filters'](_[_0xbf9b('0x40')](_0x5a2244['query'],_0x428b92[_0xbf9b('0x3f')]));if(_0x5a2244[_0xbf9b('0x35')][_0xbf9b('0x41')]){_0x23a167[_0xbf9b('0x3e')]=_[_0xbf9b('0x42')](_0x23a167['where'],{'$or':_[_0xbf9b('0x31')](_0x23a167[_0xbf9b('0x37')],function(_0x25198c){var _0x45c146={};_0x45c146[_0x25198c]={'$like':'%'+_0x5a2244['query'][_0xbf9b('0x41')]+'%'};return _0x45c146;})});}_0x23a167=_[_0xbf9b('0x42')]({},_0x23a167,_0x5a2244[_0xbf9b('0x43')]);return _0x53dfc7['getMembers'](_0x23a167);}})[_0xbf9b('0x2a')](function(_0x3c0c34){if(_0x3c0c34){_0x11f2f4=_0x3c0c34[_0xbf9b('0x3a')];if(!_0x5a2244[_0xbf9b('0x35')][_0xbf9b('0x3b')](_0xbf9b('0x5a'))){_0x23a167[_0xbf9b('0x24')]=qs[_0xbf9b('0x24')](_0x5a2244[_0xbf9b('0x35')]['limit']);_0x23a167[_0xbf9b('0x21')]=qs['offset'](_0x5a2244[_0xbf9b('0x35')][_0xbf9b('0x21')]);}return _0x53dfc7[_0xbf9b('0x57')](_0x23a167);}})['then'](function(_0x1a3658){if(_0x1a3658){return _0x1a3658?{'count':_0x11f2f4,'rows':_0x1a3658}:null;}})['then'](respondWithResult(_0xe21d87,null))['catch'](handleError(_0xe21d87,null));};exports[_0xbf9b('0x5b')]=function(_0x17cb08,_0x31f60c,_0x18b541){return db[_0xbf9b('0x32')]['find']({'where':{'id':_0x17cb08[_0xbf9b('0x51')]['id']}})['then'](handleEntityNotFound(_0x31f60c,null))[_0xbf9b('0x2a')](function(_0x59a84d){if(_0x59a84d){return _0x59a84d['removeMembers'](_0x17cb08[_0xbf9b('0x35')]['ids']);}})[_0xbf9b('0x2a')](respondWithStatusCode(_0x31f60c,null))[_0xbf9b('0x48')](handleError(_0x31f60c,null));};exports[_0xbf9b('0x5c')]=function(_0x30bddc,_0x2e8529,_0x215e47){if(_0x30bddc[_0xbf9b('0x4c')]['id']){delete _0x30bddc[_0xbf9b('0x4c')]['id'];}return db[_0xbf9b('0x32')]['find']({'where':{'id':_0x30bddc['params']['id']}})[_0xbf9b('0x2a')](handleEntityNotFound(_0x2e8529,null))[_0xbf9b('0x2a')](function(_0x501f03){if(_0x501f03){_0x30bddc[_0xbf9b('0x4c')][_0xbf9b('0x5d')]=_0x501f03['id'];return db['ChatInternalMessage'][_0xbf9b('0x4b')](_0x30bddc[_0xbf9b('0x4c')]);}})[_0xbf9b('0x2a')](respondWithResult(_0x2e8529,null))[_0xbf9b('0x48')](handleError(_0x2e8529,null));};exports['getMessages']=function(_0x36f4c2,_0x349c6f,_0x43b928){var _0x3971d4={};var _0x4a1c53={};var _0x3a0fec;var _0x5f2823;return db[_0xbf9b('0x32')]['findOne']({'where':{'id':_0x36f4c2[_0xbf9b('0x51')]['id']}})[_0xbf9b('0x2a')](handleEntityNotFound(_0x349c6f,null))[_0xbf9b('0x2a')](function(_0x236987){if(_0x236987){_0x3a0fec=_0x236987;_0x4a1c53[_0xbf9b('0x38')]=_[_0xbf9b('0x49')](db[_0xbf9b('0x50')][_0xbf9b('0x5e')]);_0x4a1c53[_0xbf9b('0x35')]=_[_0xbf9b('0x49')](_0x36f4c2['query']);_0x4a1c53['filters']=_[_0xbf9b('0x36')](_0x4a1c53[_0xbf9b('0x38')],_0x4a1c53['query']);_0x3971d4[_0xbf9b('0x37')]=_[_0xbf9b('0x36')](_0x4a1c53[_0xbf9b('0x38')],qs['fields'](_0x36f4c2[_0xbf9b('0x35')][_0xbf9b('0x39')]));_0x3971d4[_0xbf9b('0x37')]=_0x3971d4[_0xbf9b('0x37')][_0xbf9b('0x3a')]?_0x3971d4[_0xbf9b('0x37')]:_0x4a1c53[_0xbf9b('0x38')];_0x3971d4[_0xbf9b('0x3c')]=qs[_0xbf9b('0x3d')](_0x36f4c2[_0xbf9b('0x35')]['sort']);_0x3971d4['where']=qs[_0xbf9b('0x3f')](_[_0xbf9b('0x40')](_0x36f4c2[_0xbf9b('0x35')],_0x4a1c53['filters']));if(_0x36f4c2['query'][_0xbf9b('0x41')]){_0x3971d4[_0xbf9b('0x3e')]=_['merge'](_0x3971d4['where'],{'$or':_[_0xbf9b('0x31')](_0x3971d4[_0xbf9b('0x37')],function(_0x5ef324){var _0x38e244={};_0x38e244[_0x5ef324]={'$like':'%'+_0x36f4c2[_0xbf9b('0x35')][_0xbf9b('0x41')]+'%'};return _0x38e244;})});}if(_0x36f4c2[_0xbf9b('0x35')][_0xbf9b('0x5f')]){var _0x433b0a=_0x36f4c2['query'][_0xbf9b('0x5f')][_0xbf9b('0x60')](',');var _0x25c913={};_0x25c913[_0x433b0a[0x0]]={'$gte':moment(_0x433b0a[0x1])[_0xbf9b('0x61')](_0xbf9b('0x62'))};_0x3971d4['where']=_['merge'](_0x3971d4['where'],_0x25c913);}_0x3971d4=_[_0xbf9b('0x42')]({},_0x3971d4,_0x36f4c2[_0xbf9b('0x43')]);return _0x3a0fec['getMessages'](_0x3971d4);}})[_0xbf9b('0x2a')](function(_0x3cc129){if(_0x3cc129){_0x5f2823=_0x3cc129['length'];if(!_0x36f4c2[_0xbf9b('0x35')]['hasOwnProperty'](_0xbf9b('0x5a'))){_0x3971d4[_0xbf9b('0x24')]=qs[_0xbf9b('0x24')](_0x36f4c2[_0xbf9b('0x35')][_0xbf9b('0x24')]);_0x3971d4[_0xbf9b('0x21')]=qs['offset'](_0x36f4c2['query'][_0xbf9b('0x21')]);}return _0x3a0fec[_0xbf9b('0x63')](_0x3971d4);}})[_0xbf9b('0x2a')](function(_0xf1cce5){if(_0xf1cce5){return _0xf1cce5?{'count':_0x5f2823,'rows':_0xf1cce5}:null;}})['then'](respondWithResult(_0x349c6f,null))['catch'](handleError(_0x349c6f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 553b12c..14fdbb9 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 _0xa4a9=['hasOwnProperty','exports','../../mysqldb','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0xa0f722,_0x3f23f9){var _0xf38792=function(_0x94d157){while(--_0x94d157){_0xa0f722['push'](_0xa0f722['shift']());}};_0xf38792(++_0x3f23f9);}(_0xa4a9,0x7a));var _0x9a4a=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0xa4a9[_0x51ab83];return _0x14b6de;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x9a4a('0x0'))['db'][_0x9a4a('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9a4a('0x2')](0x0);var events={'afterCreate':_0x9a4a('0x3'),'afterUpdate':'update','afterDestroy':_0x9a4a('0x4')};function emitEvent(_0x5c0388){return function(_0x2cee09,_0xbe5cb7,_0x2ef3ba){ChatGroupEvents[_0x9a4a('0x5')](_0x5c0388+':'+_0x2cee09['id'],_0x2cee09);ChatGroupEvents['emit'](_0x5c0388,_0x2cee09);_0x2ef3ba(null);};}for(var e in events){if(events[_0x9a4a('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x9a4a('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x685d=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x4fabe0,_0x505145){var _0x385e2c=function(_0x5312bf){while(--_0x5312bf){_0x4fabe0['push'](_0x4fabe0['shift']());}};_0x385e2c(++_0x505145);}(_0x685d,0x143));var _0xd685=function(_0x43832d,_0x55427b){_0x43832d=_0x43832d-0x0;var _0x5757a0=_0x685d[_0x43832d];return _0x5757a0;};'use strict';var EventEmitter=require(_0xd685('0x0'));var ChatGroup=require(_0xd685('0x1'))['db'][_0xd685('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd685('0x3')](0x0);var events={'afterCreate':_0xd685('0x4'),'afterUpdate':_0xd685('0x5'),'afterDestroy':_0xd685('0x6')};function emitEvent(_0xa220a0){return function(_0x1acf84,_0x3c2166,_0x2ae524){ChatGroupEvents[_0xd685('0x7')](_0xa220a0+':'+_0x1acf84['id'],_0x1acf84);ChatGroupEvents[_0xd685('0x7')](_0xa220a0,_0x1acf84);_0x2ae524(null);};}for(var e in events){if(events[_0xd685('0x8')](e)){var event=events[e];ChatGroup[_0xd685('0x9')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index b832c53..3eef1fd 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 _0x8815=['../../config/logger','api','bluebird','path','rimraf','./chatGroup.attributes','define','ChatGroup'];(function(_0x256c5d,_0x4154ce){var _0x279814=function(_0x4e7ea9){while(--_0x4e7ea9){_0x256c5d['push'](_0x256c5d['shift']());}};_0x279814(++_0x4154ce);}(_0x8815,0x78));var _0x5881=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x8815[_0x1bbc08];return _0x5d825b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5881('0x0'))(_0x5881('0x1'));var moment=require('moment');var BPromise=require(_0x5881('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5881('0x3'));var rimraf=require(_0x5881('0x4'));var config=require('../../config/environment');var attributes=require(_0x5881('0x5'));module['exports']=function(_0x3c9475,_0x53ecca){return _0x3c9475[_0x5881('0x6')](_0x5881('0x7'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc35=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x2d4dc8,_0x591909){var _0x2ee36c=function(_0x573664){while(--_0x573664){_0x2d4dc8['push'](_0x2d4dc8['shift']());}};_0x2ee36c(++_0x591909);}(_0xbc35,0x8c));var _0x5bc3=function(_0x45b238,_0x4c8f42){_0x45b238=_0x45b238-0x0;var _0xd6f2a9=_0xbc35[_0x45b238];return _0xd6f2a9;};'use strict';var _=require(_0x5bc3('0x0'));var util=require(_0x5bc3('0x1'));var logger=require(_0x5bc3('0x2'))(_0x5bc3('0x3'));var moment=require(_0x5bc3('0x4'));var BPromise=require(_0x5bc3('0x5'));var rp=require(_0x5bc3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bc3('0x7'));var config=require(_0x5bc3('0x8'));var attributes=require('./chatGroup.attributes');module[_0x5bc3('0x9')]=function(_0x158b48,_0x2b53ec){return _0x158b48[_0x5bc3('0xa')](_0x5bc3('0xb'),attributes,{'tableName':_0x5bc3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 023df9c..f4d160a 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 _0xc73a=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util'];(function(_0xea2c75,_0x4bf4bd){var _0x2bebca=function(_0x2a60f3){while(--_0x2a60f3){_0xea2c75['push'](_0xea2c75['shift']());}};_0x2bebca(++_0x4bf4bd);}(_0xc73a,0x72));var _0xac73=function(_0x223358,_0xc8dd93){_0x223358=_0x223358-0x0;var _0x1b4ad6=_0xc73a[_0x223358];return _0x1b4ad6;};'use strict';var _=require('lodash');var util=require(_0xac73('0x0'));var moment=require(_0xac73('0x1'));var BPromise=require(_0xac73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac73('0x3'))['db'];var utils=require(_0xac73('0x4'));var logger=require(_0xac73('0x5'))('rpc');var config=require(_0xac73('0x6'));var jayson=require(_0xac73('0x7'));var client=jayson[_0xac73('0x8')]['http']({'port':0x232a});config[_0xac73('0x9')]=_[_0xac73('0xa')](config[_0xac73('0x9')],{'host':_0xac73('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac73('0x9')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0xf3b7e6,_0x454f8c,_0x468ee9){return new BPromise(function(_0x1844fe,_0x280be1){return client[_0xac73('0xc')](_0xf3b7e6,_0x468ee9)[_0xac73('0xd')](function(_0x2c8bfa){logger['info'](_0xac73('0xe'),_0x454f8c,_0xac73('0xf'));logger[_0xac73('0x10')](_0xac73('0x11'),_0x454f8c,_0xac73('0xf'),JSON[_0xac73('0x12')](_0x2c8bfa));if(_0x2c8bfa['error']){if(_0x2c8bfa[_0xac73('0x13')]['code']===0x1f4){logger[_0xac73('0x13')](_0xac73('0xe'),_0x454f8c,_0x2c8bfa[_0xac73('0x13')][_0xac73('0x14')]);return _0x280be1(_0x2c8bfa['error'][_0xac73('0x14')]);}logger[_0xac73('0x13')]('ChatGroup,\x20%s,\x20%s',_0x454f8c,_0x2c8bfa[_0xac73('0x13')][_0xac73('0x14')]);return _0x1844fe(_0x2c8bfa[_0xac73('0x13')]['message']);}else{logger[_0xac73('0x15')](_0xac73('0xe'),_0x454f8c,_0xac73('0xf'));_0x1844fe(_0x2c8bfa[_0xac73('0x16')][_0xac73('0x14')]);}})['catch'](function(_0x1e2bfd){logger[_0xac73('0x13')]('ChatGroup,\x20%s,\x20%s',_0x454f8c,_0x1e2bfd);_0x280be1(_0x1e2bfd);});});} \ No newline at end of file +var _0x84cb=['redis','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x1d9fbc,_0x6a62f3){var _0x50e7e0=function(_0x4e0c6c){while(--_0x4e0c6c){_0x1d9fbc['push'](_0x1d9fbc['shift']());}};_0x50e7e0(++_0x6a62f3);}(_0x84cb,0xf8));var _0xb84c=function(_0x586106,_0x23eba5){_0x586106=_0x586106-0x0;var _0x6be57f=_0x84cb[_0x586106];return _0x6be57f;};'use strict';var _=require(_0xb84c('0x0'));var util=require('util');var moment=require(_0xb84c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb84c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84c('0x3'))['db'];var utils=require(_0xb84c('0x4'));var logger=require(_0xb84c('0x5'))(_0xb84c('0x6'));var config=require(_0xb84c('0x7'));var jayson=require(_0xb84c('0x8'));var client=jayson[_0xb84c('0x9')][_0xb84c('0xa')]({'port':0x232a});config['redis']=_[_0xb84c('0xb')](config[_0xb84c('0xc')],{'host':_0xb84c('0xd'),'port':0x18eb});var socket=require(_0xb84c('0xe'))(new Redis(config[_0xb84c('0xc')]));require(_0xb84c('0xf'))[_0xb84c('0x10')](socket);function respondWithRpcPromise(_0x553ed8,_0x186a92,_0xcf6fb4){return new BPromise(function(_0x2a3523,_0x19fadc){return client['request'](_0x553ed8,_0xcf6fb4)[_0xb84c('0x11')](function(_0x46d08b){logger[_0xb84c('0x12')](_0xb84c('0x13'),_0x186a92,_0xb84c('0x14'));logger[_0xb84c('0x15')](_0xb84c('0x16'),_0x186a92,'request\x20sent',JSON['stringify'](_0x46d08b));if(_0x46d08b[_0xb84c('0x17')]){if(_0x46d08b['error'][_0xb84c('0x18')]===0x1f4){logger[_0xb84c('0x17')](_0xb84c('0x13'),_0x186a92,_0x46d08b[_0xb84c('0x17')]['message']);return _0x19fadc(_0x46d08b[_0xb84c('0x17')]['message']);}logger[_0xb84c('0x17')](_0xb84c('0x13'),_0x186a92,_0x46d08b['error'][_0xb84c('0x19')]);return _0x2a3523(_0x46d08b[_0xb84c('0x17')][_0xb84c('0x19')]);}else{logger[_0xb84c('0x12')](_0xb84c('0x13'),_0x186a92,_0xb84c('0x14'));_0x2a3523(_0x46d08b['result']['message']);}})['catch'](function(_0x565c37){logger['error']('ChatGroup,\x20%s,\x20%s',_0x186a92,_0x565c37);_0x19fadc(_0x565c37);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 08f122a..d70c578 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 _0x6548=['./chatGroup.events','save','remove','emit','removeListener','register','chatGroup:'];(function(_0x21d78c,_0x353407){var _0x215754=function(_0x2e1163){while(--_0x2e1163){_0x21d78c['push'](_0x21d78c['shift']());}};_0x215754(++_0x353407);}(_0x6548,0x118));var _0x8654=function(_0x1c9219,_0x46a66b){_0x1c9219=_0x1c9219-0x0;var _0x112897=_0x6548[_0x1c9219];return _0x112897;};'use strict';var ChatGroupEvents=require(_0x8654('0x0'));var events=[_0x8654('0x1'),_0x8654('0x2'),'update'];function createListener(_0x533bd8,_0x2e4c86){return function(_0x5efeb7){_0x2e4c86[_0x8654('0x3')](_0x533bd8,_0x5efeb7);};}function removeListener(_0x123c7f,_0x5888a3){return function(){ChatGroupEvents[_0x8654('0x4')](_0x123c7f,_0x5888a3);};}exports[_0x8654('0x5')]=function(_0x313a){for(var _0x233f36=0x0,_0x45b6a7=events['length'];_0x233f36<_0x45b6a7;_0x233f36++){var _0x562201=events[_0x233f36];var _0x561062=createListener(_0x8654('0x6')+_0x562201,_0x313a);ChatGroupEvents['on'](_0x562201,_0x561062);}}; \ No newline at end of file +var _0x2112=['removeListener','length','./chatGroup.events','remove','update','emit'];(function(_0x5e4d4d,_0x5a5aa6){var _0x40cbd6=function(_0x53c522){while(--_0x53c522){_0x5e4d4d['push'](_0x5e4d4d['shift']());}};_0x40cbd6(++_0x5a5aa6);}(_0x2112,0x68));var _0x2211=function(_0x1c7e9a,_0x451336){_0x1c7e9a=_0x1c7e9a-0x0;var _0x2be451=_0x2112[_0x1c7e9a];return _0x2be451;};'use strict';var ChatGroupEvents=require(_0x2211('0x0'));var events=['save',_0x2211('0x1'),_0x2211('0x2')];function createListener(_0x3d95de,_0x767881){return function(_0x1b1add){_0x767881[_0x2211('0x3')](_0x3d95de,_0x1b1add);};}function removeListener(_0x495186,_0x273613){return function(){ChatGroupEvents[_0x2211('0x4')](_0x495186,_0x273613);};}exports['register']=function(_0x1477b7){for(var _0x98987b=0x0,_0x184c1c=events[_0x2211('0x5')];_0x98987b<_0x184c1c;_0x98987b++){var _0x190cac=events[_0x98987b];var _0x4f0eaf=createListener('chatGroup:'+_0x190cac,_0x1477b7);ChatGroupEvents['on'](_0x190cac,_0x4f0eaf);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 37d77a3..9b8d9de 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 _0x960c=['addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers'];(function(_0x42eca2,_0x5e2e70){var _0x2a9e4c=function(_0x4d74e5){while(--_0x4d74e5){_0x42eca2['push'](_0x42eca2['shift']());}};_0x2a9e4c(++_0x5e2e70);}(_0x960c,0xbb));var _0xc960=function(_0x2122aa,_0x113985){_0x2122aa=_0x2122aa-0x0;var _0x1f1bc6=_0x960c[_0x2122aa];return _0x1f1bc6;};'use strict';var multer=require(_0xc960('0x0'));var util=require(_0xc960('0x1'));var path=require(_0xc960('0x2'));var timeout=require(_0xc960('0x3'));var express=require(_0xc960('0x4'));var router=express[_0xc960('0x5')]();var fs_extra=require(_0xc960('0x6'));var auth=require(_0xc960('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc960('0x8'));router[_0xc960('0x9')]('/',auth[_0xc960('0xa')](),controller[_0xc960('0xb')]);router[_0xc960('0x9')]('/describe',auth[_0xc960('0xa')](),controller[_0xc960('0xc')]);router[_0xc960('0x9')](_0xc960('0xd'),auth['isAuthenticated'](),controller[_0xc960('0xe')]);router[_0xc960('0x9')](_0xc960('0xf'),auth[_0xc960('0xa')](),controller[_0xc960('0x10')]);router[_0xc960('0x9')](_0xc960('0x11'),auth[_0xc960('0xa')](),controller[_0xc960('0x12')]);router[_0xc960('0x9')](_0xc960('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0xc960('0x14')]('/',auth[_0xc960('0xa')](),controller[_0xc960('0x15')]);router['post'](_0xc960('0x11'),auth[_0xc960('0xa')](),controller[_0xc960('0x16')]);router['post'](_0xc960('0x13'),auth[_0xc960('0xa')](),controller[_0xc960('0x17')]);router[_0xc960('0x18')](_0xc960('0xd'),auth['isAuthenticated'](),controller[_0xc960('0x19')]);router[_0xc960('0x1a')](_0xc960('0xd'),auth[_0xc960('0xa')](),controller[_0xc960('0x1b')]);router['delete']('/:id/members',auth[_0xc960('0xa')](),controller[_0xc960('0x1c')]);module[_0xc960('0x1d')]=router; \ No newline at end of file +var _0x5a57=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','delete','destroy','removeMembers','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x5ed11c,_0x165512){var _0x433303=function(_0x33971a){while(--_0x33971a){_0x5ed11c['push'](_0x5ed11c['shift']());}};_0x433303(++_0x165512);}(_0x5a57,0x13f));var _0x75a5=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x5a57[_0x40bffc];return _0x3007e9;};'use strict';var multer=require(_0x75a5('0x0'));var util=require('util');var path=require(_0x75a5('0x1'));var timeout=require(_0x75a5('0x2'));var express=require('express');var router=express[_0x75a5('0x3')]();var fs_extra=require(_0x75a5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75a5('0x5'));var config=require(_0x75a5('0x6'));var controller=require('./chatGroup.controller');router[_0x75a5('0x7')]('/',auth[_0x75a5('0x8')](),controller['index']);router['get'](_0x75a5('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x75a5('0x7')](_0x75a5('0xa'),auth['isAuthenticated'](),controller[_0x75a5('0xb')]);router['get'](_0x75a5('0xc'),auth['isAuthenticated'](),controller[_0x75a5('0xd')]);router[_0x75a5('0x7')](_0x75a5('0xe'),auth[_0x75a5('0x8')](),controller[_0x75a5('0xf')]);router[_0x75a5('0x7')](_0x75a5('0x10'),auth['isAuthenticated'](),controller[_0x75a5('0x11')]);router[_0x75a5('0x12')]('/',auth['isAuthenticated'](),controller[_0x75a5('0x13')]);router[_0x75a5('0x12')](_0x75a5('0xe'),auth['isAuthenticated'](),controller[_0x75a5('0x14')]);router[_0x75a5('0x12')](_0x75a5('0x10'),auth[_0x75a5('0x8')](),controller[_0x75a5('0x15')]);router[_0x75a5('0x16')](_0x75a5('0xa'),auth[_0x75a5('0x8')](),controller['update']);router[_0x75a5('0x17')](_0x75a5('0xa'),auth[_0x75a5('0x8')](),controller[_0x75a5('0x18')]);router[_0x75a5('0x17')]('/:id/members',auth['isAuthenticated'](),controller[_0x75a5('0x19')]);module[_0x75a5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 87b3787..0c1a643 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 _0x4157=['DATE','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING'];(function(_0x56216f,_0x51c5e6){var _0x156930=function(_0x5b7802){while(--_0x5b7802){_0x56216f['push'](_0x56216f['shift']());}};_0x156930(++_0x51c5e6);}(_0x4157,0xf3));var _0x7415=function(_0x2c5081,_0x970714){_0x2c5081=_0x2c5081-0x0;var _0x569ad4=_0x4157[_0x2c5081];return _0x569ad4;};'use strict';var Sequelize=require(_0x7415('0x0'));module[_0x7415('0x1')]={'closed':{'type':Sequelize[_0x7415('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7415('0x3')]},'ratingType':{'type':Sequelize[_0x7415('0x4')]('star',_0x7415('0x5')),'defaultValue':_0x7415('0x6')},'ratingMessage':{'type':Sequelize[_0x7415('0x7')]},'pathTranscript':{'type':Sequelize[_0x7415('0x7')]},'mailTranscript':{'type':Sequelize[_0x7415('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7415('0x9')]},'disposition':{'type':Sequelize[_0x7415('0x8')]},'secondDisposition':{'type':Sequelize[_0x7415('0x8')]},'thirdDisposition':{'type':Sequelize[_0x7415('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x7415('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x7415('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x7415('0x8')]},'deviceVendor':{'type':Sequelize[_0x7415('0x8')]},'deviceType':{'type':Sequelize[_0x7415('0x8')]},'referer':{'type':Sequelize[_0x7415('0x7')]},'customerIp':{'type':Sequelize[_0x7415('0x8')]},'formData':{'type':Sequelize[_0x7415('0x7')](_0x7415('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x7415('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x7415('0x4')]('in',_0x7415('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7415('0x8')]},'customerPort':{'type':Sequelize[_0x7415('0x8')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x7415('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x174b=['STRING','out','BOOLEAN','sequelize','INTEGER','ENUM','star','thumb','TEXT','DATE'];(function(_0x486569,_0x1897ef){var _0x394683=function(_0x208a4a){while(--_0x208a4a){_0x486569['push'](_0x486569['shift']());}};_0x394683(++_0x1897ef);}(_0x174b,0x19d));var _0xb174=function(_0x89e3bc,_0x4298cd){_0x89e3bc=_0x89e3bc-0x0;var _0x26a433=_0x174b[_0x89e3bc];return _0x26a433;};'use strict';var Sequelize=require(_0xb174('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb174('0x1')]},'ratingType':{'type':Sequelize[_0xb174('0x2')](_0xb174('0x3'),_0xb174('0x4')),'defaultValue':_0xb174('0x3')},'ratingMessage':{'type':Sequelize[_0xb174('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb174('0x6')]},'disposition':{'type':Sequelize[_0xb174('0x7')]},'secondDisposition':{'type':Sequelize[_0xb174('0x7')]},'thirdDisposition':{'type':Sequelize[_0xb174('0x7')]},'note':{'type':Sequelize[_0xb174('0x7')]},'browserName':{'type':Sequelize[_0xb174('0x7')]},'browserVersion':{'type':Sequelize[_0xb174('0x7')]},'osName':{'type':Sequelize[_0xb174('0x7')]},'osVersion':{'type':Sequelize[_0xb174('0x7')]},'deviceModel':{'type':Sequelize[_0xb174('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xb174('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xb174('0x7')]},'formData':{'type':Sequelize[_0xb174('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xb174('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb174('0x2')]('in',_0xb174('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xb174('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xb174('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xb174('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c7ec647..b7b975a 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 _0xa436=['request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','update','destroy','stack','name','send','render','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','type','key','getOptions','chat','user','params','model','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','basename','file','filename','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','User','ContactId','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','keys','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','findAll','addTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','server','transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createWriteStream','value','renderFile','downloadInteraction.ejs','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client'];(function(_0x156798,_0x506dd1){var _0x381210=function(_0x296c75){while(--_0x296c75){_0x156798['push'](_0x156798['shift']());}};_0x381210(++_0x506dd1);}(_0xa436,0x194));var _0x6a43=function(_0x4625c5,_0x390e54){_0x4625c5=_0x4625c5-0x0;var _0x402364=_0xa436[_0x4625c5];return _0x402364;};'use strict';var rimraf=require(_0x6a43('0x0'));var zipdir=require(_0x6a43('0x1'));var rp=require('request-promise');var moment=require(_0x6a43('0x2'));var BPromise=require(_0x6a43('0x3'));var Mustache=require(_0x6a43('0x4'));var util=require(_0x6a43('0x5'));var path=require(_0x6a43('0x6'));var ejs=require(_0x6a43('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x6a43('0x8'));var interaction=require(_0x6a43('0x9'));var qs=require(_0x6a43('0xa'));var pdf=require(_0x6a43('0xb'));var logger=require(_0x6a43('0xc'))(_0x6a43('0xd'));var config=require(_0x6a43('0xe'));var db=require('../../mysqldb')['db'];config[_0x6a43('0xf')]=_[_0x6a43('0x10')](config[_0x6a43('0xf')],{'host':_0x6a43('0x11'),'port':0x18eb});var socket=require(_0x6a43('0x12'))(new Redis(config[_0x6a43('0xf')]));require(_0x6a43('0x13'))[_0x6a43('0x14')](socket);var jayson=require(_0x6a43('0x15'));var client=jayson['client'][_0x6a43('0x16')]({'port':0x232b});var client9004=jayson[_0x6a43('0x17')][_0x6a43('0x16')]({'port':0x232c});function respondWithRpcPromise(_0xaf9833,_0x5ea53d,_0x2f59d9,_0x112348){return new BPromise(function(_0x38f775,_0x4c30bd){var _0x6e4f88=_0x112348||client;return _0x6e4f88[_0x6a43('0x18')](_0xaf9833,_0x2f59d9)[_0x6a43('0x19')](function(_0x3f4d53){logger[_0x6a43('0x1a')](_0x6a43('0x1b'),_0x5ea53d,_0x6a43('0x1c'));logger[_0x6a43('0x1d')](_0x6a43('0x1e'),_0x5ea53d,_0x6a43('0x1c'),JSON[_0x6a43('0x1f')](_0x3f4d53));if(_0x3f4d53[_0x6a43('0x20')]){if(_0x3f4d53[_0x6a43('0x20')][_0x6a43('0x21')]===0x1f4){logger[_0x6a43('0x20')](_0x6a43('0x1b'),_0x5ea53d,_0x3f4d53['error'][_0x6a43('0x22')]);return _0x4c30bd(_0x3f4d53[_0x6a43('0x20')]['message']);}logger[_0x6a43('0x20')](_0x6a43('0x1b'),_0x5ea53d,_0x3f4d53[_0x6a43('0x20')][_0x6a43('0x22')]);return _0x38f775(_0x3f4d53['error'][_0x6a43('0x22')]);}else{logger[_0x6a43('0x1a')](_0x6a43('0x1b'),_0x5ea53d,_0x6a43('0x1c'));_0x38f775(_0x3f4d53[_0x6a43('0x23')]['message']);}})[_0x6a43('0x24')](function(_0x4f4593){logger[_0x6a43('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x5ea53d,_0x4f4593);_0x4c30bd(_0x4f4593);});});}function respondWithStatusCode(_0x1531f3,_0x17ee77){_0x17ee77=_0x17ee77||0xcc;return function(_0x139b9d){if(_0x139b9d){return _0x1531f3[_0x6a43('0x25')](_0x17ee77);}return _0x1531f3[_0x6a43('0x26')](_0x17ee77)[_0x6a43('0x27')]();};}function respondWithResult(_0x4c703a,_0x4eec4b){_0x4eec4b=_0x4eec4b||0xc8;return function(_0x42b414){if(_0x42b414){return _0x4c703a[_0x6a43('0x26')](_0x4eec4b)[_0x6a43('0x28')](_0x42b414);}};}function respondWithFilteredResult(_0x234e17,_0x539021){return function(_0x59ff88){if(_0x59ff88){var _0x386f0c=typeof _0x539021[_0x6a43('0x29')]==='undefined'&&typeof _0x539021[_0x6a43('0x2a')]===_0x6a43('0x2b');var _0x5179d8=_0x59ff88['count'];var _0x53de6a=_0x386f0c?0x0:_0x539021['offset'];var _0x583ba6=_0x386f0c?_0x59ff88[_0x6a43('0x2c')]:_0x539021[_0x6a43('0x29')]+_0x539021[_0x6a43('0x2a')];var _0x9d38ca;if(_0x583ba6>=_0x5179d8){_0x583ba6=_0x5179d8;_0x9d38ca=0xc8;}else{_0x9d38ca=0xce;}_0x234e17['status'](_0x9d38ca);return _0x234e17[_0x6a43('0x2d')]('Content-Range',_0x53de6a+'-'+_0x583ba6+'/'+_0x5179d8)[_0x6a43('0x28')](_0x59ff88);}return null;};}function saveUpdates(_0xeae1cc){return function(_0x37a7fe){if(_0x37a7fe){return _0x37a7fe[_0x6a43('0x2e')](_0xeae1cc)['then'](function(_0x4706d9){return _0x4706d9;});}return null;};}function removeEntity(_0x44763a){return function(_0x284c99){if(_0x284c99){return _0x284c99[_0x6a43('0x2f')]()[_0x6a43('0x19')](function(){_0x44763a[_0x6a43('0x26')](0xcc)[_0x6a43('0x27')]();});}};}function handleEntityNotFound(_0x1f13d0){return function(_0x583447){if(!_0x583447){_0x1f13d0[_0x6a43('0x25')](0x194);}return _0x583447;};}function handleError(_0x361df7,_0x2cd984){_0x2cd984=_0x2cd984||0x1f4;return function(_0x25fc0b){logger[_0x6a43('0x20')](_0x25fc0b[_0x6a43('0x30')]);if(_0x25fc0b[_0x6a43('0x31')]){delete _0x25fc0b[_0x6a43('0x31')];}_0x361df7[_0x6a43('0x26')](_0x2cd984)[_0x6a43('0x32')](_0x25fc0b);};}function getMustacheRender(_0x5ec147,_0x259191){return Mustache[_0x6a43('0x33')](_0x5ec147,_['merge'](_0x259191[_0x6a43('0x34')],{'contact':_0x259191[_0x6a43('0x35')],'message':_0x259191[_0x6a43('0x22')],'agent':_0x259191[_0x6a43('0x36')],'interaction':_0x259191[_0x6a43('0x37')],'account':_0x259191[_0x6a43('0x38')]}))||'';}exports[_0x6a43('0x39')]=function(_0x56a7b2,_0x57ce35){var _0x3faa4a={};var _0xaeebfd=_[_0x6a43('0x3a')](db[_0x6a43('0x3b')][_0x6a43('0x3c')],function(_0x266479){return{'name':_0x266479['fieldName'],'type':_0x266479[_0x6a43('0x3d')][_0x6a43('0x3e')]};});_0x3faa4a=qs[_0x6a43('0x3f')](_0xaeebfd,_0x56a7b2);return interaction['findAll'](_0x6a43('0x40'),_0x56a7b2['query'],_0x56a7b2[_0x6a43('0x41')],_0x3faa4a,_0xaeebfd)[_0x6a43('0x19')](respondWithFilteredResult(_0x57ce35,_0x3faa4a))[_0x6a43('0x24')](handleError(_0x57ce35,null));};exports['show']=function(_0x505803,_0x145e04){var _0x494b56={'raw':![],'where':{'id':_0x505803[_0x6a43('0x42')]['id']}},_0x4fea20={};_0x4fea20[_0x6a43('0x43')]=_['keys'](db[_0x6a43('0x3b')][_0x6a43('0x3c')]);_0x4fea20[_0x6a43('0x44')]=_['keys'](_0x505803['query']);_0x4fea20[_0x6a43('0x45')]=_['intersection'](_0x4fea20[_0x6a43('0x43')],_0x4fea20[_0x6a43('0x44')]);_0x494b56[_0x6a43('0x46')]=_[_0x6a43('0x47')](_0x4fea20[_0x6a43('0x43')],qs[_0x6a43('0x48')](_0x505803[_0x6a43('0x44')][_0x6a43('0x48')]));_0x494b56[_0x6a43('0x46')]=_0x494b56[_0x6a43('0x46')][_0x6a43('0x49')]?_0x494b56[_0x6a43('0x46')]:_0x4fea20[_0x6a43('0x43')];if(_0x505803[_0x6a43('0x44')][_0x6a43('0x4a')]){_0x494b56[_0x6a43('0x4b')]=[{'all':!![]}];}_0x494b56=_[_0x6a43('0x4c')]({},_0x494b56,_0x505803[_0x6a43('0x4d')]);return db[_0x6a43('0x3b')][_0x6a43('0x4e')](_0x494b56)['then'](handleEntityNotFound(_0x145e04,null))[_0x6a43('0x19')](respondWithResult(_0x145e04,null))[_0x6a43('0x24')](handleError(_0x145e04,null));};exports[_0x6a43('0x4f')]=function(_0xa68c53,_0x355a95){return db['ChatInteraction'][_0x6a43('0x4f')](_0xa68c53[_0x6a43('0x34')],{})['then'](respondWithResult(_0x355a95,0xc9))['catch'](handleError(_0x355a95,null));};exports['update']=function(_0x125834,_0x17fa2b){if(_0x125834[_0x6a43('0x34')]['id']){delete _0x125834['body']['id'];}return db['ChatInteraction'][_0x6a43('0x4e')]({'where':{'id':_0x125834[_0x6a43('0x42')]['id']}})[_0x6a43('0x19')](handleEntityNotFound(_0x17fa2b,null))[_0x6a43('0x19')](saveUpdates(_0x125834[_0x6a43('0x34')],null))[_0x6a43('0x19')](respondWithResult(_0x17fa2b,null))[_0x6a43('0x24')](handleError(_0x17fa2b,null));};exports[_0x6a43('0x2f')]=function(_0x3f6db9,_0x581dd2){return db[_0x6a43('0x3b')][_0x6a43('0x4e')]({'where':{'id':_0x3f6db9['params']['id']}})[_0x6a43('0x19')](handleEntityNotFound(_0x581dd2,null))[_0x6a43('0x19')](removeEntity(_0x581dd2,null))[_0x6a43('0x24')](handleError(_0x581dd2,null));};exports['describe']=function(_0x3f94f5,_0x53224d){return db[_0x6a43('0x3b')][_0x6a43('0x50')]()[_0x6a43('0x19')](respondWithResult(_0x53224d,null))[_0x6a43('0x24')](handleError(_0x53224d,null));};exports[_0x6a43('0x51')]=function(_0x81ae81,_0x318079){var _0x8acd2b=_0x81ae81[_0x6a43('0x42')]['id'];var _0x3d26d8;var _0x4cbe97;var _0x14fb77;return db[_0x6a43('0x3b')][_0x6a43('0x52')]({'where':{'id':_0x8acd2b}})[_0x6a43('0x19')](function(_0x2a1b8f){_0x3d26d8=_0x2a1b8f;return db[_0x6a43('0x53')]['findOne']({'where':{'id':_0x2a1b8f[_0x6a43('0x54')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x6a43('0x55'),_0x6a43('0x56'),_0x6a43('0x57')],'raw':!![]});})['then'](function(_0x5d9393){if(_0x5d9393&&_0x5d9393['vidaooApiKey']&&_0x5d9393[_0x6a43('0x58')]){_0x4cbe97=_0x5d9393;var _0x3a0bc7={'interaction':{'id':_0x8acd2b},'agent':{'id':_0x81ae81['user']['id'],'name':_0x81ae81[_0x6a43('0x41')][_0x6a43('0x31')],'fullname':_0x81ae81[_0x6a43('0x41')][_0x6a43('0x59')],'email':_0x81ae81[_0x6a43('0x41')]['email']},'contact':_0x81ae81[_0x6a43('0x34')][_0x6a43('0x35')],'account':_0x81ae81[_0x6a43('0x34')][_0x6a43('0x38')]};var _0x5930af={'rejectUnauthorized':![],'method':_0x6a43('0x5a'),'url':_0x6a43('0x5b'),'headers':{'X-APIKEY':_0x5d9393['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x81ae81['user'][_0x6a43('0x5c')]],'buttons':null,'topic':_0x4cbe97[_0x6a43('0x55')],'note':_[_0x6a43('0x5d')](_0x4cbe97['vidaooNote'])?null:getMustacheRender(_0x4cbe97['vidaooNote'],_0x3a0bc7),'metadata':null},'redirect':_0x6a43('0x5e'),'json':!![]};try{if(!_[_0x6a43('0x5d')](_0x4cbe97[_0x6a43('0x57')])){var _0x4d7f3a=getMustacheRender(_0x4cbe97[_0x6a43('0x57')],_0x3a0bc7);var _0x4ae262=JSON[_0x6a43('0x5f')](_0x4d7f3a);_0x5930af[_0x6a43('0x34')]['metadata']=_0x4ae262;}}catch(_0xaf10e7){throw new db[(_0x6a43('0x60'))]['ValidationError'](_0x6a43('0x61'));}return rp(_0x5930af);}else{throw new db[(_0x6a43('0x60'))][(_0x6a43('0x62'))](_0x6a43('0x63'));}})[_0x6a43('0x19')](function(_0x510669){_0x14fb77=_0x510669;if(_0x14fb77['id']){var _0xc0998={'body':_0x14fb77['join_url'],'ChatWebsiteId':_0x4cbe97['id'],'ChatInteractionId':_0x3d26d8['id'],'direction':_0x6a43('0x64'),'UserId':_0x81ae81[_0x6a43('0x41')]['id']};return db[_0x6a43('0x65')][_0x6a43('0x4f')](_0xc0998,{});}else{throw new db[(_0x6a43('0x60'))]['ValidationError'](_0x6a43('0x66'));}})['then'](function(){return _0x3d26d8[_0x6a43('0x67')]({'vidaooSessionId':_0x14fb77['id']});})[_0x6a43('0x19')](respondWithResult(_0x318079,null))['catch'](handleError(_0x318079,null));};exports[_0x6a43('0x68')]=function(_0x28dd76,_0x3f2cd8){if(_0x28dd76[_0x6a43('0x34')]['id']){delete _0x28dd76[_0x6a43('0x34')]['id'];}return db[_0x6a43('0x3b')][_0x6a43('0x4e')]({'where':{'id':_0x28dd76[_0x6a43('0x42')]['id']},'include':[{'model':db[_0x6a43('0x69')],'as':_0x6a43('0x6a')}]})[_0x6a43('0x19')](handleEntityNotFound(_0x3f2cd8,null))[_0x6a43('0x19')](saveUpdates(_0x28dd76[_0x6a43('0x34')],null))[_0x6a43('0x19')](respondWithResult(_0x3f2cd8,null))[_0x6a43('0x24')](handleError(_0x3f2cd8,null));};exports['abandon']=function(_0x79d690,_0xd04de0){if(_0x79d690[_0x6a43('0x34')]['id']){delete _0x79d690[_0x6a43('0x34')]['id'];}return db[_0x6a43('0x3b')][_0x6a43('0x4e')]({'where':{'id':_0x79d690[_0x6a43('0x42')]['id']}})[_0x6a43('0x19')](function(_0x2c8d2e){if(!_0x2c8d2e){logger[_0x6a43('0x20')](_0x6a43('0x6b'),'abandon',0x194,'entity\x20not\x20found');_0xd04de0['sendStatus'](0x194);}else{if(_0x2c8d2e[_0x6a43('0x6c')]){throw new db[(_0x6a43('0x60'))]['ValidationError'](_0x6a43('0x6d'));}}return _0x2c8d2e;})[_0x6a43('0x19')](function(_0x5c58fb){if(_0x5c58fb){return _0x5c58fb['update']({'closed':_0x79d690['body'][_0x6a43('0x6e')],'disposition':_0x79d690[_0x6a43('0x34')][_0x6a43('0x6f')]})[_0x6a43('0x19')](function(_0x535227){return _0x535227;});}})[_0x6a43('0x19')](function(){return respondWithRpcPromise(_0x6a43('0x70'),_0x6a43('0x71'),_0x79d690[_0x6a43('0x34')],client9004);})[_0x6a43('0x19')](respondWithResult(_0xd04de0,null))['catch'](handleError(_0xd04de0,null));};exports[_0x6a43('0x72')]=function(_0x5de588,_0x9e1ac9){_0x5de588[_0x6a43('0x34')][_0x6a43('0x31')]=_0x5de588['file']['originalname'];_0x5de588[_0x6a43('0x34')][_0x6a43('0x73')]=_0x5de588[_0x6a43('0x74')][_0x6a43('0x75')];_0x5de588[_0x6a43('0x34')][_0x6a43('0x3d')]=_0x5de588[_0x6a43('0x74')]['mimetype'];return db[_0x6a43('0x76')][_0x6a43('0x4f')](_0x5de588[_0x6a43('0x34')])['then'](respondWithResult(_0x9e1ac9,0xc9))[_0x6a43('0x24')](handleError(_0x9e1ac9,null));};exports['attachmentDownload']=function(_0x153963,_0x350935){return db[_0x6a43('0x3b')][_0x6a43('0x52')]({'where':{'id':_0x153963['params']['id']},'raw':!![]})[_0x6a43('0x19')](handleEntityNotFound(_0x350935,null))[_0x6a43('0x19')](function(_0x2bf84f){if(_0x2bf84f){if(_0x2bf84f[_0x6a43('0x6e')]){return _0x350935[_0x6a43('0x26')](0x193)[_0x6a43('0x28')]({'status':0x193,'message':_0x6a43('0x77')});}return db[_0x6a43('0x76')][_0x6a43('0x52')]({'where':{'id':_0x153963[_0x6a43('0x44')][_0x6a43('0x78')]},'raw':!![]})[_0x6a43('0x19')](handleEntityNotFound(_0x350935,null));}})[_0x6a43('0x19')](function(_0x2ad16a){if(_0x2ad16a){var _0x346f99=_0x2ad16a[_0x6a43('0x79')]!==null;var _0x149e76=path[_0x6a43('0x7a')](config[_0x6a43('0x7b')],_0x6a43('0x7c'));if(_0x346f99){_0x149e76=path[_0x6a43('0x7a')](_0x149e76,_0x6a43('0x7d'));}var _0x32a36c=path[_0x6a43('0x7a')](_0x149e76,_0x2ad16a[_0x6a43('0x73')]);return _0x350935[_0x6a43('0x7e')](_0x32a36c);}})[_0x6a43('0x24')](handleError(_0x350935,null));};exports[_0x6a43('0x7f')]=function(_0x3ff1c0,_0x4a5782){var _0x3f8508=null;var _0x587bf7=null;var _0x157d93=null;if(_0x3ff1c0[_0x6a43('0x34')]['id']){delete _0x3ff1c0['body']['id'];}if(_0x3ff1c0['body'][_0x6a43('0x80')]){_0x157d93=path[_0x6a43('0x7a')](config[_0x6a43('0x7b')],'server/files/chat/upload/',util[_0x6a43('0x81')](_0x6a43('0x82'),Date[_0x6a43('0x83')]()));_0x3ff1c0[_0x6a43('0x34')][_0x6a43('0x84')]=_0x157d93;}return db[_0x6a43('0x3b')][_0x6a43('0x4e')]({'where':{'id':_0x3ff1c0[_0x6a43('0x42')]['id']},'include':[{'model':db[_0x6a43('0x65')],'as':'Messages','include':[{'model':db[_0x6a43('0x85')],'as':_0x6a43('0x85')}]}]})['then'](handleEntityNotFound(_0x4a5782,null))['then'](saveUpdates(_0x3ff1c0[_0x6a43('0x34')],null))[_0x6a43('0x19')](function(_0x353459){if(_0x353459){_0x3f8508=_0x353459;return db[_0x6a43('0x53')]['find']({'where':{'id':_0x3f8508[_0x6a43('0x54')]}});}})[_0x6a43('0x19')](function(_0x3eec5f){if(_0x3eec5f){_0x587bf7=_0x3eec5f;return db[_0x6a43('0x69')][_0x6a43('0x4e')]({'where':{'id':_0x3f8508[_0x6a43('0x86')]}});}})[_0x6a43('0x19')](function(_0x452b2f){if(_0x452b2f){if(_0x157d93){var _0x57ccee=null;for(var _0xb9b88f=0x1;_0xb9b88f<_0x3f8508[_0x6a43('0x87')]['length'];++_0xb9b88f){_0x57ccee=_0x3f8508[_0x6a43('0x87')][_0xb9b88f];var _0x14863c=_0x57ccee[_0x6a43('0x6c')]?util[_0x6a43('0x81')](_0x6a43('0x88'),_0x587bf7[_0x6a43('0x89')],_0x57ccee['UserId']):_0x6a43('0x8a');var _0x236d61=_0x3ff1c0[_0x6a43('0x34')][_0x6a43('0x8b')]||util[_0x6a43('0x81')]('%s%d',_0x6a43('0x8c'),_0x57ccee[_0x6a43('0x86')]);switch(_0x587bf7[_0x6a43('0x8d')]){case _0x6a43('0x8e'):_0x14863c=_0x57ccee[_0x6a43('0x6c')]?util[_0x6a43('0x81')]('%s%d',_0x587bf7[_0x6a43('0x89')],_0x57ccee[_0x6a43('0x6c')]):_0x6a43('0x8a');break;case _0x6a43('0x8f'):_0x14863c=_0x57ccee['UserId']?_0x57ccee[_0x6a43('0x85')][_0x6a43('0x90')]||_0x57ccee['User']['fullname']:_0x6a43('0x8a');break;case _0x6a43('0x91'):_0x14863c=_0x57ccee[_0x6a43('0x6c')]?_0x57ccee[_0x6a43('0x85')][_0x6a43('0x59')]:_0x6a43('0x8a');break;default:_0x14863c=_0x57ccee[_0x6a43('0x6c')]?util[_0x6a43('0x81')](_0x6a43('0x88'),_0x587bf7[_0x6a43('0x89')],_0x57ccee[_0x6a43('0x6c')]):_0x6a43('0x8a');}var _0x5c2fbb=util['format'](_0x6a43('0x92'),moment(_0x57ccee[_0x6a43('0x93')])[_0x6a43('0x81')](_0x6a43('0x94')),_0x57ccee[_0x6a43('0x95')]==='in'?_0x236d61:_0x14863c,_0x57ccee['body']);if(!_0x57ccee[_0x6a43('0x96')]){fs['appendFileSync'](_0x157d93,_0x5c2fbb);}}return db[_0x6a43('0x97')][_0x6a43('0x52')]({'where':{'service':!![]},'include':[{'model':db[_0x6a43('0x98')],'as':_0x6a43('0x99'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6a43('0x9a'),'raw':!![]}]}]});}}})[_0x6a43('0x19')](function(_0x1d86d0){if(!_0x1d86d0||!_0x1d86d0[_0x6a43('0x99')]||!_0x3ff1c0[_0x6a43('0x34')])return _0x3f8508;var _0x27e206=_0x1d86d0[_0x6a43('0x9b')]();return respondWithRpcPromise(_0x6a43('0x9c'),_0x6a43('0x9d'),{'account':_0x27e206,'message':{'from':util['format'](_0x6a43('0x9e'),_0x1d86d0[_0x6a43('0x31')],_0x1d86d0[_0x6a43('0x5c')]||_0x1d86d0['Smtp'][_0x6a43('0x41')]),'to':_0x3ff1c0[_0x6a43('0x34')]['mailTranscript'],'subject':_0x6a43('0x9f'),'text':util[_0x6a43('0x81')](_0x6a43('0xa0'),_0x3ff1c0[_0x6a43('0x34')][_0x6a43('0x80')]),'attachments':[{'path':_0x157d93}]}})[_0x6a43('0x19')](function(){return _0x3f8508;})[_0x6a43('0x24')](function(_0x40e183){logger[_0x6a43('0x20')](_0x40e183);});})[_0x6a43('0x19')](respondWithStatusCode(_0x4a5782,0xc8))['catch'](handleError(_0x4a5782,null));};exports[_0x6a43('0xa1')]=function(_0x50bdd,_0x21d366){return db[_0x6a43('0x65')][_0x6a43('0x4e')]({'where':{'id':_0x50bdd[_0x6a43('0x42')]['id']}})['then'](handleEntityNotFound(_0x21d366,null))[_0x6a43('0x19')](function(_0x3e8ddb){if(_0x3e8ddb){return _0x3e8ddb[_0x6a43('0xa1')](_0x50bdd[_0x6a43('0x34')][_0x6a43('0xa2')],_[_0x6a43('0xa3')](_0x50bdd['body'],['ids','id'])||{});}})[_0x6a43('0x19')](respondWithResult(_0x21d366,null))[_0x6a43('0x24')](handleError(_0x21d366,null));};exports[_0x6a43('0xa4')]=function(_0x216544,_0x575c28){var _0x344d73={'raw':![],'where':{}};var _0x8e8309={};var _0x2fab58={'count':0x0,'rows':[]};return db[_0x6a43('0x3b')][_0x6a43('0x52')]({'where':{'id':_0x216544[_0x6a43('0x42')]['id']}})[_0x6a43('0x19')](handleEntityNotFound(_0x575c28,null))[_0x6a43('0x19')](function(_0x39fc3a){if(_0x39fc3a){_0x8e8309[_0x6a43('0x43')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x8e8309['query']=_[_0x6a43('0xa5')](_0x216544[_0x6a43('0x44')]);_0x8e8309['filters']=_[_0x6a43('0x47')](_0x8e8309[_0x6a43('0x43')],_0x8e8309['query']);_0x344d73['attributes']=_['intersection'](_0x8e8309[_0x6a43('0x43')],qs[_0x6a43('0x48')](_0x216544[_0x6a43('0x44')][_0x6a43('0x48')]));_0x344d73[_0x6a43('0x46')]=_0x344d73['attributes'][_0x6a43('0x49')]?_0x344d73[_0x6a43('0x46')]:_0x8e8309[_0x6a43('0x43')];if(!_0x216544[_0x6a43('0x44')][_0x6a43('0xa6')]('nolimit')){_0x344d73[_0x6a43('0x2a')]=qs[_0x6a43('0x2a')](_0x216544['query'][_0x6a43('0x2a')]);_0x344d73['offset']=qs['offset'](_0x216544[_0x6a43('0x44')][_0x6a43('0x29')]);}_0x344d73[_0x6a43('0xa7')]=qs['sort'](_0x216544[_0x6a43('0x44')][_0x6a43('0xa8')]);_0x344d73[_0x6a43('0xa9')]=qs[_0x6a43('0x45')](_[_0x6a43('0xaa')](_0x216544[_0x6a43('0x44')],_0x8e8309[_0x6a43('0x45')]));_0x344d73[_0x6a43('0xa9')][_0x6a43('0xab')]=_0x39fc3a['id'];if(_0x216544[_0x6a43('0x44')][_0x6a43('0xac')]){_0x344d73[_0x6a43('0xa9')]=_['merge'](_0x344d73[_0x6a43('0xa9')],{'$or':_[_0x6a43('0x3a')](_0x344d73[_0x6a43('0x46')],function(_0x527b39){var _0x9140a6={};_0x9140a6[_0x527b39]={'$like':'%'+_0x216544[_0x6a43('0x44')]['filter']+'%'};return _0x9140a6;})});}if(_0x216544[_0x6a43('0x44')]['$gte']){var _0x35a3c1=_0x216544['query']['$gte'][_0x6a43('0xad')](',');var _0x44d1bc={};_0x44d1bc[_0x35a3c1[0x0]]={'$gte':moment(_0x35a3c1[0x1])['format'](_0x6a43('0xae'))};_0x344d73['where']=_['merge'](_0x344d73[_0x6a43('0xa9')],_0x44d1bc);}_0x344d73=_[_0x6a43('0x4c')]({},_0x344d73,_0x216544[_0x6a43('0x4d')]);return db['ChatMessage'][_0x6a43('0x2c')]({'where':_0x344d73[_0x6a43('0xa9')]})['then'](function(_0x70c01c){_0x2fab58['count']=_0x70c01c;if(_0x216544[_0x6a43('0x44')]['includeAll']){_0x344d73[_0x6a43('0x4b')]=[{'all':!![]}];}return db[_0x6a43('0x65')]['findAll'](_0x344d73);})[_0x6a43('0x19')](function(_0x419abb){_0x2fab58[_0x6a43('0xaf')]=_0x419abb;return _0x2fab58;});}})[_0x6a43('0x19')](respondWithFilteredResult(_0x575c28,_0x344d73))[_0x6a43('0x24')](handleError(_0x575c28,null));};exports[_0x6a43('0xb0')]=function(_0x2cb37f,_0x469175){var _0x46f1c6={'where':{}},_0x38fe3e={},_0xe9504c={'count':0x0,'rows':[]};return db[_0x6a43('0x3b')][_0x6a43('0x52')]({'where':{'id':_0x2cb37f[_0x6a43('0x42')]['id']}})[_0x6a43('0x19')](handleEntityNotFound(_0x469175,null))[_0x6a43('0x19')](function(_0x25bac0){if(_0x25bac0){_0x38fe3e[_0x6a43('0x43')]=_['keys'](db['ChatMessage'][_0x6a43('0x3c')]);_0x38fe3e['query']=_['keys'](_0x2cb37f[_0x6a43('0x44')]);_0x38fe3e['filters']=_[_0x6a43('0x47')](_0x38fe3e[_0x6a43('0x43')],_0x38fe3e['query']);_0x46f1c6[_0x6a43('0x46')]=_[_0x6a43('0x47')](_0x38fe3e[_0x6a43('0x43')],qs[_0x6a43('0x48')](_0x2cb37f['query']['fields']));_0x46f1c6[_0x6a43('0x46')]=_0x46f1c6[_0x6a43('0x46')]['length']?_0x46f1c6['attributes']:_0x38fe3e[_0x6a43('0x43')];if(!_0x2cb37f[_0x6a43('0x44')][_0x6a43('0xa6')]('nolimit')){_0x46f1c6[_0x6a43('0x2a')]=qs[_0x6a43('0x2a')](_0x2cb37f[_0x6a43('0x44')][_0x6a43('0x2a')]);_0x46f1c6['offset']=qs[_0x6a43('0x29')](_0x2cb37f[_0x6a43('0x44')][_0x6a43('0x29')]);}_0x46f1c6[_0x6a43('0xa7')]=qs[_0x6a43('0xa8')](_0x2cb37f[_0x6a43('0x44')]['sort']);_0x46f1c6['where']=qs[_0x6a43('0x45')](_[_0x6a43('0xaa')](_0x2cb37f[_0x6a43('0x44')],_0x38fe3e['filters']));_0x46f1c6[_0x6a43('0xa9')][_0x6a43('0xab')]=_0x25bac0['id'];if(_0x2cb37f[_0x6a43('0x44')][_0x6a43('0xac')]){_0x46f1c6[_0x6a43('0xa9')]=_[_0x6a43('0x4c')](_0x46f1c6[_0x6a43('0xa9')],{'$or':_[_0x6a43('0x3a')](_0x46f1c6[_0x6a43('0x46')],function(_0x1f2b52){var _0x2597c0={};_0x2597c0[_0x1f2b52]={'$like':'%'+_0x2cb37f[_0x6a43('0x44')]['filter']+'%'};return _0x2597c0;})});}_0x46f1c6[_0x6a43('0xa9')]['secret']=![];if(_0x2cb37f[_0x6a43('0x44')]['id']){_0x46f1c6['where']['id']={'$gt':_0x2cb37f[_0x6a43('0x44')]['id']};}_0x46f1c6=_[_0x6a43('0x4c')]({},_0x46f1c6,_0x2cb37f[_0x6a43('0x4d')]);return db['ChatMessage']['count']({'where':_0x46f1c6['where']})[_0x6a43('0x19')](function(_0x5ae5b3){_0xe9504c[_0x6a43('0x2c')]=_0x5ae5b3;_0x46f1c6[_0x6a43('0x4b')]=[];if(_0x2cb37f[_0x6a43('0x44')][_0x6a43('0xb1')]){_0x46f1c6['include']['push']({'model':db['User'],'as':_0x6a43('0x85'),'attributes':['id','fullname',_0x6a43('0x90')]});}if(_0x2cb37f[_0x6a43('0x44')][_0x6a43('0x4a')]){_0x46f1c6[_0x6a43('0x4b')]=[{'all':!![]}];}return db[_0x6a43('0x65')][_0x6a43('0xb2')](_0x46f1c6);})[_0x6a43('0x19')](function(_0x330be7){_0xe9504c[_0x6a43('0xaf')]=_0x330be7;return _0xe9504c;});}})['then'](respondWithFilteredResult(_0x469175,_0x46f1c6))['catch'](handleError(_0x469175,null));};exports[_0x6a43('0xb3')]=function(_0x141571,_0x1800ea){return db[_0x6a43('0x3b')][_0x6a43('0x4e')]({'where':{'id':_0x141571[_0x6a43('0x42')]['id']}})[_0x6a43('0x19')](handleEntityNotFound(_0x1800ea,null))[_0x6a43('0x19')](function(_0x54edf1){if(_0x54edf1){return _0x54edf1['setTags'](_0x141571[_0x6a43('0x34')][_0x6a43('0xa2')],_[_0x6a43('0xa3')](_0x141571[_0x6a43('0x34')],[_0x6a43('0xa2'),'id'])||{})['spread'](function(){return db[_0x6a43('0xb4')][_0x6a43('0xb2')]({'attributes':['id',_0x6a43('0x31'),_0x6a43('0xb5')],'where':{'id':_0x141571[_0x6a43('0x34')][_0x6a43('0xa2')]}});})[_0x6a43('0x19')](function(_0x3a3d90){socket[_0x6a43('0xb6')](_0x6a43('0xb7'),{'id':Number(_0x141571[_0x6a43('0x42')]['id']),'tags':_0x3a3d90||[]});return{'id':Number(_0x141571[_0x6a43('0x42')]['id']),'tags':_0x3a3d90||[]};});}})[_0x6a43('0x19')](respondWithResult(_0x1800ea,null))[_0x6a43('0x24')](handleError(_0x1800ea,null));};exports[_0x6a43('0xb8')]=function(_0x43759a,_0x2cc3dc){return db['ChatInteraction'][_0x6a43('0x4e')]({'where':{'id':_0x43759a['params']['id']}})['then'](handleEntityNotFound(_0x2cc3dc,null))[_0x6a43('0x19')](function(_0x54c906){if(_0x54c906){return _0x54c906['removeTags'](_0x43759a[_0x6a43('0x44')][_0x6a43('0xa2')]);}})[_0x6a43('0x19')](respondWithStatusCode(_0x2cc3dc,null))[_0x6a43('0x24')](handleError(_0x2cc3dc,null));};exports[_0x6a43('0x7e')]=function(_0x196a34,_0x39bc5d){var _0x528c40=moment()[_0x6a43('0xb9')]()[_0x6a43('0xba')]();var _0x52e3b4=path['join'](config['root'],'server',_0x6a43('0xbb'),'tmp');var _0x337486=path[_0x6a43('0x7a')](config[_0x6a43('0x7b')],_0x6a43('0xbc'),_0x6a43('0xbb'),'attachments');var _0x4cf14a=path[_0x6a43('0x7a')](_0x52e3b4,_0x528c40);var _0x376c7c=util[_0x6a43('0x81')](_0x6a43('0xbd'),_0x196a34[_0x6a43('0x42')]['id'],_0x528c40);var _0xf73aa3=path[_0x6a43('0x7a')](_0x52e3b4,_0x376c7c);var _0x407908=[];_0x407908[_0x6a43('0xbe')]({'model':db[_0x6a43('0x85')],'as':_0x6a43('0x85'),'attributes':['id',_0x6a43('0x59')],'raw':!![]});_0x407908[_0x6a43('0xbe')]({'model':db[_0x6a43('0x69')],'as':_0x6a43('0x6a'),'attributes':['id',_0x6a43('0xbf'),_0x6a43('0xc0')],'raw':!![]});if(_0x196a34[_0x6a43('0x44')]['attachments']){_0x407908[_0x6a43('0xbe')]({'model':db[_0x6a43('0x76')],'as':'Attachment','raw':!![]});}var _0x12fe39=[{'model':db[_0x6a43('0x65')],'as':_0x6a43('0x87'),'attributes':['id','body',_0x6a43('0x93'),'direction',_0x6a43('0x96'),_0x6a43('0xc1')],'include':_0x407908}];_0x12fe39[_0x6a43('0xbe')]({'model':db['ChatWebsite'],'as':_0x6a43('0xc2'),'attributes':['id',_0x6a43('0x31')]});_0x12fe39[_0x6a43('0xbe')]({'model':db[_0x6a43('0x85')],'as':_0x6a43('0xc3'),'attributes':['id',_0x6a43('0x59')]});return db[_0x6a43('0x3b')][_0x6a43('0x4e')]({'where':{'id':_0x196a34['params']['id']},'include':_0x12fe39})['then'](handleEntityNotFound(_0x39bc5d,null))[_0x6a43('0x19')](function(_0x3b76d2){if(_0x3b76d2){var _0x4eb1d8=_0x3b76d2[_0x6a43('0xc4')]({'plain':!![]});fs[_0x6a43('0xc5')](_0x4cf14a);var _0x385124={'channel':_0x6a43('0xc6'),'account':_0x4eb1d8[_0x6a43('0xc2')]['name'],'agent':_0x4eb1d8[_0x6a43('0xc3')]?_0x4eb1d8['Owner'][_0x6a43('0x59')]:_0x6a43('0xc7'),'createdAt':moment(_0x4eb1d8[_0x6a43('0x93')])[_0x6a43('0x81')](_0x6a43('0xae'))[_0x6a43('0xba')](),'closedAt':_0x4eb1d8[_0x6a43('0x6e')]?moment(_0x4eb1d8[_0x6a43('0xc8')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6a43('0xba')]():'','disposition':_0x4eb1d8[_0x6a43('0x6f')],'chatInfo':{'browser':_0x4eb1d8[_0x6a43('0xc9')],'os':_0x4eb1d8[_0x6a43('0xca')],'referer':_0x4eb1d8[_0x6a43('0xcb')],'customerIp':_0x4eb1d8['customerIp'],'customerPort':_0x4eb1d8['customerPort']?_0x4eb1d8[_0x6a43('0xcc')]:_0x6a43('0xc7')},'messages':_(_0x4eb1d8[_0x6a43('0x87')])[_0x6a43('0xcd')]()[_0x6a43('0xac')]({'secret':![]})[_0x6a43('0x3a')](function(_0x1e01d8){if(_0x1e01d8[_0x6a43('0x76')]){var _0x4b1bfa=path[_0x6a43('0x7a')](_0x337486,_0x1e01d8['Attachment'][_0x6a43('0x73')]);if(fs[_0x6a43('0xce')](_0x4b1bfa)){fs['createReadStream'](_0x4b1bfa)['pipe'](fs[_0x6a43('0xcf')](path[_0x6a43('0x7a')](_0x4cf14a,_0x1e01d8['Attachment'][_0x6a43('0x73')])));}}return{'date':moment(_0x1e01d8[_0x6a43('0x93')])[_0x6a43('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6a43('0xba')](),'sender':_0x1e01d8['direction']===_0x6a43('0x64')?_0x1e01d8[_0x6a43('0x85')]?_0x1e01d8[_0x6a43('0x85')][_0x6a43('0x59')]:'System':_0x1e01d8[_0x6a43('0x6a')][_0x6a43('0xbf')]+(_0x1e01d8['Contact'][_0x6a43('0xc0')]?'\x20'+_0x1e01d8[_0x6a43('0x6a')][_0x6a43('0xc0')]:''),'body':_0x1e01d8[_0x6a43('0x76')]?_0x1e01d8[_0x6a43('0x76')][_0x6a43('0x73')]:_0x1e01d8[_0x6a43('0x34')],'direction':_0x1e01d8['direction']==='out'?'A':'C','secret':_0x1e01d8['secret'],'read':_0x1e01d8[_0x6a43('0xc1')],'attachment':_0x1e01d8[_0x6a43('0x76')]};})[_0x6a43('0xd0')]()};return ejs[_0x6a43('0xd1')](path[_0x6a43('0x7a')](config[_0x6a43('0x7b')],_0x6a43('0xbc'),'views',_0x6a43('0xd2')),{'interaction':_0x385124})[_0x6a43('0x19')](function(_0x4326f1){var _0x3fbbc7=path[_0x6a43('0x7a')](_0x4cf14a,'transcript-'+_0x4eb1d8['id']+'-'+_0x528c40+'.pdf');var _0x170c06={'path':_0x3fbbc7,'channel':'Chat','interactionId':_0x4eb1d8['id']};return pdf[_0x6a43('0xd3')](_0x4326f1,_0x170c06);})[_0x6a43('0x19')](function(){return new Promise(function(_0x5b2a52,_0x1b76b7){zipdir(_0x4cf14a,{'saveTo':_0xf73aa3},function(_0x2d6895,_0x24e960){if(_0x2d6895)return _0x1b76b7(_0x2d6895);return _0x5b2a52(_0x24e960);});})['then'](function(){return new BPromise(function(_0xbe6961,_0x266d77){rimraf(_0x4cf14a,function(_0x21088f){if(_0x21088f)_0x266d77(_0x21088f);return _0xbe6961();});});})['then'](function(){return _0x39bc5d[_0x6a43('0x7e')](_0xf73aa3,_0x376c7c,function(_0x364023){if(_0x364023){logger[_0x6a43('0x20')](_0x6a43('0xd4'),_0x364023);}else{fs[_0x6a43('0xd5')](_0xf73aa3);}});});});}else{return _0x39bc5d[_0x6a43('0x25')](0xc8);}})[_0x6a43('0x24')](handleError(_0x39bc5d,null));}; \ No newline at end of file +var _0x08fc=['email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','entity\x20not\x20found','UserId','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','where','ChatInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','push','alias','rows','addTags','setTags','spread','Tag','color','emit','removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','read','Owner','get','mkdirSync','Chat','closedAt','disposition','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','out','value','renderFile','views','downloadInteraction.ejs','transcript-','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','name','send','merge','body','agent','index','ChatInteraction','rawAttributes','fieldName','type','key','findAll','chat','query','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooMetadata','vidaooApiKey','user','fullname'];(function(_0x404554,_0x43c7cb){var _0x573664=function(_0x5e1845){while(--_0x5e1845){_0x404554['push'](_0x404554['shift']());}};_0x573664(++_0x43c7cb);}(_0x08fc,0x14d));var _0xc08f=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0x08fc[_0x11e03f];return _0x5666fe;};'use strict';var rimraf=require(_0xc08f('0x0'));var zipdir=require(_0xc08f('0x1'));var rp=require(_0xc08f('0x2'));var moment=require(_0xc08f('0x3'));var BPromise=require(_0xc08f('0x4'));var Mustache=require(_0xc08f('0x5'));var util=require(_0xc08f('0x6'));var path=require(_0xc08f('0x7'));var ejs=require(_0xc08f('0x8'));var fs=require('fs');var _=require(_0xc08f('0x9'));var Redis=require(_0xc08f('0xa'));var interaction=require(_0xc08f('0xb'));var qs=require('../../components/parsers/qs');var pdf=require(_0xc08f('0xc'));var logger=require('../../config/logger')(_0xc08f('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc08f('0xe')]=_[_0xc08f('0xf')](config[_0xc08f('0xe')],{'host':_0xc08f('0x10'),'port':0x18eb});var socket=require(_0xc08f('0x11'))(new Redis(config[_0xc08f('0xe')]));require(_0xc08f('0x12'))[_0xc08f('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc08f('0x14')]['http']({'port':0x232b});var client9004=jayson[_0xc08f('0x14')][_0xc08f('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x59859f,_0x4eb3a7,_0x19a6e0,_0x32b68d){return new BPromise(function(_0x5bc5fc,_0x57ee3e){var _0x484b16=_0x32b68d||client;return _0x484b16[_0xc08f('0x16')](_0x59859f,_0x19a6e0)[_0xc08f('0x17')](function(_0x364185){logger[_0xc08f('0x18')](_0xc08f('0x19'),_0x4eb3a7,'request\x20sent');logger[_0xc08f('0x1a')](_0xc08f('0x1b'),_0x4eb3a7,_0xc08f('0x1c'),JSON[_0xc08f('0x1d')](_0x364185));if(_0x364185['error']){if(_0x364185[_0xc08f('0x1e')][_0xc08f('0x1f')]===0x1f4){logger[_0xc08f('0x1e')](_0xc08f('0x19'),_0x4eb3a7,_0x364185[_0xc08f('0x1e')]['message']);return _0x57ee3e(_0x364185['error'][_0xc08f('0x20')]);}logger[_0xc08f('0x1e')](_0xc08f('0x19'),_0x4eb3a7,_0x364185[_0xc08f('0x1e')]['message']);return _0x5bc5fc(_0x364185[_0xc08f('0x1e')][_0xc08f('0x20')]);}else{logger[_0xc08f('0x18')](_0xc08f('0x19'),_0x4eb3a7,_0xc08f('0x1c'));_0x5bc5fc(_0x364185[_0xc08f('0x21')][_0xc08f('0x20')]);}})[_0xc08f('0x22')](function(_0x38b420){logger['error'](_0xc08f('0x19'),_0x4eb3a7,_0x38b420);_0x57ee3e(_0x38b420);});});}function respondWithStatusCode(_0xf6f5a7,_0x52f11e){_0x52f11e=_0x52f11e||0xcc;return function(_0x32875f){if(_0x32875f){return _0xf6f5a7['sendStatus'](_0x52f11e);}return _0xf6f5a7[_0xc08f('0x23')](_0x52f11e)['end']();};}function respondWithResult(_0x170090,_0x27e044){_0x27e044=_0x27e044||0xc8;return function(_0x291d6d){if(_0x291d6d){return _0x170090[_0xc08f('0x23')](_0x27e044)[_0xc08f('0x24')](_0x291d6d);}};}function respondWithFilteredResult(_0x5ec8f3,_0x2bcdf6){return function(_0x3c5309){if(_0x3c5309){var _0x47be14=typeof _0x2bcdf6['offset']===_0xc08f('0x25')&&typeof _0x2bcdf6[_0xc08f('0x26')]===_0xc08f('0x25');var _0x5e6714=_0x3c5309[_0xc08f('0x27')];var _0x6634cd=_0x47be14?0x0:_0x2bcdf6[_0xc08f('0x28')];var _0x2102f8=_0x47be14?_0x3c5309[_0xc08f('0x27')]:_0x2bcdf6['offset']+_0x2bcdf6['limit'];var _0xf86e62;if(_0x2102f8>=_0x5e6714){_0x2102f8=_0x5e6714;_0xf86e62=0xc8;}else{_0xf86e62=0xce;}_0x5ec8f3[_0xc08f('0x23')](_0xf86e62);return _0x5ec8f3[_0xc08f('0x29')](_0xc08f('0x2a'),_0x6634cd+'-'+_0x2102f8+'/'+_0x5e6714)[_0xc08f('0x24')](_0x3c5309);}return null;};}function saveUpdates(_0x441e1d){return function(_0x256a7d){if(_0x256a7d){return _0x256a7d[_0xc08f('0x2b')](_0x441e1d)[_0xc08f('0x17')](function(_0x1b2b81){return _0x1b2b81;});}return null;};}function removeEntity(_0x3a1d45){return function(_0x5e4bce){if(_0x5e4bce){return _0x5e4bce[_0xc08f('0x2c')]()[_0xc08f('0x17')](function(){_0x3a1d45[_0xc08f('0x23')](0xcc)[_0xc08f('0x2d')]();});}};}function handleEntityNotFound(_0x35f3b9){return function(_0x3ab023){if(!_0x3ab023){_0x35f3b9[_0xc08f('0x2e')](0x194);}return _0x3ab023;};}function handleError(_0x2120c9,_0x575613){_0x575613=_0x575613||0x1f4;return function(_0x3684eb){logger['error'](_0x3684eb['stack']);if(_0x3684eb[_0xc08f('0x2f')]){delete _0x3684eb[_0xc08f('0x2f')];}_0x2120c9['status'](_0x575613)[_0xc08f('0x30')](_0x3684eb);};}function getMustacheRender(_0x291392,_0x10d9cb){return Mustache['render'](_0x291392,_[_0xc08f('0x31')](_0x10d9cb[_0xc08f('0x32')],{'contact':_0x10d9cb['contact'],'message':_0x10d9cb[_0xc08f('0x20')],'agent':_0x10d9cb[_0xc08f('0x33')],'interaction':_0x10d9cb['interaction'],'account':_0x10d9cb['account']}))||'';}exports[_0xc08f('0x34')]=function(_0x2107bd,_0x24e58c){var _0x37c83e={};var _0x5164fd=_['map'](db[_0xc08f('0x35')][_0xc08f('0x36')],function(_0x24c00f){return{'name':_0x24c00f[_0xc08f('0x37')],'type':_0x24c00f[_0xc08f('0x38')][_0xc08f('0x39')]};});_0x37c83e=qs['getOptions'](_0x5164fd,_0x2107bd);return interaction[_0xc08f('0x3a')](_0xc08f('0x3b'),_0x2107bd[_0xc08f('0x3c')],_0x2107bd['user'],_0x37c83e,_0x5164fd)['then'](respondWithFilteredResult(_0x24e58c,_0x37c83e))['catch'](handleError(_0x24e58c,null));};exports['show']=function(_0x5c2b48,_0x2e7880){var _0x4d8ba0={'raw':![],'where':{'id':_0x5c2b48[_0xc08f('0x3d')]['id']}},_0x583acd={};_0x583acd[_0xc08f('0x3e')]=_['keys'](db[_0xc08f('0x35')][_0xc08f('0x36')]);_0x583acd[_0xc08f('0x3c')]=_[_0xc08f('0x3f')](_0x5c2b48[_0xc08f('0x3c')]);_0x583acd[_0xc08f('0x40')]=_[_0xc08f('0x41')](_0x583acd[_0xc08f('0x3e')],_0x583acd['query']);_0x4d8ba0[_0xc08f('0x42')]=_[_0xc08f('0x41')](_0x583acd[_0xc08f('0x3e')],qs['fields'](_0x5c2b48[_0xc08f('0x3c')][_0xc08f('0x43')]));_0x4d8ba0[_0xc08f('0x42')]=_0x4d8ba0['attributes'][_0xc08f('0x44')]?_0x4d8ba0[_0xc08f('0x42')]:_0x583acd[_0xc08f('0x3e')];if(_0x5c2b48[_0xc08f('0x3c')][_0xc08f('0x45')]){_0x4d8ba0[_0xc08f('0x46')]=[{'all':!![]}];}_0x4d8ba0=_[_0xc08f('0x31')]({},_0x4d8ba0,_0x5c2b48[_0xc08f('0x47')]);return db['ChatInteraction'][_0xc08f('0x48')](_0x4d8ba0)[_0xc08f('0x17')](handleEntityNotFound(_0x2e7880,null))[_0xc08f('0x17')](respondWithResult(_0x2e7880,null))[_0xc08f('0x22')](handleError(_0x2e7880,null));};exports[_0xc08f('0x49')]=function(_0x21bb4c,_0x5e6abc){return db[_0xc08f('0x35')][_0xc08f('0x49')](_0x21bb4c[_0xc08f('0x32')],{})[_0xc08f('0x17')](respondWithResult(_0x5e6abc,0xc9))[_0xc08f('0x22')](handleError(_0x5e6abc,null));};exports['update']=function(_0x3de9d2,_0x2b9ece){if(_0x3de9d2['body']['id']){delete _0x3de9d2[_0xc08f('0x32')]['id'];}return db['ChatInteraction'][_0xc08f('0x48')]({'where':{'id':_0x3de9d2['params']['id']}})[_0xc08f('0x17')](handleEntityNotFound(_0x2b9ece,null))['then'](saveUpdates(_0x3de9d2['body'],null))[_0xc08f('0x17')](respondWithResult(_0x2b9ece,null))['catch'](handleError(_0x2b9ece,null));};exports['destroy']=function(_0x412e41,_0x7f46db){return db[_0xc08f('0x35')]['find']({'where':{'id':_0x412e41[_0xc08f('0x3d')]['id']}})[_0xc08f('0x17')](handleEntityNotFound(_0x7f46db,null))[_0xc08f('0x17')](removeEntity(_0x7f46db,null))[_0xc08f('0x22')](handleError(_0x7f46db,null));};exports[_0xc08f('0x4a')]=function(_0x7d7ede,_0x56889a){return db['ChatInteraction']['describe']()[_0xc08f('0x17')](respondWithResult(_0x56889a,null))[_0xc08f('0x22')](handleError(_0x56889a,null));};exports[_0xc08f('0x4b')]=function(_0x4cd1d1,_0x5c33cb){var _0x147749=_0x4cd1d1[_0xc08f('0x3d')]['id'];var _0x4725a2;var _0x16f5c3;var _0x4d1262;return db[_0xc08f('0x35')][_0xc08f('0x4c')]({'where':{'id':_0x147749}})[_0xc08f('0x17')](function(_0x1bf8af){_0x4725a2=_0x1bf8af;return db[_0xc08f('0x4d')][_0xc08f('0x4c')]({'where':{'id':_0x1bf8af[_0xc08f('0x4e')]},'attributes':['id','vidaooApiKey',_0xc08f('0x4f'),_0xc08f('0x50'),'vidaooNote',_0xc08f('0x51')],'raw':!![]});})['then'](function(_0x26871e){if(_0x26871e&&_0x26871e[_0xc08f('0x52')]&&_0x26871e[_0xc08f('0x4f')]){_0x16f5c3=_0x26871e;var _0x6f2336={'interaction':{'id':_0x147749},'agent':{'id':_0x4cd1d1[_0xc08f('0x53')]['id'],'name':_0x4cd1d1[_0xc08f('0x53')]['name'],'fullname':_0x4cd1d1[_0xc08f('0x53')][_0xc08f('0x54')],'email':_0x4cd1d1['user'][_0xc08f('0x55')]},'contact':_0x4cd1d1['body'][_0xc08f('0x56')],'account':_0x4cd1d1[_0xc08f('0x32')][_0xc08f('0x57')]};var _0x5c8967={'rejectUnauthorized':![],'method':_0xc08f('0x58'),'url':_0xc08f('0x59'),'headers':{'X-APIKEY':_0x26871e[_0xc08f('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4cd1d1[_0xc08f('0x53')][_0xc08f('0x55')]],'buttons':null,'topic':_0x16f5c3[_0xc08f('0x50')],'note':_['isNull'](_0x16f5c3[_0xc08f('0x5a')])?null:getMustacheRender(_0x16f5c3[_0xc08f('0x5a')],_0x6f2336),'metadata':null},'redirect':_0xc08f('0x5b'),'json':!![]};try{if(!_[_0xc08f('0x5c')](_0x16f5c3['vidaooMetadata'])){var _0x23f22f=getMustacheRender(_0x16f5c3[_0xc08f('0x51')],_0x6f2336);var _0x2e15ee=JSON['parse'](_0x23f22f);_0x5c8967[_0xc08f('0x32')][_0xc08f('0x5d')]=_0x2e15ee;}}catch(_0x43dfbb){throw new db[(_0xc08f('0x5e'))][(_0xc08f('0x5f'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5c8967);}else{throw new db[(_0xc08f('0x5e'))][(_0xc08f('0x5f'))](_0xc08f('0x60'));}})[_0xc08f('0x17')](function(_0x5df1b0){_0x4d1262=_0x5df1b0;if(_0x4d1262['id']){var _0x5baaa8={'body':_0x4d1262['join_url'],'ChatWebsiteId':_0x16f5c3['id'],'ChatInteractionId':_0x4725a2['id'],'direction':'out','UserId':_0x4cd1d1[_0xc08f('0x53')]['id']};return db[_0xc08f('0x61')]['create'](_0x5baaa8,{});}else{throw new db[(_0xc08f('0x5e'))][(_0xc08f('0x5f'))](_0xc08f('0x62'));}})['then'](function(){return _0x4725a2[_0xc08f('0x63')]({'vidaooSessionId':_0x4d1262['id']});})[_0xc08f('0x17')](respondWithResult(_0x5c33cb,null))[_0xc08f('0x22')](handleError(_0x5c33cb,null));};exports[_0xc08f('0x64')]=function(_0x23bb9b,_0x5b1de2){if(_0x23bb9b['body']['id']){delete _0x23bb9b['body']['id'];}return db[_0xc08f('0x35')][_0xc08f('0x48')]({'where':{'id':_0x23bb9b[_0xc08f('0x3d')]['id']},'include':[{'model':db['CmContact'],'as':_0xc08f('0x65')}]})[_0xc08f('0x17')](handleEntityNotFound(_0x5b1de2,null))[_0xc08f('0x17')](saveUpdates(_0x23bb9b[_0xc08f('0x32')],null))[_0xc08f('0x17')](respondWithResult(_0x5b1de2,null))['catch'](handleError(_0x5b1de2,null));};exports[_0xc08f('0x66')]=function(_0x3731a4,_0x43d861){if(_0x3731a4[_0xc08f('0x32')]['id']){delete _0x3731a4['body']['id'];}return db[_0xc08f('0x35')][_0xc08f('0x48')]({'where':{'id':_0x3731a4[_0xc08f('0x3d')]['id']}})[_0xc08f('0x17')](function(_0xe20adb){if(!_0xe20adb){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0xc08f('0x67'));_0x43d861['sendStatus'](0x194);}else{if(_0xe20adb[_0xc08f('0x68')]){throw new db[(_0xc08f('0x5e'))][(_0xc08f('0x5f'))]('Interaction\x20already\x20assigned');}}return _0xe20adb;})['then'](function(_0x4cbcf7){if(_0x4cbcf7){return _0x4cbcf7[_0xc08f('0x2b')]({'closed':_0x3731a4[_0xc08f('0x32')]['closed'],'disposition':_0x3731a4[_0xc08f('0x32')]['disposition']})[_0xc08f('0x17')](function(_0x18b64a){return _0x18b64a;});}})[_0xc08f('0x17')](function(){return respondWithRpcPromise('AbandonInteraction',_0xc08f('0x66'),_0x3731a4[_0xc08f('0x32')],client9004);})['then'](respondWithResult(_0x43d861,null))[_0xc08f('0x22')](handleError(_0x43d861,null));};exports[_0xc08f('0x69')]=function(_0x2bb613,_0x51e508){_0x2bb613[_0xc08f('0x32')][_0xc08f('0x2f')]=_0x2bb613[_0xc08f('0x6a')][_0xc08f('0x6b')];_0x2bb613[_0xc08f('0x32')][_0xc08f('0x6c')]=_0x2bb613[_0xc08f('0x6a')][_0xc08f('0x6d')];_0x2bb613[_0xc08f('0x32')]['type']=_0x2bb613[_0xc08f('0x6a')]['mimetype'];return db[_0xc08f('0x6e')][_0xc08f('0x49')](_0x2bb613['body'])[_0xc08f('0x17')](respondWithResult(_0x51e508,0xc9))[_0xc08f('0x22')](handleError(_0x51e508,null));};exports[_0xc08f('0x6f')]=function(_0x40c00c,_0x1a5bd1){return db[_0xc08f('0x35')]['findOne']({'where':{'id':_0x40c00c[_0xc08f('0x3d')]['id']},'raw':!![]})[_0xc08f('0x17')](handleEntityNotFound(_0x1a5bd1,null))[_0xc08f('0x17')](function(_0x34bbe8){if(_0x34bbe8){if(_0x34bbe8[_0xc08f('0x70')]){return _0x1a5bd1[_0xc08f('0x23')](0x193)[_0xc08f('0x24')]({'status':0x193,'message':_0xc08f('0x71')});}return db[_0xc08f('0x6e')][_0xc08f('0x4c')]({'where':{'id':_0x40c00c[_0xc08f('0x3c')][_0xc08f('0x72')]},'raw':!![]})[_0xc08f('0x17')](handleEntityNotFound(_0x1a5bd1,null));}})[_0xc08f('0x17')](function(_0x15b50f){if(_0x15b50f){var _0x2d11a9=_0x15b50f[_0xc08f('0x73')]!==null;var _0x12bc11=path[_0xc08f('0x74')](config[_0xc08f('0x75')],_0xc08f('0x76'));if(_0x2d11a9){_0x12bc11=path[_0xc08f('0x74')](_0x12bc11,_0xc08f('0x77'));}var _0x30d721=path[_0xc08f('0x74')](_0x12bc11,_0x15b50f[_0xc08f('0x6c')]);return _0x1a5bd1[_0xc08f('0x78')](_0x30d721);}})[_0xc08f('0x22')](handleError(_0x1a5bd1,null));};exports['close']=function(_0x347510,_0x16e90d){var _0x404e9e=null;var _0x23e0bf=null;var _0x22d761=null;if(_0x347510[_0xc08f('0x32')]['id']){delete _0x347510['body']['id'];}if(_0x347510[_0xc08f('0x32')][_0xc08f('0x79')]){_0x22d761=path['join'](config[_0xc08f('0x75')],_0xc08f('0x7a'),util[_0xc08f('0x7b')](_0xc08f('0x7c'),Date[_0xc08f('0x7d')]()));_0x347510['body'][_0xc08f('0x7e')]=_0x22d761;}return db[_0xc08f('0x35')][_0xc08f('0x48')]({'where':{'id':_0x347510[_0xc08f('0x3d')]['id']},'include':[{'model':db[_0xc08f('0x61')],'as':_0xc08f('0x7f'),'include':[{'model':db[_0xc08f('0x80')],'as':_0xc08f('0x80')}]}]})['then'](handleEntityNotFound(_0x16e90d,null))[_0xc08f('0x17')](saveUpdates(_0x347510[_0xc08f('0x32')],null))[_0xc08f('0x17')](function(_0x57c6fe){if(_0x57c6fe){_0x404e9e=_0x57c6fe;return db[_0xc08f('0x4d')][_0xc08f('0x48')]({'where':{'id':_0x404e9e[_0xc08f('0x4e')]}});}})['then'](function(_0x44f35f){if(_0x44f35f){_0x23e0bf=_0x44f35f;return db[_0xc08f('0x81')][_0xc08f('0x48')]({'where':{'id':_0x404e9e[_0xc08f('0x82')]}});}})['then'](function(_0x44f31e){if(_0x44f31e){if(_0x22d761){var _0x34cedc=null;for(var _0x4d4c89=0x1;_0x4d4c89<_0x404e9e[_0xc08f('0x7f')][_0xc08f('0x44')];++_0x4d4c89){_0x34cedc=_0x404e9e[_0xc08f('0x7f')][_0x4d4c89];var _0x36a3df=_0x34cedc[_0xc08f('0x68')]?util['format'](_0xc08f('0x83'),_0x23e0bf['agentAlias'],_0x34cedc['UserId']):_0xc08f('0x84');var _0x52eaa9=_0x347510[_0xc08f('0x32')][_0xc08f('0x85')]||util[_0xc08f('0x7b')]('%s%d',_0xc08f('0x86'),_0x34cedc['ContactId']);switch(_0x23e0bf[_0xc08f('0x87')]){case _0xc08f('0x88'):_0x36a3df=_0x34cedc['UserId']?util[_0xc08f('0x7b')](_0xc08f('0x83'),_0x23e0bf[_0xc08f('0x89')],_0x34cedc['UserId']):_0xc08f('0x84');break;case _0xc08f('0x8a'):_0x36a3df=_0x34cedc[_0xc08f('0x68')]?_0x34cedc[_0xc08f('0x80')]['alias']||_0x34cedc[_0xc08f('0x80')][_0xc08f('0x54')]:_0xc08f('0x84');break;case _0xc08f('0x8b'):_0x36a3df=_0x34cedc[_0xc08f('0x68')]?_0x34cedc['User']['fullname']:'System';break;default:_0x36a3df=_0x34cedc[_0xc08f('0x68')]?util['format'](_0xc08f('0x83'),_0x23e0bf[_0xc08f('0x89')],_0x34cedc[_0xc08f('0x68')]):'System';}var _0x156017=util['format'](_0xc08f('0x8c'),moment(_0x34cedc[_0xc08f('0x8d')])[_0xc08f('0x7b')](_0xc08f('0x8e')),_0x34cedc[_0xc08f('0x8f')]==='in'?_0x52eaa9:_0x36a3df,_0x34cedc[_0xc08f('0x32')]);if(!_0x34cedc[_0xc08f('0x90')]){fs['appendFileSync'](_0x22d761,_0x156017);}}return db[_0xc08f('0x91')][_0xc08f('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xc08f('0x92')],'as':_0xc08f('0x93'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc08f('0x94'),'raw':!![]}]}]});}}})['then'](function(_0x523f9d){if(!_0x523f9d||!_0x523f9d[_0xc08f('0x93')]||!_0x347510[_0xc08f('0x32')])return _0x404e9e;var _0x56ed65=_0x523f9d[_0xc08f('0x95')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x56ed65,'message':{'from':util[_0xc08f('0x7b')](_0xc08f('0x96'),_0x523f9d[_0xc08f('0x2f')],_0x523f9d[_0xc08f('0x55')]||_0x523f9d[_0xc08f('0x93')]['user']),'to':_0x347510['body'][_0xc08f('0x79')],'subject':'Mail\x20Transcript','text':util[_0xc08f('0x7b')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x347510[_0xc08f('0x32')][_0xc08f('0x79')]),'attachments':[{'path':_0x22d761}]}})[_0xc08f('0x17')](function(){return _0x404e9e;})[_0xc08f('0x22')](function(_0x5494f6){logger[_0xc08f('0x1e')](_0x5494f6);});})[_0xc08f('0x17')](respondWithStatusCode(_0x16e90d,0xc8))[_0xc08f('0x22')](handleError(_0x16e90d,null));};exports[_0xc08f('0x97')]=function(_0x311487,_0x1e2e8d){return db[_0xc08f('0x61')][_0xc08f('0x48')]({'where':{'id':_0x311487['params']['id']}})[_0xc08f('0x17')](handleEntityNotFound(_0x1e2e8d,null))[_0xc08f('0x17')](function(_0x5dc4e8){if(_0x5dc4e8){return _0x5dc4e8[_0xc08f('0x97')](_0x311487[_0xc08f('0x32')][_0xc08f('0x98')],_[_0xc08f('0x99')](_0x311487[_0xc08f('0x32')],[_0xc08f('0x98'),'id'])||{});}})['then'](respondWithResult(_0x1e2e8d,null))[_0xc08f('0x22')](handleError(_0x1e2e8d,null));};exports[_0xc08f('0x9a')]=function(_0x4a9479,_0x1efacf){var _0x33510f={'raw':![],'where':{}};var _0x1302d5={};var _0x53471b={'count':0x0,'rows':[]};return db[_0xc08f('0x35')][_0xc08f('0x4c')]({'where':{'id':_0x4a9479[_0xc08f('0x3d')]['id']}})[_0xc08f('0x17')](handleEntityNotFound(_0x1efacf,null))[_0xc08f('0x17')](function(_0x21da2b){if(_0x21da2b){_0x1302d5[_0xc08f('0x3e')]=_[_0xc08f('0x3f')](db[_0xc08f('0x61')][_0xc08f('0x36')]);_0x1302d5[_0xc08f('0x3c')]=_[_0xc08f('0x3f')](_0x4a9479[_0xc08f('0x3c')]);_0x1302d5['filters']=_['intersection'](_0x1302d5['model'],_0x1302d5[_0xc08f('0x3c')]);_0x33510f[_0xc08f('0x42')]=_[_0xc08f('0x41')](_0x1302d5[_0xc08f('0x3e')],qs[_0xc08f('0x43')](_0x4a9479[_0xc08f('0x3c')][_0xc08f('0x43')]));_0x33510f[_0xc08f('0x42')]=_0x33510f[_0xc08f('0x42')]['length']?_0x33510f['attributes']:_0x1302d5[_0xc08f('0x3e')];if(!_0x4a9479[_0xc08f('0x3c')][_0xc08f('0x9b')](_0xc08f('0x9c'))){_0x33510f[_0xc08f('0x26')]=qs[_0xc08f('0x26')](_0x4a9479[_0xc08f('0x3c')]['limit']);_0x33510f[_0xc08f('0x28')]=qs['offset'](_0x4a9479[_0xc08f('0x3c')][_0xc08f('0x28')]);}_0x33510f[_0xc08f('0x9d')]=qs[_0xc08f('0x9e')](_0x4a9479[_0xc08f('0x3c')][_0xc08f('0x9e')]);_0x33510f['where']=qs[_0xc08f('0x40')](_[_0xc08f('0x9f')](_0x4a9479[_0xc08f('0x3c')],_0x1302d5['filters']));_0x33510f[_0xc08f('0xa0')][_0xc08f('0xa1')]=_0x21da2b['id'];if(_0x4a9479[_0xc08f('0x3c')][_0xc08f('0xa2')]){_0x33510f[_0xc08f('0xa0')]=_['merge'](_0x33510f[_0xc08f('0xa0')],{'$or':_[_0xc08f('0xa3')](_0x33510f[_0xc08f('0x42')],function(_0xf3fc16){var _0x101e9e={};_0x101e9e[_0xf3fc16]={'$like':'%'+_0x4a9479['query'][_0xc08f('0xa2')]+'%'};return _0x101e9e;})});}if(_0x4a9479[_0xc08f('0x3c')][_0xc08f('0xa4')]){var _0x18abf8=_0x4a9479['query'][_0xc08f('0xa4')][_0xc08f('0xa5')](',');var _0x4391c8={};_0x4391c8[_0x18abf8[0x0]]={'$gte':moment(_0x18abf8[0x1])[_0xc08f('0x7b')](_0xc08f('0xa6'))};_0x33510f[_0xc08f('0xa0')]=_[_0xc08f('0x31')](_0x33510f[_0xc08f('0xa0')],_0x4391c8);}_0x33510f=_[_0xc08f('0x31')]({},_0x33510f,_0x4a9479[_0xc08f('0x47')]);return db[_0xc08f('0x61')][_0xc08f('0x27')]({'where':_0x33510f[_0xc08f('0xa0')]})[_0xc08f('0x17')](function(_0x24c2f7){_0x53471b[_0xc08f('0x27')]=_0x24c2f7;if(_0x4a9479[_0xc08f('0x3c')][_0xc08f('0x45')]){_0x33510f[_0xc08f('0x46')]=[{'all':!![]}];}return db['ChatMessage'][_0xc08f('0x3a')](_0x33510f);})[_0xc08f('0x17')](function(_0x448ebe){_0x53471b['rows']=_0x448ebe;return _0x53471b;});}})[_0xc08f('0x17')](respondWithFilteredResult(_0x1efacf,_0x33510f))['catch'](handleError(_0x1efacf,null));};exports[_0xc08f('0xa7')]=function(_0x15269d,_0x5360c5){var _0x48e351={'where':{}},_0x51e8fe={},_0x3bd24a={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x15269d[_0xc08f('0x3d')]['id']}})[_0xc08f('0x17')](handleEntityNotFound(_0x5360c5,null))[_0xc08f('0x17')](function(_0x5a4746){if(_0x5a4746){_0x51e8fe[_0xc08f('0x3e')]=_[_0xc08f('0x3f')](db[_0xc08f('0x61')][_0xc08f('0x36')]);_0x51e8fe[_0xc08f('0x3c')]=_['keys'](_0x15269d['query']);_0x51e8fe[_0xc08f('0x40')]=_[_0xc08f('0x41')](_0x51e8fe[_0xc08f('0x3e')],_0x51e8fe['query']);_0x48e351[_0xc08f('0x42')]=_[_0xc08f('0x41')](_0x51e8fe[_0xc08f('0x3e')],qs[_0xc08f('0x43')](_0x15269d[_0xc08f('0x3c')][_0xc08f('0x43')]));_0x48e351[_0xc08f('0x42')]=_0x48e351['attributes'][_0xc08f('0x44')]?_0x48e351[_0xc08f('0x42')]:_0x51e8fe['model'];if(!_0x15269d['query'][_0xc08f('0x9b')](_0xc08f('0x9c'))){_0x48e351['limit']=qs[_0xc08f('0x26')](_0x15269d[_0xc08f('0x3c')][_0xc08f('0x26')]);_0x48e351[_0xc08f('0x28')]=qs[_0xc08f('0x28')](_0x15269d[_0xc08f('0x3c')][_0xc08f('0x28')]);}_0x48e351[_0xc08f('0x9d')]=qs[_0xc08f('0x9e')](_0x15269d[_0xc08f('0x3c')]['sort']);_0x48e351[_0xc08f('0xa0')]=qs[_0xc08f('0x40')](_['pick'](_0x15269d[_0xc08f('0x3c')],_0x51e8fe[_0xc08f('0x40')]));_0x48e351['where'][_0xc08f('0xa1')]=_0x5a4746['id'];if(_0x15269d['query'][_0xc08f('0xa2')]){_0x48e351[_0xc08f('0xa0')]=_[_0xc08f('0x31')](_0x48e351[_0xc08f('0xa0')],{'$or':_['map'](_0x48e351['attributes'],function(_0x581518){var _0x5e33ed={};_0x5e33ed[_0x581518]={'$like':'%'+_0x15269d[_0xc08f('0x3c')]['filter']+'%'};return _0x5e33ed;})});}_0x48e351[_0xc08f('0xa0')]['secret']=![];if(_0x15269d[_0xc08f('0x3c')]['id']){_0x48e351[_0xc08f('0xa0')]['id']={'$gt':_0x15269d[_0xc08f('0x3c')]['id']};}_0x48e351=_['merge']({},_0x48e351,_0x15269d[_0xc08f('0x47')]);return db[_0xc08f('0x61')][_0xc08f('0x27')]({'where':_0x48e351[_0xc08f('0xa0')]})[_0xc08f('0x17')](function(_0x5c006f){_0x3bd24a[_0xc08f('0x27')]=_0x5c006f;_0x48e351[_0xc08f('0x46')]=[];if(_0x15269d[_0xc08f('0x3c')][_0xc08f('0xa8')]){_0x48e351[_0xc08f('0x46')][_0xc08f('0xa9')]({'model':db[_0xc08f('0x80')],'as':_0xc08f('0x80'),'attributes':['id',_0xc08f('0x54'),_0xc08f('0xaa')]});}if(_0x15269d[_0xc08f('0x3c')]['includeAll']){_0x48e351['include']=[{'all':!![]}];}return db[_0xc08f('0x61')][_0xc08f('0x3a')](_0x48e351);})[_0xc08f('0x17')](function(_0x398966){_0x3bd24a[_0xc08f('0xab')]=_0x398966;return _0x3bd24a;});}})[_0xc08f('0x17')](respondWithFilteredResult(_0x5360c5,_0x48e351))[_0xc08f('0x22')](handleError(_0x5360c5,null));};exports[_0xc08f('0xac')]=function(_0x4fa221,_0x21a217){return db['ChatInteraction'][_0xc08f('0x48')]({'where':{'id':_0x4fa221[_0xc08f('0x3d')]['id']}})[_0xc08f('0x17')](handleEntityNotFound(_0x21a217,null))[_0xc08f('0x17')](function(_0x2d4845){if(_0x2d4845){return _0x2d4845[_0xc08f('0xad')](_0x4fa221[_0xc08f('0x32')]['ids'],_['omit'](_0x4fa221[_0xc08f('0x32')],[_0xc08f('0x98'),'id'])||{})[_0xc08f('0xae')](function(){return db[_0xc08f('0xaf')][_0xc08f('0x3a')]({'attributes':['id',_0xc08f('0x2f'),_0xc08f('0xb0')],'where':{'id':_0x4fa221[_0xc08f('0x32')][_0xc08f('0x98')]}});})[_0xc08f('0x17')](function(_0x684be4){socket[_0xc08f('0xb1')]('chatInteractionTags:save',{'id':Number(_0x4fa221[_0xc08f('0x3d')]['id']),'tags':_0x684be4||[]});return{'id':Number(_0x4fa221[_0xc08f('0x3d')]['id']),'tags':_0x684be4||[]};});}})['then'](respondWithResult(_0x21a217,null))[_0xc08f('0x22')](handleError(_0x21a217,null));};exports['removeTags']=function(_0x1d470a,_0x1a71db){return db[_0xc08f('0x35')]['find']({'where':{'id':_0x1d470a['params']['id']}})['then'](handleEntityNotFound(_0x1a71db,null))[_0xc08f('0x17')](function(_0x5753d8){if(_0x5753d8){return _0x5753d8[_0xc08f('0xb2')](_0x1d470a[_0xc08f('0x3c')]['ids']);}})[_0xc08f('0x17')](respondWithStatusCode(_0x1a71db,null))[_0xc08f('0x22')](handleError(_0x1a71db,null));};exports[_0xc08f('0x78')]=function(_0x4aa9ee,_0x230447){var _0x99458f=moment()[_0xc08f('0xb3')]()[_0xc08f('0xb4')]();var _0x295677=path['join'](config[_0xc08f('0x75')],_0xc08f('0xb5'),_0xc08f('0xb6'),'tmp');var _0x175f34=path['join'](config[_0xc08f('0x75')],_0xc08f('0xb5'),'files',_0xc08f('0xb7'));var _0x44e07f=path[_0xc08f('0x74')](_0x295677,_0x99458f);var _0x358e8a=util['format'](_0xc08f('0xb8'),_0x4aa9ee[_0xc08f('0x3d')]['id'],_0x99458f);var _0x463a6b=path[_0xc08f('0x74')](_0x295677,_0x358e8a);var _0x416c2e=[];_0x416c2e[_0xc08f('0xa9')]({'model':db['User'],'as':_0xc08f('0x80'),'attributes':['id',_0xc08f('0x54')],'raw':!![]});_0x416c2e['push']({'model':db[_0xc08f('0x81')],'as':'Contact','attributes':['id',_0xc08f('0xb9'),_0xc08f('0xba')],'raw':!![]});if(_0x4aa9ee['query']['attachments']){_0x416c2e[_0xc08f('0xa9')]({'model':db['Attachment'],'as':_0xc08f('0x6e'),'raw':!![]});}var _0x29ae67=[{'model':db['ChatMessage'],'as':_0xc08f('0x7f'),'attributes':['id',_0xc08f('0x32'),_0xc08f('0x8d'),'direction','secret',_0xc08f('0xbb')],'include':_0x416c2e}];_0x29ae67[_0xc08f('0xa9')]({'model':db[_0xc08f('0x4d')],'as':'Account','attributes':['id',_0xc08f('0x2f')]});_0x29ae67[_0xc08f('0xa9')]({'model':db[_0xc08f('0x80')],'as':_0xc08f('0xbc'),'attributes':['id','fullname']});return db[_0xc08f('0x35')][_0xc08f('0x48')]({'where':{'id':_0x4aa9ee['params']['id']},'include':_0x29ae67})['then'](handleEntityNotFound(_0x230447,null))[_0xc08f('0x17')](function(_0x8794ab){if(_0x8794ab){var _0x15f6b7=_0x8794ab[_0xc08f('0xbd')]({'plain':!![]});fs[_0xc08f('0xbe')](_0x44e07f);var _0x5a07fa={'channel':_0xc08f('0xbf'),'account':_0x15f6b7['Account'][_0xc08f('0x2f')],'agent':_0x15f6b7[_0xc08f('0xbc')]?_0x15f6b7[_0xc08f('0xbc')][_0xc08f('0x54')]:'N.A.','createdAt':moment(_0x15f6b7[_0xc08f('0x8d')])[_0xc08f('0x7b')](_0xc08f('0xa6'))[_0xc08f('0xb4')](),'closedAt':_0x15f6b7[_0xc08f('0x70')]?moment(_0x15f6b7[_0xc08f('0xc0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc08f('0xb4')]():'','disposition':_0x15f6b7[_0xc08f('0xc1')],'chatInfo':{'browser':_0x15f6b7['browserName'],'os':_0x15f6b7[_0xc08f('0xc2')],'referer':_0x15f6b7[_0xc08f('0xc3')],'customerIp':_0x15f6b7[_0xc08f('0xc4')],'customerPort':_0x15f6b7[_0xc08f('0xc5')]?_0x15f6b7[_0xc08f('0xc5')]:_0xc08f('0xc6')},'messages':_(_0x15f6b7[_0xc08f('0x7f')])[_0xc08f('0xc7')]()[_0xc08f('0xa2')]({'secret':![]})[_0xc08f('0xa3')](function(_0x4ad6e0){if(_0x4ad6e0['Attachment']){var _0x1a6d98=path[_0xc08f('0x74')](_0x175f34,_0x4ad6e0['Attachment'][_0xc08f('0x6c')]);if(fs[_0xc08f('0xc8')](_0x1a6d98)){fs[_0xc08f('0xc9')](_0x1a6d98)['pipe'](fs['createWriteStream'](path[_0xc08f('0x74')](_0x44e07f,_0x4ad6e0['Attachment'][_0xc08f('0x6c')])));}}return{'date':moment(_0x4ad6e0['createdAt'])[_0xc08f('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc08f('0xb4')](),'sender':_0x4ad6e0[_0xc08f('0x8f')]===_0xc08f('0xca')?_0x4ad6e0[_0xc08f('0x80')]?_0x4ad6e0[_0xc08f('0x80')]['fullname']:_0xc08f('0x84'):_0x4ad6e0[_0xc08f('0x65')][_0xc08f('0xb9')]+(_0x4ad6e0[_0xc08f('0x65')]['lastName']?'\x20'+_0x4ad6e0['Contact'][_0xc08f('0xba')]:''),'body':_0x4ad6e0[_0xc08f('0x6e')]?_0x4ad6e0['Attachment'][_0xc08f('0x6c')]:_0x4ad6e0['body'],'direction':_0x4ad6e0[_0xc08f('0x8f')]===_0xc08f('0xca')?'A':'C','secret':_0x4ad6e0[_0xc08f('0x90')],'read':_0x4ad6e0['read'],'attachment':_0x4ad6e0[_0xc08f('0x6e')]};})[_0xc08f('0xcb')]()};return ejs[_0xc08f('0xcc')](path[_0xc08f('0x74')](config['root'],_0xc08f('0xb5'),_0xc08f('0xcd'),_0xc08f('0xce')),{'interaction':_0x5a07fa})[_0xc08f('0x17')](function(_0x223c19){var _0x39111f=path[_0xc08f('0x74')](_0x44e07f,_0xc08f('0xcf')+_0x15f6b7['id']+'-'+_0x99458f+'.pdf');var _0x5ef730={'path':_0x39111f,'channel':'Chat','interactionId':_0x15f6b7['id']};return pdf['createPdfFromHTML'](_0x223c19,_0x5ef730);})[_0xc08f('0x17')](function(){return new Promise(function(_0x47de11,_0x5a248c){zipdir(_0x44e07f,{'saveTo':_0x463a6b},function(_0x2c7d29,_0x345000){if(_0x2c7d29)return _0x5a248c(_0x2c7d29);return _0x47de11(_0x345000);});})[_0xc08f('0x17')](function(){return new BPromise(function(_0x417375,_0x3baa39){rimraf(_0x44e07f,function(_0x2bfd35){if(_0x2bfd35)_0x3baa39(_0x2bfd35);return _0x417375();});});})[_0xc08f('0x17')](function(){return _0x230447[_0xc08f('0x78')](_0x463a6b,_0x358e8a,function(_0x28ed90){if(_0x28ed90){logger[_0xc08f('0x1e')](_0xc08f('0xd0'),_0x28ed90);}else{fs['unlinkSync'](_0x463a6b);}});});});}else{return _0x230447[_0xc08f('0x2e')](0xc8);}})[_0xc08f('0x22')](handleError(_0x230447,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 94630a8..e73446d 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 _0x12b0=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save'];(function(_0x102394,_0x106b73){var _0x4d3d85=function(_0x525637){while(--_0x525637){_0x102394['push'](_0x102394['shift']());}};_0x4d3d85(++_0x106b73);}(_0x12b0,0xc7));var _0x012b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x12b0[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x012b('0x0'));var ChatInteraction=require(_0x012b('0x1'))['db'][_0x012b('0x2')];var ChatMessage=require(_0x012b('0x1'))['db'][_0x012b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x012b('0x4'),'afterUpdate':_0x012b('0x5'),'afterDestroy':_0x012b('0x6')};function emitEvent(_0x3eda62){return function(_0x4394ab,_0x2b326d,_0x16324f){_0x4394ab[_0x012b('0x7')]({'attributes':['id'],'raw':!![]})[_0x012b('0x8')](function(_0x6b7547){_0x4394ab[_0x012b('0x9')](_0x012b('0xa'),_0x6b7547[_0x012b('0xb')](function(_0x8494b6){return{'id':_0x8494b6['id']};}));return ChatMessage[_0x012b('0xc')]({'where':{'ChatInteractionId':_0x4394ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x012b('0x8')](function(_0x5c2558){_0x4394ab[_0x012b('0x9')](_0x012b('0xd'),_0x5c2558[_0x012b('0xe')]);ChatInteractionEvents['emit'](_0x3eda62+':'+_0x4394ab['id'],_0x4394ab);ChatInteractionEvents[_0x012b('0xf')](_0x3eda62,_0x4394ab);_0x16324f(null);})['catch'](_0x16324f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x012b('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xcc0d=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook'];(function(_0x3ebc04,_0xbd5a78){var _0x3754fc=function(_0xccbac9){while(--_0xccbac9){_0x3ebc04['push'](_0x3ebc04['shift']());}};_0x3754fc(++_0xbd5a78);}(_0xcc0d,0xa3));var _0xdcc0=function(_0x4a4fec,_0x9ee607){_0x4a4fec=_0x4a4fec-0x0;var _0x59cacc=_0xcc0d[_0x4a4fec];return _0x59cacc;};'use strict';var EventEmitter=require(_0xdcc0('0x0'));var ChatInteraction=require(_0xdcc0('0x1'))['db'][_0xdcc0('0x2')];var ChatMessage=require(_0xdcc0('0x1'))['db'][_0xdcc0('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdcc0('0x4'),'afterUpdate':_0xdcc0('0x5'),'afterDestroy':_0xdcc0('0x6')};function emitEvent(_0x5c8d8a){return function(_0x56b635,_0x5ba9de,_0x3f8571){_0x56b635['getUsers']({'attributes':['id'],'raw':!![]})[_0xdcc0('0x7')](function(_0x273999){_0x56b635['setDataValue'](_0xdcc0('0x8'),_0x273999[_0xdcc0('0x9')](function(_0x16f2e6){return{'id':_0x16f2e6['id']};}));return ChatMessage[_0xdcc0('0xa')]({'where':{'ChatInteractionId':_0x56b635['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdcc0('0x7')](function(_0x554d1f){_0x56b635[_0xdcc0('0xb')]('unreadMessages',_0x554d1f[_0xdcc0('0xc')]);ChatInteractionEvents[_0xdcc0('0xd')](_0x5c8d8a+':'+_0x56b635['id'],_0x56b635);ChatInteractionEvents[_0xdcc0('0xd')](_0x5c8d8a,_0x56b635);_0x3f8571(null);})[_0xdcc0('0xe')](_0x3f8571(null));};}for(var e in events){if(events[_0xdcc0('0xf')](e)){var event=events[e];ChatInteraction[_0xdcc0('0x10')](e,emitEvent(event));}}module[_0xdcc0('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 196d745..d5ff731 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 _0x0731=['moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0731,0x11a));var _0x1073=function(_0xebb7e,_0x51d3ad){_0xebb7e=_0xebb7e-0x0;var _0x26222d=_0x0731[_0xebb7e];return _0x26222d;};'use strict';var _=require(_0x1073('0x0'));var util=require(_0x1073('0x1'));var logger=require(_0x1073('0x2'))('api');var moment=require(_0x1073('0x3'));var BPromise=require(_0x1073('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1073('0x5'));var rimraf=require(_0x1073('0x6'));var config=require(_0x1073('0x7'));var attributes=require(_0x1073('0x8'));module[_0x1073('0x9')]=function(_0x486441,_0x477b3e){return _0x486441[_0x1073('0xa')](_0x1073('0xb'),attributes,{'tableName':_0x1073('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xed01c4,_0x1bc061,_0x2a17d4){if(_0xed01c4[_0x1073('0xd')](_0x1073('0xe'))){_0xed01c4[_0x1073('0xf')]=moment()[_0x1073('0x10')](_0x1073('0x11'));}_0x2a17d4(null,_0xed01c4);}},'charset':'utf8mb4','collate':_0x1073('0x12')});}; \ No newline at end of file +var _0x135b=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','format'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x135b,0xec));var _0xb135=function(_0xa46cc9,_0x327f7d){_0xa46cc9=_0xa46cc9-0x0;var _0x5683ed=_0x135b[_0xa46cc9];return _0x5683ed;};'use strict';var _=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var logger=require(_0xb135('0x2'))(_0xb135('0x3'));var moment=require(_0xb135('0x4'));var BPromise=require(_0xb135('0x5'));var rp=require(_0xb135('0x6'));var fs=require('fs');var path=require(_0xb135('0x7'));var rimraf=require(_0xb135('0x8'));var config=require('../../config/environment');var attributes=require(_0xb135('0x9'));module[_0xb135('0xa')]=function(_0x294136,_0x1b6db6){return _0x294136['define'](_0xb135('0xb'),attributes,{'tableName':_0xb135('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x582e0d,_0x51027b,_0x5f2f9c){if(_0x582e0d[_0xb135('0xd')](_0xb135('0xe'))){_0x582e0d['closedAt']=moment()[_0xb135('0xf')](_0xb135('0x10'));}_0x5f2f9c(null,_0x582e0d);}},'charset':_0xb135('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d601193..0b499bb 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 _0x5fde=['error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','limit','AddTagsToChatInteraction','addTags','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x143629,_0x56c3e3){var _0x14c8aa=function(_0x23f077){while(--_0x23f077){_0x143629['push'](_0x143629['shift']());}};_0x14c8aa(++_0x56c3e3);}(_0x5fde,0x1e4));var _0xe5fd=function(_0xd18de3,_0x5129ca){_0xd18de3=_0xd18de3-0x0;var _0xca6917=_0x5fde[_0xd18de3];return _0xca6917;};'use strict';var _=require(_0xe5fd('0x0'));var util=require(_0xe5fd('0x1'));var moment=require('moment');var BPromise=require(_0xe5fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5fd('0x3'));var db=require(_0xe5fd('0x4'))['db'];var utils=require(_0xe5fd('0x5'));var logger=require(_0xe5fd('0x6'))(_0xe5fd('0x7'));var config=require(_0xe5fd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe5fd('0x9')][_0xe5fd('0xa')]({'port':0x232a});config[_0xe5fd('0xb')]=_[_0xe5fd('0xc')](config['redis'],{'host':_0xe5fd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5fd('0xb')]));require('./chatInteraction.socket')[_0xe5fd('0xe')](socket);function respondWithRpcPromise(_0x442489,_0x22eaed,_0x3d6f0b){return new BPromise(function(_0x4cca6b,_0x129c19){return client[_0xe5fd('0xf')](_0x442489,_0x3d6f0b)[_0xe5fd('0x10')](function(_0x5a7332){logger[_0xe5fd('0x11')](_0xe5fd('0x12'),_0x22eaed,_0xe5fd('0x13'));logger[_0xe5fd('0x14')](_0xe5fd('0x15'),_0x22eaed,_0xe5fd('0x13'),JSON[_0xe5fd('0x16')](_0x5a7332));if(_0x5a7332[_0xe5fd('0x17')]){if(_0x5a7332[_0xe5fd('0x17')][_0xe5fd('0x18')]===0x1f4){logger[_0xe5fd('0x17')](_0xe5fd('0x12'),_0x22eaed,_0x5a7332['error'][_0xe5fd('0x19')]);return _0x129c19(_0x5a7332[_0xe5fd('0x17')][_0xe5fd('0x19')]);}logger[_0xe5fd('0x17')](_0xe5fd('0x12'),_0x22eaed,_0x5a7332[_0xe5fd('0x17')][_0xe5fd('0x19')]);return _0x4cca6b(_0x5a7332[_0xe5fd('0x17')][_0xe5fd('0x19')]);}else{logger[_0xe5fd('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x22eaed,'request\x20sent');_0x4cca6b(_0x5a7332[_0xe5fd('0x1a')]['message']);}})[_0xe5fd('0x1b')](function(_0x3bce4a){logger[_0xe5fd('0x17')](_0xe5fd('0x12'),_0x22eaed,_0x3bce4a);_0x129c19(_0x3bce4a);});});}exports[_0xe5fd('0x1c')]=function(_0x4bfb33){var _0x1c6220=this;return new Promise(function(_0x4f51dd,_0xa560a3){return db[_0xe5fd('0x1d')]['update'](_0x4bfb33[_0xe5fd('0x1e')],{'raw':_0x4bfb33[_0xe5fd('0x1f')]?_0x4bfb33[_0xe5fd('0x1f')][_0xe5fd('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bfb33[_0xe5fd('0x1f')]?_0x4bfb33[_0xe5fd('0x1f')][_0xe5fd('0x21')]||null:null,'attributes':_0x4bfb33['options']?_0x4bfb33[_0xe5fd('0x1f')]['attributes']||null:null,'limit':_0x4bfb33['options']?_0x4bfb33[_0xe5fd('0x1f')][_0xe5fd('0x22')]||null:null})[_0xe5fd('0x10')](function(_0x27228f){logger[_0xe5fd('0x11')](_0xe5fd('0x1c'),_0x4bfb33);logger[_0xe5fd('0x14')](_0xe5fd('0x1c'),_0x4bfb33,JSON[_0xe5fd('0x16')](_0x27228f));_0x4f51dd(_0x27228f);})[_0xe5fd('0x1b')](function(_0x4744e5){logger[_0xe5fd('0x17')](_0xe5fd('0x1c'),_0x4744e5[_0xe5fd('0x19')],_0x4bfb33);_0xa560a3(_0x1c6220[_0xe5fd('0x17')](0x1f4,_0x4744e5['message']));});});};exports[_0xe5fd('0x23')]=function(_0x2fc30b){return new Promise(function(_0x3214a3,_0x385feb){return db[_0xe5fd('0x1d')]['find']({'where':_0x2fc30b['options']?_0x2fc30b[_0xe5fd('0x1f')][_0xe5fd('0x21')]||null:null})['then'](function(_0xc50b2a){if(_0xc50b2a){return _0xc50b2a[_0xe5fd('0x24')](_0x2fc30b[_0xe5fd('0x1e')]['ids'],_['omit'](_0x2fc30b[_0xe5fd('0x1e')],['ids','id'])||{});}})[_0xe5fd('0x25')](function(_0x46bf10){logger['info'](_0xe5fd('0x26'),_0x2fc30b);logger[_0xe5fd('0x14')](_0xe5fd('0x26'),_0x2fc30b,JSON[_0xe5fd('0x16')](_0x46bf10));_0x3214a3(_0x46bf10);})['catch'](function(_0x3ca365){logger['error'](_0xe5fd('0x26'),_0x3ca365[_0xe5fd('0x19')],_0x2fc30b);_0x385feb(_this[_0xe5fd('0x17')](0x1f4,_0x3ca365['message']));});});}; \ No newline at end of file +var _0xe67d=['AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ChatInteraction','update','body','options','attributes','UpdateChatInteraction','catch'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xe67d,0x150));var _0xde67=function(_0x30597e,_0x3d3e66){_0x30597e=_0x30597e-0x0;var _0x17b1cf=_0xe67d[_0x30597e];return _0x17b1cf;};'use strict';var _=require(_0xde67('0x0'));var util=require(_0xde67('0x1'));var moment=require(_0xde67('0x2'));var BPromise=require(_0xde67('0x3'));var rs=require(_0xde67('0x4'));var fs=require('fs');var Redis=require(_0xde67('0x5'));var db=require(_0xde67('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde67('0x7'));var config=require(_0xde67('0x8'));var jayson=require(_0xde67('0x9'));var client=jayson[_0xde67('0xa')][_0xde67('0xb')]({'port':0x232a});config[_0xde67('0xc')]=_[_0xde67('0xd')](config[_0xde67('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde67('0xc')]));require('./chatInteraction.socket')[_0xde67('0xe')](socket);function respondWithRpcPromise(_0x2f46d1,_0x4fafb2,_0x1ce2e2){return new BPromise(function(_0x469660,_0x14b4d9){return client[_0xde67('0xf')](_0x2f46d1,_0x1ce2e2)[_0xde67('0x10')](function(_0x29e160){logger[_0xde67('0x11')](_0xde67('0x12'),_0x4fafb2,_0xde67('0x13'));logger[_0xde67('0x14')](_0xde67('0x15'),_0x4fafb2,_0xde67('0x13'),JSON[_0xde67('0x16')](_0x29e160));if(_0x29e160['error']){if(_0x29e160[_0xde67('0x17')]['code']===0x1f4){logger[_0xde67('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4fafb2,_0x29e160[_0xde67('0x17')][_0xde67('0x18')]);return _0x14b4d9(_0x29e160['error']['message']);}logger[_0xde67('0x17')](_0xde67('0x12'),_0x4fafb2,_0x29e160[_0xde67('0x17')][_0xde67('0x18')]);return _0x469660(_0x29e160['error'][_0xde67('0x18')]);}else{logger['info'](_0xde67('0x12'),_0x4fafb2,'request\x20sent');_0x469660(_0x29e160[_0xde67('0x19')][_0xde67('0x18')]);}})['catch'](function(_0x5c7180){logger['error'](_0xde67('0x12'),_0x4fafb2,_0x5c7180);_0x14b4d9(_0x5c7180);});});}exports['UpdateChatInteraction']=function(_0x45efcb){var _0x349df4=this;return new Promise(function(_0x148e45,_0x477897){return db[_0xde67('0x1a')][_0xde67('0x1b')](_0x45efcb[_0xde67('0x1c')],{'raw':_0x45efcb[_0xde67('0x1d')]?_0x45efcb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45efcb[_0xde67('0x1d')]?_0x45efcb[_0xde67('0x1d')]['where']||null:null,'attributes':_0x45efcb[_0xde67('0x1d')]?_0x45efcb['options'][_0xde67('0x1e')]||null:null,'limit':_0x45efcb[_0xde67('0x1d')]?_0x45efcb[_0xde67('0x1d')]['limit']||null:null})[_0xde67('0x10')](function(_0x489d92){logger[_0xde67('0x11')](_0xde67('0x1f'),_0x45efcb);logger[_0xde67('0x14')](_0xde67('0x1f'),_0x45efcb,JSON['stringify'](_0x489d92));_0x148e45(_0x489d92);})[_0xde67('0x20')](function(_0x19a33e){logger[_0xde67('0x17')](_0xde67('0x1f'),_0x19a33e[_0xde67('0x18')],_0x45efcb);_0x477897(_0x349df4[_0xde67('0x17')](0x1f4,_0x19a33e[_0xde67('0x18')]));});});};exports[_0xde67('0x21')]=function(_0x476244){return new Promise(function(_0x5038ba,_0xcb5e66){return db['ChatInteraction'][_0xde67('0x22')]({'where':_0x476244[_0xde67('0x1d')]?_0x476244['options'][_0xde67('0x23')]||null:null})[_0xde67('0x10')](function(_0x100099){if(_0x100099){return _0x100099[_0xde67('0x24')](_0x476244['body'][_0xde67('0x25')],_[_0xde67('0x26')](_0x476244['body'],[_0xde67('0x25'),'id'])||{});}})[_0xde67('0x27')](function(_0x4719c0){logger[_0xde67('0x11')](_0xde67('0x28'),_0x476244);logger[_0xde67('0x14')](_0xde67('0x28'),_0x476244,JSON[_0xde67('0x16')](_0x4719c0));_0x5038ba(_0x4719c0);})[_0xde67('0x20')](function(_0x26c2d8){logger[_0xde67('0x17')](_0xde67('0x28'),_0x26c2d8[_0xde67('0x18')],_0x476244);_0xcb5e66(_this[_0xde67('0x17')](0x1f4,_0x26c2d8[_0xde67('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8f38497..df4e49a 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 _0x17af=['removeListener','register','length','chatInteraction:','./chatInteraction.events','remove','update','emit'];(function(_0x303d3e,_0x1330e9){var _0xb012e3=function(_0x1a66c5){while(--_0x1a66c5){_0x303d3e['push'](_0x303d3e['shift']());}};_0xb012e3(++_0x1330e9);}(_0x17af,0x19c));var _0xf17a=function(_0x395f9c,_0x1f6aa0){_0x395f9c=_0x395f9c-0x0;var _0x296560=_0x17af[_0x395f9c];return _0x296560;};'use strict';var ChatInteractionEvents=require(_0xf17a('0x0'));var events=['save',_0xf17a('0x1'),_0xf17a('0x2')];function createListener(_0x39574a,_0x47b60e){return function(_0x3cdc95){_0x47b60e[_0xf17a('0x3')](_0x39574a,_0x3cdc95);};}function removeListener(_0x36dafc,_0x33c1cc){return function(){ChatInteractionEvents[_0xf17a('0x4')](_0x36dafc,_0x33c1cc);};}exports[_0xf17a('0x5')]=function(_0x41a6b6){for(var _0x156cf8=0x0,_0x52cb8a=events[_0xf17a('0x6')];_0x156cf8<_0x52cb8a;_0x156cf8++){var _0x57f163=events[_0x156cf8];var _0x43f3a3=createListener(_0xf17a('0x7')+_0x57f163,_0x41a6b6);ChatInteractionEvents['on'](_0x57f163,_0x43f3a3);}}; \ No newline at end of file +var _0x582f=['save','remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x2d97e4,_0x1ac3af){var _0x5eb7e1=function(_0x2bb817){while(--_0x2bb817){_0x2d97e4['push'](_0x2d97e4['shift']());}};_0x5eb7e1(++_0x1ac3af);}(_0x582f,0xce));var _0xf582=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x582f[_0x276468];return _0x36dc3a;};'use strict';var ChatInteractionEvents=require(_0xf582('0x0'));var events=[_0xf582('0x1'),_0xf582('0x2'),_0xf582('0x3')];function createListener(_0xea1913,_0x274bc7){return function(_0x3501b3){_0x274bc7[_0xf582('0x4')](_0xea1913,_0x3501b3);};}function removeListener(_0x71b9eb,_0x4581b8){return function(){ChatInteractionEvents[_0xf582('0x5')](_0x71b9eb,_0x4581b8);};}exports[_0xf582('0x6')]=function(_0x4e299c){for(var _0x28eb3a=0x0,_0x7158f9=events[_0xf582('0x7')];_0x28eb3a<_0x7158f9;_0x28eb3a++){var _0x4ace78=events[_0x28eb3a];var _0x449cd2=createListener(_0xf582('0x8')+_0x4ace78,_0x4e299c);ChatInteractionEvents['on'](_0x4ace78,_0x449cd2);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c72bbea..2145b76 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 _0x0d0f=['chatinteraction:destroy','removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','isChatInteractionAuthorized','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0d0f,0xc7));var _0xf0d0=function(_0xa989f6,_0x1a950e){_0xa989f6=_0xa989f6-0x0;var _0x50e6c7=_0x0d0f[_0xa989f6];return _0x50e6c7;};'use strict';var multer=require(_0xf0d0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf0d0('0x1')]();var fs_extra=require(_0xf0d0('0x2'));var auth=require(_0xf0d0('0x3'));var interaction=require(_0xf0d0('0x4'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0xf0d0('0x5')]('/',auth[_0xf0d0('0x6')](),controller[_0xf0d0('0x7')]);router[_0xf0d0('0x5')](_0xf0d0('0x8'),auth[_0xf0d0('0x6')](),controller[_0xf0d0('0x9')]);router['get'](_0xf0d0('0xa'),auth['isChatInteractionAuthorized'](),controller[_0xf0d0('0xb')]);router[_0xf0d0('0x5')](_0xf0d0('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xf0d0('0xd')]);router[_0xf0d0('0x5')](_0xf0d0('0xe'),auth[_0xf0d0('0x6')](),controller[_0xf0d0('0xf')]);router[_0xf0d0('0x5')]('/:id/my_messages',auth[_0xf0d0('0x10')](),controller['getMyMessages']);router[_0xf0d0('0x5')]('/:id/download',auth[_0xf0d0('0x6')](),controller[_0xf0d0('0x11')]);router[_0xf0d0('0x12')]('/',auth[_0xf0d0('0x6')](),controller[_0xf0d0('0x13')]);router['post'](_0xf0d0('0x14'),auth[_0xf0d0('0x6')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xf0d0('0x15')]({'destination':function(_0x412d1a,_0x4cb9f5,_0x59c094){_0x59c094(null,path[_0xf0d0('0x16')](config[_0xf0d0('0x17')],_0xf0d0('0x18')));},'filename':function(_0x277226,_0x483c17,_0x56e27f){_0x56e27f(null,util[_0xf0d0('0x19')](_0xf0d0('0x1a'),Date[_0xf0d0('0x1b')](),_0x483c17['originalname'][_0xf0d0('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf0d0('0x12')](_0xf0d0('0x1d'),upload[_0xf0d0('0x1e')](_0xf0d0('0x1f')),controller['attachmentUpload']);router[_0xf0d0('0x12')]('/:id/messages',auth[_0xf0d0('0x10')](),controller[_0xf0d0('0x20')]);router['post'](_0xf0d0('0x21'),auth[_0xf0d0('0x6')](),interaction[_0xf0d0('0x22')](_0xf0d0('0x23'),_0xf0d0('0x24')),controller[_0xf0d0('0x25')]);router[_0xf0d0('0x26')](_0xf0d0('0xa'),auth[_0xf0d0('0x6')](),interaction[_0xf0d0('0x22')](_0xf0d0('0x23'),_0xf0d0('0x27')),controller[_0xf0d0('0x28')]);router[_0xf0d0('0x26')](_0xf0d0('0x29'),controller[_0xf0d0('0x2a')]);router[_0xf0d0('0x26')]('/:id/abandon',auth[_0xf0d0('0x10')](),controller[_0xf0d0('0x2b')]);router['put'](_0xf0d0('0x2c'),controller[_0xf0d0('0x2d')]);router['delete'](_0xf0d0('0xa'),auth['isAuthenticated'](),interaction[_0xf0d0('0x22')](_0xf0d0('0x23'),_0xf0d0('0x2e')),controller['destroy']);router['delete'](_0xf0d0('0x21'),auth['isAuthenticated'](),controller[_0xf0d0('0x2f')]);module[_0xf0d0('0x30')]=router; \ No newline at end of file +var _0x5dd7=['put','chatinteraction:update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','root','format','%s-%s','now','originalname','/:id/attachment_upload','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags'];(function(_0x5ddfcc,_0x4c57f8){var _0x5cec79=function(_0xc93db5){while(--_0xc93db5){_0x5ddfcc['push'](_0x5ddfcc['shift']());}};_0x5cec79(++_0x4c57f8);}(_0x5dd7,0x9e));var _0x75dd=function(_0x52c3e1,_0x2107d0){_0x52c3e1=_0x52c3e1-0x0;var _0x4cf675=_0x5dd7[_0x52c3e1];return _0x4cf675;};'use strict';var multer=require(_0x75dd('0x0'));var util=require(_0x75dd('0x1'));var path=require(_0x75dd('0x2'));var timeout=require('connect-timeout');var express=require(_0x75dd('0x3'));var router=express['Router']();var fs_extra=require(_0x75dd('0x4'));var auth=require(_0x75dd('0x5'));var interaction=require(_0x75dd('0x6'));var config=require('../../config/environment');var controller=require(_0x75dd('0x7'));router[_0x75dd('0x8')]('/',auth[_0x75dd('0x9')](),controller['index']);router[_0x75dd('0x8')](_0x75dd('0xa'),auth[_0x75dd('0x9')](),controller['describe']);router[_0x75dd('0x8')]('/:id',auth['isChatInteractionAuthorized'](),controller['show']);router['get'](_0x75dd('0xb'),auth[_0x75dd('0xc')](),controller[_0x75dd('0xd')]);router[_0x75dd('0x8')](_0x75dd('0xe'),auth[_0x75dd('0x9')](),controller[_0x75dd('0xf')]);router[_0x75dd('0x8')](_0x75dd('0x10'),auth[_0x75dd('0xc')](),controller[_0x75dd('0x11')]);router[_0x75dd('0x8')](_0x75dd('0x12'),auth[_0x75dd('0x9')](),controller[_0x75dd('0x13')]);router[_0x75dd('0x14')]('/',auth[_0x75dd('0x9')](),controller[_0x75dd('0x15')]);router[_0x75dd('0x14')](_0x75dd('0x16'),auth['isAuthenticated'](),controller[_0x75dd('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x235548,_0x4aee5d,_0x422b34){_0x422b34(null,path[_0x75dd('0x18')](config[_0x75dd('0x19')],'server/files/attachments/'));},'filename':function(_0x3f52f3,_0x3e4d98,_0x482b96){_0x482b96(null,util[_0x75dd('0x1a')](_0x75dd('0x1b'),Date[_0x75dd('0x1c')](),_0x3e4d98[_0x75dd('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x75dd('0x1e'),upload['single'](_0x75dd('0x1f')),controller[_0x75dd('0x20')]);router[_0x75dd('0x14')](_0x75dd('0xe'),auth[_0x75dd('0xc')](),controller[_0x75dd('0x21')]);router[_0x75dd('0x14')]('/:id/tags',auth[_0x75dd('0x9')](),interaction[_0x75dd('0x22')](_0x75dd('0x23'),_0x75dd('0x24')),controller[_0x75dd('0x25')]);router[_0x75dd('0x26')]('/:id',auth[_0x75dd('0x9')](),interaction[_0x75dd('0x22')](_0x75dd('0x23'),_0x75dd('0x27')),controller['update']);router[_0x75dd('0x26')]('/:id/custom_update',controller[_0x75dd('0x28')]);router[_0x75dd('0x26')](_0x75dd('0x29'),auth['isChatInteractionAuthorized'](),controller[_0x75dd('0x2a')]);router[_0x75dd('0x26')](_0x75dd('0x2b'),controller[_0x75dd('0x2c')]);router[_0x75dd('0x2d')]('/:id',auth[_0x75dd('0x9')](),interaction[_0x75dd('0x22')](_0x75dd('0x23'),_0x75dd('0x2e')),controller[_0x75dd('0x2f')]);router['delete']('/:id/tags',auth[_0x75dd('0x9')](),controller['removeTags']);module[_0x75dd('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index ebbaf01..24d3db3 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 _0x1d5b=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x1d5b,0x1b2));var _0xb1d5=function(_0x2a0b50,_0x442dc8){_0x2a0b50=_0x2a0b50-0x0;var _0x15b700=_0x1d5b[_0x2a0b50];return _0x15b700;};'use strict';var Sequelize=require(_0xb1d5('0x0'));module['exports']={'body':{'type':Sequelize[_0xb1d5('0x1')](_0xb1d5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb1d5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb1d5('0x4')]}}; \ No newline at end of file +var _0x4ba5=['medium','exports'];(function(_0x2d9122,_0x227e82){var _0x9f5b3b=function(_0x5d23c4){while(--_0x5d23c4){_0x2d9122['push'](_0x2d9122['shift']());}};_0x9f5b3b(++_0x227e82);}(_0x4ba5,0x147));var _0x54ba=function(_0x2d9dfb,_0x2daffc){_0x2d9dfb=_0x2d9dfb-0x0;var _0x3a14cb=_0x4ba5[_0x2d9dfb];return _0x3a14cb;};'use strict';var Sequelize=require('sequelize');module[_0x54ba('0x0')]={'body':{'type':Sequelize['TEXT'](_0x54ba('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'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 f6e3056..01250f5 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 _0xb7b1=['internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','push','FromId','ToId','read','all','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','error','stack','name','index','map','ChatInternalMessage','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','then','include','findAll','catch','show','includeAll','find','create','body','params','describe','get','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','fullname','role','userpic'];(function(_0x8cffeb,_0x394925){var _0x197f90=function(_0x50166c){while(--_0x50166c){_0x8cffeb['push'](_0x8cffeb['shift']());}};_0x197f90(++_0x394925);}(_0xb7b1,0x1c6));var _0x1b7b=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xb7b1[_0x19b3f9];return _0x18c3f6;};'use strict';var emlformat=require(_0x1b7b('0x0'));var rimraf=require(_0x1b7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b7b('0x2'));var rp=require('request-promise');var moment=require(_0x1b7b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b7b('0x4'));var path=require(_0x1b7b('0x5'));var sox=require(_0x1b7b('0x6'));var csv=require(_0x1b7b('0x7'));var ejs=require(_0x1b7b('0x8'));var fs=require('fs');var fs_extra=require(_0x1b7b('0x9'));var _=require('lodash');var squel=require(_0x1b7b('0xa'));var crypto=require('crypto');var jsforce=require(_0x1b7b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1b7b('0x7'));var querystring=require(_0x1b7b('0xc'));var Papa=require(_0x1b7b('0xd'));var Redis=require(_0x1b7b('0xe'));var authService=require(_0x1b7b('0xf'));var qs=require(_0x1b7b('0x10'));var as=require(_0x1b7b('0x11'));var hardwareService=require(_0x1b7b('0x12'));var logger=require(_0x1b7b('0x13'))(_0x1b7b('0x14'));var utils=require(_0x1b7b('0x15'));var config=require(_0x1b7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b7b('0x17'))['db'];config['redis']=_[_0x1b7b('0x18')](config['redis'],{'host':_0x1b7b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b7b('0x1a')]));require('./chatInternalMessage.socket')[_0x1b7b('0x1b')](socket);function respondWithStatusCode(_0x3f0b3f,_0x17689a){_0x17689a=_0x17689a||0xcc;return function(_0x473e7c){if(_0x473e7c){return _0x3f0b3f[_0x1b7b('0x1c')](_0x17689a);}return _0x3f0b3f['status'](_0x17689a)[_0x1b7b('0x1d')]();};}function respondWithResult(_0x38ae1c,_0x119334){_0x119334=_0x119334||0xc8;return function(_0x179b14){if(_0x179b14){return _0x38ae1c[_0x1b7b('0x1e')](_0x119334)[_0x1b7b('0x1f')](_0x179b14);}};}function respondWithFilteredResult(_0x54c22d,_0x33469e){return function(_0x29bde8){if(_0x29bde8){var _0x44b591=typeof _0x33469e[_0x1b7b('0x20')]===_0x1b7b('0x21')&&typeof _0x33469e['limit']===_0x1b7b('0x21');var _0x4d109d=_0x29bde8[_0x1b7b('0x22')];var _0x5f1895=_0x44b591?0x0:_0x33469e[_0x1b7b('0x20')];var _0x31483b=_0x44b591?_0x29bde8['count']:_0x33469e[_0x1b7b('0x20')]+_0x33469e[_0x1b7b('0x23')];var _0x590615;if(_0x31483b>=_0x4d109d){_0x31483b=_0x4d109d;_0x590615=0xc8;}else{_0x590615=0xce;}_0x54c22d[_0x1b7b('0x1e')](_0x590615);return _0x54c22d[_0x1b7b('0x24')]('Content-Range',_0x5f1895+'-'+_0x31483b+'/'+_0x4d109d)[_0x1b7b('0x1f')](_0x29bde8);}return null;};}function patchUpdates(_0x1ccaee){return function(_0xfffd9){try{jsonpatch[_0x1b7b('0x25')](_0xfffd9,_0x1ccaee,!![]);}catch(_0x5572ef){return BPromise[_0x1b7b('0x26')](_0x5572ef);}return _0xfffd9[_0x1b7b('0x27')]();};}function saveUpdates(_0x586cf2,_0x445858){return function(_0x2c9b19){if(_0x2c9b19){return _0x2c9b19[_0x1b7b('0x28')](_0x586cf2)['then'](function(_0x2b520c){return _0x2b520c;});}return null;};}function removeEntity(_0xb2e21b,_0x315f21){return function(_0x57029d){if(_0x57029d){return _0x57029d[_0x1b7b('0x29')]()['then'](function(){_0xb2e21b[_0x1b7b('0x1e')](0xcc)[_0x1b7b('0x1d')]();});}};}function handleEntityNotFound(_0xc107f,_0x35b5ae){return function(_0x43cfc8){if(!_0x43cfc8){_0xc107f[_0x1b7b('0x1c')](0x194);}return _0x43cfc8;};}function handleError(_0xa30e44,_0x5da732){_0x5da732=_0x5da732||0x1f4;return function(_0xe2fbc9){logger[_0x1b7b('0x2a')](_0xe2fbc9[_0x1b7b('0x2b')]);if(_0xe2fbc9[_0x1b7b('0x2c')]){delete _0xe2fbc9[_0x1b7b('0x2c')];}_0xa30e44['status'](_0x5da732)['send'](_0xe2fbc9);};}exports[_0x1b7b('0x2d')]=function(_0x47b2c6,_0x5c9ccb){var _0x3df440={},_0x59601a={},_0x39de23={'count':0x0,'rows':[]};var _0x48d5ba=_[_0x1b7b('0x2e')](db[_0x1b7b('0x2f')][_0x1b7b('0x30')],function(_0x1e9ef1){return{'name':_0x1e9ef1['fieldName'],'type':_0x1e9ef1['type'][_0x1b7b('0x31')]};});_0x59601a['model']=_[_0x1b7b('0x2e')](_0x48d5ba,_0x1b7b('0x2c'));_0x59601a[_0x1b7b('0x32')]=_[_0x1b7b('0x33')](_0x47b2c6[_0x1b7b('0x32')]);_0x59601a[_0x1b7b('0x34')]=_[_0x1b7b('0x35')](_0x59601a[_0x1b7b('0x36')],_0x59601a[_0x1b7b('0x32')]);_0x3df440[_0x1b7b('0x37')]=_[_0x1b7b('0x35')](_0x59601a[_0x1b7b('0x36')],qs[_0x1b7b('0x38')](_0x47b2c6[_0x1b7b('0x32')][_0x1b7b('0x38')]));_0x3df440[_0x1b7b('0x37')]=_0x3df440[_0x1b7b('0x37')][_0x1b7b('0x39')]?_0x3df440['attributes']:_0x59601a['model'];if(!_0x47b2c6[_0x1b7b('0x32')]['hasOwnProperty'](_0x1b7b('0x3a'))){_0x3df440[_0x1b7b('0x23')]=qs['limit'](_0x47b2c6[_0x1b7b('0x32')]['limit']);_0x3df440['offset']=qs[_0x1b7b('0x20')](_0x47b2c6[_0x1b7b('0x32')][_0x1b7b('0x20')]);}_0x3df440[_0x1b7b('0x3b')]=qs[_0x1b7b('0x3c')](_0x47b2c6['query'][_0x1b7b('0x3c')]);_0x3df440['where']=qs[_0x1b7b('0x34')](_[_0x1b7b('0x3d')](_0x47b2c6[_0x1b7b('0x32')],_0x59601a[_0x1b7b('0x34')]),_0x48d5ba);if(_0x47b2c6[_0x1b7b('0x32')]['filter']){_0x3df440[_0x1b7b('0x3e')]=_[_0x1b7b('0x3f')](_0x3df440[_0x1b7b('0x3e')],{'$or':_[_0x1b7b('0x2e')](_0x48d5ba,function(_0x279bd5){if(_0x279bd5[_0x1b7b('0x40')]!==_0x1b7b('0x41')){var _0x11adbd={};_0x11adbd[_0x279bd5['name']]={'$like':'%'+_0x47b2c6[_0x1b7b('0x32')][_0x1b7b('0x42')]+'%'};return _0x11adbd;}})});}_0x3df440=_[_0x1b7b('0x3f')]({},_0x3df440,_0x47b2c6[_0x1b7b('0x43')]);var _0x4d47c8={'where':_0x3df440[_0x1b7b('0x3e')]};return db[_0x1b7b('0x2f')][_0x1b7b('0x22')](_0x4d47c8)[_0x1b7b('0x44')](function(_0x4a3720){_0x39de23['count']=_0x4a3720;if(_0x47b2c6[_0x1b7b('0x32')]['includeAll']){_0x3df440[_0x1b7b('0x45')]=[{'all':!![]}];}return db[_0x1b7b('0x2f')][_0x1b7b('0x46')](_0x3df440);})['then'](function(_0x534908){_0x39de23['rows']=_0x534908;return _0x39de23;})[_0x1b7b('0x44')](respondWithFilteredResult(_0x5c9ccb,_0x3df440))[_0x1b7b('0x47')](handleError(_0x5c9ccb,null));};exports[_0x1b7b('0x48')]=function(_0x345c8f,_0x55ad6e){var _0x42c269={'raw':!![],'where':{'id':_0x345c8f['params']['id']}},_0x1b6009={};_0x1b6009[_0x1b7b('0x36')]=_[_0x1b7b('0x33')](db[_0x1b7b('0x2f')][_0x1b7b('0x30')]);_0x1b6009[_0x1b7b('0x32')]=_[_0x1b7b('0x33')](_0x345c8f['query']);_0x1b6009[_0x1b7b('0x34')]=_['intersection'](_0x1b6009['model'],_0x1b6009['query']);_0x42c269[_0x1b7b('0x37')]=_[_0x1b7b('0x35')](_0x1b6009[_0x1b7b('0x36')],qs['fields'](_0x345c8f[_0x1b7b('0x32')][_0x1b7b('0x38')]));_0x42c269[_0x1b7b('0x37')]=_0x42c269['attributes'][_0x1b7b('0x39')]?_0x42c269[_0x1b7b('0x37')]:_0x1b6009[_0x1b7b('0x36')];if(_0x345c8f['query'][_0x1b7b('0x49')]){_0x42c269[_0x1b7b('0x45')]=[{'all':!![]}];}_0x42c269=_[_0x1b7b('0x3f')]({},_0x42c269,_0x345c8f[_0x1b7b('0x43')]);return db[_0x1b7b('0x2f')][_0x1b7b('0x4a')](_0x42c269)[_0x1b7b('0x44')](handleEntityNotFound(_0x55ad6e,null))[_0x1b7b('0x44')](respondWithResult(_0x55ad6e,null))['catch'](handleError(_0x55ad6e,null));};exports['create']=function(_0x482ae7,_0x26bb27){return db[_0x1b7b('0x2f')][_0x1b7b('0x4b')](_0x482ae7[_0x1b7b('0x4c')],{})[_0x1b7b('0x44')](respondWithResult(_0x26bb27,0xc9))[_0x1b7b('0x47')](handleError(_0x26bb27,null));};exports['update']=function(_0x30b112,_0x39a34b){if(_0x30b112[_0x1b7b('0x4c')]['id']){delete _0x30b112[_0x1b7b('0x4c')]['id'];}return db[_0x1b7b('0x2f')][_0x1b7b('0x4a')]({'where':{'id':_0x30b112[_0x1b7b('0x4d')]['id']}})[_0x1b7b('0x44')](handleEntityNotFound(_0x39a34b,null))['then'](saveUpdates(_0x30b112[_0x1b7b('0x4c')],null))['then'](respondWithResult(_0x39a34b,null))[_0x1b7b('0x47')](handleError(_0x39a34b,null));};exports[_0x1b7b('0x29')]=function(_0x5e4da3,_0x433e0d){return db[_0x1b7b('0x2f')][_0x1b7b('0x4a')]({'where':{'id':_0x5e4da3[_0x1b7b('0x4d')]['id']}})[_0x1b7b('0x44')](handleEntityNotFound(_0x433e0d,null))[_0x1b7b('0x44')](removeEntity(_0x433e0d,null))['catch'](handleError(_0x433e0d,null));};exports[_0x1b7b('0x4e')]=function(_0x1ca7c8,_0x5a1f8f){return db['ChatInternalMessage']['describe']()[_0x1b7b('0x44')](respondWithResult(_0x5a1f8f,null))[_0x1b7b('0x47')](handleError(_0x5a1f8f,null));};function wrapUser(_0x337030){return function(_0x413f99){var _0x38b38d=_0x337030[_0x1b7b('0x4f')]({'plain':!![]});_0x38b38d[_0x1b7b('0x50')]=[];if(_0x413f99){_0x38b38d['lastMessageAt']=_0x413f99[_0x1b7b('0x51')];_0x38b38d['lastMessage']=_0x413f99;}else{_0x38b38d[_0x1b7b('0x52')]=moment(0x0)[_0x1b7b('0x53')](_0x1b7b('0x54'));_0x38b38d[_0x1b7b('0x55')]={};}return _0x38b38d;};}exports['getUsers']=function(_0x5ce501,_0x4cbef9,_0x7f4718){var _0x2cb568=[];return db[_0x1b7b('0x56')][_0x1b7b('0x46')]({'where':{'role':[_0x1b7b('0x57'),'admin','user']},'attributes':['id',_0x1b7b('0x58'),_0x1b7b('0x2c'),_0x1b7b('0x59'),_0x1b7b('0x5a'),_0x1b7b('0x5b'),_0x1b7b('0x5c'),_0x1b7b('0x5d'),_0x1b7b('0x5e'),_0x1b7b('0x5f')],'order':qs[_0x1b7b('0x3c')](_0x1b7b('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0x1b7b('0x61'),'attributes':['id',_0x1b7b('0x2c'),_0x1b7b('0x40')],'through':{'attributes':[]}}]})[_0x1b7b('0x44')](function(_0x49a096){if(_0x49a096){var _0x447732=_0x5ce501[_0x1b7b('0x62')][_0x1b7b('0x4f')]({'plain':!![]});if(!_0x447732)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x447732[_0x1b7b('0x59')]===_0x1b7b('0x62')){return db[_0x1b7b('0x63')][_0x1b7b('0x4a')]({'where':{'name':_0x1b7b('0x64'),'userProfileId':_0x447732[_0x1b7b('0x65')]},'raw':!![]})[_0x1b7b('0x44')](function(_0x1a88e3){if(_0x1a88e3){if(_0x1a88e3[_0x1b7b('0x66')]===0x0){return db[_0x1b7b('0x67')][_0x1b7b('0x46')]({'where':{'sectionId':_0x1a88e3['id']},'raw':!![]})[_0x1b7b('0x44')](function(_0x4bfd46){var _0x5aeb36=[];if(_['isEmpty'](_0x4bfd46)){_0x5aeb36=_[_0x1b7b('0x42')](_0x49a096,function(_0xdbbde5){if(_0xdbbde5[_0x1b7b('0x59')]!=='agent'){return _0xdbbde5;}});return _0x5aeb36;}else{for(var _0x138176=0x0;_0x138176<_0x49a096['length'];_0x138176++){var _0x514f0c=_0x49a096[_0x138176];if(_0x514f0c['role']===_0x1b7b('0x57')){var _0x3d2679=_[_0x1b7b('0x4a')](_0x4bfd46,function(_0x3d8fc1){return _0x3d8fc1['resourceId']===_0x514f0c['id'];});if(_0x3d2679)_0x5aeb36[_0x1b7b('0x68')](_0x514f0c);}else{_0x5aeb36[_0x1b7b('0x68')](_0x514f0c);}}return _0x5aeb36;}});}else{return _0x49a096;}}else{var _0x162025=_[_0x1b7b('0x42')](_0x49a096,function(_0x329cc8){if(_0x329cc8[_0x1b7b('0x59')]!==_0x1b7b('0x57')){return _0x329cc8;}});return _0x162025;}});}else{return _0x49a096;}}})[_0x1b7b('0x44')](function(_0x5eafb2){var _0x4a415d=[];if(_0x5eafb2){_0x2cb568=_0x5eafb2;for(var _0x1cdad2=0x0;_0x1cdad2<_0x5eafb2[_0x1b7b('0x39')];_0x1cdad2+=0x1){_0x2cb568[_0x1cdad2]['messages']=[];_0x4a415d[_0x1b7b('0x68')](db[_0x1b7b('0x2f')][_0x1b7b('0x4a')]({'where':{'FromId':[_0x5ce501[_0x1b7b('0x62')]['id'],_0x5eafb2[_0x1cdad2]['id']],'ToId':[_0x5ce501[_0x1b7b('0x62')]['id'],_0x5eafb2[_0x1cdad2]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x1b7b('0x69'),_0x1b7b('0x6a'),_0x1b7b('0x6b'),'body'],'order':qs[_0x1b7b('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5eafb2[_0x1cdad2])));}return BPromise[_0x1b7b('0x6c')](_0x4a415d);}return[];})[_0x1b7b('0x44')](function(_0x216f7c){return{'rows':_0x216f7c,'count':_0x216f7c['length']};})[_0x1b7b('0x44')](respondWithResult(_0x4cbef9,null))[_0x1b7b('0x47')](handleError(_0x4cbef9,null));}; \ No newline at end of file +var _0xef32=['User','agent','admin','user','fullname','role','internal','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','all','eml-format','zip-dir','moment','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../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','register','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatInternalMessage','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2a40b2,_0x35c0c1){var _0x6c4056=function(_0xa1a401){while(--_0xa1a401){_0x2a40b2['push'](_0x2a40b2['shift']());}};_0x6c4056(++_0x35c0c1);}(_0xef32,0x83));var _0x2ef3=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xef32[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0x2ef3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ef3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2ef3('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2ef3('0x3'));var path=require(_0x2ef3('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2ef3('0x5'));var fs=require('fs');var fs_extra=require(_0x2ef3('0x6'));var _=require(_0x2ef3('0x7'));var squel=require(_0x2ef3('0x8'));var crypto=require('crypto');var jsforce=require(_0x2ef3('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2ef3('0xa'));var querystring=require(_0x2ef3('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ef3('0xc'));var qs=require(_0x2ef3('0xd'));var as=require(_0x2ef3('0xe'));var hardwareService=require(_0x2ef3('0xf'));var logger=require(_0x2ef3('0x10'))(_0x2ef3('0x11'));var utils=require(_0x2ef3('0x12'));var config=require(_0x2ef3('0x13'));var licenseUtil=require(_0x2ef3('0x14'));var db=require(_0x2ef3('0x15'))['db'];config[_0x2ef3('0x16')]=_[_0x2ef3('0x17')](config[_0x2ef3('0x16')],{'host':_0x2ef3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x2ef3('0x19')](socket);function respondWithStatusCode(_0x3c6134,_0x457348){_0x457348=_0x457348||0xcc;return function(_0x54653d){if(_0x54653d){return _0x3c6134['sendStatus'](_0x457348);}return _0x3c6134['status'](_0x457348)[_0x2ef3('0x1a')]();};}function respondWithResult(_0x537dea,_0x570804){_0x570804=_0x570804||0xc8;return function(_0x5db24c){if(_0x5db24c){return _0x537dea[_0x2ef3('0x1b')](_0x570804)[_0x2ef3('0x1c')](_0x5db24c);}};}function respondWithFilteredResult(_0x1a1eb4,_0x353872){return function(_0x9ebdac){if(_0x9ebdac){var _0x43027f=typeof _0x353872[_0x2ef3('0x1d')]==='undefined'&&typeof _0x353872['limit']===_0x2ef3('0x1e');var _0xb265a9=_0x9ebdac[_0x2ef3('0x1f')];var _0x3f376a=_0x43027f?0x0:_0x353872[_0x2ef3('0x1d')];var _0x2a48ee=_0x43027f?_0x9ebdac[_0x2ef3('0x1f')]:_0x353872[_0x2ef3('0x1d')]+_0x353872[_0x2ef3('0x20')];var _0x2e3fb1;if(_0x2a48ee>=_0xb265a9){_0x2a48ee=_0xb265a9;_0x2e3fb1=0xc8;}else{_0x2e3fb1=0xce;}_0x1a1eb4['status'](_0x2e3fb1);return _0x1a1eb4[_0x2ef3('0x21')](_0x2ef3('0x22'),_0x3f376a+'-'+_0x2a48ee+'/'+_0xb265a9)[_0x2ef3('0x1c')](_0x9ebdac);}return null;};}function patchUpdates(_0x3e26cc){return function(_0x4f1b7a){try{jsonpatch[_0x2ef3('0x23')](_0x4f1b7a,_0x3e26cc,!![]);}catch(_0x5f2056){return BPromise[_0x2ef3('0x24')](_0x5f2056);}return _0x4f1b7a[_0x2ef3('0x25')]();};}function saveUpdates(_0x165776,_0x40a5a8){return function(_0x3637a2){if(_0x3637a2){return _0x3637a2[_0x2ef3('0x26')](_0x165776)[_0x2ef3('0x27')](function(_0x5d3958){return _0x5d3958;});}return null;};}function removeEntity(_0x59cdc9,_0x1b1721){return function(_0x536e0f){if(_0x536e0f){return _0x536e0f[_0x2ef3('0x28')]()[_0x2ef3('0x27')](function(){_0x59cdc9[_0x2ef3('0x1b')](0xcc)[_0x2ef3('0x1a')]();});}};}function handleEntityNotFound(_0x32bd69,_0x224519){return function(_0x276691){if(!_0x276691){_0x32bd69[_0x2ef3('0x29')](0x194);}return _0x276691;};}function handleError(_0x405c3a,_0x504e83){_0x504e83=_0x504e83||0x1f4;return function(_0x110928){logger['error'](_0x110928[_0x2ef3('0x2a')]);if(_0x110928[_0x2ef3('0x2b')]){delete _0x110928[_0x2ef3('0x2b')];}_0x405c3a[_0x2ef3('0x1b')](_0x504e83)[_0x2ef3('0x2c')](_0x110928);};}exports[_0x2ef3('0x2d')]=function(_0x50912d,_0x1566f6){var _0x5c3af0={},_0x12a42d={},_0x7ca75e={'count':0x0,'rows':[]};var _0x29f8eb=_[_0x2ef3('0x2e')](db[_0x2ef3('0x2f')]['rawAttributes'],function(_0x566038){return{'name':_0x566038['fieldName'],'type':_0x566038[_0x2ef3('0x30')][_0x2ef3('0x31')]};});_0x12a42d[_0x2ef3('0x32')]=_[_0x2ef3('0x2e')](_0x29f8eb,'name');_0x12a42d['query']=_[_0x2ef3('0x33')](_0x50912d[_0x2ef3('0x34')]);_0x12a42d[_0x2ef3('0x35')]=_['intersection'](_0x12a42d[_0x2ef3('0x32')],_0x12a42d[_0x2ef3('0x34')]);_0x5c3af0[_0x2ef3('0x36')]=_[_0x2ef3('0x37')](_0x12a42d[_0x2ef3('0x32')],qs[_0x2ef3('0x38')](_0x50912d[_0x2ef3('0x34')][_0x2ef3('0x38')]));_0x5c3af0['attributes']=_0x5c3af0[_0x2ef3('0x36')][_0x2ef3('0x39')]?_0x5c3af0[_0x2ef3('0x36')]:_0x12a42d[_0x2ef3('0x32')];if(!_0x50912d[_0x2ef3('0x34')][_0x2ef3('0x3a')](_0x2ef3('0x3b'))){_0x5c3af0[_0x2ef3('0x20')]=qs['limit'](_0x50912d[_0x2ef3('0x34')]['limit']);_0x5c3af0[_0x2ef3('0x1d')]=qs[_0x2ef3('0x1d')](_0x50912d[_0x2ef3('0x34')][_0x2ef3('0x1d')]);}_0x5c3af0[_0x2ef3('0x3c')]=qs['sort'](_0x50912d[_0x2ef3('0x34')][_0x2ef3('0x3d')]);_0x5c3af0[_0x2ef3('0x3e')]=qs[_0x2ef3('0x35')](_[_0x2ef3('0x3f')](_0x50912d[_0x2ef3('0x34')],_0x12a42d['filters']),_0x29f8eb);if(_0x50912d[_0x2ef3('0x34')][_0x2ef3('0x40')]){_0x5c3af0[_0x2ef3('0x3e')]=_['merge'](_0x5c3af0[_0x2ef3('0x3e')],{'$or':_[_0x2ef3('0x2e')](_0x29f8eb,function(_0x2e3f94){if(_0x2e3f94['type']!==_0x2ef3('0x41')){var _0x15f729={};_0x15f729[_0x2e3f94[_0x2ef3('0x2b')]]={'$like':'%'+_0x50912d[_0x2ef3('0x34')][_0x2ef3('0x40')]+'%'};return _0x15f729;}})});}_0x5c3af0=_[_0x2ef3('0x42')]({},_0x5c3af0,_0x50912d['options']);var _0x3147b0={'where':_0x5c3af0[_0x2ef3('0x3e')]};return db[_0x2ef3('0x2f')]['count'](_0x3147b0)[_0x2ef3('0x27')](function(_0x5164b3){_0x7ca75e[_0x2ef3('0x1f')]=_0x5164b3;if(_0x50912d[_0x2ef3('0x34')][_0x2ef3('0x43')]){_0x5c3af0[_0x2ef3('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x2ef3('0x45')](_0x5c3af0);})[_0x2ef3('0x27')](function(_0x3d0e19){_0x7ca75e[_0x2ef3('0x46')]=_0x3d0e19;return _0x7ca75e;})['then'](respondWithFilteredResult(_0x1566f6,_0x5c3af0))['catch'](handleError(_0x1566f6,null));};exports[_0x2ef3('0x47')]=function(_0x10e4cb,_0x515340){var _0x597598={'raw':!![],'where':{'id':_0x10e4cb[_0x2ef3('0x48')]['id']}},_0x346c05={};_0x346c05[_0x2ef3('0x32')]=_[_0x2ef3('0x33')](db[_0x2ef3('0x2f')][_0x2ef3('0x49')]);_0x346c05[_0x2ef3('0x34')]=_[_0x2ef3('0x33')](_0x10e4cb[_0x2ef3('0x34')]);_0x346c05[_0x2ef3('0x35')]=_[_0x2ef3('0x37')](_0x346c05[_0x2ef3('0x32')],_0x346c05[_0x2ef3('0x34')]);_0x597598[_0x2ef3('0x36')]=_[_0x2ef3('0x37')](_0x346c05['model'],qs['fields'](_0x10e4cb['query'][_0x2ef3('0x38')]));_0x597598['attributes']=_0x597598[_0x2ef3('0x36')]['length']?_0x597598[_0x2ef3('0x36')]:_0x346c05[_0x2ef3('0x32')];if(_0x10e4cb['query'][_0x2ef3('0x43')]){_0x597598[_0x2ef3('0x44')]=[{'all':!![]}];}_0x597598=_[_0x2ef3('0x42')]({},_0x597598,_0x10e4cb[_0x2ef3('0x4a')]);return db[_0x2ef3('0x2f')][_0x2ef3('0x4b')](_0x597598)[_0x2ef3('0x27')](handleEntityNotFound(_0x515340,null))['then'](respondWithResult(_0x515340,null))[_0x2ef3('0x4c')](handleError(_0x515340,null));};exports['create']=function(_0xcc3b26,_0x456390){return db[_0x2ef3('0x2f')]['create'](_0xcc3b26[_0x2ef3('0x4d')],{})[_0x2ef3('0x27')](respondWithResult(_0x456390,0xc9))[_0x2ef3('0x4c')](handleError(_0x456390,null));};exports[_0x2ef3('0x26')]=function(_0x20c29e,_0x57645f){if(_0x20c29e[_0x2ef3('0x4d')]['id']){delete _0x20c29e[_0x2ef3('0x4d')]['id'];}return db['ChatInternalMessage'][_0x2ef3('0x4b')]({'where':{'id':_0x20c29e['params']['id']}})[_0x2ef3('0x27')](handleEntityNotFound(_0x57645f,null))['then'](saveUpdates(_0x20c29e[_0x2ef3('0x4d')],null))[_0x2ef3('0x27')](respondWithResult(_0x57645f,null))[_0x2ef3('0x4c')](handleError(_0x57645f,null));};exports[_0x2ef3('0x28')]=function(_0x47e204,_0x6bb6e3){return db[_0x2ef3('0x2f')][_0x2ef3('0x4b')]({'where':{'id':_0x47e204[_0x2ef3('0x48')]['id']}})[_0x2ef3('0x27')](handleEntityNotFound(_0x6bb6e3,null))['then'](removeEntity(_0x6bb6e3,null))[_0x2ef3('0x4c')](handleError(_0x6bb6e3,null));};exports[_0x2ef3('0x4e')]=function(_0xfabeec,_0x2f7098){return db['ChatInternalMessage']['describe']()[_0x2ef3('0x27')](respondWithResult(_0x2f7098,null))[_0x2ef3('0x4c')](handleError(_0x2f7098,null));};function wrapUser(_0x4a0526){return function(_0x320cd8){var _0x128039=_0x4a0526['get']({'plain':!![]});_0x128039[_0x2ef3('0x4f')]=[];if(_0x320cd8){_0x128039[_0x2ef3('0x50')]=_0x320cd8[_0x2ef3('0x51')];_0x128039[_0x2ef3('0x52')]=_0x320cd8;}else{_0x128039[_0x2ef3('0x50')]=moment(0x0)[_0x2ef3('0x53')](_0x2ef3('0x54'));_0x128039['lastMessage']={};}return _0x128039;};}exports['getUsers']=function(_0x2f1848,_0x4f0fc5,_0x3091b3){var _0x473e27=[];return db[_0x2ef3('0x55')]['findAll']({'where':{'role':[_0x2ef3('0x56'),_0x2ef3('0x57'),_0x2ef3('0x58')]},'attributes':['id',_0x2ef3('0x59'),_0x2ef3('0x2b'),_0x2ef3('0x5a'),'userpic',_0x2ef3('0x5b'),'online',_0x2ef3('0x5c'),'allowmessenger',_0x2ef3('0x5d')],'order':qs[_0x2ef3('0x3d')](_0x2ef3('0x5e')),'include':[{'model':db[_0x2ef3('0x5f')],'as':_0x2ef3('0x60'),'attributes':['id',_0x2ef3('0x2b'),_0x2ef3('0x30')],'through':{'attributes':[]}}]})['then'](function(_0x1d87c8){if(_0x1d87c8){var _0x4eba03=_0x2f1848[_0x2ef3('0x58')][_0x2ef3('0x61')]({'plain':!![]});if(!_0x4eba03)throw new Error(_0x2ef3('0x62'));if(_0x4eba03[_0x2ef3('0x5a')]===_0x2ef3('0x58')){return db['UserProfileSection'][_0x2ef3('0x4b')]({'where':{'name':'Agents','userProfileId':_0x4eba03[_0x2ef3('0x63')]},'raw':!![]})[_0x2ef3('0x27')](function(_0x53883c){if(_0x53883c){if(_0x53883c[_0x2ef3('0x64')]===0x0){return db[_0x2ef3('0x65')][_0x2ef3('0x45')]({'where':{'sectionId':_0x53883c['id']},'raw':!![]})[_0x2ef3('0x27')](function(_0x569bf9){var _0x55038f=[];if(_[_0x2ef3('0x66')](_0x569bf9)){_0x55038f=_[_0x2ef3('0x40')](_0x1d87c8,function(_0x3b3aca){if(_0x3b3aca[_0x2ef3('0x5a')]!==_0x2ef3('0x56')){return _0x3b3aca;}});return _0x55038f;}else{for(var _0xf452f4=0x0;_0xf452f4<_0x1d87c8[_0x2ef3('0x39')];_0xf452f4++){var _0x30a29a=_0x1d87c8[_0xf452f4];if(_0x30a29a['role']===_0x2ef3('0x56')){var _0xe6083f=_[_0x2ef3('0x4b')](_0x569bf9,function(_0x3b7274){return _0x3b7274[_0x2ef3('0x67')]===_0x30a29a['id'];});if(_0xe6083f)_0x55038f[_0x2ef3('0x68')](_0x30a29a);}else{_0x55038f[_0x2ef3('0x68')](_0x30a29a);}}return _0x55038f;}});}else{return _0x1d87c8;}}else{var _0x19fcaf=_[_0x2ef3('0x40')](_0x1d87c8,function(_0x53ba2c){if(_0x53ba2c[_0x2ef3('0x5a')]!==_0x2ef3('0x56')){return _0x53ba2c;}});return _0x19fcaf;}});}else{return _0x1d87c8;}}})['then'](function(_0x293cd2){var _0xc9dce0=[];if(_0x293cd2){_0x473e27=_0x293cd2;for(var _0x151261=0x0;_0x151261<_0x293cd2[_0x2ef3('0x39')];_0x151261+=0x1){_0x473e27[_0x151261]['messages']=[];_0xc9dce0['push'](db[_0x2ef3('0x2f')]['find']({'where':{'FromId':[_0x2f1848[_0x2ef3('0x58')]['id'],_0x293cd2[_0x151261]['id']],'ToId':[_0x2f1848[_0x2ef3('0x58')]['id'],_0x293cd2[_0x151261]['id']],'ChatGroupId':null},'attributes':['id',_0x2ef3('0x51'),_0x2ef3('0x69'),'ToId',_0x2ef3('0x6a'),_0x2ef3('0x4d')],'order':qs[_0x2ef3('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2ef3('0x27')](wrapUser(_0x293cd2[_0x151261])));}return BPromise[_0x2ef3('0x6b')](_0xc9dce0);}return[];})[_0x2ef3('0x27')](function(_0x2f7ed9){return{'rows':_0x2f7ed9,'count':_0x2f7ed9[_0x2ef3('0x39')]};})[_0x2ef3('0x27')](respondWithResult(_0x4f0fc5,null))[_0x2ef3('0x4c')](handleError(_0x4f0fc5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index bb7b88a..7b341d0 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 _0xe7d2=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x5d5912,_0x184e28){var _0x3ca890=function(_0x2bbee2){while(--_0x2bbee2){_0x5d5912['push'](_0x5d5912['shift']());}};_0x3ca890(++_0x184e28);}(_0xe7d2,0x13c));var _0x2e7d=function(_0x45cd76,_0x2e2a5b){_0x45cd76=_0x45cd76-0x0;var _0x55918d=_0xe7d2[_0x45cd76];return _0x55918d;};'use strict';var EventEmitter=require(_0x2e7d('0x0'));var ChatInternalMessage=require(_0x2e7d('0x1'))['db'][_0x2e7d('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2e7d('0x3')](0x0);var events={'afterCreate':_0x2e7d('0x4'),'afterUpdate':_0x2e7d('0x5'),'afterDestroy':_0x2e7d('0x6')};function emitEvent(_0x34f2f0){return function(_0x428c15,_0x4df6e0,_0x2946dd){ChatInternalMessageEvents[_0x2e7d('0x7')](_0x34f2f0+':'+_0x428c15['id'],_0x428c15);ChatInternalMessageEvents['emit'](_0x34f2f0,_0x428c15);_0x2946dd(null);};}for(var e in events){if(events[_0x2e7d('0x8')](e)){var event=events[e];ChatInternalMessage[_0x2e7d('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xe323=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xe323,0x16c));var _0x3e32=function(_0x393785,_0x46c39e){_0x393785=_0x393785-0x0;var _0x5e47c8=_0xe323[_0x393785];return _0x5e47c8;};'use strict';var EventEmitter=require(_0x3e32('0x0'));var ChatInternalMessage=require(_0x3e32('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3e32('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e32('0x3'),'afterDestroy':_0x3e32('0x4')};function emitEvent(_0x1d192d){return function(_0x1830a6,_0x1fa28e,_0x64dcb2){ChatInternalMessageEvents[_0x3e32('0x5')](_0x1d192d+':'+_0x1830a6['id'],_0x1830a6);ChatInternalMessageEvents['emit'](_0x1d192d,_0x1830a6);_0x64dcb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x3e32('0x6')](e,emitEvent(event));}}module[_0x3e32('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 1efdafe..1388cbd 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 _0x0573=['request-promise','path','./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x571bbd,_0x36721f){var _0x3e157a=function(_0x1a41d8){while(--_0x1a41d8){_0x571bbd['push'](_0x571bbd['shift']());}};_0x3e157a(++_0x36721f);}(_0x0573,0x1b4));var _0x3057=function(_0x19c188,_0x5bb3d8){_0x19c188=_0x19c188-0x0;var _0x6b5daa=_0x0573[_0x19c188];return _0x6b5daa;};'use strict';var _=require('lodash');var util=require(_0x3057('0x0'));var logger=require(_0x3057('0x1'))('api');var moment=require(_0x3057('0x2'));var BPromise=require(_0x3057('0x3'));var rp=require(_0x3057('0x4'));var fs=require('fs');var path=require(_0x3057('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3057('0x6'));module[_0x3057('0x7')]=function(_0x415782,_0x44c357){return _0x415782['define'](_0x3057('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3057('0x9')});}; \ No newline at end of file +var _0x907f=['moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x11c47b,_0x16a144){var _0x45cd0d=function(_0x26e72c){while(--_0x26e72c){_0x11c47b['push'](_0x11c47b['shift']());}};_0x45cd0d(++_0x16a144);}(_0x907f,0xdd));var _0xf907=function(_0x177cff,_0x579af1){_0x177cff=_0x177cff-0x0;var _0x57aa10=_0x907f[_0x177cff];return _0x57aa10;};'use strict';var _=require(_0xf907('0x0'));var util=require(_0xf907('0x1'));var logger=require('../../config/logger')(_0xf907('0x2'));var moment=require(_0xf907('0x3'));var BPromise=require(_0xf907('0x4'));var rp=require(_0xf907('0x5'));var fs=require('fs');var path=require(_0xf907('0x6'));var rimraf=require('rimraf');var config=require(_0xf907('0x7'));var attributes=require(_0xf907('0x8'));module[_0xf907('0x9')]=function(_0xcec59f,_0x723fee){return _0xcec59f[_0xf907('0xa')](_0xf907('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf907('0xc'),'collate':_0xf907('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 92c26fb..0c6c45d 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 _0x25fa=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x25fa,0x109));var _0xa25f=function(_0x87895a,_0x417b96){_0x87895a=_0x87895a-0x0;var _0x14ec4b=_0x25fa[_0x87895a];return _0x14ec4b;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var moment=require(_0xa25f('0x1'));var BPromise=require(_0xa25f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa25f('0x3'));var db=require(_0xa25f('0x4'))['db'];var utils=require(_0xa25f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa25f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa25f('0x7')][_0xa25f('0x8')]({'port':0x232a});config[_0xa25f('0x9')]=_[_0xa25f('0xa')](config[_0xa25f('0x9')],{'host':_0xa25f('0xb'),'port':0x18eb});var socket=require(_0xa25f('0xc'))(new Redis(config[_0xa25f('0x9')]));require(_0xa25f('0xd'))['register'](socket);function respondWithRpcPromise(_0x1bca18,_0x31bd1d,_0x507a36){return new BPromise(function(_0x22b930,_0x12c861){return client[_0xa25f('0xe')](_0x1bca18,_0x507a36)[_0xa25f('0xf')](function(_0x5168c1){logger[_0xa25f('0x10')](_0xa25f('0x11'),_0x31bd1d,'request\x20sent');logger[_0xa25f('0x12')](_0xa25f('0x13'),_0x31bd1d,'request\x20sent',JSON[_0xa25f('0x14')](_0x5168c1));if(_0x5168c1[_0xa25f('0x15')]){if(_0x5168c1[_0xa25f('0x15')][_0xa25f('0x16')]===0x1f4){logger[_0xa25f('0x15')](_0xa25f('0x11'),_0x31bd1d,_0x5168c1[_0xa25f('0x15')][_0xa25f('0x17')]);return _0x12c861(_0x5168c1[_0xa25f('0x15')][_0xa25f('0x17')]);}logger[_0xa25f('0x15')](_0xa25f('0x11'),_0x31bd1d,_0x5168c1['error'][_0xa25f('0x17')]);return _0x22b930(_0x5168c1[_0xa25f('0x15')][_0xa25f('0x17')]);}else{logger[_0xa25f('0x10')](_0xa25f('0x11'),_0x31bd1d,_0xa25f('0x18'));_0x22b930(_0x5168c1['result'][_0xa25f('0x17')]);}})['catch'](function(_0x32b868){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x31bd1d,_0x32b868);_0x12c861(_0x32b868);});});} \ No newline at end of file +var _0xcaa7=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x22b28f,_0x466e3e){var _0x2aca97=function(_0x1bc77b){while(--_0x1bc77b){_0x22b28f['push'](_0x22b28f['shift']());}};_0x2aca97(++_0x466e3e);}(_0xcaa7,0x1a5));var _0x7caa=function(_0x38a4c9,_0x3045ca){_0x38a4c9=_0x38a4c9-0x0;var _0x5818c3=_0xcaa7[_0x38a4c9];return _0x5818c3;};'use strict';var _=require(_0x7caa('0x0'));var util=require(_0x7caa('0x1'));var moment=require('moment');var BPromise=require(_0x7caa('0x2'));var rs=require(_0x7caa('0x3'));var fs=require('fs');var Redis=require(_0x7caa('0x4'));var db=require(_0x7caa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7caa('0x6'))('rpc');var config=require(_0x7caa('0x7'));var jayson=require(_0x7caa('0x8'));var client=jayson[_0x7caa('0x9')][_0x7caa('0xa')]({'port':0x232a});config[_0x7caa('0xb')]=_[_0x7caa('0xc')](config['redis'],{'host':_0x7caa('0xd'),'port':0x18eb});var socket=require(_0x7caa('0xe'))(new Redis(config[_0x7caa('0xb')]));require(_0x7caa('0xf'))[_0x7caa('0x10')](socket);function respondWithRpcPromise(_0x3bceeb,_0x5c03e1,_0x194384){return new BPromise(function(_0x2e890c,_0x4f745f){return client[_0x7caa('0x11')](_0x3bceeb,_0x194384)['then'](function(_0x41649e){logger[_0x7caa('0x12')](_0x7caa('0x13'),_0x5c03e1,'request\x20sent');logger[_0x7caa('0x14')](_0x7caa('0x15'),_0x5c03e1,'request\x20sent',JSON[_0x7caa('0x16')](_0x41649e));if(_0x41649e['error']){if(_0x41649e[_0x7caa('0x17')][_0x7caa('0x18')]===0x1f4){logger[_0x7caa('0x17')](_0x7caa('0x13'),_0x5c03e1,_0x41649e[_0x7caa('0x17')][_0x7caa('0x19')]);return _0x4f745f(_0x41649e[_0x7caa('0x17')]['message']);}logger[_0x7caa('0x17')](_0x7caa('0x13'),_0x5c03e1,_0x41649e[_0x7caa('0x17')][_0x7caa('0x19')]);return _0x2e890c(_0x41649e[_0x7caa('0x17')]['message']);}else{logger[_0x7caa('0x12')](_0x7caa('0x13'),_0x5c03e1,'request\x20sent');_0x2e890c(_0x41649e['result']['message']);}})[_0x7caa('0x1a')](function(_0x310b35){logger[_0x7caa('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x5c03e1,_0x310b35);_0x4f745f(_0x310b35);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index fc14c94..22d6a8a 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 _0xde20=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x1a7f70,_0x297a0c){var _0x326c0a=function(_0x1e6bd8){while(--_0x1e6bd8){_0x1a7f70['push'](_0x1a7f70['shift']());}};_0x326c0a(++_0x297a0c);}(_0xde20,0x163));var _0x0de2=function(_0x4ff167,_0x770231){_0x4ff167=_0x4ff167-0x0;var _0x314f3f=_0xde20[_0x4ff167];return _0x314f3f;};'use strict';var ChatInternalMessageEvents=require(_0x0de2('0x0'));var events=[_0x0de2('0x1'),_0x0de2('0x2'),_0x0de2('0x3')];function createListener(_0x2e959f,_0x2334d9){return function(_0x4a9598){_0x2334d9[_0x0de2('0x4')](_0x2e959f,_0x4a9598);};}function removeListener(_0xb0c4f,_0x913186){return function(){ChatInternalMessageEvents[_0x0de2('0x5')](_0xb0c4f,_0x913186);};}exports[_0x0de2('0x6')]=function(_0x34adaf){for(var _0x27ea0c=0x0,_0x1149bd=events[_0x0de2('0x7')];_0x27ea0c<_0x1149bd;_0x27ea0c++){var _0x464a16=events[_0x27ea0c];var _0x1a5262=createListener(_0x0de2('0x8')+_0x464a16,_0x34adaf);ChatInternalMessageEvents['on'](_0x464a16,_0x1a5262);}}; \ No newline at end of file +var _0xb272=['emit','register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update'];(function(_0x3e1c5e,_0x56d4cd){var _0x54df7a=function(_0x4e2f81){while(--_0x4e2f81){_0x3e1c5e['push'](_0x3e1c5e['shift']());}};_0x54df7a(++_0x56d4cd);}(_0xb272,0x1e0));var _0x2b27=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xb272[_0x184759];return _0xf26d5f;};'use strict';var ChatInternalMessageEvents=require(_0x2b27('0x0'));var events=['save',_0x2b27('0x1'),_0x2b27('0x2')];function createListener(_0xf6ff52,_0x3df96f){return function(_0x9ca708){_0x3df96f[_0x2b27('0x3')](_0xf6ff52,_0x9ca708);};}function removeListener(_0x1756a2,_0xec2d5b){return function(){ChatInternalMessageEvents['removeListener'](_0x1756a2,_0xec2d5b);};}exports[_0x2b27('0x4')]=function(_0x457b5a){for(var _0x1cf6fa=0x0,_0x21ec1c=events[_0x2b27('0x5')];_0x1cf6fa<_0x21ec1c;_0x1cf6fa++){var _0x553ffa=events[_0x1cf6fa];var _0x4fb610=createListener(_0x2b27('0x6')+_0x553ffa,_0x457b5a);ChatInternalMessageEvents['on'](_0x553ffa,_0x4fb610);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ea92d88..a3d6fcd 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 _0xd618=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/users','getUsers','/:id','put','delete','destroy','exports','multer','express','../../components/auth/service'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0xd618,0x1ad));var _0x8d61=function(_0x122d4d,_0x590e87){_0x122d4d=_0x122d4d-0x0;var _0x3668cf=_0xd618[_0x122d4d];return _0x3668cf;};'use strict';var multer=require(_0x8d61('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8d61('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d61('0x2'));var interaction=require(_0x8d61('0x3'));var config=require(_0x8d61('0x4'));var controller=require('./chatInternalMessage.controller');router[_0x8d61('0x5')]('/',auth[_0x8d61('0x6')](),controller[_0x8d61('0x7')]);router[_0x8d61('0x5')](_0x8d61('0x8'),auth[_0x8d61('0x6')](),controller['describe']);router[_0x8d61('0x5')](_0x8d61('0x9'),auth[_0x8d61('0x6')](),controller[_0x8d61('0xa')]);router[_0x8d61('0x5')](_0x8d61('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8d61('0x6')](),controller['create']);router[_0x8d61('0xc')]('/:id',controller['update']);router[_0x8d61('0xd')](_0x8d61('0xb'),auth[_0x8d61('0x6')](),controller[_0x8d61('0xe')]);module[_0x8d61('0xf')]=router; \ No newline at end of file +var _0x40ff=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','/users','getUsers','show','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x100b96,_0x1bac2c){var _0x44bbcf=function(_0x3ed853){while(--_0x3ed853){_0x100b96['push'](_0x100b96['shift']());}};_0x44bbcf(++_0x1bac2c);}(_0x40ff,0x10e));var _0xf40f=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x40ff[_0x2b5513];return _0x578fd2;};'use strict';var multer=require(_0xf40f('0x0'));var util=require('util');var path=require(_0xf40f('0x1'));var timeout=require(_0xf40f('0x2'));var express=require('express');var router=express[_0xf40f('0x3')]();var fs_extra=require(_0xf40f('0x4'));var auth=require(_0xf40f('0x5'));var interaction=require(_0xf40f('0x6'));var config=require('../../config/environment');var controller=require(_0xf40f('0x7'));router['get']('/',auth[_0xf40f('0x8')](),controller[_0xf40f('0x9')]);router[_0xf40f('0xa')](_0xf40f('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xf40f('0xa')](_0xf40f('0xc'),auth['isAuthenticated'](),controller[_0xf40f('0xd')]);router[_0xf40f('0xa')]('/:id',auth[_0xf40f('0x8')](),controller[_0xf40f('0xe')]);router['post']('/',auth[_0xf40f('0x8')](),controller[_0xf40f('0xf')]);router[_0xf40f('0x10')](_0xf40f('0x11'),controller['update']);router[_0xf40f('0x12')](_0xf40f('0x11'),auth[_0xf40f('0x8')](),controller[_0xf40f('0x13')]);module[_0xf40f('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ce00510..37ca870 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 _0x6599=['out','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6599,0xb0));var _0x9659=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0x6599[_0x30182f];return _0x5207db;};'use strict';var Sequelize=require('sequelize');module[_0x9659('0x0')]={'body':{'type':Sequelize[_0x9659('0x1')](_0x9659('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9659('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9659('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9659('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x9659('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9659('0x1')]}}; \ No newline at end of file +var _0x3264=['STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3264,0x7f));var _0x4326=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3264[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'body':{'type':Sequelize[_0x4326('0x1')](_0x4326('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4326('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4326('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4326('0x5')]},'providerResponse':{'type':Sequelize[_0x4326('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 95c4aa1..0d8dbf1 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 _0x4ef5=['crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','register','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','fields','find','create','body','destroy','describe','chat-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','agent','fullname','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','SELECT','internal','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x3d9412,_0x2bd2d6){var _0x3ca4d6=function(_0x21e927){while(--_0x21e927){_0x3d9412['push'](_0x3d9412['shift']());}};_0x3ca4d6(++_0x2bd2d6);}(_0x4ef5,0x6f));var _0x54ef=function(_0x294824,_0x1d55cd){_0x294824=_0x294824-0x0;var _0x5c0a92=_0x4ef5[_0x294824];return _0x5c0a92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54ef('0x0'));var zipdir=require(_0x54ef('0x1'));var jsonpatch=require(_0x54ef('0x2'));var rp=require(_0x54ef('0x3'));var moment=require(_0x54ef('0x4'));var BPromise=require(_0x54ef('0x5'));var Mustache=require(_0x54ef('0x6'));var util=require(_0x54ef('0x7'));var path=require(_0x54ef('0x8'));var sox=require(_0x54ef('0x9'));var csv=require(_0x54ef('0xa'));var ejs=require(_0x54ef('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x54ef('0xc'));var crypto=require(_0x54ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x54ef('0xe'));var toCsv=require(_0x54ef('0xa'));var querystring=require(_0x54ef('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x54ef('0x10'));var as=require(_0x54ef('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54ef('0x12'))(_0x54ef('0x13'));var utils=require('../../config/utils');var config=require(_0x54ef('0x14'));var licenseUtil=require(_0x54ef('0x15'));var db=require('../../mysqldb')['db'];config[_0x54ef('0x16')]=_[_0x54ef('0x17')](config[_0x54ef('0x16')],{'host':_0x54ef('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x54ef('0x16')]));require(_0x54ef('0x19'))[_0x54ef('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x54ef('0x1b')][_0x54ef('0x1c')]({'port':0x232c});var client9002=jayson[_0x54ef('0x1b')][_0x54ef('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x12d17a,_0x589303,_0x451269,_0x379116){return new BPromise(function(_0x430ec5,_0x7e495){var _0x448472=_0x379116||client;return _0x448472[_0x54ef('0x1d')](_0x12d17a,_0x451269)[_0x54ef('0x1e')](function(_0x943a7e){logger[_0x54ef('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x589303,_0x54ef('0x20'));logger[_0x54ef('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x589303,_0x54ef('0x20'),JSON[_0x54ef('0x22')](_0x943a7e));if(_0x943a7e['error']){if(_0x943a7e[_0x54ef('0x23')][_0x54ef('0x24')]===0x1f4){logger[_0x54ef('0x23')](_0x54ef('0x25'),_0x589303,_0x943a7e['error'][_0x54ef('0x26')]);return _0x7e495(_0x943a7e[_0x54ef('0x23')][_0x54ef('0x26')]);}logger[_0x54ef('0x23')](_0x54ef('0x25'),_0x589303,_0x943a7e[_0x54ef('0x23')]['message']);return _0x430ec5(_0x943a7e['error']['message']);}else{logger[_0x54ef('0x1f')](_0x54ef('0x25'),_0x589303,_0x54ef('0x20'));_0x430ec5(_0x943a7e['result']['message']);}})[_0x54ef('0x27')](function(_0x195c75){logger['error']('ChatMessage,\x20%s,\x20%s',_0x589303,_0x195c75);_0x7e495(_0x195c75);});});}function respondWithStatusCode(_0x4dc700,_0x426c61){_0x426c61=_0x426c61||0xcc;return function(_0x52ed82){if(_0x52ed82){return _0x4dc700['sendStatus'](_0x426c61);}return _0x4dc700[_0x54ef('0x28')](_0x426c61)[_0x54ef('0x29')]();};}function respondWithResult(_0x4a0557,_0x25ea3d){_0x25ea3d=_0x25ea3d||0xc8;return function(_0x5176d2){if(_0x5176d2){return _0x4a0557['status'](_0x25ea3d)[_0x54ef('0x2a')](_0x5176d2);}};}function respondWithFilteredResult(_0x916dc9,_0x3cb2e4){return function(_0x46c491){if(_0x46c491){var _0x118112=typeof _0x3cb2e4[_0x54ef('0x2b')]===_0x54ef('0x2c')&&typeof _0x3cb2e4[_0x54ef('0x2d')]===_0x54ef('0x2c');var _0x28a7b7=_0x46c491[_0x54ef('0x2e')];var _0xf6c35b=_0x118112?0x0:_0x3cb2e4[_0x54ef('0x2b')];var _0x4f2cb2=_0x118112?_0x46c491[_0x54ef('0x2e')]:_0x3cb2e4[_0x54ef('0x2b')]+_0x3cb2e4['limit'];var _0x377673;if(_0x4f2cb2>=_0x28a7b7){_0x4f2cb2=_0x28a7b7;_0x377673=0xc8;}else{_0x377673=0xce;}_0x916dc9['status'](_0x377673);return _0x916dc9['set'](_0x54ef('0x2f'),_0xf6c35b+'-'+_0x4f2cb2+'/'+_0x28a7b7)[_0x54ef('0x2a')](_0x46c491);}return null;};}function patchUpdates(_0x2d801e){return function(_0x501c86){try{jsonpatch[_0x54ef('0x30')](_0x501c86,_0x2d801e,!![]);}catch(_0x38be04){return BPromise[_0x54ef('0x31')](_0x38be04);}return _0x501c86['save']();};}function saveUpdates(_0x74f8cb,_0x337e71){return function(_0x14c58f){if(_0x14c58f){return _0x14c58f[_0x54ef('0x32')](_0x74f8cb)[_0x54ef('0x1e')](function(_0x33b254){return _0x33b254;});}return null;};}function removeEntity(_0x377ea2,_0x2b628e){return function(_0x3bd587){if(_0x3bd587){return _0x3bd587['destroy']()[_0x54ef('0x1e')](function(){_0x377ea2[_0x54ef('0x28')](0xcc)[_0x54ef('0x29')]();});}};}function handleEntityNotFound(_0x23a448,_0x1b8102){return function(_0xc0c6cf){if(!_0xc0c6cf){_0x23a448[_0x54ef('0x33')](0x194);}return _0xc0c6cf;};}function handleError(_0x3e2edb,_0x4801f1){_0x4801f1=_0x4801f1||0x1f4;return function(_0x200487){logger[_0x54ef('0x23')](_0x200487[_0x54ef('0x34')]);if(_0x200487[_0x54ef('0x35')]){delete _0x200487[_0x54ef('0x35')];}_0x3e2edb['status'](_0x4801f1)[_0x54ef('0x36')](_0x200487);};}exports[_0x54ef('0x37')]=function(_0x531342,_0x5ea323){var _0x482750={},_0x994a07={},_0x593365={'count':0x0,'rows':[]};var _0x319478=_[_0x54ef('0x38')](db[_0x54ef('0x39')][_0x54ef('0x3a')],function(_0x58c40a){return{'name':_0x58c40a[_0x54ef('0x3b')],'type':_0x58c40a[_0x54ef('0x3c')][_0x54ef('0x3d')]};});_0x994a07[_0x54ef('0x3e')]=_[_0x54ef('0x38')](_0x319478,'name');_0x994a07['query']=_[_0x54ef('0x3f')](_0x531342['query']);_0x994a07[_0x54ef('0x40')]=_[_0x54ef('0x41')](_0x994a07[_0x54ef('0x3e')],_0x994a07[_0x54ef('0x42')]);_0x482750[_0x54ef('0x43')]=_[_0x54ef('0x41')](_0x994a07[_0x54ef('0x3e')],qs['fields'](_0x531342[_0x54ef('0x42')]['fields']));_0x482750[_0x54ef('0x43')]=_0x482750['attributes']['length']?_0x482750[_0x54ef('0x43')]:_0x994a07[_0x54ef('0x3e')];if(!_0x531342[_0x54ef('0x42')]['hasOwnProperty'](_0x54ef('0x44'))){_0x482750[_0x54ef('0x2d')]=qs[_0x54ef('0x2d')](_0x531342[_0x54ef('0x42')][_0x54ef('0x2d')]);_0x482750[_0x54ef('0x2b')]=qs['offset'](_0x531342[_0x54ef('0x42')]['offset']);}_0x482750[_0x54ef('0x45')]=qs[_0x54ef('0x46')](_0x531342[_0x54ef('0x42')][_0x54ef('0x46')]);_0x482750[_0x54ef('0x47')]=qs['filters'](_[_0x54ef('0x48')](_0x531342[_0x54ef('0x42')],_0x994a07[_0x54ef('0x40')]),_0x319478);if(_0x531342[_0x54ef('0x42')]['filter']){_0x482750[_0x54ef('0x47')]=_[_0x54ef('0x49')](_0x482750[_0x54ef('0x47')],{'$or':_['map'](_0x319478,function(_0x3c61f9){if(_0x3c61f9[_0x54ef('0x3c')]!==_0x54ef('0x4a')){var _0x1be120={};_0x1be120[_0x3c61f9['name']]={'$like':'%'+_0x531342['query']['filter']+'%'};return _0x1be120;}})});}_0x482750=_[_0x54ef('0x49')]({},_0x482750,_0x531342[_0x54ef('0x4b')]);var _0x59b1aa={'where':_0x482750['where']};return db[_0x54ef('0x39')][_0x54ef('0x2e')](_0x59b1aa)['then'](function(_0x40acc4){_0x593365[_0x54ef('0x2e')]=_0x40acc4;if(_0x531342['query'][_0x54ef('0x4c')]){_0x482750[_0x54ef('0x4d')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x482750);})[_0x54ef('0x1e')](function(_0x3c1c00){_0x593365[_0x54ef('0x4e')]=_0x3c1c00;return _0x593365;})[_0x54ef('0x1e')](respondWithFilteredResult(_0x5ea323,_0x482750))[_0x54ef('0x27')](handleError(_0x5ea323,null));};exports[_0x54ef('0x4f')]=function(_0x24c3ec,_0x399c2c){var _0x459a68={'raw':!![],'where':{'id':_0x24c3ec[_0x54ef('0x50')]['id']}},_0x66d5db={};_0x66d5db['model']=_['keys'](db[_0x54ef('0x39')]['rawAttributes']);_0x66d5db[_0x54ef('0x42')]=_['keys'](_0x24c3ec[_0x54ef('0x42')]);_0x66d5db[_0x54ef('0x40')]=_[_0x54ef('0x41')](_0x66d5db[_0x54ef('0x3e')],_0x66d5db[_0x54ef('0x42')]);_0x459a68[_0x54ef('0x43')]=_[_0x54ef('0x41')](_0x66d5db[_0x54ef('0x3e')],qs[_0x54ef('0x51')](_0x24c3ec[_0x54ef('0x42')]['fields']));_0x459a68[_0x54ef('0x43')]=_0x459a68['attributes']['length']?_0x459a68[_0x54ef('0x43')]:_0x66d5db[_0x54ef('0x3e')];if(_0x24c3ec[_0x54ef('0x42')][_0x54ef('0x4c')]){_0x459a68[_0x54ef('0x4d')]=[{'all':!![]}];}_0x459a68=_[_0x54ef('0x49')]({},_0x459a68,_0x24c3ec[_0x54ef('0x4b')]);return db[_0x54ef('0x39')][_0x54ef('0x52')](_0x459a68)[_0x54ef('0x1e')](handleEntityNotFound(_0x399c2c,null))[_0x54ef('0x1e')](respondWithResult(_0x399c2c,null))[_0x54ef('0x27')](handleError(_0x399c2c,null));};exports[_0x54ef('0x53')]=function(_0x5791ea,_0x3a6400){return db['ChatMessage'][_0x54ef('0x53')](_0x5791ea[_0x54ef('0x54')],{})[_0x54ef('0x1e')](respondWithResult(_0x3a6400,0xc9))['catch'](handleError(_0x3a6400,null));};exports[_0x54ef('0x32')]=function(_0x240aa8,_0x386a61){if(_0x240aa8[_0x54ef('0x54')]['id']){delete _0x240aa8[_0x54ef('0x54')]['id'];}return db['ChatMessage'][_0x54ef('0x52')]({'where':{'id':_0x240aa8['params']['id']}})['then'](handleEntityNotFound(_0x386a61,null))['then'](saveUpdates(_0x240aa8[_0x54ef('0x54')],null))[_0x54ef('0x1e')](respondWithResult(_0x386a61,null))[_0x54ef('0x27')](handleError(_0x386a61,null));};exports[_0x54ef('0x55')]=function(_0x50a9f0,_0xbf2294){return db[_0x54ef('0x39')][_0x54ef('0x52')]({'where':{'id':_0x50a9f0[_0x54ef('0x50')]['id']}})[_0x54ef('0x1e')](handleEntityNotFound(_0xbf2294,null))[_0x54ef('0x1e')](removeEntity(_0xbf2294,null))['catch'](handleError(_0xbf2294,null));};exports['describe']=function(_0x5e730a,_0x84d0c1){return db[_0x54ef('0x39')][_0x54ef('0x56')]()[_0x54ef('0x1e')](respondWithResult(_0x84d0c1,null))[_0x54ef('0x27')](handleError(_0x84d0c1,null));};var interaction_log=require(_0x54ef('0x12'))(_0x54ef('0x57'));exports[_0x54ef('0x58')]=function(_0x51e1c6,_0x1b7efa,_0x2d8b70){var _0x428c7e={'agent':{},'channel':'chat'};if(_0x51e1c6['body']['id']){delete _0x51e1c6[_0x54ef('0x54')]['id'];}_0x51e1c6[_0x54ef('0x54')]['read']=!![];_0x51e1c6[_0x54ef('0x54')][_0x54ef('0x59')]=moment()[_0x54ef('0x5a')](_0x54ef('0x5b'));_0x51e1c6['body']['UserId']=_0x51e1c6[_0x54ef('0x54')][_0x54ef('0x5c')]||_0x51e1c6[_0x54ef('0x5d')]['id'];_0x428c7e['agent']['id']=_0x51e1c6['body'][_0x54ef('0x5c')];return db[_0x54ef('0x39')][_0x54ef('0x52')]({'where':{'id':_0x51e1c6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1b7efa,null))[_0x54ef('0x1e')](saveUpdates(_0x51e1c6[_0x54ef('0x54')],null))['then'](function(_0x361150){if(_0x361150){_0x428c7e[_0x54ef('0x26')]=_0x361150[_0x54ef('0x5e')]({'plain':!![]});return db[_0x54ef('0x5f')][_0x54ef('0x52')]({'where':{'id':_0x361150[_0x54ef('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x1b7efa,null))[_0x54ef('0x1e')](function(_0x3110b2){if(_0x3110b2){return _0x3110b2[_0x54ef('0x32')]({'UserId':_0x51e1c6['body'][_0x54ef('0x5c')],'read1stAt':_['isNil'](_0x3110b2[_0x54ef('0x61')])?moment()[_0x54ef('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2c1325){if(_0x2c1325){_0x428c7e[_0x54ef('0x62')]=_0x2c1325['get']({'plain':!![]});interaction_log[_0x54ef('0x1f')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51e1c6['user']['id'],_0x51e1c6[_0x54ef('0x5d')]['name'],_0x51e1c6[_0x54ef('0x5d')][_0x54ef('0x63')],_0x428c7e[_0x54ef('0x62')]['id'],_0x51e1c6['body']?JSON[_0x54ef('0x22')](_0x51e1c6[_0x54ef('0x54')]):'null');return respondWithRpcPromise('AcceptMessage',_0x54ef('0x64'),_0x428c7e);}return null;})['then'](function(_0x3de0b6){var _0x379053=_0x54ef('0x65')+_0x3de0b6[_0x54ef('0x26')][_0x54ef('0x66')];return db[_0x54ef('0x67')][_0x54ef('0x42')](_0x379053,{'type':db['Sequelize'][_0x54ef('0x68')]['SELECT'],'raw':!![]})[_0x54ef('0x1e')](function(_0x4fd365){return _0x4fd365;});})[_0x54ef('0x1e')](function(_0x521d0){if(_0x521d0){_0x428c7e[_0x54ef('0x26')][_0x54ef('0x69')]=_0x521d0[0x0];if(!_0x51e1c6[_0x54ef('0x54')][_0x54ef('0x5c')])return;return db[_0x54ef('0x6a')][_0x54ef('0x52')]({'where':{'id':_0x51e1c6[_0x54ef('0x54')][_0x54ef('0x5c')],'role':_0x54ef('0x6b')},'attributes':['id',_0x54ef('0x35'),_0x54ef('0x6c'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x77cd60){if(!_0x77cd60)return null;_0x428c7e[_0x54ef('0x26')][_0x54ef('0x6b')]=_0x77cd60;return _0x428c7e;})[_0x54ef('0x1e')](function(_0x3557b9){if(_0x3557b9){if(_0x51e1c6[_0x54ef('0x54')]['manual']){_0x428c7e[_0x54ef('0x26')][_0x54ef('0x6d')]=util[_0x54ef('0x5a')](_0x54ef('0x6e'),_0x51e1c6[_0x54ef('0x5d')]['name']);_0x428c7e[_0x54ef('0x26')]['channel']=_0x428c7e['channel'];_0x428c7e[_0x54ef('0x26')]['motionChannel']=_0x428c7e[_0x54ef('0x6f')];_0x428c7e[_0x54ef('0x26')][_0x54ef('0x70')]=_0x54ef('0x58');return respondWithRpcPromise(_0x54ef('0x71'),_0x54ef('0x71'),{'event':_0x54ef('0x72'),'message':_[_0x54ef('0x49')](_0x428c7e[_0x54ef('0x26')],JSON[_0x54ef('0x73')](_0x428c7e[_0x54ef('0x62')][_0x54ef('0x74')]))},client9002)[_0x54ef('0x1e')](function(){return _0x428c7e;});}return _0x428c7e;}return null;})[_0x54ef('0x1e')](respondWithResult(_0x1b7efa,null))[_0x54ef('0x27')](handleError(_0x1b7efa,null));};var interaction_log=require('../../config/logger')(_0x54ef('0x57'));exports[_0x54ef('0x31')]=function(_0xfda932,_0xffcc8,_0x4d23fc){var _0x399b3d={'agent':{},'channel':'chat'};if(_0xfda932[_0x54ef('0x54')]['id']){delete _0xfda932[_0x54ef('0x54')]['id'];}_0xfda932[_0x54ef('0x54')][_0x54ef('0x5c')]=_0xfda932[_0x54ef('0x54')][_0x54ef('0x5c')]||_0xfda932[_0x54ef('0x5d')]['id'];_0x399b3d['agent']['id']=_0xfda932[_0x54ef('0x54')]['UserId'];return db[_0x54ef('0x39')][_0x54ef('0x52')]({'where':{'id':_0xfda932[_0x54ef('0x50')]['id'],'UserId':null}})[_0x54ef('0x1e')](handleEntityNotFound(_0xffcc8,null))[_0x54ef('0x1e')](function(_0x1d016c){if(_0x1d016c){_0x399b3d[_0x54ef('0x26')]=_0x1d016c[_0x54ef('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x54ef('0x52')]({'where':{'id':_0x1d016c[_0x54ef('0x60')]}});}return null;})[_0x54ef('0x1e')](handleEntityNotFound(_0xffcc8,null))['then'](function(_0x1e8705){if(_0x1e8705){_0x399b3d[_0x54ef('0x62')]=_0x1e8705[_0x54ef('0x5e')]({'plain':!![]});interaction_log[_0x54ef('0x1f')](_0x54ef('0x75'),_0xfda932[_0x54ef('0x5d')]['id'],_0xfda932[_0x54ef('0x5d')][_0x54ef('0x35')],_0xfda932[_0x54ef('0x5d')][_0x54ef('0x63')],_0x399b3d[_0x54ef('0x62')]['id'],_0xfda932[_0x54ef('0x54')]?JSON['stringify'](_0xfda932[_0x54ef('0x54')]):_0x54ef('0x76'));return respondWithRpcPromise(_0x54ef('0x77'),_0x54ef('0x78'),_0x399b3d);}return null;})[_0x54ef('0x1e')](function(_0x1bed6e){var _0x5bc479=_0x54ef('0x65')+_0x1bed6e[_0x54ef('0x26')]['ContactId'];return db[_0x54ef('0x67')]['query'](_0x5bc479,{'type':db[_0x54ef('0x79')][_0x54ef('0x68')][_0x54ef('0x7a')],'raw':!![]})[_0x54ef('0x1e')](function(_0xdf0101){return _0xdf0101;});})[_0x54ef('0x1e')](function(_0x5069e5){if(_0x5069e5){_0x399b3d[_0x54ef('0x26')]['contact']=_0x5069e5[0x0];if(!_0xfda932[_0x54ef('0x54')][_0x54ef('0x5c')])return;return db[_0x54ef('0x6a')]['find']({'where':{'id':_0xfda932[_0x54ef('0x54')]['UserId'],'role':_0x54ef('0x6b')},'attributes':['id',_0x54ef('0x35'),'fullname','email',_0x54ef('0x7b')],'raw':!![]});}return null;})[_0x54ef('0x1e')](function(_0x48c757){if(!_0x48c757)return null;_0x399b3d['message'][_0x54ef('0x6b')]=_0x48c757;return _0x399b3d;})[_0x54ef('0x1e')](function(_0x4daa8c){if(_0x4daa8c){_0x4daa8c['message'][_0x54ef('0x6d')]=util['format'](_0x54ef('0x6e'),_0xfda932['user'][_0x54ef('0x35')]);_0x4daa8c[_0x54ef('0x26')][_0x54ef('0x6f')]=_0x399b3d[_0x54ef('0x6f')];_0x4daa8c[_0x54ef('0x26')]['motionChannel']=_0x399b3d[_0x54ef('0x6f')];_0x4daa8c[_0x54ef('0x26')][_0x54ef('0x70')]='reject';respondWithRpcPromise(_0x54ef('0x71'),_0x54ef('0x71'),{'event':'rejectmessage','message':_['merge'](_0x399b3d[_0x54ef('0x26')],JSON[_0x54ef('0x73')](_0x399b3d[_0x54ef('0x62')]['formData']))},client9002);return _0x399b3d;}return null;})[_0x54ef('0x1e')](respondWithResult(_0xffcc8,null))[_0x54ef('0x27')](handleError(_0xffcc8,null));}; \ No newline at end of file +var _0xefa6=['rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','length','order','where','pick','merge','type','options','includeAll','include','findAll','rows','params','find','create','body','describe','../../config/logger','chat-interactions','accept','chat','readAt','format','UserId','user','agent','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','User','SIP/%s','motionChannel','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xefa6,0x140));var _0x6efa=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xefa6[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x6efa('0x0'));var rimraf=require(_0x6efa('0x1'));var zipdir=require(_0x6efa('0x2'));var jsonpatch=require(_0x6efa('0x3'));var rp=require('request-promise');var moment=require(_0x6efa('0x4'));var BPromise=require(_0x6efa('0x5'));var Mustache=require(_0x6efa('0x6'));var util=require(_0x6efa('0x7'));var path=require(_0x6efa('0x8'));var sox=require(_0x6efa('0x9'));var csv=require('to-csv');var ejs=require(_0x6efa('0xa'));var fs=require('fs');var fs_extra=require(_0x6efa('0xb'));var _=require(_0x6efa('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6efa('0xd'));var querystring=require(_0x6efa('0xe'));var Papa=require('papaparse');var Redis=require(_0x6efa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6efa('0x10'));var hardwareService=require(_0x6efa('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6efa('0x12'));var licenseUtil=require(_0x6efa('0x13'));var db=require(_0x6efa('0x14'))['db'];config[_0x6efa('0x15')]=_[_0x6efa('0x16')](config['redis'],{'host':_0x6efa('0x17'),'port':0x18eb});var socket=require(_0x6efa('0x18'))(new Redis(config[_0x6efa('0x15')]));require(_0x6efa('0x19'))[_0x6efa('0x1a')](socket);var jayson=require(_0x6efa('0x1b'));var client=jayson[_0x6efa('0x1c')][_0x6efa('0x1d')]({'port':0x232c});var client9002=jayson[_0x6efa('0x1c')][_0x6efa('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x30d71d,_0x54404,_0x269438,_0x32f64b){return new BPromise(function(_0x23fc4e,_0x183bd9){var _0x2edec6=_0x32f64b||client;return _0x2edec6[_0x6efa('0x1e')](_0x30d71d,_0x269438)[_0x6efa('0x1f')](function(_0x475fbd){logger[_0x6efa('0x20')](_0x6efa('0x21'),_0x54404,_0x6efa('0x22'));logger[_0x6efa('0x23')](_0x6efa('0x24'),_0x54404,_0x6efa('0x22'),JSON['stringify'](_0x475fbd));if(_0x475fbd['error']){if(_0x475fbd[_0x6efa('0x25')]['code']===0x1f4){logger[_0x6efa('0x25')](_0x6efa('0x21'),_0x54404,_0x475fbd[_0x6efa('0x25')]['message']);return _0x183bd9(_0x475fbd['error'][_0x6efa('0x26')]);}logger[_0x6efa('0x25')](_0x6efa('0x21'),_0x54404,_0x475fbd[_0x6efa('0x25')][_0x6efa('0x26')]);return _0x23fc4e(_0x475fbd[_0x6efa('0x25')][_0x6efa('0x26')]);}else{logger[_0x6efa('0x20')](_0x6efa('0x21'),_0x54404,'request\x20sent');_0x23fc4e(_0x475fbd[_0x6efa('0x27')][_0x6efa('0x26')]);}})[_0x6efa('0x28')](function(_0x1ceecb){logger['error'](_0x6efa('0x21'),_0x54404,_0x1ceecb);_0x183bd9(_0x1ceecb);});});}function respondWithStatusCode(_0xeb5f08,_0xb1ae2f){_0xb1ae2f=_0xb1ae2f||0xcc;return function(_0x53fe3b){if(_0x53fe3b){return _0xeb5f08[_0x6efa('0x29')](_0xb1ae2f);}return _0xeb5f08[_0x6efa('0x2a')](_0xb1ae2f)[_0x6efa('0x2b')]();};}function respondWithResult(_0x36bf06,_0x102168){_0x102168=_0x102168||0xc8;return function(_0x3679a1){if(_0x3679a1){return _0x36bf06[_0x6efa('0x2a')](_0x102168)[_0x6efa('0x2c')](_0x3679a1);}};}function respondWithFilteredResult(_0x38f128,_0x36e4ee){return function(_0x17b70f){if(_0x17b70f){var _0x5eae10=typeof _0x36e4ee[_0x6efa('0x2d')]===_0x6efa('0x2e')&&typeof _0x36e4ee[_0x6efa('0x2f')]===_0x6efa('0x2e');var _0x3a6a91=_0x17b70f[_0x6efa('0x30')];var _0x2aad71=_0x5eae10?0x0:_0x36e4ee['offset'];var _0x52bfdc=_0x5eae10?_0x17b70f[_0x6efa('0x30')]:_0x36e4ee[_0x6efa('0x2d')]+_0x36e4ee[_0x6efa('0x2f')];var _0x45a01c;if(_0x52bfdc>=_0x3a6a91){_0x52bfdc=_0x3a6a91;_0x45a01c=0xc8;}else{_0x45a01c=0xce;}_0x38f128[_0x6efa('0x2a')](_0x45a01c);return _0x38f128['set'](_0x6efa('0x31'),_0x2aad71+'-'+_0x52bfdc+'/'+_0x3a6a91)[_0x6efa('0x2c')](_0x17b70f);}return null;};}function patchUpdates(_0x58a43f){return function(_0x43461c){try{jsonpatch[_0x6efa('0x32')](_0x43461c,_0x58a43f,!![]);}catch(_0x5b0796){return BPromise[_0x6efa('0x33')](_0x5b0796);}return _0x43461c[_0x6efa('0x34')]();};}function saveUpdates(_0x4ece68,_0x29541b){return function(_0x3068bc){if(_0x3068bc){return _0x3068bc[_0x6efa('0x35')](_0x4ece68)[_0x6efa('0x1f')](function(_0x3fa792){return _0x3fa792;});}return null;};}function removeEntity(_0x4503b6,_0x1dd16a){return function(_0x2058c4){if(_0x2058c4){return _0x2058c4[_0x6efa('0x36')]()[_0x6efa('0x1f')](function(){_0x4503b6['status'](0xcc)[_0x6efa('0x2b')]();});}};}function handleEntityNotFound(_0x339326,_0x29691e){return function(_0x1c40eb){if(!_0x1c40eb){_0x339326[_0x6efa('0x29')](0x194);}return _0x1c40eb;};}function handleError(_0x6d0a65,_0x24d26e){_0x24d26e=_0x24d26e||0x1f4;return function(_0x5f0a23){logger[_0x6efa('0x25')](_0x5f0a23[_0x6efa('0x37')]);if(_0x5f0a23[_0x6efa('0x38')]){delete _0x5f0a23['name'];}_0x6d0a65['status'](_0x24d26e)[_0x6efa('0x39')](_0x5f0a23);};}exports[_0x6efa('0x3a')]=function(_0x2f9197,_0x51cc49){var _0x44bb07={},_0x13380c={},_0x4e06c6={'count':0x0,'rows':[]};var _0x3576d7=_[_0x6efa('0x3b')](db[_0x6efa('0x3c')][_0x6efa('0x3d')],function(_0x477b54){return{'name':_0x477b54[_0x6efa('0x3e')],'type':_0x477b54['type']['key']};});_0x13380c['model']=_[_0x6efa('0x3b')](_0x3576d7,'name');_0x13380c['query']=_[_0x6efa('0x3f')](_0x2f9197[_0x6efa('0x40')]);_0x13380c[_0x6efa('0x41')]=_[_0x6efa('0x42')](_0x13380c[_0x6efa('0x43')],_0x13380c[_0x6efa('0x40')]);_0x44bb07['attributes']=_[_0x6efa('0x42')](_0x13380c[_0x6efa('0x43')],qs[_0x6efa('0x44')](_0x2f9197[_0x6efa('0x40')]['fields']));_0x44bb07[_0x6efa('0x45')]=_0x44bb07[_0x6efa('0x45')][_0x6efa('0x46')]?_0x44bb07[_0x6efa('0x45')]:_0x13380c[_0x6efa('0x43')];if(!_0x2f9197[_0x6efa('0x40')]['hasOwnProperty']('nolimit')){_0x44bb07[_0x6efa('0x2f')]=qs[_0x6efa('0x2f')](_0x2f9197[_0x6efa('0x40')][_0x6efa('0x2f')]);_0x44bb07[_0x6efa('0x2d')]=qs['offset'](_0x2f9197[_0x6efa('0x40')]['offset']);}_0x44bb07[_0x6efa('0x47')]=qs['sort'](_0x2f9197[_0x6efa('0x40')]['sort']);_0x44bb07[_0x6efa('0x48')]=qs['filters'](_[_0x6efa('0x49')](_0x2f9197[_0x6efa('0x40')],_0x13380c[_0x6efa('0x41')]),_0x3576d7);if(_0x2f9197[_0x6efa('0x40')]['filter']){_0x44bb07[_0x6efa('0x48')]=_[_0x6efa('0x4a')](_0x44bb07[_0x6efa('0x48')],{'$or':_['map'](_0x3576d7,function(_0x210fa5){if(_0x210fa5[_0x6efa('0x4b')]!=='VIRTUAL'){var _0x16a9d2={};_0x16a9d2[_0x210fa5[_0x6efa('0x38')]]={'$like':'%'+_0x2f9197[_0x6efa('0x40')]['filter']+'%'};return _0x16a9d2;}})});}_0x44bb07=_[_0x6efa('0x4a')]({},_0x44bb07,_0x2f9197[_0x6efa('0x4c')]);var _0x5d0316={'where':_0x44bb07[_0x6efa('0x48')]};return db[_0x6efa('0x3c')][_0x6efa('0x30')](_0x5d0316)[_0x6efa('0x1f')](function(_0x43779a){_0x4e06c6[_0x6efa('0x30')]=_0x43779a;if(_0x2f9197[_0x6efa('0x40')][_0x6efa('0x4d')]){_0x44bb07[_0x6efa('0x4e')]=[{'all':!![]}];}return db[_0x6efa('0x3c')][_0x6efa('0x4f')](_0x44bb07);})[_0x6efa('0x1f')](function(_0x568a9f){_0x4e06c6[_0x6efa('0x50')]=_0x568a9f;return _0x4e06c6;})[_0x6efa('0x1f')](respondWithFilteredResult(_0x51cc49,_0x44bb07))[_0x6efa('0x28')](handleError(_0x51cc49,null));};exports['show']=function(_0x1ca379,_0x3c3e7b){var _0x283efd={'raw':!![],'where':{'id':_0x1ca379[_0x6efa('0x51')]['id']}},_0x33a773={};_0x33a773[_0x6efa('0x43')]=_[_0x6efa('0x3f')](db[_0x6efa('0x3c')]['rawAttributes']);_0x33a773[_0x6efa('0x40')]=_['keys'](_0x1ca379[_0x6efa('0x40')]);_0x33a773[_0x6efa('0x41')]=_[_0x6efa('0x42')](_0x33a773[_0x6efa('0x43')],_0x33a773[_0x6efa('0x40')]);_0x283efd[_0x6efa('0x45')]=_['intersection'](_0x33a773[_0x6efa('0x43')],qs[_0x6efa('0x44')](_0x1ca379[_0x6efa('0x40')][_0x6efa('0x44')]));_0x283efd[_0x6efa('0x45')]=_0x283efd[_0x6efa('0x45')][_0x6efa('0x46')]?_0x283efd[_0x6efa('0x45')]:_0x33a773[_0x6efa('0x43')];if(_0x1ca379[_0x6efa('0x40')][_0x6efa('0x4d')]){_0x283efd[_0x6efa('0x4e')]=[{'all':!![]}];}_0x283efd=_[_0x6efa('0x4a')]({},_0x283efd,_0x1ca379['options']);return db[_0x6efa('0x3c')][_0x6efa('0x52')](_0x283efd)['then'](handleEntityNotFound(_0x3c3e7b,null))['then'](respondWithResult(_0x3c3e7b,null))[_0x6efa('0x28')](handleError(_0x3c3e7b,null));};exports[_0x6efa('0x53')]=function(_0x1d3557,_0x101609){return db['ChatMessage'][_0x6efa('0x53')](_0x1d3557[_0x6efa('0x54')],{})[_0x6efa('0x1f')](respondWithResult(_0x101609,0xc9))[_0x6efa('0x28')](handleError(_0x101609,null));};exports[_0x6efa('0x35')]=function(_0x4eb90a,_0x3b3f28){if(_0x4eb90a[_0x6efa('0x54')]['id']){delete _0x4eb90a[_0x6efa('0x54')]['id'];}return db['ChatMessage'][_0x6efa('0x52')]({'where':{'id':_0x4eb90a[_0x6efa('0x51')]['id']}})['then'](handleEntityNotFound(_0x3b3f28,null))[_0x6efa('0x1f')](saveUpdates(_0x4eb90a[_0x6efa('0x54')],null))['then'](respondWithResult(_0x3b3f28,null))['catch'](handleError(_0x3b3f28,null));};exports['destroy']=function(_0x3d8cac,_0x4df0d4){return db[_0x6efa('0x3c')][_0x6efa('0x52')]({'where':{'id':_0x3d8cac[_0x6efa('0x51')]['id']}})[_0x6efa('0x1f')](handleEntityNotFound(_0x4df0d4,null))[_0x6efa('0x1f')](removeEntity(_0x4df0d4,null))[_0x6efa('0x28')](handleError(_0x4df0d4,null));};exports[_0x6efa('0x55')]=function(_0x31789c,_0x3b2434){return db[_0x6efa('0x3c')][_0x6efa('0x55')]()[_0x6efa('0x1f')](respondWithResult(_0x3b2434,null))[_0x6efa('0x28')](handleError(_0x3b2434,null));};var interaction_log=require(_0x6efa('0x56'))(_0x6efa('0x57'));exports[_0x6efa('0x58')]=function(_0x28e87b,_0x227c19,_0x193d8d){var _0x3dd2b0={'agent':{},'channel':_0x6efa('0x59')};if(_0x28e87b[_0x6efa('0x54')]['id']){delete _0x28e87b[_0x6efa('0x54')]['id'];}_0x28e87b[_0x6efa('0x54')]['read']=!![];_0x28e87b[_0x6efa('0x54')][_0x6efa('0x5a')]=moment()[_0x6efa('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x28e87b['body'][_0x6efa('0x5c')]=_0x28e87b['body'][_0x6efa('0x5c')]||_0x28e87b[_0x6efa('0x5d')]['id'];_0x3dd2b0[_0x6efa('0x5e')]['id']=_0x28e87b[_0x6efa('0x54')][_0x6efa('0x5c')];return db['ChatMessage']['find']({'where':{'id':_0x28e87b[_0x6efa('0x51')]['id'],'UserId':null}})[_0x6efa('0x1f')](handleEntityNotFound(_0x227c19,null))['then'](saveUpdates(_0x28e87b[_0x6efa('0x54')],null))['then'](function(_0x15ca4c){if(_0x15ca4c){_0x3dd2b0['message']=_0x15ca4c['get']({'plain':!![]});return db['ChatInteraction'][_0x6efa('0x52')]({'where':{'id':_0x15ca4c['ChatInteractionId']}});}return null;})[_0x6efa('0x1f')](handleEntityNotFound(_0x227c19,null))[_0x6efa('0x1f')](function(_0x591638){if(_0x591638){return _0x591638[_0x6efa('0x35')]({'UserId':_0x28e87b['body'][_0x6efa('0x5c')],'read1stAt':_[_0x6efa('0x5f')](_0x591638[_0x6efa('0x60')])?moment()[_0x6efa('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6efa('0x1f')](function(_0x4567da){if(_0x4567da){_0x3dd2b0[_0x6efa('0x61')]=_0x4567da[_0x6efa('0x62')]({'plain':!![]});interaction_log['info'](_0x6efa('0x63'),_0x28e87b[_0x6efa('0x5d')]['id'],_0x28e87b['user'][_0x6efa('0x38')],_0x28e87b[_0x6efa('0x5d')][_0x6efa('0x64')],_0x3dd2b0[_0x6efa('0x61')]['id'],_0x28e87b[_0x6efa('0x54')]?JSON[_0x6efa('0x65')](_0x28e87b['body']):_0x6efa('0x66'));return respondWithRpcPromise(_0x6efa('0x67'),_0x6efa('0x68'),_0x3dd2b0);}return null;})[_0x6efa('0x1f')](function(_0x38482c){var _0x492fc2=_0x6efa('0x69')+_0x38482c[_0x6efa('0x26')][_0x6efa('0x6a')];return db[_0x6efa('0x6b')][_0x6efa('0x40')](_0x492fc2,{'type':db[_0x6efa('0x6c')]['QueryTypes'][_0x6efa('0x6d')],'raw':!![]})['then'](function(_0x27e583){return _0x27e583;});})[_0x6efa('0x1f')](function(_0x83e988){if(_0x83e988){_0x3dd2b0['message'][_0x6efa('0x6e')]=_0x83e988[0x0];if(!_0x28e87b[_0x6efa('0x54')][_0x6efa('0x5c')])return;return db['User']['find']({'where':{'id':_0x28e87b[_0x6efa('0x54')][_0x6efa('0x5c')],'role':_0x6efa('0x5e')},'attributes':['id',_0x6efa('0x38'),_0x6efa('0x6f'),_0x6efa('0x70'),_0x6efa('0x71')],'raw':!![]});}return null;})['then'](function(_0x5c0068){if(!_0x5c0068)return null;_0x3dd2b0[_0x6efa('0x26')][_0x6efa('0x5e')]=_0x5c0068;return _0x3dd2b0;})[_0x6efa('0x1f')](function(_0x29f6b5){if(_0x29f6b5){if(_0x28e87b['body'][_0x6efa('0x72')]){_0x3dd2b0[_0x6efa('0x26')][_0x6efa('0x73')]=util['format']('SIP/%s',_0x28e87b[_0x6efa('0x5d')]['name']);_0x3dd2b0[_0x6efa('0x26')][_0x6efa('0x74')]=_0x3dd2b0[_0x6efa('0x74')];_0x3dd2b0['message']['motionChannel']=_0x3dd2b0[_0x6efa('0x74')];_0x3dd2b0[_0x6efa('0x26')][_0x6efa('0x75')]='accept';return respondWithRpcPromise(_0x6efa('0x76'),'EventManager',{'event':_0x6efa('0x77'),'message':_[_0x6efa('0x4a')](_0x3dd2b0['message'],JSON[_0x6efa('0x78')](_0x3dd2b0[_0x6efa('0x61')][_0x6efa('0x79')]))},client9002)['then'](function(){return _0x3dd2b0;});}return _0x3dd2b0;}return null;})['then'](respondWithResult(_0x227c19,null))[_0x6efa('0x28')](handleError(_0x227c19,null));};var interaction_log=require(_0x6efa('0x56'))(_0x6efa('0x57'));exports[_0x6efa('0x33')]=function(_0x5450ab,_0x3569eb,_0x5af2e3){var _0x22726f={'agent':{},'channel':_0x6efa('0x59')};if(_0x5450ab[_0x6efa('0x54')]['id']){delete _0x5450ab[_0x6efa('0x54')]['id'];}_0x5450ab[_0x6efa('0x54')]['UserId']=_0x5450ab['body']['UserId']||_0x5450ab['user']['id'];_0x22726f[_0x6efa('0x5e')]['id']=_0x5450ab['body'][_0x6efa('0x5c')];return db[_0x6efa('0x3c')][_0x6efa('0x52')]({'where':{'id':_0x5450ab['params']['id'],'UserId':null}})[_0x6efa('0x1f')](handleEntityNotFound(_0x3569eb,null))[_0x6efa('0x1f')](function(_0x200b9d){if(_0x200b9d){_0x22726f[_0x6efa('0x26')]=_0x200b9d['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x200b9d[_0x6efa('0x7a')]}});}return null;})[_0x6efa('0x1f')](handleEntityNotFound(_0x3569eb,null))[_0x6efa('0x1f')](function(_0x22c976){if(_0x22c976){_0x22726f[_0x6efa('0x61')]=_0x22c976['get']({'plain':!![]});interaction_log['info'](_0x6efa('0x7b'),_0x5450ab[_0x6efa('0x5d')]['id'],_0x5450ab[_0x6efa('0x5d')][_0x6efa('0x38')],_0x5450ab['user'][_0x6efa('0x64')],_0x22726f['interaction']['id'],_0x5450ab[_0x6efa('0x54')]?JSON[_0x6efa('0x65')](_0x5450ab[_0x6efa('0x54')]):_0x6efa('0x66'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x22726f);}return null;})['then'](function(_0x3eb095){var _0x2c0c51='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3eb095['message'][_0x6efa('0x6a')];return db[_0x6efa('0x6b')][_0x6efa('0x40')](_0x2c0c51,{'type':db[_0x6efa('0x6c')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6efa('0x1f')](function(_0x506d67){return _0x506d67;});})[_0x6efa('0x1f')](function(_0x3ad49d){if(_0x3ad49d){_0x22726f[_0x6efa('0x26')][_0x6efa('0x6e')]=_0x3ad49d[0x0];if(!_0x5450ab[_0x6efa('0x54')][_0x6efa('0x5c')])return;return db[_0x6efa('0x7c')][_0x6efa('0x52')]({'where':{'id':_0x5450ab[_0x6efa('0x54')][_0x6efa('0x5c')],'role':'agent'},'attributes':['id',_0x6efa('0x38'),_0x6efa('0x6f'),_0x6efa('0x70'),_0x6efa('0x71')],'raw':!![]});}return null;})[_0x6efa('0x1f')](function(_0x4d1541){if(!_0x4d1541)return null;_0x22726f[_0x6efa('0x26')][_0x6efa('0x5e')]=_0x4d1541;return _0x22726f;})['then'](function(_0x3fb84f){if(_0x3fb84f){_0x3fb84f[_0x6efa('0x26')][_0x6efa('0x73')]=util['format'](_0x6efa('0x7d'),_0x5450ab[_0x6efa('0x5d')][_0x6efa('0x38')]);_0x3fb84f['message'][_0x6efa('0x74')]=_0x22726f['channel'];_0x3fb84f[_0x6efa('0x26')][_0x6efa('0x7e')]=_0x22726f['channel'];_0x3fb84f['message'][_0x6efa('0x75')]='reject';respondWithRpcPromise(_0x6efa('0x76'),_0x6efa('0x76'),{'event':'rejectmessage','message':_[_0x6efa('0x4a')](_0x22726f[_0x6efa('0x26')],JSON[_0x6efa('0x78')](_0x22726f[_0x6efa('0x61')][_0x6efa('0x79')]))},client9002);return _0x22726f;}return null;})[_0x6efa('0x1f')](respondWithResult(_0x3569eb,null))[_0x6efa('0x28')](handleError(_0x3569eb,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a7130f4..74fdb74 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 _0x7077=['ChatMessage','setMaxListeners','save','update','emit','exports','events'];(function(_0x4194e6,_0x5a7a50){var _0x2ac7dc=function(_0x5d905e){while(--_0x5d905e){_0x4194e6['push'](_0x4194e6['shift']());}};_0x2ac7dc(++_0x5a7a50);}(_0x7077,0xdf));var _0x7707=function(_0x188b20,_0x245fd8){_0x188b20=_0x188b20-0x0;var _0x5b3974=_0x7077[_0x188b20];return _0x5b3974;};'use strict';var EventEmitter=require(_0x7707('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x7707('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7707('0x2')](0x0);var events={'afterCreate':_0x7707('0x3'),'afterUpdate':_0x7707('0x4'),'afterDestroy':'remove'};function emitEvent(_0x157046){return function(_0x3a827c,_0x3138a6,_0x46b97a){ChatMessageEvents['emit'](_0x157046+':'+_0x3a827c['id'],_0x3a827c);ChatMessageEvents[_0x7707('0x5')](_0x157046,_0x3a827c);_0x46b97a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x7707('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x41b9=['hook','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x41b9,0x159));var _0x941b=function(_0x119f51,_0x4e3d7d){_0x119f51=_0x119f51-0x0;var _0x556951=_0x41b9[_0x119f51];return _0x556951;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x941b('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x941b('0x1')](0x0);var events={'afterCreate':_0x941b('0x2'),'afterUpdate':_0x941b('0x3'),'afterDestroy':_0x941b('0x4')};function emitEvent(_0x521d93){return function(_0x7f225f,_0x4e2e99,_0xc0177d){ChatMessageEvents['emit'](_0x521d93+':'+_0x7f225f['id'],_0x7f225f);ChatMessageEvents[_0x941b('0x5')](_0x521d93,_0x7f225f);_0xc0177d(null);};}for(var e in events){if(events[_0x941b('0x6')](e)){var event=events[e];ChatMessage[_0x941b('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 83556d4..a8a7464 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 _0xa2ad=['ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xa2ad,0xa3));var _0xda2a=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0xa2ad[_0x5a7e78];return _0xa8d4a1;};'use strict';var _=require(_0xda2a('0x0'));var util=require(_0xda2a('0x1'));var logger=require(_0xda2a('0x2'))(_0xda2a('0x3'));var moment=require(_0xda2a('0x4'));var BPromise=require(_0xda2a('0x5'));var rp=require(_0xda2a('0x6'));var fs=require('fs');var path=require(_0xda2a('0x7'));var rimraf=require(_0xda2a('0x8'));var config=require(_0xda2a('0x9'));var attributes=require(_0xda2a('0xa'));module[_0xda2a('0xb')]=function(_0x23c0cd,_0x6ccbde){return _0x23c0cd[_0xda2a('0xc')]('ChatMessage',attributes,{'tableName':_0xda2a('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xda2a('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcf07a6,_0x45419a,_0x560346){var _0x97de42=_0x23c0cd[_0xda2a('0xf')];var _0x38afdc=_0xcf07a6[_0xda2a('0x10')]({'plain':!![]});if(_0x38afdc[_0xda2a('0x11')]['toLowerCase']()==='in'||_0x38afdc[_0xda2a('0x11')][_0xda2a('0x12')]()===_0xda2a('0x13')&&!_0x38afdc[_0xda2a('0x14')]&&!_[_0xda2a('0x15')](_0x38afdc[_0xda2a('0x16')])){_0x97de42[_0xda2a('0x17')][_0xda2a('0x18')]({'where':{'id':_0x38afdc[_0xda2a('0x19')]}})[_0xda2a('0x1a')](function(_0x40ca2e){if(_0x40ca2e){_0x40ca2e[_0xda2a('0x1b')]({'lastMsgAt':_0x38afdc[_0xda2a('0x1c')],'lastMsgDirection':_0x38afdc['direction']['toLowerCase']()});}})['catch'](function(_0x2c8f25){console[_0xda2a('0x1d')](_0x2c8f25);});}_0x560346();}},'charset':_0xda2a('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf05b=['fti_chat_messages','FULLTEXT','models','direction','toLowerCase','out','secret','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','chat_messages'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf05b,0xbd));var _0xbf05=function(_0x1f404a,_0xef86a5){_0x1f404a=_0x1f404a-0x0;var _0x550cc0=_0xf05b[_0x1f404a];return _0x550cc0;};'use strict';var _=require(_0xbf05('0x0'));var util=require(_0xbf05('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbf05('0x2'));var BPromise=require(_0xbf05('0x3'));var rp=require(_0xbf05('0x4'));var fs=require('fs');var path=require(_0xbf05('0x5'));var rimraf=require(_0xbf05('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf05('0x7'));module[_0xbf05('0x8')]=function(_0x3f9c35,_0x3a6f09){return _0x3f9c35[_0xbf05('0x9')]('ChatMessage',attributes,{'tableName':_0xbf05('0xa'),'paranoid':![],'indexes':[{'name':_0xbf05('0xb'),'fields':['body'],'type':_0xbf05('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x403655,_0x3da244,_0x5b143c){var _0x1b108c=_0x3f9c35[_0xbf05('0xd')];var _0x381f8c=_0x403655['get']({'plain':!![]});if(_0x381f8c[_0xbf05('0xe')][_0xbf05('0xf')]()==='in'||_0x381f8c[_0xbf05('0xe')][_0xbf05('0xf')]()===_0xbf05('0x10')&&!_0x381f8c[_0xbf05('0x11')]&&!_['isNil'](_0x381f8c['UserId'])){_0x1b108c['ChatInteraction']['findOne']({'where':{'id':_0x381f8c[_0xbf05('0x12')]}})[_0xbf05('0x13')](function(_0x194a9c){if(_0x194a9c){_0x194a9c[_0xbf05('0x14')]({'lastMsgAt':_0x381f8c[_0xbf05('0x15')],'lastMsgDirection':_0x381f8c[_0xbf05('0xe')][_0xbf05('0xf')]()});}})[_0xbf05('0x16')](function(_0x15ed51){console['error'](_0x15ed51);});}_0x5b143c();}},'charset':_0xbf05('0x17'),'collate':_0xbf05('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5b61ff1..ffbeee6 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 _0xc824=['client','http','defaults','redis','localhost','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xc824,0x1b0));var _0x4c82=function(_0x170078,_0x1e295c){_0x170078=_0x170078-0x0;var _0x5365c9=_0xc824[_0x170078];return _0x5365c9;};'use strict';var _=require(_0x4c82('0x0'));var util=require(_0x4c82('0x1'));var moment=require(_0x4c82('0x2'));var BPromise=require(_0x4c82('0x3'));var rs=require(_0x4c82('0x4'));var fs=require('fs');var Redis=require(_0x4c82('0x5'));var db=require(_0x4c82('0x6'))['db'];var utils=require(_0x4c82('0x7'));var logger=require('../../config/logger')(_0x4c82('0x8'));var config=require(_0x4c82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4c82('0xa')][_0x4c82('0xb')]({'port':0x232a});config['redis']=_[_0x4c82('0xc')](config[_0x4c82('0xd')],{'host':_0x4c82('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c82('0xd')]));require('./chatMessage.socket')[_0x4c82('0xf')](socket);function respondWithRpcPromise(_0x57c99c,_0x21d56e,_0x5ac194){return new BPromise(function(_0x26c7c5,_0x2113ce){return client[_0x4c82('0x10')](_0x57c99c,_0x5ac194)[_0x4c82('0x11')](function(_0x44ffa9){logger[_0x4c82('0x12')](_0x4c82('0x13'),_0x21d56e,_0x4c82('0x14'));logger[_0x4c82('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x21d56e,_0x4c82('0x14'),JSON['stringify'](_0x44ffa9));if(_0x44ffa9[_0x4c82('0x16')]){if(_0x44ffa9[_0x4c82('0x16')][_0x4c82('0x17')]===0x1f4){logger[_0x4c82('0x16')]('ChatMessage,\x20%s,\x20%s',_0x21d56e,_0x44ffa9['error'][_0x4c82('0x18')]);return _0x2113ce(_0x44ffa9[_0x4c82('0x16')][_0x4c82('0x18')]);}logger['error'](_0x4c82('0x13'),_0x21d56e,_0x44ffa9['error']['message']);return _0x26c7c5(_0x44ffa9[_0x4c82('0x16')][_0x4c82('0x18')]);}else{logger['info'](_0x4c82('0x13'),_0x21d56e,_0x4c82('0x14'));_0x26c7c5(_0x44ffa9[_0x4c82('0x19')][_0x4c82('0x18')]);}})[_0x4c82('0x1a')](function(_0xa15486){logger[_0x4c82('0x16')](_0x4c82('0x13'),_0x21d56e,_0xa15486);_0x2113ce(_0xa15486);});});}exports[_0x4c82('0x1b')]=function(_0x2e29e5){var _0x4c7900=this;return new Promise(function(_0x45a3ae,_0x585f8a){return db[_0x4c82('0x1c')][_0x4c82('0x1d')](_0x2e29e5[_0x4c82('0x1e')],{'raw':_0x2e29e5[_0x4c82('0x1f')]?_0x2e29e5[_0x4c82('0x1f')][_0x4c82('0x20')]===undefined?!![]:![]:!![]})[_0x4c82('0x11')](function(_0x5bc953){logger[_0x4c82('0x12')](_0x4c82('0x1b'),_0x2e29e5);logger['debug']('CreateChatMessage',_0x2e29e5,JSON[_0x4c82('0x21')](_0x5bc953));_0x45a3ae(_0x5bc953);})[_0x4c82('0x1a')](function(_0xb689c3){logger[_0x4c82('0x16')](_0x4c82('0x1b'),_0xb689c3[_0x4c82('0x18')],_0x2e29e5);_0x585f8a(_0x4c7900['error'](0x1f4,_0xb689c3[_0x4c82('0x18')]));});});}; \ No newline at end of file +var _0xb5ba=['jayson/promise','http','redis','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x34f974,_0x19260a){var _0xd90b31=function(_0x57ee2e){while(--_0x57ee2e){_0x34f974['push'](_0x34f974['shift']());}};_0xd90b31(++_0x19260a);}(_0xb5ba,0xe9));var _0xab5b=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0xb5ba[_0x2daef6];return _0x62d030;};'use strict';var _=require(_0xab5b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab5b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab5b('0x2'));var db=require(_0xab5b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab5b('0x4'))(_0xab5b('0x5'));var config=require(_0xab5b('0x6'));var jayson=require(_0xab5b('0x7'));var client=jayson['client'][_0xab5b('0x8')]({'port':0x232a});config[_0xab5b('0x9')]=_['defaults'](config[_0xab5b('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab5b('0x9')]));require(_0xab5b('0xa'))[_0xab5b('0xb')](socket);function respondWithRpcPromise(_0x2f096e,_0x19ae9b,_0x4f75eb){return new BPromise(function(_0x44c76c,_0x54fbf8){return client[_0xab5b('0xc')](_0x2f096e,_0x4f75eb)[_0xab5b('0xd')](function(_0x217095){logger[_0xab5b('0xe')](_0xab5b('0xf'),_0x19ae9b,_0xab5b('0x10'));logger['debug'](_0xab5b('0x11'),_0x19ae9b,_0xab5b('0x10'),JSON[_0xab5b('0x12')](_0x217095));if(_0x217095[_0xab5b('0x13')]){if(_0x217095[_0xab5b('0x13')][_0xab5b('0x14')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x19ae9b,_0x217095['error'][_0xab5b('0x15')]);return _0x54fbf8(_0x217095['error'][_0xab5b('0x15')]);}logger[_0xab5b('0x13')](_0xab5b('0xf'),_0x19ae9b,_0x217095[_0xab5b('0x13')]['message']);return _0x44c76c(_0x217095['error']['message']);}else{logger[_0xab5b('0xe')](_0xab5b('0xf'),_0x19ae9b,'request\x20sent');_0x44c76c(_0x217095['result'][_0xab5b('0x15')]);}})[_0xab5b('0x16')](function(_0x3192c9){logger[_0xab5b('0x13')](_0xab5b('0xf'),_0x19ae9b,_0x3192c9);_0x54fbf8(_0x3192c9);});});}exports[_0xab5b('0x17')]=function(_0x5d4eaa){var _0x598751=this;return new Promise(function(_0x4851b5,_0x322681){return db[_0xab5b('0x18')][_0xab5b('0x19')](_0x5d4eaa[_0xab5b('0x1a')],{'raw':_0x5d4eaa[_0xab5b('0x1b')]?_0x5d4eaa[_0xab5b('0x1b')][_0xab5b('0x1c')]===undefined?!![]:![]:!![]})[_0xab5b('0xd')](function(_0x256369){logger['info'](_0xab5b('0x17'),_0x5d4eaa);logger[_0xab5b('0x1d')](_0xab5b('0x17'),_0x5d4eaa,JSON[_0xab5b('0x12')](_0x256369));_0x4851b5(_0x256369);})[_0xab5b('0x16')](function(_0x1fbdf2){logger[_0xab5b('0x13')](_0xab5b('0x17'),_0x1fbdf2[_0xab5b('0x15')],_0x5d4eaa);_0x322681(_0x598751[_0xab5b('0x13')](0x1f4,_0x1fbdf2['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 3be7079..33bdc92 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 _0x86f4=['length','chatMessage:','./chatMessage.events','save','remove','update','register'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x86f4,0x18a));var _0x486f=function(_0x160cc2,_0x20b3cd){_0x160cc2=_0x160cc2-0x0;var _0x244a11=_0x86f4[_0x160cc2];return _0x244a11;};'use strict';var ChatMessageEvents=require(_0x486f('0x0'));var events=[_0x486f('0x1'),_0x486f('0x2'),_0x486f('0x3')];function createListener(_0x3e0b4f,_0x10339c){return function(_0x45067a){_0x10339c['emit'](_0x3e0b4f,_0x45067a);};}function removeListener(_0xf8d50f,_0x1539b1){return function(){ChatMessageEvents['removeListener'](_0xf8d50f,_0x1539b1);};}exports[_0x486f('0x4')]=function(_0x1adb27){for(var _0x39f767=0x0,_0x207201=events[_0x486f('0x5')];_0x39f767<_0x207201;_0x39f767++){var _0x3a0791=events[_0x39f767];var _0x5bfabc=createListener(_0x486f('0x6')+_0x3a0791,_0x1adb27);ChatMessageEvents['on'](_0x3a0791,_0x5bfabc);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./chatMessage.events','remove'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x1cb9,0x14e));var _0x91cb=function(_0x354d4b,_0x6a959f){_0x354d4b=_0x354d4b-0x0;var _0x4fec42=_0x1cb9[_0x354d4b];return _0x4fec42;};'use strict';var ChatMessageEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){ChatMessageEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('chatMessage:'+_0x4c1f56,_0x186dc3);ChatMessageEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b7b9c5d..6e517e6 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 _0x78e2=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','/:id/accept','accept','reject','delete'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x78e2,0x146));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x278e('0x0'));var util=require('util');var path=require(_0x278e('0x1'));var timeout=require(_0x278e('0x2'));var express=require(_0x278e('0x3'));var router=express[_0x278e('0x4')]();var fs_extra=require(_0x278e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x278e('0x6'));var config=require(_0x278e('0x7'));var controller=require(_0x278e('0x8'));router[_0x278e('0x9')]('/',auth[_0x278e('0xa')](),controller['index']);router[_0x278e('0x9')](_0x278e('0xb'),auth[_0x278e('0xa')](),controller['describe']);router[_0x278e('0x9')](_0x278e('0xc'),auth[_0x278e('0xa')](),controller[_0x278e('0xd')]);router[_0x278e('0xe')]('/',auth[_0x278e('0xa')](),interaction[_0x278e('0xf')](_0x278e('0x10'),_0x278e('0x11')),controller[_0x278e('0x12')]);router['put'](_0x278e('0xc'),controller[_0x278e('0x13')]);router['put'](_0x278e('0x14'),auth[_0x278e('0xa')](),controller[_0x278e('0x15')]);router['put']('/:id/reject',auth[_0x278e('0xa')](),controller[_0x278e('0x16')]);router[_0x278e('0x17')](_0x278e('0xc'),auth[_0x278e('0xa')](),controller['destroy']);module[_0x278e('0x18')]=router; \ No newline at end of file +var _0x34b5=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x3f993e,_0x2d5757){var _0x39c135=function(_0x39e00b){while(--_0x39e00b){_0x3f993e['push'](_0x3f993e['shift']());}};_0x39c135(++_0x2d5757);}(_0x34b5,0x166));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x534b('0x0'));var util=require(_0x534b('0x1'));var path=require(_0x534b('0x2'));var timeout=require(_0x534b('0x3'));var express=require(_0x534b('0x4'));var router=express[_0x534b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x534b('0x6'));var interaction=require(_0x534b('0x7'));var config=require(_0x534b('0x8'));var controller=require(_0x534b('0x9'));router[_0x534b('0xa')]('/',auth['isAuthenticated'](),controller[_0x534b('0xb')]);router[_0x534b('0xa')](_0x534b('0xc'),auth[_0x534b('0xd')](),controller[_0x534b('0xe')]);router['get'](_0x534b('0xf'),auth[_0x534b('0xd')](),controller[_0x534b('0x10')]);router[_0x534b('0x11')]('/',auth['isAuthenticated'](),interaction[_0x534b('0x12')](_0x534b('0x13'),_0x534b('0x14')),controller[_0x534b('0x15')]);router[_0x534b('0x16')](_0x534b('0xf'),controller[_0x534b('0x17')]);router['put']('/:id/accept',auth[_0x534b('0xd')](),controller[_0x534b('0x18')]);router[_0x534b('0x16')](_0x534b('0x19'),auth[_0x534b('0xd')](),controller[_0x534b('0x1a')]);router[_0x534b('0x1b')](_0x534b('0xf'),auth[_0x534b('0xd')](),controller[_0x534b('0x1c')]);module[_0x534b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b1fa7b6..a8de5b9 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 _0xadb5=['medium','TEXT','exports'];(function(_0x4686cc,_0x472000){var _0x285b28=function(_0x3dbe23){while(--_0x3dbe23){_0x4686cc['push'](_0x4686cc['shift']());}};_0x285b28(++_0x472000);}(_0xadb5,0xad));var _0x5adb=function(_0x28a499,_0x15d4a2){_0x28a499=_0x28a499-0x0;var _0x496c0a=_0xadb5[_0x28a499];return _0x496c0a;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x757a,0xde));var _0xa757=function(_0x23f19d,_0x11d528){_0x23f19d=_0x23f19d-0x0;var _0x2884fc=_0x757a[_0x23f19d];return _0x2884fc;};'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 cd34f86..c4ad7ba 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x7a54,0x106));var _0x47a5=function(_0x5e1475,_0x2cc517){_0x5e1475=_0x5e1475-0x0;var _0x837ff4=_0x7a54[_0x5e1475];return _0x837ff4;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x7a54,0x106));var _0x47a5=function(_0x11692a,_0x502b04){_0x11692a=_0x11692a-0x0;var _0xfa288e=_0x7a54[_0x11692a];return _0xfa288e;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 374a0da..5be84d6 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 _0x325f=['hasOwnProperty','hook','exports','events','ChatOfflineMessage','setMaxListeners','update','remove','emit'];(function(_0x35fe4e,_0xd77d10){var _0x2a3972=function(_0x5f3efd){while(--_0x5f3efd){_0x35fe4e['push'](_0x35fe4e['shift']());}};_0x2a3972(++_0xd77d10);}(_0x325f,0x174));var _0xf325=function(_0x738b87,_0x1e55d8){_0x738b87=_0x738b87-0x0;var _0x323848=_0x325f[_0x738b87];return _0x323848;};'use strict';var EventEmitter=require(_0xf325('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xf325('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xf325('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf325('0x3'),'afterDestroy':_0xf325('0x4')};function emitEvent(_0x3bc806){return function(_0x2d1193,_0x96ef39,_0x2b33bb){ChatOfflineMessageEvents[_0xf325('0x5')](_0x3bc806+':'+_0x2d1193['id'],_0x2d1193);ChatOfflineMessageEvents[_0xf325('0x5')](_0x3bc806,_0x2d1193);_0x2b33bb(null);};}for(var e in events){if(events[_0xf325('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xf325('0x7')](e,emitEvent(event));}}module[_0xf325('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xb515=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb515,0x1c2));var _0x5b51=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0xb515[_0xcd5a3d];return _0xd43207;};'use strict';var EventEmitter=require(_0x5b51('0x0'));var ChatOfflineMessage=require(_0x5b51('0x1'))['db'][_0x5b51('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5b51('0x3')](0x0);var events={'afterCreate':_0x5b51('0x4'),'afterUpdate':'update','afterDestroy':_0x5b51('0x5')};function emitEvent(_0x4ac5e7){return function(_0x4c9cd0,_0x4965aa,_0x51e4be){ChatOfflineMessageEvents[_0x5b51('0x6')](_0x4ac5e7+':'+_0x4c9cd0['id'],_0x4c9cd0);ChatOfflineMessageEvents[_0x5b51('0x6')](_0x4ac5e7,_0x4c9cd0);_0x51e4be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x5b51('0x7')](e,emitEvent(event));}}module[_0x5b51('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 226ad2a..3a8c71c 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 _0x702f=['exports','define','ChatOfflineMessage','utf8mb4','./chatOfflineMessage.attributes'];(function(_0x5aed69,_0x259b5e){var _0x48b0f9=function(_0x31e169){while(--_0x31e169){_0x5aed69['push'](_0x5aed69['shift']());}};_0x48b0f9(++_0x259b5e);}(_0x702f,0xd1));var _0xf702=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x702f[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require(_0xf702('0x0'));module[_0xf702('0x1')]=function(_0x34dcbe){return _0x34dcbe[_0xf702('0x2')](_0xf702('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf702('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1a78=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x1a78,0x88));var _0x81a7=function(_0xb7c880,_0x5401d1){_0xb7c880=_0xb7c880-0x0;var _0x6a7663=_0x1a78[_0xb7c880];return _0x6a7663;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x81a7('0x0')]=function(_0x36961d){return _0x36961d[_0x81a7('0x1')](_0x81a7('0x2'),attributes,{'tableName':_0x81a7('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x81a7('0x4'),'collate':_0x81a7('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index df4d6ac..ee94161 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 _0xb2af=['request\x20sent','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0xcf1171,_0xe70ab7){var _0x4d34e9=function(_0xf1e062){while(--_0xf1e062){_0xcf1171['push'](_0xcf1171['shift']());}};_0x4d34e9(++_0xe70ab7);}(_0xb2af,0x137));var _0xfb2a=function(_0x330068,_0x26ebb8){_0x330068=_0x330068-0x0;var _0x12813f=_0xb2af[_0x330068];return _0x12813f;};'use strict';var _=require('lodash');var util=require(_0xfb2a('0x0'));var moment=require('moment');var BPromise=require(_0xfb2a('0x1'));var rs=require(_0xfb2a('0x2'));var fs=require('fs');var Redis=require(_0xfb2a('0x3'));var db=require(_0xfb2a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb2a('0x5'))(_0xfb2a('0x6'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x7'));var client=jayson['client'][_0xfb2a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39b2cb,_0x5c3cdf,_0x46fc38){return new BPromise(function(_0x3fae48,_0x42b8cb){return client[_0xfb2a('0x9')](_0x39b2cb,_0x46fc38)[_0xfb2a('0xa')](function(_0x27b300){logger[_0xfb2a('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5c3cdf,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5c3cdf,_0xfb2a('0xc'),JSON[_0xfb2a('0xd')](_0x27b300));if(_0x27b300[_0xfb2a('0xe')]){if(_0x27b300[_0xfb2a('0xe')]['code']===0x1f4){logger['error'](_0xfb2a('0xf'),_0x5c3cdf,_0x27b300[_0xfb2a('0xe')][_0xfb2a('0x10')]);return _0x42b8cb(_0x27b300[_0xfb2a('0xe')][_0xfb2a('0x10')]);}logger[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x5c3cdf,_0x27b300[_0xfb2a('0xe')][_0xfb2a('0x10')]);return _0x3fae48(_0x27b300[_0xfb2a('0xe')][_0xfb2a('0x10')]);}else{logger[_0xfb2a('0xb')](_0xfb2a('0xf'),_0x5c3cdf,_0xfb2a('0xc'));_0x3fae48(_0x27b300[_0xfb2a('0x11')][_0xfb2a('0x10')]);}})[_0xfb2a('0x12')](function(_0x145802){logger[_0xfb2a('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5c3cdf,_0x145802);_0x42b8cb(_0x145802);});});} \ No newline at end of file +var _0x8a25=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1c3b6d,_0x22d627){var _0x14f446=function(_0x21e9d6){while(--_0x21e9d6){_0x1c3b6d['push'](_0x1c3b6d['shift']());}};_0x14f446(++_0x22d627);}(_0x8a25,0x1aa));var _0x58a2=function(_0x5be376,_0x2b5390){_0x5be376=_0x5be376-0x0;var _0xd1ac92=_0x8a25[_0x5be376];return _0xd1ac92;};'use strict';var _=require(_0x58a2('0x0'));var util=require(_0x58a2('0x1'));var moment=require(_0x58a2('0x2'));var BPromise=require(_0x58a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58a2('0x4'));var db=require(_0x58a2('0x5'))['db'];var utils=require(_0x58a2('0x6'));var logger=require(_0x58a2('0x7'))(_0x58a2('0x8'));var config=require(_0x58a2('0x9'));var jayson=require(_0x58a2('0xa'));var client=jayson[_0x58a2('0xb')][_0x58a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ac0c5,_0x151bc8,_0x2d9e1a){return new BPromise(function(_0x4796b4,_0x46e81d){return client['request'](_0x1ac0c5,_0x2d9e1a)[_0x58a2('0xd')](function(_0x43b581){logger[_0x58a2('0xe')](_0x58a2('0xf'),_0x151bc8,_0x58a2('0x10'));logger['debug'](_0x58a2('0x11'),_0x151bc8,_0x58a2('0x10'),JSON[_0x58a2('0x12')](_0x43b581));if(_0x43b581[_0x58a2('0x13')]){if(_0x43b581[_0x58a2('0x13')][_0x58a2('0x14')]===0x1f4){logger[_0x58a2('0x13')](_0x58a2('0xf'),_0x151bc8,_0x43b581[_0x58a2('0x13')][_0x58a2('0x15')]);return _0x46e81d(_0x43b581[_0x58a2('0x13')][_0x58a2('0x15')]);}logger[_0x58a2('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x151bc8,_0x43b581['error'][_0x58a2('0x15')]);return _0x4796b4(_0x43b581[_0x58a2('0x13')][_0x58a2('0x15')]);}else{logger[_0x58a2('0xe')](_0x58a2('0xf'),_0x151bc8,_0x58a2('0x10'));_0x4796b4(_0x43b581[_0x58a2('0x16')][_0x58a2('0x15')]);}})[_0x58a2('0x17')](function(_0x1f915e){logger['error'](_0x58a2('0xf'),_0x151bc8,_0x1f915e);_0x46e81d(_0x1f915e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 47eaf59..5000289 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 _0x4df8=['../../config/environment','index','isAuthenticated','describe','/:id','show','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x265f20,_0x49e16b){var _0x59d620=function(_0x12fa8f){while(--_0x12fa8f){_0x265f20['push'](_0x265f20['shift']());}};_0x59d620(++_0x49e16b);}(_0x4df8,0x106));var _0x84df=function(_0x1115af,_0x1a27c6){_0x1115af=_0x1115af-0x0;var _0x113b5a=_0x4df8[_0x1115af];return _0x113b5a;};'use strict';var multer=require(_0x84df('0x0'));var util=require(_0x84df('0x1'));var path=require(_0x84df('0x2'));var timeout=require('connect-timeout');var express=require(_0x84df('0x3'));var router=express[_0x84df('0x4')]();var fs_extra=require(_0x84df('0x5'));var auth=require(_0x84df('0x6'));var interaction=require(_0x84df('0x7'));var config=require(_0x84df('0x8'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x84df('0x9')]);router['get']('/describe',auth[_0x84df('0xa')](),controller[_0x84df('0xb')]);router['get'](_0x84df('0xc'),auth[_0x84df('0xa')](),controller[_0x84df('0xd')]);router['post']('/',auth[_0x84df('0xa')](),controller[_0x84df('0xe')]);router['put'](_0x84df('0xc'),auth[_0x84df('0xa')](),controller[_0x84df('0xf')]);router['delete'](_0x84df('0xc'),auth['isAuthenticated'](),controller[_0x84df('0x10')]);module[_0x84df('0x11')]=router; \ No newline at end of file +var _0xb125=['get','/describe','isAuthenticated','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller'];(function(_0x19c846,_0x386c4c){var _0x4eca2e=function(_0x38dbe9){while(--_0x38dbe9){_0x19c846['push'](_0x19c846['shift']());}};_0x4eca2e(++_0x386c4c);}(_0xb125,0x15f));var _0x5b12=function(_0x5e7331,_0x5d4ae1){_0x5e7331=_0x5e7331-0x0;var _0x3bdd15=_0xb125[_0x5e7331];return _0x3bdd15;};'use strict';var multer=require(_0x5b12('0x0'));var util=require(_0x5b12('0x1'));var path=require(_0x5b12('0x2'));var timeout=require(_0x5b12('0x3'));var express=require(_0x5b12('0x4'));var router=express[_0x5b12('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b12('0x6'));var interaction=require(_0x5b12('0x7'));var config=require(_0x5b12('0x8'));var controller=require(_0x5b12('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5b12('0xa')](_0x5b12('0xb'),auth[_0x5b12('0xc')](),controller['describe']);router['get'](_0x5b12('0xd'),auth[_0x5b12('0xc')](),controller[_0x5b12('0xe')]);router[_0x5b12('0xf')]('/',auth[_0x5b12('0xc')](),controller[_0x5b12('0x10')]);router['put']('/:id',auth[_0x5b12('0xc')](),controller[_0x5b12('0x11')]);router[_0x5b12('0x12')](_0x5b12('0xd'),auth[_0x5b12('0xc')](),controller['destroy']);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 eff3125..c28a84b 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 _0x0c16=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c16,0x1a9));var _0x60c1=function(_0xd87a3e,_0x38af15){_0xd87a3e=_0xd87a3e-0x0;var _0x3ed8ff=_0x0c16[_0xd87a3e];return _0x3ed8ff;};'use strict';var Sequelize=require(_0x60c1('0x0'));module[_0x60c1('0x1')]={'name':{'type':Sequelize[_0x60c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x60c1('0x3')](_0x60c1('0x4'),_0x60c1('0x5')),'defaultValue':_0x60c1('0x4')},'selector':{'type':Sequelize[_0x60c1('0x2')]},'timeout':{'type':Sequelize[_0x60c1('0x6')]}}; \ No newline at end of file +var _0x3610=['INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0xdf5fc5,_0x37255b){var _0x52f5a5=function(_0x5e37aa){while(--_0x5e37aa){_0xdf5fc5['push'](_0xdf5fc5['shift']());}};_0x52f5a5(++_0x37255b);}(_0x3610,0x173));var _0x0361=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x3610[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x0361('0x0'));module[_0x0361('0x1')]={'name':{'type':Sequelize[_0x0361('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0361('0x3'),'timeout'),'defaultValue':_0x0361('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0361('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 0279f9d..6cec47b 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 _0x303a=['model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','params'];(function(_0x3b77a2,_0x37703b){var _0x116849=function(_0x12c7c6){while(--_0x12c7c6){_0x3b77a2['push'](_0x3b77a2['shift']());}};_0x116849(++_0x37703b);}(_0x303a,0x1a0));var _0xa303=function(_0x2d015c,_0x31bb7e){_0x2d015c=_0x2d015c-0x0;var _0x403093=_0x303a[_0x2d015c];return _0x403093;};'use strict';var emlformat=require(_0xa303('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa303('0x1'));var jsonpatch=require(_0xa303('0x2'));var rp=require(_0xa303('0x3'));var moment=require(_0xa303('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa303('0x5'));var util=require(_0xa303('0x6'));var path=require(_0xa303('0x7'));var sox=require(_0xa303('0x8'));var csv=require(_0xa303('0x9'));var ejs=require(_0xa303('0xa'));var fs=require('fs');var fs_extra=require(_0xa303('0xb'));var _=require(_0xa303('0xc'));var squel=require(_0xa303('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa303('0x9'));var querystring=require(_0xa303('0xe'));var Papa=require('papaparse');var Redis=require(_0xa303('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa303('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa303('0x11'));var logger=require(_0xa303('0x12'))(_0xa303('0x13'));var utils=require(_0xa303('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa303('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf5df1e,_0x43a054){_0x43a054=_0x43a054||0xcc;return function(_0x2ed971){if(_0x2ed971){return _0xf5df1e['sendStatus'](_0x43a054);}return _0xf5df1e[_0xa303('0x16')](_0x43a054)[_0xa303('0x17')]();};}function respondWithResult(_0x28cd7f,_0xfa522c){_0xfa522c=_0xfa522c||0xc8;return function(_0xed0420){if(_0xed0420){return _0x28cd7f[_0xa303('0x16')](_0xfa522c)[_0xa303('0x18')](_0xed0420);}};}function respondWithFilteredResult(_0x2d1110,_0x4c8bc1){return function(_0x2c2939){if(_0x2c2939){var _0xd2e8ee=typeof _0x4c8bc1[_0xa303('0x19')]===_0xa303('0x1a')&&typeof _0x4c8bc1[_0xa303('0x1b')]===_0xa303('0x1a');var _0x5ec243=_0x2c2939[_0xa303('0x1c')];var _0x54ca49=_0xd2e8ee?0x0:_0x4c8bc1[_0xa303('0x19')];var _0x4cf535=_0xd2e8ee?_0x2c2939[_0xa303('0x1c')]:_0x4c8bc1['offset']+_0x4c8bc1[_0xa303('0x1b')];var _0xe263f9;if(_0x4cf535>=_0x5ec243){_0x4cf535=_0x5ec243;_0xe263f9=0xc8;}else{_0xe263f9=0xce;}_0x2d1110[_0xa303('0x16')](_0xe263f9);return _0x2d1110['set'](_0xa303('0x1d'),_0x54ca49+'-'+_0x4cf535+'/'+_0x5ec243)[_0xa303('0x18')](_0x2c2939);}return null;};}function patchUpdates(_0x1b0566){return function(_0x59e551){try{jsonpatch[_0xa303('0x1e')](_0x59e551,_0x1b0566,!![]);}catch(_0x3bc8c3){return BPromise[_0xa303('0x1f')](_0x3bc8c3);}return _0x59e551[_0xa303('0x20')]();};}function saveUpdates(_0x54b173,_0x14f9ab){return function(_0x2a2512){if(_0x2a2512){return _0x2a2512['update'](_0x54b173)[_0xa303('0x21')](function(_0x27c1d7){return _0x27c1d7;});}return null;};}function removeEntity(_0x25db9c,_0x122d1e){return function(_0x65ab0e){if(_0x65ab0e){return _0x65ab0e[_0xa303('0x22')]()[_0xa303('0x21')](function(){_0x25db9c[_0xa303('0x16')](0xcc)[_0xa303('0x17')]();});}};}function handleEntityNotFound(_0x57d584,_0x532d4d){return function(_0x4dad5b){if(!_0x4dad5b){_0x57d584['sendStatus'](0x194);}return _0x4dad5b;};}function handleError(_0x5da2d2,_0x34cd0d){_0x34cd0d=_0x34cd0d||0x1f4;return function(_0xc1fd3a){logger[_0xa303('0x23')](_0xc1fd3a[_0xa303('0x24')]);if(_0xc1fd3a[_0xa303('0x25')]){delete _0xc1fd3a['name'];}_0x5da2d2[_0xa303('0x16')](_0x34cd0d)[_0xa303('0x26')](_0xc1fd3a);};}exports['show']=function(_0x221f59,_0xef04b){var _0x355025={'raw':!![],'where':{'id':_0x221f59[_0xa303('0x27')]['id']}},_0x32dcfb={};_0x32dcfb[_0xa303('0x28')]=_[_0xa303('0x29')](db[_0xa303('0x2a')][_0xa303('0x2b')]);_0x32dcfb[_0xa303('0x2c')]=_[_0xa303('0x29')](_0x221f59[_0xa303('0x2c')]);_0x32dcfb[_0xa303('0x2d')]=_[_0xa303('0x2e')](_0x32dcfb[_0xa303('0x28')],_0x32dcfb[_0xa303('0x2c')]);_0x355025[_0xa303('0x2f')]=_['intersection'](_0x32dcfb['model'],qs[_0xa303('0x30')](_0x221f59[_0xa303('0x2c')][_0xa303('0x30')]));_0x355025[_0xa303('0x2f')]=_0x355025['attributes'][_0xa303('0x31')]?_0x355025[_0xa303('0x2f')]:_0x32dcfb[_0xa303('0x28')];if(_0x221f59[_0xa303('0x2c')]['includeAll']){_0x355025[_0xa303('0x32')]=[{'all':!![]}];}_0x355025=_[_0xa303('0x33')]({},_0x355025,_0x221f59[_0xa303('0x34')]);return db['ChatProactiveAction'][_0xa303('0x35')](_0x355025)[_0xa303('0x21')](handleEntityNotFound(_0xef04b,null))[_0xa303('0x21')](respondWithResult(_0xef04b,null))['catch'](handleError(_0xef04b,null));};exports[_0xa303('0x36')]=function(_0x190742,_0x3e432d){return db['ChatProactiveAction'][_0xa303('0x36')](_0x190742[_0xa303('0x37')],{})[_0xa303('0x21')](respondWithResult(_0x3e432d,0xc9))[_0xa303('0x38')](handleError(_0x3e432d,null));};exports['update']=function(_0x1835c2,_0x23c318){if(_0x1835c2[_0xa303('0x37')]['id']){delete _0x1835c2[_0xa303('0x37')]['id'];}return db['ChatProactiveAction'][_0xa303('0x35')]({'where':{'id':_0x1835c2[_0xa303('0x27')]['id']}})[_0xa303('0x21')](handleEntityNotFound(_0x23c318,null))[_0xa303('0x21')](saveUpdates(_0x1835c2[_0xa303('0x37')],null))['then'](respondWithResult(_0x23c318,null))['catch'](handleError(_0x23c318,null));};exports[_0xa303('0x22')]=function(_0x31c71e,_0x16a0ca){return db['ChatProactiveAction']['find']({'where':{'id':_0x31c71e[_0xa303('0x27')]['id']}})[_0xa303('0x21')](handleEntityNotFound(_0x16a0ca,null))[_0xa303('0x21')](removeEntity(_0x16a0ca,null))[_0xa303('0x38')](handleError(_0x16a0ca,null));}; \ No newline at end of file +var _0x5fd1=['show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x5fd1,0x155));var _0x15fd=function(_0x5e57a4,_0x458c5d){_0x5e57a4=_0x5e57a4-0x0;var _0x5e35fd=_0x5fd1[_0x5e57a4];return _0x5e35fd;};'use strict';var emlformat=require(_0x15fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15fd('0x1'));var jsonpatch=require(_0x15fd('0x2'));var rp=require(_0x15fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15fd('0x4'));var util=require(_0x15fd('0x5'));var path=require(_0x15fd('0x6'));var sox=require('sox');var csv=require(_0x15fd('0x7'));var ejs=require(_0x15fd('0x8'));var fs=require('fs');var fs_extra=require(_0x15fd('0x9'));var _=require(_0x15fd('0xa'));var squel=require(_0x15fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x15fd('0xc'));var deskjs=require(_0x15fd('0xd'));var toCsv=require(_0x15fd('0x7'));var querystring=require('querystring');var Papa=require(_0x15fd('0xe'));var Redis=require('ioredis');var authService=require(_0x15fd('0xf'));var qs=require(_0x15fd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15fd('0x11'));var utils=require(_0x15fd('0x12'));var config=require(_0x15fd('0x13'));var licenseUtil=require(_0x15fd('0x14'));var db=require(_0x15fd('0x15'))['db'];function respondWithStatusCode(_0x2e18ec,_0x346ab1){_0x346ab1=_0x346ab1||0xcc;return function(_0x2660db){if(_0x2660db){return _0x2e18ec[_0x15fd('0x16')](_0x346ab1);}return _0x2e18ec['status'](_0x346ab1)['end']();};}function respondWithResult(_0x5784a3,_0x3fda60){_0x3fda60=_0x3fda60||0xc8;return function(_0x135a15){if(_0x135a15){return _0x5784a3[_0x15fd('0x17')](_0x3fda60)[_0x15fd('0x18')](_0x135a15);}};}function respondWithFilteredResult(_0x44eae6,_0x2ffa03){return function(_0x2c5375){if(_0x2c5375){var _0x44a63a=typeof _0x2ffa03['offset']==='undefined'&&typeof _0x2ffa03[_0x15fd('0x19')]==='undefined';var _0x7afe9c=_0x2c5375['count'];var _0x917fe4=_0x44a63a?0x0:_0x2ffa03[_0x15fd('0x1a')];var _0x855bae=_0x44a63a?_0x2c5375['count']:_0x2ffa03[_0x15fd('0x1a')]+_0x2ffa03[_0x15fd('0x19')];var _0x8b7b9e;if(_0x855bae>=_0x7afe9c){_0x855bae=_0x7afe9c;_0x8b7b9e=0xc8;}else{_0x8b7b9e=0xce;}_0x44eae6[_0x15fd('0x17')](_0x8b7b9e);return _0x44eae6[_0x15fd('0x1b')](_0x15fd('0x1c'),_0x917fe4+'-'+_0x855bae+'/'+_0x7afe9c)[_0x15fd('0x18')](_0x2c5375);}return null;};}function patchUpdates(_0x2f46f1){return function(_0x1b8b9f){try{jsonpatch[_0x15fd('0x1d')](_0x1b8b9f,_0x2f46f1,!![]);}catch(_0x3ff307){return BPromise['reject'](_0x3ff307);}return _0x1b8b9f['save']();};}function saveUpdates(_0x293d7b,_0x36b21e){return function(_0x252a1c){if(_0x252a1c){return _0x252a1c[_0x15fd('0x1e')](_0x293d7b)[_0x15fd('0x1f')](function(_0x11496a){return _0x11496a;});}return null;};}function removeEntity(_0x2073da,_0x50d493){return function(_0x40d43){if(_0x40d43){return _0x40d43[_0x15fd('0x20')]()[_0x15fd('0x1f')](function(){_0x2073da['status'](0xcc)[_0x15fd('0x21')]();});}};}function handleEntityNotFound(_0x49062f,_0x3d1835){return function(_0x1fc24f){if(!_0x1fc24f){_0x49062f[_0x15fd('0x16')](0x194);}return _0x1fc24f;};}function handleError(_0x4c9708,_0x16b87c){_0x16b87c=_0x16b87c||0x1f4;return function(_0x1cbf2c){logger[_0x15fd('0x22')](_0x1cbf2c['stack']);if(_0x1cbf2c[_0x15fd('0x23')]){delete _0x1cbf2c['name'];}_0x4c9708[_0x15fd('0x17')](_0x16b87c)[_0x15fd('0x24')](_0x1cbf2c);};}exports[_0x15fd('0x25')]=function(_0x27d2c4,_0x233ed3){var _0x6c213b={'raw':!![],'where':{'id':_0x27d2c4[_0x15fd('0x26')]['id']}},_0x218034={};_0x218034[_0x15fd('0x27')]=_[_0x15fd('0x28')](db[_0x15fd('0x29')]['rawAttributes']);_0x218034[_0x15fd('0x2a')]=_[_0x15fd('0x28')](_0x27d2c4['query']);_0x218034[_0x15fd('0x2b')]=_[_0x15fd('0x2c')](_0x218034['model'],_0x218034[_0x15fd('0x2a')]);_0x6c213b[_0x15fd('0x2d')]=_['intersection'](_0x218034[_0x15fd('0x27')],qs[_0x15fd('0x2e')](_0x27d2c4[_0x15fd('0x2a')][_0x15fd('0x2e')]));_0x6c213b[_0x15fd('0x2d')]=_0x6c213b[_0x15fd('0x2d')]['length']?_0x6c213b[_0x15fd('0x2d')]:_0x218034[_0x15fd('0x27')];if(_0x27d2c4[_0x15fd('0x2a')][_0x15fd('0x2f')]){_0x6c213b['include']=[{'all':!![]}];}_0x6c213b=_[_0x15fd('0x30')]({},_0x6c213b,_0x27d2c4[_0x15fd('0x31')]);return db[_0x15fd('0x29')][_0x15fd('0x32')](_0x6c213b)[_0x15fd('0x1f')](handleEntityNotFound(_0x233ed3,null))[_0x15fd('0x1f')](respondWithResult(_0x233ed3,null))['catch'](handleError(_0x233ed3,null));};exports[_0x15fd('0x33')]=function(_0xaae2d0,_0x57c118){return db[_0x15fd('0x29')][_0x15fd('0x33')](_0xaae2d0[_0x15fd('0x34')],{})['then'](respondWithResult(_0x57c118,0xc9))[_0x15fd('0x35')](handleError(_0x57c118,null));};exports[_0x15fd('0x1e')]=function(_0x1732bc,_0xbe50e7){if(_0x1732bc[_0x15fd('0x34')]['id']){delete _0x1732bc[_0x15fd('0x34')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x1732bc['params']['id']}})[_0x15fd('0x1f')](handleEntityNotFound(_0xbe50e7,null))[_0x15fd('0x1f')](saveUpdates(_0x1732bc[_0x15fd('0x34')],null))['then'](respondWithResult(_0xbe50e7,null))['catch'](handleError(_0xbe50e7,null));};exports[_0x15fd('0x20')]=function(_0x5962f5,_0x4f1c84){return db['ChatProactiveAction'][_0x15fd('0x32')]({'where':{'id':_0x5962f5[_0x15fd('0x26')]['id']}})[_0x15fd('0x1f')](handleEntityNotFound(_0x4f1c84,null))['then'](removeEntity(_0x4f1c84,null))[_0x15fd('0x35')](handleError(_0x4f1c84,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index d7bb4c1..402138e 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 _0x1001=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./chatProactiveAction.attributes'];(function(_0x2a5dca,_0x3d9f0a){var _0x440054=function(_0x2f2eae){while(--_0x2f2eae){_0x2a5dca['push'](_0x2a5dca['shift']());}};_0x440054(++_0x3d9f0a);}(_0x1001,0xdc));var _0x1100=function(_0x15a385,_0x5786fb){_0x15a385=_0x15a385-0x0;var _0xb433e8=_0x1001[_0x15a385];return _0xb433e8;};'use strict';var _=require(_0x1100('0x0'));var util=require(_0x1100('0x1'));var logger=require(_0x1100('0x2'))('api');var moment=require(_0x1100('0x3'));var BPromise=require(_0x1100('0x4'));var rp=require(_0x1100('0x5'));var fs=require('fs');var path=require(_0x1100('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1100('0x7'));module[_0x1100('0x8')]=function(_0x48f413,_0x56d2c0){return _0x48f413[_0x1100('0x9')](_0x1100('0xa'),attributes,{'tableName':_0x1100('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac5f=['rimraf','../../config/environment','exports','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x1d2403,_0x2eba5d){var _0x2cc8ca=function(_0x313eab){while(--_0x313eab){_0x1d2403['push'](_0x1d2403['shift']());}};_0x2cc8ca(++_0x2eba5d);}(_0xac5f,0x13f));var _0xfac5=function(_0x1964cc,_0x5fc581){_0x1964cc=_0x1964cc-0x0;var _0x211d71=_0xac5f[_0x1964cc];return _0x211d71;};'use strict';var _=require(_0xfac5('0x0'));var util=require('util');var logger=require(_0xfac5('0x1'))(_0xfac5('0x2'));var moment=require('moment');var BPromise=require(_0xfac5('0x3'));var rp=require(_0xfac5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfac5('0x5'));var config=require(_0xfac5('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0xfac5('0x7')]=function(_0x32eda9,_0x3b51ab){return _0x32eda9[_0xfac5('0x8')]('ChatProactiveAction',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 74cebdf..c4ee94d 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 _0x6201=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x6201,0xfa));var _0x1620=function(_0x25b719,_0x3864cf){_0x25b719=_0x25b719-0x0;var _0x27ea13=_0x6201[_0x25b719];return _0x27ea13;};'use strict';var _=require(_0x1620('0x0'));var util=require(_0x1620('0x1'));var moment=require('moment');var BPromise=require(_0x1620('0x2'));var rs=require(_0x1620('0x3'));var fs=require('fs');var Redis=require(_0x1620('0x4'));var db=require(_0x1620('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1620('0x6'))(_0x1620('0x7'));var config=require(_0x1620('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1620('0x9')][_0x1620('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb64,_0x21fac9,_0x23ef59){return new BPromise(function(_0x77edae,_0x4118a5){return client[_0x1620('0xb')](_0x2bdb64,_0x23ef59)[_0x1620('0xc')](function(_0x2c388e){logger[_0x1620('0xd')](_0x1620('0xe'),_0x21fac9,_0x1620('0xf'));logger[_0x1620('0x10')](_0x1620('0x11'),_0x21fac9,'request\x20sent',JSON[_0x1620('0x12')](_0x2c388e));if(_0x2c388e[_0x1620('0x13')]){if(_0x2c388e[_0x1620('0x13')]['code']===0x1f4){logger['error'](_0x1620('0xe'),_0x21fac9,_0x2c388e[_0x1620('0x13')][_0x1620('0x14')]);return _0x4118a5(_0x2c388e[_0x1620('0x13')][_0x1620('0x14')]);}logger[_0x1620('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x21fac9,_0x2c388e[_0x1620('0x13')][_0x1620('0x14')]);return _0x77edae(_0x2c388e['error'][_0x1620('0x14')]);}else{logger['info'](_0x1620('0xe'),_0x21fac9,_0x1620('0xf'));_0x77edae(_0x2c388e[_0x1620('0x15')]['message']);}})['catch'](function(_0x13ee1e){logger[_0x1620('0x13')](_0x1620('0xe'),_0x21fac9,_0x13ee1e);_0x4118a5(_0x13ee1e);});});} \ No newline at end of file +var _0xc960=['error','code','message','ChatProactiveAction,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0xfbec4a,_0x51a0b9){var _0x1796c0=function(_0x1b9ccb){while(--_0x1b9ccb){_0xfbec4a['push'](_0xfbec4a['shift']());}};_0x1796c0(++_0x51a0b9);}(_0xc960,0xcc));var _0x0c96=function(_0x41a105,_0x2a71d4){_0x41a105=_0x41a105-0x0;var _0x171641=_0xc960[_0x41a105];return _0x171641;};'use strict';var _=require(_0x0c96('0x0'));var util=require(_0x0c96('0x1'));var moment=require(_0x0c96('0x2'));var BPromise=require(_0x0c96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c96('0x4'));var db=require(_0x0c96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c96('0x6'))('rpc');var config=require(_0x0c96('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c96('0x8')][_0x0c96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x769abf,_0x51b63d,_0x2b577d){return new BPromise(function(_0x582b2f,_0x3c9ac1){return client[_0x0c96('0xa')](_0x769abf,_0x2b577d)[_0x0c96('0xb')](function(_0x129d8a){logger[_0x0c96('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x51b63d,_0x0c96('0xd'));logger[_0x0c96('0xe')](_0x0c96('0xf'),_0x51b63d,_0x0c96('0xd'),JSON['stringify'](_0x129d8a));if(_0x129d8a[_0x0c96('0x10')]){if(_0x129d8a[_0x0c96('0x10')][_0x0c96('0x11')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x51b63d,_0x129d8a[_0x0c96('0x10')]['message']);return _0x3c9ac1(_0x129d8a[_0x0c96('0x10')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x51b63d,_0x129d8a['error'][_0x0c96('0x12')]);return _0x582b2f(_0x129d8a[_0x0c96('0x10')][_0x0c96('0x12')]);}else{logger[_0x0c96('0xc')](_0x0c96('0x13'),_0x51b63d,_0x0c96('0xd'));_0x582b2f(_0x129d8a['result'][_0x0c96('0x12')]);}})['catch'](function(_0xd55313){logger['error'](_0x0c96('0x13'),_0x51b63d,_0xd55313);_0x3c9ac1(_0xd55313);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 297e1e7..9b802f8 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 _0x5075=['show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated'];(function(_0xa48ada,_0x2dc15b){var _0x36f484=function(_0xbaeae9){while(--_0xbaeae9){_0xa48ada['push'](_0xa48ada['shift']());}};_0x36f484(++_0x2dc15b);}(_0x5075,0x73));var _0x5507=function(_0x27472b,_0x1e5ca1){_0x27472b=_0x27472b-0x0;var _0x249243=_0x5075[_0x27472b];return _0x249243;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/:id',auth[_0x5507('0xa')](),controller[_0x5507('0xb')]);router['post']('/',auth[_0x5507('0xa')](),controller[_0x5507('0xc')]);router[_0x5507('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')](_0x5507('0x10'),auth[_0x5507('0xa')](),controller['destroy']);module[_0x5507('0x11')]=router; \ No newline at end of file +var _0xfdbd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x7aa3c0,_0x2e824a){var _0x173b2f=function(_0x247e1c){while(--_0x247e1c){_0x7aa3c0['push'](_0x7aa3c0['shift']());}};_0x173b2f(++_0x2e824a);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2a2e72,_0x1de962){_0x2a2e72=_0x2a2e72-0x0;var _0x3cfb4a=_0xfdbd[_0x2a2e72];return _0x3cfb4a;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get'](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xb')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller[_0xdfdb('0x10')]);module[_0xdfdb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4b80680..146d917 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 _0xd35f=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xd35f,0x1ed));var _0xfd35=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xd35f[_0x725a4c];return _0x37b2cc;};'use strict';var Sequelize=require(_0xfd35('0x0'));module[_0xfd35('0x1')]={'name':{'type':Sequelize[_0xfd35('0x2')],'unique':_0xfd35('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd35('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd35('0x4')](_0xfd35('0x5'),_0xfd35('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xcb9f=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb9f,0x1e5));var _0xfcb9=function(_0x13d55f,_0x4805d4){_0x13d55f=_0x13d55f-0x0;var _0x57c230=_0xcb9f[_0x13d55f];return _0x57c230;};'use strict';var Sequelize=require(_0xfcb9('0x0'));module[_0xfcb9('0x1')]={'name':{'type':Sequelize[_0xfcb9('0x2')],'unique':_0xfcb9('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfcb9('0x2')]},'timeout':{'type':Sequelize[_0xfcb9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfcb9('0x5'),'beepall',_0xfcb9('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ab0de16..9021ded 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 _0x9eba=['findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','getTeams','Team','order','length','addTeams','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','ids','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','http','request','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueue','includeAll','include','rows','params','keys','rawAttributes','find','create','user','role','ChatQueues','UserProfileSection','autoAssociation','body','describe','getMembers','findOne','ChatQueueId','UserChatQueue','findAll','User'];(function(_0x560274,_0x1f1355){var _0x1bc78a=function(_0x325852){while(--_0x325852){_0x560274['push'](_0x560274['shift']());}};_0x1bc78a(++_0x1f1355);}(_0x9eba,0xc7));var _0xa9eb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9eba[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xa9eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9eb('0x1'));var jsonpatch=require(_0xa9eb('0x2'));var rp=require(_0xa9eb('0x3'));var moment=require(_0xa9eb('0x4'));var BPromise=require(_0xa9eb('0x5'));var Mustache=require('mustache');var util=require(_0xa9eb('0x6'));var path=require('path');var sox=require(_0xa9eb('0x7'));var csv=require(_0xa9eb('0x8'));var ejs=require(_0xa9eb('0x9'));var fs=require('fs');var fs_extra=require(_0xa9eb('0xa'));var _=require(_0xa9eb('0xb'));var squel=require(_0xa9eb('0xc'));var crypto=require(_0xa9eb('0xd'));var jsforce=require(_0xa9eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa9eb('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9eb('0xf'));var authService=require(_0xa9eb('0x10'));var qs=require(_0xa9eb('0x11'));var as=require(_0xa9eb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9eb('0x13'))(_0xa9eb('0x14'));var utils=require(_0xa9eb('0x15'));var config=require(_0xa9eb('0x16'));var licenseUtil=require(_0xa9eb('0x17'));var db=require(_0xa9eb('0x18'))['db'];config[_0xa9eb('0x19')]=_[_0xa9eb('0x1a')](config[_0xa9eb('0x19')],{'host':_0xa9eb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9eb('0x19')]));require(_0xa9eb('0x1c'))[_0xa9eb('0x1d')](socket);var jayson=require(_0xa9eb('0x1e'));var client=jayson['client'][_0xa9eb('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5499ed,_0x271c32,_0x9c2ea,_0x1ede03){return new BPromise(function(_0x1a50d1,_0x242bab){var _0xd3e37d=_0x1ede03||client;return _0xd3e37d[_0xa9eb('0x20')](_0x5499ed,_0x9c2ea)['then'](function(_0x2487e2){logger[_0xa9eb('0x21')]('ChatQueue,\x20%s,\x20%s',_0x271c32,'request\x20sent');logger[_0xa9eb('0x22')](_0xa9eb('0x23'),_0x271c32,_0xa9eb('0x24'),JSON[_0xa9eb('0x25')](_0x2487e2));if(_0x2487e2[_0xa9eb('0x26')]){if(_0x2487e2['error']['code']===0x1f4){logger[_0xa9eb('0x26')](_0xa9eb('0x27'),_0x271c32,_0x2487e2['error'][_0xa9eb('0x28')]);return _0x242bab(_0x2487e2[_0xa9eb('0x26')][_0xa9eb('0x28')]);}logger[_0xa9eb('0x26')](_0xa9eb('0x27'),_0x271c32,_0x2487e2[_0xa9eb('0x26')][_0xa9eb('0x28')]);return _0x1a50d1(_0x2487e2[_0xa9eb('0x26')][_0xa9eb('0x28')]);}else{logger[_0xa9eb('0x21')]('ChatQueue,\x20%s,\x20%s',_0x271c32,'request\x20sent');_0x1a50d1(_0x2487e2[_0xa9eb('0x29')][_0xa9eb('0x28')]);}})[_0xa9eb('0x2a')](function(_0x472d79){logger[_0xa9eb('0x26')](_0xa9eb('0x27'),_0x271c32,_0x472d79);_0x242bab(_0x472d79);});});}function respondWithStatusCode(_0x48ffbb,_0x1c0d6b){_0x1c0d6b=_0x1c0d6b||0xcc;return function(_0x10ae09){if(_0x10ae09){return _0x48ffbb['sendStatus'](_0x1c0d6b);}return _0x48ffbb['status'](_0x1c0d6b)[_0xa9eb('0x2b')]();};}function respondWithResult(_0x27056f,_0x24139d){_0x24139d=_0x24139d||0xc8;return function(_0x206138){if(_0x206138){return _0x27056f[_0xa9eb('0x2c')](_0x24139d)['json'](_0x206138);}};}function respondWithFilteredResult(_0x1aa696,_0x314f60){return function(_0x260ec5){if(_0x260ec5){var _0x50bb67=typeof _0x314f60[_0xa9eb('0x2d')]===_0xa9eb('0x2e')&&typeof _0x314f60['limit']===_0xa9eb('0x2e');var _0x12bcc3=_0x260ec5[_0xa9eb('0x2f')];var _0x4ab368=_0x50bb67?0x0:_0x314f60[_0xa9eb('0x2d')];var _0x23a7ef=_0x50bb67?_0x260ec5[_0xa9eb('0x2f')]:_0x314f60['offset']+_0x314f60[_0xa9eb('0x30')];var _0x2b6ae2;if(_0x23a7ef>=_0x12bcc3){_0x23a7ef=_0x12bcc3;_0x2b6ae2=0xc8;}else{_0x2b6ae2=0xce;}_0x1aa696[_0xa9eb('0x2c')](_0x2b6ae2);return _0x1aa696[_0xa9eb('0x31')](_0xa9eb('0x32'),_0x4ab368+'-'+_0x23a7ef+'/'+_0x12bcc3)[_0xa9eb('0x33')](_0x260ec5);}return null;};}function patchUpdates(_0x57007a){return function(_0x55f74c){try{jsonpatch['apply'](_0x55f74c,_0x57007a,!![]);}catch(_0x16b475){return BPromise[_0xa9eb('0x34')](_0x16b475);}return _0x55f74c[_0xa9eb('0x35')]();};}function saveUpdates(_0x1c66f9,_0x247d02){return function(_0x329230){if(_0x329230){return _0x329230[_0xa9eb('0x36')](_0x1c66f9)[_0xa9eb('0x37')](function(_0x4b382b){return _0x4b382b;});}return null;};}function removeEntity(_0x1893c9,_0x473b50){return function(_0x5967a7){if(_0x5967a7){return _0x5967a7[_0xa9eb('0x38')]()[_0xa9eb('0x37')](function(){var _0x1765ca=_0x5967a7[_0xa9eb('0x39')]({'plain':!![]});var _0x12f94a='ChatQueues';return db[_0xa9eb('0x3a')][_0xa9eb('0x38')]({'where':{'type':_0x12f94a,'resourceId':_0x1765ca['id']}})[_0xa9eb('0x37')](function(){return _0x5967a7;});})['then'](function(){_0x1893c9['status'](0xcc)[_0xa9eb('0x2b')]();});}};}function handleEntityNotFound(_0x3363fd,_0x1e70a5){return function(_0x54ce7b){if(!_0x54ce7b){_0x3363fd[_0xa9eb('0x3b')](0x194);}return _0x54ce7b;};}function handleError(_0x1153ac,_0x2c13f0){_0x2c13f0=_0x2c13f0||0x1f4;return function(_0x4eace7){logger[_0xa9eb('0x26')](_0x4eace7[_0xa9eb('0x3c')]);if(_0x4eace7[_0xa9eb('0x3d')]){delete _0x4eace7['name'];}_0x1153ac[_0xa9eb('0x2c')](_0x2c13f0)['send'](_0x4eace7);};}exports['index']=function(_0x595205,_0x5d3784){var _0x26f983={},_0x5b2456={},_0x33e003={'count':0x0,'rows':[]};var _0x125ae3=_[_0xa9eb('0x3e')](db['ChatQueue']['rawAttributes'],function(_0x5a5812){return{'name':_0x5a5812[_0xa9eb('0x3f')],'type':_0x5a5812[_0xa9eb('0x40')][_0xa9eb('0x41')]};});_0x5b2456[_0xa9eb('0x42')]=_[_0xa9eb('0x3e')](_0x125ae3,'name');_0x5b2456[_0xa9eb('0x43')]=_['keys'](_0x595205[_0xa9eb('0x43')]);_0x5b2456[_0xa9eb('0x44')]=_[_0xa9eb('0x45')](_0x5b2456[_0xa9eb('0x42')],_0x5b2456[_0xa9eb('0x43')]);_0x26f983[_0xa9eb('0x46')]=_[_0xa9eb('0x45')](_0x5b2456[_0xa9eb('0x42')],qs[_0xa9eb('0x47')](_0x595205[_0xa9eb('0x43')][_0xa9eb('0x47')]));_0x26f983[_0xa9eb('0x46')]=_0x26f983[_0xa9eb('0x46')]['length']?_0x26f983[_0xa9eb('0x46')]:_0x5b2456[_0xa9eb('0x42')];if(!_0x595205[_0xa9eb('0x43')][_0xa9eb('0x48')](_0xa9eb('0x49'))){_0x26f983[_0xa9eb('0x30')]=qs[_0xa9eb('0x30')](_0x595205['query'][_0xa9eb('0x30')]);_0x26f983[_0xa9eb('0x2d')]=qs[_0xa9eb('0x2d')](_0x595205[_0xa9eb('0x43')]['offset']);}_0x26f983['order']=qs[_0xa9eb('0x4a')](_0x595205['query']['sort']);_0x26f983[_0xa9eb('0x4b')]=qs[_0xa9eb('0x44')](_[_0xa9eb('0x4c')](_0x595205[_0xa9eb('0x43')],_0x5b2456['filters']),_0x125ae3);if(_0x595205[_0xa9eb('0x43')][_0xa9eb('0x4d')]){_0x26f983[_0xa9eb('0x4b')]=_[_0xa9eb('0x4e')](_0x26f983[_0xa9eb('0x4b')],{'$or':_[_0xa9eb('0x3e')](_0x125ae3,function(_0x4cedcf){if(_0x4cedcf[_0xa9eb('0x40')]!==_0xa9eb('0x4f')){var _0x29911b={};_0x29911b[_0x4cedcf[_0xa9eb('0x3d')]]={'$like':'%'+_0x595205[_0xa9eb('0x43')][_0xa9eb('0x4d')]+'%'};return _0x29911b;}})});}_0x26f983=_['merge']({},_0x26f983,_0x595205[_0xa9eb('0x50')]);var _0x4e8c03={'where':_0x26f983['where']};return db[_0xa9eb('0x51')][_0xa9eb('0x2f')](_0x4e8c03)[_0xa9eb('0x37')](function(_0xe7fdfa){_0x33e003[_0xa9eb('0x2f')]=_0xe7fdfa;if(_0x595205[_0xa9eb('0x43')][_0xa9eb('0x52')]){_0x26f983[_0xa9eb('0x53')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x26f983);})[_0xa9eb('0x37')](function(_0xeca40e){_0x33e003[_0xa9eb('0x54')]=_0xeca40e;return _0x33e003;})['then'](respondWithFilteredResult(_0x5d3784,_0x26f983))['catch'](handleError(_0x5d3784,null));};exports['show']=function(_0x2bf47f,_0x115791){var _0x484415={'raw':!![],'where':{'id':_0x2bf47f[_0xa9eb('0x55')]['id']}},_0x280955={};_0x280955[_0xa9eb('0x42')]=_[_0xa9eb('0x56')](db['ChatQueue'][_0xa9eb('0x57')]);_0x280955['query']=_['keys'](_0x2bf47f[_0xa9eb('0x43')]);_0x280955['filters']=_[_0xa9eb('0x45')](_0x280955[_0xa9eb('0x42')],_0x280955[_0xa9eb('0x43')]);_0x484415[_0xa9eb('0x46')]=_['intersection'](_0x280955[_0xa9eb('0x42')],qs['fields'](_0x2bf47f[_0xa9eb('0x43')][_0xa9eb('0x47')]));_0x484415[_0xa9eb('0x46')]=_0x484415[_0xa9eb('0x46')]['length']?_0x484415[_0xa9eb('0x46')]:_0x280955[_0xa9eb('0x42')];if(_0x2bf47f['query'][_0xa9eb('0x52')]){_0x484415[_0xa9eb('0x53')]=[{'all':!![]}];}_0x484415=_[_0xa9eb('0x4e')]({},_0x484415,_0x2bf47f[_0xa9eb('0x50')]);return db[_0xa9eb('0x51')][_0xa9eb('0x58')](_0x484415)['then'](handleEntityNotFound(_0x115791,null))[_0xa9eb('0x37')](respondWithResult(_0x115791,null))[_0xa9eb('0x2a')](handleError(_0x115791,null));};exports[_0xa9eb('0x59')]=function(_0x5c21ca,_0x4f3cb4){return db[_0xa9eb('0x51')][_0xa9eb('0x59')](_0x5c21ca['body'],{})[_0xa9eb('0x37')](function(_0x5ecd3f){var _0x174b4c=_0x5c21ca[_0xa9eb('0x5a')][_0xa9eb('0x39')]({'plain':!![]});if(!_0x174b4c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x174b4c[_0xa9eb('0x5b')]===_0xa9eb('0x5a')){var _0x21f0be=_0x5ecd3f['get']({'plain':!![]});var _0x43c30a=_0xa9eb('0x5c');return db[_0xa9eb('0x5d')][_0xa9eb('0x58')]({'where':{'name':_0x43c30a,'userProfileId':_0x174b4c['userProfileId']},'raw':!![]})['then'](function(_0xa09fa2){if(_0xa09fa2&&_0xa09fa2[_0xa9eb('0x5e')]===0x0){return db[_0xa9eb('0x3a')][_0xa9eb('0x59')]({'name':_0x21f0be['name'],'resourceId':_0x21f0be['id'],'type':_0xa09fa2[_0xa9eb('0x3d')],'sectionId':_0xa09fa2['id']},{})[_0xa9eb('0x37')](function(){return _0x5ecd3f;});}else{return _0x5ecd3f;}})[_0xa9eb('0x2a')](function(_0x2aa71d){logger[_0xa9eb('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aa71d);throw _0x2aa71d;});}return _0x5ecd3f;})[_0xa9eb('0x37')](respondWithResult(_0x4f3cb4,0xc9))[_0xa9eb('0x2a')](handleError(_0x4f3cb4,null));};exports[_0xa9eb('0x36')]=function(_0x4bfdfd,_0x474cc4){if(_0x4bfdfd[_0xa9eb('0x5f')]['id']){delete _0x4bfdfd[_0xa9eb('0x5f')]['id'];}return db['ChatQueue'][_0xa9eb('0x58')]({'where':{'id':_0x4bfdfd[_0xa9eb('0x55')]['id']}})['then'](handleEntityNotFound(_0x474cc4,null))['then'](saveUpdates(_0x4bfdfd[_0xa9eb('0x5f')],null))[_0xa9eb('0x37')](respondWithResult(_0x474cc4,null))[_0xa9eb('0x2a')](handleError(_0x474cc4,null));};exports[_0xa9eb('0x38')]=function(_0x1c368f,_0x3b2ea2){return db['ChatQueue'][_0xa9eb('0x58')]({'where':{'id':_0x1c368f['params']['id']}})['then'](handleEntityNotFound(_0x3b2ea2,null))[_0xa9eb('0x37')](removeEntity(_0x3b2ea2,null))[_0xa9eb('0x2a')](handleError(_0x3b2ea2,null));};exports[_0xa9eb('0x60')]=function(_0x4205b3,_0x49d924){return db[_0xa9eb('0x51')][_0xa9eb('0x60')]()[_0xa9eb('0x37')](respondWithResult(_0x49d924,null))[_0xa9eb('0x2a')](handleError(_0x49d924,null));};exports[_0xa9eb('0x61')]=function(_0x1cfc85,_0x158d31,_0xbc14cf){var _0x53e2c0={'raw':!![],'where':{}},_0x307303={},_0x195ed1;return db[_0xa9eb('0x51')][_0xa9eb('0x62')]({'where':{'id':_0x1cfc85[_0xa9eb('0x55')]['id']}})[_0xa9eb('0x37')](handleEntityNotFound(_0x158d31,null))[_0xa9eb('0x37')](function(_0x35557b){if(_0x35557b){_0x195ed1=_0x35557b[_0xa9eb('0x39')]({'plain':!![]});_0x307303[_0xa9eb('0x42')]=_[_0xa9eb('0x56')](db['UserChatQueue'][_0xa9eb('0x57')]);_0x307303['query']=_[_0xa9eb('0x56')](_0x1cfc85['query']);_0x307303['filters']=_[_0xa9eb('0x45')](_0x307303[_0xa9eb('0x42')],_0x307303['query']);_0x53e2c0[_0xa9eb('0x46')]=_[_0xa9eb('0x45')](_0x307303[_0xa9eb('0x42')],qs[_0xa9eb('0x47')](_0x1cfc85['query'][_0xa9eb('0x47')]));_0x53e2c0[_0xa9eb('0x46')]=_0x53e2c0[_0xa9eb('0x46')]['length']?_0x53e2c0['attributes']:_0x307303[_0xa9eb('0x42')];if(!_0x1cfc85[_0xa9eb('0x43')][_0xa9eb('0x48')]('nolimit')){_0x53e2c0[_0xa9eb('0x30')]=qs[_0xa9eb('0x30')](_0x1cfc85['query']['limit']);_0x53e2c0[_0xa9eb('0x2d')]=qs[_0xa9eb('0x2d')](_0x1cfc85[_0xa9eb('0x43')][_0xa9eb('0x2d')]);}_0x53e2c0['order']=qs['sort'](_0x1cfc85[_0xa9eb('0x43')][_0xa9eb('0x4a')]);_0x53e2c0['where']=qs[_0xa9eb('0x44')](_[_0xa9eb('0x4c')](_0x1cfc85[_0xa9eb('0x43')],_0x307303[_0xa9eb('0x44')]));_0x53e2c0[_0xa9eb('0x4b')][_0xa9eb('0x63')]=_0x35557b['id'];if(_0x1cfc85[_0xa9eb('0x43')][_0xa9eb('0x4d')]){_0x53e2c0['where']=_[_0xa9eb('0x4e')](_0x53e2c0[_0xa9eb('0x4b')],{'$or':_[_0xa9eb('0x3e')](_0x53e2c0[_0xa9eb('0x46')],function(_0x404a57){var _0x279aeb={};_0x279aeb[_0x404a57]={'$like':'%'+_0x1cfc85['query']['filter']+'%'};return _0x279aeb;})});}_0x53e2c0=_[_0xa9eb('0x4e')]({},_0x53e2c0,_0x1cfc85[_0xa9eb('0x50')]);return db[_0xa9eb('0x64')][_0xa9eb('0x65')](_0x53e2c0);}})[_0xa9eb('0x37')](function(_0x5936b2){if(_0x5936b2){return db[_0xa9eb('0x66')][_0xa9eb('0x67')]({'where':{'id':_[_0xa9eb('0x3e')](_0x5936b2,_0xa9eb('0x68')),'role':'agent'},'attributes':['id','name',_0xa9eb('0x69'),_0xa9eb('0x6a'),_0xa9eb('0x6b')]});}})[_0xa9eb('0x37')](function(_0x3da6a9){if(_0x3da6a9){return{'count':_0x3da6a9[_0xa9eb('0x2f')],'rows':_[_0xa9eb('0x3e')](_0x3da6a9[_0xa9eb('0x54')],function(_0x2494df){return{'membername':_0x2494df[_0xa9eb('0x3d')],'UserId':_0x2494df['id'],'queue_name':_0x195ed1[_0xa9eb('0x3d')],'ChatQueueId':_0x195ed1['id'],'interface':util[_0xa9eb('0x6c')]('%s/%s','SIP',_0x2494df[_0xa9eb('0x3d')]),'penalty':0x0,'paused':_0x2494df[_0xa9eb('0x69')],'createdAt':_0x2494df[_0xa9eb('0x6b')],'updatedAt':_0x2494df[_0xa9eb('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x158d31,_0x53e2c0))[_0xa9eb('0x2a')](handleError(_0x158d31,null));};exports[_0xa9eb('0x6d')]=function(_0x9b7bf0,_0x2ec3c0,_0x2c3a39){var _0x372319={};var _0x56e493={};var _0x3cf201;var _0x2a570f;return db[_0xa9eb('0x51')][_0xa9eb('0x62')]({'where':{'id':_0x9b7bf0['params']['id']}})[_0xa9eb('0x37')](handleEntityNotFound(_0x2ec3c0,null))[_0xa9eb('0x37')](function(_0x5407e1){if(_0x5407e1){_0x3cf201=_0x5407e1;_0x56e493[_0xa9eb('0x42')]=_[_0xa9eb('0x56')](db[_0xa9eb('0x6e')][_0xa9eb('0x57')]);_0x56e493[_0xa9eb('0x43')]=_[_0xa9eb('0x56')](_0x9b7bf0[_0xa9eb('0x43')]);_0x56e493[_0xa9eb('0x44')]=_[_0xa9eb('0x45')](_0x56e493[_0xa9eb('0x42')],_0x56e493[_0xa9eb('0x43')]);_0x372319[_0xa9eb('0x46')]=_[_0xa9eb('0x45')](_0x56e493[_0xa9eb('0x42')],qs['fields'](_0x9b7bf0['query'][_0xa9eb('0x47')]));_0x372319['attributes']=_0x372319[_0xa9eb('0x46')]['length']?_0x372319[_0xa9eb('0x46')]:_0x56e493[_0xa9eb('0x42')];_0x372319[_0xa9eb('0x6f')]=qs[_0xa9eb('0x4a')](_0x9b7bf0[_0xa9eb('0x43')][_0xa9eb('0x4a')]);_0x372319[_0xa9eb('0x4b')]=qs[_0xa9eb('0x44')](_[_0xa9eb('0x4c')](_0x9b7bf0[_0xa9eb('0x43')],_0x56e493[_0xa9eb('0x44')]));if(_0x9b7bf0['query'][_0xa9eb('0x4d')]){_0x372319[_0xa9eb('0x4b')]=_[_0xa9eb('0x4e')](_0x372319['where'],{'$or':_[_0xa9eb('0x3e')](_0x372319[_0xa9eb('0x46')],function(_0x1f0889){var _0x1cf72e={};_0x1cf72e[_0x1f0889]={'$like':'%'+_0x9b7bf0[_0xa9eb('0x43')]['filter']+'%'};return _0x1cf72e;})});}_0x372319=_[_0xa9eb('0x4e')]({},_0x372319,_0x9b7bf0[_0xa9eb('0x50')]);return _0x3cf201[_0xa9eb('0x6d')](_0x372319);}})[_0xa9eb('0x37')](function(_0x2407cc){if(_0x2407cc){_0x2a570f=_0x2407cc[_0xa9eb('0x70')];if(!_0x9b7bf0[_0xa9eb('0x43')][_0xa9eb('0x48')](_0xa9eb('0x49'))){_0x372319[_0xa9eb('0x30')]=qs[_0xa9eb('0x30')](_0x9b7bf0[_0xa9eb('0x43')]['limit']);_0x372319[_0xa9eb('0x2d')]=qs[_0xa9eb('0x2d')](_0x9b7bf0[_0xa9eb('0x43')][_0xa9eb('0x2d')]);}return _0x3cf201[_0xa9eb('0x6d')](_0x372319);}})['then'](function(_0x5b06d2){if(_0x5b06d2){return _0x5b06d2?{'count':_0x2a570f,'rows':_0x5b06d2}:null;}})[_0xa9eb('0x37')](respondWithResult(_0x2ec3c0,null))[_0xa9eb('0x2a')](handleError(_0x2ec3c0,null));};exports[_0xa9eb('0x71')]=function(_0x45b309,_0x10b216,_0x16a821){var _0x2b712d=_0x45b309[_0xa9eb('0x5f')]['ids'];return db['Team'][_0xa9eb('0x65')]({'where':{'id':_0x2b712d},'attributes':['id'],'include':[{'model':db[_0xa9eb('0x66')],'as':'Agents','attributes':['id',_0xa9eb('0x3d'),'online',_0xa9eb('0x72'),'interface'],'raw':!![]}]})[_0xa9eb('0x37')](function(_0x21f275){if(_0x21f275){var _0x59fe2e=_[_0xa9eb('0x73')](_0x21f275,function(_0x1ebeba){var _0x38ea46=_0x1ebeba['get']({'plain':!![]});return _0x38ea46[_0xa9eb('0x74')];});return db[_0xa9eb('0x51')][_0xa9eb('0x58')]({'where':{'id':_0x45b309[_0xa9eb('0x55')]['id']}})[_0xa9eb('0x37')](function(_0x17b60d){return db[_0xa9eb('0x75')][_0xa9eb('0x76')](function(_0xe82d42){return _0x17b60d[_0xa9eb('0x71')](_0x2b712d,{'transaction':_0xe82d42})[_0xa9eb('0x37')](function(){return BPromise[_0xa9eb('0x77')](_0x59fe2e,function(_0x5e508a){return db[_0xa9eb('0x64')][_0xa9eb('0x78')]({'where':{'UserId':_0x5e508a['id'],'ChatQueueId':_0x45b309[_0xa9eb('0x55')]['id']},'transaction':_0xe82d42});});})[_0xa9eb('0x37')](function(){_0x59fe2e['forEach'](function(_0x455c12){socket[_0xa9eb('0x79')](_0xa9eb('0x7a'),{'UserId':_0x455c12['id'],'ChatQueueId':_0x17b60d['id']});});});});});}})[_0xa9eb('0x37')](respondWithStatusCode(_0x10b216,null))[_0xa9eb('0x2a')](handleError(_0x10b216,null));};exports['removeTeams']=function(_0x2a1737,_0x3ce10e,_0x5c085c){return db[_0xa9eb('0x6e')][_0xa9eb('0x65')]({'where':{'id':_0x2a1737['query'][_0xa9eb('0x7b')]},'attributes':['id'],'include':[{'model':db[_0xa9eb('0x66')],'as':_0xa9eb('0x74'),'attributes':['id'],'raw':!![]}]})[_0xa9eb('0x37')](handleEntityNotFound(_0x3ce10e,null))['then'](function(_0x21a994){var _0x1b8c3d=_['map'](_0x21a994,'id');var _0x510b91=[];var _0x12d4a9=[];var _0x1cbcb5=squel[_0xa9eb('0x7c')]();_0x1cbcb5[_0xa9eb('0x7d')]('tq.TeamId')[_0xa9eb('0x7e')](_0xa9eb('0x7f'),'tq')[_0xa9eb('0x80')](_0xa9eb('0x81'),'ut',_0xa9eb('0x82'))[_0xa9eb('0x4b')](_0xa9eb('0x83'),_0x2a1737['params']['id']);for(var _0x316dee=0x0;_0x316dee<_0x21a994[_0xa9eb('0x70')];_0x316dee+=0x1){let _0x1ef500=_0x21a994[_0x316dee];for(var _0x583f34=0x0;_0x583f34<_0x1ef500[_0xa9eb('0x74')][_0xa9eb('0x70')];_0x583f34+=0x1){let _0x3e9f40=_0x1ef500[_0xa9eb('0x74')][_0x583f34];var _0x291de7=_0x1cbcb5[_0xa9eb('0x84')]();_0x291de7[_0xa9eb('0x4b')]('ut.UserId\x20=\x20?',_0x3e9f40['id']);_0x12d4a9[_0xa9eb('0x85')](db[_0xa9eb('0x75')][_0xa9eb('0x43')](_0x291de7[_0xa9eb('0x86')](),{'type':db[_0xa9eb('0x75')][_0xa9eb('0x87')][_0xa9eb('0x88')]})[_0xa9eb('0x37')](function(_0x16b9db){if(_0x16b9db[_0xa9eb('0x70')]===0x1){return _0x3e9f40['id'];}else{var _0x1aea9b=_[_0xa9eb('0x89')](_[_0xa9eb('0x3e')](_0x16b9db,_0xa9eb('0x8a')),function(_0x58bd2a){return _[_0xa9eb('0x8b')](_0x1b8c3d,_0x58bd2a);});if(_0x1aea9b){return _0x3e9f40['id'];}}}));}}return BPromise[_0xa9eb('0x8c')](_0x12d4a9)['then'](function(_0x574fd7){_0x510b91=_(_0x510b91)['union'](_0x574fd7)[_0xa9eb('0x8d')]()[_0xa9eb('0x8e')]();return db[_0xa9eb('0x51')][_0xa9eb('0x58')]({'where':{'id':_0x2a1737[_0xa9eb('0x55')]['id']}})[_0xa9eb('0x37')](function(_0x43f3d0){return db[_0xa9eb('0x75')][_0xa9eb('0x76')](function(_0x134315){return _0x43f3d0[_0xa9eb('0x8f')](_0x2a1737['query'][_0xa9eb('0x7b')],{'transaction':_0x134315})[_0xa9eb('0x37')](function(){if(!_[_0xa9eb('0x90')](_0x510b91)){return _0x43f3d0[_0xa9eb('0x91')](_0x510b91,{'transaction':_0x134315});}})['then'](function(){_0x510b91['forEach'](function(_0x4fe998){socket[_0xa9eb('0x79')](_0xa9eb('0x92'),{'UserId':_0x4fe998,'ChatQueueId':_0x43f3d0['id']});});});});});});})[_0xa9eb('0x37')](respondWithStatusCode(_0x3ce10e,null))[_0xa9eb('0x2a')](handleError(_0x3ce10e,null));};exports[_0xa9eb('0x93')]=function(_0x472909,_0x2dfaa3,_0x3a23e8){return db[_0xa9eb('0x51')][_0xa9eb('0x58')]({'where':{'id':_0x472909[_0xa9eb('0x55')]['id']}})[_0xa9eb('0x37')](handleEntityNotFound(_0x2dfaa3,null))[_0xa9eb('0x37')](function(_0x5f1f0c){if(_0x5f1f0c){return _0x5f1f0c[_0xa9eb('0x93')](_0x472909[_0xa9eb('0x5f')][_0xa9eb('0x7b')],_['omit'](_0x472909['body'],['ids','id'])||{})[_0xa9eb('0x94')](function(_0x8fa5d1){for(var _0x5c642f=0x0;_0x5c642f<_0x472909[_0xa9eb('0x5f')]['ids'][_0xa9eb('0x70')];_0x5c642f+=0x1){socket['emit'](_0xa9eb('0x7a'),{'UserId':Number(_0x472909[_0xa9eb('0x5f')][_0xa9eb('0x7b')][_0x5c642f]),'ChatQueueId':Number(_0x472909[_0xa9eb('0x55')]['id'])});}return _0x8fa5d1;});}})['then'](respondWithResult(_0x2dfaa3,null))[_0xa9eb('0x2a')](handleError(_0x2dfaa3,null));};exports[_0xa9eb('0x91')]=function(_0x572183,_0x5d6564,_0x2313b1){return db[_0xa9eb('0x51')]['find']({'where':{'id':_0x572183['params']['id']}})[_0xa9eb('0x37')](handleEntityNotFound(_0x5d6564,null))[_0xa9eb('0x37')](function(_0x47a7f8){if(_0x47a7f8){return _0x47a7f8['removeAgents'](_0x572183[_0xa9eb('0x43')]['ids'])[_0xa9eb('0x37')](function(){if(_[_0xa9eb('0x95')](_0x572183[_0xa9eb('0x43')]['ids'])){for(var _0x56eb76=0x0;_0x56eb76<_0x572183[_0xa9eb('0x43')]['ids'][_0xa9eb('0x70')];_0x56eb76+=0x1){socket[_0xa9eb('0x79')](_0xa9eb('0x92'),{'UserId':Number(_0x572183['query'][_0xa9eb('0x7b')][_0x56eb76]),'ChatQueueId':Number(_0x572183[_0xa9eb('0x55')]['id'])});}}else{socket[_0xa9eb('0x79')](_0xa9eb('0x92'),{'UserId':Number(_0x572183[_0xa9eb('0x43')]['ids']),'ChatQueueId':Number(_0x572183[_0xa9eb('0x55')]['id'])});}});}})[_0xa9eb('0x37')](respondWithStatusCode(_0x5d6564,null))[_0xa9eb('0x2a')](handleError(_0x5d6564,null));};exports[_0xa9eb('0x96')]=function(_0x519ca1,_0x2ccea3,_0x16d0d0){var _0x11bab7={};var _0x174922={};var _0x522149;var _0x3d2090;return db[_0xa9eb('0x51')][_0xa9eb('0x62')]({'where':{'id':_0x519ca1['params']['id']}})[_0xa9eb('0x37')](handleEntityNotFound(_0x2ccea3,null))[_0xa9eb('0x37')](function(_0x53ae33){if(_0x53ae33){_0x522149=_0x53ae33;_0x174922[_0xa9eb('0x42')]=_[_0xa9eb('0x56')](db['User'][_0xa9eb('0x57')]);_0x174922['query']=_[_0xa9eb('0x56')](_0x519ca1['query']);_0x174922[_0xa9eb('0x44')]=_[_0xa9eb('0x45')](_0x174922['model'],_0x174922[_0xa9eb('0x43')]);_0x11bab7['attributes']=_[_0xa9eb('0x45')](_0x174922[_0xa9eb('0x42')],qs[_0xa9eb('0x47')](_0x519ca1[_0xa9eb('0x43')][_0xa9eb('0x47')]));_0x11bab7[_0xa9eb('0x46')]=_0x11bab7[_0xa9eb('0x46')][_0xa9eb('0x70')]?_0x11bab7['attributes']:_0x174922[_0xa9eb('0x42')];_0x11bab7[_0xa9eb('0x6f')]=qs[_0xa9eb('0x4a')](_0x519ca1[_0xa9eb('0x43')][_0xa9eb('0x4a')]);_0x11bab7[_0xa9eb('0x4b')]=qs[_0xa9eb('0x44')](_[_0xa9eb('0x4c')](_0x519ca1[_0xa9eb('0x43')],_0x174922[_0xa9eb('0x44')]));if(_0x519ca1[_0xa9eb('0x43')]['filter']){_0x11bab7['where']=_[_0xa9eb('0x4e')](_0x11bab7[_0xa9eb('0x4b')],{'$or':_[_0xa9eb('0x3e')](_0x11bab7[_0xa9eb('0x46')],function(_0x126bc5){var _0x6af6d={};_0x6af6d[_0x126bc5]={'$like':'%'+_0x519ca1['query'][_0xa9eb('0x4d')]+'%'};return _0x6af6d;})});}_0x11bab7=_[_0xa9eb('0x4e')]({},_0x11bab7,_0x519ca1[_0xa9eb('0x50')]);return _0x522149['getAgents'](_0x11bab7);}})[_0xa9eb('0x37')](function(_0x378208){if(_0x378208){_0x3d2090=_0x378208[_0xa9eb('0x70')];if(!_0x519ca1[_0xa9eb('0x43')][_0xa9eb('0x48')](_0xa9eb('0x49'))){_0x11bab7[_0xa9eb('0x30')]=qs[_0xa9eb('0x30')](_0x519ca1[_0xa9eb('0x43')][_0xa9eb('0x30')]);_0x11bab7[_0xa9eb('0x2d')]=qs[_0xa9eb('0x2d')](_0x519ca1[_0xa9eb('0x43')][_0xa9eb('0x2d')]);}return _0x522149[_0xa9eb('0x96')](_0x11bab7);}})[_0xa9eb('0x37')](function(_0x5bdb8){if(_0x5bdb8){return _0x5bdb8?{'count':_0x3d2090,'rows':_0x5bdb8}:null;}})[_0xa9eb('0x37')](respondWithResult(_0x2ccea3,null))['catch'](handleError(_0x2ccea3,null));}; \ No newline at end of file +var _0xde56=['union','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','error','message','ChatQueue,\x20%s,\x20%s','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','createdAt','%s/%s','chatPause','Team','getTeams','addTeams','ids','online','interface','flatMap','sequelize','transaction','forEach','emit','select','field','tq.TeamId','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all'];(function(_0x5b38ef,_0x1a03eb){var _0x5c6368=function(_0x434ebd){while(--_0x434ebd){_0x5b38ef['push'](_0x5b38ef['shift']());}};_0x5c6368(++_0x1a03eb);}(_0xde56,0x13f));var _0x6de5=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0xde56[_0x484cac];return _0x1d6e77;};'use strict';var emlformat=require(_0x6de5('0x0'));var rimraf=require(_0x6de5('0x1'));var zipdir=require(_0x6de5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6de5('0x3'));var Mustache=require('mustache');var util=require(_0x6de5('0x4'));var path=require('path');var sox=require(_0x6de5('0x5'));var csv=require('to-csv');var ejs=require(_0x6de5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6de5('0x7'));var squel=require(_0x6de5('0x8'));var crypto=require(_0x6de5('0x9'));var jsforce=require(_0x6de5('0xa'));var deskjs=require(_0x6de5('0xb'));var toCsv=require(_0x6de5('0xc'));var querystring=require(_0x6de5('0xd'));var Papa=require(_0x6de5('0xe'));var Redis=require(_0x6de5('0xf'));var authService=require(_0x6de5('0x10'));var qs=require(_0x6de5('0x11'));var as=require(_0x6de5('0x12'));var hardwareService=require(_0x6de5('0x13'));var logger=require(_0x6de5('0x14'))(_0x6de5('0x15'));var utils=require('../../config/utils');var config=require(_0x6de5('0x16'));var licenseUtil=require(_0x6de5('0x17'));var db=require(_0x6de5('0x18'))['db'];config[_0x6de5('0x19')]=_[_0x6de5('0x1a')](config[_0x6de5('0x19')],{'host':_0x6de5('0x1b'),'port':0x18eb});var socket=require(_0x6de5('0x1c'))(new Redis(config[_0x6de5('0x19')]));require(_0x6de5('0x1d'))[_0x6de5('0x1e')](socket);var jayson=require(_0x6de5('0x1f'));var client=jayson[_0x6de5('0x20')][_0x6de5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4218a0,_0x4d476f,_0x4b5e50,_0x2373a2){return new BPromise(function(_0x403803,_0x2a7f02){var _0x585088=_0x2373a2||client;return _0x585088['request'](_0x4218a0,_0x4b5e50)[_0x6de5('0x22')](function(_0x11092b){logger[_0x6de5('0x23')]('ChatQueue,\x20%s,\x20%s',_0x4d476f,_0x6de5('0x24'));logger[_0x6de5('0x25')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4d476f,_0x6de5('0x24'),JSON['stringify'](_0x11092b));if(_0x11092b[_0x6de5('0x26')]){if(_0x11092b[_0x6de5('0x26')]['code']===0x1f4){logger[_0x6de5('0x26')]('ChatQueue,\x20%s,\x20%s',_0x4d476f,_0x11092b['error']['message']);return _0x2a7f02(_0x11092b[_0x6de5('0x26')][_0x6de5('0x27')]);}logger[_0x6de5('0x26')](_0x6de5('0x28'),_0x4d476f,_0x11092b[_0x6de5('0x26')]['message']);return _0x403803(_0x11092b[_0x6de5('0x26')][_0x6de5('0x27')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x4d476f,_0x6de5('0x24'));_0x403803(_0x11092b['result'][_0x6de5('0x27')]);}})[_0x6de5('0x29')](function(_0x3c0621){logger[_0x6de5('0x26')](_0x6de5('0x28'),_0x4d476f,_0x3c0621);_0x2a7f02(_0x3c0621);});});}function respondWithStatusCode(_0x3fede5,_0x2e8c46){_0x2e8c46=_0x2e8c46||0xcc;return function(_0x460561){if(_0x460561){return _0x3fede5[_0x6de5('0x2a')](_0x2e8c46);}return _0x3fede5[_0x6de5('0x2b')](_0x2e8c46)[_0x6de5('0x2c')]();};}function respondWithResult(_0x48decc,_0x5119f2){_0x5119f2=_0x5119f2||0xc8;return function(_0x2f877e){if(_0x2f877e){return _0x48decc[_0x6de5('0x2b')](_0x5119f2)['json'](_0x2f877e);}};}function respondWithFilteredResult(_0x585bc2,_0x1f121d){return function(_0x46dad9){if(_0x46dad9){var _0x41a6bd=typeof _0x1f121d[_0x6de5('0x2d')]===_0x6de5('0x2e')&&typeof _0x1f121d[_0x6de5('0x2f')]===_0x6de5('0x2e');var _0x1edef6=_0x46dad9['count'];var _0x50f59a=_0x41a6bd?0x0:_0x1f121d[_0x6de5('0x2d')];var _0x4fa2c4=_0x41a6bd?_0x46dad9[_0x6de5('0x30')]:_0x1f121d[_0x6de5('0x2d')]+_0x1f121d['limit'];var _0x99bf0f;if(_0x4fa2c4>=_0x1edef6){_0x4fa2c4=_0x1edef6;_0x99bf0f=0xc8;}else{_0x99bf0f=0xce;}_0x585bc2['status'](_0x99bf0f);return _0x585bc2[_0x6de5('0x31')](_0x6de5('0x32'),_0x50f59a+'-'+_0x4fa2c4+'/'+_0x1edef6)['json'](_0x46dad9);}return null;};}function patchUpdates(_0x7e9e74){return function(_0x315304){try{jsonpatch['apply'](_0x315304,_0x7e9e74,!![]);}catch(_0x1f8611){return BPromise[_0x6de5('0x33')](_0x1f8611);}return _0x315304[_0x6de5('0x34')]();};}function saveUpdates(_0x4fa130,_0x1e05bb){return function(_0x1ef921){if(_0x1ef921){return _0x1ef921[_0x6de5('0x35')](_0x4fa130)[_0x6de5('0x22')](function(_0x2e16f6){return _0x2e16f6;});}return null;};}function removeEntity(_0x53504a,_0x32c29b){return function(_0x9e84bc){if(_0x9e84bc){return _0x9e84bc['destroy']()[_0x6de5('0x22')](function(){var _0x715b2d=_0x9e84bc[_0x6de5('0x36')]({'plain':!![]});var _0xf4b971='ChatQueues';return db[_0x6de5('0x37')][_0x6de5('0x38')]({'where':{'type':_0xf4b971,'resourceId':_0x715b2d['id']}})['then'](function(){return _0x9e84bc;});})[_0x6de5('0x22')](function(){_0x53504a[_0x6de5('0x2b')](0xcc)[_0x6de5('0x2c')]();});}};}function handleEntityNotFound(_0x3eec3c,_0x387c1d){return function(_0x2e2506){if(!_0x2e2506){_0x3eec3c['sendStatus'](0x194);}return _0x2e2506;};}function handleError(_0x7e94d4,_0x152f6e){_0x152f6e=_0x152f6e||0x1f4;return function(_0x102409){logger['error'](_0x102409[_0x6de5('0x39')]);if(_0x102409[_0x6de5('0x3a')]){delete _0x102409['name'];}_0x7e94d4[_0x6de5('0x2b')](_0x152f6e)[_0x6de5('0x3b')](_0x102409);};}exports[_0x6de5('0x3c')]=function(_0xa7cc35,_0x5d8175){var _0x1fa8ac={},_0x232c77={},_0x20102c={'count':0x0,'rows':[]};var _0x46aed5=_[_0x6de5('0x3d')](db[_0x6de5('0x3e')][_0x6de5('0x3f')],function(_0x1d2a37){return{'name':_0x1d2a37[_0x6de5('0x40')],'type':_0x1d2a37['type'][_0x6de5('0x41')]};});_0x232c77[_0x6de5('0x42')]=_[_0x6de5('0x3d')](_0x46aed5,_0x6de5('0x3a'));_0x232c77[_0x6de5('0x43')]=_[_0x6de5('0x44')](_0xa7cc35[_0x6de5('0x43')]);_0x232c77[_0x6de5('0x45')]=_[_0x6de5('0x46')](_0x232c77['model'],_0x232c77['query']);_0x1fa8ac['attributes']=_['intersection'](_0x232c77[_0x6de5('0x42')],qs[_0x6de5('0x47')](_0xa7cc35['query'][_0x6de5('0x47')]));_0x1fa8ac[_0x6de5('0x48')]=_0x1fa8ac[_0x6de5('0x48')][_0x6de5('0x49')]?_0x1fa8ac[_0x6de5('0x48')]:_0x232c77[_0x6de5('0x42')];if(!_0xa7cc35[_0x6de5('0x43')][_0x6de5('0x4a')](_0x6de5('0x4b'))){_0x1fa8ac[_0x6de5('0x2f')]=qs['limit'](_0xa7cc35[_0x6de5('0x43')]['limit']);_0x1fa8ac[_0x6de5('0x2d')]=qs[_0x6de5('0x2d')](_0xa7cc35[_0x6de5('0x43')][_0x6de5('0x2d')]);}_0x1fa8ac['order']=qs[_0x6de5('0x4c')](_0xa7cc35[_0x6de5('0x43')]['sort']);_0x1fa8ac['where']=qs[_0x6de5('0x45')](_[_0x6de5('0x4d')](_0xa7cc35[_0x6de5('0x43')],_0x232c77[_0x6de5('0x45')]),_0x46aed5);if(_0xa7cc35[_0x6de5('0x43')][_0x6de5('0x4e')]){_0x1fa8ac[_0x6de5('0x4f')]=_[_0x6de5('0x50')](_0x1fa8ac[_0x6de5('0x4f')],{'$or':_[_0x6de5('0x3d')](_0x46aed5,function(_0x3aae84){if(_0x3aae84[_0x6de5('0x51')]!==_0x6de5('0x52')){var _0x2a56b7={};_0x2a56b7[_0x3aae84[_0x6de5('0x3a')]]={'$like':'%'+_0xa7cc35[_0x6de5('0x43')][_0x6de5('0x4e')]+'%'};return _0x2a56b7;}})});}_0x1fa8ac=_['merge']({},_0x1fa8ac,_0xa7cc35[_0x6de5('0x53')]);var _0xa9add6={'where':_0x1fa8ac['where']};return db['ChatQueue'][_0x6de5('0x30')](_0xa9add6)['then'](function(_0x6b2748){_0x20102c['count']=_0x6b2748;if(_0xa7cc35[_0x6de5('0x43')][_0x6de5('0x54')]){_0x1fa8ac[_0x6de5('0x55')]=[{'all':!![]}];}return db[_0x6de5('0x3e')]['findAll'](_0x1fa8ac);})['then'](function(_0x1af586){_0x20102c[_0x6de5('0x56')]=_0x1af586;return _0x20102c;})[_0x6de5('0x22')](respondWithFilteredResult(_0x5d8175,_0x1fa8ac))[_0x6de5('0x29')](handleError(_0x5d8175,null));};exports['show']=function(_0x59c244,_0x226781){var _0x3d7b50={'raw':!![],'where':{'id':_0x59c244[_0x6de5('0x57')]['id']}},_0x5c7d57={};_0x5c7d57[_0x6de5('0x42')]=_[_0x6de5('0x44')](db[_0x6de5('0x3e')][_0x6de5('0x3f')]);_0x5c7d57['query']=_[_0x6de5('0x44')](_0x59c244['query']);_0x5c7d57[_0x6de5('0x45')]=_[_0x6de5('0x46')](_0x5c7d57[_0x6de5('0x42')],_0x5c7d57[_0x6de5('0x43')]);_0x3d7b50[_0x6de5('0x48')]=_['intersection'](_0x5c7d57['model'],qs[_0x6de5('0x47')](_0x59c244[_0x6de5('0x43')][_0x6de5('0x47')]));_0x3d7b50[_0x6de5('0x48')]=_0x3d7b50[_0x6de5('0x48')][_0x6de5('0x49')]?_0x3d7b50[_0x6de5('0x48')]:_0x5c7d57[_0x6de5('0x42')];if(_0x59c244[_0x6de5('0x43')][_0x6de5('0x54')]){_0x3d7b50['include']=[{'all':!![]}];}_0x3d7b50=_[_0x6de5('0x50')]({},_0x3d7b50,_0x59c244[_0x6de5('0x53')]);return db[_0x6de5('0x3e')][_0x6de5('0x58')](_0x3d7b50)[_0x6de5('0x22')](handleEntityNotFound(_0x226781,null))[_0x6de5('0x22')](respondWithResult(_0x226781,null))[_0x6de5('0x29')](handleError(_0x226781,null));};exports[_0x6de5('0x59')]=function(_0x19c6d3,_0x1439ac){return db[_0x6de5('0x3e')][_0x6de5('0x59')](_0x19c6d3[_0x6de5('0x5a')],{})['then'](function(_0x570c28){var _0x16cb51=_0x19c6d3[_0x6de5('0x5b')][_0x6de5('0x36')]({'plain':!![]});if(!_0x16cb51)throw new Error(_0x6de5('0x5c'));if(_0x16cb51[_0x6de5('0x5d')]===_0x6de5('0x5b')){var _0x427314=_0x570c28[_0x6de5('0x36')]({'plain':!![]});var _0xa55cfd='ChatQueues';return db[_0x6de5('0x5e')][_0x6de5('0x58')]({'where':{'name':_0xa55cfd,'userProfileId':_0x16cb51['userProfileId']},'raw':!![]})[_0x6de5('0x22')](function(_0x4f1e62){if(_0x4f1e62&&_0x4f1e62[_0x6de5('0x5f')]===0x0){return db[_0x6de5('0x37')]['create']({'name':_0x427314[_0x6de5('0x3a')],'resourceId':_0x427314['id'],'type':_0x4f1e62[_0x6de5('0x3a')],'sectionId':_0x4f1e62['id']},{})[_0x6de5('0x22')](function(){return _0x570c28;});}else{return _0x570c28;}})[_0x6de5('0x29')](function(_0x16bbde){logger[_0x6de5('0x26')](_0x6de5('0x60'),_0x16bbde);throw _0x16bbde;});}return _0x570c28;})[_0x6de5('0x22')](respondWithResult(_0x1439ac,0xc9))[_0x6de5('0x29')](handleError(_0x1439ac,null));};exports['update']=function(_0x3e3236,_0x42a7aa){if(_0x3e3236[_0x6de5('0x5a')]['id']){delete _0x3e3236[_0x6de5('0x5a')]['id'];}return db[_0x6de5('0x3e')][_0x6de5('0x58')]({'where':{'id':_0x3e3236[_0x6de5('0x57')]['id']}})[_0x6de5('0x22')](handleEntityNotFound(_0x42a7aa,null))[_0x6de5('0x22')](saveUpdates(_0x3e3236['body'],null))[_0x6de5('0x22')](respondWithResult(_0x42a7aa,null))[_0x6de5('0x29')](handleError(_0x42a7aa,null));};exports[_0x6de5('0x38')]=function(_0x301473,_0x5b47a8){return db[_0x6de5('0x3e')][_0x6de5('0x58')]({'where':{'id':_0x301473['params']['id']}})[_0x6de5('0x22')](handleEntityNotFound(_0x5b47a8,null))[_0x6de5('0x22')](removeEntity(_0x5b47a8,null))[_0x6de5('0x29')](handleError(_0x5b47a8,null));};exports[_0x6de5('0x61')]=function(_0x89b1d6,_0x1e1e87){return db[_0x6de5('0x3e')][_0x6de5('0x61')]()['then'](respondWithResult(_0x1e1e87,null))[_0x6de5('0x29')](handleError(_0x1e1e87,null));};exports[_0x6de5('0x62')]=function(_0x49fa26,_0x2922e7,_0x5b5db1){var _0x1408e5={'raw':!![],'where':{}},_0x4ab0ba={},_0x3e7320;return db[_0x6de5('0x3e')][_0x6de5('0x63')]({'where':{'id':_0x49fa26['params']['id']}})['then'](handleEntityNotFound(_0x2922e7,null))[_0x6de5('0x22')](function(_0xae79e){if(_0xae79e){_0x3e7320=_0xae79e[_0x6de5('0x36')]({'plain':!![]});_0x4ab0ba[_0x6de5('0x42')]=_[_0x6de5('0x44')](db[_0x6de5('0x64')][_0x6de5('0x3f')]);_0x4ab0ba['query']=_['keys'](_0x49fa26[_0x6de5('0x43')]);_0x4ab0ba[_0x6de5('0x45')]=_[_0x6de5('0x46')](_0x4ab0ba[_0x6de5('0x42')],_0x4ab0ba[_0x6de5('0x43')]);_0x1408e5['attributes']=_[_0x6de5('0x46')](_0x4ab0ba[_0x6de5('0x42')],qs[_0x6de5('0x47')](_0x49fa26[_0x6de5('0x43')][_0x6de5('0x47')]));_0x1408e5[_0x6de5('0x48')]=_0x1408e5[_0x6de5('0x48')][_0x6de5('0x49')]?_0x1408e5['attributes']:_0x4ab0ba[_0x6de5('0x42')];if(!_0x49fa26['query'][_0x6de5('0x4a')](_0x6de5('0x4b'))){_0x1408e5[_0x6de5('0x2f')]=qs['limit'](_0x49fa26[_0x6de5('0x43')][_0x6de5('0x2f')]);_0x1408e5['offset']=qs[_0x6de5('0x2d')](_0x49fa26[_0x6de5('0x43')][_0x6de5('0x2d')]);}_0x1408e5[_0x6de5('0x65')]=qs[_0x6de5('0x4c')](_0x49fa26['query'][_0x6de5('0x4c')]);_0x1408e5[_0x6de5('0x4f')]=qs[_0x6de5('0x45')](_[_0x6de5('0x4d')](_0x49fa26['query'],_0x4ab0ba['filters']));_0x1408e5[_0x6de5('0x4f')][_0x6de5('0x66')]=_0xae79e['id'];if(_0x49fa26[_0x6de5('0x43')][_0x6de5('0x4e')]){_0x1408e5[_0x6de5('0x4f')]=_['merge'](_0x1408e5[_0x6de5('0x4f')],{'$or':_[_0x6de5('0x3d')](_0x1408e5[_0x6de5('0x48')],function(_0x44aff7){var _0x4fb860={};_0x4fb860[_0x44aff7]={'$like':'%'+_0x49fa26[_0x6de5('0x43')][_0x6de5('0x4e')]+'%'};return _0x4fb860;})});}_0x1408e5=_[_0x6de5('0x50')]({},_0x1408e5,_0x49fa26[_0x6de5('0x53')]);return db[_0x6de5('0x64')][_0x6de5('0x67')](_0x1408e5);}})[_0x6de5('0x22')](function(_0x224f1c){if(_0x224f1c){return db[_0x6de5('0x68')][_0x6de5('0x69')]({'where':{'id':_[_0x6de5('0x3d')](_0x224f1c,_0x6de5('0x6a')),'role':_0x6de5('0x6b')},'attributes':['id',_0x6de5('0x3a'),'chatPause','updatedAt',_0x6de5('0x6c')]});}})[_0x6de5('0x22')](function(_0x487b06){if(_0x487b06){return{'count':_0x487b06['count'],'rows':_['map'](_0x487b06[_0x6de5('0x56')],function(_0x2521c5){return{'membername':_0x2521c5[_0x6de5('0x3a')],'UserId':_0x2521c5['id'],'queue_name':_0x3e7320[_0x6de5('0x3a')],'ChatQueueId':_0x3e7320['id'],'interface':util['format'](_0x6de5('0x6d'),'SIP',_0x2521c5[_0x6de5('0x3a')]),'penalty':0x0,'paused':_0x2521c5[_0x6de5('0x6e')],'createdAt':_0x2521c5['createdAt'],'updatedAt':_0x2521c5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6de5('0x22')](respondWithFilteredResult(_0x2922e7,_0x1408e5))[_0x6de5('0x29')](handleError(_0x2922e7,null));};exports['getTeams']=function(_0x55a887,_0x5102db,_0x45258c){var _0x3c1938={};var _0x54f82d={};var _0x189426;var _0x3ee296;return db[_0x6de5('0x3e')][_0x6de5('0x63')]({'where':{'id':_0x55a887[_0x6de5('0x57')]['id']}})[_0x6de5('0x22')](handleEntityNotFound(_0x5102db,null))['then'](function(_0x1456ca){if(_0x1456ca){_0x189426=_0x1456ca;_0x54f82d[_0x6de5('0x42')]=_[_0x6de5('0x44')](db[_0x6de5('0x6f')][_0x6de5('0x3f')]);_0x54f82d[_0x6de5('0x43')]=_['keys'](_0x55a887[_0x6de5('0x43')]);_0x54f82d['filters']=_[_0x6de5('0x46')](_0x54f82d[_0x6de5('0x42')],_0x54f82d['query']);_0x3c1938[_0x6de5('0x48')]=_[_0x6de5('0x46')](_0x54f82d[_0x6de5('0x42')],qs[_0x6de5('0x47')](_0x55a887[_0x6de5('0x43')][_0x6de5('0x47')]));_0x3c1938[_0x6de5('0x48')]=_0x3c1938[_0x6de5('0x48')][_0x6de5('0x49')]?_0x3c1938['attributes']:_0x54f82d['model'];_0x3c1938['order']=qs[_0x6de5('0x4c')](_0x55a887[_0x6de5('0x43')][_0x6de5('0x4c')]);_0x3c1938[_0x6de5('0x4f')]=qs[_0x6de5('0x45')](_[_0x6de5('0x4d')](_0x55a887[_0x6de5('0x43')],_0x54f82d['filters']));if(_0x55a887[_0x6de5('0x43')]['filter']){_0x3c1938[_0x6de5('0x4f')]=_[_0x6de5('0x50')](_0x3c1938[_0x6de5('0x4f')],{'$or':_['map'](_0x3c1938[_0x6de5('0x48')],function(_0x5eff52){var _0x104d98={};_0x104d98[_0x5eff52]={'$like':'%'+_0x55a887[_0x6de5('0x43')][_0x6de5('0x4e')]+'%'};return _0x104d98;})});}_0x3c1938=_['merge']({},_0x3c1938,_0x55a887[_0x6de5('0x53')]);return _0x189426[_0x6de5('0x70')](_0x3c1938);}})[_0x6de5('0x22')](function(_0x10fb43){if(_0x10fb43){_0x3ee296=_0x10fb43[_0x6de5('0x49')];if(!_0x55a887[_0x6de5('0x43')][_0x6de5('0x4a')](_0x6de5('0x4b'))){_0x3c1938[_0x6de5('0x2f')]=qs[_0x6de5('0x2f')](_0x55a887[_0x6de5('0x43')][_0x6de5('0x2f')]);_0x3c1938[_0x6de5('0x2d')]=qs[_0x6de5('0x2d')](_0x55a887[_0x6de5('0x43')][_0x6de5('0x2d')]);}return _0x189426[_0x6de5('0x70')](_0x3c1938);}})[_0x6de5('0x22')](function(_0x350218){if(_0x350218){return _0x350218?{'count':_0x3ee296,'rows':_0x350218}:null;}})[_0x6de5('0x22')](respondWithResult(_0x5102db,null))[_0x6de5('0x29')](handleError(_0x5102db,null));};exports[_0x6de5('0x71')]=function(_0x10ddc2,_0x1b3067,_0x19f4de){var _0x132354=_0x10ddc2[_0x6de5('0x5a')][_0x6de5('0x72')];return db['Team'][_0x6de5('0x67')]({'where':{'id':_0x132354},'attributes':['id'],'include':[{'model':db[_0x6de5('0x68')],'as':'Agents','attributes':['id',_0x6de5('0x3a'),_0x6de5('0x73'),'voicePause',_0x6de5('0x74')],'raw':!![]}]})[_0x6de5('0x22')](function(_0x4b50bc){if(_0x4b50bc){var _0x55a615=_[_0x6de5('0x75')](_0x4b50bc,function(_0x2decc9){var _0x5764b0=_0x2decc9[_0x6de5('0x36')]({'plain':!![]});return _0x5764b0['Agents'];});return db[_0x6de5('0x3e')][_0x6de5('0x58')]({'where':{'id':_0x10ddc2[_0x6de5('0x57')]['id']}})[_0x6de5('0x22')](function(_0x141e0a){return db[_0x6de5('0x76')][_0x6de5('0x77')](function(_0x30b290){return _0x141e0a['addTeams'](_0x132354,{'transaction':_0x30b290})['then'](function(){return BPromise['each'](_0x55a615,function(_0x491aee){return db[_0x6de5('0x64')]['findOrCreate']({'where':{'UserId':_0x491aee['id'],'ChatQueueId':_0x10ddc2[_0x6de5('0x57')]['id']},'transaction':_0x30b290});});})[_0x6de5('0x22')](function(){_0x55a615[_0x6de5('0x78')](function(_0x4ef8f7){socket[_0x6de5('0x79')]('userChatQueue:save',{'UserId':_0x4ef8f7['id'],'ChatQueueId':_0x141e0a['id']});});});});});}})[_0x6de5('0x22')](respondWithStatusCode(_0x1b3067,null))[_0x6de5('0x29')](handleError(_0x1b3067,null));};exports['removeTeams']=function(_0x460fa7,_0x4afb9c,_0xb4186a){return db['Team']['findAll']({'where':{'id':_0x460fa7[_0x6de5('0x43')][_0x6de5('0x72')]},'attributes':['id'],'include':[{'model':db[_0x6de5('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4afb9c,null))['then'](function(_0x1b19d3){var _0x4fb1e7=_[_0x6de5('0x3d')](_0x1b19d3,'id');var _0x40e836=[];var _0x536e06=[];var _0x7fb98e=squel[_0x6de5('0x7a')]();_0x7fb98e[_0x6de5('0x7b')](_0x6de5('0x7c'))['from'](_0x6de5('0x7d'),'tq')['join'](_0x6de5('0x7e'),'ut',_0x6de5('0x7f'))[_0x6de5('0x4f')](_0x6de5('0x80'),_0x460fa7[_0x6de5('0x57')]['id']);for(var _0x33de64=0x0;_0x33de64<_0x1b19d3['length'];_0x33de64+=0x1){let _0x1ec346=_0x1b19d3[_0x33de64];for(var _0x26970e=0x0;_0x26970e<_0x1ec346['Agents'][_0x6de5('0x49')];_0x26970e+=0x1){let _0x41191a=_0x1ec346[_0x6de5('0x81')][_0x26970e];var _0x455c50=_0x7fb98e[_0x6de5('0x82')]();_0x455c50[_0x6de5('0x4f')](_0x6de5('0x83'),_0x41191a['id']);_0x536e06[_0x6de5('0x84')](db[_0x6de5('0x76')][_0x6de5('0x43')](_0x455c50[_0x6de5('0x85')](),{'type':db[_0x6de5('0x76')][_0x6de5('0x86')][_0x6de5('0x87')]})['then'](function(_0x30a08f){if(_0x30a08f[_0x6de5('0x49')]===0x1){return _0x41191a['id'];}else{var _0x3f92b6=_[_0x6de5('0x88')](_[_0x6de5('0x3d')](_0x30a08f,_0x6de5('0x89')),function(_0x2cc6d0){return _[_0x6de5('0x8a')](_0x4fb1e7,_0x2cc6d0);});if(_0x3f92b6){return _0x41191a['id'];}}}));}}return BPromise[_0x6de5('0x8b')](_0x536e06)[_0x6de5('0x22')](function(_0xb880e9){_0x40e836=_(_0x40e836)[_0x6de5('0x8c')](_0xb880e9)[_0x6de5('0x8d')]()[_0x6de5('0x8e')]();return db[_0x6de5('0x3e')][_0x6de5('0x58')]({'where':{'id':_0x460fa7[_0x6de5('0x57')]['id']}})['then'](function(_0x130a44){return db[_0x6de5('0x76')][_0x6de5('0x77')](function(_0x2a9d27){return _0x130a44[_0x6de5('0x8f')](_0x460fa7[_0x6de5('0x43')][_0x6de5('0x72')],{'transaction':_0x2a9d27})['then'](function(){if(!_[_0x6de5('0x90')](_0x40e836)){return _0x130a44[_0x6de5('0x91')](_0x40e836,{'transaction':_0x2a9d27});}})['then'](function(){_0x40e836[_0x6de5('0x78')](function(_0x21a519){socket['emit'](_0x6de5('0x92'),{'UserId':_0x21a519,'ChatQueueId':_0x130a44['id']});});});});});});})[_0x6de5('0x22')](respondWithStatusCode(_0x4afb9c,null))['catch'](handleError(_0x4afb9c,null));};exports[_0x6de5('0x93')]=function(_0x42cdae,_0x231736,_0x12eb89){return db[_0x6de5('0x3e')][_0x6de5('0x58')]({'where':{'id':_0x42cdae[_0x6de5('0x57')]['id']}})[_0x6de5('0x22')](handleEntityNotFound(_0x231736,null))['then'](function(_0xf48477){if(_0xf48477){return _0xf48477['addAgents'](_0x42cdae[_0x6de5('0x5a')][_0x6de5('0x72')],_[_0x6de5('0x94')](_0x42cdae[_0x6de5('0x5a')],[_0x6de5('0x72'),'id'])||{})[_0x6de5('0x95')](function(_0x2a80c3){for(var _0x477be6=0x0;_0x477be6<_0x42cdae[_0x6de5('0x5a')][_0x6de5('0x72')]['length'];_0x477be6+=0x1){socket[_0x6de5('0x79')](_0x6de5('0x96'),{'UserId':Number(_0x42cdae['body'][_0x6de5('0x72')][_0x477be6]),'ChatQueueId':Number(_0x42cdae[_0x6de5('0x57')]['id'])});}return _0x2a80c3;});}})[_0x6de5('0x22')](respondWithResult(_0x231736,null))[_0x6de5('0x29')](handleError(_0x231736,null));};exports[_0x6de5('0x91')]=function(_0x5b1b4e,_0x5f0904,_0xdac668){return db[_0x6de5('0x3e')][_0x6de5('0x58')]({'where':{'id':_0x5b1b4e['params']['id']}})[_0x6de5('0x22')](handleEntityNotFound(_0x5f0904,null))[_0x6de5('0x22')](function(_0x5349c3){if(_0x5349c3){return _0x5349c3[_0x6de5('0x91')](_0x5b1b4e['query'][_0x6de5('0x72')])[_0x6de5('0x22')](function(){if(_[_0x6de5('0x97')](_0x5b1b4e[_0x6de5('0x43')][_0x6de5('0x72')])){for(var _0x5cc764=0x0;_0x5cc764<_0x5b1b4e[_0x6de5('0x43')][_0x6de5('0x72')][_0x6de5('0x49')];_0x5cc764+=0x1){socket[_0x6de5('0x79')](_0x6de5('0x92'),{'UserId':Number(_0x5b1b4e[_0x6de5('0x43')]['ids'][_0x5cc764]),'ChatQueueId':Number(_0x5b1b4e[_0x6de5('0x57')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x5b1b4e[_0x6de5('0x43')][_0x6de5('0x72')]),'ChatQueueId':Number(_0x5b1b4e[_0x6de5('0x57')]['id'])});}});}})[_0x6de5('0x22')](respondWithStatusCode(_0x5f0904,null))[_0x6de5('0x29')](handleError(_0x5f0904,null));};exports['getAgents']=function(_0x5d658d,_0x13b16a,_0x3bda44){var _0x3a8a89={};var _0x374066={};var _0x551c01;var _0x122383;return db[_0x6de5('0x3e')]['findOne']({'where':{'id':_0x5d658d['params']['id']}})[_0x6de5('0x22')](handleEntityNotFound(_0x13b16a,null))[_0x6de5('0x22')](function(_0x53e436){if(_0x53e436){_0x551c01=_0x53e436;_0x374066[_0x6de5('0x42')]=_[_0x6de5('0x44')](db[_0x6de5('0x68')]['rawAttributes']);_0x374066[_0x6de5('0x43')]=_[_0x6de5('0x44')](_0x5d658d[_0x6de5('0x43')]);_0x374066[_0x6de5('0x45')]=_[_0x6de5('0x46')](_0x374066[_0x6de5('0x42')],_0x374066[_0x6de5('0x43')]);_0x3a8a89[_0x6de5('0x48')]=_[_0x6de5('0x46')](_0x374066[_0x6de5('0x42')],qs['fields'](_0x5d658d[_0x6de5('0x43')][_0x6de5('0x47')]));_0x3a8a89[_0x6de5('0x48')]=_0x3a8a89['attributes'][_0x6de5('0x49')]?_0x3a8a89[_0x6de5('0x48')]:_0x374066[_0x6de5('0x42')];_0x3a8a89[_0x6de5('0x65')]=qs[_0x6de5('0x4c')](_0x5d658d[_0x6de5('0x43')]['sort']);_0x3a8a89['where']=qs[_0x6de5('0x45')](_[_0x6de5('0x4d')](_0x5d658d['query'],_0x374066[_0x6de5('0x45')]));if(_0x5d658d['query'][_0x6de5('0x4e')]){_0x3a8a89[_0x6de5('0x4f')]=_[_0x6de5('0x50')](_0x3a8a89['where'],{'$or':_['map'](_0x3a8a89[_0x6de5('0x48')],function(_0x47212f){var _0x551d2a={};_0x551d2a[_0x47212f]={'$like':'%'+_0x5d658d['query'][_0x6de5('0x4e')]+'%'};return _0x551d2a;})});}_0x3a8a89=_['merge']({},_0x3a8a89,_0x5d658d[_0x6de5('0x53')]);return _0x551c01[_0x6de5('0x98')](_0x3a8a89);}})['then'](function(_0x374973){if(_0x374973){_0x122383=_0x374973['length'];if(!_0x5d658d[_0x6de5('0x43')]['hasOwnProperty']('nolimit')){_0x3a8a89[_0x6de5('0x2f')]=qs['limit'](_0x5d658d[_0x6de5('0x43')][_0x6de5('0x2f')]);_0x3a8a89[_0x6de5('0x2d')]=qs[_0x6de5('0x2d')](_0x5d658d[_0x6de5('0x43')][_0x6de5('0x2d')]);}return _0x551c01[_0x6de5('0x98')](_0x3a8a89);}})[_0x6de5('0x22')](function(_0x23c639){if(_0x23c639){return _0x23c639?{'count':_0x122383,'rows':_0x23c639}:null;}})[_0x6de5('0x22')](respondWithResult(_0x13b16a,null))[_0x6de5('0x29')](handleError(_0x13b16a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 454e092..508c2f3 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 _0xe94a=['emit','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xe94a,0x1b7));var _0xae94=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0xe94a[_0x1034bb];return _0x453fdb;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0xae94('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xae94('0x1')](0x0);var events={'afterCreate':_0xae94('0x2'),'afterUpdate':_0xae94('0x3'),'afterDestroy':_0xae94('0x4')};function emitEvent(_0x1f7eae){return function(_0x1912eb,_0x4dd52a,_0x44f40e){ChatQueueEvents[_0xae94('0x5')](_0x1f7eae+':'+_0x1912eb['id'],_0x1912eb);ChatQueueEvents[_0xae94('0x5')](_0x1f7eae,_0x1912eb);_0x44f40e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x81c3=['hook','exports','../../mysqldb','ChatQueue','save','update','emit','hasOwnProperty'];(function(_0x190730,_0x4ce4fe){var _0x271fbc=function(_0x4d8ac5){while(--_0x4d8ac5){_0x190730['push'](_0x190730['shift']());}};_0x271fbc(++_0x4ce4fe);}(_0x81c3,0xd2));var _0x381c=function(_0x289755,_0xa2a591){_0x289755=_0x289755-0x0;var _0x3b8130=_0x81c3[_0x289755];return _0x3b8130;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x381c('0x0'))['db'][_0x381c('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x381c('0x2'),'afterUpdate':_0x381c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x515774){return function(_0x1603d4,_0xd74826,_0x58939c){ChatQueueEvents[_0x381c('0x4')](_0x515774+':'+_0x1603d4['id'],_0x1603d4);ChatQueueEvents[_0x381c('0x4')](_0x515774,_0x1603d4);_0x58939c(null);};}for(var e in events){if(events[_0x381c('0x5')](e)){var event=events[e];ChatQueue[_0x381c('0x6')](e,emitEvent(event));}}module[_0x381c('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index c1df475..1d49bc0 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 _0x2999=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x54870e,_0x47161f){var _0x5199fa=function(_0x55ad3d){while(--_0x55ad3d){_0x54870e['push'](_0x54870e['shift']());}};_0x5199fa(++_0x47161f);}(_0x2999,0xf0));var _0x9299=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2999[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9299('0x0'));var util=require(_0x9299('0x1'));var logger=require(_0x9299('0x2'))(_0x9299('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9299('0x4'));var fs=require('fs');var path=require(_0x9299('0x5'));var rimraf=require(_0x9299('0x6'));var config=require(_0x9299('0x7'));var attributes=require(_0x9299('0x8'));module[_0x9299('0x9')]=function(_0x1e9ad7,_0x53883f){return _0x1e9ad7[_0x9299('0xa')](_0x9299('0xb'),attributes,{'tableName':_0x9299('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08ae=['define','ChatQueue','chat_queues','util','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x08ae,0x1bb));var _0xe08a=function(_0x479035,_0xe90aad){_0x479035=_0x479035-0x0;var _0x458b43=_0x08ae[_0x479035];return _0x458b43;};'use strict';var _=require('lodash');var util=require(_0xe08a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe08a('0x1'));var BPromise=require('bluebird');var rp=require(_0xe08a('0x2'));var fs=require('fs');var path=require(_0xe08a('0x3'));var rimraf=require(_0xe08a('0x4'));var config=require(_0xe08a('0x5'));var attributes=require(_0xe08a('0x6'));module[_0xe08a('0x7')]=function(_0x1eed33,_0x1bd0b3){return _0x1eed33[_0xe08a('0x8')](_0xe08a('0x9'),attributes,{'tableName':_0xe08a('0xa'),'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 25fffdc..7ae4e7f 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 _0x4eb5=['client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','ChatQueue','findAll','options','where','attributes','limit','include','model','map','GetChatQueue','stringify','ShowChatQueue','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2df832,_0x240a8c){var _0x575133=function(_0x3e8606){while(--_0x3e8606){_0x2df832['push'](_0x2df832['shift']());}};_0x575133(++_0x240a8c);}(_0x4eb5,0x19a));var _0x54eb=function(_0x596797,_0x5b344a){_0x596797=_0x596797-0x0;var _0x332f84=_0x4eb5[_0x596797];return _0x332f84;};'use strict';var _=require(_0x54eb('0x0'));var util=require(_0x54eb('0x1'));var moment=require('moment');var BPromise=require(_0x54eb('0x2'));var rs=require(_0x54eb('0x3'));var fs=require('fs');var Redis=require(_0x54eb('0x4'));var db=require(_0x54eb('0x5'))['db'];var utils=require(_0x54eb('0x6'));var logger=require(_0x54eb('0x7'))(_0x54eb('0x8'));var config=require('../../config/environment');var jayson=require(_0x54eb('0x9'));var client=jayson[_0x54eb('0xa')][_0x54eb('0xb')]({'port':0x232a});config[_0x54eb('0xc')]=_[_0x54eb('0xd')](config[_0x54eb('0xc')],{'host':_0x54eb('0xe'),'port':0x18eb});var socket=require(_0x54eb('0xf'))(new Redis(config[_0x54eb('0xc')]));require(_0x54eb('0x10'))[_0x54eb('0x11')](socket);function respondWithRpcPromise(_0x1e9096,_0x740549,_0x52032c){return new BPromise(function(_0xc81060,_0x3c7c86){return client[_0x54eb('0x12')](_0x1e9096,_0x52032c)[_0x54eb('0x13')](function(_0x57f672){logger[_0x54eb('0x14')](_0x54eb('0x15'),_0x740549,_0x54eb('0x16'));logger[_0x54eb('0x17')](_0x54eb('0x18'),_0x740549,_0x54eb('0x16'),JSON['stringify'](_0x57f672));if(_0x57f672[_0x54eb('0x19')]){if(_0x57f672[_0x54eb('0x19')][_0x54eb('0x1a')]===0x1f4){logger[_0x54eb('0x19')](_0x54eb('0x15'),_0x740549,_0x57f672['error'][_0x54eb('0x1b')]);return _0x3c7c86(_0x57f672[_0x54eb('0x19')]['message']);}logger['error'](_0x54eb('0x15'),_0x740549,_0x57f672[_0x54eb('0x19')]['message']);return _0xc81060(_0x57f672[_0x54eb('0x19')]['message']);}else{logger[_0x54eb('0x14')](_0x54eb('0x15'),_0x740549,_0x54eb('0x16'));_0xc81060(_0x57f672['result'][_0x54eb('0x1b')]);}})[_0x54eb('0x1c')](function(_0x2a0d40){logger[_0x54eb('0x19')]('ChatQueue,\x20%s,\x20%s',_0x740549,_0x2a0d40);_0x3c7c86(_0x2a0d40);});});}exports['GetChatQueue']=function(_0x37f685){var _0x5b07c0=this;return new Promise(function(_0x49a7bf,_0x484b91){return db[_0x54eb('0x1d')][_0x54eb('0x1e')]({'raw':_0x37f685[_0x54eb('0x1f')]?_0x37f685['options']['raw']===undefined?!![]:![]:!![],'where':_0x37f685['options']?_0x37f685[_0x54eb('0x1f')][_0x54eb('0x20')]||null:null,'attributes':_0x37f685[_0x54eb('0x1f')]?_0x37f685[_0x54eb('0x1f')][_0x54eb('0x21')]||null:null,'limit':_0x37f685[_0x54eb('0x1f')]?_0x37f685[_0x54eb('0x1f')][_0x54eb('0x22')]||null:null,'include':_0x37f685[_0x54eb('0x1f')]?_0x37f685[_0x54eb('0x1f')][_0x54eb('0x23')]?_['map'](_0x37f685[_0x54eb('0x1f')]['include'],function(_0x319252){return{'model':db[_0x319252[_0x54eb('0x24')]],'as':_0x319252['as'],'attributes':_0x319252[_0x54eb('0x21')],'include':_0x319252[_0x54eb('0x23')]?_[_0x54eb('0x25')](_0x319252['include'],function(_0x5c0955){return{'model':db[_0x5c0955[_0x54eb('0x24')]],'as':_0x5c0955['as'],'attributes':_0x5c0955[_0x54eb('0x21')],'include':_0x5c0955[_0x54eb('0x23')]?_[_0x54eb('0x25')](_0x5c0955[_0x54eb('0x23')],function(_0x1e934d){return{'model':db[_0x1e934d['model']],'as':_0x1e934d['as'],'attributes':_0x1e934d[_0x54eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x54eb('0x13')](function(_0x39fd1e){logger[_0x54eb('0x14')](_0x54eb('0x26'),_0x37f685);logger[_0x54eb('0x17')](_0x54eb('0x26'),_0x37f685,JSON[_0x54eb('0x27')](_0x39fd1e));_0x49a7bf(_0x39fd1e);})['catch'](function(_0xf041e8){logger[_0x54eb('0x19')](_0x54eb('0x26'),_0xf041e8[_0x54eb('0x1b')],_0x37f685);_0x484b91(_0x5b07c0['error'](0x1f4,_0xf041e8[_0x54eb('0x1b')]));});});};exports[_0x54eb('0x28')]=function(_0x35256d){var _0x5f5a67=this;return new Promise(function(_0x498586,_0x1032b9){return db[_0x54eb('0x1d')]['find']({'raw':_0x35256d['options']?_0x35256d[_0x54eb('0x1f')][_0x54eb('0x29')]===undefined?!![]:![]:!![],'where':_0x35256d['options']?_0x35256d[_0x54eb('0x1f')][_0x54eb('0x20')]||null:null,'attributes':_0x35256d[_0x54eb('0x1f')]?_0x35256d[_0x54eb('0x1f')][_0x54eb('0x21')]||null:null,'include':_0x35256d[_0x54eb('0x1f')]?_0x35256d[_0x54eb('0x1f')][_0x54eb('0x23')]?_['map'](_0x35256d[_0x54eb('0x1f')]['include'],function(_0x591c24){return{'model':db[_0x591c24['model']],'as':_0x591c24['as'],'attributes':_0x591c24[_0x54eb('0x21')],'include':_0x591c24[_0x54eb('0x23')]?_['map'](_0x591c24[_0x54eb('0x23')],function(_0x19b9f6){return{'model':db[_0x19b9f6[_0x54eb('0x24')]],'as':_0x19b9f6['as'],'attributes':_0x19b9f6[_0x54eb('0x21')],'include':_0x19b9f6[_0x54eb('0x23')]?_[_0x54eb('0x25')](_0x19b9f6['include'],function(_0x210430){return{'model':db[_0x210430[_0x54eb('0x24')]],'as':_0x210430['as'],'attributes':_0x210430[_0x54eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x54eb('0x13')](function(_0x446530){logger[_0x54eb('0x14')]('ShowChatQueue',_0x35256d);logger[_0x54eb('0x17')]('ShowChatQueue',_0x35256d,JSON[_0x54eb('0x27')](_0x446530));_0x498586(_0x446530);})['catch'](function(_0x1ef17f){logger['error'](_0x54eb('0x28'),_0x1ef17f[_0x54eb('0x1b')],_0x35256d);_0x1032b9(_0x5f5a67[_0x54eb('0x19')](0x1f4,_0x1ef17f[_0x54eb('0x1b')]));});});}; \ No newline at end of file +var _0xcabe=['ShowChatQueue','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','map','model'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xcabe,0x1ef));var _0xecab=function(_0x27e5a1,_0x23309a){_0x27e5a1=_0x27e5a1-0x0;var _0x765786=_0xcabe[_0x27e5a1];return _0x765786;};'use strict';var _=require(_0xecab('0x0'));var util=require('util');var moment=require(_0xecab('0x1'));var BPromise=require(_0xecab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecab('0x3'));var db=require(_0xecab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xecab('0x5'))(_0xecab('0x6'));var config=require(_0xecab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xecab('0x8')][_0xecab('0x9')]({'port':0x232a});config[_0xecab('0xa')]=_[_0xecab('0xb')](config[_0xecab('0xa')],{'host':_0xecab('0xc'),'port':0x18eb});var socket=require(_0xecab('0xd'))(new Redis(config[_0xecab('0xa')]));require(_0xecab('0xe'))['register'](socket);function respondWithRpcPromise(_0x4b1d26,_0x270fdd,_0x2550e9){return new BPromise(function(_0x52f26a,_0x445617){return client[_0xecab('0xf')](_0x4b1d26,_0x2550e9)[_0xecab('0x10')](function(_0xb7d084){logger[_0xecab('0x11')](_0xecab('0x12'),_0x270fdd,'request\x20sent');logger[_0xecab('0x13')](_0xecab('0x14'),_0x270fdd,_0xecab('0x15'),JSON[_0xecab('0x16')](_0xb7d084));if(_0xb7d084[_0xecab('0x17')]){if(_0xb7d084[_0xecab('0x17')]['code']===0x1f4){logger[_0xecab('0x17')]('ChatQueue,\x20%s,\x20%s',_0x270fdd,_0xb7d084['error'][_0xecab('0x18')]);return _0x445617(_0xb7d084[_0xecab('0x17')][_0xecab('0x18')]);}logger[_0xecab('0x17')]('ChatQueue,\x20%s,\x20%s',_0x270fdd,_0xb7d084[_0xecab('0x17')][_0xecab('0x18')]);return _0x52f26a(_0xb7d084[_0xecab('0x17')][_0xecab('0x18')]);}else{logger[_0xecab('0x11')]('ChatQueue,\x20%s,\x20%s',_0x270fdd,_0xecab('0x15'));_0x52f26a(_0xb7d084[_0xecab('0x19')]['message']);}})[_0xecab('0x1a')](function(_0x3bd6c0){logger[_0xecab('0x17')](_0xecab('0x12'),_0x270fdd,_0x3bd6c0);_0x445617(_0x3bd6c0);});});}exports[_0xecab('0x1b')]=function(_0xbafd2){var _0x4a450c=this;return new Promise(function(_0x1cfa2f,_0x2ec6fb){return db[_0xecab('0x1c')]['findAll']({'raw':_0xbafd2[_0xecab('0x1d')]?_0xbafd2['options'][_0xecab('0x1e')]===undefined?!![]:![]:!![],'where':_0xbafd2['options']?_0xbafd2[_0xecab('0x1d')][_0xecab('0x1f')]||null:null,'attributes':_0xbafd2[_0xecab('0x1d')]?_0xbafd2[_0xecab('0x1d')][_0xecab('0x20')]||null:null,'limit':_0xbafd2[_0xecab('0x1d')]?_0xbafd2[_0xecab('0x1d')][_0xecab('0x21')]||null:null,'include':_0xbafd2[_0xecab('0x1d')]?_0xbafd2[_0xecab('0x1d')][_0xecab('0x22')]?_[_0xecab('0x23')](_0xbafd2['options'][_0xecab('0x22')],function(_0x4a6240){return{'model':db[_0x4a6240[_0xecab('0x24')]],'as':_0x4a6240['as'],'attributes':_0x4a6240[_0xecab('0x20')],'include':_0x4a6240['include']?_[_0xecab('0x23')](_0x4a6240['include'],function(_0x56c98e){return{'model':db[_0x56c98e[_0xecab('0x24')]],'as':_0x56c98e['as'],'attributes':_0x56c98e[_0xecab('0x20')],'include':_0x56c98e[_0xecab('0x22')]?_[_0xecab('0x23')](_0x56c98e[_0xecab('0x22')],function(_0x30ca35){return{'model':db[_0x30ca35[_0xecab('0x24')]],'as':_0x30ca35['as'],'attributes':_0x30ca35['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41df38){logger[_0xecab('0x11')](_0xecab('0x1b'),_0xbafd2);logger[_0xecab('0x13')](_0xecab('0x1b'),_0xbafd2,JSON[_0xecab('0x16')](_0x41df38));_0x1cfa2f(_0x41df38);})['catch'](function(_0x5501e9){logger[_0xecab('0x17')](_0xecab('0x1b'),_0x5501e9[_0xecab('0x18')],_0xbafd2);_0x2ec6fb(_0x4a450c[_0xecab('0x17')](0x1f4,_0x5501e9[_0xecab('0x18')]));});});};exports[_0xecab('0x25')]=function(_0x32955f){var _0x2a4661=this;return new Promise(function(_0x139a64,_0x4850b1){return db['ChatQueue']['find']({'raw':_0x32955f['options']?_0x32955f['options'][_0xecab('0x1e')]===undefined?!![]:![]:!![],'where':_0x32955f[_0xecab('0x1d')]?_0x32955f[_0xecab('0x1d')][_0xecab('0x1f')]||null:null,'attributes':_0x32955f[_0xecab('0x1d')]?_0x32955f[_0xecab('0x1d')][_0xecab('0x20')]||null:null,'include':_0x32955f[_0xecab('0x1d')]?_0x32955f[_0xecab('0x1d')][_0xecab('0x22')]?_['map'](_0x32955f[_0xecab('0x1d')]['include'],function(_0x543ea8){return{'model':db[_0x543ea8[_0xecab('0x24')]],'as':_0x543ea8['as'],'attributes':_0x543ea8['attributes'],'include':_0x543ea8[_0xecab('0x22')]?_[_0xecab('0x23')](_0x543ea8['include'],function(_0xafde3f){return{'model':db[_0xafde3f[_0xecab('0x24')]],'as':_0xafde3f['as'],'attributes':_0xafde3f[_0xecab('0x20')],'include':_0xafde3f[_0xecab('0x22')]?_['map'](_0xafde3f[_0xecab('0x22')],function(_0xf86a11){return{'model':db[_0xf86a11[_0xecab('0x24')]],'as':_0xf86a11['as'],'attributes':_0xf86a11['attributes']};}):[]};}):[]};}):[]:[]})[_0xecab('0x10')](function(_0xba2335){logger['info'](_0xecab('0x25'),_0x32955f);logger[_0xecab('0x13')](_0xecab('0x25'),_0x32955f,JSON['stringify'](_0xba2335));_0x139a64(_0xba2335);})['catch'](function(_0x58e0a8){logger[_0xecab('0x17')](_0xecab('0x25'),_0x58e0a8[_0xecab('0x18')],_0x32955f);_0x4850b1(_0x2a4661[_0xecab('0x17')](0x1f4,_0x58e0a8[_0xecab('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 4958dc9..42142fe 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 _0x0e85=['update','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x224a93,_0x5ef65b){var _0x27c59c=function(_0x434048){while(--_0x434048){_0x224a93['push'](_0x224a93['shift']());}};_0x27c59c(++_0x5ef65b);}(_0x0e85,0x7c));var _0x50e8=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x0e85[_0x4c445a];return _0x2f611c;};'use strict';var ChatQueueEvents=require(_0x50e8('0x0'));var events=[_0x50e8('0x1'),'remove',_0x50e8('0x2')];function createListener(_0x682d10,_0x55e515){return function(_0x55cba3){_0x55e515['emit'](_0x682d10,_0x55cba3);};}function removeListener(_0x236cf3,_0x4e90e7){return function(){ChatQueueEvents[_0x50e8('0x3')](_0x236cf3,_0x4e90e7);};}exports[_0x50e8('0x4')]=function(_0xe3151e){for(var _0xfde42=0x0,_0x5e8b01=events[_0x50e8('0x5')];_0xfde42<_0x5e8b01;_0xfde42++){var _0x108edc=events[_0xfde42];var _0x42665e=createListener(_0x50e8('0x6')+_0x108edc,_0xe3151e);ChatQueueEvents['on'](_0x108edc,_0x42665e);}}; \ No newline at end of file +var _0xcea2=['chatQueue:','./chatQueue.events','remove','removeListener','length'];(function(_0x74115b,_0x31f752){var _0x57ebbd=function(_0x234873){while(--_0x234873){_0x74115b['push'](_0x74115b['shift']());}};_0x57ebbd(++_0x31f752);}(_0xcea2,0x15a));var _0x2cea=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xcea2[_0x1a36a5];return _0x746243;};'use strict';var ChatQueueEvents=require(_0x2cea('0x0'));var events=['save',_0x2cea('0x1'),'update'];function createListener(_0x3e22c2,_0x7f1f5a){return function(_0x60a793){_0x7f1f5a['emit'](_0x3e22c2,_0x60a793);};}function removeListener(_0x3ff73f,_0x46060b){return function(){ChatQueueEvents[_0x2cea('0x2')](_0x3ff73f,_0x46060b);};}exports['register']=function(_0x34f0f2){for(var _0x485c26=0x0,_0x2d69ff=events[_0x2cea('0x3')];_0x485c26<_0x2d69ff;_0x485c26++){var _0x805a1b=events[_0x485c26];var _0x160cca=createListener(_0x2cea('0x4')+_0x805a1b,_0x34f0f2);ChatQueueEvents['on'](_0x805a1b,_0x160cca);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 4aca0cf..f325d63 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0x5fc3[_0xd8a8af];return _0x5b7278;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0x5fc3[_0x5c8827];return _0x50ffd5;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f90fbdf..281f6ab 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 _0x4751=['DATE','moment','exports','STRING'];(function(_0x5e7933,_0x5487dd){var _0x1b9865=function(_0x44e56b){while(--_0x44e56b){_0x5e7933['push'](_0x5e7933['shift']());}};_0x1b9865(++_0x5487dd);}(_0x4751,0x85));var _0x1475=function(_0x222780,_0xed24cd){_0x222780=_0x222780-0x0;var _0x1699cb=_0x4751[_0x222780];return _0x1699cb;};'use strict';var moment=require(_0x1475('0x0'));var Sequelize=require('sequelize');module[_0x1475('0x1')]={'uniqueid':{'type':Sequelize[_0x1475('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1475('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1475('0x3')]},'exitAt':{'type':Sequelize[_0x1475('0x3')]},'reason':{'type':Sequelize[_0x1475('0x2')]}}; \ No newline at end of file +var _0x845b=['moment','sequelize','exports','STRING','DATE'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x845b,0xaf));var _0xb845=function(_0x40e13e,_0x376d13){_0x40e13e=_0x40e13e-0x0;var _0x5db39e=_0x845b[_0x40e13e];return _0x5db39e;};'use strict';var moment=require(_0xb845('0x0'));var Sequelize=require(_0xb845('0x1'));module[_0xb845('0x2')]={'uniqueid':{'type':Sequelize[_0xb845('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb845('0x3')]},'joinAt':{'type':Sequelize[_0xb845('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb845('0x4')]},'exitAt':{'type':Sequelize[_0xb845('0x4')]},'reason':{'type':Sequelize[_0xb845('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6d1cb6f..587f219 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 _0x4672=['fieldName','key','filters','intersection','model','query','fields','length','attributes','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','then','findAll','catch','params','keys','includeAll','include','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','update','error','name','send','index','map','ChatQueueReport','rawAttributes'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0x4672,0x18a));var _0x2467=function(_0x523a8b,_0x5a7f8d){_0x523a8b=_0x523a8b-0x0;var _0x45c38c=_0x4672[_0x523a8b];return _0x45c38c;};'use strict';var emlformat=require(_0x2467('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2467('0x1'));var jsonpatch=require(_0x2467('0x2'));var rp=require('request-promise');var moment=require(_0x2467('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2467('0x4'));var util=require(_0x2467('0x5'));var path=require(_0x2467('0x6'));var sox=require(_0x2467('0x7'));var csv=require('to-csv');var ejs=require(_0x2467('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2467('0x9'));var squel=require(_0x2467('0xa'));var crypto=require(_0x2467('0xb'));var jsforce=require(_0x2467('0xc'));var deskjs=require(_0x2467('0xd'));var toCsv=require(_0x2467('0xe'));var querystring=require(_0x2467('0xf'));var Papa=require(_0x2467('0x10'));var Redis=require(_0x2467('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2467('0x12'));var as=require(_0x2467('0x13'));var hardwareService=require(_0x2467('0x14'));var logger=require(_0x2467('0x15'))('api');var utils=require(_0x2467('0x16'));var config=require(_0x2467('0x17'));var licenseUtil=require(_0x2467('0x18'));var db=require(_0x2467('0x19'))['db'];function respondWithStatusCode(_0x348f51,_0x381f99){_0x381f99=_0x381f99||0xcc;return function(_0x5ac925){if(_0x5ac925){return _0x348f51[_0x2467('0x1a')](_0x381f99);}return _0x348f51[_0x2467('0x1b')](_0x381f99)[_0x2467('0x1c')]();};}function respondWithResult(_0xa9966d,_0x37df20){_0x37df20=_0x37df20||0xc8;return function(_0x265d7e){if(_0x265d7e){return _0xa9966d[_0x2467('0x1b')](_0x37df20)['json'](_0x265d7e);}};}function respondWithFilteredResult(_0x520ad9,_0x4eab72){return function(_0x2cab68){if(_0x2cab68){var _0xe72566=typeof _0x4eab72[_0x2467('0x1d')]==='undefined'&&typeof _0x4eab72[_0x2467('0x1e')]===_0x2467('0x1f');var _0x4abd91=_0x2cab68[_0x2467('0x20')];var _0x350ead=_0xe72566?0x0:_0x4eab72[_0x2467('0x1d')];var _0x468fb4=_0xe72566?_0x2cab68[_0x2467('0x20')]:_0x4eab72[_0x2467('0x1d')]+_0x4eab72[_0x2467('0x1e')];var _0x5ecb91;if(_0x468fb4>=_0x4abd91){_0x468fb4=_0x4abd91;_0x5ecb91=0xc8;}else{_0x5ecb91=0xce;}_0x520ad9['status'](_0x5ecb91);return _0x520ad9[_0x2467('0x21')]('Content-Range',_0x350ead+'-'+_0x468fb4+'/'+_0x4abd91)[_0x2467('0x22')](_0x2cab68);}return null;};}function patchUpdates(_0xa16c1a){return function(_0x50e555){try{jsonpatch['apply'](_0x50e555,_0xa16c1a,!![]);}catch(_0x2d7061){return BPromise[_0x2467('0x23')](_0x2d7061);}return _0x50e555['save']();};}function saveUpdates(_0x1217e0,_0x1ed72b){return function(_0xb35e27){if(_0xb35e27){return _0xb35e27[_0x2467('0x24')](_0x1217e0)['then'](function(_0x2ebd45){return _0x2ebd45;});}return null;};}function removeEntity(_0x51831c,_0x5e5621){return function(_0x3f600e){if(_0x3f600e){return _0x3f600e['destroy']()['then'](function(){_0x51831c['status'](0xcc)[_0x2467('0x1c')]();});}};}function handleEntityNotFound(_0x20e798,_0x52ba60){return function(_0xb8f34f){if(!_0xb8f34f){_0x20e798[_0x2467('0x1a')](0x194);}return _0xb8f34f;};}function handleError(_0x2cd7a6,_0x3224c2){_0x3224c2=_0x3224c2||0x1f4;return function(_0x18f045){logger[_0x2467('0x25')](_0x18f045['stack']);if(_0x18f045[_0x2467('0x26')]){delete _0x18f045[_0x2467('0x26')];}_0x2cd7a6[_0x2467('0x1b')](_0x3224c2)[_0x2467('0x27')](_0x18f045);};}exports[_0x2467('0x28')]=function(_0x327954,_0x201c31){var _0x42bc8e={},_0x4da106={},_0xa793b2={'count':0x0,'rows':[]};var _0x1de49c=_[_0x2467('0x29')](db[_0x2467('0x2a')][_0x2467('0x2b')],function(_0x36c94d){return{'name':_0x36c94d[_0x2467('0x2c')],'type':_0x36c94d['type'][_0x2467('0x2d')]};});_0x4da106['model']=_['map'](_0x1de49c,_0x2467('0x26'));_0x4da106['query']=_['keys'](_0x327954['query']);_0x4da106[_0x2467('0x2e')]=_[_0x2467('0x2f')](_0x4da106[_0x2467('0x30')],_0x4da106[_0x2467('0x31')]);_0x42bc8e['attributes']=_[_0x2467('0x2f')](_0x4da106[_0x2467('0x30')],qs[_0x2467('0x32')](_0x327954['query'][_0x2467('0x32')]));_0x42bc8e['attributes']=_0x42bc8e['attributes'][_0x2467('0x33')]?_0x42bc8e[_0x2467('0x34')]:_0x4da106[_0x2467('0x30')];if(!_0x327954[_0x2467('0x31')][_0x2467('0x35')]('nolimit')){_0x42bc8e['limit']=qs['limit'](_0x327954[_0x2467('0x31')][_0x2467('0x1e')]);_0x42bc8e[_0x2467('0x1d')]=qs[_0x2467('0x1d')](_0x327954[_0x2467('0x31')][_0x2467('0x1d')]);}_0x42bc8e[_0x2467('0x36')]=qs[_0x2467('0x37')](_0x327954[_0x2467('0x31')]['sort']);_0x42bc8e[_0x2467('0x38')]=qs[_0x2467('0x2e')](_[_0x2467('0x39')](_0x327954[_0x2467('0x31')],_0x4da106[_0x2467('0x2e')]),_0x1de49c);if(_0x327954[_0x2467('0x31')]['filter']){_0x42bc8e['where']=_[_0x2467('0x3a')](_0x42bc8e[_0x2467('0x38')],{'$or':_[_0x2467('0x29')](_0x1de49c,function(_0x8dc1da){if(_0x8dc1da[_0x2467('0x3b')]!=='VIRTUAL'){var _0x1f216d={};_0x1f216d[_0x8dc1da['name']]={'$like':'%'+_0x327954['query'][_0x2467('0x3c')]+'%'};return _0x1f216d;}})});}_0x42bc8e=_[_0x2467('0x3a')]({},_0x42bc8e,_0x327954[_0x2467('0x3d')]);var _0x19e39c={'where':_0x42bc8e[_0x2467('0x38')]};return db[_0x2467('0x2a')][_0x2467('0x20')](_0x19e39c)[_0x2467('0x3e')](function(_0xe6bae3){_0xa793b2['count']=_0xe6bae3;if(_0x327954[_0x2467('0x31')]['includeAll']){_0x42bc8e['include']=[{'all':!![]}];}return db[_0x2467('0x2a')][_0x2467('0x3f')](_0x42bc8e);})[_0x2467('0x3e')](function(_0x57fa85){_0xa793b2['rows']=_0x57fa85;return _0xa793b2;})['then'](respondWithFilteredResult(_0x201c31,_0x42bc8e))[_0x2467('0x40')](handleError(_0x201c31,null));};exports['show']=function(_0x7fd02f,_0x26ed4d){var _0x2f8b67={'raw':!![],'where':{'id':_0x7fd02f[_0x2467('0x41')]['id']}},_0x2f39c8={};_0x2f39c8[_0x2467('0x30')]=_[_0x2467('0x42')](db[_0x2467('0x2a')]['rawAttributes']);_0x2f39c8[_0x2467('0x31')]=_['keys'](_0x7fd02f[_0x2467('0x31')]);_0x2f39c8[_0x2467('0x2e')]=_['intersection'](_0x2f39c8[_0x2467('0x30')],_0x2f39c8[_0x2467('0x31')]);_0x2f8b67['attributes']=_[_0x2467('0x2f')](_0x2f39c8['model'],qs[_0x2467('0x32')](_0x7fd02f['query']['fields']));_0x2f8b67[_0x2467('0x34')]=_0x2f8b67[_0x2467('0x34')][_0x2467('0x33')]?_0x2f8b67[_0x2467('0x34')]:_0x2f39c8[_0x2467('0x30')];if(_0x7fd02f[_0x2467('0x31')][_0x2467('0x43')]){_0x2f8b67[_0x2467('0x44')]=[{'all':!![]}];}_0x2f8b67=_[_0x2467('0x3a')]({},_0x2f8b67,_0x7fd02f[_0x2467('0x3d')]);return db[_0x2467('0x2a')][_0x2467('0x45')](_0x2f8b67)['then'](handleEntityNotFound(_0x26ed4d,null))['then'](respondWithResult(_0x26ed4d,null))[_0x2467('0x40')](handleError(_0x26ed4d,null));};exports[_0x2467('0x46')]=function(_0x4417d1,_0x41c70d){return db[_0x2467('0x2a')][_0x2467('0x46')](_0x4417d1[_0x2467('0x47')],{})[_0x2467('0x3e')](respondWithResult(_0x41c70d,0xc9))['catch'](handleError(_0x41c70d,null));};exports[_0x2467('0x24')]=function(_0x42ca44,_0x554011){if(_0x42ca44[_0x2467('0x47')]['id']){delete _0x42ca44['body']['id'];}return db[_0x2467('0x2a')][_0x2467('0x45')]({'where':{'id':_0x42ca44[_0x2467('0x41')]['id']}})[_0x2467('0x3e')](handleEntityNotFound(_0x554011,null))[_0x2467('0x3e')](saveUpdates(_0x42ca44[_0x2467('0x47')],null))[_0x2467('0x3e')](respondWithResult(_0x554011,null))[_0x2467('0x40')](handleError(_0x554011,null));};exports[_0x2467('0x48')]=function(_0x22fae5,_0x14867b){return db['ChatQueueReport'][_0x2467('0x45')]({'where':{'id':_0x22fae5[_0x2467('0x41')]['id']}})[_0x2467('0x3e')](handleEntityNotFound(_0x14867b,null))['then'](removeEntity(_0x14867b,null))[_0x2467('0x40')](handleError(_0x14867b,null));};exports['describe']=function(_0x573396,_0x5d43ed){return db[_0x2467('0x2a')]['describe']()[_0x2467('0x3e')](respondWithResult(_0x5d43ed,null))['catch'](handleError(_0x5d43ed,null));}; \ No newline at end of file +var _0xc891=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','name','send','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','params','create','body','find','catch','destroy','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x5641e3,_0x1437ae){var _0x4065e8=function(_0x55dbf9){while(--_0x55dbf9){_0x5641e3['push'](_0x5641e3['shift']());}};_0x4065e8(++_0x1437ae);}(_0xc891,0x152));var _0x1c89=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xc891[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x1c89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c89('0x1'));var rp=require('request-promise');var moment=require(_0x1c89('0x2'));var BPromise=require(_0x1c89('0x3'));var Mustache=require(_0x1c89('0x4'));var util=require('util');var path=require(_0x1c89('0x5'));var sox=require(_0x1c89('0x6'));var csv=require(_0x1c89('0x7'));var ejs=require(_0x1c89('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c89('0x9'));var squel=require(_0x1c89('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c89('0xb'));var deskjs=require(_0x1c89('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1c89('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c89('0xe'));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(_0x1c89('0xf'))('api');var utils=require(_0x1c89('0x10'));var config=require(_0x1c89('0x11'));var licenseUtil=require(_0x1c89('0x12'));var db=require(_0x1c89('0x13'))['db'];function respondWithStatusCode(_0x7a4a2b,_0x27e7c0){_0x27e7c0=_0x27e7c0||0xcc;return function(_0x393b5f){if(_0x393b5f){return _0x7a4a2b[_0x1c89('0x14')](_0x27e7c0);}return _0x7a4a2b['status'](_0x27e7c0)[_0x1c89('0x15')]();};}function respondWithResult(_0x514e4d,_0x46be15){_0x46be15=_0x46be15||0xc8;return function(_0x424651){if(_0x424651){return _0x514e4d[_0x1c89('0x16')](_0x46be15)['json'](_0x424651);}};}function respondWithFilteredResult(_0x45354d,_0x29602e){return function(_0x2c9572){if(_0x2c9572){var _0x4af31b=typeof _0x29602e[_0x1c89('0x17')]===_0x1c89('0x18')&&typeof _0x29602e[_0x1c89('0x19')]===_0x1c89('0x18');var _0x33afcf=_0x2c9572[_0x1c89('0x1a')];var _0x2cb186=_0x4af31b?0x0:_0x29602e[_0x1c89('0x17')];var _0x166444=_0x4af31b?_0x2c9572[_0x1c89('0x1a')]:_0x29602e[_0x1c89('0x17')]+_0x29602e['limit'];var _0x18ce93;if(_0x166444>=_0x33afcf){_0x166444=_0x33afcf;_0x18ce93=0xc8;}else{_0x18ce93=0xce;}_0x45354d[_0x1c89('0x16')](_0x18ce93);return _0x45354d['set'](_0x1c89('0x1b'),_0x2cb186+'-'+_0x166444+'/'+_0x33afcf)[_0x1c89('0x1c')](_0x2c9572);}return null;};}function patchUpdates(_0x14121c){return function(_0x43a17a){try{jsonpatch['apply'](_0x43a17a,_0x14121c,!![]);}catch(_0x4ef155){return BPromise[_0x1c89('0x1d')](_0x4ef155);}return _0x43a17a[_0x1c89('0x1e')]();};}function saveUpdates(_0x253e07,_0x23def1){return function(_0x5b4fbc){if(_0x5b4fbc){return _0x5b4fbc[_0x1c89('0x1f')](_0x253e07)[_0x1c89('0x20')](function(_0x4fbd33){return _0x4fbd33;});}return null;};}function removeEntity(_0x45f604,_0x26a1cc){return function(_0x1ac0cc){if(_0x1ac0cc){return _0x1ac0cc['destroy']()[_0x1c89('0x20')](function(){_0x45f604[_0x1c89('0x16')](0xcc)[_0x1c89('0x15')]();});}};}function handleEntityNotFound(_0x59a87e,_0x22afe9){return function(_0x49f69b){if(!_0x49f69b){_0x59a87e['sendStatus'](0x194);}return _0x49f69b;};}function handleError(_0x35cc05,_0x352449){_0x352449=_0x352449||0x1f4;return function(_0x4c4694){logger['error'](_0x4c4694['stack']);if(_0x4c4694[_0x1c89('0x21')]){delete _0x4c4694['name'];}_0x35cc05['status'](_0x352449)[_0x1c89('0x22')](_0x4c4694);};}exports['index']=function(_0x193d8d,_0x51aa70){var _0x4dac46={},_0x25500d={},_0x10dc12={'count':0x0,'rows':[]};var _0x14f7cb=_['map'](db[_0x1c89('0x23')][_0x1c89('0x24')],function(_0x487916){return{'name':_0x487916[_0x1c89('0x25')],'type':_0x487916['type'][_0x1c89('0x26')]};});_0x25500d[_0x1c89('0x27')]=_[_0x1c89('0x28')](_0x14f7cb,_0x1c89('0x21'));_0x25500d[_0x1c89('0x29')]=_[_0x1c89('0x2a')](_0x193d8d[_0x1c89('0x29')]);_0x25500d[_0x1c89('0x2b')]=_[_0x1c89('0x2c')](_0x25500d[_0x1c89('0x27')],_0x25500d['query']);_0x4dac46[_0x1c89('0x2d')]=_['intersection'](_0x25500d['model'],qs[_0x1c89('0x2e')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x2e')]));_0x4dac46[_0x1c89('0x2d')]=_0x4dac46[_0x1c89('0x2d')][_0x1c89('0x2f')]?_0x4dac46[_0x1c89('0x2d')]:_0x25500d[_0x1c89('0x27')];if(!_0x193d8d[_0x1c89('0x29')][_0x1c89('0x30')](_0x1c89('0x31'))){_0x4dac46['limit']=qs['limit'](_0x193d8d[_0x1c89('0x29')]['limit']);_0x4dac46['offset']=qs[_0x1c89('0x17')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x17')]);}_0x4dac46[_0x1c89('0x32')]=qs[_0x1c89('0x33')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x33')]);_0x4dac46['where']=qs[_0x1c89('0x2b')](_[_0x1c89('0x34')](_0x193d8d['query'],_0x25500d[_0x1c89('0x2b')]),_0x14f7cb);if(_0x193d8d[_0x1c89('0x29')][_0x1c89('0x35')]){_0x4dac46[_0x1c89('0x36')]=_[_0x1c89('0x37')](_0x4dac46['where'],{'$or':_[_0x1c89('0x28')](_0x14f7cb,function(_0x2e6ebd){if(_0x2e6ebd[_0x1c89('0x38')]!=='VIRTUAL'){var _0xed5122={};_0xed5122[_0x2e6ebd['name']]={'$like':'%'+_0x193d8d[_0x1c89('0x29')]['filter']+'%'};return _0xed5122;}})});}_0x4dac46=_[_0x1c89('0x37')]({},_0x4dac46,_0x193d8d[_0x1c89('0x39')]);var _0x45152f={'where':_0x4dac46[_0x1c89('0x36')]};return db[_0x1c89('0x23')][_0x1c89('0x1a')](_0x45152f)[_0x1c89('0x20')](function(_0x1b8566){_0x10dc12[_0x1c89('0x1a')]=_0x1b8566;if(_0x193d8d['query'][_0x1c89('0x3a')]){_0x4dac46[_0x1c89('0x3b')]=[{'all':!![]}];}return db[_0x1c89('0x23')][_0x1c89('0x3c')](_0x4dac46);})['then'](function(_0x36e3a7){_0x10dc12[_0x1c89('0x3d')]=_0x36e3a7;return _0x10dc12;})[_0x1c89('0x20')](respondWithFilteredResult(_0x51aa70,_0x4dac46))['catch'](handleError(_0x51aa70,null));};exports['show']=function(_0xa1d4bb,_0x21fa5c){var _0x5f33c0={'raw':!![],'where':{'id':_0xa1d4bb[_0x1c89('0x3e')]['id']}},_0xebb4c3={};_0xebb4c3[_0x1c89('0x27')]=_[_0x1c89('0x2a')](db[_0x1c89('0x23')][_0x1c89('0x24')]);_0xebb4c3[_0x1c89('0x29')]=_['keys'](_0xa1d4bb[_0x1c89('0x29')]);_0xebb4c3['filters']=_['intersection'](_0xebb4c3[_0x1c89('0x27')],_0xebb4c3[_0x1c89('0x29')]);_0x5f33c0[_0x1c89('0x2d')]=_[_0x1c89('0x2c')](_0xebb4c3[_0x1c89('0x27')],qs[_0x1c89('0x2e')](_0xa1d4bb[_0x1c89('0x29')][_0x1c89('0x2e')]));_0x5f33c0[_0x1c89('0x2d')]=_0x5f33c0[_0x1c89('0x2d')][_0x1c89('0x2f')]?_0x5f33c0[_0x1c89('0x2d')]:_0xebb4c3[_0x1c89('0x27')];if(_0xa1d4bb[_0x1c89('0x29')][_0x1c89('0x3a')]){_0x5f33c0[_0x1c89('0x3b')]=[{'all':!![]}];}_0x5f33c0=_['merge']({},_0x5f33c0,_0xa1d4bb[_0x1c89('0x39')]);return db['ChatQueueReport']['find'](_0x5f33c0)[_0x1c89('0x20')](handleEntityNotFound(_0x21fa5c,null))['then'](respondWithResult(_0x21fa5c,null))['catch'](handleError(_0x21fa5c,null));};exports[_0x1c89('0x3f')]=function(_0x4b4d3f,_0x5f102d){return db['ChatQueueReport'][_0x1c89('0x3f')](_0x4b4d3f['body'],{})[_0x1c89('0x20')](respondWithResult(_0x5f102d,0xc9))['catch'](handleError(_0x5f102d,null));};exports[_0x1c89('0x1f')]=function(_0x5114bb,_0x36d5fc){if(_0x5114bb[_0x1c89('0x40')]['id']){delete _0x5114bb[_0x1c89('0x40')]['id'];}return db['ChatQueueReport'][_0x1c89('0x41')]({'where':{'id':_0x5114bb[_0x1c89('0x3e')]['id']}})['then'](handleEntityNotFound(_0x36d5fc,null))['then'](saveUpdates(_0x5114bb[_0x1c89('0x40')],null))[_0x1c89('0x20')](respondWithResult(_0x36d5fc,null))[_0x1c89('0x42')](handleError(_0x36d5fc,null));};exports[_0x1c89('0x43')]=function(_0x94f616,_0x392fdb){return db[_0x1c89('0x23')][_0x1c89('0x41')]({'where':{'id':_0x94f616[_0x1c89('0x3e')]['id']}})[_0x1c89('0x20')](handleEntityNotFound(_0x392fdb,null))[_0x1c89('0x20')](removeEntity(_0x392fdb,null))[_0x1c89('0x42')](handleError(_0x392fdb,null));};exports[_0x1c89('0x44')]=function(_0x111fb2,_0x190bf6){return db[_0x1c89('0x23')][_0x1c89('0x44')]()[_0x1c89('0x20')](respondWithResult(_0x190bf6,null))[_0x1c89('0x42')](handleError(_0x190bf6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f00bc63..129dc71 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x378700,_0x12a40c){var _0x32cae8=function(_0x4ed271){while(--_0x4ed271){_0x378700['push'](_0x378700['shift']());}};_0x32cae8(++_0x12a40c);}(_0x757a,0xde));var _0xa757=function(_0x38bf77,_0x171cc1){_0x38bf77=_0x38bf77-0x0;var _0x45025d=_0x757a[_0x38bf77];return _0x45025d;};'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'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20f756,_0x3b6c12){var _0xcf3c94=function(_0x1e9961){while(--_0x1e9961){_0x20f756['push'](_0x20f756['shift']());}};_0xcf3c94(++_0x3b6c12);}(_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 8091ca0..f37b897 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 _0x589b=['attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','raw','debug','stringify','UpdateChatQueueReport','body','options','where'];(function(_0x13f729,_0x2689d0){var _0x5d1288=function(_0xd85899){while(--_0xd85899){_0x13f729['push'](_0x13f729['shift']());}};_0x5d1288(++_0x2689d0);}(_0x589b,0x97));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb589('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb589('0x1'));var rs=require(_0xb589('0x2'));var fs=require('fs');var Redis=require(_0xb589('0x3'));var db=require(_0xb589('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb589('0x5'))('rpc');var config=require(_0xb589('0x6'));var jayson=require(_0xb589('0x7'));var client=jayson[_0xb589('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb4f0eb,_0x40b624,_0x2aa115){return new BPromise(function(_0xea2df5,_0x16e2eb){return client[_0xb589('0x9')](_0xb4f0eb,_0x2aa115)[_0xb589('0xa')](function(_0x985858){logger[_0xb589('0xb')](_0xb589('0xc'),_0x40b624,_0xb589('0xd'));logger['debug'](_0xb589('0xe'),_0x40b624,_0xb589('0xd'),JSON['stringify'](_0x985858));if(_0x985858[_0xb589('0xf')]){if(_0x985858['error']['code']===0x1f4){logger[_0xb589('0xf')](_0xb589('0xc'),_0x40b624,_0x985858['error'][_0xb589('0x10')]);return _0x16e2eb(_0x985858[_0xb589('0xf')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x40b624,_0x985858[_0xb589('0xf')][_0xb589('0x10')]);return _0xea2df5(_0x985858['error'][_0xb589('0x10')]);}else{logger[_0xb589('0xb')](_0xb589('0xc'),_0x40b624,_0xb589('0xd'));_0xea2df5(_0x985858[_0xb589('0x11')]['message']);}})[_0xb589('0x12')](function(_0x458586){logger[_0xb589('0xf')](_0xb589('0xc'),_0x40b624,_0x458586);_0x16e2eb(_0x458586);});});}exports[_0xb589('0x13')]=function(_0x441e8b){var _0x4cab23=this;return new Promise(function(_0x340d7a,_0x682b56){return db[_0xb589('0x14')][_0xb589('0x15')](_0x441e8b['body'],{'raw':_0x441e8b['options']?_0x441e8b['options'][_0xb589('0x16')]===undefined?!![]:![]:!![]})[_0xb589('0xa')](function(_0x285f88){logger[_0xb589('0xb')](_0xb589('0x13'),_0x441e8b);logger[_0xb589('0x17')]('CreateChatQueueReport',_0x441e8b,JSON[_0xb589('0x18')](_0x285f88));_0x340d7a(_0x285f88);})['catch'](function(_0xd8b7ca){logger[_0xb589('0xf')](_0xb589('0x13'),_0xd8b7ca[_0xb589('0x10')],_0x441e8b);_0x682b56(_0x4cab23[_0xb589('0xf')](0x1f4,_0xd8b7ca[_0xb589('0x10')]));});});};exports[_0xb589('0x19')]=function(_0x48b2fd){var _0x252011=this;return new Promise(function(_0x44a8c8,_0x1e6248){return db[_0xb589('0x14')]['update'](_0x48b2fd[_0xb589('0x1a')],{'raw':_0x48b2fd[_0xb589('0x1b')]?_0x48b2fd[_0xb589('0x1b')][_0xb589('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48b2fd[_0xb589('0x1b')]?_0x48b2fd[_0xb589('0x1b')][_0xb589('0x1c')]||null:null,'attributes':_0x48b2fd[_0xb589('0x1b')]?_0x48b2fd[_0xb589('0x1b')][_0xb589('0x1d')]||null:null,'limit':_0x48b2fd['options']?_0x48b2fd['options']['limit']||null:null})['then'](function(_0x23e2fd){logger[_0xb589('0xb')](_0xb589('0x19'),_0x48b2fd);logger[_0xb589('0x17')](_0xb589('0x19'),_0x48b2fd,JSON[_0xb589('0x18')](_0x23e2fd));_0x44a8c8(_0x23e2fd);})[_0xb589('0x12')](function(_0x29e904){logger[_0xb589('0xf')](_0xb589('0x19'),_0x29e904[_0xb589('0x10')],_0x48b2fd);_0x1e6248(_0x252011[_0xb589('0xf')](0x1f4,_0x29e904[_0xb589('0x10')]));});});}; \ No newline at end of file +var _0x1ec6=['error','message','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','catch','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2731fa,_0x5c99ea){var _0x4bd4be=function(_0x397a7d){while(--_0x397a7d){_0x2731fa['push'](_0x2731fa['shift']());}};_0x4bd4be(++_0x5c99ea);}(_0x1ec6,0x158));var _0x61ec=function(_0x434323,_0x584fd5){_0x434323=_0x434323-0x0;var _0x2da586=_0x1ec6[_0x434323];return _0x2da586;};'use strict';var _=require(_0x61ec('0x0'));var util=require(_0x61ec('0x1'));var moment=require(_0x61ec('0x2'));var BPromise=require(_0x61ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61ec('0x4'));var db=require(_0x61ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x61ec('0x6'))(_0x61ec('0x7'));var config=require(_0x61ec('0x8'));var jayson=require(_0x61ec('0x9'));var client=jayson[_0x61ec('0xa')][_0x61ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38fa9e,_0x1f622f,_0x1ede63){return new BPromise(function(_0x477cb0,_0x4a95fa){return client['request'](_0x38fa9e,_0x1ede63)[_0x61ec('0xc')](function(_0x218c83){logger[_0x61ec('0xd')](_0x61ec('0xe'),_0x1f622f,_0x61ec('0xf'));logger[_0x61ec('0x10')](_0x61ec('0x11'),_0x1f622f,_0x61ec('0xf'),JSON[_0x61ec('0x12')](_0x218c83));if(_0x218c83[_0x61ec('0x13')]){if(_0x218c83[_0x61ec('0x13')]['code']===0x1f4){logger[_0x61ec('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x1f622f,_0x218c83['error'][_0x61ec('0x14')]);return _0x4a95fa(_0x218c83['error']['message']);}logger[_0x61ec('0x13')](_0x61ec('0xe'),_0x1f622f,_0x218c83[_0x61ec('0x13')][_0x61ec('0x14')]);return _0x477cb0(_0x218c83['error']['message']);}else{logger[_0x61ec('0xd')](_0x61ec('0xe'),_0x1f622f,_0x61ec('0xf'));_0x477cb0(_0x218c83['result'][_0x61ec('0x14')]);}})['catch'](function(_0x5ad163){logger[_0x61ec('0x13')](_0x61ec('0xe'),_0x1f622f,_0x5ad163);_0x4a95fa(_0x5ad163);});});}exports[_0x61ec('0x15')]=function(_0x331355){var _0x36079f=this;return new Promise(function(_0x55d2fb,_0x2c5e30){return db[_0x61ec('0x16')][_0x61ec('0x17')](_0x331355[_0x61ec('0x18')],{'raw':_0x331355[_0x61ec('0x19')]?_0x331355[_0x61ec('0x19')][_0x61ec('0x1a')]===undefined?!![]:![]:!![]})[_0x61ec('0xc')](function(_0x282358){logger[_0x61ec('0xd')](_0x61ec('0x15'),_0x331355);logger['debug']('CreateChatQueueReport',_0x331355,JSON[_0x61ec('0x12')](_0x282358));_0x55d2fb(_0x282358);})[_0x61ec('0x1b')](function(_0x214d70){logger[_0x61ec('0x13')](_0x61ec('0x15'),_0x214d70['message'],_0x331355);_0x2c5e30(_0x36079f[_0x61ec('0x13')](0x1f4,_0x214d70['message']));});});};exports[_0x61ec('0x1c')]=function(_0x4c154b){var _0x363136=this;return new Promise(function(_0x221ce4,_0x3fa159){return db[_0x61ec('0x16')][_0x61ec('0x1d')](_0x4c154b[_0x61ec('0x18')],{'raw':_0x4c154b[_0x61ec('0x19')]?_0x4c154b[_0x61ec('0x19')][_0x61ec('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c154b[_0x61ec('0x19')]?_0x4c154b['options'][_0x61ec('0x1e')]||null:null,'attributes':_0x4c154b[_0x61ec('0x19')]?_0x4c154b[_0x61ec('0x19')][_0x61ec('0x1f')]||null:null,'limit':_0x4c154b['options']?_0x4c154b[_0x61ec('0x19')][_0x61ec('0x20')]||null:null})[_0x61ec('0xc')](function(_0x4377de){logger[_0x61ec('0xd')](_0x61ec('0x1c'),_0x4c154b);logger[_0x61ec('0x10')](_0x61ec('0x1c'),_0x4c154b,JSON[_0x61ec('0x12')](_0x4377de));_0x221ce4(_0x4377de);})['catch'](function(_0x12a58e){logger[_0x61ec('0x13')](_0x61ec('0x1c'),_0x12a58e['message'],_0x4c154b);_0x3fa159(_0x363136[_0x61ec('0x13')](0x1f4,_0x12a58e[_0x61ec('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e65073e..c2a9cf6 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 _0xe651=['/:id','show','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x1ef8d2,_0x43cf10){var _0x52fbdb=function(_0x18b2f5){while(--_0x18b2f5){_0x1ef8d2['push'](_0x1ef8d2['shift']());}};_0x52fbdb(++_0x43cf10);}(_0xe651,0x181));var _0x1e65=function(_0x3aeb9b,_0x3f3ff2){_0x3aeb9b=_0x3aeb9b-0x0;var _0x5e318f=_0xe651[_0x3aeb9b];return _0x5e318f;};'use strict';var multer=require(_0x1e65('0x0'));var util=require(_0x1e65('0x1'));var path=require(_0x1e65('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e65('0x3'));var router=express[_0x1e65('0x4')]();var fs_extra=require(_0x1e65('0x5'));var auth=require(_0x1e65('0x6'));var interaction=require(_0x1e65('0x7'));var config=require(_0x1e65('0x8'));var controller=require(_0x1e65('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e65('0xa')]);router[_0x1e65('0xb')](_0x1e65('0xc'),auth[_0x1e65('0xd')](),controller[_0x1e65('0xe')]);router['get'](_0x1e65('0xf'),auth['isAuthenticated'](),controller[_0x1e65('0x10')]);router['post']('/',auth[_0x1e65('0xd')](),controller['create']);router[_0x1e65('0x11')](_0x1e65('0xf'),auth[_0x1e65('0xd')](),controller['update']);router[_0x1e65('0x12')](_0x1e65('0xf'),auth[_0x1e65('0xd')](),controller['destroy']);module[_0x1e65('0x13')]=router; \ No newline at end of file +var _0x9fe7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x34c4e1,_0x310387){var _0x5a11ef=function(_0x552f26){while(--_0x552f26){_0x34c4e1['push'](_0x34c4e1['shift']());}};_0x5a11ef(++_0x310387);}(_0x9fe7,0x127));var _0x79fe=function(_0x40a4ee,_0x515400){_0x40a4ee=_0x40a4ee-0x0;var _0x57c3cc=_0x9fe7[_0x40a4ee];return _0x57c3cc;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require(_0x79fe('0x2'));var timeout=require(_0x79fe('0x3'));var express=require(_0x79fe('0x4'));var router=express[_0x79fe('0x5')]();var fs_extra=require(_0x79fe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x79fe('0x7'));var config=require(_0x79fe('0x8'));var controller=require(_0x79fe('0x9'));router[_0x79fe('0xa')]('/',auth[_0x79fe('0xb')](),controller[_0x79fe('0xc')]);router[_0x79fe('0xa')]('/describe',auth[_0x79fe('0xb')](),controller[_0x79fe('0xd')]);router['get'](_0x79fe('0xe'),auth[_0x79fe('0xb')](),controller[_0x79fe('0xf')]);router['post']('/',auth[_0x79fe('0xb')](),controller['create']);router['put']('/:id',auth[_0x79fe('0xb')](),controller[_0x79fe('0x10')]);router[_0x79fe('0x11')](_0x79fe('0xe'),auth[_0x79fe('0xb')](),controller[_0x79fe('0x12')]);module[_0x79fe('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 8b3785b..2d8f1eb 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x244c80,_0x109821){var _0x1638c3=function(_0x441024){while(--_0x441024){_0x244c80['push'](_0x244c80['shift']());}};_0x1638c3(++_0x109821);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4dcd85,_0x26705e){_0x4dcd85=_0x4dcd85-0x0;var _0x13e45d=_0xf4eb[_0x4dcd85];return _0x13e45d;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x9bde,0xe1));var _0xe9bd=function(_0xe5263,_0x55fc4e){_0xe5263=_0xe5263-0x0;var _0x5bc69b=_0x9bde[_0xe5263];return _0x5bc69b;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4b8c4e7..53dbb6f 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 _0x9ac4=['lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','map','ChatTransferReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','include','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','fs-extra'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0x9ac4,0x155));var _0x49ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ac4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x49ac('0x0'));var rimraf=require(_0x49ac('0x1'));var zipdir=require(_0x49ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49ac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x49ac('0x4'));var util=require(_0x49ac('0x5'));var path=require(_0x49ac('0x6'));var sox=require('sox');var csv=require(_0x49ac('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49ac('0x8'));var _=require(_0x49ac('0x9'));var squel=require(_0x49ac('0xa'));var crypto=require('crypto');var jsforce=require(_0x49ac('0xb'));var deskjs=require(_0x49ac('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49ac('0xd'));var Redis=require(_0x49ac('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x49ac('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49ac('0x10'))(_0x49ac('0x11'));var utils=require('../../config/utils');var config=require(_0x49ac('0x12'));var licenseUtil=require(_0x49ac('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f32a3,_0x31a6c8){_0x31a6c8=_0x31a6c8||0xcc;return function(_0x57638c){if(_0x57638c){return _0x1f32a3[_0x49ac('0x14')](_0x31a6c8);}return _0x1f32a3[_0x49ac('0x15')](_0x31a6c8)[_0x49ac('0x16')]();};}function respondWithResult(_0x53c46b,_0x396106){_0x396106=_0x396106||0xc8;return function(_0x2862df){if(_0x2862df){return _0x53c46b[_0x49ac('0x15')](_0x396106)['json'](_0x2862df);}};}function respondWithFilteredResult(_0x20b903,_0x2bcae0){return function(_0x29ef86){if(_0x29ef86){var _0x255b52=typeof _0x2bcae0[_0x49ac('0x17')]===_0x49ac('0x18')&&typeof _0x2bcae0[_0x49ac('0x19')]===_0x49ac('0x18');var _0xa48071=_0x29ef86[_0x49ac('0x1a')];var _0xd7ea8a=_0x255b52?0x0:_0x2bcae0[_0x49ac('0x17')];var _0x9edd4a=_0x255b52?_0x29ef86['count']:_0x2bcae0[_0x49ac('0x17')]+_0x2bcae0[_0x49ac('0x19')];var _0x42c0be;if(_0x9edd4a>=_0xa48071){_0x9edd4a=_0xa48071;_0x42c0be=0xc8;}else{_0x42c0be=0xce;}_0x20b903[_0x49ac('0x15')](_0x42c0be);return _0x20b903[_0x49ac('0x1b')](_0x49ac('0x1c'),_0xd7ea8a+'-'+_0x9edd4a+'/'+_0xa48071)[_0x49ac('0x1d')](_0x29ef86);}return null;};}function patchUpdates(_0x485272){return function(_0x41eac7){try{jsonpatch[_0x49ac('0x1e')](_0x41eac7,_0x485272,!![]);}catch(_0xa13c42){return BPromise[_0x49ac('0x1f')](_0xa13c42);}return _0x41eac7['save']();};}function saveUpdates(_0x520a00,_0x244644){return function(_0xed01d5){if(_0xed01d5){return _0xed01d5[_0x49ac('0x20')](_0x520a00)['then'](function(_0xe436f0){return _0xe436f0;});}return null;};}function removeEntity(_0x726d0,_0x571186){return function(_0x3ed305){if(_0x3ed305){return _0x3ed305[_0x49ac('0x21')]()[_0x49ac('0x22')](function(){_0x726d0[_0x49ac('0x15')](0xcc)[_0x49ac('0x16')]();});}};}function handleEntityNotFound(_0x2677c2,_0x200bdc){return function(_0x489d73){if(!_0x489d73){_0x2677c2[_0x49ac('0x14')](0x194);}return _0x489d73;};}function handleError(_0x4700a5,_0x290e65){_0x290e65=_0x290e65||0x1f4;return function(_0x259986){logger[_0x49ac('0x23')](_0x259986[_0x49ac('0x24')]);if(_0x259986[_0x49ac('0x25')]){delete _0x259986[_0x49ac('0x25')];}_0x4700a5[_0x49ac('0x15')](_0x290e65)[_0x49ac('0x26')](_0x259986);};}exports['index']=function(_0x38d270,_0x15a533){var _0x2bfeca={},_0x3aeb7e={},_0x291143={'count':0x0,'rows':[]};var _0x14d254=_[_0x49ac('0x27')](db[_0x49ac('0x28')][_0x49ac('0x29')],function(_0x17e3cb){return{'name':_0x17e3cb['fieldName'],'type':_0x17e3cb[_0x49ac('0x2a')][_0x49ac('0x2b')]};});_0x3aeb7e['model']=_[_0x49ac('0x27')](_0x14d254,_0x49ac('0x25'));_0x3aeb7e[_0x49ac('0x2c')]=_[_0x49ac('0x2d')](_0x38d270[_0x49ac('0x2c')]);_0x3aeb7e[_0x49ac('0x2e')]=_['intersection'](_0x3aeb7e[_0x49ac('0x2f')],_0x3aeb7e[_0x49ac('0x2c')]);_0x2bfeca[_0x49ac('0x30')]=_[_0x49ac('0x31')](_0x3aeb7e[_0x49ac('0x2f')],qs[_0x49ac('0x32')](_0x38d270['query'][_0x49ac('0x32')]));_0x2bfeca[_0x49ac('0x30')]=_0x2bfeca[_0x49ac('0x30')]['length']?_0x2bfeca[_0x49ac('0x30')]:_0x3aeb7e[_0x49ac('0x2f')];if(!_0x38d270[_0x49ac('0x2c')]['hasOwnProperty'](_0x49ac('0x33'))){_0x2bfeca['limit']=qs[_0x49ac('0x19')](_0x38d270[_0x49ac('0x2c')]['limit']);_0x2bfeca['offset']=qs[_0x49ac('0x17')](_0x38d270[_0x49ac('0x2c')][_0x49ac('0x17')]);}_0x2bfeca['order']=qs[_0x49ac('0x34')](_0x38d270['query'][_0x49ac('0x34')]);_0x2bfeca[_0x49ac('0x35')]=qs[_0x49ac('0x2e')](_[_0x49ac('0x36')](_0x38d270[_0x49ac('0x2c')],_0x3aeb7e[_0x49ac('0x2e')]),_0x14d254);if(_0x38d270['query']['filter']){_0x2bfeca[_0x49ac('0x35')]=_[_0x49ac('0x37')](_0x2bfeca[_0x49ac('0x35')],{'$or':_[_0x49ac('0x27')](_0x14d254,function(_0xa4d0a4){if(_0xa4d0a4[_0x49ac('0x2a')]!==_0x49ac('0x38')){var _0x589828={};_0x589828[_0xa4d0a4[_0x49ac('0x25')]]={'$like':'%'+_0x38d270['query'][_0x49ac('0x39')]+'%'};return _0x589828;}})});}_0x2bfeca=_[_0x49ac('0x37')]({},_0x2bfeca,_0x38d270[_0x49ac('0x3a')]);var _0x38464c={'where':_0x2bfeca[_0x49ac('0x35')]};return db[_0x49ac('0x28')]['count'](_0x38464c)[_0x49ac('0x22')](function(_0x2dfd28){_0x291143[_0x49ac('0x1a')]=_0x2dfd28;if(_0x38d270[_0x49ac('0x2c')][_0x49ac('0x3b')]){_0x2bfeca['include']=[{'all':!![]}];}return db[_0x49ac('0x28')]['findAll'](_0x2bfeca);})[_0x49ac('0x22')](function(_0x25866c){_0x291143[_0x49ac('0x3c')]=_0x25866c;return _0x291143;})[_0x49ac('0x22')](respondWithFilteredResult(_0x15a533,_0x2bfeca))[_0x49ac('0x3d')](handleError(_0x15a533,null));};exports[_0x49ac('0x3e')]=function(_0x574cea,_0x3a667f){var _0x5459f9={'raw':!![],'where':{'id':_0x574cea[_0x49ac('0x3f')]['id']}},_0x529b03={};_0x529b03[_0x49ac('0x2f')]=_['keys'](db['ChatTransferReport'][_0x49ac('0x29')]);_0x529b03[_0x49ac('0x2c')]=_[_0x49ac('0x2d')](_0x574cea[_0x49ac('0x2c')]);_0x529b03[_0x49ac('0x2e')]=_[_0x49ac('0x31')](_0x529b03[_0x49ac('0x2f')],_0x529b03[_0x49ac('0x2c')]);_0x5459f9[_0x49ac('0x30')]=_['intersection'](_0x529b03[_0x49ac('0x2f')],qs['fields'](_0x574cea[_0x49ac('0x2c')][_0x49ac('0x32')]));_0x5459f9[_0x49ac('0x30')]=_0x5459f9[_0x49ac('0x30')][_0x49ac('0x40')]?_0x5459f9[_0x49ac('0x30')]:_0x529b03[_0x49ac('0x2f')];if(_0x574cea[_0x49ac('0x2c')][_0x49ac('0x3b')]){_0x5459f9[_0x49ac('0x41')]=[{'all':!![]}];}_0x5459f9=_['merge']({},_0x5459f9,_0x574cea[_0x49ac('0x3a')]);return db[_0x49ac('0x28')]['find'](_0x5459f9)[_0x49ac('0x22')](handleEntityNotFound(_0x3a667f,null))[_0x49ac('0x22')](respondWithResult(_0x3a667f,null))[_0x49ac('0x3d')](handleError(_0x3a667f,null));};exports['create']=function(_0x1d24f6,_0x51fc22){return db['ChatTransferReport'][_0x49ac('0x42')](_0x1d24f6['body'],{})['then'](respondWithResult(_0x51fc22,0xc9))[_0x49ac('0x3d')](handleError(_0x51fc22,null));};exports[_0x49ac('0x20')]=function(_0x44be05,_0x57ee4a){if(_0x44be05[_0x49ac('0x43')]['id']){delete _0x44be05[_0x49ac('0x43')]['id'];}return db[_0x49ac('0x28')][_0x49ac('0x44')]({'where':{'id':_0x44be05[_0x49ac('0x3f')]['id']}})[_0x49ac('0x22')](handleEntityNotFound(_0x57ee4a,null))[_0x49ac('0x22')](saveUpdates(_0x44be05[_0x49ac('0x43')],null))[_0x49ac('0x22')](respondWithResult(_0x57ee4a,null))[_0x49ac('0x3d')](handleError(_0x57ee4a,null));};exports[_0x49ac('0x21')]=function(_0x4d6ee3,_0x470016){return db[_0x49ac('0x28')]['find']({'where':{'id':_0x4d6ee3[_0x49ac('0x3f')]['id']}})[_0x49ac('0x22')](handleEntityNotFound(_0x470016,null))[_0x49ac('0x22')](removeEntity(_0x470016,null))[_0x49ac('0x3d')](handleError(_0x470016,null));};exports['describe']=function(_0xb4767f,_0x21992d){return db[_0x49ac('0x28')][_0x49ac('0x45')]()[_0x49ac('0x22')](respondWithResult(_0x21992d,null))['catch'](handleError(_0x21992d,null));}; \ No newline at end of file +var _0x9471=['count','offset','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','rows','catch','show','params','includeAll','options','find','create','body','destroy','describe','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit'];(function(_0x4b5c29,_0x555621){var _0x1834ff=function(_0x5256f0){while(--_0x5256f0){_0x4b5c29['push'](_0x4b5c29['shift']());}};_0x1834ff(++_0x555621);}(_0x9471,0x1ad));var _0x1947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9471[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1947('0x0'));var rimraf=require(_0x1947('0x1'));var zipdir=require(_0x1947('0x2'));var jsonpatch=require(_0x1947('0x3'));var rp=require(_0x1947('0x4'));var moment=require(_0x1947('0x5'));var BPromise=require(_0x1947('0x6'));var Mustache=require(_0x1947('0x7'));var util=require(_0x1947('0x8'));var path=require(_0x1947('0x9'));var sox=require(_0x1947('0xa'));var csv=require(_0x1947('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1947('0xc'));var _=require(_0x1947('0xd'));var squel=require(_0x1947('0xe'));var crypto=require(_0x1947('0xf'));var jsforce=require(_0x1947('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1947('0xb'));var querystring=require(_0x1947('0x11'));var Papa=require(_0x1947('0x12'));var Redis=require(_0x1947('0x13'));var authService=require(_0x1947('0x14'));var qs=require(_0x1947('0x15'));var as=require(_0x1947('0x16'));var hardwareService=require(_0x1947('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x1947('0x18'));var config=require(_0x1947('0x19'));var licenseUtil=require(_0x1947('0x1a'));var db=require(_0x1947('0x1b'))['db'];function respondWithStatusCode(_0x1d1577,_0x333851){_0x333851=_0x333851||0xcc;return function(_0x27beae){if(_0x27beae){return _0x1d1577[_0x1947('0x1c')](_0x333851);}return _0x1d1577[_0x1947('0x1d')](_0x333851)['end']();};}function respondWithResult(_0x738033,_0x15f2b4){_0x15f2b4=_0x15f2b4||0xc8;return function(_0x353f53){if(_0x353f53){return _0x738033[_0x1947('0x1d')](_0x15f2b4)[_0x1947('0x1e')](_0x353f53);}};}function respondWithFilteredResult(_0x58963c,_0x56a221){return function(_0x2abff4){if(_0x2abff4){var _0x41b26f=typeof _0x56a221['offset']===_0x1947('0x1f')&&typeof _0x56a221[_0x1947('0x20')]==='undefined';var _0x19bb3c=_0x2abff4[_0x1947('0x21')];var _0x80e9bc=_0x41b26f?0x0:_0x56a221[_0x1947('0x22')];var _0x4f6737=_0x41b26f?_0x2abff4['count']:_0x56a221[_0x1947('0x22')]+_0x56a221[_0x1947('0x20')];var _0x4dc72e;if(_0x4f6737>=_0x19bb3c){_0x4f6737=_0x19bb3c;_0x4dc72e=0xc8;}else{_0x4dc72e=0xce;}_0x58963c[_0x1947('0x1d')](_0x4dc72e);return _0x58963c['set'](_0x1947('0x23'),_0x80e9bc+'-'+_0x4f6737+'/'+_0x19bb3c)['json'](_0x2abff4);}return null;};}function patchUpdates(_0x5a5a46){return function(_0x47e8a6){try{jsonpatch[_0x1947('0x24')](_0x47e8a6,_0x5a5a46,!![]);}catch(_0x2bbe51){return BPromise[_0x1947('0x25')](_0x2bbe51);}return _0x47e8a6[_0x1947('0x26')]();};}function saveUpdates(_0x5c6576,_0x8d0357){return function(_0x5273f8){if(_0x5273f8){return _0x5273f8['update'](_0x5c6576)[_0x1947('0x27')](function(_0x5ed018){return _0x5ed018;});}return null;};}function removeEntity(_0x44a8f8,_0x1a3066){return function(_0x32137e){if(_0x32137e){return _0x32137e['destroy']()[_0x1947('0x27')](function(){_0x44a8f8['status'](0xcc)[_0x1947('0x28')]();});}};}function handleEntityNotFound(_0x323b1e,_0x6124f4){return function(_0x4fad0b){if(!_0x4fad0b){_0x323b1e['sendStatus'](0x194);}return _0x4fad0b;};}function handleError(_0x174566,_0x5bf602){_0x5bf602=_0x5bf602||0x1f4;return function(_0x2eb27d){logger[_0x1947('0x29')](_0x2eb27d[_0x1947('0x2a')]);if(_0x2eb27d[_0x1947('0x2b')]){delete _0x2eb27d[_0x1947('0x2b')];}_0x174566[_0x1947('0x1d')](_0x5bf602)[_0x1947('0x2c')](_0x2eb27d);};}exports[_0x1947('0x2d')]=function(_0x31ed42,_0x43cb75){var _0x56db17={},_0x2fe9ed={},_0x24d111={'count':0x0,'rows':[]};var _0x40a0a5=_[_0x1947('0x2e')](db[_0x1947('0x2f')][_0x1947('0x30')],function(_0xbc0a04){return{'name':_0xbc0a04[_0x1947('0x31')],'type':_0xbc0a04[_0x1947('0x32')]['key']};});_0x2fe9ed[_0x1947('0x33')]=_[_0x1947('0x2e')](_0x40a0a5,_0x1947('0x2b'));_0x2fe9ed[_0x1947('0x34')]=_[_0x1947('0x35')](_0x31ed42[_0x1947('0x34')]);_0x2fe9ed[_0x1947('0x36')]=_[_0x1947('0x37')](_0x2fe9ed[_0x1947('0x33')],_0x2fe9ed[_0x1947('0x34')]);_0x56db17['attributes']=_[_0x1947('0x37')](_0x2fe9ed['model'],qs['fields'](_0x31ed42[_0x1947('0x34')][_0x1947('0x38')]));_0x56db17[_0x1947('0x39')]=_0x56db17['attributes'][_0x1947('0x3a')]?_0x56db17[_0x1947('0x39')]:_0x2fe9ed[_0x1947('0x33')];if(!_0x31ed42[_0x1947('0x34')][_0x1947('0x3b')]('nolimit')){_0x56db17[_0x1947('0x20')]=qs[_0x1947('0x20')](_0x31ed42[_0x1947('0x34')]['limit']);_0x56db17[_0x1947('0x22')]=qs[_0x1947('0x22')](_0x31ed42[_0x1947('0x34')][_0x1947('0x22')]);}_0x56db17[_0x1947('0x3c')]=qs[_0x1947('0x3d')](_0x31ed42[_0x1947('0x34')][_0x1947('0x3d')]);_0x56db17[_0x1947('0x3e')]=qs['filters'](_[_0x1947('0x3f')](_0x31ed42[_0x1947('0x34')],_0x2fe9ed[_0x1947('0x36')]),_0x40a0a5);if(_0x31ed42[_0x1947('0x34')]['filter']){_0x56db17[_0x1947('0x3e')]=_[_0x1947('0x40')](_0x56db17['where'],{'$or':_['map'](_0x40a0a5,function(_0x5b0a24){if(_0x5b0a24[_0x1947('0x32')]!=='VIRTUAL'){var _0x3e95b0={};_0x3e95b0[_0x5b0a24['name']]={'$like':'%'+_0x31ed42['query'][_0x1947('0x41')]+'%'};return _0x3e95b0;}})});}_0x56db17=_[_0x1947('0x40')]({},_0x56db17,_0x31ed42['options']);var _0x15fc96={'where':_0x56db17[_0x1947('0x3e')]};return db[_0x1947('0x2f')][_0x1947('0x21')](_0x15fc96)[_0x1947('0x27')](function(_0xfe21ff){_0x24d111[_0x1947('0x21')]=_0xfe21ff;if(_0x31ed42['query']['includeAll']){_0x56db17['include']=[{'all':!![]}];}return db[_0x1947('0x2f')]['findAll'](_0x56db17);})[_0x1947('0x27')](function(_0x5542ff){_0x24d111[_0x1947('0x42')]=_0x5542ff;return _0x24d111;})[_0x1947('0x27')](respondWithFilteredResult(_0x43cb75,_0x56db17))[_0x1947('0x43')](handleError(_0x43cb75,null));};exports[_0x1947('0x44')]=function(_0x2299dc,_0x44b809){var _0x4c179c={'raw':!![],'where':{'id':_0x2299dc[_0x1947('0x45')]['id']}},_0x2934d2={};_0x2934d2[_0x1947('0x33')]=_[_0x1947('0x35')](db[_0x1947('0x2f')][_0x1947('0x30')]);_0x2934d2[_0x1947('0x34')]=_['keys'](_0x2299dc[_0x1947('0x34')]);_0x2934d2[_0x1947('0x36')]=_[_0x1947('0x37')](_0x2934d2[_0x1947('0x33')],_0x2934d2[_0x1947('0x34')]);_0x4c179c['attributes']=_[_0x1947('0x37')](_0x2934d2['model'],qs['fields'](_0x2299dc[_0x1947('0x34')][_0x1947('0x38')]));_0x4c179c[_0x1947('0x39')]=_0x4c179c[_0x1947('0x39')]['length']?_0x4c179c[_0x1947('0x39')]:_0x2934d2[_0x1947('0x33')];if(_0x2299dc['query'][_0x1947('0x46')]){_0x4c179c['include']=[{'all':!![]}];}_0x4c179c=_[_0x1947('0x40')]({},_0x4c179c,_0x2299dc[_0x1947('0x47')]);return db[_0x1947('0x2f')][_0x1947('0x48')](_0x4c179c)[_0x1947('0x27')](handleEntityNotFound(_0x44b809,null))['then'](respondWithResult(_0x44b809,null))[_0x1947('0x43')](handleError(_0x44b809,null));};exports[_0x1947('0x49')]=function(_0x5cfc3b,_0x575b52){return db[_0x1947('0x2f')][_0x1947('0x49')](_0x5cfc3b[_0x1947('0x4a')],{})['then'](respondWithResult(_0x575b52,0xc9))[_0x1947('0x43')](handleError(_0x575b52,null));};exports['update']=function(_0x4c1482,_0x5656b1){if(_0x4c1482['body']['id']){delete _0x4c1482[_0x1947('0x4a')]['id'];}return db[_0x1947('0x2f')]['find']({'where':{'id':_0x4c1482[_0x1947('0x45')]['id']}})[_0x1947('0x27')](handleEntityNotFound(_0x5656b1,null))[_0x1947('0x27')](saveUpdates(_0x4c1482[_0x1947('0x4a')],null))[_0x1947('0x27')](respondWithResult(_0x5656b1,null))[_0x1947('0x43')](handleError(_0x5656b1,null));};exports[_0x1947('0x4b')]=function(_0x205f48,_0x5a87ff){return db[_0x1947('0x2f')]['find']({'where':{'id':_0x205f48[_0x1947('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a87ff,null))['then'](removeEntity(_0x5a87ff,null))[_0x1947('0x43')](handleError(_0x5a87ff,null));};exports[_0x1947('0x4c')]=function(_0x42407c,_0x1775b9){return db[_0x1947('0x2f')][_0x1947('0x4c')]()['then'](respondWithResult(_0x1775b9,null))[_0x1947('0x43')](handleError(_0x1775b9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 720b968..0218ab3 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 _0x6ece=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatTransferReport.attributes','exports','define'];(function(_0x34f754,_0x278292){var _0x1aa043=function(_0x108886){while(--_0x108886){_0x34f754['push'](_0x34f754['shift']());}};_0x1aa043(++_0x278292);}(_0x6ece,0xc7));var _0xe6ec=function(_0xdfd02,_0xd54770){_0xdfd02=_0xdfd02-0x0;var _0x580054=_0x6ece[_0xdfd02];return _0x580054;};'use strict';var _=require(_0xe6ec('0x0'));var util=require(_0xe6ec('0x1'));var logger=require(_0xe6ec('0x2'))(_0xe6ec('0x3'));var moment=require(_0xe6ec('0x4'));var BPromise=require('bluebird');var rp=require(_0xe6ec('0x5'));var fs=require('fs');var path=require(_0xe6ec('0x6'));var rimraf=require(_0xe6ec('0x7'));var config=require('../../config/environment');var attributes=require(_0xe6ec('0x8'));module[_0xe6ec('0x9')]=function(_0x4f26ea,_0x55afda){return _0x4f26ea[_0xe6ec('0xa')](_0xe6ec('0xb'),attributes,{'tableName':_0xe6ec('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe6ec('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c2b=['ChatTransferReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports'];(function(_0x9ae292,_0x130cef){var _0xadefdd=function(_0x4506a0){while(--_0x4506a0){_0x9ae292['push'](_0x9ae292['shift']());}};_0xadefdd(++_0x130cef);}(_0x5c2b,0x137));var _0xb5c2=function(_0xf1579,_0x16ada1){_0xf1579=_0xf1579-0x0;var _0x588de2=_0x5c2b[_0xf1579];return _0x588de2;};'use strict';var _=require(_0xb5c2('0x0'));var util=require(_0xb5c2('0x1'));var logger=require(_0xb5c2('0x2'))(_0xb5c2('0x3'));var moment=require(_0xb5c2('0x4'));var BPromise=require('bluebird');var rp=require(_0xb5c2('0x5'));var fs=require('fs');var path=require(_0xb5c2('0x6'));var rimraf=require(_0xb5c2('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0xb5c2('0x8')]=function(_0x1de052,_0x4e0c73){return _0x1de052['define'](_0xb5c2('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','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 0019618..da43d93 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 _0xef7a=['jayson/promise','http','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x17a29e,_0x242d8c){var _0x26f32e=function(_0x504e74){while(--_0x504e74){_0x17a29e['push'](_0x17a29e['shift']());}};_0x26f32e(++_0x242d8c);}(_0xef7a,0x199));var _0xaef7=function(_0x5b323e,_0x137407){_0x5b323e=_0x5b323e-0x0;var _0x4fa5df=_0xef7a[_0x5b323e];return _0x4fa5df;};'use strict';var _=require(_0xaef7('0x0'));var util=require(_0xaef7('0x1'));var moment=require(_0xaef7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaef7('0x3'));var db=require(_0xaef7('0x4'))['db'];var utils=require(_0xaef7('0x5'));var logger=require(_0xaef7('0x6'))(_0xaef7('0x7'));var config=require(_0xaef7('0x8'));var jayson=require(_0xaef7('0x9'));var client=jayson['client'][_0xaef7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4949ed,_0x20270e,_0x30f729){return new BPromise(function(_0x486655,_0x34e89a){return client[_0xaef7('0xb')](_0x4949ed,_0x30f729)['then'](function(_0x1b0e87){logger['info'](_0xaef7('0xc'),_0x20270e,_0xaef7('0xd'));logger[_0xaef7('0xe')](_0xaef7('0xf'),_0x20270e,_0xaef7('0xd'),JSON['stringify'](_0x1b0e87));if(_0x1b0e87[_0xaef7('0x10')]){if(_0x1b0e87[_0xaef7('0x10')][_0xaef7('0x11')]===0x1f4){logger[_0xaef7('0x10')](_0xaef7('0xc'),_0x20270e,_0x1b0e87['error'][_0xaef7('0x12')]);return _0x34e89a(_0x1b0e87[_0xaef7('0x10')]['message']);}logger[_0xaef7('0x10')](_0xaef7('0xc'),_0x20270e,_0x1b0e87[_0xaef7('0x10')]['message']);return _0x486655(_0x1b0e87['error']['message']);}else{logger[_0xaef7('0x13')](_0xaef7('0xc'),_0x20270e,'request\x20sent');_0x486655(_0x1b0e87[_0xaef7('0x14')]['message']);}})[_0xaef7('0x15')](function(_0x5dd976){logger[_0xaef7('0x10')](_0xaef7('0xc'),_0x20270e,_0x5dd976);_0x34e89a(_0x5dd976);});});} \ No newline at end of file +var _0xa514=['request','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4dca38,_0x5dfae1){var _0x44656c=function(_0x538a62){while(--_0x538a62){_0x4dca38['push'](_0x4dca38['shift']());}};_0x44656c(++_0x5dfae1);}(_0xa514,0x1e3));var _0x4a51=function(_0x5bc14b,_0x1d00da){_0x5bc14b=_0x5bc14b-0x0;var _0x203e6d=_0xa514[_0x5bc14b];return _0x203e6d;};'use strict';var _=require(_0x4a51('0x0'));var util=require('util');var moment=require(_0x4a51('0x1'));var BPromise=require(_0x4a51('0x2'));var rs=require(_0x4a51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a51('0x5'))(_0x4a51('0x6'));var config=require(_0x4a51('0x7'));var jayson=require(_0x4a51('0x8'));var client=jayson[_0x4a51('0x9')][_0x4a51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x129ed2,_0x302143,_0x194da){return new BPromise(function(_0xbfe70b,_0x2761de){return client[_0x4a51('0xb')](_0x129ed2,_0x194da)['then'](function(_0x25a553){logger['info'](_0x4a51('0xc'),_0x302143,'request\x20sent');logger[_0x4a51('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x302143,_0x4a51('0xe'),JSON['stringify'](_0x25a553));if(_0x25a553[_0x4a51('0xf')]){if(_0x25a553[_0x4a51('0xf')]['code']===0x1f4){logger[_0x4a51('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x302143,_0x25a553[_0x4a51('0xf')][_0x4a51('0x10')]);return _0x2761de(_0x25a553[_0x4a51('0xf')][_0x4a51('0x10')]);}logger[_0x4a51('0xf')](_0x4a51('0xc'),_0x302143,_0x25a553[_0x4a51('0xf')][_0x4a51('0x10')]);return _0xbfe70b(_0x25a553[_0x4a51('0xf')]['message']);}else{logger[_0x4a51('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x302143,_0x4a51('0xe'));_0xbfe70b(_0x25a553[_0x4a51('0x12')]['message']);}})['catch'](function(_0x1285fc){logger[_0x4a51('0xf')](_0x4a51('0xc'),_0x302143,_0x1285fc);_0x2761de(_0x1285fc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a294765..4b9acdc 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 _0xbdc0=['isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x201d3d,_0x5e4db3){var _0x9b08db=function(_0x18b5ef){while(--_0x18b5ef){_0x201d3d['push'](_0x201d3d['shift']());}};_0x9b08db(++_0x5e4db3);}(_0xbdc0,0xfe));var _0x0bdc=function(_0x1461fd,_0x4a6c68){_0x1461fd=_0x1461fd-0x0;var _0xffefac=_0xbdc0[_0x1461fd];return _0xffefac;};'use strict';var multer=require(_0x0bdc('0x0'));var util=require(_0x0bdc('0x1'));var path=require(_0x0bdc('0x2'));var timeout=require(_0x0bdc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0bdc('0x4'));var auth=require(_0x0bdc('0x5'));var interaction=require(_0x0bdc('0x6'));var config=require(_0x0bdc('0x7'));var controller=require(_0x0bdc('0x8'));router[_0x0bdc('0x9')]('/',auth[_0x0bdc('0xa')](),controller[_0x0bdc('0xb')]);router[_0x0bdc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x0bdc('0xc')]);router[_0x0bdc('0x9')](_0x0bdc('0xd'),auth['isAuthenticated'](),controller[_0x0bdc('0xe')]);router[_0x0bdc('0xf')]('/',auth[_0x0bdc('0xa')](),controller[_0x0bdc('0x10')]);router[_0x0bdc('0x11')](_0x0bdc('0xd'),auth[_0x0bdc('0xa')](),controller[_0x0bdc('0x12')]);router[_0x0bdc('0x13')](_0x0bdc('0xd'),auth['isAuthenticated'](),controller[_0x0bdc('0x14')]);module[_0x0bdc('0x15')]=router; \ No newline at end of file +var _0x0cb3=['delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','/:id','update'];(function(_0x3f8106,_0x6cccc0){var _0x12879b=function(_0x52739d){while(--_0x52739d){_0x3f8106['push'](_0x3f8106['shift']());}};_0x12879b(++_0x6cccc0);}(_0x0cb3,0x107));var _0x30cb=function(_0x2d0336,_0x391f39){_0x2d0336=_0x2d0336-0x0;var _0x3061e5=_0x0cb3[_0x2d0336];return _0x3061e5;};'use strict';var multer=require(_0x30cb('0x0'));var util=require(_0x30cb('0x1'));var path=require('path');var timeout=require(_0x30cb('0x2'));var express=require('express');var router=express[_0x30cb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x30cb('0x4'));var interaction=require(_0x30cb('0x5'));var config=require('../../config/environment');var controller=require(_0x30cb('0x6'));router['get']('/',auth[_0x30cb('0x7')](),controller[_0x30cb('0x8')]);router[_0x30cb('0x9')](_0x30cb('0xa'),auth[_0x30cb('0x7')](),controller[_0x30cb('0xb')]);router[_0x30cb('0x9')]('/:id',auth[_0x30cb('0x7')](),controller[_0x30cb('0xc')]);router[_0x30cb('0xd')]('/',auth[_0x30cb('0x7')](),controller[_0x30cb('0xe')]);router['put'](_0x30cb('0xf'),auth[_0x30cb('0x7')](),controller[_0x30cb('0x10')]);router[_0x30cb('0x11')](_0x30cb('0xf'),auth[_0x30cb('0x7')](),controller[_0x30cb('0x12')]);module[_0x30cb('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 99fcae5..1502a45 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 _0x153f=['Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us'];(function(_0xcea0a5,_0x3c5bae){var _0x5f07cc=function(_0x391b07){while(--_0x391b07){_0xcea0a5['push'](_0xcea0a5['shift']());}};_0x5f07cc(++_0x3c5bae);}(_0x153f,0x15b));var _0xf153=function(_0x2cd460,_0x213be7){_0x2cd460=_0x2cd460-0x0;var _0xed01b=_0x153f[_0x2cd460];return _0xed01b;};'use strict';var Sequelize=require(_0xf153('0x0'));var rs=require(_0xf153('0x1'));module[_0xf153('0x2')]={'name':{'type':Sequelize[_0xf153('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'unique':_0xf153('0x4')},'description':{'type':Sequelize[_0xf153('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x5')},'key':{'type':Sequelize[_0xf153('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x6')},'customerAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf153('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf153('0x3')]},'animation':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf153('0xb'),_0xf153('0xc')),'defaultValue':_0xf153('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0xd')},'start_chat_button':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xe')},'offline_chat_button':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xf')},'header_offline':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x10')},'download_transcript':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf153('0x12')]},'closingQuestion':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x15')},'closingMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0xf')},'skipMessageButton':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x17')},'conditionAgreement':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x18')},'ratingType':{'type':Sequelize[_0xf153('0x19')](_0xf153('0x1a'),_0xf153('0x1b')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf153('0x12')],'defaultValue':function(){return JSON[_0xf153('0x1c')]({'items':[{'type':_0xf153('0x1d'),'variable':null,'config':{'placeholder':_0xf153('0x1e'),'type':_0xf153('0x1f'),'required':!![]},'props':{'title':_0xf153('0x1e'),'helpText':''}},{'type':_0xf153('0x1d'),'props':{'title':_0xf153('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xf153('0x5'),'type':_0xf153('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf153('0x20')](_0xf153('0x21'))?JSON[_0xf153('0x22')](this[_0xf153('0x20')](_0xf153('0x21'))):{};},'set':function(_0x141ef4){return this[_0xf153('0x23')](_0xf153('0x21'),JSON[_0xf153('0x1c')](_0x141ef4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf153('0x1c')]({'items':[{'type':_0xf153('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf153('0x5'),'type':_0xf153('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0xf153('0x24')},'props':{'title':_0xf153('0x24'),'helpText':_0xf153('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0xf153('0x20')](_0xf153('0x26'))?JSON[_0xf153('0x22')](this[_0xf153('0x20')](_0xf153('0x26'))):{};},'set':function(_0x19a568){return this[_0xf153('0x23')](_0xf153('0x26'),JSON[_0xf153('0x1c')](_0x19a568));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf153('0x27')]();}},'autoclose':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf153('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x29')},'skipUnmanaged':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x17')},'sendUnmanaged':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf153('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf153('0x12')],'defaultValue':function(){return _0xf153('0x2a');}},'notificationSound':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x2c')},'verticalAlignment':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2d')},'messagesAlignment':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf153('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xf153('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf153('0x9')],'comment':_0xf153('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![],'comment':_0xf153('0x31'),'set':function(_0x1ee606){if(!_0x1ee606)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf153('0x23')]('mandatoryDisposition',_0x1ee606);}},'vidaooEscalation':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf153('0x3')]},'vidaooTopic':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x32')},'vidaooNote':{'type':Sequelize[_0xf153('0x3')],'defaultValue':function(){return _0xf153('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf153('0x12')]}}; \ No newline at end of file +var _0x153f=['Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us'];(function(_0x3d934a,_0x56daac){var _0x22db26=function(_0x1c5a3f){while(--_0x1c5a3f){_0x3d934a['push'](_0x3d934a['shift']());}};_0x22db26(++_0x56daac);}(_0x153f,0x15b));var _0xf153=function(_0x1f2a49,_0x33b9b7){_0x1f2a49=_0x1f2a49-0x0;var _0x2df203=_0x153f[_0x1f2a49];return _0x2df203;};'use strict';var Sequelize=require(_0xf153('0x0'));var rs=require(_0xf153('0x1'));module[_0xf153('0x2')]={'name':{'type':Sequelize[_0xf153('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'unique':_0xf153('0x4')},'description':{'type':Sequelize[_0xf153('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x5')},'key':{'type':Sequelize[_0xf153('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x6')},'customerAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf153('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf153('0x3')]},'animation':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf153('0xb'),_0xf153('0xc')),'defaultValue':_0xf153('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0xd')},'start_chat_button':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xe')},'offline_chat_button':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xf')},'header_offline':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x10')},'download_transcript':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf153('0x12')]},'closingQuestion':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x15')},'closingMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0xf')},'skipMessageButton':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x17')},'conditionAgreement':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x18')},'ratingType':{'type':Sequelize[_0xf153('0x19')](_0xf153('0x1a'),_0xf153('0x1b')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf153('0x12')],'defaultValue':function(){return JSON[_0xf153('0x1c')]({'items':[{'type':_0xf153('0x1d'),'variable':null,'config':{'placeholder':_0xf153('0x1e'),'type':_0xf153('0x1f'),'required':!![]},'props':{'title':_0xf153('0x1e'),'helpText':''}},{'type':_0xf153('0x1d'),'props':{'title':_0xf153('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xf153('0x5'),'type':_0xf153('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf153('0x20')](_0xf153('0x21'))?JSON[_0xf153('0x22')](this[_0xf153('0x20')](_0xf153('0x21'))):{};},'set':function(_0x141ef4){return this[_0xf153('0x23')](_0xf153('0x21'),JSON[_0xf153('0x1c')](_0x141ef4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf153('0x1c')]({'items':[{'type':_0xf153('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf153('0x5'),'type':_0xf153('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0xf153('0x24')},'props':{'title':_0xf153('0x24'),'helpText':_0xf153('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0xf153('0x20')](_0xf153('0x26'))?JSON[_0xf153('0x22')](this[_0xf153('0x20')](_0xf153('0x26'))):{};},'set':function(_0x19a568){return this[_0xf153('0x23')](_0xf153('0x26'),JSON[_0xf153('0x1c')](_0x19a568));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf153('0x27')]();}},'autoclose':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf153('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x29')},'skipUnmanaged':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x17')},'sendUnmanaged':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf153('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf153('0x12')],'defaultValue':function(){return _0xf153('0x2a');}},'notificationSound':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x2c')},'verticalAlignment':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2d')},'messagesAlignment':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf153('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xf153('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf153('0x9')],'comment':_0xf153('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![],'comment':_0xf153('0x31'),'set':function(_0x1ee606){if(!_0x1ee606)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf153('0x23')]('mandatoryDisposition',_0x1ee606);}},'vidaooEscalation':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf153('0x3')]},'vidaooTopic':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x32')},'vidaooNote':{'type':Sequelize[_0xf153('0x3')],'defaultValue':function(){return _0xf153('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf153('0x12')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7158eb3..0e701a1 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 _0xb49e=['MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Smtp','offlineMessageSubject','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','Contact','User','fullname','Tag','Tags','tag','rows','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','ONLINE','timezone','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','all','some','utf8','URL','origin','remote','x-real-ip','connection','remoteAddress','replace','alignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','Transaction','READ_COMMITTED','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','removeAgents','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','url','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','params','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','ChatWebsiteId','create','getDispositions','findOne','Disposition','nolimit','removeDispositions','addAnswer','CannedAnswer','rawAttributes','hasOwnProperty','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','x-real-port','referer','version','%s\x20%s','browser','unknown','format','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','ContactId','interaction','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate'];(function(_0x237c32,_0x38ff3d){var _0x241ad9=function(_0x1f5bb8){while(--_0x1f5bb8){_0x237c32['push'](_0x237c32['shift']());}};_0x241ad9(++_0x38ff3d);}(_0xb49e,0x17e));var _0xeb49=function(_0x2aa4e1,_0x5a6994){_0x2aa4e1=_0x2aa4e1-0x0;var _0xd6ab97=_0xb49e[_0x2aa4e1];return _0xd6ab97;};'use strict';var BPromise=require(_0xeb49('0x0'));var Mustache=require(_0xeb49('0x1'));var util=require(_0xeb49('0x2'));var path=require(_0xeb49('0x3'));var ejs=require(_0xeb49('0x4'));var fs=require('fs');var fs_extra=require(_0xeb49('0x5'));var _=require('lodash');var querystring=require(_0xeb49('0x6'));var Redis=require(_0xeb49('0x7'));var qs=require(_0xeb49('0x8'));var logger=require('../../config/logger')(_0xeb49('0x9'));var config=require(_0xeb49('0xa'));var url=require(_0xeb49('0xb'));var db=require(_0xeb49('0xc'))['db'];config[_0xeb49('0xd')]=_['defaults'](config[_0xeb49('0xd')],{'host':_0xeb49('0xe'),'port':0x18eb});var socket=require(_0xeb49('0xf'))(new Redis(config['redis']));require(_0xeb49('0x10'))[_0xeb49('0x11')](socket);var htmlToText=require(_0xeb49('0x12'));var jayson=require(_0xeb49('0x13'));var client=jayson[_0xeb49('0x14')][_0xeb49('0x15')]({'port':0x232c});var client9002=jayson[_0xeb49('0x14')][_0xeb49('0x15')]({'port':0x232a});var client9003=jayson[_0xeb49('0x14')][_0xeb49('0x15')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x113bb7,_0x3d0ab1,_0x2e5b33,_0x154357){return new BPromise(function(_0x2ec9d7,_0x56b99f){var _0xe52731=_0x154357||client;return _0xe52731['request'](_0x113bb7,_0x2e5b33)[_0xeb49('0x16')](function(_0x2c5838){logger[_0xeb49('0x17')](_0xeb49('0x18'),_0x3d0ab1,_0xeb49('0x19'));logger[_0xeb49('0x1a')](_0xeb49('0x1b'),_0x3d0ab1,_0xeb49('0x19'),JSON[_0xeb49('0x1c')](_0x2c5838));if(_0x2c5838[_0xeb49('0x1d')]){if(_0x2c5838[_0xeb49('0x1d')][_0xeb49('0x1e')]===0x1f4){logger['error'](_0xeb49('0x18'),_0x3d0ab1,_0x2c5838[_0xeb49('0x1d')][_0xeb49('0x1f')]);return _0x56b99f(_0x2c5838['error'][_0xeb49('0x1f')]);}logger[_0xeb49('0x1d')](_0xeb49('0x18'),_0x3d0ab1,_0x2c5838['error'][_0xeb49('0x1f')]);return _0x2ec9d7(_0x2c5838['error']['message']);}else{logger['info'](_0xeb49('0x18'),_0x3d0ab1,_0xeb49('0x19'));_0x2ec9d7(_0x2c5838[_0xeb49('0x20')][_0xeb49('0x1f')]);}})[_0xeb49('0x21')](function(_0x16db18){logger[_0xeb49('0x1d')](_0xeb49('0x18'),_0x3d0ab1,_0x16db18);_0x56b99f(_0x16db18);});});}function respondWithStatusCode(_0x4d84ea,_0x550b45){_0x550b45=_0x550b45||0xcc;return function(_0xaebcdb){if(_0xaebcdb){return _0x4d84ea[_0xeb49('0x22')](_0x550b45);}return _0x4d84ea[_0xeb49('0x23')](_0x550b45)[_0xeb49('0x24')]();};}function respondWithResult(_0x4aeda6,_0x1373b9){_0x1373b9=_0x1373b9||0xc8;return function(_0x4778ba){if(_0x4778ba){return _0x4aeda6[_0xeb49('0x23')](_0x1373b9)[_0xeb49('0x25')](_0x4778ba);}};}function respondWithFilteredResult(_0x513fc3,_0x29fc73){return function(_0x35e5b6){if(_0x35e5b6){var _0x2cbf22=typeof _0x29fc73[_0xeb49('0x26')]===_0xeb49('0x27')&&typeof _0x29fc73[_0xeb49('0x28')]===_0xeb49('0x27');var _0x5bd77c=_0x35e5b6[_0xeb49('0x29')];var _0x40d49e=_0x2cbf22?0x0:_0x29fc73['offset'];var _0x33a0d2=_0x2cbf22?_0x35e5b6[_0xeb49('0x29')]:_0x29fc73[_0xeb49('0x26')]+_0x29fc73[_0xeb49('0x28')];var _0x34e455;if(_0x33a0d2>=_0x5bd77c){_0x33a0d2=_0x5bd77c;_0x34e455=0xc8;}else{_0x34e455=0xce;}_0x513fc3[_0xeb49('0x23')](_0x34e455);return _0x513fc3[_0xeb49('0x2a')]('Content-Range',_0x40d49e+'-'+_0x33a0d2+'/'+_0x5bd77c)[_0xeb49('0x25')](_0x35e5b6);}return null;};}function saveUpdates(_0x97e187){return function(_0x32f277){if(_0x32f277){return _0x32f277['update'](_0x97e187)[_0xeb49('0x16')](function(_0x5bd850){return _0x5bd850;});}return null;};}function removeEntity(_0x31eab5){return function(_0x16129d){if(_0x16129d){return _0x16129d[_0xeb49('0x2b')]()[_0xeb49('0x16')](function(){var _0x5bcd34=_0x16129d['get']({'plain':!![]});var _0x26f519=_0xeb49('0x2c');return db[_0xeb49('0x2d')][_0xeb49('0x2b')]({'where':{'type':_0x26f519,'resourceId':_0x5bcd34['id']}})[_0xeb49('0x16')](function(){return _0x16129d;});})[_0xeb49('0x16')](function(){_0x31eab5[_0xeb49('0x23')](0xcc)[_0xeb49('0x24')]();});}};}function handleEntityNotFound(_0x528057){return function(_0x218cd8){if(!_0x218cd8){_0x528057[_0xeb49('0x22')](0x194);}return _0x218cd8;};}function handleError(_0x212b6f,_0x22a35a){_0x22a35a=_0x22a35a||0x1f4;return function(_0x2ddaf6){logger['error'](_0x2ddaf6[_0xeb49('0x2e')]);if(_0x2ddaf6[_0xeb49('0x2f')]){delete _0x2ddaf6[_0xeb49('0x2f')];}_0x212b6f[_0xeb49('0x23')](_0x22a35a)['send'](_0x2ddaf6);};}exports[_0xeb49('0x30')]=function(_0x2c2137,_0x4094e8){var _0x5b7e61={'include':[{'model':db[_0xeb49('0x31')],'as':_0xeb49('0x32')}]},_0xe9664a={},_0x2c45de={'count':0x0,'rows':[]};var _0xbe6b8b=_[_0xeb49('0x33')](db[_0xeb49('0x34')]['rawAttributes'],function(_0x2419f8){return{'name':_0x2419f8['fieldName'],'type':_0x2419f8[_0xeb49('0x35')]['key']};});_0xe9664a[_0xeb49('0x36')]=_[_0xeb49('0x33')](_0xbe6b8b,_0xeb49('0x2f'));_0xe9664a[_0xeb49('0x37')]=_[_0xeb49('0x38')](_0x2c2137['query']);_0xe9664a['filters']=_[_0xeb49('0x39')](_0xe9664a['model'],_0xe9664a['query']);_0x5b7e61[_0xeb49('0x3a')]=_['intersection'](_0xe9664a[_0xeb49('0x36')],qs[_0xeb49('0x3b')](_0x2c2137[_0xeb49('0x37')][_0xeb49('0x3b')]));_0x5b7e61[_0xeb49('0x3a')]=_0x5b7e61[_0xeb49('0x3a')][_0xeb49('0x3c')]?_0x5b7e61[_0xeb49('0x3a')]:_0xe9664a[_0xeb49('0x36')];if(!_0x2c2137[_0xeb49('0x37')]['hasOwnProperty']('nolimit')){_0x5b7e61[_0xeb49('0x28')]=qs['limit'](_0x2c2137[_0xeb49('0x37')][_0xeb49('0x28')]);_0x5b7e61[_0xeb49('0x26')]=qs[_0xeb49('0x26')](_0x2c2137['query'][_0xeb49('0x26')]);}_0x5b7e61[_0xeb49('0x3d')]=qs[_0xeb49('0x3e')](_0x2c2137['query']['sort']);_0x5b7e61[_0xeb49('0x3f')]=qs[_0xeb49('0x40')](_[_0xeb49('0x41')](_0x2c2137[_0xeb49('0x37')],_0xe9664a[_0xeb49('0x40')]),_0xbe6b8b);if(_0x2c2137[_0xeb49('0x37')]['filter']){_0x5b7e61[_0xeb49('0x3f')]=_[_0xeb49('0x42')](_0x5b7e61[_0xeb49('0x3f')],{'$or':_[_0xeb49('0x33')](_0xbe6b8b,function(_0x508cbb){if(_0x508cbb['type']!==_0xeb49('0x43')){var _0x25644a={};_0x25644a[_0x508cbb['name']]={'$like':'%'+_0x2c2137[_0xeb49('0x37')][_0xeb49('0x44')]+'%'};return _0x25644a;}})});}_0x5b7e61=_['merge']({},_0x5b7e61,_0x2c2137[_0xeb49('0x45')]);var _0x424fd0={'where':_0x5b7e61['where']};return db[_0xeb49('0x34')]['count'](_0x424fd0)[_0xeb49('0x16')](function(_0x150f2e){_0x2c45de[_0xeb49('0x29')]=_0x150f2e;if(_0x2c2137[_0xeb49('0x37')]['includeAll']){_0x5b7e61[_0xeb49('0x46')]=[{'all':!![]}];}return db[_0xeb49('0x34')][_0xeb49('0x47')](_0x5b7e61);})['then'](function(_0x3c6314){_0x2c45de['rows']=_0x3c6314;return _0x2c45de;})[_0xeb49('0x16')](respondWithFilteredResult(_0x4094e8,_0x5b7e61))[_0xeb49('0x21')](handleError(_0x4094e8,null));};exports['show']=function(_0x539b78,_0x8704ce){var _0x4d71d5={'raw':![],'where':{'id':_0x539b78[_0xeb49('0x48')]['id']},'include':[{'model':db[_0xeb49('0x31')],'as':_0xeb49('0x32')}]},_0x227103={};_0x227103['model']=_[_0xeb49('0x38')](db[_0xeb49('0x34')]['rawAttributes']);_0x227103[_0xeb49('0x37')]=_['keys'](_0x539b78[_0xeb49('0x37')]);_0x227103['filters']=_[_0xeb49('0x39')](_0x227103['model'],_0x227103[_0xeb49('0x37')]);_0x4d71d5[_0xeb49('0x3a')]=_[_0xeb49('0x39')](_0x227103[_0xeb49('0x36')],qs['fields'](_0x539b78[_0xeb49('0x37')][_0xeb49('0x3b')]));_0x4d71d5[_0xeb49('0x3a')]=_0x4d71d5[_0xeb49('0x3a')][_0xeb49('0x3c')]?_0x4d71d5[_0xeb49('0x3a')]:_0x227103['model'];if(_0x539b78[_0xeb49('0x37')][_0xeb49('0x49')]){_0x4d71d5[_0xeb49('0x46')]=[{'all':!![]}];}_0x4d71d5=_[_0xeb49('0x42')]({},_0x4d71d5,_0x539b78[_0xeb49('0x45')]);return db[_0xeb49('0x34')][_0xeb49('0x4a')](_0x4d71d5)[_0xeb49('0x16')](handleEntityNotFound(_0x8704ce,null))[_0xeb49('0x16')](respondWithResult(_0x8704ce,null))[_0xeb49('0x21')](handleError(_0x8704ce,null));};exports['create']=function(_0x15a600,_0x3bac11){return db[_0xeb49('0x34')]['create'](_0x15a600[_0xeb49('0x4b')],{})[_0xeb49('0x16')](function(_0x9ecea3){var _0x2a7585=_0x15a600[_0xeb49('0x4c')][_0xeb49('0x4d')]({'plain':!![]});if(!_0x2a7585)throw new Error(_0xeb49('0x4e'));if(_0x2a7585[_0xeb49('0x4f')]===_0xeb49('0x4c')){var _0x2b01e0=_0x9ecea3['get']({'plain':!![]});var _0x507b11=_0xeb49('0x2c');return db[_0xeb49('0x50')][_0xeb49('0x4a')]({'where':{'name':_0x507b11,'userProfileId':_0x2a7585['userProfileId']},'raw':!![]})[_0xeb49('0x16')](function(_0x1069a8){if(_0x1069a8&&_0x1069a8['autoAssociation']===0x0){return db[_0xeb49('0x2d')]['create']({'name':_0x2b01e0[_0xeb49('0x2f')],'resourceId':_0x2b01e0['id'],'type':_0x1069a8[_0xeb49('0x2f')],'sectionId':_0x1069a8['id']},{})[_0xeb49('0x16')](function(){return _0x9ecea3;});}else{return _0x9ecea3;}})[_0xeb49('0x21')](function(_0x2a6874){logger[_0xeb49('0x1d')](_0xeb49('0x51'),_0x2a6874);throw _0x2a6874;});}return _0x9ecea3;})[_0xeb49('0x16')](respondWithResult(_0x3bac11,0xc9))[_0xeb49('0x21')](handleError(_0x3bac11,null));};exports[_0xeb49('0x52')]=function(_0x3e2bae,_0x2a76f6){if(_0x3e2bae[_0xeb49('0x4b')]['id']){delete _0x3e2bae[_0xeb49('0x4b')]['id'];}return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x3e2bae[_0xeb49('0x48')]['id']},'include':[{'model':db[_0xeb49('0x31')],'as':'mandatoryDispositionPause'}]})[_0xeb49('0x16')](handleEntityNotFound(_0x2a76f6,null))['then'](saveUpdates(_0x3e2bae[_0xeb49('0x4b')],null))[_0xeb49('0x16')](respondWithResult(_0x2a76f6,null))[_0xeb49('0x21')](handleError(_0x2a76f6,null));};exports[_0xeb49('0x2b')]=function(_0x4d429f,_0x2d538c){return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x4d429f[_0xeb49('0x48')]['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x2d538c,null))[_0xeb49('0x16')](removeEntity(_0x2d538c,null))[_0xeb49('0x21')](handleError(_0x2d538c,null));};exports[_0xeb49('0x53')]=function(_0x3b0f55,_0x4c4476){return db[_0xeb49('0x34')][_0xeb49('0x53')]()[_0xeb49('0x16')](respondWithResult(_0x4c4476,null))[_0xeb49('0x21')](handleError(_0x4c4476,null));};exports['addDisposition']=function(_0x339a0f,_0x14642f){if(_0x339a0f[_0xeb49('0x4b')]['id']){delete _0x339a0f[_0xeb49('0x4b')]['id'];}return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x339a0f['params']['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x14642f,null))[_0xeb49('0x16')](function(_0x11e79a){if(_0x11e79a){_0x339a0f[_0xeb49('0x4b')][_0xeb49('0x54')]=_0x11e79a['id'];return db['Disposition'][_0xeb49('0x55')](_0x339a0f['body']);}})['then'](respondWithResult(_0x14642f,null))['catch'](handleError(_0x14642f,null));};exports[_0xeb49('0x56')]=function(_0x1d69bb,_0x247782){var _0x5323af={'raw':![],'where':{}};var _0x5360aa={};var _0x2a83bf={'count':0x0,'rows':[]};return db[_0xeb49('0x34')][_0xeb49('0x57')]({'where':{'id':_0x1d69bb[_0xeb49('0x48')]['id']}})['then'](handleEntityNotFound(_0x247782,null))['then'](function(_0xfea1ce){if(_0xfea1ce){_0x5360aa[_0xeb49('0x36')]=_[_0xeb49('0x38')](db[_0xeb49('0x58')]['rawAttributes']);_0x5360aa[_0xeb49('0x37')]=_[_0xeb49('0x38')](_0x1d69bb[_0xeb49('0x37')]);_0x5360aa[_0xeb49('0x40')]=_[_0xeb49('0x39')](_0x5360aa[_0xeb49('0x36')],_0x5360aa[_0xeb49('0x37')]);_0x5323af[_0xeb49('0x3a')]=_[_0xeb49('0x39')](_0x5360aa['model'],qs[_0xeb49('0x3b')](_0x1d69bb['query'][_0xeb49('0x3b')]));_0x5323af[_0xeb49('0x3a')]=_0x5323af[_0xeb49('0x3a')][_0xeb49('0x3c')]?_0x5323af[_0xeb49('0x3a')]:_0x5360aa['model'];if(!_0x1d69bb['query']['hasOwnProperty'](_0xeb49('0x59'))){_0x5323af[_0xeb49('0x28')]=qs[_0xeb49('0x28')](_0x1d69bb[_0xeb49('0x37')][_0xeb49('0x28')]);_0x5323af['offset']=qs[_0xeb49('0x26')](_0x1d69bb[_0xeb49('0x37')]['offset']);}_0x5323af[_0xeb49('0x3d')]=qs[_0xeb49('0x3e')](_0x1d69bb['query'][_0xeb49('0x3e')]);_0x5323af['where']=qs[_0xeb49('0x40')](_[_0xeb49('0x41')](_0x1d69bb['query'],_0x5360aa[_0xeb49('0x40')]));_0x5323af[_0xeb49('0x3f')][_0xeb49('0x54')]=_0xfea1ce['id'];if(_0x1d69bb['query']['filter']){_0x5323af[_0xeb49('0x3f')]=_[_0xeb49('0x42')](_0x5323af[_0xeb49('0x3f')],{'$or':_[_0xeb49('0x33')](_0x5323af['attributes'],function(_0x3ecda8){var _0x11962b={};_0x11962b[_0x3ecda8]={'$like':'%'+_0x1d69bb[_0xeb49('0x37')][_0xeb49('0x44')]+'%'};return _0x11962b;})});}_0x5323af=_['merge']({},_0x5323af,_0x1d69bb[_0xeb49('0x45')]);return db['Disposition'][_0xeb49('0x29')]({'where':_0x5323af['where']})[_0xeb49('0x16')](function(_0x54ab17){_0x2a83bf[_0xeb49('0x29')]=_0x54ab17;if(_0x1d69bb[_0xeb49('0x37')][_0xeb49('0x49')]){_0x5323af[_0xeb49('0x46')]=[{'all':!![]}];}return db['Disposition'][_0xeb49('0x47')](_0x5323af);})[_0xeb49('0x16')](function(_0x548596){_0x2a83bf['rows']=_0x548596;return _0x2a83bf;});}})['then'](respondWithFilteredResult(_0x247782,_0x5323af))['catch'](handleError(_0x247782,null));};exports[_0xeb49('0x5a')]=function(_0x2adfec,_0x14d8f2){return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x2adfec[_0xeb49('0x48')]['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x14d8f2,null))[_0xeb49('0x16')](function(_0x54c8d4){if(_0x54c8d4){return _0x54c8d4[_0xeb49('0x5a')](_0x2adfec[_0xeb49('0x37')]['ids']);}})['then'](respondWithStatusCode(_0x14d8f2,null))[_0xeb49('0x21')](handleError(_0x14d8f2,null));};exports[_0xeb49('0x5b')]=function(_0x2b4423,_0x332029){if(_0x2b4423['body']['id']){delete _0x2b4423[_0xeb49('0x4b')]['id'];}return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x2b4423[_0xeb49('0x48')]['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x332029,null))[_0xeb49('0x16')](function(_0x1ce59b){if(_0x1ce59b){_0x2b4423[_0xeb49('0x4b')][_0xeb49('0x54')]=_0x1ce59b['id'];return db[_0xeb49('0x5c')][_0xeb49('0x55')](_0x2b4423[_0xeb49('0x4b')]);}})[_0xeb49('0x16')](respondWithResult(_0x332029,null))[_0xeb49('0x21')](handleError(_0x332029,null));};exports['getAnswers']=function(_0x54c87d,_0x130073){var _0x42fcff={'raw':![],'where':{}};var _0x4ec1f2={};var _0x508ce0={'count':0x0,'rows':[]};return db[_0xeb49('0x34')][_0xeb49('0x57')]({'where':{'id':_0x54c87d[_0xeb49('0x48')]['id']}})['then'](handleEntityNotFound(_0x130073,null))['then'](function(_0x2df7ed){if(_0x2df7ed){_0x4ec1f2['model']=_[_0xeb49('0x38')](db[_0xeb49('0x5c')][_0xeb49('0x5d')]);_0x4ec1f2[_0xeb49('0x37')]=_[_0xeb49('0x38')](_0x54c87d[_0xeb49('0x37')]);_0x4ec1f2[_0xeb49('0x40')]=_[_0xeb49('0x39')](_0x4ec1f2[_0xeb49('0x36')],_0x4ec1f2[_0xeb49('0x37')]);_0x42fcff[_0xeb49('0x3a')]=_[_0xeb49('0x39')](_0x4ec1f2[_0xeb49('0x36')],qs['fields'](_0x54c87d[_0xeb49('0x37')][_0xeb49('0x3b')]));_0x42fcff['attributes']=_0x42fcff[_0xeb49('0x3a')][_0xeb49('0x3c')]?_0x42fcff[_0xeb49('0x3a')]:_0x4ec1f2[_0xeb49('0x36')];if(!_0x54c87d[_0xeb49('0x37')][_0xeb49('0x5e')](_0xeb49('0x59'))){_0x42fcff[_0xeb49('0x28')]=qs[_0xeb49('0x28')](_0x54c87d[_0xeb49('0x37')][_0xeb49('0x28')]);_0x42fcff[_0xeb49('0x26')]=qs[_0xeb49('0x26')](_0x54c87d['query'][_0xeb49('0x26')]);}_0x42fcff[_0xeb49('0x3d')]=qs[_0xeb49('0x3e')](_0x54c87d[_0xeb49('0x37')][_0xeb49('0x3e')]);_0x42fcff['where']=qs[_0xeb49('0x40')](_['pick'](_0x54c87d[_0xeb49('0x37')],_0x4ec1f2['filters']));_0x42fcff['where'][_0xeb49('0x54')]=_0x2df7ed['id'];if(_0x54c87d[_0xeb49('0x37')][_0xeb49('0x44')]){_0x42fcff[_0xeb49('0x3f')]=_[_0xeb49('0x42')](_0x42fcff['where'],{'$or':_['map'](_0x42fcff['attributes'],function(_0x1c6dfb){var _0x2a44bd={};_0x2a44bd[_0x1c6dfb]={'$like':'%'+_0x54c87d[_0xeb49('0x37')][_0xeb49('0x44')]+'%'};return _0x2a44bd;})});}_0x42fcff=_[_0xeb49('0x42')]({},_0x42fcff,_0x54c87d['options']);return db['CannedAnswer'][_0xeb49('0x29')]({'where':_0x42fcff[_0xeb49('0x3f')]})[_0xeb49('0x16')](function(_0xa5468b){_0x508ce0[_0xeb49('0x29')]=_0xa5468b;if(_0x54c87d[_0xeb49('0x37')]['includeAll']){_0x42fcff[_0xeb49('0x46')]=[{'all':!![]}];}return db[_0xeb49('0x5c')][_0xeb49('0x47')](_0x42fcff);})['then'](function(_0x1dead3){_0x508ce0['rows']=_0x1dead3;return _0x508ce0;});}})[_0xeb49('0x16')](respondWithFilteredResult(_0x130073,_0x42fcff))[_0xeb49('0x21')](handleError(_0x130073,null));};exports[_0xeb49('0x5f')]=function(_0x377963,_0x4f452d){return db[_0xeb49('0x34')]['find']({'where':{'id':_0x377963['params']['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x4f452d,null))[_0xeb49('0x16')](function(_0x381144){if(_0x381144){return _0x381144[_0xeb49('0x5f')](_0x377963[_0xeb49('0x37')]['ids']);}})[_0xeb49('0x16')](respondWithStatusCode(_0x4f452d,null))[_0xeb49('0x21')](handleError(_0x4f452d,null));};exports[_0xeb49('0x60')]=function(_0x780ff9,_0x306e53){_0x780ff9[_0xeb49('0x4b')]['sitepic']=_0x780ff9[_0xeb49('0x61')][_0xeb49('0x62')];return db[_0xeb49('0x34')]['find']({'where':{'id':_0x780ff9[_0xeb49('0x48')]['id']}})['then'](handleEntityNotFound(_0x306e53,null))[_0xeb49('0x16')](saveUpdates(_0x780ff9[_0xeb49('0x4b')],null))[_0xeb49('0x16')](respondWithResult(_0x306e53,null))[_0xeb49('0x21')](handleError(_0x306e53,null));};exports[_0xeb49('0x63')]=function(_0x31f23c,_0x38e908){_0x31f23c['body'][_0xeb49('0x64')]=_0x31f23c[_0xeb49('0x61')][_0xeb49('0x62')];return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x31f23c['params']['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x38e908,null))[_0xeb49('0x16')](saveUpdates(_0x31f23c[_0xeb49('0x4b')],null))['then'](respondWithResult(_0x38e908,null))[_0xeb49('0x21')](handleError(_0x38e908,null));};exports[_0xeb49('0x65')]=function(_0x1a135b,_0x1e2c46){_0x1a135b[_0xeb49('0x4b')][_0xeb49('0x66')]=_0x1a135b[_0xeb49('0x61')][_0xeb49('0x62')];return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x1a135b[_0xeb49('0x48')]['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x1e2c46,null))[_0xeb49('0x16')](saveUpdates(_0x1a135b[_0xeb49('0x4b')],null))['then'](respondWithResult(_0x1e2c46,null))[_0xeb49('0x21')](handleError(_0x1e2c46,null));};exports[_0xeb49('0x67')]=function(_0x2c31ed,_0x12b3e3){_0x2c31ed['body']['systemAvatar']=_0x2c31ed[_0xeb49('0x61')][_0xeb49('0x62')];return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x2c31ed['params']['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x12b3e3,null))[_0xeb49('0x16')](saveUpdates(_0x2c31ed[_0xeb49('0x4b')],null))[_0xeb49('0x16')](respondWithResult(_0x12b3e3,null))[_0xeb49('0x21')](handleError(_0x12b3e3,null));};exports[_0xeb49('0x68')]=function(_0x4db072,_0x321682){var _0x2326da=path[_0xeb49('0x69')](config[_0xeb49('0x6a')],_0xeb49('0x6b'));var _0x20ba4a={'where':{'id':_0x4db072['params']['id']},'attributes':['id',_0xeb49('0x6c')],'raw':!![]};var _0x4ee532=![];return require(_0xeb49('0x6d'))['getLicense']()[_0xeb49('0x16')](function(_0x58b499){if(_0x58b499){_0x4ee532=_0x58b499[_0xeb49('0x6e')];}})[_0xeb49('0x16')](function(){return db['ChatWebsite'][_0xeb49('0x4a')](_0x20ba4a);})[_0xeb49('0x16')](handleEntityNotFound(_0x321682,null))['then'](function(_0x10dcdc){if(_0x10dcdc){if(!_[_0xeb49('0x6f')](_0x10dcdc['sitepic'])){if(fs[_0xeb49('0x70')](path[_0xeb49('0x69')](config['root'],_0xeb49('0x71'),_0x10dcdc[_0xeb49('0x6c')]))&&_0x4ee532){_0x2326da=path[_0xeb49('0x69')](config['root'],'server/files/images/logos/',_0x10dcdc[_0xeb49('0x6c')]);}}return _0x321682['download'](_0x2326da);}})[_0xeb49('0x21')](handleError(_0x321682,null));};exports['getAvatar']=function(_0x277c4e,_0x3c5a30){var _0x4ff520=path['join'](config[_0xeb49('0x6a')],'server/files/images/avatars/default_avatar.png');var _0x2443b9={'where':{'id':_0x277c4e[_0xeb49('0x48')]['id']},'attributes':['id',_0xeb49('0x64')],'raw':!![]};return db['ChatWebsite'][_0xeb49('0x4a')](_0x2443b9)[_0xeb49('0x16')](handleEntityNotFound(_0x3c5a30,null))['then'](function(_0x34573f){if(_0x34573f){if(!_[_0xeb49('0x6f')](_0x34573f[_0xeb49('0x64')])){if(fs[_0xeb49('0x70')](path[_0xeb49('0x69')](config[_0xeb49('0x6a')],'server/files/images/avatars/',_0x34573f[_0xeb49('0x64')]))){_0x4ff520=path[_0xeb49('0x69')](config[_0xeb49('0x6a')],_0xeb49('0x72'),_0x34573f[_0xeb49('0x64')]);}}return _0x3c5a30[_0xeb49('0x73')](_0x4ff520);}})[_0xeb49('0x21')](handleError(_0x3c5a30,null));};exports[_0xeb49('0x74')]=function(_0x19e2d2,_0x55d327){var _0x44e675=path[_0xeb49('0x69')](config[_0xeb49('0x6a')],'server/files/images/avatars/customer_avatar.png');var _0x2ca6ab={'where':{'id':_0x19e2d2[_0xeb49('0x48')]['id']},'attributes':['id',_0xeb49('0x66'),'showCustomerAvatar'],'raw':!![]};return db[_0xeb49('0x34')][_0xeb49('0x4a')](_0x2ca6ab)[_0xeb49('0x16')](handleEntityNotFound(_0x55d327,null))[_0xeb49('0x16')](function(_0x12b2b0){if(_0x12b2b0){if(!_['isNil'](_0x12b2b0[_0xeb49('0x66')])){if(fs['existsSync'](path[_0xeb49('0x69')](config[_0xeb49('0x6a')],_0xeb49('0x72'),_0x12b2b0[_0xeb49('0x66')]))&&_0x12b2b0[_0xeb49('0x75')]){_0x44e675=path[_0xeb49('0x69')](config['root'],_0xeb49('0x72'),_0x12b2b0[_0xeb49('0x66')]);}}return _0x55d327[_0xeb49('0x73')](_0x44e675);}})[_0xeb49('0x21')](handleError(_0x55d327,null));};exports[_0xeb49('0x76')]=function(_0xf9ce54,_0x8b1af5){var _0x4a6645=path[_0xeb49('0x69')](config['root'],_0xeb49('0x77'));var _0x438fdc={'where':{'id':_0xf9ce54[_0xeb49('0x48')]['id']},'attributes':['id',_0xeb49('0x78')],'raw':!![]};return db[_0xeb49('0x34')][_0xeb49('0x4a')](_0x438fdc)[_0xeb49('0x16')](handleEntityNotFound(_0x8b1af5,null))[_0xeb49('0x16')](function(_0x3c7f5f){if(_0x3c7f5f){if(!_[_0xeb49('0x6f')](_0x3c7f5f[_0xeb49('0x78')])){if(fs[_0xeb49('0x70')](path['join'](config[_0xeb49('0x6a')],'server/files/images/avatars/',_0x3c7f5f['systemAvatar']))){_0x4a6645=path['join'](config[_0xeb49('0x6a')],_0xeb49('0x72'),_0x3c7f5f[_0xeb49('0x78')]);}}return _0x8b1af5['download'](_0x4a6645);}})[_0xeb49('0x21')](handleError(_0x8b1af5,null));};exports['notify']=function(_0x36111c,_0x3c76d9){var _0x52bad9=require(_0xeb49('0x79'));var _0x4027bd=new _0x52bad9();var _0x424eb5=_0x4027bd[_0xeb49('0x7a')](_0x36111c[_0xeb49('0x7b')][_0xeb49('0x7c')])[_0xeb49('0x7d')]();var _0x39f320={'body':_0x36111c[_0xeb49('0x4b')],'channel':_0xeb49('0x7e')};var _0x5d6970=[];var _0x309772=[];var _0x3138db={};var _0x40cd5d=![];return db[_0xeb49('0x7f')]['describe']()[_0xeb49('0x16')](function(_0x1b7e54){if(!_0x1b7e54){throw new db['Sequelize'][(_0xeb49('0x80'))](_0xeb49('0x81'));}_0x5d6970=_[_0xeb49('0x82')](_[_0xeb49('0x38')](_0x1b7e54),['createdAt',_0xeb49('0x83')]);_0x309772=_['difference'](_[_0xeb49('0x38')](_0x1b7e54),[_0xeb49('0x84'),_0xeb49('0x83'),_0xeb49('0x85'),_0xeb49('0x86')]);if(_0x36111c[_0xeb49('0x4b')]['id']){delete _0x36111c[_0xeb49('0x4b')]['id'];}if(_[_0xeb49('0x6f')](_0x36111c[_0xeb49('0x4b')][_0xeb49('0x87')])){throw new db[(_0xeb49('0x88'))]['ValidationError'](_0xeb49('0x89'));}if(_[_0xeb49('0x6f')](_0x36111c[_0xeb49('0x4b')][_0xeb49('0x4b')])||_0x36111c[_0xeb49('0x4b')]['body']===''){throw new db['Sequelize'][(_0xeb49('0x80'))](_0xeb49('0x8a'));}if(_[_0xeb49('0x6f')](_0x36111c[_0xeb49('0x4b')][_0xeb49('0x8b')])){throw new db[(_0xeb49('0x88'))][(_0xeb49('0x80'))](_0xeb49('0x8c')+_0x309772);}if(!_['includes'](_0x309772,_0x36111c['body'][_0xeb49('0x8b')])){throw new db[(_0xeb49('0x88'))][(_0xeb49('0x80'))](_0xeb49('0x8d')+_0x309772);}_0x3138db[_0x36111c[_0xeb49('0x4b')][_0xeb49('0x8b')]]=_0x36111c[_0xeb49('0x4b')][_0xeb49('0x87')];})['then'](function(){return db[_0xeb49('0x34')]['find']({'where':{'id':_0x36111c[_0xeb49('0x48')]['id']},'include':[{'model':db['CmList'],'as':_0xeb49('0x8e'),'include':[{'model':db[_0xeb49('0x7f')],'as':'Contacts','where':_0x3138db,'limit':0x1,'order':[['updatedAt',_0xeb49('0x8f')]]}]},{'model':db[_0xeb49('0x90')],'as':_0xeb49('0x91')}]});})[_0xeb49('0x16')](handleEntityNotFound(_0x3c76d9,null))[_0xeb49('0x16')](function(_0x474362){if(_0x474362&&_0x474362[_0xeb49('0x8e')]){_0x39f320[_0xeb49('0x92')]=_0x474362;_0x39f320[_0xeb49('0x93')]=_0x474362['Applications'];_0x39f320['list']=_0x474362[_0xeb49('0x8e')];_0x39f320[_0xeb49('0x93')]=_[_0xeb49('0x94')](_0x39f320[_0xeb49('0x93')],[_0xeb49('0x95')],[_0xeb49('0x96')]);if(_0x39f320[_0xeb49('0x92')][_0xeb49('0x91')]){delete _0x39f320[_0xeb49('0x92')][_0xeb49('0x91')];}if(_0x39f320[_0xeb49('0x92')][_0xeb49('0x8e')]&&_0x39f320[_0xeb49('0x92')]['List']['Contacts'][_0xeb49('0x3c')]){return _0x39f320['account'][_0xeb49('0x8e')]['Contacts'][0x0];}var _0xf01fdb=_[_0xeb49('0x97')](_0x36111c[_0xeb49('0x4b')],{'firstName':_0x36111c[_0xeb49('0x4b')]['from'],'ListId':_0x474362['ListId']});_0xf01fdb[_0x36111c['body']['mapKey']]=_0x36111c[_0xeb49('0x4b')][_0xeb49('0x87')];return db[_0xeb49('0x7f')]['create'](_0xf01fdb,{'fields':_0x5d6970,'raw':!![]});}})[_0xeb49('0x16')](handleEntityNotFound(_0x3c76d9,null))[_0xeb49('0x16')](function(_0x273d8e){_0x39f320[_0xeb49('0x98')]=_0x273d8e;var _0x17ffb5=_0x36111c['body'][_0xeb49('0x99')];if(_0x36111c['headers']['cf-connecting-ip']){_0x17ffb5=_0x36111c['headers'][_0xeb49('0x9a')];}else if(_0x36111c[_0xeb49('0x7b')][_0xeb49('0x9b')]){_0x17ffb5=_[_0xeb49('0x9c')](_0x36111c['headers'][_0xeb49('0x9b')]['split'](','));}if(_0x273d8e){var _0xe93676={'ContactId':_0x273d8e['id'],'ChatWebsiteId':_0x36111c[_0xeb49('0x48')]['id'],'from':(_0x273d8e[_0xeb49('0x9d')]||'')+'\x20'+(_0x273d8e['lastName']||''),'customerIp':_0x17ffb5,'customerPort':_0x36111c[_0xeb49('0x7b')][_0xeb49('0x9e')]?_0x36111c[_0xeb49('0x7b')]['x-real-port']:null,'referer':_0x36111c[_0xeb49('0x4b')][_0xeb49('0x9f')],'browserName':_0x424eb5['browser'][_0xeb49('0x2f')]&&_0x424eb5['browser'][_0xeb49('0xa0')]?util['format'](_0xeb49('0xa1'),_0x424eb5[_0xeb49('0xa2')][_0xeb49('0x2f')],_0x424eb5['browser'][_0xeb49('0xa0')]):_0xeb49('0xa3'),'browserVersion':_0x424eb5['browser'][_0xeb49('0xa0')]||_0xeb49('0xa3'),'osName':util[_0xeb49('0xa4')](_0xeb49('0xa1'),_0x424eb5['os'][_0xeb49('0x2f')],_0x424eb5['os']['version']),'osVersion':_0x424eb5['os']['version'],'deviceModel':_0x424eb5[_0xeb49('0xa5')][_0xeb49('0x36')]&&_0x424eb5['device']['vendor']?util['format'](_0xeb49('0xa6'),_0x424eb5[_0xeb49('0xa5')][_0xeb49('0x36')],_0x424eb5[_0xeb49('0xa5')][_0xeb49('0xa7')],_0x424eb5[_0xeb49('0xa5')][_0xeb49('0x35')]):null,'deviceVendor':_0x424eb5[_0xeb49('0xa5')][_0xeb49('0xa7')],'deviceType':_0x424eb5['device'][_0xeb49('0x35')],'formData':JSON[_0xeb49('0x1c')](_0x36111c[_0xeb49('0x4b')])};var _0x5f1c63={'ChatWebsiteId':_0x36111c[_0xeb49('0x48')]['id'],'closed':![]};if(_0x36111c[_0xeb49('0x4b')][_0xeb49('0xa8')]){_0x5f1c63[_0xeb49('0xa8')]=_0x36111c[_0xeb49('0x4b')]['threadId'];return db[_0xeb49('0xa9')][_0xeb49('0x4a')]({'where':_0x5f1c63})[_0xeb49('0x16')](function(_0x2e6773){if(_0x2e6773){return[_0x2e6773,![]];}_0xe93676[_0xeb49('0xa8')]=_0x36111c[_0xeb49('0x4b')][_0xeb49('0xa8')];_0xe93676['externalUrl']=_0x36111c['body']['externalUrl'];return db[_0xeb49('0xa9')][_0xeb49('0x55')](_0xe93676)[_0xeb49('0x16')](function(_0x64c9ac){return[_0x64c9ac,!![]];});});}_0x5f1c63[_0xeb49('0xaa')]=_0x273d8e['id'];if(_0x36111c[_0xeb49('0x4b')][_0xeb49('0xab')]&&_0x36111c[_0xeb49('0x4b')][_0xeb49('0xab')]['id']){_0x5f1c63['id']=_0x36111c[_0xeb49('0x4b')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x5f1c63})['then'](function(_0x5ee14e){if(_0x5ee14e){return[_0x5ee14e,![]];}return db[_0xeb49('0xa9')][_0xeb49('0x55')](_0xe93676)[_0xeb49('0x16')](function(_0x5ec69f){return[_0x5ec69f,!![]];});});}return db[_0xeb49('0xa9')][_0xeb49('0x55')](_0xe93676)[_0xeb49('0x16')](function(_0xe1134d){return[_0xe1134d,!![]];});}})['spread'](function(_0x74205c,_0x2cbe82){if(_0x74205c){_0x40cd5d=_0x2cbe82;if(!_0x2cbe82){var _0x270adb={'from':(_0x39f320[_0xeb49('0x98')][_0xeb49('0x9d')]||'')+'\x20'+(_0x39f320[_0xeb49('0x98')][_0xeb49('0xac')]||'')};if(_0x36111c[_0xeb49('0x4b')][_0xeb49('0xa8')]&&_0x36111c[_0xeb49('0x4b')]['messageId']&&_0x36111c[_0xeb49('0x4b')][_0xeb49('0xa8')]!=_0x36111c['body'][_0xeb49('0xad')]){_0x270adb['threadId']=_0x36111c[_0xeb49('0x4b')]['messageId'];}return _0x74205c['update'](_0x270adb);}else{return _0x74205c;}}})[_0xeb49('0x16')](function(_0x37c1fd){_0x39f320[_0xeb49('0xab')]=_0x37c1fd[_0xeb49('0x4d')]({'plain':!![]});_0x39f320[_0xeb49('0xab')][_0xeb49('0xae')]=_0x40cd5d;if(_0x39f320['interaction'][_0xeb49('0xae')]){if(_0x39f320[_0xeb49('0x92')][_0xeb49('0xaf')]){_0x39f320['applications'][_0xeb49('0xb0')]({'id':0x0,'priority':_0x39f320[_0xeb49('0x93')][_0xeb49('0x3c')]+0x1,'app':_0xeb49('0xb1'),'appdata':_0xeb49('0xb2'),'interval':_0xeb49('0xb3')});}}return db[_0xeb49('0xb4')]['create']({'body':_0x36111c[_0xeb49('0x4b')][_0xeb49('0x4b')],'ChatWebsiteId':_0x36111c[_0xeb49('0x48')]['id'],'ChatInteractionId':_0x37c1fd['id'],'direction':'in','ContactId':_0x39f320[_0xeb49('0x98')]['id'],'AttachmentId':_0x36111c[_0xeb49('0x4b')][_0xeb49('0xb5')]});})[_0xeb49('0x16')](function(_0x188c95){_0x39f320[_0xeb49('0x1f')]=_0x188c95;if(_0x39f320[_0xeb49('0xab')][_0xeb49('0xb6')]){return db['User']['find']({'attributes':['id',_0xeb49('0x2f')],'where':{'id':_0x39f320[_0xeb49('0xab')][_0xeb49('0xb6')]}})['then'](function(_0x1afa8e){if(_0x1afa8e){_0x39f320[_0xeb49('0x93')][_0xeb49('0xb7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1afa8e[_0xeb49('0x2f')]+','+(_0x39f320[_0xeb49('0x92')][_0xeb49('0xb8')]||0xa),'interval':_0xeb49('0xb3')});_0x39f320[_0xeb49('0xb9')]=!![];}return respondWithRpcPromise(_0xeb49('0xba'),_0xeb49('0xbb'),_0x39f320);});}return respondWithRpcPromise(_0xeb49('0xba'),_0xeb49('0xbb'),_0x39f320);})[_0xeb49('0x16')](function(_0x566703){respondWithRpcPromise(_0xeb49('0xbc'),'EventManager',{'event':_0xeb49('0xbd'),'message':_0x566703},client9002);return _0x566703;})[_0xeb49('0x16')](respondWithResult(_0x3c76d9,null))[_0xeb49('0x21')](handleError(_0x3c76d9,null));};exports[_0xeb49('0xbe')]=function(_0x20b046,_0x3fd52c){var _0xb7e4f9,_0xeabc1a,_0x30d01e;var _0x1d3f82=[];var _0x53b88={};var _0x506b23=_0x20b046[_0xeb49('0xbf')]||[];var _0x2c4624=[];var _0x45afc2;return db['CmContact'][_0xeb49('0x53')]()[_0xeb49('0x16')](function(_0xba1c4a){if(!_0xba1c4a){throw new db[(_0xeb49('0x88'))][(_0xeb49('0x80'))](_0xeb49('0x81'));}_0x1d3f82=_[_0xeb49('0x82')](_[_0xeb49('0x38')](_0xba1c4a),[_0xeb49('0x84'),_0xeb49('0x83'),_0xeb49('0x85'),_0xeb49('0x86')]);if(_0x20b046['body']['id']){delete _0x20b046[_0xeb49('0x4b')]['id'];}if(_[_0xeb49('0x6f')](_0x20b046[_0xeb49('0x4b')]['from'])){throw _0x3fd52c['status'](0x1f4)[_0xeb49('0xc0')](new db[(_0xeb49('0x88'))][(_0xeb49('0x80'))](_0xeb49('0x89')));}if(_[_0xeb49('0x6f')](_0x20b046['body'][_0xeb49('0x4b')])||_0x20b046[_0xeb49('0x4b')]['body']===''){throw _0x3fd52c[_0xeb49('0x23')](0x1f4)[_0xeb49('0xc0')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xeb49('0x6f')](_0x20b046[_0xeb49('0x4b')][_0xeb49('0xc1')])){throw _0x3fd52c[_0xeb49('0x23')](0x1f4)[_0xeb49('0xc0')](new db['Sequelize'][(_0xeb49('0x80'))](_0xeb49('0xc2')+_0x1d3f82));}if(!_[_0xeb49('0xc3')](_0x1d3f82,_0x20b046[_0xeb49('0x4b')][_0xeb49('0xc1')])){throw _0x3fd52c[_0xeb49('0x23')](0x1f4)['send'](new db[(_0xeb49('0x88'))][(_0xeb49('0x80'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1d3f82));}_0x53b88[_0x20b046[_0xeb49('0x4b')]['mapKeyOffline']]=_0x20b046[_0xeb49('0x4b')][_0xeb49('0x87')];})[_0xeb49('0x16')](function(){return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x20b046[_0xeb49('0x48')]['id']},'include':[{'model':db[_0xeb49('0xc4')],'as':_0xeb49('0x8e')},{'model':db[_0xeb49('0xc5')],'as':_0xeb49('0xc5')}]});})[_0xeb49('0x16')](handleEntityNotFound(_0x3fd52c,null))[_0xeb49('0x16')](function(_0x5d299c){if(_0x5d299c&&_0x5d299c['List']){_0xeabc1a=_0x5d299c;var _0x5dba5b=_[_0xeb49('0x97')](_0x20b046['body'],{'firstName':_0x20b046[_0xeb49('0x4b')][_0xeb49('0x87')],'phone':_0x20b046[_0xeb49('0x4b')][_0xeb49('0x87')],'ListId':_0x5d299c[_0xeb49('0x86')]});_0x5dba5b[_0x20b046[_0xeb49('0x4b')][_0xeb49('0xc1')]]=_0x20b046[_0xeb49('0x4b')][_0xeb49('0x87')];return db[_0xeb49('0x7f')][_0xeb49('0xc6')]({'where':_0x53b88,'defaults':_0x5dba5b});}})[_0xeb49('0xc7')](function(_0x2369a9){if(_0x2369a9){_0x30d01e=_0x2369a9;var _0x483d34=fs[_0xeb49('0xc8')](path[_0xeb49('0x69')](config['root'],_0xeb49('0xc9')),'utf8');var _0x52a99d=ejs[_0xeb49('0xca')](_0x483d34,{'body':_[_0xeb49('0xcb')](_0x20b046[_0xeb49('0x4b')]['body']),'bodyTitle':_0xeabc1a[_0xeb49('0xcc')]});return db[_0xeb49('0xcd')][_0xeb49('0x55')]({'body':_0x52a99d,'plainBody':htmlToText[_0xeb49('0xce')](_0x52a99d),'ContactId':_0x2369a9['id'],'ChatWebsiteId':_0xeabc1a['id']});}})['then'](function(_0x14b8f0){_0x45afc2=_0x14b8f0;if(_0x506b23['length']){var _0x27d468=_0x506b23[_0xeb49('0x33')](function(_0x1eb2d7){return{'name':_0x1eb2d7[_0xeb49('0xcf')],'basename':_0x1eb2d7[_0xeb49('0x62')],'type':_0x1eb2d7[_0xeb49('0xd0')],'ChatOfflineMessageId':_0x14b8f0['id']};});_0x2c4624=_0x27d468[_0xeb49('0x33')](_0x3f51a4=>{var _0x4e809c={'filename':_0x3f51a4['name'],'path':path[_0xeb49('0x69')](config['root'],_0xeb49('0xd1'),_0xeb49('0xbf'),'attachments',_0xeb49('0xd2'),_0x3f51a4[_0xeb49('0xd3')])};return _0x4e809c;});if(!_0xeabc1a[_0xeb49('0xd4')]){return db['sequelize'][_0xeb49('0xd5')](function(_0x29f14c){return db[_0xeb49('0xd6')][_0xeb49('0xd7')](_0x27d468,{'transaction':_0x29f14c});});}}})[_0xeb49('0x16')](function(){if(_0x45afc2){_0xb7e4f9=_0x45afc2;return db[_0xeb49('0xc5')][_0xeb49('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0xeb49('0xd8')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xeb49('0xd9')],'as':_0xeb49('0xd9'),'raw':!![]}]}]});}})['then'](function(_0x14bf65){if(_0x14bf65&&_0x14bf65['Smtp']&&_0xeabc1a[_0xeb49('0xda')]&&_0xeabc1a[_0xeb49('0xdb')]){var _0x5f0890=_0x14bf65[_0xeb49('0xdc')]();return respondWithRpcPromise(_0xeb49('0xdd'),_0xeb49('0xde'),{'account':_0x5f0890,'message':{'from':util[_0xeb49('0xa4')](_0xeb49('0xdf'),_0x14bf65['name'],_0x14bf65[_0xeb49('0xe0')]||_0x14bf65[_0xeb49('0xe1')][_0xeb49('0x4c')]),'to':_0xeabc1a[_0xeb49('0xdb')],'subject':_0xeabc1a[_0xeb49('0xe2')],'html':_0xb7e4f9[_0xeb49('0x4b')],'attachments':_0x2c4624}},client9003)[_0xeb49('0x16')](function(){return _0xb7e4f9;})[_0xeb49('0x21')](function(_0x242ed5){logger[_0xeb49('0x1d')](_0x242ed5);});}})[_0xeb49('0x16')](function(){if(_0xeabc1a&&_0xeabc1a[_0xeb49('0xd4')]&&_0xeabc1a['MailAccountId']){var _0x1559d3=[];if(_0x506b23[_0xeb49('0x3c')]){_0x1559d3=_0x506b23[_0xeb49('0x33')](function(_0x809f39){return{'name':_0x809f39[_0xeb49('0xcf')],'basename':_0x809f39[_0xeb49('0x62')],'type':_0x809f39[_0xeb49('0xd0')],'ChatOfflineMessageId':_0x45afc2['id']};});}var _0x4acb4c;if(!_[_0xeb49('0x6f')](_0xeabc1a['subjectOffline'])){var _0x11d045=_[_0xeb49('0x33')](_0x20b046[_0xeb49('0x4b')],function(_0x4c697e){return _0x4c697e;});var _0x3af7fe=_[_0xeb49('0xe3')](_0x11d045)[0x0];var _0x10361d=_[_0xeb49('0xe4')](_0x3af7fe,function(_0x2ed51c){return _0x2ed51c;});_0x4acb4c=_0x10361d[0x1][_0xeabc1a['subjectOffline']];}var _0x58ffa6={'from':_0x30d01e['email'],'firstName':_0x30d01e[_0xeb49('0x9d')],'lastName':_0x30d01e[_0xeb49('0xac')],'mapKey':_0xeb49('0xe0'),'message':{'from':_0x30d01e[_0xeb49('0xe0')],'to':_0xeabc1a['MailAccount'][_0xeb49('0xe0')],'cc':'','subject':_[_0xeb49('0x6f')](_0x4acb4c)?_0xeabc1a['offlineMessageSubject']:_0x4acb4c,'messageId':'','sentAt':new Date(),'attach':_0x1559d3['length'],'attachments':_0x1559d3,'originChannel':_0xeb49('0xe5'),'ChatWebsiteId':_0xeabc1a['id'],'ChatOfflineMessageId':_0xb7e4f9['id'],'originTo':_0xeabc1a['MailAccount'][_0xeb49('0xe0')]},'body':_0xb7e4f9[_0xeb49('0x4b')]};var _0x461d10={'account':{'id':_0xeabc1a[_0xeb49('0xe6')]},'body':_0x58ffa6,'log':_0xeb49('0xe7')};return respondWithRpcPromise(_0xeb49('0xe7'),'notifyMail',_0x461d10,client9001)[_0xeb49('0x16')](function(){return _0xb7e4f9;})['catch'](function(_0x29a658){logger[_0xeb49('0x1d')](_0x29a658);});}return;})[_0xeb49('0x16')](function(){if(_0xb7e4f9){return _0xb7e4f9;}})['then'](respondWithResult(_0x3fd52c,null))[_0xeb49('0x21')](function(_0x3655a6){logger[_0xeb49('0x1d')](_0xeb49('0x21'),_0x3655a6);for(var _0x5ad99a of _0x506b23){var _0x37cbcd=path[_0xeb49('0x69')](config[_0xeb49('0x6a')],'server','files','attachments',_0xeb49('0xd2'),_0x5ad99a[_0xeb49('0x62')]);fs_extra['remove'](_0x37cbcd)[_0xeb49('0x21')](function(_0x130947){logger[_0xeb49('0x1d')](_0xeb49('0xe8'),_0x37cbcd,_0x130947);});}});};exports[_0xeb49('0xe9')]=function(_0x2e0264,_0x1571b6){return db[_0xeb49('0xa9')]['find']({'where':{'id':_0x2e0264[_0xeb49('0x48')]['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x1571b6,null))[_0xeb49('0x16')](function(_0x587b51){if(_0x587b51){return _0x587b51['addInteraction'](_0x2e0264[_0xeb49('0x4b')][_0xeb49('0xea')],_['omit'](_0x2e0264[_0xeb49('0x4b')],[_0xeb49('0xea'),'id'])||{});}})['then'](respondWithResult(_0x1571b6,null))[_0xeb49('0x21')](handleError(_0x1571b6,null));};exports['getInteractions']=function(_0x40c46a,_0xd3705f){var _0x62d5a={'raw':![],'where':{}};var _0x1720b9={};var _0x4b2105={'count':0x0,'rows':[]};return db[_0xeb49('0x34')]['findOne']({'where':{'id':_0x40c46a[_0xeb49('0x48')]['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0xd3705f,null))[_0xeb49('0x16')](function(_0x4c279c){if(_0x4c279c){_0x1720b9['model']=_[_0xeb49('0x38')](db['ChatInteraction'][_0xeb49('0x5d')]);_0x1720b9['query']=_[_0xeb49('0x38')](_0x40c46a[_0xeb49('0x37')]);_0x1720b9['filters']=_['intersection'](_0x1720b9['model'],_0x1720b9[_0xeb49('0x37')]);_0x62d5a[_0xeb49('0x3a')]=_[_0xeb49('0x39')](_0x1720b9[_0xeb49('0x36')],qs[_0xeb49('0x3b')](_0x40c46a[_0xeb49('0x37')][_0xeb49('0x3b')]));_0x62d5a[_0xeb49('0x3a')]=_0x62d5a['attributes']['length']?_0x62d5a[_0xeb49('0x3a')]:_0x1720b9[_0xeb49('0x36')];if(!_0x40c46a[_0xeb49('0x37')]['hasOwnProperty'](_0xeb49('0x59'))){_0x62d5a[_0xeb49('0x28')]=qs[_0xeb49('0x28')](_0x40c46a[_0xeb49('0x37')][_0xeb49('0x28')]);_0x62d5a['offset']=qs[_0xeb49('0x26')](_0x40c46a[_0xeb49('0x37')]['offset']);}_0x62d5a[_0xeb49('0x3d')]=qs['sort'](_0x40c46a[_0xeb49('0x37')][_0xeb49('0x3e')]);_0x62d5a[_0xeb49('0x3f')]=qs[_0xeb49('0x40')](_[_0xeb49('0x41')](_0x40c46a[_0xeb49('0x37')],_0x1720b9['filters']));_0x62d5a[_0xeb49('0x3f')][_0xeb49('0x54')]=_0x4c279c['id'];if(_0x40c46a[_0xeb49('0x37')]['filter']){_0x62d5a[_0xeb49('0x3f')]=_[_0xeb49('0x42')](_0x62d5a['where'],{'$or':_[_0xeb49('0x33')](_0x62d5a['attributes'],function(_0x4acb53){var _0x4d11a2={};_0x4d11a2[_0x4acb53]={'$like':'%'+_0x40c46a[_0xeb49('0x37')]['filter']+'%'};return _0x4d11a2;})});}_0x62d5a=_[_0xeb49('0x42')]({},_0x62d5a,_0x40c46a[_0xeb49('0x45')]);return db[_0xeb49('0xa9')]['count']({'where':_0x62d5a[_0xeb49('0x3f')]})[_0xeb49('0x16')](function(_0x424fcd){_0x4b2105[_0xeb49('0x29')]=_0x424fcd;if(_0x40c46a['query'][_0xeb49('0x49')]){_0x62d5a['include']=[{'model':db[_0xeb49('0x7f')],'as':_0xeb49('0xeb'),'required':![]},{'model':db[_0xeb49('0xec')],'as':'Owner','attributes':[_0xeb49('0x2f'),_0xeb49('0xed'),'internal'],'required':![]},{'model':db[_0xeb49('0xee')],'as':_0xeb49('0xef'),'attributes':['id',_0xeb49('0x2f'),'color'],'where':_0x40c46a['query'][_0xeb49('0xf0')]?{'id':_0x40c46a[_0xeb49('0x37')][_0xeb49('0xf0')]}:undefined,'required':_0x40c46a[_0xeb49('0x37')][_0xeb49('0xf0')]?!![]:![]}];}return db[_0xeb49('0xa9')][_0xeb49('0x47')](_0x62d5a);})[_0xeb49('0x16')](function(_0x1be39a){_0x4b2105[_0xeb49('0xf1')]=_0x1be39a;return _0x4b2105;});}})[_0xeb49('0x16')](respondWithFilteredResult(_0xd3705f,_0x62d5a))['catch'](handleError(_0xd3705f,null));};function iftimePromise(_0xa9d5b,_0x4f9ad6){return respondWithRpcPromise(_0xeb49('0xf2'),_0xeb49('0xf3'),{'command':_0x4f9ad6['timezone']?util[_0xeb49('0xa4')](_0xeb49('0xf4'),_0xa9d5b[_0xeb49('0xf5')],_0x4f9ad6['timezone']):util[_0xeb49('0xa4')](_0xeb49('0xf6'),_0xa9d5b[_0xeb49('0xf5')])},client9002)[_0xeb49('0x16')](function(_0x1a9832){var _0x2dca27=_0x1a9832&&_0x1a9832[_0xeb49('0xf7')]('true')>=0x0?!![]:![];logger[_0xeb49('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4f9ad6['id'],_0xa9d5b['id'],_0xa9d5b[_0xeb49('0xf5')],_0x2dca27?_0xeb49('0xf8'):'OFFLINE',_0x4f9ad6[_0xeb49('0xf9')]?_0x4f9ad6[_0xeb49('0xf9')]:_0xeb49('0xfa'));return _0x2dca27;})['catch'](function(_0x21a298){logger[_0xeb49('0x1d')](_0xeb49('0xfb'),_0x4f9ad6['id'],_0xa9d5b['id'],_0xa9d5b[_0xeb49('0xf5')],util[_0xeb49('0xfc')](_0x21a298,{'showHidden':![],'depth':null}),_0x4f9ad6['timezone']?_0x4f9ad6[_0xeb49('0xf9')]:'No\x20timezone');return![];});}exports[_0xeb49('0xf3')]=function(_0x15af37,_0x40fa23){var _0x855247=0x0;var _0x1c306a=0x0;var _0x34d3b4=![];var _0x4b249d;var _0x13cc3e;return db[_0xeb49('0x34')]['find']({'where':{'id':_0x15af37['params']['id']},'include':[{'model':db[_0xeb49('0xfd')],'as':_0xeb49('0xfd'),'include':[{'model':db[_0xeb49('0xfd')],'as':_0xeb49('0xfe'),'attributes':['id',_0xeb49('0xf5')],'raw':!![]}]}]})[_0xeb49('0x16')](handleEntityNotFound(_0x40fa23,null))[_0xeb49('0x16')](function(_0x33849b){if(_0x33849b){_0x4b249d=_0x33849b;return _0x33849b[_0xeb49('0xff')]({'raw':!![]});}})[_0xeb49('0x16')](function(_0x511ef5){if(_0x4b249d){if(_0x511ef5){_0x13cc3e=_0x511ef5;}}return require(_0xeb49('0x6d'))[_0xeb49('0x100')]();})[_0xeb49('0x16')](function(_0xf793e2){if(_0xf793e2){_0x1c306a=_0xf793e2[_0xeb49('0x101')];_0x34d3b4=_0xf793e2[_0xeb49('0x6e')];}})[_0xeb49('0x16')](function(){return db[_0xeb49('0xa9')][_0xeb49('0x29')]({'where':{'closed':![]}});})[_0xeb49('0x16')](function(_0x2839b2){_0x855247=_0x2839b2;if(_0x1c306a&&_0x2839b2>_0x1c306a){return db[_0xeb49('0x102')][_0xeb49('0x57')]({'where':{'id':0x1}})[_0xeb49('0x16')](function(_0x287303){if(_0x287303){_0x287303[_0xeb49('0x103')](_0xeb49('0x104'));}});}})[_0xeb49('0x16')](function(){if(_0x4b249d[_0xeb49('0xfd')]&&_0x4b249d['Interval'][_0xeb49('0xfe')]){var _0x5c9406=[];for(var _0x5ee4e4=0x0;_0x5ee4e4<_0x4b249d[_0xeb49('0xfd')][_0xeb49('0xfe')]['length'];_0x5ee4e4++){var _0x1f0fec=_0x4b249d[_0xeb49('0xfd')][_0xeb49('0xfe')][_0x5ee4e4]['get']({'plain':!![]});_0x5c9406['push'](iftimePromise(_0x1f0fec,_0x4b249d));}return BPromise[_0xeb49('0x105')](_0x5c9406)['then'](function(_0x2babc1){return _[_0xeb49('0x106')](_0x2babc1);});}else{return!![];}})[_0xeb49('0x16')](function(_0x2f7ed1){var _0xfce85a=fs[_0xeb49('0xc8')](path[_0xeb49('0x69')](config[_0xeb49('0x6a')],'server/files/chat/iframe.ejs'),_0xeb49('0x107'));var _0x2d6d3b=new url[(_0xeb49('0x108'))](_0x4b249d['address'])[_0xeb49('0x109')];var _0x126a62='3.1.0';var _0xcd91a5=![];var _0x411c7c={'chatVersion':_0x126a62,'chatWebsiteAddressOrigin':_0x2d6d3b,'remote':_0x4b249d[_0xeb49('0x10a')],'query':querystring[_0xeb49('0x1c')](_['merge'](_0x4b249d[_0xeb49('0x4d')]({'plain':!![]}),{'customerIp':_0x15af37[_0xeb49('0x7b')]['x-forwarded-for']||_0x15af37[_0xeb49('0x7b')][_0xeb49('0x10b')]||_0x15af37[_0xeb49('0x10c')][_0xeb49('0x10d')]||_0x15af37['ip'],'referer':_0x15af37['headers'][_0xeb49('0x9f')],'openedInteractions':_0x855247,'maxInteractions':_0x1c306a,'virtual':_0x34d3b4[_0xeb49('0x101')],'online':_0x2f7ed1,'custom':_0x34d3b4}))[_0xeb49('0x10e')](/'/g,'\x5c\x27')};_0x40fa23[_0xeb49('0xc0')](ejs[_0xeb49('0xca')](Mustache[_0xeb49('0xca')](_0xfce85a,_0x411c7c),{'proactiveActions':_0x13cc3e,'alignment':_0x4b249d[_0xeb49('0x10f')],'verticalAlignment':_0x4b249d['verticalAlignment'],'div_color':_0x4b249d['color'],'labelText':_0x4b249d[_0xeb49('0x110')],'text_color':_0x4b249d[_0xeb49('0x111')],'text_button_color':_0x4b249d[_0xeb49('0x112')],'button_color':_0x4b249d[_0xeb49('0x113')],'background_color':_0x4b249d[_0xeb49('0x114')],'hideWhenOffline':_0x4b249d[_0xeb49('0x115')],'intervalId':_0x4b249d['IntervalId'],'isDevelopment':_0xcd91a5,'chatVersion':_0x126a62}));})[_0xeb49('0x21')](handleError(_0x40fa23,null));};exports['addApplications']=function(_0x133ac2,_0x1144e9){var _0x4a06a6=_0x133ac2[_0xeb49('0x48')]['id'];var _0x4d5742=_0x133ac2[_0xeb49('0x4b')];var _0x374355=0xc8;var _0x724b03=null;return db['sequelize'][_0xeb49('0xd5')]({'isolationLevel':db['sequelize'][_0xeb49('0x116')]['ISOLATION_LEVELS'][_0xeb49('0x117')]},function(_0x9757a5){return db[_0xeb49('0x34')]['findOne']({'where':{'id':_0x4a06a6},'transaction':_0x9757a5})[_0xeb49('0x16')](function(_0x367ef){if(_0x367ef){return db['ChatApplication'][_0xeb49('0x2b')]({'where':{'ChatWebsiteId':_0x4a06a6},'transaction':_0x9757a5})[_0xeb49('0x16')](function(){var _0x1a1eda=_['map'](_0x4d5742,function(_0x1ff5f1){_0x1ff5f1[_0xeb49('0x54')]=_0x4a06a6;return _0x1ff5f1;});return db[_0xeb49('0x90')][_0xeb49('0xd7')](_0x1a1eda,{'transaction':_0x9757a5});});}else{_0x374355=0x194;_0x724b03=[];}});})[_0xeb49('0x16')](function(){if(_0x374355!==0x194){return db[_0xeb49('0x90')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x4a06a6},'order':_0xeb49('0x95')})[_0xeb49('0x16')](function(_0x1bd6ab){_0x724b03=_0x1bd6ab;});}})[_0xeb49('0x21')](function(_0x1ed709){_0x374355=0x1f4;logger[_0xeb49('0x1d')](_0x1ed709[_0xeb49('0x2e')]);if(_0x1ed709[_0xeb49('0x2f')]){delete _0x1ed709['name'];}_0x724b03=_0x1ed709;})['finally'](function(){if(_0x724b03===null){_0x1144e9[_0xeb49('0x22')](_0x374355);}else{if(_0x374355===0x1f4){_0x1144e9[_0xeb49('0x23')](_0x374355)[_0xeb49('0xc0')](_0x724b03);}else{_0x1144e9[_0xeb49('0x23')](_0x374355)[_0xeb49('0x25')](_0x724b03);}}});};exports[_0xeb49('0x118')]=function(_0x15e375,_0x1d165c){var _0xedb23e={};var _0xe82b3c={};var _0x2c8d17;var _0x555b57;return db['ChatWebsite']['findOne']({'where':{'id':_0x15e375['params']['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x1d165c,null))['then'](function(_0x537fbc){if(_0x537fbc){_0x2c8d17=_0x537fbc;_0xe82b3c[_0xeb49('0x36')]=_[_0xeb49('0x38')](db['ChatApplication'][_0xeb49('0x5d')]);_0xe82b3c[_0xeb49('0x37')]=_[_0xeb49('0x38')](_0x15e375['query']);_0xe82b3c[_0xeb49('0x40')]=_[_0xeb49('0x39')](_0xe82b3c[_0xeb49('0x36')],_0xe82b3c[_0xeb49('0x37')]);_0xedb23e[_0xeb49('0x3a')]=_[_0xeb49('0x39')](_0xe82b3c[_0xeb49('0x36')],qs[_0xeb49('0x3b')](_0x15e375['query'][_0xeb49('0x3b')]));_0xedb23e[_0xeb49('0x3a')]=_0xedb23e[_0xeb49('0x3a')][_0xeb49('0x3c')]?_0xedb23e[_0xeb49('0x3a')]:_0xe82b3c['model'];_0xedb23e[_0xeb49('0x3d')]=qs[_0xeb49('0x3e')](_0x15e375[_0xeb49('0x37')][_0xeb49('0x3e')]);_0xedb23e['where']=qs[_0xeb49('0x40')](_[_0xeb49('0x41')](_0x15e375['query'],_0xe82b3c[_0xeb49('0x40')]));if(_0x15e375[_0xeb49('0x37')][_0xeb49('0x44')]){_0xedb23e[_0xeb49('0x3f')]=_[_0xeb49('0x42')](_0xedb23e[_0xeb49('0x3f')],{'$or':_['map'](_0xedb23e[_0xeb49('0x3a')],function(_0x4b4064){var _0x31e5ec={};_0x31e5ec[_0x4b4064]={'$like':'%'+_0x15e375[_0xeb49('0x37')][_0xeb49('0x44')]+'%'};return _0x31e5ec;})});}_0xedb23e=_[_0xeb49('0x42')]({},_0xedb23e,_0x15e375['options']);return _0x2c8d17[_0xeb49('0x118')](_0xedb23e);}})[_0xeb49('0x16')](function(_0x40f884){if(_0x40f884){_0x555b57=_0x40f884[_0xeb49('0x3c')];if(!_0x15e375['query']['hasOwnProperty'](_0xeb49('0x59'))){_0xedb23e[_0xeb49('0x28')]=qs[_0xeb49('0x28')](_0x15e375[_0xeb49('0x37')][_0xeb49('0x28')]);_0xedb23e['offset']=qs[_0xeb49('0x26')](_0x15e375['query'][_0xeb49('0x26')]);}return _0x2c8d17['getApplications'](_0xedb23e);}})[_0xeb49('0x16')](function(_0x86c16c){if(_0x86c16c){return _0x86c16c?{'count':_0x555b57,'rows':_0x86c16c}:null;}})[_0xeb49('0x16')](respondWithResult(_0x1d165c,null))[_0xeb49('0x21')](handleError(_0x1d165c,null));};exports[_0xeb49('0x119')]=function(_0xe5875,_0x126a33){return db[_0xeb49('0x11a')][_0xeb49('0x4a')]({'where':{'id':_0xe5875[_0xeb49('0x48')]['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x126a33,null))[_0xeb49('0x16')](function(_0x587e32){if(_0x587e32){return _0x587e32[_0xeb49('0x119')](_0xe5875[_0xeb49('0x4b')]['ids'],_[_0xeb49('0x11b')](_0xe5875[_0xeb49('0x4b')],[_0xeb49('0xea'),'id'])||{});}})[_0xeb49('0x16')](respondWithResult(_0x126a33,null))[_0xeb49('0x21')](handleError(_0x126a33,null));};exports[_0xeb49('0xff')]=function(_0x34103f,_0x5822ce){var _0xeb7578={};var _0x39d379={};var _0x1f27aa;var _0x33898e;return db[_0xeb49('0x34')]['findOne']({'where':{'id':_0x34103f[_0xeb49('0x48')]['id']}})['then'](handleEntityNotFound(_0x5822ce,null))['then'](function(_0x57a997){if(_0x57a997){_0x1f27aa=_0x57a997;_0x39d379[_0xeb49('0x36')]=_[_0xeb49('0x38')](db[_0xeb49('0x11c')][_0xeb49('0x5d')]);_0x39d379[_0xeb49('0x37')]=_[_0xeb49('0x38')](_0x34103f[_0xeb49('0x37')]);_0x39d379[_0xeb49('0x40')]=_[_0xeb49('0x39')](_0x39d379[_0xeb49('0x36')],_0x39d379[_0xeb49('0x37')]);_0xeb7578[_0xeb49('0x3a')]=_[_0xeb49('0x39')](_0x39d379[_0xeb49('0x36')],qs[_0xeb49('0x3b')](_0x34103f[_0xeb49('0x37')]['fields']));_0xeb7578[_0xeb49('0x3a')]=_0xeb7578[_0xeb49('0x3a')]['length']?_0xeb7578['attributes']:_0x39d379[_0xeb49('0x36')];_0xeb7578[_0xeb49('0x3d')]=qs[_0xeb49('0x3e')](_0x34103f[_0xeb49('0x37')][_0xeb49('0x3e')]);_0xeb7578[_0xeb49('0x3f')]=qs[_0xeb49('0x40')](_['pick'](_0x34103f[_0xeb49('0x37')],_0x39d379[_0xeb49('0x40')]));if(_0x34103f['query'][_0xeb49('0x44')]){_0xeb7578[_0xeb49('0x3f')]=_[_0xeb49('0x42')](_0xeb7578['where'],{'$or':_['map'](_0xeb7578[_0xeb49('0x3a')],function(_0x2b462c){var _0x1c9540={};_0x1c9540[_0x2b462c]={'$like':'%'+_0x34103f[_0xeb49('0x37')][_0xeb49('0x44')]+'%'};return _0x1c9540;})});}_0xeb7578=_[_0xeb49('0x42')]({},_0xeb7578,_0x34103f[_0xeb49('0x45')]);return _0x1f27aa[_0xeb49('0xff')](_0xeb7578);}})['then'](function(_0xfea1e4){if(_0xfea1e4){_0x33898e=_0xfea1e4[_0xeb49('0x3c')];if(!_0x34103f[_0xeb49('0x37')][_0xeb49('0x5e')](_0xeb49('0x59'))){_0xeb7578[_0xeb49('0x28')]=qs[_0xeb49('0x28')](_0x34103f[_0xeb49('0x37')][_0xeb49('0x28')]);_0xeb7578['offset']=qs[_0xeb49('0x26')](_0x34103f[_0xeb49('0x37')]['offset']);}return _0x1f27aa['getProactiveActions'](_0xeb7578);}})[_0xeb49('0x16')](function(_0x4387b8){if(_0x4387b8){return _0x4387b8?{'count':_0x33898e,'rows':_0x4387b8}:null;}})[_0xeb49('0x16')](respondWithResult(_0x5822ce,null))[_0xeb49('0x21')](handleError(_0x5822ce,null));};exports[_0xeb49('0x11d')]=function(_0xfdf7cc,_0xc75388){var _0x2ad09=_0xfdf7cc[_0xeb49('0x37')][_0xeb49('0x11e')]===_0xeb49('0x11f')?_0xeb49('0x120'):_0xeb49('0x121');return db[_0xeb49('0x34')]['find']({'attributes':['id',_0x2ad09],'where':{'id':_0xfdf7cc[_0xeb49('0x48')]['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0xc75388,null))[_0xeb49('0x16')](function(_0x3608aa){if(_0x3608aa){var _0x4e4ba2=_0x3608aa[_0x2ad09];var _0x4132c8=_0x4e4ba2&&_0x4e4ba2[_0xeb49('0x122')]?_0x4e4ba2[_0xeb49('0x122')]:[];_0xc75388[_0xeb49('0xc0')]({'fromKey':_[_0xeb49('0x6f')](_0x4e4ba2[_0xeb49('0x123')])?undefined:_0x4e4ba2[_0xeb49('0x123')],'count':_0x4132c8[_0xeb49('0x3c')],'rows':_0x4132c8});}})[_0xeb49('0x21')](handleError(_0xc75388,null));};exports[_0xeb49('0x124')]=function(_0x29cdf3,_0x5ce6ab){var _0x398834={'raw':![],'where':{}};var _0xd240d5={};var _0x380882={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x29cdf3[_0xeb49('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ce6ab,null))[_0xeb49('0x16')](function(_0x3cdd91){if(_0x3cdd91){_0xd240d5[_0xeb49('0x36')]=_[_0xeb49('0x38')](db[_0xeb49('0xcd')][_0xeb49('0x5d')]);_0xd240d5['query']=_['keys'](_0x29cdf3[_0xeb49('0x37')]);_0xd240d5[_0xeb49('0x40')]=_[_0xeb49('0x39')](_0xd240d5[_0xeb49('0x36')],_0xd240d5[_0xeb49('0x37')]);_0x398834[_0xeb49('0x3a')]=_[_0xeb49('0x39')](_0xd240d5['model'],qs[_0xeb49('0x3b')](_0x29cdf3[_0xeb49('0x37')][_0xeb49('0x3b')]));_0x398834[_0xeb49('0x3a')]=_0x398834[_0xeb49('0x3a')]['length']?_0x398834[_0xeb49('0x3a')]:_0xd240d5['model'];if(!_0x29cdf3[_0xeb49('0x37')][_0xeb49('0x5e')](_0xeb49('0x59'))){_0x398834[_0xeb49('0x28')]=qs[_0xeb49('0x28')](_0x29cdf3['query'][_0xeb49('0x28')]);_0x398834[_0xeb49('0x26')]=qs[_0xeb49('0x26')](_0x29cdf3[_0xeb49('0x37')][_0xeb49('0x26')]);}_0x398834[_0xeb49('0x3d')]=qs['sort'](_0x29cdf3['query']['sort']);_0x398834[_0xeb49('0x3f')]=qs[_0xeb49('0x40')](_[_0xeb49('0x41')](_0x29cdf3[_0xeb49('0x37')],_0xd240d5[_0xeb49('0x40')]));_0x398834['where'][_0xeb49('0x54')]=_0x3cdd91['id'];if(_0x29cdf3['query'][_0xeb49('0x44')]){_0x398834[_0xeb49('0x3f')]=_[_0xeb49('0x42')](_0x398834['where'],{'$or':_['map'](_0x398834[_0xeb49('0x3a')],function(_0xa96857){var _0x4c86d7={};_0x4c86d7[_0xa96857]={'$like':'%'+_0x29cdf3['query'][_0xeb49('0x44')]+'%'};return _0x4c86d7;})});}_0x398834=_[_0xeb49('0x42')]({},_0x398834,_0x29cdf3[_0xeb49('0x45')]);return db['ChatOfflineMessage']['count']({'where':_0x398834['where']})[_0xeb49('0x16')](function(_0x51d6ce){_0x380882['count']=_0x51d6ce;if(_0x29cdf3['query']['includeAll']){_0x398834[_0xeb49('0x46')]=[{'all':!![]}];}else{_0x398834[_0xeb49('0x46')]=[{'model':db[_0xeb49('0x7f')],'as':_0xeb49('0xeb'),'required':![]},{'model':db[_0xeb49('0xd6')],'as':_0xeb49('0x125'),'required':![]}];}return db['ChatOfflineMessage'][_0xeb49('0x47')](_0x398834);})[_0xeb49('0x16')](function(_0x16b856){_0x380882['rows']=_0x16b856;return _0x380882;});}})[_0xeb49('0x16')](respondWithFilteredResult(_0x5ce6ab,_0x398834))[_0xeb49('0x21')](handleError(_0x5ce6ab,null));};exports[_0xeb49('0x126')]=function(_0x5684b0,_0x3673a4){return db[_0xeb49('0x34')][_0xeb49('0x4a')]({'where':{'id':_0x5684b0[_0xeb49('0x48')]['id']}})['then'](handleEntityNotFound(_0x3673a4,null))[_0xeb49('0x16')](function(_0x32ad40){if(_0x32ad40){return _0x32ad40[_0xeb49('0x126')](_0x5684b0[_0xeb49('0x4b')][_0xeb49('0xea')],_['omit'](_0x5684b0[_0xeb49('0x4b')],[_0xeb49('0xea'),'id'])||{})[_0xeb49('0xc7')](function(_0x1b5997){for(var _0x11d73d=0x0;_0x11d73d<_0x5684b0[_0xeb49('0x4b')]['ids'][_0xeb49('0x3c')];_0x11d73d+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x5684b0[_0xeb49('0x4b')][_0xeb49('0xea')][_0x11d73d]),'ChatWebsiteId':Number(_0x5684b0[_0xeb49('0x48')]['id'])});}return _0x1b5997;});}})[_0xeb49('0x16')](respondWithResult(_0x3673a4,null))['catch'](handleError(_0x3673a4,null));};exports['removeAgents']=function(_0x5e4277,_0x22dae6){return db['ChatWebsite']['find']({'where':{'id':_0x5e4277['params']['id']}})[_0xeb49('0x16')](handleEntityNotFound(_0x22dae6,null))[_0xeb49('0x16')](function(_0x59dab5){if(_0x59dab5){return _0x59dab5[_0xeb49('0x127')](_0x5e4277[_0xeb49('0x37')][_0xeb49('0xea')])['then'](function(){if(_['isArray'](_0x5e4277[_0xeb49('0x37')][_0xeb49('0xea')])){for(var _0x19e16a=0x0;_0x19e16a<_0x5e4277[_0xeb49('0x37')]['ids'][_0xeb49('0x3c')];_0x19e16a+=0x1){socket[_0xeb49('0x128')](_0xeb49('0x129'),{'UserId':Number(_0x5e4277[_0xeb49('0x37')][_0xeb49('0xea')][_0x19e16a]),'ChatWebsiteId':Number(_0x5e4277[_0xeb49('0x48')]['id'])});}}else{socket[_0xeb49('0x128')]('userChatWebsite:remove',{'UserId':Number(_0x5e4277['query']['ids']),'ChatWebsiteId':Number(_0x5e4277[_0xeb49('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x22dae6,null))['catch'](handleError(_0x22dae6,null));};exports[_0xeb49('0x12a')]=function(_0x317db8,_0x2b7b33){var _0x5dedf8={};var _0x4145f0={};var _0x181c6b;var _0x5dab59;return db[_0xeb49('0x34')][_0xeb49('0x57')]({'where':{'id':_0x317db8['params']['id']}})['then'](handleEntityNotFound(_0x2b7b33,null))[_0xeb49('0x16')](function(_0x281886){if(_0x281886){_0x181c6b=_0x281886;_0x4145f0[_0xeb49('0x36')]=_[_0xeb49('0x38')](db[_0xeb49('0xec')]['rawAttributes']);_0x4145f0['query']=_['keys'](_0x317db8[_0xeb49('0x37')]);_0x4145f0[_0xeb49('0x40')]=_[_0xeb49('0x39')](_0x4145f0[_0xeb49('0x36')],_0x4145f0[_0xeb49('0x37')]);_0x5dedf8[_0xeb49('0x3a')]=_[_0xeb49('0x39')](_0x4145f0[_0xeb49('0x36')],qs[_0xeb49('0x3b')](_0x317db8[_0xeb49('0x37')][_0xeb49('0x3b')]));_0x5dedf8[_0xeb49('0x3a')]=_0x5dedf8[_0xeb49('0x3a')]['length']?_0x5dedf8['attributes']:_0x4145f0[_0xeb49('0x36')];_0x5dedf8[_0xeb49('0x3d')]=qs[_0xeb49('0x3e')](_0x317db8[_0xeb49('0x37')]['sort']);_0x5dedf8[_0xeb49('0x3f')]=qs['filters'](_[_0xeb49('0x41')](_0x317db8['query'],_0x4145f0[_0xeb49('0x40')]));if(_0x317db8[_0xeb49('0x37')][_0xeb49('0x44')]){_0x5dedf8[_0xeb49('0x3f')]=_['merge'](_0x5dedf8[_0xeb49('0x3f')],{'$or':_[_0xeb49('0x33')](_0x5dedf8[_0xeb49('0x3a')],function(_0x21bc77){var _0x54d652={};_0x54d652[_0x21bc77]={'$like':'%'+_0x317db8[_0xeb49('0x37')][_0xeb49('0x44')]+'%'};return _0x54d652;})});}_0x5dedf8=_[_0xeb49('0x42')]({},_0x5dedf8,_0x317db8[_0xeb49('0x45')]);return _0x181c6b[_0xeb49('0x12a')](_0x5dedf8);}})[_0xeb49('0x16')](function(_0x4ef6d9){if(_0x4ef6d9){_0x5dab59=_0x4ef6d9[_0xeb49('0x3c')];if(!_0x317db8[_0xeb49('0x37')]['hasOwnProperty'](_0xeb49('0x59'))){_0x5dedf8[_0xeb49('0x28')]=qs[_0xeb49('0x28')](_0x317db8[_0xeb49('0x37')]['limit']);_0x5dedf8['offset']=qs[_0xeb49('0x26')](_0x317db8['query'][_0xeb49('0x26')]);}return _0x181c6b['getAgents'](_0x5dedf8);}})[_0xeb49('0x16')](function(_0x12b918){if(_0x12b918){return _0x12b918?{'count':_0x5dab59,'rows':_0x12b918}:null;}})[_0xeb49('0x16')](respondWithResult(_0x2b7b33,null))['catch'](handleError(_0x2b7b33,null));}; \ No newline at end of file +var _0xdcae=['filename','agentAvatar','file','addCustomerAvatar','customerAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','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','DESC','ChatApplication','Applications','account','applications','list','List','asc','Contacts','defaults','contact','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','forcedOwnership','Start','startRouting','EventManager','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','toPairsIn','mapValues','subjectOffline','offlineMessageSubject','Chat','MailAccountId','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','utf8','address','origin','remote','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','transaction','Transaction','READ_COMMITTED','priority','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','url','redis','./chatWebsite.socket','register','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','Disposition','findOne','order','ChatWebsiteId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic'];(function(_0x348c2e,_0x2f7125){var _0x43c95c=function(_0x501bd0){while(--_0x501bd0){_0x348c2e['push'](_0x348c2e['shift']());}};_0x43c95c(++_0x2f7125);}(_0xdcae,0x1f2));var _0xedca=function(_0x48ce56,_0x213bea){_0x48ce56=_0x48ce56-0x0;var _0x25e8a1=_0xdcae[_0x48ce56];return _0x25e8a1;};'use strict';var BPromise=require(_0xedca('0x0'));var Mustache=require(_0xedca('0x1'));var util=require(_0xedca('0x2'));var path=require(_0xedca('0x3'));var ejs=require(_0xedca('0x4'));var fs=require('fs');var fs_extra=require(_0xedca('0x5'));var _=require(_0xedca('0x6'));var querystring=require(_0xedca('0x7'));var Redis=require(_0xedca('0x8'));var qs=require(_0xedca('0x9'));var logger=require(_0xedca('0xa'))('api');var config=require(_0xedca('0xb'));var url=require(_0xedca('0xc'));var db=require('../../mysqldb')['db'];config[_0xedca('0xd')]=_['defaults'](config[_0xedca('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xedca('0xe'))[_0xedca('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson['client'][_0xedca('0x10')]({'port':0x232c});var client9002=jayson[_0xedca('0x11')][_0xedca('0x10')]({'port':0x232a});var client9003=jayson[_0xedca('0x11')][_0xedca('0x10')]({'port':0x232b});var client9001=jayson['client'][_0xedca('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x4e06f2,_0x312086,_0x223002,_0x40cd8e){return new BPromise(function(_0x2e2075,_0x482a42){var _0x1c81c1=_0x40cd8e||client;return _0x1c81c1[_0xedca('0x12')](_0x4e06f2,_0x223002)[_0xedca('0x13')](function(_0x4095b7){logger[_0xedca('0x14')](_0xedca('0x15'),_0x312086,_0xedca('0x16'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x312086,_0xedca('0x16'),JSON[_0xedca('0x17')](_0x4095b7));if(_0x4095b7['error']){if(_0x4095b7[_0xedca('0x18')][_0xedca('0x19')]===0x1f4){logger[_0xedca('0x18')](_0xedca('0x15'),_0x312086,_0x4095b7[_0xedca('0x18')][_0xedca('0x1a')]);return _0x482a42(_0x4095b7[_0xedca('0x18')][_0xedca('0x1a')]);}logger['error'](_0xedca('0x15'),_0x312086,_0x4095b7[_0xedca('0x18')]['message']);return _0x2e2075(_0x4095b7[_0xedca('0x18')]['message']);}else{logger['info'](_0xedca('0x15'),_0x312086,_0xedca('0x16'));_0x2e2075(_0x4095b7['result']['message']);}})[_0xedca('0x1b')](function(_0x128948){logger[_0xedca('0x18')](_0xedca('0x15'),_0x312086,_0x128948);_0x482a42(_0x128948);});});}function respondWithStatusCode(_0x5f4fe5,_0x3f3c61){_0x3f3c61=_0x3f3c61||0xcc;return function(_0xa2dc3c){if(_0xa2dc3c){return _0x5f4fe5[_0xedca('0x1c')](_0x3f3c61);}return _0x5f4fe5[_0xedca('0x1d')](_0x3f3c61)[_0xedca('0x1e')]();};}function respondWithResult(_0x411607,_0x59b9bc){_0x59b9bc=_0x59b9bc||0xc8;return function(_0x28a6ea){if(_0x28a6ea){return _0x411607['status'](_0x59b9bc)[_0xedca('0x1f')](_0x28a6ea);}};}function respondWithFilteredResult(_0x57e68a,_0x2814d3){return function(_0x16c42e){if(_0x16c42e){var _0x4801e5=typeof _0x2814d3[_0xedca('0x20')]==='undefined'&&typeof _0x2814d3[_0xedca('0x21')]==='undefined';var _0x4ea135=_0x16c42e[_0xedca('0x22')];var _0x91e817=_0x4801e5?0x0:_0x2814d3[_0xedca('0x20')];var _0xb7cf72=_0x4801e5?_0x16c42e[_0xedca('0x22')]:_0x2814d3[_0xedca('0x20')]+_0x2814d3[_0xedca('0x21')];var _0x551da5;if(_0xb7cf72>=_0x4ea135){_0xb7cf72=_0x4ea135;_0x551da5=0xc8;}else{_0x551da5=0xce;}_0x57e68a[_0xedca('0x1d')](_0x551da5);return _0x57e68a[_0xedca('0x23')](_0xedca('0x24'),_0x91e817+'-'+_0xb7cf72+'/'+_0x4ea135)[_0xedca('0x1f')](_0x16c42e);}return null;};}function saveUpdates(_0x2effe2){return function(_0x2fd74c){if(_0x2fd74c){return _0x2fd74c['update'](_0x2effe2)[_0xedca('0x13')](function(_0x57cd03){return _0x57cd03;});}return null;};}function removeEntity(_0x4bfd80){return function(_0x18f6a1){if(_0x18f6a1){return _0x18f6a1['destroy']()[_0xedca('0x13')](function(){var _0x2d09d3=_0x18f6a1['get']({'plain':!![]});var _0x588efa=_0xedca('0x25');return db[_0xedca('0x26')][_0xedca('0x27')]({'where':{'type':_0x588efa,'resourceId':_0x2d09d3['id']}})[_0xedca('0x13')](function(){return _0x18f6a1;});})[_0xedca('0x13')](function(){_0x4bfd80[_0xedca('0x1d')](0xcc)[_0xedca('0x1e')]();});}};}function handleEntityNotFound(_0x510e63){return function(_0x40d2a2){if(!_0x40d2a2){_0x510e63['sendStatus'](0x194);}return _0x40d2a2;};}function handleError(_0x1b20d8,_0x11b97a){_0x11b97a=_0x11b97a||0x1f4;return function(_0x14498b){logger['error'](_0x14498b[_0xedca('0x28')]);if(_0x14498b[_0xedca('0x29')]){delete _0x14498b[_0xedca('0x29')];}_0x1b20d8['status'](_0x11b97a)[_0xedca('0x2a')](_0x14498b);};}exports[_0xedca('0x2b')]=function(_0x8ef63d,_0x5b5019){var _0x413c67={'include':[{'model':db['Pause'],'as':_0xedca('0x2c')}]},_0x3eca09={},_0x42c501={'count':0x0,'rows':[]};var _0x4ba1ed=_[_0xedca('0x2d')](db[_0xedca('0x2e')]['rawAttributes'],function(_0x30500){return{'name':_0x30500['fieldName'],'type':_0x30500[_0xedca('0x2f')][_0xedca('0x30')]};});_0x3eca09[_0xedca('0x31')]=_[_0xedca('0x2d')](_0x4ba1ed,_0xedca('0x29'));_0x3eca09['query']=_[_0xedca('0x32')](_0x8ef63d[_0xedca('0x33')]);_0x3eca09[_0xedca('0x34')]=_[_0xedca('0x35')](_0x3eca09[_0xedca('0x31')],_0x3eca09[_0xedca('0x33')]);_0x413c67[_0xedca('0x36')]=_['intersection'](_0x3eca09['model'],qs[_0xedca('0x37')](_0x8ef63d[_0xedca('0x33')][_0xedca('0x37')]));_0x413c67[_0xedca('0x36')]=_0x413c67[_0xedca('0x36')][_0xedca('0x38')]?_0x413c67[_0xedca('0x36')]:_0x3eca09['model'];if(!_0x8ef63d[_0xedca('0x33')][_0xedca('0x39')](_0xedca('0x3a'))){_0x413c67['limit']=qs[_0xedca('0x21')](_0x8ef63d['query'][_0xedca('0x21')]);_0x413c67['offset']=qs[_0xedca('0x20')](_0x8ef63d['query'][_0xedca('0x20')]);}_0x413c67['order']=qs[_0xedca('0x3b')](_0x8ef63d[_0xedca('0x33')][_0xedca('0x3b')]);_0x413c67[_0xedca('0x3c')]=qs[_0xedca('0x34')](_[_0xedca('0x3d')](_0x8ef63d['query'],_0x3eca09[_0xedca('0x34')]),_0x4ba1ed);if(_0x8ef63d['query'][_0xedca('0x3e')]){_0x413c67[_0xedca('0x3c')]=_[_0xedca('0x3f')](_0x413c67[_0xedca('0x3c')],{'$or':_[_0xedca('0x2d')](_0x4ba1ed,function(_0xe67d3e){if(_0xe67d3e[_0xedca('0x2f')]!=='VIRTUAL'){var _0x4992f2={};_0x4992f2[_0xe67d3e[_0xedca('0x29')]]={'$like':'%'+_0x8ef63d[_0xedca('0x33')][_0xedca('0x3e')]+'%'};return _0x4992f2;}})});}_0x413c67=_['merge']({},_0x413c67,_0x8ef63d[_0xedca('0x40')]);var _0x10df5e={'where':_0x413c67[_0xedca('0x3c')]};return db[_0xedca('0x2e')][_0xedca('0x22')](_0x10df5e)[_0xedca('0x13')](function(_0x3f905b){_0x42c501[_0xedca('0x22')]=_0x3f905b;if(_0x8ef63d[_0xedca('0x33')]['includeAll']){_0x413c67[_0xedca('0x41')]=[{'all':!![]}];}return db[_0xedca('0x2e')][_0xedca('0x42')](_0x413c67);})['then'](function(_0x4119a8){_0x42c501[_0xedca('0x43')]=_0x4119a8;return _0x42c501;})[_0xedca('0x13')](respondWithFilteredResult(_0x5b5019,_0x413c67))[_0xedca('0x1b')](handleError(_0x5b5019,null));};exports['show']=function(_0x1f2ce0,_0x1c260c){var _0x3aff69={'raw':![],'where':{'id':_0x1f2ce0[_0xedca('0x44')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x43c383={};_0x43c383[_0xedca('0x31')]=_[_0xedca('0x32')](db[_0xedca('0x2e')][_0xedca('0x45')]);_0x43c383[_0xedca('0x33')]=_['keys'](_0x1f2ce0[_0xedca('0x33')]);_0x43c383[_0xedca('0x34')]=_['intersection'](_0x43c383['model'],_0x43c383[_0xedca('0x33')]);_0x3aff69['attributes']=_[_0xedca('0x35')](_0x43c383[_0xedca('0x31')],qs[_0xedca('0x37')](_0x1f2ce0['query'][_0xedca('0x37')]));_0x3aff69['attributes']=_0x3aff69[_0xedca('0x36')][_0xedca('0x38')]?_0x3aff69[_0xedca('0x36')]:_0x43c383[_0xedca('0x31')];if(_0x1f2ce0[_0xedca('0x33')][_0xedca('0x46')]){_0x3aff69[_0xedca('0x41')]=[{'all':!![]}];}_0x3aff69=_[_0xedca('0x3f')]({},_0x3aff69,_0x1f2ce0[_0xedca('0x40')]);return db[_0xedca('0x2e')][_0xedca('0x47')](_0x3aff69)[_0xedca('0x13')](handleEntityNotFound(_0x1c260c,null))['then'](respondWithResult(_0x1c260c,null))[_0xedca('0x1b')](handleError(_0x1c260c,null));};exports[_0xedca('0x48')]=function(_0x2d57bf,_0x2ca5c2){return db[_0xedca('0x2e')][_0xedca('0x48')](_0x2d57bf[_0xedca('0x49')],{})['then'](function(_0x9d3d0c){var _0x3b69a4=_0x2d57bf[_0xedca('0x4a')][_0xedca('0x4b')]({'plain':!![]});if(!_0x3b69a4)throw new Error(_0xedca('0x4c'));if(_0x3b69a4['role']===_0xedca('0x4a')){var _0x232197=_0x9d3d0c[_0xedca('0x4b')]({'plain':!![]});var _0x36cc88='ChatWebsites';return db[_0xedca('0x4d')][_0xedca('0x47')]({'where':{'name':_0x36cc88,'userProfileId':_0x3b69a4[_0xedca('0x4e')]},'raw':!![]})[_0xedca('0x13')](function(_0x1b5a3e){if(_0x1b5a3e&&_0x1b5a3e['autoAssociation']===0x0){return db[_0xedca('0x26')][_0xedca('0x48')]({'name':_0x232197['name'],'resourceId':_0x232197['id'],'type':_0x1b5a3e[_0xedca('0x29')],'sectionId':_0x1b5a3e['id']},{})[_0xedca('0x13')](function(){return _0x9d3d0c;});}else{return _0x9d3d0c;}})['catch'](function(_0x12efdd){logger['error'](_0xedca('0x4f'),_0x12efdd);throw _0x12efdd;});}return _0x9d3d0c;})['then'](respondWithResult(_0x2ca5c2,0xc9))[_0xedca('0x1b')](handleError(_0x2ca5c2,null));};exports[_0xedca('0x50')]=function(_0x4279a0,_0x50c5c6){if(_0x4279a0[_0xedca('0x49')]['id']){delete _0x4279a0['body']['id'];}return db[_0xedca('0x2e')]['find']({'where':{'id':_0x4279a0['params']['id']},'include':[{'model':db[_0xedca('0x51')],'as':_0xedca('0x2c')}]})[_0xedca('0x13')](handleEntityNotFound(_0x50c5c6,null))['then'](saveUpdates(_0x4279a0[_0xedca('0x49')],null))['then'](respondWithResult(_0x50c5c6,null))[_0xedca('0x1b')](handleError(_0x50c5c6,null));};exports['destroy']=function(_0xf6ef65,_0x1598ad){return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0xf6ef65['params']['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x1598ad,null))[_0xedca('0x13')](removeEntity(_0x1598ad,null))['catch'](handleError(_0x1598ad,null));};exports[_0xedca('0x52')]=function(_0x5f0488,_0x523185){return db['ChatWebsite']['describe']()[_0xedca('0x13')](respondWithResult(_0x523185,null))[_0xedca('0x1b')](handleError(_0x523185,null));};exports['addDisposition']=function(_0x53cc70,_0x4332e9){if(_0x53cc70['body']['id']){delete _0x53cc70[_0xedca('0x49')]['id'];}return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x53cc70[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x4332e9,null))[_0xedca('0x13')](function(_0x39e055){if(_0x39e055){_0x53cc70[_0xedca('0x49')]['ChatWebsiteId']=_0x39e055['id'];return db[_0xedca('0x53')]['create'](_0x53cc70[_0xedca('0x49')]);}})[_0xedca('0x13')](respondWithResult(_0x4332e9,null))['catch'](handleError(_0x4332e9,null));};exports['getDispositions']=function(_0x427bd8,_0x4a9409){var _0x316dfe={'raw':![],'where':{}};var _0x8bbeb9={};var _0x505178={'count':0x0,'rows':[]};return db[_0xedca('0x2e')][_0xedca('0x54')]({'where':{'id':_0x427bd8['params']['id']}})['then'](handleEntityNotFound(_0x4a9409,null))[_0xedca('0x13')](function(_0x30620e){if(_0x30620e){_0x8bbeb9[_0xedca('0x31')]=_[_0xedca('0x32')](db[_0xedca('0x53')][_0xedca('0x45')]);_0x8bbeb9[_0xedca('0x33')]=_[_0xedca('0x32')](_0x427bd8[_0xedca('0x33')]);_0x8bbeb9[_0xedca('0x34')]=_['intersection'](_0x8bbeb9[_0xedca('0x31')],_0x8bbeb9[_0xedca('0x33')]);_0x316dfe[_0xedca('0x36')]=_[_0xedca('0x35')](_0x8bbeb9['model'],qs[_0xedca('0x37')](_0x427bd8[_0xedca('0x33')]['fields']));_0x316dfe['attributes']=_0x316dfe[_0xedca('0x36')][_0xedca('0x38')]?_0x316dfe[_0xedca('0x36')]:_0x8bbeb9[_0xedca('0x31')];if(!_0x427bd8[_0xedca('0x33')][_0xedca('0x39')](_0xedca('0x3a'))){_0x316dfe[_0xedca('0x21')]=qs[_0xedca('0x21')](_0x427bd8['query'][_0xedca('0x21')]);_0x316dfe[_0xedca('0x20')]=qs[_0xedca('0x20')](_0x427bd8[_0xedca('0x33')][_0xedca('0x20')]);}_0x316dfe[_0xedca('0x55')]=qs[_0xedca('0x3b')](_0x427bd8[_0xedca('0x33')][_0xedca('0x3b')]);_0x316dfe[_0xedca('0x3c')]=qs[_0xedca('0x34')](_[_0xedca('0x3d')](_0x427bd8[_0xedca('0x33')],_0x8bbeb9[_0xedca('0x34')]));_0x316dfe[_0xedca('0x3c')][_0xedca('0x56')]=_0x30620e['id'];if(_0x427bd8[_0xedca('0x33')][_0xedca('0x3e')]){_0x316dfe[_0xedca('0x3c')]=_[_0xedca('0x3f')](_0x316dfe['where'],{'$or':_[_0xedca('0x2d')](_0x316dfe['attributes'],function(_0x1a6f12){var _0x465530={};_0x465530[_0x1a6f12]={'$like':'%'+_0x427bd8[_0xedca('0x33')][_0xedca('0x3e')]+'%'};return _0x465530;})});}_0x316dfe=_[_0xedca('0x3f')]({},_0x316dfe,_0x427bd8[_0xedca('0x40')]);return db[_0xedca('0x53')][_0xedca('0x22')]({'where':_0x316dfe[_0xedca('0x3c')]})[_0xedca('0x13')](function(_0x1f73d5){_0x505178[_0xedca('0x22')]=_0x1f73d5;if(_0x427bd8[_0xedca('0x33')][_0xedca('0x46')]){_0x316dfe[_0xedca('0x41')]=[{'all':!![]}];}return db[_0xedca('0x53')][_0xedca('0x42')](_0x316dfe);})[_0xedca('0x13')](function(_0x5a260b){_0x505178[_0xedca('0x43')]=_0x5a260b;return _0x505178;});}})['then'](respondWithFilteredResult(_0x4a9409,_0x316dfe))['catch'](handleError(_0x4a9409,null));};exports[_0xedca('0x57')]=function(_0x33a371,_0x4b4def){return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x33a371[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x4b4def,null))[_0xedca('0x13')](function(_0x618e6a){if(_0x618e6a){return _0x618e6a[_0xedca('0x57')](_0x33a371['query'][_0xedca('0x58')]);}})['then'](respondWithStatusCode(_0x4b4def,null))[_0xedca('0x1b')](handleError(_0x4b4def,null));};exports['addAnswer']=function(_0x3a5e32,_0x3d01a5){if(_0x3a5e32['body']['id']){delete _0x3a5e32['body']['id'];}return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x3a5e32[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x3d01a5,null))[_0xedca('0x13')](function(_0x3b61d9){if(_0x3b61d9){_0x3a5e32[_0xedca('0x49')][_0xedca('0x56')]=_0x3b61d9['id'];return db[_0xedca('0x59')]['create'](_0x3a5e32[_0xedca('0x49')]);}})[_0xedca('0x13')](respondWithResult(_0x3d01a5,null))['catch'](handleError(_0x3d01a5,null));};exports[_0xedca('0x5a')]=function(_0x9fb5c6,_0x55360a){var _0x16b8a2={'raw':![],'where':{}};var _0x52a85e={};var _0x31f90b={'count':0x0,'rows':[]};return db[_0xedca('0x2e')][_0xedca('0x54')]({'where':{'id':_0x9fb5c6[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x55360a,null))['then'](function(_0x42f20e){if(_0x42f20e){_0x52a85e[_0xedca('0x31')]=_['keys'](db[_0xedca('0x59')]['rawAttributes']);_0x52a85e[_0xedca('0x33')]=_['keys'](_0x9fb5c6['query']);_0x52a85e[_0xedca('0x34')]=_[_0xedca('0x35')](_0x52a85e[_0xedca('0x31')],_0x52a85e['query']);_0x16b8a2[_0xedca('0x36')]=_['intersection'](_0x52a85e[_0xedca('0x31')],qs[_0xedca('0x37')](_0x9fb5c6['query'][_0xedca('0x37')]));_0x16b8a2[_0xedca('0x36')]=_0x16b8a2[_0xedca('0x36')][_0xedca('0x38')]?_0x16b8a2[_0xedca('0x36')]:_0x52a85e['model'];if(!_0x9fb5c6[_0xedca('0x33')][_0xedca('0x39')](_0xedca('0x3a'))){_0x16b8a2[_0xedca('0x21')]=qs['limit'](_0x9fb5c6[_0xedca('0x33')][_0xedca('0x21')]);_0x16b8a2[_0xedca('0x20')]=qs[_0xedca('0x20')](_0x9fb5c6[_0xedca('0x33')]['offset']);}_0x16b8a2[_0xedca('0x55')]=qs[_0xedca('0x3b')](_0x9fb5c6[_0xedca('0x33')][_0xedca('0x3b')]);_0x16b8a2[_0xedca('0x3c')]=qs['filters'](_[_0xedca('0x3d')](_0x9fb5c6[_0xedca('0x33')],_0x52a85e[_0xedca('0x34')]));_0x16b8a2['where'][_0xedca('0x56')]=_0x42f20e['id'];if(_0x9fb5c6[_0xedca('0x33')][_0xedca('0x3e')]){_0x16b8a2[_0xedca('0x3c')]=_[_0xedca('0x3f')](_0x16b8a2[_0xedca('0x3c')],{'$or':_['map'](_0x16b8a2[_0xedca('0x36')],function(_0x327608){var _0x4414c7={};_0x4414c7[_0x327608]={'$like':'%'+_0x9fb5c6[_0xedca('0x33')][_0xedca('0x3e')]+'%'};return _0x4414c7;})});}_0x16b8a2=_[_0xedca('0x3f')]({},_0x16b8a2,_0x9fb5c6[_0xedca('0x40')]);return db['CannedAnswer'][_0xedca('0x22')]({'where':_0x16b8a2[_0xedca('0x3c')]})['then'](function(_0x24f3b8){_0x31f90b[_0xedca('0x22')]=_0x24f3b8;if(_0x9fb5c6[_0xedca('0x33')][_0xedca('0x46')]){_0x16b8a2[_0xedca('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0xedca('0x42')](_0x16b8a2);})[_0xedca('0x13')](function(_0x505290){_0x31f90b[_0xedca('0x43')]=_0x505290;return _0x31f90b;});}})[_0xedca('0x13')](respondWithFilteredResult(_0x55360a,_0x16b8a2))['catch'](handleError(_0x55360a,null));};exports[_0xedca('0x5b')]=function(_0x383622,_0x24e2b3){return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x383622[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x24e2b3,null))['then'](function(_0x21acc9){if(_0x21acc9){return _0x21acc9[_0xedca('0x5b')](_0x383622[_0xedca('0x33')][_0xedca('0x58')]);}})[_0xedca('0x13')](respondWithStatusCode(_0x24e2b3,null))[_0xedca('0x1b')](handleError(_0x24e2b3,null));};exports[_0xedca('0x5c')]=function(_0x5932af,_0x2ae220){_0x5932af[_0xedca('0x49')][_0xedca('0x5d')]=_0x5932af['file'][_0xedca('0x5e')];return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x5932af[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x2ae220,null))[_0xedca('0x13')](saveUpdates(_0x5932af[_0xedca('0x49')],null))[_0xedca('0x13')](respondWithResult(_0x2ae220,null))[_0xedca('0x1b')](handleError(_0x2ae220,null));};exports['addAvatar']=function(_0xca5857,_0x2a1c30){_0xca5857[_0xedca('0x49')][_0xedca('0x5f')]=_0xca5857[_0xedca('0x60')]['filename'];return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0xca5857['params']['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x2a1c30,null))['then'](saveUpdates(_0xca5857[_0xedca('0x49')],null))[_0xedca('0x13')](respondWithResult(_0x2a1c30,null))[_0xedca('0x1b')](handleError(_0x2a1c30,null));};exports[_0xedca('0x61')]=function(_0x1a7470,_0x1d193c){_0x1a7470['body'][_0xedca('0x62')]=_0x1a7470[_0xedca('0x60')][_0xedca('0x5e')];return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x1a7470['params']['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x1d193c,null))[_0xedca('0x13')](saveUpdates(_0x1a7470[_0xedca('0x49')],null))[_0xedca('0x13')](respondWithResult(_0x1d193c,null))[_0xedca('0x1b')](handleError(_0x1d193c,null));};exports['addSystemAvatar']=function(_0x360ac7,_0x26cdee){_0x360ac7[_0xedca('0x49')][_0xedca('0x63')]=_0x360ac7['file'][_0xedca('0x5e')];return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x360ac7[_0xedca('0x44')]['id']}})['then'](handleEntityNotFound(_0x26cdee,null))['then'](saveUpdates(_0x360ac7[_0xedca('0x49')],null))[_0xedca('0x13')](respondWithResult(_0x26cdee,null))[_0xedca('0x1b')](handleError(_0x26cdee,null));};exports['getLogo']=function(_0x5330a7,_0x4a172b){var _0x59a2ed=path[_0xedca('0x64')](config['root'],_0xedca('0x65'));var _0x3ab202={'where':{'id':_0x5330a7['params']['id']},'attributes':['id',_0xedca('0x5d')],'raw':!![]};var _0x1cb4da=![];return require(_0xedca('0x66'))[_0xedca('0x67')]()['then'](function(_0x235f6f){if(_0x235f6f){_0x1cb4da=_0x235f6f[_0xedca('0x68')];}})[_0xedca('0x13')](function(){return db['ChatWebsite'][_0xedca('0x47')](_0x3ab202);})[_0xedca('0x13')](handleEntityNotFound(_0x4a172b,null))['then'](function(_0x1fcbfa){if(_0x1fcbfa){if(!_[_0xedca('0x69')](_0x1fcbfa['sitepic'])){if(fs[_0xedca('0x6a')](path[_0xedca('0x64')](config[_0xedca('0x6b')],'server/files/images/logos/',_0x1fcbfa['sitepic']))&&_0x1cb4da){_0x59a2ed=path[_0xedca('0x64')](config[_0xedca('0x6b')],_0xedca('0x6c'),_0x1fcbfa['sitepic']);}}return _0x4a172b[_0xedca('0x6d')](_0x59a2ed);}})[_0xedca('0x1b')](handleError(_0x4a172b,null));};exports[_0xedca('0x6e')]=function(_0xb64249,_0x19d24f){var _0x3de884=path[_0xedca('0x64')](config[_0xedca('0x6b')],_0xedca('0x6f'));var _0x958c6a={'where':{'id':_0xb64249['params']['id']},'attributes':['id',_0xedca('0x5f')],'raw':!![]};return db[_0xedca('0x2e')][_0xedca('0x47')](_0x958c6a)[_0xedca('0x13')](handleEntityNotFound(_0x19d24f,null))['then'](function(_0x367ac5){if(_0x367ac5){if(!_[_0xedca('0x69')](_0x367ac5[_0xedca('0x5f')])){if(fs['existsSync'](path[_0xedca('0x64')](config['root'],'server/files/images/avatars/',_0x367ac5[_0xedca('0x5f')]))){_0x3de884=path['join'](config[_0xedca('0x6b')],'server/files/images/avatars/',_0x367ac5['agentAvatar']);}}return _0x19d24f[_0xedca('0x6d')](_0x3de884);}})['catch'](handleError(_0x19d24f,null));};exports[_0xedca('0x70')]=function(_0x590ecc,_0x5eded4){var _0x3a61e3=path[_0xedca('0x64')](config['root'],_0xedca('0x71'));var _0x138927={'where':{'id':_0x590ecc[_0xedca('0x44')]['id']},'attributes':['id',_0xedca('0x62'),'showCustomerAvatar'],'raw':!![]};return db[_0xedca('0x2e')][_0xedca('0x47')](_0x138927)[_0xedca('0x13')](handleEntityNotFound(_0x5eded4,null))[_0xedca('0x13')](function(_0x5d966c){if(_0x5d966c){if(!_[_0xedca('0x69')](_0x5d966c[_0xedca('0x62')])){if(fs[_0xedca('0x6a')](path['join'](config['root'],'server/files/images/avatars/',_0x5d966c[_0xedca('0x62')]))&&_0x5d966c[_0xedca('0x72')]){_0x3a61e3=path[_0xedca('0x64')](config[_0xedca('0x6b')],_0xedca('0x73'),_0x5d966c['customerAvatar']);}}return _0x5eded4['download'](_0x3a61e3);}})['catch'](handleError(_0x5eded4,null));};exports[_0xedca('0x74')]=function(_0x3e9a74,_0x4846d8){var _0x41887b=path[_0xedca('0x64')](config[_0xedca('0x6b')],'server/files/images/avatars/system_avatar.png');var _0x12b17e={'where':{'id':_0x3e9a74[_0xedca('0x44')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xedca('0x2e')][_0xedca('0x47')](_0x12b17e)[_0xedca('0x13')](handleEntityNotFound(_0x4846d8,null))['then'](function(_0x2a50b4){if(_0x2a50b4){if(!_[_0xedca('0x69')](_0x2a50b4['systemAvatar'])){if(fs[_0xedca('0x6a')](path[_0xedca('0x64')](config['root'],_0xedca('0x73'),_0x2a50b4[_0xedca('0x63')]))){_0x41887b=path[_0xedca('0x64')](config[_0xedca('0x6b')],_0xedca('0x73'),_0x2a50b4[_0xedca('0x63')]);}}return _0x4846d8[_0xedca('0x6d')](_0x41887b);}})[_0xedca('0x1b')](handleError(_0x4846d8,null));};exports[_0xedca('0x75')]=function(_0x3176d4,_0x563cfe){var _0x5d22bf=require(_0xedca('0x76'));var _0x5584a8=new _0x5d22bf();var _0x1b95d0=_0x5584a8[_0xedca('0x77')](_0x3176d4[_0xedca('0x78')][_0xedca('0x79')])[_0xedca('0x7a')]();var _0x1c40a0={'body':_0x3176d4[_0xedca('0x49')],'channel':_0xedca('0x7b')};var _0xadf3cc=[];var _0x3a4585=[];var _0x124e03={};var _0x41b387=![];return db[_0xedca('0x7c')][_0xedca('0x52')]()[_0xedca('0x13')](function(_0x4a26a3){if(!_0x4a26a3){throw new db[(_0xedca('0x7d'))][(_0xedca('0x7e'))](_0xedca('0x7f'));}_0xadf3cc=_['difference'](_['keys'](_0x4a26a3),[_0xedca('0x80'),_0xedca('0x81')]);_0x3a4585=_[_0xedca('0x82')](_[_0xedca('0x32')](_0x4a26a3),[_0xedca('0x80'),_0xedca('0x81'),_0xedca('0x83'),_0xedca('0x84')]);if(_0x3176d4[_0xedca('0x49')]['id']){delete _0x3176d4[_0xedca('0x49')]['id'];}if(_['isNil'](_0x3176d4[_0xedca('0x49')][_0xedca('0x85')])){throw new db[(_0xedca('0x7d'))][(_0xedca('0x7e'))](_0xedca('0x86'));}if(_[_0xedca('0x69')](_0x3176d4['body'][_0xedca('0x49')])||_0x3176d4[_0xedca('0x49')][_0xedca('0x49')]===''){throw new db[(_0xedca('0x7d'))][(_0xedca('0x7e'))](_0xedca('0x87'));}if(_[_0xedca('0x69')](_0x3176d4[_0xedca('0x49')][_0xedca('0x88')])){throw new db['Sequelize'][(_0xedca('0x7e'))](_0xedca('0x89')+_0x3a4585);}if(!_[_0xedca('0x8a')](_0x3a4585,_0x3176d4['body'][_0xedca('0x88')])){throw new db[(_0xedca('0x7d'))][(_0xedca('0x7e'))](_0xedca('0x8b')+_0x3a4585);}_0x124e03[_0x3176d4[_0xedca('0x49')][_0xedca('0x88')]]=_0x3176d4[_0xedca('0x49')]['from'];})[_0xedca('0x13')](function(){return db['ChatWebsite'][_0xedca('0x47')]({'where':{'id':_0x3176d4[_0xedca('0x44')]['id']},'include':[{'model':db[_0xedca('0x8c')],'as':'List','include':[{'model':db[_0xedca('0x7c')],'as':'Contacts','where':_0x124e03,'limit':0x1,'order':[[_0xedca('0x81'),_0xedca('0x8d')]]}]},{'model':db[_0xedca('0x8e')],'as':_0xedca('0x8f')}]});})[_0xedca('0x13')](handleEntityNotFound(_0x563cfe,null))[_0xedca('0x13')](function(_0x1b6c0c){if(_0x1b6c0c&&_0x1b6c0c['List']){_0x1c40a0[_0xedca('0x90')]=_0x1b6c0c;_0x1c40a0[_0xedca('0x91')]=_0x1b6c0c['Applications'];_0x1c40a0[_0xedca('0x92')]=_0x1b6c0c[_0xedca('0x93')];_0x1c40a0[_0xedca('0x91')]=_['orderBy'](_0x1c40a0[_0xedca('0x91')],['priority'],[_0xedca('0x94')]);if(_0x1c40a0[_0xedca('0x90')][_0xedca('0x8f')]){delete _0x1c40a0['account'][_0xedca('0x8f')];}if(_0x1c40a0['account']['List']&&_0x1c40a0[_0xedca('0x90')]['List'][_0xedca('0x95')][_0xedca('0x38')]){return _0x1c40a0[_0xedca('0x90')][_0xedca('0x93')]['Contacts'][0x0];}var _0x3c600b=_[_0xedca('0x96')](_0x3176d4[_0xedca('0x49')],{'firstName':_0x3176d4[_0xedca('0x49')][_0xedca('0x85')],'ListId':_0x1b6c0c[_0xedca('0x84')]});_0x3c600b[_0x3176d4[_0xedca('0x49')][_0xedca('0x88')]]=_0x3176d4['body'][_0xedca('0x85')];return db[_0xedca('0x7c')][_0xedca('0x48')](_0x3c600b,{'fields':_0xadf3cc,'raw':!![]});}})['then'](handleEntityNotFound(_0x563cfe,null))[_0xedca('0x13')](function(_0x274e3a){_0x1c40a0[_0xedca('0x97')]=_0x274e3a;var _0x2fdcc4=_0x3176d4['body']['customerIp'];if(_0x3176d4['headers'][_0xedca('0x98')]){_0x2fdcc4=_0x3176d4[_0xedca('0x78')]['cf-connecting-ip'];}else if(_0x3176d4[_0xedca('0x78')]['x-forwarded-for']){_0x2fdcc4=_[_0xedca('0x99')](_0x3176d4[_0xedca('0x78')][_0xedca('0x9a')][_0xedca('0x9b')](','));}if(_0x274e3a){var _0x540d84={'ContactId':_0x274e3a['id'],'ChatWebsiteId':_0x3176d4[_0xedca('0x44')]['id'],'from':(_0x274e3a[_0xedca('0x9c')]||'')+'\x20'+(_0x274e3a[_0xedca('0x9d')]||''),'customerIp':_0x2fdcc4,'customerPort':_0x3176d4[_0xedca('0x78')][_0xedca('0x9e')]?_0x3176d4['headers'][_0xedca('0x9e')]:null,'referer':_0x3176d4[_0xedca('0x49')][_0xedca('0x9f')],'browserName':_0x1b95d0[_0xedca('0xa0')][_0xedca('0x29')]&&_0x1b95d0[_0xedca('0xa0')][_0xedca('0xa1')]?util[_0xedca('0xa2')](_0xedca('0xa3'),_0x1b95d0[_0xedca('0xa0')][_0xedca('0x29')],_0x1b95d0[_0xedca('0xa0')][_0xedca('0xa1')]):_0xedca('0xa4'),'browserVersion':_0x1b95d0[_0xedca('0xa0')]['version']||_0xedca('0xa4'),'osName':util[_0xedca('0xa2')]('%s\x20%s',_0x1b95d0['os'][_0xedca('0x29')],_0x1b95d0['os'][_0xedca('0xa1')]),'osVersion':_0x1b95d0['os'][_0xedca('0xa1')],'deviceModel':_0x1b95d0[_0xedca('0xa5')][_0xedca('0x31')]&&_0x1b95d0[_0xedca('0xa5')]['vendor']?util['format'](_0xedca('0xa6'),_0x1b95d0['device'][_0xedca('0x31')],_0x1b95d0[_0xedca('0xa5')][_0xedca('0xa7')],_0x1b95d0[_0xedca('0xa5')][_0xedca('0x2f')]):null,'deviceVendor':_0x1b95d0['device'][_0xedca('0xa7')],'deviceType':_0x1b95d0['device']['type'],'formData':JSON['stringify'](_0x3176d4[_0xedca('0x49')])};var _0x4c3d27={'ChatWebsiteId':_0x3176d4['params']['id'],'closed':![]};if(_0x3176d4[_0xedca('0x49')][_0xedca('0xa8')]){_0x4c3d27[_0xedca('0xa8')]=_0x3176d4[_0xedca('0x49')]['threadId'];return db[_0xedca('0xa9')][_0xedca('0x47')]({'where':_0x4c3d27})[_0xedca('0x13')](function(_0x33aa35){if(_0x33aa35){return[_0x33aa35,![]];}_0x540d84[_0xedca('0xa8')]=_0x3176d4[_0xedca('0x49')][_0xedca('0xa8')];_0x540d84[_0xedca('0xaa')]=_0x3176d4[_0xedca('0x49')][_0xedca('0xaa')];return db[_0xedca('0xa9')]['create'](_0x540d84)[_0xedca('0x13')](function(_0x173028){return[_0x173028,!![]];});});}_0x4c3d27[_0xedca('0xab')]=_0x274e3a['id'];if(_0x3176d4[_0xedca('0x49')][_0xedca('0xac')]&&_0x3176d4[_0xedca('0x49')][_0xedca('0xac')]['id']){_0x4c3d27['id']=_0x3176d4[_0xedca('0x49')][_0xedca('0xac')]['id'];return db['ChatInteraction'][_0xedca('0x47')]({'where':_0x4c3d27})[_0xedca('0x13')](function(_0x33c50a){if(_0x33c50a){return[_0x33c50a,![]];}return db[_0xedca('0xa9')]['create'](_0x540d84)[_0xedca('0x13')](function(_0x22c739){return[_0x22c739,!![]];});});}return db[_0xedca('0xa9')]['create'](_0x540d84)[_0xedca('0x13')](function(_0x4fd17e){return[_0x4fd17e,!![]];});}})[_0xedca('0xad')](function(_0x173ab2,_0x4a9887){if(_0x173ab2){_0x41b387=_0x4a9887;if(!_0x4a9887){var _0x557372={'from':(_0x1c40a0[_0xedca('0x97')]['firstName']||'')+'\x20'+(_0x1c40a0['contact'][_0xedca('0x9d')]||'')};if(_0x3176d4[_0xedca('0x49')][_0xedca('0xa8')]&&_0x3176d4[_0xedca('0x49')][_0xedca('0xae')]&&_0x3176d4[_0xedca('0x49')][_0xedca('0xa8')]!=_0x3176d4['body'][_0xedca('0xae')]){_0x557372[_0xedca('0xa8')]=_0x3176d4[_0xedca('0x49')][_0xedca('0xae')];}return _0x173ab2[_0xedca('0x50')](_0x557372);}else{return _0x173ab2;}}})[_0xedca('0x13')](function(_0x442ef8){_0x1c40a0[_0xedca('0xac')]=_0x442ef8[_0xedca('0x4b')]({'plain':!![]});_0x1c40a0[_0xedca('0xac')][_0xedca('0xaf')]=_0x41b387;if(_0x1c40a0['interaction'][_0xedca('0xaf')]){if(_0x1c40a0[_0xedca('0x90')][_0xedca('0xb0')]){_0x1c40a0['applications'][_0xedca('0xb1')]({'id':0x0,'priority':_0x1c40a0[_0xedca('0x91')][_0xedca('0x38')]+0x1,'app':_0xedca('0xb2'),'appdata':'unmanaged','interval':_0xedca('0xb3')});}}return db[_0xedca('0xb4')][_0xedca('0x48')]({'body':_0x3176d4[_0xedca('0x49')]['body'],'ChatWebsiteId':_0x3176d4['params']['id'],'ChatInteractionId':_0x442ef8['id'],'direction':'in','ContactId':_0x1c40a0[_0xedca('0x97')]['id'],'AttachmentId':_0x3176d4[_0xedca('0x49')][_0xedca('0xb5')]});})[_0xedca('0x13')](function(_0x2f0590){_0x1c40a0[_0xedca('0x1a')]=_0x2f0590;if(_0x1c40a0[_0xedca('0xac')][_0xedca('0xb6')]){return db[_0xedca('0xb7')][_0xedca('0x47')]({'attributes':['id','name'],'where':{'id':_0x1c40a0['interaction'][_0xedca('0xb6')]}})[_0xedca('0x13')](function(_0x30c370){if(_0x30c370){_0x1c40a0[_0xedca('0x91')][_0xedca('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x30c370[_0xedca('0x29')]+','+(_0x1c40a0[_0xedca('0x90')]['waitForTheAssignedAgent']||0xa),'interval':_0xedca('0xb3')});_0x1c40a0[_0xedca('0xb9')]=!![];}return respondWithRpcPromise(_0xedca('0xba'),'startRouting',_0x1c40a0);});}return respondWithRpcPromise('Start',_0xedca('0xbb'),_0x1c40a0);})[_0xedca('0x13')](function(_0x442c58){respondWithRpcPromise(_0xedca('0xbc'),_0xedca('0xbc'),{'event':_0xedca('0x75'),'message':_0x442c58},client9002);return _0x442c58;})[_0xedca('0x13')](respondWithResult(_0x563cfe,null))[_0xedca('0x1b')](handleError(_0x563cfe,null));};exports['offline']=function(_0x2a6eee,_0x512896){var _0x4eb863,_0x2029fc,_0x413f0c;var _0x1004ed=[];var _0x47377d={};var _0x2e12d6=_0x2a6eee[_0xedca('0xbd')]||[];var _0x38128f=[];var _0x22938f;return db[_0xedca('0x7c')][_0xedca('0x52')]()[_0xedca('0x13')](function(_0x41bbde){if(!_0x41bbde){throw new db['Sequelize']['ValidationError'](_0xedca('0x7f'));}_0x1004ed=_[_0xedca('0x82')](_[_0xedca('0x32')](_0x41bbde),[_0xedca('0x80'),_0xedca('0x81'),_0xedca('0x83'),'ListId']);if(_0x2a6eee[_0xedca('0x49')]['id']){delete _0x2a6eee[_0xedca('0x49')]['id'];}if(_[_0xedca('0x69')](_0x2a6eee[_0xedca('0x49')][_0xedca('0x85')])){throw _0x512896[_0xedca('0x1d')](0x1f4)[_0xedca('0x2a')](new db[(_0xedca('0x7d'))][(_0xedca('0x7e'))](_0xedca('0x86')));}if(_[_0xedca('0x69')](_0x2a6eee['body'][_0xedca('0x49')])||_0x2a6eee[_0xedca('0x49')][_0xedca('0x49')]===''){throw _0x512896['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0xedca('0x87')));}if(_[_0xedca('0x69')](_0x2a6eee[_0xedca('0x49')]['mapKeyOffline'])){throw _0x512896[_0xedca('0x1d')](0x1f4)[_0xedca('0x2a')](new db[(_0xedca('0x7d'))][(_0xedca('0x7e'))](_0xedca('0xbe')+_0x1004ed));}if(!_['includes'](_0x1004ed,_0x2a6eee[_0xedca('0x49')][_0xedca('0xbf')])){throw _0x512896[_0xedca('0x1d')](0x1f4)[_0xedca('0x2a')](new db[(_0xedca('0x7d'))][(_0xedca('0x7e'))](_0xedca('0xc0')+_0x1004ed));}_0x47377d[_0x2a6eee[_0xedca('0x49')][_0xedca('0xbf')]]=_0x2a6eee['body'][_0xedca('0x85')];})[_0xedca('0x13')](function(){return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x2a6eee[_0xedca('0x44')]['id']},'include':[{'model':db['CmList'],'as':_0xedca('0x93')},{'model':db[_0xedca('0xc1')],'as':_0xedca('0xc1')}]});})['then'](handleEntityNotFound(_0x512896,null))[_0xedca('0x13')](function(_0x5a6659){if(_0x5a6659&&_0x5a6659[_0xedca('0x93')]){_0x2029fc=_0x5a6659;var _0x147304=_[_0xedca('0x96')](_0x2a6eee[_0xedca('0x49')],{'firstName':_0x2a6eee[_0xedca('0x49')]['from'],'phone':_0x2a6eee['body'][_0xedca('0x85')],'ListId':_0x5a6659[_0xedca('0x84')]});_0x147304[_0x2a6eee[_0xedca('0x49')][_0xedca('0xbf')]]=_0x2a6eee['body']['from'];return db['CmContact'][_0xedca('0xc2')]({'where':_0x47377d,'defaults':_0x147304});}})['spread'](function(_0x250930){if(_0x250930){_0x413f0c=_0x250930;var _0x4ed8c4=fs[_0xedca('0xc3')](path[_0xedca('0x64')](config[_0xedca('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x1cefa1=ejs[_0xedca('0xc4')](_0x4ed8c4,{'body':_[_0xedca('0xc5')](_0x2a6eee[_0xedca('0x49')][_0xedca('0x49')]),'bodyTitle':_0x2029fc[_0xedca('0xc6')]});return db[_0xedca('0xc7')][_0xedca('0x48')]({'body':_0x1cefa1,'plainBody':htmlToText[_0xedca('0xc8')](_0x1cefa1),'ContactId':_0x250930['id'],'ChatWebsiteId':_0x2029fc['id']});}})[_0xedca('0x13')](function(_0x39f286){_0x22938f=_0x39f286;if(_0x2e12d6['length']){var _0xf3af48=_0x2e12d6[_0xedca('0x2d')](function(_0x55f482){return{'name':_0x55f482[_0xedca('0xc9')],'basename':_0x55f482['filename'],'type':_0x55f482[_0xedca('0xca')],'ChatOfflineMessageId':_0x39f286['id']};});_0x38128f=_0xf3af48['map'](_0x388a14=>{var _0x56c4fd={'filename':_0x388a14['name'],'path':path[_0xedca('0x64')](config[_0xedca('0x6b')],_0xedca('0xcb'),_0xedca('0xbd'),_0xedca('0xcc'),_0xedca('0xcd'),_0x388a14[_0xedca('0xce')])};return _0x56c4fd;});if(!_0x2029fc[_0xedca('0xcf')]){return db[_0xedca('0xd0')]['transaction'](function(_0x89336e){return db[_0xedca('0xd1')][_0xedca('0xd2')](_0xf3af48,{'transaction':_0x89336e});});}}})[_0xedca('0x13')](function(){if(_0x22938f){_0x4eb863=_0x22938f;return db[_0xedca('0xc1')][_0xedca('0x54')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xedca('0xd3'),'raw':!![],'include':[{'model':db[_0xedca('0xd4')],'as':_0xedca('0xd4'),'raw':!![]}]}]});}})[_0xedca('0x13')](function(_0x289649){if(_0x289649&&_0x289649[_0xedca('0xd3')]&&_0x2029fc[_0xedca('0xd5')]&&_0x2029fc[_0xedca('0xd6')]){var _0x552c33=_0x289649[_0xedca('0xd7')]();return respondWithRpcPromise(_0xedca('0xd8'),'sendMail',{'account':_0x552c33,'message':{'from':util['format'](_0xedca('0xd9'),_0x289649[_0xedca('0x29')],_0x289649[_0xedca('0xda')]||_0x289649[_0xedca('0xd3')][_0xedca('0x4a')]),'to':_0x2029fc[_0xedca('0xd6')],'subject':_0x2029fc['offlineMessageSubject'],'html':_0x4eb863[_0xedca('0x49')],'attachments':_0x38128f}},client9003)[_0xedca('0x13')](function(){return _0x4eb863;})[_0xedca('0x1b')](function(_0x155dd4){logger[_0xedca('0x18')](_0x155dd4);});}})['then'](function(){if(_0x2029fc&&_0x2029fc['openNewInteraction']&&_0x2029fc['MailAccountId']){var _0x557586=[];if(_0x2e12d6[_0xedca('0x38')]){_0x557586=_0x2e12d6[_0xedca('0x2d')](function(_0x5df606){return{'name':_0x5df606[_0xedca('0xc9')],'basename':_0x5df606['filename'],'type':_0x5df606[_0xedca('0xca')],'ChatOfflineMessageId':_0x22938f['id']};});}var _0x4649bd;if(!_[_0xedca('0x69')](_0x2029fc['subjectOffline'])){var _0x4a26bb=_[_0xedca('0x2d')](_0x2a6eee[_0xedca('0x49')],function(_0x173ea8){return _0x173ea8;});var _0x5e6932=_[_0xedca('0xdb')](_0x4a26bb)[0x0];var _0x82ffb5=_[_0xedca('0xdc')](_0x5e6932,function(_0x4e1b8b){return _0x4e1b8b;});_0x4649bd=_0x82ffb5[0x1][_0x2029fc[_0xedca('0xdd')]];}var _0x26cf38={'from':_0x413f0c[_0xedca('0xda')],'firstName':_0x413f0c[_0xedca('0x9c')],'lastName':_0x413f0c[_0xedca('0x9d')],'mapKey':_0xedca('0xda'),'message':{'from':_0x413f0c[_0xedca('0xda')],'to':_0x2029fc['MailAccount'][_0xedca('0xda')],'cc':'','subject':_['isNil'](_0x4649bd)?_0x2029fc[_0xedca('0xde')]:_0x4649bd,'messageId':'','sentAt':new Date(),'attach':_0x557586[_0xedca('0x38')],'attachments':_0x557586,'originChannel':_0xedca('0xdf'),'ChatWebsiteId':_0x2029fc['id'],'ChatOfflineMessageId':_0x4eb863['id'],'originTo':_0x2029fc[_0xedca('0xc1')][_0xedca('0xda')]},'body':_0x4eb863[_0xedca('0x49')]};var _0x254c42={'account':{'id':_0x2029fc[_0xedca('0xe0')]},'body':_0x26cf38,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x254c42,client9001)[_0xedca('0x13')](function(){return _0x4eb863;})[_0xedca('0x1b')](function(_0x3315da){logger[_0xedca('0x18')](_0x3315da);});}return;})[_0xedca('0x13')](function(){if(_0x4eb863){return _0x4eb863;}})[_0xedca('0x13')](respondWithResult(_0x512896,null))[_0xedca('0x1b')](function(_0x14a41d){logger['error'](_0xedca('0x1b'),_0x14a41d);for(var _0x10f009 of _0x2e12d6){var _0x35696d=path[_0xedca('0x64')](config[_0xedca('0x6b')],_0xedca('0xcb'),_0xedca('0xbd'),'attachments',_0xedca('0xcd'),_0x10f009[_0xedca('0x5e')]);fs_extra[_0xedca('0xe1')](_0x35696d)[_0xedca('0x1b')](function(_0x1c2328){logger[_0xedca('0x18')](_0xedca('0xe2'),_0x35696d,_0x1c2328);});}});};exports[_0xedca('0xe3')]=function(_0x19f1f0,_0x305a6f){return db[_0xedca('0xa9')][_0xedca('0x47')]({'where':{'id':_0x19f1f0[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x305a6f,null))[_0xedca('0x13')](function(_0x49b39e){if(_0x49b39e){return _0x49b39e[_0xedca('0xe3')](_0x19f1f0[_0xedca('0x49')]['ids'],_[_0xedca('0xe4')](_0x19f1f0['body'],[_0xedca('0x58'),'id'])||{});}})[_0xedca('0x13')](respondWithResult(_0x305a6f,null))[_0xedca('0x1b')](handleError(_0x305a6f,null));};exports[_0xedca('0xe5')]=function(_0x461b3b,_0x5121c8){var _0x402350={'raw':![],'where':{}};var _0x20af29={};var _0x4daa28={'count':0x0,'rows':[]};return db[_0xedca('0x2e')]['findOne']({'where':{'id':_0x461b3b[_0xedca('0x44')]['id']}})['then'](handleEntityNotFound(_0x5121c8,null))[_0xedca('0x13')](function(_0x5e0793){if(_0x5e0793){_0x20af29['model']=_[_0xedca('0x32')](db[_0xedca('0xa9')]['rawAttributes']);_0x20af29[_0xedca('0x33')]=_[_0xedca('0x32')](_0x461b3b[_0xedca('0x33')]);_0x20af29[_0xedca('0x34')]=_[_0xedca('0x35')](_0x20af29[_0xedca('0x31')],_0x20af29['query']);_0x402350['attributes']=_[_0xedca('0x35')](_0x20af29[_0xedca('0x31')],qs['fields'](_0x461b3b['query'][_0xedca('0x37')]));_0x402350[_0xedca('0x36')]=_0x402350['attributes'][_0xedca('0x38')]?_0x402350[_0xedca('0x36')]:_0x20af29['model'];if(!_0x461b3b['query'][_0xedca('0x39')]('nolimit')){_0x402350[_0xedca('0x21')]=qs[_0xedca('0x21')](_0x461b3b['query'][_0xedca('0x21')]);_0x402350[_0xedca('0x20')]=qs[_0xedca('0x20')](_0x461b3b['query'][_0xedca('0x20')]);}_0x402350['order']=qs[_0xedca('0x3b')](_0x461b3b['query'][_0xedca('0x3b')]);_0x402350['where']=qs['filters'](_[_0xedca('0x3d')](_0x461b3b[_0xedca('0x33')],_0x20af29[_0xedca('0x34')]));_0x402350[_0xedca('0x3c')][_0xedca('0x56')]=_0x5e0793['id'];if(_0x461b3b[_0xedca('0x33')]['filter']){_0x402350[_0xedca('0x3c')]=_[_0xedca('0x3f')](_0x402350[_0xedca('0x3c')],{'$or':_[_0xedca('0x2d')](_0x402350[_0xedca('0x36')],function(_0x4e929c){var _0x318efe={};_0x318efe[_0x4e929c]={'$like':'%'+_0x461b3b[_0xedca('0x33')]['filter']+'%'};return _0x318efe;})});}_0x402350=_[_0xedca('0x3f')]({},_0x402350,_0x461b3b[_0xedca('0x40')]);return db[_0xedca('0xa9')][_0xedca('0x22')]({'where':_0x402350[_0xedca('0x3c')]})[_0xedca('0x13')](function(_0x594940){_0x4daa28[_0xedca('0x22')]=_0x594940;if(_0x461b3b[_0xedca('0x33')][_0xedca('0x46')]){_0x402350['include']=[{'model':db[_0xedca('0x7c')],'as':_0xedca('0xe6'),'required':![]},{'model':db[_0xedca('0xb7')],'as':_0xedca('0xe7'),'attributes':[_0xedca('0x29'),_0xedca('0xe8'),_0xedca('0xe9')],'required':![]},{'model':db['Tag'],'as':_0xedca('0xea'),'attributes':['id',_0xedca('0x29'),_0xedca('0xeb')],'where':_0x461b3b[_0xedca('0x33')]['tag']?{'id':_0x461b3b[_0xedca('0x33')][_0xedca('0xec')]}:undefined,'required':_0x461b3b[_0xedca('0x33')][_0xedca('0xec')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x402350);})[_0xedca('0x13')](function(_0x5c70ec){_0x4daa28[_0xedca('0x43')]=_0x5c70ec;return _0x4daa28;});}})['then'](respondWithFilteredResult(_0x5121c8,_0x402350))[_0xedca('0x1b')](handleError(_0x5121c8,null));};function iftimePromise(_0x13fb40,_0x5c2905){return respondWithRpcPromise(_0xedca('0xed'),_0xedca('0xee'),{'command':_0x5c2905[_0xedca('0xef')]?util[_0xedca('0xa2')](_0xedca('0xf0'),_0x13fb40['interval'],_0x5c2905[_0xedca('0xef')]):util['format'](_0xedca('0xf1'),_0x13fb40[_0xedca('0xf2')])},client9002)[_0xedca('0x13')](function(_0x2e96cf){var _0x1c03ba=_0x2e96cf&&_0x2e96cf[_0xedca('0xf3')](_0xedca('0xf4'))>=0x0?!![]:![];logger[_0xedca('0x14')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5c2905['id'],_0x13fb40['id'],_0x13fb40[_0xedca('0xf2')],_0x1c03ba?_0xedca('0xf5'):'OFFLINE',_0x5c2905[_0xedca('0xef')]?_0x5c2905[_0xedca('0xef')]:_0xedca('0xf6'));return _0x1c03ba;})[_0xedca('0x1b')](function(_0x3983e2){logger['error'](_0xedca('0xf7'),_0x5c2905['id'],_0x13fb40['id'],_0x13fb40['interval'],util['inspect'](_0x3983e2,{'showHidden':![],'depth':null}),_0x5c2905[_0xedca('0xef')]?_0x5c2905[_0xedca('0xef')]:'No\x20timezone');return![];});}exports[_0xedca('0xee')]=function(_0x15cec7,_0x1f3eda){var _0x3969fa=0x0;var _0x39b2c3=0x0;var _0x11146e=![];var _0x56c2f1;var _0x613614;return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x15cec7[_0xedca('0x44')]['id']},'include':[{'model':db['Interval'],'as':_0xedca('0xf8'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1f3eda,null))['then'](function(_0xb9b41e){if(_0xb9b41e){_0x56c2f1=_0xb9b41e;return _0xb9b41e[_0xedca('0xf9')]({'raw':!![]});}})[_0xedca('0x13')](function(_0x56a624){if(_0x56c2f1){if(_0x56a624){_0x613614=_0x56a624;}}return require(_0xedca('0x66'))[_0xedca('0x67')]();})[_0xedca('0x13')](function(_0x2e0d12){if(_0x2e0d12){_0x39b2c3=_0x2e0d12[_0xedca('0xfa')];_0x11146e=_0x2e0d12[_0xedca('0x68')];}})[_0xedca('0x13')](function(){return db[_0xedca('0xa9')]['count']({'where':{'closed':![]}});})[_0xedca('0x13')](function(_0x4260bc){_0x3969fa=_0x4260bc;if(_0x39b2c3&&_0x4260bc>_0x39b2c3){return db[_0xedca('0xfb')]['findOne']({'where':{'id':0x1}})[_0xedca('0x13')](function(_0x1aff1a){if(_0x1aff1a){_0x1aff1a[_0xedca('0xfc')](_0xedca('0xfd'));}});}})[_0xedca('0x13')](function(){if(_0x56c2f1[_0xedca('0xf8')]&&_0x56c2f1[_0xedca('0xf8')][_0xedca('0xfe')]){var _0x1c4189=[];for(var _0x4b20c9=0x0;_0x4b20c9<_0x56c2f1[_0xedca('0xf8')][_0xedca('0xfe')]['length'];_0x4b20c9++){var _0x4e79b6=_0x56c2f1[_0xedca('0xf8')][_0xedca('0xfe')][_0x4b20c9][_0xedca('0x4b')]({'plain':!![]});_0x1c4189[_0xedca('0xb1')](iftimePromise(_0x4e79b6,_0x56c2f1));}return BPromise[_0xedca('0xff')](_0x1c4189)[_0xedca('0x13')](function(_0x5980f9){return _[_0xedca('0x100')](_0x5980f9);});}else{return!![];}})[_0xedca('0x13')](function(_0x12eb07){var _0x33156d=fs['readFileSync'](path[_0xedca('0x64')](config['root'],_0xedca('0x101')),_0xedca('0x102'));var _0x570741=new url['URL'](_0x56c2f1[_0xedca('0x103')])[_0xedca('0x104')];var _0x426782='3.1.0';var _0x10f40d=![];var _0x557d79={'chatVersion':_0x426782,'chatWebsiteAddressOrigin':_0x570741,'remote':_0x56c2f1[_0xedca('0x105')],'query':querystring['stringify'](_['merge'](_0x56c2f1[_0xedca('0x4b')]({'plain':!![]}),{'customerIp':_0x15cec7[_0xedca('0x78')][_0xedca('0x9a')]||_0x15cec7[_0xedca('0x78')][_0xedca('0x106')]||_0x15cec7['connection'][_0xedca('0x107')]||_0x15cec7['ip'],'referer':_0x15cec7[_0xedca('0x78')][_0xedca('0x9f')],'openedInteractions':_0x3969fa,'maxInteractions':_0x39b2c3,'virtual':_0x11146e['virtual'],'online':_0x12eb07,'custom':_0x11146e}))[_0xedca('0x108')](/'/g,'\x5c\x27')};_0x1f3eda[_0xedca('0x2a')](ejs[_0xedca('0xc4')](Mustache[_0xedca('0xc4')](_0x33156d,_0x557d79),{'proactiveActions':_0x613614,'alignment':_0x56c2f1[_0xedca('0x109')],'verticalAlignment':_0x56c2f1[_0xedca('0x10a')],'div_color':_0x56c2f1[_0xedca('0xeb')],'labelText':_0x56c2f1[_0xedca('0x10b')],'text_color':_0x56c2f1[_0xedca('0x10c')],'text_button_color':_0x56c2f1[_0xedca('0x10d')],'button_color':_0x56c2f1['color_button'],'background_color':_0x56c2f1[_0xedca('0x10e')],'hideWhenOffline':_0x56c2f1[_0xedca('0x10f')],'intervalId':_0x56c2f1[_0xedca('0x110')],'isDevelopment':_0x10f40d,'chatVersion':_0x426782}));})[_0xedca('0x1b')](handleError(_0x1f3eda,null));};exports['addApplications']=function(_0x3f2bec,_0x184db1){var _0x54d3fa=_0x3f2bec[_0xedca('0x44')]['id'];var _0x406c48=_0x3f2bec[_0xedca('0x49')];var _0x14728a=0xc8;var _0x29509f=null;return db['sequelize'][_0xedca('0x111')]({'isolationLevel':db[_0xedca('0xd0')][_0xedca('0x112')]['ISOLATION_LEVELS'][_0xedca('0x113')]},function(_0x5843bb){return db[_0xedca('0x2e')]['findOne']({'where':{'id':_0x54d3fa},'transaction':_0x5843bb})[_0xedca('0x13')](function(_0x37ab29){if(_0x37ab29){return db[_0xedca('0x8e')]['destroy']({'where':{'ChatWebsiteId':_0x54d3fa},'transaction':_0x5843bb})[_0xedca('0x13')](function(){var _0x463321=_[_0xedca('0x2d')](_0x406c48,function(_0x423353){_0x423353['ChatWebsiteId']=_0x54d3fa;return _0x423353;});return db['ChatApplication'][_0xedca('0xd2')](_0x463321,{'transaction':_0x5843bb});});}else{_0x14728a=0x194;_0x29509f=[];}});})[_0xedca('0x13')](function(){if(_0x14728a!==0x194){return db[_0xedca('0x8e')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x54d3fa},'order':_0xedca('0x114')})['then'](function(_0x44e866){_0x29509f=_0x44e866;});}})[_0xedca('0x1b')](function(_0x2c8d7b){_0x14728a=0x1f4;logger[_0xedca('0x18')](_0x2c8d7b[_0xedca('0x28')]);if(_0x2c8d7b[_0xedca('0x29')]){delete _0x2c8d7b['name'];}_0x29509f=_0x2c8d7b;})[_0xedca('0x115')](function(){if(_0x29509f===null){_0x184db1[_0xedca('0x1c')](_0x14728a);}else{if(_0x14728a===0x1f4){_0x184db1[_0xedca('0x1d')](_0x14728a)[_0xedca('0x2a')](_0x29509f);}else{_0x184db1[_0xedca('0x1d')](_0x14728a)[_0xedca('0x1f')](_0x29509f);}}});};exports[_0xedca('0x116')]=function(_0x48a0f9,_0x114a61){var _0x552d23={};var _0x153774={};var _0x7e30e5;var _0x3aa42f;return db[_0xedca('0x2e')][_0xedca('0x54')]({'where':{'id':_0x48a0f9[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x114a61,null))[_0xedca('0x13')](function(_0xcbe744){if(_0xcbe744){_0x7e30e5=_0xcbe744;_0x153774[_0xedca('0x31')]=_['keys'](db[_0xedca('0x8e')][_0xedca('0x45')]);_0x153774[_0xedca('0x33')]=_['keys'](_0x48a0f9[_0xedca('0x33')]);_0x153774[_0xedca('0x34')]=_['intersection'](_0x153774[_0xedca('0x31')],_0x153774['query']);_0x552d23[_0xedca('0x36')]=_[_0xedca('0x35')](_0x153774[_0xedca('0x31')],qs[_0xedca('0x37')](_0x48a0f9['query'][_0xedca('0x37')]));_0x552d23[_0xedca('0x36')]=_0x552d23[_0xedca('0x36')]['length']?_0x552d23[_0xedca('0x36')]:_0x153774['model'];_0x552d23[_0xedca('0x55')]=qs[_0xedca('0x3b')](_0x48a0f9['query']['sort']);_0x552d23[_0xedca('0x3c')]=qs[_0xedca('0x34')](_['pick'](_0x48a0f9['query'],_0x153774['filters']));if(_0x48a0f9[_0xedca('0x33')]['filter']){_0x552d23[_0xedca('0x3c')]=_['merge'](_0x552d23['where'],{'$or':_[_0xedca('0x2d')](_0x552d23[_0xedca('0x36')],function(_0x4ef153){var _0x3e10b1={};_0x3e10b1[_0x4ef153]={'$like':'%'+_0x48a0f9['query'][_0xedca('0x3e')]+'%'};return _0x3e10b1;})});}_0x552d23=_[_0xedca('0x3f')]({},_0x552d23,_0x48a0f9[_0xedca('0x40')]);return _0x7e30e5[_0xedca('0x116')](_0x552d23);}})[_0xedca('0x13')](function(_0x4c4aaf){if(_0x4c4aaf){_0x3aa42f=_0x4c4aaf[_0xedca('0x38')];if(!_0x48a0f9[_0xedca('0x33')][_0xedca('0x39')](_0xedca('0x3a'))){_0x552d23[_0xedca('0x21')]=qs['limit'](_0x48a0f9['query'][_0xedca('0x21')]);_0x552d23[_0xedca('0x20')]=qs['offset'](_0x48a0f9[_0xedca('0x33')][_0xedca('0x20')]);}return _0x7e30e5[_0xedca('0x116')](_0x552d23);}})['then'](function(_0x219d72){if(_0x219d72){return _0x219d72?{'count':_0x3aa42f,'rows':_0x219d72}:null;}})[_0xedca('0x13')](respondWithResult(_0x114a61,null))[_0xedca('0x1b')](handleError(_0x114a61,null));};exports[_0xedca('0x117')]=function(_0x19da3d,_0x1283b4){return db[_0xedca('0x118')][_0xedca('0x47')]({'where':{'id':_0x19da3d[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x1283b4,null))[_0xedca('0x13')](function(_0x2be4e9){if(_0x2be4e9){return _0x2be4e9['addProactiveActions'](_0x19da3d[_0xedca('0x49')][_0xedca('0x58')],_[_0xedca('0xe4')](_0x19da3d[_0xedca('0x49')],[_0xedca('0x58'),'id'])||{});}})[_0xedca('0x13')](respondWithResult(_0x1283b4,null))[_0xedca('0x1b')](handleError(_0x1283b4,null));};exports[_0xedca('0xf9')]=function(_0x3740c1,_0x4e6fe6){var _0x190c71={};var _0x5b64b7={};var _0xe8cc37;var _0x331229;return db[_0xedca('0x2e')][_0xedca('0x54')]({'where':{'id':_0x3740c1[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x4e6fe6,null))[_0xedca('0x13')](function(_0x5da18){if(_0x5da18){_0xe8cc37=_0x5da18;_0x5b64b7[_0xedca('0x31')]=_['keys'](db['ChatProactiveAction'][_0xedca('0x45')]);_0x5b64b7['query']=_[_0xedca('0x32')](_0x3740c1[_0xedca('0x33')]);_0x5b64b7[_0xedca('0x34')]=_[_0xedca('0x35')](_0x5b64b7[_0xedca('0x31')],_0x5b64b7['query']);_0x190c71[_0xedca('0x36')]=_[_0xedca('0x35')](_0x5b64b7['model'],qs[_0xedca('0x37')](_0x3740c1[_0xedca('0x33')][_0xedca('0x37')]));_0x190c71['attributes']=_0x190c71['attributes'][_0xedca('0x38')]?_0x190c71[_0xedca('0x36')]:_0x5b64b7[_0xedca('0x31')];_0x190c71[_0xedca('0x55')]=qs[_0xedca('0x3b')](_0x3740c1[_0xedca('0x33')]['sort']);_0x190c71[_0xedca('0x3c')]=qs[_0xedca('0x34')](_[_0xedca('0x3d')](_0x3740c1[_0xedca('0x33')],_0x5b64b7[_0xedca('0x34')]));if(_0x3740c1[_0xedca('0x33')][_0xedca('0x3e')]){_0x190c71[_0xedca('0x3c')]=_[_0xedca('0x3f')](_0x190c71[_0xedca('0x3c')],{'$or':_[_0xedca('0x2d')](_0x190c71[_0xedca('0x36')],function(_0x272cf9){var _0x48a6b7={};_0x48a6b7[_0x272cf9]={'$like':'%'+_0x3740c1['query'][_0xedca('0x3e')]+'%'};return _0x48a6b7;})});}_0x190c71=_[_0xedca('0x3f')]({},_0x190c71,_0x3740c1['options']);return _0xe8cc37[_0xedca('0xf9')](_0x190c71);}})['then'](function(_0x566796){if(_0x566796){_0x331229=_0x566796['length'];if(!_0x3740c1[_0xedca('0x33')][_0xedca('0x39')](_0xedca('0x3a'))){_0x190c71['limit']=qs[_0xedca('0x21')](_0x3740c1[_0xedca('0x33')][_0xedca('0x21')]);_0x190c71[_0xedca('0x20')]=qs[_0xedca('0x20')](_0x3740c1['query'][_0xedca('0x20')]);}return _0xe8cc37['getProactiveActions'](_0x190c71);}})[_0xedca('0x13')](function(_0x367ea3){if(_0x367ea3){return _0x367ea3?{'count':_0x331229,'rows':_0x367ea3}:null;}})['then'](respondWithResult(_0x4e6fe6,null))[_0xedca('0x1b')](handleError(_0x4e6fe6,null));};exports[_0xedca('0x119')]=function(_0x334c45,_0xf54966){var _0x304a1c=_0x334c45['query'][_0xedca('0x11a')]===_0xedca('0x11b')?_0xedca('0x11c'):'onlineForm';return db[_0xedca('0x2e')][_0xedca('0x47')]({'attributes':['id',_0x304a1c],'where':{'id':_0x334c45['params']['id']}})['then'](handleEntityNotFound(_0xf54966,null))[_0xedca('0x13')](function(_0x1e1bdc){if(_0x1e1bdc){var _0x68dca3=_0x1e1bdc[_0x304a1c];var _0x1513ba=_0x68dca3&&_0x68dca3[_0xedca('0x11d')]?_0x68dca3[_0xedca('0x11d')]:[];_0xf54966['send']({'fromKey':_[_0xedca('0x69')](_0x68dca3[_0xedca('0x11e')])?undefined:_0x68dca3[_0xedca('0x11e')],'count':_0x1513ba['length'],'rows':_0x1513ba});}})[_0xedca('0x1b')](handleError(_0xf54966,null));};exports[_0xedca('0x11f')]=function(_0x553643,_0x349f5d){var _0x48ab96={'raw':![],'where':{}};var _0x27f24a={};var _0x300580={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xedca('0x54')]({'where':{'id':_0x553643['params']['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x349f5d,null))['then'](function(_0x21d40f){if(_0x21d40f){_0x27f24a[_0xedca('0x31')]=_[_0xedca('0x32')](db['ChatOfflineMessage'][_0xedca('0x45')]);_0x27f24a['query']=_[_0xedca('0x32')](_0x553643[_0xedca('0x33')]);_0x27f24a['filters']=_['intersection'](_0x27f24a['model'],_0x27f24a[_0xedca('0x33')]);_0x48ab96['attributes']=_[_0xedca('0x35')](_0x27f24a['model'],qs[_0xedca('0x37')](_0x553643[_0xedca('0x33')][_0xedca('0x37')]));_0x48ab96[_0xedca('0x36')]=_0x48ab96[_0xedca('0x36')][_0xedca('0x38')]?_0x48ab96[_0xedca('0x36')]:_0x27f24a['model'];if(!_0x553643[_0xedca('0x33')][_0xedca('0x39')](_0xedca('0x3a'))){_0x48ab96[_0xedca('0x21')]=qs[_0xedca('0x21')](_0x553643['query'][_0xedca('0x21')]);_0x48ab96[_0xedca('0x20')]=qs[_0xedca('0x20')](_0x553643['query'][_0xedca('0x20')]);}_0x48ab96[_0xedca('0x55')]=qs[_0xedca('0x3b')](_0x553643[_0xedca('0x33')][_0xedca('0x3b')]);_0x48ab96[_0xedca('0x3c')]=qs['filters'](_['pick'](_0x553643[_0xedca('0x33')],_0x27f24a['filters']));_0x48ab96['where'][_0xedca('0x56')]=_0x21d40f['id'];if(_0x553643[_0xedca('0x33')][_0xedca('0x3e')]){_0x48ab96[_0xedca('0x3c')]=_[_0xedca('0x3f')](_0x48ab96['where'],{'$or':_['map'](_0x48ab96[_0xedca('0x36')],function(_0x13360a){var _0x4a306={};_0x4a306[_0x13360a]={'$like':'%'+_0x553643['query']['filter']+'%'};return _0x4a306;})});}_0x48ab96=_[_0xedca('0x3f')]({},_0x48ab96,_0x553643[_0xedca('0x40')]);return db[_0xedca('0xc7')]['count']({'where':_0x48ab96[_0xedca('0x3c')]})['then'](function(_0x46d143){_0x300580[_0xedca('0x22')]=_0x46d143;if(_0x553643[_0xedca('0x33')][_0xedca('0x46')]){_0x48ab96[_0xedca('0x41')]=[{'all':!![]}];}else{_0x48ab96['include']=[{'model':db[_0xedca('0x7c')],'as':_0xedca('0xe6'),'required':![]},{'model':db[_0xedca('0xd1')],'as':_0xedca('0x120'),'required':![]}];}return db['ChatOfflineMessage'][_0xedca('0x42')](_0x48ab96);})[_0xedca('0x13')](function(_0x18c503){_0x300580[_0xedca('0x43')]=_0x18c503;return _0x300580;});}})[_0xedca('0x13')](respondWithFilteredResult(_0x349f5d,_0x48ab96))['catch'](handleError(_0x349f5d,null));};exports[_0xedca('0x121')]=function(_0x22c043,_0x422b4f){return db[_0xedca('0x2e')]['find']({'where':{'id':_0x22c043['params']['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x422b4f,null))[_0xedca('0x13')](function(_0x215002){if(_0x215002){return _0x215002[_0xedca('0x121')](_0x22c043[_0xedca('0x49')][_0xedca('0x58')],_[_0xedca('0xe4')](_0x22c043[_0xedca('0x49')],[_0xedca('0x58'),'id'])||{})[_0xedca('0xad')](function(_0x1811be){for(var _0xa3b7fc=0x0;_0xa3b7fc<_0x22c043[_0xedca('0x49')][_0xedca('0x58')][_0xedca('0x38')];_0xa3b7fc+=0x1){socket[_0xedca('0x122')](_0xedca('0x123'),{'UserId':Number(_0x22c043[_0xedca('0x49')][_0xedca('0x58')][_0xa3b7fc]),'ChatWebsiteId':Number(_0x22c043[_0xedca('0x44')]['id'])});}return _0x1811be;});}})[_0xedca('0x13')](respondWithResult(_0x422b4f,null))[_0xedca('0x1b')](handleError(_0x422b4f,null));};exports[_0xedca('0x124')]=function(_0x579f6f,_0x35fae3){return db[_0xedca('0x2e')][_0xedca('0x47')]({'where':{'id':_0x579f6f[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x35fae3,null))[_0xedca('0x13')](function(_0x238276){if(_0x238276){return _0x238276[_0xedca('0x124')](_0x579f6f[_0xedca('0x33')][_0xedca('0x58')])[_0xedca('0x13')](function(){if(_[_0xedca('0x125')](_0x579f6f['query']['ids'])){for(var _0x554056=0x0;_0x554056<_0x579f6f['query'][_0xedca('0x58')][_0xedca('0x38')];_0x554056+=0x1){socket[_0xedca('0x122')](_0xedca('0x126'),{'UserId':Number(_0x579f6f[_0xedca('0x33')][_0xedca('0x58')][_0x554056]),'ChatWebsiteId':Number(_0x579f6f[_0xedca('0x44')]['id'])});}}else{socket['emit'](_0xedca('0x126'),{'UserId':Number(_0x579f6f[_0xedca('0x33')][_0xedca('0x58')]),'ChatWebsiteId':Number(_0x579f6f[_0xedca('0x44')]['id'])});}});}})[_0xedca('0x13')](respondWithStatusCode(_0x35fae3,null))[_0xedca('0x1b')](handleError(_0x35fae3,null));};exports[_0xedca('0x127')]=function(_0x4907d4,_0x3a223f){var _0x1a016e={};var _0x2f3e91={};var _0x270a52;var _0x1a9312;return db[_0xedca('0x2e')][_0xedca('0x54')]({'where':{'id':_0x4907d4[_0xedca('0x44')]['id']}})[_0xedca('0x13')](handleEntityNotFound(_0x3a223f,null))[_0xedca('0x13')](function(_0x458ede){if(_0x458ede){_0x270a52=_0x458ede;_0x2f3e91[_0xedca('0x31')]=_[_0xedca('0x32')](db[_0xedca('0xb7')][_0xedca('0x45')]);_0x2f3e91['query']=_[_0xedca('0x32')](_0x4907d4[_0xedca('0x33')]);_0x2f3e91[_0xedca('0x34')]=_[_0xedca('0x35')](_0x2f3e91[_0xedca('0x31')],_0x2f3e91[_0xedca('0x33')]);_0x1a016e[_0xedca('0x36')]=_[_0xedca('0x35')](_0x2f3e91['model'],qs['fields'](_0x4907d4[_0xedca('0x33')][_0xedca('0x37')]));_0x1a016e[_0xedca('0x36')]=_0x1a016e['attributes'][_0xedca('0x38')]?_0x1a016e[_0xedca('0x36')]:_0x2f3e91[_0xedca('0x31')];_0x1a016e['order']=qs[_0xedca('0x3b')](_0x4907d4[_0xedca('0x33')][_0xedca('0x3b')]);_0x1a016e[_0xedca('0x3c')]=qs[_0xedca('0x34')](_[_0xedca('0x3d')](_0x4907d4[_0xedca('0x33')],_0x2f3e91['filters']));if(_0x4907d4[_0xedca('0x33')]['filter']){_0x1a016e['where']=_['merge'](_0x1a016e['where'],{'$or':_[_0xedca('0x2d')](_0x1a016e[_0xedca('0x36')],function(_0x3a0788){var _0x50a532={};_0x50a532[_0x3a0788]={'$like':'%'+_0x4907d4[_0xedca('0x33')]['filter']+'%'};return _0x50a532;})});}_0x1a016e=_[_0xedca('0x3f')]({},_0x1a016e,_0x4907d4[_0xedca('0x40')]);return _0x270a52[_0xedca('0x127')](_0x1a016e);}})['then'](function(_0x32c0ba){if(_0x32c0ba){_0x1a9312=_0x32c0ba[_0xedca('0x38')];if(!_0x4907d4[_0xedca('0x33')][_0xedca('0x39')]('nolimit')){_0x1a016e[_0xedca('0x21')]=qs[_0xedca('0x21')](_0x4907d4[_0xedca('0x33')][_0xedca('0x21')]);_0x1a016e[_0xedca('0x20')]=qs['offset'](_0x4907d4[_0xedca('0x33')][_0xedca('0x20')]);}return _0x270a52[_0xedca('0x127')](_0x1a016e);}})[_0xedca('0x13')](function(_0x4c1699){if(_0x4c1699){return _0x4c1699?{'count':_0x1a9312,'rows':_0x4c1699}:null;}})['then'](respondWithResult(_0x3a223f,null))['catch'](handleError(_0x3a223f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 0fd6983..c8ef7ac 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 _0x5b7f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x2ba3c3,_0xbe09fc){var _0x274a7e=function(_0x32b6c3){while(--_0x32b6c3){_0x2ba3c3['push'](_0x2ba3c3['shift']());}};_0x274a7e(++_0xbe09fc);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x276a57,_0x4f525c){_0x276a57=_0x276a57-0x0;var _0x5f0e81=_0x5b7f[_0x276a57];return _0x5f0e81;};'use strict';var EventEmitter=require(_0xf5b7('0x0'));var ChatWebsite=require(_0xf5b7('0x1'))['db'][_0xf5b7('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf5b7('0x3')](0x0);var events={'afterCreate':_0xf5b7('0x4'),'afterUpdate':_0xf5b7('0x5'),'afterDestroy':_0xf5b7('0x6')};function emitEvent(_0x2ae04f){return function(_0x2c5439,_0x2dfb67,_0x3c1efc){ChatWebsiteEvents[_0xf5b7('0x7')](_0x2ae04f+':'+_0x2c5439['id'],_0x2c5439);ChatWebsiteEvents[_0xf5b7('0x7')](_0x2ae04f,_0x2c5439);_0x3c1efc(null);};}for(var e in events){if(events[_0xf5b7('0x8')](e)){var event=events[e];ChatWebsite[_0xf5b7('0x9')](e,emitEvent(event));}}module[_0xf5b7('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3148=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0xd2dfeb,_0x51aa27){var _0x313172=function(_0x4cc2ba){while(--_0x4cc2ba){_0xd2dfeb['push'](_0xd2dfeb['shift']());}};_0x313172(++_0x51aa27);}(_0x3148,0x1d3));var _0x8314=function(_0x9ab282,_0x224526){_0x9ab282=_0x9ab282-0x0;var _0x3ae406=_0x3148[_0x9ab282];return _0x3ae406;};'use strict';var EventEmitter=require(_0x8314('0x0'));var ChatWebsite=require(_0x8314('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8314('0x2')](0x0);var events={'afterCreate':_0x8314('0x3'),'afterUpdate':_0x8314('0x4'),'afterDestroy':_0x8314('0x5')};function emitEvent(_0x58f818){return function(_0x35ee55,_0x41e9fd,_0x62c506){ChatWebsiteEvents[_0x8314('0x6')](_0x58f818+':'+_0x35ee55['id'],_0x35ee55);ChatWebsiteEvents[_0x8314('0x6')](_0x58f818,_0x35ee55);_0x62c506(null);};}for(var e in events){if(events[_0x8314('0x7')](e)){var event=events[e];ChatWebsite[_0x8314('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 4764343..b1dc877 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 _0x985e=['bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','ChatWebsite','lodash','../../config/logger','api','moment'];(function(_0x5bb974,_0x100ef1){var _0x4b607c=function(_0x92f321){while(--_0x92f321){_0x5bb974['push'](_0x5bb974['shift']());}};_0x4b607c(++_0x100ef1);}(_0x985e,0xd8));var _0xe985=function(_0x295ece,_0x55ed2d){_0x295ece=_0x295ece-0x0;var _0x47a60e=_0x985e[_0x295ece];return _0x47a60e;};'use strict';var _=require(_0xe985('0x0'));var util=require('util');var logger=require(_0xe985('0x1'))(_0xe985('0x2'));var moment=require(_0xe985('0x3'));var BPromise=require(_0xe985('0x4'));var rp=require(_0xe985('0x5'));var fs=require('fs');var path=require(_0xe985('0x6'));var rimraf=require(_0xe985('0x7'));var config=require('../../config/environment');var attributes=require(_0xe985('0x8'));module[_0xe985('0x9')]=function(_0xd82472,_0x1d706f){return _0xd82472['define'](_0xe985('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdde=['chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite'];(function(_0x28f026,_0x37c2bc){var _0x40fe6a=function(_0x4db87c){while(--_0x4db87c){_0x28f026['push'](_0x28f026['shift']());}};_0x40fe6a(++_0x37c2bc);}(_0xfdde,0x135));var _0xefdd=function(_0x425969,_0x5efd79){_0x425969=_0x425969-0x0;var _0x56b57f=_0xfdde[_0x425969];return _0x56b57f;};'use strict';var _=require(_0xefdd('0x0'));var util=require(_0xefdd('0x1'));var logger=require(_0xefdd('0x2'))(_0xefdd('0x3'));var moment=require(_0xefdd('0x4'));var BPromise=require(_0xefdd('0x5'));var rp=require(_0xefdd('0x6'));var fs=require('fs');var path=require(_0xefdd('0x7'));var rimraf=require(_0xefdd('0x8'));var config=require(_0xefdd('0x9'));var attributes=require(_0xefdd('0xa'));module['exports']=function(_0x584d24,_0xdacbdd){return _0x584d24[_0xefdd('0xb')](_0xefdd('0xc'),attributes,{'tableName':_0xefdd('0xd'),'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 4897240..a0e01cf 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 _0x8420=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x51487f,_0x508c4b){var _0x6d0523=function(_0x44c049){while(--_0x44c049){_0x51487f['push'](_0x51487f['shift']());}};_0x6d0523(++_0x508c4b);}(_0x8420,0x1e3));var _0x0842=function(_0x5b809a,_0x146c71){_0x5b809a=_0x5b809a-0x0;var _0x34ed89=_0x8420[_0x5b809a];return _0x34ed89;};'use strict';var _=require(_0x0842('0x0'));var util=require(_0x0842('0x1'));var moment=require(_0x0842('0x2'));var BPromise=require(_0x0842('0x3'));var rs=require(_0x0842('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0842('0x5'))['db'];var utils=require(_0x0842('0x6'));var logger=require(_0x0842('0x7'))(_0x0842('0x8'));var config=require(_0x0842('0x9'));var jayson=require(_0x0842('0xa'));var client=jayson['client'][_0x0842('0xb')]({'port':0x232a});config[_0x0842('0xc')]=_[_0x0842('0xd')](config[_0x0842('0xc')],{'host':_0x0842('0xe'),'port':0x18eb});var socket=require(_0x0842('0xf'))(new Redis(config[_0x0842('0xc')]));require(_0x0842('0x10'))[_0x0842('0x11')](socket);function respondWithRpcPromise(_0x327414,_0x124c9a,_0x4c4320){return new BPromise(function(_0x5a4688,_0x30465c){return client['request'](_0x327414,_0x4c4320)[_0x0842('0x12')](function(_0x4a7bc8){logger[_0x0842('0x13')](_0x0842('0x14'),_0x124c9a,_0x0842('0x15'));logger[_0x0842('0x16')](_0x0842('0x17'),_0x124c9a,_0x0842('0x15'),JSON['stringify'](_0x4a7bc8));if(_0x4a7bc8['error']){if(_0x4a7bc8[_0x0842('0x18')][_0x0842('0x19')]===0x1f4){logger[_0x0842('0x18')](_0x0842('0x14'),_0x124c9a,_0x4a7bc8[_0x0842('0x18')]['message']);return _0x30465c(_0x4a7bc8[_0x0842('0x18')][_0x0842('0x1a')]);}logger[_0x0842('0x18')](_0x0842('0x14'),_0x124c9a,_0x4a7bc8[_0x0842('0x18')]['message']);return _0x5a4688(_0x4a7bc8[_0x0842('0x18')][_0x0842('0x1a')]);}else{logger['info'](_0x0842('0x14'),_0x124c9a,_0x0842('0x15'));_0x5a4688(_0x4a7bc8[_0x0842('0x1b')][_0x0842('0x1a')]);}})[_0x0842('0x1c')](function(_0xb33835){logger[_0x0842('0x18')](_0x0842('0x14'),_0x124c9a,_0xb33835);_0x30465c(_0xb33835);});});} \ No newline at end of file +var _0x7aa0=['error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1ce6ff,_0x296af8){var _0x3c8af9=function(_0xc6568f){while(--_0xc6568f){_0x1ce6ff['push'](_0x1ce6ff['shift']());}};_0x3c8af9(++_0x296af8);}(_0x7aa0,0x18c));var _0x07aa=function(_0x4c1e2e,_0x4d77c2){_0x4c1e2e=_0x4c1e2e-0x0;var _0xac939c=_0x7aa0[_0x4c1e2e];return _0xac939c;};'use strict';var _=require(_0x07aa('0x0'));var util=require(_0x07aa('0x1'));var moment=require(_0x07aa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07aa('0x3'))['db'];var utils=require(_0x07aa('0x4'));var logger=require(_0x07aa('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x07aa('0x6'));var client=jayson['client'][_0x07aa('0x7')]({'port':0x232a});config[_0x07aa('0x8')]=_[_0x07aa('0x9')](config['redis'],{'host':_0x07aa('0xa'),'port':0x18eb});var socket=require(_0x07aa('0xb'))(new Redis(config[_0x07aa('0x8')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x481ab5,_0x58701a,_0x228420){return new BPromise(function(_0x2ea744,_0x247edf){return client[_0x07aa('0xc')](_0x481ab5,_0x228420)['then'](function(_0x4d3824){logger[_0x07aa('0xd')](_0x07aa('0xe'),_0x58701a,'request\x20sent');logger[_0x07aa('0xf')](_0x07aa('0x10'),_0x58701a,_0x07aa('0x11'),JSON['stringify'](_0x4d3824));if(_0x4d3824[_0x07aa('0x12')]){if(_0x4d3824[_0x07aa('0x12')][_0x07aa('0x13')]===0x1f4){logger[_0x07aa('0x12')](_0x07aa('0xe'),_0x58701a,_0x4d3824[_0x07aa('0x12')][_0x07aa('0x14')]);return _0x247edf(_0x4d3824['error']['message']);}logger[_0x07aa('0x12')](_0x07aa('0xe'),_0x58701a,_0x4d3824[_0x07aa('0x12')][_0x07aa('0x14')]);return _0x2ea744(_0x4d3824[_0x07aa('0x12')][_0x07aa('0x14')]);}else{logger[_0x07aa('0xd')](_0x07aa('0xe'),_0x58701a,_0x07aa('0x11'));_0x2ea744(_0x4d3824[_0x07aa('0x15')]['message']);}})[_0x07aa('0x16')](function(_0x29a8e1){logger[_0x07aa('0x12')](_0x07aa('0xe'),_0x58701a,_0x29a8e1);_0x247edf(_0x29a8e1);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8f367e7..427df9d 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 _0x3051=['./chatWebsite.events','save','update','emit','removeListener','register','chatWebsite:'];(function(_0x4d3835,_0x4f5f50){var _0x823439=function(_0x25a5c6){while(--_0x25a5c6){_0x4d3835['push'](_0x4d3835['shift']());}};_0x823439(++_0x4f5f50);}(_0x3051,0xa8));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var ChatWebsiteEvents=require(_0x1305('0x0'));var events=[_0x1305('0x1'),'remove',_0x1305('0x2')];function createListener(_0x3014f9,_0x56d8f6){return function(_0x43b181){_0x56d8f6[_0x1305('0x3')](_0x3014f9,_0x43b181);};}function removeListener(_0x410990,_0x182c53){return function(){ChatWebsiteEvents[_0x1305('0x4')](_0x410990,_0x182c53);};}exports[_0x1305('0x5')]=function(_0x23340f){for(var _0x550a3a=0x0,_0x35f960=events['length'];_0x550a3a<_0x35f960;_0x550a3a++){var _0x41e24f=events[_0x550a3a];var _0x4529c0=createListener(_0x1305('0x6')+_0x41e24f,_0x23340f);ChatWebsiteEvents['on'](_0x41e24f,_0x4529c0);}}; \ No newline at end of file +var _0x5171=['chatWebsite:','update','emit','register'];(function(_0x56751a,_0x143ba2){var _0x2ec86e=function(_0x480727){while(--_0x480727){_0x56751a['push'](_0x56751a['shift']());}};_0x2ec86e(++_0x143ba2);}(_0x5171,0x99));var _0x1517=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x5171[_0x51c819];return _0x15c5d2;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save','remove',_0x1517('0x0')];function createListener(_0x2154d8,_0x355cd6){return function(_0x3f5efb){_0x355cd6[_0x1517('0x1')](_0x2154d8,_0x3f5efb);};}function removeListener(_0x117492,_0xa2af7a){return function(){ChatWebsiteEvents['removeListener'](_0x117492,_0xa2af7a);};}exports[_0x1517('0x2')]=function(_0x251c7a){for(var _0x42645c=0x0,_0x474b47=events['length'];_0x42645c<_0x474b47;_0x42645c++){var _0x10685d=events[_0x42645c];var _0x6122f0=createListener(_0x1517('0x3')+_0x10685d,_0x251c7a);ChatWebsiteEvents['on'](_0x10685d,_0x6122f0);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d90ff5f..dd0868c 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 _0xd0a7=['delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','single','addLogo','now','file','addAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','offline','/:id/interactions','addApplications','addProactiveActions','put','/:id','update'];(function(_0x4b42e2,_0x5d4f5e){var _0x43f52f=function(_0x537c2e){while(--_0x537c2e){_0x4b42e2['push'](_0x4b42e2['shift']());}};_0x43f52f(++_0x5d4f5e);}(_0xd0a7,0x1a9));var _0x7d0a=function(_0xa9a034,_0x50b7cd){_0xa9a034=_0xa9a034-0x0;var _0x82cdcb=_0xd0a7[_0xa9a034];return _0x82cdcb;};'use strict';var multer=require(_0x7d0a('0x0'));var util=require(_0x7d0a('0x1'));var path=require(_0x7d0a('0x2'));var timeout=require(_0x7d0a('0x3'));var express=require(_0x7d0a('0x4'));var router=express[_0x7d0a('0x5')]();var fs_extra=require(_0x7d0a('0x6'));var auth=require(_0x7d0a('0x7'));var interaction=require(_0x7d0a('0x8'));var config=require(_0x7d0a('0x9'));var controller=require('./chatWebsite.controller');router[_0x7d0a('0xa')]('/',auth[_0x7d0a('0xb')](),controller[_0x7d0a('0xc')]);router['get'](_0x7d0a('0xd'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0xe')]);router[_0x7d0a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7d0a('0xf')]);router[_0x7d0a('0xa')](_0x7d0a('0x10'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x11')]);router['get'](_0x7d0a('0x12'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x13')]);router[_0x7d0a('0xa')](_0x7d0a('0x14'),controller['getLogo']);router[_0x7d0a('0xa')](_0x7d0a('0x15'),controller['getAvatar']);router[_0x7d0a('0xa')]('/:id/customer_avatar',controller[_0x7d0a('0x16')]);router[_0x7d0a('0xa')](_0x7d0a('0x17'),controller[_0x7d0a('0x18')]);router[_0x7d0a('0xa')]('/:id/interactions',auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x19')]);router[_0x7d0a('0xa')](_0x7d0a('0x1a'),controller['getSnippet']);router[_0x7d0a('0xa')](_0x7d0a('0x1b'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x1c')]);router[_0x7d0a('0xa')](_0x7d0a('0x1d'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x1e')]);router['get']('/:id/fields',controller[_0x7d0a('0x1f')]);router[_0x7d0a('0xa')](_0x7d0a('0x20'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x21')]);router[_0x7d0a('0xa')](_0x7d0a('0x22'),auth['isAuthenticated'](),controller[_0x7d0a('0x23')]);router[_0x7d0a('0x24')]('/',auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x25')]);router['post'](_0x7d0a('0x10'),auth[_0x7d0a('0xb')](),controller['addDisposition']);router['post'](_0x7d0a('0x12'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x26')]);var upload=multer({'storage':multer[_0x7d0a('0x27')]({'destination':function(_0x4d88ff,_0x2eac2d,_0xa4390a){_0xa4390a(null,path[_0x7d0a('0x28')](config[_0x7d0a('0x29')],_0x7d0a('0x2a')));},'filename':function(_0x1310c2,_0x2110ee,_0x1d29dc){_0x1d29dc(null,util[_0x7d0a('0x2b')](_0x7d0a('0x2c'),Date['now'](),_0x2110ee[_0x7d0a('0x2d')]));}})});router[_0x7d0a('0x24')](_0x7d0a('0x14'),upload[_0x7d0a('0x2e')]('file'),controller[_0x7d0a('0x2f')]);var upload=multer({'storage':multer[_0x7d0a('0x27')]({'destination':function(_0x573e6b,_0x2bc9dc,_0x52f181){_0x52f181(null,path['join'](config[_0x7d0a('0x29')],'server/files/images/avatars/'));},'filename':function(_0x35bef7,_0x1f6934,_0x525c2e){_0x525c2e(null,util[_0x7d0a('0x2b')](_0x7d0a('0x2c'),Date[_0x7d0a('0x30')](),_0x1f6934[_0x7d0a('0x2d')]));}})});router[_0x7d0a('0x24')](_0x7d0a('0x15'),upload['single'](_0x7d0a('0x31')),controller[_0x7d0a('0x32')]);var upload=multer({'storage':multer[_0x7d0a('0x27')]({'destination':function(_0x23eff0,_0x28c825,_0xd67aee){_0xd67aee(null,path[_0x7d0a('0x28')](config[_0x7d0a('0x29')],_0x7d0a('0x33')));},'filename':function(_0x52a569,_0x1aea64,_0x4f879f){_0x4f879f(null,util['format'](_0x7d0a('0x2c'),Date['now'](),_0x1aea64[_0x7d0a('0x2d')]));}})});router[_0x7d0a('0x24')]('/:id/customer_avatar',upload['single'](_0x7d0a('0x31')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x376980,_0x45dd70,_0x511a3b){_0x511a3b(null,path[_0x7d0a('0x28')](config[_0x7d0a('0x29')],_0x7d0a('0x33')));},'filename':function(_0x179737,_0x2ce478,_0x1e5078){_0x1e5078(null,util[_0x7d0a('0x2b')](_0x7d0a('0x2c'),Date[_0x7d0a('0x30')](),_0x2ce478[_0x7d0a('0x2d')]));}})});router['post'](_0x7d0a('0x17'),upload['single'](_0x7d0a('0x31')),controller[_0x7d0a('0x34')]);router[_0x7d0a('0x24')](_0x7d0a('0x35'),controller[_0x7d0a('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x7d0a('0x27')]({'destination':function(_0x5b6039,_0x32a16a,_0x5d763f){const _0x35a616=path[_0x7d0a('0x28')](config[_0x7d0a('0x29')],'server/files','attachments',_0x7d0a('0x37'));fs_extra[_0x7d0a('0x38')](_0x35a616,function(){_0x5d763f(null,_0x35a616);});},'filename':function(_0x1e1734,_0x49209d,_0x169be9){const _0x4e2d37=_0x49209d[_0x7d0a('0x2d')][_0x7d0a('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x141f53=path['extname'](_0x4e2d37);const _0x293942=Date[_0x7d0a('0x30')]()+'-'+_0x4e2d37[_0x7d0a('0x39')](_0x141f53,'')+_0x141f53;_0x169be9(null,_0x293942);}})});router[_0x7d0a('0x24')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x7d0a('0x3a')]);router[_0x7d0a('0x24')](_0x7d0a('0x3b'),auth[_0x7d0a('0xb')](),controller['addInteraction']);router[_0x7d0a('0x24')](_0x7d0a('0x1b'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x3c')]);router[_0x7d0a('0x24')](_0x7d0a('0x1d'),auth['isAuthenticated'](),controller[_0x7d0a('0x3d')]);router[_0x7d0a('0x24')](_0x7d0a('0x22'),auth[_0x7d0a('0xb')](),controller['addAgents']);router[_0x7d0a('0x3e')](_0x7d0a('0x3f'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x40')]);router[_0x7d0a('0x41')](_0x7d0a('0x3f'),auth[_0x7d0a('0xb')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x42')]);router[_0x7d0a('0x41')](_0x7d0a('0x12'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x43')]);router['delete'](_0x7d0a('0x22'),auth[_0x7d0a('0xb')](),controller[_0x7d0a('0x44')]);module[_0x7d0a('0x45')]=router; \ No newline at end of file +var _0x6851=['isAuthenticated','/: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','/:id/applications','getApplications','/:id/proactive_actions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','server/files/images/logos/','format','%s-%s','originalname','single','file','addLogo','root','server/files/images/avatars/','now','addCustomerAvatar','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','index','/:id'];(function(_0x8c0bf5,_0x2456ab){var _0x447387=function(_0x4c2469){while(--_0x4c2469){_0x8c0bf5['push'](_0x8c0bf5['shift']());}};_0x447387(++_0x2456ab);}(_0x6851,0x1ca));var _0x1685=function(_0x2a053a,_0xf7e06f){_0x2a053a=_0x2a053a-0x0;var _0x33adb2=_0x6851[_0x2a053a];return _0x33adb2;};'use strict';var multer=require('multer');var util=require(_0x1685('0x0'));var path=require(_0x1685('0x1'));var timeout=require(_0x1685('0x2'));var express=require('express');var router=express[_0x1685('0x3')]();var fs_extra=require(_0x1685('0x4'));var auth=require(_0x1685('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1685('0x6'));var controller=require(_0x1685('0x7'));router[_0x1685('0x8')]('/',auth['isAuthenticated'](),controller[_0x1685('0x9')]);router[_0x1685('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x1685('0xa'),auth[_0x1685('0xb')](),controller['show']);router[_0x1685('0x8')](_0x1685('0xc'),auth[_0x1685('0xb')](),controller[_0x1685('0xd')]);router[_0x1685('0x8')](_0x1685('0xe'),auth[_0x1685('0xb')](),controller[_0x1685('0xf')]);router[_0x1685('0x8')](_0x1685('0x10'),controller[_0x1685('0x11')]);router['get'](_0x1685('0x12'),controller[_0x1685('0x13')]);router[_0x1685('0x8')](_0x1685('0x14'),controller[_0x1685('0x15')]);router[_0x1685('0x8')](_0x1685('0x16'),controller[_0x1685('0x17')]);router['get'](_0x1685('0x18'),auth[_0x1685('0xb')](),controller['getInteractions']);router[_0x1685('0x8')](_0x1685('0x19'),controller['getSnippet']);router[_0x1685('0x8')](_0x1685('0x1a'),auth[_0x1685('0xb')](),controller[_0x1685('0x1b')]);router[_0x1685('0x8')](_0x1685('0x1c'),auth[_0x1685('0xb')](),controller['getProactiveActions']);router['get']('/:id/fields',controller['getFields']);router[_0x1685('0x8')](_0x1685('0x1d'),auth[_0x1685('0xb')](),controller[_0x1685('0x1e')]);router[_0x1685('0x8')](_0x1685('0x1f'),auth[_0x1685('0xb')](),controller[_0x1685('0x20')]);router[_0x1685('0x21')]('/',auth[_0x1685('0xb')](),controller[_0x1685('0x22')]);router['post'](_0x1685('0xc'),auth[_0x1685('0xb')](),controller[_0x1685('0x23')]);router[_0x1685('0x21')](_0x1685('0xe'),auth[_0x1685('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x1685('0x24')]({'destination':function(_0x138098,_0x44f7ef,_0x3a7152){_0x3a7152(null,path[_0x1685('0x25')](config['root'],_0x1685('0x26')));},'filename':function(_0x2d4d21,_0x517fe5,_0x53949f){_0x53949f(null,util[_0x1685('0x27')](_0x1685('0x28'),Date['now'](),_0x517fe5[_0x1685('0x29')]));}})});router[_0x1685('0x21')](_0x1685('0x10'),upload[_0x1685('0x2a')](_0x1685('0x2b')),controller[_0x1685('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32fe88,_0x2bcefb,_0x3c44ee){_0x3c44ee(null,path[_0x1685('0x25')](config[_0x1685('0x2d')],_0x1685('0x2e')));},'filename':function(_0x431771,_0x47de90,_0x3505bb){_0x3505bb(null,util[_0x1685('0x27')](_0x1685('0x28'),Date[_0x1685('0x2f')](),_0x47de90[_0x1685('0x29')]));}})});router[_0x1685('0x21')]('/:id/avatar',upload[_0x1685('0x2a')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16ab22,_0x4ef169,_0x1d285a){_0x1d285a(null,path[_0x1685('0x25')](config[_0x1685('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x51911e,_0xe0d162,_0x3449d0){_0x3449d0(null,util[_0x1685('0x27')](_0x1685('0x28'),Date[_0x1685('0x2f')](),_0xe0d162[_0x1685('0x29')]));}})});router[_0x1685('0x21')]('/:id/customer_avatar',upload['single']('file'),controller[_0x1685('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x51d805,_0x5f29f3,_0x382405){_0x382405(null,path[_0x1685('0x25')](config[_0x1685('0x2d')],_0x1685('0x2e')));},'filename':function(_0x309dca,_0x4f7536,_0x4b4ddf){_0x4b4ddf(null,util[_0x1685('0x27')]('%s-%s',Date[_0x1685('0x2f')](),_0x4f7536[_0x1685('0x29')]));}})});router[_0x1685('0x21')](_0x1685('0x16'),upload['single'](_0x1685('0x2b')),controller['addSystemAvatar']);router[_0x1685('0x21')](_0x1685('0x31'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x1685('0x24')]({'destination':function(_0x582a5e,_0x37c73b,_0x417fd6){const _0x561967=path[_0x1685('0x25')](config[_0x1685('0x2d')],_0x1685('0x32'),_0x1685('0x33'),_0x1685('0x34'));fs_extra['ensureDir'](_0x561967,function(){_0x417fd6(null,_0x561967);});},'filename':function(_0x226ccb,_0x55181a,_0x4b96d1){const _0x558876=_0x55181a[_0x1685('0x29')][_0x1685('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x26d001=path[_0x1685('0x36')](_0x558876);const _0x1ccb4f=Date['now']()+'-'+_0x558876[_0x1685('0x35')](_0x26d001,'')+_0x26d001;_0x4b96d1(null,_0x1ccb4f);}})});router['post'](_0x1685('0x37'),offlineUploadMulter[_0x1685('0x38')](),controller[_0x1685('0x39')]);router[_0x1685('0x21')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x1685('0x3a')]);router[_0x1685('0x21')](_0x1685('0x1a'),auth[_0x1685('0xb')](),controller[_0x1685('0x3b')]);router[_0x1685('0x21')](_0x1685('0x1c'),auth[_0x1685('0xb')](),controller['addProactiveActions']);router[_0x1685('0x21')]('/:id/users',auth[_0x1685('0xb')](),controller['addAgents']);router[_0x1685('0x3c')]('/:id',auth[_0x1685('0xb')](),controller[_0x1685('0x3d')]);router['delete'](_0x1685('0xa'),auth[_0x1685('0xb')](),controller[_0x1685('0x3e')]);router[_0x1685('0x3f')](_0x1685('0xc'),auth['isAuthenticated'](),controller[_0x1685('0x40')]);router[_0x1685('0x3f')](_0x1685('0xe'),auth[_0x1685('0xb')](),controller[_0x1685('0x41')]);router[_0x1685('0x3f')](_0x1685('0x1f'),auth[_0x1685('0xb')](),controller[_0x1685('0x42')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index a2fa006..c399e04 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 _0xe9bc=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','../config/environment'];(function(_0x5eb4af,_0x5a73fb){var _0x2107cc=function(_0x53ddc1){while(--_0x53ddc1){_0x5eb4af['push'](_0x5eb4af['shift']());}};_0x2107cc(++_0x5a73fb);}(_0xe9bc,0x1c5));var _0xce9b=function(_0x42a571,_0x57321c){_0x42a571=_0x42a571-0x0;var _0x32afaf=_0xe9bc[_0x42a571];return _0x32afaf;};var beaverLogger=require('beaver-logger/server');var express=require(_0xce9b('0x0'));var auth=require(_0xce9b('0x1'));var config=require(_0xce9b('0x2'));var router=express['Router']();var isProduction=config['env']===_0xce9b('0x3')||![];function clientSideLogs(_0x4ae37a,_0x434b8c,_0x2f80df){var _0x191036=_0x4ae37a[_0xce9b('0x4')][_0xce9b('0x5')](_0xce9b('0x6'));if(!_0x191036){throw new Error(_0xce9b('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0xce9b('0x8'),'logger':_0x191036,'enableCors':!isProduction})(_0x4ae37a,_0x434b8c,_0x2f80df);}router[_0xce9b('0x9')](auth[_0xce9b('0xa')](),clientSideLogs);module[_0xce9b('0xb')]=router; \ No newline at end of file +var _0xa59d=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../config/environment','env','production','app','client-side-logger'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xa59d,0xc9));var _0xda59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa59d[_0x2641f9];return _0x585741;};var beaverLogger=require(_0xda59('0x0'));var express=require(_0xda59('0x1'));var auth=require('../components/auth/service');var config=require(_0xda59('0x2'));var router=express['Router']();var isProduction=config[_0xda59('0x3')]===_0xda59('0x4')||![];function clientSideLogs(_0x42f5d0,_0x268d2e,_0x553e84){var _0x1ed26b=_0x42f5d0[_0xda59('0x5')]['get'](_0xda59('0x6'));if(!_0x1ed26b){throw new Error(_0xda59('0x7'));}return beaverLogger[_0xda59('0x8')]({'uri':_0xda59('0x9'),'logger':_0x1ed26b,'enableCors':!isProduction})(_0x42f5d0,_0x268d2e,_0x553e84);}router[_0xda59('0xa')](auth[_0xda59('0xb')](),clientSideLogs);module[_0xda59('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 6080c85..280b66c 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 _0xbdf9=['sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xbdf9,0x126));var _0x9bdf=function(_0xb6b285,_0x596e01){_0xb6b285=_0xb6b285-0x0;var _0x11393c=_0xbdf9[_0xb6b285];return _0x11393c;};'use strict';var Sequelize=require(_0x9bdf('0x0'));module[_0x9bdf('0x1')]={'name':{'type':Sequelize[_0x9bdf('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9bdf('0x3')](_0x9bdf('0x4'),_0x9bdf('0x5'),_0x9bdf('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9bdf('0x3')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x9bdf('0x2')],'comment':_0x9bdf('0x7')},'data2':{'type':Sequelize[_0x9bdf('0x2')],'comment':_0x9bdf('0x8')},'data3':{'type':Sequelize[_0x9bdf('0x2')],'comment':_0x9bdf('0x9')},'data4':{'type':Sequelize[_0x9bdf('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x9bdf('0xa')],'comment':_0x9bdf('0xb')},'data6':{'type':Sequelize[_0x9bdf('0xa')],'comment':_0x9bdf('0xc')},'data7':{'type':Sequelize[_0x9bdf('0xa')],'comment':_0x9bdf('0xd')}}; \ No newline at end of file +var _0xabfc=['sequelize','STRING','ENUM','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x18474f,_0x51e0f9){var _0xab5297=function(_0x4b2327){while(--_0x4b2327){_0x18474f['push'](_0x18474f['shift']());}};_0xab5297(++_0x51e0f9);}(_0xabfc,0x1c7));var _0xcabf=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xabfc[_0x3d4ef1];return _0x409423;};'use strict';var Sequelize=require(_0xcabf('0x0'));module['exports']={'name':{'type':Sequelize[_0xcabf('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xcabf('0x2')]('AmazonAWS',_0xcabf('0x3'),_0xcabf('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xcabf('0x2')]('Outlook365',_0xcabf('0x5'))},'data1':{'type':Sequelize[_0xcabf('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xcabf('0x1')],'comment':_0xcabf('0x6')},'data3':{'type':Sequelize[_0xcabf('0x1')],'comment':_0xcabf('0x7')},'data4':{'type':Sequelize[_0xcabf('0x1')],'comment':_0xcabf('0x8')},'data5':{'type':Sequelize[_0xcabf('0x9')],'comment':_0xcabf('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0xcabf('0xb')},'data7':{'type':Sequelize[_0xcabf('0x9')],'comment':_0xcabf('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index be1d406..9172d6c 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 _0x4502=['join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','oauth2Claims','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','emit','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','update','destroy','then','name','send','slice','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','params','CloudProvider','rawAttributes','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'];(function(_0x3431fb,_0x8bf9e1){var _0x9c6a02=function(_0xf096d0){while(--_0xf096d0){_0x3431fb['push'](_0x3431fb['shift']());}};_0x9c6a02(++_0x8bf9e1);}(_0x4502,0x17d));var _0x2450=function(_0x4f8f80,_0x1eed30){_0x4f8f80=_0x4f8f80-0x0;var _0x5af93f=_0x4502[_0x4f8f80];return _0x5af93f;};'use strict';var _=require('lodash');var Redis=require(_0x2450('0x0'));var qs=require(_0x2450('0x1'));var encryptor=require(_0x2450('0x2'));var config=require(_0x2450('0x3'));var logger=require('../../config/logger')(_0x2450('0x4'));var db=require(_0x2450('0x5'))['db'];var oauth=require(_0x2450('0x6'));config[_0x2450('0x7')]=_['defaults'](config[_0x2450('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x2450('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x2450('0x7')]);function respondWithStatusCode(_0x3103a9,_0x3ab97f){_0x3ab97f=_0x3ab97f||0xcc;return function(_0x4d6d49){if(_0x4d6d49){return _0x3103a9[_0x2450('0x9')](_0x3ab97f);}return _0x3103a9[_0x2450('0xa')](_0x3ab97f)[_0x2450('0xb')]();};}function respondWithResult(_0x46aaba,_0xd3e073){_0xd3e073=_0xd3e073||0xc8;return function(_0x132536){if(_0x132536){return _0x46aaba[_0x2450('0xa')](_0xd3e073)[_0x2450('0xc')](_0x132536);}};}function respondWithFilteredResult(_0x5133dc,_0x35fc3e){return function(_0x515b8d){if(_0x515b8d){var _0x33f189=typeof _0x35fc3e[_0x2450('0xd')]===_0x2450('0xe')&&typeof _0x35fc3e[_0x2450('0xf')]===_0x2450('0xe');var _0x2e163e=_0x515b8d['count'];var _0x386e0c=_0x33f189?0x0:_0x35fc3e[_0x2450('0xd')];var _0x42940d=_0x33f189?_0x515b8d[_0x2450('0x10')]:_0x35fc3e['offset']+_0x35fc3e[_0x2450('0xf')];var _0x5e7ca5;if(_0x42940d>=_0x2e163e){_0x42940d=_0x2e163e;_0x5e7ca5=0xc8;}else{_0x5e7ca5=0xce;}_0x5133dc['status'](_0x5e7ca5);return _0x5133dc['set']('Content-Range',_0x386e0c+'-'+_0x42940d+'/'+_0x2e163e)[_0x2450('0xc')](_0x515b8d);}return null;};}function saveUpdates(_0x4d1b8){return function(_0xdebf9b){if(_0xdebf9b){return _0xdebf9b[_0x2450('0x11')](_0x4d1b8)['then'](function(_0xd4ab18){return _0xd4ab18;});}return null;};}function removeEntity(_0x2cc3ce){return function(_0x4c0ecb){if(_0x4c0ecb){return _0x4c0ecb[_0x2450('0x12')]()[_0x2450('0x13')](function(){_0x2cc3ce[_0x2450('0xa')](0xcc)[_0x2450('0xb')]();});}};}function handleEntityNotFound(_0x37be2d){return function(_0xca1461){if(!_0xca1461){_0x37be2d[_0x2450('0x9')](0x194);}return _0xca1461;};}function handleError(_0x2a2c13,_0x38e7cc){_0x38e7cc=_0x38e7cc||0x1f4;return function(_0x40cec3){logger['error'](_0x40cec3['stack']);if(_0x40cec3[_0x2450('0x14')]){delete _0x40cec3[_0x2450('0x14')];}_0x2a2c13[_0x2450('0xa')](_0x38e7cc)[_0x2450('0x15')](_0x40cec3);};}function maskClientSecret(_0x2ac35c){return _['padEnd'](_0x2ac35c[_0x2450('0x16')](0x0,0x3),0x14,'*');}exports[_0x2450('0x17')]=function(_0x245eb2,_0x254375){var _0x6587a7={},_0x2cca12={},_0x5e0259={'count':0x0,'rows':[]};var _0x5f4906=_[_0x2450('0x18')](db['CloudProvider']['rawAttributes'],function(_0x4d2be6){return{'name':_0x4d2be6[_0x2450('0x19')],'type':_0x4d2be6[_0x2450('0x1a')]['key']};});_0x2cca12[_0x2450('0x1b')]=_[_0x2450('0x18')](_0x5f4906,_0x2450('0x14'));_0x2cca12[_0x2450('0x1c')]=_[_0x2450('0x1d')](_0x245eb2[_0x2450('0x1c')]);_0x2cca12[_0x2450('0x1e')]=_[_0x2450('0x1f')](_0x2cca12[_0x2450('0x1b')],_0x2cca12[_0x2450('0x1c')]);_0x6587a7['attributes']=_[_0x2450('0x1f')](_0x2cca12[_0x2450('0x1b')],qs[_0x2450('0x20')](_0x245eb2[_0x2450('0x1c')][_0x2450('0x20')]));_0x6587a7['attributes']=_0x6587a7[_0x2450('0x21')][_0x2450('0x22')]?_0x6587a7[_0x2450('0x21')]:_0x2cca12[_0x2450('0x1b')];if(!_0x245eb2[_0x2450('0x1c')][_0x2450('0x23')](_0x2450('0x24'))){_0x6587a7['limit']=qs[_0x2450('0xf')](_0x245eb2['query']['limit']);_0x6587a7['offset']=qs[_0x2450('0xd')](_0x245eb2[_0x2450('0x1c')][_0x2450('0xd')]);}_0x6587a7[_0x2450('0x25')]=qs[_0x2450('0x26')](_0x245eb2['query'][_0x2450('0x26')]);_0x6587a7[_0x2450('0x27')]=qs[_0x2450('0x1e')](_[_0x2450('0x28')](_0x245eb2['query'],_0x2cca12[_0x2450('0x1e')]),_0x5f4906);if(_0x245eb2[_0x2450('0x1c')][_0x2450('0x29')]){_0x6587a7[_0x2450('0x27')]=_[_0x2450('0x2a')](_0x6587a7[_0x2450('0x27')],{'$or':_[_0x2450('0x18')](_0x5f4906,function(_0x5046cf){if(_0x5046cf[_0x2450('0x1a')]!==_0x2450('0x2b')){var _0x431169={};_0x431169[_0x5046cf[_0x2450('0x14')]]={'$like':'%'+_0x245eb2[_0x2450('0x1c')][_0x2450('0x29')]+'%'};return _0x431169;}})});}_0x6587a7=_[_0x2450('0x2a')]({},_0x6587a7,_0x245eb2[_0x2450('0x2c')]);var _0x9877fe={'where':_0x6587a7[_0x2450('0x27')]};return db['CloudProvider'][_0x2450('0x10')](_0x9877fe)[_0x2450('0x13')](function(_0x491a11){_0x5e0259[_0x2450('0x10')]=_0x491a11;if(_0x245eb2['query'][_0x2450('0x2d')]){_0x6587a7[_0x2450('0x2e')]=[{'all':!![]}];}return db['CloudProvider'][_0x2450('0x2f')](_0x6587a7);})[_0x2450('0x13')](function(_0x5ed1d7){_0x5e0259[_0x2450('0x30')]=_[_0x2450('0x18')](_0x5ed1d7,function(_0x197f1d){if(_0x197f1d[_0x2450('0x31')]===_0x2450('0x32')){var _0x3de9b6=encryptor[_0x2450('0x33')](_0x197f1d[_0x2450('0x34')]);_0x197f1d[_0x2450('0x34')]=maskClientSecret(_0x3de9b6);}return _0x197f1d;});return _0x5e0259;})['then'](respondWithFilteredResult(_0x254375,_0x6587a7))[_0x2450('0x35')](handleError(_0x254375,null));};exports['show']=function(_0x1d78d2,_0x156c0c){var _0xa1b7bf={'raw':!![],'where':{'id':_0x1d78d2[_0x2450('0x36')]['id']}},_0x35b21b={};_0x35b21b[_0x2450('0x1b')]=_[_0x2450('0x1d')](db[_0x2450('0x37')][_0x2450('0x38')]);_0x35b21b[_0x2450('0x1c')]=_[_0x2450('0x1d')](_0x1d78d2[_0x2450('0x1c')]);_0x35b21b[_0x2450('0x1e')]=_[_0x2450('0x1f')](_0x35b21b[_0x2450('0x1b')],_0x35b21b['query']);_0xa1b7bf['attributes']=_['intersection'](_0x35b21b[_0x2450('0x1b')],qs[_0x2450('0x20')](_0x1d78d2[_0x2450('0x1c')][_0x2450('0x20')]));_0xa1b7bf['attributes']=_0xa1b7bf[_0x2450('0x21')][_0x2450('0x22')]?_0xa1b7bf[_0x2450('0x21')]:_0x35b21b[_0x2450('0x1b')];if(_0x1d78d2[_0x2450('0x1c')][_0x2450('0x2d')]){_0xa1b7bf[_0x2450('0x2e')]=[{'all':!![]}];}_0xa1b7bf=_['merge']({},_0xa1b7bf,_0x1d78d2[_0x2450('0x2c')]);return db[_0x2450('0x37')][_0x2450('0x39')](_0xa1b7bf)[_0x2450('0x13')](handleEntityNotFound(_0x156c0c,null))['then'](function(_0x2fc160){if(_0x2fc160[_0x2450('0x31')]===_0x2450('0x32')){var _0x8a1159=encryptor['decryptString'](_0x2fc160[_0x2450('0x34')]);_0x2fc160[_0x2450('0x34')]=maskClientSecret(_0x8a1159);}return _0x2fc160;})[_0x2450('0x13')](respondWithResult(_0x156c0c,null))[_0x2450('0x35')](handleError(_0x156c0c,null));};exports[_0x2450('0x3a')]=function(_0xaed84c,_0x5d611e){if(!_0xaed84c['body'][_0x2450('0x14')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0xaed84c[_0x2450('0x3b')]['service'])throw new Error(_0x2450('0x3c'));var _0x3f83ca=db[_0x2450('0x37')][_0x2450('0x38')][_0x2450('0x31')][_0x2450('0x3d')];if(!_0x3f83ca[_0x2450('0x3e')](_0xaed84c[_0x2450('0x3b')][_0x2450('0x31')]))throw new Error(_0x2450('0x3f')+_0x3f83ca[_0x2450('0x40')](',\x20'));if(_0xaed84c['body'][_0x2450('0x31')]===_0x2450('0x32')&&_0xaed84c['body'][_0x2450('0x34')]){_0xaed84c[_0x2450('0x3b')][_0x2450('0x34')]=encryptor[_0x2450('0x41')](_0xaed84c[_0x2450('0x3b')][_0x2450('0x34')]);}return db[_0x2450('0x37')][_0x2450('0x3a')](_0xaed84c[_0x2450('0x3b')],{})[_0x2450('0x13')](respondWithResult(_0x5d611e,0xc9))[_0x2450('0x35')](handleError(_0x5d611e,null));};exports[_0x2450('0x11')]=function(_0x563d7f,_0x29f0f9){if(_0x563d7f[_0x2450('0x3b')]['id']){delete _0x563d7f[_0x2450('0x3b')]['id'];}return db[_0x2450('0x37')][_0x2450('0x39')]({'where':{'id':_0x563d7f[_0x2450('0x36')]['id']}})['then'](handleEntityNotFound(_0x29f0f9,null))['then'](function(_0x10a943){if(_0x10a943[_0x2450('0x31')]===_0x2450('0x32')&&_0x563d7f[_0x2450('0x3b')][_0x2450('0x34')]){_0x563d7f[_0x2450('0x3b')][_0x2450('0x34')]=encryptor[_0x2450('0x41')](_0x563d7f[_0x2450('0x3b')][_0x2450('0x34')]);}return _0x10a943;})[_0x2450('0x13')](saveUpdates(_0x563d7f[_0x2450('0x3b')],null))[_0x2450('0x13')](respondWithResult(_0x29f0f9,null))[_0x2450('0x35')](handleError(_0x29f0f9,null));};exports[_0x2450('0x12')]=function(_0x585ca9,_0x30be46){return db['CloudProvider'][_0x2450('0x39')]({'where':{'id':_0x585ca9[_0x2450('0x36')]['id']}})[_0x2450('0x13')](handleEntityNotFound(_0x30be46,null))[_0x2450('0x13')](removeEntity(_0x30be46,null))[_0x2450('0x35')](handleError(_0x30be46,null));};exports[_0x2450('0x42')]=function(_0x57dad8,_0x16c7fc){return db['CloudProvider']['findOne']({'where':{'id':_0x57dad8[_0x2450('0x36')]['id']},'raw':!![]})['then'](function(_0x54d847){if(!_0x54d847)return _0x16c7fc[_0x2450('0x9')](0x194);return{'url':oauth[_0x2450('0x43')](_0x54d847,_0x57dad8['user']['id'])};})['then'](respondWithResult(_0x16c7fc,null))[_0x2450('0x35')](handleError(_0x16c7fc,null));};exports[_0x2450('0x44')]=function(_0x46d388,_0x282d30){var _0x2bce5f=_0x46d388[_0x2450('0x3b')];var _0x24a0f0;var _0x5a6aa7;if(_0x2bce5f[_0x2450('0x45')])throw _0x2bce5f;redis[_0x2450('0x46')](_0x2bce5f[_0x2450('0x47')])[_0x2450('0x13')](function(_0x1524cc){if(!_0x1524cc)throw new Error(_0x2450('0x48'));_0x24a0f0=JSON[_0x2450('0x49')](_0x1524cc);var _0x488036=Buffer[_0x2450('0x4a')](_0x2bce5f[_0x2450('0x47')],_0x2450('0x4b'))['toString'](_0x2450('0x4c'));_0x5a6aa7=JSON[_0x2450('0x49')](_0x488036);if(!oauth[_0x2450('0x4d')](_0x2bce5f['id_token'],_0x24a0f0[_0x2450('0x4e')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x2bce5f[_0x2450('0x47')]);return oauth[_0x2450('0x4f')](_0x2bce5f[_0x2450('0x50')],_0x24a0f0);})[_0x2450('0x13')](function(_0x126b62){_0x24a0f0[_0x2450('0x51')]=_0x126b62[_0x2450('0x52')];_0x24a0f0['data6']=_0x126b62[_0x2450('0x53')];return db['CloudProvider'][_0x2450('0x11')]({'data5':_0x24a0f0[_0x2450('0x51')],'data6':_0x24a0f0[_0x2450('0x54')]},{'where':{'id':_0x24a0f0['id']}});})[_0x2450('0x13')](function(){oauth['startRefreshInterval'](_0x24a0f0);socket[_0x2450('0x55')]('microsoftAuthorization:success',{'id':_0x5a6aa7['id']});return;})['then'](respondWithStatusCode(_0x282d30,null))[_0x2450('0x35')](function(_0x1fa8af){if(_0x5a6aa7){socket[_0x2450('0x55')]('microsoftAuthorization:error',{'id':_0x5a6aa7['id']});}if(!_0x24a0f0){logger[_0x2450('0x45')]('Invalid\x20authentication\x20state\x20parameter',_0x1fa8af);return _0x282d30[_0x2450('0xa')](0x1f4)[_0x2450('0x15')](_0x1fa8af[_0x2450('0x56')]);}logger[_0x2450('0x45')](_0x2450('0x57'),_0x24a0f0['id'],JSON[_0x2450('0x58')](_0x1fa8af));});}; \ No newline at end of file +var _0xc641=['oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','send','message','stringify','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','options','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','params','fields','includeAll','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xc641,0x72));var _0x1c64=function(_0x430f93,_0xfea284){_0x430f93=_0x430f93-0x0;var _0x24cd20=_0xc641[_0x430f93];return _0x24cd20;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x1c64('0x0'));var encryptor=require(_0x1c64('0x1'));var config=require(_0x1c64('0x2'));var logger=require('../../config/logger')(_0x1c64('0x3'));var db=require(_0x1c64('0x4'))['db'];var oauth=require(_0x1c64('0x5'));config[_0x1c64('0x6')]=_['defaults'](config[_0x1c64('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c64('0x7'))(new Redis(config[_0x1c64('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x51fcda,_0x417a18){_0x417a18=_0x417a18||0xcc;return function(_0x4768c4){if(_0x4768c4){return _0x51fcda[_0x1c64('0x8')](_0x417a18);}return _0x51fcda[_0x1c64('0x9')](_0x417a18)[_0x1c64('0xa')]();};}function respondWithResult(_0x1b7f42,_0x3c4acb){_0x3c4acb=_0x3c4acb||0xc8;return function(_0x2bfc0a){if(_0x2bfc0a){return _0x1b7f42[_0x1c64('0x9')](_0x3c4acb)[_0x1c64('0xb')](_0x2bfc0a);}};}function respondWithFilteredResult(_0x33bb0c,_0x23e445){return function(_0x1a71cf){if(_0x1a71cf){var _0x3ccc46=typeof _0x23e445['offset']===_0x1c64('0xc')&&typeof _0x23e445[_0x1c64('0xd')]===_0x1c64('0xc');var _0x48d3d4=_0x1a71cf[_0x1c64('0xe')];var _0x3d5e7d=_0x3ccc46?0x0:_0x23e445['offset'];var _0x27478e=_0x3ccc46?_0x1a71cf[_0x1c64('0xe')]:_0x23e445['offset']+_0x23e445['limit'];var _0xbe2f47;if(_0x27478e>=_0x48d3d4){_0x27478e=_0x48d3d4;_0xbe2f47=0xc8;}else{_0xbe2f47=0xce;}_0x33bb0c['status'](_0xbe2f47);return _0x33bb0c[_0x1c64('0xf')](_0x1c64('0x10'),_0x3d5e7d+'-'+_0x27478e+'/'+_0x48d3d4)['json'](_0x1a71cf);}return null;};}function saveUpdates(_0x4e2415){return function(_0x32fb39){if(_0x32fb39){return _0x32fb39[_0x1c64('0x11')](_0x4e2415)[_0x1c64('0x12')](function(_0x8a9b53){return _0x8a9b53;});}return null;};}function removeEntity(_0x26dc11){return function(_0x5e5255){if(_0x5e5255){return _0x5e5255[_0x1c64('0x13')]()[_0x1c64('0x12')](function(){_0x26dc11['status'](0xcc)[_0x1c64('0xa')]();});}};}function handleEntityNotFound(_0x4b0723){return function(_0x2b2a4){if(!_0x2b2a4){_0x4b0723[_0x1c64('0x8')](0x194);}return _0x2b2a4;};}function handleError(_0x3afb15,_0x5067dc){_0x5067dc=_0x5067dc||0x1f4;return function(_0x3f0b7c){logger[_0x1c64('0x14')](_0x3f0b7c['stack']);if(_0x3f0b7c[_0x1c64('0x15')]){delete _0x3f0b7c[_0x1c64('0x15')];}_0x3afb15[_0x1c64('0x9')](_0x5067dc)['send'](_0x3f0b7c);};}function maskClientSecret(_0x175d0b){return _['padEnd'](_0x175d0b[_0x1c64('0x16')](0x0,0x3),0x14,'*');}exports[_0x1c64('0x17')]=function(_0x270296,_0x4d4b04){var _0x54b4dc={},_0x1ce87c={},_0xd4ae7f={'count':0x0,'rows':[]};var _0x4fdd5f=_[_0x1c64('0x18')](db[_0x1c64('0x19')][_0x1c64('0x1a')],function(_0x65a74d){return{'name':_0x65a74d[_0x1c64('0x1b')],'type':_0x65a74d[_0x1c64('0x1c')][_0x1c64('0x1d')]};});_0x1ce87c[_0x1c64('0x1e')]=_[_0x1c64('0x18')](_0x4fdd5f,_0x1c64('0x15'));_0x1ce87c['query']=_[_0x1c64('0x1f')](_0x270296[_0x1c64('0x20')]);_0x1ce87c['filters']=_[_0x1c64('0x21')](_0x1ce87c[_0x1c64('0x1e')],_0x1ce87c[_0x1c64('0x20')]);_0x54b4dc[_0x1c64('0x22')]=_[_0x1c64('0x21')](_0x1ce87c[_0x1c64('0x1e')],qs['fields'](_0x270296[_0x1c64('0x20')]['fields']));_0x54b4dc[_0x1c64('0x22')]=_0x54b4dc[_0x1c64('0x22')][_0x1c64('0x23')]?_0x54b4dc[_0x1c64('0x22')]:_0x1ce87c[_0x1c64('0x1e')];if(!_0x270296['query'][_0x1c64('0x24')](_0x1c64('0x25'))){_0x54b4dc['limit']=qs[_0x1c64('0xd')](_0x270296[_0x1c64('0x20')][_0x1c64('0xd')]);_0x54b4dc[_0x1c64('0x26')]=qs['offset'](_0x270296['query'][_0x1c64('0x26')]);}_0x54b4dc['order']=qs[_0x1c64('0x27')](_0x270296[_0x1c64('0x20')]['sort']);_0x54b4dc[_0x1c64('0x28')]=qs[_0x1c64('0x29')](_[_0x1c64('0x2a')](_0x270296[_0x1c64('0x20')],_0x1ce87c[_0x1c64('0x29')]),_0x4fdd5f);if(_0x270296['query'][_0x1c64('0x2b')]){_0x54b4dc[_0x1c64('0x28')]=_['merge'](_0x54b4dc[_0x1c64('0x28')],{'$or':_[_0x1c64('0x18')](_0x4fdd5f,function(_0x342fa0){if(_0x342fa0[_0x1c64('0x1c')]!=='VIRTUAL'){var _0x1e2284={};_0x1e2284[_0x342fa0['name']]={'$like':'%'+_0x270296[_0x1c64('0x20')][_0x1c64('0x2b')]+'%'};return _0x1e2284;}})});}_0x54b4dc=_[_0x1c64('0x2c')]({},_0x54b4dc,_0x270296[_0x1c64('0x2d')]);var _0x4513e8={'where':_0x54b4dc['where']};return db['CloudProvider'][_0x1c64('0xe')](_0x4513e8)['then'](function(_0x519192){_0xd4ae7f[_0x1c64('0xe')]=_0x519192;if(_0x270296[_0x1c64('0x20')]['includeAll']){_0x54b4dc[_0x1c64('0x2e')]=[{'all':!![]}];}return db[_0x1c64('0x19')][_0x1c64('0x2f')](_0x54b4dc);})[_0x1c64('0x12')](function(_0x35a816){_0xd4ae7f['rows']=_[_0x1c64('0x18')](_0x35a816,function(_0x443a80){if(_0x443a80[_0x1c64('0x30')]===_0x1c64('0x31')){var _0x50258c=encryptor[_0x1c64('0x32')](_0x443a80[_0x1c64('0x33')]);_0x443a80[_0x1c64('0x33')]=maskClientSecret(_0x50258c);}return _0x443a80;});return _0xd4ae7f;})[_0x1c64('0x12')](respondWithFilteredResult(_0x4d4b04,_0x54b4dc))[_0x1c64('0x34')](handleError(_0x4d4b04,null));};exports['show']=function(_0x11496f,_0x2e9648){var _0x35b34b={'raw':!![],'where':{'id':_0x11496f[_0x1c64('0x35')]['id']}},_0x3a5c88={};_0x3a5c88[_0x1c64('0x1e')]=_[_0x1c64('0x1f')](db['CloudProvider'][_0x1c64('0x1a')]);_0x3a5c88[_0x1c64('0x20')]=_[_0x1c64('0x1f')](_0x11496f[_0x1c64('0x20')]);_0x3a5c88[_0x1c64('0x29')]=_[_0x1c64('0x21')](_0x3a5c88[_0x1c64('0x1e')],_0x3a5c88['query']);_0x35b34b[_0x1c64('0x22')]=_[_0x1c64('0x21')](_0x3a5c88[_0x1c64('0x1e')],qs[_0x1c64('0x36')](_0x11496f[_0x1c64('0x20')][_0x1c64('0x36')]));_0x35b34b[_0x1c64('0x22')]=_0x35b34b[_0x1c64('0x22')][_0x1c64('0x23')]?_0x35b34b[_0x1c64('0x22')]:_0x3a5c88[_0x1c64('0x1e')];if(_0x11496f[_0x1c64('0x20')][_0x1c64('0x37')]){_0x35b34b[_0x1c64('0x2e')]=[{'all':!![]}];}_0x35b34b=_['merge']({},_0x35b34b,_0x11496f[_0x1c64('0x2d')]);return db[_0x1c64('0x19')][_0x1c64('0x38')](_0x35b34b)['then'](handleEntityNotFound(_0x2e9648,null))['then'](function(_0x3cda64){if(_0x3cda64[_0x1c64('0x30')]===_0x1c64('0x31')){var _0xa1f259=encryptor[_0x1c64('0x32')](_0x3cda64['data3']);_0x3cda64[_0x1c64('0x33')]=maskClientSecret(_0xa1f259);}return _0x3cda64;})[_0x1c64('0x12')](respondWithResult(_0x2e9648,null))[_0x1c64('0x34')](handleError(_0x2e9648,null));};exports[_0x1c64('0x39')]=function(_0x3825f4,_0x8ee76d){if(!_0x3825f4[_0x1c64('0x3a')][_0x1c64('0x15')])throw new Error(_0x1c64('0x3b'));if(!_0x3825f4[_0x1c64('0x3a')][_0x1c64('0x30')])throw new Error(_0x1c64('0x3c'));var _0x2e0707=db['CloudProvider'][_0x1c64('0x1a')][_0x1c64('0x30')][_0x1c64('0x3d')];if(!_0x2e0707[_0x1c64('0x3e')](_0x3825f4['body'][_0x1c64('0x30')]))throw new Error(_0x1c64('0x3f')+_0x2e0707[_0x1c64('0x40')](',\x20'));if(_0x3825f4['body'][_0x1c64('0x30')]==='MicrosoftAzure'&&_0x3825f4[_0x1c64('0x3a')][_0x1c64('0x33')]){_0x3825f4['body'][_0x1c64('0x33')]=encryptor[_0x1c64('0x41')](_0x3825f4[_0x1c64('0x3a')][_0x1c64('0x33')]);}return db[_0x1c64('0x19')][_0x1c64('0x39')](_0x3825f4[_0x1c64('0x3a')],{})[_0x1c64('0x12')](respondWithResult(_0x8ee76d,0xc9))['catch'](handleError(_0x8ee76d,null));};exports[_0x1c64('0x11')]=function(_0x5c6ea5,_0x69e6bd){if(_0x5c6ea5[_0x1c64('0x3a')]['id']){delete _0x5c6ea5[_0x1c64('0x3a')]['id'];}return db[_0x1c64('0x19')][_0x1c64('0x38')]({'where':{'id':_0x5c6ea5[_0x1c64('0x35')]['id']}})[_0x1c64('0x12')](handleEntityNotFound(_0x69e6bd,null))[_0x1c64('0x12')](function(_0x19cb70){if(_0x19cb70['service']===_0x1c64('0x31')&&_0x5c6ea5['body'][_0x1c64('0x33')]){_0x5c6ea5['body']['data3']=encryptor['encryptString'](_0x5c6ea5[_0x1c64('0x3a')]['data3']);}return _0x19cb70;})[_0x1c64('0x12')](saveUpdates(_0x5c6ea5[_0x1c64('0x3a')],null))[_0x1c64('0x12')](respondWithResult(_0x69e6bd,null))[_0x1c64('0x34')](handleError(_0x69e6bd,null));};exports[_0x1c64('0x13')]=function(_0x59ef2f,_0x29f328){return db['CloudProvider']['find']({'where':{'id':_0x59ef2f[_0x1c64('0x35')]['id']}})[_0x1c64('0x12')](handleEntityNotFound(_0x29f328,null))[_0x1c64('0x12')](removeEntity(_0x29f328,null))[_0x1c64('0x34')](handleError(_0x29f328,null));};exports[_0x1c64('0x42')]=function(_0x4fa413,_0x2cc821){return db['CloudProvider'][_0x1c64('0x43')]({'where':{'id':_0x4fa413[_0x1c64('0x35')]['id']},'raw':!![]})['then'](function(_0x3e464e){if(!_0x3e464e)return _0x2cc821[_0x1c64('0x8')](0x194);return{'url':oauth[_0x1c64('0x44')](_0x3e464e,_0x4fa413[_0x1c64('0x45')]['id'])};})['then'](respondWithResult(_0x2cc821,null))[_0x1c64('0x34')](handleError(_0x2cc821,null));};exports[_0x1c64('0x46')]=function(_0x36b9af,_0x2b6c0a){var _0x14cd3e=_0x36b9af[_0x1c64('0x3a')];var _0x3c374a;var _0x513490;if(_0x14cd3e[_0x1c64('0x14')])throw _0x14cd3e;redis[_0x1c64('0x47')](_0x14cd3e[_0x1c64('0x48')])[_0x1c64('0x12')](function(_0x56214e){if(!_0x56214e)throw new Error(_0x1c64('0x49'));_0x3c374a=JSON[_0x1c64('0x4a')](_0x56214e);var _0x1015f6=Buffer[_0x1c64('0x4b')](_0x14cd3e[_0x1c64('0x48')],_0x1c64('0x4c'))[_0x1c64('0x4d')](_0x1c64('0x4e'));_0x513490=JSON[_0x1c64('0x4a')](_0x1015f6);if(!oauth['isValidIdToken'](_0x14cd3e[_0x1c64('0x4f')],_0x3c374a['oauth2Claims']))throw new Error(_0x1c64('0x50'));redis[_0x1c64('0x51')](_0x14cd3e[_0x1c64('0x48')]);return oauth[_0x1c64('0x52')](_0x14cd3e['code'],_0x3c374a);})['then'](function(_0x1950ec){_0x3c374a[_0x1c64('0x53')]=_0x1950ec['access_token'];_0x3c374a[_0x1c64('0x54')]=_0x1950ec[_0x1c64('0x55')];return db['CloudProvider'][_0x1c64('0x11')]({'data5':_0x3c374a['data5'],'data6':_0x3c374a[_0x1c64('0x54')]},{'where':{'id':_0x3c374a['id']}});})[_0x1c64('0x12')](function(){oauth['startRefreshInterval'](_0x3c374a);socket[_0x1c64('0x56')](_0x1c64('0x57'),{'id':_0x513490['id']});return;})[_0x1c64('0x12')](respondWithStatusCode(_0x2b6c0a,null))[_0x1c64('0x34')](function(_0x330d65){if(_0x513490){socket[_0x1c64('0x56')](_0x1c64('0x58'),{'id':_0x513490['id']});}if(!_0x3c374a){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x330d65);return _0x2b6c0a[_0x1c64('0x9')](0x1f4)[_0x1c64('0x59')](_0x330d65[_0x1c64('0x5a')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x3c374a['id'],JSON[_0x1c64('0x5b')](_0x330d65));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 75db286..040d0f6 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 _0x9dbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers'];(function(_0x4ca06e,_0xad0e25){var _0xee3ea2=function(_0x1503d5){while(--_0x1503d5){_0x4ca06e['push'](_0x4ca06e['shift']());}};_0xee3ea2(++_0xad0e25);}(_0x9dbd,0x177));var _0xd9db=function(_0x26a3ad,_0x12b751){_0x26a3ad=_0x26a3ad-0x0;var _0x51e755=_0x9dbd[_0x26a3ad];return _0x51e755;};'use strict';var _=require(_0xd9db('0x0'));var util=require(_0xd9db('0x1'));var logger=require(_0xd9db('0x2'))(_0xd9db('0x3'));var moment=require(_0xd9db('0x4'));var BPromise=require(_0xd9db('0x5'));var rp=require(_0xd9db('0x6'));var fs=require('fs');var path=require(_0xd9db('0x7'));var rimraf=require(_0xd9db('0x8'));var config=require(_0xd9db('0x9'));var attributes=require(_0xd9db('0xa'));module[_0xd9db('0xb')]=function(_0x292a07,_0x3b7a40){return _0x292a07[_0xd9db('0xc')](_0xd9db('0xd'),attributes,{'tableName':_0xd9db('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7821=['./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x16f3e9,_0x42c9a1){var _0x571fec=function(_0x4f9ba4){while(--_0x4f9ba4){_0x16f3e9['push'](_0x16f3e9['shift']());}};_0x571fec(++_0x42c9a1);}(_0x7821,0x125));var _0x1782=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x7821[_0x343090];return _0x3ff3e8;};'use strict';var _=require('lodash');var util=require(_0x1782('0x0'));var logger=require(_0x1782('0x1'))('api');var moment=require(_0x1782('0x2'));var BPromise=require(_0x1782('0x3'));var rp=require(_0x1782('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1782('0x5'));var config=require(_0x1782('0x6'));var attributes=require(_0x1782('0x7'));module[_0x1782('0x8')]=function(_0x4e7a08,_0x502b5e){return _0x4e7a08[_0x1782('0x9')](_0x1782('0xa'),attributes,{'tableName':_0x1782('0xb'),'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 c8721f9..0d60be3 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 _0x488b=['id_token','from','base64','toString','client_id','data1','response_type','redirect_uri','data4','prompt','login','key','value','oauth2Claims','oauth2/','set','stringify','decode','aud','audience','nonce','isAfter','exp','resolve','then','CloudProvider','findOne','data6','decryptString','data3','POST','data2','access_token','refresh_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','offline_access','/authorize','/token','map','type','Dynamics365','data7','join','Outlook365','/.default','replace','{TENANT_ID}','code'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x488b,0x197));var _0xb488=function(_0x4aea1b,_0x10caff){_0x4aea1b=_0x4aea1b-0x0;var _0x5f59d2=_0x488b[_0x4aea1b];return _0x5f59d2;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0xb488('0x0'));var Redis=require(_0xb488('0x1'));var rp=require(_0xb488('0x2'));var util=require(_0xb488('0x3'));var encryptor=require(_0xb488('0x4'));var config=require(_0xb488('0x5'));var logger=require(_0xb488('0x6'))(_0xb488('0x7'));var schedule=require(_0xb488('0x8'));var db=require(_0xb488('0x9'))['db'];config[_0xb488('0xa')]=_[_0xb488('0xb')](config[_0xb488('0xa')],{'host':_0xb488('0xc'),'port':0x18eb});var redis=new Redis(config[_0xb488('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xb488('0xd'),_0xb488('0xe'),_0xb488('0xf'),'offline_access',_0xb488('0x10'),_0xb488('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xb488('0xd'),_0xb488('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0xb488('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xb488('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x589c50){var _0x1141ee=_[_0xb488('0x15')](AZURE_AUTH_SCOPES[_0x589c50[_0xb488('0x16')]]);if(_0x589c50[_0xb488('0x16')]===_0xb488('0x17'))_0x1141ee['push'](_0x589c50[_0xb488('0x18')]+'/.default');return _0x1141ee[_0xb488('0x19')]('\x20');}function getAccessTokenScope(_0x419415){if(_0x419415['type']===_0xb488('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x419415[_0xb488('0x16')]===_0xb488('0x17'))return _0x419415[_0xb488('0x18')]+_0xb488('0x1b');}function generateMicrosoftAuthorizationUrl(_0x3ad39e,_0xe8db41){var _0x147ee2=MICROSOFT_AUTH_URL[_0xb488('0x1c')](_0xb488('0x1d'),_0x3ad39e['data2']);var _0x582fce=[_0xb488('0x1e'),_0xb488('0x1f')];var _0x4453f1=Buffer[_0xb488('0x20')](JSON['stringify']({'id':_0xe8db41}))['toString'](_0xb488('0x21'));var _0x3c396b=crypto['randomBytes'](0x10)[_0xb488('0x22')]('hex');var _0x146cd5=getAuthorizationScopes(_0x3ad39e);var _0x5a3eff=[{'key':_0xb488('0x23'),'value':_0x3ad39e[_0xb488('0x24')]},{'key':_0xb488('0x25'),'value':encodeURIComponent(_0x582fce[_0xb488('0x19')]('\x20'))},{'key':_0xb488('0x26'),'value':_0x3ad39e[_0xb488('0x27')]},{'key':'response_mode','value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x146cd5)},{'key':'state','value':_0x4453f1},{'key':'nonce','value':_0x3c396b},{'key':_0xb488('0x28'),'value':_0xb488('0x29')}];var _0x106c8c=_0x147ee2+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb488('0x15')](_0x5a3eff,function(_0x5afe3e){return _0x5afe3e[_0xb488('0x2a')]+'='+_0x5afe3e[_0xb488('0x2b')];})[_0xb488('0x19')]('&');_0x3ad39e[_0xb488('0x2c')]={'issuer':_0x147ee2[_0xb488('0x1c')](_0xb488('0x2d'),''),'audience':_0x3ad39e[_0xb488('0x24')],'state':_0x4453f1,'nonce':_0x3c396b};redis[_0xb488('0x2e')](_0x4453f1,JSON[_0xb488('0x2f')](_0x3ad39e));return _0x106c8c;}function isValidIdToken(_0x17a18e,_0x3d496a){try{var _0x5cd6bf=jwt[_0xb488('0x30')](_0x17a18e,{'complete':!![]});var _0x39a248=_0x5cd6bf['payload'];if(_0x39a248['iss']!==_0x3d496a['issuer'])return![];if(_0x39a248[_0xb488('0x31')]!==_0x3d496a[_0xb488('0x32')])return![];if(_0x39a248[_0xb488('0x33')]!==_0x3d496a[_0xb488('0x33')])return![];if(moment()[_0xb488('0x34')](moment['unix'](_0x39a248[_0xb488('0x35')])))return![];return!![];}catch(_0x428477){throw _0x428477;}}function refreshOauth2MicrosoftAccessToken(_0x5e8a3e){return Promise[_0xb488('0x36')]()[_0xb488('0x37')](function(){if(_0x5e8a3e['data3'])return _0x5e8a3e;return db[_0xb488('0x38')][_0xb488('0x39')]({'where':{'id':_0x5e8a3e['id']},'raw':!![]});})[_0xb488('0x37')](function(_0x381dc9){var _0x5b339e={'grant_type':'refresh_token','refresh_token':_0x381dc9[_0xb488('0x3a')],'scope':getAccessTokenScope(_0x381dc9),'redirect_uri':_0x381dc9[_0xb488('0x27')],'client_id':_0x381dc9['data1'],'client_secret':encryptor[_0xb488('0x3b')](_0x381dc9[_0xb488('0x3c')])};var _0x6f2efa={'method':_0xb488('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xb488('0x1c')](_0xb488('0x1d'),_0x381dc9[_0xb488('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5b339e,'json':!![]};return rp(_0x6f2efa);})['then'](function(_0x1d1f64){_0x5e8a3e['data5']=_0x1d1f64[_0xb488('0x3f')];_0x5e8a3e['data6']=_0x1d1f64[_0xb488('0x40')];return db[_0xb488('0x38')]['update']({'data5':_0x5e8a3e['data5'],'data6':_0x5e8a3e['data6']},{'where':{'id':_0x5e8a3e['id']}});})[_0xb488('0x37')](function(){return _0x5e8a3e;})[_0xb488('0x41')](function(_0x1a2aa5){logger[_0xb488('0x42')](_0xb488('0x43'),_0x5e8a3e['id'],_0x1a2aa5);});}function getOauth2MicrosoftAccessToken(_0x51ae04,_0x4d6637){var _0x144356={'grant_type':_0xb488('0x44'),'code':_0x51ae04,'scope':getAccessTokenScope(_0x4d6637),'redirect_uri':_0x4d6637[_0xb488('0x27')],'client_id':_0x4d6637[_0xb488('0x24')],'client_secret':encryptor[_0xb488('0x3b')](_0x4d6637[_0xb488('0x3c')])};var _0x1becd4={'method':_0xb488('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xb488('0x1c')](_0xb488('0x1d'),_0x4d6637['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x144356,'json':!![]};return rp(_0x1becd4);}function startRefreshInterval(_0x38c252){var _0x149f9d=schedule['intervals'];if(_0x149f9d[_0x38c252['id']])clearInterval(_0x149f9d[_0x38c252['id']]);_0x149f9d[_0x38c252['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x38c252['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb488('0x45')]=_0x149f9d;}function startAllRefreshIntervals(){return db[_0xb488('0x38')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x523dc9){var _0x1e3e67=_0x523dc9[_0xb488('0x15')](function(_0x3d1084){return refreshOauth2MicrosoftAccessToken(_0x3d1084)['then'](function(_0x235af8){startRefreshInterval(_0x235af8);});});return Promise[_0xb488('0x46')](_0x1e3e67);})['catch'](function(_0x2af58f){var _0x436633=_0x2af58f?util['inspect'](_0x2af58f,{'showHidden':![],'depth':null}):'';logger['error'](_0xb488('0x47'),_0x436633);});}module[_0xb488('0x48')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x953a=['offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','toString','base64','randomBytes','hex','client_id','data1','scope','state','nonce','prompt','key','value','oauth2/','set','decode','payload','iss','issuer','aud','audience','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data4','intervals','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x953a,0x85));var _0xa953=function(_0x5a988e,_0x2072fd){_0x5a988e=_0x5a988e-0x0;var _0x124c21=_0x953a[_0x5a988e];return _0x124c21;};'use strict';var _=require(_0xa953('0x0'));var crypto=require('crypto');var jwt=require(_0xa953('0x1'));var moment=require(_0xa953('0x2'));var Redis=require(_0xa953('0x3'));var rp=require(_0xa953('0x4'));var util=require(_0xa953('0x5'));var encryptor=require(_0xa953('0x6'));var config=require(_0xa953('0x7'));var logger=require(_0xa953('0x8'))(_0xa953('0x9'));var schedule=require(_0xa953('0xa'));var db=require(_0xa953('0xb'))['db'];config[_0xa953('0xc')]=_[_0xa953('0xd')](config[_0xa953('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xa953('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa953('0xf'),_0xa953('0x10'),'email',_0xa953('0x11'),_0xa953('0x12'),_0xa953('0x13'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xa953('0xf'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xa953('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3ff5ac){var _0x332577=_[_0xa953('0x15')](AZURE_AUTH_SCOPES[_0x3ff5ac[_0xa953('0x16')]]);if(_0x3ff5ac[_0xa953('0x16')]===_0xa953('0x17'))_0x332577[_0xa953('0x18')](_0x3ff5ac[_0xa953('0x19')]+_0xa953('0x1a'));return _0x332577[_0xa953('0x1b')]('\x20');}function getAccessTokenScope(_0x15549c){if(_0x15549c[_0xa953('0x16')]===_0xa953('0x1c'))return _0xa953('0x12');if(_0x15549c[_0xa953('0x16')]==='Dynamics365')return _0x15549c['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x5e8ef9,_0x215b7c){var _0x215d44=MICROSOFT_AUTH_URL[_0xa953('0x1d')](_0xa953('0x1e'),_0x5e8ef9[_0xa953('0x1f')]);var _0x9a448c=[_0xa953('0x20'),'id_token'];var _0x3ddf48=Buffer[_0xa953('0x21')](JSON['stringify']({'id':_0x215b7c}))[_0xa953('0x22')](_0xa953('0x23'));var _0x4d138d=crypto[_0xa953('0x24')](0x10)[_0xa953('0x22')](_0xa953('0x25'));var _0x3f8688=getAuthorizationScopes(_0x5e8ef9);var _0x2512e4=[{'key':_0xa953('0x26'),'value':_0x5e8ef9[_0xa953('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x9a448c[_0xa953('0x1b')]('\x20'))},{'key':'redirect_uri','value':_0x5e8ef9['data4']},{'key':'response_mode','value':'form_post'},{'key':_0xa953('0x28'),'value':encodeURIComponent(_0x3f8688)},{'key':_0xa953('0x29'),'value':_0x3ddf48},{'key':_0xa953('0x2a'),'value':_0x4d138d},{'key':_0xa953('0x2b'),'value':'login'}];var _0x3049a9=_0x215d44+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa953('0x15')](_0x2512e4,function(_0x5902fb){return _0x5902fb[_0xa953('0x2c')]+'='+_0x5902fb[_0xa953('0x2d')];})[_0xa953('0x1b')]('&');_0x5e8ef9['oauth2Claims']={'issuer':_0x215d44[_0xa953('0x1d')](_0xa953('0x2e'),''),'audience':_0x5e8ef9[_0xa953('0x27')],'state':_0x3ddf48,'nonce':_0x4d138d};redis[_0xa953('0x2f')](_0x3ddf48,JSON['stringify'](_0x5e8ef9));return _0x3049a9;}function isValidIdToken(_0x370581,_0x573c3c){try{var _0x29c82a=jwt[_0xa953('0x30')](_0x370581,{'complete':!![]});var _0x1c8b93=_0x29c82a[_0xa953('0x31')];if(_0x1c8b93[_0xa953('0x32')]!==_0x573c3c[_0xa953('0x33')])return![];if(_0x1c8b93[_0xa953('0x34')]!==_0x573c3c[_0xa953('0x35')])return![];if(_0x1c8b93[_0xa953('0x2a')]!==_0x573c3c['nonce'])return![];if(moment()['isAfter'](moment['unix'](_0x1c8b93['exp'])))return![];return!![];}catch(_0x4be21b){throw _0x4be21b;}}function refreshOauth2MicrosoftAccessToken(_0x43266f){return Promise[_0xa953('0x36')]()[_0xa953('0x37')](function(){if(_0x43266f[_0xa953('0x38')])return _0x43266f;return db[_0xa953('0x39')][_0xa953('0x3a')]({'where':{'id':_0x43266f['id']},'raw':!![]});})[_0xa953('0x37')](function(_0x5ea51f){var _0x350379={'grant_type':_0xa953('0x3b'),'refresh_token':_0x5ea51f[_0xa953('0x3c')],'scope':getAccessTokenScope(_0x5ea51f),'redirect_uri':_0x5ea51f['data4'],'client_id':_0x5ea51f[_0xa953('0x27')],'client_secret':encryptor[_0xa953('0x3d')](_0x5ea51f['data3'])};var _0x5ad97d={'method':_0xa953('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0xa953('0x1e'),_0x5ea51f[_0xa953('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x350379,'json':!![]};return rp(_0x5ad97d);})[_0xa953('0x37')](function(_0x155aa9){_0x43266f[_0xa953('0x3f')]=_0x155aa9[_0xa953('0x40')];_0x43266f[_0xa953('0x3c')]=_0x155aa9[_0xa953('0x3b')];return db[_0xa953('0x39')][_0xa953('0x41')]({'data5':_0x43266f[_0xa953('0x3f')],'data6':_0x43266f[_0xa953('0x3c')]},{'where':{'id':_0x43266f['id']}});})['then'](function(){return _0x43266f;})['catch'](function(_0x52bd0e){logger[_0xa953('0x42')](_0xa953('0x43'),_0x43266f['id'],_0x52bd0e);});}function getOauth2MicrosoftAccessToken(_0x1bce3f,_0x66d622){var _0x2dfcef={'grant_type':'authorization_code','code':_0x1bce3f,'scope':getAccessTokenScope(_0x66d622),'redirect_uri':_0x66d622[_0xa953('0x44')],'client_id':_0x66d622[_0xa953('0x27')],'client_secret':encryptor[_0xa953('0x3d')](_0x66d622[_0xa953('0x38')])};var _0x1e939c={'method':_0xa953('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xa953('0x1d')](_0xa953('0x1e'),_0x66d622[_0xa953('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2dfcef,'json':!![]};return rp(_0x1e939c);}function startRefreshInterval(_0x3b38df){var _0x5129c6=schedule[_0xa953('0x45')];if(_0x5129c6[_0x3b38df['id']])clearInterval(_0x5129c6[_0x3b38df['id']]);_0x5129c6[_0x3b38df['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x3b38df['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa953('0x45')]=_0x5129c6;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa953('0x37')](function(_0x543db0){var _0x47fc9e=_0x543db0['map'](function(_0x17373a){return refreshOauth2MicrosoftAccessToken(_0x17373a)[_0xa953('0x37')](function(_0x23c5ee){startRefreshInterval(_0x23c5ee);});});return Promise[_0xa953('0x46')](_0x47fc9e);})[_0xa953('0x47')](function(_0xe793a8){var _0x132ebd=_0xe793a8?util[_0xa953('0x48')](_0xe793a8,{'showHidden':![],'depth':null}):'';logger[_0xa953('0x42')](_0xa953('0x49'),_0x132ebd);});}module[_0xa953('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 9fc9f0f..78b5d25 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 _0x7c71=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x5deeb0,_0x5d96f2){var _0x1093bc=function(_0x2e5fd4){while(--_0x2e5fd4){_0x5deeb0['push'](_0x5deeb0['shift']());}};_0x1093bc(++_0x5d96f2);}(_0x7c71,0x177));var _0x17c7=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x7c71[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));var moment=require(_0x17c7('0x2'));var BPromise=require(_0x17c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17c7('0x4'));var db=require(_0x17c7('0x5'))['db'];var utils=require(_0x17c7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x17c7('0x7'));var jayson=require(_0x17c7('0x8'));var client=jayson[_0x17c7('0x9')][_0x17c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c061b,_0xf284a2,_0x1ff4ec){return new BPromise(function(_0x50feb0,_0x13fdad){return client[_0x17c7('0xb')](_0x3c061b,_0x1ff4ec)[_0x17c7('0xc')](function(_0xdb3575){logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));logger[_0x17c7('0x10')](_0x17c7('0x11'),_0xf284a2,_0x17c7('0xf'),JSON['stringify'](_0xdb3575));if(_0xdb3575['error']){if(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x13')]===0x1f4){logger['error'](_0x17c7('0xe'),_0xf284a2,_0xdb3575[_0x17c7('0x12')]['message']);return _0x13fdad(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xf284a2,_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);return _0x50feb0(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}else{logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));_0x50feb0(_0xdb3575[_0x17c7('0x15')][_0x17c7('0x14')]);}})[_0x17c7('0x16')](function(_0x296f9c){logger[_0x17c7('0x12')]('CloudProvider,\x20%s,\x20%s',_0xf284a2,_0x296f9c);_0x13fdad(_0x296f9c);});});} \ No newline at end of file +var _0x5236=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5edc3b,_0x21995d){var _0x82275=function(_0x3ff620){while(--_0x3ff620){_0x5edc3b['push'](_0x5edc3b['shift']());}};_0x82275(++_0x21995d);}(_0x5236,0x109));var _0x6523=function(_0x20d39d,_0x5e8fd4){_0x20d39d=_0x20d39d-0x0;var _0xf75618=_0x5236[_0x20d39d];return _0xf75618;};'use strict';var _=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var moment=require(_0x6523('0x2'));var BPromise=require(_0x6523('0x3'));var rs=require(_0x6523('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6523('0x5'))['db'];var utils=require(_0x6523('0x6'));var logger=require('../../config/logger')(_0x6523('0x7'));var config=require(_0x6523('0x8'));var jayson=require(_0x6523('0x9'));var client=jayson[_0x6523('0xa')][_0x6523('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53548c,_0x32e99c,_0x17b335){return new BPromise(function(_0x24550b,_0x514e29){return client[_0x6523('0xc')](_0x53548c,_0x17b335)[_0x6523('0xd')](function(_0x2afd63){logger[_0x6523('0xe')](_0x6523('0xf'),_0x32e99c,_0x6523('0x10'));logger['debug'](_0x6523('0x11'),_0x32e99c,_0x6523('0x10'),JSON[_0x6523('0x12')](_0x2afd63));if(_0x2afd63[_0x6523('0x13')]){if(_0x2afd63[_0x6523('0x13')]['code']===0x1f4){logger[_0x6523('0x13')](_0x6523('0xf'),_0x32e99c,_0x2afd63['error'][_0x6523('0x14')]);return _0x514e29(_0x2afd63['error']['message']);}logger[_0x6523('0x13')](_0x6523('0xf'),_0x32e99c,_0x2afd63[_0x6523('0x13')][_0x6523('0x14')]);return _0x24550b(_0x2afd63[_0x6523('0x13')][_0x6523('0x14')]);}else{logger['info'](_0x6523('0xf'),_0x32e99c,'request\x20sent');_0x24550b(_0x2afd63[_0x6523('0x15')][_0x6523('0x14')]);}})[_0x6523('0x16')](function(_0x34acbe){logger[_0x6523('0x13')](_0x6523('0xf'),_0x32e99c,_0x34acbe);_0x514e29(_0x34acbe);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f4ab3c7..a5cff78 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x7a54,0x106));var _0x47a5=function(_0x55d224,_0xbd2e16){_0x55d224=_0x55d224-0x0;var _0x1cfd77=_0x7a54[_0x55d224];return _0x1cfd77;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=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(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4780ae,_0x3b5c2f){_0x4780ae=_0x4780ae-0x0;var _0x3b6849=_0x5f2f[_0x4780ae];return _0x3b6849;};'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 3fcdefd..ae0c675 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 _0x748f=['name','STRING','sequelize','exports'];(function(_0x89fd51,_0x6d935d){var _0xb3c267=function(_0x12fca0){while(--_0x12fca0){_0x89fd51['push'](_0x89fd51['shift']());}};_0xb3c267(++_0x6d935d);}(_0x748f,0x76));var _0xf748=function(_0x6ff3a9,_0x13b9c2){_0x6ff3a9=_0x6ff3a9-0x0;var _0x249066=_0x748f[_0x6ff3a9];return _0x249066;};'use strict';var Sequelize=require(_0xf748('0x0'));module[_0xf748('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf748('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf748('0x3')]},'companyId':{'type':Sequelize[_0xf748('0x3')]},'website':{'type':Sequelize[_0xf748('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf748('0x3')]},'street':{'type':Sequelize[_0xf748('0x3')]},'postalCode':{'type':Sequelize[_0xf748('0x3')]},'city':{'type':Sequelize[_0xf748('0x3')]},'country':{'type':Sequelize[_0xf748('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf748('0x3')]},'sStreet':{'type':Sequelize[_0xf748('0x3')]},'sPostalCode':{'type':Sequelize[_0xf748('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xf748('0x3')]},'description':{'type':Sequelize[_0xf748('0x3')]}}; \ No newline at end of file +var _0xcb4d=['name','exports','STRING'];(function(_0x5cb96f,_0x49f52a){var _0x75a267=function(_0x584e1d){while(--_0x584e1d){_0x5cb96f['push'](_0x5cb96f['shift']());}};_0x75a267(++_0x49f52a);}(_0xcb4d,0xcd));var _0xdcb4=function(_0x485b70,_0x179af7){_0x485b70=_0x485b70-0x0;var _0x4dc80f=_0xcb4d[_0x485b70];return _0x4dc80f;};'use strict';var Sequelize=require('sequelize');module[_0xdcb4('0x0')]={'name':{'type':Sequelize[_0xdcb4('0x1')],'unique':_0xdcb4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xdcb4('0x1')]},'companyId':{'type':Sequelize[_0xdcb4('0x1')]},'website':{'type':Sequelize[_0xdcb4('0x1')]},'phone':{'type':Sequelize[_0xdcb4('0x1')]},'fax':{'type':Sequelize[_0xdcb4('0x1')]},'type':{'type':Sequelize[_0xdcb4('0x1')]},'street':{'type':Sequelize[_0xdcb4('0x1')]},'postalCode':{'type':Sequelize[_0xdcb4('0x1')]},'city':{'type':Sequelize[_0xdcb4('0x1')]},'country':{'type':Sequelize[_0xdcb4('0x1')]},'email':{'type':Sequelize[_0xdcb4('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xdcb4('0x1')]},'sStreet':{'type':Sequelize[_0xdcb4('0x1')]},'sPostalCode':{'type':Sequelize[_0xdcb4('0x1')]},'sCity':{'type':Sequelize[_0xdcb4('0x1')]},'sCountry':{'type':Sequelize[_0xdcb4('0x1')]},'description':{'type':Sequelize[_0xdcb4('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2da95a9..f70cdaf 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 _0x4dd9=['squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Companies','UserProfileResource','end','error','stack','name','send','index','describe','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','CmCompany','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x4dd9,0x100));var _0x94dd=function(_0xc7d00e,_0x53faef){_0xc7d00e=_0xc7d00e-0x0;var _0x39bf39=_0x4dd9[_0xc7d00e];return _0x39bf39;};'use strict';var emlformat=require(_0x94dd('0x0'));var rimraf=require(_0x94dd('0x1'));var zipdir=require(_0x94dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94dd('0x3'));var moment=require(_0x94dd('0x4'));var BPromise=require(_0x94dd('0x5'));var Mustache=require(_0x94dd('0x6'));var util=require(_0x94dd('0x7'));var path=require(_0x94dd('0x8'));var sox=require(_0x94dd('0x9'));var csv=require(_0x94dd('0xa'));var ejs=require(_0x94dd('0xb'));var fs=require('fs');var fs_extra=require(_0x94dd('0xc'));var _=require(_0x94dd('0xd'));var squel=require(_0x94dd('0xe'));var crypto=require(_0x94dd('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x94dd('0xa'));var querystring=require('querystring');var Papa=require(_0x94dd('0x10'));var Redis=require('ioredis');var authService=require(_0x94dd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x94dd('0x12'));var hardwareService=require(_0x94dd('0x13'));var logger=require(_0x94dd('0x14'))('api');var utils=require(_0x94dd('0x15'));var config=require(_0x94dd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x94dd('0x17'))['db'];function respondWithStatusCode(_0x24dda1,_0x318e96){_0x318e96=_0x318e96||0xcc;return function(_0x40ff81){if(_0x40ff81){return _0x24dda1[_0x94dd('0x18')](_0x318e96);}return _0x24dda1[_0x94dd('0x19')](_0x318e96)['end']();};}function respondWithResult(_0x23db2a,_0x3d04e9){_0x3d04e9=_0x3d04e9||0xc8;return function(_0x54ce9c){if(_0x54ce9c){return _0x23db2a[_0x94dd('0x19')](_0x3d04e9)[_0x94dd('0x1a')](_0x54ce9c);}};}function respondWithFilteredResult(_0x2c544f,_0x5adeba){return function(_0x5ebfd2){if(_0x5ebfd2){var _0x5db617=typeof _0x5adeba[_0x94dd('0x1b')]===_0x94dd('0x1c')&&typeof _0x5adeba[_0x94dd('0x1d')]===_0x94dd('0x1c');var _0x2c5ec1=_0x5ebfd2[_0x94dd('0x1e')];var _0x4cf8ba=_0x5db617?0x0:_0x5adeba['offset'];var _0x4a40b9=_0x5db617?_0x5ebfd2[_0x94dd('0x1e')]:_0x5adeba[_0x94dd('0x1b')]+_0x5adeba[_0x94dd('0x1d')];var _0x2ff5fe;if(_0x4a40b9>=_0x2c5ec1){_0x4a40b9=_0x2c5ec1;_0x2ff5fe=0xc8;}else{_0x2ff5fe=0xce;}_0x2c544f[_0x94dd('0x19')](_0x2ff5fe);return _0x2c544f[_0x94dd('0x1f')](_0x94dd('0x20'),_0x4cf8ba+'-'+_0x4a40b9+'/'+_0x2c5ec1)['json'](_0x5ebfd2);}return null;};}function patchUpdates(_0x9c9cbf){return function(_0x1d2789){try{jsonpatch[_0x94dd('0x21')](_0x1d2789,_0x9c9cbf,!![]);}catch(_0x1e95de){return BPromise['reject'](_0x1e95de);}return _0x1d2789[_0x94dd('0x22')]();};}function saveUpdates(_0x2cab26,_0x40d024){return function(_0x2cd2d9){if(_0x2cd2d9){return _0x2cd2d9[_0x94dd('0x23')](_0x2cab26)['then'](function(_0x1ffaae){return _0x1ffaae;});}return null;};}function removeEntity(_0xdf03b0,_0xa0b638){return function(_0x5007d7){if(_0x5007d7){return _0x5007d7[_0x94dd('0x24')]()[_0x94dd('0x25')](function(){var _0x55c8ff=_0x5007d7[_0x94dd('0x26')]({'plain':!![]});var _0x1dd3e9=_0x94dd('0x27');return db[_0x94dd('0x28')][_0x94dd('0x24')]({'where':{'type':_0x1dd3e9,'resourceId':_0x55c8ff['id']}})['then'](function(){return _0x5007d7;});})['then'](function(){_0xdf03b0[_0x94dd('0x19')](0xcc)[_0x94dd('0x29')]();});}};}function handleEntityNotFound(_0x50ff00,_0x1f6b90){return function(_0x5bdf44){if(!_0x5bdf44){_0x50ff00[_0x94dd('0x18')](0x194);}return _0x5bdf44;};}function handleError(_0x232dd4,_0x33e37e){_0x33e37e=_0x33e37e||0x1f4;return function(_0x1298c6){logger[_0x94dd('0x2a')](_0x1298c6[_0x94dd('0x2b')]);if(_0x1298c6[_0x94dd('0x2c')]){delete _0x1298c6[_0x94dd('0x2c')];}_0x232dd4[_0x94dd('0x19')](_0x33e37e)[_0x94dd('0x2d')](_0x1298c6);};}exports[_0x94dd('0x2e')]=function(_0x3f8789,_0x2508b6){var _0x2ecd50={},_0x36a868={},_0x5c8fdd={'count':0x0,'rows':[]};return db['CmCompany'][_0x94dd('0x2f')]()[_0x94dd('0x25')](function(_0x1f3b5b){_0x36a868[_0x94dd('0x30')]=_['keys'](_0x1f3b5b);_0x36a868[_0x94dd('0x31')]=_[_0x94dd('0x32')](_0x3f8789['query']);_0x36a868[_0x94dd('0x33')]=_[_0x94dd('0x34')](_0x36a868[_0x94dd('0x30')],_0x36a868[_0x94dd('0x31')]);_0x2ecd50[_0x94dd('0x35')]=_[_0x94dd('0x34')](_0x36a868['model'],qs[_0x94dd('0x36')](_0x3f8789['query'][_0x94dd('0x36')]));_0x2ecd50[_0x94dd('0x35')]=_0x2ecd50[_0x94dd('0x35')][_0x94dd('0x37')]?_0x2ecd50[_0x94dd('0x35')]:_0x36a868['model'];if(!_0x3f8789['query'][_0x94dd('0x38')](_0x94dd('0x39'))){_0x2ecd50[_0x94dd('0x1d')]=qs[_0x94dd('0x1d')](_0x3f8789['query']['limit']);_0x2ecd50[_0x94dd('0x1b')]=qs[_0x94dd('0x1b')](_0x3f8789['query'][_0x94dd('0x1b')]);}_0x2ecd50[_0x94dd('0x3a')]=qs[_0x94dd('0x3b')](_0x3f8789[_0x94dd('0x31')][_0x94dd('0x3b')]);_0x2ecd50[_0x94dd('0x3c')]=qs[_0x94dd('0x33')](_[_0x94dd('0x3d')](_0x3f8789[_0x94dd('0x31')],_0x36a868['filters']),_0x1f3b5b);if(_0x3f8789['query'][_0x94dd('0x3e')]){_0x2ecd50[_0x94dd('0x3c')]=_[_0x94dd('0x3f')](_0x2ecd50[_0x94dd('0x3c')],{'$or':_[_0x94dd('0x40')](_0x2ecd50[_0x94dd('0x35')],function(_0x52bdcf){var _0x35e3b2={};_0x35e3b2[_0x52bdcf]={'$like':'%'+_0x3f8789[_0x94dd('0x31')]['filter']+'%'};return _0x35e3b2;})});}_0x2ecd50=_['merge']({},_0x2ecd50,_0x3f8789[_0x94dd('0x41')]);var _0x46fecc={'where':_0x2ecd50[_0x94dd('0x3c')]};return db[_0x94dd('0x42')][_0x94dd('0x1e')](_0x46fecc)[_0x94dd('0x25')](function(_0x1343b0){_0x5c8fdd[_0x94dd('0x1e')]=_0x1343b0;if(_0x3f8789[_0x94dd('0x31')][_0x94dd('0x43')]){_0x2ecd50[_0x94dd('0x44')]=[{'all':!![]}];}return db[_0x94dd('0x42')][_0x94dd('0x45')](_0x2ecd50);})['then'](function(_0x2416c4){_0x5c8fdd[_0x94dd('0x46')]=_0x2416c4;return _0x5c8fdd;})[_0x94dd('0x25')](respondWithFilteredResult(_0x2508b6,_0x2ecd50))[_0x94dd('0x47')](handleError(_0x2508b6,null));})['catch'](handleError(_0x2508b6,null));};exports[_0x94dd('0x48')]=function(_0x5cac09,_0x5b4a54){var _0x42d372={'raw':![],'where':{'id':_0x5cac09['params']['id']}},_0x16bbf6={};_0x16bbf6[_0x94dd('0x30')]=_[_0x94dd('0x32')](db[_0x94dd('0x42')][_0x94dd('0x49')]);_0x16bbf6[_0x94dd('0x31')]=_[_0x94dd('0x32')](_0x5cac09['query']);_0x16bbf6[_0x94dd('0x33')]=_[_0x94dd('0x34')](_0x16bbf6['model'],_0x16bbf6[_0x94dd('0x31')]);_0x42d372[_0x94dd('0x35')]=_[_0x94dd('0x34')](_0x16bbf6['model'],qs['fields'](_0x5cac09[_0x94dd('0x31')][_0x94dd('0x36')]));_0x42d372[_0x94dd('0x35')]=_0x42d372['attributes']['length']?_0x42d372[_0x94dd('0x35')]:_0x16bbf6[_0x94dd('0x30')];if(_0x5cac09[_0x94dd('0x31')][_0x94dd('0x43')]){_0x42d372[_0x94dd('0x44')]=[{'all':!![]}];}_0x42d372=_[_0x94dd('0x3f')]({},_0x42d372,_0x5cac09[_0x94dd('0x41')]);return db[_0x94dd('0x42')][_0x94dd('0x4a')](_0x42d372)[_0x94dd('0x25')](handleEntityNotFound(_0x5b4a54,null))[_0x94dd('0x25')](respondWithResult(_0x5b4a54,null))[_0x94dd('0x47')](handleError(_0x5b4a54,null));};exports[_0x94dd('0x4b')]=function(_0x48d946,_0x71b03a){return db[_0x94dd('0x42')][_0x94dd('0x4b')](_0x48d946[_0x94dd('0x4c')],{})[_0x94dd('0x25')](function(_0x228e42){var _0x5b059a=_0x48d946[_0x94dd('0x4d')][_0x94dd('0x26')]({'plain':!![]});if(!_0x5b059a)throw new Error(_0x94dd('0x4e'));if(_0x5b059a[_0x94dd('0x4f')]==='user'){var _0x274160=_0x228e42['get']({'plain':!![]});var _0x31a4ef=_0x94dd('0x27');return db[_0x94dd('0x50')]['find']({'where':{'name':_0x31a4ef,'userProfileId':_0x5b059a[_0x94dd('0x51')]},'raw':!![]})[_0x94dd('0x25')](function(_0x775528){if(_0x775528&&_0x775528[_0x94dd('0x52')]===0x0){return db[_0x94dd('0x28')][_0x94dd('0x4b')]({'name':_0x274160[_0x94dd('0x2c')],'resourceId':_0x274160['id'],'type':_0x775528[_0x94dd('0x2c')],'sectionId':_0x775528['id']},{})[_0x94dd('0x25')](function(){return _0x228e42;});}else{return _0x228e42;}})[_0x94dd('0x47')](function(_0x5d14d3){logger[_0x94dd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d14d3);throw _0x5d14d3;});}return _0x228e42;})[_0x94dd('0x25')](respondWithResult(_0x71b03a,0xc9))[_0x94dd('0x47')](handleError(_0x71b03a,null));};exports[_0x94dd('0x23')]=function(_0x13362f,_0x39e3f4){if(_0x13362f[_0x94dd('0x4c')]['id']){delete _0x13362f[_0x94dd('0x4c')]['id'];}return db[_0x94dd('0x42')][_0x94dd('0x4a')]({'where':{'id':_0x13362f['params']['id']}})['then'](handleEntityNotFound(_0x39e3f4,null))[_0x94dd('0x25')](saveUpdates(_0x13362f[_0x94dd('0x4c')],null))['then'](respondWithResult(_0x39e3f4,null))[_0x94dd('0x47')](handleError(_0x39e3f4,null));};exports[_0x94dd('0x24')]=function(_0xc79489,_0x37fec5){return db[_0x94dd('0x42')][_0x94dd('0x4a')]({'where':{'id':_0xc79489[_0x94dd('0x53')]['id']}})[_0x94dd('0x25')](handleEntityNotFound(_0x37fec5,null))[_0x94dd('0x25')](removeEntity(_0x37fec5,null))['catch'](handleError(_0x37fec5,null));};exports[_0x94dd('0x2f')]=function(_0x716d11,_0xa232d2){return db[_0x94dd('0x42')]['describe']()[_0x94dd('0x25')](respondWithResult(_0xa232d2,null))[_0x94dd('0x47')](handleError(_0xa232d2,null));};exports[_0x94dd('0x54')]=function(_0x4fc336,_0x128f13,_0x4cc047){return db[_0x94dd('0x55')][_0x94dd('0x4a')]({'where':{'id':_0x4fc336['params']['id']}})[_0x94dd('0x25')](handleEntityNotFound(_0x128f13,null))[_0x94dd('0x25')](function(_0x246228){if(_0x246228){return _0x246228['addContacts'](_0x4fc336[_0x94dd('0x4c')][_0x94dd('0x56')],_[_0x94dd('0x57')](_0x4fc336['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x128f13,null))[_0x94dd('0x47')](handleError(_0x128f13,null));};exports[_0x94dd('0x58')]=function(_0x185e36,_0x4edc61,_0x5754f1){var _0x5610d2={};var _0x34c541={};var _0x304759;var _0x43d6df;return db[_0x94dd('0x42')][_0x94dd('0x59')]({'where':{'id':_0x185e36[_0x94dd('0x53')]['id']}})[_0x94dd('0x25')](handleEntityNotFound(_0x4edc61,null))['then'](function(_0x5fbde3){if(_0x5fbde3){_0x304759=_0x5fbde3;_0x34c541[_0x94dd('0x30')]=_[_0x94dd('0x32')](db['CmContact']['rawAttributes']);_0x34c541[_0x94dd('0x31')]=_[_0x94dd('0x32')](_0x185e36[_0x94dd('0x31')]);_0x34c541[_0x94dd('0x33')]=_[_0x94dd('0x34')](_0x34c541[_0x94dd('0x30')],_0x34c541[_0x94dd('0x31')]);_0x5610d2[_0x94dd('0x35')]=_[_0x94dd('0x34')](_0x34c541[_0x94dd('0x30')],qs[_0x94dd('0x36')](_0x185e36[_0x94dd('0x31')][_0x94dd('0x36')]));_0x5610d2[_0x94dd('0x35')]=_0x5610d2[_0x94dd('0x35')][_0x94dd('0x37')]?_0x5610d2[_0x94dd('0x35')]:_0x34c541[_0x94dd('0x30')];_0x5610d2['order']=qs['sort'](_0x185e36[_0x94dd('0x31')][_0x94dd('0x3b')]);_0x5610d2[_0x94dd('0x3c')]=qs[_0x94dd('0x33')](_['pick'](_0x185e36[_0x94dd('0x31')],_0x34c541['filters']));if(_0x185e36[_0x94dd('0x31')][_0x94dd('0x3e')]){_0x5610d2[_0x94dd('0x3c')]=_[_0x94dd('0x3f')](_0x5610d2[_0x94dd('0x3c')],{'$or':_[_0x94dd('0x40')](_0x5610d2[_0x94dd('0x35')],function(_0x2d466c){var _0x25f319={};_0x25f319[_0x2d466c]={'$like':'%'+_0x185e36[_0x94dd('0x31')][_0x94dd('0x3e')]+'%'};return _0x25f319;})});}_0x5610d2=_['merge']({},_0x5610d2,_0x185e36[_0x94dd('0x41')]);return _0x304759[_0x94dd('0x58')](_0x5610d2);}})[_0x94dd('0x25')](function(_0x1e3531){if(_0x1e3531){_0x43d6df=_0x1e3531[_0x94dd('0x37')];if(!_0x185e36[_0x94dd('0x31')][_0x94dd('0x38')](_0x94dd('0x39'))){_0x5610d2['limit']=qs[_0x94dd('0x1d')](_0x185e36[_0x94dd('0x31')][_0x94dd('0x1d')]);_0x5610d2[_0x94dd('0x1b')]=qs[_0x94dd('0x1b')](_0x185e36[_0x94dd('0x31')]['offset']);}return _0x304759[_0x94dd('0x58')](_0x5610d2);}})[_0x94dd('0x25')](function(_0x469064){if(_0x469064){return _0x469064?{'count':_0x43d6df,'rows':_0x469064}:null;}})['then'](respondWithResult(_0x4edc61,null))[_0x94dd('0x47')](handleError(_0x4edc61,null));}; \ No newline at end of file +var _0x4c8a=['save','update','then','destroy','get','Companies','UserProfileResource','stack','name','index','CmCompany','describe','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','includeAll','include','findAll','rows','catch','intersection','find','create','body','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','findOne','rawAttributes','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x4c8a,0x130));var _0xa4c8=function(_0x3e7014,_0x55046a){_0x3e7014=_0x3e7014-0x0;var _0x457fb8=_0x4c8a[_0x3e7014];return _0x457fb8;};'use strict';var emlformat=require(_0xa4c8('0x0'));var rimraf=require(_0xa4c8('0x1'));var zipdir=require(_0xa4c8('0x2'));var jsonpatch=require(_0xa4c8('0x3'));var rp=require(_0xa4c8('0x4'));var moment=require(_0xa4c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa4c8('0x6'));var util=require(_0xa4c8('0x7'));var path=require(_0xa4c8('0x8'));var sox=require(_0xa4c8('0x9'));var csv=require(_0xa4c8('0xa'));var ejs=require(_0xa4c8('0xb'));var fs=require('fs');var fs_extra=require(_0xa4c8('0xc'));var _=require('lodash');var squel=require(_0xa4c8('0xd'));var crypto=require(_0xa4c8('0xe'));var jsforce=require(_0xa4c8('0xf'));var deskjs=require(_0xa4c8('0x10'));var toCsv=require(_0xa4c8('0xa'));var querystring=require(_0xa4c8('0x11'));var Papa=require(_0xa4c8('0x12'));var Redis=require('ioredis');var authService=require(_0xa4c8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa4c8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4c8('0x15'))(_0xa4c8('0x16'));var utils=require(_0xa4c8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa4c8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52de1f,_0x171d4b){_0x171d4b=_0x171d4b||0xcc;return function(_0x12afaf){if(_0x12afaf){return _0x52de1f[_0xa4c8('0x19')](_0x171d4b);}return _0x52de1f[_0xa4c8('0x1a')](_0x171d4b)[_0xa4c8('0x1b')]();};}function respondWithResult(_0x317607,_0x4928f4){_0x4928f4=_0x4928f4||0xc8;return function(_0x3bcc02){if(_0x3bcc02){return _0x317607[_0xa4c8('0x1a')](_0x4928f4)[_0xa4c8('0x1c')](_0x3bcc02);}};}function respondWithFilteredResult(_0x4a1da9,_0x586d45){return function(_0x2047d8){if(_0x2047d8){var _0xac92c4=typeof _0x586d45['offset']===_0xa4c8('0x1d')&&typeof _0x586d45[_0xa4c8('0x1e')]===_0xa4c8('0x1d');var _0x111b1d=_0x2047d8['count'];var _0x466fbe=_0xac92c4?0x0:_0x586d45[_0xa4c8('0x1f')];var _0x189fff=_0xac92c4?_0x2047d8[_0xa4c8('0x20')]:_0x586d45[_0xa4c8('0x1f')]+_0x586d45[_0xa4c8('0x1e')];var _0x533855;if(_0x189fff>=_0x111b1d){_0x189fff=_0x111b1d;_0x533855=0xc8;}else{_0x533855=0xce;}_0x4a1da9[_0xa4c8('0x1a')](_0x533855);return _0x4a1da9['set'](_0xa4c8('0x21'),_0x466fbe+'-'+_0x189fff+'/'+_0x111b1d)[_0xa4c8('0x1c')](_0x2047d8);}return null;};}function patchUpdates(_0x246c5c){return function(_0x2fac0f){try{jsonpatch[_0xa4c8('0x22')](_0x2fac0f,_0x246c5c,!![]);}catch(_0x5417f7){return BPromise[_0xa4c8('0x23')](_0x5417f7);}return _0x2fac0f[_0xa4c8('0x24')]();};}function saveUpdates(_0x205927,_0x16d3f2){return function(_0x5d7901){if(_0x5d7901){return _0x5d7901[_0xa4c8('0x25')](_0x205927)[_0xa4c8('0x26')](function(_0x4e0a03){return _0x4e0a03;});}return null;};}function removeEntity(_0x165684,_0xba64f7){return function(_0x2ef20e){if(_0x2ef20e){return _0x2ef20e[_0xa4c8('0x27')]()[_0xa4c8('0x26')](function(){var _0x449ab9=_0x2ef20e[_0xa4c8('0x28')]({'plain':!![]});var _0xfa272a=_0xa4c8('0x29');return db[_0xa4c8('0x2a')][_0xa4c8('0x27')]({'where':{'type':_0xfa272a,'resourceId':_0x449ab9['id']}})[_0xa4c8('0x26')](function(){return _0x2ef20e;});})['then'](function(){_0x165684[_0xa4c8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cafe1,_0xcffd34){return function(_0x175115){if(!_0x175115){_0x1cafe1[_0xa4c8('0x19')](0x194);}return _0x175115;};}function handleError(_0x571e9f,_0x46ee4c){_0x46ee4c=_0x46ee4c||0x1f4;return function(_0x4e4df7){logger['error'](_0x4e4df7[_0xa4c8('0x2b')]);if(_0x4e4df7[_0xa4c8('0x2c')]){delete _0x4e4df7[_0xa4c8('0x2c')];}_0x571e9f['status'](_0x46ee4c)['send'](_0x4e4df7);};}exports[_0xa4c8('0x2d')]=function(_0x1eabfb,_0x1cdc46){var _0x4bc591={},_0x415ca3={},_0x1f271d={'count':0x0,'rows':[]};return db[_0xa4c8('0x2e')][_0xa4c8('0x2f')]()[_0xa4c8('0x26')](function(_0x1f3a5e){_0x415ca3['model']=_[_0xa4c8('0x30')](_0x1f3a5e);_0x415ca3[_0xa4c8('0x31')]=_['keys'](_0x1eabfb[_0xa4c8('0x31')]);_0x415ca3[_0xa4c8('0x32')]=_['intersection'](_0x415ca3[_0xa4c8('0x33')],_0x415ca3['query']);_0x4bc591[_0xa4c8('0x34')]=_['intersection'](_0x415ca3['model'],qs[_0xa4c8('0x35')](_0x1eabfb['query']['fields']));_0x4bc591[_0xa4c8('0x34')]=_0x4bc591[_0xa4c8('0x34')][_0xa4c8('0x36')]?_0x4bc591['attributes']:_0x415ca3[_0xa4c8('0x33')];if(!_0x1eabfb[_0xa4c8('0x31')][_0xa4c8('0x37')](_0xa4c8('0x38'))){_0x4bc591[_0xa4c8('0x1e')]=qs[_0xa4c8('0x1e')](_0x1eabfb[_0xa4c8('0x31')][_0xa4c8('0x1e')]);_0x4bc591['offset']=qs[_0xa4c8('0x1f')](_0x1eabfb[_0xa4c8('0x31')]['offset']);}_0x4bc591[_0xa4c8('0x39')]=qs[_0xa4c8('0x3a')](_0x1eabfb[_0xa4c8('0x31')][_0xa4c8('0x3a')]);_0x4bc591[_0xa4c8('0x3b')]=qs[_0xa4c8('0x32')](_[_0xa4c8('0x3c')](_0x1eabfb[_0xa4c8('0x31')],_0x415ca3['filters']),_0x1f3a5e);if(_0x1eabfb[_0xa4c8('0x31')]['filter']){_0x4bc591[_0xa4c8('0x3b')]=_[_0xa4c8('0x3d')](_0x4bc591['where'],{'$or':_[_0xa4c8('0x3e')](_0x4bc591['attributes'],function(_0xff148){var _0x56a7df={};_0x56a7df[_0xff148]={'$like':'%'+_0x1eabfb[_0xa4c8('0x31')]['filter']+'%'};return _0x56a7df;})});}_0x4bc591=_[_0xa4c8('0x3d')]({},_0x4bc591,_0x1eabfb[_0xa4c8('0x3f')]);var _0x435961={'where':_0x4bc591[_0xa4c8('0x3b')]};return db[_0xa4c8('0x2e')][_0xa4c8('0x20')](_0x435961)[_0xa4c8('0x26')](function(_0x22cfc5){_0x1f271d[_0xa4c8('0x20')]=_0x22cfc5;if(_0x1eabfb[_0xa4c8('0x31')][_0xa4c8('0x40')]){_0x4bc591[_0xa4c8('0x41')]=[{'all':!![]}];}return db[_0xa4c8('0x2e')][_0xa4c8('0x42')](_0x4bc591);})[_0xa4c8('0x26')](function(_0x57696b){_0x1f271d[_0xa4c8('0x43')]=_0x57696b;return _0x1f271d;})['then'](respondWithFilteredResult(_0x1cdc46,_0x4bc591))[_0xa4c8('0x44')](handleError(_0x1cdc46,null));})[_0xa4c8('0x44')](handleError(_0x1cdc46,null));};exports['show']=function(_0x3e7a9e,_0x33575e){var _0x518810={'raw':![],'where':{'id':_0x3e7a9e['params']['id']}},_0x3cbb4d={};_0x3cbb4d[_0xa4c8('0x33')]=_[_0xa4c8('0x30')](db['CmCompany']['rawAttributes']);_0x3cbb4d[_0xa4c8('0x31')]=_[_0xa4c8('0x30')](_0x3e7a9e[_0xa4c8('0x31')]);_0x3cbb4d[_0xa4c8('0x32')]=_[_0xa4c8('0x45')](_0x3cbb4d[_0xa4c8('0x33')],_0x3cbb4d[_0xa4c8('0x31')]);_0x518810[_0xa4c8('0x34')]=_['intersection'](_0x3cbb4d[_0xa4c8('0x33')],qs[_0xa4c8('0x35')](_0x3e7a9e[_0xa4c8('0x31')][_0xa4c8('0x35')]));_0x518810[_0xa4c8('0x34')]=_0x518810[_0xa4c8('0x34')][_0xa4c8('0x36')]?_0x518810[_0xa4c8('0x34')]:_0x3cbb4d['model'];if(_0x3e7a9e['query'][_0xa4c8('0x40')]){_0x518810[_0xa4c8('0x41')]=[{'all':!![]}];}_0x518810=_[_0xa4c8('0x3d')]({},_0x518810,_0x3e7a9e[_0xa4c8('0x3f')]);return db[_0xa4c8('0x2e')][_0xa4c8('0x46')](_0x518810)[_0xa4c8('0x26')](handleEntityNotFound(_0x33575e,null))[_0xa4c8('0x26')](respondWithResult(_0x33575e,null))[_0xa4c8('0x44')](handleError(_0x33575e,null));};exports[_0xa4c8('0x47')]=function(_0x40a8ab,_0x5f4223){return db['CmCompany'][_0xa4c8('0x47')](_0x40a8ab[_0xa4c8('0x48')],{})[_0xa4c8('0x26')](function(_0xf003bf){var _0x316074=_0x40a8ab[_0xa4c8('0x49')][_0xa4c8('0x28')]({'plain':!![]});if(!_0x316074)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x316074['role']===_0xa4c8('0x49')){var _0x37adf9=_0xf003bf['get']({'plain':!![]});var _0x3ae80c=_0xa4c8('0x29');return db[_0xa4c8('0x4a')][_0xa4c8('0x46')]({'where':{'name':_0x3ae80c,'userProfileId':_0x316074['userProfileId']},'raw':!![]})[_0xa4c8('0x26')](function(_0x24449a){if(_0x24449a&&_0x24449a[_0xa4c8('0x4b')]===0x0){return db[_0xa4c8('0x2a')][_0xa4c8('0x47')]({'name':_0x37adf9['name'],'resourceId':_0x37adf9['id'],'type':_0x24449a[_0xa4c8('0x2c')],'sectionId':_0x24449a['id']},{})['then'](function(){return _0xf003bf;});}else{return _0xf003bf;}})[_0xa4c8('0x44')](function(_0x3b1533){logger[_0xa4c8('0x4c')](_0xa4c8('0x4d'),_0x3b1533);throw _0x3b1533;});}return _0xf003bf;})[_0xa4c8('0x26')](respondWithResult(_0x5f4223,0xc9))[_0xa4c8('0x44')](handleError(_0x5f4223,null));};exports[_0xa4c8('0x25')]=function(_0x83a3f0,_0x1a6700){if(_0x83a3f0[_0xa4c8('0x48')]['id']){delete _0x83a3f0[_0xa4c8('0x48')]['id'];}return db[_0xa4c8('0x2e')][_0xa4c8('0x46')]({'where':{'id':_0x83a3f0[_0xa4c8('0x4e')]['id']}})[_0xa4c8('0x26')](handleEntityNotFound(_0x1a6700,null))[_0xa4c8('0x26')](saveUpdates(_0x83a3f0[_0xa4c8('0x48')],null))[_0xa4c8('0x26')](respondWithResult(_0x1a6700,null))[_0xa4c8('0x44')](handleError(_0x1a6700,null));};exports[_0xa4c8('0x27')]=function(_0x36a421,_0x4c04c1){return db[_0xa4c8('0x2e')][_0xa4c8('0x46')]({'where':{'id':_0x36a421[_0xa4c8('0x4e')]['id']}})[_0xa4c8('0x26')](handleEntityNotFound(_0x4c04c1,null))['then'](removeEntity(_0x4c04c1,null))[_0xa4c8('0x44')](handleError(_0x4c04c1,null));};exports['describe']=function(_0x470df5,_0x3483ba){return db[_0xa4c8('0x2e')][_0xa4c8('0x2f')]()[_0xa4c8('0x26')](respondWithResult(_0x3483ba,null))[_0xa4c8('0x44')](handleError(_0x3483ba,null));};exports[_0xa4c8('0x4f')]=function(_0x2156a3,_0x57f2b1,_0x232ff6){return db[_0xa4c8('0x50')][_0xa4c8('0x46')]({'where':{'id':_0x2156a3[_0xa4c8('0x4e')]['id']}})[_0xa4c8('0x26')](handleEntityNotFound(_0x57f2b1,null))['then'](function(_0x1705d1){if(_0x1705d1){return _0x1705d1[_0xa4c8('0x4f')](_0x2156a3[_0xa4c8('0x48')]['ids'],_['omit'](_0x2156a3[_0xa4c8('0x48')],[_0xa4c8('0x51'),'id'])||{});}})['then'](respondWithResult(_0x57f2b1,null))[_0xa4c8('0x44')](handleError(_0x57f2b1,null));};exports['getContacts']=function(_0x4417de,_0xab5b70,_0x20e189){var _0x42b731={};var _0x3829f3={};var _0x55f729;var _0x203cb5;return db[_0xa4c8('0x2e')][_0xa4c8('0x52')]({'where':{'id':_0x4417de[_0xa4c8('0x4e')]['id']}})[_0xa4c8('0x26')](handleEntityNotFound(_0xab5b70,null))[_0xa4c8('0x26')](function(_0x93cce4){if(_0x93cce4){_0x55f729=_0x93cce4;_0x3829f3['model']=_['keys'](db[_0xa4c8('0x50')][_0xa4c8('0x53')]);_0x3829f3[_0xa4c8('0x31')]=_[_0xa4c8('0x30')](_0x4417de[_0xa4c8('0x31')]);_0x3829f3[_0xa4c8('0x32')]=_[_0xa4c8('0x45')](_0x3829f3[_0xa4c8('0x33')],_0x3829f3[_0xa4c8('0x31')]);_0x42b731[_0xa4c8('0x34')]=_[_0xa4c8('0x45')](_0x3829f3[_0xa4c8('0x33')],qs[_0xa4c8('0x35')](_0x4417de[_0xa4c8('0x31')][_0xa4c8('0x35')]));_0x42b731[_0xa4c8('0x34')]=_0x42b731['attributes'][_0xa4c8('0x36')]?_0x42b731['attributes']:_0x3829f3[_0xa4c8('0x33')];_0x42b731[_0xa4c8('0x39')]=qs[_0xa4c8('0x3a')](_0x4417de[_0xa4c8('0x31')]['sort']);_0x42b731['where']=qs[_0xa4c8('0x32')](_[_0xa4c8('0x3c')](_0x4417de[_0xa4c8('0x31')],_0x3829f3[_0xa4c8('0x32')]));if(_0x4417de[_0xa4c8('0x31')][_0xa4c8('0x54')]){_0x42b731[_0xa4c8('0x3b')]=_[_0xa4c8('0x3d')](_0x42b731[_0xa4c8('0x3b')],{'$or':_['map'](_0x42b731[_0xa4c8('0x34')],function(_0x819b0b){var _0x39da9e={};_0x39da9e[_0x819b0b]={'$like':'%'+_0x4417de['query'][_0xa4c8('0x54')]+'%'};return _0x39da9e;})});}_0x42b731=_[_0xa4c8('0x3d')]({},_0x42b731,_0x4417de['options']);return _0x55f729['getContacts'](_0x42b731);}})[_0xa4c8('0x26')](function(_0x355b53){if(_0x355b53){_0x203cb5=_0x355b53['length'];if(!_0x4417de[_0xa4c8('0x31')][_0xa4c8('0x37')](_0xa4c8('0x38'))){_0x42b731['limit']=qs[_0xa4c8('0x1e')](_0x4417de[_0xa4c8('0x31')][_0xa4c8('0x1e')]);_0x42b731[_0xa4c8('0x1f')]=qs[_0xa4c8('0x1f')](_0x4417de[_0xa4c8('0x31')][_0xa4c8('0x1f')]);}return _0x55f729['getContacts'](_0x42b731);}})[_0xa4c8('0x26')](function(_0x35436c){if(_0x35436c){return _0x35436c?{'count':_0x203cb5,'rows':_0x35436c}:null;}})[_0xa4c8('0x26')](respondWithResult(_0xab5b70,null))[_0xa4c8('0x44')](handleError(_0xab5b70,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4572314..bfbebb9 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 _0x0ea2=['cm_companies','lodash','util','moment','bluebird','request-promise','rimraf','./cmCompany.attributes','exports'];(function(_0x3ff3f0,_0x1a866e){var _0x4bcd45=function(_0x133dae){while(--_0x133dae){_0x3ff3f0['push'](_0x3ff3f0['shift']());}};_0x4bcd45(++_0x1a866e);}(_0x0ea2,0x1d5));var _0x20ea=function(_0xbca5f7,_0x7f833a){_0xbca5f7=_0xbca5f7-0x0;var _0x2eb4c0=_0x0ea2[_0xbca5f7];return _0x2eb4c0;};'use strict';var _=require(_0x20ea('0x0'));var util=require(_0x20ea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x20ea('0x2'));var BPromise=require(_0x20ea('0x3'));var rp=require(_0x20ea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20ea('0x5'));var config=require('../../config/environment');var attributes=require(_0x20ea('0x6'));module[_0x20ea('0x7')]=function(_0x329b4a,_0x3ff6d1){return _0x329b4a['define']('CmCompany',attributes,{'tableName':_0x20ea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0caa=['request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','moment','bluebird'];(function(_0x32635d,_0x587671){var _0x1d1225=function(_0x281b1b){while(--_0x281b1b){_0x32635d['push'](_0x32635d['shift']());}};_0x1d1225(++_0x587671);}(_0x0caa,0x140));var _0xa0ca=function(_0x4bd0b1,_0x56f9e1){_0x4bd0b1=_0x4bd0b1-0x0;var _0x201417=_0x0caa[_0x4bd0b1];return _0x201417;};'use strict';var _=require(_0xa0ca('0x0'));var util=require(_0xa0ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0ca('0x2'));var BPromise=require(_0xa0ca('0x3'));var rp=require(_0xa0ca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0ca('0x5'));var config=require(_0xa0ca('0x6'));var attributes=require(_0xa0ca('0x7'));module[_0xa0ca('0x8')]=function(_0x23e215,_0x4ab396){return _0x23e215[_0xa0ca('0x9')](_0xa0ca('0xa'),attributes,{'tableName':_0xa0ca('0xb'),'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 800a2d4..f34e005 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 _0xbffe=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4eddca,_0x144171){var _0x161ac0=function(_0x3d0b12){while(--_0x3d0b12){_0x4eddca['push'](_0x4eddca['shift']());}};_0x161ac0(++_0x144171);}(_0xbffe,0x141));var _0xebff=function(_0x4ddc4f,_0x4182b5){_0x4ddc4f=_0x4ddc4f-0x0;var _0x1fb8ba=_0xbffe[_0x4ddc4f];return _0x1fb8ba;};'use strict';var _=require(_0xebff('0x0'));var util=require(_0xebff('0x1'));var moment=require(_0xebff('0x2'));var BPromise=require(_0xebff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebff('0x4'))['db'];var utils=require(_0xebff('0x5'));var logger=require(_0xebff('0x6'))('rpc');var config=require(_0xebff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xebff('0x8')][_0xebff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441055,_0x13848c,_0x504237){return new BPromise(function(_0x55c7e5,_0x4425e3){return client[_0xebff('0xa')](_0x441055,_0x504237)[_0xebff('0xb')](function(_0x19dbdc){logger['info'](_0xebff('0xc'),_0x13848c,_0xebff('0xd'));logger[_0xebff('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x13848c,_0xebff('0xd'),JSON[_0xebff('0xf')](_0x19dbdc));if(_0x19dbdc[_0xebff('0x10')]){if(_0x19dbdc[_0xebff('0x10')]['code']===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x13848c,_0x19dbdc['error'][_0xebff('0x11')]);return _0x4425e3(_0x19dbdc[_0xebff('0x10')][_0xebff('0x11')]);}logger[_0xebff('0x10')](_0xebff('0xc'),_0x13848c,_0x19dbdc[_0xebff('0x10')][_0xebff('0x11')]);return _0x55c7e5(_0x19dbdc[_0xebff('0x10')][_0xebff('0x11')]);}else{logger[_0xebff('0x12')](_0xebff('0xc'),_0x13848c,'request\x20sent');_0x55c7e5(_0x19dbdc[_0xebff('0x13')][_0xebff('0x11')]);}})[_0xebff('0x14')](function(_0x291af5){logger[_0xebff('0x10')]('CmCompany,\x20%s,\x20%s',_0x13848c,_0x291af5);_0x4425e3(_0x291af5);});});} \ No newline at end of file +var _0xa198=['message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0xa198,0x1b8));var _0x8a19=function(_0x1db0a,_0x2b3284){_0x1db0a=_0x1db0a-0x0;var _0x18d203=_0xa198[_0x1db0a];return _0x18d203;};'use strict';var _=require(_0x8a19('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a19('0x1'));var rs=require(_0x8a19('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a19('0x3'))['db'];var utils=require(_0x8a19('0x4'));var logger=require(_0x8a19('0x5'))(_0x8a19('0x6'));var config=require(_0x8a19('0x7'));var jayson=require(_0x8a19('0x8'));var client=jayson[_0x8a19('0x9')][_0x8a19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x577249,_0x1b6bc6,_0x1ce778){return new BPromise(function(_0xae0a7,_0x58410c){return client[_0x8a19('0xb')](_0x577249,_0x1ce778)[_0x8a19('0xc')](function(_0x3c1636){logger[_0x8a19('0xd')](_0x8a19('0xe'),_0x1b6bc6,'request\x20sent');logger[_0x8a19('0xf')](_0x8a19('0x10'),_0x1b6bc6,_0x8a19('0x11'),JSON[_0x8a19('0x12')](_0x3c1636));if(_0x3c1636[_0x8a19('0x13')]){if(_0x3c1636[_0x8a19('0x13')]['code']===0x1f4){logger[_0x8a19('0x13')](_0x8a19('0xe'),_0x1b6bc6,_0x3c1636[_0x8a19('0x13')][_0x8a19('0x14')]);return _0x58410c(_0x3c1636[_0x8a19('0x13')][_0x8a19('0x14')]);}logger[_0x8a19('0x13')](_0x8a19('0xe'),_0x1b6bc6,_0x3c1636['error']['message']);return _0xae0a7(_0x3c1636[_0x8a19('0x13')][_0x8a19('0x14')]);}else{logger['info'](_0x8a19('0xe'),_0x1b6bc6,'request\x20sent');_0xae0a7(_0x3c1636[_0x8a19('0x15')][_0x8a19('0x14')]);}})[_0x8a19('0x16')](function(_0x3a21b5){logger['error'](_0x8a19('0xe'),_0x1b6bc6,_0x3a21b5);_0x58410c(_0x3a21b5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 46f77d0..690ceef 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 _0x897e=['show','/:id/contacts','getContacts','post','addContacts','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x13187b,_0xdb9234){var _0xc7e2f6=function(_0xe4b1b6){while(--_0xe4b1b6){_0x13187b['push'](_0x13187b['shift']());}};_0xc7e2f6(++_0xdb9234);}(_0x897e,0x1d6));var _0xe897=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x897e[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0xe897('0x0'));var util=require('util');var path=require(_0xe897('0x1'));var timeout=require('connect-timeout');var express=require(_0xe897('0x2'));var router=express[_0xe897('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe897('0x4'));var interaction=require(_0xe897('0x5'));var config=require(_0xe897('0x6'));var controller=require(_0xe897('0x7'));router[_0xe897('0x8')]('/',auth[_0xe897('0x9')](),controller[_0xe897('0xa')]);router[_0xe897('0x8')]('/describe',auth[_0xe897('0x9')](),controller[_0xe897('0xb')]);router[_0xe897('0x8')](_0xe897('0xc'),auth[_0xe897('0x9')](),controller[_0xe897('0xd')]);router[_0xe897('0x8')](_0xe897('0xe'),auth[_0xe897('0x9')](),controller[_0xe897('0xf')]);router[_0xe897('0x10')]('/',auth[_0xe897('0x9')](),controller['create']);router[_0xe897('0x10')](_0xe897('0xe'),auth[_0xe897('0x9')](),controller[_0xe897('0x11')]);router[_0xe897('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe897('0x13')]);router[_0xe897('0x14')]('/:id',auth[_0xe897('0x9')](),controller[_0xe897('0x15')]);module[_0xe897('0x16')]=router; \ No newline at end of file +var _0xea32=['getContacts','post','create','addContacts','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/contacts'];(function(_0x1e7d0b,_0x395352){var _0x261b3d=function(_0x500a1f){while(--_0x500a1f){_0x1e7d0b['push'](_0x1e7d0b['shift']());}};_0x261b3d(++_0x395352);}(_0xea32,0xf8));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2ea3('0x0'));var util=require('util');var path=require(_0x2ea3('0x1'));var timeout=require(_0x2ea3('0x2'));var express=require(_0x2ea3('0x3'));var router=express[_0x2ea3('0x4')]();var fs_extra=require(_0x2ea3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2ea3('0x6'));var config=require(_0x2ea3('0x7'));var controller=require(_0x2ea3('0x8'));router[_0x2ea3('0x9')]('/',auth[_0x2ea3('0xa')](),controller['index']);router['get'](_0x2ea3('0xb'),auth['isAuthenticated'](),controller[_0x2ea3('0xc')]);router['get'](_0x2ea3('0xd'),auth[_0x2ea3('0xa')](),controller[_0x2ea3('0xe')]);router[_0x2ea3('0x9')](_0x2ea3('0xf'),auth[_0x2ea3('0xa')](),controller[_0x2ea3('0x10')]);router[_0x2ea3('0x11')]('/',auth['isAuthenticated'](),controller[_0x2ea3('0x12')]);router['post'](_0x2ea3('0xf'),auth[_0x2ea3('0xa')](),controller[_0x2ea3('0x13')]);router['put'](_0x2ea3('0xd'),auth[_0x2ea3('0xa')](),controller[_0x2ea3('0x14')]);router[_0x2ea3('0x15')](_0x2ea3('0xd'),auth['isAuthenticated'](),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 6847d54..456f636 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 _0x10ef=['DATE','lodash','sequelize','exports','STRING','INTEGER','UNSIGNED'];(function(_0x3767f1,_0x2ca0fa){var _0x183d7e=function(_0x443363){while(--_0x443363){_0x3767f1['push'](_0x3767f1['shift']());}};_0x183d7e(++_0x2ca0fa);}(_0x10ef,0x1c1));var _0xf10e=function(_0xbbdf14,_0x1c0bca){_0xbbdf14=_0xbbdf14-0x0;var _0x1545a3=_0x10ef[_0xbbdf14];return _0x1545a3;};'use strict';var _=require(_0xf10e('0x0'));var Sequelize=require(_0xf10e('0x1'));module[_0xf10e('0x2')]={'firstName':{'type':Sequelize[_0xf10e('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf10e('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xf10e('0x3')]},'city':{'type':Sequelize[_0xf10e('0x3')]},'country':{'type':Sequelize[_0xf10e('0x3')]},'dateOfBirth':{'type':Sequelize[_0xf10e('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xf10e('0x3')]},'mobile':{'type':Sequelize[_0xf10e('0x3')]},'fax':{'type':Sequelize[_0xf10e('0x3')]},'email':{'type':Sequelize[_0xf10e('0x3')]},'url':{'type':Sequelize[_0xf10e('0x3')]},'facebook':{'type':Sequelize[_0xf10e('0x3')]},'fb_data':{'type':Sequelize[_0xf10e('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xf10e('0x3')]},'viber':{'type':Sequelize[_0xf10e('0x3')]},'line':{'type':Sequelize[_0xf10e('0x3')]},'wechat':{'type':Sequelize[_0xf10e('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf10e('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xf10e('0x3')]},'priority':{'type':Sequelize[_0xf10e('0x4')](0x2)[_0xf10e('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf10e('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xf10e('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xab68=['TEXT','INTEGER','UNSIGNED','NOW','sequelize','exports','STRING'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xab68,0x123));var _0x8ab6=function(_0x3d7c5f,_0x2fc46c){_0x3d7c5f=_0x3d7c5f-0x0;var _0x4a74ad=_0xab68[_0x3d7c5f];return _0x4a74ad;};'use strict';var _=require('lodash');var Sequelize=require(_0x8ab6('0x0'));module[_0x8ab6('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8ab6('0x2')]},'street':{'type':Sequelize[_0x8ab6('0x2')]},'postalCode':{'type':Sequelize[_0x8ab6('0x2')]},'city':{'type':Sequelize[_0x8ab6('0x2')]},'country':{'type':Sequelize[_0x8ab6('0x2')]},'dateOfBirth':{'type':Sequelize[_0x8ab6('0x2')]},'description':{'type':Sequelize[_0x8ab6('0x3')]},'phone':{'type':Sequelize[_0x8ab6('0x2')]},'mobile':{'type':Sequelize[_0x8ab6('0x2')]},'fax':{'type':Sequelize[_0x8ab6('0x2')]},'email':{'type':Sequelize[_0x8ab6('0x2')]},'url':{'type':Sequelize[_0x8ab6('0x2')]},'facebook':{'type':Sequelize[_0x8ab6('0x2')]},'fb_data':{'type':Sequelize[_0x8ab6('0x2')]},'twitter':{'type':Sequelize[_0x8ab6('0x2')]},'skype':{'type':Sequelize[_0x8ab6('0x2')]},'teams':{'type':Sequelize[_0x8ab6('0x2')]},'viber':{'type':Sequelize[_0x8ab6('0x2')]},'line':{'type':Sequelize[_0x8ab6('0x2')]},'wechat':{'type':Sequelize[_0x8ab6('0x2')]},'telegram':{'type':Sequelize[_0x8ab6('0x2')]},'UserId':{'type':Sequelize[_0x8ab6('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x8ab6('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8ab6('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x8ab6('0x6')]},'dialTimezone':{'type':Sequelize[_0x8ab6('0x2')]},'utcOffset':{'type':Sequelize[_0x8ab6('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 00ab739..247de2c 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(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 aefdd63..cc6ced7 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 _0xf7b3=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3bafa7,_0x5067ed){var _0x3ee6d2=function(_0x34bd4e){while(--_0x34bd4e){_0x3bafa7['push'](_0x3bafa7['shift']());}};_0x3ee6d2(++_0x5067ed);}(_0xf7b3,0xc1));var _0x3f7b=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0xf7b3[_0x375492];return _0x18ba5b;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x3f7b('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x3f7b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3f7b('0x2'),'afterDestroy':_0x3f7b('0x3')};function emitEvent(_0xcf5503){return function(_0x23cec9,_0x18a407,_0x299ccf){CmContactEvents[_0x3f7b('0x4')](_0xcf5503+':'+_0x23cec9['id'],_0x23cec9);CmContactEvents['emit'](_0xcf5503,_0x23cec9);_0x299ccf(null);};}for(var e in events){if(events[_0x3f7b('0x5')](e)){var event=events[e];CmContact[_0x3f7b('0x6')](e,emitEvent(event));}}module[_0x3f7b('0x7')]=CmContactEvents; \ No newline at end of file +var _0x4fe4=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','CmContact'];(function(_0x204c83,_0x338975){var _0x1f11c0=function(_0x5de88c){while(--_0x5de88c){_0x204c83['push'](_0x204c83['shift']());}};_0x1f11c0(++_0x338975);}(_0x4fe4,0x10b));var _0x44fe=function(_0x330d1f,_0x47c710){_0x330d1f=_0x330d1f-0x0;var _0x1df784=_0x4fe4[_0x330d1f];return _0x1df784;};'use strict';var EventEmitter=require(_0x44fe('0x0'));var CmContact=require(_0x44fe('0x1'))['db'][_0x44fe('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x44fe('0x3')](0x0);var events={'afterCreate':_0x44fe('0x4'),'afterUpdate':_0x44fe('0x5'),'afterDestroy':_0x44fe('0x6')};function emitEvent(_0x133a95){return function(_0x558686,_0x2d80f2,_0x10de16){CmContactEvents[_0x44fe('0x7')](_0x133a95+':'+_0x558686['id'],_0x558686);CmContactEvents[_0x44fe('0x7')](_0x133a95,_0x558686);_0x10de16(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x44fe('0x8')](e,emitEvent(event));}}module[_0x44fe('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 8541131..6db2286 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 _0x7161=['api','request-promise','path','rimraf','./cmContact.attributes','exports','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','catch','Campaign','\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','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','always','List\x20not\x20found','destroy','VoiceQueueId','CampaignId','push','info','lodash'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x7161,0x87));var _0x1716=function(_0x21131f,_0x504bbb){_0x21131f=_0x21131f-0x0;var _0x1b58d5=_0x7161[_0x21131f];return _0x1b58d5;};'use strict';var _=require(_0x1716('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1716('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1716('0x2'));var fs=require('fs');var path=require(_0x1716('0x3'));var rimraf=require(_0x1716('0x4'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0x1716('0x5'));module[_0x1716('0x6')]=function(_0x341cfc,_0x570bc3){return _0x341cfc['define']('CmContact',attributes,{'tableName':_0x1716('0x7'),'paranoid':!![],'indexes':[{'name':_0x1716('0x8'),'fields':[_0x1716('0x8')]},{'name':_0x1716('0x9'),'fields':[_0x1716('0xa'),_0x1716('0xb'),_0x1716('0x8'),_0x1716('0xc'),_0x1716('0xd'),'email'],'type':_0x1716('0xe')}],'timestamps':!![],'charset':_0x1716('0xf'),'collate':_0x1716('0x10'),'hooks':{'afterCreate':function(_0x3faf68,_0x189b49,_0x3566a1){var _0x53cceb=_0x341cfc[_0x1716('0x11')];var _0x369725=_0x3faf68[_0x1716('0x12')]({'plain':!![]});function _0x29d37a(){return function(_0x2808f6){logger[_0x1716('0x13')]('cmContact',_0x1716('0x14'),util[_0x1716('0x15')](_0x2808f6,{'showHidden':![],'depth':null}));};}function _0x491563(_0x181a17,_0x1bc32e){var _0x49f499=_0x1bc32e[_0x1716('0x16')]?_0x1bc32e[_0x1716('0x16')]:moment()[_0x1716('0x17')](_0x1716('0x18'));return new BPromise(function(_0x5ecb52,_0x541d54){if(_[_0x1716('0x19')](_0x1bc32e[_0x1716('0x1a')])){_0x5ecb52({'ret':_0x49f499});}else{_0x53cceb[_0x1716('0x1b')][_0x1716('0x1c')]({'where':{'id':_0x181a17['id']}})[_0x1716('0x1d')](function(_0x1764e8){if(!_['isNil'](_0x1764e8)){var _0x558d32=_0x1764e8[_0x1716('0x1a')];if(!_[_0x1716('0x19')](_0x558d32)){var _0x2a2371=shared[_0x1716('0x1e')];var _0x5104ca=_0x2a2371[_0x558d32];var _0x3fa611=_0x2a2371[_0x1bc32e['dialTimezone']];if(!_[_0x1716('0x19')](_0x5104ca)&&!_[_0x1716('0x19')](_0x3fa611)){var _0x17857f=_0x5104ca[_0x1716('0x1f')]-_0x3fa611[_0x1716('0x1f')];_0x49f499=_0x1bc32e[_0x1716('0x16')]?_0x1bc32e[_0x1716('0x16')]:moment();var _0x2c0916=moment(_0x49f499)[_0x1716('0x20')](_0x17857f,_0x1716('0x21'));_0x5ecb52({'ret':_0x2c0916['format'](_0x1716('0x18'))});}else _0x5ecb52({'ret':_0x49f499});}else _0x5ecb52({'ret':_0x49f499});}else{_0x5ecb52({'ret':_0x49f499});}});}});return 0xa;}var _0xf9c394=function(_0x1d471a){return new BPromise(function(_0x30ca8f,_0x4be403){_0x491563(_0x1d471a,_0x369725)[_0x1716('0x1d')](function(_0x52f131){_0x369725['scheduledat']=_0x52f131[_0x1716('0x22')];_0x53cceb['CmHopper'][_0x1716('0x1c')]({'where':{'phone':_0x369725['phone'],'VoiceQueueId':_0x1d471a['id']}})[_0x1716('0x1d')](function(_0x24199e){if(!_[_0x1716('0x19')](_0x24199e)){throw new Error(_0x1716('0x23')+_0x369725['phone']+_0x1716('0x24')+_0x1d471a['id']);}return _0x53cceb[_0x1716('0x25')][_0x1716('0x26')]({'phone':_0x369725[_0x1716('0x8')],'ContactId':_0x369725['id'],'ListId':_0x369725[_0x1716('0x27')],'priority':_0x369725[_0x1716('0x28')]?_0x369725[_0x1716('0x28')]:0x2,'scheduledat':_0x369725[_0x1716('0x16')]?_0x369725['scheduledat']:moment()[_0x1716('0x17')](_0x1716('0x18')),'callback':_0x369725['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x369725[_0x1716('0x29')]?_0x369725[_0x1716('0x29')]:undefined,'callbackat':_0x369725[_0x1716('0x29')]?moment()[_0x1716('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1d471a['id']});})['catch'](function(_0x5e5cc9){_0x4be403(_0x5e5cc9);});});});};var _0x4d6245=function(_0x2e14e9){return new BPromise(function(_0x487088,_0x6b9f9b){_0x491563(_0x2e14e9,_0x369725)[_0x1716('0x1d')](function(_0x4b5bb6){_0x369725[_0x1716('0x16')]=_0x4b5bb6[_0x1716('0x22')];_0x53cceb[_0x1716('0x25')][_0x1716('0x1c')]({'where':{'phone':_0x369725['phone'],'VoiceQueueId':_0x2e14e9['id']}})[_0x1716('0x1d')](function(_0x1ca631){if(!_[_0x1716('0x19')](_0x1ca631)){throw new Error('cmContact,\x20afterCreate\x20'+_0x369725[_0x1716('0x8')]+_0x1716('0x2a')+_0x2e14e9['id']);}return _0x53cceb[_0x1716('0x2b')]['findOne']({'where':{'calleridnum':_0x369725[_0x1716('0x8')],'VoiceQueueId':_0x2e14e9['id']}});})[_0x1716('0x1d')](function(_0x30dda0){if(!_['isNil'](_0x30dda0)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x369725[_0x1716('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x2e14e9['id']);}return _0x53cceb['CmHopper']['create']({'phone':_0x369725[_0x1716('0x8')],'ContactId':_0x369725['id'],'ListId':_0x369725[_0x1716('0x27')],'priority':_0x369725['priority']?_0x369725[_0x1716('0x28')]:0x2,'scheduledat':_0x369725[_0x1716('0x16')]?_0x369725[_0x1716('0x16')]:moment()[_0x1716('0x17')](_0x1716('0x18')),'callback':_0x369725[_0x1716('0x29')]?!![]:![],'callbackuniqueid':_0x369725[_0x1716('0x29')]?_0x369725[_0x1716('0x29')]:undefined,'callbackat':_0x369725[_0x1716('0x29')]?moment()['format'](_0x1716('0x18')):undefined,'VoiceQueueId':_0x2e14e9['id']});})[_0x1716('0x2c')](function(_0x4d6973){_0x6b9f9b(_0x4d6973);});});});};function _0x44cb35(){return function(_0x5ba0d6){logger['error']('cmContact',_0x1716('0x14'),util['inspect'](_0x5ba0d6,{'showHidden':![],'depth':null}));};}function _0x335dfd(_0x49cbc4,_0x1b1429){var _0x158b2a=_0x1b1429[_0x1716('0x16')]?_0x1b1429['scheduledat']:moment()[_0x1716('0x17')](_0x1716('0x18'));return new BPromise(function(_0x404d2d,_0x5a6c99){if(_['isNil'](_0x1b1429['dialTimezone'])){_0x404d2d({'ret':_0x158b2a});}else{_0x53cceb[_0x1716('0x2d')][_0x1716('0x1c')]({'where':{'id':_0x49cbc4['id']}})['then'](function(_0x1e14ba){if(!_[_0x1716('0x19')](_0x1e14ba)){var _0x2f521a=_0x1e14ba[_0x1716('0x1a')];if(!_[_0x1716('0x19')](_0x2f521a)){var _0x376649=shared['timezones'];var _0x51a4b7=_0x376649[_0x2f521a];var _0x42bc58=_0x376649[_0x1b1429[_0x1716('0x1a')]];if(!_[_0x1716('0x19')](_0x51a4b7)&&!_['isNil'](_0x42bc58)){var _0x113635=_0x51a4b7[_0x1716('0x1f')]-_0x42bc58[_0x1716('0x1f')];_0x158b2a=_0x1b1429[_0x1716('0x16')]?_0x1b1429[_0x1716('0x16')]:moment();var _0x17e581=moment(_0x158b2a)[_0x1716('0x20')](_0x113635,_0x1716('0x21'));_0x404d2d({'ret':_0x17e581[_0x1716('0x17')](_0x1716('0x18'))});}else _0x404d2d({'ret':_0x158b2a});}else _0x404d2d({'ret':_0x158b2a});}else{_0x404d2d({'ret':_0x158b2a});}});}});return 0xa;}var _0x1463aa=function(_0x1e541e){return new BPromise(function(_0x355726,_0x4377cb){_0x335dfd(_0x1e541e,_0x369725)[_0x1716('0x1d')](function(_0x5af26f){_0x369725[_0x1716('0x16')]=_0x5af26f[_0x1716('0x22')];_0x53cceb['CmHopper'][_0x1716('0x1c')]({'where':{'phone':_0x369725[_0x1716('0x8')],'CampaignId':_0x1e541e['id']}})['then'](function(_0x1b5592){if(!_[_0x1716('0x19')](_0x1b5592)){throw new Error(_0x1716('0x23')+_0x369725['phone']+_0x1716('0x2e')+_0x1e541e['id']);}return _0x53cceb[_0x1716('0x25')][_0x1716('0x26')]({'phone':_0x369725[_0x1716('0x8')],'ContactId':_0x369725['id'],'ListId':_0x369725[_0x1716('0x27')],'priority':_0x369725['priority']?_0x369725[_0x1716('0x28')]:0x2,'scheduledat':_0x369725[_0x1716('0x16')]?_0x369725[_0x1716('0x16')]:moment()['format'](_0x1716('0x18')),'callback':_0x369725[_0x1716('0x29')]?!![]:![],'callbackuniqueid':_0x369725[_0x1716('0x29')]?_0x369725[_0x1716('0x29')]:undefined,'callbackat':_0x369725[_0x1716('0x29')]?moment()[_0x1716('0x17')](_0x1716('0x18')):undefined,'CampaignId':_0x1e541e['id']});})['catch'](function(_0x3db35f){_0x4377cb(_0x3db35f);});});});};var _0x5d98fc=function(_0x11c13f){return new BPromise(function(_0x29f1d5,_0x29685c){_0x335dfd(_0x11c13f,_0x369725)['then'](function(_0x18c247){_0x369725[_0x1716('0x16')]=_0x18c247['ret'];_0x53cceb['CmHopper']['findOne']({'where':{'phone':_0x369725['phone'],'CampaignId':_0x11c13f['id']}})[_0x1716('0x1d')](function(_0x41e847){if(!_[_0x1716('0x19')](_0x41e847)){throw new Error(_0x1716('0x23')+_0x369725[_0x1716('0x8')]+_0x1716('0x2f')+_0x11c13f['id']);}return _0x53cceb[_0x1716('0x2b')]['findOne']({'where':{'calleridnum':_0x369725[_0x1716('0x8')],'CampaignId':_0x11c13f['id']}});})['then'](function(_0x31e272){if(!_[_0x1716('0x19')](_0x31e272)){throw new Error(_0x1716('0x30')+_0x369725[_0x1716('0x8')]+_0x1716('0x31')+_0x11c13f['id']);}return _0x53cceb[_0x1716('0x25')][_0x1716('0x26')]({'phone':_0x369725['phone'],'ContactId':_0x369725['id'],'ListId':_0x369725[_0x1716('0x27')],'priority':_0x369725[_0x1716('0x28')]?_0x369725['priority']:0x2,'scheduledat':_0x369725[_0x1716('0x16')]?_0x369725[_0x1716('0x16')]:moment()[_0x1716('0x17')](_0x1716('0x18')),'callback':_0x369725[_0x1716('0x29')]?!![]:![],'callbackuniqueid':_0x369725[_0x1716('0x29')]?_0x369725[_0x1716('0x29')]:undefined,'callbackat':_0x369725[_0x1716('0x29')]?moment()[_0x1716('0x17')](_0x1716('0x18')):undefined,'CampaignId':_0x11c13f['id']});})['catch'](function(_0x3d27de){_0x29685c(_0x3d27de);});});});};if(_0x369725[_0x1716('0x27')]){_0x53cceb[_0x1716('0x1b')][_0x1716('0x32')]({'where':{'type':_0x1716('0x33')},'attributes':['id',_0x1716('0x34'),_0x1716('0x1a')],'include':[{'model':_0x53cceb[_0x1716('0x35')],'as':_0x1716('0x36'),'where':{'id':_0x369725['ListId']}}]})[_0x1716('0x1d')](function(_0x50accd){if(_0x50accd){var _0x21a991=[];for(var _0x5ab0ee=0x0,_0x1ea45c;_0x5ab0ee<_0x50accd[_0x1716('0x37')];_0x5ab0ee+=0x1){_0x1ea45c=_0x50accd[_0x5ab0ee]['get']({'plain':!![]});switch(_0x1ea45c[_0x1716('0x34')]){case'always':_0x4d6245(_0x1ea45c)['catch'](_0x29d37a());break;case _0x1716('0x38'):_0xf9c394(_0x1ea45c)['catch'](_0x29d37a());break;default:_0x335dfd(_0x1ea45c,_0x369725)['then'](function(_0x3edbc6){_0x369725['scheduledat']=_0x3edbc6['ret'];_0x53cceb[_0x1716('0x25')][_0x1716('0x26')]({'phone':_0x369725['phone'],'ContactId':_0x369725['id'],'ListId':_0x369725['ListId'],'scheduledat':_0x369725['scheduledat']?_0x369725[_0x1716('0x16')]:moment()['format'](_0x1716('0x18')),'priority':_0x369725[_0x1716('0x28')]?_0x369725[_0x1716('0x28')]:0x2,'callback':_0x369725[_0x1716('0x29')]?!![]:![],'callbackuniqueid':_0x369725[_0x1716('0x29')]?_0x369725[_0x1716('0x29')]:undefined,'callbackat':_0x369725['callbackUniqueid']?moment()['format'](_0x1716('0x18')):undefined,'VoiceQueueId':_0x1ea45c['id']})['catch'](_0x29d37a());});}}}})['then'](function(){return _0x53cceb['VoiceQueue'][_0x1716('0x32')]({'where':{'type':_0x1716('0x33')},'attributes':['id'],'include':[{'model':_0x53cceb[_0x1716('0x35')],'as':_0x1716('0x39'),'where':{'id':_0x369725[_0x1716('0x27')]}}]})[_0x1716('0x1d')](function(_0x51513c){if(_0x51513c){var _0x15c73d=[];for(var _0x581906=0x0,_0x1dd622;_0x581906<_0x51513c[_0x1716('0x37')];_0x581906+=0x1){_0x1dd622=_0x51513c[_0x581906][_0x1716('0x12')]({'plain':!![]});_0x53cceb[_0x1716('0x3a')]['create']({'phone':_0x369725[_0x1716('0x8')],'ContactId':_0x369725['id'],'ListId':_0x369725[_0x1716('0x27')],'VoiceQueueId':_0x1dd622['id']})['catch'](function(_0x309862){logger[_0x1716('0x13')](_0x1716('0x3b'),_0x1716('0x14'),_0x309862[_0x1716('0x3c')]);});}}});})[_0x1716('0x1d')](function(){return _0x53cceb[_0x1716('0x2d')][_0x1716('0x32')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x53cceb['CmList'],'as':'Lists','where':{'id':_0x369725[_0x1716('0x27')]}}]})[_0x1716('0x1d')](function(_0x341931){if(_0x341931){var _0xf93d2d=[];for(var _0x4d3772=0x0,_0xe4c5ba;_0x4d3772<_0x341931[_0x1716('0x37')];_0x4d3772+=0x1){_0xe4c5ba=_0x341931[_0x4d3772][_0x1716('0x12')]({'plain':!![]});switch(_0xe4c5ba[_0x1716('0x34')]){case _0x1716('0x3d'):_0x5d98fc(_0xe4c5ba)[_0x1716('0x2c')](_0x44cb35());break;case _0x1716('0x38'):_0x1463aa(_0xe4c5ba)[_0x1716('0x2c')](_0x44cb35());break;default:_0x53cceb[_0x1716('0x25')][_0x1716('0x26')]({'phone':_0x369725[_0x1716('0x8')],'ContactId':_0x369725['id'],'ListId':_0x369725[_0x1716('0x27')],'scheduledat':_0x369725[_0x1716('0x16')]?_0x369725['scheduledat']:moment()[_0x1716('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x369725[_0x1716('0x28')]?_0x369725['priority']:0x2,'callback':_0x369725['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x369725[_0x1716('0x29')]?_0x369725['callbackUniqueid']:undefined,'callbackat':_0x369725[_0x1716('0x29')]?moment()[_0x1716('0x17')](_0x1716('0x18')):undefined,'CampaignId':_0xe4c5ba['id']})[_0x1716('0x2c')](_0x44cb35());}}}});})[_0x1716('0x1d')](function(){return _0x53cceb[_0x1716('0x2d')][_0x1716('0x32')]({'attributes':['id'],'include':[{'model':_0x53cceb['CmList'],'as':_0x1716('0x39'),'where':{'id':_0x369725[_0x1716('0x27')]}}]})['then'](function(_0x44ebc5){if(_0x44ebc5){var _0x5f504d=[];for(var _0x34171d=0x0,_0x19c409;_0x34171d<_0x44ebc5[_0x1716('0x37')];_0x34171d+=0x1){_0x19c409=_0x44ebc5[_0x34171d][_0x1716('0x12')]({'plain':!![]});_0x53cceb[_0x1716('0x3a')][_0x1716('0x26')]({'phone':_0x369725[_0x1716('0x8')],'ContactId':_0x369725['id'],'ListId':_0x369725[_0x1716('0x27')],'CampaignId':_0x19c409['id']})['catch'](function(_0x25b6f7){logger[_0x1716('0x13')](_0x1716('0x3b'),_0x1716('0x14'),_0x25b6f7[_0x1716('0x3c')]);});}}});})[_0x1716('0x1d')](function(){_0x3566a1();})[_0x1716('0x2c')](function(_0x33f174){logger[_0x1716('0x13')]('cmContact,\x20%s,\x20%s',_0x1716('0x14'),_0x33f174[_0x1716('0x3c')]);_0x3566a1(_0x33f174);});}else{_0x3566a1(new Error(_0x1716('0x3e')));}},'afterDestroy':function(_0x546ba4,_0x181a7d,_0x2f1cc1){var _0x24a8cc=_0x341cfc[_0x1716('0x11')];var _0x2a9209=_0x546ba4[_0x1716('0x12')]({'plain':!![]});return _0x24a8cc[_0x1716('0x25')][_0x1716('0x32')]({'raw':!![],'where':{'ListId':_0x2a9209[_0x1716('0x27')],'ContactId':_0x2a9209['id']}})[_0x1716('0x1d')](function(_0x12dfef){if(!_['isEmpty'](_0x12dfef)){var _0x1dc26d=[];for(var _0x3b8a5e=0x0;_0x3b8a5e<_0x12dfef[_0x1716('0x37')];_0x3b8a5e+=0x1){var _0x5c1ebc=_0x24a8cc[_0x1716('0x25')][_0x1716('0x3f')]({'where':{'ListId':_0x12dfef[_0x3b8a5e]['ListId'],'ContactId':_0x12dfef[_0x3b8a5e]['ContactId'],'VoiceQueueId':_0x12dfef[_0x3b8a5e][_0x1716('0x40')],'CampaignId':_0x12dfef[_0x3b8a5e][_0x1716('0x41')]}});_0x1dc26d[_0x1716('0x42')](_0x5c1ebc);}return BPromise['all'](_0x1dc26d);}})[_0x1716('0x1d')](function(_0x59932d){logger[_0x1716('0x43')]('[CmContact][afterDestroy][Succesfull]',util[_0x1716('0x15')](_0x59932d,{'showHidden':![],'depth':null}));_0x2f1cc1();})[_0x1716('0x2c')](function(_0x432e42){logger[_0x1716('0x13')]('[CmContact][afterDestroy][Error]',util[_0x1716('0x15')](_0x432e42,{'showHidden':![],'depth':null}));_0x2f1cc1(_0x432e42);});}}});}; \ No newline at end of file +var _0xcb7e=['[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','fti_cm_contacts','firstName','phone','email','FULLTEXT','utf8mb4_unicode_ci','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','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','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always','cmContact,\x20%s,\x20%s','message','Campaign','onlyIfOpen','BlackLists','CmHopperBlack','models','destroy','ContactId','VoiceQueueId','all','info'];(function(_0x537c82,_0x1b4bc4){var _0x3f322f=function(_0x2eaef5){while(--_0x2eaef5){_0x537c82['push'](_0x537c82['shift']());}};_0x3f322f(++_0x1b4bc4);}(_0xcb7e,0x1b2));var _0xecb7=function(_0x3c747c,_0x2f944e){_0x3c747c=_0x3c747c-0x0;var _0xc6a3d5=_0xcb7e[_0x3c747c];return _0xc6a3d5;};'use strict';var _=require(_0xecb7('0x0'));var util=require('util');var logger=require(_0xecb7('0x1'))('api');var moment=require(_0xecb7('0x2'));var BPromise=require(_0xecb7('0x3'));var rp=require(_0xecb7('0x4'));var fs=require('fs');var path=require(_0xecb7('0x5'));var rimraf=require(_0xecb7('0x6'));var config=require(_0xecb7('0x7'));var shared=require(_0xecb7('0x8'));var attributes=require(_0xecb7('0x9'));module[_0xecb7('0xa')]=function(_0x4583d2,_0x2dc860){return _0x4583d2[_0xecb7('0xb')]('CmContact',attributes,{'tableName':_0xecb7('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0xecb7('0xd'),'fields':[_0xecb7('0xe'),'lastName',_0xecb7('0xf'),'mobile','fax',_0xecb7('0x10')],'type':_0xecb7('0x11')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xecb7('0x12'),'hooks':{'afterCreate':function(_0x3fa2b3,_0x22233c,_0x298b8d){var _0x5ab252=_0x4583d2['models'];var _0xad4fdf=_0x3fa2b3['get']({'plain':!![]});function _0x43d85f(){return function(_0x5a9651){logger[_0xecb7('0x13')](_0xecb7('0x14'),_0xecb7('0x15'),util[_0xecb7('0x16')](_0x5a9651,{'showHidden':![],'depth':null}));};}function _0x2dcf9c(_0x3b07f3,_0x2f5909){var _0x28455a=_0x2f5909['scheduledat']?_0x2f5909[_0xecb7('0x17')]:moment()[_0xecb7('0x18')](_0xecb7('0x19'));return new BPromise(function(_0xeaeacf,_0x70024a){if(_[_0xecb7('0x1a')](_0x2f5909['dialTimezone'])){_0xeaeacf({'ret':_0x28455a});}else{_0x5ab252[_0xecb7('0x1b')][_0xecb7('0x1c')]({'where':{'id':_0x3b07f3['id']}})[_0xecb7('0x1d')](function(_0xa7ad68){if(!_[_0xecb7('0x1a')](_0xa7ad68)){var _0x2279e8=_0xa7ad68[_0xecb7('0x1e')];if(!_[_0xecb7('0x1a')](_0x2279e8)){var _0x1ac328=shared[_0xecb7('0x1f')];var _0x4d9126=_0x1ac328[_0x2279e8];var _0x23abdc=_0x1ac328[_0x2f5909[_0xecb7('0x1e')]];if(!_[_0xecb7('0x1a')](_0x4d9126)&&!_[_0xecb7('0x1a')](_0x23abdc)){var _0x1ea79f=_0x4d9126[_0xecb7('0x20')]-_0x23abdc[_0xecb7('0x20')];_0x28455a=_0x2f5909[_0xecb7('0x17')]?_0x2f5909[_0xecb7('0x17')]:moment();var _0x7ca534=moment(_0x28455a)[_0xecb7('0x21')](_0x1ea79f,_0xecb7('0x22'));_0xeaeacf({'ret':_0x7ca534[_0xecb7('0x18')](_0xecb7('0x19'))});}else _0xeaeacf({'ret':_0x28455a});}else _0xeaeacf({'ret':_0x28455a});}else{_0xeaeacf({'ret':_0x28455a});}});}});return 0xa;}var _0x30e1ae=function(_0x3985ad){return new BPromise(function(_0x2eb37a,_0x3a1ca4){_0x2dcf9c(_0x3985ad,_0xad4fdf)[_0xecb7('0x1d')](function(_0x2d75eb){_0xad4fdf[_0xecb7('0x17')]=_0x2d75eb[_0xecb7('0x23')];_0x5ab252[_0xecb7('0x24')][_0xecb7('0x1c')]({'where':{'phone':_0xad4fdf[_0xecb7('0xf')],'VoiceQueueId':_0x3985ad['id']}})[_0xecb7('0x1d')](function(_0x33e863){if(!_['isNil'](_0x33e863)){throw new Error(_0xecb7('0x25')+_0xad4fdf[_0xecb7('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x3985ad['id']);}return _0x5ab252[_0xecb7('0x24')]['create']({'phone':_0xad4fdf['phone'],'ContactId':_0xad4fdf['id'],'ListId':_0xad4fdf['ListId'],'priority':_0xad4fdf[_0xecb7('0x26')]?_0xad4fdf['priority']:0x2,'scheduledat':_0xad4fdf[_0xecb7('0x17')]?_0xad4fdf[_0xecb7('0x17')]:moment()[_0xecb7('0x18')](_0xecb7('0x19')),'callback':_0xad4fdf[_0xecb7('0x27')]?!![]:![],'callbackuniqueid':_0xad4fdf[_0xecb7('0x27')]?_0xad4fdf['callbackUniqueid']:undefined,'callbackat':_0xad4fdf[_0xecb7('0x27')]?moment()[_0xecb7('0x18')](_0xecb7('0x19')):undefined,'VoiceQueueId':_0x3985ad['id']});})[_0xecb7('0x28')](function(_0x53b825){_0x3a1ca4(_0x53b825);});});});};var _0x533b23=function(_0x408c0f){return new BPromise(function(_0x3b9d2c,_0x1a26d5){_0x2dcf9c(_0x408c0f,_0xad4fdf)['then'](function(_0x58f785){_0xad4fdf['scheduledat']=_0x58f785[_0xecb7('0x23')];_0x5ab252[_0xecb7('0x24')]['findOne']({'where':{'phone':_0xad4fdf[_0xecb7('0xf')],'VoiceQueueId':_0x408c0f['id']}})[_0xecb7('0x1d')](function(_0x27ab8b){if(!_[_0xecb7('0x1a')](_0x27ab8b)){throw new Error(_0xecb7('0x25')+_0xad4fdf[_0xecb7('0xf')]+_0xecb7('0x29')+_0x408c0f['id']);}return _0x5ab252['CmHopperFinal'][_0xecb7('0x1c')]({'where':{'calleridnum':_0xad4fdf[_0xecb7('0xf')],'VoiceQueueId':_0x408c0f['id']}});})[_0xecb7('0x1d')](function(_0x10ce62){if(!_[_0xecb7('0x1a')](_0x10ce62)){throw new Error(_0xecb7('0x2a')+_0xad4fdf['phone']+_0xecb7('0x2b')+_0x408c0f['id']);}return _0x5ab252[_0xecb7('0x24')][_0xecb7('0x2c')]({'phone':_0xad4fdf[_0xecb7('0xf')],'ContactId':_0xad4fdf['id'],'ListId':_0xad4fdf['ListId'],'priority':_0xad4fdf[_0xecb7('0x26')]?_0xad4fdf[_0xecb7('0x26')]:0x2,'scheduledat':_0xad4fdf[_0xecb7('0x17')]?_0xad4fdf[_0xecb7('0x17')]:moment()[_0xecb7('0x18')](_0xecb7('0x19')),'callback':_0xad4fdf[_0xecb7('0x27')]?!![]:![],'callbackuniqueid':_0xad4fdf['callbackUniqueid']?_0xad4fdf[_0xecb7('0x27')]:undefined,'callbackat':_0xad4fdf['callbackUniqueid']?moment()[_0xecb7('0x18')](_0xecb7('0x19')):undefined,'VoiceQueueId':_0x408c0f['id']});})[_0xecb7('0x28')](function(_0x334860){_0x1a26d5(_0x334860);});});});};function _0x197bcc(){return function(_0x4d28be){logger[_0xecb7('0x13')](_0xecb7('0x14'),_0xecb7('0x15'),util[_0xecb7('0x16')](_0x4d28be,{'showHidden':![],'depth':null}));};}function _0x2002e9(_0x1b802a,_0x2515c4){var _0x258653=_0x2515c4['scheduledat']?_0x2515c4['scheduledat']:moment()[_0xecb7('0x18')](_0xecb7('0x19'));return new BPromise(function(_0x176d3a,_0x3f13a4){if(_[_0xecb7('0x1a')](_0x2515c4['dialTimezone'])){_0x176d3a({'ret':_0x258653});}else{_0x5ab252['Campaign']['findOne']({'where':{'id':_0x1b802a['id']}})['then'](function(_0xaf3a45){if(!_['isNil'](_0xaf3a45)){var _0x224d36=_0xaf3a45[_0xecb7('0x1e')];if(!_[_0xecb7('0x1a')](_0x224d36)){var _0x6c5774=shared[_0xecb7('0x1f')];var _0x520449=_0x6c5774[_0x224d36];var _0x49082a=_0x6c5774[_0x2515c4['dialTimezone']];if(!_[_0xecb7('0x1a')](_0x520449)&&!_[_0xecb7('0x1a')](_0x49082a)){var _0x40fc10=_0x520449[_0xecb7('0x20')]-_0x49082a[_0xecb7('0x20')];_0x258653=_0x2515c4[_0xecb7('0x17')]?_0x2515c4[_0xecb7('0x17')]:moment();var _0xa4a16a=moment(_0x258653)[_0xecb7('0x21')](_0x40fc10,'minutes');_0x176d3a({'ret':_0xa4a16a[_0xecb7('0x18')](_0xecb7('0x19'))});}else _0x176d3a({'ret':_0x258653});}else _0x176d3a({'ret':_0x258653});}else{_0x176d3a({'ret':_0x258653});}});}});return 0xa;}var _0x1809e4=function(_0x39e4cd){return new BPromise(function(_0x4a0d30,_0x441618){_0x2002e9(_0x39e4cd,_0xad4fdf)[_0xecb7('0x1d')](function(_0x44a59d){_0xad4fdf[_0xecb7('0x17')]=_0x44a59d[_0xecb7('0x23')];_0x5ab252[_0xecb7('0x24')][_0xecb7('0x1c')]({'where':{'phone':_0xad4fdf['phone'],'CampaignId':_0x39e4cd['id']}})['then'](function(_0x22463b){if(!_[_0xecb7('0x1a')](_0x22463b)){throw new Error(_0xecb7('0x25')+_0xad4fdf[_0xecb7('0xf')]+_0xecb7('0x2d')+_0x39e4cd['id']);}return _0x5ab252[_0xecb7('0x24')][_0xecb7('0x2c')]({'phone':_0xad4fdf['phone'],'ContactId':_0xad4fdf['id'],'ListId':_0xad4fdf[_0xecb7('0x2e')],'priority':_0xad4fdf[_0xecb7('0x26')]?_0xad4fdf['priority']:0x2,'scheduledat':_0xad4fdf[_0xecb7('0x17')]?_0xad4fdf['scheduledat']:moment()['format'](_0xecb7('0x19')),'callback':_0xad4fdf[_0xecb7('0x27')]?!![]:![],'callbackuniqueid':_0xad4fdf[_0xecb7('0x27')]?_0xad4fdf[_0xecb7('0x27')]:undefined,'callbackat':_0xad4fdf[_0xecb7('0x27')]?moment()[_0xecb7('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x39e4cd['id']});})[_0xecb7('0x28')](function(_0xd27895){_0x441618(_0xd27895);});});});};var _0xd8d49e=function(_0x557d93){return new BPromise(function(_0x5dfdc8,_0x106efd){_0x2002e9(_0x557d93,_0xad4fdf)[_0xecb7('0x1d')](function(_0x33f99a){_0xad4fdf['scheduledat']=_0x33f99a['ret'];_0x5ab252[_0xecb7('0x24')]['findOne']({'where':{'phone':_0xad4fdf['phone'],'CampaignId':_0x557d93['id']}})[_0xecb7('0x1d')](function(_0xa28e16){if(!_[_0xecb7('0x1a')](_0xa28e16)){throw new Error(_0xecb7('0x25')+_0xad4fdf[_0xecb7('0xf')]+_0xecb7('0x2f')+_0x557d93['id']);}return _0x5ab252[_0xecb7('0x30')][_0xecb7('0x1c')]({'where':{'calleridnum':_0xad4fdf[_0xecb7('0xf')],'CampaignId':_0x557d93['id']}});})[_0xecb7('0x1d')](function(_0x33987a){if(!_[_0xecb7('0x1a')](_0x33987a)){throw new Error('cmContact,\x20afterCreate,\x20'+_0xad4fdf[_0xecb7('0xf')]+_0xecb7('0x31')+_0x557d93['id']);}return _0x5ab252[_0xecb7('0x24')][_0xecb7('0x2c')]({'phone':_0xad4fdf[_0xecb7('0xf')],'ContactId':_0xad4fdf['id'],'ListId':_0xad4fdf[_0xecb7('0x2e')],'priority':_0xad4fdf[_0xecb7('0x26')]?_0xad4fdf[_0xecb7('0x26')]:0x2,'scheduledat':_0xad4fdf[_0xecb7('0x17')]?_0xad4fdf['scheduledat']:moment()[_0xecb7('0x18')](_0xecb7('0x19')),'callback':_0xad4fdf[_0xecb7('0x27')]?!![]:![],'callbackuniqueid':_0xad4fdf[_0xecb7('0x27')]?_0xad4fdf[_0xecb7('0x27')]:undefined,'callbackat':_0xad4fdf[_0xecb7('0x27')]?moment()[_0xecb7('0x18')](_0xecb7('0x19')):undefined,'CampaignId':_0x557d93['id']});})[_0xecb7('0x28')](function(_0x28799f){_0x106efd(_0x28799f);});});});};if(_0xad4fdf[_0xecb7('0x2e')]){_0x5ab252[_0xecb7('0x1b')][_0xecb7('0x32')]({'where':{'type':_0xecb7('0x33')},'attributes':['id',_0xecb7('0x34'),_0xecb7('0x1e')],'include':[{'model':_0x5ab252[_0xecb7('0x35')],'as':_0xecb7('0x36'),'where':{'id':_0xad4fdf[_0xecb7('0x2e')]}}]})['then'](function(_0x2957a2){if(_0x2957a2){var _0x19b9c9=[];for(var _0x2ec6ab=0x0,_0x3b6081;_0x2ec6ab<_0x2957a2[_0xecb7('0x37')];_0x2ec6ab+=0x1){_0x3b6081=_0x2957a2[_0x2ec6ab][_0xecb7('0x38')]({'plain':!![]});switch(_0x3b6081[_0xecb7('0x34')]){case _0xecb7('0x39'):_0x533b23(_0x3b6081)['catch'](_0x43d85f());break;case'onlyIfOpen':_0x30e1ae(_0x3b6081)[_0xecb7('0x28')](_0x43d85f());break;default:_0x2002e9(_0x3b6081,_0xad4fdf)[_0xecb7('0x1d')](function(_0x12807c){_0xad4fdf['scheduledat']=_0x12807c[_0xecb7('0x23')];_0x5ab252[_0xecb7('0x24')][_0xecb7('0x2c')]({'phone':_0xad4fdf[_0xecb7('0xf')],'ContactId':_0xad4fdf['id'],'ListId':_0xad4fdf[_0xecb7('0x2e')],'scheduledat':_0xad4fdf[_0xecb7('0x17')]?_0xad4fdf[_0xecb7('0x17')]:moment()[_0xecb7('0x18')](_0xecb7('0x19')),'priority':_0xad4fdf[_0xecb7('0x26')]?_0xad4fdf['priority']:0x2,'callback':_0xad4fdf[_0xecb7('0x27')]?!![]:![],'callbackuniqueid':_0xad4fdf['callbackUniqueid']?_0xad4fdf['callbackUniqueid']:undefined,'callbackat':_0xad4fdf['callbackUniqueid']?moment()[_0xecb7('0x18')](_0xecb7('0x19')):undefined,'VoiceQueueId':_0x3b6081['id']})[_0xecb7('0x28')](_0x43d85f());});}}}})['then'](function(){return _0x5ab252['VoiceQueue'][_0xecb7('0x32')]({'where':{'type':_0xecb7('0x33')},'attributes':['id'],'include':[{'model':_0x5ab252[_0xecb7('0x35')],'as':'BlackLists','where':{'id':_0xad4fdf[_0xecb7('0x2e')]}}]})[_0xecb7('0x1d')](function(_0xacb9ff){if(_0xacb9ff){var _0x204f86=[];for(var _0x5c8871=0x0,_0x433613;_0x5c8871<_0xacb9ff['length'];_0x5c8871+=0x1){_0x433613=_0xacb9ff[_0x5c8871][_0xecb7('0x38')]({'plain':!![]});_0x5ab252['CmHopperBlack']['create']({'phone':_0xad4fdf['phone'],'ContactId':_0xad4fdf['id'],'ListId':_0xad4fdf[_0xecb7('0x2e')],'VoiceQueueId':_0x433613['id']})[_0xecb7('0x28')](function(_0x5b55f4){logger[_0xecb7('0x13')](_0xecb7('0x3a'),_0xecb7('0x15'),_0x5b55f4[_0xecb7('0x3b')]);});}}});})[_0xecb7('0x1d')](function(){return _0x5ab252[_0xecb7('0x3c')][_0xecb7('0x32')]({'attributes':['id',_0xecb7('0x34'),_0xecb7('0x1e')],'include':[{'model':_0x5ab252[_0xecb7('0x35')],'as':'Lists','where':{'id':_0xad4fdf['ListId']}}]})['then'](function(_0x384c8c){if(_0x384c8c){var _0x5acf18=[];for(var _0x27ae81=0x0,_0x4502c6;_0x27ae81<_0x384c8c[_0xecb7('0x37')];_0x27ae81+=0x1){_0x4502c6=_0x384c8c[_0x27ae81]['get']({'plain':!![]});switch(_0x4502c6['dialCheckDuplicateType']){case _0xecb7('0x39'):_0xd8d49e(_0x4502c6)[_0xecb7('0x28')](_0x197bcc());break;case _0xecb7('0x3d'):_0x1809e4(_0x4502c6)[_0xecb7('0x28')](_0x197bcc());break;default:_0x5ab252[_0xecb7('0x24')][_0xecb7('0x2c')]({'phone':_0xad4fdf[_0xecb7('0xf')],'ContactId':_0xad4fdf['id'],'ListId':_0xad4fdf['ListId'],'scheduledat':_0xad4fdf['scheduledat']?_0xad4fdf[_0xecb7('0x17')]:moment()[_0xecb7('0x18')](_0xecb7('0x19')),'priority':_0xad4fdf[_0xecb7('0x26')]?_0xad4fdf['priority']:0x2,'callback':_0xad4fdf[_0xecb7('0x27')]?!![]:![],'callbackuniqueid':_0xad4fdf['callbackUniqueid']?_0xad4fdf[_0xecb7('0x27')]:undefined,'callbackat':_0xad4fdf['callbackUniqueid']?moment()[_0xecb7('0x18')](_0xecb7('0x19')):undefined,'CampaignId':_0x4502c6['id']})[_0xecb7('0x28')](_0x197bcc());}}}});})[_0xecb7('0x1d')](function(){return _0x5ab252['Campaign'][_0xecb7('0x32')]({'attributes':['id'],'include':[{'model':_0x5ab252[_0xecb7('0x35')],'as':_0xecb7('0x3e'),'where':{'id':_0xad4fdf[_0xecb7('0x2e')]}}]})[_0xecb7('0x1d')](function(_0x3e80b9){if(_0x3e80b9){var _0x4928b4=[];for(var _0x42ddfa=0x0,_0x1f0116;_0x42ddfa<_0x3e80b9['length'];_0x42ddfa+=0x1){_0x1f0116=_0x3e80b9[_0x42ddfa][_0xecb7('0x38')]({'plain':!![]});_0x5ab252[_0xecb7('0x3f')]['create']({'phone':_0xad4fdf[_0xecb7('0xf')],'ContactId':_0xad4fdf['id'],'ListId':_0xad4fdf['ListId'],'CampaignId':_0x1f0116['id']})[_0xecb7('0x28')](function(_0x5817fa){logger['error'](_0xecb7('0x3a'),'afterCreate',_0x5817fa['message']);});}}});})[_0xecb7('0x1d')](function(){_0x298b8d();})[_0xecb7('0x28')](function(_0x4955bd){logger[_0xecb7('0x13')]('cmContact,\x20%s,\x20%s',_0xecb7('0x15'),_0x4955bd[_0xecb7('0x3b')]);_0x298b8d(_0x4955bd);});}else{_0x298b8d(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x4ff67f,_0x20cc03,_0x154471){var _0x3ab181=_0x4583d2[_0xecb7('0x40')];var _0xffcc12=_0x4ff67f['get']({'plain':!![]});return _0x3ab181['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0xffcc12[_0xecb7('0x2e')],'ContactId':_0xffcc12['id']}})[_0xecb7('0x1d')](function(_0x19d893){if(!_['isEmpty'](_0x19d893)){var _0x4859b7=[];for(var _0x4b9e3c=0x0;_0x4b9e3c<_0x19d893['length'];_0x4b9e3c+=0x1){var _0x2e056b=_0x3ab181['CmHopper'][_0xecb7('0x41')]({'where':{'ListId':_0x19d893[_0x4b9e3c][_0xecb7('0x2e')],'ContactId':_0x19d893[_0x4b9e3c][_0xecb7('0x42')],'VoiceQueueId':_0x19d893[_0x4b9e3c][_0xecb7('0x43')],'CampaignId':_0x19d893[_0x4b9e3c]['CampaignId']}});_0x4859b7['push'](_0x2e056b);}return BPromise[_0xecb7('0x44')](_0x4859b7);}})[_0xecb7('0x1d')](function(_0x472eb5){logger[_0xecb7('0x45')](_0xecb7('0x46'),util[_0xecb7('0x16')](_0x472eb5,{'showHidden':![],'depth':null}));_0x154471();})[_0xecb7('0x28')](function(_0x14ae82){logger[_0xecb7('0x13')](_0xecb7('0x47'),util['inspect'](_0x14ae82,{'showHidden':![],'depth':null}));_0x154471(_0x14ae82);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 9dc959f..89c1a0c 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 _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});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 respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\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(_0x45b873,_0x27e0fc){var _0x295400=function(_0x10d19f){while(--_0x10d19f){_0x45b873['push'](_0x45b873['shift']());}};_0x295400(++_0x27e0fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 e6164b4..5eb4f62 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 _0xfa12=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0x48a6e3,_0x473966){var _0x14e4a5=function(_0x501aae){while(--_0x501aae){_0x48a6e3['push'](_0x48a6e3['shift']());}};_0x14e4a5(++_0x473966);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x5c01d7,_0x172bd2){_0x5c01d7=_0x5c01d7-0x0;var _0x3fe1a7=_0xfa12[_0x5c01d7];return _0x3fe1a7;};'use strict';var Sequelize=require(_0x2fa1('0x0'));module[_0x2fa1('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x2fa1('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x2fa1('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2fa1('0x2')],'defaultValue':_0x2fa1('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x2fa1('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x37a4=['INTEGER','STRING','PHONE','sequelize'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x37a4,0xcb));var _0x437a=function(_0x55d5d0,_0x34bc2e){_0x55d5d0=_0x55d5d0-0x0;var _0x1d0bba=_0x37a4[_0x55d5d0];return _0x1d0bba;};'use strict';var Sequelize=require(_0x437a('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x437a('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x437a('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x437a('0x2')],'defaultValue':_0x437a('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'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 818937f..e7fa8e8 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 _0x5e3d=['zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','CmContactHasItem','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0x5e3d,0x193));var _0xd5e3=function(_0x24f554,_0x530aa2){_0x24f554=_0x24f554-0x0;var _0x3f9ec5=_0x5e3d[_0x24f554];return _0x3f9ec5;};'use strict';var emlformat=require(_0xd5e3('0x0'));var rimraf=require(_0xd5e3('0x1'));var zipdir=require(_0xd5e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5e3('0x3'));var moment=require(_0xd5e3('0x4'));var BPromise=require(_0xd5e3('0x5'));var Mustache=require('mustache');var util=require(_0xd5e3('0x6'));var path=require(_0xd5e3('0x7'));var sox=require('sox');var csv=require(_0xd5e3('0x8'));var ejs=require(_0xd5e3('0x9'));var fs=require('fs');var fs_extra=require(_0xd5e3('0xa'));var _=require(_0xd5e3('0xb'));var squel=require('squel');var crypto=require(_0xd5e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd5e3('0xd'));var toCsv=require(_0xd5e3('0x8'));var querystring=require(_0xd5e3('0xe'));var Papa=require('papaparse');var Redis=require(_0xd5e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd5e3('0x10'));var as=require(_0xd5e3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5e3('0x12'))('api');var utils=require(_0xd5e3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd5e3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cca13,_0x343bcf){_0x343bcf=_0x343bcf||0xcc;return function(_0x4bd9c1){if(_0x4bd9c1){return _0x5cca13['sendStatus'](_0x343bcf);}return _0x5cca13['status'](_0x343bcf)['end']();};}function respondWithResult(_0x25f5ee,_0x8ae7fe){_0x8ae7fe=_0x8ae7fe||0xc8;return function(_0x391114){if(_0x391114){return _0x25f5ee[_0xd5e3('0x15')](_0x8ae7fe)['json'](_0x391114);}};}function respondWithFilteredResult(_0x24a3c9,_0x4b03c6){return function(_0x569ced){if(_0x569ced){var _0x33e9df=typeof _0x4b03c6[_0xd5e3('0x16')]===_0xd5e3('0x17')&&typeof _0x4b03c6[_0xd5e3('0x18')]===_0xd5e3('0x17');var _0x1d6579=_0x569ced[_0xd5e3('0x19')];var _0x211b8c=_0x33e9df?0x0:_0x4b03c6[_0xd5e3('0x16')];var _0x3a824e=_0x33e9df?_0x569ced[_0xd5e3('0x19')]:_0x4b03c6[_0xd5e3('0x16')]+_0x4b03c6[_0xd5e3('0x18')];var _0x330369;if(_0x3a824e>=_0x1d6579){_0x3a824e=_0x1d6579;_0x330369=0xc8;}else{_0x330369=0xce;}_0x24a3c9[_0xd5e3('0x15')](_0x330369);return _0x24a3c9[_0xd5e3('0x1a')](_0xd5e3('0x1b'),_0x211b8c+'-'+_0x3a824e+'/'+_0x1d6579)['json'](_0x569ced);}return null;};}function patchUpdates(_0x437802){return function(_0xd2a0e3){try{jsonpatch[_0xd5e3('0x1c')](_0xd2a0e3,_0x437802,!![]);}catch(_0x55a911){return BPromise[_0xd5e3('0x1d')](_0x55a911);}return _0xd2a0e3['save']();};}function saveUpdates(_0x461581,_0x52c9fa){return function(_0x307590){if(_0x307590){return _0x307590[_0xd5e3('0x1e')](_0x461581)[_0xd5e3('0x1f')](function(_0xfe9a6d){return _0xfe9a6d;});}return null;};}function removeEntity(_0x580228,_0x403d87){return function(_0x4bf72c){if(_0x4bf72c){return _0x4bf72c[_0xd5e3('0x20')]()[_0xd5e3('0x1f')](function(){var _0x5c9528=_0x4bf72c[_0xd5e3('0x21')]({'plain':!![]});var _0x21aecb='CmContactHasItems';return db[_0xd5e3('0x22')][_0xd5e3('0x20')]({'where':{'type':_0x21aecb,'resourceId':_0x5c9528['id']}})[_0xd5e3('0x1f')](function(){return _0x4bf72c;});})[_0xd5e3('0x1f')](function(){_0x580228[_0xd5e3('0x15')](0xcc)[_0xd5e3('0x23')]();});}};}function handleEntityNotFound(_0x34d725,_0x171796){return function(_0x20d418){if(!_0x20d418){_0x34d725[_0xd5e3('0x24')](0x194);}return _0x20d418;};}function handleError(_0x13f57d,_0x5cc329){_0x5cc329=_0x5cc329||0x1f4;return function(_0x39d4ea){logger[_0xd5e3('0x25')](_0x39d4ea[_0xd5e3('0x26')]);if(_0x39d4ea[_0xd5e3('0x27')]){delete _0x39d4ea[_0xd5e3('0x27')];}_0x13f57d[_0xd5e3('0x15')](_0x5cc329)[_0xd5e3('0x28')](_0x39d4ea);};}exports[_0xd5e3('0x29')]=function(_0x4d4125,_0x20a8f9){var _0x16b270={},_0x581c8e={},_0x40c1b7={'count':0x0,'rows':[]};var _0x24da20=_[_0xd5e3('0x2a')](db[_0xd5e3('0x2b')]['rawAttributes'],function(_0x2e003d){return{'name':_0x2e003d[_0xd5e3('0x2c')],'type':_0x2e003d[_0xd5e3('0x2d')][_0xd5e3('0x2e')]};});_0x581c8e[_0xd5e3('0x2f')]=_['map'](_0x24da20,_0xd5e3('0x27'));_0x581c8e[_0xd5e3('0x30')]=_[_0xd5e3('0x31')](_0x4d4125[_0xd5e3('0x30')]);_0x581c8e[_0xd5e3('0x32')]=_[_0xd5e3('0x33')](_0x581c8e[_0xd5e3('0x2f')],_0x581c8e[_0xd5e3('0x30')]);_0x16b270[_0xd5e3('0x34')]=_[_0xd5e3('0x33')](_0x581c8e[_0xd5e3('0x2f')],qs[_0xd5e3('0x35')](_0x4d4125[_0xd5e3('0x30')][_0xd5e3('0x35')]));_0x16b270[_0xd5e3('0x34')]=_0x16b270['attributes'][_0xd5e3('0x36')]?_0x16b270[_0xd5e3('0x34')]:_0x581c8e[_0xd5e3('0x2f')];if(!_0x4d4125[_0xd5e3('0x30')]['hasOwnProperty'](_0xd5e3('0x37'))){_0x16b270[_0xd5e3('0x18')]=qs[_0xd5e3('0x18')](_0x4d4125[_0xd5e3('0x30')][_0xd5e3('0x18')]);_0x16b270['offset']=qs['offset'](_0x4d4125['query']['offset']);}_0x16b270[_0xd5e3('0x38')]=qs['sort'](_0x4d4125['query'][_0xd5e3('0x39')]);_0x16b270[_0xd5e3('0x3a')]=qs[_0xd5e3('0x32')](_['pick'](_0x4d4125[_0xd5e3('0x30')],_0x581c8e[_0xd5e3('0x32')]),_0x24da20);if(_0x4d4125[_0xd5e3('0x30')][_0xd5e3('0x3b')]){_0x16b270[_0xd5e3('0x3a')]=_[_0xd5e3('0x3c')](_0x16b270[_0xd5e3('0x3a')],{'$or':_[_0xd5e3('0x2a')](_0x24da20,function(_0x3cfc77){if(_0x3cfc77[_0xd5e3('0x2d')]!==_0xd5e3('0x3d')){var _0x3da2fe={};_0x3da2fe[_0x3cfc77['name']]={'$like':'%'+_0x4d4125[_0xd5e3('0x30')][_0xd5e3('0x3b')]+'%'};return _0x3da2fe;}})});}_0x16b270=_['merge']({},_0x16b270,_0x4d4125[_0xd5e3('0x3e')]);var _0x2f05b2={'where':_0x16b270['where']};return db[_0xd5e3('0x2b')]['count'](_0x2f05b2)[_0xd5e3('0x1f')](function(_0x448f78){_0x40c1b7['count']=_0x448f78;if(_0x4d4125[_0xd5e3('0x30')][_0xd5e3('0x3f')]){_0x16b270[_0xd5e3('0x40')]=[{'all':!![]}];}return db[_0xd5e3('0x2b')][_0xd5e3('0x41')](_0x16b270);})[_0xd5e3('0x1f')](function(_0x57e6d1){_0x40c1b7[_0xd5e3('0x42')]=_0x57e6d1;return _0x40c1b7;})[_0xd5e3('0x1f')](respondWithFilteredResult(_0x20a8f9,_0x16b270))['catch'](handleError(_0x20a8f9,null));};exports[_0xd5e3('0x43')]=function(_0x325562,_0x329e11){var _0x4dc295={'raw':!![],'where':{'id':_0x325562['params']['id']}},_0x57ac56={};_0x57ac56['model']=_[_0xd5e3('0x31')](db[_0xd5e3('0x2b')][_0xd5e3('0x44')]);_0x57ac56['query']=_[_0xd5e3('0x31')](_0x325562[_0xd5e3('0x30')]);_0x57ac56[_0xd5e3('0x32')]=_['intersection'](_0x57ac56[_0xd5e3('0x2f')],_0x57ac56[_0xd5e3('0x30')]);_0x4dc295['attributes']=_[_0xd5e3('0x33')](_0x57ac56['model'],qs[_0xd5e3('0x35')](_0x325562[_0xd5e3('0x30')][_0xd5e3('0x35')]));_0x4dc295[_0xd5e3('0x34')]=_0x4dc295[_0xd5e3('0x34')][_0xd5e3('0x36')]?_0x4dc295[_0xd5e3('0x34')]:_0x57ac56[_0xd5e3('0x2f')];if(_0x325562[_0xd5e3('0x30')][_0xd5e3('0x3f')]){_0x4dc295[_0xd5e3('0x40')]=[{'all':!![]}];}_0x4dc295=_['merge']({},_0x4dc295,_0x325562[_0xd5e3('0x3e')]);return db[_0xd5e3('0x2b')][_0xd5e3('0x45')](_0x4dc295)[_0xd5e3('0x1f')](handleEntityNotFound(_0x329e11,null))[_0xd5e3('0x1f')](respondWithResult(_0x329e11,null))[_0xd5e3('0x46')](handleError(_0x329e11,null));};exports[_0xd5e3('0x47')]=function(_0x7c9915,_0x1af06d){return db[_0xd5e3('0x2b')]['create'](_0x7c9915['body'],{})[_0xd5e3('0x1f')](function(_0x515cfa){var _0x5ef4d6=_0x7c9915[_0xd5e3('0x48')]['get']({'plain':!![]});if(!_0x5ef4d6)throw new Error(_0xd5e3('0x49'));if(_0x5ef4d6['role']==='user'){var _0x3d69ef=_0x515cfa[_0xd5e3('0x21')]({'plain':!![]});var _0x413867=_0xd5e3('0x4a');return db[_0xd5e3('0x4b')][_0xd5e3('0x45')]({'where':{'name':_0x413867,'userProfileId':_0x5ef4d6[_0xd5e3('0x4c')]},'raw':!![]})['then'](function(_0x4b3671){if(_0x4b3671&&_0x4b3671[_0xd5e3('0x4d')]===0x0){return db[_0xd5e3('0x22')][_0xd5e3('0x47')]({'name':_0x3d69ef['name'],'resourceId':_0x3d69ef['id'],'type':_0x4b3671['name'],'sectionId':_0x4b3671['id']},{})['then'](function(){return _0x515cfa;});}else{return _0x515cfa;}})[_0xd5e3('0x46')](function(_0x275abe){logger['error'](_0xd5e3('0x4e'),_0x275abe);throw _0x275abe;});}return _0x515cfa;})[_0xd5e3('0x1f')](respondWithResult(_0x1af06d,0xc9))[_0xd5e3('0x46')](handleError(_0x1af06d,null));};exports['update']=function(_0x125916,_0x2dd914){if(_0x125916[_0xd5e3('0x4f')]['id']){delete _0x125916[_0xd5e3('0x4f')]['id'];}return db[_0xd5e3('0x2b')][_0xd5e3('0x45')]({'where':{'id':_0x125916[_0xd5e3('0x50')]['id']}})['then'](handleEntityNotFound(_0x2dd914,null))[_0xd5e3('0x1f')](saveUpdates(_0x125916[_0xd5e3('0x4f')],null))['then'](respondWithResult(_0x2dd914,null))['catch'](handleError(_0x2dd914,null));};exports[_0xd5e3('0x20')]=function(_0x256252,_0x47ba04){return db[_0xd5e3('0x2b')][_0xd5e3('0x45')]({'where':{'id':_0x256252[_0xd5e3('0x50')]['id']}})['then'](handleEntityNotFound(_0x47ba04,null))['then'](removeEntity(_0x47ba04,null))[_0xd5e3('0x46')](handleError(_0x47ba04,null));}; \ No newline at end of file +var _0x5bce=['model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','filter','merge','includeAll','findAll','catch','show','params','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','get','UserProfileResource','stack','name','send','index','CmContactHasItem','rawAttributes','type','query','keys','filters','intersection'];(function(_0x32113d,_0x2e2936){var _0x4a9682=function(_0x35bec1){while(--_0x35bec1){_0x32113d['push'](_0x32113d['shift']());}};_0x4a9682(++_0x2e2936);}(_0x5bce,0xb6));var _0xe5bc=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x5bce[_0x4ae829];return _0x256b31;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe5bc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5bc('0x1'));var moment=require(_0xe5bc('0x2'));var BPromise=require(_0xe5bc('0x3'));var Mustache=require(_0xe5bc('0x4'));var util=require('util');var path=require(_0xe5bc('0x5'));var sox=require(_0xe5bc('0x6'));var csv=require('to-csv');var ejs=require(_0xe5bc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5bc('0x8'));var squel=require(_0xe5bc('0x9'));var crypto=require(_0xe5bc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe5bc('0xb'));var toCsv=require(_0xe5bc('0xc'));var querystring=require('querystring');var Papa=require(_0xe5bc('0xd'));var Redis=require('ioredis');var authService=require(_0xe5bc('0xe'));var qs=require(_0xe5bc('0xf'));var as=require(_0xe5bc('0x10'));var hardwareService=require(_0xe5bc('0x11'));var logger=require(_0xe5bc('0x12'))(_0xe5bc('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe5bc('0x14'));var db=require(_0xe5bc('0x15'))['db'];function respondWithStatusCode(_0x4433a9,_0x1789b6){_0x1789b6=_0x1789b6||0xcc;return function(_0xf8017e){if(_0xf8017e){return _0x4433a9[_0xe5bc('0x16')](_0x1789b6);}return _0x4433a9[_0xe5bc('0x17')](_0x1789b6)['end']();};}function respondWithResult(_0x5b3881,_0x661478){_0x661478=_0x661478||0xc8;return function(_0x2eeb41){if(_0x2eeb41){return _0x5b3881['status'](_0x661478)['json'](_0x2eeb41);}};}function respondWithFilteredResult(_0x3851ba,_0x47b405){return function(_0x4b2a0d){if(_0x4b2a0d){var _0x1c2b7a=typeof _0x47b405[_0xe5bc('0x18')]===_0xe5bc('0x19')&&typeof _0x47b405[_0xe5bc('0x1a')]==='undefined';var _0x3c4cf7=_0x4b2a0d['count'];var _0x543c53=_0x1c2b7a?0x0:_0x47b405[_0xe5bc('0x18')];var _0x5deac4=_0x1c2b7a?_0x4b2a0d[_0xe5bc('0x1b')]:_0x47b405[_0xe5bc('0x18')]+_0x47b405[_0xe5bc('0x1a')];var _0x34ebf9;if(_0x5deac4>=_0x3c4cf7){_0x5deac4=_0x3c4cf7;_0x34ebf9=0xc8;}else{_0x34ebf9=0xce;}_0x3851ba[_0xe5bc('0x17')](_0x34ebf9);return _0x3851ba[_0xe5bc('0x1c')](_0xe5bc('0x1d'),_0x543c53+'-'+_0x5deac4+'/'+_0x3c4cf7)[_0xe5bc('0x1e')](_0x4b2a0d);}return null;};}function patchUpdates(_0x523c4a){return function(_0xb97082){try{jsonpatch[_0xe5bc('0x1f')](_0xb97082,_0x523c4a,!![]);}catch(_0x2d2e1c){return BPromise[_0xe5bc('0x20')](_0x2d2e1c);}return _0xb97082['save']();};}function saveUpdates(_0x23c544,_0x475a26){return function(_0x19bf42){if(_0x19bf42){return _0x19bf42[_0xe5bc('0x21')](_0x23c544)['then'](function(_0x3fcc42){return _0x3fcc42;});}return null;};}function removeEntity(_0x20ada7,_0x5b8f4c){return function(_0x443c09){if(_0x443c09){return _0x443c09[_0xe5bc('0x22')]()[_0xe5bc('0x23')](function(){var _0x53c688=_0x443c09[_0xe5bc('0x24')]({'plain':!![]});var _0x242954='CmContactHasItems';return db[_0xe5bc('0x25')][_0xe5bc('0x22')]({'where':{'type':_0x242954,'resourceId':_0x53c688['id']}})[_0xe5bc('0x23')](function(){return _0x443c09;});})[_0xe5bc('0x23')](function(){_0x20ada7[_0xe5bc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415234,_0xf15d43){return function(_0x37ff76){if(!_0x37ff76){_0x415234[_0xe5bc('0x16')](0x194);}return _0x37ff76;};}function handleError(_0xa56b9f,_0x3e16b5){_0x3e16b5=_0x3e16b5||0x1f4;return function(_0x34a83d){logger['error'](_0x34a83d[_0xe5bc('0x26')]);if(_0x34a83d[_0xe5bc('0x27')]){delete _0x34a83d[_0xe5bc('0x27')];}_0xa56b9f[_0xe5bc('0x17')](_0x3e16b5)[_0xe5bc('0x28')](_0x34a83d);};}exports[_0xe5bc('0x29')]=function(_0x5598e5,_0x3922d1){var _0x3612c8={},_0x389c60={},_0x49ff57={'count':0x0,'rows':[]};var _0x4f51dc=_['map'](db[_0xe5bc('0x2a')][_0xe5bc('0x2b')],function(_0x157e24){return{'name':_0x157e24['fieldName'],'type':_0x157e24[_0xe5bc('0x2c')]['key']};});_0x389c60['model']=_['map'](_0x4f51dc,_0xe5bc('0x27'));_0x389c60[_0xe5bc('0x2d')]=_[_0xe5bc('0x2e')](_0x5598e5['query']);_0x389c60[_0xe5bc('0x2f')]=_[_0xe5bc('0x30')](_0x389c60[_0xe5bc('0x31')],_0x389c60[_0xe5bc('0x2d')]);_0x3612c8[_0xe5bc('0x32')]=_[_0xe5bc('0x30')](_0x389c60[_0xe5bc('0x31')],qs['fields'](_0x5598e5['query'][_0xe5bc('0x33')]));_0x3612c8[_0xe5bc('0x32')]=_0x3612c8['attributes'][_0xe5bc('0x34')]?_0x3612c8[_0xe5bc('0x32')]:_0x389c60[_0xe5bc('0x31')];if(!_0x5598e5[_0xe5bc('0x2d')][_0xe5bc('0x35')]('nolimit')){_0x3612c8['limit']=qs[_0xe5bc('0x1a')](_0x5598e5[_0xe5bc('0x2d')][_0xe5bc('0x1a')]);_0x3612c8['offset']=qs[_0xe5bc('0x18')](_0x5598e5[_0xe5bc('0x2d')][_0xe5bc('0x18')]);}_0x3612c8[_0xe5bc('0x36')]=qs[_0xe5bc('0x37')](_0x5598e5['query'][_0xe5bc('0x37')]);_0x3612c8[_0xe5bc('0x38')]=qs['filters'](_[_0xe5bc('0x39')](_0x5598e5[_0xe5bc('0x2d')],_0x389c60[_0xe5bc('0x2f')]),_0x4f51dc);if(_0x5598e5['query']['filter']){_0x3612c8[_0xe5bc('0x38')]=_['merge'](_0x3612c8[_0xe5bc('0x38')],{'$or':_[_0xe5bc('0x3a')](_0x4f51dc,function(_0xf48093){if(_0xf48093['type']!=='VIRTUAL'){var _0x3c3a73={};_0x3c3a73[_0xf48093[_0xe5bc('0x27')]]={'$like':'%'+_0x5598e5[_0xe5bc('0x2d')][_0xe5bc('0x3b')]+'%'};return _0x3c3a73;}})});}_0x3612c8=_[_0xe5bc('0x3c')]({},_0x3612c8,_0x5598e5['options']);var _0x1dde08={'where':_0x3612c8[_0xe5bc('0x38')]};return db[_0xe5bc('0x2a')][_0xe5bc('0x1b')](_0x1dde08)[_0xe5bc('0x23')](function(_0x300e88){_0x49ff57[_0xe5bc('0x1b')]=_0x300e88;if(_0x5598e5['query'][_0xe5bc('0x3d')]){_0x3612c8['include']=[{'all':!![]}];}return db[_0xe5bc('0x2a')][_0xe5bc('0x3e')](_0x3612c8);})[_0xe5bc('0x23')](function(_0x1703f0){_0x49ff57['rows']=_0x1703f0;return _0x49ff57;})[_0xe5bc('0x23')](respondWithFilteredResult(_0x3922d1,_0x3612c8))[_0xe5bc('0x3f')](handleError(_0x3922d1,null));};exports[_0xe5bc('0x40')]=function(_0xfb2f0a,_0x247200){var _0x350314={'raw':!![],'where':{'id':_0xfb2f0a[_0xe5bc('0x41')]['id']}},_0x59f36e={};_0x59f36e['model']=_['keys'](db[_0xe5bc('0x2a')][_0xe5bc('0x2b')]);_0x59f36e[_0xe5bc('0x2d')]=_['keys'](_0xfb2f0a[_0xe5bc('0x2d')]);_0x59f36e['filters']=_[_0xe5bc('0x30')](_0x59f36e[_0xe5bc('0x31')],_0x59f36e[_0xe5bc('0x2d')]);_0x350314['attributes']=_[_0xe5bc('0x30')](_0x59f36e['model'],qs[_0xe5bc('0x33')](_0xfb2f0a[_0xe5bc('0x2d')][_0xe5bc('0x33')]));_0x350314[_0xe5bc('0x32')]=_0x350314[_0xe5bc('0x32')][_0xe5bc('0x34')]?_0x350314['attributes']:_0x59f36e['model'];if(_0xfb2f0a[_0xe5bc('0x2d')][_0xe5bc('0x3d')]){_0x350314[_0xe5bc('0x42')]=[{'all':!![]}];}_0x350314=_['merge']({},_0x350314,_0xfb2f0a[_0xe5bc('0x43')]);return db[_0xe5bc('0x2a')][_0xe5bc('0x44')](_0x350314)[_0xe5bc('0x23')](handleEntityNotFound(_0x247200,null))[_0xe5bc('0x23')](respondWithResult(_0x247200,null))[_0xe5bc('0x3f')](handleError(_0x247200,null));};exports['create']=function(_0x514e5f,_0x40efdb){return db['CmContactHasItem'][_0xe5bc('0x45')](_0x514e5f[_0xe5bc('0x46')],{})[_0xe5bc('0x23')](function(_0x5c5016){var _0x292070=_0x514e5f['user'][_0xe5bc('0x24')]({'plain':!![]});if(!_0x292070)throw new Error(_0xe5bc('0x47'));if(_0x292070[_0xe5bc('0x48')]==='user'){var _0x5a2f08=_0x5c5016[_0xe5bc('0x24')]({'plain':!![]});var _0x4b0b0d=_0xe5bc('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x4b0b0d,'userProfileId':_0x292070[_0xe5bc('0x4a')]},'raw':!![]})[_0xe5bc('0x23')](function(_0x390654){if(_0x390654&&_0x390654[_0xe5bc('0x4b')]===0x0){return db[_0xe5bc('0x25')][_0xe5bc('0x45')]({'name':_0x5a2f08[_0xe5bc('0x27')],'resourceId':_0x5a2f08['id'],'type':_0x390654[_0xe5bc('0x27')],'sectionId':_0x390654['id']},{})[_0xe5bc('0x23')](function(){return _0x5c5016;});}else{return _0x5c5016;}})[_0xe5bc('0x3f')](function(_0x5020cf){logger['error'](_0xe5bc('0x4c'),_0x5020cf);throw _0x5020cf;});}return _0x5c5016;})['then'](respondWithResult(_0x40efdb,0xc9))['catch'](handleError(_0x40efdb,null));};exports['update']=function(_0x4b0a70,_0x18b087){if(_0x4b0a70[_0xe5bc('0x46')]['id']){delete _0x4b0a70[_0xe5bc('0x46')]['id'];}return db[_0xe5bc('0x2a')][_0xe5bc('0x44')]({'where':{'id':_0x4b0a70[_0xe5bc('0x41')]['id']}})[_0xe5bc('0x23')](handleEntityNotFound(_0x18b087,null))[_0xe5bc('0x23')](saveUpdates(_0x4b0a70[_0xe5bc('0x46')],null))[_0xe5bc('0x23')](respondWithResult(_0x18b087,null))[_0xe5bc('0x3f')](handleError(_0x18b087,null));};exports[_0xe5bc('0x22')]=function(_0x4dd325,_0x2ff65d){return db[_0xe5bc('0x2a')]['find']({'where':{'id':_0x4dd325[_0xe5bc('0x41')]['id']}})[_0xe5bc('0x23')](handleEntityNotFound(_0x2ff65d,null))['then'](removeEntity(_0x2ff65d,null))['catch'](handleError(_0x2ff65d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 1ab3c8a..c565a72 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 _0x4c27=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x2c655f,_0x3ee11c){var _0x23ed33=function(_0x11b9df){while(--_0x11b9df){_0x2c655f['push'](_0x2c655f['shift']());}};_0x23ed33(++_0x3ee11c);}(_0x4c27,0x86));var _0x74c2=function(_0x5d164e,_0x1014de){_0x5d164e=_0x5d164e-0x0;var _0x3f12c6=_0x4c27[_0x5d164e];return _0x3f12c6;};'use strict';var _=require('lodash');var util=require(_0x74c2('0x0'));var logger=require(_0x74c2('0x1'))(_0x74c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x74c2('0x4'));var config=require(_0x74c2('0x5'));var attributes=require(_0x74c2('0x6'));module[_0x74c2('0x7')]=function(_0x1bf131,_0x512ef5){return _0x1bf131[_0x74c2('0x8')](_0x74c2('0x9'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x451e=['cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','CmContactHasItem'];(function(_0x5389a8,_0x5bf8f2){var _0x5f891a=function(_0x331d88){while(--_0x331d88){_0x5389a8['push'](_0x5389a8['shift']());}};_0x5f891a(++_0x5bf8f2);}(_0x451e,0xfe));var _0xe451=function(_0x45cbf3,_0x55fdc1){_0x45cbf3=_0x45cbf3-0x0;var _0x73323b=_0x451e[_0x45cbf3];return _0x73323b;};'use strict';var _=require(_0xe451('0x0'));var util=require(_0xe451('0x1'));var logger=require(_0xe451('0x2'))(_0xe451('0x3'));var moment=require(_0xe451('0x4'));var BPromise=require(_0xe451('0x5'));var rp=require(_0xe451('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe451('0x7'));var config=require(_0xe451('0x8'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x1dd91c,_0x8b1e82){return _0x1dd91c['define'](_0xe451('0x9'),attributes,{'tableName':_0xe451('0xa'),'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 5432e28..cafff29 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 _0x640b=['then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','CmContactHasItem,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x5f14ec,_0x2ecbf8){var _0xdfee71=function(_0x20b673){while(--_0x20b673){_0x5f14ec['push'](_0x5f14ec['shift']());}};_0xdfee71(++_0x2ecbf8);}(_0x640b,0x66));var _0xb640=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x640b[_0x422ac3];return _0x53c0d4;};'use strict';var _=require(_0xb640('0x0'));var util=require(_0xb640('0x1'));var moment=require(_0xb640('0x2'));var BPromise=require(_0xb640('0x3'));var rs=require(_0xb640('0x4'));var fs=require('fs');var Redis=require(_0xb640('0x5'));var db=require(_0xb640('0x6'))['db'];var utils=require(_0xb640('0x7'));var logger=require(_0xb640('0x8'))(_0xb640('0x9'));var config=require('../../config/environment');var jayson=require(_0xb640('0xa'));var client=jayson[_0xb640('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58f4e4,_0x3a04ec,_0xadb97){return new BPromise(function(_0x552ade,_0x35d3d8){return client[_0xb640('0xc')](_0x58f4e4,_0xadb97)[_0xb640('0xd')](function(_0x485a80){logger[_0xb640('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x3a04ec,_0xb640('0xf'));logger[_0xb640('0x10')](_0xb640('0x11'),_0x3a04ec,_0xb640('0xf'),JSON[_0xb640('0x12')](_0x485a80));if(_0x485a80[_0xb640('0x13')]){if(_0x485a80[_0xb640('0x13')]['code']===0x1f4){logger[_0xb640('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x3a04ec,_0x485a80[_0xb640('0x13')][_0xb640('0x14')]);return _0x35d3d8(_0x485a80[_0xb640('0x13')][_0xb640('0x14')]);}logger[_0xb640('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x3a04ec,_0x485a80[_0xb640('0x13')]['message']);return _0x552ade(_0x485a80[_0xb640('0x13')][_0xb640('0x14')]);}else{logger[_0xb640('0xe')](_0xb640('0x15'),_0x3a04ec,_0xb640('0xf'));_0x552ade(_0x485a80['result'][_0xb640('0x14')]);}})[_0xb640('0x16')](function(_0x562408){logger['error'](_0xb640('0x15'),_0x3a04ec,_0x562408);_0x35d3d8(_0x562408);});});} \ No newline at end of file +var _0x2cec=['request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','http'];(function(_0x119b59,_0x3be83b){var _0x2d53bc=function(_0x2876e8){while(--_0x2876e8){_0x119b59['push'](_0x119b59['shift']());}};_0x2d53bc(++_0x3be83b);}(_0x2cec,0x175));var _0xc2ce=function(_0x35b158,_0xee85ab){_0x35b158=_0x35b158-0x0;var _0x5baca9=_0x2cec[_0x35b158];return _0x5baca9;};'use strict';var _=require('lodash');var util=require(_0xc2ce('0x0'));var moment=require(_0xc2ce('0x1'));var BPromise=require(_0xc2ce('0x2'));var rs=require(_0xc2ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc2ce('0x4'));var jayson=require(_0xc2ce('0x5'));var client=jayson['client'][_0xc2ce('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4c9f2c,_0x4d400f,_0x163eb9){return new BPromise(function(_0x3757d9,_0x4a4ecd){return client[_0xc2ce('0x7')](_0x4c9f2c,_0x163eb9)[_0xc2ce('0x8')](function(_0x4f534e){logger[_0xc2ce('0x9')](_0xc2ce('0xa'),_0x4d400f,'request\x20sent');logger[_0xc2ce('0xb')](_0xc2ce('0xc'),_0x4d400f,_0xc2ce('0xd'),JSON['stringify'](_0x4f534e));if(_0x4f534e[_0xc2ce('0xe')]){if(_0x4f534e['error'][_0xc2ce('0xf')]===0x1f4){logger['error'](_0xc2ce('0xa'),_0x4d400f,_0x4f534e[_0xc2ce('0xe')][_0xc2ce('0x10')]);return _0x4a4ecd(_0x4f534e[_0xc2ce('0xe')][_0xc2ce('0x10')]);}logger['error'](_0xc2ce('0xa'),_0x4d400f,_0x4f534e['error']['message']);return _0x3757d9(_0x4f534e[_0xc2ce('0xe')][_0xc2ce('0x10')]);}else{logger[_0xc2ce('0x9')](_0xc2ce('0xa'),_0x4d400f,'request\x20sent');_0x3757d9(_0x4f534e[_0xc2ce('0x11')][_0xc2ce('0x10')]);}})[_0xc2ce('0x12')](function(_0x2a05d4){logger[_0xc2ce('0xe')](_0xc2ce('0xa'),_0x4d400f,_0x2a05d4);_0x4a4ecd(_0x2a05d4);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index d3ec6ce..363e05d 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 _0x600f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x600f,0x6c));var _0xf600=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x600f[_0x51b0dc];return _0x13fa89;};'use strict';var multer=require(_0xf600('0x0'));var util=require(_0xf600('0x1'));var path=require(_0xf600('0x2'));var timeout=require(_0xf600('0x3'));var express=require(_0xf600('0x4'));var router=express[_0xf600('0x5')]();var fs_extra=require(_0xf600('0x6'));var auth=require(_0xf600('0x7'));var interaction=require(_0xf600('0x8'));var config=require(_0xf600('0x9'));var controller=require(_0xf600('0xa'));router[_0xf600('0xb')]('/',auth[_0xf600('0xc')](),controller[_0xf600('0xd')]);router['get'](_0xf600('0xe'),auth[_0xf600('0xc')](),controller[_0xf600('0xf')]);router[_0xf600('0x10')]('/',auth[_0xf600('0xc')](),controller[_0xf600('0x11')]);router[_0xf600('0x12')](_0xf600('0xe'),auth[_0xf600('0xc')](),controller[_0xf600('0x13')]);router[_0xf600('0x14')](_0xf600('0xe'),auth['isAuthenticated'](),controller[_0xf600('0x15')]);module[_0xf600('0x16')]=router; \ No newline at end of file +var _0x16d7=['isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','../../config/environment','get'];(function(_0x475f47,_0x3f6e26){var _0x1ed578=function(_0x550286){while(--_0x550286){_0x475f47['push'](_0x475f47['shift']());}};_0x1ed578(++_0x3f6e26);}(_0x16d7,0x1ac));var _0x716d=function(_0x40f627,_0x5dfc60){_0x40f627=_0x40f627-0x0;var _0x32baf7=_0x16d7[_0x40f627];return _0x32baf7;};'use strict';var multer=require(_0x716d('0x0'));var util=require(_0x716d('0x1'));var path=require(_0x716d('0x2'));var timeout=require(_0x716d('0x3'));var express=require('express');var router=express[_0x716d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x716d('0x5'));var controller=require('./cmContactHasItem.controller');router[_0x716d('0x6')]('/',auth[_0x716d('0x7')](),controller[_0x716d('0x8')]);router[_0x716d('0x6')](_0x716d('0x9'),auth[_0x716d('0x7')](),controller['show']);router[_0x716d('0xa')]('/',auth[_0x716d('0x7')](),controller[_0x716d('0xb')]);router[_0x716d('0xc')](_0x716d('0x9'),auth['isAuthenticated'](),controller[_0x716d('0xd')]);router['delete'](_0x716d('0x9'),auth[_0x716d('0x7')](),controller[_0x716d('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 9f009ce..dce618b 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 _0x2ae6=['ENUM','voice','lodash','exports','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','select','values','stringify','BOOLEAN'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x2ae6,0x1b2));var _0x62ae=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x2ae6[_0x548627];return _0x844a84;};'use strict';var Sequelize=require('sequelize');var _=require(_0x62ae('0x0'));module[_0x62ae('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xaaf695){return this[_0x62ae('0x2')](_0x62ae('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x34e332){this[_0x62ae('0x4')](_0x62ae('0x3'),_0x34e332?_0x34e332:this[_0x62ae('0x2')](_0x62ae('0x5')));}},'type':{'type':Sequelize[_0x62ae('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x62ae('0x7')](_0x62ae('0x8')),'get':function(){if(this['getDataValue'](_0x62ae('0x9'))===_0x62ae('0xa')){return JSON['parse'](this[_0x62ae('0x2')](_0x62ae('0xb')));}else{return this[_0x62ae('0x2')](_0x62ae('0xb'));}},'set':function(_0x359694){if(Array['isArray'](_0x359694)){this[_0x62ae('0x4')](_0x62ae('0xb'),JSON[_0x62ae('0xc')](_0x359694));}else{this[_0x62ae('0x4')](_0x62ae('0xb'),_0x359694);}}},'required':{'type':Sequelize[_0x62ae('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x62ae('0xe')](_0x62ae('0xf'))}}; \ No newline at end of file +var _0x911e=['BOOLEAN','ENUM','sequelize','lodash','exports','getDataValue','STRING','setDataValue','alias','name','long','type','select','parse','values','isArray'];(function(_0x3a78bd,_0x360510){var _0x2fcd29=function(_0x24a414){while(--_0x24a414){_0x3a78bd['push'](_0x3a78bd['shift']());}};_0x2fcd29(++_0x360510);}(_0x911e,0xc2));var _0xe911=function(_0x434d51,_0x2247fa){_0x434d51=_0x434d51-0x0;var _0x5448f2=_0x911e[_0x434d51];return _0x5448f2;};'use strict';var Sequelize=require(_0xe911('0x0'));var _=require(_0xe911('0x1'));module[_0xe911('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5064fb){return this[_0xe911('0x3')]('alias');}},'alias':{'type':Sequelize[_0xe911('0x4')],'allowNull':![],'set':function(_0x179edb){this[_0xe911('0x5')](_0xe911('0x6'),_0x179edb?_0x179edb:this['getDataValue'](_0xe911('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xe911('0x8')),'get':function(){if(this[_0xe911('0x3')](_0xe911('0x9'))===_0xe911('0xa')){return JSON[_0xe911('0xb')](this['getDataValue'](_0xe911('0xc')));}else{return this[_0xe911('0x3')](_0xe911('0xc'));}},'set':function(_0x435a88){if(Array[_0xe911('0xd')](_0x435a88)){this[_0xe911('0x5')]('values',JSON['stringify'](_0x435a88));}else{this['setDataValue'](_0xe911('0xc'),_0x435a88);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe911('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe911('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 3d60fd9..f2fb62e 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 _0x7f37=['ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','fieldName','type','key','differenceBy','keys','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','limit','sort','pick','filters','filter','where','merge','VIRTUAL','options','CmCustomField','includeAll','include','findAll','rows','catch','show','rawAttributes','length','body','find','params','sequelize','transaction','create','Sequelize','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','papaparse'];(function(_0x1c09e4,_0x36519a){var _0x284ecd=function(_0x9e53b7){while(--_0x9e53b7){_0x1c09e4['push'](_0x1c09e4['shift']());}};_0x284ecd(++_0x36519a);}(_0x7f37,0x149));var _0x77f3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7f37[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x77f3('0x0'));var jsonpatch=require(_0x77f3('0x1'));var rp=require('request-promise');var moment=require(_0x77f3('0x2'));var BPromise=require(_0x77f3('0x3'));var Mustache=require(_0x77f3('0x4'));var util=require('util');var path=require(_0x77f3('0x5'));var sox=require('sox');var csv=require(_0x77f3('0x6'));var ejs=require(_0x77f3('0x7'));var fs=require('fs');var fs_extra=require(_0x77f3('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x77f3('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x77f3('0x6'));var querystring=require('querystring');var Papa=require(_0x77f3('0xa'));var Redis=require(_0x77f3('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x77f3('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x77f3('0xd'));var utils=require(_0x77f3('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0x77f3('0xf'));var db=require(_0x77f3('0x10'))['db'];function respondWithStatusCode(_0x41345d,_0x1a7c84){_0x1a7c84=_0x1a7c84||0xcc;return function(_0x5313c){if(_0x5313c){return _0x41345d[_0x77f3('0x11')](_0x1a7c84);}return _0x41345d[_0x77f3('0x12')](_0x1a7c84)[_0x77f3('0x13')]();};}function respondWithResult(_0x25f2c0,_0x44ee0a){_0x44ee0a=_0x44ee0a||0xc8;return function(_0xd16516){if(_0xd16516){return _0x25f2c0[_0x77f3('0x12')](_0x44ee0a)['json'](_0xd16516);}};}function respondWithFilteredResult(_0x5123de,_0x430a3c){return function(_0x5478b2){if(_0x5478b2){var _0x39aff5=typeof _0x430a3c[_0x77f3('0x14')]===_0x77f3('0x15')&&typeof _0x430a3c['limit']===_0x77f3('0x15');var _0x59a4ef=_0x5478b2[_0x77f3('0x16')];var _0x17cebd=_0x39aff5?0x0:_0x430a3c[_0x77f3('0x14')];var _0x24d156=_0x39aff5?_0x5478b2[_0x77f3('0x16')]:_0x430a3c[_0x77f3('0x14')]+_0x430a3c['limit'];var _0x2efa54;if(_0x24d156>=_0x59a4ef){_0x24d156=_0x59a4ef;_0x2efa54=0xc8;}else{_0x2efa54=0xce;}_0x5123de['status'](_0x2efa54);return _0x5123de[_0x77f3('0x17')](_0x77f3('0x18'),_0x17cebd+'-'+_0x24d156+'/'+_0x59a4ef)[_0x77f3('0x19')](_0x5478b2);}return null;};}function patchUpdates(_0x4f2ef9){return function(_0x2c05b1){try{jsonpatch[_0x77f3('0x1a')](_0x2c05b1,_0x4f2ef9,!![]);}catch(_0x5b978a){return BPromise[_0x77f3('0x1b')](_0x5b978a);}return _0x2c05b1[_0x77f3('0x1c')]();};}function saveUpdates(_0x2f2096,_0x1307bf){return function(_0x341cdb){if(_0x341cdb){return _0x341cdb[_0x77f3('0x1d')](_0x2f2096)['then'](function(_0x5d7279){return _0x5d7279;});}return null;};}function removeEntity(_0x15531f,_0x1f1c66){return function(_0x30e86d){if(_0x30e86d){return _0x30e86d[_0x77f3('0x1e')]()[_0x77f3('0x1f')](function(){_0x15531f['status'](0xcc)[_0x77f3('0x13')]();});}};}function handleEntityNotFound(_0x496f5c,_0x309d25){return function(_0x14c735){if(!_0x14c735){_0x496f5c['sendStatus'](0x194);}return _0x14c735;};}function handleError(_0x26f8a0,_0x1ba30f){_0x1ba30f=_0x1ba30f||0x1f4;return function(_0x2e8c51){logger[_0x77f3('0x20')](_0x2e8c51[_0x77f3('0x21')]);if(_0x2e8c51['name']){delete _0x2e8c51[_0x77f3('0x22')];}_0x26f8a0[_0x77f3('0x12')](_0x1ba30f)[_0x77f3('0x23')](_0x2e8c51);};}exports[_0x77f3('0x24')]=function(_0xc3ef54,_0x1f7e4d){var _0x3f620a={},_0x259822={},_0xe0bee2={'count':0x0,'rows':[]};var _0x116739=_[_0x77f3('0x25')](db['CmCustomField']['rawAttributes'],function(_0x3c1147){return{'name':_0x3c1147[_0x77f3('0x26')],'type':_0x3c1147[_0x77f3('0x27')][_0x77f3('0x28')]};});_0x259822['model']=_[_0x77f3('0x29')](_['map'](_0x116739,'name'),['name']);_0x259822['query']=_[_0x77f3('0x2a')](_0xc3ef54['query']);_0x259822['filters']=_[_0x77f3('0x2b')](_0x259822[_0x77f3('0x2c')],_0x259822['query']);_0x3f620a[_0x77f3('0x2d')]=_[_0x77f3('0x2b')](_0x259822[_0x77f3('0x2c')],qs[_0x77f3('0x2e')](_0xc3ef54[_0x77f3('0x2f')][_0x77f3('0x2e')]));_0x3f620a[_0x77f3('0x2d')]=_0x3f620a[_0x77f3('0x2d')]['length']?_0x3f620a['attributes']:_0x259822[_0x77f3('0x2c')];if(!_0xc3ef54[_0x77f3('0x2f')][_0x77f3('0x30')](_0x77f3('0x31'))){_0x3f620a[_0x77f3('0x32')]=qs[_0x77f3('0x32')](_0xc3ef54[_0x77f3('0x2f')][_0x77f3('0x32')]);_0x3f620a[_0x77f3('0x14')]=qs[_0x77f3('0x14')](_0xc3ef54[_0x77f3('0x2f')]['offset']);}_0x3f620a['order']=qs['sort'](_0xc3ef54[_0x77f3('0x2f')][_0x77f3('0x33')]);_0x3f620a['where']=qs['filters'](_[_0x77f3('0x34')](_0xc3ef54[_0x77f3('0x2f')],_0x259822[_0x77f3('0x35')]),_0x116739);if(_0xc3ef54[_0x77f3('0x2f')][_0x77f3('0x36')]){_0x3f620a[_0x77f3('0x37')]=_[_0x77f3('0x38')](_0x3f620a[_0x77f3('0x37')],{'$or':_[_0x77f3('0x25')](_0x116739,function(_0x38f7b5){if(_0x38f7b5[_0x77f3('0x27')]!==_0x77f3('0x39')){var _0x505d01={};_0x505d01[_0x38f7b5['name']]={'$like':'%'+_0xc3ef54['query'][_0x77f3('0x36')]+'%'};return _0x505d01;}})});}_0x3f620a=_[_0x77f3('0x38')]({},_0x3f620a,_0xc3ef54[_0x77f3('0x3a')]);var _0x160159={'where':_0x3f620a[_0x77f3('0x37')]};return db[_0x77f3('0x3b')][_0x77f3('0x16')](_0x160159)['then'](function(_0x158421){_0xe0bee2[_0x77f3('0x16')]=_0x158421;if(_0xc3ef54[_0x77f3('0x2f')][_0x77f3('0x3c')]){_0x3f620a[_0x77f3('0x3d')]=[{'all':!![]}];}return db[_0x77f3('0x3b')][_0x77f3('0x3e')](_0x3f620a);})[_0x77f3('0x1f')](function(_0x3c88fc){_0xe0bee2[_0x77f3('0x3f')]=_0x3c88fc;return _0xe0bee2;})[_0x77f3('0x1f')](respondWithFilteredResult(_0x1f7e4d,_0x3f620a))[_0x77f3('0x40')](handleError(_0x1f7e4d,null));};exports[_0x77f3('0x41')]=function(_0x15af15,_0x3672ab){var _0x429788={'raw':!![],'where':{'id':_0x15af15['params']['id']}},_0x2a2ada={};_0x2a2ada[_0x77f3('0x2c')]=_['keys'](db['CmCustomField'][_0x77f3('0x42')]);_0x2a2ada[_0x77f3('0x2f')]=_[_0x77f3('0x2a')](_0x15af15[_0x77f3('0x2f')]);_0x2a2ada['filters']=_[_0x77f3('0x2b')](_0x2a2ada[_0x77f3('0x2c')],_0x2a2ada[_0x77f3('0x2f')]);_0x429788[_0x77f3('0x2d')]=_[_0x77f3('0x2b')](_0x2a2ada[_0x77f3('0x2c')],qs[_0x77f3('0x2e')](_0x15af15[_0x77f3('0x2f')][_0x77f3('0x2e')]));_0x429788[_0x77f3('0x2d')]=_0x429788[_0x77f3('0x2d')][_0x77f3('0x43')]?_0x429788['attributes']:_0x2a2ada[_0x77f3('0x2c')];if(_0x15af15[_0x77f3('0x2f')][_0x77f3('0x3c')]){_0x429788['include']=[{'all':!![]}];}_0x429788=_[_0x77f3('0x38')]({},_0x429788,_0x15af15[_0x77f3('0x3a')]);return db[_0x77f3('0x3b')]['find'](_0x429788)['then'](handleEntityNotFound(_0x3672ab,null))[_0x77f3('0x1f')](respondWithResult(_0x3672ab,null))['catch'](handleError(_0x3672ab,null));};exports[_0x77f3('0x1d')]=function(_0x2ab647,_0x129c07){if(_0x2ab647[_0x77f3('0x44')]['id']){delete _0x2ab647['body']['id'];}return db['CmCustomField'][_0x77f3('0x45')]({'where':{'id':_0x2ab647[_0x77f3('0x46')]['id']}})['then'](handleEntityNotFound(_0x129c07,null))[_0x77f3('0x1f')](saveUpdates(_0x2ab647[_0x77f3('0x44')],null))[_0x77f3('0x1f')](respondWithResult(_0x129c07,null))[_0x77f3('0x40')](handleError(_0x129c07,null));};exports[_0x77f3('0x1e')]=function(_0x2152f3,_0x5e5412){return db[_0x77f3('0x3b')]['find']({'where':{'id':_0x2152f3['params']['id']}})['then'](handleEntityNotFound(_0x5e5412,null))[_0x77f3('0x1f')](removeEntity(_0x5e5412,null))[_0x77f3('0x40')](handleError(_0x5e5412,null));};exports['create']=function(_0x18c383,_0x4ab3ac){var _0x14867d;return db[_0x77f3('0x47')][_0x77f3('0x48')](function(_0x5b9ede){return db[_0x77f3('0x3b')][_0x77f3('0x49')](_0x18c383[_0x77f3('0x44')],{'transaction':_0x5b9ede})[_0x77f3('0x1f')](function(_0x336fd2){_0x14867d=_0x336fd2;var _0x2d0c36={'type':db[_0x77f3('0x4a')]['TEXT'],'transaction':_0x5b9ede};switch(_0x18c383[_0x77f3('0x44')][_0x77f3('0x27')]){case _0x77f3('0x4b'):_0x2d0c36['type']=db[_0x77f3('0x4a')]['TEXT'];break;case'number':_0x2d0c36['type']=db['Sequelize'][_0x77f3('0x4c')];break;case _0x77f3('0x4d'):_0x2d0c36['type']=db[_0x77f3('0x4a')][_0x77f3('0x4e')];_0x2d0c36[_0x77f3('0x4f')]=![];break;default:}return db[_0x77f3('0x47')][_0x77f3('0x50')][_0x77f3('0x51')](_0x77f3('0x52'),util[_0x77f3('0x53')](_0x77f3('0x54'),_0x14867d['id']),_0x2d0c36);})[_0x77f3('0x1f')](function(){return _0x14867d;});})[_0x77f3('0x1f')](respondWithResult(_0x4ab3ac,0xc9))['catch'](handleError(_0x4ab3ac,null));}; \ No newline at end of file +var _0xc7d3=['to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','catch','params','rawAttributes','includeAll','options','find','body','destroy','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','request-promise','moment','bluebird','util','sox'];(function(_0x2c6d92,_0x393b34){var _0xcc9db3=function(_0x16e1a0){while(--_0x16e1a0){_0x2c6d92['push'](_0x2c6d92['shift']());}};_0xcc9db3(++_0x393b34);}(_0xc7d3,0x1b6));var _0x3c7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7d3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3c7d('0x0'));var rimraf=require(_0x3c7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3c7d('0x2'));var moment=require(_0x3c7d('0x3'));var BPromise=require(_0x3c7d('0x4'));var Mustache=require('mustache');var util=require(_0x3c7d('0x5'));var path=require('path');var sox=require(_0x3c7d('0x6'));var csv=require(_0x3c7d('0x7'));var ejs=require(_0x3c7d('0x8'));var fs=require('fs');var fs_extra=require(_0x3c7d('0x9'));var _=require('lodash');var squel=require(_0x3c7d('0xa'));var crypto=require('crypto');var jsforce=require(_0x3c7d('0xb'));var deskjs=require(_0x3c7d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3c7d('0xd'));var Papa=require(_0x3c7d('0xe'));var Redis=require(_0x3c7d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3c7d('0x10'));var as=require(_0x3c7d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c7d('0x12'))('api');var utils=require(_0x3c7d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3c7d('0x14'));var db=require(_0x3c7d('0x15'))['db'];function respondWithStatusCode(_0x35b15a,_0x4cdb77){_0x4cdb77=_0x4cdb77||0xcc;return function(_0x3e3599){if(_0x3e3599){return _0x35b15a[_0x3c7d('0x16')](_0x4cdb77);}return _0x35b15a['status'](_0x4cdb77)[_0x3c7d('0x17')]();};}function respondWithResult(_0xfd189c,_0x93a1d0){_0x93a1d0=_0x93a1d0||0xc8;return function(_0x438b05){if(_0x438b05){return _0xfd189c[_0x3c7d('0x18')](_0x93a1d0)[_0x3c7d('0x19')](_0x438b05);}};}function respondWithFilteredResult(_0x192fe3,_0x497d93){return function(_0x1106c0){if(_0x1106c0){var _0x4823c0=typeof _0x497d93[_0x3c7d('0x1a')]===_0x3c7d('0x1b')&&typeof _0x497d93[_0x3c7d('0x1c')]===_0x3c7d('0x1b');var _0x4cafa0=_0x1106c0['count'];var _0x1e3f52=_0x4823c0?0x0:_0x497d93['offset'];var _0x388c87=_0x4823c0?_0x1106c0[_0x3c7d('0x1d')]:_0x497d93[_0x3c7d('0x1a')]+_0x497d93[_0x3c7d('0x1c')];var _0x4ff357;if(_0x388c87>=_0x4cafa0){_0x388c87=_0x4cafa0;_0x4ff357=0xc8;}else{_0x4ff357=0xce;}_0x192fe3[_0x3c7d('0x18')](_0x4ff357);return _0x192fe3[_0x3c7d('0x1e')](_0x3c7d('0x1f'),_0x1e3f52+'-'+_0x388c87+'/'+_0x4cafa0)['json'](_0x1106c0);}return null;};}function patchUpdates(_0x4f896c){return function(_0x2f54c8){try{jsonpatch[_0x3c7d('0x20')](_0x2f54c8,_0x4f896c,!![]);}catch(_0x469bf4){return BPromise[_0x3c7d('0x21')](_0x469bf4);}return _0x2f54c8[_0x3c7d('0x22')]();};}function saveUpdates(_0x430c70,_0x3637e9){return function(_0xb10f3d){if(_0xb10f3d){return _0xb10f3d[_0x3c7d('0x23')](_0x430c70)[_0x3c7d('0x24')](function(_0x1d8c03){return _0x1d8c03;});}return null;};}function removeEntity(_0x406480,_0xaa19d){return function(_0x2fe1d3){if(_0x2fe1d3){return _0x2fe1d3['destroy']()[_0x3c7d('0x24')](function(){_0x406480[_0x3c7d('0x18')](0xcc)[_0x3c7d('0x17')]();});}};}function handleEntityNotFound(_0x28f0c1,_0x1343d7){return function(_0x1a4701){if(!_0x1a4701){_0x28f0c1[_0x3c7d('0x16')](0x194);}return _0x1a4701;};}function handleError(_0x2405fe,_0x443ebf){_0x443ebf=_0x443ebf||0x1f4;return function(_0xb54310){logger[_0x3c7d('0x25')](_0xb54310[_0x3c7d('0x26')]);if(_0xb54310[_0x3c7d('0x27')]){delete _0xb54310['name'];}_0x2405fe[_0x3c7d('0x18')](_0x443ebf)[_0x3c7d('0x28')](_0xb54310);};}exports[_0x3c7d('0x29')]=function(_0x3db516,_0x52de72){var _0x4ce416={},_0xe2a4fe={},_0x15cdb5={'count':0x0,'rows':[]};var _0x43cad2=_[_0x3c7d('0x2a')](db[_0x3c7d('0x2b')]['rawAttributes'],function(_0x142f61){return{'name':_0x142f61[_0x3c7d('0x2c')],'type':_0x142f61[_0x3c7d('0x2d')][_0x3c7d('0x2e')]};});_0xe2a4fe[_0x3c7d('0x2f')]=_[_0x3c7d('0x30')](_['map'](_0x43cad2,_0x3c7d('0x27')),['name']);_0xe2a4fe['query']=_[_0x3c7d('0x31')](_0x3db516[_0x3c7d('0x32')]);_0xe2a4fe[_0x3c7d('0x33')]=_['intersection'](_0xe2a4fe[_0x3c7d('0x2f')],_0xe2a4fe[_0x3c7d('0x32')]);_0x4ce416['attributes']=_[_0x3c7d('0x34')](_0xe2a4fe[_0x3c7d('0x2f')],qs[_0x3c7d('0x35')](_0x3db516[_0x3c7d('0x32')][_0x3c7d('0x35')]));_0x4ce416[_0x3c7d('0x36')]=_0x4ce416['attributes'][_0x3c7d('0x37')]?_0x4ce416[_0x3c7d('0x36')]:_0xe2a4fe[_0x3c7d('0x2f')];if(!_0x3db516[_0x3c7d('0x32')][_0x3c7d('0x38')](_0x3c7d('0x39'))){_0x4ce416[_0x3c7d('0x1c')]=qs[_0x3c7d('0x1c')](_0x3db516['query'][_0x3c7d('0x1c')]);_0x4ce416[_0x3c7d('0x1a')]=qs['offset'](_0x3db516[_0x3c7d('0x32')][_0x3c7d('0x1a')]);}_0x4ce416[_0x3c7d('0x3a')]=qs[_0x3c7d('0x3b')](_0x3db516['query'][_0x3c7d('0x3b')]);_0x4ce416[_0x3c7d('0x3c')]=qs['filters'](_[_0x3c7d('0x3d')](_0x3db516[_0x3c7d('0x32')],_0xe2a4fe[_0x3c7d('0x33')]),_0x43cad2);if(_0x3db516[_0x3c7d('0x32')][_0x3c7d('0x3e')]){_0x4ce416[_0x3c7d('0x3c')]=_[_0x3c7d('0x3f')](_0x4ce416[_0x3c7d('0x3c')],{'$or':_[_0x3c7d('0x2a')](_0x43cad2,function(_0x58e210){if(_0x58e210[_0x3c7d('0x2d')]!==_0x3c7d('0x40')){var _0xf8fb42={};_0xf8fb42[_0x58e210['name']]={'$like':'%'+_0x3db516['query'][_0x3c7d('0x3e')]+'%'};return _0xf8fb42;}})});}_0x4ce416=_['merge']({},_0x4ce416,_0x3db516['options']);var _0x51a01a={'where':_0x4ce416[_0x3c7d('0x3c')]};return db['CmCustomField']['count'](_0x51a01a)[_0x3c7d('0x24')](function(_0x5a9032){_0x15cdb5['count']=_0x5a9032;if(_0x3db516['query']['includeAll']){_0x4ce416['include']=[{'all':!![]}];}return db[_0x3c7d('0x2b')]['findAll'](_0x4ce416);})[_0x3c7d('0x24')](function(_0x8af0c9){_0x15cdb5[_0x3c7d('0x41')]=_0x8af0c9;return _0x15cdb5;})[_0x3c7d('0x24')](respondWithFilteredResult(_0x52de72,_0x4ce416))[_0x3c7d('0x42')](handleError(_0x52de72,null));};exports['show']=function(_0xd91ad6,_0x5dd1f9){var _0x4b6d4d={'raw':!![],'where':{'id':_0xd91ad6[_0x3c7d('0x43')]['id']}},_0x26f2ad={};_0x26f2ad[_0x3c7d('0x2f')]=_[_0x3c7d('0x31')](db['CmCustomField'][_0x3c7d('0x44')]);_0x26f2ad['query']=_[_0x3c7d('0x31')](_0xd91ad6[_0x3c7d('0x32')]);_0x26f2ad[_0x3c7d('0x33')]=_[_0x3c7d('0x34')](_0x26f2ad[_0x3c7d('0x2f')],_0x26f2ad['query']);_0x4b6d4d['attributes']=_[_0x3c7d('0x34')](_0x26f2ad[_0x3c7d('0x2f')],qs[_0x3c7d('0x35')](_0xd91ad6[_0x3c7d('0x32')][_0x3c7d('0x35')]));_0x4b6d4d[_0x3c7d('0x36')]=_0x4b6d4d[_0x3c7d('0x36')][_0x3c7d('0x37')]?_0x4b6d4d[_0x3c7d('0x36')]:_0x26f2ad[_0x3c7d('0x2f')];if(_0xd91ad6[_0x3c7d('0x32')][_0x3c7d('0x45')]){_0x4b6d4d['include']=[{'all':!![]}];}_0x4b6d4d=_[_0x3c7d('0x3f')]({},_0x4b6d4d,_0xd91ad6[_0x3c7d('0x46')]);return db[_0x3c7d('0x2b')][_0x3c7d('0x47')](_0x4b6d4d)[_0x3c7d('0x24')](handleEntityNotFound(_0x5dd1f9,null))[_0x3c7d('0x24')](respondWithResult(_0x5dd1f9,null))['catch'](handleError(_0x5dd1f9,null));};exports['update']=function(_0x1995d7,_0x2f9cc2){if(_0x1995d7['body']['id']){delete _0x1995d7[_0x3c7d('0x48')]['id'];}return db['CmCustomField'][_0x3c7d('0x47')]({'where':{'id':_0x1995d7[_0x3c7d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f9cc2,null))['then'](saveUpdates(_0x1995d7['body'],null))['then'](respondWithResult(_0x2f9cc2,null))[_0x3c7d('0x42')](handleError(_0x2f9cc2,null));};exports[_0x3c7d('0x49')]=function(_0x387348,_0x5d6514){return db['CmCustomField'][_0x3c7d('0x47')]({'where':{'id':_0x387348[_0x3c7d('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d6514,null))[_0x3c7d('0x24')](removeEntity(_0x5d6514,null))['catch'](handleError(_0x5d6514,null));};exports['create']=function(_0x14141b,_0x36b998){var _0x59a2e9;return db[_0x3c7d('0x4a')][_0x3c7d('0x4b')](function(_0x2dc88d){return db[_0x3c7d('0x2b')][_0x3c7d('0x4c')](_0x14141b['body'],{'transaction':_0x2dc88d})[_0x3c7d('0x24')](function(_0x47ea9e){_0x59a2e9=_0x47ea9e;var _0x408c17={'type':db[_0x3c7d('0x4d')][_0x3c7d('0x4e')],'transaction':_0x2dc88d};switch(_0x14141b['body']['type']){case _0x3c7d('0x4f'):_0x408c17['type']=db[_0x3c7d('0x4d')][_0x3c7d('0x4e')];break;case _0x3c7d('0x50'):_0x408c17[_0x3c7d('0x2d')]=db[_0x3c7d('0x4d')][_0x3c7d('0x51')];break;case _0x3c7d('0x52'):_0x408c17['type']=db[_0x3c7d('0x4d')][_0x3c7d('0x53')];_0x408c17[_0x3c7d('0x54')]=![];break;default:}return db[_0x3c7d('0x4a')][_0x3c7d('0x55')][_0x3c7d('0x56')](_0x3c7d('0x57'),util[_0x3c7d('0x58')]('cf_%d',_0x59a2e9['id']),_0x408c17);})['then'](function(){return _0x59a2e9;});})[_0x3c7d('0x24')](respondWithResult(_0x36b998,0xc9))[_0x3c7d('0x42')](handleError(_0x36b998,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e702f75..a502c55 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 _0xf547=['CmCustomField','cm_custom_fields','lodash','moment','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xf547,0x1b0));var _0x7f54=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf547[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7f54('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7f54('0x1'));var BPromise=require('bluebird');var rp=require(_0x7f54('0x2'));var fs=require('fs');var path=require(_0x7f54('0x3'));var rimraf=require('rimraf');var config=require(_0x7f54('0x4'));var attributes=require(_0x7f54('0x5'));module[_0x7f54('0x6')]=function(_0xb63f25,_0x31b007){return _0xb63f25[_0x7f54('0x7')](_0x7f54('0x8'),attributes,{'tableName':_0x7f54('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ba=['request-promise','path','rimraf','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2ce795,_0x133a7e){var _0x5b95a1=function(_0x1f437e){while(--_0x1f437e){_0x2ce795['push'](_0x2ce795['shift']());}};_0x5b95a1(++_0x133a7e);}(_0x55ba,0x1c1));var _0xa55b=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x55ba[_0x5ef55a];return _0x20ae40;};'use strict';var _=require(_0xa55b('0x0'));var util=require(_0xa55b('0x1'));var logger=require(_0xa55b('0x2'))(_0xa55b('0x3'));var moment=require(_0xa55b('0x4'));var BPromise=require(_0xa55b('0x5'));var rp=require(_0xa55b('0x6'));var fs=require('fs');var path=require(_0xa55b('0x7'));var rimraf=require(_0xa55b('0x8'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xa55b('0x9')]=function(_0x3a9966,_0x4bd58c){return _0x3a9966[_0xa55b('0xa')](_0xa55b('0xb'),attributes,{'tableName':_0xa55b('0xc'),'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 6e63bd7..28b11bd 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 _0x4343=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result'];(function(_0x11389e,_0x43b9d4){var _0x7ed395=function(_0x26ede2){while(--_0x26ede2){_0x11389e['push'](_0x11389e['shift']());}};_0x7ed395(++_0x43b9d4);}(_0x4343,0x143));var _0x3434=function(_0x3ecb5c,_0x9f7266){_0x3ecb5c=_0x3ecb5c-0x0;var _0x4d0525=_0x4343[_0x3ecb5c];return _0x4d0525;};'use strict';var _=require(_0x3434('0x0'));var util=require(_0x3434('0x1'));var moment=require(_0x3434('0x2'));var BPromise=require(_0x3434('0x3'));var rs=require(_0x3434('0x4'));var fs=require('fs');var Redis=require(_0x3434('0x5'));var db=require(_0x3434('0x6'))['db'];var utils=require(_0x3434('0x7'));var logger=require('../../config/logger')(_0x3434('0x8'));var config=require('../../config/environment');var jayson=require(_0x3434('0x9'));var client=jayson['client'][_0x3434('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x543312,_0xac3195,_0x56cd57){return new BPromise(function(_0x41a3a5,_0x299daa){return client[_0x3434('0xb')](_0x543312,_0x56cd57)[_0x3434('0xc')](function(_0x522571){logger[_0x3434('0xd')](_0x3434('0xe'),_0xac3195,'request\x20sent');logger[_0x3434('0xf')](_0x3434('0x10'),_0xac3195,'request\x20sent',JSON['stringify'](_0x522571));if(_0x522571['error']){if(_0x522571['error'][_0x3434('0x11')]===0x1f4){logger[_0x3434('0x12')](_0x3434('0xe'),_0xac3195,_0x522571['error']['message']);return _0x299daa(_0x522571['error'][_0x3434('0x13')]);}logger[_0x3434('0x12')]('CmCustomField,\x20%s,\x20%s',_0xac3195,_0x522571[_0x3434('0x12')][_0x3434('0x13')]);return _0x41a3a5(_0x522571[_0x3434('0x12')][_0x3434('0x13')]);}else{logger['info'](_0x3434('0xe'),_0xac3195,_0x3434('0x14'));_0x41a3a5(_0x522571[_0x3434('0x15')]['message']);}})[_0x3434('0x16')](function(_0x3db684){logger['error']('CmCustomField,\x20%s,\x20%s',_0xac3195,_0x3db684);_0x299daa(_0x3db684);});});} \ No newline at end of file +var _0xaf8c=['then','info','request\x20sent','debug','error','CmCustomField,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x215438,_0x46e8c2){var _0x1ddc09=function(_0x42b674){while(--_0x42b674){_0x215438['push'](_0x215438['shift']());}};_0x1ddc09(++_0x46e8c2);}(_0xaf8c,0x1ac));var _0xcaf8=function(_0x2d678b,_0x24433c){_0x2d678b=_0x2d678b-0x0;var _0x5085b6=_0xaf8c[_0x2d678b];return _0x5085b6;};'use strict';var _=require(_0xcaf8('0x0'));var util=require('util');var moment=require(_0xcaf8('0x1'));var BPromise=require(_0xcaf8('0x2'));var rs=require(_0xcaf8('0x3'));var fs=require('fs');var Redis=require(_0xcaf8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcaf8('0x5'));var logger=require('../../config/logger')(_0xcaf8('0x6'));var config=require(_0xcaf8('0x7'));var jayson=require(_0xcaf8('0x8'));var client=jayson[_0xcaf8('0x9')][_0xcaf8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x516b69,_0x3e984e,_0x413d9e){return new BPromise(function(_0x52a541,_0x58b964){return client[_0xcaf8('0xb')](_0x516b69,_0x413d9e)[_0xcaf8('0xc')](function(_0x353ca9){logger[_0xcaf8('0xd')]('CmCustomField,\x20%s,\x20%s',_0x3e984e,_0xcaf8('0xe'));logger[_0xcaf8('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x3e984e,'request\x20sent',JSON['stringify'](_0x353ca9));if(_0x353ca9['error']){if(_0x353ca9[_0xcaf8('0x10')]['code']===0x1f4){logger['error'](_0xcaf8('0x11'),_0x3e984e,_0x353ca9[_0xcaf8('0x10')][_0xcaf8('0x12')]);return _0x58b964(_0x353ca9[_0xcaf8('0x10')][_0xcaf8('0x12')]);}logger[_0xcaf8('0x10')](_0xcaf8('0x11'),_0x3e984e,_0x353ca9[_0xcaf8('0x10')][_0xcaf8('0x12')]);return _0x52a541(_0x353ca9[_0xcaf8('0x10')][_0xcaf8('0x12')]);}else{logger[_0xcaf8('0xd')](_0xcaf8('0x11'),_0x3e984e,_0xcaf8('0xe'));_0x52a541(_0x353ca9[_0xcaf8('0x13')][_0xcaf8('0x12')]);}})['catch'](function(_0x547d77){logger[_0xcaf8('0x10')](_0xcaf8('0x11'),_0x3e984e,_0x547d77);_0x58b964(_0x547d77);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0a205a6..cc4ecd9 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 _0x7412=['delete','destroy','exports','multer','connect-timeout','Router','isAuthenticated','index','get','show','post','put','/:id','update'];(function(_0x5d031b,_0xb437d3){var _0x1bed25=function(_0x1db3ba){while(--_0x1db3ba){_0x5d031b['push'](_0x5d031b['shift']());}};_0x1bed25(++_0xb437d3);}(_0x7412,0x161));var _0x2741=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x7412[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0x2741('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2741('0x1'));var express=require('express');var router=express[_0x2741('0x2')]();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('./cmCustomField.controller');router['get']('/',auth[_0x2741('0x3')](),controller[_0x2741('0x4')]);router[_0x2741('0x5')]('/:id',auth[_0x2741('0x3')](),controller[_0x2741('0x6')]);router[_0x2741('0x7')]('/',auth[_0x2741('0x3')](),controller['create']);router[_0x2741('0x8')](_0x2741('0x9'),auth[_0x2741('0x3')](),controller[_0x2741('0xa')]);router[_0x2741('0xb')]('/:id',auth[_0x2741('0x3')](),controller[_0x2741('0xc')]);module[_0x2741('0xd')]=router; \ No newline at end of file +var _0x869e=['post','create','put','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','show'];(function(_0x9c991d,_0x176f07){var _0x571df0=function(_0x2a10e6){while(--_0x2a10e6){_0x9c991d['push'](_0x9c991d['shift']());}};_0x571df0(++_0x176f07);}(_0x869e,0x15c));var _0xe869=function(_0x553d74,_0x164493){_0x553d74=_0x553d74-0x0;var _0x4af2a4=_0x869e[_0x553d74];return _0x4af2a4;};'use strict';var multer=require(_0xe869('0x0'));var util=require(_0xe869('0x1'));var path=require(_0xe869('0x2'));var timeout=require('connect-timeout');var express=require(_0xe869('0x3'));var router=express[_0xe869('0x4')]();var fs_extra=require(_0xe869('0x5'));var auth=require(_0xe869('0x6'));var interaction=require(_0xe869('0x7'));var config=require('../../config/environment');var controller=require(_0xe869('0x8'));router[_0xe869('0x9')]('/',auth[_0xe869('0xa')](),controller[_0xe869('0xb')]);router['get']('/:id',auth[_0xe869('0xa')](),controller[_0xe869('0xc')]);router[_0xe869('0xd')]('/',auth[_0xe869('0xa')](),controller[_0xe869('0xe')]);router[_0xe869('0xf')](_0xe869('0x10'),auth[_0xe869('0xa')](),controller['update']);router['delete'](_0xe869('0x10'),auth[_0xe869('0xa')](),controller[_0xe869('0x11')]);module[_0xe869('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index eec7a3f..af13829 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 _0xa5a9=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','moment','sequelize','exports'];(function(_0x518aaa,_0x12149c){var _0x6ac2bd=function(_0x5c06bb){while(--_0x5c06bb){_0x518aaa['push'](_0x518aaa['shift']());}};_0x6ac2bd(++_0x12149c);}(_0xa5a9,0x129));var _0x9a5a=function(_0x16eb19,_0x58cea4){_0x16eb19=_0x16eb19-0x0;var _0x312a25=_0xa5a9[_0x16eb19];return _0x312a25;};'use strict';var moment=require(_0x9a5a('0x0'));var Sequelize=require(_0x9a5a('0x1'));module[_0x9a5a('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x9a5a('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9a5a('0x4')],'defaultValue':moment()[_0x9a5a('0x5')](_0x9a5a('0x6'))},'countbusyretry':{'type':Sequelize[_0x9a5a('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9a5a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9a5a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9a5a('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9a5a('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9a5a('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9a5a('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9a5a('0x7')],'unique':_0x9a5a('0x9')},'UserId':{'type':Sequelize[_0x9a5a('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x9a5a('0x7')],'unique':_0x9a5a('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x9a5a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9a5a('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9a5a('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9a5a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9a5a('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9a5a('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9a5a('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0x9a5a('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x143f=['moment','STRING','BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue'];(function(_0x53ffb9,_0x520ee9){var _0x4483b1=function(_0x4307ed){while(--_0x4307ed){_0x53ffb9['push'](_0x53ffb9['shift']());}};_0x4483b1(++_0x520ee9);}(_0x143f,0xb6));var _0xf143=function(_0x3d8d40,_0x58413f){_0x3d8d40=_0x3d8d40-0x0;var _0x383063=_0x143f[_0x3d8d40];return _0x383063;};'use strict';var moment=require(_0xf143('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xf143('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xf143('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf143('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xf143('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf143('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf143('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf143('0x3')]},'priority':{'type':Sequelize[_0xf143('0x4')](0x2)[_0xf143('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf143('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xf143('0x4')],'unique':_0xf143('0x6')},'UserId':{'type':Sequelize[_0xf143('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xf143('0x4')],'unique':_0xf143('0x6')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xf143('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf143('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf143('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf143('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf143('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xf143('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf143('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xf143('0x3')],'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 9117fa8..6c2aaec 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 _0x3435=['api','../../config/environment','json','offset','undefined','limit','count','status','set','Content-Range','update','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$or','$gt','$lt','$lte','$ne','$between','$in','$like','$notILike','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','show','params','intersection','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','deleted','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','hopperIds','ASC','DESC','isEmpty','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','getPreviewRecall','recallme','UPDATE','List','Queue','dialActive','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3435,0xfa));var _0x5343=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x3435[_0x5235a6];return _0x1cf37e;};'use strict';var moment=require(_0x5343('0x0'));var _=require(_0x5343('0x1'));var qs=require(_0x5343('0x2'));var logger=require(_0x5343('0x3'))(_0x5343('0x4'));var shared=require(_0x5343('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x3f1d67,_0x3ae07e){_0x3ae07e=_0x3ae07e||0xc8;return function(_0x578a24){if(_0x578a24){return _0x3f1d67['status'](_0x3ae07e)[_0x5343('0x6')](_0x578a24);}};}function respondWithFilteredResult(_0x28f0f3,_0x4d26b5){return function(_0x544b29){if(_0x544b29){var _0x13641f=typeof _0x4d26b5[_0x5343('0x7')]===_0x5343('0x8')&&typeof _0x4d26b5[_0x5343('0x9')]===_0x5343('0x8');var _0x5e1147=_0x544b29[_0x5343('0xa')];var _0x50d857=_0x13641f?0x0:_0x4d26b5[_0x5343('0x7')];var _0x328e54=_0x13641f?_0x544b29[_0x5343('0xa')]:_0x4d26b5[_0x5343('0x7')]+_0x4d26b5[_0x5343('0x9')];var _0x4ef57c;if(_0x328e54>=_0x5e1147){_0x328e54=_0x5e1147;_0x4ef57c=0xc8;}else{_0x4ef57c=0xce;}_0x28f0f3[_0x5343('0xb')](_0x4ef57c);return _0x28f0f3[_0x5343('0xc')](_0x5343('0xd'),_0x50d857+'-'+_0x328e54+'/'+_0x5e1147)['json'](_0x544b29);}return null;};}function saveUpdates(_0x2ddeb7,_0x5f473f){return function(_0x82074d){if(_0x82074d){return _0x82074d[_0x5343('0xe')](_0x2ddeb7)['then'](function(_0x392797){return _0x392797;});}return null;};}function handleEntityNotFound(_0x4cdfae,_0x13066f){return function(_0x46c3d7){if(!_0x46c3d7){_0x4cdfae[_0x5343('0xf')](0x194);}return _0x46c3d7;};}function handleError(_0x65e827,_0x4dbff1){_0x4dbff1=_0x4dbff1||0x1f4;return function(_0x446e90){logger[_0x5343('0x10')](_0x446e90[_0x5343('0x11')]);if(_0x446e90[_0x5343('0x12')]){delete _0x446e90[_0x5343('0x12')];}_0x65e827[_0x5343('0xb')](_0x4dbff1)[_0x5343('0x13')](_0x446e90);};}exports[_0x5343('0x14')]=function(_0x4cf3c2,_0x432992){var _0xec1ba0={},_0x1f5098={},_0x489e1c={'count':0x0,'rows':[]};var _0x1eb3bd=_[_0x5343('0x15')](db[_0x5343('0x16')][_0x5343('0x17')],function(_0x35e68c){return{'name':_0x35e68c[_0x5343('0x18')],'type':_0x35e68c[_0x5343('0x19')][_0x5343('0x1a')]};});_0x1f5098[_0x5343('0x1b')]=_['map'](_0x1eb3bd,_0x5343('0x12'));_0x1f5098[_0x5343('0x1c')]=_[_0x5343('0x1d')](_0x4cf3c2[_0x5343('0x1c')]);_0x1f5098[_0x5343('0x1e')]=_['intersection'](_0x1f5098[_0x5343('0x1b')],_0x1f5098[_0x5343('0x1c')]);_0x1f5098[_0x5343('0x1e')]=_[_0x5343('0x1f')](_0x1f5098[_0x5343('0x1e')],['$and',_0x5343('0x20'),_0x5343('0x21'),'$gte',_0x5343('0x22'),_0x5343('0x23'),_0x5343('0x24'),'$eq','$not',_0x5343('0x25'),'$notBetween',_0x5343('0x26'),'$notIn',_0x5343('0x27'),'$notLike','$iLike',_0x5343('0x28'),_0x5343('0x27'),'$overlap','$contains',_0x5343('0x29'),'$any']);_0xec1ba0[_0x5343('0x2a')]=_['intersection'](_0x1f5098['model'],qs[_0x5343('0x2b')](_0x4cf3c2['query']['fields']));_0xec1ba0[_0x5343('0x2a')]=_0xec1ba0[_0x5343('0x2a')][_0x5343('0x2c')]?_0xec1ba0[_0x5343('0x2a')]:_0x1f5098['model'];if(!_0x4cf3c2['query'][_0x5343('0x2d')](_0x5343('0x2e'))){_0xec1ba0[_0x5343('0x9')]=qs[_0x5343('0x9')](_0x4cf3c2[_0x5343('0x1c')][_0x5343('0x9')]);_0xec1ba0[_0x5343('0x7')]=qs[_0x5343('0x7')](_0x4cf3c2[_0x5343('0x1c')][_0x5343('0x7')]);}_0xec1ba0[_0x5343('0x2f')]=qs[_0x5343('0x30')](_0x4cf3c2['query']['sort']);_0xec1ba0[_0x5343('0x31')]=qs[_0x5343('0x1e')](_['pick'](_0x4cf3c2[_0x5343('0x1c')],_0x1f5098['filters']),_0x1eb3bd);if(_0x4cf3c2[_0x5343('0x1c')][_0x5343('0x32')]){_0xec1ba0[_0x5343('0x31')]=_[_0x5343('0x33')](_0xec1ba0['where'],{'$or':_['map'](_0x1eb3bd,function(_0x3d7e4c){if(_0x3d7e4c['type']!==_0x5343('0x34')){var _0x11954b={};_0x11954b[_0x3d7e4c['name']]={'$like':'%'+_0x4cf3c2[_0x5343('0x1c')]['filter']+'%'};return _0x11954b;}})});}_0xec1ba0=_['merge']({},_0xec1ba0,_0x4cf3c2[_0x5343('0x35')]);var _0x16383f={'where':_0xec1ba0[_0x5343('0x31')]};return db[_0x5343('0x16')]['count'](_0x16383f)['then'](function(_0x5a0663){_0x489e1c['count']=_0x5a0663;if(_0x4cf3c2[_0x5343('0x1c')][_0x5343('0x36')]){_0xec1ba0[_0x5343('0x37')]=[{'all':!![]}];}return db[_0x5343('0x16')][_0x5343('0x38')](_0xec1ba0);})[_0x5343('0x39')](function(_0x3c112a){_0x489e1c['rows']=_0x3c112a;return _0x489e1c;})[_0x5343('0x39')](respondWithFilteredResult(_0x432992,_0xec1ba0))['catch'](handleError(_0x432992,null));};exports[_0x5343('0x3a')]=function(_0x3c6d7b,_0x35511b){var _0x2f004a={'raw':!![],'where':{'id':_0x3c6d7b[_0x5343('0x3b')]['id']}},_0x849368={};_0x849368[_0x5343('0x1b')]=_['keys'](db[_0x5343('0x16')]['rawAttributes']);_0x849368[_0x5343('0x1c')]=_[_0x5343('0x1d')](_0x3c6d7b[_0x5343('0x1c')]);_0x849368[_0x5343('0x1e')]=_[_0x5343('0x3c')](_0x849368[_0x5343('0x1b')],_0x849368[_0x5343('0x1c')]);_0x2f004a['attributes']=_[_0x5343('0x3c')](_0x849368[_0x5343('0x1b')],qs['fields'](_0x3c6d7b[_0x5343('0x1c')][_0x5343('0x2b')]));_0x2f004a['attributes']=_0x2f004a['attributes'][_0x5343('0x2c')]?_0x2f004a[_0x5343('0x2a')]:_0x849368[_0x5343('0x1b')];if(_0x3c6d7b['query'][_0x5343('0x36')]){_0x2f004a[_0x5343('0x37')]=[{'all':!![]}];}_0x2f004a=_[_0x5343('0x33')]({},_0x2f004a,_0x3c6d7b[_0x5343('0x35')]);return db[_0x5343('0x16')][_0x5343('0x3d')](_0x2f004a)[_0x5343('0x39')](handleEntityNotFound(_0x35511b,null))['then'](respondWithResult(_0x35511b,null))[_0x5343('0x3e')](handleError(_0x35511b,null));};exports[_0x5343('0x3f')]=function(_0x111c10,_0x117671){return db[_0x5343('0x16')][_0x5343('0x3f')](_0x111c10[_0x5343('0x40')],{})[_0x5343('0x39')](respondWithResult(_0x117671,0xc9))[_0x5343('0x3e')](handleError(_0x117671,null));};exports[_0x5343('0xe')]=function(_0xd4e75,_0x15cca4){if(_0xd4e75[_0x5343('0x40')]['id']){delete _0xd4e75[_0x5343('0x40')]['id'];}return db[_0x5343('0x16')]['find']({'where':{'id':_0xd4e75[_0x5343('0x3b')]['id']}})[_0x5343('0x39')](handleEntityNotFound(_0x15cca4,null))['then'](saveUpdates(_0xd4e75[_0x5343('0x40')],null))[_0x5343('0x39')](respondWithResult(_0x15cca4,null))[_0x5343('0x3e')](handleError(_0x15cca4,null));};exports[_0x5343('0x41')]=function(_0x194316,_0x5bf69c){return db[_0x5343('0x16')]['describe']()['then'](respondWithResult(_0x5bf69c,null))[_0x5343('0x3e')](handleError(_0x5bf69c,null));};exports[_0x5343('0x42')]=function(_0x10329c,_0x1cd4ed){var _0x4bc427;var _0x15c77b=_0x10329c[_0x5343('0x3b')]['id'];return db[_0x5343('0x16')][_0x5343('0x3d')]({'where':{'id':_0x10329c[_0x5343('0x3b')]['id']}})[_0x5343('0x39')](handleEntityNotFound(_0x1cd4ed,null))[_0x5343('0x39')](function(_0x39aee1){if(_0x39aee1){return _0x39aee1[_0x5343('0x42')]()[_0x5343('0x39')](function(_0x566d71){return _0x566d71;});}})[_0x5343('0x39')](function(_0x2184e9){_0x4bc427=_0x2184e9;if(_0x2184e9){if(_0x2184e9[_0x5343('0x43')]||_0x2184e9[_0x5343('0x44')]){return db[_0x2184e9[_0x5343('0x43')]?_0x5343('0x45'):_0x5343('0x46')][_0x5343('0x3d')]({'where':{'id':_0x2184e9[_0x5343('0x43')]?_0x2184e9[_0x5343('0x43')]:_0x2184e9['CampaignId']},'attributes':['id',_0x5343('0x12')],'raw':!![]});}}})['then'](function(_0x50cd81){var _0x32f2bf={};if(_0x50cd81){_[_0x5343('0x33')](_0x32f2bf,_[_0x5343('0x47')](_0x4bc427[_0x5343('0x48')],[_0x5343('0x49'),'updatedAt','id']));_0x32f2bf[_0x5343('0x4a')]=0x15;_0x32f2bf['statedesc']=_0x5343('0x4b');_0x32f2bf['campaign']=_0x50cd81[_0x5343('0x12')];_0x32f2bf['membername']=_0x10329c[_0x5343('0x4c')][_0x5343('0x12')];_0x32f2bf[_0x5343('0x4d')]=_0x10329c[_0x5343('0x4c')]['id'];_0x32f2bf[_0x5343('0x4b')]=!![];_0x32f2bf['deletedat']=moment()[_0x5343('0x4e')](_0x5343('0x4f'));_0x32f2bf[_0x5343('0x50')]=_0x4bc427[_0x5343('0x51')];_0x32f2bf[_0x5343('0x52')]=_0x4bc427['VoiceQueueId']?'queue':_0x5343('0x53');return db['CmContact'][_0x5343('0x3d')]({'where':{'id':_0x32f2bf[_0x5343('0x54')]},'attributes':[_0x5343('0x55'),_0x5343('0x56')]})[_0x5343('0x39')](function(_0x434867){if(!_[_0x5343('0x57')](_0x1cd4ed)&&!_['isNil'](_0x434867[_0x5343('0x55')])){_0x32f2bf[_0x5343('0x58')]=_0x434867['firstName'];if(!_[_0x5343('0x57')](_0x434867['lastName'])){_0x32f2bf[_0x5343('0x58')]+='\x20'+_0x434867['lastName'];}}})[_0x5343('0x59')](function(){return db['CmHopperFinal'][_0x5343('0x3f')](_0x32f2bf);});}})[_0x5343('0x39')](function(_0x44d173){return db[_0x5343('0x5a')][_0x5343('0x42')]({'where':{'CmHopperId':_0x15c77b}});})[_0x5343('0x39')](function(){return _0x1cd4ed['status'](0xcc)[_0x5343('0x5b')]();})[_0x5343('0x3e')](handleError(_0x1cd4ed,null));};exports[_0x5343('0x5c')]=function(_0x201f20,_0x59ea40){var _0xd0ce1d=[];return db[_0x5343('0x5d')]['describe']()[_0x5343('0x39')](function(_0x25635d){_0xd0ce1d=_[_0x5343('0x1d')](_0x25635d);return _0x201f20['user'][_0x5343('0x5e')]({'where':{'type':_0x5343('0x5f'),'dialActive':!![],'dialMethod':_0x5343('0x60')},'attributes':['id',_0x5343('0x61'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x5343('0x39')](function(_0x60fffb){if(_0x60fffb&&_0x60fffb[_0x5343('0x2c')]){return db[_0x5343('0x62')][_0x5343('0x63')](function(_0x49b347){var _0x52c679={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5343('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x60fffb,'id')},'$or':[{'UserId':null},{'UserId':_0x201f20[_0x5343('0x4c')]['id']}]};var _0x368201={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x60fffb)[_0x5343('0x32')](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x201f20[_0x5343('0x4c')]['id']}]};var _0x1a2096={'$or':[_0x52c679,_0x368201]};var _0x1c8bae=[];if(_0x201f20[_0x5343('0x40')][_0x5343('0x64')]&&_0x201f20[_0x5343('0x40')][_0x5343('0x64')]===_0x5343('0x65')){if(!_['isEmpty'](_0x201f20['body']['hopperIds'])){_0x1a2096['id']={'$in':_0x201f20[_0x5343('0x40')][_0x5343('0x66')]};}_0x1c8bae=[['priority',_0x5343('0x67')],['scheduledAt',_0x60fffb[0x0][_0x5343('0x61')]===_0x5343('0x67')?_0x5343('0x68'):_0x5343('0x67')],db[_0x5343('0x62')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x5343('0x69')](_0x201f20[_0x5343('0x40')][_0x5343('0x66')])){_0x1a2096['id']={'$notIn':_0x201f20[_0x5343('0x40')][_0x5343('0x66')]};}_0x1c8bae=[['priority',_0x5343('0x68')],['scheduledAt',_0x60fffb[0x0]['dialOrderByScheduledAt']],db[_0x5343('0x62')][_0x5343('0x6a')](_0x5343('0x6b')),['id',_0x5343('0x67')]];}return db[_0x5343('0x16')][_0x5343('0x6c')]({'attributes':['id',_0x5343('0x6d'),_0x5343('0x51'),'recallme'],'where':_0x1a2096,'order':_0x1c8bae,'transaction':_0x49b347,'lock':_0x49b347[_0x5343('0x6e')]['UPDATE'],'include':[{'model':db[_0x5343('0x5d')],'as':_0x5343('0x6f'),'attributes':_0xd0ce1d,'include':[{'model':db[_0x5343('0x70')],'as':_0x5343('0x71'),'attributes':['id',_0x5343('0x12')]}]},{'model':db[_0x5343('0x72')],'as':'List','attributes':['id','name']},{'model':db[_0x5343('0x45')],'as':'Queue','attributes':['id','name','dialActive']}]})['then'](function(_0x35af3b){if(_0x35af3b){return _0x35af3b[_0x5343('0xe')]({'UserId':_0x201f20[_0x5343('0x4c')]['id']},{'transaction':_0x49b347});}});});}})[_0x5343('0x39')](handleEntityNotFound(_0x59ea40,null))[_0x5343('0x39')](respondWithResult(_0x59ea40,null))[_0x5343('0x3e')](handleError(_0x59ea40,null));};exports[_0x5343('0x73')]=function(_0x16c13e,_0x1f86a0,_0x2c5f5f){var _0x5a450a=[];var _0x5f55ae=_0x16c13e[_0x5343('0x3b')]['id'];var _0x3b8ed1=_0x16c13e[_0x5343('0x4c')]['id'];return db['CmContact'][_0x5343('0x41')]()['then'](function(_0xcda1d1){_0x5a450a=_[_0x5343('0x1d')](_0xcda1d1);return db['sequelize']['transaction'](function(_0x1fa24e){const _0x57ffb2={'id':_0x5f55ae};return db['CmHopper']['findOne']({'attributes':['id',_0x5343('0x6d'),_0x5343('0x74')],'where':_0x57ffb2,'transaction':_0x1fa24e,'lock':_0x1fa24e[_0x5343('0x6e')][_0x5343('0x75')],'include':[{'model':db[_0x5343('0x5d')],'as':'Contact','attributes':_0x5a450a,'include':[{'model':db['CmCompany'],'as':_0x5343('0x71'),'attributes':['id',_0x5343('0x12')]}]},{'model':db[_0x5343('0x72')],'as':_0x5343('0x76'),'attributes':['id',_0x5343('0x12')]},{'model':db[_0x5343('0x45')],'as':_0x5343('0x77'),'attributes':['id',_0x5343('0x12'),_0x5343('0x78')]}]})[_0x5343('0x39')](function(_0x4c4ff7){if(_0x4c4ff7){return _0x4c4ff7[_0x5343('0xe')]({'UserId':_0x3b8ed1},{'transaction':_0x1fa24e});}});});})[_0x5343('0x39')](handleEntityNotFound(_0x1f86a0,null))[_0x5343('0x39')](respondWithResult(_0x1f86a0,null))[_0x5343('0x3e')](handleError(_0x1f86a0,null));};exports[_0x5343('0x79')]=function(_0x268de3,_0x1785da){return _0x268de3[_0x5343('0x4c')][_0x5343('0x5e')]({'where':{'type':_0x5343('0x5f'),'dialActive':!![],'dialMethod':_0x5343('0x60')},'attributes':['id'],'raw':!![]})[_0x5343('0x39')](function(_0x58ec51){if(_0x58ec51&&_0x58ec51[_0x5343('0x2c')]){return db[_0x5343('0x16')][_0x5343('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x5343('0x15')](_0x58ec51,'id')},'$or':[{'UserId':null},{'UserId':_0x268de3['user']['id']}]}});}return 0x0;})[_0x5343('0x39')](function(_0xfe492a){if(!_[_0x5343('0x57')](_0xfe492a)&&_['isNumber'](_0xfe492a)){return _0x1785da[_0x5343('0xb')](0xc8)['json']({'contacts':_0xfe492a});}else{logger[_0x5343('0x10')](_0x5343('0x7a'),_0x5343('0x79'),0x194,'entity\x20not\x20found');_0x1785da[_0x5343('0xf')](0x194);}})['catch'](handleError(_0x1785da,null));};exports['getTimezones']=function(_0x182455,_0x136138){var _0x4f339d=shared[_0x5343('0x7b')];var _0x579f84=[];_['map'](_0x4f339d,function(_0x553b9a){_0x579f84[_0x5343('0x7c')]({'id':_0x553b9a[_0x5343('0x12')],'name':_0x553b9a[_0x5343('0x12')],'utcOffset':_0x553b9a[_0x5343('0x7d')]});});return _0x136138[_0x5343('0xb')](0xc8)[_0x5343('0x6')]({'tz':_0x579f84});};exports[_0x5343('0x7e')]=function(_0x37d128,_0x36d9b8){var _0x36ac0b=shared[_0x5343('0x7b')];var _0xd287d2={};if(!_[_0x5343('0x57')](_0x36ac0b[_0x37d128['body']['id']]))_0xd287d2=_0x36ac0b[_0x37d128['body']['id']];return _0x36d9b8[_0x5343('0xb')](0xc8)[_0x5343('0x6')](_0xd287d2);}; \ No newline at end of file +var _0x85d0=['$between','$like','$notLike','$iLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','keys','includeAll','options','find','create','body','describe','destroy','VoiceQueueId','CampaignId','createdAt','state','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','lastName','isNil','calleridname','firstName','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','scheduledAt','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','scheduledat','LOCK','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','api','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','update','then','error','stack','name','send','index','CmHopper','rawAttributes','fieldName','type','model','map','query','intersection','filters','concat','$or','$gt','$gte','$lte','$ne','$eq','$not'];(function(_0x183aeb,_0x357449){var _0x36a876=function(_0x1f61d5){while(--_0x1f61d5){_0x183aeb['push'](_0x183aeb['shift']());}};_0x36a876(++_0x357449);}(_0x85d0,0x164));var _0x085d=function(_0x26422b,_0x4a27c5){_0x26422b=_0x26422b-0x0;var _0x4bcf11=_0x85d0[_0x26422b];return _0x4bcf11;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x085d('0x0'));var shared=require(_0x085d('0x1'));var db=require(_0x085d('0x2'))['db'];function respondWithResult(_0x313db8,_0x231765){_0x231765=_0x231765||0xc8;return function(_0x19ae4c){if(_0x19ae4c){return _0x313db8['status'](_0x231765)[_0x085d('0x3')](_0x19ae4c);}};}function respondWithFilteredResult(_0x5c917f,_0x364f09){return function(_0x9acc97){if(_0x9acc97){var _0x2a6902=typeof _0x364f09['offset']===_0x085d('0x4')&&typeof _0x364f09[_0x085d('0x5')]===_0x085d('0x4');var _0x3129a8=_0x9acc97[_0x085d('0x6')];var _0x6450ab=_0x2a6902?0x0:_0x364f09[_0x085d('0x7')];var _0x985cb3=_0x2a6902?_0x9acc97[_0x085d('0x6')]:_0x364f09['offset']+_0x364f09[_0x085d('0x5')];var _0x19b205;if(_0x985cb3>=_0x3129a8){_0x985cb3=_0x3129a8;_0x19b205=0xc8;}else{_0x19b205=0xce;}_0x5c917f[_0x085d('0x8')](_0x19b205);return _0x5c917f[_0x085d('0x9')]('Content-Range',_0x6450ab+'-'+_0x985cb3+'/'+_0x3129a8)[_0x085d('0x3')](_0x9acc97);}return null;};}function saveUpdates(_0x2bd6ae,_0x5c6c27){return function(_0x2e0714){if(_0x2e0714){return _0x2e0714[_0x085d('0xa')](_0x2bd6ae)[_0x085d('0xb')](function(_0x6b21d1){return _0x6b21d1;});}return null;};}function handleEntityNotFound(_0x5a5252,_0x4b87b9){return function(_0x19ce18){if(!_0x19ce18){_0x5a5252['sendStatus'](0x194);}return _0x19ce18;};}function handleError(_0x536f36,_0x267374){_0x267374=_0x267374||0x1f4;return function(_0x334263){logger[_0x085d('0xc')](_0x334263[_0x085d('0xd')]);if(_0x334263[_0x085d('0xe')]){delete _0x334263['name'];}_0x536f36[_0x085d('0x8')](_0x267374)[_0x085d('0xf')](_0x334263);};}exports[_0x085d('0x10')]=function(_0x1b0a6c,_0x3e566f){var _0x1c9de6={},_0x5c046e={},_0x6f7604={'count':0x0,'rows':[]};var _0x1195d5=_['map'](db[_0x085d('0x11')][_0x085d('0x12')],function(_0x159291){return{'name':_0x159291[_0x085d('0x13')],'type':_0x159291[_0x085d('0x14')]['key']};});_0x5c046e[_0x085d('0x15')]=_[_0x085d('0x16')](_0x1195d5,_0x085d('0xe'));_0x5c046e[_0x085d('0x17')]=_['keys'](_0x1b0a6c['query']);_0x5c046e['filters']=_[_0x085d('0x18')](_0x5c046e[_0x085d('0x15')],_0x5c046e[_0x085d('0x17')]);_0x5c046e[_0x085d('0x19')]=_[_0x085d('0x1a')](_0x5c046e[_0x085d('0x19')],['$and',_0x085d('0x1b'),_0x085d('0x1c'),_0x085d('0x1d'),'$lt',_0x085d('0x1e'),_0x085d('0x1f'),_0x085d('0x20'),_0x085d('0x21'),_0x085d('0x22'),'$notBetween','$in','$notIn',_0x085d('0x23'),_0x085d('0x24'),_0x085d('0x25'),'$notILike',_0x085d('0x23'),_0x085d('0x26'),_0x085d('0x27'),'$contained',_0x085d('0x28')]);_0x1c9de6[_0x085d('0x29')]=_[_0x085d('0x18')](_0x5c046e[_0x085d('0x15')],qs['fields'](_0x1b0a6c[_0x085d('0x17')][_0x085d('0x2a')]));_0x1c9de6['attributes']=_0x1c9de6[_0x085d('0x29')][_0x085d('0x2b')]?_0x1c9de6['attributes']:_0x5c046e[_0x085d('0x15')];if(!_0x1b0a6c[_0x085d('0x17')][_0x085d('0x2c')]('nolimit')){_0x1c9de6[_0x085d('0x5')]=qs[_0x085d('0x5')](_0x1b0a6c[_0x085d('0x17')]['limit']);_0x1c9de6[_0x085d('0x7')]=qs['offset'](_0x1b0a6c[_0x085d('0x17')][_0x085d('0x7')]);}_0x1c9de6[_0x085d('0x2d')]=qs[_0x085d('0x2e')](_0x1b0a6c['query'][_0x085d('0x2e')]);_0x1c9de6[_0x085d('0x2f')]=qs[_0x085d('0x19')](_[_0x085d('0x30')](_0x1b0a6c['query'],_0x5c046e['filters']),_0x1195d5);if(_0x1b0a6c[_0x085d('0x17')][_0x085d('0x31')]){_0x1c9de6[_0x085d('0x2f')]=_[_0x085d('0x32')](_0x1c9de6[_0x085d('0x2f')],{'$or':_[_0x085d('0x16')](_0x1195d5,function(_0x165eff){if(_0x165eff[_0x085d('0x14')]!==_0x085d('0x33')){var _0x596862={};_0x596862[_0x165eff[_0x085d('0xe')]]={'$like':'%'+_0x1b0a6c[_0x085d('0x17')]['filter']+'%'};return _0x596862;}})});}_0x1c9de6=_[_0x085d('0x32')]({},_0x1c9de6,_0x1b0a6c['options']);var _0x1cc755={'where':_0x1c9de6[_0x085d('0x2f')]};return db['CmHopper'][_0x085d('0x6')](_0x1cc755)[_0x085d('0xb')](function(_0x26d1f2){_0x6f7604[_0x085d('0x6')]=_0x26d1f2;if(_0x1b0a6c[_0x085d('0x17')]['includeAll']){_0x1c9de6[_0x085d('0x34')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1c9de6);})[_0x085d('0xb')](function(_0x32bf4f){_0x6f7604[_0x085d('0x35')]=_0x32bf4f;return _0x6f7604;})[_0x085d('0xb')](respondWithFilteredResult(_0x3e566f,_0x1c9de6))[_0x085d('0x36')](handleError(_0x3e566f,null));};exports['show']=function(_0x10d5cf,_0x47e1e8){var _0x3a8646={'raw':!![],'where':{'id':_0x10d5cf[_0x085d('0x37')]['id']}},_0x65ec6d={};_0x65ec6d['model']=_[_0x085d('0x38')](db['CmHopper'][_0x085d('0x12')]);_0x65ec6d[_0x085d('0x17')]=_['keys'](_0x10d5cf[_0x085d('0x17')]);_0x65ec6d[_0x085d('0x19')]=_[_0x085d('0x18')](_0x65ec6d['model'],_0x65ec6d['query']);_0x3a8646[_0x085d('0x29')]=_[_0x085d('0x18')](_0x65ec6d[_0x085d('0x15')],qs[_0x085d('0x2a')](_0x10d5cf[_0x085d('0x17')][_0x085d('0x2a')]));_0x3a8646[_0x085d('0x29')]=_0x3a8646[_0x085d('0x29')][_0x085d('0x2b')]?_0x3a8646[_0x085d('0x29')]:_0x65ec6d['model'];if(_0x10d5cf['query'][_0x085d('0x39')]){_0x3a8646[_0x085d('0x34')]=[{'all':!![]}];}_0x3a8646=_[_0x085d('0x32')]({},_0x3a8646,_0x10d5cf[_0x085d('0x3a')]);return db[_0x085d('0x11')][_0x085d('0x3b')](_0x3a8646)[_0x085d('0xb')](handleEntityNotFound(_0x47e1e8,null))[_0x085d('0xb')](respondWithResult(_0x47e1e8,null))[_0x085d('0x36')](handleError(_0x47e1e8,null));};exports[_0x085d('0x3c')]=function(_0x20a4ef,_0x4d5167){return db[_0x085d('0x11')][_0x085d('0x3c')](_0x20a4ef[_0x085d('0x3d')],{})[_0x085d('0xb')](respondWithResult(_0x4d5167,0xc9))[_0x085d('0x36')](handleError(_0x4d5167,null));};exports['update']=function(_0x13ba2d,_0x544729){if(_0x13ba2d[_0x085d('0x3d')]['id']){delete _0x13ba2d['body']['id'];}return db['CmHopper'][_0x085d('0x3b')]({'where':{'id':_0x13ba2d[_0x085d('0x37')]['id']}})[_0x085d('0xb')](handleEntityNotFound(_0x544729,null))[_0x085d('0xb')](saveUpdates(_0x13ba2d[_0x085d('0x3d')],null))['then'](respondWithResult(_0x544729,null))['catch'](handleError(_0x544729,null));};exports['describe']=function(_0x580b91,_0x5aeb4a){return db[_0x085d('0x11')][_0x085d('0x3e')]()['then'](respondWithResult(_0x5aeb4a,null))[_0x085d('0x36')](handleError(_0x5aeb4a,null));};exports['destroy']=function(_0x5df4cf,_0x415a4b){var _0x20cdcb;var _0x1da4b8=_0x5df4cf[_0x085d('0x37')]['id'];return db['CmHopper'][_0x085d('0x3b')]({'where':{'id':_0x5df4cf['params']['id']}})[_0x085d('0xb')](handleEntityNotFound(_0x415a4b,null))[_0x085d('0xb')](function(_0x5d6f22){if(_0x5d6f22){return _0x5d6f22[_0x085d('0x3f')]()[_0x085d('0xb')](function(_0x298f6f){return _0x298f6f;});}})[_0x085d('0xb')](function(_0x58955e){_0x20cdcb=_0x58955e;if(_0x58955e){if(_0x58955e[_0x085d('0x40')]||_0x58955e['CampaignId']){return db[_0x58955e[_0x085d('0x40')]?'VoiceQueue':'Campaign'][_0x085d('0x3b')]({'where':{'id':_0x58955e[_0x085d('0x40')]?_0x58955e[_0x085d('0x40')]:_0x58955e[_0x085d('0x41')]},'attributes':['id',_0x085d('0xe')],'raw':!![]});}}})[_0x085d('0xb')](function(_0x1c3081){var _0x1bac21={};if(_0x1c3081){_['merge'](_0x1bac21,_['omit'](_0x20cdcb['dataValues'],[_0x085d('0x42'),'updatedAt','id']));_0x1bac21[_0x085d('0x43')]=0x15;_0x1bac21['statedesc']=_0x085d('0x44');_0x1bac21[_0x085d('0x45')]=_0x1c3081[_0x085d('0xe')];_0x1bac21[_0x085d('0x46')]=_0x5df4cf['user']['name'];_0x1bac21[_0x085d('0x47')]=_0x5df4cf[_0x085d('0x48')]['id'];_0x1bac21['deleted']=!![];_0x1bac21[_0x085d('0x49')]=moment()[_0x085d('0x4a')](_0x085d('0x4b'));_0x1bac21[_0x085d('0x4c')]=_0x20cdcb[_0x085d('0x4d')];_0x1bac21[_0x085d('0x4e')]=_0x20cdcb[_0x085d('0x40')]?_0x085d('0x4f'):'ivr';return db[_0x085d('0x50')]['find']({'where':{'id':_0x1bac21[_0x085d('0x51')]},'attributes':['firstName',_0x085d('0x52')]})['then'](function(_0x402157){if(!_[_0x085d('0x53')](_0x415a4b)&&!_['isNil'](_0x402157['firstName'])){_0x1bac21[_0x085d('0x54')]=_0x402157[_0x085d('0x55')];if(!_[_0x085d('0x53')](_0x402157[_0x085d('0x52')])){_0x1bac21[_0x085d('0x54')]+='\x20'+_0x402157[_0x085d('0x52')];}}})[_0x085d('0x56')](function(){return db[_0x085d('0x57')][_0x085d('0x3c')](_0x1bac21);});}})[_0x085d('0xb')](function(_0x289303){return db[_0x085d('0x58')][_0x085d('0x3f')]({'where':{'CmHopperId':_0x1da4b8}});})[_0x085d('0xb')](function(){return _0x415a4b['status'](0xcc)['end']();})[_0x085d('0x36')](handleError(_0x415a4b,null));};exports[_0x085d('0x59')]=function(_0x4b606d,_0x5b89e1){var _0x4e695e=[];return db[_0x085d('0x50')][_0x085d('0x3e')]()['then'](function(_0x210f01){_0x4e695e=_[_0x085d('0x38')](_0x210f01);return _0x4b606d[_0x085d('0x48')]['getVoiceQueues']({'where':{'type':_0x085d('0x5a'),'dialActive':!![],'dialMethod':_0x085d('0x5b')},'attributes':['id',_0x085d('0x5c'),_0x085d('0x5d')],'raw':!![]});})['then'](function(_0x3fc07e){if(_0x3fc07e&&_0x3fc07e[_0x085d('0x2b')]){return db['sequelize'][_0x085d('0x5e')](function(_0x375779){var _0x1a7ddc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x3fc07e,'id')},'$or':[{'UserId':null},{'UserId':_0x4b606d[_0x085d('0x48')]['id']}]};var _0x586569={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3fc07e)['filter']([_0x085d('0x5d'),0x0])['map']('id')[_0x085d('0x5f')]()},'$or':[{'UserId':null},{'UserId':_0x4b606d[_0x085d('0x48')]['id']}]};var _0x50fe13={'$or':[_0x1a7ddc,_0x586569]};var _0x1f23f2=[];if(_0x4b606d[_0x085d('0x3d')]['direction']&&_0x4b606d[_0x085d('0x3d')][_0x085d('0x60')]===_0x085d('0x61')){if(!_[_0x085d('0x62')](_0x4b606d['body']['hopperIds'])){_0x50fe13['id']={'$in':_0x4b606d[_0x085d('0x3d')][_0x085d('0x63')]};}_0x1f23f2=[[_0x085d('0x64'),_0x085d('0x65')],['scheduledAt',_0x3fc07e[0x0]['dialOrderByScheduledAt']==='ASC'?_0x085d('0x66'):'ASC'],db['sequelize'][_0x085d('0x67')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x085d('0x66')]];}else{if(!_[_0x085d('0x62')](_0x4b606d[_0x085d('0x3d')][_0x085d('0x63')])){_0x50fe13['id']={'$notIn':_0x4b606d['body'][_0x085d('0x63')]};}_0x1f23f2=[[_0x085d('0x64'),_0x085d('0x66')],[_0x085d('0x68'),_0x3fc07e[0x0][_0x085d('0x5c')]],db[_0x085d('0x69')][_0x085d('0x67')](_0x085d('0x6a')),['id',_0x085d('0x65')]];}return db[_0x085d('0x11')]['findOne']({'attributes':['id','scheduledat',_0x085d('0x4d'),_0x085d('0x6b')],'where':_0x50fe13,'order':_0x1f23f2,'transaction':_0x375779,'lock':_0x375779['LOCK'][_0x085d('0x6c')],'include':[{'model':db[_0x085d('0x50')],'as':_0x085d('0x6d'),'attributes':_0x4e695e,'include':[{'model':db[_0x085d('0x6e')],'as':_0x085d('0x6f'),'attributes':['id',_0x085d('0xe')]}]},{'model':db[_0x085d('0x70')],'as':_0x085d('0x71'),'attributes':['id',_0x085d('0xe')]},{'model':db[_0x085d('0x72')],'as':_0x085d('0x73'),'attributes':['id',_0x085d('0xe'),_0x085d('0x74')]}]})[_0x085d('0xb')](function(_0xf17978){if(_0xf17978){return _0xf17978[_0x085d('0xa')]({'UserId':_0x4b606d[_0x085d('0x48')]['id']},{'transaction':_0x375779});}});});}})['then'](handleEntityNotFound(_0x5b89e1,null))[_0x085d('0xb')](respondWithResult(_0x5b89e1,null))[_0x085d('0x36')](handleError(_0x5b89e1,null));};exports[_0x085d('0x75')]=function(_0x53d5ba,_0x326e94,_0x4de098){var _0x53fd1b=[];var _0x261ac7=_0x53d5ba[_0x085d('0x37')]['id'];var _0x4ba7a8=_0x53d5ba[_0x085d('0x48')]['id'];return db[_0x085d('0x50')][_0x085d('0x3e')]()[_0x085d('0xb')](function(_0x2f21c0){_0x53fd1b=_['keys'](_0x2f21c0);return db[_0x085d('0x69')][_0x085d('0x5e')](function(_0x5ada01){const _0x52cc7b={'id':_0x261ac7};return db[_0x085d('0x11')]['findOne']({'attributes':['id',_0x085d('0x76'),_0x085d('0x6b')],'where':_0x52cc7b,'transaction':_0x5ada01,'lock':_0x5ada01[_0x085d('0x77')][_0x085d('0x6c')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x53fd1b,'include':[{'model':db[_0x085d('0x6e')],'as':_0x085d('0x6f'),'attributes':['id',_0x085d('0xe')]}]},{'model':db['CmList'],'as':_0x085d('0x71'),'attributes':['id','name']},{'model':db[_0x085d('0x72')],'as':_0x085d('0x73'),'attributes':['id',_0x085d('0xe'),'dialActive']}]})[_0x085d('0xb')](function(_0x5994ec){if(_0x5994ec){return _0x5994ec[_0x085d('0xa')]({'UserId':_0x4ba7a8},{'transaction':_0x5ada01});}});});})[_0x085d('0xb')](handleEntityNotFound(_0x326e94,null))[_0x085d('0xb')](respondWithResult(_0x326e94,null))['catch'](handleError(_0x326e94,null));};exports['getOpenContacts']=function(_0x1c62e5,_0x2bc093){return _0x1c62e5[_0x085d('0x48')][_0x085d('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x143289){if(_0x143289&&_0x143289[_0x085d('0x2b')]){return db[_0x085d('0x11')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x085d('0x4b'))},'VoiceQueueId':{'$in':_[_0x085d('0x16')](_0x143289,'id')},'$or':[{'UserId':null},{'UserId':_0x1c62e5[_0x085d('0x48')]['id']}]}});}return 0x0;})['then'](function(_0x16f6e7){if(!_['isNil'](_0x16f6e7)&&_[_0x085d('0x79')](_0x16f6e7)){return _0x2bc093[_0x085d('0x8')](0xc8)['json']({'contacts':_0x16f6e7});}else{logger[_0x085d('0xc')](_0x085d('0x7a'),_0x085d('0x7b'),0x194,'entity\x20not\x20found');_0x2bc093[_0x085d('0x7c')](0x194);}})[_0x085d('0x36')](handleError(_0x2bc093,null));};exports[_0x085d('0x7d')]=function(_0x18809c,_0x2de70b){var _0x562711=shared[_0x085d('0x7e')];var _0x11a937=[];_[_0x085d('0x16')](_0x562711,function(_0x4f866b){_0x11a937[_0x085d('0x7f')]({'id':_0x4f866b[_0x085d('0xe')],'name':_0x4f866b[_0x085d('0xe')],'utcOffset':_0x4f866b[_0x085d('0x80')]});});return _0x2de70b[_0x085d('0x8')](0xc8)[_0x085d('0x3')]({'tz':_0x11a937});};exports[_0x085d('0x81')]=function(_0x32cbca,_0x57706d){var _0x1f3144=shared['timezones'];var _0x4a4e8e={};if(!_[_0x085d('0x53')](_0x1f3144[_0x32cbca[_0x085d('0x3d')]['id']]))_0x4a4e8e=_0x1f3144[_0x32cbca[_0x085d('0x3d')]['id']];return _0x57706d[_0x085d('0x8')](0xc8)[_0x085d('0x3')](_0x4a4e8e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 64d19ec..2a2c135 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(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x6f47,0xc7));var _0x76f4=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x6f47[_0x1abb09];return _0xea1c07;};'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 _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x9a77af,_0x5e3566){var _0x212a19=function(_0x3519e8){while(--_0x3519e8){_0x9a77af['push'](_0x9a77af['shift']());}};_0x212a19(++_0x5e3566);}(_0x7096,0x10c));var _0x6709=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7096[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index fbf01f8..c35130a 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 _0x7028=['sequelize','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','UPDATE','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Contact','CmList','List','CmHopperHandlePreviewRecallNotifications','moment','bluebird','../../config/logger','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','map','include','model','then','info','debug','stringify','catch','error','ShowCmHopper','find','raw','message','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','LOCK','keys','Agent','name','voicePause','length','UserId','includes','push','all','dataValues'];(function(_0x1312a3,_0x56e689){var _0x7550ab=function(_0x410b9f){while(--_0x410b9f){_0x1312a3['push'](_0x1312a3['shift']());}};_0x7550ab(++_0x56e689);}(_0x7028,0x157));var _0x8702=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7028[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8702('0x0'));var BPromise=require(_0x8702('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x8702('0x2'))('rpc');exports[_0x8702('0x3')]=function(_0x121605){var _0x3536ec=this;return new Promise(function(_0x35a601,_0x570931){return db[_0x8702('0x4')][_0x8702('0x5')]({'raw':_0x121605[_0x8702('0x6')]?_0x121605[_0x8702('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x121605['options']?_0x121605['options'][_0x8702('0x7')]||null:null,'attributes':_0x121605[_0x8702('0x6')]?_0x121605[_0x8702('0x6')][_0x8702('0x8')]||null:null,'limit':_0x121605['options']?_0x121605[_0x8702('0x6')][_0x8702('0x9')]||null:null,'include':_0x121605['options']?_0x121605[_0x8702('0x6')]['include']?_[_0x8702('0xa')](_0x121605['options'][_0x8702('0xb')],function(_0xc777b){return{'model':db[_0xc777b[_0x8702('0xc')]],'as':_0xc777b['as'],'attributes':_0xc777b[_0x8702('0x8')],'include':_0xc777b['include']?_[_0x8702('0xa')](_0xc777b[_0x8702('0xb')],function(_0x152bdd){return{'model':db[_0x152bdd[_0x8702('0xc')]],'as':_0x152bdd['as'],'attributes':_0x152bdd[_0x8702('0x8')],'include':_0x152bdd[_0x8702('0xb')]?_[_0x8702('0xa')](_0x152bdd[_0x8702('0xb')],function(_0x112b4d){return{'model':db[_0x112b4d['model']],'as':_0x112b4d['as'],'attributes':_0x112b4d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8702('0xd')](function(_0x5ac1c1){logger[_0x8702('0xe')](_0x8702('0x3'),_0x121605);logger[_0x8702('0xf')](_0x8702('0x3'),_0x121605,JSON[_0x8702('0x10')](_0x5ac1c1));_0x35a601(_0x5ac1c1);})[_0x8702('0x11')](function(_0x23f827){logger['error'](_0x8702('0x3'),_0x23f827['message'],_0x121605);_0x570931(_0x3536ec[_0x8702('0x12')](0x1f4,_0x23f827['message']));});});};exports[_0x8702('0x13')]=function(_0x35a448){var _0x12483d=this;return new Promise(function(_0x2e4a19,_0x115e77){return db[_0x8702('0x4')][_0x8702('0x14')]({'raw':_0x35a448[_0x8702('0x6')]?_0x35a448['options'][_0x8702('0x15')]===undefined?!![]:![]:!![],'where':_0x35a448[_0x8702('0x6')]?_0x35a448['options'][_0x8702('0x7')]||null:null,'attributes':_0x35a448[_0x8702('0x6')]?_0x35a448[_0x8702('0x6')][_0x8702('0x8')]||null:null,'include':_0x35a448[_0x8702('0x6')]?_0x35a448[_0x8702('0x6')][_0x8702('0xb')]?_[_0x8702('0xa')](_0x35a448['options'][_0x8702('0xb')],function(_0x5615fc){return{'model':db[_0x5615fc[_0x8702('0xc')]],'as':_0x5615fc['as'],'attributes':_0x5615fc[_0x8702('0x8')],'include':_0x5615fc[_0x8702('0xb')]?_['map'](_0x5615fc[_0x8702('0xb')],function(_0x1fccd4){return{'model':db[_0x1fccd4[_0x8702('0xc')]],'as':_0x1fccd4['as'],'attributes':_0x1fccd4['attributes'],'include':_0x1fccd4['include']?_[_0x8702('0xa')](_0x1fccd4[_0x8702('0xb')],function(_0x480aca){return{'model':db[_0x480aca[_0x8702('0xc')]],'as':_0x480aca['as'],'attributes':_0x480aca[_0x8702('0x8')]};}):[]};}):[]};}):[]:[]})[_0x8702('0xd')](function(_0x14fde8){logger[_0x8702('0xe')](_0x8702('0x13'),_0x35a448);logger[_0x8702('0xf')]('ShowCmHopper',_0x35a448,JSON[_0x8702('0x10')](_0x14fde8));_0x2e4a19(_0x14fde8);})[_0x8702('0x11')](function(_0x197c80){logger['error']('ShowCmHopper',_0x197c80[_0x8702('0x16')],_0x35a448);_0x115e77(_0x12483d['error'](0x1f4,_0x197c80['message']));});});};exports[_0x8702('0x17')]=function(_0x512f51){var _0x397fa9=this;return new Promise(function(_0x219596,_0x37d27f){return db[_0x8702('0x4')][_0x8702('0x18')](_0x512f51[_0x8702('0x19')],{'raw':_0x512f51[_0x8702('0x6')]?_0x512f51[_0x8702('0x6')][_0x8702('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x178b0a){logger[_0x8702('0xe')](_0x8702('0x17'),_0x512f51);logger[_0x8702('0xf')](_0x8702('0x17'),_0x512f51,JSON['stringify'](_0x178b0a));_0x219596(_0x178b0a);})[_0x8702('0x11')](function(_0x399a36){logger['error'](_0x8702('0x17'),_0x399a36[_0x8702('0x16')],_0x512f51);_0x37d27f(_0x397fa9['error'](0x1f4,_0x399a36['message']));});});};exports['UpdateCmHopper']=function(_0x3849ec){var _0x433ee3=this;return new Promise(function(_0x47bcfd,_0x487d25){return db[_0x8702('0x4')][_0x8702('0x1a')](_0x3849ec[_0x8702('0x19')],{'raw':_0x3849ec['options']?_0x3849ec[_0x8702('0x6')][_0x8702('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3849ec[_0x8702('0x6')]?_0x3849ec[_0x8702('0x6')][_0x8702('0x7')]||null:null,'attributes':_0x3849ec[_0x8702('0x6')]?_0x3849ec[_0x8702('0x6')][_0x8702('0x8')]||null:null,'limit':_0x3849ec[_0x8702('0x6')]?_0x3849ec['options'][_0x8702('0x9')]||null:null})[_0x8702('0xd')](function(_0x555d27){logger[_0x8702('0xe')](_0x8702('0x1b'),_0x3849ec);logger[_0x8702('0xe')](_0x8702('0x1c'),JSON[_0x8702('0x10')](_0x3849ec[_0x8702('0x6')]['where']),_0x3849ec[_0x8702('0x19')][_0x8702('0x1d')]);logger[_0x8702('0xf')](_0x8702('0x1b'),_0x3849ec,JSON['stringify'](_0x555d27));_0x47bcfd(_0x555d27);})['catch'](function(_0x101068){logger[_0x8702('0x12')]('UpdateCmHopper',_0x101068[_0x8702('0x16')],_0x3849ec);_0x487d25(_0x433ee3[_0x8702('0x12')](0x1f4,_0x101068[_0x8702('0x16')]));});});};exports[_0x8702('0x1e')]=function(_0x4f173c){var _0xdae69a=this;return new Promise(function(_0x2c1e4a,_0x5e2329){return db[_0x8702('0x4')][_0x8702('0x1f')]({'where':_0x4f173c['options']?_0x4f173c[_0x8702('0x6')][_0x8702('0x7')]||null:null})[_0x8702('0xd')](function(_0x43e9a7){logger['info'](_0x8702('0x1e'),_0x4f173c);logger['debug']('DestroyCmHopper',_0x4f173c,JSON[_0x8702('0x10')](_0x43e9a7));_0x2c1e4a(_0x43e9a7);})['catch'](function(_0x3f0996){logger['error'](_0x8702('0x1e'),_0x3f0996['message'],_0x4f173c);_0x5e2329(_0xdae69a[_0x8702('0x12')](0x1f4,_0x3f0996[_0x8702('0x16')]));});});};exports[_0x8702('0x20')]=function(_0x192d45){var _0x1ce08e=this;return new Promise(function(_0x132ae8,_0x5bfb39){return db[_0x8702('0x21')][_0x8702('0x22')]()[_0x8702('0xd')](function(_0x1d5d53){return db['sequelize'][_0x8702('0x23')](function(_0x231912){return db[_0x8702('0x4')][_0x8702('0x5')]({'where':_0x192d45[_0x8702('0x6')]?_0x192d45[_0x8702('0x6')][_0x8702('0x7')]||null:null,'attributes':_0x192d45[_0x8702('0x6')]?_0x192d45[_0x8702('0x6')]['attributes']||null:null,'limit':_0x192d45[_0x8702('0x6')]?_0x192d45[_0x8702('0x6')][_0x8702('0x9')]||null:null,'order':_0x192d45[_0x8702('0x6')]?_0x192d45[_0x8702('0x6')]['order']||null:null,'transaction':_0x231912,'lock':_0x231912[_0x8702('0x24')]['UPDATE'],'include':[{'model':db[_0x8702('0x21')],'as':'Contact','attributes':_[_0x8702('0x25')](_0x1d5d53)},{'model':db['User'],'as':_0x8702('0x26'),'attributes':['id',_0x8702('0x27'),_0x8702('0x28')]}]})['then'](function(_0x59e77f){var _0x19b3a4=[];var _0x572d69=[];for(var _0xe3014f=0x0;_0xe3014f<_0x59e77f[_0x8702('0x29')];_0xe3014f+=0x1){var _0x137a05=_0x59e77f[_0xe3014f][_0x8702('0x2a')];if(_0x137a05===null){_0x19b3a4['push'](_0x59e77f[_0xe3014f][_0x8702('0x1a')](_0x192d45[_0x8702('0x19')],{'transaction':_0x231912}));}else if(!_0x572d69[_0x8702('0x2b')](_0x137a05)){_0x572d69['push'](_0x137a05);_0x19b3a4[_0x8702('0x2c')](_0x59e77f[_0xe3014f]['update'](_0x192d45[_0x8702('0x19')],{'transaction':_0x231912}));}}return BPromise[_0x8702('0x2d')](_0x19b3a4);});})[_0x8702('0xd')](function(_0xc34116){logger[_0x8702('0xe')](_0x8702('0x20'),_0x192d45);if(_0xc34116[_0x8702('0x29')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0xc34116[0x0][_0x8702('0x2e')]['id'],_0xc34116[0x0][_0x8702('0x2e')]['ContactId'],_0xc34116[0x0][_0x8702('0x2e')][_0x8702('0x1d')]);}logger['debug'](_0x8702('0x20'),_0x192d45,JSON[_0x8702('0x10')](_0xc34116));_0x132ae8(_0xc34116);})[_0x8702('0x11')](function(_0x1536d7){logger[_0x8702('0x12')](_0x8702('0x20'),_0x1536d7[_0x8702('0x16')],_0x192d45);_0x5bfb39(_0x1ce08e[_0x8702('0x12')](0x1f4,_0x1536d7[_0x8702('0x16')]));});});});};exports['MoveContactManagedDialer']=function(_0x1d9722){var _0x2241a6=this;return new Promise(function(_0x1b1f49,_0x4ec801){return db[_0x8702('0x2f')][_0x8702('0x23')](function(_0x28480e){return db[_0x8702('0x30')][_0x8702('0x18')](_0x1d9722[_0x8702('0x19')],{'raw':_0x1d9722[_0x8702('0x6')]?_0x1d9722[_0x8702('0x6')][_0x8702('0x15')]===undefined?!![]:![]:!![],'transaction':_0x28480e})['then'](function(){logger[_0x8702('0xe')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x8702('0x10')](_0x1d9722[_0x8702('0x6')][_0x8702('0x7')]),_0x1d9722[_0x8702('0x6')][_0x8702('0x7')]['active']);return db[_0x8702('0x4')][_0x8702('0x1f')]({'where':_0x1d9722['options']?_0x1d9722[_0x8702('0x6')]['where']||null:null,'transaction':_0x28480e});});})['then'](function(_0x5817a7){logger[_0x8702('0xe')](_0x8702('0x31'),_0x1d9722);logger[_0x8702('0xf')](_0x8702('0x31'),_0x1d9722,JSON[_0x8702('0x10')](_0x5817a7));_0x1b1f49(_0x5817a7);})['catch'](function(_0x5a56ad){logger[_0x8702('0x12')](_0x8702('0x31'),_0x5a56ad[_0x8702('0x16')],_0x1d9722);_0x4ec801(_0x2241a6[_0x8702('0x12')](0x1f4,_0x5a56ad['message']));});});};exports[_0x8702('0x32')]=function(_0x285359){var _0x7d1dd9=this;return new Promise(function(_0x44e1aa,_0x5ac050){return db[_0x8702('0x4')][_0x8702('0x5')]({'raw':_0x285359[_0x8702('0x6')]?_0x285359[_0x8702('0x6')][_0x8702('0x15')]===undefined?!![]:![]:!![],'where':_0x285359[_0x8702('0x6')]?_0x285359[_0x8702('0x6')][_0x8702('0x7')]||null:null,'attributes':[[db[_0x8702('0x2f')]['fn'](_0x8702('0x33'),db[_0x8702('0x2f')]['fn']('IF',db[_0x8702('0x2f')][_0x8702('0x34')](_0x8702('0x35')+util[_0x8702('0x36')](_0x8702('0x37'),moment()[_0x8702('0x36')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x8702('0x38')))),_0x8702('0x39')]]})[_0x8702('0xd')](function(_0xd21d53){logger['info']('CountReScheduled',_0x285359);logger[_0x8702('0xf')](_0x8702('0x32'),_0x285359,JSON[_0x8702('0x10')](_0xd21d53));_0x44e1aa(_0xd21d53);})[_0x8702('0x11')](function(_0x3bc2cc){logger[_0x8702('0x12')](_0x8702('0x32'),_0x3bc2cc[_0x8702('0x16')],_0x285359);_0x5ac050(_0x7d1dd9[_0x8702('0x12')](0x1f4,_0x3bc2cc['message']));});});};exports[_0x8702('0x3a')]=function(_0x2cfd3e){var _0x1aceb7=this;return new Promise(function(_0x46c38a,_0x164e7d){return db[_0x8702('0x21')][_0x8702('0x22')]()['then'](function(){return db[_0x8702('0x2f')][_0x8702('0x23')](function(_0x334e2e){return db[_0x8702('0x4')]['findAll']({'where':_0x2cfd3e[_0x8702('0x6')]?_0x2cfd3e['options'][_0x8702('0x7')]||null:null,'attributes':_0x2cfd3e['options']?_0x2cfd3e[_0x8702('0x6')]['attributes']||null:null,'limit':0x1,'order':_0x2cfd3e[_0x8702('0x6')]?_0x2cfd3e['options'][_0x8702('0x3b')]||null:null,'group':db[_0x8702('0x4')][_0x8702('0x2a')],'transaction':_0x334e2e,'lock':_0x334e2e[_0x8702('0x24')][_0x8702('0x3c')],'include':_0x2cfd3e[_0x8702('0x6')]?_0x2cfd3e['options'][_0x8702('0xb')]?_[_0x8702('0xa')](_0x2cfd3e[_0x8702('0x6')]['include'],function(_0x214251){return{'model':db[_0x214251[_0x8702('0xc')]],'as':_0x214251['as'],'attributes':_0x214251['attributes'],'include':_0x214251[_0x8702('0xb')]?_['map'](_0x214251['include'],function(_0x433e37){return{'model':db[_0x433e37[_0x8702('0xc')]],'as':_0x433e37['as'],'attributes':_0x433e37[_0x8702('0x8')],'include':_0x433e37[_0x8702('0xb')]?_[_0x8702('0xa')](_0x433e37[_0x8702('0xb')],function(_0x4c6968){return{'model':db[_0x4c6968[_0x8702('0xc')]],'as':_0x4c6968['as'],'attributes':_0x4c6968[_0x8702('0x8')]};}):[]};}):[]};}):[]:[]})[_0x8702('0xd')](function(_0x3fe692){var _0x2ad536=[];for(var _0x42a1a0=0x0;_0x42a1a0<_0x3fe692[_0x8702('0x29')];_0x42a1a0+=0x1){_0x2ad536[_0x8702('0x2c')](_0x3fe692[_0x42a1a0][_0x8702('0x1a')](_0x2cfd3e['body'],{'transaction':_0x334e2e}));}return BPromise[_0x8702('0x2d')](_0x2ad536);});})[_0x8702('0xd')](function(_0x3cb31a){logger[_0x8702('0xe')](_0x8702('0x3a'),_0x2cfd3e);logger[_0x8702('0xf')](_0x8702('0x3a'),_0x2cfd3e,JSON['stringify'](_0x3cb31a));_0x46c38a(_0x3cb31a);})['catch'](function(_0x28ac12){logger[_0x8702('0x12')](_0x8702('0x3a'),_0x28ac12[_0x8702('0x16')],_0x2cfd3e);_0x164e7d(_0x1aceb7[_0x8702('0x12')](0x1f4,_0x28ac12[_0x8702('0x16')]));});});});};exports[_0x8702('0x3d')]=function(_0x4a402e){var _0x3d8c26=this;return new Promise(function(_0x382d7d,_0x3f3df3){db['CmContact'][_0x8702('0x22')]()[_0x8702('0xd')](function(_0x51e629){return db[_0x8702('0x4')][_0x8702('0x5')]({'raw':_0x4a402e[_0x8702('0x6')]?_0x4a402e[_0x8702('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x4a402e['options']?_0x4a402e[_0x8702('0x6')][_0x8702('0x7')]||null:null,'attributes':_0x4a402e[_0x8702('0x6')]?_0x4a402e[_0x8702('0x6')][_0x8702('0x8')]||null:null,'limit':_0x4a402e[_0x8702('0x6')]?_0x4a402e[_0x8702('0x6')][_0x8702('0x9')]||null:null,'include':_0x4a402e[_0x8702('0x6')]?_0x4a402e[_0x8702('0x6')][_0x8702('0xb')]?_[_0x8702('0xa')](_0x4a402e[_0x8702('0x6')][_0x8702('0xb')],function(_0x358822){return{'model':db[_0x358822['model']],'as':_0x358822['as'],'attributes':_0x358822['as']==='Contact'?_[_0x8702('0x25')](_0x51e629):_0x358822[_0x8702('0x8')],'include':_0x358822[_0x8702('0xb')]?_[_0x8702('0xa')](_0x358822[_0x8702('0xb')],function(_0x16a8f0){return{'model':db[_0x16a8f0[_0x8702('0xc')]],'as':_0x16a8f0['as'],'attributes':_0x16a8f0[_0x8702('0x8')],'include':_0x16a8f0[_0x8702('0xb')]?_[_0x8702('0xa')](_0x16a8f0[_0x8702('0xb')],function(_0x1875df){return{'model':db[_0x1875df[_0x8702('0xc')]],'as':_0x1875df['as'],'attributes':_0x1875df[_0x8702('0x8')]};}):[]};}):[]};}):[]:[]})[_0x8702('0xd')](function(_0x55b07b){logger[_0x8702('0xe')](_0x8702('0x3'),_0x4a402e);logger['debug'](_0x8702('0x3'),_0x4a402e,JSON[_0x8702('0x10')](_0x55b07b));_0x382d7d(_0x55b07b);})[_0x8702('0x11')](function(_0x208d12){logger['error'](_0x8702('0x3'),_0x208d12[_0x8702('0x16')],_0x4a402e);_0x3f3df3(_0x3d8c26['error'](0x1f4,_0x208d12[_0x8702('0x16')]));});});});};exports[_0x8702('0x3e')]=function(_0x34e19c){var _0x445d89=this;return new Promise(function(_0x58c835,_0x5158f9){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x34e19c[_0x8702('0x6')][_0x8702('0x7')][_0x8702('0x3f')]},'attributes':['id',_0x8702('0x40')],'order':[['id',_0x8702('0x41')]]})[_0x8702('0xd')](function(_0x3cc716){logger[_0x8702('0xe')]('getContactByPhone',_0x34e19c);logger[_0x8702('0xf')](_0x8702('0x42'),_0x34e19c,JSON[_0x8702('0x10')](_0x3cc716));_0x58c835(_0x3cc716);})[_0x8702('0x11')](function(_0x70d697){logger[_0x8702('0x12')](_0x8702('0x42'),_0x70d697[_0x8702('0x16')],_0x34e19c);_0x5158f9(_0x445d89[_0x8702('0x12')](0x1f4,_0x70d697[_0x8702('0x16')]));});});};exports['ResetActiveCalls']=function(_0x507143){var _0xafb04c=this;return new Promise(function(_0x2e0891,_0xbddcfc){return db[_0x8702('0x2f')][_0x8702('0x23')](function(_0x56eb1c){var _0xf31b3a=_0x507143[_0x8702('0x6')]&&_0x507143[_0x8702('0x6')]['where']?_0x507143[_0x8702('0x6')][_0x8702('0x7')]:{};return db[_0x8702('0x4')][_0x8702('0x1a')](_0x507143[_0x8702('0x19')],{'where':_0xf31b3a,'transaction':_0x56eb1c})[_0x8702('0xd')](function(_0x306fbb){logger[_0x8702('0xe')](_0x8702('0x43'),_0x507143);logger[_0x8702('0xf')](_0x8702('0x43'),_0x507143,JSON[_0x8702('0x10')](_0x306fbb));_0x2e0891(_0x306fbb);})[_0x8702('0x11')](function(_0x313ea0){logger[_0x8702('0x12')](_0x8702('0x43'),_0x313ea0['message'],_0x507143);_0xbddcfc(_0xafb04c[_0x8702('0x12')](0x1f4,_0x313ea0['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0xe430d5){var _0x21ad91=this;var _0x5e21db=_0xe430d5['body'][_0x8702('0x7')][_0x8702('0x44')];var _0x3d228d=_0xe430d5[_0x8702('0x19')]['where'][_0x8702('0x45')];var _0x525499=_0xe430d5['body'][_0x8702('0x7')][_0x8702('0x46')];return new Promise(function(_0x313f5d,_0xaeca26){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x5e21db},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x8702('0x2f')][_0x8702('0x34')](_0x8702('0x47')+_0x3d228d+_0x8702('0x48')),'$gt':db[_0x8702('0x2f')]['literal'](_0x8702('0x49'))}},'UserId':{'$in':_0x525499}},'include':[{'model':db['CmContact'],'as':_0x8702('0x4a')},{'model':db['User'],'as':_0x8702('0x26'),'attributes':['id',_0x8702('0x27'),_0x8702('0x28')]},{'model':db[_0x8702('0x4b')],'as':_0x8702('0x4c')}]})[_0x8702('0xd')](function(_0x4872e9){if(_0x4872e9['length']>0x0){return db[_0x8702('0x2f')][_0x8702('0x23')](function(_0x3765c3){return db[_0x8702('0x4')]['update']({'recallmeNotifiedDate':db['sequelize'][_0x8702('0x34')](_0x8702('0x49'))},{'where':{'id':{'$in':_[_0x8702('0xa')](_0x4872e9,'id')}},'transaction':_0x3765c3})[_0x8702('0xd')](function(){_0x313f5d(_0x4872e9);})['catch'](function(_0x44cb6f){logger['error'](_0x8702('0x4d'),_0x44cb6f[_0x8702('0x16')],_0xe430d5);_0xaeca26(_0x21ad91[_0x8702('0x12')](0x1f4,_0x44cb6f[_0x8702('0x16')]));});})[_0x8702('0x11')](function(_0x362605){logger[_0x8702('0x12')](_0x8702('0x4d'),_0x362605[_0x8702('0x16')],_0xe430d5);_0xaeca26(_0x21ad91[_0x8702('0x12')](0x1f4,_0x362605[_0x8702('0x16')]));});}else{_0x313f5d(_0x4872e9);}});});}; \ No newline at end of file +var _0xfc77=['limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','LOCK','keys','name','voicePause','length','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','CountReScheduled','CmContact','UPDATE','GetContactRecallMe','GetCmHopperPreview','Contact','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','\x20MINUTE','NOW()','User','Agent','CmList','List','util','bluebird','../../mysqldb','rpc','GetCmHopper','findAll','options','where','attributes'];(function(_0x509e7c,_0x2bc76a){var _0x37f904=function(_0x447fe5){while(--_0x447fe5){_0x509e7c['push'](_0x509e7c['shift']());}};_0x37f904(++_0x2bc76a);}(_0xfc77,0xe1));var _0x7fc7=function(_0x5af1ce,_0x318f6e){_0x5af1ce=_0x5af1ce-0x0;var _0x4e7f4f=_0xfc77[_0x5af1ce];return _0x4e7f4f;};'use strict';var _=require('lodash');var util=require(_0x7fc7('0x0'));var moment=require('moment');var BPromise=require(_0x7fc7('0x1'));var db=require(_0x7fc7('0x2'))['db'];var logger=require('../../config/logger')(_0x7fc7('0x3'));exports[_0x7fc7('0x4')]=function(_0x2e24d1){var _0x5f2180=this;return new Promise(function(_0x3be72f,_0x4181a3){return db['CmHopper'][_0x7fc7('0x5')]({'raw':_0x2e24d1[_0x7fc7('0x6')]?_0x2e24d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e24d1[_0x7fc7('0x6')]?_0x2e24d1[_0x7fc7('0x6')][_0x7fc7('0x7')]||null:null,'attributes':_0x2e24d1['options']?_0x2e24d1['options'][_0x7fc7('0x8')]||null:null,'limit':_0x2e24d1['options']?_0x2e24d1[_0x7fc7('0x6')][_0x7fc7('0x9')]||null:null,'include':_0x2e24d1['options']?_0x2e24d1['options'][_0x7fc7('0xa')]?_['map'](_0x2e24d1['options'][_0x7fc7('0xa')],function(_0x4de1e0){return{'model':db[_0x4de1e0[_0x7fc7('0xb')]],'as':_0x4de1e0['as'],'attributes':_0x4de1e0[_0x7fc7('0x8')],'include':_0x4de1e0['include']?_[_0x7fc7('0xc')](_0x4de1e0[_0x7fc7('0xa')],function(_0x485619){return{'model':db[_0x485619['model']],'as':_0x485619['as'],'attributes':_0x485619['attributes'],'include':_0x485619[_0x7fc7('0xa')]?_[_0x7fc7('0xc')](_0x485619[_0x7fc7('0xa')],function(_0x54a2d1){return{'model':db[_0x54a2d1[_0x7fc7('0xb')]],'as':_0x54a2d1['as'],'attributes':_0x54a2d1[_0x7fc7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x7fc7('0xd')](function(_0x4c11fb){logger[_0x7fc7('0xe')](_0x7fc7('0x4'),_0x2e24d1);logger[_0x7fc7('0xf')](_0x7fc7('0x4'),_0x2e24d1,JSON[_0x7fc7('0x10')](_0x4c11fb));_0x3be72f(_0x4c11fb);})[_0x7fc7('0x11')](function(_0x36768d){logger['error']('GetCmHopper',_0x36768d['message'],_0x2e24d1);_0x4181a3(_0x5f2180[_0x7fc7('0x12')](0x1f4,_0x36768d[_0x7fc7('0x13')]));});});};exports[_0x7fc7('0x14')]=function(_0xe88ea8){var _0x7e4def=this;return new Promise(function(_0x3fd628,_0x13020b){return db[_0x7fc7('0x15')][_0x7fc7('0x16')]({'raw':_0xe88ea8['options']?_0xe88ea8[_0x7fc7('0x6')][_0x7fc7('0x17')]===undefined?!![]:![]:!![],'where':_0xe88ea8[_0x7fc7('0x6')]?_0xe88ea8[_0x7fc7('0x6')][_0x7fc7('0x7')]||null:null,'attributes':_0xe88ea8['options']?_0xe88ea8[_0x7fc7('0x6')][_0x7fc7('0x8')]||null:null,'include':_0xe88ea8[_0x7fc7('0x6')]?_0xe88ea8['options'][_0x7fc7('0xa')]?_['map'](_0xe88ea8[_0x7fc7('0x6')][_0x7fc7('0xa')],function(_0x29fbcf){return{'model':db[_0x29fbcf[_0x7fc7('0xb')]],'as':_0x29fbcf['as'],'attributes':_0x29fbcf[_0x7fc7('0x8')],'include':_0x29fbcf[_0x7fc7('0xa')]?_['map'](_0x29fbcf[_0x7fc7('0xa')],function(_0x35168e){return{'model':db[_0x35168e[_0x7fc7('0xb')]],'as':_0x35168e['as'],'attributes':_0x35168e['attributes'],'include':_0x35168e[_0x7fc7('0xa')]?_[_0x7fc7('0xc')](_0x35168e[_0x7fc7('0xa')],function(_0x41b49a){return{'model':db[_0x41b49a['model']],'as':_0x41b49a['as'],'attributes':_0x41b49a[_0x7fc7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x7fc7('0xd')](function(_0x296ca5){logger[_0x7fc7('0xe')]('ShowCmHopper',_0xe88ea8);logger[_0x7fc7('0xf')](_0x7fc7('0x14'),_0xe88ea8,JSON[_0x7fc7('0x10')](_0x296ca5));_0x3fd628(_0x296ca5);})[_0x7fc7('0x11')](function(_0x47f373){logger['error']('ShowCmHopper',_0x47f373[_0x7fc7('0x13')],_0xe88ea8);_0x13020b(_0x7e4def[_0x7fc7('0x12')](0x1f4,_0x47f373[_0x7fc7('0x13')]));});});};exports[_0x7fc7('0x18')]=function(_0x1e915a){var _0x38fc92=this;return new Promise(function(_0x8c2a19,_0x180370){return db['CmHopper'][_0x7fc7('0x19')](_0x1e915a[_0x7fc7('0x1a')],{'raw':_0x1e915a[_0x7fc7('0x6')]?_0x1e915a['options'][_0x7fc7('0x17')]===undefined?!![]:![]:!![]})[_0x7fc7('0xd')](function(_0x35b243){logger[_0x7fc7('0xe')](_0x7fc7('0x18'),_0x1e915a);logger[_0x7fc7('0xf')](_0x7fc7('0x18'),_0x1e915a,JSON[_0x7fc7('0x10')](_0x35b243));_0x8c2a19(_0x35b243);})[_0x7fc7('0x11')](function(_0x44fb14){logger[_0x7fc7('0x12')](_0x7fc7('0x18'),_0x44fb14[_0x7fc7('0x13')],_0x1e915a);_0x180370(_0x38fc92[_0x7fc7('0x12')](0x1f4,_0x44fb14[_0x7fc7('0x13')]));});});};exports['UpdateCmHopper']=function(_0xf32c69){var _0x224480=this;return new Promise(function(_0x41ae31,_0x265253){return db[_0x7fc7('0x15')]['update'](_0xf32c69[_0x7fc7('0x1a')],{'raw':_0xf32c69[_0x7fc7('0x6')]?_0xf32c69[_0x7fc7('0x6')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf32c69[_0x7fc7('0x6')]?_0xf32c69[_0x7fc7('0x6')]['where']||null:null,'attributes':_0xf32c69[_0x7fc7('0x6')]?_0xf32c69['options'][_0x7fc7('0x8')]||null:null,'limit':_0xf32c69[_0x7fc7('0x6')]?_0xf32c69['options'][_0x7fc7('0x9')]||null:null})[_0x7fc7('0xd')](function(_0x4c72f3){logger[_0x7fc7('0xe')](_0x7fc7('0x1b'),_0xf32c69);logger[_0x7fc7('0xe')](_0x7fc7('0x1c'),JSON[_0x7fc7('0x10')](_0xf32c69[_0x7fc7('0x6')][_0x7fc7('0x7')]),_0xf32c69[_0x7fc7('0x1a')][_0x7fc7('0x1d')]);logger[_0x7fc7('0xf')](_0x7fc7('0x1b'),_0xf32c69,JSON[_0x7fc7('0x10')](_0x4c72f3));_0x41ae31(_0x4c72f3);})[_0x7fc7('0x11')](function(_0x91a22d){logger[_0x7fc7('0x12')](_0x7fc7('0x1b'),_0x91a22d[_0x7fc7('0x13')],_0xf32c69);_0x265253(_0x224480['error'](0x1f4,_0x91a22d['message']));});});};exports[_0x7fc7('0x1e')]=function(_0x4883c5){var _0x203faa=this;return new Promise(function(_0x6bbecb,_0x4aa220){return db[_0x7fc7('0x15')][_0x7fc7('0x1f')]({'where':_0x4883c5['options']?_0x4883c5[_0x7fc7('0x6')][_0x7fc7('0x7')]||null:null})[_0x7fc7('0xd')](function(_0x317f0b){logger['info']('DestroyCmHopper',_0x4883c5);logger[_0x7fc7('0xf')](_0x7fc7('0x1e'),_0x4883c5,JSON[_0x7fc7('0x10')](_0x317f0b));_0x6bbecb(_0x317f0b);})[_0x7fc7('0x11')](function(_0x53afa5){logger[_0x7fc7('0x12')](_0x7fc7('0x1e'),_0x53afa5[_0x7fc7('0x13')],_0x4883c5);_0x4aa220(_0x203faa[_0x7fc7('0x12')](0x1f4,_0x53afa5[_0x7fc7('0x13')]));});});};exports[_0x7fc7('0x20')]=function(_0x227358){var _0x34e8f1=this;return new Promise(function(_0x3c555f,_0x2271a0){return db['CmContact'][_0x7fc7('0x21')]()[_0x7fc7('0xd')](function(_0x4c7dc8){return db['sequelize'][_0x7fc7('0x22')](function(_0x28ce23){return db[_0x7fc7('0x15')][_0x7fc7('0x5')]({'where':_0x227358[_0x7fc7('0x6')]?_0x227358[_0x7fc7('0x6')]['where']||null:null,'attributes':_0x227358[_0x7fc7('0x6')]?_0x227358[_0x7fc7('0x6')][_0x7fc7('0x8')]||null:null,'limit':_0x227358['options']?_0x227358[_0x7fc7('0x6')][_0x7fc7('0x9')]||null:null,'order':_0x227358[_0x7fc7('0x6')]?_0x227358[_0x7fc7('0x6')]['order']||null:null,'transaction':_0x28ce23,'lock':_0x28ce23[_0x7fc7('0x23')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x7fc7('0x24')](_0x4c7dc8)},{'model':db['User'],'as':'Agent','attributes':['id',_0x7fc7('0x25'),_0x7fc7('0x26')]}]})[_0x7fc7('0xd')](function(_0x2b2c40){var _0x349450=[];var _0x20f6a7=[];for(var _0x3f407a=0x0;_0x3f407a<_0x2b2c40[_0x7fc7('0x27')];_0x3f407a+=0x1){var _0x61995a=_0x2b2c40[_0x3f407a][_0x7fc7('0x28')];if(_0x61995a===null){_0x349450[_0x7fc7('0x29')](_0x2b2c40[_0x3f407a][_0x7fc7('0x2a')](_0x227358['body'],{'transaction':_0x28ce23}));}else if(!_0x20f6a7[_0x7fc7('0x2b')](_0x61995a)){_0x20f6a7[_0x7fc7('0x29')](_0x61995a);_0x349450[_0x7fc7('0x29')](_0x2b2c40[_0x3f407a][_0x7fc7('0x2a')](_0x227358['body'],{'transaction':_0x28ce23}));}}return BPromise[_0x7fc7('0x2c')](_0x349450);});})['then'](function(_0x2ac9d5){logger[_0x7fc7('0xe')](_0x7fc7('0x20'),_0x227358);if(_0x2ac9d5[_0x7fc7('0x27')]>0x0){logger[_0x7fc7('0xe')](_0x7fc7('0x2d'),_0x2ac9d5[0x0][_0x7fc7('0x2e')]['id'],_0x2ac9d5[0x0]['dataValues'][_0x7fc7('0x2f')],_0x2ac9d5[0x0]['dataValues'][_0x7fc7('0x1d')]);}logger[_0x7fc7('0xf')]('GetContactDialer',_0x227358,JSON[_0x7fc7('0x10')](_0x2ac9d5));_0x3c555f(_0x2ac9d5);})[_0x7fc7('0x11')](function(_0x18b00f){logger[_0x7fc7('0x12')](_0x7fc7('0x20'),_0x18b00f[_0x7fc7('0x13')],_0x227358);_0x2271a0(_0x34e8f1[_0x7fc7('0x12')](0x1f4,_0x18b00f[_0x7fc7('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x2bbc7e){var _0x249970=this;return new Promise(function(_0x2ba921,_0x32cd3b){return db['sequelize'][_0x7fc7('0x22')](function(_0x12ded5){return db[_0x7fc7('0x30')]['create'](_0x2bbc7e[_0x7fc7('0x1a')],{'raw':_0x2bbc7e['options']?_0x2bbc7e[_0x7fc7('0x6')][_0x7fc7('0x17')]===undefined?!![]:![]:!![],'transaction':_0x12ded5})[_0x7fc7('0xd')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x7fc7('0x10')](_0x2bbc7e[_0x7fc7('0x6')][_0x7fc7('0x7')]),_0x2bbc7e[_0x7fc7('0x6')][_0x7fc7('0x7')][_0x7fc7('0x1d')]);return db[_0x7fc7('0x15')][_0x7fc7('0x1f')]({'where':_0x2bbc7e[_0x7fc7('0x6')]?_0x2bbc7e[_0x7fc7('0x6')]['where']||null:null,'transaction':_0x12ded5});});})['then'](function(_0x4d0496){logger['info'](_0x7fc7('0x31'),_0x2bbc7e);logger[_0x7fc7('0xf')](_0x7fc7('0x31'),_0x2bbc7e,JSON[_0x7fc7('0x10')](_0x4d0496));_0x2ba921(_0x4d0496);})[_0x7fc7('0x11')](function(_0x53b304){logger['error'](_0x7fc7('0x31'),_0x53b304[_0x7fc7('0x13')],_0x2bbc7e);_0x32cd3b(_0x249970[_0x7fc7('0x12')](0x1f4,_0x53b304[_0x7fc7('0x13')]));});});};exports['CountReScheduled']=function(_0x2fe7df){var _0x31b683=this;return new Promise(function(_0x4c7e9c,_0x4258d0){return db['CmHopper'][_0x7fc7('0x5')]({'raw':_0x2fe7df[_0x7fc7('0x6')]?_0x2fe7df['options']['raw']===undefined?!![]:![]:!![],'where':_0x2fe7df[_0x7fc7('0x6')]?_0x2fe7df[_0x7fc7('0x6')][_0x7fc7('0x7')]||null:null,'attributes':[[db[_0x7fc7('0x32')]['fn'](_0x7fc7('0x33'),db[_0x7fc7('0x32')]['fn']('IF',db['sequelize'][_0x7fc7('0x34')](_0x7fc7('0x35')+util[_0x7fc7('0x36')](_0x7fc7('0x37'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x7fc7('0x38')))),'contactsRescheduled']]})['then'](function(_0x1cbdb9){logger['info'](_0x7fc7('0x39'),_0x2fe7df);logger[_0x7fc7('0xf')](_0x7fc7('0x39'),_0x2fe7df,JSON[_0x7fc7('0x10')](_0x1cbdb9));_0x4c7e9c(_0x1cbdb9);})[_0x7fc7('0x11')](function(_0x54c8af){logger[_0x7fc7('0x12')]('CountReScheduled',_0x54c8af[_0x7fc7('0x13')],_0x2fe7df);_0x4258d0(_0x31b683['error'](0x1f4,_0x54c8af[_0x7fc7('0x13')]));});});};exports['GetContactRecallMe']=function(_0x25feb3){var _0x538143=this;return new Promise(function(_0xbbfb1e,_0xa0971a){return db[_0x7fc7('0x3a')]['describe']()[_0x7fc7('0xd')](function(){return db['sequelize'][_0x7fc7('0x22')](function(_0x1d0fed){return db[_0x7fc7('0x15')]['findAll']({'where':_0x25feb3['options']?_0x25feb3[_0x7fc7('0x6')][_0x7fc7('0x7')]||null:null,'attributes':_0x25feb3[_0x7fc7('0x6')]?_0x25feb3[_0x7fc7('0x6')]['attributes']||null:null,'limit':0x1,'order':_0x25feb3[_0x7fc7('0x6')]?_0x25feb3[_0x7fc7('0x6')]['order']||null:null,'group':db[_0x7fc7('0x15')][_0x7fc7('0x28')],'transaction':_0x1d0fed,'lock':_0x1d0fed['LOCK'][_0x7fc7('0x3b')],'include':_0x25feb3[_0x7fc7('0x6')]?_0x25feb3[_0x7fc7('0x6')][_0x7fc7('0xa')]?_[_0x7fc7('0xc')](_0x25feb3['options'][_0x7fc7('0xa')],function(_0x59dfb3){return{'model':db[_0x59dfb3[_0x7fc7('0xb')]],'as':_0x59dfb3['as'],'attributes':_0x59dfb3[_0x7fc7('0x8')],'include':_0x59dfb3['include']?_[_0x7fc7('0xc')](_0x59dfb3['include'],function(_0x27b996){return{'model':db[_0x27b996[_0x7fc7('0xb')]],'as':_0x27b996['as'],'attributes':_0x27b996[_0x7fc7('0x8')],'include':_0x27b996[_0x7fc7('0xa')]?_[_0x7fc7('0xc')](_0x27b996[_0x7fc7('0xa')],function(_0x2b7d54){return{'model':db[_0x2b7d54[_0x7fc7('0xb')]],'as':_0x2b7d54['as'],'attributes':_0x2b7d54[_0x7fc7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x7fc7('0xd')](function(_0x4f4dd7){var _0x794d52=[];for(var _0x43d74e=0x0;_0x43d74e<_0x4f4dd7[_0x7fc7('0x27')];_0x43d74e+=0x1){_0x794d52[_0x7fc7('0x29')](_0x4f4dd7[_0x43d74e][_0x7fc7('0x2a')](_0x25feb3[_0x7fc7('0x1a')],{'transaction':_0x1d0fed}));}return BPromise['all'](_0x794d52);});})[_0x7fc7('0xd')](function(_0x5bfa63){logger[_0x7fc7('0xe')](_0x7fc7('0x3c'),_0x25feb3);logger['debug'](_0x7fc7('0x3c'),_0x25feb3,JSON[_0x7fc7('0x10')](_0x5bfa63));_0xbbfb1e(_0x5bfa63);})[_0x7fc7('0x11')](function(_0x4cef9e){logger[_0x7fc7('0x12')]('GetContactRecallMe',_0x4cef9e[_0x7fc7('0x13')],_0x25feb3);_0xa0971a(_0x538143['error'](0x1f4,_0x4cef9e[_0x7fc7('0x13')]));});});});};exports[_0x7fc7('0x3d')]=function(_0x1c4120){var _0x35634f=this;return new Promise(function(_0x1a6435,_0x18e81c){db[_0x7fc7('0x3a')][_0x7fc7('0x21')]()[_0x7fc7('0xd')](function(_0x389f5f){return db['CmHopper'][_0x7fc7('0x5')]({'raw':_0x1c4120[_0x7fc7('0x6')]?_0x1c4120[_0x7fc7('0x6')][_0x7fc7('0x17')]===undefined?!![]:![]:!![],'where':_0x1c4120[_0x7fc7('0x6')]?_0x1c4120[_0x7fc7('0x6')][_0x7fc7('0x7')]||null:null,'attributes':_0x1c4120['options']?_0x1c4120[_0x7fc7('0x6')][_0x7fc7('0x8')]||null:null,'limit':_0x1c4120['options']?_0x1c4120[_0x7fc7('0x6')][_0x7fc7('0x9')]||null:null,'include':_0x1c4120[_0x7fc7('0x6')]?_0x1c4120['options']['include']?_[_0x7fc7('0xc')](_0x1c4120['options'][_0x7fc7('0xa')],function(_0x4c32c9){return{'model':db[_0x4c32c9[_0x7fc7('0xb')]],'as':_0x4c32c9['as'],'attributes':_0x4c32c9['as']===_0x7fc7('0x3e')?_['keys'](_0x389f5f):_0x4c32c9['attributes'],'include':_0x4c32c9['include']?_[_0x7fc7('0xc')](_0x4c32c9[_0x7fc7('0xa')],function(_0x47b90e){return{'model':db[_0x47b90e[_0x7fc7('0xb')]],'as':_0x47b90e['as'],'attributes':_0x47b90e['attributes'],'include':_0x47b90e[_0x7fc7('0xa')]?_[_0x7fc7('0xc')](_0x47b90e['include'],function(_0x1158de){return{'model':db[_0x1158de['model']],'as':_0x1158de['as'],'attributes':_0x1158de[_0x7fc7('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20686a){logger['info'](_0x7fc7('0x4'),_0x1c4120);logger[_0x7fc7('0xf')](_0x7fc7('0x4'),_0x1c4120,JSON[_0x7fc7('0x10')](_0x20686a));_0x1a6435(_0x20686a);})[_0x7fc7('0x11')](function(_0x3b7423){logger['error']('GetCmHopper',_0x3b7423[_0x7fc7('0x13')],_0x1c4120);_0x18e81c(_0x35634f[_0x7fc7('0x12')](0x1f4,_0x3b7423[_0x7fc7('0x13')]));});});});};exports['GetContactByPhone']=function(_0x4c3da0){var _0x38255e=this;return new Promise(function(_0x8a162b,_0x2a02a9){return db[_0x7fc7('0x3a')][_0x7fc7('0x3f')]({'raw':!![],'where':{'phone':_0x4c3da0['options'][_0x7fc7('0x7')][_0x7fc7('0x40')]},'attributes':['id',_0x7fc7('0x41')],'order':[['id',_0x7fc7('0x42')]]})[_0x7fc7('0xd')](function(_0x348be6){logger['info'](_0x7fc7('0x43'),_0x4c3da0);logger['debug'](_0x7fc7('0x43'),_0x4c3da0,JSON[_0x7fc7('0x10')](_0x348be6));_0x8a162b(_0x348be6);})['catch'](function(_0x2c2d28){logger[_0x7fc7('0x12')](_0x7fc7('0x43'),_0x2c2d28[_0x7fc7('0x13')],_0x4c3da0);_0x2a02a9(_0x38255e['error'](0x1f4,_0x2c2d28[_0x7fc7('0x13')]));});});};exports[_0x7fc7('0x44')]=function(_0x5a9578){var _0x4e5136=this;return new Promise(function(_0x1cbdb2,_0x36c5f0){return db['sequelize']['transaction'](function(_0x2c3d9a){var _0x322ae3=_0x5a9578['options']&&_0x5a9578[_0x7fc7('0x6')]['where']?_0x5a9578['options'][_0x7fc7('0x7')]:{};return db[_0x7fc7('0x15')][_0x7fc7('0x2a')](_0x5a9578[_0x7fc7('0x1a')],{'where':_0x322ae3,'transaction':_0x2c3d9a})[_0x7fc7('0xd')](function(_0x2494f8){logger[_0x7fc7('0xe')](_0x7fc7('0x44'),_0x5a9578);logger['debug']('ResetActiveCalls',_0x5a9578,JSON[_0x7fc7('0x10')](_0x2494f8));_0x1cbdb2(_0x2494f8);})[_0x7fc7('0x11')](function(_0x577099){logger[_0x7fc7('0x12')](_0x7fc7('0x44'),_0x577099[_0x7fc7('0x13')],_0x5a9578);_0x36c5f0(_0x4e5136[_0x7fc7('0x12')](0x1f4,_0x577099[_0x7fc7('0x13')]));});});});};exports[_0x7fc7('0x45')]=function(_0x287511){var _0x47ede1=this;var _0x3d99d3=_0x287511[_0x7fc7('0x1a')][_0x7fc7('0x7')]['voiceQueueIds'];var _0x395fcf=_0x287511[_0x7fc7('0x1a')][_0x7fc7('0x7')][_0x7fc7('0x46')];var _0x1b4cac=_0x287511[_0x7fc7('0x1a')][_0x7fc7('0x7')][_0x7fc7('0x47')];return new Promise(function(_0x17917a,_0x350cb7){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x3d99d3},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x7fc7('0x34')]('NOW()\x20+\x20INTERVAL\x20'+_0x395fcf+_0x7fc7('0x48')),'$gt':db[_0x7fc7('0x32')][_0x7fc7('0x34')](_0x7fc7('0x49'))}},'UserId':{'$in':_0x1b4cac}},'include':[{'model':db[_0x7fc7('0x3a')],'as':_0x7fc7('0x3e')},{'model':db[_0x7fc7('0x4a')],'as':_0x7fc7('0x4b'),'attributes':['id',_0x7fc7('0x25'),'voicePause']},{'model':db[_0x7fc7('0x4c')],'as':_0x7fc7('0x4d')}]})[_0x7fc7('0xd')](function(_0x1aec55){if(_0x1aec55['length']>0x0){return db[_0x7fc7('0x32')][_0x7fc7('0x22')](function(_0x48d203){return db[_0x7fc7('0x15')][_0x7fc7('0x2a')]({'recallmeNotifiedDate':db[_0x7fc7('0x32')]['literal'](_0x7fc7('0x49'))},{'where':{'id':{'$in':_[_0x7fc7('0xc')](_0x1aec55,'id')}},'transaction':_0x48d203})[_0x7fc7('0xd')](function(){_0x17917a(_0x1aec55);})['catch'](function(_0x441f25){logger['error'](_0x7fc7('0x45'),_0x441f25[_0x7fc7('0x13')],_0x287511);_0x350cb7(_0x47ede1['error'](0x1f4,_0x441f25[_0x7fc7('0x13')]));});})['catch'](function(_0x27d859){logger[_0x7fc7('0x12')](_0x7fc7('0x45'),_0x27d859[_0x7fc7('0x13')],_0x287511);_0x350cb7(_0x47ede1['error'](0x1f4,_0x27d859[_0x7fc7('0x13')]));});}else{_0x17917a(_0x1aec55);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 8e967e4..55e86fc 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 _0x5f71=['get','/describe','/opencontacts','getOpenContacts','/timezones','/:id','show','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','delete','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x5f71,0x9b));var _0x15f7=function(_0x1a55a0,_0x1e1855){_0x1a55a0=_0x1a55a0-0x0;var _0x21a919=_0x5f71[_0x1a55a0];return _0x21a919;};'use strict';var express=require(_0x15f7('0x0'));var router=express[_0x15f7('0x1')]();var auth=require(_0x15f7('0x2'));var controller=require(_0x15f7('0x3'));router['get']('/',auth[_0x15f7('0x4')](),controller[_0x15f7('0x5')]);router[_0x15f7('0x6')](_0x15f7('0x7'),auth[_0x15f7('0x4')](),controller['describe']);router['get'](_0x15f7('0x8'),auth[_0x15f7('0x4')](),controller[_0x15f7('0x9')]);router['get'](_0x15f7('0xa'),auth[_0x15f7('0x4')](),controller['getTimezones']);router[_0x15f7('0x6')](_0x15f7('0xb'),auth['isAuthenticated'](),controller[_0x15f7('0xc')]);router[_0x15f7('0x6')]('/:id/previewrecall',auth[_0x15f7('0x4')](),controller[_0x15f7('0xd')]);router[_0x15f7('0xe')]('/',auth[_0x15f7('0x4')](),controller[_0x15f7('0xf')]);router[_0x15f7('0xe')](_0x15f7('0x10'),auth[_0x15f7('0x4')](),controller[_0x15f7('0x11')]);router['post'](_0x15f7('0x12'),auth[_0x15f7('0x4')](),controller[_0x15f7('0x13')]);router[_0x15f7('0x14')](_0x15f7('0xb'),auth[_0x15f7('0x4')](),controller[_0x15f7('0x15')]);router[_0x15f7('0x16')](_0x15f7('0xb'),auth[_0x15f7('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6faf=['getPreview','getTimezone','put','update','delete','express','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','post','create','/preview'];(function(_0xcf4067,_0x190b22){var _0x717dd2=function(_0x6b1952){while(--_0x6b1952){_0xcf4067['push'](_0xcf4067['shift']());}};_0x717dd2(++_0x190b22);}(_0x6faf,0x14f));var _0xf6fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6faf[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0xf6fa('0x0'));var router=express['Router']();var auth=require(_0xf6fa('0x1'));var controller=require(_0xf6fa('0x2'));router[_0xf6fa('0x3')]('/',auth['isAuthenticated'](),controller[_0xf6fa('0x4')]);router[_0xf6fa('0x3')](_0xf6fa('0x5'),auth[_0xf6fa('0x6')](),controller['describe']);router['get'](_0xf6fa('0x7'),auth[_0xf6fa('0x6')](),controller[_0xf6fa('0x8')]);router[_0xf6fa('0x3')](_0xf6fa('0x9'),auth[_0xf6fa('0x6')](),controller[_0xf6fa('0xa')]);router[_0xf6fa('0x3')](_0xf6fa('0xb'),auth[_0xf6fa('0x6')](),controller[_0xf6fa('0xc')]);router[_0xf6fa('0x3')](_0xf6fa('0xd'),auth[_0xf6fa('0x6')](),controller['getPreviewRecall']);router[_0xf6fa('0xe')]('/',auth[_0xf6fa('0x6')](),controller[_0xf6fa('0xf')]);router[_0xf6fa('0xe')](_0xf6fa('0x10'),auth[_0xf6fa('0x6')](),controller[_0xf6fa('0x11')]);router[_0xf6fa('0xe')]('/timezone',auth[_0xf6fa('0x6')](),controller[_0xf6fa('0x12')]);router[_0xf6fa('0x13')]('/:id',auth[_0xf6fa('0x6')](),controller[_0xf6fa('0x14')]);router[_0xf6fa('0x15')](_0xf6fa('0xb'),auth[_0xf6fa('0x6')](),controller['destroy']);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 e4743ff..2cf50c4 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 _0xc0cb=['sequelize','INTEGER','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc0cb,0x95));var _0xbc0c=function(_0x3b16dd,_0x145154){_0x3b16dd=_0x3b16dd-0x0;var _0x2dee00=_0xc0cb[_0x3b16dd];return _0x2dee00;};'use strict';var moment=require(_0xbc0c('0x0'));var Sequelize=require(_0xbc0c('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xbc0c('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xbc0c('0x3')](_0xbc0c('0x4'))},'countbusyretry':{'type':Sequelize[_0xbc0c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbc0c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbc0c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b3f=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','STRING','DATE','format'];(function(_0x3c7658,_0x500b70){var _0x3c813e=function(_0x5dca0f){while(--_0x5dca0f){_0x3c7658['push'](_0x3c7658['shift']());}};_0x3c813e(++_0x500b70);}(_0x3b3f,0xcc));var _0xf3b3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3b3f[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0xf3b3('0x0'));var Sequelize=require('sequelize');module[_0xf3b3('0x1')]={'CmHopperId':{'type':Sequelize[_0xf3b3('0x2')]},'phone':{'type':Sequelize[_0xf3b3('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xf3b3('0x4')],'defaultValue':moment()[_0xf3b3('0x5')](_0xf3b3('0x6'))},'countbusyretry':{'type':Sequelize[_0xf3b3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf3b3('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf3b3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf3b3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 69c92a7..454dcf5 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 _0x9edd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x57b199,_0x4f4b02){var _0x5139e7=function(_0x32d35b){while(--_0x32d35b){_0x57b199['push'](_0x57b199['shift']());}};_0x5139e7(++_0x4f4b02);}(_0x9edd,0x1a1));var _0xd9ed=function(_0x2d2bd9,_0x24b758){_0x2d2bd9=_0x2d2bd9-0x0;var _0x42a701=_0x9edd[_0x2d2bd9];return _0x42a701;};'use strict';var emlformat=require(_0xd9ed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd9ed('0x1'));var rp=require(_0xd9ed('0x2'));var moment=require(_0xd9ed('0x3'));var BPromise=require(_0xd9ed('0x4'));var Mustache=require(_0xd9ed('0x5'));var util=require(_0xd9ed('0x6'));var path=require(_0xd9ed('0x7'));var sox=require(_0xd9ed('0x8'));var csv=require(_0xd9ed('0x9'));var ejs=require(_0xd9ed('0xa'));var fs=require('fs');var fs_extra=require(_0xd9ed('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd9ed('0xc'));var jsforce=require(_0xd9ed('0xd'));var deskjs=require(_0xd9ed('0xe'));var toCsv=require(_0xd9ed('0x9'));var querystring=require(_0xd9ed('0xf'));var Papa=require(_0xd9ed('0x10'));var Redis=require(_0xd9ed('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd9ed('0x12'));var as=require(_0xd9ed('0x13'));var hardwareService=require(_0xd9ed('0x14'));var logger=require(_0xd9ed('0x15'))('api');var utils=require(_0xd9ed('0x16'));var config=require(_0xd9ed('0x17'));var licenseUtil=require(_0xd9ed('0x18'));var db=require(_0xd9ed('0x19'))['db'];function respondWithStatusCode(_0x12a707,_0x865884){_0x865884=_0x865884||0xcc;return function(_0x33c1be){if(_0x33c1be){return _0x12a707[_0xd9ed('0x1a')](_0x865884);}return _0x12a707[_0xd9ed('0x1b')](_0x865884)[_0xd9ed('0x1c')]();};}function respondWithResult(_0x54a9f4,_0x4c35b7){_0x4c35b7=_0x4c35b7||0xc8;return function(_0x365e1e){if(_0x365e1e){return _0x54a9f4['status'](_0x4c35b7)[_0xd9ed('0x1d')](_0x365e1e);}};}function respondWithFilteredResult(_0x4d8db5,_0x5a4ded){return function(_0x354218){if(_0x354218){var _0x274cd2=typeof _0x5a4ded[_0xd9ed('0x1e')]===_0xd9ed('0x1f')&&typeof _0x5a4ded[_0xd9ed('0x20')]===_0xd9ed('0x1f');var _0x2417e1=_0x354218[_0xd9ed('0x21')];var _0x431196=_0x274cd2?0x0:_0x5a4ded[_0xd9ed('0x1e')];var _0x376a4a=_0x274cd2?_0x354218[_0xd9ed('0x21')]:_0x5a4ded['offset']+_0x5a4ded[_0xd9ed('0x20')];var _0x27ce6e;if(_0x376a4a>=_0x2417e1){_0x376a4a=_0x2417e1;_0x27ce6e=0xc8;}else{_0x27ce6e=0xce;}_0x4d8db5[_0xd9ed('0x1b')](_0x27ce6e);return _0x4d8db5['set'](_0xd9ed('0x22'),_0x431196+'-'+_0x376a4a+'/'+_0x2417e1)['json'](_0x354218);}return null;};}function patchUpdates(_0x3e4922){return function(_0x5b278a){try{jsonpatch['apply'](_0x5b278a,_0x3e4922,!![]);}catch(_0x48d788){return BPromise[_0xd9ed('0x23')](_0x48d788);}return _0x5b278a['save']();};}function saveUpdates(_0xa391aa,_0x2a4097){return function(_0xa9003a){if(_0xa9003a){return _0xa9003a[_0xd9ed('0x24')](_0xa391aa)[_0xd9ed('0x25')](function(_0x4f3a22){return _0x4f3a22;});}return null;};}function removeEntity(_0x210084,_0x226ad0){return function(_0x3e50d6){if(_0x3e50d6){return _0x3e50d6['destroy']()[_0xd9ed('0x25')](function(){var _0x4e1c30=_0x3e50d6[_0xd9ed('0x26')]({'plain':!![]});var _0x28dd6d=_0xd9ed('0x27');return db[_0xd9ed('0x28')][_0xd9ed('0x29')]({'where':{'type':_0x28dd6d,'resourceId':_0x4e1c30['id']}})[_0xd9ed('0x25')](function(){return _0x3e50d6;});})[_0xd9ed('0x25')](function(){_0x210084[_0xd9ed('0x1b')](0xcc)[_0xd9ed('0x1c')]();});}};}function handleEntityNotFound(_0x1baafe,_0x2c7f6d){return function(_0xfbb0a0){if(!_0xfbb0a0){_0x1baafe['sendStatus'](0x194);}return _0xfbb0a0;};}function handleError(_0x18edef,_0x2dcb1b){_0x2dcb1b=_0x2dcb1b||0x1f4;return function(_0x4cd704){logger['error'](_0x4cd704[_0xd9ed('0x2a')]);if(_0x4cd704[_0xd9ed('0x2b')]){delete _0x4cd704[_0xd9ed('0x2b')];}_0x18edef['status'](_0x2dcb1b)[_0xd9ed('0x2c')](_0x4cd704);};}exports[_0xd9ed('0x2d')]=function(_0x4cbdef,_0x570d6f){var _0x1803e1={},_0x1a9a86={},_0x8e59bf={'count':0x0,'rows':[]};var _0x488548=_[_0xd9ed('0x2e')](db[_0xd9ed('0x2f')][_0xd9ed('0x30')],function(_0x8ffcf2){return{'name':_0x8ffcf2[_0xd9ed('0x31')],'type':_0x8ffcf2['type'][_0xd9ed('0x32')]};});_0x1a9a86['model']=_['map'](_0x488548,_0xd9ed('0x2b'));_0x1a9a86['query']=_[_0xd9ed('0x33')](_0x4cbdef[_0xd9ed('0x34')]);_0x1a9a86[_0xd9ed('0x35')]=_[_0xd9ed('0x36')](_0x1a9a86['model'],_0x1a9a86[_0xd9ed('0x34')]);_0x1803e1[_0xd9ed('0x37')]=_[_0xd9ed('0x36')](_0x1a9a86['model'],qs[_0xd9ed('0x38')](_0x4cbdef[_0xd9ed('0x34')]['fields']));_0x1803e1[_0xd9ed('0x37')]=_0x1803e1[_0xd9ed('0x37')][_0xd9ed('0x39')]?_0x1803e1[_0xd9ed('0x37')]:_0x1a9a86[_0xd9ed('0x3a')];if(!_0x4cbdef[_0xd9ed('0x34')][_0xd9ed('0x3b')](_0xd9ed('0x3c'))){_0x1803e1[_0xd9ed('0x20')]=qs[_0xd9ed('0x20')](_0x4cbdef[_0xd9ed('0x34')][_0xd9ed('0x20')]);_0x1803e1['offset']=qs[_0xd9ed('0x1e')](_0x4cbdef[_0xd9ed('0x34')][_0xd9ed('0x1e')]);}_0x1803e1[_0xd9ed('0x3d')]=qs[_0xd9ed('0x3e')](_0x4cbdef[_0xd9ed('0x34')][_0xd9ed('0x3e')]);_0x1803e1[_0xd9ed('0x3f')]=qs[_0xd9ed('0x35')](_[_0xd9ed('0x40')](_0x4cbdef[_0xd9ed('0x34')],_0x1a9a86['filters']),_0x488548);if(_0x4cbdef[_0xd9ed('0x34')][_0xd9ed('0x41')]){_0x1803e1[_0xd9ed('0x3f')]=_[_0xd9ed('0x42')](_0x1803e1['where'],{'$or':_[_0xd9ed('0x2e')](_0x488548,function(_0x2ae7b3){if(_0x2ae7b3[_0xd9ed('0x43')]!==_0xd9ed('0x44')){var _0x6138eb={};_0x6138eb[_0x2ae7b3[_0xd9ed('0x2b')]]={'$like':'%'+_0x4cbdef['query'][_0xd9ed('0x41')]+'%'};return _0x6138eb;}})});}_0x1803e1=_[_0xd9ed('0x42')]({},_0x1803e1,_0x4cbdef[_0xd9ed('0x45')]);var _0x15c08f={'where':_0x1803e1[_0xd9ed('0x3f')]};return db[_0xd9ed('0x2f')][_0xd9ed('0x21')](_0x15c08f)[_0xd9ed('0x25')](function(_0xc6f5cd){_0x8e59bf[_0xd9ed('0x21')]=_0xc6f5cd;if(_0x4cbdef[_0xd9ed('0x34')][_0xd9ed('0x46')]){_0x1803e1[_0xd9ed('0x47')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xd9ed('0x48')](_0x1803e1);})[_0xd9ed('0x25')](function(_0x4a07dc){_0x8e59bf[_0xd9ed('0x49')]=_0x4a07dc;return _0x8e59bf;})[_0xd9ed('0x25')](respondWithFilteredResult(_0x570d6f,_0x1803e1))[_0xd9ed('0x4a')](handleError(_0x570d6f,null));};exports[_0xd9ed('0x4b')]=function(_0x1b77a4,_0x438966){var _0x46be75={'raw':!![],'where':{'id':_0x1b77a4[_0xd9ed('0x4c')]['id']}},_0x111357={};_0x111357[_0xd9ed('0x3a')]=_['keys'](db[_0xd9ed('0x2f')][_0xd9ed('0x30')]);_0x111357[_0xd9ed('0x34')]=_[_0xd9ed('0x33')](_0x1b77a4[_0xd9ed('0x34')]);_0x111357['filters']=_[_0xd9ed('0x36')](_0x111357[_0xd9ed('0x3a')],_0x111357['query']);_0x46be75[_0xd9ed('0x37')]=_[_0xd9ed('0x36')](_0x111357['model'],qs[_0xd9ed('0x38')](_0x1b77a4[_0xd9ed('0x34')][_0xd9ed('0x38')]));_0x46be75[_0xd9ed('0x37')]=_0x46be75[_0xd9ed('0x37')]['length']?_0x46be75[_0xd9ed('0x37')]:_0x111357[_0xd9ed('0x3a')];if(_0x1b77a4[_0xd9ed('0x34')]['includeAll']){_0x46be75[_0xd9ed('0x47')]=[{'all':!![]}];}_0x46be75=_['merge']({},_0x46be75,_0x1b77a4[_0xd9ed('0x45')]);return db[_0xd9ed('0x2f')]['find'](_0x46be75)['then'](handleEntityNotFound(_0x438966,null))[_0xd9ed('0x25')](respondWithResult(_0x438966,null))[_0xd9ed('0x4a')](handleError(_0x438966,null));};exports[_0xd9ed('0x4d')]=function(_0x17d074,_0x2bbb16){return db[_0xd9ed('0x2f')][_0xd9ed('0x4d')](_0x17d074[_0xd9ed('0x4e')],{})['then'](function(_0xd4465a){var _0x1c7c9b=_0x17d074[_0xd9ed('0x4f')]['get']({'plain':!![]});if(!_0x1c7c9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c7c9b[_0xd9ed('0x50')]===_0xd9ed('0x4f')){var _0x395265=_0xd4465a['get']({'plain':!![]});var _0x582683=_0xd9ed('0x27');return db[_0xd9ed('0x51')]['find']({'where':{'name':_0x582683,'userProfileId':_0x1c7c9b[_0xd9ed('0x52')]},'raw':!![]})[_0xd9ed('0x25')](function(_0x4fbfea){if(_0x4fbfea&&_0x4fbfea[_0xd9ed('0x53')]===0x0){return db['UserProfileResource'][_0xd9ed('0x4d')]({'name':_0x395265['name'],'resourceId':_0x395265['id'],'type':_0x4fbfea[_0xd9ed('0x2b')],'sectionId':_0x4fbfea['id']},{})[_0xd9ed('0x25')](function(){return _0xd4465a;});}else{return _0xd4465a;}})[_0xd9ed('0x4a')](function(_0x1ffc5d){logger[_0xd9ed('0x54')](_0xd9ed('0x55'),_0x1ffc5d);throw _0x1ffc5d;});}return _0xd4465a;})[_0xd9ed('0x25')](respondWithResult(_0x2bbb16,0xc9))['catch'](handleError(_0x2bbb16,null));};exports[_0xd9ed('0x24')]=function(_0xc5eb82,_0x1e8235){if(_0xc5eb82['body']['id']){delete _0xc5eb82[_0xd9ed('0x4e')]['id'];}return db['CmHopperAdditionalPhone'][_0xd9ed('0x56')]({'where':{'id':_0xc5eb82[_0xd9ed('0x4c')]['id']}})[_0xd9ed('0x25')](handleEntityNotFound(_0x1e8235,null))[_0xd9ed('0x25')](saveUpdates(_0xc5eb82['body'],null))[_0xd9ed('0x25')](respondWithResult(_0x1e8235,null))[_0xd9ed('0x4a')](handleError(_0x1e8235,null));};exports[_0xd9ed('0x29')]=function(_0x6bed27,_0x4a8a99){return db[_0xd9ed('0x2f')]['find']({'where':{'id':_0x6bed27['params']['id']}})[_0xd9ed('0x25')](handleEntityNotFound(_0x4a8a99,null))['then'](removeEntity(_0x4a8a99,null))[_0xd9ed('0x4a')](handleError(_0x4a8a99,null));}; \ No newline at end of file +var _0x1053=['status','json','undefined','limit','count','set','apply','save','then','destroy','CmHopperAdditionalPhones','UserProfileResource','end','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','filter','merge','options','includeAll','findAll','catch','keys','include','create','get','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x27fa65,_0x4e02ee){var _0x456594=function(_0x43b6da){while(--_0x43b6da){_0x27fa65['push'](_0x27fa65['shift']());}};_0x456594(++_0x4e02ee);}(_0x1053,0x12b));var _0x3105=function(_0x329dd0,_0x47e04f){_0x329dd0=_0x329dd0-0x0;var _0x4f5b90=_0x1053[_0x329dd0];return _0x4f5b90;};'use strict';var emlformat=require(_0x3105('0x0'));var rimraf=require(_0x3105('0x1'));var zipdir=require(_0x3105('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3105('0x3'));var moment=require(_0x3105('0x4'));var BPromise=require(_0x3105('0x5'));var Mustache=require(_0x3105('0x6'));var util=require(_0x3105('0x7'));var path=require(_0x3105('0x8'));var sox=require(_0x3105('0x9'));var csv=require(_0x3105('0xa'));var ejs=require(_0x3105('0xb'));var fs=require('fs');var fs_extra=require(_0x3105('0xc'));var _=require(_0x3105('0xd'));var squel=require(_0x3105('0xe'));var crypto=require(_0x3105('0xf'));var jsforce=require(_0x3105('0x10'));var deskjs=require(_0x3105('0x11'));var toCsv=require('to-csv');var querystring=require(_0x3105('0x12'));var Papa=require(_0x3105('0x13'));var Redis=require('ioredis');var authService=require(_0x3105('0x14'));var qs=require(_0x3105('0x15'));var as=require(_0x3105('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3105('0x17'))('api');var utils=require(_0x3105('0x18'));var config=require(_0x3105('0x19'));var licenseUtil=require(_0x3105('0x1a'));var db=require(_0x3105('0x1b'))['db'];function respondWithStatusCode(_0x550d7e,_0x1970d4){_0x1970d4=_0x1970d4||0xcc;return function(_0x558f13){if(_0x558f13){return _0x550d7e[_0x3105('0x1c')](_0x1970d4);}return _0x550d7e[_0x3105('0x1d')](_0x1970d4)['end']();};}function respondWithResult(_0x164976,_0x47fcc7){_0x47fcc7=_0x47fcc7||0xc8;return function(_0x452668){if(_0x452668){return _0x164976['status'](_0x47fcc7)[_0x3105('0x1e')](_0x452668);}};}function respondWithFilteredResult(_0x45b432,_0x5a0688){return function(_0x48636a){if(_0x48636a){var _0x318a8d=typeof _0x5a0688['offset']===_0x3105('0x1f')&&typeof _0x5a0688[_0x3105('0x20')]===_0x3105('0x1f');var _0x38e2ec=_0x48636a['count'];var _0x51d0ae=_0x318a8d?0x0:_0x5a0688['offset'];var _0x1fa1a7=_0x318a8d?_0x48636a[_0x3105('0x21')]:_0x5a0688['offset']+_0x5a0688[_0x3105('0x20')];var _0x3cd4b5;if(_0x1fa1a7>=_0x38e2ec){_0x1fa1a7=_0x38e2ec;_0x3cd4b5=0xc8;}else{_0x3cd4b5=0xce;}_0x45b432[_0x3105('0x1d')](_0x3cd4b5);return _0x45b432[_0x3105('0x22')]('Content-Range',_0x51d0ae+'-'+_0x1fa1a7+'/'+_0x38e2ec)['json'](_0x48636a);}return null;};}function patchUpdates(_0x4eca29){return function(_0x1622a4){try{jsonpatch[_0x3105('0x23')](_0x1622a4,_0x4eca29,!![]);}catch(_0x5bfebf){return BPromise['reject'](_0x5bfebf);}return _0x1622a4[_0x3105('0x24')]();};}function saveUpdates(_0x37dd52,_0x124959){return function(_0x15b02b){if(_0x15b02b){return _0x15b02b['update'](_0x37dd52)[_0x3105('0x25')](function(_0x109ae2){return _0x109ae2;});}return null;};}function removeEntity(_0x44661d,_0x4c9228){return function(_0x58f54b){if(_0x58f54b){return _0x58f54b[_0x3105('0x26')]()[_0x3105('0x25')](function(){var _0x4d61ce=_0x58f54b['get']({'plain':!![]});var _0x5bc726=_0x3105('0x27');return db[_0x3105('0x28')]['destroy']({'where':{'type':_0x5bc726,'resourceId':_0x4d61ce['id']}})[_0x3105('0x25')](function(){return _0x58f54b;});})[_0x3105('0x25')](function(){_0x44661d[_0x3105('0x1d')](0xcc)[_0x3105('0x29')]();});}};}function handleEntityNotFound(_0x57a22d,_0x3798a1){return function(_0x6f5e65){if(!_0x6f5e65){_0x57a22d[_0x3105('0x1c')](0x194);}return _0x6f5e65;};}function handleError(_0x39e0f6,_0x454162){_0x454162=_0x454162||0x1f4;return function(_0x215091){logger[_0x3105('0x2a')](_0x215091['stack']);if(_0x215091[_0x3105('0x2b')]){delete _0x215091['name'];}_0x39e0f6[_0x3105('0x1d')](_0x454162)[_0x3105('0x2c')](_0x215091);};}exports['index']=function(_0x5e5142,_0x2d15ce){var _0x174b84={},_0x420fb2={},_0x519f27={'count':0x0,'rows':[]};var _0x454dcf=_[_0x3105('0x2d')](db[_0x3105('0x2e')][_0x3105('0x2f')],function(_0x11c7bf){return{'name':_0x11c7bf[_0x3105('0x30')],'type':_0x11c7bf[_0x3105('0x31')][_0x3105('0x32')]};});_0x420fb2[_0x3105('0x33')]=_[_0x3105('0x2d')](_0x454dcf,_0x3105('0x2b'));_0x420fb2[_0x3105('0x34')]=_['keys'](_0x5e5142[_0x3105('0x34')]);_0x420fb2['filters']=_['intersection'](_0x420fb2[_0x3105('0x33')],_0x420fb2['query']);_0x174b84[_0x3105('0x35')]=_[_0x3105('0x36')](_0x420fb2[_0x3105('0x33')],qs[_0x3105('0x37')](_0x5e5142[_0x3105('0x34')][_0x3105('0x37')]));_0x174b84['attributes']=_0x174b84['attributes'][_0x3105('0x38')]?_0x174b84[_0x3105('0x35')]:_0x420fb2[_0x3105('0x33')];if(!_0x5e5142[_0x3105('0x34')][_0x3105('0x39')](_0x3105('0x3a'))){_0x174b84[_0x3105('0x20')]=qs[_0x3105('0x20')](_0x5e5142[_0x3105('0x34')][_0x3105('0x20')]);_0x174b84[_0x3105('0x3b')]=qs[_0x3105('0x3b')](_0x5e5142['query'][_0x3105('0x3b')]);}_0x174b84['order']=qs[_0x3105('0x3c')](_0x5e5142[_0x3105('0x34')]['sort']);_0x174b84[_0x3105('0x3d')]=qs[_0x3105('0x3e')](_['pick'](_0x5e5142[_0x3105('0x34')],_0x420fb2[_0x3105('0x3e')]),_0x454dcf);if(_0x5e5142[_0x3105('0x34')][_0x3105('0x3f')]){_0x174b84[_0x3105('0x3d')]=_['merge'](_0x174b84[_0x3105('0x3d')],{'$or':_[_0x3105('0x2d')](_0x454dcf,function(_0x2e24f){if(_0x2e24f['type']!=='VIRTUAL'){var _0x40c852={};_0x40c852[_0x2e24f['name']]={'$like':'%'+_0x5e5142[_0x3105('0x34')]['filter']+'%'};return _0x40c852;}})});}_0x174b84=_[_0x3105('0x40')]({},_0x174b84,_0x5e5142[_0x3105('0x41')]);var _0x1a4423={'where':_0x174b84[_0x3105('0x3d')]};return db[_0x3105('0x2e')][_0x3105('0x21')](_0x1a4423)[_0x3105('0x25')](function(_0x591a44){_0x519f27['count']=_0x591a44;if(_0x5e5142[_0x3105('0x34')][_0x3105('0x42')]){_0x174b84['include']=[{'all':!![]}];}return db[_0x3105('0x2e')][_0x3105('0x43')](_0x174b84);})[_0x3105('0x25')](function(_0xc61fd0){_0x519f27['rows']=_0xc61fd0;return _0x519f27;})[_0x3105('0x25')](respondWithFilteredResult(_0x2d15ce,_0x174b84))[_0x3105('0x44')](handleError(_0x2d15ce,null));};exports['show']=function(_0x5b5456,_0x5a5f65){var _0x12b3c1={'raw':!![],'where':{'id':_0x5b5456['params']['id']}},_0x55ab6f={};_0x55ab6f[_0x3105('0x33')]=_['keys'](db[_0x3105('0x2e')][_0x3105('0x2f')]);_0x55ab6f[_0x3105('0x34')]=_[_0x3105('0x45')](_0x5b5456[_0x3105('0x34')]);_0x55ab6f[_0x3105('0x3e')]=_[_0x3105('0x36')](_0x55ab6f['model'],_0x55ab6f[_0x3105('0x34')]);_0x12b3c1[_0x3105('0x35')]=_[_0x3105('0x36')](_0x55ab6f['model'],qs[_0x3105('0x37')](_0x5b5456[_0x3105('0x34')][_0x3105('0x37')]));_0x12b3c1[_0x3105('0x35')]=_0x12b3c1[_0x3105('0x35')][_0x3105('0x38')]?_0x12b3c1[_0x3105('0x35')]:_0x55ab6f[_0x3105('0x33')];if(_0x5b5456[_0x3105('0x34')]['includeAll']){_0x12b3c1[_0x3105('0x46')]=[{'all':!![]}];}_0x12b3c1=_[_0x3105('0x40')]({},_0x12b3c1,_0x5b5456[_0x3105('0x41')]);return db[_0x3105('0x2e')]['find'](_0x12b3c1)[_0x3105('0x25')](handleEntityNotFound(_0x5a5f65,null))['then'](respondWithResult(_0x5a5f65,null))['catch'](handleError(_0x5a5f65,null));};exports[_0x3105('0x47')]=function(_0x4fed77,_0x443cb6){return db[_0x3105('0x2e')][_0x3105('0x47')](_0x4fed77['body'],{})[_0x3105('0x25')](function(_0x43edc6){var _0x2bc4f6=_0x4fed77['user'][_0x3105('0x48')]({'plain':!![]});if(!_0x2bc4f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bc4f6[_0x3105('0x49')]===_0x3105('0x4a')){var _0x1d3f09=_0x43edc6['get']({'plain':!![]});var _0x16f933='CmHopperAdditionalPhones';return db[_0x3105('0x4b')]['find']({'where':{'name':_0x16f933,'userProfileId':_0x2bc4f6[_0x3105('0x4c')]},'raw':!![]})[_0x3105('0x25')](function(_0x43ca80){if(_0x43ca80&&_0x43ca80['autoAssociation']===0x0){return db[_0x3105('0x28')][_0x3105('0x47')]({'name':_0x1d3f09[_0x3105('0x2b')],'resourceId':_0x1d3f09['id'],'type':_0x43ca80[_0x3105('0x2b')],'sectionId':_0x43ca80['id']},{})[_0x3105('0x25')](function(){return _0x43edc6;});}else{return _0x43edc6;}})[_0x3105('0x44')](function(_0x128258){logger[_0x3105('0x2a')](_0x3105('0x4d'),_0x128258);throw _0x128258;});}return _0x43edc6;})[_0x3105('0x25')](respondWithResult(_0x443cb6,0xc9))[_0x3105('0x44')](handleError(_0x443cb6,null));};exports[_0x3105('0x4e')]=function(_0x5a1c55,_0x2e5180){if(_0x5a1c55[_0x3105('0x4f')]['id']){delete _0x5a1c55[_0x3105('0x4f')]['id'];}return db[_0x3105('0x2e')][_0x3105('0x50')]({'where':{'id':_0x5a1c55[_0x3105('0x51')]['id']}})[_0x3105('0x25')](handleEntityNotFound(_0x2e5180,null))['then'](saveUpdates(_0x5a1c55[_0x3105('0x4f')],null))['then'](respondWithResult(_0x2e5180,null))['catch'](handleError(_0x2e5180,null));};exports[_0x3105('0x26')]=function(_0x31443b,_0x3e9a04){return db['CmHopperAdditionalPhone'][_0x3105('0x50')]({'where':{'id':_0x31443b['params']['id']}})[_0x3105('0x25')](handleEntityNotFound(_0x3e9a04,null))['then'](removeEntity(_0x3e9a04,null))['catch'](handleError(_0x3e9a04,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a942928..f9d780c 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 _0x5bec=['define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0x5bec,0x85));var _0xc5be=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5bec[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xc5be('0x0'));var util=require(_0xc5be('0x1'));var logger=require(_0xc5be('0x2'))(_0xc5be('0x3'));var moment=require(_0xc5be('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5be('0x5'));var rimraf=require(_0xc5be('0x6'));var config=require(_0xc5be('0x7'));var attributes=require(_0xc5be('0x8'));module[_0xc5be('0x9')]=function(_0x5f4128,_0x999618){return _0x5f4128[_0xc5be('0xa')](_0xc5be('0xb'),attributes,{'tableName':_0xc5be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76dd=['../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','bluebird'];(function(_0x2cae08,_0x5edc50){var _0x64a60a=function(_0x3c0964){while(--_0x3c0964){_0x2cae08['push'](_0x2cae08['shift']());}};_0x64a60a(++_0x5edc50);}(_0x76dd,0xb4));var _0xd76d=function(_0x4c4a25,_0x551b9c){_0x4c4a25=_0x4c4a25-0x0;var _0x185f23=_0x76dd[_0x4c4a25];return _0x185f23;};'use strict';var _=require(_0xd76d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd76d('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd76d('0x2'));var attributes=require(_0xd76d('0x3'));module['exports']=function(_0x240f33,_0x29ee93){return _0x240f33[_0xd76d('0x4')](_0xd76d('0x5'),attributes,{'tableName':_0xd76d('0x6'),'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 134e30b..4095f65 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 _0x5746=['CampaignId','CmHopperAdditionalPhone','OrderBy','then','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ASC','countbusyretry','entity','dialGlobalMaxRetry','catch','SwapAdditionalPhones','CmHopper','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','VerifyAdditionalPhones','findOne','body','ListId','VoiceQueueId'];(function(_0x558a01,_0x5239e3){var _0x319bb8=function(_0x4a95d8){while(--_0x4a95d8){_0x558a01['push'](_0x558a01['shift']());}};_0x319bb8(++_0x5239e3);}(_0x5746,0x1f2));var _0x6574=function(_0x5c1721,_0x2f139e){_0x5c1721=_0x5c1721-0x0;var _0xbac3ed=_0x5746[_0x5c1721];return _0xbac3ed;};'use strict';var _=require(_0x6574('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6574('0x1'));var rs=require(_0x6574('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6574('0x3'))['db'];var utils=require(_0x6574('0x4'));var logger=require(_0x6574('0x5'))(_0x6574('0x6'));var config=require(_0x6574('0x7'));var jayson=require(_0x6574('0x8'));var client=jayson[_0x6574('0x9')][_0x6574('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d691,_0x3cedc0,_0x4429c7){return new BPromise(function(_0x5677e9,_0x2f883f){return client[_0x6574('0xb')](_0x48d691,_0x4429c7)['then'](function(_0x2bf057){logger[_0x6574('0xc')](_0x6574('0xd'),_0x3cedc0,_0x6574('0xe'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x3cedc0,_0x6574('0xe'),JSON[_0x6574('0xf')](_0x2bf057));if(_0x2bf057['error']){if(_0x2bf057[_0x6574('0x10')]['code']===0x1f4){logger[_0x6574('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3cedc0,_0x2bf057['error'][_0x6574('0x11')]);return _0x2f883f(_0x2bf057[_0x6574('0x10')]['message']);}logger['error'](_0x6574('0xd'),_0x3cedc0,_0x2bf057[_0x6574('0x10')][_0x6574('0x11')]);return _0x5677e9(_0x2bf057['error']['message']);}else{logger[_0x6574('0xc')](_0x6574('0xd'),_0x3cedc0,_0x6574('0xe'));_0x5677e9(_0x2bf057[_0x6574('0x12')]['message']);}})['catch'](function(_0x306e0a){logger['error'](_0x6574('0xd'),_0x3cedc0,_0x306e0a);_0x2f883f(_0x306e0a);});});}exports[_0x6574('0x13')]=function(_0x38f01e){var _0x22e867=this;return new Promise(function(_0xf48913,_0x53c4f2){return db['CmHopper'][_0x6574('0x14')]({'raw':!![],'where':{'ContactId':_0x38f01e['body']['ContactId'],'ListId':_0x38f01e[_0x6574('0x15')][_0x6574('0x16')],'VoiceQueueId':_0x38f01e['body'][_0x6574('0x17')]===undefined?null:_0x38f01e[_0x6574('0x15')][_0x6574('0x17')],'CampaignId':_0x38f01e[_0x6574('0x15')][_0x6574('0x18')]===undefined?null:_0x38f01e[_0x6574('0x15')][_0x6574('0x18')]}})['then'](function(_0x4c4227){if(_0x4c4227!=null){return db[_0x6574('0x19')][_0x6574('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4c4227['id'],'OrderBy':{'$gt':_0x4c4227[_0x6574('0x1a')]}},'order':[[_0x6574('0x1a'),'ASC']]})[_0x6574('0x1b')](function(_0x3eabdf){var _0x5bc1f3=0x0;if(_0x3eabdf){if(_0x3eabdf['countbusyretry']+_0x3eabdf[_0x6574('0x1c')]+_0x3eabdf[_0x6574('0x1d')]+_0x3eabdf[_0x6574('0x1e')]+_0x3eabdf[_0x6574('0x1f')]+_0x3eabdf[_0x6574('0x20')]+_0x3eabdf[_0x6574('0x21')]+_0x3eabdf[_0x6574('0x22')]<_0x38f01e['entity']['dialGlobalMaxRetry'])_0x5bc1f3=0x1;_0xf48913({'additional':_0x5bc1f3});}else{return db[_0x6574('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4c4227['id']},'order':[['OrderBy',_0x6574('0x23')]]})['then'](function(_0x42a965){var _0x46a7ab=0x0;if(_0x42a965){if(_0x42a965[_0x6574('0x24')]+_0x42a965[_0x6574('0x1c')]+_0x42a965['countnoanswerretry']+_0x42a965[_0x6574('0x1e')]+_0x42a965[_0x6574('0x1f')]+_0x42a965[_0x6574('0x20')]+_0x42a965['countmachineretry']+_0x42a965[_0x6574('0x22')]<_0x38f01e[_0x6574('0x25')][_0x6574('0x26')])_0x46a7ab=0x1;_0xf48913({'additional':_0x46a7ab});}else{_0xf48913({'additional':0x0});}})[_0x6574('0x27')](function(_0xf2ac6f){logger['error'](_0x6574('0x13'),_0xf2ac6f[_0x6574('0x11')]);_0x53c4f2(_0x22e867[_0x6574('0x10')](0x1f4,_0xf2ac6f[_0x6574('0x11')]));});}})[_0x6574('0x27')](function(_0x2edd31){logger[_0x6574('0x10')]('VerifyAdditionalPhones',_0x2edd31[_0x6574('0x11')]);_0x53c4f2(_0x22e867['error'](0x1f4,_0x2edd31[_0x6574('0x11')]));});}else _0xf48913({'additional':0x0});});});};exports[_0x6574('0x28')]=function(_0x5a328e){var _0xd8c338=this;return new Promise(function(_0x5bd0b5,_0x362917){return db[_0x6574('0x29')][_0x6574('0x14')]({'raw':!![],'where':{'ContactId':_0x5a328e[_0x6574('0x15')][_0x6574('0x2a')],'ListId':_0x5a328e['body'][_0x6574('0x16')],'VoiceQueueId':_0x5a328e[_0x6574('0x15')][_0x6574('0x17')]===undefined?null:_0x5a328e[_0x6574('0x15')]['VoiceQueueId'],'CampaignId':_0x5a328e['body'][_0x6574('0x18')]===undefined?null:_0x5a328e[_0x6574('0x15')]['CampaignId']}})[_0x6574('0x1b')](function(_0x2b2e85){if(_0x2b2e85!=null){return db[_0x6574('0x19')][_0x6574('0x14')]({'raw':!![],'where':{'CmHopperId':_0x2b2e85['id'],'OrderBy':{'$gte':_0x2b2e85[_0x6574('0x1a')]}},'order':[[_0x6574('0x1a'),'ASC']]})[_0x6574('0x1b')](function(_0x759b74){if(_0x759b74)return activateAdditionalPhone(_0x2b2e85,_0x5a328e[_0x6574('0x15')],_0x759b74,_0x5a328e[_0x6574('0x2b')],_0x5a328e[_0x6574('0x2c')])['then'](function(_0x24721e){_0x5bd0b5(_0x24721e);});else{return db[_0x6574('0x19')][_0x6574('0x14')]({'raw':!![],'where':{'CmHopperId':_0x2b2e85['id']},'order':[[_0x6574('0x1a'),'ASC']]})[_0x6574('0x1b')](function(_0x348747){if(_0x348747)return activateAdditionalPhone(_0x2b2e85,_0x5a328e[_0x6574('0x15')],_0x348747,_0x5a328e[_0x6574('0x2b')],_0x5a328e['waitTime'])[_0x6574('0x1b')](function(_0x30dc2c){_0x5bd0b5(_0x30dc2c);});else{_0x5bd0b5({'id':_0x2b2e85['id'],'phone':''});}})[_0x6574('0x27')](function(_0x3b297e){logger[_0x6574('0x10')](_0x6574('0x13'),_0x3b297e['message']);_0x362917(_0xd8c338['error'](0x1f4,_0x3b297e[_0x6574('0x11')]));});}})[_0x6574('0x27')](function(_0x4fc165){logger[_0x6574('0x10')](_0x6574('0x13'),_0x4fc165[_0x6574('0x11')]);_0x362917(_0xd8c338[_0x6574('0x10')](0x1f4,_0x4fc165[_0x6574('0x11')]));});}else _0x5bd0b5(0x1);});});};function activateAdditionalPhone(_0x51cf2c,_0x3fe90c,_0x76f97f,_0x1c6a01,_0x28c16c){return new Promise(function(_0xff05d,_0x507a7e){var _0x2fc65a;if(_[_0x6574('0x2d')](_0x76f97f[_0x6574('0x2e')])){_0x76f97f[_0x6574('0x2e')]=moment();}if(moment()>moment(_0x76f97f[_0x6574('0x2e')])){_0x2fc65a=moment()[_0x6574('0x2f')](_0x28c16c||0x3,'minutes');}else{if(_0x76f97f['OrderBy']==0x0){_0x2fc65a=moment(_0x76f97f[_0x6574('0x2e')]);}else{_0x2fc65a=moment()[_0x6574('0x2f')](_0x28c16c||0x3,_0x6574('0x30'));}}if(_[_0x6574('0x2d')](_0x2fc65a)){_0x2fc65a=moment()['add'](_0x28c16c||0x3,_0x6574('0x30'));}var _0x2e0717={'phone':_0x51cf2c[_0x6574('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x51cf2c[_0x6574('0x1a')])?0x0:_0x51cf2c[_0x6574('0x1a')],'scheduledat':moment()[_0x6574('0x2f')](_0x1c6a01||0x1,'minutes'),'countbusyretry':_0x3fe90c['countbusyretry'],'countcongestionretry':_0x3fe90c['countcongestionretry'],'countnoanswerretry':_0x3fe90c[_0x6574('0x1d')],'countnosuchnumberretry':_0x3fe90c[_0x6574('0x1e')],'countdropretry':_0x3fe90c[_0x6574('0x1f')],'countabandonedretry':_0x3fe90c[_0x6574('0x20')],'countmachineretry':_0x3fe90c[_0x6574('0x21')],'countagentrejectretry':_0x3fe90c[_0x6574('0x22')],'createdAt':_0x3fe90c['createdAt'],'updatedAt':_0x3fe90c[_0x6574('0x32')]};var _0x57f433={'CmHopperId':_0x51cf2c['id'],'phone':_0x76f97f[_0x6574('0x31')],'active':0x0,'OrderBy':_[_0x6574('0x2d')](_0x76f97f[_0x6574('0x1a')])?0x0:_0x76f97f[_0x6574('0x1a')],'scheduledat':_0x2fc65a,'countbusyretry':_0x76f97f[_0x6574('0x24')],'countcongestionretry':_0x76f97f[_0x6574('0x1c')],'countnoanswerretry':_0x76f97f[_0x6574('0x1d')],'countnosuchnumberretry':_0x76f97f[_0x6574('0x1e')],'countdropretry':_0x76f97f[_0x6574('0x1f')],'countabandonedretry':_0x76f97f[_0x6574('0x20')],'countmachineretry':_0x76f97f[_0x6574('0x21')],'countagentrejectretry':_0x76f97f[_0x6574('0x22')],'createdAt':_0x76f97f[_0x6574('0x33')],'updatedAt':_0x76f97f[_0x6574('0x32')]};return db[_0x6574('0x34')][_0x6574('0x35')](function(_0x230919){return db[_0x6574('0x19')][_0x6574('0x36')](_0x2e0717,{'where':{'id':_0x76f97f['id']}},{'transaction':_0x230919})[_0x6574('0x1b')](function(){return db[_0x6574('0x29')]['update'](_0x57f433,{'where':{'id':_0x51cf2c['id']}},{'transaction':_0x230919});});})[_0x6574('0x1b')](function(_0x583069){_0xff05d({'id':_0x51cf2c['id'],'phone':_0x76f97f[_0x6574('0x31')]});})[_0x6574('0x27')](function(_0x52e357){logger[_0x6574('0x10')](_0x6574('0x37'),_0x52e357[_0x6574('0x11')]);_0x507a7e({'error':_0x52e357[_0x6574('0x11')]});});});}exports['IncrementPreviewCounters']=function(_0x46bd93){var _0x40ff1a=this;return new Promise(function(_0x39f1be,_0x1fe7c2){return db[_0x6574('0x29')][_0x6574('0x36')](_0x46bd93['body'][_0x6574('0x38')],{'where':{'id':_0x46bd93['body']['id']}})[_0x6574('0x1b')](function(_0x410d12){_0x39f1be(_0x410d12);})[_0x6574('0x27')](function(_0x16bd33){logger[_0x6574('0x10')](_0x6574('0x39'),_0x16bd33[_0x6574('0x11')]);_0x1fe7c2(_0x40ff1a[_0x6574('0x10')](0x1f4,_0x16bd33[_0x6574('0x11')]));});});}; \ No newline at end of file +var _0x8645=['countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countabandonedretry','catch','SwapAdditionalPhones','ContactId','duration','waitTime','scheduledat','minutes','add','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','request\x20sent','result','VerifyAdditionalPhones','CmHopper','ListId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry'];(function(_0x17fc01,_0x22e641){var _0x433478=function(_0x5430c3){while(--_0x5430c3){_0x17fc01['push'](_0x17fc01['shift']());}};_0x433478(++_0x22e641);}(_0x8645,0xca));var _0x5864=function(_0x17f363,_0x53e47b){_0x17f363=_0x17f363-0x0;var _0x5d7c1b=_0x8645[_0x17f363];return _0x5d7c1b;};'use strict';var _=require(_0x5864('0x0'));var util=require('util');var moment=require(_0x5864('0x1'));var BPromise=require('bluebird');var rs=require(_0x5864('0x2'));var fs=require('fs');var Redis=require(_0x5864('0x3'));var db=require(_0x5864('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5864('0x5'))(_0x5864('0x6'));var config=require(_0x5864('0x7'));var jayson=require(_0x5864('0x8'));var client=jayson[_0x5864('0x9')][_0x5864('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x452455,_0x462dd2,_0x2f6775){return new BPromise(function(_0x3e32d6,_0x3569de){return client['request'](_0x452455,_0x2f6775)[_0x5864('0xb')](function(_0x1bfe91){logger[_0x5864('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x462dd2,'request\x20sent');logger[_0x5864('0xd')](_0x5864('0xe'),_0x462dd2,'request\x20sent',JSON['stringify'](_0x1bfe91));if(_0x1bfe91[_0x5864('0xf')]){if(_0x1bfe91[_0x5864('0xf')][_0x5864('0x10')]===0x1f4){logger[_0x5864('0xf')](_0x5864('0x11'),_0x462dd2,_0x1bfe91[_0x5864('0xf')][_0x5864('0x12')]);return _0x3569de(_0x1bfe91[_0x5864('0xf')][_0x5864('0x12')]);}logger[_0x5864('0xf')](_0x5864('0x11'),_0x462dd2,_0x1bfe91[_0x5864('0xf')]['message']);return _0x3e32d6(_0x1bfe91[_0x5864('0xf')][_0x5864('0x12')]);}else{logger[_0x5864('0xc')](_0x5864('0x11'),_0x462dd2,_0x5864('0x13'));_0x3e32d6(_0x1bfe91[_0x5864('0x14')][_0x5864('0x12')]);}})['catch'](function(_0x4f2d4f){logger[_0x5864('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x462dd2,_0x4f2d4f);_0x3569de(_0x4f2d4f);});});}exports[_0x5864('0x15')]=function(_0x2197ce){var _0x26c882=this;return new Promise(function(_0x57908f,_0x33d870){return db[_0x5864('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x2197ce['body']['ContactId'],'ListId':_0x2197ce['body'][_0x5864('0x17')],'VoiceQueueId':_0x2197ce['body']['VoiceQueueId']===undefined?null:_0x2197ce[_0x5864('0x18')][_0x5864('0x19')],'CampaignId':_0x2197ce[_0x5864('0x18')][_0x5864('0x1a')]===undefined?null:_0x2197ce['body']['CampaignId']}})[_0x5864('0xb')](function(_0xba5cfb){if(_0xba5cfb!=null){return db[_0x5864('0x1b')][_0x5864('0x1c')]({'raw':!![],'where':{'CmHopperId':_0xba5cfb['id'],'OrderBy':{'$gt':_0xba5cfb[_0x5864('0x1d')]}},'order':[['OrderBy',_0x5864('0x1e')]]})[_0x5864('0xb')](function(_0x11e5cf){var _0xb6afa1=0x0;if(_0x11e5cf){if(_0x11e5cf[_0x5864('0x1f')]+_0x11e5cf[_0x5864('0x20')]+_0x11e5cf['countnoanswerretry']+_0x11e5cf[_0x5864('0x21')]+_0x11e5cf[_0x5864('0x22')]+_0x11e5cf['countabandonedretry']+_0x11e5cf[_0x5864('0x23')]+_0x11e5cf[_0x5864('0x24')]<_0x2197ce[_0x5864('0x25')][_0x5864('0x26')])_0xb6afa1=0x1;_0x57908f({'additional':_0xb6afa1});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xba5cfb['id']},'order':[[_0x5864('0x1d'),'ASC']]})[_0x5864('0xb')](function(_0x558a58){var _0x22ed9f=0x0;if(_0x558a58){if(_0x558a58[_0x5864('0x1f')]+_0x558a58[_0x5864('0x20')]+_0x558a58[_0x5864('0x27')]+_0x558a58[_0x5864('0x21')]+_0x558a58[_0x5864('0x22')]+_0x558a58[_0x5864('0x28')]+_0x558a58['countmachineretry']+_0x558a58[_0x5864('0x24')]<_0x2197ce[_0x5864('0x25')][_0x5864('0x26')])_0x22ed9f=0x1;_0x57908f({'additional':_0x22ed9f});}else{_0x57908f({'additional':0x0});}})[_0x5864('0x29')](function(_0x73d065){logger['error']('VerifyAdditionalPhones',_0x73d065[_0x5864('0x12')]);_0x33d870(_0x26c882[_0x5864('0xf')](0x1f4,_0x73d065[_0x5864('0x12')]));});}})[_0x5864('0x29')](function(_0x5c7047){logger[_0x5864('0xf')](_0x5864('0x15'),_0x5c7047[_0x5864('0x12')]);_0x33d870(_0x26c882[_0x5864('0xf')](0x1f4,_0x5c7047[_0x5864('0x12')]));});}else _0x57908f({'additional':0x0});});});};exports[_0x5864('0x2a')]=function(_0x116c34){var _0xa9bc9=this;return new Promise(function(_0x323782,_0x587271){return db[_0x5864('0x16')][_0x5864('0x1c')]({'raw':!![],'where':{'ContactId':_0x116c34[_0x5864('0x18')][_0x5864('0x2b')],'ListId':_0x116c34[_0x5864('0x18')]['ListId'],'VoiceQueueId':_0x116c34[_0x5864('0x18')][_0x5864('0x19')]===undefined?null:_0x116c34[_0x5864('0x18')][_0x5864('0x19')],'CampaignId':_0x116c34['body']['CampaignId']===undefined?null:_0x116c34[_0x5864('0x18')]['CampaignId']}})[_0x5864('0xb')](function(_0x505ed8){if(_0x505ed8!=null){return db[_0x5864('0x1b')][_0x5864('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x505ed8['id'],'OrderBy':{'$gte':_0x505ed8[_0x5864('0x1d')]}},'order':[[_0x5864('0x1d'),_0x5864('0x1e')]]})[_0x5864('0xb')](function(_0x473086){if(_0x473086)return activateAdditionalPhone(_0x505ed8,_0x116c34['body'],_0x473086,_0x116c34[_0x5864('0x2c')],_0x116c34['waitTime'])['then'](function(_0x93a72f){_0x323782(_0x93a72f);});else{return db[_0x5864('0x1b')][_0x5864('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x505ed8['id']},'order':[['OrderBy',_0x5864('0x1e')]]})['then'](function(_0x4ba205){if(_0x4ba205)return activateAdditionalPhone(_0x505ed8,_0x116c34[_0x5864('0x18')],_0x4ba205,_0x116c34[_0x5864('0x2c')],_0x116c34[_0x5864('0x2d')])[_0x5864('0xb')](function(_0x56feee){_0x323782(_0x56feee);});else{_0x323782({'id':_0x505ed8['id'],'phone':''});}})[_0x5864('0x29')](function(_0x546752){logger['error'](_0x5864('0x15'),_0x546752[_0x5864('0x12')]);_0x587271(_0xa9bc9[_0x5864('0xf')](0x1f4,_0x546752[_0x5864('0x12')]));});}})[_0x5864('0x29')](function(_0x5abc76){logger['error'](_0x5864('0x15'),_0x5abc76[_0x5864('0x12')]);_0x587271(_0xa9bc9[_0x5864('0xf')](0x1f4,_0x5abc76[_0x5864('0x12')]));});}else _0x323782(0x1);});});};function activateAdditionalPhone(_0x3dd088,_0x1fa74d,_0x40bd01,_0x29b38c,_0x48976d){return new Promise(function(_0x3796e0,_0x849bf9){var _0x32e5d0;if(_['isNil'](_0x40bd01[_0x5864('0x2e')])){_0x40bd01['scheduledat']=moment();}if(moment()>moment(_0x40bd01[_0x5864('0x2e')])){_0x32e5d0=moment()['add'](_0x48976d||0x3,_0x5864('0x2f'));}else{if(_0x40bd01[_0x5864('0x1d')]==0x0){_0x32e5d0=moment(_0x40bd01[_0x5864('0x2e')]);}else{_0x32e5d0=moment()[_0x5864('0x30')](_0x48976d||0x3,_0x5864('0x2f'));}}if(_[_0x5864('0x31')](_0x32e5d0)){_0x32e5d0=moment()[_0x5864('0x30')](_0x48976d||0x3,_0x5864('0x2f'));}var _0x24c116={'phone':_0x3dd088[_0x5864('0x32')],'active':0x0,'OrderBy':_[_0x5864('0x31')](_0x3dd088[_0x5864('0x1d')])?0x0:_0x3dd088[_0x5864('0x1d')],'scheduledat':moment()[_0x5864('0x30')](_0x29b38c||0x1,'minutes'),'countbusyretry':_0x1fa74d['countbusyretry'],'countcongestionretry':_0x1fa74d[_0x5864('0x20')],'countnoanswerretry':_0x1fa74d[_0x5864('0x27')],'countnosuchnumberretry':_0x1fa74d[_0x5864('0x21')],'countdropretry':_0x1fa74d[_0x5864('0x22')],'countabandonedretry':_0x1fa74d[_0x5864('0x28')],'countmachineretry':_0x1fa74d[_0x5864('0x23')],'countagentrejectretry':_0x1fa74d[_0x5864('0x24')],'createdAt':_0x1fa74d[_0x5864('0x33')],'updatedAt':_0x1fa74d[_0x5864('0x34')]};var _0x20fbc3={'CmHopperId':_0x3dd088['id'],'phone':_0x40bd01[_0x5864('0x32')],'active':0x0,'OrderBy':_[_0x5864('0x31')](_0x40bd01['OrderBy'])?0x0:_0x40bd01['OrderBy'],'scheduledat':_0x32e5d0,'countbusyretry':_0x40bd01[_0x5864('0x1f')],'countcongestionretry':_0x40bd01[_0x5864('0x20')],'countnoanswerretry':_0x40bd01[_0x5864('0x27')],'countnosuchnumberretry':_0x40bd01[_0x5864('0x21')],'countdropretry':_0x40bd01['countdropretry'],'countabandonedretry':_0x40bd01[_0x5864('0x28')],'countmachineretry':_0x40bd01[_0x5864('0x23')],'countagentrejectretry':_0x40bd01[_0x5864('0x24')],'createdAt':_0x40bd01['createdAt'],'updatedAt':_0x40bd01[_0x5864('0x34')]};return db[_0x5864('0x35')][_0x5864('0x36')](function(_0x30d1dc){return db[_0x5864('0x1b')][_0x5864('0x37')](_0x24c116,{'where':{'id':_0x40bd01['id']}},{'transaction':_0x30d1dc})[_0x5864('0xb')](function(){return db[_0x5864('0x16')][_0x5864('0x37')](_0x20fbc3,{'where':{'id':_0x3dd088['id']}},{'transaction':_0x30d1dc});});})[_0x5864('0xb')](function(_0x7ce515){_0x3796e0({'id':_0x3dd088['id'],'phone':_0x40bd01[_0x5864('0x32')]});})[_0x5864('0x29')](function(_0x2b97c4){logger[_0x5864('0xf')](_0x5864('0x38'),_0x2b97c4[_0x5864('0x12')]);_0x849bf9({'error':_0x2b97c4[_0x5864('0x12')]});});});}exports[_0x5864('0x39')]=function(_0x5f04fb){var _0x182ba7=this;return new Promise(function(_0x331411,_0x2c31db){return db[_0x5864('0x16')][_0x5864('0x37')](_0x5f04fb[_0x5864('0x18')][_0x5864('0x3a')],{'where':{'id':_0x5f04fb[_0x5864('0x18')]['id']}})[_0x5864('0xb')](function(_0x39a035){_0x331411(_0x39a035);})[_0x5864('0x29')](function(_0x2358df){logger['error'](_0x5864('0x39'),_0x2358df['message']);_0x2c31db(_0x182ba7[_0x5864('0xf')](0x1f4,_0x2358df[_0x5864('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 122aa15..8aa2912 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 _0x087b=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x5f4f42,_0x2ab674){var _0x1962cf=function(_0x46b09f){while(--_0x46b09f){_0x5f4f42['push'](_0x5f4f42['shift']());}};_0x1962cf(++_0x2ab674);}(_0x087b,0x11a));var _0xb087=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x087b[_0x40220a];return _0x3903cc;};'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('0xd')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0xf')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);module[_0xb087('0x13')]=router; \ No newline at end of file +var _0x1c83=['../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','util','path','Router','../../components/auth/service'];(function(_0x337f65,_0x42cdb3){var _0x14d06a=function(_0x272d70){while(--_0x272d70){_0x337f65['push'](_0x337f65['shift']());}};_0x14d06a(++_0x42cdb3);}(_0x1c83,0x16c));var _0x31c8=function(_0x571a56,_0x4bae9f){_0x571a56=_0x571a56-0x0;var _0xff3fa9=_0x1c83[_0x571a56];return _0xff3fa9;};'use strict';var multer=require('multer');var util=require(_0x31c8('0x0'));var path=require(_0x31c8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x31c8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x31c8('0x3'));var interaction=require(_0x31c8('0x4'));var config=require(_0x31c8('0x5'));var controller=require(_0x31c8('0x6'));router[_0x31c8('0x7')]('/',auth[_0x31c8('0x8')](),controller[_0x31c8('0x9')]);router[_0x31c8('0x7')](_0x31c8('0xa'),auth[_0x31c8('0x8')](),controller[_0x31c8('0xb')]);router[_0x31c8('0xc')]('/',auth[_0x31c8('0x8')](),controller[_0x31c8('0xd')]);router[_0x31c8('0xe')](_0x31c8('0xa'),auth['isAuthenticated'](),controller[_0x31c8('0xf')]);router['delete'](_0x31c8('0xa'),auth['isAuthenticated'](),controller['destroy']);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 4aa6158..4320aa7 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 _0x50df=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x7b39c2,_0xc466c6){var _0x24fb8f=function(_0x58d899){while(--_0x58d899){_0x7b39c2['push'](_0x7b39c2['shift']());}};_0x24fb8f(++_0xc466c6);}(_0x50df,0x168));var _0xf50d=function(_0x282a40,_0x248b5e){_0x282a40=_0x282a40-0x0;var _0xf422ec=_0x50df[_0x282a40];return _0xf422ec;};'use strict';var moment=require(_0xf50d('0x0'));var Sequelize=require('sequelize');module[_0xf50d('0x1')]={'phone':{'type':Sequelize[_0xf50d('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf50d('0x3')],'unique':_0xf50d('0x4')},'ListId':{'type':Sequelize[_0xf50d('0x3')],'unique':_0xf50d('0x4')},'VoiceQueueId':{'type':Sequelize[_0xf50d('0x3')],'unique':_0xf50d('0x4')}}; \ No newline at end of file +var _0xb934=['contactListQueue','moment','sequelize','exports','INTEGER'];(function(_0x2c7ca2,_0x2a3d2f){var _0x2b1e63=function(_0x2ae293){while(--_0x2ae293){_0x2c7ca2['push'](_0x2c7ca2['shift']());}};_0x2b1e63(++_0x2a3d2f);}(_0xb934,0x92));var _0x4b93=function(_0x96de37,_0x1a0413){_0x96de37=_0x96de37-0x0;var _0x500f75=_0xb934[_0x96de37];return _0x500f75;};'use strict';var moment=require(_0x4b93('0x0'));var Sequelize=require(_0x4b93('0x1'));module[_0x4b93('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4b93('0x3')],'unique':_0x4b93('0x4')},'ListId':{'type':Sequelize[_0x4b93('0x3')],'unique':_0x4b93('0x4')},'VoiceQueueId':{'type':Sequelize[_0x4b93('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 389eb0a..80e4012 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 _0xa200=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x6dee97,_0x394c7d){var _0x1fe22f=function(_0x36e082){while(--_0x36e082){_0x6dee97['push'](_0x6dee97['shift']());}};_0x1fe22f(++_0x394c7d);}(_0xa200,0xd3));var _0x0a20=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa200[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a20('0x0'));var zipdir=require(_0x0a20('0x1'));var jsonpatch=require(_0x0a20('0x2'));var rp=require(_0x0a20('0x3'));var moment=require('moment');var BPromise=require(_0x0a20('0x4'));var Mustache=require(_0x0a20('0x5'));var util=require(_0x0a20('0x6'));var path=require(_0x0a20('0x7'));var sox=require(_0x0a20('0x8'));var csv=require(_0x0a20('0x9'));var ejs=require(_0x0a20('0xa'));var fs=require('fs');var fs_extra=require(_0x0a20('0xb'));var _=require(_0x0a20('0xc'));var squel=require(_0x0a20('0xd'));var crypto=require(_0x0a20('0xe'));var jsforce=require(_0x0a20('0xf'));var deskjs=require(_0x0a20('0x10'));var toCsv=require(_0x0a20('0x9'));var querystring=require(_0x0a20('0x11'));var Papa=require(_0x0a20('0x12'));var Redis=require(_0x0a20('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0a20('0x14'));var as=require(_0x0a20('0x15'));var hardwareService=require(_0x0a20('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x0a20('0x17'));var config=require(_0x0a20('0x18'));var licenseUtil=require(_0x0a20('0x19'));var db=require(_0x0a20('0x1a'))['db'];function respondWithStatusCode(_0x43ccce,_0x1592fc){_0x1592fc=_0x1592fc||0xcc;return function(_0x4a8014){if(_0x4a8014){return _0x43ccce[_0x0a20('0x1b')](_0x1592fc);}return _0x43ccce['status'](_0x1592fc)[_0x0a20('0x1c')]();};}function respondWithResult(_0xb1c5b2,_0x482878){_0x482878=_0x482878||0xc8;return function(_0x18a217){if(_0x18a217){return _0xb1c5b2[_0x0a20('0x1d')](_0x482878)['json'](_0x18a217);}};}function respondWithFilteredResult(_0x3420d2,_0x181341){return function(_0x1ad9e8){if(_0x1ad9e8){var _0x53c08b=typeof _0x181341['offset']===_0x0a20('0x1e')&&typeof _0x181341['limit']===_0x0a20('0x1e');var _0x12ed9e=_0x1ad9e8[_0x0a20('0x1f')];var _0x39db0d=_0x53c08b?0x0:_0x181341[_0x0a20('0x20')];var _0x41dc4e=_0x53c08b?_0x1ad9e8[_0x0a20('0x1f')]:_0x181341[_0x0a20('0x20')]+_0x181341[_0x0a20('0x21')];var _0x37c939;if(_0x41dc4e>=_0x12ed9e){_0x41dc4e=_0x12ed9e;_0x37c939=0xc8;}else{_0x37c939=0xce;}_0x3420d2[_0x0a20('0x1d')](_0x37c939);return _0x3420d2[_0x0a20('0x22')](_0x0a20('0x23'),_0x39db0d+'-'+_0x41dc4e+'/'+_0x12ed9e)['json'](_0x1ad9e8);}return null;};}function patchUpdates(_0x2ce953){return function(_0x2647ba){try{jsonpatch[_0x0a20('0x24')](_0x2647ba,_0x2ce953,!![]);}catch(_0x488199){return BPromise['reject'](_0x488199);}return _0x2647ba[_0x0a20('0x25')]();};}function saveUpdates(_0x5cf478,_0xd2a1e5){return function(_0xbfda94){if(_0xbfda94){return _0xbfda94[_0x0a20('0x26')](_0x5cf478)[_0x0a20('0x27')](function(_0x313c8c){return _0x313c8c;});}return null;};}function removeEntity(_0x2c2212,_0x361571){return function(_0x51de16){if(_0x51de16){return _0x51de16['destroy']()[_0x0a20('0x27')](function(){_0x2c2212[_0x0a20('0x1d')](0xcc)[_0x0a20('0x1c')]();});}};}function handleEntityNotFound(_0x4a88b5,_0x33c443){return function(_0x2706d5){if(!_0x2706d5){_0x4a88b5[_0x0a20('0x1b')](0x194);}return _0x2706d5;};}function handleError(_0x4327a5,_0x4afcf0){_0x4afcf0=_0x4afcf0||0x1f4;return function(_0x4d2f06){logger['error'](_0x4d2f06[_0x0a20('0x28')]);if(_0x4d2f06[_0x0a20('0x29')]){delete _0x4d2f06[_0x0a20('0x29')];}_0x4327a5[_0x0a20('0x1d')](_0x4afcf0)[_0x0a20('0x2a')](_0x4d2f06);};}exports[_0x0a20('0x2b')]=function(_0x4a2e92,_0x422130){var _0x4909e0={},_0x433c34={},_0x53f1a9={'count':0x0,'rows':[]};var _0x55d21f=_[_0x0a20('0x2c')](db[_0x0a20('0x2d')][_0x0a20('0x2e')],function(_0x1d0857){return{'name':_0x1d0857['fieldName'],'type':_0x1d0857[_0x0a20('0x2f')][_0x0a20('0x30')]};});_0x433c34[_0x0a20('0x31')]=_[_0x0a20('0x2c')](_0x55d21f,_0x0a20('0x29'));_0x433c34[_0x0a20('0x32')]=_[_0x0a20('0x33')](_0x4a2e92[_0x0a20('0x32')]);_0x433c34[_0x0a20('0x34')]=_['intersection'](_0x433c34[_0x0a20('0x31')],_0x433c34['query']);_0x4909e0[_0x0a20('0x35')]=_[_0x0a20('0x36')](_0x433c34[_0x0a20('0x31')],qs[_0x0a20('0x37')](_0x4a2e92[_0x0a20('0x32')][_0x0a20('0x37')]));_0x4909e0['attributes']=_0x4909e0[_0x0a20('0x35')][_0x0a20('0x38')]?_0x4909e0[_0x0a20('0x35')]:_0x433c34['model'];if(!_0x4a2e92['query'][_0x0a20('0x39')](_0x0a20('0x3a'))){_0x4909e0[_0x0a20('0x21')]=qs[_0x0a20('0x21')](_0x4a2e92[_0x0a20('0x32')][_0x0a20('0x21')]);_0x4909e0['offset']=qs[_0x0a20('0x20')](_0x4a2e92[_0x0a20('0x32')][_0x0a20('0x20')]);}_0x4909e0[_0x0a20('0x3b')]=qs[_0x0a20('0x3c')](_0x4a2e92[_0x0a20('0x32')][_0x0a20('0x3c')]);_0x4909e0[_0x0a20('0x3d')]=qs[_0x0a20('0x34')](_[_0x0a20('0x3e')](_0x4a2e92['query'],_0x433c34['filters']),_0x55d21f);if(_0x4a2e92[_0x0a20('0x32')][_0x0a20('0x3f')]){_0x4909e0[_0x0a20('0x3d')]=_[_0x0a20('0x40')](_0x4909e0[_0x0a20('0x3d')],{'$or':_[_0x0a20('0x2c')](_0x55d21f,function(_0x2e6759){if(_0x2e6759[_0x0a20('0x2f')]!==_0x0a20('0x41')){var _0x5c63c1={};_0x5c63c1[_0x2e6759['name']]={'$like':'%'+_0x4a2e92['query'][_0x0a20('0x3f')]+'%'};return _0x5c63c1;}})});}_0x4909e0=_['merge']({},_0x4909e0,_0x4a2e92['options']);var _0x17c6ed={'where':_0x4909e0[_0x0a20('0x3d')]};return db[_0x0a20('0x2d')][_0x0a20('0x1f')](_0x17c6ed)[_0x0a20('0x27')](function(_0x3d930d){_0x53f1a9['count']=_0x3d930d;if(_0x4a2e92['query']['includeAll']){_0x4909e0[_0x0a20('0x42')]=[{'all':!![]}];}return db[_0x0a20('0x2d')][_0x0a20('0x43')](_0x4909e0);})['then'](function(_0x707f88){_0x53f1a9[_0x0a20('0x44')]=_0x707f88;return _0x53f1a9;})[_0x0a20('0x27')](respondWithFilteredResult(_0x422130,_0x4909e0))[_0x0a20('0x45')](handleError(_0x422130,null));};exports[_0x0a20('0x46')]=function(_0x5fa0aa,_0x27f683){var _0x33d1b2={'raw':!![],'where':{'id':_0x5fa0aa[_0x0a20('0x47')]['id']}},_0x40f1ba={};_0x40f1ba[_0x0a20('0x31')]=_[_0x0a20('0x33')](db['CmHopperBlack']['rawAttributes']);_0x40f1ba['query']=_[_0x0a20('0x33')](_0x5fa0aa[_0x0a20('0x32')]);_0x40f1ba['filters']=_[_0x0a20('0x36')](_0x40f1ba[_0x0a20('0x31')],_0x40f1ba[_0x0a20('0x32')]);_0x33d1b2[_0x0a20('0x35')]=_['intersection'](_0x40f1ba[_0x0a20('0x31')],qs[_0x0a20('0x37')](_0x5fa0aa[_0x0a20('0x32')][_0x0a20('0x37')]));_0x33d1b2[_0x0a20('0x35')]=_0x33d1b2[_0x0a20('0x35')][_0x0a20('0x38')]?_0x33d1b2[_0x0a20('0x35')]:_0x40f1ba[_0x0a20('0x31')];if(_0x5fa0aa[_0x0a20('0x32')][_0x0a20('0x48')]){_0x33d1b2[_0x0a20('0x42')]=[{'all':!![]}];}_0x33d1b2=_['merge']({},_0x33d1b2,_0x5fa0aa['options']);return db['CmHopperBlack']['find'](_0x33d1b2)[_0x0a20('0x27')](handleEntityNotFound(_0x27f683,null))['then'](respondWithResult(_0x27f683,null))[_0x0a20('0x45')](handleError(_0x27f683,null));};exports[_0x0a20('0x26')]=function(_0x2604c6,_0x1e7f4f){if(_0x2604c6[_0x0a20('0x49')]['id']){delete _0x2604c6['body']['id'];}return db[_0x0a20('0x2d')][_0x0a20('0x4a')]({'where':{'id':_0x2604c6[_0x0a20('0x47')]['id']}})[_0x0a20('0x27')](handleEntityNotFound(_0x1e7f4f,null))[_0x0a20('0x27')](saveUpdates(_0x2604c6[_0x0a20('0x49')],null))['then'](respondWithResult(_0x1e7f4f,null))[_0x0a20('0x45')](handleError(_0x1e7f4f,null));};exports[_0x0a20('0x4b')]=function(_0x360beb,_0x2e3865){return db['CmHopperBlack'][_0x0a20('0x4a')]({'where':{'id':_0x360beb[_0x0a20('0x47')]['id']}})[_0x0a20('0x27')](handleEntityNotFound(_0x2e3865,null))['then'](removeEntity(_0x2e3865,null))[_0x0a20('0x45')](handleError(_0x2e3865,null));};exports[_0x0a20('0x4c')]=function(_0xbb9369,_0xa948d){return db[_0x0a20('0x2d')][_0x0a20('0x4c')]()[_0x0a20('0x27')](respondWithResult(_0xa948d,null))['catch'](handleError(_0xa948d,null));}; \ No newline at end of file +var _0x2895=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','rows','catch','show','params','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x3a8cbd,_0x46c2ec){var _0x337eca=function(_0x2feb78){while(--_0x2feb78){_0x3a8cbd['push'](_0x3a8cbd['shift']());}};_0x337eca(++_0x46c2ec);}(_0x2895,0x82));var _0x5289=function(_0x2800f9,_0x2f692b){_0x2800f9=_0x2800f9-0x0;var _0x4b683a=_0x2895[_0x2800f9];return _0x4b683a;};'use strict';var emlformat=require(_0x5289('0x0'));var rimraf=require(_0x5289('0x1'));var zipdir=require(_0x5289('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5289('0x3'));var moment=require(_0x5289('0x4'));var BPromise=require(_0x5289('0x5'));var Mustache=require(_0x5289('0x6'));var util=require('util');var path=require(_0x5289('0x7'));var sox=require('sox');var csv=require(_0x5289('0x8'));var ejs=require(_0x5289('0x9'));var fs=require('fs');var fs_extra=require(_0x5289('0xa'));var _=require(_0x5289('0xb'));var squel=require(_0x5289('0xc'));var crypto=require(_0x5289('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5289('0xe'));var toCsv=require(_0x5289('0x8'));var querystring=require(_0x5289('0xf'));var Papa=require(_0x5289('0x10'));var Redis=require(_0x5289('0x11'));var authService=require(_0x5289('0x12'));var qs=require(_0x5289('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5289('0x14'));var logger=require(_0x5289('0x15'))('api');var utils=require(_0x5289('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5289('0x17'))['db'];function respondWithStatusCode(_0x5c71e3,_0x4c2b68){_0x4c2b68=_0x4c2b68||0xcc;return function(_0x2bab36){if(_0x2bab36){return _0x5c71e3[_0x5289('0x18')](_0x4c2b68);}return _0x5c71e3[_0x5289('0x19')](_0x4c2b68)[_0x5289('0x1a')]();};}function respondWithResult(_0x2d3554,_0x5a7edb){_0x5a7edb=_0x5a7edb||0xc8;return function(_0x4307b5){if(_0x4307b5){return _0x2d3554[_0x5289('0x19')](_0x5a7edb)[_0x5289('0x1b')](_0x4307b5);}};}function respondWithFilteredResult(_0x412eca,_0x4a5ae5){return function(_0x11ec93){if(_0x11ec93){var _0x3989e4=typeof _0x4a5ae5[_0x5289('0x1c')]===_0x5289('0x1d')&&typeof _0x4a5ae5[_0x5289('0x1e')]===_0x5289('0x1d');var _0x538aa5=_0x11ec93[_0x5289('0x1f')];var _0x1d631b=_0x3989e4?0x0:_0x4a5ae5[_0x5289('0x1c')];var _0xb64ea4=_0x3989e4?_0x11ec93[_0x5289('0x1f')]:_0x4a5ae5[_0x5289('0x1c')]+_0x4a5ae5[_0x5289('0x1e')];var _0x3ba6d4;if(_0xb64ea4>=_0x538aa5){_0xb64ea4=_0x538aa5;_0x3ba6d4=0xc8;}else{_0x3ba6d4=0xce;}_0x412eca[_0x5289('0x19')](_0x3ba6d4);return _0x412eca['set'](_0x5289('0x20'),_0x1d631b+'-'+_0xb64ea4+'/'+_0x538aa5)[_0x5289('0x1b')](_0x11ec93);}return null;};}function patchUpdates(_0x566567){return function(_0x4fdadc){try{jsonpatch[_0x5289('0x21')](_0x4fdadc,_0x566567,!![]);}catch(_0x380a71){return BPromise['reject'](_0x380a71);}return _0x4fdadc[_0x5289('0x22')]();};}function saveUpdates(_0xae4e70,_0x459828){return function(_0x18d0f4){if(_0x18d0f4){return _0x18d0f4[_0x5289('0x23')](_0xae4e70)[_0x5289('0x24')](function(_0x480139){return _0x480139;});}return null;};}function removeEntity(_0x59ab40,_0x2215a8){return function(_0x2b0b33){if(_0x2b0b33){return _0x2b0b33[_0x5289('0x25')]()['then'](function(){_0x59ab40[_0x5289('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x314480,_0x292923){return function(_0x47fd60){if(!_0x47fd60){_0x314480[_0x5289('0x18')](0x194);}return _0x47fd60;};}function handleError(_0x4bae78,_0x3e2246){_0x3e2246=_0x3e2246||0x1f4;return function(_0x16aa73){logger[_0x5289('0x26')](_0x16aa73[_0x5289('0x27')]);if(_0x16aa73[_0x5289('0x28')]){delete _0x16aa73[_0x5289('0x28')];}_0x4bae78[_0x5289('0x19')](_0x3e2246)[_0x5289('0x29')](_0x16aa73);};}exports[_0x5289('0x2a')]=function(_0x3c728e,_0x5ed7d1){var _0x446bf9={},_0x3e2679={},_0x4bbfeb={'count':0x0,'rows':[]};var _0x287e80=_['map'](db['CmHopperBlack'][_0x5289('0x2b')],function(_0x4d9913){return{'name':_0x4d9913[_0x5289('0x2c')],'type':_0x4d9913[_0x5289('0x2d')]['key']};});_0x3e2679[_0x5289('0x2e')]=_[_0x5289('0x2f')](_0x287e80,_0x5289('0x28'));_0x3e2679['query']=_[_0x5289('0x30')](_0x3c728e[_0x5289('0x31')]);_0x3e2679[_0x5289('0x32')]=_['intersection'](_0x3e2679[_0x5289('0x2e')],_0x3e2679[_0x5289('0x31')]);_0x446bf9[_0x5289('0x33')]=_[_0x5289('0x34')](_0x3e2679[_0x5289('0x2e')],qs[_0x5289('0x35')](_0x3c728e[_0x5289('0x31')][_0x5289('0x35')]));_0x446bf9['attributes']=_0x446bf9['attributes'][_0x5289('0x36')]?_0x446bf9[_0x5289('0x33')]:_0x3e2679[_0x5289('0x2e')];if(!_0x3c728e[_0x5289('0x31')][_0x5289('0x37')](_0x5289('0x38'))){_0x446bf9['limit']=qs['limit'](_0x3c728e[_0x5289('0x31')][_0x5289('0x1e')]);_0x446bf9['offset']=qs[_0x5289('0x1c')](_0x3c728e[_0x5289('0x31')][_0x5289('0x1c')]);}_0x446bf9['order']=qs['sort'](_0x3c728e[_0x5289('0x31')][_0x5289('0x39')]);_0x446bf9[_0x5289('0x3a')]=qs[_0x5289('0x32')](_[_0x5289('0x3b')](_0x3c728e[_0x5289('0x31')],_0x3e2679['filters']),_0x287e80);if(_0x3c728e[_0x5289('0x31')][_0x5289('0x3c')]){_0x446bf9[_0x5289('0x3a')]=_[_0x5289('0x3d')](_0x446bf9[_0x5289('0x3a')],{'$or':_['map'](_0x287e80,function(_0x493a89){if(_0x493a89[_0x5289('0x2d')]!==_0x5289('0x3e')){var _0x277c74={};_0x277c74[_0x493a89[_0x5289('0x28')]]={'$like':'%'+_0x3c728e['query']['filter']+'%'};return _0x277c74;}})});}_0x446bf9=_[_0x5289('0x3d')]({},_0x446bf9,_0x3c728e[_0x5289('0x3f')]);var _0x4a55ee={'where':_0x446bf9[_0x5289('0x3a')]};return db[_0x5289('0x40')][_0x5289('0x1f')](_0x4a55ee)['then'](function(_0x5a65a5){_0x4bbfeb['count']=_0x5a65a5;if(_0x3c728e[_0x5289('0x31')][_0x5289('0x41')]){_0x446bf9[_0x5289('0x42')]=[{'all':!![]}];}return db[_0x5289('0x40')]['findAll'](_0x446bf9);})[_0x5289('0x24')](function(_0x230227){_0x4bbfeb[_0x5289('0x43')]=_0x230227;return _0x4bbfeb;})['then'](respondWithFilteredResult(_0x5ed7d1,_0x446bf9))[_0x5289('0x44')](handleError(_0x5ed7d1,null));};exports[_0x5289('0x45')]=function(_0x5c6506,_0xec3fd2){var _0x325ee1={'raw':!![],'where':{'id':_0x5c6506[_0x5289('0x46')]['id']}},_0x5f3cb2={};_0x5f3cb2[_0x5289('0x2e')]=_[_0x5289('0x30')](db[_0x5289('0x40')][_0x5289('0x2b')]);_0x5f3cb2[_0x5289('0x31')]=_[_0x5289('0x30')](_0x5c6506[_0x5289('0x31')]);_0x5f3cb2['filters']=_[_0x5289('0x34')](_0x5f3cb2[_0x5289('0x2e')],_0x5f3cb2['query']);_0x325ee1[_0x5289('0x33')]=_[_0x5289('0x34')](_0x5f3cb2[_0x5289('0x2e')],qs['fields'](_0x5c6506['query'][_0x5289('0x35')]));_0x325ee1[_0x5289('0x33')]=_0x325ee1[_0x5289('0x33')]['length']?_0x325ee1[_0x5289('0x33')]:_0x5f3cb2[_0x5289('0x2e')];if(_0x5c6506[_0x5289('0x31')][_0x5289('0x41')]){_0x325ee1['include']=[{'all':!![]}];}_0x325ee1=_[_0x5289('0x3d')]({},_0x325ee1,_0x5c6506[_0x5289('0x3f')]);return db['CmHopperBlack']['find'](_0x325ee1)[_0x5289('0x24')](handleEntityNotFound(_0xec3fd2,null))[_0x5289('0x24')](respondWithResult(_0xec3fd2,null))['catch'](handleError(_0xec3fd2,null));};exports[_0x5289('0x23')]=function(_0x5532c3,_0xa82246){if(_0x5532c3[_0x5289('0x47')]['id']){delete _0x5532c3[_0x5289('0x47')]['id'];}return db[_0x5289('0x40')][_0x5289('0x48')]({'where':{'id':_0x5532c3[_0x5289('0x46')]['id']}})[_0x5289('0x24')](handleEntityNotFound(_0xa82246,null))['then'](saveUpdates(_0x5532c3[_0x5289('0x47')],null))['then'](respondWithResult(_0xa82246,null))[_0x5289('0x44')](handleError(_0xa82246,null));};exports[_0x5289('0x25')]=function(_0xbe7636,_0x42ed36){return db[_0x5289('0x40')]['find']({'where':{'id':_0xbe7636[_0x5289('0x46')]['id']}})['then'](handleEntityNotFound(_0x42ed36,null))[_0x5289('0x24')](removeEntity(_0x42ed36,null))['catch'](handleError(_0x42ed36,null));};exports['describe']=function(_0x1acb60,_0x47842f){return db[_0x5289('0x40')][_0x5289('0x49')]()[_0x5289('0x24')](respondWithResult(_0x47842f,null))['catch'](handleError(_0x47842f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 95c9be1..30eb432 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 _0x7bb2=['moment','path','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','util','../../config/logger','api'];(function(_0xd8878e,_0x35cbe6){var _0x5f1214=function(_0x15c0d8){while(--_0x15c0d8){_0xd8878e['push'](_0xd8878e['shift']());}};_0x5f1214(++_0x35cbe6);}(_0x7bb2,0xcc));var _0x27bb=function(_0x4b384e,_0x38386e){_0x4b384e=_0x4b384e-0x0;var _0x393b4d=_0x7bb2[_0x4b384e];return _0x393b4d;};'use strict';var _=require('lodash');var util=require(_0x27bb('0x0'));var logger=require(_0x27bb('0x1'))(_0x27bb('0x2'));var moment=require(_0x27bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x27bb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x27bb('0x5'));module[_0x27bb('0x6')]=function(_0x5f0498,_0x545238){return _0x5f0498['define'](_0x27bb('0x7'),attributes,{'tableName':_0x27bb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x482c=['CmHopperBlack','util','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define'];(function(_0x34df03,_0x382a3a){var _0x3dde93=function(_0x4db57b){while(--_0x4db57b){_0x34df03['push'](_0x34df03['shift']());}};_0x3dde93(++_0x382a3a);}(_0x482c,0x13c));var _0xc482=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x482c[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xc482('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc482('0x1'));var rp=require(_0xc482('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc482('0x3'));var config=require(_0xc482('0x4'));var attributes=require(_0xc482('0x5'));module[_0xc482('0x6')]=function(_0x53ce84,_0x2b079b){return _0x53ce84[_0xc482('0x7')](_0xc482('0x8'),attributes,{'tableName':'cm_hopper_black','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 34aa7fa..e0db805 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 _0x35c1=['request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','attributes','limit','map','include','model','GetCmHopperBlack','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x35c1,0x12c));var _0x135c=function(_0x4ccd75,_0x228c4b){_0x4ccd75=_0x4ccd75-0x0;var _0x558e01=_0x35c1[_0x4ccd75];return _0x558e01;};'use strict';var _=require(_0x135c('0x0'));var util=require(_0x135c('0x1'));var moment=require('moment');var BPromise=require(_0x135c('0x2'));var rs=require(_0x135c('0x3'));var fs=require('fs');var Redis=require(_0x135c('0x4'));var db=require(_0x135c('0x5'))['db'];var utils=require(_0x135c('0x6'));var logger=require(_0x135c('0x7'))('rpc');var config=require(_0x135c('0x8'));var jayson=require(_0x135c('0x9'));var client=jayson[_0x135c('0xa')][_0x135c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a994,_0x5a7130,_0x2b940a){return new BPromise(function(_0x4939e0,_0x187cc0){return client[_0x135c('0xc')](_0x49a994,_0x2b940a)[_0x135c('0xd')](function(_0xb4d0c0){logger[_0x135c('0xe')](_0x135c('0xf'),_0x5a7130,_0x135c('0x10'));logger[_0x135c('0x11')](_0x135c('0x12'),_0x5a7130,_0x135c('0x10'),JSON[_0x135c('0x13')](_0xb4d0c0));if(_0xb4d0c0[_0x135c('0x14')]){if(_0xb4d0c0[_0x135c('0x14')][_0x135c('0x15')]===0x1f4){logger[_0x135c('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x5a7130,_0xb4d0c0[_0x135c('0x14')][_0x135c('0x16')]);return _0x187cc0(_0xb4d0c0[_0x135c('0x14')][_0x135c('0x16')]);}logger[_0x135c('0x14')](_0x135c('0xf'),_0x5a7130,_0xb4d0c0[_0x135c('0x14')][_0x135c('0x16')]);return _0x4939e0(_0xb4d0c0[_0x135c('0x14')]['message']);}else{logger[_0x135c('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x5a7130,'request\x20sent');_0x4939e0(_0xb4d0c0[_0x135c('0x17')][_0x135c('0x16')]);}})[_0x135c('0x18')](function(_0x1eb4fc){logger[_0x135c('0x14')](_0x135c('0xf'),_0x5a7130,_0x1eb4fc);_0x187cc0(_0x1eb4fc);});});}exports['GetCmHopperBlack']=function(_0x49bb9f){var _0x2cbdeb=this;return new Promise(function(_0x145a25,_0x26e6df){return db[_0x135c('0x19')][_0x135c('0x1a')]({'raw':_0x49bb9f[_0x135c('0x1b')]?_0x49bb9f['options'][_0x135c('0x1c')]===undefined?!![]:![]:!![],'where':_0x49bb9f[_0x135c('0x1b')]?_0x49bb9f[_0x135c('0x1b')]['where']||null:null,'attributes':_0x49bb9f[_0x135c('0x1b')]?_0x49bb9f['options'][_0x135c('0x1d')]||null:null,'limit':_0x49bb9f[_0x135c('0x1b')]?_0x49bb9f['options'][_0x135c('0x1e')]||null:null,'include':_0x49bb9f[_0x135c('0x1b')]?_0x49bb9f[_0x135c('0x1b')]['include']?_[_0x135c('0x1f')](_0x49bb9f[_0x135c('0x1b')][_0x135c('0x20')],function(_0x449326){return{'model':db[_0x449326[_0x135c('0x21')]],'as':_0x449326['as'],'attributes':_0x449326['attributes'],'include':_0x449326[_0x135c('0x20')]?_[_0x135c('0x1f')](_0x449326[_0x135c('0x20')],function(_0x51b0ad){return{'model':db[_0x51b0ad[_0x135c('0x21')]],'as':_0x51b0ad['as'],'attributes':_0x51b0ad[_0x135c('0x1d')],'include':_0x51b0ad[_0x135c('0x20')]?_['map'](_0x51b0ad[_0x135c('0x20')],function(_0x3d268a){return{'model':db[_0x3d268a[_0x135c('0x21')]],'as':_0x3d268a['as'],'attributes':_0x3d268a[_0x135c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x135c('0xd')](function(_0x478c47){logger['info']('GetCmHopperBlack',_0x49bb9f);logger[_0x135c('0x11')](_0x135c('0x22'),_0x49bb9f,JSON['stringify'](_0x478c47));_0x145a25(_0x478c47);})[_0x135c('0x18')](function(_0x57f5a4){logger[_0x135c('0x14')](_0x135c('0x22'),_0x57f5a4[_0x135c('0x16')],_0x49bb9f);_0x26e6df(_0x2cbdeb[_0x135c('0x14')](0x1f4,_0x57f5a4[_0x135c('0x16')]));});});};exports[_0x135c('0x23')]=function(_0x2ba5e6){var _0x15f271=this;return new Promise(function(_0x541b4b,_0x1338a4){return db['CmHopperBlack']['update'](_0x2ba5e6['body'],{'raw':_0x2ba5e6['options']?_0x2ba5e6[_0x135c('0x1b')][_0x135c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ba5e6[_0x135c('0x1b')]?_0x2ba5e6[_0x135c('0x1b')]['where']||null:null,'attributes':_0x2ba5e6[_0x135c('0x1b')]?_0x2ba5e6[_0x135c('0x1b')][_0x135c('0x1d')]||null:null,'limit':_0x2ba5e6[_0x135c('0x1b')]?_0x2ba5e6['options'][_0x135c('0x1e')]||null:null})[_0x135c('0xd')](function(_0x28715b){logger[_0x135c('0xe')](_0x135c('0x23'),_0x2ba5e6);logger[_0x135c('0x11')](_0x135c('0x23'),_0x2ba5e6,JSON[_0x135c('0x13')](_0x28715b));_0x541b4b(_0x28715b);})['catch'](function(_0x3e1204){logger['error'](_0x135c('0x23'),_0x3e1204[_0x135c('0x16')],_0x2ba5e6);_0x1338a4(_0x15f271[_0x135c('0x14')](0x1f4,_0x3e1204['message']));});});};exports[_0x135c('0x24')]=function(_0x336dea){var _0x41ff6c=this;return new Promise(function(_0x223fb6,_0x4b10df){return db[_0x135c('0x19')][_0x135c('0x25')]({'where':_0x336dea[_0x135c('0x1b')]?_0x336dea[_0x135c('0x1b')][_0x135c('0x26')]||null:null})[_0x135c('0xd')](function(_0x3893ed){logger['info'](_0x135c('0x24'),_0x336dea);logger[_0x135c('0x11')](_0x135c('0x24'),_0x336dea,JSON[_0x135c('0x13')](_0x3893ed));_0x223fb6(_0x3893ed);})[_0x135c('0x18')](function(_0x4f4cdf){logger['error']('DestroyCmHopperBlack',_0x4f4cdf[_0x135c('0x16')],_0x336dea);_0x4b10df(_0x41ff6c['error'](0x1f4,_0x4f4cdf[_0x135c('0x16')]));});});}; \ No newline at end of file +var _0xce5f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CmHopperBlack','options','raw','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','body','where','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring'];(function(_0x350c22,_0x596abc){var _0x59a6a8=function(_0x105775){while(--_0x105775){_0x350c22['push'](_0x350c22['shift']());}};_0x59a6a8(++_0x596abc);}(_0xce5f,0x148));var _0xfce5=function(_0x229432,_0x14f606){_0x229432=_0x229432-0x0;var _0x3d551c=_0xce5f[_0x229432];return _0x3d551c;};'use strict';var _=require(_0xfce5('0x0'));var util=require(_0xfce5('0x1'));var moment=require(_0xfce5('0x2'));var BPromise=require(_0xfce5('0x3'));var rs=require(_0xfce5('0x4'));var fs=require('fs');var Redis=require(_0xfce5('0x5'));var db=require(_0xfce5('0x6'))['db'];var utils=require(_0xfce5('0x7'));var logger=require(_0xfce5('0x8'))(_0xfce5('0x9'));var config=require(_0xfce5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfce5('0xb')][_0xfce5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26afcc,_0x1f53c1,_0x511c4d){return new BPromise(function(_0x386dba,_0x1ab75d){return client[_0xfce5('0xd')](_0x26afcc,_0x511c4d)[_0xfce5('0xe')](function(_0x25505e){logger[_0xfce5('0xf')](_0xfce5('0x10'),_0x1f53c1,'request\x20sent');logger[_0xfce5('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1f53c1,_0xfce5('0x12'),JSON[_0xfce5('0x13')](_0x25505e));if(_0x25505e['error']){if(_0x25505e[_0xfce5('0x14')]['code']===0x1f4){logger[_0xfce5('0x14')](_0xfce5('0x10'),_0x1f53c1,_0x25505e[_0xfce5('0x14')]['message']);return _0x1ab75d(_0x25505e[_0xfce5('0x14')][_0xfce5('0x15')]);}logger[_0xfce5('0x14')](_0xfce5('0x10'),_0x1f53c1,_0x25505e['error'][_0xfce5('0x15')]);return _0x386dba(_0x25505e[_0xfce5('0x14')]['message']);}else{logger[_0xfce5('0xf')](_0xfce5('0x10'),_0x1f53c1,_0xfce5('0x12'));_0x386dba(_0x25505e[_0xfce5('0x16')][_0xfce5('0x15')]);}})[_0xfce5('0x17')](function(_0x3c59fb){logger[_0xfce5('0x14')](_0xfce5('0x10'),_0x1f53c1,_0x3c59fb);_0x1ab75d(_0x3c59fb);});});}exports['GetCmHopperBlack']=function(_0x4169af){var _0x16e67a=this;return new Promise(function(_0x54b678,_0x5600d8){return db[_0xfce5('0x18')]['findAll']({'raw':_0x4169af[_0xfce5('0x19')]?_0x4169af[_0xfce5('0x19')][_0xfce5('0x1a')]===undefined?!![]:![]:!![],'where':_0x4169af['options']?_0x4169af[_0xfce5('0x19')]['where']||null:null,'attributes':_0x4169af[_0xfce5('0x19')]?_0x4169af[_0xfce5('0x19')][_0xfce5('0x1b')]||null:null,'limit':_0x4169af[_0xfce5('0x19')]?_0x4169af[_0xfce5('0x19')]['limit']||null:null,'include':_0x4169af['options']?_0x4169af['options'][_0xfce5('0x1c')]?_[_0xfce5('0x1d')](_0x4169af['options'][_0xfce5('0x1c')],function(_0x123473){return{'model':db[_0x123473['model']],'as':_0x123473['as'],'attributes':_0x123473[_0xfce5('0x1b')],'include':_0x123473[_0xfce5('0x1c')]?_[_0xfce5('0x1d')](_0x123473[_0xfce5('0x1c')],function(_0x3bbf76){return{'model':db[_0x3bbf76[_0xfce5('0x1e')]],'as':_0x3bbf76['as'],'attributes':_0x3bbf76[_0xfce5('0x1b')],'include':_0x3bbf76[_0xfce5('0x1c')]?_[_0xfce5('0x1d')](_0x3bbf76['include'],function(_0x550243){return{'model':db[_0x550243[_0xfce5('0x1e')]],'as':_0x550243['as'],'attributes':_0x550243['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x355f10){logger[_0xfce5('0xf')](_0xfce5('0x1f'),_0x4169af);logger[_0xfce5('0x11')](_0xfce5('0x1f'),_0x4169af,JSON[_0xfce5('0x13')](_0x355f10));_0x54b678(_0x355f10);})[_0xfce5('0x17')](function(_0x1c0053){logger['error']('GetCmHopperBlack',_0x1c0053[_0xfce5('0x15')],_0x4169af);_0x5600d8(_0x16e67a[_0xfce5('0x14')](0x1f4,_0x1c0053[_0xfce5('0x15')]));});});};exports[_0xfce5('0x20')]=function(_0x13e8fe){var _0xdf6093=this;return new Promise(function(_0x6873d6,_0x3ba90c){return db[_0xfce5('0x18')]['update'](_0x13e8fe[_0xfce5('0x21')],{'raw':_0x13e8fe['options']?_0x13e8fe[_0xfce5('0x19')][_0xfce5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13e8fe[_0xfce5('0x19')]?_0x13e8fe[_0xfce5('0x19')][_0xfce5('0x22')]||null:null,'attributes':_0x13e8fe[_0xfce5('0x19')]?_0x13e8fe[_0xfce5('0x19')][_0xfce5('0x1b')]||null:null,'limit':_0x13e8fe['options']?_0x13e8fe['options']['limit']||null:null})[_0xfce5('0xe')](function(_0x3d77b4){logger[_0xfce5('0xf')](_0xfce5('0x20'),_0x13e8fe);logger[_0xfce5('0x11')]('UpdateCmHopperBlack',_0x13e8fe,JSON[_0xfce5('0x13')](_0x3d77b4));_0x6873d6(_0x3d77b4);})[_0xfce5('0x17')](function(_0x13691e){logger[_0xfce5('0x14')]('UpdateCmHopperBlack',_0x13691e[_0xfce5('0x15')],_0x13e8fe);_0x3ba90c(_0xdf6093[_0xfce5('0x14')](0x1f4,_0x13691e['message']));});});};exports[_0xfce5('0x23')]=function(_0x402fa3){var _0x1b6995=this;return new Promise(function(_0x5466aa,_0x4fbe51){return db['CmHopperBlack'][_0xfce5('0x24')]({'where':_0x402fa3['options']?_0x402fa3[_0xfce5('0x19')][_0xfce5('0x22')]||null:null})[_0xfce5('0xe')](function(_0x26c0c5){logger[_0xfce5('0xf')](_0xfce5('0x23'),_0x402fa3);logger[_0xfce5('0x11')](_0xfce5('0x23'),_0x402fa3,JSON[_0xfce5('0x13')](_0x26c0c5));_0x5466aa(_0x26c0c5);})['catch'](function(_0x298382){logger[_0xfce5('0x14')]('DestroyCmHopperBlack',_0x298382[_0xfce5('0x15')],_0x402fa3);_0x4fbe51(_0x1b6995[_0xfce5('0x14')](0x1f4,_0x298382[_0xfce5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 95dc26d..8c1f49e 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 _0xd046=['isAuthenticated','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./cmHopperBlack.controller','index','get','describe','show','/:id'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xd046,0x129));var _0x6d04=function(_0xb74348,_0x82bc07){_0xb74348=_0xb74348-0x0;var _0x11c899=_0xd046[_0xb74348];return _0x11c899;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d04('0x4'));var config=require('../../config/environment');var controller=require(_0x6d04('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d04('0x6')]);router[_0x6d04('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6d04('0x8')]);router[_0x6d04('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['put'](_0x6d04('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6d04('0xa'),auth[_0x6d04('0xb')](),controller[_0x6d04('0xc')]);module[_0x6d04('0xd')]=router; \ No newline at end of file +var _0x2d72=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','multer','util','path'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x2d72,0xa8));var _0x22d7=function(_0x2662cb,_0x2eafee){_0x2662cb=_0x2662cb-0x0;var _0x3ab7d6=_0x2d72[_0x2662cb];return _0x3ab7d6;};'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['put']('/:id',auth[_0x22d7('0xc')](),controller[_0x22d7('0x11')]);router[_0x22d7('0x12')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index bfa4248..02b33da 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 _0x7d6f=['sequelize','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','BOOLEAN'];(function(_0x265949,_0x51a0bc){var _0x47af4=function(_0x1a5e22){while(--_0x1a5e22){_0x265949['push'](_0x265949['shift']());}};_0x47af4(++_0x51a0bc);}(_0x7d6f,0x154));var _0xf7d6=function(_0x6e4a32,_0x4a1334){_0x6e4a32=_0x6e4a32-0x0;var _0x31a071=_0x7d6f[_0x6e4a32];return _0x31a071;};'use strict';var Sequelize=require(_0xf7d6('0x0'));var moment=require('moment');module[_0xf7d6('0x1')]={'state':{'type':Sequelize[_0xf7d6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf7d6('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf7d6('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf7d6('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf7d6('0x3')]},'calleridname':{'type':Sequelize[_0xf7d6('0x3')]},'starttime':{'type':Sequelize[_0xf7d6('0x4')]},'responsetime':{'type':Sequelize[_0xf7d6('0x4')]},'answertime':{'type':Sequelize[_0xf7d6('0x4')]},'droptime':{'type':Sequelize[_0xf7d6('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf7d6('0x3')]},'campaign':{'type':Sequelize[_0xf7d6('0x3')]},'campaigntype':{'type':Sequelize[_0xf7d6('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xf7d6('0x3')]},'secondDisposition':{'type':Sequelize[_0xf7d6('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf7d6('0x3')]},'dispositionat':{'type':Sequelize[_0xf7d6('0x4')],'set':function(_0x326500){var _0x3124d0=this[_0xf7d6('0x5')]('endtime');if(_0x3124d0&&_0x326500){this[_0xf7d6('0x6')](_0xf7d6('0x7'),moment(_0x326500)[_0xf7d6('0x8')](moment(_0x3124d0),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf7d6('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf7d6('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf7d6('0x4')]},'callback':{'type':Sequelize[_0xf7d6('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf7d6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xf7d6('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf7d6('0x4')]},'recallme':{'type':Sequelize[_0xf7d6('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf7d6('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf7d6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb52a=['DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','moment','exports'];(function(_0x5e49db,_0x5aaeda){var _0x32a679=function(_0x4ccf1b){while(--_0x4ccf1b){_0x5e49db['push'](_0x5e49db['shift']());}};_0x32a679(++_0x5aaeda);}(_0xb52a,0xc4));var _0xab52=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb52a[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xab52('0x0'));module[_0xab52('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xab52('0x2')]},'countbusyretry':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xab52('0x4')]},'originatecalleridname':{'type':Sequelize[_0xab52('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xab52('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xab52('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xab52('0x2')]},'endtime':{'type':Sequelize[_0xab52('0x2')]},'ringtime':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xab52('0x4')]},'membername':{'type':Sequelize[_0xab52('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xab52('0x4')]},'secondDisposition':{'type':Sequelize[_0xab52('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0xec3c90){var _0x18dae6=this[_0xab52('0x5')](_0xab52('0x6'));if(_0x18dae6&&_0xec3c90){this[_0xab52('0x7')](_0xab52('0x8'),moment(_0xec3c90)['diff'](moment(_0x18dae6),_0xab52('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xab52('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xab52('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xab52('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xab52('0x2')]},'callback':{'type':Sequelize[_0xab52('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xab52('0x2')]},'recallme':{'type':Sequelize[_0xab52('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xab52('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xab52('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 a505602..bcce0bb 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 _0x4137=['squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','literal','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['CmHopperFinal'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['describe']=function(_0x513657,_0x3c1f1a){return db['CmHopperFinal']['describe']()[_0x7413('0x25')](respondWithResult(_0x3c1f1a,null))[_0x7413('0x47')](handleError(_0x3c1f1a,null));};exports['update']=function(_0x2aa12c,_0x586d25){if(_0x2aa12c['body'][_0x7413('0x48')]){delete _0x2aa12c['body'][_0x7413('0x48')];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'uniqueid':_0x2aa12c[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x586d25,null))[_0x7413('0x25')](saveUpdates(_0x2aa12c[_0x7413('0x49')],null))[_0x7413('0x25')](respondWithResult(_0x586d25,null))[_0x7413('0x47')](handleError(_0x586d25,null));};exports[_0x7413('0x4a')]=function(_0x50a27d,_0x369891,_0x501407){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x50a27d[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x4d')))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x51')))),_0x7413('0x52')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x55')))),'abandonedContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x369891,null))[_0x7413('0x25')](respondWithResult(_0x369891,null))[_0x7413('0x47')](handleError(_0x369891,null));};exports[_0x7413('0x5a')]=function(_0x28130e,_0x593571,_0x35f7e8){return db['CmHopperFinal'][_0x7413('0x41')]({'raw':![],'where':{'CampaignId':_0x28130e[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x5b')))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x51')))),'congestionContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7413('0x5c')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x593571,null))[_0x7413('0x25')](respondWithResult(_0x593571,null))[_0x7413('0x47')](handleError(_0x593571,null));};exports[_0x7413('0x5d')]=function(_0x2c504e,_0x50910a,_0x5988bd){return db[_0x7413('0x5e')]['find']({'where':{'id':_0x2c504e[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x50910a,null))['then'](function(_0x2be9b1){var _0x4b676a;if(_0x2be9b1){_0x4b676a=squel[_0x7413('0x5f')]()[_0x7413('0x60')]('cm_hopper')['fromQuery']([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),'ListId',_0x7413('0x64'),_0x7413('0x65'),_0x7413('0x66')],squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x69'),'phone')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x62'))['field'](_0x7413('0x6b'),_0x7413('0x63'))[_0x7413('0x68')](_0x7413('0x6c'),_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x6e'),_0x7413('0x64'))[_0x7413('0x68')]('NOW()',_0x7413('0x65'))[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x71'),_0x2c504e['params']['id']['toString']())[_0x7413('0x3b')](_0x7413('0x72'),_0x2c504e['body'][_0x7413('0x73')][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('phone')[_0x7413('0x6f')]('cm_hopper')[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x77'))[_0x7413('0x6f')](_0x7413('0x70'))[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]())[_0x7413('0x3b')]('state\x20=\x204'))['group']('ContactId'))[_0x7413('0x74')]();return db['sequelize'][_0x7413('0x32')](_0x4b676a);}return[];})[_0x7413('0x25')](respondWithResult(_0x50910a,null))[_0x7413('0x47')](handleError(_0x50910a,null));};exports[_0x7413('0x78')]=function(_0x470c21,_0x17c115,_0xbba3c7){return db[_0x7413('0x79')][_0x7413('0x46')]({'where':{'id':_0x470c21['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x17c115,null))[_0x7413('0x25')](function(_0x38bb4e){var _0x4ea60e;if(_0x38bb4e){_0x4ea60e=squel[_0x7413('0x5f')]()[_0x7413('0x60')](_0x7413('0x7a'))[_0x7413('0x7b')]([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),_0x7413('0x6d'),_0x7413('0x7c'),_0x7413('0x65'),'updatedAt'],squel[_0x7413('0x67')]()[_0x7413('0x68')]('ANY_VALUE(calleridnum)',_0x7413('0x61'))[_0x7413('0x68')]('NOW()',_0x7413('0x62'))[_0x7413('0x68')](_0x7413('0x6b'),'ContactId')[_0x7413('0x68')]('ANY_VALUE(ListId)',_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x7d'),_0x7413('0x7c'))[_0x7413('0x68')](_0x7413('0x6a'),'createdAt')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x72'),_0x470c21['body']['state'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x7413('0x68')](_0x7413('0x61'))[_0x7413('0x6f')]('cm_hopper')['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('calleridnum')['from'](_0x7413('0x70'))[_0x7413('0x3b')]('CampaignId\x20=\x20?',_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x7f')))[_0x7413('0x80')](_0x7413('0x63')))[_0x7413('0x74')]();return db[_0x7413('0x4b')][_0x7413('0x32')](_0x4ea60e);}return[];})['then'](respondWithResult(_0x17c115,null))[_0x7413('0x47')](handleError(_0x17c115,null));};exports[_0x7413('0x81')]=function(_0x59d665,_0x1f3e26,_0xccd480){return db[_0x7413('0x82')]['findOne']({'where':{'VoiceQueueId':_0x59d665['body']['VoiceQueueId'],'CampaignId':_0x59d665[_0x7413('0x49')][_0x7413('0x7c')],'ContactId':_0x59d665[_0x7413('0x49')][_0x7413('0x63')]}})[_0x7413('0x25')](handleEntityNotFound(_0x1f3e26,null))[_0x7413('0x25')](function(_0x207293){if(_0x207293){return _0x207293;}return null;})[_0x7413('0x25')](respondWithResult(_0x1f3e26,null))['catch'](handleError(_0x1f3e26,null));}; \ No newline at end of file +var _0xd8fb=['updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','toString','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','options','find','describe','body','uniqueid','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt'];(function(_0x112f78,_0x261742){var _0x117e6b=function(_0x14ad2c){while(--_0x14ad2c){_0x112f78['push'](_0x112f78['shift']());}};_0x117e6b(++_0x261742);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3fca5c,_0x43bbea){_0x3fca5c=_0x3fca5c-0x0;var _0x435a13=_0xd8fb[_0x3fca5c];return _0x435a13;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=typeof _0xa57e91[_0xbd8f('0x18')]===_0xbd8f('0x19')&&typeof _0xa57e91['limit']===_0xbd8f('0x19');var _0xf5e7a=_0x10d72e['count'];var _0x4435b9=_0x4da96f?0x0:_0xa57e91[_0xbd8f('0x18')];var _0x47d317=_0x4da96f?_0x10d72e['count']:_0xa57e91[_0xbd8f('0x18')]+_0xa57e91['limit'];var _0x5705c5;if(_0x47d317>=_0xf5e7a){_0x47d317=_0xf5e7a;_0x5705c5=0xc8;}else{_0x5705c5=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5705c5);return _0x829fb2['set'](_0xbd8f('0x1a'),_0x4435b9+'-'+_0x47d317+'/'+_0xf5e7a)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0xb47c8e){return function(_0x897f25){try{jsonpatch[_0xbd8f('0x1b')](_0x897f25,_0xb47c8e,!![]);}catch(_0x20cab7){return BPromise[_0xbd8f('0x1c')](_0x20cab7);}return _0x897f25[_0xbd8f('0x1d')]();};}function saveUpdates(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x1e')](_0x2fbe3b)[_0xbd8f('0x1f')](function(_0x15c4a9){return _0x15c4a9;});}return null;};}function removeEntity(_0x320ede,_0xd11ae){return function(_0x395b1b){if(_0x395b1b){return _0x395b1b['destroy']()[_0xbd8f('0x1f')](function(){_0x320ede[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x2f3df7,_0xa88414){return function(_0x2257fd){if(!_0x2257fd){_0x2f3df7[_0xbd8f('0x14')](0x194);}return _0x2257fd;};}function handleError(_0x264e62,_0x4ea554){_0x4ea554=_0x4ea554||0x1f4;return function(_0x40cb43){logger[_0xbd8f('0x20')](_0x40cb43['stack']);if(_0x40cb43[_0xbd8f('0x21')]){delete _0x40cb43['name'];}_0x264e62[_0xbd8f('0x15')](_0x4ea554)[_0xbd8f('0x22')](_0x40cb43);};}exports[_0xbd8f('0x23')]=function(_0x202126,_0x2aefa2){var _0x247b07={},_0x4c4431={},_0x166de7={'count':0x0,'rows':[]};var _0x14f3cb=_[_0xbd8f('0x24')](db[_0xbd8f('0x25')][_0xbd8f('0x26')],function(_0x2ac26f){return{'name':_0x2ac26f[_0xbd8f('0x27')],'type':_0x2ac26f['type'][_0xbd8f('0x28')]};});_0x4c4431[_0xbd8f('0x29')]=_[_0xbd8f('0x24')](_0x14f3cb,_0xbd8f('0x21'));_0x4c4431['query']=_['keys'](_0x202126[_0xbd8f('0x2a')]);_0x4c4431[_0xbd8f('0x2b')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],_0x4c4431['query']);_0x247b07[_0xbd8f('0x2d')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x202126[_0xbd8f('0x2a')]['fields']));_0x247b07[_0xbd8f('0x2d')]=_0x247b07[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x247b07[_0xbd8f('0x2d')]:_0x4c4431[_0xbd8f('0x29')];if(!_0x202126['query'][_0xbd8f('0x30')]('nolimit')){_0x247b07[_0xbd8f('0x31')]=qs[_0xbd8f('0x31')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x31')]);_0x247b07[_0xbd8f('0x18')]=qs[_0xbd8f('0x18')](_0x202126['query']['offset']);}_0x247b07['order']=qs[_0xbd8f('0x32')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x32')]);_0x247b07[_0xbd8f('0x33')]=qs[_0xbd8f('0x2b')](_[_0xbd8f('0x34')](_0x202126[_0xbd8f('0x2a')],_0x4c4431[_0xbd8f('0x2b')]),_0x14f3cb);if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]){_0x247b07[_0xbd8f('0x33')]=_[_0xbd8f('0x36')](_0x247b07[_0xbd8f('0x33')],{'$or':_[_0xbd8f('0x24')](_0x14f3cb,function(_0x391d45){if(_0x391d45['type']!==_0xbd8f('0x37')){var _0x4181e0={};_0x4181e0[_0x391d45['name']]={'$like':'%'+_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]+'%'};return _0x4181e0;}})});}_0x247b07=_[_0xbd8f('0x36')]({},_0x247b07,_0x202126['options']);var _0x21da54={'where':_0x247b07['where']};return db[_0xbd8f('0x25')][_0xbd8f('0x38')](_0x21da54)[_0xbd8f('0x1f')](function(_0x4f2ebc){_0x166de7[_0xbd8f('0x38')]=_0x4f2ebc;if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x247b07['include']=[{'all':!![]}];}return db[_0xbd8f('0x25')][_0xbd8f('0x3a')](_0x247b07);})[_0xbd8f('0x1f')](function(_0x351027){_0x166de7[_0xbd8f('0x3b')]=_0x351027;return _0x166de7;})[_0xbd8f('0x1f')](respondWithFilteredResult(_0x2aefa2,_0x247b07))[_0xbd8f('0x3c')](handleError(_0x2aefa2,null));};exports[_0xbd8f('0x3d')]=function(_0x14b768,_0x5e1e77){var _0x52c62b={'raw':!![],'where':{'id':_0x14b768[_0xbd8f('0x3e')]['id']}},_0x2907a3={};_0x2907a3[_0xbd8f('0x29')]=_[_0xbd8f('0x3f')](db['CmHopperFinal'][_0xbd8f('0x26')]);_0x2907a3[_0xbd8f('0x2a')]=_[_0xbd8f('0x3f')](_0x14b768[_0xbd8f('0x2a')]);_0x2907a3[_0xbd8f('0x2b')]=_['intersection'](_0x2907a3['model'],_0x2907a3[_0xbd8f('0x2a')]);_0x52c62b['attributes']=_[_0xbd8f('0x2c')](_0x2907a3[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x2e')]));_0x52c62b[_0xbd8f('0x2d')]=_0x52c62b[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x52c62b['attributes']:_0x2907a3[_0xbd8f('0x29')];if(_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x52c62b[_0xbd8f('0x40')]=[{'all':!![]}];}_0x52c62b=_[_0xbd8f('0x36')]({},_0x52c62b,_0x14b768[_0xbd8f('0x41')]);return db[_0xbd8f('0x25')][_0xbd8f('0x42')](_0x52c62b)['then'](handleEntityNotFound(_0x5e1e77,null))[_0xbd8f('0x1f')](respondWithResult(_0x5e1e77,null))[_0xbd8f('0x3c')](handleError(_0x5e1e77,null));};exports[_0xbd8f('0x43')]=function(_0x1f12dd,_0x2fdbd0){return db[_0xbd8f('0x25')][_0xbd8f('0x43')]()[_0xbd8f('0x1f')](respondWithResult(_0x2fdbd0,null))[_0xbd8f('0x3c')](handleError(_0x2fdbd0,null));};exports[_0xbd8f('0x1e')]=function(_0x406741,_0x255c59){if(_0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')]){delete _0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')];}return db[_0xbd8f('0x25')][_0xbd8f('0x42')]({'where':{'uniqueid':_0x406741[_0xbd8f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x255c59,null))[_0xbd8f('0x1f')](saveUpdates(_0x406741[_0xbd8f('0x44')],null))[_0xbd8f('0x1f')](respondWithResult(_0x255c59,null))[_0xbd8f('0x3c')](handleError(_0x255c59,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x1b38ad,_0x5a33c5,_0x9bfe93){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'VoiceQueueId':_0x1b38ad[_0xbd8f('0x3e')]['id']},'attributes':[[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')]('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),_0xbd8f('0x51')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),'reCallContacts'],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x5a33c5,null))[_0xbd8f('0x1f')](respondWithResult(_0x5a33c5,null))[_0xbd8f('0x3c')](handleError(_0x5a33c5,null));};exports[_0xbd8f('0x54')]=function(_0x93452d,_0x4a86a9,_0x5ea275){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'CampaignId':_0x93452d[_0xbd8f('0x3e')]['id']},'attributes':[[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),'abandonedContacts'],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),_0xbd8f('0x55')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x56')))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x4a86a9,null))[_0xbd8f('0x1f')](respondWithResult(_0x4a86a9,null))[_0xbd8f('0x3c')](handleError(_0x4a86a9,null));};exports[_0xbd8f('0x57')]=function(_0x5a8c8f,_0x5c04d9,_0x2407e7){return db[_0xbd8f('0x58')][_0xbd8f('0x42')]({'where':{'id':_0x5a8c8f[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x5c04d9,null))['then'](function(_0x200718){var _0x27ec14;if(_0x200718){_0x27ec14=squel[_0xbd8f('0x59')]()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x61'),_0xbd8f('0x62'),_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x66'),_0xbd8f('0x5d'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),'ListId')['field'](_0xbd8f('0x69'),_0xbd8f('0x61'))['field'](_0xbd8f('0x6a'),'createdAt')[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')]('cm_hopper_final')[_0xbd8f('0x33')](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x5a8c8f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x5d'))[_0xbd8f('0x6b')]('cm_hopper')[_0xbd8f('0x33')]('VoiceQueueId\x20=\x20?',_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()[_0xbd8f('0x65')](_0xbd8f('0x71'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))['where'](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')]('state\x20=\x204'))['group'](_0xbd8f('0x5f')))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x27ec14);}return[];})[_0xbd8f('0x1f')](respondWithResult(_0x5c04d9,null))['catch'](handleError(_0x5c04d9,null));};exports[_0xbd8f('0x74')]=function(_0x13314f,_0x328bd6,_0x11a05a){return db[_0xbd8f('0x75')]['find']({'where':{'id':_0x13314f['params']['id']}})['then'](handleEntityNotFound(_0x328bd6,null))[_0xbd8f('0x1f')](function(_0x5df0e1){var _0x535869;if(_0x5df0e1){_0x535869=squel['insert']()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x76'),'createdAt',_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')]('ANY_VALUE(calleridnum)',_0xbd8f('0x5d'))[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),_0xbd8f('0x60'))['field'](_0xbd8f('0x77'),_0xbd8f('0x76'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x62'))['field'](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))[_0xbd8f('0x33')]('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x13314f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xbd8f('0x64')]()['field']('phone')['from'](_0xbd8f('0x5b'))[_0xbd8f('0x33')](_0xbd8f('0x78'),_0x13314f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()['field'](_0xbd8f('0x71'))['from'](_0xbd8f('0x72'))['where']('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x79')))[_0xbd8f('0x7a')]('ContactId'))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x535869);}return[];})['then'](respondWithResult(_0x328bd6,null))[_0xbd8f('0x3c')](handleError(_0x328bd6,null));};exports[_0xbd8f('0x7b')]=function(_0x38d1a6,_0x31b92c,_0x11fb11){return db[_0xbd8f('0x7c')][_0xbd8f('0x7d')]({'where':{'VoiceQueueId':_0x38d1a6[_0xbd8f('0x44')][_0xbd8f('0x61')],'CampaignId':_0x38d1a6[_0xbd8f('0x44')]['CampaignId'],'ContactId':_0x38d1a6['body']['ContactId']}})['then'](handleEntityNotFound(_0x31b92c,null))[_0xbd8f('0x1f')](function(_0x3ff503){if(_0x3ff503){return _0x3ff503;}return null;})['then'](respondWithResult(_0x31b92c,null))['catch'](handleError(_0x31b92c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index fa7df34..84ee63d 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 _0xd817=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xd817,0xb4));var _0x7d81=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0xd817[_0x5751e6];return _0x4199e4;};'use strict';var _=require(_0x7d81('0x0'));var util=require(_0x7d81('0x1'));var logger=require(_0x7d81('0x2'))('api');var moment=require(_0x7d81('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d81('0x4'));var fs=require('fs');var path=require(_0x7d81('0x5'));var rimraf=require(_0x7d81('0x6'));var config=require(_0x7d81('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x7d81('0x8')]=function(_0x4456a8,_0x2d10cd){return _0x4456a8[_0x7d81('0x9')](_0x7d81('0xa'),attributes,{'tableName':_0x7d81('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x7d81('0xc')]},{'name':_0x7d81('0xd'),'fields':[_0x7d81('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84b6=['request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x401681,_0x56835b){var _0x5e8192=function(_0x331289){while(--_0x331289){_0x401681['push'](_0x401681['shift']());}};_0x5e8192(++_0x56835b);}(_0x84b6,0x106));var _0x684b=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x84b6[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x684b('0x0'))(_0x684b('0x1'));var moment=require(_0x684b('0x2'));var BPromise=require(_0x684b('0x3'));var rp=require(_0x684b('0x4'));var fs=require('fs');var path=require(_0x684b('0x5'));var rimraf=require('rimraf');var config=require(_0x684b('0x6'));var attributes=require(_0x684b('0x7'));module[_0x684b('0x8')]=function(_0x1a6a26,_0x34636d){return _0x1a6a26[_0x684b('0x9')](_0x684b('0xa'),attributes,{'tableName':_0x684b('0xb'),'paranoid':![],'indexes':[{'name':_0x684b('0xc'),'fields':['calleridnum']},{'name':_0x684b('0xd'),'fields':[_0x684b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index a2faeb1..92ab431 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 _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xc0236e,_0xdf6cba){var _0x333fe9=function(_0xd0fcb1){while(--_0xd0fcb1){_0xc0236e['push'](_0xc0236e['shift']());}};_0x333fe9(++_0xdf6cba);}(_0x7a54,0x106));var _0x47a5=function(_0x2408ec,_0x3a36c9){_0x2408ec=_0x2408ec-0x0;var _0x51ffae=_0x7a54[_0x2408ec];return _0x51ffae;};'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')]('CmHopperFinal,\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['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5600f6,_0x5a3760){var _0x48bf5d=function(_0x23d4ea){while(--_0x23d4ea){_0x5600f6['push'](_0x5600f6['shift']());}};_0x48bf5d(++_0x5a3760);}(_0x7a54,0x106));var _0x47a5=function(_0x321fbb,_0x360241){_0x321fbb=_0x321fbb-0x0;var _0x400330=_0x7a54[_0x321fbb];return _0x400330;};'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')]('CmHopperFinal,\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['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index b033073..1beb78f 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 _0x3e94=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x49b238,_0x2d06d8){var _0x238565=function(_0x90a85d){while(--_0x90a85d){_0x49b238['push'](_0x49b238['shift']());}};_0x238565(++_0x2d06d8);}(_0x3e94,0x67));var _0x43e9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3e94[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var path=require('path');var timeout=require(_0x43e9('0x2'));var express=require(_0x43e9('0x3'));var router=express[_0x43e9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x43e9('0x5'));var interaction=require(_0x43e9('0x6'));var config=require(_0x43e9('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x43e9('0x8')]('/',auth['isAuthenticated'](),controller[_0x43e9('0x9')]);router['get'](_0x43e9('0xa'),auth[_0x43e9('0xb')](),controller[_0x43e9('0xc')]);router['get'](_0x43e9('0xd'),auth[_0x43e9('0xb')](),controller[_0x43e9('0xe')]);router[_0x43e9('0x8')](_0x43e9('0xf'),auth[_0x43e9('0xb')](),controller[_0x43e9('0x10')]);router[_0x43e9('0x8')](_0x43e9('0x11'),auth['isAuthenticated'](),controller[_0x43e9('0x12')]);router[_0x43e9('0x13')](_0x43e9('0x14'),auth['isAuthenticated'](),controller[_0x43e9('0x15')]);router[_0x43e9('0x13')](_0x43e9('0x16'),auth[_0x43e9('0xb')](),controller[_0x43e9('0x17')]);router['post']('/checkContactHopper',auth[_0x43e9('0xb')](),controller['checkContactHopper']);router[_0x43e9('0x18')](_0x43e9('0xd'),auth[_0x43e9('0xb')](),controller[_0x43e9('0x19')]);module[_0x43e9('0x1a')]=router; \ No newline at end of file +var _0x3ece=['../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','get','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','Router'];(function(_0x23bf40,_0xf05f78){var _0x33ca5c=function(_0x261581){while(--_0x261581){_0x23bf40['push'](_0x23bf40['shift']());}};_0x33ca5c(++_0xf05f78);}(_0x3ece,0x10e));var _0xe3ec=function(_0x242615,_0x46b21c){_0x242615=_0x242615-0x0;var _0x129256=_0x3ece[_0x242615];return _0x129256;};'use strict';var multer=require(_0xe3ec('0x0'));var util=require(_0xe3ec('0x1'));var path=require(_0xe3ec('0x2'));var timeout=require(_0xe3ec('0x3'));var express=require('express');var router=express[_0xe3ec('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe3ec('0x5'));var interaction=require(_0xe3ec('0x6'));var config=require('../../config/environment');var controller=require(_0xe3ec('0x7'));router['get']('/',auth[_0xe3ec('0x8')](),controller[_0xe3ec('0x9')]);router[_0xe3ec('0xa')]('/describe',auth[_0xe3ec('0x8')](),controller[_0xe3ec('0xb')]);router[_0xe3ec('0xa')](_0xe3ec('0xc'),auth[_0xe3ec('0x8')](),controller[_0xe3ec('0xd')]);router[_0xe3ec('0xa')](_0xe3ec('0xe'),auth[_0xe3ec('0x8')](),controller[_0xe3ec('0xf')]);router[_0xe3ec('0xa')]('/campaign/countAttributes/:id',auth[_0xe3ec('0x8')](),controller[_0xe3ec('0x10')]);router[_0xe3ec('0x11')](_0xe3ec('0x12'),auth[_0xe3ec('0x8')](),controller[_0xe3ec('0x13')]);router[_0xe3ec('0x11')]('/voice/campaign/moveContacts/:id',auth[_0xe3ec('0x8')](),controller[_0xe3ec('0x14')]);router['post'](_0xe3ec('0x15'),auth[_0xe3ec('0x8')](),controller[_0xe3ec('0x16')]);router[_0xe3ec('0x17')](_0xe3ec('0xc'),auth[_0xe3ec('0x8')](),controller['update']);module[_0xe3ec('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c4a900c..918d6db 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 _0xd90a=['STRING','BOOLEAN','sequelize','INTEGER','DATE'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0xd90a,0x6b));var _0xad90=function(_0x3f1dd4,_0x378d9b){_0x3f1dd4=_0x3f1dd4-0x0;var _0x5e0eb7=_0xd90a[_0x3f1dd4];return _0x5e0eb7;};'use strict';var Sequelize=require(_0xad90('0x0'));module['exports']={'state':{'type':Sequelize[_0xad90('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xad90('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xad90('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xad90('0x3')]},'originatecalleridname':{'type':Sequelize[_0xad90('0x3')]},'calleridnum':{'type':Sequelize[_0xad90('0x3')]},'calleridname':{'type':Sequelize[_0xad90('0x3')]},'starttime':{'type':Sequelize[_0xad90('0x2')]},'responsetime':{'type':Sequelize[_0xad90('0x2')]},'answertime':{'type':Sequelize[_0xad90('0x2')]},'droptime':{'type':Sequelize[_0xad90('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xad90('0x3')]},'campaign':{'type':Sequelize[_0xad90('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xad90('0x3')]},'reason':{'type':Sequelize[_0xad90('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xad90('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xad90('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xad90('0x2')]},'recallme':{'type':Sequelize[_0xad90('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xad90('0x2')]},'edited':{'type':Sequelize[_0xad90('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xad90('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xad90('0x3')]}}; \ No newline at end of file +var _0xe65b=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xe65b,0xf9));var _0xbe65=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe65b[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xbe65('0x0'));module[_0xbe65('0x1')]={'state':{'type':Sequelize[_0xbe65('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbe65('0x3')]},'scheduledat':{'type':Sequelize[_0xbe65('0x4')]},'countbusyretry':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbe65('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xbe65('0x3')]},'calleridnum':{'type':Sequelize[_0xbe65('0x3')]},'calleridname':{'type':Sequelize[_0xbe65('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbe65('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xbe65('0x4')]},'endtime':{'type':Sequelize[_0xbe65('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbe65('0x3')]},'campaign':{'type':Sequelize[_0xbe65('0x3')]},'campaigntype':{'type':Sequelize[_0xbe65('0x3')]},'membername':{'type':Sequelize[_0xbe65('0x3')]},'reason':{'type':Sequelize[_0xbe65('0x3')]},'amd':{'type':Sequelize[_0xbe65('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbe65('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xbe65('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbe65('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xbe65('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbe65('0x4')]},'edited':{'type':Sequelize[_0xbe65('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbe65('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xbe65('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a44cce0..6e5d8f3 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 _0x2a01=['moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','merge','filter','CmHopperHistory','includeAll','include','rows','catch','params','keys','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch'];(function(_0x590d15,_0x26d156){var _0x16377e=function(_0x281738){while(--_0x281738){_0x590d15['push'](_0x590d15['shift']());}};_0x16377e(++_0x26d156);}(_0x2a01,0x16a));var _0x12a0=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x2a01[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0x12a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12a0('0x1'));var jsonpatch=require(_0x12a0('0x2'));var rp=require('request-promise');var moment=require(_0x12a0('0x3'));var BPromise=require(_0x12a0('0x4'));var Mustache=require('mustache');var util=require(_0x12a0('0x5'));var path=require(_0x12a0('0x6'));var sox=require('sox');var csv=require(_0x12a0('0x7'));var ejs=require(_0x12a0('0x8'));var fs=require('fs');var fs_extra=require(_0x12a0('0x9'));var _=require('lodash');var squel=require(_0x12a0('0xa'));var crypto=require(_0x12a0('0xb'));var jsforce=require(_0x12a0('0xc'));var deskjs=require(_0x12a0('0xd'));var toCsv=require(_0x12a0('0x7'));var querystring=require(_0x12a0('0xe'));var Papa=require(_0x12a0('0xf'));var Redis=require(_0x12a0('0x10'));var authService=require(_0x12a0('0x11'));var qs=require(_0x12a0('0x12'));var as=require(_0x12a0('0x13'));var hardwareService=require(_0x12a0('0x14'));var logger=require('../../config/logger')(_0x12a0('0x15'));var utils=require(_0x12a0('0x16'));var config=require(_0x12a0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c83df,_0x282a1c){_0x282a1c=_0x282a1c||0xcc;return function(_0x500de4){if(_0x500de4){return _0x3c83df[_0x12a0('0x18')](_0x282a1c);}return _0x3c83df[_0x12a0('0x19')](_0x282a1c)['end']();};}function respondWithResult(_0x847b1e,_0x1a1526){_0x1a1526=_0x1a1526||0xc8;return function(_0x4be694){if(_0x4be694){return _0x847b1e[_0x12a0('0x19')](_0x1a1526)[_0x12a0('0x1a')](_0x4be694);}};}function respondWithFilteredResult(_0x494e67,_0x29cc7f){return function(_0x522483){if(_0x522483){var _0x49705b=typeof _0x29cc7f['offset']===_0x12a0('0x1b')&&typeof _0x29cc7f['limit']===_0x12a0('0x1b');var _0x1c2eba=_0x522483[_0x12a0('0x1c')];var _0x3a3ce1=_0x49705b?0x0:_0x29cc7f[_0x12a0('0x1d')];var _0x4da0e9=_0x49705b?_0x522483[_0x12a0('0x1c')]:_0x29cc7f[_0x12a0('0x1d')]+_0x29cc7f[_0x12a0('0x1e')];var _0x2bc8e7;if(_0x4da0e9>=_0x1c2eba){_0x4da0e9=_0x1c2eba;_0x2bc8e7=0xc8;}else{_0x2bc8e7=0xce;}_0x494e67[_0x12a0('0x19')](_0x2bc8e7);return _0x494e67[_0x12a0('0x1f')](_0x12a0('0x20'),_0x3a3ce1+'-'+_0x4da0e9+'/'+_0x1c2eba)['json'](_0x522483);}return null;};}function patchUpdates(_0x339dc4){return function(_0x2b5d50){try{jsonpatch[_0x12a0('0x21')](_0x2b5d50,_0x339dc4,!![]);}catch(_0x2ff5e8){return BPromise[_0x12a0('0x22')](_0x2ff5e8);}return _0x2b5d50[_0x12a0('0x23')]();};}function saveUpdates(_0x4c3f4d,_0x25f8bc){return function(_0x3ed702){if(_0x3ed702){return _0x3ed702[_0x12a0('0x24')](_0x4c3f4d)[_0x12a0('0x25')](function(_0x18f754){return _0x18f754;});}return null;};}function removeEntity(_0x546bff,_0x251ed){return function(_0x2c9598){if(_0x2c9598){return _0x2c9598[_0x12a0('0x26')]()['then'](function(){_0x546bff[_0x12a0('0x19')](0xcc)[_0x12a0('0x27')]();});}};}function handleEntityNotFound(_0x2d90b2,_0x1a49fb){return function(_0x288254){if(!_0x288254){_0x2d90b2[_0x12a0('0x18')](0x194);}return _0x288254;};}function handleError(_0x49ad63,_0x24f6d4){_0x24f6d4=_0x24f6d4||0x1f4;return function(_0x1b6743){logger[_0x12a0('0x28')](_0x1b6743[_0x12a0('0x29')]);if(_0x1b6743['name']){delete _0x1b6743[_0x12a0('0x2a')];}_0x49ad63[_0x12a0('0x19')](_0x24f6d4)[_0x12a0('0x2b')](_0x1b6743);};}exports[_0x12a0('0x2c')]=function(_0x25e6b9,_0x1fb642){var _0x252f25={},_0x50f70b={},_0x43b7ce={'count':0x0,'rows':[]};var _0x576620=_[_0x12a0('0x2d')](db['CmHopperHistory'][_0x12a0('0x2e')],function(_0x562b7a){return{'name':_0x562b7a[_0x12a0('0x2f')],'type':_0x562b7a['type']['key']};});_0x50f70b['model']=_[_0x12a0('0x2d')](_0x576620,_0x12a0('0x2a'));_0x50f70b[_0x12a0('0x30')]=_['keys'](_0x25e6b9[_0x12a0('0x30')]);_0x50f70b['filters']=_[_0x12a0('0x31')](_0x50f70b[_0x12a0('0x32')],_0x50f70b[_0x12a0('0x30')]);_0x252f25[_0x12a0('0x33')]=_[_0x12a0('0x31')](_0x50f70b[_0x12a0('0x32')],qs[_0x12a0('0x34')](_0x25e6b9[_0x12a0('0x30')][_0x12a0('0x34')]));_0x252f25[_0x12a0('0x33')]=_0x252f25[_0x12a0('0x33')][_0x12a0('0x35')]?_0x252f25[_0x12a0('0x33')]:_0x50f70b[_0x12a0('0x32')];if(!_0x25e6b9[_0x12a0('0x30')]['hasOwnProperty'](_0x12a0('0x36'))){_0x252f25[_0x12a0('0x1e')]=qs['limit'](_0x25e6b9[_0x12a0('0x30')][_0x12a0('0x1e')]);_0x252f25[_0x12a0('0x1d')]=qs[_0x12a0('0x1d')](_0x25e6b9[_0x12a0('0x30')][_0x12a0('0x1d')]);}_0x252f25[_0x12a0('0x37')]=qs['sort'](_0x25e6b9[_0x12a0('0x30')][_0x12a0('0x38')]);_0x252f25[_0x12a0('0x39')]=qs[_0x12a0('0x3a')](_['pick'](_0x25e6b9[_0x12a0('0x30')],_0x50f70b[_0x12a0('0x3a')]),_0x576620);if(_0x25e6b9[_0x12a0('0x30')]['filter']){_0x252f25[_0x12a0('0x39')]=_[_0x12a0('0x3b')](_0x252f25['where'],{'$or':_[_0x12a0('0x2d')](_0x576620,function(_0x7d9c20){if(_0x7d9c20['type']!=='VIRTUAL'){var _0x1d8576={};_0x1d8576[_0x7d9c20['name']]={'$like':'%'+_0x25e6b9['query'][_0x12a0('0x3c')]+'%'};return _0x1d8576;}})});}_0x252f25=_[_0x12a0('0x3b')]({},_0x252f25,_0x25e6b9['options']);var _0x40ff03={'where':_0x252f25[_0x12a0('0x39')]};return db[_0x12a0('0x3d')]['count'](_0x40ff03)[_0x12a0('0x25')](function(_0x5ca2c1){_0x43b7ce[_0x12a0('0x1c')]=_0x5ca2c1;if(_0x25e6b9[_0x12a0('0x30')][_0x12a0('0x3e')]){_0x252f25[_0x12a0('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x252f25);})[_0x12a0('0x25')](function(_0x549585){_0x43b7ce[_0x12a0('0x40')]=_0x549585;return _0x43b7ce;})[_0x12a0('0x25')](respondWithFilteredResult(_0x1fb642,_0x252f25))[_0x12a0('0x41')](handleError(_0x1fb642,null));};exports['show']=function(_0x57a01e,_0x518fba){var _0x1926b4={'raw':!![],'where':{'id':_0x57a01e[_0x12a0('0x42')]['id']}},_0x528b96={};_0x528b96[_0x12a0('0x32')]=_[_0x12a0('0x43')](db['CmHopperHistory'][_0x12a0('0x2e')]);_0x528b96[_0x12a0('0x30')]=_[_0x12a0('0x43')](_0x57a01e[_0x12a0('0x30')]);_0x528b96['filters']=_[_0x12a0('0x31')](_0x528b96[_0x12a0('0x32')],_0x528b96[_0x12a0('0x30')]);_0x1926b4['attributes']=_[_0x12a0('0x31')](_0x528b96[_0x12a0('0x32')],qs['fields'](_0x57a01e[_0x12a0('0x30')][_0x12a0('0x34')]));_0x1926b4[_0x12a0('0x33')]=_0x1926b4[_0x12a0('0x33')]['length']?_0x1926b4[_0x12a0('0x33')]:_0x528b96[_0x12a0('0x32')];if(_0x57a01e[_0x12a0('0x30')][_0x12a0('0x3e')]){_0x1926b4[_0x12a0('0x3f')]=[{'all':!![]}];}_0x1926b4=_[_0x12a0('0x3b')]({},_0x1926b4,_0x57a01e['options']);return db[_0x12a0('0x3d')][_0x12a0('0x44')](_0x1926b4)['then'](handleEntityNotFound(_0x518fba,null))['then'](respondWithResult(_0x518fba,null))[_0x12a0('0x41')](handleError(_0x518fba,null));};exports[_0x12a0('0x45')]=function(_0x1366a7,_0x2054de){return db[_0x12a0('0x3d')][_0x12a0('0x45')](_0x1366a7[_0x12a0('0x46')],{})[_0x12a0('0x25')](respondWithResult(_0x2054de,0xc9))[_0x12a0('0x41')](handleError(_0x2054de,null));};exports[_0x12a0('0x47')]=function(_0x4418d6,_0x1dfbf7){return db['CmHopperHistory']['describe']()[_0x12a0('0x25')](respondWithResult(_0x1dfbf7,null))[_0x12a0('0x41')](handleError(_0x1dfbf7,null));};exports['update']=function(_0x4f23f4,_0x41e51e){if(_0x4f23f4['body'][_0x12a0('0x48')]){delete _0x4f23f4[_0x12a0('0x46')]['uniqueid'];}return db[_0x12a0('0x3d')][_0x12a0('0x44')]({'where':{'uniqueid':_0x4f23f4[_0x12a0('0x42')]['id']}})['then'](handleEntityNotFound(_0x41e51e,null))[_0x12a0('0x25')](saveUpdates(_0x4f23f4[_0x12a0('0x46')],null))[_0x12a0('0x25')](respondWithResult(_0x41e51e,null))[_0x12a0('0x41')](handleError(_0x41e51e,null));}; \ No newline at end of file +var _0x2827=['error','stack','name','index','map','CmHopperHistory','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','catch','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2827,0x193));var _0x7282=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2827[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7282('0x0'));var rimraf=require(_0x7282('0x1'));var zipdir=require(_0x7282('0x2'));var jsonpatch=require(_0x7282('0x3'));var rp=require(_0x7282('0x4'));var moment=require('moment');var BPromise=require(_0x7282('0x5'));var Mustache=require('mustache');var util=require(_0x7282('0x6'));var path=require('path');var sox=require(_0x7282('0x7'));var csv=require('to-csv');var ejs=require(_0x7282('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7282('0x9'));var squel=require(_0x7282('0xa'));var crypto=require(_0x7282('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7282('0xc'));var querystring=require(_0x7282('0xd'));var Papa=require(_0x7282('0xe'));var Redis=require(_0x7282('0xf'));var authService=require(_0x7282('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7282('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7282('0x12'));var utils=require('../../config/utils');var config=require(_0x7282('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7282('0x14'))['db'];function respondWithStatusCode(_0x272fcf,_0x1699bb){_0x1699bb=_0x1699bb||0xcc;return function(_0x5618ed){if(_0x5618ed){return _0x272fcf[_0x7282('0x15')](_0x1699bb);}return _0x272fcf[_0x7282('0x16')](_0x1699bb)[_0x7282('0x17')]();};}function respondWithResult(_0x5d9548,_0x4a65d6){_0x4a65d6=_0x4a65d6||0xc8;return function(_0x8b37bf){if(_0x8b37bf){return _0x5d9548[_0x7282('0x16')](_0x4a65d6)[_0x7282('0x18')](_0x8b37bf);}};}function respondWithFilteredResult(_0x1431ca,_0x2d9ed6){return function(_0x5ca90d){if(_0x5ca90d){var _0xf59cb2=typeof _0x2d9ed6['offset']===_0x7282('0x19')&&typeof _0x2d9ed6[_0x7282('0x1a')]===_0x7282('0x19');var _0x48e710=_0x5ca90d[_0x7282('0x1b')];var _0x2254bd=_0xf59cb2?0x0:_0x2d9ed6[_0x7282('0x1c')];var _0xcbc696=_0xf59cb2?_0x5ca90d['count']:_0x2d9ed6[_0x7282('0x1c')]+_0x2d9ed6[_0x7282('0x1a')];var _0x31359e;if(_0xcbc696>=_0x48e710){_0xcbc696=_0x48e710;_0x31359e=0xc8;}else{_0x31359e=0xce;}_0x1431ca[_0x7282('0x16')](_0x31359e);return _0x1431ca[_0x7282('0x1d')]('Content-Range',_0x2254bd+'-'+_0xcbc696+'/'+_0x48e710)[_0x7282('0x18')](_0x5ca90d);}return null;};}function patchUpdates(_0x3535db){return function(_0x5b2efb){try{jsonpatch[_0x7282('0x1e')](_0x5b2efb,_0x3535db,!![]);}catch(_0x2e3656){return BPromise['reject'](_0x2e3656);}return _0x5b2efb[_0x7282('0x1f')]();};}function saveUpdates(_0x19d480,_0x4c7ea5){return function(_0x59b7c){if(_0x59b7c){return _0x59b7c[_0x7282('0x20')](_0x19d480)['then'](function(_0x4adc47){return _0x4adc47;});}return null;};}function removeEntity(_0x352673,_0x3dfe52){return function(_0x3b4825){if(_0x3b4825){return _0x3b4825[_0x7282('0x21')]()[_0x7282('0x22')](function(){_0x352673[_0x7282('0x16')](0xcc)[_0x7282('0x17')]();});}};}function handleEntityNotFound(_0x2706c9,_0x53b775){return function(_0x1480c4){if(!_0x1480c4){_0x2706c9['sendStatus'](0x194);}return _0x1480c4;};}function handleError(_0x466aef,_0x5eccdf){_0x5eccdf=_0x5eccdf||0x1f4;return function(_0x33d60f){logger[_0x7282('0x23')](_0x33d60f[_0x7282('0x24')]);if(_0x33d60f[_0x7282('0x25')]){delete _0x33d60f['name'];}_0x466aef[_0x7282('0x16')](_0x5eccdf)['send'](_0x33d60f);};}exports[_0x7282('0x26')]=function(_0x4f6d78,_0x41ae10){var _0x1d88fe={},_0x56a85d={},_0xb8526c={'count':0x0,'rows':[]};var _0x33dda6=_[_0x7282('0x27')](db[_0x7282('0x28')]['rawAttributes'],function(_0x11f550){return{'name':_0x11f550[_0x7282('0x29')],'type':_0x11f550[_0x7282('0x2a')][_0x7282('0x2b')]};});_0x56a85d[_0x7282('0x2c')]=_[_0x7282('0x27')](_0x33dda6,_0x7282('0x25'));_0x56a85d[_0x7282('0x2d')]=_['keys'](_0x4f6d78[_0x7282('0x2d')]);_0x56a85d[_0x7282('0x2e')]=_[_0x7282('0x2f')](_0x56a85d[_0x7282('0x2c')],_0x56a85d[_0x7282('0x2d')]);_0x1d88fe[_0x7282('0x30')]=_['intersection'](_0x56a85d[_0x7282('0x2c')],qs[_0x7282('0x31')](_0x4f6d78[_0x7282('0x2d')][_0x7282('0x31')]));_0x1d88fe['attributes']=_0x1d88fe[_0x7282('0x30')][_0x7282('0x32')]?_0x1d88fe[_0x7282('0x30')]:_0x56a85d[_0x7282('0x2c')];if(!_0x4f6d78[_0x7282('0x2d')]['hasOwnProperty']('nolimit')){_0x1d88fe[_0x7282('0x1a')]=qs[_0x7282('0x1a')](_0x4f6d78['query'][_0x7282('0x1a')]);_0x1d88fe[_0x7282('0x1c')]=qs['offset'](_0x4f6d78[_0x7282('0x2d')]['offset']);}_0x1d88fe[_0x7282('0x33')]=qs['sort'](_0x4f6d78[_0x7282('0x2d')][_0x7282('0x34')]);_0x1d88fe[_0x7282('0x35')]=qs[_0x7282('0x2e')](_[_0x7282('0x36')](_0x4f6d78[_0x7282('0x2d')],_0x56a85d[_0x7282('0x2e')]),_0x33dda6);if(_0x4f6d78['query'][_0x7282('0x37')]){_0x1d88fe[_0x7282('0x35')]=_[_0x7282('0x38')](_0x1d88fe[_0x7282('0x35')],{'$or':_['map'](_0x33dda6,function(_0x5dd535){if(_0x5dd535[_0x7282('0x2a')]!==_0x7282('0x39')){var _0x4491be={};_0x4491be[_0x5dd535[_0x7282('0x25')]]={'$like':'%'+_0x4f6d78[_0x7282('0x2d')][_0x7282('0x37')]+'%'};return _0x4491be;}})});}_0x1d88fe=_[_0x7282('0x38')]({},_0x1d88fe,_0x4f6d78[_0x7282('0x3a')]);var _0x1f9c3c={'where':_0x1d88fe['where']};return db['CmHopperHistory'][_0x7282('0x1b')](_0x1f9c3c)['then'](function(_0x5251fd){_0xb8526c[_0x7282('0x1b')]=_0x5251fd;if(_0x4f6d78[_0x7282('0x2d')][_0x7282('0x3b')]){_0x1d88fe[_0x7282('0x3c')]=[{'all':!![]}];}return db[_0x7282('0x28')][_0x7282('0x3d')](_0x1d88fe);})[_0x7282('0x22')](function(_0x5457a4){_0xb8526c[_0x7282('0x3e')]=_0x5457a4;return _0xb8526c;})[_0x7282('0x22')](respondWithFilteredResult(_0x41ae10,_0x1d88fe))['catch'](handleError(_0x41ae10,null));};exports[_0x7282('0x3f')]=function(_0x15ace5,_0x23ccd2){var _0x2572d6={'raw':!![],'where':{'id':_0x15ace5[_0x7282('0x40')]['id']}},_0x4d254d={};_0x4d254d['model']=_[_0x7282('0x41')](db[_0x7282('0x28')][_0x7282('0x42')]);_0x4d254d[_0x7282('0x2d')]=_[_0x7282('0x41')](_0x15ace5[_0x7282('0x2d')]);_0x4d254d[_0x7282('0x2e')]=_[_0x7282('0x2f')](_0x4d254d[_0x7282('0x2c')],_0x4d254d['query']);_0x2572d6[_0x7282('0x30')]=_[_0x7282('0x2f')](_0x4d254d[_0x7282('0x2c')],qs[_0x7282('0x31')](_0x15ace5[_0x7282('0x2d')][_0x7282('0x31')]));_0x2572d6[_0x7282('0x30')]=_0x2572d6[_0x7282('0x30')][_0x7282('0x32')]?_0x2572d6['attributes']:_0x4d254d[_0x7282('0x2c')];if(_0x15ace5[_0x7282('0x2d')]['includeAll']){_0x2572d6[_0x7282('0x3c')]=[{'all':!![]}];}_0x2572d6=_['merge']({},_0x2572d6,_0x15ace5[_0x7282('0x3a')]);return db[_0x7282('0x28')]['find'](_0x2572d6)['then'](handleEntityNotFound(_0x23ccd2,null))[_0x7282('0x22')](respondWithResult(_0x23ccd2,null))[_0x7282('0x43')](handleError(_0x23ccd2,null));};exports[_0x7282('0x44')]=function(_0x4024d8,_0xbe70c1){return db[_0x7282('0x28')][_0x7282('0x44')](_0x4024d8[_0x7282('0x45')],{})[_0x7282('0x22')](respondWithResult(_0xbe70c1,0xc9))['catch'](handleError(_0xbe70c1,null));};exports[_0x7282('0x46')]=function(_0x5681d5,_0x237958){return db[_0x7282('0x28')][_0x7282('0x46')]()[_0x7282('0x22')](respondWithResult(_0x237958,null))['catch'](handleError(_0x237958,null));};exports[_0x7282('0x20')]=function(_0x5dee5,_0x4e5dca){if(_0x5dee5['body']['uniqueid']){delete _0x5dee5[_0x7282('0x45')][_0x7282('0x47')];}return db[_0x7282('0x28')][_0x7282('0x48')]({'where':{'uniqueid':_0x5dee5['params']['id']}})[_0x7282('0x22')](handleEntityNotFound(_0x4e5dca,null))['then'](saveUpdates(_0x5dee5[_0x7282('0x45')],null))[_0x7282('0x22')](respondWithResult(_0x4e5dca,null))[_0x7282('0x43')](handleError(_0x4e5dca,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f593b4f..739781c 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 _0xa613=['cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x2a96c2,_0x4a2182){var _0x2c02dc=function(_0x156484){while(--_0x156484){_0x2a96c2['push'](_0x2a96c2['shift']());}};_0x2c02dc(++_0x4a2182);}(_0xa613,0x8a));var _0x3a61=function(_0x2b84d5,_0x428914){_0x2b84d5=_0x2b84d5-0x0;var _0x51452a=_0xa613[_0x2b84d5];return _0x51452a;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var logger=require(_0x3a61('0x1'))(_0x3a61('0x2'));var moment=require(_0x3a61('0x3'));var BPromise=require(_0x3a61('0x4'));var rp=require(_0x3a61('0x5'));var fs=require('fs');var path=require(_0x3a61('0x6'));var rimraf=require(_0x3a61('0x7'));var config=require(_0x3a61('0x8'));var attributes=require(_0x3a61('0x9'));module[_0x3a61('0xa')]=function(_0x50a744,_0x37904a){return _0x50a744[_0x3a61('0xb')]('CmHopperHistory',attributes,{'tableName':_0x3a61('0xc'),'paranoid':![],'indexes':[{'name':_0x3a61('0xd'),'fields':[_0x3a61('0xd')]},{'name':_0x3a61('0xe'),'fields':[_0x3a61('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f83=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2005a0,_0x19745b){var _0x18687a=function(_0x2cdd95){while(--_0x2cdd95){_0x2005a0['push'](_0x2005a0['shift']());}};_0x18687a(++_0x19745b);}(_0x6f83,0x72));var _0x36f8=function(_0x5d0571,_0x1a1972){_0x5d0571=_0x5d0571-0x0;var _0x322413=_0x6f83[_0x5d0571];return _0x322413;};'use strict';var _=require('lodash');var util=require(_0x36f8('0x0'));var logger=require(_0x36f8('0x1'))('api');var moment=require(_0x36f8('0x2'));var BPromise=require(_0x36f8('0x3'));var rp=require(_0x36f8('0x4'));var fs=require('fs');var path=require(_0x36f8('0x5'));var rimraf=require(_0x36f8('0x6'));var config=require(_0x36f8('0x7'));var attributes=require(_0x36f8('0x8'));module[_0x36f8('0x9')]=function(_0x31ff95,_0x3b9620){return _0x31ff95[_0x36f8('0xa')](_0x36f8('0xb'),attributes,{'tableName':_0x36f8('0xc'),'paranoid':![],'indexes':[{'name':_0x36f8('0xd'),'fields':[_0x36f8('0xd')]},{'name':_0x36f8('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 828a2ad..1f164a6 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 _0x6f33=['error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','raw','then','findAll','options','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d8a35,_0x38a56d){var _0x1388e8=function(_0xadd8ec){while(--_0xadd8ec){_0x4d8a35['push'](_0x4d8a35['shift']());}};_0x1388e8(++_0x38a56d);}(_0x6f33,0x7a));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36f3('0x0'));var util=require(_0x36f3('0x1'));var moment=require(_0x36f3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36f3('0x3'));var db=require(_0x36f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36f3('0x5'));var config=require('../../config/environment');var jayson=require(_0x36f3('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x257b9f,_0x491b61,_0x4129b0){return new BPromise(function(_0x2645e3,_0x6f1cbb){return client[_0x36f3('0x7')](_0x257b9f,_0x4129b0)['then'](function(_0x383f82){logger[_0x36f3('0x8')](_0x36f3('0x9'),_0x491b61,_0x36f3('0xa'));logger[_0x36f3('0xb')](_0x36f3('0xc'),_0x491b61,_0x36f3('0xa'),JSON[_0x36f3('0xd')](_0x383f82));if(_0x383f82[_0x36f3('0xe')]){if(_0x383f82[_0x36f3('0xe')]['code']===0x1f4){logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x383f82['error'][_0x36f3('0xf')]);return _0x6f1cbb(_0x383f82['error'][_0x36f3('0xf')]);}logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x383f82[_0x36f3('0xe')][_0x36f3('0xf')]);return _0x2645e3(_0x383f82['error'][_0x36f3('0xf')]);}else{logger[_0x36f3('0x8')](_0x36f3('0x9'),_0x491b61,_0x36f3('0xa'));_0x2645e3(_0x383f82[_0x36f3('0x10')]['message']);}})[_0x36f3('0x11')](function(_0x411b0b){logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x411b0b);_0x6f1cbb(_0x411b0b);});});}exports[_0x36f3('0x12')]=function(_0x2cc9ea){var _0x4d2f7f=this;return new Promise(function(_0x232fd3,_0x227a29){return db[_0x36f3('0x13')][_0x36f3('0x14')](_0x2cc9ea[_0x36f3('0x15')],{'raw':_0x2cc9ea['options']?_0x2cc9ea['options'][_0x36f3('0x16')]===undefined?!![]:![]:!![]})[_0x36f3('0x17')](function(_0x402dc8){logger[_0x36f3('0x8')](_0x36f3('0x12'),_0x2cc9ea);logger[_0x36f3('0xb')](_0x36f3('0x12'),_0x2cc9ea,JSON['stringify'](_0x402dc8));_0x232fd3(_0x402dc8);})['catch'](function(_0x57d1c2){logger['error'](_0x36f3('0x12'),_0x57d1c2['message'],_0x2cc9ea);_0x227a29(_0x4d2f7f[_0x36f3('0xe')](0x1f4,_0x57d1c2[_0x36f3('0xf')]));});});};exports['AvgHandleTime']=function(_0x4c45eb){var _0x4325b8=this;return new Promise(function(_0x56ac46,_0x256f53){return db[_0x36f3('0x13')][_0x36f3('0x18')]({'raw':_0x4c45eb[_0x36f3('0x19')]?_0x4c45eb['options'][_0x36f3('0x16')]===undefined?!![]:![]:!![],'where':_0x4c45eb['options']?_0x4c45eb[_0x36f3('0x19')][_0x36f3('0x1a')]||null:null,'attributes':[[db[_0x36f3('0x1b')]['fn']('COUNT',db['sequelize'][_0x36f3('0x1c')]('id')),_0x36f3('0x1d')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')]('`state`\x20=\x2010,\x201,\x20null'))),_0x36f3('0x20')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0x36f3('0x21')],[db['sequelize']['fn'](_0x36f3('0x22'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x36f3('0x23')],[db[_0x36f3('0x1b')]['fn']('AVG',db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x24')))),_0x36f3('0x25')]]})[_0x36f3('0x17')](function(_0x36f189){logger[_0x36f3('0x8')](_0x36f3('0x26'),_0x4c45eb);logger[_0x36f3('0xb')](_0x36f3('0x26'),_0x4c45eb,JSON[_0x36f3('0xd')](_0x36f189));_0x56ac46(_0x36f189);})[_0x36f3('0x11')](function(_0x176989){logger[_0x36f3('0xe')](_0x36f3('0x26'),_0x176989['message'],_0x4c45eb);_0x256f53(_0x4325b8[_0x36f3('0xe')](0x1f4,_0x176989['message']));});});};exports[_0x36f3('0x27')]=function(_0x2b7756){var _0x33bf3c=this;return new Promise(function(_0x35bfdd,_0x43a0bb){return db[_0x36f3('0x13')][_0x36f3('0x18')]({'raw':_0x2b7756['options']?_0x2b7756['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b7756[_0x36f3('0x19')]?_0x2b7756[_0x36f3('0x19')]['where']||null:null,'attributes':[[_0x36f3('0x28'),_0x36f3('0x29')],[db[_0x36f3('0x1b')]['fn']('COUNT',db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),_0x36f3('0x2a')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db['sequelize']['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x2b')))),_0x36f3('0x2c')],[db[_0x36f3('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x36f3('0x1f')](_0x36f3('0x2d')))),_0x36f3('0x2e')],[db[_0x36f3('0x1b')]['fn']('COUNT',db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x2f')))),_0x36f3('0x30')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x36f3('0x31')))),'outboundCongestionCallsDay'],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')](_0x36f3('0x32')))),_0x36f3('0x33')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x34')))),_0x36f3('0x35')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')](_0x36f3('0x36')))),_0x36f3('0x37')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x38')))),'outboundBlacklistCallsDay'],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x39')))),_0x36f3('0x3a')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x3b')))),_0x36f3('0x3c')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),_0x36f3('0x3d')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')]['literal'](_0x36f3('0x3e')))),'outboundRejectCallsDay'],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db['sequelize']['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x3f')))),_0x36f3('0x40')]],'group':['campaign']})[_0x36f3('0x17')](function(_0x167170){logger[_0x36f3('0x8')](_0x36f3('0x27'),_0x2b7756);logger[_0x36f3('0xb')](_0x36f3('0x27'),_0x2b7756,JSON[_0x36f3('0xd')](_0x167170));_0x35bfdd(_0x167170);})[_0x36f3('0x11')](function(_0x2c9fc4){logger['error'](_0x36f3('0x27'),_0x2c9fc4[_0x36f3('0xf')],_0x2b7756);_0x43a0bb(_0x33bf3c[_0x36f3('0xe')](0x1f4,_0x2c9fc4[_0x36f3('0xf')]));});});};exports[_0x36f3('0x41')]=function(_0x3ef01a){var _0x189b86=this;return new Promise(function(_0x144d88,_0x2473b9){return db[_0x36f3('0x13')]['findAll']({'raw':_0x3ef01a[_0x36f3('0x19')]?_0x3ef01a['options'][_0x36f3('0x16')]===undefined?!![]:![]:!![],'where':_0x3ef01a[_0x36f3('0x19')]?_0x3ef01a[_0x36f3('0x19')]['where']||null:null,'attributes':[[_0x36f3('0x28'),_0x36f3('0x29')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['col']('id')),_0x36f3('0x42')],[db['sequelize']['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')](_0x36f3('0x2d')))),_0x36f3('0x43')]],'group':[_0x36f3('0x28')]})[_0x36f3('0x17')](function(_0x2ec8fd){logger['info'](_0x36f3('0x41'),_0x3ef01a);logger[_0x36f3('0xb')](_0x36f3('0x41'),_0x3ef01a,JSON[_0x36f3('0xd')](_0x2ec8fd));_0x144d88(_0x2ec8fd);})[_0x36f3('0x11')](function(_0x5d0911){logger[_0x36f3('0xe')](_0x36f3('0x41'),_0x5d0911['message'],_0x3ef01a);_0x2473b9(_0x189b86[_0x36f3('0xe')](0x1f4,_0x5d0911[_0x36f3('0xf')]));});});}; \ No newline at end of file +var _0x2f72=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','stringify','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util'];(function(_0x1e2b86,_0x5ef1e5){var _0x496c77=function(_0x158f46){while(--_0x158f46){_0x1e2b86['push'](_0x1e2b86['shift']());}};_0x496c77(++_0x5ef1e5);}(_0x2f72,0x166));var _0x22f7=function(_0x4a12f7,_0x3d0563){_0x4a12f7=_0x4a12f7-0x0;var _0x54a44e=_0x2f72[_0x4a12f7];return _0x54a44e;};'use strict';var _=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var moment=require(_0x22f7('0x2'));var BPromise=require(_0x22f7('0x3'));var rs=require(_0x22f7('0x4'));var fs=require('fs');var Redis=require(_0x22f7('0x5'));var db=require(_0x22f7('0x6'))['db'];var utils=require(_0x22f7('0x7'));var logger=require('../../config/logger')(_0x22f7('0x8'));var config=require(_0x22f7('0x9'));var jayson=require(_0x22f7('0xa'));var client=jayson[_0x22f7('0xb')][_0x22f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11cb61,_0x46195a,_0x1ad8d1){return new BPromise(function(_0x261813,_0x434aa4){return client[_0x22f7('0xd')](_0x11cb61,_0x1ad8d1)[_0x22f7('0xe')](function(_0x8457b5){logger[_0x22f7('0xf')](_0x22f7('0x10'),_0x46195a,_0x22f7('0x11'));logger['debug'](_0x22f7('0x12'),_0x46195a,_0x22f7('0x11'),JSON['stringify'](_0x8457b5));if(_0x8457b5[_0x22f7('0x13')]){if(_0x8457b5[_0x22f7('0x13')]['code']===0x1f4){logger[_0x22f7('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x46195a,_0x8457b5[_0x22f7('0x13')][_0x22f7('0x14')]);return _0x434aa4(_0x8457b5['error'][_0x22f7('0x14')]);}logger[_0x22f7('0x13')](_0x22f7('0x10'),_0x46195a,_0x8457b5[_0x22f7('0x13')][_0x22f7('0x14')]);return _0x261813(_0x8457b5[_0x22f7('0x13')][_0x22f7('0x14')]);}else{logger[_0x22f7('0xf')](_0x22f7('0x10'),_0x46195a,_0x22f7('0x11'));_0x261813(_0x8457b5[_0x22f7('0x15')][_0x22f7('0x14')]);}})[_0x22f7('0x16')](function(_0x3b2861){logger[_0x22f7('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x46195a,_0x3b2861);_0x434aa4(_0x3b2861);});});}exports[_0x22f7('0x17')]=function(_0x3894f4){var _0x1c3971=this;return new Promise(function(_0x3f15b8,_0xa62ab6){return db[_0x22f7('0x18')][_0x22f7('0x19')](_0x3894f4[_0x22f7('0x1a')],{'raw':_0x3894f4[_0x22f7('0x1b')]?_0x3894f4['options'][_0x22f7('0x1c')]===undefined?!![]:![]:!![]})[_0x22f7('0xe')](function(_0x1f363d){logger[_0x22f7('0xf')]('CreateCmHopperHistory',_0x3894f4);logger[_0x22f7('0x1d')](_0x22f7('0x17'),_0x3894f4,JSON[_0x22f7('0x1e')](_0x1f363d));_0x3f15b8(_0x1f363d);})[_0x22f7('0x16')](function(_0x352663){logger['error']('CreateCmHopperHistory',_0x352663[_0x22f7('0x14')],_0x3894f4);_0xa62ab6(_0x1c3971['error'](0x1f4,_0x352663[_0x22f7('0x14')]));});});};exports[_0x22f7('0x1f')]=function(_0xc53928){var _0x3bb24e=this;return new Promise(function(_0x10adc7,_0x177ff1){return db['CmHopperHistory'][_0x22f7('0x20')]({'raw':_0xc53928['options']?_0xc53928['options'][_0x22f7('0x1c')]===undefined?!![]:![]:!![],'where':_0xc53928[_0x22f7('0x1b')]?_0xc53928[_0x22f7('0x1b')]['where']||null:null,'attributes':[[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db['sequelize'][_0x22f7('0x23')]('id')),_0x22f7('0x24')],[db['sequelize']['fn'](_0x22f7('0x22'),db['sequelize']['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')](_0x22f7('0x26')))),'predictiveIntervalAnsweredCalls'],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db['sequelize']['literal'](_0x22f7('0x27')))),_0x22f7('0x28')],[db[_0x22f7('0x21')]['fn']('COUNT',db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')](_0x22f7('0x29')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x2a'),db[_0x22f7('0x21')]['fn']('IF',db['sequelize'][_0x22f7('0x25')](_0x22f7('0x2b')))),_0x22f7('0x2c')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x2a'),db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')](_0x22f7('0x2d')))),_0x22f7('0x2e')]]})[_0x22f7('0xe')](function(_0x2b63e2){logger[_0x22f7('0xf')](_0x22f7('0x1f'),_0xc53928);logger[_0x22f7('0x1d')](_0x22f7('0x1f'),_0xc53928,JSON[_0x22f7('0x1e')](_0x2b63e2));_0x10adc7(_0x2b63e2);})[_0x22f7('0x16')](function(_0x1ac785){logger[_0x22f7('0x13')](_0x22f7('0x1f'),_0x1ac785[_0x22f7('0x14')],_0xc53928);_0x177ff1(_0x3bb24e[_0x22f7('0x13')](0x1f4,_0x1ac785[_0x22f7('0x14')]));});});};exports[_0x22f7('0x2f')]=function(_0x520f8b){var _0x304f84=this;return new Promise(function(_0x4e6fbc,_0xae7703){return db[_0x22f7('0x18')][_0x22f7('0x20')]({'raw':_0x520f8b[_0x22f7('0x1b')]?_0x520f8b['options'][_0x22f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x520f8b[_0x22f7('0x1b')]?_0x520f8b['options'][_0x22f7('0x30')]||null:null,'attributes':[[_0x22f7('0x31'),_0x22f7('0x32')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')](_0x22f7('0x33')))),_0x22f7('0x34')],[db['sequelize']['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')]['literal'](_0x22f7('0x35')))),'outboundNoAnswerCallsDay'],[db[_0x22f7('0x21')]['fn']('COUNT',db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')](_0x22f7('0x26')))),_0x22f7('0x36')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db['sequelize']['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')]('`state`\x20=\x205,\x201,\x20null'))),_0x22f7('0x37')],[db['sequelize']['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db['sequelize'][_0x22f7('0x25')](_0x22f7('0x38')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x22f7('0x39')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x22f7('0x3a')))),_0x22f7('0x3b')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db['sequelize'][_0x22f7('0x25')](_0x22f7('0x3c')))),_0x22f7('0x3d')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db['sequelize'][_0x22f7('0x25')](_0x22f7('0x3e')))),'outboundBlacklistCallsDay'],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db['sequelize']['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')](_0x22f7('0x3f')))),_0x22f7('0x40')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')]('`state`\x20=\x2018,\x201,\x20null'))),_0x22f7('0x41')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')](_0x22f7('0x42')))),'outboundAnswerAgiCallsDay'],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')][_0x22f7('0x25')](_0x22f7('0x43')))),_0x22f7('0x41')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db['sequelize'][_0x22f7('0x25')](_0x22f7('0x44')))),_0x22f7('0x45')]],'group':['campaign']})[_0x22f7('0xe')](function(_0x1df039){logger[_0x22f7('0xf')](_0x22f7('0x2f'),_0x520f8b);logger[_0x22f7('0x1d')](_0x22f7('0x2f'),_0x520f8b,JSON[_0x22f7('0x1e')](_0x1df039));_0x4e6fbc(_0x1df039);})['catch'](function(_0x20b19e){logger['error'](_0x22f7('0x2f'),_0x20b19e[_0x22f7('0x14')],_0x520f8b);_0xae7703(_0x304f84[_0x22f7('0x13')](0x1f4,_0x20b19e[_0x22f7('0x14')]));});});};exports[_0x22f7('0x46')]=function(_0x27fe75){var _0x2aa337=this;return new Promise(function(_0x24a49c,_0x2ba21e){return db[_0x22f7('0x18')][_0x22f7('0x20')]({'raw':_0x27fe75[_0x22f7('0x1b')]?_0x27fe75[_0x22f7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x27fe75[_0x22f7('0x1b')]?_0x27fe75[_0x22f7('0x1b')][_0x22f7('0x30')]||null:null,'attributes':[[_0x22f7('0x31'),_0x22f7('0x32')],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db['sequelize'][_0x22f7('0x23')]('id')),'ivrTotalCallsDays'],[db[_0x22f7('0x21')]['fn'](_0x22f7('0x22'),db[_0x22f7('0x21')]['fn']('IF',db[_0x22f7('0x21')]['literal'](_0x22f7('0x26')))),_0x22f7('0x47')]],'group':[_0x22f7('0x31')]})['then'](function(_0x3b229a){logger[_0x22f7('0xf')](_0x22f7('0x46'),_0x27fe75);logger[_0x22f7('0x1d')](_0x22f7('0x46'),_0x27fe75,JSON[_0x22f7('0x1e')](_0x3b229a));_0x24a49c(_0x3b229a);})[_0x22f7('0x16')](function(_0x252401){logger[_0x22f7('0x13')](_0x22f7('0x46'),_0x252401[_0x22f7('0x14')],_0x27fe75);_0x2ba21e(_0x2aa337[_0x22f7('0x13')](0x1f4,_0x252401[_0x22f7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4fd2da5..4572863 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 _0xf066=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','post','create','update','multer'];(function(_0x202057,_0x3cc872){var _0x10b505=function(_0x224089){while(--_0x224089){_0x202057['push'](_0x202057['shift']());}};_0x10b505(++_0x3cc872);}(_0xf066,0xe9));var _0x6f06=function(_0x135f1f,_0x45e875){_0x135f1f=_0x135f1f-0x0;var _0x547ed6=_0xf066[_0x135f1f];return _0x547ed6;};'use strict';var multer=require(_0x6f06('0x0'));var util=require(_0x6f06('0x1'));var path=require(_0x6f06('0x2'));var timeout=require(_0x6f06('0x3'));var express=require(_0x6f06('0x4'));var router=express[_0x6f06('0x5')]();var fs_extra=require(_0x6f06('0x6'));var auth=require(_0x6f06('0x7'));var interaction=require(_0x6f06('0x8'));var config=require(_0x6f06('0x9'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x6f06('0xa')](),controller['index']);router[_0x6f06('0xb')](_0x6f06('0xc'),auth['isAuthenticated'](),controller[_0x6f06('0xd')]);router[_0x6f06('0xb')](_0x6f06('0xe'),auth[_0x6f06('0xa')](),controller['show']);router[_0x6f06('0xf')]('/',auth[_0x6f06('0xa')](),controller[_0x6f06('0x10')]);router['put']('/:id',auth[_0x6f06('0xa')](),controller[_0x6f06('0x11')]);module['exports']=router; \ No newline at end of file +var _0x84cf=['show','post','create','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/:id'];(function(_0x110924,_0x1374bb){var _0x12905b=function(_0x47d32c){while(--_0x47d32c){_0x110924['push'](_0x110924['shift']());}};_0x12905b(++_0x1374bb);}(_0x84cf,0x1ba));var _0xf84c=function(_0x4bf64b,_0x46b3ef){_0x4bf64b=_0x4bf64b-0x0;var _0x487c28=_0x84cf[_0x4bf64b];return _0x487c28;};'use strict';var multer=require('multer');var util=require(_0xf84c('0x0'));var path=require(_0xf84c('0x1'));var timeout=require(_0xf84c('0x2'));var express=require(_0xf84c('0x3'));var router=express[_0xf84c('0x4')]();var fs_extra=require(_0xf84c('0x5'));var auth=require(_0xf84c('0x6'));var interaction=require(_0xf84c('0x7'));var config=require(_0xf84c('0x8'));var controller=require(_0xf84c('0x9'));router[_0xf84c('0xa')]('/',auth[_0xf84c('0xb')](),controller[_0xf84c('0xc')]);router['get']('/describe',auth[_0xf84c('0xb')](),controller['describe']);router[_0xf84c('0xa')](_0xf84c('0xd'),auth['isAuthenticated'](),controller[_0xf84c('0xe')]);router[_0xf84c('0xf')]('/',auth[_0xf84c('0xb')](),controller[_0xf84c('0x10')]);router['put'](_0xf84c('0xd'),auth[_0xf84c('0xb')](),controller[_0xf84c('0x11')]);module[_0xf84c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 5c33c1f..07b8e7b 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 _0x8743=['exports','STRING','sequelize'];(function(_0x11cc89,_0x3135b1){var _0x268a8a=function(_0xb6aa8b){while(--_0xb6aa8b){_0x11cc89['push'](_0x11cc89['shift']());}};_0x268a8a(++_0x3135b1);}(_0x8743,0x7a));var _0x3874=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x8743[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x3874('0x0'));module[_0x3874('0x1')]={'name':{'type':Sequelize[_0x3874('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3874('0x2')]},'dialPrefix':{'type':Sequelize[_0x3874('0x2')]}}; \ No newline at end of file +var _0xf874=['name','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf874,0xed));var _0x4f87=function(_0x5739d7,_0x1d06d9){_0x5739d7=_0x5739d7-0x0;var _0xa44565=_0xf874[_0x5739d7];return _0xa44565;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4f87('0x0')],'unique':_0x4f87('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4f87('0x0')]},'dialPrefix':{'type':Sequelize[_0x4f87('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6a0683a..94715ab 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 _0x1b61=['findOne','hasOwnProperty','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','options','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','ItemTypeId\x20=\x20?','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','info','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./cmList.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','Disposition','getDispositions'];(function(_0x304107,_0xa47eaf){var _0x43d4af=function(_0x1d88b8){while(--_0x1d88b8){_0x304107['push'](_0x304107['shift']());}};_0x43d4af(++_0xa47eaf);}(_0x1b61,0xec));var _0x11b6=function(_0x4443c2,_0x3edbc3){_0x4443c2=_0x4443c2-0x0;var _0x1909de=_0x1b61[_0x4443c2];return _0x1909de;};'use strict';var emlformat=require(_0x11b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11b6('0x1'));var jsonpatch=require(_0x11b6('0x2'));var rp=require(_0x11b6('0x3'));var moment=require(_0x11b6('0x4'));var BPromise=require(_0x11b6('0x5'));var Mustache=require(_0x11b6('0x6'));var util=require('util');var path=require(_0x11b6('0x7'));var sox=require('sox');var csv=require(_0x11b6('0x8'));var ejs=require(_0x11b6('0x9'));var fs=require('fs');var fs_extra=require(_0x11b6('0xa'));var _=require(_0x11b6('0xb'));var squel=require('squel');var crypto=require(_0x11b6('0xc'));var jsforce=require(_0x11b6('0xd'));var deskjs=require(_0x11b6('0xe'));var toCsv=require(_0x11b6('0x8'));var querystring=require(_0x11b6('0xf'));var Papa=require('papaparse');var Redis=require(_0x11b6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x11b6('0x11'));var as=require(_0x11b6('0x12'));var hardwareService=require(_0x11b6('0x13'));var logger=require(_0x11b6('0x14'))(_0x11b6('0x15'));var utils=require(_0x11b6('0x16'));var config=require(_0x11b6('0x17'));var licenseUtil=require(_0x11b6('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x11b6('0x19')]=_['defaults'](config[_0x11b6('0x19')],{'host':_0x11b6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11b6('0x19')]));require(_0x11b6('0x1b'))[_0x11b6('0x1c')](socket);function respondWithStatusCode(_0x36577c,_0x38b286){_0x38b286=_0x38b286||0xcc;return function(_0xda3c9a){if(_0xda3c9a){return _0x36577c['sendStatus'](_0x38b286);}return _0x36577c[_0x11b6('0x1d')](_0x38b286)[_0x11b6('0x1e')]();};}function respondWithResult(_0x277c0a,_0x1f3901){_0x1f3901=_0x1f3901||0xc8;return function(_0x37f8b8){if(_0x37f8b8){return _0x277c0a[_0x11b6('0x1d')](_0x1f3901)[_0x11b6('0x1f')](_0x37f8b8);}};}function respondWithFilteredResult(_0x9a34c8,_0x3dfa99){return function(_0x1633a9){if(_0x1633a9){var _0xf8087c=typeof _0x3dfa99[_0x11b6('0x20')]===_0x11b6('0x21')&&typeof _0x3dfa99[_0x11b6('0x22')]===_0x11b6('0x21');var _0xa26ca7=_0x1633a9[_0x11b6('0x23')];var _0x111b4b=_0xf8087c?0x0:_0x3dfa99[_0x11b6('0x20')];var _0x357f09=_0xf8087c?_0x1633a9['count']:_0x3dfa99[_0x11b6('0x20')]+_0x3dfa99[_0x11b6('0x22')];var _0xb82bc3;if(_0x357f09>=_0xa26ca7){_0x357f09=_0xa26ca7;_0xb82bc3=0xc8;}else{_0xb82bc3=0xce;}_0x9a34c8[_0x11b6('0x1d')](_0xb82bc3);return _0x9a34c8['set'](_0x11b6('0x24'),_0x111b4b+'-'+_0x357f09+'/'+_0xa26ca7)['json'](_0x1633a9);}return null;};}function patchUpdates(_0x178f1e){return function(_0x7b8334){try{jsonpatch[_0x11b6('0x25')](_0x7b8334,_0x178f1e,!![]);}catch(_0x1a86be){return BPromise[_0x11b6('0x26')](_0x1a86be);}return _0x7b8334[_0x11b6('0x27')]();};}function saveUpdates(_0x2e5a3c,_0x4afb91){return function(_0x1b46fa){if(_0x1b46fa){return _0x1b46fa[_0x11b6('0x28')](_0x2e5a3c)['then'](function(_0x328750){return _0x328750;});}return null;};}function removeEntity(_0x7bbe00,_0x5f0200){return function(_0x5d1f0e){if(_0x5d1f0e){return _0x5d1f0e[_0x11b6('0x29')]()[_0x11b6('0x2a')](function(){var _0x4bbae8=_0x5d1f0e[_0x11b6('0x2b')]({'plain':!![]});var _0xc8f872='Lists';return db[_0x11b6('0x2c')][_0x11b6('0x29')]({'where':{'type':_0xc8f872,'resourceId':_0x4bbae8['id']}})[_0x11b6('0x2a')](function(){return _0x5d1f0e;});})[_0x11b6('0x2a')](function(){_0x7bbe00[_0x11b6('0x1d')](0xcc)[_0x11b6('0x1e')]();});}};}function handleEntityNotFound(_0x17cdb4,_0x2561ae){return function(_0x5c65ac){if(!_0x5c65ac){_0x17cdb4['sendStatus'](0x194);}return _0x5c65ac;};}function handleError(_0x1fda4d,_0x387f23){_0x387f23=_0x387f23||0x1f4;return function(_0x33b553){logger['error'](_0x33b553[_0x11b6('0x2d')]);if(_0x33b553[_0x11b6('0x2e')]){delete _0x33b553[_0x11b6('0x2e')];}_0x1fda4d['status'](_0x387f23)['send'](_0x33b553);};}exports[_0x11b6('0x2f')]=function(_0x573ec6,_0x713eb){var _0x1699fa={},_0x5bc815={},_0x303bed={'count':0x0,'rows':[]};var _0xfcc5c4=_[_0x11b6('0x30')](db[_0x11b6('0x31')][_0x11b6('0x32')],function(_0x343afb){return{'name':_0x343afb[_0x11b6('0x33')],'type':_0x343afb[_0x11b6('0x34')]['key']};});_0x5bc815[_0x11b6('0x35')]=_[_0x11b6('0x30')](_0xfcc5c4,_0x11b6('0x2e'));_0x5bc815[_0x11b6('0x36')]=_[_0x11b6('0x37')](_0x573ec6[_0x11b6('0x36')]);_0x5bc815['filters']=_[_0x11b6('0x38')](_0x5bc815['model'],_0x5bc815[_0x11b6('0x36')]);_0x1699fa['attributes']=_['intersection'](_0x5bc815[_0x11b6('0x35')],qs[_0x11b6('0x39')](_0x573ec6['query'][_0x11b6('0x39')]));_0x1699fa[_0x11b6('0x3a')]=_0x1699fa[_0x11b6('0x3a')][_0x11b6('0x3b')]?_0x1699fa[_0x11b6('0x3a')]:_0x5bc815[_0x11b6('0x35')];if(!_0x573ec6['query']['hasOwnProperty'](_0x11b6('0x3c'))){_0x1699fa[_0x11b6('0x22')]=qs[_0x11b6('0x22')](_0x573ec6[_0x11b6('0x36')][_0x11b6('0x22')]);_0x1699fa[_0x11b6('0x20')]=qs[_0x11b6('0x20')](_0x573ec6[_0x11b6('0x36')]['offset']);}_0x1699fa[_0x11b6('0x3d')]=qs[_0x11b6('0x3e')](_0x573ec6['query'][_0x11b6('0x3e')]);_0x1699fa[_0x11b6('0x3f')]=qs[_0x11b6('0x40')](_[_0x11b6('0x41')](_0x573ec6['query'],_0x5bc815['filters']),_0xfcc5c4);if(_0x573ec6[_0x11b6('0x36')][_0x11b6('0x42')]){_0x1699fa['where']=_[_0x11b6('0x43')](_0x1699fa[_0x11b6('0x3f')],{'$or':_[_0x11b6('0x30')](_0xfcc5c4,function(_0xf37e31){if(_0xf37e31[_0x11b6('0x34')]!=='VIRTUAL'){var _0x1a7577={};_0x1a7577[_0xf37e31[_0x11b6('0x2e')]]={'$like':'%'+_0x573ec6['query'][_0x11b6('0x42')]+'%'};return _0x1a7577;}})});}_0x1699fa=_[_0x11b6('0x43')]({},_0x1699fa,_0x573ec6['options']);var _0x30c15b={'where':_0x1699fa[_0x11b6('0x3f')]};return db['CmList']['count'](_0x30c15b)[_0x11b6('0x2a')](function(_0x1cedbd){_0x303bed[_0x11b6('0x23')]=_0x1cedbd;if(_0x573ec6[_0x11b6('0x36')]['includeAll']){_0x1699fa[_0x11b6('0x44')]=[{'all':!![]}];}return db['CmList'][_0x11b6('0x45')](_0x1699fa);})[_0x11b6('0x2a')](function(_0x543407){_0x303bed[_0x11b6('0x46')]=_0x543407;return _0x303bed;})[_0x11b6('0x2a')](respondWithFilteredResult(_0x713eb,_0x1699fa))[_0x11b6('0x47')](handleError(_0x713eb,null));};exports[_0x11b6('0x48')]=function(_0x303e2f,_0x3d54a8){var _0x52b392={'raw':![],'where':{'id':_0x303e2f[_0x11b6('0x49')]['id']}},_0x45165d={};_0x45165d[_0x11b6('0x35')]=_[_0x11b6('0x37')](db[_0x11b6('0x31')][_0x11b6('0x32')]);_0x45165d[_0x11b6('0x36')]=_[_0x11b6('0x37')](_0x303e2f[_0x11b6('0x36')]);_0x45165d[_0x11b6('0x40')]=_[_0x11b6('0x38')](_0x45165d['model'],_0x45165d['query']);_0x52b392['attributes']=_[_0x11b6('0x38')](_0x45165d[_0x11b6('0x35')],qs[_0x11b6('0x39')](_0x303e2f[_0x11b6('0x36')][_0x11b6('0x39')]));_0x52b392[_0x11b6('0x3a')]=_0x52b392[_0x11b6('0x3a')][_0x11b6('0x3b')]?_0x52b392['attributes']:_0x45165d[_0x11b6('0x35')];if(_0x303e2f[_0x11b6('0x36')][_0x11b6('0x4a')]){_0x52b392[_0x11b6('0x44')]=[{'all':!![]}];}_0x52b392=_[_0x11b6('0x43')]({},_0x52b392,_0x303e2f['options']);return db['CmList'][_0x11b6('0x4b')](_0x52b392)['then'](handleEntityNotFound(_0x3d54a8,null))[_0x11b6('0x2a')](respondWithResult(_0x3d54a8,null))[_0x11b6('0x47')](handleError(_0x3d54a8,null));};exports[_0x11b6('0x4c')]=function(_0x1a03e2,_0x5e0761){return db[_0x11b6('0x31')][_0x11b6('0x4c')](_0x1a03e2['body'],{})['then'](function(_0x248a74){var _0x22edbb=_0x1a03e2['user'][_0x11b6('0x2b')]({'plain':!![]});if(!_0x22edbb)throw new Error(_0x11b6('0x4d'));if(_0x22edbb[_0x11b6('0x4e')]==='user'){var _0x1d2e86=_0x248a74[_0x11b6('0x2b')]({'plain':!![]});var _0x1dd034='Lists';return db['UserProfileSection'][_0x11b6('0x4b')]({'where':{'name':_0x1dd034,'userProfileId':_0x22edbb[_0x11b6('0x4f')]},'raw':!![]})[_0x11b6('0x2a')](function(_0x3fab83){if(_0x3fab83&&_0x3fab83[_0x11b6('0x50')]===0x0){return db[_0x11b6('0x2c')]['create']({'name':_0x1d2e86[_0x11b6('0x2e')],'resourceId':_0x1d2e86['id'],'type':_0x3fab83[_0x11b6('0x2e')],'sectionId':_0x3fab83['id']},{})[_0x11b6('0x2a')](function(){return _0x248a74;});}else{return _0x248a74;}})[_0x11b6('0x47')](function(_0x18b126){logger[_0x11b6('0x51')](_0x11b6('0x52'),_0x18b126);throw _0x18b126;});}return _0x248a74;})[_0x11b6('0x2a')](respondWithResult(_0x5e0761,0xc9))[_0x11b6('0x47')](handleError(_0x5e0761,null));};exports[_0x11b6('0x28')]=function(_0xb8639f,_0x38ca95){if(_0xb8639f[_0x11b6('0x53')]['id']){delete _0xb8639f[_0x11b6('0x53')]['id'];}return db[_0x11b6('0x31')][_0x11b6('0x4b')]({'where':{'id':_0xb8639f['params']['id']}})['then'](handleEntityNotFound(_0x38ca95,null))['then'](saveUpdates(_0xb8639f[_0x11b6('0x53')],null))['then'](respondWithResult(_0x38ca95,null))[_0x11b6('0x47')](handleError(_0x38ca95,null));};exports['destroy']=function(_0x4d158f,_0x316964){return db[_0x11b6('0x31')][_0x11b6('0x4b')]({'where':{'id':_0x4d158f[_0x11b6('0x49')]['id']}})[_0x11b6('0x2a')](handleEntityNotFound(_0x316964,null))[_0x11b6('0x2a')](removeEntity(_0x316964,null))[_0x11b6('0x47')](handleError(_0x316964,null));};exports['describe']=function(_0x3a0719,_0x4b31f9){return db['CmList'][_0x11b6('0x54')]()[_0x11b6('0x2a')](respondWithResult(_0x4b31f9,null))[_0x11b6('0x47')](handleError(_0x4b31f9,null));};exports['addDisposition']=function(_0x471373,_0x3ea762,_0x5d000b){if(_0x471373[_0x11b6('0x53')]['id']){delete _0x471373[_0x11b6('0x53')]['id'];}return db[_0x11b6('0x31')][_0x11b6('0x4b')]({'where':{'id':_0x471373[_0x11b6('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ea762,null))[_0x11b6('0x2a')](function(_0x13352c){if(_0x13352c){_0x471373[_0x11b6('0x53')][_0x11b6('0x55')]=_0x13352c['id'];return db[_0x11b6('0x56')][_0x11b6('0x4c')](_0x471373[_0x11b6('0x53')]);}})[_0x11b6('0x2a')](respondWithResult(_0x3ea762,null))['catch'](handleError(_0x3ea762,null));};exports[_0x11b6('0x57')]=function(_0x4b0a9b,_0x13d1a9,_0x325077){var _0x99b6d5={'raw':![],'where':{}};var _0xc19767={};var _0x5ef372={'count':0x0,'rows':[]};return db[_0x11b6('0x31')][_0x11b6('0x58')]({'where':{'id':_0x4b0a9b['params']['id']}})[_0x11b6('0x2a')](handleEntityNotFound(_0x13d1a9,null))['then'](function(_0x24bb7e){if(_0x24bb7e){_0xc19767[_0x11b6('0x35')]=_[_0x11b6('0x37')](db['Disposition'][_0x11b6('0x32')]);_0xc19767[_0x11b6('0x36')]=_[_0x11b6('0x37')](_0x4b0a9b[_0x11b6('0x36')]);_0xc19767[_0x11b6('0x40')]=_[_0x11b6('0x38')](_0xc19767[_0x11b6('0x35')],_0xc19767[_0x11b6('0x36')]);_0x99b6d5[_0x11b6('0x3a')]=_[_0x11b6('0x38')](_0xc19767[_0x11b6('0x35')],qs[_0x11b6('0x39')](_0x4b0a9b[_0x11b6('0x36')][_0x11b6('0x39')]));_0x99b6d5[_0x11b6('0x3a')]=_0x99b6d5[_0x11b6('0x3a')]['length']?_0x99b6d5['attributes']:_0xc19767[_0x11b6('0x35')];if(!_0x4b0a9b[_0x11b6('0x36')][_0x11b6('0x59')](_0x11b6('0x3c'))){_0x99b6d5[_0x11b6('0x22')]=qs[_0x11b6('0x22')](_0x4b0a9b[_0x11b6('0x36')][_0x11b6('0x22')]);_0x99b6d5[_0x11b6('0x20')]=qs[_0x11b6('0x20')](_0x4b0a9b['query'][_0x11b6('0x20')]);}_0x99b6d5[_0x11b6('0x3d')]=qs['sort'](_0x4b0a9b[_0x11b6('0x36')][_0x11b6('0x3e')]);_0x99b6d5['where']=qs[_0x11b6('0x40')](_['pick'](_0x4b0a9b['query'],_0xc19767[_0x11b6('0x40')]));_0x99b6d5[_0x11b6('0x3f')][_0x11b6('0x55')]=_0x24bb7e['id'];if(_0x4b0a9b[_0x11b6('0x36')]['filter']){_0x99b6d5[_0x11b6('0x3f')]=_[_0x11b6('0x43')](_0x99b6d5[_0x11b6('0x3f')],{'$or':_[_0x11b6('0x30')](_0x99b6d5[_0x11b6('0x3a')],function(_0x13242a){var _0x494ad1={};_0x494ad1[_0x13242a]={'$like':'%'+_0x4b0a9b[_0x11b6('0x36')][_0x11b6('0x42')]+'%'};return _0x494ad1;})});}_0x99b6d5=_[_0x11b6('0x43')]({},_0x99b6d5,_0x4b0a9b['options']);return db[_0x11b6('0x56')]['count']({'where':_0x99b6d5['where']})['then'](function(_0x433147){_0x5ef372['count']=_0x433147;if(_0x4b0a9b[_0x11b6('0x36')]['includeAll']){_0x99b6d5[_0x11b6('0x44')]=[{'all':!![]}];}return db[_0x11b6('0x56')][_0x11b6('0x45')](_0x99b6d5);})[_0x11b6('0x2a')](function(_0x5cacfb){_0x5ef372[_0x11b6('0x46')]=_0x5cacfb;return _0x5ef372;});}})['then'](respondWithFilteredResult(_0x13d1a9,_0x99b6d5))[_0x11b6('0x47')](handleError(_0x13d1a9,null));};exports[_0x11b6('0x5a')]=function(_0x418d7b,_0x28ec19,_0x164332){return db[_0x11b6('0x31')][_0x11b6('0x4b')]({'where':{'id':_0x418d7b[_0x11b6('0x49')]['id']}})[_0x11b6('0x2a')](handleEntityNotFound(_0x28ec19,null))[_0x11b6('0x2a')](function(_0x5981b){if(_0x5981b){return _0x5981b['removeDispositions'](_0x418d7b['query'][_0x11b6('0x5b')]);}})[_0x11b6('0x2a')](respondWithStatusCode(_0x28ec19,null))[_0x11b6('0x47')](handleError(_0x28ec19,null));};exports[_0x11b6('0x5c')]=function(_0x1939bf,_0x2ea91c,_0x3e7347){return db[_0x11b6('0x31')][_0x11b6('0x4b')]({'where':{'id':_0x1939bf[_0x11b6('0x49')]['id']}})[_0x11b6('0x2a')](handleEntityNotFound(_0x2ea91c,null))[_0x11b6('0x2a')](function(_0x2c77db){if(_0x2c77db){var _0x48ff70=[];var _0x23f72a={'success':[],'errors':[]};return db[_0x11b6('0x5d')][_0x11b6('0x54')]()['then'](function(_0x43260b){if(_0x1939bf[_0x11b6('0x53')][_0x11b6('0x5e')]&&_['isArray'](_0x1939bf[_0x11b6('0x53')][_0x11b6('0x5e')])){if(_0x1939bf[_0x11b6('0x53')][_0x11b6('0x5e')]['length']){_0x1939bf[_0x11b6('0x53')][_0x11b6('0x5e')]=_0x1939bf[_0x11b6('0x53')]['tags'][_0x11b6('0x5f')](';')+';';}else{_0x1939bf[_0x11b6('0x53')][_0x11b6('0x5e')]=null;}}else{_0x1939bf[_0x11b6('0x53')][_0x11b6('0x5e')]=null;}if(_0x1939bf[_0x11b6('0x53')]&&_[_0x11b6('0x60')](_0x1939bf['body'])){for(var _0x314ddd=0x0;_0x314ddd<_0x1939bf[_0x11b6('0x53')][_0x11b6('0x3b')];_0x314ddd+=0x1){_0x1939bf[_0x11b6('0x53')][_0x314ddd]['ListId']=_0x1939bf[_0x11b6('0x49')]['id'];_0x48ff70[_0x11b6('0x61')](_0x1939bf['body'][_0x314ddd]);}return BPromise[_0x11b6('0x62')](_0x48ff70,function(_0x11ac9b){return db[_0x11b6('0x5d')][_0x11b6('0x4c')](_[_0x11b6('0x63')](_0x11ac9b,[_0x11b6('0x5b'),'id'])||{},{'fields':_[_0x11b6('0x37')](_0x43260b),'raw':!![]})[_0x11b6('0x2a')](function(_0x2b3ace){_0x23f72a[_0x11b6('0x64')]['push'](_0x2b3ace[_0x11b6('0x65')]);})[_0x11b6('0x47')](function(_0x570981){_0x23f72a[_0x11b6('0x66')]['push']({'data':_0x11ac9b,'error':_0x570981[_0x11b6('0x67')]});});})[_0x11b6('0x2a')](function(_0x3544fe){return _0x23f72a;})[_0x11b6('0x47')](function(_0x51b2f6){return _0x51b2f6;});}else{_0x2ea91c['status'](0x190)['json']({'message':_0x11b6('0x68')});}});}})[_0x11b6('0x2a')](respondWithResult(_0x2ea91c,null))[_0x11b6('0x47')](handleError(_0x2ea91c,null));};exports[_0x11b6('0x69')]=function(_0x106050,_0x11f48f,_0x13de6e){var _0x4833f8;return db[_0x11b6('0x31')][_0x11b6('0x4b')]({'where':{'id':_0x106050[_0x11b6('0x49')]['id']},'include':[{'model':db[_0x11b6('0x6a')],'as':_0x11b6('0x6b')}]})[_0x11b6('0x2a')](handleEntityNotFound(_0x11f48f,null))[_0x11b6('0x2a')](function(_0x4f0a99){if(_0x4f0a99){_0x4833f8=_0x4f0a99;return db['CmContact'][_0x11b6('0x32')];}})[_0x11b6('0x2a')](function(_0xd934f7){if(_0xd934f7){var _0x4e59bf={};var _0x11c697={};_0x11c697['model']=_[_0x11b6('0x6c')](_[_0x11b6('0x37')](_0xd934f7),_['map'](_0x4833f8['CustomFields'],function(_0x55b2d9){return util[_0x11b6('0x6d')](_0x11b6('0x6e'),_0x55b2d9['id']);}));_0x11c697[_0x11b6('0x36')]=_[_0x11b6('0x37')](_0x106050[_0x11b6('0x36')]);_0x11c697[_0x11b6('0x40')]=_[_0x11b6('0x38')](_0x11c697[_0x11b6('0x35')],_0x11c697[_0x11b6('0x36')]);_0x4e59bf[_0x11b6('0x3a')]=_[_0x11b6('0x38')](_0x11c697[_0x11b6('0x35')],qs[_0x11b6('0x39')](_0x106050[_0x11b6('0x36')][_0x11b6('0x39')]));_0x4e59bf[_0x11b6('0x3a')]=_0x4e59bf[_0x11b6('0x3a')][_0x11b6('0x3b')]?_0x4e59bf[_0x11b6('0x3a')]:_0x11c697['model'];if(!_0x106050[_0x11b6('0x36')][_0x11b6('0x59')]('nolimit')){_0x4e59bf[_0x11b6('0x22')]=qs[_0x11b6('0x22')](_0x106050['query']['limit']);_0x4e59bf['offset']=qs['offset'](_0x106050['query'][_0x11b6('0x20')]);}_0x4e59bf[_0x11b6('0x3d')]=qs['sort'](_0x106050[_0x11b6('0x36')][_0x11b6('0x3e')]);_0x4e59bf[_0x11b6('0x3f')]=qs[_0x11b6('0x40')](_[_0x11b6('0x41')](_0x106050[_0x11b6('0x36')],_0x11c697['filters']));_0x4e59bf['raw']=!![];if(_0x106050[_0x11b6('0x36')]['filter']){_0x4e59bf[_0x11b6('0x3f')]=_[_0x11b6('0x43')](_0x4e59bf[_0x11b6('0x3f')],{'$or':_[_0x11b6('0x30')](_0x4e59bf[_0x11b6('0x3a')],function(_0xc8b91f){var _0x3b022c={};_0x3b022c[_0xc8b91f]={'$like':'%'+_0x106050[_0x11b6('0x36')][_0x11b6('0x42')]+'%'};return _0x3b022c;})});}_0x4e59bf=_[_0x11b6('0x43')]({},_0x4e59bf,_0x106050[_0x11b6('0x6f')]);return _0x4833f8[_0x11b6('0x69')](_0x4e59bf);}})[_0x11b6('0x2a')](respondWithResult(_0x11f48f,null))[_0x11b6('0x47')](handleError(_0x11f48f,null));};exports[_0x11b6('0x70')]=function(_0x37bdec,_0x491268,_0x5cfd07){var _0x442ac2;var _0x535a4a;var _0x570a1c;var _0x44447d=_0x37bdec[_0x11b6('0x49')]['id'];csv_results=[];return db[_0x11b6('0x71')][_0x11b6('0x45')]({'attributes':['id',_0x11b6('0x2e')],'raw':!![],'order':[_0x11b6('0x72')]})[_0x11b6('0x2a')](function(_0x3235f){_0x442ac2=_0x3235f;var _0x2ea00d=_[_0x11b6('0x37')](db[_0x11b6('0x5d')][_0x11b6('0x32')]);return db[_0x11b6('0x6a')][_0x11b6('0x45')]({'raw':!![],'attributes':['id',_0x11b6('0x73')]})[_0x11b6('0x2a')](function(_0x1da81d){_0x535a4a=_0x1da81d;var _0x23152c=squel[_0x11b6('0x74')]()[_0x11b6('0x39')](_0x2ea00d)[_0x11b6('0x75')](_0x11b6('0x76'),'c')[_0x11b6('0x3f')](_0x11b6('0x77'),_0x44447d)[_0x11b6('0x3f')](_0x11b6('0x78'))[_0x11b6('0x79')]();for(var _0x3d5d47=0x0;_0x3d5d47<_0x535a4a['length'];_0x3d5d47++){_0x23152c[_0x11b6('0x7a')]('c.cf_'+_0x535a4a[_0x3d5d47]['id'],'customField_'+_0x535a4a[_0x3d5d47][_0x11b6('0x73')]);}for(var _0x3d5d47=0x0;_0x3d5d47<_0x442ac2[_0x11b6('0x3b')];_0x3d5d47++){_0x23152c['field'](squel[_0x11b6('0x74')]()[_0x11b6('0x7a')]('item')[_0x11b6('0x75')]('cm_contact_has_items')[_0x11b6('0x3f')]('ItemTypeId\x20=\x20?',_0x442ac2[_0x3d5d47]['id'])['where'](_0x11b6('0x7b')),_0x11b6('0x7c')+_0x442ac2[_0x3d5d47][_0x11b6('0x2e')]);_0x23152c[_0x11b6('0x7a')](squel[_0x11b6('0x74')]()[_0x11b6('0x7a')](_0x11b6('0x7d'))[_0x11b6('0x75')](_0x11b6('0x7e'))[_0x11b6('0x3f')](_0x11b6('0x7f'),_0x442ac2[_0x3d5d47]['id'])[_0x11b6('0x3f')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x442ac2[_0x3d5d47][_0x11b6('0x2e')]);}var _0x19cba2=[];_0x19cba2['push'](_0x23152c[_0x11b6('0x80')]());BPromise[_0x11b6('0x62')](_0x19cba2,handleQuery)[_0x11b6('0x2a')](function(_0x2997fd){handleQuery(_0x23152c['toString']());var _0x1016b5=csv_results[0x0];if(!_[_0x11b6('0x81')](_0x1016b5)){var _0x35f0f1=toCsv(_0x1016b5);var _0x34498b=Date[_0x11b6('0x82')]();fs[_0x11b6('0x83')](util[_0x11b6('0x6d')](_0x11b6('0x84'),_0x44447d,_0x34498b),_0x35f0f1);_0x491268[_0x11b6('0x85')]('Content-disposition',_0x11b6('0x86')+util[_0x11b6('0x6d')](_0x11b6('0x87'),_0x44447d,_0x34498b));_0x491268['setHeader'](_0x11b6('0x88'),_0x11b6('0x89'));return _0x491268[_0x11b6('0x8a')](util[_0x11b6('0x6d')]('/tmp/list_%d_%s.csv',_0x44447d,_0x34498b));}else{return _0x491268[_0x11b6('0x8b')](0xcc);}});});});};exports[_0x11b6('0x8c')]=function(_0x4b38a1,_0x19a515,_0x4aa957){var _0x2d068e;delete _0x4b38a1[_0x11b6('0x53')]['id'];return db['CmList'][_0x11b6('0x58')]({'where':{'id':_0x4b38a1[_0x11b6('0x49')]['id']}})[_0x11b6('0x2a')](handleEntityNotFound(_0x19a515,null))[_0x11b6('0x2a')](function(_0x2ccee3){if(_0x2ccee3){return db[_0x11b6('0x8d')]['transaction'](function(_0x55c82c){return db[_0x11b6('0x6a')]['create'](_0x4b38a1[_0x11b6('0x53')],{'transaction':_0x55c82c})[_0x11b6('0x2a')](function(_0x53f845){_0x2d068e=_0x53f845;return _0x2ccee3[_0x11b6('0x8e')](_0x53f845,{'transaction':_0x55c82c});})[_0x11b6('0x2a')](function(){var _0x465495={'type':db[_0x11b6('0x8f')][_0x11b6('0x90')],'transaction':_0x55c82c};switch(_0x4b38a1['body'][_0x11b6('0x34')]){case'text':_0x465495[_0x11b6('0x34')]=db[_0x11b6('0x8f')][_0x11b6('0x90')];break;case _0x11b6('0x91'):_0x465495['type']=db[_0x11b6('0x8f')][_0x11b6('0x92')];break;case _0x11b6('0x93'):_0x465495[_0x11b6('0x34')]=db[_0x11b6('0x8f')][_0x11b6('0x94')];_0x465495[_0x11b6('0x95')]=![];break;default:}return db['sequelize'][_0x11b6('0x96')]['addColumn'](_0x11b6('0x76'),util[_0x11b6('0x6d')](_0x11b6('0x97'),_0x2d068e['id']),_0x465495);})[_0x11b6('0x2a')](function(){return _0x2d068e;});});}})['then'](respondWithResult(_0x19a515,null))[_0x11b6('0x47')](handleError(_0x19a515,null));};exports['getCustomFields']=function(_0x591ed4,_0x4e30e3,_0xf6d909){var _0x5535df={};var _0x20d698={};var _0x46ebac;var _0x1f153f;return db[_0x11b6('0x31')][_0x11b6('0x58')]({'where':{'id':_0x591ed4['params']['id']}})[_0x11b6('0x2a')](handleEntityNotFound(_0x4e30e3,null))[_0x11b6('0x2a')](function(_0x466aa7){if(_0x466aa7){_0x46ebac=_0x466aa7;_0x20d698['model']=_[_0x11b6('0x37')](db[_0x11b6('0x6a')]['rawAttributes']);_0x20d698['query']=_['keys'](_0x591ed4[_0x11b6('0x36')]);_0x20d698[_0x11b6('0x40')]=_[_0x11b6('0x38')](_0x20d698[_0x11b6('0x35')],_0x20d698[_0x11b6('0x36')]);_0x5535df['attributes']=_[_0x11b6('0x38')](_0x20d698[_0x11b6('0x35')],qs['fields'](_0x591ed4[_0x11b6('0x36')][_0x11b6('0x39')]));_0x5535df[_0x11b6('0x3a')]=_0x5535df[_0x11b6('0x3a')][_0x11b6('0x3b')]?_0x5535df[_0x11b6('0x3a')]:_0x20d698[_0x11b6('0x35')];_0x5535df[_0x11b6('0x3d')]=qs[_0x11b6('0x3e')](_0x591ed4[_0x11b6('0x36')][_0x11b6('0x3e')]);_0x5535df[_0x11b6('0x3f')]=qs['filters'](_['pick'](_0x591ed4[_0x11b6('0x36')],_0x20d698[_0x11b6('0x40')]));_0x5535df[_0x11b6('0x3f')]=_[_0x11b6('0x43')](_0x5535df[_0x11b6('0x3f')],{'$or':[{'ListId':_0x466aa7['id']},{'ListId':null}]});if(_0x591ed4[_0x11b6('0x36')]['filter']){_0x5535df[_0x11b6('0x3f')]=_[_0x11b6('0x43')](_0x5535df[_0x11b6('0x3f')],{'$or':_[_0x11b6('0x30')](_0x5535df['attributes'],function(_0x95d0c7){var _0x2526d2={};_0x2526d2[_0x95d0c7]={'$like':'%'+_0x591ed4[_0x11b6('0x36')][_0x11b6('0x42')]+'%'};return _0x2526d2;})});}_0x5535df=_[_0x11b6('0x43')]({},_0x5535df,_0x591ed4[_0x11b6('0x6f')]);return db[_0x11b6('0x6a')][_0x11b6('0x98')](_0x5535df);}})[_0x11b6('0x2a')](respondWithResult(_0x4e30e3,null))[_0x11b6('0x47')](handleError(_0x4e30e3,null));};exports[_0x11b6('0x99')]=function(_0x14b3c1,_0x49d98f){return db[_0x11b6('0x6a')][_0x11b6('0x98')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x49d98f,null))[_0x11b6('0x2a')](function(_0x49be26){return _0x49be26;})[_0x11b6('0x2a')](respondWithResult(_0x49d98f,null))[_0x11b6('0x47')](handleError(_0x49d98f,null));};exports['addAgents']=function(_0xa7f147,_0x46a1f8,_0x5d969f){return db['CmList'][_0x11b6('0x4b')]({'where':{'id':_0xa7f147[_0x11b6('0x49')]['id']}})[_0x11b6('0x2a')](handleEntityNotFound(_0x46a1f8,null))['then'](function(_0x219ee2){if(_0x219ee2){return _0x219ee2[_0x11b6('0x9a')](_0xa7f147[_0x11b6('0x53')][_0x11b6('0x5b')],_['omit'](_0xa7f147[_0x11b6('0x53')],[_0x11b6('0x5b'),'id'])||{})[_0x11b6('0x9b')](function(_0x5d6547){for(var _0x5b2c2a=0x0;_0x5b2c2a<_0xa7f147[_0x11b6('0x53')][_0x11b6('0x5b')][_0x11b6('0x3b')];_0x5b2c2a+=0x1){socket[_0x11b6('0x9c')]('userCmList:save',{'UserId':Number(_0xa7f147[_0x11b6('0x53')][_0x11b6('0x5b')][_0x5b2c2a]),'CmListId':Number(_0xa7f147[_0x11b6('0x49')]['id'])});}return _0x5d6547;});}})[_0x11b6('0x2a')](respondWithResult(_0x46a1f8,null))[_0x11b6('0x47')](handleError(_0x46a1f8,null));};exports[_0x11b6('0x9d')]=function(_0x4557c2,_0x45f0b6,_0x5a082f){return db[_0x11b6('0x31')][_0x11b6('0x4b')]({'where':{'id':_0x4557c2[_0x11b6('0x49')]['id']}})[_0x11b6('0x2a')](handleEntityNotFound(_0x45f0b6,null))['then'](function(_0xf7dc79){if(_0xf7dc79){return _0xf7dc79['removeAgents'](_0x4557c2[_0x11b6('0x36')][_0x11b6('0x5b')])['then'](function(){if(_['isArray'](_0x4557c2[_0x11b6('0x36')]['ids'])){for(var _0x59e3a6=0x0;_0x59e3a6<_0x4557c2[_0x11b6('0x36')]['ids']['length'];_0x59e3a6+=0x1){socket[_0x11b6('0x9c')](_0x11b6('0x9e'),{'UserId':Number(_0x4557c2[_0x11b6('0x36')][_0x11b6('0x5b')][_0x59e3a6]),'CmListId':Number(_0x4557c2[_0x11b6('0x49')]['id'])});}}else{socket[_0x11b6('0x9c')](_0x11b6('0x9e'),{'UserId':Number(_0x4557c2[_0x11b6('0x36')][_0x11b6('0x5b')]),'CmListId':Number(_0x4557c2[_0x11b6('0x49')]['id'])});}});}})[_0x11b6('0x2a')](respondWithStatusCode(_0x45f0b6,null))[_0x11b6('0x47')](handleError(_0x45f0b6,null));};exports[_0x11b6('0x9f')]=function(_0x45dcf7,_0x1b1ffe,_0x587fcc){var _0x413ad3={};var _0x2fa418={};var _0x52b3b5;var _0x34eca7;return db[_0x11b6('0x31')][_0x11b6('0x58')]({'where':{'id':_0x45dcf7[_0x11b6('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b1ffe,null))['then'](function(_0x793657){if(_0x793657){_0x52b3b5=_0x793657;_0x2fa418[_0x11b6('0x35')]=_[_0x11b6('0x37')](db[_0x11b6('0xa0')][_0x11b6('0x32')]);_0x2fa418[_0x11b6('0x36')]=_[_0x11b6('0x37')](_0x45dcf7[_0x11b6('0x36')]);_0x2fa418['filters']=_[_0x11b6('0x38')](_0x2fa418[_0x11b6('0x35')],_0x2fa418[_0x11b6('0x36')]);_0x413ad3[_0x11b6('0x3a')]=_[_0x11b6('0x38')](_0x2fa418['model'],qs[_0x11b6('0x39')](_0x45dcf7[_0x11b6('0x36')]['fields']));_0x413ad3['attributes']=_0x413ad3[_0x11b6('0x3a')]['length']?_0x413ad3[_0x11b6('0x3a')]:_0x2fa418[_0x11b6('0x35')];_0x413ad3[_0x11b6('0x3d')]=qs['sort'](_0x45dcf7[_0x11b6('0x36')]['sort']);_0x413ad3['where']=qs[_0x11b6('0x40')](_[_0x11b6('0x41')](_0x45dcf7[_0x11b6('0x36')],_0x2fa418['filters']));if(_0x45dcf7[_0x11b6('0x36')][_0x11b6('0x42')]){_0x413ad3[_0x11b6('0x3f')]=_[_0x11b6('0x43')](_0x413ad3['where'],{'$or':_[_0x11b6('0x30')](_0x413ad3[_0x11b6('0x3a')],function(_0x1b6d57){var _0x2dd1b5={};_0x2dd1b5[_0x1b6d57]={'$like':'%'+_0x45dcf7[_0x11b6('0x36')][_0x11b6('0x42')]+'%'};return _0x2dd1b5;})});}_0x413ad3=_[_0x11b6('0x43')]({},_0x413ad3,_0x45dcf7['options']);return _0x52b3b5['getAgents'](_0x413ad3);}})[_0x11b6('0x2a')](function(_0x2517b4){if(_0x2517b4){_0x34eca7=_0x2517b4['length'];if(!_0x45dcf7[_0x11b6('0x36')][_0x11b6('0x59')](_0x11b6('0x3c'))){_0x413ad3['limit']=qs[_0x11b6('0x22')](_0x45dcf7[_0x11b6('0x36')][_0x11b6('0x22')]);_0x413ad3[_0x11b6('0x20')]=qs['offset'](_0x45dcf7['query']['offset']);}return _0x52b3b5['getAgents'](_0x413ad3);}})['then'](function(_0x5e2b34){if(_0x5e2b34){return _0x5e2b34?{'count':_0x34eca7,'rows':_0x5e2b34}:null;}})[_0x11b6('0x2a')](respondWithResult(_0x1b1ffe,null))['catch'](handleError(_0x1b1ffe,null));};function handleQuery(_0x27a3ea){logger[_0x11b6('0xa1')](_0x27a3ea);return db[_0x11b6('0x8d')]['query'](_0x27a3ea)[_0x11b6('0x9b')](function(_0x3f2e){csv_results[_0x11b6('0x61')](_0x3f2e);})[_0x11b6('0x47')](function(_0x1cf2a1){logger[_0x11b6('0x51')](_0x1cf2a1[_0x11b6('0x67')]);});} \ No newline at end of file +var _0x31b7=['number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','message','eml-format','rimraf','zip-dir','bluebird','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','Lists','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','CmList','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','sort','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','success','errors','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','customField_','select','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','CmCustomField','Sequelize','TEXT','text'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x31b7,0x15c));var _0x731b=function(_0x1088b5,_0x5f548c){_0x1088b5=_0x1088b5-0x0;var _0x288834=_0x31b7[_0x1088b5];return _0x288834;};'use strict';var emlformat=require(_0x731b('0x0'));var rimraf=require(_0x731b('0x1'));var zipdir=require(_0x731b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x731b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x731b('0x4'));var sox=require('sox');var csv=require(_0x731b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x731b('0x6'));var _=require(_0x731b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x731b('0x8'));var deskjs=require(_0x731b('0x9'));var toCsv=require(_0x731b('0x5'));var querystring=require(_0x731b('0xa'));var Papa=require(_0x731b('0xb'));var Redis=require(_0x731b('0xc'));var authService=require(_0x731b('0xd'));var qs=require(_0x731b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x731b('0xf'))(_0x731b('0x10'));var utils=require(_0x731b('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x731b('0x12'));var db=require(_0x731b('0x13'))['db'];var csv_results;config[_0x731b('0x14')]=_[_0x731b('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x731b('0x16'))(new Redis(config['redis']));require(_0x731b('0x17'))[_0x731b('0x18')](socket);function respondWithStatusCode(_0x50ace9,_0x4b61dd){_0x4b61dd=_0x4b61dd||0xcc;return function(_0x4fbf4f){if(_0x4fbf4f){return _0x50ace9[_0x731b('0x19')](_0x4b61dd);}return _0x50ace9['status'](_0x4b61dd)[_0x731b('0x1a')]();};}function respondWithResult(_0x4d4f16,_0xf8f8ee){_0xf8f8ee=_0xf8f8ee||0xc8;return function(_0x2bc78d){if(_0x2bc78d){return _0x4d4f16[_0x731b('0x1b')](_0xf8f8ee)[_0x731b('0x1c')](_0x2bc78d);}};}function respondWithFilteredResult(_0x351524,_0x2d8f65){return function(_0x5e9e71){if(_0x5e9e71){var _0x1755f1=typeof _0x2d8f65[_0x731b('0x1d')]===_0x731b('0x1e')&&typeof _0x2d8f65[_0x731b('0x1f')]===_0x731b('0x1e');var _0x5b4ca0=_0x5e9e71['count'];var _0x2d20c2=_0x1755f1?0x0:_0x2d8f65[_0x731b('0x1d')];var _0x2049f4=_0x1755f1?_0x5e9e71['count']:_0x2d8f65[_0x731b('0x1d')]+_0x2d8f65[_0x731b('0x1f')];var _0x55ae52;if(_0x2049f4>=_0x5b4ca0){_0x2049f4=_0x5b4ca0;_0x55ae52=0xc8;}else{_0x55ae52=0xce;}_0x351524[_0x731b('0x1b')](_0x55ae52);return _0x351524[_0x731b('0x20')](_0x731b('0x21'),_0x2d20c2+'-'+_0x2049f4+'/'+_0x5b4ca0)['json'](_0x5e9e71);}return null;};}function patchUpdates(_0x1c2f47){return function(_0x23808e){try{jsonpatch[_0x731b('0x22')](_0x23808e,_0x1c2f47,!![]);}catch(_0x15063f){return BPromise[_0x731b('0x23')](_0x15063f);}return _0x23808e[_0x731b('0x24')]();};}function saveUpdates(_0xb85c0f,_0x4f76c8){return function(_0x8b28da){if(_0x8b28da){return _0x8b28da[_0x731b('0x25')](_0xb85c0f)[_0x731b('0x26')](function(_0x5e802e){return _0x5e802e;});}return null;};}function removeEntity(_0x2c0b40,_0x49760b){return function(_0x447a7d){if(_0x447a7d){return _0x447a7d['destroy']()[_0x731b('0x26')](function(){var _0x239dda=_0x447a7d['get']({'plain':!![]});var _0x3667d2=_0x731b('0x27');return db['UserProfileResource'][_0x731b('0x28')]({'where':{'type':_0x3667d2,'resourceId':_0x239dda['id']}})[_0x731b('0x26')](function(){return _0x447a7d;});})[_0x731b('0x26')](function(){_0x2c0b40[_0x731b('0x1b')](0xcc)[_0x731b('0x1a')]();});}};}function handleEntityNotFound(_0x52a8eb,_0x4087d2){return function(_0x5e5154){if(!_0x5e5154){_0x52a8eb[_0x731b('0x19')](0x194);}return _0x5e5154;};}function handleError(_0x40441d,_0x44aa8c){_0x44aa8c=_0x44aa8c||0x1f4;return function(_0x3cb75f){logger[_0x731b('0x29')](_0x3cb75f[_0x731b('0x2a')]);if(_0x3cb75f[_0x731b('0x2b')]){delete _0x3cb75f['name'];}_0x40441d[_0x731b('0x1b')](_0x44aa8c)['send'](_0x3cb75f);};}exports[_0x731b('0x2c')]=function(_0x302091,_0x326234){var _0x24d774={},_0x512d1a={},_0x4df732={'count':0x0,'rows':[]};var _0x2203eb=_[_0x731b('0x2d')](db['CmList'][_0x731b('0x2e')],function(_0x32fb6a){return{'name':_0x32fb6a[_0x731b('0x2f')],'type':_0x32fb6a[_0x731b('0x30')][_0x731b('0x31')]};});_0x512d1a[_0x731b('0x32')]=_[_0x731b('0x2d')](_0x2203eb,_0x731b('0x2b'));_0x512d1a['query']=_[_0x731b('0x33')](_0x302091[_0x731b('0x34')]);_0x512d1a[_0x731b('0x35')]=_[_0x731b('0x36')](_0x512d1a[_0x731b('0x32')],_0x512d1a['query']);_0x24d774[_0x731b('0x37')]=_['intersection'](_0x512d1a[_0x731b('0x32')],qs['fields'](_0x302091[_0x731b('0x34')][_0x731b('0x38')]));_0x24d774[_0x731b('0x37')]=_0x24d774[_0x731b('0x37')][_0x731b('0x39')]?_0x24d774[_0x731b('0x37')]:_0x512d1a[_0x731b('0x32')];if(!_0x302091[_0x731b('0x34')]['hasOwnProperty'](_0x731b('0x3a'))){_0x24d774[_0x731b('0x1f')]=qs[_0x731b('0x1f')](_0x302091[_0x731b('0x34')]['limit']);_0x24d774[_0x731b('0x1d')]=qs[_0x731b('0x1d')](_0x302091['query'][_0x731b('0x1d')]);}_0x24d774[_0x731b('0x3b')]=qs['sort'](_0x302091[_0x731b('0x34')]['sort']);_0x24d774['where']=qs[_0x731b('0x35')](_[_0x731b('0x3c')](_0x302091[_0x731b('0x34')],_0x512d1a['filters']),_0x2203eb);if(_0x302091[_0x731b('0x34')][_0x731b('0x3d')]){_0x24d774[_0x731b('0x3e')]=_[_0x731b('0x3f')](_0x24d774[_0x731b('0x3e')],{'$or':_['map'](_0x2203eb,function(_0x3e3a96){if(_0x3e3a96[_0x731b('0x30')]!==_0x731b('0x40')){var _0x85ef59={};_0x85ef59[_0x3e3a96[_0x731b('0x2b')]]={'$like':'%'+_0x302091[_0x731b('0x34')][_0x731b('0x3d')]+'%'};return _0x85ef59;}})});}_0x24d774=_[_0x731b('0x3f')]({},_0x24d774,_0x302091[_0x731b('0x41')]);var _0x1a9588={'where':_0x24d774['where']};return db['CmList'][_0x731b('0x42')](_0x1a9588)['then'](function(_0x564d77){_0x4df732['count']=_0x564d77;if(_0x302091['query'][_0x731b('0x43')]){_0x24d774[_0x731b('0x44')]=[{'all':!![]}];}return db[_0x731b('0x45')][_0x731b('0x46')](_0x24d774);})[_0x731b('0x26')](function(_0x2448e4){_0x4df732[_0x731b('0x47')]=_0x2448e4;return _0x4df732;})[_0x731b('0x26')](respondWithFilteredResult(_0x326234,_0x24d774))['catch'](handleError(_0x326234,null));};exports[_0x731b('0x48')]=function(_0x5aa4e6,_0x52f927){var _0x3192a1={'raw':![],'where':{'id':_0x5aa4e6[_0x731b('0x49')]['id']}},_0x33f8ed={};_0x33f8ed[_0x731b('0x32')]=_['keys'](db['CmList'][_0x731b('0x2e')]);_0x33f8ed['query']=_[_0x731b('0x33')](_0x5aa4e6[_0x731b('0x34')]);_0x33f8ed[_0x731b('0x35')]=_['intersection'](_0x33f8ed[_0x731b('0x32')],_0x33f8ed['query']);_0x3192a1[_0x731b('0x37')]=_['intersection'](_0x33f8ed[_0x731b('0x32')],qs[_0x731b('0x38')](_0x5aa4e6[_0x731b('0x34')][_0x731b('0x38')]));_0x3192a1['attributes']=_0x3192a1[_0x731b('0x37')][_0x731b('0x39')]?_0x3192a1[_0x731b('0x37')]:_0x33f8ed[_0x731b('0x32')];if(_0x5aa4e6[_0x731b('0x34')][_0x731b('0x43')]){_0x3192a1[_0x731b('0x44')]=[{'all':!![]}];}_0x3192a1=_[_0x731b('0x3f')]({},_0x3192a1,_0x5aa4e6[_0x731b('0x41')]);return db['CmList'][_0x731b('0x4a')](_0x3192a1)[_0x731b('0x26')](handleEntityNotFound(_0x52f927,null))['then'](respondWithResult(_0x52f927,null))[_0x731b('0x4b')](handleError(_0x52f927,null));};exports[_0x731b('0x4c')]=function(_0x31acf6,_0xe10ac3){return db[_0x731b('0x45')]['create'](_0x31acf6[_0x731b('0x4d')],{})[_0x731b('0x26')](function(_0x13961d){var _0x2fb886=_0x31acf6[_0x731b('0x4e')]['get']({'plain':!![]});if(!_0x2fb886)throw new Error(_0x731b('0x4f'));if(_0x2fb886[_0x731b('0x50')]==='user'){var _0x180074=_0x13961d[_0x731b('0x51')]({'plain':!![]});var _0xd3b159=_0x731b('0x27');return db[_0x731b('0x52')][_0x731b('0x4a')]({'where':{'name':_0xd3b159,'userProfileId':_0x2fb886[_0x731b('0x53')]},'raw':!![]})['then'](function(_0x4e5528){if(_0x4e5528&&_0x4e5528['autoAssociation']===0x0){return db[_0x731b('0x54')]['create']({'name':_0x180074[_0x731b('0x2b')],'resourceId':_0x180074['id'],'type':_0x4e5528[_0x731b('0x2b')],'sectionId':_0x4e5528['id']},{})[_0x731b('0x26')](function(){return _0x13961d;});}else{return _0x13961d;}})[_0x731b('0x4b')](function(_0x1aa01c){logger[_0x731b('0x29')](_0x731b('0x55'),_0x1aa01c);throw _0x1aa01c;});}return _0x13961d;})[_0x731b('0x26')](respondWithResult(_0xe10ac3,0xc9))['catch'](handleError(_0xe10ac3,null));};exports[_0x731b('0x25')]=function(_0x4f7e76,_0x57fe2b){if(_0x4f7e76[_0x731b('0x4d')]['id']){delete _0x4f7e76['body']['id'];}return db[_0x731b('0x45')][_0x731b('0x4a')]({'where':{'id':_0x4f7e76[_0x731b('0x49')]['id']}})[_0x731b('0x26')](handleEntityNotFound(_0x57fe2b,null))[_0x731b('0x26')](saveUpdates(_0x4f7e76[_0x731b('0x4d')],null))[_0x731b('0x26')](respondWithResult(_0x57fe2b,null))[_0x731b('0x4b')](handleError(_0x57fe2b,null));};exports[_0x731b('0x28')]=function(_0x19ad60,_0x94c44d){return db['CmList'][_0x731b('0x4a')]({'where':{'id':_0x19ad60[_0x731b('0x49')]['id']}})[_0x731b('0x26')](handleEntityNotFound(_0x94c44d,null))[_0x731b('0x26')](removeEntity(_0x94c44d,null))[_0x731b('0x4b')](handleError(_0x94c44d,null));};exports[_0x731b('0x56')]=function(_0x5e37e3,_0x21f3ab){return db[_0x731b('0x45')][_0x731b('0x56')]()[_0x731b('0x26')](respondWithResult(_0x21f3ab,null))[_0x731b('0x4b')](handleError(_0x21f3ab,null));};exports[_0x731b('0x57')]=function(_0x5dda4c,_0x230104,_0x4d7ff7){if(_0x5dda4c[_0x731b('0x4d')]['id']){delete _0x5dda4c['body']['id'];}return db[_0x731b('0x45')][_0x731b('0x4a')]({'where':{'id':_0x5dda4c[_0x731b('0x49')]['id']}})['then'](handleEntityNotFound(_0x230104,null))[_0x731b('0x26')](function(_0x2d1e53){if(_0x2d1e53){_0x5dda4c['body'][_0x731b('0x58')]=_0x2d1e53['id'];return db[_0x731b('0x59')][_0x731b('0x4c')](_0x5dda4c[_0x731b('0x4d')]);}})[_0x731b('0x26')](respondWithResult(_0x230104,null))[_0x731b('0x4b')](handleError(_0x230104,null));};exports[_0x731b('0x5a')]=function(_0x3c1261,_0x2660aa,_0x23bf88){var _0x461b9f={'raw':![],'where':{}};var _0x1fe543={};var _0x37c3d2={'count':0x0,'rows':[]};return db[_0x731b('0x45')][_0x731b('0x5b')]({'where':{'id':_0x3c1261[_0x731b('0x49')]['id']}})['then'](handleEntityNotFound(_0x2660aa,null))[_0x731b('0x26')](function(_0xbaf5a8){if(_0xbaf5a8){_0x1fe543[_0x731b('0x32')]=_[_0x731b('0x33')](db[_0x731b('0x59')][_0x731b('0x2e')]);_0x1fe543[_0x731b('0x34')]=_[_0x731b('0x33')](_0x3c1261[_0x731b('0x34')]);_0x1fe543[_0x731b('0x35')]=_[_0x731b('0x36')](_0x1fe543['model'],_0x1fe543[_0x731b('0x34')]);_0x461b9f[_0x731b('0x37')]=_[_0x731b('0x36')](_0x1fe543[_0x731b('0x32')],qs[_0x731b('0x38')](_0x3c1261[_0x731b('0x34')]['fields']));_0x461b9f[_0x731b('0x37')]=_0x461b9f[_0x731b('0x37')][_0x731b('0x39')]?_0x461b9f['attributes']:_0x1fe543[_0x731b('0x32')];if(!_0x3c1261[_0x731b('0x34')][_0x731b('0x5c')](_0x731b('0x3a'))){_0x461b9f[_0x731b('0x1f')]=qs[_0x731b('0x1f')](_0x3c1261[_0x731b('0x34')][_0x731b('0x1f')]);_0x461b9f[_0x731b('0x1d')]=qs[_0x731b('0x1d')](_0x3c1261[_0x731b('0x34')]['offset']);}_0x461b9f['order']=qs[_0x731b('0x5d')](_0x3c1261[_0x731b('0x34')][_0x731b('0x5d')]);_0x461b9f[_0x731b('0x3e')]=qs[_0x731b('0x35')](_['pick'](_0x3c1261[_0x731b('0x34')],_0x1fe543['filters']));_0x461b9f[_0x731b('0x3e')]['ListId']=_0xbaf5a8['id'];if(_0x3c1261['query']['filter']){_0x461b9f['where']=_[_0x731b('0x3f')](_0x461b9f[_0x731b('0x3e')],{'$or':_[_0x731b('0x2d')](_0x461b9f[_0x731b('0x37')],function(_0x43c68c){var _0x1bbe80={};_0x1bbe80[_0x43c68c]={'$like':'%'+_0x3c1261[_0x731b('0x34')][_0x731b('0x3d')]+'%'};return _0x1bbe80;})});}_0x461b9f=_['merge']({},_0x461b9f,_0x3c1261[_0x731b('0x41')]);return db['Disposition'][_0x731b('0x42')]({'where':_0x461b9f['where']})[_0x731b('0x26')](function(_0x472647){_0x37c3d2[_0x731b('0x42')]=_0x472647;if(_0x3c1261[_0x731b('0x34')][_0x731b('0x43')]){_0x461b9f[_0x731b('0x44')]=[{'all':!![]}];}return db[_0x731b('0x59')][_0x731b('0x46')](_0x461b9f);})[_0x731b('0x26')](function(_0xa9efad){_0x37c3d2[_0x731b('0x47')]=_0xa9efad;return _0x37c3d2;});}})[_0x731b('0x26')](respondWithFilteredResult(_0x2660aa,_0x461b9f))['catch'](handleError(_0x2660aa,null));};exports[_0x731b('0x5e')]=function(_0x228cec,_0x19388f,_0x572594){return db[_0x731b('0x45')][_0x731b('0x4a')]({'where':{'id':_0x228cec[_0x731b('0x49')]['id']}})[_0x731b('0x26')](handleEntityNotFound(_0x19388f,null))[_0x731b('0x26')](function(_0x3e2366){if(_0x3e2366){return _0x3e2366[_0x731b('0x5e')](_0x228cec[_0x731b('0x34')][_0x731b('0x5f')]);}})[_0x731b('0x26')](respondWithStatusCode(_0x19388f,null))['catch'](handleError(_0x19388f,null));};exports[_0x731b('0x60')]=function(_0x5853af,_0x43293f,_0xbfcedb){return db[_0x731b('0x45')][_0x731b('0x4a')]({'where':{'id':_0x5853af[_0x731b('0x49')]['id']}})[_0x731b('0x26')](handleEntityNotFound(_0x43293f,null))[_0x731b('0x26')](function(_0x2ce7ce){if(_0x2ce7ce){var _0x5bad84=[];var _0x3fe0d0={'success':[],'errors':[]};return db[_0x731b('0x61')]['describe']()['then'](function(_0x5a7de2){if(_0x5853af[_0x731b('0x4d')]['tags']&&_[_0x731b('0x62')](_0x5853af[_0x731b('0x4d')]['tags'])){if(_0x5853af['body']['tags'][_0x731b('0x39')]){_0x5853af[_0x731b('0x4d')][_0x731b('0x63')]=_0x5853af[_0x731b('0x4d')][_0x731b('0x63')][_0x731b('0x64')](';')+';';}else{_0x5853af['body'][_0x731b('0x63')]=null;}}else{_0x5853af[_0x731b('0x4d')][_0x731b('0x63')]=null;}if(_0x5853af[_0x731b('0x4d')]&&_['isArray'](_0x5853af[_0x731b('0x4d')])){for(var _0xaebb73=0x0;_0xaebb73<_0x5853af[_0x731b('0x4d')][_0x731b('0x39')];_0xaebb73+=0x1){_0x5853af[_0x731b('0x4d')][_0xaebb73][_0x731b('0x58')]=_0x5853af[_0x731b('0x49')]['id'];_0x5bad84[_0x731b('0x65')](_0x5853af['body'][_0xaebb73]);}return BPromise['each'](_0x5bad84,function(_0x151686){return db[_0x731b('0x61')][_0x731b('0x4c')](_['omit'](_0x151686,[_0x731b('0x5f'),'id'])||{},{'fields':_[_0x731b('0x33')](_0x5a7de2),'raw':!![]})['then'](function(_0x2c69c1){_0x3fe0d0[_0x731b('0x66')]['push'](_0x2c69c1['dataValues']);})[_0x731b('0x4b')](function(_0x57b9d5){_0x3fe0d0[_0x731b('0x67')][_0x731b('0x65')]({'data':_0x151686,'error':_0x57b9d5['message']});});})[_0x731b('0x26')](function(_0x45e213){return _0x3fe0d0;})[_0x731b('0x4b')](function(_0x1cc1a8){return _0x1cc1a8;});}else{_0x43293f[_0x731b('0x1b')](0x190)[_0x731b('0x1c')]({'message':_0x731b('0x68')});}});}})[_0x731b('0x26')](respondWithResult(_0x43293f,null))[_0x731b('0x4b')](handleError(_0x43293f,null));};exports['getContacts']=function(_0x56c4ea,_0x5e53fc,_0xc0756b){var _0x52920e;return db['CmList']['find']({'where':{'id':_0x56c4ea[_0x731b('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x731b('0x69')}]})[_0x731b('0x26')](handleEntityNotFound(_0x5e53fc,null))[_0x731b('0x26')](function(_0x383c02){if(_0x383c02){_0x52920e=_0x383c02;return db[_0x731b('0x61')]['rawAttributes'];}})[_0x731b('0x26')](function(_0x223781){if(_0x223781){var _0x1e65ff={};var _0x1d6945={};_0x1d6945[_0x731b('0x32')]=_[_0x731b('0x6a')](_[_0x731b('0x33')](_0x223781),_[_0x731b('0x2d')](_0x52920e[_0x731b('0x69')],function(_0x32fc9d){return util[_0x731b('0x6b')](_0x731b('0x6c'),_0x32fc9d['id']);}));_0x1d6945[_0x731b('0x34')]=_[_0x731b('0x33')](_0x56c4ea[_0x731b('0x34')]);_0x1d6945[_0x731b('0x35')]=_[_0x731b('0x36')](_0x1d6945[_0x731b('0x32')],_0x1d6945['query']);_0x1e65ff[_0x731b('0x37')]=_[_0x731b('0x36')](_0x1d6945[_0x731b('0x32')],qs[_0x731b('0x38')](_0x56c4ea[_0x731b('0x34')][_0x731b('0x38')]));_0x1e65ff[_0x731b('0x37')]=_0x1e65ff[_0x731b('0x37')][_0x731b('0x39')]?_0x1e65ff[_0x731b('0x37')]:_0x1d6945[_0x731b('0x32')];if(!_0x56c4ea[_0x731b('0x34')][_0x731b('0x5c')](_0x731b('0x3a'))){_0x1e65ff['limit']=qs[_0x731b('0x1f')](_0x56c4ea[_0x731b('0x34')][_0x731b('0x1f')]);_0x1e65ff[_0x731b('0x1d')]=qs[_0x731b('0x1d')](_0x56c4ea['query'][_0x731b('0x1d')]);}_0x1e65ff[_0x731b('0x3b')]=qs[_0x731b('0x5d')](_0x56c4ea[_0x731b('0x34')][_0x731b('0x5d')]);_0x1e65ff[_0x731b('0x3e')]=qs['filters'](_['pick'](_0x56c4ea[_0x731b('0x34')],_0x1d6945['filters']));_0x1e65ff[_0x731b('0x6d')]=!![];if(_0x56c4ea['query']['filter']){_0x1e65ff[_0x731b('0x3e')]=_[_0x731b('0x3f')](_0x1e65ff[_0x731b('0x3e')],{'$or':_[_0x731b('0x2d')](_0x1e65ff[_0x731b('0x37')],function(_0x52d823){var _0x3e8825={};_0x3e8825[_0x52d823]={'$like':'%'+_0x56c4ea['query'][_0x731b('0x3d')]+'%'};return _0x3e8825;})});}_0x1e65ff=_[_0x731b('0x3f')]({},_0x1e65ff,_0x56c4ea[_0x731b('0x41')]);return _0x52920e[_0x731b('0x6e')](_0x1e65ff);}})[_0x731b('0x26')](respondWithResult(_0x5e53fc,null))[_0x731b('0x4b')](handleError(_0x5e53fc,null));};exports[_0x731b('0x6f')]=function(_0x2d91f9,_0x2631dd,_0x1c564c){var _0x349ef2;var _0x5a2b13;var _0x1f0804;var _0x12450d=_0x2d91f9[_0x731b('0x49')]['id'];csv_results=[];return db[_0x731b('0x70')][_0x731b('0x46')]({'attributes':['id',_0x731b('0x2b')],'raw':!![],'order':[_0x731b('0x71')]})[_0x731b('0x26')](function(_0x3a25fd){_0x349ef2=_0x3a25fd;var _0x5e2da7=_[_0x731b('0x33')](db['CmContact'][_0x731b('0x2e')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x731b('0x72')]})[_0x731b('0x26')](function(_0x47989b){_0x5a2b13=_0x47989b;var _0x3a3387=squel['select']()[_0x731b('0x38')](_0x5e2da7)[_0x731b('0x73')]('cm_contacts','c')['where'](_0x731b('0x74'),_0x12450d)['where'](_0x731b('0x75'))['distinct']();for(var _0x538639=0x0;_0x538639<_0x5a2b13[_0x731b('0x39')];_0x538639++){_0x3a3387[_0x731b('0x76')]('c.cf_'+_0x5a2b13[_0x538639]['id'],_0x731b('0x77')+_0x5a2b13[_0x538639][_0x731b('0x72')]);}for(var _0x538639=0x0;_0x538639<_0x349ef2[_0x731b('0x39')];_0x538639++){_0x3a3387[_0x731b('0x76')](squel[_0x731b('0x78')]()[_0x731b('0x76')]('item')[_0x731b('0x73')](_0x731b('0x79'))[_0x731b('0x3e')](_0x731b('0x7a'),_0x349ef2[_0x538639]['id'])['where']('CmContactId\x20=\x20c.id'),_0x731b('0x7b')+_0x349ef2[_0x538639][_0x731b('0x2b')]);_0x3a3387[_0x731b('0x76')](squel[_0x731b('0x78')]()[_0x731b('0x76')]('description')[_0x731b('0x73')](_0x731b('0x79'))[_0x731b('0x3e')](_0x731b('0x7a'),_0x349ef2[_0x538639]['id'])['where'](_0x731b('0x7c')),_0x731b('0x7d')+_0x349ef2[_0x538639][_0x731b('0x2b')]);}var _0x53fdfa=[];_0x53fdfa['push'](_0x3a3387[_0x731b('0x7e')]());BPromise['each'](_0x53fdfa,handleQuery)[_0x731b('0x26')](function(_0x2daad0){handleQuery(_0x3a3387[_0x731b('0x7e')]());var _0x368fa6=csv_results[0x0];if(!_['isEmpty'](_0x368fa6)){var _0x950603=toCsv(_0x368fa6);var _0x3a019c=Date[_0x731b('0x7f')]();fs[_0x731b('0x80')](util[_0x731b('0x6b')]('/tmp/list_%d_%s.csv',_0x12450d,_0x3a019c),_0x950603);_0x2631dd[_0x731b('0x81')]('Content-disposition',_0x731b('0x82')+util[_0x731b('0x6b')](_0x731b('0x83'),_0x12450d,_0x3a019c));_0x2631dd[_0x731b('0x81')](_0x731b('0x84'),_0x731b('0x85'));return _0x2631dd[_0x731b('0x86')](util[_0x731b('0x6b')](_0x731b('0x87'),_0x12450d,_0x3a019c));}else{return _0x2631dd['sendStatus'](0xcc);}});});});};exports[_0x731b('0x88')]=function(_0x798338,_0x50b05a,_0x4167eb){var _0x308683;delete _0x798338[_0x731b('0x4d')]['id'];return db[_0x731b('0x45')][_0x731b('0x5b')]({'where':{'id':_0x798338[_0x731b('0x49')]['id']}})['then'](handleEntityNotFound(_0x50b05a,null))['then'](function(_0x3d763f){if(_0x3d763f){return db['sequelize']['transaction'](function(_0x5cd081){return db[_0x731b('0x89')][_0x731b('0x4c')](_0x798338[_0x731b('0x4d')],{'transaction':_0x5cd081})[_0x731b('0x26')](function(_0x1f0b47){_0x308683=_0x1f0b47;return _0x3d763f['addCustomFields'](_0x1f0b47,{'transaction':_0x5cd081});})[_0x731b('0x26')](function(){var _0x479f78={'type':db[_0x731b('0x8a')][_0x731b('0x8b')],'transaction':_0x5cd081};switch(_0x798338['body'][_0x731b('0x30')]){case _0x731b('0x8c'):_0x479f78[_0x731b('0x30')]=db['Sequelize'][_0x731b('0x8b')];break;case _0x731b('0x8d'):_0x479f78[_0x731b('0x30')]=db[_0x731b('0x8a')][_0x731b('0x8e')];break;case _0x731b('0x8f'):_0x479f78[_0x731b('0x30')]=db[_0x731b('0x8a')][_0x731b('0x90')];_0x479f78[_0x731b('0x91')]=![];break;default:}return db['sequelize'][_0x731b('0x92')][_0x731b('0x93')]('cm_contacts',util[_0x731b('0x6b')](_0x731b('0x94'),_0x308683['id']),_0x479f78);})[_0x731b('0x26')](function(){return _0x308683;});});}})[_0x731b('0x26')](respondWithResult(_0x50b05a,null))[_0x731b('0x4b')](handleError(_0x50b05a,null));};exports[_0x731b('0x95')]=function(_0x56bef6,_0x3ff199,_0x153922){var _0x1dbd66={};var _0x55341a={};var _0x54288d;var _0x3b0862;return db[_0x731b('0x45')][_0x731b('0x5b')]({'where':{'id':_0x56bef6[_0x731b('0x49')]['id']}})[_0x731b('0x26')](handleEntityNotFound(_0x3ff199,null))[_0x731b('0x26')](function(_0x30c9b6){if(_0x30c9b6){_0x54288d=_0x30c9b6;_0x55341a['model']=_[_0x731b('0x33')](db[_0x731b('0x89')][_0x731b('0x2e')]);_0x55341a[_0x731b('0x34')]=_['keys'](_0x56bef6[_0x731b('0x34')]);_0x55341a[_0x731b('0x35')]=_[_0x731b('0x36')](_0x55341a[_0x731b('0x32')],_0x55341a['query']);_0x1dbd66[_0x731b('0x37')]=_[_0x731b('0x36')](_0x55341a[_0x731b('0x32')],qs['fields'](_0x56bef6['query'][_0x731b('0x38')]));_0x1dbd66['attributes']=_0x1dbd66[_0x731b('0x37')][_0x731b('0x39')]?_0x1dbd66[_0x731b('0x37')]:_0x55341a[_0x731b('0x32')];_0x1dbd66[_0x731b('0x3b')]=qs[_0x731b('0x5d')](_0x56bef6[_0x731b('0x34')][_0x731b('0x5d')]);_0x1dbd66[_0x731b('0x3e')]=qs[_0x731b('0x35')](_[_0x731b('0x3c')](_0x56bef6['query'],_0x55341a[_0x731b('0x35')]));_0x1dbd66['where']=_['merge'](_0x1dbd66[_0x731b('0x3e')],{'$or':[{'ListId':_0x30c9b6['id']},{'ListId':null}]});if(_0x56bef6['query'][_0x731b('0x3d')]){_0x1dbd66['where']=_[_0x731b('0x3f')](_0x1dbd66['where'],{'$or':_[_0x731b('0x2d')](_0x1dbd66[_0x731b('0x37')],function(_0x1b77c5){var _0x49bbb8={};_0x49bbb8[_0x1b77c5]={'$like':'%'+_0x56bef6[_0x731b('0x34')][_0x731b('0x3d')]+'%'};return _0x49bbb8;})});}_0x1dbd66=_[_0x731b('0x3f')]({},_0x1dbd66,_0x56bef6[_0x731b('0x41')]);return db[_0x731b('0x89')]['findAndCountAll'](_0x1dbd66);}})[_0x731b('0x26')](respondWithResult(_0x3ff199,null))[_0x731b('0x4b')](handleError(_0x3ff199,null));};exports[_0x731b('0x96')]=function(_0x4ecf3d,_0x337771){return db[_0x731b('0x89')][_0x731b('0x97')]({'where':{'ListId':null}})[_0x731b('0x26')](handleEntityNotFound(_0x337771,null))[_0x731b('0x26')](function(_0x56709e){return _0x56709e;})[_0x731b('0x26')](respondWithResult(_0x337771,null))[_0x731b('0x4b')](handleError(_0x337771,null));};exports[_0x731b('0x98')]=function(_0x35f72c,_0x33d19e,_0x1d1de8){return db[_0x731b('0x45')]['find']({'where':{'id':_0x35f72c['params']['id']}})[_0x731b('0x26')](handleEntityNotFound(_0x33d19e,null))[_0x731b('0x26')](function(_0x52e252){if(_0x52e252){return _0x52e252[_0x731b('0x98')](_0x35f72c['body']['ids'],_[_0x731b('0x99')](_0x35f72c[_0x731b('0x4d')],[_0x731b('0x5f'),'id'])||{})[_0x731b('0x9a')](function(_0x2aaaa2){for(var _0x5e0217=0x0;_0x5e0217<_0x35f72c[_0x731b('0x4d')][_0x731b('0x5f')][_0x731b('0x39')];_0x5e0217+=0x1){socket[_0x731b('0x9b')](_0x731b('0x9c'),{'UserId':Number(_0x35f72c[_0x731b('0x4d')][_0x731b('0x5f')][_0x5e0217]),'CmListId':Number(_0x35f72c[_0x731b('0x49')]['id'])});}return _0x2aaaa2;});}})[_0x731b('0x26')](respondWithResult(_0x33d19e,null))[_0x731b('0x4b')](handleError(_0x33d19e,null));};exports['removeAgents']=function(_0x4d1ad1,_0x2b9722,_0x23d399){return db[_0x731b('0x45')][_0x731b('0x4a')]({'where':{'id':_0x4d1ad1[_0x731b('0x49')]['id']}})[_0x731b('0x26')](handleEntityNotFound(_0x2b9722,null))[_0x731b('0x26')](function(_0x16967c){if(_0x16967c){return _0x16967c[_0x731b('0x9d')](_0x4d1ad1[_0x731b('0x34')]['ids'])['then'](function(){if(_[_0x731b('0x62')](_0x4d1ad1['query'][_0x731b('0x5f')])){for(var _0x844fa2=0x0;_0x844fa2<_0x4d1ad1[_0x731b('0x34')][_0x731b('0x5f')]['length'];_0x844fa2+=0x1){socket[_0x731b('0x9b')](_0x731b('0x9e'),{'UserId':Number(_0x4d1ad1['query'][_0x731b('0x5f')][_0x844fa2]),'CmListId':Number(_0x4d1ad1[_0x731b('0x49')]['id'])});}}else{socket[_0x731b('0x9b')](_0x731b('0x9e'),{'UserId':Number(_0x4d1ad1[_0x731b('0x34')][_0x731b('0x5f')]),'CmListId':Number(_0x4d1ad1['params']['id'])});}});}})[_0x731b('0x26')](respondWithStatusCode(_0x2b9722,null))[_0x731b('0x4b')](handleError(_0x2b9722,null));};exports[_0x731b('0x9f')]=function(_0x281132,_0x8984f4,_0x6546c6){var _0x1597ed={};var _0x1275d0={};var _0x3d7d40;var _0x2ea2d9;return db[_0x731b('0x45')][_0x731b('0x5b')]({'where':{'id':_0x281132[_0x731b('0x49')]['id']}})[_0x731b('0x26')](handleEntityNotFound(_0x8984f4,null))[_0x731b('0x26')](function(_0x47118c){if(_0x47118c){_0x3d7d40=_0x47118c;_0x1275d0[_0x731b('0x32')]=_[_0x731b('0x33')](db[_0x731b('0xa0')][_0x731b('0x2e')]);_0x1275d0['query']=_[_0x731b('0x33')](_0x281132[_0x731b('0x34')]);_0x1275d0[_0x731b('0x35')]=_[_0x731b('0x36')](_0x1275d0[_0x731b('0x32')],_0x1275d0[_0x731b('0x34')]);_0x1597ed['attributes']=_[_0x731b('0x36')](_0x1275d0['model'],qs[_0x731b('0x38')](_0x281132[_0x731b('0x34')][_0x731b('0x38')]));_0x1597ed['attributes']=_0x1597ed['attributes']['length']?_0x1597ed['attributes']:_0x1275d0['model'];_0x1597ed[_0x731b('0x3b')]=qs[_0x731b('0x5d')](_0x281132['query'][_0x731b('0x5d')]);_0x1597ed[_0x731b('0x3e')]=qs[_0x731b('0x35')](_[_0x731b('0x3c')](_0x281132[_0x731b('0x34')],_0x1275d0['filters']));if(_0x281132['query'][_0x731b('0x3d')]){_0x1597ed[_0x731b('0x3e')]=_[_0x731b('0x3f')](_0x1597ed[_0x731b('0x3e')],{'$or':_[_0x731b('0x2d')](_0x1597ed['attributes'],function(_0x408651){var _0x30bd7f={};_0x30bd7f[_0x408651]={'$like':'%'+_0x281132[_0x731b('0x34')][_0x731b('0x3d')]+'%'};return _0x30bd7f;})});}_0x1597ed=_['merge']({},_0x1597ed,_0x281132['options']);return _0x3d7d40[_0x731b('0x9f')](_0x1597ed);}})['then'](function(_0x5ef1ce){if(_0x5ef1ce){_0x2ea2d9=_0x5ef1ce['length'];if(!_0x281132[_0x731b('0x34')][_0x731b('0x5c')](_0x731b('0x3a'))){_0x1597ed[_0x731b('0x1f')]=qs[_0x731b('0x1f')](_0x281132[_0x731b('0x34')][_0x731b('0x1f')]);_0x1597ed[_0x731b('0x1d')]=qs[_0x731b('0x1d')](_0x281132['query'][_0x731b('0x1d')]);}return _0x3d7d40['getAgents'](_0x1597ed);}})[_0x731b('0x26')](function(_0x279502){if(_0x279502){return _0x279502?{'count':_0x2ea2d9,'rows':_0x279502}:null;}})[_0x731b('0x26')](respondWithResult(_0x8984f4,null))[_0x731b('0x4b')](handleError(_0x8984f4,null));};function handleQuery(_0x1ec3e6){logger[_0x731b('0xa1')](_0x1ec3e6);return db['sequelize'][_0x731b('0x34')](_0x1ec3e6)['spread'](function(_0x5b0f18){csv_results[_0x731b('0x65')](_0x5b0f18);})[_0x731b('0x4b')](function(_0x44b040){logger[_0x731b('0x29')](_0x44b040[_0x731b('0xa2')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6badf7b..cff5c54 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x5be16a,_0x145a69){_0x5be16a=_0x5be16a-0x0;var _0x5eb46e=_0xe14b[_0x5be16a];return _0x5eb46e;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x55ca,0x126));var _0xa55c=function(_0x30099e,_0x1ee4b2){_0x30099e=_0x30099e-0x0;var _0x474f63=_0x55ca[_0x30099e];return _0x474f63;};'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 7da8d7b..b641cee 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 _0x41bb=['bluebird','request-promise','path','rimraf','./cmList.attributes','exports','cm_lists','lodash','util','api'];(function(_0x225a3f,_0x397e5b){var _0x3fdecf=function(_0x3865c9){while(--_0x3865c9){_0x225a3f['push'](_0x225a3f['shift']());}};_0x3fdecf(++_0x397e5b);}(_0x41bb,0xc5));var _0xb41b=function(_0x15c5c2,_0x155ba1){_0x15c5c2=_0x15c5c2-0x0;var _0x5b04b8=_0x41bb[_0x15c5c2];return _0x5b04b8;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('CmList',attributes,{'tableName':_0xb41b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0x59db3c,_0x3de328){var _0x51f294=function(_0x8e50c0){while(--_0x8e50c0){_0x59db3c['push'](_0x59db3c['shift']());}};_0x51f294(++_0x3de328);}(_0xaa88,0x137));var _0x8aa8=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0xaa88[_0x4370c7];return _0xce78a9;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'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 9760974..e98ac2b 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 _0xa660=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x499398,_0x50ea6b){var _0x29106a=function(_0x350db0){while(--_0x350db0){_0x499398['push'](_0x499398['shift']());}};_0x29106a(++_0x50ea6b);}(_0xa660,0x98));var _0x0a66=function(_0x43fe6d,_0x25d0a7){_0x43fe6d=_0x43fe6d-0x0;var _0x1811d8=_0xa660[_0x43fe6d];return _0x1811d8;};'use strict';var _=require(_0x0a66('0x0'));var util=require(_0x0a66('0x1'));var moment=require('moment');var BPromise=require(_0x0a66('0x2'));var rs=require(_0x0a66('0x3'));var fs=require('fs');var Redis=require(_0x0a66('0x4'));var db=require(_0x0a66('0x5'))['db'];var utils=require(_0x0a66('0x6'));var logger=require(_0x0a66('0x7'))(_0x0a66('0x8'));var config=require(_0x0a66('0x9'));var jayson=require(_0x0a66('0xa'));var client=jayson[_0x0a66('0xb')][_0x0a66('0xc')]({'port':0x232a});config[_0x0a66('0xd')]=_[_0x0a66('0xe')](config['redis'],{'host':_0x0a66('0xf'),'port':0x18eb});var socket=require(_0x0a66('0x10'))(new Redis(config[_0x0a66('0xd')]));require(_0x0a66('0x11'))[_0x0a66('0x12')](socket);function respondWithRpcPromise(_0x5a2bad,_0x10129a,_0x5e1352){return new BPromise(function(_0x4fe21c,_0x13a4fb){return client[_0x0a66('0x13')](_0x5a2bad,_0x5e1352)['then'](function(_0x53f41b){logger[_0x0a66('0x14')](_0x0a66('0x15'),_0x10129a,_0x0a66('0x16'));logger[_0x0a66('0x17')](_0x0a66('0x18'),_0x10129a,_0x0a66('0x16'),JSON[_0x0a66('0x19')](_0x53f41b));if(_0x53f41b[_0x0a66('0x1a')]){if(_0x53f41b[_0x0a66('0x1a')][_0x0a66('0x1b')]===0x1f4){logger[_0x0a66('0x1a')](_0x0a66('0x15'),_0x10129a,_0x53f41b['error'][_0x0a66('0x1c')]);return _0x13a4fb(_0x53f41b[_0x0a66('0x1a')][_0x0a66('0x1c')]);}logger['error'](_0x0a66('0x15'),_0x10129a,_0x53f41b['error'][_0x0a66('0x1c')]);return _0x4fe21c(_0x53f41b[_0x0a66('0x1a')][_0x0a66('0x1c')]);}else{logger[_0x0a66('0x14')](_0x0a66('0x15'),_0x10129a,_0x0a66('0x16'));_0x4fe21c(_0x53f41b[_0x0a66('0x1d')][_0x0a66('0x1c')]);}})[_0x0a66('0x1e')](function(_0x311c0b){logger[_0x0a66('0x1a')](_0x0a66('0x15'),_0x10129a,_0x311c0b);_0x13a4fb(_0x311c0b);});});} \ No newline at end of file +var _0x82b3=['redis','defaults','localhost','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x21135f,_0x1dd5e6){var _0x3413d=function(_0x1ef36b){while(--_0x1ef36b){_0x21135f['push'](_0x21135f['shift']());}};_0x3413d(++_0x1dd5e6);}(_0x82b3,0xf9));var _0x382b=function(_0x1c4e9c,_0x400e42){_0x1c4e9c=_0x1c4e9c-0x0;var _0x12d61a=_0x82b3[_0x1c4e9c];return _0x12d61a;};'use strict';var _=require(_0x382b('0x0'));var util=require(_0x382b('0x1'));var moment=require('moment');var BPromise=require(_0x382b('0x2'));var rs=require(_0x382b('0x3'));var fs=require('fs');var Redis=require(_0x382b('0x4'));var db=require(_0x382b('0x5'))['db'];var utils=require(_0x382b('0x6'));var logger=require(_0x382b('0x7'))('rpc');var config=require(_0x382b('0x8'));var jayson=require(_0x382b('0x9'));var client=jayson[_0x382b('0xa')][_0x382b('0xb')]({'port':0x232a});config[_0x382b('0xc')]=_[_0x382b('0xd')](config[_0x382b('0xc')],{'host':_0x382b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x382b('0xc')]));require(_0x382b('0xf'))[_0x382b('0x10')](socket);function respondWithRpcPromise(_0x5ae155,_0x53c788,_0x2bcea3){return new BPromise(function(_0x2bd044,_0x576428){return client[_0x382b('0x11')](_0x5ae155,_0x2bcea3)['then'](function(_0x23c64b){logger[_0x382b('0x12')](_0x382b('0x13'),_0x53c788,_0x382b('0x14'));logger[_0x382b('0x15')](_0x382b('0x16'),_0x53c788,'request\x20sent',JSON[_0x382b('0x17')](_0x23c64b));if(_0x23c64b[_0x382b('0x18')]){if(_0x23c64b['error'][_0x382b('0x19')]===0x1f4){logger[_0x382b('0x18')](_0x382b('0x13'),_0x53c788,_0x23c64b['error']['message']);return _0x576428(_0x23c64b[_0x382b('0x18')][_0x382b('0x1a')]);}logger['error'](_0x382b('0x13'),_0x53c788,_0x23c64b[_0x382b('0x18')][_0x382b('0x1a')]);return _0x2bd044(_0x23c64b[_0x382b('0x18')][_0x382b('0x1a')]);}else{logger[_0x382b('0x12')](_0x382b('0x13'),_0x53c788,'request\x20sent');_0x2bd044(_0x23c64b[_0x382b('0x1b')][_0x382b('0x1a')]);}})[_0x382b('0x1c')](function(_0x2fa6a7){logger[_0x382b('0x18')](_0x382b('0x13'),_0x53c788,_0x2fa6a7);_0x576428(_0x2fa6a7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e230d5e..8cbc4fc 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 _0x40bb=['save','remove','update','register','./cmList.events'];(function(_0x3af9d9,_0x2698b6){var _0x91a211=function(_0x19e92a){while(--_0x19e92a){_0x3af9d9['push'](_0x3af9d9['shift']());}};_0x91a211(++_0x2698b6);}(_0x40bb,0x149));var _0xb40b=function(_0x4a6102,_0x55c49b){_0x4a6102=_0x4a6102-0x0;var _0x994381=_0x40bb[_0x4a6102];return _0x994381;};'use strict';var CmListEvents=require(_0xb40b('0x0'));var events=[_0xb40b('0x1'),_0xb40b('0x2'),_0xb40b('0x3')];function createListener(_0x372a23,_0x5243f3){return function(_0x3d17bb){_0x5243f3['emit'](_0x372a23,_0x3d17bb);};}function removeListener(_0x3f6863,_0x518dc6){return function(){CmListEvents['removeListener'](_0x3f6863,_0x518dc6);};}exports[_0xb40b('0x4')]=function(_0x13489a){for(var _0x26660e=0x0,_0x189739=events['length'];_0x26660e<_0x189739;_0x26660e++){var _0x5e10f2=events[_0x26660e];var _0x26337f=createListener('cmList:'+_0x5e10f2,_0x13489a);CmListEvents['on'](_0x5e10f2,_0x26337f);}}; \ No newline at end of file +var _0xcc0d=['register','length','cmList:','./cmList.events','remove','update','emit'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xcc0d,0x145));var _0xdcc0=function(_0x19a0c2,_0x26053e){_0x19a0c2=_0x19a0c2-0x0;var _0x4cb91e=_0xcc0d[_0x19a0c2];return _0x4cb91e;};'use strict';var CmListEvents=require(_0xdcc0('0x0'));var events=['save',_0xdcc0('0x1'),_0xdcc0('0x2')];function createListener(_0x1882da,_0x9c4fd){return function(_0x2a91b1){_0x9c4fd[_0xdcc0('0x3')](_0x1882da,_0x2a91b1);};}function removeListener(_0x5a8f50,_0x22471c){return function(){CmListEvents['removeListener'](_0x5a8f50,_0x22471c);};}exports[_0xdcc0('0x4')]=function(_0x3fe27d){for(var _0x4f6551=0x0,_0x182c10=events[_0xdcc0('0x5')];_0x4f6551<_0x182c10;_0x4f6551++){var _0x33a463=events[_0x4f6551];var _0x2ba8bd=createListener(_0xdcc0('0x6')+_0x33a463,_0x3fe27d);CmListEvents['on'](_0x33a463,_0x2ba8bd);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 57a6ccd..fb11dbe 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 _0x96a6=['/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','describe','/global_fields','isAuthenticated','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts'];(function(_0x36a722,_0x511d46){var _0x37d766=function(_0x5f358e){while(--_0x5f358e){_0x36a722['push'](_0x36a722['shift']());}};_0x37d766(++_0x511d46);}(_0x96a6,0xfd));var _0x696a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x96a6[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x696a('0x0'));var util=require(_0x696a('0x1'));var path=require('path');var timeout=require(_0x696a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x696a('0x3'));var interaction=require(_0x696a('0x4'));var config=require(_0x696a('0x5'));var controller=require(_0x696a('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x696a('0x7')](_0x696a('0x8'),auth['isAuthenticated'](),controller[_0x696a('0x9')]);router[_0x696a('0x7')](_0x696a('0xa'),auth[_0x696a('0xb')](),controller[_0x696a('0xc')]);router[_0x696a('0x7')](_0x696a('0xd'),auth[_0x696a('0xb')](),controller[_0x696a('0xe')]);router['get'](_0x696a('0xf'),auth['isAuthenticated'](),controller[_0x696a('0x10')]);router[_0x696a('0x7')](_0x696a('0x11'),auth[_0x696a('0xb')](),controller[_0x696a('0x12')]);router[_0x696a('0x7')](_0x696a('0x13'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x696a('0x7')](_0x696a('0x14'),auth[_0x696a('0xb')](),controller[_0x696a('0x15')]);router[_0x696a('0x7')](_0x696a('0x16'),auth[_0x696a('0xb')](),controller[_0x696a('0x17')]);router['post']('/',auth[_0x696a('0xb')](),controller['create']);router[_0x696a('0x18')](_0x696a('0xf'),auth['isAuthenticated'](),controller[_0x696a('0x19')]);router[_0x696a('0x18')](_0x696a('0x11'),auth['isAuthenticated'](),controller[_0x696a('0x1a')]);router['post'](_0x696a('0x14'),auth[_0x696a('0xb')](),controller[_0x696a('0x1b')]);router[_0x696a('0x18')](_0x696a('0x16'),auth['isAuthenticated'](),controller[_0x696a('0x1c')]);router['put'](_0x696a('0xd'),auth[_0x696a('0xb')](),controller[_0x696a('0x1d')]);router[_0x696a('0x1e')](_0x696a('0xd'),auth[_0x696a('0xb')](),controller[_0x696a('0x1f')]);router[_0x696a('0x1e')]('/:id/dispositions',auth[_0x696a('0xb')](),controller[_0x696a('0x20')]);router['delete'](_0x696a('0x16'),auth[_0x696a('0xb')](),controller['removeAgents']);module[_0x696a('0x21')]=router; \ No newline at end of file +var _0x52cb=['index','/describe','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getAgents','post','create','addDisposition','/:id/fields','addCustomField','addAgents','put','delete','destroy','removeDispositions','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52cb,0x1a2));var _0xb52c=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0x52cb[_0x336264];return _0x53cf91;};'use strict';var multer=require(_0xb52c('0x0'));var util=require(_0xb52c('0x1'));var path=require('path');var timeout=require(_0xb52c('0x2'));var express=require(_0xb52c('0x3'));var router=express[_0xb52c('0x4')]();var fs_extra=require(_0xb52c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb52c('0x6'));var config=require(_0xb52c('0x7'));var controller=require(_0xb52c('0x8'));router[_0xb52c('0x9')]('/',auth[_0xb52c('0xa')](),controller[_0xb52c('0xb')]);router[_0xb52c('0x9')](_0xb52c('0xc'),auth[_0xb52c('0xa')](),controller[_0xb52c('0xd')]);router[_0xb52c('0x9')]('/global_fields',auth['isAuthenticated'](),controller[_0xb52c('0xe')]);router[_0xb52c('0x9')](_0xb52c('0xf'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x10')]);router[_0xb52c('0x9')](_0xb52c('0x11'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x12')]);router[_0xb52c('0x9')](_0xb52c('0x13'),auth[_0xb52c('0xa')](),controller['getContacts']);router[_0xb52c('0x9')](_0xb52c('0x14'),auth[_0xb52c('0xa')](),controller['getContactsCsv']);router[_0xb52c('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getCustomFields']);router[_0xb52c('0x9')]('/:id/users',auth[_0xb52c('0xa')](),controller[_0xb52c('0x15')]);router[_0xb52c('0x16')]('/',auth[_0xb52c('0xa')](),controller[_0xb52c('0x17')]);router[_0xb52c('0x16')]('/:id/dispositions',auth[_0xb52c('0xa')](),controller[_0xb52c('0x18')]);router['post']('/:id/contacts',auth[_0xb52c('0xa')](),controller['addContacts']);router['post'](_0xb52c('0x19'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x1a')]);router[_0xb52c('0x16')]('/:id/users',auth[_0xb52c('0xa')](),controller[_0xb52c('0x1b')]);router[_0xb52c('0x1c')](_0xb52c('0xf'),auth[_0xb52c('0xa')](),controller['update']);router[_0xb52c('0x1d')]('/:id',auth[_0xb52c('0xa')](),controller[_0xb52c('0x1e')]);router['delete'](_0xb52c('0x11'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x1f')]);router[_0xb52c('0x1d')]('/:id/users',auth[_0xb52c('0xa')](),controller['removeAgents']);module[_0xb52c('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 12e5c0c..91457bc 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 _0x6cdc=['STRING','sequelize','exports','getDataValue','field'];(function(_0x2fc8ea,_0x2ec5a7){var _0x3b679e=function(_0x3613b7){while(--_0x3613b7){_0x2fc8ea['push'](_0x2fc8ea['shift']());}};_0x3b679e(++_0x2ec5a7);}(_0x6cdc,0xf1));var _0xc6cd=function(_0x928a02,_0x2257cd){_0x928a02=_0x928a02-0x0;var _0x30705c=_0x6cdc[_0x928a02];return _0x30705c;};'use strict';var Sequelize=require(_0xc6cd('0x0'));module[_0xc6cd('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x40a646){return this[_0xc6cd('0x2')](_0xc6cd('0x3'));}},'field':{'type':Sequelize[_0xc6cd('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xc6cd('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xc6cd('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa78f=['STRING','exports','VIRTUAL','getDataValue'];(function(_0x2c8bee,_0x327339){var _0x4c1430=function(_0x1ee31e){while(--_0x1ee31e){_0x2c8bee['push'](_0x2c8bee['shift']());}};_0x4c1430(++_0x327339);}(_0xa78f,0x7d));var _0xfa78=function(_0x4e6411,_0x2763b1){_0x4e6411=_0x4e6411-0x0;var _0x21697a=_0xa78f[_0x4e6411];return _0x21697a;};'use strict';var Sequelize=require('sequelize');module[_0xfa78('0x0')]={'name':{'type':Sequelize[_0xfa78('0x1')],'get':function(_0x17c18f){return this[_0xfa78('0x2')]('field');}},'field':{'type':Sequelize[_0xfa78('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xfa78('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xfa78('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index c133ebb..317309f 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2a17cc,_0x33e6e2){var _0x41b1ad=function(_0x1fda85){while(--_0x1fda85){_0x2a17cc['push'](_0x2a17cc['shift']());}};_0x41b1ad(++_0x33e6e2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5dff93,_0x5afa75){var _0x4e38a1=function(_0x4d277a){while(--_0x4d277a){_0x5dff93['push'](_0x5dff93['shift']());}};_0x4e38a1(++_0x5afa75);}(_0x7a54,0x106));var _0x47a5=function(_0x2f3d4d,_0x54e8e0){_0x2f3d4d=_0x2f3d4d-0x0;var _0x5dd61a=_0x7a54[_0x2f3d4d];return _0x5dd61a;};'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 0ed226a..df94ed0 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 _0x0be8=['util','moment','bluebird','rimraf','../../config/environment','./condition.attributes','exports','define','Condition'];(function(_0x4097d3,_0x816047){var _0x21bae7=function(_0x379672){while(--_0x379672){_0x4097d3['push'](_0x4097d3['shift']());}};_0x21bae7(++_0x816047);}(_0x0be8,0x1c2));var _0x80be=function(_0x59e0ce,_0x4ff009){_0x59e0ce=_0x59e0ce-0x0;var _0x1c5474=_0x0be8[_0x59e0ce];return _0x1c5474;};'use strict';var _=require('lodash');var util=require(_0x80be('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x80be('0x1'));var BPromise=require(_0x80be('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80be('0x3'));var config=require(_0x80be('0x4'));var attributes=require(_0x80be('0x5'));module[_0x80be('0x6')]=function(_0x39c9d7,_0x53c2ab){return _0x39c9d7[_0x80be('0x7')](_0x80be('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa23c=['Condition','tools_conditions','lodash','util','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x168cb5,_0x3c25db){var _0xa53cac=function(_0x35a312){while(--_0x35a312){_0x168cb5['push'](_0x168cb5['shift']());}};_0xa53cac(++_0x3c25db);}(_0xa23c,0x1ba));var _0xca23=function(_0x2686fb,_0x3cf35b){_0x2686fb=_0x2686fb-0x0;var _0x17ba62=_0xa23c[_0x2686fb];return _0x17ba62;};'use strict';var _=require(_0xca23('0x0'));var util=require(_0xca23('0x1'));var logger=require('../../config/logger')(_0xca23('0x2'));var moment=require(_0xca23('0x3'));var BPromise=require(_0xca23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca23('0x5'));var rimraf=require('rimraf');var config=require(_0xca23('0x6'));var attributes=require('./condition.attributes');module[_0xca23('0x7')]=function(_0x4f1e53,_0x551f14){return _0x4f1e53[_0xca23('0x8')](_0xca23('0x9'),attributes,{'tableName':_0xca23('0xa'),'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 a609928..133fb89 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 _0xf86d=['util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','request','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','Condition,\x20%s,\x20%s','catch','lodash'];(function(_0x5c8c28,_0x5540a7){var _0x4cd6bd=function(_0x3e43aa){while(--_0x3e43aa){_0x5c8c28['push'](_0x5c8c28['shift']());}};_0x4cd6bd(++_0x5540a7);}(_0xf86d,0x1df));var _0xdf86=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xf86d[_0x533e4e];return _0x1f14bb;};'use strict';var _=require(_0xdf86('0x0'));var util=require(_0xdf86('0x1'));var moment=require(_0xdf86('0x2'));var BPromise=require(_0xdf86('0x3'));var rs=require(_0xdf86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf86('0x5'));var logger=require('../../config/logger')(_0xdf86('0x6'));var config=require('../../config/environment');var jayson=require(_0xdf86('0x7'));var client=jayson['client'][_0xdf86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5490be,_0x11d3a4,_0x3f331e){return new BPromise(function(_0x31dc1b,_0x9abe4a){return client[_0xdf86('0x9')](_0x5490be,_0x3f331e)['then'](function(_0x240f42){logger['info']('Condition,\x20%s,\x20%s',_0x11d3a4,_0xdf86('0xa'));logger[_0xdf86('0xb')](_0xdf86('0xc'),_0x11d3a4,_0xdf86('0xa'),JSON[_0xdf86('0xd')](_0x240f42));if(_0x240f42['error']){if(_0x240f42['error'][_0xdf86('0xe')]===0x1f4){logger[_0xdf86('0xf')]('Condition,\x20%s,\x20%s',_0x11d3a4,_0x240f42[_0xdf86('0xf')][_0xdf86('0x10')]);return _0x9abe4a(_0x240f42[_0xdf86('0xf')][_0xdf86('0x10')]);}logger['error']('Condition,\x20%s,\x20%s',_0x11d3a4,_0x240f42[_0xdf86('0xf')][_0xdf86('0x10')]);return _0x31dc1b(_0x240f42[_0xdf86('0xf')][_0xdf86('0x10')]);}else{logger[_0xdf86('0x11')](_0xdf86('0x12'),_0x11d3a4,_0xdf86('0xa'));_0x31dc1b(_0x240f42['result'][_0xdf86('0x10')]);}})[_0xdf86('0x13')](function(_0x2a0846){logger[_0xdf86('0xf')](_0xdf86('0x12'),_0x11d3a4,_0x2a0846);_0x9abe4a(_0x2a0846);});});} \ No newline at end of file +var _0x15eb=['client','http','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/environment','jayson/promise'];(function(_0x5d1068,_0x15bee1){var _0x2351a8=function(_0x54c844){while(--_0x54c844){_0x5d1068['push'](_0x5d1068['shift']());}};_0x2351a8(++_0x15bee1);}(_0x15eb,0x173));var _0xb15e=function(_0x4c2fad,_0x1eb609){_0x4c2fad=_0x4c2fad-0x0;var _0x1a4825=_0x15eb[_0x4c2fad];return _0x1a4825;};'use strict';var _=require(_0xb15e('0x0'));var util=require(_0xb15e('0x1'));var moment=require(_0xb15e('0x2'));var BPromise=require(_0xb15e('0x3'));var rs=require(_0xb15e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb15e('0x5'));var jayson=require(_0xb15e('0x6'));var client=jayson[_0xb15e('0x7')][_0xb15e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f39de,_0x561a58,_0x43ffe2){return new BPromise(function(_0x5e7a34,_0x5d38b4){return client['request'](_0x3f39de,_0x43ffe2)['then'](function(_0x1e2fde){logger['info'](_0xb15e('0x9'),_0x561a58,_0xb15e('0xa'));logger['debug'](_0xb15e('0xb'),_0x561a58,_0xb15e('0xa'),JSON[_0xb15e('0xc')](_0x1e2fde));if(_0x1e2fde[_0xb15e('0xd')]){if(_0x1e2fde['error'][_0xb15e('0xe')]===0x1f4){logger[_0xb15e('0xd')]('Condition,\x20%s,\x20%s',_0x561a58,_0x1e2fde['error']['message']);return _0x5d38b4(_0x1e2fde[_0xb15e('0xd')][_0xb15e('0xf')]);}logger[_0xb15e('0xd')]('Condition,\x20%s,\x20%s',_0x561a58,_0x1e2fde['error'][_0xb15e('0xf')]);return _0x5e7a34(_0x1e2fde[_0xb15e('0xd')][_0xb15e('0xf')]);}else{logger[_0xb15e('0x10')](_0xb15e('0x9'),_0x561a58,_0xb15e('0xa'));_0x5e7a34(_0x1e2fde[_0xb15e('0x11')][_0xb15e('0xf')]);}})['catch'](function(_0x5730e){logger[_0xb15e('0xd')](_0xb15e('0x9'),_0x561a58,_0x5730e);_0x5d38b4(_0x5730e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 9d571c2..bd9e83e 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 _0x50ec=['put','/:id','isAuthenticated','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x50ec,0x1cd));var _0xc50e=function(_0x1dba1d,_0x57e40b){_0x1dba1d=_0x1dba1d-0x0;var _0x121725=_0x50ec[_0x1dba1d];return _0x121725;};'use strict';var multer=require(_0xc50e('0x0'));var util=require('util');var path=require(_0xc50e('0x1'));var timeout=require(_0xc50e('0x2'));var express=require('express');var router=express[_0xc50e('0x3')]();var fs_extra=require(_0xc50e('0x4'));var auth=require(_0xc50e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc50e('0x6'));var controller=require('./condition.controller');router[_0xc50e('0x7')](_0xc50e('0x8'),auth[_0xc50e('0x9')](),controller['update']);router[_0xc50e('0xa')](_0xc50e('0x8'),auth[_0xc50e('0x9')](),controller[_0xc50e('0xb')]);module[_0xc50e('0xc')]=router; \ No newline at end of file +var _0x1a6d=['isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x34d823,_0x2d20b0){var _0x1eb90c=function(_0x43eda6){while(--_0x43eda6){_0x34d823['push'](_0x34d823['shift']());}};_0x1eb90c(++_0x2d20b0);}(_0x1a6d,0x94));var _0xd1a6=function(_0x5c2113,_0x3daf5e){_0x5c2113=_0x5c2113-0x0;var _0x4eba66=_0x1a6d[_0x5c2113];return _0x4eba66;};'use strict';var multer=require(_0xd1a6('0x0'));var util=require(_0xd1a6('0x1'));var path=require(_0xd1a6('0x2'));var timeout=require(_0xd1a6('0x3'));var express=require(_0xd1a6('0x4'));var router=express[_0xd1a6('0x5')]();var fs_extra=require(_0xd1a6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd1a6('0x7'));var config=require(_0xd1a6('0x8'));var controller=require(_0xd1a6('0x9'));router[_0xd1a6('0xa')](_0xd1a6('0xb'),auth[_0xd1a6('0xc')](),controller[_0xd1a6('0xd')]);router[_0xd1a6('0xe')](_0xd1a6('0xb'),auth[_0xd1a6('0xc')](),controller['destroy']);module[_0xd1a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c49cde0..a264de8 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 _0x134c=['STRING','name','INTEGER','sequelize','exports'];(function(_0x20656c,_0x11a677){var _0x5abe15=function(_0x381701){while(--_0x381701){_0x20656c['push'](_0x20656c['shift']());}};_0x5abe15(++_0x11a677);}(_0x134c,0x1ca));var _0xc134=function(_0x8f4554,_0x97e1f8){_0x8f4554=_0x8f4554-0x0;var _0x2b7465=_0x134c[_0x8f4554];return _0x2b7465;};'use strict';var Sequelize=require(_0xc134('0x0'));module[_0xc134('0x1')]={'name':{'type':Sequelize[_0xc134('0x2')],'allowNull':![],'unique':_0xc134('0x3')},'OrderBy':{'type':Sequelize[_0xc134('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc134('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x151c=['STRING','name','exports'];(function(_0x2ff38f,_0xefceba){var _0x19a75f=function(_0x22c3b1){while(--_0x22c3b1){_0x2ff38f['push'](_0x2ff38f['shift']());}};_0x19a75f(++_0xefceba);}(_0x151c,0x6e));var _0xc151=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x151c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xc151('0x0')]={'name':{'type':Sequelize[_0xc151('0x1')],'allowNull':![],'unique':_0xc151('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc151('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 177919f..386394b 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 _0x6a95=['get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x41155b,_0x14214c){var _0x52c2af=function(_0x4cf4c0){while(--_0x4cf4c0){_0x41155b['push'](_0x41155b['shift']());}};_0x52c2af(++_0x14214c);}(_0x6a95,0x1db));var _0x56a9=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x6a95[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2c7f,_0x4552ce){_0x4552ce=_0x4552ce||0xcc;return function(_0x420667){if(_0x420667){return _0x2b2c7f[_0x56a9('0x19')](_0x4552ce);}return _0x2b2c7f[_0x56a9('0x1a')](_0x4552ce)[_0x56a9('0x1b')]();};}function respondWithResult(_0x124ab8,_0x1a2eb4){_0x1a2eb4=_0x1a2eb4||0xc8;return function(_0x40b2cb){if(_0x40b2cb){return _0x124ab8['status'](_0x1a2eb4)['json'](_0x40b2cb);}};}function respondWithFilteredResult(_0x2e0dfd,_0x2a0714){return function(_0x42007b){if(_0x42007b){var _0x46f854=typeof _0x2a0714['offset']===_0x56a9('0x1c')&&typeof _0x2a0714['limit']==='undefined';var _0x4e292f=_0x42007b[_0x56a9('0x1d')];var _0x576bdf=_0x46f854?0x0:_0x2a0714[_0x56a9('0x1e')];var _0x105fe5=_0x46f854?_0x42007b[_0x56a9('0x1d')]:_0x2a0714[_0x56a9('0x1e')]+_0x2a0714[_0x56a9('0x1f')];var _0xbfeb1a;if(_0x105fe5>=_0x4e292f){_0x105fe5=_0x4e292f;_0xbfeb1a=0xc8;}else{_0xbfeb1a=0xce;}_0x2e0dfd[_0x56a9('0x1a')](_0xbfeb1a);return _0x2e0dfd[_0x56a9('0x20')](_0x56a9('0x21'),_0x576bdf+'-'+_0x105fe5+'/'+_0x4e292f)[_0x56a9('0x22')](_0x42007b);}return null;};}function patchUpdates(_0x5f145f){return function(_0x5bc03a){try{jsonpatch[_0x56a9('0x23')](_0x5bc03a,_0x5f145f,!![]);}catch(_0x16f9de){return BPromise[_0x56a9('0x24')](_0x16f9de);}return _0x5bc03a[_0x56a9('0x25')]();};}function saveUpdates(_0x4a09e5,_0x6100fe){return function(_0x3355c4){if(_0x3355c4){return _0x3355c4[_0x56a9('0x26')](_0x4a09e5)[_0x56a9('0x27')](function(_0x5a82e0){return _0x5a82e0;});}return null;};}function removeEntity(_0x44762e,_0x32839b){return function(_0x21ab38){if(_0x21ab38){return _0x21ab38[_0x56a9('0x28')]()[_0x56a9('0x27')](function(){var _0x52016c=_0x21ab38[_0x56a9('0x29')]({'plain':!![]});var _0x217bda=_0x56a9('0x2a');return db['UserProfileResource'][_0x56a9('0x28')]({'where':{'type':_0x217bda,'resourceId':_0x52016c['id']}})['then'](function(){return _0x21ab38;});})[_0x56a9('0x27')](function(){_0x44762e[_0x56a9('0x1a')](0xcc)[_0x56a9('0x1b')]();});}};}function handleEntityNotFound(_0x20432a,_0x45f38c){return function(_0x1afe8a){if(!_0x1afe8a){_0x20432a[_0x56a9('0x19')](0x194);}return _0x1afe8a;};}function handleError(_0xff5f55,_0x51fd64){_0x51fd64=_0x51fd64||0x1f4;return function(_0x437ccf){logger[_0x56a9('0x2b')](_0x437ccf['stack']);if(_0x437ccf[_0x56a9('0x2c')]){delete _0x437ccf['name'];}_0xff5f55['status'](_0x51fd64)[_0x56a9('0x2d')](_0x437ccf);};}exports['index']=function(_0x2f933a,_0x11002a){var _0x2fbd5d={},_0x2c1c3d={},_0x5879db={'count':0x0,'rows':[]};var _0x332707=_[_0x56a9('0x2e')](db[_0x56a9('0x2f')][_0x56a9('0x30')],function(_0xbbb47d){return{'name':_0xbbb47d[_0x56a9('0x31')],'type':_0xbbb47d[_0x56a9('0x32')][_0x56a9('0x33')]};});_0x2c1c3d[_0x56a9('0x34')]=_[_0x56a9('0x2e')](_0x332707,_0x56a9('0x2c'));_0x2c1c3d[_0x56a9('0x35')]=_['keys'](_0x2f933a[_0x56a9('0x35')]);_0x2c1c3d[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x2c1c3d['model'],_0x2c1c3d[_0x56a9('0x35')]);_0x2fbd5d['attributes']=_['intersection'](_0x2c1c3d['model'],qs[_0x56a9('0x38')](_0x2f933a[_0x56a9('0x35')]['fields']));_0x2fbd5d['attributes']=_0x2fbd5d[_0x56a9('0x39')][_0x56a9('0x3a')]?_0x2fbd5d[_0x56a9('0x39')]:_0x2c1c3d[_0x56a9('0x34')];if(!_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3b')](_0x56a9('0x3c'))){_0x2fbd5d[_0x56a9('0x1f')]=qs[_0x56a9('0x1f')](_0x2f933a[_0x56a9('0x35')]['limit']);_0x2fbd5d['offset']=qs['offset'](_0x2f933a['query'][_0x56a9('0x1e')]);}_0x2fbd5d[_0x56a9('0x3d')]=qs['sort'](_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3e')]);_0x2fbd5d[_0x56a9('0x3f')]=qs[_0x56a9('0x36')](_[_0x56a9('0x40')](_0x2f933a[_0x56a9('0x35')],_0x2c1c3d[_0x56a9('0x36')]),_0x332707);if(_0x2f933a['query'][_0x56a9('0x41')]){_0x2fbd5d[_0x56a9('0x3f')]=_['merge'](_0x2fbd5d['where'],{'$or':_[_0x56a9('0x2e')](_0x332707,function(_0x1180c6){if(_0x1180c6[_0x56a9('0x32')]!==_0x56a9('0x42')){var _0x158504={};_0x158504[_0x1180c6[_0x56a9('0x2c')]]={'$like':'%'+_0x2f933a[_0x56a9('0x35')][_0x56a9('0x41')]+'%'};return _0x158504;}})});}_0x2fbd5d=_[_0x56a9('0x43')]({},_0x2fbd5d,_0x2f933a[_0x56a9('0x44')]);var _0x9f24ea={'where':_0x2fbd5d[_0x56a9('0x3f')]};return db[_0x56a9('0x2f')][_0x56a9('0x1d')](_0x9f24ea)[_0x56a9('0x27')](function(_0xe57cfb){_0x5879db[_0x56a9('0x1d')]=_0xe57cfb;if(_0x2f933a[_0x56a9('0x35')]['includeAll']){_0x2fbd5d[_0x56a9('0x45')]=[{'all':!![]}];}return db[_0x56a9('0x2f')][_0x56a9('0x46')](_0x2fbd5d);})['then'](function(_0x1f8b30){_0x5879db['rows']=_0x1f8b30;return _0x5879db;})[_0x56a9('0x27')](respondWithFilteredResult(_0x11002a,_0x2fbd5d))['catch'](handleError(_0x11002a,null));};exports[_0x56a9('0x47')]=function(_0x39c445,_0x3998f1){var _0x49286b={'raw':!![],'where':{'id':_0x39c445['params']['id']}},_0x5192d8={};_0x5192d8['model']=_[_0x56a9('0x48')](db[_0x56a9('0x2f')][_0x56a9('0x30')]);_0x5192d8[_0x56a9('0x35')]=_[_0x56a9('0x48')](_0x39c445[_0x56a9('0x35')]);_0x5192d8[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],_0x5192d8[_0x56a9('0x35')]);_0x49286b[_0x56a9('0x39')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],qs[_0x56a9('0x38')](_0x39c445['query'][_0x56a9('0x38')]));_0x49286b[_0x56a9('0x39')]=_0x49286b[_0x56a9('0x39')]['length']?_0x49286b[_0x56a9('0x39')]:_0x5192d8[_0x56a9('0x34')];if(_0x39c445['query'][_0x56a9('0x49')]){_0x49286b[_0x56a9('0x45')]=[{'all':!![]}];}_0x49286b=_[_0x56a9('0x43')]({},_0x49286b,_0x39c445[_0x56a9('0x44')]);return db['ContactItemType'][_0x56a9('0x4a')](_0x49286b)[_0x56a9('0x27')](handleEntityNotFound(_0x3998f1,null))[_0x56a9('0x27')](respondWithResult(_0x3998f1,null))[_0x56a9('0x4b')](handleError(_0x3998f1,null));};exports[_0x56a9('0x4c')]=function(_0x3942d8,_0x31aaf5){return db[_0x56a9('0x2f')][_0x56a9('0x4c')](_0x3942d8[_0x56a9('0x4d')],{})[_0x56a9('0x27')](function(_0x500656){var _0x58d370=_0x3942d8[_0x56a9('0x4e')][_0x56a9('0x29')]({'plain':!![]});if(!_0x58d370)throw new Error(_0x56a9('0x4f'));if(_0x58d370[_0x56a9('0x50')]==='user'){var _0x1986f2=_0x500656[_0x56a9('0x29')]({'plain':!![]});var _0x26ad3e=_0x56a9('0x2a');return db['UserProfileSection'][_0x56a9('0x4a')]({'where':{'name':_0x26ad3e,'userProfileId':_0x58d370[_0x56a9('0x51')]},'raw':!![]})['then'](function(_0x1ff42f){if(_0x1ff42f&&_0x1ff42f[_0x56a9('0x52')]===0x0){return db['UserProfileResource'][_0x56a9('0x4c')]({'name':_0x1986f2[_0x56a9('0x2c')],'resourceId':_0x1986f2['id'],'type':_0x1ff42f[_0x56a9('0x2c')],'sectionId':_0x1ff42f['id']},{})[_0x56a9('0x27')](function(){return _0x500656;});}else{return _0x500656;}})['catch'](function(_0x4938d6){logger[_0x56a9('0x2b')](_0x56a9('0x53'),_0x4938d6);throw _0x4938d6;});}return _0x500656;})[_0x56a9('0x27')](respondWithResult(_0x31aaf5,0xc9))[_0x56a9('0x4b')](handleError(_0x31aaf5,null));};exports[_0x56a9('0x26')]=function(_0xce9dc0,_0x798b4e){if(_0xce9dc0[_0x56a9('0x4d')]['id']){delete _0xce9dc0[_0x56a9('0x4d')]['id'];}return db[_0x56a9('0x2f')]['find']({'where':{'id':_0xce9dc0[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x798b4e,null))[_0x56a9('0x27')](saveUpdates(_0xce9dc0[_0x56a9('0x4d')],null))[_0x56a9('0x27')](respondWithResult(_0x798b4e,null))[_0x56a9('0x4b')](handleError(_0x798b4e,null));};exports[_0x56a9('0x28')]=function(_0x488577,_0x870aa5){return db[_0x56a9('0x2f')][_0x56a9('0x4a')]({'where':{'id':_0x488577[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x870aa5,null))[_0x56a9('0x27')](db[_0x56a9('0x55')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x488577[_0x56a9('0x54')]['id']}}))['then'](removeEntity(_0x870aa5,null))['catch'](handleError(_0x870aa5,null));}; \ No newline at end of file +var _0x7708=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','send','index','map','ContactItemType','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x7708,0x188));var _0x8770=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7708[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){var _0x460474=_0x4274dd['get']({'plain':!![]});var _0x7b4755=_0x8770('0x23');return db[_0x8770('0x24')][_0x8770('0x22')]({'where':{'type':_0x7b4755,'resourceId':_0x460474['id']}})[_0x8770('0x21')](function(){return _0x4274dd;});})[_0x8770('0x21')](function(){_0x468fc0[_0x8770('0x17')](0xcc)[_0x8770('0x18')]();});}};}function handleEntityNotFound(_0xb3f4aa,_0xa480){return function(_0x5f4973){if(!_0x5f4973){_0xb3f4aa[_0x8770('0x16')](0x194);}return _0x5f4973;};}function handleError(_0x199b96,_0x1df627){_0x1df627=_0x1df627||0x1f4;return function(_0x5c7bd){logger[_0x8770('0x25')](_0x5c7bd[_0x8770('0x26')]);if(_0x5c7bd['name']){delete _0x5c7bd['name'];}_0x199b96[_0x8770('0x17')](_0x1df627)[_0x8770('0x27')](_0x5c7bd);};}exports[_0x8770('0x28')]=function(_0x365080,_0x23f4b0){var _0x4bc072={},_0x5282dd={},_0x45fff4={'count':0x0,'rows':[]};var _0x144c24=_[_0x8770('0x29')](db[_0x8770('0x2a')]['rawAttributes'],function(_0x2f4e44){return{'name':_0x2f4e44['fieldName'],'type':_0x2f4e44['type'][_0x8770('0x2b')]};});_0x5282dd['model']=_[_0x8770('0x29')](_0x144c24,_0x8770('0x2c'));_0x5282dd[_0x8770('0x2d')]=_[_0x8770('0x2e')](_0x365080[_0x8770('0x2d')]);_0x5282dd[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],_0x5282dd[_0x8770('0x2d')]);_0x4bc072['attributes']=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],qs[_0x8770('0x32')](_0x365080['query']['fields']));_0x4bc072[_0x8770('0x33')]=_0x4bc072[_0x8770('0x33')][_0x8770('0x34')]?_0x4bc072['attributes']:_0x5282dd[_0x8770('0x31')];if(!_0x365080['query'][_0x8770('0x35')](_0x8770('0x36'))){_0x4bc072[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x365080[_0x8770('0x2d')][_0x8770('0x1c')]);_0x4bc072[_0x8770('0x1a')]=qs[_0x8770('0x1a')](_0x365080[_0x8770('0x2d')][_0x8770('0x1a')]);}_0x4bc072['order']=qs[_0x8770('0x37')](_0x365080[_0x8770('0x2d')][_0x8770('0x37')]);_0x4bc072['where']=qs[_0x8770('0x2f')](_[_0x8770('0x38')](_0x365080[_0x8770('0x2d')],_0x5282dd[_0x8770('0x2f')]),_0x144c24);if(_0x365080[_0x8770('0x2d')][_0x8770('0x39')]){_0x4bc072['where']=_[_0x8770('0x3a')](_0x4bc072['where'],{'$or':_[_0x8770('0x29')](_0x144c24,function(_0x57f52e){if(_0x57f52e[_0x8770('0x3b')]!==_0x8770('0x3c')){var _0x306142={};_0x306142[_0x57f52e['name']]={'$like':'%'+_0x365080[_0x8770('0x2d')][_0x8770('0x39')]+'%'};return _0x306142;}})});}_0x4bc072=_[_0x8770('0x3a')]({},_0x4bc072,_0x365080[_0x8770('0x3d')]);var _0x408e86={'where':_0x4bc072[_0x8770('0x3e')]};return db['ContactItemType'][_0x8770('0x1b')](_0x408e86)['then'](function(_0x4bcfc7){_0x45fff4[_0x8770('0x1b')]=_0x4bcfc7;if(_0x365080[_0x8770('0x2d')][_0x8770('0x3f')]){_0x4bc072[_0x8770('0x40')]=[{'all':!![]}];}return db[_0x8770('0x2a')]['findAll'](_0x4bc072);})[_0x8770('0x21')](function(_0x26ae1b){_0x45fff4['rows']=_0x26ae1b;return _0x45fff4;})[_0x8770('0x21')](respondWithFilteredResult(_0x23f4b0,_0x4bc072))['catch'](handleError(_0x23f4b0,null));};exports[_0x8770('0x41')]=function(_0x6bfa55,_0xc29c65){var _0x39c0d3={'raw':!![],'where':{'id':_0x6bfa55[_0x8770('0x42')]['id']}},_0x29dae5={};_0x29dae5[_0x8770('0x31')]=_[_0x8770('0x2e')](db[_0x8770('0x2a')][_0x8770('0x43')]);_0x29dae5[_0x8770('0x2d')]=_['keys'](_0x6bfa55[_0x8770('0x2d')]);_0x29dae5[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x29dae5[_0x8770('0x31')],_0x29dae5[_0x8770('0x2d')]);_0x39c0d3[_0x8770('0x33')]=_['intersection'](_0x29dae5[_0x8770('0x31')],qs[_0x8770('0x32')](_0x6bfa55[_0x8770('0x2d')][_0x8770('0x32')]));_0x39c0d3[_0x8770('0x33')]=_0x39c0d3[_0x8770('0x33')][_0x8770('0x34')]?_0x39c0d3[_0x8770('0x33')]:_0x29dae5['model'];if(_0x6bfa55[_0x8770('0x2d')][_0x8770('0x3f')]){_0x39c0d3[_0x8770('0x40')]=[{'all':!![]}];}_0x39c0d3=_[_0x8770('0x3a')]({},_0x39c0d3,_0x6bfa55[_0x8770('0x3d')]);return db['ContactItemType']['find'](_0x39c0d3)[_0x8770('0x21')](handleEntityNotFound(_0xc29c65,null))['then'](respondWithResult(_0xc29c65,null))[_0x8770('0x44')](handleError(_0xc29c65,null));};exports['create']=function(_0x4f9e0b,_0x3805d8){return db[_0x8770('0x2a')][_0x8770('0x45')](_0x4f9e0b[_0x8770('0x46')],{})['then'](function(_0x136cc1){var _0x48dea0=_0x4f9e0b['user']['get']({'plain':!![]});if(!_0x48dea0)throw new Error(_0x8770('0x47'));if(_0x48dea0[_0x8770('0x48')]===_0x8770('0x49')){var _0x4f5cb8=_0x136cc1[_0x8770('0x4a')]({'plain':!![]});var _0x5b6638=_0x8770('0x23');return db[_0x8770('0x4b')][_0x8770('0x4c')]({'where':{'name':_0x5b6638,'userProfileId':_0x48dea0['userProfileId']},'raw':!![]})[_0x8770('0x21')](function(_0x5de11e){if(_0x5de11e&&_0x5de11e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8770('0x45')]({'name':_0x4f5cb8[_0x8770('0x2c')],'resourceId':_0x4f5cb8['id'],'type':_0x5de11e[_0x8770('0x2c')],'sectionId':_0x5de11e['id']},{})[_0x8770('0x21')](function(){return _0x136cc1;});}else{return _0x136cc1;}})[_0x8770('0x44')](function(_0x1df5cd){logger['error'](_0x8770('0x4d'),_0x1df5cd);throw _0x1df5cd;});}return _0x136cc1;})['then'](respondWithResult(_0x3805d8,0xc9))[_0x8770('0x44')](handleError(_0x3805d8,null));};exports[_0x8770('0x20')]=function(_0x475e9d,_0x3e4f77){if(_0x475e9d['body']['id']){delete _0x475e9d[_0x8770('0x46')]['id'];}return db[_0x8770('0x2a')]['find']({'where':{'id':_0x475e9d['params']['id']}})['then'](handleEntityNotFound(_0x3e4f77,null))['then'](saveUpdates(_0x475e9d[_0x8770('0x46')],null))[_0x8770('0x21')](respondWithResult(_0x3e4f77,null))['catch'](handleError(_0x3e4f77,null));};exports[_0x8770('0x22')]=function(_0x38b68f,_0x435c23){return db[_0x8770('0x2a')][_0x8770('0x4c')]({'where':{'id':_0x38b68f[_0x8770('0x42')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x435c23,null))[_0x8770('0x21')](db[_0x8770('0x4e')][_0x8770('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x38b68f[_0x8770('0x42')]['id']}}))['then'](removeEntity(_0x435c23,null))[_0x8770('0x44')](handleError(_0x435c23,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d40dece..1193625 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 _0xd677=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1f9027,_0x2329df){var _0x51028a=function(_0x37dc52){while(--_0x37dc52){_0x1f9027['push'](_0x1f9027['shift']());}};_0x51028a(++_0x2329df);}(_0xd677,0x1cd));var _0x7d67=function(_0x40b0f,_0x3783e5){_0x40b0f=_0x40b0f-0x0;var _0x39a923=_0xd677[_0x40b0f];return _0x39a923;};'use strict';var _=require(_0x7d67('0x0'));var util=require(_0x7d67('0x1'));var logger=require(_0x7d67('0x2'))(_0x7d67('0x3'));var moment=require(_0x7d67('0x4'));var BPromise=require(_0x7d67('0x5'));var rp=require(_0x7d67('0x6'));var fs=require('fs');var path=require(_0x7d67('0x7'));var rimraf=require(_0x7d67('0x8'));var config=require(_0x7d67('0x9'));var attributes=require(_0x7d67('0xa'));module[_0x7d67('0xb')]=function(_0x254742,_0x5c7b6e){return _0x254742['define']('ContactItemType',attributes,{'tableName':_0x7d67('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1af6=['exports','define','ContactItemType','lodash','../../config/logger','api','request-promise','path','../../config/environment','./contactItemType.attributes'];(function(_0x46ab1a,_0x1b5cb2){var _0x4a0afd=function(_0xc7746f){while(--_0xc7746f){_0x46ab1a['push'](_0x46ab1a['shift']());}};_0x4a0afd(++_0x1b5cb2);}(_0x1af6,0x1ed));var _0x61af=function(_0x1fffeb,_0x1347b0){_0x1fffeb=_0x1fffeb-0x0;var _0x37b8c6=_0x1af6[_0x1fffeb];return _0x37b8c6;};'use strict';var _=require(_0x61af('0x0'));var util=require('util');var logger=require(_0x61af('0x1'))(_0x61af('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x61af('0x3'));var fs=require('fs');var path=require(_0x61af('0x4'));var rimraf=require('rimraf');var config=require(_0x61af('0x5'));var attributes=require(_0x61af('0x6'));module[_0x61af('0x7')]=function(_0x326c00,_0x477ea5){return _0x326c00[_0x61af('0x8')](_0x61af('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 6598e63..cad52df 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 _0x0db9=['code','message','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59f4b4,_0xb53668){var _0x4dcb83=function(_0x1b9f6){while(--_0x1b9f6){_0x59f4b4['push'](_0x59f4b4['shift']());}};_0x4dcb83(++_0xb53668);}(_0x0db9,0xa3));var _0x90db=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x0db9[_0x3bab09];return _0x164376;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90db('0x1'));var fs=require('fs');var Redis=require(_0x90db('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90db('0x3'));var logger=require('../../config/logger')(_0x90db('0x4'));var config=require(_0x90db('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90db('0x6')][_0x90db('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x476491,_0xee21f8,_0x915ca){return new BPromise(function(_0x9b6d0d,_0x4b0c1d){return client[_0x90db('0x8')](_0x476491,_0x915ca)[_0x90db('0x9')](function(_0x39512e){logger[_0x90db('0xa')](_0x90db('0xb'),_0xee21f8,_0x90db('0xc'));logger[_0x90db('0xd')](_0x90db('0xe'),_0xee21f8,_0x90db('0xc'),JSON[_0x90db('0xf')](_0x39512e));if(_0x39512e[_0x90db('0x10')]){if(_0x39512e['error'][_0x90db('0x11')]===0x1f4){logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);return _0x4b0c1d(_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);}logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);return _0x9b6d0d(_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);}else{logger[_0x90db('0xa')]('ContactItemType,\x20%s,\x20%s',_0xee21f8,_0x90db('0xc'));_0x9b6d0d(_0x39512e['result'][_0x90db('0x12')]);}})[_0x90db('0x13')](function(_0x3de860){logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x3de860);_0x4b0c1d(_0x3de860);});});} \ No newline at end of file +var _0x5761=['util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x5761,0x107));var _0x1576=function(_0x349b17,_0x567df3){_0x349b17=_0x349b17-0x0;var _0x3a42b0=_0x5761[_0x349b17];return _0x3a42b0;};'use strict';var _=require(_0x1576('0x0'));var util=require(_0x1576('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1576('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1576('0x3'))['db'];var utils=require(_0x1576('0x4'));var logger=require(_0x1576('0x5'))(_0x1576('0x6'));var config=require(_0x1576('0x7'));var jayson=require(_0x1576('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30f503,_0x21d3bd,_0x229cee){return new BPromise(function(_0x1f814b,_0x5ab69b){return client[_0x1576('0x9')](_0x30f503,_0x229cee)[_0x1576('0xa')](function(_0x561917){logger[_0x1576('0xb')]('ContactItemType,\x20%s,\x20%s',_0x21d3bd,'request\x20sent');logger[_0x1576('0xc')](_0x1576('0xd'),_0x21d3bd,_0x1576('0xe'),JSON[_0x1576('0xf')](_0x561917));if(_0x561917[_0x1576('0x10')]){if(_0x561917['error'][_0x1576('0x11')]===0x1f4){logger['error'](_0x1576('0x12'),_0x21d3bd,_0x561917[_0x1576('0x10')][_0x1576('0x13')]);return _0x5ab69b(_0x561917[_0x1576('0x10')][_0x1576('0x13')]);}logger[_0x1576('0x10')](_0x1576('0x12'),_0x21d3bd,_0x561917[_0x1576('0x10')][_0x1576('0x13')]);return _0x1f814b(_0x561917['error'][_0x1576('0x13')]);}else{logger['info'](_0x1576('0x12'),_0x21d3bd,_0x1576('0xe'));_0x1f814b(_0x561917[_0x1576('0x14')][_0x1576('0x13')]);}})[_0x1576('0x15')](function(_0x288749){logger['error'](_0x1576('0x12'),_0x21d3bd,_0x288749);_0x5ab69b(_0x288749);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index c0f80bc..9d1b261 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 _0x45e4=['delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x118d56,_0x482e84){var _0x20ec02=function(_0x1d069a){while(--_0x1d069a){_0x118d56['push'](_0x118d56['shift']());}};_0x20ec02(++_0x482e84);}(_0x45e4,0x18e));var _0x445e=function(_0x5f2637,_0x1eec28){_0x5f2637=_0x5f2637-0x0;var _0x4c1c9d=_0x45e4[_0x5f2637];return _0x4c1c9d;};'use strict';var multer=require(_0x445e('0x0'));var util=require(_0x445e('0x1'));var path=require(_0x445e('0x2'));var timeout=require('connect-timeout');var express=require(_0x445e('0x3'));var router=express[_0x445e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x445e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x445e('0x6'));var controller=require(_0x445e('0x7'));router[_0x445e('0x8')]('/',auth[_0x445e('0x9')](),controller[_0x445e('0xa')]);router['get'](_0x445e('0xb'),auth['isAuthenticated'](),controller[_0x445e('0xc')]);router[_0x445e('0xd')]('/',auth[_0x445e('0x9')](),controller[_0x445e('0xe')]);router['put'](_0x445e('0xb'),auth[_0x445e('0x9')](),controller[_0x445e('0xf')]);router[_0x445e('0x10')](_0x445e('0xb'),auth[_0x445e('0x9')](),controller['destroy']);module[_0x445e('0x11')]=router; \ No newline at end of file +var _0xcb6e=['show','post','create','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id'];(function(_0x35cf53,_0x2a8e36){var _0x1b3ace=function(_0x3c3c1e){while(--_0x3c3c1e){_0x35cf53['push'](_0x35cf53['shift']());}};_0x1b3ace(++_0x2a8e36);}(_0xcb6e,0xb1));var _0xecb6=function(_0x4d52f5,_0x412544){_0x4d52f5=_0x4d52f5-0x0;var _0x5bd5e5=_0xcb6e[_0x4d52f5];return _0x5bd5e5;};'use strict';var multer=require(_0xecb6('0x0'));var util=require(_0xecb6('0x1'));var path=require(_0xecb6('0x2'));var timeout=require('connect-timeout');var express=require(_0xecb6('0x3'));var router=express['Router']();var fs_extra=require(_0xecb6('0x4'));var auth=require(_0xecb6('0x5'));var interaction=require(_0xecb6('0x6'));var config=require(_0xecb6('0x7'));var controller=require(_0xecb6('0x8'));router[_0xecb6('0x9')]('/',auth[_0xecb6('0xa')](),controller[_0xecb6('0xb')]);router['get'](_0xecb6('0xc'),auth[_0xecb6('0xa')](),controller[_0xecb6('0xd')]);router[_0xecb6('0xe')]('/',auth[_0xecb6('0xa')](),controller[_0xecb6('0xf')]);router['put'](_0xecb6('0xc'),auth['isAuthenticated'](),controller[_0xecb6('0x10')]);router['delete'](_0xecb6('0xc'),auth[_0xecb6('0xa')](),controller[_0xecb6('0x11')]);module[_0xecb6('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 f388491..7975e81 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 _0xb10b=['name','sequelize','STRING'];(function(_0x19e484,_0x4a4ef2){var _0x197afc=function(_0x191176){while(--_0x191176){_0x19e484['push'](_0x19e484['shift']());}};_0x197afc(++_0x4a4ef2);}(_0xb10b,0x12a));var _0xbb10=function(_0x37affd,_0x53e54d){_0x37affd=_0x37affd-0x0;var _0x5c385a=_0xb10b[_0x37affd];return _0x5c385a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x51664c,_0x35016b){var _0x431f7d=function(_0x3bd31e){while(--_0x3bd31e){_0x51664c['push'](_0x51664c['shift']());}};_0x431f7d(++_0x35016b);}(_0xb10b,0x12a));var _0xbb10=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0xb10b[_0xd58823];return _0x249c0a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4a84ae2..aac1fcb 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 _0xbac5=['attrSerie3','attrVoiceQueues','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','pick','filter','getItems','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','defaults','redis','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','options','includeAll','findAll','rows','catch','show','include','create','body','user','role','CustomDashboards','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','type','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2'];(function(_0x1f9c6c,_0x5307ea){var _0x3a0c7f=function(_0x78bfa9){while(--_0x78bfa9){_0x1f9c6c['push'](_0x1f9c6c['shift']());}};_0x3a0c7f(++_0x5307ea);}(_0xbac5,0x8c));var _0x5bac=function(_0x299cde,_0x13b449){_0x299cde=_0x299cde-0x0;var _0x54981b=_0xbac5[_0x299cde];return _0x54981b;};'use strict';var emlformat=require(_0x5bac('0x0'));var rimraf=require(_0x5bac('0x1'));var zipdir=require(_0x5bac('0x2'));var jsonpatch=require(_0x5bac('0x3'));var rp=require('request-promise');var moment=require(_0x5bac('0x4'));var BPromise=require(_0x5bac('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5bac('0x6'));var sox=require(_0x5bac('0x7'));var csv=require(_0x5bac('0x8'));var ejs=require(_0x5bac('0x9'));var fs=require('fs');var fs_extra=require(_0x5bac('0xa'));var _=require(_0x5bac('0xb'));var squel=require('squel');var crypto=require(_0x5bac('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5bac('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5bac('0xe'));var Redis=require(_0x5bac('0xf'));var authService=require(_0x5bac('0x10'));var qs=require(_0x5bac('0x11'));var as=require(_0x5bac('0x12'));var hardwareService=require(_0x5bac('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x5bac('0x14')](config[_0x5bac('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bac('0x15')]));require(_0x5bac('0x16'))[_0x5bac('0x17')](socket);function respondWithStatusCode(_0x55fc0c,_0x2d22c5){_0x2d22c5=_0x2d22c5||0xcc;return function(_0x3a9ba6){if(_0x3a9ba6){return _0x55fc0c[_0x5bac('0x18')](_0x2d22c5);}return _0x55fc0c['status'](_0x2d22c5)[_0x5bac('0x19')]();};}function respondWithResult(_0x525552,_0x329f18){_0x329f18=_0x329f18||0xc8;return function(_0x9c0629){if(_0x9c0629){return _0x525552[_0x5bac('0x1a')](_0x329f18)[_0x5bac('0x1b')](_0x9c0629);}};}function respondWithFilteredResult(_0x6ac73c,_0x127430){return function(_0x55f2d8){if(_0x55f2d8){var _0x57c6d3=typeof _0x127430[_0x5bac('0x1c')]===_0x5bac('0x1d')&&typeof _0x127430[_0x5bac('0x1e')]===_0x5bac('0x1d');var _0x21c290=_0x55f2d8[_0x5bac('0x1f')];var _0x1e806e=_0x57c6d3?0x0:_0x127430[_0x5bac('0x1c')];var _0x2456d8=_0x57c6d3?_0x55f2d8['count']:_0x127430[_0x5bac('0x1c')]+_0x127430['limit'];var _0x4cc3f4;if(_0x2456d8>=_0x21c290){_0x2456d8=_0x21c290;_0x4cc3f4=0xc8;}else{_0x4cc3f4=0xce;}_0x6ac73c[_0x5bac('0x1a')](_0x4cc3f4);return _0x6ac73c['set'](_0x5bac('0x20'),_0x1e806e+'-'+_0x2456d8+'/'+_0x21c290)[_0x5bac('0x1b')](_0x55f2d8);}return null;};}function patchUpdates(_0x5ee599){return function(_0x4427a3){try{jsonpatch[_0x5bac('0x21')](_0x4427a3,_0x5ee599,!![]);}catch(_0x4262e2){return BPromise[_0x5bac('0x22')](_0x4262e2);}return _0x4427a3['save']();};}function saveUpdates(_0xb864a0,_0x11bcfb){return function(_0x309152){if(_0x309152){return _0x309152[_0x5bac('0x23')](_0xb864a0)[_0x5bac('0x24')](function(_0x3f50f4){return _0x3f50f4;});}return null;};}function removeEntity(_0x3c2ba3,_0x2b48af){return function(_0x466407){if(_0x466407){return _0x466407[_0x5bac('0x25')]()[_0x5bac('0x24')](function(){var _0x2198f1=_0x466407[_0x5bac('0x26')]({'plain':!![]});var _0x4d5805='CustomDashboards';return db[_0x5bac('0x27')][_0x5bac('0x25')]({'where':{'type':_0x4d5805,'resourceId':_0x2198f1['id']}})[_0x5bac('0x24')](function(){return _0x466407;});})[_0x5bac('0x24')](function(){_0x3c2ba3[_0x5bac('0x1a')](0xcc)[_0x5bac('0x19')]();});}};}function handleEntityNotFound(_0x1eaf85,_0x37b9a5){return function(_0x4d18fb){if(!_0x4d18fb){_0x1eaf85[_0x5bac('0x18')](0x194);}return _0x4d18fb;};}function handleError(_0x3d1c0f,_0x16a535){_0x16a535=_0x16a535||0x1f4;return function(_0x1a0c48){logger[_0x5bac('0x28')](_0x1a0c48[_0x5bac('0x29')]);if(_0x1a0c48[_0x5bac('0x2a')]){delete _0x1a0c48['name'];}_0x3d1c0f[_0x5bac('0x1a')](_0x16a535)[_0x5bac('0x2b')](_0x1a0c48);};}exports[_0x5bac('0x2c')]=function(_0x36ef66,_0x3dea63){var _0x4eab71={},_0x554101={},_0x406639={'count':0x0,'rows':[]};var _0x764082=_[_0x5bac('0x2d')](db[_0x5bac('0x2e')][_0x5bac('0x2f')],function(_0x64849d){return{'name':_0x64849d[_0x5bac('0x30')],'type':_0x64849d['type'][_0x5bac('0x31')]};});_0x554101[_0x5bac('0x32')]=_[_0x5bac('0x2d')](_0x764082,_0x5bac('0x2a'));_0x554101[_0x5bac('0x33')]=_[_0x5bac('0x34')](_0x36ef66[_0x5bac('0x33')]);_0x554101[_0x5bac('0x35')]=_[_0x5bac('0x36')](_0x554101[_0x5bac('0x32')],_0x554101[_0x5bac('0x33')]);_0x4eab71[_0x5bac('0x37')]=_[_0x5bac('0x36')](_0x554101[_0x5bac('0x32')],qs[_0x5bac('0x38')](_0x36ef66[_0x5bac('0x33')][_0x5bac('0x38')]));_0x4eab71['attributes']=_0x4eab71[_0x5bac('0x37')][_0x5bac('0x39')]?_0x4eab71[_0x5bac('0x37')]:_0x554101[_0x5bac('0x32')];if(!_0x36ef66[_0x5bac('0x33')]['hasOwnProperty'](_0x5bac('0x3a'))){_0x4eab71['limit']=qs[_0x5bac('0x1e')](_0x36ef66[_0x5bac('0x33')][_0x5bac('0x1e')]);_0x4eab71[_0x5bac('0x1c')]=qs[_0x5bac('0x1c')](_0x36ef66[_0x5bac('0x33')][_0x5bac('0x1c')]);}_0x4eab71[_0x5bac('0x3b')]=qs[_0x5bac('0x3c')](_0x36ef66['query'][_0x5bac('0x3c')]);_0x4eab71['where']=qs[_0x5bac('0x35')](_['pick'](_0x36ef66[_0x5bac('0x33')],_0x554101[_0x5bac('0x35')]),_0x764082);if(_0x36ef66['query']['filter']){_0x4eab71[_0x5bac('0x3d')]=_[_0x5bac('0x3e')](_0x4eab71['where'],{'$or':_[_0x5bac('0x2d')](_0x764082,function(_0x1fff6c){if(_0x1fff6c['type']!=='VIRTUAL'){var _0x13b659={};_0x13b659[_0x1fff6c[_0x5bac('0x2a')]]={'$like':'%'+_0x36ef66[_0x5bac('0x33')]['filter']+'%'};return _0x13b659;}})});}_0x4eab71=_[_0x5bac('0x3e')]({},_0x4eab71,_0x36ef66[_0x5bac('0x3f')]);var _0x4d186e={'where':_0x4eab71[_0x5bac('0x3d')]};return db[_0x5bac('0x2e')][_0x5bac('0x1f')](_0x4d186e)[_0x5bac('0x24')](function(_0x47a53e){_0x406639['count']=_0x47a53e;if(_0x36ef66[_0x5bac('0x33')][_0x5bac('0x40')]){_0x4eab71['include']=[{'all':!![]}];}return db[_0x5bac('0x2e')][_0x5bac('0x41')](_0x4eab71);})[_0x5bac('0x24')](function(_0x52518b){_0x406639[_0x5bac('0x42')]=_0x52518b;return _0x406639;})[_0x5bac('0x24')](respondWithFilteredResult(_0x3dea63,_0x4eab71))[_0x5bac('0x43')](handleError(_0x3dea63,null));};exports[_0x5bac('0x44')]=function(_0x24ac85,_0x28de9d){var _0x20ade7={'raw':![],'where':{'id':_0x24ac85['params']['id']}},_0x473508={};_0x473508[_0x5bac('0x32')]=_[_0x5bac('0x34')](db[_0x5bac('0x2e')][_0x5bac('0x2f')]);_0x473508[_0x5bac('0x33')]=_[_0x5bac('0x34')](_0x24ac85[_0x5bac('0x33')]);_0x473508[_0x5bac('0x35')]=_[_0x5bac('0x36')](_0x473508[_0x5bac('0x32')],_0x473508[_0x5bac('0x33')]);_0x20ade7[_0x5bac('0x37')]=_[_0x5bac('0x36')](_0x473508['model'],qs[_0x5bac('0x38')](_0x24ac85[_0x5bac('0x33')][_0x5bac('0x38')]));_0x20ade7[_0x5bac('0x37')]=_0x20ade7[_0x5bac('0x37')]['length']?_0x20ade7[_0x5bac('0x37')]:_0x473508[_0x5bac('0x32')];if(_0x24ac85['query'][_0x5bac('0x40')]){_0x20ade7[_0x5bac('0x45')]=[{'all':!![]}];}_0x20ade7=_[_0x5bac('0x3e')]({},_0x20ade7,_0x24ac85[_0x5bac('0x3f')]);return db[_0x5bac('0x2e')]['find'](_0x20ade7)[_0x5bac('0x24')](handleEntityNotFound(_0x28de9d,null))[_0x5bac('0x24')](respondWithResult(_0x28de9d,null))[_0x5bac('0x43')](handleError(_0x28de9d,null));};exports['create']=function(_0x3ec3b7,_0x506192){return db[_0x5bac('0x2e')][_0x5bac('0x46')](_0x3ec3b7[_0x5bac('0x47')],{})[_0x5bac('0x24')](function(_0x59932b){var _0xf0a2d=_0x3ec3b7[_0x5bac('0x48')][_0x5bac('0x26')]({'plain':!![]});if(!_0xf0a2d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf0a2d[_0x5bac('0x49')]===_0x5bac('0x48')){var _0x5a2ded=_0x59932b[_0x5bac('0x26')]({'plain':!![]});var _0x1e3394=_0x5bac('0x4a');return db[_0x5bac('0x4b')]['find']({'where':{'name':_0x1e3394,'userProfileId':_0xf0a2d['userProfileId']},'raw':!![]})['then'](function(_0x4672e9){if(_0x4672e9&&_0x4672e9['autoAssociation']===0x0){return db[_0x5bac('0x27')][_0x5bac('0x46')]({'name':_0x5a2ded['name'],'resourceId':_0x5a2ded['id'],'type':_0x4672e9[_0x5bac('0x2a')],'sectionId':_0x4672e9['id']},{})[_0x5bac('0x24')](function(){return _0x59932b;});}else{return _0x59932b;}})[_0x5bac('0x43')](function(_0x5b89ab){logger[_0x5bac('0x28')](_0x5bac('0x4c'),_0x5b89ab);throw _0x5b89ab;});}return _0x59932b;})['then'](respondWithResult(_0x506192,0xc9))['catch'](handleError(_0x506192,null));};exports[_0x5bac('0x4d')]=function(_0x27dfa8,_0x42033){var _0x574990={'where':{'id':_0x27dfa8[_0x5bac('0x4e')]['id']}},_0x3faf71={};_0x3faf71[_0x5bac('0x32')]=_[_0x5bac('0x34')](db[_0x5bac('0x2e')][_0x5bac('0x2f')]);_0x574990[_0x5bac('0x37')]=_['intersection'](_0x3faf71[_0x5bac('0x32')],qs[_0x5bac('0x38')](_0x27dfa8[_0x5bac('0x33')][_0x5bac('0x38')]));_0x574990[_0x5bac('0x37')]=_0x574990['attributes'][_0x5bac('0x39')]?_0x574990[_0x5bac('0x37')]:_0x3faf71[_0x5bac('0x32')];if(_0x27dfa8[_0x5bac('0x33')][_0x5bac('0x40')]){_0x574990[_0x5bac('0x45')]=[{'all':!![]}];}_0x574990=_['merge']({},_0x574990,_0x27dfa8[_0x5bac('0x3f')]);return db['Dashboard']['find'](_0x574990)[_0x5bac('0x24')](handleEntityNotFound(_0x42033,null))[_0x5bac('0x24')](function(_0x575c0a){if(_0x575c0a){var _0xab7444=_0x575c0a['get']({'plain':!![]});_0xab7444=qs[_0x5bac('0x4f')](_0xab7444,['id','createdAt','updatedAt']);_0x27dfa8[_0x5bac('0x47')]=_['omit'](_0x27dfa8[_0x5bac('0x47')],['id',_0x5bac('0x50'),_0x5bac('0x51')]);return db[_0x5bac('0x2e')][_0x5bac('0x46')](_[_0x5bac('0x3e')](_0xab7444,_0x27dfa8[_0x5bac('0x47')]),{'include':_0x27dfa8[_0x5bac('0x33')][_0x5bac('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x256b80){var _0x4ea14a=_0x27dfa8[_0x5bac('0x48')][_0x5bac('0x26')]({'plain':!![]});if(!_0x4ea14a)throw new Error(_0x5bac('0x52'));if(_0x4ea14a[_0x5bac('0x49')]==='user'){var _0x4e462e=_0x256b80[_0x5bac('0x26')]({'plain':!![]});var _0x3b8b37=_0x5bac('0x4a');return db[_0x5bac('0x4b')][_0x5bac('0x53')]({'where':{'name':_0x3b8b37,'userProfileId':_0x4ea14a[_0x5bac('0x54')]},'raw':!![]})['then'](function(_0x5381b5){if(_0x5381b5&&_0x5381b5[_0x5bac('0x55')]===0x0){return db[_0x5bac('0x27')][_0x5bac('0x46')]({'name':_0x4e462e[_0x5bac('0x2a')],'resourceId':_0x4e462e['id'],'type':_0x5381b5[_0x5bac('0x2a')],'sectionId':_0x5381b5['id']},{})[_0x5bac('0x24')](function(){return _0x256b80;});}else{return _0x256b80;}})['catch'](function(_0x1604e8){logger[_0x5bac('0x28')](_0x5bac('0x4c'),_0x1604e8);throw _0x1604e8;});}return _0x256b80;});}})[_0x5bac('0x24')](respondWithResult(_0x42033,0xc9))['catch'](handleError(_0x42033,null));};exports['update']=function(_0x5f1203,_0x2dff5c){if(_0x5f1203[_0x5bac('0x47')]['id']){delete _0x5f1203[_0x5bac('0x47')]['id'];}return db[_0x5bac('0x2e')][_0x5bac('0x53')]({'where':{'id':_0x5f1203['params']['id']}})['then'](handleEntityNotFound(_0x2dff5c,null))[_0x5bac('0x24')](saveUpdates(_0x5f1203['body'],null))[_0x5bac('0x24')](respondWithResult(_0x2dff5c,null))['catch'](handleError(_0x2dff5c,null));};exports[_0x5bac('0x25')]=function(_0x5ae5d8,_0x5e0a4c){return db[_0x5bac('0x2e')][_0x5bac('0x53')]({'where':{'id':_0x5ae5d8[_0x5bac('0x4e')]['id']}})[_0x5bac('0x24')](handleEntityNotFound(_0x5e0a4c,null))['then'](removeEntity(_0x5e0a4c,null))[_0x5bac('0x43')](handleError(_0x5e0a4c,null));};function widgetAttributes(_0x56719e){try{switch(_0x56719e[_0x5bac('0x56')]){case'iframe':return[{'name':_0x5bac('0x57'),'value':_0x56719e[_0x5bac('0x57')]||(_0x56719e['attrs']&&_0x56719e[_0x5bac('0x58')][0x0]?_0x56719e[_0x5bac('0x58')][0x0][_0x5bac('0x59')]:undefined)||_0x5bac('0x5a')}];case _0x5bac('0x5b'):return[{'name':_0x5bac('0x5c'),'value':_0x56719e['attrPath']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x0]?_0x56719e[_0x5bac('0x58')][0x0][_0x5bac('0x59')]:undefined)||''}];case _0x5bac('0x5d'):return[{'name':'attrHourFormat','value':_0x56719e['attrHourFormat']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x0]?_0x56719e['attrs'][0x0][_0x5bac('0x59')]:undefined)||_0x5bac('0x5e')},{'name':_0x5bac('0x5f'),'value':_0x56719e[_0x5bac('0x5f')]||(_0x56719e['attrs']&&_0x56719e['attrs'][0x1]?_0x56719e[_0x5bac('0x58')][0x1]['value']:undefined)||_0x5bac('0x60')},{'name':'attrFontSize','value':_0x56719e[_0x5bac('0x61')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x2]?_0x56719e['attrs'][0x2][_0x5bac('0x59')]:undefined)||0xc}];case _0x5bac('0x62'):return[{'name':'attrMetric','value':_0x56719e['attrMetric']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x0]?_0x56719e['attrs'][0x0][_0x5bac('0x59')]:undefined)||_0x5bac('0x63')},{'name':'attrVoiceQueues','value':_0x56719e['attrVoiceQueues']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x1]?_0x56719e[_0x5bac('0x58')][0x1]['value']:undefined)||[]},{'name':_0x5bac('0x61'),'value':_0x56719e[_0x5bac('0x61')]||(_0x56719e['attrs']&&_0x56719e[_0x5bac('0x58')][0x2]?_0x56719e[_0x5bac('0x58')][0x2]['value']:undefined)||0x14},{'name':_0x5bac('0x64'),'value':_0x56719e[_0x5bac('0x64')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x3]?_0x56719e[_0x5bac('0x58')][0x3]['value']:undefined)||_0x5bac('0x65')},{'name':'attrEmailAccounts','value':_0x56719e[_0x5bac('0x66')]||(_0x56719e['attrs']&&_0x56719e[_0x5bac('0x58')][0x4]?_0x56719e['attrs'][0x4][_0x5bac('0x59')]:undefined)||''},{'name':_0x5bac('0x67'),'value':_0x56719e['attrFaxAccounts']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x5]?_0x56719e['attrs'][0x5][_0x5bac('0x59')]:undefined)||''},{'name':_0x5bac('0x68'),'value':_0x56719e[_0x5bac('0x68')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x6]?_0x56719e[_0x5bac('0x58')][0x6]['value']:undefined)||''},{'name':_0x5bac('0x69'),'value':_0x56719e[_0x5bac('0x69')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x7]?_0x56719e[_0x5bac('0x58')][0x7][_0x5bac('0x59')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x56719e[_0x5bac('0x6a')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e['attrs'][0x8]?_0x56719e[_0x5bac('0x58')][0x8]['value']:undefined)||''},{'name':_0x5bac('0x6b'),'value':_0x56719e[_0x5bac('0x6b')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e['attrs'][0x9]?_0x56719e[_0x5bac('0x58')][0x9][_0x5bac('0x59')]:undefined)||''}];case _0x5bac('0x6c'):case _0x5bac('0x6d'):return[{'name':_0x5bac('0x6e'),'value':_0x56719e[_0x5bac('0x6e')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x0]?_0x56719e[_0x5bac('0x58')][0x0][_0x5bac('0x59')]:undefined)||_0x5bac('0x63')},{'name':'attrSerie2','value':_0x56719e[_0x5bac('0x6f')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e['attrs'][0x1]?_0x56719e[_0x5bac('0x58')][0x1][_0x5bac('0x59')]:undefined)||null},{'name':_0x5bac('0x70'),'value':_0x56719e[_0x5bac('0x70')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x2]?_0x56719e[_0x5bac('0x58')][0x2]['value']:undefined)||null},{'name':_0x5bac('0x71'),'value':_0x56719e[_0x5bac('0x71')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x3]?_0x56719e[_0x5bac('0x58')][0x3][_0x5bac('0x59')]:undefined)||[]},{'name':'attrChannel','value':_0x56719e[_0x5bac('0x64')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e['attrs'][0x4]?_0x56719e[_0x5bac('0x58')][0x4]['value']:undefined)||_0x5bac('0x65')},{'name':_0x5bac('0x66'),'value':_0x56719e['attrEmailAccounts']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e['attrs'][0x5]?_0x56719e['attrs'][0x5][_0x5bac('0x59')]:undefined)||''},{'name':_0x5bac('0x67'),'value':_0x56719e['attrFaxAccounts']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x6]?_0x56719e[_0x5bac('0x58')][0x6][_0x5bac('0x59')]:undefined)||''},{'name':_0x5bac('0x68'),'value':_0x56719e['attrSmsAccounts']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e['attrs'][0x7]?_0x56719e[_0x5bac('0x58')][0x7][_0x5bac('0x59')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x56719e[_0x5bac('0x69')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x8]?_0x56719e[_0x5bac('0x58')][0x8][_0x5bac('0x59')]:undefined)||''},{'name':_0x5bac('0x6a'),'value':_0x56719e['attrWhatsappAccounts']||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x9]?_0x56719e[_0x5bac('0x58')][0x9]['value']:undefined)||''},{'name':_0x5bac('0x6b'),'value':_0x56719e[_0x5bac('0x6b')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0xa]?_0x56719e[_0x5bac('0x58')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x5bac('0x72'),'type':_0x56719e['reportType']||(_0x56719e['attrs']&&_0x56719e[_0x5bac('0x58')][0x0]?_0x56719e[_0x5bac('0x58')][0x0][_0x5bac('0x56')]:undefined)||null,'value':_0x56719e[_0x5bac('0x72')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x0]?_0x56719e['attrs'][0x0]['value']:undefined)||null},{'name':_0x5bac('0x73'),'value':_0x56719e[_0x5bac('0x73')]||(_0x56719e[_0x5bac('0x58')]&&_0x56719e[_0x5bac('0x58')][0x1]?_0x56719e[_0x5bac('0x58')][0x1][_0x5bac('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x11aaf6){logger[_0x5bac('0x28')](_0x5bac('0x74'),JSON[_0x5bac('0x75')](_0x11aaf6));return[];}}exports[_0x5bac('0x76')]=function(_0x222972,_0x4f61d4,_0x126c19){if(_0x222972[_0x5bac('0x47')]['id']){delete _0x222972[_0x5bac('0x47')]['id'];}return db[_0x5bac('0x2e')][_0x5bac('0x53')]({'where':{'id':_0x222972[_0x5bac('0x4e')]['id']}})[_0x5bac('0x24')](handleEntityNotFound(_0x4f61d4,null))[_0x5bac('0x24')](function(_0x4a2f3e){if(_0x4a2f3e){_0x222972[_0x5bac('0x47')][_0x5bac('0x77')]=_0x4a2f3e['id'];_0x222972[_0x5bac('0x47')][_0x5bac('0x58')]=widgetAttributes(_0x222972[_0x5bac('0x47')]);return db[_0x5bac('0x78')][_0x5bac('0x46')](_0x222972[_0x5bac('0x47')]);}})[_0x5bac('0x24')](respondWithResult(_0x4f61d4,null))[_0x5bac('0x43')](handleError(_0x4f61d4,null));};exports['getItems']=function(_0xb319c2,_0x3731cc,_0x745915){var _0xb89bdc={};var _0x3f1c86={};var _0x3b9a3e;var _0x2ba3b6;return db['Dashboard'][_0x5bac('0x79')]({'where':{'id':_0xb319c2[_0x5bac('0x4e')]['id']}})[_0x5bac('0x24')](handleEntityNotFound(_0x3731cc,null))[_0x5bac('0x24')](function(_0x261574){if(_0x261574){_0x3b9a3e=_0x261574;_0x3f1c86[_0x5bac('0x32')]=_[_0x5bac('0x34')](db[_0x5bac('0x78')][_0x5bac('0x2f')]);_0x3f1c86[_0x5bac('0x33')]=_[_0x5bac('0x34')](_0xb319c2[_0x5bac('0x33')]);_0x3f1c86[_0x5bac('0x35')]=_[_0x5bac('0x36')](_0x3f1c86[_0x5bac('0x32')],_0x3f1c86[_0x5bac('0x33')]);_0xb89bdc['attributes']=_[_0x5bac('0x36')](_0x3f1c86['model'],qs[_0x5bac('0x38')](_0xb319c2[_0x5bac('0x33')][_0x5bac('0x38')]));_0xb89bdc[_0x5bac('0x37')]=_0xb89bdc['attributes'][_0x5bac('0x39')]?_0xb89bdc[_0x5bac('0x37')]:_0x3f1c86[_0x5bac('0x32')];_0xb89bdc[_0x5bac('0x3b')]=qs[_0x5bac('0x3c')](_0xb319c2[_0x5bac('0x33')]['sort']);_0xb89bdc['where']=qs[_0x5bac('0x35')](_[_0x5bac('0x7a')](_0xb319c2[_0x5bac('0x33')],_0x3f1c86[_0x5bac('0x35')]));if(_0xb319c2[_0x5bac('0x33')][_0x5bac('0x7b')]){_0xb89bdc['where']=_[_0x5bac('0x3e')](_0xb89bdc[_0x5bac('0x3d')],{'$or':_[_0x5bac('0x2d')](_0xb89bdc[_0x5bac('0x37')],function(_0x229937){var _0x5ec7c8={};_0x5ec7c8[_0x229937]={'$like':'%'+_0xb319c2['query']['filter']+'%'};return _0x5ec7c8;})});}_0xb89bdc=_[_0x5bac('0x3e')]({},_0xb89bdc,_0xb319c2['options']);return _0x3b9a3e[_0x5bac('0x7c')](_0xb89bdc);}})[_0x5bac('0x24')](function(_0xb22376){if(_0xb22376){_0x2ba3b6=_0xb22376[_0x5bac('0x39')];if(!_0xb319c2[_0x5bac('0x33')][_0x5bac('0x7d')](_0x5bac('0x3a'))){_0xb89bdc[_0x5bac('0x1e')]=qs[_0x5bac('0x1e')](_0xb319c2[_0x5bac('0x33')][_0x5bac('0x1e')]);_0xb89bdc[_0x5bac('0x1c')]=qs['offset'](_0xb319c2['query'][_0x5bac('0x1c')]);}return _0x3b9a3e['getItems'](_0xb89bdc);}})['then'](function(_0x1b9a89){if(_0x1b9a89){return _0x1b9a89?{'count':_0x2ba3b6,'rows':_0x1b9a89}:null;}})[_0x5bac('0x24')](respondWithResult(_0x3731cc,null))['catch'](handleError(_0x3731cc,null));}; \ No newline at end of file +var _0xb2df=['../../config/license/util','redis','defaults','localhost','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','CustomDashboards','UserProfileResource','then','name','send','index','map','Dashboard','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','VIRTUAL','filter','includeAll','findAll','rows','catch','params','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','options','omit','updatedAt','createdAt','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrMetric','attrVoiceQueues','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0xb116ea,_0x573cd9){var _0x545eae=function(_0x38763d){while(--_0x38763d){_0xb116ea['push'](_0xb116ea['shift']());}};_0x545eae(++_0x573cd9);}(_0xb2df,0x65));var _0xfb2d=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb2df[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0xfb2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb2d('0x1'));var jsonpatch=require(_0xfb2d('0x2'));var rp=require(_0xfb2d('0x3'));var moment=require('moment');var BPromise=require(_0xfb2d('0x4'));var Mustache=require(_0xfb2d('0x5'));var util=require(_0xfb2d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfb2d('0x7'));var ejs=require(_0xfb2d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfb2d('0x9'));var deskjs=require(_0xfb2d('0xa'));var toCsv=require(_0xfb2d('0x7'));var querystring=require(_0xfb2d('0xb'));var Papa=require('papaparse');var Redis=require(_0xfb2d('0xc'));var authService=require(_0xfb2d('0xd'));var qs=require(_0xfb2d('0xe'));var as=require(_0xfb2d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb2d('0x10'));var utils=require(_0xfb2d('0x11'));var config=require(_0xfb2d('0x12'));var licenseUtil=require(_0xfb2d('0x13'));var db=require('../../mysqldb')['db'];config[_0xfb2d('0x14')]=_[_0xfb2d('0x15')](config[_0xfb2d('0x14')],{'host':_0xfb2d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfb2d('0x17'))[_0xfb2d('0x18')](socket);function respondWithStatusCode(_0x743f39,_0x5e8be4){_0x5e8be4=_0x5e8be4||0xcc;return function(_0x1d92d3){if(_0x1d92d3){return _0x743f39['sendStatus'](_0x5e8be4);}return _0x743f39[_0xfb2d('0x19')](_0x5e8be4)[_0xfb2d('0x1a')]();};}function respondWithResult(_0x5f4a19,_0x37693b){_0x37693b=_0x37693b||0xc8;return function(_0x3b4053){if(_0x3b4053){return _0x5f4a19['status'](_0x37693b)[_0xfb2d('0x1b')](_0x3b4053);}};}function respondWithFilteredResult(_0x30b9e4,_0x5f46aa){return function(_0x2f5af8){if(_0x2f5af8){var _0x150e8f=typeof _0x5f46aa[_0xfb2d('0x1c')]===_0xfb2d('0x1d')&&typeof _0x5f46aa[_0xfb2d('0x1e')]==='undefined';var _0x81f2f2=_0x2f5af8[_0xfb2d('0x1f')];var _0x5e12d8=_0x150e8f?0x0:_0x5f46aa[_0xfb2d('0x1c')];var _0x523705=_0x150e8f?_0x2f5af8[_0xfb2d('0x1f')]:_0x5f46aa[_0xfb2d('0x1c')]+_0x5f46aa[_0xfb2d('0x1e')];var _0x2bafb5;if(_0x523705>=_0x81f2f2){_0x523705=_0x81f2f2;_0x2bafb5=0xc8;}else{_0x2bafb5=0xce;}_0x30b9e4[_0xfb2d('0x19')](_0x2bafb5);return _0x30b9e4['set']('Content-Range',_0x5e12d8+'-'+_0x523705+'/'+_0x81f2f2)[_0xfb2d('0x1b')](_0x2f5af8);}return null;};}function patchUpdates(_0x32e367){return function(_0x2793c5){try{jsonpatch[_0xfb2d('0x20')](_0x2793c5,_0x32e367,!![]);}catch(_0x367950){return BPromise[_0xfb2d('0x21')](_0x367950);}return _0x2793c5['save']();};}function saveUpdates(_0x4ab9f8,_0x2d3e31){return function(_0x39c742){if(_0x39c742){return _0x39c742[_0xfb2d('0x22')](_0x4ab9f8)['then'](function(_0x5199dc){return _0x5199dc;});}return null;};}function removeEntity(_0x2283cb,_0xeb0f8f){return function(_0x2dd775){if(_0x2dd775){return _0x2dd775[_0xfb2d('0x23')]()['then'](function(){var _0x5c9aa2=_0x2dd775['get']({'plain':!![]});var _0x764d8c=_0xfb2d('0x24');return db[_0xfb2d('0x25')]['destroy']({'where':{'type':_0x764d8c,'resourceId':_0x5c9aa2['id']}})[_0xfb2d('0x26')](function(){return _0x2dd775;});})[_0xfb2d('0x26')](function(){_0x2283cb[_0xfb2d('0x19')](0xcc)[_0xfb2d('0x1a')]();});}};}function handleEntityNotFound(_0x26142b,_0xf12e3e){return function(_0x4ada81){if(!_0x4ada81){_0x26142b['sendStatus'](0x194);}return _0x4ada81;};}function handleError(_0x2b989a,_0x257907){_0x257907=_0x257907||0x1f4;return function(_0x39ec06){logger['error'](_0x39ec06['stack']);if(_0x39ec06[_0xfb2d('0x27')]){delete _0x39ec06[_0xfb2d('0x27')];}_0x2b989a[_0xfb2d('0x19')](_0x257907)[_0xfb2d('0x28')](_0x39ec06);};}exports[_0xfb2d('0x29')]=function(_0xd48cfe,_0x4527f6){var _0xdaffce={},_0x6e3559={},_0x51fc37={'count':0x0,'rows':[]};var _0x5dccc6=_[_0xfb2d('0x2a')](db[_0xfb2d('0x2b')][_0xfb2d('0x2c')],function(_0x2e8f6a){return{'name':_0x2e8f6a['fieldName'],'type':_0x2e8f6a[_0xfb2d('0x2d')]['key']};});_0x6e3559['model']=_['map'](_0x5dccc6,'name');_0x6e3559[_0xfb2d('0x2e')]=_[_0xfb2d('0x2f')](_0xd48cfe['query']);_0x6e3559[_0xfb2d('0x30')]=_[_0xfb2d('0x31')](_0x6e3559['model'],_0x6e3559[_0xfb2d('0x2e')]);_0xdaffce['attributes']=_[_0xfb2d('0x31')](_0x6e3559[_0xfb2d('0x32')],qs[_0xfb2d('0x33')](_0xd48cfe[_0xfb2d('0x2e')][_0xfb2d('0x33')]));_0xdaffce[_0xfb2d('0x34')]=_0xdaffce[_0xfb2d('0x34')]['length']?_0xdaffce[_0xfb2d('0x34')]:_0x6e3559[_0xfb2d('0x32')];if(!_0xd48cfe['query'][_0xfb2d('0x35')]('nolimit')){_0xdaffce[_0xfb2d('0x1e')]=qs[_0xfb2d('0x1e')](_0xd48cfe[_0xfb2d('0x2e')][_0xfb2d('0x1e')]);_0xdaffce[_0xfb2d('0x1c')]=qs[_0xfb2d('0x1c')](_0xd48cfe[_0xfb2d('0x2e')][_0xfb2d('0x1c')]);}_0xdaffce[_0xfb2d('0x36')]=qs['sort'](_0xd48cfe['query'][_0xfb2d('0x37')]);_0xdaffce[_0xfb2d('0x38')]=qs[_0xfb2d('0x30')](_['pick'](_0xd48cfe[_0xfb2d('0x2e')],_0x6e3559[_0xfb2d('0x30')]),_0x5dccc6);if(_0xd48cfe['query']['filter']){_0xdaffce[_0xfb2d('0x38')]=_['merge'](_0xdaffce[_0xfb2d('0x38')],{'$or':_[_0xfb2d('0x2a')](_0x5dccc6,function(_0x4fd880){if(_0x4fd880[_0xfb2d('0x2d')]!==_0xfb2d('0x39')){var _0x21621c={};_0x21621c[_0x4fd880[_0xfb2d('0x27')]]={'$like':'%'+_0xd48cfe[_0xfb2d('0x2e')][_0xfb2d('0x3a')]+'%'};return _0x21621c;}})});}_0xdaffce=_['merge']({},_0xdaffce,_0xd48cfe['options']);var _0x238608={'where':_0xdaffce[_0xfb2d('0x38')]};return db[_0xfb2d('0x2b')][_0xfb2d('0x1f')](_0x238608)['then'](function(_0x5eec89){_0x51fc37[_0xfb2d('0x1f')]=_0x5eec89;if(_0xd48cfe[_0xfb2d('0x2e')][_0xfb2d('0x3b')]){_0xdaffce['include']=[{'all':!![]}];}return db['Dashboard'][_0xfb2d('0x3c')](_0xdaffce);})[_0xfb2d('0x26')](function(_0x2f4f50){_0x51fc37[_0xfb2d('0x3d')]=_0x2f4f50;return _0x51fc37;})['then'](respondWithFilteredResult(_0x4527f6,_0xdaffce))[_0xfb2d('0x3e')](handleError(_0x4527f6,null));};exports['show']=function(_0x17b58e,_0x182520){var _0x4bf611={'raw':![],'where':{'id':_0x17b58e[_0xfb2d('0x3f')]['id']}},_0x37fc9d={};_0x37fc9d[_0xfb2d('0x32')]=_[_0xfb2d('0x2f')](db['Dashboard'][_0xfb2d('0x2c')]);_0x37fc9d[_0xfb2d('0x2e')]=_[_0xfb2d('0x2f')](_0x17b58e[_0xfb2d('0x2e')]);_0x37fc9d['filters']=_[_0xfb2d('0x31')](_0x37fc9d[_0xfb2d('0x32')],_0x37fc9d[_0xfb2d('0x2e')]);_0x4bf611[_0xfb2d('0x34')]=_[_0xfb2d('0x31')](_0x37fc9d[_0xfb2d('0x32')],qs[_0xfb2d('0x33')](_0x17b58e[_0xfb2d('0x2e')][_0xfb2d('0x33')]));_0x4bf611[_0xfb2d('0x34')]=_0x4bf611[_0xfb2d('0x34')]['length']?_0x4bf611[_0xfb2d('0x34')]:_0x37fc9d['model'];if(_0x17b58e[_0xfb2d('0x2e')][_0xfb2d('0x3b')]){_0x4bf611[_0xfb2d('0x40')]=[{'all':!![]}];}_0x4bf611=_[_0xfb2d('0x41')]({},_0x4bf611,_0x17b58e['options']);return db[_0xfb2d('0x2b')][_0xfb2d('0x42')](_0x4bf611)['then'](handleEntityNotFound(_0x182520,null))[_0xfb2d('0x26')](respondWithResult(_0x182520,null))[_0xfb2d('0x3e')](handleError(_0x182520,null));};exports['create']=function(_0x150265,_0x14e701){return db['Dashboard'][_0xfb2d('0x43')](_0x150265[_0xfb2d('0x44')],{})[_0xfb2d('0x26')](function(_0x88f015){var _0x221532=_0x150265[_0xfb2d('0x45')][_0xfb2d('0x46')]({'plain':!![]});if(!_0x221532)throw new Error(_0xfb2d('0x47'));if(_0x221532[_0xfb2d('0x48')]==='user'){var _0x51eb91=_0x88f015[_0xfb2d('0x46')]({'plain':!![]});var _0x5ed179='CustomDashboards';return db[_0xfb2d('0x49')][_0xfb2d('0x42')]({'where':{'name':_0x5ed179,'userProfileId':_0x221532[_0xfb2d('0x4a')]},'raw':!![]})[_0xfb2d('0x26')](function(_0x5b62a4){if(_0x5b62a4&&_0x5b62a4[_0xfb2d('0x4b')]===0x0){return db[_0xfb2d('0x25')]['create']({'name':_0x51eb91[_0xfb2d('0x27')],'resourceId':_0x51eb91['id'],'type':_0x5b62a4[_0xfb2d('0x27')],'sectionId':_0x5b62a4['id']},{})[_0xfb2d('0x26')](function(){return _0x88f015;});}else{return _0x88f015;}})[_0xfb2d('0x3e')](function(_0x279921){logger[_0xfb2d('0x4c')](_0xfb2d('0x4d'),_0x279921);throw _0x279921;});}return _0x88f015;})[_0xfb2d('0x26')](respondWithResult(_0x14e701,0xc9))[_0xfb2d('0x3e')](handleError(_0x14e701,null));};exports[_0xfb2d('0x4e')]=function(_0x49828f,_0x1f740c){var _0x176aee={'where':{'id':_0x49828f[_0xfb2d('0x3f')]['id']}},_0x587c7f={};_0x587c7f['model']=_[_0xfb2d('0x2f')](db[_0xfb2d('0x2b')][_0xfb2d('0x2c')]);_0x176aee[_0xfb2d('0x34')]=_['intersection'](_0x587c7f['model'],qs[_0xfb2d('0x33')](_0x49828f['query'][_0xfb2d('0x33')]));_0x176aee[_0xfb2d('0x34')]=_0x176aee['attributes'][_0xfb2d('0x4f')]?_0x176aee['attributes']:_0x587c7f[_0xfb2d('0x32')];if(_0x49828f['query'][_0xfb2d('0x3b')]){_0x176aee[_0xfb2d('0x40')]=[{'all':!![]}];}_0x176aee=_[_0xfb2d('0x41')]({},_0x176aee,_0x49828f[_0xfb2d('0x50')]);return db['Dashboard'][_0xfb2d('0x42')](_0x176aee)[_0xfb2d('0x26')](handleEntityNotFound(_0x1f740c,null))['then'](function(_0x4c20e1){if(_0x4c20e1){var _0x2a732c=_0x4c20e1[_0xfb2d('0x46')]({'plain':!![]});_0x2a732c=qs[_0xfb2d('0x51')](_0x2a732c,['id','createdAt',_0xfb2d('0x52')]);_0x49828f[_0xfb2d('0x44')]=_[_0xfb2d('0x51')](_0x49828f[_0xfb2d('0x44')],['id',_0xfb2d('0x53'),_0xfb2d('0x52')]);return db['Dashboard'][_0xfb2d('0x43')](_[_0xfb2d('0x41')](_0x2a732c,_0x49828f['body']),{'include':_0x49828f[_0xfb2d('0x2e')][_0xfb2d('0x3b')]?[{'all':!![]}]:undefined})[_0xfb2d('0x26')](function(_0xd6dfee){var _0x25e5aa=_0x49828f[_0xfb2d('0x45')][_0xfb2d('0x46')]({'plain':!![]});if(!_0x25e5aa)throw new Error(_0xfb2d('0x47'));if(_0x25e5aa[_0xfb2d('0x48')]===_0xfb2d('0x45')){var _0x42bd78=_0xd6dfee[_0xfb2d('0x46')]({'plain':!![]});var _0x4f67f8=_0xfb2d('0x24');return db[_0xfb2d('0x49')]['find']({'where':{'name':_0x4f67f8,'userProfileId':_0x25e5aa[_0xfb2d('0x4a')]},'raw':!![]})[_0xfb2d('0x26')](function(_0x1c1e43){if(_0x1c1e43&&_0x1c1e43[_0xfb2d('0x4b')]===0x0){return db[_0xfb2d('0x25')]['create']({'name':_0x42bd78[_0xfb2d('0x27')],'resourceId':_0x42bd78['id'],'type':_0x1c1e43[_0xfb2d('0x27')],'sectionId':_0x1c1e43['id']},{})[_0xfb2d('0x26')](function(){return _0xd6dfee;});}else{return _0xd6dfee;}})[_0xfb2d('0x3e')](function(_0x561dea){logger[_0xfb2d('0x4c')](_0xfb2d('0x4d'),_0x561dea);throw _0x561dea;});}return _0xd6dfee;});}})[_0xfb2d('0x26')](respondWithResult(_0x1f740c,0xc9))[_0xfb2d('0x3e')](handleError(_0x1f740c,null));};exports[_0xfb2d('0x22')]=function(_0x1f2a8f,_0x35fcec){if(_0x1f2a8f[_0xfb2d('0x44')]['id']){delete _0x1f2a8f[_0xfb2d('0x44')]['id'];}return db[_0xfb2d('0x2b')]['find']({'where':{'id':_0x1f2a8f[_0xfb2d('0x3f')]['id']}})[_0xfb2d('0x26')](handleEntityNotFound(_0x35fcec,null))[_0xfb2d('0x26')](saveUpdates(_0x1f2a8f[_0xfb2d('0x44')],null))['then'](respondWithResult(_0x35fcec,null))['catch'](handleError(_0x35fcec,null));};exports[_0xfb2d('0x23')]=function(_0x1487b0,_0xa53085){return db['Dashboard'][_0xfb2d('0x42')]({'where':{'id':_0x1487b0['params']['id']}})[_0xfb2d('0x26')](handleEntityNotFound(_0xa53085,null))[_0xfb2d('0x26')](removeEntity(_0xa53085,null))[_0xfb2d('0x3e')](handleError(_0xa53085,null));};function widgetAttributes(_0x108a8a){try{switch(_0x108a8a[_0xfb2d('0x2d')]){case _0xfb2d('0x54'):return[{'name':_0xfb2d('0x55'),'value':_0x108a8a['attrUrl']||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x0]?_0x108a8a['attrs'][0x0]['value']:undefined)||_0xfb2d('0x57')}];case'custom':return[{'name':_0xfb2d('0x58'),'value':_0x108a8a[_0xfb2d('0x58')]||(_0x108a8a['attrs']&&_0x108a8a[_0xfb2d('0x56')][0x0]?_0x108a8a[_0xfb2d('0x56')][0x0][_0xfb2d('0x59')]:undefined)||''}];case _0xfb2d('0x5a'):return[{'name':_0xfb2d('0x5b'),'value':_0x108a8a[_0xfb2d('0x5b')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x0]?_0x108a8a[_0xfb2d('0x56')][0x0]['value']:undefined)||_0xfb2d('0x5c')},{'name':_0xfb2d('0x5d'),'value':_0x108a8a['attrTimezone']||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x1]?_0x108a8a[_0xfb2d('0x56')][0x1][_0xfb2d('0x59')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x108a8a['attrFontSize']||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x2]?_0x108a8a[_0xfb2d('0x56')][0x2][_0xfb2d('0x59')]:undefined)||0xc}];case'counter':return[{'name':_0xfb2d('0x5e'),'value':_0x108a8a[_0xfb2d('0x5e')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a['attrs'][0x0]?_0x108a8a[_0xfb2d('0x56')][0x0][_0xfb2d('0x59')]:undefined)||'total'},{'name':_0xfb2d('0x5f'),'value':_0x108a8a['attrVoiceQueues']||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x1]?_0x108a8a[_0xfb2d('0x56')][0x1]['value']:undefined)||[]},{'name':_0xfb2d('0x60'),'value':_0x108a8a[_0xfb2d('0x60')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a['attrs'][0x2]?_0x108a8a['attrs'][0x2][_0xfb2d('0x59')]:undefined)||0x14},{'name':'attrChannel','value':_0x108a8a[_0xfb2d('0x61')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a['attrs'][0x3]?_0x108a8a['attrs'][0x3][_0xfb2d('0x59')]:undefined)||'voice'},{'name':_0xfb2d('0x62'),'value':_0x108a8a[_0xfb2d('0x62')]||(_0x108a8a['attrs']&&_0x108a8a[_0xfb2d('0x56')][0x4]?_0x108a8a[_0xfb2d('0x56')][0x4]['value']:undefined)||''},{'name':_0xfb2d('0x63'),'value':_0x108a8a[_0xfb2d('0x63')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x5]?_0x108a8a[_0xfb2d('0x56')][0x5][_0xfb2d('0x59')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x108a8a[_0xfb2d('0x64')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a['attrs'][0x6]?_0x108a8a[_0xfb2d('0x56')][0x6][_0xfb2d('0x59')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x108a8a[_0xfb2d('0x65')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x7]?_0x108a8a[_0xfb2d('0x56')][0x7][_0xfb2d('0x59')]:undefined)||''},{'name':_0xfb2d('0x66'),'value':_0x108a8a[_0xfb2d('0x66')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x8]?_0x108a8a[_0xfb2d('0x56')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x108a8a[_0xfb2d('0x67')]||(_0x108a8a['attrs']&&_0x108a8a[_0xfb2d('0x56')][0x9]?_0x108a8a['attrs'][0x9]['value']:undefined)||''}];case _0xfb2d('0x68'):case'pie-chart':return[{'name':'attrSerie1','value':_0x108a8a['attrSerie1']||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x0]?_0x108a8a[_0xfb2d('0x56')][0x0][_0xfb2d('0x59')]:undefined)||_0xfb2d('0x69')},{'name':_0xfb2d('0x6a'),'value':_0x108a8a[_0xfb2d('0x6a')]||(_0x108a8a['attrs']&&_0x108a8a[_0xfb2d('0x56')][0x1]?_0x108a8a['attrs'][0x1][_0xfb2d('0x59')]:undefined)||null},{'name':_0xfb2d('0x6b'),'value':_0x108a8a[_0xfb2d('0x6b')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x2]?_0x108a8a['attrs'][0x2][_0xfb2d('0x59')]:undefined)||null},{'name':_0xfb2d('0x5f'),'value':_0x108a8a['attrVoiceQueues']||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x3]?_0x108a8a[_0xfb2d('0x56')][0x3][_0xfb2d('0x59')]:undefined)||[]},{'name':'attrChannel','value':_0x108a8a[_0xfb2d('0x61')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x4]?_0x108a8a[_0xfb2d('0x56')][0x4][_0xfb2d('0x59')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x108a8a[_0xfb2d('0x62')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x5]?_0x108a8a[_0xfb2d('0x56')][0x5][_0xfb2d('0x59')]:undefined)||''},{'name':_0xfb2d('0x63'),'value':_0x108a8a[_0xfb2d('0x63')]||(_0x108a8a['attrs']&&_0x108a8a['attrs'][0x6]?_0x108a8a[_0xfb2d('0x56')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x108a8a['attrSmsAccounts']||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x7]?_0x108a8a[_0xfb2d('0x56')][0x7]['value']:undefined)||''},{'name':_0xfb2d('0x65'),'value':_0x108a8a[_0xfb2d('0x65')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x8]?_0x108a8a[_0xfb2d('0x56')][0x8][_0xfb2d('0x59')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x108a8a[_0xfb2d('0x66')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x9]?_0x108a8a[_0xfb2d('0x56')][0x9][_0xfb2d('0x59')]:undefined)||''},{'name':_0xfb2d('0x67'),'value':_0x108a8a[_0xfb2d('0x67')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0xa]?_0x108a8a[_0xfb2d('0x56')][0xa][_0xfb2d('0x59')]:undefined)||''}];case _0xfb2d('0x6c'):return[{'name':_0xfb2d('0x6d'),'type':_0x108a8a[_0xfb2d('0x6e')]||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a['attrs'][0x0]?_0x108a8a[_0xfb2d('0x56')][0x0][_0xfb2d('0x2d')]:undefined)||null,'value':_0x108a8a[_0xfb2d('0x6d')]||(_0x108a8a['attrs']&&_0x108a8a[_0xfb2d('0x56')][0x0]?_0x108a8a['attrs'][0x0][_0xfb2d('0x59')]:undefined)||null},{'name':_0xfb2d('0x6f'),'value':_0x108a8a['attrRefresh']||(_0x108a8a[_0xfb2d('0x56')]&&_0x108a8a[_0xfb2d('0x56')][0x1]?_0x108a8a[_0xfb2d('0x56')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4a879e){logger['error'](_0xfb2d('0x70'),JSON[_0xfb2d('0x71')](_0x4a879e));return[];}}exports[_0xfb2d('0x72')]=function(_0x1eb659,_0x1a7418,_0x2c72b3){if(_0x1eb659[_0xfb2d('0x44')]['id']){delete _0x1eb659[_0xfb2d('0x44')]['id'];}return db[_0xfb2d('0x2b')][_0xfb2d('0x42')]({'where':{'id':_0x1eb659[_0xfb2d('0x3f')]['id']}})[_0xfb2d('0x26')](handleEntityNotFound(_0x1a7418,null))[_0xfb2d('0x26')](function(_0x4d28a3){if(_0x4d28a3){_0x1eb659[_0xfb2d('0x44')][_0xfb2d('0x73')]=_0x4d28a3['id'];_0x1eb659[_0xfb2d('0x44')][_0xfb2d('0x56')]=widgetAttributes(_0x1eb659[_0xfb2d('0x44')]);return db[_0xfb2d('0x74')]['create'](_0x1eb659[_0xfb2d('0x44')]);}})[_0xfb2d('0x26')](respondWithResult(_0x1a7418,null))['catch'](handleError(_0x1a7418,null));};exports[_0xfb2d('0x75')]=function(_0x3785cc,_0x23c9a5,_0x1c25f2){var _0x79e06={};var _0x4129ca={};var _0x120f25;var _0x138263;return db[_0xfb2d('0x2b')][_0xfb2d('0x76')]({'where':{'id':_0x3785cc[_0xfb2d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x23c9a5,null))[_0xfb2d('0x26')](function(_0x5e38c4){if(_0x5e38c4){_0x120f25=_0x5e38c4;_0x4129ca[_0xfb2d('0x32')]=_[_0xfb2d('0x2f')](db[_0xfb2d('0x74')][_0xfb2d('0x2c')]);_0x4129ca['query']=_[_0xfb2d('0x2f')](_0x3785cc['query']);_0x4129ca[_0xfb2d('0x30')]=_[_0xfb2d('0x31')](_0x4129ca['model'],_0x4129ca[_0xfb2d('0x2e')]);_0x79e06[_0xfb2d('0x34')]=_[_0xfb2d('0x31')](_0x4129ca[_0xfb2d('0x32')],qs[_0xfb2d('0x33')](_0x3785cc[_0xfb2d('0x2e')][_0xfb2d('0x33')]));_0x79e06[_0xfb2d('0x34')]=_0x79e06[_0xfb2d('0x34')][_0xfb2d('0x4f')]?_0x79e06[_0xfb2d('0x34')]:_0x4129ca['model'];_0x79e06['order']=qs[_0xfb2d('0x37')](_0x3785cc['query']['sort']);_0x79e06[_0xfb2d('0x38')]=qs[_0xfb2d('0x30')](_['pick'](_0x3785cc[_0xfb2d('0x2e')],_0x4129ca[_0xfb2d('0x30')]));if(_0x3785cc['query']['filter']){_0x79e06[_0xfb2d('0x38')]=_[_0xfb2d('0x41')](_0x79e06[_0xfb2d('0x38')],{'$or':_[_0xfb2d('0x2a')](_0x79e06['attributes'],function(_0x171fd3){var _0x2cdf7a={};_0x2cdf7a[_0x171fd3]={'$like':'%'+_0x3785cc[_0xfb2d('0x2e')][_0xfb2d('0x3a')]+'%'};return _0x2cdf7a;})});}_0x79e06=_[_0xfb2d('0x41')]({},_0x79e06,_0x3785cc[_0xfb2d('0x50')]);return _0x120f25[_0xfb2d('0x75')](_0x79e06);}})[_0xfb2d('0x26')](function(_0x4ef915){if(_0x4ef915){_0x138263=_0x4ef915[_0xfb2d('0x4f')];if(!_0x3785cc['query'][_0xfb2d('0x35')](_0xfb2d('0x77'))){_0x79e06[_0xfb2d('0x1e')]=qs['limit'](_0x3785cc[_0xfb2d('0x2e')][_0xfb2d('0x1e')]);_0x79e06[_0xfb2d('0x1c')]=qs[_0xfb2d('0x1c')](_0x3785cc['query']['offset']);}return _0x120f25[_0xfb2d('0x75')](_0x79e06);}})[_0xfb2d('0x26')](function(_0x322690){if(_0x322690){return _0x322690?{'count':_0x138263,'rows':_0x322690}:null;}})['then'](respondWithResult(_0x23c9a5,null))[_0xfb2d('0x3e')](handleError(_0x23c9a5,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5004ad2..530e1cf 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 _0x29d2=['events','Dashboard','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x259add,_0xf8fbd){var _0x5407a9=function(_0x4d181d){while(--_0x4d181d){_0x259add['push'](_0x259add['shift']());}};_0x5407a9(++_0xf8fbd);}(_0x29d2,0x1a7));var _0x229d=function(_0x1f6495,_0x5c5cbd){_0x1f6495=_0x1f6495-0x0;var _0x19288f=_0x29d2[_0x1f6495];return _0x19288f;};'use strict';var EventEmitter=require(_0x229d('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x229d('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x229d('0x2')](0x0);var events={'afterCreate':_0x229d('0x3'),'afterUpdate':_0x229d('0x4'),'afterDestroy':_0x229d('0x5')};function emitEvent(_0x397218){return function(_0x1f4a57,_0x29747d,_0x2411b1){DashboardEvents[_0x229d('0x6')](_0x397218+':'+_0x1f4a57['id'],_0x1f4a57);DashboardEvents['emit'](_0x397218,_0x1f4a57);_0x2411b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x229d('0x7')](e,emitEvent(event));}}module[_0x229d('0x8')]=DashboardEvents; \ No newline at end of file +var _0x598a=['Dashboard','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x42b47e,_0x3df4bf){var _0x18baa2=function(_0x54f06c){while(--_0x54f06c){_0x42b47e['push'](_0x42b47e['shift']());}};_0x18baa2(++_0x3df4bf);}(_0x598a,0x1c9));var _0xa598=function(_0x1e86a8,_0x1c17ea){_0x1e86a8=_0x1e86a8-0x0;var _0x471c04=_0x598a[_0x1e86a8];return _0x471c04;};'use strict';var EventEmitter=require(_0xa598('0x0'));var Dashboard=require(_0xa598('0x1'))['db'][_0xa598('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa598('0x3')](0x0);var events={'afterCreate':_0xa598('0x4'),'afterUpdate':_0xa598('0x5'),'afterDestroy':'remove'};function emitEvent(_0x742da2){return function(_0x23b1c3,_0x481514,_0x364c9d){DashboardEvents['emit'](_0x742da2+':'+_0x23b1c3['id'],_0x23b1c3);DashboardEvents[_0xa598('0x6')](_0x742da2,_0x23b1c3);_0x364c9d(null);};}for(var e in events){if(events[_0xa598('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xa598('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2581bdd..2343f7d 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 _0x03dc=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util'];(function(_0x3c51c7,_0x20cf54){var _0x4e932a=function(_0x6044e0){while(--_0x6044e0){_0x3c51c7['push'](_0x3c51c7['shift']());}};_0x4e932a(++_0x20cf54);}(_0x03dc,0xdb));var _0xc03d=function(_0x1d637d,_0x7cc1ad){_0x1d637d=_0x1d637d-0x0;var _0x3203e0=_0x03dc[_0x1d637d];return _0x3203e0;};'use strict';var _=require(_0xc03d('0x0'));var util=require(_0xc03d('0x1'));var logger=require(_0xc03d('0x2'))(_0xc03d('0x3'));var moment=require(_0xc03d('0x4'));var BPromise=require(_0xc03d('0x5'));var rp=require(_0xc03d('0x6'));var fs=require('fs');var path=require(_0xc03d('0x7'));var rimraf=require('rimraf');var config=require(_0xc03d('0x8'));var attributes=require(_0xc03d('0x9'));module[_0xc03d('0xa')]=function(_0x49f3ba,_0x2ac804){return _0x49f3ba['define'](_0xc03d('0xb'),attributes,{'tableName':_0xc03d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf23b=['moment','bluebird','rimraf','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0xf23b,0x1ca));var _0xbf23=function(_0xadac88,_0x39a40f){_0xadac88=_0xadac88-0x0;var _0x3a55b6=_0xf23b[_0xadac88];return _0x3a55b6;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var logger=require(_0xbf23('0x2'))(_0xbf23('0x3'));var moment=require(_0xbf23('0x4'));var BPromise=require(_0xbf23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf23('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf23('0x7'));module[_0xbf23('0x8')]=function(_0x5a414d,_0x145e02){return _0x5a414d[_0xbf23('0x9')](_0xbf23('0xa'),attributes,{'tableName':'dashboards','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 a444b60..03c248f 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 _0x55e2=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5a66b7,_0x517636){var _0x5f56e3=function(_0x1c602d){while(--_0x1c602d){_0x5a66b7['push'](_0x5a66b7['shift']());}};_0x5f56e3(++_0x517636);}(_0x55e2,0x9f));var _0x255e=function(_0x52bac3,_0x56ae9b){_0x52bac3=_0x52bac3-0x0;var _0x4d3570=_0x55e2[_0x52bac3];return _0x4d3570;};'use strict';var _=require(_0x255e('0x0'));var util=require(_0x255e('0x1'));var moment=require(_0x255e('0x2'));var BPromise=require(_0x255e('0x3'));var rs=require(_0x255e('0x4'));var fs=require('fs');var Redis=require(_0x255e('0x5'));var db=require(_0x255e('0x6'))['db'];var utils=require(_0x255e('0x7'));var logger=require('../../config/logger')(_0x255e('0x8'));var config=require(_0x255e('0x9'));var jayson=require(_0x255e('0xa'));var client=jayson[_0x255e('0xb')][_0x255e('0xc')]({'port':0x232a});config[_0x255e('0xd')]=_[_0x255e('0xe')](config[_0x255e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x255e('0xf'))(new Redis(config[_0x255e('0xd')]));require('./dashboard.socket')[_0x255e('0x10')](socket);function respondWithRpcPromise(_0xfa68e1,_0x22005d,_0x2989a4){return new BPromise(function(_0x1c83a1,_0x3f6ede){return client[_0x255e('0x11')](_0xfa68e1,_0x2989a4)[_0x255e('0x12')](function(_0x429d81){logger[_0x255e('0x13')](_0x255e('0x14'),_0x22005d,'request\x20sent');logger['debug'](_0x255e('0x15'),_0x22005d,_0x255e('0x16'),JSON[_0x255e('0x17')](_0x429d81));if(_0x429d81[_0x255e('0x18')]){if(_0x429d81[_0x255e('0x18')]['code']===0x1f4){logger[_0x255e('0x18')](_0x255e('0x14'),_0x22005d,_0x429d81[_0x255e('0x18')][_0x255e('0x19')]);return _0x3f6ede(_0x429d81[_0x255e('0x18')][_0x255e('0x19')]);}logger[_0x255e('0x18')](_0x255e('0x14'),_0x22005d,_0x429d81['error'][_0x255e('0x19')]);return _0x1c83a1(_0x429d81[_0x255e('0x18')][_0x255e('0x19')]);}else{logger[_0x255e('0x13')](_0x255e('0x14'),_0x22005d,'request\x20sent');_0x1c83a1(_0x429d81[_0x255e('0x1a')][_0x255e('0x19')]);}})[_0x255e('0x1b')](function(_0x1986f1){logger['error'](_0x255e('0x14'),_0x22005d,_0x1986f1);_0x3f6ede(_0x1986f1);});});} \ No newline at end of file +var _0xcfaa=['stringify','error','code','message','Dashboard,\x20%s,\x20%s','request\x20sent','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','./dashboard.socket','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x6c77b1,_0x4399eb){var _0x1cee86=function(_0xf4f50){while(--_0xf4f50){_0x6c77b1['push'](_0x6c77b1['shift']());}};_0x1cee86(++_0x4399eb);}(_0xcfaa,0x104));var _0xacfa=function(_0x52ec9a,_0x2c7e28){_0x52ec9a=_0x52ec9a-0x0;var _0x3b3313=_0xcfaa[_0x52ec9a];return _0x3b3313;};'use strict';var _=require('lodash');var util=require(_0xacfa('0x0'));var moment=require(_0xacfa('0x1'));var BPromise=require(_0xacfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacfa('0x3'))['db'];var utils=require(_0xacfa('0x4'));var logger=require(_0xacfa('0x5'))(_0xacfa('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xacfa('0x7')]({'port':0x232a});config[_0xacfa('0x8')]=_['defaults'](config[_0xacfa('0x8')],{'host':_0xacfa('0x9'),'port':0x18eb});var socket=require(_0xacfa('0xa'))(new Redis(config['redis']));require(_0xacfa('0xb'))['register'](socket);function respondWithRpcPromise(_0x124147,_0x1a7a3f,_0x443134){return new BPromise(function(_0x4d112e,_0x30044f){return client['request'](_0x124147,_0x443134)[_0xacfa('0xc')](function(_0x1d097e){logger[_0xacfa('0xd')]('Dashboard,\x20%s,\x20%s',_0x1a7a3f,'request\x20sent');logger[_0xacfa('0xe')](_0xacfa('0xf'),_0x1a7a3f,'request\x20sent',JSON[_0xacfa('0x10')](_0x1d097e));if(_0x1d097e[_0xacfa('0x11')]){if(_0x1d097e[_0xacfa('0x11')][_0xacfa('0x12')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x1a7a3f,_0x1d097e[_0xacfa('0x11')][_0xacfa('0x13')]);return _0x30044f(_0x1d097e[_0xacfa('0x11')][_0xacfa('0x13')]);}logger['error'](_0xacfa('0x14'),_0x1a7a3f,_0x1d097e[_0xacfa('0x11')][_0xacfa('0x13')]);return _0x4d112e(_0x1d097e[_0xacfa('0x11')][_0xacfa('0x13')]);}else{logger[_0xacfa('0xd')](_0xacfa('0x14'),_0x1a7a3f,_0xacfa('0x15'));_0x4d112e(_0x1d097e[_0xacfa('0x16')][_0xacfa('0x13')]);}})['catch'](function(_0xa23de2){logger[_0xacfa('0x11')]('Dashboard,\x20%s,\x20%s',_0x1a7a3f,_0xa23de2);_0x30044f(_0xa23de2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2ffa001..6ad9bb3 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 _0xe40f=['length','./dashboard.events','save','remove','update','emit'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xe40f,0xa9));var _0xfe40=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe40f[_0x17d9e3];return _0x14192d;};'use strict';var DashboardEvents=require(_0xfe40('0x0'));var events=[_0xfe40('0x1'),_0xfe40('0x2'),_0xfe40('0x3')];function createListener(_0x2784df,_0xa265a6){return function(_0x1aebd3){_0xa265a6[_0xfe40('0x4')](_0x2784df,_0x1aebd3);};}function removeListener(_0x42869e,_0x264c8b){return function(){DashboardEvents['removeListener'](_0x42869e,_0x264c8b);};}exports['register']=function(_0xf762e5){for(var _0x5c9ac3=0x0,_0x24fbc2=events[_0xfe40('0x5')];_0x5c9ac3<_0x24fbc2;_0x5c9ac3++){var _0x42b2b3=events[_0x5c9ac3];var _0x1d0b63=createListener('dashboard:'+_0x42b2b3,_0xf762e5);DashboardEvents['on'](_0x42b2b3,_0x1d0b63);}}; \ No newline at end of file +var _0x06ca=['emit','removeListener','register','dashboard:','./dashboard.events'];(function(_0x510562,_0x2febc2){var _0x112e91=function(_0x2e5fd5){while(--_0x2e5fd5){_0x510562['push'](_0x510562['shift']());}};_0x112e91(++_0x2febc2);}(_0x06ca,0x1b2));var _0xa06c=function(_0x49cefe,_0x31f709){_0x49cefe=_0x49cefe-0x0;var _0x4da46e=_0x06ca[_0x49cefe];return _0x4da46e;};'use strict';var DashboardEvents=require(_0xa06c('0x0'));var events=['save','remove','update'];function createListener(_0x500815,_0xff9d33){return function(_0x31fa03){_0xff9d33[_0xa06c('0x1')](_0x500815,_0x31fa03);};}function removeListener(_0x585648,_0x1fe933){return function(){DashboardEvents[_0xa06c('0x2')](_0x585648,_0x1fe933);};}exports[_0xa06c('0x3')]=function(_0x4471e0){for(var _0x28edff=0x0,_0xd7230a=events['length'];_0x28edff<_0xd7230a;_0x28edff++){var _0xbab1fe=events[_0x28edff];var _0x3f95b0=createListener(_0xa06c('0x4')+_0xbab1fe,_0x4471e0);DashboardEvents['on'](_0xbab1fe,_0x3f95b0);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1bc46c6..a5a4d9c 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 _0x700b=['isAuthenticated','index','show','/:id/items','post','create','/:id/clone','clone','addItem','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get'];(function(_0x2cf02c,_0x1a162f){var _0x42b0f5=function(_0x2eff64){while(--_0x2eff64){_0x2cf02c['push'](_0x2cf02c['shift']());}};_0x42b0f5(++_0x1a162f);}(_0x700b,0xce));var _0xb700=function(_0x5f2d48,_0x2e2e2c){_0x5f2d48=_0x5f2d48-0x0;var _0x2ffebe=_0x700b[_0x5f2d48];return _0x2ffebe;};'use strict';var multer=require(_0xb700('0x0'));var util=require('util');var path=require(_0xb700('0x1'));var timeout=require(_0xb700('0x2'));var express=require(_0xb700('0x3'));var router=express[_0xb700('0x4')]();var fs_extra=require(_0xb700('0x5'));var auth=require(_0xb700('0x6'));var interaction=require(_0xb700('0x7'));var config=require('../../config/environment');var controller=require(_0xb700('0x8'));router[_0xb700('0x9')]('/',auth[_0xb700('0xa')](),controller[_0xb700('0xb')]);router['get']('/:id',auth[_0xb700('0xa')](),controller[_0xb700('0xc')]);router['get'](_0xb700('0xd'),auth[_0xb700('0xa')](),controller['getItems']);router[_0xb700('0xe')]('/',auth[_0xb700('0xa')](),controller[_0xb700('0xf')]);router[_0xb700('0xe')](_0xb700('0x10'),auth[_0xb700('0xa')](),controller[_0xb700('0x11')]);router[_0xb700('0xe')](_0xb700('0xd'),auth[_0xb700('0xa')](),controller[_0xb700('0x12')]);router['put'](_0xb700('0x13'),auth[_0xb700('0xa')](),controller[_0xb700('0x14')]);router[_0xb700('0x15')](_0xb700('0x13'),auth[_0xb700('0xa')](),controller[_0xb700('0x16')]);module[_0xb700('0x17')]=router; \ No newline at end of file +var _0xccf3=['../../config/environment','get','isAuthenticated','index','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x27b6ae,_0x5a268e){var _0x6b11ed=function(_0x1ccac9){while(--_0x1ccac9){_0x27b6ae['push'](_0x27b6ae['shift']());}};_0x6b11ed(++_0x5a268e);}(_0xccf3,0x19b));var _0x3ccf=function(_0x340cfc,_0x49baf3){_0x340cfc=_0x340cfc-0x0;var _0x9cbab0=_0xccf3[_0x340cfc];return _0x9cbab0;};'use strict';var multer=require('multer');var util=require(_0x3ccf('0x0'));var path=require('path');var timeout=require(_0x3ccf('0x1'));var express=require(_0x3ccf('0x2'));var router=express[_0x3ccf('0x3')]();var fs_extra=require(_0x3ccf('0x4'));var auth=require(_0x3ccf('0x5'));var interaction=require(_0x3ccf('0x6'));var config=require(_0x3ccf('0x7'));var controller=require('./dashboard.controller');router[_0x3ccf('0x8')]('/',auth[_0x3ccf('0x9')](),controller[_0x3ccf('0xa')]);router[_0x3ccf('0x8')]('/:id',auth[_0x3ccf('0x9')](),controller['show']);router[_0x3ccf('0x8')](_0x3ccf('0xb'),auth[_0x3ccf('0x9')](),controller[_0x3ccf('0xc')]);router[_0x3ccf('0xd')]('/',auth[_0x3ccf('0x9')](),controller[_0x3ccf('0xe')]);router[_0x3ccf('0xd')](_0x3ccf('0xf'),auth['isAuthenticated'](),controller[_0x3ccf('0x10')]);router['post'](_0x3ccf('0xb'),auth['isAuthenticated'](),controller[_0x3ccf('0x11')]);router[_0x3ccf('0x12')](_0x3ccf('0x13'),auth[_0x3ccf('0x9')](),controller['update']);router['delete'](_0x3ccf('0x13'),auth[_0x3ccf('0x9')](),controller[_0x3ccf('0x14')]);module[_0x3ccf('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 16f3bd0..1d15b82 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 _0x2542=['exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0x2542,0x169));var _0x2254=function(_0x33d5d1,_0x4718a4){_0x33d5d1=_0x33d5d1-0x0;var _0x364bb8=_0x2542[_0x33d5d1];return _0x364bb8;};'use strict';var Sequelize=require(_0x2254('0x0'));var squel=require(_0x2254('0x1'));var _=require(_0x2254('0x2'));module[_0x2254('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x2254('0x5')),'get':function(){try{return JSON[_0x2254('0x6')](this[_0x2254('0x7')](_0x2254('0x8')));}catch(_0x76c902){return[];}},'set':function(_0x508183){try{this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')](_0x508183));}catch(_0x3c45ec){this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2254('0xb')]},'col':{'type':Sequelize[_0x2254('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2254('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2254('0x4')],'allowNull':![],'defaultValue':_0x2254('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2254('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x2813fa,_0x3211d4){var _0x8a2acb=function(_0x4a9602){while(--_0x4a9602){_0x2813fa['push'](_0x2813fa['shift']());}};_0x8a2acb(++_0x3211d4);}(_0xfcf0,0x138));var _0x0fcf=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0xfcf0[_0x296754];return _0x1d9f1d;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('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 c1eb0ab..b7ca854 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 _0x1c23=['save','destroy','then','error','stack','name','send','show','params','DashboardItem','query','keys','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply'];(function(_0x4cd147,_0x274e0d){var _0x5bf030=function(_0x37a69f){while(--_0x37a69f){_0x4cd147['push'](_0x4cd147['shift']());}};_0x5bf030(++_0x274e0d);}(_0x1c23,0x1d5));var _0x31c2=function(_0x407f89,_0x317af8){_0x407f89=_0x407f89-0x0;var _0x5314fb=_0x1c23[_0x407f89];return _0x5314fb;};'use strict';var emlformat=require(_0x31c2('0x0'));var rimraf=require(_0x31c2('0x1'));var zipdir=require(_0x31c2('0x2'));var jsonpatch=require(_0x31c2('0x3'));var rp=require(_0x31c2('0x4'));var moment=require(_0x31c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31c2('0x6'));var util=require(_0x31c2('0x7'));var path=require('path');var sox=require(_0x31c2('0x8'));var csv=require(_0x31c2('0x9'));var ejs=require(_0x31c2('0xa'));var fs=require('fs');var fs_extra=require(_0x31c2('0xb'));var _=require(_0x31c2('0xc'));var squel=require('squel');var crypto=require(_0x31c2('0xd'));var jsforce=require(_0x31c2('0xe'));var deskjs=require(_0x31c2('0xf'));var toCsv=require(_0x31c2('0x9'));var querystring=require(_0x31c2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x31c2('0x11'));var qs=require(_0x31c2('0x12'));var as=require(_0x31c2('0x13'));var hardwareService=require(_0x31c2('0x14'));var logger=require(_0x31c2('0x15'))(_0x31c2('0x16'));var utils=require('../../config/utils');var config=require(_0x31c2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x31c2('0x18'))['db'];config[_0x31c2('0x19')]=_[_0x31c2('0x1a')](config['redis'],{'host':_0x31c2('0x1b'),'port':0x18eb});var socket=require(_0x31c2('0x1c'))(new Redis(config['redis']));require(_0x31c2('0x1d'))[_0x31c2('0x1e')](socket);function respondWithStatusCode(_0x463881,_0x41edf9){_0x41edf9=_0x41edf9||0xcc;return function(_0x3f092f){if(_0x3f092f){return _0x463881[_0x31c2('0x1f')](_0x41edf9);}return _0x463881[_0x31c2('0x20')](_0x41edf9)[_0x31c2('0x21')]();};}function respondWithResult(_0x3f1d79,_0x289fff){_0x289fff=_0x289fff||0xc8;return function(_0x3b23b9){if(_0x3b23b9){return _0x3f1d79['status'](_0x289fff)['json'](_0x3b23b9);}};}function respondWithFilteredResult(_0x3bfa45,_0x1ea2ed){return function(_0x1f7f83){if(_0x1f7f83){var _0x589941=typeof _0x1ea2ed['offset']===_0x31c2('0x22')&&typeof _0x1ea2ed['limit']===_0x31c2('0x22');var _0x3f2435=_0x1f7f83[_0x31c2('0x23')];var _0xb4c4a5=_0x589941?0x0:_0x1ea2ed['offset'];var _0xc29f8a=_0x589941?_0x1f7f83['count']:_0x1ea2ed[_0x31c2('0x24')]+_0x1ea2ed[_0x31c2('0x25')];var _0x483c25;if(_0xc29f8a>=_0x3f2435){_0xc29f8a=_0x3f2435;_0x483c25=0xc8;}else{_0x483c25=0xce;}_0x3bfa45['status'](_0x483c25);return _0x3bfa45[_0x31c2('0x26')](_0x31c2('0x27'),_0xb4c4a5+'-'+_0xc29f8a+'/'+_0x3f2435)['json'](_0x1f7f83);}return null;};}function patchUpdates(_0x133d0e){return function(_0xeea92c){try{jsonpatch[_0x31c2('0x28')](_0xeea92c,_0x133d0e,!![]);}catch(_0x44a0bc){return BPromise['reject'](_0x44a0bc);}return _0xeea92c[_0x31c2('0x29')]();};}function saveUpdates(_0x26939e,_0x5bb71d){return function(_0x259a5b){if(_0x259a5b){return _0x259a5b['update'](_0x26939e)['then'](function(_0x3af6eb){return _0x3af6eb;});}return null;};}function removeEntity(_0x58f82d,_0x37b749){return function(_0x30c767){if(_0x30c767){return _0x30c767[_0x31c2('0x2a')]()[_0x31c2('0x2b')](function(){_0x58f82d[_0x31c2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x344cd7,_0x2c65a1){return function(_0x3ae1b9){if(!_0x3ae1b9){_0x344cd7['sendStatus'](0x194);}return _0x3ae1b9;};}function handleError(_0x28d51a,_0x3c0ec1){_0x3c0ec1=_0x3c0ec1||0x1f4;return function(_0xf8879a){logger[_0x31c2('0x2c')](_0xf8879a[_0x31c2('0x2d')]);if(_0xf8879a[_0x31c2('0x2e')]){delete _0xf8879a[_0x31c2('0x2e')];}_0x28d51a['status'](_0x3c0ec1)[_0x31c2('0x2f')](_0xf8879a);};}exports[_0x31c2('0x30')]=function(_0x1eb509,_0x2488eb){var _0x276137={'raw':![],'where':{'id':_0x1eb509[_0x31c2('0x31')]['id']}},_0x3e2eef={};_0x3e2eef['model']=_['keys'](db[_0x31c2('0x32')]['rawAttributes']);_0x3e2eef[_0x31c2('0x33')]=_[_0x31c2('0x34')](_0x1eb509[_0x31c2('0x33')]);_0x3e2eef[_0x31c2('0x35')]=_['intersection'](_0x3e2eef[_0x31c2('0x36')],_0x3e2eef['query']);_0x276137[_0x31c2('0x37')]=_[_0x31c2('0x38')](_0x3e2eef[_0x31c2('0x36')],qs[_0x31c2('0x39')](_0x1eb509['query']['fields']));_0x276137['attributes']=_0x276137[_0x31c2('0x37')][_0x31c2('0x3a')]?_0x276137[_0x31c2('0x37')]:_0x3e2eef[_0x31c2('0x36')];if(_0x1eb509[_0x31c2('0x33')][_0x31c2('0x3b')]){_0x276137[_0x31c2('0x3c')]=[{'all':!![]}];}_0x276137=_[_0x31c2('0x3d')]({},_0x276137,_0x1eb509[_0x31c2('0x3e')]);return db[_0x31c2('0x32')][_0x31c2('0x3f')](_0x276137)[_0x31c2('0x2b')](handleEntityNotFound(_0x2488eb,null))[_0x31c2('0x2b')](respondWithResult(_0x2488eb,null))[_0x31c2('0x40')](handleError(_0x2488eb,null));};exports[_0x31c2('0x2a')]=function(_0x5bf1e3,_0x4e746c){return db[_0x31c2('0x32')][_0x31c2('0x3f')]({'where':{'id':_0x5bf1e3[_0x31c2('0x31')]['id']}})[_0x31c2('0x2b')](handleEntityNotFound(_0x4e746c,null))[_0x31c2('0x2b')](removeEntity(_0x4e746c,null))['catch'](handleError(_0x4e746c,null));};function widgetAttributes(_0x5429f4){try{switch(_0x5429f4[_0x31c2('0x41')]){case _0x31c2('0x42'):return[{'name':_0x31c2('0x43'),'value':_0x5429f4[_0x31c2('0x43')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x0]?_0x5429f4[_0x31c2('0x44')][0x0][_0x31c2('0x45')]:undefined)||'https://'}];case _0x31c2('0x46'):return[{'name':'attrPath','value':_0x5429f4[_0x31c2('0x47')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x0]?_0x5429f4[_0x31c2('0x44')][0x0]['value']:undefined)||''}];case _0x31c2('0x48'):return[{'name':_0x31c2('0x49'),'value':_0x5429f4[_0x31c2('0x49')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x0]?_0x5429f4[_0x31c2('0x44')][0x0][_0x31c2('0x45')]:undefined)||_0x31c2('0x4a')},{'name':_0x31c2('0x4b'),'value':_0x5429f4[_0x31c2('0x4b')]||(_0x5429f4['attrs']&&_0x5429f4[_0x31c2('0x44')][0x1]?_0x5429f4['attrs'][0x1][_0x31c2('0x45')]:undefined)||'0.00'},{'name':_0x31c2('0x4c'),'value':_0x5429f4[_0x31c2('0x4c')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x2]?_0x5429f4[_0x31c2('0x44')][0x2][_0x31c2('0x45')]:undefined)||0xc}];case _0x31c2('0x4d'):return[{'name':'attrMetric','value':_0x5429f4[_0x31c2('0x4e')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x0]?_0x5429f4[_0x31c2('0x44')][0x0][_0x31c2('0x45')]:undefined)||_0x31c2('0x4f')},{'name':_0x31c2('0x50'),'value':_0x5429f4[_0x31c2('0x50')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x1]?_0x5429f4[_0x31c2('0x44')][0x1][_0x31c2('0x45')]:undefined)||[]},{'name':_0x31c2('0x4c'),'value':_0x5429f4[_0x31c2('0x4c')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x2]?_0x5429f4[_0x31c2('0x44')][0x2][_0x31c2('0x45')]:undefined)||0x14},{'name':'attrChannel','value':_0x5429f4[_0x31c2('0x51')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x3]?_0x5429f4[_0x31c2('0x44')][0x3][_0x31c2('0x45')]:undefined)||_0x31c2('0x52')},{'name':_0x31c2('0x53'),'value':_0x5429f4[_0x31c2('0x53')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x4]?_0x5429f4['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x5429f4[_0x31c2('0x54')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x5]?_0x5429f4['attrs'][0x5][_0x31c2('0x45')]:undefined)||''},{'name':_0x31c2('0x55'),'value':_0x5429f4['attrSmsAccounts']||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x6]?_0x5429f4['attrs'][0x6][_0x31c2('0x45')]:undefined)||''},{'name':_0x31c2('0x56'),'value':_0x5429f4['attrOpenchannelAccounts']||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x7]?_0x5429f4['attrs'][0x7][_0x31c2('0x45')]:undefined)||''},{'name':_0x31c2('0x57'),'value':_0x5429f4[_0x31c2('0x57')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x8]?_0x5429f4[_0x31c2('0x44')][0x8][_0x31c2('0x45')]:undefined)||''},{'name':_0x31c2('0x58'),'value':_0x5429f4[_0x31c2('0x58')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x9]?_0x5429f4['attrs'][0x9][_0x31c2('0x45')]:undefined)||''}];case _0x31c2('0x59'):case _0x31c2('0x5a'):return[{'name':_0x31c2('0x5b'),'value':_0x5429f4[_0x31c2('0x5b')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x0]?_0x5429f4[_0x31c2('0x44')][0x0][_0x31c2('0x45')]:undefined)||_0x31c2('0x4f')},{'name':_0x31c2('0x5c'),'value':_0x5429f4[_0x31c2('0x5c')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x1]?_0x5429f4[_0x31c2('0x44')][0x1][_0x31c2('0x45')]:undefined)||null},{'name':_0x31c2('0x5d'),'value':_0x5429f4['attrSerie3']||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x2]?_0x5429f4[_0x31c2('0x44')][0x2][_0x31c2('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5429f4['attrVoiceQueues']||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x3]?_0x5429f4['attrs'][0x3][_0x31c2('0x45')]:undefined)||[]},{'name':_0x31c2('0x51'),'value':_0x5429f4[_0x31c2('0x51')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x4]?_0x5429f4['attrs'][0x4][_0x31c2('0x45')]:undefined)||_0x31c2('0x52')},{'name':_0x31c2('0x53'),'value':_0x5429f4[_0x31c2('0x53')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x5]?_0x5429f4[_0x31c2('0x44')][0x5][_0x31c2('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5429f4[_0x31c2('0x54')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x6]?_0x5429f4[_0x31c2('0x44')][0x6][_0x31c2('0x45')]:undefined)||''},{'name':_0x31c2('0x55'),'value':_0x5429f4[_0x31c2('0x55')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x7]?_0x5429f4[_0x31c2('0x44')][0x7][_0x31c2('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5429f4[_0x31c2('0x56')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x8]?_0x5429f4[_0x31c2('0x44')][0x8]['value']:undefined)||''},{'name':_0x31c2('0x57'),'value':_0x5429f4[_0x31c2('0x57')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x9]?_0x5429f4['attrs'][0x9][_0x31c2('0x45')]:undefined)||''},{'name':_0x31c2('0x58'),'value':_0x5429f4[_0x31c2('0x58')]||(_0x5429f4['attrs']&&_0x5429f4[_0x31c2('0x44')][0xa]?_0x5429f4[_0x31c2('0x44')][0xa][_0x31c2('0x45')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x5429f4[_0x31c2('0x5e')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x0]?_0x5429f4['attrs'][0x0][_0x31c2('0x41')]:undefined)||null,'value':_0x5429f4[_0x31c2('0x5f')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4[_0x31c2('0x44')][0x0]?_0x5429f4[_0x31c2('0x44')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x5429f4[_0x31c2('0x60')]||(_0x5429f4[_0x31c2('0x44')]&&_0x5429f4['attrs'][0x1]?_0x5429f4[_0x31c2('0x44')][0x1][_0x31c2('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x1ebc9a){logger[_0x31c2('0x2c')](_0x31c2('0x61'),JSON[_0x31c2('0x62')](_0x1ebc9a));return[];}}exports['create']=function(_0x4f4fdb,_0x1265f1){if(_0x4f4fdb[_0x31c2('0x63')]){_0x4f4fdb[_0x31c2('0x63')]['attrs']=widgetAttributes(_0x4f4fdb['body']);}return db[_0x31c2('0x32')][_0x31c2('0x64')](_0x4f4fdb[_0x31c2('0x63')],{})[_0x31c2('0x2b')](respondWithResult(_0x1265f1,0xc9))[_0x31c2('0x40')](handleError(_0x1265f1,null));};exports[_0x31c2('0x65')]=function(_0x486004,_0x327a1c){if(_0x486004[_0x31c2('0x63')]['id']){delete _0x486004[_0x31c2('0x63')]['id'];}_0x486004[_0x31c2('0x63')][_0x31c2('0x44')]=widgetAttributes(_0x486004[_0x31c2('0x63')]);return db['DashboardItem'][_0x31c2('0x3f')]({'where':{'id':_0x486004[_0x31c2('0x31')]['id']}})[_0x31c2('0x2b')](handleEntityNotFound(_0x327a1c,null))[_0x31c2('0x2b')](saveUpdates(_0x486004['body'],null))['then'](respondWithResult(_0x327a1c,null))[_0x31c2('0x40')](handleError(_0x327a1c,null));}; \ No newline at end of file +var _0xa6b0=['redis','defaults','./dashboardItem.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0xa8369a,_0x3d2319){var _0x4b74b7=function(_0x11d138){while(--_0x11d138){_0xa8369a['push'](_0xa8369a['shift']());}};_0x4b74b7(++_0x3d2319);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x56dc3c,_0x1e1ad1){_0x56dc3c=_0x56dc3c-0x0;var _0x51f8db=_0xa6b0[_0x56dc3c];return _0x51f8db;};'use strict';var emlformat=require(_0x0a6b('0x0'));var rimraf=require(_0x0a6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a6b('0x2'));var moment=require(_0x0a6b('0x3'));var BPromise=require(_0x0a6b('0x4'));var Mustache=require('mustache');var util=require(_0x0a6b('0x5'));var path=require(_0x0a6b('0x6'));var sox=require(_0x0a6b('0x7'));var csv=require(_0x0a6b('0x8'));var ejs=require(_0x0a6b('0x9'));var fs=require('fs');var fs_extra=require(_0x0a6b('0xa'));var _=require(_0x0a6b('0xb'));var squel=require(_0x0a6b('0xc'));var crypto=require(_0x0a6b('0xd'));var jsforce=require(_0x0a6b('0xe'));var deskjs=require(_0x0a6b('0xf'));var toCsv=require(_0x0a6b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a6b('0x10'));var authService=require(_0x0a6b('0x11'));var qs=require(_0x0a6b('0x12'));var as=require(_0x0a6b('0x13'));var hardwareService=require(_0x0a6b('0x14'));var logger=require(_0x0a6b('0x15'))(_0x0a6b('0x16'));var utils=require(_0x0a6b('0x17'));var config=require(_0x0a6b('0x18'));var licenseUtil=require(_0x0a6b('0x19'));var db=require(_0x0a6b('0x1a'))['db'];config[_0x0a6b('0x1b')]=_[_0x0a6b('0x1c')](config[_0x0a6b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a6b('0x1b')]));require(_0x0a6b('0x1d'))[_0x0a6b('0x1e')](socket);function respondWithStatusCode(_0x177e87,_0x8bbc03){_0x8bbc03=_0x8bbc03||0xcc;return function(_0x45fc9f){if(_0x45fc9f){return _0x177e87[_0x0a6b('0x1f')](_0x8bbc03);}return _0x177e87[_0x0a6b('0x20')](_0x8bbc03)[_0x0a6b('0x21')]();};}function respondWithResult(_0x9d7aba,_0x4797d1){_0x4797d1=_0x4797d1||0xc8;return function(_0xa36d75){if(_0xa36d75){return _0x9d7aba[_0x0a6b('0x20')](_0x4797d1)['json'](_0xa36d75);}};}function respondWithFilteredResult(_0x290f7f,_0x4d0e3b){return function(_0xcb412){if(_0xcb412){var _0x31f347=typeof _0x4d0e3b[_0x0a6b('0x22')]===_0x0a6b('0x23')&&typeof _0x4d0e3b['limit']===_0x0a6b('0x23');var _0x296162=_0xcb412['count'];var _0x19848c=_0x31f347?0x0:_0x4d0e3b[_0x0a6b('0x22')];var _0x1feb47=_0x31f347?_0xcb412['count']:_0x4d0e3b[_0x0a6b('0x22')]+_0x4d0e3b[_0x0a6b('0x24')];var _0x4077c6;if(_0x1feb47>=_0x296162){_0x1feb47=_0x296162;_0x4077c6=0xc8;}else{_0x4077c6=0xce;}_0x290f7f['status'](_0x4077c6);return _0x290f7f[_0x0a6b('0x25')](_0x0a6b('0x26'),_0x19848c+'-'+_0x1feb47+'/'+_0x296162)[_0x0a6b('0x27')](_0xcb412);}return null;};}function patchUpdates(_0x5e8206){return function(_0x122c19){try{jsonpatch['apply'](_0x122c19,_0x5e8206,!![]);}catch(_0x1e5065){return BPromise[_0x0a6b('0x28')](_0x1e5065);}return _0x122c19[_0x0a6b('0x29')]();};}function saveUpdates(_0x5c77fb,_0x2bd8b1){return function(_0x2e58fd){if(_0x2e58fd){return _0x2e58fd[_0x0a6b('0x2a')](_0x5c77fb)[_0x0a6b('0x2b')](function(_0x3b12a2){return _0x3b12a2;});}return null;};}function removeEntity(_0x5b2229,_0x3e6a1d){return function(_0x243779){if(_0x243779){return _0x243779[_0x0a6b('0x2c')]()['then'](function(){_0x5b2229[_0x0a6b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xecbf0c,_0x2ef965){return function(_0x45ae97){if(!_0x45ae97){_0xecbf0c['sendStatus'](0x194);}return _0x45ae97;};}function handleError(_0x526fdc,_0xf1ed3d){_0xf1ed3d=_0xf1ed3d||0x1f4;return function(_0xe01bba){logger[_0x0a6b('0x2d')](_0xe01bba[_0x0a6b('0x2e')]);if(_0xe01bba[_0x0a6b('0x2f')]){delete _0xe01bba[_0x0a6b('0x2f')];}_0x526fdc['status'](_0xf1ed3d)[_0x0a6b('0x30')](_0xe01bba);};}exports[_0x0a6b('0x31')]=function(_0x5f0b31,_0x4744d1){var _0x554145={'raw':![],'where':{'id':_0x5f0b31[_0x0a6b('0x32')]['id']}},_0x4eb516={};_0x4eb516[_0x0a6b('0x33')]=_[_0x0a6b('0x34')](db[_0x0a6b('0x35')][_0x0a6b('0x36')]);_0x4eb516['query']=_['keys'](_0x5f0b31[_0x0a6b('0x37')]);_0x4eb516[_0x0a6b('0x38')]=_[_0x0a6b('0x39')](_0x4eb516[_0x0a6b('0x33')],_0x4eb516['query']);_0x554145[_0x0a6b('0x3a')]=_[_0x0a6b('0x39')](_0x4eb516['model'],qs['fields'](_0x5f0b31[_0x0a6b('0x37')][_0x0a6b('0x3b')]));_0x554145['attributes']=_0x554145[_0x0a6b('0x3a')][_0x0a6b('0x3c')]?_0x554145[_0x0a6b('0x3a')]:_0x4eb516[_0x0a6b('0x33')];if(_0x5f0b31[_0x0a6b('0x37')][_0x0a6b('0x3d')]){_0x554145[_0x0a6b('0x3e')]=[{'all':!![]}];}_0x554145=_[_0x0a6b('0x3f')]({},_0x554145,_0x5f0b31[_0x0a6b('0x40')]);return db[_0x0a6b('0x35')][_0x0a6b('0x41')](_0x554145)[_0x0a6b('0x2b')](handleEntityNotFound(_0x4744d1,null))['then'](respondWithResult(_0x4744d1,null))[_0x0a6b('0x42')](handleError(_0x4744d1,null));};exports[_0x0a6b('0x2c')]=function(_0x50036b,_0x390d62){return db[_0x0a6b('0x35')][_0x0a6b('0x41')]({'where':{'id':_0x50036b[_0x0a6b('0x32')]['id']}})[_0x0a6b('0x2b')](handleEntityNotFound(_0x390d62,null))[_0x0a6b('0x2b')](removeEntity(_0x390d62,null))[_0x0a6b('0x42')](handleError(_0x390d62,null));};function widgetAttributes(_0x3f1be6){try{switch(_0x3f1be6[_0x0a6b('0x43')]){case'iframe':return[{'name':_0x0a6b('0x44'),'value':_0x3f1be6[_0x0a6b('0x44')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x0]?_0x3f1be6[_0x0a6b('0x45')][0x0][_0x0a6b('0x46')]:undefined)||_0x0a6b('0x47')}];case _0x0a6b('0x48'):return[{'name':_0x0a6b('0x49'),'value':_0x3f1be6['attrPath']||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x0]?_0x3f1be6[_0x0a6b('0x45')][0x0][_0x0a6b('0x46')]:undefined)||''}];case _0x0a6b('0x4a'):return[{'name':_0x0a6b('0x4b'),'value':_0x3f1be6[_0x0a6b('0x4b')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x0]?_0x3f1be6['attrs'][0x0][_0x0a6b('0x46')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x3f1be6[_0x0a6b('0x4c')]||(_0x3f1be6['attrs']&&_0x3f1be6['attrs'][0x1]?_0x3f1be6[_0x0a6b('0x45')][0x1][_0x0a6b('0x46')]:undefined)||_0x0a6b('0x4d')},{'name':'attrFontSize','value':_0x3f1be6[_0x0a6b('0x4e')]||(_0x3f1be6['attrs']&&_0x3f1be6['attrs'][0x2]?_0x3f1be6[_0x0a6b('0x45')][0x2]['value']:undefined)||0xc}];case _0x0a6b('0x4f'):return[{'name':'attrMetric','value':_0x3f1be6[_0x0a6b('0x50')]||(_0x3f1be6['attrs']&&_0x3f1be6['attrs'][0x0]?_0x3f1be6[_0x0a6b('0x45')][0x0][_0x0a6b('0x46')]:undefined)||_0x0a6b('0x51')},{'name':_0x0a6b('0x52'),'value':_0x3f1be6['attrVoiceQueues']||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x1]?_0x3f1be6[_0x0a6b('0x45')][0x1][_0x0a6b('0x46')]:undefined)||[]},{'name':_0x0a6b('0x4e'),'value':_0x3f1be6[_0x0a6b('0x4e')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6['attrs'][0x2]?_0x3f1be6[_0x0a6b('0x45')][0x2][_0x0a6b('0x46')]:undefined)||0x14},{'name':_0x0a6b('0x53'),'value':_0x3f1be6[_0x0a6b('0x53')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x3]?_0x3f1be6[_0x0a6b('0x45')][0x3][_0x0a6b('0x46')]:undefined)||_0x0a6b('0x54')},{'name':'attrEmailAccounts','value':_0x3f1be6[_0x0a6b('0x55')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x4]?_0x3f1be6[_0x0a6b('0x45')][0x4][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x56'),'value':_0x3f1be6[_0x0a6b('0x56')]||(_0x3f1be6['attrs']&&_0x3f1be6['attrs'][0x5]?_0x3f1be6[_0x0a6b('0x45')][0x5][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x57'),'value':_0x3f1be6[_0x0a6b('0x57')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x6]?_0x3f1be6[_0x0a6b('0x45')][0x6][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x58'),'value':_0x3f1be6['attrOpenchannelAccounts']||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x7]?_0x3f1be6[_0x0a6b('0x45')][0x7][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x59'),'value':_0x3f1be6['attrWhatsappAccounts']||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x8]?_0x3f1be6[_0x0a6b('0x45')][0x8][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x5a'),'value':_0x3f1be6[_0x0a6b('0x5a')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x9]?_0x3f1be6[_0x0a6b('0x45')][0x9][_0x0a6b('0x46')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x0a6b('0x5b'),'value':_0x3f1be6['attrSerie1']||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6['attrs'][0x0]?_0x3f1be6[_0x0a6b('0x45')][0x0][_0x0a6b('0x46')]:undefined)||_0x0a6b('0x51')},{'name':'attrSerie2','value':_0x3f1be6[_0x0a6b('0x5c')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6['attrs'][0x1]?_0x3f1be6[_0x0a6b('0x45')][0x1]['value']:undefined)||null},{'name':_0x0a6b('0x5d'),'value':_0x3f1be6[_0x0a6b('0x5d')]||(_0x3f1be6['attrs']&&_0x3f1be6[_0x0a6b('0x45')][0x2]?_0x3f1be6['attrs'][0x2][_0x0a6b('0x46')]:undefined)||null},{'name':_0x0a6b('0x52'),'value':_0x3f1be6[_0x0a6b('0x52')]||(_0x3f1be6['attrs']&&_0x3f1be6[_0x0a6b('0x45')][0x3]?_0x3f1be6[_0x0a6b('0x45')][0x3][_0x0a6b('0x46')]:undefined)||[]},{'name':_0x0a6b('0x53'),'value':_0x3f1be6[_0x0a6b('0x53')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6['attrs'][0x4]?_0x3f1be6['attrs'][0x4]['value']:undefined)||_0x0a6b('0x54')},{'name':'attrEmailAccounts','value':_0x3f1be6[_0x0a6b('0x55')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6['attrs'][0x5]?_0x3f1be6['attrs'][0x5]['value']:undefined)||''},{'name':_0x0a6b('0x56'),'value':_0x3f1be6[_0x0a6b('0x56')]||(_0x3f1be6['attrs']&&_0x3f1be6[_0x0a6b('0x45')][0x6]?_0x3f1be6[_0x0a6b('0x45')][0x6][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x57'),'value':_0x3f1be6[_0x0a6b('0x57')]||(_0x3f1be6['attrs']&&_0x3f1be6['attrs'][0x7]?_0x3f1be6['attrs'][0x7][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x58'),'value':_0x3f1be6['attrOpenchannelAccounts']||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6['attrs'][0x8]?_0x3f1be6[_0x0a6b('0x45')][0x8][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x59'),'value':_0x3f1be6[_0x0a6b('0x59')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6['attrs'][0x9]?_0x3f1be6[_0x0a6b('0x45')][0x9][_0x0a6b('0x46')]:undefined)||''},{'name':_0x0a6b('0x5a'),'value':_0x3f1be6[_0x0a6b('0x5a')]||(_0x3f1be6['attrs']&&_0x3f1be6[_0x0a6b('0x45')][0xa]?_0x3f1be6[_0x0a6b('0x45')][0xa][_0x0a6b('0x46')]:undefined)||''}];case _0x0a6b('0x5e'):return[{'name':_0x0a6b('0x5f'),'type':_0x3f1be6['reportType']||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x0]?_0x3f1be6[_0x0a6b('0x45')][0x0][_0x0a6b('0x43')]:undefined)||null,'value':_0x3f1be6[_0x0a6b('0x5f')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x0]?_0x3f1be6[_0x0a6b('0x45')][0x0]['value']:undefined)||null},{'name':_0x0a6b('0x60'),'value':_0x3f1be6[_0x0a6b('0x60')]||(_0x3f1be6[_0x0a6b('0x45')]&&_0x3f1be6[_0x0a6b('0x45')][0x1]?_0x3f1be6['attrs'][0x1][_0x0a6b('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x340be7){logger[_0x0a6b('0x2d')](_0x0a6b('0x61'),JSON[_0x0a6b('0x62')](_0x340be7));return[];}}exports[_0x0a6b('0x63')]=function(_0x3db026,_0x45f990){if(_0x3db026[_0x0a6b('0x64')]){_0x3db026[_0x0a6b('0x64')][_0x0a6b('0x45')]=widgetAttributes(_0x3db026[_0x0a6b('0x64')]);}return db[_0x0a6b('0x35')][_0x0a6b('0x63')](_0x3db026[_0x0a6b('0x64')],{})['then'](respondWithResult(_0x45f990,0xc9))['catch'](handleError(_0x45f990,null));};exports[_0x0a6b('0x2a')]=function(_0xd09cb2,_0x4a3161){if(_0xd09cb2[_0x0a6b('0x64')]['id']){delete _0xd09cb2[_0x0a6b('0x64')]['id'];}_0xd09cb2[_0x0a6b('0x64')][_0x0a6b('0x45')]=widgetAttributes(_0xd09cb2[_0x0a6b('0x64')]);return db[_0x0a6b('0x35')][_0x0a6b('0x41')]({'where':{'id':_0xd09cb2[_0x0a6b('0x32')]['id']}})[_0x0a6b('0x2b')](handleEntityNotFound(_0x4a3161,null))[_0x0a6b('0x2b')](saveUpdates(_0xd09cb2[_0x0a6b('0x64')],null))['then'](respondWithResult(_0x4a3161,null))[_0x0a6b('0x42')](handleError(_0x4a3161,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a2e0913..26d08b7 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 _0x5d2c=['remove','emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','update'];(function(_0x30c9aa,_0x32c3c6){var _0x1daccb=function(_0xb0b22c){while(--_0xb0b22c){_0x30c9aa['push'](_0x30c9aa['shift']());}};_0x1daccb(++_0x32c3c6);}(_0x5d2c,0x144));var _0xc5d2=function(_0x566d48,_0x1c25fd){_0x566d48=_0x566d48-0x0;var _0x18332a=_0x5d2c[_0x566d48];return _0x18332a;};'use strict';var EventEmitter=require(_0xc5d2('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xc5d2('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc5d2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc5d2('0x3'),'afterDestroy':_0xc5d2('0x4')};function emitEvent(_0x14f878){return function(_0xdbe6af,_0x2cfdef,_0x4662da){DashboardItemEvents[_0xc5d2('0x5')](_0x14f878+':'+_0xdbe6af['id'],_0xdbe6af);DashboardItemEvents[_0xc5d2('0x5')](_0x14f878,_0xdbe6af);_0x4662da(null);};}for(var e in events){if(events[_0xc5d2('0x6')](e)){var event=events[e];DashboardItem[_0xc5d2('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xe93d=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe93d,0x1be));var _0xde93=function(_0x135a2c,_0x4b9cc2){_0x135a2c=_0x135a2c-0x0;var _0x3a01eb=_0xe93d[_0x135a2c];return _0x3a01eb;};'use strict';var EventEmitter=require(_0xde93('0x0'));var DashboardItem=require(_0xde93('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xde93('0x2')](0x0);var events={'afterCreate':_0xde93('0x3'),'afterUpdate':'update','afterDestroy':_0xde93('0x4')};function emitEvent(_0x4b3958){return function(_0x4b806d,_0x19a11f,_0x75bbaa){DashboardItemEvents[_0xde93('0x5')](_0x4b3958+':'+_0x4b806d['id'],_0x4b806d);DashboardItemEvents[_0xde93('0x5')](_0x4b3958,_0x4b806d);_0x75bbaa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xde93('0x6')](e,emitEvent(event));}}module[_0xde93('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a6d0bb8..e18e6c1 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 _0xabde=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x58843d,_0x362610){var _0x3c7677=function(_0x56dda2){while(--_0x56dda2){_0x58843d['push'](_0x58843d['shift']());}};_0x3c7677(++_0x362610);}(_0xabde,0x8e));var _0xeabd=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0xabde[_0x2053ea];return _0x2232c4;};'use strict';var _=require(_0xeabd('0x0'));var util=require('util');var logger=require(_0xeabd('0x1'))('api');var moment=require(_0xeabd('0x2'));var BPromise=require(_0xeabd('0x3'));var rp=require(_0xeabd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeabd('0x5'));var attributes=require(_0xeabd('0x6'));module[_0xeabd('0x7')]=function(_0x1c9bfe,_0x21bca9){return _0x1c9bfe[_0xeabd('0x8')](_0xeabd('0x9'),attributes,{'tableName':_0xeabd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6812=['dashboard_items','api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem'];(function(_0x571714,_0x30d2b3){var _0x599a14=function(_0x3874fa){while(--_0x3874fa){_0x571714['push'](_0x571714['shift']());}};_0x599a14(++_0x30d2b3);}(_0x6812,0x121));var _0x2681=function(_0x1fcdb0,_0x198731){_0x1fcdb0=_0x1fcdb0-0x0;var _0xbca867=_0x6812[_0x1fcdb0];return _0xbca867;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2681('0x0'));var moment=require('moment');var BPromise=require(_0x2681('0x1'));var rp=require(_0x2681('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2681('0x3'));var config=require(_0x2681('0x4'));var attributes=require(_0x2681('0x5'));module['exports']=function(_0x482c52,_0x507a2c){return _0x482c52[_0x2681('0x6')](_0x2681('0x7'),attributes,{'tableName':_0x2681('0x8'),'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 d69a634..452ca5f 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 _0xc73b=['./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x5f5df5,_0x2f41c8){var _0x511d12=function(_0x33bbd6){while(--_0x33bbd6){_0x5f5df5['push'](_0x5f5df5['shift']());}};_0x511d12(++_0x2f41c8);}(_0xc73b,0x194));var _0xbc73=function(_0x20c4ea,_0x1d9044){_0x20c4ea=_0x20c4ea-0x0;var _0x2b1670=_0xc73b[_0x20c4ea];return _0x2b1670;};'use strict';var _=require(_0xbc73('0x0'));var util=require('util');var moment=require(_0xbc73('0x1'));var BPromise=require(_0xbc73('0x2'));var rs=require(_0xbc73('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc73('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc73('0x5'))(_0xbc73('0x6'));var config=require(_0xbc73('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xbc73('0x8')](config[_0xbc73('0x9')],{'host':_0xbc73('0xa'),'port':0x18eb});var socket=require(_0xbc73('0xb'))(new Redis(config[_0xbc73('0x9')]));require(_0xbc73('0xc'))[_0xbc73('0xd')](socket);function respondWithRpcPromise(_0x2870d7,_0xb89ebd,_0x4ee1f7){return new BPromise(function(_0x2d4363,_0x2e9190){return client[_0xbc73('0xe')](_0x2870d7,_0x4ee1f7)[_0xbc73('0xf')](function(_0x404008){logger[_0xbc73('0x10')](_0xbc73('0x11'),_0xb89ebd,_0xbc73('0x12'));logger[_0xbc73('0x13')](_0xbc73('0x14'),_0xb89ebd,_0xbc73('0x12'),JSON[_0xbc73('0x15')](_0x404008));if(_0x404008[_0xbc73('0x16')]){if(_0x404008[_0xbc73('0x16')]['code']===0x1f4){logger[_0xbc73('0x16')](_0xbc73('0x11'),_0xb89ebd,_0x404008[_0xbc73('0x16')]['message']);return _0x2e9190(_0x404008['error'][_0xbc73('0x17')]);}logger[_0xbc73('0x16')](_0xbc73('0x11'),_0xb89ebd,_0x404008[_0xbc73('0x16')][_0xbc73('0x17')]);return _0x2d4363(_0x404008[_0xbc73('0x16')]['message']);}else{logger[_0xbc73('0x10')](_0xbc73('0x11'),_0xb89ebd,'request\x20sent');_0x2d4363(_0x404008[_0xbc73('0x18')][_0xbc73('0x17')]);}})[_0xbc73('0x19')](function(_0x1aaa36){logger['error'](_0xbc73('0x11'),_0xb89ebd,_0x1aaa36);_0x2e9190(_0x1aaa36);});});} \ No newline at end of file +var _0x8979=['socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','debug','error','code','DashboardItem,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x566b90,_0x27378b){var _0x411e71=function(_0x233f73){while(--_0x233f73){_0x566b90['push'](_0x566b90['shift']());}};_0x411e71(++_0x27378b);}(_0x8979,0xcc));var _0x9897=function(_0x5a5936,_0x45ea99){_0x5a5936=_0x5a5936-0x0;var _0x147c49=_0x8979[_0x5a5936];return _0x147c49;};'use strict';var _=require('lodash');var util=require(_0x9897('0x0'));var moment=require(_0x9897('0x1'));var BPromise=require(_0x9897('0x2'));var rs=require(_0x9897('0x3'));var fs=require('fs');var Redis=require(_0x9897('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9897('0x5'))(_0x9897('0x6'));var config=require(_0x9897('0x7'));var jayson=require(_0x9897('0x8'));var client=jayson['client'][_0x9897('0x9')]({'port':0x232a});config[_0x9897('0xa')]=_[_0x9897('0xb')](config[_0x9897('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9897('0xc'))(new Redis(config[_0x9897('0xa')]));require(_0x9897('0xd'))['register'](socket);function respondWithRpcPromise(_0x575ce8,_0x1364f8,_0x18cdac){return new BPromise(function(_0x4c558b,_0x3ae597){return client[_0x9897('0xe')](_0x575ce8,_0x18cdac)[_0x9897('0xf')](function(_0x1b1cfd){logger[_0x9897('0x10')]('DashboardItem,\x20%s,\x20%s',_0x1364f8,_0x9897('0x11'));logger[_0x9897('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1364f8,_0x9897('0x11'),JSON['stringify'](_0x1b1cfd));if(_0x1b1cfd[_0x9897('0x13')]){if(_0x1b1cfd[_0x9897('0x13')][_0x9897('0x14')]===0x1f4){logger[_0x9897('0x13')](_0x9897('0x15'),_0x1364f8,_0x1b1cfd[_0x9897('0x13')][_0x9897('0x16')]);return _0x3ae597(_0x1b1cfd['error'][_0x9897('0x16')]);}logger[_0x9897('0x13')]('DashboardItem,\x20%s,\x20%s',_0x1364f8,_0x1b1cfd['error'][_0x9897('0x16')]);return _0x4c558b(_0x1b1cfd[_0x9897('0x13')]['message']);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x1364f8,_0x9897('0x11'));_0x4c558b(_0x1b1cfd['result']['message']);}})[_0x9897('0x17')](function(_0x255570){logger[_0x9897('0x13')](_0x9897('0x15'),_0x1364f8,_0x255570);_0x3ae597(_0x255570);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f807f68..5baca5b 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 _0x7a3a=['save','update','emit','removeListener','length','dashboardItem:'];(function(_0x3a0743,_0x490078){var _0x441203=function(_0x3268db){while(--_0x3268db){_0x3a0743['push'](_0x3a0743['shift']());}};_0x441203(++_0x490078);}(_0x7a3a,0x7e));var _0xa7a3=function(_0x478d21,_0xb238ec){_0x478d21=_0x478d21-0x0;var _0x571f38=_0x7a3a[_0x478d21];return _0x571f38;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xa7a3('0x0'),'remove',_0xa7a3('0x1')];function createListener(_0x1007c6,_0x46af8a){return function(_0xdadba5){_0x46af8a[_0xa7a3('0x2')](_0x1007c6,_0xdadba5);};}function removeListener(_0x3cece5,_0x3ae449){return function(){DashboardItemEvents[_0xa7a3('0x3')](_0x3cece5,_0x3ae449);};}exports['register']=function(_0x563ab0){for(var _0x314a44=0x0,_0x1567bc=events[_0xa7a3('0x4')];_0x314a44<_0x1567bc;_0x314a44++){var _0x4ffe5b=events[_0x314a44];var _0x2ba7b3=createListener(_0xa7a3('0x5')+_0x4ffe5b,_0x563ab0);DashboardItemEvents['on'](_0x4ffe5b,_0x2ba7b3);}}; \ No newline at end of file +var _0x37b2=['length','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0xc4f397,_0x143a64){var _0x43b531=function(_0x14684d){while(--_0x14684d){_0xc4f397['push'](_0xc4f397['shift']());}};_0x43b531(++_0x143a64);}(_0x37b2,0x1f1));var _0x237b=function(_0x55732c,_0x4da144){_0x55732c=_0x55732c-0x0;var _0x24887a=_0x37b2[_0x55732c];return _0x24887a;};'use strict';var DashboardItemEvents=require(_0x237b('0x0'));var events=[_0x237b('0x1'),_0x237b('0x2'),_0x237b('0x3')];function createListener(_0x501e4e,_0x2479b4){return function(_0x48a102){_0x2479b4[_0x237b('0x4')](_0x501e4e,_0x48a102);};}function removeListener(_0x337be8,_0x314a4d){return function(){DashboardItemEvents[_0x237b('0x5')](_0x337be8,_0x314a4d);};}exports[_0x237b('0x6')]=function(_0x27f0f0){for(var _0x464e65=0x0,_0x3426ef=events[_0x237b('0x7')];_0x464e65<_0x3426ef;_0x464e65++){var _0xc251a1=events[_0x464e65];var _0x4c850c=createListener('dashboardItem:'+_0xc251a1,_0x27f0f0);DashboardItemEvents['on'](_0xc251a1,_0x4c850c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 58e4460..fd650a5 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 _0x151d=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id'];(function(_0x17d45b,_0x41abad){var _0x2755ca=function(_0x45879d){while(--_0x45879d){_0x17d45b['push'](_0x17d45b['shift']());}};_0x2755ca(++_0x41abad);}(_0x151d,0x178));var _0xd151=function(_0x222528,_0x3f7ace){_0x222528=_0x222528-0x0;var _0x358ab0=_0x151d[_0x222528];return _0x358ab0;};'use strict';var multer=require(_0xd151('0x0'));var util=require(_0xd151('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd151('0x2'));var router=express['Router']();var fs_extra=require(_0xd151('0x3'));var auth=require(_0xd151('0x4'));var interaction=require(_0xd151('0x5'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xd151('0x6')](_0xd151('0x7'),auth[_0xd151('0x8')](),controller['show']);router[_0xd151('0x9')]('/',auth[_0xd151('0x8')](),controller[_0xd151('0xa')]);router[_0xd151('0xb')](_0xd151('0x7'),auth[_0xd151('0x8')](),controller[_0xd151('0xc')]);router[_0xd151('0xd')](_0xd151('0x7'),auth['isAuthenticated'](),controller[_0xd151('0xe')]);module[_0xd151('0xf')]=router; \ No newline at end of file +var _0xb3b7=['update','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','isAuthenticated','show','post','create','put','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb3b7,0xd3));var _0x7b3b=function(_0x2ef46e,_0x2c21bd){_0x2ef46e=_0x2ef46e-0x0;var _0x11431c=_0xb3b7[_0x2ef46e];return _0x11431c;};'use strict';var multer=require(_0x7b3b('0x0'));var util=require(_0x7b3b('0x1'));var path=require(_0x7b3b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7b3b('0x3'));var auth=require(_0x7b3b('0x4'));var interaction=require(_0x7b3b('0x5'));var config=require('../../config/environment');var controller=require(_0x7b3b('0x6'));router['get']('/:id',auth[_0x7b3b('0x7')](),controller[_0x7b3b('0x8')]);router[_0x7b3b('0x9')]('/',auth[_0x7b3b('0x7')](),controller[_0x7b3b('0xa')]);router[_0x7b3b('0xb')](_0x7b3b('0xc'),auth[_0x7b3b('0x7')](),controller[_0x7b3b('0xd')]);router[_0x7b3b('0xe')](_0x7b3b('0xc'),auth[_0x7b3b('0x7')](),controller[_0x7b3b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 0411231..e29f341 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 _0x7c7a=['STRING','ENUM','second','third','first','sequelize','exports'];(function(_0xb4bed2,_0x1ba3db){var _0x17a2a5=function(_0x3957c1){while(--_0x3957c1){_0xb4bed2['push'](_0xb4bed2['shift']());}};_0x17a2a5(++_0x1ba3db);}(_0x7c7a,0x1a9));var _0xa7c7=function(_0x367a0a,_0x257268){_0x367a0a=_0x367a0a-0x0;var _0x37610b=_0x7c7a[_0x367a0a];return _0x37610b;};'use strict';var Sequelize=require(_0xa7c7('0x0'));module[_0xa7c7('0x1')]={'name':{'type':Sequelize[_0xa7c7('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa7c7('0x3')]('first',_0xa7c7('0x4'),_0xa7c7('0x5')),'allowNull':![],'defaultValue':_0xa7c7('0x6')},'description':{'type':Sequelize[_0xa7c7('0x2')]}}; \ No newline at end of file +var _0x7a66=['third','first','sequelize','exports','STRING'];(function(_0x3296c3,_0xc96c4a){var _0x1fb66a=function(_0xa92688){while(--_0xa92688){_0x3296c3['push'](_0x3296c3['shift']());}};_0x1fb66a(++_0xc96c4a);}(_0x7a66,0x1a1));var _0x67a6=function(_0x19faae,_0x5697bc){_0x19faae=_0x19faae-0x0;var _0x363543=_0x7a66[_0x19faae];return _0x363543;};'use strict';var Sequelize=require(_0x67a6('0x0'));module[_0x67a6('0x1')]={'name':{'type':Sequelize[_0x67a6('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first','second',_0x67a6('0x3')),'allowNull':![],'defaultValue':_0x67a6('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 2697ddd..9a7dd8c 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 _0x0578=['order','sort','where','filter','merge','options','includeAll','Disposition','findAll','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','Dispositions','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x41e8e0,_0x19f969){var _0x3beb7f=function(_0x45ad8e){while(--_0x45ad8e){_0x41e8e0['push'](_0x41e8e0['shift']());}};_0x3beb7f(++_0x19f969);}(_0x0578,0x1b8));var _0x8057=function(_0x4b010a,_0x3f6824){_0x4b010a=_0x4b010a-0x0;var _0x5d5084=_0x0578[_0x4b010a];return _0x5d5084;};'use strict';var emlformat=require(_0x8057('0x0'));var rimraf=require(_0x8057('0x1'));var zipdir=require(_0x8057('0x2'));var jsonpatch=require(_0x8057('0x3'));var rp=require(_0x8057('0x4'));var moment=require('moment');var BPromise=require(_0x8057('0x5'));var Mustache=require(_0x8057('0x6'));var util=require('util');var path=require(_0x8057('0x7'));var sox=require(_0x8057('0x8'));var csv=require('to-csv');var ejs=require(_0x8057('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8057('0xa'));var squel=require(_0x8057('0xb'));var crypto=require('crypto');var jsforce=require(_0x8057('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8057('0xd'));var querystring=require(_0x8057('0xe'));var Papa=require(_0x8057('0xf'));var Redis=require(_0x8057('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8057('0x11'));var logger=require(_0x8057('0x12'))(_0x8057('0x13'));var utils=require(_0x8057('0x14'));var config=require(_0x8057('0x15'));var licenseUtil=require(_0x8057('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47337f,_0x27635d){_0x27635d=_0x27635d||0xcc;return function(_0x511aa1){if(_0x511aa1){return _0x47337f[_0x8057('0x17')](_0x27635d);}return _0x47337f[_0x8057('0x18')](_0x27635d)['end']();};}function respondWithResult(_0x1915c6,_0x826189){_0x826189=_0x826189||0xc8;return function(_0x4c9507){if(_0x4c9507){return _0x1915c6[_0x8057('0x18')](_0x826189)[_0x8057('0x19')](_0x4c9507);}};}function respondWithFilteredResult(_0x70a8a7,_0x582fd5){return function(_0x3b9dbf){if(_0x3b9dbf){var _0x44a708=typeof _0x582fd5[_0x8057('0x1a')]===_0x8057('0x1b')&&typeof _0x582fd5[_0x8057('0x1c')]===_0x8057('0x1b');var _0xa97fd0=_0x3b9dbf[_0x8057('0x1d')];var _0x39d555=_0x44a708?0x0:_0x582fd5[_0x8057('0x1a')];var _0x55ad72=_0x44a708?_0x3b9dbf[_0x8057('0x1d')]:_0x582fd5[_0x8057('0x1a')]+_0x582fd5[_0x8057('0x1c')];var _0x36a340;if(_0x55ad72>=_0xa97fd0){_0x55ad72=_0xa97fd0;_0x36a340=0xc8;}else{_0x36a340=0xce;}_0x70a8a7['status'](_0x36a340);return _0x70a8a7[_0x8057('0x1e')](_0x8057('0x1f'),_0x39d555+'-'+_0x55ad72+'/'+_0xa97fd0)[_0x8057('0x19')](_0x3b9dbf);}return null;};}function patchUpdates(_0x3e2230){return function(_0x3f3d36){try{jsonpatch[_0x8057('0x20')](_0x3f3d36,_0x3e2230,!![]);}catch(_0x7dcae9){return BPromise[_0x8057('0x21')](_0x7dcae9);}return _0x3f3d36[_0x8057('0x22')]();};}function saveUpdates(_0x6e8b75,_0x3d6d9d){return function(_0x23b50c){if(_0x23b50c){return _0x23b50c['update'](_0x6e8b75)[_0x8057('0x23')](function(_0x34c4c1){return _0x34c4c1;});}return null;};}function removeEntity(_0x597341,_0xef3504){return function(_0x1d74d1){if(_0x1d74d1){return _0x1d74d1['destroy']()[_0x8057('0x23')](function(){var _0x32be6c=_0x1d74d1['get']({'plain':!![]});var _0x3084b1=_0x8057('0x24');return db['UserProfileResource'][_0x8057('0x25')]({'where':{'type':_0x3084b1,'resourceId':_0x32be6c['id']}})[_0x8057('0x23')](function(){return _0x1d74d1;});})[_0x8057('0x23')](function(){_0x597341[_0x8057('0x18')](0xcc)[_0x8057('0x26')]();});}};}function handleEntityNotFound(_0x10306c,_0x4d6c46){return function(_0x2856a4){if(!_0x2856a4){_0x10306c[_0x8057('0x17')](0x194);}return _0x2856a4;};}function handleError(_0x163222,_0x4e2211){_0x4e2211=_0x4e2211||0x1f4;return function(_0x1402b6){logger[_0x8057('0x27')](_0x1402b6[_0x8057('0x28')]);if(_0x1402b6['name']){delete _0x1402b6[_0x8057('0x29')];}_0x163222['status'](_0x4e2211)['send'](_0x1402b6);};}exports[_0x8057('0x2a')]=function(_0x57cfc3,_0x50d3e0){var _0x242d87={},_0x50c9a2={},_0x1b24fc={'count':0x0,'rows':[]};var _0x53a4a8=_[_0x8057('0x2b')](db['Disposition'][_0x8057('0x2c')],function(_0x1c2730){return{'name':_0x1c2730[_0x8057('0x2d')],'type':_0x1c2730[_0x8057('0x2e')][_0x8057('0x2f')]};});_0x50c9a2[_0x8057('0x30')]=_['map'](_0x53a4a8,_0x8057('0x29'));_0x50c9a2[_0x8057('0x31')]=_[_0x8057('0x32')](_0x57cfc3['query']);_0x50c9a2[_0x8057('0x33')]=_[_0x8057('0x34')](_0x50c9a2[_0x8057('0x30')],_0x50c9a2['query']);_0x242d87[_0x8057('0x35')]=_[_0x8057('0x34')](_0x50c9a2['model'],qs['fields'](_0x57cfc3[_0x8057('0x31')][_0x8057('0x36')]));_0x242d87[_0x8057('0x35')]=_0x242d87[_0x8057('0x35')][_0x8057('0x37')]?_0x242d87[_0x8057('0x35')]:_0x50c9a2[_0x8057('0x30')];if(!_0x57cfc3[_0x8057('0x31')][_0x8057('0x38')](_0x8057('0x39'))){_0x242d87[_0x8057('0x1c')]=qs[_0x8057('0x1c')](_0x57cfc3['query'][_0x8057('0x1c')]);_0x242d87[_0x8057('0x1a')]=qs[_0x8057('0x1a')](_0x57cfc3[_0x8057('0x31')][_0x8057('0x1a')]);}_0x242d87[_0x8057('0x3a')]=qs[_0x8057('0x3b')](_0x57cfc3[_0x8057('0x31')][_0x8057('0x3b')]);_0x242d87[_0x8057('0x3c')]=qs[_0x8057('0x33')](_['pick'](_0x57cfc3[_0x8057('0x31')],_0x50c9a2[_0x8057('0x33')]),_0x53a4a8);if(_0x57cfc3['query'][_0x8057('0x3d')]){_0x242d87[_0x8057('0x3c')]=_[_0x8057('0x3e')](_0x242d87[_0x8057('0x3c')],{'$or':_[_0x8057('0x2b')](_0x53a4a8,function(_0x4f5aab){if(_0x4f5aab[_0x8057('0x2e')]!=='VIRTUAL'){var _0x595aff={};_0x595aff[_0x4f5aab['name']]={'$like':'%'+_0x57cfc3['query'][_0x8057('0x3d')]+'%'};return _0x595aff;}})});}_0x242d87=_[_0x8057('0x3e')]({},_0x242d87,_0x57cfc3[_0x8057('0x3f')]);var _0xcf2e73={'where':_0x242d87['where']};return db['Disposition']['count'](_0xcf2e73)[_0x8057('0x23')](function(_0xf604e5){_0x1b24fc[_0x8057('0x1d')]=_0xf604e5;if(_0x57cfc3[_0x8057('0x31')][_0x8057('0x40')]){_0x242d87['include']=[{'all':!![]}];}return db[_0x8057('0x41')][_0x8057('0x42')](_0x242d87);})['then'](function(_0x58c157){_0x1b24fc[_0x8057('0x43')]=_0x58c157;return _0x1b24fc;})[_0x8057('0x23')](respondWithFilteredResult(_0x50d3e0,_0x242d87))[_0x8057('0x44')](handleError(_0x50d3e0,null));};exports[_0x8057('0x45')]=function(_0x675162,_0x37aecb){var _0xa07416={'raw':!![],'where':{'id':_0x675162[_0x8057('0x46')]['id']}},_0x34face={};_0x34face[_0x8057('0x30')]=_[_0x8057('0x32')](db[_0x8057('0x41')][_0x8057('0x2c')]);_0x34face['query']=_[_0x8057('0x32')](_0x675162[_0x8057('0x31')]);_0x34face[_0x8057('0x33')]=_[_0x8057('0x34')](_0x34face['model'],_0x34face['query']);_0xa07416['attributes']=_[_0x8057('0x34')](_0x34face['model'],qs[_0x8057('0x36')](_0x675162['query']['fields']));_0xa07416[_0x8057('0x35')]=_0xa07416[_0x8057('0x35')]['length']?_0xa07416['attributes']:_0x34face[_0x8057('0x30')];if(_0x675162['query']['includeAll']){_0xa07416[_0x8057('0x47')]=[{'all':!![]}];}_0xa07416=_[_0x8057('0x3e')]({},_0xa07416,_0x675162['options']);return db[_0x8057('0x41')][_0x8057('0x48')](_0xa07416)[_0x8057('0x23')](handleEntityNotFound(_0x37aecb,null))[_0x8057('0x23')](respondWithResult(_0x37aecb,null))[_0x8057('0x44')](handleError(_0x37aecb,null));};exports[_0x8057('0x49')]=function(_0x15ea8c,_0x1f113d){return db[_0x8057('0x41')][_0x8057('0x49')](_0x15ea8c[_0x8057('0x4a')],{})[_0x8057('0x23')](function(_0x44eea9){var _0x128e21=_0x15ea8c[_0x8057('0x4b')][_0x8057('0x4c')]({'plain':!![]});if(!_0x128e21)throw new Error(_0x8057('0x4d'));if(_0x128e21[_0x8057('0x4e')]==='user'){var _0x224646=_0x44eea9[_0x8057('0x4c')]({'plain':!![]});var _0x4f9727=_0x8057('0x24');return db[_0x8057('0x4f')][_0x8057('0x48')]({'where':{'name':_0x4f9727,'userProfileId':_0x128e21[_0x8057('0x50')]},'raw':!![]})['then'](function(_0x3effdb){if(_0x3effdb&&_0x3effdb[_0x8057('0x51')]===0x0){return db['UserProfileResource'][_0x8057('0x49')]({'name':_0x224646['name'],'resourceId':_0x224646['id'],'type':_0x3effdb['name'],'sectionId':_0x3effdb['id']},{})[_0x8057('0x23')](function(){return _0x44eea9;});}else{return _0x44eea9;}})['catch'](function(_0x3b87fd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b87fd);throw _0x3b87fd;});}return _0x44eea9;})[_0x8057('0x23')](respondWithResult(_0x1f113d,0xc9))['catch'](handleError(_0x1f113d,null));};exports[_0x8057('0x52')]=function(_0x27d08b,_0x41170c){if(_0x27d08b[_0x8057('0x4a')]['id']){delete _0x27d08b[_0x8057('0x4a')]['id'];}return db[_0x8057('0x41')][_0x8057('0x48')]({'where':{'id':_0x27d08b[_0x8057('0x46')]['id']}})['then'](handleEntityNotFound(_0x41170c,null))[_0x8057('0x23')](saveUpdates(_0x27d08b[_0x8057('0x4a')],null))['then'](respondWithResult(_0x41170c,null))[_0x8057('0x44')](handleError(_0x41170c,null));};exports[_0x8057('0x25')]=function(_0x32f01c,_0x41562d){return db[_0x8057('0x41')][_0x8057('0x48')]({'where':{'id':_0x32f01c[_0x8057('0x46')]['id']}})[_0x8057('0x23')](handleEntityNotFound(_0x41562d,null))['then'](removeEntity(_0x41562d,null))['catch'](handleError(_0x41562d,null));}; \ No newline at end of file +var _0xe367=['keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','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','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','query'];(function(_0x391cd8,_0x37e968){var _0x5bdf6b=function(_0x1c1cb8){while(--_0x1c1cb8){_0x391cd8['push'](_0x391cd8['shift']());}};_0x5bdf6b(++_0x37e968);}(_0xe367,0x116));var _0x7e36=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xe367[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0x7e36('0x0'));var rimraf=require(_0x7e36('0x1'));var zipdir=require(_0x7e36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e36('0x3'));var moment=require(_0x7e36('0x4'));var BPromise=require(_0x7e36('0x5'));var Mustache=require(_0x7e36('0x6'));var util=require(_0x7e36('0x7'));var path=require(_0x7e36('0x8'));var sox=require(_0x7e36('0x9'));var csv=require(_0x7e36('0xa'));var ejs=require(_0x7e36('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7e36('0xc'));var crypto=require(_0x7e36('0xd'));var jsforce=require(_0x7e36('0xe'));var deskjs=require(_0x7e36('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7e36('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e36('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7e36('0x12'));var hardwareService=require(_0x7e36('0x13'));var logger=require(_0x7e36('0x14'))(_0x7e36('0x15'));var utils=require(_0x7e36('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7e36('0x17'));var db=require(_0x7e36('0x18'))['db'];function respondWithStatusCode(_0x278595,_0xee1285){_0xee1285=_0xee1285||0xcc;return function(_0xb77081){if(_0xb77081){return _0x278595[_0x7e36('0x19')](_0xee1285);}return _0x278595[_0x7e36('0x1a')](_0xee1285)[_0x7e36('0x1b')]();};}function respondWithResult(_0x2347d8,_0x3caab1){_0x3caab1=_0x3caab1||0xc8;return function(_0x5535af){if(_0x5535af){return _0x2347d8[_0x7e36('0x1a')](_0x3caab1)[_0x7e36('0x1c')](_0x5535af);}};}function respondWithFilteredResult(_0x25e684,_0x5b8e38){return function(_0x34b95b){if(_0x34b95b){var _0x1c7d7a=typeof _0x5b8e38[_0x7e36('0x1d')]==='undefined'&&typeof _0x5b8e38[_0x7e36('0x1e')]==='undefined';var _0x2536cf=_0x34b95b['count'];var _0xf4aed1=_0x1c7d7a?0x0:_0x5b8e38['offset'];var _0x3c492e=_0x1c7d7a?_0x34b95b[_0x7e36('0x1f')]:_0x5b8e38[_0x7e36('0x1d')]+_0x5b8e38[_0x7e36('0x1e')];var _0x3d46a2;if(_0x3c492e>=_0x2536cf){_0x3c492e=_0x2536cf;_0x3d46a2=0xc8;}else{_0x3d46a2=0xce;}_0x25e684[_0x7e36('0x1a')](_0x3d46a2);return _0x25e684['set'](_0x7e36('0x20'),_0xf4aed1+'-'+_0x3c492e+'/'+_0x2536cf)[_0x7e36('0x1c')](_0x34b95b);}return null;};}function patchUpdates(_0x48bd1f){return function(_0x5c0b1c){try{jsonpatch[_0x7e36('0x21')](_0x5c0b1c,_0x48bd1f,!![]);}catch(_0x58c391){return BPromise[_0x7e36('0x22')](_0x58c391);}return _0x5c0b1c['save']();};}function saveUpdates(_0x5e3590,_0x296d32){return function(_0x20d96c){if(_0x20d96c){return _0x20d96c[_0x7e36('0x23')](_0x5e3590)[_0x7e36('0x24')](function(_0x435d1a){return _0x435d1a;});}return null;};}function removeEntity(_0x4faf43,_0x1af5f9){return function(_0x3ec65e){if(_0x3ec65e){return _0x3ec65e['destroy']()[_0x7e36('0x24')](function(){var _0x42833d=_0x3ec65e[_0x7e36('0x25')]({'plain':!![]});var _0x1aed95='Dispositions';return db[_0x7e36('0x26')][_0x7e36('0x27')]({'where':{'type':_0x1aed95,'resourceId':_0x42833d['id']}})['then'](function(){return _0x3ec65e;});})[_0x7e36('0x24')](function(){_0x4faf43[_0x7e36('0x1a')](0xcc)[_0x7e36('0x1b')]();});}};}function handleEntityNotFound(_0x223bcd,_0x10a2c8){return function(_0x1241bf){if(!_0x1241bf){_0x223bcd[_0x7e36('0x19')](0x194);}return _0x1241bf;};}function handleError(_0x2c6183,_0x33124e){_0x33124e=_0x33124e||0x1f4;return function(_0x20b511){logger['error'](_0x20b511[_0x7e36('0x28')]);if(_0x20b511['name']){delete _0x20b511[_0x7e36('0x29')];}_0x2c6183['status'](_0x33124e)[_0x7e36('0x2a')](_0x20b511);};}exports[_0x7e36('0x2b')]=function(_0x1ab563,_0x4c991f){var _0x276125={},_0xba6001={},_0x4f3200={'count':0x0,'rows':[]};var _0x47e8bb=_[_0x7e36('0x2c')](db[_0x7e36('0x2d')][_0x7e36('0x2e')],function(_0x2e8f75){return{'name':_0x2e8f75[_0x7e36('0x2f')],'type':_0x2e8f75[_0x7e36('0x30')]['key']};});_0xba6001['model']=_[_0x7e36('0x2c')](_0x47e8bb,_0x7e36('0x29'));_0xba6001[_0x7e36('0x31')]=_[_0x7e36('0x32')](_0x1ab563['query']);_0xba6001[_0x7e36('0x33')]=_['intersection'](_0xba6001[_0x7e36('0x34')],_0xba6001[_0x7e36('0x31')]);_0x276125[_0x7e36('0x35')]=_['intersection'](_0xba6001['model'],qs[_0x7e36('0x36')](_0x1ab563['query'][_0x7e36('0x36')]));_0x276125[_0x7e36('0x35')]=_0x276125['attributes'][_0x7e36('0x37')]?_0x276125[_0x7e36('0x35')]:_0xba6001['model'];if(!_0x1ab563[_0x7e36('0x31')][_0x7e36('0x38')](_0x7e36('0x39'))){_0x276125[_0x7e36('0x1e')]=qs[_0x7e36('0x1e')](_0x1ab563[_0x7e36('0x31')][_0x7e36('0x1e')]);_0x276125[_0x7e36('0x1d')]=qs[_0x7e36('0x1d')](_0x1ab563[_0x7e36('0x31')]['offset']);}_0x276125[_0x7e36('0x3a')]=qs['sort'](_0x1ab563[_0x7e36('0x31')][_0x7e36('0x3b')]);_0x276125[_0x7e36('0x3c')]=qs['filters'](_[_0x7e36('0x3d')](_0x1ab563[_0x7e36('0x31')],_0xba6001[_0x7e36('0x33')]),_0x47e8bb);if(_0x1ab563[_0x7e36('0x31')][_0x7e36('0x3e')]){_0x276125[_0x7e36('0x3c')]=_[_0x7e36('0x3f')](_0x276125[_0x7e36('0x3c')],{'$or':_[_0x7e36('0x2c')](_0x47e8bb,function(_0x258f53){if(_0x258f53[_0x7e36('0x30')]!=='VIRTUAL'){var _0x38d6bc={};_0x38d6bc[_0x258f53[_0x7e36('0x29')]]={'$like':'%'+_0x1ab563['query']['filter']+'%'};return _0x38d6bc;}})});}_0x276125=_[_0x7e36('0x3f')]({},_0x276125,_0x1ab563[_0x7e36('0x40')]);var _0x4360ed={'where':_0x276125['where']};return db[_0x7e36('0x2d')][_0x7e36('0x1f')](_0x4360ed)[_0x7e36('0x24')](function(_0x5f7d2e){_0x4f3200[_0x7e36('0x1f')]=_0x5f7d2e;if(_0x1ab563[_0x7e36('0x31')]['includeAll']){_0x276125[_0x7e36('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x7e36('0x42')](_0x276125);})[_0x7e36('0x24')](function(_0x218c72){_0x4f3200[_0x7e36('0x43')]=_0x218c72;return _0x4f3200;})['then'](respondWithFilteredResult(_0x4c991f,_0x276125))[_0x7e36('0x44')](handleError(_0x4c991f,null));};exports[_0x7e36('0x45')]=function(_0x210bca,_0x5bf4c3){var _0x557274={'raw':!![],'where':{'id':_0x210bca[_0x7e36('0x46')]['id']}},_0x42abaf={};_0x42abaf['model']=_['keys'](db[_0x7e36('0x2d')]['rawAttributes']);_0x42abaf[_0x7e36('0x31')]=_[_0x7e36('0x32')](_0x210bca[_0x7e36('0x31')]);_0x42abaf[_0x7e36('0x33')]=_[_0x7e36('0x47')](_0x42abaf[_0x7e36('0x34')],_0x42abaf[_0x7e36('0x31')]);_0x557274[_0x7e36('0x35')]=_[_0x7e36('0x47')](_0x42abaf[_0x7e36('0x34')],qs['fields'](_0x210bca['query'][_0x7e36('0x36')]));_0x557274[_0x7e36('0x35')]=_0x557274[_0x7e36('0x35')][_0x7e36('0x37')]?_0x557274[_0x7e36('0x35')]:_0x42abaf[_0x7e36('0x34')];if(_0x210bca[_0x7e36('0x31')]['includeAll']){_0x557274[_0x7e36('0x41')]=[{'all':!![]}];}_0x557274=_['merge']({},_0x557274,_0x210bca[_0x7e36('0x40')]);return db[_0x7e36('0x2d')][_0x7e36('0x48')](_0x557274)[_0x7e36('0x24')](handleEntityNotFound(_0x5bf4c3,null))[_0x7e36('0x24')](respondWithResult(_0x5bf4c3,null))[_0x7e36('0x44')](handleError(_0x5bf4c3,null));};exports[_0x7e36('0x49')]=function(_0x234fee,_0x44969e){return db[_0x7e36('0x2d')][_0x7e36('0x49')](_0x234fee[_0x7e36('0x4a')],{})['then'](function(_0x5043f1){var _0x1d6f59=_0x234fee[_0x7e36('0x4b')]['get']({'plain':!![]});if(!_0x1d6f59)throw new Error(_0x7e36('0x4c'));if(_0x1d6f59[_0x7e36('0x4d')]===_0x7e36('0x4b')){var _0x14f32b=_0x5043f1[_0x7e36('0x25')]({'plain':!![]});var _0x5c8253=_0x7e36('0x4e');return db[_0x7e36('0x4f')][_0x7e36('0x48')]({'where':{'name':_0x5c8253,'userProfileId':_0x1d6f59[_0x7e36('0x50')]},'raw':!![]})[_0x7e36('0x24')](function(_0x57c7e8){if(_0x57c7e8&&_0x57c7e8['autoAssociation']===0x0){return db[_0x7e36('0x26')][_0x7e36('0x49')]({'name':_0x14f32b[_0x7e36('0x29')],'resourceId':_0x14f32b['id'],'type':_0x57c7e8['name'],'sectionId':_0x57c7e8['id']},{})[_0x7e36('0x24')](function(){return _0x5043f1;});}else{return _0x5043f1;}})[_0x7e36('0x44')](function(_0x14f18f){logger['error'](_0x7e36('0x51'),_0x14f18f);throw _0x14f18f;});}return _0x5043f1;})[_0x7e36('0x24')](respondWithResult(_0x44969e,0xc9))[_0x7e36('0x44')](handleError(_0x44969e,null));};exports[_0x7e36('0x23')]=function(_0x2d9bb6,_0xa09370){if(_0x2d9bb6[_0x7e36('0x4a')]['id']){delete _0x2d9bb6[_0x7e36('0x4a')]['id'];}return db[_0x7e36('0x2d')][_0x7e36('0x48')]({'where':{'id':_0x2d9bb6[_0x7e36('0x46')]['id']}})[_0x7e36('0x24')](handleEntityNotFound(_0xa09370,null))['then'](saveUpdates(_0x2d9bb6[_0x7e36('0x4a')],null))[_0x7e36('0x24')](respondWithResult(_0xa09370,null))['catch'](handleError(_0xa09370,null));};exports[_0x7e36('0x27')]=function(_0x1ad211,_0x33aac2){return db[_0x7e36('0x2d')][_0x7e36('0x48')]({'where':{'id':_0x1ad211[_0x7e36('0x46')]['id']}})[_0x7e36('0x24')](handleEntityNotFound(_0x33aac2,null))[_0x7e36('0x24')](removeEntity(_0x33aac2,null))['catch'](handleError(_0x33aac2,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f13d301..260f18e 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 _0x3c38=['api','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name_chat','name','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger'];(function(_0x10343,_0x25e7e9){var _0x2cc857=function(_0x2041b0){while(--_0x2041b0){_0x10343['push'](_0x10343['shift']());}};_0x2cc857(++_0x25e7e9);}(_0x3c38,0x9e));var _0x83c3=function(_0x147f4b,_0x5e3b4b){_0x147f4b=_0x147f4b-0x0;var _0x28f7eb=_0x3c38[_0x147f4b];return _0x28f7eb;};'use strict';var _=require(_0x83c3('0x0'));var util=require(_0x83c3('0x1'));var logger=require(_0x83c3('0x2'))(_0x83c3('0x3'));var moment=require('moment');var BPromise=require(_0x83c3('0x4'));var rp=require(_0x83c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x83c3('0x6'));var attributes=require(_0x83c3('0x7'));module[_0x83c3('0x8')]=function(_0xe2fdb4,_0x36d58e){return _0xe2fdb4[_0x83c3('0x9')](_0x83c3('0xa'),attributes,{'tableName':_0x83c3('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x83c3('0xc'),'fields':['name','ListId']},{'unique':!![],'name':_0x83c3('0xd'),'fields':[_0x83c3('0xe'),_0x83c3('0xf')]},{'unique':!![],'name':_0x83c3('0x10'),'fields':[_0x83c3('0xe'),'MailAccountId']},{'unique':!![],'name':_0x83c3('0x11'),'fields':[_0x83c3('0xe'),_0x83c3('0x12')]},{'unique':!![],'name':_0x83c3('0x13'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x83c3('0x14'),'fields':['name',_0x83c3('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x83c3('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf098=['request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api'];(function(_0x418927,_0x45de03){var _0x27b742=function(_0x3dc2a5){while(--_0x3dc2a5){_0x418927['push'](_0x418927['shift']());}};_0x27b742(++_0x45de03);}(_0xf098,0x194));var _0x8f09=function(_0xe81823,_0x324f10){_0xe81823=_0xe81823-0x0;var _0x5314dd=_0xf098[_0xe81823];return _0x5314dd;};'use strict';var _=require(_0x8f09('0x0'));var util=require(_0x8f09('0x1'));var logger=require(_0x8f09('0x2'))(_0x8f09('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f09('0x4'));var fs=require('fs');var path=require(_0x8f09('0x5'));var rimraf=require(_0x8f09('0x6'));var config=require('../../config/environment');var attributes=require(_0x8f09('0x7'));module[_0x8f09('0x8')]=function(_0x234b21,_0x3b9edc){return _0x234b21[_0x8f09('0x9')](_0x8f09('0xa'),attributes,{'tableName':_0x8f09('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8f09('0xc'),'fields':[_0x8f09('0xd'),_0x8f09('0xe')]},{'unique':!![],'name':_0x8f09('0xf'),'fields':['name',_0x8f09('0x10')]},{'unique':!![],'name':_0x8f09('0x11'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x8f09('0x12'),'fields':['name',_0x8f09('0x13')]},{'unique':!![],'name':_0x8f09('0x14'),'fields':[_0x8f09('0xd'),_0x8f09('0x15')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0x8f09('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x8f09('0xd'),_0x8f09('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 5dd7bca..c877f64 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(_0x340a4f,_0x491a32){var _0x5d8989=function(_0x25ca23){while(--_0x25ca23){_0x340a4f['push'](_0x340a4f['shift']());}};_0x5d8989(++_0x491a32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b045c,_0x6475dd){var _0xace9b4=function(_0x3fd054){while(--_0x3fd054){_0x5b045c['push'](_0x5b045c['shift']());}};_0xace9b4(++_0x6475dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 eca3508..d021eb7 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 _0x01ab=['./disposition.controller','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01ab,0xfa));var _0xb01a=function(_0x542d87,_0x3f1428){_0x542d87=_0x542d87-0x0;var _0x18f154=_0x01ab[_0x542d87];return _0x18f154;};'use strict';var multer=require('multer');var util=require(_0xb01a('0x0'));var path=require('path');var timeout=require(_0xb01a('0x1'));var express=require(_0xb01a('0x2'));var router=express['Router']();var fs_extra=require(_0xb01a('0x3'));var auth=require(_0xb01a('0x4'));var interaction=require(_0xb01a('0x5'));var config=require('../../config/environment');var controller=require(_0xb01a('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb01a('0x7')](_0xb01a('0x8'),auth[_0xb01a('0x9')](),controller['show']);router[_0xb01a('0xa')]('/',auth[_0xb01a('0x9')](),controller[_0xb01a('0xb')]);router[_0xb01a('0xc')](_0xb01a('0x8'),auth[_0xb01a('0x9')](),controller['update']);router[_0xb01a('0xd')](_0xb01a('0x8'),auth['isAuthenticated'](),controller[_0xb01a('0xe')]);module[_0xb01a('0xf')]=router; \ No newline at end of file +var _0x612b=['/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x4a6427,_0x294b6e){var _0x5e4d41=function(_0x56925d){while(--_0x56925d){_0x4a6427['push'](_0x4a6427['shift']());}};_0x5e4d41(++_0x294b6e);}(_0x612b,0x1d2));var _0xb612=function(_0x11d4ed,_0x486865){_0x11d4ed=_0x11d4ed-0x0;var _0x3869b8=_0x612b[_0x11d4ed];return _0x3869b8;};'use strict';var multer=require(_0xb612('0x0'));var util=require(_0xb612('0x1'));var path=require(_0xb612('0x2'));var timeout=require(_0xb612('0x3'));var express=require(_0xb612('0x4'));var router=express['Router']();var fs_extra=require(_0xb612('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb612('0x6'));var controller=require('./disposition.controller');router[_0xb612('0x7')]('/',auth[_0xb612('0x8')](),controller[_0xb612('0x9')]);router[_0xb612('0x7')](_0xb612('0xa'),auth[_0xb612('0x8')](),controller[_0xb612('0xb')]);router[_0xb612('0xc')]('/',auth[_0xb612('0x8')](),controller[_0xb612('0xd')]);router[_0xb612('0xe')](_0xb612('0xa'),auth[_0xb612('0x8')](),controller['update']);router[_0xb612('0xf')](_0xb612('0xa'),auth[_0xb612('0x8')](),controller['destroy']);module[_0xb612('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0bda7b0..669be6e 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 _0x9d9f=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x4207a6,_0x3a3110){var _0x42b37a=function(_0x574360){while(--_0x574360){_0x4207a6['push'](_0x4207a6['shift']());}};_0x42b37a(++_0x3a3110);}(_0x9d9f,0xb3));var _0xf9d9=function(_0x1ef7ff,_0x311060){_0x1ef7ff=_0x1ef7ff-0x0;var _0x3c8b3=_0x9d9f[_0x1ef7ff];return _0x3c8b3;};'use strict';var Sequelize=require(_0xf9d9('0x0'));module[_0xf9d9('0x1')]={'name':{'type':Sequelize[_0xf9d9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf9d9('0x2')]},'ecm':{'type':Sequelize[_0xf9d9('0x3')](_0xf9d9('0x4'),'no'),'defaultValue':_0xf9d9('0x4')},'headerinfo':{'type':Sequelize[_0xf9d9('0x2')],'defaultValue':_0xf9d9('0x5')},'localstationid':{'type':Sequelize[_0xf9d9('0x2')],'unique':_0xf9d9('0x6')},'minrate':{'type':Sequelize['ENUM'](_0xf9d9('0x7'),_0xf9d9('0x8'),_0xf9d9('0x9'),_0xf9d9('0xa'),_0xf9d9('0xb'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xf9d9('0x3')](_0xf9d9('0x7'),_0xf9d9('0x8'),_0xf9d9('0x9'),_0xf9d9('0xa'),_0xf9d9('0xb'),_0xf9d9('0xc')),'defaultValue':_0xf9d9('0xc')},'modem':{'type':Sequelize[_0xf9d9('0x2')],'defaultValue':_0xf9d9('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf9d9('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf9d9('0x3')](_0xf9d9('0xe'),_0xf9d9('0xf'),_0xf9d9('0x10'),_0xf9d9('0x11')),'defaultValue':_0xf9d9('0xe')},'key':{'type':Sequelize[_0xf9d9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf9d9('0x12')],'defaultValue':function(){return _0xf9d9('0x13');}},'notificationSound':{'type':Sequelize[_0xf9d9('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf9d9('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf9d9('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf9d9('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf9d9('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf9d9('0x15')],'allowNull':!![],'defaultValue':null,'comment':_0xf9d9('0x16')},'mandatoryDisposition':{'type':Sequelize[_0xf9d9('0x14')],'defaultValue':![],'comment':_0xf9d9('0x17'),'set':function(_0x592e94){if(!_0x592e94)this['setDataValue'](_0xf9d9('0x18'),null);this['setDataValue']('mandatoryDisposition',_0x592e94);}}}; \ No newline at end of file +var _0x63c7=['SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','14400','v17,v27,v29','INTEGER'];(function(_0x44f000,_0x4fcb9f){var _0xa7ffd1=function(_0xff7ddd){while(--_0xff7ddd){_0x44f000['push'](_0x44f000['shift']());}};_0xa7ffd1(++_0x4fcb9f);}(_0x63c7,0x9b));var _0x763c=function(_0xd4627b,_0xff27fe){_0xd4627b=_0xd4627b-0x0;var _0x30e307=_0x63c7[_0xd4627b];return _0x30e307;};'use strict';var Sequelize=require(_0x763c('0x0'));module[_0x763c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x763c('0x2')]},'ecm':{'type':Sequelize[_0x763c('0x3')](_0x763c('0x4'),'no'),'defaultValue':_0x763c('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x763c('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x763c('0x6')},'minrate':{'type':Sequelize[_0x763c('0x3')](_0x763c('0x7'),'4800',_0x763c('0x8'),_0x763c('0x9'),'12000',_0x763c('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x763c('0x7'),'4800','7200',_0x763c('0x9'),'12000',_0x763c('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x763c('0xb')},'gateway':{'type':Sequelize[_0x763c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x763c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x763c('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x763c('0xd'),_0x763c('0xe'),'DADHI','KHOMP'),'defaultValue':_0x763c('0xd')},'key':{'type':Sequelize[_0x763c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x763c('0xf')],'defaultValue':function(){return _0x763c('0x10');}},'notificationSound':{'type':Sequelize[_0x763c('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x763c('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x763c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x763c('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x763c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x763c('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x763c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x763c('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x763c('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xf2db08){if(!_0xf2db08)this['setDataValue'](_0x763c('0x12'),null);this[_0x763c('0x13')](_0x763c('0x14'),_0xf2db08);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8aa8bfa..cdd88b6 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 _0x7c02=['FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','includeAll','rows','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','FaxAccountId','Disposition','getDispositions','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','findOne','FaxApplication','findAndCountAll','priority','finally','getApplications','context','exten','app','system','description','Fax\x20Extension','appdata','Answer','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','push','Set','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','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','split','format','send','CmList','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','defaults','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','redis','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','apply','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause'];(function(_0x7b5cee,_0x165c1b){var _0x5b1278=function(_0x34ffc5){while(--_0x34ffc5){_0x7b5cee['push'](_0x7b5cee['shift']());}};_0x5b1278(++_0x165c1b);}(_0x7c02,0x14b));var _0x27c0=function(_0x1d26ff,_0x42ea78){_0x1d26ff=_0x1d26ff-0x0;var _0x511325=_0x7c02[_0x1d26ff];return _0x511325;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27c0('0x0'));var zipdir=require(_0x27c0('0x1'));var jsonpatch=require(_0x27c0('0x2'));var rp=require(_0x27c0('0x3'));var moment=require(_0x27c0('0x4'));var BPromise=require(_0x27c0('0x5'));var Mustache=require(_0x27c0('0x6'));var util=require(_0x27c0('0x7'));var path=require('path');var sox=require(_0x27c0('0x8'));var csv=require(_0x27c0('0x9'));var ejs=require(_0x27c0('0xa'));var fs=require('fs');var fs_extra=require(_0x27c0('0xb'));var _=require(_0x27c0('0xc'));var squel=require(_0x27c0('0xd'));var crypto=require(_0x27c0('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x27c0('0xf'));var Papa=require(_0x27c0('0x10'));var Redis=require('ioredis');var authService=require(_0x27c0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x27c0('0x12'));var hardwareService=require(_0x27c0('0x13'));var logger=require(_0x27c0('0x14'))(_0x27c0('0x15'));var utils=require(_0x27c0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x27c0('0x17'));var db=require(_0x27c0('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x27c0('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x27c0('0x1a')]));require('./faxAccount.socket')[_0x27c0('0x1b')](socket);var jayson=require(_0x27c0('0x1c'));var client=jayson[_0x27c0('0x1d')][_0x27c0('0x1e')]({'port':0x232c});var client9002=jayson[_0x27c0('0x1d')][_0x27c0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x184c80,_0x13fd5d,_0x2a3baf,_0x34ac04){return new BPromise(function(_0x4c4fc4,_0x4cad39){var _0xb30c08=_0x34ac04||client;return _0xb30c08[_0x27c0('0x1f')](_0x184c80,_0x2a3baf)[_0x27c0('0x20')](function(_0x1e139a){logger[_0x27c0('0x21')](_0x27c0('0x22'),_0x13fd5d,_0x27c0('0x23'));logger['debug'](_0x27c0('0x24'),_0x13fd5d,_0x27c0('0x23'),JSON[_0x27c0('0x25')](_0x1e139a));if(_0x1e139a[_0x27c0('0x26')]){if(_0x1e139a['error'][_0x27c0('0x27')]===0x1f4){logger[_0x27c0('0x26')](_0x27c0('0x22'),_0x13fd5d,_0x1e139a[_0x27c0('0x26')][_0x27c0('0x28')]);return _0x4cad39(_0x1e139a[_0x27c0('0x26')][_0x27c0('0x28')]);}logger[_0x27c0('0x26')](_0x27c0('0x22'),_0x13fd5d,_0x1e139a[_0x27c0('0x26')][_0x27c0('0x28')]);return _0x4c4fc4(_0x1e139a['error'][_0x27c0('0x28')]);}else{logger[_0x27c0('0x21')]('FaxAccount,\x20%s,\x20%s',_0x13fd5d,'request\x20sent');_0x4c4fc4(_0x1e139a['result']['message']);}})[_0x27c0('0x29')](function(_0x5ba31d){logger[_0x27c0('0x26')](_0x27c0('0x22'),_0x13fd5d,_0x5ba31d);_0x4cad39(_0x5ba31d);});});}function respondWithStatusCode(_0x33f29f,_0x3832ee){_0x3832ee=_0x3832ee||0xcc;return function(_0xe8d4d4){if(_0xe8d4d4){return _0x33f29f[_0x27c0('0x2a')](_0x3832ee);}return _0x33f29f[_0x27c0('0x2b')](_0x3832ee)[_0x27c0('0x2c')]();};}function respondWithResult(_0x195b0b,_0xaf00f7){_0xaf00f7=_0xaf00f7||0xc8;return function(_0x580faf){if(_0x580faf){return _0x195b0b[_0x27c0('0x2b')](_0xaf00f7)[_0x27c0('0x2d')](_0x580faf);}};}function respondWithFilteredResult(_0x183d6a,_0x307b58){return function(_0x3a3e90){if(_0x3a3e90){var _0x11f768=typeof _0x307b58[_0x27c0('0x2e')]===_0x27c0('0x2f')&&typeof _0x307b58['limit']==='undefined';var _0x2e0fc1=_0x3a3e90['count'];var _0x3a8798=_0x11f768?0x0:_0x307b58[_0x27c0('0x2e')];var _0x19d159=_0x11f768?_0x3a3e90[_0x27c0('0x30')]:_0x307b58[_0x27c0('0x2e')]+_0x307b58[_0x27c0('0x31')];var _0x1c0eda;if(_0x19d159>=_0x2e0fc1){_0x19d159=_0x2e0fc1;_0x1c0eda=0xc8;}else{_0x1c0eda=0xce;}_0x183d6a[_0x27c0('0x2b')](_0x1c0eda);return _0x183d6a['set']('Content-Range',_0x3a8798+'-'+_0x19d159+'/'+_0x2e0fc1)[_0x27c0('0x2d')](_0x3a3e90);}return null;};}function patchUpdates(_0x3a69c0){return function(_0x3352f1){try{jsonpatch[_0x27c0('0x32')](_0x3352f1,_0x3a69c0,!![]);}catch(_0x121efb){return BPromise['reject'](_0x121efb);}return _0x3352f1[_0x27c0('0x33')]();};}function saveUpdates(_0x30b119,_0x52c449){return function(_0x3a609c){if(_0x3a609c){return _0x3a609c['update'](_0x30b119)[_0x27c0('0x20')](function(_0x20cf2a){return _0x20cf2a;});}return null;};}function removeEntity(_0x2ea88b,_0x569deb){return function(_0x4a9f01){if(_0x4a9f01){return _0x4a9f01[_0x27c0('0x34')]()['then'](function(){var _0x34457b=_0x4a9f01[_0x27c0('0x35')]({'plain':!![]});var _0x886a17=_0x27c0('0x36');return db[_0x27c0('0x37')][_0x27c0('0x34')]({'where':{'type':_0x886a17,'resourceId':_0x34457b['id']}})[_0x27c0('0x20')](function(){return _0x4a9f01;});})['then'](function(){_0x2ea88b['status'](0xcc)[_0x27c0('0x2c')]();});}};}function handleEntityNotFound(_0x5ba172,_0x2778d1){return function(_0x7d98d0){if(!_0x7d98d0){_0x5ba172[_0x27c0('0x2a')](0x194);}return _0x7d98d0;};}function handleError(_0x39a5ee,_0xd2cbcb){_0xd2cbcb=_0xd2cbcb||0x1f4;return function(_0x4a1dd6){logger[_0x27c0('0x26')](_0x4a1dd6[_0x27c0('0x38')]);if(_0x4a1dd6[_0x27c0('0x39')]){delete _0x4a1dd6[_0x27c0('0x39')];}_0x39a5ee[_0x27c0('0x2b')](_0xd2cbcb)['send'](_0x4a1dd6);};}exports[_0x27c0('0x3a')]=function(_0x416249,_0xebe33c){var _0x551b2f={'include':[{'model':db[_0x27c0('0x3b')],'as':_0x27c0('0x3c')}]},_0x961037={},_0xbcecfa={'count':0x0,'rows':[]};var _0x44e154=_['map'](db[_0x27c0('0x3d')][_0x27c0('0x3e')],function(_0x39a810){return{'name':_0x39a810[_0x27c0('0x3f')],'type':_0x39a810[_0x27c0('0x40')][_0x27c0('0x41')]};});_0x961037[_0x27c0('0x42')]=_['map'](_0x44e154,_0x27c0('0x39'));_0x961037[_0x27c0('0x43')]=_[_0x27c0('0x44')](_0x416249['query']);_0x961037['filters']=_[_0x27c0('0x45')](_0x961037['model'],_0x961037['query']);_0x551b2f['attributes']=_[_0x27c0('0x45')](_0x961037[_0x27c0('0x42')],qs[_0x27c0('0x46')](_0x416249['query']['fields']));_0x551b2f['attributes']=_0x551b2f[_0x27c0('0x47')]['length']?_0x551b2f['attributes']:_0x961037[_0x27c0('0x42')];if(!_0x416249['query'][_0x27c0('0x48')](_0x27c0('0x49'))){_0x551b2f[_0x27c0('0x31')]=qs[_0x27c0('0x31')](_0x416249[_0x27c0('0x43')][_0x27c0('0x31')]);_0x551b2f['offset']=qs[_0x27c0('0x2e')](_0x416249['query'][_0x27c0('0x2e')]);}_0x551b2f[_0x27c0('0x4a')]=qs[_0x27c0('0x4b')](_0x416249[_0x27c0('0x43')][_0x27c0('0x4b')]);_0x551b2f['where']=qs[_0x27c0('0x4c')](_[_0x27c0('0x4d')](_0x416249['query'],_0x961037[_0x27c0('0x4c')]),_0x44e154);if(_0x416249[_0x27c0('0x43')][_0x27c0('0x4e')]){_0x551b2f[_0x27c0('0x4f')]=_[_0x27c0('0x50')](_0x551b2f[_0x27c0('0x4f')],{'$or':_[_0x27c0('0x51')](_0x44e154,function(_0x9319ef){if(_0x9319ef[_0x27c0('0x40')]!==_0x27c0('0x52')){var _0x1a4a45={};_0x1a4a45[_0x9319ef['name']]={'$like':'%'+_0x416249['query']['filter']+'%'};return _0x1a4a45;}})});}_0x551b2f=_[_0x27c0('0x50')]({},_0x551b2f,_0x416249['options']);var _0x159603={'where':_0x551b2f[_0x27c0('0x4f')]};return db[_0x27c0('0x3d')][_0x27c0('0x30')](_0x159603)[_0x27c0('0x20')](function(_0x2d1eac){_0xbcecfa[_0x27c0('0x30')]=_0x2d1eac;if(_0x416249[_0x27c0('0x43')][_0x27c0('0x53')]){_0x551b2f['include']=[{'all':!![]}];}return db[_0x27c0('0x3d')]['findAll'](_0x551b2f);})[_0x27c0('0x20')](function(_0x1c4dab){_0xbcecfa[_0x27c0('0x54')]=_0x1c4dab;return _0xbcecfa;})[_0x27c0('0x20')](respondWithFilteredResult(_0xebe33c,_0x551b2f))['catch'](handleError(_0xebe33c,null));};exports['show']=function(_0xad0b7f,_0x41bd34){var _0x2ae17b={'raw':![],'where':{'id':_0xad0b7f[_0x27c0('0x55')]['id']},'include':[{'model':db[_0x27c0('0x3b')],'as':_0x27c0('0x3c')}]},_0x53c653={};_0x53c653['model']=_[_0x27c0('0x44')](db[_0x27c0('0x3d')][_0x27c0('0x3e')]);_0x53c653[_0x27c0('0x43')]=_[_0x27c0('0x44')](_0xad0b7f[_0x27c0('0x43')]);_0x53c653[_0x27c0('0x4c')]=_[_0x27c0('0x45')](_0x53c653[_0x27c0('0x42')],_0x53c653[_0x27c0('0x43')]);_0x2ae17b[_0x27c0('0x47')]=_['intersection'](_0x53c653[_0x27c0('0x42')],qs['fields'](_0xad0b7f[_0x27c0('0x43')]['fields']));_0x2ae17b['attributes']=_0x2ae17b['attributes'][_0x27c0('0x56')]?_0x2ae17b[_0x27c0('0x47')]:_0x53c653[_0x27c0('0x42')];if(_0xad0b7f['query']['includeAll']){_0x2ae17b[_0x27c0('0x57')]=[{'all':!![]}];}_0x2ae17b=_[_0x27c0('0x50')]({},_0x2ae17b,_0xad0b7f['options']);return db[_0x27c0('0x3d')]['find'](_0x2ae17b)['then'](handleEntityNotFound(_0x41bd34,null))[_0x27c0('0x20')](respondWithResult(_0x41bd34,null))[_0x27c0('0x29')](handleError(_0x41bd34,null));};exports['create']=function(_0x16886e,_0x35b45f){return db['FaxAccount'][_0x27c0('0x58')](_0x16886e[_0x27c0('0x59')],{})[_0x27c0('0x20')](function(_0x4c5e6b){var _0x14e814=_0x16886e[_0x27c0('0x5a')][_0x27c0('0x35')]({'plain':!![]});if(!_0x14e814)throw new Error(_0x27c0('0x5b'));if(_0x14e814[_0x27c0('0x5c')]===_0x27c0('0x5a')){var _0x2d828e=_0x4c5e6b[_0x27c0('0x35')]({'plain':!![]});var _0x17b53e=_0x27c0('0x36');return db[_0x27c0('0x5d')][_0x27c0('0x5e')]({'where':{'name':_0x17b53e,'userProfileId':_0x14e814[_0x27c0('0x5f')]},'raw':!![]})['then'](function(_0x4c011f){if(_0x4c011f&&_0x4c011f[_0x27c0('0x60')]===0x0){return db[_0x27c0('0x37')][_0x27c0('0x58')]({'name':_0x2d828e['name'],'resourceId':_0x2d828e['id'],'type':_0x4c011f[_0x27c0('0x39')],'sectionId':_0x4c011f['id']},{})[_0x27c0('0x20')](function(){return _0x4c5e6b;});}else{return _0x4c5e6b;}})[_0x27c0('0x29')](function(_0x590051){logger[_0x27c0('0x26')](_0x27c0('0x61'),_0x590051);throw _0x590051;});}return _0x4c5e6b;})[_0x27c0('0x20')](respondWithResult(_0x35b45f,0xc9))[_0x27c0('0x29')](handleError(_0x35b45f,null));};exports[_0x27c0('0x62')]=function(_0x4cf429,_0x3523ff){if(_0x4cf429[_0x27c0('0x59')]['id']){delete _0x4cf429[_0x27c0('0x59')]['id'];}return db[_0x27c0('0x3d')][_0x27c0('0x5e')]({'where':{'id':_0x4cf429[_0x27c0('0x55')]['id']},'include':[{'model':db[_0x27c0('0x3b')],'as':_0x27c0('0x3c')}]})[_0x27c0('0x20')](handleEntityNotFound(_0x3523ff,null))[_0x27c0('0x20')](saveUpdates(_0x4cf429[_0x27c0('0x59')],null))[_0x27c0('0x20')](respondWithResult(_0x3523ff,null))[_0x27c0('0x29')](handleError(_0x3523ff,null));};exports[_0x27c0('0x34')]=function(_0x5dc24d,_0x21ec10){return db[_0x27c0('0x3d')][_0x27c0('0x5e')]({'where':{'id':_0x5dc24d[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x21ec10,null))[_0x27c0('0x20')](removeEntity(_0x21ec10,null))[_0x27c0('0x29')](handleError(_0x21ec10,null));};exports[_0x27c0('0x63')]=function(_0x2cf90c,_0x3cdf58){return db[_0x27c0('0x3d')]['describe']()[_0x27c0('0x20')](respondWithResult(_0x3cdf58,null))['catch'](handleError(_0x3cdf58,null));};exports['addDisposition']=function(_0x389a20,_0x40ef6e,_0x599431){if(_0x389a20[_0x27c0('0x59')]['id']){delete _0x389a20[_0x27c0('0x59')]['id'];}return db[_0x27c0('0x3d')][_0x27c0('0x5e')]({'where':{'id':_0x389a20[_0x27c0('0x55')]['id']}})['then'](handleEntityNotFound(_0x40ef6e,null))[_0x27c0('0x20')](function(_0xb46ca7){if(_0xb46ca7){_0x389a20[_0x27c0('0x59')][_0x27c0('0x64')]=_0xb46ca7['id'];return db[_0x27c0('0x65')]['create'](_0x389a20[_0x27c0('0x59')]);}})[_0x27c0('0x20')](respondWithResult(_0x40ef6e,null))[_0x27c0('0x29')](handleError(_0x40ef6e,null));};exports[_0x27c0('0x66')]=function(_0x34901d,_0x16dfce,_0x5cefad){var _0x4eb9c0={'raw':![],'where':{}};var _0x82923d={};var _0x25fee0={'count':0x0,'rows':[]};return db[_0x27c0('0x3d')]['findOne']({'where':{'id':_0x34901d[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x16dfce,null))[_0x27c0('0x20')](function(_0x35749d){if(_0x35749d){_0x82923d[_0x27c0('0x42')]=_[_0x27c0('0x44')](db[_0x27c0('0x65')][_0x27c0('0x3e')]);_0x82923d['query']=_[_0x27c0('0x44')](_0x34901d[_0x27c0('0x43')]);_0x82923d['filters']=_[_0x27c0('0x45')](_0x82923d[_0x27c0('0x42')],_0x82923d[_0x27c0('0x43')]);_0x4eb9c0[_0x27c0('0x47')]=_[_0x27c0('0x45')](_0x82923d['model'],qs[_0x27c0('0x46')](_0x34901d['query']['fields']));_0x4eb9c0[_0x27c0('0x47')]=_0x4eb9c0['attributes']['length']?_0x4eb9c0['attributes']:_0x82923d[_0x27c0('0x42')];if(!_0x34901d[_0x27c0('0x43')][_0x27c0('0x48')]('nolimit')){_0x4eb9c0[_0x27c0('0x31')]=qs['limit'](_0x34901d[_0x27c0('0x43')][_0x27c0('0x31')]);_0x4eb9c0[_0x27c0('0x2e')]=qs[_0x27c0('0x2e')](_0x34901d[_0x27c0('0x43')][_0x27c0('0x2e')]);}_0x4eb9c0[_0x27c0('0x4a')]=qs[_0x27c0('0x4b')](_0x34901d[_0x27c0('0x43')][_0x27c0('0x4b')]);_0x4eb9c0[_0x27c0('0x4f')]=qs['filters'](_['pick'](_0x34901d[_0x27c0('0x43')],_0x82923d[_0x27c0('0x4c')]));_0x4eb9c0['where'][_0x27c0('0x64')]=_0x35749d['id'];if(_0x34901d[_0x27c0('0x43')][_0x27c0('0x4e')]){_0x4eb9c0[_0x27c0('0x4f')]=_[_0x27c0('0x50')](_0x4eb9c0[_0x27c0('0x4f')],{'$or':_[_0x27c0('0x51')](_0x4eb9c0['attributes'],function(_0x75dea){var _0x559cc8={};_0x559cc8[_0x75dea]={'$like':'%'+_0x34901d[_0x27c0('0x43')][_0x27c0('0x4e')]+'%'};return _0x559cc8;})});}_0x4eb9c0=_['merge']({},_0x4eb9c0,_0x34901d[_0x27c0('0x67')]);return db['Disposition'][_0x27c0('0x30')]({'where':_0x4eb9c0[_0x27c0('0x4f')]})[_0x27c0('0x20')](function(_0x1fcfd8){_0x25fee0[_0x27c0('0x30')]=_0x1fcfd8;if(_0x34901d[_0x27c0('0x43')]['includeAll']){_0x4eb9c0[_0x27c0('0x57')]=[{'all':!![]}];}return db[_0x27c0('0x65')][_0x27c0('0x68')](_0x4eb9c0);})[_0x27c0('0x20')](function(_0x42edcf){_0x25fee0['rows']=_0x42edcf;return _0x25fee0;});}})[_0x27c0('0x20')](respondWithFilteredResult(_0x16dfce,_0x4eb9c0))[_0x27c0('0x29')](handleError(_0x16dfce,null));};exports[_0x27c0('0x69')]=function(_0x47b3fc,_0x52a7b5,_0x28cad9){return db[_0x27c0('0x3d')][_0x27c0('0x5e')]({'where':{'id':_0x47b3fc[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x52a7b5,null))[_0x27c0('0x20')](function(_0xd34db5){if(_0xd34db5){return _0xd34db5[_0x27c0('0x69')](_0x47b3fc['query'][_0x27c0('0x6a')]);}})['then'](respondWithStatusCode(_0x52a7b5,null))[_0x27c0('0x29')](handleError(_0x52a7b5,null));};exports[_0x27c0('0x6b')]=function(_0xeed127,_0x76c8ef,_0x5c26ef){if(_0xeed127[_0x27c0('0x59')]['id']){delete _0xeed127['body']['id'];}return db[_0x27c0('0x3d')]['find']({'where':{'id':_0xeed127[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x76c8ef,null))[_0x27c0('0x20')](function(_0x322d17){if(_0x322d17){_0xeed127[_0x27c0('0x59')][_0x27c0('0x64')]=_0x322d17['id'];return db[_0x27c0('0x6c')]['create'](_0xeed127['body']);}})['then'](respondWithResult(_0x76c8ef,null))[_0x27c0('0x29')](handleError(_0x76c8ef,null));};exports[_0x27c0('0x6d')]=function(_0x1fa863,_0x492236,_0x74c17c){var _0x109724={'raw':![],'where':{}};var _0x1b84e8={};var _0x44b264={'count':0x0,'rows':[]};return db[_0x27c0('0x3d')]['findOne']({'where':{'id':_0x1fa863[_0x27c0('0x55')]['id']}})['then'](handleEntityNotFound(_0x492236,null))[_0x27c0('0x20')](function(_0x6bd4b5){if(_0x6bd4b5){_0x1b84e8[_0x27c0('0x42')]=_['keys'](db[_0x27c0('0x6c')][_0x27c0('0x3e')]);_0x1b84e8['query']=_['keys'](_0x1fa863[_0x27c0('0x43')]);_0x1b84e8[_0x27c0('0x4c')]=_[_0x27c0('0x45')](_0x1b84e8[_0x27c0('0x42')],_0x1b84e8[_0x27c0('0x43')]);_0x109724[_0x27c0('0x47')]=_[_0x27c0('0x45')](_0x1b84e8[_0x27c0('0x42')],qs['fields'](_0x1fa863[_0x27c0('0x43')][_0x27c0('0x46')]));_0x109724['attributes']=_0x109724[_0x27c0('0x47')][_0x27c0('0x56')]?_0x109724['attributes']:_0x1b84e8[_0x27c0('0x42')];if(!_0x1fa863[_0x27c0('0x43')][_0x27c0('0x48')](_0x27c0('0x49'))){_0x109724['limit']=qs[_0x27c0('0x31')](_0x1fa863[_0x27c0('0x43')][_0x27c0('0x31')]);_0x109724['offset']=qs[_0x27c0('0x2e')](_0x1fa863[_0x27c0('0x43')][_0x27c0('0x2e')]);}_0x109724[_0x27c0('0x4a')]=qs['sort'](_0x1fa863['query'][_0x27c0('0x4b')]);_0x109724[_0x27c0('0x4f')]=qs[_0x27c0('0x4c')](_['pick'](_0x1fa863[_0x27c0('0x43')],_0x1b84e8[_0x27c0('0x4c')]));_0x109724[_0x27c0('0x4f')][_0x27c0('0x64')]=_0x6bd4b5['id'];if(_0x1fa863[_0x27c0('0x43')]['filter']){_0x109724[_0x27c0('0x4f')]=_[_0x27c0('0x50')](_0x109724[_0x27c0('0x4f')],{'$or':_['map'](_0x109724[_0x27c0('0x47')],function(_0x3c5d70){var _0x365d5a={};_0x365d5a[_0x3c5d70]={'$like':'%'+_0x1fa863[_0x27c0('0x43')][_0x27c0('0x4e')]+'%'};return _0x365d5a;})});}_0x109724=_['merge']({},_0x109724,_0x1fa863['options']);return db[_0x27c0('0x6c')]['count']({'where':_0x109724[_0x27c0('0x4f')]})[_0x27c0('0x20')](function(_0x32fea3){_0x44b264['count']=_0x32fea3;if(_0x1fa863[_0x27c0('0x43')]['includeAll']){_0x109724[_0x27c0('0x57')]=[{'all':!![]}];}return db[_0x27c0('0x6c')][_0x27c0('0x68')](_0x109724);})['then'](function(_0x90bac9){_0x44b264['rows']=_0x90bac9;return _0x44b264;});}})[_0x27c0('0x20')](respondWithFilteredResult(_0x492236,_0x109724))[_0x27c0('0x29')](handleError(_0x492236,null));};exports['removeAnswers']=function(_0x4df903,_0x209faf,_0x185741){return db[_0x27c0('0x3d')][_0x27c0('0x5e')]({'where':{'id':_0x4df903[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x209faf,null))['then'](function(_0x1f2f5e){if(_0x1f2f5e){return _0x1f2f5e[_0x27c0('0x6e')](_0x4df903[_0x27c0('0x43')][_0x27c0('0x6a')]);}})[_0x27c0('0x20')](respondWithStatusCode(_0x209faf,null))['catch'](handleError(_0x209faf,null));};exports[_0x27c0('0x6f')]=function(_0x3f2549,_0x233bc3,_0x11ed4c){return db[_0x27c0('0x70')][_0x27c0('0x5e')]({'where':{'id':_0x3f2549[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x233bc3,null))[_0x27c0('0x20')](function(_0x5ea77b){if(_0x5ea77b){return _0x5ea77b[_0x27c0('0x6f')](_0x3f2549[_0x27c0('0x59')][_0x27c0('0x6a')],_[_0x27c0('0x71')](_0x3f2549[_0x27c0('0x59')],[_0x27c0('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x233bc3,null))[_0x27c0('0x29')](handleError(_0x233bc3,null));};exports['getInteractions']=function(_0x45b312,_0x520ffd,_0x5eb088){var _0x4abe8a={'raw':![],'where':{}};var _0x3140d7={};var _0x542b8a={'count':0x0,'rows':[]};return db[_0x27c0('0x3d')]['findOne']({'where':{'id':_0x45b312[_0x27c0('0x55')]['id']}})['then'](handleEntityNotFound(_0x520ffd,null))['then'](function(_0x5ef58e){if(_0x5ef58e){_0x3140d7[_0x27c0('0x42')]=_[_0x27c0('0x44')](db['FaxInteraction'][_0x27c0('0x3e')]);_0x3140d7[_0x27c0('0x43')]=_[_0x27c0('0x44')](_0x45b312[_0x27c0('0x43')]);_0x3140d7[_0x27c0('0x4c')]=_[_0x27c0('0x45')](_0x3140d7['model'],_0x3140d7[_0x27c0('0x43')]);_0x4abe8a[_0x27c0('0x47')]=_[_0x27c0('0x45')](_0x3140d7[_0x27c0('0x42')],qs[_0x27c0('0x46')](_0x45b312[_0x27c0('0x43')][_0x27c0('0x46')]));_0x4abe8a[_0x27c0('0x47')]=_0x4abe8a[_0x27c0('0x47')][_0x27c0('0x56')]?_0x4abe8a[_0x27c0('0x47')]:_0x3140d7[_0x27c0('0x42')];if(!_0x45b312['query'][_0x27c0('0x48')](_0x27c0('0x49'))){_0x4abe8a[_0x27c0('0x31')]=qs['limit'](_0x45b312[_0x27c0('0x43')][_0x27c0('0x31')]);_0x4abe8a[_0x27c0('0x2e')]=qs[_0x27c0('0x2e')](_0x45b312[_0x27c0('0x43')]['offset']);}_0x4abe8a[_0x27c0('0x4a')]=qs[_0x27c0('0x4b')](_0x45b312[_0x27c0('0x43')][_0x27c0('0x4b')]);_0x4abe8a['where']=qs[_0x27c0('0x4c')](_['pick'](_0x45b312[_0x27c0('0x43')],_0x3140d7[_0x27c0('0x4c')]));_0x4abe8a['where'][_0x27c0('0x64')]=_0x5ef58e['id'];if(_0x45b312[_0x27c0('0x43')]['filter']){_0x4abe8a[_0x27c0('0x4f')]=_[_0x27c0('0x50')](_0x4abe8a[_0x27c0('0x4f')],{'$or':_[_0x27c0('0x51')](_0x4abe8a[_0x27c0('0x47')],function(_0x21f317){var _0x19629c={};_0x19629c[_0x21f317]={'$like':'%'+_0x45b312[_0x27c0('0x43')][_0x27c0('0x4e')]+'%'};return _0x19629c;})});}_0x4abe8a=_[_0x27c0('0x50')]({},_0x4abe8a,_0x45b312[_0x27c0('0x67')]);return db[_0x27c0('0x70')][_0x27c0('0x30')]({'where':_0x4abe8a['where']})['then'](function(_0x4b8449){_0x542b8a[_0x27c0('0x30')]=_0x4b8449;if(_0x45b312[_0x27c0('0x43')][_0x27c0('0x53')]){_0x4abe8a[_0x27c0('0x57')]=[{'model':db[_0x27c0('0x72')],'as':_0x27c0('0x73'),'required':![]},{'model':db[_0x27c0('0x74')],'as':_0x27c0('0x75'),'attributes':[_0x27c0('0x39'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x27c0('0x76'),'attributes':['id',_0x27c0('0x39'),_0x27c0('0x77')],'where':_0x45b312[_0x27c0('0x43')]['tag']?{'id':_0x45b312[_0x27c0('0x43')]['tag']}:undefined,'required':_0x45b312[_0x27c0('0x43')][_0x27c0('0x78')]?!![]:![]}];}return db[_0x27c0('0x70')][_0x27c0('0x68')](_0x4abe8a);})['then'](function(_0x519a09){_0x542b8a[_0x27c0('0x54')]=_0x519a09;return _0x542b8a;});}})[_0x27c0('0x20')](respondWithFilteredResult(_0x520ffd,_0x4abe8a))[_0x27c0('0x29')](handleError(_0x520ffd,null));};exports[_0x27c0('0x79')]=function(_0x5242a7,_0x491b17){var _0x55db88=_0x5242a7[_0x27c0('0x55')]['id'];var _0x264dc4=_0x5242a7[_0x27c0('0x59')];var _0x59471d=0xc8;var _0x556836=null;return db['sequelize'][_0x27c0('0x7a')]({'isolationLevel':db[_0x27c0('0x7b')][_0x27c0('0x7c')][_0x27c0('0x7d')]['READ_COMMITTED']},function(_0x2782fa){return db[_0x27c0('0x3d')][_0x27c0('0x7e')]({'where':{'id':_0x55db88},'transaction':_0x2782fa})['then'](function(_0x3d68a2){if(_0x3d68a2){return db[_0x27c0('0x7f')]['destroy']({'where':{'FaxAccountId':_0x55db88},'transaction':_0x2782fa})[_0x27c0('0x20')](function(){var _0x1cfba3=_['map'](_0x264dc4,function(_0x4d1764){_0x4d1764['FaxAccountId']=_0x55db88;return _0x4d1764;});return db['FaxApplication']['bulkCreate'](_0x1cfba3,{'transaction':_0x2782fa});});}else{_0x59471d=0x194;_0x556836=[];}});})[_0x27c0('0x20')](function(){if(_0x59471d!==0x194){return db[_0x27c0('0x7f')][_0x27c0('0x80')]({'where':{'FaxAccountId':_0x55db88},'order':_0x27c0('0x81')})[_0x27c0('0x20')](function(_0x5540cb){_0x556836=_0x5540cb;});}})[_0x27c0('0x29')](function(_0x4853d9){_0x59471d=0x1f4;logger[_0x27c0('0x26')](_0x4853d9['stack']);if(_0x4853d9[_0x27c0('0x39')]){delete _0x4853d9[_0x27c0('0x39')];}_0x556836=_0x4853d9;})[_0x27c0('0x82')](function(){if(_0x556836===null){_0x491b17['sendStatus'](_0x59471d);}else{if(_0x59471d===0x1f4){_0x491b17[_0x27c0('0x2b')](_0x59471d)['send'](_0x556836);}else{_0x491b17[_0x27c0('0x2b')](_0x59471d)['json'](_0x556836);}}});};exports['getApplications']=function(_0x50d683,_0x16dbc5,_0x56bdb4){var _0x41617e={};var _0x57487c={};var _0xb04ca5;var _0x3cb065;return db[_0x27c0('0x3d')][_0x27c0('0x7e')]({'where':{'id':_0x50d683['params']['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x16dbc5,null))[_0x27c0('0x20')](function(_0xc88fd0){if(_0xc88fd0){_0xb04ca5=_0xc88fd0;_0x57487c[_0x27c0('0x42')]=_[_0x27c0('0x44')](db['FaxApplication']['rawAttributes']);_0x57487c['query']=_[_0x27c0('0x44')](_0x50d683[_0x27c0('0x43')]);_0x57487c[_0x27c0('0x4c')]=_[_0x27c0('0x45')](_0x57487c['model'],_0x57487c[_0x27c0('0x43')]);_0x41617e[_0x27c0('0x47')]=_['intersection'](_0x57487c[_0x27c0('0x42')],qs[_0x27c0('0x46')](_0x50d683[_0x27c0('0x43')]['fields']));_0x41617e['attributes']=_0x41617e[_0x27c0('0x47')]['length']?_0x41617e[_0x27c0('0x47')]:_0x57487c['model'];_0x41617e[_0x27c0('0x4a')]=qs[_0x27c0('0x4b')](_0x50d683['query'][_0x27c0('0x4b')]);_0x41617e[_0x27c0('0x4f')]=qs[_0x27c0('0x4c')](_[_0x27c0('0x4d')](_0x50d683[_0x27c0('0x43')],_0x57487c[_0x27c0('0x4c')]));if(_0x50d683[_0x27c0('0x43')][_0x27c0('0x4e')]){_0x41617e[_0x27c0('0x4f')]=_[_0x27c0('0x50')](_0x41617e[_0x27c0('0x4f')],{'$or':_['map'](_0x41617e[_0x27c0('0x47')],function(_0x282928){var _0x3873e7={};_0x3873e7[_0x282928]={'$like':'%'+_0x50d683[_0x27c0('0x43')][_0x27c0('0x4e')]+'%'};return _0x3873e7;})});}_0x41617e=_[_0x27c0('0x50')]({},_0x41617e,_0x50d683['options']);return _0xb04ca5[_0x27c0('0x83')](_0x41617e);}})[_0x27c0('0x20')](function(_0x1ea67e){if(_0x1ea67e){_0x3cb065=_0x1ea67e[_0x27c0('0x56')];if(!_0x50d683[_0x27c0('0x43')]['hasOwnProperty'](_0x27c0('0x49'))){_0x41617e['limit']=qs['limit'](_0x50d683['query'][_0x27c0('0x31')]);_0x41617e[_0x27c0('0x2e')]=qs[_0x27c0('0x2e')](_0x50d683[_0x27c0('0x43')][_0x27c0('0x2e')]);}return _0xb04ca5['getApplications'](_0x41617e);}})[_0x27c0('0x20')](function(_0x137a06){if(_0x137a06){return _0x137a06?{'count':_0x3cb065,'rows':_0x137a06}:null;}})[_0x27c0('0x20')](respondWithResult(_0x16dbc5,null))[_0x27c0('0x29')](handleError(_0x16dbc5,null));};function Extension(_0x26068f,_0x2da6f1,_0x5c2387,_0xa33c72){this[_0x27c0('0x84')]='from-voip-provider';this[_0x27c0('0x85')]=_0x26068f['localstationid'];this[_0x27c0('0x86')]=_0xa33c72;this[_0x27c0('0x40')]=_0x27c0('0x87');this[_0x27c0('0x88')]=_0x27c0('0x89');this[_0x27c0('0x64')]=_0x26068f['id'];this[_0x27c0('0x81')]=_0x2da6f1;this[_0x27c0('0x8a')]=_0x5c2387;}function createExtensionsReciveFax(_0x2a7ae4){var _0x29ca81=0x1;var _0x122d78=[];_0x122d78['push'](new Extension(_0x2a7ae4,_0x29ca81,'',_0x27c0('0x8b')));_0x29ca81+=0x1;_0x122d78['push'](new Extension(_0x2a7ae4,_0x29ca81,'CDR(type)=inbound-fax','Set'));_0x29ca81+=0x1;for(var _0x1a974a in _0x2a7ae4){if(_0x2a7ae4['hasOwnProperty'](_0x1a974a)&&(_0x1a974a===_0x27c0('0x8c')||_0x1a974a==='localstationid'||_0x1a974a===_0x27c0('0x8d')||_0x1a974a===_0x27c0('0x8e')||_0x1a974a===_0x27c0('0x8f')||_0x1a974a===_0x27c0('0x90')||_0x1a974a===_0x27c0('0x91')||_0x1a974a===_0x27c0('0x92')||_0x1a974a===_0x27c0('0x93'))){_0x122d78[_0x27c0('0x94')](new Extension(_0x2a7ae4,_0x29ca81,'FAXOPT('+_0x1a974a+')='+_0x2a7ae4[_0x1a974a],_0x27c0('0x95')));_0x29ca81+=0x1;}}_0x122d78['push'](new Extension(_0x2a7ae4,_0x29ca81,'6',_0x27c0('0x96')));_0x29ca81+=0x1;_0x122d78['push'](new Extension(_0x2a7ae4,_0x29ca81,_0x27c0('0x97'),_0x27c0('0x98')));_0x29ca81=0x0;return _0x122d78;}exports['addAccountApplications']=function(_0xf6d5b3,_0x3a6f7e,_0x559f85){var _0x32fa76;return db[_0x27c0('0x7b')][_0x27c0('0x7a')](function(_0x325ce2){return db[_0x27c0('0x3d')]['create'](_0xf6d5b3[_0x27c0('0x59')],{'transaction':_0x325ce2})['then'](function(_0xd649d6){_0x32fa76=_0xd649d6['get']({'plain':!![]});return db[_0x27c0('0x99')][_0x27c0('0x9a')](createExtensionsReciveFax(_0x32fa76),{'transaction':_0x325ce2});});})[_0x27c0('0x20')](function(){return _0x32fa76;})['then'](respondWithResult(_0x3a6f7e,null))['catch'](handleError(_0x3a6f7e,null));};exports[_0x27c0('0x9b')]=function(_0xf0ab25,_0x4405ed,_0x5a0abf){var _0x53d8c5;return db[_0x27c0('0x7b')][_0x27c0('0x7a')](function(_0x496c0e){return db['FaxAccount']['update'](_0xf0ab25[_0x27c0('0x59')],{'where':{'id':_0xf0ab25[_0x27c0('0x59')]['id']},'transaction':_0x496c0e})[_0x27c0('0x20')](function(_0x3375aa){return db['VoiceExtension'][_0x27c0('0x34')]({'where':{'FaxAccountId':_0xf0ab25['body']['id']},'transaction':_0x496c0e})[_0x27c0('0x20')](function(_0x2aae21){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_['omit'](_0xf0ab25[_0x27c0('0x59')],[_0x27c0('0x9c'),_0x27c0('0x41'),_0x27c0('0x9d'),_0x27c0('0x9e'),'TrunkId',_0x27c0('0x9f')])),{'transaction':_0x496c0e});});});})[_0x27c0('0x20')](function(){return db[_0x27c0('0x3d')]['findById'](_0xf0ab25[_0x27c0('0x59')]['id']);})['then'](respondWithResult(_0x4405ed,null))[_0x27c0('0x29')](handleError(_0x4405ed,null));};exports[_0x27c0('0xa0')]=function(_0xd520f5,_0x56d06f,_0x3a368e){var _0x4379a9={'raw':!![],'where':{}};var _0x27436e={};var _0x319b3b={'count':0x0,'rows':[]};return db[_0x27c0('0x3d')][_0x27c0('0x7e')]({'where':{'id':_0xd520f5[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x56d06f,null))[_0x27c0('0x20')](function(_0x512b2d){if(_0x512b2d){_0x27436e[_0x27c0('0x42')]=_['keys'](db[_0x27c0('0xa1')][_0x27c0('0x3e')]);_0x27436e[_0x27c0('0x43')]=_[_0x27c0('0x44')](_0xd520f5[_0x27c0('0x43')]);_0x27436e[_0x27c0('0x4c')]=_[_0x27c0('0x45')](_0x27436e[_0x27c0('0x42')],_0x27436e[_0x27c0('0x43')]);_0x4379a9[_0x27c0('0x47')]=_[_0x27c0('0x45')](_0x27436e[_0x27c0('0x42')],qs[_0x27c0('0x46')](_0xd520f5['query'][_0x27c0('0x46')]));_0x4379a9['attributes']=_0x4379a9[_0x27c0('0x47')][_0x27c0('0x56')]?_0x4379a9['attributes']:_0x27436e[_0x27c0('0x42')];if(!_0xd520f5[_0x27c0('0x43')]['hasOwnProperty']('nolimit')){_0x4379a9[_0x27c0('0x31')]=qs[_0x27c0('0x31')](_0xd520f5[_0x27c0('0x43')][_0x27c0('0x31')]);_0x4379a9['offset']=qs['offset'](_0xd520f5['query'][_0x27c0('0x2e')]);}_0x4379a9[_0x27c0('0x4a')]=qs[_0x27c0('0x4b')](_0xd520f5['query'][_0x27c0('0x4b')]);_0x4379a9['where']=qs[_0x27c0('0x4c')](_[_0x27c0('0x4d')](_0xd520f5[_0x27c0('0x43')],_0x27436e['filters']));_0x4379a9[_0x27c0('0x4f')][_0x27c0('0x64')]=_0x512b2d['id'];if(_0xd520f5['query']['filter']){_0x4379a9['where']=_[_0x27c0('0x50')](_0x4379a9['where'],{'$or':_['map'](_0x4379a9['attributes'],function(_0x5c61fa){var _0x1c0d69={};_0x1c0d69[_0x5c61fa]={'$like':'%'+_0xd520f5['query'][_0x27c0('0x4e')]+'%'};return _0x1c0d69;})});}if(_0xd520f5['query'][_0x27c0('0xa2')]){var _0x20c02c=_0xd520f5['query'][_0x27c0('0xa2')][_0x27c0('0xa3')](',');var _0x6d83c3={};_0x6d83c3[_0x20c02c[0x0]]={'$gte':moment(_0x20c02c[0x1])[_0x27c0('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4379a9['where']=_[_0x27c0('0x50')](_0x4379a9['where'],_0x6d83c3);}_0x4379a9=_['merge']({},_0x4379a9,_0xd520f5['options']);return db[_0x27c0('0xa1')][_0x27c0('0x30')]({'where':_0x4379a9['where']})[_0x27c0('0x20')](function(_0x4293af){_0x319b3b[_0x27c0('0x30')]=_0x4293af;if(_0xd520f5[_0x27c0('0x43')][_0x27c0('0x53')]){_0x4379a9[_0x27c0('0x57')]=[{'all':!![]}];}return db[_0x27c0('0xa1')][_0x27c0('0x68')](_0x4379a9);})[_0x27c0('0x20')](function(_0x2148b3){_0x319b3b[_0x27c0('0x54')]=_0x2148b3;return _0x319b3b;});}})[_0x27c0('0x20')](respondWithFilteredResult(_0x56d06f,_0x4379a9))[_0x27c0('0x29')](handleError(_0x56d06f,null));};exports[_0x27c0('0xa5')]=function(_0x48f374,_0x22ab00,_0x59a2bb){var _0x2ead70,_0x1dbaca={},_0x31cde5;if(_0x48f374[_0x27c0('0x59')]['to']){_0x31cde5=_0x48f374[_0x27c0('0x59')]['to'][0x0];}return db[_0x27c0('0x3d')][_0x27c0('0x5e')]({'where':{'id':_0x48f374['params']['id']},'include':[{'model':db[_0x27c0('0xa6')],'as':'List','include':[{'model':db[_0x27c0('0x72')],'as':_0x27c0('0xa7'),'where':{'fax':_0x31cde5},'limit':0x1,'order':[[_0x27c0('0x9e'),_0x27c0('0xa8')]]}]}]})[_0x27c0('0x20')](handleEntityNotFound(_0x22ab00,null))[_0x27c0('0x20')](function(_0x235179){_0x2ead70=_0x235179;if(_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')]&&_0x48f374['body'][_0x27c0('0xa9')][_0x27c0('0x56')]){for(var _0x114dc3=0x0;_0x114dc3<_0x48f374['body'][_0x27c0('0xa9')][_0x27c0('0x56')];_0x114dc3+=0x1){_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][_0x114dc3]={'filename':_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][_0x114dc3]['name'],'id':_0x48f374['body'][_0x27c0('0xa9')][_0x114dc3]['id'],'path':path[_0x27c0('0xaa')](config[_0x27c0('0xab')],'server/files/attachments',_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][_0x114dc3]['basename'])};}}return respondWithRpcPromise(_0x27c0('0xac'),'CheckAfterSend',{'FaxAccountId':_[_0x27c0('0xad')](_0x48f374[_0x27c0('0x55')]['id'])?undefined:_0x48f374[_0x27c0('0x55')]['id'],'path':_[_0x27c0('0xad')](_0x48f374['body'][_0x27c0('0xa9')][0x0][_0x27c0('0xae')])?undefined:_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][0x0][_0x27c0('0xae')],'fax':_[_0x27c0('0xad')](_0x48f374['body']['to'][0x0])?undefined:_0x48f374[_0x27c0('0x59')]['to'][0x0]},client9002);})[_0x27c0('0x20')](function(){if(_0x2ead70){if(_[_0x27c0('0xad')](_0x48f374[_0x27c0('0x59')][_0x27c0('0xaf')])){_0x48f374[_0x27c0('0x59')][_0x27c0('0xaf')]=util[_0x27c0('0xa4')](_0x27c0('0xb0'),_0x2ead70[_0x27c0('0x39')],_0x2ead70[_0x27c0('0xb1')]);}if(_0x2ead70[_0x27c0('0xb2')]){if(_0x2ead70['List']['Contacts'][_0x27c0('0x56')]){return _0x2ead70['List']['Contacts'][0x0];}else{return db[_0x27c0('0x72')][_0x27c0('0x58')](_[_0x27c0('0xb3')](_0x48f374['body'],{'firstName':_0x48f374[_0x27c0('0x59')]['to'][0x0],'phone':_0x48f374[_0x27c0('0x59')]['to'][0x0],'fax':_0x48f374[_0x27c0('0x59')]['to'][0x0],'ListId':_0x2ead70['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x5ef25a){if(_0x5ef25a){return db[_0x27c0('0x70')][_0x27c0('0x5e')]({'where':{'ContactId':_0x5ef25a['id'],'closed':![],'FaxAccountId':_0x2ead70['id']}})[_0x27c0('0x20')](function(_0xe99f98){if(_0xe99f98){return[_0xe99f98,![]];}return db[_0x27c0('0x70')][_0x27c0('0x58')]({'UserId':_0x48f374['user']['id'],'ContactId':_0x5ef25a['id'],'FaxAccountId':_0x2ead70['id'],'fax':_0x48f374[_0x27c0('0x59')]['to'][0x0],'firstMsgDirection':_0x27c0('0xb4'),'Messages':[_[_0x27c0('0x50')](_0x48f374['body'],{'read':![],'body':_0x48f374['body'][_0x27c0('0xa9')][0x0][_0x27c0('0xb5')],'FaxAccountId':_0x2ead70['id'],'UserId':_0x48f374[_0x27c0('0x5a')]['id'],'ContactId':_0x5ef25a['id'],'AttachmentId':_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x27c0('0xa1')],'as':_0x27c0('0xb6')}]})['then'](function(_0xee443f){return[_0xee443f,!![]];});});}else{throw new Error(_0x27c0('0xb7'));}})[_0x27c0('0xb8')](function(_0x2de8b8,_0x5f30fc){if(_0x5f30fc){return _0x2de8b8;}return db[_0x27c0('0xa1')][_0x27c0('0x58')]({'direction':'out','read':![],'body':_0x48f374['body'][_0x27c0('0xa9')][0x0][_0x27c0('0xb5')],'FaxAccountId':_0x2ead70['id'],'FaxInteractionId':_0x2de8b8['id'],'UserId':_0x48f374['user']['id'],'ContactId':_0x2de8b8[_0x27c0('0xb9')],'AttachmentId':_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][0x0]['id']})['then'](function(_0x43ceb8){_0x2de8b8['dataValues'][_0x27c0('0xb6')]=[];_0x2de8b8[_0x27c0('0xba')][_0x27c0('0xb6')][_0x27c0('0x94')](_0x43ceb8[_0x27c0('0xba')]);return _0x2de8b8;});})[_0x27c0('0x20')](function(_0x773eb7){respondWithRpcPromise(_0x27c0('0xbb'),'SendFax',{'FaxAccountId':_[_0x27c0('0xad')](_0x48f374[_0x27c0('0x55')]['id'])?undefined:_0x48f374[_0x27c0('0x55')]['id'],'path':_['isNil'](_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][0x0]['path'])?undefined:_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][0x0][_0x27c0('0xae')],'fax':_[_0x27c0('0xad')](_0x48f374[_0x27c0('0x59')]['to'][0x0])?undefined:_0x48f374['body']['to'][0x0],'AttachmentId':_0x48f374[_0x27c0('0x59')][_0x27c0('0xa9')][0x0]['id']},client9002)[_0x27c0('0x20')](function(_0xce0ee6){logger[_0x27c0('0x21')](_0x27c0('0xbc'),_0xce0ee6);})[_0x27c0('0x29')](function(_0x19b9e2){logger[_0x27c0('0x21')]('SendFaxRpc,\x20%s',_0x19b9e2);});return _0x773eb7;})[_0x27c0('0x20')](respondWithResult(_0x22ab00,null))[_0x27c0('0x29')](handleError(_0x22ab00,null));};exports['addAgents']=function(_0x306baa,_0x5e6cfa,_0x12631a){return db['FaxAccount'][_0x27c0('0x5e')]({'where':{'id':_0x306baa[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x5e6cfa,null))[_0x27c0('0x20')](function(_0x37d16e){if(_0x37d16e){return _0x37d16e[_0x27c0('0xbd')](_0x306baa['body'][_0x27c0('0x6a')],_[_0x27c0('0x71')](_0x306baa[_0x27c0('0x59')],[_0x27c0('0x6a'),'id'])||{})[_0x27c0('0xb8')](function(_0x57c8c7){for(var _0x1945d9=0x0;_0x1945d9<_0x306baa[_0x27c0('0x59')][_0x27c0('0x6a')][_0x27c0('0x56')];_0x1945d9+=0x1){socket[_0x27c0('0xbe')](_0x27c0('0xbf'),{'UserId':Number(_0x306baa[_0x27c0('0x59')][_0x27c0('0x6a')][_0x1945d9]),'FaxAccountId':Number(_0x306baa[_0x27c0('0x55')]['id'])});}return _0x57c8c7;});}})[_0x27c0('0x20')](respondWithResult(_0x5e6cfa,null))[_0x27c0('0x29')](handleError(_0x5e6cfa,null));};exports['removeAgents']=function(_0x24f026,_0x5abc5d,_0x2f647c){return db['FaxAccount'][_0x27c0('0x5e')]({'where':{'id':_0x24f026[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x5abc5d,null))[_0x27c0('0x20')](function(_0x493ed2){if(_0x493ed2){return _0x493ed2[_0x27c0('0xc0')](_0x24f026[_0x27c0('0x43')][_0x27c0('0x6a')])[_0x27c0('0x20')](function(){if(_[_0x27c0('0xc1')](_0x24f026[_0x27c0('0x43')][_0x27c0('0x6a')])){for(var _0xa3287c=0x0;_0xa3287c<_0x24f026['query'][_0x27c0('0x6a')][_0x27c0('0x56')];_0xa3287c+=0x1){socket[_0x27c0('0xbe')](_0x27c0('0xc2'),{'UserId':Number(_0x24f026[_0x27c0('0x43')][_0x27c0('0x6a')][_0xa3287c]),'FaxAccountId':Number(_0x24f026[_0x27c0('0x55')]['id'])});}}else{socket[_0x27c0('0xbe')](_0x27c0('0xc2'),{'UserId':Number(_0x24f026['query'][_0x27c0('0x6a')]),'FaxAccountId':Number(_0x24f026['params']['id'])});}});}})[_0x27c0('0x20')](respondWithStatusCode(_0x5abc5d,null))['catch'](handleError(_0x5abc5d,null));};exports[_0x27c0('0xc3')]=function(_0x1e6fb5,_0x1eace4,_0x38b598){var _0x56d958={};var _0x1563cc={};var _0x2c07b2;var _0x4ae82a;return db['FaxAccount']['findOne']({'where':{'id':_0x1e6fb5[_0x27c0('0x55')]['id']}})[_0x27c0('0x20')](handleEntityNotFound(_0x1eace4,null))[_0x27c0('0x20')](function(_0x31cb08){if(_0x31cb08){_0x2c07b2=_0x31cb08;_0x1563cc[_0x27c0('0x42')]=_['keys'](db[_0x27c0('0x74')]['rawAttributes']);_0x1563cc[_0x27c0('0x43')]=_[_0x27c0('0x44')](_0x1e6fb5[_0x27c0('0x43')]);_0x1563cc[_0x27c0('0x4c')]=_['intersection'](_0x1563cc['model'],_0x1563cc['query']);_0x56d958[_0x27c0('0x47')]=_[_0x27c0('0x45')](_0x1563cc['model'],qs[_0x27c0('0x46')](_0x1e6fb5[_0x27c0('0x43')][_0x27c0('0x46')]));_0x56d958[_0x27c0('0x47')]=_0x56d958['attributes'][_0x27c0('0x56')]?_0x56d958[_0x27c0('0x47')]:_0x1563cc['model'];_0x56d958[_0x27c0('0x4a')]=qs[_0x27c0('0x4b')](_0x1e6fb5[_0x27c0('0x43')][_0x27c0('0x4b')]);_0x56d958[_0x27c0('0x4f')]=qs[_0x27c0('0x4c')](_[_0x27c0('0x4d')](_0x1e6fb5[_0x27c0('0x43')],_0x1563cc[_0x27c0('0x4c')]));if(_0x1e6fb5[_0x27c0('0x43')][_0x27c0('0x4e')]){_0x56d958[_0x27c0('0x4f')]=_['merge'](_0x56d958['where'],{'$or':_[_0x27c0('0x51')](_0x56d958[_0x27c0('0x47')],function(_0x57d7bc){var _0x23460b={};_0x23460b[_0x57d7bc]={'$like':'%'+_0x1e6fb5[_0x27c0('0x43')][_0x27c0('0x4e')]+'%'};return _0x23460b;})});}_0x56d958=_[_0x27c0('0x50')]({},_0x56d958,_0x1e6fb5[_0x27c0('0x67')]);return _0x2c07b2[_0x27c0('0xc3')](_0x56d958);}})['then'](function(_0x3624df){if(_0x3624df){_0x4ae82a=_0x3624df[_0x27c0('0x56')];if(!_0x1e6fb5[_0x27c0('0x43')]['hasOwnProperty'](_0x27c0('0x49'))){_0x56d958[_0x27c0('0x31')]=qs[_0x27c0('0x31')](_0x1e6fb5[_0x27c0('0x43')][_0x27c0('0x31')]);_0x56d958[_0x27c0('0x2e')]=qs[_0x27c0('0x2e')](_0x1e6fb5[_0x27c0('0x43')]['offset']);}return _0x2c07b2[_0x27c0('0xc3')](_0x56d958);}})['then'](function(_0x20dff5){if(_0x20dff5){return _0x20dff5?{'count':_0x4ae82a,'rows':_0x20dff5}:null;}})['then'](respondWithResult(_0x1eace4,null))['catch'](handleError(_0x1eace4,null));}; \ No newline at end of file +var _0x5b6f=['Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','exten','app','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','hasOwnProperty','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','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','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','split','format','FaxMessage','List','Contacts','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','apply','save','destroy','get','FaxAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','FaxAccount','rows','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','findOne','Disposition','merge','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction'];(function(_0x390103,_0x382921){var _0x2eccea=function(_0x4ecb6d){while(--_0x4ecb6d){_0x390103['push'](_0x390103['shift']());}};_0x2eccea(++_0x382921);}(_0x5b6f,0x10c));var _0xf5b6=function(_0x253ae6,_0xc0f0f9){_0x253ae6=_0x253ae6-0x0;var _0x13157a=_0x5b6f[_0x253ae6];return _0x13157a;};'use strict';var emlformat=require(_0xf5b6('0x0'));var rimraf=require(_0xf5b6('0x1'));var zipdir=require(_0xf5b6('0x2'));var jsonpatch=require(_0xf5b6('0x3'));var rp=require(_0xf5b6('0x4'));var moment=require(_0xf5b6('0x5'));var BPromise=require(_0xf5b6('0x6'));var Mustache=require(_0xf5b6('0x7'));var util=require(_0xf5b6('0x8'));var path=require(_0xf5b6('0x9'));var sox=require(_0xf5b6('0xa'));var csv=require(_0xf5b6('0xb'));var ejs=require(_0xf5b6('0xc'));var fs=require('fs');var fs_extra=require(_0xf5b6('0xd'));var _=require(_0xf5b6('0xe'));var squel=require(_0xf5b6('0xf'));var crypto=require(_0xf5b6('0x10'));var jsforce=require(_0xf5b6('0x11'));var deskjs=require(_0xf5b6('0x12'));var toCsv=require(_0xf5b6('0xb'));var querystring=require(_0xf5b6('0x13'));var Papa=require('papaparse');var Redis=require(_0xf5b6('0x14'));var authService=require(_0xf5b6('0x15'));var qs=require(_0xf5b6('0x16'));var as=require(_0xf5b6('0x17'));var hardwareService=require(_0xf5b6('0x18'));var logger=require(_0xf5b6('0x19'))(_0xf5b6('0x1a'));var utils=require(_0xf5b6('0x1b'));var config=require(_0xf5b6('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5b6('0x1d'))['db'];config[_0xf5b6('0x1e')]=_['defaults'](config[_0xf5b6('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0xf5b6('0x1f'))(new Redis(config[_0xf5b6('0x1e')]));require(_0xf5b6('0x20'))[_0xf5b6('0x21')](socket);var jayson=require(_0xf5b6('0x22'));var client=jayson[_0xf5b6('0x23')]['http']({'port':0x232c});var client9002=jayson[_0xf5b6('0x23')][_0xf5b6('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x336356,_0x3951b6,_0x4f9506,_0x13ea91){return new BPromise(function(_0x5751a4,_0x1c9878){var _0x375ae7=_0x13ea91||client;return _0x375ae7[_0xf5b6('0x25')](_0x336356,_0x4f9506)[_0xf5b6('0x26')](function(_0x1ce57f){logger['info'](_0xf5b6('0x27'),_0x3951b6,_0xf5b6('0x28'));logger[_0xf5b6('0x29')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3951b6,'request\x20sent',JSON[_0xf5b6('0x2a')](_0x1ce57f));if(_0x1ce57f[_0xf5b6('0x2b')]){if(_0x1ce57f[_0xf5b6('0x2b')][_0xf5b6('0x2c')]===0x1f4){logger[_0xf5b6('0x2b')](_0xf5b6('0x27'),_0x3951b6,_0x1ce57f[_0xf5b6('0x2b')][_0xf5b6('0x2d')]);return _0x1c9878(_0x1ce57f[_0xf5b6('0x2b')][_0xf5b6('0x2d')]);}logger[_0xf5b6('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x3951b6,_0x1ce57f['error'][_0xf5b6('0x2d')]);return _0x5751a4(_0x1ce57f[_0xf5b6('0x2b')]['message']);}else{logger['info'](_0xf5b6('0x27'),_0x3951b6,_0xf5b6('0x28'));_0x5751a4(_0x1ce57f[_0xf5b6('0x2e')]['message']);}})[_0xf5b6('0x2f')](function(_0x4e0432){logger['error'](_0xf5b6('0x27'),_0x3951b6,_0x4e0432);_0x1c9878(_0x4e0432);});});}function respondWithStatusCode(_0x35c7de,_0x438089){_0x438089=_0x438089||0xcc;return function(_0x37ed55){if(_0x37ed55){return _0x35c7de['sendStatus'](_0x438089);}return _0x35c7de['status'](_0x438089)['end']();};}function respondWithResult(_0x196a59,_0x608caf){_0x608caf=_0x608caf||0xc8;return function(_0x57ab9f){if(_0x57ab9f){return _0x196a59['status'](_0x608caf)[_0xf5b6('0x30')](_0x57ab9f);}};}function respondWithFilteredResult(_0x576e89,_0x5567e6){return function(_0x446bdd){if(_0x446bdd){var _0x2400ff=typeof _0x5567e6[_0xf5b6('0x31')]===_0xf5b6('0x32')&&typeof _0x5567e6[_0xf5b6('0x33')]===_0xf5b6('0x32');var _0x1f8656=_0x446bdd[_0xf5b6('0x34')];var _0x2967a8=_0x2400ff?0x0:_0x5567e6[_0xf5b6('0x31')];var _0xb4d7d6=_0x2400ff?_0x446bdd[_0xf5b6('0x34')]:_0x5567e6['offset']+_0x5567e6['limit'];var _0x1e1493;if(_0xb4d7d6>=_0x1f8656){_0xb4d7d6=_0x1f8656;_0x1e1493=0xc8;}else{_0x1e1493=0xce;}_0x576e89[_0xf5b6('0x35')](_0x1e1493);return _0x576e89[_0xf5b6('0x36')]('Content-Range',_0x2967a8+'-'+_0xb4d7d6+'/'+_0x1f8656)[_0xf5b6('0x30')](_0x446bdd);}return null;};}function patchUpdates(_0x3c3688){return function(_0x5c0de5){try{jsonpatch[_0xf5b6('0x37')](_0x5c0de5,_0x3c3688,!![]);}catch(_0x3f1b4d){return BPromise['reject'](_0x3f1b4d);}return _0x5c0de5[_0xf5b6('0x38')]();};}function saveUpdates(_0x2ae634,_0x14964b){return function(_0x564319){if(_0x564319){return _0x564319['update'](_0x2ae634)[_0xf5b6('0x26')](function(_0x42889f){return _0x42889f;});}return null;};}function removeEntity(_0x56cef5,_0x3afafb){return function(_0x4f1dd7){if(_0x4f1dd7){return _0x4f1dd7[_0xf5b6('0x39')]()['then'](function(){var _0x20d0f3=_0x4f1dd7[_0xf5b6('0x3a')]({'plain':!![]});var _0xd07296=_0xf5b6('0x3b');return db[_0xf5b6('0x3c')][_0xf5b6('0x39')]({'where':{'type':_0xd07296,'resourceId':_0x20d0f3['id']}})['then'](function(){return _0x4f1dd7;});})[_0xf5b6('0x26')](function(){_0x56cef5[_0xf5b6('0x35')](0xcc)[_0xf5b6('0x3d')]();});}};}function handleEntityNotFound(_0x1b14f0,_0x5243e2){return function(_0x271618){if(!_0x271618){_0x1b14f0[_0xf5b6('0x3e')](0x194);}return _0x271618;};}function handleError(_0x19ddfb,_0x64c252){_0x64c252=_0x64c252||0x1f4;return function(_0x21ceee){logger[_0xf5b6('0x2b')](_0x21ceee[_0xf5b6('0x3f')]);if(_0x21ceee[_0xf5b6('0x40')]){delete _0x21ceee[_0xf5b6('0x40')];}_0x19ddfb['status'](_0x64c252)[_0xf5b6('0x41')](_0x21ceee);};}exports[_0xf5b6('0x42')]=function(_0x48cd64,_0x579fff){var _0x5491d9={'include':[{'model':db[_0xf5b6('0x43')],'as':'mandatoryDispositionPause'}]},_0x10c778={},_0x4c404c={'count':0x0,'rows':[]};var _0x48c900=_[_0xf5b6('0x44')](db['FaxAccount'][_0xf5b6('0x45')],function(_0x144523){return{'name':_0x144523[_0xf5b6('0x46')],'type':_0x144523[_0xf5b6('0x47')][_0xf5b6('0x48')]};});_0x10c778[_0xf5b6('0x49')]=_[_0xf5b6('0x44')](_0x48c900,'name');_0x10c778[_0xf5b6('0x4a')]=_[_0xf5b6('0x4b')](_0x48cd64['query']);_0x10c778['filters']=_[_0xf5b6('0x4c')](_0x10c778[_0xf5b6('0x49')],_0x10c778[_0xf5b6('0x4a')]);_0x5491d9[_0xf5b6('0x4d')]=_[_0xf5b6('0x4c')](_0x10c778[_0xf5b6('0x49')],qs[_0xf5b6('0x4e')](_0x48cd64['query'][_0xf5b6('0x4e')]));_0x5491d9[_0xf5b6('0x4d')]=_0x5491d9[_0xf5b6('0x4d')][_0xf5b6('0x4f')]?_0x5491d9[_0xf5b6('0x4d')]:_0x10c778[_0xf5b6('0x49')];if(!_0x48cd64['query']['hasOwnProperty'](_0xf5b6('0x50'))){_0x5491d9[_0xf5b6('0x33')]=qs[_0xf5b6('0x33')](_0x48cd64['query'][_0xf5b6('0x33')]);_0x5491d9[_0xf5b6('0x31')]=qs[_0xf5b6('0x31')](_0x48cd64[_0xf5b6('0x4a')]['offset']);}_0x5491d9[_0xf5b6('0x51')]=qs[_0xf5b6('0x52')](_0x48cd64[_0xf5b6('0x4a')]['sort']);_0x5491d9['where']=qs[_0xf5b6('0x53')](_[_0xf5b6('0x54')](_0x48cd64['query'],_0x10c778['filters']),_0x48c900);if(_0x48cd64[_0xf5b6('0x4a')][_0xf5b6('0x55')]){_0x5491d9[_0xf5b6('0x56')]=_['merge'](_0x5491d9['where'],{'$or':_['map'](_0x48c900,function(_0x5f5b42){if(_0x5f5b42[_0xf5b6('0x47')]!==_0xf5b6('0x57')){var _0x2cba78={};_0x2cba78[_0x5f5b42[_0xf5b6('0x40')]]={'$like':'%'+_0x48cd64[_0xf5b6('0x4a')]['filter']+'%'};return _0x2cba78;}})});}_0x5491d9=_['merge']({},_0x5491d9,_0x48cd64['options']);var _0x4cdb3d={'where':_0x5491d9['where']};return db['FaxAccount'][_0xf5b6('0x34')](_0x4cdb3d)[_0xf5b6('0x26')](function(_0x1ff077){_0x4c404c[_0xf5b6('0x34')]=_0x1ff077;if(_0x48cd64[_0xf5b6('0x4a')][_0xf5b6('0x58')]){_0x5491d9['include']=[{'all':!![]}];}return db[_0xf5b6('0x59')]['findAll'](_0x5491d9);})['then'](function(_0x15969f){_0x4c404c[_0xf5b6('0x5a')]=_0x15969f;return _0x4c404c;})[_0xf5b6('0x26')](respondWithFilteredResult(_0x579fff,_0x5491d9))[_0xf5b6('0x2f')](handleError(_0x579fff,null));};exports[_0xf5b6('0x5b')]=function(_0x29f225,_0x163378){var _0x51e5ac={'raw':![],'where':{'id':_0x29f225[_0xf5b6('0x5c')]['id']},'include':[{'model':db[_0xf5b6('0x43')],'as':'mandatoryDispositionPause'}]},_0x5f0f55={};_0x5f0f55[_0xf5b6('0x49')]=_[_0xf5b6('0x4b')](db[_0xf5b6('0x59')][_0xf5b6('0x45')]);_0x5f0f55[_0xf5b6('0x4a')]=_[_0xf5b6('0x4b')](_0x29f225[_0xf5b6('0x4a')]);_0x5f0f55['filters']=_[_0xf5b6('0x4c')](_0x5f0f55[_0xf5b6('0x49')],_0x5f0f55[_0xf5b6('0x4a')]);_0x51e5ac[_0xf5b6('0x4d')]=_['intersection'](_0x5f0f55[_0xf5b6('0x49')],qs[_0xf5b6('0x4e')](_0x29f225['query'][_0xf5b6('0x4e')]));_0x51e5ac['attributes']=_0x51e5ac[_0xf5b6('0x4d')][_0xf5b6('0x4f')]?_0x51e5ac[_0xf5b6('0x4d')]:_0x5f0f55[_0xf5b6('0x49')];if(_0x29f225[_0xf5b6('0x4a')][_0xf5b6('0x58')]){_0x51e5ac[_0xf5b6('0x5d')]=[{'all':!![]}];}_0x51e5ac=_['merge']({},_0x51e5ac,_0x29f225[_0xf5b6('0x5e')]);return db[_0xf5b6('0x59')]['find'](_0x51e5ac)[_0xf5b6('0x26')](handleEntityNotFound(_0x163378,null))[_0xf5b6('0x26')](respondWithResult(_0x163378,null))[_0xf5b6('0x2f')](handleError(_0x163378,null));};exports[_0xf5b6('0x5f')]=function(_0xdcc78,_0x57360a){return db[_0xf5b6('0x59')][_0xf5b6('0x5f')](_0xdcc78[_0xf5b6('0x60')],{})['then'](function(_0x5c9ff7){var _0x3ad6aa=_0xdcc78[_0xf5b6('0x61')][_0xf5b6('0x3a')]({'plain':!![]});if(!_0x3ad6aa)throw new Error(_0xf5b6('0x62'));if(_0x3ad6aa[_0xf5b6('0x63')]==='user'){var _0x4bdc0c=_0x5c9ff7[_0xf5b6('0x3a')]({'plain':!![]});var _0x12283e=_0xf5b6('0x3b');return db['UserProfileSection'][_0xf5b6('0x64')]({'where':{'name':_0x12283e,'userProfileId':_0x3ad6aa[_0xf5b6('0x65')]},'raw':!![]})['then'](function(_0x140824){if(_0x140824&&_0x140824[_0xf5b6('0x66')]===0x0){return db[_0xf5b6('0x3c')][_0xf5b6('0x5f')]({'name':_0x4bdc0c[_0xf5b6('0x40')],'resourceId':_0x4bdc0c['id'],'type':_0x140824[_0xf5b6('0x40')],'sectionId':_0x140824['id']},{})[_0xf5b6('0x26')](function(){return _0x5c9ff7;});}else{return _0x5c9ff7;}})['catch'](function(_0x1b1d63){logger[_0xf5b6('0x2b')](_0xf5b6('0x67'),_0x1b1d63);throw _0x1b1d63;});}return _0x5c9ff7;})[_0xf5b6('0x26')](respondWithResult(_0x57360a,0xc9))[_0xf5b6('0x2f')](handleError(_0x57360a,null));};exports['update']=function(_0x42d862,_0x472f85){if(_0x42d862[_0xf5b6('0x60')]['id']){delete _0x42d862['body']['id'];}return db[_0xf5b6('0x59')][_0xf5b6('0x64')]({'where':{'id':_0x42d862[_0xf5b6('0x5c')]['id']},'include':[{'model':db[_0xf5b6('0x43')],'as':_0xf5b6('0x68')}]})['then'](handleEntityNotFound(_0x472f85,null))['then'](saveUpdates(_0x42d862['body'],null))['then'](respondWithResult(_0x472f85,null))[_0xf5b6('0x2f')](handleError(_0x472f85,null));};exports[_0xf5b6('0x39')]=function(_0x2c8701,_0x38f03f){return db[_0xf5b6('0x59')][_0xf5b6('0x64')]({'where':{'id':_0x2c8701['params']['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x38f03f,null))[_0xf5b6('0x26')](removeEntity(_0x38f03f,null))['catch'](handleError(_0x38f03f,null));};exports[_0xf5b6('0x69')]=function(_0xa3ffe3,_0x5e9de3){return db[_0xf5b6('0x59')][_0xf5b6('0x69')]()[_0xf5b6('0x26')](respondWithResult(_0x5e9de3,null))[_0xf5b6('0x2f')](handleError(_0x5e9de3,null));};exports[_0xf5b6('0x6a')]=function(_0x5d9632,_0x41ac27,_0x45796b){if(_0x5d9632[_0xf5b6('0x60')]['id']){delete _0x5d9632[_0xf5b6('0x60')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x5d9632[_0xf5b6('0x5c')]['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x41ac27,null))['then'](function(_0x371ef5){if(_0x371ef5){_0x5d9632[_0xf5b6('0x60')][_0xf5b6('0x6b')]=_0x371ef5['id'];return db['Disposition'][_0xf5b6('0x5f')](_0x5d9632[_0xf5b6('0x60')]);}})[_0xf5b6('0x26')](respondWithResult(_0x41ac27,null))[_0xf5b6('0x2f')](handleError(_0x41ac27,null));};exports['getDispositions']=function(_0x1ea580,_0x4d9af8,_0x549911){var _0x2118b5={'raw':![],'where':{}};var _0x1579f0={};var _0x4c3ee8={'count':0x0,'rows':[]};return db[_0xf5b6('0x59')][_0xf5b6('0x6c')]({'where':{'id':_0x1ea580[_0xf5b6('0x5c')]['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x4d9af8,null))[_0xf5b6('0x26')](function(_0x198784){if(_0x198784){_0x1579f0['model']=_[_0xf5b6('0x4b')](db[_0xf5b6('0x6d')][_0xf5b6('0x45')]);_0x1579f0[_0xf5b6('0x4a')]=_[_0xf5b6('0x4b')](_0x1ea580[_0xf5b6('0x4a')]);_0x1579f0['filters']=_[_0xf5b6('0x4c')](_0x1579f0[_0xf5b6('0x49')],_0x1579f0['query']);_0x2118b5[_0xf5b6('0x4d')]=_[_0xf5b6('0x4c')](_0x1579f0[_0xf5b6('0x49')],qs[_0xf5b6('0x4e')](_0x1ea580[_0xf5b6('0x4a')][_0xf5b6('0x4e')]));_0x2118b5[_0xf5b6('0x4d')]=_0x2118b5[_0xf5b6('0x4d')]['length']?_0x2118b5[_0xf5b6('0x4d')]:_0x1579f0[_0xf5b6('0x49')];if(!_0x1ea580[_0xf5b6('0x4a')]['hasOwnProperty'](_0xf5b6('0x50'))){_0x2118b5[_0xf5b6('0x33')]=qs[_0xf5b6('0x33')](_0x1ea580[_0xf5b6('0x4a')][_0xf5b6('0x33')]);_0x2118b5[_0xf5b6('0x31')]=qs[_0xf5b6('0x31')](_0x1ea580['query'][_0xf5b6('0x31')]);}_0x2118b5[_0xf5b6('0x51')]=qs['sort'](_0x1ea580[_0xf5b6('0x4a')][_0xf5b6('0x52')]);_0x2118b5[_0xf5b6('0x56')]=qs[_0xf5b6('0x53')](_[_0xf5b6('0x54')](_0x1ea580[_0xf5b6('0x4a')],_0x1579f0[_0xf5b6('0x53')]));_0x2118b5[_0xf5b6('0x56')][_0xf5b6('0x6b')]=_0x198784['id'];if(_0x1ea580['query'][_0xf5b6('0x55')]){_0x2118b5[_0xf5b6('0x56')]=_[_0xf5b6('0x6e')](_0x2118b5[_0xf5b6('0x56')],{'$or':_[_0xf5b6('0x44')](_0x2118b5[_0xf5b6('0x4d')],function(_0x106743){var _0x515d4e={};_0x515d4e[_0x106743]={'$like':'%'+_0x1ea580[_0xf5b6('0x4a')][_0xf5b6('0x55')]+'%'};return _0x515d4e;})});}_0x2118b5=_[_0xf5b6('0x6e')]({},_0x2118b5,_0x1ea580[_0xf5b6('0x5e')]);return db['Disposition']['count']({'where':_0x2118b5[_0xf5b6('0x56')]})[_0xf5b6('0x26')](function(_0x5d98a1){_0x4c3ee8[_0xf5b6('0x34')]=_0x5d98a1;if(_0x1ea580[_0xf5b6('0x4a')][_0xf5b6('0x58')]){_0x2118b5[_0xf5b6('0x5d')]=[{'all':!![]}];}return db[_0xf5b6('0x6d')][_0xf5b6('0x6f')](_0x2118b5);})[_0xf5b6('0x26')](function(_0xb36487){_0x4c3ee8['rows']=_0xb36487;return _0x4c3ee8;});}})[_0xf5b6('0x26')](respondWithFilteredResult(_0x4d9af8,_0x2118b5))[_0xf5b6('0x2f')](handleError(_0x4d9af8,null));};exports[_0xf5b6('0x70')]=function(_0x38b9dc,_0x395940,_0x2d7999){return db['FaxAccount'][_0xf5b6('0x64')]({'where':{'id':_0x38b9dc[_0xf5b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x395940,null))['then'](function(_0x424b5d){if(_0x424b5d){return _0x424b5d[_0xf5b6('0x70')](_0x38b9dc[_0xf5b6('0x4a')][_0xf5b6('0x71')]);}})['then'](respondWithStatusCode(_0x395940,null))[_0xf5b6('0x2f')](handleError(_0x395940,null));};exports[_0xf5b6('0x72')]=function(_0x497820,_0x1dbbec,_0x1c945e){if(_0x497820[_0xf5b6('0x60')]['id']){delete _0x497820[_0xf5b6('0x60')]['id'];}return db['FaxAccount'][_0xf5b6('0x64')]({'where':{'id':_0x497820['params']['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x1dbbec,null))[_0xf5b6('0x26')](function(_0x294ddf){if(_0x294ddf){_0x497820['body']['FaxAccountId']=_0x294ddf['id'];return db[_0xf5b6('0x73')][_0xf5b6('0x5f')](_0x497820[_0xf5b6('0x60')]);}})[_0xf5b6('0x26')](respondWithResult(_0x1dbbec,null))[_0xf5b6('0x2f')](handleError(_0x1dbbec,null));};exports['getAnswers']=function(_0x23f685,_0x39d6ca,_0x5dc189){var _0x51eac8={'raw':![],'where':{}};var _0x43aaf9={};var _0x171a02={'count':0x0,'rows':[]};return db[_0xf5b6('0x59')][_0xf5b6('0x6c')]({'where':{'id':_0x23f685[_0xf5b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x39d6ca,null))[_0xf5b6('0x26')](function(_0xe0aa81){if(_0xe0aa81){_0x43aaf9['model']=_[_0xf5b6('0x4b')](db['CannedAnswer']['rawAttributes']);_0x43aaf9[_0xf5b6('0x4a')]=_[_0xf5b6('0x4b')](_0x23f685[_0xf5b6('0x4a')]);_0x43aaf9[_0xf5b6('0x53')]=_[_0xf5b6('0x4c')](_0x43aaf9[_0xf5b6('0x49')],_0x43aaf9[_0xf5b6('0x4a')]);_0x51eac8[_0xf5b6('0x4d')]=_[_0xf5b6('0x4c')](_0x43aaf9[_0xf5b6('0x49')],qs['fields'](_0x23f685['query'][_0xf5b6('0x4e')]));_0x51eac8[_0xf5b6('0x4d')]=_0x51eac8[_0xf5b6('0x4d')][_0xf5b6('0x4f')]?_0x51eac8[_0xf5b6('0x4d')]:_0x43aaf9['model'];if(!_0x23f685[_0xf5b6('0x4a')]['hasOwnProperty']('nolimit')){_0x51eac8['limit']=qs[_0xf5b6('0x33')](_0x23f685['query'][_0xf5b6('0x33')]);_0x51eac8[_0xf5b6('0x31')]=qs[_0xf5b6('0x31')](_0x23f685['query']['offset']);}_0x51eac8[_0xf5b6('0x51')]=qs['sort'](_0x23f685[_0xf5b6('0x4a')][_0xf5b6('0x52')]);_0x51eac8[_0xf5b6('0x56')]=qs[_0xf5b6('0x53')](_[_0xf5b6('0x54')](_0x23f685['query'],_0x43aaf9['filters']));_0x51eac8[_0xf5b6('0x56')][_0xf5b6('0x6b')]=_0xe0aa81['id'];if(_0x23f685['query']['filter']){_0x51eac8[_0xf5b6('0x56')]=_[_0xf5b6('0x6e')](_0x51eac8['where'],{'$or':_[_0xf5b6('0x44')](_0x51eac8[_0xf5b6('0x4d')],function(_0x44c409){var _0x35cbe2={};_0x35cbe2[_0x44c409]={'$like':'%'+_0x23f685[_0xf5b6('0x4a')][_0xf5b6('0x55')]+'%'};return _0x35cbe2;})});}_0x51eac8=_[_0xf5b6('0x6e')]({},_0x51eac8,_0x23f685[_0xf5b6('0x5e')]);return db[_0xf5b6('0x73')][_0xf5b6('0x34')]({'where':_0x51eac8['where']})[_0xf5b6('0x26')](function(_0x5ceaf5){_0x171a02[_0xf5b6('0x34')]=_0x5ceaf5;if(_0x23f685[_0xf5b6('0x4a')][_0xf5b6('0x58')]){_0x51eac8[_0xf5b6('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf5b6('0x6f')](_0x51eac8);})[_0xf5b6('0x26')](function(_0x23f5e1){_0x171a02['rows']=_0x23f5e1;return _0x171a02;});}})[_0xf5b6('0x26')](respondWithFilteredResult(_0x39d6ca,_0x51eac8))[_0xf5b6('0x2f')](handleError(_0x39d6ca,null));};exports['removeAnswers']=function(_0x5208a5,_0x47d6ac,_0x37b421){return db[_0xf5b6('0x59')][_0xf5b6('0x64')]({'where':{'id':_0x5208a5[_0xf5b6('0x5c')]['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x47d6ac,null))['then'](function(_0x2d855d){if(_0x2d855d){return _0x2d855d[_0xf5b6('0x74')](_0x5208a5[_0xf5b6('0x4a')][_0xf5b6('0x71')]);}})[_0xf5b6('0x26')](respondWithStatusCode(_0x47d6ac,null))[_0xf5b6('0x2f')](handleError(_0x47d6ac,null));};exports[_0xf5b6('0x75')]=function(_0x2aa69b,_0x533d44,_0x401477){return db['FaxInteraction'][_0xf5b6('0x64')]({'where':{'id':_0x2aa69b[_0xf5b6('0x5c')]['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x533d44,null))[_0xf5b6('0x26')](function(_0x23afcf){if(_0x23afcf){return _0x23afcf[_0xf5b6('0x75')](_0x2aa69b[_0xf5b6('0x60')][_0xf5b6('0x71')],_['omit'](_0x2aa69b[_0xf5b6('0x60')],['ids','id'])||{});}})[_0xf5b6('0x26')](respondWithResult(_0x533d44,null))[_0xf5b6('0x2f')](handleError(_0x533d44,null));};exports[_0xf5b6('0x76')]=function(_0x5c2fe9,_0xce552,_0x33ff15){var _0x48f5f0={'raw':![],'where':{}};var _0x300ae4={};var _0x3a901f={'count':0x0,'rows':[]};return db[_0xf5b6('0x59')][_0xf5b6('0x6c')]({'where':{'id':_0x5c2fe9[_0xf5b6('0x5c')]['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0xce552,null))[_0xf5b6('0x26')](function(_0x2efc13){if(_0x2efc13){_0x300ae4[_0xf5b6('0x49')]=_[_0xf5b6('0x4b')](db[_0xf5b6('0x77')]['rawAttributes']);_0x300ae4[_0xf5b6('0x4a')]=_[_0xf5b6('0x4b')](_0x5c2fe9[_0xf5b6('0x4a')]);_0x300ae4[_0xf5b6('0x53')]=_['intersection'](_0x300ae4[_0xf5b6('0x49')],_0x300ae4[_0xf5b6('0x4a')]);_0x48f5f0[_0xf5b6('0x4d')]=_[_0xf5b6('0x4c')](_0x300ae4[_0xf5b6('0x49')],qs[_0xf5b6('0x4e')](_0x5c2fe9[_0xf5b6('0x4a')]['fields']));_0x48f5f0[_0xf5b6('0x4d')]=_0x48f5f0[_0xf5b6('0x4d')][_0xf5b6('0x4f')]?_0x48f5f0[_0xf5b6('0x4d')]:_0x300ae4[_0xf5b6('0x49')];if(!_0x5c2fe9['query']['hasOwnProperty']('nolimit')){_0x48f5f0[_0xf5b6('0x33')]=qs['limit'](_0x5c2fe9[_0xf5b6('0x4a')][_0xf5b6('0x33')]);_0x48f5f0['offset']=qs[_0xf5b6('0x31')](_0x5c2fe9['query'][_0xf5b6('0x31')]);}_0x48f5f0[_0xf5b6('0x51')]=qs[_0xf5b6('0x52')](_0x5c2fe9['query']['sort']);_0x48f5f0[_0xf5b6('0x56')]=qs[_0xf5b6('0x53')](_['pick'](_0x5c2fe9[_0xf5b6('0x4a')],_0x300ae4[_0xf5b6('0x53')]));_0x48f5f0[_0xf5b6('0x56')]['FaxAccountId']=_0x2efc13['id'];if(_0x5c2fe9[_0xf5b6('0x4a')][_0xf5b6('0x55')]){_0x48f5f0[_0xf5b6('0x56')]=_['merge'](_0x48f5f0['where'],{'$or':_[_0xf5b6('0x44')](_0x48f5f0[_0xf5b6('0x4d')],function(_0x1c3d0b){var _0xa17ef7={};_0xa17ef7[_0x1c3d0b]={'$like':'%'+_0x5c2fe9[_0xf5b6('0x4a')]['filter']+'%'};return _0xa17ef7;})});}_0x48f5f0=_[_0xf5b6('0x6e')]({},_0x48f5f0,_0x5c2fe9[_0xf5b6('0x5e')]);return db[_0xf5b6('0x77')][_0xf5b6('0x34')]({'where':_0x48f5f0[_0xf5b6('0x56')]})[_0xf5b6('0x26')](function(_0x4ea06c){_0x3a901f[_0xf5b6('0x34')]=_0x4ea06c;if(_0x5c2fe9[_0xf5b6('0x4a')][_0xf5b6('0x58')]){_0x48f5f0[_0xf5b6('0x5d')]=[{'model':db[_0xf5b6('0x78')],'as':_0xf5b6('0x79'),'required':![]},{'model':db[_0xf5b6('0x7a')],'as':_0xf5b6('0x7b'),'attributes':[_0xf5b6('0x40'),'fullname',_0xf5b6('0x7c')],'required':![]},{'model':db[_0xf5b6('0x7d')],'as':_0xf5b6('0x7e'),'attributes':['id',_0xf5b6('0x40'),_0xf5b6('0x7f')],'where':_0x5c2fe9[_0xf5b6('0x4a')][_0xf5b6('0x80')]?{'id':_0x5c2fe9[_0xf5b6('0x4a')][_0xf5b6('0x80')]}:undefined,'required':_0x5c2fe9[_0xf5b6('0x4a')]['tag']?!![]:![]}];}return db[_0xf5b6('0x77')][_0xf5b6('0x6f')](_0x48f5f0);})[_0xf5b6('0x26')](function(_0xae1b7b){_0x3a901f[_0xf5b6('0x5a')]=_0xae1b7b;return _0x3a901f;});}})[_0xf5b6('0x26')](respondWithFilteredResult(_0xce552,_0x48f5f0))[_0xf5b6('0x2f')](handleError(_0xce552,null));};exports[_0xf5b6('0x81')]=function(_0x503126,_0x5f2552){var _0x22a991=_0x503126['params']['id'];var _0x290c46=_0x503126[_0xf5b6('0x60')];var _0x54bae7=0xc8;var _0x45463b=null;return db[_0xf5b6('0x82')][_0xf5b6('0x83')]({'isolationLevel':db['sequelize'][_0xf5b6('0x84')]['ISOLATION_LEVELS'][_0xf5b6('0x85')]},function(_0x18179d){return db['FaxAccount'][_0xf5b6('0x6c')]({'where':{'id':_0x22a991},'transaction':_0x18179d})[_0xf5b6('0x26')](function(_0x3f5b42){if(_0x3f5b42){return db['FaxApplication'][_0xf5b6('0x39')]({'where':{'FaxAccountId':_0x22a991},'transaction':_0x18179d})[_0xf5b6('0x26')](function(){var _0x27fe09=_['map'](_0x290c46,function(_0x2906d3){_0x2906d3[_0xf5b6('0x6b')]=_0x22a991;return _0x2906d3;});return db[_0xf5b6('0x86')][_0xf5b6('0x87')](_0x27fe09,{'transaction':_0x18179d});});}else{_0x54bae7=0x194;_0x45463b=[];}});})[_0xf5b6('0x26')](function(){if(_0x54bae7!==0x194){return db['FaxApplication'][_0xf5b6('0x88')]({'where':{'FaxAccountId':_0x22a991},'order':_0xf5b6('0x89')})[_0xf5b6('0x26')](function(_0x41f3f0){_0x45463b=_0x41f3f0;});}})[_0xf5b6('0x2f')](function(_0x4ac092){_0x54bae7=0x1f4;logger[_0xf5b6('0x2b')](_0x4ac092[_0xf5b6('0x3f')]);if(_0x4ac092['name']){delete _0x4ac092['name'];}_0x45463b=_0x4ac092;})[_0xf5b6('0x8a')](function(){if(_0x45463b===null){_0x5f2552[_0xf5b6('0x3e')](_0x54bae7);}else{if(_0x54bae7===0x1f4){_0x5f2552[_0xf5b6('0x35')](_0x54bae7)[_0xf5b6('0x41')](_0x45463b);}else{_0x5f2552[_0xf5b6('0x35')](_0x54bae7)[_0xf5b6('0x30')](_0x45463b);}}});};exports[_0xf5b6('0x8b')]=function(_0x5ccf77,_0x627cf0,_0x46bf6c){var _0x5ae6d5={};var _0x37c561={};var _0x27a82c;var _0x2b2169;return db[_0xf5b6('0x59')][_0xf5b6('0x6c')]({'where':{'id':_0x5ccf77[_0xf5b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x627cf0,null))['then'](function(_0x1f3208){if(_0x1f3208){_0x27a82c=_0x1f3208;_0x37c561[_0xf5b6('0x49')]=_[_0xf5b6('0x4b')](db[_0xf5b6('0x86')][_0xf5b6('0x45')]);_0x37c561[_0xf5b6('0x4a')]=_[_0xf5b6('0x4b')](_0x5ccf77['query']);_0x37c561[_0xf5b6('0x53')]=_['intersection'](_0x37c561[_0xf5b6('0x49')],_0x37c561['query']);_0x5ae6d5[_0xf5b6('0x4d')]=_[_0xf5b6('0x4c')](_0x37c561[_0xf5b6('0x49')],qs[_0xf5b6('0x4e')](_0x5ccf77[_0xf5b6('0x4a')]['fields']));_0x5ae6d5[_0xf5b6('0x4d')]=_0x5ae6d5[_0xf5b6('0x4d')][_0xf5b6('0x4f')]?_0x5ae6d5[_0xf5b6('0x4d')]:_0x37c561['model'];_0x5ae6d5[_0xf5b6('0x51')]=qs['sort'](_0x5ccf77[_0xf5b6('0x4a')][_0xf5b6('0x52')]);_0x5ae6d5[_0xf5b6('0x56')]=qs[_0xf5b6('0x53')](_[_0xf5b6('0x54')](_0x5ccf77[_0xf5b6('0x4a')],_0x37c561[_0xf5b6('0x53')]));if(_0x5ccf77[_0xf5b6('0x4a')][_0xf5b6('0x55')]){_0x5ae6d5[_0xf5b6('0x56')]=_['merge'](_0x5ae6d5['where'],{'$or':_['map'](_0x5ae6d5[_0xf5b6('0x4d')],function(_0x1bc781){var _0x55bd30={};_0x55bd30[_0x1bc781]={'$like':'%'+_0x5ccf77[_0xf5b6('0x4a')]['filter']+'%'};return _0x55bd30;})});}_0x5ae6d5=_[_0xf5b6('0x6e')]({},_0x5ae6d5,_0x5ccf77[_0xf5b6('0x5e')]);return _0x27a82c['getApplications'](_0x5ae6d5);}})[_0xf5b6('0x26')](function(_0x11a68a){if(_0x11a68a){_0x2b2169=_0x11a68a[_0xf5b6('0x4f')];if(!_0x5ccf77[_0xf5b6('0x4a')]['hasOwnProperty'](_0xf5b6('0x50'))){_0x5ae6d5[_0xf5b6('0x33')]=qs['limit'](_0x5ccf77['query']['limit']);_0x5ae6d5[_0xf5b6('0x31')]=qs[_0xf5b6('0x31')](_0x5ccf77['query'][_0xf5b6('0x31')]);}return _0x27a82c[_0xf5b6('0x8b')](_0x5ae6d5);}})[_0xf5b6('0x26')](function(_0x32cc44){if(_0x32cc44){return _0x32cc44?{'count':_0x2b2169,'rows':_0x32cc44}:null;}})[_0xf5b6('0x26')](respondWithResult(_0x627cf0,null))[_0xf5b6('0x2f')](handleError(_0x627cf0,null));};function Extension(_0x44977f,_0x40c7f6,_0x58f725,_0x46f427){this['context']='from-voip-provider';this[_0xf5b6('0x8c')]=_0x44977f['localstationid'];this[_0xf5b6('0x8d')]=_0x46f427;this[_0xf5b6('0x47')]='system';this[_0xf5b6('0x8e')]='Fax\x20Extension';this[_0xf5b6('0x6b')]=_0x44977f['id'];this[_0xf5b6('0x89')]=_0x40c7f6;this[_0xf5b6('0x8f')]=_0x58f725;}function createExtensionsReciveFax(_0x4bc6aa){var _0x9f3552=0x1;var _0x599577=[];_0x599577[_0xf5b6('0x90')](new Extension(_0x4bc6aa,_0x9f3552,'',_0xf5b6('0x91')));_0x9f3552+=0x1;_0x599577['push'](new Extension(_0x4bc6aa,_0x9f3552,_0xf5b6('0x92'),_0xf5b6('0x93')));_0x9f3552+=0x1;for(var _0x9a0a19 in _0x4bc6aa){if(_0x4bc6aa[_0xf5b6('0x94')](_0x9a0a19)&&(_0x9a0a19===_0xf5b6('0x95')||_0x9a0a19===_0xf5b6('0x96')||_0x9a0a19===_0xf5b6('0x97')||_0x9a0a19===_0xf5b6('0x98')||_0x9a0a19===_0xf5b6('0x99')||_0x9a0a19===_0xf5b6('0x9a')||_0x9a0a19===_0xf5b6('0x9b')||_0x9a0a19===_0xf5b6('0x9c')||_0x9a0a19==='t38timeout')){_0x599577['push'](new Extension(_0x4bc6aa,_0x9f3552,'FAXOPT('+_0x9a0a19+')='+_0x4bc6aa[_0x9a0a19],_0xf5b6('0x93')));_0x9f3552+=0x1;}}_0x599577[_0xf5b6('0x90')](new Extension(_0x4bc6aa,_0x9f3552,'6',_0xf5b6('0x9d')));_0x9f3552+=0x1;_0x599577[_0xf5b6('0x90')](new Extension(_0x4bc6aa,_0x9f3552,_0xf5b6('0x9e'),'ReceiveFax'));_0x9f3552=0x0;return _0x599577;}exports[_0xf5b6('0x9f')]=function(_0x5736ff,_0x17b127,_0x287380){var _0x5fdec5;return db[_0xf5b6('0x82')][_0xf5b6('0x83')](function(_0x31b8a6){return db[_0xf5b6('0x59')][_0xf5b6('0x5f')](_0x5736ff[_0xf5b6('0x60')],{'transaction':_0x31b8a6})[_0xf5b6('0x26')](function(_0x111bd5){_0x5fdec5=_0x111bd5[_0xf5b6('0x3a')]({'plain':!![]});return db[_0xf5b6('0xa0')][_0xf5b6('0x87')](createExtensionsReciveFax(_0x5fdec5),{'transaction':_0x31b8a6});});})[_0xf5b6('0x26')](function(){return _0x5fdec5;})[_0xf5b6('0x26')](respondWithResult(_0x17b127,null))[_0xf5b6('0x2f')](handleError(_0x17b127,null));};exports[_0xf5b6('0xa1')]=function(_0x567b40,_0x23c45d,_0xcdaa33){var _0x529e39;return db[_0xf5b6('0x82')][_0xf5b6('0x83')](function(_0x539c79){return db['FaxAccount']['update'](_0x567b40[_0xf5b6('0x60')],{'where':{'id':_0x567b40[_0xf5b6('0x60')]['id']},'transaction':_0x539c79})[_0xf5b6('0x26')](function(_0x4ac198){return db[_0xf5b6('0xa0')][_0xf5b6('0x39')]({'where':{'FaxAccountId':_0x567b40[_0xf5b6('0x60')]['id']},'transaction':_0x539c79})[_0xf5b6('0x26')](function(_0x44ccdb){return db[_0xf5b6('0xa0')][_0xf5b6('0x87')](createExtensionsReciveFax(_['omit'](_0x567b40[_0xf5b6('0x60')],[_0xf5b6('0xa2'),'key',_0xf5b6('0xa3'),_0xf5b6('0xa4'),_0xf5b6('0xa5'),_0xf5b6('0xa6')])),{'transaction':_0x539c79});});});})['then'](function(){return db[_0xf5b6('0x59')]['findById'](_0x567b40[_0xf5b6('0x60')]['id']);})[_0xf5b6('0x26')](respondWithResult(_0x23c45d,null))[_0xf5b6('0x2f')](handleError(_0x23c45d,null));};exports[_0xf5b6('0xa7')]=function(_0x2b8f1e,_0x35030f,_0x4cc207){var _0x2f7e96={'raw':!![],'where':{}};var _0x2dce5b={};var _0x4ad51c={'count':0x0,'rows':[]};return db[_0xf5b6('0x59')][_0xf5b6('0x6c')]({'where':{'id':_0x2b8f1e[_0xf5b6('0x5c')]['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x35030f,null))['then'](function(_0xfd4f9d){if(_0xfd4f9d){_0x2dce5b[_0xf5b6('0x49')]=_[_0xf5b6('0x4b')](db['FaxMessage']['rawAttributes']);_0x2dce5b[_0xf5b6('0x4a')]=_[_0xf5b6('0x4b')](_0x2b8f1e[_0xf5b6('0x4a')]);_0x2dce5b[_0xf5b6('0x53')]=_[_0xf5b6('0x4c')](_0x2dce5b[_0xf5b6('0x49')],_0x2dce5b[_0xf5b6('0x4a')]);_0x2f7e96['attributes']=_[_0xf5b6('0x4c')](_0x2dce5b[_0xf5b6('0x49')],qs['fields'](_0x2b8f1e[_0xf5b6('0x4a')][_0xf5b6('0x4e')]));_0x2f7e96[_0xf5b6('0x4d')]=_0x2f7e96[_0xf5b6('0x4d')]['length']?_0x2f7e96[_0xf5b6('0x4d')]:_0x2dce5b[_0xf5b6('0x49')];if(!_0x2b8f1e['query'][_0xf5b6('0x94')](_0xf5b6('0x50'))){_0x2f7e96['limit']=qs[_0xf5b6('0x33')](_0x2b8f1e[_0xf5b6('0x4a')][_0xf5b6('0x33')]);_0x2f7e96[_0xf5b6('0x31')]=qs[_0xf5b6('0x31')](_0x2b8f1e['query']['offset']);}_0x2f7e96[_0xf5b6('0x51')]=qs[_0xf5b6('0x52')](_0x2b8f1e[_0xf5b6('0x4a')]['sort']);_0x2f7e96['where']=qs[_0xf5b6('0x53')](_[_0xf5b6('0x54')](_0x2b8f1e[_0xf5b6('0x4a')],_0x2dce5b[_0xf5b6('0x53')]));_0x2f7e96['where'][_0xf5b6('0x6b')]=_0xfd4f9d['id'];if(_0x2b8f1e['query'][_0xf5b6('0x55')]){_0x2f7e96[_0xf5b6('0x56')]=_[_0xf5b6('0x6e')](_0x2f7e96[_0xf5b6('0x56')],{'$or':_['map'](_0x2f7e96[_0xf5b6('0x4d')],function(_0x20f082){var _0x12372f={};_0x12372f[_0x20f082]={'$like':'%'+_0x2b8f1e[_0xf5b6('0x4a')]['filter']+'%'};return _0x12372f;})});}if(_0x2b8f1e['query']['$gte']){var _0x2fb86c=_0x2b8f1e[_0xf5b6('0x4a')]['$gte'][_0xf5b6('0xa8')](',');var _0x4671bf={};_0x4671bf[_0x2fb86c[0x0]]={'$gte':moment(_0x2fb86c[0x1])[_0xf5b6('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f7e96[_0xf5b6('0x56')]=_['merge'](_0x2f7e96['where'],_0x4671bf);}_0x2f7e96=_['merge']({},_0x2f7e96,_0x2b8f1e[_0xf5b6('0x5e')]);return db[_0xf5b6('0xaa')][_0xf5b6('0x34')]({'where':_0x2f7e96[_0xf5b6('0x56')]})[_0xf5b6('0x26')](function(_0x3dd2c2){_0x4ad51c[_0xf5b6('0x34')]=_0x3dd2c2;if(_0x2b8f1e[_0xf5b6('0x4a')][_0xf5b6('0x58')]){_0x2f7e96[_0xf5b6('0x5d')]=[{'all':!![]}];}return db[_0xf5b6('0xaa')][_0xf5b6('0x6f')](_0x2f7e96);})['then'](function(_0x4c3a7e){_0x4ad51c['rows']=_0x4c3a7e;return _0x4ad51c;});}})[_0xf5b6('0x26')](respondWithFilteredResult(_0x35030f,_0x2f7e96))[_0xf5b6('0x2f')](handleError(_0x35030f,null));};exports[_0xf5b6('0x41')]=function(_0x175b48,_0x21ce51,_0x986c23){var _0x5a1218,_0x16f4cb={},_0x40b4a6;if(_0x175b48['body']['to']){_0x40b4a6=_0x175b48[_0xf5b6('0x60')]['to'][0x0];}return db[_0xf5b6('0x59')][_0xf5b6('0x64')]({'where':{'id':_0x175b48[_0xf5b6('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0xf5b6('0xab'),'include':[{'model':db[_0xf5b6('0x78')],'as':_0xf5b6('0xac'),'where':{'fax':_0x40b4a6},'limit':0x1,'order':[['updatedAt',_0xf5b6('0xad')]]}]}]})[_0xf5b6('0x26')](handleEntityNotFound(_0x21ce51,null))[_0xf5b6('0x26')](function(_0x249a86){_0x5a1218=_0x249a86;if(_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')]&&_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')]['length']){for(var _0x2dea69=0x0;_0x2dea69<_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][_0xf5b6('0x4f')];_0x2dea69+=0x1){_0x175b48['body'][_0xf5b6('0xae')][_0x2dea69]={'filename':_0x175b48[_0xf5b6('0x60')]['attachments'][_0x2dea69][_0xf5b6('0x40')],'id':_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][_0x2dea69]['id'],'path':path['join'](config[_0xf5b6('0xaf')],'server/files/attachments',_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][_0x2dea69][_0xf5b6('0xb0')])};}}return respondWithRpcPromise(_0xf5b6('0xb1'),_0xf5b6('0xb1'),{'FaxAccountId':_[_0xf5b6('0xb2')](_0x175b48[_0xf5b6('0x5c')]['id'])?undefined:_0x175b48[_0xf5b6('0x5c')]['id'],'path':_[_0xf5b6('0xb2')](_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][0x0][_0xf5b6('0x9')])?undefined:_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][0x0][_0xf5b6('0x9')],'fax':_['isNil'](_0x175b48['body']['to'][0x0])?undefined:_0x175b48[_0xf5b6('0x60')]['to'][0x0]},client9002);})[_0xf5b6('0x26')](function(){if(_0x5a1218){if(_[_0xf5b6('0xb2')](_0x175b48[_0xf5b6('0x60')]['from'])){_0x175b48['body'][_0xf5b6('0xb3')]=util[_0xf5b6('0xa9')](_0xf5b6('0xb4'),_0x5a1218[_0xf5b6('0x40')],_0x5a1218['fax']);}if(_0x5a1218[_0xf5b6('0xab')]){if(_0x5a1218[_0xf5b6('0xab')][_0xf5b6('0xac')][_0xf5b6('0x4f')]){return _0x5a1218['List'][_0xf5b6('0xac')][0x0];}else{return db['CmContact'][_0xf5b6('0x5f')](_['defaults'](_0x175b48['body'],{'firstName':_0x175b48['body']['to'][0x0],'phone':_0x175b48[_0xf5b6('0x60')]['to'][0x0],'fax':_0x175b48[_0xf5b6('0x60')]['to'][0x0],'ListId':_0x5a1218[_0xf5b6('0xa6')]}));}}else{throw new Error(_0xf5b6('0xb5'));}}else{throw new Error(_0xf5b6('0xb6'));}})[_0xf5b6('0x26')](function(_0x107f3a){if(_0x107f3a){return db[_0xf5b6('0x77')][_0xf5b6('0x64')]({'where':{'ContactId':_0x107f3a['id'],'closed':![],'FaxAccountId':_0x5a1218['id']}})[_0xf5b6('0x26')](function(_0x123fa1){if(_0x123fa1){return[_0x123fa1,![]];}return db['FaxInteraction'][_0xf5b6('0x5f')]({'UserId':_0x175b48['user']['id'],'ContactId':_0x107f3a['id'],'FaxAccountId':_0x5a1218['id'],'fax':_0x175b48['body']['to'][0x0],'firstMsgDirection':_0xf5b6('0xb7'),'Messages':[_['merge'](_0x175b48['body'],{'read':![],'body':_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][0x0][_0xf5b6('0xb8')],'FaxAccountId':_0x5a1218['id'],'UserId':_0x175b48[_0xf5b6('0x61')]['id'],'ContactId':_0x107f3a['id'],'AttachmentId':_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][0x0]['id']})]},{'include':[{'model':db[_0xf5b6('0xaa')],'as':_0xf5b6('0xb9')}]})[_0xf5b6('0x26')](function(_0x5e57cf){return[_0x5e57cf,!![]];});});}else{throw new Error(_0xf5b6('0xba'));}})[_0xf5b6('0xbb')](function(_0x559746,_0xe6ef7){if(_0xe6ef7){return _0x559746;}return db['FaxMessage']['create']({'direction':_0xf5b6('0xb7'),'read':![],'body':_0x175b48['body'][_0xf5b6('0xae')][0x0][_0xf5b6('0xb8')],'FaxAccountId':_0x5a1218['id'],'FaxInteractionId':_0x559746['id'],'UserId':_0x175b48['user']['id'],'ContactId':_0x559746[_0xf5b6('0xbc')],'AttachmentId':_0x175b48[_0xf5b6('0x60')]['attachments'][0x0]['id']})[_0xf5b6('0x26')](function(_0x454e26){_0x559746['dataValues'][_0xf5b6('0xb9')]=[];_0x559746['dataValues'][_0xf5b6('0xb9')][_0xf5b6('0x90')](_0x454e26[_0xf5b6('0xbd')]);return _0x559746;});})[_0xf5b6('0x26')](function(_0xd78b91){respondWithRpcPromise(_0xf5b6('0xbe'),_0xf5b6('0xbe'),{'FaxAccountId':_['isNil'](_0x175b48[_0xf5b6('0x5c')]['id'])?undefined:_0x175b48[_0xf5b6('0x5c')]['id'],'path':_['isNil'](_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][0x0][_0xf5b6('0x9')])?undefined:_0x175b48[_0xf5b6('0x60')][_0xf5b6('0xae')][0x0][_0xf5b6('0x9')],'fax':_[_0xf5b6('0xb2')](_0x175b48[_0xf5b6('0x60')]['to'][0x0])?undefined:_0x175b48[_0xf5b6('0x60')]['to'][0x0],'AttachmentId':_0x175b48['body'][_0xf5b6('0xae')][0x0]['id']},client9002)[_0xf5b6('0x26')](function(_0x138d24){logger[_0xf5b6('0xbf')](_0xf5b6('0xc0'),_0x138d24);})[_0xf5b6('0x2f')](function(_0x46876c){logger[_0xf5b6('0xbf')](_0xf5b6('0xc0'),_0x46876c);});return _0xd78b91;})['then'](respondWithResult(_0x21ce51,null))[_0xf5b6('0x2f')](handleError(_0x21ce51,null));};exports[_0xf5b6('0xc1')]=function(_0x3b847a,_0xe6d4ca,_0xc60ca4){return db[_0xf5b6('0x59')][_0xf5b6('0x64')]({'where':{'id':_0x3b847a['params']['id']}})['then'](handleEntityNotFound(_0xe6d4ca,null))['then'](function(_0x4097f0){if(_0x4097f0){return _0x4097f0[_0xf5b6('0xc1')](_0x3b847a[_0xf5b6('0x60')][_0xf5b6('0x71')],_['omit'](_0x3b847a[_0xf5b6('0x60')],[_0xf5b6('0x71'),'id'])||{})[_0xf5b6('0xbb')](function(_0x4a19cb){for(var _0x3c0f8f=0x0;_0x3c0f8f<_0x3b847a[_0xf5b6('0x60')][_0xf5b6('0x71')]['length'];_0x3c0f8f+=0x1){socket[_0xf5b6('0xc2')](_0xf5b6('0xc3'),{'UserId':Number(_0x3b847a[_0xf5b6('0x60')][_0xf5b6('0x71')][_0x3c0f8f]),'FaxAccountId':Number(_0x3b847a[_0xf5b6('0x5c')]['id'])});}return _0x4a19cb;});}})['then'](respondWithResult(_0xe6d4ca,null))[_0xf5b6('0x2f')](handleError(_0xe6d4ca,null));};exports[_0xf5b6('0xc4')]=function(_0xf78c85,_0x397786,_0x1ce974){return db['FaxAccount'][_0xf5b6('0x64')]({'where':{'id':_0xf78c85['params']['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x397786,null))['then'](function(_0x44baf3){if(_0x44baf3){return _0x44baf3['removeAgents'](_0xf78c85[_0xf5b6('0x4a')][_0xf5b6('0x71')])[_0xf5b6('0x26')](function(){if(_[_0xf5b6('0xc5')](_0xf78c85[_0xf5b6('0x4a')][_0xf5b6('0x71')])){for(var _0x4016af=0x0;_0x4016af<_0xf78c85[_0xf5b6('0x4a')][_0xf5b6('0x71')]['length'];_0x4016af+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0xf78c85[_0xf5b6('0x4a')]['ids'][_0x4016af]),'FaxAccountId':Number(_0xf78c85[_0xf5b6('0x5c')]['id'])});}}else{socket[_0xf5b6('0xc2')](_0xf5b6('0xc6'),{'UserId':Number(_0xf78c85[_0xf5b6('0x4a')]['ids']),'FaxAccountId':Number(_0xf78c85[_0xf5b6('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x397786,null))[_0xf5b6('0x2f')](handleError(_0x397786,null));};exports[_0xf5b6('0xc7')]=function(_0x2ccdfe,_0x58cdc0,_0x59ae23){var _0x3a5a58={};var _0x5b70a7={};var _0x4e7d4d;var _0x410637;return db[_0xf5b6('0x59')][_0xf5b6('0x6c')]({'where':{'id':_0x2ccdfe[_0xf5b6('0x5c')]['id']}})[_0xf5b6('0x26')](handleEntityNotFound(_0x58cdc0,null))['then'](function(_0x2282b7){if(_0x2282b7){_0x4e7d4d=_0x2282b7;_0x5b70a7[_0xf5b6('0x49')]=_['keys'](db[_0xf5b6('0x7a')][_0xf5b6('0x45')]);_0x5b70a7[_0xf5b6('0x4a')]=_[_0xf5b6('0x4b')](_0x2ccdfe[_0xf5b6('0x4a')]);_0x5b70a7[_0xf5b6('0x53')]=_[_0xf5b6('0x4c')](_0x5b70a7['model'],_0x5b70a7[_0xf5b6('0x4a')]);_0x3a5a58[_0xf5b6('0x4d')]=_[_0xf5b6('0x4c')](_0x5b70a7['model'],qs['fields'](_0x2ccdfe[_0xf5b6('0x4a')][_0xf5b6('0x4e')]));_0x3a5a58[_0xf5b6('0x4d')]=_0x3a5a58[_0xf5b6('0x4d')][_0xf5b6('0x4f')]?_0x3a5a58[_0xf5b6('0x4d')]:_0x5b70a7['model'];_0x3a5a58[_0xf5b6('0x51')]=qs[_0xf5b6('0x52')](_0x2ccdfe[_0xf5b6('0x4a')][_0xf5b6('0x52')]);_0x3a5a58[_0xf5b6('0x56')]=qs[_0xf5b6('0x53')](_[_0xf5b6('0x54')](_0x2ccdfe['query'],_0x5b70a7[_0xf5b6('0x53')]));if(_0x2ccdfe['query'][_0xf5b6('0x55')]){_0x3a5a58[_0xf5b6('0x56')]=_['merge'](_0x3a5a58['where'],{'$or':_[_0xf5b6('0x44')](_0x3a5a58[_0xf5b6('0x4d')],function(_0x34acc4){var _0xf097ce={};_0xf097ce[_0x34acc4]={'$like':'%'+_0x2ccdfe[_0xf5b6('0x4a')][_0xf5b6('0x55')]+'%'};return _0xf097ce;})});}_0x3a5a58=_[_0xf5b6('0x6e')]({},_0x3a5a58,_0x2ccdfe['options']);return _0x4e7d4d[_0xf5b6('0xc7')](_0x3a5a58);}})[_0xf5b6('0x26')](function(_0x446129){if(_0x446129){_0x410637=_0x446129[_0xf5b6('0x4f')];if(!_0x2ccdfe['query'][_0xf5b6('0x94')](_0xf5b6('0x50'))){_0x3a5a58['limit']=qs[_0xf5b6('0x33')](_0x2ccdfe[_0xf5b6('0x4a')][_0xf5b6('0x33')]);_0x3a5a58[_0xf5b6('0x31')]=qs['offset'](_0x2ccdfe['query'][_0xf5b6('0x31')]);}return _0x4e7d4d[_0xf5b6('0xc7')](_0x3a5a58);}})[_0xf5b6('0x26')](function(_0x2aba0d){if(_0x2aba0d){return _0x2aba0d?{'count':_0x410637,'rows':_0x2aba0d}:null;}})['then'](respondWithResult(_0x58cdc0,null))[_0xf5b6('0x2f')](handleError(_0x58cdc0,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cb70812..07168db 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 _0xe573=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5ae013,_0x35928e){var _0x517dec=function(_0x3476c2){while(--_0x3476c2){_0x5ae013['push'](_0x5ae013['shift']());}};_0x517dec(++_0x35928e);}(_0xe573,0x1ee));var _0x3e57=function(_0x2465e1,_0x4267bd){_0x2465e1=_0x2465e1-0x0;var _0x25747d=_0xe573[_0x2465e1];return _0x25747d;};'use strict';var EventEmitter=require(_0x3e57('0x0'));var FaxAccount=require(_0x3e57('0x1'))['db'][_0x3e57('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3e57('0x3')](0x0);var events={'afterCreate':_0x3e57('0x4'),'afterUpdate':_0x3e57('0x5'),'afterDestroy':_0x3e57('0x6')};function emitEvent(_0x492992){return function(_0x4857b5,_0x340da5,_0x27dcb7){FaxAccountEvents[_0x3e57('0x7')](_0x492992+':'+_0x4857b5['id'],_0x4857b5);FaxAccountEvents[_0x3e57('0x7')](_0x492992,_0x4857b5);_0x27dcb7(null);};}for(var e in events){if(events[_0x3e57('0x8')](e)){var event=events[e];FaxAccount[_0x3e57('0x9')](e,emitEvent(event));}}module[_0x3e57('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0xda58=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x22893c,_0x2d1ab9){var _0x58dc82=function(_0x2055bd){while(--_0x2055bd){_0x22893c['push'](_0x22893c['shift']());}};_0x58dc82(++_0x2d1ab9);}(_0xda58,0xea));var _0x8da5=function(_0x1be2d6,_0x273e33){_0x1be2d6=_0x1be2d6-0x0;var _0x41eda6=_0xda58[_0x1be2d6];return _0x41eda6;};'use strict';var EventEmitter=require(_0x8da5('0x0'));var FaxAccount=require(_0x8da5('0x1'))['db'][_0x8da5('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8da5('0x3')](0x0);var events={'afterCreate':_0x8da5('0x4'),'afterUpdate':_0x8da5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x7baea6){return function(_0x543927,_0x29227d,_0x5c413d){FaxAccountEvents[_0x8da5('0x6')](_0x7baea6+':'+_0x543927['id'],_0x543927);FaxAccountEvents['emit'](_0x7baea6,_0x543927);_0x5c413d(null);};}for(var e in events){if(events[_0x8da5('0x7')](e)){var event=events[e];FaxAccount[_0x8da5('0x8')](e,emitEvent(event));}}module[_0x8da5('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 4dcd027..21a17ca 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 _0x5c0f=['../../config/environment','./faxAccount.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise'];(function(_0x39d481,_0x468019){var _0x510b49=function(_0x3f57d9){while(--_0x3f57d9){_0x39d481['push'](_0x39d481['shift']());}};_0x510b49(++_0x468019);}(_0x5c0f,0xc1));var _0xf5c0=function(_0x27c69c,_0x4fa9a9){_0x27c69c=_0x27c69c-0x0;var _0x339bd9=_0x5c0f[_0x27c69c];return _0x339bd9;};'use strict';var _=require(_0xf5c0('0x0'));var util=require('util');var logger=require(_0xf5c0('0x1'))(_0xf5c0('0x2'));var moment=require(_0xf5c0('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5c0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf5c0('0x5'));var attributes=require(_0xf5c0('0x6'));module[_0xf5c0('0x7')]=function(_0x42a044,_0xec4056){return _0x42a044[_0xf5c0('0x8')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f75=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x46c9cc,_0xd27dca){var _0x21b46e=function(_0x33b2f5){while(--_0x33b2f5){_0x46c9cc['push'](_0x46c9cc['shift']());}};_0x21b46e(++_0xd27dca);}(_0x0f75,0x1b2));var _0x50f7=function(_0x5bda5d,_0x15d284){_0x5bda5d=_0x5bda5d-0x0;var _0x4881e7=_0x0f75[_0x5bda5d];return _0x4881e7;};'use strict';var _=require(_0x50f7('0x0'));var util=require(_0x50f7('0x1'));var logger=require(_0x50f7('0x2'))('api');var moment=require(_0x50f7('0x3'));var BPromise=require(_0x50f7('0x4'));var rp=require(_0x50f7('0x5'));var fs=require('fs');var path=require(_0x50f7('0x6'));var rimraf=require(_0x50f7('0x7'));var config=require(_0x50f7('0x8'));var attributes=require(_0x50f7('0x9'));module[_0x50f7('0xa')]=function(_0x2a5e0d,_0x3fe52d){return _0x2a5e0d['define']('FaxAccount',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 dcc40ab..2d21d5e 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 _0x7eeb=['NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','*,*,*,*','created','ContactId','interaction','UserId','User','unshift','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','map','include','model','then'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x7eeb,0x17d));var _0xb7ee=function(_0x3e92aa,_0x113124){_0x3e92aa=_0x3e92aa-0x0;var _0x249178=_0x7eeb[_0x3e92aa];return _0x249178;};'use strict';var _=require(_0xb7ee('0x0'));var util=require(_0xb7ee('0x1'));var moment=require(_0xb7ee('0x2'));var BPromise=require(_0xb7ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7ee('0x4'));var db=require(_0xb7ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7ee('0x6'))(_0xb7ee('0x7'));var config=require(_0xb7ee('0x8'));var jayson=require(_0xb7ee('0x9'));var client=jayson[_0xb7ee('0xa')][_0xb7ee('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0xb7ee('0xc')],{'host':_0xb7ee('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb7ee('0xc')]));require('./faxAccount.socket')[_0xb7ee('0xe')](socket);function respondWithRpcPromise(_0x4e861c,_0x16fb0d,_0x426172){return new BPromise(function(_0x1ebac9,_0x55fb7d){return client['request'](_0x4e861c,_0x426172)['then'](function(_0x1ae137){logger[_0xb7ee('0xf')](_0xb7ee('0x10'),_0x16fb0d,_0xb7ee('0x11'));logger['debug'](_0xb7ee('0x12'),_0x16fb0d,_0xb7ee('0x11'),JSON[_0xb7ee('0x13')](_0x1ae137));if(_0x1ae137[_0xb7ee('0x14')]){if(_0x1ae137[_0xb7ee('0x14')]['code']===0x1f4){logger[_0xb7ee('0x14')]('FaxAccount,\x20%s,\x20%s',_0x16fb0d,_0x1ae137['error'][_0xb7ee('0x15')]);return _0x55fb7d(_0x1ae137[_0xb7ee('0x14')][_0xb7ee('0x15')]);}logger[_0xb7ee('0x14')](_0xb7ee('0x10'),_0x16fb0d,_0x1ae137[_0xb7ee('0x14')][_0xb7ee('0x15')]);return _0x1ebac9(_0x1ae137['error'][_0xb7ee('0x15')]);}else{logger[_0xb7ee('0xf')](_0xb7ee('0x10'),_0x16fb0d,_0xb7ee('0x11'));_0x1ebac9(_0x1ae137['result'][_0xb7ee('0x15')]);}})[_0xb7ee('0x16')](function(_0x168d7c){logger[_0xb7ee('0x14')](_0xb7ee('0x10'),_0x16fb0d,_0x168d7c);_0x55fb7d(_0x168d7c);});});}exports[_0xb7ee('0x17')]=function(_0x543378){var _0x108853=this;return new Promise(function(_0x1a32a8,_0xf1d48d){return db[_0xb7ee('0x18')][_0xb7ee('0x19')]({'raw':_0x543378[_0xb7ee('0x1a')]?_0x543378[_0xb7ee('0x1a')][_0xb7ee('0x1b')]===undefined?!![]:![]:!![],'where':_0x543378[_0xb7ee('0x1a')]?_0x543378['options'][_0xb7ee('0x1c')]||null:null,'attributes':_0x543378[_0xb7ee('0x1a')]?_0x543378[_0xb7ee('0x1a')][_0xb7ee('0x1d')]||null:null,'limit':_0x543378[_0xb7ee('0x1a')]?_0x543378[_0xb7ee('0x1a')]['limit']||null:null,'include':_0x543378['options']?_0x543378[_0xb7ee('0x1a')]['include']?_[_0xb7ee('0x1e')](_0x543378['options'][_0xb7ee('0x1f')],function(_0x474dc4){return{'model':db[_0x474dc4[_0xb7ee('0x20')]],'as':_0x474dc4['as'],'attributes':_0x474dc4['attributes'],'include':_0x474dc4[_0xb7ee('0x1f')]?_['map'](_0x474dc4[_0xb7ee('0x1f')],function(_0x12c95f){return{'model':db[_0x12c95f[_0xb7ee('0x20')]],'as':_0x12c95f['as'],'attributes':_0x12c95f[_0xb7ee('0x1d')],'include':_0x12c95f[_0xb7ee('0x1f')]?_[_0xb7ee('0x1e')](_0x12c95f[_0xb7ee('0x1f')],function(_0x59b90){return{'model':db[_0x59b90['model']],'as':_0x59b90['as'],'attributes':_0x59b90[_0xb7ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb7ee('0x21')](function(_0x168c1f){logger[_0xb7ee('0xf')](_0xb7ee('0x17'),_0x543378);logger['debug'](_0xb7ee('0x17'),_0x543378,JSON['stringify'](_0x168c1f));_0x1a32a8(_0x168c1f);})[_0xb7ee('0x16')](function(_0x2a25f8){logger[_0xb7ee('0x14')](_0xb7ee('0x17'),_0x2a25f8[_0xb7ee('0x15')],_0x543378);_0xf1d48d(_0x108853['error'](0x1f4,_0x2a25f8[_0xb7ee('0x15')]));});});};exports[_0xb7ee('0x22')]=function(_0x29aeb7,_0x34ece4,_0x198b36){var _0x10a488=this;return new Promise(function(_0x229401,_0x49b5e2){var _0x442646={'body':_0x29aeb7[_0xb7ee('0x23')],'channel':_0xb7ee('0x24')};var _0x2104ea=[];var _0x2d7e05=[];var _0x2d46b6={};return db[_0xb7ee('0x25')]['describe']()[_0xb7ee('0x21')](function(_0x152067){if(!_0x152067){throw new db[(_0xb7ee('0x26'))][(_0xb7ee('0x27'))]('no\x20available\x20attributes');}_0x2104ea=_[_0xb7ee('0x28')](_[_0xb7ee('0x29')](_0x152067),[_0xb7ee('0x2a'),_0xb7ee('0x2b')]);_0x2d7e05=_[_0xb7ee('0x28')](_[_0xb7ee('0x29')](_0x152067),[_0xb7ee('0x2a'),'updatedAt',_0xb7ee('0x2c'),_0xb7ee('0x2d')]);if(_0x29aeb7['body']['id']){delete _0x29aeb7[_0xb7ee('0x23')]['id'];}if(_['isNil'](_0x29aeb7[_0xb7ee('0x23')][_0xb7ee('0x2e')])){throw new db[(_0xb7ee('0x26'))][(_0xb7ee('0x27'))](_0xb7ee('0x2f'));}if(_[_0xb7ee('0x30')](_0x29aeb7[_0xb7ee('0x23')][_0xb7ee('0x23')])||_0x29aeb7[_0xb7ee('0x23')]['body']===''){throw new db['Sequelize']['ValidationError'](_0xb7ee('0x31'));}if(_[_0xb7ee('0x30')](_0x29aeb7[_0xb7ee('0x23')][_0xb7ee('0x32')])){throw new db['Sequelize'][(_0xb7ee('0x27'))](_0xb7ee('0x33')+_0x2d7e05);}if(!_['includes'](_0x2d7e05,_0x29aeb7['body'][_0xb7ee('0x32')])){throw new db[(_0xb7ee('0x26'))][(_0xb7ee('0x27'))](_0xb7ee('0x34')+_0x2d7e05);}_0x2d46b6[_0x29aeb7[_0xb7ee('0x23')][_0xb7ee('0x32')]]=_0x29aeb7['body'][_0xb7ee('0x2e')];})[_0xb7ee('0x21')](function(){return db[_0xb7ee('0x18')][_0xb7ee('0x35')]({'where':{'id':_0x29aeb7[_0xb7ee('0x36')]['id']},'include':[{'model':db[_0xb7ee('0x37')],'as':_0xb7ee('0x38'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2d46b6,'limit':0x1,'order':[[_0xb7ee('0x2b'),_0xb7ee('0x39')]]}]},{'model':db[_0xb7ee('0x3a')],'as':_0xb7ee('0x3b')}]});})[_0xb7ee('0x21')](function(_0x1304ab){if(_0x1304ab&&_0x1304ab['List']){var _0x1b0207=_0x1304ab[_0xb7ee('0x3c')]({'plain':!![]});_0x442646[_0xb7ee('0x36')]=_0x1b0207;_0x442646[_0xb7ee('0x3d')]=_0x1b0207['Applications'];_0x442646[_0xb7ee('0x3e')]=_0x1b0207[_0xb7ee('0x38')];_0x442646[_0xb7ee('0x3d')]=_[_0xb7ee('0x3f')](_0x442646[_0xb7ee('0x3d')],[_0xb7ee('0x40')],['asc']);if(_0x442646['account'][_0xb7ee('0x3b')]){delete _0x442646[_0xb7ee('0x36')][_0xb7ee('0x3b')];}if(_0x442646[_0xb7ee('0x36')][_0xb7ee('0x38')]&&_0x442646['account'][_0xb7ee('0x38')]['Contacts'][_0xb7ee('0x41')]){return _0x442646['account'][_0xb7ee('0x38')]['Contacts'][0x0];}var _0x229c9c=_[_0xb7ee('0x42')](_0x29aeb7['body'],{'firstName':_0x29aeb7[_0xb7ee('0x23')][_0xb7ee('0x2e')],'ListId':_0x1b0207[_0xb7ee('0x2d')]});_0x229c9c[_0x29aeb7[_0xb7ee('0x23')]['mapKey']]=_0x29aeb7[_0xb7ee('0x23')][_0xb7ee('0x2e')];return db[_0xb7ee('0x25')][_0xb7ee('0x43')](_0x229c9c,{'fields':_0x2104ea,'raw':!![]});}})[_0xb7ee('0x21')](function(_0x3838a7){_0x442646[_0xb7ee('0x44')]=_0x3838a7;if(_0x3838a7){var _0x2015db={'ContactId':_0x3838a7['id'],'FaxAccountId':_0x29aeb7[_0xb7ee('0x36')]['id'],'fax':_0x3838a7[_0xb7ee('0x24')]};return db[_0xb7ee('0x45')][_0xb7ee('0x35')]({'where':{'ContactId':_0x3838a7['id'],'closed':![],'FaxAccountId':_0x29aeb7[_0xb7ee('0x36')]['id']}})[_0xb7ee('0x21')](function(_0x54247a){if(_0x54247a){return[_0x54247a,![]];}return db[_0xb7ee('0x45')]['create'](_0x2015db)['then'](function(_0xe55522){return[_0xe55522,!![]];});});}else{throw new Error(_0xb7ee('0x46'));}})[_0xb7ee('0x47')](function(_0x5ea28e,_0x242c87){var _0x5b93fa=_0x5ea28e[_0xb7ee('0x3c')]({'plain':!![]});if(_0x242c87){if(_0x442646['account']['autoclose']){_0x442646['applications'][_0xb7ee('0x48')]({'id':0x0,'priority':_0x442646['applications'][_0xb7ee('0x41')]+0x1,'app':_0xb7ee('0x49'),'appdata':'unmanaged','interval':_0xb7ee('0x4a')});}_0x5b93fa['created']=!![];}else{_0x5b93fa[_0xb7ee('0x4b')]=![];}_0x442646['interaction']=_0x5b93fa;return db['FaxMessage'][_0xb7ee('0x43')]({'body':_0x29aeb7['body'][_0xb7ee('0x23')],'FaxAccountId':_0x29aeb7['account']['id'],'FaxInteractionId':_0x5ea28e['id'],'direction':'in','ContactId':_0x5ea28e[_0xb7ee('0x4c')],'AttachmentId':_0x29aeb7['body']['AttachmentId']});})[_0xb7ee('0x21')](function(_0x325c81){_0x442646[_0xb7ee('0x15')]=_0x325c81;if(_0x442646[_0xb7ee('0x4d')][_0xb7ee('0x4e')]){return db[_0xb7ee('0x4f')]['find']({'attributes':['id','name'],'where':{'id':_0x442646['interaction']['UserId']}})[_0xb7ee('0x21')](function(_0x3407e3){if(_0x3407e3){_0x442646[_0xb7ee('0x3d')][_0xb7ee('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3407e3['name']+','+(_0x442646[_0xb7ee('0x36')][_0xb7ee('0x51')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb7ee('0x52'),'startRouting',_0x442646);});}return respondWithRpcPromise(_0xb7ee('0x52'),'startRouting',_0x442646);})['then'](function(_0x5b9962){_0x229401(_0x5b9962);})['catch'](function(_0x49aab3){_0x49b5e2(_0x10a488[_0xb7ee('0x14')](0x1f4,_0x49aab3[_0xb7ee('0x15')]));});});}; \ No newline at end of file +var _0x8dc4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','keys','createdAt','difference','updatedAt','CompanyId','ListId','from','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','find','account','CmList','Contacts','Applications','get','applications','List','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4dcc31,_0xfae86f){var _0x4dbd4d=function(_0x2e8250){while(--_0x2e8250){_0x4dcc31['push'](_0x4dcc31['shift']());}};_0x4dbd4d(++_0xfae86f);}(_0x8dc4,0x166));var _0x48dc=function(_0x57f17d,_0xa96a0c){_0x57f17d=_0x57f17d-0x0;var _0x39bb43=_0x8dc4[_0x57f17d];return _0x39bb43;};'use strict';var _=require(_0x48dc('0x0'));var util=require(_0x48dc('0x1'));var moment=require(_0x48dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x48dc('0x3'));var fs=require('fs');var Redis=require(_0x48dc('0x4'));var db=require(_0x48dc('0x5'))['db'];var utils=require(_0x48dc('0x6'));var logger=require(_0x48dc('0x7'))(_0x48dc('0x8'));var config=require(_0x48dc('0x9'));var jayson=require(_0x48dc('0xa'));var client=jayson[_0x48dc('0xb')][_0x48dc('0xc')]({'port':0x232c});config[_0x48dc('0xd')]=_[_0x48dc('0xe')](config[_0x48dc('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x48dc('0xf'))(new Redis(config[_0x48dc('0xd')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4f723d,_0x5a2e7d,_0x480295){return new BPromise(function(_0x3864af,_0x5a5efc){return client[_0x48dc('0x10')](_0x4f723d,_0x480295)[_0x48dc('0x11')](function(_0x30c69d){logger['info'](_0x48dc('0x12'),_0x5a2e7d,_0x48dc('0x13'));logger[_0x48dc('0x14')](_0x48dc('0x15'),_0x5a2e7d,_0x48dc('0x13'),JSON[_0x48dc('0x16')](_0x30c69d));if(_0x30c69d[_0x48dc('0x17')]){if(_0x30c69d[_0x48dc('0x17')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5a2e7d,_0x30c69d[_0x48dc('0x17')][_0x48dc('0x18')]);return _0x5a5efc(_0x30c69d['error'][_0x48dc('0x18')]);}logger[_0x48dc('0x17')](_0x48dc('0x12'),_0x5a2e7d,_0x30c69d[_0x48dc('0x17')][_0x48dc('0x18')]);return _0x3864af(_0x30c69d[_0x48dc('0x17')][_0x48dc('0x18')]);}else{logger[_0x48dc('0x19')](_0x48dc('0x12'),_0x5a2e7d,'request\x20sent');_0x3864af(_0x30c69d[_0x48dc('0x1a')][_0x48dc('0x18')]);}})[_0x48dc('0x1b')](function(_0x44420b){logger[_0x48dc('0x17')](_0x48dc('0x12'),_0x5a2e7d,_0x44420b);_0x5a5efc(_0x44420b);});});}exports[_0x48dc('0x1c')]=function(_0x17ae03){var _0x3bdaf5=this;return new Promise(function(_0x55a29d,_0x43818e){return db[_0x48dc('0x1d')][_0x48dc('0x1e')]({'raw':_0x17ae03[_0x48dc('0x1f')]?_0x17ae03[_0x48dc('0x1f')][_0x48dc('0x20')]===undefined?!![]:![]:!![],'where':_0x17ae03['options']?_0x17ae03[_0x48dc('0x1f')][_0x48dc('0x21')]||null:null,'attributes':_0x17ae03[_0x48dc('0x1f')]?_0x17ae03[_0x48dc('0x1f')][_0x48dc('0x22')]||null:null,'limit':_0x17ae03[_0x48dc('0x1f')]?_0x17ae03[_0x48dc('0x1f')][_0x48dc('0x23')]||null:null,'include':_0x17ae03['options']?_0x17ae03[_0x48dc('0x1f')]['include']?_[_0x48dc('0x24')](_0x17ae03[_0x48dc('0x1f')]['include'],function(_0x3c81dd){return{'model':db[_0x3c81dd['model']],'as':_0x3c81dd['as'],'attributes':_0x3c81dd[_0x48dc('0x22')],'include':_0x3c81dd[_0x48dc('0x25')]?_['map'](_0x3c81dd[_0x48dc('0x25')],function(_0x55aea3){return{'model':db[_0x55aea3[_0x48dc('0x26')]],'as':_0x55aea3['as'],'attributes':_0x55aea3[_0x48dc('0x22')],'include':_0x55aea3[_0x48dc('0x25')]?_[_0x48dc('0x24')](_0x55aea3['include'],function(_0x2e1816){return{'model':db[_0x2e1816[_0x48dc('0x26')]],'as':_0x2e1816['as'],'attributes':_0x2e1816[_0x48dc('0x22')]};}):[]};}):[]};}):[]:[]})[_0x48dc('0x11')](function(_0x34dacd){logger[_0x48dc('0x19')](_0x48dc('0x1c'),_0x17ae03);logger[_0x48dc('0x14')](_0x48dc('0x1c'),_0x17ae03,JSON[_0x48dc('0x16')](_0x34dacd));_0x55a29d(_0x34dacd);})[_0x48dc('0x1b')](function(_0x1e3145){logger[_0x48dc('0x17')](_0x48dc('0x1c'),_0x1e3145[_0x48dc('0x18')],_0x17ae03);_0x43818e(_0x3bdaf5[_0x48dc('0x17')](0x1f4,_0x1e3145[_0x48dc('0x18')]));});});};exports[_0x48dc('0x27')]=function(_0x49a380,_0x4990f8,_0x58317f){var _0x2f9545=this;return new Promise(function(_0x1cf8db,_0x9e6a8e){var _0x37770e={'body':_0x49a380[_0x48dc('0x28')],'channel':_0x48dc('0x29')};var _0xcfa165=[];var _0x1fac67=[];var _0x4d518a={};return db[_0x48dc('0x2a')]['describe']()[_0x48dc('0x11')](function(_0x38b8fc){if(!_0x38b8fc){throw new db[(_0x48dc('0x2b'))][(_0x48dc('0x2c'))]('no\x20available\x20attributes');}_0xcfa165=_['difference'](_[_0x48dc('0x2d')](_0x38b8fc),[_0x48dc('0x2e'),'updatedAt']);_0x1fac67=_[_0x48dc('0x2f')](_['keys'](_0x38b8fc),[_0x48dc('0x2e'),_0x48dc('0x30'),_0x48dc('0x31'),_0x48dc('0x32')]);if(_0x49a380[_0x48dc('0x28')]['id']){delete _0x49a380[_0x48dc('0x28')]['id'];}if(_['isNil'](_0x49a380[_0x48dc('0x28')][_0x48dc('0x33')])){throw new db[(_0x48dc('0x2b'))][(_0x48dc('0x2c'))]('from\x20is\x20mandatory');}if(_[_0x48dc('0x34')](_0x49a380[_0x48dc('0x28')]['body'])||_0x49a380['body'][_0x48dc('0x28')]===''){throw new db[(_0x48dc('0x2b'))][(_0x48dc('0x2c'))](_0x48dc('0x35'));}if(_[_0x48dc('0x34')](_0x49a380[_0x48dc('0x28')][_0x48dc('0x36')])){throw new db[(_0x48dc('0x2b'))]['ValidationError'](_0x48dc('0x37')+_0x1fac67);}if(!_[_0x48dc('0x38')](_0x1fac67,_0x49a380['body'][_0x48dc('0x36')])){throw new db[(_0x48dc('0x2b'))][(_0x48dc('0x2c'))](_0x48dc('0x39')+_0x1fac67);}_0x4d518a[_0x49a380[_0x48dc('0x28')][_0x48dc('0x36')]]=_0x49a380[_0x48dc('0x28')][_0x48dc('0x33')];})[_0x48dc('0x11')](function(){return db[_0x48dc('0x1d')][_0x48dc('0x3a')]({'where':{'id':_0x49a380[_0x48dc('0x3b')]['id']},'include':[{'model':db[_0x48dc('0x3c')],'as':'List','include':[{'model':db[_0x48dc('0x2a')],'as':_0x48dc('0x3d'),'where':_0x4d518a,'limit':0x1,'order':[[_0x48dc('0x30'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x48dc('0x3e')}]});})[_0x48dc('0x11')](function(_0x194a2c){if(_0x194a2c&&_0x194a2c['List']){var _0x446872=_0x194a2c[_0x48dc('0x3f')]({'plain':!![]});_0x37770e['account']=_0x446872;_0x37770e[_0x48dc('0x40')]=_0x446872[_0x48dc('0x3e')];_0x37770e['list']=_0x446872[_0x48dc('0x41')];_0x37770e[_0x48dc('0x40')]=_[_0x48dc('0x42')](_0x37770e['applications'],[_0x48dc('0x43')],[_0x48dc('0x44')]);if(_0x37770e[_0x48dc('0x3b')][_0x48dc('0x3e')]){delete _0x37770e[_0x48dc('0x3b')][_0x48dc('0x3e')];}if(_0x37770e[_0x48dc('0x3b')][_0x48dc('0x41')]&&_0x37770e['account']['List'][_0x48dc('0x3d')][_0x48dc('0x45')]){return _0x37770e[_0x48dc('0x3b')][_0x48dc('0x41')][_0x48dc('0x3d')][0x0];}var _0x4225c0=_['defaults'](_0x49a380['body'],{'firstName':_0x49a380[_0x48dc('0x28')][_0x48dc('0x33')],'ListId':_0x446872['ListId']});_0x4225c0[_0x49a380[_0x48dc('0x28')][_0x48dc('0x36')]]=_0x49a380[_0x48dc('0x28')]['from'];return db[_0x48dc('0x2a')][_0x48dc('0x46')](_0x4225c0,{'fields':_0xcfa165,'raw':!![]});}})[_0x48dc('0x11')](function(_0x37fbe6){_0x37770e[_0x48dc('0x47')]=_0x37fbe6;if(_0x37fbe6){var _0x35ea6d={'ContactId':_0x37fbe6['id'],'FaxAccountId':_0x49a380['account']['id'],'fax':_0x37fbe6[_0x48dc('0x29')]};return db[_0x48dc('0x48')]['find']({'where':{'ContactId':_0x37fbe6['id'],'closed':![],'FaxAccountId':_0x49a380[_0x48dc('0x3b')]['id']}})[_0x48dc('0x11')](function(_0x8d69d){if(_0x8d69d){return[_0x8d69d,![]];}return db[_0x48dc('0x48')][_0x48dc('0x46')](_0x35ea6d)[_0x48dc('0x11')](function(_0x2c486e){return[_0x2c486e,!![]];});});}else{throw new Error(_0x48dc('0x49'));}})[_0x48dc('0x4a')](function(_0x12ea48,_0x555a6c){var _0x4c7ce2=_0x12ea48[_0x48dc('0x3f')]({'plain':!![]});if(_0x555a6c){if(_0x37770e[_0x48dc('0x3b')][_0x48dc('0x4b')]){_0x37770e[_0x48dc('0x40')][_0x48dc('0x4c')]({'id':0x0,'priority':_0x37770e['applications']['length']+0x1,'app':'close','appdata':_0x48dc('0x4d'),'interval':'*,*,*,*'});}_0x4c7ce2[_0x48dc('0x4e')]=!![];}else{_0x4c7ce2[_0x48dc('0x4e')]=![];}_0x37770e[_0x48dc('0x4f')]=_0x4c7ce2;return db[_0x48dc('0x50')][_0x48dc('0x46')]({'body':_0x49a380[_0x48dc('0x28')][_0x48dc('0x28')],'FaxAccountId':_0x49a380[_0x48dc('0x3b')]['id'],'FaxInteractionId':_0x12ea48['id'],'direction':'in','ContactId':_0x12ea48[_0x48dc('0x51')],'AttachmentId':_0x49a380[_0x48dc('0x28')][_0x48dc('0x52')]});})[_0x48dc('0x11')](function(_0x4435fb){_0x37770e[_0x48dc('0x18')]=_0x4435fb;if(_0x37770e['interaction']['UserId']){return db[_0x48dc('0x53')][_0x48dc('0x3a')]({'attributes':['id',_0x48dc('0x54')],'where':{'id':_0x37770e['interaction']['UserId']}})[_0x48dc('0x11')](function(_0x581def){if(_0x581def){_0x37770e[_0x48dc('0x40')][_0x48dc('0x55')]({'id':0x0,'priority':0x0,'app':_0x48dc('0x56'),'appdata':_0x581def[_0x48dc('0x54')]+','+(_0x37770e[_0x48dc('0x3b')][_0x48dc('0x57')]||0xa),'interval':_0x48dc('0x58')});}return respondWithRpcPromise(_0x48dc('0x59'),_0x48dc('0x5a'),_0x37770e);});}return respondWithRpcPromise(_0x48dc('0x59'),'startRouting',_0x37770e);})[_0x48dc('0x11')](function(_0xf7d3b3){_0x1cf8db(_0xf7d3b3);})[_0x48dc('0x1b')](function(_0x3a4cde){_0x9e6a8e(_0x2f9545[_0x48dc('0x17')](0x1f4,_0x3a4cde[_0x48dc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2615e46..126f4e3 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 _0x4776=['emit','register','length','faxAccount:','save','remove','update'];(function(_0x2c75eb,_0x14b302){var _0x18d29c=function(_0x4d2289){while(--_0x4d2289){_0x2c75eb['push'](_0x2c75eb['shift']());}};_0x18d29c(++_0x14b302);}(_0x4776,0x1cb));var _0x6477=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x4776[_0xe73080];return _0x12cbc4;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6477('0x0'),_0x6477('0x1'),_0x6477('0x2')];function createListener(_0x1c06c0,_0x41a57d){return function(_0x5e2c0d){_0x41a57d[_0x6477('0x3')](_0x1c06c0,_0x5e2c0d);};}function removeListener(_0x29bdb3,_0x32a159){return function(){FaxAccountEvents['removeListener'](_0x29bdb3,_0x32a159);};}exports[_0x6477('0x4')]=function(_0x3411d9){for(var _0xa5f791=0x0,_0x2eb91f=events[_0x6477('0x5')];_0xa5f791<_0x2eb91f;_0xa5f791++){var _0x9d827e=events[_0xa5f791];var _0x504bbd=createListener(_0x6477('0x6')+_0x9d827e,_0x3411d9);FaxAccountEvents['on'](_0x9d827e,_0x504bbd);}}; \ No newline at end of file +var _0x7cf2=['./faxAccount.events','remove','update','removeListener','register','faxAccount:'];(function(_0x5524a1,_0x37c171){var _0x4ea5e3=function(_0x493ee1){while(--_0x493ee1){_0x5524a1['push'](_0x5524a1['shift']());}};_0x4ea5e3(++_0x37c171);}(_0x7cf2,0x126));var _0x27cf=function(_0x1cc211,_0x4856f1){_0x1cc211=_0x1cc211-0x0;var _0x5df05a=_0x7cf2[_0x1cc211];return _0x5df05a;};'use strict';var FaxAccountEvents=require(_0x27cf('0x0'));var events=['save',_0x27cf('0x1'),_0x27cf('0x2')];function createListener(_0x2776be,_0x1eacf8){return function(_0x516bbd){_0x1eacf8['emit'](_0x2776be,_0x516bbd);};}function removeListener(_0x11db76,_0x240345){return function(){FaxAccountEvents[_0x27cf('0x3')](_0x11db76,_0x240345);};}exports[_0x27cf('0x4')]=function(_0xc016fd){for(var _0xf7a3b9=0x0,_0x5a5fad=events['length'];_0xf7a3b9<_0x5a5fad;_0xf7a3b9++){var _0x3a56a2=events[_0xf7a3b9];var _0x28a953=createListener(_0x27cf('0x5')+_0x3a56a2,_0xc016fd);FaxAccountEvents['on'](_0x3a56a2,_0x28a953);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index dca3707..f9ab27e 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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x28950b,_0x34bd03){var _0x15d6d4=function(_0x554ec2){while(--_0x554ec2){_0x28950b['push'](_0x28950b['shift']());}};_0x15d6d4(++_0x34bd03);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 f02d76b..3e569fb 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 _0x899a=['noop','TEXT','*,*,*,*','STRING'];(function(_0x20cbd8,_0x15434d){var _0x27ccf8=function(_0x4dd548){while(--_0x4dd548){_0x20cbd8['push'](_0x20cbd8['shift']());}};_0x27ccf8(++_0x15434d);}(_0x899a,0xff));var _0xa899=function(_0x54a30d,_0x254534){_0x54a30d=_0x54a30d-0x0;var _0x1b81bd=_0x899a[_0x54a30d];return _0x1b81bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa899('0x0')],'allowNull':![],'defaultValue':_0xa899('0x1')},'appdata':{'type':Sequelize[_0xa899('0x2')]()},'description':{'type':Sequelize[_0xa899('0x0')]},'interval':{'type':Sequelize[_0xa899('0x0')],'defaultValue':_0xa899('0x3')}}; \ No newline at end of file +var _0x4f0d=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x5abf17,_0x402570){var _0x4358bc=function(_0x5845b7){while(--_0x5845b7){_0x5abf17['push'](_0x5abf17['shift']());}};_0x4358bc(++_0x402570);}(_0x4f0d,0x184));var _0xd4f0=function(_0xc6cd9,_0x24938f){_0xc6cd9=_0xc6cd9-0x0;var _0x39ca4b=_0x4f0d[_0xc6cd9];return _0x39ca4b;};'use strict';var Sequelize=require(_0xd4f0('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd4f0('0x1')],'allowNull':![],'defaultValue':_0xd4f0('0x2')},'appdata':{'type':Sequelize[_0xd4f0('0x3')]()},'description':{'type':Sequelize[_0xd4f0('0x1')]},'interval':{'type':Sequelize[_0xd4f0('0x1')],'defaultValue':_0xd4f0('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d981c0f..ba7dee2 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 _0x811f=['FaxApplication','rawAttributes','type','key','query','model','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map'];(function(_0x1522f5,_0x134b6b){var _0x2cb9ba=function(_0x477d9f){while(--_0x477d9f){_0x1522f5['push'](_0x1522f5['shift']());}};_0x2cb9ba(++_0x134b6b);}(_0x811f,0x1eb));var _0xf811=function(_0x1bd948,_0xd2639c){_0x1bd948=_0x1bd948-0x0;var _0x5cccf9=_0x811f[_0x1bd948];return _0x5cccf9;};'use strict';var emlformat=require(_0xf811('0x0'));var rimraf=require(_0xf811('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf811('0x2'));var rp=require(_0xf811('0x3'));var moment=require(_0xf811('0x4'));var BPromise=require(_0xf811('0x5'));var Mustache=require('mustache');var util=require(_0xf811('0x6'));var path=require('path');var sox=require(_0xf811('0x7'));var csv=require('to-csv');var ejs=require(_0xf811('0x8'));var fs=require('fs');var fs_extra=require(_0xf811('0x9'));var _=require(_0xf811('0xa'));var squel=require(_0xf811('0xb'));var crypto=require(_0xf811('0xc'));var jsforce=require(_0xf811('0xd'));var deskjs=require(_0xf811('0xe'));var toCsv=require(_0xf811('0xf'));var querystring=require('querystring');var Papa=require(_0xf811('0x10'));var Redis=require(_0xf811('0x11'));var authService=require(_0xf811('0x12'));var qs=require(_0xf811('0x13'));var as=require(_0xf811('0x14'));var hardwareService=require(_0xf811('0x15'));var logger=require(_0xf811('0x16'))('api');var utils=require(_0xf811('0x17'));var config=require(_0xf811('0x18'));var licenseUtil=require(_0xf811('0x19'));var db=require(_0xf811('0x1a'))['db'];function respondWithStatusCode(_0x14fd7f,_0x325312){_0x325312=_0x325312||0xcc;return function(_0x288aaf){if(_0x288aaf){return _0x14fd7f[_0xf811('0x1b')](_0x325312);}return _0x14fd7f[_0xf811('0x1c')](_0x325312)['end']();};}function respondWithResult(_0x3c212e,_0x49e7d5){_0x49e7d5=_0x49e7d5||0xc8;return function(_0x1dc4d4){if(_0x1dc4d4){return _0x3c212e[_0xf811('0x1c')](_0x49e7d5)[_0xf811('0x1d')](_0x1dc4d4);}};}function respondWithFilteredResult(_0x1d1919,_0x3412b1){return function(_0x68de09){if(_0x68de09){var _0xe57a96=typeof _0x3412b1[_0xf811('0x1e')]===_0xf811('0x1f')&&typeof _0x3412b1[_0xf811('0x20')]===_0xf811('0x1f');var _0x25009b=_0x68de09['count'];var _0x3744c5=_0xe57a96?0x0:_0x3412b1[_0xf811('0x1e')];var _0x41f151=_0xe57a96?_0x68de09['count']:_0x3412b1['offset']+_0x3412b1[_0xf811('0x20')];var _0x4efad5;if(_0x41f151>=_0x25009b){_0x41f151=_0x25009b;_0x4efad5=0xc8;}else{_0x4efad5=0xce;}_0x1d1919[_0xf811('0x1c')](_0x4efad5);return _0x1d1919[_0xf811('0x21')](_0xf811('0x22'),_0x3744c5+'-'+_0x41f151+'/'+_0x25009b)[_0xf811('0x1d')](_0x68de09);}return null;};}function patchUpdates(_0x41d88d){return function(_0x368534){try{jsonpatch[_0xf811('0x23')](_0x368534,_0x41d88d,!![]);}catch(_0x193f0d){return BPromise[_0xf811('0x24')](_0x193f0d);}return _0x368534[_0xf811('0x25')]();};}function saveUpdates(_0x3dbbd4,_0x385db9){return function(_0x25d201){if(_0x25d201){return _0x25d201[_0xf811('0x26')](_0x3dbbd4)['then'](function(_0x5c5033){return _0x5c5033;});}return null;};}function removeEntity(_0x32507d,_0x2b3606){return function(_0xeb8b79){if(_0xeb8b79){return _0xeb8b79[_0xf811('0x27')]()[_0xf811('0x28')](function(){_0x32507d['status'](0xcc)[_0xf811('0x29')]();});}};}function handleEntityNotFound(_0x2b10e2,_0x28d7c8){return function(_0x5b8139){if(!_0x5b8139){_0x2b10e2[_0xf811('0x1b')](0x194);}return _0x5b8139;};}function handleError(_0x478fbe,_0x58d800){_0x58d800=_0x58d800||0x1f4;return function(_0x56f53d){logger[_0xf811('0x2a')](_0x56f53d[_0xf811('0x2b')]);if(_0x56f53d[_0xf811('0x2c')]){delete _0x56f53d[_0xf811('0x2c')];}_0x478fbe['status'](_0x58d800)[_0xf811('0x2d')](_0x56f53d);};}exports[_0xf811('0x2e')]=function(_0x44171a,_0x4e53a9){var _0x1d4176={},_0xdb8567={},_0x5765cc={'count':0x0,'rows':[]};var _0x16f0a1=_[_0xf811('0x2f')](db[_0xf811('0x30')][_0xf811('0x31')],function(_0x2e0895){return{'name':_0x2e0895['fieldName'],'type':_0x2e0895[_0xf811('0x32')][_0xf811('0x33')]};});_0xdb8567['model']=_[_0xf811('0x2f')](_0x16f0a1,_0xf811('0x2c'));_0xdb8567[_0xf811('0x34')]=_['keys'](_0x44171a['query']);_0xdb8567['filters']=_['intersection'](_0xdb8567[_0xf811('0x35')],_0xdb8567[_0xf811('0x34')]);_0x1d4176[_0xf811('0x36')]=_[_0xf811('0x37')](_0xdb8567[_0xf811('0x35')],qs[_0xf811('0x38')](_0x44171a[_0xf811('0x34')]['fields']));_0x1d4176[_0xf811('0x36')]=_0x1d4176[_0xf811('0x36')][_0xf811('0x39')]?_0x1d4176[_0xf811('0x36')]:_0xdb8567[_0xf811('0x35')];if(!_0x44171a['query']['hasOwnProperty']('nolimit')){_0x1d4176[_0xf811('0x20')]=qs[_0xf811('0x20')](_0x44171a[_0xf811('0x34')][_0xf811('0x20')]);_0x1d4176['offset']=qs[_0xf811('0x1e')](_0x44171a[_0xf811('0x34')]['offset']);}_0x1d4176[_0xf811('0x3a')]=qs[_0xf811('0x3b')](_0x44171a[_0xf811('0x34')]['sort']);_0x1d4176[_0xf811('0x3c')]=qs[_0xf811('0x3d')](_[_0xf811('0x3e')](_0x44171a[_0xf811('0x34')],_0xdb8567[_0xf811('0x3d')]),_0x16f0a1);if(_0x44171a[_0xf811('0x34')][_0xf811('0x3f')]){_0x1d4176[_0xf811('0x3c')]=_[_0xf811('0x40')](_0x1d4176[_0xf811('0x3c')],{'$or':_[_0xf811('0x2f')](_0x16f0a1,function(_0x76967e){if(_0x76967e['type']!=='VIRTUAL'){var _0x490f1b={};_0x490f1b[_0x76967e[_0xf811('0x2c')]]={'$like':'%'+_0x44171a['query'][_0xf811('0x3f')]+'%'};return _0x490f1b;}})});}_0x1d4176=_[_0xf811('0x40')]({},_0x1d4176,_0x44171a[_0xf811('0x41')]);var _0x107464={'where':_0x1d4176['where']};return db[_0xf811('0x30')][_0xf811('0x42')](_0x107464)['then'](function(_0x5c6f9b){_0x5765cc[_0xf811('0x42')]=_0x5c6f9b;if(_0x44171a[_0xf811('0x34')][_0xf811('0x43')]){_0x1d4176[_0xf811('0x44')]=[{'all':!![]}];}return db[_0xf811('0x30')][_0xf811('0x45')](_0x1d4176);})[_0xf811('0x28')](function(_0x4c83d4){_0x5765cc['rows']=_0x4c83d4;return _0x5765cc;})[_0xf811('0x28')](respondWithFilteredResult(_0x4e53a9,_0x1d4176))[_0xf811('0x46')](handleError(_0x4e53a9,null));};exports[_0xf811('0x47')]=function(_0x1e660c,_0x2875c4){var _0x426402={'raw':!![],'where':{'id':_0x1e660c[_0xf811('0x48')]['id']}},_0x42e2fc={};_0x42e2fc['model']=_[_0xf811('0x49')](db[_0xf811('0x30')]['rawAttributes']);_0x42e2fc[_0xf811('0x34')]=_[_0xf811('0x49')](_0x1e660c[_0xf811('0x34')]);_0x42e2fc[_0xf811('0x3d')]=_[_0xf811('0x37')](_0x42e2fc[_0xf811('0x35')],_0x42e2fc[_0xf811('0x34')]);_0x426402[_0xf811('0x36')]=_['intersection'](_0x42e2fc[_0xf811('0x35')],qs['fields'](_0x1e660c[_0xf811('0x34')]['fields']));_0x426402[_0xf811('0x36')]=_0x426402[_0xf811('0x36')][_0xf811('0x39')]?_0x426402[_0xf811('0x36')]:_0x42e2fc[_0xf811('0x35')];if(_0x1e660c[_0xf811('0x34')][_0xf811('0x43')]){_0x426402['include']=[{'all':!![]}];}_0x426402=_['merge']({},_0x426402,_0x1e660c[_0xf811('0x41')]);return db[_0xf811('0x30')][_0xf811('0x4a')](_0x426402)[_0xf811('0x28')](handleEntityNotFound(_0x2875c4,null))[_0xf811('0x28')](respondWithResult(_0x2875c4,null))[_0xf811('0x46')](handleError(_0x2875c4,null));};exports['create']=function(_0x36aa92,_0x20a1d2){return db['FaxApplication'][_0xf811('0x4b')](_0x36aa92[_0xf811('0x4c')],{})['then'](respondWithResult(_0x20a1d2,0xc9))['catch'](handleError(_0x20a1d2,null));};exports[_0xf811('0x26')]=function(_0x4bb817,_0x42e4ab){if(_0x4bb817['body']['id']){delete _0x4bb817['body']['id'];}return db['FaxApplication'][_0xf811('0x4a')]({'where':{'id':_0x4bb817[_0xf811('0x48')]['id']}})[_0xf811('0x28')](handleEntityNotFound(_0x42e4ab,null))[_0xf811('0x28')](saveUpdates(_0x4bb817['body'],null))['then'](respondWithResult(_0x42e4ab,null))[_0xf811('0x46')](handleError(_0x42e4ab,null));};exports['destroy']=function(_0xae6d36,_0x5214e1){return db[_0xf811('0x30')][_0xf811('0x4a')]({'where':{'id':_0xae6d36[_0xf811('0x48')]['id']}})[_0xf811('0x28')](handleEntityNotFound(_0x5214e1,null))[_0xf811('0x28')](removeEntity(_0x5214e1,null))[_0xf811('0x46')](handleError(_0x5214e1,null));}; \ No newline at end of file +var _0xe1be=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','includeAll','include','rows','show','params','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe1be,0xbf));var _0xee1b=function(_0x4a8be8,_0x1c5aa5){_0x4a8be8=_0x4a8be8-0x0;var _0x84471a=_0xe1be[_0x4a8be8];return _0x84471a;};'use strict';var emlformat=require(_0xee1b('0x0'));var rimraf=require(_0xee1b('0x1'));var zipdir=require(_0xee1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee1b('0x3'));var moment=require(_0xee1b('0x4'));var BPromise=require(_0xee1b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xee1b('0x6'));var csv=require(_0xee1b('0x7'));var ejs=require(_0xee1b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee1b('0x9'));var squel=require(_0xee1b('0xa'));var crypto=require('crypto');var jsforce=require(_0xee1b('0xb'));var deskjs=require(_0xee1b('0xc'));var toCsv=require(_0xee1b('0x7'));var querystring=require(_0xee1b('0xd'));var Papa=require(_0xee1b('0xe'));var Redis=require(_0xee1b('0xf'));var authService=require(_0xee1b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xee1b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee1b('0x12'))('api');var utils=require(_0xee1b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee1b('0x14'))['db'];function respondWithStatusCode(_0x2c1fb3,_0x3b05f7){_0x3b05f7=_0x3b05f7||0xcc;return function(_0x1696f2){if(_0x1696f2){return _0x2c1fb3['sendStatus'](_0x3b05f7);}return _0x2c1fb3[_0xee1b('0x15')](_0x3b05f7)[_0xee1b('0x16')]();};}function respondWithResult(_0x394efb,_0xf9b282){_0xf9b282=_0xf9b282||0xc8;return function(_0x17c307){if(_0x17c307){return _0x394efb[_0xee1b('0x15')](_0xf9b282)[_0xee1b('0x17')](_0x17c307);}};}function respondWithFilteredResult(_0x489054,_0x1ad9f6){return function(_0x2508dd){if(_0x2508dd){var _0x17dae4=typeof _0x1ad9f6['offset']===_0xee1b('0x18')&&typeof _0x1ad9f6['limit']===_0xee1b('0x18');var _0x5f3b0=_0x2508dd[_0xee1b('0x19')];var _0x32d918=_0x17dae4?0x0:_0x1ad9f6[_0xee1b('0x1a')];var _0x3a07b1=_0x17dae4?_0x2508dd['count']:_0x1ad9f6[_0xee1b('0x1a')]+_0x1ad9f6[_0xee1b('0x1b')];var _0x5a0820;if(_0x3a07b1>=_0x5f3b0){_0x3a07b1=_0x5f3b0;_0x5a0820=0xc8;}else{_0x5a0820=0xce;}_0x489054[_0xee1b('0x15')](_0x5a0820);return _0x489054[_0xee1b('0x1c')](_0xee1b('0x1d'),_0x32d918+'-'+_0x3a07b1+'/'+_0x5f3b0)[_0xee1b('0x17')](_0x2508dd);}return null;};}function patchUpdates(_0x466aa7){return function(_0x2b25c2){try{jsonpatch[_0xee1b('0x1e')](_0x2b25c2,_0x466aa7,!![]);}catch(_0x4737a3){return BPromise[_0xee1b('0x1f')](_0x4737a3);}return _0x2b25c2['save']();};}function saveUpdates(_0x4c63e9,_0x4dd14d){return function(_0x5a2697){if(_0x5a2697){return _0x5a2697[_0xee1b('0x20')](_0x4c63e9)[_0xee1b('0x21')](function(_0x2baa28){return _0x2baa28;});}return null;};}function removeEntity(_0x5188b4,_0x397ebf){return function(_0x5b230b){if(_0x5b230b){return _0x5b230b[_0xee1b('0x22')]()[_0xee1b('0x21')](function(){_0x5188b4[_0xee1b('0x15')](0xcc)[_0xee1b('0x16')]();});}};}function handleEntityNotFound(_0x1c6ee4,_0x372c8e){return function(_0x11af30){if(!_0x11af30){_0x1c6ee4[_0xee1b('0x23')](0x194);}return _0x11af30;};}function handleError(_0x9f7657,_0x2196de){_0x2196de=_0x2196de||0x1f4;return function(_0x38e2fa){logger[_0xee1b('0x24')](_0x38e2fa[_0xee1b('0x25')]);if(_0x38e2fa[_0xee1b('0x26')]){delete _0x38e2fa[_0xee1b('0x26')];}_0x9f7657[_0xee1b('0x15')](_0x2196de)['send'](_0x38e2fa);};}exports[_0xee1b('0x27')]=function(_0x459216,_0x40cadf){var _0x4d80af={},_0x25ec64={},_0x491ff9={'count':0x0,'rows':[]};var _0x597247=_[_0xee1b('0x28')](db[_0xee1b('0x29')][_0xee1b('0x2a')],function(_0x1a26d2){return{'name':_0x1a26d2[_0xee1b('0x2b')],'type':_0x1a26d2[_0xee1b('0x2c')][_0xee1b('0x2d')]};});_0x25ec64[_0xee1b('0x2e')]=_['map'](_0x597247,'name');_0x25ec64[_0xee1b('0x2f')]=_[_0xee1b('0x30')](_0x459216[_0xee1b('0x2f')]);_0x25ec64['filters']=_[_0xee1b('0x31')](_0x25ec64[_0xee1b('0x2e')],_0x25ec64[_0xee1b('0x2f')]);_0x4d80af[_0xee1b('0x32')]=_[_0xee1b('0x31')](_0x25ec64[_0xee1b('0x2e')],qs[_0xee1b('0x33')](_0x459216['query'][_0xee1b('0x33')]));_0x4d80af['attributes']=_0x4d80af[_0xee1b('0x32')][_0xee1b('0x34')]?_0x4d80af[_0xee1b('0x32')]:_0x25ec64[_0xee1b('0x2e')];if(!_0x459216[_0xee1b('0x2f')][_0xee1b('0x35')](_0xee1b('0x36'))){_0x4d80af[_0xee1b('0x1b')]=qs['limit'](_0x459216[_0xee1b('0x2f')]['limit']);_0x4d80af[_0xee1b('0x1a')]=qs['offset'](_0x459216[_0xee1b('0x2f')][_0xee1b('0x1a')]);}_0x4d80af['order']=qs[_0xee1b('0x37')](_0x459216[_0xee1b('0x2f')][_0xee1b('0x37')]);_0x4d80af[_0xee1b('0x38')]=qs[_0xee1b('0x39')](_['pick'](_0x459216[_0xee1b('0x2f')],_0x25ec64[_0xee1b('0x39')]),_0x597247);if(_0x459216[_0xee1b('0x2f')][_0xee1b('0x3a')]){_0x4d80af[_0xee1b('0x38')]=_[_0xee1b('0x3b')](_0x4d80af[_0xee1b('0x38')],{'$or':_[_0xee1b('0x28')](_0x597247,function(_0x310bb4){if(_0x310bb4[_0xee1b('0x2c')]!=='VIRTUAL'){var _0x4fa868={};_0x4fa868[_0x310bb4['name']]={'$like':'%'+_0x459216[_0xee1b('0x2f')][_0xee1b('0x3a')]+'%'};return _0x4fa868;}})});}_0x4d80af=_[_0xee1b('0x3b')]({},_0x4d80af,_0x459216['options']);var _0x53f7d7={'where':_0x4d80af['where']};return db[_0xee1b('0x29')][_0xee1b('0x19')](_0x53f7d7)[_0xee1b('0x21')](function(_0x1969d9){_0x491ff9['count']=_0x1969d9;if(_0x459216['query'][_0xee1b('0x3c')]){_0x4d80af[_0xee1b('0x3d')]=[{'all':!![]}];}return db[_0xee1b('0x29')]['findAll'](_0x4d80af);})[_0xee1b('0x21')](function(_0x49425f){_0x491ff9[_0xee1b('0x3e')]=_0x49425f;return _0x491ff9;})[_0xee1b('0x21')](respondWithFilteredResult(_0x40cadf,_0x4d80af))['catch'](handleError(_0x40cadf,null));};exports[_0xee1b('0x3f')]=function(_0x5593aa,_0x34f81b){var _0x2bf12d={'raw':!![],'where':{'id':_0x5593aa[_0xee1b('0x40')]['id']}},_0x755d79={};_0x755d79[_0xee1b('0x2e')]=_['keys'](db[_0xee1b('0x29')]['rawAttributes']);_0x755d79[_0xee1b('0x2f')]=_[_0xee1b('0x30')](_0x5593aa[_0xee1b('0x2f')]);_0x755d79[_0xee1b('0x39')]=_[_0xee1b('0x31')](_0x755d79[_0xee1b('0x2e')],_0x755d79[_0xee1b('0x2f')]);_0x2bf12d['attributes']=_[_0xee1b('0x31')](_0x755d79['model'],qs[_0xee1b('0x33')](_0x5593aa[_0xee1b('0x2f')][_0xee1b('0x33')]));_0x2bf12d[_0xee1b('0x32')]=_0x2bf12d[_0xee1b('0x32')][_0xee1b('0x34')]?_0x2bf12d['attributes']:_0x755d79['model'];if(_0x5593aa[_0xee1b('0x2f')][_0xee1b('0x3c')]){_0x2bf12d[_0xee1b('0x3d')]=[{'all':!![]}];}_0x2bf12d=_[_0xee1b('0x3b')]({},_0x2bf12d,_0x5593aa[_0xee1b('0x41')]);return db[_0xee1b('0x29')][_0xee1b('0x42')](_0x2bf12d)[_0xee1b('0x21')](handleEntityNotFound(_0x34f81b,null))[_0xee1b('0x21')](respondWithResult(_0x34f81b,null))['catch'](handleError(_0x34f81b,null));};exports[_0xee1b('0x43')]=function(_0x51baac,_0x36e8c8){return db[_0xee1b('0x29')][_0xee1b('0x43')](_0x51baac[_0xee1b('0x44')],{})[_0xee1b('0x21')](respondWithResult(_0x36e8c8,0xc9))['catch'](handleError(_0x36e8c8,null));};exports[_0xee1b('0x20')]=function(_0xa4f2ff,_0x599f55){if(_0xa4f2ff[_0xee1b('0x44')]['id']){delete _0xa4f2ff[_0xee1b('0x44')]['id'];}return db[_0xee1b('0x29')][_0xee1b('0x42')]({'where':{'id':_0xa4f2ff[_0xee1b('0x40')]['id']}})[_0xee1b('0x21')](handleEntityNotFound(_0x599f55,null))['then'](saveUpdates(_0xa4f2ff[_0xee1b('0x44')],null))['then'](respondWithResult(_0x599f55,null))['catch'](handleError(_0x599f55,null));};exports['destroy']=function(_0x579f0b,_0x4c5bb2){return db['FaxApplication']['find']({'where':{'id':_0x579f0b[_0xee1b('0x40')]['id']}})[_0xee1b('0x21')](handleEntityNotFound(_0x4c5bb2,null))[_0xee1b('0x21')](removeEntity(_0x4c5bb2,null))['catch'](handleError(_0x4c5bb2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0cd2e1b..04ff80a 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 _0x1405=['api','moment','bluebird','request-promise','path','rimraf','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x2874e8,_0x89814d){var _0x36bdcc=function(_0x42d5c5){while(--_0x42d5c5){_0x2874e8['push'](_0x2874e8['shift']());}};_0x36bdcc(++_0x89814d);}(_0x1405,0x76));var _0x5140=function(_0x2ddd13,_0x4dd0bd){_0x2ddd13=_0x2ddd13-0x0;var _0x8b928b=_0x1405[_0x2ddd13];return _0x8b928b;};'use strict';var _=require(_0x5140('0x0'));var util=require('util');var logger=require(_0x5140('0x1'))(_0x5140('0x2'));var moment=require(_0x5140('0x3'));var BPromise=require(_0x5140('0x4'));var rp=require(_0x5140('0x5'));var fs=require('fs');var path=require(_0x5140('0x6'));var rimraf=require(_0x5140('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module['exports']=function(_0x16e83a,_0x368091){return _0x16e83a['define'](_0x5140('0x8'),attributes,{'tableName':_0x5140('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5140('0xa'),'collate':_0x5140('0xb')});}; \ No newline at end of file +var _0x956e=['exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x956e,0x79));var _0xe956=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x956e[_0x58a4ac];return _0x545810;};'use strict';var _=require(_0xe956('0x0'));var util=require(_0xe956('0x1'));var logger=require(_0xe956('0x2'))(_0xe956('0x3'));var moment=require('moment');var BPromise=require(_0xe956('0x4'));var rp=require(_0xe956('0x5'));var fs=require('fs');var path=require(_0xe956('0x6'));var rimraf=require(_0xe956('0x7'));var config=require(_0xe956('0x8'));var attributes=require('./faxApplication.attributes');module[_0xe956('0x9')]=function(_0xdb80c,_0x3c3da9){return _0xdb80c[_0xe956('0xa')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe956('0xb'),'collate':_0xe956('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e0c769e..ce2c343 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 _0x9135=['FaxApplication','body','options','raw','attributes','limit','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','UpdateFaxApplication'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x9135,0xd9));var _0x5913=function(_0xab18f9,_0x7f6ff6){_0xab18f9=_0xab18f9-0x0;var _0x9200fa=_0x9135[_0xab18f9];return _0x9200fa;};'use strict';var _=require('lodash');var util=require(_0x5913('0x0'));var moment=require(_0x5913('0x1'));var BPromise=require(_0x5913('0x2'));var rs=require(_0x5913('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5913('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5913('0x5'))(_0x5913('0x6'));var config=require(_0x5913('0x7'));var jayson=require(_0x5913('0x8'));var client=jayson[_0x5913('0x9')][_0x5913('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa2432,_0xb4290c,_0x328949){return new BPromise(function(_0x1041e6,_0x428377){return client[_0x5913('0xb')](_0xa2432,_0x328949)[_0x5913('0xc')](function(_0x57ed06){logger[_0x5913('0xd')]('FaxApplication,\x20%s,\x20%s',_0xb4290c,_0x5913('0xe'));logger[_0x5913('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xb4290c,_0x5913('0xe'),JSON[_0x5913('0x10')](_0x57ed06));if(_0x57ed06['error']){if(_0x57ed06[_0x5913('0x11')][_0x5913('0x12')]===0x1f4){logger[_0x5913('0x11')](_0x5913('0x13'),_0xb4290c,_0x57ed06['error'][_0x5913('0x14')]);return _0x428377(_0x57ed06['error'][_0x5913('0x14')]);}logger[_0x5913('0x11')](_0x5913('0x13'),_0xb4290c,_0x57ed06[_0x5913('0x11')][_0x5913('0x14')]);return _0x1041e6(_0x57ed06['error'][_0x5913('0x14')]);}else{logger[_0x5913('0xd')]('FaxApplication,\x20%s,\x20%s',_0xb4290c,_0x5913('0xe'));_0x1041e6(_0x57ed06[_0x5913('0x15')][_0x5913('0x14')]);}})['catch'](function(_0x4b291e){logger[_0x5913('0x11')](_0x5913('0x13'),_0xb4290c,_0x4b291e);_0x428377(_0x4b291e);});});}exports[_0x5913('0x16')]=function(_0x1c32ef){var _0x1a4a45=this;return new Promise(function(_0x50568a,_0x1b73be){return db[_0x5913('0x17')]['update'](_0x1c32ef[_0x5913('0x18')],{'raw':_0x1c32ef[_0x5913('0x19')]?_0x1c32ef[_0x5913('0x19')][_0x5913('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c32ef[_0x5913('0x19')]?_0x1c32ef['options']['where']||null:null,'attributes':_0x1c32ef['options']?_0x1c32ef['options'][_0x5913('0x1b')]||null:null,'limit':_0x1c32ef[_0x5913('0x19')]?_0x1c32ef[_0x5913('0x19')][_0x5913('0x1c')]||null:null})[_0x5913('0xc')](function(_0x22e184){logger[_0x5913('0xd')]('UpdateFaxApplication',_0x1c32ef);logger[_0x5913('0xf')]('UpdateFaxApplication',_0x1c32ef,JSON[_0x5913('0x10')](_0x22e184));_0x50568a(_0x22e184);})[_0x5913('0x1d')](function(_0x539ebc){logger['error']('UpdateFaxApplication',_0x539ebc[_0x5913('0x14')],_0x1c32ef);_0x1b73be(_0x1a4a45[_0x5913('0x11')](0x1f4,_0x539ebc['message']));});});}; \ No newline at end of file +var _0xd529=['../../config/logger','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','update','body','options','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd529,0x1c9));var _0x9d52=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd529[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9d52('0x0'));var util=require(_0x9d52('0x1'));var moment=require(_0x9d52('0x2'));var BPromise=require(_0x9d52('0x3'));var rs=require(_0x9d52('0x4'));var fs=require('fs');var Redis=require(_0x9d52('0x5'));var db=require(_0x9d52('0x6'))['db'];var utils=require(_0x9d52('0x7'));var logger=require(_0x9d52('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9d52('0x9'));var client=jayson[_0x9d52('0xa')][_0x9d52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eb7f2,_0x145323,_0x2ff138){return new BPromise(function(_0x543a86,_0xa1711b){return client[_0x9d52('0xc')](_0x1eb7f2,_0x2ff138)[_0x9d52('0xd')](function(_0x1703f5){logger[_0x9d52('0xe')]('FaxApplication,\x20%s,\x20%s',_0x145323,'request\x20sent');logger['debug'](_0x9d52('0xf'),_0x145323,_0x9d52('0x10'),JSON[_0x9d52('0x11')](_0x1703f5));if(_0x1703f5[_0x9d52('0x12')]){if(_0x1703f5['error'][_0x9d52('0x13')]===0x1f4){logger[_0x9d52('0x12')](_0x9d52('0x14'),_0x145323,_0x1703f5[_0x9d52('0x12')][_0x9d52('0x15')]);return _0xa1711b(_0x1703f5[_0x9d52('0x12')][_0x9d52('0x15')]);}logger['error'](_0x9d52('0x14'),_0x145323,_0x1703f5['error'][_0x9d52('0x15')]);return _0x543a86(_0x1703f5['error'][_0x9d52('0x15')]);}else{logger[_0x9d52('0xe')](_0x9d52('0x14'),_0x145323,_0x9d52('0x10'));_0x543a86(_0x1703f5[_0x9d52('0x16')][_0x9d52('0x15')]);}})[_0x9d52('0x17')](function(_0x5823b7){logger['error'](_0x9d52('0x14'),_0x145323,_0x5823b7);_0xa1711b(_0x5823b7);});});}exports[_0x9d52('0x18')]=function(_0x5b8899){var _0x293477=this;return new Promise(function(_0x5532c6,_0x544c22){return db['FaxApplication'][_0x9d52('0x19')](_0x5b8899[_0x9d52('0x1a')],{'raw':_0x5b8899[_0x9d52('0x1b')]?_0x5b8899[_0x9d52('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b8899['options']?_0x5b8899[_0x9d52('0x1b')]['where']||null:null,'attributes':_0x5b8899[_0x9d52('0x1b')]?_0x5b8899[_0x9d52('0x1b')][_0x9d52('0x1c')]||null:null,'limit':_0x5b8899['options']?_0x5b8899[_0x9d52('0x1b')][_0x9d52('0x1d')]||null:null})[_0x9d52('0xd')](function(_0x329297){logger['info'](_0x9d52('0x18'),_0x5b8899);logger[_0x9d52('0x1e')](_0x9d52('0x18'),_0x5b8899,JSON[_0x9d52('0x11')](_0x329297));_0x5532c6(_0x329297);})[_0x9d52('0x17')](function(_0x3fca33){logger['error'](_0x9d52('0x18'),_0x3fca33[_0x9d52('0x15')],_0x5b8899);_0x544c22(_0x293477[_0x9d52('0x12')](0x1f4,_0x3fca33[_0x9d52('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index fce384d..ce7fa35 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x234fe5,_0x3c59ea){var _0x5c1ab2=function(_0x2a0a93){while(--_0x2a0a93){_0x234fe5['push'](_0x234fe5['shift']());}};_0x5c1ab2(++_0x3c59ea);}(_0xac4a,0x13f));var _0xaac4=function(_0x5b4900,_0x553533){_0x5b4900=_0x5b4900-0x0;var _0x3a8477=_0xac4a[_0x5b4900];return _0x3a8477;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x49d741,_0x22b10f){var _0x5e412c=function(_0x4b7fbd){while(--_0x4b7fbd){_0x49d741['push'](_0x49d741['shift']());}};_0x5e412c(++_0x22b10f);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3e6dfd,_0x21c245){_0x3e6dfd=_0x3e6dfd-0x0;var _0x22a794=_0xb03e[_0x3e6dfd];return _0x22a794;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c36a6a2..9218495 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 _0xf4af=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf4af,0x7f));var _0xff4a=function(_0x21e6f1,_0x4d5eb5){_0x21e6f1=_0x21e6f1-0x0;var _0x44a394=_0xf4af[_0x21e6f1];return _0x44a394;};'use strict';var Sequelize=require(_0xff4a('0x0'));module[_0xff4a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xff4a('0x2')]},'disposition':{'type':Sequelize[_0xff4a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xff4a('0x3')]},'read1stAt':{'type':Sequelize[_0xff4a('0x2')]},'fax':{'type':Sequelize[_0xff4a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xff4a('0x4')]('in',_0xff4a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xff4a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xff4a('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4302=['out','exports','DATE','STRING','ENUM'];(function(_0x15246c,_0x4be85e){var _0x5e9bf2=function(_0xc8a6c0){while(--_0xc8a6c0){_0x15246c['push'](_0x15246c['shift']());}};_0x5e9bf2(++_0x4be85e);}(_0x4302,0x173));var _0x2430=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x4302[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require('sequelize');module[_0x2430('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2430('0x1')]},'disposition':{'type':Sequelize[_0x2430('0x2')]},'secondDisposition':{'type':Sequelize[_0x2430('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2430('0x2')]},'read1stAt':{'type':Sequelize[_0x2430('0x1')]},'fax':{'type':Sequelize[_0x2430('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x2430('0x3')]('in',_0x2430('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2430('0x3')]('in',_0x2430('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 0539a8a..602de70 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 _0x9715=['FaxMessage','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','spread','Tag','color','emit','removeTags','download','toString','join','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','pipe','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','fieldName','getOptions','findAll','query','user','catch','show','params','keys','rawAttributes','filters','model','attributes','intersection','fields','length','includeAll','include','merge','find','create','body','describe','addMessage','ids','omit','getMessages','findOne'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x9715,0x86));var _0x5971=function(_0x526a46,_0x119cc9){_0x526a46=_0x526a46-0x0;var _0x299cab=_0x9715[_0x526a46];return _0x299cab;};'use strict';var rimraf=require(_0x5971('0x0'));var zipdir=require(_0x5971('0x1'));var moment=require(_0x5971('0x2'));var BPromise=require(_0x5971('0x3'));var util=require(_0x5971('0x4'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x5971('0x5'));var interaction=require(_0x5971('0x6'));var qs=require(_0x5971('0x7'));var logger=require('../../config/logger')(_0x5971('0x8'));var config=require(_0x5971('0x9'));var db=require(_0x5971('0xa'))['db'];config[_0x5971('0xb')]=_[_0x5971('0xc')](config[_0x5971('0xb')],{'host':_0x5971('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5971('0xb')]));require('./faxInteraction.socket')[_0x5971('0xe')](socket);function respondWithStatusCode(_0x44135a,_0x8d6ca8){_0x8d6ca8=_0x8d6ca8||0xcc;return function(_0x5c1d77){if(_0x5c1d77){return _0x44135a[_0x5971('0xf')](_0x8d6ca8);}return _0x44135a[_0x5971('0x10')](_0x8d6ca8)[_0x5971('0x11')]();};}function respondWithResult(_0x8f75b7,_0x4722cc){_0x4722cc=_0x4722cc||0xc8;return function(_0xcec95c){if(_0xcec95c){return _0x8f75b7['status'](_0x4722cc)[_0x5971('0x12')](_0xcec95c);}};}function respondWithFilteredResult(_0x588fd1,_0x3dc9fb){return function(_0x2425b5){if(_0x2425b5){var _0x399049=typeof _0x3dc9fb[_0x5971('0x13')]===_0x5971('0x14')&&typeof _0x3dc9fb[_0x5971('0x15')]==='undefined';var _0x470c70=_0x2425b5[_0x5971('0x16')];var _0x2cb405=_0x399049?0x0:_0x3dc9fb[_0x5971('0x13')];var _0x32c6e6=_0x399049?_0x2425b5['count']:_0x3dc9fb[_0x5971('0x13')]+_0x3dc9fb[_0x5971('0x15')];var _0x5d1ff3;if(_0x32c6e6>=_0x470c70){_0x32c6e6=_0x470c70;_0x5d1ff3=0xc8;}else{_0x5d1ff3=0xce;}_0x588fd1[_0x5971('0x10')](_0x5d1ff3);return _0x588fd1['set'](_0x5971('0x17'),_0x2cb405+'-'+_0x32c6e6+'/'+_0x470c70)[_0x5971('0x12')](_0x2425b5);}return null;};}function saveUpdates(_0x15d79d){return function(_0x393851){if(_0x393851){return _0x393851[_0x5971('0x18')](_0x15d79d)[_0x5971('0x19')](function(_0x3bde81){return _0x3bde81;});}return null;};}function removeEntity(_0x50eac5){return function(_0x3267be){if(_0x3267be){return _0x3267be[_0x5971('0x1a')]()[_0x5971('0x19')](function(){_0x50eac5[_0x5971('0x10')](0xcc)[_0x5971('0x11')]();});}};}function handleEntityNotFound(_0x464e1c){return function(_0x169894){if(!_0x169894){_0x464e1c[_0x5971('0xf')](0x194);}return _0x169894;};}function handleError(_0x4f50cd,_0x132211){_0x132211=_0x132211||0x1f4;return function(_0x3de160){logger[_0x5971('0x1b')](_0x3de160[_0x5971('0x1c')]);if(_0x3de160[_0x5971('0x1d')]){delete _0x3de160[_0x5971('0x1d')];}_0x4f50cd[_0x5971('0x10')](_0x132211)[_0x5971('0x1e')](_0x3de160);};}exports[_0x5971('0x1f')]=function(_0x188177,_0x4287da){var _0x8b8127={};var _0x1c0b53=_[_0x5971('0x20')](db[_0x5971('0x21')]['rawAttributes'],function(_0xf56a42){return{'name':_0xf56a42[_0x5971('0x22')],'type':_0xf56a42['type']['key']};});_0x8b8127=qs[_0x5971('0x23')](_0x1c0b53,_0x188177);return interaction[_0x5971('0x24')]('fax',_0x188177[_0x5971('0x25')],_0x188177[_0x5971('0x26')],_0x8b8127,_0x1c0b53)[_0x5971('0x19')](respondWithFilteredResult(_0x4287da,_0x8b8127))[_0x5971('0x27')](handleError(_0x4287da,null));};exports[_0x5971('0x28')]=function(_0x25fc99,_0x2807e3){var _0x4f6bfe={'raw':![],'where':{'id':_0x25fc99[_0x5971('0x29')]['id']}},_0x196ad3={};_0x196ad3['model']=_[_0x5971('0x2a')](db['FaxInteraction'][_0x5971('0x2b')]);_0x196ad3[_0x5971('0x25')]=_[_0x5971('0x2a')](_0x25fc99[_0x5971('0x25')]);_0x196ad3[_0x5971('0x2c')]=_['intersection'](_0x196ad3[_0x5971('0x2d')],_0x196ad3[_0x5971('0x25')]);_0x4f6bfe[_0x5971('0x2e')]=_[_0x5971('0x2f')](_0x196ad3[_0x5971('0x2d')],qs['fields'](_0x25fc99[_0x5971('0x25')][_0x5971('0x30')]));_0x4f6bfe[_0x5971('0x2e')]=_0x4f6bfe['attributes'][_0x5971('0x31')]?_0x4f6bfe[_0x5971('0x2e')]:_0x196ad3[_0x5971('0x2d')];if(_0x25fc99[_0x5971('0x25')][_0x5971('0x32')]){_0x4f6bfe[_0x5971('0x33')]=[{'all':!![]}];}_0x4f6bfe=_[_0x5971('0x34')]({},_0x4f6bfe,_0x25fc99['options']);return db['FaxInteraction'][_0x5971('0x35')](_0x4f6bfe)[_0x5971('0x19')](handleEntityNotFound(_0x2807e3,null))[_0x5971('0x19')](respondWithResult(_0x2807e3,null))[_0x5971('0x27')](handleError(_0x2807e3,null));};exports['create']=function(_0x432767,_0x129df2){return db['FaxInteraction'][_0x5971('0x36')](_0x432767['body'],{})['then'](respondWithResult(_0x129df2,0xc9))['catch'](handleError(_0x129df2,null));};exports[_0x5971('0x18')]=function(_0x20f581,_0x384e5d){if(_0x20f581[_0x5971('0x37')]['id']){delete _0x20f581[_0x5971('0x37')]['id'];}return db[_0x5971('0x21')][_0x5971('0x35')]({'where':{'id':_0x20f581[_0x5971('0x29')]['id']}})[_0x5971('0x19')](handleEntityNotFound(_0x384e5d,null))['then'](saveUpdates(_0x20f581[_0x5971('0x37')],null))[_0x5971('0x19')](respondWithResult(_0x384e5d,null))[_0x5971('0x27')](handleError(_0x384e5d,null));};exports[_0x5971('0x1a')]=function(_0x29aaab,_0x1c11ff){return db[_0x5971('0x21')][_0x5971('0x35')]({'where':{'id':_0x29aaab[_0x5971('0x29')]['id']}})['then'](handleEntityNotFound(_0x1c11ff,null))['then'](removeEntity(_0x1c11ff,null))[_0x5971('0x27')](handleError(_0x1c11ff,null));};exports[_0x5971('0x38')]=function(_0x422e82,_0x228829){return db[_0x5971('0x21')][_0x5971('0x38')]()['then'](respondWithResult(_0x228829,null))[_0x5971('0x27')](handleError(_0x228829,null));};exports[_0x5971('0x39')]=function(_0x5652ed,_0xe8cdde){return db['FaxMessage'][_0x5971('0x35')]({'where':{'id':_0x5652ed[_0x5971('0x29')]['id']}})[_0x5971('0x19')](handleEntityNotFound(_0xe8cdde,null))['then'](function(_0x632c34){if(_0x632c34){return _0x632c34[_0x5971('0x39')](_0x5652ed['body'][_0x5971('0x3a')],_[_0x5971('0x3b')](_0x5652ed[_0x5971('0x37')],[_0x5971('0x3a'),'id'])||{});}})[_0x5971('0x19')](respondWithResult(_0xe8cdde,null))['catch'](handleError(_0xe8cdde,null));};exports[_0x5971('0x3c')]=function(_0xc52de9,_0x3ebc16){var _0x561eb4={'raw':![],'where':{}};var _0x312161={};var _0x2befa0={'count':0x0,'rows':[]};return db[_0x5971('0x21')][_0x5971('0x3d')]({'where':{'id':_0xc52de9['params']['id']}})[_0x5971('0x19')](handleEntityNotFound(_0x3ebc16,null))[_0x5971('0x19')](function(_0x2fb37d){if(_0x2fb37d){_0x312161['model']=_[_0x5971('0x2a')](db[_0x5971('0x3e')][_0x5971('0x2b')]);_0x312161['query']=_['keys'](_0xc52de9[_0x5971('0x25')]);_0x312161[_0x5971('0x2c')]=_[_0x5971('0x2f')](_0x312161[_0x5971('0x2d')],_0x312161[_0x5971('0x25')]);_0x561eb4[_0x5971('0x2e')]=_['intersection'](_0x312161[_0x5971('0x2d')],qs[_0x5971('0x30')](_0xc52de9[_0x5971('0x25')][_0x5971('0x30')]));_0x561eb4['attributes']=_0x561eb4[_0x5971('0x2e')]['length']?_0x561eb4[_0x5971('0x2e')]:_0x312161[_0x5971('0x2d')];if(!_0xc52de9[_0x5971('0x25')][_0x5971('0x3f')](_0x5971('0x40'))){_0x561eb4['limit']=qs[_0x5971('0x15')](_0xc52de9['query'][_0x5971('0x15')]);_0x561eb4[_0x5971('0x13')]=qs[_0x5971('0x13')](_0xc52de9['query'][_0x5971('0x13')]);}_0x561eb4[_0x5971('0x41')]=qs[_0x5971('0x42')](_0xc52de9[_0x5971('0x25')][_0x5971('0x42')]);_0x561eb4[_0x5971('0x43')]=qs[_0x5971('0x2c')](_[_0x5971('0x44')](_0xc52de9[_0x5971('0x25')],_0x312161[_0x5971('0x2c')]));_0x561eb4['where'][_0x5971('0x45')]=_0x2fb37d['id'];if(_0xc52de9[_0x5971('0x25')][_0x5971('0x46')]){_0x561eb4[_0x5971('0x43')]=_[_0x5971('0x34')](_0x561eb4[_0x5971('0x43')],{'$or':_[_0x5971('0x20')](_0x561eb4[_0x5971('0x2e')],function(_0x38aded){var _0x58e937={};_0x58e937[_0x38aded]={'$like':'%'+_0xc52de9[_0x5971('0x25')][_0x5971('0x46')]+'%'};return _0x58e937;})});}if(_0xc52de9[_0x5971('0x25')][_0x5971('0x47')]){var _0x56067d=_0xc52de9[_0x5971('0x25')][_0x5971('0x47')]['split'](',');var _0x5ccb44={};_0x5ccb44[_0x56067d[0x0]]={'$gte':moment(_0x56067d[0x1])['format'](_0x5971('0x48'))};_0x561eb4[_0x5971('0x43')]=_[_0x5971('0x34')](_0x561eb4[_0x5971('0x43')],_0x5ccb44);}_0x561eb4=_['merge']({},_0x561eb4,_0xc52de9[_0x5971('0x49')]);return db[_0x5971('0x3e')]['count']({'where':_0x561eb4[_0x5971('0x43')]})[_0x5971('0x19')](function(_0x1b1669){_0x2befa0[_0x5971('0x16')]=_0x1b1669;if(_0xc52de9['query'][_0x5971('0x32')]){_0x561eb4[_0x5971('0x33')]=[{'all':!![]}];}return db['FaxMessage'][_0x5971('0x24')](_0x561eb4);})['then'](function(_0x4aa95f){_0x2befa0[_0x5971('0x4a')]=_0x4aa95f;return _0x2befa0;});}})[_0x5971('0x19')](respondWithFilteredResult(_0x3ebc16,_0x561eb4))[_0x5971('0x27')](handleError(_0x3ebc16,null));};exports['addTags']=function(_0x4a1de6,_0x38cdc0){return db[_0x5971('0x21')][_0x5971('0x35')]({'where':{'id':_0x4a1de6[_0x5971('0x29')]['id']}})[_0x5971('0x19')](handleEntityNotFound(_0x38cdc0,null))[_0x5971('0x19')](function(_0x235649){if(_0x235649){return _0x235649[_0x5971('0x4b')](_0x4a1de6['body'][_0x5971('0x3a')],_[_0x5971('0x3b')](_0x4a1de6['body'],[_0x5971('0x3a'),'id'])||{})[_0x5971('0x4c')](function(){return db[_0x5971('0x4d')][_0x5971('0x24')]({'attributes':['id','name',_0x5971('0x4e')],'where':{'id':_0x4a1de6[_0x5971('0x37')][_0x5971('0x3a')]}});})['then'](function(_0x18beaa){socket[_0x5971('0x4f')]('faxInteractionTags:save',{'id':Number(_0x4a1de6['params']['id']),'tags':_0x18beaa||[]});return{'id':Number(_0x4a1de6[_0x5971('0x29')]['id']),'tags':_0x18beaa||[]};});}})[_0x5971('0x19')](respondWithResult(_0x38cdc0,null))['catch'](handleError(_0x38cdc0,null));};exports[_0x5971('0x50')]=function(_0x4f4449,_0x368b43){return db[_0x5971('0x21')][_0x5971('0x35')]({'where':{'id':_0x4f4449[_0x5971('0x29')]['id']}})[_0x5971('0x19')](handleEntityNotFound(_0x368b43,null))['then'](function(_0x28aa09){if(_0x28aa09){return _0x28aa09[_0x5971('0x50')](_0x4f4449[_0x5971('0x25')][_0x5971('0x3a')]);}})['then'](respondWithStatusCode(_0x368b43,null))[_0x5971('0x27')](handleError(_0x368b43,null));};exports[_0x5971('0x51')]=function(_0x17ee15,_0xb7b014){var _0x8eede7=moment()['unix']()[_0x5971('0x52')]();var _0x1a8a9e=path[_0x5971('0x53')](config['root'],'server',_0x5971('0x54'),_0x5971('0x55'));var _0x56ec23=path[_0x5971('0x53')](config[_0x5971('0x56')],'server',_0x5971('0x54'),_0x5971('0x57'));var _0x1a206e=path[_0x5971('0x53')](_0x1a8a9e,_0x8eede7);var _0x2f7173=util['format'](_0x5971('0x58'),_0x17ee15[_0x5971('0x29')]['id'],_0x8eede7);var _0x35bbb5=path[_0x5971('0x53')](_0x1a8a9e,_0x2f7173);var _0x1d45a9=[];_0x1d45a9[_0x5971('0x59')]({'model':db[_0x5971('0x5a')],'as':_0x5971('0x5a'),'raw':!![]});var _0x55b9ef=[{'model':db[_0x5971('0x3e')],'as':_0x5971('0x5b'),'attributes':['id','body','createdAt'],'include':_0x1d45a9}];return db[_0x5971('0x21')][_0x5971('0x35')]({'where':{'id':_0x17ee15[_0x5971('0x29')]['id']},'include':_0x55b9ef})['then'](handleEntityNotFound(_0xb7b014,null))[_0x5971('0x19')](function(_0xf5087d){if(_0xf5087d&&_0xf5087d['Messages']){var _0x5d8b2a=_0xf5087d[_0x5971('0x5c')]({'plain':!![]});fs[_0x5971('0x5d')](_0x1a206e);for(var _0x4f810e=0x0;_0x4f810e<_0x5d8b2a['Messages'][_0x5971('0x31')];_0x4f810e++){var _0xe89f6c=_0x5d8b2a[_0x5971('0x5b')][_0x4f810e][_0x5971('0x5a')];if(_0xe89f6c){var _0x50455b=path['join'](_0x56ec23,_0xe89f6c[_0x5971('0x5e')]);if(fs['existsSync'](_0x50455b)){fs['createReadStream'](_0x50455b)[_0x5971('0x5f')](fs['createWriteStream'](path[_0x5971('0x53')](_0x1a206e,_0xe89f6c['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x464ea7,_0x4b27a3){zipdir(_0x1a206e,{'saveTo':_0x35bbb5},function(_0x85104,_0xe43476){if(_0x85104)return _0x4b27a3(_0x85104);return _0x464ea7(_0xe43476);});})[_0x5971('0x19')](function(){return new BPromise(function(_0x1fde8a,_0x3feb37){rimraf(_0x1a206e,function(_0x25f358){if(_0x25f358)_0x3feb37(_0x25f358);return _0x1fde8a();});});})['then'](function(){return _0xb7b014[_0x5971('0x51')](_0x35bbb5,_0x2f7173,function(_0x36f85b){if(_0x36f85b){console['log'](_0x5971('0x60'),_0x36f85b);}else{fs[_0x5971('0x61')](_0x35bbb5);}});});});}else{return _0xb7b014[_0x5971('0xf')](0xc8);}})[_0x5971('0x27')](handleError(_0xb7b014,null));}; \ No newline at end of file +var _0x11a5=['query','catch','show','params','model','keys','filters','fields','length','attributes','includeAll','include','merge','find','create','body','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','fax'];(function(_0x1de9e2,_0x5a7b24){var _0x3f9129=function(_0x318cf0){while(--_0x318cf0){_0x1de9e2['push'](_0x1de9e2['shift']());}};_0x3f9129(++_0x5a7b24);}(_0x11a5,0x175));var _0x511a=function(_0x40e114,_0x278b52){_0x40e114=_0x40e114-0x0;var _0x2e9542=_0x11a5[_0x40e114];return _0x2e9542;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x511a('0x0'));var moment=require(_0x511a('0x1'));var BPromise=require('bluebird');var util=require(_0x511a('0x2'));var path=require(_0x511a('0x3'));var fs=require('fs');var _=require(_0x511a('0x4'));var Redis=require(_0x511a('0x5'));var interaction=require(_0x511a('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x511a('0x7'))(_0x511a('0x8'));var config=require(_0x511a('0x9'));var db=require(_0x511a('0xa'))['db'];config[_0x511a('0xb')]=_['defaults'](config[_0x511a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x511a('0xb')]));require(_0x511a('0xc'))[_0x511a('0xd')](socket);function respondWithStatusCode(_0x1d8a1d,_0x4cdb3a){_0x4cdb3a=_0x4cdb3a||0xcc;return function(_0x9fa48c){if(_0x9fa48c){return _0x1d8a1d[_0x511a('0xe')](_0x4cdb3a);}return _0x1d8a1d[_0x511a('0xf')](_0x4cdb3a)[_0x511a('0x10')]();};}function respondWithResult(_0x5c3c1f,_0x5c7ddc){_0x5c7ddc=_0x5c7ddc||0xc8;return function(_0x5ec1ac){if(_0x5ec1ac){return _0x5c3c1f[_0x511a('0xf')](_0x5c7ddc)[_0x511a('0x11')](_0x5ec1ac);}};}function respondWithFilteredResult(_0xfb220f,_0x18a69c){return function(_0x408753){if(_0x408753){var _0xb02b8a=typeof _0x18a69c[_0x511a('0x12')]==='undefined'&&typeof _0x18a69c['limit']===_0x511a('0x13');var _0x1f4b09=_0x408753[_0x511a('0x14')];var _0x5e2d81=_0xb02b8a?0x0:_0x18a69c['offset'];var _0x1e7418=_0xb02b8a?_0x408753[_0x511a('0x14')]:_0x18a69c['offset']+_0x18a69c[_0x511a('0x15')];var _0x42be38;if(_0x1e7418>=_0x1f4b09){_0x1e7418=_0x1f4b09;_0x42be38=0xc8;}else{_0x42be38=0xce;}_0xfb220f[_0x511a('0xf')](_0x42be38);return _0xfb220f[_0x511a('0x16')](_0x511a('0x17'),_0x5e2d81+'-'+_0x1e7418+'/'+_0x1f4b09)[_0x511a('0x11')](_0x408753);}return null;};}function saveUpdates(_0x140955){return function(_0x5cd20a){if(_0x5cd20a){return _0x5cd20a[_0x511a('0x18')](_0x140955)[_0x511a('0x19')](function(_0x51d161){return _0x51d161;});}return null;};}function removeEntity(_0xdde867){return function(_0x231495){if(_0x231495){return _0x231495[_0x511a('0x1a')]()[_0x511a('0x19')](function(){_0xdde867['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26fc92){return function(_0x2c0832){if(!_0x2c0832){_0x26fc92[_0x511a('0xe')](0x194);}return _0x2c0832;};}function handleError(_0x10547f,_0x22e892){_0x22e892=_0x22e892||0x1f4;return function(_0x343d57){logger[_0x511a('0x1b')](_0x343d57[_0x511a('0x1c')]);if(_0x343d57['name']){delete _0x343d57[_0x511a('0x1d')];}_0x10547f['status'](_0x22e892)[_0x511a('0x1e')](_0x343d57);};}exports[_0x511a('0x1f')]=function(_0x872108,_0x245ad4){var _0x3516ea={};var _0x19ee34=_[_0x511a('0x20')](db[_0x511a('0x21')][_0x511a('0x22')],function(_0x354d48){return{'name':_0x354d48[_0x511a('0x23')],'type':_0x354d48['type'][_0x511a('0x24')]};});_0x3516ea=qs[_0x511a('0x25')](_0x19ee34,_0x872108);return interaction['findAll'](_0x511a('0x26'),_0x872108[_0x511a('0x27')],_0x872108['user'],_0x3516ea,_0x19ee34)[_0x511a('0x19')](respondWithFilteredResult(_0x245ad4,_0x3516ea))[_0x511a('0x28')](handleError(_0x245ad4,null));};exports[_0x511a('0x29')]=function(_0x3ebc29,_0x430331){var _0x4b7481={'raw':![],'where':{'id':_0x3ebc29[_0x511a('0x2a')]['id']}},_0x581b07={};_0x581b07[_0x511a('0x2b')]=_['keys'](db[_0x511a('0x21')]['rawAttributes']);_0x581b07[_0x511a('0x27')]=_[_0x511a('0x2c')](_0x3ebc29[_0x511a('0x27')]);_0x581b07[_0x511a('0x2d')]=_['intersection'](_0x581b07['model'],_0x581b07[_0x511a('0x27')]);_0x4b7481['attributes']=_['intersection'](_0x581b07[_0x511a('0x2b')],qs[_0x511a('0x2e')](_0x3ebc29[_0x511a('0x27')][_0x511a('0x2e')]));_0x4b7481['attributes']=_0x4b7481['attributes'][_0x511a('0x2f')]?_0x4b7481[_0x511a('0x30')]:_0x581b07[_0x511a('0x2b')];if(_0x3ebc29[_0x511a('0x27')][_0x511a('0x31')]){_0x4b7481[_0x511a('0x32')]=[{'all':!![]}];}_0x4b7481=_[_0x511a('0x33')]({},_0x4b7481,_0x3ebc29['options']);return db[_0x511a('0x21')][_0x511a('0x34')](_0x4b7481)['then'](handleEntityNotFound(_0x430331,null))[_0x511a('0x19')](respondWithResult(_0x430331,null))[_0x511a('0x28')](handleError(_0x430331,null));};exports[_0x511a('0x35')]=function(_0x4953cc,_0x1e80d7){return db[_0x511a('0x21')]['create'](_0x4953cc[_0x511a('0x36')],{})[_0x511a('0x19')](respondWithResult(_0x1e80d7,0xc9))[_0x511a('0x28')](handleError(_0x1e80d7,null));};exports['update']=function(_0x2db399,_0x18becd){if(_0x2db399['body']['id']){delete _0x2db399[_0x511a('0x36')]['id'];}return db[_0x511a('0x21')][_0x511a('0x34')]({'where':{'id':_0x2db399['params']['id']}})[_0x511a('0x19')](handleEntityNotFound(_0x18becd,null))[_0x511a('0x19')](saveUpdates(_0x2db399[_0x511a('0x36')],null))[_0x511a('0x19')](respondWithResult(_0x18becd,null))['catch'](handleError(_0x18becd,null));};exports['destroy']=function(_0x531d27,_0x469d89){return db['FaxInteraction'][_0x511a('0x34')]({'where':{'id':_0x531d27['params']['id']}})['then'](handleEntityNotFound(_0x469d89,null))['then'](removeEntity(_0x469d89,null))[_0x511a('0x28')](handleError(_0x469d89,null));};exports['describe']=function(_0x32138d,_0x5c300c){return db[_0x511a('0x21')][_0x511a('0x37')]()[_0x511a('0x19')](respondWithResult(_0x5c300c,null))[_0x511a('0x28')](handleError(_0x5c300c,null));};exports['addMessage']=function(_0x2f6899,_0x3b3314){return db[_0x511a('0x38')][_0x511a('0x34')]({'where':{'id':_0x2f6899[_0x511a('0x2a')]['id']}})[_0x511a('0x19')](handleEntityNotFound(_0x3b3314,null))[_0x511a('0x19')](function(_0x30df81){if(_0x30df81){return _0x30df81[_0x511a('0x39')](_0x2f6899[_0x511a('0x36')][_0x511a('0x3a')],_[_0x511a('0x3b')](_0x2f6899['body'],[_0x511a('0x3a'),'id'])||{});}})[_0x511a('0x19')](respondWithResult(_0x3b3314,null))[_0x511a('0x28')](handleError(_0x3b3314,null));};exports[_0x511a('0x3c')]=function(_0xf9406f,_0x379895){var _0x33a694={'raw':![],'where':{}};var _0x5577c8={};var _0x2b659f={'count':0x0,'rows':[]};return db[_0x511a('0x21')][_0x511a('0x3d')]({'where':{'id':_0xf9406f[_0x511a('0x2a')]['id']}})[_0x511a('0x19')](handleEntityNotFound(_0x379895,null))[_0x511a('0x19')](function(_0x1435e4){if(_0x1435e4){_0x5577c8[_0x511a('0x2b')]=_[_0x511a('0x2c')](db[_0x511a('0x38')][_0x511a('0x22')]);_0x5577c8[_0x511a('0x27')]=_[_0x511a('0x2c')](_0xf9406f[_0x511a('0x27')]);_0x5577c8['filters']=_[_0x511a('0x3e')](_0x5577c8[_0x511a('0x2b')],_0x5577c8[_0x511a('0x27')]);_0x33a694[_0x511a('0x30')]=_[_0x511a('0x3e')](_0x5577c8[_0x511a('0x2b')],qs[_0x511a('0x2e')](_0xf9406f[_0x511a('0x27')][_0x511a('0x2e')]));_0x33a694[_0x511a('0x30')]=_0x33a694[_0x511a('0x30')][_0x511a('0x2f')]?_0x33a694[_0x511a('0x30')]:_0x5577c8[_0x511a('0x2b')];if(!_0xf9406f['query'][_0x511a('0x3f')](_0x511a('0x40'))){_0x33a694[_0x511a('0x15')]=qs[_0x511a('0x15')](_0xf9406f[_0x511a('0x27')][_0x511a('0x15')]);_0x33a694[_0x511a('0x12')]=qs[_0x511a('0x12')](_0xf9406f[_0x511a('0x27')][_0x511a('0x12')]);}_0x33a694[_0x511a('0x41')]=qs[_0x511a('0x42')](_0xf9406f[_0x511a('0x27')][_0x511a('0x42')]);_0x33a694[_0x511a('0x43')]=qs[_0x511a('0x2d')](_[_0x511a('0x44')](_0xf9406f[_0x511a('0x27')],_0x5577c8[_0x511a('0x2d')]));_0x33a694[_0x511a('0x43')][_0x511a('0x45')]=_0x1435e4['id'];if(_0xf9406f[_0x511a('0x27')][_0x511a('0x46')]){_0x33a694[_0x511a('0x43')]=_[_0x511a('0x33')](_0x33a694[_0x511a('0x43')],{'$or':_[_0x511a('0x20')](_0x33a694[_0x511a('0x30')],function(_0x54eafa){var _0x354607={};_0x354607[_0x54eafa]={'$like':'%'+_0xf9406f[_0x511a('0x27')][_0x511a('0x46')]+'%'};return _0x354607;})});}if(_0xf9406f[_0x511a('0x27')]['$gte']){var _0x261aab=_0xf9406f[_0x511a('0x27')]['$gte']['split'](',');var _0xf57abd={};_0xf57abd[_0x261aab[0x0]]={'$gte':moment(_0x261aab[0x1])[_0x511a('0x47')](_0x511a('0x48'))};_0x33a694['where']=_['merge'](_0x33a694['where'],_0xf57abd);}_0x33a694=_[_0x511a('0x33')]({},_0x33a694,_0xf9406f[_0x511a('0x49')]);return db[_0x511a('0x38')][_0x511a('0x14')]({'where':_0x33a694[_0x511a('0x43')]})[_0x511a('0x19')](function(_0x1d1c97){_0x2b659f[_0x511a('0x14')]=_0x1d1c97;if(_0xf9406f[_0x511a('0x27')]['includeAll']){_0x33a694[_0x511a('0x32')]=[{'all':!![]}];}return db[_0x511a('0x38')][_0x511a('0x4a')](_0x33a694);})[_0x511a('0x19')](function(_0x288754){_0x2b659f[_0x511a('0x4b')]=_0x288754;return _0x2b659f;});}})[_0x511a('0x19')](respondWithFilteredResult(_0x379895,_0x33a694))['catch'](handleError(_0x379895,null));};exports[_0x511a('0x4c')]=function(_0x259ff8,_0x342b64){return db[_0x511a('0x21')][_0x511a('0x34')]({'where':{'id':_0x259ff8['params']['id']}})['then'](handleEntityNotFound(_0x342b64,null))[_0x511a('0x19')](function(_0x491378){if(_0x491378){return _0x491378[_0x511a('0x4d')](_0x259ff8[_0x511a('0x36')][_0x511a('0x3a')],_[_0x511a('0x3b')](_0x259ff8[_0x511a('0x36')],[_0x511a('0x3a'),'id'])||{})[_0x511a('0x4e')](function(){return db[_0x511a('0x4f')][_0x511a('0x4a')]({'attributes':['id',_0x511a('0x1d'),_0x511a('0x50')],'where':{'id':_0x259ff8[_0x511a('0x36')][_0x511a('0x3a')]}});})[_0x511a('0x19')](function(_0x2f1f09){socket[_0x511a('0x51')]('faxInteractionTags:save',{'id':Number(_0x259ff8[_0x511a('0x2a')]['id']),'tags':_0x2f1f09||[]});return{'id':Number(_0x259ff8[_0x511a('0x2a')]['id']),'tags':_0x2f1f09||[]};});}})[_0x511a('0x19')](respondWithResult(_0x342b64,null))['catch'](handleError(_0x342b64,null));};exports[_0x511a('0x52')]=function(_0x30e225,_0x134632){return db['FaxInteraction'][_0x511a('0x34')]({'where':{'id':_0x30e225['params']['id']}})[_0x511a('0x19')](handleEntityNotFound(_0x134632,null))[_0x511a('0x19')](function(_0x36bf22){if(_0x36bf22){return _0x36bf22[_0x511a('0x52')](_0x30e225[_0x511a('0x27')][_0x511a('0x3a')]);}})['then'](respondWithStatusCode(_0x134632,null))[_0x511a('0x28')](handleError(_0x134632,null));};exports[_0x511a('0x53')]=function(_0x300d77,_0x2692ac){var _0x5f33f8=moment()[_0x511a('0x54')]()[_0x511a('0x55')]();var _0x6bb290=path[_0x511a('0x56')](config['root'],_0x511a('0x57'),'files',_0x511a('0x58'));var _0x417f6e=path[_0x511a('0x56')](config[_0x511a('0x59')],_0x511a('0x57'),_0x511a('0x5a'),_0x511a('0x5b'));var _0x3e6887=path[_0x511a('0x56')](_0x6bb290,_0x5f33f8);var _0x44186c=util[_0x511a('0x47')](_0x511a('0x5c'),_0x300d77['params']['id'],_0x5f33f8);var _0x314095=path[_0x511a('0x56')](_0x6bb290,_0x44186c);var _0x268de2=[];_0x268de2['push']({'model':db[_0x511a('0x5d')],'as':_0x511a('0x5d'),'raw':!![]});var _0x4fd380=[{'model':db[_0x511a('0x38')],'as':_0x511a('0x5e'),'attributes':['id',_0x511a('0x36'),_0x511a('0x5f')],'include':_0x268de2}];return db[_0x511a('0x21')][_0x511a('0x34')]({'where':{'id':_0x300d77['params']['id']},'include':_0x4fd380})['then'](handleEntityNotFound(_0x2692ac,null))[_0x511a('0x19')](function(_0x1e780d){if(_0x1e780d&&_0x1e780d[_0x511a('0x5e')]){var _0x5f0a08=_0x1e780d[_0x511a('0x60')]({'plain':!![]});fs[_0x511a('0x61')](_0x3e6887);for(var _0x2b0558=0x0;_0x2b0558<_0x5f0a08[_0x511a('0x5e')]['length'];_0x2b0558++){var _0x38c418=_0x5f0a08[_0x511a('0x5e')][_0x2b0558][_0x511a('0x5d')];if(_0x38c418){var _0x15e51e=path[_0x511a('0x56')](_0x417f6e,_0x38c418[_0x511a('0x62')]);if(fs[_0x511a('0x63')](_0x15e51e)){fs[_0x511a('0x64')](_0x15e51e)[_0x511a('0x65')](fs[_0x511a('0x66')](path['join'](_0x3e6887,_0x38c418[_0x511a('0x62')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x2883aa,_0x486d4f){zipdir(_0x3e6887,{'saveTo':_0x314095},function(_0x1c07d5,_0x1cdade){if(_0x1c07d5)return _0x486d4f(_0x1c07d5);return _0x2883aa(_0x1cdade);});})[_0x511a('0x19')](function(){return new BPromise(function(_0x338597,_0x39eb53){rimraf(_0x3e6887,function(_0x20256d){if(_0x20256d)_0x39eb53(_0x20256d);return _0x338597();});});})[_0x511a('0x19')](function(){return _0x2692ac['download'](_0x314095,_0x44186c,function(_0x2f97de){if(_0x2f97de){console['log']('err',_0x2f97de);}else{fs['unlinkSync'](_0x314095);}});});});}else{return _0x2692ac[_0x511a('0xe')](0xc8);}})[_0x511a('0x28')](handleError(_0x2692ac,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a4f882b..2d5949f 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 _0xa5f6=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length'];(function(_0x51c7dc,_0x3d514d){var _0x6cfe67=function(_0x1d029b){while(--_0x1d029b){_0x51c7dc['push'](_0x51c7dc['shift']());}};_0x6cfe67(++_0x3d514d);}(_0xa5f6,0x1a3));var _0x6a5f=function(_0x43702a,_0x2f227e){_0x43702a=_0x43702a-0x0;var _0x1cb663=_0xa5f6[_0x43702a];return _0x1cb663;};'use strict';var EventEmitter=require(_0x6a5f('0x0'));var FaxInteraction=require(_0x6a5f('0x1'))['db'][_0x6a5f('0x2')];var FaxMessage=require(_0x6a5f('0x1'))['db'][_0x6a5f('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a5f('0x4'),'afterUpdate':'update','afterDestroy':_0x6a5f('0x5')};function emitEvent(_0x22c983){return function(_0x469e48,_0x3637cb,_0x58e883){_0x469e48[_0x6a5f('0x6')]({'attributes':['id'],'raw':!![]})[_0x6a5f('0x7')](function(_0x14c369){_0x469e48[_0x6a5f('0x8')](_0x6a5f('0x9'),_0x14c369[_0x6a5f('0xa')](function(_0x435c93){return{'id':_0x435c93['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x469e48['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6a5f('0x7')](function(_0x389837){_0x469e48[_0x6a5f('0x8')](_0x6a5f('0xb'),_0x389837[_0x6a5f('0xc')]);FaxInteractionEvents[_0x6a5f('0xd')](_0x22c983+':'+_0x469e48['id'],_0x469e48);FaxInteractionEvents['emit'](_0x22c983,_0x469e48);_0x58e883(null);})[_0x6a5f('0xe')](_0x58e883(null));};}for(var e in events){if(events[_0x6a5f('0xf')](e)){var event=events[e];FaxInteraction[_0x6a5f('0x10')](e,emitEvent(event));}}module[_0x6a5f('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x6bdb=['hook','exports','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','length','catch','hasOwnProperty'];(function(_0x4a27ea,_0x40ce5d){var _0x3d02fe=function(_0x439378){while(--_0x439378){_0x4a27ea['push'](_0x4a27ea['shift']());}};_0x3d02fe(++_0x40ce5d);}(_0x6bdb,0x1a6));var _0xb6bd=function(_0x37e1e9,_0x17d89f){_0x37e1e9=_0x37e1e9-0x0;var _0x4b35b4=_0x6bdb[_0x37e1e9];return _0x4b35b4;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xb6bd('0x0'))['db'][_0xb6bd('0x1')];var FaxMessage=require(_0xb6bd('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb6bd('0x2')](0x0);var events={'afterCreate':_0xb6bd('0x3'),'afterUpdate':_0xb6bd('0x4'),'afterDestroy':_0xb6bd('0x5')};function emitEvent(_0x1fb39a){return function(_0x587df0,_0x4052bc,_0x57cdea){_0x587df0[_0xb6bd('0x6')]({'attributes':['id'],'raw':!![]})[_0xb6bd('0x7')](function(_0x561271){_0x587df0[_0xb6bd('0x8')](_0xb6bd('0x9'),_0x561271['map'](function(_0x182503){return{'id':_0x182503['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x587df0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb6bd('0x7')](function(_0x4ffc17){_0x587df0[_0xb6bd('0x8')]('unreadMessages',_0x4ffc17[_0xb6bd('0xa')]);FaxInteractionEvents['emit'](_0x1fb39a+':'+_0x587df0['id'],_0x587df0);FaxInteractionEvents['emit'](_0x1fb39a,_0x587df0);_0x57cdea(null);})[_0xb6bd('0xb')](_0x57cdea(null));};}for(var e in events){if(events[_0xb6bd('0xc')](e)){var event=events[e];FaxInteraction[_0xb6bd('0xd')](e,emitEvent(event));}}module[_0xb6bd('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 707c6ae..ead1644 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 _0x647b=['api','moment','request-promise','path','../../config/environment','exports','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x4d1914,_0x133a1c){var _0x526f4b=function(_0x150545){while(--_0x150545){_0x4d1914['push'](_0x4d1914['shift']());}};_0x526f4b(++_0x133a1c);}(_0x647b,0x7c));var _0xb647=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x647b[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xb647('0x0'));var util=require(_0xb647('0x1'));var logger=require('../../config/logger')(_0xb647('0x2'));var moment=require(_0xb647('0x3'));var BPromise=require('bluebird');var rp=require(_0xb647('0x4'));var fs=require('fs');var path=require(_0xb647('0x5'));var rimraf=require('rimraf');var config=require(_0xb647('0x6'));var attributes=require('./faxInteraction.attributes');module[_0xb647('0x7')]=function(_0x41791,_0x3a06d4){return _0x41791['define'](_0xb647('0x8'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ab7c4,_0x3979d1,_0x5e69cf){if(_0x3ab7c4[_0xb647('0x9')](_0xb647('0xa'))){_0x3ab7c4[_0xb647('0xb')]=moment()[_0xb647('0xc')](_0xb647('0xd'));}_0x5e69cf(null,_0x3ab7c4);}}});}; \ No newline at end of file +var _0x2bd4=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions'];(function(_0x1ec3f8,_0x4d7809){var _0xaf463b=function(_0x44041f){while(--_0x44041f){_0x1ec3f8['push'](_0x1ec3f8['shift']());}};_0xaf463b(++_0x4d7809);}(_0x2bd4,0x103));var _0x42bd=function(_0x239ce1,_0x13c0a5){_0x239ce1=_0x239ce1-0x0;var _0x686bec=_0x2bd4[_0x239ce1];return _0x686bec;};'use strict';var _=require(_0x42bd('0x0'));var util=require(_0x42bd('0x1'));var logger=require(_0x42bd('0x2'))(_0x42bd('0x3'));var moment=require(_0x42bd('0x4'));var BPromise=require(_0x42bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42bd('0x6'));var rimraf=require(_0x42bd('0x7'));var config=require(_0x42bd('0x8'));var attributes=require(_0x42bd('0x9'));module[_0x42bd('0xa')]=function(_0x2c25a8,_0x2ab9c9){return _0x2c25a8['define'](_0x42bd('0xb'),attributes,{'tableName':_0x42bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54b5e4,_0x137c34,_0x5cba92){if(_0x54b5e4[_0x42bd('0xd')]('closed')){_0x54b5e4[_0x42bd('0xe')]=moment()[_0x42bd('0xf')](_0x42bd('0x10'));}_0x5cba92(null,_0x54b5e4);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e15784c..e1e0925 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 _0xb615=['rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x3d4a7c,_0x355e24){var _0x26fc4e=function(_0x33a90b){while(--_0x33a90b){_0x3d4a7c['push'](_0x3d4a7c['shift']());}};_0x26fc4e(++_0x355e24);}(_0xb615,0x79));var _0x5b61=function(_0x1a3262,_0x3435c2){_0x1a3262=_0x1a3262-0x0;var _0x4abacf=_0xb615[_0x1a3262];return _0x4abacf;};'use strict';var _=require(_0x5b61('0x0'));var util=require(_0x5b61('0x1'));var moment=require('moment');var BPromise=require(_0x5b61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b61('0x3'))['db'];var utils=require(_0x5b61('0x4'));var logger=require('../../config/logger')(_0x5b61('0x5'));var config=require('../../config/environment');var jayson=require(_0x5b61('0x6'));var client=jayson['client'][_0x5b61('0x7')]({'port':0x232a});config['redis']=_[_0x5b61('0x8')](config[_0x5b61('0x9')],{'host':_0x5b61('0xa'),'port':0x18eb});var socket=require(_0x5b61('0xb'))(new Redis(config[_0x5b61('0x9')]));require(_0x5b61('0xc'))[_0x5b61('0xd')](socket);function respondWithRpcPromise(_0x24979a,_0x27c573,_0x2306eb){return new BPromise(function(_0x5af490,_0x1592d3){return client[_0x5b61('0xe')](_0x24979a,_0x2306eb)[_0x5b61('0xf')](function(_0x305ea7){logger[_0x5b61('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x27c573,_0x5b61('0x11'));logger[_0x5b61('0x12')](_0x5b61('0x13'),_0x27c573,_0x5b61('0x11'),JSON[_0x5b61('0x14')](_0x305ea7));if(_0x305ea7[_0x5b61('0x15')]){if(_0x305ea7[_0x5b61('0x15')][_0x5b61('0x16')]===0x1f4){logger[_0x5b61('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x27c573,_0x305ea7[_0x5b61('0x15')]['message']);return _0x1592d3(_0x305ea7[_0x5b61('0x15')][_0x5b61('0x17')]);}logger['error'](_0x5b61('0x18'),_0x27c573,_0x305ea7['error'][_0x5b61('0x17')]);return _0x5af490(_0x305ea7['error'][_0x5b61('0x17')]);}else{logger[_0x5b61('0x10')](_0x5b61('0x18'),_0x27c573,_0x5b61('0x11'));_0x5af490(_0x305ea7[_0x5b61('0x19')][_0x5b61('0x17')]);}})[_0x5b61('0x1a')](function(_0x514811){logger[_0x5b61('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x27c573,_0x514811);_0x1592d3(_0x514811);});});}exports[_0x5b61('0x1b')]=function(_0x22d9e5){var _0x194c8a=this;return new Promise(function(_0x3ff3b9,_0x19d956){return db[_0x5b61('0x1c')][_0x5b61('0x1d')](_0x22d9e5[_0x5b61('0x1e')],{'raw':_0x22d9e5[_0x5b61('0x1f')]?_0x22d9e5[_0x5b61('0x1f')][_0x5b61('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22d9e5[_0x5b61('0x1f')]?_0x22d9e5['options'][_0x5b61('0x21')]||null:null,'attributes':_0x22d9e5[_0x5b61('0x1f')]?_0x22d9e5[_0x5b61('0x1f')]['attributes']||null:null,'limit':_0x22d9e5['options']?_0x22d9e5[_0x5b61('0x1f')][_0x5b61('0x22')]||null:null})['then'](function(_0x262611){logger[_0x5b61('0x10')](_0x5b61('0x1b'),_0x22d9e5);logger[_0x5b61('0x12')]('UpdateFaxInteraction',_0x22d9e5,JSON[_0x5b61('0x14')](_0x262611));_0x3ff3b9(_0x262611);})[_0x5b61('0x1a')](function(_0x596618){logger[_0x5b61('0x15')](_0x5b61('0x1b'),_0x596618[_0x5b61('0x17')],_0x22d9e5);_0x19d956(_0x194c8a['error'](0x1f4,_0x596618[_0x5b61('0x17')]));});});};exports[_0x5b61('0x23')]=function(_0x11f82e){return new Promise(function(_0x3916a9,_0x41652d){return db['FaxInteraction'][_0x5b61('0x24')]({'where':_0x11f82e['options']?_0x11f82e[_0x5b61('0x1f')][_0x5b61('0x21')]||null:null})[_0x5b61('0xf')](function(_0x4efb93){if(_0x4efb93){return _0x4efb93[_0x5b61('0x25')](_0x11f82e[_0x5b61('0x1e')][_0x5b61('0x26')],_[_0x5b61('0x27')](_0x11f82e['body'],[_0x5b61('0x26'),'id'])||{});}})[_0x5b61('0x28')](function(_0x25a685){logger[_0x5b61('0x10')]('AddTags',_0x11f82e);logger['debug'](_0x5b61('0x29'),_0x11f82e,JSON[_0x5b61('0x14')](_0x25a685));_0x3916a9(_0x25a685);})['catch'](function(_0x2ce6ef){logger[_0x5b61('0x15')]('AddTags',_0x2ce6ef[_0x5b61('0x17')],_0x11f82e);_0x41652d(_this[_0x5b61('0x15')](0x1f4,_0x2ce6ef[_0x5b61('0x17')]));});});}; \ No newline at end of file +var _0xab19=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','limit','catch','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x445074,_0xf835ae){var _0x3d8455=function(_0x3ca2ec){while(--_0x3ca2ec){_0x445074['push'](_0x445074['shift']());}};_0x3d8455(++_0xf835ae);}(_0xab19,0x17c));var _0x9ab1=function(_0x91af96,_0x110185){_0x91af96=_0x91af96-0x0;var _0x4c8900=_0xab19[_0x91af96];return _0x4c8900;};'use strict';var _=require('lodash');var util=require(_0x9ab1('0x0'));var moment=require(_0x9ab1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9ab1('0x2'));var fs=require('fs');var Redis=require(_0x9ab1('0x3'));var db=require(_0x9ab1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ab1('0x5'));var config=require(_0x9ab1('0x6'));var jayson=require(_0x9ab1('0x7'));var client=jayson[_0x9ab1('0x8')][_0x9ab1('0x9')]({'port':0x232a});config[_0x9ab1('0xa')]=_[_0x9ab1('0xb')](config[_0x9ab1('0xa')],{'host':_0x9ab1('0xc'),'port':0x18eb});var socket=require(_0x9ab1('0xd'))(new Redis(config[_0x9ab1('0xa')]));require(_0x9ab1('0xe'))[_0x9ab1('0xf')](socket);function respondWithRpcPromise(_0x59c257,_0x46dc89,_0x28e2c8){return new BPromise(function(_0x182a1f,_0x13666c){return client[_0x9ab1('0x10')](_0x59c257,_0x28e2c8)[_0x9ab1('0x11')](function(_0x1c05b4){logger[_0x9ab1('0x12')](_0x9ab1('0x13'),_0x46dc89,_0x9ab1('0x14'));logger[_0x9ab1('0x15')](_0x9ab1('0x16'),_0x46dc89,_0x9ab1('0x14'),JSON[_0x9ab1('0x17')](_0x1c05b4));if(_0x1c05b4[_0x9ab1('0x18')]){if(_0x1c05b4[_0x9ab1('0x18')][_0x9ab1('0x19')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x46dc89,_0x1c05b4['error'][_0x9ab1('0x1a')]);return _0x13666c(_0x1c05b4[_0x9ab1('0x18')]['message']);}logger[_0x9ab1('0x18')](_0x9ab1('0x13'),_0x46dc89,_0x1c05b4[_0x9ab1('0x18')]['message']);return _0x182a1f(_0x1c05b4[_0x9ab1('0x18')][_0x9ab1('0x1a')]);}else{logger['info'](_0x9ab1('0x13'),_0x46dc89,'request\x20sent');_0x182a1f(_0x1c05b4[_0x9ab1('0x1b')][_0x9ab1('0x1a')]);}})['catch'](function(_0x2be156){logger[_0x9ab1('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x46dc89,_0x2be156);_0x13666c(_0x2be156);});});}exports[_0x9ab1('0x1c')]=function(_0x464745){var _0x3fc490=this;return new Promise(function(_0x1f26db,_0x15384e){return db[_0x9ab1('0x1d')]['update'](_0x464745[_0x9ab1('0x1e')],{'raw':_0x464745[_0x9ab1('0x1f')]?_0x464745['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x464745[_0x9ab1('0x1f')]?_0x464745[_0x9ab1('0x1f')][_0x9ab1('0x20')]||null:null,'attributes':_0x464745['options']?_0x464745[_0x9ab1('0x1f')][_0x9ab1('0x21')]||null:null,'limit':_0x464745[_0x9ab1('0x1f')]?_0x464745[_0x9ab1('0x1f')][_0x9ab1('0x22')]||null:null})[_0x9ab1('0x11')](function(_0x2e8e9f){logger['info'](_0x9ab1('0x1c'),_0x464745);logger[_0x9ab1('0x15')](_0x9ab1('0x1c'),_0x464745,JSON[_0x9ab1('0x17')](_0x2e8e9f));_0x1f26db(_0x2e8e9f);})[_0x9ab1('0x23')](function(_0x900a05){logger['error'](_0x9ab1('0x1c'),_0x900a05[_0x9ab1('0x1a')],_0x464745);_0x15384e(_0x3fc490[_0x9ab1('0x18')](0x1f4,_0x900a05[_0x9ab1('0x1a')]));});});};exports[_0x9ab1('0x24')]=function(_0x50b24a){return new Promise(function(_0x1d36d2,_0x27331e){return db[_0x9ab1('0x1d')][_0x9ab1('0x25')]({'where':_0x50b24a[_0x9ab1('0x1f')]?_0x50b24a[_0x9ab1('0x1f')][_0x9ab1('0x20')]||null:null})['then'](function(_0x5dd92b){if(_0x5dd92b){return _0x5dd92b[_0x9ab1('0x26')](_0x50b24a['body'][_0x9ab1('0x27')],_[_0x9ab1('0x28')](_0x50b24a[_0x9ab1('0x1e')],['ids','id'])||{});}})[_0x9ab1('0x29')](function(_0xd1f8c){logger[_0x9ab1('0x12')](_0x9ab1('0x2a'),_0x50b24a);logger[_0x9ab1('0x15')](_0x9ab1('0x2a'),_0x50b24a,JSON[_0x9ab1('0x17')](_0xd1f8c));_0x1d36d2(_0xd1f8c);})[_0x9ab1('0x23')](function(_0x2576b1){logger[_0x9ab1('0x18')](_0x9ab1('0x2a'),_0x2576b1[_0x9ab1('0x1a')],_0x50b24a);_0x27331e(_this['error'](0x1f4,_0x2576b1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1b41b79..ebd3647 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 _0xb7cb=['remove','update','removeListener','register','faxInteraction:'];(function(_0x2e2c0f,_0x34f52b){var _0x589d3f=function(_0x14680f){while(--_0x14680f){_0x2e2c0f['push'](_0x2e2c0f['shift']());}};_0x589d3f(++_0x34f52b);}(_0xb7cb,0x1d6));var _0xbb7c=function(_0x3ef90f,_0x46f414){_0x3ef90f=_0x3ef90f-0x0;var _0x278fab=_0xb7cb[_0x3ef90f];return _0x278fab;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xbb7c('0x0'),_0xbb7c('0x1')];function createListener(_0x2aa245,_0x312a75){return function(_0x5a4e18){_0x312a75['emit'](_0x2aa245,_0x5a4e18);};}function removeListener(_0x254c0f,_0x30cff8){return function(){FaxInteractionEvents[_0xbb7c('0x2')](_0x254c0f,_0x30cff8);};}exports[_0xbb7c('0x3')]=function(_0x35cd1a){for(var _0x115ea0=0x0,_0x181711=events['length'];_0x115ea0<_0x181711;_0x115ea0++){var _0x3d8953=events[_0x115ea0];var _0x5823e9=createListener(_0xbb7c('0x4')+_0x3d8953,_0x35cd1a);FaxInteractionEvents['on'](_0x3d8953,_0x5823e9);}}; \ No newline at end of file +var _0x4d18=['faxInteraction:','remove','removeListener'];(function(_0x5530a9,_0x48e4c2){var _0x1c69f4=function(_0x2577e0){while(--_0x2577e0){_0x5530a9['push'](_0x5530a9['shift']());}};_0x1c69f4(++_0x48e4c2);}(_0x4d18,0xdc));var _0x84d1=function(_0x74d93e,_0x242d8d){_0x74d93e=_0x74d93e-0x0;var _0x5bd978=_0x4d18[_0x74d93e];return _0x5bd978;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x84d1('0x0'),'update'];function createListener(_0x135310,_0x137aa7){return function(_0x59f4fb){_0x137aa7['emit'](_0x135310,_0x59f4fb);};}function removeListener(_0x29b130,_0x5d8951){return function(){FaxInteractionEvents[_0x84d1('0x1')](_0x29b130,_0x5d8951);};}exports['register']=function(_0x53246d){for(var _0x42d2b3=0x0,_0xa57dc0=events['length'];_0x42d2b3<_0xa57dc0;_0x42d2b3++){var _0x214122=events[_0x42d2b3];var _0x2b8d24=createListener(_0x84d1('0x2')+_0x214122,_0x53246d);FaxInteractionEvents['on'](_0x214122,_0x2b8d24);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 8e8ceb7..33c5240 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 _0xfff0=['create','addMessage','/:id/tags','tracked','fax','addTags','put','update','delete','faxinteraction:destroy','removeTags','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post'];(function(_0x13727d,_0x4df1bc){var _0x9c69a4=function(_0x4bb2c4){while(--_0x4bb2c4){_0x13727d['push'](_0x13727d['shift']());}};_0x9c69a4(++_0x4df1bc);}(_0xfff0,0xeb));var _0x0fff=function(_0x8fd7c8,_0x391c24){_0x8fd7c8=_0x8fd7c8-0x0;var _0x38aec4=_0xfff0[_0x8fd7c8];return _0x38aec4;};'use strict';var multer=require(_0x0fff('0x0'));var util=require(_0x0fff('0x1'));var path=require('path');var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0fff('0x3'));var auth=require(_0x0fff('0x4'));var interaction=require(_0x0fff('0x5'));var config=require(_0x0fff('0x6'));var controller=require(_0x0fff('0x7'));router[_0x0fff('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0fff('0x9'),auth[_0x0fff('0xa')](),controller[_0x0fff('0xb')]);router[_0x0fff('0x8')](_0x0fff('0xc'),auth[_0x0fff('0xa')](),controller[_0x0fff('0xd')]);router[_0x0fff('0x8')](_0x0fff('0xe'),auth['isAuthenticated'](),controller[_0x0fff('0xf')]);router[_0x0fff('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x0fff('0x10')]('/',auth[_0x0fff('0xa')](),controller[_0x0fff('0x11')]);router[_0x0fff('0x10')](_0x0fff('0xe'),auth[_0x0fff('0xa')](),controller[_0x0fff('0x12')]);router[_0x0fff('0x10')](_0x0fff('0x13'),auth[_0x0fff('0xa')](),interaction[_0x0fff('0x14')](_0x0fff('0x15'),'faxinteraction:addtags'),controller[_0x0fff('0x16')]);router[_0x0fff('0x17')]('/:id',auth[_0x0fff('0xa')](),interaction[_0x0fff('0x14')](_0x0fff('0x15'),'faxinteraction:update'),controller[_0x0fff('0x18')]);router[_0x0fff('0x19')](_0x0fff('0xc'),auth[_0x0fff('0xa')](),interaction[_0x0fff('0x14')]('fax',_0x0fff('0x1a')),controller['destroy']);router[_0x0fff('0x19')](_0x0fff('0x13'),auth[_0x0fff('0xa')](),controller[_0x0fff('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa2dc=['destroy','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','fax','put','faxinteraction:update','update','delete','tracked'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa2dc,0xfb));var _0xca2d=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0xa2dc[_0x1be3b3];return _0x4f8b2d;};'use strict';var multer=require(_0xca2d('0x0'));var util=require('util');var path=require(_0xca2d('0x1'));var timeout=require(_0xca2d('0x2'));var express=require(_0xca2d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xca2d('0x4'));var interaction=require(_0xca2d('0x5'));var config=require(_0xca2d('0x6'));var controller=require(_0xca2d('0x7'));router[_0xca2d('0x8')]('/',auth[_0xca2d('0x9')](),controller[_0xca2d('0xa')]);router[_0xca2d('0x8')](_0xca2d('0xb'),auth['isAuthenticated'](),controller[_0xca2d('0xc')]);router[_0xca2d('0x8')](_0xca2d('0xd'),auth[_0xca2d('0x9')](),controller[_0xca2d('0xe')]);router[_0xca2d('0x8')]('/:id/messages',auth[_0xca2d('0x9')](),controller[_0xca2d('0xf')]);router['get'](_0xca2d('0x10'),auth[_0xca2d('0x9')](),controller[_0xca2d('0x11')]);router['post']('/',auth[_0xca2d('0x9')](),controller['create']);router[_0xca2d('0x12')](_0xca2d('0x13'),auth[_0xca2d('0x9')](),controller[_0xca2d('0x14')]);router[_0xca2d('0x12')](_0xca2d('0x15'),auth[_0xca2d('0x9')](),interaction['tracked'](_0xca2d('0x16'),'faxinteraction:addtags'),controller['addTags']);router[_0xca2d('0x17')](_0xca2d('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xca2d('0x16'),_0xca2d('0x18')),controller[_0xca2d('0x19')]);router[_0xca2d('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0xca2d('0x1b')](_0xca2d('0x16'),'faxinteraction:destroy'),controller[_0xca2d('0x1c')]);router[_0xca2d('0x1a')](_0xca2d('0x15'),auth[_0xca2d('0x9')](),controller[_0xca2d('0x1d')]);module[_0xca2d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 51dec80..f0d9e8a 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 _0x4a81=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x1f8517,_0x564adb){var _0x1425be=function(_0x1f6f02){while(--_0x1f6f02){_0x1f8517['push'](_0x1f8517['shift']());}};_0x1425be(++_0x564adb);}(_0x4a81,0x1b7));var _0x14a8=function(_0x1d168b,_0xdae06b){_0x1d168b=_0x1d168b-0x0;var _0x12ac97=_0x4a81[_0x1d168b];return _0x12ac97;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'body':{'type':Sequelize[_0x14a8('0x2')](_0x14a8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x14a8('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x14a8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x14a8('0x5')]}}; \ No newline at end of file +var _0x8128=['DATE','sequelize','medium','BOOLEAN','out','TEXT'];(function(_0x6c7ac2,_0xfda494){var _0x5a5273=function(_0x31b83c){while(--_0x31b83c){_0x6c7ac2['push'](_0x6c7ac2['shift']());}};_0x5a5273(++_0xfda494);}(_0x8128,0x1b1));var _0x8812=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8128[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x8812('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x8812('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x8812('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8812('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8812('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8812('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index ab806f9..ba3e352 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 _0x30e1=['interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteraction','role','RejectMessage','rejectMessage','contact','create','CmContact','findOne','isNil','AttachmentId','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','root','server','Attachment','join','basename','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','body','describe','fax-interactions','accept','fax','read','format','UserId','user','get','FaxInteractionId','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5c5899,_0x130bbb){var _0x2582d8=function(_0x10d5ad){while(--_0x10d5ad){_0x5c5899['push'](_0x5c5899['shift']());}};_0x2582d8(++_0x130bbb);}(_0x30e1,0x147));var _0x130e=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0x30e1[_0x134d5e];return _0x1e166a;};'use strict';var emlformat=require(_0x130e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x130e('0x1'));var jsonpatch=require(_0x130e('0x2'));var rp=require(_0x130e('0x3'));var moment=require(_0x130e('0x4'));var BPromise=require(_0x130e('0x5'));var Mustache=require(_0x130e('0x6'));var util=require('util');var path=require(_0x130e('0x7'));var sox=require(_0x130e('0x8'));var csv=require(_0x130e('0x9'));var ejs=require(_0x130e('0xa'));var fs=require('fs');var fs_extra=require(_0x130e('0xb'));var _=require(_0x130e('0xc'));var squel=require('squel');var crypto=require(_0x130e('0xd'));var jsforce=require(_0x130e('0xe'));var deskjs=require(_0x130e('0xf'));var toCsv=require(_0x130e('0x9'));var querystring=require(_0x130e('0x10'));var Papa=require('papaparse');var Redis=require(_0x130e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x130e('0x12'));var as=require(_0x130e('0x13'));var hardwareService=require(_0x130e('0x14'));var logger=require(_0x130e('0x15'))(_0x130e('0x16'));var utils=require(_0x130e('0x17'));var config=require(_0x130e('0x18'));var licenseUtil=require(_0x130e('0x19'));var db=require(_0x130e('0x1a'))['db'];config['redis']=_['defaults'](config[_0x130e('0x1b')],{'host':_0x130e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x130e('0x1b')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0x130e('0x1d'));var client=jayson[_0x130e('0x1e')][_0x130e('0x1f')]({'port':0x232c});var client9002=jayson[_0x130e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1969d1,_0x1f8a79,_0x2f2e59,_0x422fde){return new BPromise(function(_0x432cc8,_0x1041ad){var _0x1423ea=_0x422fde||client;return _0x1423ea[_0x130e('0x20')](_0x1969d1,_0x2f2e59)[_0x130e('0x21')](function(_0x57cffd){logger[_0x130e('0x22')](_0x130e('0x23'),_0x1f8a79,_0x130e('0x24'));logger[_0x130e('0x25')](_0x130e('0x26'),_0x1f8a79,_0x130e('0x24'),JSON['stringify'](_0x57cffd));if(_0x57cffd[_0x130e('0x27')]){if(_0x57cffd[_0x130e('0x27')][_0x130e('0x28')]===0x1f4){logger[_0x130e('0x27')](_0x130e('0x23'),_0x1f8a79,_0x57cffd[_0x130e('0x27')][_0x130e('0x29')]);return _0x1041ad(_0x57cffd[_0x130e('0x27')][_0x130e('0x29')]);}logger[_0x130e('0x27')](_0x130e('0x23'),_0x1f8a79,_0x57cffd[_0x130e('0x27')][_0x130e('0x29')]);return _0x432cc8(_0x57cffd['error'][_0x130e('0x29')]);}else{logger['info'](_0x130e('0x23'),_0x1f8a79,_0x130e('0x24'));_0x432cc8(_0x57cffd['result'][_0x130e('0x29')]);}})[_0x130e('0x2a')](function(_0x3b1b72){logger[_0x130e('0x27')](_0x130e('0x23'),_0x1f8a79,_0x3b1b72);_0x1041ad(_0x3b1b72);});});}function respondWithStatusCode(_0x4f31d4,_0x478ab7){_0x478ab7=_0x478ab7||0xcc;return function(_0xabaec0){if(_0xabaec0){return _0x4f31d4[_0x130e('0x2b')](_0x478ab7);}return _0x4f31d4[_0x130e('0x2c')](_0x478ab7)[_0x130e('0x2d')]();};}function respondWithResult(_0x488cce,_0x1ec936){_0x1ec936=_0x1ec936||0xc8;return function(_0x214979){if(_0x214979){return _0x488cce['status'](_0x1ec936)[_0x130e('0x2e')](_0x214979);}};}function respondWithFilteredResult(_0x6a8107,_0x5a366b){return function(_0x4fb66e){if(_0x4fb66e){var _0x2c3fa4=typeof _0x5a366b[_0x130e('0x2f')]===_0x130e('0x30')&&typeof _0x5a366b['limit']===_0x130e('0x30');var _0x42bb55=_0x4fb66e[_0x130e('0x31')];var _0x39cccc=_0x2c3fa4?0x0:_0x5a366b[_0x130e('0x2f')];var _0x962348=_0x2c3fa4?_0x4fb66e['count']:_0x5a366b[_0x130e('0x2f')]+_0x5a366b[_0x130e('0x32')];var _0x23c8a1;if(_0x962348>=_0x42bb55){_0x962348=_0x42bb55;_0x23c8a1=0xc8;}else{_0x23c8a1=0xce;}_0x6a8107[_0x130e('0x2c')](_0x23c8a1);return _0x6a8107[_0x130e('0x33')](_0x130e('0x34'),_0x39cccc+'-'+_0x962348+'/'+_0x42bb55)['json'](_0x4fb66e);}return null;};}function patchUpdates(_0x1556fd){return function(_0x3b5d25){try{jsonpatch[_0x130e('0x35')](_0x3b5d25,_0x1556fd,!![]);}catch(_0x274286){return BPromise[_0x130e('0x36')](_0x274286);}return _0x3b5d25[_0x130e('0x37')]();};}function saveUpdates(_0x3796ff,_0x4cd9fd){return function(_0x567928){if(_0x567928){return _0x567928[_0x130e('0x38')](_0x3796ff)[_0x130e('0x21')](function(_0x3c1bd3){return _0x3c1bd3;});}return null;};}function removeEntity(_0x1aca94,_0x3f9b99){return function(_0x525070){if(_0x525070){return _0x525070[_0x130e('0x39')]()[_0x130e('0x21')](function(){_0x1aca94[_0x130e('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb0404c,_0x20cc47){return function(_0x253a21){if(!_0x253a21){_0xb0404c[_0x130e('0x2b')](0x194);}return _0x253a21;};}function handleError(_0x4464e3,_0x125f34){_0x125f34=_0x125f34||0x1f4;return function(_0x2d568e){logger[_0x130e('0x27')](_0x2d568e[_0x130e('0x3a')]);if(_0x2d568e[_0x130e('0x3b')]){delete _0x2d568e[_0x130e('0x3b')];}_0x4464e3['status'](_0x125f34)[_0x130e('0x3c')](_0x2d568e);};}exports[_0x130e('0x3d')]=function(_0xad86ad,_0x324bef){var _0x51cbdc={},_0x3c21dc={},_0x59b104={'count':0x0,'rows':[]};var _0x4f267a=_[_0x130e('0x3e')](db[_0x130e('0x3f')][_0x130e('0x40')],function(_0x1b81ac){return{'name':_0x1b81ac[_0x130e('0x41')],'type':_0x1b81ac['type'][_0x130e('0x42')]};});_0x3c21dc['model']=_['map'](_0x4f267a,_0x130e('0x3b'));_0x3c21dc['query']=_[_0x130e('0x43')](_0xad86ad[_0x130e('0x44')]);_0x3c21dc[_0x130e('0x45')]=_[_0x130e('0x46')](_0x3c21dc[_0x130e('0x47')],_0x3c21dc[_0x130e('0x44')]);_0x51cbdc[_0x130e('0x48')]=_['intersection'](_0x3c21dc[_0x130e('0x47')],qs[_0x130e('0x49')](_0xad86ad[_0x130e('0x44')][_0x130e('0x49')]));_0x51cbdc[_0x130e('0x48')]=_0x51cbdc['attributes']['length']?_0x51cbdc['attributes']:_0x3c21dc[_0x130e('0x47')];if(!_0xad86ad[_0x130e('0x44')][_0x130e('0x4a')]('nolimit')){_0x51cbdc['limit']=qs[_0x130e('0x32')](_0xad86ad[_0x130e('0x44')]['limit']);_0x51cbdc[_0x130e('0x2f')]=qs[_0x130e('0x2f')](_0xad86ad[_0x130e('0x44')][_0x130e('0x2f')]);}_0x51cbdc[_0x130e('0x4b')]=qs['sort'](_0xad86ad['query'][_0x130e('0x4c')]);_0x51cbdc[_0x130e('0x4d')]=qs[_0x130e('0x45')](_[_0x130e('0x4e')](_0xad86ad[_0x130e('0x44')],_0x3c21dc[_0x130e('0x45')]),_0x4f267a);if(_0xad86ad[_0x130e('0x44')][_0x130e('0x4f')]){_0x51cbdc[_0x130e('0x4d')]=_[_0x130e('0x50')](_0x51cbdc[_0x130e('0x4d')],{'$or':_['map'](_0x4f267a,function(_0x1e8493){if(_0x1e8493['type']!=='VIRTUAL'){var _0x3baae1={};_0x3baae1[_0x1e8493[_0x130e('0x3b')]]={'$like':'%'+_0xad86ad['query'][_0x130e('0x4f')]+'%'};return _0x3baae1;}})});}_0x51cbdc=_[_0x130e('0x50')]({},_0x51cbdc,_0xad86ad[_0x130e('0x51')]);var _0x514af8={'where':_0x51cbdc[_0x130e('0x4d')]};return db[_0x130e('0x3f')][_0x130e('0x31')](_0x514af8)['then'](function(_0x4f97c8){_0x59b104[_0x130e('0x31')]=_0x4f97c8;if(_0xad86ad[_0x130e('0x44')][_0x130e('0x52')]){_0x51cbdc[_0x130e('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0x130e('0x54')](_0x51cbdc);})['then'](function(_0x3bb25d){_0x59b104[_0x130e('0x55')]=_0x3bb25d;return _0x59b104;})['then'](respondWithFilteredResult(_0x324bef,_0x51cbdc))[_0x130e('0x2a')](handleError(_0x324bef,null));};exports[_0x130e('0x56')]=function(_0x1810ee,_0x7283d5){var _0x4d86c2={'raw':!![],'where':{'id':_0x1810ee[_0x130e('0x57')]['id']}},_0x4cbc0e={};_0x4cbc0e[_0x130e('0x47')]=_[_0x130e('0x43')](db['FaxMessage']['rawAttributes']);_0x4cbc0e['query']=_['keys'](_0x1810ee[_0x130e('0x44')]);_0x4cbc0e[_0x130e('0x45')]=_[_0x130e('0x46')](_0x4cbc0e['model'],_0x4cbc0e['query']);_0x4d86c2[_0x130e('0x48')]=_[_0x130e('0x46')](_0x4cbc0e[_0x130e('0x47')],qs['fields'](_0x1810ee[_0x130e('0x44')]['fields']));_0x4d86c2[_0x130e('0x48')]=_0x4d86c2[_0x130e('0x48')][_0x130e('0x58')]?_0x4d86c2[_0x130e('0x48')]:_0x4cbc0e[_0x130e('0x47')];if(_0x1810ee[_0x130e('0x44')][_0x130e('0x52')]){_0x4d86c2[_0x130e('0x53')]=[{'all':!![]}];}_0x4d86c2=_['merge']({},_0x4d86c2,_0x1810ee[_0x130e('0x51')]);return db[_0x130e('0x3f')][_0x130e('0x59')](_0x4d86c2)[_0x130e('0x21')](handleEntityNotFound(_0x7283d5,null))[_0x130e('0x21')](respondWithResult(_0x7283d5,null))['catch'](handleError(_0x7283d5,null));};exports['update']=function(_0x4bd87d,_0x20c538){if(_0x4bd87d[_0x130e('0x5a')]['id']){delete _0x4bd87d['body']['id'];}return db[_0x130e('0x3f')][_0x130e('0x59')]({'where':{'id':_0x4bd87d['params']['id']}})[_0x130e('0x21')](handleEntityNotFound(_0x20c538,null))[_0x130e('0x21')](saveUpdates(_0x4bd87d[_0x130e('0x5a')],null))[_0x130e('0x21')](respondWithResult(_0x20c538,null))[_0x130e('0x2a')](handleError(_0x20c538,null));};exports[_0x130e('0x39')]=function(_0x351d4c,_0x598b73){return db[_0x130e('0x3f')][_0x130e('0x59')]({'where':{'id':_0x351d4c['params']['id']}})[_0x130e('0x21')](handleEntityNotFound(_0x598b73,null))['then'](removeEntity(_0x598b73,null))[_0x130e('0x2a')](handleError(_0x598b73,null));};exports[_0x130e('0x5b')]=function(_0x5b7770,_0xed1ab4){return db[_0x130e('0x3f')]['describe']()['then'](respondWithResult(_0xed1ab4,null))[_0x130e('0x2a')](handleError(_0xed1ab4,null));};var interaction_log=require(_0x130e('0x15'))(_0x130e('0x5c'));exports[_0x130e('0x5d')]=function(_0x10dc9a,_0x56ba57,_0x1cf990){var _0x5af8d9={'agent':{},'channel':_0x130e('0x5e')};if(_0x10dc9a[_0x130e('0x5a')]['id']){delete _0x10dc9a[_0x130e('0x5a')]['id'];}_0x10dc9a[_0x130e('0x5a')][_0x130e('0x5f')]=!![];_0x10dc9a[_0x130e('0x5a')]['readAt']=moment()[_0x130e('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x10dc9a[_0x130e('0x5a')][_0x130e('0x61')]=_0x10dc9a[_0x130e('0x5a')][_0x130e('0x61')]||_0x10dc9a[_0x130e('0x62')]['id'];_0x5af8d9['agent']['id']=_0x10dc9a[_0x130e('0x5a')]['UserId'];return db[_0x130e('0x3f')][_0x130e('0x59')]({'where':{'id':_0x10dc9a[_0x130e('0x57')]['id'],'UserId':null}})[_0x130e('0x21')](handleEntityNotFound(_0x56ba57,null))[_0x130e('0x21')](saveUpdates(_0x10dc9a[_0x130e('0x5a')],null))[_0x130e('0x21')](function(_0x42029f){if(_0x42029f){_0x5af8d9[_0x130e('0x29')]=_0x42029f[_0x130e('0x63')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x42029f[_0x130e('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x56ba57,null))[_0x130e('0x21')](function(_0x1c3d5d){if(_0x1c3d5d){return _0x1c3d5d[_0x130e('0x38')]({'UserId':_0x10dc9a[_0x130e('0x5a')][_0x130e('0x61')],'read1stAt':_['isNil'](_0x1c3d5d['read1stAt'])?moment()['format'](_0x130e('0x65')):undefined});}return null;})[_0x130e('0x21')](function(_0x23b972){if(_0x23b972){_0x5af8d9['interaction']=_0x23b972['get']({'plain':!![]});interaction_log[_0x130e('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x10dc9a[_0x130e('0x62')]['id'],_0x10dc9a[_0x130e('0x62')][_0x130e('0x3b')],_0x10dc9a[_0x130e('0x62')]['role'],_0x5af8d9[_0x130e('0x66')]['id'],_0x10dc9a['body']?JSON[_0x130e('0x67')](_0x10dc9a[_0x130e('0x5a')]):_0x130e('0x68'));return respondWithRpcPromise(_0x130e('0x69'),_0x130e('0x6a'),_0x5af8d9);}return null;})[_0x130e('0x21')](function(_0x431e54){var _0x2b4aab=_0x130e('0x6b')+_0x431e54['message'][_0x130e('0x6c')];return db[_0x130e('0x6d')][_0x130e('0x44')](_0x2b4aab,{'type':db[_0x130e('0x6e')][_0x130e('0x6f')][_0x130e('0x70')],'raw':!![]})[_0x130e('0x21')](function(_0x16fa71){return _0x16fa71;});})[_0x130e('0x21')](function(_0x410d2c){if(_0x410d2c){_0x5af8d9['message']['contact']=_0x410d2c[0x0];if(!_0x10dc9a[_0x130e('0x5a')][_0x130e('0x61')])return;return db[_0x130e('0x71')][_0x130e('0x59')]({'where':{'id':_0x10dc9a[_0x130e('0x5a')]['UserId'],'role':_0x130e('0x72')},'attributes':['id',_0x130e('0x3b'),'fullname',_0x130e('0x73'),_0x130e('0x74')],'raw':!![]});}return null;})[_0x130e('0x21')](function(_0x1ca9ea){if(!_0x1ca9ea)return null;_0x5af8d9[_0x130e('0x29')][_0x130e('0x72')]=_0x1ca9ea;return _0x5af8d9;})[_0x130e('0x21')](function(_0x734c27){if(_0x734c27){if(_0x10dc9a['body'][_0x130e('0x75')]){_0x5af8d9[_0x130e('0x29')][_0x130e('0x76')]=util[_0x130e('0x60')](_0x130e('0x77'),_0x10dc9a['user'][_0x130e('0x3b')]);_0x5af8d9[_0x130e('0x29')][_0x130e('0x78')]=_0x5af8d9['channel'];_0x5af8d9[_0x130e('0x29')][_0x130e('0x79')]=_0x5af8d9[_0x130e('0x78')];_0x5af8d9[_0x130e('0x29')][_0x130e('0x7a')]=_0x130e('0x5d');return respondWithRpcPromise(_0x130e('0x7b'),_0x130e('0x7b'),{'event':_0x130e('0x7c'),'message':_0x5af8d9[_0x130e('0x29')]},client9002)[_0x130e('0x21')](function(){return _0x5af8d9;});}return _0x5af8d9;}return null;})[_0x130e('0x21')](respondWithResult(_0x56ba57,null))['catch'](handleError(_0x56ba57,null));};var interaction_log=require(_0x130e('0x15'))('fax-interactions');exports[_0x130e('0x36')]=function(_0x3d61f0,_0x1edbb,_0x5836eb){var _0x5d432e={'agent':{},'channel':_0x130e('0x5e')};if(_0x3d61f0[_0x130e('0x5a')]['id']){delete _0x3d61f0[_0x130e('0x5a')]['id'];}_0x3d61f0[_0x130e('0x5a')][_0x130e('0x61')]=_0x3d61f0[_0x130e('0x5a')][_0x130e('0x61')]||_0x3d61f0['user']['id'];_0x5d432e['agent']['id']=_0x3d61f0[_0x130e('0x5a')][_0x130e('0x61')];return db[_0x130e('0x3f')][_0x130e('0x59')]({'where':{'id':_0x3d61f0[_0x130e('0x57')]['id'],'UserId':null}})[_0x130e('0x21')](handleEntityNotFound(_0x1edbb,null))[_0x130e('0x21')](function(_0x290048){if(_0x290048){_0x5d432e[_0x130e('0x29')]=_0x290048[_0x130e('0x63')]({'plain':!![]});return db[_0x130e('0x7d')]['find']({'where':{'id':_0x290048[_0x130e('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1edbb,null))[_0x130e('0x21')](function(_0x19b531){if(_0x19b531){_0x5d432e[_0x130e('0x66')]=_0x19b531[_0x130e('0x63')]({'plain':!![]});interaction_log[_0x130e('0x22')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d61f0[_0x130e('0x62')]['id'],_0x3d61f0[_0x130e('0x62')][_0x130e('0x3b')],_0x3d61f0[_0x130e('0x62')][_0x130e('0x7e')],_0x5d432e[_0x130e('0x66')]['id'],_0x3d61f0[_0x130e('0x5a')]?JSON[_0x130e('0x67')](_0x3d61f0[_0x130e('0x5a')]):'null');return respondWithRpcPromise(_0x130e('0x7f'),_0x130e('0x80'),_0x5d432e);}return null;})[_0x130e('0x21')](function(_0xbd47ec){var _0x5b7e23=_0x130e('0x6b')+_0xbd47ec[_0x130e('0x29')]['ContactId'];return db[_0x130e('0x6d')]['query'](_0x5b7e23,{'type':db[_0x130e('0x6e')][_0x130e('0x6f')][_0x130e('0x70')],'raw':!![]})[_0x130e('0x21')](function(_0x3cdae9){return _0x3cdae9;});})['then'](function(_0x58352a){if(_0x58352a){_0x5d432e[_0x130e('0x29')][_0x130e('0x81')]=_0x58352a[0x0];if(!_0x3d61f0[_0x130e('0x5a')][_0x130e('0x61')])return;return db[_0x130e('0x71')][_0x130e('0x59')]({'where':{'id':_0x3d61f0['body']['UserId'],'role':_0x130e('0x72')},'attributes':['id',_0x130e('0x3b'),'fullname','email',_0x130e('0x74')],'raw':!![]});}return null;})[_0x130e('0x21')](function(_0x2a8525){if(!_0x2a8525)return null;_0x5d432e[_0x130e('0x29')]['agent']=_0x2a8525;return _0x5d432e;})['then'](function(_0x2926ff){if(_0x2926ff){_0x2926ff['message']['interface']=util[_0x130e('0x60')](_0x130e('0x77'),_0x3d61f0['user'][_0x130e('0x3b')]);_0x2926ff[_0x130e('0x29')][_0x130e('0x78')]=_0x5d432e[_0x130e('0x78')];_0x2926ff[_0x130e('0x29')][_0x130e('0x79')]=_0x5d432e[_0x130e('0x78')];_0x2926ff[_0x130e('0x29')][_0x130e('0x7a')]=_0x130e('0x36');respondWithRpcPromise('EventManager',_0x130e('0x7b'),{'event':'rejectmessage','message':_0x2926ff[_0x130e('0x29')]},client9002);return _0x5d432e;}return null;})[_0x130e('0x21')](respondWithResult(_0x1edbb,null))[_0x130e('0x2a')](handleError(_0x1edbb,null));};exports[_0x130e('0x82')]=function(_0x123072,_0xfac878){var _0x1ad340;return db[_0x130e('0x3f')][_0x130e('0x82')](_0x123072['body'],{})[_0x130e('0x21')](function(_0x41fe86){_0x1ad340=_0x41fe86;return db[_0x130e('0x83')][_0x130e('0x84')]({'where':{'id':_0x1ad340['ContactId']}});})[_0x130e('0x21')](function(_0x2401d3){if(_[_0x130e('0x85')](_0x2401d3)){return;}else{_0x1ad340[_0x130e('0x5e')]=_0x2401d3['fax'];return db['Attachment']['findOne']({'where':{'id':_0x1ad340[_0x130e('0x86')]}});}})['then'](function(_0x1c828c){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x130e('0x85')](_0x123072[_0x130e('0x5a')])?undefined:_0x123072[_0x130e('0x5a')][_0x130e('0x87')],'path':_['isNil'](_0x1c828c)?undefined:util[_0x130e('0x60')](_0x130e('0x88'),_0x1c828c['basename']),'fax':_[_0x130e('0x85')](_0x1ad340[_0x130e('0x5e')])?undefined:_0x1ad340['fax'],'AttachmentId':_0x1ad340[_0x130e('0x86')]},client9002);})[_0x130e('0x21')](respondWithResult(_0xfac878,0xc9))[_0x130e('0x2a')](handleError(_0xfac878,null));};exports[_0x130e('0x89')]=function(_0x59ae2f,_0x1fa680){var _0x6107cb=path['join'](config[_0x130e('0x8a')],_0x130e('0x8b'),'files','attachments');return db[_0x130e('0x3f')][_0x130e('0x59')]({'where':{'id':_0x59ae2f[_0x130e('0x57')]['id']},'include':[{'model':db[_0x130e('0x8c')],'as':_0x130e('0x8c')}]})[_0x130e('0x21')](handleEntityNotFound(_0x1fa680,null))[_0x130e('0x21')](function(_0x258b6e){if(_0x258b6e){return _0x1fa680[_0x130e('0x89')](path[_0x130e('0x8d')](_0x6107cb,_0x258b6e[_0x130e('0x8c')][_0x130e('0x8e')]));}})[_0x130e('0x2a')](handleError(_0x1fa680,null));}; \ No newline at end of file +var _0x8375=['VIRTUAL','merge','options','includeAll','include','FaxMessage','findAll','show','body','find','params','describe','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','channel','motionChannel','event','accept','acceptmessage','fax','RejectMessage','rejectMessage','sequelize','SIP/%s','EventManager','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','isNil','basename','download','join','root','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxMessage.socket','jayson/promise','http','request','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x8375,0xcb));var _0x5837=function(_0x3eda46,_0x5a8d2a){_0x3eda46=_0x3eda46-0x0;var _0x392750=_0x8375[_0x3eda46];return _0x392750;};'use strict';var emlformat=require(_0x5837('0x0'));var rimraf=require(_0x5837('0x1'));var zipdir=require(_0x5837('0x2'));var jsonpatch=require(_0x5837('0x3'));var rp=require(_0x5837('0x4'));var moment=require(_0x5837('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5837('0x6'));var util=require(_0x5837('0x7'));var path=require(_0x5837('0x8'));var sox=require(_0x5837('0x9'));var csv=require('to-csv');var ejs=require(_0x5837('0xa'));var fs=require('fs');var fs_extra=require(_0x5837('0xb'));var _=require(_0x5837('0xc'));var squel=require('squel');var crypto=require(_0x5837('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5837('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5837('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5837('0x10'));var qs=require(_0x5837('0x11'));var as=require(_0x5837('0x12'));var hardwareService=require(_0x5837('0x13'));var logger=require(_0x5837('0x14'))(_0x5837('0x15'));var utils=require(_0x5837('0x16'));var config=require(_0x5837('0x17'));var licenseUtil=require(_0x5837('0x18'));var db=require('../../mysqldb')['db'];config[_0x5837('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5837('0x1a'))(new Redis(config[_0x5837('0x19')]));require(_0x5837('0x1b'))['register'](socket);var jayson=require(_0x5837('0x1c'));var client=jayson['client'][_0x5837('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x5837('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2effac,_0x5aa119,_0x14bd8c,_0x5f46f3){return new BPromise(function(_0x4d8069,_0x39c16e){var _0x658161=_0x5f46f3||client;return _0x658161[_0x5837('0x1e')](_0x2effac,_0x14bd8c)['then'](function(_0x57354f){logger[_0x5837('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x5aa119,'request\x20sent');logger[_0x5837('0x20')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5aa119,_0x5837('0x21'),JSON[_0x5837('0x22')](_0x57354f));if(_0x57354f['error']){if(_0x57354f[_0x5837('0x23')][_0x5837('0x24')]===0x1f4){logger[_0x5837('0x23')](_0x5837('0x25'),_0x5aa119,_0x57354f[_0x5837('0x23')][_0x5837('0x26')]);return _0x39c16e(_0x57354f[_0x5837('0x23')][_0x5837('0x26')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x5aa119,_0x57354f[_0x5837('0x23')][_0x5837('0x26')]);return _0x4d8069(_0x57354f[_0x5837('0x23')]['message']);}else{logger['info'](_0x5837('0x25'),_0x5aa119,'request\x20sent');_0x4d8069(_0x57354f[_0x5837('0x27')]['message']);}})[_0x5837('0x28')](function(_0x56f4ab){logger[_0x5837('0x23')](_0x5837('0x25'),_0x5aa119,_0x56f4ab);_0x39c16e(_0x56f4ab);});});}function respondWithStatusCode(_0x5bb7ea,_0x3f30ed){_0x3f30ed=_0x3f30ed||0xcc;return function(_0x541bbe){if(_0x541bbe){return _0x5bb7ea[_0x5837('0x29')](_0x3f30ed);}return _0x5bb7ea[_0x5837('0x2a')](_0x3f30ed)['end']();};}function respondWithResult(_0x3036d7,_0x5f028f){_0x5f028f=_0x5f028f||0xc8;return function(_0x2178ee){if(_0x2178ee){return _0x3036d7[_0x5837('0x2a')](_0x5f028f)[_0x5837('0x2b')](_0x2178ee);}};}function respondWithFilteredResult(_0x1bb072,_0x281c99){return function(_0x3b5a0){if(_0x3b5a0){var _0x4945ed=typeof _0x281c99['offset']===_0x5837('0x2c')&&typeof _0x281c99['limit']==='undefined';var _0x1a2218=_0x3b5a0[_0x5837('0x2d')];var _0xb8aa99=_0x4945ed?0x0:_0x281c99[_0x5837('0x2e')];var _0x21745b=_0x4945ed?_0x3b5a0[_0x5837('0x2d')]:_0x281c99['offset']+_0x281c99['limit'];var _0x5e5b09;if(_0x21745b>=_0x1a2218){_0x21745b=_0x1a2218;_0x5e5b09=0xc8;}else{_0x5e5b09=0xce;}_0x1bb072[_0x5837('0x2a')](_0x5e5b09);return _0x1bb072['set'](_0x5837('0x2f'),_0xb8aa99+'-'+_0x21745b+'/'+_0x1a2218)['json'](_0x3b5a0);}return null;};}function patchUpdates(_0x4e4a09){return function(_0x350bd7){try{jsonpatch[_0x5837('0x30')](_0x350bd7,_0x4e4a09,!![]);}catch(_0x490ac7){return BPromise[_0x5837('0x31')](_0x490ac7);}return _0x350bd7[_0x5837('0x32')]();};}function saveUpdates(_0x58c897,_0x2a4161){return function(_0x12356d){if(_0x12356d){return _0x12356d[_0x5837('0x33')](_0x58c897)[_0x5837('0x34')](function(_0x43124b){return _0x43124b;});}return null;};}function removeEntity(_0x282375,_0xa9e51){return function(_0x5202fd){if(_0x5202fd){return _0x5202fd[_0x5837('0x35')]()[_0x5837('0x34')](function(){_0x282375[_0x5837('0x2a')](0xcc)[_0x5837('0x36')]();});}};}function handleEntityNotFound(_0x220f21,_0x222a6f){return function(_0x1bed33){if(!_0x1bed33){_0x220f21[_0x5837('0x29')](0x194);}return _0x1bed33;};}function handleError(_0x3daec7,_0x17ba37){_0x17ba37=_0x17ba37||0x1f4;return function(_0x42e0f4){logger[_0x5837('0x23')](_0x42e0f4[_0x5837('0x37')]);if(_0x42e0f4['name']){delete _0x42e0f4['name'];}_0x3daec7[_0x5837('0x2a')](_0x17ba37)[_0x5837('0x38')](_0x42e0f4);};}exports[_0x5837('0x39')]=function(_0x355923,_0x10b6c5){var _0x599f8e={},_0x5f34e1={},_0x327699={'count':0x0,'rows':[]};var _0x1b739a=_['map'](db['FaxMessage'][_0x5837('0x3a')],function(_0x1e4a15){return{'name':_0x1e4a15[_0x5837('0x3b')],'type':_0x1e4a15[_0x5837('0x3c')][_0x5837('0x3d')]};});_0x5f34e1[_0x5837('0x3e')]=_[_0x5837('0x3f')](_0x1b739a,_0x5837('0x40'));_0x5f34e1['query']=_[_0x5837('0x41')](_0x355923[_0x5837('0x42')]);_0x5f34e1[_0x5837('0x43')]=_[_0x5837('0x44')](_0x5f34e1[_0x5837('0x3e')],_0x5f34e1[_0x5837('0x42')]);_0x599f8e[_0x5837('0x45')]=_['intersection'](_0x5f34e1[_0x5837('0x3e')],qs[_0x5837('0x46')](_0x355923[_0x5837('0x42')][_0x5837('0x46')]));_0x599f8e['attributes']=_0x599f8e[_0x5837('0x45')][_0x5837('0x47')]?_0x599f8e[_0x5837('0x45')]:_0x5f34e1[_0x5837('0x3e')];if(!_0x355923[_0x5837('0x42')][_0x5837('0x48')](_0x5837('0x49'))){_0x599f8e[_0x5837('0x4a')]=qs['limit'](_0x355923[_0x5837('0x42')][_0x5837('0x4a')]);_0x599f8e[_0x5837('0x2e')]=qs['offset'](_0x355923[_0x5837('0x42')][_0x5837('0x2e')]);}_0x599f8e[_0x5837('0x4b')]=qs['sort'](_0x355923[_0x5837('0x42')][_0x5837('0x4c')]);_0x599f8e['where']=qs[_0x5837('0x43')](_['pick'](_0x355923['query'],_0x5f34e1[_0x5837('0x43')]),_0x1b739a);if(_0x355923[_0x5837('0x42')][_0x5837('0x4d')]){_0x599f8e[_0x5837('0x4e')]=_['merge'](_0x599f8e[_0x5837('0x4e')],{'$or':_['map'](_0x1b739a,function(_0x3b5093){if(_0x3b5093[_0x5837('0x3c')]!==_0x5837('0x4f')){var _0x445bde={};_0x445bde[_0x3b5093[_0x5837('0x40')]]={'$like':'%'+_0x355923['query'][_0x5837('0x4d')]+'%'};return _0x445bde;}})});}_0x599f8e=_[_0x5837('0x50')]({},_0x599f8e,_0x355923[_0x5837('0x51')]);var _0x2a160={'where':_0x599f8e[_0x5837('0x4e')]};return db['FaxMessage'][_0x5837('0x2d')](_0x2a160)['then'](function(_0x26568d){_0x327699[_0x5837('0x2d')]=_0x26568d;if(_0x355923[_0x5837('0x42')][_0x5837('0x52')]){_0x599f8e[_0x5837('0x53')]=[{'all':!![]}];}return db[_0x5837('0x54')][_0x5837('0x55')](_0x599f8e);})[_0x5837('0x34')](function(_0x48ea15){_0x327699['rows']=_0x48ea15;return _0x327699;})[_0x5837('0x34')](respondWithFilteredResult(_0x10b6c5,_0x599f8e))[_0x5837('0x28')](handleError(_0x10b6c5,null));};exports[_0x5837('0x56')]=function(_0x46e7cd,_0x90c4ee){var _0x25b9a6={'raw':!![],'where':{'id':_0x46e7cd['params']['id']}},_0x42b74e={};_0x42b74e[_0x5837('0x3e')]=_['keys'](db['FaxMessage'][_0x5837('0x3a')]);_0x42b74e[_0x5837('0x42')]=_[_0x5837('0x41')](_0x46e7cd[_0x5837('0x42')]);_0x42b74e['filters']=_[_0x5837('0x44')](_0x42b74e[_0x5837('0x3e')],_0x42b74e[_0x5837('0x42')]);_0x25b9a6[_0x5837('0x45')]=_[_0x5837('0x44')](_0x42b74e[_0x5837('0x3e')],qs[_0x5837('0x46')](_0x46e7cd[_0x5837('0x42')][_0x5837('0x46')]));_0x25b9a6[_0x5837('0x45')]=_0x25b9a6[_0x5837('0x45')]['length']?_0x25b9a6[_0x5837('0x45')]:_0x42b74e['model'];if(_0x46e7cd[_0x5837('0x42')]['includeAll']){_0x25b9a6[_0x5837('0x53')]=[{'all':!![]}];}_0x25b9a6=_[_0x5837('0x50')]({},_0x25b9a6,_0x46e7cd[_0x5837('0x51')]);return db[_0x5837('0x54')]['find'](_0x25b9a6)['then'](handleEntityNotFound(_0x90c4ee,null))[_0x5837('0x34')](respondWithResult(_0x90c4ee,null))[_0x5837('0x28')](handleError(_0x90c4ee,null));};exports['update']=function(_0x2b2766,_0x105f8f){if(_0x2b2766['body']['id']){delete _0x2b2766[_0x5837('0x57')]['id'];}return db[_0x5837('0x54')][_0x5837('0x58')]({'where':{'id':_0x2b2766[_0x5837('0x59')]['id']}})['then'](handleEntityNotFound(_0x105f8f,null))[_0x5837('0x34')](saveUpdates(_0x2b2766['body'],null))[_0x5837('0x34')](respondWithResult(_0x105f8f,null))[_0x5837('0x28')](handleError(_0x105f8f,null));};exports[_0x5837('0x35')]=function(_0x2e14c,_0x768048){return db['FaxMessage']['find']({'where':{'id':_0x2e14c[_0x5837('0x59')]['id']}})['then'](handleEntityNotFound(_0x768048,null))[_0x5837('0x34')](removeEntity(_0x768048,null))[_0x5837('0x28')](handleError(_0x768048,null));};exports[_0x5837('0x5a')]=function(_0x587d2d,_0x2ab81e){return db[_0x5837('0x54')][_0x5837('0x5a')]()[_0x5837('0x34')](respondWithResult(_0x2ab81e,null))[_0x5837('0x28')](handleError(_0x2ab81e,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0x122b96,_0x151895,_0x3355f3){var _0x35bfd3={'agent':{},'channel':'fax'};if(_0x122b96[_0x5837('0x57')]['id']){delete _0x122b96['body']['id'];}_0x122b96['body'][_0x5837('0x5b')]=!![];_0x122b96['body']['readAt']=moment()[_0x5837('0x5c')](_0x5837('0x5d'));_0x122b96['body'][_0x5837('0x5e')]=_0x122b96[_0x5837('0x57')][_0x5837('0x5e')]||_0x122b96[_0x5837('0x5f')]['id'];_0x35bfd3[_0x5837('0x60')]['id']=_0x122b96[_0x5837('0x57')][_0x5837('0x5e')];return db['FaxMessage']['find']({'where':{'id':_0x122b96['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x151895,null))[_0x5837('0x34')](saveUpdates(_0x122b96['body'],null))[_0x5837('0x34')](function(_0x1a9891){if(_0x1a9891){_0x35bfd3[_0x5837('0x26')]=_0x1a9891['get']({'plain':!![]});return db[_0x5837('0x61')]['find']({'where':{'id':_0x1a9891[_0x5837('0x62')]}});}return null;})[_0x5837('0x34')](handleEntityNotFound(_0x151895,null))[_0x5837('0x34')](function(_0x3dd763){if(_0x3dd763){return _0x3dd763[_0x5837('0x33')]({'UserId':_0x122b96[_0x5837('0x57')][_0x5837('0x5e')],'read1stAt':_['isNil'](_0x3dd763[_0x5837('0x63')])?moment()['format'](_0x5837('0x5d')):undefined});}return null;})[_0x5837('0x34')](function(_0x3ce2d5){if(_0x3ce2d5){_0x35bfd3['interaction']=_0x3ce2d5[_0x5837('0x64')]({'plain':!![]});interaction_log[_0x5837('0x1f')](_0x5837('0x65'),_0x122b96[_0x5837('0x5f')]['id'],_0x122b96[_0x5837('0x5f')][_0x5837('0x40')],_0x122b96['user'][_0x5837('0x66')],_0x35bfd3[_0x5837('0x67')]['id'],_0x122b96[_0x5837('0x57')]?JSON['stringify'](_0x122b96['body']):_0x5837('0x68'));return respondWithRpcPromise('AcceptMessage',_0x5837('0x69'),_0x35bfd3);}return null;})['then'](function(_0x898127){var _0x26f2dc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x898127[_0x5837('0x26')][_0x5837('0x6a')];return db['sequelize'][_0x5837('0x42')](_0x26f2dc,{'type':db[_0x5837('0x6b')][_0x5837('0x6c')][_0x5837('0x6d')],'raw':!![]})[_0x5837('0x34')](function(_0x23827e){return _0x23827e;});})[_0x5837('0x34')](function(_0x17eb27){if(_0x17eb27){_0x35bfd3[_0x5837('0x26')][_0x5837('0x6e')]=_0x17eb27[0x0];if(!_0x122b96[_0x5837('0x57')]['UserId'])return;return db[_0x5837('0x6f')][_0x5837('0x58')]({'where':{'id':_0x122b96[_0x5837('0x57')]['UserId'],'role':_0x5837('0x60')},'attributes':['id','name',_0x5837('0x70'),_0x5837('0x71'),'internal'],'raw':!![]});}return null;})[_0x5837('0x34')](function(_0xbe6ca6){if(!_0xbe6ca6)return null;_0x35bfd3[_0x5837('0x26')]['agent']=_0xbe6ca6;return _0x35bfd3;})[_0x5837('0x34')](function(_0x4c42cf){if(_0x4c42cf){if(_0x122b96['body'][_0x5837('0x72')]){_0x35bfd3['message']['interface']=util[_0x5837('0x5c')]('SIP/%s',_0x122b96[_0x5837('0x5f')]['name']);_0x35bfd3['message'][_0x5837('0x73')]=_0x35bfd3['channel'];_0x35bfd3['message'][_0x5837('0x74')]=_0x35bfd3[_0x5837('0x73')];_0x35bfd3[_0x5837('0x26')][_0x5837('0x75')]=_0x5837('0x76');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x5837('0x77'),'message':_0x35bfd3[_0x5837('0x26')]},client9002)[_0x5837('0x34')](function(){return _0x35bfd3;});}return _0x35bfd3;}return null;})[_0x5837('0x34')](respondWithResult(_0x151895,null))[_0x5837('0x28')](handleError(_0x151895,null));};var interaction_log=require(_0x5837('0x14'))('fax-interactions');exports[_0x5837('0x31')]=function(_0x3cffab,_0x25b208,_0x19fe1a){var _0xc3fb1b={'agent':{},'channel':_0x5837('0x78')};if(_0x3cffab['body']['id']){delete _0x3cffab[_0x5837('0x57')]['id'];}_0x3cffab[_0x5837('0x57')][_0x5837('0x5e')]=_0x3cffab[_0x5837('0x57')][_0x5837('0x5e')]||_0x3cffab[_0x5837('0x5f')]['id'];_0xc3fb1b['agent']['id']=_0x3cffab[_0x5837('0x57')][_0x5837('0x5e')];return db[_0x5837('0x54')][_0x5837('0x58')]({'where':{'id':_0x3cffab['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x25b208,null))['then'](function(_0x390aa5){if(_0x390aa5){_0xc3fb1b[_0x5837('0x26')]=_0x390aa5[_0x5837('0x64')]({'plain':!![]});return db[_0x5837('0x61')][_0x5837('0x58')]({'where':{'id':_0x390aa5['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x25b208,null))[_0x5837('0x34')](function(_0x2c8ec9){if(_0x2c8ec9){_0xc3fb1b[_0x5837('0x67')]=_0x2c8ec9[_0x5837('0x64')]({'plain':!![]});interaction_log[_0x5837('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3cffab[_0x5837('0x5f')]['id'],_0x3cffab['user'][_0x5837('0x40')],_0x3cffab['user'][_0x5837('0x66')],_0xc3fb1b[_0x5837('0x67')]['id'],_0x3cffab['body']?JSON[_0x5837('0x22')](_0x3cffab[_0x5837('0x57')]):'null');return respondWithRpcPromise(_0x5837('0x79'),_0x5837('0x7a'),_0xc3fb1b);}return null;})[_0x5837('0x34')](function(_0x4757d5){var _0x5de2a9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4757d5['message'][_0x5837('0x6a')];return db[_0x5837('0x7b')][_0x5837('0x42')](_0x5de2a9,{'type':db[_0x5837('0x6b')][_0x5837('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x30da54){return _0x30da54;});})[_0x5837('0x34')](function(_0x51a39c){if(_0x51a39c){_0xc3fb1b[_0x5837('0x26')][_0x5837('0x6e')]=_0x51a39c[0x0];if(!_0x3cffab[_0x5837('0x57')][_0x5837('0x5e')])return;return db['User'][_0x5837('0x58')]({'where':{'id':_0x3cffab[_0x5837('0x57')][_0x5837('0x5e')],'role':'agent'},'attributes':['id','name',_0x5837('0x70'),_0x5837('0x71'),'internal'],'raw':!![]});}return null;})[_0x5837('0x34')](function(_0x3fe320){if(!_0x3fe320)return null;_0xc3fb1b[_0x5837('0x26')]['agent']=_0x3fe320;return _0xc3fb1b;})['then'](function(_0x5b3917){if(_0x5b3917){_0x5b3917[_0x5837('0x26')]['interface']=util['format'](_0x5837('0x7c'),_0x3cffab[_0x5837('0x5f')][_0x5837('0x40')]);_0x5b3917[_0x5837('0x26')][_0x5837('0x73')]=_0xc3fb1b[_0x5837('0x73')];_0x5b3917[_0x5837('0x26')][_0x5837('0x74')]=_0xc3fb1b[_0x5837('0x73')];_0x5b3917[_0x5837('0x26')][_0x5837('0x75')]='reject';respondWithRpcPromise(_0x5837('0x7d'),_0x5837('0x7d'),{'event':_0x5837('0x7e'),'message':_0x5b3917[_0x5837('0x26')]},client9002);return _0xc3fb1b;}return null;})['then'](respondWithResult(_0x25b208,null))[_0x5837('0x28')](handleError(_0x25b208,null));};exports['create']=function(_0xf61015,_0x38a3de){var _0x43dc62;return db[_0x5837('0x54')][_0x5837('0x7f')](_0xf61015[_0x5837('0x57')],{})[_0x5837('0x34')](function(_0x1d6036){_0x43dc62=_0x1d6036;return db[_0x5837('0x80')][_0x5837('0x81')]({'where':{'id':_0x43dc62[_0x5837('0x6a')]}});})[_0x5837('0x34')](function(_0x2b57f3){if(_['isNil'](_0x2b57f3)){return;}else{_0x43dc62['fax']=_0x2b57f3[_0x5837('0x78')];return db['Attachment']['findOne']({'where':{'id':_0x43dc62[_0x5837('0x82')]}});}})[_0x5837('0x34')](function(_0x5056ae){return respondWithRpcPromise(_0x5837('0x83'),_0x5837('0x83'),{'FaxAccountId':_['isNil'](_0xf61015['body'])?undefined:_0xf61015[_0x5837('0x57')]['FaxAccountId'],'path':_[_0x5837('0x84')](_0x5056ae)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x5056ae[_0x5837('0x85')]),'fax':_[_0x5837('0x84')](_0x43dc62[_0x5837('0x78')])?undefined:_0x43dc62[_0x5837('0x78')],'AttachmentId':_0x43dc62[_0x5837('0x82')]},client9002);})[_0x5837('0x34')](respondWithResult(_0x38a3de,0xc9))[_0x5837('0x28')](handleError(_0x38a3de,null));};exports[_0x5837('0x86')]=function(_0x592fe2,_0x207c39){var _0x2018a7=path[_0x5837('0x87')](config[_0x5837('0x88')],_0x5837('0x89'),_0x5837('0x8a'),_0x5837('0x8b'));return db[_0x5837('0x54')][_0x5837('0x58')]({'where':{'id':_0x592fe2[_0x5837('0x59')]['id']},'include':[{'model':db[_0x5837('0x8c')],'as':_0x5837('0x8c')}]})[_0x5837('0x34')](handleEntityNotFound(_0x207c39,null))[_0x5837('0x34')](function(_0x33db44){if(_0x33db44){return _0x207c39[_0x5837('0x86')](path['join'](_0x2018a7,_0x33db44['Attachment'][_0x5837('0x85')]));}})[_0x5837('0x28')](handleError(_0x207c39,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8ce6505..7ac00af 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 _0xe558=['hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x9a1f73,_0x395364){var _0x52b72c=function(_0x37c2f9){while(--_0x37c2f9){_0x9a1f73['push'](_0x9a1f73['shift']());}};_0x52b72c(++_0x395364);}(_0xe558,0x70));var _0x8e55=function(_0x48e455,_0x3fc0e0){_0x48e455=_0x48e455-0x0;var _0x3d32e8=_0xe558[_0x48e455];return _0x3d32e8;};'use strict';var EventEmitter=require(_0x8e55('0x0'));var FaxMessage=require(_0x8e55('0x1'))['db'][_0x8e55('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8e55('0x3')](0x0);var events={'afterCreate':_0x8e55('0x4'),'afterUpdate':_0x8e55('0x5'),'afterDestroy':_0x8e55('0x6')};function emitEvent(_0x3a5285){return function(_0x28c870,_0x5bc807,_0xf125cc){FaxMessageEvents[_0x8e55('0x7')](_0x3a5285+':'+_0x28c870['id'],_0x28c870);FaxMessageEvents[_0x8e55('0x7')](_0x3a5285,_0x28c870);_0xf125cc(null);};}for(var e in events){if(events[_0x8e55('0x8')](e)){var event=events[e];FaxMessage[_0x8e55('0x9')](e,emitEvent(event));}}module[_0x8e55('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x002d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','update','remove'];(function(_0x26a981,_0x4f6a76){var _0x5a9ce6=function(_0x416206){while(--_0x416206){_0x26a981['push'](_0x26a981['shift']());}};_0x5a9ce6(++_0x4f6a76);}(_0x002d,0xca));var _0xd002=function(_0x10359c,_0xb2080a){_0x10359c=_0x10359c-0x0;var _0x17208a=_0x002d[_0x10359c];return _0x17208a;};'use strict';var EventEmitter=require(_0xd002('0x0'));var FaxMessage=require(_0xd002('0x1'))['db'][_0xd002('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd002('0x3'),'afterDestroy':_0xd002('0x4')};function emitEvent(_0x1c0d0a){return function(_0x24ff42,_0x1323f0,_0x179915){FaxMessageEvents[_0xd002('0x5')](_0x1c0d0a+':'+_0x24ff42['id'],_0x24ff42);FaxMessageEvents[_0xd002('0x5')](_0x1c0d0a,_0x24ff42);_0x179915(null);};}for(var e in events){if(events[_0xd002('0x6')](e)){var event=events[e];FaxMessage[_0xd002('0x7')](e,emitEvent(event));}}module[_0xd002('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 b1e921c..445d610 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 _0x702f=['then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId'];(function(_0x3bd703,_0x5b6838){var _0x548fa5=function(_0x634714){while(--_0x634714){_0x3bd703['push'](_0x3bd703['shift']());}};_0x548fa5(++_0x5b6838);}(_0x702f,0x75));var _0xf702=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x702f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf702('0x0'));var util=require(_0xf702('0x1'));var logger=require(_0xf702('0x2'))(_0xf702('0x3'));var moment=require('moment');var BPromise=require(_0xf702('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf702('0x5'));var rimraf=require(_0xf702('0x6'));var config=require(_0xf702('0x7'));var attributes=require(_0xf702('0x8'));module[_0xf702('0x9')]=function(_0x2b4aaf,_0x474ee8){return _0x2b4aaf[_0xf702('0xa')](_0xf702('0xb'),attributes,{'tableName':_0xf702('0xc'),'paranoid':![],'indexes':[{'name':_0xf702('0xd'),'fields':[_0xf702('0xe')],'type':_0xf702('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5587ab,_0x227a37,_0x41cb18){var _0x59e371=_0x2b4aaf[_0xf702('0x10')];var _0x15cc55=_0x5587ab[_0xf702('0x11')]({'plain':!![]});if(_0x15cc55[_0xf702('0x12')][_0xf702('0x13')]()==='in'||_0x15cc55[_0xf702('0x12')][_0xf702('0x13')]()===_0xf702('0x14')&&!_0x15cc55[_0xf702('0x15')]&&!_['isNil'](_0x15cc55[_0xf702('0x16')])){_0x59e371['FaxInteraction']['findOne']({'where':{'id':_0x15cc55['FaxInteractionId']}})[_0xf702('0x17')](function(_0xc66be7){if(_0xc66be7){_0xc66be7['update']({'lastMsgAt':_0x15cc55[_0xf702('0x18')],'lastMsgDirection':_0x15cc55[_0xf702('0x12')]['toLowerCase']()});}})[_0xf702('0x19')](function(_0x32fb3c){console[_0xf702('0x1a')](_0x32fb3c);});}_0x41cb18();}},'charset':_0xf702('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x065e=['define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','api','moment','request-promise','path','../../config/environment','./faxMessage.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x065e,0x1d4));var _0xe065=function(_0x2b157c,_0x5cf335){_0x2b157c=_0x2b157c-0x0;var _0x2d8d43=_0x065e[_0x2b157c];return _0x2d8d43;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe065('0x0'));var moment=require(_0xe065('0x1'));var BPromise=require('bluebird');var rp=require(_0xe065('0x2'));var fs=require('fs');var path=require(_0xe065('0x3'));var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module[_0xe065('0x6')]=function(_0x19a3e9,_0x2f7f46){return _0x19a3e9[_0xe065('0x7')](_0xe065('0x8'),attributes,{'tableName':_0xe065('0x9'),'paranoid':![],'indexes':[{'name':_0xe065('0xa'),'fields':['body'],'type':_0xe065('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c0760,_0x546568,_0x48891c){var _0x1fc641=_0x19a3e9[_0xe065('0xc')];var _0x2c7372=_0x5c0760[_0xe065('0xd')]({'plain':!![]});if(_0x2c7372[_0xe065('0xe')]['toLowerCase']()==='in'||_0x2c7372[_0xe065('0xe')][_0xe065('0xf')]()===_0xe065('0x10')&&!_0x2c7372['secret']&&!_['isNil'](_0x2c7372[_0xe065('0x11')])){_0x1fc641['FaxInteraction'][_0xe065('0x12')]({'where':{'id':_0x2c7372[_0xe065('0x13')]}})[_0xe065('0x14')](function(_0x16b7ad){if(_0x16b7ad){_0x16b7ad[_0xe065('0x15')]({'lastMsgAt':_0x2c7372[_0xe065('0x16')],'lastMsgDirection':_0x2c7372[_0xe065('0xe')][_0xe065('0xf')]()});}})[_0xe065('0x17')](function(_0x10abfb){console['error'](_0x10abfb);});}_0x48891c();}},'charset':'utf8mb4','collate':_0xe065('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5c35505..2353f73 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 _0xe5b3=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','then','info'];(function(_0x3c88e4,_0x2668b3){var _0x360eec=function(_0x4fc490){while(--_0x4fc490){_0x3c88e4['push'](_0x3c88e4['shift']());}};_0x360eec(++_0x2668b3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5c88e3,_0x12138e){_0x5c88e3=_0x5c88e3-0x0;var _0x4a07fd=_0xe5b3[_0x5c88e3];return _0x4a07fd;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});config[_0x3e5b('0xc')]=_['defaults'](config[_0x3e5b('0xc')],{'host':_0x3e5b('0xd'),'port':0x18eb});var socket=require(_0x3e5b('0xe'))(new Redis(config[_0x3e5b('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1fef54,_0x3d3b6e,_0x22fc1a){return new BPromise(function(_0x17dee7,_0xeeaabc){return client['request'](_0x1fef54,_0x22fc1a)[_0x3e5b('0xf')](function(_0x52efbd){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,_0x3e5b('0x12'));logger[_0x3e5b('0x13')](_0x3e5b('0x14'),_0x3d3b6e,_0x3e5b('0x12'),JSON[_0x3e5b('0x15')](_0x52efbd));if(_0x52efbd['error']){if(_0x52efbd[_0x3e5b('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd[_0x3e5b('0x16')][_0x3e5b('0x17')]);return _0xeeaabc(_0x52efbd[_0x3e5b('0x16')]['message']);}logger[_0x3e5b('0x16')]('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd['error'][_0x3e5b('0x17')]);return _0x17dee7(_0x52efbd[_0x3e5b('0x16')]['message']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,'request\x20sent');_0x17dee7(_0x52efbd[_0x3e5b('0x18')][_0x3e5b('0x17')]);}})['catch'](function(_0x4b189d){logger[_0x3e5b('0x16')](_0x3e5b('0x11'),_0x3d3b6e,_0x4b189d);_0xeeaabc(_0x4b189d);});});}exports[_0x3e5b('0x19')]=function(_0xff4aba){var _0x24de5b=this;return new Promise(function(_0x1564b5,_0x447d36){return db[_0x3e5b('0x1a')][_0x3e5b('0x1b')](_0xff4aba[_0x3e5b('0x1c')],{'raw':_0xff4aba[_0x3e5b('0x1d')]?_0xff4aba[_0x3e5b('0x1d')][_0x3e5b('0x1e')]===undefined?!![]:![]:!![]})[_0x3e5b('0xf')](function(_0x5b46d4){logger[_0x3e5b('0x10')](_0x3e5b('0x19'),_0xff4aba);logger[_0x3e5b('0x13')](_0x3e5b('0x19'),_0xff4aba,JSON['stringify'](_0x5b46d4));_0x1564b5(_0x5b46d4);})[_0x3e5b('0x1f')](function(_0x5b33bb){logger[_0x3e5b('0x16')](_0x3e5b('0x19'),_0x5b33bb['message'],_0xff4aba);_0x447d36(_0x24de5b[_0x3e5b('0x16')](0x1f4,_0x5b33bb[_0x3e5b('0x17')]));});});};exports[_0x3e5b('0x20')]=function(_0x3c8965){var _0x3bb749=this;return new Promise(function(_0x26c7f2,_0x160e87){return db[_0x3e5b('0x1a')]['update'](_0x3c8965[_0x3e5b('0x1c')],{'raw':_0x3c8965['options']?_0x3c8965[_0x3e5b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x21')]||null:null,'attributes':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x22')]||null:null,'limit':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x23')]||null:null})[_0x3e5b('0xf')](function(_0x1e1565){logger['info'](_0x3e5b('0x20'),_0x3c8965);logger[_0x3e5b('0x13')](_0x3e5b('0x20'),_0x3c8965,JSON[_0x3e5b('0x15')](_0x1e1565));_0x26c7f2(_0x1e1565);})[_0x3e5b('0x1f')](function(_0x31e9f9){logger[_0x3e5b('0x16')]('UpdateFaxMessage',_0x31e9f9[_0x3e5b('0x17')],_0x3c8965);_0x160e87(_0x3bb749['error'](0x1f4,_0x31e9f9['message']));});});}; \ No newline at end of file +var _0x2d17=['create','catch','UpdateFaxMessage','FaxMessage','body','options','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxMessage'];(function(_0x5c5268,_0x1aa5d9){var _0x532504=function(_0x413405){while(--_0x413405){_0x5c5268['push'](_0x5c5268['shift']());}};_0x532504(++_0x1aa5d9);}(_0x2d17,0x17e));var _0x72d1=function(_0x22dee7,_0x208649){_0x22dee7=_0x22dee7-0x0;var _0x8743c1=_0x2d17[_0x22dee7];return _0x8743c1;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});config[_0x72d1('0x9')]=_['defaults'](config[_0x72d1('0x9')],{'host':_0x72d1('0xa'),'port':0x18eb});var socket=require(_0x72d1('0xb'))(new Redis(config['redis']));require(_0x72d1('0xc'))[_0x72d1('0xd')](socket);function respondWithRpcPromise(_0x283775,_0x593c91,_0x1d7520){return new BPromise(function(_0x3a35c6,_0x45eb4a){return client[_0x72d1('0xe')](_0x283775,_0x1d7520)[_0x72d1('0xf')](function(_0x3916f2){logger[_0x72d1('0x10')](_0x72d1('0x11'),_0x593c91,_0x72d1('0x12'));logger[_0x72d1('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'),JSON[_0x72d1('0x14')](_0x3916f2));if(_0x3916f2[_0x72d1('0x15')]){if(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x16')]===0x1f4){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);return _0x45eb4a(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);}logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2['error'][_0x72d1('0x17')]);return _0x3a35c6(_0x3916f2['error'][_0x72d1('0x17')]);}else{logger[_0x72d1('0x10')]('FaxMessage,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'));_0x3a35c6(_0x3916f2[_0x72d1('0x18')][_0x72d1('0x17')]);}})['catch'](function(_0x4925f6){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x4925f6);_0x45eb4a(_0x4925f6);});});}exports[_0x72d1('0x19')]=function(_0x1865c1){var _0x8d6890=this;return new Promise(function(_0x2253fd,_0x1e2411){return db['FaxMessage'][_0x72d1('0x1a')](_0x1865c1['body'],{'raw':_0x1865c1['options']?_0x1865c1['options']['raw']===undefined?!![]:![]:!![]})[_0x72d1('0xf')](function(_0x374602){logger['info'](_0x72d1('0x19'),_0x1865c1);logger[_0x72d1('0x13')](_0x72d1('0x19'),_0x1865c1,JSON[_0x72d1('0x14')](_0x374602));_0x2253fd(_0x374602);})[_0x72d1('0x1b')](function(_0x4e6acd){logger['error'](_0x72d1('0x19'),_0x4e6acd[_0x72d1('0x17')],_0x1865c1);_0x1e2411(_0x8d6890[_0x72d1('0x15')](0x1f4,_0x4e6acd[_0x72d1('0x17')]));});});};exports[_0x72d1('0x1c')]=function(_0x33d530){var _0x163bec=this;return new Promise(function(_0x589f7c,_0x57ec9e){return db[_0x72d1('0x1d')]['update'](_0x33d530[_0x72d1('0x1e')],{'raw':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d530[_0x72d1('0x1f')]?_0x33d530['options'][_0x72d1('0x20')]||null:null,'attributes':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')][_0x72d1('0x21')]||null:null,'limit':_0x33d530['options']?_0x33d530[_0x72d1('0x1f')]['limit']||null:null})[_0x72d1('0xf')](function(_0x32dc5e){logger['info'](_0x72d1('0x1c'),_0x33d530);logger[_0x72d1('0x13')](_0x72d1('0x1c'),_0x33d530,JSON[_0x72d1('0x14')](_0x32dc5e));_0x589f7c(_0x32dc5e);})[_0x72d1('0x1b')](function(_0x52511f){logger[_0x72d1('0x15')](_0x72d1('0x1c'),_0x52511f[_0x72d1('0x17')],_0x33d530);_0x57ec9e(_0x163bec['error'](0x1f4,_0x52511f[_0x72d1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7c06fbf..2986ea4 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 _0x9b91=['update','emit','removeListener','register','length','faxMessage:','save','remove'];(function(_0x4fc702,_0x30dde6){var _0x4857cb=function(_0x1711d5){while(--_0x1711d5){_0x4fc702['push'](_0x4fc702['shift']());}};_0x4857cb(++_0x30dde6);}(_0x9b91,0x1d6));var _0x19b9=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0x9b91[_0x1be3b3];return _0x4f8b2d;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x19b9('0x0'),_0x19b9('0x1'),_0x19b9('0x2')];function createListener(_0x34f2ed,_0x537adb){return function(_0xe0b808){_0x537adb[_0x19b9('0x3')](_0x34f2ed,_0xe0b808);};}function removeListener(_0x40bf61,_0x301097){return function(){FaxMessageEvents[_0x19b9('0x4')](_0x40bf61,_0x301097);};}exports[_0x19b9('0x5')]=function(_0x36b536){for(var _0x407e9b=0x0,_0x39ab7e=events[_0x19b9('0x6')];_0x407e9b<_0x39ab7e;_0x407e9b++){var _0x2bfcb8=events[_0x407e9b];var _0x23cc89=createListener(_0x19b9('0x7')+_0x2bfcb8,_0x36b536);FaxMessageEvents['on'](_0x2bfcb8,_0x23cc89);}}; \ No newline at end of file +var _0x7ea7=['emit','removeListener','register','length','faxMessage:','remove','update'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x7ea7,0x1d3));var _0x77ea=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x7ea7[_0x4fb1b8];return _0x146c71;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x77ea('0x0'),_0x77ea('0x1')];function createListener(_0x53ce00,_0x5e0a09){return function(_0xa568d5){_0x5e0a09[_0x77ea('0x2')](_0x53ce00,_0xa568d5);};}function removeListener(_0x523c69,_0x16e8a8){return function(){FaxMessageEvents[_0x77ea('0x3')](_0x523c69,_0x16e8a8);};}exports[_0x77ea('0x4')]=function(_0x57a9a4){for(var _0x510c4a=0x0,_0x4fe79f=events[_0x77ea('0x5')];_0x510c4a<_0x4fe79f;_0x510c4a++){var _0x52cb5f=events[_0x510c4a];var _0x2a6dc0=createListener(_0x77ea('0x6')+_0x52cb5f,_0x57a9a4);FaxMessageEvents['on'](_0x52cb5f,_0x2a6dc0);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 4470197..090eca0 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 _0xbdb7=['accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','index','get','describe','show','/:id/download','isAuthenticated','download','post','tracked','put','/:id','update'];(function(_0xf27762,_0x2288fd){var _0x997b2e=function(_0x492932){while(--_0x492932){_0xf27762['push'](_0xf27762['shift']());}};_0x997b2e(++_0x2288fd);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x26a74d,_0x37ecfc){_0x26a74d=_0x26a74d-0x0;var _0xcbb1a3=_0xbdb7[_0x26a74d];return _0xcbb1a3;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')]('/',auth[_0x7bdb('0xf')](),interaction[_0x7bdb('0x12')]('fax','faxmessage:create'),controller['create']);router[_0x7bdb('0x13')](_0x7bdb('0x14'),auth['isAuthenticated'](),controller[_0x7bdb('0x15')]);router['put']('/:id/accept',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')](_0x7bdb('0x14'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x19')]);module[_0x7bdb('0x1a')]=router; \ No newline at end of file +var _0x0102=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','exports','util','path','connect-timeout','express','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x0102,0x186));var _0x2010=function(_0x68f26b,_0x1b8049){_0x68f26b=_0x68f26b-0x0;var _0x2c86d8=_0x0102[_0x68f26b];return _0x2c86d8;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('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('../../config/environment');var controller=require(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),interaction[_0x2010('0xe')](_0x2010('0xf'),_0x2010('0x10')),controller[_0x2010('0x11')]);router[_0x2010('0x12')](_0x2010('0x13'),auth[_0x2010('0x6')](),controller[_0x2010('0x14')]);router['put']('/:id/accept',auth[_0x2010('0x6')](),controller[_0x2010('0x15')]);router[_0x2010('0x12')](_0x2010('0x16'),auth[_0x2010('0x6')](),controller[_0x2010('0x17')]);router['delete'](_0x2010('0x13'),auth[_0x2010('0x6')](),controller['destroy']);module[_0x2010('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 e74482e..895392c 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 _0x21ab=['exports','name','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x408fe9,_0x52ad78){var _0x2475b7=function(_0x781f0f){while(--_0x781f0f){_0x408fe9['push'](_0x408fe9['shift']());}};_0x2475b7(++_0x52ad78);}(_0x21ab,0x16c));var _0xb21a=function(_0x299559,_0x27e064){_0x299559=_0x299559-0x0;var _0x526031=_0x21ab[_0x299559];return _0x526031;};'use strict';var Sequelize=require('sequelize');module[_0xb21a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb21a('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb21a('0x2')]},'timeout':{'type':Sequelize[_0xb21a('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb21a('0x4'),_0xb21a('0x5'),_0xb21a('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb21a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8893=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x73dcd,_0x482364){var _0x4949fa=function(_0x593f20){while(--_0x593f20){_0x73dcd['push'](_0x73dcd['shift']());}};_0x4949fa(++_0x482364);}(_0x8893,0x1ae));var _0x3889=function(_0x467164,_0x75d1a5){_0x467164=_0x467164-0x0;var _0x1c31c9=_0x8893[_0x467164];return _0x1c31c9;};'use strict';var Sequelize=require('sequelize');module[_0x3889('0x0')]={'name':{'type':Sequelize[_0x3889('0x1')],'unique':_0x3889('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3889('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3889('0x4')](_0x3889('0x5'),_0x3889('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3889('0x3')],'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 3fb267c..db81b08 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 _0x573d=['./faxQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','FaxQueue','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','catch','show','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','FaxQueueId','map','User','UserId','faxPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','each','UserFaxQueue','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x32835c,_0x422737){var _0x15b9bc=function(_0x41d6b5){while(--_0x41d6b5){_0x32835c['push'](_0x32835c['shift']());}};_0x15b9bc(++_0x422737);}(_0x573d,0x189));var _0xd573=function(_0x35b5b3,_0x439f57){_0x35b5b3=_0x35b5b3-0x0;var _0x1adc49=_0x573d[_0x35b5b3];return _0x1adc49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd573('0x0'));var zipdir=require(_0xd573('0x1'));var jsonpatch=require(_0xd573('0x2'));var rp=require('request-promise');var moment=require(_0xd573('0x3'));var BPromise=require(_0xd573('0x4'));var Mustache=require(_0xd573('0x5'));var util=require(_0xd573('0x6'));var path=require(_0xd573('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd573('0x8'));var fs=require('fs');var fs_extra=require(_0xd573('0x9'));var _=require(_0xd573('0xa'));var squel=require(_0xd573('0xb'));var crypto=require(_0xd573('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd573('0xd'));var toCsv=require(_0xd573('0xe'));var querystring=require(_0xd573('0xf'));var Papa=require('papaparse');var Redis=require(_0xd573('0x10'));var authService=require(_0xd573('0x11'));var qs=require(_0xd573('0x12'));var as=require(_0xd573('0x13'));var hardwareService=require(_0xd573('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd573('0x15'));var config=require(_0xd573('0x16'));var licenseUtil=require(_0xd573('0x17'));var db=require('../../mysqldb')['db'];config[_0xd573('0x18')]=_[_0xd573('0x19')](config[_0xd573('0x18')],{'host':_0xd573('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd573('0x18')]));require(_0xd573('0x1b'))[_0xd573('0x1c')](socket);function respondWithStatusCode(_0x53a61a,_0x207c89){_0x207c89=_0x207c89||0xcc;return function(_0x16aaf8){if(_0x16aaf8){return _0x53a61a[_0xd573('0x1d')](_0x207c89);}return _0x53a61a['status'](_0x207c89)[_0xd573('0x1e')]();};}function respondWithResult(_0x1f2ae2,_0x3fe75e){_0x3fe75e=_0x3fe75e||0xc8;return function(_0xfbd5b6){if(_0xfbd5b6){return _0x1f2ae2[_0xd573('0x1f')](_0x3fe75e)[_0xd573('0x20')](_0xfbd5b6);}};}function respondWithFilteredResult(_0x3bdf63,_0x3baca6){return function(_0x5cc947){if(_0x5cc947){var _0x2d2aaf=typeof _0x3baca6[_0xd573('0x21')]===_0xd573('0x22')&&typeof _0x3baca6[_0xd573('0x23')]===_0xd573('0x22');var _0x35c33c=_0x5cc947[_0xd573('0x24')];var _0x46d9c9=_0x2d2aaf?0x0:_0x3baca6['offset'];var _0x54cf2b=_0x2d2aaf?_0x5cc947['count']:_0x3baca6[_0xd573('0x21')]+_0x3baca6[_0xd573('0x23')];var _0x16e2af;if(_0x54cf2b>=_0x35c33c){_0x54cf2b=_0x35c33c;_0x16e2af=0xc8;}else{_0x16e2af=0xce;}_0x3bdf63[_0xd573('0x1f')](_0x16e2af);return _0x3bdf63['set'](_0xd573('0x25'),_0x46d9c9+'-'+_0x54cf2b+'/'+_0x35c33c)[_0xd573('0x20')](_0x5cc947);}return null;};}function patchUpdates(_0xab29e6){return function(_0xdb4b69){try{jsonpatch[_0xd573('0x26')](_0xdb4b69,_0xab29e6,!![]);}catch(_0x4ca360){return BPromise[_0xd573('0x27')](_0x4ca360);}return _0xdb4b69['save']();};}function saveUpdates(_0x125a08,_0x4ea49d){return function(_0x26e75f){if(_0x26e75f){return _0x26e75f[_0xd573('0x28')](_0x125a08)[_0xd573('0x29')](function(_0x450469){return _0x450469;});}return null;};}function removeEntity(_0x3b2f3f,_0x56d76f){return function(_0x810fbb){if(_0x810fbb){return _0x810fbb[_0xd573('0x2a')]()[_0xd573('0x29')](function(){var _0x32bc1a=_0x810fbb[_0xd573('0x2b')]({'plain':!![]});var _0x66204a='FaxQueues';return db[_0xd573('0x2c')][_0xd573('0x2a')]({'where':{'type':_0x66204a,'resourceId':_0x32bc1a['id']}})[_0xd573('0x29')](function(){return _0x810fbb;});})[_0xd573('0x29')](function(){_0x3b2f3f[_0xd573('0x1f')](0xcc)[_0xd573('0x1e')]();});}};}function handleEntityNotFound(_0x4e6bf0,_0x13a239){return function(_0x249fa1){if(!_0x249fa1){_0x4e6bf0['sendStatus'](0x194);}return _0x249fa1;};}function handleError(_0x47d88b,_0x47837e){_0x47837e=_0x47837e||0x1f4;return function(_0x635f44){logger[_0xd573('0x2d')](_0x635f44[_0xd573('0x2e')]);if(_0x635f44[_0xd573('0x2f')]){delete _0x635f44['name'];}_0x47d88b[_0xd573('0x1f')](_0x47837e)[_0xd573('0x30')](_0x635f44);};}exports['index']=function(_0x5b5e0f,_0x1a71e5){var _0x330593={},_0x2cc66e={},_0x53fbee={'count':0x0,'rows':[]};var _0x5e9f1a=_['map'](db[_0xd573('0x31')][_0xd573('0x32')],function(_0x200081){return{'name':_0x200081['fieldName'],'type':_0x200081[_0xd573('0x33')]['key']};});_0x2cc66e['model']=_['map'](_0x5e9f1a,_0xd573('0x2f'));_0x2cc66e[_0xd573('0x34')]=_[_0xd573('0x35')](_0x5b5e0f[_0xd573('0x34')]);_0x2cc66e[_0xd573('0x36')]=_[_0xd573('0x37')](_0x2cc66e[_0xd573('0x38')],_0x2cc66e['query']);_0x330593['attributes']=_['intersection'](_0x2cc66e[_0xd573('0x38')],qs['fields'](_0x5b5e0f['query'][_0xd573('0x39')]));_0x330593[_0xd573('0x3a')]=_0x330593['attributes'][_0xd573('0x3b')]?_0x330593[_0xd573('0x3a')]:_0x2cc66e[_0xd573('0x38')];if(!_0x5b5e0f[_0xd573('0x34')][_0xd573('0x3c')](_0xd573('0x3d'))){_0x330593['limit']=qs[_0xd573('0x23')](_0x5b5e0f[_0xd573('0x34')][_0xd573('0x23')]);_0x330593[_0xd573('0x21')]=qs['offset'](_0x5b5e0f[_0xd573('0x34')][_0xd573('0x21')]);}_0x330593[_0xd573('0x3e')]=qs[_0xd573('0x3f')](_0x5b5e0f[_0xd573('0x34')][_0xd573('0x3f')]);_0x330593[_0xd573('0x40')]=qs[_0xd573('0x36')](_['pick'](_0x5b5e0f[_0xd573('0x34')],_0x2cc66e['filters']),_0x5e9f1a);if(_0x5b5e0f['query'][_0xd573('0x41')]){_0x330593['where']=_['merge'](_0x330593[_0xd573('0x40')],{'$or':_['map'](_0x5e9f1a,function(_0x5b9696){if(_0x5b9696[_0xd573('0x33')]!=='VIRTUAL'){var _0x4b7f05={};_0x4b7f05[_0x5b9696[_0xd573('0x2f')]]={'$like':'%'+_0x5b5e0f[_0xd573('0x34')][_0xd573('0x41')]+'%'};return _0x4b7f05;}})});}_0x330593=_['merge']({},_0x330593,_0x5b5e0f[_0xd573('0x42')]);var _0x593ae6={'where':_0x330593[_0xd573('0x40')]};return db[_0xd573('0x31')][_0xd573('0x24')](_0x593ae6)[_0xd573('0x29')](function(_0x33b583){_0x53fbee['count']=_0x33b583;if(_0x5b5e0f[_0xd573('0x34')][_0xd573('0x43')]){_0x330593[_0xd573('0x44')]=[{'all':!![]}];}return db[_0xd573('0x31')][_0xd573('0x45')](_0x330593);})[_0xd573('0x29')](function(_0x8b0a06){_0x53fbee['rows']=_0x8b0a06;return _0x53fbee;})[_0xd573('0x29')](respondWithFilteredResult(_0x1a71e5,_0x330593))[_0xd573('0x46')](handleError(_0x1a71e5,null));};exports[_0xd573('0x47')]=function(_0x46d9e0,_0x4b92cf){var _0x2a6793={'raw':!![],'where':{'id':_0x46d9e0[_0xd573('0x48')]['id']}},_0xabf71f={};_0xabf71f[_0xd573('0x38')]=_['keys'](db[_0xd573('0x31')]['rawAttributes']);_0xabf71f[_0xd573('0x34')]=_[_0xd573('0x35')](_0x46d9e0[_0xd573('0x34')]);_0xabf71f[_0xd573('0x36')]=_[_0xd573('0x37')](_0xabf71f[_0xd573('0x38')],_0xabf71f['query']);_0x2a6793[_0xd573('0x3a')]=_[_0xd573('0x37')](_0xabf71f[_0xd573('0x38')],qs['fields'](_0x46d9e0['query'][_0xd573('0x39')]));_0x2a6793[_0xd573('0x3a')]=_0x2a6793[_0xd573('0x3a')][_0xd573('0x3b')]?_0x2a6793['attributes']:_0xabf71f[_0xd573('0x38')];if(_0x46d9e0['query'][_0xd573('0x43')]){_0x2a6793[_0xd573('0x44')]=[{'all':!![]}];}_0x2a6793=_[_0xd573('0x49')]({},_0x2a6793,_0x46d9e0[_0xd573('0x42')]);return db[_0xd573('0x31')]['find'](_0x2a6793)[_0xd573('0x29')](handleEntityNotFound(_0x4b92cf,null))[_0xd573('0x29')](respondWithResult(_0x4b92cf,null))[_0xd573('0x46')](handleError(_0x4b92cf,null));};exports['create']=function(_0x250661,_0x574c9f){return db[_0xd573('0x31')][_0xd573('0x4a')](_0x250661[_0xd573('0x4b')],{})[_0xd573('0x29')](function(_0x34b9c8){var _0x1418bb=_0x250661[_0xd573('0x4c')][_0xd573('0x2b')]({'plain':!![]});if(!_0x1418bb)throw new Error(_0xd573('0x4d'));if(_0x1418bb[_0xd573('0x4e')]===_0xd573('0x4c')){var _0x23ac5f=_0x34b9c8[_0xd573('0x2b')]({'plain':!![]});var _0x1f0138=_0xd573('0x4f');return db[_0xd573('0x50')][_0xd573('0x51')]({'where':{'name':_0x1f0138,'userProfileId':_0x1418bb[_0xd573('0x52')]},'raw':!![]})[_0xd573('0x29')](function(_0xc5634c){if(_0xc5634c&&_0xc5634c['autoAssociation']===0x0){return db[_0xd573('0x2c')][_0xd573('0x4a')]({'name':_0x23ac5f[_0xd573('0x2f')],'resourceId':_0x23ac5f['id'],'type':_0xc5634c[_0xd573('0x2f')],'sectionId':_0xc5634c['id']},{})['then'](function(){return _0x34b9c8;});}else{return _0x34b9c8;}})[_0xd573('0x46')](function(_0x49207e){logger[_0xd573('0x2d')](_0xd573('0x53'),_0x49207e);throw _0x49207e;});}return _0x34b9c8;})[_0xd573('0x29')](respondWithResult(_0x574c9f,0xc9))[_0xd573('0x46')](handleError(_0x574c9f,null));};exports['update']=function(_0x209ffe,_0x1f9b95){if(_0x209ffe[_0xd573('0x4b')]['id']){delete _0x209ffe[_0xd573('0x4b')]['id'];}return db[_0xd573('0x31')][_0xd573('0x51')]({'where':{'id':_0x209ffe[_0xd573('0x48')]['id']}})[_0xd573('0x29')](handleEntityNotFound(_0x1f9b95,null))[_0xd573('0x29')](saveUpdates(_0x209ffe[_0xd573('0x4b')],null))[_0xd573('0x29')](respondWithResult(_0x1f9b95,null))['catch'](handleError(_0x1f9b95,null));};exports[_0xd573('0x2a')]=function(_0x5b3f07,_0x31dedf){return db[_0xd573('0x31')]['find']({'where':{'id':_0x5b3f07['params']['id']}})[_0xd573('0x29')](handleEntityNotFound(_0x31dedf,null))[_0xd573('0x29')](removeEntity(_0x31dedf,null))['catch'](handleError(_0x31dedf,null));};exports['describe']=function(_0x508c7f,_0x72e44a){return db[_0xd573('0x31')][_0xd573('0x54')]()[_0xd573('0x29')](respondWithResult(_0x72e44a,null))['catch'](handleError(_0x72e44a,null));};exports[_0xd573('0x55')]=function(_0x56980e,_0x2d9d39,_0x3b43ba){var _0x4b781e={'raw':!![],'where':{}},_0x5d1bba={},_0x5acd29;return db[_0xd573('0x31')][_0xd573('0x56')]({'where':{'id':_0x56980e[_0xd573('0x48')]['id']}})[_0xd573('0x29')](handleEntityNotFound(_0x2d9d39,null))['then'](function(_0x511c89){if(_0x511c89){_0x5acd29=_0x511c89[_0xd573('0x2b')]({'plain':!![]});_0x5d1bba[_0xd573('0x38')]=_[_0xd573('0x35')](db['UserFaxQueue'][_0xd573('0x32')]);_0x5d1bba[_0xd573('0x34')]=_['keys'](_0x56980e['query']);_0x5d1bba[_0xd573('0x36')]=_[_0xd573('0x37')](_0x5d1bba[_0xd573('0x38')],_0x5d1bba[_0xd573('0x34')]);_0x4b781e['attributes']=_[_0xd573('0x37')](_0x5d1bba[_0xd573('0x38')],qs[_0xd573('0x39')](_0x56980e[_0xd573('0x34')]['fields']));_0x4b781e[_0xd573('0x3a')]=_0x4b781e[_0xd573('0x3a')][_0xd573('0x3b')]?_0x4b781e['attributes']:_0x5d1bba[_0xd573('0x38')];if(!_0x56980e[_0xd573('0x34')][_0xd573('0x3c')](_0xd573('0x3d'))){_0x4b781e[_0xd573('0x23')]=qs[_0xd573('0x23')](_0x56980e[_0xd573('0x34')]['limit']);_0x4b781e[_0xd573('0x21')]=qs[_0xd573('0x21')](_0x56980e['query']['offset']);}_0x4b781e[_0xd573('0x3e')]=qs[_0xd573('0x3f')](_0x56980e[_0xd573('0x34')][_0xd573('0x3f')]);_0x4b781e[_0xd573('0x40')]=qs[_0xd573('0x36')](_[_0xd573('0x57')](_0x56980e['query'],_0x5d1bba[_0xd573('0x36')]));_0x4b781e['where'][_0xd573('0x58')]=_0x511c89['id'];if(_0x56980e[_0xd573('0x34')][_0xd573('0x41')]){_0x4b781e[_0xd573('0x40')]=_[_0xd573('0x49')](_0x4b781e['where'],{'$or':_[_0xd573('0x59')](_0x4b781e['attributes'],function(_0x3231b4){var _0x490030={};_0x490030[_0x3231b4]={'$like':'%'+_0x56980e['query'][_0xd573('0x41')]+'%'};return _0x490030;})});}_0x4b781e=_[_0xd573('0x49')]({},_0x4b781e,_0x56980e[_0xd573('0x42')]);return db['UserFaxQueue'][_0xd573('0x45')](_0x4b781e);}})[_0xd573('0x29')](function(_0x2d31b2){if(_0x2d31b2){return db[_0xd573('0x5a')]['findAndCountAll']({'where':{'id':_[_0xd573('0x59')](_0x2d31b2,_0xd573('0x5b')),'role':'agent'},'attributes':['id',_0xd573('0x2f'),_0xd573('0x5c'),_0xd573('0x5d'),_0xd573('0x5e')]});}})[_0xd573('0x29')](function(_0x113ea0){if(_0x113ea0){return{'count':_0x113ea0['count'],'rows':_['map'](_0x113ea0[_0xd573('0x5f')],function(_0x116ec2){return{'membername':_0x116ec2['name'],'UserId':_0x116ec2['id'],'queue_name':_0x5acd29[_0xd573('0x2f')],'FaxQueueId':_0x5acd29['id'],'interface':util[_0xd573('0x60')](_0xd573('0x61'),'SIP',_0x116ec2[_0xd573('0x2f')]),'penalty':0x0,'paused':_0x116ec2[_0xd573('0x5c')],'createdAt':_0x116ec2[_0xd573('0x5e')],'updatedAt':_0x116ec2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd573('0x29')](respondWithFilteredResult(_0x2d9d39,_0x4b781e))[_0xd573('0x46')](handleError(_0x2d9d39,null));};exports[_0xd573('0x62')]=function(_0x5b5470,_0x2cb036,_0xea3f02){var _0x39a335={};var _0x1072a2={};var _0xc91c09;var _0x1a79fa;return db[_0xd573('0x31')][_0xd573('0x56')]({'where':{'id':_0x5b5470[_0xd573('0x48')]['id']}})[_0xd573('0x29')](handleEntityNotFound(_0x2cb036,null))[_0xd573('0x29')](function(_0xa4aaa7){if(_0xa4aaa7){_0xc91c09=_0xa4aaa7;_0x1072a2['model']=_[_0xd573('0x35')](db[_0xd573('0x63')][_0xd573('0x32')]);_0x1072a2[_0xd573('0x34')]=_[_0xd573('0x35')](_0x5b5470[_0xd573('0x34')]);_0x1072a2[_0xd573('0x36')]=_[_0xd573('0x37')](_0x1072a2[_0xd573('0x38')],_0x1072a2[_0xd573('0x34')]);_0x39a335['attributes']=_[_0xd573('0x37')](_0x1072a2[_0xd573('0x38')],qs[_0xd573('0x39')](_0x5b5470[_0xd573('0x34')][_0xd573('0x39')]));_0x39a335[_0xd573('0x3a')]=_0x39a335['attributes']['length']?_0x39a335[_0xd573('0x3a')]:_0x1072a2['model'];_0x39a335[_0xd573('0x3e')]=qs[_0xd573('0x3f')](_0x5b5470[_0xd573('0x34')]['sort']);_0x39a335[_0xd573('0x40')]=qs[_0xd573('0x36')](_[_0xd573('0x57')](_0x5b5470[_0xd573('0x34')],_0x1072a2[_0xd573('0x36')]));if(_0x5b5470[_0xd573('0x34')][_0xd573('0x41')]){_0x39a335['where']=_['merge'](_0x39a335[_0xd573('0x40')],{'$or':_['map'](_0x39a335[_0xd573('0x3a')],function(_0x7707ac){var _0x2bfcdb={};_0x2bfcdb[_0x7707ac]={'$like':'%'+_0x5b5470[_0xd573('0x34')][_0xd573('0x41')]+'%'};return _0x2bfcdb;})});}_0x39a335=_[_0xd573('0x49')]({},_0x39a335,_0x5b5470['options']);return _0xc91c09[_0xd573('0x62')](_0x39a335);}})[_0xd573('0x29')](function(_0x1251c0){if(_0x1251c0){_0x1a79fa=_0x1251c0[_0xd573('0x3b')];if(!_0x5b5470[_0xd573('0x34')][_0xd573('0x3c')](_0xd573('0x3d'))){_0x39a335['limit']=qs['limit'](_0x5b5470[_0xd573('0x34')][_0xd573('0x23')]);_0x39a335[_0xd573('0x21')]=qs[_0xd573('0x21')](_0x5b5470['query'][_0xd573('0x21')]);}return _0xc91c09[_0xd573('0x62')](_0x39a335);}})['then'](function(_0x5dc8fa){if(_0x5dc8fa){return _0x5dc8fa?{'count':_0x1a79fa,'rows':_0x5dc8fa}:null;}})['then'](respondWithResult(_0x2cb036,null))[_0xd573('0x46')](handleError(_0x2cb036,null));};exports['addTeams']=function(_0x29f63a,_0x2bbf5a,_0x2090ec){var _0x7df8cf=_0x29f63a[_0xd573('0x4b')][_0xd573('0x64')];return db[_0xd573('0x63')][_0xd573('0x45')]({'where':{'id':_0x7df8cf},'attributes':['id'],'include':[{'model':db[_0xd573('0x5a')],'as':_0xd573('0x65'),'attributes':['id',_0xd573('0x2f'),_0xd573('0x66'),_0xd573('0x67'),_0xd573('0x68')],'raw':!![]}]})[_0xd573('0x29')](function(_0x3fe98b){if(_0x3fe98b){var _0x273f15=_[_0xd573('0x69')](_0x3fe98b,function(_0x47de10){var _0xab92e0=_0x47de10[_0xd573('0x2b')]({'plain':!![]});return _0xab92e0[_0xd573('0x65')];});return db['FaxQueue'][_0xd573('0x51')]({'where':{'id':_0x29f63a[_0xd573('0x48')]['id']}})[_0xd573('0x29')](function(_0x33cb23){return db['sequelize']['transaction'](function(_0x1cb947){return _0x33cb23['addTeams'](_0x7df8cf,{'transaction':_0x1cb947})[_0xd573('0x29')](function(){return BPromise[_0xd573('0x6a')](_0x273f15,function(_0x5288b1){return db[_0xd573('0x6b')][_0xd573('0x6c')]({'where':{'UserId':_0x5288b1['id'],'FaxQueueId':_0x29f63a[_0xd573('0x48')]['id']},'transaction':_0x1cb947});});})[_0xd573('0x29')](function(){_0x273f15[_0xd573('0x6d')](function(_0x1e3b44){socket[_0xd573('0x6e')](_0xd573('0x6f'),{'UserId':_0x1e3b44['id'],'FaxQueueId':_0x33cb23['id']});});});});});}})[_0xd573('0x29')](respondWithStatusCode(_0x2bbf5a,null))[_0xd573('0x46')](handleError(_0x2bbf5a,null));};exports[_0xd573('0x70')]=function(_0x473ae8,_0x7ea39e,_0x51bbb0){return db[_0xd573('0x63')][_0xd573('0x45')]({'where':{'id':_0x473ae8[_0xd573('0x34')][_0xd573('0x64')]},'attributes':['id'],'include':[{'model':db[_0xd573('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd573('0x29')](handleEntityNotFound(_0x7ea39e,null))['then'](function(_0x1c154a){var _0xb68bae=_['map'](_0x1c154a,'id');var _0x1b0fb0=[];var _0x5a4646=[];var _0x5828e0=squel[_0xd573('0x71')]();_0x5828e0['field'](_0xd573('0x72'))[_0xd573('0x73')](_0xd573('0x74'),'tq')[_0xd573('0x75')](_0xd573('0x76'),'ut',_0xd573('0x77'))[_0xd573('0x40')](_0xd573('0x78'),_0x473ae8['params']['id']);for(var _0x3c0ac0=0x0;_0x3c0ac0<_0x1c154a['length'];_0x3c0ac0+=0x1){let _0x296034=_0x1c154a[_0x3c0ac0];for(var _0x4ab305=0x0;_0x4ab305<_0x296034[_0xd573('0x65')]['length'];_0x4ab305+=0x1){let _0x425ed4=_0x296034['Agents'][_0x4ab305];var _0x426ce9=_0x5828e0[_0xd573('0x79')]();_0x426ce9[_0xd573('0x40')](_0xd573('0x7a'),_0x425ed4['id']);_0x5a4646['push'](db[_0xd573('0x7b')][_0xd573('0x34')](_0x426ce9[_0xd573('0x7c')](),{'type':db[_0xd573('0x7b')][_0xd573('0x7d')][_0xd573('0x7e')]})[_0xd573('0x29')](function(_0x4bcc9a){if(_0x4bcc9a[_0xd573('0x3b')]===0x1){return _0x425ed4['id'];}else{var _0x48b2a8=_[_0xd573('0x7f')](_[_0xd573('0x59')](_0x4bcc9a,_0xd573('0x80')),function(_0x10ffa2){return _[_0xd573('0x81')](_0xb68bae,_0x10ffa2);});if(_0x48b2a8){return _0x425ed4['id'];}}}));}}return BPromise['all'](_0x5a4646)[_0xd573('0x29')](function(_0x49f801){_0x1b0fb0=_(_0x1b0fb0)[_0xd573('0x82')](_0x49f801)[_0xd573('0x83')]()[_0xd573('0x84')]();return db[_0xd573('0x31')][_0xd573('0x51')]({'where':{'id':_0x473ae8[_0xd573('0x48')]['id']}})['then'](function(_0x585a00){return db['sequelize']['transaction'](function(_0x173248){return _0x585a00[_0xd573('0x70')](_0x473ae8[_0xd573('0x34')][_0xd573('0x64')],{'transaction':_0x173248})['then'](function(){if(!_['isEmpty'](_0x1b0fb0)){return _0x585a00[_0xd573('0x85')](_0x1b0fb0,{'transaction':_0x173248});}})[_0xd573('0x29')](function(){_0x1b0fb0[_0xd573('0x6d')](function(_0x123374){socket[_0xd573('0x6e')](_0xd573('0x86'),{'UserId':_0x123374,'FaxQueueId':_0x585a00['id']});});});});});});})[_0xd573('0x29')](respondWithStatusCode(_0x7ea39e,null))[_0xd573('0x46')](handleError(_0x7ea39e,null));};exports[_0xd573('0x87')]=function(_0x123305,_0x5b87e9,_0x22fd94){return db[_0xd573('0x31')]['find']({'where':{'id':_0x123305[_0xd573('0x48')]['id']}})[_0xd573('0x29')](handleEntityNotFound(_0x5b87e9,null))[_0xd573('0x29')](function(_0x1f6ddc){if(_0x1f6ddc){return _0x1f6ddc[_0xd573('0x87')](_0x123305['body']['ids'],_[_0xd573('0x88')](_0x123305[_0xd573('0x4b')],[_0xd573('0x64'),'id'])||{})[_0xd573('0x89')](function(_0x37aee2){for(var _0x20d019=0x0;_0x20d019<_0x123305['body']['ids']['length'];_0x20d019+=0x1){socket[_0xd573('0x6e')]('userFaxQueue:save',{'UserId':Number(_0x123305['body'][_0xd573('0x64')][_0x20d019]),'FaxQueueId':Number(_0x123305[_0xd573('0x48')]['id'])});}return _0x37aee2;});}})[_0xd573('0x29')](respondWithResult(_0x5b87e9,null))[_0xd573('0x46')](handleError(_0x5b87e9,null));};exports[_0xd573('0x85')]=function(_0x2bdfd5,_0xad9207,_0x5ea0b1){return db[_0xd573('0x31')][_0xd573('0x51')]({'where':{'id':_0x2bdfd5[_0xd573('0x48')]['id']}})['then'](handleEntityNotFound(_0xad9207,null))['then'](function(_0x3fed5c){if(_0x3fed5c){return _0x3fed5c['removeAgents'](_0x2bdfd5[_0xd573('0x34')][_0xd573('0x64')])['then'](function(){if(_[_0xd573('0x8a')](_0x2bdfd5['query']['ids'])){for(var _0x1f00a5=0x0;_0x1f00a5<_0x2bdfd5[_0xd573('0x34')][_0xd573('0x64')][_0xd573('0x3b')];_0x1f00a5+=0x1){socket[_0xd573('0x6e')](_0xd573('0x86'),{'UserId':Number(_0x2bdfd5[_0xd573('0x34')][_0xd573('0x64')][_0x1f00a5]),'FaxQueueId':Number(_0x2bdfd5[_0xd573('0x48')]['id'])});}}else{socket[_0xd573('0x6e')](_0xd573('0x86'),{'UserId':Number(_0x2bdfd5[_0xd573('0x34')]['ids']),'FaxQueueId':Number(_0x2bdfd5[_0xd573('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0xad9207,null))[_0xd573('0x46')](handleError(_0xad9207,null));};exports[_0xd573('0x8b')]=function(_0x138f38,_0x4ef0f8,_0x46e49c){var _0x7e259f={};var _0x5c41d0={};var _0x1d5a87;var _0x605d7d;return db[_0xd573('0x31')][_0xd573('0x56')]({'where':{'id':_0x138f38[_0xd573('0x48')]['id']}})[_0xd573('0x29')](handleEntityNotFound(_0x4ef0f8,null))['then'](function(_0x32467e){if(_0x32467e){_0x1d5a87=_0x32467e;_0x5c41d0[_0xd573('0x38')]=_['keys'](db[_0xd573('0x5a')][_0xd573('0x32')]);_0x5c41d0[_0xd573('0x34')]=_['keys'](_0x138f38[_0xd573('0x34')]);_0x5c41d0[_0xd573('0x36')]=_['intersection'](_0x5c41d0['model'],_0x5c41d0[_0xd573('0x34')]);_0x7e259f[_0xd573('0x3a')]=_['intersection'](_0x5c41d0[_0xd573('0x38')],qs[_0xd573('0x39')](_0x138f38[_0xd573('0x34')][_0xd573('0x39')]));_0x7e259f[_0xd573('0x3a')]=_0x7e259f[_0xd573('0x3a')][_0xd573('0x3b')]?_0x7e259f[_0xd573('0x3a')]:_0x5c41d0['model'];_0x7e259f[_0xd573('0x3e')]=qs[_0xd573('0x3f')](_0x138f38[_0xd573('0x34')][_0xd573('0x3f')]);_0x7e259f[_0xd573('0x40')]=qs[_0xd573('0x36')](_[_0xd573('0x57')](_0x138f38[_0xd573('0x34')],_0x5c41d0[_0xd573('0x36')]));if(_0x138f38[_0xd573('0x34')][_0xd573('0x41')]){_0x7e259f[_0xd573('0x40')]=_[_0xd573('0x49')](_0x7e259f[_0xd573('0x40')],{'$or':_[_0xd573('0x59')](_0x7e259f['attributes'],function(_0x339750){var _0x4748ae={};_0x4748ae[_0x339750]={'$like':'%'+_0x138f38['query'][_0xd573('0x41')]+'%'};return _0x4748ae;})});}_0x7e259f=_[_0xd573('0x49')]({},_0x7e259f,_0x138f38[_0xd573('0x42')]);return _0x1d5a87[_0xd573('0x8b')](_0x7e259f);}})[_0xd573('0x29')](function(_0x1f48de){if(_0x1f48de){_0x605d7d=_0x1f48de[_0xd573('0x3b')];if(!_0x138f38['query'][_0xd573('0x3c')]('nolimit')){_0x7e259f[_0xd573('0x23')]=qs[_0xd573('0x23')](_0x138f38[_0xd573('0x34')][_0xd573('0x23')]);_0x7e259f[_0xd573('0x21')]=qs[_0xd573('0x21')](_0x138f38[_0xd573('0x34')][_0xd573('0x21')]);}return _0x1d5a87[_0xd573('0x8b')](_0x7e259f);}})['then'](function(_0x5ac220){if(_0x5ac220){return _0x5ac220?{'count':_0x605d7d,'rows':_0x5ac220}:null;}})[_0xd573('0x29')](respondWithResult(_0x4ef0f8,null))[_0xd573('0x46')](handleError(_0x4ef0f8,null));}; \ No newline at end of file +var _0xb9e9=['all','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','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','../../mysqldb','redis','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','name','send','index','map','FaxQueue','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue','rawAttributes','order','findAll','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','interface','sequelize','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes'];(function(_0x525efa,_0x50532a){var _0x7b65b0=function(_0x206c91){while(--_0x206c91){_0x525efa['push'](_0x525efa['shift']());}};_0x7b65b0(++_0x50532a);}(_0xb9e9,0x90));var _0x9b9e=function(_0x1a2581,_0x44dab6){_0x1a2581=_0x1a2581-0x0;var _0x21ef3e=_0xb9e9[_0x1a2581];return _0x21ef3e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9b9e('0x0'));var jsonpatch=require(_0x9b9e('0x1'));var rp=require(_0x9b9e('0x2'));var moment=require(_0x9b9e('0x3'));var BPromise=require(_0x9b9e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9b9e('0x5'));var sox=require('sox');var csv=require(_0x9b9e('0x6'));var ejs=require(_0x9b9e('0x7'));var fs=require('fs');var fs_extra=require(_0x9b9e('0x8'));var _=require(_0x9b9e('0x9'));var squel=require(_0x9b9e('0xa'));var crypto=require(_0x9b9e('0xb'));var jsforce=require(_0x9b9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9b9e('0xd'));var Papa=require(_0x9b9e('0xe'));var Redis=require(_0x9b9e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9b9e('0x10'));var as=require(_0x9b9e('0x11'));var hardwareService=require(_0x9b9e('0x12'));var logger=require(_0x9b9e('0x13'))(_0x9b9e('0x14'));var utils=require(_0x9b9e('0x15'));var config=require(_0x9b9e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b9e('0x17'))['db'];config['redis']=_['defaults'](config[_0x9b9e('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9b9e('0x19'))[_0x9b9e('0x1a')](socket);function respondWithStatusCode(_0x45c8b3,_0x4fcc08){_0x4fcc08=_0x4fcc08||0xcc;return function(_0x73eb16){if(_0x73eb16){return _0x45c8b3[_0x9b9e('0x1b')](_0x4fcc08);}return _0x45c8b3[_0x9b9e('0x1c')](_0x4fcc08)[_0x9b9e('0x1d')]();};}function respondWithResult(_0x236147,_0x113d8c){_0x113d8c=_0x113d8c||0xc8;return function(_0x387750){if(_0x387750){return _0x236147[_0x9b9e('0x1c')](_0x113d8c)[_0x9b9e('0x1e')](_0x387750);}};}function respondWithFilteredResult(_0x172f0a,_0x1e6e4a){return function(_0xe221a9){if(_0xe221a9){var _0x987c25=typeof _0x1e6e4a[_0x9b9e('0x1f')]===_0x9b9e('0x20')&&typeof _0x1e6e4a['limit']==='undefined';var _0xb8b218=_0xe221a9[_0x9b9e('0x21')];var _0x57ce16=_0x987c25?0x0:_0x1e6e4a[_0x9b9e('0x1f')];var _0x278586=_0x987c25?_0xe221a9[_0x9b9e('0x21')]:_0x1e6e4a[_0x9b9e('0x1f')]+_0x1e6e4a[_0x9b9e('0x22')];var _0x28fac6;if(_0x278586>=_0xb8b218){_0x278586=_0xb8b218;_0x28fac6=0xc8;}else{_0x28fac6=0xce;}_0x172f0a['status'](_0x28fac6);return _0x172f0a['set'](_0x9b9e('0x23'),_0x57ce16+'-'+_0x278586+'/'+_0xb8b218)[_0x9b9e('0x1e')](_0xe221a9);}return null;};}function patchUpdates(_0x28bbec){return function(_0x282a0b){try{jsonpatch['apply'](_0x282a0b,_0x28bbec,!![]);}catch(_0xda7ba0){return BPromise[_0x9b9e('0x24')](_0xda7ba0);}return _0x282a0b[_0x9b9e('0x25')]();};}function saveUpdates(_0x126787,_0x47f60f){return function(_0x5b9f00){if(_0x5b9f00){return _0x5b9f00[_0x9b9e('0x26')](_0x126787)[_0x9b9e('0x27')](function(_0x52288b){return _0x52288b;});}return null;};}function removeEntity(_0x4fbc83,_0x37a95e){return function(_0x51b83a){if(_0x51b83a){return _0x51b83a['destroy']()[_0x9b9e('0x27')](function(){var _0x45b694=_0x51b83a[_0x9b9e('0x28')]({'plain':!![]});var _0x8b481f=_0x9b9e('0x29');return db[_0x9b9e('0x2a')][_0x9b9e('0x2b')]({'where':{'type':_0x8b481f,'resourceId':_0x45b694['id']}})[_0x9b9e('0x27')](function(){return _0x51b83a;});})[_0x9b9e('0x27')](function(){_0x4fbc83[_0x9b9e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4288a8,_0x58425e){return function(_0x3d223b){if(!_0x3d223b){_0x4288a8['sendStatus'](0x194);}return _0x3d223b;};}function handleError(_0x539a10,_0x4c55ba){_0x4c55ba=_0x4c55ba||0x1f4;return function(_0x5e7317){logger['error'](_0x5e7317['stack']);if(_0x5e7317['name']){delete _0x5e7317[_0x9b9e('0x2c')];}_0x539a10[_0x9b9e('0x1c')](_0x4c55ba)[_0x9b9e('0x2d')](_0x5e7317);};}exports[_0x9b9e('0x2e')]=function(_0x27f5a1,_0x32b963){var _0x17b357={},_0x3ffaae={},_0x33a3b0={'count':0x0,'rows':[]};var _0x1279de=_[_0x9b9e('0x2f')](db[_0x9b9e('0x30')]['rawAttributes'],function(_0x12400e){return{'name':_0x12400e['fieldName'],'type':_0x12400e[_0x9b9e('0x31')]['key']};});_0x3ffaae[_0x9b9e('0x32')]=_[_0x9b9e('0x2f')](_0x1279de,_0x9b9e('0x2c'));_0x3ffaae['query']=_['keys'](_0x27f5a1[_0x9b9e('0x33')]);_0x3ffaae[_0x9b9e('0x34')]=_[_0x9b9e('0x35')](_0x3ffaae[_0x9b9e('0x32')],_0x3ffaae[_0x9b9e('0x33')]);_0x17b357[_0x9b9e('0x36')]=_['intersection'](_0x3ffaae[_0x9b9e('0x32')],qs[_0x9b9e('0x37')](_0x27f5a1[_0x9b9e('0x33')][_0x9b9e('0x37')]));_0x17b357[_0x9b9e('0x36')]=_0x17b357[_0x9b9e('0x36')]['length']?_0x17b357[_0x9b9e('0x36')]:_0x3ffaae[_0x9b9e('0x32')];if(!_0x27f5a1['query'][_0x9b9e('0x38')](_0x9b9e('0x39'))){_0x17b357[_0x9b9e('0x22')]=qs[_0x9b9e('0x22')](_0x27f5a1[_0x9b9e('0x33')][_0x9b9e('0x22')]);_0x17b357[_0x9b9e('0x1f')]=qs[_0x9b9e('0x1f')](_0x27f5a1[_0x9b9e('0x33')][_0x9b9e('0x1f')]);}_0x17b357['order']=qs[_0x9b9e('0x3a')](_0x27f5a1['query'][_0x9b9e('0x3a')]);_0x17b357[_0x9b9e('0x3b')]=qs[_0x9b9e('0x34')](_[_0x9b9e('0x3c')](_0x27f5a1[_0x9b9e('0x33')],_0x3ffaae[_0x9b9e('0x34')]),_0x1279de);if(_0x27f5a1[_0x9b9e('0x33')][_0x9b9e('0x3d')]){_0x17b357[_0x9b9e('0x3b')]=_[_0x9b9e('0x3e')](_0x17b357[_0x9b9e('0x3b')],{'$or':_[_0x9b9e('0x2f')](_0x1279de,function(_0x532277){if(_0x532277[_0x9b9e('0x31')]!==_0x9b9e('0x3f')){var _0xd1f37e={};_0xd1f37e[_0x532277['name']]={'$like':'%'+_0x27f5a1[_0x9b9e('0x33')][_0x9b9e('0x3d')]+'%'};return _0xd1f37e;}})});}_0x17b357=_[_0x9b9e('0x3e')]({},_0x17b357,_0x27f5a1[_0x9b9e('0x40')]);var _0x3800ce={'where':_0x17b357[_0x9b9e('0x3b')]};return db[_0x9b9e('0x30')][_0x9b9e('0x21')](_0x3800ce)[_0x9b9e('0x27')](function(_0x4907c4){_0x33a3b0[_0x9b9e('0x21')]=_0x4907c4;if(_0x27f5a1[_0x9b9e('0x33')][_0x9b9e('0x41')]){_0x17b357['include']=[{'all':!![]}];}return db[_0x9b9e('0x30')]['findAll'](_0x17b357);})[_0x9b9e('0x27')](function(_0x4360e4){_0x33a3b0[_0x9b9e('0x42')]=_0x4360e4;return _0x33a3b0;})[_0x9b9e('0x27')](respondWithFilteredResult(_0x32b963,_0x17b357))[_0x9b9e('0x43')](handleError(_0x32b963,null));};exports['show']=function(_0x405f8e,_0x12f482){var _0x515b0d={'raw':!![],'where':{'id':_0x405f8e[_0x9b9e('0x44')]['id']}},_0x15efcb={};_0x15efcb[_0x9b9e('0x32')]=_[_0x9b9e('0x45')](db[_0x9b9e('0x30')]['rawAttributes']);_0x15efcb[_0x9b9e('0x33')]=_[_0x9b9e('0x45')](_0x405f8e[_0x9b9e('0x33')]);_0x15efcb[_0x9b9e('0x34')]=_[_0x9b9e('0x35')](_0x15efcb[_0x9b9e('0x32')],_0x15efcb[_0x9b9e('0x33')]);_0x515b0d[_0x9b9e('0x36')]=_[_0x9b9e('0x35')](_0x15efcb[_0x9b9e('0x32')],qs[_0x9b9e('0x37')](_0x405f8e[_0x9b9e('0x33')]['fields']));_0x515b0d[_0x9b9e('0x36')]=_0x515b0d[_0x9b9e('0x36')][_0x9b9e('0x46')]?_0x515b0d[_0x9b9e('0x36')]:_0x15efcb['model'];if(_0x405f8e[_0x9b9e('0x33')][_0x9b9e('0x41')]){_0x515b0d['include']=[{'all':!![]}];}_0x515b0d=_[_0x9b9e('0x3e')]({},_0x515b0d,_0x405f8e['options']);return db[_0x9b9e('0x30')]['find'](_0x515b0d)[_0x9b9e('0x27')](handleEntityNotFound(_0x12f482,null))['then'](respondWithResult(_0x12f482,null))['catch'](handleError(_0x12f482,null));};exports['create']=function(_0x1caf0d,_0x39e5f9){return db['FaxQueue'][_0x9b9e('0x47')](_0x1caf0d[_0x9b9e('0x48')],{})[_0x9b9e('0x27')](function(_0x1562f6){var _0x191f48=_0x1caf0d[_0x9b9e('0x49')]['get']({'plain':!![]});if(!_0x191f48)throw new Error(_0x9b9e('0x4a'));if(_0x191f48[_0x9b9e('0x4b')]===_0x9b9e('0x49')){var _0x36b692=_0x1562f6[_0x9b9e('0x28')]({'plain':!![]});var _0x529378=_0x9b9e('0x29');return db[_0x9b9e('0x4c')][_0x9b9e('0x4d')]({'where':{'name':_0x529378,'userProfileId':_0x191f48[_0x9b9e('0x4e')]},'raw':!![]})[_0x9b9e('0x27')](function(_0x22ce5b){if(_0x22ce5b&&_0x22ce5b['autoAssociation']===0x0){return db[_0x9b9e('0x2a')]['create']({'name':_0x36b692[_0x9b9e('0x2c')],'resourceId':_0x36b692['id'],'type':_0x22ce5b[_0x9b9e('0x2c')],'sectionId':_0x22ce5b['id']},{})['then'](function(){return _0x1562f6;});}else{return _0x1562f6;}})['catch'](function(_0x57491e){logger[_0x9b9e('0x4f')](_0x9b9e('0x50'),_0x57491e);throw _0x57491e;});}return _0x1562f6;})['then'](respondWithResult(_0x39e5f9,0xc9))['catch'](handleError(_0x39e5f9,null));};exports[_0x9b9e('0x26')]=function(_0x157f8e,_0x279966){if(_0x157f8e[_0x9b9e('0x48')]['id']){delete _0x157f8e[_0x9b9e('0x48')]['id'];}return db[_0x9b9e('0x30')][_0x9b9e('0x4d')]({'where':{'id':_0x157f8e['params']['id']}})[_0x9b9e('0x27')](handleEntityNotFound(_0x279966,null))['then'](saveUpdates(_0x157f8e['body'],null))[_0x9b9e('0x27')](respondWithResult(_0x279966,null))[_0x9b9e('0x43')](handleError(_0x279966,null));};exports[_0x9b9e('0x2b')]=function(_0x3e17d0,_0x5b2c4b){return db[_0x9b9e('0x30')][_0x9b9e('0x4d')]({'where':{'id':_0x3e17d0['params']['id']}})[_0x9b9e('0x27')](handleEntityNotFound(_0x5b2c4b,null))[_0x9b9e('0x27')](removeEntity(_0x5b2c4b,null))[_0x9b9e('0x43')](handleError(_0x5b2c4b,null));};exports[_0x9b9e('0x51')]=function(_0xf62d37,_0x1b3232){return db[_0x9b9e('0x30')]['describe']()[_0x9b9e('0x27')](respondWithResult(_0x1b3232,null))[_0x9b9e('0x43')](handleError(_0x1b3232,null));};exports['getMembers']=function(_0x484476,_0x4f4536,_0x2f30e6){var _0x29717c={'raw':!![],'where':{}},_0x1bd7f3={},_0xfeeaa4;return db[_0x9b9e('0x30')]['findOne']({'where':{'id':_0x484476[_0x9b9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f4536,null))[_0x9b9e('0x27')](function(_0x404de0){if(_0x404de0){_0xfeeaa4=_0x404de0[_0x9b9e('0x28')]({'plain':!![]});_0x1bd7f3['model']=_[_0x9b9e('0x45')](db[_0x9b9e('0x52')][_0x9b9e('0x53')]);_0x1bd7f3[_0x9b9e('0x33')]=_['keys'](_0x484476[_0x9b9e('0x33')]);_0x1bd7f3['filters']=_[_0x9b9e('0x35')](_0x1bd7f3[_0x9b9e('0x32')],_0x1bd7f3[_0x9b9e('0x33')]);_0x29717c['attributes']=_[_0x9b9e('0x35')](_0x1bd7f3[_0x9b9e('0x32')],qs[_0x9b9e('0x37')](_0x484476[_0x9b9e('0x33')][_0x9b9e('0x37')]));_0x29717c['attributes']=_0x29717c[_0x9b9e('0x36')][_0x9b9e('0x46')]?_0x29717c[_0x9b9e('0x36')]:_0x1bd7f3[_0x9b9e('0x32')];if(!_0x484476[_0x9b9e('0x33')][_0x9b9e('0x38')]('nolimit')){_0x29717c[_0x9b9e('0x22')]=qs[_0x9b9e('0x22')](_0x484476[_0x9b9e('0x33')][_0x9b9e('0x22')]);_0x29717c[_0x9b9e('0x1f')]=qs[_0x9b9e('0x1f')](_0x484476[_0x9b9e('0x33')]['offset']);}_0x29717c[_0x9b9e('0x54')]=qs[_0x9b9e('0x3a')](_0x484476['query'][_0x9b9e('0x3a')]);_0x29717c[_0x9b9e('0x3b')]=qs[_0x9b9e('0x34')](_[_0x9b9e('0x3c')](_0x484476[_0x9b9e('0x33')],_0x1bd7f3[_0x9b9e('0x34')]));_0x29717c[_0x9b9e('0x3b')]['FaxQueueId']=_0x404de0['id'];if(_0x484476['query'][_0x9b9e('0x3d')]){_0x29717c[_0x9b9e('0x3b')]=_[_0x9b9e('0x3e')](_0x29717c['where'],{'$or':_[_0x9b9e('0x2f')](_0x29717c['attributes'],function(_0x1088d2){var _0x1a48e8={};_0x1a48e8[_0x1088d2]={'$like':'%'+_0x484476[_0x9b9e('0x33')]['filter']+'%'};return _0x1a48e8;})});}_0x29717c=_[_0x9b9e('0x3e')]({},_0x29717c,_0x484476[_0x9b9e('0x40')]);return db['UserFaxQueue'][_0x9b9e('0x55')](_0x29717c);}})[_0x9b9e('0x27')](function(_0x4383b6){if(_0x4383b6){return db['User'][_0x9b9e('0x56')]({'where':{'id':_[_0x9b9e('0x2f')](_0x4383b6,_0x9b9e('0x57')),'role':'agent'},'attributes':['id',_0x9b9e('0x2c'),'faxPause',_0x9b9e('0x58'),_0x9b9e('0x59')]});}})['then'](function(_0x1f0d3c){if(_0x1f0d3c){return{'count':_0x1f0d3c['count'],'rows':_[_0x9b9e('0x2f')](_0x1f0d3c[_0x9b9e('0x42')],function(_0x38fe92){return{'membername':_0x38fe92['name'],'UserId':_0x38fe92['id'],'queue_name':_0xfeeaa4[_0x9b9e('0x2c')],'FaxQueueId':_0xfeeaa4['id'],'interface':util[_0x9b9e('0x5a')](_0x9b9e('0x5b'),_0x9b9e('0x5c'),_0x38fe92['name']),'penalty':0x0,'paused':_0x38fe92['faxPause'],'createdAt':_0x38fe92[_0x9b9e('0x59')],'updatedAt':_0x38fe92['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9b9e('0x27')](respondWithFilteredResult(_0x4f4536,_0x29717c))[_0x9b9e('0x43')](handleError(_0x4f4536,null));};exports[_0x9b9e('0x5d')]=function(_0x3f26ec,_0x59054a,_0x4af32a){var _0xe90964={};var _0x117ba0={};var _0x1e396f;var _0x2dc881;return db[_0x9b9e('0x30')][_0x9b9e('0x5e')]({'where':{'id':_0x3f26ec[_0x9b9e('0x44')]['id']}})[_0x9b9e('0x27')](handleEntityNotFound(_0x59054a,null))[_0x9b9e('0x27')](function(_0x5ca0a9){if(_0x5ca0a9){_0x1e396f=_0x5ca0a9;_0x117ba0[_0x9b9e('0x32')]=_['keys'](db[_0x9b9e('0x5f')][_0x9b9e('0x53')]);_0x117ba0['query']=_[_0x9b9e('0x45')](_0x3f26ec[_0x9b9e('0x33')]);_0x117ba0[_0x9b9e('0x34')]=_['intersection'](_0x117ba0[_0x9b9e('0x32')],_0x117ba0[_0x9b9e('0x33')]);_0xe90964[_0x9b9e('0x36')]=_[_0x9b9e('0x35')](_0x117ba0[_0x9b9e('0x32')],qs[_0x9b9e('0x37')](_0x3f26ec[_0x9b9e('0x33')]['fields']));_0xe90964[_0x9b9e('0x36')]=_0xe90964[_0x9b9e('0x36')][_0x9b9e('0x46')]?_0xe90964[_0x9b9e('0x36')]:_0x117ba0[_0x9b9e('0x32')];_0xe90964[_0x9b9e('0x54')]=qs[_0x9b9e('0x3a')](_0x3f26ec[_0x9b9e('0x33')][_0x9b9e('0x3a')]);_0xe90964[_0x9b9e('0x3b')]=qs['filters'](_[_0x9b9e('0x3c')](_0x3f26ec[_0x9b9e('0x33')],_0x117ba0[_0x9b9e('0x34')]));if(_0x3f26ec[_0x9b9e('0x33')][_0x9b9e('0x3d')]){_0xe90964[_0x9b9e('0x3b')]=_[_0x9b9e('0x3e')](_0xe90964[_0x9b9e('0x3b')],{'$or':_[_0x9b9e('0x2f')](_0xe90964[_0x9b9e('0x36')],function(_0x532e73){var _0x602da5={};_0x602da5[_0x532e73]={'$like':'%'+_0x3f26ec[_0x9b9e('0x33')][_0x9b9e('0x3d')]+'%'};return _0x602da5;})});}_0xe90964=_[_0x9b9e('0x3e')]({},_0xe90964,_0x3f26ec['options']);return _0x1e396f[_0x9b9e('0x5d')](_0xe90964);}})[_0x9b9e('0x27')](function(_0x4ee373){if(_0x4ee373){_0x2dc881=_0x4ee373[_0x9b9e('0x46')];if(!_0x3f26ec[_0x9b9e('0x33')][_0x9b9e('0x38')]('nolimit')){_0xe90964[_0x9b9e('0x22')]=qs['limit'](_0x3f26ec[_0x9b9e('0x33')][_0x9b9e('0x22')]);_0xe90964[_0x9b9e('0x1f')]=qs['offset'](_0x3f26ec['query'][_0x9b9e('0x1f')]);}return _0x1e396f[_0x9b9e('0x5d')](_0xe90964);}})[_0x9b9e('0x27')](function(_0x5b2d82){if(_0x5b2d82){return _0x5b2d82?{'count':_0x2dc881,'rows':_0x5b2d82}:null;}})[_0x9b9e('0x27')](respondWithResult(_0x59054a,null))['catch'](handleError(_0x59054a,null));};exports[_0x9b9e('0x60')]=function(_0x178d28,_0x42dadc,_0x186e4d){var _0x36b93c=_0x178d28['body'][_0x9b9e('0x61')];return db[_0x9b9e('0x5f')][_0x9b9e('0x55')]({'where':{'id':_0x36b93c},'attributes':['id'],'include':[{'model':db[_0x9b9e('0x62')],'as':_0x9b9e('0x63'),'attributes':['id',_0x9b9e('0x2c'),'online','voicePause',_0x9b9e('0x64')],'raw':!![]}]})[_0x9b9e('0x27')](function(_0x55fb2b){if(_0x55fb2b){var _0x149567=_['flatMap'](_0x55fb2b,function(_0x11ba02){var _0x50171a=_0x11ba02[_0x9b9e('0x28')]({'plain':!![]});return _0x50171a[_0x9b9e('0x63')];});return db[_0x9b9e('0x30')][_0x9b9e('0x4d')]({'where':{'id':_0x178d28[_0x9b9e('0x44')]['id']}})[_0x9b9e('0x27')](function(_0x1d8673){return db[_0x9b9e('0x65')]['transaction'](function(_0x28651d){return _0x1d8673[_0x9b9e('0x60')](_0x36b93c,{'transaction':_0x28651d})['then'](function(){return BPromise['each'](_0x149567,function(_0x4b5fb9){return db[_0x9b9e('0x52')][_0x9b9e('0x66')]({'where':{'UserId':_0x4b5fb9['id'],'FaxQueueId':_0x178d28[_0x9b9e('0x44')]['id']},'transaction':_0x28651d});});})[_0x9b9e('0x27')](function(){_0x149567[_0x9b9e('0x67')](function(_0x4c2e1c){socket[_0x9b9e('0x68')](_0x9b9e('0x69'),{'UserId':_0x4c2e1c['id'],'FaxQueueId':_0x1d8673['id']});});});});});}})[_0x9b9e('0x27')](respondWithStatusCode(_0x42dadc,null))[_0x9b9e('0x43')](handleError(_0x42dadc,null));};exports[_0x9b9e('0x6a')]=function(_0x50e161,_0x41b803,_0x18b61e){return db[_0x9b9e('0x5f')][_0x9b9e('0x55')]({'where':{'id':_0x50e161[_0x9b9e('0x33')][_0x9b9e('0x61')]},'attributes':['id'],'include':[{'model':db[_0x9b9e('0x62')],'as':_0x9b9e('0x63'),'attributes':['id'],'raw':!![]}]})[_0x9b9e('0x27')](handleEntityNotFound(_0x41b803,null))['then'](function(_0x5c7045){var _0x563116=_['map'](_0x5c7045,'id');var _0x15fdb2=[];var _0x20a841=[];var _0x3e188b=squel[_0x9b9e('0x6b')]();_0x3e188b[_0x9b9e('0x6c')](_0x9b9e('0x6d'))[_0x9b9e('0x6e')](_0x9b9e('0x6f'),'tq')['join']('user_has_teams','ut',_0x9b9e('0x70'))[_0x9b9e('0x3b')](_0x9b9e('0x71'),_0x50e161[_0x9b9e('0x44')]['id']);for(var _0x30c9e4=0x0;_0x30c9e4<_0x5c7045[_0x9b9e('0x46')];_0x30c9e4+=0x1){let _0x4341af=_0x5c7045[_0x30c9e4];for(var _0x773920=0x0;_0x773920<_0x4341af[_0x9b9e('0x63')][_0x9b9e('0x46')];_0x773920+=0x1){let _0x2ccb68=_0x4341af['Agents'][_0x773920];var _0xecf7d2=_0x3e188b[_0x9b9e('0x72')]();_0xecf7d2[_0x9b9e('0x3b')](_0x9b9e('0x73'),_0x2ccb68['id']);_0x20a841[_0x9b9e('0x74')](db[_0x9b9e('0x65')][_0x9b9e('0x33')](_0xecf7d2[_0x9b9e('0x75')](),{'type':db['sequelize'][_0x9b9e('0x76')]['SELECT']})['then'](function(_0x5dc574){if(_0x5dc574['length']===0x1){return _0x2ccb68['id'];}else{var _0x3cc08f=_['every'](_['map'](_0x5dc574,'TeamId'),function(_0x29d520){return _[_0x9b9e('0x77')](_0x563116,_0x29d520);});if(_0x3cc08f){return _0x2ccb68['id'];}}}));}}return BPromise[_0x9b9e('0x78')](_0x20a841)[_0x9b9e('0x27')](function(_0x58d7cb){_0x15fdb2=_(_0x15fdb2)[_0x9b9e('0x79')](_0x58d7cb)[_0x9b9e('0x7a')]()[_0x9b9e('0x7b')]();return db[_0x9b9e('0x30')][_0x9b9e('0x4d')]({'where':{'id':_0x50e161[_0x9b9e('0x44')]['id']}})['then'](function(_0x238aad){return db[_0x9b9e('0x65')][_0x9b9e('0x7c')](function(_0x3ff9d6){return _0x238aad[_0x9b9e('0x6a')](_0x50e161['query'][_0x9b9e('0x61')],{'transaction':_0x3ff9d6})['then'](function(){if(!_[_0x9b9e('0x7d')](_0x15fdb2)){return _0x238aad[_0x9b9e('0x7e')](_0x15fdb2,{'transaction':_0x3ff9d6});}})[_0x9b9e('0x27')](function(){_0x15fdb2[_0x9b9e('0x67')](function(_0x4bd0b4){socket[_0x9b9e('0x68')](_0x9b9e('0x7f'),{'UserId':_0x4bd0b4,'FaxQueueId':_0x238aad['id']});});});});});});})[_0x9b9e('0x27')](respondWithStatusCode(_0x41b803,null))[_0x9b9e('0x43')](handleError(_0x41b803,null));};exports[_0x9b9e('0x80')]=function(_0x4db340,_0x497072,_0x539212){return db['FaxQueue']['find']({'where':{'id':_0x4db340[_0x9b9e('0x44')]['id']}})[_0x9b9e('0x27')](handleEntityNotFound(_0x497072,null))['then'](function(_0x14820f){if(_0x14820f){return _0x14820f[_0x9b9e('0x80')](_0x4db340[_0x9b9e('0x48')][_0x9b9e('0x61')],_['omit'](_0x4db340[_0x9b9e('0x48')],[_0x9b9e('0x61'),'id'])||{})[_0x9b9e('0x81')](function(_0x162f14){for(var _0xe10709=0x0;_0xe10709<_0x4db340['body'][_0x9b9e('0x61')][_0x9b9e('0x46')];_0xe10709+=0x1){socket[_0x9b9e('0x68')](_0x9b9e('0x69'),{'UserId':Number(_0x4db340['body'][_0x9b9e('0x61')][_0xe10709]),'FaxQueueId':Number(_0x4db340[_0x9b9e('0x44')]['id'])});}return _0x162f14;});}})['then'](respondWithResult(_0x497072,null))[_0x9b9e('0x43')](handleError(_0x497072,null));};exports[_0x9b9e('0x7e')]=function(_0x381ea7,_0x588855,_0x1f8b65){return db['FaxQueue'][_0x9b9e('0x4d')]({'where':{'id':_0x381ea7[_0x9b9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x588855,null))[_0x9b9e('0x27')](function(_0x5c1498){if(_0x5c1498){return _0x5c1498['removeAgents'](_0x381ea7[_0x9b9e('0x33')][_0x9b9e('0x61')])[_0x9b9e('0x27')](function(){if(_[_0x9b9e('0x82')](_0x381ea7[_0x9b9e('0x33')]['ids'])){for(var _0x27fdd7=0x0;_0x27fdd7<_0x381ea7[_0x9b9e('0x33')][_0x9b9e('0x61')][_0x9b9e('0x46')];_0x27fdd7+=0x1){socket['emit'](_0x9b9e('0x7f'),{'UserId':Number(_0x381ea7[_0x9b9e('0x33')][_0x9b9e('0x61')][_0x27fdd7]),'FaxQueueId':Number(_0x381ea7[_0x9b9e('0x44')]['id'])});}}else{socket['emit'](_0x9b9e('0x7f'),{'UserId':Number(_0x381ea7[_0x9b9e('0x33')]['ids']),'FaxQueueId':Number(_0x381ea7[_0x9b9e('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x588855,null))[_0x9b9e('0x43')](handleError(_0x588855,null));};exports[_0x9b9e('0x83')]=function(_0xb1d31b,_0x484768,_0x2f6deb){var _0x11a5ac={};var _0x197da9={};var _0x3efec;var _0x43064c;return db[_0x9b9e('0x30')][_0x9b9e('0x5e')]({'where':{'id':_0xb1d31b['params']['id']}})[_0x9b9e('0x27')](handleEntityNotFound(_0x484768,null))['then'](function(_0x1df951){if(_0x1df951){_0x3efec=_0x1df951;_0x197da9[_0x9b9e('0x32')]=_['keys'](db[_0x9b9e('0x62')][_0x9b9e('0x53')]);_0x197da9[_0x9b9e('0x33')]=_['keys'](_0xb1d31b[_0x9b9e('0x33')]);_0x197da9[_0x9b9e('0x34')]=_['intersection'](_0x197da9[_0x9b9e('0x32')],_0x197da9['query']);_0x11a5ac['attributes']=_[_0x9b9e('0x35')](_0x197da9[_0x9b9e('0x32')],qs[_0x9b9e('0x37')](_0xb1d31b[_0x9b9e('0x33')][_0x9b9e('0x37')]));_0x11a5ac[_0x9b9e('0x36')]=_0x11a5ac[_0x9b9e('0x36')][_0x9b9e('0x46')]?_0x11a5ac[_0x9b9e('0x36')]:_0x197da9[_0x9b9e('0x32')];_0x11a5ac[_0x9b9e('0x54')]=qs[_0x9b9e('0x3a')](_0xb1d31b[_0x9b9e('0x33')][_0x9b9e('0x3a')]);_0x11a5ac[_0x9b9e('0x3b')]=qs['filters'](_['pick'](_0xb1d31b[_0x9b9e('0x33')],_0x197da9[_0x9b9e('0x34')]));if(_0xb1d31b[_0x9b9e('0x33')]['filter']){_0x11a5ac[_0x9b9e('0x3b')]=_[_0x9b9e('0x3e')](_0x11a5ac['where'],{'$or':_[_0x9b9e('0x2f')](_0x11a5ac[_0x9b9e('0x36')],function(_0x22094c){var _0x864620={};_0x864620[_0x22094c]={'$like':'%'+_0xb1d31b[_0x9b9e('0x33')]['filter']+'%'};return _0x864620;})});}_0x11a5ac=_[_0x9b9e('0x3e')]({},_0x11a5ac,_0xb1d31b[_0x9b9e('0x40')]);return _0x3efec[_0x9b9e('0x83')](_0x11a5ac);}})[_0x9b9e('0x27')](function(_0xbd7c93){if(_0xbd7c93){_0x43064c=_0xbd7c93[_0x9b9e('0x46')];if(!_0xb1d31b[_0x9b9e('0x33')]['hasOwnProperty'](_0x9b9e('0x39'))){_0x11a5ac['limit']=qs[_0x9b9e('0x22')](_0xb1d31b[_0x9b9e('0x33')][_0x9b9e('0x22')]);_0x11a5ac[_0x9b9e('0x1f')]=qs[_0x9b9e('0x1f')](_0xb1d31b[_0x9b9e('0x33')][_0x9b9e('0x1f')]);}return _0x3efec[_0x9b9e('0x83')](_0x11a5ac);}})[_0x9b9e('0x27')](function(_0x2c687b){if(_0x2c687b){return _0x2c687b?{'count':_0x43064c,'rows':_0x2c687b}:null;}})[_0x9b9e('0x27')](respondWithResult(_0x484768,null))[_0x9b9e('0x43')](handleError(_0x484768,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c94377d..834383e 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 _0xd9b1=['FaxQueue','setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xd9b1,0xad));var _0x1d9b=function(_0x258031,_0x5a68dd){_0x258031=_0x258031-0x0;var _0x10eb7f=_0xd9b1[_0x258031];return _0x10eb7f;};'use strict';var EventEmitter=require(_0x1d9b('0x0'));var FaxQueue=require(_0x1d9b('0x1'))['db'][_0x1d9b('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1d9b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x98a1b7){return function(_0x15fb71,_0x1b0396,_0x3b3463){FaxQueueEvents[_0x1d9b('0x4')](_0x98a1b7+':'+_0x15fb71['id'],_0x15fb71);FaxQueueEvents[_0x1d9b('0x4')](_0x98a1b7,_0x15fb71);_0x3b3463(null);};}for(var e in events){if(events[_0x1d9b('0x5')](e)){var event=events[e];FaxQueue[_0x1d9b('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xf9a4=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update'];(function(_0x2a1350,_0x1120a3){var _0x53ef69=function(_0x4be3c6){while(--_0x4be3c6){_0x2a1350['push'](_0x2a1350['shift']());}};_0x53ef69(++_0x1120a3);}(_0xf9a4,0xa5));var _0x4f9a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf9a4[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x4f9a('0x0'));var FaxQueue=require(_0x4f9a('0x1'))['db'][_0x4f9a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4f9a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4f9a('0x4'),'afterDestroy':_0x4f9a('0x5')};function emitEvent(_0x2f11bc){return function(_0x9b8a91,_0x643f52,_0x3ba164){FaxQueueEvents[_0x4f9a('0x6')](_0x2f11bc+':'+_0x9b8a91['id'],_0x9b8a91);FaxQueueEvents['emit'](_0x2f11bc,_0x9b8a91);_0x3ba164(null);};}for(var e in events){if(events[_0x4f9a('0x7')](e)){var event=events[e];FaxQueue[_0x4f9a('0x8')](e,emitEvent(event));}}module[_0x4f9a('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index e6d518a..6fccc03 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 _0x5747=['exports','define','fax_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x34e223,_0x51a514){var _0x5411ca=function(_0x52306b){while(--_0x52306b){_0x34e223['push'](_0x34e223['shift']());}};_0x5411ca(++_0x51a514);}(_0x5747,0x1c6));var _0x7574=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x5747[_0x92c450];return _0x2a9599;};'use strict';var _=require('lodash');var util=require(_0x7574('0x0'));var logger=require('../../config/logger')(_0x7574('0x1'));var moment=require('moment');var BPromise=require(_0x7574('0x2'));var rp=require(_0x7574('0x3'));var fs=require('fs');var path=require(_0x7574('0x4'));var rimraf=require(_0x7574('0x5'));var config=require(_0x7574('0x6'));var attributes=require(_0x7574('0x7'));module[_0x7574('0x8')]=function(_0x3442b0,_0x3d5cec){return _0x3442b0[_0x7574('0x9')]('FaxQueue',attributes,{'tableName':_0x7574('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c9d=['api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger'];(function(_0x4b6f19,_0x234e56){var _0xba3216=function(_0x2f9dda){while(--_0x2f9dda){_0x4b6f19['push'](_0x4b6f19['shift']());}};_0xba3216(++_0x234e56);}(_0x8c9d,0xf4));var _0xd8c9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c9d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd8c9('0x0'));var util=require(_0xd8c9('0x1'));var logger=require(_0xd8c9('0x2'))(_0xd8c9('0x3'));var moment=require(_0xd8c9('0x4'));var BPromise=require(_0xd8c9('0x5'));var rp=require(_0xd8c9('0x6'));var fs=require('fs');var path=require(_0xd8c9('0x7'));var rimraf=require(_0xd8c9('0x8'));var config=require('../../config/environment');var attributes=require(_0xd8c9('0x9'));module[_0xd8c9('0xa')]=function(_0x2bb3e9,_0x4a7f1d){return _0x2bb3e9['define'](_0xd8c9('0xb'),attributes,{'tableName':_0xd8c9('0xc'),'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 160ce83..7c77e6b 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 _0x3172=['map','include','model','ShowFaxQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','options','raw','attributes'];(function(_0x355203,_0x1a59f0){var _0x20e921=function(_0x4e55ee){while(--_0x4e55ee){_0x355203['push'](_0x355203['shift']());}};_0x20e921(++_0x1a59f0);}(_0x3172,0x19d));var _0x2317=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x3172[_0x1fc84d];return _0x2658fa;};'use strict';var _=require(_0x2317('0x0'));var util=require('util');var moment=require(_0x2317('0x1'));var BPromise=require(_0x2317('0x2'));var rs=require(_0x2317('0x3'));var fs=require('fs');var Redis=require(_0x2317('0x4'));var db=require(_0x2317('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2317('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2317('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x2317('0x8')]=_[_0x2317('0x9')](config[_0x2317('0x8')],{'host':_0x2317('0xa'),'port':0x18eb});var socket=require(_0x2317('0xb'))(new Redis(config[_0x2317('0x8')]));require(_0x2317('0xc'))[_0x2317('0xd')](socket);function respondWithRpcPromise(_0x48ad05,_0x2908bd,_0x534ef5){return new BPromise(function(_0x319592,_0x1e2025){return client['request'](_0x48ad05,_0x534ef5)[_0x2317('0xe')](function(_0x33577d){logger[_0x2317('0xf')]('FaxQueue,\x20%s,\x20%s',_0x2908bd,_0x2317('0x10'));logger[_0x2317('0x11')](_0x2317('0x12'),_0x2908bd,'request\x20sent',JSON[_0x2317('0x13')](_0x33577d));if(_0x33577d[_0x2317('0x14')]){if(_0x33577d[_0x2317('0x14')][_0x2317('0x15')]===0x1f4){logger['error'](_0x2317('0x16'),_0x2908bd,_0x33577d[_0x2317('0x14')][_0x2317('0x17')]);return _0x1e2025(_0x33577d[_0x2317('0x14')][_0x2317('0x17')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x2908bd,_0x33577d[_0x2317('0x14')][_0x2317('0x17')]);return _0x319592(_0x33577d['error'][_0x2317('0x17')]);}else{logger[_0x2317('0xf')](_0x2317('0x16'),_0x2908bd,_0x2317('0x10'));_0x319592(_0x33577d[_0x2317('0x18')]['message']);}})[_0x2317('0x19')](function(_0x350e20){logger[_0x2317('0x14')](_0x2317('0x16'),_0x2908bd,_0x350e20);_0x1e2025(_0x350e20);});});}exports[_0x2317('0x1a')]=function(_0xf569d){var _0x39944d=this;return new Promise(function(_0x901741,_0x41f76f){return db[_0x2317('0x1b')]['findAll']({'raw':_0xf569d['options']?_0xf569d[_0x2317('0x1c')][_0x2317('0x1d')]===undefined?!![]:![]:!![],'where':_0xf569d[_0x2317('0x1c')]?_0xf569d['options']['where']||null:null,'attributes':_0xf569d['options']?_0xf569d[_0x2317('0x1c')][_0x2317('0x1e')]||null:null,'limit':_0xf569d[_0x2317('0x1c')]?_0xf569d['options']['limit']||null:null,'include':_0xf569d[_0x2317('0x1c')]?_0xf569d[_0x2317('0x1c')]['include']?_[_0x2317('0x1f')](_0xf569d[_0x2317('0x1c')][_0x2317('0x20')],function(_0x2efb87){return{'model':db[_0x2efb87[_0x2317('0x21')]],'as':_0x2efb87['as'],'attributes':_0x2efb87[_0x2317('0x1e')],'include':_0x2efb87[_0x2317('0x20')]?_[_0x2317('0x1f')](_0x2efb87[_0x2317('0x20')],function(_0xeee667){return{'model':db[_0xeee667[_0x2317('0x21')]],'as':_0xeee667['as'],'attributes':_0xeee667[_0x2317('0x1e')],'include':_0xeee667[_0x2317('0x20')]?_[_0x2317('0x1f')](_0xeee667['include'],function(_0x572628){return{'model':db[_0x572628[_0x2317('0x21')]],'as':_0x572628['as'],'attributes':_0x572628[_0x2317('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2317('0xe')](function(_0x190e02){logger[_0x2317('0xf')](_0x2317('0x1a'),_0xf569d);logger[_0x2317('0x11')](_0x2317('0x1a'),_0xf569d,JSON['stringify'](_0x190e02));_0x901741(_0x190e02);})['catch'](function(_0xf65e91){logger[_0x2317('0x14')](_0x2317('0x1a'),_0xf65e91['message'],_0xf569d);_0x41f76f(_0x39944d[_0x2317('0x14')](0x1f4,_0xf65e91['message']));});});};exports[_0x2317('0x22')]=function(_0xe15047){var _0x49cbd9=this;return new Promise(function(_0x571f4e,_0x59a618){return db[_0x2317('0x1b')][_0x2317('0x23')]({'raw':_0xe15047[_0x2317('0x1c')]?_0xe15047[_0x2317('0x1c')][_0x2317('0x1d')]===undefined?!![]:![]:!![],'where':_0xe15047[_0x2317('0x1c')]?_0xe15047[_0x2317('0x1c')][_0x2317('0x24')]||null:null,'attributes':_0xe15047[_0x2317('0x1c')]?_0xe15047['options'][_0x2317('0x1e')]||null:null,'include':_0xe15047[_0x2317('0x1c')]?_0xe15047['options']['include']?_[_0x2317('0x1f')](_0xe15047[_0x2317('0x1c')][_0x2317('0x20')],function(_0x17c88a){return{'model':db[_0x17c88a[_0x2317('0x21')]],'as':_0x17c88a['as'],'attributes':_0x17c88a[_0x2317('0x1e')],'include':_0x17c88a[_0x2317('0x20')]?_['map'](_0x17c88a[_0x2317('0x20')],function(_0x36443f){return{'model':db[_0x36443f[_0x2317('0x21')]],'as':_0x36443f['as'],'attributes':_0x36443f['attributes'],'include':_0x36443f[_0x2317('0x20')]?_[_0x2317('0x1f')](_0x36443f[_0x2317('0x20')],function(_0x58d7c1){return{'model':db[_0x58d7c1['model']],'as':_0x58d7c1['as'],'attributes':_0x58d7c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xea677e){logger[_0x2317('0xf')]('ShowFaxQueue',_0xe15047);logger['debug'](_0x2317('0x22'),_0xe15047,JSON['stringify'](_0xea677e));_0x571f4e(_0xea677e);})['catch'](function(_0x41ae38){logger[_0x2317('0x14')](_0x2317('0x22'),_0x41ae38[_0x2317('0x17')],_0xe15047);_0x59a618(_0x49cbd9[_0x2317('0x14')](0x1f4,_0x41ae38[_0x2317('0x17')]));});});}; \ No newline at end of file +var _0x85ca=['stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowFaxQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x564531,_0x52013c){var _0x4b2e78=function(_0x101ee6){while(--_0x101ee6){_0x564531['push'](_0x564531['shift']());}};_0x4b2e78(++_0x52013c);}(_0x85ca,0x133));var _0xa85c=function(_0xc34460,_0x5a8745){_0xc34460=_0xc34460-0x0;var _0x15ac3e=_0x85ca[_0xc34460];return _0x15ac3e;};'use strict';var _=require(_0xa85c('0x0'));var util=require(_0xa85c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa85c('0x2'));var fs=require('fs');var Redis=require(_0xa85c('0x3'));var db=require(_0xa85c('0x4'))['db'];var utils=require(_0xa85c('0x5'));var logger=require(_0xa85c('0x6'))(_0xa85c('0x7'));var config=require(_0xa85c('0x8'));var jayson=require(_0xa85c('0x9'));var client=jayson[_0xa85c('0xa')][_0xa85c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa85c('0xc'),'port':0x18eb});var socket=require(_0xa85c('0xd'))(new Redis(config[_0xa85c('0xe')]));require(_0xa85c('0xf'))[_0xa85c('0x10')](socket);function respondWithRpcPromise(_0x1d4345,_0xc01e2c,_0x475aae){return new BPromise(function(_0x49e616,_0x48fd1f){return client[_0xa85c('0x11')](_0x1d4345,_0x475aae)['then'](function(_0x501361){logger['info'](_0xa85c('0x12'),_0xc01e2c,_0xa85c('0x13'));logger[_0xa85c('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0xc01e2c,_0xa85c('0x13'),JSON[_0xa85c('0x15')](_0x501361));if(_0x501361[_0xa85c('0x16')]){if(_0x501361[_0xa85c('0x16')][_0xa85c('0x17')]===0x1f4){logger[_0xa85c('0x16')](_0xa85c('0x12'),_0xc01e2c,_0x501361['error'][_0xa85c('0x18')]);return _0x48fd1f(_0x501361[_0xa85c('0x16')][_0xa85c('0x18')]);}logger['error'](_0xa85c('0x12'),_0xc01e2c,_0x501361[_0xa85c('0x16')][_0xa85c('0x18')]);return _0x49e616(_0x501361[_0xa85c('0x16')][_0xa85c('0x18')]);}else{logger[_0xa85c('0x19')]('FaxQueue,\x20%s,\x20%s',_0xc01e2c,'request\x20sent');_0x49e616(_0x501361[_0xa85c('0x1a')][_0xa85c('0x18')]);}})[_0xa85c('0x1b')](function(_0x4eaaf8){logger['error'](_0xa85c('0x12'),_0xc01e2c,_0x4eaaf8);_0x48fd1f(_0x4eaaf8);});});}exports[_0xa85c('0x1c')]=function(_0x9132c0){var _0x1de718=this;return new Promise(function(_0x148757,_0xd81213){return db[_0xa85c('0x1d')][_0xa85c('0x1e')]({'raw':_0x9132c0[_0xa85c('0x1f')]?_0x9132c0[_0xa85c('0x1f')][_0xa85c('0x20')]===undefined?!![]:![]:!![],'where':_0x9132c0[_0xa85c('0x1f')]?_0x9132c0[_0xa85c('0x1f')][_0xa85c('0x21')]||null:null,'attributes':_0x9132c0[_0xa85c('0x1f')]?_0x9132c0[_0xa85c('0x1f')][_0xa85c('0x22')]||null:null,'limit':_0x9132c0[_0xa85c('0x1f')]?_0x9132c0['options'][_0xa85c('0x23')]||null:null,'include':_0x9132c0[_0xa85c('0x1f')]?_0x9132c0[_0xa85c('0x1f')][_0xa85c('0x24')]?_[_0xa85c('0x25')](_0x9132c0[_0xa85c('0x1f')]['include'],function(_0x4d3125){return{'model':db[_0x4d3125[_0xa85c('0x26')]],'as':_0x4d3125['as'],'attributes':_0x4d3125[_0xa85c('0x22')],'include':_0x4d3125['include']?_[_0xa85c('0x25')](_0x4d3125['include'],function(_0xbfa93f){return{'model':db[_0xbfa93f['model']],'as':_0xbfa93f['as'],'attributes':_0xbfa93f[_0xa85c('0x22')],'include':_0xbfa93f[_0xa85c('0x24')]?_[_0xa85c('0x25')](_0xbfa93f[_0xa85c('0x24')],function(_0x4c6043){return{'model':db[_0x4c6043[_0xa85c('0x26')]],'as':_0x4c6043['as'],'attributes':_0x4c6043[_0xa85c('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa85c('0x27')](function(_0x4a7b14){logger[_0xa85c('0x19')](_0xa85c('0x1c'),_0x9132c0);logger[_0xa85c('0x14')]('GetFaxQueue',_0x9132c0,JSON[_0xa85c('0x15')](_0x4a7b14));_0x148757(_0x4a7b14);})[_0xa85c('0x1b')](function(_0x1e6684){logger[_0xa85c('0x16')](_0xa85c('0x1c'),_0x1e6684[_0xa85c('0x18')],_0x9132c0);_0xd81213(_0x1de718[_0xa85c('0x16')](0x1f4,_0x1e6684['message']));});});};exports[_0xa85c('0x28')]=function(_0x124168){var _0x1a8c6c=this;return new Promise(function(_0x15b0c3,_0x536110){return db[_0xa85c('0x1d')]['find']({'raw':_0x124168[_0xa85c('0x1f')]?_0x124168[_0xa85c('0x1f')][_0xa85c('0x20')]===undefined?!![]:![]:!![],'where':_0x124168['options']?_0x124168[_0xa85c('0x1f')][_0xa85c('0x21')]||null:null,'attributes':_0x124168[_0xa85c('0x1f')]?_0x124168['options']['attributes']||null:null,'include':_0x124168[_0xa85c('0x1f')]?_0x124168['options'][_0xa85c('0x24')]?_[_0xa85c('0x25')](_0x124168[_0xa85c('0x1f')][_0xa85c('0x24')],function(_0x1ba6ab){return{'model':db[_0x1ba6ab[_0xa85c('0x26')]],'as':_0x1ba6ab['as'],'attributes':_0x1ba6ab[_0xa85c('0x22')],'include':_0x1ba6ab[_0xa85c('0x24')]?_[_0xa85c('0x25')](_0x1ba6ab['include'],function(_0x4b09ed){return{'model':db[_0x4b09ed['model']],'as':_0x4b09ed['as'],'attributes':_0x4b09ed[_0xa85c('0x22')],'include':_0x4b09ed[_0xa85c('0x24')]?_[_0xa85c('0x25')](_0x4b09ed[_0xa85c('0x24')],function(_0x2c9de9){return{'model':db[_0x2c9de9['model']],'as':_0x2c9de9['as'],'attributes':_0x2c9de9[_0xa85c('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa85c('0x27')](function(_0x478ce1){logger[_0xa85c('0x19')](_0xa85c('0x28'),_0x124168);logger[_0xa85c('0x14')](_0xa85c('0x28'),_0x124168,JSON['stringify'](_0x478ce1));_0x15b0c3(_0x478ce1);})['catch'](function(_0x28ce8b){logger[_0xa85c('0x16')]('ShowFaxQueue',_0x28ce8b[_0xa85c('0x18')],_0x124168);_0x536110(_0x1a8c6c['error'](0x1f4,_0x28ce8b[_0xa85c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5c5b89d..8db3a6e 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 _0x31aa=['save','update','emit','removeListener','register','faxQueue:'];(function(_0x1f988b,_0x5184ef){var _0x391022=function(_0x580c9b){while(--_0x580c9b){_0x1f988b['push'](_0x1f988b['shift']());}};_0x391022(++_0x5184ef);}(_0x31aa,0x198));var _0xa31a=function(_0x51bdc0,_0x400958){_0x51bdc0=_0x51bdc0-0x0;var _0xb906d9=_0x31aa[_0x51bdc0];return _0xb906d9;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xa31a('0x0'),'remove',_0xa31a('0x1')];function createListener(_0xbaad1e,_0x149039){return function(_0x8430ac){_0x149039[_0xa31a('0x2')](_0xbaad1e,_0x8430ac);};}function removeListener(_0x13c2ba,_0x4164f7){return function(){FaxQueueEvents[_0xa31a('0x3')](_0x13c2ba,_0x4164f7);};}exports[_0xa31a('0x4')]=function(_0x4f81c5){for(var _0x1d161d=0x0,_0x41abce=events['length'];_0x1d161d<_0x41abce;_0x1d161d++){var _0x228e15=events[_0x1d161d];var _0x3775c7=createListener(_0xa31a('0x5')+_0x228e15,_0x4f81c5);FaxQueueEvents['on'](_0x228e15,_0x3775c7);}}; \ No newline at end of file +var _0x8302=['register','length','faxQueue:','save','update','removeListener'];(function(_0xda443b,_0x12485e){var _0x1c9da2=function(_0x23568b){while(--_0x23568b){_0xda443b['push'](_0xda443b['shift']());}};_0x1c9da2(++_0x12485e);}(_0x8302,0x1bf));var _0x2830=function(_0x3732e1,_0x304dc1){_0x3732e1=_0x3732e1-0x0;var _0x51e120=_0x8302[_0x3732e1];return _0x51e120;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x2830('0x0'),'remove',_0x2830('0x1')];function createListener(_0x33a842,_0x18458e){return function(_0xa8b044){_0x18458e['emit'](_0x33a842,_0xa8b044);};}function removeListener(_0x3591e3,_0x284db8){return function(){FaxQueueEvents[_0x2830('0x2')](_0x3591e3,_0x284db8);};}exports[_0x2830('0x3')]=function(_0x172e0a){for(var _0x122d4f=0x0,_0x3b378b=events[_0x2830('0x4')];_0x122d4f<_0x3b378b;_0x122d4f++){var _0x526bb3=events[_0x122d4f];var _0xab7508=createListener(_0x2830('0x5')+_0x526bb3,_0x172e0a);FaxQueueEvents['on'](_0x526bb3,_0xab7508);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4ee6aae..de4dac2 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 _0x1b65=['/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index'];(function(_0x5269e3,_0x556de1){var _0x1bf31a=function(_0x4f234c){while(--_0x4f234c){_0x5269e3['push'](_0x5269e3['shift']());}};_0x1bf31a(++_0x556de1);}(_0x1b65,0x1b4));var _0x51b6=function(_0x4748a2,_0x5d04bd){_0x4748a2=_0x4748a2-0x0;var _0x16c342=_0x1b65[_0x4748a2];return _0x16c342;};'use strict';var multer=require(_0x51b6('0x0'));var util=require(_0x51b6('0x1'));var path=require(_0x51b6('0x2'));var timeout=require(_0x51b6('0x3'));var express=require('express');var router=express[_0x51b6('0x4')]();var fs_extra=require(_0x51b6('0x5'));var auth=require(_0x51b6('0x6'));var interaction=require(_0x51b6('0x7'));var config=require(_0x51b6('0x8'));var controller=require(_0x51b6('0x9'));router[_0x51b6('0xa')]('/',auth['isAuthenticated'](),controller[_0x51b6('0xb')]);router[_0x51b6('0xa')](_0x51b6('0xc'),auth[_0x51b6('0xd')](),controller['describe']);router[_0x51b6('0xa')](_0x51b6('0xe'),auth['isAuthenticated'](),controller[_0x51b6('0xf')]);router['get']('/:id/members',auth[_0x51b6('0xd')](),controller[_0x51b6('0x10')]);router[_0x51b6('0xa')](_0x51b6('0x11'),auth[_0x51b6('0xd')](),controller['getTeams']);router['get'](_0x51b6('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x51b6('0x13')]('/',auth['isAuthenticated'](),controller[_0x51b6('0x14')]);router['post'](_0x51b6('0x11'),auth[_0x51b6('0xd')](),controller[_0x51b6('0x15')]);router[_0x51b6('0x13')](_0x51b6('0x12'),auth[_0x51b6('0xd')](),controller['addAgents']);router[_0x51b6('0x16')](_0x51b6('0xe'),auth[_0x51b6('0xd')](),controller['update']);router[_0x51b6('0x17')]('/:id',auth[_0x51b6('0xd')](),controller[_0x51b6('0x18')]);router[_0x51b6('0x17')](_0x51b6('0x11'),auth[_0x51b6('0xd')](),controller[_0x51b6('0x19')]);router['delete'](_0x51b6('0x12'),auth['isAuthenticated'](),controller[_0x51b6('0x1a')]);module[_0x51b6('0x1b')]=router; \ No newline at end of file +var _0x66fa=['delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','/:id'];(function(_0x107089,_0x2e2947){var _0x4b6722=function(_0x34bd04){while(--_0x34bd04){_0x107089['push'](_0x107089['shift']());}};_0x4b6722(++_0x2e2947);}(_0x66fa,0x117));var _0xa66f=function(_0x14528b,_0x2c3c19){_0x14528b=_0x14528b-0x0;var _0x3f050f=_0x66fa[_0x14528b];return _0x3f050f;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xa66f('0xb')](_0xa66f('0xd'),auth['isAuthenticated'](),controller[_0xa66f('0xe')]);router['get'](_0xa66f('0xf'),auth['isAuthenticated'](),controller[_0xa66f('0x10')]);router[_0xa66f('0x11')]('/',auth[_0xa66f('0x9')](),controller['create']);router['post'](_0xa66f('0xd'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xa66f('0xf'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x12')]);router[_0xa66f('0x13')](_0xa66f('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xa66f('0x15')](_0xa66f('0x14'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x16')]);router['delete'](_0xa66f('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xa66f('0x15')](_0xa66f('0xf'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x17')]);module[_0xa66f('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 05f06b9..e10029e 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 _0xe362=['moment','exports','STRING','DATE'];(function(_0x1e2153,_0x500d02){var _0x16726a=function(_0x1802d5){while(--_0x1802d5){_0x1e2153['push'](_0x1e2153['shift']());}};_0x16726a(++_0x500d02);}(_0xe362,0x194));var _0x2e36=function(_0x21aca7,_0x547646){_0x21aca7=_0x21aca7-0x0;var _0x4eba0e=_0xe362[_0x21aca7];return _0x4eba0e;};'use strict';var moment=require(_0x2e36('0x0'));var Sequelize=require('sequelize');module[_0x2e36('0x1')]={'uniqueid':{'type':Sequelize[_0x2e36('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2e36('0x3')]},'leaveAt':{'type':Sequelize[_0x2e36('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa43a=['STRING','DATE','moment','sequelize','exports'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0xa43a,0xe3));var _0xaa43=function(_0x2874d8,_0x487ede){_0x2874d8=_0x2874d8-0x0;var _0x262fb6=_0xa43a[_0x2874d8];return _0x262fb6;};'use strict';var moment=require(_0xaa43('0x0'));var Sequelize=require(_0xaa43('0x1'));module[_0xaa43('0x2')]={'uniqueid':{'type':Sequelize[_0xaa43('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xaa43('0x3')]},'joinAt':{'type':Sequelize[_0xaa43('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xaa43('0x4')]},'exitAt':{'type':Sequelize[_0xaa43('0x4')]},'reason':{'type':Sequelize[_0xaa43('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a7d5903..738a1c8 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 _0xb634=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../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','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','filter','where','VIRTUAL','merge','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir'];(function(_0x54e337,_0x19d256){var _0x5f1c5c=function(_0x20bf83){while(--_0x20bf83){_0x54e337['push'](_0x54e337['shift']());}};_0x5f1c5c(++_0x19d256);}(_0xb634,0x1c0));var _0x4b63=function(_0x50c03d,_0x39cd34){_0x50c03d=_0x50c03d-0x0;var _0x5f32e3=_0xb634[_0x50c03d];return _0x5f32e3;};'use strict';var emlformat=require(_0x4b63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b63('0x1'));var jsonpatch=require(_0x4b63('0x2'));var rp=require(_0x4b63('0x3'));var moment=require('moment');var BPromise=require(_0x4b63('0x4'));var Mustache=require(_0x4b63('0x5'));var util=require(_0x4b63('0x6'));var path=require(_0x4b63('0x7'));var sox=require(_0x4b63('0x8'));var csv=require(_0x4b63('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b63('0xa'));var squel=require('squel');var crypto=require(_0x4b63('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b63('0xc'));var toCsv=require(_0x4b63('0x9'));var querystring=require('querystring');var Papa=require(_0x4b63('0xd'));var Redis=require(_0x4b63('0xe'));var authService=require(_0x4b63('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4b63('0x10'));var hardwareService=require(_0x4b63('0x11'));var logger=require(_0x4b63('0x12'))(_0x4b63('0x13'));var utils=require(_0x4b63('0x14'));var config=require(_0x4b63('0x15'));var licenseUtil=require(_0x4b63('0x16'));var db=require(_0x4b63('0x17'))['db'];function respondWithStatusCode(_0x2cb7fe,_0x2d4985){_0x2d4985=_0x2d4985||0xcc;return function(_0x121bfd){if(_0x121bfd){return _0x2cb7fe[_0x4b63('0x18')](_0x2d4985);}return _0x2cb7fe['status'](_0x2d4985)[_0x4b63('0x19')]();};}function respondWithResult(_0x3e4574,_0x35a5fb){_0x35a5fb=_0x35a5fb||0xc8;return function(_0x1d0374){if(_0x1d0374){return _0x3e4574[_0x4b63('0x1a')](_0x35a5fb)[_0x4b63('0x1b')](_0x1d0374);}};}function respondWithFilteredResult(_0x3e7c87,_0x5c94c6){return function(_0x975c4b){if(_0x975c4b){var _0x49709e=typeof _0x5c94c6[_0x4b63('0x1c')]===_0x4b63('0x1d')&&typeof _0x5c94c6[_0x4b63('0x1e')]===_0x4b63('0x1d');var _0x197498=_0x975c4b[_0x4b63('0x1f')];var _0x1e488c=_0x49709e?0x0:_0x5c94c6['offset'];var _0x523863=_0x49709e?_0x975c4b[_0x4b63('0x1f')]:_0x5c94c6['offset']+_0x5c94c6[_0x4b63('0x1e')];var _0x4021cf;if(_0x523863>=_0x197498){_0x523863=_0x197498;_0x4021cf=0xc8;}else{_0x4021cf=0xce;}_0x3e7c87[_0x4b63('0x1a')](_0x4021cf);return _0x3e7c87['set'](_0x4b63('0x20'),_0x1e488c+'-'+_0x523863+'/'+_0x197498)[_0x4b63('0x1b')](_0x975c4b);}return null;};}function patchUpdates(_0x57c5f4){return function(_0x59a3d2){try{jsonpatch[_0x4b63('0x21')](_0x59a3d2,_0x57c5f4,!![]);}catch(_0x4282f6){return BPromise[_0x4b63('0x22')](_0x4282f6);}return _0x59a3d2[_0x4b63('0x23')]();};}function saveUpdates(_0xe1461e,_0x167337){return function(_0x2350dc){if(_0x2350dc){return _0x2350dc[_0x4b63('0x24')](_0xe1461e)[_0x4b63('0x25')](function(_0x10f8e7){return _0x10f8e7;});}return null;};}function removeEntity(_0xacb37a,_0x269faf){return function(_0x8940d6){if(_0x8940d6){return _0x8940d6[_0x4b63('0x26')]()['then'](function(){_0xacb37a[_0x4b63('0x1a')](0xcc)[_0x4b63('0x19')]();});}};}function handleEntityNotFound(_0x444860,_0x26b6f9){return function(_0x11326d){if(!_0x11326d){_0x444860['sendStatus'](0x194);}return _0x11326d;};}function handleError(_0xab6ac8,_0x495478){_0x495478=_0x495478||0x1f4;return function(_0x417d92){logger[_0x4b63('0x27')](_0x417d92['stack']);if(_0x417d92['name']){delete _0x417d92[_0x4b63('0x28')];}_0xab6ac8[_0x4b63('0x1a')](_0x495478)[_0x4b63('0x29')](_0x417d92);};}exports[_0x4b63('0x2a')]=function(_0x8852f1,_0x208af0){var _0x1e7ed0={},_0x5a9648={},_0x310ab0={'count':0x0,'rows':[]};var _0x56497c=_['map'](db['FaxQueueReport']['rawAttributes'],function(_0x5a28b7){return{'name':_0x5a28b7[_0x4b63('0x2b')],'type':_0x5a28b7[_0x4b63('0x2c')][_0x4b63('0x2d')]};});_0x5a9648[_0x4b63('0x2e')]=_[_0x4b63('0x2f')](_0x56497c,_0x4b63('0x28'));_0x5a9648['query']=_[_0x4b63('0x30')](_0x8852f1['query']);_0x5a9648[_0x4b63('0x31')]=_[_0x4b63('0x32')](_0x5a9648[_0x4b63('0x2e')],_0x5a9648[_0x4b63('0x33')]);_0x1e7ed0[_0x4b63('0x34')]=_[_0x4b63('0x32')](_0x5a9648['model'],qs[_0x4b63('0x35')](_0x8852f1['query']['fields']));_0x1e7ed0[_0x4b63('0x34')]=_0x1e7ed0[_0x4b63('0x34')][_0x4b63('0x36')]?_0x1e7ed0['attributes']:_0x5a9648[_0x4b63('0x2e')];if(!_0x8852f1['query'][_0x4b63('0x37')](_0x4b63('0x38'))){_0x1e7ed0['limit']=qs[_0x4b63('0x1e')](_0x8852f1['query'][_0x4b63('0x1e')]);_0x1e7ed0['offset']=qs[_0x4b63('0x1c')](_0x8852f1[_0x4b63('0x33')][_0x4b63('0x1c')]);}_0x1e7ed0['order']=qs['sort'](_0x8852f1[_0x4b63('0x33')]['sort']);_0x1e7ed0['where']=qs[_0x4b63('0x31')](_['pick'](_0x8852f1[_0x4b63('0x33')],_0x5a9648[_0x4b63('0x31')]),_0x56497c);if(_0x8852f1[_0x4b63('0x33')][_0x4b63('0x39')]){_0x1e7ed0[_0x4b63('0x3a')]=_['merge'](_0x1e7ed0[_0x4b63('0x3a')],{'$or':_['map'](_0x56497c,function(_0x36e706){if(_0x36e706[_0x4b63('0x2c')]!==_0x4b63('0x3b')){var _0x315dc6={};_0x315dc6[_0x36e706[_0x4b63('0x28')]]={'$like':'%'+_0x8852f1[_0x4b63('0x33')][_0x4b63('0x39')]+'%'};return _0x315dc6;}})});}_0x1e7ed0=_[_0x4b63('0x3c')]({},_0x1e7ed0,_0x8852f1[_0x4b63('0x3d')]);var _0x3c0930={'where':_0x1e7ed0[_0x4b63('0x3a')]};return db[_0x4b63('0x3e')][_0x4b63('0x1f')](_0x3c0930)[_0x4b63('0x25')](function(_0x1b27b4){_0x310ab0['count']=_0x1b27b4;if(_0x8852f1['query'][_0x4b63('0x3f')]){_0x1e7ed0[_0x4b63('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x4b63('0x41')](_0x1e7ed0);})[_0x4b63('0x25')](function(_0x3ef21e){_0x310ab0[_0x4b63('0x42')]=_0x3ef21e;return _0x310ab0;})[_0x4b63('0x25')](respondWithFilteredResult(_0x208af0,_0x1e7ed0))[_0x4b63('0x43')](handleError(_0x208af0,null));};exports[_0x4b63('0x44')]=function(_0x2ff9cd,_0x26a22c){var _0x5ebe9c={'raw':!![],'where':{'id':_0x2ff9cd['params']['id']}},_0x45cc94={};_0x45cc94[_0x4b63('0x2e')]=_['keys'](db[_0x4b63('0x3e')][_0x4b63('0x45')]);_0x45cc94[_0x4b63('0x33')]=_[_0x4b63('0x30')](_0x2ff9cd[_0x4b63('0x33')]);_0x45cc94[_0x4b63('0x31')]=_[_0x4b63('0x32')](_0x45cc94[_0x4b63('0x2e')],_0x45cc94['query']);_0x5ebe9c[_0x4b63('0x34')]=_[_0x4b63('0x32')](_0x45cc94[_0x4b63('0x2e')],qs[_0x4b63('0x35')](_0x2ff9cd[_0x4b63('0x33')][_0x4b63('0x35')]));_0x5ebe9c[_0x4b63('0x34')]=_0x5ebe9c[_0x4b63('0x34')][_0x4b63('0x36')]?_0x5ebe9c[_0x4b63('0x34')]:_0x45cc94[_0x4b63('0x2e')];if(_0x2ff9cd[_0x4b63('0x33')][_0x4b63('0x3f')]){_0x5ebe9c['include']=[{'all':!![]}];}_0x5ebe9c=_[_0x4b63('0x3c')]({},_0x5ebe9c,_0x2ff9cd[_0x4b63('0x3d')]);return db['FaxQueueReport'][_0x4b63('0x46')](_0x5ebe9c)['then'](handleEntityNotFound(_0x26a22c,null))[_0x4b63('0x25')](respondWithResult(_0x26a22c,null))[_0x4b63('0x43')](handleError(_0x26a22c,null));};exports[_0x4b63('0x47')]=function(_0x1c8b9d,_0x403f46){return db[_0x4b63('0x3e')][_0x4b63('0x47')](_0x1c8b9d[_0x4b63('0x48')],{})[_0x4b63('0x25')](respondWithResult(_0x403f46,0xc9))[_0x4b63('0x43')](handleError(_0x403f46,null));};exports[_0x4b63('0x24')]=function(_0x130ca2,_0x35f4cf){if(_0x130ca2['body']['id']){delete _0x130ca2['body']['id'];}return db[_0x4b63('0x3e')]['find']({'where':{'id':_0x130ca2[_0x4b63('0x49')]['id']}})[_0x4b63('0x25')](handleEntityNotFound(_0x35f4cf,null))[_0x4b63('0x25')](saveUpdates(_0x130ca2[_0x4b63('0x48')],null))['then'](respondWithResult(_0x35f4cf,null))[_0x4b63('0x43')](handleError(_0x35f4cf,null));};exports[_0x4b63('0x26')]=function(_0x10cfdb,_0xf07322){return db['FaxQueueReport'][_0x4b63('0x46')]({'where':{'id':_0x10cfdb[_0x4b63('0x49')]['id']}})[_0x4b63('0x25')](handleEntityNotFound(_0xf07322,null))['then'](removeEntity(_0xf07322,null))[_0x4b63('0x43')](handleError(_0xf07322,null));};exports[_0x4b63('0x4a')]=function(_0x58b70e,_0x5dd48a){return db[_0x4b63('0x3e')][_0x4b63('0x4a')]()[_0x4b63('0x25')](respondWithResult(_0x5dd48a,null))[_0x4b63('0x43')](handleError(_0x5dd48a,null));}; \ No newline at end of file +var _0x279d=['include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','includeAll'];(function(_0x248841,_0x1ea103){var _0x29eaf7=function(_0x1b3a04){while(--_0x1b3a04){_0x248841['push'](_0x248841['shift']());}};_0x29eaf7(++_0x1ea103);}(_0x279d,0x1d8));var _0xd279=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x279d[_0x46d0c9];return _0x174506;};'use strict';var emlformat=require(_0xd279('0x0'));var rimraf=require(_0xd279('0x1'));var zipdir=require(_0xd279('0x2'));var jsonpatch=require(_0xd279('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd279('0x4'));var Mustache=require(_0xd279('0x5'));var util=require('util');var path=require(_0xd279('0x6'));var sox=require(_0xd279('0x7'));var csv=require(_0xd279('0x8'));var ejs=require(_0xd279('0x9'));var fs=require('fs');var fs_extra=require(_0xd279('0xa'));var _=require(_0xd279('0xb'));var squel=require(_0xd279('0xc'));var crypto=require('crypto');var jsforce=require(_0xd279('0xd'));var deskjs=require(_0xd279('0xe'));var toCsv=require(_0xd279('0x8'));var querystring=require(_0xd279('0xf'));var Papa=require(_0xd279('0x10'));var Redis=require(_0xd279('0x11'));var authService=require(_0xd279('0x12'));var qs=require(_0xd279('0x13'));var as=require(_0xd279('0x14'));var hardwareService=require(_0xd279('0x15'));var logger=require(_0xd279('0x16'))('api');var utils=require(_0xd279('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd279('0x18'));var db=require(_0xd279('0x19'))['db'];function respondWithStatusCode(_0x5056bd,_0xeb0828){_0xeb0828=_0xeb0828||0xcc;return function(_0x54f78b){if(_0x54f78b){return _0x5056bd['sendStatus'](_0xeb0828);}return _0x5056bd[_0xd279('0x1a')](_0xeb0828)['end']();};}function respondWithResult(_0x426d48,_0x5c3b48){_0x5c3b48=_0x5c3b48||0xc8;return function(_0x2bf8e3){if(_0x2bf8e3){return _0x426d48[_0xd279('0x1a')](_0x5c3b48)[_0xd279('0x1b')](_0x2bf8e3);}};}function respondWithFilteredResult(_0x1161b3,_0x5c1c0f){return function(_0x55b3c5){if(_0x55b3c5){var _0x20db5d=typeof _0x5c1c0f[_0xd279('0x1c')]===_0xd279('0x1d')&&typeof _0x5c1c0f[_0xd279('0x1e')]==='undefined';var _0x5701c0=_0x55b3c5['count'];var _0x5a52fd=_0x20db5d?0x0:_0x5c1c0f['offset'];var _0x1394bb=_0x20db5d?_0x55b3c5[_0xd279('0x1f')]:_0x5c1c0f['offset']+_0x5c1c0f[_0xd279('0x1e')];var _0xd3b5d3;if(_0x1394bb>=_0x5701c0){_0x1394bb=_0x5701c0;_0xd3b5d3=0xc8;}else{_0xd3b5d3=0xce;}_0x1161b3[_0xd279('0x1a')](_0xd3b5d3);return _0x1161b3[_0xd279('0x20')]('Content-Range',_0x5a52fd+'-'+_0x1394bb+'/'+_0x5701c0)[_0xd279('0x1b')](_0x55b3c5);}return null;};}function patchUpdates(_0x2be01c){return function(_0x5577fc){try{jsonpatch[_0xd279('0x21')](_0x5577fc,_0x2be01c,!![]);}catch(_0x395762){return BPromise[_0xd279('0x22')](_0x395762);}return _0x5577fc[_0xd279('0x23')]();};}function saveUpdates(_0x533ceb,_0x36fd44){return function(_0x2716f4){if(_0x2716f4){return _0x2716f4[_0xd279('0x24')](_0x533ceb)['then'](function(_0x7683bc){return _0x7683bc;});}return null;};}function removeEntity(_0x1a06e7,_0x3a9e73){return function(_0x307599){if(_0x307599){return _0x307599[_0xd279('0x25')]()[_0xd279('0x26')](function(){_0x1a06e7[_0xd279('0x1a')](0xcc)[_0xd279('0x27')]();});}};}function handleEntityNotFound(_0x440293,_0x48f1b1){return function(_0x53e0f6){if(!_0x53e0f6){_0x440293[_0xd279('0x28')](0x194);}return _0x53e0f6;};}function handleError(_0x299c67,_0x563637){_0x563637=_0x563637||0x1f4;return function(_0x46a162){logger[_0xd279('0x29')](_0x46a162[_0xd279('0x2a')]);if(_0x46a162[_0xd279('0x2b')]){delete _0x46a162['name'];}_0x299c67[_0xd279('0x1a')](_0x563637)[_0xd279('0x2c')](_0x46a162);};}exports['index']=function(_0x43aacd,_0x577102){var _0x159ea4={},_0x2347ed={},_0x3e64f6={'count':0x0,'rows':[]};var _0x47175a=_[_0xd279('0x2d')](db[_0xd279('0x2e')][_0xd279('0x2f')],function(_0x36041f){return{'name':_0x36041f[_0xd279('0x30')],'type':_0x36041f['type'][_0xd279('0x31')]};});_0x2347ed[_0xd279('0x32')]=_[_0xd279('0x2d')](_0x47175a,_0xd279('0x2b'));_0x2347ed[_0xd279('0x33')]=_[_0xd279('0x34')](_0x43aacd[_0xd279('0x33')]);_0x2347ed[_0xd279('0x35')]=_[_0xd279('0x36')](_0x2347ed['model'],_0x2347ed['query']);_0x159ea4[_0xd279('0x37')]=_[_0xd279('0x36')](_0x2347ed[_0xd279('0x32')],qs[_0xd279('0x38')](_0x43aacd['query'][_0xd279('0x38')]));_0x159ea4[_0xd279('0x37')]=_0x159ea4[_0xd279('0x37')][_0xd279('0x39')]?_0x159ea4['attributes']:_0x2347ed[_0xd279('0x32')];if(!_0x43aacd[_0xd279('0x33')][_0xd279('0x3a')]('nolimit')){_0x159ea4[_0xd279('0x1e')]=qs['limit'](_0x43aacd[_0xd279('0x33')]['limit']);_0x159ea4[_0xd279('0x1c')]=qs[_0xd279('0x1c')](_0x43aacd['query'][_0xd279('0x1c')]);}_0x159ea4[_0xd279('0x3b')]=qs[_0xd279('0x3c')](_0x43aacd['query'][_0xd279('0x3c')]);_0x159ea4[_0xd279('0x3d')]=qs[_0xd279('0x35')](_[_0xd279('0x3e')](_0x43aacd[_0xd279('0x33')],_0x2347ed[_0xd279('0x35')]),_0x47175a);if(_0x43aacd['query']['filter']){_0x159ea4[_0xd279('0x3d')]=_[_0xd279('0x3f')](_0x159ea4[_0xd279('0x3d')],{'$or':_[_0xd279('0x2d')](_0x47175a,function(_0x1b272b){if(_0x1b272b[_0xd279('0x40')]!=='VIRTUAL'){var _0x2463b1={};_0x2463b1[_0x1b272b['name']]={'$like':'%'+_0x43aacd[_0xd279('0x33')][_0xd279('0x41')]+'%'};return _0x2463b1;}})});}_0x159ea4=_['merge']({},_0x159ea4,_0x43aacd['options']);var _0x37837c={'where':_0x159ea4[_0xd279('0x3d')]};return db[_0xd279('0x2e')][_0xd279('0x1f')](_0x37837c)['then'](function(_0x457dfb){_0x3e64f6['count']=_0x457dfb;if(_0x43aacd[_0xd279('0x33')][_0xd279('0x42')]){_0x159ea4[_0xd279('0x43')]=[{'all':!![]}];}return db[_0xd279('0x2e')]['findAll'](_0x159ea4);})['then'](function(_0x3084f5){_0x3e64f6[_0xd279('0x44')]=_0x3084f5;return _0x3e64f6;})[_0xd279('0x26')](respondWithFilteredResult(_0x577102,_0x159ea4))[_0xd279('0x45')](handleError(_0x577102,null));};exports[_0xd279('0x46')]=function(_0x4bacbf,_0x580b30){var _0x10ae13={'raw':!![],'where':{'id':_0x4bacbf[_0xd279('0x47')]['id']}},_0x3acc04={};_0x3acc04['model']=_['keys'](db[_0xd279('0x2e')]['rawAttributes']);_0x3acc04[_0xd279('0x33')]=_[_0xd279('0x34')](_0x4bacbf['query']);_0x3acc04[_0xd279('0x35')]=_[_0xd279('0x36')](_0x3acc04[_0xd279('0x32')],_0x3acc04[_0xd279('0x33')]);_0x10ae13[_0xd279('0x37')]=_[_0xd279('0x36')](_0x3acc04[_0xd279('0x32')],qs[_0xd279('0x38')](_0x4bacbf['query'][_0xd279('0x38')]));_0x10ae13[_0xd279('0x37')]=_0x10ae13[_0xd279('0x37')][_0xd279('0x39')]?_0x10ae13['attributes']:_0x3acc04[_0xd279('0x32')];if(_0x4bacbf[_0xd279('0x33')][_0xd279('0x42')]){_0x10ae13[_0xd279('0x43')]=[{'all':!![]}];}_0x10ae13=_[_0xd279('0x3f')]({},_0x10ae13,_0x4bacbf[_0xd279('0x48')]);return db[_0xd279('0x2e')][_0xd279('0x49')](_0x10ae13)[_0xd279('0x26')](handleEntityNotFound(_0x580b30,null))[_0xd279('0x26')](respondWithResult(_0x580b30,null))[_0xd279('0x45')](handleError(_0x580b30,null));};exports['create']=function(_0x537ae5,_0x4f2a56){return db[_0xd279('0x2e')][_0xd279('0x4a')](_0x537ae5[_0xd279('0x4b')],{})[_0xd279('0x26')](respondWithResult(_0x4f2a56,0xc9))[_0xd279('0x45')](handleError(_0x4f2a56,null));};exports[_0xd279('0x24')]=function(_0x2983bf,_0x55b189){if(_0x2983bf[_0xd279('0x4b')]['id']){delete _0x2983bf[_0xd279('0x4b')]['id'];}return db[_0xd279('0x2e')][_0xd279('0x49')]({'where':{'id':_0x2983bf[_0xd279('0x47')]['id']}})[_0xd279('0x26')](handleEntityNotFound(_0x55b189,null))[_0xd279('0x26')](saveUpdates(_0x2983bf[_0xd279('0x4b')],null))[_0xd279('0x26')](respondWithResult(_0x55b189,null))[_0xd279('0x45')](handleError(_0x55b189,null));};exports[_0xd279('0x25')]=function(_0x81278c,_0x341d92){return db['FaxQueueReport'][_0xd279('0x49')]({'where':{'id':_0x81278c['params']['id']}})[_0xd279('0x26')](handleEntityNotFound(_0x341d92,null))[_0xd279('0x26')](removeEntity(_0x341d92,null))[_0xd279('0x45')](handleError(_0x341d92,null));};exports[_0xd279('0x4c')]=function(_0x554cd3,_0x18c54a){return db[_0xd279('0x2e')][_0xd279('0x4c')]()[_0xd279('0x26')](respondWithResult(_0x18c54a,null))[_0xd279('0x45')](handleError(_0x18c54a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2a3a42d..384dcf0 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19e64d,_0x3cc5a5){var _0x1a1fc4=function(_0x11556c){while(--_0x11556c){_0x19e64d['push'](_0x19e64d['shift']());}};_0x1a1fc4(++_0x3cc5a5);}(_0x4975,0x86));var _0x5497=function(_0x226baf,_0x44787b){_0x226baf=_0x226baf-0x0;var _0x4ef6dd=_0x4975[_0x226baf];return _0x4ef6dd;};'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 +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x24734b,_0x118f71){var _0x2e92fc=function(_0x1cc765){while(--_0x1cc765){_0x24734b['push'](_0x24734b['shift']());}};_0x2e92fc(++_0x118f71);}(_0x5fc3,0xa8));var _0x35fc=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x5fc3[_0x469a3c];return _0x968f4;};'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')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d5af5bd..c2ff573 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 _0x1724=['FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateFaxQueueReport','FaxQueueReport','create','raw','catch','UpdateFaxQueueReport','update','options','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x30dc9f,_0xe0db1e){var _0x5ec8ca=function(_0x441846){while(--_0x441846){_0x30dc9f['push'](_0x30dc9f['shift']());}};_0x5ec8ca(++_0xe0db1e);}(_0x1724,0x111));var _0x4172=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x1724[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x4172('0x0'));var util=require('util');var moment=require(_0x4172('0x1'));var BPromise=require(_0x4172('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4172('0x3'));var db=require(_0x4172('0x4'))['db'];var utils=require(_0x4172('0x5'));var logger=require(_0x4172('0x6'))(_0x4172('0x7'));var config=require(_0x4172('0x8'));var jayson=require(_0x4172('0x9'));var client=jayson[_0x4172('0xa')][_0x4172('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359329,_0x4b2ccc,_0x25e831){return new BPromise(function(_0x5655f5,_0x1b3ba7){return client[_0x4172('0xc')](_0x359329,_0x25e831)[_0x4172('0xd')](function(_0x168c77){logger[_0x4172('0xe')](_0x4172('0xf'),_0x4b2ccc,_0x4172('0x10'));logger[_0x4172('0x11')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4b2ccc,_0x4172('0x10'),JSON[_0x4172('0x12')](_0x168c77));if(_0x168c77[_0x4172('0x13')]){if(_0x168c77[_0x4172('0x13')]['code']===0x1f4){logger[_0x4172('0x13')](_0x4172('0xf'),_0x4b2ccc,_0x168c77['error'][_0x4172('0x14')]);return _0x1b3ba7(_0x168c77[_0x4172('0x13')][_0x4172('0x14')]);}logger['error'](_0x4172('0xf'),_0x4b2ccc,_0x168c77[_0x4172('0x13')][_0x4172('0x14')]);return _0x5655f5(_0x168c77['error'][_0x4172('0x14')]);}else{logger['info'](_0x4172('0xf'),_0x4b2ccc,_0x4172('0x10'));_0x5655f5(_0x168c77[_0x4172('0x15')][_0x4172('0x14')]);}})['catch'](function(_0x23f7cc){logger[_0x4172('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x4b2ccc,_0x23f7cc);_0x1b3ba7(_0x23f7cc);});});}exports[_0x4172('0x16')]=function(_0x4ee1f8){var _0x4860c8=this;return new Promise(function(_0x450e54,_0x494aca){return db[_0x4172('0x17')][_0x4172('0x18')](_0x4ee1f8['body'],{'raw':_0x4ee1f8['options']?_0x4ee1f8['options'][_0x4172('0x19')]===undefined?!![]:![]:!![]})[_0x4172('0xd')](function(_0x5ea7e6){logger[_0x4172('0xe')](_0x4172('0x16'),_0x4ee1f8);logger[_0x4172('0x11')](_0x4172('0x16'),_0x4ee1f8,JSON[_0x4172('0x12')](_0x5ea7e6));_0x450e54(_0x5ea7e6);})[_0x4172('0x1a')](function(_0x43329d){logger[_0x4172('0x13')]('CreateFaxQueueReport',_0x43329d['message'],_0x4ee1f8);_0x494aca(_0x4860c8[_0x4172('0x13')](0x1f4,_0x43329d[_0x4172('0x14')]));});});};exports[_0x4172('0x1b')]=function(_0x1b0e59){var _0x1e196c=this;return new Promise(function(_0x3b959a,_0x199692){return db[_0x4172('0x17')][_0x4172('0x1c')](_0x1b0e59['body'],{'raw':_0x1b0e59[_0x4172('0x1d')]?_0x1b0e59['options'][_0x4172('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b0e59['options']?_0x1b0e59[_0x4172('0x1d')][_0x4172('0x1e')]||null:null,'attributes':_0x1b0e59[_0x4172('0x1d')]?_0x1b0e59['options'][_0x4172('0x1f')]||null:null,'limit':_0x1b0e59['options']?_0x1b0e59[_0x4172('0x1d')]['limit']||null:null})[_0x4172('0xd')](function(_0x2e619b){logger[_0x4172('0xe')](_0x4172('0x1b'),_0x1b0e59);logger[_0x4172('0x11')]('UpdateFaxQueueReport',_0x1b0e59,JSON[_0x4172('0x12')](_0x2e619b));_0x3b959a(_0x2e619b);})['catch'](function(_0x1fd5e){logger[_0x4172('0x13')]('UpdateFaxQueueReport',_0x1fd5e['message'],_0x1b0e59);_0x199692(_0x1e196c['error'](0x1f4,_0x1fd5e[_0x4172('0x14')]));});});}; \ No newline at end of file +var _0x5366=['UpdateFaxQueueReport','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch'];(function(_0x2d156c,_0x4b0547){var _0x22b4c6=function(_0x50fb41){while(--_0x50fb41){_0x2d156c['push'](_0x2d156c['shift']());}};_0x22b4c6(++_0x4b0547);}(_0x5366,0x163));var _0x6536=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x5366[_0x5cb97e];return _0x1714b4;};'use strict';var _=require(_0x6536('0x0'));var util=require(_0x6536('0x1'));var moment=require('moment');var BPromise=require(_0x6536('0x2'));var rs=require(_0x6536('0x3'));var fs=require('fs');var Redis=require(_0x6536('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6536('0x5'));var logger=require(_0x6536('0x6'))(_0x6536('0x7'));var config=require('../../config/environment');var jayson=require(_0x6536('0x8'));var client=jayson[_0x6536('0x9')][_0x6536('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f1c03,_0x40b450,_0x344f57){return new BPromise(function(_0x3af81a,_0x981eeb){return client[_0x6536('0xb')](_0x3f1c03,_0x344f57)[_0x6536('0xc')](function(_0x1987d7){logger[_0x6536('0xd')](_0x6536('0xe'),_0x40b450,_0x6536('0xf'));logger[_0x6536('0x10')](_0x6536('0x11'),_0x40b450,_0x6536('0xf'),JSON[_0x6536('0x12')](_0x1987d7));if(_0x1987d7[_0x6536('0x13')]){if(_0x1987d7[_0x6536('0x13')]['code']===0x1f4){logger[_0x6536('0x13')](_0x6536('0xe'),_0x40b450,_0x1987d7[_0x6536('0x13')][_0x6536('0x14')]);return _0x981eeb(_0x1987d7[_0x6536('0x13')]['message']);}logger[_0x6536('0x13')](_0x6536('0xe'),_0x40b450,_0x1987d7['error'][_0x6536('0x14')]);return _0x3af81a(_0x1987d7['error']['message']);}else{logger[_0x6536('0xd')](_0x6536('0xe'),_0x40b450,'request\x20sent');_0x3af81a(_0x1987d7[_0x6536('0x15')][_0x6536('0x14')]);}})['catch'](function(_0x5a6784){logger['error'](_0x6536('0xe'),_0x40b450,_0x5a6784);_0x981eeb(_0x5a6784);});});}exports[_0x6536('0x16')]=function(_0x310b4b){var _0xfdcdea=this;return new Promise(function(_0x2714de,_0x2d8f7b){return db[_0x6536('0x17')][_0x6536('0x18')](_0x310b4b[_0x6536('0x19')],{'raw':_0x310b4b[_0x6536('0x1a')]?_0x310b4b[_0x6536('0x1a')][_0x6536('0x1b')]===undefined?!![]:![]:!![]})[_0x6536('0xc')](function(_0x5a46fd){logger[_0x6536('0xd')]('CreateFaxQueueReport',_0x310b4b);logger[_0x6536('0x10')]('CreateFaxQueueReport',_0x310b4b,JSON[_0x6536('0x12')](_0x5a46fd));_0x2714de(_0x5a46fd);})[_0x6536('0x1c')](function(_0x36b4cc){logger[_0x6536('0x13')]('CreateFaxQueueReport',_0x36b4cc[_0x6536('0x14')],_0x310b4b);_0x2d8f7b(_0xfdcdea['error'](0x1f4,_0x36b4cc[_0x6536('0x14')]));});});};exports[_0x6536('0x1d')]=function(_0x2d652d){var _0x23e4b0=this;return new Promise(function(_0x137595,_0x5a687b){return db['FaxQueueReport']['update'](_0x2d652d[_0x6536('0x19')],{'raw':_0x2d652d[_0x6536('0x1a')]?_0x2d652d['options'][_0x6536('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d652d[_0x6536('0x1a')]?_0x2d652d[_0x6536('0x1a')]['where']||null:null,'attributes':_0x2d652d[_0x6536('0x1a')]?_0x2d652d[_0x6536('0x1a')][_0x6536('0x1e')]||null:null,'limit':_0x2d652d[_0x6536('0x1a')]?_0x2d652d[_0x6536('0x1a')][_0x6536('0x1f')]||null:null})['then'](function(_0x1d2622){logger[_0x6536('0xd')](_0x6536('0x1d'),_0x2d652d);logger[_0x6536('0x10')](_0x6536('0x1d'),_0x2d652d,JSON[_0x6536('0x12')](_0x1d2622));_0x137595(_0x1d2622);})[_0x6536('0x1c')](function(_0x156d1e){logger[_0x6536('0x13')]('UpdateFaxQueueReport',_0x156d1e[_0x6536('0x14')],_0x2d652d);_0x5a687b(_0x23e4b0[_0x6536('0x13')](0x1f4,_0x156d1e[_0x6536('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 88f2dcb..1cc77e0 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 _0xa476=['describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x542c62,_0x130b02){var _0x449067=function(_0x1f282b){while(--_0x1f282b){_0x542c62['push'](_0x542c62['shift']());}};_0x449067(++_0x130b02);}(_0xa476,0x194));var _0x6a47=function(_0x940f48,_0x49989c){_0x940f48=_0x940f48-0x0;var _0x1d5486=_0xa476[_0x940f48];return _0x1d5486;};'use strict';var multer=require(_0x6a47('0x0'));var util=require(_0x6a47('0x1'));var path=require(_0x6a47('0x2'));var timeout=require(_0x6a47('0x3'));var express=require('express');var router=express[_0x6a47('0x4')]();var fs_extra=require(_0x6a47('0x5'));var auth=require(_0x6a47('0x6'));var interaction=require(_0x6a47('0x7'));var config=require(_0x6a47('0x8'));var controller=require(_0x6a47('0x9'));router[_0x6a47('0xa')]('/',auth['isAuthenticated'](),controller[_0x6a47('0xb')]);router[_0x6a47('0xa')](_0x6a47('0xc'),auth[_0x6a47('0xd')](),controller[_0x6a47('0xe')]);router[_0x6a47('0xa')](_0x6a47('0xf'),auth['isAuthenticated'](),controller[_0x6a47('0x10')]);router['post']('/',auth[_0x6a47('0xd')](),controller['create']);router[_0x6a47('0x11')](_0x6a47('0xf'),auth[_0x6a47('0xd')](),controller[_0x6a47('0x12')]);router[_0x6a47('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6a47('0x14')]);module[_0x6a47('0x15')]=router; \ No newline at end of file +var _0x15a3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','delete','destroy','exports','multer','path'];(function(_0x411231,_0x3073b9){var _0x541076=function(_0xfe140d){while(--_0xfe140d){_0x411231['push'](_0x411231['shift']());}};_0x541076(++_0x3073b9);}(_0x15a3,0x18e));var _0x315a=function(_0x48df04,_0x1522b1){_0x48df04=_0x48df04-0x0;var _0x4de5fa=_0x15a3[_0x48df04];return _0x4de5fa;};'use strict';var multer=require(_0x315a('0x0'));var util=require('util');var path=require(_0x315a('0x1'));var timeout=require(_0x315a('0x2'));var express=require(_0x315a('0x3'));var router=express[_0x315a('0x4')]();var fs_extra=require(_0x315a('0x5'));var auth=require(_0x315a('0x6'));var interaction=require(_0x315a('0x7'));var config=require(_0x315a('0x8'));var controller=require(_0x315a('0x9'));router['get']('/',auth[_0x315a('0xa')](),controller['index']);router[_0x315a('0xb')](_0x315a('0xc'),auth[_0x315a('0xa')](),controller[_0x315a('0xd')]);router['get'](_0x315a('0xe'),auth[_0x315a('0xa')](),controller[_0x315a('0xf')]);router[_0x315a('0x10')]('/',auth[_0x315a('0xa')](),controller['create']);router['put'](_0x315a('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x315a('0x11')]('/:id',auth[_0x315a('0xa')](),controller[_0x315a('0x12')]);module[_0x315a('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 01af78f..2976dea 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x35c511,_0x2dd26c){var _0x2906fd=function(_0x27b127){while(--_0x27b127){_0x35c511['push'](_0x35c511['shift']());}};_0x2906fd(++_0x2dd26c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x4b84[_0x126fb9];return _0xc8a3b1;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xb7bd46,_0x941298){var _0x2abe45=function(_0x2bdecc){while(--_0x2bdecc){_0xb7bd46['push'](_0xb7bd46['shift']());}};_0x2abe45(++_0x941298);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 3ec69d2..3a90772 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 _0xe6c6=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','then','catch','show','params','find','create','body','describe','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','offset','limit','undefined','count','set','json','apply','save','update','destroy','error','name','send','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x57429b,_0x473850){var _0x269299=function(_0x47bf13){while(--_0x47bf13){_0x57429b['push'](_0x57429b['shift']());}};_0x269299(++_0x473850);}(_0xe6c6,0xab));var _0x6e6c=function(_0x558134,_0x2bfce1){_0x558134=_0x558134-0x0;var _0x4d9aee=_0xe6c6[_0x558134];return _0x4d9aee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6e6c('0x0'));var rp=require('request-promise');var moment=require(_0x6e6c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6e6c('0x2'));var util=require('util');var path=require(_0x6e6c('0x3'));var sox=require(_0x6e6c('0x4'));var csv=require(_0x6e6c('0x5'));var ejs=require(_0x6e6c('0x6'));var fs=require('fs');var fs_extra=require(_0x6e6c('0x7'));var _=require(_0x6e6c('0x8'));var squel=require(_0x6e6c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e6c('0xa'));var Papa=require(_0x6e6c('0xb'));var Redis=require('ioredis');var authService=require(_0x6e6c('0xc'));var qs=require(_0x6e6c('0xd'));var as=require(_0x6e6c('0xe'));var hardwareService=require(_0x6e6c('0xf'));var logger=require(_0x6e6c('0x10'))(_0x6e6c('0x11'));var utils=require(_0x6e6c('0x12'));var config=require(_0x6e6c('0x13'));var licenseUtil=require(_0x6e6c('0x14'));var db=require(_0x6e6c('0x15'))['db'];function respondWithStatusCode(_0x303127,_0x272bfd){_0x272bfd=_0x272bfd||0xcc;return function(_0x4928d4){if(_0x4928d4){return _0x303127[_0x6e6c('0x16')](_0x272bfd);}return _0x303127[_0x6e6c('0x17')](_0x272bfd)[_0x6e6c('0x18')]();};}function respondWithResult(_0x205bdc,_0x9638f1){_0x9638f1=_0x9638f1||0xc8;return function(_0x252d4f){if(_0x252d4f){return _0x205bdc[_0x6e6c('0x17')](_0x9638f1)['json'](_0x252d4f);}};}function respondWithFilteredResult(_0x491ae0,_0x50ee18){return function(_0x26ee8a){if(_0x26ee8a){var _0x47c038=typeof _0x50ee18[_0x6e6c('0x19')]==='undefined'&&typeof _0x50ee18[_0x6e6c('0x1a')]===_0x6e6c('0x1b');var _0x322aad=_0x26ee8a['count'];var _0x12dcbc=_0x47c038?0x0:_0x50ee18['offset'];var _0x17f07f=_0x47c038?_0x26ee8a[_0x6e6c('0x1c')]:_0x50ee18[_0x6e6c('0x19')]+_0x50ee18[_0x6e6c('0x1a')];var _0x22b195;if(_0x17f07f>=_0x322aad){_0x17f07f=_0x322aad;_0x22b195=0xc8;}else{_0x22b195=0xce;}_0x491ae0[_0x6e6c('0x17')](_0x22b195);return _0x491ae0[_0x6e6c('0x1d')]('Content-Range',_0x12dcbc+'-'+_0x17f07f+'/'+_0x322aad)[_0x6e6c('0x1e')](_0x26ee8a);}return null;};}function patchUpdates(_0x30cded){return function(_0x25812f){try{jsonpatch[_0x6e6c('0x1f')](_0x25812f,_0x30cded,!![]);}catch(_0x5f2293){return BPromise['reject'](_0x5f2293);}return _0x25812f[_0x6e6c('0x20')]();};}function saveUpdates(_0x5aa6e0,_0x5ae5ab){return function(_0x4af709){if(_0x4af709){return _0x4af709[_0x6e6c('0x21')](_0x5aa6e0)['then'](function(_0x150436){return _0x150436;});}return null;};}function removeEntity(_0x469780,_0x2ce90c){return function(_0x73c0e5){if(_0x73c0e5){return _0x73c0e5[_0x6e6c('0x22')]()['then'](function(){_0x469780[_0x6e6c('0x17')](0xcc)[_0x6e6c('0x18')]();});}};}function handleEntityNotFound(_0x1e8bfa,_0x3b2155){return function(_0x5ebb3e){if(!_0x5ebb3e){_0x1e8bfa['sendStatus'](0x194);}return _0x5ebb3e;};}function handleError(_0x426629,_0x17fbdb){_0x17fbdb=_0x17fbdb||0x1f4;return function(_0x46a66e){logger[_0x6e6c('0x23')](_0x46a66e['stack']);if(_0x46a66e[_0x6e6c('0x24')]){delete _0x46a66e[_0x6e6c('0x24')];}_0x426629['status'](_0x17fbdb)[_0x6e6c('0x25')](_0x46a66e);};}exports['index']=function(_0x17e6f3,_0x4f7cb5){var _0x279a7f={},_0x56e2e6={},_0x45fcc3={'count':0x0,'rows':[]};var _0x3a5fe2=_[_0x6e6c('0x26')](db[_0x6e6c('0x27')]['rawAttributes'],function(_0x247a3c){return{'name':_0x247a3c[_0x6e6c('0x28')],'type':_0x247a3c[_0x6e6c('0x29')][_0x6e6c('0x2a')]};});_0x56e2e6[_0x6e6c('0x2b')]=_[_0x6e6c('0x26')](_0x3a5fe2,'name');_0x56e2e6[_0x6e6c('0x2c')]=_[_0x6e6c('0x2d')](_0x17e6f3[_0x6e6c('0x2c')]);_0x56e2e6[_0x6e6c('0x2e')]=_[_0x6e6c('0x2f')](_0x56e2e6['model'],_0x56e2e6[_0x6e6c('0x2c')]);_0x279a7f[_0x6e6c('0x30')]=_[_0x6e6c('0x2f')](_0x56e2e6['model'],qs[_0x6e6c('0x31')](_0x17e6f3['query'][_0x6e6c('0x31')]));_0x279a7f[_0x6e6c('0x30')]=_0x279a7f[_0x6e6c('0x30')][_0x6e6c('0x32')]?_0x279a7f[_0x6e6c('0x30')]:_0x56e2e6[_0x6e6c('0x2b')];if(!_0x17e6f3[_0x6e6c('0x2c')][_0x6e6c('0x33')](_0x6e6c('0x34'))){_0x279a7f[_0x6e6c('0x1a')]=qs['limit'](_0x17e6f3['query']['limit']);_0x279a7f[_0x6e6c('0x19')]=qs[_0x6e6c('0x19')](_0x17e6f3['query'][_0x6e6c('0x19')]);}_0x279a7f[_0x6e6c('0x35')]=qs[_0x6e6c('0x36')](_0x17e6f3[_0x6e6c('0x2c')][_0x6e6c('0x36')]);_0x279a7f[_0x6e6c('0x37')]=qs[_0x6e6c('0x2e')](_[_0x6e6c('0x38')](_0x17e6f3[_0x6e6c('0x2c')],_0x56e2e6[_0x6e6c('0x2e')]),_0x3a5fe2);if(_0x17e6f3[_0x6e6c('0x2c')]['filter']){_0x279a7f['where']=_[_0x6e6c('0x39')](_0x279a7f[_0x6e6c('0x37')],{'$or':_[_0x6e6c('0x26')](_0x3a5fe2,function(_0x476cb6){if(_0x476cb6['type']!==_0x6e6c('0x3a')){var _0x4d269f={};_0x4d269f[_0x476cb6[_0x6e6c('0x24')]]={'$like':'%'+_0x17e6f3[_0x6e6c('0x2c')][_0x6e6c('0x3b')]+'%'};return _0x4d269f;}})});}_0x279a7f=_[_0x6e6c('0x39')]({},_0x279a7f,_0x17e6f3[_0x6e6c('0x3c')]);var _0x2b4779={'where':_0x279a7f['where']};return db[_0x6e6c('0x27')]['count'](_0x2b4779)['then'](function(_0x22c725){_0x45fcc3[_0x6e6c('0x1c')]=_0x22c725;if(_0x17e6f3[_0x6e6c('0x2c')][_0x6e6c('0x3d')]){_0x279a7f[_0x6e6c('0x3e')]=[{'all':!![]}];}return db[_0x6e6c('0x27')][_0x6e6c('0x3f')](_0x279a7f);})['then'](function(_0x2da709){_0x45fcc3[_0x6e6c('0x40')]=_0x2da709;return _0x45fcc3;})[_0x6e6c('0x41')](respondWithFilteredResult(_0x4f7cb5,_0x279a7f))[_0x6e6c('0x42')](handleError(_0x4f7cb5,null));};exports[_0x6e6c('0x43')]=function(_0x5528f4,_0x444f28){var _0x17f6c4={'raw':!![],'where':{'id':_0x5528f4[_0x6e6c('0x44')]['id']}},_0x344221={};_0x344221[_0x6e6c('0x2b')]=_[_0x6e6c('0x2d')](db['FaxTransferReport']['rawAttributes']);_0x344221[_0x6e6c('0x2c')]=_[_0x6e6c('0x2d')](_0x5528f4[_0x6e6c('0x2c')]);_0x344221['filters']=_[_0x6e6c('0x2f')](_0x344221['model'],_0x344221['query']);_0x17f6c4[_0x6e6c('0x30')]=_[_0x6e6c('0x2f')](_0x344221[_0x6e6c('0x2b')],qs[_0x6e6c('0x31')](_0x5528f4[_0x6e6c('0x2c')][_0x6e6c('0x31')]));_0x17f6c4[_0x6e6c('0x30')]=_0x17f6c4[_0x6e6c('0x30')][_0x6e6c('0x32')]?_0x17f6c4['attributes']:_0x344221['model'];if(_0x5528f4['query'][_0x6e6c('0x3d')]){_0x17f6c4['include']=[{'all':!![]}];}_0x17f6c4=_[_0x6e6c('0x39')]({},_0x17f6c4,_0x5528f4[_0x6e6c('0x3c')]);return db['FaxTransferReport'][_0x6e6c('0x45')](_0x17f6c4)[_0x6e6c('0x41')](handleEntityNotFound(_0x444f28,null))[_0x6e6c('0x41')](respondWithResult(_0x444f28,null))[_0x6e6c('0x42')](handleError(_0x444f28,null));};exports[_0x6e6c('0x46')]=function(_0x39efd0,_0x4fe9e1){return db[_0x6e6c('0x27')]['create'](_0x39efd0[_0x6e6c('0x47')],{})['then'](respondWithResult(_0x4fe9e1,0xc9))[_0x6e6c('0x42')](handleError(_0x4fe9e1,null));};exports['update']=function(_0x28c905,_0x274432){if(_0x28c905[_0x6e6c('0x47')]['id']){delete _0x28c905['body']['id'];}return db['FaxTransferReport'][_0x6e6c('0x45')]({'where':{'id':_0x28c905[_0x6e6c('0x44')]['id']}})[_0x6e6c('0x41')](handleEntityNotFound(_0x274432,null))[_0x6e6c('0x41')](saveUpdates(_0x28c905[_0x6e6c('0x47')],null))['then'](respondWithResult(_0x274432,null))[_0x6e6c('0x42')](handleError(_0x274432,null));};exports[_0x6e6c('0x22')]=function(_0x5b02a3,_0x369f6f){return db[_0x6e6c('0x27')]['find']({'where':{'id':_0x5b02a3['params']['id']}})[_0x6e6c('0x41')](handleEntityNotFound(_0x369f6f,null))[_0x6e6c('0x41')](removeEntity(_0x369f6f,null))[_0x6e6c('0x42')](handleError(_0x369f6f,null));};exports[_0x6e6c('0x48')]=function(_0x5900c2,_0x119c39){return db[_0x6e6c('0x27')][_0x6e6c('0x48')]()[_0x6e6c('0x41')](respondWithResult(_0x119c39,null))['catch'](handleError(_0x119c39,null));}; \ No newline at end of file +var _0xa75d=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x3e54c3,_0x195509){var _0xda0ffe=function(_0x1c0804){while(--_0x1c0804){_0x3e54c3['push'](_0x3e54c3['shift']());}};_0xda0ffe(++_0x195509);}(_0xa75d,0x1d7));var _0xda75=function(_0x2ba7c7,_0xb616c9){_0x2ba7c7=_0x2ba7c7-0x0;var _0x582e56=_0xa75d[_0x2ba7c7];return _0x582e56;};'use strict';var emlformat=require(_0xda75('0x0'));var rimraf=require(_0xda75('0x1'));var zipdir=require(_0xda75('0x2'));var jsonpatch=require(_0xda75('0x3'));var rp=require(_0xda75('0x4'));var moment=require(_0xda75('0x5'));var BPromise=require(_0xda75('0x6'));var Mustache=require(_0xda75('0x7'));var util=require(_0xda75('0x8'));var path=require(_0xda75('0x9'));var sox=require(_0xda75('0xa'));var csv=require(_0xda75('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda75('0xc'));var _=require(_0xda75('0xd'));var squel=require('squel');var crypto=require(_0xda75('0xe'));var jsforce=require(_0xda75('0xf'));var deskjs=require(_0xda75('0x10'));var toCsv=require(_0xda75('0xb'));var querystring=require(_0xda75('0x11'));var Papa=require(_0xda75('0x12'));var Redis=require('ioredis');var authService=require(_0xda75('0x13'));var qs=require(_0xda75('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda75('0x15'));var logger=require(_0xda75('0x16'))('api');var utils=require(_0xda75('0x17'));var config=require(_0xda75('0x18'));var licenseUtil=require(_0xda75('0x19'));var db=require(_0xda75('0x1a'))['db'];function respondWithStatusCode(_0x563fc5,_0x46654e){_0x46654e=_0x46654e||0xcc;return function(_0x4f43f8){if(_0x4f43f8){return _0x563fc5[_0xda75('0x1b')](_0x46654e);}return _0x563fc5[_0xda75('0x1c')](_0x46654e)[_0xda75('0x1d')]();};}function respondWithResult(_0x321661,_0x579810){_0x579810=_0x579810||0xc8;return function(_0x24af81){if(_0x24af81){return _0x321661[_0xda75('0x1c')](_0x579810)[_0xda75('0x1e')](_0x24af81);}};}function respondWithFilteredResult(_0xf26abc,_0xf8813f){return function(_0x4da6c6){if(_0x4da6c6){var _0x4e7020=typeof _0xf8813f[_0xda75('0x1f')]===_0xda75('0x20')&&typeof _0xf8813f['limit']===_0xda75('0x20');var _0x13af8a=_0x4da6c6[_0xda75('0x21')];var _0x42b2f0=_0x4e7020?0x0:_0xf8813f['offset'];var _0x566a43=_0x4e7020?_0x4da6c6['count']:_0xf8813f['offset']+_0xf8813f['limit'];var _0x212c4b;if(_0x566a43>=_0x13af8a){_0x566a43=_0x13af8a;_0x212c4b=0xc8;}else{_0x212c4b=0xce;}_0xf26abc[_0xda75('0x1c')](_0x212c4b);return _0xf26abc[_0xda75('0x22')](_0xda75('0x23'),_0x42b2f0+'-'+_0x566a43+'/'+_0x13af8a)[_0xda75('0x1e')](_0x4da6c6);}return null;};}function patchUpdates(_0xbb49f9){return function(_0x5eb0c7){try{jsonpatch[_0xda75('0x24')](_0x5eb0c7,_0xbb49f9,!![]);}catch(_0x44141c){return BPromise[_0xda75('0x25')](_0x44141c);}return _0x5eb0c7[_0xda75('0x26')]();};}function saveUpdates(_0x924dd8,_0x26537f){return function(_0x26ea04){if(_0x26ea04){return _0x26ea04[_0xda75('0x27')](_0x924dd8)[_0xda75('0x28')](function(_0x9c7072){return _0x9c7072;});}return null;};}function removeEntity(_0x155e87,_0x49ac06){return function(_0x49ae1c){if(_0x49ae1c){return _0x49ae1c['destroy']()['then'](function(){_0x155e87[_0xda75('0x1c')](0xcc)[_0xda75('0x1d')]();});}};}function handleEntityNotFound(_0x57fd64,_0x1841ea){return function(_0x5147ed){if(!_0x5147ed){_0x57fd64[_0xda75('0x1b')](0x194);}return _0x5147ed;};}function handleError(_0x422ddd,_0x549214){_0x549214=_0x549214||0x1f4;return function(_0x6decc4){logger['error'](_0x6decc4[_0xda75('0x29')]);if(_0x6decc4['name']){delete _0x6decc4[_0xda75('0x2a')];}_0x422ddd[_0xda75('0x1c')](_0x549214)[_0xda75('0x2b')](_0x6decc4);};}exports[_0xda75('0x2c')]=function(_0x7cf162,_0x325a63){var _0x51e485={},_0x597671={},_0x1fad95={'count':0x0,'rows':[]};var _0x5c6bff=_['map'](db[_0xda75('0x2d')][_0xda75('0x2e')],function(_0x1fdb8a){return{'name':_0x1fdb8a[_0xda75('0x2f')],'type':_0x1fdb8a[_0xda75('0x30')][_0xda75('0x31')]};});_0x597671[_0xda75('0x32')]=_[_0xda75('0x33')](_0x5c6bff,'name');_0x597671[_0xda75('0x34')]=_[_0xda75('0x35')](_0x7cf162['query']);_0x597671['filters']=_[_0xda75('0x36')](_0x597671[_0xda75('0x32')],_0x597671[_0xda75('0x34')]);_0x51e485[_0xda75('0x37')]=_['intersection'](_0x597671[_0xda75('0x32')],qs[_0xda75('0x38')](_0x7cf162[_0xda75('0x34')]['fields']));_0x51e485['attributes']=_0x51e485[_0xda75('0x37')][_0xda75('0x39')]?_0x51e485['attributes']:_0x597671[_0xda75('0x32')];if(!_0x7cf162[_0xda75('0x34')][_0xda75('0x3a')](_0xda75('0x3b'))){_0x51e485[_0xda75('0x3c')]=qs[_0xda75('0x3c')](_0x7cf162[_0xda75('0x34')][_0xda75('0x3c')]);_0x51e485[_0xda75('0x1f')]=qs[_0xda75('0x1f')](_0x7cf162[_0xda75('0x34')][_0xda75('0x1f')]);}_0x51e485[_0xda75('0x3d')]=qs[_0xda75('0x3e')](_0x7cf162['query'][_0xda75('0x3e')]);_0x51e485['where']=qs[_0xda75('0x3f')](_[_0xda75('0x40')](_0x7cf162[_0xda75('0x34')],_0x597671['filters']),_0x5c6bff);if(_0x7cf162[_0xda75('0x34')][_0xda75('0x41')]){_0x51e485[_0xda75('0x42')]=_[_0xda75('0x43')](_0x51e485[_0xda75('0x42')],{'$or':_[_0xda75('0x33')](_0x5c6bff,function(_0xf46719){if(_0xf46719[_0xda75('0x30')]!==_0xda75('0x44')){var _0x4f7fa4={};_0x4f7fa4[_0xf46719[_0xda75('0x2a')]]={'$like':'%'+_0x7cf162[_0xda75('0x34')][_0xda75('0x41')]+'%'};return _0x4f7fa4;}})});}_0x51e485=_[_0xda75('0x43')]({},_0x51e485,_0x7cf162[_0xda75('0x45')]);var _0x31aeab={'where':_0x51e485['where']};return db[_0xda75('0x2d')]['count'](_0x31aeab)['then'](function(_0x22f224){_0x1fad95[_0xda75('0x21')]=_0x22f224;if(_0x7cf162['query'][_0xda75('0x46')]){_0x51e485['include']=[{'all':!![]}];}return db[_0xda75('0x2d')][_0xda75('0x47')](_0x51e485);})[_0xda75('0x28')](function(_0x485eca){_0x1fad95[_0xda75('0x48')]=_0x485eca;return _0x1fad95;})['then'](respondWithFilteredResult(_0x325a63,_0x51e485))['catch'](handleError(_0x325a63,null));};exports[_0xda75('0x49')]=function(_0x260465,_0x368883){var _0x43e77e={'raw':!![],'where':{'id':_0x260465[_0xda75('0x4a')]['id']}},_0x570569={};_0x570569[_0xda75('0x32')]=_[_0xda75('0x35')](db[_0xda75('0x2d')]['rawAttributes']);_0x570569[_0xda75('0x34')]=_['keys'](_0x260465['query']);_0x570569['filters']=_[_0xda75('0x36')](_0x570569[_0xda75('0x32')],_0x570569[_0xda75('0x34')]);_0x43e77e['attributes']=_[_0xda75('0x36')](_0x570569['model'],qs['fields'](_0x260465[_0xda75('0x34')][_0xda75('0x38')]));_0x43e77e[_0xda75('0x37')]=_0x43e77e[_0xda75('0x37')][_0xda75('0x39')]?_0x43e77e[_0xda75('0x37')]:_0x570569[_0xda75('0x32')];if(_0x260465['query'][_0xda75('0x46')]){_0x43e77e[_0xda75('0x4b')]=[{'all':!![]}];}_0x43e77e=_[_0xda75('0x43')]({},_0x43e77e,_0x260465[_0xda75('0x45')]);return db[_0xda75('0x2d')][_0xda75('0x4c')](_0x43e77e)['then'](handleEntityNotFound(_0x368883,null))[_0xda75('0x28')](respondWithResult(_0x368883,null))[_0xda75('0x4d')](handleError(_0x368883,null));};exports[_0xda75('0x4e')]=function(_0x47c70a,_0x55bb31){return db[_0xda75('0x2d')][_0xda75('0x4e')](_0x47c70a[_0xda75('0x4f')],{})[_0xda75('0x28')](respondWithResult(_0x55bb31,0xc9))['catch'](handleError(_0x55bb31,null));};exports['update']=function(_0x13b462,_0x155d4e){if(_0x13b462[_0xda75('0x4f')]['id']){delete _0x13b462[_0xda75('0x4f')]['id'];}return db[_0xda75('0x2d')]['find']({'where':{'id':_0x13b462[_0xda75('0x4a')]['id']}})[_0xda75('0x28')](handleEntityNotFound(_0x155d4e,null))[_0xda75('0x28')](saveUpdates(_0x13b462[_0xda75('0x4f')],null))['then'](respondWithResult(_0x155d4e,null))[_0xda75('0x4d')](handleError(_0x155d4e,null));};exports[_0xda75('0x50')]=function(_0x2c5eed,_0x660915){return db[_0xda75('0x2d')]['find']({'where':{'id':_0x2c5eed['params']['id']}})[_0xda75('0x28')](handleEntityNotFound(_0x660915,null))['then'](removeEntity(_0x660915,null))[_0xda75('0x4d')](handleError(_0x660915,null));};exports[_0xda75('0x51')]=function(_0x1dc08f,_0x283fcb){return db['FaxTransferReport']['describe']()[_0xda75('0x28')](respondWithResult(_0x283fcb,null))[_0xda75('0x4d')](handleError(_0x283fcb,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2fc7e8f..92fff48 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 _0x15da=['report_fax_transfer','uniqueid','util','../../config/logger','bluebird','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x41ccbb,_0x3771e8){var _0x519c61=function(_0x4724a6){while(--_0x4724a6){_0x41ccbb['push'](_0x41ccbb['shift']());}};_0x519c61(++_0x3771e8);}(_0x15da,0x98));var _0xa15d=function(_0x252d7e,_0x20a71c){_0x252d7e=_0x252d7e-0x0;var _0x2afaba=_0x15da[_0x252d7e];return _0x2afaba;};'use strict';var _=require('lodash');var util=require(_0xa15d('0x0'));var logger=require(_0xa15d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa15d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa15d('0x3'));var config=require(_0xa15d('0x4'));var attributes=require(_0xa15d('0x5'));module[_0xa15d('0x6')]=function(_0x375c1a,_0x40dd5e){return _0x375c1a[_0xa15d('0x7')]('FaxTransferReport',attributes,{'tableName':_0xa15d('0x8'),'paranoid':![],'indexes':[{'name':_0xa15d('0x9'),'fields':[_0xa15d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa264=['define','FaxTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x5c55dd,_0x3cd260){var _0x3521fc=function(_0x1a2a6d){while(--_0x1a2a6d){_0x5c55dd['push'](_0x5c55dd['shift']());}};_0x3521fc(++_0x3cd260);}(_0xa264,0x148));var _0x4a26=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0xa264[_0x276468];return _0x36dc3a;};'use strict';var _=require(_0x4a26('0x0'));var util=require('util');var logger=require(_0x4a26('0x1'))(_0x4a26('0x2'));var moment=require(_0x4a26('0x3'));var BPromise=require(_0x4a26('0x4'));var rp=require(_0x4a26('0x5'));var fs=require('fs');var path=require(_0x4a26('0x6'));var rimraf=require('rimraf');var config=require(_0x4a26('0x7'));var attributes=require(_0x4a26('0x8'));module[_0x4a26('0x9')]=function(_0x449d3d,_0x204ec0){return _0x449d3d[_0x4a26('0xa')](_0x4a26('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x4a26('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2ace1d1..2e66eaf 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 _0xff8e=['code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x548f50,_0x32aca0){var _0x5112e0=function(_0x23a07f){while(--_0x23a07f){_0x548f50['push'](_0x548f50['shift']());}};_0x5112e0(++_0x32aca0);}(_0xff8e,0x14d));var _0xeff8=function(_0x4ab15,_0x131c32){_0x4ab15=_0x4ab15-0x0;var _0x54c11d=_0xff8e[_0x4ab15];return _0x54c11d;};'use strict';var _=require(_0xeff8('0x0'));var util=require(_0xeff8('0x1'));var moment=require(_0xeff8('0x2'));var BPromise=require('bluebird');var rs=require(_0xeff8('0x3'));var fs=require('fs');var Redis=require(_0xeff8('0x4'));var db=require(_0xeff8('0x5'))['db'];var utils=require(_0xeff8('0x6'));var logger=require('../../config/logger')(_0xeff8('0x7'));var config=require(_0xeff8('0x8'));var jayson=require(_0xeff8('0x9'));var client=jayson['client'][_0xeff8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x131a76,_0x554119,_0x2ef042){return new BPromise(function(_0x1ff231,_0x29c8b7){return client[_0xeff8('0xb')](_0x131a76,_0x2ef042)[_0xeff8('0xc')](function(_0x4fe352){logger[_0xeff8('0xd')](_0xeff8('0xe'),_0x554119,_0xeff8('0xf'));logger['debug'](_0xeff8('0x10'),_0x554119,_0xeff8('0xf'),JSON[_0xeff8('0x11')](_0x4fe352));if(_0x4fe352['error']){if(_0x4fe352[_0xeff8('0x12')][_0xeff8('0x13')]===0x1f4){logger[_0xeff8('0x12')](_0xeff8('0xe'),_0x554119,_0x4fe352[_0xeff8('0x12')]['message']);return _0x29c8b7(_0x4fe352[_0xeff8('0x12')][_0xeff8('0x14')]);}logger[_0xeff8('0x12')](_0xeff8('0xe'),_0x554119,_0x4fe352[_0xeff8('0x12')][_0xeff8('0x14')]);return _0x1ff231(_0x4fe352['error'][_0xeff8('0x14')]);}else{logger['info'](_0xeff8('0xe'),_0x554119,_0xeff8('0xf'));_0x1ff231(_0x4fe352[_0xeff8('0x15')]['message']);}})['catch'](function(_0x4b45a3){logger[_0xeff8('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x554119,_0x4b45a3);_0x29c8b7(_0x4b45a3);});});} \ No newline at end of file +var _0x91f2=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x91f2,0x1a2));var _0x291f=function(_0x4c49f0,_0x4d7049){_0x4c49f0=_0x4c49f0-0x0;var _0x284bd7=_0x91f2[_0x4c49f0];return _0x284bd7;};'use strict';var _=require(_0x291f('0x0'));var util=require(_0x291f('0x1'));var moment=require(_0x291f('0x2'));var BPromise=require(_0x291f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x291f('0x4'))['db'];var utils=require(_0x291f('0x5'));var logger=require(_0x291f('0x6'))(_0x291f('0x7'));var config=require(_0x291f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x291f('0x9')][_0x291f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab8c5,_0x4d3766,_0x26a295){return new BPromise(function(_0x1ae9bb,_0x36381f){return client[_0x291f('0xb')](_0x1ab8c5,_0x26a295)[_0x291f('0xc')](function(_0x4017d0){logger['info'](_0x291f('0xd'),_0x4d3766,'request\x20sent');logger['debug'](_0x291f('0xe'),_0x4d3766,_0x291f('0xf'),JSON['stringify'](_0x4017d0));if(_0x4017d0[_0x291f('0x10')]){if(_0x4017d0[_0x291f('0x10')][_0x291f('0x11')]===0x1f4){logger['error'](_0x291f('0xd'),_0x4d3766,_0x4017d0[_0x291f('0x10')][_0x291f('0x12')]);return _0x36381f(_0x4017d0[_0x291f('0x10')][_0x291f('0x12')]);}logger[_0x291f('0x10')](_0x291f('0xd'),_0x4d3766,_0x4017d0[_0x291f('0x10')]['message']);return _0x1ae9bb(_0x4017d0[_0x291f('0x10')]['message']);}else{logger['info'](_0x291f('0xd'),_0x4d3766,_0x291f('0xf'));_0x1ae9bb(_0x4017d0[_0x291f('0x13')]['message']);}})[_0x291f('0x14')](function(_0x15af89){logger[_0x291f('0x10')](_0x291f('0xd'),_0x4d3766,_0x15af89);_0x36381f(_0x15af89);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index bf28864..909757b 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 _0x80ce=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x3e0809,_0x2d780c){var _0x337e39=function(_0x25c106){while(--_0x25c106){_0x3e0809['push'](_0x3e0809['shift']());}};_0x337e39(++_0x2d780c);}(_0x80ce,0x14f));var _0xe80c=function(_0x1b2633,_0x5ca9fc){_0x1b2633=_0x1b2633-0x0;var _0x5d440c=_0x80ce[_0x1b2633];return _0x5d440c;};'use strict';var multer=require(_0xe80c('0x0'));var util=require(_0xe80c('0x1'));var path=require(_0xe80c('0x2'));var timeout=require(_0xe80c('0x3'));var express=require(_0xe80c('0x4'));var router=express['Router']();var fs_extra=require(_0xe80c('0x5'));var auth=require(_0xe80c('0x6'));var interaction=require(_0xe80c('0x7'));var config=require(_0xe80c('0x8'));var controller=require(_0xe80c('0x9'));router[_0xe80c('0xa')]('/',auth[_0xe80c('0xb')](),controller[_0xe80c('0xc')]);router[_0xe80c('0xa')](_0xe80c('0xd'),auth[_0xe80c('0xb')](),controller[_0xe80c('0xe')]);router['get'](_0xe80c('0xf'),auth[_0xe80c('0xb')](),controller[_0xe80c('0x10')]);router[_0xe80c('0x11')]('/',auth[_0xe80c('0xb')](),controller[_0xe80c('0x12')]);router['put']('/:id',auth[_0xe80c('0xb')](),controller[_0xe80c('0x13')]);router[_0xe80c('0x14')](_0xe80c('0xf'),auth['isAuthenticated'](),controller[_0xe80c('0x15')]);module[_0xe80c('0x16')]=router; \ No newline at end of file +var _0x6e0e=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x416bf6,_0x41e9a6){var _0x29e604=function(_0x5821be){while(--_0x5821be){_0x416bf6['push'](_0x416bf6['shift']());}};_0x29e604(++_0x41e9a6);}(_0x6e0e,0x106));var _0xe6e0=function(_0x521de1,_0x23e812){_0x521de1=_0x521de1-0x0;var _0x49f370=_0x6e0e[_0x521de1];return _0x49f370;};'use strict';var multer=require(_0xe6e0('0x0'));var util=require(_0xe6e0('0x1'));var path=require(_0xe6e0('0x2'));var timeout=require(_0xe6e0('0x3'));var express=require(_0xe6e0('0x4'));var router=express[_0xe6e0('0x5')]();var fs_extra=require(_0xe6e0('0x6'));var auth=require(_0xe6e0('0x7'));var interaction=require(_0xe6e0('0x8'));var config=require('../../config/environment');var controller=require(_0xe6e0('0x9'));router[_0xe6e0('0xa')]('/',auth[_0xe6e0('0xb')](),controller[_0xe6e0('0xc')]);router[_0xe6e0('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xe6e0('0xd')]);router[_0xe6e0('0xa')](_0xe6e0('0xe'),auth['isAuthenticated'](),controller[_0xe6e0('0xf')]);router[_0xe6e0('0x10')]('/',auth[_0xe6e0('0xb')](),controller[_0xe6e0('0x11')]);router[_0xe6e0('0x12')]('/:id',auth[_0xe6e0('0xb')](),controller[_0xe6e0('0x13')]);router[_0xe6e0('0x14')](_0xe6e0('0xe'),auth[_0xe6e0('0xb')](),controller[_0xe6e0('0x15')]);module[_0xe6e0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 31533bf..a8038b0 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 _0x2c2b=['/:id','update','delete','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x5524c5,_0x53cd4f){var _0x174ccf=function(_0xa7cafb){while(--_0xa7cafb){_0x5524c5['push'](_0x5524c5['shift']());}};_0x174ccf(++_0x53cd4f);}(_0x2c2b,0xeb));var _0xb2c2=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x2c2b[_0x2f9467];return _0x39894c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb2c2('0x0'));var express=require(_0xb2c2('0x1'));var router=express['Router']();var fs_extra=require(_0xb2c2('0x2'));var auth=require(_0xb2c2('0x3'));var interaction=require(_0xb2c2('0x4'));var config=require('../../config/environment');var controller=require(_0xb2c2('0x5'));router[_0xb2c2('0x6')]('/',auth[_0xb2c2('0x7')](),controller[_0xb2c2('0x8')]);router[_0xb2c2('0x6')]('/:id',auth[_0xb2c2('0x7')](),controller[_0xb2c2('0x9')]);router[_0xb2c2('0x6')](_0xb2c2('0xa'),auth[_0xb2c2('0x7')](),controller[_0xb2c2('0xb')]);router['get'](_0xb2c2('0xc'),auth[_0xb2c2('0x7')](),controller[_0xb2c2('0xd')]);router[_0xb2c2('0xe')]('/',auth[_0xb2c2('0x7')](),controller[_0xb2c2('0xf')]);router['post']('/:id/configurations',auth[_0xb2c2('0x7')](),controller[_0xb2c2('0x10')]);router[_0xb2c2('0x11')](_0xb2c2('0x12'),auth[_0xb2c2('0x7')](),controller[_0xb2c2('0x13')]);router[_0xb2c2('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb2c2('0x15')]);module[_0xb2c2('0x16')]=router; \ No newline at end of file +var _0x646b=['../../components/auth/service','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x22ed17,_0x1c5da5){var _0x15ea07=function(_0x1c1443){while(--_0x1c1443){_0x22ed17['push'](_0x22ed17['shift']());}};_0x15ea07(++_0x1c5da5);}(_0x646b,0x149));var _0xb646=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0x646b[_0x48cb1f];return _0x172c4d;};'use strict';var multer=require(_0xb646('0x0'));var util=require(_0xb646('0x1'));var path=require(_0xb646('0x2'));var timeout=require(_0xb646('0x3'));var express=require(_0xb646('0x4'));var router=express[_0xb646('0x5')]();var fs_extra=require(_0xb646('0x6'));var auth=require(_0xb646('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xb646('0x8')]('/',auth[_0xb646('0x9')](),controller[_0xb646('0xa')]);router['get']('/:id',auth[_0xb646('0x9')](),controller[_0xb646('0xb')]);router[_0xb646('0x8')]('/:id/configurations',auth[_0xb646('0x9')](),controller[_0xb646('0xc')]);router[_0xb646('0x8')](_0xb646('0xd'),auth[_0xb646('0x9')](),controller[_0xb646('0xe')]);router[_0xb646('0xf')]('/',auth['isAuthenticated'](),controller[_0xb646('0x10')]);router[_0xb646('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb646('0x11')]);router[_0xb646('0x12')](_0xb646('0x13'),auth[_0xb646('0x9')](),controller[_0xb646('0x14')]);router[_0xb646('0x15')](_0xb646('0x13'),auth[_0xb646('0x9')](),controller[_0xb646('0x16')]);module[_0xb646('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index eed5059..8f23e66 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 _0xc9ba=['ENUM','integrationTab','sequelize','exports','STRING','basic'];(function(_0x5d5526,_0x9b50ac){var _0x300680=function(_0x5a83b4){while(--_0x5a83b4){_0x5d5526['push'](_0x5d5526['shift']());}};_0x300680(++_0x9b50ac);}(_0xc9ba,0x1a6));var _0xac9b=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xc9ba[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0xac9b('0x0'));module[_0xac9b('0x1')]={'name':{'type':Sequelize[_0xac9b('0x2')]},'description':{'type':Sequelize[_0xac9b('0x2')]},'username':{'type':Sequelize[_0xac9b('0x2')]},'remoteUri':{'type':Sequelize[_0xac9b('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xac9b('0x3')),'defaultValue':_0xac9b('0x3')},'password':{'type':Sequelize[_0xac9b('0x2')]},'consumerKey':{'type':Sequelize[_0xac9b('0x2')]},'consumerSecret':{'type':Sequelize[_0xac9b('0x2')]},'token':{'type':Sequelize[_0xac9b('0x2')]},'tokenSecret':{'type':Sequelize[_0xac9b('0x2')]},'serverUrl':{'type':Sequelize[_0xac9b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xac9b('0x4')]('integrationTab','newTab'),'defaultValue':_0xac9b('0x5')}}; \ No newline at end of file +var _0xb0f3=['STRING','ENUM','basic','integrationTab','newTab','exports'];(function(_0x2c6d85,_0x375257){var _0x382e41=function(_0x2e5cdd){while(--_0x2e5cdd){_0x2c6d85['push'](_0x2c6d85['shift']());}};_0x382e41(++_0x375257);}(_0xb0f3,0x197));var _0x3b0f=function(_0x197df3,_0x57d366){_0x197df3=_0x197df3-0x0;var _0xafdaf7=_0xb0f3[_0x197df3];return _0xafdaf7;};'use strict';var Sequelize=require('sequelize');module[_0x3b0f('0x0')]={'name':{'type':Sequelize[_0x3b0f('0x1')]},'description':{'type':Sequelize[_0x3b0f('0x1')]},'username':{'type':Sequelize[_0x3b0f('0x1')]},'remoteUri':{'type':Sequelize[_0x3b0f('0x1')]},'authType':{'type':Sequelize[_0x3b0f('0x2')](_0x3b0f('0x3')),'defaultValue':_0x3b0f('0x3')},'password':{'type':Sequelize[_0x3b0f('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x3b0f('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x3b0f('0x1')]},'serverUrl':{'type':Sequelize[_0x3b0f('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3b0f('0x4'),_0x3b0f('0x5')),'defaultValue':_0x3b0f('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7c38ec3..70275bf 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 _0x7e1e=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','DeskAccount','rawAttributes','fieldName','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','include','findAll','catch','show','params','includeAll','create','body','find','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','%s/custom_fields','application/json','headers','Authorization','format','base64','_embedded','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x33acdd,_0x5b7ed7){var _0xd4452d=function(_0x579db8){while(--_0x579db8){_0x33acdd['push'](_0x33acdd['shift']());}};_0xd4452d(++_0x5b7ed7);}(_0x7e1e,0xe1));var _0xe7e1=function(_0x25fb9b,_0x38f646){_0x25fb9b=_0x25fb9b-0x0;var _0x47d1d4=_0x7e1e[_0x25fb9b];return _0x47d1d4;};'use strict';var emlformat=require(_0xe7e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7e1('0x1'));var jsonpatch=require(_0xe7e1('0x2'));var rp=require(_0xe7e1('0x3'));var moment=require(_0xe7e1('0x4'));var BPromise=require(_0xe7e1('0x5'));var Mustache=require(_0xe7e1('0x6'));var util=require('util');var path=require(_0xe7e1('0x7'));var sox=require(_0xe7e1('0x8'));var csv=require(_0xe7e1('0x9'));var ejs=require(_0xe7e1('0xa'));var fs=require('fs');var fs_extra=require(_0xe7e1('0xb'));var _=require(_0xe7e1('0xc'));var squel=require(_0xe7e1('0xd'));var crypto=require(_0xe7e1('0xe'));var jsforce=require(_0xe7e1('0xf'));var deskjs=require(_0xe7e1('0x10'));var toCsv=require(_0xe7e1('0x9'));var querystring=require(_0xe7e1('0x11'));var Papa=require(_0xe7e1('0x12'));var Redis=require(_0xe7e1('0x13'));var authService=require(_0xe7e1('0x14'));var qs=require(_0xe7e1('0x15'));var as=require(_0xe7e1('0x16'));var hardwareService=require(_0xe7e1('0x17'));var logger=require(_0xe7e1('0x18'))(_0xe7e1('0x19'));var utils=require('../../config/utils');var config=require(_0xe7e1('0x1a'));var licenseUtil=require(_0xe7e1('0x1b'));var db=require(_0xe7e1('0x1c'))['db'];var integrations=require(_0xe7e1('0x1d'));function respondWithStatusCode(_0x265fa5,_0x371705){_0x371705=_0x371705||0xcc;return function(_0x36b697){if(_0x36b697){return _0x265fa5[_0xe7e1('0x1e')](_0x371705);}return _0x265fa5[_0xe7e1('0x1f')](_0x371705)[_0xe7e1('0x20')]();};}function respondWithResult(_0x203a5e,_0x342a1a){_0x342a1a=_0x342a1a||0xc8;return function(_0x21cead){if(_0x21cead){return _0x203a5e['status'](_0x342a1a)[_0xe7e1('0x21')](_0x21cead);}};}function respondWithFilteredResult(_0x4dc54a,_0xdf9053){return function(_0x37b12f){if(_0x37b12f){var _0x145b32=typeof _0xdf9053[_0xe7e1('0x22')]===_0xe7e1('0x23')&&typeof _0xdf9053[_0xe7e1('0x24')]===_0xe7e1('0x23');var _0x3dd1d5=_0x37b12f['count'];var _0x278742=_0x145b32?0x0:_0xdf9053[_0xe7e1('0x22')];var _0x5943a6=_0x145b32?_0x37b12f[_0xe7e1('0x25')]:_0xdf9053[_0xe7e1('0x22')]+_0xdf9053[_0xe7e1('0x24')];var _0x5679f1;if(_0x5943a6>=_0x3dd1d5){_0x5943a6=_0x3dd1d5;_0x5679f1=0xc8;}else{_0x5679f1=0xce;}_0x4dc54a[_0xe7e1('0x1f')](_0x5679f1);return _0x4dc54a['set'](_0xe7e1('0x26'),_0x278742+'-'+_0x5943a6+'/'+_0x3dd1d5)[_0xe7e1('0x21')](_0x37b12f);}return null;};}function patchUpdates(_0x42901f){return function(_0x3c3b38){try{jsonpatch[_0xe7e1('0x27')](_0x3c3b38,_0x42901f,!![]);}catch(_0x398f79){return BPromise[_0xe7e1('0x28')](_0x398f79);}return _0x3c3b38[_0xe7e1('0x29')]();};}function saveUpdates(_0x42a9be,_0x2a522e){return function(_0x16a8eb){if(_0x16a8eb){return _0x16a8eb[_0xe7e1('0x2a')](_0x42a9be)[_0xe7e1('0x2b')](function(_0xaf4488){return _0xaf4488;});}return null;};}function removeEntity(_0x497537,_0x24aede){return function(_0x5df425){if(_0x5df425){return _0x5df425[_0xe7e1('0x2c')]()[_0xe7e1('0x2b')](function(){_0x497537[_0xe7e1('0x1f')](0xcc)[_0xe7e1('0x20')]();});}};}function handleEntityNotFound(_0x1740b6,_0x3aece5){return function(_0x4abb5f){if(!_0x4abb5f){_0x1740b6[_0xe7e1('0x1e')](0x194);}return _0x4abb5f;};}function handleError(_0x601808,_0x520e30){_0x520e30=_0x520e30||0x1f4;return function(_0x528fc8){logger['error'](_0x528fc8[_0xe7e1('0x2d')]);if(_0x528fc8[_0xe7e1('0x2e')]){delete _0x528fc8[_0xe7e1('0x2e')];}_0x601808[_0xe7e1('0x1f')](_0x520e30)['send'](_0x528fc8);};}exports[_0xe7e1('0x2f')]=function(_0x2da210,_0x5be3cc){var _0x56f13e={},_0x15e8da={},_0x1b0137={'count':0x0,'rows':[]};var _0x10c5a8=_['map'](db[_0xe7e1('0x30')][_0xe7e1('0x31')],function(_0x38ed64){return{'name':_0x38ed64[_0xe7e1('0x32')],'type':_0x38ed64['type']['key']};});_0x15e8da[_0xe7e1('0x33')]=_[_0xe7e1('0x34')](_0x10c5a8,_0xe7e1('0x2e'));_0x15e8da['query']=_[_0xe7e1('0x35')](_0x2da210[_0xe7e1('0x36')]);_0x15e8da[_0xe7e1('0x37')]=_['intersection'](_0x15e8da[_0xe7e1('0x33')],_0x15e8da[_0xe7e1('0x36')]);_0x56f13e[_0xe7e1('0x38')]=_[_0xe7e1('0x39')](_0x15e8da[_0xe7e1('0x33')],qs['fields'](_0x2da210[_0xe7e1('0x36')][_0xe7e1('0x3a')]));_0x56f13e['attributes']=_0x56f13e[_0xe7e1('0x38')][_0xe7e1('0x3b')]?_0x56f13e[_0xe7e1('0x38')]:_0x15e8da[_0xe7e1('0x33')];if(!_0x2da210['query'][_0xe7e1('0x3c')](_0xe7e1('0x3d'))){_0x56f13e[_0xe7e1('0x24')]=qs[_0xe7e1('0x24')](_0x2da210['query'][_0xe7e1('0x24')]);_0x56f13e[_0xe7e1('0x22')]=qs[_0xe7e1('0x22')](_0x2da210[_0xe7e1('0x36')]['offset']);}_0x56f13e[_0xe7e1('0x3e')]=qs[_0xe7e1('0x3f')](_0x2da210['query'][_0xe7e1('0x3f')]);_0x56f13e[_0xe7e1('0x40')]=qs[_0xe7e1('0x37')](_[_0xe7e1('0x41')](_0x2da210[_0xe7e1('0x36')],_0x15e8da[_0xe7e1('0x37')]),_0x10c5a8);if(_0x2da210[_0xe7e1('0x36')][_0xe7e1('0x42')]){_0x56f13e[_0xe7e1('0x40')]=_['merge'](_0x56f13e['where'],{'$or':_[_0xe7e1('0x34')](_0x10c5a8,function(_0x23c5cf){if(_0x23c5cf[_0xe7e1('0x43')]!=='VIRTUAL'){var _0x359170={};_0x359170[_0x23c5cf['name']]={'$like':'%'+_0x2da210[_0xe7e1('0x36')][_0xe7e1('0x42')]+'%'};return _0x359170;}})});}_0x56f13e=_[_0xe7e1('0x44')]({},_0x56f13e,_0x2da210[_0xe7e1('0x45')]);var _0x266820={'where':_0x56f13e[_0xe7e1('0x40')]};return db[_0xe7e1('0x30')][_0xe7e1('0x25')](_0x266820)[_0xe7e1('0x2b')](function(_0x7e841a){_0x1b0137['count']=_0x7e841a;if(_0x2da210[_0xe7e1('0x36')]['includeAll']){_0x56f13e[_0xe7e1('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0xe7e1('0x47')](_0x56f13e);})[_0xe7e1('0x2b')](function(_0xc6ab60){_0x1b0137['rows']=_0xc6ab60;return _0x1b0137;})['then'](respondWithFilteredResult(_0x5be3cc,_0x56f13e))[_0xe7e1('0x48')](handleError(_0x5be3cc,null));};exports[_0xe7e1('0x49')]=function(_0x2fec3a,_0x161c40){var _0x60ed8c={'raw':![],'where':{'id':_0x2fec3a[_0xe7e1('0x4a')]['id']}},_0x20a4cd={};_0x20a4cd['model']=_['keys'](db[_0xe7e1('0x30')][_0xe7e1('0x31')]);_0x20a4cd['query']=_[_0xe7e1('0x35')](_0x2fec3a[_0xe7e1('0x36')]);_0x20a4cd[_0xe7e1('0x37')]=_['intersection'](_0x20a4cd[_0xe7e1('0x33')],_0x20a4cd['query']);_0x60ed8c[_0xe7e1('0x38')]=_[_0xe7e1('0x39')](_0x20a4cd[_0xe7e1('0x33')],qs[_0xe7e1('0x3a')](_0x2fec3a[_0xe7e1('0x36')][_0xe7e1('0x3a')]));_0x60ed8c[_0xe7e1('0x38')]=_0x60ed8c[_0xe7e1('0x38')][_0xe7e1('0x3b')]?_0x60ed8c['attributes']:_0x20a4cd['model'];if(_0x2fec3a['query'][_0xe7e1('0x4b')]){_0x60ed8c[_0xe7e1('0x46')]=[{'all':!![]}];}_0x60ed8c=_[_0xe7e1('0x44')]({},_0x60ed8c,_0x2fec3a[_0xe7e1('0x45')]);return db['DeskAccount']['find'](_0x60ed8c)['then'](handleEntityNotFound(_0x161c40,null))[_0xe7e1('0x2b')](respondWithResult(_0x161c40,null))[_0xe7e1('0x48')](handleError(_0x161c40,null));};exports[_0xe7e1('0x4c')]=function(_0x54ea09,_0x3cd5ad){return db[_0xe7e1('0x30')]['create'](_0x54ea09[_0xe7e1('0x4d')],{})[_0xe7e1('0x2b')](respondWithResult(_0x3cd5ad,0xc9))[_0xe7e1('0x48')](handleError(_0x3cd5ad,null));};exports[_0xe7e1('0x2a')]=function(_0x329f91,_0x5335b7){if(_0x329f91['body']['id']){delete _0x329f91['body']['id'];}return db[_0xe7e1('0x30')]['find']({'where':{'id':_0x329f91[_0xe7e1('0x4a')]['id']}})[_0xe7e1('0x2b')](handleEntityNotFound(_0x5335b7,null))[_0xe7e1('0x2b')](saveUpdates(_0x329f91[_0xe7e1('0x4d')],null))[_0xe7e1('0x2b')](respondWithResult(_0x5335b7,null))[_0xe7e1('0x48')](handleError(_0x5335b7,null));};exports[_0xe7e1('0x2c')]=function(_0x4a4d8c,_0xcf8be6){return db[_0xe7e1('0x30')][_0xe7e1('0x4e')]({'where':{'id':_0x4a4d8c[_0xe7e1('0x4a')]['id']}})[_0xe7e1('0x2b')](handleEntityNotFound(_0xcf8be6,null))[_0xe7e1('0x2b')](removeEntity(_0xcf8be6,null))[_0xe7e1('0x48')](handleError(_0xcf8be6,null));};exports['getConfigurations']=function(_0x47c5d8,_0x2207f4,_0xf7f4de){var _0x2d20ed={};var _0x85ae4f={};var _0x1c934f;var _0x492510;return db[_0xe7e1('0x30')][_0xe7e1('0x4f')]({'where':{'id':_0x47c5d8['params']['id']}})[_0xe7e1('0x2b')](handleEntityNotFound(_0x2207f4,null))['then'](function(_0x39d798){if(_0x39d798){_0x1c934f=_0x39d798;_0x85ae4f[_0xe7e1('0x33')]=_['keys'](db[_0xe7e1('0x50')][_0xe7e1('0x31')]);_0x85ae4f['query']=_[_0xe7e1('0x35')](_0x47c5d8[_0xe7e1('0x36')]);_0x85ae4f[_0xe7e1('0x37')]=_[_0xe7e1('0x39')](_0x85ae4f[_0xe7e1('0x33')],_0x85ae4f[_0xe7e1('0x36')]);_0x2d20ed['attributes']=_[_0xe7e1('0x39')](_0x85ae4f[_0xe7e1('0x33')],qs['fields'](_0x47c5d8['query'][_0xe7e1('0x3a')]));_0x2d20ed[_0xe7e1('0x38')]=_0x2d20ed[_0xe7e1('0x38')]['length']?_0x2d20ed[_0xe7e1('0x38')]:_0x85ae4f[_0xe7e1('0x33')];_0x2d20ed[_0xe7e1('0x3e')]=qs[_0xe7e1('0x3f')](_0x47c5d8[_0xe7e1('0x36')]['sort']);_0x2d20ed[_0xe7e1('0x40')]=qs[_0xe7e1('0x37')](_[_0xe7e1('0x41')](_0x47c5d8['query'],_0x85ae4f[_0xe7e1('0x37')]));if(_0x47c5d8[_0xe7e1('0x36')][_0xe7e1('0x42')]){_0x2d20ed[_0xe7e1('0x40')]=_['merge'](_0x2d20ed[_0xe7e1('0x40')],{'$or':_[_0xe7e1('0x34')](_0x2d20ed[_0xe7e1('0x38')],function(_0x53353){var _0x587180={};_0x587180[_0x53353]={'$like':'%'+_0x47c5d8[_0xe7e1('0x36')][_0xe7e1('0x42')]+'%'};return _0x587180;})});}_0x2d20ed=_[_0xe7e1('0x44')]({},_0x2d20ed,_0x47c5d8[_0xe7e1('0x45')]);return _0x1c934f[_0xe7e1('0x51')](_0x2d20ed);}})[_0xe7e1('0x2b')](function(_0x2f8b2e){if(_0x2f8b2e){_0x492510=_0x2f8b2e[_0xe7e1('0x3b')];if(!_0x47c5d8[_0xe7e1('0x36')][_0xe7e1('0x3c')](_0xe7e1('0x3d'))){_0x2d20ed['limit']=qs[_0xe7e1('0x24')](_0x47c5d8['query']['limit']);_0x2d20ed['offset']=qs[_0xe7e1('0x22')](_0x47c5d8[_0xe7e1('0x36')]['offset']);}return _0x1c934f[_0xe7e1('0x51')](_0x2d20ed);}})['then'](function(_0x1102fe){if(_0x1102fe){return _0x1102fe?{'count':_0x492510,'rows':_0x1102fe}:null;}})[_0xe7e1('0x2b')](respondWithResult(_0x2207f4,null))[_0xe7e1('0x48')](handleError(_0x2207f4,null));};exports[_0xe7e1('0x52')]=function(_0x36bac9,_0x28b447,_0x2bb128){if(_0x36bac9['body']['id']){delete _0x36bac9[_0xe7e1('0x4d')]['id'];}return db[_0xe7e1('0x30')][_0xe7e1('0x4f')]({'where':{'id':_0x36bac9['params']['id']}})[_0xe7e1('0x2b')](handleEntityNotFound(_0x28b447,null))[_0xe7e1('0x2b')](function(_0x575e2e){if(_0x575e2e){_0x36bac9[_0xe7e1('0x4d')][_0xe7e1('0x53')]=_0x575e2e['id'];_0x36bac9[_0xe7e1('0x4d')][_0xe7e1('0x54')]=integrations[_0xe7e1('0x55')](_0x36bac9[_0xe7e1('0x4d')][_0xe7e1('0x56')],_0x36bac9[_0xe7e1('0x4d')][_0xe7e1('0x43')]);_0x36bac9[_0xe7e1('0x4d')][_0xe7e1('0x57')]=integrations[_0xe7e1('0x58')](_0x36bac9['body']['channel'],_0x36bac9[_0xe7e1('0x4d')][_0xe7e1('0x43')]);return db['DeskConfiguration']['create'](_0x36bac9[_0xe7e1('0x4d')],{'include':[{'model':db['DeskField'],'as':_0xe7e1('0x54')},{'model':db[_0xe7e1('0x59')],'as':_0xe7e1('0x57')}]});}return null;})[_0xe7e1('0x2b')](respondWithResult(_0x28b447,null))[_0xe7e1('0x48')](handleError(_0x28b447,null));};exports[_0xe7e1('0x5a')]=function(_0x2328c9,_0x331f98,_0x33563c){var _0x37575f=[{'name':'priority','label':_0xe7e1('0x5b'),'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 _0x1bf613='';return db[_0xe7e1('0x30')]['findOne']({'where':{'id':_0x2328c9['params']['id']},'attributes':['id','remoteUri',_0xe7e1('0x5c'),_0xe7e1('0x5d'),_0xe7e1('0x5e'),_0xe7e1('0x5f'),_0xe7e1('0x60'),_0xe7e1('0x61'),_0xe7e1('0x62')]})[_0xe7e1('0x2b')](handleEntityNotFound(_0x331f98,null))[_0xe7e1('0x2b')](function(_0x4a8de0){if(_0x4a8de0){_0x1bf613=_0x4a8de0['remoteUri'];var _0x2d7375=_0x1bf613[_0xe7e1('0x63')](-0x1);if(_0x2d7375==='/'){_0x1bf613=_0x1bf613[_0xe7e1('0x64')](0x0,_0x1bf613['lastIndexOf'](_0x2d7375));}var _0x42ff15={'method':_0xe7e1('0x65'),'uri':util['format'](_0xe7e1('0x66'),_0x1bf613),'headers':{'Content-Type':_0xe7e1('0x67'),'Accept':_0xe7e1('0x67')},'json':!![]};if(_0x4a8de0[_0xe7e1('0x5c')]==='basic'){_0x42ff15[_0xe7e1('0x68')][_0xe7e1('0x69')]=util['format']('Basic\x20%s',new Buffer(util[_0xe7e1('0x6a')]('%s:%s',_0x4a8de0[_0xe7e1('0x5d')],_0x4a8de0[_0xe7e1('0x5e')]))['toString'](_0xe7e1('0x6b')));}return rp(_0x42ff15)[_0xe7e1('0x2b')](function(_0x4217b2){return _0x37575f['concat'](_[_0xe7e1('0x34')](_0x4217b2[_0xe7e1('0x6c')]['entries'],function(_0x442b7f){return{'id':_0x442b7f[_0xe7e1('0x2e')],'name':_0x442b7f[_0xe7e1('0x2e')],'type':_0x442b7f[_0xe7e1('0x43')],'active':_0x442b7f[_0xe7e1('0x6d')],'label':_0x442b7f[_0xe7e1('0x6e')],'custom':!![]};}));});}})[_0xe7e1('0x2b')](function(_0x225b25){return{'count':_0x225b25[_0xe7e1('0x3b')],'rows':_0x225b25};})[_0xe7e1('0x2b')](respondWithResult(_0x331f98,null))['catch'](function(_0x21a9dc){var _0x23372d=_0x2328c9[_0xe7e1('0x36')][_0xe7e1('0x6f')]?0x1f4:_0x21a9dc[_0xe7e1('0x70')]||0x1f4;logger[_0xe7e1('0x71')](_0xe7e1('0x72'),_0xe7e1('0x5a'),_0x23372d,JSON[_0xe7e1('0x73')](_0x21a9dc));delete _0x21a9dc[_0xe7e1('0x2e')];if(_0x23372d===0x191){_0x23372d=0x190;}_0x331f98[_0xe7e1('0x1f')](_0x23372d)[_0xe7e1('0x74')](_0x2328c9[_0xe7e1('0x36')][_0xe7e1('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x21a9dc[_0xe7e1('0x70')]}:_0x21a9dc);});}; \ No newline at end of file +var _0x8541=['getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','headers','Authorization','format','Basic\x20%s','%s:%s','username','toString','_embedded','active','label','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','find','create','body','params','getConfigurations','findOne','DeskConfiguration','options','addConfiguration','AccountId','Subjects'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x8541,0x95));var _0x1854=function(_0x2acaaa,_0x13ad7d){_0x2acaaa=_0x2acaaa-0x0;var _0x142546=_0x8541[_0x2acaaa];return _0x142546;};'use strict';var emlformat=require(_0x1854('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1854('0x1'));var jsonpatch=require(_0x1854('0x2'));var rp=require('request-promise');var moment=require(_0x1854('0x3'));var BPromise=require(_0x1854('0x4'));var Mustache=require('mustache');var util=require(_0x1854('0x5'));var path=require(_0x1854('0x6'));var sox=require('sox');var csv=require(_0x1854('0x7'));var ejs=require(_0x1854('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1854('0x9'));var squel=require(_0x1854('0xa'));var crypto=require(_0x1854('0xb'));var jsforce=require(_0x1854('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1854('0x7'));var querystring=require(_0x1854('0xd'));var Papa=require(_0x1854('0xe'));var Redis=require(_0x1854('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1854('0x10'));var as=require(_0x1854('0x11'));var hardwareService=require(_0x1854('0x12'));var logger=require('../../config/logger')(_0x1854('0x13'));var utils=require(_0x1854('0x14'));var config=require(_0x1854('0x15'));var licenseUtil=require(_0x1854('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1854('0x17'));function respondWithStatusCode(_0x3db411,_0x5d57ba){_0x5d57ba=_0x5d57ba||0xcc;return function(_0x470773){if(_0x470773){return _0x3db411[_0x1854('0x18')](_0x5d57ba);}return _0x3db411[_0x1854('0x19')](_0x5d57ba)[_0x1854('0x1a')]();};}function respondWithResult(_0x498a6b,_0x8c1aaf){_0x8c1aaf=_0x8c1aaf||0xc8;return function(_0x5e2544){if(_0x5e2544){return _0x498a6b['status'](_0x8c1aaf)[_0x1854('0x1b')](_0x5e2544);}};}function respondWithFilteredResult(_0x25f035,_0x5b03cb){return function(_0x2585b1){if(_0x2585b1){var _0x5f4cd9=typeof _0x5b03cb['offset']===_0x1854('0x1c')&&typeof _0x5b03cb[_0x1854('0x1d')]==='undefined';var _0x42b520=_0x2585b1[_0x1854('0x1e')];var _0x3c4e61=_0x5f4cd9?0x0:_0x5b03cb[_0x1854('0x1f')];var _0x2b5b00=_0x5f4cd9?_0x2585b1[_0x1854('0x1e')]:_0x5b03cb['offset']+_0x5b03cb['limit'];var _0x2de1ab;if(_0x2b5b00>=_0x42b520){_0x2b5b00=_0x42b520;_0x2de1ab=0xc8;}else{_0x2de1ab=0xce;}_0x25f035[_0x1854('0x19')](_0x2de1ab);return _0x25f035[_0x1854('0x20')](_0x1854('0x21'),_0x3c4e61+'-'+_0x2b5b00+'/'+_0x42b520)['json'](_0x2585b1);}return null;};}function patchUpdates(_0x25951b){return function(_0xa56bd9){try{jsonpatch[_0x1854('0x22')](_0xa56bd9,_0x25951b,!![]);}catch(_0x1ebd50){return BPromise[_0x1854('0x23')](_0x1ebd50);}return _0xa56bd9['save']();};}function saveUpdates(_0x3638e3,_0x3af58b){return function(_0x4406f9){if(_0x4406f9){return _0x4406f9[_0x1854('0x24')](_0x3638e3)[_0x1854('0x25')](function(_0x32fc58){return _0x32fc58;});}return null;};}function removeEntity(_0x5a0c85,_0x56efff){return function(_0x493077){if(_0x493077){return _0x493077[_0x1854('0x26')]()[_0x1854('0x25')](function(){_0x5a0c85[_0x1854('0x19')](0xcc)[_0x1854('0x1a')]();});}};}function handleEntityNotFound(_0x33bf84,_0x3d1f1c){return function(_0x37bdf0){if(!_0x37bdf0){_0x33bf84[_0x1854('0x18')](0x194);}return _0x37bdf0;};}function handleError(_0x580786,_0x45cdd0){_0x45cdd0=_0x45cdd0||0x1f4;return function(_0x3f5e00){logger['error'](_0x3f5e00[_0x1854('0x27')]);if(_0x3f5e00[_0x1854('0x28')]){delete _0x3f5e00[_0x1854('0x28')];}_0x580786[_0x1854('0x19')](_0x45cdd0)[_0x1854('0x29')](_0x3f5e00);};}exports[_0x1854('0x2a')]=function(_0x1d8a5a,_0x402f4e){var _0x555cac={},_0x5e80bf={},_0x2ccd65={'count':0x0,'rows':[]};var _0x217ef6=_[_0x1854('0x2b')](db[_0x1854('0x2c')][_0x1854('0x2d')],function(_0x310a91){return{'name':_0x310a91['fieldName'],'type':_0x310a91['type'][_0x1854('0x2e')]};});_0x5e80bf[_0x1854('0x2f')]=_[_0x1854('0x2b')](_0x217ef6,_0x1854('0x28'));_0x5e80bf[_0x1854('0x30')]=_[_0x1854('0x31')](_0x1d8a5a[_0x1854('0x30')]);_0x5e80bf[_0x1854('0x32')]=_[_0x1854('0x33')](_0x5e80bf['model'],_0x5e80bf[_0x1854('0x30')]);_0x555cac[_0x1854('0x34')]=_['intersection'](_0x5e80bf['model'],qs[_0x1854('0x35')](_0x1d8a5a[_0x1854('0x30')][_0x1854('0x35')]));_0x555cac[_0x1854('0x34')]=_0x555cac['attributes'][_0x1854('0x36')]?_0x555cac[_0x1854('0x34')]:_0x5e80bf[_0x1854('0x2f')];if(!_0x1d8a5a['query'][_0x1854('0x37')](_0x1854('0x38'))){_0x555cac[_0x1854('0x1d')]=qs[_0x1854('0x1d')](_0x1d8a5a[_0x1854('0x30')]['limit']);_0x555cac[_0x1854('0x1f')]=qs[_0x1854('0x1f')](_0x1d8a5a[_0x1854('0x30')][_0x1854('0x1f')]);}_0x555cac[_0x1854('0x39')]=qs[_0x1854('0x3a')](_0x1d8a5a[_0x1854('0x30')][_0x1854('0x3a')]);_0x555cac[_0x1854('0x3b')]=qs[_0x1854('0x32')](_[_0x1854('0x3c')](_0x1d8a5a[_0x1854('0x30')],_0x5e80bf[_0x1854('0x32')]),_0x217ef6);if(_0x1d8a5a[_0x1854('0x30')][_0x1854('0x3d')]){_0x555cac[_0x1854('0x3b')]=_[_0x1854('0x3e')](_0x555cac[_0x1854('0x3b')],{'$or':_[_0x1854('0x2b')](_0x217ef6,function(_0x540e49){if(_0x540e49[_0x1854('0x3f')]!==_0x1854('0x40')){var _0xa07bad={};_0xa07bad[_0x540e49[_0x1854('0x28')]]={'$like':'%'+_0x1d8a5a[_0x1854('0x30')]['filter']+'%'};return _0xa07bad;}})});}_0x555cac=_[_0x1854('0x3e')]({},_0x555cac,_0x1d8a5a['options']);var _0x21a1ad={'where':_0x555cac['where']};return db[_0x1854('0x2c')][_0x1854('0x1e')](_0x21a1ad)[_0x1854('0x25')](function(_0x31d4d6){_0x2ccd65['count']=_0x31d4d6;if(_0x1d8a5a[_0x1854('0x30')][_0x1854('0x41')]){_0x555cac[_0x1854('0x42')]=[{'all':!![]}];}return db['DeskAccount'][_0x1854('0x43')](_0x555cac);})[_0x1854('0x25')](function(_0x1357b7){_0x2ccd65[_0x1854('0x44')]=_0x1357b7;return _0x2ccd65;})[_0x1854('0x25')](respondWithFilteredResult(_0x402f4e,_0x555cac))[_0x1854('0x45')](handleError(_0x402f4e,null));};exports['show']=function(_0xa45cf0,_0x46eb22){var _0x38221d={'raw':![],'where':{'id':_0xa45cf0['params']['id']}},_0x1d8e1e={};_0x1d8e1e[_0x1854('0x2f')]=_[_0x1854('0x31')](db['DeskAccount']['rawAttributes']);_0x1d8e1e[_0x1854('0x30')]=_[_0x1854('0x31')](_0xa45cf0[_0x1854('0x30')]);_0x1d8e1e[_0x1854('0x32')]=_[_0x1854('0x33')](_0x1d8e1e['model'],_0x1d8e1e[_0x1854('0x30')]);_0x38221d['attributes']=_['intersection'](_0x1d8e1e[_0x1854('0x2f')],qs[_0x1854('0x35')](_0xa45cf0[_0x1854('0x30')][_0x1854('0x35')]));_0x38221d[_0x1854('0x34')]=_0x38221d[_0x1854('0x34')][_0x1854('0x36')]?_0x38221d[_0x1854('0x34')]:_0x1d8e1e[_0x1854('0x2f')];if(_0xa45cf0[_0x1854('0x30')]['includeAll']){_0x38221d['include']=[{'all':!![]}];}_0x38221d=_['merge']({},_0x38221d,_0xa45cf0['options']);return db[_0x1854('0x2c')][_0x1854('0x46')](_0x38221d)[_0x1854('0x25')](handleEntityNotFound(_0x46eb22,null))[_0x1854('0x25')](respondWithResult(_0x46eb22,null))[_0x1854('0x45')](handleError(_0x46eb22,null));};exports[_0x1854('0x47')]=function(_0xe7306b,_0x38383a){return db[_0x1854('0x2c')][_0x1854('0x47')](_0xe7306b[_0x1854('0x48')],{})[_0x1854('0x25')](respondWithResult(_0x38383a,0xc9))['catch'](handleError(_0x38383a,null));};exports[_0x1854('0x24')]=function(_0x5f213b,_0x2628b9){if(_0x5f213b[_0x1854('0x48')]['id']){delete _0x5f213b['body']['id'];}return db[_0x1854('0x2c')]['find']({'where':{'id':_0x5f213b[_0x1854('0x49')]['id']}})[_0x1854('0x25')](handleEntityNotFound(_0x2628b9,null))[_0x1854('0x25')](saveUpdates(_0x5f213b[_0x1854('0x48')],null))['then'](respondWithResult(_0x2628b9,null))[_0x1854('0x45')](handleError(_0x2628b9,null));};exports['destroy']=function(_0x1c2d17,_0x4dba74){return db['DeskAccount'][_0x1854('0x46')]({'where':{'id':_0x1c2d17[_0x1854('0x49')]['id']}})['then'](handleEntityNotFound(_0x4dba74,null))[_0x1854('0x25')](removeEntity(_0x4dba74,null))[_0x1854('0x45')](handleError(_0x4dba74,null));};exports[_0x1854('0x4a')]=function(_0x5ee48a,_0x5ec1cd,_0x386f3a){var _0x41380f={};var _0x1f45cf={};var _0x28cc63;var _0x37560d;return db[_0x1854('0x2c')][_0x1854('0x4b')]({'where':{'id':_0x5ee48a[_0x1854('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ec1cd,null))[_0x1854('0x25')](function(_0x57aa3f){if(_0x57aa3f){_0x28cc63=_0x57aa3f;_0x1f45cf[_0x1854('0x2f')]=_['keys'](db[_0x1854('0x4c')][_0x1854('0x2d')]);_0x1f45cf[_0x1854('0x30')]=_[_0x1854('0x31')](_0x5ee48a[_0x1854('0x30')]);_0x1f45cf[_0x1854('0x32')]=_[_0x1854('0x33')](_0x1f45cf[_0x1854('0x2f')],_0x1f45cf[_0x1854('0x30')]);_0x41380f['attributes']=_[_0x1854('0x33')](_0x1f45cf[_0x1854('0x2f')],qs['fields'](_0x5ee48a['query']['fields']));_0x41380f[_0x1854('0x34')]=_0x41380f[_0x1854('0x34')][_0x1854('0x36')]?_0x41380f[_0x1854('0x34')]:_0x1f45cf['model'];_0x41380f[_0x1854('0x39')]=qs[_0x1854('0x3a')](_0x5ee48a[_0x1854('0x30')][_0x1854('0x3a')]);_0x41380f[_0x1854('0x3b')]=qs['filters'](_[_0x1854('0x3c')](_0x5ee48a[_0x1854('0x30')],_0x1f45cf[_0x1854('0x32')]));if(_0x5ee48a[_0x1854('0x30')]['filter']){_0x41380f[_0x1854('0x3b')]=_[_0x1854('0x3e')](_0x41380f[_0x1854('0x3b')],{'$or':_[_0x1854('0x2b')](_0x41380f[_0x1854('0x34')],function(_0x2fe6b5){var _0xe1966c={};_0xe1966c[_0x2fe6b5]={'$like':'%'+_0x5ee48a[_0x1854('0x30')]['filter']+'%'};return _0xe1966c;})});}_0x41380f=_[_0x1854('0x3e')]({},_0x41380f,_0x5ee48a[_0x1854('0x4d')]);return _0x28cc63[_0x1854('0x4a')](_0x41380f);}})[_0x1854('0x25')](function(_0x1e74fb){if(_0x1e74fb){_0x37560d=_0x1e74fb[_0x1854('0x36')];if(!_0x5ee48a[_0x1854('0x30')]['hasOwnProperty'](_0x1854('0x38'))){_0x41380f['limit']=qs[_0x1854('0x1d')](_0x5ee48a[_0x1854('0x30')][_0x1854('0x1d')]);_0x41380f[_0x1854('0x1f')]=qs['offset'](_0x5ee48a[_0x1854('0x30')][_0x1854('0x1f')]);}return _0x28cc63[_0x1854('0x4a')](_0x41380f);}})[_0x1854('0x25')](function(_0x59905b){if(_0x59905b){return _0x59905b?{'count':_0x37560d,'rows':_0x59905b}:null;}})[_0x1854('0x25')](respondWithResult(_0x5ec1cd,null))[_0x1854('0x45')](handleError(_0x5ec1cd,null));};exports[_0x1854('0x4e')]=function(_0x5b9258,_0x42a6f2,_0x1cc9bb){if(_0x5b9258[_0x1854('0x48')]['id']){delete _0x5b9258['body']['id'];}return db[_0x1854('0x2c')][_0x1854('0x4b')]({'where':{'id':_0x5b9258[_0x1854('0x49')]['id']}})['then'](handleEntityNotFound(_0x42a6f2,null))['then'](function(_0x136ce2){if(_0x136ce2){_0x5b9258['body'][_0x1854('0x4f')]=_0x136ce2['id'];_0x5b9258['body'][_0x1854('0x50')]=integrations[_0x1854('0x51')](_0x5b9258[_0x1854('0x48')][_0x1854('0x52')],_0x5b9258[_0x1854('0x48')][_0x1854('0x3f')]);_0x5b9258[_0x1854('0x48')][_0x1854('0x53')]=integrations[_0x1854('0x54')](_0x5b9258[_0x1854('0x48')][_0x1854('0x52')],_0x5b9258[_0x1854('0x48')]['type']);return db[_0x1854('0x4c')]['create'](_0x5b9258[_0x1854('0x48')],{'include':[{'model':db[_0x1854('0x55')],'as':_0x1854('0x50')},{'model':db[_0x1854('0x55')],'as':_0x1854('0x53')}]});}return null;})['then'](respondWithResult(_0x42a6f2,null))[_0x1854('0x45')](handleError(_0x42a6f2,null));};exports[_0x1854('0x56')]=function(_0x9c688a,_0x3f867c,_0x274ec7){var _0x641fd1=[{'name':_0x1854('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 _0x46dd9a='';return db['DeskAccount'][_0x1854('0x4b')]({'where':{'id':_0x9c688a['params']['id']},'attributes':['id',_0x1854('0x58'),_0x1854('0x59'),'username',_0x1854('0x5a'),_0x1854('0x5b'),_0x1854('0x5c'),_0x1854('0x5d'),_0x1854('0x5e')]})[_0x1854('0x25')](handleEntityNotFound(_0x3f867c,null))[_0x1854('0x25')](function(_0x4cabb8){if(_0x4cabb8){_0x46dd9a=_0x4cabb8[_0x1854('0x58')];var _0x27d267=_0x46dd9a['slice'](-0x1);if(_0x27d267==='/'){_0x46dd9a=_0x46dd9a[_0x1854('0x5f')](0x0,_0x46dd9a[_0x1854('0x60')](_0x27d267));}var _0x34a38b={'method':_0x1854('0x61'),'uri':util['format'](_0x1854('0x62'),_0x46dd9a),'headers':{'Content-Type':_0x1854('0x63'),'Accept':'application/json'},'json':!![]};if(_0x4cabb8[_0x1854('0x59')]==='basic'){_0x34a38b[_0x1854('0x64')][_0x1854('0x65')]=util[_0x1854('0x66')](_0x1854('0x67'),new Buffer(util[_0x1854('0x66')](_0x1854('0x68'),_0x4cabb8[_0x1854('0x69')],_0x4cabb8['password']))[_0x1854('0x6a')]('base64'));}return rp(_0x34a38b)[_0x1854('0x25')](function(_0x28e40c){return _0x641fd1['concat'](_[_0x1854('0x2b')](_0x28e40c[_0x1854('0x6b')]['entries'],function(_0x5b726e){return{'id':_0x5b726e[_0x1854('0x28')],'name':_0x5b726e[_0x1854('0x28')],'type':_0x5b726e[_0x1854('0x3f')],'active':_0x5b726e[_0x1854('0x6c')],'label':_0x5b726e[_0x1854('0x6d')],'custom':!![]};}));});}})[_0x1854('0x25')](function(_0x3a52f9){return{'count':_0x3a52f9[_0x1854('0x36')],'rows':_0x3a52f9};})[_0x1854('0x25')](respondWithResult(_0x3f867c,null))[_0x1854('0x45')](function(_0x4fe823){var _0x1ebc4e=_0x9c688a[_0x1854('0x30')][_0x1854('0x6e')]?0x1f4:_0x4fe823[_0x1854('0x6f')]||0x1f4;logger[_0x1854('0x70')]('getFields,\x20%s,\x20%s,\x20%s',_0x1854('0x56'),_0x1ebc4e,JSON[_0x1854('0x71')](_0x4fe823));delete _0x4fe823[_0x1854('0x28')];if(_0x1ebc4e===0x191){_0x1ebc4e=0x190;}_0x3f867c[_0x1854('0x19')](_0x1ebc4e)['send'](_0x9c688a['query'][_0x1854('0x6e')]?{'message':_0x1854('0x72'),'statusCode':_0x4fe823[_0x1854('0x6f')]}:_0x4fe823);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3711f20..1b54d37 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 _0xc16d=['rimraf','../../config/environment','../../components/integrations/configuration','define','DeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc16d,0x161));var _0xdc16=function(_0x1e0aea,_0x3f20d0){_0x1e0aea=_0x1e0aea-0x0;var _0x2b3c3d=_0xc16d[_0x1e0aea];return _0x2b3c3d;};'use strict';var _=require(_0xdc16('0x0'));var util=require(_0xdc16('0x1'));var logger=require(_0xdc16('0x2'))('api');var moment=require(_0xdc16('0x3'));var BPromise=require(_0xdc16('0x4'));var rp=require(_0xdc16('0x5'));var fs=require('fs');var path=require(_0xdc16('0x6'));var rimraf=require(_0xdc16('0x7'));var config=require(_0xdc16('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xdc16('0x9'));module['exports']=function(_0x2d24a5,_0x356fe6){return _0x2d24a5[_0xdc16('0xa')](_0xdc16('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd35b=['exports','define','DeskAccount','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x57b740,_0x3a8814){var _0x576e93=function(_0x5b8041){while(--_0x5b8041){_0x57b740['push'](_0x57b740['shift']());}};_0x576e93(++_0x3a8814);}(_0xd35b,0x66));var _0xbd35=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xd35b[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xbd35('0x0'));var util=require(_0xbd35('0x1'));var logger=require(_0xbd35('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbd35('0x3'));var rp=require(_0xbd35('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd35('0x5'));var config=require(_0xbd35('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xbd35('0x7'));module[_0xbd35('0x8')]=function(_0x5e19ca,_0x9bf767){return _0x5e19ca[_0xbd35('0x9')](_0xbd35('0xa'),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 0f6adc2..aadbad8 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 _0xbf26=['jayson/promise','client','then','request\x20sent','debug','error','code','DeskAccount,\x20%s,\x20%s','message','info','result','catch','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetDeskAccount','ShowDeskAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment'];(function(_0x26b1b8,_0x35bfd4){var _0x401762=function(_0x49b4f4){while(--_0x49b4f4){_0x26b1b8['push'](_0x26b1b8['shift']());}};_0x401762(++_0x35bfd4);}(_0xbf26,0x9e));var _0x6bf2=function(_0x5e238f,_0xc78f0b){_0x5e238f=_0x5e238f-0x0;var _0x4de3fa=_0xbf26[_0x5e238f];return _0x4de3fa;};'use strict';var _=require(_0x6bf2('0x0'));var util=require(_0x6bf2('0x1'));var moment=require(_0x6bf2('0x2'));var BPromise=require(_0x6bf2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bf2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6bf2('0x5'))('rpc');var config=require(_0x6bf2('0x6'));var jayson=require(_0x6bf2('0x7'));var client=jayson[_0x6bf2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28d3a5,_0x7c2903,_0x23151c){return new BPromise(function(_0x8260e7,_0x52827c){return client['request'](_0x28d3a5,_0x23151c)[_0x6bf2('0x9')](function(_0x4d009b){logger['info']('DeskAccount,\x20%s,\x20%s',_0x7c2903,_0x6bf2('0xa'));logger[_0x6bf2('0xb')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x7c2903,'request\x20sent',JSON['stringify'](_0x4d009b));if(_0x4d009b[_0x6bf2('0xc')]){if(_0x4d009b[_0x6bf2('0xc')][_0x6bf2('0xd')]===0x1f4){logger[_0x6bf2('0xc')](_0x6bf2('0xe'),_0x7c2903,_0x4d009b[_0x6bf2('0xc')][_0x6bf2('0xf')]);return _0x52827c(_0x4d009b[_0x6bf2('0xc')][_0x6bf2('0xf')]);}logger[_0x6bf2('0xc')](_0x6bf2('0xe'),_0x7c2903,_0x4d009b[_0x6bf2('0xc')][_0x6bf2('0xf')]);return _0x8260e7(_0x4d009b['error']['message']);}else{logger[_0x6bf2('0x10')]('DeskAccount,\x20%s,\x20%s',_0x7c2903,_0x6bf2('0xa'));_0x8260e7(_0x4d009b[_0x6bf2('0x11')][_0x6bf2('0xf')]);}})[_0x6bf2('0x12')](function(_0xcd2a99){logger['error'](_0x6bf2('0xe'),_0x7c2903,_0xcd2a99);_0x52827c(_0xcd2a99);});});}exports['GetDeskAccount']=function(_0x3c0ae0){var _0x19dea7=this;return new Promise(function(_0x322097,_0x414a1c){return db[_0x6bf2('0x13')][_0x6bf2('0x14')]({'raw':_0x3c0ae0[_0x6bf2('0x15')]?_0x3c0ae0[_0x6bf2('0x15')][_0x6bf2('0x16')]===undefined?!![]:![]:!![],'where':_0x3c0ae0['options']?_0x3c0ae0['options'][_0x6bf2('0x17')]||null:null,'attributes':_0x3c0ae0[_0x6bf2('0x15')]?_0x3c0ae0['options']['attributes']||null:null,'limit':_0x3c0ae0['options']?_0x3c0ae0[_0x6bf2('0x15')][_0x6bf2('0x18')]||null:null,'include':_0x3c0ae0['options']?_0x3c0ae0[_0x6bf2('0x15')][_0x6bf2('0x19')]?_[_0x6bf2('0x1a')](_0x3c0ae0['options'][_0x6bf2('0x19')],function(_0xd5e379){return{'model':db[_0xd5e379[_0x6bf2('0x1b')]],'as':_0xd5e379['as'],'attributes':_0xd5e379[_0x6bf2('0x1c')],'include':_0xd5e379[_0x6bf2('0x19')]?_[_0x6bf2('0x1a')](_0xd5e379[_0x6bf2('0x19')],function(_0x17b9a7){return{'model':db[_0x17b9a7[_0x6bf2('0x1b')]],'as':_0x17b9a7['as'],'attributes':_0x17b9a7[_0x6bf2('0x1c')],'include':_0x17b9a7[_0x6bf2('0x19')]?_[_0x6bf2('0x1a')](_0x17b9a7[_0x6bf2('0x19')],function(_0x1ad9d3){return{'model':db[_0x1ad9d3[_0x6bf2('0x1b')]],'as':_0x1ad9d3['as'],'attributes':_0x1ad9d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x6bf2('0x9')](function(_0x57275e){logger[_0x6bf2('0x10')]('GetDeskAccount',_0x3c0ae0);logger[_0x6bf2('0xb')](_0x6bf2('0x1d'),_0x3c0ae0,JSON['stringify'](_0x57275e));_0x322097(_0x57275e);})[_0x6bf2('0x12')](function(_0x1bd0d9){logger[_0x6bf2('0xc')](_0x6bf2('0x1d'),_0x1bd0d9['message'],_0x3c0ae0);_0x414a1c(_0x19dea7[_0x6bf2('0xc')](0x1f4,_0x1bd0d9['message']));});});};exports[_0x6bf2('0x1e')]=function(_0x591d27){var _0x1fd8e7=this;return new Promise(function(_0x4f52d1,_0x852827){return db[_0x6bf2('0x13')][_0x6bf2('0x1f')]({'raw':_0x591d27['options']?_0x591d27[_0x6bf2('0x15')][_0x6bf2('0x16')]===undefined?!![]:![]:!![],'where':_0x591d27[_0x6bf2('0x15')]?_0x591d27[_0x6bf2('0x15')]['where']||null:null,'attributes':_0x591d27['options']?_0x591d27[_0x6bf2('0x15')][_0x6bf2('0x1c')]||null:null,'include':_0x591d27[_0x6bf2('0x15')]?_0x591d27['options'][_0x6bf2('0x19')]?_[_0x6bf2('0x1a')](_0x591d27['options'][_0x6bf2('0x19')],function(_0x48192d){return{'model':db[_0x48192d[_0x6bf2('0x1b')]],'as':_0x48192d['as'],'attributes':_0x48192d[_0x6bf2('0x1c')],'include':_0x48192d[_0x6bf2('0x19')]?_[_0x6bf2('0x1a')](_0x48192d[_0x6bf2('0x19')],function(_0x181940){return{'model':db[_0x181940['model']],'as':_0x181940['as'],'attributes':_0x181940[_0x6bf2('0x1c')],'include':_0x181940[_0x6bf2('0x19')]?_[_0x6bf2('0x1a')](_0x181940[_0x6bf2('0x19')],function(_0x1bff4d){return{'model':db[_0x1bff4d[_0x6bf2('0x1b')]],'as':_0x1bff4d['as'],'attributes':_0x1bff4d[_0x6bf2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6bf2('0x9')](function(_0x34c2e6){logger[_0x6bf2('0x10')]('ShowDeskAccount',_0x591d27);logger[_0x6bf2('0xb')](_0x6bf2('0x1e'),_0x591d27,JSON[_0x6bf2('0x20')](_0x34c2e6));_0x4f52d1(_0x34c2e6);})[_0x6bf2('0x12')](function(_0x32fca1){logger[_0x6bf2('0xc')](_0x6bf2('0x1e'),_0x32fca1[_0x6bf2('0xf')],_0x591d27);_0x852827(_0x1fd8e7[_0x6bf2('0xc')](0x1f4,_0x32fca1[_0x6bf2('0xf')]));});});}; \ No newline at end of file +var _0xc278=['code','DeskAccount,\x20%s,\x20%s','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','map','include','model','attributes','ShowDeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4e0417,_0x574fd4){var _0x5d6909=function(_0x54e5d3){while(--_0x54e5d3){_0x4e0417['push'](_0x4e0417['shift']());}};_0x5d6909(++_0x574fd4);}(_0xc278,0x12b));var _0x8c27=function(_0x2858e6,_0x527a8c){_0x2858e6=_0x2858e6-0x0;var _0x5c3954=_0xc278[_0x2858e6];return _0x5c3954;};'use strict';var _=require(_0x8c27('0x0'));var util=require(_0x8c27('0x1'));var moment=require(_0x8c27('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c27('0x3'));var fs=require('fs');var Redis=require(_0x8c27('0x4'));var db=require(_0x8c27('0x5'))['db'];var utils=require(_0x8c27('0x6'));var logger=require('../../config/logger')(_0x8c27('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8c27('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61f3,_0x51db03,_0xa8359){return new BPromise(function(_0x1966d7,_0x153c94){return client[_0x8c27('0x9')](_0x5a61f3,_0xa8359)[_0x8c27('0xa')](function(_0x502c56){logger['info']('DeskAccount,\x20%s,\x20%s',_0x51db03,_0x8c27('0xb'));logger[_0x8c27('0xc')](_0x8c27('0xd'),_0x51db03,_0x8c27('0xb'),JSON[_0x8c27('0xe')](_0x502c56));if(_0x502c56[_0x8c27('0xf')]){if(_0x502c56[_0x8c27('0xf')][_0x8c27('0x10')]===0x1f4){logger['error'](_0x8c27('0x11'),_0x51db03,_0x502c56[_0x8c27('0xf')][_0x8c27('0x12')]);return _0x153c94(_0x502c56[_0x8c27('0xf')][_0x8c27('0x12')]);}logger[_0x8c27('0xf')](_0x8c27('0x11'),_0x51db03,_0x502c56['error'][_0x8c27('0x12')]);return _0x1966d7(_0x502c56[_0x8c27('0xf')][_0x8c27('0x12')]);}else{logger[_0x8c27('0x13')]('DeskAccount,\x20%s,\x20%s',_0x51db03,_0x8c27('0xb'));_0x1966d7(_0x502c56[_0x8c27('0x14')][_0x8c27('0x12')]);}})[_0x8c27('0x15')](function(_0xe8039c){logger[_0x8c27('0xf')](_0x8c27('0x11'),_0x51db03,_0xe8039c);_0x153c94(_0xe8039c);});});}exports[_0x8c27('0x16')]=function(_0x4f4b03){var _0x52072a=this;return new Promise(function(_0x3c397e,_0x115bd8){return db[_0x8c27('0x17')][_0x8c27('0x18')]({'raw':_0x4f4b03['options']?_0x4f4b03[_0x8c27('0x19')][_0x8c27('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f4b03[_0x8c27('0x19')]?_0x4f4b03[_0x8c27('0x19')][_0x8c27('0x1b')]||null:null,'attributes':_0x4f4b03[_0x8c27('0x19')]?_0x4f4b03['options']['attributes']||null:null,'limit':_0x4f4b03[_0x8c27('0x19')]?_0x4f4b03[_0x8c27('0x19')][_0x8c27('0x1c')]||null:null,'include':_0x4f4b03['options']?_0x4f4b03['options']['include']?_[_0x8c27('0x1d')](_0x4f4b03[_0x8c27('0x19')][_0x8c27('0x1e')],function(_0x4289ed){return{'model':db[_0x4289ed[_0x8c27('0x1f')]],'as':_0x4289ed['as'],'attributes':_0x4289ed[_0x8c27('0x20')],'include':_0x4289ed[_0x8c27('0x1e')]?_[_0x8c27('0x1d')](_0x4289ed['include'],function(_0x10bec4){return{'model':db[_0x10bec4[_0x8c27('0x1f')]],'as':_0x10bec4['as'],'attributes':_0x10bec4['attributes'],'include':_0x10bec4[_0x8c27('0x1e')]?_['map'](_0x10bec4[_0x8c27('0x1e')],function(_0x365894){return{'model':db[_0x365894[_0x8c27('0x1f')]],'as':_0x365894['as'],'attributes':_0x365894[_0x8c27('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x527543){logger[_0x8c27('0x13')]('GetDeskAccount',_0x4f4b03);logger['debug'](_0x8c27('0x16'),_0x4f4b03,JSON[_0x8c27('0xe')](_0x527543));_0x3c397e(_0x527543);})[_0x8c27('0x15')](function(_0x255ca6){logger[_0x8c27('0xf')]('GetDeskAccount',_0x255ca6[_0x8c27('0x12')],_0x4f4b03);_0x115bd8(_0x52072a[_0x8c27('0xf')](0x1f4,_0x255ca6[_0x8c27('0x12')]));});});};exports[_0x8c27('0x21')]=function(_0x4eacd4){var _0x23f5d6=this;return new Promise(function(_0x41ae07,_0x369971){return db[_0x8c27('0x17')][_0x8c27('0x22')]({'raw':_0x4eacd4[_0x8c27('0x19')]?_0x4eacd4[_0x8c27('0x19')][_0x8c27('0x1a')]===undefined?!![]:![]:!![],'where':_0x4eacd4['options']?_0x4eacd4[_0x8c27('0x19')][_0x8c27('0x1b')]||null:null,'attributes':_0x4eacd4[_0x8c27('0x19')]?_0x4eacd4[_0x8c27('0x19')][_0x8c27('0x20')]||null:null,'include':_0x4eacd4['options']?_0x4eacd4[_0x8c27('0x19')][_0x8c27('0x1e')]?_[_0x8c27('0x1d')](_0x4eacd4[_0x8c27('0x19')]['include'],function(_0x18ef70){return{'model':db[_0x18ef70[_0x8c27('0x1f')]],'as':_0x18ef70['as'],'attributes':_0x18ef70['attributes'],'include':_0x18ef70['include']?_[_0x8c27('0x1d')](_0x18ef70[_0x8c27('0x1e')],function(_0x260c57){return{'model':db[_0x260c57['model']],'as':_0x260c57['as'],'attributes':_0x260c57[_0x8c27('0x20')],'include':_0x260c57[_0x8c27('0x1e')]?_[_0x8c27('0x1d')](_0x260c57[_0x8c27('0x1e')],function(_0x251543){return{'model':db[_0x251543[_0x8c27('0x1f')]],'as':_0x251543['as'],'attributes':_0x251543[_0x8c27('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8c27('0xa')](function(_0x3ae230){logger['info'](_0x8c27('0x21'),_0x4eacd4);logger[_0x8c27('0xc')](_0x8c27('0x21'),_0x4eacd4,JSON[_0x8c27('0xe')](_0x3ae230));_0x41ae07(_0x3ae230);})[_0x8c27('0x15')](function(_0x438d1d){logger[_0x8c27('0xf')](_0x8c27('0x21'),_0x438d1d[_0x8c27('0x12')],_0x4eacd4);_0x369971(_0x23f5d6[_0x8c27('0xf')](0x1f4,_0x438d1d[_0x8c27('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 97d8f10..1cebdd4 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2d588f,_0x1d3d08){var _0x41ebda=function(_0x5214fc){while(--_0x5214fc){_0x2d588f['push'](_0x2d588f['shift']());}};_0x41ebda(++_0x1d3d08);}(_0x008c,0x188));var _0xc008=function(_0x5a9d2b,_0x64b8b8){_0x5a9d2b=_0x5a9d2b-0x0;var _0x55a4a5=_0x008c[_0x5a9d2b];return _0x55a4a5;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _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(_0x57e6e8,_0x34129e){var _0x319c28=function(_0x3d9e5e){while(--_0x3d9e5e){_0x57e6e8['push'](_0x57e6e8['shift']());}};_0x319c28(++_0x34129e);}(_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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index eb7a30a..8bec4f0 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 _0xe001=['exports','STRING','sequelize'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xe001,0x92));var _0x1e00=function(_0x6dd9df,_0x30408f){_0x6dd9df=_0x6dd9df-0x0;var _0x4876f8=_0xe001[_0x6dd9df];return _0x4876f8;};'use strict';var Sequelize=require(_0x1e00('0x0'));module[_0x1e00('0x1')]={'name':{'type':Sequelize[_0x1e00('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf2f=['STRING','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcf2f,0xb9));var _0xfcf2=function(_0xbee3e5,_0x45a93c){_0xbee3e5=_0xbee3e5-0x0;var _0xb275cd=_0xcf2f[_0xbee3e5];return _0xb275cd;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module['exports']={'name':{'type':Sequelize[_0xfcf2('0x1')]},'description':{'type':Sequelize[_0xfcf2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 83d0a09..00fe62e 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 _0x739b=['catch','show','params','include','options','find','create','body','update','getFields','findOne','rawAttributes','sort','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','findAll'];(function(_0x70c92d,_0x985af4){var _0x1919d4=function(_0x246bea){while(--_0x246bea){_0x70c92d['push'](_0x70c92d['shift']());}};_0x1919d4(++_0x985af4);}(_0x739b,0x112));var _0xb739=function(_0x362c77,_0x569855){_0x362c77=_0x362c77-0x0;var _0x5a043b=_0x739b[_0x362c77];return _0x5a043b;};'use strict';var emlformat=require(_0xb739('0x0'));var rimraf=require(_0xb739('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb739('0x2'));var moment=require(_0xb739('0x3'));var BPromise=require(_0xb739('0x4'));var Mustache=require(_0xb739('0x5'));var util=require(_0xb739('0x6'));var path=require(_0xb739('0x7'));var sox=require(_0xb739('0x8'));var csv=require(_0xb739('0x9'));var ejs=require(_0xb739('0xa'));var fs=require('fs');var fs_extra=require(_0xb739('0xb'));var _=require(_0xb739('0xc'));var squel=require(_0xb739('0xd'));var crypto=require(_0xb739('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb739('0xf'));var toCsv=require(_0xb739('0x9'));var querystring=require('querystring');var Papa=require(_0xb739('0x10'));var Redis=require(_0xb739('0x11'));var authService=require(_0xb739('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb739('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb739('0x14'));var utils=require(_0xb739('0x15'));var config=require(_0xb739('0x16'));var licenseUtil=require(_0xb739('0x17'));var db=require(_0xb739('0x18'))['db'];function respondWithStatusCode(_0x174dfb,_0x58a037){_0x58a037=_0x58a037||0xcc;return function(_0x5fc145){if(_0x5fc145){return _0x174dfb[_0xb739('0x19')](_0x58a037);}return _0x174dfb[_0xb739('0x1a')](_0x58a037)['end']();};}function respondWithResult(_0x1a5193,_0x587bf9){_0x587bf9=_0x587bf9||0xc8;return function(_0x240eb0){if(_0x240eb0){return _0x1a5193['status'](_0x587bf9)['json'](_0x240eb0);}};}function respondWithFilteredResult(_0x3f9ae7,_0x2e2fe1){return function(_0x9563f0){if(_0x9563f0){var _0x28743c=typeof _0x2e2fe1['offset']===_0xb739('0x1b')&&typeof _0x2e2fe1[_0xb739('0x1c')]==='undefined';var _0x3d256d=_0x9563f0[_0xb739('0x1d')];var _0x900ef5=_0x28743c?0x0:_0x2e2fe1[_0xb739('0x1e')];var _0x5c11ff=_0x28743c?_0x9563f0[_0xb739('0x1d')]:_0x2e2fe1[_0xb739('0x1e')]+_0x2e2fe1[_0xb739('0x1c')];var _0xfcb25;if(_0x5c11ff>=_0x3d256d){_0x5c11ff=_0x3d256d;_0xfcb25=0xc8;}else{_0xfcb25=0xce;}_0x3f9ae7['status'](_0xfcb25);return _0x3f9ae7[_0xb739('0x1f')](_0xb739('0x20'),_0x900ef5+'-'+_0x5c11ff+'/'+_0x3d256d)[_0xb739('0x21')](_0x9563f0);}return null;};}function patchUpdates(_0x548544){return function(_0x3999b5){try{jsonpatch['apply'](_0x3999b5,_0x548544,!![]);}catch(_0x251377){return BPromise[_0xb739('0x22')](_0x251377);}return _0x3999b5[_0xb739('0x23')]();};}function saveUpdates(_0x42fd80,_0x3f30d6){return function(_0x663436){if(_0x663436){return _0x663436['update'](_0x42fd80)[_0xb739('0x24')](function(_0x5a1e83){return _0x5a1e83;});}return null;};}function removeEntity(_0xdac88e,_0x28179e){return function(_0x25bf74){if(_0x25bf74){return _0x25bf74[_0xb739('0x25')]()[_0xb739('0x24')](function(){_0xdac88e[_0xb739('0x1a')](0xcc)[_0xb739('0x26')]();});}};}function handleEntityNotFound(_0x265236,_0x96695e){return function(_0x2bcd05){if(!_0x2bcd05){_0x265236[_0xb739('0x19')](0x194);}return _0x2bcd05;};}function handleError(_0x475a16,_0x27384d){_0x27384d=_0x27384d||0x1f4;return function(_0x1863ba){logger[_0xb739('0x27')](_0x1863ba[_0xb739('0x28')]);if(_0x1863ba[_0xb739('0x29')]){delete _0x1863ba[_0xb739('0x29')];}_0x475a16['status'](_0x27384d)[_0xb739('0x2a')](_0x1863ba);};}exports['index']=function(_0x84a22d,_0x443192){var _0x49bd6f={},_0x3747c2={},_0x1e8790={'count':0x0,'rows':[]};var _0x4be737=_[_0xb739('0x2b')](db[_0xb739('0x2c')]['rawAttributes'],function(_0x575743){return{'name':_0x575743[_0xb739('0x2d')],'type':_0x575743[_0xb739('0x2e')][_0xb739('0x2f')]};});_0x3747c2[_0xb739('0x30')]=_[_0xb739('0x2b')](_0x4be737,_0xb739('0x29'));_0x3747c2[_0xb739('0x31')]=_[_0xb739('0x32')](_0x84a22d[_0xb739('0x31')]);_0x3747c2[_0xb739('0x33')]=_[_0xb739('0x34')](_0x3747c2[_0xb739('0x30')],_0x3747c2['query']);_0x49bd6f[_0xb739('0x35')]=_['intersection'](_0x3747c2[_0xb739('0x30')],qs[_0xb739('0x36')](_0x84a22d[_0xb739('0x31')][_0xb739('0x36')]));_0x49bd6f[_0xb739('0x35')]=_0x49bd6f[_0xb739('0x35')][_0xb739('0x37')]?_0x49bd6f['attributes']:_0x3747c2['model'];if(!_0x84a22d['query'][_0xb739('0x38')](_0xb739('0x39'))){_0x49bd6f[_0xb739('0x1c')]=qs[_0xb739('0x1c')](_0x84a22d[_0xb739('0x31')][_0xb739('0x1c')]);_0x49bd6f[_0xb739('0x1e')]=qs[_0xb739('0x1e')](_0x84a22d[_0xb739('0x31')][_0xb739('0x1e')]);}_0x49bd6f[_0xb739('0x3a')]=qs['sort'](_0x84a22d[_0xb739('0x31')]['sort']);_0x49bd6f[_0xb739('0x3b')]=qs[_0xb739('0x33')](_[_0xb739('0x3c')](_0x84a22d['query'],_0x3747c2[_0xb739('0x33')]),_0x4be737);if(_0x84a22d[_0xb739('0x31')]['filter']){_0x49bd6f[_0xb739('0x3b')]=_[_0xb739('0x3d')](_0x49bd6f[_0xb739('0x3b')],{'$or':_[_0xb739('0x2b')](_0x4be737,function(_0x79e28f){if(_0x79e28f[_0xb739('0x2e')]!==_0xb739('0x3e')){var _0x5658f5={};_0x5658f5[_0x79e28f[_0xb739('0x29')]]={'$like':'%'+_0x84a22d['query'][_0xb739('0x3f')]+'%'};return _0x5658f5;}})});}_0x49bd6f=_[_0xb739('0x3d')]({},_0x49bd6f,_0x84a22d['options']);var _0x285893={'where':_0x49bd6f[_0xb739('0x3b')]};return db[_0xb739('0x2c')]['count'](_0x285893)[_0xb739('0x24')](function(_0x14c5f6){_0x1e8790['count']=_0x14c5f6;if(_0x84a22d[_0xb739('0x31')][_0xb739('0x40')]){_0x49bd6f['include']=[{'all':!![]}];}return db[_0xb739('0x2c')][_0xb739('0x41')](_0x49bd6f);})[_0xb739('0x24')](function(_0x489eda){_0x1e8790['rows']=_0x489eda;return _0x1e8790;})[_0xb739('0x24')](respondWithFilteredResult(_0x443192,_0x49bd6f))[_0xb739('0x42')](handleError(_0x443192,null));};exports[_0xb739('0x43')]=function(_0x382520,_0x4c1119){var _0x4bd0d={'raw':![],'where':{'id':_0x382520[_0xb739('0x44')]['id']}},_0x526eec={};_0x526eec['model']=_[_0xb739('0x32')](db[_0xb739('0x2c')]['rawAttributes']);_0x526eec['query']=_['keys'](_0x382520['query']);_0x526eec[_0xb739('0x33')]=_[_0xb739('0x34')](_0x526eec[_0xb739('0x30')],_0x526eec[_0xb739('0x31')]);_0x4bd0d[_0xb739('0x35')]=_['intersection'](_0x526eec[_0xb739('0x30')],qs[_0xb739('0x36')](_0x382520[_0xb739('0x31')]['fields']));_0x4bd0d['attributes']=_0x4bd0d[_0xb739('0x35')][_0xb739('0x37')]?_0x4bd0d[_0xb739('0x35')]:_0x526eec[_0xb739('0x30')];if(_0x382520[_0xb739('0x31')][_0xb739('0x40')]){_0x4bd0d[_0xb739('0x45')]=[{'all':!![]}];}_0x4bd0d=_['merge']({},_0x4bd0d,_0x382520[_0xb739('0x46')]);return db[_0xb739('0x2c')][_0xb739('0x47')](_0x4bd0d)[_0xb739('0x24')](handleEntityNotFound(_0x4c1119,null))[_0xb739('0x24')](respondWithResult(_0x4c1119,null))[_0xb739('0x42')](handleError(_0x4c1119,null));};exports[_0xb739('0x48')]=function(_0x7c18c9,_0xff1933){return db[_0xb739('0x2c')][_0xb739('0x48')](_0x7c18c9[_0xb739('0x49')],{})[_0xb739('0x24')](respondWithResult(_0xff1933,0xc9))[_0xb739('0x42')](handleError(_0xff1933,null));};exports[_0xb739('0x4a')]=function(_0x143701,_0x507d34){if(_0x143701[_0xb739('0x49')]['id']){delete _0x143701[_0xb739('0x49')]['id'];}return db[_0xb739('0x2c')]['find']({'where':{'id':_0x143701[_0xb739('0x44')]['id']}})[_0xb739('0x24')](handleEntityNotFound(_0x507d34,null))[_0xb739('0x24')](saveUpdates(_0x143701[_0xb739('0x49')],null))[_0xb739('0x24')](respondWithResult(_0x507d34,null))[_0xb739('0x42')](handleError(_0x507d34,null));};exports[_0xb739('0x25')]=function(_0x56bf89,_0x592806){return db['DeskConfiguration']['find']({'where':{'id':_0x56bf89['params']['id']}})[_0xb739('0x24')](handleEntityNotFound(_0x592806,null))['then'](removeEntity(_0x592806,null))[_0xb739('0x42')](handleError(_0x592806,null));};exports[_0xb739('0x4b')]=function(_0xf45123,_0x12abff,_0x3a43ea){var _0x3a66f8={};var _0x210d4a={};var _0x4b9bec;var _0xfd9270;return db[_0xb739('0x2c')][_0xb739('0x4c')]({'where':{'id':_0xf45123[_0xb739('0x44')]['id']}})[_0xb739('0x24')](handleEntityNotFound(_0x12abff,null))[_0xb739('0x24')](function(_0x2e1e3d){if(_0x2e1e3d){_0x4b9bec=_0x2e1e3d;_0x210d4a[_0xb739('0x30')]=_[_0xb739('0x32')](db['DeskField'][_0xb739('0x4d')]);_0x210d4a[_0xb739('0x31')]=_[_0xb739('0x32')](_0xf45123[_0xb739('0x31')]);_0x210d4a[_0xb739('0x33')]=_[_0xb739('0x34')](_0x210d4a[_0xb739('0x30')],_0x210d4a[_0xb739('0x31')]);_0x3a66f8[_0xb739('0x35')]=_[_0xb739('0x34')](_0x210d4a['model'],qs[_0xb739('0x36')](_0xf45123['query'][_0xb739('0x36')]));_0x3a66f8[_0xb739('0x35')]=_0x3a66f8[_0xb739('0x35')]['length']?_0x3a66f8[_0xb739('0x35')]:_0x210d4a[_0xb739('0x30')];_0x3a66f8[_0xb739('0x3a')]=qs[_0xb739('0x4e')](_0xf45123[_0xb739('0x31')][_0xb739('0x4e')]);_0x3a66f8[_0xb739('0x3b')]=qs['filters'](_[_0xb739('0x3c')](_0xf45123[_0xb739('0x31')],_0x210d4a[_0xb739('0x33')]));if(_0xf45123[_0xb739('0x31')][_0xb739('0x3f')]){_0x3a66f8[_0xb739('0x3b')]=_[_0xb739('0x3d')](_0x3a66f8[_0xb739('0x3b')],{'$or':_[_0xb739('0x2b')](_0x3a66f8[_0xb739('0x35')],function(_0x3d413d){var _0xb33d3c={};_0xb33d3c[_0x3d413d]={'$like':'%'+_0xf45123['query'][_0xb739('0x3f')]+'%'};return _0xb33d3c;})});}_0x3a66f8=_[_0xb739('0x3d')]({},_0x3a66f8,_0xf45123[_0xb739('0x46')]);return _0x4b9bec['getFields'](_0x3a66f8);}})['then'](function(_0x4c4526){if(_0x4c4526){_0xfd9270=_0x4c4526[_0xb739('0x37')];if(!_0xf45123[_0xb739('0x31')]['hasOwnProperty'](_0xb739('0x39'))){_0x3a66f8[_0xb739('0x1c')]=qs['limit'](_0xf45123['query'][_0xb739('0x1c')]);_0x3a66f8[_0xb739('0x1e')]=qs['offset'](_0xf45123['query'][_0xb739('0x1e')]);}return _0x4b9bec[_0xb739('0x4b')](_0x3a66f8);}})['then'](function(_0x1e95e4){if(_0x1e95e4){return _0x1e95e4?{'count':_0xfd9270,'rows':_0x1e95e4}:null;}})['then'](respondWithResult(_0x12abff,null))[_0xb739('0x42')](handleError(_0x12abff,null));};exports[_0xb739('0x4f')]=function(_0x2865b0,_0x43e81c,_0x60ae78){var _0x485c92={};var _0x6d7f80={};var _0xc86013;var _0x54d7ed;return db[_0xb739('0x2c')][_0xb739('0x4c')]({'where':{'id':_0x2865b0['params']['id']}})['then'](handleEntityNotFound(_0x43e81c,null))[_0xb739('0x24')](function(_0x698acd){if(_0x698acd){_0xc86013=_0x698acd;_0x6d7f80[_0xb739('0x30')]=_[_0xb739('0x32')](db[_0xb739('0x50')][_0xb739('0x4d')]);_0x6d7f80['query']=_[_0xb739('0x32')](_0x2865b0['query']);_0x6d7f80[_0xb739('0x33')]=_[_0xb739('0x34')](_0x6d7f80[_0xb739('0x30')],_0x6d7f80[_0xb739('0x31')]);_0x485c92[_0xb739('0x35')]=_[_0xb739('0x34')](_0x6d7f80[_0xb739('0x30')],qs[_0xb739('0x36')](_0x2865b0['query']['fields']));_0x485c92[_0xb739('0x35')]=_0x485c92[_0xb739('0x35')]['length']?_0x485c92[_0xb739('0x35')]:_0x6d7f80[_0xb739('0x30')];_0x485c92['order']=qs['sort'](_0x2865b0[_0xb739('0x31')][_0xb739('0x4e')]);_0x485c92[_0xb739('0x3b')]=qs[_0xb739('0x33')](_[_0xb739('0x3c')](_0x2865b0[_0xb739('0x31')],_0x6d7f80['filters']));if(_0x2865b0[_0xb739('0x31')][_0xb739('0x3f')]){_0x485c92[_0xb739('0x3b')]=_[_0xb739('0x3d')](_0x485c92['where'],{'$or':_[_0xb739('0x2b')](_0x485c92['attributes'],function(_0x30f343){var _0xf06914={};_0xf06914[_0x30f343]={'$like':'%'+_0x2865b0[_0xb739('0x31')][_0xb739('0x3f')]+'%'};return _0xf06914;})});}_0x485c92=_[_0xb739('0x3d')]({},_0x485c92,_0x2865b0['options']);return _0xc86013['getSubjects'](_0x485c92);}})[_0xb739('0x24')](function(_0xc77587){if(_0xc77587){_0x54d7ed=_0xc77587['length'];if(!_0x2865b0[_0xb739('0x31')][_0xb739('0x38')]('nolimit')){_0x485c92[_0xb739('0x1c')]=qs[_0xb739('0x1c')](_0x2865b0['query'][_0xb739('0x1c')]);_0x485c92[_0xb739('0x1e')]=qs['offset'](_0x2865b0[_0xb739('0x31')][_0xb739('0x1e')]);}return _0xc86013[_0xb739('0x4f')](_0x485c92);}})[_0xb739('0x24')](function(_0x204494){if(_0x204494){return _0x204494?{'count':_0x54d7ed,'rows':_0x204494}:null;}})[_0xb739('0x24')](respondWithResult(_0x43e81c,null))[_0xb739('0x42')](handleError(_0x43e81c,null));};exports[_0xb739('0x51')]=function(_0x3c2583,_0x31138b,_0x1a3bd9){var _0x3429f2={};var _0x5a2e29={};var _0x1671a5;var _0x18d23d;return db[_0xb739('0x2c')][_0xb739('0x4c')]({'where':{'id':_0x3c2583['params']['id']}})[_0xb739('0x24')](handleEntityNotFound(_0x31138b,null))['then'](function(_0x265cae){if(_0x265cae){_0x1671a5=_0x265cae;_0x5a2e29[_0xb739('0x30')]=_[_0xb739('0x32')](db[_0xb739('0x50')]['rawAttributes']);_0x5a2e29['query']=_[_0xb739('0x32')](_0x3c2583['query']);_0x5a2e29[_0xb739('0x33')]=_[_0xb739('0x34')](_0x5a2e29[_0xb739('0x30')],_0x5a2e29[_0xb739('0x31')]);_0x3429f2[_0xb739('0x35')]=_[_0xb739('0x34')](_0x5a2e29[_0xb739('0x30')],qs[_0xb739('0x36')](_0x3c2583[_0xb739('0x31')][_0xb739('0x36')]));_0x3429f2[_0xb739('0x35')]=_0x3429f2[_0xb739('0x35')][_0xb739('0x37')]?_0x3429f2[_0xb739('0x35')]:_0x5a2e29[_0xb739('0x30')];_0x3429f2[_0xb739('0x3a')]=qs[_0xb739('0x4e')](_0x3c2583['query'][_0xb739('0x4e')]);_0x3429f2[_0xb739('0x3b')]=qs[_0xb739('0x33')](_[_0xb739('0x3c')](_0x3c2583[_0xb739('0x31')],_0x5a2e29[_0xb739('0x33')]));if(_0x3c2583[_0xb739('0x31')][_0xb739('0x3f')]){_0x3429f2[_0xb739('0x3b')]=_['merge'](_0x3429f2[_0xb739('0x3b')],{'$or':_[_0xb739('0x2b')](_0x3429f2[_0xb739('0x35')],function(_0x3aeddd){var _0x4a8d09={};_0x4a8d09[_0x3aeddd]={'$like':'%'+_0x3c2583[_0xb739('0x31')][_0xb739('0x3f')]+'%'};return _0x4a8d09;})});}_0x3429f2=_[_0xb739('0x3d')]({},_0x3429f2,_0x3c2583[_0xb739('0x46')]);return _0x1671a5[_0xb739('0x51')](_0x3429f2);}})[_0xb739('0x24')](function(_0x1e58f7){if(_0x1e58f7){_0x18d23d=_0x1e58f7[_0xb739('0x37')];if(!_0x3c2583['query']['hasOwnProperty'](_0xb739('0x39'))){_0x3429f2['limit']=qs[_0xb739('0x1c')](_0x3c2583['query'][_0xb739('0x1c')]);_0x3429f2[_0xb739('0x1e')]=qs[_0xb739('0x1e')](_0x3c2583['query']['offset']);}return _0x1671a5[_0xb739('0x51')](_0x3429f2);}})[_0xb739('0x24')](function(_0x289b6c){if(_0x289b6c){return _0x289b6c?{'count':_0x18d23d,'rows':_0x289b6c}:null;}})['then'](respondWithResult(_0x31138b,null))[_0xb739('0x42')](handleError(_0x31138b,null));};exports[_0xb739('0x52')]=function(_0x59f5ff,_0x5776b5,_0x369177){var _0x4b8f6b={};var _0x58a31b={};var _0xf7fec5;var _0x1a5205;return db['DeskConfiguration'][_0xb739('0x4c')]({'where':{'id':_0x59f5ff[_0xb739('0x44')]['id']}})[_0xb739('0x24')](handleEntityNotFound(_0x5776b5,null))['then'](function(_0x566039){if(_0x566039){_0xf7fec5=_0x566039;_0x58a31b['model']=_[_0xb739('0x32')](db['Tag'][_0xb739('0x4d')]);_0x58a31b[_0xb739('0x31')]=_[_0xb739('0x32')](_0x59f5ff['query']);_0x58a31b[_0xb739('0x33')]=_[_0xb739('0x34')](_0x58a31b[_0xb739('0x30')],_0x58a31b['query']);_0x4b8f6b['attributes']=_[_0xb739('0x34')](_0x58a31b[_0xb739('0x30')],qs[_0xb739('0x36')](_0x59f5ff[_0xb739('0x31')][_0xb739('0x36')]));_0x4b8f6b[_0xb739('0x35')]=_0x4b8f6b[_0xb739('0x35')][_0xb739('0x37')]?_0x4b8f6b['attributes']:_0x58a31b[_0xb739('0x30')];_0x4b8f6b['order']=qs[_0xb739('0x4e')](_0x59f5ff[_0xb739('0x31')]['sort']);_0x4b8f6b[_0xb739('0x3b')]=qs[_0xb739('0x33')](_['pick'](_0x59f5ff[_0xb739('0x31')],_0x58a31b[_0xb739('0x33')]));if(_0x59f5ff[_0xb739('0x31')][_0xb739('0x3f')]){_0x4b8f6b[_0xb739('0x3b')]=_[_0xb739('0x3d')](_0x4b8f6b[_0xb739('0x3b')],{'$or':_[_0xb739('0x2b')](_0x4b8f6b[_0xb739('0x35')],function(_0x2e7b4a){var _0x1952a0={};_0x1952a0[_0x2e7b4a]={'$like':'%'+_0x59f5ff[_0xb739('0x31')]['filter']+'%'};return _0x1952a0;})});}_0x4b8f6b=_[_0xb739('0x3d')]({},_0x4b8f6b,_0x59f5ff[_0xb739('0x46')]);return _0xf7fec5[_0xb739('0x52')](_0x4b8f6b);}})[_0xb739('0x24')](function(_0x47f846){if(_0x47f846){_0x1a5205=_0x47f846[_0xb739('0x37')];if(!_0x59f5ff[_0xb739('0x31')]['hasOwnProperty'](_0xb739('0x39'))){_0x4b8f6b[_0xb739('0x1c')]=qs[_0xb739('0x1c')](_0x59f5ff[_0xb739('0x31')][_0xb739('0x1c')]);_0x4b8f6b[_0xb739('0x1e')]=qs[_0xb739('0x1e')](_0x59f5ff['query'][_0xb739('0x1e')]);}return _0xf7fec5['getTags'](_0x4b8f6b);}})['then'](function(_0x2554f0){if(_0x2554f0){return _0x2554f0?{'count':_0x1a5205,'rows':_0x2554f0}:null;}})[_0xb739('0x24')](respondWithResult(_0x5776b5,null))[_0xb739('0x42')](handleError(_0x5776b5,null));};exports['setTags']=function(_0x4ede12,_0x3de3aa,_0x13b5bf){if(_0x4ede12[_0xb739('0x49')]['id']){delete _0x4ede12[_0xb739('0x49')]['id'];}return db[_0xb739('0x2c')][_0xb739('0x4c')]({'where':{'id':_0x4ede12['params']['id']}})[_0xb739('0x24')](handleEntityNotFound(_0x3de3aa,null))['then'](function(_0xf46901){if(_0xf46901){return _0xf46901[_0xb739('0x53')](_0x4ede12[_0xb739('0x49')][_0xb739('0x54')]||[]);}return null;})[_0xb739('0x24')](respondWithResult(_0x3de3aa,null))[_0xb739('0x42')](handleError(_0x3de3aa,null));}; \ No newline at end of file +var _0xd2cd=['include','findAll','rows','catch','keys','includeAll','find','create','body','params','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','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','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','destroy','then','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xd2cd,0x1ae));var _0xdd2c=function(_0x50392a,_0x2d4ed9){_0x50392a=_0x50392a-0x0;var _0x417b0a=_0xd2cd[_0x50392a];return _0x417b0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd2c('0x1'));var rp=require(_0xdd2c('0x2'));var moment=require('moment');var BPromise=require(_0xdd2c('0x3'));var Mustache=require(_0xdd2c('0x4'));var util=require(_0xdd2c('0x5'));var path=require(_0xdd2c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd2c('0x7'));var _=require(_0xdd2c('0x8'));var squel=require(_0xdd2c('0x9'));var crypto=require('crypto');var jsforce=require(_0xdd2c('0xa'));var deskjs=require(_0xdd2c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdd2c('0xc'));var Papa=require(_0xdd2c('0xd'));var Redis=require(_0xdd2c('0xe'));var authService=require(_0xdd2c('0xf'));var qs=require(_0xdd2c('0x10'));var as=require(_0xdd2c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd2c('0x12'))(_0xdd2c('0x13'));var utils=require(_0xdd2c('0x14'));var config=require(_0xdd2c('0x15'));var licenseUtil=require(_0xdd2c('0x16'));var db=require(_0xdd2c('0x17'))['db'];function respondWithStatusCode(_0x386912,_0x59f1a9){_0x59f1a9=_0x59f1a9||0xcc;return function(_0x1d074f){if(_0x1d074f){return _0x386912[_0xdd2c('0x18')](_0x59f1a9);}return _0x386912[_0xdd2c('0x19')](_0x59f1a9)[_0xdd2c('0x1a')]();};}function respondWithResult(_0x1766c3,_0x243135){_0x243135=_0x243135||0xc8;return function(_0x510070){if(_0x510070){return _0x1766c3[_0xdd2c('0x19')](_0x243135)[_0xdd2c('0x1b')](_0x510070);}};}function respondWithFilteredResult(_0x36f024,_0xd92896){return function(_0x48c2e){if(_0x48c2e){var _0x5f2cd7=typeof _0xd92896[_0xdd2c('0x1c')]===_0xdd2c('0x1d')&&typeof _0xd92896['limit']==='undefined';var _0x4c6eea=_0x48c2e['count'];var _0x8f00c6=_0x5f2cd7?0x0:_0xd92896['offset'];var _0x31a1af=_0x5f2cd7?_0x48c2e['count']:_0xd92896['offset']+_0xd92896[_0xdd2c('0x1e')];var _0x1709a5;if(_0x31a1af>=_0x4c6eea){_0x31a1af=_0x4c6eea;_0x1709a5=0xc8;}else{_0x1709a5=0xce;}_0x36f024['status'](_0x1709a5);return _0x36f024[_0xdd2c('0x1f')]('Content-Range',_0x8f00c6+'-'+_0x31a1af+'/'+_0x4c6eea)[_0xdd2c('0x1b')](_0x48c2e);}return null;};}function patchUpdates(_0x56ad62){return function(_0xfbd208){try{jsonpatch[_0xdd2c('0x20')](_0xfbd208,_0x56ad62,!![]);}catch(_0x4b4bae){return BPromise['reject'](_0x4b4bae);}return _0xfbd208[_0xdd2c('0x21')]();};}function saveUpdates(_0x17fbf8,_0x19e963){return function(_0x195f77){if(_0x195f77){return _0x195f77[_0xdd2c('0x22')](_0x17fbf8)['then'](function(_0x1bd57f){return _0x1bd57f;});}return null;};}function removeEntity(_0x5bdc9f,_0x3fc24b){return function(_0x4619a4){if(_0x4619a4){return _0x4619a4[_0xdd2c('0x23')]()[_0xdd2c('0x24')](function(){_0x5bdc9f[_0xdd2c('0x19')](0xcc)[_0xdd2c('0x1a')]();});}};}function handleEntityNotFound(_0x1bb1ca,_0x17e8bf){return function(_0x125d23){if(!_0x125d23){_0x1bb1ca[_0xdd2c('0x18')](0x194);}return _0x125d23;};}function handleError(_0xe6f817,_0x2c1733){_0x2c1733=_0x2c1733||0x1f4;return function(_0x197688){logger['error'](_0x197688[_0xdd2c('0x25')]);if(_0x197688[_0xdd2c('0x26')]){delete _0x197688[_0xdd2c('0x26')];}_0xe6f817[_0xdd2c('0x19')](_0x2c1733)['send'](_0x197688);};}exports[_0xdd2c('0x27')]=function(_0x364e3f,_0x301a82){var _0x114df6={},_0x44d908={},_0x18205d={'count':0x0,'rows':[]};var _0x4ff784=_[_0xdd2c('0x28')](db[_0xdd2c('0x29')][_0xdd2c('0x2a')],function(_0x308b9d){return{'name':_0x308b9d[_0xdd2c('0x2b')],'type':_0x308b9d[_0xdd2c('0x2c')]['key']};});_0x44d908[_0xdd2c('0x2d')]=_[_0xdd2c('0x28')](_0x4ff784,_0xdd2c('0x26'));_0x44d908[_0xdd2c('0x2e')]=_['keys'](_0x364e3f[_0xdd2c('0x2e')]);_0x44d908[_0xdd2c('0x2f')]=_['intersection'](_0x44d908[_0xdd2c('0x2d')],_0x44d908['query']);_0x114df6[_0xdd2c('0x30')]=_[_0xdd2c('0x31')](_0x44d908['model'],qs[_0xdd2c('0x32')](_0x364e3f['query']['fields']));_0x114df6[_0xdd2c('0x30')]=_0x114df6[_0xdd2c('0x30')][_0xdd2c('0x33')]?_0x114df6[_0xdd2c('0x30')]:_0x44d908[_0xdd2c('0x2d')];if(!_0x364e3f[_0xdd2c('0x2e')][_0xdd2c('0x34')](_0xdd2c('0x35'))){_0x114df6['limit']=qs[_0xdd2c('0x1e')](_0x364e3f[_0xdd2c('0x2e')]['limit']);_0x114df6['offset']=qs['offset'](_0x364e3f['query'][_0xdd2c('0x1c')]);}_0x114df6[_0xdd2c('0x36')]=qs[_0xdd2c('0x37')](_0x364e3f[_0xdd2c('0x2e')][_0xdd2c('0x37')]);_0x114df6['where']=qs[_0xdd2c('0x2f')](_['pick'](_0x364e3f[_0xdd2c('0x2e')],_0x44d908[_0xdd2c('0x2f')]),_0x4ff784);if(_0x364e3f[_0xdd2c('0x2e')][_0xdd2c('0x38')]){_0x114df6[_0xdd2c('0x39')]=_[_0xdd2c('0x3a')](_0x114df6['where'],{'$or':_['map'](_0x4ff784,function(_0x47bf2c){if(_0x47bf2c[_0xdd2c('0x2c')]!==_0xdd2c('0x3b')){var _0x2df619={};_0x2df619[_0x47bf2c[_0xdd2c('0x26')]]={'$like':'%'+_0x364e3f[_0xdd2c('0x2e')][_0xdd2c('0x38')]+'%'};return _0x2df619;}})});}_0x114df6=_['merge']({},_0x114df6,_0x364e3f[_0xdd2c('0x3c')]);var _0x1ed2de={'where':_0x114df6[_0xdd2c('0x39')]};return db[_0xdd2c('0x29')][_0xdd2c('0x3d')](_0x1ed2de)[_0xdd2c('0x24')](function(_0x5e10c7){_0x18205d[_0xdd2c('0x3d')]=_0x5e10c7;if(_0x364e3f[_0xdd2c('0x2e')]['includeAll']){_0x114df6[_0xdd2c('0x3e')]=[{'all':!![]}];}return db[_0xdd2c('0x29')][_0xdd2c('0x3f')](_0x114df6);})['then'](function(_0x4d9af2){_0x18205d[_0xdd2c('0x40')]=_0x4d9af2;return _0x18205d;})[_0xdd2c('0x24')](respondWithFilteredResult(_0x301a82,_0x114df6))[_0xdd2c('0x41')](handleError(_0x301a82,null));};exports['show']=function(_0xefc914,_0x58ba8a){var _0x101e55={'raw':![],'where':{'id':_0xefc914['params']['id']}},_0x57356c={};_0x57356c[_0xdd2c('0x2d')]=_[_0xdd2c('0x42')](db['DeskConfiguration'][_0xdd2c('0x2a')]);_0x57356c[_0xdd2c('0x2e')]=_[_0xdd2c('0x42')](_0xefc914[_0xdd2c('0x2e')]);_0x57356c['filters']=_[_0xdd2c('0x31')](_0x57356c[_0xdd2c('0x2d')],_0x57356c[_0xdd2c('0x2e')]);_0x101e55['attributes']=_[_0xdd2c('0x31')](_0x57356c[_0xdd2c('0x2d')],qs[_0xdd2c('0x32')](_0xefc914[_0xdd2c('0x2e')][_0xdd2c('0x32')]));_0x101e55[_0xdd2c('0x30')]=_0x101e55['attributes'][_0xdd2c('0x33')]?_0x101e55[_0xdd2c('0x30')]:_0x57356c[_0xdd2c('0x2d')];if(_0xefc914[_0xdd2c('0x2e')][_0xdd2c('0x43')]){_0x101e55['include']=[{'all':!![]}];}_0x101e55=_[_0xdd2c('0x3a')]({},_0x101e55,_0xefc914[_0xdd2c('0x3c')]);return db[_0xdd2c('0x29')][_0xdd2c('0x44')](_0x101e55)[_0xdd2c('0x24')](handleEntityNotFound(_0x58ba8a,null))['then'](respondWithResult(_0x58ba8a,null))[_0xdd2c('0x41')](handleError(_0x58ba8a,null));};exports[_0xdd2c('0x45')]=function(_0x284134,_0x5a658e){return db[_0xdd2c('0x29')][_0xdd2c('0x45')](_0x284134['body'],{})['then'](respondWithResult(_0x5a658e,0xc9))[_0xdd2c('0x41')](handleError(_0x5a658e,null));};exports['update']=function(_0x1232f3,_0x589e70){if(_0x1232f3[_0xdd2c('0x46')]['id']){delete _0x1232f3[_0xdd2c('0x46')]['id'];}return db[_0xdd2c('0x29')]['find']({'where':{'id':_0x1232f3[_0xdd2c('0x47')]['id']}})[_0xdd2c('0x24')](handleEntityNotFound(_0x589e70,null))[_0xdd2c('0x24')](saveUpdates(_0x1232f3[_0xdd2c('0x46')],null))[_0xdd2c('0x24')](respondWithResult(_0x589e70,null))[_0xdd2c('0x41')](handleError(_0x589e70,null));};exports['destroy']=function(_0x4154b1,_0x38a331){return db[_0xdd2c('0x29')][_0xdd2c('0x44')]({'where':{'id':_0x4154b1[_0xdd2c('0x47')]['id']}})[_0xdd2c('0x24')](handleEntityNotFound(_0x38a331,null))[_0xdd2c('0x24')](removeEntity(_0x38a331,null))[_0xdd2c('0x41')](handleError(_0x38a331,null));};exports[_0xdd2c('0x48')]=function(_0x1f5594,_0x566959,_0x1ee4b1){var _0x38c229={};var _0x1d00e8={};var _0x5bc975;var _0x46b750;return db['DeskConfiguration'][_0xdd2c('0x49')]({'where':{'id':_0x1f5594[_0xdd2c('0x47')]['id']}})[_0xdd2c('0x24')](handleEntityNotFound(_0x566959,null))[_0xdd2c('0x24')](function(_0x3a5690){if(_0x3a5690){_0x5bc975=_0x3a5690;_0x1d00e8[_0xdd2c('0x2d')]=_[_0xdd2c('0x42')](db[_0xdd2c('0x4a')][_0xdd2c('0x2a')]);_0x1d00e8[_0xdd2c('0x2e')]=_[_0xdd2c('0x42')](_0x1f5594[_0xdd2c('0x2e')]);_0x1d00e8[_0xdd2c('0x2f')]=_[_0xdd2c('0x31')](_0x1d00e8['model'],_0x1d00e8[_0xdd2c('0x2e')]);_0x38c229[_0xdd2c('0x30')]=_[_0xdd2c('0x31')](_0x1d00e8['model'],qs[_0xdd2c('0x32')](_0x1f5594[_0xdd2c('0x2e')]['fields']));_0x38c229[_0xdd2c('0x30')]=_0x38c229[_0xdd2c('0x30')][_0xdd2c('0x33')]?_0x38c229[_0xdd2c('0x30')]:_0x1d00e8[_0xdd2c('0x2d')];_0x38c229['order']=qs[_0xdd2c('0x37')](_0x1f5594['query'][_0xdd2c('0x37')]);_0x38c229[_0xdd2c('0x39')]=qs[_0xdd2c('0x2f')](_[_0xdd2c('0x4b')](_0x1f5594['query'],_0x1d00e8[_0xdd2c('0x2f')]));if(_0x1f5594[_0xdd2c('0x2e')][_0xdd2c('0x38')]){_0x38c229[_0xdd2c('0x39')]=_[_0xdd2c('0x3a')](_0x38c229[_0xdd2c('0x39')],{'$or':_[_0xdd2c('0x28')](_0x38c229[_0xdd2c('0x30')],function(_0x4cd922){var _0x4c0e56={};_0x4c0e56[_0x4cd922]={'$like':'%'+_0x1f5594[_0xdd2c('0x2e')][_0xdd2c('0x38')]+'%'};return _0x4c0e56;})});}_0x38c229=_['merge']({},_0x38c229,_0x1f5594[_0xdd2c('0x3c')]);return _0x5bc975['getFields'](_0x38c229);}})[_0xdd2c('0x24')](function(_0x2daa87){if(_0x2daa87){_0x46b750=_0x2daa87[_0xdd2c('0x33')];if(!_0x1f5594[_0xdd2c('0x2e')][_0xdd2c('0x34')](_0xdd2c('0x35'))){_0x38c229[_0xdd2c('0x1e')]=qs[_0xdd2c('0x1e')](_0x1f5594['query'][_0xdd2c('0x1e')]);_0x38c229['offset']=qs[_0xdd2c('0x1c')](_0x1f5594['query']['offset']);}return _0x5bc975['getFields'](_0x38c229);}})[_0xdd2c('0x24')](function(_0x2614cd){if(_0x2614cd){return _0x2614cd?{'count':_0x46b750,'rows':_0x2614cd}:null;}})[_0xdd2c('0x24')](respondWithResult(_0x566959,null))[_0xdd2c('0x41')](handleError(_0x566959,null));};exports['getSubjects']=function(_0x1a6285,_0x54b934,_0x1f41d4){var _0x25b72f={};var _0x1259ad={};var _0x3c9c82;var _0x97d442;return db[_0xdd2c('0x29')][_0xdd2c('0x49')]({'where':{'id':_0x1a6285[_0xdd2c('0x47')]['id']}})[_0xdd2c('0x24')](handleEntityNotFound(_0x54b934,null))[_0xdd2c('0x24')](function(_0x14bb81){if(_0x14bb81){_0x3c9c82=_0x14bb81;_0x1259ad[_0xdd2c('0x2d')]=_[_0xdd2c('0x42')](db[_0xdd2c('0x4a')][_0xdd2c('0x2a')]);_0x1259ad[_0xdd2c('0x2e')]=_[_0xdd2c('0x42')](_0x1a6285['query']);_0x1259ad[_0xdd2c('0x2f')]=_[_0xdd2c('0x31')](_0x1259ad[_0xdd2c('0x2d')],_0x1259ad['query']);_0x25b72f['attributes']=_[_0xdd2c('0x31')](_0x1259ad[_0xdd2c('0x2d')],qs[_0xdd2c('0x32')](_0x1a6285[_0xdd2c('0x2e')][_0xdd2c('0x32')]));_0x25b72f['attributes']=_0x25b72f[_0xdd2c('0x30')][_0xdd2c('0x33')]?_0x25b72f[_0xdd2c('0x30')]:_0x1259ad['model'];_0x25b72f[_0xdd2c('0x36')]=qs[_0xdd2c('0x37')](_0x1a6285[_0xdd2c('0x2e')][_0xdd2c('0x37')]);_0x25b72f[_0xdd2c('0x39')]=qs[_0xdd2c('0x2f')](_[_0xdd2c('0x4b')](_0x1a6285[_0xdd2c('0x2e')],_0x1259ad[_0xdd2c('0x2f')]));if(_0x1a6285[_0xdd2c('0x2e')][_0xdd2c('0x38')]){_0x25b72f[_0xdd2c('0x39')]=_[_0xdd2c('0x3a')](_0x25b72f['where'],{'$or':_[_0xdd2c('0x28')](_0x25b72f[_0xdd2c('0x30')],function(_0x1bef39){var _0x327b7b={};_0x327b7b[_0x1bef39]={'$like':'%'+_0x1a6285[_0xdd2c('0x2e')][_0xdd2c('0x38')]+'%'};return _0x327b7b;})});}_0x25b72f=_[_0xdd2c('0x3a')]({},_0x25b72f,_0x1a6285[_0xdd2c('0x3c')]);return _0x3c9c82[_0xdd2c('0x4c')](_0x25b72f);}})[_0xdd2c('0x24')](function(_0x1569f5){if(_0x1569f5){_0x97d442=_0x1569f5[_0xdd2c('0x33')];if(!_0x1a6285[_0xdd2c('0x2e')][_0xdd2c('0x34')](_0xdd2c('0x35'))){_0x25b72f[_0xdd2c('0x1e')]=qs[_0xdd2c('0x1e')](_0x1a6285['query']['limit']);_0x25b72f[_0xdd2c('0x1c')]=qs['offset'](_0x1a6285[_0xdd2c('0x2e')][_0xdd2c('0x1c')]);}return _0x3c9c82[_0xdd2c('0x4c')](_0x25b72f);}})[_0xdd2c('0x24')](function(_0xe53b5f){if(_0xe53b5f){return _0xe53b5f?{'count':_0x97d442,'rows':_0xe53b5f}:null;}})[_0xdd2c('0x24')](respondWithResult(_0x54b934,null))[_0xdd2c('0x41')](handleError(_0x54b934,null));};exports[_0xdd2c('0x4d')]=function(_0x9ecde1,_0x13afa3,_0x4b1156){var _0xcbd7cb={};var _0x3f4a61={};var _0x307ee7;var _0x47b74d;return db[_0xdd2c('0x29')][_0xdd2c('0x49')]({'where':{'id':_0x9ecde1[_0xdd2c('0x47')]['id']}})[_0xdd2c('0x24')](handleEntityNotFound(_0x13afa3,null))[_0xdd2c('0x24')](function(_0x3a8eec){if(_0x3a8eec){_0x307ee7=_0x3a8eec;_0x3f4a61[_0xdd2c('0x2d')]=_['keys'](db[_0xdd2c('0x4a')][_0xdd2c('0x2a')]);_0x3f4a61['query']=_[_0xdd2c('0x42')](_0x9ecde1[_0xdd2c('0x2e')]);_0x3f4a61[_0xdd2c('0x2f')]=_['intersection'](_0x3f4a61['model'],_0x3f4a61[_0xdd2c('0x2e')]);_0xcbd7cb[_0xdd2c('0x30')]=_[_0xdd2c('0x31')](_0x3f4a61[_0xdd2c('0x2d')],qs[_0xdd2c('0x32')](_0x9ecde1[_0xdd2c('0x2e')][_0xdd2c('0x32')]));_0xcbd7cb[_0xdd2c('0x30')]=_0xcbd7cb[_0xdd2c('0x30')][_0xdd2c('0x33')]?_0xcbd7cb[_0xdd2c('0x30')]:_0x3f4a61[_0xdd2c('0x2d')];_0xcbd7cb['order']=qs[_0xdd2c('0x37')](_0x9ecde1[_0xdd2c('0x2e')][_0xdd2c('0x37')]);_0xcbd7cb[_0xdd2c('0x39')]=qs['filters'](_[_0xdd2c('0x4b')](_0x9ecde1['query'],_0x3f4a61[_0xdd2c('0x2f')]));if(_0x9ecde1[_0xdd2c('0x2e')][_0xdd2c('0x38')]){_0xcbd7cb[_0xdd2c('0x39')]=_[_0xdd2c('0x3a')](_0xcbd7cb[_0xdd2c('0x39')],{'$or':_[_0xdd2c('0x28')](_0xcbd7cb[_0xdd2c('0x30')],function(_0x2df146){var _0xe2e354={};_0xe2e354[_0x2df146]={'$like':'%'+_0x9ecde1[_0xdd2c('0x2e')]['filter']+'%'};return _0xe2e354;})});}_0xcbd7cb=_[_0xdd2c('0x3a')]({},_0xcbd7cb,_0x9ecde1['options']);return _0x307ee7[_0xdd2c('0x4d')](_0xcbd7cb);}})[_0xdd2c('0x24')](function(_0x3dbbc5){if(_0x3dbbc5){_0x47b74d=_0x3dbbc5[_0xdd2c('0x33')];if(!_0x9ecde1[_0xdd2c('0x2e')][_0xdd2c('0x34')](_0xdd2c('0x35'))){_0xcbd7cb['limit']=qs[_0xdd2c('0x1e')](_0x9ecde1[_0xdd2c('0x2e')][_0xdd2c('0x1e')]);_0xcbd7cb[_0xdd2c('0x1c')]=qs[_0xdd2c('0x1c')](_0x9ecde1[_0xdd2c('0x2e')]['offset']);}return _0x307ee7[_0xdd2c('0x4d')](_0xcbd7cb);}})['then'](function(_0x203199){if(_0x203199){return _0x203199?{'count':_0x47b74d,'rows':_0x203199}:null;}})[_0xdd2c('0x24')](respondWithResult(_0x13afa3,null))[_0xdd2c('0x41')](handleError(_0x13afa3,null));};exports[_0xdd2c('0x4e')]=function(_0x45118b,_0x1e7b66,_0x5504a8){var _0x287d32={};var _0x1cd4fd={};var _0x567482;var _0x511df1;return db['DeskConfiguration'][_0xdd2c('0x49')]({'where':{'id':_0x45118b[_0xdd2c('0x47')]['id']}})[_0xdd2c('0x24')](handleEntityNotFound(_0x1e7b66,null))[_0xdd2c('0x24')](function(_0x5d7c85){if(_0x5d7c85){_0x567482=_0x5d7c85;_0x1cd4fd[_0xdd2c('0x2d')]=_[_0xdd2c('0x42')](db[_0xdd2c('0x4f')][_0xdd2c('0x2a')]);_0x1cd4fd[_0xdd2c('0x2e')]=_[_0xdd2c('0x42')](_0x45118b[_0xdd2c('0x2e')]);_0x1cd4fd[_0xdd2c('0x2f')]=_[_0xdd2c('0x31')](_0x1cd4fd[_0xdd2c('0x2d')],_0x1cd4fd[_0xdd2c('0x2e')]);_0x287d32[_0xdd2c('0x30')]=_['intersection'](_0x1cd4fd[_0xdd2c('0x2d')],qs['fields'](_0x45118b[_0xdd2c('0x2e')][_0xdd2c('0x32')]));_0x287d32[_0xdd2c('0x30')]=_0x287d32[_0xdd2c('0x30')][_0xdd2c('0x33')]?_0x287d32[_0xdd2c('0x30')]:_0x1cd4fd['model'];_0x287d32[_0xdd2c('0x36')]=qs[_0xdd2c('0x37')](_0x45118b['query'][_0xdd2c('0x37')]);_0x287d32['where']=qs['filters'](_[_0xdd2c('0x4b')](_0x45118b['query'],_0x1cd4fd['filters']));if(_0x45118b['query'][_0xdd2c('0x38')]){_0x287d32['where']=_[_0xdd2c('0x3a')](_0x287d32['where'],{'$or':_[_0xdd2c('0x28')](_0x287d32['attributes'],function(_0x344e64){var _0x1ddfd0={};_0x1ddfd0[_0x344e64]={'$like':'%'+_0x45118b[_0xdd2c('0x2e')]['filter']+'%'};return _0x1ddfd0;})});}_0x287d32=_[_0xdd2c('0x3a')]({},_0x287d32,_0x45118b[_0xdd2c('0x3c')]);return _0x567482[_0xdd2c('0x4e')](_0x287d32);}})[_0xdd2c('0x24')](function(_0x484110){if(_0x484110){_0x511df1=_0x484110['length'];if(!_0x45118b[_0xdd2c('0x2e')][_0xdd2c('0x34')](_0xdd2c('0x35'))){_0x287d32[_0xdd2c('0x1e')]=qs[_0xdd2c('0x1e')](_0x45118b[_0xdd2c('0x2e')][_0xdd2c('0x1e')]);_0x287d32['offset']=qs[_0xdd2c('0x1c')](_0x45118b[_0xdd2c('0x2e')][_0xdd2c('0x1c')]);}return _0x567482['getTags'](_0x287d32);}})[_0xdd2c('0x24')](function(_0x1901f7){if(_0x1901f7){return _0x1901f7?{'count':_0x511df1,'rows':_0x1901f7}:null;}})[_0xdd2c('0x24')](respondWithResult(_0x1e7b66,null))[_0xdd2c('0x41')](handleError(_0x1e7b66,null));};exports[_0xdd2c('0x50')]=function(_0x56ef47,_0x59e33a,_0x40b836){if(_0x56ef47[_0xdd2c('0x46')]['id']){delete _0x56ef47[_0xdd2c('0x46')]['id'];}return db['DeskConfiguration'][_0xdd2c('0x49')]({'where':{'id':_0x56ef47[_0xdd2c('0x47')]['id']}})[_0xdd2c('0x24')](handleEntityNotFound(_0x59e33a,null))[_0xdd2c('0x24')](function(_0x2922c5){if(_0x2922c5){return _0x2922c5[_0xdd2c('0x50')](_0x56ef47['body'][_0xdd2c('0x51')]||[]);}return null;})[_0xdd2c('0x24')](respondWithResult(_0x59e33a,null))[_0xdd2c('0x41')](handleError(_0x59e33a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 377c4b0..b048db6 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 _0xfb9b=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d9314,_0x335c6c){var _0x99bc44=function(_0x28aa9b){while(--_0x28aa9b){_0x4d9314['push'](_0x4d9314['shift']());}};_0x99bc44(++_0x335c6c);}(_0xfb9b,0x1d9));var _0xbfb9=function(_0x17b1c6,_0x2227e5){_0x17b1c6=_0x17b1c6-0x0;var _0x293981=_0xfb9b[_0x17b1c6];return _0x293981;};'use strict';var _=require(_0xbfb9('0x0'));var util=require(_0xbfb9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbfb9('0x2'));var BPromise=require(_0xbfb9('0x3'));var rp=require(_0xbfb9('0x4'));var fs=require('fs');var path=require(_0xbfb9('0x5'));var rimraf=require(_0xbfb9('0x6'));var config=require(_0xbfb9('0x7'));var attributes=require(_0xbfb9('0x8'));module[_0xbfb9('0x9')]=function(_0x4ca84c,_0x32bef5){return _0x4ca84c[_0xbfb9('0xa')](_0xbfb9('0xb'),attributes,{'tableName':_0xbfb9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x490b=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1a203c,_0x30d742){var _0x19119e=function(_0x4628b6){while(--_0x4628b6){_0x1a203c['push'](_0x1a203c['shift']());}};_0x19119e(++_0x30d742);}(_0x490b,0x14b));var _0xb490=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0x490b[_0xb8cfbe];return _0x227d51;};'use strict';var _=require(_0xb490('0x0'));var util=require(_0xb490('0x1'));var logger=require(_0xb490('0x2'))(_0xb490('0x3'));var moment=require(_0xb490('0x4'));var BPromise=require(_0xb490('0x5'));var rp=require(_0xb490('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb490('0x7'));var attributes=require(_0xb490('0x8'));module[_0xb490('0x9')]=function(_0x4c2394,_0x35e42a){return _0x4c2394[_0xb490('0xa')](_0xb490('0xb'),attributes,{'tableName':_0xb490('0xc'),'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 82fb02f..579b7e4 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 _0x5c21=['http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5c21,0x90));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x15c2('0x0'));var moment=require(_0x15c2('0x1'));var BPromise=require(_0x15c2('0x2'));var rs=require(_0x15c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15c2('0x4'))['db'];var utils=require(_0x15c2('0x5'));var logger=require(_0x15c2('0x6'))(_0x15c2('0x7'));var config=require(_0x15c2('0x8'));var jayson=require(_0x15c2('0x9'));var client=jayson['client'][_0x15c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e1e25,_0xf7dd99,_0x1a78e6){return new BPromise(function(_0x3fc8ac,_0x4f6891){return client[_0x15c2('0xb')](_0x5e1e25,_0x1a78e6)['then'](function(_0x336780){logger[_0x15c2('0xc')](_0x15c2('0xd'),_0xf7dd99,_0x15c2('0xe'));logger['debug'](_0x15c2('0xf'),_0xf7dd99,'request\x20sent',JSON[_0x15c2('0x10')](_0x336780));if(_0x336780[_0x15c2('0x11')]){if(_0x336780[_0x15c2('0x11')][_0x15c2('0x12')]===0x1f4){logger[_0x15c2('0x11')](_0x15c2('0xd'),_0xf7dd99,_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);return _0x4f6891(_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);}logger['error'](_0x15c2('0xd'),_0xf7dd99,_0x336780['error'][_0x15c2('0x13')]);return _0x3fc8ac(_0x336780[_0x15c2('0x11')][_0x15c2('0x13')]);}else{logger[_0x15c2('0xc')](_0x15c2('0xd'),_0xf7dd99,_0x15c2('0xe'));_0x3fc8ac(_0x336780[_0x15c2('0x14')][_0x15c2('0x13')]);}})[_0x15c2('0x15')](function(_0x7a9f15){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xf7dd99,_0x7a9f15);_0x4f6891(_0x7a9f15);});});} \ No newline at end of file +var _0x7fb3=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3eda45,_0x3a2bf7){var _0x4bea17=function(_0x3f05f0){while(--_0x3f05f0){_0x3eda45['push'](_0x3eda45['shift']());}};_0x4bea17(++_0x3a2bf7);}(_0x7fb3,0xf9));var _0x37fb=function(_0x39ab14,_0x1c6d59){_0x39ab14=_0x39ab14-0x0;var _0x5a661e=_0x7fb3[_0x39ab14];return _0x5a661e;};'use strict';var _=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var moment=require(_0x37fb('0x2'));var BPromise=require(_0x37fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37fb('0x4'));var db=require(_0x37fb('0x5'))['db'];var utils=require(_0x37fb('0x6'));var logger=require(_0x37fb('0x7'))('rpc');var config=require(_0x37fb('0x8'));var jayson=require(_0x37fb('0x9'));var client=jayson[_0x37fb('0xa')][_0x37fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x144254,_0x39d6a3,_0x51b36a){return new BPromise(function(_0x5ab1f3,_0x4ee5e0){return client[_0x37fb('0xc')](_0x144254,_0x51b36a)[_0x37fb('0xd')](function(_0x1f4810){logger[_0x37fb('0xe')](_0x37fb('0xf'),_0x39d6a3,_0x37fb('0x10'));logger[_0x37fb('0x11')](_0x37fb('0x12'),_0x39d6a3,'request\x20sent',JSON['stringify'](_0x1f4810));if(_0x1f4810[_0x37fb('0x13')]){if(_0x1f4810[_0x37fb('0x13')][_0x37fb('0x14')]===0x1f4){logger[_0x37fb('0x13')](_0x37fb('0xf'),_0x39d6a3,_0x1f4810[_0x37fb('0x13')][_0x37fb('0x15')]);return _0x4ee5e0(_0x1f4810[_0x37fb('0x13')]['message']);}logger['error'](_0x37fb('0xf'),_0x39d6a3,_0x1f4810[_0x37fb('0x13')][_0x37fb('0x15')]);return _0x5ab1f3(_0x1f4810[_0x37fb('0x13')]['message']);}else{logger[_0x37fb('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x39d6a3,_0x37fb('0x10'));_0x5ab1f3(_0x1f4810[_0x37fb('0x16')][_0x37fb('0x15')]);}})[_0x37fb('0x17')](function(_0x42b5ce){logger[_0x37fb('0x13')](_0x37fb('0xf'),_0x39d6a3,_0x42b5ce);_0x4ee5e0(_0x42b5ce);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4826d32..e132233 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 _0x8bc3=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x8bc3,0x8a));var _0x38bc=function(_0x475574,_0x528747){_0x475574=_0x475574-0x0;var _0x1f90de=_0x8bc3[_0x475574];return _0x1f90de;};'use strict';var multer=require(_0x38bc('0x0'));var util=require(_0x38bc('0x1'));var path=require(_0x38bc('0x2'));var timeout=require(_0x38bc('0x3'));var express=require(_0x38bc('0x4'));var router=express[_0x38bc('0x5')]();var fs_extra=require(_0x38bc('0x6'));var auth=require(_0x38bc('0x7'));var interaction=require(_0x38bc('0x8'));var config=require(_0x38bc('0x9'));var controller=require('./intDeskField.controller');router[_0x38bc('0xa')]('/',auth['isAuthenticated'](),controller[_0x38bc('0xb')]);router[_0x38bc('0xa')](_0x38bc('0xc'),auth[_0x38bc('0xd')](),controller[_0x38bc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x38bc('0xf')]);router[_0x38bc('0x10')](_0x38bc('0xc'),auth[_0x38bc('0xd')](),controller[_0x38bc('0x11')]);router[_0x38bc('0x12')](_0x38bc('0xc'),auth[_0x38bc('0xd')](),controller['destroy']);module[_0x38bc('0x13')]=router; \ No newline at end of file +var _0x3f2b=['create','put','update','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3f2b,0x1be));var _0xb3f2=function(_0x30134f,_0x1fae49){_0x30134f=_0x30134f-0x0;var _0x25121d=_0x3f2b[_0x30134f];return _0x25121d;};'use strict';var multer=require(_0xb3f2('0x0'));var util=require(_0xb3f2('0x1'));var path=require(_0xb3f2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb3f2('0x3')]();var fs_extra=require(_0xb3f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb3f2('0x5'));var config=require('../../config/environment');var controller=require(_0xb3f2('0x6'));router[_0xb3f2('0x7')]('/',auth[_0xb3f2('0x8')](),controller[_0xb3f2('0x9')]);router[_0xb3f2('0x7')](_0xb3f2('0xa'),auth[_0xb3f2('0x8')](),controller[_0xb3f2('0xb')]);router[_0xb3f2('0xc')]('/',auth[_0xb3f2('0x8')](),controller[_0xb3f2('0xd')]);router[_0xb3f2('0xe')](_0xb3f2('0xa'),auth['isAuthenticated'](),controller[_0xb3f2('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb3f2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index fd8b35c..9834ebd 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 _0x9360=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x4f47eb,_0x5424ae){var _0x2f7730=function(_0x47f73d){while(--_0x47f73d){_0x4f47eb['push'](_0x4f47eb['shift']());}};_0x2f7730(++_0x5424ae);}(_0x9360,0x1c0));var _0x0936=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9360[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x0936('0x0'));module[_0x0936('0x1')]={'type':{'type':Sequelize[_0x0936('0x2')](_0x0936('0x3'),_0x0936('0x4'),_0x0936('0x5'),_0x0936('0x6'),_0x0936('0x7')),'defaultValue':_0x0936('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0936('0x8')]},'keyType':{'type':Sequelize[_0x0936('0x2')](_0x0936('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x0936('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0936('0x8')]},'customField':{'type':Sequelize[_0x0936('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0936('0x8')]}}; \ No newline at end of file +var _0x2365=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x18e6c3,_0x3e0e47){var _0x195456=function(_0x213331){while(--_0x213331){_0x18e6c3['push'](_0x18e6c3['shift']());}};_0x195456(++_0x3e0e47);}(_0x2365,0x6d));var _0x5236=function(_0x24e6a7,_0x29c938){_0x24e6a7=_0x24e6a7-0x0;var _0x4233ce=_0x2365[_0x24e6a7];return _0x4233ce;};'use strict';var Sequelize=require('sequelize');module[_0x5236('0x0')]={'type':{'type':Sequelize[_0x5236('0x1')](_0x5236('0x2'),_0x5236('0x3'),_0x5236('0x4'),_0x5236('0x5'),_0x5236('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5236('0x7')]},'key':{'type':Sequelize[_0x5236('0x7')]},'keyType':{'type':Sequelize[_0x5236('0x1')]('string','variable',_0x5236('0x4'))},'keyContent':{'type':Sequelize[_0x5236('0x7')]},'idField':{'type':Sequelize[_0x5236('0x7')]},'nameField':{'type':Sequelize[_0x5236('0x7')]},'customField':{'type':Sequelize[_0x5236('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5236('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index d142a77..f1e4279 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 _0xf9b7=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','DeskField','findAll','rows','catch','show','params','rawAttributes','create','body'];(function(_0x392a17,_0x55968c){var _0x61f736=function(_0x2709c5){while(--_0x2709c5){_0x392a17['push'](_0x392a17['shift']());}};_0x61f736(++_0x55968c);}(_0xf9b7,0x91));var _0x7f9b=function(_0x452f88,_0x59f752){_0x452f88=_0x452f88-0x0;var _0x30fbf1=_0xf9b7[_0x452f88];return _0x30fbf1;};'use strict';var emlformat=require(_0x7f9b('0x0'));var rimraf=require(_0x7f9b('0x1'));var zipdir=require(_0x7f9b('0x2'));var jsonpatch=require(_0x7f9b('0x3'));var rp=require(_0x7f9b('0x4'));var moment=require(_0x7f9b('0x5'));var BPromise=require(_0x7f9b('0x6'));var Mustache=require(_0x7f9b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7f9b('0x8'));var csv=require('to-csv');var ejs=require(_0x7f9b('0x9'));var fs=require('fs');var fs_extra=require(_0x7f9b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f9b('0xb'));var jsforce=require(_0x7f9b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f9b('0xd'));var Redis=require(_0x7f9b('0xe'));var authService=require(_0x7f9b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7f9b('0x10'));var hardwareService=require(_0x7f9b('0x11'));var logger=require('../../config/logger')(_0x7f9b('0x12'));var utils=require('../../config/utils');var config=require(_0x7f9b('0x13'));var licenseUtil=require(_0x7f9b('0x14'));var db=require(_0x7f9b('0x15'))['db'];function respondWithStatusCode(_0x911217,_0x2c60e6){_0x2c60e6=_0x2c60e6||0xcc;return function(_0x48ea83){if(_0x48ea83){return _0x911217[_0x7f9b('0x16')](_0x2c60e6);}return _0x911217['status'](_0x2c60e6)[_0x7f9b('0x17')]();};}function respondWithResult(_0x27f63e,_0x38a0b1){_0x38a0b1=_0x38a0b1||0xc8;return function(_0x1f756c){if(_0x1f756c){return _0x27f63e[_0x7f9b('0x18')](_0x38a0b1)[_0x7f9b('0x19')](_0x1f756c);}};}function respondWithFilteredResult(_0x261c4c,_0x2ba158){return function(_0x447255){if(_0x447255){var _0x39ecbd=typeof _0x2ba158[_0x7f9b('0x1a')]===_0x7f9b('0x1b')&&typeof _0x2ba158[_0x7f9b('0x1c')]===_0x7f9b('0x1b');var _0x51debb=_0x447255[_0x7f9b('0x1d')];var _0x575643=_0x39ecbd?0x0:_0x2ba158[_0x7f9b('0x1a')];var _0x4d934b=_0x39ecbd?_0x447255[_0x7f9b('0x1d')]:_0x2ba158['offset']+_0x2ba158['limit'];var _0x5cec50;if(_0x4d934b>=_0x51debb){_0x4d934b=_0x51debb;_0x5cec50=0xc8;}else{_0x5cec50=0xce;}_0x261c4c[_0x7f9b('0x18')](_0x5cec50);return _0x261c4c['set'](_0x7f9b('0x1e'),_0x575643+'-'+_0x4d934b+'/'+_0x51debb)['json'](_0x447255);}return null;};}function patchUpdates(_0x4a1399){return function(_0x262857){try{jsonpatch[_0x7f9b('0x1f')](_0x262857,_0x4a1399,!![]);}catch(_0x318203){return BPromise['reject'](_0x318203);}return _0x262857[_0x7f9b('0x20')]();};}function saveUpdates(_0x12285b,_0x47142f){return function(_0x4e3f37){if(_0x4e3f37){return _0x4e3f37[_0x7f9b('0x21')](_0x12285b)[_0x7f9b('0x22')](function(_0x25b6ac){return _0x25b6ac;});}return null;};}function removeEntity(_0x28d6de,_0x38e7d6){return function(_0x527f30){if(_0x527f30){return _0x527f30['destroy']()[_0x7f9b('0x22')](function(){_0x28d6de[_0x7f9b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62295d,_0x17b31d){return function(_0x22c380){if(!_0x22c380){_0x62295d[_0x7f9b('0x16')](0x194);}return _0x22c380;};}function handleError(_0x3b9da4,_0x214347){_0x214347=_0x214347||0x1f4;return function(_0x1155f6){logger['error'](_0x1155f6[_0x7f9b('0x23')]);if(_0x1155f6[_0x7f9b('0x24')]){delete _0x1155f6[_0x7f9b('0x24')];}_0x3b9da4[_0x7f9b('0x18')](_0x214347)[_0x7f9b('0x25')](_0x1155f6);};}exports[_0x7f9b('0x26')]=function(_0x5f3a5c,_0x4ab6ad){var _0x49a678={},_0xe72154={},_0x122caf={'count':0x0,'rows':[]};var _0x4e5c5d=_[_0x7f9b('0x27')](db['DeskField']['rawAttributes'],function(_0x5aba6e){return{'name':_0x5aba6e[_0x7f9b('0x28')],'type':_0x5aba6e[_0x7f9b('0x29')][_0x7f9b('0x2a')]};});_0xe72154[_0x7f9b('0x2b')]=_[_0x7f9b('0x27')](_0x4e5c5d,_0x7f9b('0x24'));_0xe72154['query']=_[_0x7f9b('0x2c')](_0x5f3a5c['query']);_0xe72154[_0x7f9b('0x2d')]=_[_0x7f9b('0x2e')](_0xe72154[_0x7f9b('0x2b')],_0xe72154[_0x7f9b('0x2f')]);_0x49a678[_0x7f9b('0x30')]=_['intersection'](_0xe72154['model'],qs['fields'](_0x5f3a5c['query'][_0x7f9b('0x31')]));_0x49a678[_0x7f9b('0x30')]=_0x49a678['attributes'][_0x7f9b('0x32')]?_0x49a678[_0x7f9b('0x30')]:_0xe72154[_0x7f9b('0x2b')];if(!_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x33')](_0x7f9b('0x34'))){_0x49a678[_0x7f9b('0x1c')]=qs['limit'](_0x5f3a5c['query']['limit']);_0x49a678[_0x7f9b('0x1a')]=qs[_0x7f9b('0x1a')](_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x1a')]);}_0x49a678[_0x7f9b('0x35')]=qs[_0x7f9b('0x36')](_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x36')]);_0x49a678['where']=qs[_0x7f9b('0x2d')](_[_0x7f9b('0x37')](_0x5f3a5c[_0x7f9b('0x2f')],_0xe72154[_0x7f9b('0x2d')]),_0x4e5c5d);if(_0x5f3a5c['query'][_0x7f9b('0x38')]){_0x49a678[_0x7f9b('0x39')]=_[_0x7f9b('0x3a')](_0x49a678[_0x7f9b('0x39')],{'$or':_[_0x7f9b('0x27')](_0x4e5c5d,function(_0x325370){if(_0x325370[_0x7f9b('0x29')]!==_0x7f9b('0x3b')){var _0x55d618={};_0x55d618[_0x325370[_0x7f9b('0x24')]]={'$like':'%'+_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x38')]+'%'};return _0x55d618;}})});}_0x49a678=_[_0x7f9b('0x3a')]({},_0x49a678,_0x5f3a5c['options']);var _0xd937c0={'where':_0x49a678[_0x7f9b('0x39')]};return db['DeskField'][_0x7f9b('0x1d')](_0xd937c0)[_0x7f9b('0x22')](function(_0x413230){_0x122caf['count']=_0x413230;if(_0x5f3a5c['query'][_0x7f9b('0x3c')]){_0x49a678[_0x7f9b('0x3d')]=[{'all':!![]}];}return db[_0x7f9b('0x3e')][_0x7f9b('0x3f')](_0x49a678);})[_0x7f9b('0x22')](function(_0x1e3df5){_0x122caf[_0x7f9b('0x40')]=_0x1e3df5;return _0x122caf;})[_0x7f9b('0x22')](respondWithFilteredResult(_0x4ab6ad,_0x49a678))[_0x7f9b('0x41')](handleError(_0x4ab6ad,null));};exports[_0x7f9b('0x42')]=function(_0x22e485,_0x8ca3a8){var _0x5e2171={'raw':!![],'where':{'id':_0x22e485[_0x7f9b('0x43')]['id']}},_0x190ebc={};_0x190ebc[_0x7f9b('0x2b')]=_[_0x7f9b('0x2c')](db['DeskField'][_0x7f9b('0x44')]);_0x190ebc[_0x7f9b('0x2f')]=_['keys'](_0x22e485[_0x7f9b('0x2f')]);_0x190ebc['filters']=_[_0x7f9b('0x2e')](_0x190ebc[_0x7f9b('0x2b')],_0x190ebc['query']);_0x5e2171[_0x7f9b('0x30')]=_['intersection'](_0x190ebc[_0x7f9b('0x2b')],qs['fields'](_0x22e485['query'][_0x7f9b('0x31')]));_0x5e2171[_0x7f9b('0x30')]=_0x5e2171[_0x7f9b('0x30')][_0x7f9b('0x32')]?_0x5e2171[_0x7f9b('0x30')]:_0x190ebc[_0x7f9b('0x2b')];if(_0x22e485[_0x7f9b('0x2f')][_0x7f9b('0x3c')]){_0x5e2171[_0x7f9b('0x3d')]=[{'all':!![]}];}_0x5e2171=_[_0x7f9b('0x3a')]({},_0x5e2171,_0x22e485['options']);return db[_0x7f9b('0x3e')]['find'](_0x5e2171)[_0x7f9b('0x22')](handleEntityNotFound(_0x8ca3a8,null))[_0x7f9b('0x22')](respondWithResult(_0x8ca3a8,null))['catch'](handleError(_0x8ca3a8,null));};exports[_0x7f9b('0x45')]=function(_0xfe294d,_0x2c9173){return db[_0x7f9b('0x3e')]['create'](_0xfe294d['body'],{})[_0x7f9b('0x22')](respondWithResult(_0x2c9173,0xc9))[_0x7f9b('0x41')](handleError(_0x2c9173,null));};exports['update']=function(_0xd30798,_0x1a211b){if(_0xd30798[_0x7f9b('0x46')]['id']){delete _0xd30798[_0x7f9b('0x46')]['id'];}return db[_0x7f9b('0x3e')][_0x7f9b('0x47')]({'where':{'id':_0xd30798[_0x7f9b('0x43')]['id']}})[_0x7f9b('0x22')](handleEntityNotFound(_0x1a211b,null))[_0x7f9b('0x22')](saveUpdates(_0xd30798[_0x7f9b('0x46')],null))[_0x7f9b('0x22')](respondWithResult(_0x1a211b,null))[_0x7f9b('0x41')](handleError(_0x1a211b,null));};exports['destroy']=function(_0x30004f,_0x3e80d1){return db['DeskField']['find']({'where':{'id':_0x30004f[_0x7f9b('0x43')]['id']}})[_0x7f9b('0x22')](handleEntityNotFound(_0x3e80d1,null))[_0x7f9b('0x22')](removeEntity(_0x3e80d1,null))[_0x7f9b('0x41')](handleError(_0x3e80d1,null));}; \ No newline at end of file +var _0xaf79=['count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xaf79,0x1f0));var _0x9af7=function(_0x502764,_0x1b5205){_0x502764=_0x502764-0x0;var _0xdf680e=_0xaf79[_0x502764];return _0xdf680e;};'use strict';var emlformat=require(_0x9af7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9af7('0x1'));var jsonpatch=require(_0x9af7('0x2'));var rp=require(_0x9af7('0x3'));var moment=require(_0x9af7('0x4'));var BPromise=require(_0x9af7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9af7('0x6'));var ejs=require(_0x9af7('0x7'));var fs=require('fs');var fs_extra=require(_0x9af7('0x8'));var _=require(_0x9af7('0x9'));var squel=require('squel');var crypto=require(_0x9af7('0xa'));var jsforce=require(_0x9af7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9af7('0x6'));var querystring=require(_0x9af7('0xc'));var Papa=require(_0x9af7('0xd'));var Redis=require(_0x9af7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9af7('0xf'));var as=require(_0x9af7('0x10'));var hardwareService=require(_0x9af7('0x11'));var logger=require(_0x9af7('0x12'))(_0x9af7('0x13'));var utils=require(_0x9af7('0x14'));var config=require(_0x9af7('0x15'));var licenseUtil=require(_0x9af7('0x16'));var db=require(_0x9af7('0x17'))['db'];function respondWithStatusCode(_0x72f155,_0x4c69d3){_0x4c69d3=_0x4c69d3||0xcc;return function(_0x38df7a){if(_0x38df7a){return _0x72f155[_0x9af7('0x18')](_0x4c69d3);}return _0x72f155[_0x9af7('0x19')](_0x4c69d3)[_0x9af7('0x1a')]();};}function respondWithResult(_0x351053,_0x498f38){_0x498f38=_0x498f38||0xc8;return function(_0x22278c){if(_0x22278c){return _0x351053[_0x9af7('0x19')](_0x498f38)[_0x9af7('0x1b')](_0x22278c);}};}function respondWithFilteredResult(_0x34ac03,_0x3e495b){return function(_0x368e31){if(_0x368e31){var _0x30a6a1=typeof _0x3e495b['offset']===_0x9af7('0x1c')&&typeof _0x3e495b['limit']==='undefined';var _0x14ce05=_0x368e31[_0x9af7('0x1d')];var _0x19c17d=_0x30a6a1?0x0:_0x3e495b[_0x9af7('0x1e')];var _0x3589fd=_0x30a6a1?_0x368e31[_0x9af7('0x1d')]:_0x3e495b[_0x9af7('0x1e')]+_0x3e495b[_0x9af7('0x1f')];var _0x1b316f;if(_0x3589fd>=_0x14ce05){_0x3589fd=_0x14ce05;_0x1b316f=0xc8;}else{_0x1b316f=0xce;}_0x34ac03[_0x9af7('0x19')](_0x1b316f);return _0x34ac03[_0x9af7('0x20')](_0x9af7('0x21'),_0x19c17d+'-'+_0x3589fd+'/'+_0x14ce05)['json'](_0x368e31);}return null;};}function patchUpdates(_0x3957fe){return function(_0x322105){try{jsonpatch[_0x9af7('0x22')](_0x322105,_0x3957fe,!![]);}catch(_0x2d0a05){return BPromise[_0x9af7('0x23')](_0x2d0a05);}return _0x322105['save']();};}function saveUpdates(_0x571b3c,_0x1a402b){return function(_0x5de6f3){if(_0x5de6f3){return _0x5de6f3['update'](_0x571b3c)[_0x9af7('0x24')](function(_0x2bca08){return _0x2bca08;});}return null;};}function removeEntity(_0x3bb6b8,_0x4d7e51){return function(_0x5c35d8){if(_0x5c35d8){return _0x5c35d8[_0x9af7('0x25')]()[_0x9af7('0x24')](function(){_0x3bb6b8[_0x9af7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb17e59,_0x5847d9){return function(_0x1fe3ef){if(!_0x1fe3ef){_0xb17e59[_0x9af7('0x18')](0x194);}return _0x1fe3ef;};}function handleError(_0x3abaac,_0x57c9b6){_0x57c9b6=_0x57c9b6||0x1f4;return function(_0x54277d){logger['error'](_0x54277d[_0x9af7('0x26')]);if(_0x54277d[_0x9af7('0x27')]){delete _0x54277d[_0x9af7('0x27')];}_0x3abaac[_0x9af7('0x19')](_0x57c9b6)[_0x9af7('0x28')](_0x54277d);};}exports[_0x9af7('0x29')]=function(_0xc49254,_0x5bd210){var _0x512142={},_0x11b9ac={},_0x545275={'count':0x0,'rows':[]};var _0x399d7a=_[_0x9af7('0x2a')](db[_0x9af7('0x2b')][_0x9af7('0x2c')],function(_0x2c3e49){return{'name':_0x2c3e49[_0x9af7('0x2d')],'type':_0x2c3e49[_0x9af7('0x2e')][_0x9af7('0x2f')]};});_0x11b9ac[_0x9af7('0x30')]=_[_0x9af7('0x2a')](_0x399d7a,_0x9af7('0x27'));_0x11b9ac[_0x9af7('0x31')]=_[_0x9af7('0x32')](_0xc49254[_0x9af7('0x31')]);_0x11b9ac[_0x9af7('0x33')]=_[_0x9af7('0x34')](_0x11b9ac['model'],_0x11b9ac[_0x9af7('0x31')]);_0x512142['attributes']=_[_0x9af7('0x34')](_0x11b9ac[_0x9af7('0x30')],qs[_0x9af7('0x35')](_0xc49254['query'][_0x9af7('0x35')]));_0x512142['attributes']=_0x512142['attributes']['length']?_0x512142[_0x9af7('0x36')]:_0x11b9ac[_0x9af7('0x30')];if(!_0xc49254['query'][_0x9af7('0x37')](_0x9af7('0x38'))){_0x512142[_0x9af7('0x1f')]=qs[_0x9af7('0x1f')](_0xc49254[_0x9af7('0x31')][_0x9af7('0x1f')]);_0x512142[_0x9af7('0x1e')]=qs[_0x9af7('0x1e')](_0xc49254[_0x9af7('0x31')][_0x9af7('0x1e')]);}_0x512142[_0x9af7('0x39')]=qs[_0x9af7('0x3a')](_0xc49254[_0x9af7('0x31')]['sort']);_0x512142[_0x9af7('0x3b')]=qs[_0x9af7('0x33')](_[_0x9af7('0x3c')](_0xc49254[_0x9af7('0x31')],_0x11b9ac['filters']),_0x399d7a);if(_0xc49254['query'][_0x9af7('0x3d')]){_0x512142[_0x9af7('0x3b')]=_['merge'](_0x512142[_0x9af7('0x3b')],{'$or':_['map'](_0x399d7a,function(_0x5997ae){if(_0x5997ae[_0x9af7('0x2e')]!=='VIRTUAL'){var _0x1cd5a8={};_0x1cd5a8[_0x5997ae['name']]={'$like':'%'+_0xc49254[_0x9af7('0x31')][_0x9af7('0x3d')]+'%'};return _0x1cd5a8;}})});}_0x512142=_[_0x9af7('0x3e')]({},_0x512142,_0xc49254[_0x9af7('0x3f')]);var _0x1480e7={'where':_0x512142[_0x9af7('0x3b')]};return db[_0x9af7('0x2b')]['count'](_0x1480e7)['then'](function(_0x5ab0d0){_0x545275[_0x9af7('0x1d')]=_0x5ab0d0;if(_0xc49254[_0x9af7('0x31')]['includeAll']){_0x512142[_0x9af7('0x40')]=[{'all':!![]}];}return db[_0x9af7('0x2b')][_0x9af7('0x41')](_0x512142);})['then'](function(_0x574444){_0x545275[_0x9af7('0x42')]=_0x574444;return _0x545275;})['then'](respondWithFilteredResult(_0x5bd210,_0x512142))[_0x9af7('0x43')](handleError(_0x5bd210,null));};exports[_0x9af7('0x44')]=function(_0x165ae2,_0x456430){var _0x23214c={'raw':!![],'where':{'id':_0x165ae2[_0x9af7('0x45')]['id']}},_0x20f333={};_0x20f333[_0x9af7('0x30')]=_['keys'](db[_0x9af7('0x2b')]['rawAttributes']);_0x20f333[_0x9af7('0x31')]=_[_0x9af7('0x32')](_0x165ae2[_0x9af7('0x31')]);_0x20f333[_0x9af7('0x33')]=_[_0x9af7('0x34')](_0x20f333['model'],_0x20f333[_0x9af7('0x31')]);_0x23214c[_0x9af7('0x36')]=_[_0x9af7('0x34')](_0x20f333[_0x9af7('0x30')],qs['fields'](_0x165ae2[_0x9af7('0x31')][_0x9af7('0x35')]));_0x23214c['attributes']=_0x23214c[_0x9af7('0x36')]['length']?_0x23214c[_0x9af7('0x36')]:_0x20f333[_0x9af7('0x30')];if(_0x165ae2[_0x9af7('0x31')][_0x9af7('0x46')]){_0x23214c['include']=[{'all':!![]}];}_0x23214c=_[_0x9af7('0x3e')]({},_0x23214c,_0x165ae2[_0x9af7('0x3f')]);return db[_0x9af7('0x2b')]['find'](_0x23214c)[_0x9af7('0x24')](handleEntityNotFound(_0x456430,null))[_0x9af7('0x24')](respondWithResult(_0x456430,null))[_0x9af7('0x43')](handleError(_0x456430,null));};exports[_0x9af7('0x47')]=function(_0x8a1e08,_0x3f4496){return db[_0x9af7('0x2b')][_0x9af7('0x47')](_0x8a1e08[_0x9af7('0x48')],{})[_0x9af7('0x24')](respondWithResult(_0x3f4496,0xc9))[_0x9af7('0x43')](handleError(_0x3f4496,null));};exports[_0x9af7('0x49')]=function(_0x2f3f64,_0x3e7355){if(_0x2f3f64[_0x9af7('0x48')]['id']){delete _0x2f3f64['body']['id'];}return db[_0x9af7('0x2b')][_0x9af7('0x4a')]({'where':{'id':_0x2f3f64[_0x9af7('0x45')]['id']}})[_0x9af7('0x24')](handleEntityNotFound(_0x3e7355,null))[_0x9af7('0x24')](saveUpdates(_0x2f3f64[_0x9af7('0x48')],null))[_0x9af7('0x24')](respondWithResult(_0x3e7355,null))[_0x9af7('0x43')](handleError(_0x3e7355,null));};exports[_0x9af7('0x25')]=function(_0x5b9a47,_0x284532){return db[_0x9af7('0x2b')]['find']({'where':{'id':_0x5b9a47[_0x9af7('0x45')]['id']}})[_0x9af7('0x24')](handleEntityNotFound(_0x284532,null))[_0x9af7('0x24')](removeEntity(_0x284532,null))[_0x9af7('0x43')](handleError(_0x284532,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a4765ee..1e68266 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 _0x0e1a=['./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','rimraf'];(function(_0x445024,_0x36dca6){var _0x5ab19a=function(_0x598957){while(--_0x598957){_0x445024['push'](_0x445024['shift']());}};_0x5ab19a(++_0x36dca6);}(_0x0e1a,0x8b));var _0xa0e1=function(_0x3172dc,_0x132513){_0x3172dc=_0x3172dc-0x0;var _0x42aa7c=_0x0e1a[_0x3172dc];return _0x42aa7c;};'use strict';var _=require(_0xa0e1('0x0'));var util=require(_0xa0e1('0x1'));var logger=require(_0xa0e1('0x2'))(_0xa0e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa0e1('0x4'));var config=require('../../config/environment');var attributes=require(_0xa0e1('0x5'));module[_0xa0e1('0x6')]=function(_0x5b810d,_0x18c3e8){return _0x5b810d[_0xa0e1('0x7')](_0xa0e1('0x8'),attributes,{'tableName':_0xa0e1('0x9'),'paranoid':![],'indexes':[{'name':_0xa0e1('0xa'),'fields':['idField',_0xa0e1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60dc=['bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','desk_unique_index','FieldId','../../config/logger','api','moment'];(function(_0x227eec,_0x4a4027){var _0x2ee592=function(_0x3cfa11){while(--_0x3cfa11){_0x227eec['push'](_0x227eec['shift']());}};_0x2ee592(++_0x4a4027);}(_0x60dc,0xa5));var _0xc60d=function(_0x3c58ea,_0x314626){_0x3c58ea=_0x3c58ea-0x0;var _0x3d4e03=_0x60dc[_0x3c58ea];return _0x3d4e03;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc60d('0x0'))(_0xc60d('0x1'));var moment=require(_0xc60d('0x2'));var BPromise=require(_0xc60d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc60d('0x4'));var rimraf=require(_0xc60d('0x5'));var config=require(_0xc60d('0x6'));var attributes=require(_0xc60d('0x7'));module['exports']=function(_0x28c2a1,_0x2224b8){return _0x28c2a1[_0xc60d('0x8')](_0xc60d('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xc60d('0xa'),'fields':['idField',_0xc60d('0xb')],'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 5b44e2d..584ead5 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 _0x6cdc=['debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x2bcc8d,_0x5691d1){var _0x123b6a=function(_0xbe08e8){while(--_0xbe08e8){_0x2bcc8d['push'](_0x2bcc8d['shift']());}};_0x123b6a(++_0x5691d1);}(_0x6cdc,0x125));var _0xc6cd=function(_0x280bb5,_0x4a1aff){_0x280bb5=_0x280bb5-0x0;var _0x2b760c=_0x6cdc[_0x280bb5];return _0x2b760c;};'use strict';var _=require(_0xc6cd('0x0'));var util=require(_0xc6cd('0x1'));var moment=require(_0xc6cd('0x2'));var BPromise=require('bluebird');var rs=require(_0xc6cd('0x3'));var fs=require('fs');var Redis=require(_0xc6cd('0x4'));var db=require(_0xc6cd('0x5'))['db'];var utils=require(_0xc6cd('0x6'));var logger=require('../../config/logger')(_0xc6cd('0x7'));var config=require('../../config/environment');var jayson=require(_0xc6cd('0x8'));var client=jayson[_0xc6cd('0x9')][_0xc6cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f0bb5,_0x394e81,_0x18533e){return new BPromise(function(_0x5b1620,_0x1cd4c8){return client[_0xc6cd('0xb')](_0x5f0bb5,_0x18533e)[_0xc6cd('0xc')](function(_0x910143){logger['info'](_0xc6cd('0xd'),_0x394e81,_0xc6cd('0xe'));logger[_0xc6cd('0xf')](_0xc6cd('0x10'),_0x394e81,_0xc6cd('0xe'),JSON['stringify'](_0x910143));if(_0x910143['error']){if(_0x910143[_0xc6cd('0x11')][_0xc6cd('0x12')]===0x1f4){logger[_0xc6cd('0x11')]('DeskField,\x20%s,\x20%s',_0x394e81,_0x910143['error'][_0xc6cd('0x13')]);return _0x1cd4c8(_0x910143[_0xc6cd('0x11')][_0xc6cd('0x13')]);}logger[_0xc6cd('0x11')]('DeskField,\x20%s,\x20%s',_0x394e81,_0x910143[_0xc6cd('0x11')][_0xc6cd('0x13')]);return _0x5b1620(_0x910143[_0xc6cd('0x11')][_0xc6cd('0x13')]);}else{logger[_0xc6cd('0x14')](_0xc6cd('0xd'),_0x394e81,_0xc6cd('0xe'));_0x5b1620(_0x910143[_0xc6cd('0x15')]['message']);}})['catch'](function(_0x2e6a62){logger[_0xc6cd('0x11')]('DeskField,\x20%s,\x20%s',_0x394e81,_0x2e6a62);_0x1cd4c8(_0x2e6a62);});});} \ No newline at end of file +var _0x4032=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0xbf400c,_0x37e1e7){var _0x2ee697=function(_0x3c2668){while(--_0x3c2668){_0xbf400c['push'](_0xbf400c['shift']());}};_0x2ee697(++_0x37e1e7);}(_0x4032,0xee));var _0x2403=function(_0x3dd30c,_0x29e40a){_0x3dd30c=_0x3dd30c-0x0;var _0x2f8f65=_0x4032[_0x3dd30c];return _0x2f8f65;};'use strict';var _=require(_0x2403('0x0'));var util=require(_0x2403('0x1'));var moment=require(_0x2403('0x2'));var BPromise=require(_0x2403('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2403('0x4'))['db'];var utils=require(_0x2403('0x5'));var logger=require('../../config/logger')(_0x2403('0x6'));var config=require(_0x2403('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2403('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36cdbf,_0x14075e,_0x10345e){return new BPromise(function(_0x53f7b0,_0x337131){return client['request'](_0x36cdbf,_0x10345e)[_0x2403('0x9')](function(_0x11f89b){logger[_0x2403('0xa')](_0x2403('0xb'),_0x14075e,_0x2403('0xc'));logger['debug'](_0x2403('0xd'),_0x14075e,_0x2403('0xc'),JSON[_0x2403('0xe')](_0x11f89b));if(_0x11f89b[_0x2403('0xf')]){if(_0x11f89b[_0x2403('0xf')][_0x2403('0x10')]===0x1f4){logger[_0x2403('0xf')](_0x2403('0xb'),_0x14075e,_0x11f89b[_0x2403('0xf')][_0x2403('0x11')]);return _0x337131(_0x11f89b['error'][_0x2403('0x11')]);}logger[_0x2403('0xf')](_0x2403('0xb'),_0x14075e,_0x11f89b[_0x2403('0xf')][_0x2403('0x11')]);return _0x53f7b0(_0x11f89b[_0x2403('0xf')][_0x2403('0x11')]);}else{logger[_0x2403('0xa')](_0x2403('0xb'),_0x14075e,_0x2403('0xc'));_0x53f7b0(_0x11f89b[_0x2403('0x12')][_0x2403('0x11')]);}})[_0x2403('0x13')](function(_0x38d385){logger[_0x2403('0xf')](_0x2403('0xb'),_0x14075e,_0x38d385);_0x337131(_0x38d385);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e6cc9e9..b6e013b 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 _0xd2b2=['../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x46a39f,_0x13820a){var _0x3595d2=function(_0x1a74d6){while(--_0x1a74d6){_0x46a39f['push'](_0x46a39f['shift']());}};_0x3595d2(++_0x13820a);}(_0xd2b2,0xda));var _0x2d2b=function(_0x3c29e3,_0x43f921){_0x3c29e3=_0x3c29e3-0x0;var _0x536b6c=_0xd2b2[_0x3c29e3];return _0x536b6c;};'use strict';var multer=require(_0x2d2b('0x0'));var util=require(_0x2d2b('0x1'));var path=require('path');var timeout=require(_0x2d2b('0x2'));var express=require(_0x2d2b('0x3'));var router=express['Router']();var fs_extra=require(_0x2d2b('0x4'));var auth=require(_0x2d2b('0x5'));var interaction=require(_0x2d2b('0x6'));var config=require(_0x2d2b('0x7'));var controller=require(_0x2d2b('0x8'));router[_0x2d2b('0x9')]('/',auth[_0x2d2b('0xa')](),controller['index']);router[_0x2d2b('0x9')](_0x2d2b('0xb'),auth[_0x2d2b('0xa')](),controller[_0x2d2b('0xc')]);router[_0x2d2b('0x9')](_0x2d2b('0xd'),auth[_0x2d2b('0xa')](),controller[_0x2d2b('0xe')]);router[_0x2d2b('0x9')](_0x2d2b('0xf'),auth[_0x2d2b('0xa')](),controller[_0x2d2b('0x10')]);router[_0x2d2b('0x11')]('/',auth[_0x2d2b('0xa')](),controller[_0x2d2b('0x12')]);router[_0x2d2b('0x11')](_0x2d2b('0xd'),auth['isAuthenticated'](),controller[_0x2d2b('0x13')]);router[_0x2d2b('0x14')](_0x2d2b('0xb'),auth[_0x2d2b('0xa')](),controller[_0x2d2b('0x15')]);router[_0x2d2b('0x16')](_0x2d2b('0xb'),auth['isAuthenticated'](),controller[_0x2d2b('0x17')]);module[_0x2d2b('0x18')]=router; \ No newline at end of file +var _0xbdad=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','addConfiguration','put','update','delete'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbdad,0x7f));var _0xdbda=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbdad[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xdbda('0x0'));var util=require(_0xdbda('0x1'));var path=require(_0xdbda('0x2'));var timeout=require(_0xdbda('0x3'));var express=require(_0xdbda('0x4'));var router=express[_0xdbda('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbda('0x6'));var config=require(_0xdbda('0x7'));var controller=require(_0xdbda('0x8'));router['get']('/',auth[_0xdbda('0x9')](),controller['index']);router[_0xdbda('0xa')](_0xdbda('0xb'),auth['isAuthenticated'](),controller[_0xdbda('0xc')]);router[_0xdbda('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xdbda('0xd')]);router[_0xdbda('0xa')](_0xdbda('0xe'),auth[_0xdbda('0x9')](),controller[_0xdbda('0xf')]);router['post']('/',auth[_0xdbda('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0xdbda('0x9')](),controller[_0xdbda('0x10')]);router[_0xdbda('0x11')](_0xdbda('0xb'),auth['isAuthenticated'](),controller[_0xdbda('0x12')]);router[_0xdbda('0x13')](_0xdbda('0xb'),auth[_0xdbda('0x9')](),controller['destroy']);module[_0xdbda('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 4d12e69..e90fa78 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 _0x9b69=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5e6519,_0x49271f){var _0x40713e=function(_0x37a04a){while(--_0x37a04a){_0x5e6519['push'](_0x5e6519['shift']());}};_0x40713e(++_0x49271f);}(_0x9b69,0xa3));var _0x99b6=function(_0x309a93,_0x57a138){_0x309a93=_0x309a93-0x0;var _0x528a05=_0x9b69[_0x309a93];return _0x528a05;};'use strict';var Sequelize=require(_0x99b6('0x0'));module[_0x99b6('0x1')]={'name':{'type':Sequelize[_0x99b6('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x99b6('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x99b6('0x2')]},'clientSecret':{'type':Sequelize[_0x99b6('0x2')]},'serverUrl':{'type':Sequelize[_0x99b6('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x99b6('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe5e0=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3ff1f8,_0x5920ff){var _0x3857f5=function(_0x1a6711){while(--_0x1a6711){_0x3ff1f8['push'](_0x3ff1f8['shift']());}};_0x3857f5(++_0x5920ff);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x4422e8,_0xa771e2){_0x4422e8=_0x4422e8-0x0;var _0x523b92=_0xe5e0[_0x4422e8];return _0x523b92;};'use strict';var Sequelize=require(_0x0e5e('0x0'));module[_0x0e5e('0x1')]={'name':{'type':Sequelize[_0x0e5e('0x2')]},'username':{'type':Sequelize[_0x0e5e('0x2')]},'password':{'type':Sequelize[_0x0e5e('0x2')]},'remoteUri':{'type':Sequelize[_0x0e5e('0x2')]},'tenantId':{'type':Sequelize[_0x0e5e('0x2')]},'clientId':{'type':Sequelize[_0x0e5e('0x2')]},'clientSecret':{'type':Sequelize[_0x0e5e('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0e5e('0x2')]},'modernAuthentication':{'type':Sequelize[_0x0e5e('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ee3253b..fbdc48a 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 _0x86c4=['customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','password','remoteUri','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','https://login.microsoftonline.com/','tenantId','clientSecret','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','isNil','substring','lastIndexOf','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','Wrong\x20credentials','statusCode','GET',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','status','offset','undefined','limit','count','set','json','update','then','destroy','end','sendStatus','error','stack','name','index','Dynamics365Account','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','options','includeAll','include','findAll','catch','show','create','body','find','params','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','channel','Subjects','slice','format','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','customeridname'];(function(_0x52ac97,_0x48f8be){var _0x1fab11=function(_0xece7f0){while(--_0xece7f0){_0x52ac97['push'](_0x52ac97['shift']());}};_0x1fab11(++_0x48f8be);}(_0x86c4,0x64));var _0x486c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x86c4[_0x4565bf];return _0x5610ba;};'use strict';var rp=require(_0x486c('0x0'));var util=require('util');var _=require(_0x486c('0x1'));var qs=require(_0x486c('0x2'));var logger=require(_0x486c('0x3'))(_0x486c('0x4'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x28ab56,_0x10bce3){_0x10bce3=_0x10bce3||0xc8;return function(_0x1caa48){if(_0x1caa48){return _0x28ab56[_0x486c('0x5')](_0x10bce3)['json'](_0x1caa48);}};}function respondWithFilteredResult(_0x30e7fb,_0x53e7e4){return function(_0x5aafe7){if(_0x5aafe7){var _0x3d8c58=typeof _0x53e7e4[_0x486c('0x6')]===_0x486c('0x7')&&typeof _0x53e7e4[_0x486c('0x8')]===_0x486c('0x7');var _0x34a36d=_0x5aafe7[_0x486c('0x9')];var _0x6e5a34=_0x3d8c58?0x0:_0x53e7e4[_0x486c('0x6')];var _0x54877e=_0x3d8c58?_0x5aafe7['count']:_0x53e7e4[_0x486c('0x6')]+_0x53e7e4[_0x486c('0x8')];var _0x151c83;if(_0x54877e>=_0x34a36d){_0x54877e=_0x34a36d;_0x151c83=0xc8;}else{_0x151c83=0xce;}_0x30e7fb['status'](_0x151c83);return _0x30e7fb[_0x486c('0xa')]('Content-Range',_0x6e5a34+'-'+_0x54877e+'/'+_0x34a36d)[_0x486c('0xb')](_0x5aafe7);}return null;};}function saveUpdates(_0x18a1f1){return function(_0x29773c){if(_0x29773c){return _0x29773c[_0x486c('0xc')](_0x18a1f1)[_0x486c('0xd')](function(_0x2f16d0){return _0x2f16d0;});}return null;};}function removeEntity(_0x38606f){return function(_0xfe2692){if(_0xfe2692){return _0xfe2692[_0x486c('0xe')]()[_0x486c('0xd')](function(){_0x38606f[_0x486c('0x5')](0xcc)[_0x486c('0xf')]();});}};}function handleEntityNotFound(_0x23573e){return function(_0x2e96a3){if(!_0x2e96a3){_0x23573e[_0x486c('0x10')](0x194);}return _0x2e96a3;};}function handleError(_0x538ff5,_0x2a01bb){_0x2a01bb=_0x2a01bb||0x1f4;return function(_0x1c1a90){logger[_0x486c('0x11')](_0x1c1a90[_0x486c('0x12')]);if(_0x1c1a90['name']){delete _0x1c1a90[_0x486c('0x13')];}_0x538ff5[_0x486c('0x5')](_0x2a01bb)['send'](_0x1c1a90);};}exports[_0x486c('0x14')]=function(_0x5b6760,_0x25efa3){var _0x507c13={},_0x71a26b={},_0x172905={'count':0x0,'rows':[]};var _0x4fec1a=_['map'](db[_0x486c('0x15')][_0x486c('0x16')],function(_0x3952fa){return{'name':_0x3952fa[_0x486c('0x17')],'type':_0x3952fa[_0x486c('0x18')][_0x486c('0x19')]};});_0x71a26b['model']=_[_0x486c('0x1a')](_0x4fec1a,_0x486c('0x13'));_0x71a26b[_0x486c('0x1b')]=_[_0x486c('0x1c')](_0x5b6760[_0x486c('0x1b')]);_0x71a26b['filters']=_['intersection'](_0x71a26b[_0x486c('0x1d')],_0x71a26b['query']);_0x507c13[_0x486c('0x1e')]=_[_0x486c('0x1f')](_0x71a26b['model'],qs[_0x486c('0x20')](_0x5b6760[_0x486c('0x1b')][_0x486c('0x20')]));_0x507c13[_0x486c('0x1e')]=_0x507c13[_0x486c('0x1e')][_0x486c('0x21')]?_0x507c13[_0x486c('0x1e')]:_0x71a26b[_0x486c('0x1d')];if(!_0x5b6760['query'][_0x486c('0x22')](_0x486c('0x23'))){_0x507c13[_0x486c('0x8')]=qs[_0x486c('0x8')](_0x5b6760['query'][_0x486c('0x8')]);_0x507c13[_0x486c('0x6')]=qs['offset'](_0x5b6760[_0x486c('0x1b')][_0x486c('0x6')]);}_0x507c13['order']=qs['sort'](_0x5b6760[_0x486c('0x1b')][_0x486c('0x24')]);_0x507c13['where']=qs[_0x486c('0x25')](_[_0x486c('0x26')](_0x5b6760[_0x486c('0x1b')],_0x71a26b['filters']),_0x4fec1a);if(_0x5b6760[_0x486c('0x1b')][_0x486c('0x27')]){_0x507c13['where']=_[_0x486c('0x28')](_0x507c13[_0x486c('0x29')],{'$or':_['map'](_0x4fec1a,function(_0x284f85){if(_0x284f85[_0x486c('0x18')]!=='VIRTUAL'){var _0x412e2b={};_0x412e2b[_0x284f85[_0x486c('0x13')]]={'$like':'%'+_0x5b6760['query'][_0x486c('0x27')]+'%'};return _0x412e2b;}})});}_0x507c13=_['merge']({},_0x507c13,_0x5b6760[_0x486c('0x2a')]);var _0x2bfbcf={'where':_0x507c13[_0x486c('0x29')]};return db['Dynamics365Account']['count'](_0x2bfbcf)[_0x486c('0xd')](function(_0x575e87){_0x172905[_0x486c('0x9')]=_0x575e87;if(_0x5b6760[_0x486c('0x1b')][_0x486c('0x2b')]){_0x507c13[_0x486c('0x2c')]=[{'all':!![]}];}return db[_0x486c('0x15')][_0x486c('0x2d')](_0x507c13);})['then'](function(_0x374890){_0x172905['rows']=_0x374890;return _0x172905;})[_0x486c('0xd')](respondWithFilteredResult(_0x25efa3,_0x507c13))[_0x486c('0x2e')](handleError(_0x25efa3,null));};exports[_0x486c('0x2f')]=function(_0x355d18,_0x3b4f1f){var _0x1e43c6={'raw':![],'where':{'id':_0x355d18['params']['id']}},_0x5cb216={};_0x5cb216[_0x486c('0x1d')]=_[_0x486c('0x1c')](db['Dynamics365Account'][_0x486c('0x16')]);_0x5cb216['query']=_[_0x486c('0x1c')](_0x355d18[_0x486c('0x1b')]);_0x5cb216[_0x486c('0x25')]=_[_0x486c('0x1f')](_0x5cb216[_0x486c('0x1d')],_0x5cb216[_0x486c('0x1b')]);_0x1e43c6[_0x486c('0x1e')]=_['intersection'](_0x5cb216[_0x486c('0x1d')],qs['fields'](_0x355d18[_0x486c('0x1b')][_0x486c('0x20')]));_0x1e43c6[_0x486c('0x1e')]=_0x1e43c6['attributes'][_0x486c('0x21')]?_0x1e43c6[_0x486c('0x1e')]:_0x5cb216['model'];if(_0x355d18[_0x486c('0x1b')]['includeAll']){_0x1e43c6[_0x486c('0x2c')]=[{'all':!![]}];}_0x1e43c6=_[_0x486c('0x28')]({},_0x1e43c6,_0x355d18[_0x486c('0x2a')]);return db[_0x486c('0x15')]['find'](_0x1e43c6)['then'](handleEntityNotFound(_0x3b4f1f,null))[_0x486c('0xd')](respondWithResult(_0x3b4f1f,null))[_0x486c('0x2e')](handleError(_0x3b4f1f,null));};exports[_0x486c('0x30')]=function(_0x1659eb,_0x1e3452){return db[_0x486c('0x15')][_0x486c('0x30')](_0x1659eb[_0x486c('0x31')],{})['then'](respondWithResult(_0x1e3452,0xc9))['catch'](handleError(_0x1e3452,null));};exports[_0x486c('0xc')]=function(_0x3b406e,_0x9da408){if(_0x3b406e[_0x486c('0x31')]['id']){delete _0x3b406e[_0x486c('0x31')]['id'];}return db['Dynamics365Account'][_0x486c('0x32')]({'where':{'id':_0x3b406e[_0x486c('0x33')]['id']}})[_0x486c('0xd')](handleEntityNotFound(_0x9da408,null))[_0x486c('0xd')](saveUpdates(_0x3b406e[_0x486c('0x31')],null))['then'](respondWithResult(_0x9da408,null))[_0x486c('0x2e')](handleError(_0x9da408,null));};exports[_0x486c('0xe')]=function(_0x204796,_0x36fb51){return db[_0x486c('0x15')][_0x486c('0x32')]({'where':{'id':_0x204796[_0x486c('0x33')]['id']}})['then'](handleEntityNotFound(_0x36fb51,null))[_0x486c('0xd')](removeEntity(_0x36fb51,null))['catch'](handleError(_0x36fb51,null));};exports['getConfigurations']=function(_0x1caa66,_0x25874f){var _0x51ba11={};var _0x4e296a={};var _0x2f9454;var _0x1a003a;return db[_0x486c('0x15')]['findOne']({'where':{'id':_0x1caa66[_0x486c('0x33')]['id']}})[_0x486c('0xd')](handleEntityNotFound(_0x25874f,null))[_0x486c('0xd')](function(_0x113990){if(_0x113990){_0x2f9454=_0x113990;_0x4e296a[_0x486c('0x1d')]=_[_0x486c('0x1c')](db[_0x486c('0x34')][_0x486c('0x16')]);_0x4e296a[_0x486c('0x1b')]=_[_0x486c('0x1c')](_0x1caa66['query']);_0x4e296a[_0x486c('0x25')]=_[_0x486c('0x1f')](_0x4e296a['model'],_0x4e296a['query']);_0x51ba11['attributes']=_['intersection'](_0x4e296a[_0x486c('0x1d')],qs[_0x486c('0x20')](_0x1caa66[_0x486c('0x1b')]['fields']));_0x51ba11[_0x486c('0x1e')]=_0x51ba11[_0x486c('0x1e')]['length']?_0x51ba11[_0x486c('0x1e')]:_0x4e296a[_0x486c('0x1d')];_0x51ba11['order']=qs[_0x486c('0x24')](_0x1caa66[_0x486c('0x1b')]['sort']);_0x51ba11[_0x486c('0x29')]=qs['filters'](_[_0x486c('0x26')](_0x1caa66['query'],_0x4e296a[_0x486c('0x25')]));if(_0x1caa66['query']['filter']){_0x51ba11[_0x486c('0x29')]=_[_0x486c('0x28')](_0x51ba11['where'],{'$or':_['map'](_0x51ba11['attributes'],function(_0x10d500){var _0x56bd0a={};_0x56bd0a[_0x10d500]={'$like':'%'+_0x1caa66['query'][_0x486c('0x27')]+'%'};return _0x56bd0a;})});}_0x51ba11=_[_0x486c('0x28')]({},_0x51ba11,_0x1caa66['options']);return _0x2f9454[_0x486c('0x35')](_0x51ba11);}})['then'](function(_0x287d93){if(_0x287d93){_0x1a003a=_0x287d93[_0x486c('0x21')];if(!_0x1caa66[_0x486c('0x1b')][_0x486c('0x22')](_0x486c('0x23'))){_0x51ba11[_0x486c('0x8')]=qs[_0x486c('0x8')](_0x1caa66[_0x486c('0x1b')][_0x486c('0x8')]);_0x51ba11['offset']=qs[_0x486c('0x6')](_0x1caa66[_0x486c('0x1b')][_0x486c('0x6')]);}return _0x2f9454['getConfigurations'](_0x51ba11);}})[_0x486c('0xd')](function(_0x4a8cc2){if(_0x4a8cc2){return _0x4a8cc2?{'count':_0x1a003a,'rows':_0x4a8cc2}:null;}})[_0x486c('0xd')](respondWithResult(_0x25874f,null))[_0x486c('0x2e')](handleError(_0x25874f,null));};exports[_0x486c('0x36')]=function(_0x5006c1,_0x1156c1){if(_0x5006c1[_0x486c('0x31')]['id']){delete _0x5006c1['body']['id'];}return db[_0x486c('0x15')]['findOne']({'where':{'id':_0x5006c1[_0x486c('0x33')]['id']}})[_0x486c('0xd')](handleEntityNotFound(_0x1156c1,null))[_0x486c('0xd')](function(_0x17f215){if(_0x17f215){_0x5006c1[_0x486c('0x31')][_0x486c('0x37')]=_0x17f215['id'];_0x5006c1[_0x486c('0x31')]['Subjects']=integrations[_0x486c('0x38')](_0x5006c1[_0x486c('0x31')]['channel'],_0x5006c1['body']['type']);_0x5006c1[_0x486c('0x31')][_0x486c('0x39')]=integrations['getDescriptions'](_0x5006c1['body'][_0x486c('0x3a')],_0x5006c1['body'][_0x486c('0x18')]);return db[_0x486c('0x34')][_0x486c('0x30')](_0x5006c1[_0x486c('0x31')],{'include':[{'model':db['Dynamics365Field'],'as':_0x486c('0x3b')},{'model':db['Dynamics365Field'],'as':_0x486c('0x39')}]});}return null;})[_0x486c('0xd')](respondWithResult(_0x1156c1,null))[_0x486c('0x2e')](handleError(_0x1156c1,null));};function sanitizeRemoteUri(_0x42029d){var _0x42475c=_0x42029d[_0x486c('0x3c')](-0x1);if(_0x42475c==='/')return _0x42029d['substring'](0x0,_0x42029d['lastIndexOf'](_0x42475c));return _0x42029d;}function getWebApiUrl(_0x56d4bf){return util[_0x486c('0x3d')](_0x486c('0x3e'),_0x56d4bf);}exports[_0x486c('0x3f')]=function(_0x5b6c46,_0x5f16c4){var _0x30246b=_0x5b6c46[_0x486c('0x1b')][_0x486c('0x40')];var _0x266d7c=_0x30246b===_0x486c('0x41')?'Incident':_0x486c('0x42');var _0x1bb899='';var _0x6cc132='';var _0xf2d5ca='';var _0x252118='';var _0x4cc4b2='';var _0x32259a='';var _0x3bf453='';var _0x502f79='';var _0x2282f9=[_0x486c('0x43'),'description',_0x486c('0x44'),_0x486c('0x45'),_0x486c('0x46'),_0x486c('0x47'),_0x486c('0x48'),'regardingobjectid',_0x486c('0x49'),'phonecall_activity_parties'];var _0x63c7fd=[_0x486c('0x4a'),_0x486c('0x4b'),_0x486c('0x4c'),_0x486c('0x4d'),_0x486c('0x4e'),_0x486c('0x4f'),_0x486c('0x50'),'contractidname',_0x486c('0x51'),_0x486c('0x52'),_0x486c('0x53'),_0x486c('0x54'),'createdon','createdonbehalfbyname','createdonbehalfbyyominame',_0x486c('0x55'),_0x486c('0x56'),'customeridyominame',_0x486c('0x57'),_0x486c('0x58'),_0x486c('0x59'),_0x486c('0x5a'),_0x486c('0x5b'),_0x486c('0x5c'),'firstresponsebykpiidname',_0x486c('0x5d'),_0x486c('0x5e'),_0x486c('0x5f'),_0x486c('0x60'),'lastonholdtime',_0x486c('0x61'),_0x486c('0x62'),_0x486c('0x63'),_0x486c('0x64'),'modifiedbyyominame',_0x486c('0x65'),_0x486c('0x66'),_0x486c('0x67'),_0x486c('0x68'),_0x486c('0x69'),_0x486c('0x6a'),_0x486c('0x6b'),'overriddencreatedon',_0x486c('0x6c'),_0x486c('0x6d'),'owneridyominame',_0x486c('0x6e'),_0x486c('0x6f'),_0x486c('0x70'),_0x486c('0x71'),'productidname',_0x486c('0x72'),_0x486c('0x73'),'resolvebykpiidname',_0x486c('0x74'),_0x486c('0x75'),_0x486c('0x76'),_0x486c('0x77'),_0x486c('0x78'),_0x486c('0x79'),'socialprofileidname',_0x486c('0x7a'),'statuscode',_0x486c('0x7b'),'ticketnumber',_0x486c('0x7c'),_0x486c('0x7d'),_0x486c('0x7e'),_0x486c('0x7f'),_0x486c('0x80')];var _0x554b8b=_0x2282f9[_0x486c('0x81')](_0x63c7fd);return db[_0x486c('0x15')][_0x486c('0x82')]({'where':{'id':_0x5b6c46[_0x486c('0x33')]['id']},'attributes':['id',_0x486c('0x83'),_0x486c('0x84'),_0x486c('0x85'),'tenantId',_0x486c('0x86'),'clientSecret',_0x486c('0x87')],'include':[{'model':db[_0x486c('0x88')],'as':_0x486c('0x88'),'attributes':['id',_0x486c('0x89'),_0x486c('0x8a')]}]})[_0x486c('0xd')](handleEntityNotFound(_0x5f16c4,null))['then'](function(_0x105e1c){if(_0x105e1c){if(_0x105e1c['modernAuthentication']){_0x105e1c[_0x486c('0x8b')]=_0x105e1c[_0x486c('0x88')][_0x486c('0x89')];_0x502f79=sanitizeRemoteUri(_0x105e1c[_0x486c('0x88')][_0x486c('0x8a')]);_0x3bf453=getWebApiUrl(_0x502f79);return _0x105e1c;}_0x502f79=sanitizeRemoteUri(_0x105e1c[_0x486c('0x85')]);_0x3bf453=getWebApiUrl(_0x502f79);var _0x37cce0={'method':'POST','uri':_0x486c('0x8c')+_0x105e1c[_0x486c('0x8d')]+'/oauth2/token','form':{'client_id':_0x105e1c[_0x486c('0x86')],'resource':_0x502f79,'username':_0x105e1c[_0x486c('0x83')],'password':_0x105e1c['password'],'grant_type':_0x486c('0x84'),'client_secret':_0x105e1c[_0x486c('0x8e')]},'json':!![]};return rp(_0x37cce0);}})[_0x486c('0xd')](function(_0x36907c){_0x32259a=_0x36907c[_0x486c('0x8b')];var _0x5b34aa={'method':'GET','uri':encodeURI(_0x3bf453+_0x486c('0x8f')+_0x266d7c+'\x27'),'headers':{'Authorization':_0x486c('0x90')+_0x32259a,'If-None-Match':null,'OData-Version':_0x486c('0x91')},'json':!![]};return rp(_0x5b34aa);})['then'](function(_0x109d1a){var _0x338c46=_0x109d1a[_0x486c('0x92')][0x0];var _0xf24db5=_0x338c46[_0x486c('0x93')];var _0x3fd8de={'method':'GET','uri':_0x3bf453+_0x486c('0x94')+_0xf24db5+_0x486c('0x95'),'headers':{'Authorization':'Bearer\x20'+_0x32259a,'If-None-Match':null,'OData-Version':_0x486c('0x91')},'json':!![]};return rp(_0x3fd8de);})[_0x486c('0xd')](function(_0x36f024){_0x1bb899=_0x36f024;_0x6cc132=_0x1bb899[_0x486c('0x96')];_0x6cc132=_[_0x486c('0x97')](_0x6cc132,function(_0x4495c0){return!_0x554b8b[_0x486c('0x98')](_0x4495c0['LogicalName']);});var _0x21add9=[];var _0x1fc94e=[];_0x6cc132[_0x486c('0x99')](function(_0x32e4e6){if(_0x32e4e6['@odata.type']){var _0x5b777e=_0x32e4e6[_0x486c('0x9a')]['substring'](_0x32e4e6[_0x486c('0x9a')]['lastIndexOf']('.')+0x1);if(_0x5b777e==='PicklistAttributeMetadata'){_0x21add9['push'](getSelectList(_0x3bf453,_0x30246b,_0x1fc94e,_0x1bb899[_0x486c('0x93')],_0x32e4e6[_0x486c('0x93')],_0x32259a));}}});return Promise['all'](_0x21add9);})[_0x486c('0xd')](function(_0x59b2f7){_0xf2d5ca=_0x59b2f7[0x0];var _0x5a3a0d=[];var _0x567608=[];_0x6cc132[_0x486c('0x99')](function(_0x191485){if(!_[_0x486c('0x9b')](_0x191485[_0x486c('0x9a')])){var _0x5c328a=_0x191485[_0x486c('0x9a')][_0x486c('0x9c')](_0x191485[_0x486c('0x9a')][_0x486c('0x9d')]('.')+0x1);if(_0x5c328a==='BooleanAttributeMetadata'){_0x5a3a0d['push'](getBooleanList(_0x3bf453,_0x30246b,_0x567608,_0x1bb899[_0x486c('0x93')],_0x191485[_0x486c('0x93')],_0x32259a));}}});return Promise[_0x486c('0x9e')](_0x5a3a0d);})['then'](function(_0x5c19e7){_0x252118=_0x5c19e7[0x0];var _0x45191d=[];var _0x5a98dc=[];_0x6cc132[_0x486c('0x99')](function(_0x20dcfa){if(_0x20dcfa[_0x486c('0x9a')]){var _0x1d9bbe=_0x20dcfa[_0x486c('0x9a')][_0x486c('0x9c')](_0x20dcfa[_0x486c('0x9a')][_0x486c('0x9d')]('.')+0x1);if(_0x1d9bbe===_0x486c('0x9f')||_0x1d9bbe===_0x486c('0xa0')||_0x1d9bbe===_0x486c('0xa1')||_0x1d9bbe===_0x486c('0xa2')||_0x1d9bbe===_0x486c('0xa3')||_0x1d9bbe==='DateTimeAttributeMetadata'||_0x1d9bbe===_0x486c('0xa4')||_0x1d9bbe==='EntityNameAttributeMetadata'||_0x1d9bbe===_0x486c('0xa5')||_0x1d9bbe===_0x486c('0xa6')){_0x45191d[_0x486c('0xa7')](getInputList(_0x3bf453,_0x30246b,_0x1d9bbe,_0x5a98dc,_0x1bb899[_0x486c('0x93')],_0x20dcfa['MetadataId'],_0x32259a));}}});return Promise[_0x486c('0x9e')](_0x45191d);})['then'](function(_0x42748b){_0x4cc4b2=_0x42748b[0x0];var _0x57899e=_0xf2d5ca['concat'](_0x252118)[_0x486c('0x81')](_0x4cc4b2);var _0x43b522={'count':_0x57899e['length'],'rows':_0x57899e};return _0x43b522;})[_0x486c('0xd')](respondWithResult(_0x5f16c4,null))[_0x486c('0x2e')](function(_0x23b914){var _0x3651b6=_0x5b6c46[_0x486c('0x1b')][_0x486c('0xa8')]?0x1f4:_0x23b914['statusCode']||0x1f4;logger[_0x486c('0x11')](_0x23b914['stack']);delete _0x23b914[_0x486c('0x13')];if(_0x3651b6===0x191){_0x3651b6=0x190;}_0x5f16c4[_0x486c('0x5')](_0x3651b6)['send'](_0x5b6c46[_0x486c('0x1b')]['test']?{'message':_0x486c('0xa9'),'statusCode':_0x23b914[_0x486c('0xaa')]}:_0x23b914);});};function getSelectList(_0x3c37f9,_0x54b7bf,_0x16cf64,_0x221c85,_0x1d7a45,_0x22f41d){var _0x2bc81c={'method':_0x486c('0xab'),'uri':_0x3c37f9+_0x486c('0x94')+_0x221c85+_0x486c('0xac')+_0x1d7a45+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x486c('0xad'),'headers':{'Authorization':_0x486c('0x90')+_0x22f41d,'If-None-Match':null,'OData-Version':_0x486c('0x91')},'json':!![]};return rp(_0x2bc81c)[_0x486c('0xd')](function(_0xb4c2df){var _0x54fef9=[];var _0x304fc2=_0xb4c2df[_0x486c('0xae')][_0x486c('0xaf')];_0x304fc2[_0x486c('0x99')](function(_0x26dd2c){_0x54fef9[_0x486c('0xa7')]({'name':_0x26dd2c[_0x486c('0xb0')]['UserLocalizedLabel']['Label'],'value':String(_0x26dd2c['Value'])});});var _0x2046a9={'id':_0x54b7bf+'_'+_0xb4c2df[_0x486c('0xb1')],'name':_0xb4c2df[_0x486c('0xb2')][_0x486c('0xb3')][_0x486c('0xb0')],'custom':![],'options':_0x54fef9};_0x16cf64[_0x486c('0xa7')](_0x2046a9);return _0x16cf64;});}function getBooleanList(_0x4813fc,_0x260cdf,_0x4768f1,_0x286ce2,_0x3f9964,_0x10c9e2){var _0x52fafd={'method':_0x486c('0xab'),'uri':_0x4813fc+'EntityDefinitions('+_0x286ce2+')/Attributes('+_0x3f9964+_0x486c('0xb4'),'headers':{'Authorization':_0x486c('0x90')+_0x10c9e2,'If-None-Match':null,'OData-Version':_0x486c('0x91')},'json':!![]};return rp(_0x52fafd)[_0x486c('0xd')](function(_0x56b553){var _0x19cefd=[];_0x19cefd[_0x486c('0xa7')]({'name':_0x56b553[_0x486c('0xae')][_0x486c('0xb5')]['Label'][_0x486c('0xb3')][_0x486c('0xb0')],'value':_0x486c('0xb6')},{'name':_0x56b553[_0x486c('0xae')][_0x486c('0xb7')][_0x486c('0xb0')][_0x486c('0xb3')][_0x486c('0xb0')],'value':'false'});var _0xfd88ce={'id':_0x260cdf+'_'+_0x56b553['LogicalName'],'name':_0x56b553[_0x486c('0xb2')][_0x486c('0xb3')][_0x486c('0xb0')],'custom':![],'options':_0x19cefd};_0x4768f1[_0x486c('0xa7')](_0xfd88ce);return _0x4768f1;});}function getInputList(_0x4951a7,_0x242b85,_0x2daee6,_0x1cd13a,_0x26d4ab,_0x1e2410,_0x508e29){var _0x550317={'method':'GET','uri':_0x4951a7+'EntityDefinitions('+_0x26d4ab+_0x486c('0xac')+_0x1e2410+_0x486c('0xb8')+_0x2daee6+_0x486c('0xb9'),'headers':{'Authorization':_0x486c('0x90')+_0x508e29,'If-None-Match':null,'OData-Version':_0x486c('0x91')},'json':!![]};return rp(_0x550317)[_0x486c('0xd')](function(_0x4bf277){var _0xefc5e8={'id':_0x242b85+'_'+_0x4bf277[_0x486c('0xb1')],'name':_0x4bf277[_0x486c('0xb2')]['UserLocalizedLabel']?_0x4bf277[_0x486c('0xb2')]['UserLocalizedLabel'][_0x486c('0xb0')]:_0x4bf277['LogicalName'],'custom':![],'options':[]};_0x1cd13a['push'](_0xefc5e8);return _0x1cd13a;});} \ No newline at end of file +var _0xf51f=['forEach','@odata.type','PicklistAttributeMetadata','push','isNil','substring','BooleanAttributeMetadata','all','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','limit','undefined','count','status','set','update','destroy','then','end','sendStatus','error','stack','name','send','map','Dynamics365Account','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','description','customerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','tenantId','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','https://login.microsoftonline.com/','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName'];(function(_0x5365d5,_0x51aa66){var _0x1d3d0e=function(_0x3d1e01){while(--_0x3d1e01){_0x5365d5['push'](_0x5365d5['shift']());}};_0x1d3d0e(++_0x51aa66);}(_0xf51f,0x191));var _0xff51=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xf51f[_0x1778e1];return _0x2bc4c6;};'use strict';var rp=require('request-promise');var util=require(_0xff51('0x0'));var _=require(_0xff51('0x1'));var qs=require(_0xff51('0x2'));var logger=require(_0xff51('0x3'))(_0xff51('0x4'));var db=require(_0xff51('0x5'))['db'];var integrations=require(_0xff51('0x6'));function respondWithResult(_0x260b34,_0x231521){_0x231521=_0x231521||0xc8;return function(_0x19e2e3){if(_0x19e2e3){return _0x260b34['status'](_0x231521)[_0xff51('0x7')](_0x19e2e3);}};}function respondWithFilteredResult(_0x4ddd55,_0x2993eb){return function(_0x3f0a14){if(_0x3f0a14){var _0x3bacd7=typeof _0x2993eb[_0xff51('0x8')]==='undefined'&&typeof _0x2993eb[_0xff51('0x9')]===_0xff51('0xa');var _0x222cb7=_0x3f0a14[_0xff51('0xb')];var _0x537a14=_0x3bacd7?0x0:_0x2993eb['offset'];var _0x46a726=_0x3bacd7?_0x3f0a14[_0xff51('0xb')]:_0x2993eb[_0xff51('0x8')]+_0x2993eb[_0xff51('0x9')];var _0x4b85d5;if(_0x46a726>=_0x222cb7){_0x46a726=_0x222cb7;_0x4b85d5=0xc8;}else{_0x4b85d5=0xce;}_0x4ddd55[_0xff51('0xc')](_0x4b85d5);return _0x4ddd55[_0xff51('0xd')]('Content-Range',_0x537a14+'-'+_0x46a726+'/'+_0x222cb7)['json'](_0x3f0a14);}return null;};}function saveUpdates(_0x51cd97){return function(_0x45be2e){if(_0x45be2e){return _0x45be2e[_0xff51('0xe')](_0x51cd97)['then'](function(_0x26d074){return _0x26d074;});}return null;};}function removeEntity(_0x47ae41){return function(_0x4f26c8){if(_0x4f26c8){return _0x4f26c8[_0xff51('0xf')]()[_0xff51('0x10')](function(){_0x47ae41[_0xff51('0xc')](0xcc)[_0xff51('0x11')]();});}};}function handleEntityNotFound(_0x414082){return function(_0x39a677){if(!_0x39a677){_0x414082[_0xff51('0x12')](0x194);}return _0x39a677;};}function handleError(_0xe41cf,_0x41dcec){_0x41dcec=_0x41dcec||0x1f4;return function(_0x1cc92f){logger[_0xff51('0x13')](_0x1cc92f[_0xff51('0x14')]);if(_0x1cc92f[_0xff51('0x15')]){delete _0x1cc92f[_0xff51('0x15')];}_0xe41cf[_0xff51('0xc')](_0x41dcec)[_0xff51('0x16')](_0x1cc92f);};}exports['index']=function(_0x3dbede,_0x301eae){var _0x248100={},_0x14b369={},_0x1799db={'count':0x0,'rows':[]};var _0x2d38a1=_[_0xff51('0x17')](db[_0xff51('0x18')]['rawAttributes'],function(_0x42c6b5){return{'name':_0x42c6b5[_0xff51('0x19')],'type':_0x42c6b5[_0xff51('0x1a')]['key']};});_0x14b369[_0xff51('0x1b')]=_[_0xff51('0x17')](_0x2d38a1,_0xff51('0x15'));_0x14b369[_0xff51('0x1c')]=_[_0xff51('0x1d')](_0x3dbede[_0xff51('0x1c')]);_0x14b369[_0xff51('0x1e')]=_[_0xff51('0x1f')](_0x14b369[_0xff51('0x1b')],_0x14b369[_0xff51('0x1c')]);_0x248100[_0xff51('0x20')]=_[_0xff51('0x1f')](_0x14b369[_0xff51('0x1b')],qs['fields'](_0x3dbede['query'][_0xff51('0x21')]));_0x248100[_0xff51('0x20')]=_0x248100[_0xff51('0x20')][_0xff51('0x22')]?_0x248100[_0xff51('0x20')]:_0x14b369[_0xff51('0x1b')];if(!_0x3dbede[_0xff51('0x1c')][_0xff51('0x23')](_0xff51('0x24'))){_0x248100[_0xff51('0x9')]=qs[_0xff51('0x9')](_0x3dbede[_0xff51('0x1c')]['limit']);_0x248100[_0xff51('0x8')]=qs[_0xff51('0x8')](_0x3dbede[_0xff51('0x1c')][_0xff51('0x8')]);}_0x248100[_0xff51('0x25')]=qs[_0xff51('0x26')](_0x3dbede['query'][_0xff51('0x26')]);_0x248100[_0xff51('0x27')]=qs[_0xff51('0x1e')](_[_0xff51('0x28')](_0x3dbede[_0xff51('0x1c')],_0x14b369[_0xff51('0x1e')]),_0x2d38a1);if(_0x3dbede[_0xff51('0x1c')][_0xff51('0x29')]){_0x248100[_0xff51('0x27')]=_['merge'](_0x248100[_0xff51('0x27')],{'$or':_[_0xff51('0x17')](_0x2d38a1,function(_0xa0858e){if(_0xa0858e['type']!==_0xff51('0x2a')){var _0x245f75={};_0x245f75[_0xa0858e[_0xff51('0x15')]]={'$like':'%'+_0x3dbede['query'][_0xff51('0x29')]+'%'};return _0x245f75;}})});}_0x248100=_[_0xff51('0x2b')]({},_0x248100,_0x3dbede[_0xff51('0x2c')]);var _0x11b560={'where':_0x248100['where']};return db[_0xff51('0x18')][_0xff51('0xb')](_0x11b560)[_0xff51('0x10')](function(_0x4c2c05){_0x1799db[_0xff51('0xb')]=_0x4c2c05;if(_0x3dbede[_0xff51('0x1c')][_0xff51('0x2d')]){_0x248100['include']=[{'all':!![]}];}return db[_0xff51('0x18')][_0xff51('0x2e')](_0x248100);})[_0xff51('0x10')](function(_0x799d5f){_0x1799db[_0xff51('0x2f')]=_0x799d5f;return _0x1799db;})[_0xff51('0x10')](respondWithFilteredResult(_0x301eae,_0x248100))[_0xff51('0x30')](handleError(_0x301eae,null));};exports[_0xff51('0x31')]=function(_0x55407d,_0x3d9f6b){var _0x482d9b={'raw':![],'where':{'id':_0x55407d['params']['id']}},_0x7d558c={};_0x7d558c[_0xff51('0x1b')]=_['keys'](db[_0xff51('0x18')][_0xff51('0x32')]);_0x7d558c[_0xff51('0x1c')]=_[_0xff51('0x1d')](_0x55407d[_0xff51('0x1c')]);_0x7d558c[_0xff51('0x1e')]=_['intersection'](_0x7d558c[_0xff51('0x1b')],_0x7d558c['query']);_0x482d9b[_0xff51('0x20')]=_['intersection'](_0x7d558c[_0xff51('0x1b')],qs[_0xff51('0x21')](_0x55407d[_0xff51('0x1c')][_0xff51('0x21')]));_0x482d9b['attributes']=_0x482d9b['attributes'][_0xff51('0x22')]?_0x482d9b[_0xff51('0x20')]:_0x7d558c[_0xff51('0x1b')];if(_0x55407d['query'][_0xff51('0x2d')]){_0x482d9b[_0xff51('0x33')]=[{'all':!![]}];}_0x482d9b=_[_0xff51('0x2b')]({},_0x482d9b,_0x55407d[_0xff51('0x2c')]);return db['Dynamics365Account'][_0xff51('0x34')](_0x482d9b)['then'](handleEntityNotFound(_0x3d9f6b,null))['then'](respondWithResult(_0x3d9f6b,null))[_0xff51('0x30')](handleError(_0x3d9f6b,null));};exports[_0xff51('0x35')]=function(_0x118959,_0x49b8e3){return db[_0xff51('0x18')][_0xff51('0x35')](_0x118959[_0xff51('0x36')],{})[_0xff51('0x10')](respondWithResult(_0x49b8e3,0xc9))[_0xff51('0x30')](handleError(_0x49b8e3,null));};exports[_0xff51('0xe')]=function(_0x5b5851,_0x129ca1){if(_0x5b5851[_0xff51('0x36')]['id']){delete _0x5b5851[_0xff51('0x36')]['id'];}return db[_0xff51('0x18')][_0xff51('0x34')]({'where':{'id':_0x5b5851[_0xff51('0x37')]['id']}})[_0xff51('0x10')](handleEntityNotFound(_0x129ca1,null))[_0xff51('0x10')](saveUpdates(_0x5b5851[_0xff51('0x36')],null))[_0xff51('0x10')](respondWithResult(_0x129ca1,null))[_0xff51('0x30')](handleError(_0x129ca1,null));};exports[_0xff51('0xf')]=function(_0x609e8c,_0x969772){return db[_0xff51('0x18')]['find']({'where':{'id':_0x609e8c[_0xff51('0x37')]['id']}})['then'](handleEntityNotFound(_0x969772,null))['then'](removeEntity(_0x969772,null))[_0xff51('0x30')](handleError(_0x969772,null));};exports[_0xff51('0x38')]=function(_0x5ef6db,_0x11a1d5){var _0x39fe71={};var _0x53a4d1={};var _0x36b2ed;var _0x2be1d4;return db[_0xff51('0x18')]['findOne']({'where':{'id':_0x5ef6db[_0xff51('0x37')]['id']}})[_0xff51('0x10')](handleEntityNotFound(_0x11a1d5,null))[_0xff51('0x10')](function(_0x3edf6b){if(_0x3edf6b){_0x36b2ed=_0x3edf6b;_0x53a4d1[_0xff51('0x1b')]=_[_0xff51('0x1d')](db[_0xff51('0x39')][_0xff51('0x32')]);_0x53a4d1[_0xff51('0x1c')]=_[_0xff51('0x1d')](_0x5ef6db['query']);_0x53a4d1[_0xff51('0x1e')]=_[_0xff51('0x1f')](_0x53a4d1[_0xff51('0x1b')],_0x53a4d1['query']);_0x39fe71[_0xff51('0x20')]=_[_0xff51('0x1f')](_0x53a4d1[_0xff51('0x1b')],qs['fields'](_0x5ef6db['query']['fields']));_0x39fe71[_0xff51('0x20')]=_0x39fe71[_0xff51('0x20')][_0xff51('0x22')]?_0x39fe71[_0xff51('0x20')]:_0x53a4d1[_0xff51('0x1b')];_0x39fe71[_0xff51('0x25')]=qs[_0xff51('0x26')](_0x5ef6db[_0xff51('0x1c')][_0xff51('0x26')]);_0x39fe71['where']=qs[_0xff51('0x1e')](_[_0xff51('0x28')](_0x5ef6db['query'],_0x53a4d1['filters']));if(_0x5ef6db[_0xff51('0x1c')][_0xff51('0x29')]){_0x39fe71['where']=_[_0xff51('0x2b')](_0x39fe71[_0xff51('0x27')],{'$or':_[_0xff51('0x17')](_0x39fe71['attributes'],function(_0x2cde32){var _0x2acf49={};_0x2acf49[_0x2cde32]={'$like':'%'+_0x5ef6db[_0xff51('0x1c')][_0xff51('0x29')]+'%'};return _0x2acf49;})});}_0x39fe71=_[_0xff51('0x2b')]({},_0x39fe71,_0x5ef6db['options']);return _0x36b2ed[_0xff51('0x38')](_0x39fe71);}})[_0xff51('0x10')](function(_0x4a0f80){if(_0x4a0f80){_0x2be1d4=_0x4a0f80[_0xff51('0x22')];if(!_0x5ef6db[_0xff51('0x1c')][_0xff51('0x23')](_0xff51('0x24'))){_0x39fe71[_0xff51('0x9')]=qs[_0xff51('0x9')](_0x5ef6db[_0xff51('0x1c')][_0xff51('0x9')]);_0x39fe71[_0xff51('0x8')]=qs['offset'](_0x5ef6db[_0xff51('0x1c')][_0xff51('0x8')]);}return _0x36b2ed[_0xff51('0x38')](_0x39fe71);}})[_0xff51('0x10')](function(_0x158e8d){if(_0x158e8d){return _0x158e8d?{'count':_0x2be1d4,'rows':_0x158e8d}:null;}})[_0xff51('0x10')](respondWithResult(_0x11a1d5,null))[_0xff51('0x30')](handleError(_0x11a1d5,null));};exports[_0xff51('0x3a')]=function(_0x5c5780,_0x3824f4){if(_0x5c5780[_0xff51('0x36')]['id']){delete _0x5c5780[_0xff51('0x36')]['id'];}return db[_0xff51('0x18')][_0xff51('0x3b')]({'where':{'id':_0x5c5780[_0xff51('0x37')]['id']}})[_0xff51('0x10')](handleEntityNotFound(_0x3824f4,null))[_0xff51('0x10')](function(_0x287d9e){if(_0x287d9e){_0x5c5780[_0xff51('0x36')][_0xff51('0x3c')]=_0x287d9e['id'];_0x5c5780[_0xff51('0x36')][_0xff51('0x3d')]=integrations[_0xff51('0x3e')](_0x5c5780[_0xff51('0x36')]['channel'],_0x5c5780[_0xff51('0x36')][_0xff51('0x1a')]);_0x5c5780[_0xff51('0x36')][_0xff51('0x3f')]=integrations[_0xff51('0x40')](_0x5c5780['body'][_0xff51('0x41')],_0x5c5780[_0xff51('0x36')][_0xff51('0x1a')]);return db['Dynamics365Configuration'][_0xff51('0x35')](_0x5c5780[_0xff51('0x36')],{'include':[{'model':db[_0xff51('0x42')],'as':_0xff51('0x3d')},{'model':db[_0xff51('0x42')],'as':_0xff51('0x3f')}]});}return null;})[_0xff51('0x10')](respondWithResult(_0x3824f4,null))[_0xff51('0x30')](handleError(_0x3824f4,null));};function sanitizeRemoteUri(_0x523cb8){var _0x3c2634=_0x523cb8['slice'](-0x1);if(_0x3c2634==='/')return _0x523cb8['substring'](0x0,_0x523cb8[_0xff51('0x43')](_0x3c2634));return _0x523cb8;}function getWebApiUrl(_0x6fc1d8){return util[_0xff51('0x44')](_0xff51('0x45'),_0x6fc1d8);}exports[_0xff51('0x46')]=function(_0xad2858,_0x3571cc){var _0x44540a=_0xad2858[_0xff51('0x1c')]['ticketType'];var _0x62acf5=_0x44540a===_0xff51('0x47')?_0xff51('0x48'):_0xff51('0x49');var _0x4dff66='';var _0x42a00f='';var _0x2546a3='';var _0x148800='';var _0x5cacce='';var _0x397bb5='';var _0x576bf6='';var _0x521805='';var _0x49e5ac=[_0xff51('0x4a'),_0xff51('0x4b'),_0xff51('0x4c'),'ownerid','caseorigincode',_0xff51('0x4d'),_0xff51('0x4e'),_0xff51('0x4f'),_0xff51('0x50'),_0xff51('0x51')];var _0x510e5c=[_0xff51('0x52'),_0xff51('0x53'),'actualserviceunits',_0xff51('0x54'),_0xff51('0x55'),'contactidyominame','contractdetailidname',_0xff51('0x56'),_0xff51('0x57'),_0xff51('0x58'),_0xff51('0x59'),_0xff51('0x5a'),_0xff51('0x5b'),'createdonbehalfbyname','createdonbehalfbyyominame',_0xff51('0x5c'),_0xff51('0x5d'),_0xff51('0x5e'),'emailaddress',_0xff51('0x5f'),_0xff51('0x60'),'entityimage_url','escalatedon',_0xff51('0x61'),_0xff51('0x62'),_0xff51('0x63'),_0xff51('0x64'),'influencescore','kbarticleidname',_0xff51('0x65'),_0xff51('0x66'),_0xff51('0x67'),_0xff51('0x68'),'modifiedbyname','modifiedbyyominame',_0xff51('0x69'),_0xff51('0x6a'),_0xff51('0x6b'),_0xff51('0x6c'),_0xff51('0x6d'),_0xff51('0x6e'),'onholdtime',_0xff51('0x6f'),_0xff51('0x70'),_0xff51('0x71'),_0xff51('0x72'),'parentcaseidname',_0xff51('0x73'),_0xff51('0x74'),_0xff51('0x75'),'productidname','productserialnumber','resolveby',_0xff51('0x76'),_0xff51('0x77'),_0xff51('0x78'),_0xff51('0x79'),_0xff51('0x7a'),_0xff51('0x7b'),_0xff51('0x7c'),_0xff51('0x7d'),'statecode',_0xff51('0x7e'),'subjectidname',_0xff51('0x7f'),_0xff51('0x80'),'transactioncurrencyidname',_0xff51('0x81'),_0xff51('0x82'),_0xff51('0x83')];var _0x30f89f=_0x49e5ac[_0xff51('0x84')](_0x510e5c);return db['Dynamics365Account'][_0xff51('0x3b')]({'where':{'id':_0xad2858[_0xff51('0x37')]['id']},'attributes':['id','username',_0xff51('0x85'),'remoteUri',_0xff51('0x86'),_0xff51('0x87'),_0xff51('0x88'),'modernAuthentication'],'include':[{'model':db[_0xff51('0x89')],'as':_0xff51('0x89'),'attributes':['id',_0xff51('0x8a'),_0xff51('0x8b')]}]})[_0xff51('0x10')](handleEntityNotFound(_0x3571cc,null))[_0xff51('0x10')](function(_0x233e1c){if(_0x233e1c){if(_0x233e1c[_0xff51('0x8c')]){_0x233e1c[_0xff51('0x8d')]=_0x233e1c[_0xff51('0x89')][_0xff51('0x8a')];_0x521805=sanitizeRemoteUri(_0x233e1c[_0xff51('0x89')][_0xff51('0x8b')]);_0x576bf6=getWebApiUrl(_0x521805);return _0x233e1c;}_0x521805=sanitizeRemoteUri(_0x233e1c['remoteUri']);_0x576bf6=getWebApiUrl(_0x521805);var _0x423443={'method':'POST','uri':_0xff51('0x8e')+_0x233e1c['tenantId']+'/oauth2/token','form':{'client_id':_0x233e1c['clientId'],'resource':_0x521805,'username':_0x233e1c[_0xff51('0x8f')],'password':_0x233e1c[_0xff51('0x85')],'grant_type':_0xff51('0x85'),'client_secret':_0x233e1c[_0xff51('0x88')]},'json':!![]};return rp(_0x423443);}})[_0xff51('0x10')](function(_0x21bc6f){_0x397bb5=_0x21bc6f[_0xff51('0x8d')];var _0x169185={'method':_0xff51('0x90'),'uri':encodeURI(_0x576bf6+_0xff51('0x91')+_0x62acf5+'\x27'),'headers':{'Authorization':_0xff51('0x92')+_0x397bb5,'If-None-Match':null,'OData-Version':_0xff51('0x93')},'json':!![]};return rp(_0x169185);})[_0xff51('0x10')](function(_0x527d03){var _0x53c5ed=_0x527d03[_0xff51('0x94')][0x0];var _0x207a91=_0x53c5ed[_0xff51('0x95')];var _0x1499ae={'method':_0xff51('0x90'),'uri':_0x576bf6+_0xff51('0x96')+_0x207a91+_0xff51('0x97'),'headers':{'Authorization':_0xff51('0x92')+_0x397bb5,'If-None-Match':null,'OData-Version':_0xff51('0x93')},'json':!![]};return rp(_0x1499ae);})[_0xff51('0x10')](function(_0x59cf34){_0x4dff66=_0x59cf34;_0x42a00f=_0x4dff66['Attributes'];_0x42a00f=_['remove'](_0x42a00f,function(_0x28f703){return!_0x30f89f[_0xff51('0x98')](_0x28f703[_0xff51('0x99')]);});var _0x583d22=[];var _0x5d7790=[];_0x42a00f[_0xff51('0x9a')](function(_0x207672){if(_0x207672[_0xff51('0x9b')]){var _0x3e37fe=_0x207672[_0xff51('0x9b')]['substring'](_0x207672['@odata.type'][_0xff51('0x43')]('.')+0x1);if(_0x3e37fe===_0xff51('0x9c')){_0x583d22[_0xff51('0x9d')](getSelectList(_0x576bf6,_0x44540a,_0x5d7790,_0x4dff66['MetadataId'],_0x207672[_0xff51('0x95')],_0x397bb5));}}});return Promise['all'](_0x583d22);})[_0xff51('0x10')](function(_0x14b349){_0x2546a3=_0x14b349[0x0];var _0x257540=[];var _0x3d2ff4=[];_0x42a00f[_0xff51('0x9a')](function(_0x367856){if(!_[_0xff51('0x9e')](_0x367856[_0xff51('0x9b')])){var _0x251105=_0x367856[_0xff51('0x9b')][_0xff51('0x9f')](_0x367856[_0xff51('0x9b')][_0xff51('0x43')]('.')+0x1);if(_0x251105===_0xff51('0xa0')){_0x257540[_0xff51('0x9d')](getBooleanList(_0x576bf6,_0x44540a,_0x3d2ff4,_0x4dff66[_0xff51('0x95')],_0x367856[_0xff51('0x95')],_0x397bb5));}}});return Promise[_0xff51('0xa1')](_0x257540);})[_0xff51('0x10')](function(_0x49f27e){_0x148800=_0x49f27e[0x0];var _0x33a243=[];var _0x5253f5=[];_0x42a00f[_0xff51('0x9a')](function(_0x2ac9a0){if(_0x2ac9a0[_0xff51('0x9b')]){var _0x28cedb=_0x2ac9a0[_0xff51('0x9b')]['substring'](_0x2ac9a0[_0xff51('0x9b')][_0xff51('0x43')]('.')+0x1);if(_0x28cedb==='StringAttributeMetadata'||_0x28cedb==='DoubleAttributeMetadata'||_0x28cedb===_0xff51('0xa2')||_0x28cedb===_0xff51('0xa3')||_0x28cedb===_0xff51('0xa4')||_0x28cedb===_0xff51('0xa5')||_0x28cedb===_0xff51('0xa6')||_0x28cedb===_0xff51('0xa7')||_0x28cedb===_0xff51('0xa8')||_0x28cedb==='DecimalAttributeMetadata'){_0x33a243[_0xff51('0x9d')](getInputList(_0x576bf6,_0x44540a,_0x28cedb,_0x5253f5,_0x4dff66[_0xff51('0x95')],_0x2ac9a0[_0xff51('0x95')],_0x397bb5));}}});return Promise['all'](_0x33a243);})[_0xff51('0x10')](function(_0x4190a2){_0x5cacce=_0x4190a2[0x0];var _0x152f65=_0x2546a3['concat'](_0x148800)[_0xff51('0x84')](_0x5cacce);var _0x56386a={'count':_0x152f65[_0xff51('0x22')],'rows':_0x152f65};return _0x56386a;})[_0xff51('0x10')](respondWithResult(_0x3571cc,null))[_0xff51('0x30')](function(_0x15f4be){var _0x2217db=_0xad2858[_0xff51('0x1c')][_0xff51('0xa9')]?0x1f4:_0x15f4be[_0xff51('0xaa')]||0x1f4;logger['error'](_0x15f4be[_0xff51('0x14')]);delete _0x15f4be[_0xff51('0x15')];if(_0x2217db===0x191){_0x2217db=0x190;}_0x3571cc['status'](_0x2217db)[_0xff51('0x16')](_0xad2858['query'][_0xff51('0xa9')]?{'message':_0xff51('0xab'),'statusCode':_0x15f4be[_0xff51('0xaa')]}:_0x15f4be);});};function getSelectList(_0x235cb0,_0x15ab73,_0x5315e8,_0x5566b2,_0x36ac4c,_0x300160){var _0x3cd92e={'method':_0xff51('0x90'),'uri':_0x235cb0+_0xff51('0x96')+_0x5566b2+')/Attributes('+_0x36ac4c+_0xff51('0xac')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x300160,'If-None-Match':null,'OData-Version':_0xff51('0x93')},'json':!![]};return rp(_0x3cd92e)[_0xff51('0x10')](function(_0x2b7d5a){var _0x3270e8=[];var _0x2b6d9e=_0x2b7d5a[_0xff51('0xad')]['Options'];_0x2b6d9e[_0xff51('0x9a')](function(_0x9a31b3){_0x3270e8[_0xff51('0x9d')]({'name':_0x9a31b3[_0xff51('0xae')]['UserLocalizedLabel'][_0xff51('0xae')],'value':String(_0x9a31b3['Value'])});});var _0x4be87b={'id':_0x15ab73+'_'+_0x2b7d5a[_0xff51('0x99')],'name':_0x2b7d5a[_0xff51('0xaf')][_0xff51('0xb0')]['Label'],'custom':![],'options':_0x3270e8};_0x5315e8[_0xff51('0x9d')](_0x4be87b);return _0x5315e8;});}function getBooleanList(_0x13c3e0,_0x1f03fe,_0x1454c7,_0x299731,_0x3fd0a5,_0x39e62e){var _0x1d3151={'method':'GET','uri':_0x13c3e0+_0xff51('0x96')+_0x299731+_0xff51('0xb1')+_0x3fd0a5+_0xff51('0xb2'),'headers':{'Authorization':_0xff51('0x92')+_0x39e62e,'If-None-Match':null,'OData-Version':_0xff51('0x93')},'json':!![]};return rp(_0x1d3151)[_0xff51('0x10')](function(_0x241e75){var _0x23aa63=[];_0x23aa63[_0xff51('0x9d')]({'name':_0x241e75[_0xff51('0xad')][_0xff51('0xb3')][_0xff51('0xae')][_0xff51('0xb0')][_0xff51('0xae')],'value':_0xff51('0xb4')},{'name':_0x241e75[_0xff51('0xad')][_0xff51('0xb5')][_0xff51('0xae')][_0xff51('0xb0')][_0xff51('0xae')],'value':_0xff51('0xb6')});var _0x4b53ca={'id':_0x1f03fe+'_'+_0x241e75['LogicalName'],'name':_0x241e75[_0xff51('0xaf')][_0xff51('0xb0')][_0xff51('0xae')],'custom':![],'options':_0x23aa63};_0x1454c7[_0xff51('0x9d')](_0x4b53ca);return _0x1454c7;});}function getInputList(_0xe44964,_0x4a3d23,_0x7b52da,_0x64ede3,_0x2a207c,_0x44f3d2,_0x3896cd){var _0x5311eb={'method':'GET','uri':_0xe44964+_0xff51('0x96')+_0x2a207c+_0xff51('0xb1')+_0x44f3d2+_0xff51('0xb7')+_0x7b52da+_0xff51('0xb8'),'headers':{'Authorization':_0xff51('0x92')+_0x3896cd,'If-None-Match':null,'OData-Version':_0xff51('0x93')},'json':!![]};return rp(_0x5311eb)[_0xff51('0x10')](function(_0x6e82dc){var _0x18f733={'id':_0x4a3d23+'_'+_0x6e82dc[_0xff51('0x99')],'name':_0x6e82dc[_0xff51('0xaf')][_0xff51('0xb0')]?_0x6e82dc[_0xff51('0xaf')][_0xff51('0xb0')][_0xff51('0xae')]:_0x6e82dc[_0xff51('0x99')],'custom':![],'options':[]};_0x64ede3['push'](_0x18f733);return _0x64ede3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 701340c..103cc3f 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x56efed,_0x4f23b0){var _0xdf9119=function(_0x3e9f78){while(--_0x3e9f78){_0x56efed['push'](_0x56efed['shift']());}};_0xdf9119(++_0x4f23b0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x5c8a8f,_0x21287f){var _0x576e6b=function(_0x16ea59){while(--_0x16ea59){_0x5c8a8f['push'](_0x5c8a8f['shift']());}};_0x576e6b(++_0x21287f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xcb91[_0x1ee62e];return _0x27c6c8;};'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'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ee30bd7..43cbfd9 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 _0x0a65=['GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','Dynamics365Account','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0xe5e2b2,_0x97671){var _0x34ae7a=function(_0x564833){while(--_0x564833){_0xe5e2b2['push'](_0xe5e2b2['shift']());}};_0x34ae7a(++_0x97671);}(_0x0a65,0x1a4));var _0x50a6=function(_0x2969f0,_0x57916c){_0x2969f0=_0x2969f0-0x0;var _0x3c55fa=_0x0a65[_0x2969f0];return _0x3c55fa;};'use strict';var _=require(_0x50a6('0x0'));var util=require('util');var moment=require(_0x50a6('0x1'));var BPromise=require(_0x50a6('0x2'));var rs=require(_0x50a6('0x3'));var fs=require('fs');var Redis=require(_0x50a6('0x4'));var db=require(_0x50a6('0x5'))['db'];var utils=require(_0x50a6('0x6'));var logger=require('../../config/logger')(_0x50a6('0x7'));var config=require(_0x50a6('0x8'));var jayson=require(_0x50a6('0x9'));var client=jayson[_0x50a6('0xa')][_0x50a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d97df,_0xac9021,_0x4610b2){return new BPromise(function(_0x269663,_0x54a828){return client[_0x50a6('0xc')](_0x3d97df,_0x4610b2)[_0x50a6('0xd')](function(_0x4931f6){logger[_0x50a6('0xe')](_0x50a6('0xf'),_0xac9021,'request\x20sent');logger[_0x50a6('0x10')](_0x50a6('0x11'),_0xac9021,_0x50a6('0x12'),JSON[_0x50a6('0x13')](_0x4931f6));if(_0x4931f6[_0x50a6('0x14')]){if(_0x4931f6[_0x50a6('0x14')][_0x50a6('0x15')]===0x1f4){logger[_0x50a6('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0xac9021,_0x4931f6['error'][_0x50a6('0x16')]);return _0x54a828(_0x4931f6[_0x50a6('0x14')][_0x50a6('0x16')]);}logger[_0x50a6('0x14')](_0x50a6('0xf'),_0xac9021,_0x4931f6[_0x50a6('0x14')][_0x50a6('0x16')]);return _0x269663(_0x4931f6[_0x50a6('0x14')][_0x50a6('0x16')]);}else{logger[_0x50a6('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0xac9021,_0x50a6('0x12'));_0x269663(_0x4931f6['result'][_0x50a6('0x16')]);}})[_0x50a6('0x17')](function(_0x44c53e){logger['error'](_0x50a6('0xf'),_0xac9021,_0x44c53e);_0x54a828(_0x44c53e);});});}exports[_0x50a6('0x18')]=function(_0xe464b3){var _0x5a4508=this;return new Promise(function(_0x1929bd,_0xaa7b85){return db['Dynamics365Account'][_0x50a6('0x19')]({'raw':_0xe464b3['options']?_0xe464b3[_0x50a6('0x1a')][_0x50a6('0x1b')]===undefined?!![]:![]:!![],'where':_0xe464b3[_0x50a6('0x1a')]?_0xe464b3[_0x50a6('0x1a')][_0x50a6('0x1c')]||null:null,'attributes':_0xe464b3[_0x50a6('0x1a')]?_0xe464b3[_0x50a6('0x1a')][_0x50a6('0x1d')]||null:null,'limit':_0xe464b3['options']?_0xe464b3[_0x50a6('0x1a')][_0x50a6('0x1e')]||null:null,'include':_0xe464b3[_0x50a6('0x1a')]?_0xe464b3[_0x50a6('0x1a')][_0x50a6('0x1f')]?_[_0x50a6('0x20')](_0xe464b3['options'][_0x50a6('0x1f')],function(_0x3c4699){return{'model':db[_0x3c4699[_0x50a6('0x21')]],'as':_0x3c4699['as'],'attributes':_0x3c4699['attributes'],'include':_0x3c4699[_0x50a6('0x1f')]?_[_0x50a6('0x20')](_0x3c4699[_0x50a6('0x1f')],function(_0xac4dcb){return{'model':db[_0xac4dcb[_0x50a6('0x21')]],'as':_0xac4dcb['as'],'attributes':_0xac4dcb['attributes'],'include':_0xac4dcb[_0x50a6('0x1f')]?_[_0x50a6('0x20')](_0xac4dcb[_0x50a6('0x1f')],function(_0x5a2a32){return{'model':db[_0x5a2a32[_0x50a6('0x21')]],'as':_0x5a2a32['as'],'attributes':_0x5a2a32[_0x50a6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50a6('0xd')](function(_0x2eb17c){logger[_0x50a6('0xe')](_0x50a6('0x18'),_0xe464b3);logger[_0x50a6('0x10')](_0x50a6('0x18'),_0xe464b3,JSON[_0x50a6('0x13')](_0x2eb17c));_0x1929bd(_0x2eb17c);})[_0x50a6('0x17')](function(_0x2ebb51){logger[_0x50a6('0x14')](_0x50a6('0x18'),_0x2ebb51['message'],_0xe464b3);_0xaa7b85(_0x5a4508[_0x50a6('0x14')](0x1f4,_0x2ebb51[_0x50a6('0x16')]));});});};exports[_0x50a6('0x22')]=function(_0x6af724){var _0x84b882=this;return new Promise(function(_0x72ef21,_0x178ebc){return db[_0x50a6('0x23')][_0x50a6('0x24')]({'raw':_0x6af724['options']?_0x6af724[_0x50a6('0x1a')][_0x50a6('0x1b')]===undefined?!![]:![]:!![],'where':_0x6af724[_0x50a6('0x1a')]?_0x6af724[_0x50a6('0x1a')][_0x50a6('0x1c')]||null:null,'attributes':_0x6af724['options']?_0x6af724[_0x50a6('0x1a')][_0x50a6('0x1d')]||null:null,'include':_0x6af724[_0x50a6('0x1a')]?_0x6af724[_0x50a6('0x1a')]['include']?_[_0x50a6('0x20')](_0x6af724[_0x50a6('0x1a')][_0x50a6('0x1f')],function(_0x215f53){return{'model':db[_0x215f53[_0x50a6('0x21')]],'as':_0x215f53['as'],'attributes':_0x215f53[_0x50a6('0x1d')],'include':_0x215f53[_0x50a6('0x1f')]?_['map'](_0x215f53['include'],function(_0x4b80b0){return{'model':db[_0x4b80b0[_0x50a6('0x21')]],'as':_0x4b80b0['as'],'attributes':_0x4b80b0['attributes'],'include':_0x4b80b0['include']?_[_0x50a6('0x20')](_0x4b80b0['include'],function(_0xf52431){return{'model':db[_0xf52431[_0x50a6('0x21')]],'as':_0xf52431['as'],'attributes':_0xf52431['attributes']};}):[]};}):[]};}):[]:[]})[_0x50a6('0xd')](function(_0xf9e65c){logger[_0x50a6('0xe')](_0x50a6('0x22'),_0x6af724);logger[_0x50a6('0x10')]('ShowDynamics365Account',_0x6af724,JSON[_0x50a6('0x13')](_0xf9e65c));_0x72ef21(_0xf9e65c);})['catch'](function(_0x51bd69){logger['error'](_0x50a6('0x22'),_0x51bd69[_0x50a6('0x16')],_0x6af724);_0x178ebc(_0x84b882[_0x50a6('0x14')](0x1f4,_0x51bd69['message']));});});}; \ No newline at end of file +var _0x84bf=['info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x20b1e4,_0x431b17){var _0x272d88=function(_0x5c2329){while(--_0x5c2329){_0x20b1e4['push'](_0x20b1e4['shift']());}};_0x272d88(++_0x431b17);}(_0x84bf,0xc5));var _0xf84b=function(_0x386e5b,_0xc53ad){_0x386e5b=_0x386e5b-0x0;var _0x4274b4=_0x84bf[_0x386e5b];return _0x4274b4;};'use strict';var _=require(_0xf84b('0x0'));var util=require(_0xf84b('0x1'));var moment=require('moment');var BPromise=require(_0xf84b('0x2'));var rs=require(_0xf84b('0x3'));var fs=require('fs');var Redis=require(_0xf84b('0x4'));var db=require(_0xf84b('0x5'))['db'];var utils=require(_0xf84b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf84b('0x7'));var jayson=require(_0xf84b('0x8'));var client=jayson[_0xf84b('0x9')][_0xf84b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b71b6,_0x528ff7,_0xf32198){return new BPromise(function(_0x345f91,_0x49af02){return client[_0xf84b('0xb')](_0x2b71b6,_0xf32198)[_0xf84b('0xc')](function(_0x1cb7cb){logger[_0xf84b('0xd')](_0xf84b('0xe'),_0x528ff7,'request\x20sent');logger[_0xf84b('0xf')](_0xf84b('0x10'),_0x528ff7,_0xf84b('0x11'),JSON['stringify'](_0x1cb7cb));if(_0x1cb7cb[_0xf84b('0x12')]){if(_0x1cb7cb[_0xf84b('0x12')][_0xf84b('0x13')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x528ff7,_0x1cb7cb[_0xf84b('0x12')][_0xf84b('0x14')]);return _0x49af02(_0x1cb7cb[_0xf84b('0x12')][_0xf84b('0x14')]);}logger[_0xf84b('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x528ff7,_0x1cb7cb[_0xf84b('0x12')][_0xf84b('0x14')]);return _0x345f91(_0x1cb7cb[_0xf84b('0x12')][_0xf84b('0x14')]);}else{logger[_0xf84b('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x528ff7,_0xf84b('0x11'));_0x345f91(_0x1cb7cb[_0xf84b('0x15')]['message']);}})[_0xf84b('0x16')](function(_0x4040a5){logger[_0xf84b('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x528ff7,_0x4040a5);_0x49af02(_0x4040a5);});});}exports['GetDynamics365Account']=function(_0x233c04){var _0x552b23=this;return new Promise(function(_0x179f33,_0x458e24){return db[_0xf84b('0x17')][_0xf84b('0x18')]({'raw':_0x233c04[_0xf84b('0x19')]?_0x233c04['options']['raw']===undefined?!![]:![]:!![],'where':_0x233c04[_0xf84b('0x19')]?_0x233c04['options'][_0xf84b('0x1a')]||null:null,'attributes':_0x233c04[_0xf84b('0x19')]?_0x233c04[_0xf84b('0x19')][_0xf84b('0x1b')]||null:null,'limit':_0x233c04['options']?_0x233c04[_0xf84b('0x19')][_0xf84b('0x1c')]||null:null,'include':_0x233c04[_0xf84b('0x19')]?_0x233c04[_0xf84b('0x19')][_0xf84b('0x1d')]?_[_0xf84b('0x1e')](_0x233c04['options']['include'],function(_0x5a4cf5){return{'model':db[_0x5a4cf5[_0xf84b('0x1f')]],'as':_0x5a4cf5['as'],'attributes':_0x5a4cf5['attributes'],'include':_0x5a4cf5[_0xf84b('0x1d')]?_[_0xf84b('0x1e')](_0x5a4cf5[_0xf84b('0x1d')],function(_0x173b9d){return{'model':db[_0x173b9d[_0xf84b('0x1f')]],'as':_0x173b9d['as'],'attributes':_0x173b9d[_0xf84b('0x1b')],'include':_0x173b9d[_0xf84b('0x1d')]?_['map'](_0x173b9d[_0xf84b('0x1d')],function(_0x57fb81){return{'model':db[_0x57fb81['model']],'as':_0x57fb81['as'],'attributes':_0x57fb81[_0xf84b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf84b('0xc')](function(_0x8b471a){logger[_0xf84b('0xd')](_0xf84b('0x20'),_0x233c04);logger[_0xf84b('0xf')]('GetDynamics365Account',_0x233c04,JSON['stringify'](_0x8b471a));_0x179f33(_0x8b471a);})[_0xf84b('0x16')](function(_0x501d52){logger[_0xf84b('0x12')](_0xf84b('0x20'),_0x501d52[_0xf84b('0x14')],_0x233c04);_0x458e24(_0x552b23[_0xf84b('0x12')](0x1f4,_0x501d52[_0xf84b('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x471b55){var _0x4dc479=this;return new Promise(function(_0x13485c,_0x575706){return db[_0xf84b('0x17')]['find']({'raw':_0x471b55[_0xf84b('0x19')]?_0x471b55['options']['raw']===undefined?!![]:![]:!![],'where':_0x471b55[_0xf84b('0x19')]?_0x471b55[_0xf84b('0x19')][_0xf84b('0x1a')]||null:null,'attributes':_0x471b55[_0xf84b('0x19')]?_0x471b55['options'][_0xf84b('0x1b')]||null:null,'include':_0x471b55['options']?_0x471b55[_0xf84b('0x19')][_0xf84b('0x1d')]?_['map'](_0x471b55[_0xf84b('0x19')]['include'],function(_0x511d1e){return{'model':db[_0x511d1e[_0xf84b('0x1f')]],'as':_0x511d1e['as'],'attributes':_0x511d1e[_0xf84b('0x1b')],'include':_0x511d1e[_0xf84b('0x1d')]?_['map'](_0x511d1e[_0xf84b('0x1d')],function(_0x364c17){return{'model':db[_0x364c17['model']],'as':_0x364c17['as'],'attributes':_0x364c17[_0xf84b('0x1b')],'include':_0x364c17['include']?_['map'](_0x364c17[_0xf84b('0x1d')],function(_0x44cd42){return{'model':db[_0x44cd42[_0xf84b('0x1f')]],'as':_0x44cd42['as'],'attributes':_0x44cd42[_0xf84b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf84b('0xc')](function(_0x4032a0){logger[_0xf84b('0xd')](_0xf84b('0x21'),_0x471b55);logger[_0xf84b('0xf')](_0xf84b('0x21'),_0x471b55,JSON[_0xf84b('0x22')](_0x4032a0));_0x13485c(_0x4032a0);})['catch'](function(_0x5930dd){logger[_0xf84b('0x12')](_0xf84b('0x21'),_0x5930dd[_0xf84b('0x14')],_0x471b55);_0x575706(_0x4dc479['error'](0x1f4,_0x5930dd[_0xf84b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8d0e496..88d0257 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 _0x35c8=['get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated'];(function(_0x379494,_0x4fedff){var _0x1850d5=function(_0x15bb22){while(--_0x15bb22){_0x379494['push'](_0x379494['shift']());}};_0x1850d5(++_0x4fedff);}(_0x35c8,0xdc));var _0x835c=function(_0x142144,_0x54980d){_0x142144=_0x142144-0x0;var _0x151b52=_0x35c8[_0x142144];return _0x151b52;};'use strict';var multer=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var path=require(_0x835c('0x2'));var timeout=require(_0x835c('0x3'));var express=require(_0x835c('0x4'));var router=express['Router']();var fs_extra=require(_0x835c('0x5'));var auth=require(_0x835c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x835c('0x7'));var controller=require(_0x835c('0x8'));router['get']('/',auth[_0x835c('0x9')](),controller['index']);router[_0x835c('0xa')](_0x835c('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x835c('0xc'),auth['isAuthenticated'](),controller[_0x835c('0xd')]);router[_0x835c('0xa')](_0x835c('0xe'),auth[_0x835c('0x9')](),controller[_0x835c('0xf')]);router['get'](_0x835c('0x10'),auth[_0x835c('0x9')](),controller['getDescriptions']);router[_0x835c('0x11')]('/',auth['isAuthenticated'](),controller[_0x835c('0x12')]);router[_0x835c('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x835c('0x14')](_0x835c('0xb'),auth[_0x835c('0x9')](),controller[_0x835c('0x15')]);module[_0x835c('0x16')]=router; \ No newline at end of file +var _0xa8ac=['/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','get','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x551179,_0x49c7af){var _0x5c1170=function(_0x3d9f8b){while(--_0x3d9f8b){_0x551179['push'](_0x551179['shift']());}};_0x5c1170(++_0x49c7af);}(_0xa8ac,0xd9));var _0xca8a=function(_0x333bf2,_0x16c173){_0x333bf2=_0x333bf2-0x0;var _0x590088=_0xa8ac[_0x333bf2];return _0x590088;};'use strict';var multer=require('multer');var util=require(_0xca8a('0x0'));var path=require(_0xca8a('0x1'));var timeout=require('connect-timeout');var express=require(_0xca8a('0x2'));var router=express[_0xca8a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xca8a('0x4'));var config=require('../../config/environment');var controller=require(_0xca8a('0x5'));router['get']('/',auth[_0xca8a('0x6')](),controller['index']);router[_0xca8a('0x7')]('/:id',auth[_0xca8a('0x6')](),controller[_0xca8a('0x8')]);router[_0xca8a('0x7')](_0xca8a('0x9'),auth[_0xca8a('0x6')](),controller[_0xca8a('0xa')]);router[_0xca8a('0x7')](_0xca8a('0xb'),auth[_0xca8a('0x6')](),controller[_0xca8a('0xc')]);router['get'](_0xca8a('0xd'),auth['isAuthenticated'](),controller[_0xca8a('0xe')]);router[_0xca8a('0xf')]('/',auth[_0xca8a('0x6')](),controller[_0xca8a('0x10')]);router[_0xca8a('0x11')](_0xca8a('0x12'),auth[_0xca8a('0x6')](),controller[_0xca8a('0x13')]);router[_0xca8a('0x14')]('/:id',auth[_0xca8a('0x6')](),controller[_0xca8a('0x15')]);module[_0xca8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 072cc78..3db5186 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 _0x1807=['sequelize','exports','STRING','incident','phonecall','contact','nothing','BOOLEAN'];(function(_0x5c01f2,_0x1cad21){var _0x37e4ba=function(_0xe2b2d9){while(--_0xe2b2d9){_0x5c01f2['push'](_0x5c01f2['shift']());}};_0x37e4ba(++_0x1cad21);}(_0x1807,0x138));var _0x7180=function(_0x4d50b4,_0x314aaa){_0x4d50b4=_0x4d50b4-0x0;var _0x18bcbf=_0x1807[_0x4d50b4];return _0x18bcbf;};'use strict';var Sequelize=require(_0x7180('0x0'));module[_0x7180('0x1')]={'name':{'type':Sequelize[_0x7180('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x7180('0x3'),_0x7180('0x4')),'defaultValue':_0x7180('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x7180('0x5'),_0x7180('0x6')),'defaultValue':_0x7180('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7180('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7180('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5c4f=['nothing','BOOLEAN','sequelize','STRING','ENUM','incident','phonecall','contact'];(function(_0x38c95c,_0x417967){var _0x1d9fb0=function(_0x2734ca){while(--_0x2734ca){_0x38c95c['push'](_0x38c95c['shift']());}};_0x1d9fb0(++_0x417967);}(_0x5c4f,0x1a2));var _0xf5c4=function(_0x3b8667,_0x2cbadf){_0x3b8667=_0x3b8667-0x0;var _0x3092f6=_0x5c4f[_0x3b8667];return _0x3092f6;};'use strict';var Sequelize=require(_0xf5c4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5c4('0x1')]},'ticketType':{'type':Sequelize[_0xf5c4('0x2')](_0xf5c4('0x3'),_0xf5c4('0x4')),'defaultValue':_0xf5c4('0x3')},'moduleCreate':{'type':Sequelize[_0xf5c4('0x2')](_0xf5c4('0x5'),_0xf5c4('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xf5c4('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xf5c4('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4d0d114..20208fe 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 _0x09db=['getSubjects','getDescriptions','eml-format','rimraf','request-promise','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','offset','count','set','Content-Range','save','update','destroy','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','then','rows','catch','show','params','keys','find','create','body','getFields','findOne','Dynamics365Field','length','order'];(function(_0x54703a,_0x6992c1){var _0x334b62=function(_0x2526dd){while(--_0x2526dd){_0x54703a['push'](_0x54703a['shift']());}};_0x334b62(++_0x6992c1);}(_0x09db,0xec));var _0xb09d=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x09db[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0xb09d('0x0'));var rimraf=require(_0xb09d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb09d('0x2'));var moment=require('moment');var BPromise=require(_0xb09d('0x3'));var Mustache=require(_0xb09d('0x4'));var util=require(_0xb09d('0x5'));var path=require('path');var sox=require(_0xb09d('0x6'));var csv=require(_0xb09d('0x7'));var ejs=require(_0xb09d('0x8'));var fs=require('fs');var fs_extra=require(_0xb09d('0x9'));var _=require(_0xb09d('0xa'));var squel=require('squel');var crypto=require(_0xb09d('0xb'));var jsforce=require(_0xb09d('0xc'));var deskjs=require(_0xb09d('0xd'));var toCsv=require(_0xb09d('0x7'));var querystring=require(_0xb09d('0xe'));var Papa=require(_0xb09d('0xf'));var Redis=require(_0xb09d('0x10'));var authService=require(_0xb09d('0x11'));var qs=require(_0xb09d('0x12'));var as=require(_0xb09d('0x13'));var hardwareService=require(_0xb09d('0x14'));var logger=require(_0xb09d('0x15'))(_0xb09d('0x16'));var utils=require(_0xb09d('0x17'));var config=require(_0xb09d('0x18'));var licenseUtil=require(_0xb09d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x200181,_0x197178){_0x197178=_0x197178||0xcc;return function(_0x3cff2b){if(_0x3cff2b){return _0x200181[_0xb09d('0x1a')](_0x197178);}return _0x200181[_0xb09d('0x1b')](_0x197178)['end']();};}function respondWithResult(_0x5686e8,_0x5c3d64){_0x5c3d64=_0x5c3d64||0xc8;return function(_0x1c0a50){if(_0x1c0a50){return _0x5686e8[_0xb09d('0x1b')](_0x5c3d64)[_0xb09d('0x1c')](_0x1c0a50);}};}function respondWithFilteredResult(_0x1b18ae,_0x3b0ceb){return function(_0x4347eb){if(_0x4347eb){var _0x3a0307=typeof _0x3b0ceb['offset']==='undefined'&&typeof _0x3b0ceb[_0xb09d('0x1d')]==='undefined';var _0x2eabfc=_0x4347eb['count'];var _0x2e3817=_0x3a0307?0x0:_0x3b0ceb[_0xb09d('0x1e')];var _0x388be8=_0x3a0307?_0x4347eb[_0xb09d('0x1f')]:_0x3b0ceb[_0xb09d('0x1e')]+_0x3b0ceb[_0xb09d('0x1d')];var _0x1b3a5f;if(_0x388be8>=_0x2eabfc){_0x388be8=_0x2eabfc;_0x1b3a5f=0xc8;}else{_0x1b3a5f=0xce;}_0x1b18ae[_0xb09d('0x1b')](_0x1b3a5f);return _0x1b18ae[_0xb09d('0x20')](_0xb09d('0x21'),_0x2e3817+'-'+_0x388be8+'/'+_0x2eabfc)[_0xb09d('0x1c')](_0x4347eb);}return null;};}function patchUpdates(_0x293359){return function(_0x2553d1){try{jsonpatch['apply'](_0x2553d1,_0x293359,!![]);}catch(_0x4b12a0){return BPromise['reject'](_0x4b12a0);}return _0x2553d1[_0xb09d('0x22')]();};}function saveUpdates(_0x2d4f87,_0x434bd4){return function(_0x2c6302){if(_0x2c6302){return _0x2c6302[_0xb09d('0x23')](_0x2d4f87)['then'](function(_0x2fd834){return _0x2fd834;});}return null;};}function removeEntity(_0x20b298,_0x19725c){return function(_0x344af7){if(_0x344af7){return _0x344af7[_0xb09d('0x24')]()['then'](function(){_0x20b298['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x245207,_0x241607){return function(_0x20194b){if(!_0x20194b){_0x245207[_0xb09d('0x1a')](0x194);}return _0x20194b;};}function handleError(_0x8f0f8a,_0x34b636){_0x34b636=_0x34b636||0x1f4;return function(_0x335e19){logger[_0xb09d('0x25')](_0x335e19[_0xb09d('0x26')]);if(_0x335e19[_0xb09d('0x27')]){delete _0x335e19[_0xb09d('0x27')];}_0x8f0f8a['status'](_0x34b636)[_0xb09d('0x28')](_0x335e19);};}exports['index']=function(_0x44a8c0,_0x2dc3e8){var _0x2dabdb={},_0x338948={},_0x257e51={'count':0x0,'rows':[]};var _0x2c2477=_[_0xb09d('0x29')](db[_0xb09d('0x2a')][_0xb09d('0x2b')],function(_0x2440c6){return{'name':_0x2440c6['fieldName'],'type':_0x2440c6[_0xb09d('0x2c')][_0xb09d('0x2d')]};});_0x338948[_0xb09d('0x2e')]=_[_0xb09d('0x29')](_0x2c2477,_0xb09d('0x27'));_0x338948[_0xb09d('0x2f')]=_['keys'](_0x44a8c0[_0xb09d('0x2f')]);_0x338948[_0xb09d('0x30')]=_[_0xb09d('0x31')](_0x338948['model'],_0x338948[_0xb09d('0x2f')]);_0x2dabdb[_0xb09d('0x32')]=_[_0xb09d('0x31')](_0x338948[_0xb09d('0x2e')],qs['fields'](_0x44a8c0[_0xb09d('0x2f')][_0xb09d('0x33')]));_0x2dabdb[_0xb09d('0x32')]=_0x2dabdb[_0xb09d('0x32')]['length']?_0x2dabdb[_0xb09d('0x32')]:_0x338948[_0xb09d('0x2e')];if(!_0x44a8c0[_0xb09d('0x2f')][_0xb09d('0x34')](_0xb09d('0x35'))){_0x2dabdb[_0xb09d('0x1d')]=qs[_0xb09d('0x1d')](_0x44a8c0[_0xb09d('0x2f')]['limit']);_0x2dabdb[_0xb09d('0x1e')]=qs[_0xb09d('0x1e')](_0x44a8c0[_0xb09d('0x2f')][_0xb09d('0x1e')]);}_0x2dabdb['order']=qs['sort'](_0x44a8c0['query'][_0xb09d('0x36')]);_0x2dabdb[_0xb09d('0x37')]=qs['filters'](_[_0xb09d('0x38')](_0x44a8c0[_0xb09d('0x2f')],_0x338948['filters']),_0x2c2477);if(_0x44a8c0['query']['filter']){_0x2dabdb[_0xb09d('0x37')]=_[_0xb09d('0x39')](_0x2dabdb[_0xb09d('0x37')],{'$or':_[_0xb09d('0x29')](_0x2c2477,function(_0x580eb9){if(_0x580eb9[_0xb09d('0x2c')]!==_0xb09d('0x3a')){var _0x2576bd={};_0x2576bd[_0x580eb9[_0xb09d('0x27')]]={'$like':'%'+_0x44a8c0['query'][_0xb09d('0x3b')]+'%'};return _0x2576bd;}})});}_0x2dabdb=_[_0xb09d('0x39')]({},_0x2dabdb,_0x44a8c0[_0xb09d('0x3c')]);var _0x2463e2={'where':_0x2dabdb[_0xb09d('0x37')]};return db['Dynamics365Configuration']['count'](_0x2463e2)['then'](function(_0x4108b3){_0x257e51['count']=_0x4108b3;if(_0x44a8c0[_0xb09d('0x2f')][_0xb09d('0x3d')]){_0x2dabdb['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x2dabdb);})[_0xb09d('0x3e')](function(_0xfe6897){_0x257e51[_0xb09d('0x3f')]=_0xfe6897;return _0x257e51;})[_0xb09d('0x3e')](respondWithFilteredResult(_0x2dc3e8,_0x2dabdb))[_0xb09d('0x40')](handleError(_0x2dc3e8,null));};exports[_0xb09d('0x41')]=function(_0x27ee72,_0x4cce06){var _0x25e9fb={'raw':![],'where':{'id':_0x27ee72[_0xb09d('0x42')]['id']}},_0x3e53b3={};_0x3e53b3[_0xb09d('0x2e')]=_[_0xb09d('0x43')](db[_0xb09d('0x2a')][_0xb09d('0x2b')]);_0x3e53b3['query']=_[_0xb09d('0x43')](_0x27ee72[_0xb09d('0x2f')]);_0x3e53b3[_0xb09d('0x30')]=_['intersection'](_0x3e53b3[_0xb09d('0x2e')],_0x3e53b3[_0xb09d('0x2f')]);_0x25e9fb[_0xb09d('0x32')]=_[_0xb09d('0x31')](_0x3e53b3[_0xb09d('0x2e')],qs[_0xb09d('0x33')](_0x27ee72[_0xb09d('0x2f')]['fields']));_0x25e9fb['attributes']=_0x25e9fb['attributes']['length']?_0x25e9fb[_0xb09d('0x32')]:_0x3e53b3[_0xb09d('0x2e')];if(_0x27ee72[_0xb09d('0x2f')][_0xb09d('0x3d')]){_0x25e9fb['include']=[{'all':!![]}];}_0x25e9fb=_[_0xb09d('0x39')]({},_0x25e9fb,_0x27ee72['options']);return db['Dynamics365Configuration'][_0xb09d('0x44')](_0x25e9fb)[_0xb09d('0x3e')](handleEntityNotFound(_0x4cce06,null))[_0xb09d('0x3e')](respondWithResult(_0x4cce06,null))[_0xb09d('0x40')](handleError(_0x4cce06,null));};exports[_0xb09d('0x45')]=function(_0x43ec8c,_0x7cbf25){return db['Dynamics365Configuration']['create'](_0x43ec8c[_0xb09d('0x46')],{})['then'](respondWithResult(_0x7cbf25,0xc9))[_0xb09d('0x40')](handleError(_0x7cbf25,null));};exports[_0xb09d('0x23')]=function(_0xdef5e1,_0x4bbb56){if(_0xdef5e1[_0xb09d('0x46')]['id']){delete _0xdef5e1[_0xb09d('0x46')]['id'];}return db[_0xb09d('0x2a')][_0xb09d('0x44')]({'where':{'id':_0xdef5e1[_0xb09d('0x42')]['id']}})[_0xb09d('0x3e')](handleEntityNotFound(_0x4bbb56,null))[_0xb09d('0x3e')](saveUpdates(_0xdef5e1[_0xb09d('0x46')],null))['then'](respondWithResult(_0x4bbb56,null))[_0xb09d('0x40')](handleError(_0x4bbb56,null));};exports[_0xb09d('0x24')]=function(_0x40c3ec,_0x3595f2){return db[_0xb09d('0x2a')][_0xb09d('0x44')]({'where':{'id':_0x40c3ec[_0xb09d('0x42')]['id']}})[_0xb09d('0x3e')](handleEntityNotFound(_0x3595f2,null))[_0xb09d('0x3e')](removeEntity(_0x3595f2,null))['catch'](handleError(_0x3595f2,null));};exports[_0xb09d('0x47')]=function(_0x24d6d0,_0x4b81cf,_0x34e57c){var _0xb17e90={};var _0x3171fe={};var _0x42d9d9;var _0x2829a5;return db[_0xb09d('0x2a')][_0xb09d('0x48')]({'where':{'id':_0x24d6d0[_0xb09d('0x42')]['id']}})[_0xb09d('0x3e')](handleEntityNotFound(_0x4b81cf,null))[_0xb09d('0x3e')](function(_0xf9855b){if(_0xf9855b){_0x42d9d9=_0xf9855b;_0x3171fe[_0xb09d('0x2e')]=_['keys'](db[_0xb09d('0x49')]['rawAttributes']);_0x3171fe[_0xb09d('0x2f')]=_[_0xb09d('0x43')](_0x24d6d0[_0xb09d('0x2f')]);_0x3171fe['filters']=_[_0xb09d('0x31')](_0x3171fe['model'],_0x3171fe['query']);_0xb17e90[_0xb09d('0x32')]=_[_0xb09d('0x31')](_0x3171fe['model'],qs[_0xb09d('0x33')](_0x24d6d0[_0xb09d('0x2f')]['fields']));_0xb17e90['attributes']=_0xb17e90[_0xb09d('0x32')][_0xb09d('0x4a')]?_0xb17e90[_0xb09d('0x32')]:_0x3171fe['model'];_0xb17e90[_0xb09d('0x4b')]=qs[_0xb09d('0x36')](_0x24d6d0[_0xb09d('0x2f')]['sort']);_0xb17e90[_0xb09d('0x37')]=qs['filters'](_[_0xb09d('0x38')](_0x24d6d0[_0xb09d('0x2f')],_0x3171fe[_0xb09d('0x30')]));if(_0x24d6d0[_0xb09d('0x2f')]['filter']){_0xb17e90[_0xb09d('0x37')]=_[_0xb09d('0x39')](_0xb17e90[_0xb09d('0x37')],{'$or':_['map'](_0xb17e90['attributes'],function(_0x392efb){var _0xb5efbc={};_0xb5efbc[_0x392efb]={'$like':'%'+_0x24d6d0[_0xb09d('0x2f')][_0xb09d('0x3b')]+'%'};return _0xb5efbc;})});}_0xb17e90=_[_0xb09d('0x39')]({},_0xb17e90,_0x24d6d0['options']);return _0x42d9d9['getFields'](_0xb17e90);}})['then'](function(_0x240e5d){if(_0x240e5d){_0x2829a5=_0x240e5d[_0xb09d('0x4a')];if(!_0x24d6d0[_0xb09d('0x2f')][_0xb09d('0x34')](_0xb09d('0x35'))){_0xb17e90[_0xb09d('0x1d')]=qs[_0xb09d('0x1d')](_0x24d6d0[_0xb09d('0x2f')][_0xb09d('0x1d')]);_0xb17e90[_0xb09d('0x1e')]=qs[_0xb09d('0x1e')](_0x24d6d0[_0xb09d('0x2f')][_0xb09d('0x1e')]);}return _0x42d9d9[_0xb09d('0x47')](_0xb17e90);}})[_0xb09d('0x3e')](function(_0x1f9745){if(_0x1f9745){return _0x1f9745?{'count':_0x2829a5,'rows':_0x1f9745}:null;}})[_0xb09d('0x3e')](respondWithResult(_0x4b81cf,null))[_0xb09d('0x40')](handleError(_0x4b81cf,null));};exports[_0xb09d('0x4c')]=function(_0x1876db,_0x75ac9b,_0x5d8ff1){var _0x32a592={};var _0x18b22c={};var _0x7f854d;var _0x424b74;return db['Dynamics365Configuration'][_0xb09d('0x48')]({'where':{'id':_0x1876db['params']['id']}})[_0xb09d('0x3e')](handleEntityNotFound(_0x75ac9b,null))[_0xb09d('0x3e')](function(_0x240e9e){if(_0x240e9e){_0x7f854d=_0x240e9e;_0x18b22c[_0xb09d('0x2e')]=_['keys'](db[_0xb09d('0x49')][_0xb09d('0x2b')]);_0x18b22c[_0xb09d('0x2f')]=_[_0xb09d('0x43')](_0x1876db[_0xb09d('0x2f')]);_0x18b22c['filters']=_['intersection'](_0x18b22c['model'],_0x18b22c[_0xb09d('0x2f')]);_0x32a592[_0xb09d('0x32')]=_[_0xb09d('0x31')](_0x18b22c[_0xb09d('0x2e')],qs[_0xb09d('0x33')](_0x1876db[_0xb09d('0x2f')]['fields']));_0x32a592[_0xb09d('0x32')]=_0x32a592[_0xb09d('0x32')][_0xb09d('0x4a')]?_0x32a592['attributes']:_0x18b22c[_0xb09d('0x2e')];_0x32a592[_0xb09d('0x4b')]=qs[_0xb09d('0x36')](_0x1876db[_0xb09d('0x2f')]['sort']);_0x32a592[_0xb09d('0x37')]=qs[_0xb09d('0x30')](_['pick'](_0x1876db[_0xb09d('0x2f')],_0x18b22c[_0xb09d('0x30')]));if(_0x1876db[_0xb09d('0x2f')]['filter']){_0x32a592[_0xb09d('0x37')]=_[_0xb09d('0x39')](_0x32a592[_0xb09d('0x37')],{'$or':_[_0xb09d('0x29')](_0x32a592[_0xb09d('0x32')],function(_0x4df5f2){var _0x27da66={};_0x27da66[_0x4df5f2]={'$like':'%'+_0x1876db['query'][_0xb09d('0x3b')]+'%'};return _0x27da66;})});}_0x32a592=_[_0xb09d('0x39')]({},_0x32a592,_0x1876db['options']);return _0x7f854d[_0xb09d('0x4c')](_0x32a592);}})[_0xb09d('0x3e')](function(_0x553a12){if(_0x553a12){_0x424b74=_0x553a12[_0xb09d('0x4a')];if(!_0x1876db[_0xb09d('0x2f')][_0xb09d('0x34')]('nolimit')){_0x32a592['limit']=qs[_0xb09d('0x1d')](_0x1876db['query']['limit']);_0x32a592[_0xb09d('0x1e')]=qs[_0xb09d('0x1e')](_0x1876db[_0xb09d('0x2f')][_0xb09d('0x1e')]);}return _0x7f854d[_0xb09d('0x4c')](_0x32a592);}})[_0xb09d('0x3e')](function(_0x4d9e47){if(_0x4d9e47){return _0x4d9e47?{'count':_0x424b74,'rows':_0x4d9e47}:null;}})[_0xb09d('0x3e')](respondWithResult(_0x75ac9b,null))[_0xb09d('0x40')](handleError(_0x75ac9b,null));};exports['getDescriptions']=function(_0x1349e1,_0x342599,_0x242f97){var _0x34aa5d={};var _0x2b54e1={};var _0xc0a50b;var _0x765e0d;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x1349e1['params']['id']}})[_0xb09d('0x3e')](handleEntityNotFound(_0x342599,null))[_0xb09d('0x3e')](function(_0x247914){if(_0x247914){_0xc0a50b=_0x247914;_0x2b54e1[_0xb09d('0x2e')]=_[_0xb09d('0x43')](db['Dynamics365Field'][_0xb09d('0x2b')]);_0x2b54e1[_0xb09d('0x2f')]=_['keys'](_0x1349e1['query']);_0x2b54e1[_0xb09d('0x30')]=_['intersection'](_0x2b54e1[_0xb09d('0x2e')],_0x2b54e1[_0xb09d('0x2f')]);_0x34aa5d[_0xb09d('0x32')]=_[_0xb09d('0x31')](_0x2b54e1['model'],qs[_0xb09d('0x33')](_0x1349e1['query']['fields']));_0x34aa5d['attributes']=_0x34aa5d[_0xb09d('0x32')][_0xb09d('0x4a')]?_0x34aa5d['attributes']:_0x2b54e1[_0xb09d('0x2e')];_0x34aa5d[_0xb09d('0x4b')]=qs[_0xb09d('0x36')](_0x1349e1[_0xb09d('0x2f')][_0xb09d('0x36')]);_0x34aa5d['where']=qs[_0xb09d('0x30')](_['pick'](_0x1349e1[_0xb09d('0x2f')],_0x2b54e1[_0xb09d('0x30')]));if(_0x1349e1['query']['filter']){_0x34aa5d['where']=_['merge'](_0x34aa5d[_0xb09d('0x37')],{'$or':_[_0xb09d('0x29')](_0x34aa5d[_0xb09d('0x32')],function(_0xc73089){var _0x744cf5={};_0x744cf5[_0xc73089]={'$like':'%'+_0x1349e1[_0xb09d('0x2f')][_0xb09d('0x3b')]+'%'};return _0x744cf5;})});}_0x34aa5d=_[_0xb09d('0x39')]({},_0x34aa5d,_0x1349e1[_0xb09d('0x3c')]);return _0xc0a50b[_0xb09d('0x4d')](_0x34aa5d);}})[_0xb09d('0x3e')](function(_0x8ce61d){if(_0x8ce61d){_0x765e0d=_0x8ce61d[_0xb09d('0x4a')];if(!_0x1349e1[_0xb09d('0x2f')][_0xb09d('0x34')](_0xb09d('0x35'))){_0x34aa5d[_0xb09d('0x1d')]=qs[_0xb09d('0x1d')](_0x1349e1[_0xb09d('0x2f')][_0xb09d('0x1d')]);_0x34aa5d[_0xb09d('0x1e')]=qs[_0xb09d('0x1e')](_0x1349e1[_0xb09d('0x2f')][_0xb09d('0x1e')]);}return _0xc0a50b['getDescriptions'](_0x34aa5d);}})[_0xb09d('0x3e')](function(_0x3680fa){if(_0x3680fa){return _0x3680fa?{'count':_0x765e0d,'rows':_0x3680fa}:null;}})[_0xb09d('0x3e')](respondWithResult(_0x342599,null))[_0xb09d('0x40')](handleError(_0x342599,null));}; \ No newline at end of file +var _0xe5cf=['fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','destroy','getFields','findOne','pick','getSubjects','Dynamics365Field','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','end','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','attributes','intersection'];(function(_0x2949de,_0x47b38d){var _0xc974b6=function(_0x2ef45e){while(--_0x2ef45e){_0x2949de['push'](_0x2949de['shift']());}};_0xc974b6(++_0x47b38d);}(_0xe5cf,0x6d));var _0xfe5c=function(_0x1a77f8,_0x568cde){_0x1a77f8=_0x1a77f8-0x0;var _0x5cdf17=_0xe5cf[_0x1a77f8];return _0x5cdf17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe5c('0x0'));var zipdir=require(_0xfe5c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe5c('0x2'));var moment=require(_0xfe5c('0x3'));var BPromise=require(_0xfe5c('0x4'));var Mustache=require(_0xfe5c('0x5'));var util=require(_0xfe5c('0x6'));var path=require(_0xfe5c('0x7'));var sox=require(_0xfe5c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe5c('0x9'));var crypto=require(_0xfe5c('0xa'));var jsforce=require(_0xfe5c('0xb'));var deskjs=require(_0xfe5c('0xc'));var toCsv=require(_0xfe5c('0xd'));var querystring=require(_0xfe5c('0xe'));var Papa=require(_0xfe5c('0xf'));var Redis=require(_0xfe5c('0x10'));var authService=require(_0xfe5c('0x11'));var qs=require(_0xfe5c('0x12'));var as=require(_0xfe5c('0x13'));var hardwareService=require(_0xfe5c('0x14'));var logger=require(_0xfe5c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xfe5c('0x16'));var licenseUtil=require(_0xfe5c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x102181,_0x522902){_0x522902=_0x522902||0xcc;return function(_0x218653){if(_0x218653){return _0x102181[_0xfe5c('0x18')](_0x522902);}return _0x102181[_0xfe5c('0x19')](_0x522902)['end']();};}function respondWithResult(_0x4583d4,_0x5de8cd){_0x5de8cd=_0x5de8cd||0xc8;return function(_0x3e4a18){if(_0x3e4a18){return _0x4583d4[_0xfe5c('0x19')](_0x5de8cd)[_0xfe5c('0x1a')](_0x3e4a18);}};}function respondWithFilteredResult(_0x5188ac,_0x3f61d6){return function(_0x1afb47){if(_0x1afb47){var _0x69e550=typeof _0x3f61d6[_0xfe5c('0x1b')]===_0xfe5c('0x1c')&&typeof _0x3f61d6[_0xfe5c('0x1d')]===_0xfe5c('0x1c');var _0x23a3a3=_0x1afb47[_0xfe5c('0x1e')];var _0x38e22c=_0x69e550?0x0:_0x3f61d6[_0xfe5c('0x1b')];var _0x1be92d=_0x69e550?_0x1afb47['count']:_0x3f61d6['offset']+_0x3f61d6['limit'];var _0x575f17;if(_0x1be92d>=_0x23a3a3){_0x1be92d=_0x23a3a3;_0x575f17=0xc8;}else{_0x575f17=0xce;}_0x5188ac[_0xfe5c('0x19')](_0x575f17);return _0x5188ac[_0xfe5c('0x1f')]('Content-Range',_0x38e22c+'-'+_0x1be92d+'/'+_0x23a3a3)[_0xfe5c('0x1a')](_0x1afb47);}return null;};}function patchUpdates(_0x22fe74){return function(_0x598527){try{jsonpatch[_0xfe5c('0x20')](_0x598527,_0x22fe74,!![]);}catch(_0x358c7f){return BPromise['reject'](_0x358c7f);}return _0x598527['save']();};}function saveUpdates(_0x3e18fb,_0xe63102){return function(_0x3170d8){if(_0x3170d8){return _0x3170d8[_0xfe5c('0x21')](_0x3e18fb)[_0xfe5c('0x22')](function(_0x81b3a7){return _0x81b3a7;});}return null;};}function removeEntity(_0x55172d,_0x2e929a){return function(_0x3f417e){if(_0x3f417e){return _0x3f417e['destroy']()['then'](function(){_0x55172d[_0xfe5c('0x19')](0xcc)[_0xfe5c('0x23')]();});}};}function handleEntityNotFound(_0x5ec7c7,_0x9d0276){return function(_0x942a9c){if(!_0x942a9c){_0x5ec7c7[_0xfe5c('0x18')](0x194);}return _0x942a9c;};}function handleError(_0x227b1a,_0x15756b){_0x15756b=_0x15756b||0x1f4;return function(_0x34c677){logger['error'](_0x34c677[_0xfe5c('0x24')]);if(_0x34c677[_0xfe5c('0x25')]){delete _0x34c677[_0xfe5c('0x25')];}_0x227b1a['status'](_0x15756b)[_0xfe5c('0x26')](_0x34c677);};}exports['index']=function(_0x441059,_0x41526a){var _0x545551={},_0x3039c6={},_0xcd62be={'count':0x0,'rows':[]};var _0x1a50bd=_[_0xfe5c('0x27')](db[_0xfe5c('0x28')][_0xfe5c('0x29')],function(_0x555efc){return{'name':_0x555efc[_0xfe5c('0x2a')],'type':_0x555efc[_0xfe5c('0x2b')][_0xfe5c('0x2c')]};});_0x3039c6[_0xfe5c('0x2d')]=_[_0xfe5c('0x27')](_0x1a50bd,'name');_0x3039c6[_0xfe5c('0x2e')]=_['keys'](_0x441059[_0xfe5c('0x2e')]);_0x3039c6['filters']=_['intersection'](_0x3039c6[_0xfe5c('0x2d')],_0x3039c6[_0xfe5c('0x2e')]);_0x545551[_0xfe5c('0x2f')]=_[_0xfe5c('0x30')](_0x3039c6[_0xfe5c('0x2d')],qs[_0xfe5c('0x31')](_0x441059[_0xfe5c('0x2e')][_0xfe5c('0x31')]));_0x545551[_0xfe5c('0x2f')]=_0x545551[_0xfe5c('0x2f')][_0xfe5c('0x32')]?_0x545551[_0xfe5c('0x2f')]:_0x3039c6[_0xfe5c('0x2d')];if(!_0x441059[_0xfe5c('0x2e')][_0xfe5c('0x33')](_0xfe5c('0x34'))){_0x545551[_0xfe5c('0x1d')]=qs['limit'](_0x441059['query'][_0xfe5c('0x1d')]);_0x545551['offset']=qs[_0xfe5c('0x1b')](_0x441059['query'][_0xfe5c('0x1b')]);}_0x545551[_0xfe5c('0x35')]=qs[_0xfe5c('0x36')](_0x441059[_0xfe5c('0x2e')]['sort']);_0x545551['where']=qs[_0xfe5c('0x37')](_['pick'](_0x441059['query'],_0x3039c6['filters']),_0x1a50bd);if(_0x441059['query'][_0xfe5c('0x38')]){_0x545551['where']=_['merge'](_0x545551[_0xfe5c('0x39')],{'$or':_[_0xfe5c('0x27')](_0x1a50bd,function(_0x5757f8){if(_0x5757f8['type']!==_0xfe5c('0x3a')){var _0x4b5b91={};_0x4b5b91[_0x5757f8[_0xfe5c('0x25')]]={'$like':'%'+_0x441059[_0xfe5c('0x2e')]['filter']+'%'};return _0x4b5b91;}})});}_0x545551=_[_0xfe5c('0x3b')]({},_0x545551,_0x441059[_0xfe5c('0x3c')]);var _0x216eb2={'where':_0x545551[_0xfe5c('0x39')]};return db[_0xfe5c('0x28')][_0xfe5c('0x1e')](_0x216eb2)[_0xfe5c('0x22')](function(_0x377cec){_0xcd62be[_0xfe5c('0x1e')]=_0x377cec;if(_0x441059['query'][_0xfe5c('0x3d')]){_0x545551[_0xfe5c('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xfe5c('0x3f')](_0x545551);})['then'](function(_0x5ac230){_0xcd62be[_0xfe5c('0x40')]=_0x5ac230;return _0xcd62be;})['then'](respondWithFilteredResult(_0x41526a,_0x545551))[_0xfe5c('0x41')](handleError(_0x41526a,null));};exports[_0xfe5c('0x42')]=function(_0x4aabe0,_0x1efab8){var _0x41da50={'raw':![],'where':{'id':_0x4aabe0['params']['id']}},_0x546c27={};_0x546c27[_0xfe5c('0x2d')]=_[_0xfe5c('0x43')](db[_0xfe5c('0x28')][_0xfe5c('0x29')]);_0x546c27[_0xfe5c('0x2e')]=_[_0xfe5c('0x43')](_0x4aabe0[_0xfe5c('0x2e')]);_0x546c27[_0xfe5c('0x37')]=_[_0xfe5c('0x30')](_0x546c27[_0xfe5c('0x2d')],_0x546c27['query']);_0x41da50[_0xfe5c('0x2f')]=_[_0xfe5c('0x30')](_0x546c27[_0xfe5c('0x2d')],qs[_0xfe5c('0x31')](_0x4aabe0['query'][_0xfe5c('0x31')]));_0x41da50['attributes']=_0x41da50[_0xfe5c('0x2f')][_0xfe5c('0x32')]?_0x41da50[_0xfe5c('0x2f')]:_0x546c27[_0xfe5c('0x2d')];if(_0x4aabe0[_0xfe5c('0x2e')]['includeAll']){_0x41da50[_0xfe5c('0x3e')]=[{'all':!![]}];}_0x41da50=_[_0xfe5c('0x3b')]({},_0x41da50,_0x4aabe0[_0xfe5c('0x3c')]);return db[_0xfe5c('0x28')][_0xfe5c('0x44')](_0x41da50)[_0xfe5c('0x22')](handleEntityNotFound(_0x1efab8,null))['then'](respondWithResult(_0x1efab8,null))[_0xfe5c('0x41')](handleError(_0x1efab8,null));};exports['create']=function(_0x5d57d4,_0x25e01b){return db[_0xfe5c('0x28')][_0xfe5c('0x45')](_0x5d57d4[_0xfe5c('0x46')],{})[_0xfe5c('0x22')](respondWithResult(_0x25e01b,0xc9))[_0xfe5c('0x41')](handleError(_0x25e01b,null));};exports['update']=function(_0x5e095f,_0x34bf35){if(_0x5e095f[_0xfe5c('0x46')]['id']){delete _0x5e095f[_0xfe5c('0x46')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x5e095f[_0xfe5c('0x47')]['id']}})[_0xfe5c('0x22')](handleEntityNotFound(_0x34bf35,null))[_0xfe5c('0x22')](saveUpdates(_0x5e095f[_0xfe5c('0x46')],null))[_0xfe5c('0x22')](respondWithResult(_0x34bf35,null))['catch'](handleError(_0x34bf35,null));};exports[_0xfe5c('0x48')]=function(_0x833354,_0x2aad82){return db[_0xfe5c('0x28')][_0xfe5c('0x44')]({'where':{'id':_0x833354[_0xfe5c('0x47')]['id']}})[_0xfe5c('0x22')](handleEntityNotFound(_0x2aad82,null))[_0xfe5c('0x22')](removeEntity(_0x2aad82,null))['catch'](handleError(_0x2aad82,null));};exports[_0xfe5c('0x49')]=function(_0x28ca1a,_0x467786,_0xa0109f){var _0x54e0b0={};var _0x46809b={};var _0x36513a;var _0x4667c5;return db[_0xfe5c('0x28')][_0xfe5c('0x4a')]({'where':{'id':_0x28ca1a[_0xfe5c('0x47')]['id']}})['then'](handleEntityNotFound(_0x467786,null))[_0xfe5c('0x22')](function(_0x1d492d){if(_0x1d492d){_0x36513a=_0x1d492d;_0x46809b['model']=_[_0xfe5c('0x43')](db['Dynamics365Field']['rawAttributes']);_0x46809b['query']=_['keys'](_0x28ca1a['query']);_0x46809b[_0xfe5c('0x37')]=_[_0xfe5c('0x30')](_0x46809b['model'],_0x46809b[_0xfe5c('0x2e')]);_0x54e0b0['attributes']=_[_0xfe5c('0x30')](_0x46809b['model'],qs[_0xfe5c('0x31')](_0x28ca1a[_0xfe5c('0x2e')][_0xfe5c('0x31')]));_0x54e0b0[_0xfe5c('0x2f')]=_0x54e0b0[_0xfe5c('0x2f')][_0xfe5c('0x32')]?_0x54e0b0[_0xfe5c('0x2f')]:_0x46809b[_0xfe5c('0x2d')];_0x54e0b0[_0xfe5c('0x35')]=qs[_0xfe5c('0x36')](_0x28ca1a[_0xfe5c('0x2e')][_0xfe5c('0x36')]);_0x54e0b0['where']=qs[_0xfe5c('0x37')](_[_0xfe5c('0x4b')](_0x28ca1a['query'],_0x46809b[_0xfe5c('0x37')]));if(_0x28ca1a[_0xfe5c('0x2e')][_0xfe5c('0x38')]){_0x54e0b0[_0xfe5c('0x39')]=_['merge'](_0x54e0b0[_0xfe5c('0x39')],{'$or':_[_0xfe5c('0x27')](_0x54e0b0[_0xfe5c('0x2f')],function(_0x2ed9bf){var _0x47cbb4={};_0x47cbb4[_0x2ed9bf]={'$like':'%'+_0x28ca1a[_0xfe5c('0x2e')]['filter']+'%'};return _0x47cbb4;})});}_0x54e0b0=_[_0xfe5c('0x3b')]({},_0x54e0b0,_0x28ca1a[_0xfe5c('0x3c')]);return _0x36513a['getFields'](_0x54e0b0);}})['then'](function(_0x15c338){if(_0x15c338){_0x4667c5=_0x15c338[_0xfe5c('0x32')];if(!_0x28ca1a[_0xfe5c('0x2e')][_0xfe5c('0x33')](_0xfe5c('0x34'))){_0x54e0b0[_0xfe5c('0x1d')]=qs[_0xfe5c('0x1d')](_0x28ca1a[_0xfe5c('0x2e')]['limit']);_0x54e0b0[_0xfe5c('0x1b')]=qs['offset'](_0x28ca1a[_0xfe5c('0x2e')][_0xfe5c('0x1b')]);}return _0x36513a[_0xfe5c('0x49')](_0x54e0b0);}})[_0xfe5c('0x22')](function(_0x5a1ba3){if(_0x5a1ba3){return _0x5a1ba3?{'count':_0x4667c5,'rows':_0x5a1ba3}:null;}})[_0xfe5c('0x22')](respondWithResult(_0x467786,null))[_0xfe5c('0x41')](handleError(_0x467786,null));};exports[_0xfe5c('0x4c')]=function(_0x79db81,_0x3c9df0,_0x5877ef){var _0x11c8a7={};var _0x5bdc93={};var _0x29443e;var _0x1c69ae;return db[_0xfe5c('0x28')]['findOne']({'where':{'id':_0x79db81['params']['id']}})[_0xfe5c('0x22')](handleEntityNotFound(_0x3c9df0,null))['then'](function(_0x3d4b6f){if(_0x3d4b6f){_0x29443e=_0x3d4b6f;_0x5bdc93[_0xfe5c('0x2d')]=_[_0xfe5c('0x43')](db[_0xfe5c('0x4d')][_0xfe5c('0x29')]);_0x5bdc93[_0xfe5c('0x2e')]=_[_0xfe5c('0x43')](_0x79db81[_0xfe5c('0x2e')]);_0x5bdc93['filters']=_['intersection'](_0x5bdc93[_0xfe5c('0x2d')],_0x5bdc93['query']);_0x11c8a7['attributes']=_[_0xfe5c('0x30')](_0x5bdc93['model'],qs[_0xfe5c('0x31')](_0x79db81['query'][_0xfe5c('0x31')]));_0x11c8a7['attributes']=_0x11c8a7[_0xfe5c('0x2f')][_0xfe5c('0x32')]?_0x11c8a7['attributes']:_0x5bdc93[_0xfe5c('0x2d')];_0x11c8a7[_0xfe5c('0x35')]=qs[_0xfe5c('0x36')](_0x79db81[_0xfe5c('0x2e')][_0xfe5c('0x36')]);_0x11c8a7[_0xfe5c('0x39')]=qs[_0xfe5c('0x37')](_[_0xfe5c('0x4b')](_0x79db81[_0xfe5c('0x2e')],_0x5bdc93[_0xfe5c('0x37')]));if(_0x79db81[_0xfe5c('0x2e')][_0xfe5c('0x38')]){_0x11c8a7[_0xfe5c('0x39')]=_[_0xfe5c('0x3b')](_0x11c8a7[_0xfe5c('0x39')],{'$or':_[_0xfe5c('0x27')](_0x11c8a7[_0xfe5c('0x2f')],function(_0x494cc4){var _0x216a34={};_0x216a34[_0x494cc4]={'$like':'%'+_0x79db81['query'][_0xfe5c('0x38')]+'%'};return _0x216a34;})});}_0x11c8a7=_[_0xfe5c('0x3b')]({},_0x11c8a7,_0x79db81[_0xfe5c('0x3c')]);return _0x29443e['getSubjects'](_0x11c8a7);}})[_0xfe5c('0x22')](function(_0x105630){if(_0x105630){_0x1c69ae=_0x105630['length'];if(!_0x79db81['query'][_0xfe5c('0x33')](_0xfe5c('0x34'))){_0x11c8a7[_0xfe5c('0x1d')]=qs[_0xfe5c('0x1d')](_0x79db81[_0xfe5c('0x2e')]['limit']);_0x11c8a7[_0xfe5c('0x1b')]=qs[_0xfe5c('0x1b')](_0x79db81['query'][_0xfe5c('0x1b')]);}return _0x29443e[_0xfe5c('0x4c')](_0x11c8a7);}})[_0xfe5c('0x22')](function(_0x32d6a7){if(_0x32d6a7){return _0x32d6a7?{'count':_0x1c69ae,'rows':_0x32d6a7}:null;}})[_0xfe5c('0x22')](respondWithResult(_0x3c9df0,null))['catch'](handleError(_0x3c9df0,null));};exports[_0xfe5c('0x4e')]=function(_0x5cbf4b,_0x216936,_0x250d7b){var _0x4c0bc9={};var _0x5551a2={};var _0x5f0c2c;var _0x43177c;return db[_0xfe5c('0x28')]['findOne']({'where':{'id':_0x5cbf4b[_0xfe5c('0x47')]['id']}})[_0xfe5c('0x22')](handleEntityNotFound(_0x216936,null))[_0xfe5c('0x22')](function(_0x514ffe){if(_0x514ffe){_0x5f0c2c=_0x514ffe;_0x5551a2[_0xfe5c('0x2d')]=_['keys'](db[_0xfe5c('0x4d')][_0xfe5c('0x29')]);_0x5551a2[_0xfe5c('0x2e')]=_['keys'](_0x5cbf4b[_0xfe5c('0x2e')]);_0x5551a2[_0xfe5c('0x37')]=_[_0xfe5c('0x30')](_0x5551a2['model'],_0x5551a2[_0xfe5c('0x2e')]);_0x4c0bc9[_0xfe5c('0x2f')]=_[_0xfe5c('0x30')](_0x5551a2[_0xfe5c('0x2d')],qs[_0xfe5c('0x31')](_0x5cbf4b[_0xfe5c('0x2e')]['fields']));_0x4c0bc9[_0xfe5c('0x2f')]=_0x4c0bc9[_0xfe5c('0x2f')]['length']?_0x4c0bc9[_0xfe5c('0x2f')]:_0x5551a2[_0xfe5c('0x2d')];_0x4c0bc9['order']=qs['sort'](_0x5cbf4b[_0xfe5c('0x2e')][_0xfe5c('0x36')]);_0x4c0bc9[_0xfe5c('0x39')]=qs['filters'](_[_0xfe5c('0x4b')](_0x5cbf4b['query'],_0x5551a2['filters']));if(_0x5cbf4b['query'][_0xfe5c('0x38')]){_0x4c0bc9[_0xfe5c('0x39')]=_[_0xfe5c('0x3b')](_0x4c0bc9[_0xfe5c('0x39')],{'$or':_[_0xfe5c('0x27')](_0x4c0bc9[_0xfe5c('0x2f')],function(_0x26ea41){var _0x2c936b={};_0x2c936b[_0x26ea41]={'$like':'%'+_0x5cbf4b[_0xfe5c('0x2e')][_0xfe5c('0x38')]+'%'};return _0x2c936b;})});}_0x4c0bc9=_[_0xfe5c('0x3b')]({},_0x4c0bc9,_0x5cbf4b[_0xfe5c('0x3c')]);return _0x5f0c2c[_0xfe5c('0x4e')](_0x4c0bc9);}})['then'](function(_0x32411c){if(_0x32411c){_0x43177c=_0x32411c[_0xfe5c('0x32')];if(!_0x5cbf4b['query'][_0xfe5c('0x33')](_0xfe5c('0x34'))){_0x4c0bc9[_0xfe5c('0x1d')]=qs['limit'](_0x5cbf4b[_0xfe5c('0x2e')][_0xfe5c('0x1d')]);_0x4c0bc9[_0xfe5c('0x1b')]=qs['offset'](_0x5cbf4b[_0xfe5c('0x2e')]['offset']);}return _0x5f0c2c[_0xfe5c('0x4e')](_0x4c0bc9);}})[_0xfe5c('0x22')](function(_0xc400b){if(_0xc400b){return _0xc400b?{'count':_0x43177c,'rows':_0xc400b}:null;}})[_0xfe5c('0x22')](respondWithResult(_0x216936,null))[_0xfe5c('0x41')](handleError(_0x216936,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0f07c5b..b4482c7 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x32af84,_0xc7a8d){var _0x41ec02=function(_0x5828a5){while(--_0x5828a5){_0x32af84['push'](_0x32af84['shift']());}};_0x41ec02(++_0xc7a8d);}(_0xdace,0xc5));var _0xedac=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xdace[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0xa09250,_0x12e5e2){var _0x533103=function(_0x48896e){while(--_0x48896e){_0xa09250['push'](_0xa09250['shift']());}};_0x533103(++_0x12e5e2);}(_0x84ab,0x12f));var _0xb84a=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x84ab[_0x4f0e62];return _0x117ab8;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 9f3d9f7..cbcf943 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 _0xba03=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util'];(function(_0x2c5581,_0xfdbbef){var _0x4f4213=function(_0x1620e9){while(--_0x1620e9){_0x2c5581['push'](_0x2c5581['shift']());}};_0x4f4213(++_0xfdbbef);}(_0xba03,0x154));var _0x3ba0=function(_0x43baeb,_0x2b56d2){_0x43baeb=_0x43baeb-0x0;var _0x540bc9=_0xba03[_0x43baeb];return _0x540bc9;};'use strict';var _=require(_0x3ba0('0x0'));var util=require(_0x3ba0('0x1'));var moment=require(_0x3ba0('0x2'));var BPromise=require(_0x3ba0('0x3'));var rs=require(_0x3ba0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3ba0('0x5'));var logger=require(_0x3ba0('0x6'))(_0x3ba0('0x7'));var config=require(_0x3ba0('0x8'));var jayson=require(_0x3ba0('0x9'));var client=jayson[_0x3ba0('0xa')][_0x3ba0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e23e3,_0x4b15c3,_0x56e254){return new BPromise(function(_0x15d20b,_0x544fa7){return client['request'](_0x5e23e3,_0x56e254)['then'](function(_0x3977aa){logger[_0x3ba0('0xc')](_0x3ba0('0xd'),_0x4b15c3,_0x3ba0('0xe'));logger[_0x3ba0('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4b15c3,_0x3ba0('0xe'),JSON['stringify'](_0x3977aa));if(_0x3977aa[_0x3ba0('0x10')]){if(_0x3977aa['error'][_0x3ba0('0x11')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4b15c3,_0x3977aa[_0x3ba0('0x10')][_0x3ba0('0x12')]);return _0x544fa7(_0x3977aa['error'][_0x3ba0('0x12')]);}logger[_0x3ba0('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4b15c3,_0x3977aa[_0x3ba0('0x10')]['message']);return _0x15d20b(_0x3977aa[_0x3ba0('0x10')][_0x3ba0('0x12')]);}else{logger['info'](_0x3ba0('0xd'),_0x4b15c3,_0x3ba0('0xe'));_0x15d20b(_0x3977aa['result'][_0x3ba0('0x12')]);}})['catch'](function(_0x451617){logger[_0x3ba0('0x10')](_0x3ba0('0xd'),_0x4b15c3,_0x451617);_0x544fa7(_0x451617);});});} \ No newline at end of file +var _0x2b48=['jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e2940,_0x14284c){var _0x4b48a6=function(_0x2fb5c9){while(--_0x2fb5c9){_0x5e2940['push'](_0x5e2940['shift']());}};_0x4b48a6(++_0x14284c);}(_0x2b48,0x115));var _0x82b4=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x2b48[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x82b4('0x0'));var util=require(_0x82b4('0x1'));var moment=require(_0x82b4('0x2'));var BPromise=require(_0x82b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82b4('0x5'));var logger=require(_0x82b4('0x6'))(_0x82b4('0x7'));var config=require(_0x82b4('0x8'));var jayson=require(_0x82b4('0x9'));var client=jayson['client'][_0x82b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5555c3,_0x48e541,_0x3517b7){return new BPromise(function(_0x26c19b,_0x1aa82a){return client[_0x82b4('0xb')](_0x5555c3,_0x3517b7)[_0x82b4('0xc')](function(_0x3ff26f){logger[_0x82b4('0xd')](_0x82b4('0xe'),_0x48e541,_0x82b4('0xf'));logger[_0x82b4('0x10')](_0x82b4('0x11'),_0x48e541,'request\x20sent',JSON[_0x82b4('0x12')](_0x3ff26f));if(_0x3ff26f['error']){if(_0x3ff26f[_0x82b4('0x13')][_0x82b4('0x14')]===0x1f4){logger[_0x82b4('0x13')](_0x82b4('0xe'),_0x48e541,_0x3ff26f['error'][_0x82b4('0x15')]);return _0x1aa82a(_0x3ff26f[_0x82b4('0x13')]['message']);}logger[_0x82b4('0x13')](_0x82b4('0xe'),_0x48e541,_0x3ff26f[_0x82b4('0x13')]['message']);return _0x26c19b(_0x3ff26f[_0x82b4('0x13')][_0x82b4('0x15')]);}else{logger[_0x82b4('0xd')](_0x82b4('0xe'),_0x48e541,_0x82b4('0xf'));_0x26c19b(_0x3ff26f['result'][_0x82b4('0x15')]);}})['catch'](function(_0x26d31b){logger[_0x82b4('0x13')](_0x82b4('0xe'),_0x48e541,_0x26d31b);_0x1aa82a(_0x26d31b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 42b625a..b79ae96 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 _0xb14a=['multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x32b3c2,_0xe56fd){var _0x40a313=function(_0x51ba92){while(--_0x51ba92){_0x32b3c2['push'](_0x32b3c2['shift']());}};_0x40a313(++_0xe56fd);}(_0xb14a,0xfc));var _0xab14=function(_0x421395,_0x47983a){_0x421395=_0x421395-0x0;var _0x1b5a64=_0xb14a[_0x421395];return _0x1b5a64;};'use strict';var multer=require(_0xab14('0x0'));var util=require(_0xab14('0x1'));var path=require(_0xab14('0x2'));var timeout=require(_0xab14('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab14('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab14('0x5'));var config=require(_0xab14('0x6'));var controller=require('./intDynamics365Field.controller');router[_0xab14('0x7')]('/',auth[_0xab14('0x8')](),controller[_0xab14('0x9')]);router[_0xab14('0x7')](_0xab14('0xa'),auth[_0xab14('0x8')](),controller[_0xab14('0xb')]);router[_0xab14('0xc')]('/',auth[_0xab14('0x8')](),controller[_0xab14('0xd')]);router['put'](_0xab14('0xa'),auth[_0xab14('0x8')](),controller[_0xab14('0xe')]);router[_0xab14('0xf')](_0xab14('0xa'),auth[_0xab14('0x8')](),controller[_0xab14('0x10')]);module[_0xab14('0x11')]=router; \ No newline at end of file +var _0x799f=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','post','create','put','/:id'];(function(_0x2be2c7,_0x32900e){var _0x4cc9a7=function(_0x2a3c37){while(--_0x2a3c37){_0x2be2c7['push'](_0x2be2c7['shift']());}};_0x4cc9a7(++_0x32900e);}(_0x799f,0xcb));var _0xf799=function(_0x5910a7,_0x1463ff){_0x5910a7=_0x5910a7-0x0;var _0x3a07e8=_0x799f[_0x5910a7];return _0x3a07e8;};'use strict';var multer=require(_0xf799('0x0'));var util=require(_0xf799('0x1'));var path=require(_0xf799('0x2'));var timeout=require(_0xf799('0x3'));var express=require(_0xf799('0x4'));var router=express[_0xf799('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf799('0x6'));var interaction=require(_0xf799('0x7'));var config=require(_0xf799('0x8'));var controller=require(_0xf799('0x9'));router[_0xf799('0xa')]('/',auth[_0xf799('0xb')](),controller[_0xf799('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf799('0xd')]('/',auth[_0xf799('0xb')](),controller[_0xf799('0xe')]);router[_0xf799('0xf')](_0xf799('0x10'),auth[_0xf799('0xb')](),controller[_0xf799('0x11')]);router[_0xf799('0x12')](_0xf799('0x10'),auth['isAuthenticated'](),controller[_0xf799('0x13')]);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 d793032..c9f3eaa 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 _0xeed6=['string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x14bff8,_0x58bd0f){var _0x48ea7e=function(_0xddb082){while(--_0xddb082){_0x14bff8['push'](_0x14bff8['shift']());}};_0x48ea7e(++_0x58bd0f);}(_0xeed6,0x1c9));var _0x6eed=function(_0x47430a,_0x2e3f19){_0x47430a=_0x47430a-0x0;var _0x3efc3a=_0xeed6[_0x47430a];return _0x3efc3a;};'use strict';var Sequelize=require(_0x6eed('0x0'));module[_0x6eed('0x1')]={'type':{'type':Sequelize[_0x6eed('0x2')](_0x6eed('0x3'),_0x6eed('0x4'),'customVariable',_0x6eed('0x5'),_0x6eed('0x6')),'defaultValue':_0x6eed('0x3')},'content':{'type':Sequelize[_0x6eed('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6eed('0x2')]('string',_0x6eed('0x4'),_0x6eed('0x8'))},'keyContent':{'type':Sequelize[_0x6eed('0x7')]},'idField':{'type':Sequelize[_0x6eed('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6eed('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6eed('0x7')]}}; \ No newline at end of file +var _0x6761=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6761,0x7d));var _0x1676=function(_0x4f39b9,_0x1c7355){_0x4f39b9=_0x4f39b9-0x0;var _0xbd9ea0=_0x6761[_0x4f39b9];return _0xbd9ea0;};'use strict';var Sequelize=require(_0x1676('0x0'));module['exports']={'type':{'type':Sequelize[_0x1676('0x1')](_0x1676('0x2'),_0x1676('0x3'),_0x1676('0x4'),'keyValue',_0x1676('0x5')),'defaultValue':_0x1676('0x2')},'content':{'type':Sequelize[_0x1676('0x6')]},'key':{'type':Sequelize[_0x1676('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1676('0x2'),'variable',_0x1676('0x4'))},'keyContent':{'type':Sequelize[_0x1676('0x6')]},'idField':{'type':Sequelize[_0x1676('0x6')]},'nameField':{'type':Sequelize[_0x1676('0x6')]},'customField':{'type':Sequelize[_0x1676('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1676('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index fec376e..d50240c 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 _0x7391=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x4bfe4e,_0x50f78b){var _0x276dac=function(_0x4710cc){while(--_0x4710cc){_0x4bfe4e['push'](_0x4bfe4e['shift']());}};_0x276dac(++_0x50f78b);}(_0x7391,0x88));var _0x1739=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x7391[_0x237546];return _0x233e29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1739('0x0'));var zipdir=require(_0x1739('0x1'));var jsonpatch=require(_0x1739('0x2'));var rp=require(_0x1739('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1739('0x4'));var util=require(_0x1739('0x5'));var path=require(_0x1739('0x6'));var sox=require(_0x1739('0x7'));var csv=require(_0x1739('0x8'));var ejs=require(_0x1739('0x9'));var fs=require('fs');var fs_extra=require(_0x1739('0xa'));var _=require(_0x1739('0xb'));var squel=require('squel');var crypto=require(_0x1739('0xc'));var jsforce=require(_0x1739('0xd'));var deskjs=require(_0x1739('0xe'));var toCsv=require(_0x1739('0x8'));var querystring=require(_0x1739('0xf'));var Papa=require(_0x1739('0x10'));var Redis=require('ioredis');var authService=require(_0x1739('0x11'));var qs=require(_0x1739('0x12'));var as=require(_0x1739('0x13'));var hardwareService=require(_0x1739('0x14'));var logger=require(_0x1739('0x15'))('api');var utils=require(_0x1739('0x16'));var config=require(_0x1739('0x17'));var licenseUtil=require(_0x1739('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x96e186,_0x226c0e){_0x226c0e=_0x226c0e||0xcc;return function(_0x3abc5f){if(_0x3abc5f){return _0x96e186['sendStatus'](_0x226c0e);}return _0x96e186[_0x1739('0x19')](_0x226c0e)[_0x1739('0x1a')]();};}function respondWithResult(_0x32068b,_0xd818fd){_0xd818fd=_0xd818fd||0xc8;return function(_0x339a97){if(_0x339a97){return _0x32068b[_0x1739('0x19')](_0xd818fd)[_0x1739('0x1b')](_0x339a97);}};}function respondWithFilteredResult(_0x54133b,_0x39c4b2){return function(_0x3adcc2){if(_0x3adcc2){var _0x58de57=typeof _0x39c4b2[_0x1739('0x1c')]===_0x1739('0x1d')&&typeof _0x39c4b2[_0x1739('0x1e')]==='undefined';var _0xbee331=_0x3adcc2[_0x1739('0x1f')];var _0x5a89f9=_0x58de57?0x0:_0x39c4b2[_0x1739('0x1c')];var _0x2c28f9=_0x58de57?_0x3adcc2[_0x1739('0x1f')]:_0x39c4b2[_0x1739('0x1c')]+_0x39c4b2[_0x1739('0x1e')];var _0x38ef41;if(_0x2c28f9>=_0xbee331){_0x2c28f9=_0xbee331;_0x38ef41=0xc8;}else{_0x38ef41=0xce;}_0x54133b[_0x1739('0x19')](_0x38ef41);return _0x54133b[_0x1739('0x20')](_0x1739('0x21'),_0x5a89f9+'-'+_0x2c28f9+'/'+_0xbee331)[_0x1739('0x1b')](_0x3adcc2);}return null;};}function patchUpdates(_0x11b943){return function(_0x57293f){try{jsonpatch[_0x1739('0x22')](_0x57293f,_0x11b943,!![]);}catch(_0x4d5974){return BPromise[_0x1739('0x23')](_0x4d5974);}return _0x57293f[_0x1739('0x24')]();};}function saveUpdates(_0x3c2647,_0x163b1b){return function(_0x1e572a){if(_0x1e572a){return _0x1e572a[_0x1739('0x25')](_0x3c2647)['then'](function(_0x34b6f8){return _0x34b6f8;});}return null;};}function removeEntity(_0x18611e,_0x5a2048){return function(_0x355cf0){if(_0x355cf0){return _0x355cf0[_0x1739('0x26')]()[_0x1739('0x27')](function(){_0x18611e['status'](0xcc)[_0x1739('0x1a')]();});}};}function handleEntityNotFound(_0xa62f91,_0x46badc){return function(_0x2f5505){if(!_0x2f5505){_0xa62f91[_0x1739('0x28')](0x194);}return _0x2f5505;};}function handleError(_0x373513,_0x4f8e31){_0x4f8e31=_0x4f8e31||0x1f4;return function(_0x2e5857){logger[_0x1739('0x29')](_0x2e5857[_0x1739('0x2a')]);if(_0x2e5857[_0x1739('0x2b')]){delete _0x2e5857['name'];}_0x373513[_0x1739('0x19')](_0x4f8e31)[_0x1739('0x2c')](_0x2e5857);};}exports[_0x1739('0x2d')]=function(_0x2f983a,_0x7ebcb5){var _0x55c3c9={},_0x3abaf8={},_0x194db0={'count':0x0,'rows':[]};var _0x111fab=_[_0x1739('0x2e')](db['Dynamics365Field']['rawAttributes'],function(_0x485c42){return{'name':_0x485c42['fieldName'],'type':_0x485c42['type'][_0x1739('0x2f')]};});_0x3abaf8['model']=_[_0x1739('0x2e')](_0x111fab,_0x1739('0x2b'));_0x3abaf8[_0x1739('0x30')]=_[_0x1739('0x31')](_0x2f983a['query']);_0x3abaf8[_0x1739('0x32')]=_[_0x1739('0x33')](_0x3abaf8[_0x1739('0x34')],_0x3abaf8[_0x1739('0x30')]);_0x55c3c9['attributes']=_[_0x1739('0x33')](_0x3abaf8[_0x1739('0x34')],qs[_0x1739('0x35')](_0x2f983a['query'][_0x1739('0x35')]));_0x55c3c9[_0x1739('0x36')]=_0x55c3c9[_0x1739('0x36')][_0x1739('0x37')]?_0x55c3c9['attributes']:_0x3abaf8[_0x1739('0x34')];if(!_0x2f983a[_0x1739('0x30')][_0x1739('0x38')](_0x1739('0x39'))){_0x55c3c9[_0x1739('0x1e')]=qs[_0x1739('0x1e')](_0x2f983a[_0x1739('0x30')]['limit']);_0x55c3c9['offset']=qs[_0x1739('0x1c')](_0x2f983a['query'][_0x1739('0x1c')]);}_0x55c3c9[_0x1739('0x3a')]=qs[_0x1739('0x3b')](_0x2f983a[_0x1739('0x30')][_0x1739('0x3b')]);_0x55c3c9[_0x1739('0x3c')]=qs['filters'](_[_0x1739('0x3d')](_0x2f983a[_0x1739('0x30')],_0x3abaf8[_0x1739('0x32')]),_0x111fab);if(_0x2f983a[_0x1739('0x30')][_0x1739('0x3e')]){_0x55c3c9[_0x1739('0x3c')]=_['merge'](_0x55c3c9[_0x1739('0x3c')],{'$or':_[_0x1739('0x2e')](_0x111fab,function(_0x4f9c43){if(_0x4f9c43[_0x1739('0x3f')]!=='VIRTUAL'){var _0x2c299f={};_0x2c299f[_0x4f9c43[_0x1739('0x2b')]]={'$like':'%'+_0x2f983a[_0x1739('0x30')][_0x1739('0x3e')]+'%'};return _0x2c299f;}})});}_0x55c3c9=_[_0x1739('0x40')]({},_0x55c3c9,_0x2f983a[_0x1739('0x41')]);var _0x108806={'where':_0x55c3c9[_0x1739('0x3c')]};return db[_0x1739('0x42')]['count'](_0x108806)[_0x1739('0x27')](function(_0x398463){_0x194db0[_0x1739('0x1f')]=_0x398463;if(_0x2f983a[_0x1739('0x30')][_0x1739('0x43')]){_0x55c3c9[_0x1739('0x44')]=[{'all':!![]}];}return db[_0x1739('0x42')][_0x1739('0x45')](_0x55c3c9);})[_0x1739('0x27')](function(_0x26866d){_0x194db0[_0x1739('0x46')]=_0x26866d;return _0x194db0;})['then'](respondWithFilteredResult(_0x7ebcb5,_0x55c3c9))[_0x1739('0x47')](handleError(_0x7ebcb5,null));};exports['show']=function(_0x582555,_0x55e8d8){var _0x5a7e0b={'raw':!![],'where':{'id':_0x582555[_0x1739('0x48')]['id']}},_0x127ad7={};_0x127ad7[_0x1739('0x34')]=_['keys'](db[_0x1739('0x42')][_0x1739('0x49')]);_0x127ad7[_0x1739('0x30')]=_['keys'](_0x582555['query']);_0x127ad7[_0x1739('0x32')]=_[_0x1739('0x33')](_0x127ad7[_0x1739('0x34')],_0x127ad7[_0x1739('0x30')]);_0x5a7e0b['attributes']=_['intersection'](_0x127ad7[_0x1739('0x34')],qs[_0x1739('0x35')](_0x582555[_0x1739('0x30')][_0x1739('0x35')]));_0x5a7e0b['attributes']=_0x5a7e0b[_0x1739('0x36')][_0x1739('0x37')]?_0x5a7e0b[_0x1739('0x36')]:_0x127ad7['model'];if(_0x582555[_0x1739('0x30')][_0x1739('0x43')]){_0x5a7e0b[_0x1739('0x44')]=[{'all':!![]}];}_0x5a7e0b=_[_0x1739('0x40')]({},_0x5a7e0b,_0x582555[_0x1739('0x41')]);return db['Dynamics365Field'][_0x1739('0x4a')](_0x5a7e0b)[_0x1739('0x27')](handleEntityNotFound(_0x55e8d8,null))[_0x1739('0x27')](respondWithResult(_0x55e8d8,null))['catch'](handleError(_0x55e8d8,null));};exports[_0x1739('0x4b')]=function(_0x4da275,_0x4e9c63){return db[_0x1739('0x42')][_0x1739('0x4b')](_0x4da275['body'],{})['then'](respondWithResult(_0x4e9c63,0xc9))[_0x1739('0x47')](handleError(_0x4e9c63,null));};exports['update']=function(_0x314071,_0x3c0a97){if(_0x314071[_0x1739('0x4c')]['id']){delete _0x314071[_0x1739('0x4c')]['id'];}return db[_0x1739('0x42')][_0x1739('0x4a')]({'where':{'id':_0x314071[_0x1739('0x48')]['id']}})[_0x1739('0x27')](handleEntityNotFound(_0x3c0a97,null))[_0x1739('0x27')](saveUpdates(_0x314071[_0x1739('0x4c')],null))[_0x1739('0x27')](respondWithResult(_0x3c0a97,null))[_0x1739('0x47')](handleError(_0x3c0a97,null));};exports[_0x1739('0x26')]=function(_0x188327,_0x5efb80){return db['Dynamics365Field'][_0x1739('0x4a')]({'where':{'id':_0x188327[_0x1739('0x48')]['id']}})['then'](handleEntityNotFound(_0x5efb80,null))[_0x1739('0x27')](removeEntity(_0x5efb80,null))['catch'](handleError(_0x5efb80,null));}; \ No newline at end of file +var _0x3058=['Dynamics365Field','then','includeAll','findAll','rows','catch','show','params','include','create','body','find','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options'];(function(_0xe688d5,_0x5aa2fe){var _0x43c192=function(_0x25580b){while(--_0x25580b){_0xe688d5['push'](_0xe688d5['shift']());}};_0x43c192(++_0x5aa2fe);}(_0x3058,0x1b0));var _0x8305=function(_0x1b3c3a,_0x23a90e){_0x1b3c3a=_0x1b3c3a-0x0;var _0x16fc0d=_0x3058[_0x1b3c3a];return _0x16fc0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8305('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8305('0x1'));var moment=require(_0x8305('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8305('0x3'));var util=require(_0x8305('0x4'));var path=require(_0x8305('0x5'));var sox=require(_0x8305('0x6'));var csv=require(_0x8305('0x7'));var ejs=require(_0x8305('0x8'));var fs=require('fs');var fs_extra=require(_0x8305('0x9'));var _=require(_0x8305('0xa'));var squel=require(_0x8305('0xb'));var crypto=require(_0x8305('0xc'));var jsforce=require(_0x8305('0xd'));var deskjs=require(_0x8305('0xe'));var toCsv=require(_0x8305('0x7'));var querystring=require(_0x8305('0xf'));var Papa=require(_0x8305('0x10'));var Redis=require(_0x8305('0x11'));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(_0x8305('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x8305('0x13'));var licenseUtil=require(_0x8305('0x14'));var db=require(_0x8305('0x15'))['db'];function respondWithStatusCode(_0x3e3431,_0x1c6978){_0x1c6978=_0x1c6978||0xcc;return function(_0x215235){if(_0x215235){return _0x3e3431[_0x8305('0x16')](_0x1c6978);}return _0x3e3431[_0x8305('0x17')](_0x1c6978)[_0x8305('0x18')]();};}function respondWithResult(_0x2c8b57,_0x351422){_0x351422=_0x351422||0xc8;return function(_0x2dfc9a){if(_0x2dfc9a){return _0x2c8b57['status'](_0x351422)[_0x8305('0x19')](_0x2dfc9a);}};}function respondWithFilteredResult(_0x3321a3,_0x459175){return function(_0x3cc0c7){if(_0x3cc0c7){var _0x44883e=typeof _0x459175[_0x8305('0x1a')]===_0x8305('0x1b')&&typeof _0x459175[_0x8305('0x1c')]===_0x8305('0x1b');var _0x449a5e=_0x3cc0c7['count'];var _0x12f465=_0x44883e?0x0:_0x459175[_0x8305('0x1a')];var _0x4a10f6=_0x44883e?_0x3cc0c7[_0x8305('0x1d')]:_0x459175['offset']+_0x459175['limit'];var _0x5af71a;if(_0x4a10f6>=_0x449a5e){_0x4a10f6=_0x449a5e;_0x5af71a=0xc8;}else{_0x5af71a=0xce;}_0x3321a3['status'](_0x5af71a);return _0x3321a3['set']('Content-Range',_0x12f465+'-'+_0x4a10f6+'/'+_0x449a5e)['json'](_0x3cc0c7);}return null;};}function patchUpdates(_0x1ce2dd){return function(_0x3debc2){try{jsonpatch['apply'](_0x3debc2,_0x1ce2dd,!![]);}catch(_0x2bb55e){return BPromise[_0x8305('0x1e')](_0x2bb55e);}return _0x3debc2[_0x8305('0x1f')]();};}function saveUpdates(_0x42d0d5,_0x2b7571){return function(_0x542eee){if(_0x542eee){return _0x542eee[_0x8305('0x20')](_0x42d0d5)['then'](function(_0x597e00){return _0x597e00;});}return null;};}function removeEntity(_0xf52c35,_0xacfdb7){return function(_0x1309ee){if(_0x1309ee){return _0x1309ee[_0x8305('0x21')]()['then'](function(){_0xf52c35[_0x8305('0x17')](0xcc)[_0x8305('0x18')]();});}};}function handleEntityNotFound(_0x2cf142,_0x222cd1){return function(_0x31005e){if(!_0x31005e){_0x2cf142['sendStatus'](0x194);}return _0x31005e;};}function handleError(_0x303799,_0x5a1fb4){_0x5a1fb4=_0x5a1fb4||0x1f4;return function(_0x447e9a){logger[_0x8305('0x22')](_0x447e9a[_0x8305('0x23')]);if(_0x447e9a[_0x8305('0x24')]){delete _0x447e9a[_0x8305('0x24')];}_0x303799[_0x8305('0x17')](_0x5a1fb4)[_0x8305('0x25')](_0x447e9a);};}exports[_0x8305('0x26')]=function(_0x4639ae,_0x30ecfc){var _0x1148c7={},_0x863bb2={},_0x33334c={'count':0x0,'rows':[]};var _0x1e072f=_[_0x8305('0x27')](db['Dynamics365Field']['rawAttributes'],function(_0x3bdc49){return{'name':_0x3bdc49[_0x8305('0x28')],'type':_0x3bdc49[_0x8305('0x29')]['key']};});_0x863bb2['model']=_[_0x8305('0x27')](_0x1e072f,'name');_0x863bb2[_0x8305('0x2a')]=_[_0x8305('0x2b')](_0x4639ae['query']);_0x863bb2[_0x8305('0x2c')]=_[_0x8305('0x2d')](_0x863bb2[_0x8305('0x2e')],_0x863bb2[_0x8305('0x2a')]);_0x1148c7['attributes']=_[_0x8305('0x2d')](_0x863bb2[_0x8305('0x2e')],qs['fields'](_0x4639ae[_0x8305('0x2a')][_0x8305('0x2f')]));_0x1148c7[_0x8305('0x30')]=_0x1148c7[_0x8305('0x30')][_0x8305('0x31')]?_0x1148c7[_0x8305('0x30')]:_0x863bb2[_0x8305('0x2e')];if(!_0x4639ae[_0x8305('0x2a')]['hasOwnProperty'](_0x8305('0x32'))){_0x1148c7[_0x8305('0x1c')]=qs[_0x8305('0x1c')](_0x4639ae[_0x8305('0x2a')][_0x8305('0x1c')]);_0x1148c7[_0x8305('0x1a')]=qs['offset'](_0x4639ae[_0x8305('0x2a')]['offset']);}_0x1148c7[_0x8305('0x33')]=qs['sort'](_0x4639ae['query']['sort']);_0x1148c7[_0x8305('0x34')]=qs[_0x8305('0x2c')](_[_0x8305('0x35')](_0x4639ae['query'],_0x863bb2[_0x8305('0x2c')]),_0x1e072f);if(_0x4639ae[_0x8305('0x2a')][_0x8305('0x36')]){_0x1148c7[_0x8305('0x34')]=_['merge'](_0x1148c7[_0x8305('0x34')],{'$or':_[_0x8305('0x27')](_0x1e072f,function(_0x4663f3){if(_0x4663f3[_0x8305('0x29')]!==_0x8305('0x37')){var _0x53a0ab={};_0x53a0ab[_0x4663f3['name']]={'$like':'%'+_0x4639ae['query'][_0x8305('0x36')]+'%'};return _0x53a0ab;}})});}_0x1148c7=_[_0x8305('0x38')]({},_0x1148c7,_0x4639ae[_0x8305('0x39')]);var _0x1bea2e={'where':_0x1148c7[_0x8305('0x34')]};return db[_0x8305('0x3a')][_0x8305('0x1d')](_0x1bea2e)[_0x8305('0x3b')](function(_0x2fed8f){_0x33334c[_0x8305('0x1d')]=_0x2fed8f;if(_0x4639ae[_0x8305('0x2a')][_0x8305('0x3c')]){_0x1148c7['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x8305('0x3d')](_0x1148c7);})[_0x8305('0x3b')](function(_0x3fd5e3){_0x33334c[_0x8305('0x3e')]=_0x3fd5e3;return _0x33334c;})[_0x8305('0x3b')](respondWithFilteredResult(_0x30ecfc,_0x1148c7))[_0x8305('0x3f')](handleError(_0x30ecfc,null));};exports[_0x8305('0x40')]=function(_0x431c1a,_0x2a2498){var _0x87665b={'raw':!![],'where':{'id':_0x431c1a[_0x8305('0x41')]['id']}},_0x126139={};_0x126139[_0x8305('0x2e')]=_[_0x8305('0x2b')](db[_0x8305('0x3a')]['rawAttributes']);_0x126139['query']=_['keys'](_0x431c1a[_0x8305('0x2a')]);_0x126139[_0x8305('0x2c')]=_['intersection'](_0x126139[_0x8305('0x2e')],_0x126139['query']);_0x87665b[_0x8305('0x30')]=_[_0x8305('0x2d')](_0x126139[_0x8305('0x2e')],qs[_0x8305('0x2f')](_0x431c1a[_0x8305('0x2a')][_0x8305('0x2f')]));_0x87665b['attributes']=_0x87665b[_0x8305('0x30')][_0x8305('0x31')]?_0x87665b[_0x8305('0x30')]:_0x126139['model'];if(_0x431c1a[_0x8305('0x2a')]['includeAll']){_0x87665b[_0x8305('0x42')]=[{'all':!![]}];}_0x87665b=_[_0x8305('0x38')]({},_0x87665b,_0x431c1a[_0x8305('0x39')]);return db['Dynamics365Field']['find'](_0x87665b)[_0x8305('0x3b')](handleEntityNotFound(_0x2a2498,null))[_0x8305('0x3b')](respondWithResult(_0x2a2498,null))['catch'](handleError(_0x2a2498,null));};exports[_0x8305('0x43')]=function(_0x4bfd09,_0x514d4){return db[_0x8305('0x3a')][_0x8305('0x43')](_0x4bfd09[_0x8305('0x44')],{})[_0x8305('0x3b')](respondWithResult(_0x514d4,0xc9))[_0x8305('0x3f')](handleError(_0x514d4,null));};exports[_0x8305('0x20')]=function(_0x5bce09,_0x95a233){if(_0x5bce09[_0x8305('0x44')]['id']){delete _0x5bce09[_0x8305('0x44')]['id'];}return db[_0x8305('0x3a')][_0x8305('0x45')]({'where':{'id':_0x5bce09[_0x8305('0x41')]['id']}})[_0x8305('0x3b')](handleEntityNotFound(_0x95a233,null))['then'](saveUpdates(_0x5bce09['body'],null))['then'](respondWithResult(_0x95a233,null))['catch'](handleError(_0x95a233,null));};exports['destroy']=function(_0x549b3c,_0x252e28){return db[_0x8305('0x3a')][_0x8305('0x45')]({'where':{'id':_0x549b3c[_0x8305('0x41')]['id']}})[_0x8305('0x3b')](handleEntityNotFound(_0x252e28,null))['then'](removeEntity(_0x252e28,null))[_0x8305('0x3f')](handleError(_0x252e28,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a5b71f2..2ccb1b8 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 _0x91f3=['int_dynamics365_fields','dynamics365_unique_index','util','../../config/logger','moment','bluebird','path','../../config/environment','Dynamics365Field'];(function(_0x5242b0,_0x5c7eac){var _0x2e5667=function(_0x57702a){while(--_0x57702a){_0x5242b0['push'](_0x5242b0['shift']());}};_0x2e5667(++_0x5c7eac);}(_0x91f3,0xb6));var _0x391f=function(_0x40a923,_0x371735){_0x40a923=_0x40a923-0x0;var _0x153f91=_0x91f3[_0x40a923];return _0x153f91;};'use strict';var _=require('lodash');var util=require(_0x391f('0x0'));var logger=require(_0x391f('0x1'))('api');var moment=require(_0x391f('0x2'));var BPromise=require(_0x391f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x391f('0x4'));var rimraf=require('rimraf');var config=require(_0x391f('0x5'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x45748c,_0x36abb0){return _0x45748c['define'](_0x391f('0x6'),attributes,{'tableName':_0x391f('0x7'),'paranoid':![],'indexes':[{'name':_0x391f('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b8c=['../../config/logger','api','moment','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util'];(function(_0x55fef3,_0x13be30){var _0x5aff6c=function(_0x2f037b){while(--_0x2f037b){_0x55fef3['push'](_0x55fef3['shift']());}};_0x5aff6c(++_0x13be30);}(_0x6b8c,0x94));var _0xc6b8=function(_0x50042c,_0x1ab24f){_0x50042c=_0x50042c-0x0;var _0x1c62eb=_0x6b8c[_0x50042c];return _0x1c62eb;};'use strict';var _=require(_0xc6b8('0x0'));var util=require(_0xc6b8('0x1'));var logger=require(_0xc6b8('0x2'))(_0xc6b8('0x3'));var moment=require(_0xc6b8('0x4'));var BPromise=require('bluebird');var rp=require(_0xc6b8('0x5'));var fs=require('fs');var path=require(_0xc6b8('0x6'));var rimraf=require(_0xc6b8('0x7'));var config=require('../../config/environment');var attributes=require(_0xc6b8('0x8'));module[_0xc6b8('0x9')]=function(_0x6a5d1,_0x10e461){return _0x6a5d1[_0xc6b8('0xa')](_0xc6b8('0xb'),attributes,{'tableName':_0xc6b8('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xc6b8('0xd'),_0xc6b8('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 2599bcc..d89cfbc 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 _0xfa2d=['jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x507c81,_0x19d1d1){var _0x1c141d=function(_0x3a877b){while(--_0x3a877b){_0x507c81['push'](_0x507c81['shift']());}};_0x1c141d(++_0x19d1d1);}(_0xfa2d,0x183));var _0xdfa2=function(_0x136565,_0x19ce1b){_0x136565=_0x136565-0x0;var _0x62e031=_0xfa2d[_0x136565];return _0x62e031;};'use strict';var _=require(_0xdfa2('0x0'));var util=require(_0xdfa2('0x1'));var moment=require(_0xdfa2('0x2'));var BPromise=require(_0xdfa2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfa2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfa2('0x5'));var logger=require(_0xdfa2('0x6'))(_0xdfa2('0x7'));var config=require(_0xdfa2('0x8'));var jayson=require(_0xdfa2('0x9'));var client=jayson[_0xdfa2('0xa')][_0xdfa2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c8c8,_0x59baaa,_0x248a80){return new BPromise(function(_0x220459,_0x22254a){return client[_0xdfa2('0xc')](_0x54c8c8,_0x248a80)[_0xdfa2('0xd')](function(_0x1d7502){logger['info'](_0xdfa2('0xe'),_0x59baaa,_0xdfa2('0xf'));logger[_0xdfa2('0x10')](_0xdfa2('0x11'),_0x59baaa,_0xdfa2('0xf'),JSON[_0xdfa2('0x12')](_0x1d7502));if(_0x1d7502[_0xdfa2('0x13')]){if(_0x1d7502[_0xdfa2('0x13')]['code']===0x1f4){logger[_0xdfa2('0x13')](_0xdfa2('0xe'),_0x59baaa,_0x1d7502[_0xdfa2('0x13')]['message']);return _0x22254a(_0x1d7502[_0xdfa2('0x13')]['message']);}logger['error'](_0xdfa2('0xe'),_0x59baaa,_0x1d7502['error'][_0xdfa2('0x14')]);return _0x220459(_0x1d7502[_0xdfa2('0x13')][_0xdfa2('0x14')]);}else{logger['info'](_0xdfa2('0xe'),_0x59baaa,_0xdfa2('0xf'));_0x220459(_0x1d7502[_0xdfa2('0x15')][_0xdfa2('0x14')]);}})['catch'](function(_0x462060){logger[_0xdfa2('0x13')](_0xdfa2('0xe'),_0x59baaa,_0x462060);_0x22254a(_0x462060);});});} \ No newline at end of file +var _0xfeb2=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request'];(function(_0x343d36,_0x5f248a){var _0x3bd305=function(_0x611a1e){while(--_0x611a1e){_0x343d36['push'](_0x343d36['shift']());}};_0x3bd305(++_0x5f248a);}(_0xfeb2,0x170));var _0x2feb=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0xfeb2[_0x764874];return _0x29f9d5;};'use strict';var _=require('lodash');var util=require(_0x2feb('0x0'));var moment=require(_0x2feb('0x1'));var BPromise=require(_0x2feb('0x2'));var rs=require(_0x2feb('0x3'));var fs=require('fs');var Redis=require(_0x2feb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2feb('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2feb('0x6'));var client=jayson[_0x2feb('0x7')][_0x2feb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53f6b1,_0x3ba839,_0x353d6b){return new BPromise(function(_0x45bce3,_0x487559){return client[_0x2feb('0x9')](_0x53f6b1,_0x353d6b)['then'](function(_0x582301){logger[_0x2feb('0xa')](_0x2feb('0xb'),_0x3ba839,_0x2feb('0xc'));logger[_0x2feb('0xd')](_0x2feb('0xe'),_0x3ba839,_0x2feb('0xc'),JSON[_0x2feb('0xf')](_0x582301));if(_0x582301[_0x2feb('0x10')]){if(_0x582301[_0x2feb('0x10')][_0x2feb('0x11')]===0x1f4){logger[_0x2feb('0x10')](_0x2feb('0xb'),_0x3ba839,_0x582301[_0x2feb('0x10')][_0x2feb('0x12')]);return _0x487559(_0x582301[_0x2feb('0x10')][_0x2feb('0x12')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3ba839,_0x582301[_0x2feb('0x10')][_0x2feb('0x12')]);return _0x45bce3(_0x582301[_0x2feb('0x10')][_0x2feb('0x12')]);}else{logger[_0x2feb('0xa')](_0x2feb('0xb'),_0x3ba839,_0x2feb('0xc'));_0x45bce3(_0x582301[_0x2feb('0x13')][_0x2feb('0x12')]);}})[_0x2feb('0x14')](function(_0x5a85ce){logger[_0x2feb('0x10')](_0x2feb('0xb'),_0x3ba839,_0x5a85ce);_0x487559(_0x5a85ce);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f3a5c24..ad6e8fa 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 _0x1471=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','exports','multer'];(function(_0x4d3276,_0x2d69c6){var _0x11469f=function(_0x2580be){while(--_0x2580be){_0x4d3276['push'](_0x4d3276['shift']());}};_0x11469f(++_0x2d69c6);}(_0x1471,0x19d));var _0x1147=function(_0xffb2c7,_0x473dde){_0xffb2c7=_0xffb2c7-0x0;var _0x27bf12=_0x1471[_0xffb2c7];return _0x27bf12;};'use strict';var multer=require(_0x1147('0x0'));var util=require('util');var path=require(_0x1147('0x1'));var timeout=require(_0x1147('0x2'));var express=require('express');var router=express[_0x1147('0x3')]();var fs_extra=require(_0x1147('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1147('0x5'));var config=require('../../config/environment');var controller=require(_0x1147('0x6'));router[_0x1147('0x7')]('/',auth[_0x1147('0x8')](),controller[_0x1147('0x9')]);router[_0x1147('0x7')](_0x1147('0xa'),auth['isAuthenticated'](),controller[_0x1147('0xb')]);router[_0x1147('0x7')](_0x1147('0xc'),auth[_0x1147('0x8')](),controller[_0x1147('0xd')]);router['get'](_0x1147('0xe'),auth['isAuthenticated'](),controller[_0x1147('0xf')]);router['post']('/',auth[_0x1147('0x8')](),controller[_0x1147('0x10')]);router[_0x1147('0x11')](_0x1147('0xc'),auth[_0x1147('0x8')](),controller[_0x1147('0x12')]);router[_0x1147('0x13')](_0x1147('0xa'),auth[_0x1147('0x8')](),controller[_0x1147('0x14')]);router[_0x1147('0x15')](_0x1147('0xa'),auth[_0x1147('0x8')](),controller['destroy']);module[_0x1147('0x16')]=router; \ No newline at end of file +var _0x7a62=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','/:id','update','destroy'];(function(_0x18aa65,_0xbc670b){var _0xb07544=function(_0x588f28){while(--_0x588f28){_0x18aa65['push'](_0x18aa65['shift']());}};_0xb07544(++_0xbc670b);}(_0x7a62,0xa2));var _0x27a6=function(_0x316122,_0x53ee5b){_0x316122=_0x316122-0x0;var _0x4887f6=_0x7a62[_0x316122];return _0x4887f6;};'use strict';var multer=require(_0x27a6('0x0'));var util=require(_0x27a6('0x1'));var path=require(_0x27a6('0x2'));var timeout=require(_0x27a6('0x3'));var express=require('express');var router=express[_0x27a6('0x4')]();var fs_extra=require(_0x27a6('0x5'));var auth=require(_0x27a6('0x6'));var interaction=require(_0x27a6('0x7'));var config=require(_0x27a6('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x27a6('0x9')]('/',auth[_0x27a6('0xa')](),controller['index']);router[_0x27a6('0x9')]('/:id',auth[_0x27a6('0xa')](),controller[_0x27a6('0xb')]);router[_0x27a6('0x9')](_0x27a6('0xc'),auth[_0x27a6('0xa')](),controller[_0x27a6('0xd')]);router['get'](_0x27a6('0xe'),auth[_0x27a6('0xa')](),controller[_0x27a6('0xf')]);router['post']('/',auth[_0x27a6('0xa')](),controller[_0x27a6('0x10')]);router['post'](_0x27a6('0xc'),auth[_0x27a6('0xa')](),controller[_0x27a6('0x11')]);router[_0x27a6('0x12')](_0x27a6('0x13'),auth[_0x27a6('0xa')](),controller[_0x27a6('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x27a6('0x15')]);module[_0x27a6('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0df241e..64b1c85 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 _0x93e9=['sequelize','exports','STRING','username'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x93e9,0xcc));var _0x993e=function(_0x3a04c6,_0x12a482){_0x3a04c6=_0x3a04c6-0x0;var _0xf4131a=_0x93e9[_0x3a04c6];return _0xf4131a;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')]},'description':{'type':Sequelize[_0x993e('0x2')]},'username':{'type':Sequelize[_0x993e('0x2')],'unique':_0x993e('0x3')},'apiKey':{'type':Sequelize[_0x993e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x993e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb78e=['username','remoteUri','sequelize','exports','STRING'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0xb78e,0x1c9));var _0xeb78=function(_0x15c808,_0x47863d){_0x15c808=_0x15c808-0x0;var _0x4e4498=_0xb78e[_0x15c808];return _0x4e4498;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb78('0x2')]},'username':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x3')},'apiKey':{'type':Sequelize[_0xeb78('0x2')]},'remoteUri':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x4')},'serverUrl':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 7cae21f..3297d94 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 _0x7b05=['channel','FreshdeskField','Descriptions','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','test','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskAccount','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','type','getDescriptions'];(function(_0x296e71,_0x500b29){var _0x15ccc0=function(_0x23d34b){while(--_0x23d34b){_0x296e71['push'](_0x296e71['shift']());}};_0x15ccc0(++_0x500b29);}(_0x7b05,0x91));var _0x57b0=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x7b05[_0x382c73];return _0x1dd0bf;};'use strict';var emlformat=require(_0x57b0('0x0'));var rimraf=require(_0x57b0('0x1'));var zipdir=require(_0x57b0('0x2'));var jsonpatch=require(_0x57b0('0x3'));var rp=require('request-promise');var moment=require(_0x57b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57b0('0x5'));var util=require(_0x57b0('0x6'));var path=require(_0x57b0('0x7'));var sox=require(_0x57b0('0x8'));var csv=require(_0x57b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57b0('0xa'));var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x57b0('0x15'));function respondWithStatusCode(_0x145eae,_0xee8335){_0xee8335=_0xee8335||0xcc;return function(_0x520f45){if(_0x520f45){return _0x145eae['sendStatus'](_0xee8335);}return _0x145eae[_0x57b0('0x16')](_0xee8335)[_0x57b0('0x17')]();};}function respondWithResult(_0xc9044f,_0x3b48a3){_0x3b48a3=_0x3b48a3||0xc8;return function(_0x564b15){if(_0x564b15){return _0xc9044f[_0x57b0('0x16')](_0x3b48a3)['json'](_0x564b15);}};}function respondWithFilteredResult(_0x235d4a,_0xa20423){return function(_0x55fd9c){if(_0x55fd9c){var _0x1ad3c9=typeof _0xa20423[_0x57b0('0x18')]===_0x57b0('0x19')&&typeof _0xa20423[_0x57b0('0x1a')]===_0x57b0('0x19');var _0x545c29=_0x55fd9c[_0x57b0('0x1b')];var _0x4ac304=_0x1ad3c9?0x0:_0xa20423['offset'];var _0x1f18a7=_0x1ad3c9?_0x55fd9c[_0x57b0('0x1b')]:_0xa20423[_0x57b0('0x18')]+_0xa20423[_0x57b0('0x1a')];var _0x2b9368;if(_0x1f18a7>=_0x545c29){_0x1f18a7=_0x545c29;_0x2b9368=0xc8;}else{_0x2b9368=0xce;}_0x235d4a[_0x57b0('0x16')](_0x2b9368);return _0x235d4a['set'](_0x57b0('0x1c'),_0x4ac304+'-'+_0x1f18a7+'/'+_0x545c29)[_0x57b0('0x1d')](_0x55fd9c);}return null;};}function patchUpdates(_0x35a457){return function(_0x4c7ea2){try{jsonpatch[_0x57b0('0x1e')](_0x4c7ea2,_0x35a457,!![]);}catch(_0x34e958){return BPromise[_0x57b0('0x1f')](_0x34e958);}return _0x4c7ea2[_0x57b0('0x20')]();};}function saveUpdates(_0x2ffc0a,_0x22b11e){return function(_0x29cf6f){if(_0x29cf6f){return _0x29cf6f[_0x57b0('0x21')](_0x2ffc0a)[_0x57b0('0x22')](function(_0x5c60b9){return _0x5c60b9;});}return null;};}function removeEntity(_0x55b870,_0x40c279){return function(_0x59bdb8){if(_0x59bdb8){return _0x59bdb8[_0x57b0('0x23')]()[_0x57b0('0x22')](function(){_0x55b870[_0x57b0('0x16')](0xcc)[_0x57b0('0x17')]();});}};}function handleEntityNotFound(_0x3e75e8,_0xbf54ac){return function(_0x1cf6ed){if(!_0x1cf6ed){_0x3e75e8[_0x57b0('0x24')](0x194);}return _0x1cf6ed;};}function handleError(_0xacd07c,_0x109678){_0x109678=_0x109678||0x1f4;return function(_0x3e4e5f){logger[_0x57b0('0x25')](_0x3e4e5f[_0x57b0('0x26')]);if(_0x3e4e5f['name']){delete _0x3e4e5f[_0x57b0('0x27')];}_0xacd07c[_0x57b0('0x16')](_0x109678)[_0x57b0('0x28')](_0x3e4e5f);};}exports[_0x57b0('0x29')]=function(_0x5e046c,_0x552f3e){var _0x325e39={},_0x3aaf57={},_0x1ccf42={'count':0x0,'rows':[]};var _0x5958a8=_['map'](db[_0x57b0('0x2a')]['rawAttributes'],function(_0x12f4bf){return{'name':_0x12f4bf['fieldName'],'type':_0x12f4bf['type'][_0x57b0('0x2b')]};});_0x3aaf57[_0x57b0('0x2c')]=_['map'](_0x5958a8,_0x57b0('0x27'));_0x3aaf57[_0x57b0('0x2d')]=_['keys'](_0x5e046c[_0x57b0('0x2d')]);_0x3aaf57[_0x57b0('0x2e')]=_[_0x57b0('0x2f')](_0x3aaf57['model'],_0x3aaf57[_0x57b0('0x2d')]);_0x325e39[_0x57b0('0x30')]=_[_0x57b0('0x2f')](_0x3aaf57[_0x57b0('0x2c')],qs[_0x57b0('0x31')](_0x5e046c['query']['fields']));_0x325e39['attributes']=_0x325e39['attributes'][_0x57b0('0x32')]?_0x325e39[_0x57b0('0x30')]:_0x3aaf57[_0x57b0('0x2c')];if(!_0x5e046c[_0x57b0('0x2d')][_0x57b0('0x33')]('nolimit')){_0x325e39[_0x57b0('0x1a')]=qs[_0x57b0('0x1a')](_0x5e046c[_0x57b0('0x2d')][_0x57b0('0x1a')]);_0x325e39['offset']=qs[_0x57b0('0x18')](_0x5e046c[_0x57b0('0x2d')]['offset']);}_0x325e39[_0x57b0('0x34')]=qs[_0x57b0('0x35')](_0x5e046c['query']['sort']);_0x325e39[_0x57b0('0x36')]=qs[_0x57b0('0x2e')](_[_0x57b0('0x37')](_0x5e046c[_0x57b0('0x2d')],_0x3aaf57[_0x57b0('0x2e')]),_0x5958a8);if(_0x5e046c[_0x57b0('0x2d')][_0x57b0('0x38')]){_0x325e39[_0x57b0('0x36')]=_[_0x57b0('0x39')](_0x325e39[_0x57b0('0x36')],{'$or':_[_0x57b0('0x3a')](_0x5958a8,function(_0xb12b18){if(_0xb12b18['type']!==_0x57b0('0x3b')){var _0x145b80={};_0x145b80[_0xb12b18[_0x57b0('0x27')]]={'$like':'%'+_0x5e046c['query']['filter']+'%'};return _0x145b80;}})});}_0x325e39=_['merge']({},_0x325e39,_0x5e046c[_0x57b0('0x3c')]);var _0x2204c8={'where':_0x325e39[_0x57b0('0x36')]};return db[_0x57b0('0x2a')]['count'](_0x2204c8)[_0x57b0('0x22')](function(_0x2b96ee){_0x1ccf42['count']=_0x2b96ee;if(_0x5e046c[_0x57b0('0x2d')][_0x57b0('0x3d')]){_0x325e39[_0x57b0('0x3e')]=[{'all':!![]}];}return db[_0x57b0('0x2a')][_0x57b0('0x3f')](_0x325e39);})['then'](function(_0xaa22e0){_0x1ccf42[_0x57b0('0x40')]=_0xaa22e0;return _0x1ccf42;})[_0x57b0('0x22')](respondWithFilteredResult(_0x552f3e,_0x325e39))[_0x57b0('0x41')](handleError(_0x552f3e,null));};exports['show']=function(_0x574431,_0xa7b431){var _0x344bc6={'raw':![],'where':{'id':_0x574431[_0x57b0('0x42')]['id']}},_0x49c98f={};_0x49c98f[_0x57b0('0x2c')]=_[_0x57b0('0x43')](db['FreshdeskAccount']['rawAttributes']);_0x49c98f[_0x57b0('0x2d')]=_[_0x57b0('0x43')](_0x574431[_0x57b0('0x2d')]);_0x49c98f[_0x57b0('0x2e')]=_[_0x57b0('0x2f')](_0x49c98f['model'],_0x49c98f[_0x57b0('0x2d')]);_0x344bc6[_0x57b0('0x30')]=_[_0x57b0('0x2f')](_0x49c98f[_0x57b0('0x2c')],qs[_0x57b0('0x31')](_0x574431['query']['fields']));_0x344bc6['attributes']=_0x344bc6['attributes'][_0x57b0('0x32')]?_0x344bc6[_0x57b0('0x30')]:_0x49c98f[_0x57b0('0x2c')];if(_0x574431[_0x57b0('0x2d')][_0x57b0('0x3d')]){_0x344bc6[_0x57b0('0x3e')]=[{'all':!![]}];}_0x344bc6=_[_0x57b0('0x39')]({},_0x344bc6,_0x574431['options']);return db[_0x57b0('0x2a')][_0x57b0('0x44')](_0x344bc6)[_0x57b0('0x22')](handleEntityNotFound(_0xa7b431,null))[_0x57b0('0x22')](respondWithResult(_0xa7b431,null))[_0x57b0('0x41')](handleError(_0xa7b431,null));};exports[_0x57b0('0x45')]=function(_0x5380e7,_0x48eb9f){return db[_0x57b0('0x2a')]['create'](_0x5380e7[_0x57b0('0x46')],{})['then'](respondWithResult(_0x48eb9f,0xc9))[_0x57b0('0x41')](handleError(_0x48eb9f,null));};exports['update']=function(_0x40dae2,_0x464a50){if(_0x40dae2['body']['id']){delete _0x40dae2[_0x57b0('0x46')]['id'];}return db[_0x57b0('0x2a')][_0x57b0('0x44')]({'where':{'id':_0x40dae2['params']['id']}})[_0x57b0('0x22')](handleEntityNotFound(_0x464a50,null))[_0x57b0('0x22')](saveUpdates(_0x40dae2['body'],null))[_0x57b0('0x22')](respondWithResult(_0x464a50,null))[_0x57b0('0x41')](handleError(_0x464a50,null));};exports['destroy']=function(_0x467731,_0x35ed98){return db[_0x57b0('0x2a')][_0x57b0('0x44')]({'where':{'id':_0x467731[_0x57b0('0x42')]['id']}})['then'](handleEntityNotFound(_0x35ed98,null))['then'](removeEntity(_0x35ed98,null))[_0x57b0('0x41')](handleError(_0x35ed98,null));};exports[_0x57b0('0x47')]=function(_0x22f0ae,_0x4b4b2a,_0x391e73){var _0x1688d4={};var _0x243f3c={};var _0x44a7d2;var _0xe3c067;return db[_0x57b0('0x2a')][_0x57b0('0x48')]({'where':{'id':_0x22f0ae[_0x57b0('0x42')]['id']}})[_0x57b0('0x22')](handleEntityNotFound(_0x4b4b2a,null))[_0x57b0('0x22')](function(_0x1350a0){if(_0x1350a0){_0x44a7d2=_0x1350a0;_0x243f3c[_0x57b0('0x2c')]=_[_0x57b0('0x43')](db[_0x57b0('0x49')][_0x57b0('0x4a')]);_0x243f3c[_0x57b0('0x2d')]=_[_0x57b0('0x43')](_0x22f0ae[_0x57b0('0x2d')]);_0x243f3c['filters']=_[_0x57b0('0x2f')](_0x243f3c[_0x57b0('0x2c')],_0x243f3c[_0x57b0('0x2d')]);_0x1688d4['attributes']=_['intersection'](_0x243f3c[_0x57b0('0x2c')],qs['fields'](_0x22f0ae['query'][_0x57b0('0x31')]));_0x1688d4['attributes']=_0x1688d4[_0x57b0('0x30')]['length']?_0x1688d4[_0x57b0('0x30')]:_0x243f3c[_0x57b0('0x2c')];_0x1688d4['order']=qs['sort'](_0x22f0ae[_0x57b0('0x2d')][_0x57b0('0x35')]);_0x1688d4['where']=qs[_0x57b0('0x2e')](_[_0x57b0('0x37')](_0x22f0ae[_0x57b0('0x2d')],_0x243f3c[_0x57b0('0x2e')]));if(_0x22f0ae['query'][_0x57b0('0x38')]){_0x1688d4[_0x57b0('0x36')]=_['merge'](_0x1688d4[_0x57b0('0x36')],{'$or':_[_0x57b0('0x3a')](_0x1688d4[_0x57b0('0x30')],function(_0x49675d){var _0x1f1fb6={};_0x1f1fb6[_0x49675d]={'$like':'%'+_0x22f0ae[_0x57b0('0x2d')][_0x57b0('0x38')]+'%'};return _0x1f1fb6;})});}_0x1688d4=_['merge']({},_0x1688d4,_0x22f0ae['options']);return _0x44a7d2[_0x57b0('0x47')](_0x1688d4);}})['then'](function(_0x2a1180){if(_0x2a1180){_0xe3c067=_0x2a1180['length'];if(!_0x22f0ae[_0x57b0('0x2d')]['hasOwnProperty']('nolimit')){_0x1688d4[_0x57b0('0x1a')]=qs[_0x57b0('0x1a')](_0x22f0ae['query']['limit']);_0x1688d4['offset']=qs[_0x57b0('0x18')](_0x22f0ae[_0x57b0('0x2d')][_0x57b0('0x18')]);}return _0x44a7d2[_0x57b0('0x47')](_0x1688d4);}})['then'](function(_0x47d772){if(_0x47d772){return _0x47d772?{'count':_0xe3c067,'rows':_0x47d772}:null;}})[_0x57b0('0x22')](respondWithResult(_0x4b4b2a,null))[_0x57b0('0x41')](handleError(_0x4b4b2a,null));};exports[_0x57b0('0x4b')]=function(_0x1102cb,_0x215b53,_0x4dbab3){if(_0x1102cb['body']['id']){delete _0x1102cb[_0x57b0('0x46')]['id'];}return db[_0x57b0('0x2a')][_0x57b0('0x48')]({'where':{'id':_0x1102cb[_0x57b0('0x42')]['id']}})[_0x57b0('0x22')](handleEntityNotFound(_0x215b53,null))['then'](function(_0x118d56){if(_0x118d56){_0x1102cb[_0x57b0('0x46')][_0x57b0('0x4c')]=_0x118d56['id'];_0x1102cb[_0x57b0('0x46')][_0x57b0('0x4d')]=integrations[_0x57b0('0x4e')](_0x1102cb['body']['channel'],_0x1102cb['body'][_0x57b0('0x4f')]);_0x1102cb[_0x57b0('0x46')]['Descriptions']=integrations[_0x57b0('0x50')](_0x1102cb[_0x57b0('0x46')][_0x57b0('0x51')],_0x1102cb[_0x57b0('0x46')]['type']);return db['FreshdeskConfiguration']['create'](_0x1102cb[_0x57b0('0x46')],{'include':[{'model':db[_0x57b0('0x52')],'as':_0x57b0('0x4d')},{'model':db['FreshdeskField'],'as':_0x57b0('0x53')}]});}return null;})['then'](respondWithResult(_0x215b53,null))['catch'](handleError(_0x215b53,null));};exports['getFields']=function(_0x189200,_0x58c9dd,_0x3363ed){var _0x9b131f='';return db[_0x57b0('0x2a')][_0x57b0('0x48')]({'where':{'id':_0x189200[_0x57b0('0x42')]['id']},'attributes':['id',_0x57b0('0x54'),_0x57b0('0x55')]})[_0x57b0('0x22')](handleEntityNotFound(_0x58c9dd,null))[_0x57b0('0x22')](function(_0x4e843b){if(_0x4e843b){_0x9b131f=_0x4e843b[_0x57b0('0x54')];var _0x1f14b7=_0x9b131f[_0x57b0('0x56')](-0x1);if(_0x1f14b7==='/'){_0x9b131f=_0x9b131f['substring'](0x0,_0x9b131f[_0x57b0('0x57')](_0x1f14b7));}return rp({'method':_0x57b0('0x58'),'uri':util[_0x57b0('0x59')](_0x57b0('0x5a'),_0x9b131f,_0x57b0('0x5b')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x57b0('0x59')](_0x57b0('0x5c'),_0x4e843b['apiKey']))[_0x57b0('0x5d')](_0x57b0('0x5e')))},'json':!![]});}})[_0x57b0('0x22')](function(_0x53aec2){if(_0x53aec2){var _0x52858c=[_0x57b0('0x5f'),'subject',_0x57b0('0x60'),_0x57b0('0x61'),_0x57b0('0x16'),_0x57b0('0x62'),_0x57b0('0x63'),_0x57b0('0x64'),_0x57b0('0x65'),_0x57b0('0x63'),'company'];_[_0x57b0('0x66')](_0x53aec2,function(_0x22a123){return _0x52858c[_0x57b0('0x67')](_0x22a123[_0x57b0('0x27')])||!_0x22a123['default']&&_0x22a123[_0x57b0('0x4f')]!==_0x57b0('0x68')&&_0x22a123['type']!==_0x57b0('0x69');});return{'count':_0x53aec2[_0x57b0('0x32')],'rows':_[_0x57b0('0x3a')](_0x53aec2,function(_0x3db1d8){return{'id':_0x3db1d8['name'],'name':_0x3db1d8['label'],'custom':!_0x3db1d8[_0x57b0('0x6a')],'options':_0x3db1d8[_0x57b0('0x6b')]?_[_0x57b0('0x3a')](_0x3db1d8[_0x57b0('0x6b')],function(_0x2de69c){return{'name':_[_0x57b0('0x6c')](_0x2de69c),'value':_0x2de69c};}):[]};})};}})[_0x57b0('0x22')](respondWithResult(_0x58c9dd,null))[_0x57b0('0x41')](function(_0x3018ce){var _0x255d3a=_0x189200[_0x57b0('0x2d')][_0x57b0('0x6d')]?0x1f4:_0x3018ce['statusCode']||0x1f4;logger[_0x57b0('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x57b0('0x6e'),_0x255d3a,JSON[_0x57b0('0x6f')](_0x3018ce));delete _0x3018ce[_0x57b0('0x27')];if(_0x255d3a===0x191){_0x255d3a=0x190;}_0x58c9dd[_0x57b0('0x16')](_0x255d3a)[_0x57b0('0x28')](_0x189200[_0x57b0('0x2d')][_0x57b0('0x6d')]?{'message':_0x57b0('0x70'),'statusCode':_0x3018ce['statusCode']}:_0x3018ce);});}; \ No newline at end of file +var _0xcea2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','catch','create','body','find','findOne','FreshdeskConfiguration','pick','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','slice','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x24496c,_0x54a634){var _0x434101=function(_0x301e58){while(--_0x301e58){_0x24496c['push'](_0x24496c['shift']());}};_0x434101(++_0x54a634);}(_0xcea2,0x15a));var _0x2cea=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xcea2[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x2cea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cea('0x2'));var moment=require(_0x2cea('0x3'));var BPromise=require(_0x2cea('0x4'));var Mustache=require('mustache');var util=require(_0x2cea('0x5'));var path=require(_0x2cea('0x6'));var sox=require(_0x2cea('0x7'));var csv=require('to-csv');var ejs=require(_0x2cea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0xe'));var querystring=require('querystring');var Papa=require(_0x2cea('0xf'));var Redis=require(_0x2cea('0x10'));var authService=require(_0x2cea('0x11'));var qs=require(_0x2cea('0x12'));var as=require(_0x2cea('0x13'));var hardwareService=require(_0x2cea('0x14'));var logger=require(_0x2cea('0x15'))(_0x2cea('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cea('0x17'));var db=require(_0x2cea('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4bd265,_0x160eaf){_0x160eaf=_0x160eaf||0xcc;return function(_0x4e0da7){if(_0x4e0da7){return _0x4bd265[_0x2cea('0x19')](_0x160eaf);}return _0x4bd265[_0x2cea('0x1a')](_0x160eaf)[_0x2cea('0x1b')]();};}function respondWithResult(_0x5cf805,_0x4d7f8b){_0x4d7f8b=_0x4d7f8b||0xc8;return function(_0x578c3e){if(_0x578c3e){return _0x5cf805[_0x2cea('0x1a')](_0x4d7f8b)['json'](_0x578c3e);}};}function respondWithFilteredResult(_0x3c7130,_0x338669){return function(_0x981e3f){if(_0x981e3f){var _0x17322c=typeof _0x338669[_0x2cea('0x1c')]===_0x2cea('0x1d')&&typeof _0x338669[_0x2cea('0x1e')]===_0x2cea('0x1d');var _0x5eee09=_0x981e3f[_0x2cea('0x1f')];var _0x464f7d=_0x17322c?0x0:_0x338669[_0x2cea('0x1c')];var _0x43ae15=_0x17322c?_0x981e3f[_0x2cea('0x1f')]:_0x338669[_0x2cea('0x1c')]+_0x338669['limit'];var _0x27375b;if(_0x43ae15>=_0x5eee09){_0x43ae15=_0x5eee09;_0x27375b=0xc8;}else{_0x27375b=0xce;}_0x3c7130['status'](_0x27375b);return _0x3c7130[_0x2cea('0x20')](_0x2cea('0x21'),_0x464f7d+'-'+_0x43ae15+'/'+_0x5eee09)[_0x2cea('0x22')](_0x981e3f);}return null;};}function patchUpdates(_0x4fd3d5){return function(_0x46a112){try{jsonpatch[_0x2cea('0x23')](_0x46a112,_0x4fd3d5,!![]);}catch(_0x210d7e){return BPromise[_0x2cea('0x24')](_0x210d7e);}return _0x46a112[_0x2cea('0x25')]();};}function saveUpdates(_0x3f6f0e,_0x10f13a){return function(_0x566ce2){if(_0x566ce2){return _0x566ce2[_0x2cea('0x26')](_0x3f6f0e)['then'](function(_0x7d88b9){return _0x7d88b9;});}return null;};}function removeEntity(_0x4926ff,_0x3966d5){return function(_0x18a394){if(_0x18a394){return _0x18a394['destroy']()[_0x2cea('0x27')](function(){_0x4926ff[_0x2cea('0x1a')](0xcc)[_0x2cea('0x1b')]();});}};}function handleEntityNotFound(_0xf0bfbe,_0x3f3ee0){return function(_0x79529b){if(!_0x79529b){_0xf0bfbe['sendStatus'](0x194);}return _0x79529b;};}function handleError(_0x4ec9b3,_0x32b6a3){_0x32b6a3=_0x32b6a3||0x1f4;return function(_0x2bbe9b){logger[_0x2cea('0x28')](_0x2bbe9b[_0x2cea('0x29')]);if(_0x2bbe9b[_0x2cea('0x2a')]){delete _0x2bbe9b[_0x2cea('0x2a')];}_0x4ec9b3[_0x2cea('0x1a')](_0x32b6a3)['send'](_0x2bbe9b);};}exports[_0x2cea('0x2b')]=function(_0x128863,_0x5f3fb4){var _0xfeb8bd={},_0xc398c5={},_0x271b2f={'count':0x0,'rows':[]};var _0x16cf9f=_['map'](db[_0x2cea('0x2c')][_0x2cea('0x2d')],function(_0x4a51e5){return{'name':_0x4a51e5[_0x2cea('0x2e')],'type':_0x4a51e5[_0x2cea('0x2f')][_0x2cea('0x30')]};});_0xc398c5[_0x2cea('0x31')]=_[_0x2cea('0x32')](_0x16cf9f,_0x2cea('0x2a'));_0xc398c5[_0x2cea('0x33')]=_[_0x2cea('0x34')](_0x128863[_0x2cea('0x33')]);_0xc398c5[_0x2cea('0x35')]=_[_0x2cea('0x36')](_0xc398c5['model'],_0xc398c5[_0x2cea('0x33')]);_0xfeb8bd[_0x2cea('0x37')]=_[_0x2cea('0x36')](_0xc398c5[_0x2cea('0x31')],qs['fields'](_0x128863['query'][_0x2cea('0x38')]));_0xfeb8bd[_0x2cea('0x37')]=_0xfeb8bd['attributes'][_0x2cea('0x39')]?_0xfeb8bd['attributes']:_0xc398c5[_0x2cea('0x31')];if(!_0x128863['query'][_0x2cea('0x3a')]('nolimit')){_0xfeb8bd[_0x2cea('0x1e')]=qs[_0x2cea('0x1e')](_0x128863['query'][_0x2cea('0x1e')]);_0xfeb8bd[_0x2cea('0x1c')]=qs['offset'](_0x128863[_0x2cea('0x33')][_0x2cea('0x1c')]);}_0xfeb8bd[_0x2cea('0x3b')]=qs[_0x2cea('0x3c')](_0x128863[_0x2cea('0x33')]['sort']);_0xfeb8bd[_0x2cea('0x3d')]=qs[_0x2cea('0x35')](_['pick'](_0x128863['query'],_0xc398c5[_0x2cea('0x35')]),_0x16cf9f);if(_0x128863['query']['filter']){_0xfeb8bd['where']=_['merge'](_0xfeb8bd[_0x2cea('0x3d')],{'$or':_[_0x2cea('0x32')](_0x16cf9f,function(_0x53d597){if(_0x53d597[_0x2cea('0x2f')]!==_0x2cea('0x3e')){var _0x249aaa={};_0x249aaa[_0x53d597['name']]={'$like':'%'+_0x128863[_0x2cea('0x33')][_0x2cea('0x3f')]+'%'};return _0x249aaa;}})});}_0xfeb8bd=_[_0x2cea('0x40')]({},_0xfeb8bd,_0x128863[_0x2cea('0x41')]);var _0x167e40={'where':_0xfeb8bd[_0x2cea('0x3d')]};return db[_0x2cea('0x2c')][_0x2cea('0x1f')](_0x167e40)[_0x2cea('0x27')](function(_0x27677c){_0x271b2f[_0x2cea('0x1f')]=_0x27677c;if(_0x128863[_0x2cea('0x33')][_0x2cea('0x42')]){_0xfeb8bd[_0x2cea('0x43')]=[{'all':!![]}];}return db[_0x2cea('0x2c')][_0x2cea('0x44')](_0xfeb8bd);})[_0x2cea('0x27')](function(_0xa0692d){_0x271b2f['rows']=_0xa0692d;return _0x271b2f;})[_0x2cea('0x27')](respondWithFilteredResult(_0x5f3fb4,_0xfeb8bd))['catch'](handleError(_0x5f3fb4,null));};exports[_0x2cea('0x45')]=function(_0x1afbb9,_0x22ce6b){var _0x5b5d71={'raw':![],'where':{'id':_0x1afbb9[_0x2cea('0x46')]['id']}},_0x2c703b={};_0x2c703b[_0x2cea('0x31')]=_[_0x2cea('0x34')](db[_0x2cea('0x2c')][_0x2cea('0x2d')]);_0x2c703b['query']=_['keys'](_0x1afbb9[_0x2cea('0x33')]);_0x2c703b[_0x2cea('0x35')]=_['intersection'](_0x2c703b[_0x2cea('0x31')],_0x2c703b['query']);_0x5b5d71[_0x2cea('0x37')]=_['intersection'](_0x2c703b[_0x2cea('0x31')],qs[_0x2cea('0x38')](_0x1afbb9[_0x2cea('0x33')][_0x2cea('0x38')]));_0x5b5d71[_0x2cea('0x37')]=_0x5b5d71[_0x2cea('0x37')][_0x2cea('0x39')]?_0x5b5d71[_0x2cea('0x37')]:_0x2c703b[_0x2cea('0x31')];if(_0x1afbb9[_0x2cea('0x33')]['includeAll']){_0x5b5d71[_0x2cea('0x43')]=[{'all':!![]}];}_0x5b5d71=_[_0x2cea('0x40')]({},_0x5b5d71,_0x1afbb9[_0x2cea('0x41')]);return db[_0x2cea('0x2c')]['find'](_0x5b5d71)['then'](handleEntityNotFound(_0x22ce6b,null))[_0x2cea('0x27')](respondWithResult(_0x22ce6b,null))[_0x2cea('0x47')](handleError(_0x22ce6b,null));};exports[_0x2cea('0x48')]=function(_0x510e0f,_0x2a5e20){return db[_0x2cea('0x2c')][_0x2cea('0x48')](_0x510e0f[_0x2cea('0x49')],{})['then'](respondWithResult(_0x2a5e20,0xc9))[_0x2cea('0x47')](handleError(_0x2a5e20,null));};exports['update']=function(_0x4d1b77,_0x42379a){if(_0x4d1b77[_0x2cea('0x49')]['id']){delete _0x4d1b77[_0x2cea('0x49')]['id'];}return db[_0x2cea('0x2c')]['find']({'where':{'id':_0x4d1b77['params']['id']}})[_0x2cea('0x27')](handleEntityNotFound(_0x42379a,null))[_0x2cea('0x27')](saveUpdates(_0x4d1b77[_0x2cea('0x49')],null))[_0x2cea('0x27')](respondWithResult(_0x42379a,null))['catch'](handleError(_0x42379a,null));};exports['destroy']=function(_0x5d7cb6,_0x31c559){return db[_0x2cea('0x2c')][_0x2cea('0x4a')]({'where':{'id':_0x5d7cb6[_0x2cea('0x46')]['id']}})[_0x2cea('0x27')](handleEntityNotFound(_0x31c559,null))[_0x2cea('0x27')](removeEntity(_0x31c559,null))[_0x2cea('0x47')](handleError(_0x31c559,null));};exports['getConfigurations']=function(_0x3f0fd0,_0x39937e,_0x3ccb9f){var _0x4b9f75={};var _0x103f18={};var _0x59dbbe;var _0x471147;return db[_0x2cea('0x2c')][_0x2cea('0x4b')]({'where':{'id':_0x3f0fd0[_0x2cea('0x46')]['id']}})[_0x2cea('0x27')](handleEntityNotFound(_0x39937e,null))[_0x2cea('0x27')](function(_0x33f411){if(_0x33f411){_0x59dbbe=_0x33f411;_0x103f18[_0x2cea('0x31')]=_['keys'](db[_0x2cea('0x4c')]['rawAttributes']);_0x103f18[_0x2cea('0x33')]=_[_0x2cea('0x34')](_0x3f0fd0[_0x2cea('0x33')]);_0x103f18['filters']=_[_0x2cea('0x36')](_0x103f18['model'],_0x103f18['query']);_0x4b9f75[_0x2cea('0x37')]=_[_0x2cea('0x36')](_0x103f18[_0x2cea('0x31')],qs[_0x2cea('0x38')](_0x3f0fd0[_0x2cea('0x33')]['fields']));_0x4b9f75['attributes']=_0x4b9f75[_0x2cea('0x37')][_0x2cea('0x39')]?_0x4b9f75[_0x2cea('0x37')]:_0x103f18[_0x2cea('0x31')];_0x4b9f75['order']=qs[_0x2cea('0x3c')](_0x3f0fd0['query'][_0x2cea('0x3c')]);_0x4b9f75[_0x2cea('0x3d')]=qs[_0x2cea('0x35')](_[_0x2cea('0x4d')](_0x3f0fd0[_0x2cea('0x33')],_0x103f18['filters']));if(_0x3f0fd0[_0x2cea('0x33')][_0x2cea('0x3f')]){_0x4b9f75[_0x2cea('0x3d')]=_[_0x2cea('0x40')](_0x4b9f75[_0x2cea('0x3d')],{'$or':_['map'](_0x4b9f75[_0x2cea('0x37')],function(_0x469601){var _0x511aa1={};_0x511aa1[_0x469601]={'$like':'%'+_0x3f0fd0[_0x2cea('0x33')][_0x2cea('0x3f')]+'%'};return _0x511aa1;})});}_0x4b9f75=_[_0x2cea('0x40')]({},_0x4b9f75,_0x3f0fd0[_0x2cea('0x41')]);return _0x59dbbe['getConfigurations'](_0x4b9f75);}})['then'](function(_0x1c53bf){if(_0x1c53bf){_0x471147=_0x1c53bf[_0x2cea('0x39')];if(!_0x3f0fd0['query'][_0x2cea('0x3a')](_0x2cea('0x4e'))){_0x4b9f75['limit']=qs[_0x2cea('0x1e')](_0x3f0fd0[_0x2cea('0x33')][_0x2cea('0x1e')]);_0x4b9f75[_0x2cea('0x1c')]=qs[_0x2cea('0x1c')](_0x3f0fd0['query'][_0x2cea('0x1c')]);}return _0x59dbbe[_0x2cea('0x4f')](_0x4b9f75);}})['then'](function(_0x28f6d8){if(_0x28f6d8){return _0x28f6d8?{'count':_0x471147,'rows':_0x28f6d8}:null;}})[_0x2cea('0x27')](respondWithResult(_0x39937e,null))[_0x2cea('0x47')](handleError(_0x39937e,null));};exports[_0x2cea('0x50')]=function(_0x36cc18,_0x2f37bc,_0xa57e5c){if(_0x36cc18[_0x2cea('0x49')]['id']){delete _0x36cc18[_0x2cea('0x49')]['id'];}return db[_0x2cea('0x2c')][_0x2cea('0x4b')]({'where':{'id':_0x36cc18[_0x2cea('0x46')]['id']}})[_0x2cea('0x27')](handleEntityNotFound(_0x2f37bc,null))['then'](function(_0x5c81b4){if(_0x5c81b4){_0x36cc18[_0x2cea('0x49')][_0x2cea('0x51')]=_0x5c81b4['id'];_0x36cc18[_0x2cea('0x49')][_0x2cea('0x52')]=integrations[_0x2cea('0x53')](_0x36cc18[_0x2cea('0x49')][_0x2cea('0x54')],_0x36cc18['body']['type']);_0x36cc18[_0x2cea('0x49')][_0x2cea('0x55')]=integrations[_0x2cea('0x56')](_0x36cc18['body']['channel'],_0x36cc18['body'][_0x2cea('0x2f')]);return db[_0x2cea('0x4c')]['create'](_0x36cc18['body'],{'include':[{'model':db[_0x2cea('0x57')],'as':_0x2cea('0x52')},{'model':db[_0x2cea('0x57')],'as':_0x2cea('0x55')}]});}return null;})[_0x2cea('0x27')](respondWithResult(_0x2f37bc,null))[_0x2cea('0x47')](handleError(_0x2f37bc,null));};exports[_0x2cea('0x58')]=function(_0x3a1242,_0x520061,_0x3c7055){var _0x4080bf='';return db[_0x2cea('0x2c')][_0x2cea('0x4b')]({'where':{'id':_0x3a1242[_0x2cea('0x46')]['id']},'attributes':['id','remoteUri',_0x2cea('0x59')]})[_0x2cea('0x27')](handleEntityNotFound(_0x520061,null))['then'](function(_0x10419c){if(_0x10419c){_0x4080bf=_0x10419c[_0x2cea('0x5a')];var _0xaeeba5=_0x4080bf[_0x2cea('0x5b')](-0x1);if(_0xaeeba5==='/'){_0x4080bf=_0x4080bf['substring'](0x0,_0x4080bf[_0x2cea('0x5c')](_0xaeeba5));}return rp({'method':_0x2cea('0x5d'),'uri':util[_0x2cea('0x5e')]('%s/%s',_0x4080bf,_0x2cea('0x5f')),'headers':{'Authorization':util[_0x2cea('0x5e')](_0x2cea('0x60'),new Buffer(util[_0x2cea('0x5e')](_0x2cea('0x61'),_0x10419c[_0x2cea('0x59')]))[_0x2cea('0x62')](_0x2cea('0x63')))},'json':!![]});}})[_0x2cea('0x27')](function(_0x4d9c3b){if(_0x4d9c3b){var _0x1112c6=[_0x2cea('0x64'),_0x2cea('0x65'),_0x2cea('0x66'),'description',_0x2cea('0x1a'),_0x2cea('0x67'),_0x2cea('0x68'),_0x2cea('0x69'),'ticket_type',_0x2cea('0x68'),_0x2cea('0x6a')];_[_0x2cea('0x6b')](_0x4d9c3b,function(_0x2ae3f1){return _0x1112c6[_0x2cea('0x6c')](_0x2ae3f1[_0x2cea('0x2a')])||!_0x2ae3f1[_0x2cea('0x6d')]&&_0x2ae3f1[_0x2cea('0x2f')]!==_0x2cea('0x6e')&&_0x2ae3f1[_0x2cea('0x2f')]!==_0x2cea('0x6f');});return{'count':_0x4d9c3b[_0x2cea('0x39')],'rows':_[_0x2cea('0x32')](_0x4d9c3b,function(_0x1efbd1){return{'id':_0x1efbd1['name'],'name':_0x1efbd1[_0x2cea('0x70')],'custom':!_0x1efbd1['default'],'options':_0x1efbd1[_0x2cea('0x71')]?_[_0x2cea('0x32')](_0x1efbd1[_0x2cea('0x71')],function(_0x3058ed){return{'name':_[_0x2cea('0x72')](_0x3058ed),'value':_0x3058ed};}):[]};})};}})['then'](respondWithResult(_0x520061,null))[_0x2cea('0x47')](function(_0x4ac911){var _0x5ddfba=_0x3a1242[_0x2cea('0x33')][_0x2cea('0x73')]?0x1f4:_0x4ac911[_0x2cea('0x74')]||0x1f4;logger['error'](_0x2cea('0x75'),_0x2cea('0x58'),_0x5ddfba,JSON[_0x2cea('0x76')](_0x4ac911));delete _0x4ac911[_0x2cea('0x2a')];if(_0x5ddfba===0x191){_0x5ddfba=0x190;}_0x520061['status'](_0x5ddfba)[_0x2cea('0x77')](_0x3a1242[_0x2cea('0x33')]['test']?{'message':_0x2cea('0x78'),'statusCode':_0x4ac911[_0x2cea('0x74')]}:_0x4ac911);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 387bcb2..7b8d137 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 _0x8aed=['int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x1335f2,_0x529711){var _0x4b7282=function(_0x1b7944){while(--_0x1b7944){_0x1335f2['push'](_0x1335f2['shift']());}};_0x4b7282(++_0x529711);}(_0x8aed,0x14b));var _0xd8ae=function(_0x55ab06,_0x40c53e){_0x55ab06=_0x55ab06-0x0;var _0x8cd2e0=_0x8aed[_0x55ab06];return _0x8cd2e0;};'use strict';var _=require(_0xd8ae('0x0'));var util=require(_0xd8ae('0x1'));var logger=require(_0xd8ae('0x2'))(_0xd8ae('0x3'));var moment=require('moment');var BPromise=require(_0xd8ae('0x4'));var rp=require(_0xd8ae('0x5'));var fs=require('fs');var path=require(_0xd8ae('0x6'));var rimraf=require(_0xd8ae('0x7'));var config=require(_0xd8ae('0x8'));var attributes=require(_0xd8ae('0x9'));var integrations=require(_0xd8ae('0xa'));module[_0xd8ae('0xb')]=function(_0xbf6609,_0x20e5a5){return _0xbf6609[_0xd8ae('0xc')](_0xd8ae('0xd'),attributes,{'tableName':_0xd8ae('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a69=['request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4740ed,_0x485e09){var _0x4a5d2d=function(_0x142869){while(--_0x142869){_0x4740ed['push'](_0x4740ed['shift']());}};_0x4a5d2d(++_0x485e09);}(_0x0a69,0xa3));var _0x90a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a69[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x90a6('0x0'));var util=require('util');var logger=require(_0x90a6('0x1'))(_0x90a6('0x2'));var moment=require(_0x90a6('0x3'));var BPromise=require(_0x90a6('0x4'));var rp=require(_0x90a6('0x5'));var fs=require('fs');var path=require(_0x90a6('0x6'));var rimraf=require(_0x90a6('0x7'));var config=require(_0x90a6('0x8'));var attributes=require(_0x90a6('0x9'));var integrations=require(_0x90a6('0xa'));module['exports']=function(_0x5d3a9d,_0x42a474){return _0x5d3a9d[_0x90a6('0xb')](_0x90a6('0xc'),attributes,{'tableName':_0x90a6('0xd'),'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 8cdb501..4f309f0 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 _0xcb8b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','info','ShowFreshdeskAccount','stringify','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xcb8b,0xc7));var _0xbcb8=function(_0x48f39b,_0x5c4e90){_0x48f39b=_0x48f39b-0x0;var _0x5422a3=_0xcb8b[_0x48f39b];return _0x5422a3;};'use strict';var _=require('lodash');var util=require(_0xbcb8('0x0'));var moment=require(_0xbcb8('0x1'));var BPromise=require('bluebird');var rs=require(_0xbcb8('0x2'));var fs=require('fs');var Redis=require(_0xbcb8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbcb8('0x4'));var logger=require(_0xbcb8('0x5'))(_0xbcb8('0x6'));var config=require(_0xbcb8('0x7'));var jayson=require(_0xbcb8('0x8'));var client=jayson[_0xbcb8('0x9')][_0xbcb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35d35c,_0x2b65c3,_0x2fef89){return new BPromise(function(_0xd5e583,_0x5247c5){return client[_0xbcb8('0xb')](_0x35d35c,_0x2fef89)[_0xbcb8('0xc')](function(_0x52a440){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2b65c3,'request\x20sent');logger[_0xbcb8('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2b65c3,_0xbcb8('0xe'),JSON['stringify'](_0x52a440));if(_0x52a440[_0xbcb8('0xf')]){if(_0x52a440['error'][_0xbcb8('0x10')]===0x1f4){logger[_0xbcb8('0xf')](_0xbcb8('0x11'),_0x2b65c3,_0x52a440[_0xbcb8('0xf')][_0xbcb8('0x12')]);return _0x5247c5(_0x52a440['error'][_0xbcb8('0x12')]);}logger[_0xbcb8('0xf')](_0xbcb8('0x11'),_0x2b65c3,_0x52a440[_0xbcb8('0xf')]['message']);return _0xd5e583(_0x52a440[_0xbcb8('0xf')][_0xbcb8('0x12')]);}else{logger['info'](_0xbcb8('0x11'),_0x2b65c3,_0xbcb8('0xe'));_0xd5e583(_0x52a440['result'][_0xbcb8('0x12')]);}})[_0xbcb8('0x13')](function(_0x5de2c0){logger['error'](_0xbcb8('0x11'),_0x2b65c3,_0x5de2c0);_0x5247c5(_0x5de2c0);});});}exports[_0xbcb8('0x14')]=function(_0x53006b){var _0x26132b=this;return new Promise(function(_0x3cb886,_0x344c7f){return db[_0xbcb8('0x15')][_0xbcb8('0x16')]({'raw':_0x53006b[_0xbcb8('0x17')]?_0x53006b[_0xbcb8('0x17')][_0xbcb8('0x18')]===undefined?!![]:![]:!![],'where':_0x53006b[_0xbcb8('0x17')]?_0x53006b['options'][_0xbcb8('0x19')]||null:null,'attributes':_0x53006b[_0xbcb8('0x17')]?_0x53006b['options']['attributes']||null:null,'limit':_0x53006b[_0xbcb8('0x17')]?_0x53006b[_0xbcb8('0x17')][_0xbcb8('0x1a')]||null:null,'include':_0x53006b[_0xbcb8('0x17')]?_0x53006b[_0xbcb8('0x17')][_0xbcb8('0x1b')]?_['map'](_0x53006b[_0xbcb8('0x17')]['include'],function(_0x24006b){return{'model':db[_0x24006b['model']],'as':_0x24006b['as'],'attributes':_0x24006b['attributes'],'include':_0x24006b[_0xbcb8('0x1b')]?_[_0xbcb8('0x1c')](_0x24006b[_0xbcb8('0x1b')],function(_0x2dbf54){return{'model':db[_0x2dbf54[_0xbcb8('0x1d')]],'as':_0x2dbf54['as'],'attributes':_0x2dbf54[_0xbcb8('0x1e')],'include':_0x2dbf54['include']?_[_0xbcb8('0x1c')](_0x2dbf54[_0xbcb8('0x1b')],function(_0x502f55){return{'model':db[_0x502f55[_0xbcb8('0x1d')]],'as':_0x502f55['as'],'attributes':_0x502f55['attributes']};}):[]};}):[]};}):[]:[]})[_0xbcb8('0xc')](function(_0x520112){logger[_0xbcb8('0x1f')](_0xbcb8('0x14'),_0x53006b);logger[_0xbcb8('0xd')]('GetFreshdeskAccount',_0x53006b,JSON['stringify'](_0x520112));_0x3cb886(_0x520112);})['catch'](function(_0x1935bc){logger['error'](_0xbcb8('0x14'),_0x1935bc[_0xbcb8('0x12')],_0x53006b);_0x344c7f(_0x26132b[_0xbcb8('0xf')](0x1f4,_0x1935bc['message']));});});};exports[_0xbcb8('0x20')]=function(_0x42759c){var _0x50bda3=this;return new Promise(function(_0x1be7ed,_0x41f0b5){return db[_0xbcb8('0x15')]['find']({'raw':_0x42759c['options']?_0x42759c['options'][_0xbcb8('0x18')]===undefined?!![]:![]:!![],'where':_0x42759c[_0xbcb8('0x17')]?_0x42759c['options'][_0xbcb8('0x19')]||null:null,'attributes':_0x42759c['options']?_0x42759c['options'][_0xbcb8('0x1e')]||null:null,'include':_0x42759c[_0xbcb8('0x17')]?_0x42759c['options'][_0xbcb8('0x1b')]?_[_0xbcb8('0x1c')](_0x42759c[_0xbcb8('0x17')]['include'],function(_0x1295c8){return{'model':db[_0x1295c8[_0xbcb8('0x1d')]],'as':_0x1295c8['as'],'attributes':_0x1295c8['attributes'],'include':_0x1295c8[_0xbcb8('0x1b')]?_[_0xbcb8('0x1c')](_0x1295c8[_0xbcb8('0x1b')],function(_0x150c5d){return{'model':db[_0x150c5d['model']],'as':_0x150c5d['as'],'attributes':_0x150c5d[_0xbcb8('0x1e')],'include':_0x150c5d[_0xbcb8('0x1b')]?_[_0xbcb8('0x1c')](_0x150c5d['include'],function(_0x4311d3){return{'model':db[_0x4311d3[_0xbcb8('0x1d')]],'as':_0x4311d3['as'],'attributes':_0x4311d3[_0xbcb8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbcb8('0xc')](function(_0x1b60ea){logger[_0xbcb8('0x1f')](_0xbcb8('0x20'),_0x42759c);logger[_0xbcb8('0xd')](_0xbcb8('0x20'),_0x42759c,JSON[_0xbcb8('0x21')](_0x1b60ea));_0x1be7ed(_0x1b60ea);})['catch'](function(_0x35039e){logger[_0xbcb8('0xf')](_0xbcb8('0x20'),_0x35039e[_0xbcb8('0x12')],_0x42759c);_0x41f0b5(_0x50bda3['error'](0x1f4,_0x35039e[_0xbcb8('0x12')]));});});}; \ No newline at end of file +var _0x2eb6=['map','model','catch','FreshdeskAccount','where','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','info','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include'];(function(_0x2233bc,_0x2e2916){var _0x5ea8e2=function(_0xe6db5a){while(--_0xe6db5a){_0x2233bc['push'](_0x2233bc['shift']());}};_0x5ea8e2(++_0x2e2916);}(_0x2eb6,0x102));var _0x62eb=function(_0x45130e,_0x4387d0){_0x45130e=_0x45130e-0x0;var _0x5226ff=_0x2eb6[_0x45130e];return _0x5226ff;};'use strict';var _=require(_0x62eb('0x0'));var util=require(_0x62eb('0x1'));var moment=require(_0x62eb('0x2'));var BPromise=require(_0x62eb('0x3'));var rs=require(_0x62eb('0x4'));var fs=require('fs');var Redis=require(_0x62eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x62eb('0x6'));var logger=require(_0x62eb('0x7'))(_0x62eb('0x8'));var config=require(_0x62eb('0x9'));var jayson=require(_0x62eb('0xa'));var client=jayson[_0x62eb('0xb')][_0x62eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c8a78,_0xccf5c,_0x206709){return new BPromise(function(_0x36f110,_0x57fc54){return client['request'](_0x1c8a78,_0x206709)[_0x62eb('0xd')](function(_0x3fa837){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xccf5c,_0x62eb('0xe'));logger[_0x62eb('0xf')](_0x62eb('0x10'),_0xccf5c,'request\x20sent',JSON[_0x62eb('0x11')](_0x3fa837));if(_0x3fa837[_0x62eb('0x12')]){if(_0x3fa837[_0x62eb('0x12')][_0x62eb('0x13')]===0x1f4){logger[_0x62eb('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0xccf5c,_0x3fa837[_0x62eb('0x12')][_0x62eb('0x14')]);return _0x57fc54(_0x3fa837[_0x62eb('0x12')][_0x62eb('0x14')]);}logger[_0x62eb('0x12')](_0x62eb('0x15'),_0xccf5c,_0x3fa837[_0x62eb('0x12')]['message']);return _0x36f110(_0x3fa837[_0x62eb('0x12')][_0x62eb('0x14')]);}else{logger[_0x62eb('0x16')]('FreshdeskAccount,\x20%s,\x20%s',_0xccf5c,_0x62eb('0xe'));_0x36f110(_0x3fa837['result']['message']);}})['catch'](function(_0x5b7668){logger['error'](_0x62eb('0x15'),_0xccf5c,_0x5b7668);_0x57fc54(_0x5b7668);});});}exports[_0x62eb('0x17')]=function(_0x2d510c){var _0xb9d792=this;return new Promise(function(_0x30f579,_0x34b680){return db['FreshdeskAccount'][_0x62eb('0x18')]({'raw':_0x2d510c[_0x62eb('0x19')]?_0x2d510c[_0x62eb('0x19')][_0x62eb('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d510c['options']?_0x2d510c[_0x62eb('0x19')]['where']||null:null,'attributes':_0x2d510c[_0x62eb('0x19')]?_0x2d510c[_0x62eb('0x19')][_0x62eb('0x1b')]||null:null,'limit':_0x2d510c['options']?_0x2d510c['options'][_0x62eb('0x1c')]||null:null,'include':_0x2d510c[_0x62eb('0x19')]?_0x2d510c[_0x62eb('0x19')][_0x62eb('0x1d')]?_[_0x62eb('0x1e')](_0x2d510c['options'][_0x62eb('0x1d')],function(_0x308cfe){return{'model':db[_0x308cfe[_0x62eb('0x1f')]],'as':_0x308cfe['as'],'attributes':_0x308cfe[_0x62eb('0x1b')],'include':_0x308cfe['include']?_[_0x62eb('0x1e')](_0x308cfe[_0x62eb('0x1d')],function(_0x50dab1){return{'model':db[_0x50dab1[_0x62eb('0x1f')]],'as':_0x50dab1['as'],'attributes':_0x50dab1[_0x62eb('0x1b')],'include':_0x50dab1[_0x62eb('0x1d')]?_['map'](_0x50dab1[_0x62eb('0x1d')],function(_0x387466){return{'model':db[_0x387466['model']],'as':_0x387466['as'],'attributes':_0x387466[_0x62eb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x62eb('0xd')](function(_0xb8eb24){logger[_0x62eb('0x16')](_0x62eb('0x17'),_0x2d510c);logger[_0x62eb('0xf')](_0x62eb('0x17'),_0x2d510c,JSON['stringify'](_0xb8eb24));_0x30f579(_0xb8eb24);})[_0x62eb('0x20')](function(_0x2a617d){logger[_0x62eb('0x12')](_0x62eb('0x17'),_0x2a617d['message'],_0x2d510c);_0x34b680(_0xb9d792[_0x62eb('0x12')](0x1f4,_0x2a617d[_0x62eb('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x579733){var _0x5b0bbd=this;return new Promise(function(_0x3cd236,_0x4d431e){return db[_0x62eb('0x21')]['find']({'raw':_0x579733['options']?_0x579733['options'][_0x62eb('0x1a')]===undefined?!![]:![]:!![],'where':_0x579733['options']?_0x579733[_0x62eb('0x19')][_0x62eb('0x22')]||null:null,'attributes':_0x579733[_0x62eb('0x19')]?_0x579733[_0x62eb('0x19')][_0x62eb('0x1b')]||null:null,'include':_0x579733[_0x62eb('0x19')]?_0x579733[_0x62eb('0x19')][_0x62eb('0x1d')]?_[_0x62eb('0x1e')](_0x579733[_0x62eb('0x19')]['include'],function(_0x2f5abd){return{'model':db[_0x2f5abd[_0x62eb('0x1f')]],'as':_0x2f5abd['as'],'attributes':_0x2f5abd[_0x62eb('0x1b')],'include':_0x2f5abd['include']?_[_0x62eb('0x1e')](_0x2f5abd['include'],function(_0x1231ee){return{'model':db[_0x1231ee[_0x62eb('0x1f')]],'as':_0x1231ee['as'],'attributes':_0x1231ee['attributes'],'include':_0x1231ee[_0x62eb('0x1d')]?_[_0x62eb('0x1e')](_0x1231ee[_0x62eb('0x1d')],function(_0x502caf){return{'model':db[_0x502caf[_0x62eb('0x1f')]],'as':_0x502caf['as'],'attributes':_0x502caf[_0x62eb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x62eb('0xd')](function(_0x14ca9d){logger[_0x62eb('0x16')](_0x62eb('0x23'),_0x579733);logger['debug']('ShowFreshdeskAccount',_0x579733,JSON['stringify'](_0x14ca9d));_0x3cd236(_0x14ca9d);})[_0x62eb('0x20')](function(_0x456e32){logger[_0x62eb('0x12')](_0x62eb('0x23'),_0x456e32[_0x62eb('0x14')],_0x579733);_0x4d431e(_0x5b0bbd[_0x62eb('0x12')](0x1f4,_0x456e32[_0x62eb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ccf67e0..718cbfd 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 _0x5165=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','put'];(function(_0x35768c,_0x2412b1){var _0x3c0e69=function(_0x19ffea){while(--_0x19ffea){_0x35768c['push'](_0x35768c['shift']());}};_0x3c0e69(++_0x2412b1);}(_0x5165,0x162));var _0x5516=function(_0xb3d4ec,_0x4ff9e7){_0xb3d4ec=_0xb3d4ec-0x0;var _0x4d1ccb=_0x5165[_0xb3d4ec];return _0x4d1ccb;};'use strict';var multer=require('multer');var util=require(_0x5516('0x0'));var path=require(_0x5516('0x1'));var timeout=require(_0x5516('0x2'));var express=require(_0x5516('0x3'));var router=express[_0x5516('0x4')]();var fs_extra=require(_0x5516('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5516('0x6'));var config=require(_0x5516('0x7'));var controller=require(_0x5516('0x8'));router[_0x5516('0x9')]('/',auth[_0x5516('0xa')](),controller['index']);router[_0x5516('0x9')](_0x5516('0xb'),auth[_0x5516('0xa')](),controller['show']);router[_0x5516('0x9')](_0x5516('0xc'),auth['isAuthenticated'](),controller[_0x5516('0xd')]);router[_0x5516('0x9')](_0x5516('0xe'),auth[_0x5516('0xa')](),controller['getSubjects']);router[_0x5516('0x9')](_0x5516('0xf'),auth[_0x5516('0xa')](),controller[_0x5516('0x10')]);router[_0x5516('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5516('0x11')]);router[_0x5516('0x12')]('/',auth[_0x5516('0xa')](),controller['create']);router[_0x5516('0x12')](_0x5516('0x13'),auth[_0x5516('0xa')](),controller['setTags']);router[_0x5516('0x14')](_0x5516('0xb'),auth[_0x5516('0xa')](),controller[_0x5516('0x15')]);router[_0x5516('0x16')]('/:id',auth[_0x5516('0xa')](),controller[_0x5516('0x17')]);module[_0x5516('0x18')]=router; \ No newline at end of file +var _0x8ef3=['fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','/:id/tags','setTags','/:id','update','delete','multer','util','path','connect-timeout'];(function(_0x3ea379,_0x5869a3){var _0x689a55=function(_0x2b6647){while(--_0x2b6647){_0x3ea379['push'](_0x3ea379['shift']());}};_0x689a55(++_0x5869a3);}(_0x8ef3,0xcb));var _0x38ef=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8ef3[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x38ef('0x0'));var util=require(_0x38ef('0x1'));var path=require(_0x38ef('0x2'));var timeout=require(_0x38ef('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x38ef('0x4'));var auth=require(_0x38ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x38ef('0x6'));var controller=require(_0x38ef('0x7'));router[_0x38ef('0x8')]('/',auth[_0x38ef('0x9')](),controller[_0x38ef('0xa')]);router[_0x38ef('0x8')]('/:id',auth[_0x38ef('0x9')](),controller[_0x38ef('0xb')]);router[_0x38ef('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x38ef('0xc')]);router[_0x38ef('0x8')](_0x38ef('0xd'),auth[_0x38ef('0x9')](),controller[_0x38ef('0xe')]);router[_0x38ef('0x8')](_0x38ef('0xf'),auth[_0x38ef('0x9')](),controller[_0x38ef('0x10')]);router[_0x38ef('0x8')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x38ef('0x9')](),controller['create']);router[_0x38ef('0x11')](_0x38ef('0x12'),auth[_0x38ef('0x9')](),controller[_0x38ef('0x13')]);router['put'](_0x38ef('0x14'),auth[_0x38ef('0x9')](),controller[_0x38ef('0x15')]);router[_0x38ef('0x16')](_0x38ef('0x14'),auth[_0x38ef('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index fe5486c..d633647 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 _0x03af=['sequelize','exports'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x03af,0xd4));var _0xf03a=function(_0x133a4a,_0x4987d8){_0x133a4a=_0x133a4a-0x0;var _0x1f69d0=_0x03af[_0x133a4a];return _0x1f69d0;};'use strict';var Sequelize=require(_0xf03a('0x0'));module[_0xf03a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde54=['STRING'];(function(_0x55158a,_0x215746){var _0x558e10=function(_0x8f30ba){while(--_0x8f30ba){_0x55158a['push'](_0x55158a['shift']());}};_0x558e10(++_0x215746);}(_0xde54,0xd7));var _0x4de5=function(_0x4d2d73,_0x5498aa){_0x4d2d73=_0x4d2d73-0x0;var _0x113547=_0xde54[_0x4d2d73];return _0x113547;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4de5('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 48c0f6c..7371d8c 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 _0x10f2=['intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','FreshdeskField','length','pick','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','filters'];(function(_0x3b01f1,_0x35606c){var _0x4bfef9=function(_0x526dca){while(--_0x526dca){_0x3b01f1['push'](_0x3b01f1['shift']());}};_0x4bfef9(++_0x35606c);}(_0x10f2,0xc6));var _0x210f=function(_0x35e58b,_0x373e34){_0x35e58b=_0x35e58b-0x0;var _0x432710=_0x10f2[_0x35e58b];return _0x432710;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x210f('0x0'));var zipdir=require(_0x210f('0x1'));var jsonpatch=require(_0x210f('0x2'));var rp=require(_0x210f('0x3'));var moment=require('moment');var BPromise=require(_0x210f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x210f('0x5'));var sox=require(_0x210f('0x6'));var csv=require(_0x210f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x210f('0x8'));var squel=require(_0x210f('0x9'));var crypto=require(_0x210f('0xa'));var jsforce=require(_0x210f('0xb'));var deskjs=require(_0x210f('0xc'));var toCsv=require(_0x210f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x210f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x210f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x210f('0xf'));var logger=require(_0x210f('0x10'))(_0x210f('0x11'));var utils=require(_0x210f('0x12'));var config=require(_0x210f('0x13'));var licenseUtil=require(_0x210f('0x14'));var db=require(_0x210f('0x15'))['db'];function respondWithStatusCode(_0x54877a,_0x55eea2){_0x55eea2=_0x55eea2||0xcc;return function(_0x4f88b5){if(_0x4f88b5){return _0x54877a[_0x210f('0x16')](_0x55eea2);}return _0x54877a[_0x210f('0x17')](_0x55eea2)[_0x210f('0x18')]();};}function respondWithResult(_0x574198,_0x17fc2e){_0x17fc2e=_0x17fc2e||0xc8;return function(_0x4930af){if(_0x4930af){return _0x574198['status'](_0x17fc2e)[_0x210f('0x19')](_0x4930af);}};}function respondWithFilteredResult(_0x1cb54a,_0x34a43c){return function(_0x1865d5){if(_0x1865d5){var _0x1bff5d=typeof _0x34a43c[_0x210f('0x1a')]==='undefined'&&typeof _0x34a43c[_0x210f('0x1b')]===_0x210f('0x1c');var _0xa83803=_0x1865d5[_0x210f('0x1d')];var _0x592a75=_0x1bff5d?0x0:_0x34a43c['offset'];var _0x26e81b=_0x1bff5d?_0x1865d5[_0x210f('0x1d')]:_0x34a43c['offset']+_0x34a43c[_0x210f('0x1b')];var _0x37d156;if(_0x26e81b>=_0xa83803){_0x26e81b=_0xa83803;_0x37d156=0xc8;}else{_0x37d156=0xce;}_0x1cb54a['status'](_0x37d156);return _0x1cb54a[_0x210f('0x1e')]('Content-Range',_0x592a75+'-'+_0x26e81b+'/'+_0xa83803)[_0x210f('0x19')](_0x1865d5);}return null;};}function patchUpdates(_0x3904ce){return function(_0x440f89){try{jsonpatch['apply'](_0x440f89,_0x3904ce,!![]);}catch(_0xaf9890){return BPromise[_0x210f('0x1f')](_0xaf9890);}return _0x440f89[_0x210f('0x20')]();};}function saveUpdates(_0x22711c,_0x2335af){return function(_0x26aef9){if(_0x26aef9){return _0x26aef9[_0x210f('0x21')](_0x22711c)[_0x210f('0x22')](function(_0x4be003){return _0x4be003;});}return null;};}function removeEntity(_0x4d19d1,_0x227201){return function(_0x1122a9){if(_0x1122a9){return _0x1122a9[_0x210f('0x23')]()[_0x210f('0x22')](function(){_0x4d19d1[_0x210f('0x17')](0xcc)[_0x210f('0x18')]();});}};}function handleEntityNotFound(_0x184757,_0xd8da0b){return function(_0x456a0e){if(!_0x456a0e){_0x184757['sendStatus'](0x194);}return _0x456a0e;};}function handleError(_0x2540d0,_0x3bb213){_0x3bb213=_0x3bb213||0x1f4;return function(_0x208ea7){logger[_0x210f('0x24')](_0x208ea7[_0x210f('0x25')]);if(_0x208ea7[_0x210f('0x26')]){delete _0x208ea7['name'];}_0x2540d0['status'](_0x3bb213)['send'](_0x208ea7);};}exports[_0x210f('0x27')]=function(_0x576d0a,_0x28d55c){var _0x5a1600={},_0x51654a={},_0x29a611={'count':0x0,'rows':[]};var _0x433b2a=_[_0x210f('0x28')](db[_0x210f('0x29')][_0x210f('0x2a')],function(_0x3e52f0){return{'name':_0x3e52f0[_0x210f('0x2b')],'type':_0x3e52f0[_0x210f('0x2c')][_0x210f('0x2d')]};});_0x51654a['model']=_[_0x210f('0x28')](_0x433b2a,'name');_0x51654a[_0x210f('0x2e')]=_['keys'](_0x576d0a[_0x210f('0x2e')]);_0x51654a[_0x210f('0x2f')]=_[_0x210f('0x30')](_0x51654a[_0x210f('0x31')],_0x51654a['query']);_0x5a1600[_0x210f('0x32')]=_[_0x210f('0x30')](_0x51654a[_0x210f('0x31')],qs[_0x210f('0x33')](_0x576d0a['query'][_0x210f('0x33')]));_0x5a1600[_0x210f('0x32')]=_0x5a1600[_0x210f('0x32')]['length']?_0x5a1600[_0x210f('0x32')]:_0x51654a[_0x210f('0x31')];if(!_0x576d0a[_0x210f('0x2e')][_0x210f('0x34')](_0x210f('0x35'))){_0x5a1600[_0x210f('0x1b')]=qs[_0x210f('0x1b')](_0x576d0a[_0x210f('0x2e')][_0x210f('0x1b')]);_0x5a1600[_0x210f('0x1a')]=qs[_0x210f('0x1a')](_0x576d0a[_0x210f('0x2e')]['offset']);}_0x5a1600[_0x210f('0x36')]=qs[_0x210f('0x37')](_0x576d0a[_0x210f('0x2e')][_0x210f('0x37')]);_0x5a1600[_0x210f('0x38')]=qs[_0x210f('0x2f')](_['pick'](_0x576d0a[_0x210f('0x2e')],_0x51654a[_0x210f('0x2f')]),_0x433b2a);if(_0x576d0a['query'][_0x210f('0x39')]){_0x5a1600[_0x210f('0x38')]=_[_0x210f('0x3a')](_0x5a1600[_0x210f('0x38')],{'$or':_[_0x210f('0x28')](_0x433b2a,function(_0x51bb97){if(_0x51bb97[_0x210f('0x2c')]!==_0x210f('0x3b')){var _0x83bf97={};_0x83bf97[_0x51bb97[_0x210f('0x26')]]={'$like':'%'+_0x576d0a['query'][_0x210f('0x39')]+'%'};return _0x83bf97;}})});}_0x5a1600=_[_0x210f('0x3a')]({},_0x5a1600,_0x576d0a['options']);var _0x3be927={'where':_0x5a1600[_0x210f('0x38')]};return db[_0x210f('0x29')][_0x210f('0x1d')](_0x3be927)[_0x210f('0x22')](function(_0x39a638){_0x29a611[_0x210f('0x1d')]=_0x39a638;if(_0x576d0a[_0x210f('0x2e')][_0x210f('0x3c')]){_0x5a1600[_0x210f('0x3d')]=[{'all':!![]}];}return db[_0x210f('0x29')][_0x210f('0x3e')](_0x5a1600);})['then'](function(_0x1fe334){_0x29a611[_0x210f('0x3f')]=_0x1fe334;return _0x29a611;})[_0x210f('0x22')](respondWithFilteredResult(_0x28d55c,_0x5a1600))[_0x210f('0x40')](handleError(_0x28d55c,null));};exports[_0x210f('0x41')]=function(_0x1a48a1,_0x11ae84){var _0x194b1f={'raw':![],'where':{'id':_0x1a48a1['params']['id']}},_0x14a1f2={};_0x14a1f2[_0x210f('0x31')]=_[_0x210f('0x42')](db['FreshdeskConfiguration'][_0x210f('0x2a')]);_0x14a1f2[_0x210f('0x2e')]=_[_0x210f('0x42')](_0x1a48a1[_0x210f('0x2e')]);_0x14a1f2['filters']=_[_0x210f('0x30')](_0x14a1f2['model'],_0x14a1f2[_0x210f('0x2e')]);_0x194b1f[_0x210f('0x32')]=_['intersection'](_0x14a1f2[_0x210f('0x31')],qs[_0x210f('0x33')](_0x1a48a1[_0x210f('0x2e')][_0x210f('0x33')]));_0x194b1f[_0x210f('0x32')]=_0x194b1f[_0x210f('0x32')]['length']?_0x194b1f[_0x210f('0x32')]:_0x14a1f2[_0x210f('0x31')];if(_0x1a48a1['query'][_0x210f('0x3c')]){_0x194b1f['include']=[{'all':!![]}];}_0x194b1f=_[_0x210f('0x3a')]({},_0x194b1f,_0x1a48a1[_0x210f('0x43')]);return db[_0x210f('0x29')][_0x210f('0x44')](_0x194b1f)[_0x210f('0x22')](handleEntityNotFound(_0x11ae84,null))[_0x210f('0x22')](respondWithResult(_0x11ae84,null))[_0x210f('0x40')](handleError(_0x11ae84,null));};exports['create']=function(_0x4eb6a8,_0x1e1730){return db[_0x210f('0x29')][_0x210f('0x45')](_0x4eb6a8[_0x210f('0x46')],{})[_0x210f('0x22')](respondWithResult(_0x1e1730,0xc9))[_0x210f('0x40')](handleError(_0x1e1730,null));};exports[_0x210f('0x21')]=function(_0x3d328c,_0x555ce1){if(_0x3d328c[_0x210f('0x46')]['id']){delete _0x3d328c['body']['id'];}return db[_0x210f('0x29')][_0x210f('0x44')]({'where':{'id':_0x3d328c[_0x210f('0x47')]['id']}})[_0x210f('0x22')](handleEntityNotFound(_0x555ce1,null))['then'](saveUpdates(_0x3d328c['body'],null))[_0x210f('0x22')](respondWithResult(_0x555ce1,null))[_0x210f('0x40')](handleError(_0x555ce1,null));};exports[_0x210f('0x23')]=function(_0x16f7a3,_0xc6374){return db['FreshdeskConfiguration'][_0x210f('0x44')]({'where':{'id':_0x16f7a3['params']['id']}})[_0x210f('0x22')](handleEntityNotFound(_0xc6374,null))[_0x210f('0x22')](removeEntity(_0xc6374,null))['catch'](handleError(_0xc6374,null));};exports['getFields']=function(_0x55536e,_0x555219,_0x55d05c){var _0x4bffd6={};var _0x172682={};var _0x38af22;var _0x1158be;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x55536e['params']['id']}})[_0x210f('0x22')](handleEntityNotFound(_0x555219,null))[_0x210f('0x22')](function(_0xf723ba){if(_0xf723ba){_0x38af22=_0xf723ba;_0x172682[_0x210f('0x31')]=_['keys'](db[_0x210f('0x48')][_0x210f('0x2a')]);_0x172682['query']=_[_0x210f('0x42')](_0x55536e[_0x210f('0x2e')]);_0x172682[_0x210f('0x2f')]=_[_0x210f('0x30')](_0x172682[_0x210f('0x31')],_0x172682['query']);_0x4bffd6[_0x210f('0x32')]=_['intersection'](_0x172682[_0x210f('0x31')],qs[_0x210f('0x33')](_0x55536e[_0x210f('0x2e')]['fields']));_0x4bffd6['attributes']=_0x4bffd6['attributes'][_0x210f('0x49')]?_0x4bffd6[_0x210f('0x32')]:_0x172682[_0x210f('0x31')];_0x4bffd6[_0x210f('0x36')]=qs['sort'](_0x55536e[_0x210f('0x2e')][_0x210f('0x37')]);_0x4bffd6[_0x210f('0x38')]=qs[_0x210f('0x2f')](_[_0x210f('0x4a')](_0x55536e[_0x210f('0x2e')],_0x172682[_0x210f('0x2f')]));if(_0x55536e['query'][_0x210f('0x39')]){_0x4bffd6[_0x210f('0x38')]=_[_0x210f('0x3a')](_0x4bffd6['where'],{'$or':_[_0x210f('0x28')](_0x4bffd6[_0x210f('0x32')],function(_0x5a9e23){var _0x275a10={};_0x275a10[_0x5a9e23]={'$like':'%'+_0x55536e[_0x210f('0x2e')][_0x210f('0x39')]+'%'};return _0x275a10;})});}_0x4bffd6=_['merge']({},_0x4bffd6,_0x55536e[_0x210f('0x43')]);return _0x38af22[_0x210f('0x4b')](_0x4bffd6);}})['then'](function(_0x5c2065){if(_0x5c2065){_0x1158be=_0x5c2065[_0x210f('0x49')];if(!_0x55536e[_0x210f('0x2e')][_0x210f('0x34')](_0x210f('0x35'))){_0x4bffd6[_0x210f('0x1b')]=qs['limit'](_0x55536e['query'][_0x210f('0x1b')]);_0x4bffd6[_0x210f('0x1a')]=qs[_0x210f('0x1a')](_0x55536e[_0x210f('0x2e')][_0x210f('0x1a')]);}return _0x38af22[_0x210f('0x4b')](_0x4bffd6);}})[_0x210f('0x22')](function(_0x1e0e09){if(_0x1e0e09){return _0x1e0e09?{'count':_0x1158be,'rows':_0x1e0e09}:null;}})[_0x210f('0x22')](respondWithResult(_0x555219,null))['catch'](handleError(_0x555219,null));};exports[_0x210f('0x4c')]=function(_0x5da342,_0x2b9296,_0x29a4ed){var _0x457d41={};var _0x4b2920={};var _0xe4c32f;var _0x3c847c;return db['FreshdeskConfiguration'][_0x210f('0x4d')]({'where':{'id':_0x5da342[_0x210f('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b9296,null))[_0x210f('0x22')](function(_0x1e4108){if(_0x1e4108){_0xe4c32f=_0x1e4108;_0x4b2920['model']=_[_0x210f('0x42')](db[_0x210f('0x48')][_0x210f('0x2a')]);_0x4b2920[_0x210f('0x2e')]=_[_0x210f('0x42')](_0x5da342[_0x210f('0x2e')]);_0x4b2920[_0x210f('0x2f')]=_['intersection'](_0x4b2920[_0x210f('0x31')],_0x4b2920[_0x210f('0x2e')]);_0x457d41['attributes']=_[_0x210f('0x30')](_0x4b2920[_0x210f('0x31')],qs[_0x210f('0x33')](_0x5da342['query'][_0x210f('0x33')]));_0x457d41['attributes']=_0x457d41[_0x210f('0x32')][_0x210f('0x49')]?_0x457d41['attributes']:_0x4b2920['model'];_0x457d41['order']=qs[_0x210f('0x37')](_0x5da342[_0x210f('0x2e')]['sort']);_0x457d41[_0x210f('0x38')]=qs[_0x210f('0x2f')](_[_0x210f('0x4a')](_0x5da342['query'],_0x4b2920[_0x210f('0x2f')]));if(_0x5da342[_0x210f('0x2e')][_0x210f('0x39')]){_0x457d41[_0x210f('0x38')]=_[_0x210f('0x3a')](_0x457d41[_0x210f('0x38')],{'$or':_[_0x210f('0x28')](_0x457d41['attributes'],function(_0x2c78f1){var _0x2617be={};_0x2617be[_0x2c78f1]={'$like':'%'+_0x5da342[_0x210f('0x2e')][_0x210f('0x39')]+'%'};return _0x2617be;})});}_0x457d41=_['merge']({},_0x457d41,_0x5da342[_0x210f('0x43')]);return _0xe4c32f['getSubjects'](_0x457d41);}})[_0x210f('0x22')](function(_0x271cc6){if(_0x271cc6){_0x3c847c=_0x271cc6[_0x210f('0x49')];if(!_0x5da342['query'][_0x210f('0x34')](_0x210f('0x35'))){_0x457d41[_0x210f('0x1b')]=qs[_0x210f('0x1b')](_0x5da342['query']['limit']);_0x457d41[_0x210f('0x1a')]=qs['offset'](_0x5da342[_0x210f('0x2e')][_0x210f('0x1a')]);}return _0xe4c32f[_0x210f('0x4c')](_0x457d41);}})['then'](function(_0x5cb2cf){if(_0x5cb2cf){return _0x5cb2cf?{'count':_0x3c847c,'rows':_0x5cb2cf}:null;}})[_0x210f('0x22')](respondWithResult(_0x2b9296,null))['catch'](handleError(_0x2b9296,null));};exports[_0x210f('0x4e')]=function(_0x1ba14c,_0x12c254,_0x57ffcc){var _0x4d8ad2={};var _0x2cecc5={};var _0x10be96;var _0x1405f7;return db[_0x210f('0x29')][_0x210f('0x4d')]({'where':{'id':_0x1ba14c[_0x210f('0x47')]['id']}})['then'](handleEntityNotFound(_0x12c254,null))[_0x210f('0x22')](function(_0x4442c6){if(_0x4442c6){_0x10be96=_0x4442c6;_0x2cecc5[_0x210f('0x31')]=_[_0x210f('0x42')](db[_0x210f('0x48')][_0x210f('0x2a')]);_0x2cecc5[_0x210f('0x2e')]=_['keys'](_0x1ba14c[_0x210f('0x2e')]);_0x2cecc5[_0x210f('0x2f')]=_[_0x210f('0x30')](_0x2cecc5[_0x210f('0x31')],_0x2cecc5[_0x210f('0x2e')]);_0x4d8ad2[_0x210f('0x32')]=_[_0x210f('0x30')](_0x2cecc5[_0x210f('0x31')],qs['fields'](_0x1ba14c[_0x210f('0x2e')][_0x210f('0x33')]));_0x4d8ad2[_0x210f('0x32')]=_0x4d8ad2[_0x210f('0x32')]['length']?_0x4d8ad2[_0x210f('0x32')]:_0x2cecc5[_0x210f('0x31')];_0x4d8ad2['order']=qs['sort'](_0x1ba14c[_0x210f('0x2e')]['sort']);_0x4d8ad2[_0x210f('0x38')]=qs[_0x210f('0x2f')](_[_0x210f('0x4a')](_0x1ba14c[_0x210f('0x2e')],_0x2cecc5[_0x210f('0x2f')]));if(_0x1ba14c[_0x210f('0x2e')][_0x210f('0x39')]){_0x4d8ad2['where']=_[_0x210f('0x3a')](_0x4d8ad2[_0x210f('0x38')],{'$or':_[_0x210f('0x28')](_0x4d8ad2[_0x210f('0x32')],function(_0x3e4ee2){var _0x1092dd={};_0x1092dd[_0x3e4ee2]={'$like':'%'+_0x1ba14c[_0x210f('0x2e')][_0x210f('0x39')]+'%'};return _0x1092dd;})});}_0x4d8ad2=_[_0x210f('0x3a')]({},_0x4d8ad2,_0x1ba14c['options']);return _0x10be96[_0x210f('0x4e')](_0x4d8ad2);}})['then'](function(_0x13cb4a){if(_0x13cb4a){_0x1405f7=_0x13cb4a[_0x210f('0x49')];if(!_0x1ba14c[_0x210f('0x2e')]['hasOwnProperty'](_0x210f('0x35'))){_0x4d8ad2['limit']=qs['limit'](_0x1ba14c['query'][_0x210f('0x1b')]);_0x4d8ad2[_0x210f('0x1a')]=qs[_0x210f('0x1a')](_0x1ba14c[_0x210f('0x2e')][_0x210f('0x1a')]);}return _0x10be96['getDescriptions'](_0x4d8ad2);}})[_0x210f('0x22')](function(_0x3b1332){if(_0x3b1332){return _0x3b1332?{'count':_0x1405f7,'rows':_0x3b1332}:null;}})[_0x210f('0x22')](respondWithResult(_0x12c254,null))['catch'](handleError(_0x12c254,null));};exports[_0x210f('0x4f')]=function(_0x4afaaa,_0x45a642,_0x492674){var _0xf322a9={};var _0xe35ee={};var _0x18b0b6;var _0x42fb5c;return db[_0x210f('0x29')]['findOne']({'where':{'id':_0x4afaaa[_0x210f('0x47')]['id']}})[_0x210f('0x22')](handleEntityNotFound(_0x45a642,null))[_0x210f('0x22')](function(_0x27cdc7){if(_0x27cdc7){_0x18b0b6=_0x27cdc7;_0xe35ee['model']=_[_0x210f('0x42')](db['Tag']['rawAttributes']);_0xe35ee[_0x210f('0x2e')]=_['keys'](_0x4afaaa['query']);_0xe35ee[_0x210f('0x2f')]=_[_0x210f('0x30')](_0xe35ee[_0x210f('0x31')],_0xe35ee[_0x210f('0x2e')]);_0xf322a9[_0x210f('0x32')]=_[_0x210f('0x30')](_0xe35ee['model'],qs[_0x210f('0x33')](_0x4afaaa[_0x210f('0x2e')][_0x210f('0x33')]));_0xf322a9['attributes']=_0xf322a9[_0x210f('0x32')][_0x210f('0x49')]?_0xf322a9[_0x210f('0x32')]:_0xe35ee[_0x210f('0x31')];_0xf322a9[_0x210f('0x36')]=qs['sort'](_0x4afaaa['query'][_0x210f('0x37')]);_0xf322a9[_0x210f('0x38')]=qs[_0x210f('0x2f')](_[_0x210f('0x4a')](_0x4afaaa[_0x210f('0x2e')],_0xe35ee[_0x210f('0x2f')]));if(_0x4afaaa[_0x210f('0x2e')][_0x210f('0x39')]){_0xf322a9[_0x210f('0x38')]=_[_0x210f('0x3a')](_0xf322a9[_0x210f('0x38')],{'$or':_[_0x210f('0x28')](_0xf322a9[_0x210f('0x32')],function(_0x2cd5bb){var _0x271457={};_0x271457[_0x2cd5bb]={'$like':'%'+_0x4afaaa[_0x210f('0x2e')][_0x210f('0x39')]+'%'};return _0x271457;})});}_0xf322a9=_['merge']({},_0xf322a9,_0x4afaaa['options']);return _0x18b0b6[_0x210f('0x4f')](_0xf322a9);}})['then'](function(_0x5cc761){if(_0x5cc761){_0x42fb5c=_0x5cc761[_0x210f('0x49')];if(!_0x4afaaa[_0x210f('0x2e')]['hasOwnProperty'](_0x210f('0x35'))){_0xf322a9[_0x210f('0x1b')]=qs[_0x210f('0x1b')](_0x4afaaa[_0x210f('0x2e')][_0x210f('0x1b')]);_0xf322a9[_0x210f('0x1a')]=qs['offset'](_0x4afaaa[_0x210f('0x2e')][_0x210f('0x1a')]);}return _0x18b0b6[_0x210f('0x4f')](_0xf322a9);}})[_0x210f('0x22')](function(_0x3aa710){if(_0x3aa710){return _0x3aa710?{'count':_0x42fb5c,'rows':_0x3aa710}:null;}})['then'](respondWithResult(_0x45a642,null))[_0x210f('0x40')](handleError(_0x45a642,null));};exports[_0x210f('0x50')]=function(_0x47ee06,_0x1e6f05,_0x16f641){if(_0x47ee06[_0x210f('0x46')]['id']){delete _0x47ee06[_0x210f('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x210f('0x4d')]({'where':{'id':_0x47ee06['params']['id']}})['then'](handleEntityNotFound(_0x1e6f05,null))[_0x210f('0x22')](function(_0x8a3246){if(_0x8a3246){return _0x8a3246[_0x210f('0x50')](_0x47ee06[_0x210f('0x46')][_0x210f('0x51')]||[]);}return null;})[_0x210f('0x22')](respondWithResult(_0x1e6f05,null))[_0x210f('0x40')](handleError(_0x1e6f05,null));}; \ No newline at end of file +var _0xbcc1=['update','body','destroy','getFields','findOne','order','getSubjects','FreshdeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','FreshdeskConfiguration','findAll','rows','show','params','rawAttributes','includeAll','find','create','catch'];(function(_0x287d5e,_0x33f42b){var _0x41a451=function(_0x23fde9){while(--_0x23fde9){_0x287d5e['push'](_0x287d5e['shift']());}};_0x41a451(++_0x33f42b);}(_0xbcc1,0x161));var _0x1bcc=function(_0x2608a9,_0x32ccb1){_0x2608a9=_0x2608a9-0x0;var _0x3c3f68=_0xbcc1[_0x2608a9];return _0x3c3f68;};'use strict';var emlformat=require(_0x1bcc('0x0'));var rimraf=require(_0x1bcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1bcc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1bcc('0x3'));var util=require('util');var path=require(_0x1bcc('0x4'));var sox=require(_0x1bcc('0x5'));var csv=require('to-csv');var ejs=require(_0x1bcc('0x6'));var fs=require('fs');var fs_extra=require(_0x1bcc('0x7'));var _=require(_0x1bcc('0x8'));var squel=require(_0x1bcc('0x9'));var crypto=require('crypto');var jsforce=require(_0x1bcc('0xa'));var deskjs=require(_0x1bcc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1bcc('0xc'));var Papa=require('papaparse');var Redis=require(_0x1bcc('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1bcc('0xe'));var as=require(_0x1bcc('0xf'));var hardwareService=require(_0x1bcc('0x10'));var logger=require(_0x1bcc('0x11'))(_0x1bcc('0x12'));var utils=require(_0x1bcc('0x13'));var config=require(_0x1bcc('0x14'));var licenseUtil=require(_0x1bcc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d22e1,_0x347b76){_0x347b76=_0x347b76||0xcc;return function(_0x385e54){if(_0x385e54){return _0x2d22e1['sendStatus'](_0x347b76);}return _0x2d22e1[_0x1bcc('0x16')](_0x347b76)['end']();};}function respondWithResult(_0x1a1456,_0x52246f){_0x52246f=_0x52246f||0xc8;return function(_0x3b03b3){if(_0x3b03b3){return _0x1a1456[_0x1bcc('0x16')](_0x52246f)[_0x1bcc('0x17')](_0x3b03b3);}};}function respondWithFilteredResult(_0x21937d,_0xa5e67b){return function(_0x2d8367){if(_0x2d8367){var _0x167817=typeof _0xa5e67b['offset']==='undefined'&&typeof _0xa5e67b[_0x1bcc('0x18')]===_0x1bcc('0x19');var _0x531ca5=_0x2d8367[_0x1bcc('0x1a')];var _0x1af911=_0x167817?0x0:_0xa5e67b[_0x1bcc('0x1b')];var _0x5e651d=_0x167817?_0x2d8367['count']:_0xa5e67b['offset']+_0xa5e67b[_0x1bcc('0x18')];var _0x7cb55d;if(_0x5e651d>=_0x531ca5){_0x5e651d=_0x531ca5;_0x7cb55d=0xc8;}else{_0x7cb55d=0xce;}_0x21937d[_0x1bcc('0x16')](_0x7cb55d);return _0x21937d[_0x1bcc('0x1c')](_0x1bcc('0x1d'),_0x1af911+'-'+_0x5e651d+'/'+_0x531ca5)[_0x1bcc('0x17')](_0x2d8367);}return null;};}function patchUpdates(_0x561665){return function(_0x43c814){try{jsonpatch[_0x1bcc('0x1e')](_0x43c814,_0x561665,!![]);}catch(_0x2fef51){return BPromise[_0x1bcc('0x1f')](_0x2fef51);}return _0x43c814[_0x1bcc('0x20')]();};}function saveUpdates(_0x55f739,_0x3b5246){return function(_0x754ebc){if(_0x754ebc){return _0x754ebc['update'](_0x55f739)[_0x1bcc('0x21')](function(_0x554d9c){return _0x554d9c;});}return null;};}function removeEntity(_0x309ea7,_0x3b1d54){return function(_0x4b4e83){if(_0x4b4e83){return _0x4b4e83['destroy']()['then'](function(){_0x309ea7['status'](0xcc)[_0x1bcc('0x22')]();});}};}function handleEntityNotFound(_0x3cbb0e,_0x5f01a0){return function(_0x3169da){if(!_0x3169da){_0x3cbb0e[_0x1bcc('0x23')](0x194);}return _0x3169da;};}function handleError(_0x20be08,_0x4a652b){_0x4a652b=_0x4a652b||0x1f4;return function(_0x298f0){logger[_0x1bcc('0x24')](_0x298f0[_0x1bcc('0x25')]);if(_0x298f0[_0x1bcc('0x26')]){delete _0x298f0[_0x1bcc('0x26')];}_0x20be08[_0x1bcc('0x16')](_0x4a652b)[_0x1bcc('0x27')](_0x298f0);};}exports[_0x1bcc('0x28')]=function(_0x1c54cc,_0x14bbff){var _0x1fdfd4={},_0x281f2c={},_0x17febe={'count':0x0,'rows':[]};var _0x59d72d=_[_0x1bcc('0x29')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x471ca7){return{'name':_0x471ca7[_0x1bcc('0x2a')],'type':_0x471ca7[_0x1bcc('0x2b')][_0x1bcc('0x2c')]};});_0x281f2c[_0x1bcc('0x2d')]=_[_0x1bcc('0x29')](_0x59d72d,'name');_0x281f2c['query']=_[_0x1bcc('0x2e')](_0x1c54cc['query']);_0x281f2c[_0x1bcc('0x2f')]=_[_0x1bcc('0x30')](_0x281f2c[_0x1bcc('0x2d')],_0x281f2c[_0x1bcc('0x31')]);_0x1fdfd4[_0x1bcc('0x32')]=_[_0x1bcc('0x30')](_0x281f2c[_0x1bcc('0x2d')],qs[_0x1bcc('0x33')](_0x1c54cc[_0x1bcc('0x31')][_0x1bcc('0x33')]));_0x1fdfd4[_0x1bcc('0x32')]=_0x1fdfd4[_0x1bcc('0x32')][_0x1bcc('0x34')]?_0x1fdfd4['attributes']:_0x281f2c[_0x1bcc('0x2d')];if(!_0x1c54cc[_0x1bcc('0x31')][_0x1bcc('0x35')](_0x1bcc('0x36'))){_0x1fdfd4[_0x1bcc('0x18')]=qs[_0x1bcc('0x18')](_0x1c54cc[_0x1bcc('0x31')][_0x1bcc('0x18')]);_0x1fdfd4[_0x1bcc('0x1b')]=qs[_0x1bcc('0x1b')](_0x1c54cc[_0x1bcc('0x31')][_0x1bcc('0x1b')]);}_0x1fdfd4['order']=qs['sort'](_0x1c54cc[_0x1bcc('0x31')][_0x1bcc('0x37')]);_0x1fdfd4[_0x1bcc('0x38')]=qs[_0x1bcc('0x2f')](_[_0x1bcc('0x39')](_0x1c54cc['query'],_0x281f2c[_0x1bcc('0x2f')]),_0x59d72d);if(_0x1c54cc[_0x1bcc('0x31')][_0x1bcc('0x3a')]){_0x1fdfd4['where']=_[_0x1bcc('0x3b')](_0x1fdfd4[_0x1bcc('0x38')],{'$or':_['map'](_0x59d72d,function(_0x34c2af){if(_0x34c2af[_0x1bcc('0x2b')]!=='VIRTUAL'){var _0x90ce04={};_0x90ce04[_0x34c2af[_0x1bcc('0x26')]]={'$like':'%'+_0x1c54cc[_0x1bcc('0x31')][_0x1bcc('0x3a')]+'%'};return _0x90ce04;}})});}_0x1fdfd4=_[_0x1bcc('0x3b')]({},_0x1fdfd4,_0x1c54cc[_0x1bcc('0x3c')]);var _0x32a3b9={'where':_0x1fdfd4[_0x1bcc('0x38')]};return db['FreshdeskConfiguration'][_0x1bcc('0x1a')](_0x32a3b9)[_0x1bcc('0x21')](function(_0x47f79f){_0x17febe[_0x1bcc('0x1a')]=_0x47f79f;if(_0x1c54cc[_0x1bcc('0x31')]['includeAll']){_0x1fdfd4[_0x1bcc('0x3d')]=[{'all':!![]}];}return db[_0x1bcc('0x3e')][_0x1bcc('0x3f')](_0x1fdfd4);})[_0x1bcc('0x21')](function(_0x31d77b){_0x17febe[_0x1bcc('0x40')]=_0x31d77b;return _0x17febe;})[_0x1bcc('0x21')](respondWithFilteredResult(_0x14bbff,_0x1fdfd4))['catch'](handleError(_0x14bbff,null));};exports[_0x1bcc('0x41')]=function(_0x5ba740,_0x10f200){var _0x160f80={'raw':![],'where':{'id':_0x5ba740[_0x1bcc('0x42')]['id']}},_0xee9a28={};_0xee9a28['model']=_[_0x1bcc('0x2e')](db[_0x1bcc('0x3e')][_0x1bcc('0x43')]);_0xee9a28[_0x1bcc('0x31')]=_[_0x1bcc('0x2e')](_0x5ba740[_0x1bcc('0x31')]);_0xee9a28[_0x1bcc('0x2f')]=_['intersection'](_0xee9a28[_0x1bcc('0x2d')],_0xee9a28[_0x1bcc('0x31')]);_0x160f80[_0x1bcc('0x32')]=_[_0x1bcc('0x30')](_0xee9a28[_0x1bcc('0x2d')],qs[_0x1bcc('0x33')](_0x5ba740[_0x1bcc('0x31')][_0x1bcc('0x33')]));_0x160f80[_0x1bcc('0x32')]=_0x160f80[_0x1bcc('0x32')][_0x1bcc('0x34')]?_0x160f80['attributes']:_0xee9a28[_0x1bcc('0x2d')];if(_0x5ba740['query'][_0x1bcc('0x44')]){_0x160f80[_0x1bcc('0x3d')]=[{'all':!![]}];}_0x160f80=_[_0x1bcc('0x3b')]({},_0x160f80,_0x5ba740[_0x1bcc('0x3c')]);return db[_0x1bcc('0x3e')][_0x1bcc('0x45')](_0x160f80)['then'](handleEntityNotFound(_0x10f200,null))[_0x1bcc('0x21')](respondWithResult(_0x10f200,null))['catch'](handleError(_0x10f200,null));};exports[_0x1bcc('0x46')]=function(_0x4df1c9,_0x100917){return db[_0x1bcc('0x3e')][_0x1bcc('0x46')](_0x4df1c9['body'],{})[_0x1bcc('0x21')](respondWithResult(_0x100917,0xc9))[_0x1bcc('0x47')](handleError(_0x100917,null));};exports[_0x1bcc('0x48')]=function(_0x10487d,_0x254b83){if(_0x10487d[_0x1bcc('0x49')]['id']){delete _0x10487d[_0x1bcc('0x49')]['id'];}return db[_0x1bcc('0x3e')]['find']({'where':{'id':_0x10487d['params']['id']}})['then'](handleEntityNotFound(_0x254b83,null))[_0x1bcc('0x21')](saveUpdates(_0x10487d[_0x1bcc('0x49')],null))['then'](respondWithResult(_0x254b83,null))[_0x1bcc('0x47')](handleError(_0x254b83,null));};exports[_0x1bcc('0x4a')]=function(_0x4634d0,_0x66071a){return db[_0x1bcc('0x3e')][_0x1bcc('0x45')]({'where':{'id':_0x4634d0[_0x1bcc('0x42')]['id']}})[_0x1bcc('0x21')](handleEntityNotFound(_0x66071a,null))['then'](removeEntity(_0x66071a,null))[_0x1bcc('0x47')](handleError(_0x66071a,null));};exports[_0x1bcc('0x4b')]=function(_0x488256,_0x5b559e,_0x5c830c){var _0x51b992={};var _0x27b2a5={};var _0x47565f;var _0xe9ff78;return db[_0x1bcc('0x3e')][_0x1bcc('0x4c')]({'where':{'id':_0x488256[_0x1bcc('0x42')]['id']}})[_0x1bcc('0x21')](handleEntityNotFound(_0x5b559e,null))[_0x1bcc('0x21')](function(_0x5580dc){if(_0x5580dc){_0x47565f=_0x5580dc;_0x27b2a5['model']=_[_0x1bcc('0x2e')](db['FreshdeskField'][_0x1bcc('0x43')]);_0x27b2a5[_0x1bcc('0x31')]=_['keys'](_0x488256[_0x1bcc('0x31')]);_0x27b2a5['filters']=_['intersection'](_0x27b2a5['model'],_0x27b2a5[_0x1bcc('0x31')]);_0x51b992[_0x1bcc('0x32')]=_[_0x1bcc('0x30')](_0x27b2a5['model'],qs[_0x1bcc('0x33')](_0x488256[_0x1bcc('0x31')]['fields']));_0x51b992[_0x1bcc('0x32')]=_0x51b992['attributes'][_0x1bcc('0x34')]?_0x51b992[_0x1bcc('0x32')]:_0x27b2a5[_0x1bcc('0x2d')];_0x51b992[_0x1bcc('0x4d')]=qs[_0x1bcc('0x37')](_0x488256[_0x1bcc('0x31')][_0x1bcc('0x37')]);_0x51b992[_0x1bcc('0x38')]=qs[_0x1bcc('0x2f')](_[_0x1bcc('0x39')](_0x488256[_0x1bcc('0x31')],_0x27b2a5[_0x1bcc('0x2f')]));if(_0x488256[_0x1bcc('0x31')][_0x1bcc('0x3a')]){_0x51b992[_0x1bcc('0x38')]=_[_0x1bcc('0x3b')](_0x51b992[_0x1bcc('0x38')],{'$or':_[_0x1bcc('0x29')](_0x51b992['attributes'],function(_0x4ec163){var _0x532a9e={};_0x532a9e[_0x4ec163]={'$like':'%'+_0x488256[_0x1bcc('0x31')]['filter']+'%'};return _0x532a9e;})});}_0x51b992=_['merge']({},_0x51b992,_0x488256[_0x1bcc('0x3c')]);return _0x47565f[_0x1bcc('0x4b')](_0x51b992);}})[_0x1bcc('0x21')](function(_0x544454){if(_0x544454){_0xe9ff78=_0x544454['length'];if(!_0x488256[_0x1bcc('0x31')]['hasOwnProperty'](_0x1bcc('0x36'))){_0x51b992['limit']=qs[_0x1bcc('0x18')](_0x488256['query'][_0x1bcc('0x18')]);_0x51b992[_0x1bcc('0x1b')]=qs[_0x1bcc('0x1b')](_0x488256[_0x1bcc('0x31')][_0x1bcc('0x1b')]);}return _0x47565f['getFields'](_0x51b992);}})[_0x1bcc('0x21')](function(_0x3c48bc){if(_0x3c48bc){return _0x3c48bc?{'count':_0xe9ff78,'rows':_0x3c48bc}:null;}})[_0x1bcc('0x21')](respondWithResult(_0x5b559e,null))[_0x1bcc('0x47')](handleError(_0x5b559e,null));};exports[_0x1bcc('0x4e')]=function(_0x5e5f9c,_0x48cdb4,_0x362745){var _0x3946ea={};var _0x1d8b60={};var _0x5b6e13;var _0x337b33;return db[_0x1bcc('0x3e')][_0x1bcc('0x4c')]({'where':{'id':_0x5e5f9c[_0x1bcc('0x42')]['id']}})['then'](handleEntityNotFound(_0x48cdb4,null))['then'](function(_0x482f12){if(_0x482f12){_0x5b6e13=_0x482f12;_0x1d8b60['model']=_[_0x1bcc('0x2e')](db[_0x1bcc('0x4f')][_0x1bcc('0x43')]);_0x1d8b60[_0x1bcc('0x31')]=_['keys'](_0x5e5f9c[_0x1bcc('0x31')]);_0x1d8b60['filters']=_[_0x1bcc('0x30')](_0x1d8b60[_0x1bcc('0x2d')],_0x1d8b60[_0x1bcc('0x31')]);_0x3946ea[_0x1bcc('0x32')]=_[_0x1bcc('0x30')](_0x1d8b60['model'],qs['fields'](_0x5e5f9c['query'][_0x1bcc('0x33')]));_0x3946ea[_0x1bcc('0x32')]=_0x3946ea['attributes'][_0x1bcc('0x34')]?_0x3946ea[_0x1bcc('0x32')]:_0x1d8b60[_0x1bcc('0x2d')];_0x3946ea[_0x1bcc('0x4d')]=qs[_0x1bcc('0x37')](_0x5e5f9c['query'][_0x1bcc('0x37')]);_0x3946ea['where']=qs[_0x1bcc('0x2f')](_[_0x1bcc('0x39')](_0x5e5f9c['query'],_0x1d8b60[_0x1bcc('0x2f')]));if(_0x5e5f9c['query'][_0x1bcc('0x3a')]){_0x3946ea['where']=_[_0x1bcc('0x3b')](_0x3946ea[_0x1bcc('0x38')],{'$or':_['map'](_0x3946ea['attributes'],function(_0x301ab4){var _0x4de561={};_0x4de561[_0x301ab4]={'$like':'%'+_0x5e5f9c['query']['filter']+'%'};return _0x4de561;})});}_0x3946ea=_[_0x1bcc('0x3b')]({},_0x3946ea,_0x5e5f9c['options']);return _0x5b6e13[_0x1bcc('0x4e')](_0x3946ea);}})[_0x1bcc('0x21')](function(_0x77f9f4){if(_0x77f9f4){_0x337b33=_0x77f9f4[_0x1bcc('0x34')];if(!_0x5e5f9c['query'][_0x1bcc('0x35')](_0x1bcc('0x36'))){_0x3946ea[_0x1bcc('0x18')]=qs[_0x1bcc('0x18')](_0x5e5f9c[_0x1bcc('0x31')][_0x1bcc('0x18')]);_0x3946ea[_0x1bcc('0x1b')]=qs[_0x1bcc('0x1b')](_0x5e5f9c[_0x1bcc('0x31')][_0x1bcc('0x1b')]);}return _0x5b6e13[_0x1bcc('0x4e')](_0x3946ea);}})[_0x1bcc('0x21')](function(_0x281fac){if(_0x281fac){return _0x281fac?{'count':_0x337b33,'rows':_0x281fac}:null;}})[_0x1bcc('0x21')](respondWithResult(_0x48cdb4,null))[_0x1bcc('0x47')](handleError(_0x48cdb4,null));};exports[_0x1bcc('0x50')]=function(_0x326f4e,_0x11de2c,_0x584140){var _0x487725={};var _0x11e745={};var _0x2d271d;var _0xb4a063;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x326f4e['params']['id']}})[_0x1bcc('0x21')](handleEntityNotFound(_0x11de2c,null))[_0x1bcc('0x21')](function(_0x4b021a){if(_0x4b021a){_0x2d271d=_0x4b021a;_0x11e745[_0x1bcc('0x2d')]=_['keys'](db[_0x1bcc('0x4f')][_0x1bcc('0x43')]);_0x11e745[_0x1bcc('0x31')]=_[_0x1bcc('0x2e')](_0x326f4e['query']);_0x11e745[_0x1bcc('0x2f')]=_[_0x1bcc('0x30')](_0x11e745[_0x1bcc('0x2d')],_0x11e745[_0x1bcc('0x31')]);_0x487725['attributes']=_[_0x1bcc('0x30')](_0x11e745[_0x1bcc('0x2d')],qs[_0x1bcc('0x33')](_0x326f4e[_0x1bcc('0x31')][_0x1bcc('0x33')]));_0x487725[_0x1bcc('0x32')]=_0x487725[_0x1bcc('0x32')]['length']?_0x487725[_0x1bcc('0x32')]:_0x11e745['model'];_0x487725[_0x1bcc('0x4d')]=qs[_0x1bcc('0x37')](_0x326f4e['query']['sort']);_0x487725[_0x1bcc('0x38')]=qs['filters'](_[_0x1bcc('0x39')](_0x326f4e[_0x1bcc('0x31')],_0x11e745[_0x1bcc('0x2f')]));if(_0x326f4e[_0x1bcc('0x31')]['filter']){_0x487725[_0x1bcc('0x38')]=_['merge'](_0x487725['where'],{'$or':_['map'](_0x487725[_0x1bcc('0x32')],function(_0xca80e3){var _0xbbdc09={};_0xbbdc09[_0xca80e3]={'$like':'%'+_0x326f4e[_0x1bcc('0x31')][_0x1bcc('0x3a')]+'%'};return _0xbbdc09;})});}_0x487725=_[_0x1bcc('0x3b')]({},_0x487725,_0x326f4e['options']);return _0x2d271d[_0x1bcc('0x50')](_0x487725);}})[_0x1bcc('0x21')](function(_0x15079e){if(_0x15079e){_0xb4a063=_0x15079e[_0x1bcc('0x34')];if(!_0x326f4e[_0x1bcc('0x31')][_0x1bcc('0x35')](_0x1bcc('0x36'))){_0x487725[_0x1bcc('0x18')]=qs[_0x1bcc('0x18')](_0x326f4e['query'][_0x1bcc('0x18')]);_0x487725['offset']=qs['offset'](_0x326f4e[_0x1bcc('0x31')][_0x1bcc('0x1b')]);}return _0x2d271d[_0x1bcc('0x50')](_0x487725);}})[_0x1bcc('0x21')](function(_0x1f1677){if(_0x1f1677){return _0x1f1677?{'count':_0xb4a063,'rows':_0x1f1677}:null;}})[_0x1bcc('0x21')](respondWithResult(_0x11de2c,null))[_0x1bcc('0x47')](handleError(_0x11de2c,null));};exports['getTags']=function(_0x592d63,_0x2346cc,_0x42b044){var _0x267d95={};var _0x106d57={};var _0x567f85;var _0x20b4ad;return db[_0x1bcc('0x3e')][_0x1bcc('0x4c')]({'where':{'id':_0x592d63[_0x1bcc('0x42')]['id']}})['then'](handleEntityNotFound(_0x2346cc,null))[_0x1bcc('0x21')](function(_0x58feaf){if(_0x58feaf){_0x567f85=_0x58feaf;_0x106d57['model']=_['keys'](db[_0x1bcc('0x51')]['rawAttributes']);_0x106d57[_0x1bcc('0x31')]=_[_0x1bcc('0x2e')](_0x592d63[_0x1bcc('0x31')]);_0x106d57[_0x1bcc('0x2f')]=_[_0x1bcc('0x30')](_0x106d57['model'],_0x106d57[_0x1bcc('0x31')]);_0x267d95[_0x1bcc('0x32')]=_[_0x1bcc('0x30')](_0x106d57['model'],qs[_0x1bcc('0x33')](_0x592d63[_0x1bcc('0x31')]['fields']));_0x267d95[_0x1bcc('0x32')]=_0x267d95[_0x1bcc('0x32')][_0x1bcc('0x34')]?_0x267d95[_0x1bcc('0x32')]:_0x106d57[_0x1bcc('0x2d')];_0x267d95['order']=qs[_0x1bcc('0x37')](_0x592d63[_0x1bcc('0x31')]['sort']);_0x267d95[_0x1bcc('0x38')]=qs['filters'](_[_0x1bcc('0x39')](_0x592d63[_0x1bcc('0x31')],_0x106d57[_0x1bcc('0x2f')]));if(_0x592d63[_0x1bcc('0x31')][_0x1bcc('0x3a')]){_0x267d95[_0x1bcc('0x38')]=_['merge'](_0x267d95[_0x1bcc('0x38')],{'$or':_[_0x1bcc('0x29')](_0x267d95[_0x1bcc('0x32')],function(_0x58b97c){var _0x277a7f={};_0x277a7f[_0x58b97c]={'$like':'%'+_0x592d63[_0x1bcc('0x31')][_0x1bcc('0x3a')]+'%'};return _0x277a7f;})});}_0x267d95=_['merge']({},_0x267d95,_0x592d63[_0x1bcc('0x3c')]);return _0x567f85['getTags'](_0x267d95);}})[_0x1bcc('0x21')](function(_0x1434b1){if(_0x1434b1){_0x20b4ad=_0x1434b1[_0x1bcc('0x34')];if(!_0x592d63['query'][_0x1bcc('0x35')]('nolimit')){_0x267d95['limit']=qs[_0x1bcc('0x18')](_0x592d63[_0x1bcc('0x31')][_0x1bcc('0x18')]);_0x267d95[_0x1bcc('0x1b')]=qs[_0x1bcc('0x1b')](_0x592d63['query'][_0x1bcc('0x1b')]);}return _0x567f85[_0x1bcc('0x52')](_0x267d95);}})['then'](function(_0x19e940){if(_0x19e940){return _0x19e940?{'count':_0x20b4ad,'rows':_0x19e940}:null;}})[_0x1bcc('0x21')](respondWithResult(_0x2346cc,null))[_0x1bcc('0x47')](handleError(_0x2346cc,null));};exports[_0x1bcc('0x53')]=function(_0x2f3b5e,_0x1fa5cb,_0x38b1ca){if(_0x2f3b5e[_0x1bcc('0x49')]['id']){delete _0x2f3b5e['body']['id'];}return db[_0x1bcc('0x3e')][_0x1bcc('0x4c')]({'where':{'id':_0x2f3b5e[_0x1bcc('0x42')]['id']}})[_0x1bcc('0x21')](handleEntityNotFound(_0x1fa5cb,null))['then'](function(_0x387c43){if(_0x387c43){return _0x387c43['setTags'](_0x2f3b5e[_0x1bcc('0x49')][_0x1bcc('0x54')]||[]);}return null;})[_0x1bcc('0x21')](respondWithResult(_0x1fa5cb,null))[_0x1bcc('0x47')](handleError(_0x1fa5cb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3ab1336..3b9a861 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 _0x4022=['rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x33fd97,_0x1a69a2){var _0x2d7eae=function(_0x3c1f7b){while(--_0x3c1f7b){_0x33fd97['push'](_0x33fd97['shift']());}};_0x2d7eae(++_0x1a69a2);}(_0x4022,0x89));var _0x2402=function(_0x27ac11,_0x164c17){_0x27ac11=_0x27ac11-0x0;var _0x5aab19=_0x4022[_0x27ac11];return _0x5aab19;};'use strict';var _=require(_0x2402('0x0'));var util=require(_0x2402('0x1'));var logger=require(_0x2402('0x2'))(_0x2402('0x3'));var moment=require(_0x2402('0x4'));var BPromise=require('bluebird');var rp=require(_0x2402('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2402('0x6'));var config=require('../../config/environment');var attributes=require(_0x2402('0x7'));module[_0x2402('0x8')]=function(_0x316ca5,_0x3f97c7){return _0x316ca5['define'](_0x2402('0x9'),attributes,{'tableName':_0x2402('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x935c=['path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x935c,0x1dd));var _0xc935=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x935c[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xc935('0x0'));var util=require('util');var logger=require(_0xc935('0x1'))('api');var moment=require(_0xc935('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc935('0x3'));var rimraf=require(_0xc935('0x4'));var config=require(_0xc935('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xc935('0x6')]=function(_0x583ad6,_0x2c9286){return _0x583ad6[_0xc935('0x7')](_0xc935('0x8'),attributes,{'tableName':_0xc935('0x9'),'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 a2c909c..09ff728 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 _0x594c=['FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x141291,_0x2574e6){var _0x5203f8=function(_0x1d9e72){while(--_0x1d9e72){_0x141291['push'](_0x141291['shift']());}};_0x5203f8(++_0x2574e6);}(_0x594c,0xeb));var _0xc594=function(_0xc4dbe,_0x2b0d46){_0xc4dbe=_0xc4dbe-0x0;var _0x3f021a=_0x594c[_0xc4dbe];return _0x3f021a;};'use strict';var _=require(_0xc594('0x0'));var util=require(_0xc594('0x1'));var moment=require(_0xc594('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc594('0x3'));var logger=require(_0xc594('0x4'))('rpc');var config=require(_0xc594('0x5'));var jayson=require(_0xc594('0x6'));var client=jayson[_0xc594('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4130de,_0x294103,_0x1928a4){return new BPromise(function(_0xf392c6,_0x512c5e){return client[_0xc594('0x8')](_0x4130de,_0x1928a4)[_0xc594('0x9')](function(_0x2b1164){logger[_0xc594('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x294103,_0xc594('0xb'));logger[_0xc594('0xc')](_0xc594('0xd'),_0x294103,_0xc594('0xb'),JSON[_0xc594('0xe')](_0x2b1164));if(_0x2b1164[_0xc594('0xf')]){if(_0x2b1164[_0xc594('0xf')][_0xc594('0x10')]===0x1f4){logger['error'](_0xc594('0x11'),_0x294103,_0x2b1164[_0xc594('0xf')][_0xc594('0x12')]);return _0x512c5e(_0x2b1164[_0xc594('0xf')][_0xc594('0x12')]);}logger['error'](_0xc594('0x11'),_0x294103,_0x2b1164[_0xc594('0xf')][_0xc594('0x12')]);return _0xf392c6(_0x2b1164[_0xc594('0xf')]['message']);}else{logger['info'](_0xc594('0x11'),_0x294103,_0xc594('0xb'));_0xf392c6(_0x2b1164[_0xc594('0x13')][_0xc594('0x12')]);}})[_0xc594('0x14')](function(_0x521904){logger[_0xc594('0xf')](_0xc594('0x11'),_0x294103,_0x521904);_0x512c5e(_0x521904);});});} \ No newline at end of file +var _0x86a9=['code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','stringify','error'];(function(_0x2b8bbe,_0x37eb6a){var _0x1bb210=function(_0x116173){while(--_0x116173){_0x2b8bbe['push'](_0x2b8bbe['shift']());}};_0x1bb210(++_0x37eb6a);}(_0x86a9,0xac));var _0x986a=function(_0x437c49,_0x5530af){_0x437c49=_0x437c49-0x0;var _0x47579e=_0x86a9[_0x437c49];return _0x47579e;};'use strict';var _=require(_0x986a('0x0'));var util=require(_0x986a('0x1'));var moment=require('moment');var BPromise=require(_0x986a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x986a('0x3'));var db=require(_0x986a('0x4'))['db'];var utils=require(_0x986a('0x5'));var logger=require(_0x986a('0x6'))(_0x986a('0x7'));var config=require(_0x986a('0x8'));var jayson=require(_0x986a('0x9'));var client=jayson[_0x986a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190c81,_0x3cf652,_0x3e4066){return new BPromise(function(_0x58c112,_0x291c8a){return client[_0x986a('0xb')](_0x190c81,_0x3e4066)['then'](function(_0x110c29){logger[_0x986a('0xc')](_0x986a('0xd'),_0x3cf652,'request\x20sent');logger[_0x986a('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3cf652,'request\x20sent',JSON[_0x986a('0xf')](_0x110c29));if(_0x110c29[_0x986a('0x10')]){if(_0x110c29[_0x986a('0x10')][_0x986a('0x11')]===0x1f4){logger['error'](_0x986a('0xd'),_0x3cf652,_0x110c29[_0x986a('0x10')][_0x986a('0x12')]);return _0x291c8a(_0x110c29[_0x986a('0x10')][_0x986a('0x12')]);}logger[_0x986a('0x10')](_0x986a('0xd'),_0x3cf652,_0x110c29[_0x986a('0x10')]['message']);return _0x58c112(_0x110c29[_0x986a('0x10')][_0x986a('0x12')]);}else{logger[_0x986a('0xc')](_0x986a('0xd'),_0x3cf652,'request\x20sent');_0x58c112(_0x110c29[_0x986a('0x13')][_0x986a('0x12')]);}})[_0x986a('0x14')](function(_0x9fbe64){logger[_0x986a('0x10')](_0x986a('0xd'),_0x3cf652,_0x9fbe64);_0x291c8a(_0x9fbe64);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index c02a7a2..a2cf5ca 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 _0x60e8=['multer','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x418a25,_0x3cde89){var _0x165a13=function(_0x1561a7){while(--_0x1561a7){_0x418a25['push'](_0x418a25['shift']());}};_0x165a13(++_0x3cde89);}(_0x60e8,0xaa));var _0x860e=function(_0x44aadd,_0x1b380d){_0x44aadd=_0x44aadd-0x0;var _0x526744=_0x60e8[_0x44aadd];return _0x526744;};'use strict';var multer=require(_0x860e('0x0'));var util=require('util');var path=require(_0x860e('0x1'));var timeout=require(_0x860e('0x2'));var express=require(_0x860e('0x3'));var router=express[_0x860e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x860e('0x5'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x860e('0x6')](),controller[_0x860e('0x7')]);router[_0x860e('0x8')](_0x860e('0x9'),auth[_0x860e('0x6')](),controller[_0x860e('0xa')]);router[_0x860e('0xb')]('/',auth[_0x860e('0x6')](),controller['create']);router[_0x860e('0xc')](_0x860e('0x9'),auth[_0x860e('0x6')](),controller[_0x860e('0xd')]);router[_0x860e('0xe')](_0x860e('0x9'),auth[_0x860e('0x6')](),controller[_0x860e('0xf')]);module[_0x860e('0x10')]=router; \ No newline at end of file +var _0xf606=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x4b4e5b,_0x58b3f1){var _0x85bff2=function(_0x1ee06f){while(--_0x1ee06f){_0x4b4e5b['push'](_0x4b4e5b['shift']());}};_0x85bff2(++_0x58b3f1);}(_0xf606,0x140));var _0x6f60=function(_0x113af9,_0x26432e){_0x113af9=_0x113af9-0x0;var _0x4dad46=_0xf606[_0x113af9];return _0x4dad46;};'use strict';var multer=require(_0x6f60('0x0'));var util=require(_0x6f60('0x1'));var path=require(_0x6f60('0x2'));var timeout=require(_0x6f60('0x3'));var express=require(_0x6f60('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6f60('0x5'));var interaction=require(_0x6f60('0x6'));var config=require(_0x6f60('0x7'));var controller=require(_0x6f60('0x8'));router[_0x6f60('0x9')]('/',auth[_0x6f60('0xa')](),controller[_0x6f60('0xb')]);router['get'](_0x6f60('0xc'),auth[_0x6f60('0xa')](),controller[_0x6f60('0xd')]);router['post']('/',auth[_0x6f60('0xa')](),controller[_0x6f60('0xe')]);router[_0x6f60('0xf')](_0x6f60('0xc'),auth['isAuthenticated'](),controller[_0x6f60('0x10')]);router[_0x6f60('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6f60('0x12')]);module[_0x6f60('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 722e862..7a35660 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 _0xe6b2=['string','variable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x47a2c0,_0x388145){var _0x2d8a88=function(_0x21cdba){while(--_0x21cdba){_0x47a2c0['push'](_0x47a2c0['shift']());}};_0x2d8a88(++_0x388145);}(_0xe6b2,0xad));var _0x2e6b=function(_0x19be15,_0x5271d3){_0x19be15=_0x19be15-0x0;var _0x28b46d=_0xe6b2[_0x19be15];return _0x28b46d;};'use strict';var Sequelize=require(_0x2e6b('0x0'));module[_0x2e6b('0x1')]={'type':{'type':Sequelize[_0x2e6b('0x2')](_0x2e6b('0x3'),_0x2e6b('0x4'),'customVariable',_0x2e6b('0x5'),'picklist'),'defaultValue':_0x2e6b('0x3')},'content':{'type':Sequelize[_0x2e6b('0x6')]},'key':{'type':Sequelize[_0x2e6b('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2e6b('0x6')]},'nameField':{'type':Sequelize[_0x2e6b('0x6')]},'customField':{'type':Sequelize[_0x2e6b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2e6b('0x6')]}}; \ No newline at end of file +var _0xe457=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x510c0d,_0x256cfc){var _0x5d97b6=function(_0x427108){while(--_0x427108){_0x510c0d['push'](_0x510c0d['shift']());}};_0x5d97b6(++_0x256cfc);}(_0xe457,0xf2));var _0x7e45=function(_0x3f766c,_0x1fef7c){_0x3f766c=_0x3f766c-0x0;var _0x36a7db=_0xe457[_0x3f766c];return _0x36a7db;};'use strict';var Sequelize=require('sequelize');module[_0x7e45('0x0')]={'type':{'type':Sequelize[_0x7e45('0x1')](_0x7e45('0x2'),_0x7e45('0x3'),_0x7e45('0x4'),_0x7e45('0x5'),_0x7e45('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7e45('0x7')]},'key':{'type':Sequelize[_0x7e45('0x7')]},'keyType':{'type':Sequelize[_0x7e45('0x1')](_0x7e45('0x2'),_0x7e45('0x3'),_0x7e45('0x4'))},'keyContent':{'type':Sequelize[_0x7e45('0x7')]},'idField':{'type':Sequelize[_0x7e45('0x7')]},'nameField':{'type':Sequelize[_0x7e45('0x7')]},'customField':{'type':Sequelize[_0x7e45('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3ee1a16..cc8af13 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 _0xc901=['save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','includeAll','find','catch','create','body','params','eml-format','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x398e76,_0xe59576){var _0x5328a7=function(_0x370664){while(--_0x370664){_0x398e76['push'](_0x398e76['shift']());}};_0x5328a7(++_0xe59576);}(_0xc901,0x142));var _0x1c90=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc901[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x1c90('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c90('0x1'));var BPromise=require(_0x1c90('0x2'));var Mustache=require('mustache');var util=require(_0x1c90('0x3'));var path=require(_0x1c90('0x4'));var sox=require(_0x1c90('0x5'));var csv=require(_0x1c90('0x6'));var ejs=require(_0x1c90('0x7'));var fs=require('fs');var fs_extra=require(_0x1c90('0x8'));var _=require(_0x1c90('0x9'));var squel=require(_0x1c90('0xa'));var crypto=require(_0x1c90('0xb'));var jsforce=require(_0x1c90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1c90('0x6'));var querystring=require(_0x1c90('0xd'));var Papa=require(_0x1c90('0xe'));var Redis=require(_0x1c90('0xf'));var authService=require(_0x1c90('0x10'));var qs=require(_0x1c90('0x11'));var as=require(_0x1c90('0x12'));var hardwareService=require(_0x1c90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1c90('0x14'));var config=require(_0x1c90('0x15'));var licenseUtil=require(_0x1c90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da158,_0x3a38ed){_0x3a38ed=_0x3a38ed||0xcc;return function(_0x3353e3){if(_0x3353e3){return _0x4da158['sendStatus'](_0x3a38ed);}return _0x4da158[_0x1c90('0x17')](_0x3a38ed)[_0x1c90('0x18')]();};}function respondWithResult(_0xf72b98,_0x589c97){_0x589c97=_0x589c97||0xc8;return function(_0x42cb94){if(_0x42cb94){return _0xf72b98['status'](_0x589c97)[_0x1c90('0x19')](_0x42cb94);}};}function respondWithFilteredResult(_0x210ef4,_0x7a88dc){return function(_0x42d8a4){if(_0x42d8a4){var _0x48bd5e=typeof _0x7a88dc[_0x1c90('0x1a')]==='undefined'&&typeof _0x7a88dc[_0x1c90('0x1b')]===_0x1c90('0x1c');var _0x5f1025=_0x42d8a4[_0x1c90('0x1d')];var _0x4ec354=_0x48bd5e?0x0:_0x7a88dc['offset'];var _0x128bf0=_0x48bd5e?_0x42d8a4['count']:_0x7a88dc[_0x1c90('0x1a')]+_0x7a88dc[_0x1c90('0x1b')];var _0x2a5b73;if(_0x128bf0>=_0x5f1025){_0x128bf0=_0x5f1025;_0x2a5b73=0xc8;}else{_0x2a5b73=0xce;}_0x210ef4[_0x1c90('0x17')](_0x2a5b73);return _0x210ef4['set'](_0x1c90('0x1e'),_0x4ec354+'-'+_0x128bf0+'/'+_0x5f1025)['json'](_0x42d8a4);}return null;};}function patchUpdates(_0x525997){return function(_0x38f997){try{jsonpatch[_0x1c90('0x1f')](_0x38f997,_0x525997,!![]);}catch(_0x47fd11){return BPromise[_0x1c90('0x20')](_0x47fd11);}return _0x38f997[_0x1c90('0x21')]();};}function saveUpdates(_0x445664,_0x4074fd){return function(_0x13fc42){if(_0x13fc42){return _0x13fc42[_0x1c90('0x22')](_0x445664)['then'](function(_0x418f4c){return _0x418f4c;});}return null;};}function removeEntity(_0x46baa1,_0xab232a){return function(_0x33c88b){if(_0x33c88b){return _0x33c88b[_0x1c90('0x23')]()[_0x1c90('0x24')](function(){_0x46baa1[_0x1c90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64ca90,_0x435c3a){return function(_0x3923a9){if(!_0x3923a9){_0x64ca90['sendStatus'](0x194);}return _0x3923a9;};}function handleError(_0xb5666e,_0x44387f){_0x44387f=_0x44387f||0x1f4;return function(_0x4abffe){logger[_0x1c90('0x25')](_0x4abffe[_0x1c90('0x26')]);if(_0x4abffe['name']){delete _0x4abffe[_0x1c90('0x27')];}_0xb5666e[_0x1c90('0x17')](_0x44387f)[_0x1c90('0x28')](_0x4abffe);};}exports[_0x1c90('0x29')]=function(_0x395edb,_0x111e20){var _0xd0a607={},_0x35c843={},_0x52c308={'count':0x0,'rows':[]};var _0xc1a571=_[_0x1c90('0x2a')](db[_0x1c90('0x2b')][_0x1c90('0x2c')],function(_0x1979de){return{'name':_0x1979de[_0x1c90('0x2d')],'type':_0x1979de[_0x1c90('0x2e')][_0x1c90('0x2f')]};});_0x35c843[_0x1c90('0x30')]=_[_0x1c90('0x2a')](_0xc1a571,_0x1c90('0x27'));_0x35c843['query']=_[_0x1c90('0x31')](_0x395edb[_0x1c90('0x32')]);_0x35c843['filters']=_[_0x1c90('0x33')](_0x35c843['model'],_0x35c843[_0x1c90('0x32')]);_0xd0a607['attributes']=_[_0x1c90('0x33')](_0x35c843['model'],qs[_0x1c90('0x34')](_0x395edb[_0x1c90('0x32')]['fields']));_0xd0a607[_0x1c90('0x35')]=_0xd0a607[_0x1c90('0x35')]['length']?_0xd0a607[_0x1c90('0x35')]:_0x35c843[_0x1c90('0x30')];if(!_0x395edb[_0x1c90('0x32')][_0x1c90('0x36')](_0x1c90('0x37'))){_0xd0a607['limit']=qs['limit'](_0x395edb['query']['limit']);_0xd0a607['offset']=qs[_0x1c90('0x1a')](_0x395edb[_0x1c90('0x32')][_0x1c90('0x1a')]);}_0xd0a607['order']=qs[_0x1c90('0x38')](_0x395edb['query'][_0x1c90('0x38')]);_0xd0a607[_0x1c90('0x39')]=qs['filters'](_['pick'](_0x395edb[_0x1c90('0x32')],_0x35c843[_0x1c90('0x3a')]),_0xc1a571);if(_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]){_0xd0a607[_0x1c90('0x39')]=_[_0x1c90('0x3c')](_0xd0a607[_0x1c90('0x39')],{'$or':_['map'](_0xc1a571,function(_0x508025){if(_0x508025[_0x1c90('0x2e')]!==_0x1c90('0x3d')){var _0x134501={};_0x134501[_0x508025[_0x1c90('0x27')]]={'$like':'%'+_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]+'%'};return _0x134501;}})});}_0xd0a607=_[_0x1c90('0x3c')]({},_0xd0a607,_0x395edb[_0x1c90('0x3e')]);var _0x398ee9={'where':_0xd0a607[_0x1c90('0x39')]};return db['FreshdeskField'][_0x1c90('0x1d')](_0x398ee9)['then'](function(_0x5a8eea){_0x52c308[_0x1c90('0x1d')]=_0x5a8eea;if(_0x395edb['query']['includeAll']){_0xd0a607[_0x1c90('0x3f')]=[{'all':!![]}];}return db[_0x1c90('0x2b')]['findAll'](_0xd0a607);})[_0x1c90('0x24')](function(_0x3271ea){_0x52c308[_0x1c90('0x40')]=_0x3271ea;return _0x52c308;})[_0x1c90('0x24')](respondWithFilteredResult(_0x111e20,_0xd0a607))['catch'](handleError(_0x111e20,null));};exports['show']=function(_0x19e689,_0x171ca0){var _0x5680fe={'raw':!![],'where':{'id':_0x19e689['params']['id']}},_0x35952a={};_0x35952a[_0x1c90('0x30')]=_[_0x1c90('0x31')](db['FreshdeskField'][_0x1c90('0x2c')]);_0x35952a[_0x1c90('0x32')]=_[_0x1c90('0x31')](_0x19e689[_0x1c90('0x32')]);_0x35952a[_0x1c90('0x3a')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],_0x35952a[_0x1c90('0x32')]);_0x5680fe[_0x1c90('0x35')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],qs['fields'](_0x19e689[_0x1c90('0x32')]['fields']));_0x5680fe[_0x1c90('0x35')]=_0x5680fe['attributes']['length']?_0x5680fe[_0x1c90('0x35')]:_0x35952a[_0x1c90('0x30')];if(_0x19e689[_0x1c90('0x32')][_0x1c90('0x41')]){_0x5680fe[_0x1c90('0x3f')]=[{'all':!![]}];}_0x5680fe=_[_0x1c90('0x3c')]({},_0x5680fe,_0x19e689[_0x1c90('0x3e')]);return db[_0x1c90('0x2b')][_0x1c90('0x42')](_0x5680fe)['then'](handleEntityNotFound(_0x171ca0,null))['then'](respondWithResult(_0x171ca0,null))[_0x1c90('0x43')](handleError(_0x171ca0,null));};exports[_0x1c90('0x44')]=function(_0x68fac8,_0x2d30f5){return db[_0x1c90('0x2b')][_0x1c90('0x44')](_0x68fac8[_0x1c90('0x45')],{})[_0x1c90('0x24')](respondWithResult(_0x2d30f5,0xc9))['catch'](handleError(_0x2d30f5,null));};exports[_0x1c90('0x22')]=function(_0x24016a,_0x9524b6){if(_0x24016a['body']['id']){delete _0x24016a['body']['id'];}return db[_0x1c90('0x2b')]['find']({'where':{'id':_0x24016a[_0x1c90('0x46')]['id']}})['then'](handleEntityNotFound(_0x9524b6,null))['then'](saveUpdates(_0x24016a[_0x1c90('0x45')],null))[_0x1c90('0x24')](respondWithResult(_0x9524b6,null))['catch'](handleError(_0x9524b6,null));};exports['destroy']=function(_0x394177,_0x53f158){return db[_0x1c90('0x2b')][_0x1c90('0x42')]({'where':{'id':_0x394177[_0x1c90('0x46')]['id']}})[_0x1c90('0x24')](handleEntityNotFound(_0x53f158,null))['then'](removeEntity(_0x53f158,null))['catch'](handleError(_0x53f158,null));}; \ No newline at end of file +var _0x8130=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','filters','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes'];(function(_0x1040c8,_0x1baa50){var _0x5d0df0=function(_0x182b7f){while(--_0x182b7f){_0x1040c8['push'](_0x1040c8['shift']());}};_0x5d0df0(++_0x1baa50);}(_0x8130,0x146));var _0x0813=function(_0x4185b3,_0x446b1c){_0x4185b3=_0x4185b3-0x0;var _0x5be705=_0x8130[_0x4185b3];return _0x5be705;};'use strict';var emlformat=require(_0x0813('0x0'));var rimraf=require(_0x0813('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0813('0x2'));var rp=require(_0x0813('0x3'));var moment=require(_0x0813('0x4'));var BPromise=require(_0x0813('0x5'));var Mustache=require(_0x0813('0x6'));var util=require(_0x0813('0x7'));var path=require('path');var sox=require(_0x0813('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0813('0x9'));var _=require(_0x0813('0xa'));var squel=require(_0x0813('0xb'));var crypto=require(_0x0813('0xc'));var jsforce=require(_0x0813('0xd'));var deskjs=require(_0x0813('0xe'));var toCsv=require(_0x0813('0xf'));var querystring=require('querystring');var Papa=require(_0x0813('0x10'));var Redis=require(_0x0813('0x11'));var authService=require(_0x0813('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0813('0x13'));var logger=require('../../config/logger')(_0x0813('0x14'));var utils=require('../../config/utils');var config=require(_0x0813('0x15'));var licenseUtil=require(_0x0813('0x16'));var db=require(_0x0813('0x17'))['db'];function respondWithStatusCode(_0x230ec7,_0x5b17f2){_0x5b17f2=_0x5b17f2||0xcc;return function(_0x4dcc3a){if(_0x4dcc3a){return _0x230ec7[_0x0813('0x18')](_0x5b17f2);}return _0x230ec7[_0x0813('0x19')](_0x5b17f2)['end']();};}function respondWithResult(_0x403e40,_0x4dae33){_0x4dae33=_0x4dae33||0xc8;return function(_0x58e56c){if(_0x58e56c){return _0x403e40[_0x0813('0x19')](_0x4dae33)[_0x0813('0x1a')](_0x58e56c);}};}function respondWithFilteredResult(_0x4ffaad,_0x2cf4f1){return function(_0x5793cb){if(_0x5793cb){var _0x29537f=typeof _0x2cf4f1[_0x0813('0x1b')]===_0x0813('0x1c')&&typeof _0x2cf4f1[_0x0813('0x1d')]===_0x0813('0x1c');var _0x10e29a=_0x5793cb[_0x0813('0x1e')];var _0x3e15da=_0x29537f?0x0:_0x2cf4f1['offset'];var _0x3ec7b5=_0x29537f?_0x5793cb['count']:_0x2cf4f1[_0x0813('0x1b')]+_0x2cf4f1[_0x0813('0x1d')];var _0x518923;if(_0x3ec7b5>=_0x10e29a){_0x3ec7b5=_0x10e29a;_0x518923=0xc8;}else{_0x518923=0xce;}_0x4ffaad[_0x0813('0x19')](_0x518923);return _0x4ffaad[_0x0813('0x1f')]('Content-Range',_0x3e15da+'-'+_0x3ec7b5+'/'+_0x10e29a)[_0x0813('0x1a')](_0x5793cb);}return null;};}function patchUpdates(_0x334741){return function(_0x4d7680){try{jsonpatch[_0x0813('0x20')](_0x4d7680,_0x334741,!![]);}catch(_0x3b3662){return BPromise[_0x0813('0x21')](_0x3b3662);}return _0x4d7680[_0x0813('0x22')]();};}function saveUpdates(_0xf6ee0c,_0x5a6cdc){return function(_0x2bb694){if(_0x2bb694){return _0x2bb694[_0x0813('0x23')](_0xf6ee0c)[_0x0813('0x24')](function(_0x598cf2){return _0x598cf2;});}return null;};}function removeEntity(_0x35b3d6,_0x5eabe4){return function(_0x56f4b6){if(_0x56f4b6){return _0x56f4b6[_0x0813('0x25')]()['then'](function(){_0x35b3d6['status'](0xcc)[_0x0813('0x26')]();});}};}function handleEntityNotFound(_0x2366a3,_0x1a8d2a){return function(_0x2f8849){if(!_0x2f8849){_0x2366a3[_0x0813('0x18')](0x194);}return _0x2f8849;};}function handleError(_0x1418c7,_0x42627c){_0x42627c=_0x42627c||0x1f4;return function(_0x3ac129){logger['error'](_0x3ac129[_0x0813('0x27')]);if(_0x3ac129[_0x0813('0x28')]){delete _0x3ac129[_0x0813('0x28')];}_0x1418c7[_0x0813('0x19')](_0x42627c)[_0x0813('0x29')](_0x3ac129);};}exports[_0x0813('0x2a')]=function(_0x55e115,_0xa36d86){var _0x48294b={},_0x54ed64={},_0x54bf5d={'count':0x0,'rows':[]};var _0x3c3321=_[_0x0813('0x2b')](db[_0x0813('0x2c')][_0x0813('0x2d')],function(_0x21f388){return{'name':_0x21f388[_0x0813('0x2e')],'type':_0x21f388['type'][_0x0813('0x2f')]};});_0x54ed64[_0x0813('0x30')]=_['map'](_0x3c3321,'name');_0x54ed64[_0x0813('0x31')]=_[_0x0813('0x32')](_0x55e115[_0x0813('0x31')]);_0x54ed64['filters']=_[_0x0813('0x33')](_0x54ed64[_0x0813('0x30')],_0x54ed64['query']);_0x48294b['attributes']=_[_0x0813('0x33')](_0x54ed64[_0x0813('0x30')],qs[_0x0813('0x34')](_0x55e115[_0x0813('0x31')]['fields']));_0x48294b[_0x0813('0x35')]=_0x48294b[_0x0813('0x35')][_0x0813('0x36')]?_0x48294b[_0x0813('0x35')]:_0x54ed64['model'];if(!_0x55e115['query'][_0x0813('0x37')](_0x0813('0x38'))){_0x48294b[_0x0813('0x1d')]=qs['limit'](_0x55e115[_0x0813('0x31')][_0x0813('0x1d')]);_0x48294b[_0x0813('0x1b')]=qs['offset'](_0x55e115['query'][_0x0813('0x1b')]);}_0x48294b[_0x0813('0x39')]=qs[_0x0813('0x3a')](_0x55e115[_0x0813('0x31')][_0x0813('0x3a')]);_0x48294b[_0x0813('0x3b')]=qs['filters'](_[_0x0813('0x3c')](_0x55e115['query'],_0x54ed64['filters']),_0x3c3321);if(_0x55e115['query'][_0x0813('0x3d')]){_0x48294b[_0x0813('0x3b')]=_['merge'](_0x48294b['where'],{'$or':_[_0x0813('0x2b')](_0x3c3321,function(_0x36ce6d){if(_0x36ce6d[_0x0813('0x3e')]!==_0x0813('0x3f')){var _0x36f4d5={};_0x36f4d5[_0x36ce6d[_0x0813('0x28')]]={'$like':'%'+_0x55e115[_0x0813('0x31')][_0x0813('0x3d')]+'%'};return _0x36f4d5;}})});}_0x48294b=_[_0x0813('0x40')]({},_0x48294b,_0x55e115[_0x0813('0x41')]);var _0x54b271={'where':_0x48294b['where']};return db['FreshdeskField'][_0x0813('0x1e')](_0x54b271)[_0x0813('0x24')](function(_0x5cb01b){_0x54bf5d[_0x0813('0x1e')]=_0x5cb01b;if(_0x55e115[_0x0813('0x31')][_0x0813('0x42')]){_0x48294b['include']=[{'all':!![]}];}return db[_0x0813('0x2c')][_0x0813('0x43')](_0x48294b);})[_0x0813('0x24')](function(_0x4e94b0){_0x54bf5d[_0x0813('0x44')]=_0x4e94b0;return _0x54bf5d;})[_0x0813('0x24')](respondWithFilteredResult(_0xa36d86,_0x48294b))[_0x0813('0x45')](handleError(_0xa36d86,null));};exports['show']=function(_0x22564d,_0x38dc22){var _0x47da3b={'raw':!![],'where':{'id':_0x22564d[_0x0813('0x46')]['id']}},_0x171a5e={};_0x171a5e['model']=_[_0x0813('0x32')](db['FreshdeskField'][_0x0813('0x2d')]);_0x171a5e[_0x0813('0x31')]=_[_0x0813('0x32')](_0x22564d['query']);_0x171a5e[_0x0813('0x47')]=_['intersection'](_0x171a5e[_0x0813('0x30')],_0x171a5e[_0x0813('0x31')]);_0x47da3b[_0x0813('0x35')]=_[_0x0813('0x33')](_0x171a5e[_0x0813('0x30')],qs[_0x0813('0x34')](_0x22564d['query'][_0x0813('0x34')]));_0x47da3b['attributes']=_0x47da3b[_0x0813('0x35')]['length']?_0x47da3b['attributes']:_0x171a5e['model'];if(_0x22564d[_0x0813('0x31')][_0x0813('0x42')]){_0x47da3b[_0x0813('0x48')]=[{'all':!![]}];}_0x47da3b=_[_0x0813('0x40')]({},_0x47da3b,_0x22564d[_0x0813('0x41')]);return db[_0x0813('0x2c')]['find'](_0x47da3b)['then'](handleEntityNotFound(_0x38dc22,null))[_0x0813('0x24')](respondWithResult(_0x38dc22,null))[_0x0813('0x45')](handleError(_0x38dc22,null));};exports[_0x0813('0x49')]=function(_0x3fd5f9,_0xadaead){return db[_0x0813('0x2c')][_0x0813('0x49')](_0x3fd5f9[_0x0813('0x4a')],{})['then'](respondWithResult(_0xadaead,0xc9))[_0x0813('0x45')](handleError(_0xadaead,null));};exports[_0x0813('0x23')]=function(_0x42e4e4,_0x1baf77){if(_0x42e4e4[_0x0813('0x4a')]['id']){delete _0x42e4e4[_0x0813('0x4a')]['id'];}return db['FreshdeskField'][_0x0813('0x4b')]({'where':{'id':_0x42e4e4['params']['id']}})[_0x0813('0x24')](handleEntityNotFound(_0x1baf77,null))[_0x0813('0x24')](saveUpdates(_0x42e4e4[_0x0813('0x4a')],null))[_0x0813('0x24')](respondWithResult(_0x1baf77,null))['catch'](handleError(_0x1baf77,null));};exports[_0x0813('0x25')]=function(_0x3a93eb,_0x353e25){return db[_0x0813('0x2c')]['find']({'where':{'id':_0x3a93eb[_0x0813('0x46')]['id']}})[_0x0813('0x24')](handleEntityNotFound(_0x353e25,null))['then'](removeEntity(_0x353e25,null))['catch'](handleError(_0x353e25,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 14613d4..d98ad91 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 _0x758e=['FreshdeskField','idField','lodash','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x7106d6,_0x5c2fe1){var _0x414b1e=function(_0x124043){while(--_0x124043){_0x7106d6['push'](_0x7106d6['shift']());}};_0x414b1e(++_0x5c2fe1);}(_0x758e,0x1af));var _0xe758=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x758e[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe758('0x1'));var moment=require(_0xe758('0x2'));var BPromise=require(_0xe758('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe758('0x4'));var config=require(_0xe758('0x5'));var attributes=require(_0xe758('0x6'));module[_0xe758('0x7')]=function(_0x5a2226,_0x2cdf89){return _0x5a2226[_0xe758('0x8')](_0xe758('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xe758('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b19=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x7b19,0x1b7));var _0x97b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7b19[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x97b1('0x0'));var logger=require(_0x97b1('0x1'))(_0x97b1('0x2'));var moment=require('moment');var BPromise=require(_0x97b1('0x3'));var rp=require(_0x97b1('0x4'));var fs=require('fs');var path=require(_0x97b1('0x5'));var rimraf=require(_0x97b1('0x6'));var config=require(_0x97b1('0x7'));var attributes=require(_0x97b1('0x8'));module[_0x97b1('0x9')]=function(_0x1a6672,_0x4b675e){return _0x1a6672[_0x97b1('0xa')](_0x97b1('0xb'),attributes,{'tableName':_0x97b1('0xc'),'paranoid':![],'indexes':[{'name':_0x97b1('0xd'),'fields':[_0x97b1('0xe'),_0x97b1('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 2e4ac15..ae0f536 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 _0xdcc5=['message','result','catch','util','bluebird','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x30ce9d,_0x180023){var _0x496c73=function(_0x32611a){while(--_0x32611a){_0x30ce9d['push'](_0x30ce9d['shift']());}};_0x496c73(++_0x180023);}(_0xdcc5,0x146));var _0x5dcc=function(_0x31e5a1,_0x393a96){_0x31e5a1=_0x31e5a1-0x0;var _0xa9d83d=_0xdcc5[_0x31e5a1];return _0xa9d83d;};'use strict';var _=require('lodash');var util=require(_0x5dcc('0x0'));var moment=require('moment');var BPromise=require(_0x5dcc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dcc('0x2'));var db=require(_0x5dcc('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5dcc('0x4'));var client=jayson[_0x5dcc('0x5')][_0x5dcc('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5d29af,_0xa723d,_0x5bb998){return new BPromise(function(_0x449698,_0x17c12e){return client[_0x5dcc('0x7')](_0x5d29af,_0x5bb998)[_0x5dcc('0x8')](function(_0x3b1ffe){logger[_0x5dcc('0x9')](_0x5dcc('0xa'),_0xa723d,_0x5dcc('0xb'));logger[_0x5dcc('0xc')](_0x5dcc('0xd'),_0xa723d,_0x5dcc('0xb'),JSON[_0x5dcc('0xe')](_0x3b1ffe));if(_0x3b1ffe[_0x5dcc('0xf')]){if(_0x3b1ffe[_0x5dcc('0xf')]['code']===0x1f4){logger[_0x5dcc('0xf')](_0x5dcc('0xa'),_0xa723d,_0x3b1ffe[_0x5dcc('0xf')][_0x5dcc('0x10')]);return _0x17c12e(_0x3b1ffe[_0x5dcc('0xf')][_0x5dcc('0x10')]);}logger['error'](_0x5dcc('0xa'),_0xa723d,_0x3b1ffe[_0x5dcc('0xf')]['message']);return _0x449698(_0x3b1ffe['error']['message']);}else{logger[_0x5dcc('0x9')](_0x5dcc('0xa'),_0xa723d,'request\x20sent');_0x449698(_0x3b1ffe[_0x5dcc('0x11')][_0x5dcc('0x10')]);}})[_0x5dcc('0x12')](function(_0x365ccc){logger[_0x5dcc('0xf')](_0x5dcc('0xa'),_0xa723d,_0x365ccc);_0x17c12e(_0x365ccc);});});} \ No newline at end of file +var _0xd95e=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s'];(function(_0x38fc4d,_0x40c0a8){var _0x2b36a1=function(_0x18b583){while(--_0x18b583){_0x38fc4d['push'](_0x38fc4d['shift']());}};_0x2b36a1(++_0x40c0a8);}(_0xd95e,0x16f));var _0xed95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd95e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xed95('0x0'));var util=require(_0xed95('0x1'));var moment=require('moment');var BPromise=require(_0xed95('0x2'));var rs=require(_0xed95('0x3'));var fs=require('fs');var Redis=require(_0xed95('0x4'));var db=require(_0xed95('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed95('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xed95('0x7'));var client=jayson[_0xed95('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x320299,_0x22594e,_0x4ddc80){return new BPromise(function(_0x4636f7,_0x47dbe6){return client[_0xed95('0x9')](_0x320299,_0x4ddc80)[_0xed95('0xa')](function(_0x5c1532){logger[_0xed95('0xb')](_0xed95('0xc'),_0x22594e,_0xed95('0xd'));logger[_0xed95('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x22594e,_0xed95('0xd'),JSON[_0xed95('0xf')](_0x5c1532));if(_0x5c1532['error']){if(_0x5c1532[_0xed95('0x10')]['code']===0x1f4){logger[_0xed95('0x10')](_0xed95('0xc'),_0x22594e,_0x5c1532[_0xed95('0x10')][_0xed95('0x11')]);return _0x47dbe6(_0x5c1532[_0xed95('0x10')][_0xed95('0x11')]);}logger['error'](_0xed95('0xc'),_0x22594e,_0x5c1532[_0xed95('0x10')][_0xed95('0x11')]);return _0x4636f7(_0x5c1532[_0xed95('0x10')][_0xed95('0x11')]);}else{logger['info'](_0xed95('0xc'),_0x22594e,_0xed95('0xd'));_0x4636f7(_0x5c1532[_0xed95('0x12')][_0xed95('0x11')]);}})[_0xed95('0x13')](function(_0x229114){logger[_0xed95('0x10')](_0xed95('0xc'),_0x22594e,_0x229114);_0x47dbe6(_0x229114);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 052662f..7f34de2 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 _0xf7b4=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4190c5,_0x383337){_0x4190c5=_0x4190c5-0x0;var _0x5b8c76=_0xf7b4[_0x4190c5];return _0x5b8c76;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/fields',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);router['post'](_0x4f7b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4f7b('0x11')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['delete'](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x13')]);module[_0x4f7b('0x14')]=router; \ No newline at end of file +var _0x373d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','update','destroy','exports','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x373d,0x1e2));var _0xd373=function(_0x4f1ff3,_0x2736a1){_0x4f1ff3=_0x4f1ff3-0x0;var _0x1768a5=_0x373d[_0x4f1ff3];return _0x1768a5;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require(_0xd373('0x3'));var router=express[_0xd373('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd373('0x5'));var interaction=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xd373('0x8')](),controller[_0xd373('0x9')]);router[_0xd373('0xa')](_0xd373('0xb'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd373('0xd')]);router[_0xd373('0xa')]('/:id/fields',auth[_0xd373('0x8')](),controller[_0xd373('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd373('0xf')]);router[_0xd373('0x10')](_0xd373('0x11'),auth[_0xd373('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0xd373('0x8')](),controller[_0xd373('0x12')]);router['delete'](_0xd373('0xb'),auth[_0xd373('0x8')](),controller[_0xd373('0x13')]);module[_0xd373('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index af4f1a2..6508763 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 _0x3a6d=['exports','STRING','username','sequelize'];(function(_0x339b63,_0x38d905){var _0x34eb4a=function(_0x465718){while(--_0x465718){_0x339b63['push'](_0x339b63['shift']());}};_0x34eb4a(++_0x38d905);}(_0x3a6d,0x143));var _0xd3a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3a6d[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3a6('0x2')]},'username':{'type':Sequelize[_0xd3a6('0x2')],'unique':_0xd3a6('0x3')},'apiKey':{'type':Sequelize[_0xd3a6('0x2')]},'remoteUri':{'type':Sequelize[_0xd3a6('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd3a6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa456=['STRING','username','sequelize','exports'];(function(_0x2b4283,_0x2b127d){var _0x4a0a2d=function(_0x587da4){while(--_0x587da4){_0x2b4283['push'](_0x2b4283['shift']());}};_0x4a0a2d(++_0x2b127d);}(_0xa456,0x142));var _0x6a45=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xa456[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('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 a9b4ee7..2ce63d4 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 _0x8907=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','options','where','FreshsalesAccount','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','FreshsalesConfiguration','pick','map','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','findOne','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x8907,0xcc));var _0x7890=function(_0xfa4f6b,_0x5c6f62){_0xfa4f6b=_0xfa4f6b-0x0;var _0x2751aa=_0x8907[_0xfa4f6b];return _0x2751aa;};'use strict';var emlformat=require(_0x7890('0x0'));var rimraf=require(_0x7890('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7890('0x2'));var rp=require(_0x7890('0x3'));var moment=require(_0x7890('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7890('0x5'));var path=require(_0x7890('0x6'));var sox=require(_0x7890('0x7'));var csv=require(_0x7890('0x8'));var ejs=require(_0x7890('0x9'));var fs=require('fs');var fs_extra=require(_0x7890('0xa'));var _=require('lodash');var squel=require(_0x7890('0xb'));var crypto=require('crypto');var jsforce=require(_0x7890('0xc'));var deskjs=require(_0x7890('0xd'));var toCsv=require(_0x7890('0x8'));var querystring=require(_0x7890('0xe'));var Papa=require(_0x7890('0xf'));var Redis=require('ioredis');var authService=require(_0x7890('0x10'));var qs=require(_0x7890('0x11'));var as=require(_0x7890('0x12'));var hardwareService=require(_0x7890('0x13'));var logger=require(_0x7890('0x14'))(_0x7890('0x15'));var utils=require(_0x7890('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7890('0x17'));var db=require(_0x7890('0x18'))['db'];var integrations=require(_0x7890('0x19'));function respondWithStatusCode(_0x1c289a,_0x551f98){_0x551f98=_0x551f98||0xcc;return function(_0x5188a1){if(_0x5188a1){return _0x1c289a[_0x7890('0x1a')](_0x551f98);}return _0x1c289a[_0x7890('0x1b')](_0x551f98)[_0x7890('0x1c')]();};}function respondWithResult(_0xcaf7ba,_0x580ae0){_0x580ae0=_0x580ae0||0xc8;return function(_0x1f398c){if(_0x1f398c){return _0xcaf7ba['status'](_0x580ae0)[_0x7890('0x1d')](_0x1f398c);}};}function respondWithFilteredResult(_0x862d8a,_0x14678a){return function(_0xfd9904){if(_0xfd9904){var _0xd22747=typeof _0x14678a[_0x7890('0x1e')]===_0x7890('0x1f')&&typeof _0x14678a[_0x7890('0x20')]===_0x7890('0x1f');var _0x520a0f=_0xfd9904[_0x7890('0x21')];var _0x243cb8=_0xd22747?0x0:_0x14678a[_0x7890('0x1e')];var _0x1bd005=_0xd22747?_0xfd9904[_0x7890('0x21')]:_0x14678a['offset']+_0x14678a[_0x7890('0x20')];var _0x1c60c8;if(_0x1bd005>=_0x520a0f){_0x1bd005=_0x520a0f;_0x1c60c8=0xc8;}else{_0x1c60c8=0xce;}_0x862d8a[_0x7890('0x1b')](_0x1c60c8);return _0x862d8a[_0x7890('0x22')](_0x7890('0x23'),_0x243cb8+'-'+_0x1bd005+'/'+_0x520a0f)['json'](_0xfd9904);}return null;};}function patchUpdates(_0x1eef37){return function(_0x28f6ac){try{jsonpatch[_0x7890('0x24')](_0x28f6ac,_0x1eef37,!![]);}catch(_0x57d872){return BPromise[_0x7890('0x25')](_0x57d872);}return _0x28f6ac[_0x7890('0x26')]();};}function saveUpdates(_0x35d82c,_0x4c4fbc){return function(_0x1ca528){if(_0x1ca528){return _0x1ca528[_0x7890('0x27')](_0x35d82c)['then'](function(_0x50b48b){return _0x50b48b;});}return null;};}function removeEntity(_0x258cdf,_0x22a660){return function(_0x225319){if(_0x225319){return _0x225319[_0x7890('0x28')]()['then'](function(){_0x258cdf['status'](0xcc)[_0x7890('0x1c')]();});}};}function handleEntityNotFound(_0x5a1330,_0x10a312){return function(_0x54790f){if(!_0x54790f){_0x5a1330[_0x7890('0x1a')](0x194);}return _0x54790f;};}function handleError(_0x346704,_0x1f7b8e){_0x1f7b8e=_0x1f7b8e||0x1f4;return function(_0x4183cb){logger[_0x7890('0x29')](_0x4183cb[_0x7890('0x2a')]);if(_0x4183cb[_0x7890('0x2b')]){delete _0x4183cb[_0x7890('0x2b')];}_0x346704[_0x7890('0x1b')](_0x1f7b8e)['send'](_0x4183cb);};}exports['index']=function(_0x321f50,_0x19ebfc){var _0x19d148={},_0x2e2598={},_0x28d192={'count':0x0,'rows':[]};var _0x5b0a19=_['map'](db['FreshsalesAccount'][_0x7890('0x2c')],function(_0x590089){return{'name':_0x590089[_0x7890('0x2d')],'type':_0x590089[_0x7890('0x2e')][_0x7890('0x2f')]};});_0x2e2598[_0x7890('0x30')]=_['map'](_0x5b0a19,_0x7890('0x2b'));_0x2e2598[_0x7890('0x31')]=_[_0x7890('0x32')](_0x321f50['query']);_0x2e2598['filters']=_['intersection'](_0x2e2598['model'],_0x2e2598['query']);_0x19d148[_0x7890('0x33')]=_[_0x7890('0x34')](_0x2e2598[_0x7890('0x30')],qs['fields'](_0x321f50['query'][_0x7890('0x35')]));_0x19d148[_0x7890('0x33')]=_0x19d148['attributes']['length']?_0x19d148[_0x7890('0x33')]:_0x2e2598[_0x7890('0x30')];if(!_0x321f50[_0x7890('0x31')][_0x7890('0x36')](_0x7890('0x37'))){_0x19d148[_0x7890('0x20')]=qs[_0x7890('0x20')](_0x321f50[_0x7890('0x31')][_0x7890('0x20')]);_0x19d148[_0x7890('0x1e')]=qs[_0x7890('0x1e')](_0x321f50['query']['offset']);}_0x19d148[_0x7890('0x38')]=qs[_0x7890('0x39')](_0x321f50[_0x7890('0x31')][_0x7890('0x39')]);_0x19d148['where']=qs[_0x7890('0x3a')](_['pick'](_0x321f50['query'],_0x2e2598[_0x7890('0x3a')]),_0x5b0a19);if(_0x321f50[_0x7890('0x31')][_0x7890('0x3b')]){_0x19d148['where']=_[_0x7890('0x3c')](_0x19d148['where'],{'$or':_['map'](_0x5b0a19,function(_0x2ba3fc){if(_0x2ba3fc[_0x7890('0x2e')]!=='VIRTUAL'){var _0x2788b5={};_0x2788b5[_0x2ba3fc[_0x7890('0x2b')]]={'$like':'%'+_0x321f50[_0x7890('0x31')][_0x7890('0x3b')]+'%'};return _0x2788b5;}})});}_0x19d148=_[_0x7890('0x3c')]({},_0x19d148,_0x321f50[_0x7890('0x3d')]);var _0x37f3b9={'where':_0x19d148[_0x7890('0x3e')]};return db[_0x7890('0x3f')][_0x7890('0x21')](_0x37f3b9)[_0x7890('0x40')](function(_0x3169c5){_0x28d192[_0x7890('0x21')]=_0x3169c5;if(_0x321f50[_0x7890('0x31')][_0x7890('0x41')]){_0x19d148[_0x7890('0x42')]=[{'all':!![]}];}return db[_0x7890('0x3f')][_0x7890('0x43')](_0x19d148);})['then'](function(_0x216fea){_0x28d192[_0x7890('0x44')]=_0x216fea;return _0x28d192;})['then'](respondWithFilteredResult(_0x19ebfc,_0x19d148))[_0x7890('0x45')](handleError(_0x19ebfc,null));};exports[_0x7890('0x46')]=function(_0x586adc,_0x4cee76){var _0x1a193c={'raw':![],'where':{'id':_0x586adc[_0x7890('0x47')]['id']}},_0x15bbb7={};_0x15bbb7[_0x7890('0x30')]=_['keys'](db['FreshsalesAccount'][_0x7890('0x2c')]);_0x15bbb7['query']=_[_0x7890('0x32')](_0x586adc[_0x7890('0x31')]);_0x15bbb7[_0x7890('0x3a')]=_[_0x7890('0x34')](_0x15bbb7['model'],_0x15bbb7[_0x7890('0x31')]);_0x1a193c[_0x7890('0x33')]=_[_0x7890('0x34')](_0x15bbb7['model'],qs[_0x7890('0x35')](_0x586adc[_0x7890('0x31')][_0x7890('0x35')]));_0x1a193c[_0x7890('0x33')]=_0x1a193c['attributes'][_0x7890('0x48')]?_0x1a193c['attributes']:_0x15bbb7['model'];if(_0x586adc[_0x7890('0x31')][_0x7890('0x41')]){_0x1a193c['include']=[{'all':!![]}];}_0x1a193c=_[_0x7890('0x3c')]({},_0x1a193c,_0x586adc['options']);return db['FreshsalesAccount'][_0x7890('0x49')](_0x1a193c)[_0x7890('0x40')](handleEntityNotFound(_0x4cee76,null))[_0x7890('0x40')](respondWithResult(_0x4cee76,null))[_0x7890('0x45')](handleError(_0x4cee76,null));};exports[_0x7890('0x4a')]=function(_0x2881b5,_0x581fa9){return db[_0x7890('0x3f')]['create'](_0x2881b5[_0x7890('0x4b')],{})[_0x7890('0x40')](respondWithResult(_0x581fa9,0xc9))[_0x7890('0x45')](handleError(_0x581fa9,null));};exports[_0x7890('0x27')]=function(_0x2702b0,_0x4850e4){if(_0x2702b0[_0x7890('0x4b')]['id']){delete _0x2702b0[_0x7890('0x4b')]['id'];}return db[_0x7890('0x3f')][_0x7890('0x49')]({'where':{'id':_0x2702b0[_0x7890('0x47')]['id']}})['then'](handleEntityNotFound(_0x4850e4,null))['then'](saveUpdates(_0x2702b0[_0x7890('0x4b')],null))[_0x7890('0x40')](respondWithResult(_0x4850e4,null))['catch'](handleError(_0x4850e4,null));};exports[_0x7890('0x28')]=function(_0x4946a6,_0x5d1451){return db[_0x7890('0x3f')]['find']({'where':{'id':_0x4946a6['params']['id']}})[_0x7890('0x40')](handleEntityNotFound(_0x5d1451,null))[_0x7890('0x40')](removeEntity(_0x5d1451,null))[_0x7890('0x45')](handleError(_0x5d1451,null));};exports[_0x7890('0x4c')]=function(_0x5c6251,_0x2a1757,_0x41a6a5){var _0x15a9b3={};var _0x5a73ff={};var _0x31257f;var _0x37ea21;return db[_0x7890('0x3f')]['findOne']({'where':{'id':_0x5c6251[_0x7890('0x47')]['id']}})[_0x7890('0x40')](handleEntityNotFound(_0x2a1757,null))['then'](function(_0x5d0e7a){if(_0x5d0e7a){_0x31257f=_0x5d0e7a;_0x5a73ff['model']=_[_0x7890('0x32')](db[_0x7890('0x4d')][_0x7890('0x2c')]);_0x5a73ff[_0x7890('0x31')]=_[_0x7890('0x32')](_0x5c6251[_0x7890('0x31')]);_0x5a73ff['filters']=_[_0x7890('0x34')](_0x5a73ff[_0x7890('0x30')],_0x5a73ff[_0x7890('0x31')]);_0x15a9b3[_0x7890('0x33')]=_[_0x7890('0x34')](_0x5a73ff['model'],qs['fields'](_0x5c6251[_0x7890('0x31')][_0x7890('0x35')]));_0x15a9b3[_0x7890('0x33')]=_0x15a9b3['attributes'][_0x7890('0x48')]?_0x15a9b3['attributes']:_0x5a73ff[_0x7890('0x30')];_0x15a9b3[_0x7890('0x38')]=qs[_0x7890('0x39')](_0x5c6251[_0x7890('0x31')][_0x7890('0x39')]);_0x15a9b3[_0x7890('0x3e')]=qs[_0x7890('0x3a')](_[_0x7890('0x4e')](_0x5c6251['query'],_0x5a73ff[_0x7890('0x3a')]));if(_0x5c6251['query'][_0x7890('0x3b')]){_0x15a9b3[_0x7890('0x3e')]=_[_0x7890('0x3c')](_0x15a9b3['where'],{'$or':_[_0x7890('0x4f')](_0x15a9b3[_0x7890('0x33')],function(_0x4fafc0){var _0x52fd98={};_0x52fd98[_0x4fafc0]={'$like':'%'+_0x5c6251['query'][_0x7890('0x3b')]+'%'};return _0x52fd98;})});}_0x15a9b3=_['merge']({},_0x15a9b3,_0x5c6251[_0x7890('0x3d')]);return _0x31257f[_0x7890('0x4c')](_0x15a9b3);}})[_0x7890('0x40')](function(_0x1b9461){if(_0x1b9461){_0x37ea21=_0x1b9461[_0x7890('0x48')];if(!_0x5c6251[_0x7890('0x31')][_0x7890('0x36')]('nolimit')){_0x15a9b3[_0x7890('0x20')]=qs[_0x7890('0x20')](_0x5c6251['query'][_0x7890('0x20')]);_0x15a9b3[_0x7890('0x1e')]=qs['offset'](_0x5c6251[_0x7890('0x31')][_0x7890('0x1e')]);}return _0x31257f[_0x7890('0x4c')](_0x15a9b3);}})['then'](function(_0x328e95){if(_0x328e95){return _0x328e95?{'count':_0x37ea21,'rows':_0x328e95}:null;}})['then'](respondWithResult(_0x2a1757,null))[_0x7890('0x45')](handleError(_0x2a1757,null));};exports[_0x7890('0x50')]=function(_0x11c429,_0xbda2db,_0x3ecfa0){if(_0x11c429[_0x7890('0x4b')]['id']){delete _0x11c429['body']['id'];}return db[_0x7890('0x3f')]['findOne']({'where':{'id':_0x11c429[_0x7890('0x47')]['id']}})[_0x7890('0x40')](handleEntityNotFound(_0xbda2db,null))[_0x7890('0x40')](function(_0x334b33){if(_0x334b33){_0x11c429[_0x7890('0x4b')][_0x7890('0x51')]=_0x334b33['id'];_0x11c429[_0x7890('0x4b')]['Subjects']=integrations[_0x7890('0x52')](_0x11c429['body'][_0x7890('0x53')],_0x11c429[_0x7890('0x4b')][_0x7890('0x2e')]);_0x11c429['body'][_0x7890('0x54')]=integrations[_0x7890('0x55')](_0x11c429[_0x7890('0x4b')][_0x7890('0x53')],_0x11c429[_0x7890('0x4b')][_0x7890('0x2e')]);return db['FreshsalesConfiguration'][_0x7890('0x4a')](_0x11c429[_0x7890('0x4b')],{'include':[{'model':db[_0x7890('0x56')],'as':_0x7890('0x57')},{'model':db[_0x7890('0x56')],'as':_0x7890('0x54')}]});}return null;})[_0x7890('0x40')](respondWithResult(_0xbda2db,null))[_0x7890('0x45')](handleError(_0xbda2db,null));};exports['getFields']=function(_0x2b504d,_0x430dd2,_0x127adf){var _0x49c836='';var _0x3de722='';return db[_0x7890('0x3f')][_0x7890('0x58')]({'where':{'id':_0x2b504d[_0x7890('0x47')]['id']},'attributes':['id',_0x7890('0x59'),_0x7890('0x5a'),_0x7890('0x5b')]})[_0x7890('0x40')](handleEntityNotFound(_0x430dd2,null))[_0x7890('0x40')](function(_0x151854){if(_0x151854){_0x3de722=_0x151854[_0x7890('0x59')];_0x49c836=_0x151854[_0x7890('0x5a')];var _0x213355=_0x151854['remoteUri'][_0x7890('0x5c')](-0x1);if(_0x213355==='/'){_0x49c836=_0x49c836[_0x7890('0x5d')](0x0,_0x49c836[_0x7890('0x5e')](_0x213355));}return rp({'method':_0x7890('0x5f'),'uri':util[_0x7890('0x60')]('%s%s',_0x49c836,_0x7890('0x61')),'headers':{'Authorization':_0x7890('0x62')+_0x151854[_0x7890('0x5b')]},'json':!![]});}})[_0x7890('0x40')](function(_0x30cb68){if(_0x30cb68){var _0x3b5377=_0x30cb68[_0x7890('0x63')];var _0xac3773=![];var _0x35be39=null;for(_0x35be39=0x0;_0x35be39<_0x3b5377[_0x7890('0x48')];_0x35be39++){if(_0x3b5377[_0x35be39][_0x7890('0x64')]===_0x3de722){_0xac3773=!![];}}if(_0xac3773){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7890('0x65')});}}})['then'](respondWithResult(_0x430dd2,null))[_0x7890('0x45')](function(_0xe7bc1e){var _0x4e8e56=_0x2b504d[_0x7890('0x31')][_0x7890('0x66')]?0x1f4:_0xe7bc1e[_0x7890('0x67')]||0x1f4;logger[_0x7890('0x29')](_0x7890('0x68'),_0x7890('0x69'),_0x4e8e56,JSON['stringify'](_0xe7bc1e));delete _0xe7bc1e['name'];if(_0x4e8e56===0x191){_0x4e8e56=0x190;}_0x430dd2[_0x7890('0x1b')](_0x4e8e56)[_0x7890('0x6a')](_0x2b504d['query'][_0x7890('0x66')]?{'message':_0x7890('0x6b'),'statusCode':_0xe7bc1e[_0x7890('0x67')]}:_0xe7bc1e);});}; \ No newline at end of file +var _0x2a22=['update','then','destroy','end','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','keys','include','find','create','body','params','findOne','FreshsalesConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','crypto','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0x2a22,0xae));var _0x22a2=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2a22[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x22a2('0x0'));var rimraf=require(_0x22a2('0x1'));var zipdir=require(_0x22a2('0x2'));var jsonpatch=require(_0x22a2('0x3'));var rp=require(_0x22a2('0x4'));var moment=require(_0x22a2('0x5'));var BPromise=require(_0x22a2('0x6'));var Mustache=require(_0x22a2('0x7'));var util=require(_0x22a2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x22a2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x22a2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x22a2('0xb'));var Papa=require(_0x22a2('0xc'));var Redis=require(_0x22a2('0xd'));var authService=require(_0x22a2('0xe'));var qs=require(_0x22a2('0xf'));var as=require(_0x22a2('0x10'));var hardwareService=require(_0x22a2('0x11'));var logger=require(_0x22a2('0x12'))('api');var utils=require(_0x22a2('0x13'));var config=require(_0x22a2('0x14'));var licenseUtil=require(_0x22a2('0x15'));var db=require(_0x22a2('0x16'))['db'];var integrations=require(_0x22a2('0x17'));function respondWithStatusCode(_0x181543,_0xadd4ff){_0xadd4ff=_0xadd4ff||0xcc;return function(_0x28bc41){if(_0x28bc41){return _0x181543[_0x22a2('0x18')](_0xadd4ff);}return _0x181543[_0x22a2('0x19')](_0xadd4ff)['end']();};}function respondWithResult(_0xf6275c,_0x75e6bd){_0x75e6bd=_0x75e6bd||0xc8;return function(_0x1a5da1){if(_0x1a5da1){return _0xf6275c[_0x22a2('0x19')](_0x75e6bd)[_0x22a2('0x1a')](_0x1a5da1);}};}function respondWithFilteredResult(_0x54dc65,_0x14cbad){return function(_0x4c7766){if(_0x4c7766){var _0x2d4663=typeof _0x14cbad[_0x22a2('0x1b')]===_0x22a2('0x1c')&&typeof _0x14cbad[_0x22a2('0x1d')]===_0x22a2('0x1c');var _0x1394c0=_0x4c7766[_0x22a2('0x1e')];var _0x51530e=_0x2d4663?0x0:_0x14cbad['offset'];var _0x478a8b=_0x2d4663?_0x4c7766[_0x22a2('0x1e')]:_0x14cbad[_0x22a2('0x1b')]+_0x14cbad[_0x22a2('0x1d')];var _0x269443;if(_0x478a8b>=_0x1394c0){_0x478a8b=_0x1394c0;_0x269443=0xc8;}else{_0x269443=0xce;}_0x54dc65['status'](_0x269443);return _0x54dc65[_0x22a2('0x1f')](_0x22a2('0x20'),_0x51530e+'-'+_0x478a8b+'/'+_0x1394c0)['json'](_0x4c7766);}return null;};}function patchUpdates(_0x173467){return function(_0x1a3e1a){try{jsonpatch[_0x22a2('0x21')](_0x1a3e1a,_0x173467,!![]);}catch(_0x50cd6a){return BPromise[_0x22a2('0x22')](_0x50cd6a);}return _0x1a3e1a[_0x22a2('0x23')]();};}function saveUpdates(_0x55655f,_0xf276e){return function(_0x32d95b){if(_0x32d95b){return _0x32d95b[_0x22a2('0x24')](_0x55655f)[_0x22a2('0x25')](function(_0x56f2eb){return _0x56f2eb;});}return null;};}function removeEntity(_0x16a119,_0x503c5f){return function(_0x50b9a2){if(_0x50b9a2){return _0x50b9a2[_0x22a2('0x26')]()[_0x22a2('0x25')](function(){_0x16a119['status'](0xcc)[_0x22a2('0x27')]();});}};}function handleEntityNotFound(_0x1cada6,_0x3e87e6){return function(_0x192aec){if(!_0x192aec){_0x1cada6['sendStatus'](0x194);}return _0x192aec;};}function handleError(_0x10d01c,_0x5d2959){_0x5d2959=_0x5d2959||0x1f4;return function(_0x5472d9){logger[_0x22a2('0x28')](_0x5472d9[_0x22a2('0x29')]);if(_0x5472d9['name']){delete _0x5472d9[_0x22a2('0x2a')];}_0x10d01c[_0x22a2('0x19')](_0x5d2959)[_0x22a2('0x2b')](_0x5472d9);};}exports[_0x22a2('0x2c')]=function(_0x2de3dc,_0x3a2096){var _0x40492e={},_0x380e2e={},_0x3fb86e={'count':0x0,'rows':[]};var _0x4a1f6c=_[_0x22a2('0x2d')](db[_0x22a2('0x2e')][_0x22a2('0x2f')],function(_0x3c944d){return{'name':_0x3c944d[_0x22a2('0x30')],'type':_0x3c944d[_0x22a2('0x31')][_0x22a2('0x32')]};});_0x380e2e[_0x22a2('0x33')]=_[_0x22a2('0x2d')](_0x4a1f6c,_0x22a2('0x2a'));_0x380e2e['query']=_['keys'](_0x2de3dc[_0x22a2('0x34')]);_0x380e2e[_0x22a2('0x35')]=_[_0x22a2('0x36')](_0x380e2e[_0x22a2('0x33')],_0x380e2e[_0x22a2('0x34')]);_0x40492e[_0x22a2('0x37')]=_[_0x22a2('0x36')](_0x380e2e['model'],qs[_0x22a2('0x38')](_0x2de3dc[_0x22a2('0x34')]['fields']));_0x40492e['attributes']=_0x40492e[_0x22a2('0x37')][_0x22a2('0x39')]?_0x40492e[_0x22a2('0x37')]:_0x380e2e[_0x22a2('0x33')];if(!_0x2de3dc[_0x22a2('0x34')][_0x22a2('0x3a')](_0x22a2('0x3b'))){_0x40492e['limit']=qs[_0x22a2('0x1d')](_0x2de3dc['query'][_0x22a2('0x1d')]);_0x40492e[_0x22a2('0x1b')]=qs[_0x22a2('0x1b')](_0x2de3dc[_0x22a2('0x34')]['offset']);}_0x40492e[_0x22a2('0x3c')]=qs[_0x22a2('0x3d')](_0x2de3dc['query']['sort']);_0x40492e[_0x22a2('0x3e')]=qs[_0x22a2('0x35')](_[_0x22a2('0x3f')](_0x2de3dc[_0x22a2('0x34')],_0x380e2e[_0x22a2('0x35')]),_0x4a1f6c);if(_0x2de3dc[_0x22a2('0x34')][_0x22a2('0x40')]){_0x40492e['where']=_['merge'](_0x40492e[_0x22a2('0x3e')],{'$or':_[_0x22a2('0x2d')](_0x4a1f6c,function(_0x481667){if(_0x481667[_0x22a2('0x31')]!==_0x22a2('0x41')){var _0x2c33aa={};_0x2c33aa[_0x481667[_0x22a2('0x2a')]]={'$like':'%'+_0x2de3dc[_0x22a2('0x34')][_0x22a2('0x40')]+'%'};return _0x2c33aa;}})});}_0x40492e=_[_0x22a2('0x42')]({},_0x40492e,_0x2de3dc[_0x22a2('0x43')]);var _0x36bc4e={'where':_0x40492e[_0x22a2('0x3e')]};return db[_0x22a2('0x2e')][_0x22a2('0x1e')](_0x36bc4e)['then'](function(_0x1ee23c){_0x3fb86e[_0x22a2('0x1e')]=_0x1ee23c;if(_0x2de3dc[_0x22a2('0x34')][_0x22a2('0x44')]){_0x40492e['include']=[{'all':!![]}];}return db[_0x22a2('0x2e')]['findAll'](_0x40492e);})[_0x22a2('0x25')](function(_0x472942){_0x3fb86e[_0x22a2('0x45')]=_0x472942;return _0x3fb86e;})[_0x22a2('0x25')](respondWithFilteredResult(_0x3a2096,_0x40492e))[_0x22a2('0x46')](handleError(_0x3a2096,null));};exports[_0x22a2('0x47')]=function(_0x15be44,_0x2bc10d){var _0x32c9df={'raw':![],'where':{'id':_0x15be44['params']['id']}},_0x2c4b89={};_0x2c4b89[_0x22a2('0x33')]=_[_0x22a2('0x48')](db[_0x22a2('0x2e')][_0x22a2('0x2f')]);_0x2c4b89['query']=_[_0x22a2('0x48')](_0x15be44[_0x22a2('0x34')]);_0x2c4b89[_0x22a2('0x35')]=_['intersection'](_0x2c4b89['model'],_0x2c4b89[_0x22a2('0x34')]);_0x32c9df[_0x22a2('0x37')]=_[_0x22a2('0x36')](_0x2c4b89[_0x22a2('0x33')],qs['fields'](_0x15be44[_0x22a2('0x34')][_0x22a2('0x38')]));_0x32c9df[_0x22a2('0x37')]=_0x32c9df[_0x22a2('0x37')]['length']?_0x32c9df[_0x22a2('0x37')]:_0x2c4b89[_0x22a2('0x33')];if(_0x15be44[_0x22a2('0x34')][_0x22a2('0x44')]){_0x32c9df[_0x22a2('0x49')]=[{'all':!![]}];}_0x32c9df=_[_0x22a2('0x42')]({},_0x32c9df,_0x15be44['options']);return db['FreshsalesAccount'][_0x22a2('0x4a')](_0x32c9df)[_0x22a2('0x25')](handleEntityNotFound(_0x2bc10d,null))['then'](respondWithResult(_0x2bc10d,null))[_0x22a2('0x46')](handleError(_0x2bc10d,null));};exports[_0x22a2('0x4b')]=function(_0x38be76,_0x34f658){return db[_0x22a2('0x2e')][_0x22a2('0x4b')](_0x38be76['body'],{})[_0x22a2('0x25')](respondWithResult(_0x34f658,0xc9))[_0x22a2('0x46')](handleError(_0x34f658,null));};exports['update']=function(_0x4c293c,_0x5eb093){if(_0x4c293c['body']['id']){delete _0x4c293c[_0x22a2('0x4c')]['id'];}return db[_0x22a2('0x2e')][_0x22a2('0x4a')]({'where':{'id':_0x4c293c[_0x22a2('0x4d')]['id']}})[_0x22a2('0x25')](handleEntityNotFound(_0x5eb093,null))[_0x22a2('0x25')](saveUpdates(_0x4c293c['body'],null))[_0x22a2('0x25')](respondWithResult(_0x5eb093,null))[_0x22a2('0x46')](handleError(_0x5eb093,null));};exports['destroy']=function(_0x26de23,_0x4cdeb7){return db[_0x22a2('0x2e')][_0x22a2('0x4a')]({'where':{'id':_0x26de23[_0x22a2('0x4d')]['id']}})[_0x22a2('0x25')](handleEntityNotFound(_0x4cdeb7,null))['then'](removeEntity(_0x4cdeb7,null))[_0x22a2('0x46')](handleError(_0x4cdeb7,null));};exports['getConfigurations']=function(_0x13bb78,_0x13d61d,_0x2c2160){var _0x3ce1ef={};var _0x37b263={};var _0x2ed99e;var _0xe4f844;return db['FreshsalesAccount'][_0x22a2('0x4e')]({'where':{'id':_0x13bb78[_0x22a2('0x4d')]['id']}})[_0x22a2('0x25')](handleEntityNotFound(_0x13d61d,null))[_0x22a2('0x25')](function(_0x4cadb5){if(_0x4cadb5){_0x2ed99e=_0x4cadb5;_0x37b263['model']=_[_0x22a2('0x48')](db[_0x22a2('0x4f')]['rawAttributes']);_0x37b263['query']=_[_0x22a2('0x48')](_0x13bb78[_0x22a2('0x34')]);_0x37b263[_0x22a2('0x35')]=_[_0x22a2('0x36')](_0x37b263[_0x22a2('0x33')],_0x37b263[_0x22a2('0x34')]);_0x3ce1ef[_0x22a2('0x37')]=_[_0x22a2('0x36')](_0x37b263[_0x22a2('0x33')],qs[_0x22a2('0x38')](_0x13bb78[_0x22a2('0x34')][_0x22a2('0x38')]));_0x3ce1ef[_0x22a2('0x37')]=_0x3ce1ef[_0x22a2('0x37')][_0x22a2('0x39')]?_0x3ce1ef[_0x22a2('0x37')]:_0x37b263[_0x22a2('0x33')];_0x3ce1ef[_0x22a2('0x3c')]=qs[_0x22a2('0x3d')](_0x13bb78[_0x22a2('0x34')]['sort']);_0x3ce1ef[_0x22a2('0x3e')]=qs['filters'](_[_0x22a2('0x3f')](_0x13bb78[_0x22a2('0x34')],_0x37b263['filters']));if(_0x13bb78['query']['filter']){_0x3ce1ef['where']=_[_0x22a2('0x42')](_0x3ce1ef[_0x22a2('0x3e')],{'$or':_[_0x22a2('0x2d')](_0x3ce1ef[_0x22a2('0x37')],function(_0x5a82a6){var _0x580b02={};_0x580b02[_0x5a82a6]={'$like':'%'+_0x13bb78[_0x22a2('0x34')][_0x22a2('0x40')]+'%'};return _0x580b02;})});}_0x3ce1ef=_['merge']({},_0x3ce1ef,_0x13bb78[_0x22a2('0x43')]);return _0x2ed99e[_0x22a2('0x50')](_0x3ce1ef);}})['then'](function(_0x9df0b1){if(_0x9df0b1){_0xe4f844=_0x9df0b1[_0x22a2('0x39')];if(!_0x13bb78[_0x22a2('0x34')][_0x22a2('0x3a')](_0x22a2('0x3b'))){_0x3ce1ef[_0x22a2('0x1d')]=qs[_0x22a2('0x1d')](_0x13bb78[_0x22a2('0x34')]['limit']);_0x3ce1ef[_0x22a2('0x1b')]=qs[_0x22a2('0x1b')](_0x13bb78[_0x22a2('0x34')][_0x22a2('0x1b')]);}return _0x2ed99e[_0x22a2('0x50')](_0x3ce1ef);}})[_0x22a2('0x25')](function(_0x280e3d){if(_0x280e3d){return _0x280e3d?{'count':_0xe4f844,'rows':_0x280e3d}:null;}})[_0x22a2('0x25')](respondWithResult(_0x13d61d,null))['catch'](handleError(_0x13d61d,null));};exports['addConfiguration']=function(_0x32eb67,_0x3cfe2e,_0x143ef2){if(_0x32eb67[_0x22a2('0x4c')]['id']){delete _0x32eb67[_0x22a2('0x4c')]['id'];}return db[_0x22a2('0x2e')]['findOne']({'where':{'id':_0x32eb67[_0x22a2('0x4d')]['id']}})[_0x22a2('0x25')](handleEntityNotFound(_0x3cfe2e,null))[_0x22a2('0x25')](function(_0x2cfe2a){if(_0x2cfe2a){_0x32eb67[_0x22a2('0x4c')][_0x22a2('0x51')]=_0x2cfe2a['id'];_0x32eb67[_0x22a2('0x4c')][_0x22a2('0x52')]=integrations[_0x22a2('0x53')](_0x32eb67[_0x22a2('0x4c')][_0x22a2('0x54')],_0x32eb67[_0x22a2('0x4c')][_0x22a2('0x31')]);_0x32eb67[_0x22a2('0x4c')][_0x22a2('0x55')]=integrations[_0x22a2('0x56')](_0x32eb67['body'][_0x22a2('0x54')],_0x32eb67[_0x22a2('0x4c')][_0x22a2('0x31')]);return db['FreshsalesConfiguration'][_0x22a2('0x4b')](_0x32eb67['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x22a2('0x52')},{'model':db['FreshsalesField'],'as':_0x22a2('0x55')}]});}return null;})['then'](respondWithResult(_0x3cfe2e,null))[_0x22a2('0x46')](handleError(_0x3cfe2e,null));};exports[_0x22a2('0x57')]=function(_0xc65283,_0x1d6c23,_0x16491c){var _0x4caad8='';var _0x3bc03e='';return db[_0x22a2('0x2e')][_0x22a2('0x4e')]({'where':{'id':_0xc65283[_0x22a2('0x4d')]['id']},'attributes':['id',_0x22a2('0x58'),_0x22a2('0x59'),'apiKey']})[_0x22a2('0x25')](handleEntityNotFound(_0x1d6c23,null))['then'](function(_0x44abaa){if(_0x44abaa){_0x3bc03e=_0x44abaa[_0x22a2('0x58')];_0x4caad8=_0x44abaa[_0x22a2('0x59')];var _0xc2e30e=_0x44abaa[_0x22a2('0x59')][_0x22a2('0x5a')](-0x1);if(_0xc2e30e==='/'){_0x4caad8=_0x4caad8[_0x22a2('0x5b')](0x0,_0x4caad8[_0x22a2('0x5c')](_0xc2e30e));}return rp({'method':_0x22a2('0x5d'),'uri':util[_0x22a2('0x5e')](_0x22a2('0x5f'),_0x4caad8,'/api/selector/owners'),'headers':{'Authorization':_0x22a2('0x60')+_0x44abaa[_0x22a2('0x61')]},'json':!![]});}})['then'](function(_0x4d3694){if(_0x4d3694){var _0x110c80=_0x4d3694[_0x22a2('0x62')];var _0x338181=![];var _0x3eb55e=null;for(_0x3eb55e=0x0;_0x3eb55e<_0x110c80[_0x22a2('0x39')];_0x3eb55e++){if(_0x110c80[_0x3eb55e][_0x22a2('0x63')]===_0x3bc03e){_0x338181=!![];}}if(_0x338181){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x22a2('0x64')});}}})[_0x22a2('0x25')](respondWithResult(_0x1d6c23,null))[_0x22a2('0x46')](function(_0x3e2ba1){var _0x380300=_0xc65283[_0x22a2('0x34')]['test']?0x1f4:_0x3e2ba1[_0x22a2('0x65')]||0x1f4;logger[_0x22a2('0x28')](_0x22a2('0x66'),'getFields',_0x380300,JSON[_0x22a2('0x67')](_0x3e2ba1));delete _0x3e2ba1['name'];if(_0x380300===0x191){_0x380300=0x190;}_0x1d6c23[_0x22a2('0x19')](_0x380300)[_0x22a2('0x2b')](_0xc65283[_0x22a2('0x34')][_0x22a2('0x68')]?{'message':'Wrong\x20credentials','statusCode':_0x3e2ba1[_0x22a2('0x65')]}:_0x3e2ba1);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 77cea47..8fe6031 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 _0x2d72=['exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x2d72,0xa8));var _0x22d7=function(_0x525934,_0xdb4366){_0x525934=_0x525934-0x0;var _0x227b70=_0x2d72[_0x525934];return _0x227b70;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));var integrations=require(_0x22d7('0xb'));module[_0x22d7('0xc')]=function(_0x100426,_0x52a3e3){return _0x100426[_0x22d7('0xd')](_0x22d7('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x46a646,_0x5286e4){var _0x4eeb29=function(_0x2c56ee){while(--_0x2c56ee){_0x46a646['push'](_0x46a646['shift']());}};_0x4eeb29(++_0x5286e4);}(_0x6050,0x196));var _0x0605=function(_0x172497,_0x54b707){_0x172497=_0x172497-0x0;var _0x4f819f=_0x6050[_0x172497];return _0x4f819f;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd78d96,_0x578623){return _0xd78d96['define']('FreshsalesAccount',attributes,{'tableName':_0x0605('0x9'),'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 b48f6a8..5164a86 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 _0x0295=['find','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','where','include','map','model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount'];(function(_0x3d0c84,_0x1288b8){var _0x214ba9=function(_0x1e6e92){while(--_0x1e6e92){_0x3d0c84['push'](_0x3d0c84['shift']());}};_0x214ba9(++_0x1288b8);}(_0x0295,0x1f0));var _0x5029=function(_0x4668a6,_0x4e8a1f){_0x4668a6=_0x4668a6-0x0;var _0x23215d=_0x0295[_0x4668a6];return _0x23215d;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['GetFreshsalesAccount']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0x1ed567[_0x5029('0x17')]?_0x1ed567['options'][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')]['attributes']||null:null,'limit':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')]['limit']||null:null,'include':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')],function(_0x125c26){return{'model':db[_0x125c26[_0x5029('0x1c')]],'as':_0x125c26['as'],'attributes':_0x125c26[_0x5029('0x1d')],'include':_0x125c26['include']?_['map'](_0x125c26['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1c')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1b')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x5e45c4){logger[_0x5029('0xb')](_0x5029('0x1e'),_0x1ed567);logger[_0x5029('0xd')]('GetFreshsalesAccount',_0x1ed567,JSON[_0x5029('0xf')](_0x5e45c4));_0x35de81(_0x5e45c4);})[_0x5029('0x14')](function(_0xe5313e){logger['error'](_0x5029('0x1e'),_0xe5313e[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155['error'](0x1f4,_0xe5313e[_0x5029('0x12')]));});});};exports[_0x5029('0x1f')]=function(_0x4434ff){var _0x1c3dd9=this;return new Promise(function(_0x196830,_0x2a1ed6){return db[_0x5029('0x15')][_0x5029('0x20')]({'raw':_0x4434ff[_0x5029('0x17')]?_0x4434ff[_0x5029('0x17')][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x4434ff[_0x5029('0x17')]?_0x4434ff['options'][_0x5029('0x19')]||null:null,'attributes':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')]['attributes']||null:null,'include':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x4434ff['options'][_0x5029('0x1a')],function(_0x15d882){return{'model':db[_0x15d882[_0x5029('0x1c')]],'as':_0x15d882['as'],'attributes':_0x15d882[_0x5029('0x1d')],'include':_0x15d882[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x15d882[_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1c')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x3e2d88){logger['info']('ShowFreshsalesAccount',_0x4434ff);logger[_0x5029('0xd')](_0x5029('0x1f'),_0x4434ff,JSON['stringify'](_0x3e2d88));_0x196830(_0x3e2d88);})['catch'](function(_0x9656f2){logger[_0x5029('0x10')](_0x5029('0x1f'),_0x9656f2[_0x5029('0x12')],_0x4434ff);_0x2a1ed6(_0x1c3dd9[_0x5029('0x10')](0x1f4,_0x9656f2[_0x5029('0x12')]));});});}; \ No newline at end of file +var _0x4888=['FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshsalesAccount'];(function(_0x3ba13a,_0x11836f){var _0x1f9dab=function(_0xb13287){while(--_0xb13287){_0x3ba13a['push'](_0x3ba13a['shift']());}};_0x1f9dab(++_0x11836f);}(_0x4888,0x198));var _0x8488=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x4888[_0x3b594b];return _0x1ea5f8;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});}exports[_0x8488('0x17')]=function(_0x60ae2f){var _0x39775f=this;return new Promise(function(_0x1aedb1,_0x27c62a){return db[_0x8488('0x18')][_0x8488('0x19')]({'raw':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x60ae2f['options']?_0x60ae2f['options'][_0x8488('0x1c')]||null:null,'attributes':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1d')]||null:null,'limit':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1e')]||null:null,'include':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')]['include']?_[_0x8488('0x1f')](_0x60ae2f[_0x8488('0x1a')][_0x8488('0x20')],function(_0x1361a6){return{'model':db[_0x1361a6[_0x8488('0x21')]],'as':_0x1361a6['as'],'attributes':_0x1361a6['attributes'],'include':_0x1361a6['include']?_['map'](_0x1361a6['include'],function(_0x472624){return{'model':db[_0x472624['model']],'as':_0x472624['as'],'attributes':_0x472624['attributes'],'include':_0x472624[_0x8488('0x20')]?_[_0x8488('0x1f')](_0x472624[_0x8488('0x20')],function(_0x6ebee0){return{'model':db[_0x6ebee0[_0x8488('0x21')]],'as':_0x6ebee0['as'],'attributes':_0x6ebee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x38c137){logger[_0x8488('0xe')](_0x8488('0x17'),_0x60ae2f);logger[_0x8488('0x11')](_0x8488('0x17'),_0x60ae2f,JSON[_0x8488('0x12')](_0x38c137));_0x1aedb1(_0x38c137);})[_0x8488('0x22')](function(_0x368f9c){logger[_0x8488('0x13')](_0x8488('0x17'),_0x368f9c['message'],_0x60ae2f);_0x27c62a(_0x39775f['error'](0x1f4,_0x368f9c['message']));});});};exports[_0x8488('0x23')]=function(_0x408c36){var _0x19cf42=this;return new Promise(function(_0x121dcc,_0x117321){return db[_0x8488('0x18')]['find']({'raw':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['where']||null:null,'attributes':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['attributes']||null:null,'include':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x20')]?_[_0x8488('0x1f')](_0x408c36[_0x8488('0x1a')]['include'],function(_0x44c8f3){return{'model':db[_0x44c8f3[_0x8488('0x21')]],'as':_0x44c8f3['as'],'attributes':_0x44c8f3[_0x8488('0x1d')],'include':_0x44c8f3['include']?_[_0x8488('0x1f')](_0x44c8f3['include'],function(_0x205ccc){return{'model':db[_0x205ccc[_0x8488('0x21')]],'as':_0x205ccc['as'],'attributes':_0x205ccc[_0x8488('0x1d')],'include':_0x205ccc[_0x8488('0x20')]?_['map'](_0x205ccc[_0x8488('0x20')],function(_0xe71bd9){return{'model':db[_0xe71bd9[_0x8488('0x21')]],'as':_0xe71bd9['as'],'attributes':_0xe71bd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x17bfea){logger[_0x8488('0xe')](_0x8488('0x23'),_0x408c36);logger[_0x8488('0x11')](_0x8488('0x23'),_0x408c36,JSON[_0x8488('0x12')](_0x17bfea));_0x121dcc(_0x17bfea);})[_0x8488('0x22')](function(_0x1a8235){logger[_0x8488('0x13')](_0x8488('0x23'),_0x1a8235['message'],_0x408c36);_0x117321(_0x19cf42['error'](0x1f4,_0x1a8235[_0x8488('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 497d2c7..dfb3c2d 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 _0xec5d=['../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4883fe,_0x1b34c5){var _0x5e3407=function(_0x4ceb18){while(--_0x4ceb18){_0x4883fe['push'](_0x4883fe['shift']());}};_0x5e3407(++_0x1b34c5);}(_0xec5d,0x1ee));var _0xdec5=function(_0xcc05ed,_0x44eb83){_0xcc05ed=_0xcc05ed-0x0;var _0x24a2f5=_0xec5d[_0xcc05ed];return _0x24a2f5;};'use strict';var multer=require(_0xdec5('0x0'));var util=require(_0xdec5('0x1'));var path=require(_0xdec5('0x2'));var timeout=require(_0xdec5('0x3'));var express=require(_0xdec5('0x4'));var router=express[_0xdec5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdec5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdec5('0x7'));var controller=require(_0xdec5('0x8'));router[_0xdec5('0x9')]('/',auth[_0xdec5('0xa')](),controller[_0xdec5('0xb')]);router[_0xdec5('0x9')](_0xdec5('0xc'),auth[_0xdec5('0xa')](),controller[_0xdec5('0xd')]);router[_0xdec5('0x9')](_0xdec5('0xe'),auth[_0xdec5('0xa')](),controller[_0xdec5('0xf')]);router['get'](_0xdec5('0x10'),auth[_0xdec5('0xa')](),controller[_0xdec5('0x11')]);router[_0xdec5('0x9')](_0xdec5('0x12'),auth[_0xdec5('0xa')](),controller[_0xdec5('0x13')]);router[_0xdec5('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xdec5('0xa')](),controller[_0xdec5('0x15')]);router[_0xdec5('0x16')](_0xdec5('0xc'),auth[_0xdec5('0xa')](),controller[_0xdec5('0x17')]);module[_0xdec5('0x18')]=router; \ No newline at end of file +var _0x47e9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','create','put','update','destroy','exports','multer','express','Router','../../components/auth/service'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x47e9,0xec));var _0x947e=function(_0x3ca679,_0xa957c8){_0x3ca679=_0x3ca679-0x0;var _0x172843=_0x47e9[_0x3ca679];return _0x172843;};'use strict';var multer=require(_0x947e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x947e('0x1'));var router=express[_0x947e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x947e('0x3'));var interaction=require(_0x947e('0x4'));var config=require(_0x947e('0x5'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x947e('0x6')]('/',auth[_0x947e('0x7')](),controller[_0x947e('0x8')]);router[_0x947e('0x6')](_0x947e('0x9'),auth[_0x947e('0x7')](),controller[_0x947e('0xa')]);router[_0x947e('0x6')](_0x947e('0xb'),auth[_0x947e('0x7')](),controller[_0x947e('0xc')]);router[_0x947e('0x6')]('/:id/descriptions',auth[_0x947e('0x7')](),controller[_0x947e('0xd')]);router[_0x947e('0x6')](_0x947e('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x947e('0xf')]);router[_0x947e('0x10')](_0x947e('0x9'),auth[_0x947e('0x7')](),controller[_0x947e('0x11')]);router['delete'](_0x947e('0x9'),auth['isAuthenticated'](),controller[_0x947e('0x12')]);module[_0x947e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 8214256..8e4b43d 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 _0x069a=['STRING','sequelize','exports'];(function(_0x43f336,_0x2b4836){var _0x2ba81d=function(_0x83d9b4){while(--_0x83d9b4){_0x43f336['push'](_0x43f336['shift']());}};_0x2ba81d(++_0x2b4836);}(_0x069a,0x1a5));var _0xa069=function(_0x53231a,_0x20098d){_0x53231a=_0x53231a-0x0;var _0x25422d=_0x069a[_0x53231a];return _0x25422d;};'use strict';var Sequelize=require(_0xa069('0x0'));module[_0xa069('0x1')]={'name':{'type':Sequelize[_0xa069('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36db=['STRING','exports'];(function(_0x3692e3,_0x1e7229){var _0x21ea27=function(_0x515151){while(--_0x515151){_0x3692e3['push'](_0x3692e3['shift']());}};_0x21ea27(++_0x1e7229);}(_0x36db,0xdf));var _0xb36d=function(_0x149105,_0x43dded){_0x149105=_0x149105-0x0;var _0x327a27=_0x36db[_0x149105];return _0x327a27;};'use strict';var Sequelize=require('sequelize');module[_0xb36d('0x0')]={'name':{'type':Sequelize[_0xb36d('0x1')]},'description':{'type':Sequelize[_0xb36d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 015c71f..ace3aea 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 _0x090c=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FreshsalesConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','FreshsalesField','pick','getSubjects','findOne','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis'];(function(_0x184c30,_0x4d87ce){var _0x49d1ca=function(_0xf2081c){while(--_0xf2081c){_0x184c30['push'](_0x184c30['shift']());}};_0x49d1ca(++_0x4d87ce);}(_0x090c,0x132));var _0xc090=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x090c[_0x1034bb];return _0x453fdb;};'use strict';var emlformat=require(_0xc090('0x0'));var rimraf=require(_0xc090('0x1'));var zipdir=require(_0xc090('0x2'));var jsonpatch=require(_0xc090('0x3'));var rp=require(_0xc090('0x4'));var moment=require(_0xc090('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc090('0x6'));var util=require(_0xc090('0x7'));var path=require(_0xc090('0x8'));var sox=require(_0xc090('0x9'));var csv=require(_0xc090('0xa'));var ejs=require(_0xc090('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc090('0xc'));var squel=require(_0xc090('0xd'));var crypto=require(_0xc090('0xe'));var jsforce=require(_0xc090('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc090('0xa'));var querystring=require('querystring');var Papa=require(_0xc090('0x10'));var Redis=require(_0xc090('0x11'));var authService=require(_0xc090('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc090('0x13'));var hardwareService=require(_0xc090('0x14'));var logger=require('../../config/logger')(_0xc090('0x15'));var utils=require('../../config/utils');var config=require(_0xc090('0x16'));var licenseUtil=require(_0xc090('0x17'));var db=require(_0xc090('0x18'))['db'];function respondWithStatusCode(_0x3a54d9,_0x218db7){_0x218db7=_0x218db7||0xcc;return function(_0x1c8b3e){if(_0x1c8b3e){return _0x3a54d9[_0xc090('0x19')](_0x218db7);}return _0x3a54d9[_0xc090('0x1a')](_0x218db7)[_0xc090('0x1b')]();};}function respondWithResult(_0x25fc54,_0x4d1dbc){_0x4d1dbc=_0x4d1dbc||0xc8;return function(_0x53f96e){if(_0x53f96e){return _0x25fc54[_0xc090('0x1a')](_0x4d1dbc)[_0xc090('0x1c')](_0x53f96e);}};}function respondWithFilteredResult(_0x17fb5a,_0x48c64a){return function(_0x342f3c){if(_0x342f3c){var _0xe2464a=typeof _0x48c64a[_0xc090('0x1d')]===_0xc090('0x1e')&&typeof _0x48c64a[_0xc090('0x1f')]===_0xc090('0x1e');var _0x50d1f4=_0x342f3c[_0xc090('0x20')];var _0x444f9a=_0xe2464a?0x0:_0x48c64a[_0xc090('0x1d')];var _0x465a17=_0xe2464a?_0x342f3c['count']:_0x48c64a[_0xc090('0x1d')]+_0x48c64a[_0xc090('0x1f')];var _0x124b0a;if(_0x465a17>=_0x50d1f4){_0x465a17=_0x50d1f4;_0x124b0a=0xc8;}else{_0x124b0a=0xce;}_0x17fb5a[_0xc090('0x1a')](_0x124b0a);return _0x17fb5a[_0xc090('0x21')](_0xc090('0x22'),_0x444f9a+'-'+_0x465a17+'/'+_0x50d1f4)['json'](_0x342f3c);}return null;};}function patchUpdates(_0x387101){return function(_0x3605b7){try{jsonpatch[_0xc090('0x23')](_0x3605b7,_0x387101,!![]);}catch(_0x223569){return BPromise['reject'](_0x223569);}return _0x3605b7[_0xc090('0x24')]();};}function saveUpdates(_0x947088,_0x27879a){return function(_0x23e212){if(_0x23e212){return _0x23e212[_0xc090('0x25')](_0x947088)[_0xc090('0x26')](function(_0x2af40e){return _0x2af40e;});}return null;};}function removeEntity(_0x599e7a,_0x30c92e){return function(_0x11d3b1){if(_0x11d3b1){return _0x11d3b1[_0xc090('0x27')]()['then'](function(){_0x599e7a[_0xc090('0x1a')](0xcc)[_0xc090('0x1b')]();});}};}function handleEntityNotFound(_0x338d4f,_0x10cad9){return function(_0xe0fd95){if(!_0xe0fd95){_0x338d4f[_0xc090('0x19')](0x194);}return _0xe0fd95;};}function handleError(_0x3ab35c,_0x2e0c8c){_0x2e0c8c=_0x2e0c8c||0x1f4;return function(_0x5f40e6){logger[_0xc090('0x28')](_0x5f40e6[_0xc090('0x29')]);if(_0x5f40e6[_0xc090('0x2a')]){delete _0x5f40e6[_0xc090('0x2a')];}_0x3ab35c[_0xc090('0x1a')](_0x2e0c8c)[_0xc090('0x2b')](_0x5f40e6);};}exports['index']=function(_0x5d0a93,_0x23c42a){var _0x476ae8={},_0x368f2b={},_0x4682e8={'count':0x0,'rows':[]};var _0x4932f3=_[_0xc090('0x2c')](db[_0xc090('0x2d')][_0xc090('0x2e')],function(_0x359047){return{'name':_0x359047['fieldName'],'type':_0x359047[_0xc090('0x2f')]['key']};});_0x368f2b[_0xc090('0x30')]=_[_0xc090('0x2c')](_0x4932f3,_0xc090('0x2a'));_0x368f2b[_0xc090('0x31')]=_[_0xc090('0x32')](_0x5d0a93['query']);_0x368f2b[_0xc090('0x33')]=_['intersection'](_0x368f2b['model'],_0x368f2b[_0xc090('0x31')]);_0x476ae8['attributes']=_[_0xc090('0x34')](_0x368f2b[_0xc090('0x30')],qs[_0xc090('0x35')](_0x5d0a93[_0xc090('0x31')][_0xc090('0x35')]));_0x476ae8[_0xc090('0x36')]=_0x476ae8[_0xc090('0x36')][_0xc090('0x37')]?_0x476ae8[_0xc090('0x36')]:_0x368f2b[_0xc090('0x30')];if(!_0x5d0a93[_0xc090('0x31')][_0xc090('0x38')](_0xc090('0x39'))){_0x476ae8[_0xc090('0x1f')]=qs[_0xc090('0x1f')](_0x5d0a93['query'][_0xc090('0x1f')]);_0x476ae8['offset']=qs['offset'](_0x5d0a93[_0xc090('0x31')][_0xc090('0x1d')]);}_0x476ae8[_0xc090('0x3a')]=qs[_0xc090('0x3b')](_0x5d0a93['query'][_0xc090('0x3b')]);_0x476ae8[_0xc090('0x3c')]=qs['filters'](_['pick'](_0x5d0a93['query'],_0x368f2b['filters']),_0x4932f3);if(_0x5d0a93[_0xc090('0x31')][_0xc090('0x3d')]){_0x476ae8['where']=_[_0xc090('0x3e')](_0x476ae8[_0xc090('0x3c')],{'$or':_['map'](_0x4932f3,function(_0x3e9644){if(_0x3e9644[_0xc090('0x2f')]!==_0xc090('0x3f')){var _0x218ba1={};_0x218ba1[_0x3e9644['name']]={'$like':'%'+_0x5d0a93[_0xc090('0x31')]['filter']+'%'};return _0x218ba1;}})});}_0x476ae8=_['merge']({},_0x476ae8,_0x5d0a93[_0xc090('0x40')]);var _0x1befd6={'where':_0x476ae8[_0xc090('0x3c')]};return db[_0xc090('0x2d')][_0xc090('0x20')](_0x1befd6)[_0xc090('0x26')](function(_0x13243b){_0x4682e8['count']=_0x13243b;if(_0x5d0a93[_0xc090('0x31')][_0xc090('0x41')]){_0x476ae8[_0xc090('0x42')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xc090('0x43')](_0x476ae8);})[_0xc090('0x26')](function(_0x3f99f6){_0x4682e8[_0xc090('0x44')]=_0x3f99f6;return _0x4682e8;})[_0xc090('0x26')](respondWithFilteredResult(_0x23c42a,_0x476ae8))['catch'](handleError(_0x23c42a,null));};exports[_0xc090('0x45')]=function(_0x5553f9,_0x2c3343){var _0x140068={'raw':![],'where':{'id':_0x5553f9['params']['id']}},_0x193c07={};_0x193c07[_0xc090('0x30')]=_[_0xc090('0x32')](db[_0xc090('0x2d')]['rawAttributes']);_0x193c07[_0xc090('0x31')]=_[_0xc090('0x32')](_0x5553f9['query']);_0x193c07[_0xc090('0x33')]=_[_0xc090('0x34')](_0x193c07[_0xc090('0x30')],_0x193c07[_0xc090('0x31')]);_0x140068['attributes']=_['intersection'](_0x193c07[_0xc090('0x30')],qs[_0xc090('0x35')](_0x5553f9['query'][_0xc090('0x35')]));_0x140068[_0xc090('0x36')]=_0x140068[_0xc090('0x36')][_0xc090('0x37')]?_0x140068['attributes']:_0x193c07[_0xc090('0x30')];if(_0x5553f9[_0xc090('0x31')]['includeAll']){_0x140068[_0xc090('0x42')]=[{'all':!![]}];}_0x140068=_['merge']({},_0x140068,_0x5553f9['options']);return db[_0xc090('0x2d')][_0xc090('0x46')](_0x140068)[_0xc090('0x26')](handleEntityNotFound(_0x2c3343,null))[_0xc090('0x26')](respondWithResult(_0x2c3343,null))[_0xc090('0x47')](handleError(_0x2c3343,null));};exports[_0xc090('0x48')]=function(_0x50c7fc,_0xb408bd){return db[_0xc090('0x2d')][_0xc090('0x48')](_0x50c7fc[_0xc090('0x49')],{})[_0xc090('0x26')](respondWithResult(_0xb408bd,0xc9))[_0xc090('0x47')](handleError(_0xb408bd,null));};exports[_0xc090('0x25')]=function(_0x558894,_0x599cc6){if(_0x558894[_0xc090('0x49')]['id']){delete _0x558894[_0xc090('0x49')]['id'];}return db[_0xc090('0x2d')][_0xc090('0x46')]({'where':{'id':_0x558894[_0xc090('0x4a')]['id']}})[_0xc090('0x26')](handleEntityNotFound(_0x599cc6,null))[_0xc090('0x26')](saveUpdates(_0x558894[_0xc090('0x49')],null))[_0xc090('0x26')](respondWithResult(_0x599cc6,null))['catch'](handleError(_0x599cc6,null));};exports[_0xc090('0x27')]=function(_0x68b83f,_0x163755){return db[_0xc090('0x2d')][_0xc090('0x46')]({'where':{'id':_0x68b83f[_0xc090('0x4a')]['id']}})[_0xc090('0x26')](handleEntityNotFound(_0x163755,null))[_0xc090('0x26')](removeEntity(_0x163755,null))['catch'](handleError(_0x163755,null));};exports['getSubjects']=function(_0x390e8e,_0x538990,_0x507756){var _0x1718ae={};var _0x3b84b6={};var _0x4d4bd8;var _0x28402f;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x390e8e[_0xc090('0x4a')]['id']}})[_0xc090('0x26')](handleEntityNotFound(_0x538990,null))[_0xc090('0x26')](function(_0x417e93){if(_0x417e93){_0x4d4bd8=_0x417e93;_0x3b84b6[_0xc090('0x30')]=_['keys'](db[_0xc090('0x4b')][_0xc090('0x2e')]);_0x3b84b6[_0xc090('0x31')]=_[_0xc090('0x32')](_0x390e8e['query']);_0x3b84b6[_0xc090('0x33')]=_[_0xc090('0x34')](_0x3b84b6[_0xc090('0x30')],_0x3b84b6['query']);_0x1718ae[_0xc090('0x36')]=_[_0xc090('0x34')](_0x3b84b6[_0xc090('0x30')],qs[_0xc090('0x35')](_0x390e8e['query'][_0xc090('0x35')]));_0x1718ae['attributes']=_0x1718ae[_0xc090('0x36')][_0xc090('0x37')]?_0x1718ae[_0xc090('0x36')]:_0x3b84b6[_0xc090('0x30')];_0x1718ae[_0xc090('0x3a')]=qs[_0xc090('0x3b')](_0x390e8e[_0xc090('0x31')][_0xc090('0x3b')]);_0x1718ae[_0xc090('0x3c')]=qs['filters'](_[_0xc090('0x4c')](_0x390e8e[_0xc090('0x31')],_0x3b84b6[_0xc090('0x33')]));if(_0x390e8e[_0xc090('0x31')][_0xc090('0x3d')]){_0x1718ae[_0xc090('0x3c')]=_['merge'](_0x1718ae[_0xc090('0x3c')],{'$or':_[_0xc090('0x2c')](_0x1718ae[_0xc090('0x36')],function(_0x2fa064){var _0x313d5f={};_0x313d5f[_0x2fa064]={'$like':'%'+_0x390e8e[_0xc090('0x31')][_0xc090('0x3d')]+'%'};return _0x313d5f;})});}_0x1718ae=_[_0xc090('0x3e')]({},_0x1718ae,_0x390e8e[_0xc090('0x40')]);return _0x4d4bd8[_0xc090('0x4d')](_0x1718ae);}})[_0xc090('0x26')](function(_0x493680){if(_0x493680){_0x28402f=_0x493680[_0xc090('0x37')];if(!_0x390e8e[_0xc090('0x31')][_0xc090('0x38')](_0xc090('0x39'))){_0x1718ae[_0xc090('0x1f')]=qs[_0xc090('0x1f')](_0x390e8e['query']['limit']);_0x1718ae[_0xc090('0x1d')]=qs[_0xc090('0x1d')](_0x390e8e[_0xc090('0x31')]['offset']);}return _0x4d4bd8[_0xc090('0x4d')](_0x1718ae);}})[_0xc090('0x26')](function(_0x23180e){if(_0x23180e){return _0x23180e?{'count':_0x28402f,'rows':_0x23180e}:null;}})[_0xc090('0x26')](respondWithResult(_0x538990,null))['catch'](handleError(_0x538990,null));};exports['getDescriptions']=function(_0x82398c,_0x349669,_0x80c80e){var _0xa9917b={};var _0x1af53e={};var _0x32fc0b;var _0x1d998b;return db[_0xc090('0x2d')][_0xc090('0x4e')]({'where':{'id':_0x82398c['params']['id']}})[_0xc090('0x26')](handleEntityNotFound(_0x349669,null))[_0xc090('0x26')](function(_0xffc35c){if(_0xffc35c){_0x32fc0b=_0xffc35c;_0x1af53e[_0xc090('0x30')]=_[_0xc090('0x32')](db[_0xc090('0x4b')]['rawAttributes']);_0x1af53e[_0xc090('0x31')]=_['keys'](_0x82398c[_0xc090('0x31')]);_0x1af53e[_0xc090('0x33')]=_['intersection'](_0x1af53e[_0xc090('0x30')],_0x1af53e[_0xc090('0x31')]);_0xa9917b['attributes']=_['intersection'](_0x1af53e[_0xc090('0x30')],qs[_0xc090('0x35')](_0x82398c[_0xc090('0x31')][_0xc090('0x35')]));_0xa9917b[_0xc090('0x36')]=_0xa9917b['attributes']['length']?_0xa9917b[_0xc090('0x36')]:_0x1af53e['model'];_0xa9917b[_0xc090('0x3a')]=qs[_0xc090('0x3b')](_0x82398c[_0xc090('0x31')][_0xc090('0x3b')]);_0xa9917b[_0xc090('0x3c')]=qs[_0xc090('0x33')](_[_0xc090('0x4c')](_0x82398c[_0xc090('0x31')],_0x1af53e['filters']));if(_0x82398c[_0xc090('0x31')][_0xc090('0x3d')]){_0xa9917b[_0xc090('0x3c')]=_[_0xc090('0x3e')](_0xa9917b['where'],{'$or':_[_0xc090('0x2c')](_0xa9917b[_0xc090('0x36')],function(_0x575441){var _0x43132b={};_0x43132b[_0x575441]={'$like':'%'+_0x82398c['query']['filter']+'%'};return _0x43132b;})});}_0xa9917b=_[_0xc090('0x3e')]({},_0xa9917b,_0x82398c[_0xc090('0x40')]);return _0x32fc0b['getDescriptions'](_0xa9917b);}})[_0xc090('0x26')](function(_0x1c121d){if(_0x1c121d){_0x1d998b=_0x1c121d[_0xc090('0x37')];if(!_0x82398c['query']['hasOwnProperty'](_0xc090('0x39'))){_0xa9917b[_0xc090('0x1f')]=qs[_0xc090('0x1f')](_0x82398c[_0xc090('0x31')][_0xc090('0x1f')]);_0xa9917b[_0xc090('0x1d')]=qs[_0xc090('0x1d')](_0x82398c['query']['offset']);}return _0x32fc0b[_0xc090('0x4f')](_0xa9917b);}})[_0xc090('0x26')](function(_0x5dd953){if(_0x5dd953){return _0x5dd953?{'count':_0x1d998b,'rows':_0x5dd953}:null;}})['then'](respondWithResult(_0x349669,null))['catch'](handleError(_0x349669,null));};exports[_0xc090('0x50')]=function(_0x3e62c8,_0x50e953,_0x602369){var _0x211b78={};var _0x561de1={};var _0x4cd1bc;var _0x4f73f3;return db['FreshsalesConfiguration'][_0xc090('0x4e')]({'where':{'id':_0x3e62c8['params']['id']}})[_0xc090('0x26')](handleEntityNotFound(_0x50e953,null))[_0xc090('0x26')](function(_0x2ddefb){if(_0x2ddefb){_0x4cd1bc=_0x2ddefb;_0x561de1[_0xc090('0x30')]=_[_0xc090('0x32')](db[_0xc090('0x4b')][_0xc090('0x2e')]);_0x561de1[_0xc090('0x31')]=_[_0xc090('0x32')](_0x3e62c8['query']);_0x561de1['filters']=_[_0xc090('0x34')](_0x561de1['model'],_0x561de1[_0xc090('0x31')]);_0x211b78[_0xc090('0x36')]=_[_0xc090('0x34')](_0x561de1[_0xc090('0x30')],qs['fields'](_0x3e62c8[_0xc090('0x31')][_0xc090('0x35')]));_0x211b78[_0xc090('0x36')]=_0x211b78[_0xc090('0x36')][_0xc090('0x37')]?_0x211b78[_0xc090('0x36')]:_0x561de1[_0xc090('0x30')];_0x211b78['order']=qs[_0xc090('0x3b')](_0x3e62c8[_0xc090('0x31')][_0xc090('0x3b')]);_0x211b78[_0xc090('0x3c')]=qs[_0xc090('0x33')](_[_0xc090('0x4c')](_0x3e62c8[_0xc090('0x31')],_0x561de1['filters']));if(_0x3e62c8['query'][_0xc090('0x3d')]){_0x211b78['where']=_[_0xc090('0x3e')](_0x211b78[_0xc090('0x3c')],{'$or':_[_0xc090('0x2c')](_0x211b78[_0xc090('0x36')],function(_0x14bc83){var _0xcdb893={};_0xcdb893[_0x14bc83]={'$like':'%'+_0x3e62c8[_0xc090('0x31')][_0xc090('0x3d')]+'%'};return _0xcdb893;})});}_0x211b78=_['merge']({},_0x211b78,_0x3e62c8[_0xc090('0x40')]);return _0x4cd1bc[_0xc090('0x50')](_0x211b78);}})[_0xc090('0x26')](function(_0x4d2138){if(_0x4d2138){_0x4f73f3=_0x4d2138['length'];if(!_0x3e62c8[_0xc090('0x31')]['hasOwnProperty']('nolimit')){_0x211b78[_0xc090('0x1f')]=qs[_0xc090('0x1f')](_0x3e62c8[_0xc090('0x31')][_0xc090('0x1f')]);_0x211b78[_0xc090('0x1d')]=qs[_0xc090('0x1d')](_0x3e62c8[_0xc090('0x31')]['offset']);}return _0x4cd1bc[_0xc090('0x50')](_0x211b78);}})['then'](function(_0x19f324){if(_0x19f324){return _0x19f324?{'count':_0x4f73f3,'rows':_0x19f324}:null;}})['then'](respondWithResult(_0x50e953,null))[_0xc090('0x47')](handleError(_0x50e953,null));}; \ No newline at end of file +var _0x5b2d=['getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','update','findOne','FreshsalesField','sort','pick'];(function(_0x2bd4e0,_0x42387e){var _0x2d236d=function(_0x369eb1){while(--_0x369eb1){_0x2bd4e0['push'](_0x2bd4e0['shift']());}};_0x2d236d(++_0x42387e);}(_0x5b2d,0x133));var _0xd5b2=function(_0x275de9,_0x97a8dd){_0x275de9=_0x275de9-0x0;var _0x4d9acd=_0x5b2d[_0x275de9];return _0x4d9acd;};'use strict';var emlformat=require(_0xd5b2('0x0'));var rimraf=require(_0xd5b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd5b2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd5b2('0x4'));var sox=require(_0xd5b2('0x5'));var csv=require(_0xd5b2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5b2('0x7'));var _=require(_0xd5b2('0x8'));var squel=require(_0xd5b2('0x9'));var crypto=require(_0xd5b2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd5b2('0xb'));var toCsv=require(_0xd5b2('0x6'));var querystring=require(_0xd5b2('0xc'));var Papa=require(_0xd5b2('0xd'));var Redis=require(_0xd5b2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd5b2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5b2('0x10'))(_0xd5b2('0x11'));var utils=require(_0xd5b2('0x12'));var config=require(_0xd5b2('0x13'));var licenseUtil=require(_0xd5b2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19db66,_0x469420){_0x469420=_0x469420||0xcc;return function(_0x25999c){if(_0x25999c){return _0x19db66[_0xd5b2('0x15')](_0x469420);}return _0x19db66['status'](_0x469420)[_0xd5b2('0x16')]();};}function respondWithResult(_0x45f675,_0x49f494){_0x49f494=_0x49f494||0xc8;return function(_0x53ca28){if(_0x53ca28){return _0x45f675[_0xd5b2('0x17')](_0x49f494)[_0xd5b2('0x18')](_0x53ca28);}};}function respondWithFilteredResult(_0x383ea1,_0x482987){return function(_0x4995ff){if(_0x4995ff){var _0x12fd79=typeof _0x482987[_0xd5b2('0x19')]==='undefined'&&typeof _0x482987[_0xd5b2('0x1a')]===_0xd5b2('0x1b');var _0x4e848d=_0x4995ff['count'];var _0x248266=_0x12fd79?0x0:_0x482987[_0xd5b2('0x19')];var _0x2f16a2=_0x12fd79?_0x4995ff[_0xd5b2('0x1c')]:_0x482987['offset']+_0x482987['limit'];var _0xbf941;if(_0x2f16a2>=_0x4e848d){_0x2f16a2=_0x4e848d;_0xbf941=0xc8;}else{_0xbf941=0xce;}_0x383ea1['status'](_0xbf941);return _0x383ea1[_0xd5b2('0x1d')](_0xd5b2('0x1e'),_0x248266+'-'+_0x2f16a2+'/'+_0x4e848d)[_0xd5b2('0x18')](_0x4995ff);}return null;};}function patchUpdates(_0x37c164){return function(_0x1a35fb){try{jsonpatch[_0xd5b2('0x1f')](_0x1a35fb,_0x37c164,!![]);}catch(_0x75c89){return BPromise[_0xd5b2('0x20')](_0x75c89);}return _0x1a35fb[_0xd5b2('0x21')]();};}function saveUpdates(_0x12617f,_0x3d03d4){return function(_0x4cc5c9){if(_0x4cc5c9){return _0x4cc5c9['update'](_0x12617f)['then'](function(_0x29609a){return _0x29609a;});}return null;};}function removeEntity(_0x50ce31,_0x305d6b){return function(_0x221249){if(_0x221249){return _0x221249[_0xd5b2('0x22')]()[_0xd5b2('0x23')](function(){_0x50ce31[_0xd5b2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xddbb36,_0x38d134){return function(_0x30d264){if(!_0x30d264){_0xddbb36['sendStatus'](0x194);}return _0x30d264;};}function handleError(_0x420b62,_0x22dc8d){_0x22dc8d=_0x22dc8d||0x1f4;return function(_0x2bb7e2){logger[_0xd5b2('0x24')](_0x2bb7e2['stack']);if(_0x2bb7e2[_0xd5b2('0x25')]){delete _0x2bb7e2[_0xd5b2('0x25')];}_0x420b62['status'](_0x22dc8d)[_0xd5b2('0x26')](_0x2bb7e2);};}exports[_0xd5b2('0x27')]=function(_0x115737,_0x1a8a6d){var _0x3f34b2={},_0x4e250c={},_0x894a15={'count':0x0,'rows':[]};var _0x139bb5=_[_0xd5b2('0x28')](db[_0xd5b2('0x29')][_0xd5b2('0x2a')],function(_0x302113){return{'name':_0x302113[_0xd5b2('0x2b')],'type':_0x302113['type'][_0xd5b2('0x2c')]};});_0x4e250c['model']=_[_0xd5b2('0x28')](_0x139bb5,'name');_0x4e250c[_0xd5b2('0x2d')]=_['keys'](_0x115737[_0xd5b2('0x2d')]);_0x4e250c[_0xd5b2('0x2e')]=_[_0xd5b2('0x2f')](_0x4e250c[_0xd5b2('0x30')],_0x4e250c['query']);_0x3f34b2[_0xd5b2('0x31')]=_['intersection'](_0x4e250c[_0xd5b2('0x30')],qs[_0xd5b2('0x32')](_0x115737['query']['fields']));_0x3f34b2[_0xd5b2('0x31')]=_0x3f34b2[_0xd5b2('0x31')][_0xd5b2('0x33')]?_0x3f34b2[_0xd5b2('0x31')]:_0x4e250c['model'];if(!_0x115737[_0xd5b2('0x2d')]['hasOwnProperty'](_0xd5b2('0x34'))){_0x3f34b2[_0xd5b2('0x1a')]=qs[_0xd5b2('0x1a')](_0x115737[_0xd5b2('0x2d')]['limit']);_0x3f34b2[_0xd5b2('0x19')]=qs['offset'](_0x115737[_0xd5b2('0x2d')]['offset']);}_0x3f34b2[_0xd5b2('0x35')]=qs['sort'](_0x115737[_0xd5b2('0x2d')]['sort']);_0x3f34b2['where']=qs[_0xd5b2('0x2e')](_['pick'](_0x115737[_0xd5b2('0x2d')],_0x4e250c[_0xd5b2('0x2e')]),_0x139bb5);if(_0x115737[_0xd5b2('0x2d')][_0xd5b2('0x36')]){_0x3f34b2[_0xd5b2('0x37')]=_[_0xd5b2('0x38')](_0x3f34b2[_0xd5b2('0x37')],{'$or':_['map'](_0x139bb5,function(_0x16820b){if(_0x16820b[_0xd5b2('0x39')]!==_0xd5b2('0x3a')){var _0x4eda62={};_0x4eda62[_0x16820b['name']]={'$like':'%'+_0x115737[_0xd5b2('0x2d')][_0xd5b2('0x36')]+'%'};return _0x4eda62;}})});}_0x3f34b2=_[_0xd5b2('0x38')]({},_0x3f34b2,_0x115737[_0xd5b2('0x3b')]);var _0x1fd88d={'where':_0x3f34b2[_0xd5b2('0x37')]};return db['FreshsalesConfiguration'][_0xd5b2('0x1c')](_0x1fd88d)[_0xd5b2('0x23')](function(_0x9dba0){_0x894a15[_0xd5b2('0x1c')]=_0x9dba0;if(_0x115737[_0xd5b2('0x2d')][_0xd5b2('0x3c')]){_0x3f34b2[_0xd5b2('0x3d')]=[{'all':!![]}];}return db[_0xd5b2('0x29')]['findAll'](_0x3f34b2);})[_0xd5b2('0x23')](function(_0x420a6f){_0x894a15[_0xd5b2('0x3e')]=_0x420a6f;return _0x894a15;})[_0xd5b2('0x23')](respondWithFilteredResult(_0x1a8a6d,_0x3f34b2))[_0xd5b2('0x3f')](handleError(_0x1a8a6d,null));};exports['show']=function(_0x30a7a8,_0x3e3e13){var _0x34064e={'raw':![],'where':{'id':_0x30a7a8[_0xd5b2('0x40')]['id']}},_0x567297={};_0x567297[_0xd5b2('0x30')]=_[_0xd5b2('0x41')](db[_0xd5b2('0x29')][_0xd5b2('0x2a')]);_0x567297[_0xd5b2('0x2d')]=_[_0xd5b2('0x41')](_0x30a7a8[_0xd5b2('0x2d')]);_0x567297[_0xd5b2('0x2e')]=_[_0xd5b2('0x2f')](_0x567297[_0xd5b2('0x30')],_0x567297[_0xd5b2('0x2d')]);_0x34064e['attributes']=_['intersection'](_0x567297['model'],qs[_0xd5b2('0x32')](_0x30a7a8['query'][_0xd5b2('0x32')]));_0x34064e['attributes']=_0x34064e[_0xd5b2('0x31')][_0xd5b2('0x33')]?_0x34064e[_0xd5b2('0x31')]:_0x567297[_0xd5b2('0x30')];if(_0x30a7a8[_0xd5b2('0x2d')][_0xd5b2('0x3c')]){_0x34064e[_0xd5b2('0x3d')]=[{'all':!![]}];}_0x34064e=_[_0xd5b2('0x38')]({},_0x34064e,_0x30a7a8[_0xd5b2('0x3b')]);return db[_0xd5b2('0x29')][_0xd5b2('0x42')](_0x34064e)[_0xd5b2('0x23')](handleEntityNotFound(_0x3e3e13,null))[_0xd5b2('0x23')](respondWithResult(_0x3e3e13,null))[_0xd5b2('0x3f')](handleError(_0x3e3e13,null));};exports[_0xd5b2('0x43')]=function(_0x4ae10b,_0x438fca){return db[_0xd5b2('0x29')][_0xd5b2('0x43')](_0x4ae10b['body'],{})[_0xd5b2('0x23')](respondWithResult(_0x438fca,0xc9))['catch'](handleError(_0x438fca,null));};exports[_0xd5b2('0x44')]=function(_0x4630bf,_0x4498a0){if(_0x4630bf['body']['id']){delete _0x4630bf['body']['id'];}return db[_0xd5b2('0x29')]['find']({'where':{'id':_0x4630bf[_0xd5b2('0x40')]['id']}})[_0xd5b2('0x23')](handleEntityNotFound(_0x4498a0,null))[_0xd5b2('0x23')](saveUpdates(_0x4630bf['body'],null))[_0xd5b2('0x23')](respondWithResult(_0x4498a0,null))[_0xd5b2('0x3f')](handleError(_0x4498a0,null));};exports['destroy']=function(_0x2dcb7f,_0x25e904){return db[_0xd5b2('0x29')][_0xd5b2('0x42')]({'where':{'id':_0x2dcb7f[_0xd5b2('0x40')]['id']}})[_0xd5b2('0x23')](handleEntityNotFound(_0x25e904,null))[_0xd5b2('0x23')](removeEntity(_0x25e904,null))[_0xd5b2('0x3f')](handleError(_0x25e904,null));};exports['getSubjects']=function(_0x2dec33,_0x5ecc0d,_0x244233){var _0x2fa256={};var _0x26c2e6={};var _0x202799;var _0x393882;return db[_0xd5b2('0x29')][_0xd5b2('0x45')]({'where':{'id':_0x2dec33[_0xd5b2('0x40')]['id']}})[_0xd5b2('0x23')](handleEntityNotFound(_0x5ecc0d,null))[_0xd5b2('0x23')](function(_0x16fe34){if(_0x16fe34){_0x202799=_0x16fe34;_0x26c2e6[_0xd5b2('0x30')]=_[_0xd5b2('0x41')](db[_0xd5b2('0x46')]['rawAttributes']);_0x26c2e6[_0xd5b2('0x2d')]=_[_0xd5b2('0x41')](_0x2dec33[_0xd5b2('0x2d')]);_0x26c2e6[_0xd5b2('0x2e')]=_[_0xd5b2('0x2f')](_0x26c2e6[_0xd5b2('0x30')],_0x26c2e6[_0xd5b2('0x2d')]);_0x2fa256[_0xd5b2('0x31')]=_['intersection'](_0x26c2e6['model'],qs['fields'](_0x2dec33[_0xd5b2('0x2d')][_0xd5b2('0x32')]));_0x2fa256['attributes']=_0x2fa256['attributes'][_0xd5b2('0x33')]?_0x2fa256[_0xd5b2('0x31')]:_0x26c2e6['model'];_0x2fa256[_0xd5b2('0x35')]=qs['sort'](_0x2dec33[_0xd5b2('0x2d')][_0xd5b2('0x47')]);_0x2fa256[_0xd5b2('0x37')]=qs['filters'](_[_0xd5b2('0x48')](_0x2dec33[_0xd5b2('0x2d')],_0x26c2e6['filters']));if(_0x2dec33['query'][_0xd5b2('0x36')]){_0x2fa256[_0xd5b2('0x37')]=_[_0xd5b2('0x38')](_0x2fa256[_0xd5b2('0x37')],{'$or':_[_0xd5b2('0x28')](_0x2fa256[_0xd5b2('0x31')],function(_0x7682a8){var _0x45b60a={};_0x45b60a[_0x7682a8]={'$like':'%'+_0x2dec33['query'][_0xd5b2('0x36')]+'%'};return _0x45b60a;})});}_0x2fa256=_[_0xd5b2('0x38')]({},_0x2fa256,_0x2dec33['options']);return _0x202799[_0xd5b2('0x49')](_0x2fa256);}})[_0xd5b2('0x23')](function(_0x2a44a9){if(_0x2a44a9){_0x393882=_0x2a44a9[_0xd5b2('0x33')];if(!_0x2dec33[_0xd5b2('0x2d')][_0xd5b2('0x4a')](_0xd5b2('0x34'))){_0x2fa256[_0xd5b2('0x1a')]=qs[_0xd5b2('0x1a')](_0x2dec33[_0xd5b2('0x2d')][_0xd5b2('0x1a')]);_0x2fa256[_0xd5b2('0x19')]=qs[_0xd5b2('0x19')](_0x2dec33[_0xd5b2('0x2d')][_0xd5b2('0x19')]);}return _0x202799['getSubjects'](_0x2fa256);}})['then'](function(_0x5024f3){if(_0x5024f3){return _0x5024f3?{'count':_0x393882,'rows':_0x5024f3}:null;}})[_0xd5b2('0x23')](respondWithResult(_0x5ecc0d,null))['catch'](handleError(_0x5ecc0d,null));};exports[_0xd5b2('0x4b')]=function(_0x5df9d8,_0x2ba6c0,_0x152307){var _0x3f6980={};var _0x58d142={};var _0xfa09ff;var _0x75e073;return db[_0xd5b2('0x29')]['findOne']({'where':{'id':_0x5df9d8['params']['id']}})[_0xd5b2('0x23')](handleEntityNotFound(_0x2ba6c0,null))['then'](function(_0x4e3f59){if(_0x4e3f59){_0xfa09ff=_0x4e3f59;_0x58d142[_0xd5b2('0x30')]=_[_0xd5b2('0x41')](db[_0xd5b2('0x46')][_0xd5b2('0x2a')]);_0x58d142[_0xd5b2('0x2d')]=_[_0xd5b2('0x41')](_0x5df9d8[_0xd5b2('0x2d')]);_0x58d142[_0xd5b2('0x2e')]=_[_0xd5b2('0x2f')](_0x58d142['model'],_0x58d142[_0xd5b2('0x2d')]);_0x3f6980[_0xd5b2('0x31')]=_[_0xd5b2('0x2f')](_0x58d142['model'],qs[_0xd5b2('0x32')](_0x5df9d8[_0xd5b2('0x2d')][_0xd5b2('0x32')]));_0x3f6980[_0xd5b2('0x31')]=_0x3f6980['attributes'][_0xd5b2('0x33')]?_0x3f6980[_0xd5b2('0x31')]:_0x58d142['model'];_0x3f6980[_0xd5b2('0x35')]=qs['sort'](_0x5df9d8['query'][_0xd5b2('0x47')]);_0x3f6980[_0xd5b2('0x37')]=qs[_0xd5b2('0x2e')](_['pick'](_0x5df9d8[_0xd5b2('0x2d')],_0x58d142[_0xd5b2('0x2e')]));if(_0x5df9d8[_0xd5b2('0x2d')][_0xd5b2('0x36')]){_0x3f6980[_0xd5b2('0x37')]=_[_0xd5b2('0x38')](_0x3f6980[_0xd5b2('0x37')],{'$or':_['map'](_0x3f6980[_0xd5b2('0x31')],function(_0x14e404){var _0x1cc967={};_0x1cc967[_0x14e404]={'$like':'%'+_0x5df9d8['query']['filter']+'%'};return _0x1cc967;})});}_0x3f6980=_['merge']({},_0x3f6980,_0x5df9d8[_0xd5b2('0x3b')]);return _0xfa09ff[_0xd5b2('0x4b')](_0x3f6980);}})[_0xd5b2('0x23')](function(_0x22f9ed){if(_0x22f9ed){_0x75e073=_0x22f9ed[_0xd5b2('0x33')];if(!_0x5df9d8[_0xd5b2('0x2d')][_0xd5b2('0x4a')]('nolimit')){_0x3f6980[_0xd5b2('0x1a')]=qs[_0xd5b2('0x1a')](_0x5df9d8['query']['limit']);_0x3f6980[_0xd5b2('0x19')]=qs[_0xd5b2('0x19')](_0x5df9d8[_0xd5b2('0x2d')][_0xd5b2('0x19')]);}return _0xfa09ff['getDescriptions'](_0x3f6980);}})[_0xd5b2('0x23')](function(_0x11a3e9){if(_0x11a3e9){return _0x11a3e9?{'count':_0x75e073,'rows':_0x11a3e9}:null;}})['then'](respondWithResult(_0x2ba6c0,null))['catch'](handleError(_0x2ba6c0,null));};exports['getFields']=function(_0x3da298,_0x11502d,_0x2b0708){var _0x2235dc={};var _0x4e5785={};var _0x5bbb93;var _0x520e7f;return db['FreshsalesConfiguration'][_0xd5b2('0x45')]({'where':{'id':_0x3da298['params']['id']}})[_0xd5b2('0x23')](handleEntityNotFound(_0x11502d,null))[_0xd5b2('0x23')](function(_0x3f1e67){if(_0x3f1e67){_0x5bbb93=_0x3f1e67;_0x4e5785[_0xd5b2('0x30')]=_['keys'](db[_0xd5b2('0x46')]['rawAttributes']);_0x4e5785['query']=_[_0xd5b2('0x41')](_0x3da298[_0xd5b2('0x2d')]);_0x4e5785[_0xd5b2('0x2e')]=_[_0xd5b2('0x2f')](_0x4e5785[_0xd5b2('0x30')],_0x4e5785[_0xd5b2('0x2d')]);_0x2235dc[_0xd5b2('0x31')]=_[_0xd5b2('0x2f')](_0x4e5785[_0xd5b2('0x30')],qs[_0xd5b2('0x32')](_0x3da298[_0xd5b2('0x2d')][_0xd5b2('0x32')]));_0x2235dc[_0xd5b2('0x31')]=_0x2235dc[_0xd5b2('0x31')]['length']?_0x2235dc['attributes']:_0x4e5785[_0xd5b2('0x30')];_0x2235dc['order']=qs[_0xd5b2('0x47')](_0x3da298[_0xd5b2('0x2d')][_0xd5b2('0x47')]);_0x2235dc[_0xd5b2('0x37')]=qs[_0xd5b2('0x2e')](_[_0xd5b2('0x48')](_0x3da298[_0xd5b2('0x2d')],_0x4e5785[_0xd5b2('0x2e')]));if(_0x3da298[_0xd5b2('0x2d')][_0xd5b2('0x36')]){_0x2235dc[_0xd5b2('0x37')]=_[_0xd5b2('0x38')](_0x2235dc['where'],{'$or':_[_0xd5b2('0x28')](_0x2235dc[_0xd5b2('0x31')],function(_0x3c731c){var _0x6a11ef={};_0x6a11ef[_0x3c731c]={'$like':'%'+_0x3da298[_0xd5b2('0x2d')][_0xd5b2('0x36')]+'%'};return _0x6a11ef;})});}_0x2235dc=_['merge']({},_0x2235dc,_0x3da298[_0xd5b2('0x3b')]);return _0x5bbb93['getFields'](_0x2235dc);}})[_0xd5b2('0x23')](function(_0x1c22d2){if(_0x1c22d2){_0x520e7f=_0x1c22d2[_0xd5b2('0x33')];if(!_0x3da298[_0xd5b2('0x2d')]['hasOwnProperty']('nolimit')){_0x2235dc[_0xd5b2('0x1a')]=qs[_0xd5b2('0x1a')](_0x3da298[_0xd5b2('0x2d')]['limit']);_0x2235dc[_0xd5b2('0x19')]=qs[_0xd5b2('0x19')](_0x3da298['query']['offset']);}return _0x5bbb93['getFields'](_0x2235dc);}})[_0xd5b2('0x23')](function(_0x2627e7){if(_0x2627e7){return _0x2627e7?{'count':_0x520e7f,'rows':_0x2627e7}:null;}})['then'](respondWithResult(_0x11502d,null))['catch'](handleError(_0x11502d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 5901e7e..a109709 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 _0xacf8=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','../../config/logger','api','moment','request-promise'];(function(_0x2f06fb,_0x5813eb){var _0x2ab977=function(_0x865504){while(--_0x865504){_0x2f06fb['push'](_0x2f06fb['shift']());}};_0x2ab977(++_0x5813eb);}(_0xacf8,0x1a0));var _0x8acf=function(_0x5eab9b,_0x113241){_0x5eab9b=_0x5eab9b-0x0;var _0x16bbc5=_0xacf8[_0x5eab9b];return _0x16bbc5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8acf('0x0'))(_0x8acf('0x1'));var moment=require(_0x8acf('0x2'));var BPromise=require('bluebird');var rp=require(_0x8acf('0x3'));var fs=require('fs');var path=require(_0x8acf('0x4'));var rimraf=require(_0x8acf('0x5'));var config=require(_0x8acf('0x6'));var attributes=require(_0x8acf('0x7'));module[_0x8acf('0x8')]=function(_0xd2fc46,_0x125b8b){return _0xd2fc46[_0x8acf('0x9')](_0x8acf('0xa'),attributes,{'tableName':_0x8acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x927f=['request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','../../config/logger','api','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x927f,0xc4));var _0xf927=function(_0x1beea3,_0x32c9a9){_0x1beea3=_0x1beea3-0x0;var _0x4c9581=_0x927f[_0x1beea3];return _0x4c9581;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf927('0x0'))(_0xf927('0x1'));var moment=require(_0xf927('0x2'));var BPromise=require(_0xf927('0x3'));var rp=require(_0xf927('0x4'));var fs=require('fs');var path=require(_0xf927('0x5'));var rimraf=require('rimraf');var config=require(_0xf927('0x6'));var attributes=require(_0xf927('0x7'));module['exports']=function(_0x3c4fe5,_0x2c20f5){return _0x3c4fe5[_0xf927('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0xf927('0x9'),'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 5cf7a1a..98b5b34 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 _0xf044=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x234341,_0x1f0568){var _0x2fd6e9=function(_0x1fd8dd){while(--_0x1fd8dd){_0x234341['push'](_0x234341['shift']());}};_0x2fd6e9(++_0x1f0568);}(_0xf044,0x11b));var _0x4f04=function(_0x14f16c,_0x3280c0){_0x14f16c=_0x14f16c-0x0;var _0x35dc76=_0xf044[_0x14f16c];return _0x35dc76;};'use strict';var _=require(_0x4f04('0x0'));var util=require(_0x4f04('0x1'));var moment=require(_0x4f04('0x2'));var BPromise=require(_0x4f04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f04('0x4'));var db=require(_0x4f04('0x5'))['db'];var utils=require(_0x4f04('0x6'));var logger=require('../../config/logger')(_0x4f04('0x7'));var config=require(_0x4f04('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4f04('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c58ed,_0x11972f,_0x4c9ae3){return new BPromise(function(_0x467f12,_0x4a2485){return client[_0x4f04('0xa')](_0x2c58ed,_0x4c9ae3)[_0x4f04('0xb')](function(_0x124b74){logger['info'](_0x4f04('0xc'),_0x11972f,'request\x20sent');logger[_0x4f04('0xd')](_0x4f04('0xe'),_0x11972f,_0x4f04('0xf'),JSON['stringify'](_0x124b74));if(_0x124b74[_0x4f04('0x10')]){if(_0x124b74[_0x4f04('0x10')][_0x4f04('0x11')]===0x1f4){logger[_0x4f04('0x10')](_0x4f04('0xc'),_0x11972f,_0x124b74['error'][_0x4f04('0x12')]);return _0x4a2485(_0x124b74[_0x4f04('0x10')][_0x4f04('0x12')]);}logger['error'](_0x4f04('0xc'),_0x11972f,_0x124b74[_0x4f04('0x10')][_0x4f04('0x12')]);return _0x467f12(_0x124b74[_0x4f04('0x10')][_0x4f04('0x12')]);}else{logger[_0x4f04('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x11972f,_0x4f04('0xf'));_0x467f12(_0x124b74[_0x4f04('0x14')][_0x4f04('0x12')]);}})[_0x4f04('0x15')](function(_0xc273ad){logger[_0x4f04('0x10')](_0x4f04('0xc'),_0x11972f,_0xc273ad);_0x4a2485(_0xc273ad);});});} \ No newline at end of file +var _0x3e51=['../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1e99f4,_0x223262){var _0x2b52f4=function(_0x1226fa){while(--_0x1226fa){_0x1e99f4['push'](_0x1e99f4['shift']());}};_0x2b52f4(++_0x223262);}(_0x3e51,0xec));var _0x13e5=function(_0xcf8ce9,_0x29989f){_0xcf8ce9=_0xcf8ce9-0x0;var _0xa200bd=_0x3e51[_0xcf8ce9];return _0xa200bd;};'use strict';var _=require(_0x13e5('0x0'));var util=require(_0x13e5('0x1'));var moment=require('moment');var BPromise=require(_0x13e5('0x2'));var rs=require(_0x13e5('0x3'));var fs=require('fs');var Redis=require(_0x13e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13e5('0x5'));var logger=require(_0x13e5('0x6'))(_0x13e5('0x7'));var config=require(_0x13e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x13e5('0x9')][_0x13e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c9b1b,_0x13f373,_0xb12c3d){return new BPromise(function(_0x51d284,_0x1d921c){return client[_0x13e5('0xb')](_0x3c9b1b,_0xb12c3d)[_0x13e5('0xc')](function(_0x2d4cd7){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x13f373,_0x13e5('0xd'));logger['debug'](_0x13e5('0xe'),_0x13f373,_0x13e5('0xd'),JSON[_0x13e5('0xf')](_0x2d4cd7));if(_0x2d4cd7['error']){if(_0x2d4cd7[_0x13e5('0x10')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x13f373,_0x2d4cd7['error'][_0x13e5('0x11')]);return _0x1d921c(_0x2d4cd7[_0x13e5('0x10')][_0x13e5('0x11')]);}logger[_0x13e5('0x10')](_0x13e5('0x12'),_0x13f373,_0x2d4cd7[_0x13e5('0x10')]['message']);return _0x51d284(_0x2d4cd7[_0x13e5('0x10')]['message']);}else{logger[_0x13e5('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x13f373,_0x13e5('0xd'));_0x51d284(_0x2d4cd7[_0x13e5('0x14')]['message']);}})[_0x13e5('0x15')](function(_0x111d53){logger[_0x13e5('0x10')](_0x13e5('0x12'),_0x13f373,_0x111d53);_0x1d921c(_0x111d53);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9aef7b1..3cdbb9f 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 _0x1ddc=['/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x37622b,_0x310901){var _0x2d2702=function(_0x51362c){while(--_0x51362c){_0x37622b['push'](_0x37622b['shift']());}};_0x2d2702(++_0x310901);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x4786ef,_0x31a7bb){_0x4786ef=_0x4786ef-0x0;var _0x312938=_0x1ddc[_0x4786ef];return _0x312938;};'use strict';var multer=require('multer');var util=require(_0xc1dd('0x0'));var path=require(_0xc1dd('0x1'));var timeout=require(_0xc1dd('0x2'));var express=require('express');var router=express[_0xc1dd('0x3')]();var fs_extra=require(_0xc1dd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc1dd('0x5'));var config=require(_0xc1dd('0x6'));var controller=require('./intFreshsalesField.controller');router[_0xc1dd('0x7')]('/',auth[_0xc1dd('0x8')](),controller['index']);router[_0xc1dd('0x7')](_0xc1dd('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc1dd('0xa')]('/',auth[_0xc1dd('0x8')](),controller[_0xc1dd('0xb')]);router[_0xc1dd('0xc')]('/:id',auth[_0xc1dd('0x8')](),controller[_0xc1dd('0xd')]);router[_0xc1dd('0xe')](_0xc1dd('0x9'),auth['isAuthenticated'](),controller[_0xc1dd('0xf')]);module[_0xc1dd('0x10')]=router; \ No newline at end of file +var _0xdeb3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','create','put','update','delete','multer','util','path'];(function(_0x21a0f3,_0x33820c){var _0xb4b31a=function(_0x490e90){while(--_0x490e90){_0x21a0f3['push'](_0x21a0f3['shift']());}};_0xb4b31a(++_0x33820c);}(_0xdeb3,0xeb));var _0x3deb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdeb3[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var path=require(_0x3deb('0x2'));var timeout=require(_0x3deb('0x3'));var express=require(_0x3deb('0x4'));var router=express[_0x3deb('0x5')]();var fs_extra=require(_0x3deb('0x6'));var auth=require(_0x3deb('0x7'));var interaction=require(_0x3deb('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x3deb('0x9')](),controller[_0x3deb('0xa')]);router[_0x3deb('0xb')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller['show']);router['post']('/',auth[_0x3deb('0x9')](),controller[_0x3deb('0xd')]);router[_0x3deb('0xe')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller[_0x3deb('0xf')]);router[_0x3deb('0x10')](_0x3deb('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index afa9483..4011817 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 _0x351d=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x3afb73,_0xaa578f){var _0x5165f2=function(_0x142ac9){while(--_0x142ac9){_0x3afb73['push'](_0x3afb73['shift']());}};_0x5165f2(++_0xaa578f);}(_0x351d,0x1c1));var _0xd351=function(_0x2a6f44,_0x4e5f45){_0x2a6f44=_0x2a6f44-0x0;var _0xbae6e=_0x351d[_0x2a6f44];return _0xbae6e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd351('0x0')](_0xd351('0x1'),_0xd351('0x2'),_0xd351('0x3'),_0xd351('0x4'),_0xd351('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd351('0x6')]},'key':{'type':Sequelize[_0xd351('0x6')]},'keyType':{'type':Sequelize[_0xd351('0x0')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xd351('0x6')]},'idField':{'type':Sequelize[_0xd351('0x6')]},'nameField':{'type':Sequelize[_0xd351('0x6')]},'customField':{'type':Sequelize[_0xd351('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x62e3=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x1411d8,_0x5d8a99){var _0x2572c7=function(_0x44515c){while(--_0x44515c){_0x1411d8['push'](_0x1411d8['shift']());}};_0x2572c7(++_0x5d8a99);}(_0x62e3,0x113));var _0x362e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x362e('0x0'));module[_0x362e('0x1')]={'type':{'type':Sequelize[_0x362e('0x2')]('string',_0x362e('0x3'),_0x362e('0x4'),_0x362e('0x5'),_0x362e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x362e('0x7'),'variable',_0x362e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x362e('0x8')]},'nameField':{'type':Sequelize[_0x362e('0x8')]},'customField':{'type':Sequelize[_0x362e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x362e('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index afe45cb..f044ff0 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 _0x5ce7=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','FreshsalesField','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','keys','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x38286c,_0x132603){var _0x34863f=function(_0x3e4d24){while(--_0x3e4d24){_0x38286c['push'](_0x38286c['shift']());}};_0x34863f(++_0x132603);}(_0x5ce7,0x87));var _0x75ce=function(_0x50faaa,_0x2f840a){_0x50faaa=_0x50faaa-0x0;var _0x1edd36=_0x5ce7[_0x50faaa];return _0x1edd36;};'use strict';var emlformat=require(_0x75ce('0x0'));var rimraf=require(_0x75ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x75ce('0x2'));var rp=require(_0x75ce('0x3'));var moment=require(_0x75ce('0x4'));var BPromise=require(_0x75ce('0x5'));var Mustache=require(_0x75ce('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x75ce('0x7'));var ejs=require(_0x75ce('0x8'));var fs=require('fs');var fs_extra=require(_0x75ce('0x9'));var _=require(_0x75ce('0xa'));var squel=require(_0x75ce('0xb'));var crypto=require(_0x75ce('0xc'));var jsforce=require(_0x75ce('0xd'));var deskjs=require(_0x75ce('0xe'));var toCsv=require(_0x75ce('0x7'));var querystring=require(_0x75ce('0xf'));var Papa=require(_0x75ce('0x10'));var Redis=require('ioredis');var authService=require(_0x75ce('0x11'));var qs=require(_0x75ce('0x12'));var as=require(_0x75ce('0x13'));var hardwareService=require(_0x75ce('0x14'));var logger=require(_0x75ce('0x15'))(_0x75ce('0x16'));var utils=require('../../config/utils');var config=require(_0x75ce('0x17'));var licenseUtil=require(_0x75ce('0x18'));var db=require(_0x75ce('0x19'))['db'];function respondWithStatusCode(_0x19cd0b,_0x36046f){_0x36046f=_0x36046f||0xcc;return function(_0x45d2c8){if(_0x45d2c8){return _0x19cd0b[_0x75ce('0x1a')](_0x36046f);}return _0x19cd0b[_0x75ce('0x1b')](_0x36046f)['end']();};}function respondWithResult(_0x189e37,_0x16bf68){_0x16bf68=_0x16bf68||0xc8;return function(_0x2464bc){if(_0x2464bc){return _0x189e37['status'](_0x16bf68)[_0x75ce('0x1c')](_0x2464bc);}};}function respondWithFilteredResult(_0x499770,_0x358d02){return function(_0x210fea){if(_0x210fea){var _0x50e99e=typeof _0x358d02['offset']==='undefined'&&typeof _0x358d02['limit']===_0x75ce('0x1d');var _0x287101=_0x210fea['count'];var _0xc73856=_0x50e99e?0x0:_0x358d02[_0x75ce('0x1e')];var _0x392e33=_0x50e99e?_0x210fea[_0x75ce('0x1f')]:_0x358d02[_0x75ce('0x1e')]+_0x358d02['limit'];var _0x2a97e8;if(_0x392e33>=_0x287101){_0x392e33=_0x287101;_0x2a97e8=0xc8;}else{_0x2a97e8=0xce;}_0x499770[_0x75ce('0x1b')](_0x2a97e8);return _0x499770[_0x75ce('0x20')](_0x75ce('0x21'),_0xc73856+'-'+_0x392e33+'/'+_0x287101)[_0x75ce('0x1c')](_0x210fea);}return null;};}function patchUpdates(_0x242281){return function(_0x40df38){try{jsonpatch['apply'](_0x40df38,_0x242281,!![]);}catch(_0x3a26a3){return BPromise[_0x75ce('0x22')](_0x3a26a3);}return _0x40df38[_0x75ce('0x23')]();};}function saveUpdates(_0xfc158d,_0x58a878){return function(_0x4803b6){if(_0x4803b6){return _0x4803b6[_0x75ce('0x24')](_0xfc158d)[_0x75ce('0x25')](function(_0x44dfd1){return _0x44dfd1;});}return null;};}function removeEntity(_0x5c50cb,_0x5a43a7){return function(_0x3d820f){if(_0x3d820f){return _0x3d820f[_0x75ce('0x26')]()[_0x75ce('0x25')](function(){_0x5c50cb[_0x75ce('0x1b')](0xcc)[_0x75ce('0x27')]();});}};}function handleEntityNotFound(_0x30ec4a,_0x1cf4c4){return function(_0x424840){if(!_0x424840){_0x30ec4a[_0x75ce('0x1a')](0x194);}return _0x424840;};}function handleError(_0x3a8168,_0x59db52){_0x59db52=_0x59db52||0x1f4;return function(_0x55ba06){logger[_0x75ce('0x28')](_0x55ba06['stack']);if(_0x55ba06['name']){delete _0x55ba06[_0x75ce('0x29')];}_0x3a8168['status'](_0x59db52)[_0x75ce('0x2a')](_0x55ba06);};}exports[_0x75ce('0x2b')]=function(_0x196afc,_0x201264){var _0x12a5d5={},_0x3ab397={},_0x3e382d={'count':0x0,'rows':[]};var _0x3b0445=_[_0x75ce('0x2c')](db[_0x75ce('0x2d')]['rawAttributes'],function(_0x4ca407){return{'name':_0x4ca407[_0x75ce('0x2e')],'type':_0x4ca407[_0x75ce('0x2f')]['key']};});_0x3ab397['model']=_['map'](_0x3b0445,_0x75ce('0x29'));_0x3ab397[_0x75ce('0x30')]=_['keys'](_0x196afc[_0x75ce('0x30')]);_0x3ab397[_0x75ce('0x31')]=_[_0x75ce('0x32')](_0x3ab397[_0x75ce('0x33')],_0x3ab397['query']);_0x12a5d5[_0x75ce('0x34')]=_[_0x75ce('0x32')](_0x3ab397[_0x75ce('0x33')],qs[_0x75ce('0x35')](_0x196afc[_0x75ce('0x30')][_0x75ce('0x35')]));_0x12a5d5[_0x75ce('0x34')]=_0x12a5d5[_0x75ce('0x34')][_0x75ce('0x36')]?_0x12a5d5[_0x75ce('0x34')]:_0x3ab397['model'];if(!_0x196afc[_0x75ce('0x30')][_0x75ce('0x37')](_0x75ce('0x38'))){_0x12a5d5[_0x75ce('0x39')]=qs[_0x75ce('0x39')](_0x196afc[_0x75ce('0x30')][_0x75ce('0x39')]);_0x12a5d5[_0x75ce('0x1e')]=qs[_0x75ce('0x1e')](_0x196afc['query'][_0x75ce('0x1e')]);}_0x12a5d5[_0x75ce('0x3a')]=qs['sort'](_0x196afc[_0x75ce('0x30')]['sort']);_0x12a5d5[_0x75ce('0x3b')]=qs[_0x75ce('0x31')](_[_0x75ce('0x3c')](_0x196afc[_0x75ce('0x30')],_0x3ab397[_0x75ce('0x31')]),_0x3b0445);if(_0x196afc['query'][_0x75ce('0x3d')]){_0x12a5d5[_0x75ce('0x3b')]=_[_0x75ce('0x3e')](_0x12a5d5['where'],{'$or':_[_0x75ce('0x2c')](_0x3b0445,function(_0x5c745e){if(_0x5c745e[_0x75ce('0x2f')]!==_0x75ce('0x3f')){var _0x64f436={};_0x64f436[_0x5c745e[_0x75ce('0x29')]]={'$like':'%'+_0x196afc[_0x75ce('0x30')]['filter']+'%'};return _0x64f436;}})});}_0x12a5d5=_[_0x75ce('0x3e')]({},_0x12a5d5,_0x196afc['options']);var _0x349c67={'where':_0x12a5d5[_0x75ce('0x3b')]};return db[_0x75ce('0x2d')]['count'](_0x349c67)[_0x75ce('0x25')](function(_0x538583){_0x3e382d['count']=_0x538583;if(_0x196afc[_0x75ce('0x30')][_0x75ce('0x40')]){_0x12a5d5[_0x75ce('0x41')]=[{'all':!![]}];}return db[_0x75ce('0x2d')][_0x75ce('0x42')](_0x12a5d5);})[_0x75ce('0x25')](function(_0x28039d){_0x3e382d[_0x75ce('0x43')]=_0x28039d;return _0x3e382d;})[_0x75ce('0x25')](respondWithFilteredResult(_0x201264,_0x12a5d5))[_0x75ce('0x44')](handleError(_0x201264,null));};exports['show']=function(_0x5b57a1,_0x488a70){var _0x58ab86={'raw':!![],'where':{'id':_0x5b57a1['params']['id']}},_0x33c693={};_0x33c693['model']=_['keys'](db[_0x75ce('0x2d')][_0x75ce('0x45')]);_0x33c693[_0x75ce('0x30')]=_[_0x75ce('0x46')](_0x5b57a1[_0x75ce('0x30')]);_0x33c693[_0x75ce('0x31')]=_[_0x75ce('0x32')](_0x33c693[_0x75ce('0x33')],_0x33c693[_0x75ce('0x30')]);_0x58ab86[_0x75ce('0x34')]=_[_0x75ce('0x32')](_0x33c693['model'],qs[_0x75ce('0x35')](_0x5b57a1['query'][_0x75ce('0x35')]));_0x58ab86[_0x75ce('0x34')]=_0x58ab86[_0x75ce('0x34')][_0x75ce('0x36')]?_0x58ab86['attributes']:_0x33c693[_0x75ce('0x33')];if(_0x5b57a1[_0x75ce('0x30')][_0x75ce('0x40')]){_0x58ab86['include']=[{'all':!![]}];}_0x58ab86=_[_0x75ce('0x3e')]({},_0x58ab86,_0x5b57a1[_0x75ce('0x47')]);return db[_0x75ce('0x2d')][_0x75ce('0x48')](_0x58ab86)[_0x75ce('0x25')](handleEntityNotFound(_0x488a70,null))[_0x75ce('0x25')](respondWithResult(_0x488a70,null))['catch'](handleError(_0x488a70,null));};exports[_0x75ce('0x49')]=function(_0x3fb403,_0x536fa7){return db[_0x75ce('0x2d')][_0x75ce('0x49')](_0x3fb403[_0x75ce('0x4a')],{})['then'](respondWithResult(_0x536fa7,0xc9))[_0x75ce('0x44')](handleError(_0x536fa7,null));};exports['update']=function(_0x27c9f1,_0x621caf){if(_0x27c9f1[_0x75ce('0x4a')]['id']){delete _0x27c9f1[_0x75ce('0x4a')]['id'];}return db['FreshsalesField'][_0x75ce('0x48')]({'where':{'id':_0x27c9f1[_0x75ce('0x4b')]['id']}})['then'](handleEntityNotFound(_0x621caf,null))[_0x75ce('0x25')](saveUpdates(_0x27c9f1[_0x75ce('0x4a')],null))['then'](respondWithResult(_0x621caf,null))[_0x75ce('0x44')](handleError(_0x621caf,null));};exports[_0x75ce('0x26')]=function(_0x2e7edf,_0x498d7f){return db[_0x75ce('0x2d')]['find']({'where':{'id':_0x2e7edf[_0x75ce('0x4b')]['id']}})['then'](handleEntityNotFound(_0x498d7f,null))[_0x75ce('0x25')](removeEntity(_0x498d7f,null))[_0x75ce('0x44')](handleError(_0x498d7f,null));}; \ No newline at end of file +var _0xa00e=['type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','rimraf','zip-dir','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','json','apply','reject','save','then','destroy','error','name','send','index','FreshsalesField','fieldName'];(function(_0x902bc,_0x1f6493){var _0x39ce08=function(_0x3754ac){while(--_0x3754ac){_0x902bc['push'](_0x902bc['shift']());}};_0x39ce08(++_0x1f6493);}(_0xa00e,0xba));var _0xea00=function(_0x1e932a,_0x3095e2){_0x1e932a=_0x1e932a-0x0;var _0x54ce52=_0xa00e[_0x1e932a];return _0x54ce52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea00('0x0'));var zipdir=require(_0xea00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea00('0x2'));var BPromise=require(_0xea00('0x3'));var Mustache=require(_0xea00('0x4'));var util=require('util');var path=require(_0xea00('0x5'));var sox=require(_0xea00('0x6'));var csv=require(_0xea00('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea00('0x8'));var _=require('lodash');var squel=require(_0xea00('0x9'));var crypto=require(_0xea00('0xa'));var jsforce=require(_0xea00('0xb'));var deskjs=require(_0xea00('0xc'));var toCsv=require('to-csv');var querystring=require(_0xea00('0xd'));var Papa=require(_0xea00('0xe'));var Redis=require(_0xea00('0xf'));var authService=require(_0xea00('0x10'));var qs=require(_0xea00('0x11'));var as=require(_0xea00('0x12'));var hardwareService=require(_0xea00('0x13'));var logger=require('../../config/logger')(_0xea00('0x14'));var utils=require(_0xea00('0x15'));var config=require(_0xea00('0x16'));var licenseUtil=require(_0xea00('0x17'));var db=require(_0xea00('0x18'))['db'];function respondWithStatusCode(_0xf46213,_0x554131){_0x554131=_0x554131||0xcc;return function(_0x533f99){if(_0x533f99){return _0xf46213[_0xea00('0x19')](_0x554131);}return _0xf46213['status'](_0x554131)[_0xea00('0x1a')]();};}function respondWithResult(_0x4dac38,_0x4bcd31){_0x4bcd31=_0x4bcd31||0xc8;return function(_0x21f86c){if(_0x21f86c){return _0x4dac38['status'](_0x4bcd31)['json'](_0x21f86c);}};}function respondWithFilteredResult(_0x35a97c,_0x1f40eb){return function(_0x1f5a95){if(_0x1f5a95){var _0x4e7287=typeof _0x1f40eb[_0xea00('0x1b')]===_0xea00('0x1c')&&typeof _0x1f40eb[_0xea00('0x1d')]==='undefined';var _0x4222d7=_0x1f5a95[_0xea00('0x1e')];var _0x50d9e0=_0x4e7287?0x0:_0x1f40eb[_0xea00('0x1b')];var _0x29982d=_0x4e7287?_0x1f5a95[_0xea00('0x1e')]:_0x1f40eb[_0xea00('0x1b')]+_0x1f40eb[_0xea00('0x1d')];var _0x544cbd;if(_0x29982d>=_0x4222d7){_0x29982d=_0x4222d7;_0x544cbd=0xc8;}else{_0x544cbd=0xce;}_0x35a97c[_0xea00('0x1f')](_0x544cbd);return _0x35a97c[_0xea00('0x20')]('Content-Range',_0x50d9e0+'-'+_0x29982d+'/'+_0x4222d7)[_0xea00('0x21')](_0x1f5a95);}return null;};}function patchUpdates(_0x18e571){return function(_0xe6e7ee){try{jsonpatch[_0xea00('0x22')](_0xe6e7ee,_0x18e571,!![]);}catch(_0x450f12){return BPromise[_0xea00('0x23')](_0x450f12);}return _0xe6e7ee[_0xea00('0x24')]();};}function saveUpdates(_0x15abd0,_0x3a2770){return function(_0x17c741){if(_0x17c741){return _0x17c741['update'](_0x15abd0)[_0xea00('0x25')](function(_0x331d6f){return _0x331d6f;});}return null;};}function removeEntity(_0x5f31a9,_0x1762a1){return function(_0x268397){if(_0x268397){return _0x268397[_0xea00('0x26')]()['then'](function(){_0x5f31a9[_0xea00('0x1f')](0xcc)[_0xea00('0x1a')]();});}};}function handleEntityNotFound(_0x1ab9f0,_0x36a41d){return function(_0xefc04c){if(!_0xefc04c){_0x1ab9f0[_0xea00('0x19')](0x194);}return _0xefc04c;};}function handleError(_0x11cdbd,_0x4ff9d6){_0x4ff9d6=_0x4ff9d6||0x1f4;return function(_0x971fc9){logger[_0xea00('0x27')](_0x971fc9['stack']);if(_0x971fc9['name']){delete _0x971fc9[_0xea00('0x28')];}_0x11cdbd[_0xea00('0x1f')](_0x4ff9d6)[_0xea00('0x29')](_0x971fc9);};}exports[_0xea00('0x2a')]=function(_0x4493a6,_0x3a195d){var _0x5e8296={},_0x2c9fff={},_0x621748={'count':0x0,'rows':[]};var _0x30b899=_['map'](db[_0xea00('0x2b')]['rawAttributes'],function(_0x100c96){return{'name':_0x100c96[_0xea00('0x2c')],'type':_0x100c96[_0xea00('0x2d')][_0xea00('0x2e')]};});_0x2c9fff[_0xea00('0x2f')]=_[_0xea00('0x30')](_0x30b899,_0xea00('0x28'));_0x2c9fff[_0xea00('0x31')]=_[_0xea00('0x32')](_0x4493a6[_0xea00('0x31')]);_0x2c9fff['filters']=_[_0xea00('0x33')](_0x2c9fff['model'],_0x2c9fff[_0xea00('0x31')]);_0x5e8296['attributes']=_[_0xea00('0x33')](_0x2c9fff[_0xea00('0x2f')],qs[_0xea00('0x34')](_0x4493a6['query'][_0xea00('0x34')]));_0x5e8296[_0xea00('0x35')]=_0x5e8296['attributes'][_0xea00('0x36')]?_0x5e8296[_0xea00('0x35')]:_0x2c9fff[_0xea00('0x2f')];if(!_0x4493a6['query'][_0xea00('0x37')](_0xea00('0x38'))){_0x5e8296['limit']=qs['limit'](_0x4493a6[_0xea00('0x31')][_0xea00('0x1d')]);_0x5e8296['offset']=qs[_0xea00('0x1b')](_0x4493a6[_0xea00('0x31')][_0xea00('0x1b')]);}_0x5e8296[_0xea00('0x39')]=qs[_0xea00('0x3a')](_0x4493a6[_0xea00('0x31')][_0xea00('0x3a')]);_0x5e8296[_0xea00('0x3b')]=qs[_0xea00('0x3c')](_[_0xea00('0x3d')](_0x4493a6[_0xea00('0x31')],_0x2c9fff[_0xea00('0x3c')]),_0x30b899);if(_0x4493a6['query'][_0xea00('0x3e')]){_0x5e8296[_0xea00('0x3b')]=_['merge'](_0x5e8296[_0xea00('0x3b')],{'$or':_['map'](_0x30b899,function(_0xfd1fcc){if(_0xfd1fcc[_0xea00('0x2d')]!==_0xea00('0x3f')){var _0x22e633={};_0x22e633[_0xfd1fcc[_0xea00('0x28')]]={'$like':'%'+_0x4493a6[_0xea00('0x31')][_0xea00('0x3e')]+'%'};return _0x22e633;}})});}_0x5e8296=_['merge']({},_0x5e8296,_0x4493a6[_0xea00('0x40')]);var _0xe9b2d8={'where':_0x5e8296[_0xea00('0x3b')]};return db[_0xea00('0x2b')][_0xea00('0x1e')](_0xe9b2d8)['then'](function(_0x4eb9f0){_0x621748[_0xea00('0x1e')]=_0x4eb9f0;if(_0x4493a6[_0xea00('0x31')][_0xea00('0x41')]){_0x5e8296['include']=[{'all':!![]}];}return db[_0xea00('0x2b')][_0xea00('0x42')](_0x5e8296);})[_0xea00('0x25')](function(_0x45e0a8){_0x621748[_0xea00('0x43')]=_0x45e0a8;return _0x621748;})['then'](respondWithFilteredResult(_0x3a195d,_0x5e8296))[_0xea00('0x44')](handleError(_0x3a195d,null));};exports[_0xea00('0x45')]=function(_0x98178b,_0x5d9da4){var _0x5c53c2={'raw':!![],'where':{'id':_0x98178b[_0xea00('0x46')]['id']}},_0x2e2421={};_0x2e2421[_0xea00('0x2f')]=_[_0xea00('0x32')](db[_0xea00('0x2b')][_0xea00('0x47')]);_0x2e2421[_0xea00('0x31')]=_['keys'](_0x98178b[_0xea00('0x31')]);_0x2e2421[_0xea00('0x3c')]=_[_0xea00('0x33')](_0x2e2421[_0xea00('0x2f')],_0x2e2421[_0xea00('0x31')]);_0x5c53c2[_0xea00('0x35')]=_[_0xea00('0x33')](_0x2e2421[_0xea00('0x2f')],qs[_0xea00('0x34')](_0x98178b['query'][_0xea00('0x34')]));_0x5c53c2[_0xea00('0x35')]=_0x5c53c2[_0xea00('0x35')][_0xea00('0x36')]?_0x5c53c2[_0xea00('0x35')]:_0x2e2421[_0xea00('0x2f')];if(_0x98178b[_0xea00('0x31')][_0xea00('0x41')]){_0x5c53c2[_0xea00('0x48')]=[{'all':!![]}];}_0x5c53c2=_['merge']({},_0x5c53c2,_0x98178b[_0xea00('0x40')]);return db[_0xea00('0x2b')][_0xea00('0x49')](_0x5c53c2)[_0xea00('0x25')](handleEntityNotFound(_0x5d9da4,null))[_0xea00('0x25')](respondWithResult(_0x5d9da4,null))[_0xea00('0x44')](handleError(_0x5d9da4,null));};exports[_0xea00('0x4a')]=function(_0x1ac182,_0x28e303){return db[_0xea00('0x2b')][_0xea00('0x4a')](_0x1ac182[_0xea00('0x4b')],{})[_0xea00('0x25')](respondWithResult(_0x28e303,0xc9))[_0xea00('0x44')](handleError(_0x28e303,null));};exports[_0xea00('0x4c')]=function(_0x2ee27a,_0x225856){if(_0x2ee27a[_0xea00('0x4b')]['id']){delete _0x2ee27a['body']['id'];}return db[_0xea00('0x2b')][_0xea00('0x49')]({'where':{'id':_0x2ee27a[_0xea00('0x46')]['id']}})[_0xea00('0x25')](handleEntityNotFound(_0x225856,null))[_0xea00('0x25')](saveUpdates(_0x2ee27a['body'],null))[_0xea00('0x25')](respondWithResult(_0x225856,null))[_0xea00('0x44')](handleError(_0x225856,null));};exports['destroy']=function(_0x51e22b,_0x3fa8ee){return db[_0xea00('0x2b')][_0xea00('0x49')]({'where':{'id':_0x51e22b[_0xea00('0x46')]['id']}})[_0xea00('0x25')](handleEntityNotFound(_0x3fa8ee,null))['then'](removeEntity(_0x3fa8ee,null))[_0xea00('0x44')](handleError(_0x3fa8ee,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index c34f529..75796f7 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 _0x351d=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','FreshsalesField','int_freshsales_fields','idField','FieldId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x351d,0x90));var _0xd351=function(_0x3df1a7,_0x35b5d5){_0x3df1a7=_0x3df1a7-0x0;var _0x13bd14=_0x351d[_0x3df1a7];return _0x13bd14;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xd351('0xa'),_0xd351('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c9c=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5410b8,_0x5b734b){var _0x4702ae=function(_0x56c3a7){while(--_0x56c3a7){_0x5410b8['push'](_0x5410b8['shift']());}};_0x4702ae(++_0x5b734b);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x66cd8f,_0x5d908a){_0x66cd8f=_0x66cd8f-0x0;var _0x579561=_0x6c9c[_0x66cd8f];return _0x579561;};'use strict';var _=require(_0xc6c9('0x0'));var util=require(_0xc6c9('0x1'));var logger=require('../../config/logger')(_0xc6c9('0x2'));var moment=require(_0xc6c9('0x3'));var BPromise=require(_0xc6c9('0x4'));var rp=require(_0xc6c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6c9('0x6'));var config=require(_0xc6c9('0x7'));var attributes=require(_0xc6c9('0x8'));module[_0xc6c9('0x9')]=function(_0x422195,_0x84b96e){return _0x422195[_0xc6c9('0xa')](_0xc6c9('0xb'),attributes,{'tableName':_0xc6c9('0xc'),'paranoid':![],'indexes':[{'name':_0xc6c9('0xd'),'fields':[_0xc6c9('0xe'),_0xc6c9('0xf')],'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 9b206f9..d5e9b26 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58736a,_0x5d0121){var _0x4518e2=function(_0x2d9433){while(--_0x2d9433){_0x58736a['push'](_0x58736a['shift']());}};_0x4518e2(++_0x5d0121);}(_0x5fab,0x177));var _0xb5fa=function(_0x3b0e74,_0x295ca1){_0x3b0e74=_0x3b0e74-0x0;var _0x2ebdc1=_0x5fab[_0x3b0e74];return _0x2ebdc1;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x424039,_0x552d60){var _0x459e6d=function(_0x3e7748){while(--_0x3e7748){_0x424039['push'](_0x424039['shift']());}};_0x459e6d(++_0x552d60);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 6fc9e79..cf75447 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(_0x264c84,_0x598700){var _0x1fd84c=function(_0x271c3d){while(--_0x271c3d){_0x264c84['push'](_0x264c84['shift']());}};_0x1fd84c(++_0x598700);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x16ff1a,_0x421ba9){var _0x280cad=function(_0x3d4917){while(--_0x3d4917){_0x16ff1a['push'](_0x16ff1a['shift']());}};_0x280cad(++_0x421ba9);}(_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/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index f938595..6ea6ee6 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 _0x5464=['integrationTab','sequelize','exports','STRING'];(function(_0x20e09b,_0x250157){var _0x5d005b=function(_0x508da0){while(--_0x508da0){_0x20e09b['push'](_0x20e09b['shift']());}};_0x5d005b(++_0x250157);}(_0x5464,0x15d));var _0x4546=function(_0x3fc6ec,_0x5a618a){_0x3fc6ec=_0x3fc6ec-0x0;var _0x2f3474=_0x5464[_0x3fc6ec];return _0x2f3474;};'use strict';var Sequelize=require(_0x4546('0x0'));module[_0x4546('0x1')]={'name':{'type':Sequelize[_0x4546('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4546('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x4546('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4546('0x2')]},'clientSecret':{'type':Sequelize[_0x4546('0x2')]},'securityToken':{'type':Sequelize[_0x4546('0x2')]},'serverUrl':{'type':Sequelize[_0x4546('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x4546('0x3')}}; \ No newline at end of file +var _0x4eb8=['exports','STRING','username','ENUM','integrationTab','sequelize'];(function(_0x5681e0,_0xfbe509){var _0x71a200=function(_0x240ee6){while(--_0x240ee6){_0x5681e0['push'](_0x5681e0['shift']());}};_0x71a200(++_0xfbe509);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x9f9816,_0x579b0e){_0x9f9816=_0x9f9816-0x0;var _0x40a913=_0x4eb8[_0x9f9816];return _0x40a913;};'use strict';var Sequelize=require(_0x84eb('0x0'));module[_0x84eb('0x1')]={'name':{'type':Sequelize[_0x84eb('0x2')]},'description':{'type':Sequelize[_0x84eb('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x84eb('0x3')},'remoteUri':{'type':Sequelize[_0x84eb('0x2')]},'password':{'type':Sequelize[_0x84eb('0x2')]},'clientId':{'type':Sequelize[_0x84eb('0x2')]},'clientSecret':{'type':Sequelize[_0x84eb('0x2')]},'securityToken':{'type':Sequelize[_0x84eb('0x2')]},'serverUrl':{'type':Sequelize[_0x84eb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x84eb('0x4')](_0x84eb('0x5'),'newTab'),'defaultValue':_0x84eb('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c6b18cb..9000b6c 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 _0x963e=['../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','sendStatus','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','update','find','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','remoteUri','substring','lastIndexOf','Connection','login','concat','securityToken','ticketType','sobject','OwnerId','ActivityDate','Description','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util'];(function(_0x43671b,_0x28deb6){var _0x45c2a6=function(_0x187a01){while(--_0x187a01){_0x43671b['push'](_0x43671b['shift']());}};_0x45c2a6(++_0x28deb6);}(_0x963e,0x1d3));var _0xe963=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x963e[_0x54eab6];return _0x1e7435;};'use strict';var emlformat=require(_0xe963('0x0'));var rimraf=require(_0xe963('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe963('0x2'));var rp=require(_0xe963('0x3'));var moment=require(_0xe963('0x4'));var BPromise=require(_0xe963('0x5'));var Mustache=require(_0xe963('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe963('0x7'));var csv=require(_0xe963('0x8'));var ejs=require(_0xe963('0x9'));var fs=require('fs');var fs_extra=require(_0xe963('0xa'));var _=require(_0xe963('0xb'));var squel=require(_0xe963('0xc'));var crypto=require(_0xe963('0xd'));var jsforce=require(_0xe963('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe963('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe963('0xf'));var authService=require(_0xe963('0x10'));var qs=require(_0xe963('0x11'));var as=require(_0xe963('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe963('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe963('0x14'));var db=require(_0xe963('0x15'))['db'];var integrations=require(_0xe963('0x16'));function respondWithStatusCode(_0x2d2452,_0x2bd0e5){_0x2bd0e5=_0x2bd0e5||0xcc;return function(_0x59768e){if(_0x59768e){return _0x2d2452['sendStatus'](_0x2bd0e5);}return _0x2d2452[_0xe963('0x17')](_0x2bd0e5)['end']();};}function respondWithResult(_0x317eaf,_0x253027){_0x253027=_0x253027||0xc8;return function(_0x264673){if(_0x264673){return _0x317eaf['status'](_0x253027)['json'](_0x264673);}};}function respondWithFilteredResult(_0x2d0c26,_0x26b2a5){return function(_0x211b00){if(_0x211b00){var _0x238f78=typeof _0x26b2a5[_0xe963('0x18')]===_0xe963('0x19')&&typeof _0x26b2a5[_0xe963('0x1a')]===_0xe963('0x19');var _0x1b85bd=_0x211b00['count'];var _0x87e5d=_0x238f78?0x0:_0x26b2a5[_0xe963('0x18')];var _0x29c74a=_0x238f78?_0x211b00[_0xe963('0x1b')]:_0x26b2a5[_0xe963('0x18')]+_0x26b2a5[_0xe963('0x1a')];var _0x3cb007;if(_0x29c74a>=_0x1b85bd){_0x29c74a=_0x1b85bd;_0x3cb007=0xc8;}else{_0x3cb007=0xce;}_0x2d0c26[_0xe963('0x17')](_0x3cb007);return _0x2d0c26[_0xe963('0x1c')]('Content-Range',_0x87e5d+'-'+_0x29c74a+'/'+_0x1b85bd)['json'](_0x211b00);}return null;};}function patchUpdates(_0x30e4aa){return function(_0x5210b4){try{jsonpatch[_0xe963('0x1d')](_0x5210b4,_0x30e4aa,!![]);}catch(_0x194bb1){return BPromise[_0xe963('0x1e')](_0x194bb1);}return _0x5210b4[_0xe963('0x1f')]();};}function saveUpdates(_0x2a39eb,_0x50cb12){return function(_0x5912d2){if(_0x5912d2){return _0x5912d2['update'](_0x2a39eb)['then'](function(_0x4f6532){return _0x4f6532;});}return null;};}function removeEntity(_0x4d03ae,_0x4a7654){return function(_0x3bf33a){if(_0x3bf33a){return _0x3bf33a[_0xe963('0x20')]()[_0xe963('0x21')](function(){_0x4d03ae[_0xe963('0x17')](0xcc)[_0xe963('0x22')]();});}};}function handleEntityNotFound(_0x4f31b3,_0x580f70){return function(_0x5a5675){if(!_0x5a5675){_0x4f31b3[_0xe963('0x23')](0x194);}return _0x5a5675;};}function handleError(_0x3c2edf,_0x30f2c8){_0x30f2c8=_0x30f2c8||0x1f4;return function(_0x1ed581){logger['error'](_0x1ed581[_0xe963('0x24')]);if(_0x1ed581['name']){delete _0x1ed581[_0xe963('0x25')];}_0x3c2edf[_0xe963('0x17')](_0x30f2c8)[_0xe963('0x26')](_0x1ed581);};}exports[_0xe963('0x27')]=function(_0x824cae,_0x49a4aa){var _0x210260={},_0x3a4559={},_0x5557d5={'count':0x0,'rows':[]};var _0x4cc644=_['map'](db[_0xe963('0x28')][_0xe963('0x29')],function(_0x538cf4){return{'name':_0x538cf4[_0xe963('0x2a')],'type':_0x538cf4[_0xe963('0x2b')][_0xe963('0x2c')]};});_0x3a4559[_0xe963('0x2d')]=_[_0xe963('0x2e')](_0x4cc644,'name');_0x3a4559[_0xe963('0x2f')]=_[_0xe963('0x30')](_0x824cae[_0xe963('0x2f')]);_0x3a4559[_0xe963('0x31')]=_['intersection'](_0x3a4559[_0xe963('0x2d')],_0x3a4559[_0xe963('0x2f')]);_0x210260['attributes']=_[_0xe963('0x32')](_0x3a4559['model'],qs[_0xe963('0x33')](_0x824cae[_0xe963('0x2f')][_0xe963('0x33')]));_0x210260[_0xe963('0x34')]=_0x210260[_0xe963('0x34')][_0xe963('0x35')]?_0x210260[_0xe963('0x34')]:_0x3a4559[_0xe963('0x2d')];if(!_0x824cae[_0xe963('0x2f')]['hasOwnProperty'](_0xe963('0x36'))){_0x210260[_0xe963('0x1a')]=qs[_0xe963('0x1a')](_0x824cae[_0xe963('0x2f')][_0xe963('0x1a')]);_0x210260[_0xe963('0x18')]=qs[_0xe963('0x18')](_0x824cae[_0xe963('0x2f')]['offset']);}_0x210260[_0xe963('0x37')]=qs[_0xe963('0x38')](_0x824cae[_0xe963('0x2f')]['sort']);_0x210260[_0xe963('0x39')]=qs['filters'](_[_0xe963('0x3a')](_0x824cae[_0xe963('0x2f')],_0x3a4559[_0xe963('0x31')]),_0x4cc644);if(_0x824cae[_0xe963('0x2f')][_0xe963('0x3b')]){_0x210260[_0xe963('0x39')]=_[_0xe963('0x3c')](_0x210260[_0xe963('0x39')],{'$or':_[_0xe963('0x2e')](_0x4cc644,function(_0x32ffc3){if(_0x32ffc3[_0xe963('0x2b')]!==_0xe963('0x3d')){var _0x512725={};_0x512725[_0x32ffc3[_0xe963('0x25')]]={'$like':'%'+_0x824cae[_0xe963('0x2f')][_0xe963('0x3b')]+'%'};return _0x512725;}})});}_0x210260=_[_0xe963('0x3c')]({},_0x210260,_0x824cae[_0xe963('0x3e')]);var _0xbe970a={'where':_0x210260[_0xe963('0x39')]};return db[_0xe963('0x28')][_0xe963('0x1b')](_0xbe970a)[_0xe963('0x21')](function(_0x2b86c9){_0x5557d5[_0xe963('0x1b')]=_0x2b86c9;if(_0x824cae['query'][_0xe963('0x3f')]){_0x210260[_0xe963('0x40')]=[{'all':!![]}];}return db[_0xe963('0x28')][_0xe963('0x41')](_0x210260);})[_0xe963('0x21')](function(_0x5c8f11){_0x5557d5[_0xe963('0x42')]=_0x5c8f11;return _0x5557d5;})[_0xe963('0x21')](respondWithFilteredResult(_0x49a4aa,_0x210260))['catch'](handleError(_0x49a4aa,null));};exports[_0xe963('0x43')]=function(_0x3f26c0,_0x4885c7){var _0x13ff75={'raw':![],'where':{'id':_0x3f26c0[_0xe963('0x44')]['id']}},_0x181343={};_0x181343['model']=_[_0xe963('0x30')](db[_0xe963('0x28')]['rawAttributes']);_0x181343[_0xe963('0x2f')]=_[_0xe963('0x30')](_0x3f26c0[_0xe963('0x2f')]);_0x181343[_0xe963('0x31')]=_[_0xe963('0x32')](_0x181343[_0xe963('0x2d')],_0x181343[_0xe963('0x2f')]);_0x13ff75[_0xe963('0x34')]=_['intersection'](_0x181343[_0xe963('0x2d')],qs[_0xe963('0x33')](_0x3f26c0[_0xe963('0x2f')][_0xe963('0x33')]));_0x13ff75[_0xe963('0x34')]=_0x13ff75[_0xe963('0x34')]['length']?_0x13ff75[_0xe963('0x34')]:_0x181343[_0xe963('0x2d')];if(_0x3f26c0['query'][_0xe963('0x3f')]){_0x13ff75[_0xe963('0x40')]=[{'all':!![]}];}_0x13ff75=_['merge']({},_0x13ff75,_0x3f26c0[_0xe963('0x3e')]);return db[_0xe963('0x28')]['find'](_0x13ff75)[_0xe963('0x21')](handleEntityNotFound(_0x4885c7,null))[_0xe963('0x21')](respondWithResult(_0x4885c7,null))[_0xe963('0x45')](handleError(_0x4885c7,null));};exports['create']=function(_0xedae32,_0x6049c6){return db[_0xe963('0x28')][_0xe963('0x46')](_0xedae32[_0xe963('0x47')],{})[_0xe963('0x21')](respondWithResult(_0x6049c6,0xc9))[_0xe963('0x45')](handleError(_0x6049c6,null));};exports[_0xe963('0x48')]=function(_0x9b1c0d,_0x5cd64c){if(_0x9b1c0d['body']['id']){delete _0x9b1c0d[_0xe963('0x47')]['id'];}return db['SalesforceAccount'][_0xe963('0x49')]({'where':{'id':_0x9b1c0d[_0xe963('0x44')]['id']}})['then'](handleEntityNotFound(_0x5cd64c,null))[_0xe963('0x21')](saveUpdates(_0x9b1c0d[_0xe963('0x47')],null))[_0xe963('0x21')](respondWithResult(_0x5cd64c,null))[_0xe963('0x45')](handleError(_0x5cd64c,null));};exports[_0xe963('0x20')]=function(_0x4257ee,_0x2a0125){return db[_0xe963('0x28')][_0xe963('0x49')]({'where':{'id':_0x4257ee[_0xe963('0x44')]['id']}})[_0xe963('0x21')](handleEntityNotFound(_0x2a0125,null))[_0xe963('0x21')](removeEntity(_0x2a0125,null))['catch'](handleError(_0x2a0125,null));};exports[_0xe963('0x4a')]=function(_0x248732,_0x50dc08,_0x126d99){var _0x3d14e6={};var _0x100aec={};var _0x5ab57d;var _0x7be7cf;return db[_0xe963('0x28')][_0xe963('0x4b')]({'where':{'id':_0x248732[_0xe963('0x44')]['id']}})[_0xe963('0x21')](handleEntityNotFound(_0x50dc08,null))[_0xe963('0x21')](function(_0x4ed8d7){if(_0x4ed8d7){_0x5ab57d=_0x4ed8d7;_0x100aec['model']=_[_0xe963('0x30')](db[_0xe963('0x4c')][_0xe963('0x29')]);_0x100aec[_0xe963('0x2f')]=_[_0xe963('0x30')](_0x248732[_0xe963('0x2f')]);_0x100aec[_0xe963('0x31')]=_[_0xe963('0x32')](_0x100aec['model'],_0x100aec[_0xe963('0x2f')]);_0x3d14e6[_0xe963('0x34')]=_['intersection'](_0x100aec[_0xe963('0x2d')],qs[_0xe963('0x33')](_0x248732[_0xe963('0x2f')][_0xe963('0x33')]));_0x3d14e6[_0xe963('0x34')]=_0x3d14e6[_0xe963('0x34')][_0xe963('0x35')]?_0x3d14e6['attributes']:_0x100aec[_0xe963('0x2d')];_0x3d14e6[_0xe963('0x37')]=qs[_0xe963('0x38')](_0x248732[_0xe963('0x2f')][_0xe963('0x38')]);_0x3d14e6[_0xe963('0x39')]=qs[_0xe963('0x31')](_[_0xe963('0x3a')](_0x248732[_0xe963('0x2f')],_0x100aec[_0xe963('0x31')]));if(_0x248732[_0xe963('0x2f')]['filter']){_0x3d14e6[_0xe963('0x39')]=_[_0xe963('0x3c')](_0x3d14e6[_0xe963('0x39')],{'$or':_[_0xe963('0x2e')](_0x3d14e6['attributes'],function(_0x20d735){var _0x2f59b2={};_0x2f59b2[_0x20d735]={'$like':'%'+_0x248732['query']['filter']+'%'};return _0x2f59b2;})});}_0x3d14e6=_['merge']({},_0x3d14e6,_0x248732[_0xe963('0x3e')]);return _0x5ab57d[_0xe963('0x4a')](_0x3d14e6);}})[_0xe963('0x21')](function(_0x4c1e32){if(_0x4c1e32){_0x7be7cf=_0x4c1e32['length'];if(!_0x248732['query'][_0xe963('0x4d')](_0xe963('0x36'))){_0x3d14e6[_0xe963('0x1a')]=qs[_0xe963('0x1a')](_0x248732[_0xe963('0x2f')][_0xe963('0x1a')]);_0x3d14e6[_0xe963('0x18')]=qs[_0xe963('0x18')](_0x248732[_0xe963('0x2f')]['offset']);}return _0x5ab57d[_0xe963('0x4a')](_0x3d14e6);}})['then'](function(_0x2bc476){if(_0x2bc476){return _0x2bc476?{'count':_0x7be7cf,'rows':_0x2bc476}:null;}})[_0xe963('0x21')](respondWithResult(_0x50dc08,null))[_0xe963('0x45')](handleError(_0x50dc08,null));};exports[_0xe963('0x4e')]=function(_0x35a19a,_0x41c731,_0x4cdbce){if(_0x35a19a[_0xe963('0x47')]['id']){delete _0x35a19a[_0xe963('0x47')]['id'];}return db[_0xe963('0x28')][_0xe963('0x4b')]({'where':{'id':_0x35a19a[_0xe963('0x44')]['id']}})['then'](handleEntityNotFound(_0x41c731,null))['then'](function(_0x4c919c){if(_0x4c919c){_0x35a19a['body']['AccountId']=_0x4c919c['id'];_0x35a19a[_0xe963('0x47')][_0xe963('0x4f')]=integrations[_0xe963('0x50')](_0x35a19a[_0xe963('0x47')][_0xe963('0x51')],_0x35a19a[_0xe963('0x47')][_0xe963('0x2b')]);_0x35a19a[_0xe963('0x47')][_0xe963('0x52')]=integrations[_0xe963('0x53')](_0x35a19a[_0xe963('0x47')]['channel'],_0x35a19a[_0xe963('0x47')][_0xe963('0x2b')]);return db[_0xe963('0x4c')]['create'](_0x35a19a['body'],{'include':[{'model':db[_0xe963('0x54')],'as':_0xe963('0x4f')},{'model':db[_0xe963('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x41c731,null))['catch'](handleError(_0x41c731,null));};exports[_0xe963('0x55')]=function(_0x59142b,_0x240578,_0x2109ee){var _0x28fb53;var _0x584a5b='';var _0x204f9c=_0xe963('0x56');return db[_0xe963('0x28')][_0xe963('0x4b')]({'where':{'id':_0x59142b[_0xe963('0x44')]['id']},'attributes':['id','remoteUri',_0xe963('0x57'),_0xe963('0x58'),_0xe963('0x59'),_0xe963('0x5a'),'securityToken']})[_0xe963('0x21')](handleEntityNotFound(_0x240578,null))[_0xe963('0x21')](function(_0x44914b){if(_0x44914b){_0x584a5b=_0x44914b[_0xe963('0x5b')];var _0x31ff76=_0x584a5b['slice'](-0x1);if(_0x31ff76==='/'){_0x584a5b=_0x584a5b[_0xe963('0x5c')](0x0,_0x584a5b[_0xe963('0x5d')](_0x31ff76));}_0x28fb53=new jsforce[(_0xe963('0x5e'))]({'oauth2':{'loginUrl':_0x584a5b,'clientId':_0x44914b[_0xe963('0x57')],'clientSecret':_0x44914b[_0xe963('0x58')]}});return _0x28fb53[_0xe963('0x5f')](_0x44914b[_0xe963('0x59')],_0x44914b[_0xe963('0x5a')][_0xe963('0x60')](_0x44914b[_0xe963('0x61')]));}})[_0xe963('0x21')](function(_0x341288){if(_0x341288){if(!_['isNil'](_0x59142b[_0xe963('0x2f')]['ticketType'])){_0x204f9c=_0x59142b['query'][_0xe963('0x62')];}return _0x28fb53[_0xe963('0x63')](_0x204f9c)['describe']();}})[_0xe963('0x21')](function(_0x2e4ec8){var _0x4388df=[_0xe963('0x64'),_0xe963('0x65'),'IsReminderSet','IsRecurrence','Subject',_0xe963('0x66')];var _0x8b5ad6=[_0xe963('0x67'),'int',_0xe963('0x68'),_0xe963('0x69'),_0xe963('0x6a'),_0xe963('0x6b'),_0xe963('0x6c')];if(_0x2e4ec8){_[_0xe963('0x6d')](_0x2e4ec8[_0xe963('0x33')],function(_0x1f745a){return _0x4388df[_0xe963('0x6e')](_0x1f745a[_0xe963('0x25')])||!_0x8b5ad6[_0xe963('0x6e')](_0x1f745a[_0xe963('0x2b')]);});return{'count':_0x2e4ec8['fields'][_0xe963('0x35')],'rows':_[_0xe963('0x2e')](_0x2e4ec8[_0xe963('0x33')],function(_0x7b0130){return{'id':_0x7b0130['name'],'name':_0x7b0130[_0xe963('0x6f')],'custom':_0x7b0130[_0xe963('0x70')],'options':_0x7b0130[_0xe963('0x71')][_0xe963('0x35')]>0x0?_[_0xe963('0x2e')](_0x7b0130['picklistValues'],function(_0x15ece1){return{'name':_0x15ece1['label'],'value':_0x15ece1['value']};}):_0x7b0130[_0xe963('0x2b')]==_0xe963('0x69')?[{'name':_0xe963('0x72'),'value':_0xe963('0x73')},{'name':_0xe963('0x74'),'value':_0xe963('0x75')}]:[]};})};}})[_0xe963('0x21')](respondWithResult(_0x240578,null))[_0xe963('0x45')](function(_0x1ff97c){var _0xf21a1f=_0x59142b[_0xe963('0x2f')]['test']?0x1f4:_0x1ff97c[_0xe963('0x76')]||0x1f4;logger['error'](_0xe963('0x77'),'getFields',_0xf21a1f,JSON[_0xe963('0x78')](_0x1ff97c));delete _0x1ff97c['name'];if(_0xf21a1f===0x191){_0xf21a1f=0x190;}_0x240578['status'](_0xf21a1f)[_0xe963('0x26')](_0x59142b[_0xe963('0x2f')]['test']?{'message':_0xe963('0x79'),'statusCode':_0x1ff97c[_0xe963('0x76')]}:_0x1ff97c);});}; \ No newline at end of file +var _0x856d=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','getConfigurations','findOne','length','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SalesforceConfiguration','SalesforceField','Subjects','Descriptions','Task','clientId','clientSecret','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','Description','string','int','picklist','boolean','email','phone','includes','label','custom','picklistValues','value','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse'];(function(_0x3bbad7,_0xb3e410){var _0x1a10a1=function(_0x1327f1){while(--_0x1327f1){_0x3bbad7['push'](_0x3bbad7['shift']());}};_0x1a10a1(++_0xb3e410);}(_0x856d,0xe2));var _0xd856=function(_0x141dea,_0x3c7158){_0x141dea=_0x141dea-0x0;var _0x585cf5=_0x856d[_0x141dea];return _0x585cf5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd856('0x0'));var zipdir=require(_0xd856('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd856('0x2'));var moment=require(_0xd856('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd856('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd856('0x5'));var ejs=require(_0xd856('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd856('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd856('0x8'));var deskjs=require(_0xd856('0x9'));var toCsv=require(_0xd856('0x5'));var querystring=require(_0xd856('0xa'));var Papa=require(_0xd856('0xb'));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(_0xd856('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0xd856('0xd'));var config=require(_0xd856('0xe'));var licenseUtil=require(_0xd856('0xf'));var db=require(_0xd856('0x10'))['db'];var integrations=require(_0xd856('0x11'));function respondWithStatusCode(_0x25d4df,_0x1bbad5){_0x1bbad5=_0x1bbad5||0xcc;return function(_0x2f4a98){if(_0x2f4a98){return _0x25d4df[_0xd856('0x12')](_0x1bbad5);}return _0x25d4df[_0xd856('0x13')](_0x1bbad5)[_0xd856('0x14')]();};}function respondWithResult(_0x43410a,_0x2ecdf9){_0x2ecdf9=_0x2ecdf9||0xc8;return function(_0x4e8c86){if(_0x4e8c86){return _0x43410a[_0xd856('0x13')](_0x2ecdf9)[_0xd856('0x15')](_0x4e8c86);}};}function respondWithFilteredResult(_0x4ccc2,_0x9eec88){return function(_0x4e81c7){if(_0x4e81c7){var _0xe73c4a=typeof _0x9eec88[_0xd856('0x16')]===_0xd856('0x17')&&typeof _0x9eec88['limit']===_0xd856('0x17');var _0x3640ee=_0x4e81c7['count'];var _0x2e6e41=_0xe73c4a?0x0:_0x9eec88[_0xd856('0x16')];var _0xb257e8=_0xe73c4a?_0x4e81c7[_0xd856('0x18')]:_0x9eec88['offset']+_0x9eec88[_0xd856('0x19')];var _0x108671;if(_0xb257e8>=_0x3640ee){_0xb257e8=_0x3640ee;_0x108671=0xc8;}else{_0x108671=0xce;}_0x4ccc2[_0xd856('0x13')](_0x108671);return _0x4ccc2['set'](_0xd856('0x1a'),_0x2e6e41+'-'+_0xb257e8+'/'+_0x3640ee)['json'](_0x4e81c7);}return null;};}function patchUpdates(_0x3b75af){return function(_0x45854f){try{jsonpatch['apply'](_0x45854f,_0x3b75af,!![]);}catch(_0x417a07){return BPromise[_0xd856('0x1b')](_0x417a07);}return _0x45854f['save']();};}function saveUpdates(_0x58d962,_0x414ecb){return function(_0x480072){if(_0x480072){return _0x480072[_0xd856('0x1c')](_0x58d962)['then'](function(_0x5dae0d){return _0x5dae0d;});}return null;};}function removeEntity(_0xfabfc1,_0x49a34b){return function(_0x59fe06){if(_0x59fe06){return _0x59fe06[_0xd856('0x1d')]()[_0xd856('0x1e')](function(){_0xfabfc1[_0xd856('0x13')](0xcc)[_0xd856('0x14')]();});}};}function handleEntityNotFound(_0x384e72,_0x276577){return function(_0x175dea){if(!_0x175dea){_0x384e72[_0xd856('0x12')](0x194);}return _0x175dea;};}function handleError(_0x104a1f,_0x2ca410){_0x2ca410=_0x2ca410||0x1f4;return function(_0x3eb6c1){logger[_0xd856('0x1f')](_0x3eb6c1[_0xd856('0x20')]);if(_0x3eb6c1[_0xd856('0x21')]){delete _0x3eb6c1[_0xd856('0x21')];}_0x104a1f[_0xd856('0x13')](_0x2ca410)[_0xd856('0x22')](_0x3eb6c1);};}exports[_0xd856('0x23')]=function(_0x274c6e,_0xed22cd){var _0xfad045={},_0x900a1e={},_0xbdabb1={'count':0x0,'rows':[]};var _0x586693=_[_0xd856('0x24')](db[_0xd856('0x25')][_0xd856('0x26')],function(_0xb70f9a){return{'name':_0xb70f9a[_0xd856('0x27')],'type':_0xb70f9a['type'][_0xd856('0x28')]};});_0x900a1e[_0xd856('0x29')]=_[_0xd856('0x24')](_0x586693,_0xd856('0x21'));_0x900a1e[_0xd856('0x2a')]=_[_0xd856('0x2b')](_0x274c6e['query']);_0x900a1e[_0xd856('0x2c')]=_['intersection'](_0x900a1e[_0xd856('0x29')],_0x900a1e[_0xd856('0x2a')]);_0xfad045[_0xd856('0x2d')]=_[_0xd856('0x2e')](_0x900a1e[_0xd856('0x29')],qs['fields'](_0x274c6e[_0xd856('0x2a')][_0xd856('0x2f')]));_0xfad045['attributes']=_0xfad045[_0xd856('0x2d')]['length']?_0xfad045[_0xd856('0x2d')]:_0x900a1e[_0xd856('0x29')];if(!_0x274c6e[_0xd856('0x2a')][_0xd856('0x30')](_0xd856('0x31'))){_0xfad045['limit']=qs[_0xd856('0x19')](_0x274c6e[_0xd856('0x2a')][_0xd856('0x19')]);_0xfad045['offset']=qs[_0xd856('0x16')](_0x274c6e['query']['offset']);}_0xfad045[_0xd856('0x32')]=qs[_0xd856('0x33')](_0x274c6e['query'][_0xd856('0x33')]);_0xfad045[_0xd856('0x34')]=qs[_0xd856('0x2c')](_[_0xd856('0x35')](_0x274c6e[_0xd856('0x2a')],_0x900a1e['filters']),_0x586693);if(_0x274c6e[_0xd856('0x2a')][_0xd856('0x36')]){_0xfad045[_0xd856('0x34')]=_[_0xd856('0x37')](_0xfad045['where'],{'$or':_[_0xd856('0x24')](_0x586693,function(_0x2bdfff){if(_0x2bdfff[_0xd856('0x38')]!==_0xd856('0x39')){var _0x2332e5={};_0x2332e5[_0x2bdfff[_0xd856('0x21')]]={'$like':'%'+_0x274c6e[_0xd856('0x2a')][_0xd856('0x36')]+'%'};return _0x2332e5;}})});}_0xfad045=_[_0xd856('0x37')]({},_0xfad045,_0x274c6e[_0xd856('0x3a')]);var _0x39cbc9={'where':_0xfad045[_0xd856('0x34')]};return db[_0xd856('0x25')]['count'](_0x39cbc9)[_0xd856('0x1e')](function(_0x44fc89){_0xbdabb1[_0xd856('0x18')]=_0x44fc89;if(_0x274c6e[_0xd856('0x2a')][_0xd856('0x3b')]){_0xfad045[_0xd856('0x3c')]=[{'all':!![]}];}return db[_0xd856('0x25')]['findAll'](_0xfad045);})[_0xd856('0x1e')](function(_0x45ddf6){_0xbdabb1['rows']=_0x45ddf6;return _0xbdabb1;})['then'](respondWithFilteredResult(_0xed22cd,_0xfad045))[_0xd856('0x3d')](handleError(_0xed22cd,null));};exports[_0xd856('0x3e')]=function(_0xce1431,_0x27cade){var _0x545daa={'raw':![],'where':{'id':_0xce1431[_0xd856('0x3f')]['id']}},_0x43fc85={};_0x43fc85[_0xd856('0x29')]=_[_0xd856('0x2b')](db[_0xd856('0x25')][_0xd856('0x26')]);_0x43fc85[_0xd856('0x2a')]=_['keys'](_0xce1431[_0xd856('0x2a')]);_0x43fc85[_0xd856('0x2c')]=_[_0xd856('0x2e')](_0x43fc85[_0xd856('0x29')],_0x43fc85['query']);_0x545daa['attributes']=_[_0xd856('0x2e')](_0x43fc85[_0xd856('0x29')],qs[_0xd856('0x2f')](_0xce1431[_0xd856('0x2a')]['fields']));_0x545daa['attributes']=_0x545daa[_0xd856('0x2d')]['length']?_0x545daa['attributes']:_0x43fc85['model'];if(_0xce1431[_0xd856('0x2a')][_0xd856('0x3b')]){_0x545daa[_0xd856('0x3c')]=[{'all':!![]}];}_0x545daa=_[_0xd856('0x37')]({},_0x545daa,_0xce1431['options']);return db['SalesforceAccount'][_0xd856('0x40')](_0x545daa)['then'](handleEntityNotFound(_0x27cade,null))['then'](respondWithResult(_0x27cade,null))['catch'](handleError(_0x27cade,null));};exports[_0xd856('0x41')]=function(_0x526d14,_0x3f7b47){return db[_0xd856('0x25')]['create'](_0x526d14[_0xd856('0x42')],{})['then'](respondWithResult(_0x3f7b47,0xc9))[_0xd856('0x3d')](handleError(_0x3f7b47,null));};exports[_0xd856('0x1c')]=function(_0x444af2,_0x55c486){if(_0x444af2[_0xd856('0x42')]['id']){delete _0x444af2[_0xd856('0x42')]['id'];}return db[_0xd856('0x25')][_0xd856('0x40')]({'where':{'id':_0x444af2[_0xd856('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55c486,null))[_0xd856('0x1e')](saveUpdates(_0x444af2[_0xd856('0x42')],null))[_0xd856('0x1e')](respondWithResult(_0x55c486,null))['catch'](handleError(_0x55c486,null));};exports[_0xd856('0x1d')]=function(_0x55c6e5,_0x5ec34d){return db['SalesforceAccount'][_0xd856('0x40')]({'where':{'id':_0x55c6e5['params']['id']}})[_0xd856('0x1e')](handleEntityNotFound(_0x5ec34d,null))[_0xd856('0x1e')](removeEntity(_0x5ec34d,null))[_0xd856('0x3d')](handleError(_0x5ec34d,null));};exports[_0xd856('0x43')]=function(_0x45f528,_0x39b8c8,_0x5ae088){var _0x3a4581={};var _0x3719a9={};var _0x2defbe;var _0x566054;return db[_0xd856('0x25')][_0xd856('0x44')]({'where':{'id':_0x45f528[_0xd856('0x3f')]['id']}})[_0xd856('0x1e')](handleEntityNotFound(_0x39b8c8,null))[_0xd856('0x1e')](function(_0x464808){if(_0x464808){_0x2defbe=_0x464808;_0x3719a9[_0xd856('0x29')]=_[_0xd856('0x2b')](db['SalesforceConfiguration'][_0xd856('0x26')]);_0x3719a9[_0xd856('0x2a')]=_[_0xd856('0x2b')](_0x45f528[_0xd856('0x2a')]);_0x3719a9[_0xd856('0x2c')]=_[_0xd856('0x2e')](_0x3719a9[_0xd856('0x29')],_0x3719a9[_0xd856('0x2a')]);_0x3a4581[_0xd856('0x2d')]=_[_0xd856('0x2e')](_0x3719a9[_0xd856('0x29')],qs['fields'](_0x45f528['query'][_0xd856('0x2f')]));_0x3a4581[_0xd856('0x2d')]=_0x3a4581[_0xd856('0x2d')][_0xd856('0x45')]?_0x3a4581[_0xd856('0x2d')]:_0x3719a9[_0xd856('0x29')];_0x3a4581[_0xd856('0x32')]=qs[_0xd856('0x33')](_0x45f528[_0xd856('0x2a')]['sort']);_0x3a4581[_0xd856('0x34')]=qs['filters'](_[_0xd856('0x35')](_0x45f528[_0xd856('0x2a')],_0x3719a9['filters']));if(_0x45f528[_0xd856('0x2a')][_0xd856('0x36')]){_0x3a4581[_0xd856('0x34')]=_['merge'](_0x3a4581[_0xd856('0x34')],{'$or':_[_0xd856('0x24')](_0x3a4581[_0xd856('0x2d')],function(_0x362f29){var _0x2fc794={};_0x2fc794[_0x362f29]={'$like':'%'+_0x45f528[_0xd856('0x2a')][_0xd856('0x36')]+'%'};return _0x2fc794;})});}_0x3a4581=_[_0xd856('0x37')]({},_0x3a4581,_0x45f528['options']);return _0x2defbe['getConfigurations'](_0x3a4581);}})[_0xd856('0x1e')](function(_0x3e96d0){if(_0x3e96d0){_0x566054=_0x3e96d0[_0xd856('0x45')];if(!_0x45f528[_0xd856('0x2a')][_0xd856('0x30')](_0xd856('0x31'))){_0x3a4581['limit']=qs[_0xd856('0x19')](_0x45f528[_0xd856('0x2a')]['limit']);_0x3a4581[_0xd856('0x16')]=qs[_0xd856('0x16')](_0x45f528[_0xd856('0x2a')][_0xd856('0x16')]);}return _0x2defbe['getConfigurations'](_0x3a4581);}})[_0xd856('0x1e')](function(_0x26e791){if(_0x26e791){return _0x26e791?{'count':_0x566054,'rows':_0x26e791}:null;}})['then'](respondWithResult(_0x39b8c8,null))['catch'](handleError(_0x39b8c8,null));};exports[_0xd856('0x46')]=function(_0x13ebb7,_0xbbabcf,_0x19acea){if(_0x13ebb7[_0xd856('0x42')]['id']){delete _0x13ebb7['body']['id'];}return db[_0xd856('0x25')][_0xd856('0x44')]({'where':{'id':_0x13ebb7['params']['id']}})[_0xd856('0x1e')](handleEntityNotFound(_0xbbabcf,null))[_0xd856('0x1e')](function(_0x91ee8d){if(_0x91ee8d){_0x13ebb7[_0xd856('0x42')][_0xd856('0x47')]=_0x91ee8d['id'];_0x13ebb7[_0xd856('0x42')]['Subjects']=integrations[_0xd856('0x48')](_0x13ebb7[_0xd856('0x42')][_0xd856('0x49')],_0x13ebb7['body'][_0xd856('0x38')]);_0x13ebb7['body']['Descriptions']=integrations[_0xd856('0x4a')](_0x13ebb7['body'][_0xd856('0x49')],_0x13ebb7[_0xd856('0x42')][_0xd856('0x38')]);return db[_0xd856('0x4b')][_0xd856('0x41')](_0x13ebb7['body'],{'include':[{'model':db[_0xd856('0x4c')],'as':_0xd856('0x4d')},{'model':db[_0xd856('0x4c')],'as':_0xd856('0x4e')}]});}return null;})[_0xd856('0x1e')](respondWithResult(_0xbbabcf,null))['catch'](handleError(_0xbbabcf,null));};exports['getFields']=function(_0x160f43,_0x4198a2,_0x3d844e){var _0x16341d;var _0x514c11='';var _0x2124df=_0xd856('0x4f');return db[_0xd856('0x25')][_0xd856('0x44')]({'where':{'id':_0x160f43[_0xd856('0x3f')]['id']},'attributes':['id','remoteUri',_0xd856('0x50'),_0xd856('0x51'),_0xd856('0x52'),_0xd856('0x53'),_0xd856('0x54')]})[_0xd856('0x1e')](handleEntityNotFound(_0x4198a2,null))[_0xd856('0x1e')](function(_0x34ad25){if(_0x34ad25){_0x514c11=_0x34ad25[_0xd856('0x55')];var _0x48e1a5=_0x514c11[_0xd856('0x56')](-0x1);if(_0x48e1a5==='/'){_0x514c11=_0x514c11[_0xd856('0x57')](0x0,_0x514c11[_0xd856('0x58')](_0x48e1a5));}_0x16341d=new jsforce[(_0xd856('0x59'))]({'oauth2':{'loginUrl':_0x514c11,'clientId':_0x34ad25[_0xd856('0x50')],'clientSecret':_0x34ad25[_0xd856('0x51')]}});return _0x16341d[_0xd856('0x5a')](_0x34ad25[_0xd856('0x52')],_0x34ad25[_0xd856('0x53')][_0xd856('0x5b')](_0x34ad25[_0xd856('0x54')]));}})['then'](function(_0x229703){if(_0x229703){if(!_[_0xd856('0x5c')](_0x160f43[_0xd856('0x2a')][_0xd856('0x5d')])){_0x2124df=_0x160f43[_0xd856('0x2a')]['ticketType'];}return _0x16341d[_0xd856('0x5e')](_0x2124df)['describe']();}})['then'](function(_0x103231){var _0x3148d9=[_0xd856('0x5f'),_0xd856('0x60'),_0xd856('0x61'),'IsRecurrence','Subject',_0xd856('0x62')];var _0x283184=[_0xd856('0x63'),_0xd856('0x64'),_0xd856('0x65'),_0xd856('0x66'),_0xd856('0x67'),'textarea',_0xd856('0x68')];if(_0x103231){_['remove'](_0x103231[_0xd856('0x2f')],function(_0x575e2c){return _0x3148d9[_0xd856('0x69')](_0x575e2c[_0xd856('0x21')])||!_0x283184[_0xd856('0x69')](_0x575e2c[_0xd856('0x38')]);});return{'count':_0x103231[_0xd856('0x2f')][_0xd856('0x45')],'rows':_[_0xd856('0x24')](_0x103231[_0xd856('0x2f')],function(_0x2d1d28){return{'id':_0x2d1d28[_0xd856('0x21')],'name':_0x2d1d28[_0xd856('0x6a')],'custom':_0x2d1d28[_0xd856('0x6b')],'options':_0x2d1d28[_0xd856('0x6c')][_0xd856('0x45')]>0x0?_[_0xd856('0x24')](_0x2d1d28[_0xd856('0x6c')],function(_0x493508){return{'name':_0x493508[_0xd856('0x6a')],'value':_0x493508[_0xd856('0x6d')]};}):_0x2d1d28[_0xd856('0x38')]==_0xd856('0x66')?[{'name':_0xd856('0x6e'),'value':_0xd856('0x6f')},{'name':_0xd856('0x70'),'value':_0xd856('0x71')}]:[]};})};}})['then'](respondWithResult(_0x4198a2,null))[_0xd856('0x3d')](function(_0x4f2c32){var _0x566386=_0x160f43[_0xd856('0x2a')][_0xd856('0x72')]?0x1f4:_0x4f2c32['statusCode']||0x1f4;logger[_0xd856('0x1f')](_0xd856('0x73'),_0xd856('0x74'),_0x566386,JSON[_0xd856('0x75')](_0x4f2c32));delete _0x4f2c32[_0xd856('0x21')];if(_0x566386===0x191){_0x566386=0x190;}_0x4198a2[_0xd856('0x13')](_0x566386)['send'](_0x160f43[_0xd856('0x2a')][_0xd856('0x72')]?{'message':_0xd856('0x76'),'statusCode':_0x4f2c32['statusCode']}:_0x4f2c32);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7d3764a..713b6e7 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 _0x00a6=['exports','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x00a6,0x1a5));var _0x600a=function(_0x2c2675,_0x23f98c){_0x2c2675=_0x2c2675-0x0;var _0x40d5a8=_0x00a6[_0x2c2675];return _0x40d5a8;};'use strict';var _=require('lodash');var util=require(_0x600a('0x0'));var logger=require(_0x600a('0x1'))(_0x600a('0x2'));var moment=require(_0x600a('0x3'));var BPromise=require('bluebird');var rp=require(_0x600a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x600a('0x5'));var config=require(_0x600a('0x6'));var attributes=require(_0x600a('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x600a('0x8')]=function(_0x5451ac,_0x144777){return _0x5451ac['define'](_0x600a('0x9'),attributes,{'tableName':_0x600a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0141=['moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','api'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x0141,0xbe));var _0x1014=function(_0x150e23,_0x4dde00){_0x150e23=_0x150e23-0x0;var _0x223954=_0x0141[_0x150e23];return _0x223954;};'use strict';var _=require('lodash');var util=require(_0x1014('0x0'));var logger=require('../../config/logger')(_0x1014('0x1'));var moment=require(_0x1014('0x2'));var BPromise=require('bluebird');var rp=require(_0x1014('0x3'));var fs=require('fs');var path=require(_0x1014('0x4'));var rimraf=require(_0x1014('0x5'));var config=require(_0x1014('0x6'));var attributes=require(_0x1014('0x7'));var integrations=require(_0x1014('0x8'));module['exports']=function(_0x17a985,_0x4bee95){return _0x17a985[_0x1014('0x9')](_0x1014('0xa'),attributes,{'tableName':_0x1014('0xb'),'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 61e5db3..855c32d 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 _0x099f=['options','raw','attributes','limit','include','model','map','stringify','ShowSalesforceAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','catch','GetSalesforceAccount','SalesforceAccount','findAll'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x099f,0x133));var _0xf099=function(_0x34d162,_0x334365){_0x34d162=_0x34d162-0x0;var _0x28cd0b=_0x099f[_0x34d162];return _0x28cd0b;};'use strict';var _=require(_0xf099('0x0'));var util=require(_0xf099('0x1'));var moment=require(_0xf099('0x2'));var BPromise=require(_0xf099('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf099('0x4'));var db=require(_0xf099('0x5'))['db'];var utils=require(_0xf099('0x6'));var logger=require(_0xf099('0x7'))(_0xf099('0x8'));var config=require(_0xf099('0x9'));var jayson=require(_0xf099('0xa'));var client=jayson['client'][_0xf099('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50284f,_0x11d863,_0x3afe56){return new BPromise(function(_0x5a3398,_0x1cff3d){return client[_0xf099('0xc')](_0x50284f,_0x3afe56)[_0xf099('0xd')](function(_0x34841c){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x11d863,_0xf099('0xe'));logger[_0xf099('0xf')](_0xf099('0x10'),_0x11d863,_0xf099('0xe'),JSON['stringify'](_0x34841c));if(_0x34841c[_0xf099('0x11')]){if(_0x34841c[_0xf099('0x11')][_0xf099('0x12')]===0x1f4){logger[_0xf099('0x11')](_0xf099('0x13'),_0x11d863,_0x34841c[_0xf099('0x11')][_0xf099('0x14')]);return _0x1cff3d(_0x34841c[_0xf099('0x11')]['message']);}logger['error'](_0xf099('0x13'),_0x11d863,_0x34841c['error'][_0xf099('0x14')]);return _0x5a3398(_0x34841c[_0xf099('0x11')]['message']);}else{logger[_0xf099('0x15')](_0xf099('0x13'),_0x11d863,_0xf099('0xe'));_0x5a3398(_0x34841c['result'][_0xf099('0x14')]);}})[_0xf099('0x16')](function(_0xbfca92){logger[_0xf099('0x11')](_0xf099('0x13'),_0x11d863,_0xbfca92);_0x1cff3d(_0xbfca92);});});}exports[_0xf099('0x17')]=function(_0x888905){var _0x3ffb67=this;return new Promise(function(_0x37c977,_0x4940b2){return db[_0xf099('0x18')][_0xf099('0x19')]({'raw':_0x888905['options']?_0x888905[_0xf099('0x1a')][_0xf099('0x1b')]===undefined?!![]:![]:!![],'where':_0x888905['options']?_0x888905[_0xf099('0x1a')]['where']||null:null,'attributes':_0x888905['options']?_0x888905[_0xf099('0x1a')][_0xf099('0x1c')]||null:null,'limit':_0x888905[_0xf099('0x1a')]?_0x888905[_0xf099('0x1a')][_0xf099('0x1d')]||null:null,'include':_0x888905[_0xf099('0x1a')]?_0x888905['options'][_0xf099('0x1e')]?_['map'](_0x888905[_0xf099('0x1a')][_0xf099('0x1e')],function(_0x41dae0){return{'model':db[_0x41dae0[_0xf099('0x1f')]],'as':_0x41dae0['as'],'attributes':_0x41dae0[_0xf099('0x1c')],'include':_0x41dae0[_0xf099('0x1e')]?_[_0xf099('0x20')](_0x41dae0[_0xf099('0x1e')],function(_0xca6e0e){return{'model':db[_0xca6e0e[_0xf099('0x1f')]],'as':_0xca6e0e['as'],'attributes':_0xca6e0e['attributes'],'include':_0xca6e0e[_0xf099('0x1e')]?_[_0xf099('0x20')](_0xca6e0e[_0xf099('0x1e')],function(_0x39804d){return{'model':db[_0x39804d['model']],'as':_0x39804d['as'],'attributes':_0x39804d[_0xf099('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2150da){logger[_0xf099('0x15')]('GetSalesforceAccount',_0x888905);logger[_0xf099('0xf')](_0xf099('0x17'),_0x888905,JSON[_0xf099('0x21')](_0x2150da));_0x37c977(_0x2150da);})[_0xf099('0x16')](function(_0x524892){logger[_0xf099('0x11')](_0xf099('0x17'),_0x524892[_0xf099('0x14')],_0x888905);_0x4940b2(_0x3ffb67[_0xf099('0x11')](0x1f4,_0x524892[_0xf099('0x14')]));});});};exports[_0xf099('0x22')]=function(_0x4f0d7f){var _0x5e597b=this;return new Promise(function(_0x162d41,_0x38dfac){return db[_0xf099('0x18')][_0xf099('0x23')]({'raw':_0x4f0d7f[_0xf099('0x1a')]?_0x4f0d7f[_0xf099('0x1a')][_0xf099('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f0d7f[_0xf099('0x1a')]?_0x4f0d7f[_0xf099('0x1a')][_0xf099('0x24')]||null:null,'attributes':_0x4f0d7f[_0xf099('0x1a')]?_0x4f0d7f[_0xf099('0x1a')][_0xf099('0x1c')]||null:null,'include':_0x4f0d7f[_0xf099('0x1a')]?_0x4f0d7f[_0xf099('0x1a')][_0xf099('0x1e')]?_[_0xf099('0x20')](_0x4f0d7f[_0xf099('0x1a')]['include'],function(_0x4dfcf1){return{'model':db[_0x4dfcf1['model']],'as':_0x4dfcf1['as'],'attributes':_0x4dfcf1[_0xf099('0x1c')],'include':_0x4dfcf1[_0xf099('0x1e')]?_['map'](_0x4dfcf1['include'],function(_0x4d6e46){return{'model':db[_0x4d6e46['model']],'as':_0x4d6e46['as'],'attributes':_0x4d6e46[_0xf099('0x1c')],'include':_0x4d6e46[_0xf099('0x1e')]?_[_0xf099('0x20')](_0x4d6e46[_0xf099('0x1e')],function(_0x4ee327){return{'model':db[_0x4ee327[_0xf099('0x1f')]],'as':_0x4ee327['as'],'attributes':_0x4ee327[_0xf099('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf099('0xd')](function(_0x48d1e3){logger[_0xf099('0x15')]('ShowSalesforceAccount',_0x4f0d7f);logger['debug'](_0xf099('0x22'),_0x4f0d7f,JSON[_0xf099('0x21')](_0x48d1e3));_0x162d41(_0x48d1e3);})['catch'](function(_0x180e91){logger[_0xf099('0x11')](_0xf099('0x22'),_0x180e91['message'],_0x4f0d7f);_0x38dfac(_0x5e597b[_0xf099('0x11')](0x1f4,_0x180e91[_0xf099('0x14')]));});});}; \ No newline at end of file +var _0xe1e8=['SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','include','model','attributes','info','ShowSalesforceAccount','find','raw','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2c396f,_0x5dbc3f){var _0x428792=function(_0x39681b){while(--_0x39681b){_0x2c396f['push'](_0x2c396f['shift']());}};_0x428792(++_0x5dbc3f);}(_0xe1e8,0x120));var _0x8e1e=function(_0x1c350b,_0x42da96){_0x1c350b=_0x1c350b-0x0;var _0x553563=_0xe1e8[_0x1c350b];return _0x553563;};'use strict';var _=require(_0x8e1e('0x0'));var util=require(_0x8e1e('0x1'));var moment=require(_0x8e1e('0x2'));var BPromise=require(_0x8e1e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1e('0x4'));var db=require(_0x8e1e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e1e('0x6'))('rpc');var config=require(_0x8e1e('0x7'));var jayson=require(_0x8e1e('0x8'));var client=jayson[_0x8e1e('0x9')][_0x8e1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12bfb7,_0x4126b0,_0x14b259){return new BPromise(function(_0x43edcd,_0x46fff8){return client['request'](_0x12bfb7,_0x14b259)[_0x8e1e('0xb')](function(_0x3041dd){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4126b0,_0x8e1e('0xc'));logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4126b0,'request\x20sent',JSON[_0x8e1e('0xf')](_0x3041dd));if(_0x3041dd[_0x8e1e('0x10')]){if(_0x3041dd['error'][_0x8e1e('0x11')]===0x1f4){logger[_0x8e1e('0x10')](_0x8e1e('0x12'),_0x4126b0,_0x3041dd[_0x8e1e('0x10')][_0x8e1e('0x13')]);return _0x46fff8(_0x3041dd[_0x8e1e('0x10')]['message']);}logger[_0x8e1e('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4126b0,_0x3041dd[_0x8e1e('0x10')]['message']);return _0x43edcd(_0x3041dd['error'][_0x8e1e('0x13')]);}else{logger['info'](_0x8e1e('0x12'),_0x4126b0,'request\x20sent');_0x43edcd(_0x3041dd[_0x8e1e('0x14')]['message']);}})[_0x8e1e('0x15')](function(_0x644689){logger[_0x8e1e('0x10')](_0x8e1e('0x12'),_0x4126b0,_0x644689);_0x46fff8(_0x644689);});});}exports[_0x8e1e('0x16')]=function(_0x236c54){var _0x58acab=this;return new Promise(function(_0x114c47,_0x43878e){return db[_0x8e1e('0x17')][_0x8e1e('0x18')]({'raw':_0x236c54[_0x8e1e('0x19')]?_0x236c54[_0x8e1e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x236c54[_0x8e1e('0x19')]?_0x236c54[_0x8e1e('0x19')]['where']||null:null,'attributes':_0x236c54[_0x8e1e('0x19')]?_0x236c54[_0x8e1e('0x19')]['attributes']||null:null,'limit':_0x236c54[_0x8e1e('0x19')]?_0x236c54['options']['limit']||null:null,'include':_0x236c54[_0x8e1e('0x19')]?_0x236c54[_0x8e1e('0x19')]['include']?_['map'](_0x236c54[_0x8e1e('0x19')][_0x8e1e('0x1a')],function(_0xb3e9c5){return{'model':db[_0xb3e9c5[_0x8e1e('0x1b')]],'as':_0xb3e9c5['as'],'attributes':_0xb3e9c5[_0x8e1e('0x1c')],'include':_0xb3e9c5['include']?_['map'](_0xb3e9c5[_0x8e1e('0x1a')],function(_0x26d4df){return{'model':db[_0x26d4df[_0x8e1e('0x1b')]],'as':_0x26d4df['as'],'attributes':_0x26d4df[_0x8e1e('0x1c')],'include':_0x26d4df['include']?_['map'](_0x26d4df[_0x8e1e('0x1a')],function(_0x1e031){return{'model':db[_0x1e031[_0x8e1e('0x1b')]],'as':_0x1e031['as'],'attributes':_0x1e031[_0x8e1e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f1403){logger[_0x8e1e('0x1d')](_0x8e1e('0x16'),_0x236c54);logger[_0x8e1e('0xd')](_0x8e1e('0x16'),_0x236c54,JSON['stringify'](_0x5f1403));_0x114c47(_0x5f1403);})['catch'](function(_0x1095c7){logger['error'](_0x8e1e('0x16'),_0x1095c7[_0x8e1e('0x13')],_0x236c54);_0x43878e(_0x58acab[_0x8e1e('0x10')](0x1f4,_0x1095c7[_0x8e1e('0x13')]));});});};exports[_0x8e1e('0x1e')]=function(_0x358eb8){var _0x136ff2=this;return new Promise(function(_0x525a88,_0x2a77b9){return db[_0x8e1e('0x17')][_0x8e1e('0x1f')]({'raw':_0x358eb8[_0x8e1e('0x19')]?_0x358eb8['options'][_0x8e1e('0x20')]===undefined?!![]:![]:!![],'where':_0x358eb8[_0x8e1e('0x19')]?_0x358eb8[_0x8e1e('0x19')]['where']||null:null,'attributes':_0x358eb8['options']?_0x358eb8[_0x8e1e('0x19')]['attributes']||null:null,'include':_0x358eb8[_0x8e1e('0x19')]?_0x358eb8[_0x8e1e('0x19')][_0x8e1e('0x1a')]?_[_0x8e1e('0x21')](_0x358eb8[_0x8e1e('0x19')][_0x8e1e('0x1a')],function(_0x55fa45){return{'model':db[_0x55fa45[_0x8e1e('0x1b')]],'as':_0x55fa45['as'],'attributes':_0x55fa45['attributes'],'include':_0x55fa45[_0x8e1e('0x1a')]?_[_0x8e1e('0x21')](_0x55fa45['include'],function(_0x273f64){return{'model':db[_0x273f64[_0x8e1e('0x1b')]],'as':_0x273f64['as'],'attributes':_0x273f64[_0x8e1e('0x1c')],'include':_0x273f64['include']?_[_0x8e1e('0x21')](_0x273f64[_0x8e1e('0x1a')],function(_0x3c6ef8){return{'model':db[_0x3c6ef8['model']],'as':_0x3c6ef8['as'],'attributes':_0x3c6ef8['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e1e('0xb')](function(_0x581316){logger[_0x8e1e('0x1d')]('ShowSalesforceAccount',_0x358eb8);logger[_0x8e1e('0xd')](_0x8e1e('0x1e'),_0x358eb8,JSON[_0x8e1e('0xf')](_0x581316));_0x525a88(_0x581316);})[_0x8e1e('0x15')](function(_0x3519a1){logger[_0x8e1e('0x10')](_0x8e1e('0x1e'),_0x3519a1['message'],_0x358eb8);_0x2a77b9(_0x136ff2[_0x8e1e('0x10')](0x1f4,_0x3519a1[_0x8e1e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 45116a9..1fc99af 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xdb28,0x106));var _0x8db2=function(_0x40be00,_0x1f42b0){_0x40be00=_0x40be00-0x0;var _0x339832=_0xdb28[_0x40be00];return _0x339832;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +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(_0x586a7d,_0x1a6de1){var _0x35ae5e=function(_0xadb804){while(--_0xadb804){_0x586a7d['push'](_0x586a7d['shift']());}};_0x35ae5e(++_0x1a6de1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 917ea62..0f112af 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 _0xd242=['contact_lead','contact','lead','account','nothing','sequelize','exports','STRING','ENUM','Task'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd242,0x127));var _0x2d24=function(_0x2201e1,_0x50ba88){_0x2201e1=_0x2201e1-0x0;var _0x5a063f=_0xd242[_0x2201e1];return _0x5a063f;};'use strict';var Sequelize=require(_0x2d24('0x0'));module[_0x2d24('0x1')]={'name':{'type':Sequelize[_0x2d24('0x2')]},'description':{'type':Sequelize[_0x2d24('0x2')]},'ticketType':{'type':Sequelize[_0x2d24('0x3')](_0x2d24('0x4'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x2d24('0x3')](_0x2d24('0x5'),_0x2d24('0x6'),_0x2d24('0x7'),'account_contact_lead',_0x2d24('0x8')),'defaultValue':_0x2d24('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x2d24('0x9'),_0x2d24('0x6'),_0x2d24('0x7'),_0x2d24('0x8')),'defaultValue':_0x2d24('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x2d24('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x2d24('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x2d24('0x2')]}}; \ No newline at end of file +var _0x38ba=['sequelize','exports','STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead','account','nothing'];(function(_0xa41818,_0x346292){var _0x2e8ae6=function(_0x5b895f){while(--_0x5b895f){_0xa41818['push'](_0xa41818['shift']());}};_0x2e8ae6(++_0x346292);}(_0x38ba,0x134));var _0xa38b=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x38ba[_0x553a87];return _0x12d1e6;};'use strict';var Sequelize=require(_0xa38b('0x0'));module[_0xa38b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa38b('0x2')]},'ticketType':{'type':Sequelize[_0xa38b('0x3')](_0xa38b('0x4'),'Case'),'defaultValue':_0xa38b('0x4')},'moduleSearch':{'type':Sequelize[_0xa38b('0x3')](_0xa38b('0x5'),_0xa38b('0x6'),_0xa38b('0x7'),_0xa38b('0x8'),_0xa38b('0x9')),'defaultValue':_0xa38b('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0xa38b('0xa'),'contact',_0xa38b('0x7'),_0xa38b('0x9')),'defaultValue':_0xa38b('0x7')},'leadId':{'type':Sequelize[_0xa38b('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xa38b('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xa38b('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xa38b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 004ca35..1729779 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 _0x8e84=['moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','SalesforceConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','fields','options','find','create','body','params','getFields','findOne','SalesforceField','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x455cca,_0x2bc1ff){var _0x18a951=function(_0x3d52ef){while(--_0x3d52ef){_0x455cca['push'](_0x455cca['shift']());}};_0x18a951(++_0x2bc1ff);}(_0x8e84,0x195));var _0x48e8=function(_0x1b2eee,_0x16186b){_0x1b2eee=_0x1b2eee-0x0;var _0x3e4241=_0x8e84[_0x1b2eee];return _0x3e4241;};'use strict';var emlformat=require(_0x48e8('0x0'));var rimraf=require(_0x48e8('0x1'));var zipdir=require(_0x48e8('0x2'));var jsonpatch=require(_0x48e8('0x3'));var rp=require(_0x48e8('0x4'));var moment=require(_0x48e8('0x5'));var BPromise=require(_0x48e8('0x6'));var Mustache=require('mustache');var util=require(_0x48e8('0x7'));var path=require(_0x48e8('0x8'));var sox=require(_0x48e8('0x9'));var csv=require(_0x48e8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48e8('0xb'));var squel=require(_0x48e8('0xc'));var crypto=require(_0x48e8('0xd'));var jsforce=require(_0x48e8('0xe'));var deskjs=require(_0x48e8('0xf'));var toCsv=require(_0x48e8('0xa'));var querystring=require(_0x48e8('0x10'));var Papa=require('papaparse');var Redis=require(_0x48e8('0x11'));var authService=require(_0x48e8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x48e8('0x13'));var hardwareService=require(_0x48e8('0x14'));var logger=require(_0x48e8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x48e8('0x16'));var licenseUtil=require(_0x48e8('0x17'));var db=require(_0x48e8('0x18'))['db'];function respondWithStatusCode(_0xe04513,_0xa03418){_0xa03418=_0xa03418||0xcc;return function(_0x515810){if(_0x515810){return _0xe04513[_0x48e8('0x19')](_0xa03418);}return _0xe04513[_0x48e8('0x1a')](_0xa03418)[_0x48e8('0x1b')]();};}function respondWithResult(_0x146777,_0x1c009f){_0x1c009f=_0x1c009f||0xc8;return function(_0x368f10){if(_0x368f10){return _0x146777['status'](_0x1c009f)[_0x48e8('0x1c')](_0x368f10);}};}function respondWithFilteredResult(_0x3ac7a4,_0x537f3f){return function(_0x2b1c20){if(_0x2b1c20){var _0x6176fb=typeof _0x537f3f[_0x48e8('0x1d')]===_0x48e8('0x1e')&&typeof _0x537f3f[_0x48e8('0x1f')]===_0x48e8('0x1e');var _0x4032d3=_0x2b1c20[_0x48e8('0x20')];var _0x14c487=_0x6176fb?0x0:_0x537f3f[_0x48e8('0x1d')];var _0x3c17c2=_0x6176fb?_0x2b1c20['count']:_0x537f3f[_0x48e8('0x1d')]+_0x537f3f['limit'];var _0x230ad8;if(_0x3c17c2>=_0x4032d3){_0x3c17c2=_0x4032d3;_0x230ad8=0xc8;}else{_0x230ad8=0xce;}_0x3ac7a4['status'](_0x230ad8);return _0x3ac7a4[_0x48e8('0x21')](_0x48e8('0x22'),_0x14c487+'-'+_0x3c17c2+'/'+_0x4032d3)['json'](_0x2b1c20);}return null;};}function patchUpdates(_0x57feb6){return function(_0x439f92){try{jsonpatch[_0x48e8('0x23')](_0x439f92,_0x57feb6,!![]);}catch(_0x5813a4){return BPromise['reject'](_0x5813a4);}return _0x439f92[_0x48e8('0x24')]();};}function saveUpdates(_0x187046,_0x2f059c){return function(_0x35885b){if(_0x35885b){return _0x35885b[_0x48e8('0x25')](_0x187046)['then'](function(_0x117939){return _0x117939;});}return null;};}function removeEntity(_0x35ca9d,_0x299e5d){return function(_0x2898b5){if(_0x2898b5){return _0x2898b5[_0x48e8('0x26')]()[_0x48e8('0x27')](function(){_0x35ca9d['status'](0xcc)[_0x48e8('0x1b')]();});}};}function handleEntityNotFound(_0x6f83d6,_0x4219cc){return function(_0x59f94e){if(!_0x59f94e){_0x6f83d6[_0x48e8('0x19')](0x194);}return _0x59f94e;};}function handleError(_0xb1477e,_0x3d7278){_0x3d7278=_0x3d7278||0x1f4;return function(_0x2167b9){logger['error'](_0x2167b9[_0x48e8('0x28')]);if(_0x2167b9[_0x48e8('0x29')]){delete _0x2167b9[_0x48e8('0x29')];}_0xb1477e[_0x48e8('0x1a')](_0x3d7278)[_0x48e8('0x2a')](_0x2167b9);};}exports[_0x48e8('0x2b')]=function(_0x6fd97,_0x143c8a){var _0x7ab316={},_0x5e1ce7={},_0x190887={'count':0x0,'rows':[]};var _0x1c3a70=_['map'](db[_0x48e8('0x2c')][_0x48e8('0x2d')],function(_0x2e9999){return{'name':_0x2e9999['fieldName'],'type':_0x2e9999[_0x48e8('0x2e')][_0x48e8('0x2f')]};});_0x5e1ce7[_0x48e8('0x30')]=_[_0x48e8('0x31')](_0x1c3a70,_0x48e8('0x29'));_0x5e1ce7[_0x48e8('0x32')]=_[_0x48e8('0x33')](_0x6fd97[_0x48e8('0x32')]);_0x5e1ce7[_0x48e8('0x34')]=_[_0x48e8('0x35')](_0x5e1ce7['model'],_0x5e1ce7['query']);_0x7ab316[_0x48e8('0x36')]=_[_0x48e8('0x35')](_0x5e1ce7[_0x48e8('0x30')],qs['fields'](_0x6fd97['query']['fields']));_0x7ab316[_0x48e8('0x36')]=_0x7ab316['attributes'][_0x48e8('0x37')]?_0x7ab316['attributes']:_0x5e1ce7[_0x48e8('0x30')];if(!_0x6fd97[_0x48e8('0x32')][_0x48e8('0x38')](_0x48e8('0x39'))){_0x7ab316[_0x48e8('0x1f')]=qs['limit'](_0x6fd97['query'][_0x48e8('0x1f')]);_0x7ab316[_0x48e8('0x1d')]=qs[_0x48e8('0x1d')](_0x6fd97[_0x48e8('0x32')][_0x48e8('0x1d')]);}_0x7ab316[_0x48e8('0x3a')]=qs[_0x48e8('0x3b')](_0x6fd97[_0x48e8('0x32')][_0x48e8('0x3b')]);_0x7ab316[_0x48e8('0x3c')]=qs[_0x48e8('0x34')](_[_0x48e8('0x3d')](_0x6fd97['query'],_0x5e1ce7[_0x48e8('0x34')]),_0x1c3a70);if(_0x6fd97[_0x48e8('0x32')]['filter']){_0x7ab316['where']=_[_0x48e8('0x3e')](_0x7ab316[_0x48e8('0x3c')],{'$or':_[_0x48e8('0x31')](_0x1c3a70,function(_0x5ae378){if(_0x5ae378[_0x48e8('0x2e')]!==_0x48e8('0x3f')){var _0xb2eba6={};_0xb2eba6[_0x5ae378['name']]={'$like':'%'+_0x6fd97[_0x48e8('0x32')]['filter']+'%'};return _0xb2eba6;}})});}_0x7ab316=_[_0x48e8('0x3e')]({},_0x7ab316,_0x6fd97['options']);var _0x350ea3={'where':_0x7ab316[_0x48e8('0x3c')]};return db['SalesforceConfiguration'][_0x48e8('0x20')](_0x350ea3)[_0x48e8('0x27')](function(_0x461623){_0x190887[_0x48e8('0x20')]=_0x461623;if(_0x6fd97[_0x48e8('0x32')][_0x48e8('0x40')]){_0x7ab316[_0x48e8('0x41')]=[{'all':!![]}];}return db[_0x48e8('0x2c')][_0x48e8('0x42')](_0x7ab316);})[_0x48e8('0x27')](function(_0x47d75f){_0x190887[_0x48e8('0x43')]=_0x47d75f;return _0x190887;})[_0x48e8('0x27')](respondWithFilteredResult(_0x143c8a,_0x7ab316))[_0x48e8('0x44')](handleError(_0x143c8a,null));};exports[_0x48e8('0x45')]=function(_0x399742,_0x46ab82){var _0x52a412={'raw':![],'where':{'id':_0x399742['params']['id']}},_0x1b0412={};_0x1b0412['model']=_[_0x48e8('0x33')](db['SalesforceConfiguration'][_0x48e8('0x2d')]);_0x1b0412[_0x48e8('0x32')]=_[_0x48e8('0x33')](_0x399742['query']);_0x1b0412['filters']=_['intersection'](_0x1b0412[_0x48e8('0x30')],_0x1b0412[_0x48e8('0x32')]);_0x52a412['attributes']=_[_0x48e8('0x35')](_0x1b0412['model'],qs[_0x48e8('0x46')](_0x399742['query']['fields']));_0x52a412[_0x48e8('0x36')]=_0x52a412[_0x48e8('0x36')][_0x48e8('0x37')]?_0x52a412['attributes']:_0x1b0412[_0x48e8('0x30')];if(_0x399742[_0x48e8('0x32')]['includeAll']){_0x52a412['include']=[{'all':!![]}];}_0x52a412=_['merge']({},_0x52a412,_0x399742[_0x48e8('0x47')]);return db['SalesforceConfiguration'][_0x48e8('0x48')](_0x52a412)[_0x48e8('0x27')](handleEntityNotFound(_0x46ab82,null))[_0x48e8('0x27')](respondWithResult(_0x46ab82,null))[_0x48e8('0x44')](handleError(_0x46ab82,null));};exports[_0x48e8('0x49')]=function(_0x5805e1,_0x35b709){return db[_0x48e8('0x2c')][_0x48e8('0x49')](_0x5805e1[_0x48e8('0x4a')],{})[_0x48e8('0x27')](respondWithResult(_0x35b709,0xc9))[_0x48e8('0x44')](handleError(_0x35b709,null));};exports[_0x48e8('0x25')]=function(_0x24bec6,_0x253aec){if(_0x24bec6['body']['id']){delete _0x24bec6[_0x48e8('0x4a')]['id'];}return db[_0x48e8('0x2c')]['find']({'where':{'id':_0x24bec6['params']['id']}})[_0x48e8('0x27')](handleEntityNotFound(_0x253aec,null))['then'](saveUpdates(_0x24bec6[_0x48e8('0x4a')],null))[_0x48e8('0x27')](respondWithResult(_0x253aec,null))['catch'](handleError(_0x253aec,null));};exports[_0x48e8('0x26')]=function(_0x5548b2,_0x3868a2){return db[_0x48e8('0x2c')][_0x48e8('0x48')]({'where':{'id':_0x5548b2[_0x48e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3868a2,null))[_0x48e8('0x27')](removeEntity(_0x3868a2,null))[_0x48e8('0x44')](handleError(_0x3868a2,null));};exports[_0x48e8('0x4c')]=function(_0x5b2ed3,_0x2a0e3c,_0x276838){var _0x620230={};var _0x511ad4={};var _0x2da276;var _0x35b29b;return db[_0x48e8('0x2c')][_0x48e8('0x4d')]({'where':{'id':_0x5b2ed3[_0x48e8('0x4b')]['id']}})[_0x48e8('0x27')](handleEntityNotFound(_0x2a0e3c,null))[_0x48e8('0x27')](function(_0x1be6cb){if(_0x1be6cb){_0x2da276=_0x1be6cb;_0x511ad4[_0x48e8('0x30')]=_[_0x48e8('0x33')](db[_0x48e8('0x4e')][_0x48e8('0x2d')]);_0x511ad4[_0x48e8('0x32')]=_[_0x48e8('0x33')](_0x5b2ed3[_0x48e8('0x32')]);_0x511ad4[_0x48e8('0x34')]=_[_0x48e8('0x35')](_0x511ad4[_0x48e8('0x30')],_0x511ad4[_0x48e8('0x32')]);_0x620230[_0x48e8('0x36')]=_[_0x48e8('0x35')](_0x511ad4[_0x48e8('0x30')],qs['fields'](_0x5b2ed3[_0x48e8('0x32')][_0x48e8('0x46')]));_0x620230[_0x48e8('0x36')]=_0x620230[_0x48e8('0x36')]['length']?_0x620230[_0x48e8('0x36')]:_0x511ad4['model'];_0x620230[_0x48e8('0x3a')]=qs[_0x48e8('0x3b')](_0x5b2ed3[_0x48e8('0x32')][_0x48e8('0x3b')]);_0x620230[_0x48e8('0x3c')]=qs[_0x48e8('0x34')](_[_0x48e8('0x3d')](_0x5b2ed3[_0x48e8('0x32')],_0x511ad4['filters']));if(_0x5b2ed3[_0x48e8('0x32')][_0x48e8('0x4f')]){_0x620230['where']=_[_0x48e8('0x3e')](_0x620230[_0x48e8('0x3c')],{'$or':_[_0x48e8('0x31')](_0x620230[_0x48e8('0x36')],function(_0x363da1){var _0x4f5981={};_0x4f5981[_0x363da1]={'$like':'%'+_0x5b2ed3['query'][_0x48e8('0x4f')]+'%'};return _0x4f5981;})});}_0x620230=_[_0x48e8('0x3e')]({},_0x620230,_0x5b2ed3[_0x48e8('0x47')]);return _0x2da276['getFields'](_0x620230);}})[_0x48e8('0x27')](function(_0x5c1a1c){if(_0x5c1a1c){_0x35b29b=_0x5c1a1c[_0x48e8('0x37')];if(!_0x5b2ed3['query']['hasOwnProperty'](_0x48e8('0x39'))){_0x620230[_0x48e8('0x1f')]=qs[_0x48e8('0x1f')](_0x5b2ed3[_0x48e8('0x32')][_0x48e8('0x1f')]);_0x620230[_0x48e8('0x1d')]=qs[_0x48e8('0x1d')](_0x5b2ed3[_0x48e8('0x32')][_0x48e8('0x1d')]);}return _0x2da276[_0x48e8('0x4c')](_0x620230);}})[_0x48e8('0x27')](function(_0xa10efa){if(_0xa10efa){return _0xa10efa?{'count':_0x35b29b,'rows':_0xa10efa}:null;}})[_0x48e8('0x27')](respondWithResult(_0x2a0e3c,null))['catch'](handleError(_0x2a0e3c,null));};exports['getSubjects']=function(_0x279463,_0x4c47f5,_0x2e9eaf){var _0x3b7dc4={};var _0x42723b={};var _0x4b5b8d;var _0x4ca859;return db[_0x48e8('0x2c')]['findOne']({'where':{'id':_0x279463[_0x48e8('0x4b')]['id']}})[_0x48e8('0x27')](handleEntityNotFound(_0x4c47f5,null))['then'](function(_0x389f4c){if(_0x389f4c){_0x4b5b8d=_0x389f4c;_0x42723b['model']=_['keys'](db[_0x48e8('0x4e')]['rawAttributes']);_0x42723b[_0x48e8('0x32')]=_[_0x48e8('0x33')](_0x279463[_0x48e8('0x32')]);_0x42723b[_0x48e8('0x34')]=_[_0x48e8('0x35')](_0x42723b[_0x48e8('0x30')],_0x42723b['query']);_0x3b7dc4[_0x48e8('0x36')]=_[_0x48e8('0x35')](_0x42723b[_0x48e8('0x30')],qs[_0x48e8('0x46')](_0x279463[_0x48e8('0x32')][_0x48e8('0x46')]));_0x3b7dc4[_0x48e8('0x36')]=_0x3b7dc4['attributes'][_0x48e8('0x37')]?_0x3b7dc4[_0x48e8('0x36')]:_0x42723b['model'];_0x3b7dc4[_0x48e8('0x3a')]=qs[_0x48e8('0x3b')](_0x279463[_0x48e8('0x32')][_0x48e8('0x3b')]);_0x3b7dc4[_0x48e8('0x3c')]=qs[_0x48e8('0x34')](_['pick'](_0x279463['query'],_0x42723b[_0x48e8('0x34')]));if(_0x279463[_0x48e8('0x32')][_0x48e8('0x4f')]){_0x3b7dc4[_0x48e8('0x3c')]=_[_0x48e8('0x3e')](_0x3b7dc4[_0x48e8('0x3c')],{'$or':_[_0x48e8('0x31')](_0x3b7dc4['attributes'],function(_0x3cc127){var _0x2cd093={};_0x2cd093[_0x3cc127]={'$like':'%'+_0x279463[_0x48e8('0x32')][_0x48e8('0x4f')]+'%'};return _0x2cd093;})});}_0x3b7dc4=_['merge']({},_0x3b7dc4,_0x279463[_0x48e8('0x47')]);return _0x4b5b8d[_0x48e8('0x50')](_0x3b7dc4);}})[_0x48e8('0x27')](function(_0x16a4aa){if(_0x16a4aa){_0x4ca859=_0x16a4aa[_0x48e8('0x37')];if(!_0x279463[_0x48e8('0x32')]['hasOwnProperty']('nolimit')){_0x3b7dc4[_0x48e8('0x1f')]=qs[_0x48e8('0x1f')](_0x279463[_0x48e8('0x32')]['limit']);_0x3b7dc4[_0x48e8('0x1d')]=qs[_0x48e8('0x1d')](_0x279463[_0x48e8('0x32')]['offset']);}return _0x4b5b8d[_0x48e8('0x50')](_0x3b7dc4);}})[_0x48e8('0x27')](function(_0x389ddb){if(_0x389ddb){return _0x389ddb?{'count':_0x4ca859,'rows':_0x389ddb}:null;}})['then'](respondWithResult(_0x4c47f5,null))[_0x48e8('0x44')](handleError(_0x4c47f5,null));};exports[_0x48e8('0x51')]=function(_0x544c8a,_0x251847,_0x121a9f){var _0x3da972={};var _0x37f70e={};var _0x302528;var _0x33d24c;return db[_0x48e8('0x2c')][_0x48e8('0x4d')]({'where':{'id':_0x544c8a[_0x48e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x251847,null))[_0x48e8('0x27')](function(_0x10a62d){if(_0x10a62d){_0x302528=_0x10a62d;_0x37f70e['model']=_[_0x48e8('0x33')](db[_0x48e8('0x4e')]['rawAttributes']);_0x37f70e[_0x48e8('0x32')]=_[_0x48e8('0x33')](_0x544c8a[_0x48e8('0x32')]);_0x37f70e[_0x48e8('0x34')]=_[_0x48e8('0x35')](_0x37f70e['model'],_0x37f70e[_0x48e8('0x32')]);_0x3da972['attributes']=_[_0x48e8('0x35')](_0x37f70e[_0x48e8('0x30')],qs[_0x48e8('0x46')](_0x544c8a[_0x48e8('0x32')][_0x48e8('0x46')]));_0x3da972[_0x48e8('0x36')]=_0x3da972[_0x48e8('0x36')][_0x48e8('0x37')]?_0x3da972[_0x48e8('0x36')]:_0x37f70e[_0x48e8('0x30')];_0x3da972[_0x48e8('0x3a')]=qs[_0x48e8('0x3b')](_0x544c8a[_0x48e8('0x32')][_0x48e8('0x3b')]);_0x3da972[_0x48e8('0x3c')]=qs[_0x48e8('0x34')](_[_0x48e8('0x3d')](_0x544c8a['query'],_0x37f70e[_0x48e8('0x34')]));if(_0x544c8a['query'][_0x48e8('0x4f')]){_0x3da972[_0x48e8('0x3c')]=_['merge'](_0x3da972['where'],{'$or':_[_0x48e8('0x31')](_0x3da972['attributes'],function(_0x2e8505){var _0x260507={};_0x260507[_0x2e8505]={'$like':'%'+_0x544c8a['query']['filter']+'%'};return _0x260507;})});}_0x3da972=_[_0x48e8('0x3e')]({},_0x3da972,_0x544c8a['options']);return _0x302528[_0x48e8('0x51')](_0x3da972);}})[_0x48e8('0x27')](function(_0x55872b){if(_0x55872b){_0x33d24c=_0x55872b[_0x48e8('0x37')];if(!_0x544c8a['query']['hasOwnProperty'](_0x48e8('0x39'))){_0x3da972[_0x48e8('0x1f')]=qs['limit'](_0x544c8a[_0x48e8('0x32')][_0x48e8('0x1f')]);_0x3da972[_0x48e8('0x1d')]=qs['offset'](_0x544c8a[_0x48e8('0x32')][_0x48e8('0x1d')]);}return _0x302528[_0x48e8('0x51')](_0x3da972);}})[_0x48e8('0x27')](function(_0x483c21){if(_0x483c21){return _0x483c21?{'count':_0x33d24c,'rows':_0x483c21}:null;}})[_0x48e8('0x27')](respondWithResult(_0x251847,null))[_0x48e8('0x44')](handleError(_0x251847,null));}; \ No newline at end of file +var _0x992d=['rawAttributes','merge','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','include','SalesforceConfiguration','rows','catch','show','params','includeAll','find','create','body','destroy','getFields','findOne','SalesforceField'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x992d,0xa9));var _0xd992=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x992d[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xd992('0x0'));var rimraf=require(_0xd992('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd992('0x2'));var rp=require(_0xd992('0x3'));var moment=require(_0xd992('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd992('0x5'));var path=require(_0xd992('0x6'));var sox=require(_0xd992('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd992('0x8'));var _=require('lodash');var squel=require(_0xd992('0x9'));var crypto=require(_0xd992('0xa'));var jsforce=require(_0xd992('0xb'));var deskjs=require(_0xd992('0xc'));var toCsv=require(_0xd992('0xd'));var querystring=require('querystring');var Papa=require(_0xd992('0xe'));var Redis=require(_0xd992('0xf'));var authService=require(_0xd992('0x10'));var qs=require(_0xd992('0x11'));var as=require(_0xd992('0x12'));var hardwareService=require(_0xd992('0x13'));var logger=require(_0xd992('0x14'))(_0xd992('0x15'));var utils=require(_0xd992('0x16'));var config=require(_0xd992('0x17'));var licenseUtil=require(_0xd992('0x18'));var db=require(_0xd992('0x19'))['db'];function respondWithStatusCode(_0x1f9b10,_0x368bd8){_0x368bd8=_0x368bd8||0xcc;return function(_0x29c184){if(_0x29c184){return _0x1f9b10[_0xd992('0x1a')](_0x368bd8);}return _0x1f9b10[_0xd992('0x1b')](_0x368bd8)[_0xd992('0x1c')]();};}function respondWithResult(_0x45c82e,_0x1f6eca){_0x1f6eca=_0x1f6eca||0xc8;return function(_0x9f4762){if(_0x9f4762){return _0x45c82e[_0xd992('0x1b')](_0x1f6eca)[_0xd992('0x1d')](_0x9f4762);}};}function respondWithFilteredResult(_0x41c979,_0x2ef4da){return function(_0x398c6b){if(_0x398c6b){var _0x22b23f=typeof _0x2ef4da['offset']===_0xd992('0x1e')&&typeof _0x2ef4da[_0xd992('0x1f')]===_0xd992('0x1e');var _0x4b8172=_0x398c6b['count'];var _0x5d6699=_0x22b23f?0x0:_0x2ef4da[_0xd992('0x20')];var _0x15f294=_0x22b23f?_0x398c6b['count']:_0x2ef4da[_0xd992('0x20')]+_0x2ef4da[_0xd992('0x1f')];var _0x694c7b;if(_0x15f294>=_0x4b8172){_0x15f294=_0x4b8172;_0x694c7b=0xc8;}else{_0x694c7b=0xce;}_0x41c979[_0xd992('0x1b')](_0x694c7b);return _0x41c979[_0xd992('0x21')](_0xd992('0x22'),_0x5d6699+'-'+_0x15f294+'/'+_0x4b8172)[_0xd992('0x1d')](_0x398c6b);}return null;};}function patchUpdates(_0x285b86){return function(_0x2b9108){try{jsonpatch[_0xd992('0x23')](_0x2b9108,_0x285b86,!![]);}catch(_0x4e6edf){return BPromise[_0xd992('0x24')](_0x4e6edf);}return _0x2b9108[_0xd992('0x25')]();};}function saveUpdates(_0x16a517,_0x17dbf5){return function(_0x5cdcd5){if(_0x5cdcd5){return _0x5cdcd5[_0xd992('0x26')](_0x16a517)[_0xd992('0x27')](function(_0xe60955){return _0xe60955;});}return null;};}function removeEntity(_0x34732c,_0x1c2d26){return function(_0x381518){if(_0x381518){return _0x381518['destroy']()[_0xd992('0x27')](function(){_0x34732c[_0xd992('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d3f5d,_0x24db0c){return function(_0x146cc0){if(!_0x146cc0){_0x3d3f5d[_0xd992('0x1a')](0x194);}return _0x146cc0;};}function handleError(_0x5e3e60,_0x460da5){_0x460da5=_0x460da5||0x1f4;return function(_0x4fbe55){logger['error'](_0x4fbe55[_0xd992('0x28')]);if(_0x4fbe55['name']){delete _0x4fbe55['name'];}_0x5e3e60[_0xd992('0x1b')](_0x460da5)[_0xd992('0x29')](_0x4fbe55);};}exports[_0xd992('0x2a')]=function(_0x31e068,_0x139169){var _0xf8e0b1={},_0x30bfe0={},_0x440c67={'count':0x0,'rows':[]};var _0xd68117=_[_0xd992('0x2b')](db['SalesforceConfiguration']['rawAttributes'],function(_0x3611a4){return{'name':_0x3611a4['fieldName'],'type':_0x3611a4['type'][_0xd992('0x2c')]};});_0x30bfe0[_0xd992('0x2d')]=_['map'](_0xd68117,_0xd992('0x2e'));_0x30bfe0[_0xd992('0x2f')]=_[_0xd992('0x30')](_0x31e068['query']);_0x30bfe0[_0xd992('0x31')]=_['intersection'](_0x30bfe0[_0xd992('0x2d')],_0x30bfe0['query']);_0xf8e0b1[_0xd992('0x32')]=_[_0xd992('0x33')](_0x30bfe0['model'],qs[_0xd992('0x34')](_0x31e068['query'][_0xd992('0x34')]));_0xf8e0b1[_0xd992('0x32')]=_0xf8e0b1['attributes'][_0xd992('0x35')]?_0xf8e0b1[_0xd992('0x32')]:_0x30bfe0[_0xd992('0x2d')];if(!_0x31e068['query'][_0xd992('0x36')]('nolimit')){_0xf8e0b1[_0xd992('0x1f')]=qs['limit'](_0x31e068[_0xd992('0x2f')][_0xd992('0x1f')]);_0xf8e0b1[_0xd992('0x20')]=qs[_0xd992('0x20')](_0x31e068[_0xd992('0x2f')][_0xd992('0x20')]);}_0xf8e0b1[_0xd992('0x37')]=qs['sort'](_0x31e068['query'][_0xd992('0x38')]);_0xf8e0b1[_0xd992('0x39')]=qs[_0xd992('0x31')](_[_0xd992('0x3a')](_0x31e068[_0xd992('0x2f')],_0x30bfe0['filters']),_0xd68117);if(_0x31e068['query'][_0xd992('0x3b')]){_0xf8e0b1[_0xd992('0x39')]=_['merge'](_0xf8e0b1[_0xd992('0x39')],{'$or':_[_0xd992('0x2b')](_0xd68117,function(_0x20bde3){if(_0x20bde3[_0xd992('0x3c')]!==_0xd992('0x3d')){var _0x49aa97={};_0x49aa97[_0x20bde3['name']]={'$like':'%'+_0x31e068[_0xd992('0x2f')][_0xd992('0x3b')]+'%'};return _0x49aa97;}})});}_0xf8e0b1=_['merge']({},_0xf8e0b1,_0x31e068[_0xd992('0x3e')]);var _0x26e6b1={'where':_0xf8e0b1['where']};return db['SalesforceConfiguration']['count'](_0x26e6b1)[_0xd992('0x27')](function(_0x3f29d9){_0x440c67['count']=_0x3f29d9;if(_0x31e068[_0xd992('0x2f')]['includeAll']){_0xf8e0b1[_0xd992('0x3f')]=[{'all':!![]}];}return db[_0xd992('0x40')]['findAll'](_0xf8e0b1);})[_0xd992('0x27')](function(_0x1ea98f){_0x440c67[_0xd992('0x41')]=_0x1ea98f;return _0x440c67;})['then'](respondWithFilteredResult(_0x139169,_0xf8e0b1))[_0xd992('0x42')](handleError(_0x139169,null));};exports[_0xd992('0x43')]=function(_0x33d4cf,_0x38c27f){var _0x2459ee={'raw':![],'where':{'id':_0x33d4cf[_0xd992('0x44')]['id']}},_0xa19229={};_0xa19229[_0xd992('0x2d')]=_[_0xd992('0x30')](db[_0xd992('0x40')]['rawAttributes']);_0xa19229[_0xd992('0x2f')]=_[_0xd992('0x30')](_0x33d4cf[_0xd992('0x2f')]);_0xa19229['filters']=_[_0xd992('0x33')](_0xa19229[_0xd992('0x2d')],_0xa19229[_0xd992('0x2f')]);_0x2459ee[_0xd992('0x32')]=_[_0xd992('0x33')](_0xa19229[_0xd992('0x2d')],qs['fields'](_0x33d4cf[_0xd992('0x2f')][_0xd992('0x34')]));_0x2459ee[_0xd992('0x32')]=_0x2459ee['attributes'][_0xd992('0x35')]?_0x2459ee[_0xd992('0x32')]:_0xa19229[_0xd992('0x2d')];if(_0x33d4cf[_0xd992('0x2f')][_0xd992('0x45')]){_0x2459ee[_0xd992('0x3f')]=[{'all':!![]}];}_0x2459ee=_['merge']({},_0x2459ee,_0x33d4cf[_0xd992('0x3e')]);return db[_0xd992('0x40')][_0xd992('0x46')](_0x2459ee)[_0xd992('0x27')](handleEntityNotFound(_0x38c27f,null))['then'](respondWithResult(_0x38c27f,null))['catch'](handleError(_0x38c27f,null));};exports[_0xd992('0x47')]=function(_0x5c969d,_0x193354){return db[_0xd992('0x40')][_0xd992('0x47')](_0x5c969d[_0xd992('0x48')],{})[_0xd992('0x27')](respondWithResult(_0x193354,0xc9))[_0xd992('0x42')](handleError(_0x193354,null));};exports[_0xd992('0x26')]=function(_0x249816,_0x418b1f){if(_0x249816['body']['id']){delete _0x249816[_0xd992('0x48')]['id'];}return db[_0xd992('0x40')][_0xd992('0x46')]({'where':{'id':_0x249816['params']['id']}})[_0xd992('0x27')](handleEntityNotFound(_0x418b1f,null))[_0xd992('0x27')](saveUpdates(_0x249816[_0xd992('0x48')],null))[_0xd992('0x27')](respondWithResult(_0x418b1f,null))['catch'](handleError(_0x418b1f,null));};exports[_0xd992('0x49')]=function(_0x191bd3,_0x56b085){return db[_0xd992('0x40')]['find']({'where':{'id':_0x191bd3[_0xd992('0x44')]['id']}})['then'](handleEntityNotFound(_0x56b085,null))[_0xd992('0x27')](removeEntity(_0x56b085,null))['catch'](handleError(_0x56b085,null));};exports[_0xd992('0x4a')]=function(_0x4f2af0,_0x13c77,_0xd88153){var _0xebc15={};var _0x51c522={};var _0x338428;var _0x59f1d4;return db['SalesforceConfiguration'][_0xd992('0x4b')]({'where':{'id':_0x4f2af0['params']['id']}})['then'](handleEntityNotFound(_0x13c77,null))[_0xd992('0x27')](function(_0x15a270){if(_0x15a270){_0x338428=_0x15a270;_0x51c522['model']=_[_0xd992('0x30')](db[_0xd992('0x4c')][_0xd992('0x4d')]);_0x51c522[_0xd992('0x2f')]=_[_0xd992('0x30')](_0x4f2af0[_0xd992('0x2f')]);_0x51c522[_0xd992('0x31')]=_[_0xd992('0x33')](_0x51c522[_0xd992('0x2d')],_0x51c522['query']);_0xebc15[_0xd992('0x32')]=_[_0xd992('0x33')](_0x51c522[_0xd992('0x2d')],qs[_0xd992('0x34')](_0x4f2af0[_0xd992('0x2f')][_0xd992('0x34')]));_0xebc15['attributes']=_0xebc15['attributes']['length']?_0xebc15['attributes']:_0x51c522[_0xd992('0x2d')];_0xebc15[_0xd992('0x37')]=qs[_0xd992('0x38')](_0x4f2af0[_0xd992('0x2f')][_0xd992('0x38')]);_0xebc15[_0xd992('0x39')]=qs[_0xd992('0x31')](_[_0xd992('0x3a')](_0x4f2af0[_0xd992('0x2f')],_0x51c522[_0xd992('0x31')]));if(_0x4f2af0['query'][_0xd992('0x3b')]){_0xebc15[_0xd992('0x39')]=_[_0xd992('0x4e')](_0xebc15[_0xd992('0x39')],{'$or':_[_0xd992('0x2b')](_0xebc15[_0xd992('0x32')],function(_0x4fe3f1){var _0x70ace={};_0x70ace[_0x4fe3f1]={'$like':'%'+_0x4f2af0[_0xd992('0x2f')][_0xd992('0x3b')]+'%'};return _0x70ace;})});}_0xebc15=_[_0xd992('0x4e')]({},_0xebc15,_0x4f2af0[_0xd992('0x3e')]);return _0x338428[_0xd992('0x4a')](_0xebc15);}})[_0xd992('0x27')](function(_0xe8f340){if(_0xe8f340){_0x59f1d4=_0xe8f340['length'];if(!_0x4f2af0[_0xd992('0x2f')][_0xd992('0x36')](_0xd992('0x4f'))){_0xebc15[_0xd992('0x1f')]=qs[_0xd992('0x1f')](_0x4f2af0[_0xd992('0x2f')]['limit']);_0xebc15[_0xd992('0x20')]=qs[_0xd992('0x20')](_0x4f2af0[_0xd992('0x2f')][_0xd992('0x20')]);}return _0x338428['getFields'](_0xebc15);}})[_0xd992('0x27')](function(_0x156dca){if(_0x156dca){return _0x156dca?{'count':_0x59f1d4,'rows':_0x156dca}:null;}})[_0xd992('0x27')](respondWithResult(_0x13c77,null))[_0xd992('0x42')](handleError(_0x13c77,null));};exports[_0xd992('0x50')]=function(_0x2b783b,_0x1ef1d7,_0x361589){var _0x4114fa={};var _0x1483a0={};var _0x5f07fb;var _0x573fec;return db['SalesforceConfiguration'][_0xd992('0x4b')]({'where':{'id':_0x2b783b[_0xd992('0x44')]['id']}})[_0xd992('0x27')](handleEntityNotFound(_0x1ef1d7,null))[_0xd992('0x27')](function(_0x58e91a){if(_0x58e91a){_0x5f07fb=_0x58e91a;_0x1483a0[_0xd992('0x2d')]=_[_0xd992('0x30')](db[_0xd992('0x4c')][_0xd992('0x4d')]);_0x1483a0['query']=_[_0xd992('0x30')](_0x2b783b[_0xd992('0x2f')]);_0x1483a0[_0xd992('0x31')]=_['intersection'](_0x1483a0['model'],_0x1483a0[_0xd992('0x2f')]);_0x4114fa[_0xd992('0x32')]=_[_0xd992('0x33')](_0x1483a0['model'],qs[_0xd992('0x34')](_0x2b783b['query'][_0xd992('0x34')]));_0x4114fa[_0xd992('0x32')]=_0x4114fa[_0xd992('0x32')][_0xd992('0x35')]?_0x4114fa['attributes']:_0x1483a0[_0xd992('0x2d')];_0x4114fa[_0xd992('0x37')]=qs['sort'](_0x2b783b[_0xd992('0x2f')][_0xd992('0x38')]);_0x4114fa['where']=qs[_0xd992('0x31')](_['pick'](_0x2b783b[_0xd992('0x2f')],_0x1483a0[_0xd992('0x31')]));if(_0x2b783b[_0xd992('0x2f')][_0xd992('0x3b')]){_0x4114fa[_0xd992('0x39')]=_['merge'](_0x4114fa[_0xd992('0x39')],{'$or':_[_0xd992('0x2b')](_0x4114fa['attributes'],function(_0x2e6fcc){var _0x57b152={};_0x57b152[_0x2e6fcc]={'$like':'%'+_0x2b783b['query'][_0xd992('0x3b')]+'%'};return _0x57b152;})});}_0x4114fa=_['merge']({},_0x4114fa,_0x2b783b['options']);return _0x5f07fb[_0xd992('0x50')](_0x4114fa);}})[_0xd992('0x27')](function(_0x2ee9bf){if(_0x2ee9bf){_0x573fec=_0x2ee9bf[_0xd992('0x35')];if(!_0x2b783b['query']['hasOwnProperty'](_0xd992('0x4f'))){_0x4114fa['limit']=qs[_0xd992('0x1f')](_0x2b783b[_0xd992('0x2f')]['limit']);_0x4114fa[_0xd992('0x20')]=qs[_0xd992('0x20')](_0x2b783b[_0xd992('0x2f')]['offset']);}return _0x5f07fb['getSubjects'](_0x4114fa);}})['then'](function(_0x4594d4){if(_0x4594d4){return _0x4594d4?{'count':_0x573fec,'rows':_0x4594d4}:null;}})[_0xd992('0x27')](respondWithResult(_0x1ef1d7,null))[_0xd992('0x42')](handleError(_0x1ef1d7,null));};exports[_0xd992('0x51')]=function(_0x3add99,_0x32fc80,_0x4d468c){var _0x725293={};var _0x59726b={};var _0x5664d5;var _0x4c9e47;return db[_0xd992('0x40')]['findOne']({'where':{'id':_0x3add99[_0xd992('0x44')]['id']}})[_0xd992('0x27')](handleEntityNotFound(_0x32fc80,null))[_0xd992('0x27')](function(_0x3d98c6){if(_0x3d98c6){_0x5664d5=_0x3d98c6;_0x59726b[_0xd992('0x2d')]=_[_0xd992('0x30')](db[_0xd992('0x4c')][_0xd992('0x4d')]);_0x59726b[_0xd992('0x2f')]=_[_0xd992('0x30')](_0x3add99[_0xd992('0x2f')]);_0x59726b[_0xd992('0x31')]=_[_0xd992('0x33')](_0x59726b[_0xd992('0x2d')],_0x59726b[_0xd992('0x2f')]);_0x725293[_0xd992('0x32')]=_['intersection'](_0x59726b[_0xd992('0x2d')],qs[_0xd992('0x34')](_0x3add99[_0xd992('0x2f')][_0xd992('0x34')]));_0x725293[_0xd992('0x32')]=_0x725293['attributes']['length']?_0x725293[_0xd992('0x32')]:_0x59726b['model'];_0x725293[_0xd992('0x37')]=qs['sort'](_0x3add99[_0xd992('0x2f')][_0xd992('0x38')]);_0x725293[_0xd992('0x39')]=qs[_0xd992('0x31')](_[_0xd992('0x3a')](_0x3add99['query'],_0x59726b[_0xd992('0x31')]));if(_0x3add99[_0xd992('0x2f')][_0xd992('0x3b')]){_0x725293[_0xd992('0x39')]=_[_0xd992('0x4e')](_0x725293['where'],{'$or':_[_0xd992('0x2b')](_0x725293[_0xd992('0x32')],function(_0x130de6){var _0x3a8ab6={};_0x3a8ab6[_0x130de6]={'$like':'%'+_0x3add99[_0xd992('0x2f')][_0xd992('0x3b')]+'%'};return _0x3a8ab6;})});}_0x725293=_[_0xd992('0x4e')]({},_0x725293,_0x3add99[_0xd992('0x3e')]);return _0x5664d5['getDescriptions'](_0x725293);}})[_0xd992('0x27')](function(_0x272771){if(_0x272771){_0x4c9e47=_0x272771[_0xd992('0x35')];if(!_0x3add99['query']['hasOwnProperty']('nolimit')){_0x725293['limit']=qs['limit'](_0x3add99[_0xd992('0x2f')][_0xd992('0x1f')]);_0x725293['offset']=qs['offset'](_0x3add99[_0xd992('0x2f')]['offset']);}return _0x5664d5[_0xd992('0x51')](_0x725293);}})[_0xd992('0x27')](function(_0xa8374c){if(_0xa8374c){return _0xa8374c?{'count':_0x4c9e47,'rows':_0xa8374c}:null;}})['then'](respondWithResult(_0x32fc80,null))[_0xd992('0x42')](handleError(_0x32fc80,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6e02708..cbf1415 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 _0x584b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x584b,0x9a));var _0xb584=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x584b[_0x2718c7];return _0x59d89c;};'use strict';var _=require(_0xb584('0x0'));var util=require('util');var logger=require(_0xb584('0x1'))(_0xb584('0x2'));var moment=require(_0xb584('0x3'));var BPromise=require(_0xb584('0x4'));var rp=require(_0xb584('0x5'));var fs=require('fs');var path=require(_0xb584('0x6'));var rimraf=require('rimraf');var config=require(_0xb584('0x7'));var attributes=require(_0xb584('0x8'));module[_0xb584('0x9')]=function(_0x1b60ef,_0x5a803f){return _0x1b60ef[_0xb584('0xa')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8425=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x11b1c3,_0x47f38c){var _0x35aaf7=function(_0x416dda){while(--_0x416dda){_0x11b1c3['push'](_0x11b1c3['shift']());}};_0x35aaf7(++_0x47f38c);}(_0x8425,0xf9));var _0x5842=function(_0x14d499,_0x4dba66){_0x14d499=_0x14d499-0x0;var _0x1ac8d9=_0x8425[_0x14d499];return _0x1ac8d9;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var logger=require(_0x5842('0x2'))(_0x5842('0x3'));var moment=require(_0x5842('0x4'));var BPromise=require(_0x5842('0x5'));var rp=require(_0x5842('0x6'));var fs=require('fs');var path=require(_0x5842('0x7'));var rimraf=require(_0x5842('0x8'));var config=require(_0x5842('0x9'));var attributes=require(_0x5842('0xa'));module[_0x5842('0xb')]=function(_0x449f09,_0x2f6e6c){return _0x449f09[_0x5842('0xc')](_0x5842('0xd'),attributes,{'tableName':_0x5842('0xe'),'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 a2a617f..1fd5d5c 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 _0xcb69=['code','message','error','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3927dc,_0x29107f){var _0x521192=function(_0x33b881){while(--_0x33b881){_0x3927dc['push'](_0x3927dc['shift']());}};_0x521192(++_0x29107f);}(_0xcb69,0x10e));var _0x9cb6=function(_0x20d357,_0x3e11a4){_0x20d357=_0x20d357-0x0;var _0x1380d7=_0xcb69[_0x20d357];return _0x1380d7;};'use strict';var _=require(_0x9cb6('0x0'));var util=require(_0x9cb6('0x1'));var moment=require('moment');var BPromise=require(_0x9cb6('0x2'));var rs=require(_0x9cb6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cb6('0x4'))['db'];var utils=require(_0x9cb6('0x5'));var logger=require('../../config/logger')(_0x9cb6('0x6'));var config=require('../../config/environment');var jayson=require(_0x9cb6('0x7'));var client=jayson[_0x9cb6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5a7e,_0x54a441,_0x169a0f){return new BPromise(function(_0x31c884,_0x206ac5){return client['request'](_0x1e5a7e,_0x169a0f)[_0x9cb6('0x9')](function(_0x1dd335){logger[_0x9cb6('0xa')](_0x9cb6('0xb'),_0x54a441,_0x9cb6('0xc'));logger[_0x9cb6('0xd')](_0x9cb6('0xe'),_0x54a441,_0x9cb6('0xc'),JSON['stringify'](_0x1dd335));if(_0x1dd335['error']){if(_0x1dd335['error'][_0x9cb6('0xf')]===0x1f4){logger['error'](_0x9cb6('0xb'),_0x54a441,_0x1dd335['error'][_0x9cb6('0x10')]);return _0x206ac5(_0x1dd335[_0x9cb6('0x11')][_0x9cb6('0x10')]);}logger[_0x9cb6('0x11')](_0x9cb6('0xb'),_0x54a441,_0x1dd335[_0x9cb6('0x11')][_0x9cb6('0x10')]);return _0x31c884(_0x1dd335[_0x9cb6('0x11')][_0x9cb6('0x10')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x54a441,'request\x20sent');_0x31c884(_0x1dd335[_0x9cb6('0x12')]['message']);}})['catch'](function(_0x23a595){logger[_0x9cb6('0x11')](_0x9cb6('0xb'),_0x54a441,_0x23a595);_0x206ac5(_0x23a595);});});} \ No newline at end of file +var _0x10ee=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2985f5,_0x5913c0){var _0x4962a2=function(_0x2c8f7b){while(--_0x2c8f7b){_0x2985f5['push'](_0x2985f5['shift']());}};_0x4962a2(++_0x5913c0);}(_0x10ee,0x1a6));var _0xe10e=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x10ee[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xe10e('0x0'));var util=require(_0xe10e('0x1'));var moment=require(_0xe10e('0x2'));var BPromise=require('bluebird');var rs=require(_0xe10e('0x3'));var fs=require('fs');var Redis=require(_0xe10e('0x4'));var db=require(_0xe10e('0x5'))['db'];var utils=require(_0xe10e('0x6'));var logger=require(_0xe10e('0x7'))(_0xe10e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe10e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x212c02,_0x536cc9,_0x4f345c){return new BPromise(function(_0x4b2c82,_0x184dca){return client[_0xe10e('0xa')](_0x212c02,_0x4f345c)[_0xe10e('0xb')](function(_0x184e99){logger[_0xe10e('0xc')](_0xe10e('0xd'),_0x536cc9,_0xe10e('0xe'));logger[_0xe10e('0xf')](_0xe10e('0x10'),_0x536cc9,_0xe10e('0xe'),JSON[_0xe10e('0x11')](_0x184e99));if(_0x184e99[_0xe10e('0x12')]){if(_0x184e99[_0xe10e('0x12')]['code']===0x1f4){logger['error'](_0xe10e('0xd'),_0x536cc9,_0x184e99[_0xe10e('0x12')][_0xe10e('0x13')]);return _0x184dca(_0x184e99[_0xe10e('0x12')]['message']);}logger[_0xe10e('0x12')](_0xe10e('0xd'),_0x536cc9,_0x184e99[_0xe10e('0x12')][_0xe10e('0x13')]);return _0x4b2c82(_0x184e99[_0xe10e('0x12')][_0xe10e('0x13')]);}else{logger[_0xe10e('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x536cc9,_0xe10e('0xe'));_0x4b2c82(_0x184e99[_0xe10e('0x14')][_0xe10e('0x13')]);}})['catch'](function(_0x20621){logger['error'](_0xe10e('0xd'),_0x536cc9,_0x20621);_0x184dca(_0x20621);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b84800c..f6a82fc 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 _0xd031=['../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xd031,0x174));var _0x1d03=function(_0x48cfa5,_0x12a52f){_0x48cfa5=_0x48cfa5-0x0;var _0x5e67f9=_0xd031[_0x48cfa5];return _0x5e67f9;};'use strict';var multer=require(_0x1d03('0x0'));var util=require(_0x1d03('0x1'));var path=require(_0x1d03('0x2'));var timeout=require(_0x1d03('0x3'));var express=require(_0x1d03('0x4'));var router=express[_0x1d03('0x5')]();var fs_extra=require(_0x1d03('0x6'));var auth=require(_0x1d03('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1d03('0x8'));var controller=require(_0x1d03('0x9'));router['get']('/',auth[_0x1d03('0xa')](),controller[_0x1d03('0xb')]);router[_0x1d03('0xc')](_0x1d03('0xd'),auth[_0x1d03('0xa')](),controller[_0x1d03('0xe')]);router[_0x1d03('0xf')]('/',auth[_0x1d03('0xa')](),controller[_0x1d03('0x10')]);router['put'](_0x1d03('0xd'),auth[_0x1d03('0xa')](),controller[_0x1d03('0x11')]);router['delete'](_0x1d03('0xd'),auth[_0x1d03('0xa')](),controller[_0x1d03('0x12')]);module['exports']=router; \ No newline at end of file +var _0x156b=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','post','create','update'];(function(_0xe1388e,_0xb9ecd1){var _0x44ecfa=function(_0x5c07b4){while(--_0x5c07b4){_0xe1388e['push'](_0xe1388e['shift']());}};_0x44ecfa(++_0xb9ecd1);}(_0x156b,0x162));var _0xb156=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x156b[_0xa60623];return _0x4a6487;};'use strict';var multer=require(_0xb156('0x0'));var util=require('util');var path=require(_0xb156('0x1'));var timeout=require(_0xb156('0x2'));var express=require(_0xb156('0x3'));var router=express[_0xb156('0x4')]();var fs_extra=require(_0xb156('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb156('0x6'));var controller=require(_0xb156('0x7'));router[_0xb156('0x8')]('/',auth[_0xb156('0x9')](),controller['index']);router['get'](_0xb156('0xa'),auth[_0xb156('0x9')](),controller['show']);router[_0xb156('0xb')]('/',auth[_0xb156('0x9')](),controller[_0xb156('0xc')]);router['put'](_0xb156('0xa'),auth[_0xb156('0x9')](),controller[_0xb156('0xd')]);router['delete'](_0xb156('0xa'),auth[_0xb156('0x9')](),controller[_0xb156('0xe')]);module[_0xb156('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 23ffddd..f50a150 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 _0x6264=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x9b4cda,_0x206ec1){var _0x1ac6c5=function(_0x4ba0a3){while(--_0x4ba0a3){_0x9b4cda['push'](_0x9b4cda['shift']());}};_0x1ac6c5(++_0x206ec1);}(_0x6264,0x9c));var _0x4626=function(_0x11539d,_0x2b3499){_0x11539d=_0x11539d-0x0;var _0x43e15e=_0x6264[_0x11539d];return _0x43e15e;};'use strict';var Sequelize=require(_0x4626('0x0'));module[_0x4626('0x1')]={'type':{'type':Sequelize[_0x4626('0x2')](_0x4626('0x3'),_0x4626('0x4'),_0x4626('0x5'),_0x4626('0x6'),_0x4626('0x7')),'defaultValue':_0x4626('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4626('0x8')]},'keyType':{'type':Sequelize[_0x4626('0x2')](_0x4626('0x3'),_0x4626('0x4'),_0x4626('0x5'))},'keyContent':{'type':Sequelize[_0x4626('0x8')]},'idField':{'type':Sequelize[_0x4626('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8f19=['sequelize','exports','string','variable','picklist','STRING','ENUM','customVariable'];(function(_0x263b4c,_0x2820bf){var _0x149bb1=function(_0x259670){while(--_0x259670){_0x263b4c['push'](_0x263b4c['shift']());}};_0x149bb1(++_0x2820bf);}(_0x8f19,0xc8));var _0x98f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f19[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x98f1('0x0'));module[_0x98f1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x98f1('0x2'),_0x98f1('0x3'),'customVariable','keyValue',_0x98f1('0x4')),'defaultValue':_0x98f1('0x2')},'content':{'type':Sequelize[_0x98f1('0x5')]},'key':{'type':Sequelize[_0x98f1('0x5')]},'keyType':{'type':Sequelize[_0x98f1('0x6')](_0x98f1('0x2'),'variable',_0x98f1('0x7'))},'keyContent':{'type':Sequelize[_0x98f1('0x5')]},'idField':{'type':Sequelize[_0x98f1('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 45cf994..135d1a6 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 _0xb1ef=['offset','undefined','limit','count','reject','save','update','then','error','stack','name','send','map','SalesforceField','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','intersection','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x127f1d,_0x324b39){var _0x35017b=function(_0x57b551){while(--_0x57b551){_0x127f1d['push'](_0x127f1d['shift']());}};_0x35017b(++_0x324b39);}(_0xb1ef,0x71));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xfb1e('0x0'));var rimraf=require(_0xfb1e('0x1'));var zipdir=require(_0xfb1e('0x2'));var jsonpatch=require(_0xfb1e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfb1e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfb1e('0x5'));var sox=require(_0xfb1e('0x6'));var csv=require('to-csv');var ejs=require(_0xfb1e('0x7'));var fs=require('fs');var fs_extra=require(_0xfb1e('0x8'));var _=require(_0xfb1e('0x9'));var squel=require(_0xfb1e('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb1e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfb1e('0xc'));var querystring=require(_0xfb1e('0xd'));var Papa=require(_0xfb1e('0xe'));var Redis=require(_0xfb1e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfb1e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb1e('0x11'));var logger=require(_0xfb1e('0x12'))(_0xfb1e('0x13'));var utils=require('../../config/utils');var config=require(_0xfb1e('0x14'));var licenseUtil=require(_0xfb1e('0x15'));var db=require(_0xfb1e('0x16'))['db'];function respondWithStatusCode(_0xe3fffd,_0x9c888){_0x9c888=_0x9c888||0xcc;return function(_0x35d9fc){if(_0x35d9fc){return _0xe3fffd[_0xfb1e('0x17')](_0x9c888);}return _0xe3fffd[_0xfb1e('0x18')](_0x9c888)[_0xfb1e('0x19')]();};}function respondWithResult(_0x41fa5b,_0x336474){_0x336474=_0x336474||0xc8;return function(_0xb480ec){if(_0xb480ec){return _0x41fa5b[_0xfb1e('0x18')](_0x336474)[_0xfb1e('0x1a')](_0xb480ec);}};}function respondWithFilteredResult(_0x4adb71,_0x1753a0){return function(_0x197796){if(_0x197796){var _0x30c74b=typeof _0x1753a0[_0xfb1e('0x1b')]===_0xfb1e('0x1c')&&typeof _0x1753a0[_0xfb1e('0x1d')]===_0xfb1e('0x1c');var _0x4bc7c7=_0x197796[_0xfb1e('0x1e')];var _0x1906d0=_0x30c74b?0x0:_0x1753a0[_0xfb1e('0x1b')];var _0x153c6b=_0x30c74b?_0x197796['count']:_0x1753a0['offset']+_0x1753a0[_0xfb1e('0x1d')];var _0x38d622;if(_0x153c6b>=_0x4bc7c7){_0x153c6b=_0x4bc7c7;_0x38d622=0xc8;}else{_0x38d622=0xce;}_0x4adb71[_0xfb1e('0x18')](_0x38d622);return _0x4adb71['set']('Content-Range',_0x1906d0+'-'+_0x153c6b+'/'+_0x4bc7c7)[_0xfb1e('0x1a')](_0x197796);}return null;};}function patchUpdates(_0x4a51ca){return function(_0x5492cd){try{jsonpatch['apply'](_0x5492cd,_0x4a51ca,!![]);}catch(_0x9141cb){return BPromise[_0xfb1e('0x1f')](_0x9141cb);}return _0x5492cd[_0xfb1e('0x20')]();};}function saveUpdates(_0x7ea8e,_0x2e579f){return function(_0x26072d){if(_0x26072d){return _0x26072d[_0xfb1e('0x21')](_0x7ea8e)[_0xfb1e('0x22')](function(_0x1fd4da){return _0x1fd4da;});}return null;};}function removeEntity(_0x217121,_0x35d0d3){return function(_0x59d31d){if(_0x59d31d){return _0x59d31d['destroy']()[_0xfb1e('0x22')](function(){_0x217121[_0xfb1e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dd99d,_0x4ab9d6){return function(_0x5acc67){if(!_0x5acc67){_0x3dd99d[_0xfb1e('0x17')](0x194);}return _0x5acc67;};}function handleError(_0x5b7310,_0x4219fa){_0x4219fa=_0x4219fa||0x1f4;return function(_0x314842){logger[_0xfb1e('0x23')](_0x314842[_0xfb1e('0x24')]);if(_0x314842[_0xfb1e('0x25')]){delete _0x314842[_0xfb1e('0x25')];}_0x5b7310['status'](_0x4219fa)[_0xfb1e('0x26')](_0x314842);};}exports['index']=function(_0x42bcfa,_0x24d0e8){var _0x5ea643={},_0x28eac6={},_0x1218bf={'count':0x0,'rows':[]};var _0x1ca46d=_[_0xfb1e('0x27')](db[_0xfb1e('0x28')]['rawAttributes'],function(_0xbf9b01){return{'name':_0xbf9b01['fieldName'],'type':_0xbf9b01[_0xfb1e('0x29')][_0xfb1e('0x2a')]};});_0x28eac6[_0xfb1e('0x2b')]=_[_0xfb1e('0x27')](_0x1ca46d,'name');_0x28eac6[_0xfb1e('0x2c')]=_[_0xfb1e('0x2d')](_0x42bcfa[_0xfb1e('0x2c')]);_0x28eac6[_0xfb1e('0x2e')]=_['intersection'](_0x28eac6[_0xfb1e('0x2b')],_0x28eac6[_0xfb1e('0x2c')]);_0x5ea643[_0xfb1e('0x2f')]=_['intersection'](_0x28eac6[_0xfb1e('0x2b')],qs[_0xfb1e('0x30')](_0x42bcfa['query'][_0xfb1e('0x30')]));_0x5ea643['attributes']=_0x5ea643[_0xfb1e('0x2f')]['length']?_0x5ea643['attributes']:_0x28eac6[_0xfb1e('0x2b')];if(!_0x42bcfa[_0xfb1e('0x2c')][_0xfb1e('0x31')]('nolimit')){_0x5ea643[_0xfb1e('0x1d')]=qs[_0xfb1e('0x1d')](_0x42bcfa[_0xfb1e('0x2c')][_0xfb1e('0x1d')]);_0x5ea643[_0xfb1e('0x1b')]=qs[_0xfb1e('0x1b')](_0x42bcfa[_0xfb1e('0x2c')][_0xfb1e('0x1b')]);}_0x5ea643['order']=qs[_0xfb1e('0x32')](_0x42bcfa[_0xfb1e('0x2c')][_0xfb1e('0x32')]);_0x5ea643[_0xfb1e('0x33')]=qs[_0xfb1e('0x2e')](_[_0xfb1e('0x34')](_0x42bcfa[_0xfb1e('0x2c')],_0x28eac6['filters']),_0x1ca46d);if(_0x42bcfa[_0xfb1e('0x2c')][_0xfb1e('0x35')]){_0x5ea643[_0xfb1e('0x33')]=_[_0xfb1e('0x36')](_0x5ea643[_0xfb1e('0x33')],{'$or':_[_0xfb1e('0x27')](_0x1ca46d,function(_0x15bb36){if(_0x15bb36[_0xfb1e('0x29')]!==_0xfb1e('0x37')){var _0x3fbb08={};_0x3fbb08[_0x15bb36[_0xfb1e('0x25')]]={'$like':'%'+_0x42bcfa[_0xfb1e('0x2c')]['filter']+'%'};return _0x3fbb08;}})});}_0x5ea643=_['merge']({},_0x5ea643,_0x42bcfa[_0xfb1e('0x38')]);var _0x22ff9c={'where':_0x5ea643[_0xfb1e('0x33')]};return db[_0xfb1e('0x28')][_0xfb1e('0x1e')](_0x22ff9c)['then'](function(_0x56e429){_0x1218bf['count']=_0x56e429;if(_0x42bcfa[_0xfb1e('0x2c')]['includeAll']){_0x5ea643[_0xfb1e('0x39')]=[{'all':!![]}];}return db[_0xfb1e('0x28')][_0xfb1e('0x3a')](_0x5ea643);})['then'](function(_0x3dcaa7){_0x1218bf[_0xfb1e('0x3b')]=_0x3dcaa7;return _0x1218bf;})[_0xfb1e('0x22')](respondWithFilteredResult(_0x24d0e8,_0x5ea643))[_0xfb1e('0x3c')](handleError(_0x24d0e8,null));};exports['show']=function(_0x5b8811,_0x6518fc){var _0x6c8126={'raw':!![],'where':{'id':_0x5b8811[_0xfb1e('0x3d')]['id']}},_0x1e0117={};_0x1e0117['model']=_['keys'](db[_0xfb1e('0x28')][_0xfb1e('0x3e')]);_0x1e0117['query']=_[_0xfb1e('0x2d')](_0x5b8811[_0xfb1e('0x2c')]);_0x1e0117['filters']=_[_0xfb1e('0x3f')](_0x1e0117[_0xfb1e('0x2b')],_0x1e0117[_0xfb1e('0x2c')]);_0x6c8126[_0xfb1e('0x2f')]=_[_0xfb1e('0x3f')](_0x1e0117[_0xfb1e('0x2b')],qs['fields'](_0x5b8811[_0xfb1e('0x2c')]['fields']));_0x6c8126[_0xfb1e('0x2f')]=_0x6c8126[_0xfb1e('0x2f')][_0xfb1e('0x40')]?_0x6c8126[_0xfb1e('0x2f')]:_0x1e0117[_0xfb1e('0x2b')];if(_0x5b8811[_0xfb1e('0x2c')][_0xfb1e('0x41')]){_0x6c8126[_0xfb1e('0x39')]=[{'all':!![]}];}_0x6c8126=_[_0xfb1e('0x36')]({},_0x6c8126,_0x5b8811['options']);return db[_0xfb1e('0x28')][_0xfb1e('0x42')](_0x6c8126)[_0xfb1e('0x22')](handleEntityNotFound(_0x6518fc,null))[_0xfb1e('0x22')](respondWithResult(_0x6518fc,null))[_0xfb1e('0x3c')](handleError(_0x6518fc,null));};exports['create']=function(_0x53a0d0,_0x970488){return db[_0xfb1e('0x28')][_0xfb1e('0x43')](_0x53a0d0[_0xfb1e('0x44')],{})[_0xfb1e('0x22')](respondWithResult(_0x970488,0xc9))['catch'](handleError(_0x970488,null));};exports[_0xfb1e('0x21')]=function(_0x2e0a6b,_0x169da3){if(_0x2e0a6b['body']['id']){delete _0x2e0a6b[_0xfb1e('0x44')]['id'];}return db[_0xfb1e('0x28')][_0xfb1e('0x42')]({'where':{'id':_0x2e0a6b['params']['id']}})[_0xfb1e('0x22')](handleEntityNotFound(_0x169da3,null))[_0xfb1e('0x22')](saveUpdates(_0x2e0a6b['body'],null))[_0xfb1e('0x22')](respondWithResult(_0x169da3,null))[_0xfb1e('0x3c')](handleError(_0x169da3,null));};exports[_0xfb1e('0x45')]=function(_0x19d99b,_0x1415f7){return db['SalesforceField'][_0xfb1e('0x42')]({'where':{'id':_0x19d99b[_0xfb1e('0x3d')]['id']}})[_0xfb1e('0x22')](handleEntityNotFound(_0x1415f7,null))['then'](removeEntity(_0x1415f7,null))[_0xfb1e('0x3c')](handleError(_0x1415f7,null));}; \ No newline at end of file +var _0x14d7=['SalesforceField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','findAll','catch','show','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x14d7,0x194));var _0x714d=function(_0x9ae685,_0x2c6652){_0x9ae685=_0x9ae685-0x0;var _0x4c492e=_0x14d7[_0x9ae685];return _0x4c492e;};'use strict';var emlformat=require(_0x714d('0x0'));var rimraf=require(_0x714d('0x1'));var zipdir=require(_0x714d('0x2'));var jsonpatch=require(_0x714d('0x3'));var rp=require(_0x714d('0x4'));var moment=require(_0x714d('0x5'));var BPromise=require(_0x714d('0x6'));var Mustache=require(_0x714d('0x7'));var util=require(_0x714d('0x8'));var path=require(_0x714d('0x9'));var sox=require(_0x714d('0xa'));var csv=require(_0x714d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x714d('0xc'));var _=require('lodash');var squel=require(_0x714d('0xd'));var crypto=require(_0x714d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x714d('0xf'));var toCsv=require(_0x714d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x714d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x714d('0x11'));var as=require(_0x714d('0x12'));var hardwareService=require(_0x714d('0x13'));var logger=require('../../config/logger')(_0x714d('0x14'));var utils=require(_0x714d('0x15'));var config=require(_0x714d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x714d('0x17'))['db'];function respondWithStatusCode(_0xb1e28d,_0x17e70f){_0x17e70f=_0x17e70f||0xcc;return function(_0x463ecd){if(_0x463ecd){return _0xb1e28d[_0x714d('0x18')](_0x17e70f);}return _0xb1e28d[_0x714d('0x19')](_0x17e70f)['end']();};}function respondWithResult(_0x37c866,_0x588ff4){_0x588ff4=_0x588ff4||0xc8;return function(_0x54b86b){if(_0x54b86b){return _0x37c866[_0x714d('0x19')](_0x588ff4)[_0x714d('0x1a')](_0x54b86b);}};}function respondWithFilteredResult(_0x5df1c7,_0x221167){return function(_0x1c3817){if(_0x1c3817){var _0xe725f3=typeof _0x221167['offset']==='undefined'&&typeof _0x221167[_0x714d('0x1b')]===_0x714d('0x1c');var _0x1b28df=_0x1c3817[_0x714d('0x1d')];var _0x1bb618=_0xe725f3?0x0:_0x221167[_0x714d('0x1e')];var _0x374661=_0xe725f3?_0x1c3817[_0x714d('0x1d')]:_0x221167[_0x714d('0x1e')]+_0x221167[_0x714d('0x1b')];var _0x575bf7;if(_0x374661>=_0x1b28df){_0x374661=_0x1b28df;_0x575bf7=0xc8;}else{_0x575bf7=0xce;}_0x5df1c7[_0x714d('0x19')](_0x575bf7);return _0x5df1c7[_0x714d('0x1f')](_0x714d('0x20'),_0x1bb618+'-'+_0x374661+'/'+_0x1b28df)[_0x714d('0x1a')](_0x1c3817);}return null;};}function patchUpdates(_0x4419ac){return function(_0x6981bd){try{jsonpatch[_0x714d('0x21')](_0x6981bd,_0x4419ac,!![]);}catch(_0x32120f){return BPromise[_0x714d('0x22')](_0x32120f);}return _0x6981bd[_0x714d('0x23')]();};}function saveUpdates(_0x5910ac,_0xad7e73){return function(_0x13b31f){if(_0x13b31f){return _0x13b31f[_0x714d('0x24')](_0x5910ac)[_0x714d('0x25')](function(_0xa35ba3){return _0xa35ba3;});}return null;};}function removeEntity(_0x286de4,_0x387352){return function(_0x384af0){if(_0x384af0){return _0x384af0[_0x714d('0x26')]()['then'](function(){_0x286de4['status'](0xcc)[_0x714d('0x27')]();});}};}function handleEntityNotFound(_0x298dd7,_0x1545ec){return function(_0x53c7ed){if(!_0x53c7ed){_0x298dd7[_0x714d('0x18')](0x194);}return _0x53c7ed;};}function handleError(_0x3f304f,_0x3e5462){_0x3e5462=_0x3e5462||0x1f4;return function(_0xfaefdf){logger[_0x714d('0x28')](_0xfaefdf[_0x714d('0x29')]);if(_0xfaefdf[_0x714d('0x2a')]){delete _0xfaefdf[_0x714d('0x2a')];}_0x3f304f[_0x714d('0x19')](_0x3e5462)[_0x714d('0x2b')](_0xfaefdf);};}exports[_0x714d('0x2c')]=function(_0x502dab,_0x1da037){var _0x426e7e={},_0x567e7e={},_0x48ba00={'count':0x0,'rows':[]};var _0x5efb28=_[_0x714d('0x2d')](db[_0x714d('0x2e')][_0x714d('0x2f')],function(_0x4a0916){return{'name':_0x4a0916[_0x714d('0x30')],'type':_0x4a0916['type'][_0x714d('0x31')]};});_0x567e7e[_0x714d('0x32')]=_[_0x714d('0x2d')](_0x5efb28,_0x714d('0x2a'));_0x567e7e[_0x714d('0x33')]=_['keys'](_0x502dab[_0x714d('0x33')]);_0x567e7e['filters']=_[_0x714d('0x34')](_0x567e7e[_0x714d('0x32')],_0x567e7e[_0x714d('0x33')]);_0x426e7e[_0x714d('0x35')]=_[_0x714d('0x34')](_0x567e7e[_0x714d('0x32')],qs[_0x714d('0x36')](_0x502dab[_0x714d('0x33')][_0x714d('0x36')]));_0x426e7e['attributes']=_0x426e7e[_0x714d('0x35')][_0x714d('0x37')]?_0x426e7e[_0x714d('0x35')]:_0x567e7e[_0x714d('0x32')];if(!_0x502dab[_0x714d('0x33')][_0x714d('0x38')](_0x714d('0x39'))){_0x426e7e[_0x714d('0x1b')]=qs[_0x714d('0x1b')](_0x502dab[_0x714d('0x33')][_0x714d('0x1b')]);_0x426e7e[_0x714d('0x1e')]=qs[_0x714d('0x1e')](_0x502dab['query']['offset']);}_0x426e7e['order']=qs[_0x714d('0x3a')](_0x502dab['query'][_0x714d('0x3a')]);_0x426e7e[_0x714d('0x3b')]=qs[_0x714d('0x3c')](_[_0x714d('0x3d')](_0x502dab['query'],_0x567e7e[_0x714d('0x3c')]),_0x5efb28);if(_0x502dab[_0x714d('0x33')][_0x714d('0x3e')]){_0x426e7e['where']=_[_0x714d('0x3f')](_0x426e7e[_0x714d('0x3b')],{'$or':_[_0x714d('0x2d')](_0x5efb28,function(_0xc75f51){if(_0xc75f51[_0x714d('0x40')]!==_0x714d('0x41')){var _0x593a34={};_0x593a34[_0xc75f51[_0x714d('0x2a')]]={'$like':'%'+_0x502dab['query']['filter']+'%'};return _0x593a34;}})});}_0x426e7e=_[_0x714d('0x3f')]({},_0x426e7e,_0x502dab['options']);var _0x3e1445={'where':_0x426e7e['where']};return db[_0x714d('0x2e')]['count'](_0x3e1445)[_0x714d('0x25')](function(_0x25ebcf){_0x48ba00['count']=_0x25ebcf;if(_0x502dab[_0x714d('0x33')]['includeAll']){_0x426e7e['include']=[{'all':!![]}];}return db['SalesforceField'][_0x714d('0x42')](_0x426e7e);})['then'](function(_0x25ef8a){_0x48ba00['rows']=_0x25ef8a;return _0x48ba00;})[_0x714d('0x25')](respondWithFilteredResult(_0x1da037,_0x426e7e))[_0x714d('0x43')](handleError(_0x1da037,null));};exports[_0x714d('0x44')]=function(_0x18cef9,_0xa686a2){var _0x9daaee={'raw':!![],'where':{'id':_0x18cef9[_0x714d('0x45')]['id']}},_0x5de3ad={};_0x5de3ad['model']=_[_0x714d('0x46')](db[_0x714d('0x2e')][_0x714d('0x2f')]);_0x5de3ad[_0x714d('0x33')]=_[_0x714d('0x46')](_0x18cef9[_0x714d('0x33')]);_0x5de3ad['filters']=_['intersection'](_0x5de3ad['model'],_0x5de3ad[_0x714d('0x33')]);_0x9daaee[_0x714d('0x35')]=_[_0x714d('0x34')](_0x5de3ad[_0x714d('0x32')],qs['fields'](_0x18cef9[_0x714d('0x33')][_0x714d('0x36')]));_0x9daaee['attributes']=_0x9daaee['attributes'][_0x714d('0x37')]?_0x9daaee[_0x714d('0x35')]:_0x5de3ad['model'];if(_0x18cef9[_0x714d('0x33')]['includeAll']){_0x9daaee['include']=[{'all':!![]}];}_0x9daaee=_[_0x714d('0x3f')]({},_0x9daaee,_0x18cef9[_0x714d('0x47')]);return db[_0x714d('0x2e')][_0x714d('0x48')](_0x9daaee)['then'](handleEntityNotFound(_0xa686a2,null))['then'](respondWithResult(_0xa686a2,null))[_0x714d('0x43')](handleError(_0xa686a2,null));};exports[_0x714d('0x49')]=function(_0x93d70,_0x2bf26b){return db[_0x714d('0x2e')][_0x714d('0x49')](_0x93d70[_0x714d('0x4a')],{})[_0x714d('0x25')](respondWithResult(_0x2bf26b,0xc9))[_0x714d('0x43')](handleError(_0x2bf26b,null));};exports[_0x714d('0x24')]=function(_0x33b5fb,_0x193446){if(_0x33b5fb[_0x714d('0x4a')]['id']){delete _0x33b5fb[_0x714d('0x4a')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x33b5fb[_0x714d('0x45')]['id']}})[_0x714d('0x25')](handleEntityNotFound(_0x193446,null))[_0x714d('0x25')](saveUpdates(_0x33b5fb[_0x714d('0x4a')],null))[_0x714d('0x25')](respondWithResult(_0x193446,null))['catch'](handleError(_0x193446,null));};exports[_0x714d('0x26')]=function(_0x5a9500,_0x2b8da5){return db[_0x714d('0x2e')][_0x714d('0x48')]({'where':{'id':_0x5a9500['params']['id']}})[_0x714d('0x25')](handleEntityNotFound(_0x2b8da5,null))['then'](removeEntity(_0x2b8da5,null))[_0x714d('0x43')](handleError(_0x2b8da5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e2cd6bd..603a152 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 _0xe30e=['request-promise','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x53c720,_0x331b70){var _0xfa4477=function(_0xa70767){while(--_0xa70767){_0x53c720['push'](_0x53c720['shift']());}};_0xfa4477(++_0x331b70);}(_0xe30e,0x159));var _0xee30=function(_0xb39122,_0x1c4f04){_0xb39122=_0xb39122-0x0;var _0x4126c7=_0xe30e[_0xb39122];return _0x4126c7;};'use strict';var _=require(_0xee30('0x0'));var util=require('util');var logger=require(_0xee30('0x1'))(_0xee30('0x2'));var moment=require(_0xee30('0x3'));var BPromise=require(_0xee30('0x4'));var rp=require(_0xee30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee30('0x6'));var config=require('../../config/environment');var attributes=require(_0xee30('0x7'));module[_0xee30('0x8')]=function(_0x12fe4a,_0x2fb8a8){return _0x12fe4a[_0xee30('0x9')](_0xee30('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xee30('0xb'),'fields':[_0xee30('0xc'),_0xee30('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4830=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','api','moment','request-promise'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4830,0x106));var _0x0483=function(_0x2d6376,_0x246215){_0x2d6376=_0x2d6376-0x0;var _0x53de3a=_0x4830[_0x2d6376];return _0x53de3a;};'use strict';var _=require('lodash');var util=require(_0x0483('0x0'));var logger=require('../../config/logger')(_0x0483('0x1'));var moment=require(_0x0483('0x2'));var BPromise=require('bluebird');var rp=require(_0x0483('0x3'));var fs=require('fs');var path=require(_0x0483('0x4'));var rimraf=require(_0x0483('0x5'));var config=require(_0x0483('0x6'));var attributes=require(_0x0483('0x7'));module[_0x0483('0x8')]=function(_0x21837a,_0xd8e0a7){return _0x21837a[_0x0483('0x9')]('SalesforceField',attributes,{'tableName':_0x0483('0xa'),'paranoid':![],'indexes':[{'name':_0x0483('0xb'),'fields':[_0x0483('0xc'),_0x0483('0xd')],'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 8ca13d5..ca11ad2 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 _0x5421=['error','message','SalesforceField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x41a5cb,_0x526b04){var _0x127bf3=function(_0x5bd2ee){while(--_0x5bd2ee){_0x41a5cb['push'](_0x41a5cb['shift']());}};_0x127bf3(++_0x526b04);}(_0x5421,0x1e5));var _0x1542=function(_0x109f4d,_0x39dabd){_0x109f4d=_0x109f4d-0x0;var _0x541706=_0x5421[_0x109f4d];return _0x541706;};'use strict';var _=require(_0x1542('0x0'));var util=require(_0x1542('0x1'));var moment=require('moment');var BPromise=require(_0x1542('0x2'));var rs=require(_0x1542('0x3'));var fs=require('fs');var Redis=require(_0x1542('0x4'));var db=require(_0x1542('0x5'))['db'];var utils=require(_0x1542('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1542('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1542('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41873a,_0x1af905,_0xbe6c8){return new BPromise(function(_0x5744ad,_0x1b8624){return client[_0x1542('0x9')](_0x41873a,_0xbe6c8)['then'](function(_0x111fd2){logger[_0x1542('0xa')]('SalesforceField,\x20%s,\x20%s',_0x1af905,_0x1542('0xb'));logger[_0x1542('0xc')](_0x1542('0xd'),_0x1af905,_0x1542('0xb'),JSON[_0x1542('0xe')](_0x111fd2));if(_0x111fd2[_0x1542('0xf')]){if(_0x111fd2[_0x1542('0xf')]['code']===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1af905,_0x111fd2['error']['message']);return _0x1b8624(_0x111fd2[_0x1542('0xf')][_0x1542('0x10')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x1af905,_0x111fd2[_0x1542('0xf')][_0x1542('0x10')]);return _0x5744ad(_0x111fd2[_0x1542('0xf')][_0x1542('0x10')]);}else{logger[_0x1542('0xa')](_0x1542('0x11'),_0x1af905,'request\x20sent');_0x5744ad(_0x111fd2[_0x1542('0x12')][_0x1542('0x10')]);}})[_0x1542('0x13')](function(_0x229aa0){logger['error'](_0x1542('0x11'),_0x1af905,_0x229aa0);_0x1b8624(_0x229aa0);});});} \ No newline at end of file +var _0xe267=['request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x473d87,_0x2a5afc){var _0x3c7207=function(_0x4b55e3){while(--_0x4b55e3){_0x473d87['push'](_0x473d87['shift']());}};_0x3c7207(++_0x2a5afc);}(_0xe267,0x1d5));var _0x7e26=function(_0x1f2446,_0x405cfc){_0x1f2446=_0x1f2446-0x0;var _0x468bfa=_0xe267[_0x1f2446];return _0x468bfa;};'use strict';var _=require(_0x7e26('0x0'));var util=require(_0x7e26('0x1'));var moment=require('moment');var BPromise=require(_0x7e26('0x2'));var rs=require(_0x7e26('0x3'));var fs=require('fs');var Redis=require(_0x7e26('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e26('0x5'));var logger=require(_0x7e26('0x6'))(_0x7e26('0x7'));var config=require('../../config/environment');var jayson=require(_0x7e26('0x8'));var client=jayson[_0x7e26('0x9')][_0x7e26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47870e,_0x148051,_0x162e66){return new BPromise(function(_0x5bf869,_0x139c48){return client[_0x7e26('0xb')](_0x47870e,_0x162e66)[_0x7e26('0xc')](function(_0x45a135){logger[_0x7e26('0xd')]('SalesforceField,\x20%s,\x20%s',_0x148051,_0x7e26('0xe'));logger[_0x7e26('0xf')](_0x7e26('0x10'),_0x148051,'request\x20sent',JSON[_0x7e26('0x11')](_0x45a135));if(_0x45a135[_0x7e26('0x12')]){if(_0x45a135[_0x7e26('0x12')][_0x7e26('0x13')]===0x1f4){logger['error'](_0x7e26('0x14'),_0x148051,_0x45a135['error'][_0x7e26('0x15')]);return _0x139c48(_0x45a135[_0x7e26('0x12')]['message']);}logger['error'](_0x7e26('0x14'),_0x148051,_0x45a135[_0x7e26('0x12')][_0x7e26('0x15')]);return _0x5bf869(_0x45a135[_0x7e26('0x12')][_0x7e26('0x15')]);}else{logger[_0x7e26('0xd')]('SalesforceField,\x20%s,\x20%s',_0x148051,_0x7e26('0xe'));_0x5bf869(_0x45a135[_0x7e26('0x16')][_0x7e26('0x15')]);}})['catch'](function(_0x2001df){logger['error'](_0x7e26('0x14'),_0x148051,_0x2001df);_0x139c48(_0x2001df);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6aa700c..182583f 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 _0xdc3d=['isAuthenticated','/:id/configurations','getFields','create','post','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc3d,0x1ad));var _0xddc3=function(_0x47a988,_0xf67dd0){_0x47a988=_0x47a988-0x0;var _0x4fa587=_0xdc3d[_0x47a988];return _0x4fa587;};'use strict';var multer=require(_0xddc3('0x0'));var util=require(_0xddc3('0x1'));var path=require(_0xddc3('0x2'));var timeout=require(_0xddc3('0x3'));var express=require(_0xddc3('0x4'));var router=express['Router']();var fs_extra=require(_0xddc3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xddc3('0x6'));var config=require('../../config/environment');var controller=require(_0xddc3('0x7'));router[_0xddc3('0x8')]('/',auth['isAuthenticated'](),controller[_0xddc3('0x9')]);router[_0xddc3('0x8')](_0xddc3('0xa'),auth[_0xddc3('0xb')](),controller['show']);router['get'](_0xddc3('0xc'),auth[_0xddc3('0xb')](),controller['getConfigurations']);router[_0xddc3('0x8')]('/:id/fields',auth[_0xddc3('0xb')](),controller[_0xddc3('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xddc3('0xe')]);router[_0xddc3('0xf')](_0xddc3('0xc'),auth[_0xddc3('0xb')](),controller[_0xddc3('0x10')]);router[_0xddc3('0x11')](_0xddc3('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xddc3('0x12')](_0xddc3('0xa'),auth[_0xddc3('0xb')](),controller['destroy']);module[_0xddc3('0x13')]=router; \ No newline at end of file +var _0xbe02=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x2bd96f,_0x32f14f){var _0x4b7c3d=function(_0x4e7be9){while(--_0x4e7be9){_0x2bd96f['push'](_0x2bd96f['shift']());}};_0x4b7c3d(++_0x32f14f);}(_0xbe02,0x146));var _0x2be0=function(_0x11c737,_0x403621){_0x11c737=_0x11c737-0x0;var _0x39469f=_0xbe02[_0x11c737];return _0x39469f;};'use strict';var multer=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var path=require(_0x2be0('0x2'));var timeout=require(_0x2be0('0x3'));var express=require('express');var router=express[_0x2be0('0x4')]();var fs_extra=require(_0x2be0('0x5'));var auth=require(_0x2be0('0x6'));var interaction=require(_0x2be0('0x7'));var config=require(_0x2be0('0x8'));var controller=require(_0x2be0('0x9'));router[_0x2be0('0xa')]('/',auth[_0x2be0('0xb')](),controller[_0x2be0('0xc')]);router['get']('/:id',auth[_0x2be0('0xb')](),controller[_0x2be0('0xd')]);router[_0x2be0('0xa')](_0x2be0('0xe'),auth[_0x2be0('0xb')](),controller[_0x2be0('0xf')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x2be0('0x10')]);router[_0x2be0('0x11')]('/:id/configurations',auth[_0x2be0('0xb')](),controller[_0x2be0('0x12')]);router[_0x2be0('0x13')](_0x2be0('0x14'),auth[_0x2be0('0xb')](),controller[_0x2be0('0x15')]);router[_0x2be0('0x16')](_0x2be0('0x14'),auth[_0x2be0('0xb')](),controller[_0x2be0('0x17')]);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 9d363c0..bcc7fdf 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 _0x6fc6=['username','remoteUri','sequelize','exports','STRING'];(function(_0x23a079,_0xb8c9aa){var _0x53f2a5=function(_0x1b3dc5){while(--_0x1b3dc5){_0x23a079['push'](_0x23a079['shift']());}};_0x53f2a5(++_0xb8c9aa);}(_0x6fc6,0x1e7));var _0x66fc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6fc6[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x66fc('0x0'));module[_0x66fc('0x1')]={'name':{'type':Sequelize[_0x66fc('0x2')]},'description':{'type':Sequelize[_0x66fc('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x66fc('0x3')},'password':{'type':Sequelize[_0x66fc('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x66fc('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x746b=['username','sequelize','exports','STRING'];(function(_0x4ea9b9,_0x525a0c){var _0x1d7b57=function(_0x1c4ade){while(--_0x1c4ade){_0x4ea9b9['push'](_0x4ea9b9['shift']());}};_0x1d7b57(++_0x525a0c);}(_0x746b,0x1c1));var _0xb746=function(_0x401f0d,_0x348817){_0x401f0d=_0x401f0d-0x0;var _0x218bed=_0x746b[_0x401f0d];return _0x218bed;};'use strict';var Sequelize=require(_0xb746('0x0'));module[_0xb746('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb746('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xb746('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb746('0x2')]},'remoteUri':{'type':Sequelize[_0xb746('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index c89dd97..233d2c9 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 _0xdd46=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','map','ServicenowAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','catch','show','params','fields','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','filter','addConfiguration','AccountId','channel','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','close_code','notify','incident_state','caused_by','watch_list','upon_reject','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_created_on','sys_created_by','knowledge','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','correlation_display','delivery_task','work_start','business_stc','calendar_duration','closed_by','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','severity','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','assign','TCL:\x20_object','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','True','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdd46,0x15c));var _0x6dd4=function(_0x14a661,_0x30b951){_0x14a661=_0x14a661-0x0;var _0x46a427=_0xdd46[_0x14a661];return _0x46a427;};'use strict';var emlformat=require(_0x6dd4('0x0'));var rimraf=require(_0x6dd4('0x1'));var zipdir=require(_0x6dd4('0x2'));var jsonpatch=require(_0x6dd4('0x3'));var rp=require('request-promise');var moment=require(_0x6dd4('0x4'));var BPromise=require(_0x6dd4('0x5'));var Mustache=require(_0x6dd4('0x6'));var util=require(_0x6dd4('0x7'));var path=require(_0x6dd4('0x8'));var sox=require(_0x6dd4('0x9'));var csv=require(_0x6dd4('0xa'));var ejs=require(_0x6dd4('0xb'));var fs=require('fs');var fs_extra=require(_0x6dd4('0xc'));var _=require(_0x6dd4('0xd'));var squel=require(_0x6dd4('0xe'));var crypto=require(_0x6dd4('0xf'));var jsforce=require(_0x6dd4('0x10'));var deskjs=require(_0x6dd4('0x11'));var toCsv=require(_0x6dd4('0xa'));var querystring=require(_0x6dd4('0x12'));var Papa=require(_0x6dd4('0x13'));var Redis=require(_0x6dd4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x6dd4('0x15'));var as=require(_0x6dd4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dd4('0x17'))(_0x6dd4('0x18'));var utils=require(_0x6dd4('0x19'));var config=require(_0x6dd4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6dd4('0x1b'))['db'];var integrations=require(_0x6dd4('0x1c'));function respondWithStatusCode(_0xad8b31,_0x241925){_0x241925=_0x241925||0xcc;return function(_0x71d847){if(_0x71d847){return _0xad8b31[_0x6dd4('0x1d')](_0x241925);}return _0xad8b31['status'](_0x241925)['end']();};}function respondWithResult(_0x33ac1a,_0x32f5f5){_0x32f5f5=_0x32f5f5||0xc8;return function(_0x49750d){if(_0x49750d){return _0x33ac1a[_0x6dd4('0x1e')](_0x32f5f5)[_0x6dd4('0x1f')](_0x49750d);}};}function respondWithFilteredResult(_0x4ad109,_0x2d7bc7){return function(_0x46ed82){if(_0x46ed82){var _0x437069=typeof _0x2d7bc7[_0x6dd4('0x20')]===_0x6dd4('0x21')&&typeof _0x2d7bc7['limit']===_0x6dd4('0x21');var _0x4e754c=_0x46ed82[_0x6dd4('0x22')];var _0x15d657=_0x437069?0x0:_0x2d7bc7[_0x6dd4('0x20')];var _0x5528d5=_0x437069?_0x46ed82['count']:_0x2d7bc7['offset']+_0x2d7bc7['limit'];var _0x23694e;if(_0x5528d5>=_0x4e754c){_0x5528d5=_0x4e754c;_0x23694e=0xc8;}else{_0x23694e=0xce;}_0x4ad109[_0x6dd4('0x1e')](_0x23694e);return _0x4ad109[_0x6dd4('0x23')]('Content-Range',_0x15d657+'-'+_0x5528d5+'/'+_0x4e754c)[_0x6dd4('0x1f')](_0x46ed82);}return null;};}function patchUpdates(_0x25fd5a){return function(_0xa24a51){try{jsonpatch[_0x6dd4('0x24')](_0xa24a51,_0x25fd5a,!![]);}catch(_0x38cec8){return BPromise[_0x6dd4('0x25')](_0x38cec8);}return _0xa24a51[_0x6dd4('0x26')]();};}function saveUpdates(_0x4624f2,_0xda662a){return function(_0x155865){if(_0x155865){return _0x155865[_0x6dd4('0x27')](_0x4624f2)[_0x6dd4('0x28')](function(_0x3ca65c){return _0x3ca65c;});}return null;};}function removeEntity(_0x4fbc51,_0x20e1c2){return function(_0x2f0989){if(_0x2f0989){return _0x2f0989[_0x6dd4('0x29')]()[_0x6dd4('0x28')](function(){_0x4fbc51[_0x6dd4('0x1e')](0xcc)[_0x6dd4('0x2a')]();});}};}function handleEntityNotFound(_0x27b921,_0xaac1d1){return function(_0x6bb3cb){if(!_0x6bb3cb){_0x27b921['sendStatus'](0x194);}return _0x6bb3cb;};}function handleError(_0x469fea,_0x1ee921){_0x1ee921=_0x1ee921||0x1f4;return function(_0xb06d99){logger['error'](_0xb06d99[_0x6dd4('0x2b')]);if(_0xb06d99[_0x6dd4('0x2c')]){delete _0xb06d99[_0x6dd4('0x2c')];}_0x469fea[_0x6dd4('0x1e')](_0x1ee921)[_0x6dd4('0x2d')](_0xb06d99);};}exports['index']=function(_0x3fd30d,_0x13bb28){var _0x23b248={},_0x520db7={},_0x504883={'count':0x0,'rows':[]};var _0x4ac88a=_[_0x6dd4('0x2e')](db[_0x6dd4('0x2f')][_0x6dd4('0x30')],function(_0x3b50b8){return{'name':_0x3b50b8['fieldName'],'type':_0x3b50b8[_0x6dd4('0x31')][_0x6dd4('0x32')]};});_0x520db7['model']=_[_0x6dd4('0x2e')](_0x4ac88a,_0x6dd4('0x2c'));_0x520db7[_0x6dd4('0x33')]=_[_0x6dd4('0x34')](_0x3fd30d[_0x6dd4('0x33')]);_0x520db7[_0x6dd4('0x35')]=_[_0x6dd4('0x36')](_0x520db7[_0x6dd4('0x37')],_0x520db7[_0x6dd4('0x33')]);_0x23b248[_0x6dd4('0x38')]=_['intersection'](_0x520db7[_0x6dd4('0x37')],qs['fields'](_0x3fd30d[_0x6dd4('0x33')]['fields']));_0x23b248['attributes']=_0x23b248[_0x6dd4('0x38')][_0x6dd4('0x39')]?_0x23b248['attributes']:_0x520db7[_0x6dd4('0x37')];if(!_0x3fd30d[_0x6dd4('0x33')][_0x6dd4('0x3a')](_0x6dd4('0x3b'))){_0x23b248['limit']=qs[_0x6dd4('0x3c')](_0x3fd30d['query']['limit']);_0x23b248[_0x6dd4('0x20')]=qs[_0x6dd4('0x20')](_0x3fd30d['query']['offset']);}_0x23b248[_0x6dd4('0x3d')]=qs[_0x6dd4('0x3e')](_0x3fd30d[_0x6dd4('0x33')][_0x6dd4('0x3e')]);_0x23b248[_0x6dd4('0x3f')]=qs[_0x6dd4('0x35')](_[_0x6dd4('0x40')](_0x3fd30d[_0x6dd4('0x33')],_0x520db7['filters']),_0x4ac88a);if(_0x3fd30d[_0x6dd4('0x33')]['filter']){_0x23b248[_0x6dd4('0x3f')]=_[_0x6dd4('0x41')](_0x23b248['where'],{'$or':_[_0x6dd4('0x2e')](_0x4ac88a,function(_0x21b9b2){if(_0x21b9b2['type']!==_0x6dd4('0x42')){var _0x1858b2={};_0x1858b2[_0x21b9b2[_0x6dd4('0x2c')]]={'$like':'%'+_0x3fd30d[_0x6dd4('0x33')]['filter']+'%'};return _0x1858b2;}})});}_0x23b248=_[_0x6dd4('0x41')]({},_0x23b248,_0x3fd30d[_0x6dd4('0x43')]);var _0x2b9eac={'where':_0x23b248['where']};return db[_0x6dd4('0x2f')]['count'](_0x2b9eac)['then'](function(_0x46d577){_0x504883[_0x6dd4('0x22')]=_0x46d577;if(_0x3fd30d[_0x6dd4('0x33')][_0x6dd4('0x44')]){_0x23b248['include']=[{'all':!![]}];}return db[_0x6dd4('0x2f')]['findAll'](_0x23b248);})[_0x6dd4('0x28')](function(_0x2e13e2){_0x504883['rows']=_0x2e13e2;return _0x504883;})[_0x6dd4('0x28')](respondWithFilteredResult(_0x13bb28,_0x23b248))[_0x6dd4('0x45')](handleError(_0x13bb28,null));};exports[_0x6dd4('0x46')]=function(_0x183037,_0x219182){var _0x399eb8={'raw':![],'where':{'id':_0x183037[_0x6dd4('0x47')]['id']}},_0x1ce034={};_0x1ce034[_0x6dd4('0x37')]=_[_0x6dd4('0x34')](db['ServicenowAccount'][_0x6dd4('0x30')]);_0x1ce034[_0x6dd4('0x33')]=_[_0x6dd4('0x34')](_0x183037[_0x6dd4('0x33')]);_0x1ce034['filters']=_[_0x6dd4('0x36')](_0x1ce034[_0x6dd4('0x37')],_0x1ce034[_0x6dd4('0x33')]);_0x399eb8[_0x6dd4('0x38')]=_['intersection'](_0x1ce034[_0x6dd4('0x37')],qs[_0x6dd4('0x48')](_0x183037[_0x6dd4('0x33')][_0x6dd4('0x48')]));_0x399eb8[_0x6dd4('0x38')]=_0x399eb8[_0x6dd4('0x38')][_0x6dd4('0x39')]?_0x399eb8[_0x6dd4('0x38')]:_0x1ce034['model'];if(_0x183037[_0x6dd4('0x33')][_0x6dd4('0x44')]){_0x399eb8[_0x6dd4('0x49')]=[{'all':!![]}];}_0x399eb8=_['merge']({},_0x399eb8,_0x183037['options']);return db[_0x6dd4('0x2f')][_0x6dd4('0x4a')](_0x399eb8)['then'](handleEntityNotFound(_0x219182,null))[_0x6dd4('0x28')](respondWithResult(_0x219182,null))[_0x6dd4('0x45')](handleError(_0x219182,null));};exports[_0x6dd4('0x4b')]=function(_0x43c3ea,_0x11f780){return db[_0x6dd4('0x2f')][_0x6dd4('0x4b')](_0x43c3ea['body'],{})['then'](respondWithResult(_0x11f780,0xc9))[_0x6dd4('0x45')](handleError(_0x11f780,null));};exports[_0x6dd4('0x27')]=function(_0x41f6da,_0x3fb62c){if(_0x41f6da[_0x6dd4('0x4c')]['id']){delete _0x41f6da[_0x6dd4('0x4c')]['id'];}return db[_0x6dd4('0x2f')][_0x6dd4('0x4a')]({'where':{'id':_0x41f6da[_0x6dd4('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fb62c,null))[_0x6dd4('0x28')](saveUpdates(_0x41f6da[_0x6dd4('0x4c')],null))['then'](respondWithResult(_0x3fb62c,null))[_0x6dd4('0x45')](handleError(_0x3fb62c,null));};exports[_0x6dd4('0x29')]=function(_0x3ea8b7,_0x4805d5){return db[_0x6dd4('0x2f')]['find']({'where':{'id':_0x3ea8b7['params']['id']}})[_0x6dd4('0x28')](handleEntityNotFound(_0x4805d5,null))[_0x6dd4('0x28')](removeEntity(_0x4805d5,null))[_0x6dd4('0x45')](handleError(_0x4805d5,null));};exports[_0x6dd4('0x4d')]=function(_0x267b55,_0x52094a,_0x32ad9f){var _0x1d7157={};var _0x525f70={};var _0x65c86b;var _0x6dd25c;return db[_0x6dd4('0x2f')][_0x6dd4('0x4e')]({'where':{'id':_0x267b55[_0x6dd4('0x47')]['id']}})['then'](handleEntityNotFound(_0x52094a,null))[_0x6dd4('0x28')](function(_0x3e2feb){if(_0x3e2feb){_0x65c86b=_0x3e2feb;_0x525f70[_0x6dd4('0x37')]=_[_0x6dd4('0x34')](db[_0x6dd4('0x4f')][_0x6dd4('0x30')]);_0x525f70[_0x6dd4('0x33')]=_[_0x6dd4('0x34')](_0x267b55[_0x6dd4('0x33')]);_0x525f70[_0x6dd4('0x35')]=_[_0x6dd4('0x36')](_0x525f70[_0x6dd4('0x37')],_0x525f70[_0x6dd4('0x33')]);_0x1d7157[_0x6dd4('0x38')]=_[_0x6dd4('0x36')](_0x525f70['model'],qs[_0x6dd4('0x48')](_0x267b55[_0x6dd4('0x33')]['fields']));_0x1d7157[_0x6dd4('0x38')]=_0x1d7157[_0x6dd4('0x38')]['length']?_0x1d7157['attributes']:_0x525f70[_0x6dd4('0x37')];_0x1d7157[_0x6dd4('0x3d')]=qs[_0x6dd4('0x3e')](_0x267b55['query'][_0x6dd4('0x3e')]);_0x1d7157['where']=qs[_0x6dd4('0x35')](_[_0x6dd4('0x40')](_0x267b55[_0x6dd4('0x33')],_0x525f70[_0x6dd4('0x35')]));if(_0x267b55[_0x6dd4('0x33')][_0x6dd4('0x50')]){_0x1d7157[_0x6dd4('0x3f')]=_[_0x6dd4('0x41')](_0x1d7157[_0x6dd4('0x3f')],{'$or':_[_0x6dd4('0x2e')](_0x1d7157[_0x6dd4('0x38')],function(_0x47edfa){var _0x424fec={};_0x424fec[_0x47edfa]={'$like':'%'+_0x267b55[_0x6dd4('0x33')]['filter']+'%'};return _0x424fec;})});}_0x1d7157=_['merge']({},_0x1d7157,_0x267b55[_0x6dd4('0x43')]);return _0x65c86b[_0x6dd4('0x4d')](_0x1d7157);}})[_0x6dd4('0x28')](function(_0x67068b){if(_0x67068b){_0x6dd25c=_0x67068b[_0x6dd4('0x39')];if(!_0x267b55[_0x6dd4('0x33')][_0x6dd4('0x3a')](_0x6dd4('0x3b'))){_0x1d7157['limit']=qs[_0x6dd4('0x3c')](_0x267b55['query']['limit']);_0x1d7157[_0x6dd4('0x20')]=qs[_0x6dd4('0x20')](_0x267b55[_0x6dd4('0x33')][_0x6dd4('0x20')]);}return _0x65c86b['getConfigurations'](_0x1d7157);}})[_0x6dd4('0x28')](function(_0x52bced){if(_0x52bced){return _0x52bced?{'count':_0x6dd25c,'rows':_0x52bced}:null;}})[_0x6dd4('0x28')](respondWithResult(_0x52094a,null))[_0x6dd4('0x45')](handleError(_0x52094a,null));};exports[_0x6dd4('0x51')]=function(_0x58dd2c,_0x3dc35b,_0x15e33e){if(_0x58dd2c[_0x6dd4('0x4c')]['id']){delete _0x58dd2c['body']['id'];}return db[_0x6dd4('0x2f')][_0x6dd4('0x4e')]({'where':{'id':_0x58dd2c[_0x6dd4('0x47')]['id']}})[_0x6dd4('0x28')](handleEntityNotFound(_0x3dc35b,null))[_0x6dd4('0x28')](function(_0xff6dc1){if(_0xff6dc1){_0x58dd2c[_0x6dd4('0x4c')][_0x6dd4('0x52')]=_0xff6dc1['id'];_0x58dd2c['body']['Subjects']=integrations['getSubjects'](_0x58dd2c[_0x6dd4('0x4c')][_0x6dd4('0x53')],_0x58dd2c[_0x6dd4('0x4c')]['type']);_0x58dd2c['body']['Descriptions']=integrations[_0x6dd4('0x54')](_0x58dd2c[_0x6dd4('0x4c')][_0x6dd4('0x53')],_0x58dd2c[_0x6dd4('0x4c')]['type']);return db[_0x6dd4('0x4f')]['create'](_0x58dd2c[_0x6dd4('0x4c')],{'include':[{'model':db[_0x6dd4('0x55')],'as':_0x6dd4('0x56')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x6dd4('0x28')](respondWithResult(_0x3dc35b,null))[_0x6dd4('0x45')](handleError(_0x3dc35b,null));};exports[_0x6dd4('0x57')]=function(_0x3d4573,_0x177b93,_0x48ffe3){var _0x3ac447=[_0x6dd4('0x58'),_0x6dd4('0x59'),'knowledge','subcategory',_0x6dd4('0x5a'),_0x6dd4('0x5b'),_0x6dd4('0x5c'),'severity','category'];var _0xf115c=['parent','made_sla',_0x6dd4('0x5d'),_0x6dd4('0x5e'),_0x6dd4('0x5f'),'sys_updated_on',_0x6dd4('0x60'),'hold_reason',_0x6dd4('0x61'),'number','resolved_by',_0x6dd4('0x62'),_0x6dd4('0x63'),_0x6dd4('0x64'),_0x6dd4('0x65'),'sys_domain','state',_0x6dd4('0x66'),_0x6dd4('0x67'),_0x6dd4('0x3d'),_0x6dd4('0x68'),_0x6dd4('0x69'),'cmdb_ci',_0x6dd4('0x6a'),_0x6dd4('0x6b'),_0x6dd4('0x6c'),_0x6dd4('0x6d'),'business_service',_0x6dd4('0x6e'),_0x6dd4('0x6f'),_0x6dd4('0x70'),_0x6dd4('0x71'),'expected_start','opened_at','business_duration',_0x6dd4('0x72'),_0x6dd4('0x73'),_0x6dd4('0x74'),_0x6dd4('0x75'),_0x6dd4('0x76'),_0x6dd4('0x77'),_0x6dd4('0x78'),'work_notes',_0x6dd4('0x79'),_0x6dd4('0x5a'),_0x6dd4('0x7a'),_0x6dd4('0x7b'),_0x6dd4('0x7c'),'assignment_group',_0x6dd4('0x7d'),'additional_assignee_list','description',_0x6dd4('0x7e'),_0x6dd4('0x5b'),'sys_class_name','close_notes',_0x6dd4('0x7f'),'follow_up',_0x6dd4('0x80'),_0x6dd4('0x81'),'contact_type',_0x6dd4('0x82'),_0x6dd4('0x5c'),_0x6dd4('0x83'),_0x6dd4('0x84'),_0x6dd4('0x85'),_0x6dd4('0x86'),_0x6dd4('0x87'),'assigned_to',_0x6dd4('0x88'),_0x6dd4('0x89'),_0x6dd4('0x8a'),'approval','comments_and_work_notes',_0x6dd4('0x8b'),_0x6dd4('0x8c'),_0x6dd4('0x8d'),_0x6dd4('0x8e'),_0x6dd4('0x8f'),_0x6dd4('0x90'),_0x6dd4('0x91'),_0x6dd4('0x92'),_0x6dd4('0x93')];var _0x40b178='';var _0x265c6d='';var _0x9f2142=[];var _0x18cf5f='';var _0x659429='';var _0x16adb6=[];var _0x417462='';var _0x296993='';var _0x2bb9cd={};var _0x161f8e='';return db[_0x6dd4('0x2f')][_0x6dd4('0x4e')]({'where':{'id':_0x3d4573['params']['id']},'attributes':['id',_0x6dd4('0x94'),_0x6dd4('0x95'),_0x6dd4('0x96'),'remoteUri',_0x6dd4('0x97')]})[_0x6dd4('0x28')](handleEntityNotFound(_0x177b93,null))['then'](function(_0x22f660){if(_0x22f660){_0x161f8e=_0x22f660[_0x6dd4('0x98')];var _0xd4ae09=_0x161f8e[_0x6dd4('0x99')](-0x1);if(_0xd4ae09==='/'){_0x161f8e=_0x161f8e['substring'](0x0,_0x161f8e[_0x6dd4('0x9a')](_0xd4ae09));}_0x296993=util[_0x6dd4('0x9b')](_0x6dd4('0x9c'),_0x161f8e);_0x417462=util[_0x6dd4('0x9b')](_0x6dd4('0x9d'),_0x161f8e);_0x2bb9cd={'user':_0x22f660['username'],'pass':_0x22f660[_0x6dd4('0x95')]};var _0x19257b={'method':'GET','uri':_0x296993+_0x6dd4('0x9e'),'auth':_0x2bb9cd,'json':!![]};return rp(_0x19257b);}})[_0x6dd4('0x28')](function(_0x3c08e6){if(_0x3c08e6[_0x6dd4('0x9f')][_0x6dd4('0x39')]>0x0){_0x40b178=_0x3c08e6['result'];}console[_0x6dd4('0xa0')](_0x6dd4('0xa1'),_0x40b178);_0x16adb6=[];_0x265c6d=Object['assign']([],_0x40b178);_[_0x6dd4('0xa2')](_0x265c6d,function(_0x10870c){return!_0x3ac447[_0x6dd4('0xa3')](_0x10870c['name']);});_0x265c6d[_0x6dd4('0xa4')](function(_0x45a1ab){var _0x5a4225=createFieldObject(_0x417462,_0x2bb9cd,_0x45a1ab[_0x6dd4('0xa5')],_0x45a1ab[_0x6dd4('0x2c')],_0x45a1ab[_0x6dd4('0xa6')],![]);_0x16adb6[_0x6dd4('0xa7')](_0x5a4225);});return Promise['all'](_0x16adb6);})[_0x6dd4('0x28')](function(_0x5cd2f5){_0x9f2142=_0x5cd2f5;_0x18cf5f=Object[_0x6dd4('0xa8')]([],_0x40b178);console[_0x6dd4('0xa0')](_0x6dd4('0xa9'),_0x40b178);_[_0x6dd4('0xa2')](_0x18cf5f,function(_0x3b8850){return _0xf115c['includes'](_0x3b8850[_0x6dd4('0x2c')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x18cf5f);_0x16adb6=[];_0x18cf5f['forEach'](function(_0x1d7439){var _0x4345cc=createFieldObject(_0x417462,_0x2bb9cd,_0x1d7439[_0x6dd4('0xa5')],_0x1d7439[_0x6dd4('0x2c')],_0x1d7439['label'],!![]);_0x16adb6[_0x6dd4('0xa7')](_0x4345cc);});return Promise['all'](_0x16adb6);})[_0x6dd4('0x28')](function(_0x309fbf){_0x659429=_0x309fbf;var _0x2b3a4c=_0x9f2142[_0x6dd4('0xaa')](_0x659429);return{'count':_0x2b3a4c[_0x6dd4('0x39')],'rows':_0x2b3a4c};})[_0x6dd4('0x28')](respondWithResult(_0x177b93,null))[_0x6dd4('0x45')](function(_0x1d5612){console[_0x6dd4('0xa0')](_0x6dd4('0xab')+_0x1d5612);var _0x3ad65f=_0x3d4573[_0x6dd4('0x33')]['test']?0x1f4:_0x1d5612[_0x6dd4('0xac')]||0x1f4;logger['error'](_0x1d5612['stack']);delete _0x1d5612[_0x6dd4('0x2c')];if(_0x3ad65f===0x191){_0x3ad65f=0x190;}_0x177b93[_0x6dd4('0x1e')](_0x3ad65f)[_0x6dd4('0x2d')](_0x3d4573[_0x6dd4('0x33')]['test']?{'message':_0x6dd4('0xad'),'statusCode':_0x1d5612[_0x6dd4('0xac')]}:_0x1d5612);});};function createFieldObject(_0x54ec79,_0x2f255a,_0x4cbe08,_0x370daa,_0x26c3f1,_0x1c2150){return new Promise(function(_0x7ef162,_0x4452da){var _0x8929f4={'id':_0x370daa,'name':_0x26c3f1,'custom':_0x1c2150};if(_0x4cbe08===_0x6dd4('0xae')){_0x8929f4[_0x6dd4('0x43')]=[{'name':_0x6dd4('0xaf'),'value':'true'},{'name':_0x6dd4('0xb0'),'value':_0x6dd4('0xb1')}];_0x7ef162(_0x8929f4);}else{var _0xb48871={'method':_0x6dd4('0xb2'),'uri':_0x54ec79+_0x6dd4('0xb3')+_0x370daa,'auth':_0x2f255a,'json':!![]};return rp(_0xb48871)[_0x6dd4('0x28')](function(_0x4cd2bd){var _0x106d88=[];if(_0x4cd2bd[_0x6dd4('0x9f')][_0x6dd4('0x39')]>0x0){_0x4cd2bd[_0x6dd4('0x9f')][_0x6dd4('0xa4')](function(_0x8770c8){if(_0x8770c8[_0x6dd4('0xb4')]===_0x6dd4('0xb1')){var _0x548727={'name':_0x8770c8[_0x6dd4('0xa6')],'value':_0x8770c8['value']};_0x106d88[_0x6dd4('0xa7')](_0x548727);}});}_0x8929f4[_0x6dd4('0x43')]=_0x106d88;if(_0x8929f4[_0x6dd4('0x43')][_0x6dd4('0x39')]>0x0){_0x7ef162(_0x8929f4);}else{if(_0x1c2150==![]){_0x7ef162();}else{_0x7ef162(_0x8929f4);}}});}});} \ No newline at end of file +var _0xa2b1=['true','False','inactive','false','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','ServicenowField','getFields','hold_reason','knowledge','close_code','notify','incident_state','severity','category','made_sla','caused_by','upon_reject','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','work_notes_list','business_service','priority','sys_domain_path','time_worked','opened_at','business_duration','resolved_at','approval_set','subcategory','work_notes','correlation_display','delivery_task','assignment_group','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','urgency','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode'];(function(_0x284d91,_0x4a7eb2){var _0x427199=function(_0x47219f){while(--_0x47219f){_0x284d91['push'](_0x284d91['shift']());}};_0x427199(++_0x4a7eb2);}(_0xa2b1,0x166));var _0x1a2b=function(_0x584db0,_0x46428f){_0x584db0=_0x584db0-0x0;var _0x3a216d=_0xa2b1[_0x584db0];return _0x3a216d;};'use strict';var emlformat=require(_0x1a2b('0x0'));var rimraf=require(_0x1a2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1a2b('0x2'));var BPromise=require(_0x1a2b('0x3'));var Mustache=require(_0x1a2b('0x4'));var util=require('util');var path=require(_0x1a2b('0x5'));var sox=require(_0x1a2b('0x6'));var csv=require(_0x1a2b('0x7'));var ejs=require(_0x1a2b('0x8'));var fs=require('fs');var fs_extra=require(_0x1a2b('0x9'));var _=require(_0x1a2b('0xa'));var squel=require(_0x1a2b('0xb'));var crypto=require(_0x1a2b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a2b('0xd'));var toCsv=require(_0x1a2b('0x7'));var querystring=require(_0x1a2b('0xe'));var Papa=require(_0x1a2b('0xf'));var Redis=require('ioredis');var authService=require(_0x1a2b('0x10'));var qs=require(_0x1a2b('0x11'));var as=require(_0x1a2b('0x12'));var hardwareService=require(_0x1a2b('0x13'));var logger=require(_0x1a2b('0x14'))(_0x1a2b('0x15'));var utils=require('../../config/utils');var config=require(_0x1a2b('0x16'));var licenseUtil=require(_0x1a2b('0x17'));var db=require(_0x1a2b('0x18'))['db'];var integrations=require(_0x1a2b('0x19'));function respondWithStatusCode(_0xc847b8,_0x1d9ac6){_0x1d9ac6=_0x1d9ac6||0xcc;return function(_0x51b228){if(_0x51b228){return _0xc847b8[_0x1a2b('0x1a')](_0x1d9ac6);}return _0xc847b8[_0x1a2b('0x1b')](_0x1d9ac6)[_0x1a2b('0x1c')]();};}function respondWithResult(_0x55fdee,_0x3bf2ae){_0x3bf2ae=_0x3bf2ae||0xc8;return function(_0x398b05){if(_0x398b05){return _0x55fdee[_0x1a2b('0x1b')](_0x3bf2ae)[_0x1a2b('0x1d')](_0x398b05);}};}function respondWithFilteredResult(_0x44cf95,_0xd9cdd7){return function(_0x385f03){if(_0x385f03){var _0x9b4d73=typeof _0xd9cdd7[_0x1a2b('0x1e')]===_0x1a2b('0x1f')&&typeof _0xd9cdd7['limit']===_0x1a2b('0x1f');var _0x5e7e1f=_0x385f03[_0x1a2b('0x20')];var _0x6e76cb=_0x9b4d73?0x0:_0xd9cdd7['offset'];var _0x52e391=_0x9b4d73?_0x385f03[_0x1a2b('0x20')]:_0xd9cdd7['offset']+_0xd9cdd7['limit'];var _0x2789d9;if(_0x52e391>=_0x5e7e1f){_0x52e391=_0x5e7e1f;_0x2789d9=0xc8;}else{_0x2789d9=0xce;}_0x44cf95[_0x1a2b('0x1b')](_0x2789d9);return _0x44cf95[_0x1a2b('0x21')](_0x1a2b('0x22'),_0x6e76cb+'-'+_0x52e391+'/'+_0x5e7e1f)[_0x1a2b('0x1d')](_0x385f03);}return null;};}function patchUpdates(_0x10281c){return function(_0xbf88e6){try{jsonpatch['apply'](_0xbf88e6,_0x10281c,!![]);}catch(_0x287189){return BPromise[_0x1a2b('0x23')](_0x287189);}return _0xbf88e6[_0x1a2b('0x24')]();};}function saveUpdates(_0x4eabea,_0x19b1b6){return function(_0x51a327){if(_0x51a327){return _0x51a327[_0x1a2b('0x25')](_0x4eabea)['then'](function(_0x3ddf50){return _0x3ddf50;});}return null;};}function removeEntity(_0x318bc0,_0xdb1b40){return function(_0x194ec6){if(_0x194ec6){return _0x194ec6[_0x1a2b('0x26')]()[_0x1a2b('0x27')](function(){_0x318bc0[_0x1a2b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe27d6e,_0x35842b){return function(_0x1ac66d){if(!_0x1ac66d){_0xe27d6e['sendStatus'](0x194);}return _0x1ac66d;};}function handleError(_0x2348e7,_0x55ef10){_0x55ef10=_0x55ef10||0x1f4;return function(_0x9bf657){logger[_0x1a2b('0x28')](_0x9bf657[_0x1a2b('0x29')]);if(_0x9bf657['name']){delete _0x9bf657[_0x1a2b('0x2a')];}_0x2348e7[_0x1a2b('0x1b')](_0x55ef10)[_0x1a2b('0x2b')](_0x9bf657);};}exports[_0x1a2b('0x2c')]=function(_0x1a46e6,_0x448991){var _0x54a1da={},_0x53cbe6={},_0x6da023={'count':0x0,'rows':[]};var _0x34195e=_[_0x1a2b('0x2d')](db[_0x1a2b('0x2e')]['rawAttributes'],function(_0x255089){return{'name':_0x255089[_0x1a2b('0x2f')],'type':_0x255089[_0x1a2b('0x30')][_0x1a2b('0x31')]};});_0x53cbe6['model']=_[_0x1a2b('0x2d')](_0x34195e,_0x1a2b('0x2a'));_0x53cbe6['query']=_[_0x1a2b('0x32')](_0x1a46e6['query']);_0x53cbe6[_0x1a2b('0x33')]=_[_0x1a2b('0x34')](_0x53cbe6[_0x1a2b('0x35')],_0x53cbe6['query']);_0x54a1da[_0x1a2b('0x36')]=_[_0x1a2b('0x34')](_0x53cbe6[_0x1a2b('0x35')],qs[_0x1a2b('0x37')](_0x1a46e6['query']['fields']));_0x54a1da[_0x1a2b('0x36')]=_0x54a1da['attributes'][_0x1a2b('0x38')]?_0x54a1da['attributes']:_0x53cbe6[_0x1a2b('0x35')];if(!_0x1a46e6[_0x1a2b('0x39')][_0x1a2b('0x3a')](_0x1a2b('0x3b'))){_0x54a1da[_0x1a2b('0x3c')]=qs['limit'](_0x1a46e6[_0x1a2b('0x39')]['limit']);_0x54a1da['offset']=qs[_0x1a2b('0x1e')](_0x1a46e6['query'][_0x1a2b('0x1e')]);}_0x54a1da[_0x1a2b('0x3d')]=qs[_0x1a2b('0x3e')](_0x1a46e6[_0x1a2b('0x39')][_0x1a2b('0x3e')]);_0x54a1da['where']=qs[_0x1a2b('0x33')](_[_0x1a2b('0x3f')](_0x1a46e6[_0x1a2b('0x39')],_0x53cbe6[_0x1a2b('0x33')]),_0x34195e);if(_0x1a46e6[_0x1a2b('0x39')][_0x1a2b('0x40')]){_0x54a1da[_0x1a2b('0x41')]=_[_0x1a2b('0x42')](_0x54a1da[_0x1a2b('0x41')],{'$or':_[_0x1a2b('0x2d')](_0x34195e,function(_0x4573db){if(_0x4573db[_0x1a2b('0x30')]!=='VIRTUAL'){var _0x1d008d={};_0x1d008d[_0x4573db[_0x1a2b('0x2a')]]={'$like':'%'+_0x1a46e6[_0x1a2b('0x39')][_0x1a2b('0x40')]+'%'};return _0x1d008d;}})});}_0x54a1da=_[_0x1a2b('0x42')]({},_0x54a1da,_0x1a46e6['options']);var _0x407a1c={'where':_0x54a1da['where']};return db['ServicenowAccount'][_0x1a2b('0x20')](_0x407a1c)[_0x1a2b('0x27')](function(_0x56507c){_0x6da023[_0x1a2b('0x20')]=_0x56507c;if(_0x1a46e6[_0x1a2b('0x39')][_0x1a2b('0x43')]){_0x54a1da[_0x1a2b('0x44')]=[{'all':!![]}];}return db[_0x1a2b('0x2e')][_0x1a2b('0x45')](_0x54a1da);})[_0x1a2b('0x27')](function(_0x4f2551){_0x6da023[_0x1a2b('0x46')]=_0x4f2551;return _0x6da023;})[_0x1a2b('0x27')](respondWithFilteredResult(_0x448991,_0x54a1da))[_0x1a2b('0x47')](handleError(_0x448991,null));};exports[_0x1a2b('0x48')]=function(_0x5cb9af,_0xc1aad4){var _0x13db5a={'raw':![],'where':{'id':_0x5cb9af[_0x1a2b('0x49')]['id']}},_0x285029={};_0x285029['model']=_[_0x1a2b('0x32')](db[_0x1a2b('0x2e')][_0x1a2b('0x4a')]);_0x285029[_0x1a2b('0x39')]=_[_0x1a2b('0x32')](_0x5cb9af[_0x1a2b('0x39')]);_0x285029[_0x1a2b('0x33')]=_[_0x1a2b('0x34')](_0x285029[_0x1a2b('0x35')],_0x285029[_0x1a2b('0x39')]);_0x13db5a[_0x1a2b('0x36')]=_['intersection'](_0x285029[_0x1a2b('0x35')],qs[_0x1a2b('0x37')](_0x5cb9af[_0x1a2b('0x39')][_0x1a2b('0x37')]));_0x13db5a['attributes']=_0x13db5a[_0x1a2b('0x36')][_0x1a2b('0x38')]?_0x13db5a[_0x1a2b('0x36')]:_0x285029[_0x1a2b('0x35')];if(_0x5cb9af['query'][_0x1a2b('0x43')]){_0x13db5a[_0x1a2b('0x44')]=[{'all':!![]}];}_0x13db5a=_['merge']({},_0x13db5a,_0x5cb9af[_0x1a2b('0x4b')]);return db['ServicenowAccount'][_0x1a2b('0x4c')](_0x13db5a)[_0x1a2b('0x27')](handleEntityNotFound(_0xc1aad4,null))[_0x1a2b('0x27')](respondWithResult(_0xc1aad4,null))[_0x1a2b('0x47')](handleError(_0xc1aad4,null));};exports[_0x1a2b('0x4d')]=function(_0x4c75a1,_0x1a5b91){return db['ServicenowAccount'][_0x1a2b('0x4d')](_0x4c75a1['body'],{})[_0x1a2b('0x27')](respondWithResult(_0x1a5b91,0xc9))[_0x1a2b('0x47')](handleError(_0x1a5b91,null));};exports[_0x1a2b('0x25')]=function(_0x38c11d,_0x3bdb51){if(_0x38c11d['body']['id']){delete _0x38c11d[_0x1a2b('0x4e')]['id'];}return db[_0x1a2b('0x2e')][_0x1a2b('0x4c')]({'where':{'id':_0x38c11d[_0x1a2b('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bdb51,null))['then'](saveUpdates(_0x38c11d['body'],null))[_0x1a2b('0x27')](respondWithResult(_0x3bdb51,null))[_0x1a2b('0x47')](handleError(_0x3bdb51,null));};exports[_0x1a2b('0x26')]=function(_0x445d86,_0x54fe36){return db[_0x1a2b('0x2e')][_0x1a2b('0x4c')]({'where':{'id':_0x445d86[_0x1a2b('0x49')]['id']}})[_0x1a2b('0x27')](handleEntityNotFound(_0x54fe36,null))[_0x1a2b('0x27')](removeEntity(_0x54fe36,null))['catch'](handleError(_0x54fe36,null));};exports[_0x1a2b('0x4f')]=function(_0x30b078,_0x16da8d,_0x7071b9){var _0x288e04={};var _0x4e1332={};var _0x5d1298;var _0x424375;return db['ServicenowAccount']['findOne']({'where':{'id':_0x30b078[_0x1a2b('0x49')]['id']}})['then'](handleEntityNotFound(_0x16da8d,null))[_0x1a2b('0x27')](function(_0x33011b){if(_0x33011b){_0x5d1298=_0x33011b;_0x4e1332[_0x1a2b('0x35')]=_[_0x1a2b('0x32')](db[_0x1a2b('0x50')][_0x1a2b('0x4a')]);_0x4e1332['query']=_[_0x1a2b('0x32')](_0x30b078[_0x1a2b('0x39')]);_0x4e1332['filters']=_['intersection'](_0x4e1332[_0x1a2b('0x35')],_0x4e1332['query']);_0x288e04[_0x1a2b('0x36')]=_['intersection'](_0x4e1332[_0x1a2b('0x35')],qs[_0x1a2b('0x37')](_0x30b078[_0x1a2b('0x39')][_0x1a2b('0x37')]));_0x288e04[_0x1a2b('0x36')]=_0x288e04['attributes'][_0x1a2b('0x38')]?_0x288e04[_0x1a2b('0x36')]:_0x4e1332['model'];_0x288e04['order']=qs[_0x1a2b('0x3e')](_0x30b078[_0x1a2b('0x39')][_0x1a2b('0x3e')]);_0x288e04['where']=qs[_0x1a2b('0x33')](_[_0x1a2b('0x3f')](_0x30b078['query'],_0x4e1332[_0x1a2b('0x33')]));if(_0x30b078[_0x1a2b('0x39')]['filter']){_0x288e04[_0x1a2b('0x41')]=_[_0x1a2b('0x42')](_0x288e04[_0x1a2b('0x41')],{'$or':_[_0x1a2b('0x2d')](_0x288e04['attributes'],function(_0x5a9ba4){var _0x288312={};_0x288312[_0x5a9ba4]={'$like':'%'+_0x30b078[_0x1a2b('0x39')][_0x1a2b('0x40')]+'%'};return _0x288312;})});}_0x288e04=_[_0x1a2b('0x42')]({},_0x288e04,_0x30b078['options']);return _0x5d1298[_0x1a2b('0x4f')](_0x288e04);}})[_0x1a2b('0x27')](function(_0x204c36){if(_0x204c36){_0x424375=_0x204c36[_0x1a2b('0x38')];if(!_0x30b078[_0x1a2b('0x39')][_0x1a2b('0x3a')](_0x1a2b('0x3b'))){_0x288e04[_0x1a2b('0x3c')]=qs[_0x1a2b('0x3c')](_0x30b078['query'][_0x1a2b('0x3c')]);_0x288e04[_0x1a2b('0x1e')]=qs[_0x1a2b('0x1e')](_0x30b078[_0x1a2b('0x39')][_0x1a2b('0x1e')]);}return _0x5d1298[_0x1a2b('0x4f')](_0x288e04);}})[_0x1a2b('0x27')](function(_0x8319bb){if(_0x8319bb){return _0x8319bb?{'count':_0x424375,'rows':_0x8319bb}:null;}})[_0x1a2b('0x27')](respondWithResult(_0x16da8d,null))[_0x1a2b('0x47')](handleError(_0x16da8d,null));};exports[_0x1a2b('0x51')]=function(_0x2d8731,_0x6e5784,_0x1c2524){if(_0x2d8731[_0x1a2b('0x4e')]['id']){delete _0x2d8731['body']['id'];}return db[_0x1a2b('0x2e')][_0x1a2b('0x52')]({'where':{'id':_0x2d8731[_0x1a2b('0x49')]['id']}})[_0x1a2b('0x27')](handleEntityNotFound(_0x6e5784,null))['then'](function(_0x488e3b){if(_0x488e3b){_0x2d8731[_0x1a2b('0x4e')][_0x1a2b('0x53')]=_0x488e3b['id'];_0x2d8731[_0x1a2b('0x4e')][_0x1a2b('0x54')]=integrations['getSubjects'](_0x2d8731['body'][_0x1a2b('0x55')],_0x2d8731[_0x1a2b('0x4e')][_0x1a2b('0x30')]);_0x2d8731[_0x1a2b('0x4e')][_0x1a2b('0x56')]=integrations['getDescriptions'](_0x2d8731[_0x1a2b('0x4e')][_0x1a2b('0x55')],_0x2d8731[_0x1a2b('0x4e')][_0x1a2b('0x30')]);return db[_0x1a2b('0x50')][_0x1a2b('0x4d')](_0x2d8731[_0x1a2b('0x4e')],{'include':[{'model':db[_0x1a2b('0x57')],'as':_0x1a2b('0x54')},{'model':db[_0x1a2b('0x57')],'as':_0x1a2b('0x56')}]});}return null;})[_0x1a2b('0x27')](respondWithResult(_0x6e5784,null))[_0x1a2b('0x47')](handleError(_0x6e5784,null));};exports[_0x1a2b('0x58')]=function(_0x51b174,_0x1fa39a,_0x478f41){var _0x5266a6=['made_sla',_0x1a2b('0x59'),_0x1a2b('0x5a'),'subcategory',_0x1a2b('0x5b'),_0x1a2b('0x5c'),_0x1a2b('0x5d'),_0x1a2b('0x5e'),_0x1a2b('0x5f')];var _0x590d02=['parent',_0x1a2b('0x60'),_0x1a2b('0x61'),'watch_list',_0x1a2b('0x62'),'sys_updated_on',_0x1a2b('0x63'),_0x1a2b('0x59'),_0x1a2b('0x64'),_0x1a2b('0x65'),'resolved_by',_0x1a2b('0x66'),_0x1a2b('0x67'),_0x1a2b('0x68'),'sys_created_on',_0x1a2b('0x69'),_0x1a2b('0x6a'),_0x1a2b('0x6b'),'knowledge','order',_0x1a2b('0x6c'),_0x1a2b('0x6d'),_0x1a2b('0x6e'),'delivery_plan','impact','active',_0x1a2b('0x6f'),_0x1a2b('0x70'),_0x1a2b('0x71'),_0x1a2b('0x72'),'rfc',_0x1a2b('0x73'),'expected_start',_0x1a2b('0x74'),_0x1a2b('0x75'),'group_list','work_end','reopened_time',_0x1a2b('0x76'),'caller_id',_0x1a2b('0x77'),_0x1a2b('0x78'),_0x1a2b('0x79'),'short_description',_0x1a2b('0x5b'),_0x1a2b('0x7a'),_0x1a2b('0x7b'),'work_start',_0x1a2b('0x7c'),'business_stc',_0x1a2b('0x7d'),'description',_0x1a2b('0x7e'),_0x1a2b('0x5c'),_0x1a2b('0x7f'),_0x1a2b('0x80'),_0x1a2b('0x81'),'follow_up',_0x1a2b('0x82'),_0x1a2b('0x83'),_0x1a2b('0x84'),'reopened_by',_0x1a2b('0x5d'),_0x1a2b('0x85'),'problem_id',_0x1a2b('0x86'),_0x1a2b('0x87'),'activity_due',_0x1a2b('0x88'),'severity',_0x1a2b('0x89'),_0x1a2b('0x8a'),_0x1a2b('0x8b'),_0x1a2b('0x8c'),'due_date',_0x1a2b('0x8d'),'reopen_count',_0x1a2b('0x8e'),_0x1a2b('0x8f'),_0x1a2b('0x90'),'correlation_id',_0x1a2b('0x91'),_0x1a2b('0x5f')];var _0x42332a='';var _0x4ba647='';var _0x19f881=[];var _0x30da24='';var _0x3afecf='';var _0x4003a5=[];var _0x4099ac='';var _0x34de04='';var _0x2e0178={};var _0x580979='';return db['ServicenowAccount'][_0x1a2b('0x52')]({'where':{'id':_0x51b174['params']['id']},'attributes':['id',_0x1a2b('0x92'),_0x1a2b('0x93'),_0x1a2b('0x94'),_0x1a2b('0x95'),_0x1a2b('0x96')]})['then'](handleEntityNotFound(_0x1fa39a,null))[_0x1a2b('0x27')](function(_0x1ebf81){if(_0x1ebf81){_0x580979=_0x1ebf81[_0x1a2b('0x95')];var _0x458c56=_0x580979[_0x1a2b('0x97')](-0x1);if(_0x458c56==='/'){_0x580979=_0x580979[_0x1a2b('0x98')](0x0,_0x580979[_0x1a2b('0x99')](_0x458c56));}_0x34de04=util['format'](_0x1a2b('0x9a'),_0x580979);_0x4099ac=util['format'](_0x1a2b('0x9b'),_0x580979);_0x2e0178={'user':_0x1ebf81[_0x1a2b('0x92')],'pass':_0x1ebf81[_0x1a2b('0x93')]};var _0x2aa561={'method':_0x1a2b('0x9c'),'uri':_0x34de04+'incident?sysparm_display_value=all','auth':_0x2e0178,'json':!![]};return rp(_0x2aa561);}})[_0x1a2b('0x27')](function(_0xe8c2c2){if(_0xe8c2c2['result']['length']>0x0){_0x42332a=_0xe8c2c2[_0x1a2b('0x9d')];}console[_0x1a2b('0x9e')]('incident\x20table\x20objects',_0x42332a);_0x4003a5=[];_0x4ba647=Object[_0x1a2b('0x9f')]([],_0x42332a);_[_0x1a2b('0xa0')](_0x4ba647,function(_0x208482){return!_0x5266a6[_0x1a2b('0xa1')](_0x208482[_0x1a2b('0x2a')]);});_0x4ba647[_0x1a2b('0xa2')](function(_0x1a13fa){var _0x466a13=createFieldObject(_0x4099ac,_0x2e0178,_0x1a13fa[_0x1a2b('0xa3')],_0x1a13fa[_0x1a2b('0x2a')],_0x1a13fa[_0x1a2b('0xa4')],![]);_0x4003a5['push'](_0x466a13);});return Promise[_0x1a2b('0xa5')](_0x4003a5);})[_0x1a2b('0x27')](function(_0x27f0fe){_0x19f881=_0x27f0fe;_0x30da24=Object[_0x1a2b('0x9f')]([],_0x42332a);console[_0x1a2b('0x9e')](_0x1a2b('0xa6'),_0x42332a);_[_0x1a2b('0xa0')](_0x30da24,function(_0x560111){return _0x590d02[_0x1a2b('0xa1')](_0x560111[_0x1a2b('0x2a')]);});console[_0x1a2b('0x9e')](_0x1a2b('0xa7'),_0x30da24);_0x4003a5=[];_0x30da24[_0x1a2b('0xa2')](function(_0x4bd2ef){var _0x576df4=createFieldObject(_0x4099ac,_0x2e0178,_0x4bd2ef['internalType'],_0x4bd2ef[_0x1a2b('0x2a')],_0x4bd2ef[_0x1a2b('0xa4')],!![]);_0x4003a5[_0x1a2b('0xa8')](_0x576df4);});return Promise['all'](_0x4003a5);})[_0x1a2b('0x27')](function(_0x47d16e){_0x3afecf=_0x47d16e;var _0x4959c9=_0x19f881[_0x1a2b('0xa9')](_0x3afecf);return{'count':_0x4959c9[_0x1a2b('0x38')],'rows':_0x4959c9};})[_0x1a2b('0x27')](respondWithResult(_0x1fa39a,null))[_0x1a2b('0x47')](function(_0x391b9a){console[_0x1a2b('0x9e')](_0x1a2b('0xaa')+_0x391b9a);var _0x451be1=_0x51b174[_0x1a2b('0x39')]['test']?0x1f4:_0x391b9a['statusCode']||0x1f4;logger[_0x1a2b('0x28')](_0x391b9a['stack']);delete _0x391b9a[_0x1a2b('0x2a')];if(_0x451be1===0x191){_0x451be1=0x190;}_0x1fa39a['status'](_0x451be1)[_0x1a2b('0x2b')](_0x51b174[_0x1a2b('0x39')][_0x1a2b('0xab')]?{'message':'Wrong\x20credentials','statusCode':_0x391b9a[_0x1a2b('0xac')]}:_0x391b9a);});};function createFieldObject(_0x3b65f2,_0x3661fb,_0x45b661,_0x550a96,_0xc0c2f7,_0x26844e){return new Promise(function(_0x24d111,_0xf47460){var _0x52c8b1={'id':_0x550a96,'name':_0xc0c2f7,'custom':_0x26844e};if(_0x45b661==='boolean'){_0x52c8b1[_0x1a2b('0x4b')]=[{'name':'True','value':_0x1a2b('0xad')},{'name':_0x1a2b('0xae'),'value':'false'}];_0x24d111(_0x52c8b1);}else{var _0x10caa0={'method':_0x1a2b('0x9c'),'uri':_0x3b65f2+'sys_choice?sysparm_query=name=incident^element='+_0x550a96,'auth':_0x3661fb,'json':!![]};return rp(_0x10caa0)[_0x1a2b('0x27')](function(_0x592d69){var _0xbdb4f7=[];if(_0x592d69[_0x1a2b('0x9d')][_0x1a2b('0x38')]>0x0){_0x592d69[_0x1a2b('0x9d')]['forEach'](function(_0x49b208){if(_0x49b208[_0x1a2b('0xaf')]===_0x1a2b('0xb0')){var _0x28a26e={'name':_0x49b208['label'],'value':_0x49b208['value']};_0xbdb4f7[_0x1a2b('0xa8')](_0x28a26e);}});}_0x52c8b1[_0x1a2b('0x4b')]=_0xbdb4f7;if(_0x52c8b1[_0x1a2b('0x4b')][_0x1a2b('0x38')]>0x0){_0x24d111(_0x52c8b1);}else{if(_0x26844e==![]){_0x24d111();}else{_0x24d111(_0x52c8b1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 2efdf6e..aa2ffed 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 _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','int_servicenow_accounts','util'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0x6f47,0xc7));var _0x76f4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6f47[_0x126558];return _0x1f6d14;};'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'));var integrations=require(_0x76f4('0x7'));module['exports']=function(_0x35602f,_0xfc2405){return _0x35602f[_0x76f4('0x8')]('ServicenowAccount',attributes,{'tableName':_0x76f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment'];(function(_0x1270c1,_0x54ea60){var _0xbc351=function(_0x5aeeae){while(--_0x5aeeae){_0x1270c1['push'](_0x1270c1['shift']());}};_0xbc351(++_0x54ea60);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));var integrations=require(_0xd46e('0x8'));module[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return _0x25cf78[_0xd46e('0xa')](_0xd46e('0xb'),attributes,{'tableName':_0xd46e('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 5621930..d6ce600 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 _0x8ae2=['info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','ServicenowAccount','options','raw','where','include','model','attributes','map','then','GetServicenowAccount','ShowServicenowAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','client','http','request'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x8ae2,0x140));var _0x28ae=function(_0x331226,_0x4a49e7){_0x331226=_0x331226-0x0;var _0x4866ce=_0x8ae2[_0x331226];return _0x4866ce;};'use strict';var _=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var moment=require(_0x28ae('0x2'));var BPromise=require(_0x28ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28ae('0x4'));var db=require(_0x28ae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x28ae('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x28ae('0x7')][_0x28ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1debf2,_0x40a175,_0x328f8e){return new BPromise(function(_0x3ce5d6,_0x3491a1){return client[_0x28ae('0x9')](_0x1debf2,_0x328f8e)['then'](function(_0x390c6d){logger[_0x28ae('0xa')](_0x28ae('0xb'),_0x40a175,'request\x20sent');logger[_0x28ae('0xc')](_0x28ae('0xd'),_0x40a175,'request\x20sent',JSON['stringify'](_0x390c6d));if(_0x390c6d['error']){if(_0x390c6d[_0x28ae('0xe')][_0x28ae('0xf')]===0x1f4){logger[_0x28ae('0xe')](_0x28ae('0xb'),_0x40a175,_0x390c6d['error'][_0x28ae('0x10')]);return _0x3491a1(_0x390c6d[_0x28ae('0xe')][_0x28ae('0x10')]);}logger[_0x28ae('0xe')](_0x28ae('0xb'),_0x40a175,_0x390c6d[_0x28ae('0xe')][_0x28ae('0x10')]);return _0x3ce5d6(_0x390c6d[_0x28ae('0xe')][_0x28ae('0x10')]);}else{logger['info'](_0x28ae('0xb'),_0x40a175,_0x28ae('0x11'));_0x3ce5d6(_0x390c6d[_0x28ae('0x12')][_0x28ae('0x10')]);}})[_0x28ae('0x13')](function(_0x28761e){logger[_0x28ae('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x40a175,_0x28761e);_0x3491a1(_0x28761e);});});}exports['GetServicenowAccount']=function(_0x90d212){var _0x3387c9=this;return new Promise(function(_0x4938c5,_0x1edb39){return db[_0x28ae('0x14')]['findAll']({'raw':_0x90d212[_0x28ae('0x15')]?_0x90d212['options'][_0x28ae('0x16')]===undefined?!![]:![]:!![],'where':_0x90d212[_0x28ae('0x15')]?_0x90d212[_0x28ae('0x15')][_0x28ae('0x17')]||null:null,'attributes':_0x90d212[_0x28ae('0x15')]?_0x90d212['options']['attributes']||null:null,'limit':_0x90d212['options']?_0x90d212[_0x28ae('0x15')]['limit']||null:null,'include':_0x90d212[_0x28ae('0x15')]?_0x90d212[_0x28ae('0x15')][_0x28ae('0x18')]?_['map'](_0x90d212[_0x28ae('0x15')][_0x28ae('0x18')],function(_0x184424){return{'model':db[_0x184424[_0x28ae('0x19')]],'as':_0x184424['as'],'attributes':_0x184424[_0x28ae('0x1a')],'include':_0x184424[_0x28ae('0x18')]?_[_0x28ae('0x1b')](_0x184424[_0x28ae('0x18')],function(_0x30a875){return{'model':db[_0x30a875['model']],'as':_0x30a875['as'],'attributes':_0x30a875[_0x28ae('0x1a')],'include':_0x30a875[_0x28ae('0x18')]?_[_0x28ae('0x1b')](_0x30a875['include'],function(_0x1ab589){return{'model':db[_0x1ab589[_0x28ae('0x19')]],'as':_0x1ab589['as'],'attributes':_0x1ab589[_0x28ae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x28ae('0x1c')](function(_0x3776e6){logger[_0x28ae('0xa')](_0x28ae('0x1d'),_0x90d212);logger['debug']('GetServicenowAccount',_0x90d212,JSON['stringify'](_0x3776e6));_0x4938c5(_0x3776e6);})['catch'](function(_0x5e130d){logger['error'](_0x28ae('0x1d'),_0x5e130d['message'],_0x90d212);_0x1edb39(_0x3387c9[_0x28ae('0xe')](0x1f4,_0x5e130d['message']));});});};exports[_0x28ae('0x1e')]=function(_0x187781){var _0x38112b=this;return new Promise(function(_0x1843d1,_0x46c4f8){return db[_0x28ae('0x14')][_0x28ae('0x1f')]({'raw':_0x187781[_0x28ae('0x15')]?_0x187781['options']['raw']===undefined?!![]:![]:!![],'where':_0x187781[_0x28ae('0x15')]?_0x187781['options'][_0x28ae('0x17')]||null:null,'attributes':_0x187781[_0x28ae('0x15')]?_0x187781[_0x28ae('0x15')]['attributes']||null:null,'include':_0x187781[_0x28ae('0x15')]?_0x187781['options']['include']?_[_0x28ae('0x1b')](_0x187781[_0x28ae('0x15')][_0x28ae('0x18')],function(_0x402dbf){return{'model':db[_0x402dbf[_0x28ae('0x19')]],'as':_0x402dbf['as'],'attributes':_0x402dbf[_0x28ae('0x1a')],'include':_0x402dbf[_0x28ae('0x18')]?_['map'](_0x402dbf[_0x28ae('0x18')],function(_0x3a2586){return{'model':db[_0x3a2586[_0x28ae('0x19')]],'as':_0x3a2586['as'],'attributes':_0x3a2586[_0x28ae('0x1a')],'include':_0x3a2586[_0x28ae('0x18')]?_['map'](_0x3a2586['include'],function(_0x1e0596){return{'model':db[_0x1e0596[_0x28ae('0x19')]],'as':_0x1e0596['as'],'attributes':_0x1e0596['attributes']};}):[]};}):[]};}):[]:[]})[_0x28ae('0x1c')](function(_0x3f0410){logger['info']('ShowServicenowAccount',_0x187781);logger[_0x28ae('0xc')](_0x28ae('0x1e'),_0x187781,JSON[_0x28ae('0x20')](_0x3f0410));_0x1843d1(_0x3f0410);})[_0x28ae('0x13')](function(_0x5d7061){logger[_0x28ae('0xe')](_0x28ae('0x1e'),_0x5d7061[_0x28ae('0x10')],_0x187781);_0x46c4f8(_0x38112b[_0x28ae('0xe')](0x1f4,_0x5d7061[_0x28ae('0x10')]));});});}; \ No newline at end of file +var _0x131c=['../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','include','model','attributes','map','then','stringify','catch','ShowServicenowAccount','find','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x4f704d,_0x47354a){var _0x15ae1f=function(_0x3fd689){while(--_0x3fd689){_0x4f704d['push'](_0x4f704d['shift']());}};_0x15ae1f(++_0x47354a);}(_0x131c,0x12c));var _0xc131=function(_0x59eb87,_0xb8ecc3){_0x59eb87=_0x59eb87-0x0;var _0x586a4f=_0x131c[_0x59eb87];return _0x586a4f;};'use strict';var _=require(_0xc131('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc131('0x1'));var rs=require(_0xc131('0x2'));var fs=require('fs');var Redis=require(_0xc131('0x3'));var db=require(_0xc131('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc131('0x5'));var config=require(_0xc131('0x6'));var jayson=require(_0xc131('0x7'));var client=jayson[_0xc131('0x8')][_0xc131('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14682b,_0xfb8071,_0x472ebe){return new BPromise(function(_0x375970,_0x183174){return client[_0xc131('0xa')](_0x14682b,_0x472ebe)['then'](function(_0x342dcf){logger[_0xc131('0xb')](_0xc131('0xc'),_0xfb8071,'request\x20sent');logger[_0xc131('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xfb8071,_0xc131('0xe'),JSON['stringify'](_0x342dcf));if(_0x342dcf['error']){if(_0x342dcf[_0xc131('0xf')][_0xc131('0x10')]===0x1f4){logger[_0xc131('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0xfb8071,_0x342dcf[_0xc131('0xf')]['message']);return _0x183174(_0x342dcf[_0xc131('0xf')][_0xc131('0x11')]);}logger[_0xc131('0xf')](_0xc131('0xc'),_0xfb8071,_0x342dcf[_0xc131('0xf')][_0xc131('0x11')]);return _0x375970(_0x342dcf['error'][_0xc131('0x11')]);}else{logger[_0xc131('0xb')](_0xc131('0xc'),_0xfb8071,_0xc131('0xe'));_0x375970(_0x342dcf[_0xc131('0x12')][_0xc131('0x11')]);}})['catch'](function(_0x1427c1){logger[_0xc131('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0xfb8071,_0x1427c1);_0x183174(_0x1427c1);});});}exports[_0xc131('0x13')]=function(_0x1f33d7){var _0x58efb4=this;return new Promise(function(_0x95c334,_0x1b198b){return db[_0xc131('0x14')][_0xc131('0x15')]({'raw':_0x1f33d7[_0xc131('0x16')]?_0x1f33d7[_0xc131('0x16')][_0xc131('0x17')]===undefined?!![]:![]:!![],'where':_0x1f33d7['options']?_0x1f33d7['options']['where']||null:null,'attributes':_0x1f33d7[_0xc131('0x16')]?_0x1f33d7['options']['attributes']||null:null,'limit':_0x1f33d7[_0xc131('0x16')]?_0x1f33d7[_0xc131('0x16')]['limit']||null:null,'include':_0x1f33d7[_0xc131('0x16')]?_0x1f33d7['options']['include']?_['map'](_0x1f33d7[_0xc131('0x16')][_0xc131('0x18')],function(_0x238cff){return{'model':db[_0x238cff[_0xc131('0x19')]],'as':_0x238cff['as'],'attributes':_0x238cff['attributes'],'include':_0x238cff[_0xc131('0x18')]?_['map'](_0x238cff[_0xc131('0x18')],function(_0xdfac64){return{'model':db[_0xdfac64[_0xc131('0x19')]],'as':_0xdfac64['as'],'attributes':_0xdfac64[_0xc131('0x1a')],'include':_0xdfac64[_0xc131('0x18')]?_[_0xc131('0x1b')](_0xdfac64[_0xc131('0x18')],function(_0x8b74ce){return{'model':db[_0x8b74ce[_0xc131('0x19')]],'as':_0x8b74ce['as'],'attributes':_0x8b74ce[_0xc131('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc131('0x1c')](function(_0xc250be){logger[_0xc131('0xb')](_0xc131('0x13'),_0x1f33d7);logger['debug'](_0xc131('0x13'),_0x1f33d7,JSON[_0xc131('0x1d')](_0xc250be));_0x95c334(_0xc250be);})[_0xc131('0x1e')](function(_0x47dea9){logger[_0xc131('0xf')]('GetServicenowAccount',_0x47dea9[_0xc131('0x11')],_0x1f33d7);_0x1b198b(_0x58efb4[_0xc131('0xf')](0x1f4,_0x47dea9['message']));});});};exports[_0xc131('0x1f')]=function(_0x4b2964){var _0x208464=this;return new Promise(function(_0x3604dc,_0x48b95b){return db[_0xc131('0x14')][_0xc131('0x20')]({'raw':_0x4b2964[_0xc131('0x16')]?_0x4b2964[_0xc131('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4b2964[_0xc131('0x16')]?_0x4b2964[_0xc131('0x16')][_0xc131('0x21')]||null:null,'attributes':_0x4b2964[_0xc131('0x16')]?_0x4b2964[_0xc131('0x16')]['attributes']||null:null,'include':_0x4b2964[_0xc131('0x16')]?_0x4b2964[_0xc131('0x16')]['include']?_[_0xc131('0x1b')](_0x4b2964[_0xc131('0x16')][_0xc131('0x18')],function(_0x4d8d69){return{'model':db[_0x4d8d69[_0xc131('0x19')]],'as':_0x4d8d69['as'],'attributes':_0x4d8d69[_0xc131('0x1a')],'include':_0x4d8d69['include']?_[_0xc131('0x1b')](_0x4d8d69[_0xc131('0x18')],function(_0x594489){return{'model':db[_0x594489[_0xc131('0x19')]],'as':_0x594489['as'],'attributes':_0x594489[_0xc131('0x1a')],'include':_0x594489[_0xc131('0x18')]?_[_0xc131('0x1b')](_0x594489[_0xc131('0x18')],function(_0xa0109d){return{'model':db[_0xa0109d[_0xc131('0x19')]],'as':_0xa0109d['as'],'attributes':_0xa0109d[_0xc131('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45cbd6){logger[_0xc131('0xb')](_0xc131('0x1f'),_0x4b2964);logger[_0xc131('0xd')]('ShowServicenowAccount',_0x4b2964,JSON[_0xc131('0x1d')](_0x45cbd6));_0x3604dc(_0x45cbd6);})['catch'](function(_0x1f4c7e){logger[_0xc131('0xf')](_0xc131('0x1f'),_0x1f4c7e[_0xc131('0x11')],_0x4b2964);_0x48b95b(_0x208464[_0xc131('0xf')](0x1f4,_0x1f4c7e[_0xc131('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 09dfa00..b92bd56 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 _0x89d3=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x89d3,0xa3));var _0x389d=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x89d3[_0x33fcbb];return _0x2efe40;};'use strict';var multer=require(_0x389d('0x0'));var util=require(_0x389d('0x1'));var path=require(_0x389d('0x2'));var timeout=require('connect-timeout');var express=require(_0x389d('0x3'));var router=express[_0x389d('0x4')]();var fs_extra=require(_0x389d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x389d('0x6'));var config=require(_0x389d('0x7'));var controller=require(_0x389d('0x8'));router['get']('/',auth[_0x389d('0x9')](),controller[_0x389d('0xa')]);router[_0x389d('0xb')]('/:id',auth[_0x389d('0x9')](),controller['show']);router[_0x389d('0xb')]('/:id/fields',auth[_0x389d('0x9')](),controller[_0x389d('0xc')]);router['get'](_0x389d('0xd'),auth[_0x389d('0x9')](),controller[_0x389d('0xe')]);router[_0x389d('0xb')]('/:id/descriptions',auth[_0x389d('0x9')](),controller[_0x389d('0xf')]);router[_0x389d('0x10')]('/',auth['isAuthenticated'](),controller[_0x389d('0x11')]);router[_0x389d('0x12')](_0x389d('0x13'),auth['isAuthenticated'](),controller[_0x389d('0x14')]);router[_0x389d('0x15')](_0x389d('0x13'),auth[_0x389d('0x9')](),controller[_0x389d('0x16')]);module[_0x389d('0x17')]=router; \ No newline at end of file +var _0xee12=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0xee12,0x184));var _0x2ee1=function(_0xb0ad6c,_0x1e6c5b){_0xb0ad6c=_0xb0ad6c-0x0;var _0x35b9b6=_0xee12[_0xb0ad6c];return _0x35b9b6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2ee1('0x0'));var timeout=require(_0x2ee1('0x1'));var express=require('express');var router=express[_0x2ee1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2ee1('0x3'));var interaction=require(_0x2ee1('0x4'));var config=require(_0x2ee1('0x5'));var controller=require(_0x2ee1('0x6'));router[_0x2ee1('0x7')]('/',auth[_0x2ee1('0x8')](),controller[_0x2ee1('0x9')]);router[_0x2ee1('0x7')](_0x2ee1('0xa'),auth[_0x2ee1('0x8')](),controller[_0x2ee1('0xb')]);router[_0x2ee1('0x7')](_0x2ee1('0xc'),auth['isAuthenticated'](),controller[_0x2ee1('0xd')]);router[_0x2ee1('0x7')](_0x2ee1('0xe'),auth[_0x2ee1('0x8')](),controller['getSubjects']);router['get'](_0x2ee1('0xf'),auth[_0x2ee1('0x8')](),controller['getDescriptions']);router[_0x2ee1('0x10')]('/',auth['isAuthenticated'](),controller[_0x2ee1('0x11')]);router[_0x2ee1('0x12')](_0x2ee1('0xa'),auth[_0x2ee1('0x8')](),controller['update']);router[_0x2ee1('0x13')](_0x2ee1('0xa'),auth['isAuthenticated'](),controller[_0x2ee1('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index d4fa0e3..edbf058 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 _0x4994=['STRING','sequelize','exports'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x4994,0x169));var _0x4499=function(_0x58c4ba,_0xadb551){_0x58c4ba=_0x58c4ba-0x0;var _0x4a8317=_0x4994[_0x58c4ba];return _0x4a8317;};'use strict';var Sequelize=require(_0x4499('0x0'));module[_0x4499('0x1')]={'name':{'type':Sequelize[_0x4499('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x144a=['STRING','sequelize','exports'];(function(_0x3f6a80,_0x3b11f3){var _0x5d6307=function(_0x1178a8){while(--_0x1178a8){_0x3f6a80['push'](_0x3f6a80['shift']());}};_0x5d6307(++_0x3b11f3);}(_0x144a,0x1a5));var _0xa144=function(_0x5cfd0c,_0x418c4a){_0x5cfd0c=_0x5cfd0c-0x0;var _0x5740a9=_0x144a[_0x5cfd0c];return _0x5740a9;};'use strict';var Sequelize=require(_0xa144('0x0'));module[_0xa144('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa144('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index c7fc965..e41e8aa 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 _0xdadb=['body','getFields','findOne','ServicenowField','options','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','include','rows','show','params','includeAll','merge','find','catch','create'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xdadb,0x15a));var _0xbdad=function(_0x5ad262,_0x2c6555){_0x5ad262=_0x5ad262-0x0;var _0x5d72cf=_0xdadb[_0x5ad262];return _0x5d72cf;};'use strict';var emlformat=require(_0xbdad('0x0'));var rimraf=require(_0xbdad('0x1'));var zipdir=require(_0xbdad('0x2'));var jsonpatch=require(_0xbdad('0x3'));var rp=require(_0xbdad('0x4'));var moment=require('moment');var BPromise=require(_0xbdad('0x5'));var Mustache=require(_0xbdad('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbdad('0x7'));var ejs=require(_0xbdad('0x8'));var fs=require('fs');var fs_extra=require(_0xbdad('0x9'));var _=require(_0xbdad('0xa'));var squel=require(_0xbdad('0xb'));var crypto=require(_0xbdad('0xc'));var jsforce=require(_0xbdad('0xd'));var deskjs=require(_0xbdad('0xe'));var toCsv=require(_0xbdad('0x7'));var querystring=require(_0xbdad('0xf'));var Papa=require(_0xbdad('0x10'));var Redis=require(_0xbdad('0x11'));var authService=require(_0xbdad('0x12'));var qs=require(_0xbdad('0x13'));var as=require(_0xbdad('0x14'));var hardwareService=require(_0xbdad('0x15'));var logger=require(_0xbdad('0x16'))(_0xbdad('0x17'));var utils=require(_0xbdad('0x18'));var config=require(_0xbdad('0x19'));var licenseUtil=require(_0xbdad('0x1a'));var db=require(_0xbdad('0x1b'))['db'];function respondWithStatusCode(_0x4c8ca7,_0x351ebf){_0x351ebf=_0x351ebf||0xcc;return function(_0x59645d){if(_0x59645d){return _0x4c8ca7['sendStatus'](_0x351ebf);}return _0x4c8ca7[_0xbdad('0x1c')](_0x351ebf)[_0xbdad('0x1d')]();};}function respondWithResult(_0xbda897,_0x30d29d){_0x30d29d=_0x30d29d||0xc8;return function(_0x478d87){if(_0x478d87){return _0xbda897[_0xbdad('0x1c')](_0x30d29d)[_0xbdad('0x1e')](_0x478d87);}};}function respondWithFilteredResult(_0x684513,_0x23010b){return function(_0x4b55c9){if(_0x4b55c9){var _0x29dcf4=typeof _0x23010b[_0xbdad('0x1f')]===_0xbdad('0x20')&&typeof _0x23010b['limit']===_0xbdad('0x20');var _0x56bac7=_0x4b55c9[_0xbdad('0x21')];var _0xa75755=_0x29dcf4?0x0:_0x23010b[_0xbdad('0x1f')];var _0x1871f8=_0x29dcf4?_0x4b55c9['count']:_0x23010b['offset']+_0x23010b[_0xbdad('0x22')];var _0x178f08;if(_0x1871f8>=_0x56bac7){_0x1871f8=_0x56bac7;_0x178f08=0xc8;}else{_0x178f08=0xce;}_0x684513[_0xbdad('0x1c')](_0x178f08);return _0x684513[_0xbdad('0x23')](_0xbdad('0x24'),_0xa75755+'-'+_0x1871f8+'/'+_0x56bac7)[_0xbdad('0x1e')](_0x4b55c9);}return null;};}function patchUpdates(_0x22932d){return function(_0x22e371){try{jsonpatch[_0xbdad('0x25')](_0x22e371,_0x22932d,!![]);}catch(_0x9652bf){return BPromise[_0xbdad('0x26')](_0x9652bf);}return _0x22e371[_0xbdad('0x27')]();};}function saveUpdates(_0x3627f9,_0x1ae34e){return function(_0x3dc29c){if(_0x3dc29c){return _0x3dc29c[_0xbdad('0x28')](_0x3627f9)[_0xbdad('0x29')](function(_0x2957cc){return _0x2957cc;});}return null;};}function removeEntity(_0x405fca,_0x3de3fd){return function(_0x5b43dd){if(_0x5b43dd){return _0x5b43dd[_0xbdad('0x2a')]()[_0xbdad('0x29')](function(){_0x405fca[_0xbdad('0x1c')](0xcc)[_0xbdad('0x1d')]();});}};}function handleEntityNotFound(_0x4288d8,_0x278dac){return function(_0x50941a){if(!_0x50941a){_0x4288d8[_0xbdad('0x2b')](0x194);}return _0x50941a;};}function handleError(_0x2e5fc0,_0x1e0e51){_0x1e0e51=_0x1e0e51||0x1f4;return function(_0x2cdfaf){logger[_0xbdad('0x2c')](_0x2cdfaf[_0xbdad('0x2d')]);if(_0x2cdfaf[_0xbdad('0x2e')]){delete _0x2cdfaf['name'];}_0x2e5fc0[_0xbdad('0x1c')](_0x1e0e51)[_0xbdad('0x2f')](_0x2cdfaf);};}exports[_0xbdad('0x30')]=function(_0x39de70,_0x5c29df){var _0x2633b4={},_0x4643d0={},_0x4ffbad={'count':0x0,'rows':[]};var _0x38bac3=_[_0xbdad('0x31')](db[_0xbdad('0x32')][_0xbdad('0x33')],function(_0x3ddad7){return{'name':_0x3ddad7['fieldName'],'type':_0x3ddad7[_0xbdad('0x34')][_0xbdad('0x35')]};});_0x4643d0['model']=_[_0xbdad('0x31')](_0x38bac3,_0xbdad('0x2e'));_0x4643d0[_0xbdad('0x36')]=_[_0xbdad('0x37')](_0x39de70[_0xbdad('0x36')]);_0x4643d0[_0xbdad('0x38')]=_['intersection'](_0x4643d0['model'],_0x4643d0[_0xbdad('0x36')]);_0x2633b4[_0xbdad('0x39')]=_[_0xbdad('0x3a')](_0x4643d0[_0xbdad('0x3b')],qs[_0xbdad('0x3c')](_0x39de70[_0xbdad('0x36')][_0xbdad('0x3c')]));_0x2633b4[_0xbdad('0x39')]=_0x2633b4[_0xbdad('0x39')][_0xbdad('0x3d')]?_0x2633b4[_0xbdad('0x39')]:_0x4643d0['model'];if(!_0x39de70[_0xbdad('0x36')][_0xbdad('0x3e')](_0xbdad('0x3f'))){_0x2633b4['limit']=qs[_0xbdad('0x22')](_0x39de70['query']['limit']);_0x2633b4[_0xbdad('0x1f')]=qs['offset'](_0x39de70['query'][_0xbdad('0x1f')]);}_0x2633b4[_0xbdad('0x40')]=qs[_0xbdad('0x41')](_0x39de70[_0xbdad('0x36')]['sort']);_0x2633b4[_0xbdad('0x42')]=qs[_0xbdad('0x38')](_[_0xbdad('0x43')](_0x39de70[_0xbdad('0x36')],_0x4643d0[_0xbdad('0x38')]),_0x38bac3);if(_0x39de70[_0xbdad('0x36')][_0xbdad('0x44')]){_0x2633b4[_0xbdad('0x42')]=_['merge'](_0x2633b4[_0xbdad('0x42')],{'$or':_[_0xbdad('0x31')](_0x38bac3,function(_0x4a60e7){if(_0x4a60e7['type']!==_0xbdad('0x45')){var _0x5bfea9={};_0x5bfea9[_0x4a60e7[_0xbdad('0x2e')]]={'$like':'%'+_0x39de70[_0xbdad('0x36')][_0xbdad('0x44')]+'%'};return _0x5bfea9;}})});}_0x2633b4=_['merge']({},_0x2633b4,_0x39de70['options']);var _0x255e61={'where':_0x2633b4[_0xbdad('0x42')]};return db[_0xbdad('0x32')]['count'](_0x255e61)[_0xbdad('0x29')](function(_0x3f8bc3){_0x4ffbad[_0xbdad('0x21')]=_0x3f8bc3;if(_0x39de70[_0xbdad('0x36')]['includeAll']){_0x2633b4[_0xbdad('0x46')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x2633b4);})[_0xbdad('0x29')](function(_0xa94f99){_0x4ffbad[_0xbdad('0x47')]=_0xa94f99;return _0x4ffbad;})[_0xbdad('0x29')](respondWithFilteredResult(_0x5c29df,_0x2633b4))['catch'](handleError(_0x5c29df,null));};exports[_0xbdad('0x48')]=function(_0x4da954,_0x119ea2){var _0x273427={'raw':![],'where':{'id':_0x4da954[_0xbdad('0x49')]['id']}},_0x4cbceb={};_0x4cbceb[_0xbdad('0x3b')]=_[_0xbdad('0x37')](db[_0xbdad('0x32')][_0xbdad('0x33')]);_0x4cbceb['query']=_[_0xbdad('0x37')](_0x4da954[_0xbdad('0x36')]);_0x4cbceb['filters']=_[_0xbdad('0x3a')](_0x4cbceb[_0xbdad('0x3b')],_0x4cbceb[_0xbdad('0x36')]);_0x273427[_0xbdad('0x39')]=_[_0xbdad('0x3a')](_0x4cbceb[_0xbdad('0x3b')],qs[_0xbdad('0x3c')](_0x4da954['query'][_0xbdad('0x3c')]));_0x273427['attributes']=_0x273427[_0xbdad('0x39')][_0xbdad('0x3d')]?_0x273427['attributes']:_0x4cbceb[_0xbdad('0x3b')];if(_0x4da954[_0xbdad('0x36')][_0xbdad('0x4a')]){_0x273427['include']=[{'all':!![]}];}_0x273427=_[_0xbdad('0x4b')]({},_0x273427,_0x4da954['options']);return db[_0xbdad('0x32')][_0xbdad('0x4c')](_0x273427)[_0xbdad('0x29')](handleEntityNotFound(_0x119ea2,null))[_0xbdad('0x29')](respondWithResult(_0x119ea2,null))[_0xbdad('0x4d')](handleError(_0x119ea2,null));};exports[_0xbdad('0x4e')]=function(_0x1082a0,_0x390060){return db[_0xbdad('0x32')][_0xbdad('0x4e')](_0x1082a0[_0xbdad('0x4f')],{})[_0xbdad('0x29')](respondWithResult(_0x390060,0xc9))[_0xbdad('0x4d')](handleError(_0x390060,null));};exports[_0xbdad('0x28')]=function(_0x2a97ae,_0x32934a){if(_0x2a97ae[_0xbdad('0x4f')]['id']){delete _0x2a97ae['body']['id'];}return db['ServicenowConfiguration'][_0xbdad('0x4c')]({'where':{'id':_0x2a97ae[_0xbdad('0x49')]['id']}})[_0xbdad('0x29')](handleEntityNotFound(_0x32934a,null))['then'](saveUpdates(_0x2a97ae['body'],null))[_0xbdad('0x29')](respondWithResult(_0x32934a,null))['catch'](handleError(_0x32934a,null));};exports['destroy']=function(_0xb6d7c3,_0x5e22a1){return db['ServicenowConfiguration'][_0xbdad('0x4c')]({'where':{'id':_0xb6d7c3[_0xbdad('0x49')]['id']}})[_0xbdad('0x29')](handleEntityNotFound(_0x5e22a1,null))[_0xbdad('0x29')](removeEntity(_0x5e22a1,null))[_0xbdad('0x4d')](handleError(_0x5e22a1,null));};exports[_0xbdad('0x50')]=function(_0x571788,_0x4cfb2c,_0x919729){var _0x5480c0={};var _0x16b1a8={};var _0x2c231e;var _0x1adbdc;return db[_0xbdad('0x32')][_0xbdad('0x51')]({'where':{'id':_0x571788[_0xbdad('0x49')]['id']}})['then'](handleEntityNotFound(_0x4cfb2c,null))[_0xbdad('0x29')](function(_0x1bf7b3){if(_0x1bf7b3){_0x2c231e=_0x1bf7b3;_0x16b1a8[_0xbdad('0x3b')]=_[_0xbdad('0x37')](db[_0xbdad('0x52')][_0xbdad('0x33')]);_0x16b1a8[_0xbdad('0x36')]=_['keys'](_0x571788[_0xbdad('0x36')]);_0x16b1a8[_0xbdad('0x38')]=_[_0xbdad('0x3a')](_0x16b1a8[_0xbdad('0x3b')],_0x16b1a8[_0xbdad('0x36')]);_0x5480c0[_0xbdad('0x39')]=_[_0xbdad('0x3a')](_0x16b1a8[_0xbdad('0x3b')],qs[_0xbdad('0x3c')](_0x571788['query'][_0xbdad('0x3c')]));_0x5480c0['attributes']=_0x5480c0['attributes'][_0xbdad('0x3d')]?_0x5480c0[_0xbdad('0x39')]:_0x16b1a8[_0xbdad('0x3b')];_0x5480c0[_0xbdad('0x40')]=qs[_0xbdad('0x41')](_0x571788['query'][_0xbdad('0x41')]);_0x5480c0['where']=qs[_0xbdad('0x38')](_[_0xbdad('0x43')](_0x571788[_0xbdad('0x36')],_0x16b1a8['filters']));if(_0x571788[_0xbdad('0x36')][_0xbdad('0x44')]){_0x5480c0['where']=_[_0xbdad('0x4b')](_0x5480c0[_0xbdad('0x42')],{'$or':_[_0xbdad('0x31')](_0x5480c0['attributes'],function(_0x5cfe61){var _0x537ce4={};_0x537ce4[_0x5cfe61]={'$like':'%'+_0x571788[_0xbdad('0x36')][_0xbdad('0x44')]+'%'};return _0x537ce4;})});}_0x5480c0=_[_0xbdad('0x4b')]({},_0x5480c0,_0x571788[_0xbdad('0x53')]);return _0x2c231e[_0xbdad('0x50')](_0x5480c0);}})[_0xbdad('0x29')](function(_0x15e2e4){if(_0x15e2e4){_0x1adbdc=_0x15e2e4[_0xbdad('0x3d')];if(!_0x571788['query'][_0xbdad('0x3e')]('nolimit')){_0x5480c0[_0xbdad('0x22')]=qs[_0xbdad('0x22')](_0x571788[_0xbdad('0x36')][_0xbdad('0x22')]);_0x5480c0[_0xbdad('0x1f')]=qs['offset'](_0x571788['query'][_0xbdad('0x1f')]);}return _0x2c231e['getFields'](_0x5480c0);}})['then'](function(_0x29e44d){if(_0x29e44d){return _0x29e44d?{'count':_0x1adbdc,'rows':_0x29e44d}:null;}})['then'](respondWithResult(_0x4cfb2c,null))[_0xbdad('0x4d')](handleError(_0x4cfb2c,null));};exports['getSubjects']=function(_0x12e200,_0x297919,_0x527fdc){var _0x496b8e={};var _0x503199={};var _0x32eade;var _0x40c2f6;return db[_0xbdad('0x32')]['findOne']({'where':{'id':_0x12e200['params']['id']}})[_0xbdad('0x29')](handleEntityNotFound(_0x297919,null))[_0xbdad('0x29')](function(_0x26ff35){if(_0x26ff35){_0x32eade=_0x26ff35;_0x503199[_0xbdad('0x3b')]=_[_0xbdad('0x37')](db[_0xbdad('0x52')][_0xbdad('0x33')]);_0x503199['query']=_[_0xbdad('0x37')](_0x12e200[_0xbdad('0x36')]);_0x503199['filters']=_[_0xbdad('0x3a')](_0x503199[_0xbdad('0x3b')],_0x503199[_0xbdad('0x36')]);_0x496b8e[_0xbdad('0x39')]=_['intersection'](_0x503199[_0xbdad('0x3b')],qs[_0xbdad('0x3c')](_0x12e200['query']['fields']));_0x496b8e[_0xbdad('0x39')]=_0x496b8e[_0xbdad('0x39')]['length']?_0x496b8e[_0xbdad('0x39')]:_0x503199[_0xbdad('0x3b')];_0x496b8e[_0xbdad('0x40')]=qs['sort'](_0x12e200[_0xbdad('0x36')]['sort']);_0x496b8e['where']=qs[_0xbdad('0x38')](_[_0xbdad('0x43')](_0x12e200[_0xbdad('0x36')],_0x503199[_0xbdad('0x38')]));if(_0x12e200[_0xbdad('0x36')][_0xbdad('0x44')]){_0x496b8e['where']=_['merge'](_0x496b8e[_0xbdad('0x42')],{'$or':_['map'](_0x496b8e[_0xbdad('0x39')],function(_0x42feb1){var _0x1e70a0={};_0x1e70a0[_0x42feb1]={'$like':'%'+_0x12e200[_0xbdad('0x36')][_0xbdad('0x44')]+'%'};return _0x1e70a0;})});}_0x496b8e=_[_0xbdad('0x4b')]({},_0x496b8e,_0x12e200['options']);return _0x32eade['getSubjects'](_0x496b8e);}})['then'](function(_0x215ac3){if(_0x215ac3){_0x40c2f6=_0x215ac3[_0xbdad('0x3d')];if(!_0x12e200[_0xbdad('0x36')][_0xbdad('0x3e')](_0xbdad('0x3f'))){_0x496b8e[_0xbdad('0x22')]=qs['limit'](_0x12e200[_0xbdad('0x36')][_0xbdad('0x22')]);_0x496b8e[_0xbdad('0x1f')]=qs[_0xbdad('0x1f')](_0x12e200[_0xbdad('0x36')][_0xbdad('0x1f')]);}return _0x32eade['getSubjects'](_0x496b8e);}})[_0xbdad('0x29')](function(_0x1c10a5){if(_0x1c10a5){return _0x1c10a5?{'count':_0x40c2f6,'rows':_0x1c10a5}:null;}})[_0xbdad('0x29')](respondWithResult(_0x297919,null))['catch'](handleError(_0x297919,null));};exports[_0xbdad('0x54')]=function(_0x4a4224,_0x9126b8,_0x5ba6d2){var _0x3b10c1={};var _0x54527c={};var _0x54313c;var _0x1bff83;return db['ServicenowConfiguration'][_0xbdad('0x51')]({'where':{'id':_0x4a4224[_0xbdad('0x49')]['id']}})[_0xbdad('0x29')](handleEntityNotFound(_0x9126b8,null))[_0xbdad('0x29')](function(_0xca9962){if(_0xca9962){_0x54313c=_0xca9962;_0x54527c[_0xbdad('0x3b')]=_[_0xbdad('0x37')](db[_0xbdad('0x52')]['rawAttributes']);_0x54527c[_0xbdad('0x36')]=_['keys'](_0x4a4224['query']);_0x54527c[_0xbdad('0x38')]=_[_0xbdad('0x3a')](_0x54527c['model'],_0x54527c['query']);_0x3b10c1[_0xbdad('0x39')]=_['intersection'](_0x54527c['model'],qs['fields'](_0x4a4224[_0xbdad('0x36')]['fields']));_0x3b10c1[_0xbdad('0x39')]=_0x3b10c1[_0xbdad('0x39')][_0xbdad('0x3d')]?_0x3b10c1[_0xbdad('0x39')]:_0x54527c[_0xbdad('0x3b')];_0x3b10c1[_0xbdad('0x40')]=qs[_0xbdad('0x41')](_0x4a4224[_0xbdad('0x36')][_0xbdad('0x41')]);_0x3b10c1[_0xbdad('0x42')]=qs['filters'](_[_0xbdad('0x43')](_0x4a4224['query'],_0x54527c[_0xbdad('0x38')]));if(_0x4a4224[_0xbdad('0x36')][_0xbdad('0x44')]){_0x3b10c1[_0xbdad('0x42')]=_[_0xbdad('0x4b')](_0x3b10c1['where'],{'$or':_[_0xbdad('0x31')](_0x3b10c1['attributes'],function(_0x2b4630){var _0x4dbea4={};_0x4dbea4[_0x2b4630]={'$like':'%'+_0x4a4224[_0xbdad('0x36')]['filter']+'%'};return _0x4dbea4;})});}_0x3b10c1=_[_0xbdad('0x4b')]({},_0x3b10c1,_0x4a4224[_0xbdad('0x53')]);return _0x54313c['getDescriptions'](_0x3b10c1);}})[_0xbdad('0x29')](function(_0x291def){if(_0x291def){_0x1bff83=_0x291def['length'];if(!_0x4a4224[_0xbdad('0x36')][_0xbdad('0x3e')](_0xbdad('0x3f'))){_0x3b10c1[_0xbdad('0x22')]=qs[_0xbdad('0x22')](_0x4a4224['query']['limit']);_0x3b10c1[_0xbdad('0x1f')]=qs[_0xbdad('0x1f')](_0x4a4224['query']['offset']);}return _0x54313c['getDescriptions'](_0x3b10c1);}})[_0xbdad('0x29')](function(_0x21cafd){if(_0x21cafd){return _0x21cafd?{'count':_0x1bff83,'rows':_0x21cafd}:null;}})[_0xbdad('0x29')](respondWithResult(_0x9126b8,null))[_0xbdad('0x4d')](handleError(_0x9126b8,null));}; \ No newline at end of file +var _0x4770=['model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','body','find','destroy','getFields','findOne','ServicenowField','rawAttributes','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','save','update','then','end','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key'];(function(_0x52b657,_0x167ac8){var _0x4f2ca5=function(_0x5a5172){while(--_0x5a5172){_0x52b657['push'](_0x52b657['shift']());}};_0x4f2ca5(++_0x167ac8);}(_0x4770,0x198));var _0x0477=function(_0x3cb359,_0x48bb14){_0x3cb359=_0x3cb359-0x0;var _0x5f325a=_0x4770[_0x3cb359];return _0x5f325a;};'use strict';var emlformat=require(_0x0477('0x0'));var rimraf=require(_0x0477('0x1'));var zipdir=require(_0x0477('0x2'));var jsonpatch=require(_0x0477('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0477('0x4'));var Mustache=require('mustache');var util=require(_0x0477('0x5'));var path=require(_0x0477('0x6'));var sox=require(_0x0477('0x7'));var csv=require(_0x0477('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0477('0x9'));var crypto=require(_0x0477('0xa'));var jsforce=require(_0x0477('0xb'));var deskjs=require(_0x0477('0xc'));var toCsv=require(_0x0477('0x8'));var querystring=require(_0x0477('0xd'));var Papa=require(_0x0477('0xe'));var Redis=require('ioredis');var authService=require(_0x0477('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0477('0x10'));var logger=require(_0x0477('0x11'))(_0x0477('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0477('0x13'));var db=require(_0x0477('0x14'))['db'];function respondWithStatusCode(_0x2b27a3,_0x490ee0){_0x490ee0=_0x490ee0||0xcc;return function(_0x274999){if(_0x274999){return _0x2b27a3['sendStatus'](_0x490ee0);}return _0x2b27a3[_0x0477('0x15')](_0x490ee0)['end']();};}function respondWithResult(_0x460d4e,_0x51ef73){_0x51ef73=_0x51ef73||0xc8;return function(_0x2523de){if(_0x2523de){return _0x460d4e[_0x0477('0x15')](_0x51ef73)[_0x0477('0x16')](_0x2523de);}};}function respondWithFilteredResult(_0x71da43,_0x1df53c){return function(_0x38eb33){if(_0x38eb33){var _0x38ebe6=typeof _0x1df53c[_0x0477('0x17')]===_0x0477('0x18')&&typeof _0x1df53c[_0x0477('0x19')]===_0x0477('0x18');var _0x4a110f=_0x38eb33['count'];var _0x38df62=_0x38ebe6?0x0:_0x1df53c[_0x0477('0x17')];var _0x5d2001=_0x38ebe6?_0x38eb33[_0x0477('0x1a')]:_0x1df53c[_0x0477('0x17')]+_0x1df53c['limit'];var _0x5d3569;if(_0x5d2001>=_0x4a110f){_0x5d2001=_0x4a110f;_0x5d3569=0xc8;}else{_0x5d3569=0xce;}_0x71da43[_0x0477('0x15')](_0x5d3569);return _0x71da43['set']('Content-Range',_0x38df62+'-'+_0x5d2001+'/'+_0x4a110f)[_0x0477('0x16')](_0x38eb33);}return null;};}function patchUpdates(_0x24ad54){return function(_0x31581c){try{jsonpatch['apply'](_0x31581c,_0x24ad54,!![]);}catch(_0x2518ab){return BPromise['reject'](_0x2518ab);}return _0x31581c[_0x0477('0x1b')]();};}function saveUpdates(_0x199bb7,_0x208b60){return function(_0x52e625){if(_0x52e625){return _0x52e625[_0x0477('0x1c')](_0x199bb7)[_0x0477('0x1d')](function(_0x1d4d4d){return _0x1d4d4d;});}return null;};}function removeEntity(_0x28b8cf,_0x4353f3){return function(_0x289100){if(_0x289100){return _0x289100['destroy']()['then'](function(){_0x28b8cf['status'](0xcc)[_0x0477('0x1e')]();});}};}function handleEntityNotFound(_0x4f71f7,_0x1a5ecd){return function(_0x183558){if(!_0x183558){_0x4f71f7[_0x0477('0x1f')](0x194);}return _0x183558;};}function handleError(_0x442e4e,_0x4ebf94){_0x4ebf94=_0x4ebf94||0x1f4;return function(_0x75798c){logger[_0x0477('0x20')](_0x75798c[_0x0477('0x21')]);if(_0x75798c[_0x0477('0x22')]){delete _0x75798c[_0x0477('0x22')];}_0x442e4e['status'](_0x4ebf94)[_0x0477('0x23')](_0x75798c);};}exports[_0x0477('0x24')]=function(_0xb4bd5f,_0x4de302){var _0x27767b={},_0x2f0f41={},_0x44b556={'count':0x0,'rows':[]};var _0x44caec=_[_0x0477('0x25')](db[_0x0477('0x26')]['rawAttributes'],function(_0x49bf9a){return{'name':_0x49bf9a[_0x0477('0x27')],'type':_0x49bf9a[_0x0477('0x28')][_0x0477('0x29')]};});_0x2f0f41[_0x0477('0x2a')]=_[_0x0477('0x25')](_0x44caec,_0x0477('0x22'));_0x2f0f41['query']=_[_0x0477('0x2b')](_0xb4bd5f[_0x0477('0x2c')]);_0x2f0f41['filters']=_['intersection'](_0x2f0f41[_0x0477('0x2a')],_0x2f0f41[_0x0477('0x2c')]);_0x27767b[_0x0477('0x2d')]=_[_0x0477('0x2e')](_0x2f0f41[_0x0477('0x2a')],qs[_0x0477('0x2f')](_0xb4bd5f[_0x0477('0x2c')][_0x0477('0x2f')]));_0x27767b['attributes']=_0x27767b['attributes'][_0x0477('0x30')]?_0x27767b[_0x0477('0x2d')]:_0x2f0f41[_0x0477('0x2a')];if(!_0xb4bd5f[_0x0477('0x2c')]['hasOwnProperty'](_0x0477('0x31'))){_0x27767b['limit']=qs['limit'](_0xb4bd5f[_0x0477('0x2c')][_0x0477('0x19')]);_0x27767b[_0x0477('0x17')]=qs['offset'](_0xb4bd5f[_0x0477('0x2c')][_0x0477('0x17')]);}_0x27767b[_0x0477('0x32')]=qs[_0x0477('0x33')](_0xb4bd5f['query'][_0x0477('0x33')]);_0x27767b[_0x0477('0x34')]=qs[_0x0477('0x35')](_['pick'](_0xb4bd5f[_0x0477('0x2c')],_0x2f0f41[_0x0477('0x35')]),_0x44caec);if(_0xb4bd5f['query'][_0x0477('0x36')]){_0x27767b[_0x0477('0x34')]=_[_0x0477('0x37')](_0x27767b['where'],{'$or':_[_0x0477('0x25')](_0x44caec,function(_0x8a4e55){if(_0x8a4e55[_0x0477('0x28')]!==_0x0477('0x38')){var _0x39ed20={};_0x39ed20[_0x8a4e55[_0x0477('0x22')]]={'$like':'%'+_0xb4bd5f[_0x0477('0x2c')][_0x0477('0x36')]+'%'};return _0x39ed20;}})});}_0x27767b=_[_0x0477('0x37')]({},_0x27767b,_0xb4bd5f[_0x0477('0x39')]);var _0x135e22={'where':_0x27767b['where']};return db[_0x0477('0x26')][_0x0477('0x1a')](_0x135e22)['then'](function(_0x3e6475){_0x44b556['count']=_0x3e6475;if(_0xb4bd5f[_0x0477('0x2c')][_0x0477('0x3a')]){_0x27767b[_0x0477('0x3b')]=[{'all':!![]}];}return db[_0x0477('0x26')]['findAll'](_0x27767b);})[_0x0477('0x1d')](function(_0x140409){_0x44b556[_0x0477('0x3c')]=_0x140409;return _0x44b556;})[_0x0477('0x1d')](respondWithFilteredResult(_0x4de302,_0x27767b))[_0x0477('0x3d')](handleError(_0x4de302,null));};exports[_0x0477('0x3e')]=function(_0x3b39dc,_0xcaf37){var _0x173321={'raw':![],'where':{'id':_0x3b39dc[_0x0477('0x3f')]['id']}},_0x570389={};_0x570389[_0x0477('0x2a')]=_[_0x0477('0x2b')](db[_0x0477('0x26')]['rawAttributes']);_0x570389['query']=_[_0x0477('0x2b')](_0x3b39dc[_0x0477('0x2c')]);_0x570389[_0x0477('0x35')]=_['intersection'](_0x570389[_0x0477('0x2a')],_0x570389[_0x0477('0x2c')]);_0x173321[_0x0477('0x2d')]=_[_0x0477('0x2e')](_0x570389[_0x0477('0x2a')],qs['fields'](_0x3b39dc[_0x0477('0x2c')]['fields']));_0x173321[_0x0477('0x2d')]=_0x173321['attributes']['length']?_0x173321['attributes']:_0x570389[_0x0477('0x2a')];if(_0x3b39dc['query'][_0x0477('0x3a')]){_0x173321[_0x0477('0x3b')]=[{'all':!![]}];}_0x173321=_['merge']({},_0x173321,_0x3b39dc[_0x0477('0x39')]);return db['ServicenowConfiguration']['find'](_0x173321)[_0x0477('0x1d')](handleEntityNotFound(_0xcaf37,null))['then'](respondWithResult(_0xcaf37,null))[_0x0477('0x3d')](handleError(_0xcaf37,null));};exports['create']=function(_0x5989d7,_0x1d89b5){return db[_0x0477('0x26')]['create'](_0x5989d7['body'],{})[_0x0477('0x1d')](respondWithResult(_0x1d89b5,0xc9))[_0x0477('0x3d')](handleError(_0x1d89b5,null));};exports['update']=function(_0x4c7fe8,_0x4a97f4){if(_0x4c7fe8[_0x0477('0x40')]['id']){delete _0x4c7fe8[_0x0477('0x40')]['id'];}return db[_0x0477('0x26')][_0x0477('0x41')]({'where':{'id':_0x4c7fe8[_0x0477('0x3f')]['id']}})[_0x0477('0x1d')](handleEntityNotFound(_0x4a97f4,null))[_0x0477('0x1d')](saveUpdates(_0x4c7fe8[_0x0477('0x40')],null))[_0x0477('0x1d')](respondWithResult(_0x4a97f4,null))[_0x0477('0x3d')](handleError(_0x4a97f4,null));};exports[_0x0477('0x42')]=function(_0x563caf,_0x346b3d){return db[_0x0477('0x26')]['find']({'where':{'id':_0x563caf['params']['id']}})[_0x0477('0x1d')](handleEntityNotFound(_0x346b3d,null))[_0x0477('0x1d')](removeEntity(_0x346b3d,null))[_0x0477('0x3d')](handleError(_0x346b3d,null));};exports[_0x0477('0x43')]=function(_0x288a96,_0x40214f,_0xca9ced){var _0x481c7c={};var _0xe022d4={};var _0x5119ac;var _0x35dc2a;return db[_0x0477('0x26')][_0x0477('0x44')]({'where':{'id':_0x288a96[_0x0477('0x3f')]['id']}})['then'](handleEntityNotFound(_0x40214f,null))[_0x0477('0x1d')](function(_0x13ff7c){if(_0x13ff7c){_0x5119ac=_0x13ff7c;_0xe022d4[_0x0477('0x2a')]=_[_0x0477('0x2b')](db[_0x0477('0x45')][_0x0477('0x46')]);_0xe022d4[_0x0477('0x2c')]=_[_0x0477('0x2b')](_0x288a96[_0x0477('0x2c')]);_0xe022d4[_0x0477('0x35')]=_['intersection'](_0xe022d4[_0x0477('0x2a')],_0xe022d4[_0x0477('0x2c')]);_0x481c7c['attributes']=_['intersection'](_0xe022d4[_0x0477('0x2a')],qs[_0x0477('0x2f')](_0x288a96[_0x0477('0x2c')][_0x0477('0x2f')]));_0x481c7c[_0x0477('0x2d')]=_0x481c7c[_0x0477('0x2d')][_0x0477('0x30')]?_0x481c7c['attributes']:_0xe022d4[_0x0477('0x2a')];_0x481c7c[_0x0477('0x32')]=qs['sort'](_0x288a96['query']['sort']);_0x481c7c[_0x0477('0x34')]=qs[_0x0477('0x35')](_[_0x0477('0x47')](_0x288a96['query'],_0xe022d4[_0x0477('0x35')]));if(_0x288a96[_0x0477('0x2c')]['filter']){_0x481c7c[_0x0477('0x34')]=_['merge'](_0x481c7c[_0x0477('0x34')],{'$or':_['map'](_0x481c7c[_0x0477('0x2d')],function(_0x40054a){var _0x57f051={};_0x57f051[_0x40054a]={'$like':'%'+_0x288a96[_0x0477('0x2c')]['filter']+'%'};return _0x57f051;})});}_0x481c7c=_[_0x0477('0x37')]({},_0x481c7c,_0x288a96[_0x0477('0x39')]);return _0x5119ac[_0x0477('0x43')](_0x481c7c);}})[_0x0477('0x1d')](function(_0x28f551){if(_0x28f551){_0x35dc2a=_0x28f551[_0x0477('0x30')];if(!_0x288a96[_0x0477('0x2c')][_0x0477('0x48')](_0x0477('0x31'))){_0x481c7c[_0x0477('0x19')]=qs[_0x0477('0x19')](_0x288a96['query']['limit']);_0x481c7c[_0x0477('0x17')]=qs[_0x0477('0x17')](_0x288a96[_0x0477('0x2c')][_0x0477('0x17')]);}return _0x5119ac['getFields'](_0x481c7c);}})[_0x0477('0x1d')](function(_0x1b9688){if(_0x1b9688){return _0x1b9688?{'count':_0x35dc2a,'rows':_0x1b9688}:null;}})[_0x0477('0x1d')](respondWithResult(_0x40214f,null))[_0x0477('0x3d')](handleError(_0x40214f,null));};exports[_0x0477('0x49')]=function(_0x3dac37,_0x24a3df,_0x332d20){var _0x4779a6={};var _0x9adb5e={};var _0x2bdbc7;var _0x2f99aa;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3dac37[_0x0477('0x3f')]['id']}})[_0x0477('0x1d')](handleEntityNotFound(_0x24a3df,null))[_0x0477('0x1d')](function(_0x599dc3){if(_0x599dc3){_0x2bdbc7=_0x599dc3;_0x9adb5e['model']=_[_0x0477('0x2b')](db[_0x0477('0x45')][_0x0477('0x46')]);_0x9adb5e[_0x0477('0x2c')]=_[_0x0477('0x2b')](_0x3dac37[_0x0477('0x2c')]);_0x9adb5e[_0x0477('0x35')]=_[_0x0477('0x2e')](_0x9adb5e[_0x0477('0x2a')],_0x9adb5e[_0x0477('0x2c')]);_0x4779a6[_0x0477('0x2d')]=_['intersection'](_0x9adb5e[_0x0477('0x2a')],qs[_0x0477('0x2f')](_0x3dac37['query'][_0x0477('0x2f')]));_0x4779a6[_0x0477('0x2d')]=_0x4779a6['attributes'][_0x0477('0x30')]?_0x4779a6[_0x0477('0x2d')]:_0x9adb5e['model'];_0x4779a6[_0x0477('0x32')]=qs[_0x0477('0x33')](_0x3dac37['query'][_0x0477('0x33')]);_0x4779a6['where']=qs[_0x0477('0x35')](_[_0x0477('0x47')](_0x3dac37[_0x0477('0x2c')],_0x9adb5e['filters']));if(_0x3dac37[_0x0477('0x2c')]['filter']){_0x4779a6[_0x0477('0x34')]=_['merge'](_0x4779a6[_0x0477('0x34')],{'$or':_[_0x0477('0x25')](_0x4779a6['attributes'],function(_0x43d062){var _0x40629f={};_0x40629f[_0x43d062]={'$like':'%'+_0x3dac37[_0x0477('0x2c')][_0x0477('0x36')]+'%'};return _0x40629f;})});}_0x4779a6=_[_0x0477('0x37')]({},_0x4779a6,_0x3dac37[_0x0477('0x39')]);return _0x2bdbc7[_0x0477('0x49')](_0x4779a6);}})['then'](function(_0x5043bd){if(_0x5043bd){_0x2f99aa=_0x5043bd[_0x0477('0x30')];if(!_0x3dac37[_0x0477('0x2c')][_0x0477('0x48')](_0x0477('0x31'))){_0x4779a6[_0x0477('0x19')]=qs[_0x0477('0x19')](_0x3dac37[_0x0477('0x2c')][_0x0477('0x19')]);_0x4779a6[_0x0477('0x17')]=qs[_0x0477('0x17')](_0x3dac37[_0x0477('0x2c')][_0x0477('0x17')]);}return _0x2bdbc7[_0x0477('0x49')](_0x4779a6);}})[_0x0477('0x1d')](function(_0x28a005){if(_0x28a005){return _0x28a005?{'count':_0x2f99aa,'rows':_0x28a005}:null;}})[_0x0477('0x1d')](respondWithResult(_0x24a3df,null))[_0x0477('0x3d')](handleError(_0x24a3df,null));};exports['getDescriptions']=function(_0x3e8488,_0x7d7d3f,_0xa81fef){var _0x452d79={};var _0x2b583f={};var _0x1736bf;var _0x3c27bf;return db[_0x0477('0x26')][_0x0477('0x44')]({'where':{'id':_0x3e8488['params']['id']}})[_0x0477('0x1d')](handleEntityNotFound(_0x7d7d3f,null))[_0x0477('0x1d')](function(_0x49aa0f){if(_0x49aa0f){_0x1736bf=_0x49aa0f;_0x2b583f[_0x0477('0x2a')]=_['keys'](db[_0x0477('0x45')][_0x0477('0x46')]);_0x2b583f[_0x0477('0x2c')]=_[_0x0477('0x2b')](_0x3e8488[_0x0477('0x2c')]);_0x2b583f['filters']=_[_0x0477('0x2e')](_0x2b583f[_0x0477('0x2a')],_0x2b583f[_0x0477('0x2c')]);_0x452d79[_0x0477('0x2d')]=_['intersection'](_0x2b583f[_0x0477('0x2a')],qs['fields'](_0x3e8488['query'][_0x0477('0x2f')]));_0x452d79[_0x0477('0x2d')]=_0x452d79[_0x0477('0x2d')]['length']?_0x452d79[_0x0477('0x2d')]:_0x2b583f['model'];_0x452d79['order']=qs[_0x0477('0x33')](_0x3e8488['query'][_0x0477('0x33')]);_0x452d79[_0x0477('0x34')]=qs[_0x0477('0x35')](_[_0x0477('0x47')](_0x3e8488['query'],_0x2b583f['filters']));if(_0x3e8488[_0x0477('0x2c')]['filter']){_0x452d79[_0x0477('0x34')]=_[_0x0477('0x37')](_0x452d79[_0x0477('0x34')],{'$or':_['map'](_0x452d79[_0x0477('0x2d')],function(_0x677d16){var _0x317895={};_0x317895[_0x677d16]={'$like':'%'+_0x3e8488[_0x0477('0x2c')][_0x0477('0x36')]+'%'};return _0x317895;})});}_0x452d79=_['merge']({},_0x452d79,_0x3e8488[_0x0477('0x39')]);return _0x1736bf[_0x0477('0x4a')](_0x452d79);}})['then'](function(_0x1abf5e){if(_0x1abf5e){_0x3c27bf=_0x1abf5e[_0x0477('0x30')];if(!_0x3e8488[_0x0477('0x2c')]['hasOwnProperty'](_0x0477('0x31'))){_0x452d79[_0x0477('0x19')]=qs[_0x0477('0x19')](_0x3e8488[_0x0477('0x2c')][_0x0477('0x19')]);_0x452d79[_0x0477('0x17')]=qs['offset'](_0x3e8488[_0x0477('0x2c')]['offset']);}return _0x1736bf[_0x0477('0x4a')](_0x452d79);}})[_0x0477('0x1d')](function(_0x4e305c){if(_0x4e305c){return _0x4e305c?{'count':_0x3c27bf,'rows':_0x4e305c}:null;}})['then'](respondWithResult(_0x7d7d3f,null))[_0x0477('0x3d')](handleError(_0x7d7d3f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index bc85f1f..236f032 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 _0x351d=['../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x147f30,_0x22fe10){var _0x2faa38=function(_0x5572ae){while(--_0x5572ae){_0x147f30['push'](_0x147f30['shift']());}};_0x2faa38(++_0x22fe10);}(_0x351d,0x90));var _0xd351=function(_0x4cd47c,_0x2ee5d7){_0x4cd47c=_0x4cd47c-0x0;var _0x9694fa=_0x351d[_0x4cd47c];return _0x9694fa;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf4c=['moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x309d68,_0x1036c9){_0x309d68=_0x309d68-0x0;var _0xcee19a=_0xaf4c[_0x309d68];return _0xcee19a;};'use strict';var _=require('lodash');var util=require(_0xcaf4('0x0'));var logger=require(_0xcaf4('0x1'))('api');var moment=require(_0xcaf4('0x2'));var BPromise=require(_0xcaf4('0x3'));var rp=require(_0xcaf4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaf4('0x5'));var config=require(_0xcaf4('0x6'));var attributes=require(_0xcaf4('0x7'));module['exports']=function(_0x21ad95,_0x548527){return _0x21ad95[_0xcaf4('0x8')](_0xcaf4('0x9'),attributes,{'tableName':_0xcaf4('0xa'),'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 b1f1848..19a8e73 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 _0xd1e4=['../../config/environment','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x2073da,_0x20740f){var _0x2d62e7=function(_0x50cf7d){while(--_0x50cf7d){_0x2073da['push'](_0x2073da['shift']());}};_0x2d62e7(++_0x20740f);}(_0xd1e4,0x8d));var _0x4d1e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd1e4[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x4d1e('0x0'));var util=require('util');var moment=require(_0x4d1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d1e('0x2'));var fs=require('fs');var Redis=require(_0x4d1e('0x3'));var db=require(_0x4d1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d1e('0x5'));var config=require(_0x4d1e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4d1e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a77a9,_0x2d7cac,_0x40c054){return new BPromise(function(_0x44a421,_0xe87545){return client[_0x4d1e('0x8')](_0x2a77a9,_0x40c054)[_0x4d1e('0x9')](function(_0x21ac18){logger[_0x4d1e('0xa')](_0x4d1e('0xb'),_0x2d7cac,_0x4d1e('0xc'));logger[_0x4d1e('0xd')](_0x4d1e('0xe'),_0x2d7cac,_0x4d1e('0xc'),JSON[_0x4d1e('0xf')](_0x21ac18));if(_0x21ac18[_0x4d1e('0x10')]){if(_0x21ac18[_0x4d1e('0x10')][_0x4d1e('0x11')]===0x1f4){logger[_0x4d1e('0x10')](_0x4d1e('0xb'),_0x2d7cac,_0x21ac18[_0x4d1e('0x10')]['message']);return _0xe87545(_0x21ac18[_0x4d1e('0x10')]['message']);}logger[_0x4d1e('0x10')](_0x4d1e('0xb'),_0x2d7cac,_0x21ac18[_0x4d1e('0x10')][_0x4d1e('0x12')]);return _0x44a421(_0x21ac18[_0x4d1e('0x10')][_0x4d1e('0x12')]);}else{logger[_0x4d1e('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2d7cac,'request\x20sent');_0x44a421(_0x21ac18[_0x4d1e('0x13')][_0x4d1e('0x12')]);}})[_0x4d1e('0x14')](function(_0x38c907){logger['error'](_0x4d1e('0xb'),_0x2d7cac,_0x38c907);_0xe87545(_0x38c907);});});} \ No newline at end of file +var _0x6ac7=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x27d44e,_0x2c9977){var _0x244827=function(_0x26db81){while(--_0x26db81){_0x27d44e['push'](_0x27d44e['shift']());}};_0x244827(++_0x2c9977);}(_0x6ac7,0x1e0));var _0x76ac=function(_0x5e99fa,_0x33bc1f){_0x5e99fa=_0x5e99fa-0x0;var _0x103c4b=_0x6ac7[_0x5e99fa];return _0x103c4b;};'use strict';var _=require(_0x76ac('0x0'));var util=require(_0x76ac('0x1'));var moment=require(_0x76ac('0x2'));var BPromise=require(_0x76ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76ac('0x4'));var db=require(_0x76ac('0x5'))['db'];var utils=require(_0x76ac('0x6'));var logger=require(_0x76ac('0x7'))(_0x76ac('0x8'));var config=require(_0x76ac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x76ac('0xa')][_0x76ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f4282,_0x22ba65,_0x159cbb){return new BPromise(function(_0x31d9bc,_0x26884d){return client[_0x76ac('0xc')](_0x5f4282,_0x159cbb)[_0x76ac('0xd')](function(_0x38ef11){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x22ba65,_0x76ac('0xe'));logger['debug'](_0x76ac('0xf'),_0x22ba65,_0x76ac('0xe'),JSON[_0x76ac('0x10')](_0x38ef11));if(_0x38ef11[_0x76ac('0x11')]){if(_0x38ef11[_0x76ac('0x11')]['code']===0x1f4){logger[_0x76ac('0x11')](_0x76ac('0x12'),_0x22ba65,_0x38ef11[_0x76ac('0x11')]['message']);return _0x26884d(_0x38ef11[_0x76ac('0x11')][_0x76ac('0x13')]);}logger['error'](_0x76ac('0x12'),_0x22ba65,_0x38ef11[_0x76ac('0x11')][_0x76ac('0x13')]);return _0x31d9bc(_0x38ef11[_0x76ac('0x11')]['message']);}else{logger['info'](_0x76ac('0x12'),_0x22ba65,_0x76ac('0xe'));_0x31d9bc(_0x38ef11[_0x76ac('0x14')][_0x76ac('0x13')]);}})['catch'](function(_0x104c7e){logger[_0x76ac('0x11')](_0x76ac('0x12'),_0x22ba65,_0x104c7e);_0x26884d(_0x104c7e);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index bf81272..033fc15 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 _0x45b0=['delete','destroy','exports','multer','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45b0,0xa3));var _0x045b=function(_0x5c13c1,_0x4cff61){_0x5c13c1=_0x5c13c1-0x0;var _0x5a821a=_0x45b0[_0x5c13c1];return _0x5a821a;};'use strict';var multer=require(_0x045b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x045b('0x1')]();var fs_extra=require(_0x045b('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x045b('0x3'));var config=require(_0x045b('0x4'));var controller=require('./intServicenowField.controller');router[_0x045b('0x5')]('/',auth[_0x045b('0x6')](),controller[_0x045b('0x7')]);router['get'](_0x045b('0x8'),auth['isAuthenticated'](),controller[_0x045b('0x9')]);router[_0x045b('0xa')]('/',auth[_0x045b('0x6')](),controller[_0x045b('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x045b('0xc')]);router[_0x045b('0xd')]('/:id',auth[_0x045b('0x6')](),controller[_0x045b('0xe')]);module[_0x045b('0xf')]=router; \ No newline at end of file +var _0x052a=['get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x052a,0x145));var _0xa052=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x052a[_0x576e2b];return _0x46461a;};'use strict';var multer=require(_0xa052('0x0'));var util=require('util');var path=require(_0xa052('0x1'));var timeout=require(_0xa052('0x2'));var express=require(_0xa052('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('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa052('0x4')]);router[_0xa052('0x5')](_0xa052('0x6'),auth[_0xa052('0x7')](),controller[_0xa052('0x8')]);router[_0xa052('0x9')]('/',auth['isAuthenticated'](),controller[_0xa052('0xa')]);router[_0xa052('0xb')](_0xa052('0x6'),auth[_0xa052('0x7')](),controller[_0xa052('0xc')]);router['delete'](_0xa052('0x6'),auth['isAuthenticated'](),controller[_0xa052('0xd')]);module[_0xa052('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f35fc35..6c5d88f 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 _0xf87b=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','string'];(function(_0x52e6be,_0x477955){var _0x5833d0=function(_0x290336){while(--_0x290336){_0x52e6be['push'](_0x52e6be['shift']());}};_0x5833d0(++_0x477955);}(_0xf87b,0x1d6));var _0xbf87=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf87b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xbf87('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbf87('0x1'),_0xbf87('0x2'),_0xbf87('0x3'),_0xbf87('0x4'),_0xbf87('0x5')),'defaultValue':_0xbf87('0x1')},'content':{'type':Sequelize[_0xbf87('0x6')]},'key':{'type':Sequelize[_0xbf87('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xbf87('0x1'),_0xbf87('0x2'),_0xbf87('0x3'))},'keyContent':{'type':Sequelize[_0xbf87('0x6')]},'idField':{'type':Sequelize[_0xbf87('0x6')]},'nameField':{'type':Sequelize[_0xbf87('0x6')]},'customField':{'type':Sequelize[_0xbf87('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf87('0x6')]}}; \ No newline at end of file +var _0x0e7c=['sequelize','exports','ENUM','customVariable','keyValue','picklist','string','STRING'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x0e7c,0x68));var _0xc0e7=function(_0x189b3b,_0x484de8){_0x189b3b=_0x189b3b-0x0;var _0x7c4721=_0x0e7c[_0x189b3b];return _0x7c4721;};'use strict';var Sequelize=require(_0xc0e7('0x0'));module[_0xc0e7('0x1')]={'type':{'type':Sequelize[_0xc0e7('0x2')]('string','variable',_0xc0e7('0x3'),_0xc0e7('0x4'),_0xc0e7('0x5')),'defaultValue':_0xc0e7('0x6')},'content':{'type':Sequelize[_0xc0e7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc0e7('0x2')](_0xc0e7('0x6'),'variable',_0xc0e7('0x3'))},'keyContent':{'type':Sequelize[_0xc0e7('0x7')]},'idField':{'type':Sequelize[_0xc0e7('0x7')]},'nameField':{'type':Sequelize[_0xc0e7('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc0e7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 7cdd2c9..377a0b1 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 _0x08b5=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','create','body','params','destroy','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv'];(function(_0x4f2e9a,_0x4507b3){var _0x36325b=function(_0x10dd27){while(--_0x10dd27){_0x4f2e9a['push'](_0x4f2e9a['shift']());}};_0x36325b(++_0x4507b3);}(_0x08b5,0x1bf));var _0x508b=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x08b5[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0x508b('0x0'));var rimraf=require(_0x508b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x508b('0x2'));var rp=require(_0x508b('0x3'));var moment=require(_0x508b('0x4'));var BPromise=require(_0x508b('0x5'));var Mustache=require(_0x508b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x508b('0x7'));var csv=require(_0x508b('0x8'));var ejs=require(_0x508b('0x9'));var fs=require('fs');var fs_extra=require(_0x508b('0xa'));var _=require(_0x508b('0xb'));var squel=require(_0x508b('0xc'));var crypto=require(_0x508b('0xd'));var jsforce=require(_0x508b('0xe'));var deskjs=require(_0x508b('0xf'));var toCsv=require(_0x508b('0x8'));var querystring=require(_0x508b('0x10'));var Papa=require(_0x508b('0x11'));var Redis=require(_0x508b('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x508b('0x13'));var hardwareService=require(_0x508b('0x14'));var logger=require('../../config/logger')(_0x508b('0x15'));var utils=require(_0x508b('0x16'));var config=require(_0x508b('0x17'));var licenseUtil=require(_0x508b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d492e,_0x426ce5){_0x426ce5=_0x426ce5||0xcc;return function(_0x108b19){if(_0x108b19){return _0x7d492e[_0x508b('0x19')](_0x426ce5);}return _0x7d492e[_0x508b('0x1a')](_0x426ce5)[_0x508b('0x1b')]();};}function respondWithResult(_0x461e04,_0x28a09c){_0x28a09c=_0x28a09c||0xc8;return function(_0x2c35aa){if(_0x2c35aa){return _0x461e04[_0x508b('0x1a')](_0x28a09c)[_0x508b('0x1c')](_0x2c35aa);}};}function respondWithFilteredResult(_0x437ef5,_0x22b6c8){return function(_0x1a04c0){if(_0x1a04c0){var _0x13b35b=typeof _0x22b6c8['offset']==='undefined'&&typeof _0x22b6c8['limit']===_0x508b('0x1d');var _0x310d35=_0x1a04c0[_0x508b('0x1e')];var _0x28c039=_0x13b35b?0x0:_0x22b6c8[_0x508b('0x1f')];var _0x127aa8=_0x13b35b?_0x1a04c0[_0x508b('0x1e')]:_0x22b6c8[_0x508b('0x1f')]+_0x22b6c8[_0x508b('0x20')];var _0x3b46cf;if(_0x127aa8>=_0x310d35){_0x127aa8=_0x310d35;_0x3b46cf=0xc8;}else{_0x3b46cf=0xce;}_0x437ef5['status'](_0x3b46cf);return _0x437ef5[_0x508b('0x21')](_0x508b('0x22'),_0x28c039+'-'+_0x127aa8+'/'+_0x310d35)['json'](_0x1a04c0);}return null;};}function patchUpdates(_0x462c78){return function(_0x31413a){try{jsonpatch[_0x508b('0x23')](_0x31413a,_0x462c78,!![]);}catch(_0x56a6c1){return BPromise[_0x508b('0x24')](_0x56a6c1);}return _0x31413a[_0x508b('0x25')]();};}function saveUpdates(_0x1d8f39,_0x5198b0){return function(_0x5c0747){if(_0x5c0747){return _0x5c0747[_0x508b('0x26')](_0x1d8f39)['then'](function(_0x2e39c8){return _0x2e39c8;});}return null;};}function removeEntity(_0x588a78,_0x294e66){return function(_0x1f5d0a){if(_0x1f5d0a){return _0x1f5d0a['destroy']()[_0x508b('0x27')](function(){_0x588a78[_0x508b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a26e2,_0x37df5f){return function(_0x525c36){if(!_0x525c36){_0x2a26e2[_0x508b('0x19')](0x194);}return _0x525c36;};}function handleError(_0x45e1d5,_0x370df0){_0x370df0=_0x370df0||0x1f4;return function(_0x4bc211){logger['error'](_0x4bc211[_0x508b('0x28')]);if(_0x4bc211['name']){delete _0x4bc211['name'];}_0x45e1d5['status'](_0x370df0)[_0x508b('0x29')](_0x4bc211);};}exports[_0x508b('0x2a')]=function(_0xbad364,_0x360f23){var _0x3b416d={},_0x5a3351={},_0xf25118={'count':0x0,'rows':[]};var _0x28ef3c=_[_0x508b('0x2b')](db[_0x508b('0x2c')][_0x508b('0x2d')],function(_0x3cdfc8){return{'name':_0x3cdfc8[_0x508b('0x2e')],'type':_0x3cdfc8['type'][_0x508b('0x2f')]};});_0x5a3351[_0x508b('0x30')]=_['map'](_0x28ef3c,_0x508b('0x31'));_0x5a3351['query']=_[_0x508b('0x32')](_0xbad364[_0x508b('0x33')]);_0x5a3351[_0x508b('0x34')]=_[_0x508b('0x35')](_0x5a3351[_0x508b('0x30')],_0x5a3351[_0x508b('0x33')]);_0x3b416d[_0x508b('0x36')]=_['intersection'](_0x5a3351[_0x508b('0x30')],qs['fields'](_0xbad364['query'][_0x508b('0x37')]));_0x3b416d[_0x508b('0x36')]=_0x3b416d[_0x508b('0x36')][_0x508b('0x38')]?_0x3b416d[_0x508b('0x36')]:_0x5a3351[_0x508b('0x30')];if(!_0xbad364[_0x508b('0x33')][_0x508b('0x39')]('nolimit')){_0x3b416d[_0x508b('0x20')]=qs[_0x508b('0x20')](_0xbad364['query']['limit']);_0x3b416d[_0x508b('0x1f')]=qs[_0x508b('0x1f')](_0xbad364[_0x508b('0x33')][_0x508b('0x1f')]);}_0x3b416d['order']=qs[_0x508b('0x3a')](_0xbad364['query'][_0x508b('0x3a')]);_0x3b416d[_0x508b('0x3b')]=qs[_0x508b('0x34')](_[_0x508b('0x3c')](_0xbad364['query'],_0x5a3351[_0x508b('0x34')]),_0x28ef3c);if(_0xbad364[_0x508b('0x33')][_0x508b('0x3d')]){_0x3b416d[_0x508b('0x3b')]=_[_0x508b('0x3e')](_0x3b416d[_0x508b('0x3b')],{'$or':_[_0x508b('0x2b')](_0x28ef3c,function(_0x2df11b){if(_0x2df11b[_0x508b('0x3f')]!==_0x508b('0x40')){var _0x23cad7={};_0x23cad7[_0x2df11b[_0x508b('0x31')]]={'$like':'%'+_0xbad364[_0x508b('0x33')]['filter']+'%'};return _0x23cad7;}})});}_0x3b416d=_['merge']({},_0x3b416d,_0xbad364[_0x508b('0x41')]);var _0x31a29b={'where':_0x3b416d['where']};return db[_0x508b('0x2c')][_0x508b('0x1e')](_0x31a29b)['then'](function(_0xcfc49f){_0xf25118[_0x508b('0x1e')]=_0xcfc49f;if(_0xbad364[_0x508b('0x33')]['includeAll']){_0x3b416d[_0x508b('0x42')]=[{'all':!![]}];}return db[_0x508b('0x2c')][_0x508b('0x43')](_0x3b416d);})[_0x508b('0x27')](function(_0x13ebd8){_0xf25118[_0x508b('0x44')]=_0x13ebd8;return _0xf25118;})[_0x508b('0x27')](respondWithFilteredResult(_0x360f23,_0x3b416d))[_0x508b('0x45')](handleError(_0x360f23,null));};exports[_0x508b('0x46')]=function(_0xc90400,_0x4ce488){var _0x228015={'raw':!![],'where':{'id':_0xc90400['params']['id']}},_0x4d2132={};_0x4d2132[_0x508b('0x30')]=_[_0x508b('0x32')](db[_0x508b('0x2c')]['rawAttributes']);_0x4d2132[_0x508b('0x33')]=_[_0x508b('0x32')](_0xc90400[_0x508b('0x33')]);_0x4d2132[_0x508b('0x34')]=_[_0x508b('0x35')](_0x4d2132[_0x508b('0x30')],_0x4d2132[_0x508b('0x33')]);_0x228015[_0x508b('0x36')]=_[_0x508b('0x35')](_0x4d2132[_0x508b('0x30')],qs[_0x508b('0x37')](_0xc90400[_0x508b('0x33')]['fields']));_0x228015[_0x508b('0x36')]=_0x228015[_0x508b('0x36')][_0x508b('0x38')]?_0x228015[_0x508b('0x36')]:_0x4d2132[_0x508b('0x30')];if(_0xc90400[_0x508b('0x33')]['includeAll']){_0x228015[_0x508b('0x42')]=[{'all':!![]}];}_0x228015=_[_0x508b('0x3e')]({},_0x228015,_0xc90400[_0x508b('0x41')]);return db[_0x508b('0x2c')]['find'](_0x228015)[_0x508b('0x27')](handleEntityNotFound(_0x4ce488,null))[_0x508b('0x27')](respondWithResult(_0x4ce488,null))['catch'](handleError(_0x4ce488,null));};exports[_0x508b('0x47')]=function(_0x5786cf,_0x2f55a4){return db[_0x508b('0x2c')][_0x508b('0x47')](_0x5786cf[_0x508b('0x48')],{})[_0x508b('0x27')](respondWithResult(_0x2f55a4,0xc9))[_0x508b('0x45')](handleError(_0x2f55a4,null));};exports[_0x508b('0x26')]=function(_0x34f70e,_0xe56856){if(_0x34f70e[_0x508b('0x48')]['id']){delete _0x34f70e[_0x508b('0x48')]['id'];}return db[_0x508b('0x2c')]['find']({'where':{'id':_0x34f70e[_0x508b('0x49')]['id']}})[_0x508b('0x27')](handleEntityNotFound(_0xe56856,null))[_0x508b('0x27')](saveUpdates(_0x34f70e[_0x508b('0x48')],null))['then'](respondWithResult(_0xe56856,null))['catch'](handleError(_0xe56856,null));};exports[_0x508b('0x4a')]=function(_0x3c7244,_0x1c16ac){return db[_0x508b('0x2c')][_0x508b('0x4b')]({'where':{'id':_0x3c7244[_0x508b('0x49')]['id']}})[_0x508b('0x27')](handleEntityNotFound(_0x1c16ac,null))[_0x508b('0x27')](removeEntity(_0x1c16ac,null))[_0x508b('0x45')](handleError(_0x1c16ac,null));}; \ No newline at end of file +var _0x122f=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','undefined','limit','count','offset','status','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map','ServicenowField','fieldName','type','key','query','filters','intersection','model','fields','attributes','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x122f,0x119));var _0xf122=function(_0x3507d9,_0x52c298){_0x3507d9=_0x3507d9-0x0;var _0x184d00=_0x122f[_0x3507d9];return _0x184d00;};'use strict';var emlformat=require(_0xf122('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf122('0x1'));var rp=require('request-promise');var moment=require(_0xf122('0x2'));var BPromise=require(_0xf122('0x3'));var Mustache=require('mustache');var util=require(_0xf122('0x4'));var path=require(_0xf122('0x5'));var sox=require(_0xf122('0x6'));var csv=require(_0xf122('0x7'));var ejs=require(_0xf122('0x8'));var fs=require('fs');var fs_extra=require(_0xf122('0x9'));var _=require('lodash');var squel=require(_0xf122('0xa'));var crypto=require(_0xf122('0xb'));var jsforce=require(_0xf122('0xc'));var deskjs=require(_0xf122('0xd'));var toCsv=require(_0xf122('0x7'));var querystring=require(_0xf122('0xe'));var Papa=require(_0xf122('0xf'));var Redis=require(_0xf122('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf122('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf122('0x12'));var logger=require(_0xf122('0x13'))('api');var utils=require(_0xf122('0x14'));var config=require(_0xf122('0x15'));var licenseUtil=require(_0xf122('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c7d3,_0x270960){_0x270960=_0x270960||0xcc;return function(_0x3caea3){if(_0x3caea3){return _0x14c7d3[_0xf122('0x17')](_0x270960);}return _0x14c7d3['status'](_0x270960)[_0xf122('0x18')]();};}function respondWithResult(_0x260363,_0x2cacc6){_0x2cacc6=_0x2cacc6||0xc8;return function(_0x43d798){if(_0x43d798){return _0x260363['status'](_0x2cacc6)['json'](_0x43d798);}};}function respondWithFilteredResult(_0x2aebe9,_0x5b26e8){return function(_0x17c669){if(_0x17c669){var _0x461b96=typeof _0x5b26e8['offset']===_0xf122('0x19')&&typeof _0x5b26e8[_0xf122('0x1a')]===_0xf122('0x19');var _0x578e4a=_0x17c669[_0xf122('0x1b')];var _0x255b4d=_0x461b96?0x0:_0x5b26e8[_0xf122('0x1c')];var _0x36141f=_0x461b96?_0x17c669[_0xf122('0x1b')]:_0x5b26e8['offset']+_0x5b26e8[_0xf122('0x1a')];var _0x240e64;if(_0x36141f>=_0x578e4a){_0x36141f=_0x578e4a;_0x240e64=0xc8;}else{_0x240e64=0xce;}_0x2aebe9[_0xf122('0x1d')](_0x240e64);return _0x2aebe9[_0xf122('0x1e')]('Content-Range',_0x255b4d+'-'+_0x36141f+'/'+_0x578e4a)[_0xf122('0x1f')](_0x17c669);}return null;};}function patchUpdates(_0x13add5){return function(_0x5356b2){try{jsonpatch[_0xf122('0x20')](_0x5356b2,_0x13add5,!![]);}catch(_0x3166af){return BPromise[_0xf122('0x21')](_0x3166af);}return _0x5356b2[_0xf122('0x22')]();};}function saveUpdates(_0x5ac28c,_0x112ec1){return function(_0x4a1468){if(_0x4a1468){return _0x4a1468[_0xf122('0x23')](_0x5ac28c)[_0xf122('0x24')](function(_0x195386){return _0x195386;});}return null;};}function removeEntity(_0x5adee4,_0x23c614){return function(_0x37840f){if(_0x37840f){return _0x37840f[_0xf122('0x25')]()[_0xf122('0x24')](function(){_0x5adee4[_0xf122('0x1d')](0xcc)[_0xf122('0x18')]();});}};}function handleEntityNotFound(_0x287d39,_0x41f642){return function(_0x125dda){if(!_0x125dda){_0x287d39[_0xf122('0x17')](0x194);}return _0x125dda;};}function handleError(_0x174c5e,_0x389a03){_0x389a03=_0x389a03||0x1f4;return function(_0x1bbc52){logger[_0xf122('0x26')](_0x1bbc52['stack']);if(_0x1bbc52[_0xf122('0x27')]){delete _0x1bbc52['name'];}_0x174c5e['status'](_0x389a03)[_0xf122('0x28')](_0x1bbc52);};}exports[_0xf122('0x29')]=function(_0x2b1532,_0x5d0559){var _0x39963c={},_0x5a6d8c={},_0x23c0a7={'count':0x0,'rows':[]};var _0x4b32f3=_[_0xf122('0x2a')](db[_0xf122('0x2b')]['rawAttributes'],function(_0x3841ab){return{'name':_0x3841ab[_0xf122('0x2c')],'type':_0x3841ab[_0xf122('0x2d')][_0xf122('0x2e')]};});_0x5a6d8c['model']=_[_0xf122('0x2a')](_0x4b32f3,_0xf122('0x27'));_0x5a6d8c[_0xf122('0x2f')]=_['keys'](_0x2b1532[_0xf122('0x2f')]);_0x5a6d8c[_0xf122('0x30')]=_[_0xf122('0x31')](_0x5a6d8c[_0xf122('0x32')],_0x5a6d8c[_0xf122('0x2f')]);_0x39963c['attributes']=_['intersection'](_0x5a6d8c[_0xf122('0x32')],qs[_0xf122('0x33')](_0x2b1532[_0xf122('0x2f')][_0xf122('0x33')]));_0x39963c[_0xf122('0x34')]=_0x39963c[_0xf122('0x34')]['length']?_0x39963c[_0xf122('0x34')]:_0x5a6d8c[_0xf122('0x32')];if(!_0x2b1532[_0xf122('0x2f')]['hasOwnProperty'](_0xf122('0x35'))){_0x39963c[_0xf122('0x1a')]=qs[_0xf122('0x1a')](_0x2b1532['query'][_0xf122('0x1a')]);_0x39963c['offset']=qs[_0xf122('0x1c')](_0x2b1532[_0xf122('0x2f')]['offset']);}_0x39963c['order']=qs[_0xf122('0x36')](_0x2b1532['query'][_0xf122('0x36')]);_0x39963c[_0xf122('0x37')]=qs[_0xf122('0x30')](_['pick'](_0x2b1532[_0xf122('0x2f')],_0x5a6d8c['filters']),_0x4b32f3);if(_0x2b1532['query'][_0xf122('0x38')]){_0x39963c[_0xf122('0x37')]=_['merge'](_0x39963c[_0xf122('0x37')],{'$or':_[_0xf122('0x2a')](_0x4b32f3,function(_0x383be2){if(_0x383be2['type']!==_0xf122('0x39')){var _0xcf039a={};_0xcf039a[_0x383be2[_0xf122('0x27')]]={'$like':'%'+_0x2b1532[_0xf122('0x2f')]['filter']+'%'};return _0xcf039a;}})});}_0x39963c=_[_0xf122('0x3a')]({},_0x39963c,_0x2b1532[_0xf122('0x3b')]);var _0x4b157d={'where':_0x39963c[_0xf122('0x37')]};return db['ServicenowField'][_0xf122('0x1b')](_0x4b157d)['then'](function(_0x59c882){_0x23c0a7[_0xf122('0x1b')]=_0x59c882;if(_0x2b1532[_0xf122('0x2f')][_0xf122('0x3c')]){_0x39963c['include']=[{'all':!![]}];}return db['ServicenowField'][_0xf122('0x3d')](_0x39963c);})['then'](function(_0x2b90be){_0x23c0a7[_0xf122('0x3e')]=_0x2b90be;return _0x23c0a7;})['then'](respondWithFilteredResult(_0x5d0559,_0x39963c))[_0xf122('0x3f')](handleError(_0x5d0559,null));};exports[_0xf122('0x40')]=function(_0x5e0a95,_0x4bf6dc){var _0x1d9f45={'raw':!![],'where':{'id':_0x5e0a95[_0xf122('0x41')]['id']}},_0x2b378c={};_0x2b378c[_0xf122('0x32')]=_[_0xf122('0x42')](db[_0xf122('0x2b')][_0xf122('0x43')]);_0x2b378c[_0xf122('0x2f')]=_[_0xf122('0x42')](_0x5e0a95[_0xf122('0x2f')]);_0x2b378c['filters']=_[_0xf122('0x31')](_0x2b378c[_0xf122('0x32')],_0x2b378c[_0xf122('0x2f')]);_0x1d9f45[_0xf122('0x34')]=_['intersection'](_0x2b378c[_0xf122('0x32')],qs[_0xf122('0x33')](_0x5e0a95['query']['fields']));_0x1d9f45['attributes']=_0x1d9f45[_0xf122('0x34')][_0xf122('0x44')]?_0x1d9f45[_0xf122('0x34')]:_0x2b378c[_0xf122('0x32')];if(_0x5e0a95[_0xf122('0x2f')]['includeAll']){_0x1d9f45[_0xf122('0x45')]=[{'all':!![]}];}_0x1d9f45=_['merge']({},_0x1d9f45,_0x5e0a95[_0xf122('0x3b')]);return db[_0xf122('0x2b')][_0xf122('0x46')](_0x1d9f45)[_0xf122('0x24')](handleEntityNotFound(_0x4bf6dc,null))[_0xf122('0x24')](respondWithResult(_0x4bf6dc,null))[_0xf122('0x3f')](handleError(_0x4bf6dc,null));};exports[_0xf122('0x47')]=function(_0x5ed8d4,_0x4a74c6){return db[_0xf122('0x2b')][_0xf122('0x47')](_0x5ed8d4[_0xf122('0x48')],{})[_0xf122('0x24')](respondWithResult(_0x4a74c6,0xc9))[_0xf122('0x3f')](handleError(_0x4a74c6,null));};exports[_0xf122('0x23')]=function(_0x2d05fe,_0x4a0452){if(_0x2d05fe[_0xf122('0x48')]['id']){delete _0x2d05fe['body']['id'];}return db['ServicenowField'][_0xf122('0x46')]({'where':{'id':_0x2d05fe[_0xf122('0x41')]['id']}})[_0xf122('0x24')](handleEntityNotFound(_0x4a0452,null))[_0xf122('0x24')](saveUpdates(_0x2d05fe['body'],null))[_0xf122('0x24')](respondWithResult(_0x4a0452,null))[_0xf122('0x3f')](handleError(_0x4a0452,null));};exports['destroy']=function(_0x25a95f,_0x38cba8){return db[_0xf122('0x2b')][_0xf122('0x46')]({'where':{'id':_0x25a95f[_0xf122('0x41')]['id']}})[_0xf122('0x24')](handleEntityNotFound(_0x38cba8,null))[_0xf122('0x24')](removeEntity(_0x38cba8,null))[_0xf122('0x3f')](handleError(_0x38cba8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index ec9267c..2aa8b60 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 _0x8c63=['../../config/environment','exports','define','ServicenowField','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3ec014,_0x399f43){var _0x49531f=function(_0x152e05){while(--_0x152e05){_0x3ec014['push'](_0x3ec014['shift']());}};_0x49531f(++_0x399f43);}(_0x8c63,0x116));var _0x38c6=function(_0x2c3ed9,_0x5f0b97){_0x2c3ed9=_0x2c3ed9-0x0;var _0x1379f8=_0x8c63[_0x2c3ed9];return _0x1379f8;};'use strict';var _=require(_0x38c6('0x0'));var util=require(_0x38c6('0x1'));var logger=require(_0x38c6('0x2'))(_0x38c6('0x3'));var moment=require(_0x38c6('0x4'));var BPromise=require(_0x38c6('0x5'));var rp=require(_0x38c6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38c6('0x7'));var config=require(_0x38c6('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x38c6('0x9')]=function(_0x246c19,_0x2f7f91){return _0x246c19[_0x38c6('0xa')](_0x38c6('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x38c6('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb84=['./intServicenowField.attributes','exports','define','ServicenowField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x14c891,_0x1c30ea){var _0x15b13a=function(_0x4ba4a9){while(--_0x4ba4a9){_0x14c891['push'](_0x14c891['shift']());}};_0x15b13a(++_0x1c30ea);}(_0xcb84,0x109));var _0x4cb8=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0xcb84[_0x4c321c];return _0x25accb;};'use strict';var _=require(_0x4cb8('0x0'));var util=require(_0x4cb8('0x1'));var logger=require(_0x4cb8('0x2'))(_0x4cb8('0x3'));var moment=require(_0x4cb8('0x4'));var BPromise=require('bluebird');var rp=require(_0x4cb8('0x5'));var fs=require('fs');var path=require(_0x4cb8('0x6'));var rimraf=require('rimraf');var config=require(_0x4cb8('0x7'));var attributes=require(_0x4cb8('0x8'));module[_0x4cb8('0x9')]=function(_0x16a2dd,_0x4192db){return _0x16a2dd[_0x4cb8('0xa')](_0x4cb8('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x4cb8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 3b0b5b2..dc0e39b 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x244cef,_0xbce3ec){var _0x32139b=function(_0x12d1f4){while(--_0x12d1f4){_0x244cef['push'](_0x244cef['shift']());}};_0x32139b(++_0xbce3ec);}(_0xaa88,0x137));var _0x8aa8=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0xaa88[_0x2932cf];return _0x1711dd;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xb6e21,_0xef74f){var _0x859ae0=function(_0x299838){while(--_0x299838){_0xb6e21['push'](_0xb6e21['shift']());}};_0x859ae0(++_0xef74f);}(_0xe706,0xa3));var _0x6e70=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xe706[_0x378b4];return _0x11d07b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 1a52595..55cdec8 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(_0xdb3560,_0x4348d5){var _0x4eae43=function(_0x42866e){while(--_0x42866e){_0xdb3560['push'](_0xdb3560['shift']());}};_0x4eae43(++_0x4348d5);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4a2971,_0x57e7f8){var _0x13e929=function(_0x4a72c9){while(--_0x4a72c9){_0x4a2971['push'](_0x4a2971['shift']());}};_0x13e929(++_0x57e7f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e4ee5e5..d706ec3 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(_0x1701da,_0x3cdb68){var _0x3d2ad3=function(_0x14bd0f){while(--_0x14bd0f){_0x1701da['push'](_0x1701da['shift']());}};_0x3d2ad3(++_0x3cdb68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x271f88,_0x3efa90){var _0x538bd4=function(_0x1403f3){while(--_0x1403f3){_0x271f88['push'](_0x271f88['shift']());}};_0x538bd4(++_0x3efa90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 c23c65f..9d71c4e 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 _0xa1f2=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','created_by','date_start','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','remove','includes','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','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','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','SugarcrmAccount','fieldName','type','model'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xa1f2,0x1b3));var _0x2a1f=function(_0x5a4988,_0xe5d68b){_0x5a4988=_0x5a4988-0x0;var _0x3e48bc=_0xa1f2[_0x5a4988];return _0x3e48bc;};'use strict';var emlformat=require(_0x2a1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a1f('0x1'));var jsonpatch=require(_0x2a1f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a1f('0x3'));var util=require(_0x2a1f('0x4'));var path=require(_0x2a1f('0x5'));var sox=require(_0x2a1f('0x6'));var csv=require('to-csv');var ejs=require(_0x2a1f('0x7'));var fs=require('fs');var fs_extra=require(_0x2a1f('0x8'));var _=require(_0x2a1f('0x9'));var squel=require(_0x2a1f('0xa'));var crypto=require(_0x2a1f('0xb'));var jsforce=require(_0x2a1f('0xc'));var deskjs=require(_0x2a1f('0xd'));var toCsv=require(_0x2a1f('0xe'));var querystring=require(_0x2a1f('0xf'));var Papa=require(_0x2a1f('0x10'));var Redis=require(_0x2a1f('0x11'));var authService=require(_0x2a1f('0x12'));var qs=require(_0x2a1f('0x13'));var as=require(_0x2a1f('0x14'));var hardwareService=require(_0x2a1f('0x15'));var logger=require(_0x2a1f('0x16'))(_0x2a1f('0x17'));var utils=require(_0x2a1f('0x18'));var config=require(_0x2a1f('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x2a1f('0x1a'));function respondWithStatusCode(_0x589877,_0x5d2913){_0x5d2913=_0x5d2913||0xcc;return function(_0x7f5142){if(_0x7f5142){return _0x589877[_0x2a1f('0x1b')](_0x5d2913);}return _0x589877[_0x2a1f('0x1c')](_0x5d2913)['end']();};}function respondWithResult(_0x5712b2,_0x2e6e1f){_0x2e6e1f=_0x2e6e1f||0xc8;return function(_0x2be894){if(_0x2be894){return _0x5712b2[_0x2a1f('0x1c')](_0x2e6e1f)[_0x2a1f('0x1d')](_0x2be894);}};}function respondWithFilteredResult(_0x4e7632,_0x148950){return function(_0x1c37a0){if(_0x1c37a0){var _0x44b15f=typeof _0x148950['offset']===_0x2a1f('0x1e')&&typeof _0x148950[_0x2a1f('0x1f')]===_0x2a1f('0x1e');var _0x913eca=_0x1c37a0[_0x2a1f('0x20')];var _0x37866e=_0x44b15f?0x0:_0x148950[_0x2a1f('0x21')];var _0xbe4e78=_0x44b15f?_0x1c37a0['count']:_0x148950['offset']+_0x148950['limit'];var _0x615878;if(_0xbe4e78>=_0x913eca){_0xbe4e78=_0x913eca;_0x615878=0xc8;}else{_0x615878=0xce;}_0x4e7632[_0x2a1f('0x1c')](_0x615878);return _0x4e7632[_0x2a1f('0x22')](_0x2a1f('0x23'),_0x37866e+'-'+_0xbe4e78+'/'+_0x913eca)[_0x2a1f('0x1d')](_0x1c37a0);}return null;};}function patchUpdates(_0x35cb1a){return function(_0x2d21f2){try{jsonpatch[_0x2a1f('0x24')](_0x2d21f2,_0x35cb1a,!![]);}catch(_0x4f17be){return BPromise[_0x2a1f('0x25')](_0x4f17be);}return _0x2d21f2[_0x2a1f('0x26')]();};}function saveUpdates(_0x48bc9c,_0x2154b6){return function(_0x1db804){if(_0x1db804){return _0x1db804[_0x2a1f('0x27')](_0x48bc9c)['then'](function(_0x2ae1ff){return _0x2ae1ff;});}return null;};}function removeEntity(_0x1f4619,_0x45b2a9){return function(_0x44d260){if(_0x44d260){return _0x44d260[_0x2a1f('0x28')]()[_0x2a1f('0x29')](function(){_0x1f4619['status'](0xcc)[_0x2a1f('0x2a')]();});}};}function handleEntityNotFound(_0x523e47,_0x5d1f2d){return function(_0x3698b6){if(!_0x3698b6){_0x523e47[_0x2a1f('0x1b')](0x194);}return _0x3698b6;};}function handleError(_0x382161,_0x39f438){_0x39f438=_0x39f438||0x1f4;return function(_0x301107){logger[_0x2a1f('0x2b')](_0x301107[_0x2a1f('0x2c')]);if(_0x301107[_0x2a1f('0x2d')]){delete _0x301107[_0x2a1f('0x2d')];}_0x382161[_0x2a1f('0x1c')](_0x39f438)[_0x2a1f('0x2e')](_0x301107);};}exports[_0x2a1f('0x2f')]=function(_0x45cd82,_0x2d6d7c){var _0x4e7d77={},_0x5cc3dd={},_0x679b63={'count':0x0,'rows':[]};var _0x78a3ff=_[_0x2a1f('0x30')](db[_0x2a1f('0x31')]['rawAttributes'],function(_0x264da9){return{'name':_0x264da9[_0x2a1f('0x32')],'type':_0x264da9[_0x2a1f('0x33')]['key']};});_0x5cc3dd[_0x2a1f('0x34')]=_[_0x2a1f('0x30')](_0x78a3ff,_0x2a1f('0x2d'));_0x5cc3dd['query']=_[_0x2a1f('0x35')](_0x45cd82[_0x2a1f('0x36')]);_0x5cc3dd[_0x2a1f('0x37')]=_[_0x2a1f('0x38')](_0x5cc3dd[_0x2a1f('0x34')],_0x5cc3dd['query']);_0x4e7d77[_0x2a1f('0x39')]=_[_0x2a1f('0x38')](_0x5cc3dd[_0x2a1f('0x34')],qs[_0x2a1f('0x3a')](_0x45cd82[_0x2a1f('0x36')][_0x2a1f('0x3a')]));_0x4e7d77[_0x2a1f('0x39')]=_0x4e7d77[_0x2a1f('0x39')][_0x2a1f('0x3b')]?_0x4e7d77['attributes']:_0x5cc3dd['model'];if(!_0x45cd82[_0x2a1f('0x36')][_0x2a1f('0x3c')](_0x2a1f('0x3d'))){_0x4e7d77['limit']=qs['limit'](_0x45cd82[_0x2a1f('0x36')][_0x2a1f('0x1f')]);_0x4e7d77[_0x2a1f('0x21')]=qs[_0x2a1f('0x21')](_0x45cd82[_0x2a1f('0x36')]['offset']);}_0x4e7d77['order']=qs['sort'](_0x45cd82[_0x2a1f('0x36')][_0x2a1f('0x3e')]);_0x4e7d77['where']=qs['filters'](_[_0x2a1f('0x3f')](_0x45cd82[_0x2a1f('0x36')],_0x5cc3dd[_0x2a1f('0x37')]),_0x78a3ff);if(_0x45cd82[_0x2a1f('0x36')][_0x2a1f('0x40')]){_0x4e7d77[_0x2a1f('0x41')]=_['merge'](_0x4e7d77['where'],{'$or':_[_0x2a1f('0x30')](_0x78a3ff,function(_0x1f1225){if(_0x1f1225[_0x2a1f('0x33')]!==_0x2a1f('0x42')){var _0x441ace={};_0x441ace[_0x1f1225['name']]={'$like':'%'+_0x45cd82[_0x2a1f('0x36')]['filter']+'%'};return _0x441ace;}})});}_0x4e7d77=_[_0x2a1f('0x43')]({},_0x4e7d77,_0x45cd82[_0x2a1f('0x44')]);var _0x3b6851={'where':_0x4e7d77[_0x2a1f('0x41')]};return db['SugarcrmAccount']['count'](_0x3b6851)[_0x2a1f('0x29')](function(_0x508cf5){_0x679b63['count']=_0x508cf5;if(_0x45cd82['query'][_0x2a1f('0x45')]){_0x4e7d77[_0x2a1f('0x46')]=[{'all':!![]}];}return db[_0x2a1f('0x31')][_0x2a1f('0x47')](_0x4e7d77);})[_0x2a1f('0x29')](function(_0x1e86db){_0x679b63[_0x2a1f('0x48')]=_0x1e86db;return _0x679b63;})[_0x2a1f('0x29')](respondWithFilteredResult(_0x2d6d7c,_0x4e7d77))[_0x2a1f('0x49')](handleError(_0x2d6d7c,null));};exports['show']=function(_0x4a5c6b,_0x372a87){var _0x7f3267={'raw':![],'where':{'id':_0x4a5c6b[_0x2a1f('0x4a')]['id']}},_0x58885a={};_0x58885a[_0x2a1f('0x34')]=_[_0x2a1f('0x35')](db[_0x2a1f('0x31')][_0x2a1f('0x4b')]);_0x58885a['query']=_[_0x2a1f('0x35')](_0x4a5c6b[_0x2a1f('0x36')]);_0x58885a[_0x2a1f('0x37')]=_[_0x2a1f('0x38')](_0x58885a[_0x2a1f('0x34')],_0x58885a[_0x2a1f('0x36')]);_0x7f3267[_0x2a1f('0x39')]=_[_0x2a1f('0x38')](_0x58885a[_0x2a1f('0x34')],qs[_0x2a1f('0x3a')](_0x4a5c6b[_0x2a1f('0x36')][_0x2a1f('0x3a')]));_0x7f3267['attributes']=_0x7f3267[_0x2a1f('0x39')][_0x2a1f('0x3b')]?_0x7f3267[_0x2a1f('0x39')]:_0x58885a[_0x2a1f('0x34')];if(_0x4a5c6b[_0x2a1f('0x36')][_0x2a1f('0x45')]){_0x7f3267['include']=[{'all':!![]}];}_0x7f3267=_[_0x2a1f('0x43')]({},_0x7f3267,_0x4a5c6b[_0x2a1f('0x44')]);return db[_0x2a1f('0x31')][_0x2a1f('0x4c')](_0x7f3267)[_0x2a1f('0x29')](handleEntityNotFound(_0x372a87,null))[_0x2a1f('0x29')](respondWithResult(_0x372a87,null))[_0x2a1f('0x49')](handleError(_0x372a87,null));};exports[_0x2a1f('0x4d')]=function(_0x418b06,_0x5543ec){return db[_0x2a1f('0x31')][_0x2a1f('0x4d')](_0x418b06[_0x2a1f('0x4e')],{})[_0x2a1f('0x29')](respondWithResult(_0x5543ec,0xc9))[_0x2a1f('0x49')](handleError(_0x5543ec,null));};exports['update']=function(_0x57f339,_0x94963f){if(_0x57f339[_0x2a1f('0x4e')]['id']){delete _0x57f339['body']['id'];}return db[_0x2a1f('0x31')][_0x2a1f('0x4c')]({'where':{'id':_0x57f339[_0x2a1f('0x4a')]['id']}})[_0x2a1f('0x29')](handleEntityNotFound(_0x94963f,null))['then'](saveUpdates(_0x57f339[_0x2a1f('0x4e')],null))[_0x2a1f('0x29')](respondWithResult(_0x94963f,null))[_0x2a1f('0x49')](handleError(_0x94963f,null));};exports[_0x2a1f('0x28')]=function(_0x14cf1e,_0x1aa0f3){return db[_0x2a1f('0x31')][_0x2a1f('0x4c')]({'where':{'id':_0x14cf1e[_0x2a1f('0x4a')]['id']}})[_0x2a1f('0x29')](handleEntityNotFound(_0x1aa0f3,null))[_0x2a1f('0x29')](removeEntity(_0x1aa0f3,null))[_0x2a1f('0x49')](handleError(_0x1aa0f3,null));};exports[_0x2a1f('0x4f')]=function(_0x161434,_0x596f59,_0x840cd7){var _0x3b6c31={};var _0x5ba046={};var _0x1bfca7;var _0x1eb547;return db[_0x2a1f('0x31')][_0x2a1f('0x50')]({'where':{'id':_0x161434[_0x2a1f('0x4a')]['id']}})[_0x2a1f('0x29')](handleEntityNotFound(_0x596f59,null))[_0x2a1f('0x29')](function(_0x32e19d){if(_0x32e19d){_0x1bfca7=_0x32e19d;_0x5ba046['model']=_[_0x2a1f('0x35')](db['SugarcrmConfiguration'][_0x2a1f('0x4b')]);_0x5ba046[_0x2a1f('0x36')]=_[_0x2a1f('0x35')](_0x161434[_0x2a1f('0x36')]);_0x5ba046[_0x2a1f('0x37')]=_[_0x2a1f('0x38')](_0x5ba046[_0x2a1f('0x34')],_0x5ba046[_0x2a1f('0x36')]);_0x3b6c31[_0x2a1f('0x39')]=_[_0x2a1f('0x38')](_0x5ba046[_0x2a1f('0x34')],qs['fields'](_0x161434['query']['fields']));_0x3b6c31['attributes']=_0x3b6c31[_0x2a1f('0x39')][_0x2a1f('0x3b')]?_0x3b6c31[_0x2a1f('0x39')]:_0x5ba046[_0x2a1f('0x34')];_0x3b6c31[_0x2a1f('0x51')]=qs[_0x2a1f('0x3e')](_0x161434['query']['sort']);_0x3b6c31['where']=qs[_0x2a1f('0x37')](_[_0x2a1f('0x3f')](_0x161434['query'],_0x5ba046['filters']));if(_0x161434[_0x2a1f('0x36')][_0x2a1f('0x40')]){_0x3b6c31[_0x2a1f('0x41')]=_[_0x2a1f('0x43')](_0x3b6c31[_0x2a1f('0x41')],{'$or':_[_0x2a1f('0x30')](_0x3b6c31[_0x2a1f('0x39')],function(_0x1c7a79){var _0x2e9690={};_0x2e9690[_0x1c7a79]={'$like':'%'+_0x161434[_0x2a1f('0x36')][_0x2a1f('0x40')]+'%'};return _0x2e9690;})});}_0x3b6c31=_[_0x2a1f('0x43')]({},_0x3b6c31,_0x161434[_0x2a1f('0x44')]);return _0x1bfca7[_0x2a1f('0x4f')](_0x3b6c31);}})['then'](function(_0x47c25e){if(_0x47c25e){_0x1eb547=_0x47c25e['length'];if(!_0x161434[_0x2a1f('0x36')]['hasOwnProperty'](_0x2a1f('0x3d'))){_0x3b6c31[_0x2a1f('0x1f')]=qs['limit'](_0x161434[_0x2a1f('0x36')][_0x2a1f('0x1f')]);_0x3b6c31['offset']=qs[_0x2a1f('0x21')](_0x161434[_0x2a1f('0x36')][_0x2a1f('0x21')]);}return _0x1bfca7['getConfigurations'](_0x3b6c31);}})['then'](function(_0x2269ac){if(_0x2269ac){return _0x2269ac?{'count':_0x1eb547,'rows':_0x2269ac}:null;}})[_0x2a1f('0x29')](respondWithResult(_0x596f59,null))[_0x2a1f('0x49')](handleError(_0x596f59,null));};exports[_0x2a1f('0x52')]=function(_0x77c572,_0x56ef94,_0x23690e){if(_0x77c572[_0x2a1f('0x4e')]['id']){delete _0x77c572[_0x2a1f('0x4e')]['id'];}return db[_0x2a1f('0x31')][_0x2a1f('0x50')]({'where':{'id':_0x77c572['params']['id']}})[_0x2a1f('0x29')](handleEntityNotFound(_0x56ef94,null))[_0x2a1f('0x29')](function(_0x4bba2a){if(_0x4bba2a){_0x77c572[_0x2a1f('0x4e')][_0x2a1f('0x53')]=_0x4bba2a['id'];_0x77c572[_0x2a1f('0x4e')][_0x2a1f('0x54')]=integrations[_0x2a1f('0x55')](_0x77c572['body'][_0x2a1f('0x56')],_0x77c572[_0x2a1f('0x4e')][_0x2a1f('0x33')]);_0x77c572[_0x2a1f('0x4e')][_0x2a1f('0x57')]=integrations[_0x2a1f('0x58')](_0x77c572[_0x2a1f('0x4e')]['channel'],_0x77c572[_0x2a1f('0x4e')][_0x2a1f('0x33')]);return db[_0x2a1f('0x59')][_0x2a1f('0x4d')](_0x77c572[_0x2a1f('0x4e')],{'include':[{'model':db[_0x2a1f('0x5a')],'as':_0x2a1f('0x54')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x2a1f('0x29')](respondWithResult(_0x56ef94,null))[_0x2a1f('0x49')](handleError(_0x56ef94,null));};exports[_0x2a1f('0x5b')]=function(_0x19624e,_0x3d86fc,_0x5e1f20){var _0x415781='';var _0x3a12d7=['id',_0x2a1f('0x2d'),'assigned_user_id',_0x2a1f('0x5c'),'description',_0x2a1f('0x5d'),'duration_hours',_0x2a1f('0x5e'),_0x2a1f('0x5f'),_0x2a1f('0x60'),'parent_name',_0x2a1f('0x61')];return db[_0x2a1f('0x31')][_0x2a1f('0x50')]({'where':{'id':_0x19624e[_0x2a1f('0x4a')]['id']},'attributes':['id',_0x2a1f('0x62'),_0x2a1f('0x63'),_0x2a1f('0x64')]})[_0x2a1f('0x29')](handleEntityNotFound(_0x3d86fc,null))[_0x2a1f('0x29')](function(_0x8ee879){if(_0x8ee879){_0x415781=_0x8ee879['remoteUri'];var _0x4b1eb4=_0x415781[_0x2a1f('0x65')](-0x1);if(_0x4b1eb4==='/'){_0x415781=_0x415781[_0x2a1f('0x66')](0x0,_0x415781[_0x2a1f('0x67')](_0x4b1eb4));}return rp({'method':_0x2a1f('0x68'),'uri':util[_0x2a1f('0x69')](_0x2a1f('0x6a'),_0x415781,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x2a1f('0x6b'),'response_type':_0x2a1f('0x6b'),'rest_data':JSON[_0x2a1f('0x6c')]({'user_auth':{'user_name':_0x8ee879[_0x2a1f('0x62')],'password':_0x8ee879[_0x2a1f('0x63')],'encryption':_0x2a1f('0x6d')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x2a1f('0x29')](function(_0x10d813){if(_0x10d813&&_0x10d813['name']!==_0x2a1f('0x6e')&&_0x10d813[_0x2a1f('0x2d')]!==_0x2a1f('0x6f')){return rp({'method':'POST','uri':util[_0x2a1f('0x69')](_0x2a1f('0x6a'),_0x415781,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2a1f('0x70'),'input_type':_0x2a1f('0x6b'),'response_type':_0x2a1f('0x6b'),'rest_data':JSON['stringify']({'session':_0x10d813['id'],'module_name':'Calls'})}})[_0x2a1f('0x29')](function(_0x15894b){if(_0x15894b){var _0x23eb18=_['values'](_0x15894b['module_fields']);_[_0x2a1f('0x71')](_0x23eb18,function(_0xf18a4b){return _0x3a12d7[_0x2a1f('0x72')](_0xf18a4b[_0x2a1f('0x2d')]);});return{'count':_0x23eb18[_0x2a1f('0x3b')],'rows':_['map'](_0x23eb18,function(_0x194ef2){return{'id':_0x194ef2['name'],'name':_0x194ef2[_0x2a1f('0x73')],'custom':_[_0x2a1f('0x74')](_0x194ef2['name'],'_c')?!![]:![],'options':_0x194ef2['options']?_[_0x2a1f('0x30')](_['values'](_0x194ef2[_0x2a1f('0x44')]),function(_0x337cf2){return{'name':_0x337cf2[_0x2a1f('0x75')],'value':_0x337cf2[_0x2a1f('0x2d')]};}):[]};})};}})['then'](respondWithResult(_0x3d86fc,null))[_0x2a1f('0x49')](function(_0x183aca){var _0x582407=_0x19624e[_0x2a1f('0x36')][_0x2a1f('0x76')]?0x1f4:_0x183aca['statusCode']||0x1f4;logger[_0x2a1f('0x2b')](_0x2a1f('0x77'),_0x2a1f('0x5b'),_0x582407,JSON[_0x2a1f('0x6c')](_0x183aca));delete _0x183aca[_0x2a1f('0x2d')];if(_0x582407===0x191){_0x582407=0x190;}_0x3d86fc[_0x2a1f('0x1c')](_0x582407)['send'](_0x19624e[_0x2a1f('0x36')][_0x2a1f('0x76')]?{'message':_0x2a1f('0x78'),'statusCode':_0x183aca[_0x2a1f('0x79')]}:_0x183aca);});}else{var _0xdbfd46=0x1f4;_0x3d86fc[_0x2a1f('0x1c')](_0xdbfd46)['send']({'message':_0x2a1f('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb3b5=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','key','model','keys','query','intersection','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','show','params','fields','includeAll','catch','create','body','find','getConfigurations','findOne','rawAttributes','options','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','type','SugarcrmConfiguration','Descriptions','assigned_user_id','description','date_start','duration_hours','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','Wrong\x20credentials'];(function(_0x1988bb,_0x8578ec){var _0x1426c5=function(_0x9e996f){while(--_0x9e996f){_0x1988bb['push'](_0x1988bb['shift']());}};_0x1426c5(++_0x8578ec);}(_0xb3b5,0xf0));var _0x5b3b=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0xb3b5[_0xd307d9];return _0x209bf8;};'use strict';var emlformat=require(_0x5b3b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b3b('0x1'));var jsonpatch=require(_0x5b3b('0x2'));var rp=require(_0x5b3b('0x3'));var moment=require(_0x5b3b('0x4'));var BPromise=require(_0x5b3b('0x5'));var Mustache=require(_0x5b3b('0x6'));var util=require('util');var path=require(_0x5b3b('0x7'));var sox=require(_0x5b3b('0x8'));var csv=require(_0x5b3b('0x9'));var ejs=require(_0x5b3b('0xa'));var fs=require('fs');var fs_extra=require(_0x5b3b('0xb'));var _=require(_0x5b3b('0xc'));var squel=require(_0x5b3b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5b3b('0xe'));var toCsv=require(_0x5b3b('0x9'));var querystring=require(_0x5b3b('0xf'));var Papa=require(_0x5b3b('0x10'));var Redis=require('ioredis');var authService=require(_0x5b3b('0x11'));var qs=require(_0x5b3b('0x12'));var as=require(_0x5b3b('0x13'));var hardwareService=require(_0x5b3b('0x14'));var logger=require(_0x5b3b('0x15'))('api');var utils=require(_0x5b3b('0x16'));var config=require(_0x5b3b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2aadf0,_0x24de52){_0x24de52=_0x24de52||0xcc;return function(_0x399c2f){if(_0x399c2f){return _0x2aadf0[_0x5b3b('0x18')](_0x24de52);}return _0x2aadf0[_0x5b3b('0x19')](_0x24de52)[_0x5b3b('0x1a')]();};}function respondWithResult(_0x5c85c3,_0x8927d1){_0x8927d1=_0x8927d1||0xc8;return function(_0x480030){if(_0x480030){return _0x5c85c3[_0x5b3b('0x19')](_0x8927d1)[_0x5b3b('0x1b')](_0x480030);}};}function respondWithFilteredResult(_0x181693,_0xad5546){return function(_0xd833ec){if(_0xd833ec){var _0x309b71=typeof _0xad5546[_0x5b3b('0x1c')]===_0x5b3b('0x1d')&&typeof _0xad5546[_0x5b3b('0x1e')]===_0x5b3b('0x1d');var _0x2cfdb0=_0xd833ec[_0x5b3b('0x1f')];var _0x12ba9b=_0x309b71?0x0:_0xad5546[_0x5b3b('0x1c')];var _0x1f9bf5=_0x309b71?_0xd833ec[_0x5b3b('0x1f')]:_0xad5546[_0x5b3b('0x1c')]+_0xad5546['limit'];var _0x53b3c6;if(_0x1f9bf5>=_0x2cfdb0){_0x1f9bf5=_0x2cfdb0;_0x53b3c6=0xc8;}else{_0x53b3c6=0xce;}_0x181693['status'](_0x53b3c6);return _0x181693['set'](_0x5b3b('0x20'),_0x12ba9b+'-'+_0x1f9bf5+'/'+_0x2cfdb0)[_0x5b3b('0x1b')](_0xd833ec);}return null;};}function patchUpdates(_0x31c84b){return function(_0xbf558d){try{jsonpatch[_0x5b3b('0x21')](_0xbf558d,_0x31c84b,!![]);}catch(_0x25d43d){return BPromise[_0x5b3b('0x22')](_0x25d43d);}return _0xbf558d[_0x5b3b('0x23')]();};}function saveUpdates(_0x357bd4,_0x2bb426){return function(_0x4c43ba){if(_0x4c43ba){return _0x4c43ba[_0x5b3b('0x24')](_0x357bd4)[_0x5b3b('0x25')](function(_0x4f3845){return _0x4f3845;});}return null;};}function removeEntity(_0x38000e,_0x2f061b){return function(_0x43d5b5){if(_0x43d5b5){return _0x43d5b5[_0x5b3b('0x26')]()[_0x5b3b('0x25')](function(){_0x38000e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d9afa,_0x2bfac9){return function(_0x3afcbf){if(!_0x3afcbf){_0x4d9afa[_0x5b3b('0x18')](0x194);}return _0x3afcbf;};}function handleError(_0x4e441d,_0x49cfd2){_0x49cfd2=_0x49cfd2||0x1f4;return function(_0x2385a9){logger[_0x5b3b('0x27')](_0x2385a9[_0x5b3b('0x28')]);if(_0x2385a9[_0x5b3b('0x29')]){delete _0x2385a9[_0x5b3b('0x29')];}_0x4e441d[_0x5b3b('0x19')](_0x49cfd2)[_0x5b3b('0x2a')](_0x2385a9);};}exports[_0x5b3b('0x2b')]=function(_0x49e6ab,_0xcb4336){var _0x5d205e={},_0x478935={},_0x29e6bc={'count':0x0,'rows':[]};var _0x5f3927=_[_0x5b3b('0x2c')](db[_0x5b3b('0x2d')]['rawAttributes'],function(_0x5b436e){return{'name':_0x5b436e['fieldName'],'type':_0x5b436e['type'][_0x5b3b('0x2e')]};});_0x478935[_0x5b3b('0x2f')]=_[_0x5b3b('0x2c')](_0x5f3927,_0x5b3b('0x29'));_0x478935['query']=_[_0x5b3b('0x30')](_0x49e6ab[_0x5b3b('0x31')]);_0x478935['filters']=_[_0x5b3b('0x32')](_0x478935[_0x5b3b('0x2f')],_0x478935[_0x5b3b('0x31')]);_0x5d205e['attributes']=_['intersection'](_0x478935[_0x5b3b('0x2f')],qs['fields'](_0x49e6ab[_0x5b3b('0x31')]['fields']));_0x5d205e[_0x5b3b('0x33')]=_0x5d205e[_0x5b3b('0x33')][_0x5b3b('0x34')]?_0x5d205e[_0x5b3b('0x33')]:_0x478935[_0x5b3b('0x2f')];if(!_0x49e6ab[_0x5b3b('0x31')]['hasOwnProperty'](_0x5b3b('0x35'))){_0x5d205e[_0x5b3b('0x1e')]=qs[_0x5b3b('0x1e')](_0x49e6ab[_0x5b3b('0x31')][_0x5b3b('0x1e')]);_0x5d205e[_0x5b3b('0x1c')]=qs['offset'](_0x49e6ab[_0x5b3b('0x31')][_0x5b3b('0x1c')]);}_0x5d205e[_0x5b3b('0x36')]=qs[_0x5b3b('0x37')](_0x49e6ab['query'][_0x5b3b('0x37')]);_0x5d205e[_0x5b3b('0x38')]=qs['filters'](_[_0x5b3b('0x39')](_0x49e6ab[_0x5b3b('0x31')],_0x478935[_0x5b3b('0x3a')]),_0x5f3927);if(_0x49e6ab[_0x5b3b('0x31')][_0x5b3b('0x3b')]){_0x5d205e[_0x5b3b('0x38')]=_[_0x5b3b('0x3c')](_0x5d205e[_0x5b3b('0x38')],{'$or':_[_0x5b3b('0x2c')](_0x5f3927,function(_0x2b755d){if(_0x2b755d['type']!==_0x5b3b('0x3d')){var _0x2c529b={};_0x2c529b[_0x2b755d[_0x5b3b('0x29')]]={'$like':'%'+_0x49e6ab[_0x5b3b('0x31')][_0x5b3b('0x3b')]+'%'};return _0x2c529b;}})});}_0x5d205e=_[_0x5b3b('0x3c')]({},_0x5d205e,_0x49e6ab['options']);var _0xcd2d3d={'where':_0x5d205e['where']};return db[_0x5b3b('0x2d')][_0x5b3b('0x1f')](_0xcd2d3d)['then'](function(_0x2ec773){_0x29e6bc[_0x5b3b('0x1f')]=_0x2ec773;if(_0x49e6ab[_0x5b3b('0x31')]['includeAll']){_0x5d205e[_0x5b3b('0x3e')]=[{'all':!![]}];}return db[_0x5b3b('0x2d')][_0x5b3b('0x3f')](_0x5d205e);})[_0x5b3b('0x25')](function(_0x42083c){_0x29e6bc[_0x5b3b('0x40')]=_0x42083c;return _0x29e6bc;})[_0x5b3b('0x25')](respondWithFilteredResult(_0xcb4336,_0x5d205e))['catch'](handleError(_0xcb4336,null));};exports[_0x5b3b('0x41')]=function(_0x4a87d1,_0x16774f){var _0x58f91b={'raw':![],'where':{'id':_0x4a87d1[_0x5b3b('0x42')]['id']}},_0x4aba73={};_0x4aba73[_0x5b3b('0x2f')]=_[_0x5b3b('0x30')](db[_0x5b3b('0x2d')]['rawAttributes']);_0x4aba73[_0x5b3b('0x31')]=_[_0x5b3b('0x30')](_0x4a87d1[_0x5b3b('0x31')]);_0x4aba73[_0x5b3b('0x3a')]=_[_0x5b3b('0x32')](_0x4aba73[_0x5b3b('0x2f')],_0x4aba73['query']);_0x58f91b[_0x5b3b('0x33')]=_[_0x5b3b('0x32')](_0x4aba73[_0x5b3b('0x2f')],qs[_0x5b3b('0x43')](_0x4a87d1[_0x5b3b('0x31')][_0x5b3b('0x43')]));_0x58f91b[_0x5b3b('0x33')]=_0x58f91b['attributes'][_0x5b3b('0x34')]?_0x58f91b[_0x5b3b('0x33')]:_0x4aba73[_0x5b3b('0x2f')];if(_0x4a87d1[_0x5b3b('0x31')][_0x5b3b('0x44')]){_0x58f91b[_0x5b3b('0x3e')]=[{'all':!![]}];}_0x58f91b=_[_0x5b3b('0x3c')]({},_0x58f91b,_0x4a87d1['options']);return db['SugarcrmAccount']['find'](_0x58f91b)[_0x5b3b('0x25')](handleEntityNotFound(_0x16774f,null))[_0x5b3b('0x25')](respondWithResult(_0x16774f,null))[_0x5b3b('0x45')](handleError(_0x16774f,null));};exports[_0x5b3b('0x46')]=function(_0x2a760f,_0x1267d7){return db['SugarcrmAccount'][_0x5b3b('0x46')](_0x2a760f[_0x5b3b('0x47')],{})['then'](respondWithResult(_0x1267d7,0xc9))[_0x5b3b('0x45')](handleError(_0x1267d7,null));};exports[_0x5b3b('0x24')]=function(_0x9bb4f6,_0x171293){if(_0x9bb4f6[_0x5b3b('0x47')]['id']){delete _0x9bb4f6['body']['id'];}return db[_0x5b3b('0x2d')][_0x5b3b('0x48')]({'where':{'id':_0x9bb4f6['params']['id']}})['then'](handleEntityNotFound(_0x171293,null))['then'](saveUpdates(_0x9bb4f6[_0x5b3b('0x47')],null))[_0x5b3b('0x25')](respondWithResult(_0x171293,null))['catch'](handleError(_0x171293,null));};exports[_0x5b3b('0x26')]=function(_0x3e44a8,_0x15096c){return db[_0x5b3b('0x2d')][_0x5b3b('0x48')]({'where':{'id':_0x3e44a8[_0x5b3b('0x42')]['id']}})[_0x5b3b('0x25')](handleEntityNotFound(_0x15096c,null))['then'](removeEntity(_0x15096c,null))[_0x5b3b('0x45')](handleError(_0x15096c,null));};exports[_0x5b3b('0x49')]=function(_0x35a30f,_0x25cd4d,_0x499bbe){var _0x436f17={};var _0x4fdf50={};var _0xd99017;var _0x31b876;return db[_0x5b3b('0x2d')][_0x5b3b('0x4a')]({'where':{'id':_0x35a30f[_0x5b3b('0x42')]['id']}})[_0x5b3b('0x25')](handleEntityNotFound(_0x25cd4d,null))[_0x5b3b('0x25')](function(_0xa8238a){if(_0xa8238a){_0xd99017=_0xa8238a;_0x4fdf50[_0x5b3b('0x2f')]=_[_0x5b3b('0x30')](db['SugarcrmConfiguration'][_0x5b3b('0x4b')]);_0x4fdf50[_0x5b3b('0x31')]=_['keys'](_0x35a30f[_0x5b3b('0x31')]);_0x4fdf50[_0x5b3b('0x3a')]=_['intersection'](_0x4fdf50[_0x5b3b('0x2f')],_0x4fdf50[_0x5b3b('0x31')]);_0x436f17[_0x5b3b('0x33')]=_[_0x5b3b('0x32')](_0x4fdf50[_0x5b3b('0x2f')],qs[_0x5b3b('0x43')](_0x35a30f[_0x5b3b('0x31')]['fields']));_0x436f17[_0x5b3b('0x33')]=_0x436f17[_0x5b3b('0x33')][_0x5b3b('0x34')]?_0x436f17[_0x5b3b('0x33')]:_0x4fdf50['model'];_0x436f17[_0x5b3b('0x36')]=qs[_0x5b3b('0x37')](_0x35a30f[_0x5b3b('0x31')][_0x5b3b('0x37')]);_0x436f17[_0x5b3b('0x38')]=qs[_0x5b3b('0x3a')](_[_0x5b3b('0x39')](_0x35a30f['query'],_0x4fdf50[_0x5b3b('0x3a')]));if(_0x35a30f[_0x5b3b('0x31')]['filter']){_0x436f17[_0x5b3b('0x38')]=_[_0x5b3b('0x3c')](_0x436f17[_0x5b3b('0x38')],{'$or':_[_0x5b3b('0x2c')](_0x436f17[_0x5b3b('0x33')],function(_0x1c387d){var _0x35c526={};_0x35c526[_0x1c387d]={'$like':'%'+_0x35a30f['query']['filter']+'%'};return _0x35c526;})});}_0x436f17=_[_0x5b3b('0x3c')]({},_0x436f17,_0x35a30f[_0x5b3b('0x4c')]);return _0xd99017[_0x5b3b('0x49')](_0x436f17);}})['then'](function(_0x46b73a){if(_0x46b73a){_0x31b876=_0x46b73a[_0x5b3b('0x34')];if(!_0x35a30f[_0x5b3b('0x31')][_0x5b3b('0x4d')](_0x5b3b('0x35'))){_0x436f17[_0x5b3b('0x1e')]=qs[_0x5b3b('0x1e')](_0x35a30f[_0x5b3b('0x31')][_0x5b3b('0x1e')]);_0x436f17['offset']=qs[_0x5b3b('0x1c')](_0x35a30f[_0x5b3b('0x31')][_0x5b3b('0x1c')]);}return _0xd99017[_0x5b3b('0x49')](_0x436f17);}})[_0x5b3b('0x25')](function(_0x4e7e70){if(_0x4e7e70){return _0x4e7e70?{'count':_0x31b876,'rows':_0x4e7e70}:null;}})[_0x5b3b('0x25')](respondWithResult(_0x25cd4d,null))[_0x5b3b('0x45')](handleError(_0x25cd4d,null));};exports[_0x5b3b('0x4e')]=function(_0x36f3e9,_0x33b4b1,_0x30e93a){if(_0x36f3e9['body']['id']){delete _0x36f3e9[_0x5b3b('0x47')]['id'];}return db[_0x5b3b('0x2d')][_0x5b3b('0x4a')]({'where':{'id':_0x36f3e9[_0x5b3b('0x42')]['id']}})[_0x5b3b('0x25')](handleEntityNotFound(_0x33b4b1,null))[_0x5b3b('0x25')](function(_0x57f6e5){if(_0x57f6e5){_0x36f3e9['body'][_0x5b3b('0x4f')]=_0x57f6e5['id'];_0x36f3e9['body'][_0x5b3b('0x50')]=integrations[_0x5b3b('0x51')](_0x36f3e9[_0x5b3b('0x47')][_0x5b3b('0x52')],_0x36f3e9[_0x5b3b('0x47')]['type']);_0x36f3e9[_0x5b3b('0x47')]['Descriptions']=integrations[_0x5b3b('0x53')](_0x36f3e9[_0x5b3b('0x47')][_0x5b3b('0x52')],_0x36f3e9[_0x5b3b('0x47')][_0x5b3b('0x54')]);return db[_0x5b3b('0x55')][_0x5b3b('0x46')](_0x36f3e9['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x5b3b('0x50')},{'model':db['SugarcrmField'],'as':_0x5b3b('0x56')}]});}return null;})[_0x5b3b('0x25')](respondWithResult(_0x33b4b1,null))['catch'](handleError(_0x33b4b1,null));};exports['getFields']=function(_0x560e7b,_0x302f05,_0x30bdd9){var _0x2410d1='';var _0x17ae5f=['id','name',_0x5b3b('0x57'),'created_by',_0x5b3b('0x58'),_0x5b3b('0x59'),_0x5b3b('0x5a'),'duration_minutes','parent_id',_0x5b3b('0x5b'),_0x5b3b('0x5c'),_0x5b3b('0x5d')];return db[_0x5b3b('0x2d')]['findOne']({'where':{'id':_0x560e7b[_0x5b3b('0x42')]['id']},'attributes':['id',_0x5b3b('0x5e'),'password','remoteUri']})['then'](handleEntityNotFound(_0x302f05,null))[_0x5b3b('0x25')](function(_0x2146a3){if(_0x2146a3){_0x2410d1=_0x2146a3[_0x5b3b('0x5f')];var _0x48fd4f=_0x2410d1[_0x5b3b('0x60')](-0x1);if(_0x48fd4f==='/'){_0x2410d1=_0x2410d1[_0x5b3b('0x61')](0x0,_0x2410d1[_0x5b3b('0x62')](_0x48fd4f));}return rp({'method':_0x5b3b('0x63'),'uri':util['format']('%s%s',_0x2410d1,_0x5b3b('0x64')),'json':!![],'form':{'method':_0x5b3b('0x65'),'input_type':_0x5b3b('0x66'),'response_type':_0x5b3b('0x66'),'rest_data':JSON[_0x5b3b('0x67')]({'user_auth':{'user_name':_0x2146a3[_0x5b3b('0x5e')],'password':_0x2146a3[_0x5b3b('0x68')],'encryption':_0x5b3b('0x69')},'application':_0x5b3b('0x6a')})}});}})['then'](function(_0x4ef7be){if(_0x4ef7be&&_0x4ef7be['name']!==_0x5b3b('0x6b')&&_0x4ef7be[_0x5b3b('0x29')]!=='Password\x20Expired'){return rp({'method':_0x5b3b('0x63'),'uri':util['format'](_0x5b3b('0x6c'),_0x2410d1,_0x5b3b('0x64')),'json':!![],'form':{'method':_0x5b3b('0x6d'),'input_type':_0x5b3b('0x66'),'response_type':'JSON','rest_data':JSON[_0x5b3b('0x67')]({'session':_0x4ef7be['id'],'module_name':'Calls'})}})[_0x5b3b('0x25')](function(_0x4a3a88){if(_0x4a3a88){var _0x242674=_[_0x5b3b('0x6e')](_0x4a3a88[_0x5b3b('0x6f')]);_[_0x5b3b('0x70')](_0x242674,function(_0x1af44a){return _0x17ae5f[_0x5b3b('0x71')](_0x1af44a['name']);});return{'count':_0x242674[_0x5b3b('0x34')],'rows':_[_0x5b3b('0x2c')](_0x242674,function(_0x44b059){return{'id':_0x44b059[_0x5b3b('0x29')],'name':_0x44b059[_0x5b3b('0x72')],'custom':_[_0x5b3b('0x73')](_0x44b059[_0x5b3b('0x29')],'_c')?!![]:![],'options':_0x44b059[_0x5b3b('0x4c')]?_[_0x5b3b('0x2c')](_[_0x5b3b('0x6e')](_0x44b059['options']),function(_0x47e3ef){return{'name':_0x47e3ef[_0x5b3b('0x74')],'value':_0x47e3ef['name']};}):[]};})};}})[_0x5b3b('0x25')](respondWithResult(_0x302f05,null))[_0x5b3b('0x45')](function(_0x4b4c32){var _0x5bf43e=_0x560e7b[_0x5b3b('0x31')][_0x5b3b('0x75')]?0x1f4:_0x4b4c32['statusCode']||0x1f4;logger[_0x5b3b('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5bf43e,JSON['stringify'](_0x4b4c32));delete _0x4b4c32[_0x5b3b('0x29')];if(_0x5bf43e===0x191){_0x5bf43e=0x190;}_0x302f05[_0x5b3b('0x19')](_0x5bf43e)['send'](_0x560e7b['query'][_0x5b3b('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x4b4c32[_0x5b3b('0x76')]}:_0x4b4c32);});}else{var _0x4a71f0=0x1f4;_0x302f05[_0x5b3b('0x19')](_0x4a71f0)[_0x5b3b('0x2a')]({'message':_0x5b3b('0x77'),'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 e6774e3..4305aab 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 _0x4134=['SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4134,0x17c));var _0x4413=function(_0x566b58,_0x2e2881){_0x566b58=_0x566b58-0x0;var _0x3dc55c=_0x4134[_0x566b58];return _0x3dc55c;};'use strict';var _=require('lodash');var util=require(_0x4413('0x0'));var logger=require(_0x4413('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4413('0x2'));var rimraf=require('rimraf');var config=require(_0x4413('0x3'));var attributes=require(_0x4413('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x4413('0x5')]=function(_0x1433e0,_0x1f0076){return _0x1433e0[_0x4413('0x6')](_0x4413('0x7'),attributes,{'tableName':_0x4413('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e6d=['api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger'];(function(_0xda414f,_0x58aa96){var _0x49851b=function(_0x2772f3){while(--_0x2772f3){_0xda414f['push'](_0xda414f['shift']());}};_0x49851b(++_0x58aa96);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x23bbc1,_0x59099d){_0x23bbc1=_0x23bbc1-0x0;var _0x3eda24=_0x9e6d[_0x23bbc1];return _0x3eda24;};'use strict';var _=require(_0xd9e6('0x0'));var util=require('util');var logger=require(_0xd9e6('0x1'))(_0xd9e6('0x2'));var moment=require(_0xd9e6('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9e6('0x4'));var fs=require('fs');var path=require(_0xd9e6('0x5'));var rimraf=require(_0xd9e6('0x6'));var config=require(_0xd9e6('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xd9e6('0x8'));module[_0xd9e6('0x9')]=function(_0x525209,_0x57a688){return _0x525209[_0xd9e6('0xa')](_0xd9e6('0xb'),attributes,{'tableName':_0xd9e6('0xc'),'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 9700890..a2a7c49 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 _0x49fe=['limit','map','include','model','attributes','ShowSugarcrmAccount','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','where'];(function(_0x10255f,_0x125b63){var _0x5ac535=function(_0x359993){while(--_0x359993){_0x10255f['push'](_0x10255f['shift']());}};_0x5ac535(++_0x125b63);}(_0x49fe,0x127));var _0xe49f=function(_0x595d21,_0x29e0c4){_0x595d21=_0x595d21-0x0;var _0x3184a0=_0x49fe[_0x595d21];return _0x3184a0;};'use strict';var _=require(_0xe49f('0x0'));var util=require(_0xe49f('0x1'));var moment=require(_0xe49f('0x2'));var BPromise=require(_0xe49f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe49f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe49f('0x5'));var logger=require(_0xe49f('0x6'))(_0xe49f('0x7'));var config=require(_0xe49f('0x8'));var jayson=require(_0xe49f('0x9'));var client=jayson[_0xe49f('0xa')][_0xe49f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xff0e48,_0x517c2b,_0x803184){return new BPromise(function(_0x44cd52,_0x48acd5){return client[_0xe49f('0xc')](_0xff0e48,_0x803184)[_0xe49f('0xd')](function(_0x2a8cc3){logger[_0xe49f('0xe')](_0xe49f('0xf'),_0x517c2b,_0xe49f('0x10'));logger[_0xe49f('0x11')](_0xe49f('0x12'),_0x517c2b,_0xe49f('0x10'),JSON['stringify'](_0x2a8cc3));if(_0x2a8cc3[_0xe49f('0x13')]){if(_0x2a8cc3[_0xe49f('0x13')][_0xe49f('0x14')]===0x1f4){logger[_0xe49f('0x13')](_0xe49f('0xf'),_0x517c2b,_0x2a8cc3[_0xe49f('0x13')]['message']);return _0x48acd5(_0x2a8cc3[_0xe49f('0x13')][_0xe49f('0x15')]);}logger[_0xe49f('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x517c2b,_0x2a8cc3[_0xe49f('0x13')]['message']);return _0x44cd52(_0x2a8cc3[_0xe49f('0x13')][_0xe49f('0x15')]);}else{logger[_0xe49f('0xe')](_0xe49f('0xf'),_0x517c2b,_0xe49f('0x10'));_0x44cd52(_0x2a8cc3[_0xe49f('0x16')][_0xe49f('0x15')]);}})['catch'](function(_0x30bbc4){logger[_0xe49f('0x13')](_0xe49f('0xf'),_0x517c2b,_0x30bbc4);_0x48acd5(_0x30bbc4);});});}exports[_0xe49f('0x17')]=function(_0x2c7eeb){var _0x2652f1=this;return new Promise(function(_0x4c35e2,_0x260bc8){return db[_0xe49f('0x18')][_0xe49f('0x19')]({'raw':_0x2c7eeb['options']?_0x2c7eeb['options'][_0xe49f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c7eeb[_0xe49f('0x1b')]?_0x2c7eeb[_0xe49f('0x1b')][_0xe49f('0x1c')]||null:null,'attributes':_0x2c7eeb[_0xe49f('0x1b')]?_0x2c7eeb[_0xe49f('0x1b')]['attributes']||null:null,'limit':_0x2c7eeb[_0xe49f('0x1b')]?_0x2c7eeb[_0xe49f('0x1b')][_0xe49f('0x1d')]||null:null,'include':_0x2c7eeb[_0xe49f('0x1b')]?_0x2c7eeb['options']['include']?_[_0xe49f('0x1e')](_0x2c7eeb[_0xe49f('0x1b')][_0xe49f('0x1f')],function(_0x390f98){return{'model':db[_0x390f98[_0xe49f('0x20')]],'as':_0x390f98['as'],'attributes':_0x390f98[_0xe49f('0x21')],'include':_0x390f98[_0xe49f('0x1f')]?_[_0xe49f('0x1e')](_0x390f98['include'],function(_0xafe878){return{'model':db[_0xafe878[_0xe49f('0x20')]],'as':_0xafe878['as'],'attributes':_0xafe878[_0xe49f('0x21')],'include':_0xafe878[_0xe49f('0x1f')]?_[_0xe49f('0x1e')](_0xafe878[_0xe49f('0x1f')],function(_0x2f21a2){return{'model':db[_0x2f21a2[_0xe49f('0x20')]],'as':_0x2f21a2['as'],'attributes':_0x2f21a2[_0xe49f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe49f('0xd')](function(_0x59de0b){logger[_0xe49f('0xe')](_0xe49f('0x17'),_0x2c7eeb);logger['debug'](_0xe49f('0x17'),_0x2c7eeb,JSON['stringify'](_0x59de0b));_0x4c35e2(_0x59de0b);})['catch'](function(_0x3d02b8){logger[_0xe49f('0x13')](_0xe49f('0x17'),_0x3d02b8[_0xe49f('0x15')],_0x2c7eeb);_0x260bc8(_0x2652f1['error'](0x1f4,_0x3d02b8[_0xe49f('0x15')]));});});};exports[_0xe49f('0x22')]=function(_0x14014d){var _0x46f15d=this;return new Promise(function(_0x4f999f,_0x1227a6){return db[_0xe49f('0x18')]['find']({'raw':_0x14014d[_0xe49f('0x1b')]?_0x14014d[_0xe49f('0x1b')][_0xe49f('0x1a')]===undefined?!![]:![]:!![],'where':_0x14014d[_0xe49f('0x1b')]?_0x14014d[_0xe49f('0x1b')][_0xe49f('0x1c')]||null:null,'attributes':_0x14014d[_0xe49f('0x1b')]?_0x14014d[_0xe49f('0x1b')]['attributes']||null:null,'include':_0x14014d[_0xe49f('0x1b')]?_0x14014d['options'][_0xe49f('0x1f')]?_[_0xe49f('0x1e')](_0x14014d[_0xe49f('0x1b')][_0xe49f('0x1f')],function(_0x296aba){return{'model':db[_0x296aba['model']],'as':_0x296aba['as'],'attributes':_0x296aba['attributes'],'include':_0x296aba[_0xe49f('0x1f')]?_['map'](_0x296aba['include'],function(_0x397b85){return{'model':db[_0x397b85[_0xe49f('0x20')]],'as':_0x397b85['as'],'attributes':_0x397b85[_0xe49f('0x21')],'include':_0x397b85[_0xe49f('0x1f')]?_['map'](_0x397b85[_0xe49f('0x1f')],function(_0x3834df){return{'model':db[_0x3834df[_0xe49f('0x20')]],'as':_0x3834df['as'],'attributes':_0x3834df['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x507d0f){logger['info']('ShowSugarcrmAccount',_0x14014d);logger[_0xe49f('0x11')]('ShowSugarcrmAccount',_0x14014d,JSON[_0xe49f('0x23')](_0x507d0f));_0x4f999f(_0x507d0f);})['catch'](function(_0x4442c0){logger[_0xe49f('0x13')](_0xe49f('0x22'),_0x4442c0[_0xe49f('0x15')],_0x14014d);_0x1227a6(_0x46f15d[_0xe49f('0x13')](0x1f4,_0x4442c0[_0xe49f('0x15')]));});});}; \ No newline at end of file +var _0xabda=['raw','limit','include','map','model','attributes','GetSugarcrmAccount','ShowSugarcrmAccount','find','where','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','SugarcrmAccount','findAll','options'];(function(_0x3b713f,_0x39f82d){var _0x505ef3=function(_0x139d94){while(--_0x139d94){_0x3b713f['push'](_0x3b713f['shift']());}};_0x505ef3(++_0x39f82d);}(_0xabda,0x18a));var _0xaabd=function(_0xdca4a6,_0x4965f6){_0xdca4a6=_0xdca4a6-0x0;var _0x5c5b95=_0xabda[_0xdca4a6];return _0x5c5b95;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaabd('0x0'));var BPromise=require(_0xaabd('0x1'));var rs=require(_0xaabd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaabd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xaabd('0x4'))('rpc');var config=require(_0xaabd('0x5'));var jayson=require(_0xaabd('0x6'));var client=jayson[_0xaabd('0x7')][_0xaabd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f4884,_0x453932,_0x33e09c){return new BPromise(function(_0x28d116,_0x255f2a){return client['request'](_0x2f4884,_0x33e09c)[_0xaabd('0x9')](function(_0xd31d34){logger[_0xaabd('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x453932,_0xaabd('0xb'));logger[_0xaabd('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x453932,_0xaabd('0xb'),JSON[_0xaabd('0xd')](_0xd31d34));if(_0xd31d34[_0xaabd('0xe')]){if(_0xd31d34['error']['code']===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x453932,_0xd31d34[_0xaabd('0xe')][_0xaabd('0xf')]);return _0x255f2a(_0xd31d34[_0xaabd('0xe')][_0xaabd('0xf')]);}logger[_0xaabd('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x453932,_0xd31d34['error'][_0xaabd('0xf')]);return _0x28d116(_0xd31d34['error']['message']);}else{logger['info'](_0xaabd('0x10'),_0x453932,_0xaabd('0xb'));_0x28d116(_0xd31d34[_0xaabd('0x11')][_0xaabd('0xf')]);}})[_0xaabd('0x12')](function(_0x424726){logger[_0xaabd('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x453932,_0x424726);_0x255f2a(_0x424726);});});}exports['GetSugarcrmAccount']=function(_0x24146f){var _0x33a45e=this;return new Promise(function(_0x5599d2,_0x5611f9){return db[_0xaabd('0x13')][_0xaabd('0x14')]({'raw':_0x24146f[_0xaabd('0x15')]?_0x24146f[_0xaabd('0x15')][_0xaabd('0x16')]===undefined?!![]:![]:!![],'where':_0x24146f[_0xaabd('0x15')]?_0x24146f[_0xaabd('0x15')]['where']||null:null,'attributes':_0x24146f[_0xaabd('0x15')]?_0x24146f[_0xaabd('0x15')]['attributes']||null:null,'limit':_0x24146f['options']?_0x24146f[_0xaabd('0x15')][_0xaabd('0x17')]||null:null,'include':_0x24146f['options']?_0x24146f[_0xaabd('0x15')][_0xaabd('0x18')]?_[_0xaabd('0x19')](_0x24146f[_0xaabd('0x15')]['include'],function(_0x439dfb){return{'model':db[_0x439dfb[_0xaabd('0x1a')]],'as':_0x439dfb['as'],'attributes':_0x439dfb[_0xaabd('0x1b')],'include':_0x439dfb['include']?_[_0xaabd('0x19')](_0x439dfb[_0xaabd('0x18')],function(_0x549ae8){return{'model':db[_0x549ae8[_0xaabd('0x1a')]],'as':_0x549ae8['as'],'attributes':_0x549ae8['attributes'],'include':_0x549ae8[_0xaabd('0x18')]?_[_0xaabd('0x19')](_0x549ae8[_0xaabd('0x18')],function(_0x35a811){return{'model':db[_0x35a811[_0xaabd('0x1a')]],'as':_0x35a811['as'],'attributes':_0x35a811[_0xaabd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaabd('0x9')](function(_0x5a343b){logger[_0xaabd('0xa')](_0xaabd('0x1c'),_0x24146f);logger[_0xaabd('0xc')](_0xaabd('0x1c'),_0x24146f,JSON[_0xaabd('0xd')](_0x5a343b));_0x5599d2(_0x5a343b);})[_0xaabd('0x12')](function(_0x7a191e){logger[_0xaabd('0xe')](_0xaabd('0x1c'),_0x7a191e['message'],_0x24146f);_0x5611f9(_0x33a45e['error'](0x1f4,_0x7a191e[_0xaabd('0xf')]));});});};exports[_0xaabd('0x1d')]=function(_0x4f328c){var _0xb18a65=this;return new Promise(function(_0x2157bf,_0x25546f){return db[_0xaabd('0x13')][_0xaabd('0x1e')]({'raw':_0x4f328c[_0xaabd('0x15')]?_0x4f328c[_0xaabd('0x15')][_0xaabd('0x16')]===undefined?!![]:![]:!![],'where':_0x4f328c[_0xaabd('0x15')]?_0x4f328c[_0xaabd('0x15')][_0xaabd('0x1f')]||null:null,'attributes':_0x4f328c[_0xaabd('0x15')]?_0x4f328c['options'][_0xaabd('0x1b')]||null:null,'include':_0x4f328c['options']?_0x4f328c[_0xaabd('0x15')][_0xaabd('0x18')]?_[_0xaabd('0x19')](_0x4f328c[_0xaabd('0x15')][_0xaabd('0x18')],function(_0xc678b2){return{'model':db[_0xc678b2[_0xaabd('0x1a')]],'as':_0xc678b2['as'],'attributes':_0xc678b2[_0xaabd('0x1b')],'include':_0xc678b2[_0xaabd('0x18')]?_['map'](_0xc678b2[_0xaabd('0x18')],function(_0x199f36){return{'model':db[_0x199f36['model']],'as':_0x199f36['as'],'attributes':_0x199f36[_0xaabd('0x1b')],'include':_0x199f36[_0xaabd('0x18')]?_[_0xaabd('0x19')](_0x199f36[_0xaabd('0x18')],function(_0x2496b3){return{'model':db[_0x2496b3['model']],'as':_0x2496b3['as'],'attributes':_0x2496b3[_0xaabd('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x104b77){logger[_0xaabd('0xa')](_0xaabd('0x1d'),_0x4f328c);logger[_0xaabd('0xc')](_0xaabd('0x1d'),_0x4f328c,JSON[_0xaabd('0xd')](_0x104b77));_0x2157bf(_0x104b77);})[_0xaabd('0x12')](function(_0x5c3a82){logger[_0xaabd('0xe')](_0xaabd('0x1d'),_0x5c3a82[_0xaabd('0xf')],_0x4f328c);_0x25546f(_0xb18a65[_0xaabd('0xe')](0x1f4,_0x5c3a82[_0xaabd('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 37c9a76..70ef164 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 _0x1eb0=['post','put','/:id','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x46c90d,_0x7d30ee){var _0x347ddf=function(_0xe85dbc){while(--_0xe85dbc){_0x46c90d['push'](_0x46c90d['shift']());}};_0x347ddf(++_0x7d30ee);}(_0x1eb0,0x192));var _0x01eb=function(_0xa22227,_0x48b16a){_0xa22227=_0xa22227-0x0;var _0x2a60c2=_0x1eb0[_0xa22227];return _0x2a60c2;};'use strict';var multer=require('multer');var util=require(_0x01eb('0x0'));var path=require('path');var timeout=require(_0x01eb('0x1'));var express=require(_0x01eb('0x2'));var router=express[_0x01eb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x01eb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x01eb('0x5'));var controller=require(_0x01eb('0x6'));router[_0x01eb('0x7')]('/',auth[_0x01eb('0x8')](),controller['index']);router['get']('/:id',auth[_0x01eb('0x8')](),controller[_0x01eb('0x9')]);router[_0x01eb('0x7')](_0x01eb('0xa'),auth[_0x01eb('0x8')](),controller[_0x01eb('0xb')]);router[_0x01eb('0x7')](_0x01eb('0xc'),auth[_0x01eb('0x8')](),controller[_0x01eb('0xd')]);router['get'](_0x01eb('0xe'),auth[_0x01eb('0x8')](),controller[_0x01eb('0xf')]);router[_0x01eb('0x10')]('/',auth[_0x01eb('0x8')](),controller['create']);router[_0x01eb('0x11')](_0x01eb('0x12'),auth[_0x01eb('0x8')](),controller[_0x01eb('0x13')]);router[_0x01eb('0x14')](_0x01eb('0x12'),auth[_0x01eb('0x8')](),controller[_0x01eb('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8a90=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','create','put','delete','destroy','exports','path'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x8a90,0xaf));var _0x08a9=function(_0x2a7e04,_0x29ed17){_0x2a7e04=_0x2a7e04-0x0;var _0x3a96ff=_0x8a90[_0x2a7e04];return _0x3a96ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x08a9('0x0'));var timeout=require(_0x08a9('0x1'));var express=require(_0x08a9('0x2'));var router=express[_0x08a9('0x3')]();var fs_extra=require(_0x08a9('0x4'));var auth=require(_0x08a9('0x5'));var interaction=require(_0x08a9('0x6'));var config=require(_0x08a9('0x7'));var controller=require(_0x08a9('0x8'));router[_0x08a9('0x9')]('/',auth[_0x08a9('0xa')](),controller['index']);router[_0x08a9('0x9')](_0x08a9('0xb'),auth[_0x08a9('0xa')](),controller[_0x08a9('0xc')]);router[_0x08a9('0x9')](_0x08a9('0xd'),auth[_0x08a9('0xa')](),controller[_0x08a9('0xe')]);router['get']('/:id/subjects',auth[_0x08a9('0xa')](),controller[_0x08a9('0xf')]);router[_0x08a9('0x9')](_0x08a9('0x10'),auth[_0x08a9('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x08a9('0xa')](),controller[_0x08a9('0x11')]);router[_0x08a9('0x12')](_0x08a9('0xb'),auth[_0x08a9('0xa')](),controller['update']);router[_0x08a9('0x13')](_0x08a9('0xb'),auth[_0x08a9('0xa')](),controller[_0x08a9('0x14')]);module[_0x08a9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 892a45e..8d88c32 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 _0xc8eb=['STRING'];(function(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0xc8eb,0x14f));var _0xbc8e=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0xc8eb[_0xf0ec6e];return _0x8bbc27;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbc8e('0x0')]},'description':{'type':Sequelize[_0xbc8e('0x0')]}}; \ No newline at end of file +var _0x56f7=['sequelize','STRING'];(function(_0x4ab6ba,_0x5e8b21){var _0xb4fc41=function(_0x21803e){while(--_0x21803e){_0x4ab6ba['push'](_0x4ab6ba['shift']());}};_0xb4fc41(++_0x5e8b21);}(_0x56f7,0x194));var _0x756f=function(_0x2faf63,_0x43ea11){_0x2faf63=_0x2faf63-0x0;var _0x56d9ce=_0x56f7[_0x2faf63];return _0x56d9ce;};'use strict';var Sequelize=require(_0x756f('0x0'));module['exports']={'name':{'type':Sequelize[_0x756f('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 5d87e36..c284376 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 _0x6fb0=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','SugarcrmConfiguration','include','rows','catch','show','params','includeAll','options','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x2189a5,_0x5abd42){var _0x418db7=function(_0x500e2a){while(--_0x500e2a){_0x2189a5['push'](_0x2189a5['shift']());}};_0x418db7(++_0x5abd42);}(_0x6fb0,0xc8));var _0x06fb=function(_0x78b313,_0x334e22){_0x78b313=_0x78b313-0x0;var _0x583a82=_0x6fb0[_0x78b313];return _0x583a82;};'use strict';var emlformat=require(_0x06fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06fb('0x1'));var jsonpatch=require(_0x06fb('0x2'));var rp=require(_0x06fb('0x3'));var moment=require(_0x06fb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x06fb('0x5'));var util=require(_0x06fb('0x6'));var path=require('path');var sox=require(_0x06fb('0x7'));var csv=require(_0x06fb('0x8'));var ejs=require(_0x06fb('0x9'));var fs=require('fs');var fs_extra=require(_0x06fb('0xa'));var _=require(_0x06fb('0xb'));var squel=require('squel');var crypto=require(_0x06fb('0xc'));var jsforce=require(_0x06fb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x06fb('0xe'));var Redis=require(_0x06fb('0xf'));var authService=require(_0x06fb('0x10'));var qs=require(_0x06fb('0x11'));var as=require(_0x06fb('0x12'));var hardwareService=require(_0x06fb('0x13'));var logger=require(_0x06fb('0x14'))(_0x06fb('0x15'));var utils=require('../../config/utils');var config=require(_0x06fb('0x16'));var licenseUtil=require(_0x06fb('0x17'));var db=require(_0x06fb('0x18'))['db'];function respondWithStatusCode(_0x27add5,_0x3b7da4){_0x3b7da4=_0x3b7da4||0xcc;return function(_0x74ca9f){if(_0x74ca9f){return _0x27add5[_0x06fb('0x19')](_0x3b7da4);}return _0x27add5[_0x06fb('0x1a')](_0x3b7da4)[_0x06fb('0x1b')]();};}function respondWithResult(_0x2227ee,_0x381bb1){_0x381bb1=_0x381bb1||0xc8;return function(_0x2e6a18){if(_0x2e6a18){return _0x2227ee['status'](_0x381bb1)[_0x06fb('0x1c')](_0x2e6a18);}};}function respondWithFilteredResult(_0x333e1f,_0x487fe){return function(_0x20e3c3){if(_0x20e3c3){var _0x5bf183=typeof _0x487fe[_0x06fb('0x1d')]===_0x06fb('0x1e')&&typeof _0x487fe[_0x06fb('0x1f')]===_0x06fb('0x1e');var _0x4c3924=_0x20e3c3[_0x06fb('0x20')];var _0x19ddb9=_0x5bf183?0x0:_0x487fe['offset'];var _0xc347a6=_0x5bf183?_0x20e3c3[_0x06fb('0x20')]:_0x487fe[_0x06fb('0x1d')]+_0x487fe['limit'];var _0x2f422e;if(_0xc347a6>=_0x4c3924){_0xc347a6=_0x4c3924;_0x2f422e=0xc8;}else{_0x2f422e=0xce;}_0x333e1f[_0x06fb('0x1a')](_0x2f422e);return _0x333e1f[_0x06fb('0x21')](_0x06fb('0x22'),_0x19ddb9+'-'+_0xc347a6+'/'+_0x4c3924)[_0x06fb('0x1c')](_0x20e3c3);}return null;};}function patchUpdates(_0x4967a6){return function(_0x27f9a4){try{jsonpatch[_0x06fb('0x23')](_0x27f9a4,_0x4967a6,!![]);}catch(_0x14f914){return BPromise[_0x06fb('0x24')](_0x14f914);}return _0x27f9a4[_0x06fb('0x25')]();};}function saveUpdates(_0x5da12b,_0x50f905){return function(_0x598739){if(_0x598739){return _0x598739[_0x06fb('0x26')](_0x5da12b)[_0x06fb('0x27')](function(_0x410f14){return _0x410f14;});}return null;};}function removeEntity(_0x385572,_0x356a26){return function(_0x10a8b4){if(_0x10a8b4){return _0x10a8b4[_0x06fb('0x28')]()[_0x06fb('0x27')](function(){_0x385572[_0x06fb('0x1a')](0xcc)[_0x06fb('0x1b')]();});}};}function handleEntityNotFound(_0x5d792c,_0x4a2419){return function(_0x1ce401){if(!_0x1ce401){_0x5d792c[_0x06fb('0x19')](0x194);}return _0x1ce401;};}function handleError(_0x5e4f9a,_0x289b5a){_0x289b5a=_0x289b5a||0x1f4;return function(_0x242cfa){logger[_0x06fb('0x29')](_0x242cfa[_0x06fb('0x2a')]);if(_0x242cfa[_0x06fb('0x2b')]){delete _0x242cfa[_0x06fb('0x2b')];}_0x5e4f9a[_0x06fb('0x1a')](_0x289b5a)[_0x06fb('0x2c')](_0x242cfa);};}exports[_0x06fb('0x2d')]=function(_0x3d2992,_0x445efc){var _0x34d7d8={},_0x23c9fc={},_0x1afbc8={'count':0x0,'rows':[]};var _0x50234e=_[_0x06fb('0x2e')](db['SugarcrmConfiguration'][_0x06fb('0x2f')],function(_0x4b3767){return{'name':_0x4b3767[_0x06fb('0x30')],'type':_0x4b3767[_0x06fb('0x31')][_0x06fb('0x32')]};});_0x23c9fc[_0x06fb('0x33')]=_[_0x06fb('0x2e')](_0x50234e,_0x06fb('0x2b'));_0x23c9fc[_0x06fb('0x34')]=_[_0x06fb('0x35')](_0x3d2992[_0x06fb('0x34')]);_0x23c9fc[_0x06fb('0x36')]=_[_0x06fb('0x37')](_0x23c9fc[_0x06fb('0x33')],_0x23c9fc[_0x06fb('0x34')]);_0x34d7d8[_0x06fb('0x38')]=_[_0x06fb('0x37')](_0x23c9fc['model'],qs[_0x06fb('0x39')](_0x3d2992['query'][_0x06fb('0x39')]));_0x34d7d8[_0x06fb('0x38')]=_0x34d7d8[_0x06fb('0x38')][_0x06fb('0x3a')]?_0x34d7d8[_0x06fb('0x38')]:_0x23c9fc[_0x06fb('0x33')];if(!_0x3d2992[_0x06fb('0x34')][_0x06fb('0x3b')](_0x06fb('0x3c'))){_0x34d7d8[_0x06fb('0x1f')]=qs[_0x06fb('0x1f')](_0x3d2992['query'][_0x06fb('0x1f')]);_0x34d7d8[_0x06fb('0x1d')]=qs[_0x06fb('0x1d')](_0x3d2992['query'][_0x06fb('0x1d')]);}_0x34d7d8[_0x06fb('0x3d')]=qs[_0x06fb('0x3e')](_0x3d2992[_0x06fb('0x34')][_0x06fb('0x3e')]);_0x34d7d8[_0x06fb('0x3f')]=qs[_0x06fb('0x36')](_[_0x06fb('0x40')](_0x3d2992['query'],_0x23c9fc['filters']),_0x50234e);if(_0x3d2992[_0x06fb('0x34')]['filter']){_0x34d7d8['where']=_[_0x06fb('0x41')](_0x34d7d8[_0x06fb('0x3f')],{'$or':_[_0x06fb('0x2e')](_0x50234e,function(_0x2b7a8){if(_0x2b7a8[_0x06fb('0x31')]!==_0x06fb('0x42')){var _0x2c5f25={};_0x2c5f25[_0x2b7a8[_0x06fb('0x2b')]]={'$like':'%'+_0x3d2992[_0x06fb('0x34')][_0x06fb('0x43')]+'%'};return _0x2c5f25;}})});}_0x34d7d8=_['merge']({},_0x34d7d8,_0x3d2992['options']);var _0x3b9da2={'where':_0x34d7d8[_0x06fb('0x3f')]};return db[_0x06fb('0x44')][_0x06fb('0x20')](_0x3b9da2)[_0x06fb('0x27')](function(_0x42e4e5){_0x1afbc8[_0x06fb('0x20')]=_0x42e4e5;if(_0x3d2992[_0x06fb('0x34')]['includeAll']){_0x34d7d8[_0x06fb('0x45')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x34d7d8);})[_0x06fb('0x27')](function(_0x4f84ba){_0x1afbc8[_0x06fb('0x46')]=_0x4f84ba;return _0x1afbc8;})['then'](respondWithFilteredResult(_0x445efc,_0x34d7d8))[_0x06fb('0x47')](handleError(_0x445efc,null));};exports[_0x06fb('0x48')]=function(_0x3e797f,_0xbf4164){var _0x13e8a7={'raw':![],'where':{'id':_0x3e797f[_0x06fb('0x49')]['id']}},_0x4052a8={};_0x4052a8[_0x06fb('0x33')]=_['keys'](db[_0x06fb('0x44')][_0x06fb('0x2f')]);_0x4052a8['query']=_['keys'](_0x3e797f[_0x06fb('0x34')]);_0x4052a8[_0x06fb('0x36')]=_['intersection'](_0x4052a8[_0x06fb('0x33')],_0x4052a8[_0x06fb('0x34')]);_0x13e8a7[_0x06fb('0x38')]=_[_0x06fb('0x37')](_0x4052a8[_0x06fb('0x33')],qs[_0x06fb('0x39')](_0x3e797f[_0x06fb('0x34')][_0x06fb('0x39')]));_0x13e8a7[_0x06fb('0x38')]=_0x13e8a7[_0x06fb('0x38')][_0x06fb('0x3a')]?_0x13e8a7[_0x06fb('0x38')]:_0x4052a8[_0x06fb('0x33')];if(_0x3e797f[_0x06fb('0x34')][_0x06fb('0x4a')]){_0x13e8a7[_0x06fb('0x45')]=[{'all':!![]}];}_0x13e8a7=_['merge']({},_0x13e8a7,_0x3e797f[_0x06fb('0x4b')]);return db[_0x06fb('0x44')][_0x06fb('0x4c')](_0x13e8a7)[_0x06fb('0x27')](handleEntityNotFound(_0xbf4164,null))[_0x06fb('0x27')](respondWithResult(_0xbf4164,null))[_0x06fb('0x47')](handleError(_0xbf4164,null));};exports[_0x06fb('0x4d')]=function(_0x4057bd,_0x9e0923){return db[_0x06fb('0x44')][_0x06fb('0x4d')](_0x4057bd[_0x06fb('0x4e')],{})[_0x06fb('0x27')](respondWithResult(_0x9e0923,0xc9))['catch'](handleError(_0x9e0923,null));};exports[_0x06fb('0x26')]=function(_0x2c0d98,_0x7aae78){if(_0x2c0d98['body']['id']){delete _0x2c0d98['body']['id'];}return db[_0x06fb('0x44')][_0x06fb('0x4c')]({'where':{'id':_0x2c0d98[_0x06fb('0x49')]['id']}})[_0x06fb('0x27')](handleEntityNotFound(_0x7aae78,null))[_0x06fb('0x27')](saveUpdates(_0x2c0d98[_0x06fb('0x4e')],null))['then'](respondWithResult(_0x7aae78,null))[_0x06fb('0x47')](handleError(_0x7aae78,null));};exports[_0x06fb('0x28')]=function(_0x38c775,_0x559c15){return db[_0x06fb('0x44')][_0x06fb('0x4c')]({'where':{'id':_0x38c775[_0x06fb('0x49')]['id']}})[_0x06fb('0x27')](handleEntityNotFound(_0x559c15,null))[_0x06fb('0x27')](removeEntity(_0x559c15,null))[_0x06fb('0x47')](handleError(_0x559c15,null));};exports[_0x06fb('0x4f')]=function(_0x35a1f3,_0x13290e,_0x4d7c5e){var _0x239073={};var _0x5a62c1={};var _0x3238e3;var _0x153a09;return db[_0x06fb('0x44')][_0x06fb('0x50')]({'where':{'id':_0x35a1f3['params']['id']}})[_0x06fb('0x27')](handleEntityNotFound(_0x13290e,null))[_0x06fb('0x27')](function(_0x35b08a){if(_0x35b08a){_0x3238e3=_0x35b08a;_0x5a62c1[_0x06fb('0x33')]=_[_0x06fb('0x35')](db[_0x06fb('0x51')][_0x06fb('0x2f')]);_0x5a62c1[_0x06fb('0x34')]=_[_0x06fb('0x35')](_0x35a1f3[_0x06fb('0x34')]);_0x5a62c1[_0x06fb('0x36')]=_[_0x06fb('0x37')](_0x5a62c1[_0x06fb('0x33')],_0x5a62c1[_0x06fb('0x34')]);_0x239073[_0x06fb('0x38')]=_[_0x06fb('0x37')](_0x5a62c1[_0x06fb('0x33')],qs[_0x06fb('0x39')](_0x35a1f3[_0x06fb('0x34')][_0x06fb('0x39')]));_0x239073['attributes']=_0x239073[_0x06fb('0x38')][_0x06fb('0x3a')]?_0x239073[_0x06fb('0x38')]:_0x5a62c1[_0x06fb('0x33')];_0x239073[_0x06fb('0x3d')]=qs['sort'](_0x35a1f3[_0x06fb('0x34')][_0x06fb('0x3e')]);_0x239073['where']=qs[_0x06fb('0x36')](_['pick'](_0x35a1f3[_0x06fb('0x34')],_0x5a62c1[_0x06fb('0x36')]));if(_0x35a1f3[_0x06fb('0x34')][_0x06fb('0x43')]){_0x239073[_0x06fb('0x3f')]=_[_0x06fb('0x41')](_0x239073[_0x06fb('0x3f')],{'$or':_[_0x06fb('0x2e')](_0x239073['attributes'],function(_0x13c8d0){var _0x55c377={};_0x55c377[_0x13c8d0]={'$like':'%'+_0x35a1f3[_0x06fb('0x34')][_0x06fb('0x43')]+'%'};return _0x55c377;})});}_0x239073=_[_0x06fb('0x41')]({},_0x239073,_0x35a1f3[_0x06fb('0x4b')]);return _0x3238e3['getFields'](_0x239073);}})[_0x06fb('0x27')](function(_0x3023ea){if(_0x3023ea){_0x153a09=_0x3023ea[_0x06fb('0x3a')];if(!_0x35a1f3[_0x06fb('0x34')][_0x06fb('0x3b')](_0x06fb('0x3c'))){_0x239073[_0x06fb('0x1f')]=qs[_0x06fb('0x1f')](_0x35a1f3[_0x06fb('0x34')]['limit']);_0x239073[_0x06fb('0x1d')]=qs[_0x06fb('0x1d')](_0x35a1f3[_0x06fb('0x34')][_0x06fb('0x1d')]);}return _0x3238e3['getFields'](_0x239073);}})[_0x06fb('0x27')](function(_0x47534b){if(_0x47534b){return _0x47534b?{'count':_0x153a09,'rows':_0x47534b}:null;}})[_0x06fb('0x27')](respondWithResult(_0x13290e,null))[_0x06fb('0x47')](handleError(_0x13290e,null));};exports[_0x06fb('0x52')]=function(_0x164be4,_0x32fcd6,_0x3fbb0e){var _0x4eff65={};var _0x3676bc={};var _0xf5e76c;var _0x33c429;return db[_0x06fb('0x44')]['findOne']({'where':{'id':_0x164be4[_0x06fb('0x49')]['id']}})[_0x06fb('0x27')](handleEntityNotFound(_0x32fcd6,null))['then'](function(_0x23166f){if(_0x23166f){_0xf5e76c=_0x23166f;_0x3676bc['model']=_[_0x06fb('0x35')](db[_0x06fb('0x51')]['rawAttributes']);_0x3676bc['query']=_['keys'](_0x164be4[_0x06fb('0x34')]);_0x3676bc['filters']=_[_0x06fb('0x37')](_0x3676bc['model'],_0x3676bc[_0x06fb('0x34')]);_0x4eff65[_0x06fb('0x38')]=_[_0x06fb('0x37')](_0x3676bc[_0x06fb('0x33')],qs[_0x06fb('0x39')](_0x164be4[_0x06fb('0x34')][_0x06fb('0x39')]));_0x4eff65[_0x06fb('0x38')]=_0x4eff65[_0x06fb('0x38')][_0x06fb('0x3a')]?_0x4eff65[_0x06fb('0x38')]:_0x3676bc['model'];_0x4eff65[_0x06fb('0x3d')]=qs[_0x06fb('0x3e')](_0x164be4[_0x06fb('0x34')]['sort']);_0x4eff65['where']=qs[_0x06fb('0x36')](_[_0x06fb('0x40')](_0x164be4['query'],_0x3676bc[_0x06fb('0x36')]));if(_0x164be4['query'][_0x06fb('0x43')]){_0x4eff65[_0x06fb('0x3f')]=_['merge'](_0x4eff65[_0x06fb('0x3f')],{'$or':_['map'](_0x4eff65[_0x06fb('0x38')],function(_0x2c7618){var _0x470b18={};_0x470b18[_0x2c7618]={'$like':'%'+_0x164be4[_0x06fb('0x34')][_0x06fb('0x43')]+'%'};return _0x470b18;})});}_0x4eff65=_[_0x06fb('0x41')]({},_0x4eff65,_0x164be4[_0x06fb('0x4b')]);return _0xf5e76c[_0x06fb('0x52')](_0x4eff65);}})['then'](function(_0x5a09fa){if(_0x5a09fa){_0x33c429=_0x5a09fa['length'];if(!_0x164be4[_0x06fb('0x34')]['hasOwnProperty'](_0x06fb('0x3c'))){_0x4eff65[_0x06fb('0x1f')]=qs[_0x06fb('0x1f')](_0x164be4[_0x06fb('0x34')][_0x06fb('0x1f')]);_0x4eff65['offset']=qs[_0x06fb('0x1d')](_0x164be4[_0x06fb('0x34')][_0x06fb('0x1d')]);}return _0xf5e76c[_0x06fb('0x52')](_0x4eff65);}})[_0x06fb('0x27')](function(_0x3bd7aa){if(_0x3bd7aa){return _0x3bd7aa?{'count':_0x33c429,'rows':_0x3bd7aa}:null;}})[_0x06fb('0x27')](respondWithResult(_0x32fcd6,null))[_0x06fb('0x47')](handleError(_0x32fcd6,null));};exports[_0x06fb('0x53')]=function(_0x4055b4,_0x1b9de3,_0x40173b){var _0x28ebe1={};var _0x372937={};var _0x36e37a;var _0x3d6363;return db[_0x06fb('0x44')][_0x06fb('0x50')]({'where':{'id':_0x4055b4['params']['id']}})['then'](handleEntityNotFound(_0x1b9de3,null))[_0x06fb('0x27')](function(_0x3a70db){if(_0x3a70db){_0x36e37a=_0x3a70db;_0x372937[_0x06fb('0x33')]=_['keys'](db['SugarcrmField'][_0x06fb('0x2f')]);_0x372937['query']=_['keys'](_0x4055b4[_0x06fb('0x34')]);_0x372937['filters']=_[_0x06fb('0x37')](_0x372937[_0x06fb('0x33')],_0x372937['query']);_0x28ebe1['attributes']=_[_0x06fb('0x37')](_0x372937[_0x06fb('0x33')],qs['fields'](_0x4055b4[_0x06fb('0x34')]['fields']));_0x28ebe1[_0x06fb('0x38')]=_0x28ebe1['attributes'][_0x06fb('0x3a')]?_0x28ebe1['attributes']:_0x372937[_0x06fb('0x33')];_0x28ebe1[_0x06fb('0x3d')]=qs[_0x06fb('0x3e')](_0x4055b4[_0x06fb('0x34')][_0x06fb('0x3e')]);_0x28ebe1[_0x06fb('0x3f')]=qs[_0x06fb('0x36')](_[_0x06fb('0x40')](_0x4055b4[_0x06fb('0x34')],_0x372937['filters']));if(_0x4055b4[_0x06fb('0x34')][_0x06fb('0x43')]){_0x28ebe1[_0x06fb('0x3f')]=_['merge'](_0x28ebe1['where'],{'$or':_['map'](_0x28ebe1[_0x06fb('0x38')],function(_0x4a5712){var _0x179d0a={};_0x179d0a[_0x4a5712]={'$like':'%'+_0x4055b4[_0x06fb('0x34')][_0x06fb('0x43')]+'%'};return _0x179d0a;})});}_0x28ebe1=_[_0x06fb('0x41')]({},_0x28ebe1,_0x4055b4[_0x06fb('0x4b')]);return _0x36e37a[_0x06fb('0x53')](_0x28ebe1);}})[_0x06fb('0x27')](function(_0x19cd8){if(_0x19cd8){_0x3d6363=_0x19cd8[_0x06fb('0x3a')];if(!_0x4055b4[_0x06fb('0x34')][_0x06fb('0x3b')](_0x06fb('0x3c'))){_0x28ebe1[_0x06fb('0x1f')]=qs[_0x06fb('0x1f')](_0x4055b4[_0x06fb('0x34')]['limit']);_0x28ebe1[_0x06fb('0x1d')]=qs[_0x06fb('0x1d')](_0x4055b4[_0x06fb('0x34')][_0x06fb('0x1d')]);}return _0x36e37a['getDescriptions'](_0x28ebe1);}})[_0x06fb('0x27')](function(_0x12cf17){if(_0x12cf17){return _0x12cf17?{'count':_0x3d6363,'rows':_0x12cf17}:null;}})[_0x06fb('0x27')](respondWithResult(_0x1b9de3,null))[_0x06fb('0x47')](handleError(_0x1b9de3,null));}; \ No newline at end of file +var _0x03cd=['find','create','body','getFields','findOne','rawAttributes','order','SugarcrmField','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','SugarcrmConfiguration','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','options'];(function(_0x1bbbff,_0x55c3b8){var _0x5b23ac=function(_0x13f4d3){while(--_0x13f4d3){_0x1bbbff['push'](_0x1bbbff['shift']());}};_0x5b23ac(++_0x55c3b8);}(_0x03cd,0x1e3));var _0xd03c=function(_0x24c7d8,_0x39bf28){_0x24c7d8=_0x24c7d8-0x0;var _0x20a453=_0x03cd[_0x24c7d8];return _0x20a453;};'use strict';var emlformat=require(_0xd03c('0x0'));var rimraf=require(_0xd03c('0x1'));var zipdir=require(_0xd03c('0x2'));var jsonpatch=require(_0xd03c('0x3'));var rp=require(_0xd03c('0x4'));var moment=require('moment');var BPromise=require(_0xd03c('0x5'));var Mustache=require(_0xd03c('0x6'));var util=require(_0xd03c('0x7'));var path=require(_0xd03c('0x8'));var sox=require(_0xd03c('0x9'));var csv=require(_0xd03c('0xa'));var ejs=require(_0xd03c('0xb'));var fs=require('fs');var fs_extra=require(_0xd03c('0xc'));var _=require(_0xd03c('0xd'));var squel=require('squel');var crypto=require(_0xd03c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd03c('0xf'));var toCsv=require(_0xd03c('0xa'));var querystring=require(_0xd03c('0x10'));var Papa=require(_0xd03c('0x11'));var Redis=require(_0xd03c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd03c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd03c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd03c('0x15'));var licenseUtil=require(_0xd03c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aae4e,_0x2f3b86){_0x2f3b86=_0x2f3b86||0xcc;return function(_0x251b2e){if(_0x251b2e){return _0x2aae4e['sendStatus'](_0x2f3b86);}return _0x2aae4e[_0xd03c('0x17')](_0x2f3b86)['end']();};}function respondWithResult(_0x4a6496,_0x5990a3){_0x5990a3=_0x5990a3||0xc8;return function(_0x513905){if(_0x513905){return _0x4a6496[_0xd03c('0x17')](_0x5990a3)[_0xd03c('0x18')](_0x513905);}};}function respondWithFilteredResult(_0xf733da,_0x487d1f){return function(_0x22f5a3){if(_0x22f5a3){var _0x56c69b=typeof _0x487d1f[_0xd03c('0x19')]===_0xd03c('0x1a')&&typeof _0x487d1f[_0xd03c('0x1b')]==='undefined';var _0x30481b=_0x22f5a3[_0xd03c('0x1c')];var _0x29a8cf=_0x56c69b?0x0:_0x487d1f[_0xd03c('0x19')];var _0x51e82d=_0x56c69b?_0x22f5a3['count']:_0x487d1f[_0xd03c('0x19')]+_0x487d1f[_0xd03c('0x1b')];var _0x314c8a;if(_0x51e82d>=_0x30481b){_0x51e82d=_0x30481b;_0x314c8a=0xc8;}else{_0x314c8a=0xce;}_0xf733da[_0xd03c('0x17')](_0x314c8a);return _0xf733da[_0xd03c('0x1d')]('Content-Range',_0x29a8cf+'-'+_0x51e82d+'/'+_0x30481b)[_0xd03c('0x18')](_0x22f5a3);}return null;};}function patchUpdates(_0x1fa415){return function(_0xd53ac3){try{jsonpatch[_0xd03c('0x1e')](_0xd53ac3,_0x1fa415,!![]);}catch(_0x8dbfb1){return BPromise[_0xd03c('0x1f')](_0x8dbfb1);}return _0xd53ac3[_0xd03c('0x20')]();};}function saveUpdates(_0x3083c7,_0x4b02d3){return function(_0xe33b3){if(_0xe33b3){return _0xe33b3[_0xd03c('0x21')](_0x3083c7)[_0xd03c('0x22')](function(_0x1d2f08){return _0x1d2f08;});}return null;};}function removeEntity(_0x34dee1,_0x434f2c){return function(_0x5782b7){if(_0x5782b7){return _0x5782b7[_0xd03c('0x23')]()[_0xd03c('0x22')](function(){_0x34dee1[_0xd03c('0x17')](0xcc)[_0xd03c('0x24')]();});}};}function handleEntityNotFound(_0x5f2339,_0xff6841){return function(_0x1db9f0){if(!_0x1db9f0){_0x5f2339['sendStatus'](0x194);}return _0x1db9f0;};}function handleError(_0x1dc8f9,_0x3bd885){_0x3bd885=_0x3bd885||0x1f4;return function(_0x5e9211){logger[_0xd03c('0x25')](_0x5e9211[_0xd03c('0x26')]);if(_0x5e9211[_0xd03c('0x27')]){delete _0x5e9211['name'];}_0x1dc8f9[_0xd03c('0x17')](_0x3bd885)[_0xd03c('0x28')](_0x5e9211);};}exports[_0xd03c('0x29')]=function(_0x45544c,_0x2c8fcc){var _0xd8b237={},_0x4f3538={},_0x3a0ab3={'count':0x0,'rows':[]};var _0x45d4d6=_['map'](db[_0xd03c('0x2a')]['rawAttributes'],function(_0x154dfe){return{'name':_0x154dfe[_0xd03c('0x2b')],'type':_0x154dfe[_0xd03c('0x2c')][_0xd03c('0x2d')]};});_0x4f3538['model']=_['map'](_0x45d4d6,'name');_0x4f3538[_0xd03c('0x2e')]=_[_0xd03c('0x2f')](_0x45544c[_0xd03c('0x2e')]);_0x4f3538['filters']=_['intersection'](_0x4f3538[_0xd03c('0x30')],_0x4f3538[_0xd03c('0x2e')]);_0xd8b237[_0xd03c('0x31')]=_[_0xd03c('0x32')](_0x4f3538[_0xd03c('0x30')],qs[_0xd03c('0x33')](_0x45544c[_0xd03c('0x2e')][_0xd03c('0x33')]));_0xd8b237[_0xd03c('0x31')]=_0xd8b237[_0xd03c('0x31')][_0xd03c('0x34')]?_0xd8b237[_0xd03c('0x31')]:_0x4f3538[_0xd03c('0x30')];if(!_0x45544c[_0xd03c('0x2e')][_0xd03c('0x35')](_0xd03c('0x36'))){_0xd8b237['limit']=qs['limit'](_0x45544c[_0xd03c('0x2e')]['limit']);_0xd8b237[_0xd03c('0x19')]=qs[_0xd03c('0x19')](_0x45544c[_0xd03c('0x2e')][_0xd03c('0x19')]);}_0xd8b237['order']=qs[_0xd03c('0x37')](_0x45544c['query']['sort']);_0xd8b237[_0xd03c('0x38')]=qs[_0xd03c('0x39')](_[_0xd03c('0x3a')](_0x45544c[_0xd03c('0x2e')],_0x4f3538[_0xd03c('0x39')]),_0x45d4d6);if(_0x45544c[_0xd03c('0x2e')][_0xd03c('0x3b')]){_0xd8b237['where']=_[_0xd03c('0x3c')](_0xd8b237[_0xd03c('0x38')],{'$or':_[_0xd03c('0x3d')](_0x45d4d6,function(_0x50ca04){if(_0x50ca04[_0xd03c('0x2c')]!==_0xd03c('0x3e')){var _0x36dd7b={};_0x36dd7b[_0x50ca04['name']]={'$like':'%'+_0x45544c['query']['filter']+'%'};return _0x36dd7b;}})});}_0xd8b237=_[_0xd03c('0x3c')]({},_0xd8b237,_0x45544c['options']);var _0x298a0e={'where':_0xd8b237[_0xd03c('0x38')]};return db[_0xd03c('0x2a')]['count'](_0x298a0e)[_0xd03c('0x22')](function(_0x4848b4){_0x3a0ab3[_0xd03c('0x1c')]=_0x4848b4;if(_0x45544c['query'][_0xd03c('0x3f')]){_0xd8b237[_0xd03c('0x40')]=[{'all':!![]}];}return db[_0xd03c('0x2a')][_0xd03c('0x41')](_0xd8b237);})['then'](function(_0x1a5cc2){_0x3a0ab3['rows']=_0x1a5cc2;return _0x3a0ab3;})[_0xd03c('0x22')](respondWithFilteredResult(_0x2c8fcc,_0xd8b237))[_0xd03c('0x42')](handleError(_0x2c8fcc,null));};exports[_0xd03c('0x43')]=function(_0x2b6672,_0x1053bf){var _0x34516f={'raw':![],'where':{'id':_0x2b6672[_0xd03c('0x44')]['id']}},_0x1c2be1={};_0x1c2be1[_0xd03c('0x30')]=_['keys'](db[_0xd03c('0x2a')]['rawAttributes']);_0x1c2be1[_0xd03c('0x2e')]=_['keys'](_0x2b6672[_0xd03c('0x2e')]);_0x1c2be1[_0xd03c('0x39')]=_[_0xd03c('0x32')](_0x1c2be1[_0xd03c('0x30')],_0x1c2be1[_0xd03c('0x2e')]);_0x34516f[_0xd03c('0x31')]=_[_0xd03c('0x32')](_0x1c2be1[_0xd03c('0x30')],qs[_0xd03c('0x33')](_0x2b6672['query'][_0xd03c('0x33')]));_0x34516f['attributes']=_0x34516f[_0xd03c('0x31')][_0xd03c('0x34')]?_0x34516f[_0xd03c('0x31')]:_0x1c2be1[_0xd03c('0x30')];if(_0x2b6672[_0xd03c('0x2e')][_0xd03c('0x3f')]){_0x34516f[_0xd03c('0x40')]=[{'all':!![]}];}_0x34516f=_['merge']({},_0x34516f,_0x2b6672[_0xd03c('0x45')]);return db[_0xd03c('0x2a')][_0xd03c('0x46')](_0x34516f)[_0xd03c('0x22')](handleEntityNotFound(_0x1053bf,null))[_0xd03c('0x22')](respondWithResult(_0x1053bf,null))[_0xd03c('0x42')](handleError(_0x1053bf,null));};exports[_0xd03c('0x47')]=function(_0x7bb437,_0x3e7437){return db[_0xd03c('0x2a')][_0xd03c('0x47')](_0x7bb437[_0xd03c('0x48')],{})[_0xd03c('0x22')](respondWithResult(_0x3e7437,0xc9))['catch'](handleError(_0x3e7437,null));};exports['update']=function(_0x28e730,_0x1c1028){if(_0x28e730[_0xd03c('0x48')]['id']){delete _0x28e730['body']['id'];}return db[_0xd03c('0x2a')][_0xd03c('0x46')]({'where':{'id':_0x28e730['params']['id']}})['then'](handleEntityNotFound(_0x1c1028,null))[_0xd03c('0x22')](saveUpdates(_0x28e730[_0xd03c('0x48')],null))[_0xd03c('0x22')](respondWithResult(_0x1c1028,null))['catch'](handleError(_0x1c1028,null));};exports[_0xd03c('0x23')]=function(_0x442248,_0x2d38b5){return db[_0xd03c('0x2a')][_0xd03c('0x46')]({'where':{'id':_0x442248[_0xd03c('0x44')]['id']}})[_0xd03c('0x22')](handleEntityNotFound(_0x2d38b5,null))[_0xd03c('0x22')](removeEntity(_0x2d38b5,null))['catch'](handleError(_0x2d38b5,null));};exports[_0xd03c('0x49')]=function(_0x100678,_0x19fd17,_0x15c693){var _0x5d033c={};var _0x138385={};var _0x42aeb;var _0x4053c8;return db[_0xd03c('0x2a')][_0xd03c('0x4a')]({'where':{'id':_0x100678[_0xd03c('0x44')]['id']}})[_0xd03c('0x22')](handleEntityNotFound(_0x19fd17,null))[_0xd03c('0x22')](function(_0x514fad){if(_0x514fad){_0x42aeb=_0x514fad;_0x138385[_0xd03c('0x30')]=_[_0xd03c('0x2f')](db['SugarcrmField'][_0xd03c('0x4b')]);_0x138385['query']=_[_0xd03c('0x2f')](_0x100678[_0xd03c('0x2e')]);_0x138385[_0xd03c('0x39')]=_[_0xd03c('0x32')](_0x138385[_0xd03c('0x30')],_0x138385[_0xd03c('0x2e')]);_0x5d033c[_0xd03c('0x31')]=_[_0xd03c('0x32')](_0x138385[_0xd03c('0x30')],qs[_0xd03c('0x33')](_0x100678[_0xd03c('0x2e')][_0xd03c('0x33')]));_0x5d033c['attributes']=_0x5d033c[_0xd03c('0x31')][_0xd03c('0x34')]?_0x5d033c[_0xd03c('0x31')]:_0x138385['model'];_0x5d033c[_0xd03c('0x4c')]=qs[_0xd03c('0x37')](_0x100678['query']['sort']);_0x5d033c[_0xd03c('0x38')]=qs[_0xd03c('0x39')](_[_0xd03c('0x3a')](_0x100678[_0xd03c('0x2e')],_0x138385['filters']));if(_0x100678['query']['filter']){_0x5d033c[_0xd03c('0x38')]=_[_0xd03c('0x3c')](_0x5d033c[_0xd03c('0x38')],{'$or':_[_0xd03c('0x3d')](_0x5d033c[_0xd03c('0x31')],function(_0x4ddda0){var _0x511c9a={};_0x511c9a[_0x4ddda0]={'$like':'%'+_0x100678['query'][_0xd03c('0x3b')]+'%'};return _0x511c9a;})});}_0x5d033c=_[_0xd03c('0x3c')]({},_0x5d033c,_0x100678[_0xd03c('0x45')]);return _0x42aeb['getFields'](_0x5d033c);}})[_0xd03c('0x22')](function(_0x36767){if(_0x36767){_0x4053c8=_0x36767[_0xd03c('0x34')];if(!_0x100678[_0xd03c('0x2e')][_0xd03c('0x35')]('nolimit')){_0x5d033c['limit']=qs['limit'](_0x100678[_0xd03c('0x2e')][_0xd03c('0x1b')]);_0x5d033c[_0xd03c('0x19')]=qs[_0xd03c('0x19')](_0x100678['query']['offset']);}return _0x42aeb[_0xd03c('0x49')](_0x5d033c);}})[_0xd03c('0x22')](function(_0x35a7e1){if(_0x35a7e1){return _0x35a7e1?{'count':_0x4053c8,'rows':_0x35a7e1}:null;}})[_0xd03c('0x22')](respondWithResult(_0x19fd17,null))[_0xd03c('0x42')](handleError(_0x19fd17,null));};exports['getSubjects']=function(_0x31fe5f,_0x5c67ba,_0x4e14ae){var _0x7e79bf={};var _0x49c479={};var _0x490178;var _0x45f2a4;return db['SugarcrmConfiguration'][_0xd03c('0x4a')]({'where':{'id':_0x31fe5f[_0xd03c('0x44')]['id']}})[_0xd03c('0x22')](handleEntityNotFound(_0x5c67ba,null))[_0xd03c('0x22')](function(_0x5de889){if(_0x5de889){_0x490178=_0x5de889;_0x49c479[_0xd03c('0x30')]=_[_0xd03c('0x2f')](db[_0xd03c('0x4d')]['rawAttributes']);_0x49c479[_0xd03c('0x2e')]=_[_0xd03c('0x2f')](_0x31fe5f[_0xd03c('0x2e')]);_0x49c479['filters']=_['intersection'](_0x49c479[_0xd03c('0x30')],_0x49c479[_0xd03c('0x2e')]);_0x7e79bf[_0xd03c('0x31')]=_[_0xd03c('0x32')](_0x49c479[_0xd03c('0x30')],qs[_0xd03c('0x33')](_0x31fe5f[_0xd03c('0x2e')][_0xd03c('0x33')]));_0x7e79bf['attributes']=_0x7e79bf[_0xd03c('0x31')][_0xd03c('0x34')]?_0x7e79bf[_0xd03c('0x31')]:_0x49c479[_0xd03c('0x30')];_0x7e79bf[_0xd03c('0x4c')]=qs[_0xd03c('0x37')](_0x31fe5f[_0xd03c('0x2e')][_0xd03c('0x37')]);_0x7e79bf['where']=qs[_0xd03c('0x39')](_['pick'](_0x31fe5f[_0xd03c('0x2e')],_0x49c479['filters']));if(_0x31fe5f[_0xd03c('0x2e')]['filter']){_0x7e79bf[_0xd03c('0x38')]=_['merge'](_0x7e79bf[_0xd03c('0x38')],{'$or':_['map'](_0x7e79bf[_0xd03c('0x31')],function(_0x1c0e28){var _0x4c5d4c={};_0x4c5d4c[_0x1c0e28]={'$like':'%'+_0x31fe5f[_0xd03c('0x2e')][_0xd03c('0x3b')]+'%'};return _0x4c5d4c;})});}_0x7e79bf=_[_0xd03c('0x3c')]({},_0x7e79bf,_0x31fe5f[_0xd03c('0x45')]);return _0x490178['getSubjects'](_0x7e79bf);}})[_0xd03c('0x22')](function(_0x13b89e){if(_0x13b89e){_0x45f2a4=_0x13b89e[_0xd03c('0x34')];if(!_0x31fe5f[_0xd03c('0x2e')][_0xd03c('0x35')](_0xd03c('0x36'))){_0x7e79bf[_0xd03c('0x1b')]=qs[_0xd03c('0x1b')](_0x31fe5f['query'][_0xd03c('0x1b')]);_0x7e79bf[_0xd03c('0x19')]=qs[_0xd03c('0x19')](_0x31fe5f['query']['offset']);}return _0x490178[_0xd03c('0x4e')](_0x7e79bf);}})[_0xd03c('0x22')](function(_0x2234c1){if(_0x2234c1){return _0x2234c1?{'count':_0x45f2a4,'rows':_0x2234c1}:null;}})[_0xd03c('0x22')](respondWithResult(_0x5c67ba,null))[_0xd03c('0x42')](handleError(_0x5c67ba,null));};exports['getDescriptions']=function(_0x1f8802,_0x176e1e,_0x542124){var _0x4a6a06={};var _0xa7b935={};var _0x59334c;var _0x53f160;return db['SugarcrmConfiguration'][_0xd03c('0x4a')]({'where':{'id':_0x1f8802['params']['id']}})[_0xd03c('0x22')](handleEntityNotFound(_0x176e1e,null))[_0xd03c('0x22')](function(_0x1e1777){if(_0x1e1777){_0x59334c=_0x1e1777;_0xa7b935['model']=_[_0xd03c('0x2f')](db[_0xd03c('0x4d')][_0xd03c('0x4b')]);_0xa7b935['query']=_[_0xd03c('0x2f')](_0x1f8802[_0xd03c('0x2e')]);_0xa7b935[_0xd03c('0x39')]=_[_0xd03c('0x32')](_0xa7b935[_0xd03c('0x30')],_0xa7b935[_0xd03c('0x2e')]);_0x4a6a06[_0xd03c('0x31')]=_[_0xd03c('0x32')](_0xa7b935[_0xd03c('0x30')],qs[_0xd03c('0x33')](_0x1f8802[_0xd03c('0x2e')][_0xd03c('0x33')]));_0x4a6a06[_0xd03c('0x31')]=_0x4a6a06[_0xd03c('0x31')][_0xd03c('0x34')]?_0x4a6a06[_0xd03c('0x31')]:_0xa7b935['model'];_0x4a6a06[_0xd03c('0x4c')]=qs[_0xd03c('0x37')](_0x1f8802[_0xd03c('0x2e')]['sort']);_0x4a6a06[_0xd03c('0x38')]=qs[_0xd03c('0x39')](_[_0xd03c('0x3a')](_0x1f8802['query'],_0xa7b935[_0xd03c('0x39')]));if(_0x1f8802[_0xd03c('0x2e')][_0xd03c('0x3b')]){_0x4a6a06['where']=_[_0xd03c('0x3c')](_0x4a6a06[_0xd03c('0x38')],{'$or':_['map'](_0x4a6a06[_0xd03c('0x31')],function(_0x50be03){var _0x24370f={};_0x24370f[_0x50be03]={'$like':'%'+_0x1f8802[_0xd03c('0x2e')][_0xd03c('0x3b')]+'%'};return _0x24370f;})});}_0x4a6a06=_[_0xd03c('0x3c')]({},_0x4a6a06,_0x1f8802[_0xd03c('0x45')]);return _0x59334c['getDescriptions'](_0x4a6a06);}})[_0xd03c('0x22')](function(_0x2107e8){if(_0x2107e8){_0x53f160=_0x2107e8['length'];if(!_0x1f8802[_0xd03c('0x2e')]['hasOwnProperty'](_0xd03c('0x36'))){_0x4a6a06['limit']=qs[_0xd03c('0x1b')](_0x1f8802[_0xd03c('0x2e')]['limit']);_0x4a6a06['offset']=qs['offset'](_0x1f8802['query'][_0xd03c('0x19')]);}return _0x59334c['getDescriptions'](_0x4a6a06);}})[_0xd03c('0x22')](function(_0x17a2ff){if(_0x17a2ff){return _0x17a2ff?{'count':_0x53f160,'rows':_0x17a2ff}:null;}})[_0xd03c('0x22')](respondWithResult(_0x176e1e,null))['catch'](handleError(_0x176e1e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4ff87dd..b5d9368 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 _0xc79b=['exports','define','SugarcrmConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc79b,0x1d1));var _0xbc79=function(_0x30fc7d,_0x59c4fa){_0x30fc7d=_0x30fc7d-0x0;var _0x1781ed=_0xc79b[_0x30fc7d];return _0x1781ed;};'use strict';var _=require(_0xbc79('0x0'));var util=require('util');var logger=require(_0xbc79('0x1'))(_0xbc79('0x2'));var moment=require(_0xbc79('0x3'));var BPromise=require(_0xbc79('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc79('0x5'));var rimraf=require(_0xbc79('0x6'));var config=require(_0xbc79('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xbc79('0x8')]=function(_0x50a447,_0x231fe7){return _0x50a447[_0xbc79('0x9')](_0xbc79('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dfa=['bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x2ec4f4,_0x5e3a1e){var _0x34ad89=function(_0x2bbbd8){while(--_0x2bbbd8){_0x2ec4f4['push'](_0x2ec4f4['shift']());}};_0x34ad89(++_0x5e3a1e);}(_0x5dfa,0x1ad));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa5df('0x0'));var util=require(_0xa5df('0x1'));var logger=require(_0xa5df('0x2'))(_0xa5df('0x3'));var moment=require(_0xa5df('0x4'));var BPromise=require(_0xa5df('0x5'));var rp=require(_0xa5df('0x6'));var fs=require('fs');var path=require(_0xa5df('0x7'));var rimraf=require(_0xa5df('0x8'));var config=require('../../config/environment');var attributes=require(_0xa5df('0x9'));module[_0xa5df('0xa')]=function(_0xfba564,_0x4c57a7){return _0xfba564[_0xa5df('0xb')](_0xa5df('0xc'),attributes,{'tableName':_0xa5df('0xd'),'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 1b6aebb..cf126b2 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 _0xc299=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c3ff7,_0x224f3c){var _0x102477=function(_0x538b2b){while(--_0x538b2b){_0x1c3ff7['push'](_0x1c3ff7['shift']());}};_0x102477(++_0x224f3c);}(_0xc299,0x192));var _0x9c29=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0xc299[_0x208505];return _0x1a985f;};'use strict';var _=require(_0x9c29('0x0'));var util=require(_0x9c29('0x1'));var moment=require(_0x9c29('0x2'));var BPromise=require(_0x9c29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c29('0x5'));var logger=require(_0x9c29('0x6'))(_0x9c29('0x7'));var config=require(_0x9c29('0x8'));var jayson=require(_0x9c29('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17ef20,_0x147723,_0x18eac3){return new BPromise(function(_0xbef957,_0x4180ca){return client[_0x9c29('0xa')](_0x17ef20,_0x18eac3)[_0x9c29('0xb')](function(_0x475929){logger[_0x9c29('0xc')](_0x9c29('0xd'),_0x147723,_0x9c29('0xe'));logger['debug'](_0x9c29('0xf'),_0x147723,_0x9c29('0xe'),JSON[_0x9c29('0x10')](_0x475929));if(_0x475929[_0x9c29('0x11')]){if(_0x475929[_0x9c29('0x11')]['code']===0x1f4){logger[_0x9c29('0x11')](_0x9c29('0xd'),_0x147723,_0x475929[_0x9c29('0x11')][_0x9c29('0x12')]);return _0x4180ca(_0x475929[_0x9c29('0x11')][_0x9c29('0x12')]);}logger[_0x9c29('0x11')](_0x9c29('0xd'),_0x147723,_0x475929[_0x9c29('0x11')][_0x9c29('0x12')]);return _0xbef957(_0x475929[_0x9c29('0x11')][_0x9c29('0x12')]);}else{logger[_0x9c29('0xc')](_0x9c29('0xd'),_0x147723,_0x9c29('0xe'));_0xbef957(_0x475929[_0x9c29('0x13')][_0x9c29('0x12')]);}})[_0x9c29('0x14')](function(_0x16c314){logger[_0x9c29('0x11')](_0x9c29('0xd'),_0x147723,_0x16c314);_0x4180ca(_0x16c314);});});} \ No newline at end of file +var _0xbd27=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x25d260,_0xb5423d){var _0x307c60=function(_0x4281cf){while(--_0x4281cf){_0x25d260['push'](_0x25d260['shift']());}};_0x307c60(++_0xb5423d);}(_0xbd27,0x6d));var _0x7bd2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbd27[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7bd2('0x0'));var util=require(_0x7bd2('0x1'));var moment=require(_0x7bd2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bd2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bd2('0x4'));var logger=require(_0x7bd2('0x5'))(_0x7bd2('0x6'));var config=require(_0x7bd2('0x7'));var jayson=require(_0x7bd2('0x8'));var client=jayson[_0x7bd2('0x9')][_0x7bd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59d2be,_0x5da416,_0x1d45a0){return new BPromise(function(_0x435a6f,_0x5110a7){return client[_0x7bd2('0xb')](_0x59d2be,_0x1d45a0)[_0x7bd2('0xc')](function(_0x568dd7){logger['info'](_0x7bd2('0xd'),_0x5da416,'request\x20sent');logger[_0x7bd2('0xe')](_0x7bd2('0xf'),_0x5da416,_0x7bd2('0x10'),JSON[_0x7bd2('0x11')](_0x568dd7));if(_0x568dd7[_0x7bd2('0x12')]){if(_0x568dd7['error']['code']===0x1f4){logger['error'](_0x7bd2('0xd'),_0x5da416,_0x568dd7['error'][_0x7bd2('0x13')]);return _0x5110a7(_0x568dd7[_0x7bd2('0x12')][_0x7bd2('0x13')]);}logger[_0x7bd2('0x12')](_0x7bd2('0xd'),_0x5da416,_0x568dd7[_0x7bd2('0x12')]['message']);return _0x435a6f(_0x568dd7[_0x7bd2('0x12')][_0x7bd2('0x13')]);}else{logger['info'](_0x7bd2('0xd'),_0x5da416,_0x7bd2('0x10'));_0x435a6f(_0x568dd7[_0x7bd2('0x14')][_0x7bd2('0x13')]);}})[_0x7bd2('0x15')](function(_0x5093af){logger['error'](_0x7bd2('0xd'),_0x5da416,_0x5093af);_0x5110a7(_0x5093af);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index bd123ea..1d69b3e 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 _0xbd3e=['/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbd3e,0xb0));var _0xebd3=function(_0x6c2e0e,_0x1ca217){_0x6c2e0e=_0x6c2e0e-0x0;var _0x139caf=_0xbd3e[_0x6c2e0e];return _0x139caf;};'use strict';var multer=require(_0xebd3('0x0'));var util=require(_0xebd3('0x1'));var path=require(_0xebd3('0x2'));var timeout=require(_0xebd3('0x3'));var express=require(_0xebd3('0x4'));var router=express[_0xebd3('0x5')]();var fs_extra=require(_0xebd3('0x6'));var auth=require(_0xebd3('0x7'));var interaction=require(_0xebd3('0x8'));var config=require(_0xebd3('0x9'));var controller=require(_0xebd3('0xa'));router[_0xebd3('0xb')]('/',auth['isAuthenticated'](),controller[_0xebd3('0xc')]);router[_0xebd3('0xb')](_0xebd3('0xd'),auth[_0xebd3('0xe')](),controller[_0xebd3('0xf')]);router[_0xebd3('0x10')]('/',auth[_0xebd3('0xe')](),controller['create']);router[_0xebd3('0x11')]('/:id',auth[_0xebd3('0xe')](),controller[_0xebd3('0x12')]);router['delete'](_0xebd3('0xd'),auth[_0xebd3('0xe')](),controller[_0xebd3('0x13')]);module[_0xebd3('0x14')]=router; \ No newline at end of file +var _0x413d=['show','post','isAuthenticated','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','/:id'];(function(_0xd3169c,_0x6084a3){var _0x546fde=function(_0x59fa8d){while(--_0x59fa8d){_0xd3169c['push'](_0xd3169c['shift']());}};_0x546fde(++_0x6084a3);}(_0x413d,0x176));var _0xd413=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x413d[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0xd413('0x0'));var util=require(_0xd413('0x1'));var path=require('path');var timeout=require(_0xd413('0x2'));var express=require(_0xd413('0x3'));var router=express[_0xd413('0x4')]();var fs_extra=require(_0xd413('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd413('0x6'));var config=require('../../config/environment');var controller=require(_0xd413('0x7'));router[_0xd413('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd413('0x8')](_0xd413('0x9'),auth['isAuthenticated'](),controller[_0xd413('0xa')]);router[_0xd413('0xb')]('/',auth[_0xd413('0xc')](),controller['create']);router['put'](_0xd413('0x9'),auth[_0xd413('0xc')](),controller[_0xd413('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd413('0xe')]);module[_0xd413('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ea6252d..594220f 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 _0x459f=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize'];(function(_0x5f0003,_0x48f4ed){var _0x1fbc06=function(_0x4c62ec){while(--_0x4c62ec){_0x5f0003['push'](_0x5f0003['shift']());}};_0x1fbc06(++_0x48f4ed);}(_0x459f,0x1e7));var _0xf459=function(_0x3287f6,_0xb09471){_0x3287f6=_0x3287f6-0x0;var _0x2b5e30=_0x459f[_0x3287f6];return _0x2b5e30;};'use strict';var Sequelize=require(_0xf459('0x0'));module['exports']={'type':{'type':Sequelize[_0xf459('0x1')](_0xf459('0x2'),_0xf459('0x3'),'customVariable',_0xf459('0x4'),_0xf459('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf459('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf459('0x1')](_0xf459('0x2'),_0xf459('0x3'),_0xf459('0x7'))},'keyContent':{'type':Sequelize[_0xf459('0x6')]},'idField':{'type':Sequelize[_0xf459('0x6')]},'nameField':{'type':Sequelize[_0xf459('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf459('0x6')]}}; \ No newline at end of file +var _0x64bb=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x64bb,0xf3));var _0xb64b=function(_0x43f62d,_0x97e5bd){_0x43f62d=_0x43f62d-0x0;var _0x550b5f=_0x64bb[_0x43f62d];return _0x550b5f;};'use strict';var Sequelize=require(_0xb64b('0x0'));module[_0xb64b('0x1')]={'type':{'type':Sequelize[_0xb64b('0x2')](_0xb64b('0x3'),_0xb64b('0x4'),_0xb64b('0x5'),_0xb64b('0x6'),_0xb64b('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb64b('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb64b('0x2')](_0xb64b('0x3'),_0xb64b('0x4'),_0xb64b('0x5'))},'keyContent':{'type':Sequelize[_0xb64b('0x8')]},'idField':{'type':Sequelize[_0xb64b('0x8')]},'nameField':{'type':Sequelize[_0xb64b('0x8')]},'customField':{'type':Sequelize[_0xb64b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb64b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 9e44afc..aa0c2c1 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 _0x697c=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','count','includeAll','include','findAll','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','map','SugarcrmField'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x697c,0x152));var _0xc697=function(_0x352543,_0x234ecb){_0x352543=_0x352543-0x0;var _0x16e97c=_0x697c[_0x352543];return _0x16e97c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc697('0x0'));var zipdir=require(_0xc697('0x1'));var jsonpatch=require(_0xc697('0x2'));var rp=require(_0xc697('0x3'));var moment=require(_0xc697('0x4'));var BPromise=require(_0xc697('0x5'));var Mustache=require(_0xc697('0x6'));var util=require(_0xc697('0x7'));var path=require(_0xc697('0x8'));var sox=require(_0xc697('0x9'));var csv=require('to-csv');var ejs=require(_0xc697('0xa'));var fs=require('fs');var fs_extra=require(_0xc697('0xb'));var _=require(_0xc697('0xc'));var squel=require(_0xc697('0xd'));var crypto=require(_0xc697('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc697('0xf'));var querystring=require(_0xc697('0x10'));var Papa=require('papaparse');var Redis=require(_0xc697('0x11'));var authService=require(_0xc697('0x12'));var qs=require(_0xc697('0x13'));var as=require(_0xc697('0x14'));var hardwareService=require(_0xc697('0x15'));var logger=require(_0xc697('0x16'))(_0xc697('0x17'));var utils=require(_0xc697('0x18'));var config=require(_0xc697('0x19'));var licenseUtil=require(_0xc697('0x1a'));var db=require(_0xc697('0x1b'))['db'];function respondWithStatusCode(_0x2c42ac,_0x4343c4){_0x4343c4=_0x4343c4||0xcc;return function(_0x2a5175){if(_0x2a5175){return _0x2c42ac['sendStatus'](_0x4343c4);}return _0x2c42ac[_0xc697('0x1c')](_0x4343c4)['end']();};}function respondWithResult(_0xa1bf,_0x1ce21c){_0x1ce21c=_0x1ce21c||0xc8;return function(_0x42f808){if(_0x42f808){return _0xa1bf[_0xc697('0x1c')](_0x1ce21c)[_0xc697('0x1d')](_0x42f808);}};}function respondWithFilteredResult(_0x43a016,_0x2c0ffc){return function(_0x7a44b2){if(_0x7a44b2){var _0xc2d8f5=typeof _0x2c0ffc[_0xc697('0x1e')]===_0xc697('0x1f')&&typeof _0x2c0ffc[_0xc697('0x20')]===_0xc697('0x1f');var _0x4318df=_0x7a44b2['count'];var _0x238019=_0xc2d8f5?0x0:_0x2c0ffc['offset'];var _0x3eeb99=_0xc2d8f5?_0x7a44b2['count']:_0x2c0ffc[_0xc697('0x1e')]+_0x2c0ffc[_0xc697('0x20')];var _0x488408;if(_0x3eeb99>=_0x4318df){_0x3eeb99=_0x4318df;_0x488408=0xc8;}else{_0x488408=0xce;}_0x43a016[_0xc697('0x1c')](_0x488408);return _0x43a016[_0xc697('0x21')]('Content-Range',_0x238019+'-'+_0x3eeb99+'/'+_0x4318df)[_0xc697('0x1d')](_0x7a44b2);}return null;};}function patchUpdates(_0x1a9d6f){return function(_0x1107e8){try{jsonpatch[_0xc697('0x22')](_0x1107e8,_0x1a9d6f,!![]);}catch(_0x5e5382){return BPromise[_0xc697('0x23')](_0x5e5382);}return _0x1107e8['save']();};}function saveUpdates(_0x527158,_0x51f976){return function(_0x41e1f2){if(_0x41e1f2){return _0x41e1f2[_0xc697('0x24')](_0x527158)[_0xc697('0x25')](function(_0x3d948d){return _0x3d948d;});}return null;};}function removeEntity(_0x371828,_0x1192c7){return function(_0x341529){if(_0x341529){return _0x341529[_0xc697('0x26')]()[_0xc697('0x25')](function(){_0x371828['status'](0xcc)[_0xc697('0x27')]();});}};}function handleEntityNotFound(_0x4f9584,_0x1cb7d9){return function(_0x38d709){if(!_0x38d709){_0x4f9584[_0xc697('0x28')](0x194);}return _0x38d709;};}function handleError(_0x2a63de,_0x883ee7){_0x883ee7=_0x883ee7||0x1f4;return function(_0x443f9d){logger[_0xc697('0x29')](_0x443f9d[_0xc697('0x2a')]);if(_0x443f9d[_0xc697('0x2b')]){delete _0x443f9d[_0xc697('0x2b')];}_0x2a63de['status'](_0x883ee7)[_0xc697('0x2c')](_0x443f9d);};}exports['index']=function(_0x5c3913,_0x5ed6a4){var _0x19f7a3={},_0x1110aa={},_0x4a5d5b={'count':0x0,'rows':[]};var _0x24f497=_[_0xc697('0x2d')](db[_0xc697('0x2e')][_0xc697('0x2f')],function(_0x2bddd1){return{'name':_0x2bddd1[_0xc697('0x30')],'type':_0x2bddd1['type'][_0xc697('0x31')]};});_0x1110aa[_0xc697('0x32')]=_[_0xc697('0x2d')](_0x24f497,_0xc697('0x2b'));_0x1110aa[_0xc697('0x33')]=_[_0xc697('0x34')](_0x5c3913[_0xc697('0x33')]);_0x1110aa[_0xc697('0x35')]=_[_0xc697('0x36')](_0x1110aa[_0xc697('0x32')],_0x1110aa[_0xc697('0x33')]);_0x19f7a3['attributes']=_[_0xc697('0x36')](_0x1110aa[_0xc697('0x32')],qs[_0xc697('0x37')](_0x5c3913[_0xc697('0x33')][_0xc697('0x37')]));_0x19f7a3['attributes']=_0x19f7a3[_0xc697('0x38')][_0xc697('0x39')]?_0x19f7a3[_0xc697('0x38')]:_0x1110aa['model'];if(!_0x5c3913['query'][_0xc697('0x3a')](_0xc697('0x3b'))){_0x19f7a3[_0xc697('0x20')]=qs[_0xc697('0x20')](_0x5c3913[_0xc697('0x33')][_0xc697('0x20')]);_0x19f7a3[_0xc697('0x1e')]=qs[_0xc697('0x1e')](_0x5c3913[_0xc697('0x33')][_0xc697('0x1e')]);}_0x19f7a3[_0xc697('0x3c')]=qs[_0xc697('0x3d')](_0x5c3913[_0xc697('0x33')]['sort']);_0x19f7a3[_0xc697('0x3e')]=qs['filters'](_[_0xc697('0x3f')](_0x5c3913['query'],_0x1110aa['filters']),_0x24f497);if(_0x5c3913['query']['filter']){_0x19f7a3[_0xc697('0x3e')]=_[_0xc697('0x40')](_0x19f7a3[_0xc697('0x3e')],{'$or':_[_0xc697('0x2d')](_0x24f497,function(_0x229d1d){if(_0x229d1d[_0xc697('0x41')]!=='VIRTUAL'){var _0x51d370={};_0x51d370[_0x229d1d[_0xc697('0x2b')]]={'$like':'%'+_0x5c3913[_0xc697('0x33')][_0xc697('0x42')]+'%'};return _0x51d370;}})});}_0x19f7a3=_[_0xc697('0x40')]({},_0x19f7a3,_0x5c3913[_0xc697('0x43')]);var _0x1ae889={'where':_0x19f7a3[_0xc697('0x3e')]};return db[_0xc697('0x2e')][_0xc697('0x44')](_0x1ae889)[_0xc697('0x25')](function(_0x5b7c1c){_0x4a5d5b[_0xc697('0x44')]=_0x5b7c1c;if(_0x5c3913[_0xc697('0x33')][_0xc697('0x45')]){_0x19f7a3[_0xc697('0x46')]=[{'all':!![]}];}return db[_0xc697('0x2e')][_0xc697('0x47')](_0x19f7a3);})[_0xc697('0x25')](function(_0x4c541a){_0x4a5d5b['rows']=_0x4c541a;return _0x4a5d5b;})['then'](respondWithFilteredResult(_0x5ed6a4,_0x19f7a3))[_0xc697('0x48')](handleError(_0x5ed6a4,null));};exports['show']=function(_0x3daa21,_0x3f2f88){var _0x137ab6={'raw':!![],'where':{'id':_0x3daa21[_0xc697('0x49')]['id']}},_0x4a6fe8={};_0x4a6fe8[_0xc697('0x32')]=_[_0xc697('0x34')](db[_0xc697('0x2e')]['rawAttributes']);_0x4a6fe8[_0xc697('0x33')]=_[_0xc697('0x34')](_0x3daa21[_0xc697('0x33')]);_0x4a6fe8[_0xc697('0x35')]=_[_0xc697('0x36')](_0x4a6fe8[_0xc697('0x32')],_0x4a6fe8['query']);_0x137ab6['attributes']=_['intersection'](_0x4a6fe8[_0xc697('0x32')],qs[_0xc697('0x37')](_0x3daa21[_0xc697('0x33')][_0xc697('0x37')]));_0x137ab6['attributes']=_0x137ab6['attributes']['length']?_0x137ab6[_0xc697('0x38')]:_0x4a6fe8[_0xc697('0x32')];if(_0x3daa21[_0xc697('0x33')][_0xc697('0x45')]){_0x137ab6[_0xc697('0x46')]=[{'all':!![]}];}_0x137ab6=_[_0xc697('0x40')]({},_0x137ab6,_0x3daa21[_0xc697('0x43')]);return db[_0xc697('0x2e')][_0xc697('0x4a')](_0x137ab6)[_0xc697('0x25')](handleEntityNotFound(_0x3f2f88,null))[_0xc697('0x25')](respondWithResult(_0x3f2f88,null))['catch'](handleError(_0x3f2f88,null));};exports['create']=function(_0x545e04,_0x2c5ee6){return db[_0xc697('0x2e')][_0xc697('0x4b')](_0x545e04['body'],{})[_0xc697('0x25')](respondWithResult(_0x2c5ee6,0xc9))[_0xc697('0x48')](handleError(_0x2c5ee6,null));};exports[_0xc697('0x24')]=function(_0x517896,_0x433623){if(_0x517896[_0xc697('0x4c')]['id']){delete _0x517896['body']['id'];}return db[_0xc697('0x2e')][_0xc697('0x4a')]({'where':{'id':_0x517896[_0xc697('0x49')]['id']}})['then'](handleEntityNotFound(_0x433623,null))['then'](saveUpdates(_0x517896['body'],null))['then'](respondWithResult(_0x433623,null))[_0xc697('0x48')](handleError(_0x433623,null));};exports[_0xc697('0x26')]=function(_0x8e29ee,_0x22fd36){return db[_0xc697('0x2e')][_0xc697('0x4a')]({'where':{'id':_0x8e29ee[_0xc697('0x49')]['id']}})[_0xc697('0x25')](handleEntityNotFound(_0x22fd36,null))[_0xc697('0x25')](removeEntity(_0x22fd36,null))[_0xc697('0x48')](handleError(_0x22fd36,null));}; \ No newline at end of file +var _0x62bf=['fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','SugarcrmField','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x62bf,0x83));var _0xf62b=function(_0x39cefc,_0x28d0bf){_0x39cefc=_0x39cefc-0x0;var _0x3079e6=_0x62bf[_0x39cefc];return _0x3079e6;};'use strict';var emlformat=require(_0xf62b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf62b('0x1'));var rp=require(_0xf62b('0x2'));var moment=require(_0xf62b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf62b('0x4'));var path=require(_0xf62b('0x5'));var sox=require(_0xf62b('0x6'));var csv=require(_0xf62b('0x7'));var ejs=require(_0xf62b('0x8'));var fs=require('fs');var fs_extra=require(_0xf62b('0x9'));var _=require(_0xf62b('0xa'));var squel=require('squel');var crypto=require(_0xf62b('0xb'));var jsforce=require(_0xf62b('0xc'));var deskjs=require(_0xf62b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf62b('0xe'));var Redis=require(_0xf62b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf62b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf62b('0x11'));var logger=require(_0xf62b('0x12'))(_0xf62b('0x13'));var utils=require(_0xf62b('0x14'));var config=require(_0xf62b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf62b('0x16'))['db'];function respondWithStatusCode(_0x5c5e8e,_0x31dc23){_0x31dc23=_0x31dc23||0xcc;return function(_0x2bee73){if(_0x2bee73){return _0x5c5e8e['sendStatus'](_0x31dc23);}return _0x5c5e8e[_0xf62b('0x17')](_0x31dc23)['end']();};}function respondWithResult(_0x1da84c,_0x283469){_0x283469=_0x283469||0xc8;return function(_0x366e42){if(_0x366e42){return _0x1da84c['status'](_0x283469)['json'](_0x366e42);}};}function respondWithFilteredResult(_0x2a73e0,_0x2038a5){return function(_0x2bb539){if(_0x2bb539){var _0x299582=typeof _0x2038a5[_0xf62b('0x18')]===_0xf62b('0x19')&&typeof _0x2038a5[_0xf62b('0x1a')]===_0xf62b('0x19');var _0x2ff3f0=_0x2bb539[_0xf62b('0x1b')];var _0x303cbb=_0x299582?0x0:_0x2038a5[_0xf62b('0x18')];var _0x12d202=_0x299582?_0x2bb539[_0xf62b('0x1b')]:_0x2038a5[_0xf62b('0x18')]+_0x2038a5[_0xf62b('0x1a')];var _0x3d5dbc;if(_0x12d202>=_0x2ff3f0){_0x12d202=_0x2ff3f0;_0x3d5dbc=0xc8;}else{_0x3d5dbc=0xce;}_0x2a73e0[_0xf62b('0x17')](_0x3d5dbc);return _0x2a73e0['set'](_0xf62b('0x1c'),_0x303cbb+'-'+_0x12d202+'/'+_0x2ff3f0)[_0xf62b('0x1d')](_0x2bb539);}return null;};}function patchUpdates(_0x4e796d){return function(_0x32d355){try{jsonpatch['apply'](_0x32d355,_0x4e796d,!![]);}catch(_0x392b23){return BPromise[_0xf62b('0x1e')](_0x392b23);}return _0x32d355[_0xf62b('0x1f')]();};}function saveUpdates(_0x12f714,_0x5194e2){return function(_0x3d8a4d){if(_0x3d8a4d){return _0x3d8a4d[_0xf62b('0x20')](_0x12f714)[_0xf62b('0x21')](function(_0x496196){return _0x496196;});}return null;};}function removeEntity(_0x1c96e,_0x2bcf8b){return function(_0x36f88b){if(_0x36f88b){return _0x36f88b[_0xf62b('0x22')]()[_0xf62b('0x21')](function(){_0x1c96e[_0xf62b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3351f3,_0x42240d){return function(_0x217918){if(!_0x217918){_0x3351f3['sendStatus'](0x194);}return _0x217918;};}function handleError(_0x33657d,_0x51762e){_0x51762e=_0x51762e||0x1f4;return function(_0x47d65d){logger[_0xf62b('0x23')](_0x47d65d['stack']);if(_0x47d65d[_0xf62b('0x24')]){delete _0x47d65d[_0xf62b('0x24')];}_0x33657d[_0xf62b('0x17')](_0x51762e)[_0xf62b('0x25')](_0x47d65d);};}exports[_0xf62b('0x26')]=function(_0x2f54b9,_0x4c3a33){var _0x32269a={},_0x5d3b64={},_0x6dc067={'count':0x0,'rows':[]};var _0x2f5f08=_['map'](db['SugarcrmField']['rawAttributes'],function(_0x2bcc01){return{'name':_0x2bcc01[_0xf62b('0x27')],'type':_0x2bcc01[_0xf62b('0x28')]['key']};});_0x5d3b64[_0xf62b('0x29')]=_[_0xf62b('0x2a')](_0x2f5f08,_0xf62b('0x24'));_0x5d3b64['query']=_['keys'](_0x2f54b9[_0xf62b('0x2b')]);_0x5d3b64[_0xf62b('0x2c')]=_[_0xf62b('0x2d')](_0x5d3b64[_0xf62b('0x29')],_0x5d3b64[_0xf62b('0x2b')]);_0x32269a[_0xf62b('0x2e')]=_[_0xf62b('0x2d')](_0x5d3b64[_0xf62b('0x29')],qs['fields'](_0x2f54b9[_0xf62b('0x2b')][_0xf62b('0x2f')]));_0x32269a[_0xf62b('0x2e')]=_0x32269a['attributes'][_0xf62b('0x30')]?_0x32269a[_0xf62b('0x2e')]:_0x5d3b64[_0xf62b('0x29')];if(!_0x2f54b9['query'][_0xf62b('0x31')]('nolimit')){_0x32269a[_0xf62b('0x1a')]=qs['limit'](_0x2f54b9['query']['limit']);_0x32269a[_0xf62b('0x18')]=qs[_0xf62b('0x18')](_0x2f54b9[_0xf62b('0x2b')][_0xf62b('0x18')]);}_0x32269a[_0xf62b('0x32')]=qs[_0xf62b('0x33')](_0x2f54b9[_0xf62b('0x2b')]['sort']);_0x32269a[_0xf62b('0x34')]=qs[_0xf62b('0x2c')](_['pick'](_0x2f54b9[_0xf62b('0x2b')],_0x5d3b64[_0xf62b('0x2c')]),_0x2f5f08);if(_0x2f54b9[_0xf62b('0x2b')]['filter']){_0x32269a[_0xf62b('0x34')]=_[_0xf62b('0x35')](_0x32269a[_0xf62b('0x34')],{'$or':_[_0xf62b('0x2a')](_0x2f5f08,function(_0x20d3e9){if(_0x20d3e9[_0xf62b('0x28')]!==_0xf62b('0x36')){var _0x43241f={};_0x43241f[_0x20d3e9[_0xf62b('0x24')]]={'$like':'%'+_0x2f54b9[_0xf62b('0x2b')][_0xf62b('0x37')]+'%'};return _0x43241f;}})});}_0x32269a=_[_0xf62b('0x35')]({},_0x32269a,_0x2f54b9['options']);var _0x1b78ae={'where':_0x32269a[_0xf62b('0x34')]};return db[_0xf62b('0x38')]['count'](_0x1b78ae)[_0xf62b('0x21')](function(_0x519108){_0x6dc067[_0xf62b('0x1b')]=_0x519108;if(_0x2f54b9[_0xf62b('0x2b')]['includeAll']){_0x32269a[_0xf62b('0x39')]=[{'all':!![]}];}return db['SugarcrmField'][_0xf62b('0x3a')](_0x32269a);})[_0xf62b('0x21')](function(_0xf0a7cf){_0x6dc067[_0xf62b('0x3b')]=_0xf0a7cf;return _0x6dc067;})[_0xf62b('0x21')](respondWithFilteredResult(_0x4c3a33,_0x32269a))[_0xf62b('0x3c')](handleError(_0x4c3a33,null));};exports[_0xf62b('0x3d')]=function(_0x5bb6a2,_0x137576){var _0x439245={'raw':!![],'where':{'id':_0x5bb6a2[_0xf62b('0x3e')]['id']}},_0x2d93a6={};_0x2d93a6['model']=_[_0xf62b('0x3f')](db[_0xf62b('0x38')][_0xf62b('0x40')]);_0x2d93a6[_0xf62b('0x2b')]=_['keys'](_0x5bb6a2['query']);_0x2d93a6['filters']=_[_0xf62b('0x2d')](_0x2d93a6[_0xf62b('0x29')],_0x2d93a6[_0xf62b('0x2b')]);_0x439245[_0xf62b('0x2e')]=_[_0xf62b('0x2d')](_0x2d93a6[_0xf62b('0x29')],qs[_0xf62b('0x2f')](_0x5bb6a2[_0xf62b('0x2b')][_0xf62b('0x2f')]));_0x439245[_0xf62b('0x2e')]=_0x439245[_0xf62b('0x2e')][_0xf62b('0x30')]?_0x439245[_0xf62b('0x2e')]:_0x2d93a6[_0xf62b('0x29')];if(_0x5bb6a2[_0xf62b('0x2b')][_0xf62b('0x41')]){_0x439245[_0xf62b('0x39')]=[{'all':!![]}];}_0x439245=_[_0xf62b('0x35')]({},_0x439245,_0x5bb6a2[_0xf62b('0x42')]);return db['SugarcrmField'][_0xf62b('0x43')](_0x439245)[_0xf62b('0x21')](handleEntityNotFound(_0x137576,null))[_0xf62b('0x21')](respondWithResult(_0x137576,null))[_0xf62b('0x3c')](handleError(_0x137576,null));};exports[_0xf62b('0x44')]=function(_0x2581de,_0x54bf40){return db[_0xf62b('0x38')][_0xf62b('0x44')](_0x2581de[_0xf62b('0x45')],{})['then'](respondWithResult(_0x54bf40,0xc9))['catch'](handleError(_0x54bf40,null));};exports[_0xf62b('0x20')]=function(_0x286954,_0x429eb6){if(_0x286954[_0xf62b('0x45')]['id']){delete _0x286954[_0xf62b('0x45')]['id'];}return db[_0xf62b('0x38')][_0xf62b('0x43')]({'where':{'id':_0x286954[_0xf62b('0x3e')]['id']}})[_0xf62b('0x21')](handleEntityNotFound(_0x429eb6,null))[_0xf62b('0x21')](saveUpdates(_0x286954['body'],null))['then'](respondWithResult(_0x429eb6,null))[_0xf62b('0x3c')](handleError(_0x429eb6,null));};exports[_0xf62b('0x22')]=function(_0x9dee2,_0x303ed5){return db[_0xf62b('0x38')][_0xf62b('0x43')]({'where':{'id':_0x9dee2[_0xf62b('0x3e')]['id']}})[_0xf62b('0x21')](handleEntityNotFound(_0x303ed5,null))[_0xf62b('0x21')](removeEntity(_0x303ed5,null))['catch'](handleError(_0x303ed5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b6feabb..07faf9a 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 _0xc87a=['moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xa61590,_0x32cebe){var _0x4b721a=function(_0x504800){while(--_0x504800){_0xa61590['push'](_0xa61590['shift']());}};_0x4b721a(++_0x32cebe);}(_0xc87a,0x12c));var _0xac87=function(_0x31e9d6,_0x379b29){_0x31e9d6=_0x31e9d6-0x0;var _0xbb8a1a=_0xc87a[_0x31e9d6];return _0xbb8a1a;};'use strict';var _=require(_0xac87('0x0'));var util=require(_0xac87('0x1'));var logger=require(_0xac87('0x2'))(_0xac87('0x3'));var moment=require(_0xac87('0x4'));var BPromise=require(_0xac87('0x5'));var rp=require(_0xac87('0x6'));var fs=require('fs');var path=require(_0xac87('0x7'));var rimraf=require('rimraf');var config=require(_0xac87('0x8'));var attributes=require(_0xac87('0x9'));module[_0xac87('0xa')]=function(_0xcfa4b8,_0x568ece){return _0xcfa4b8[_0xac87('0xb')](_0xac87('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xac87('0xd'),'fields':[_0xac87('0xe'),_0xac87('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ae=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','idField','FieldId','lodash'];(function(_0x2a1465,_0x8bf785){var _0x128933=function(_0x4f2a1f){while(--_0x4f2a1f){_0x2a1465['push'](_0x2a1465['shift']());}};_0x128933(++_0x8bf785);}(_0xd8ae,0xed));var _0xed8a=function(_0x45df47,_0x2f3d5e){_0x45df47=_0x45df47-0x0;var _0x3be963=_0xd8ae[_0x45df47];return _0x3be963;};'use strict';var _=require(_0xed8a('0x0'));var util=require(_0xed8a('0x1'));var logger=require(_0xed8a('0x2'))(_0xed8a('0x3'));var moment=require('moment');var BPromise=require(_0xed8a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed8a('0x5'));var rimraf=require(_0xed8a('0x6'));var config=require(_0xed8a('0x7'));var attributes=require(_0xed8a('0x8'));module[_0xed8a('0x9')]=function(_0x38c0a0,_0x380698){return _0x38c0a0[_0xed8a('0xa')]('SugarcrmField',attributes,{'tableName':_0xed8a('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xed8a('0xc'),_0xed8a('0xd')],'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 48d8b77..28ce0cb 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 _0x4618=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x2ff022,_0x183a9c){var _0x1cbaa5=function(_0x342bd9){while(--_0x342bd9){_0x2ff022['push'](_0x2ff022['shift']());}};_0x1cbaa5(++_0x183a9c);}(_0x4618,0xb8));var _0x8461=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x4618[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require(_0x8461('0x0'));var moment=require(_0x8461('0x1'));var BPromise=require(_0x8461('0x2'));var rs=require(_0x8461('0x3'));var fs=require('fs');var Redis=require(_0x8461('0x4'));var db=require(_0x8461('0x5'))['db'];var utils=require(_0x8461('0x6'));var logger=require(_0x8461('0x7'))('rpc');var config=require(_0x8461('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8461('0x9')][_0x8461('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x547d9f,_0x368d07,_0x2587c7){return new BPromise(function(_0x5258fc,_0x291ec2){return client[_0x8461('0xb')](_0x547d9f,_0x2587c7)[_0x8461('0xc')](function(_0x33a70e){logger[_0x8461('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x368d07,_0x8461('0xe'));logger[_0x8461('0xf')](_0x8461('0x10'),_0x368d07,_0x8461('0xe'),JSON[_0x8461('0x11')](_0x33a70e));if(_0x33a70e['error']){if(_0x33a70e[_0x8461('0x12')][_0x8461('0x13')]===0x1f4){logger[_0x8461('0x12')](_0x8461('0x14'),_0x368d07,_0x33a70e[_0x8461('0x12')][_0x8461('0x15')]);return _0x291ec2(_0x33a70e[_0x8461('0x12')]['message']);}logger[_0x8461('0x12')](_0x8461('0x14'),_0x368d07,_0x33a70e[_0x8461('0x12')][_0x8461('0x15')]);return _0x5258fc(_0x33a70e[_0x8461('0x12')]['message']);}else{logger['info'](_0x8461('0x14'),_0x368d07,'request\x20sent');_0x5258fc(_0x33a70e['result']['message']);}})['catch'](function(_0x285dd9){logger[_0x8461('0x12')](_0x8461('0x14'),_0x368d07,_0x285dd9);_0x291ec2(_0x285dd9);});});} \ No newline at end of file +var _0x89a9=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x4dc204,_0x12bfa3){var _0x35400b=function(_0x55a5ca){while(--_0x55a5ca){_0x4dc204['push'](_0x4dc204['shift']());}};_0x35400b(++_0x12bfa3);}(_0x89a9,0xd8));var _0x989a=function(_0x3de06d,_0x40b157){_0x3de06d=_0x3de06d-0x0;var _0x4ddd39=_0x89a9[_0x3de06d];return _0x4ddd39;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x989a('0x0'));var BPromise=require(_0x989a('0x1'));var rs=require(_0x989a('0x2'));var fs=require('fs');var Redis=require(_0x989a('0x3'));var db=require(_0x989a('0x4'))['db'];var utils=require(_0x989a('0x5'));var logger=require(_0x989a('0x6'))('rpc');var config=require(_0x989a('0x7'));var jayson=require(_0x989a('0x8'));var client=jayson[_0x989a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x245161,_0xc2484c,_0x19b869){return new BPromise(function(_0x383e89,_0x520f39){return client[_0x989a('0xa')](_0x245161,_0x19b869)[_0x989a('0xb')](function(_0x3c8023){logger[_0x989a('0xc')](_0x989a('0xd'),_0xc2484c,_0x989a('0xe'));logger[_0x989a('0xf')](_0x989a('0x10'),_0xc2484c,_0x989a('0xe'),JSON[_0x989a('0x11')](_0x3c8023));if(_0x3c8023['error']){if(_0x3c8023['error'][_0x989a('0x12')]===0x1f4){logger[_0x989a('0x13')](_0x989a('0xd'),_0xc2484c,_0x3c8023[_0x989a('0x13')][_0x989a('0x14')]);return _0x520f39(_0x3c8023[_0x989a('0x13')][_0x989a('0x14')]);}logger[_0x989a('0x13')](_0x989a('0xd'),_0xc2484c,_0x3c8023['error']['message']);return _0x383e89(_0x3c8023[_0x989a('0x13')][_0x989a('0x14')]);}else{logger[_0x989a('0xc')](_0x989a('0xd'),_0xc2484c,_0x989a('0xe'));_0x383e89(_0x3c8023[_0x989a('0x15')][_0x989a('0x14')]);}})[_0x989a('0x16')](function(_0xb7f80c){logger[_0x989a('0x13')]('SugarcrmField,\x20%s,\x20%s',_0xc2484c,_0xb7f80c);_0x520f39(_0xb7f80c);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f7fde98..9dbc083 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 _0x0207=['../../config/environment','./intVtigerAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','put','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29ba88,_0x2bd7d4){var _0x35887c=function(_0x34c2ce){while(--_0x34c2ce){_0x29ba88['push'](_0x29ba88['shift']());}};_0x35887c(++_0x2bd7d4);}(_0x0207,0x162));var _0x7020=function(_0x18fb4c,_0x578f22){_0x18fb4c=_0x18fb4c-0x0;var _0x4a75b3=_0x0207[_0x18fb4c];return _0x4a75b3;};'use strict';var multer=require('multer');var util=require(_0x7020('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7020('0x1'));var router=express[_0x7020('0x2')]();var fs_extra=require(_0x7020('0x3'));var auth=require(_0x7020('0x4'));var interaction=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var controller=require(_0x7020('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7020('0x8')]);router[_0x7020('0x9')](_0x7020('0xa'),auth[_0x7020('0xb')](),controller[_0x7020('0xc')]);router[_0x7020('0x9')](_0x7020('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7020('0x9')](_0x7020('0xe'),auth[_0x7020('0xb')](),controller['getFields']);router[_0x7020('0xf')]('/',auth[_0x7020('0xb')](),controller['create']);router[_0x7020('0xf')](_0x7020('0xd'),auth[_0x7020('0xb')](),controller['addConfiguration']);router[_0x7020('0x10')](_0x7020('0xa'),auth[_0x7020('0xb')](),controller[_0x7020('0x11')]);router[_0x7020('0x12')]('/:id',auth[_0x7020('0xb')](),controller['destroy']);module[_0x7020('0x13')]=router; \ No newline at end of file +var _0x1016=['../../config/environment','./intVtigerAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3c312f,_0x4eabac){var _0x595252=function(_0x28c3dc){while(--_0x28c3dc){_0x3c312f['push'](_0x3c312f['shift']());}};_0x595252(++_0x4eabac);}(_0x1016,0x124));var _0x6101=function(_0x41d578,_0x2dbaf4){_0x41d578=_0x41d578-0x0;var _0x57e9fc=_0x1016[_0x41d578];return _0x57e9fc;};'use strict';var multer=require(_0x6101('0x0'));var util=require(_0x6101('0x1'));var path=require(_0x6101('0x2'));var timeout=require('connect-timeout');var express=require(_0x6101('0x3'));var router=express[_0x6101('0x4')]();var fs_extra=require(_0x6101('0x5'));var auth=require(_0x6101('0x6'));var interaction=require(_0x6101('0x7'));var config=require(_0x6101('0x8'));var controller=require(_0x6101('0x9'));router[_0x6101('0xa')]('/',auth['isAuthenticated'](),controller[_0x6101('0xb')]);router[_0x6101('0xa')]('/:id',auth[_0x6101('0xc')](),controller[_0x6101('0xd')]);router[_0x6101('0xa')](_0x6101('0xe'),auth[_0x6101('0xc')](),controller['getConfigurations']);router[_0x6101('0xa')](_0x6101('0xf'),auth[_0x6101('0xc')](),controller[_0x6101('0x10')]);router[_0x6101('0x11')]('/',auth['isAuthenticated'](),controller[_0x6101('0x12')]);router[_0x6101('0x11')](_0x6101('0xe'),auth[_0x6101('0xc')](),controller[_0x6101('0x13')]);router[_0x6101('0x14')](_0x6101('0x15'),auth[_0x6101('0xc')](),controller['update']);router[_0x6101('0x16')](_0x6101('0x15'),auth[_0x6101('0xc')](),controller[_0x6101('0x17')]);module[_0x6101('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 6db129d..c7ab67b 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 _0x9568=['sequelize','exports','STRING'];(function(_0x56cb5d,_0x3948fc){var _0x5b268b=function(_0x568d24){while(--_0x568d24){_0x56cb5d['push'](_0x56cb5d['shift']());}};_0x5b268b(++_0x3948fc);}(_0x9568,0x153));var _0x8956=function(_0xa64da9,_0x549be6){_0xa64da9=_0xa64da9-0x0;var _0x2e5f3a=_0x9568[_0xa64da9];return _0x2e5f3a;};'use strict';var Sequelize=require(_0x8956('0x0'));module[_0x8956('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8956('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8956('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x8956('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8956('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x74e9=['STRING','HelpDesk','exports'];(function(_0x5c29e0,_0xf52f6e){var _0x90cd14=function(_0x187413){while(--_0x187413){_0x5c29e0['push'](_0x5c29e0['shift']());}};_0x90cd14(++_0xf52f6e);}(_0x74e9,0x11c));var _0x974e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74e9[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x974e('0x0')]={'name':{'type':Sequelize[_0x974e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x974e('0x1')]},'username':{'type':Sequelize[_0x974e('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x974e('0x2')},'remoteUri':{'type':Sequelize[_0x974e('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x974e('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x974e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 88a3aa5..327a069 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 _0x14e7=['create','body','params','destroy','findOne','VtigerConfiguration','pick','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','result','token','sessionName','owner','remove','includes','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','send','Wrong\x20credentials','rimraf','request-promise','moment','mustache','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','update','then','error','stack','index','map','VtigerAccount','rawAttributes','type','model','name','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','keys','intersection','include','find'];(function(_0x535250,_0x1127f7){var _0x16ffe8=function(_0x3062dc){while(--_0x3062dc){_0x535250['push'](_0x535250['shift']());}};_0x16ffe8(++_0x1127f7);}(_0x14e7,0x184));var _0x714e=function(_0x2e5ce3,_0x1dfb51){_0x2e5ce3=_0x2e5ce3-0x0;var _0x1f11db=_0x14e7[_0x2e5ce3];return _0x1f11db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x714e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x714e('0x1'));var moment=require(_0x714e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x714e('0x3'));var util=require('util');var path=require('path');var sox=require(_0x714e('0x4'));var csv=require('to-csv');var ejs=require(_0x714e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x714e('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x714e('0x7'));var deskjs=require(_0x714e('0x8'));var toCsv=require(_0x714e('0x9'));var querystring=require(_0x714e('0xa'));var Papa=require(_0x714e('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x714e('0xc'));var as=require(_0x714e('0xd'));var hardwareService=require(_0x714e('0xe'));var logger=require(_0x714e('0xf'))(_0x714e('0x10'));var utils=require(_0x714e('0x11'));var config=require(_0x714e('0x12'));var licenseUtil=require(_0x714e('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x714e('0x14'));function respondWithStatusCode(_0x5d198a,_0x1c361c){_0x1c361c=_0x1c361c||0xcc;return function(_0x345181){if(_0x345181){return _0x5d198a[_0x714e('0x15')](_0x1c361c);}return _0x5d198a[_0x714e('0x16')](_0x1c361c)[_0x714e('0x17')]();};}function respondWithResult(_0x3663f2,_0x201da9){_0x201da9=_0x201da9||0xc8;return function(_0x572c1e){if(_0x572c1e){return _0x3663f2[_0x714e('0x16')](_0x201da9)[_0x714e('0x18')](_0x572c1e);}};}function respondWithFilteredResult(_0x3dded7,_0x18af40){return function(_0x457580){if(_0x457580){var _0x4fb1cb=typeof _0x18af40[_0x714e('0x19')]==='undefined'&&typeof _0x18af40[_0x714e('0x1a')]===_0x714e('0x1b');var _0x38434e=_0x457580[_0x714e('0x1c')];var _0x3417d0=_0x4fb1cb?0x0:_0x18af40[_0x714e('0x19')];var _0x347fba=_0x4fb1cb?_0x457580[_0x714e('0x1c')]:_0x18af40[_0x714e('0x19')]+_0x18af40[_0x714e('0x1a')];var _0x5e3f3f;if(_0x347fba>=_0x38434e){_0x347fba=_0x38434e;_0x5e3f3f=0xc8;}else{_0x5e3f3f=0xce;}_0x3dded7['status'](_0x5e3f3f);return _0x3dded7[_0x714e('0x1d')]('Content-Range',_0x3417d0+'-'+_0x347fba+'/'+_0x38434e)[_0x714e('0x18')](_0x457580);}return null;};}function patchUpdates(_0x1e592){return function(_0x5928c4){try{jsonpatch['apply'](_0x5928c4,_0x1e592,!![]);}catch(_0x24245d){return BPromise[_0x714e('0x1e')](_0x24245d);}return _0x5928c4['save']();};}function saveUpdates(_0x2729ad,_0x4b393e){return function(_0x5b8ce9){if(_0x5b8ce9){return _0x5b8ce9[_0x714e('0x1f')](_0x2729ad)[_0x714e('0x20')](function(_0x3786a3){return _0x3786a3;});}return null;};}function removeEntity(_0x30d59d,_0x36856f){return function(_0x5b10e3){if(_0x5b10e3){return _0x5b10e3['destroy']()['then'](function(){_0x30d59d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aff74,_0x219b9f){return function(_0x1ad075){if(!_0x1ad075){_0x2aff74[_0x714e('0x15')](0x194);}return _0x1ad075;};}function handleError(_0x263f5e,_0x3cc19a){_0x3cc19a=_0x3cc19a||0x1f4;return function(_0x110969){logger[_0x714e('0x21')](_0x110969[_0x714e('0x22')]);if(_0x110969['name']){delete _0x110969['name'];}_0x263f5e[_0x714e('0x16')](_0x3cc19a)['send'](_0x110969);};}exports[_0x714e('0x23')]=function(_0x5ef63d,_0x32723e){var _0x1460df={},_0x9df416={},_0x4ee779={'count':0x0,'rows':[]};var _0x5b7667=_[_0x714e('0x24')](db[_0x714e('0x25')][_0x714e('0x26')],function(_0xea9eca){return{'name':_0xea9eca['fieldName'],'type':_0xea9eca[_0x714e('0x27')]['key']};});_0x9df416[_0x714e('0x28')]=_[_0x714e('0x24')](_0x5b7667,_0x714e('0x29'));_0x9df416[_0x714e('0x2a')]=_['keys'](_0x5ef63d[_0x714e('0x2a')]);_0x9df416[_0x714e('0x2b')]=_['intersection'](_0x9df416['model'],_0x9df416[_0x714e('0x2a')]);_0x1460df['attributes']=_['intersection'](_0x9df416['model'],qs['fields'](_0x5ef63d[_0x714e('0x2a')][_0x714e('0x2c')]));_0x1460df[_0x714e('0x2d')]=_0x1460df[_0x714e('0x2d')][_0x714e('0x2e')]?_0x1460df[_0x714e('0x2d')]:_0x9df416[_0x714e('0x28')];if(!_0x5ef63d[_0x714e('0x2a')][_0x714e('0x2f')](_0x714e('0x30'))){_0x1460df['limit']=qs[_0x714e('0x1a')](_0x5ef63d['query'][_0x714e('0x1a')]);_0x1460df[_0x714e('0x19')]=qs[_0x714e('0x19')](_0x5ef63d[_0x714e('0x2a')][_0x714e('0x19')]);}_0x1460df[_0x714e('0x31')]=qs[_0x714e('0x32')](_0x5ef63d[_0x714e('0x2a')][_0x714e('0x32')]);_0x1460df[_0x714e('0x33')]=qs[_0x714e('0x2b')](_['pick'](_0x5ef63d[_0x714e('0x2a')],_0x9df416[_0x714e('0x2b')]),_0x5b7667);if(_0x5ef63d[_0x714e('0x2a')][_0x714e('0x34')]){_0x1460df[_0x714e('0x33')]=_[_0x714e('0x35')](_0x1460df[_0x714e('0x33')],{'$or':_[_0x714e('0x24')](_0x5b7667,function(_0x4f8d90){if(_0x4f8d90[_0x714e('0x27')]!=='VIRTUAL'){var _0x129c22={};_0x129c22[_0x4f8d90['name']]={'$like':'%'+_0x5ef63d['query']['filter']+'%'};return _0x129c22;}})});}_0x1460df=_['merge']({},_0x1460df,_0x5ef63d[_0x714e('0x36')]);var _0x5cc387={'where':_0x1460df[_0x714e('0x33')]};return db[_0x714e('0x25')][_0x714e('0x1c')](_0x5cc387)['then'](function(_0x373f1b){_0x4ee779[_0x714e('0x1c')]=_0x373f1b;if(_0x5ef63d[_0x714e('0x2a')][_0x714e('0x37')]){_0x1460df['include']=[{'all':!![]}];}return db[_0x714e('0x25')][_0x714e('0x38')](_0x1460df);})[_0x714e('0x20')](function(_0x1746f5){_0x4ee779[_0x714e('0x39')]=_0x1746f5;return _0x4ee779;})[_0x714e('0x20')](respondWithFilteredResult(_0x32723e,_0x1460df))[_0x714e('0x3a')](handleError(_0x32723e,null));};exports[_0x714e('0x3b')]=function(_0x38b7aa,_0x18a8ce){var _0x2df8d5={'raw':![],'where':{'id':_0x38b7aa['params']['id']}},_0x2e85e8={};_0x2e85e8[_0x714e('0x28')]=_[_0x714e('0x3c')](db[_0x714e('0x25')]['rawAttributes']);_0x2e85e8[_0x714e('0x2a')]=_[_0x714e('0x3c')](_0x38b7aa['query']);_0x2e85e8[_0x714e('0x2b')]=_[_0x714e('0x3d')](_0x2e85e8[_0x714e('0x28')],_0x2e85e8[_0x714e('0x2a')]);_0x2df8d5[_0x714e('0x2d')]=_[_0x714e('0x3d')](_0x2e85e8['model'],qs[_0x714e('0x2c')](_0x38b7aa[_0x714e('0x2a')][_0x714e('0x2c')]));_0x2df8d5[_0x714e('0x2d')]=_0x2df8d5[_0x714e('0x2d')][_0x714e('0x2e')]?_0x2df8d5['attributes']:_0x2e85e8[_0x714e('0x28')];if(_0x38b7aa[_0x714e('0x2a')]['includeAll']){_0x2df8d5[_0x714e('0x3e')]=[{'all':!![]}];}_0x2df8d5=_[_0x714e('0x35')]({},_0x2df8d5,_0x38b7aa['options']);return db[_0x714e('0x25')][_0x714e('0x3f')](_0x2df8d5)[_0x714e('0x20')](handleEntityNotFound(_0x18a8ce,null))[_0x714e('0x20')](respondWithResult(_0x18a8ce,null))[_0x714e('0x3a')](handleError(_0x18a8ce,null));};exports[_0x714e('0x40')]=function(_0x2fe27a,_0xfb2a82){return db[_0x714e('0x25')][_0x714e('0x40')](_0x2fe27a['body'],{})[_0x714e('0x20')](respondWithResult(_0xfb2a82,0xc9))[_0x714e('0x3a')](handleError(_0xfb2a82,null));};exports['update']=function(_0x381ecf,_0x9463b1){if(_0x381ecf[_0x714e('0x41')]['id']){delete _0x381ecf[_0x714e('0x41')]['id'];}return db[_0x714e('0x25')][_0x714e('0x3f')]({'where':{'id':_0x381ecf[_0x714e('0x42')]['id']}})['then'](handleEntityNotFound(_0x9463b1,null))['then'](saveUpdates(_0x381ecf[_0x714e('0x41')],null))[_0x714e('0x20')](respondWithResult(_0x9463b1,null))['catch'](handleError(_0x9463b1,null));};exports[_0x714e('0x43')]=function(_0x3c170c,_0x130934){return db[_0x714e('0x25')]['find']({'where':{'id':_0x3c170c[_0x714e('0x42')]['id']}})['then'](handleEntityNotFound(_0x130934,null))[_0x714e('0x20')](removeEntity(_0x130934,null))[_0x714e('0x3a')](handleError(_0x130934,null));};exports['getConfigurations']=function(_0x1f068d,_0x260f42,_0x1e0995){var _0x42e9f5={};var _0xaafb56={};var _0x3c0d72;var _0x17a1e6;return db[_0x714e('0x25')][_0x714e('0x44')]({'where':{'id':_0x1f068d['params']['id']}})[_0x714e('0x20')](handleEntityNotFound(_0x260f42,null))[_0x714e('0x20')](function(_0x52106f){if(_0x52106f){_0x3c0d72=_0x52106f;_0xaafb56[_0x714e('0x28')]=_[_0x714e('0x3c')](db[_0x714e('0x45')][_0x714e('0x26')]);_0xaafb56[_0x714e('0x2a')]=_['keys'](_0x1f068d['query']);_0xaafb56['filters']=_[_0x714e('0x3d')](_0xaafb56[_0x714e('0x28')],_0xaafb56[_0x714e('0x2a')]);_0x42e9f5[_0x714e('0x2d')]=_['intersection'](_0xaafb56[_0x714e('0x28')],qs[_0x714e('0x2c')](_0x1f068d[_0x714e('0x2a')]['fields']));_0x42e9f5[_0x714e('0x2d')]=_0x42e9f5['attributes'][_0x714e('0x2e')]?_0x42e9f5[_0x714e('0x2d')]:_0xaafb56[_0x714e('0x28')];_0x42e9f5['order']=qs[_0x714e('0x32')](_0x1f068d[_0x714e('0x2a')][_0x714e('0x32')]);_0x42e9f5[_0x714e('0x33')]=qs[_0x714e('0x2b')](_[_0x714e('0x46')](_0x1f068d[_0x714e('0x2a')],_0xaafb56[_0x714e('0x2b')]));if(_0x1f068d[_0x714e('0x2a')][_0x714e('0x34')]){_0x42e9f5[_0x714e('0x33')]=_[_0x714e('0x35')](_0x42e9f5[_0x714e('0x33')],{'$or':_[_0x714e('0x24')](_0x42e9f5[_0x714e('0x2d')],function(_0x18782e){var _0x3c65e5={};_0x3c65e5[_0x18782e]={'$like':'%'+_0x1f068d[_0x714e('0x2a')][_0x714e('0x34')]+'%'};return _0x3c65e5;})});}_0x42e9f5=_['merge']({},_0x42e9f5,_0x1f068d['options']);return _0x3c0d72[_0x714e('0x47')](_0x42e9f5);}})[_0x714e('0x20')](function(_0x18c00c){if(_0x18c00c){_0x17a1e6=_0x18c00c[_0x714e('0x2e')];if(!_0x1f068d[_0x714e('0x2a')][_0x714e('0x2f')](_0x714e('0x30'))){_0x42e9f5['limit']=qs[_0x714e('0x1a')](_0x1f068d[_0x714e('0x2a')][_0x714e('0x1a')]);_0x42e9f5[_0x714e('0x19')]=qs['offset'](_0x1f068d[_0x714e('0x2a')][_0x714e('0x19')]);}return _0x3c0d72[_0x714e('0x47')](_0x42e9f5);}})[_0x714e('0x20')](function(_0x12fcec){if(_0x12fcec){return _0x12fcec?{'count':_0x17a1e6,'rows':_0x12fcec}:null;}})[_0x714e('0x20')](respondWithResult(_0x260f42,null))[_0x714e('0x3a')](handleError(_0x260f42,null));};exports[_0x714e('0x48')]=function(_0xaa029a,_0x17a910,_0x40d27){if(_0xaa029a[_0x714e('0x41')]['id']){delete _0xaa029a[_0x714e('0x41')]['id'];}return db['VtigerAccount'][_0x714e('0x44')]({'where':{'id':_0xaa029a[_0x714e('0x42')]['id']}})[_0x714e('0x20')](handleEntityNotFound(_0x17a910,null))['then'](function(_0x348d03){if(_0x348d03){_0xaa029a[_0x714e('0x41')]['AccountId']=_0x348d03['id'];_0xaa029a[_0x714e('0x41')][_0x714e('0x49')]=integrations[_0x714e('0x4a')](_0xaa029a[_0x714e('0x41')][_0x714e('0x4b')],_0xaa029a[_0x714e('0x41')][_0x714e('0x27')]);_0xaa029a['body'][_0x714e('0x4c')]=integrations[_0x714e('0x4d')](_0xaa029a[_0x714e('0x41')]['channel'],_0xaa029a['body']['type']);return db[_0x714e('0x45')][_0x714e('0x40')](_0xaa029a[_0x714e('0x41')],{'include':[{'model':db[_0x714e('0x4e')],'as':_0x714e('0x49')},{'model':db['VtigerField'],'as':_0x714e('0x4c')}]});}return null;})[_0x714e('0x20')](respondWithResult(_0x17a910,null))[_0x714e('0x3a')](handleError(_0x17a910,null));};var md5=require(_0x714e('0x4f'));exports[_0x714e('0x50')]=function(_0x17356b,_0x112be9,_0x1e7c38){var _0xa19b88=null;var _0x92a97e=null;var _0x3dfed8=null;var _0x324aff=null;var _0x258fe4='';return db[_0x714e('0x25')][_0x714e('0x44')]({'where':{'id':_0x17356b['params']['id']},'attributes':['id',_0x714e('0x29'),_0x714e('0x51'),_0x714e('0x52'),_0x714e('0x53'),_0x714e('0x54'),_0x714e('0x55'),'accessKey']})['then'](handleEntityNotFound(_0x112be9,null))[_0x714e('0x20')](function(_0x4b7cd8){if(_0x4b7cd8){_0xa19b88=_0x4b7cd8[_0x714e('0x51')];_0x92a97e=_0x4b7cd8[_0x714e('0x56')];_0x3dfed8=_0x4b7cd8[_0x714e('0x53')];_0x258fe4=_0x4b7cd8[_0x714e('0x54')];var _0x27134f=_0x258fe4['slice'](-0x1);if(_0x27134f==='/'){_0x258fe4=_0x258fe4[_0x714e('0x57')](0x0,_0x258fe4[_0x714e('0x58')](_0x27134f));}_0x324aff=util[_0x714e('0x59')](_0x714e('0x5a'),_0x258fe4);var _0x49d549={'method':_0x714e('0x5b'),'uri':_0x324aff,'qs':{'operation':'getchallenge','username':_0x4b7cd8[_0x714e('0x51')]},'json':!![]};return rp(_0x49d549);}})['then'](function(_0x18fdeb){if(_0x18fdeb[_0x714e('0x5c')]){var _0x304c3e={'method':_0x714e('0x5d'),'uri':_0x324aff,'form':{'operation':'login','username':_0xa19b88,'accessKey':md5(_0x18fdeb[_0x714e('0x5e')][_0x714e('0x5f')]+_0x92a97e)},'json':!![]};return rp(_0x304c3e);}})['then'](function(_0x1421dd){if(_0x1421dd['success']){var _0x3a6758={'method':_0x714e('0x5b'),'uri':_0x324aff,'qs':{'operation':'describe','username':_0xa19b88,'sessionName':_0x1421dd[_0x714e('0x5e')][_0x714e('0x60')],'elementType':_0x3dfed8},'json':!![]};return rp(_0x3a6758);}})['then'](function(_0xfd6538){if(_0xfd6538[_0x714e('0x5c')]){var _0x3c7c61=['autogenerated','reference',_0x714e('0x61')];_[_0x714e('0x62')](_0xfd6538['result'][_0x714e('0x2c')],function(_0x467f9d){return _0x3c7c61[_0x714e('0x63')](_0x467f9d['type'][_0x714e('0x29')]);});_['remove'](_0xfd6538['result'][_0x714e('0x2c')],function(_0xe6a660){return _0xe6a660['editable']===_0x714e('0x64');});return{'count':_0xfd6538[_0x714e('0x5e')][_0x714e('0x2c')]['length'],'rows':_['map'](_0xfd6538[_0x714e('0x5e')][_0x714e('0x2c')],function(_0x5c2144){return{'id':_0x5c2144['name'],'name':_0x5c2144[_0x714e('0x65')],'custom':_['startsWith'](_0x5c2144[_0x714e('0x29')],_0x714e('0x66'))?!![]:![],'options':_0x5c2144['type'][_0x714e('0x29')]===_0x714e('0x67')&&_0x5c2144[_0x714e('0x27')][_0x714e('0x68')][_0x714e('0x2e')]>0x0?_[_0x714e('0x24')](_0x5c2144[_0x714e('0x27')][_0x714e('0x68')],function(_0x3bfb9f){return{'name':_0x3bfb9f[_0x714e('0x65')],'value':_0x3bfb9f[_0x714e('0x69')]};}):[]};})};}})[_0x714e('0x20')](respondWithResult(_0x112be9,null))[_0x714e('0x3a')](function(_0x56eebb){console[_0x714e('0x6a')](_0x714e('0x6b')+_0x56eebb);var _0x1278db=_0x17356b[_0x714e('0x2a')][_0x714e('0x6c')]?0x1f4:_0x56eebb[_0x714e('0x6d')]||0x1f4;logger[_0x714e('0x21')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1278db,JSON[_0x714e('0x6e')](_0x56eebb));delete _0x56eebb[_0x714e('0x29')];if(_0x1278db===0x191){_0x1278db=0x190;}_0x112be9['status'](_0x1278db)[_0x714e('0x6f')](_0x17356b[_0x714e('0x2a')]['test']?{'message':_0x714e('0x70'),'statusCode':_0x56eebb[_0x714e('0x6d')]}:_0x56eebb);});}; \ No newline at end of file +var _0x86cd=['include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','username','success','POST','login','token','describe','result','sessionName','autogenerated','owner','remove','editable','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','index','VtigerAccount','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','merge','options','count','includeAll'];(function(_0xe2a229,_0x102b3f){var _0x12b87b=function(_0x1b0cd2){while(--_0x1b0cd2){_0xe2a229['push'](_0xe2a229['shift']());}};_0x12b87b(++_0x102b3f);}(_0x86cd,0x12e));var _0xd86c=function(_0x5ef161,_0x27d16c){_0x5ef161=_0x5ef161-0x0;var _0x1c6e9e=_0x86cd[_0x5ef161];return _0x1c6e9e;};'use strict';var emlformat=require(_0xd86c('0x0'));var rimraf=require(_0xd86c('0x1'));var zipdir=require(_0xd86c('0x2'));var jsonpatch=require(_0xd86c('0x3'));var rp=require(_0xd86c('0x4'));var moment=require(_0xd86c('0x5'));var BPromise=require(_0xd86c('0x6'));var Mustache=require('mustache');var util=require(_0xd86c('0x7'));var path=require(_0xd86c('0x8'));var sox=require(_0xd86c('0x9'));var csv=require(_0xd86c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd86c('0xb'));var _=require(_0xd86c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd86c('0xd'));var deskjs=require(_0xd86c('0xe'));var toCsv=require(_0xd86c('0xa'));var querystring=require(_0xd86c('0xf'));var Papa=require(_0xd86c('0x10'));var Redis=require('ioredis');var authService=require(_0xd86c('0x11'));var qs=require(_0xd86c('0x12'));var as=require(_0xd86c('0x13'));var hardwareService=require(_0xd86c('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd86c('0x15'));var licenseUtil=require(_0xd86c('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd86c('0x17'));function respondWithStatusCode(_0x372fb4,_0x1eb630){_0x1eb630=_0x1eb630||0xcc;return function(_0x24994e){if(_0x24994e){return _0x372fb4['sendStatus'](_0x1eb630);}return _0x372fb4['status'](_0x1eb630)[_0xd86c('0x18')]();};}function respondWithResult(_0xd4768f,_0x37b5ac){_0x37b5ac=_0x37b5ac||0xc8;return function(_0x4cba0a){if(_0x4cba0a){return _0xd4768f[_0xd86c('0x19')](_0x37b5ac)[_0xd86c('0x1a')](_0x4cba0a);}};}function respondWithFilteredResult(_0x5af7bf,_0x1254da){return function(_0x2404d5){if(_0x2404d5){var _0x494cc7=typeof _0x1254da[_0xd86c('0x1b')]===_0xd86c('0x1c')&&typeof _0x1254da['limit']===_0xd86c('0x1c');var _0x3f77e5=_0x2404d5['count'];var _0x5c05fe=_0x494cc7?0x0:_0x1254da[_0xd86c('0x1b')];var _0x700f5=_0x494cc7?_0x2404d5['count']:_0x1254da[_0xd86c('0x1b')]+_0x1254da[_0xd86c('0x1d')];var _0x2b041e;if(_0x700f5>=_0x3f77e5){_0x700f5=_0x3f77e5;_0x2b041e=0xc8;}else{_0x2b041e=0xce;}_0x5af7bf[_0xd86c('0x19')](_0x2b041e);return _0x5af7bf[_0xd86c('0x1e')](_0xd86c('0x1f'),_0x5c05fe+'-'+_0x700f5+'/'+_0x3f77e5)[_0xd86c('0x1a')](_0x2404d5);}return null;};}function patchUpdates(_0x3142f7){return function(_0x295b6f){try{jsonpatch['apply'](_0x295b6f,_0x3142f7,!![]);}catch(_0x5ebca7){return BPromise[_0xd86c('0x20')](_0x5ebca7);}return _0x295b6f[_0xd86c('0x21')]();};}function saveUpdates(_0x2a1347,_0x5322ab){return function(_0x1fa665){if(_0x1fa665){return _0x1fa665[_0xd86c('0x22')](_0x2a1347)[_0xd86c('0x23')](function(_0x262ea3){return _0x262ea3;});}return null;};}function removeEntity(_0x22dd27,_0x52b85b){return function(_0x230ddf){if(_0x230ddf){return _0x230ddf[_0xd86c('0x24')]()[_0xd86c('0x23')](function(){_0x22dd27[_0xd86c('0x19')](0xcc)[_0xd86c('0x18')]();});}};}function handleEntityNotFound(_0x3a89e6,_0x134cd4){return function(_0x39505d){if(!_0x39505d){_0x3a89e6[_0xd86c('0x25')](0x194);}return _0x39505d;};}function handleError(_0x1aabd5,_0x4b73ed){_0x4b73ed=_0x4b73ed||0x1f4;return function(_0x2bf27d){logger[_0xd86c('0x26')](_0x2bf27d[_0xd86c('0x27')]);if(_0x2bf27d['name']){delete _0x2bf27d['name'];}_0x1aabd5[_0xd86c('0x19')](_0x4b73ed)['send'](_0x2bf27d);};}exports[_0xd86c('0x28')]=function(_0x2a3f91,_0x53801b){var _0x423c3a={},_0x459d74={},_0x3c8a10={'count':0x0,'rows':[]};var _0x2e9546=_['map'](db[_0xd86c('0x29')]['rawAttributes'],function(_0x131a7e){return{'name':_0x131a7e[_0xd86c('0x2a')],'type':_0x131a7e['type'][_0xd86c('0x2b')]};});_0x459d74[_0xd86c('0x2c')]=_[_0xd86c('0x2d')](_0x2e9546,_0xd86c('0x2e'));_0x459d74[_0xd86c('0x2f')]=_[_0xd86c('0x30')](_0x2a3f91[_0xd86c('0x2f')]);_0x459d74[_0xd86c('0x31')]=_[_0xd86c('0x32')](_0x459d74[_0xd86c('0x2c')],_0x459d74[_0xd86c('0x2f')]);_0x423c3a[_0xd86c('0x33')]=_[_0xd86c('0x32')](_0x459d74['model'],qs[_0xd86c('0x34')](_0x2a3f91[_0xd86c('0x2f')]['fields']));_0x423c3a[_0xd86c('0x33')]=_0x423c3a[_0xd86c('0x33')][_0xd86c('0x35')]?_0x423c3a[_0xd86c('0x33')]:_0x459d74[_0xd86c('0x2c')];if(!_0x2a3f91['query'][_0xd86c('0x36')](_0xd86c('0x37'))){_0x423c3a[_0xd86c('0x1d')]=qs[_0xd86c('0x1d')](_0x2a3f91[_0xd86c('0x2f')][_0xd86c('0x1d')]);_0x423c3a[_0xd86c('0x1b')]=qs[_0xd86c('0x1b')](_0x2a3f91['query'][_0xd86c('0x1b')]);}_0x423c3a['order']=qs[_0xd86c('0x38')](_0x2a3f91[_0xd86c('0x2f')][_0xd86c('0x38')]);_0x423c3a[_0xd86c('0x39')]=qs[_0xd86c('0x31')](_['pick'](_0x2a3f91[_0xd86c('0x2f')],_0x459d74[_0xd86c('0x31')]),_0x2e9546);if(_0x2a3f91[_0xd86c('0x2f')][_0xd86c('0x3a')]){_0x423c3a[_0xd86c('0x39')]=_['merge'](_0x423c3a['where'],{'$or':_[_0xd86c('0x2d')](_0x2e9546,function(_0x521600){if(_0x521600[_0xd86c('0x3b')]!=='VIRTUAL'){var _0x332eb7={};_0x332eb7[_0x521600['name']]={'$like':'%'+_0x2a3f91[_0xd86c('0x2f')]['filter']+'%'};return _0x332eb7;}})});}_0x423c3a=_[_0xd86c('0x3c')]({},_0x423c3a,_0x2a3f91[_0xd86c('0x3d')]);var _0x51e5fe={'where':_0x423c3a[_0xd86c('0x39')]};return db[_0xd86c('0x29')][_0xd86c('0x3e')](_0x51e5fe)[_0xd86c('0x23')](function(_0x316101){_0x3c8a10['count']=_0x316101;if(_0x2a3f91[_0xd86c('0x2f')][_0xd86c('0x3f')]){_0x423c3a[_0xd86c('0x40')]=[{'all':!![]}];}return db[_0xd86c('0x29')][_0xd86c('0x41')](_0x423c3a);})[_0xd86c('0x23')](function(_0x3f0ed3){_0x3c8a10[_0xd86c('0x42')]=_0x3f0ed3;return _0x3c8a10;})[_0xd86c('0x23')](respondWithFilteredResult(_0x53801b,_0x423c3a))[_0xd86c('0x43')](handleError(_0x53801b,null));};exports[_0xd86c('0x44')]=function(_0x33724b,_0x464e76){var _0x17ce7e={'raw':![],'where':{'id':_0x33724b[_0xd86c('0x45')]['id']}},_0x248941={};_0x248941['model']=_['keys'](db['VtigerAccount'][_0xd86c('0x46')]);_0x248941[_0xd86c('0x2f')]=_['keys'](_0x33724b[_0xd86c('0x2f')]);_0x248941[_0xd86c('0x31')]=_['intersection'](_0x248941[_0xd86c('0x2c')],_0x248941['query']);_0x17ce7e[_0xd86c('0x33')]=_[_0xd86c('0x32')](_0x248941['model'],qs[_0xd86c('0x34')](_0x33724b[_0xd86c('0x2f')][_0xd86c('0x34')]));_0x17ce7e[_0xd86c('0x33')]=_0x17ce7e[_0xd86c('0x33')][_0xd86c('0x35')]?_0x17ce7e['attributes']:_0x248941['model'];if(_0x33724b['query']['includeAll']){_0x17ce7e[_0xd86c('0x40')]=[{'all':!![]}];}_0x17ce7e=_[_0xd86c('0x3c')]({},_0x17ce7e,_0x33724b[_0xd86c('0x3d')]);return db[_0xd86c('0x29')][_0xd86c('0x47')](_0x17ce7e)[_0xd86c('0x23')](handleEntityNotFound(_0x464e76,null))['then'](respondWithResult(_0x464e76,null))[_0xd86c('0x43')](handleError(_0x464e76,null));};exports[_0xd86c('0x48')]=function(_0x4a8246,_0x3df6a1){return db['VtigerAccount'][_0xd86c('0x48')](_0x4a8246[_0xd86c('0x49')],{})[_0xd86c('0x23')](respondWithResult(_0x3df6a1,0xc9))[_0xd86c('0x43')](handleError(_0x3df6a1,null));};exports[_0xd86c('0x22')]=function(_0x5be329,_0x443dac){if(_0x5be329[_0xd86c('0x49')]['id']){delete _0x5be329[_0xd86c('0x49')]['id'];}return db[_0xd86c('0x29')]['find']({'where':{'id':_0x5be329[_0xd86c('0x45')]['id']}})[_0xd86c('0x23')](handleEntityNotFound(_0x443dac,null))['then'](saveUpdates(_0x5be329[_0xd86c('0x49')],null))[_0xd86c('0x23')](respondWithResult(_0x443dac,null))['catch'](handleError(_0x443dac,null));};exports[_0xd86c('0x24')]=function(_0x27638b,_0x3d6f00){return db['VtigerAccount'][_0xd86c('0x47')]({'where':{'id':_0x27638b['params']['id']}})['then'](handleEntityNotFound(_0x3d6f00,null))[_0xd86c('0x23')](removeEntity(_0x3d6f00,null))[_0xd86c('0x43')](handleError(_0x3d6f00,null));};exports[_0xd86c('0x4a')]=function(_0x3479e7,_0x42bc66,_0x551a4f){var _0x3998d1={};var _0x3acd2c={};var _0x4dd589;var _0x260bfc;return db[_0xd86c('0x29')][_0xd86c('0x4b')]({'where':{'id':_0x3479e7['params']['id']}})[_0xd86c('0x23')](handleEntityNotFound(_0x42bc66,null))['then'](function(_0x481671){if(_0x481671){_0x4dd589=_0x481671;_0x3acd2c[_0xd86c('0x2c')]=_[_0xd86c('0x30')](db[_0xd86c('0x4c')]['rawAttributes']);_0x3acd2c[_0xd86c('0x2f')]=_[_0xd86c('0x30')](_0x3479e7[_0xd86c('0x2f')]);_0x3acd2c[_0xd86c('0x31')]=_[_0xd86c('0x32')](_0x3acd2c['model'],_0x3acd2c['query']);_0x3998d1[_0xd86c('0x33')]=_[_0xd86c('0x32')](_0x3acd2c[_0xd86c('0x2c')],qs[_0xd86c('0x34')](_0x3479e7[_0xd86c('0x2f')][_0xd86c('0x34')]));_0x3998d1[_0xd86c('0x33')]=_0x3998d1['attributes'][_0xd86c('0x35')]?_0x3998d1[_0xd86c('0x33')]:_0x3acd2c[_0xd86c('0x2c')];_0x3998d1[_0xd86c('0x4d')]=qs[_0xd86c('0x38')](_0x3479e7[_0xd86c('0x2f')][_0xd86c('0x38')]);_0x3998d1[_0xd86c('0x39')]=qs['filters'](_['pick'](_0x3479e7[_0xd86c('0x2f')],_0x3acd2c[_0xd86c('0x31')]));if(_0x3479e7[_0xd86c('0x2f')]['filter']){_0x3998d1[_0xd86c('0x39')]=_['merge'](_0x3998d1[_0xd86c('0x39')],{'$or':_['map'](_0x3998d1[_0xd86c('0x33')],function(_0x4f394f){var _0x482baa={};_0x482baa[_0x4f394f]={'$like':'%'+_0x3479e7['query'][_0xd86c('0x3a')]+'%'};return _0x482baa;})});}_0x3998d1=_[_0xd86c('0x3c')]({},_0x3998d1,_0x3479e7[_0xd86c('0x3d')]);return _0x4dd589[_0xd86c('0x4a')](_0x3998d1);}})['then'](function(_0x1fb109){if(_0x1fb109){_0x260bfc=_0x1fb109[_0xd86c('0x35')];if(!_0x3479e7[_0xd86c('0x2f')][_0xd86c('0x36')]('nolimit')){_0x3998d1[_0xd86c('0x1d')]=qs[_0xd86c('0x1d')](_0x3479e7[_0xd86c('0x2f')][_0xd86c('0x1d')]);_0x3998d1['offset']=qs[_0xd86c('0x1b')](_0x3479e7[_0xd86c('0x2f')]['offset']);}return _0x4dd589['getConfigurations'](_0x3998d1);}})[_0xd86c('0x23')](function(_0x11a870){if(_0x11a870){return _0x11a870?{'count':_0x260bfc,'rows':_0x11a870}:null;}})['then'](respondWithResult(_0x42bc66,null))['catch'](handleError(_0x42bc66,null));};exports['addConfiguration']=function(_0x2c40b9,_0xbc285d,_0x391164){if(_0x2c40b9['body']['id']){delete _0x2c40b9['body']['id'];}return db['VtigerAccount'][_0xd86c('0x4b')]({'where':{'id':_0x2c40b9[_0xd86c('0x45')]['id']}})[_0xd86c('0x23')](handleEntityNotFound(_0xbc285d,null))[_0xd86c('0x23')](function(_0x410d4a){if(_0x410d4a){_0x2c40b9[_0xd86c('0x49')][_0xd86c('0x4e')]=_0x410d4a['id'];_0x2c40b9[_0xd86c('0x49')][_0xd86c('0x4f')]=integrations[_0xd86c('0x50')](_0x2c40b9['body'][_0xd86c('0x51')],_0x2c40b9[_0xd86c('0x49')][_0xd86c('0x3b')]);_0x2c40b9[_0xd86c('0x49')][_0xd86c('0x52')]=integrations['getDescriptions'](_0x2c40b9[_0xd86c('0x49')][_0xd86c('0x51')],_0x2c40b9[_0xd86c('0x49')]['type']);return db['VtigerConfiguration'][_0xd86c('0x48')](_0x2c40b9[_0xd86c('0x49')],{'include':[{'model':db['VtigerField'],'as':_0xd86c('0x4f')},{'model':db[_0xd86c('0x53')],'as':_0xd86c('0x52')}]});}return null;})[_0xd86c('0x23')](respondWithResult(_0xbc285d,null))[_0xd86c('0x43')](handleError(_0xbc285d,null));};var md5=require(_0xd86c('0x54'));exports[_0xd86c('0x55')]=function(_0x5375bb,_0x2edbfd,_0xce089d){var _0x45fb23=null;var _0x316af9=null;var _0x33390a=null;var _0xe226bf=null;var _0x139713='';return db[_0xd86c('0x29')][_0xd86c('0x4b')]({'where':{'id':_0x5375bb[_0xd86c('0x45')]['id']},'attributes':['id',_0xd86c('0x2e'),'username',_0xd86c('0x56'),_0xd86c('0x57'),_0xd86c('0x58'),'serverUrl',_0xd86c('0x59')]})[_0xd86c('0x23')](handleEntityNotFound(_0x2edbfd,null))['then'](function(_0xc0b06a){if(_0xc0b06a){_0x45fb23=_0xc0b06a['username'];_0x316af9=_0xc0b06a[_0xd86c('0x59')];_0x33390a=_0xc0b06a['moduleName'];_0x139713=_0xc0b06a[_0xd86c('0x58')];var _0x16e7f2=_0x139713[_0xd86c('0x5a')](-0x1);if(_0x16e7f2==='/'){_0x139713=_0x139713[_0xd86c('0x5b')](0x0,_0x139713[_0xd86c('0x5c')](_0x16e7f2));}_0xe226bf=util[_0xd86c('0x5d')](_0xd86c('0x5e'),_0x139713);var _0x330b01={'method':_0xd86c('0x5f'),'uri':_0xe226bf,'qs':{'operation':_0xd86c('0x60'),'username':_0xc0b06a[_0xd86c('0x61')]},'json':!![]};return rp(_0x330b01);}})[_0xd86c('0x23')](function(_0x2dcf55){if(_0x2dcf55[_0xd86c('0x62')]){var _0x4024c0={'method':_0xd86c('0x63'),'uri':_0xe226bf,'form':{'operation':_0xd86c('0x64'),'username':_0x45fb23,'accessKey':md5(_0x2dcf55['result'][_0xd86c('0x65')]+_0x316af9)},'json':!![]};return rp(_0x4024c0);}})[_0xd86c('0x23')](function(_0x5ee3f6){if(_0x5ee3f6[_0xd86c('0x62')]){var _0x597d11={'method':_0xd86c('0x5f'),'uri':_0xe226bf,'qs':{'operation':_0xd86c('0x66'),'username':_0x45fb23,'sessionName':_0x5ee3f6[_0xd86c('0x67')][_0xd86c('0x68')],'elementType':_0x33390a},'json':!![]};return rp(_0x597d11);}})[_0xd86c('0x23')](function(_0x5cc54a){if(_0x5cc54a['success']){var _0x384bc6=[_0xd86c('0x69'),'reference',_0xd86c('0x6a')];_[_0xd86c('0x6b')](_0x5cc54a[_0xd86c('0x67')]['fields'],function(_0x3d02e5){return _0x384bc6['includes'](_0x3d02e5[_0xd86c('0x3b')][_0xd86c('0x2e')]);});_['remove'](_0x5cc54a['result'][_0xd86c('0x34')],function(_0x434e81){return _0x434e81[_0xd86c('0x6c')]==='false';});return{'count':_0x5cc54a[_0xd86c('0x67')][_0xd86c('0x34')]['length'],'rows':_[_0xd86c('0x2d')](_0x5cc54a[_0xd86c('0x67')][_0xd86c('0x34')],function(_0x2a59a1){return{'id':_0x2a59a1[_0xd86c('0x2e')],'name':_0x2a59a1['label'],'custom':_[_0xd86c('0x6d')](_0x2a59a1['name'],_0xd86c('0x6e'))?!![]:![],'options':_0x2a59a1['type'][_0xd86c('0x2e')]===_0xd86c('0x6f')&&_0x2a59a1[_0xd86c('0x3b')][_0xd86c('0x70')][_0xd86c('0x35')]>0x0?_[_0xd86c('0x2d')](_0x2a59a1[_0xd86c('0x3b')][_0xd86c('0x70')],function(_0x67033){return{'name':_0x67033['label'],'value':_0x67033[_0xd86c('0x71')]};}):[]};})};}})[_0xd86c('0x23')](respondWithResult(_0x2edbfd,null))[_0xd86c('0x43')](function(_0x1c807b){console[_0xd86c('0x72')](_0xd86c('0x73')+_0x1c807b);var _0x237b25=_0x5375bb['query'][_0xd86c('0x74')]?0x1f4:_0x1c807b[_0xd86c('0x75')]||0x1f4;logger['error'](_0xd86c('0x76'),_0xd86c('0x55'),_0x237b25,JSON[_0xd86c('0x77')](_0x1c807b));delete _0x1c807b[_0xd86c('0x2e')];if(_0x237b25===0x191){_0x237b25=0x190;}_0x2edbfd[_0xd86c('0x19')](_0x237b25)[_0xd86c('0x78')](_0x5375bb['query'][_0xd86c('0x74')]?{'message':_0xd86c('0x79'),'statusCode':_0x1c807b[_0xd86c('0x75')]}:_0x1c807b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5837ae5..564001f 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 _0x6111=['exports','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x4eb31b,_0x5eac9d){var _0x14081d=function(_0x1478d5){while(--_0x1478d5){_0x4eb31b['push'](_0x4eb31b['shift']());}};_0x14081d(++_0x5eac9d);}(_0x6111,0x14e));var _0x1611=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6111[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1611('0x0'))('api');var moment=require(_0x1611('0x1'));var BPromise=require(_0x1611('0x2'));var rp=require(_0x1611('0x3'));var fs=require('fs');var path=require(_0x1611('0x4'));var rimraf=require(_0x1611('0x5'));var config=require(_0x1611('0x6'));var attributes=require(_0x1611('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1611('0x8')]=function(_0x30e545,_0x206151){return _0x30e545['define']('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf1b=['define','VtigerAccount','util','api','moment','bluebird','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xa8dc6a,_0x5464d3){var _0x55f176=function(_0x49adab){while(--_0x49adab){_0xa8dc6a['push'](_0xa8dc6a['shift']());}};_0x55f176(++_0x5464d3);}(_0xcf1b,0x1c5));var _0xbcf1=function(_0x3bb2b7,_0x4535d5){_0x3bb2b7=_0x3bb2b7-0x0;var _0x31fc06=_0xcf1b[_0x3bb2b7];return _0x31fc06;};'use strict';var _=require('lodash');var util=require(_0xbcf1('0x0'));var logger=require('../../config/logger')(_0xbcf1('0x1'));var moment=require(_0xbcf1('0x2'));var BPromise=require(_0xbcf1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcf1('0x4'));var rimraf=require(_0xbcf1('0x5'));var config=require('../../config/environment');var attributes=require(_0xbcf1('0x6'));var integrations=require(_0xbcf1('0x7'));module[_0xbcf1('0x8')]=function(_0x1d288e,_0x18622d){return _0x1d288e[_0xbcf1('0x9')](_0xbcf1('0xa'),attributes,{'tableName':'int_vtiger_accounts','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 0411224..e0b935c 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 _0xe605=['include','map','model','ShowVtigerAccount','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe605,0x92));var _0x5e60=function(_0x4ba7e5,_0x43f5b9){_0x4ba7e5=_0x4ba7e5-0x0;var _0x5ec175=_0xe605[_0x4ba7e5];return _0x5ec175;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});}exports[_0x5e60('0x16')]=function(_0x5c485d){var _0xdd0a71=this;return new Promise(function(_0x22d718,_0x52cc15){return db[_0x5e60('0x17')][_0x5e60('0x18')]({'raw':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1b')]||null:null,'attributes':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1c')]||null:null,'limit':_0x5c485d['options']?_0x5c485d[_0x5e60('0x19')]['limit']||null:null,'include':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1d')],function(_0x2636f1){return{'model':db[_0x2636f1['model']],'as':_0x2636f1['as'],'attributes':_0x2636f1[_0x5e60('0x1c')],'include':_0x2636f1[_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x2636f1['include'],function(_0x45cb62){return{'model':db[_0x45cb62[_0x5e60('0x1f')]],'as':_0x45cb62['as'],'attributes':_0x45cb62[_0x5e60('0x1c')],'include':_0x45cb62[_0x5e60('0x1d')]?_['map'](_0x45cb62[_0x5e60('0x1d')],function(_0x5712f7){return{'model':db[_0x5712f7[_0x5e60('0x1f')]],'as':_0x5712f7['as'],'attributes':_0x5712f7[_0x5e60('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46691f){logger[_0x5e60('0xe')]('GetVtigerAccount',_0x5c485d);logger[_0x5e60('0x11')](_0x5e60('0x16'),_0x5c485d,JSON['stringify'](_0x46691f));_0x22d718(_0x46691f);})['catch'](function(_0x52f668){logger[_0x5e60('0x12')](_0x5e60('0x16'),_0x52f668[_0x5e60('0x14')],_0x5c485d);_0x52cc15(_0xdd0a71[_0x5e60('0x12')](0x1f4,_0x52f668[_0x5e60('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x168ce6){var _0x405461=this;return new Promise(function(_0x4d4b55,_0x11fc87){return db['VtigerAccount']['find']({'raw':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1a')]===undefined?!![]:![]:!![],'where':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1b')]||null:null,'attributes':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1c')]||null:null,'include':_0x168ce6[_0x5e60('0x19')]?_0x168ce6['options'][_0x5e60('0x1d')]?_['map'](_0x168ce6['options'][_0x5e60('0x1d')],function(_0x317206){return{'model':db[_0x317206['model']],'as':_0x317206['as'],'attributes':_0x317206[_0x5e60('0x1c')],'include':_0x317206['include']?_[_0x5e60('0x1e')](_0x317206[_0x5e60('0x1d')],function(_0x2b2426){return{'model':db[_0x2b2426[_0x5e60('0x1f')]],'as':_0x2b2426['as'],'attributes':_0x2b2426[_0x5e60('0x1c')],'include':_0x2b2426[_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x2b2426[_0x5e60('0x1d')],function(_0x5b3aa5){return{'model':db[_0x5b3aa5[_0x5e60('0x1f')]],'as':_0x5b3aa5['as'],'attributes':_0x5b3aa5[_0x5e60('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e60('0xd')](function(_0x1a3782){logger[_0x5e60('0xe')](_0x5e60('0x20'),_0x168ce6);logger[_0x5e60('0x11')]('ShowVtigerAccount',_0x168ce6,JSON[_0x5e60('0x21')](_0x1a3782));_0x4d4b55(_0x1a3782);})[_0x5e60('0x22')](function(_0x4cba18){logger['error'](_0x5e60('0x20'),_0x4cba18[_0x5e60('0x14')],_0x168ce6);_0x11fc87(_0x405461[_0x5e60('0x12')](0x1f4,_0x4cba18[_0x5e60('0x14')]));});});}; \ No newline at end of file +var _0x065e=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','find','ShowVtigerAccount','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x7c01c8,_0x719e29){var _0xf42fdb=function(_0xe354b4){while(--_0xe354b4){_0x7c01c8['push'](_0x7c01c8['shift']());}};_0xf42fdb(++_0x719e29);}(_0x065e,0x1a7));var _0xe065=function(_0x52b81c,_0x5490aa){_0x52b81c=_0x52b81c-0x0;var _0xa843f1=_0x065e[_0x52b81c];return _0xa843f1;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x189d72,_0x52403a,_0x267122){return new BPromise(function(_0x5afbd4,_0x273e22){return client[_0xe065('0x8')](_0x189d72,_0x267122)[_0xe065('0x9')](function(_0x114497){logger[_0xe065('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0xe065('0xb'));logger[_0xe065('0xc')](_0xe065('0xd'),_0x52403a,_0xe065('0xb'),JSON[_0xe065('0xe')](_0x114497));if(_0x114497[_0xe065('0xf')]){if(_0x114497['error']['code']===0x1f4){logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x273e22(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x5afbd4(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}else{logger[_0xe065('0xa')](_0xe065('0x10'),_0x52403a,_0xe065('0xb'));_0x5afbd4(_0x114497[_0xe065('0x12')][_0xe065('0x11')]);}})['catch'](function(_0x1ba88d){logger[_0xe065('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0x1ba88d);_0x273e22(_0x1ba88d);});});}exports[_0xe065('0x13')]=function(_0x1d2f7a){var _0x397f05=this;return new Promise(function(_0x14c97c,_0x1e7177){return db[_0xe065('0x14')][_0xe065('0x15')]({'raw':_0x1d2f7a['options']?_0x1d2f7a[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')]['where']||null:null,'attributes':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a['options'][_0xe065('0x17')]||null:null,'limit':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x18')]||null:null,'include':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1d2f7a[_0xe065('0x16')]['include'],function(_0x7208af){return{'model':db[_0x7208af[_0xe065('0x1b')]],'as':_0x7208af['as'],'attributes':_0x7208af[_0xe065('0x17')],'include':_0x7208af[_0xe065('0x19')]?_['map'](_0x7208af['include'],function(_0x164965){return{'model':db[_0x164965['model']],'as':_0x164965['as'],'attributes':_0x164965[_0xe065('0x17')],'include':_0x164965[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x164965[_0xe065('0x19')],function(_0x418731){return{'model':db[_0x418731[_0xe065('0x1b')]],'as':_0x418731['as'],'attributes':_0x418731[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x52cd9c){logger['info'](_0xe065('0x13'),_0x1d2f7a);logger[_0xe065('0xc')](_0xe065('0x13'),_0x1d2f7a,JSON[_0xe065('0xe')](_0x52cd9c));_0x14c97c(_0x52cd9c);})['catch'](function(_0x23f573){logger['error']('GetVtigerAccount',_0x23f573[_0xe065('0x11')],_0x1d2f7a);_0x1e7177(_0x397f05[_0xe065('0xf')](0x1f4,_0x23f573[_0xe065('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x883747){var _0x59b915=this;return new Promise(function(_0x12679d,_0x46db7e){return db[_0xe065('0x14')][_0xe065('0x1c')]({'raw':_0x883747['options']?_0x883747[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x883747[_0xe065('0x16')]?_0x883747[_0xe065('0x16')]['where']||null:null,'attributes':_0x883747[_0xe065('0x16')]?_0x883747['options'][_0xe065('0x17')]||null:null,'include':_0x883747['options']?_0x883747[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x883747[_0xe065('0x16')]['include'],function(_0x1fe1dc){return{'model':db[_0x1fe1dc[_0xe065('0x1b')]],'as':_0x1fe1dc['as'],'attributes':_0x1fe1dc[_0xe065('0x17')],'include':_0x1fe1dc[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1fe1dc[_0xe065('0x19')],function(_0x4b822a){return{'model':db[_0x4b822a[_0xe065('0x1b')]],'as':_0x4b822a['as'],'attributes':_0x4b822a[_0xe065('0x17')],'include':_0x4b822a['include']?_[_0xe065('0x1a')](_0x4b822a[_0xe065('0x19')],function(_0x5afc23){return{'model':db[_0x5afc23[_0xe065('0x1b')]],'as':_0x5afc23['as'],'attributes':_0x5afc23[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x35135f){logger['info'](_0xe065('0x1d'),_0x883747);logger['debug'](_0xe065('0x1d'),_0x883747,JSON[_0xe065('0xe')](_0x35135f));_0x12679d(_0x35135f);})[_0xe065('0x1e')](function(_0xcceb12){logger[_0xe065('0xf')](_0xe065('0x1d'),_0xcceb12['message'],_0x883747);_0x46db7e(_0x59b915[_0xe065('0xf')](0x1f4,_0xcceb12[_0xe065('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a1b7a1d..0a676fb 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 _0x62ce=['./intVtigerConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x62ce,0x92));var _0xe62c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x62ce[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xe62c('0x0'));var util=require(_0xe62c('0x1'));var path=require(_0xe62c('0x2'));var timeout=require(_0xe62c('0x3'));var express=require('express');var router=express[_0xe62c('0x4')]();var fs_extra=require(_0xe62c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe62c('0x6'));var config=require(_0xe62c('0x7'));var controller=require(_0xe62c('0x8'));router[_0xe62c('0x9')]('/',auth[_0xe62c('0xa')](),controller['index']);router['get'](_0xe62c('0xb'),auth[_0xe62c('0xa')](),controller['show']);router[_0xe62c('0x9')](_0xe62c('0xc'),auth[_0xe62c('0xa')](),controller[_0xe62c('0xd')]);router[_0xe62c('0x9')](_0xe62c('0xe'),auth[_0xe62c('0xa')](),controller[_0xe62c('0xf')]);router['get'](_0xe62c('0x10'),auth[_0xe62c('0xa')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xe62c('0x11')]);router[_0xe62c('0x12')](_0xe62c('0xb'),auth[_0xe62c('0xa')](),controller[_0xe62c('0x13')]);router[_0xe62c('0x14')](_0xe62c('0xb'),auth[_0xe62c('0xa')](),controller[_0xe62c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x006b=['destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','create','put'];(function(_0x20d65f,_0x40bdd1){var _0x5b4bb8=function(_0x18770e){while(--_0x18770e){_0x20d65f['push'](_0x20d65f['shift']());}};_0x5b4bb8(++_0x40bdd1);}(_0x006b,0x169));var _0xb006=function(_0xe9c2a8,_0x4bdfc5){_0xe9c2a8=_0xe9c2a8-0x0;var _0x1e4eb1=_0x006b[_0xe9c2a8];return _0x1e4eb1;};'use strict';var multer=require(_0xb006('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb006('0x1'));var express=require(_0xb006('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb006('0x3'));var interaction=require(_0xb006('0x4'));var config=require(_0xb006('0x5'));var controller=require(_0xb006('0x6'));router[_0xb006('0x7')]('/',auth[_0xb006('0x8')](),controller[_0xb006('0x9')]);router[_0xb006('0x7')](_0xb006('0xa'),auth[_0xb006('0x8')](),controller['show']);router[_0xb006('0x7')](_0xb006('0xb'),auth['isAuthenticated'](),controller[_0xb006('0xc')]);router[_0xb006('0x7')]('/:id/subjects',auth[_0xb006('0x8')](),controller[_0xb006('0xd')]);router[_0xb006('0x7')](_0xb006('0xe'),auth[_0xb006('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0xb006('0x8')](),controller[_0xb006('0xf')]);router[_0xb006('0x10')]('/:id',auth[_0xb006('0x8')](),controller['update']);router['delete'](_0xb006('0xa'),auth['isAuthenticated'](),controller[_0xb006('0x11')]);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 0866472..43265ad 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 _0x09aa=['sequelize','exports','STRING'];(function(_0x111436,_0x6410f6){var _0x3f2559=function(_0x291b8c){while(--_0x291b8c){_0x111436['push'](_0x111436['shift']());}};_0x3f2559(++_0x6410f6);}(_0x09aa,0x13e));var _0xa09a=function(_0x1c75a4,_0x316603){_0x1c75a4=_0x1c75a4-0x0;var _0x3fed51=_0x09aa[_0x1c75a4];return _0x3fed51;};'use strict';var Sequelize=require(_0xa09a('0x0'));module[_0xa09a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa09a('0x2')]}}; \ No newline at end of file +var _0xf3b3=['sequelize','STRING'];(function(_0x4219e2,_0x4c2521){var _0x2e7f08=function(_0x25204f){while(--_0x25204f){_0x4219e2['push'](_0x4219e2['shift']());}};_0x2e7f08(++_0x4c2521);}(_0xf3b3,0xc8));var _0x3f3b=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xf3b3[_0x37a79c];return _0x561d89;};'use strict';var Sequelize=require(_0x3f3b('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f3b('0x1')]},'description':{'type':Sequelize[_0x3f3b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c402598..3df85fd 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 _0xbfef=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','params','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xbfef,0x1df));var _0xfbfe=function(_0x35fd8b,_0x35cd43){_0x35fd8b=_0x35fd8b-0x0;var _0x2808da=_0xbfef[_0x35fd8b];return _0x2808da;};'use strict';var emlformat=require(_0xfbfe('0x0'));var rimraf=require(_0xfbfe('0x1'));var zipdir=require(_0xfbfe('0x2'));var jsonpatch=require(_0xfbfe('0x3'));var rp=require(_0xfbfe('0x4'));var moment=require(_0xfbfe('0x5'));var BPromise=require(_0xfbfe('0x6'));var Mustache=require(_0xfbfe('0x7'));var util=require(_0xfbfe('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfbfe('0x9'));var ejs=require(_0xfbfe('0xa'));var fs=require('fs');var fs_extra=require(_0xfbfe('0xb'));var _=require(_0xfbfe('0xc'));var squel=require('squel');var crypto=require(_0xfbfe('0xd'));var jsforce=require(_0xfbfe('0xe'));var deskjs=require(_0xfbfe('0xf'));var toCsv=require(_0xfbfe('0x9'));var querystring=require(_0xfbfe('0x10'));var Papa=require(_0xfbfe('0x11'));var Redis=require(_0xfbfe('0x12'));var authService=require(_0xfbfe('0x13'));var qs=require(_0xfbfe('0x14'));var as=require(_0xfbfe('0x15'));var hardwareService=require(_0xfbfe('0x16'));var logger=require(_0xfbfe('0x17'))(_0xfbfe('0x18'));var utils=require(_0xfbfe('0x19'));var config=require(_0xfbfe('0x1a'));var licenseUtil=require(_0xfbfe('0x1b'));var db=require(_0xfbfe('0x1c'))['db'];function respondWithStatusCode(_0x2ae2c8,_0x2c2d93){_0x2c2d93=_0x2c2d93||0xcc;return function(_0x32f841){if(_0x32f841){return _0x2ae2c8['sendStatus'](_0x2c2d93);}return _0x2ae2c8['status'](_0x2c2d93)[_0xfbfe('0x1d')]();};}function respondWithResult(_0x517e10,_0x4b3ec2){_0x4b3ec2=_0x4b3ec2||0xc8;return function(_0xa03c30){if(_0xa03c30){return _0x517e10[_0xfbfe('0x1e')](_0x4b3ec2)[_0xfbfe('0x1f')](_0xa03c30);}};}function respondWithFilteredResult(_0x749281,_0x3c4222){return function(_0x540c71){if(_0x540c71){var _0x8d2a5d=typeof _0x3c4222[_0xfbfe('0x20')]===_0xfbfe('0x21')&&typeof _0x3c4222['limit']===_0xfbfe('0x21');var _0x278c51=_0x540c71[_0xfbfe('0x22')];var _0x48a7e0=_0x8d2a5d?0x0:_0x3c4222[_0xfbfe('0x20')];var _0x429204=_0x8d2a5d?_0x540c71[_0xfbfe('0x22')]:_0x3c4222[_0xfbfe('0x20')]+_0x3c4222[_0xfbfe('0x23')];var _0x32d058;if(_0x429204>=_0x278c51){_0x429204=_0x278c51;_0x32d058=0xc8;}else{_0x32d058=0xce;}_0x749281[_0xfbfe('0x1e')](_0x32d058);return _0x749281[_0xfbfe('0x24')](_0xfbfe('0x25'),_0x48a7e0+'-'+_0x429204+'/'+_0x278c51)[_0xfbfe('0x1f')](_0x540c71);}return null;};}function patchUpdates(_0x52a38e){return function(_0x421127){try{jsonpatch[_0xfbfe('0x26')](_0x421127,_0x52a38e,!![]);}catch(_0x34576a){return BPromise[_0xfbfe('0x27')](_0x34576a);}return _0x421127['save']();};}function saveUpdates(_0x574ae4,_0x1de349){return function(_0x10abae){if(_0x10abae){return _0x10abae[_0xfbfe('0x28')](_0x574ae4)[_0xfbfe('0x29')](function(_0x3c0d38){return _0x3c0d38;});}return null;};}function removeEntity(_0x1132a0,_0x6d31e2){return function(_0x3a21bd){if(_0x3a21bd){return _0x3a21bd['destroy']()[_0xfbfe('0x29')](function(){_0x1132a0['status'](0xcc)[_0xfbfe('0x1d')]();});}};}function handleEntityNotFound(_0x44c888,_0x3ca6e2){return function(_0x4459c3){if(!_0x4459c3){_0x44c888[_0xfbfe('0x2a')](0x194);}return _0x4459c3;};}function handleError(_0x3332d4,_0x14e52a){_0x14e52a=_0x14e52a||0x1f4;return function(_0x1d9ee6){logger[_0xfbfe('0x2b')](_0x1d9ee6[_0xfbfe('0x2c')]);if(_0x1d9ee6[_0xfbfe('0x2d')]){delete _0x1d9ee6[_0xfbfe('0x2d')];}_0x3332d4['status'](_0x14e52a)['send'](_0x1d9ee6);};}exports[_0xfbfe('0x2e')]=function(_0x3e34da,_0x295f83){var _0x2fcf22={},_0x514e88={},_0x577623={'count':0x0,'rows':[]};var _0x29dc3c=_[_0xfbfe('0x2f')](db[_0xfbfe('0x30')][_0xfbfe('0x31')],function(_0x2fbc9d){return{'name':_0x2fbc9d[_0xfbfe('0x32')],'type':_0x2fbc9d[_0xfbfe('0x33')][_0xfbfe('0x34')]};});_0x514e88[_0xfbfe('0x35')]=_['map'](_0x29dc3c,_0xfbfe('0x2d'));_0x514e88[_0xfbfe('0x36')]=_[_0xfbfe('0x37')](_0x3e34da[_0xfbfe('0x36')]);_0x514e88['filters']=_[_0xfbfe('0x38')](_0x514e88[_0xfbfe('0x35')],_0x514e88['query']);_0x2fcf22[_0xfbfe('0x39')]=_['intersection'](_0x514e88[_0xfbfe('0x35')],qs[_0xfbfe('0x3a')](_0x3e34da[_0xfbfe('0x36')][_0xfbfe('0x3a')]));_0x2fcf22[_0xfbfe('0x39')]=_0x2fcf22['attributes'][_0xfbfe('0x3b')]?_0x2fcf22[_0xfbfe('0x39')]:_0x514e88[_0xfbfe('0x35')];if(!_0x3e34da[_0xfbfe('0x36')][_0xfbfe('0x3c')](_0xfbfe('0x3d'))){_0x2fcf22['limit']=qs['limit'](_0x3e34da[_0xfbfe('0x36')][_0xfbfe('0x23')]);_0x2fcf22[_0xfbfe('0x20')]=qs[_0xfbfe('0x20')](_0x3e34da[_0xfbfe('0x36')][_0xfbfe('0x20')]);}_0x2fcf22[_0xfbfe('0x3e')]=qs[_0xfbfe('0x3f')](_0x3e34da[_0xfbfe('0x36')][_0xfbfe('0x3f')]);_0x2fcf22['where']=qs[_0xfbfe('0x40')](_[_0xfbfe('0x41')](_0x3e34da[_0xfbfe('0x36')],_0x514e88[_0xfbfe('0x40')]),_0x29dc3c);if(_0x3e34da['query'][_0xfbfe('0x42')]){_0x2fcf22[_0xfbfe('0x43')]=_[_0xfbfe('0x44')](_0x2fcf22[_0xfbfe('0x43')],{'$or':_[_0xfbfe('0x2f')](_0x29dc3c,function(_0x315591){if(_0x315591[_0xfbfe('0x33')]!==_0xfbfe('0x45')){var _0x5af51a={};_0x5af51a[_0x315591[_0xfbfe('0x2d')]]={'$like':'%'+_0x3e34da['query']['filter']+'%'};return _0x5af51a;}})});}_0x2fcf22=_[_0xfbfe('0x44')]({},_0x2fcf22,_0x3e34da[_0xfbfe('0x46')]);var _0x30d334={'where':_0x2fcf22[_0xfbfe('0x43')]};return db[_0xfbfe('0x30')]['count'](_0x30d334)[_0xfbfe('0x29')](function(_0x2b2503){_0x577623['count']=_0x2b2503;if(_0x3e34da[_0xfbfe('0x36')]['includeAll']){_0x2fcf22[_0xfbfe('0x47')]=[{'all':!![]}];}return db[_0xfbfe('0x30')][_0xfbfe('0x48')](_0x2fcf22);})['then'](function(_0x3ba912){_0x577623[_0xfbfe('0x49')]=_0x3ba912;return _0x577623;})[_0xfbfe('0x29')](respondWithFilteredResult(_0x295f83,_0x2fcf22))[_0xfbfe('0x4a')](handleError(_0x295f83,null));};exports[_0xfbfe('0x4b')]=function(_0x13df1b,_0x36e981){var _0x3a955e={'raw':![],'where':{'id':_0x13df1b['params']['id']}},_0x6321c7={};_0x6321c7[_0xfbfe('0x35')]=_[_0xfbfe('0x37')](db['VtigerConfiguration'][_0xfbfe('0x31')]);_0x6321c7[_0xfbfe('0x36')]=_[_0xfbfe('0x37')](_0x13df1b['query']);_0x6321c7[_0xfbfe('0x40')]=_[_0xfbfe('0x38')](_0x6321c7[_0xfbfe('0x35')],_0x6321c7[_0xfbfe('0x36')]);_0x3a955e[_0xfbfe('0x39')]=_['intersection'](_0x6321c7[_0xfbfe('0x35')],qs[_0xfbfe('0x3a')](_0x13df1b[_0xfbfe('0x36')][_0xfbfe('0x3a')]));_0x3a955e[_0xfbfe('0x39')]=_0x3a955e[_0xfbfe('0x39')][_0xfbfe('0x3b')]?_0x3a955e[_0xfbfe('0x39')]:_0x6321c7['model'];if(_0x13df1b[_0xfbfe('0x36')]['includeAll']){_0x3a955e[_0xfbfe('0x47')]=[{'all':!![]}];}_0x3a955e=_[_0xfbfe('0x44')]({},_0x3a955e,_0x13df1b[_0xfbfe('0x46')]);return db[_0xfbfe('0x30')][_0xfbfe('0x4c')](_0x3a955e)[_0xfbfe('0x29')](handleEntityNotFound(_0x36e981,null))[_0xfbfe('0x29')](respondWithResult(_0x36e981,null))[_0xfbfe('0x4a')](handleError(_0x36e981,null));};exports[_0xfbfe('0x4d')]=function(_0x37ffce,_0x4efc6c){return db['VtigerConfiguration'][_0xfbfe('0x4d')](_0x37ffce[_0xfbfe('0x4e')],{})[_0xfbfe('0x29')](respondWithResult(_0x4efc6c,0xc9))['catch'](handleError(_0x4efc6c,null));};exports['update']=function(_0x17fe8d,_0x3d2c57){if(_0x17fe8d[_0xfbfe('0x4e')]['id']){delete _0x17fe8d[_0xfbfe('0x4e')]['id'];}return db[_0xfbfe('0x30')][_0xfbfe('0x4c')]({'where':{'id':_0x17fe8d[_0xfbfe('0x4f')]['id']}})[_0xfbfe('0x29')](handleEntityNotFound(_0x3d2c57,null))[_0xfbfe('0x29')](saveUpdates(_0x17fe8d[_0xfbfe('0x4e')],null))[_0xfbfe('0x29')](respondWithResult(_0x3d2c57,null))[_0xfbfe('0x4a')](handleError(_0x3d2c57,null));};exports['destroy']=function(_0x22a7c4,_0x5e91ee){return db[_0xfbfe('0x30')][_0xfbfe('0x4c')]({'where':{'id':_0x22a7c4[_0xfbfe('0x4f')]['id']}})[_0xfbfe('0x29')](handleEntityNotFound(_0x5e91ee,null))[_0xfbfe('0x29')](removeEntity(_0x5e91ee,null))['catch'](handleError(_0x5e91ee,null));};exports['getFields']=function(_0x24fe41,_0x1ff916,_0x4f61d9){var _0x173363={};var _0x8b7fab={};var _0x3897ca;var _0x9d0e1c;return db[_0xfbfe('0x30')][_0xfbfe('0x50')]({'where':{'id':_0x24fe41[_0xfbfe('0x4f')]['id']}})[_0xfbfe('0x29')](handleEntityNotFound(_0x1ff916,null))[_0xfbfe('0x29')](function(_0x5c942e){if(_0x5c942e){_0x3897ca=_0x5c942e;_0x8b7fab[_0xfbfe('0x35')]=_[_0xfbfe('0x37')](db[_0xfbfe('0x51')][_0xfbfe('0x31')]);_0x8b7fab['query']=_['keys'](_0x24fe41[_0xfbfe('0x36')]);_0x8b7fab[_0xfbfe('0x40')]=_[_0xfbfe('0x38')](_0x8b7fab[_0xfbfe('0x35')],_0x8b7fab['query']);_0x173363[_0xfbfe('0x39')]=_[_0xfbfe('0x38')](_0x8b7fab['model'],qs['fields'](_0x24fe41[_0xfbfe('0x36')]['fields']));_0x173363[_0xfbfe('0x39')]=_0x173363[_0xfbfe('0x39')]['length']?_0x173363[_0xfbfe('0x39')]:_0x8b7fab[_0xfbfe('0x35')];_0x173363['order']=qs[_0xfbfe('0x3f')](_0x24fe41[_0xfbfe('0x36')][_0xfbfe('0x3f')]);_0x173363['where']=qs[_0xfbfe('0x40')](_['pick'](_0x24fe41['query'],_0x8b7fab['filters']));if(_0x24fe41[_0xfbfe('0x36')]['filter']){_0x173363['where']=_[_0xfbfe('0x44')](_0x173363['where'],{'$or':_['map'](_0x173363['attributes'],function(_0x23546f){var _0x468b3a={};_0x468b3a[_0x23546f]={'$like':'%'+_0x24fe41[_0xfbfe('0x36')][_0xfbfe('0x42')]+'%'};return _0x468b3a;})});}_0x173363=_[_0xfbfe('0x44')]({},_0x173363,_0x24fe41[_0xfbfe('0x46')]);return _0x3897ca['getFields'](_0x173363);}})['then'](function(_0x16da3e){if(_0x16da3e){_0x9d0e1c=_0x16da3e[_0xfbfe('0x3b')];if(!_0x24fe41[_0xfbfe('0x36')][_0xfbfe('0x3c')](_0xfbfe('0x3d'))){_0x173363[_0xfbfe('0x23')]=qs[_0xfbfe('0x23')](_0x24fe41[_0xfbfe('0x36')][_0xfbfe('0x23')]);_0x173363['offset']=qs[_0xfbfe('0x20')](_0x24fe41[_0xfbfe('0x36')][_0xfbfe('0x20')]);}return _0x3897ca[_0xfbfe('0x52')](_0x173363);}})[_0xfbfe('0x29')](function(_0x16c43d){if(_0x16c43d){return _0x16c43d?{'count':_0x9d0e1c,'rows':_0x16c43d}:null;}})[_0xfbfe('0x29')](respondWithResult(_0x1ff916,null))[_0xfbfe('0x4a')](handleError(_0x1ff916,null));};exports[_0xfbfe('0x53')]=function(_0x26ff4e,_0x402a02,_0x6d3e42){var _0x4933f4={};var _0x51f9fa={};var _0x2def84;var _0x4ea599;return db[_0xfbfe('0x30')]['findOne']({'where':{'id':_0x26ff4e['params']['id']}})[_0xfbfe('0x29')](handleEntityNotFound(_0x402a02,null))[_0xfbfe('0x29')](function(_0x8ea6e8){if(_0x8ea6e8){_0x2def84=_0x8ea6e8;_0x51f9fa[_0xfbfe('0x35')]=_['keys'](db[_0xfbfe('0x51')][_0xfbfe('0x31')]);_0x51f9fa[_0xfbfe('0x36')]=_[_0xfbfe('0x37')](_0x26ff4e[_0xfbfe('0x36')]);_0x51f9fa[_0xfbfe('0x40')]=_[_0xfbfe('0x38')](_0x51f9fa['model'],_0x51f9fa[_0xfbfe('0x36')]);_0x4933f4[_0xfbfe('0x39')]=_[_0xfbfe('0x38')](_0x51f9fa[_0xfbfe('0x35')],qs[_0xfbfe('0x3a')](_0x26ff4e[_0xfbfe('0x36')]['fields']));_0x4933f4['attributes']=_0x4933f4[_0xfbfe('0x39')]['length']?_0x4933f4[_0xfbfe('0x39')]:_0x51f9fa[_0xfbfe('0x35')];_0x4933f4[_0xfbfe('0x3e')]=qs[_0xfbfe('0x3f')](_0x26ff4e[_0xfbfe('0x36')]['sort']);_0x4933f4[_0xfbfe('0x43')]=qs['filters'](_[_0xfbfe('0x41')](_0x26ff4e[_0xfbfe('0x36')],_0x51f9fa[_0xfbfe('0x40')]));if(_0x26ff4e[_0xfbfe('0x36')][_0xfbfe('0x42')]){_0x4933f4[_0xfbfe('0x43')]=_[_0xfbfe('0x44')](_0x4933f4['where'],{'$or':_[_0xfbfe('0x2f')](_0x4933f4[_0xfbfe('0x39')],function(_0x11fb07){var _0x13f40a={};_0x13f40a[_0x11fb07]={'$like':'%'+_0x26ff4e[_0xfbfe('0x36')]['filter']+'%'};return _0x13f40a;})});}_0x4933f4=_[_0xfbfe('0x44')]({},_0x4933f4,_0x26ff4e[_0xfbfe('0x46')]);return _0x2def84[_0xfbfe('0x53')](_0x4933f4);}})[_0xfbfe('0x29')](function(_0x1d369e){if(_0x1d369e){_0x4ea599=_0x1d369e[_0xfbfe('0x3b')];if(!_0x26ff4e['query'][_0xfbfe('0x3c')](_0xfbfe('0x3d'))){_0x4933f4['limit']=qs[_0xfbfe('0x23')](_0x26ff4e[_0xfbfe('0x36')][_0xfbfe('0x23')]);_0x4933f4['offset']=qs['offset'](_0x26ff4e[_0xfbfe('0x36')][_0xfbfe('0x20')]);}return _0x2def84[_0xfbfe('0x53')](_0x4933f4);}})[_0xfbfe('0x29')](function(_0x163e89){if(_0x163e89){return _0x163e89?{'count':_0x4ea599,'rows':_0x163e89}:null;}})['then'](respondWithResult(_0x402a02,null))[_0xfbfe('0x4a')](handleError(_0x402a02,null));};exports['getDescriptions']=function(_0x1bf337,_0x49a2de,_0x3020e3){var _0x41388a={};var _0xa46287={};var _0xf1d2e5;var _0x19aa53;return db[_0xfbfe('0x30')]['findOne']({'where':{'id':_0x1bf337[_0xfbfe('0x4f')]['id']}})[_0xfbfe('0x29')](handleEntityNotFound(_0x49a2de,null))['then'](function(_0x41044e){if(_0x41044e){_0xf1d2e5=_0x41044e;_0xa46287[_0xfbfe('0x35')]=_[_0xfbfe('0x37')](db['VtigerField'][_0xfbfe('0x31')]);_0xa46287[_0xfbfe('0x36')]=_[_0xfbfe('0x37')](_0x1bf337[_0xfbfe('0x36')]);_0xa46287[_0xfbfe('0x40')]=_['intersection'](_0xa46287[_0xfbfe('0x35')],_0xa46287[_0xfbfe('0x36')]);_0x41388a[_0xfbfe('0x39')]=_[_0xfbfe('0x38')](_0xa46287['model'],qs[_0xfbfe('0x3a')](_0x1bf337[_0xfbfe('0x36')][_0xfbfe('0x3a')]));_0x41388a[_0xfbfe('0x39')]=_0x41388a['attributes']['length']?_0x41388a[_0xfbfe('0x39')]:_0xa46287[_0xfbfe('0x35')];_0x41388a[_0xfbfe('0x3e')]=qs['sort'](_0x1bf337['query']['sort']);_0x41388a[_0xfbfe('0x43')]=qs['filters'](_[_0xfbfe('0x41')](_0x1bf337[_0xfbfe('0x36')],_0xa46287[_0xfbfe('0x40')]));if(_0x1bf337[_0xfbfe('0x36')][_0xfbfe('0x42')]){_0x41388a['where']=_[_0xfbfe('0x44')](_0x41388a[_0xfbfe('0x43')],{'$or':_[_0xfbfe('0x2f')](_0x41388a[_0xfbfe('0x39')],function(_0x547420){var _0x15d9ab={};_0x15d9ab[_0x547420]={'$like':'%'+_0x1bf337[_0xfbfe('0x36')][_0xfbfe('0x42')]+'%'};return _0x15d9ab;})});}_0x41388a=_[_0xfbfe('0x44')]({},_0x41388a,_0x1bf337['options']);return _0xf1d2e5[_0xfbfe('0x54')](_0x41388a);}})[_0xfbfe('0x29')](function(_0x3a31b2){if(_0x3a31b2){_0x19aa53=_0x3a31b2[_0xfbfe('0x3b')];if(!_0x1bf337[_0xfbfe('0x36')][_0xfbfe('0x3c')](_0xfbfe('0x3d'))){_0x41388a[_0xfbfe('0x23')]=qs[_0xfbfe('0x23')](_0x1bf337[_0xfbfe('0x36')][_0xfbfe('0x23')]);_0x41388a[_0xfbfe('0x20')]=qs['offset'](_0x1bf337[_0xfbfe('0x36')][_0xfbfe('0x20')]);}return _0xf1d2e5[_0xfbfe('0x54')](_0x41388a);}})[_0xfbfe('0x29')](function(_0x5bc10d){if(_0x5bc10d){return _0x5bc10d?{'count':_0x19aa53,'rows':_0x5bc10d}:null;}})['then'](respondWithResult(_0x49a2de,null))['catch'](handleError(_0x49a2de,null));}; \ No newline at end of file +var _0x6a72=['stack','name','send','index','map','VtigerConfiguration','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','filter','where','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','update','getFields','findOne','VtigerField','sort','pick','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6a72,0x118));var _0x26a7=function(_0x587439,_0x153c32){_0x587439=_0x587439-0x0;var _0x138c81=_0x6a72[_0x587439];return _0x138c81;};'use strict';var emlformat=require(_0x26a7('0x0'));var rimraf=require(_0x26a7('0x1'));var zipdir=require(_0x26a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26a7('0x3'));var moment=require('moment');var BPromise=require(_0x26a7('0x4'));var Mustache=require(_0x26a7('0x5'));var util=require(_0x26a7('0x6'));var path=require(_0x26a7('0x7'));var sox=require(_0x26a7('0x8'));var csv=require(_0x26a7('0x9'));var ejs=require(_0x26a7('0xa'));var fs=require('fs');var fs_extra=require(_0x26a7('0xb'));var _=require('lodash');var squel=require(_0x26a7('0xc'));var crypto=require(_0x26a7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x26a7('0xe'));var toCsv=require(_0x26a7('0x9'));var querystring=require(_0x26a7('0xf'));var Papa=require(_0x26a7('0x10'));var Redis=require('ioredis');var authService=require(_0x26a7('0x11'));var qs=require(_0x26a7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x26a7('0x13'))(_0x26a7('0x14'));var utils=require(_0x26a7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x26a7('0x16'));var db=require(_0x26a7('0x17'))['db'];function respondWithStatusCode(_0xb9a91c,_0x122047){_0x122047=_0x122047||0xcc;return function(_0x193766){if(_0x193766){return _0xb9a91c['sendStatus'](_0x122047);}return _0xb9a91c[_0x26a7('0x18')](_0x122047)['end']();};}function respondWithResult(_0x1fc466,_0x1c457d){_0x1c457d=_0x1c457d||0xc8;return function(_0x445afc){if(_0x445afc){return _0x1fc466[_0x26a7('0x18')](_0x1c457d)[_0x26a7('0x19')](_0x445afc);}};}function respondWithFilteredResult(_0x4470d6,_0x1aa11a){return function(_0x399795){if(_0x399795){var _0x14ed58=typeof _0x1aa11a[_0x26a7('0x1a')]===_0x26a7('0x1b')&&typeof _0x1aa11a[_0x26a7('0x1c')]===_0x26a7('0x1b');var _0x4ab69c=_0x399795[_0x26a7('0x1d')];var _0x22eb67=_0x14ed58?0x0:_0x1aa11a[_0x26a7('0x1a')];var _0x36515e=_0x14ed58?_0x399795[_0x26a7('0x1d')]:_0x1aa11a[_0x26a7('0x1a')]+_0x1aa11a[_0x26a7('0x1c')];var _0x29fb55;if(_0x36515e>=_0x4ab69c){_0x36515e=_0x4ab69c;_0x29fb55=0xc8;}else{_0x29fb55=0xce;}_0x4470d6['status'](_0x29fb55);return _0x4470d6['set'](_0x26a7('0x1e'),_0x22eb67+'-'+_0x36515e+'/'+_0x4ab69c)[_0x26a7('0x19')](_0x399795);}return null;};}function patchUpdates(_0x463940){return function(_0x5c64d0){try{jsonpatch[_0x26a7('0x1f')](_0x5c64d0,_0x463940,!![]);}catch(_0x364812){return BPromise[_0x26a7('0x20')](_0x364812);}return _0x5c64d0[_0x26a7('0x21')]();};}function saveUpdates(_0x655fd6,_0x1d1ac8){return function(_0x1ecf21){if(_0x1ecf21){return _0x1ecf21['update'](_0x655fd6)[_0x26a7('0x22')](function(_0xc4ccbb){return _0xc4ccbb;});}return null;};}function removeEntity(_0x22916c,_0x499795){return function(_0x423205){if(_0x423205){return _0x423205['destroy']()[_0x26a7('0x22')](function(){_0x22916c[_0x26a7('0x18')](0xcc)[_0x26a7('0x23')]();});}};}function handleEntityNotFound(_0x2ed12c,_0x440f83){return function(_0x109104){if(!_0x109104){_0x2ed12c['sendStatus'](0x194);}return _0x109104;};}function handleError(_0x629726,_0x167e7e){_0x167e7e=_0x167e7e||0x1f4;return function(_0x111285){logger['error'](_0x111285[_0x26a7('0x24')]);if(_0x111285['name']){delete _0x111285[_0x26a7('0x25')];}_0x629726[_0x26a7('0x18')](_0x167e7e)[_0x26a7('0x26')](_0x111285);};}exports[_0x26a7('0x27')]=function(_0x21733e,_0x2b9180){var _0x3591dc={},_0xbd9c83={},_0x5162d9={'count':0x0,'rows':[]};var _0x1107cb=_[_0x26a7('0x28')](db[_0x26a7('0x29')][_0x26a7('0x2a')],function(_0xfc472a){return{'name':_0xfc472a['fieldName'],'type':_0xfc472a['type'][_0x26a7('0x2b')]};});_0xbd9c83['model']=_[_0x26a7('0x28')](_0x1107cb,_0x26a7('0x25'));_0xbd9c83[_0x26a7('0x2c')]=_[_0x26a7('0x2d')](_0x21733e[_0x26a7('0x2c')]);_0xbd9c83[_0x26a7('0x2e')]=_[_0x26a7('0x2f')](_0xbd9c83['model'],_0xbd9c83['query']);_0x3591dc[_0x26a7('0x30')]=_[_0x26a7('0x2f')](_0xbd9c83[_0x26a7('0x31')],qs[_0x26a7('0x32')](_0x21733e[_0x26a7('0x2c')]['fields']));_0x3591dc[_0x26a7('0x30')]=_0x3591dc[_0x26a7('0x30')][_0x26a7('0x33')]?_0x3591dc['attributes']:_0xbd9c83[_0x26a7('0x31')];if(!_0x21733e[_0x26a7('0x2c')][_0x26a7('0x34')]('nolimit')){_0x3591dc[_0x26a7('0x1c')]=qs[_0x26a7('0x1c')](_0x21733e[_0x26a7('0x2c')][_0x26a7('0x1c')]);_0x3591dc[_0x26a7('0x1a')]=qs[_0x26a7('0x1a')](_0x21733e['query'][_0x26a7('0x1a')]);}_0x3591dc[_0x26a7('0x35')]=qs['sort'](_0x21733e[_0x26a7('0x2c')]['sort']);_0x3591dc['where']=qs[_0x26a7('0x2e')](_['pick'](_0x21733e[_0x26a7('0x2c')],_0xbd9c83[_0x26a7('0x2e')]),_0x1107cb);if(_0x21733e[_0x26a7('0x2c')][_0x26a7('0x36')]){_0x3591dc[_0x26a7('0x37')]=_['merge'](_0x3591dc[_0x26a7('0x37')],{'$or':_[_0x26a7('0x28')](_0x1107cb,function(_0x467b0b){if(_0x467b0b[_0x26a7('0x38')]!==_0x26a7('0x39')){var _0x43f7a7={};_0x43f7a7[_0x467b0b['name']]={'$like':'%'+_0x21733e['query']['filter']+'%'};return _0x43f7a7;}})});}_0x3591dc=_['merge']({},_0x3591dc,_0x21733e['options']);var _0x2067e0={'where':_0x3591dc[_0x26a7('0x37')]};return db[_0x26a7('0x29')][_0x26a7('0x1d')](_0x2067e0)[_0x26a7('0x22')](function(_0x2717d3){_0x5162d9[_0x26a7('0x1d')]=_0x2717d3;if(_0x21733e[_0x26a7('0x2c')][_0x26a7('0x3a')]){_0x3591dc[_0x26a7('0x3b')]=[{'all':!![]}];}return db[_0x26a7('0x29')][_0x26a7('0x3c')](_0x3591dc);})[_0x26a7('0x22')](function(_0x2ee7d4){_0x5162d9[_0x26a7('0x3d')]=_0x2ee7d4;return _0x5162d9;})[_0x26a7('0x22')](respondWithFilteredResult(_0x2b9180,_0x3591dc))[_0x26a7('0x3e')](handleError(_0x2b9180,null));};exports[_0x26a7('0x3f')]=function(_0xb855cb,_0x22fdc4){var _0xaa6117={'raw':![],'where':{'id':_0xb855cb[_0x26a7('0x40')]['id']}},_0x9d864e={};_0x9d864e['model']=_[_0x26a7('0x2d')](db[_0x26a7('0x29')][_0x26a7('0x2a')]);_0x9d864e[_0x26a7('0x2c')]=_[_0x26a7('0x2d')](_0xb855cb[_0x26a7('0x2c')]);_0x9d864e['filters']=_['intersection'](_0x9d864e[_0x26a7('0x31')],_0x9d864e['query']);_0xaa6117[_0x26a7('0x30')]=_['intersection'](_0x9d864e[_0x26a7('0x31')],qs[_0x26a7('0x32')](_0xb855cb[_0x26a7('0x2c')][_0x26a7('0x32')]));_0xaa6117[_0x26a7('0x30')]=_0xaa6117['attributes']['length']?_0xaa6117[_0x26a7('0x30')]:_0x9d864e[_0x26a7('0x31')];if(_0xb855cb[_0x26a7('0x2c')][_0x26a7('0x3a')]){_0xaa6117['include']=[{'all':!![]}];}_0xaa6117=_[_0x26a7('0x41')]({},_0xaa6117,_0xb855cb[_0x26a7('0x42')]);return db[_0x26a7('0x29')][_0x26a7('0x43')](_0xaa6117)[_0x26a7('0x22')](handleEntityNotFound(_0x22fdc4,null))[_0x26a7('0x22')](respondWithResult(_0x22fdc4,null))[_0x26a7('0x3e')](handleError(_0x22fdc4,null));};exports[_0x26a7('0x44')]=function(_0x59b18b,_0xf7289c){return db[_0x26a7('0x29')]['create'](_0x59b18b[_0x26a7('0x45')],{})[_0x26a7('0x22')](respondWithResult(_0xf7289c,0xc9))[_0x26a7('0x3e')](handleError(_0xf7289c,null));};exports[_0x26a7('0x46')]=function(_0x551ad0,_0x5d646d){if(_0x551ad0[_0x26a7('0x45')]['id']){delete _0x551ad0['body']['id'];}return db[_0x26a7('0x29')]['find']({'where':{'id':_0x551ad0[_0x26a7('0x40')]['id']}})[_0x26a7('0x22')](handleEntityNotFound(_0x5d646d,null))[_0x26a7('0x22')](saveUpdates(_0x551ad0['body'],null))[_0x26a7('0x22')](respondWithResult(_0x5d646d,null))[_0x26a7('0x3e')](handleError(_0x5d646d,null));};exports['destroy']=function(_0x38a34e,_0x3edb76){return db[_0x26a7('0x29')][_0x26a7('0x43')]({'where':{'id':_0x38a34e[_0x26a7('0x40')]['id']}})[_0x26a7('0x22')](handleEntityNotFound(_0x3edb76,null))[_0x26a7('0x22')](removeEntity(_0x3edb76,null))[_0x26a7('0x3e')](handleError(_0x3edb76,null));};exports[_0x26a7('0x47')]=function(_0x24af84,_0x5611d4,_0x543499){var _0x5ef837={};var _0x454e3f={};var _0x57aecb;var _0x2a064e;return db[_0x26a7('0x29')][_0x26a7('0x48')]({'where':{'id':_0x24af84['params']['id']}})[_0x26a7('0x22')](handleEntityNotFound(_0x5611d4,null))[_0x26a7('0x22')](function(_0x4d7b95){if(_0x4d7b95){_0x57aecb=_0x4d7b95;_0x454e3f['model']=_[_0x26a7('0x2d')](db[_0x26a7('0x49')][_0x26a7('0x2a')]);_0x454e3f[_0x26a7('0x2c')]=_[_0x26a7('0x2d')](_0x24af84[_0x26a7('0x2c')]);_0x454e3f['filters']=_[_0x26a7('0x2f')](_0x454e3f[_0x26a7('0x31')],_0x454e3f[_0x26a7('0x2c')]);_0x5ef837[_0x26a7('0x30')]=_['intersection'](_0x454e3f['model'],qs[_0x26a7('0x32')](_0x24af84[_0x26a7('0x2c')][_0x26a7('0x32')]));_0x5ef837[_0x26a7('0x30')]=_0x5ef837[_0x26a7('0x30')][_0x26a7('0x33')]?_0x5ef837[_0x26a7('0x30')]:_0x454e3f[_0x26a7('0x31')];_0x5ef837[_0x26a7('0x35')]=qs['sort'](_0x24af84[_0x26a7('0x2c')][_0x26a7('0x4a')]);_0x5ef837[_0x26a7('0x37')]=qs[_0x26a7('0x2e')](_[_0x26a7('0x4b')](_0x24af84[_0x26a7('0x2c')],_0x454e3f[_0x26a7('0x2e')]));if(_0x24af84[_0x26a7('0x2c')]['filter']){_0x5ef837[_0x26a7('0x37')]=_[_0x26a7('0x41')](_0x5ef837[_0x26a7('0x37')],{'$or':_[_0x26a7('0x28')](_0x5ef837[_0x26a7('0x30')],function(_0x1adec4){var _0x56f060={};_0x56f060[_0x1adec4]={'$like':'%'+_0x24af84['query'][_0x26a7('0x36')]+'%'};return _0x56f060;})});}_0x5ef837=_[_0x26a7('0x41')]({},_0x5ef837,_0x24af84[_0x26a7('0x42')]);return _0x57aecb[_0x26a7('0x47')](_0x5ef837);}})[_0x26a7('0x22')](function(_0x9f6d9c){if(_0x9f6d9c){_0x2a064e=_0x9f6d9c['length'];if(!_0x24af84[_0x26a7('0x2c')][_0x26a7('0x34')]('nolimit')){_0x5ef837[_0x26a7('0x1c')]=qs['limit'](_0x24af84[_0x26a7('0x2c')][_0x26a7('0x1c')]);_0x5ef837['offset']=qs['offset'](_0x24af84[_0x26a7('0x2c')][_0x26a7('0x1a')]);}return _0x57aecb[_0x26a7('0x47')](_0x5ef837);}})[_0x26a7('0x22')](function(_0x58111b){if(_0x58111b){return _0x58111b?{'count':_0x2a064e,'rows':_0x58111b}:null;}})[_0x26a7('0x22')](respondWithResult(_0x5611d4,null))[_0x26a7('0x3e')](handleError(_0x5611d4,null));};exports[_0x26a7('0x4c')]=function(_0xd02d75,_0xe9e26e,_0x394205){var _0x65e0ca={};var _0x537f85={};var _0x4c3971;var _0x3aa6e4;return db[_0x26a7('0x29')][_0x26a7('0x48')]({'where':{'id':_0xd02d75['params']['id']}})['then'](handleEntityNotFound(_0xe9e26e,null))[_0x26a7('0x22')](function(_0x5ab4f0){if(_0x5ab4f0){_0x4c3971=_0x5ab4f0;_0x537f85[_0x26a7('0x31')]=_['keys'](db[_0x26a7('0x49')][_0x26a7('0x2a')]);_0x537f85['query']=_[_0x26a7('0x2d')](_0xd02d75[_0x26a7('0x2c')]);_0x537f85[_0x26a7('0x2e')]=_[_0x26a7('0x2f')](_0x537f85['model'],_0x537f85[_0x26a7('0x2c')]);_0x65e0ca[_0x26a7('0x30')]=_[_0x26a7('0x2f')](_0x537f85[_0x26a7('0x31')],qs[_0x26a7('0x32')](_0xd02d75[_0x26a7('0x2c')][_0x26a7('0x32')]));_0x65e0ca['attributes']=_0x65e0ca[_0x26a7('0x30')][_0x26a7('0x33')]?_0x65e0ca[_0x26a7('0x30')]:_0x537f85[_0x26a7('0x31')];_0x65e0ca[_0x26a7('0x35')]=qs[_0x26a7('0x4a')](_0xd02d75[_0x26a7('0x2c')][_0x26a7('0x4a')]);_0x65e0ca[_0x26a7('0x37')]=qs[_0x26a7('0x2e')](_['pick'](_0xd02d75['query'],_0x537f85[_0x26a7('0x2e')]));if(_0xd02d75[_0x26a7('0x2c')]['filter']){_0x65e0ca['where']=_[_0x26a7('0x41')](_0x65e0ca[_0x26a7('0x37')],{'$or':_[_0x26a7('0x28')](_0x65e0ca['attributes'],function(_0x418892){var _0x1454a1={};_0x1454a1[_0x418892]={'$like':'%'+_0xd02d75[_0x26a7('0x2c')]['filter']+'%'};return _0x1454a1;})});}_0x65e0ca=_[_0x26a7('0x41')]({},_0x65e0ca,_0xd02d75[_0x26a7('0x42')]);return _0x4c3971['getSubjects'](_0x65e0ca);}})['then'](function(_0x3ede03){if(_0x3ede03){_0x3aa6e4=_0x3ede03[_0x26a7('0x33')];if(!_0xd02d75['query']['hasOwnProperty'](_0x26a7('0x4d'))){_0x65e0ca[_0x26a7('0x1c')]=qs['limit'](_0xd02d75['query'][_0x26a7('0x1c')]);_0x65e0ca[_0x26a7('0x1a')]=qs[_0x26a7('0x1a')](_0xd02d75[_0x26a7('0x2c')]['offset']);}return _0x4c3971['getSubjects'](_0x65e0ca);}})[_0x26a7('0x22')](function(_0x14ce0f){if(_0x14ce0f){return _0x14ce0f?{'count':_0x3aa6e4,'rows':_0x14ce0f}:null;}})['then'](respondWithResult(_0xe9e26e,null))[_0x26a7('0x3e')](handleError(_0xe9e26e,null));};exports[_0x26a7('0x4e')]=function(_0x20bf1b,_0x1985ba,_0x5d2035){var _0x4360bf={};var _0x20baa8={};var _0x443d6d;var _0x4322c0;return db['VtigerConfiguration'][_0x26a7('0x48')]({'where':{'id':_0x20bf1b[_0x26a7('0x40')]['id']}})[_0x26a7('0x22')](handleEntityNotFound(_0x1985ba,null))[_0x26a7('0x22')](function(_0x12de30){if(_0x12de30){_0x443d6d=_0x12de30;_0x20baa8['model']=_['keys'](db[_0x26a7('0x49')][_0x26a7('0x2a')]);_0x20baa8[_0x26a7('0x2c')]=_['keys'](_0x20bf1b[_0x26a7('0x2c')]);_0x20baa8['filters']=_[_0x26a7('0x2f')](_0x20baa8[_0x26a7('0x31')],_0x20baa8['query']);_0x4360bf[_0x26a7('0x30')]=_[_0x26a7('0x2f')](_0x20baa8[_0x26a7('0x31')],qs[_0x26a7('0x32')](_0x20bf1b[_0x26a7('0x2c')][_0x26a7('0x32')]));_0x4360bf['attributes']=_0x4360bf['attributes'][_0x26a7('0x33')]?_0x4360bf[_0x26a7('0x30')]:_0x20baa8[_0x26a7('0x31')];_0x4360bf[_0x26a7('0x35')]=qs[_0x26a7('0x4a')](_0x20bf1b['query'][_0x26a7('0x4a')]);_0x4360bf[_0x26a7('0x37')]=qs[_0x26a7('0x2e')](_[_0x26a7('0x4b')](_0x20bf1b[_0x26a7('0x2c')],_0x20baa8[_0x26a7('0x2e')]));if(_0x20bf1b['query'][_0x26a7('0x36')]){_0x4360bf[_0x26a7('0x37')]=_['merge'](_0x4360bf[_0x26a7('0x37')],{'$or':_[_0x26a7('0x28')](_0x4360bf[_0x26a7('0x30')],function(_0x445d52){var _0x7ea778={};_0x7ea778[_0x445d52]={'$like':'%'+_0x20bf1b['query'][_0x26a7('0x36')]+'%'};return _0x7ea778;})});}_0x4360bf=_[_0x26a7('0x41')]({},_0x4360bf,_0x20bf1b['options']);return _0x443d6d['getDescriptions'](_0x4360bf);}})['then'](function(_0x385413){if(_0x385413){_0x4322c0=_0x385413[_0x26a7('0x33')];if(!_0x20bf1b['query']['hasOwnProperty'](_0x26a7('0x4d'))){_0x4360bf[_0x26a7('0x1c')]=qs[_0x26a7('0x1c')](_0x20bf1b[_0x26a7('0x2c')][_0x26a7('0x1c')]);_0x4360bf[_0x26a7('0x1a')]=qs[_0x26a7('0x1a')](_0x20bf1b['query'][_0x26a7('0x1a')]);}return _0x443d6d[_0x26a7('0x4e')](_0x4360bf);}})[_0x26a7('0x22')](function(_0x27c63b){if(_0x27c63b){return _0x27c63b?{'count':_0x4322c0,'rows':_0x27c63b}:null;}})[_0x26a7('0x22')](respondWithResult(_0x1985ba,null))[_0x26a7('0x3e')](handleError(_0x1985ba,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index a93343c..84931a9 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 _0x4aa8=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0x4aa8,0x87));var _0x84aa=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x4aa8[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x84aa('0x0'));var util=require(_0x84aa('0x1'));var logger=require(_0x84aa('0x2'))('api');var moment=require('moment');var BPromise=require(_0x84aa('0x3'));var rp=require(_0x84aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84aa('0x5'));var config=require('../../config/environment');var attributes=require(_0x84aa('0x6'));module['exports']=function(_0xcfac1f,_0xfea97f){return _0xcfac1f['define'](_0x84aa('0x7'),attributes,{'tableName':_0x84aa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a5c=['../../config/environment','exports','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x58c772,_0x5000bd){var _0x4885f4=function(_0x1d4b72){while(--_0x1d4b72){_0x58c772['push'](_0x58c772['shift']());}};_0x4885f4(++_0x5000bd);}(_0x2a5c,0xee));var _0xc2a5=function(_0x34249d,_0xbd551e){_0x34249d=_0x34249d-0x0;var _0x36ff17=_0x2a5c[_0x34249d];return _0x36ff17;};'use strict';var _=require('lodash');var util=require(_0xc2a5('0x0'));var logger=require(_0xc2a5('0x1'))('api');var moment=require(_0xc2a5('0x2'));var BPromise=require(_0xc2a5('0x3'));var rp=require(_0xc2a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc2a5('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xc2a5('0x6')]=function(_0x5d2f97,_0x3f4ee4){return _0x5d2f97['define'](_0xc2a5('0x7'),attributes,{'tableName':_0xc2a5('0x8'),'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 9bfab95..fe5583f 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 _0xaf54=['info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','then'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xaf54,0x7d));var _0x4af5=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0xaf54[_0x3816c2];return _0x144669;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4af5('0x0'));var BPromise=require(_0x4af5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4af5('0x2'));var db=require(_0x4af5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4af5('0x4'));var config=require('../../config/environment');var jayson=require(_0x4af5('0x5'));var client=jayson['client'][_0x4af5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x298a58,_0x2b551c,_0x53bec3){return new BPromise(function(_0x16a408,_0x13cd9b){return client['request'](_0x298a58,_0x53bec3)[_0x4af5('0x7')](function(_0x48eb59){logger[_0x4af5('0x8')]('VtigerConfiguration,\x20%s,\x20%s',_0x2b551c,_0x4af5('0x9'));logger[_0x4af5('0xa')](_0x4af5('0xb'),_0x2b551c,_0x4af5('0x9'),JSON[_0x4af5('0xc')](_0x48eb59));if(_0x48eb59[_0x4af5('0xd')]){if(_0x48eb59[_0x4af5('0xd')][_0x4af5('0xe')]===0x1f4){logger[_0x4af5('0xd')](_0x4af5('0xf'),_0x2b551c,_0x48eb59[_0x4af5('0xd')][_0x4af5('0x10')]);return _0x13cd9b(_0x48eb59[_0x4af5('0xd')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2b551c,_0x48eb59[_0x4af5('0xd')][_0x4af5('0x10')]);return _0x16a408(_0x48eb59[_0x4af5('0xd')][_0x4af5('0x10')]);}else{logger['info'](_0x4af5('0xf'),_0x2b551c,_0x4af5('0x9'));_0x16a408(_0x48eb59[_0x4af5('0x11')][_0x4af5('0x10')]);}})[_0x4af5('0x12')](function(_0x1de39d){logger[_0x4af5('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x2b551c,_0x1de39d);_0x13cd9b(_0x1de39d);});});} \ No newline at end of file +var _0x7a86=['jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x53ba30,_0x210d1e){var _0x46e47a=function(_0x39a06d){while(--_0x39a06d){_0x53ba30['push'](_0x53ba30['shift']());}};_0x46e47a(++_0x210d1e);}(_0x7a86,0x1ae));var _0x67a8=function(_0x1bf928,_0x3ce8aa){_0x1bf928=_0x1bf928-0x0;var _0x3bf76d=_0x7a86[_0x1bf928];return _0x3bf76d;};'use strict';var _=require(_0x67a8('0x0'));var util=require(_0x67a8('0x1'));var moment=require('moment');var BPromise=require(_0x67a8('0x2'));var rs=require(_0x67a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x67a8('0x4'));var logger=require(_0x67a8('0x5'))('rpc');var config=require(_0x67a8('0x6'));var jayson=require(_0x67a8('0x7'));var client=jayson['client'][_0x67a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43da51,_0x36b767,_0x21fc92){return new BPromise(function(_0x2d2a95,_0x4a7fab){return client[_0x67a8('0x9')](_0x43da51,_0x21fc92)[_0x67a8('0xa')](function(_0x4e40d9){logger[_0x67a8('0xb')](_0x67a8('0xc'),_0x36b767,_0x67a8('0xd'));logger[_0x67a8('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x36b767,_0x67a8('0xd'),JSON[_0x67a8('0xf')](_0x4e40d9));if(_0x4e40d9[_0x67a8('0x10')]){if(_0x4e40d9['error']['code']===0x1f4){logger[_0x67a8('0x10')](_0x67a8('0xc'),_0x36b767,_0x4e40d9['error'][_0x67a8('0x11')]);return _0x4a7fab(_0x4e40d9['error'][_0x67a8('0x11')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x36b767,_0x4e40d9['error']['message']);return _0x2d2a95(_0x4e40d9[_0x67a8('0x10')][_0x67a8('0x11')]);}else{logger[_0x67a8('0xb')](_0x67a8('0xc'),_0x36b767,'request\x20sent');_0x2d2a95(_0x4e40d9[_0x67a8('0x12')][_0x67a8('0x11')]);}})['catch'](function(_0xa73cd8){logger[_0x67a8('0x10')](_0x67a8('0xc'),_0x36b767,_0xa73cd8);_0x4a7fab(_0xa73cd8);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index dc2c3bc..ed1a1f1 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 _0x7385=['show','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7385,0xdf));var _0x5738=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7385[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x5738('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5738('0x1'));var express=require(_0x5738('0x2'));var router=express[_0x5738('0x3')]();var fs_extra=require(_0x5738('0x4'));var auth=require(_0x5738('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5738('0x6'));var controller=require('./intVtigerField.controller');router[_0x5738('0x7')]('/',auth[_0x5738('0x8')](),controller[_0x5738('0x9')]);router[_0x5738('0x7')](_0x5738('0xa'),auth[_0x5738('0x8')](),controller[_0x5738('0xb')]);router[_0x5738('0xc')]('/',auth[_0x5738('0x8')](),controller[_0x5738('0xd')]);router[_0x5738('0xe')](_0x5738('0xa'),auth[_0x5738('0x8')](),controller['update']);router[_0x5738('0xf')](_0x5738('0xa'),auth[_0x5738('0x8')](),controller[_0x5738('0x10')]);module[_0x5738('0x11')]=router; \ No newline at end of file +var _0x6ff5=['update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','post','put','/:id'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x6ff5,0xce));var _0x56ff=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6ff5[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x56ff('0x0'));var util=require(_0x56ff('0x1'));var path=require('path');var timeout=require(_0x56ff('0x2'));var express=require('express');var router=express[_0x56ff('0x3')]();var fs_extra=require(_0x56ff('0x4'));var auth=require(_0x56ff('0x5'));var interaction=require(_0x56ff('0x6'));var config=require(_0x56ff('0x7'));var controller=require(_0x56ff('0x8'));router['get']('/',auth[_0x56ff('0x9')](),controller[_0x56ff('0xa')]);router[_0x56ff('0xb')]('/:id',auth[_0x56ff('0x9')](),controller['show']);router[_0x56ff('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x56ff('0xd')](_0x56ff('0xe'),auth[_0x56ff('0x9')](),controller[_0x56ff('0xf')]);router['delete'](_0x56ff('0xe'),auth[_0x56ff('0x9')](),controller['destroy']);module[_0x56ff('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index b119baa..195dee4 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 _0x2d5a=['exports','ENUM','string','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x57cc7a,_0x1e738d){var _0x5d6159=function(_0xb455d5){while(--_0xb455d5){_0x57cc7a['push'](_0x57cc7a['shift']());}};_0x5d6159(++_0x1e738d);}(_0x2d5a,0x137));var _0xa2d5=function(_0xebc908,_0x579ea3){_0xebc908=_0xebc908-0x0;var _0x4f9bc9=_0x2d5a[_0xebc908];return _0x4f9bc9;};'use strict';var Sequelize=require(_0xa2d5('0x0'));module[_0xa2d5('0x1')]={'type':{'type':Sequelize[_0xa2d5('0x2')](_0xa2d5('0x3'),'variable',_0xa2d5('0x4'),_0xa2d5('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa2d5('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa2d5('0x2')](_0xa2d5('0x3'),'variable',_0xa2d5('0x4'))},'keyContent':{'type':Sequelize[_0xa2d5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa2d5('0x6')]},'customField':{'type':Sequelize[_0xa2d5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa2d5('0x6')]}}; \ No newline at end of file +var _0x50ff=['STRING','ENUM','string','customVariable','BOOLEAN','sequelize','variable','picklist'];(function(_0x37aada,_0x1edce7){var _0x1ebbe0=function(_0x58790c){while(--_0x58790c){_0x37aada['push'](_0x37aada['shift']());}};_0x1ebbe0(++_0x1edce7);}(_0x50ff,0x6d));var _0xf50f=function(_0x477d99,_0x1314ba){_0x477d99=_0x477d99-0x0;var _0x12a5e9=_0x50ff[_0x477d99];return _0x12a5e9;};'use strict';var Sequelize=require(_0xf50f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xf50f('0x1'),'customVariable','keyValue',_0xf50f('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf50f('0x3')]},'key':{'type':Sequelize[_0xf50f('0x3')]},'keyType':{'type':Sequelize[_0xf50f('0x4')](_0xf50f('0x5'),'variable',_0xf50f('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf50f('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf50f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf50f('0x3')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 7cb3307..014e087 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 _0xcc60=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','error','stack','name','index','map','VtigerField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3f35f4,_0x4c581e){var _0x33e445=function(_0x45bfd8){while(--_0x45bfd8){_0x3f35f4['push'](_0x3f35f4['shift']());}};_0x33e445(++_0x4c581e);}(_0xcc60,0xe4));var _0x0cc6=function(_0x5dbbc6,_0x141f04){_0x5dbbc6=_0x5dbbc6-0x0;var _0x38a7fc=_0xcc60[_0x5dbbc6];return _0x38a7fc;};'use strict';var emlformat=require(_0x0cc6('0x0'));var rimraf=require(_0x0cc6('0x1'));var zipdir=require(_0x0cc6('0x2'));var jsonpatch=require(_0x0cc6('0x3'));var rp=require(_0x0cc6('0x4'));var moment=require(_0x0cc6('0x5'));var BPromise=require(_0x0cc6('0x6'));var Mustache=require(_0x0cc6('0x7'));var util=require(_0x0cc6('0x8'));var path=require(_0x0cc6('0x9'));var sox=require(_0x0cc6('0xa'));var csv=require(_0x0cc6('0xb'));var ejs=require(_0x0cc6('0xc'));var fs=require('fs');var fs_extra=require(_0x0cc6('0xd'));var _=require(_0x0cc6('0xe'));var squel=require(_0x0cc6('0xf'));var crypto=require(_0x0cc6('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x0cc6('0x11'));var toCsv=require(_0x0cc6('0xb'));var querystring=require(_0x0cc6('0x12'));var Papa=require(_0x0cc6('0x13'));var Redis=require(_0x0cc6('0x14'));var authService=require(_0x0cc6('0x15'));var qs=require(_0x0cc6('0x16'));var as=require(_0x0cc6('0x17'));var hardwareService=require(_0x0cc6('0x18'));var logger=require(_0x0cc6('0x19'))('api');var utils=require(_0x0cc6('0x1a'));var config=require(_0x0cc6('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cc6('0x1c'))['db'];function respondWithStatusCode(_0x2412a2,_0x1e4718){_0x1e4718=_0x1e4718||0xcc;return function(_0x6bad9d){if(_0x6bad9d){return _0x2412a2[_0x0cc6('0x1d')](_0x1e4718);}return _0x2412a2[_0x0cc6('0x1e')](_0x1e4718)[_0x0cc6('0x1f')]();};}function respondWithResult(_0x4da1a3,_0x24835f){_0x24835f=_0x24835f||0xc8;return function(_0x4f5544){if(_0x4f5544){return _0x4da1a3['status'](_0x24835f)[_0x0cc6('0x20')](_0x4f5544);}};}function respondWithFilteredResult(_0x3870f0,_0x3bac7d){return function(_0x2197e6){if(_0x2197e6){var _0x4aaed9=typeof _0x3bac7d[_0x0cc6('0x21')]==='undefined'&&typeof _0x3bac7d[_0x0cc6('0x22')]===_0x0cc6('0x23');var _0x4dca6f=_0x2197e6[_0x0cc6('0x24')];var _0x320d19=_0x4aaed9?0x0:_0x3bac7d['offset'];var _0x1c3e7c=_0x4aaed9?_0x2197e6['count']:_0x3bac7d[_0x0cc6('0x21')]+_0x3bac7d['limit'];var _0xe13ae6;if(_0x1c3e7c>=_0x4dca6f){_0x1c3e7c=_0x4dca6f;_0xe13ae6=0xc8;}else{_0xe13ae6=0xce;}_0x3870f0[_0x0cc6('0x1e')](_0xe13ae6);return _0x3870f0[_0x0cc6('0x25')]('Content-Range',_0x320d19+'-'+_0x1c3e7c+'/'+_0x4dca6f)[_0x0cc6('0x20')](_0x2197e6);}return null;};}function patchUpdates(_0x49363a){return function(_0x3948a1){try{jsonpatch[_0x0cc6('0x26')](_0x3948a1,_0x49363a,!![]);}catch(_0x458468){return BPromise[_0x0cc6('0x27')](_0x458468);}return _0x3948a1['save']();};}function saveUpdates(_0x54ff3c,_0x42ffcd){return function(_0x590879){if(_0x590879){return _0x590879[_0x0cc6('0x28')](_0x54ff3c)[_0x0cc6('0x29')](function(_0x399636){return _0x399636;});}return null;};}function removeEntity(_0x281493,_0x478974){return function(_0x4bd0bf){if(_0x4bd0bf){return _0x4bd0bf['destroy']()[_0x0cc6('0x29')](function(){_0x281493[_0x0cc6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ea792,_0x137a01){return function(_0x29fb80){if(!_0x29fb80){_0x1ea792['sendStatus'](0x194);}return _0x29fb80;};}function handleError(_0x3a8144,_0x1f6965){_0x1f6965=_0x1f6965||0x1f4;return function(_0xa1f626){logger[_0x0cc6('0x2a')](_0xa1f626[_0x0cc6('0x2b')]);if(_0xa1f626[_0x0cc6('0x2c')]){delete _0xa1f626[_0x0cc6('0x2c')];}_0x3a8144[_0x0cc6('0x1e')](_0x1f6965)['send'](_0xa1f626);};}exports[_0x0cc6('0x2d')]=function(_0x4a433b,_0x26a5e7){var _0x287caf={},_0x1733ea={},_0x1094e1={'count':0x0,'rows':[]};var _0x5809d2=_[_0x0cc6('0x2e')](db[_0x0cc6('0x2f')]['rawAttributes'],function(_0x2b6336){return{'name':_0x2b6336[_0x0cc6('0x30')],'type':_0x2b6336['type'][_0x0cc6('0x31')]};});_0x1733ea[_0x0cc6('0x32')]=_[_0x0cc6('0x2e')](_0x5809d2,_0x0cc6('0x2c'));_0x1733ea[_0x0cc6('0x33')]=_[_0x0cc6('0x34')](_0x4a433b[_0x0cc6('0x33')]);_0x1733ea[_0x0cc6('0x35')]=_[_0x0cc6('0x36')](_0x1733ea['model'],_0x1733ea['query']);_0x287caf[_0x0cc6('0x37')]=_['intersection'](_0x1733ea['model'],qs[_0x0cc6('0x38')](_0x4a433b[_0x0cc6('0x33')][_0x0cc6('0x38')]));_0x287caf['attributes']=_0x287caf['attributes'][_0x0cc6('0x39')]?_0x287caf[_0x0cc6('0x37')]:_0x1733ea[_0x0cc6('0x32')];if(!_0x4a433b[_0x0cc6('0x33')][_0x0cc6('0x3a')](_0x0cc6('0x3b'))){_0x287caf[_0x0cc6('0x22')]=qs[_0x0cc6('0x22')](_0x4a433b[_0x0cc6('0x33')][_0x0cc6('0x22')]);_0x287caf['offset']=qs[_0x0cc6('0x21')](_0x4a433b[_0x0cc6('0x33')][_0x0cc6('0x21')]);}_0x287caf['order']=qs['sort'](_0x4a433b[_0x0cc6('0x33')][_0x0cc6('0x3c')]);_0x287caf[_0x0cc6('0x3d')]=qs[_0x0cc6('0x35')](_[_0x0cc6('0x3e')](_0x4a433b[_0x0cc6('0x33')],_0x1733ea[_0x0cc6('0x35')]),_0x5809d2);if(_0x4a433b[_0x0cc6('0x33')][_0x0cc6('0x3f')]){_0x287caf[_0x0cc6('0x3d')]=_[_0x0cc6('0x40')](_0x287caf['where'],{'$or':_[_0x0cc6('0x2e')](_0x5809d2,function(_0x3d3a21){if(_0x3d3a21['type']!=='VIRTUAL'){var _0x594972={};_0x594972[_0x3d3a21[_0x0cc6('0x2c')]]={'$like':'%'+_0x4a433b[_0x0cc6('0x33')][_0x0cc6('0x3f')]+'%'};return _0x594972;}})});}_0x287caf=_[_0x0cc6('0x40')]({},_0x287caf,_0x4a433b['options']);var _0x3c33dd={'where':_0x287caf[_0x0cc6('0x3d')]};return db[_0x0cc6('0x2f')]['count'](_0x3c33dd)[_0x0cc6('0x29')](function(_0x5c03d3){_0x1094e1[_0x0cc6('0x24')]=_0x5c03d3;if(_0x4a433b[_0x0cc6('0x33')][_0x0cc6('0x41')]){_0x287caf['include']=[{'all':!![]}];}return db[_0x0cc6('0x2f')][_0x0cc6('0x42')](_0x287caf);})['then'](function(_0x5622f5){_0x1094e1[_0x0cc6('0x43')]=_0x5622f5;return _0x1094e1;})[_0x0cc6('0x29')](respondWithFilteredResult(_0x26a5e7,_0x287caf))[_0x0cc6('0x44')](handleError(_0x26a5e7,null));};exports[_0x0cc6('0x45')]=function(_0xf3c462,_0x121d31){var _0x1482c8={'raw':!![],'where':{'id':_0xf3c462[_0x0cc6('0x46')]['id']}},_0x127795={};_0x127795[_0x0cc6('0x32')]=_[_0x0cc6('0x34')](db[_0x0cc6('0x2f')][_0x0cc6('0x47')]);_0x127795[_0x0cc6('0x33')]=_[_0x0cc6('0x34')](_0xf3c462['query']);_0x127795[_0x0cc6('0x35')]=_[_0x0cc6('0x36')](_0x127795[_0x0cc6('0x32')],_0x127795[_0x0cc6('0x33')]);_0x1482c8[_0x0cc6('0x37')]=_[_0x0cc6('0x36')](_0x127795['model'],qs[_0x0cc6('0x38')](_0xf3c462[_0x0cc6('0x33')][_0x0cc6('0x38')]));_0x1482c8['attributes']=_0x1482c8['attributes'][_0x0cc6('0x39')]?_0x1482c8[_0x0cc6('0x37')]:_0x127795[_0x0cc6('0x32')];if(_0xf3c462[_0x0cc6('0x33')][_0x0cc6('0x41')]){_0x1482c8[_0x0cc6('0x48')]=[{'all':!![]}];}_0x1482c8=_[_0x0cc6('0x40')]({},_0x1482c8,_0xf3c462[_0x0cc6('0x49')]);return db[_0x0cc6('0x2f')][_0x0cc6('0x4a')](_0x1482c8)[_0x0cc6('0x29')](handleEntityNotFound(_0x121d31,null))[_0x0cc6('0x29')](respondWithResult(_0x121d31,null))[_0x0cc6('0x44')](handleError(_0x121d31,null));};exports[_0x0cc6('0x4b')]=function(_0x4a3bbd,_0x452341){return db[_0x0cc6('0x2f')][_0x0cc6('0x4b')](_0x4a3bbd[_0x0cc6('0x4c')],{})[_0x0cc6('0x29')](respondWithResult(_0x452341,0xc9))['catch'](handleError(_0x452341,null));};exports[_0x0cc6('0x28')]=function(_0x32902e,_0x2b6a32){if(_0x32902e[_0x0cc6('0x4c')]['id']){delete _0x32902e[_0x0cc6('0x4c')]['id'];}return db[_0x0cc6('0x2f')][_0x0cc6('0x4a')]({'where':{'id':_0x32902e['params']['id']}})[_0x0cc6('0x29')](handleEntityNotFound(_0x2b6a32,null))[_0x0cc6('0x29')](saveUpdates(_0x32902e['body'],null))[_0x0cc6('0x29')](respondWithResult(_0x2b6a32,null))['catch'](handleError(_0x2b6a32,null));};exports[_0x0cc6('0x4d')]=function(_0x3fe527,_0x4a699a){return db[_0x0cc6('0x2f')][_0x0cc6('0x4a')]({'where':{'id':_0x3fe527['params']['id']}})[_0x0cc6('0x29')](handleEntityNotFound(_0x4a699a,null))[_0x0cc6('0x29')](removeEntity(_0x4a699a,null))[_0x0cc6('0x44')](handleError(_0x4a699a,null));}; \ No newline at end of file +var _0x66a4=['name','send','map','VtigerField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','where','merge','type','VIRTUAL','filter','rows','catch','params','includeAll','include','options','find','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x66a4,0x1ca));var _0x466a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x66a4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x466a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x466a('0x1'));var rp=require(_0x466a('0x2'));var moment=require(_0x466a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x466a('0x4'));var util=require(_0x466a('0x5'));var path=require(_0x466a('0x6'));var sox=require(_0x466a('0x7'));var csv=require(_0x466a('0x8'));var ejs=require(_0x466a('0x9'));var fs=require('fs');var fs_extra=require(_0x466a('0xa'));var _=require(_0x466a('0xb'));var squel=require(_0x466a('0xc'));var crypto=require(_0x466a('0xd'));var jsforce=require(_0x466a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x466a('0xf'));var authService=require(_0x466a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x466a('0x11'));var hardwareService=require(_0x466a('0x12'));var logger=require(_0x466a('0x13'))(_0x466a('0x14'));var utils=require(_0x466a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x466a('0x16'))['db'];function respondWithStatusCode(_0x154000,_0x1868e7){_0x1868e7=_0x1868e7||0xcc;return function(_0x597b69){if(_0x597b69){return _0x154000[_0x466a('0x17')](_0x1868e7);}return _0x154000[_0x466a('0x18')](_0x1868e7)[_0x466a('0x19')]();};}function respondWithResult(_0x17b8b2,_0x34e14f){_0x34e14f=_0x34e14f||0xc8;return function(_0x59bf65){if(_0x59bf65){return _0x17b8b2['status'](_0x34e14f)['json'](_0x59bf65);}};}function respondWithFilteredResult(_0x2ec483,_0x216ad6){return function(_0x39ca16){if(_0x39ca16){var _0xddb0ed=typeof _0x216ad6[_0x466a('0x1a')]===_0x466a('0x1b')&&typeof _0x216ad6['limit']==='undefined';var _0x28d137=_0x39ca16[_0x466a('0x1c')];var _0x2f6069=_0xddb0ed?0x0:_0x216ad6[_0x466a('0x1a')];var _0x34213f=_0xddb0ed?_0x39ca16[_0x466a('0x1c')]:_0x216ad6[_0x466a('0x1a')]+_0x216ad6['limit'];var _0xf5abb3;if(_0x34213f>=_0x28d137){_0x34213f=_0x28d137;_0xf5abb3=0xc8;}else{_0xf5abb3=0xce;}_0x2ec483[_0x466a('0x18')](_0xf5abb3);return _0x2ec483[_0x466a('0x1d')](_0x466a('0x1e'),_0x2f6069+'-'+_0x34213f+'/'+_0x28d137)[_0x466a('0x1f')](_0x39ca16);}return null;};}function patchUpdates(_0x260824){return function(_0x2732c4){try{jsonpatch[_0x466a('0x20')](_0x2732c4,_0x260824,!![]);}catch(_0x24edd7){return BPromise[_0x466a('0x21')](_0x24edd7);}return _0x2732c4[_0x466a('0x22')]();};}function saveUpdates(_0x2c0889,_0x2ed625){return function(_0x3dac12){if(_0x3dac12){return _0x3dac12[_0x466a('0x23')](_0x2c0889)['then'](function(_0x2fa1a6){return _0x2fa1a6;});}return null;};}function removeEntity(_0x2eeb9e,_0x1622e0){return function(_0x23a209){if(_0x23a209){return _0x23a209[_0x466a('0x24')]()[_0x466a('0x25')](function(){_0x2eeb9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x418273,_0x46169e){return function(_0x142089){if(!_0x142089){_0x418273['sendStatus'](0x194);}return _0x142089;};}function handleError(_0x4bb368,_0x37cd13){_0x37cd13=_0x37cd13||0x1f4;return function(_0x169f39){logger[_0x466a('0x26')](_0x169f39['stack']);if(_0x169f39[_0x466a('0x27')]){delete _0x169f39[_0x466a('0x27')];}_0x4bb368[_0x466a('0x18')](_0x37cd13)[_0x466a('0x28')](_0x169f39);};}exports['index']=function(_0x47c62c,_0x1c6f5d){var _0x3d7b82={},_0x39bf84={},_0x308aa7={'count':0x0,'rows':[]};var _0x1524a5=_[_0x466a('0x29')](db[_0x466a('0x2a')][_0x466a('0x2b')],function(_0x20bd6c){return{'name':_0x20bd6c[_0x466a('0x2c')],'type':_0x20bd6c['type']['key']};});_0x39bf84[_0x466a('0x2d')]=_[_0x466a('0x29')](_0x1524a5,_0x466a('0x27'));_0x39bf84[_0x466a('0x2e')]=_[_0x466a('0x2f')](_0x47c62c[_0x466a('0x2e')]);_0x39bf84[_0x466a('0x30')]=_[_0x466a('0x31')](_0x39bf84[_0x466a('0x2d')],_0x39bf84[_0x466a('0x2e')]);_0x3d7b82[_0x466a('0x32')]=_[_0x466a('0x31')](_0x39bf84['model'],qs[_0x466a('0x33')](_0x47c62c[_0x466a('0x2e')]['fields']));_0x3d7b82['attributes']=_0x3d7b82[_0x466a('0x32')][_0x466a('0x34')]?_0x3d7b82[_0x466a('0x32')]:_0x39bf84[_0x466a('0x2d')];if(!_0x47c62c['query'][_0x466a('0x35')]('nolimit')){_0x3d7b82[_0x466a('0x36')]=qs[_0x466a('0x36')](_0x47c62c['query']['limit']);_0x3d7b82[_0x466a('0x1a')]=qs['offset'](_0x47c62c[_0x466a('0x2e')][_0x466a('0x1a')]);}_0x3d7b82['order']=qs['sort'](_0x47c62c[_0x466a('0x2e')][_0x466a('0x37')]);_0x3d7b82['where']=qs['filters'](_[_0x466a('0x38')](_0x47c62c[_0x466a('0x2e')],_0x39bf84[_0x466a('0x30')]),_0x1524a5);if(_0x47c62c[_0x466a('0x2e')]['filter']){_0x3d7b82[_0x466a('0x39')]=_[_0x466a('0x3a')](_0x3d7b82[_0x466a('0x39')],{'$or':_['map'](_0x1524a5,function(_0x4b39cb){if(_0x4b39cb[_0x466a('0x3b')]!==_0x466a('0x3c')){var _0xb9cb3f={};_0xb9cb3f[_0x4b39cb['name']]={'$like':'%'+_0x47c62c[_0x466a('0x2e')][_0x466a('0x3d')]+'%'};return _0xb9cb3f;}})});}_0x3d7b82=_[_0x466a('0x3a')]({},_0x3d7b82,_0x47c62c['options']);var _0x11d4f3={'where':_0x3d7b82[_0x466a('0x39')]};return db[_0x466a('0x2a')]['count'](_0x11d4f3)[_0x466a('0x25')](function(_0x3660bd){_0x308aa7[_0x466a('0x1c')]=_0x3660bd;if(_0x47c62c[_0x466a('0x2e')]['includeAll']){_0x3d7b82['include']=[{'all':!![]}];}return db[_0x466a('0x2a')]['findAll'](_0x3d7b82);})[_0x466a('0x25')](function(_0x230937){_0x308aa7[_0x466a('0x3e')]=_0x230937;return _0x308aa7;})[_0x466a('0x25')](respondWithFilteredResult(_0x1c6f5d,_0x3d7b82))[_0x466a('0x3f')](handleError(_0x1c6f5d,null));};exports['show']=function(_0x2fc918,_0x7d6944){var _0xd7c8f5={'raw':!![],'where':{'id':_0x2fc918[_0x466a('0x40')]['id']}},_0x44f003={};_0x44f003[_0x466a('0x2d')]=_['keys'](db[_0x466a('0x2a')][_0x466a('0x2b')]);_0x44f003['query']=_[_0x466a('0x2f')](_0x2fc918[_0x466a('0x2e')]);_0x44f003[_0x466a('0x30')]=_['intersection'](_0x44f003[_0x466a('0x2d')],_0x44f003[_0x466a('0x2e')]);_0xd7c8f5['attributes']=_['intersection'](_0x44f003[_0x466a('0x2d')],qs[_0x466a('0x33')](_0x2fc918[_0x466a('0x2e')]['fields']));_0xd7c8f5[_0x466a('0x32')]=_0xd7c8f5[_0x466a('0x32')][_0x466a('0x34')]?_0xd7c8f5[_0x466a('0x32')]:_0x44f003[_0x466a('0x2d')];if(_0x2fc918[_0x466a('0x2e')][_0x466a('0x41')]){_0xd7c8f5[_0x466a('0x42')]=[{'all':!![]}];}_0xd7c8f5=_['merge']({},_0xd7c8f5,_0x2fc918[_0x466a('0x43')]);return db[_0x466a('0x2a')][_0x466a('0x44')](_0xd7c8f5)[_0x466a('0x25')](handleEntityNotFound(_0x7d6944,null))[_0x466a('0x25')](respondWithResult(_0x7d6944,null))[_0x466a('0x3f')](handleError(_0x7d6944,null));};exports[_0x466a('0x45')]=function(_0x3281dc,_0x551eff){return db['VtigerField'][_0x466a('0x45')](_0x3281dc[_0x466a('0x46')],{})[_0x466a('0x25')](respondWithResult(_0x551eff,0xc9))[_0x466a('0x3f')](handleError(_0x551eff,null));};exports[_0x466a('0x23')]=function(_0x4987f6,_0x45fd95){if(_0x4987f6['body']['id']){delete _0x4987f6[_0x466a('0x46')]['id'];}return db[_0x466a('0x2a')][_0x466a('0x44')]({'where':{'id':_0x4987f6[_0x466a('0x40')]['id']}})['then'](handleEntityNotFound(_0x45fd95,null))[_0x466a('0x25')](saveUpdates(_0x4987f6[_0x466a('0x46')],null))[_0x466a('0x25')](respondWithResult(_0x45fd95,null))[_0x466a('0x3f')](handleError(_0x45fd95,null));};exports[_0x466a('0x24')]=function(_0x51bed1,_0x58010a){return db[_0x466a('0x2a')][_0x466a('0x44')]({'where':{'id':_0x51bed1[_0x466a('0x40')]['id']}})['then'](handleEntityNotFound(_0x58010a,null))[_0x466a('0x25')](removeEntity(_0x58010a,null))[_0x466a('0x3f')](handleError(_0x58010a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 83c2930..167323b 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 _0x5198=['../../config/environment','define','int_vtiger_fields','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x357f63,_0x2b641e){var _0x4e9400=function(_0x3cd2f5){while(--_0x3cd2f5){_0x357f63['push'](_0x357f63['shift']());}};_0x4e9400(++_0x2b641e);}(_0x5198,0xe0));var _0x8519=function(_0x581aa6,_0xa310dc){_0x581aa6=_0x581aa6-0x0;var _0x1d6902=_0x5198[_0x581aa6];return _0x1d6902;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8519('0x0'))(_0x8519('0x1'));var moment=require(_0x8519('0x2'));var BPromise=require(_0x8519('0x3'));var rp=require(_0x8519('0x4'));var fs=require('fs');var path=require(_0x8519('0x5'));var rimraf=require(_0x8519('0x6'));var config=require(_0x8519('0x7'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x37cf0d,_0x3dd8b0){return _0x37cf0d[_0x8519('0x8')]('VtigerField',attributes,{'tableName':_0x8519('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x8519('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ce7=['idField','FieldId','util','../../config/logger','api','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0x2ce7,0x8e));var _0x72ce=function(_0x300fee,_0xfb2928){_0x300fee=_0x300fee-0x0;var _0x19c3bd=_0x2ce7[_0x300fee];return _0x19c3bd;};'use strict';var _=require('lodash');var util=require(_0x72ce('0x0'));var logger=require(_0x72ce('0x1'))(_0x72ce('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x72ce('0x3'));module[_0x72ce('0x4')]=function(_0x5c93c5,_0x4c0885){return _0x5c93c5['define'](_0x72ce('0x5'),attributes,{'tableName':_0x72ce('0x6'),'paranoid':![],'indexes':[{'name':_0x72ce('0x7'),'fields':[_0x72ce('0x8'),_0x72ce('0x9')],'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 d9b9054..649a6f9 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 _0xc354=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc354,0x10c));var _0x4c35=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc354[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4c35('0x0'));var util=require(_0x4c35('0x1'));var moment=require(_0x4c35('0x2'));var BPromise=require(_0x4c35('0x3'));var rs=require(_0x4c35('0x4'));var fs=require('fs');var Redis=require(_0x4c35('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c35('0x6'))(_0x4c35('0x7'));var config=require(_0x4c35('0x8'));var jayson=require(_0x4c35('0x9'));var client=jayson['client'][_0x4c35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45aca4,_0x5ae4a1,_0x335c52){return new BPromise(function(_0x2926e3,_0x1bbdd5){return client['request'](_0x45aca4,_0x335c52)['then'](function(_0x240a5b){logger[_0x4c35('0xb')](_0x4c35('0xc'),_0x5ae4a1,'request\x20sent');logger[_0x4c35('0xd')](_0x4c35('0xe'),_0x5ae4a1,_0x4c35('0xf'),JSON[_0x4c35('0x10')](_0x240a5b));if(_0x240a5b[_0x4c35('0x11')]){if(_0x240a5b[_0x4c35('0x11')][_0x4c35('0x12')]===0x1f4){logger['error'](_0x4c35('0xc'),_0x5ae4a1,_0x240a5b[_0x4c35('0x11')][_0x4c35('0x13')]);return _0x1bbdd5(_0x240a5b[_0x4c35('0x11')][_0x4c35('0x13')]);}logger[_0x4c35('0x11')](_0x4c35('0xc'),_0x5ae4a1,_0x240a5b['error']['message']);return _0x2926e3(_0x240a5b[_0x4c35('0x11')][_0x4c35('0x13')]);}else{logger[_0x4c35('0xb')](_0x4c35('0xc'),_0x5ae4a1,'request\x20sent');_0x2926e3(_0x240a5b[_0x4c35('0x14')][_0x4c35('0x13')]);}})[_0x4c35('0x15')](function(_0xadc1f2){logger['error'](_0x4c35('0xc'),_0x5ae4a1,_0xadc1f2);_0x1bbdd5(_0xadc1f2);});});} \ No newline at end of file +var _0x8322=['../../config/logger','rpc','../../config/environment','jayson/promise','request','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x24bada,_0x58de24){var _0xf56b0=function(_0x107ce1){while(--_0x107ce1){_0x24bada['push'](_0x24bada['shift']());}};_0xf56b0(++_0x58de24);}(_0x8322,0x1ce));var _0x2832=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x8322[_0x586fa2];return _0x515be9;};'use strict';var _=require('lodash');var util=require(_0x2832('0x0'));var moment=require(_0x2832('0x1'));var BPromise=require(_0x2832('0x2'));var rs=require(_0x2832('0x3'));var fs=require('fs');var Redis=require(_0x2832('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2832('0x5'));var logger=require(_0x2832('0x6'))(_0x2832('0x7'));var config=require(_0x2832('0x8'));var jayson=require(_0x2832('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3acd89,_0x53e88c,_0x266480){return new BPromise(function(_0x27b48f,_0x3a0126){return client[_0x2832('0xa')](_0x3acd89,_0x266480)['then'](function(_0x275d0f){logger['info'](_0x2832('0xb'),_0x53e88c,'request\x20sent');logger['debug'](_0x2832('0xc'),_0x53e88c,'request\x20sent',JSON[_0x2832('0xd')](_0x275d0f));if(_0x275d0f[_0x2832('0xe')]){if(_0x275d0f[_0x2832('0xe')][_0x2832('0xf')]===0x1f4){logger[_0x2832('0xe')]('VtigerField,\x20%s,\x20%s',_0x53e88c,_0x275d0f['error'][_0x2832('0x10')]);return _0x3a0126(_0x275d0f['error'][_0x2832('0x10')]);}logger[_0x2832('0xe')](_0x2832('0xb'),_0x53e88c,_0x275d0f['error'][_0x2832('0x10')]);return _0x27b48f(_0x275d0f[_0x2832('0xe')][_0x2832('0x10')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x53e88c,'request\x20sent');_0x27b48f(_0x275d0f['result'][_0x2832('0x10')]);}})[_0x2832('0x11')](function(_0x25a840){logger[_0x2832('0xe')](_0x2832('0xb'),_0x53e88c,_0x25a840);_0x3a0126(_0x25a840);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6013fe9..f27f9de 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 _0xda72=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','index','get','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util'];(function(_0x58ae23,_0x296dfe){var _0x3b047f=function(_0xcc5b24){while(--_0xcc5b24){_0x58ae23['push'](_0x58ae23['shift']());}};_0x3b047f(++_0x296dfe);}(_0xda72,0x174));var _0x2da7=function(_0x189775,_0x1af650){_0x189775=_0x189775-0x0;var _0x43efc0=_0xda72[_0x189775];return _0x43efc0;};'use strict';var multer=require(_0x2da7('0x0'));var util=require(_0x2da7('0x1'));var path=require(_0x2da7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2da7('0x3')]();var fs_extra=require(_0x2da7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2da7('0x5'));var config=require(_0x2da7('0x6'));var controller=require(_0x2da7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2da7('0x8')]);router[_0x2da7('0x9')]('/:id',auth[_0x2da7('0xa')](),controller[_0x2da7('0xb')]);router['get'](_0x2da7('0xc'),auth[_0x2da7('0xa')](),controller['getConfigurations']);router[_0x2da7('0x9')](_0x2da7('0xd'),auth[_0x2da7('0xa')](),controller['getFields']);router[_0x2da7('0xe')]('/',auth['isAuthenticated'](),controller[_0x2da7('0xf')]);router['post'](_0x2da7('0xc'),auth[_0x2da7('0xa')](),controller[_0x2da7('0x10')]);router[_0x2da7('0x11')](_0x2da7('0x12'),auth[_0x2da7('0xa')](),controller[_0x2da7('0x13')]);router[_0x2da7('0x14')]('/:id',auth[_0x2da7('0xa')](),controller[_0x2da7('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe0ad=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x38f69b,_0xd464ba){var _0x911f39=function(_0x1e3629){while(--_0x1e3629){_0x38f69b['push'](_0x38f69b['shift']());}};_0x911f39(++_0xd464ba);}(_0xe0ad,0x1a5));var _0xde0a=function(_0x5a18ac,_0xc401f2){_0x5a18ac=_0x5a18ac-0x0;var _0x38bbc5=_0xe0ad[_0x5a18ac];return _0x38bbc5;};'use strict';var multer=require(_0xde0a('0x0'));var util=require('util');var path=require(_0xde0a('0x1'));var timeout=require(_0xde0a('0x2'));var express=require(_0xde0a('0x3'));var router=express[_0xde0a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xde0a('0x5'));var interaction=require(_0xde0a('0x6'));var config=require(_0xde0a('0x7'));var controller=require(_0xde0a('0x8'));router[_0xde0a('0x9')]('/',auth[_0xde0a('0xa')](),controller[_0xde0a('0xb')]);router[_0xde0a('0x9')](_0xde0a('0xc'),auth[_0xde0a('0xa')](),controller[_0xde0a('0xd')]);router[_0xde0a('0x9')](_0xde0a('0xe'),auth[_0xde0a('0xa')](),controller[_0xde0a('0xf')]);router[_0xde0a('0x9')](_0xde0a('0x10'),auth['isAuthenticated'](),controller[_0xde0a('0x11')]);router[_0xde0a('0x12')]('/',auth['isAuthenticated'](),controller[_0xde0a('0x13')]);router[_0xde0a('0x12')](_0xde0a('0xe'),auth[_0xde0a('0xa')](),controller[_0xde0a('0x14')]);router[_0xde0a('0x15')](_0xde0a('0xc'),auth[_0xde0a('0xa')](),controller['update']);router[_0xde0a('0x16')](_0xde0a('0xc'),auth['isAuthenticated'](),controller[_0xde0a('0x17')]);module[_0xde0a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index afb83fc..1b6bc01 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 _0x0958=['STRING','username','remoteUri','token','password','ENUM','integrationTab','sequelize','exports'];(function(_0x5b8638,_0x47888f){var _0x5b62a8=function(_0x331801){while(--_0x331801){_0x5b8638['push'](_0x5b8638['shift']());}};_0x5b62a8(++_0x47888f);}(_0x0958,0x7c));var _0x8095=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0958[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x8095('0x0'));module[_0x8095('0x1')]={'name':{'type':Sequelize[_0x8095('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8095('0x2')],'unique':_0x8095('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8095('0x2')],'unique':_0x8095('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0x8095('0x5')),'defaultValue':_0x8095('0x6')},'serverUrl':{'type':Sequelize[_0x8095('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8095('0x7')](_0x8095('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x15ef=['password','newTab','exports','STRING','username','ENUM'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x15ef,0x80));var _0xf15e=function(_0x565f80,_0x4b0eb4){_0x565f80=_0x565f80-0x0;var _0x331c76=_0x15ef[_0x565f80];return _0x331c76;};'use strict';var Sequelize=require('sequelize');module[_0xf15e('0x0')]={'name':{'type':Sequelize[_0xf15e('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf15e('0x1')],'unique':_0xf15e('0x2')},'password':{'type':Sequelize[_0xf15e('0x1')]},'token':{'type':Sequelize[_0xf15e('0x1')]},'remoteUri':{'type':Sequelize[_0xf15e('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xf15e('0x3')](_0xf15e('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xf15e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf15e('0x3')]('integrationTab',_0xf15e('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 33ba368..3e9186d 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 _0xcb91=['ZendeskAccount','rawAttributes','fieldName','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','findAll','rows','show','includeAll','include','find','create','body','params','catch','destroy','getConfigurations','keys','ZendeskConfiguration','addConfiguration','AccountId','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','findOne','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','subject','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','error','stack','name','send','index'];(function(_0x29a5e4,_0x3d11f7){var _0x551abc=function(_0x2c1d5a){while(--_0x2c1d5a){_0x29a5e4['push'](_0x29a5e4['shift']());}};_0x551abc(++_0x3d11f7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xcb91[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5e3c19,_0x59dec3){_0x59dec3=_0x59dec3||0xcc;return function(_0x358866){if(_0x358866){return _0x5e3c19[_0x1cb9('0x16')](_0x59dec3);}return _0x5e3c19[_0x1cb9('0x17')](_0x59dec3)[_0x1cb9('0x18')]();};}function respondWithResult(_0x56884d,_0x397727){_0x397727=_0x397727||0xc8;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x17')](_0x397727)[_0x1cb9('0x19')](_0x6ef389);}};}function respondWithFilteredResult(_0x3e2d11,_0x5806d8){return function(_0x5572cb){if(_0x5572cb){var _0xd446a3=typeof _0x5806d8[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x5806d8[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0xf22920=_0x5572cb[_0x1cb9('0x1d')];var _0x4e1340=_0xd446a3?0x0:_0x5806d8['offset'];var _0x1b2fa6=_0xd446a3?_0x5572cb[_0x1cb9('0x1d')]:_0x5806d8[_0x1cb9('0x1a')]+_0x5806d8[_0x1cb9('0x1c')];var _0x280a84;if(_0x1b2fa6>=_0xf22920){_0x1b2fa6=_0xf22920;_0x280a84=0xc8;}else{_0x280a84=0xce;}_0x3e2d11[_0x1cb9('0x17')](_0x280a84);return _0x3e2d11[_0x1cb9('0x1e')]('Content-Range',_0x4e1340+'-'+_0x1b2fa6+'/'+_0xf22920)['json'](_0x5572cb);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x1f')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x20')](_0x2e3854)[_0x1cb9('0x21')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x21')](function(){_0x59ebea[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x44d3c4,_0x43a100){return function(_0x53f9fa){if(!_0x53f9fa){_0x44d3c4[_0x1cb9('0x16')](0x194);}return _0x53f9fa;};}function handleError(_0x9df250,_0x4c8d76){_0x4c8d76=_0x4c8d76||0x1f4;return function(_0xd6891c){logger[_0x1cb9('0x22')](_0xd6891c[_0x1cb9('0x23')]);if(_0xd6891c[_0x1cb9('0x24')]){delete _0xd6891c[_0x1cb9('0x24')];}_0x9df250[_0x1cb9('0x17')](_0x4c8d76)[_0x1cb9('0x25')](_0xd6891c);};}exports[_0x1cb9('0x26')]=function(_0x41e5c2,_0x9de64b){var _0x48888d={},_0x405a2f={},_0x536635={'count':0x0,'rows':[]};var _0x110282=_['map'](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x3cd7f5){return{'name':_0x3cd7f5[_0x1cb9('0x29')],'type':_0x3cd7f5['type'][_0x1cb9('0x2a')]};});_0x405a2f['model']=_[_0x1cb9('0x2b')](_0x110282,_0x1cb9('0x24'));_0x405a2f[_0x1cb9('0x2c')]=_['keys'](_0x41e5c2[_0x1cb9('0x2c')]);_0x405a2f['filters']=_[_0x1cb9('0x2d')](_0x405a2f['model'],_0x405a2f[_0x1cb9('0x2c')]);_0x48888d[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x405a2f[_0x1cb9('0x2f')],qs['fields'](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x30')]));_0x48888d[_0x1cb9('0x2e')]=_0x48888d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x48888d[_0x1cb9('0x2e')]:_0x405a2f[_0x1cb9('0x2f')];if(!_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x48888d[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x41e5c2[_0x1cb9('0x2c')]['limit']);_0x48888d['offset']=qs[_0x1cb9('0x1a')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x1a')]);}_0x48888d[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x48888d[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x41e5c2[_0x1cb9('0x2c')],_0x405a2f[_0x1cb9('0x38')]),_0x110282);if(_0x41e5c2['query'][_0x1cb9('0x39')]){_0x48888d['where']=_[_0x1cb9('0x3a')](_0x48888d['where'],{'$or':_[_0x1cb9('0x2b')](_0x110282,function(_0x13d4fd){if(_0x13d4fd[_0x1cb9('0x3b')]!==_0x1cb9('0x3c')){var _0x34ada2={};_0x34ada2[_0x13d4fd[_0x1cb9('0x24')]]={'$like':'%'+_0x41e5c2[_0x1cb9('0x2c')]['filter']+'%'};return _0x34ada2;}})});}_0x48888d=_['merge']({},_0x48888d,_0x41e5c2[_0x1cb9('0x3d')]);var _0x1d2723={'where':_0x48888d[_0x1cb9('0x36')]};return db[_0x1cb9('0x27')][_0x1cb9('0x1d')](_0x1d2723)[_0x1cb9('0x21')](function(_0x32130b){_0x536635['count']=_0x32130b;if(_0x41e5c2[_0x1cb9('0x2c')]['includeAll']){_0x48888d['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x1cb9('0x3e')](_0x48888d);})[_0x1cb9('0x21')](function(_0x1bf51c){_0x536635[_0x1cb9('0x3f')]=_0x1bf51c;return _0x536635;})[_0x1cb9('0x21')](respondWithFilteredResult(_0x9de64b,_0x48888d))['catch'](handleError(_0x9de64b,null));};exports[_0x1cb9('0x40')]=function(_0x523866,_0x91121){var _0x71db9d={'raw':![],'where':{'id':_0x523866['params']['id']}},_0x38d973={};_0x38d973[_0x1cb9('0x2f')]=_['keys'](db[_0x1cb9('0x27')][_0x1cb9('0x28')]);_0x38d973['query']=_['keys'](_0x523866[_0x1cb9('0x2c')]);_0x38d973[_0x1cb9('0x38')]=_[_0x1cb9('0x2d')](_0x38d973[_0x1cb9('0x2f')],_0x38d973[_0x1cb9('0x2c')]);_0x71db9d['attributes']=_[_0x1cb9('0x2d')](_0x38d973['model'],qs['fields'](_0x523866['query'][_0x1cb9('0x30')]));_0x71db9d[_0x1cb9('0x2e')]=_0x71db9d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x71db9d[_0x1cb9('0x2e')]:_0x38d973[_0x1cb9('0x2f')];if(_0x523866[_0x1cb9('0x2c')][_0x1cb9('0x41')]){_0x71db9d[_0x1cb9('0x42')]=[{'all':!![]}];}_0x71db9d=_[_0x1cb9('0x3a')]({},_0x71db9d,_0x523866[_0x1cb9('0x3d')]);return db['ZendeskAccount'][_0x1cb9('0x43')](_0x71db9d)[_0x1cb9('0x21')](handleEntityNotFound(_0x91121,null))[_0x1cb9('0x21')](respondWithResult(_0x91121,null))['catch'](handleError(_0x91121,null));};exports[_0x1cb9('0x44')]=function(_0x57251,_0x3c6044){return db[_0x1cb9('0x27')][_0x1cb9('0x44')](_0x57251['body'],{})[_0x1cb9('0x21')](respondWithResult(_0x3c6044,0xc9))['catch'](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x4ac483,_0x1cf2ee){if(_0x4ac483[_0x1cb9('0x45')]['id']){delete _0x4ac483[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x4ac483[_0x1cb9('0x46')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x1cf2ee,null))[_0x1cb9('0x21')](saveUpdates(_0x4ac483[_0x1cb9('0x45')],null))[_0x1cb9('0x21')](respondWithResult(_0x1cf2ee,null))[_0x1cb9('0x47')](handleError(_0x1cf2ee,null));};exports[_0x1cb9('0x48')]=function(_0x3b6a92,_0xbb500e){return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x3b6a92['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0xbb500e,null))[_0x1cb9('0x21')](removeEntity(_0xbb500e,null))[_0x1cb9('0x47')](handleError(_0xbb500e,null));};exports[_0x1cb9('0x49')]=function(_0x20b253,_0x2d076b,_0x367dd7){var _0x1c4ff6={};var _0x36c53a={};var _0x166ca2;var _0x4a4b87;return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x20b253[_0x1cb9('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d076b,null))[_0x1cb9('0x21')](function(_0x53c002){if(_0x53c002){_0x166ca2=_0x53c002;_0x36c53a['model']=_[_0x1cb9('0x4a')](db[_0x1cb9('0x4b')][_0x1cb9('0x28')]);_0x36c53a['query']=_[_0x1cb9('0x4a')](_0x20b253[_0x1cb9('0x2c')]);_0x36c53a['filters']=_['intersection'](_0x36c53a[_0x1cb9('0x2f')],_0x36c53a[_0x1cb9('0x2c')]);_0x1c4ff6[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x36c53a[_0x1cb9('0x2f')],qs[_0x1cb9('0x30')](_0x20b253[_0x1cb9('0x2c')]['fields']));_0x1c4ff6[_0x1cb9('0x2e')]=_0x1c4ff6[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x1c4ff6['attributes']:_0x36c53a[_0x1cb9('0x2f')];_0x1c4ff6[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x1c4ff6[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x20b253[_0x1cb9('0x2c')],_0x36c53a[_0x1cb9('0x38')]));if(_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]){_0x1c4ff6[_0x1cb9('0x36')]=_[_0x1cb9('0x3a')](_0x1c4ff6[_0x1cb9('0x36')],{'$or':_[_0x1cb9('0x2b')](_0x1c4ff6[_0x1cb9('0x2e')],function(_0x370c97){var _0x55fb51={};_0x55fb51[_0x370c97]={'$like':'%'+_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]+'%'};return _0x55fb51;})});}_0x1c4ff6=_[_0x1cb9('0x3a')]({},_0x1c4ff6,_0x20b253[_0x1cb9('0x3d')]);return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x319358){if(_0x319358){_0x4a4b87=_0x319358[_0x1cb9('0x31')];if(!_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x1c4ff6[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x20b253[_0x1cb9('0x2c')]['limit']);_0x1c4ff6['offset']=qs[_0x1cb9('0x1a')](_0x20b253['query']['offset']);}return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x5d349b){if(_0x5d349b){return _0x5d349b?{'count':_0x4a4b87,'rows':_0x5d349b}:null;}})[_0x1cb9('0x21')](respondWithResult(_0x2d076b,null))[_0x1cb9('0x47')](handleError(_0x2d076b,null));};exports[_0x1cb9('0x4c')]=function(_0x43bafc,_0x23d435,_0xccbee3){if(_0x43bafc['body']['id']){delete _0x43bafc[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x43bafc['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x23d435,null))[_0x1cb9('0x21')](function(_0x2e818f){if(_0x2e818f){_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4d')]=_0x2e818f['id'];_0x43bafc['body']['Subjects']=integrations['getSubjects'](_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4e')],_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x3b')]);_0x43bafc[_0x1cb9('0x45')]['Descriptions']=integrations[_0x1cb9('0x4f')](_0x43bafc[_0x1cb9('0x45')]['channel'],_0x43bafc['body'][_0x1cb9('0x3b')]);return db['ZendeskConfiguration'][_0x1cb9('0x44')](_0x43bafc[_0x1cb9('0x45')],{'include':[{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x51')},{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x52')}]});}return null;})['then'](respondWithResult(_0x23d435,null))[_0x1cb9('0x47')](handleError(_0x23d435,null));};exports[_0x1cb9('0x53')]=function(_0x330fc1,_0x17c361,_0x5b5f0d){var _0x520d98='';return db[_0x1cb9('0x27')][_0x1cb9('0x54')]({'where':{'id':_0x330fc1[_0x1cb9('0x46')]['id']},'attributes':['id',_0x1cb9('0x55'),_0x1cb9('0x56'),_0x1cb9('0x57'),'authType',_0x1cb9('0x58')]})['then'](handleEntityNotFound(_0x17c361,null))[_0x1cb9('0x21')](function(_0x26dae9){if(_0x26dae9){_0x520d98=_0x26dae9['remoteUri'];var _0xf5b006=_0x520d98[_0x1cb9('0x59')](-0x1);if(_0xf5b006==='/'){_0x520d98=_0x520d98[_0x1cb9('0x5a')](0x0,_0x520d98['lastIndexOf'](_0xf5b006));}var _0x1b4878={'method':_0x1cb9('0x5b'),'uri':util[_0x1cb9('0x5c')](_0x1cb9('0x5d'),_0x520d98,_0x1cb9('0x5e')),'json':!![]};switch(_0x26dae9[_0x1cb9('0x5f')]){case'password':_0x1b4878[_0x1cb9('0x60')]={'Authorization':util[_0x1cb9('0x5c')](_0x1cb9('0x61'),new Buffer(util[_0x1cb9('0x5c')](_0x1cb9('0x62'),_0x26dae9[_0x1cb9('0x55')],_0x26dae9[_0x1cb9('0x56')]))[_0x1cb9('0x63')]('base64'))};break;case _0x1cb9('0x57'):_0x1b4878[_0x1cb9('0x60')]={'Authorization':util['format'](_0x1cb9('0x61'),new Buffer(util['format'](_0x1cb9('0x64'),_0x26dae9['username'],_0x26dae9['token']))[_0x1cb9('0x63')](_0x1cb9('0x65')))};break;default:throw new db['Sequelize'][(_0x1cb9('0x66'))]('Unknown\x20authentication\x20type');}return rp(_0x1b4878);}})[_0x1cb9('0x21')](function(_0x7ecb4e){if(_0x7ecb4e){var _0x399986=[_0x1cb9('0x67'),'description',_0x1cb9('0x68'),_0x1cb9('0x69')];_[_0x1cb9('0x6a')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x4f8d74){return _0x399986[_0x1cb9('0x6b')](_0x4f8d74['type']);});return{'count':_0x7ecb4e[_0x1cb9('0x5e')][_0x1cb9('0x31')],'rows':_[_0x1cb9('0x2b')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x102f2c){return{'id':_0x102f2c['id'],'name':_0x102f2c[_0x1cb9('0x6c')]>0x7?_0x102f2c['title']:_0x102f2c[_0x1cb9('0x3b')],'custom':_0x102f2c[_0x1cb9('0x6c')]>0x7?!![]:![],'options':_0x102f2c['system_field_options']?_0x102f2c[_0x1cb9('0x6d')]:_0x102f2c[_0x1cb9('0x6e')]?_0x102f2c[_0x1cb9('0x6e')]:[]};})};}})[_0x1cb9('0x21')](respondWithResult(_0x17c361,null))[_0x1cb9('0x47')](function(_0x209dc7){var _0x423aae=_0x330fc1['query'][_0x1cb9('0x6f')]?0x1f4:_0x209dc7['statusCode']||0x1f4;logger[_0x1cb9('0x22')](_0x1cb9('0x70'),'getFields',_0x423aae,JSON[_0x1cb9('0x71')](_0x209dc7));delete _0x209dc7[_0x1cb9('0x24')];if(_0x423aae===0x191){_0x423aae=0x190;}_0x17c361[_0x1cb9('0x17')](_0x423aae)[_0x1cb9('0x25')](_0x330fc1['query'][_0x1cb9('0x6f')]?{'message':_0x1cb9('0x72'),'statusCode':_0x209dc7[_0x1cb9('0x73')]}:_0x209dc7);});}; \ No newline at end of file +var _0xe1e3=['assignee','remove','includes','position','title','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','undefined','count','offset','status','set','apply','save','then','destroy','name','send','ZendeskAccount','type','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','update','ZendeskConfiguration','length','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','findOne','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','username','base64','headers','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','group'];(function(_0xadcd62,_0xfd1f8e){var _0x145d9a=function(_0x5bf28e){while(--_0x5bf28e){_0xadcd62['push'](_0xadcd62['shift']());}};_0x145d9a(++_0xfd1f8e);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x56eb32,_0x4f0671){_0x56eb32=_0x56eb32-0x0;var _0x1c663b=_0xe1e3[_0x56eb32];return _0x1c663b;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x536129,_0x5c09a2){_0x5c09a2=_0x5c09a2||0xcc;return function(_0x14ad58){if(_0x14ad58){return _0x536129['sendStatus'](_0x5c09a2);}return _0x536129['status'](_0x5c09a2)[_0x3e1e('0x14')]();};}function respondWithResult(_0x8bd4cd,_0x78ee54){_0x78ee54=_0x78ee54||0xc8;return function(_0x50f221){if(_0x50f221){return _0x8bd4cd['status'](_0x78ee54)[_0x3e1e('0x15')](_0x50f221);}};}function respondWithFilteredResult(_0x1b62e6,_0x4dca60){return function(_0x26cb35){if(_0x26cb35){var _0x1f0af9=typeof _0x4dca60['offset']===_0x3e1e('0x16')&&typeof _0x4dca60['limit']===_0x3e1e('0x16');var _0x247daa=_0x26cb35[_0x3e1e('0x17')];var _0x39eaa7=_0x1f0af9?0x0:_0x4dca60[_0x3e1e('0x18')];var _0x1c181b=_0x1f0af9?_0x26cb35['count']:_0x4dca60['offset']+_0x4dca60['limit'];var _0x428e4e;if(_0x1c181b>=_0x247daa){_0x1c181b=_0x247daa;_0x428e4e=0xc8;}else{_0x428e4e=0xce;}_0x1b62e6[_0x3e1e('0x19')](_0x428e4e);return _0x1b62e6[_0x3e1e('0x1a')]('Content-Range',_0x39eaa7+'-'+_0x1c181b+'/'+_0x247daa)[_0x3e1e('0x15')](_0x26cb35);}return null;};}function patchUpdates(_0x530815){return function(_0x228991){try{jsonpatch[_0x3e1e('0x1b')](_0x228991,_0x530815,!![]);}catch(_0x474085){return BPromise['reject'](_0x474085);}return _0x228991[_0x3e1e('0x1c')]();};}function saveUpdates(_0x96396,_0xefa098){return function(_0x55dc62){if(_0x55dc62){return _0x55dc62['update'](_0x96396)[_0x3e1e('0x1d')](function(_0x1b5097){return _0x1b5097;});}return null;};}function removeEntity(_0x488f9f,_0x60e6bc){return function(_0x56ae51){if(_0x56ae51){return _0x56ae51[_0x3e1e('0x1e')]()[_0x3e1e('0x1d')](function(){_0x488f9f[_0x3e1e('0x19')](0xcc)[_0x3e1e('0x14')]();});}};}function handleEntityNotFound(_0x43d583,_0x21c898){return function(_0x4ee2b5){if(!_0x4ee2b5){_0x43d583['sendStatus'](0x194);}return _0x4ee2b5;};}function handleError(_0x44e419,_0x541ef1){_0x541ef1=_0x541ef1||0x1f4;return function(_0x55db8f){logger['error'](_0x55db8f['stack']);if(_0x55db8f[_0x3e1e('0x1f')]){delete _0x55db8f[_0x3e1e('0x1f')];}_0x44e419['status'](_0x541ef1)[_0x3e1e('0x20')](_0x55db8f);};}exports['index']=function(_0xdfcd93,_0x176bb4){var _0x53a6ff={},_0x43e029={},_0x210a84={'count':0x0,'rows':[]};var _0x45ed0e=_['map'](db[_0x3e1e('0x21')]['rawAttributes'],function(_0x591c36){return{'name':_0x591c36['fieldName'],'type':_0x591c36[_0x3e1e('0x22')]['key']};});_0x43e029['model']=_[_0x3e1e('0x23')](_0x45ed0e,_0x3e1e('0x1f'));_0x43e029[_0x3e1e('0x24')]=_[_0x3e1e('0x25')](_0xdfcd93[_0x3e1e('0x24')]);_0x43e029['filters']=_['intersection'](_0x43e029['model'],_0x43e029['query']);_0x53a6ff[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x43e029[_0x3e1e('0x28')],qs[_0x3e1e('0x29')](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x29')]));_0x53a6ff[_0x3e1e('0x26')]=_0x53a6ff[_0x3e1e('0x26')]['length']?_0x53a6ff[_0x3e1e('0x26')]:_0x43e029[_0x3e1e('0x28')];if(!_0xdfcd93['query'][_0x3e1e('0x2a')](_0x3e1e('0x2b'))){_0x53a6ff[_0x3e1e('0x2c')]=qs[_0x3e1e('0x2c')](_0xdfcd93['query']['limit']);_0x53a6ff[_0x3e1e('0x18')]=qs[_0x3e1e('0x18')](_0xdfcd93['query'][_0x3e1e('0x18')]);}_0x53a6ff[_0x3e1e('0x2d')]=qs['sort'](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x2e')]);_0x53a6ff[_0x3e1e('0x2f')]=qs[_0x3e1e('0x30')](_[_0x3e1e('0x31')](_0xdfcd93['query'],_0x43e029[_0x3e1e('0x30')]),_0x45ed0e);if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x32')]){_0x53a6ff[_0x3e1e('0x2f')]=_['merge'](_0x53a6ff[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x45ed0e,function(_0x111da4){if(_0x111da4[_0x3e1e('0x22')]!==_0x3e1e('0x33')){var _0x25a95b={};_0x25a95b[_0x111da4[_0x3e1e('0x1f')]]={'$like':'%'+_0xdfcd93['query'][_0x3e1e('0x32')]+'%'};return _0x25a95b;}})});}_0x53a6ff=_['merge']({},_0x53a6ff,_0xdfcd93['options']);var _0x4f598e={'where':_0x53a6ff[_0x3e1e('0x2f')]};return db[_0x3e1e('0x21')]['count'](_0x4f598e)[_0x3e1e('0x1d')](function(_0xb030eb){_0x210a84['count']=_0xb030eb;if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x53a6ff['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x3e1e('0x35')](_0x53a6ff);})['then'](function(_0x4ff868){_0x210a84[_0x3e1e('0x36')]=_0x4ff868;return _0x210a84;})[_0x3e1e('0x1d')](respondWithFilteredResult(_0x176bb4,_0x53a6ff))[_0x3e1e('0x37')](handleError(_0x176bb4,null));};exports[_0x3e1e('0x38')]=function(_0x377a06,_0x55ea1d){var _0x5b32ad={'raw':![],'where':{'id':_0x377a06[_0x3e1e('0x39')]['id']}},_0x24b2ad={};_0x24b2ad[_0x3e1e('0x28')]=_['keys'](db[_0x3e1e('0x21')][_0x3e1e('0x3a')]);_0x24b2ad[_0x3e1e('0x24')]=_['keys'](_0x377a06[_0x3e1e('0x24')]);_0x24b2ad['filters']=_['intersection'](_0x24b2ad[_0x3e1e('0x28')],_0x24b2ad[_0x3e1e('0x24')]);_0x5b32ad[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x24b2ad['model'],qs['fields'](_0x377a06['query']['fields']));_0x5b32ad[_0x3e1e('0x26')]=_0x5b32ad[_0x3e1e('0x26')]['length']?_0x5b32ad['attributes']:_0x24b2ad[_0x3e1e('0x28')];if(_0x377a06[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x5b32ad['include']=[{'all':!![]}];}_0x5b32ad=_[_0x3e1e('0x3b')]({},_0x5b32ad,_0x377a06['options']);return db[_0x3e1e('0x21')][_0x3e1e('0x3c')](_0x5b32ad)[_0x3e1e('0x1d')](handleEntityNotFound(_0x55ea1d,null))[_0x3e1e('0x1d')](respondWithResult(_0x55ea1d,null))[_0x3e1e('0x37')](handleError(_0x55ea1d,null));};exports[_0x3e1e('0x3d')]=function(_0x53d32b,_0x2f14b3){return db[_0x3e1e('0x21')]['create'](_0x53d32b[_0x3e1e('0x3e')],{})[_0x3e1e('0x1d')](respondWithResult(_0x2f14b3,0xc9))['catch'](handleError(_0x2f14b3,null));};exports[_0x3e1e('0x3f')]=function(_0x347b3f,_0x2e286f){if(_0x347b3f[_0x3e1e('0x3e')]['id']){delete _0x347b3f['body']['id'];}return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0x347b3f[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x2e286f,null))['then'](saveUpdates(_0x347b3f[_0x3e1e('0x3e')],null))[_0x3e1e('0x1d')](respondWithResult(_0x2e286f,null))[_0x3e1e('0x37')](handleError(_0x2e286f,null));};exports[_0x3e1e('0x1e')]=function(_0xe2516c,_0x1df5a8){return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0xe2516c['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1df5a8,null))['then'](removeEntity(_0x1df5a8,null))['catch'](handleError(_0x1df5a8,null));};exports['getConfigurations']=function(_0x1c4269,_0x17641c,_0x5147a2){var _0x13b076={};var _0x592733={};var _0x5b2416;var _0x3eaf76;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1c4269['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x17641c,null))[_0x3e1e('0x1d')](function(_0x1334c8){if(_0x1334c8){_0x5b2416=_0x1334c8;_0x592733[_0x3e1e('0x28')]=_[_0x3e1e('0x25')](db[_0x3e1e('0x40')][_0x3e1e('0x3a')]);_0x592733['query']=_[_0x3e1e('0x25')](_0x1c4269['query']);_0x592733[_0x3e1e('0x30')]=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],_0x592733['query']);_0x13b076['attributes']=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],qs['fields'](_0x1c4269[_0x3e1e('0x24')]['fields']));_0x13b076['attributes']=_0x13b076[_0x3e1e('0x26')][_0x3e1e('0x41')]?_0x13b076['attributes']:_0x592733[_0x3e1e('0x28')];_0x13b076['order']=qs['sort'](_0x1c4269[_0x3e1e('0x24')]['sort']);_0x13b076[_0x3e1e('0x2f')]=qs['filters'](_[_0x3e1e('0x31')](_0x1c4269['query'],_0x592733[_0x3e1e('0x30')]));if(_0x1c4269[_0x3e1e('0x24')]['filter']){_0x13b076['where']=_['merge'](_0x13b076[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x13b076[_0x3e1e('0x26')],function(_0x588189){var _0x1b04ce={};_0x1b04ce[_0x588189]={'$like':'%'+_0x1c4269[_0x3e1e('0x24')][_0x3e1e('0x32')]+'%'};return _0x1b04ce;})});}_0x13b076=_['merge']({},_0x13b076,_0x1c4269['options']);return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x3b97a2){if(_0x3b97a2){_0x3eaf76=_0x3b97a2[_0x3e1e('0x41')];if(!_0x1c4269[_0x3e1e('0x24')]['hasOwnProperty'](_0x3e1e('0x2b'))){_0x13b076['limit']=qs[_0x3e1e('0x2c')](_0x1c4269[_0x3e1e('0x24')]['limit']);_0x13b076[_0x3e1e('0x18')]=qs['offset'](_0x1c4269[_0x3e1e('0x24')]['offset']);}return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x31062e){if(_0x31062e){return _0x31062e?{'count':_0x3eaf76,'rows':_0x31062e}:null;}})[_0x3e1e('0x1d')](respondWithResult(_0x17641c,null))[_0x3e1e('0x37')](handleError(_0x17641c,null));};exports['addConfiguration']=function(_0x11cab1,_0x1fbcfc,_0x4e6957){if(_0x11cab1[_0x3e1e('0x3e')]['id']){delete _0x11cab1['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x11cab1[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1fbcfc,null))[_0x3e1e('0x1d')](function(_0x4b0944){if(_0x4b0944){_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x43')]=_0x4b0944['id'];_0x11cab1[_0x3e1e('0x3e')]['Subjects']=integrations[_0x3e1e('0x44')](_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x45')],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x46')]=integrations[_0x3e1e('0x47')](_0x11cab1['body']['channel'],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);return db[_0x3e1e('0x40')][_0x3e1e('0x3d')](_0x11cab1[_0x3e1e('0x3e')],{'include':[{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x49')},{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x46')}]});}return null;})[_0x3e1e('0x1d')](respondWithResult(_0x1fbcfc,null))[_0x3e1e('0x37')](handleError(_0x1fbcfc,null));};exports[_0x3e1e('0x4a')]=function(_0x5e148e,_0x5581ee,_0x20bc4d){var _0x29ddc4='';return db[_0x3e1e('0x21')][_0x3e1e('0x4b')]({'where':{'id':_0x5e148e[_0x3e1e('0x39')]['id']},'attributes':['id','username',_0x3e1e('0x4c'),_0x3e1e('0x4d'),_0x3e1e('0x4e'),_0x3e1e('0x4f')]})[_0x3e1e('0x1d')](handleEntityNotFound(_0x5581ee,null))['then'](function(_0x8b6b28){if(_0x8b6b28){_0x29ddc4=_0x8b6b28[_0x3e1e('0x4f')];var _0xc60340=_0x29ddc4[_0x3e1e('0x50')](-0x1);if(_0xc60340==='/'){_0x29ddc4=_0x29ddc4[_0x3e1e('0x51')](0x0,_0x29ddc4[_0x3e1e('0x52')](_0xc60340));}var _0x4d0854={'method':_0x3e1e('0x53'),'uri':util[_0x3e1e('0x54')](_0x3e1e('0x55'),_0x29ddc4,_0x3e1e('0x56')),'json':!![]};switch(_0x8b6b28[_0x3e1e('0x4e')]){case _0x3e1e('0x4c'):_0x4d0854['headers']={'Authorization':util[_0x3e1e('0x54')](_0x3e1e('0x57'),new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x58'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4c')]))['toString'](_0x3e1e('0x5a')))};break;case'token':_0x4d0854[_0x3e1e('0x5b')]={'Authorization':util[_0x3e1e('0x54')]('Basic\x20%s',new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x5c'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4d')]))['toString'](_0x3e1e('0x5a')))};break;default:throw new db['Sequelize'][(_0x3e1e('0x5d'))](_0x3e1e('0x5e'));}return rp(_0x4d0854);}})[_0x3e1e('0x1d')](function(_0x632f99){if(_0x632f99){var _0x2ef476=[_0x3e1e('0x5f'),'description',_0x3e1e('0x60'),_0x3e1e('0x61')];_[_0x3e1e('0x62')](_0x632f99[_0x3e1e('0x56')],function(_0x4b4fd4){return _0x2ef476[_0x3e1e('0x63')](_0x4b4fd4[_0x3e1e('0x22')]);});return{'count':_0x632f99[_0x3e1e('0x56')][_0x3e1e('0x41')],'rows':_['map'](_0x632f99[_0x3e1e('0x56')],function(_0x41d98f){return{'id':_0x41d98f['id'],'name':_0x41d98f[_0x3e1e('0x64')]>0x7?_0x41d98f[_0x3e1e('0x65')]:_0x41d98f[_0x3e1e('0x22')],'custom':_0x41d98f[_0x3e1e('0x64')]>0x7?!![]:![],'options':_0x41d98f['system_field_options']?_0x41d98f['system_field_options']:_0x41d98f['custom_field_options']?_0x41d98f[_0x3e1e('0x66')]:[]};})};}})['then'](respondWithResult(_0x5581ee,null))[_0x3e1e('0x37')](function(_0x5f436f){var _0x32b5ef=_0x5e148e[_0x3e1e('0x24')][_0x3e1e('0x67')]?0x1f4:_0x5f436f[_0x3e1e('0x68')]||0x1f4;logger['error'](_0x3e1e('0x69'),'getFields',_0x32b5ef,JSON[_0x3e1e('0x6a')](_0x5f436f));delete _0x5f436f['name'];if(_0x32b5ef===0x191){_0x32b5ef=0x190;}_0x5581ee[_0x3e1e('0x19')](_0x32b5ef)[_0x3e1e('0x20')](_0x5e148e['query'][_0x3e1e('0x67')]?{'message':_0x3e1e('0x6b'),'statusCode':_0x5f436f[_0x3e1e('0x68')]}:_0x5f436f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 2780df2..4bccbba 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 _0x01ea=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts'];(function(_0x39ecfb,_0x469d81){var _0x450c1a=function(_0x4636e1){while(--_0x4636e1){_0x39ecfb['push'](_0x39ecfb['shift']());}};_0x450c1a(++_0x469d81);}(_0x01ea,0xb0));var _0xa01e=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x01ea[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa01e('0x0'))(_0xa01e('0x1'));var moment=require(_0xa01e('0x2'));var BPromise=require(_0xa01e('0x3'));var rp=require(_0xa01e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa01e('0x5'));var config=require('../../config/environment');var attributes=require(_0xa01e('0x6'));var integrations=require(_0xa01e('0x7'));module[_0xa01e('0x8')]=function(_0x4eba52,_0x1ec943){return _0x4eba52[_0xa01e('0x9')]('ZendeskAccount',attributes,{'tableName':_0xa01e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80fd=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x80fd,0x155));var _0xd80f=function(_0x5f2857,_0x9414d1){_0x5f2857=_0x5f2857-0x0;var _0x39a832=_0x80fd[_0x5f2857];return _0x39a832;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd80f('0x0'))('api');var moment=require(_0xd80f('0x1'));var BPromise=require(_0xd80f('0x2'));var rp=require(_0xd80f('0x3'));var fs=require('fs');var path=require(_0xd80f('0x4'));var rimraf=require(_0xd80f('0x5'));var config=require(_0xd80f('0x6'));var attributes=require(_0xd80f('0x7'));var integrations=require(_0xd80f('0x8'));module['exports']=function(_0x324bfb,_0xab8a81){return _0x324bfb[_0xd80f('0x9')]('ZendeskAccount',attributes,{'tableName':_0xd80f('0xa'),'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 ea5edb9..7967041 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 _0xf24b=['attributes','stringify','ShowZendeskAccount','ZendeskAccount','find','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','GetZendeskAccount','findAll','options','raw','map','include','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf24b,0x8a));var _0xbf24=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0xf24b[_0x567bcb];return _0x4eebc2;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require(_0xbf24('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf24('0x4'))['db'];var utils=require(_0xbf24('0x5'));var logger=require(_0xbf24('0x6'))(_0xbf24('0x7'));var config=require(_0xbf24('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13b438,_0x5c8604,_0x1b5aae){return new BPromise(function(_0x14f04c,_0x5b05c6){return client[_0xbf24('0xa')](_0x13b438,_0x1b5aae)[_0xbf24('0xb')](function(_0x247bb6){logger['info'](_0xbf24('0xc'),_0x5c8604,'request\x20sent');logger[_0xbf24('0xd')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x5c8604,_0xbf24('0xe'),JSON['stringify'](_0x247bb6));if(_0x247bb6[_0xbf24('0xf')]){if(_0x247bb6['error']['code']===0x1f4){logger['error'](_0xbf24('0xc'),_0x5c8604,_0x247bb6[_0xbf24('0xf')][_0xbf24('0x10')]);return _0x5b05c6(_0x247bb6['error'][_0xbf24('0x10')]);}logger[_0xbf24('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x5c8604,_0x247bb6[_0xbf24('0xf')][_0xbf24('0x10')]);return _0x14f04c(_0x247bb6[_0xbf24('0xf')][_0xbf24('0x10')]);}else{logger[_0xbf24('0x11')](_0xbf24('0xc'),_0x5c8604,_0xbf24('0xe'));_0x14f04c(_0x247bb6[_0xbf24('0x12')][_0xbf24('0x10')]);}})[_0xbf24('0x13')](function(_0x1a55f7){logger[_0xbf24('0xf')](_0xbf24('0xc'),_0x5c8604,_0x1a55f7);_0x5b05c6(_0x1a55f7);});});}exports[_0xbf24('0x14')]=function(_0x59d835){var _0x4bdb56=this;return new Promise(function(_0x2fd1ba,_0x18eb48){return db['ZendeskAccount'][_0xbf24('0x15')]({'raw':_0x59d835['options']?_0x59d835[_0xbf24('0x16')][_0xbf24('0x17')]===undefined?!![]:![]:!![],'where':_0x59d835['options']?_0x59d835['options']['where']||null:null,'attributes':_0x59d835[_0xbf24('0x16')]?_0x59d835['options']['attributes']||null:null,'limit':_0x59d835[_0xbf24('0x16')]?_0x59d835[_0xbf24('0x16')]['limit']||null:null,'include':_0x59d835['options']?_0x59d835[_0xbf24('0x16')]['include']?_[_0xbf24('0x18')](_0x59d835['options'][_0xbf24('0x19')],function(_0x2247be){return{'model':db[_0x2247be[_0xbf24('0x1a')]],'as':_0x2247be['as'],'attributes':_0x2247be[_0xbf24('0x1b')],'include':_0x2247be[_0xbf24('0x19')]?_[_0xbf24('0x18')](_0x2247be[_0xbf24('0x19')],function(_0x4349d1){return{'model':db[_0x4349d1[_0xbf24('0x1a')]],'as':_0x4349d1['as'],'attributes':_0x4349d1[_0xbf24('0x1b')],'include':_0x4349d1['include']?_['map'](_0x4349d1[_0xbf24('0x19')],function(_0x5b4e6e){return{'model':db[_0x5b4e6e[_0xbf24('0x1a')]],'as':_0x5b4e6e['as'],'attributes':_0x5b4e6e['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf24('0xb')](function(_0x21c6a0){logger['info'](_0xbf24('0x14'),_0x59d835);logger[_0xbf24('0xd')](_0xbf24('0x14'),_0x59d835,JSON[_0xbf24('0x1c')](_0x21c6a0));_0x2fd1ba(_0x21c6a0);})[_0xbf24('0x13')](function(_0x413f6d){logger[_0xbf24('0xf')](_0xbf24('0x14'),_0x413f6d[_0xbf24('0x10')],_0x59d835);_0x18eb48(_0x4bdb56[_0xbf24('0xf')](0x1f4,_0x413f6d['message']));});});};exports[_0xbf24('0x1d')]=function(_0x1dee7b){var _0xdbb645=this;return new Promise(function(_0x3343e4,_0x373ad6){return db[_0xbf24('0x1e')][_0xbf24('0x1f')]({'raw':_0x1dee7b[_0xbf24('0x16')]?_0x1dee7b[_0xbf24('0x16')][_0xbf24('0x17')]===undefined?!![]:![]:!![],'where':_0x1dee7b[_0xbf24('0x16')]?_0x1dee7b['options'][_0xbf24('0x20')]||null:null,'attributes':_0x1dee7b[_0xbf24('0x16')]?_0x1dee7b[_0xbf24('0x16')][_0xbf24('0x1b')]||null:null,'include':_0x1dee7b['options']?_0x1dee7b[_0xbf24('0x16')][_0xbf24('0x19')]?_[_0xbf24('0x18')](_0x1dee7b[_0xbf24('0x16')][_0xbf24('0x19')],function(_0x34afc0){return{'model':db[_0x34afc0[_0xbf24('0x1a')]],'as':_0x34afc0['as'],'attributes':_0x34afc0['attributes'],'include':_0x34afc0[_0xbf24('0x19')]?_[_0xbf24('0x18')](_0x34afc0[_0xbf24('0x19')],function(_0x4312de){return{'model':db[_0x4312de[_0xbf24('0x1a')]],'as':_0x4312de['as'],'attributes':_0x4312de[_0xbf24('0x1b')],'include':_0x4312de[_0xbf24('0x19')]?_[_0xbf24('0x18')](_0x4312de['include'],function(_0x4b9f06){return{'model':db[_0x4b9f06[_0xbf24('0x1a')]],'as':_0x4b9f06['as'],'attributes':_0x4b9f06['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf24('0xb')](function(_0x2bc310){logger['info'](_0xbf24('0x1d'),_0x1dee7b);logger[_0xbf24('0xd')](_0xbf24('0x1d'),_0x1dee7b,JSON['stringify'](_0x2bc310));_0x3343e4(_0x2bc310);})[_0xbf24('0x13')](function(_0x37d808){logger[_0xbf24('0xf')]('ShowZendeskAccount',_0x37d808[_0xbf24('0x10')],_0x1dee7b);_0x373ad6(_0xdbb645[_0xbf24('0xf')](0x1f4,_0x37d808['message']));});});}; \ No newline at end of file +var _0x8e8a=['attributes','limit','include','map','model','then','ShowZendeskAccount','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where'];(function(_0x3d0429,_0x36c936){var _0x315636=function(_0x4d3ee9){while(--_0x4d3ee9){_0x3d0429['push'](_0x3d0429['shift']());}};_0x315636(++_0x36c936);}(_0x8e8a,0x9d));var _0xa8e8=function(_0x3a5457,_0xab1659){_0x3a5457=_0x3a5457-0x0;var _0x51d08c=_0x8e8a[_0x3a5457];return _0x51d08c;};'use strict';var _=require('lodash');var util=require(_0xa8e8('0x0'));var moment=require(_0xa8e8('0x1'));var BPromise=require('bluebird');var rs=require(_0xa8e8('0x2'));var fs=require('fs');var Redis=require(_0xa8e8('0x3'));var db=require(_0xa8e8('0x4'))['db'];var utils=require(_0xa8e8('0x5'));var logger=require(_0xa8e8('0x6'))(_0xa8e8('0x7'));var config=require(_0xa8e8('0x8'));var jayson=require(_0xa8e8('0x9'));var client=jayson[_0xa8e8('0xa')][_0xa8e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f4a54,_0x4edec7,_0xdc924c){return new BPromise(function(_0x4406e7,_0x3e2f1e){return client[_0xa8e8('0xc')](_0x1f4a54,_0xdc924c)['then'](function(_0x509ed9){logger[_0xa8e8('0xd')](_0xa8e8('0xe'),_0x4edec7,_0xa8e8('0xf'));logger[_0xa8e8('0x10')](_0xa8e8('0x11'),_0x4edec7,_0xa8e8('0xf'),JSON[_0xa8e8('0x12')](_0x509ed9));if(_0x509ed9[_0xa8e8('0x13')]){if(_0x509ed9[_0xa8e8('0x13')]['code']===0x1f4){logger[_0xa8e8('0x13')](_0xa8e8('0xe'),_0x4edec7,_0x509ed9[_0xa8e8('0x13')][_0xa8e8('0x14')]);return _0x3e2f1e(_0x509ed9['error'][_0xa8e8('0x14')]);}logger[_0xa8e8('0x13')](_0xa8e8('0xe'),_0x4edec7,_0x509ed9[_0xa8e8('0x13')][_0xa8e8('0x14')]);return _0x4406e7(_0x509ed9[_0xa8e8('0x13')][_0xa8e8('0x14')]);}else{logger[_0xa8e8('0xd')](_0xa8e8('0xe'),_0x4edec7,_0xa8e8('0xf'));_0x4406e7(_0x509ed9[_0xa8e8('0x15')][_0xa8e8('0x14')]);}})[_0xa8e8('0x16')](function(_0x54375a){logger[_0xa8e8('0x13')](_0xa8e8('0xe'),_0x4edec7,_0x54375a);_0x3e2f1e(_0x54375a);});});}exports[_0xa8e8('0x17')]=function(_0x3fe196){var _0x24c8a7=this;return new Promise(function(_0x811ccd,_0x240887){return db[_0xa8e8('0x18')][_0xa8e8('0x19')]({'raw':_0x3fe196[_0xa8e8('0x1a')]?_0x3fe196[_0xa8e8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3fe196[_0xa8e8('0x1a')]?_0x3fe196[_0xa8e8('0x1a')][_0xa8e8('0x1b')]||null:null,'attributes':_0x3fe196[_0xa8e8('0x1a')]?_0x3fe196[_0xa8e8('0x1a')][_0xa8e8('0x1c')]||null:null,'limit':_0x3fe196[_0xa8e8('0x1a')]?_0x3fe196[_0xa8e8('0x1a')][_0xa8e8('0x1d')]||null:null,'include':_0x3fe196['options']?_0x3fe196['options'][_0xa8e8('0x1e')]?_[_0xa8e8('0x1f')](_0x3fe196[_0xa8e8('0x1a')]['include'],function(_0xa69191){return{'model':db[_0xa69191[_0xa8e8('0x20')]],'as':_0xa69191['as'],'attributes':_0xa69191['attributes'],'include':_0xa69191['include']?_['map'](_0xa69191[_0xa8e8('0x1e')],function(_0x31bf3c){return{'model':db[_0x31bf3c[_0xa8e8('0x20')]],'as':_0x31bf3c['as'],'attributes':_0x31bf3c[_0xa8e8('0x1c')],'include':_0x31bf3c[_0xa8e8('0x1e')]?_[_0xa8e8('0x1f')](_0x31bf3c[_0xa8e8('0x1e')],function(_0x952205){return{'model':db[_0x952205['model']],'as':_0x952205['as'],'attributes':_0x952205[_0xa8e8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa8e8('0x21')](function(_0x79babb){logger[_0xa8e8('0xd')](_0xa8e8('0x17'),_0x3fe196);logger[_0xa8e8('0x10')](_0xa8e8('0x17'),_0x3fe196,JSON[_0xa8e8('0x12')](_0x79babb));_0x811ccd(_0x79babb);})['catch'](function(_0xa832ba){logger[_0xa8e8('0x13')](_0xa8e8('0x17'),_0xa832ba[_0xa8e8('0x14')],_0x3fe196);_0x240887(_0x24c8a7[_0xa8e8('0x13')](0x1f4,_0xa832ba[_0xa8e8('0x14')]));});});};exports[_0xa8e8('0x22')]=function(_0x4e4f63){var _0x152086=this;return new Promise(function(_0xf8cbeb,_0x1770db){return db['ZendeskAccount'][_0xa8e8('0x23')]({'raw':_0x4e4f63[_0xa8e8('0x1a')]?_0x4e4f63[_0xa8e8('0x1a')][_0xa8e8('0x24')]===undefined?!![]:![]:!![],'where':_0x4e4f63['options']?_0x4e4f63[_0xa8e8('0x1a')][_0xa8e8('0x1b')]||null:null,'attributes':_0x4e4f63[_0xa8e8('0x1a')]?_0x4e4f63[_0xa8e8('0x1a')][_0xa8e8('0x1c')]||null:null,'include':_0x4e4f63[_0xa8e8('0x1a')]?_0x4e4f63[_0xa8e8('0x1a')][_0xa8e8('0x1e')]?_[_0xa8e8('0x1f')](_0x4e4f63[_0xa8e8('0x1a')]['include'],function(_0x25057b){return{'model':db[_0x25057b['model']],'as':_0x25057b['as'],'attributes':_0x25057b[_0xa8e8('0x1c')],'include':_0x25057b[_0xa8e8('0x1e')]?_[_0xa8e8('0x1f')](_0x25057b[_0xa8e8('0x1e')],function(_0x4f1411){return{'model':db[_0x4f1411['model']],'as':_0x4f1411['as'],'attributes':_0x4f1411[_0xa8e8('0x1c')],'include':_0x4f1411[_0xa8e8('0x1e')]?_[_0xa8e8('0x1f')](_0x4f1411['include'],function(_0x2d8b4a){return{'model':db[_0x2d8b4a['model']],'as':_0x2d8b4a['as'],'attributes':_0x2d8b4a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa8e8('0x21')](function(_0x2a4aff){logger['info']('ShowZendeskAccount',_0x4e4f63);logger[_0xa8e8('0x10')](_0xa8e8('0x22'),_0x4e4f63,JSON['stringify'](_0x2a4aff));_0xf8cbeb(_0x2a4aff);})[_0xa8e8('0x16')](function(_0x1d83af){logger[_0xa8e8('0x13')](_0xa8e8('0x22'),_0x1d83af[_0xa8e8('0x14')],_0x4e4f63);_0x1770db(_0x152086[_0xa8e8('0x13')](0x1f4,_0x1d83af[_0xa8e8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8b4778e..dc5c777 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 _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x20634c,_0x5534fc){var _0x5d8936=function(_0x6b45f2){while(--_0x6b45f2){_0x20634c['push'](_0x20634c['shift']());}};_0x5d8936(++_0x5534fc);}(_0x4483,0x1a3));var _0x3448=function(_0x447dd1,_0x55b6a2){_0x447dd1=_0x447dd1-0x0;var _0xed5166=_0x4483[_0x447dd1];return _0xed5166;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file +var _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x215f7a,_0x58061a){var _0x4e806d=function(_0xfae9da){while(--_0xfae9da){_0x215f7a['push'](_0x215f7a['shift']());}};_0x4e806d(++_0x58061a);}(_0x5c00,0x17e));var _0x05c0=function(_0x55da99,_0x4a6b0c){_0x55da99=_0x55da99-0x0;var _0x575612=_0x5c00[_0x55da99];return _0x575612;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index ec73a47..4373a12 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 _0x9e38=['sequelize','exports','STRING'];(function(_0x40e740,_0x1362a0){var _0x32098e=function(_0x1366f5){while(--_0x1366f5){_0x40e740['push'](_0x40e740['shift']());}};_0x32098e(++_0x1362a0);}(_0x9e38,0x93));var _0x89e3=function(_0x157d23,_0x4027b9){_0x157d23=_0x157d23-0x0;var _0x5b93cc=_0x9e38[_0x157d23];return _0x5b93cc;};'use strict';var Sequelize=require(_0x89e3('0x0'));module[_0x89e3('0x1')]={'name':{'type':Sequelize[_0x89e3('0x2')]},'description':{'type':Sequelize[_0x89e3('0x2')]}}; \ No newline at end of file +var _0xa38b=['exports','STRING','sequelize'];(function(_0x1d2195,_0x4b8096){var _0x4962cd=function(_0x301f5a){while(--_0x301f5a){_0x1d2195['push'](_0x1d2195['shift']());}};_0x4962cd(++_0x4b8096);}(_0xa38b,0x101));var _0xba38=function(_0x4e7e76,_0x4b19c7){_0x4e7e76=_0x4e7e76-0x0;var _0x18c031=_0xa38b[_0x4e7e76];return _0x18c031;};'use strict';var Sequelize=require(_0xba38('0x0'));module[_0xba38('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba38('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e5b78fd..68b5fd2 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 _0xd656=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','update','find','destroy','findOne','ZendeskField','length','pick','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','then','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','keys','query'];(function(_0x1eebbf,_0x4b4e5f){var _0xf46b0c=function(_0x2f4c12){while(--_0x2f4c12){_0x1eebbf['push'](_0x1eebbf['shift']());}};_0xf46b0c(++_0x4b4e5f);}(_0xd656,0x11d));var _0x6d65=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd656[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x6d65('0x0'));var rimraf=require(_0x6d65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d65('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6d65('0x3'));var util=require('util');var path=require(_0x6d65('0x4'));var sox=require(_0x6d65('0x5'));var csv=require(_0x6d65('0x6'));var ejs=require(_0x6d65('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d65('0x8'));var squel=require(_0x6d65('0x9'));var crypto=require(_0x6d65('0xa'));var jsforce=require(_0x6d65('0xb'));var deskjs=require(_0x6d65('0xc'));var toCsv=require(_0x6d65('0x6'));var querystring=require('querystring');var Papa=require(_0x6d65('0xd'));var Redis=require(_0x6d65('0xe'));var authService=require(_0x6d65('0xf'));var qs=require(_0x6d65('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d65('0x11'))(_0x6d65('0x12'));var utils=require(_0x6d65('0x13'));var config=require(_0x6d65('0x14'));var licenseUtil=require(_0x6d65('0x15'));var db=require(_0x6d65('0x16'))['db'];function respondWithStatusCode(_0x5e928d,_0x30aacb){_0x30aacb=_0x30aacb||0xcc;return function(_0x3c24b2){if(_0x3c24b2){return _0x5e928d[_0x6d65('0x17')](_0x30aacb);}return _0x5e928d[_0x6d65('0x18')](_0x30aacb)[_0x6d65('0x19')]();};}function respondWithResult(_0x3855cc,_0x2781d3){_0x2781d3=_0x2781d3||0xc8;return function(_0x2c4620){if(_0x2c4620){return _0x3855cc[_0x6d65('0x18')](_0x2781d3)[_0x6d65('0x1a')](_0x2c4620);}};}function respondWithFilteredResult(_0x1ae3f7,_0x3ecff3){return function(_0x4364b5){if(_0x4364b5){var _0x59f656=typeof _0x3ecff3['offset']==='undefined'&&typeof _0x3ecff3[_0x6d65('0x1b')]===_0x6d65('0x1c');var _0x120e6c=_0x4364b5[_0x6d65('0x1d')];var _0x249c72=_0x59f656?0x0:_0x3ecff3[_0x6d65('0x1e')];var _0xa4b1d5=_0x59f656?_0x4364b5[_0x6d65('0x1d')]:_0x3ecff3['offset']+_0x3ecff3[_0x6d65('0x1b')];var _0x265bfa;if(_0xa4b1d5>=_0x120e6c){_0xa4b1d5=_0x120e6c;_0x265bfa=0xc8;}else{_0x265bfa=0xce;}_0x1ae3f7[_0x6d65('0x18')](_0x265bfa);return _0x1ae3f7['set'](_0x6d65('0x1f'),_0x249c72+'-'+_0xa4b1d5+'/'+_0x120e6c)[_0x6d65('0x1a')](_0x4364b5);}return null;};}function patchUpdates(_0x50fe0b){return function(_0x36d756){try{jsonpatch[_0x6d65('0x20')](_0x36d756,_0x50fe0b,!![]);}catch(_0x503511){return BPromise[_0x6d65('0x21')](_0x503511);}return _0x36d756['save']();};}function saveUpdates(_0x5a857b,_0x39bea0){return function(_0x3f29c6){if(_0x3f29c6){return _0x3f29c6['update'](_0x5a857b)[_0x6d65('0x22')](function(_0x2189c1){return _0x2189c1;});}return null;};}function removeEntity(_0x488bfe,_0x33da3e){return function(_0x32c5f3){if(_0x32c5f3){return _0x32c5f3['destroy']()[_0x6d65('0x22')](function(){_0x488bfe[_0x6d65('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c3d1a,_0x291cee){return function(_0x144638){if(!_0x144638){_0x4c3d1a['sendStatus'](0x194);}return _0x144638;};}function handleError(_0x54fa7f,_0x2bd01f){_0x2bd01f=_0x2bd01f||0x1f4;return function(_0x204687){logger[_0x6d65('0x23')](_0x204687[_0x6d65('0x24')]);if(_0x204687[_0x6d65('0x25')]){delete _0x204687[_0x6d65('0x25')];}_0x54fa7f[_0x6d65('0x18')](_0x2bd01f)['send'](_0x204687);};}exports[_0x6d65('0x26')]=function(_0x1ffb3e,_0x174828){var _0x28173c={},_0x4dcb7d={},_0x4a41a5={'count':0x0,'rows':[]};var _0x2aede0=_[_0x6d65('0x27')](db[_0x6d65('0x28')][_0x6d65('0x29')],function(_0x5aefd7){return{'name':_0x5aefd7[_0x6d65('0x2a')],'type':_0x5aefd7[_0x6d65('0x2b')][_0x6d65('0x2c')]};});_0x4dcb7d['model']=_[_0x6d65('0x27')](_0x2aede0,_0x6d65('0x25'));_0x4dcb7d['query']=_[_0x6d65('0x2d')](_0x1ffb3e[_0x6d65('0x2e')]);_0x4dcb7d[_0x6d65('0x2f')]=_[_0x6d65('0x30')](_0x4dcb7d[_0x6d65('0x31')],_0x4dcb7d['query']);_0x28173c[_0x6d65('0x32')]=_['intersection'](_0x4dcb7d['model'],qs[_0x6d65('0x33')](_0x1ffb3e[_0x6d65('0x2e')][_0x6d65('0x33')]));_0x28173c['attributes']=_0x28173c[_0x6d65('0x32')]['length']?_0x28173c[_0x6d65('0x32')]:_0x4dcb7d[_0x6d65('0x31')];if(!_0x1ffb3e[_0x6d65('0x2e')][_0x6d65('0x34')](_0x6d65('0x35'))){_0x28173c['limit']=qs[_0x6d65('0x1b')](_0x1ffb3e[_0x6d65('0x2e')][_0x6d65('0x1b')]);_0x28173c[_0x6d65('0x1e')]=qs[_0x6d65('0x1e')](_0x1ffb3e[_0x6d65('0x2e')][_0x6d65('0x1e')]);}_0x28173c[_0x6d65('0x36')]=qs[_0x6d65('0x37')](_0x1ffb3e[_0x6d65('0x2e')]['sort']);_0x28173c[_0x6d65('0x38')]=qs['filters'](_['pick'](_0x1ffb3e['query'],_0x4dcb7d[_0x6d65('0x2f')]),_0x2aede0);if(_0x1ffb3e[_0x6d65('0x2e')]['filter']){_0x28173c['where']=_[_0x6d65('0x39')](_0x28173c[_0x6d65('0x38')],{'$or':_[_0x6d65('0x27')](_0x2aede0,function(_0x399385){if(_0x399385[_0x6d65('0x2b')]!==_0x6d65('0x3a')){var _0x8e43f0={};_0x8e43f0[_0x399385[_0x6d65('0x25')]]={'$like':'%'+_0x1ffb3e[_0x6d65('0x2e')][_0x6d65('0x3b')]+'%'};return _0x8e43f0;}})});}_0x28173c=_['merge']({},_0x28173c,_0x1ffb3e[_0x6d65('0x3c')]);var _0x1ee889={'where':_0x28173c[_0x6d65('0x38')]};return db[_0x6d65('0x28')][_0x6d65('0x1d')](_0x1ee889)['then'](function(_0x1cf1f7){_0x4a41a5[_0x6d65('0x1d')]=_0x1cf1f7;if(_0x1ffb3e[_0x6d65('0x2e')][_0x6d65('0x3d')]){_0x28173c[_0x6d65('0x3e')]=[{'all':!![]}];}return db[_0x6d65('0x28')]['findAll'](_0x28173c);})[_0x6d65('0x22')](function(_0x18f5c0){_0x4a41a5[_0x6d65('0x3f')]=_0x18f5c0;return _0x4a41a5;})[_0x6d65('0x22')](respondWithFilteredResult(_0x174828,_0x28173c))[_0x6d65('0x40')](handleError(_0x174828,null));};exports[_0x6d65('0x41')]=function(_0x28cb3b,_0x399303){var _0x5f3cff={'raw':![],'where':{'id':_0x28cb3b[_0x6d65('0x42')]['id']}},_0x24849f={};_0x24849f[_0x6d65('0x31')]=_['keys'](db[_0x6d65('0x28')]['rawAttributes']);_0x24849f[_0x6d65('0x2e')]=_[_0x6d65('0x2d')](_0x28cb3b['query']);_0x24849f[_0x6d65('0x2f')]=_['intersection'](_0x24849f['model'],_0x24849f[_0x6d65('0x2e')]);_0x5f3cff[_0x6d65('0x32')]=_[_0x6d65('0x30')](_0x24849f[_0x6d65('0x31')],qs[_0x6d65('0x33')](_0x28cb3b[_0x6d65('0x2e')][_0x6d65('0x33')]));_0x5f3cff['attributes']=_0x5f3cff[_0x6d65('0x32')]['length']?_0x5f3cff['attributes']:_0x24849f[_0x6d65('0x31')];if(_0x28cb3b[_0x6d65('0x2e')][_0x6d65('0x3d')]){_0x5f3cff[_0x6d65('0x3e')]=[{'all':!![]}];}_0x5f3cff=_[_0x6d65('0x39')]({},_0x5f3cff,_0x28cb3b[_0x6d65('0x3c')]);return db[_0x6d65('0x28')]['find'](_0x5f3cff)[_0x6d65('0x22')](handleEntityNotFound(_0x399303,null))[_0x6d65('0x22')](respondWithResult(_0x399303,null))['catch'](handleError(_0x399303,null));};exports[_0x6d65('0x43')]=function(_0xe247bb,_0x26e296){return db[_0x6d65('0x28')][_0x6d65('0x43')](_0xe247bb[_0x6d65('0x44')],{})[_0x6d65('0x22')](respondWithResult(_0x26e296,0xc9))['catch'](handleError(_0x26e296,null));};exports[_0x6d65('0x45')]=function(_0x33fc67,_0x2b057f){if(_0x33fc67['body']['id']){delete _0x33fc67['body']['id'];}return db['ZendeskConfiguration'][_0x6d65('0x46')]({'where':{'id':_0x33fc67[_0x6d65('0x42')]['id']}})[_0x6d65('0x22')](handleEntityNotFound(_0x2b057f,null))[_0x6d65('0x22')](saveUpdates(_0x33fc67[_0x6d65('0x44')],null))[_0x6d65('0x22')](respondWithResult(_0x2b057f,null))['catch'](handleError(_0x2b057f,null));};exports[_0x6d65('0x47')]=function(_0x32ea2b,_0x348175){return db['ZendeskConfiguration'][_0x6d65('0x46')]({'where':{'id':_0x32ea2b[_0x6d65('0x42')]['id']}})[_0x6d65('0x22')](handleEntityNotFound(_0x348175,null))[_0x6d65('0x22')](removeEntity(_0x348175,null))[_0x6d65('0x40')](handleError(_0x348175,null));};exports['getFields']=function(_0x1a561f,_0x521151,_0x4dfd9f){var _0x567822={};var _0x1d80b7={};var _0x489e5b;var _0x2ac33b;return db[_0x6d65('0x28')][_0x6d65('0x48')]({'where':{'id':_0x1a561f[_0x6d65('0x42')]['id']}})[_0x6d65('0x22')](handleEntityNotFound(_0x521151,null))[_0x6d65('0x22')](function(_0x50ee24){if(_0x50ee24){_0x489e5b=_0x50ee24;_0x1d80b7['model']=_[_0x6d65('0x2d')](db[_0x6d65('0x49')][_0x6d65('0x29')]);_0x1d80b7[_0x6d65('0x2e')]=_['keys'](_0x1a561f[_0x6d65('0x2e')]);_0x1d80b7['filters']=_['intersection'](_0x1d80b7[_0x6d65('0x31')],_0x1d80b7['query']);_0x567822[_0x6d65('0x32')]=_[_0x6d65('0x30')](_0x1d80b7[_0x6d65('0x31')],qs[_0x6d65('0x33')](_0x1a561f['query'][_0x6d65('0x33')]));_0x567822[_0x6d65('0x32')]=_0x567822[_0x6d65('0x32')][_0x6d65('0x4a')]?_0x567822[_0x6d65('0x32')]:_0x1d80b7[_0x6d65('0x31')];_0x567822[_0x6d65('0x36')]=qs[_0x6d65('0x37')](_0x1a561f[_0x6d65('0x2e')]['sort']);_0x567822[_0x6d65('0x38')]=qs[_0x6d65('0x2f')](_[_0x6d65('0x4b')](_0x1a561f[_0x6d65('0x2e')],_0x1d80b7[_0x6d65('0x2f')]));if(_0x1a561f[_0x6d65('0x2e')][_0x6d65('0x3b')]){_0x567822[_0x6d65('0x38')]=_['merge'](_0x567822[_0x6d65('0x38')],{'$or':_['map'](_0x567822['attributes'],function(_0x45ce7e){var _0x235c75={};_0x235c75[_0x45ce7e]={'$like':'%'+_0x1a561f['query'][_0x6d65('0x3b')]+'%'};return _0x235c75;})});}_0x567822=_[_0x6d65('0x39')]({},_0x567822,_0x1a561f[_0x6d65('0x3c')]);return _0x489e5b[_0x6d65('0x4c')](_0x567822);}})[_0x6d65('0x22')](function(_0x27ec4f){if(_0x27ec4f){_0x2ac33b=_0x27ec4f['length'];if(!_0x1a561f['query'][_0x6d65('0x34')]('nolimit')){_0x567822['limit']=qs[_0x6d65('0x1b')](_0x1a561f[_0x6d65('0x2e')][_0x6d65('0x1b')]);_0x567822[_0x6d65('0x1e')]=qs['offset'](_0x1a561f[_0x6d65('0x2e')][_0x6d65('0x1e')]);}return _0x489e5b[_0x6d65('0x4c')](_0x567822);}})[_0x6d65('0x22')](function(_0x1d3e51){if(_0x1d3e51){return _0x1d3e51?{'count':_0x2ac33b,'rows':_0x1d3e51}:null;}})['then'](respondWithResult(_0x521151,null))[_0x6d65('0x40')](handleError(_0x521151,null));};exports[_0x6d65('0x4d')]=function(_0x439c4c,_0x546b61,_0x160b5e){var _0x5f887b={};var _0x93c53e={};var _0x352dd5;var _0x50d232;return db[_0x6d65('0x28')]['findOne']({'where':{'id':_0x439c4c[_0x6d65('0x42')]['id']}})[_0x6d65('0x22')](handleEntityNotFound(_0x546b61,null))[_0x6d65('0x22')](function(_0x266cd8){if(_0x266cd8){_0x352dd5=_0x266cd8;_0x93c53e[_0x6d65('0x31')]=_['keys'](db['ZendeskField'][_0x6d65('0x29')]);_0x93c53e[_0x6d65('0x2e')]=_[_0x6d65('0x2d')](_0x439c4c['query']);_0x93c53e[_0x6d65('0x2f')]=_[_0x6d65('0x30')](_0x93c53e[_0x6d65('0x31')],_0x93c53e[_0x6d65('0x2e')]);_0x5f887b[_0x6d65('0x32')]=_['intersection'](_0x93c53e[_0x6d65('0x31')],qs[_0x6d65('0x33')](_0x439c4c['query'][_0x6d65('0x33')]));_0x5f887b[_0x6d65('0x32')]=_0x5f887b[_0x6d65('0x32')]['length']?_0x5f887b[_0x6d65('0x32')]:_0x93c53e['model'];_0x5f887b['order']=qs['sort'](_0x439c4c[_0x6d65('0x2e')]['sort']);_0x5f887b[_0x6d65('0x38')]=qs[_0x6d65('0x2f')](_[_0x6d65('0x4b')](_0x439c4c[_0x6d65('0x2e')],_0x93c53e[_0x6d65('0x2f')]));if(_0x439c4c[_0x6d65('0x2e')]['filter']){_0x5f887b[_0x6d65('0x38')]=_[_0x6d65('0x39')](_0x5f887b[_0x6d65('0x38')],{'$or':_[_0x6d65('0x27')](_0x5f887b[_0x6d65('0x32')],function(_0x59afde){var _0x204aab={};_0x204aab[_0x59afde]={'$like':'%'+_0x439c4c[_0x6d65('0x2e')][_0x6d65('0x3b')]+'%'};return _0x204aab;})});}_0x5f887b=_[_0x6d65('0x39')]({},_0x5f887b,_0x439c4c[_0x6d65('0x3c')]);return _0x352dd5['getSubjects'](_0x5f887b);}})[_0x6d65('0x22')](function(_0x13842d){if(_0x13842d){_0x50d232=_0x13842d[_0x6d65('0x4a')];if(!_0x439c4c['query'][_0x6d65('0x34')]('nolimit')){_0x5f887b[_0x6d65('0x1b')]=qs['limit'](_0x439c4c['query'][_0x6d65('0x1b')]);_0x5f887b[_0x6d65('0x1e')]=qs[_0x6d65('0x1e')](_0x439c4c[_0x6d65('0x2e')]['offset']);}return _0x352dd5[_0x6d65('0x4d')](_0x5f887b);}})[_0x6d65('0x22')](function(_0x33f242){if(_0x33f242){return _0x33f242?{'count':_0x50d232,'rows':_0x33f242}:null;}})['then'](respondWithResult(_0x546b61,null))[_0x6d65('0x40')](handleError(_0x546b61,null));};exports[_0x6d65('0x4e')]=function(_0x3fb912,_0x47faf5,_0x5dc9a7){var _0x409319={};var _0x310d06={};var _0x31b044;var _0x241e33;return db[_0x6d65('0x28')][_0x6d65('0x48')]({'where':{'id':_0x3fb912[_0x6d65('0x42')]['id']}})[_0x6d65('0x22')](handleEntityNotFound(_0x47faf5,null))[_0x6d65('0x22')](function(_0x4e8d67){if(_0x4e8d67){_0x31b044=_0x4e8d67;_0x310d06[_0x6d65('0x31')]=_[_0x6d65('0x2d')](db[_0x6d65('0x49')][_0x6d65('0x29')]);_0x310d06[_0x6d65('0x2e')]=_[_0x6d65('0x2d')](_0x3fb912[_0x6d65('0x2e')]);_0x310d06[_0x6d65('0x2f')]=_[_0x6d65('0x30')](_0x310d06['model'],_0x310d06[_0x6d65('0x2e')]);_0x409319[_0x6d65('0x32')]=_[_0x6d65('0x30')](_0x310d06[_0x6d65('0x31')],qs[_0x6d65('0x33')](_0x3fb912['query'][_0x6d65('0x33')]));_0x409319['attributes']=_0x409319[_0x6d65('0x32')][_0x6d65('0x4a')]?_0x409319[_0x6d65('0x32')]:_0x310d06[_0x6d65('0x31')];_0x409319[_0x6d65('0x36')]=qs[_0x6d65('0x37')](_0x3fb912[_0x6d65('0x2e')][_0x6d65('0x37')]);_0x409319['where']=qs[_0x6d65('0x2f')](_[_0x6d65('0x4b')](_0x3fb912[_0x6d65('0x2e')],_0x310d06[_0x6d65('0x2f')]));if(_0x3fb912[_0x6d65('0x2e')][_0x6d65('0x3b')]){_0x409319[_0x6d65('0x38')]=_['merge'](_0x409319[_0x6d65('0x38')],{'$or':_[_0x6d65('0x27')](_0x409319['attributes'],function(_0x571f75){var _0x4470e8={};_0x4470e8[_0x571f75]={'$like':'%'+_0x3fb912[_0x6d65('0x2e')]['filter']+'%'};return _0x4470e8;})});}_0x409319=_['merge']({},_0x409319,_0x3fb912[_0x6d65('0x3c')]);return _0x31b044[_0x6d65('0x4e')](_0x409319);}})['then'](function(_0x536104){if(_0x536104){_0x241e33=_0x536104[_0x6d65('0x4a')];if(!_0x3fb912[_0x6d65('0x2e')][_0x6d65('0x34')](_0x6d65('0x35'))){_0x409319['limit']=qs[_0x6d65('0x1b')](_0x3fb912[_0x6d65('0x2e')][_0x6d65('0x1b')]);_0x409319[_0x6d65('0x1e')]=qs[_0x6d65('0x1e')](_0x3fb912[_0x6d65('0x2e')]['offset']);}return _0x31b044[_0x6d65('0x4e')](_0x409319);}})[_0x6d65('0x22')](function(_0x2d86a1){if(_0x2d86a1){return _0x2d86a1?{'count':_0x241e33,'rows':_0x2d86a1}:null;}})[_0x6d65('0x22')](respondWithResult(_0x47faf5,null))['catch'](handleError(_0x47faf5,null));};exports[_0x6d65('0x4f')]=function(_0x482125,_0x41380d,_0x42c7cc){var _0x5b1115={};var _0x16c942={};var _0x3245f9;var _0x12a409;return db['ZendeskConfiguration'][_0x6d65('0x48')]({'where':{'id':_0x482125['params']['id']}})[_0x6d65('0x22')](handleEntityNotFound(_0x41380d,null))[_0x6d65('0x22')](function(_0x3c4d1c){if(_0x3c4d1c){_0x3245f9=_0x3c4d1c;_0x16c942['model']=_[_0x6d65('0x2d')](db[_0x6d65('0x50')][_0x6d65('0x29')]);_0x16c942['query']=_[_0x6d65('0x2d')](_0x482125[_0x6d65('0x2e')]);_0x16c942[_0x6d65('0x2f')]=_[_0x6d65('0x30')](_0x16c942[_0x6d65('0x31')],_0x16c942[_0x6d65('0x2e')]);_0x5b1115['attributes']=_[_0x6d65('0x30')](_0x16c942[_0x6d65('0x31')],qs[_0x6d65('0x33')](_0x482125[_0x6d65('0x2e')][_0x6d65('0x33')]));_0x5b1115[_0x6d65('0x32')]=_0x5b1115['attributes'][_0x6d65('0x4a')]?_0x5b1115['attributes']:_0x16c942[_0x6d65('0x31')];_0x5b1115['order']=qs[_0x6d65('0x37')](_0x482125['query']['sort']);_0x5b1115[_0x6d65('0x38')]=qs[_0x6d65('0x2f')](_[_0x6d65('0x4b')](_0x482125[_0x6d65('0x2e')],_0x16c942['filters']));if(_0x482125['query']['filter']){_0x5b1115[_0x6d65('0x38')]=_[_0x6d65('0x39')](_0x5b1115[_0x6d65('0x38')],{'$or':_[_0x6d65('0x27')](_0x5b1115[_0x6d65('0x32')],function(_0x31c792){var _0x59a95f={};_0x59a95f[_0x31c792]={'$like':'%'+_0x482125['query']['filter']+'%'};return _0x59a95f;})});}_0x5b1115=_['merge']({},_0x5b1115,_0x482125[_0x6d65('0x3c')]);return _0x3245f9[_0x6d65('0x4f')](_0x5b1115);}})[_0x6d65('0x22')](function(_0x516b6c){if(_0x516b6c){_0x12a409=_0x516b6c[_0x6d65('0x4a')];if(!_0x482125[_0x6d65('0x2e')][_0x6d65('0x34')](_0x6d65('0x35'))){_0x5b1115[_0x6d65('0x1b')]=qs[_0x6d65('0x1b')](_0x482125[_0x6d65('0x2e')][_0x6d65('0x1b')]);_0x5b1115[_0x6d65('0x1e')]=qs[_0x6d65('0x1e')](_0x482125[_0x6d65('0x2e')][_0x6d65('0x1e')]);}return _0x3245f9[_0x6d65('0x4f')](_0x5b1115);}})[_0x6d65('0x22')](function(_0x3c4362){if(_0x3c4362){return _0x3c4362?{'count':_0x12a409,'rows':_0x3c4362}:null;}})[_0x6d65('0x22')](respondWithResult(_0x41380d,null))[_0x6d65('0x40')](handleError(_0x41380d,null));};exports[_0x6d65('0x51')]=function(_0x53f265,_0x4bf333,_0x3653a5){if(_0x53f265[_0x6d65('0x44')]['id']){delete _0x53f265['body']['id'];}return db[_0x6d65('0x28')][_0x6d65('0x48')]({'where':{'id':_0x53f265[_0x6d65('0x42')]['id']}})[_0x6d65('0x22')](handleEntityNotFound(_0x4bf333,null))['then'](function(_0x1f8308){if(_0x1f8308){return _0x1f8308['setTags'](_0x53f265[_0x6d65('0x44')][_0x6d65('0x52')]||[]);}return null;})[_0x6d65('0x22')](respondWithResult(_0x4bf333,null))[_0x6d65('0x40')](handleError(_0x4bf333,null));}; \ No newline at end of file +var _0x4150=['includeAll','findAll','rows','catch','show','params','find','create','body','findOne','nolimit','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4150,0x110));var _0x0415=function(_0x5b81f8,_0x2111a5){_0x5b81f8=_0x5b81f8-0x0;var _0xdbef55=_0x4150[_0x5b81f8];return _0xdbef55;};'use strict';var emlformat=require(_0x0415('0x0'));var rimraf=require(_0x0415('0x1'));var zipdir=require(_0x0415('0x2'));var jsonpatch=require(_0x0415('0x3'));var rp=require(_0x0415('0x4'));var moment=require(_0x0415('0x5'));var BPromise=require(_0x0415('0x6'));var Mustache=require(_0x0415('0x7'));var util=require(_0x0415('0x8'));var path=require('path');var sox=require(_0x0415('0x9'));var csv=require(_0x0415('0xa'));var ejs=require(_0x0415('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0415('0xc'));var squel=require(_0x0415('0xd'));var crypto=require('crypto');var jsforce=require(_0x0415('0xe'));var deskjs=require(_0x0415('0xf'));var toCsv=require(_0x0415('0xa'));var querystring=require('querystring');var Papa=require(_0x0415('0x10'));var Redis=require(_0x0415('0x11'));var authService=require(_0x0415('0x12'));var qs=require(_0x0415('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0415('0x14'));var logger=require(_0x0415('0x15'))(_0x0415('0x16'));var utils=require(_0x0415('0x17'));var config=require(_0x0415('0x18'));var licenseUtil=require(_0x0415('0x19'));var db=require(_0x0415('0x1a'))['db'];function respondWithStatusCode(_0x62a457,_0x47fe1c){_0x47fe1c=_0x47fe1c||0xcc;return function(_0x5d6287){if(_0x5d6287){return _0x62a457[_0x0415('0x1b')](_0x47fe1c);}return _0x62a457['status'](_0x47fe1c)[_0x0415('0x1c')]();};}function respondWithResult(_0x3640c3,_0x5aacbe){_0x5aacbe=_0x5aacbe||0xc8;return function(_0x2ed6ad){if(_0x2ed6ad){return _0x3640c3[_0x0415('0x1d')](_0x5aacbe)[_0x0415('0x1e')](_0x2ed6ad);}};}function respondWithFilteredResult(_0x13a773,_0x2274b5){return function(_0xd12578){if(_0xd12578){var _0x1b13ab=typeof _0x2274b5['offset']===_0x0415('0x1f')&&typeof _0x2274b5[_0x0415('0x20')]==='undefined';var _0x11c4c7=_0xd12578[_0x0415('0x21')];var _0x4b89f9=_0x1b13ab?0x0:_0x2274b5['offset'];var _0x5d86a0=_0x1b13ab?_0xd12578['count']:_0x2274b5[_0x0415('0x22')]+_0x2274b5[_0x0415('0x20')];var _0x1df9d8;if(_0x5d86a0>=_0x11c4c7){_0x5d86a0=_0x11c4c7;_0x1df9d8=0xc8;}else{_0x1df9d8=0xce;}_0x13a773[_0x0415('0x1d')](_0x1df9d8);return _0x13a773['set'](_0x0415('0x23'),_0x4b89f9+'-'+_0x5d86a0+'/'+_0x11c4c7)[_0x0415('0x1e')](_0xd12578);}return null;};}function patchUpdates(_0x2226b2){return function(_0xd96142){try{jsonpatch['apply'](_0xd96142,_0x2226b2,!![]);}catch(_0xf56f55){return BPromise[_0x0415('0x24')](_0xf56f55);}return _0xd96142[_0x0415('0x25')]();};}function saveUpdates(_0xb6d4b9,_0x4f4d98){return function(_0x486986){if(_0x486986){return _0x486986[_0x0415('0x26')](_0xb6d4b9)['then'](function(_0x451399){return _0x451399;});}return null;};}function removeEntity(_0x490865,_0x5d1248){return function(_0xc88d9c){if(_0xc88d9c){return _0xc88d9c[_0x0415('0x27')]()['then'](function(){_0x490865['status'](0xcc)[_0x0415('0x1c')]();});}};}function handleEntityNotFound(_0x518904,_0x473528){return function(_0x2865b5){if(!_0x2865b5){_0x518904['sendStatus'](0x194);}return _0x2865b5;};}function handleError(_0x314292,_0x45e755){_0x45e755=_0x45e755||0x1f4;return function(_0x148ab6){logger[_0x0415('0x28')](_0x148ab6[_0x0415('0x29')]);if(_0x148ab6[_0x0415('0x2a')]){delete _0x148ab6[_0x0415('0x2a')];}_0x314292[_0x0415('0x1d')](_0x45e755)[_0x0415('0x2b')](_0x148ab6);};}exports['index']=function(_0x41d58f,_0x26d5d5){var _0x20eafb={},_0x3aa662={},_0x16b4ea={'count':0x0,'rows':[]};var _0x54bfd4=_[_0x0415('0x2c')](db[_0x0415('0x2d')][_0x0415('0x2e')],function(_0x127c08){return{'name':_0x127c08[_0x0415('0x2f')],'type':_0x127c08[_0x0415('0x30')][_0x0415('0x31')]};});_0x3aa662[_0x0415('0x32')]=_[_0x0415('0x2c')](_0x54bfd4,_0x0415('0x2a'));_0x3aa662['query']=_[_0x0415('0x33')](_0x41d58f[_0x0415('0x34')]);_0x3aa662[_0x0415('0x35')]=_['intersection'](_0x3aa662[_0x0415('0x32')],_0x3aa662[_0x0415('0x34')]);_0x20eafb['attributes']=_[_0x0415('0x36')](_0x3aa662['model'],qs[_0x0415('0x37')](_0x41d58f[_0x0415('0x34')][_0x0415('0x37')]));_0x20eafb['attributes']=_0x20eafb[_0x0415('0x38')][_0x0415('0x39')]?_0x20eafb[_0x0415('0x38')]:_0x3aa662[_0x0415('0x32')];if(!_0x41d58f[_0x0415('0x34')][_0x0415('0x3a')]('nolimit')){_0x20eafb[_0x0415('0x20')]=qs[_0x0415('0x20')](_0x41d58f[_0x0415('0x34')]['limit']);_0x20eafb['offset']=qs['offset'](_0x41d58f[_0x0415('0x34')]['offset']);}_0x20eafb[_0x0415('0x3b')]=qs[_0x0415('0x3c')](_0x41d58f[_0x0415('0x34')]['sort']);_0x20eafb[_0x0415('0x3d')]=qs[_0x0415('0x35')](_[_0x0415('0x3e')](_0x41d58f['query'],_0x3aa662[_0x0415('0x35')]),_0x54bfd4);if(_0x41d58f[_0x0415('0x34')][_0x0415('0x3f')]){_0x20eafb[_0x0415('0x3d')]=_['merge'](_0x20eafb[_0x0415('0x3d')],{'$or':_[_0x0415('0x2c')](_0x54bfd4,function(_0x17dcdb){if(_0x17dcdb[_0x0415('0x30')]!==_0x0415('0x40')){var _0x2b1f83={};_0x2b1f83[_0x17dcdb[_0x0415('0x2a')]]={'$like':'%'+_0x41d58f[_0x0415('0x34')][_0x0415('0x3f')]+'%'};return _0x2b1f83;}})});}_0x20eafb=_[_0x0415('0x41')]({},_0x20eafb,_0x41d58f[_0x0415('0x42')]);var _0x27cdf9={'where':_0x20eafb[_0x0415('0x3d')]};return db[_0x0415('0x2d')]['count'](_0x27cdf9)[_0x0415('0x43')](function(_0x25ef04){_0x16b4ea['count']=_0x25ef04;if(_0x41d58f[_0x0415('0x34')][_0x0415('0x44')]){_0x20eafb['include']=[{'all':!![]}];}return db[_0x0415('0x2d')][_0x0415('0x45')](_0x20eafb);})[_0x0415('0x43')](function(_0x4fd628){_0x16b4ea[_0x0415('0x46')]=_0x4fd628;return _0x16b4ea;})['then'](respondWithFilteredResult(_0x26d5d5,_0x20eafb))[_0x0415('0x47')](handleError(_0x26d5d5,null));};exports[_0x0415('0x48')]=function(_0x556ac3,_0x1e2ff1){var _0x21968b={'raw':![],'where':{'id':_0x556ac3[_0x0415('0x49')]['id']}},_0x6e53b3={};_0x6e53b3['model']=_[_0x0415('0x33')](db['ZendeskConfiguration']['rawAttributes']);_0x6e53b3[_0x0415('0x34')]=_[_0x0415('0x33')](_0x556ac3[_0x0415('0x34')]);_0x6e53b3['filters']=_['intersection'](_0x6e53b3['model'],_0x6e53b3['query']);_0x21968b[_0x0415('0x38')]=_[_0x0415('0x36')](_0x6e53b3[_0x0415('0x32')],qs[_0x0415('0x37')](_0x556ac3[_0x0415('0x34')][_0x0415('0x37')]));_0x21968b[_0x0415('0x38')]=_0x21968b[_0x0415('0x38')][_0x0415('0x39')]?_0x21968b['attributes']:_0x6e53b3[_0x0415('0x32')];if(_0x556ac3[_0x0415('0x34')]['includeAll']){_0x21968b['include']=[{'all':!![]}];}_0x21968b=_[_0x0415('0x41')]({},_0x21968b,_0x556ac3[_0x0415('0x42')]);return db[_0x0415('0x2d')][_0x0415('0x4a')](_0x21968b)[_0x0415('0x43')](handleEntityNotFound(_0x1e2ff1,null))[_0x0415('0x43')](respondWithResult(_0x1e2ff1,null))['catch'](handleError(_0x1e2ff1,null));};exports[_0x0415('0x4b')]=function(_0x272084,_0x29dfbc){return db[_0x0415('0x2d')][_0x0415('0x4b')](_0x272084[_0x0415('0x4c')],{})[_0x0415('0x43')](respondWithResult(_0x29dfbc,0xc9))['catch'](handleError(_0x29dfbc,null));};exports[_0x0415('0x26')]=function(_0x1b3cf7,_0x49d54f){if(_0x1b3cf7[_0x0415('0x4c')]['id']){delete _0x1b3cf7['body']['id'];}return db[_0x0415('0x2d')][_0x0415('0x4a')]({'where':{'id':_0x1b3cf7[_0x0415('0x49')]['id']}})[_0x0415('0x43')](handleEntityNotFound(_0x49d54f,null))[_0x0415('0x43')](saveUpdates(_0x1b3cf7[_0x0415('0x4c')],null))[_0x0415('0x43')](respondWithResult(_0x49d54f,null))[_0x0415('0x47')](handleError(_0x49d54f,null));};exports[_0x0415('0x27')]=function(_0x381c89,_0x525f1c){return db['ZendeskConfiguration'][_0x0415('0x4a')]({'where':{'id':_0x381c89['params']['id']}})['then'](handleEntityNotFound(_0x525f1c,null))[_0x0415('0x43')](removeEntity(_0x525f1c,null))[_0x0415('0x47')](handleError(_0x525f1c,null));};exports['getFields']=function(_0x181e38,_0x5b573e,_0x3b64f6){var _0x298c17={};var _0x7b039f={};var _0x4d33ca;var _0x5161de;return db[_0x0415('0x2d')][_0x0415('0x4d')]({'where':{'id':_0x181e38[_0x0415('0x49')]['id']}})[_0x0415('0x43')](handleEntityNotFound(_0x5b573e,null))[_0x0415('0x43')](function(_0x5cc1df){if(_0x5cc1df){_0x4d33ca=_0x5cc1df;_0x7b039f[_0x0415('0x32')]=_[_0x0415('0x33')](db['ZendeskField'][_0x0415('0x2e')]);_0x7b039f[_0x0415('0x34')]=_[_0x0415('0x33')](_0x181e38['query']);_0x7b039f[_0x0415('0x35')]=_[_0x0415('0x36')](_0x7b039f[_0x0415('0x32')],_0x7b039f['query']);_0x298c17[_0x0415('0x38')]=_[_0x0415('0x36')](_0x7b039f[_0x0415('0x32')],qs['fields'](_0x181e38[_0x0415('0x34')][_0x0415('0x37')]));_0x298c17[_0x0415('0x38')]=_0x298c17[_0x0415('0x38')]['length']?_0x298c17[_0x0415('0x38')]:_0x7b039f[_0x0415('0x32')];_0x298c17[_0x0415('0x3b')]=qs[_0x0415('0x3c')](_0x181e38[_0x0415('0x34')][_0x0415('0x3c')]);_0x298c17[_0x0415('0x3d')]=qs[_0x0415('0x35')](_[_0x0415('0x3e')](_0x181e38[_0x0415('0x34')],_0x7b039f['filters']));if(_0x181e38[_0x0415('0x34')][_0x0415('0x3f')]){_0x298c17['where']=_['merge'](_0x298c17[_0x0415('0x3d')],{'$or':_[_0x0415('0x2c')](_0x298c17[_0x0415('0x38')],function(_0x25c55a){var _0x1f7c0d={};_0x1f7c0d[_0x25c55a]={'$like':'%'+_0x181e38[_0x0415('0x34')]['filter']+'%'};return _0x1f7c0d;})});}_0x298c17=_[_0x0415('0x41')]({},_0x298c17,_0x181e38[_0x0415('0x42')]);return _0x4d33ca['getFields'](_0x298c17);}})[_0x0415('0x43')](function(_0x293b8a){if(_0x293b8a){_0x5161de=_0x293b8a[_0x0415('0x39')];if(!_0x181e38[_0x0415('0x34')][_0x0415('0x3a')](_0x0415('0x4e'))){_0x298c17['limit']=qs[_0x0415('0x20')](_0x181e38[_0x0415('0x34')][_0x0415('0x20')]);_0x298c17[_0x0415('0x22')]=qs[_0x0415('0x22')](_0x181e38[_0x0415('0x34')][_0x0415('0x22')]);}return _0x4d33ca['getFields'](_0x298c17);}})[_0x0415('0x43')](function(_0x33b1ca){if(_0x33b1ca){return _0x33b1ca?{'count':_0x5161de,'rows':_0x33b1ca}:null;}})[_0x0415('0x43')](respondWithResult(_0x5b573e,null))[_0x0415('0x47')](handleError(_0x5b573e,null));};exports['getSubjects']=function(_0x54ecf7,_0x3a9867,_0x5c1575){var _0x27eb28={};var _0x22fe69={};var _0x297872;var _0x4f9257;return db[_0x0415('0x2d')][_0x0415('0x4d')]({'where':{'id':_0x54ecf7[_0x0415('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a9867,null))[_0x0415('0x43')](function(_0x466153){if(_0x466153){_0x297872=_0x466153;_0x22fe69[_0x0415('0x32')]=_[_0x0415('0x33')](db[_0x0415('0x4f')]['rawAttributes']);_0x22fe69[_0x0415('0x34')]=_['keys'](_0x54ecf7[_0x0415('0x34')]);_0x22fe69[_0x0415('0x35')]=_[_0x0415('0x36')](_0x22fe69[_0x0415('0x32')],_0x22fe69['query']);_0x27eb28[_0x0415('0x38')]=_[_0x0415('0x36')](_0x22fe69[_0x0415('0x32')],qs[_0x0415('0x37')](_0x54ecf7['query'][_0x0415('0x37')]));_0x27eb28[_0x0415('0x38')]=_0x27eb28['attributes'][_0x0415('0x39')]?_0x27eb28[_0x0415('0x38')]:_0x22fe69[_0x0415('0x32')];_0x27eb28[_0x0415('0x3b')]=qs[_0x0415('0x3c')](_0x54ecf7[_0x0415('0x34')][_0x0415('0x3c')]);_0x27eb28[_0x0415('0x3d')]=qs[_0x0415('0x35')](_[_0x0415('0x3e')](_0x54ecf7[_0x0415('0x34')],_0x22fe69[_0x0415('0x35')]));if(_0x54ecf7[_0x0415('0x34')]['filter']){_0x27eb28[_0x0415('0x3d')]=_[_0x0415('0x41')](_0x27eb28[_0x0415('0x3d')],{'$or':_[_0x0415('0x2c')](_0x27eb28['attributes'],function(_0x4575db){var _0x3cec4c={};_0x3cec4c[_0x4575db]={'$like':'%'+_0x54ecf7[_0x0415('0x34')]['filter']+'%'};return _0x3cec4c;})});}_0x27eb28=_[_0x0415('0x41')]({},_0x27eb28,_0x54ecf7[_0x0415('0x42')]);return _0x297872[_0x0415('0x50')](_0x27eb28);}})['then'](function(_0x13b71a){if(_0x13b71a){_0x4f9257=_0x13b71a[_0x0415('0x39')];if(!_0x54ecf7[_0x0415('0x34')]['hasOwnProperty'](_0x0415('0x4e'))){_0x27eb28[_0x0415('0x20')]=qs['limit'](_0x54ecf7['query'][_0x0415('0x20')]);_0x27eb28[_0x0415('0x22')]=qs[_0x0415('0x22')](_0x54ecf7[_0x0415('0x34')][_0x0415('0x22')]);}return _0x297872['getSubjects'](_0x27eb28);}})[_0x0415('0x43')](function(_0x3de1cd){if(_0x3de1cd){return _0x3de1cd?{'count':_0x4f9257,'rows':_0x3de1cd}:null;}})[_0x0415('0x43')](respondWithResult(_0x3a9867,null))['catch'](handleError(_0x3a9867,null));};exports['getDescriptions']=function(_0x16a86c,_0x2abf70,_0x5dc06d){var _0x327abd={};var _0x19fd64={};var _0x25be77;var _0x2685ac;return db['ZendeskConfiguration'][_0x0415('0x4d')]({'where':{'id':_0x16a86c['params']['id']}})[_0x0415('0x43')](handleEntityNotFound(_0x2abf70,null))['then'](function(_0x1f65de){if(_0x1f65de){_0x25be77=_0x1f65de;_0x19fd64[_0x0415('0x32')]=_[_0x0415('0x33')](db['ZendeskField']['rawAttributes']);_0x19fd64['query']=_[_0x0415('0x33')](_0x16a86c[_0x0415('0x34')]);_0x19fd64[_0x0415('0x35')]=_['intersection'](_0x19fd64['model'],_0x19fd64[_0x0415('0x34')]);_0x327abd[_0x0415('0x38')]=_[_0x0415('0x36')](_0x19fd64[_0x0415('0x32')],qs[_0x0415('0x37')](_0x16a86c['query'][_0x0415('0x37')]));_0x327abd[_0x0415('0x38')]=_0x327abd[_0x0415('0x38')][_0x0415('0x39')]?_0x327abd['attributes']:_0x19fd64['model'];_0x327abd['order']=qs[_0x0415('0x3c')](_0x16a86c['query'][_0x0415('0x3c')]);_0x327abd[_0x0415('0x3d')]=qs[_0x0415('0x35')](_[_0x0415('0x3e')](_0x16a86c['query'],_0x19fd64[_0x0415('0x35')]));if(_0x16a86c[_0x0415('0x34')]['filter']){_0x327abd['where']=_['merge'](_0x327abd['where'],{'$or':_[_0x0415('0x2c')](_0x327abd['attributes'],function(_0x57b5bc){var _0x596e13={};_0x596e13[_0x57b5bc]={'$like':'%'+_0x16a86c[_0x0415('0x34')]['filter']+'%'};return _0x596e13;})});}_0x327abd=_['merge']({},_0x327abd,_0x16a86c[_0x0415('0x42')]);return _0x25be77['getDescriptions'](_0x327abd);}})[_0x0415('0x43')](function(_0x133019){if(_0x133019){_0x2685ac=_0x133019[_0x0415('0x39')];if(!_0x16a86c[_0x0415('0x34')][_0x0415('0x3a')]('nolimit')){_0x327abd['limit']=qs[_0x0415('0x20')](_0x16a86c[_0x0415('0x34')][_0x0415('0x20')]);_0x327abd[_0x0415('0x22')]=qs[_0x0415('0x22')](_0x16a86c['query']['offset']);}return _0x25be77[_0x0415('0x51')](_0x327abd);}})[_0x0415('0x43')](function(_0x275958){if(_0x275958){return _0x275958?{'count':_0x2685ac,'rows':_0x275958}:null;}})['then'](respondWithResult(_0x2abf70,null))[_0x0415('0x47')](handleError(_0x2abf70,null));};exports[_0x0415('0x52')]=function(_0x2cd945,_0x3ed629,_0x5685b3){var _0x4a9f37={};var _0xade867={};var _0x3586ce;var _0x172b36;return db[_0x0415('0x2d')]['findOne']({'where':{'id':_0x2cd945[_0x0415('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ed629,null))[_0x0415('0x43')](function(_0xdd87b6){if(_0xdd87b6){_0x3586ce=_0xdd87b6;_0xade867['model']=_[_0x0415('0x33')](db['Tag'][_0x0415('0x2e')]);_0xade867[_0x0415('0x34')]=_[_0x0415('0x33')](_0x2cd945[_0x0415('0x34')]);_0xade867[_0x0415('0x35')]=_['intersection'](_0xade867[_0x0415('0x32')],_0xade867[_0x0415('0x34')]);_0x4a9f37[_0x0415('0x38')]=_[_0x0415('0x36')](_0xade867['model'],qs[_0x0415('0x37')](_0x2cd945[_0x0415('0x34')][_0x0415('0x37')]));_0x4a9f37['attributes']=_0x4a9f37[_0x0415('0x38')]['length']?_0x4a9f37[_0x0415('0x38')]:_0xade867[_0x0415('0x32')];_0x4a9f37[_0x0415('0x3b')]=qs[_0x0415('0x3c')](_0x2cd945[_0x0415('0x34')][_0x0415('0x3c')]);_0x4a9f37[_0x0415('0x3d')]=qs[_0x0415('0x35')](_['pick'](_0x2cd945[_0x0415('0x34')],_0xade867['filters']));if(_0x2cd945[_0x0415('0x34')][_0x0415('0x3f')]){_0x4a9f37[_0x0415('0x3d')]=_[_0x0415('0x41')](_0x4a9f37[_0x0415('0x3d')],{'$or':_['map'](_0x4a9f37[_0x0415('0x38')],function(_0x335ab3){var _0x4da4d4={};_0x4da4d4[_0x335ab3]={'$like':'%'+_0x2cd945[_0x0415('0x34')][_0x0415('0x3f')]+'%'};return _0x4da4d4;})});}_0x4a9f37=_[_0x0415('0x41')]({},_0x4a9f37,_0x2cd945[_0x0415('0x42')]);return _0x3586ce[_0x0415('0x52')](_0x4a9f37);}})['then'](function(_0x3374fb){if(_0x3374fb){_0x172b36=_0x3374fb[_0x0415('0x39')];if(!_0x2cd945[_0x0415('0x34')][_0x0415('0x3a')](_0x0415('0x4e'))){_0x4a9f37[_0x0415('0x20')]=qs[_0x0415('0x20')](_0x2cd945[_0x0415('0x34')]['limit']);_0x4a9f37[_0x0415('0x22')]=qs['offset'](_0x2cd945[_0x0415('0x34')][_0x0415('0x22')]);}return _0x3586ce['getTags'](_0x4a9f37);}})[_0x0415('0x43')](function(_0x462b5e){if(_0x462b5e){return _0x462b5e?{'count':_0x172b36,'rows':_0x462b5e}:null;}})['then'](respondWithResult(_0x3ed629,null))['catch'](handleError(_0x3ed629,null));};exports[_0x0415('0x53')]=function(_0x5edf23,_0x582dba,_0x489bc1){if(_0x5edf23[_0x0415('0x4c')]['id']){delete _0x5edf23[_0x0415('0x4c')]['id'];}return db[_0x0415('0x2d')][_0x0415('0x4d')]({'where':{'id':_0x5edf23[_0x0415('0x49')]['id']}})[_0x0415('0x43')](handleEntityNotFound(_0x582dba,null))[_0x0415('0x43')](function(_0x29865d){if(_0x29865d){return _0x29865d[_0x0415('0x53')](_0x5edf23[_0x0415('0x4c')][_0x0415('0x54')]||[]);}return null;})[_0x0415('0x43')](respondWithResult(_0x582dba,null))[_0x0415('0x47')](handleError(_0x582dba,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ad67ca4..a212a3f 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 _0xda3f=['../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','request-promise','rimraf'];(function(_0x41a788,_0x4ab4fc){var _0x81d4dd=function(_0x1959cf){while(--_0x1959cf){_0x41a788['push'](_0x41a788['shift']());}};_0x81d4dd(++_0x4ab4fc);}(_0xda3f,0xec));var _0xfda3=function(_0x11af5f,_0x246b82){_0x11af5f=_0x11af5f-0x0;var _0x27d84b=_0xda3f[_0x11af5f];return _0x27d84b;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbb=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x5bac46,_0x5f1be3){var _0x4d1d3b=function(_0x529e0c){while(--_0x529e0c){_0x5bac46['push'](_0x5bac46['shift']());}};_0x4d1d3b(++_0x5f1be3);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x59cc66,_0x629408){_0x59cc66=_0x59cc66-0x0;var _0x36837c=_0xfcbb[_0x59cc66];return _0x36837c;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var fs=require('fs');var path=require(_0xbfcb('0x5'));var rimraf=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x32c2aa,_0x4990c){return _0x32c2aa[_0xbfcb('0x8')](_0xbfcb('0x9'),attributes,{'tableName':_0xbfcb('0xa'),'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 2ba8842..a0867d5 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 _0x86d8=['error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x86d8,0xdd));var _0x886d=function(_0x1a28ee,_0x103ece){_0x1a28ee=_0x1a28ee-0x0;var _0xd44a61=_0x86d8[_0x1a28ee];return _0xd44a61;};'use strict';var _=require(_0x886d('0x0'));var util=require('util');var moment=require(_0x886d('0x1'));var BPromise=require(_0x886d('0x2'));var rs=require(_0x886d('0x3'));var fs=require('fs');var Redis=require(_0x886d('0x4'));var db=require(_0x886d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x886d('0x6'));var config=require('../../config/environment');var jayson=require(_0x886d('0x7'));var client=jayson[_0x886d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32f099,_0x4c1b04,_0x3fd03a){return new BPromise(function(_0x15b77d,_0x745aa6){return client['request'](_0x32f099,_0x3fd03a)[_0x886d('0x9')](function(_0x25d294){logger[_0x886d('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4c1b04,_0x886d('0xb'));logger['debug'](_0x886d('0xc'),_0x4c1b04,'request\x20sent',JSON['stringify'](_0x25d294));if(_0x25d294[_0x886d('0xd')]){if(_0x25d294['error']['code']===0x1f4){logger['error'](_0x886d('0xe'),_0x4c1b04,_0x25d294[_0x886d('0xd')][_0x886d('0xf')]);return _0x745aa6(_0x25d294[_0x886d('0xd')][_0x886d('0xf')]);}logger[_0x886d('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4c1b04,_0x25d294[_0x886d('0xd')][_0x886d('0xf')]);return _0x15b77d(_0x25d294[_0x886d('0xd')][_0x886d('0xf')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x4c1b04,'request\x20sent');_0x15b77d(_0x25d294[_0x886d('0x10')]['message']);}})[_0x886d('0x11')](function(_0x4747b4){logger[_0x886d('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4c1b04,_0x4747b4);_0x745aa6(_0x4747b4);});});} \ No newline at end of file +var _0xeeab=['http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client'];(function(_0x9cfca7,_0x3e46df){var _0x237554=function(_0x5c692b){while(--_0x5c692b){_0x9cfca7['push'](_0x9cfca7['shift']());}};_0x237554(++_0x3e46df);}(_0xeeab,0x9f));var _0xbeea=function(_0xcec71a,_0x25dd7c){_0xcec71a=_0xcec71a-0x0;var _0x4b7def=_0xeeab[_0xcec71a];return _0x4b7def;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbeea('0x0'));var rs=require(_0xbeea('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbeea('0x2'));var logger=require('../../config/logger')(_0xbeea('0x3'));var config=require(_0xbeea('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xbeea('0x5')][_0xbeea('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x234b51,_0x5d41e9,_0x13e3be){return new BPromise(function(_0x17ccee,_0x5bf652){return client['request'](_0x234b51,_0x13e3be)[_0xbeea('0x7')](function(_0x117108){logger[_0xbeea('0x8')](_0xbeea('0x9'),_0x5d41e9,_0xbeea('0xa'));logger[_0xbeea('0xb')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5d41e9,_0xbeea('0xa'),JSON['stringify'](_0x117108));if(_0x117108[_0xbeea('0xc')]){if(_0x117108['error'][_0xbeea('0xd')]===0x1f4){logger[_0xbeea('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5d41e9,_0x117108[_0xbeea('0xc')][_0xbeea('0xe')]);return _0x5bf652(_0x117108[_0xbeea('0xc')][_0xbeea('0xe')]);}logger[_0xbeea('0xc')](_0xbeea('0x9'),_0x5d41e9,_0x117108['error'][_0xbeea('0xe')]);return _0x17ccee(_0x117108[_0xbeea('0xc')][_0xbeea('0xe')]);}else{logger[_0xbeea('0x8')](_0xbeea('0x9'),_0x5d41e9,_0xbeea('0xa'));_0x17ccee(_0x117108['result']['message']);}})['catch'](function(_0x59c138){logger[_0xbeea('0xc')](_0xbeea('0x9'),_0x5d41e9,_0x59c138);_0x5bf652(_0x59c138);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 6146edc..d3d3bc8 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 _0xa977=['get','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f2540,_0x10e19b){var _0x151dd6=function(_0x57c8ec){while(--_0x57c8ec){_0x4f2540['push'](_0x4f2540['shift']());}};_0x151dd6(++_0x10e19b);}(_0xa977,0xa9));var _0x7a97=function(_0x3b56bc,_0x20a373){_0x3b56bc=_0x3b56bc-0x0;var _0x18ba5c=_0xa977[_0x3b56bc];return _0x18ba5c;};'use strict';var multer=require(_0x7a97('0x0'));var util=require(_0x7a97('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7a97('0x2'));var router=express['Router']();var fs_extra=require(_0x7a97('0x3'));var auth=require(_0x7a97('0x4'));var interaction=require(_0x7a97('0x5'));var config=require(_0x7a97('0x6'));var controller=require('./intZendeskField.controller');router[_0x7a97('0x7')]('/',auth[_0x7a97('0x8')](),controller['index']);router['get']('/:id',auth[_0x7a97('0x8')](),controller[_0x7a97('0x9')]);router[_0x7a97('0xa')]('/',auth[_0x7a97('0x8')](),controller['create']);router['put'](_0x7a97('0xb'),auth[_0x7a97('0x8')](),controller[_0x7a97('0xc')]);router[_0x7a97('0xd')]('/:id',auth[_0x7a97('0x8')](),controller[_0x7a97('0xe')]);module[_0x7a97('0xf')]=router; \ No newline at end of file +var _0x16b0=['path','connect-timeout','express','fs-extra','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16b0,0x1a8));var _0x016b=function(_0x5f36a9,_0x223fee){_0x5f36a9=_0x5f36a9-0x0;var _0x495322=_0x16b0[_0x5f36a9];return _0x495322;};'use strict';var multer=require('multer');var util=require(_0x016b('0x0'));var path=require(_0x016b('0x1'));var timeout=require(_0x016b('0x2'));var express=require(_0x016b('0x3'));var router=express['Router']();var fs_extra=require(_0x016b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x016b('0x5'));router['get']('/',auth[_0x016b('0x6')](),controller[_0x016b('0x7')]);router[_0x016b('0x8')](_0x016b('0x9'),auth[_0x016b('0x6')](),controller[_0x016b('0xa')]);router[_0x016b('0xb')]('/',auth[_0x016b('0x6')](),controller[_0x016b('0xc')]);router[_0x016b('0xd')](_0x016b('0x9'),auth[_0x016b('0x6')](),controller[_0x016b('0xe')]);router[_0x016b('0xf')](_0x016b('0x9'),auth[_0x016b('0x6')](),controller[_0x016b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 988bb12..19b3a28 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 _0xea4d=['customVariable','BOOLEAN','sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM'];(function(_0x28d9e2,_0x5426b1){var _0x17bd86=function(_0x532137){while(--_0x532137){_0x28d9e2['push'](_0x28d9e2['shift']());}};_0x17bd86(++_0x5426b1);}(_0xea4d,0x106));var _0xdea4=function(_0x102979,_0x2a0ee3){_0x102979=_0x102979-0x0;var _0x2ff2cd=_0xea4d[_0x102979];return _0x2ff2cd;};'use strict';var Sequelize=require(_0xdea4('0x0'));module[_0xdea4('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdea4('0x2'),_0xdea4('0x3'),'customVariable',_0xdea4('0x4'),_0xdea4('0x5')),'defaultValue':_0xdea4('0x2')},'content':{'type':Sequelize[_0xdea4('0x6')]},'key':{'type':Sequelize[_0xdea4('0x6')]},'keyType':{'type':Sequelize[_0xdea4('0x7')](_0xdea4('0x2'),_0xdea4('0x3'),_0xdea4('0x8'))},'keyContent':{'type':Sequelize[_0xdea4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdea4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdea4('0x6')]}}; \ No newline at end of file +var _0x3787=['customVariable','picklist','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x499592,_0x17e6a9){var _0x490a9b=function(_0x5a6ca9){while(--_0x5a6ca9){_0x499592['push'](_0x499592['shift']());}};_0x490a9b(++_0x17e6a9);}(_0x3787,0x9d));var _0x7378=function(_0x426ea2,_0x3f3b4f){_0x426ea2=_0x426ea2-0x0;var _0x22ca47=_0x3787[_0x426ea2];return _0x22ca47;};'use strict';var Sequelize=require('sequelize');module[_0x7378('0x0')]={'type':{'type':Sequelize[_0x7378('0x1')]('string',_0x7378('0x2'),_0x7378('0x3'),'keyValue',_0x7378('0x4')),'defaultValue':_0x7378('0x5')},'content':{'type':Sequelize[_0x7378('0x6')]},'key':{'type':Sequelize[_0x7378('0x6')]},'keyType':{'type':Sequelize[_0x7378('0x1')]('string',_0x7378('0x2'),_0x7378('0x3'))},'keyContent':{'type':Sequelize[_0x7378('0x6')]},'idField':{'type':Sequelize[_0x7378('0x6')]},'nameField':{'type':Sequelize[_0x7378('0x6')]},'customField':{'type':Sequelize[_0x7378('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7378('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b831076..d465543 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 _0xf3f6=['map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','ZendeskField','rawAttributes','key','model'];(function(_0x123239,_0x23d35a){var _0x5a6042=function(_0x13a52e){while(--_0x13a52e){_0x123239['push'](_0x123239['shift']());}};_0x5a6042(++_0x23d35a);}(_0xf3f6,0x136));var _0x6f3f=function(_0x44452c,_0x6c2101){_0x44452c=_0x44452c-0x0;var _0x3fb23a=_0xf3f6[_0x44452c];return _0x3fb23a;};'use strict';var emlformat=require(_0x6f3f('0x0'));var rimraf=require(_0x6f3f('0x1'));var zipdir=require(_0x6f3f('0x2'));var jsonpatch=require(_0x6f3f('0x3'));var rp=require(_0x6f3f('0x4'));var moment=require(_0x6f3f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6f3f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6f3f('0x7'));var csv=require(_0x6f3f('0x8'));var ejs=require(_0x6f3f('0x9'));var fs=require('fs');var fs_extra=require(_0x6f3f('0xa'));var _=require('lodash');var squel=require(_0x6f3f('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f3f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6f3f('0x8'));var querystring=require(_0x6f3f('0xd'));var Papa=require(_0x6f3f('0xe'));var Redis=require('ioredis');var authService=require(_0x6f3f('0xf'));var qs=require(_0x6f3f('0x10'));var as=require(_0x6f3f('0x11'));var hardwareService=require(_0x6f3f('0x12'));var logger=require(_0x6f3f('0x13'))(_0x6f3f('0x14'));var utils=require('../../config/utils');var config=require(_0x6f3f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f3f('0x16'))['db'];function respondWithStatusCode(_0x1e9189,_0x34b898){_0x34b898=_0x34b898||0xcc;return function(_0xf37bc9){if(_0xf37bc9){return _0x1e9189[_0x6f3f('0x17')](_0x34b898);}return _0x1e9189[_0x6f3f('0x18')](_0x34b898)[_0x6f3f('0x19')]();};}function respondWithResult(_0x54bf03,_0x29834d){_0x29834d=_0x29834d||0xc8;return function(_0x29e988){if(_0x29e988){return _0x54bf03[_0x6f3f('0x18')](_0x29834d)[_0x6f3f('0x1a')](_0x29e988);}};}function respondWithFilteredResult(_0x1a5243,_0x42535a){return function(_0x4eda7f){if(_0x4eda7f){var _0x2eb3ac=typeof _0x42535a['offset']===_0x6f3f('0x1b')&&typeof _0x42535a['limit']==='undefined';var _0x479af5=_0x4eda7f[_0x6f3f('0x1c')];var _0x2eb928=_0x2eb3ac?0x0:_0x42535a[_0x6f3f('0x1d')];var _0x1a70cd=_0x2eb3ac?_0x4eda7f[_0x6f3f('0x1c')]:_0x42535a[_0x6f3f('0x1d')]+_0x42535a[_0x6f3f('0x1e')];var _0x883b47;if(_0x1a70cd>=_0x479af5){_0x1a70cd=_0x479af5;_0x883b47=0xc8;}else{_0x883b47=0xce;}_0x1a5243['status'](_0x883b47);return _0x1a5243[_0x6f3f('0x1f')](_0x6f3f('0x20'),_0x2eb928+'-'+_0x1a70cd+'/'+_0x479af5)[_0x6f3f('0x1a')](_0x4eda7f);}return null;};}function patchUpdates(_0x3cb972){return function(_0x585bd8){try{jsonpatch[_0x6f3f('0x21')](_0x585bd8,_0x3cb972,!![]);}catch(_0x2e0517){return BPromise[_0x6f3f('0x22')](_0x2e0517);}return _0x585bd8[_0x6f3f('0x23')]();};}function saveUpdates(_0x360621,_0x1fd90a){return function(_0x1df0ea){if(_0x1df0ea){return _0x1df0ea[_0x6f3f('0x24')](_0x360621)[_0x6f3f('0x25')](function(_0xd74df5){return _0xd74df5;});}return null;};}function removeEntity(_0x568642,_0x530460){return function(_0x321df0){if(_0x321df0){return _0x321df0[_0x6f3f('0x26')]()[_0x6f3f('0x25')](function(){_0x568642[_0x6f3f('0x18')](0xcc)[_0x6f3f('0x19')]();});}};}function handleEntityNotFound(_0x1d0ae4,_0x417e57){return function(_0x24bffe){if(!_0x24bffe){_0x1d0ae4[_0x6f3f('0x17')](0x194);}return _0x24bffe;};}function handleError(_0x4d4367,_0x2f8ad7){_0x2f8ad7=_0x2f8ad7||0x1f4;return function(_0x58d84f){logger['error'](_0x58d84f[_0x6f3f('0x27')]);if(_0x58d84f[_0x6f3f('0x28')]){delete _0x58d84f[_0x6f3f('0x28')];}_0x4d4367['status'](_0x2f8ad7)['send'](_0x58d84f);};}exports['index']=function(_0x34c6cc,_0x1043fb){var _0x375575={},_0x29a79d={},_0x16094b={'count':0x0,'rows':[]};var _0x301d24=_['map'](db[_0x6f3f('0x29')][_0x6f3f('0x2a')],function(_0x3e25ea){return{'name':_0x3e25ea['fieldName'],'type':_0x3e25ea['type'][_0x6f3f('0x2b')]};});_0x29a79d[_0x6f3f('0x2c')]=_[_0x6f3f('0x2d')](_0x301d24,_0x6f3f('0x28'));_0x29a79d['query']=_[_0x6f3f('0x2e')](_0x34c6cc[_0x6f3f('0x2f')]);_0x29a79d[_0x6f3f('0x30')]=_[_0x6f3f('0x31')](_0x29a79d[_0x6f3f('0x2c')],_0x29a79d[_0x6f3f('0x2f')]);_0x375575[_0x6f3f('0x32')]=_[_0x6f3f('0x31')](_0x29a79d[_0x6f3f('0x2c')],qs[_0x6f3f('0x33')](_0x34c6cc[_0x6f3f('0x2f')][_0x6f3f('0x33')]));_0x375575[_0x6f3f('0x32')]=_0x375575[_0x6f3f('0x32')]['length']?_0x375575['attributes']:_0x29a79d[_0x6f3f('0x2c')];if(!_0x34c6cc[_0x6f3f('0x2f')][_0x6f3f('0x34')](_0x6f3f('0x35'))){_0x375575[_0x6f3f('0x1e')]=qs[_0x6f3f('0x1e')](_0x34c6cc['query'][_0x6f3f('0x1e')]);_0x375575[_0x6f3f('0x1d')]=qs['offset'](_0x34c6cc[_0x6f3f('0x2f')]['offset']);}_0x375575['order']=qs[_0x6f3f('0x36')](_0x34c6cc[_0x6f3f('0x2f')][_0x6f3f('0x36')]);_0x375575[_0x6f3f('0x37')]=qs[_0x6f3f('0x30')](_[_0x6f3f('0x38')](_0x34c6cc['query'],_0x29a79d[_0x6f3f('0x30')]),_0x301d24);if(_0x34c6cc[_0x6f3f('0x2f')][_0x6f3f('0x39')]){_0x375575[_0x6f3f('0x37')]=_['merge'](_0x375575['where'],{'$or':_[_0x6f3f('0x2d')](_0x301d24,function(_0x349183){if(_0x349183['type']!==_0x6f3f('0x3a')){var _0x5b9ead={};_0x5b9ead[_0x349183[_0x6f3f('0x28')]]={'$like':'%'+_0x34c6cc[_0x6f3f('0x2f')]['filter']+'%'};return _0x5b9ead;}})});}_0x375575=_[_0x6f3f('0x3b')]({},_0x375575,_0x34c6cc[_0x6f3f('0x3c')]);var _0x5f2ea2={'where':_0x375575[_0x6f3f('0x37')]};return db[_0x6f3f('0x29')][_0x6f3f('0x1c')](_0x5f2ea2)[_0x6f3f('0x25')](function(_0x7a3b1d){_0x16094b['count']=_0x7a3b1d;if(_0x34c6cc[_0x6f3f('0x2f')]['includeAll']){_0x375575[_0x6f3f('0x3d')]=[{'all':!![]}];}return db[_0x6f3f('0x29')][_0x6f3f('0x3e')](_0x375575);})['then'](function(_0x4a551b){_0x16094b['rows']=_0x4a551b;return _0x16094b;})[_0x6f3f('0x25')](respondWithFilteredResult(_0x1043fb,_0x375575))[_0x6f3f('0x3f')](handleError(_0x1043fb,null));};exports[_0x6f3f('0x40')]=function(_0x4ae3d5,_0x5bbffb){var _0xd53ec4={'raw':!![],'where':{'id':_0x4ae3d5[_0x6f3f('0x41')]['id']}},_0xcf33eb={};_0xcf33eb['model']=_[_0x6f3f('0x2e')](db[_0x6f3f('0x29')][_0x6f3f('0x2a')]);_0xcf33eb[_0x6f3f('0x2f')]=_[_0x6f3f('0x2e')](_0x4ae3d5[_0x6f3f('0x2f')]);_0xcf33eb['filters']=_[_0x6f3f('0x31')](_0xcf33eb[_0x6f3f('0x2c')],_0xcf33eb[_0x6f3f('0x2f')]);_0xd53ec4[_0x6f3f('0x32')]=_[_0x6f3f('0x31')](_0xcf33eb[_0x6f3f('0x2c')],qs[_0x6f3f('0x33')](_0x4ae3d5[_0x6f3f('0x2f')][_0x6f3f('0x33')]));_0xd53ec4['attributes']=_0xd53ec4[_0x6f3f('0x32')][_0x6f3f('0x42')]?_0xd53ec4[_0x6f3f('0x32')]:_0xcf33eb[_0x6f3f('0x2c')];if(_0x4ae3d5[_0x6f3f('0x2f')][_0x6f3f('0x43')]){_0xd53ec4[_0x6f3f('0x3d')]=[{'all':!![]}];}_0xd53ec4=_[_0x6f3f('0x3b')]({},_0xd53ec4,_0x4ae3d5[_0x6f3f('0x3c')]);return db[_0x6f3f('0x29')][_0x6f3f('0x44')](_0xd53ec4)['then'](handleEntityNotFound(_0x5bbffb,null))[_0x6f3f('0x25')](respondWithResult(_0x5bbffb,null))['catch'](handleError(_0x5bbffb,null));};exports[_0x6f3f('0x45')]=function(_0x55c44b,_0x4bb000){return db[_0x6f3f('0x29')][_0x6f3f('0x45')](_0x55c44b[_0x6f3f('0x46')],{})[_0x6f3f('0x25')](respondWithResult(_0x4bb000,0xc9))[_0x6f3f('0x3f')](handleError(_0x4bb000,null));};exports[_0x6f3f('0x24')]=function(_0x4ab9cf,_0x4fef13){if(_0x4ab9cf[_0x6f3f('0x46')]['id']){delete _0x4ab9cf['body']['id'];}return db[_0x6f3f('0x29')]['find']({'where':{'id':_0x4ab9cf[_0x6f3f('0x41')]['id']}})[_0x6f3f('0x25')](handleEntityNotFound(_0x4fef13,null))[_0x6f3f('0x25')](saveUpdates(_0x4ab9cf[_0x6f3f('0x46')],null))['then'](respondWithResult(_0x4fef13,null))[_0x6f3f('0x3f')](handleError(_0x4fef13,null));};exports['destroy']=function(_0x5d0710,_0x41d7ae){return db[_0x6f3f('0x29')][_0x6f3f('0x44')]({'where':{'id':_0x5d0710[_0x6f3f('0x41')]['id']}})[_0x6f3f('0x25')](handleEntityNotFound(_0x41d7ae,null))[_0x6f3f('0x25')](removeEntity(_0x41d7ae,null))['catch'](handleError(_0x41d7ae,null));}; \ No newline at end of file +var _0x328d=['json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','params','fields','length','options','find','catch','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x328d,0x1d4));var _0xd328=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x328d[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xd328('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd328('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd328('0x2'));var moment=require(_0xd328('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd328('0x4'));var util=require(_0xd328('0x5'));var path=require(_0xd328('0x6'));var sox=require(_0xd328('0x7'));var csv=require(_0xd328('0x8'));var ejs=require(_0xd328('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd328('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd328('0xb'));var toCsv=require(_0xd328('0x8'));var querystring=require(_0xd328('0xc'));var Papa=require(_0xd328('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd328('0xe'));var hardwareService=require(_0xd328('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xd328('0x10'));var config=require(_0xd328('0x11'));var licenseUtil=require(_0xd328('0x12'));var db=require(_0xd328('0x13'))['db'];function respondWithStatusCode(_0xf5cbce,_0x2b599b){_0x2b599b=_0x2b599b||0xcc;return function(_0x4ba2a9){if(_0x4ba2a9){return _0xf5cbce['sendStatus'](_0x2b599b);}return _0xf5cbce[_0xd328('0x14')](_0x2b599b)[_0xd328('0x15')]();};}function respondWithResult(_0x322cbf,_0x5d9b4d){_0x5d9b4d=_0x5d9b4d||0xc8;return function(_0x4b04c2){if(_0x4b04c2){return _0x322cbf[_0xd328('0x14')](_0x5d9b4d)[_0xd328('0x16')](_0x4b04c2);}};}function respondWithFilteredResult(_0x465806,_0x5b4cce){return function(_0x2e04d4){if(_0x2e04d4){var _0x1564af=typeof _0x5b4cce[_0xd328('0x17')]===_0xd328('0x18')&&typeof _0x5b4cce['limit']===_0xd328('0x18');var _0x190578=_0x2e04d4[_0xd328('0x19')];var _0x16d391=_0x1564af?0x0:_0x5b4cce[_0xd328('0x17')];var _0x25caca=_0x1564af?_0x2e04d4['count']:_0x5b4cce[_0xd328('0x17')]+_0x5b4cce[_0xd328('0x1a')];var _0x3416da;if(_0x25caca>=_0x190578){_0x25caca=_0x190578;_0x3416da=0xc8;}else{_0x3416da=0xce;}_0x465806[_0xd328('0x14')](_0x3416da);return _0x465806['set'](_0xd328('0x1b'),_0x16d391+'-'+_0x25caca+'/'+_0x190578)[_0xd328('0x16')](_0x2e04d4);}return null;};}function patchUpdates(_0x45459a){return function(_0x49b91a){try{jsonpatch[_0xd328('0x1c')](_0x49b91a,_0x45459a,!![]);}catch(_0x402c6f){return BPromise[_0xd328('0x1d')](_0x402c6f);}return _0x49b91a[_0xd328('0x1e')]();};}function saveUpdates(_0x17470c,_0x1c154f){return function(_0x97d0fe){if(_0x97d0fe){return _0x97d0fe[_0xd328('0x1f')](_0x17470c)[_0xd328('0x20')](function(_0x8d83c1){return _0x8d83c1;});}return null;};}function removeEntity(_0xf08bb4,_0x5e7d45){return function(_0x415f34){if(_0x415f34){return _0x415f34[_0xd328('0x21')]()[_0xd328('0x20')](function(){_0xf08bb4[_0xd328('0x14')](0xcc)[_0xd328('0x15')]();});}};}function handleEntityNotFound(_0x3b0be7,_0x2ebc31){return function(_0x5eb0bf){if(!_0x5eb0bf){_0x3b0be7[_0xd328('0x22')](0x194);}return _0x5eb0bf;};}function handleError(_0x12eddd,_0x56e291){_0x56e291=_0x56e291||0x1f4;return function(_0x3ab88e){logger[_0xd328('0x23')](_0x3ab88e[_0xd328('0x24')]);if(_0x3ab88e['name']){delete _0x3ab88e[_0xd328('0x25')];}_0x12eddd[_0xd328('0x14')](_0x56e291)[_0xd328('0x26')](_0x3ab88e);};}exports[_0xd328('0x27')]=function(_0x541fc8,_0x12e8c6){var _0x31a26e={},_0x2433e6={},_0x18c17f={'count':0x0,'rows':[]};var _0x42e827=_[_0xd328('0x28')](db[_0xd328('0x29')][_0xd328('0x2a')],function(_0x302c12){return{'name':_0x302c12[_0xd328('0x2b')],'type':_0x302c12[_0xd328('0x2c')]['key']};});_0x2433e6['model']=_[_0xd328('0x28')](_0x42e827,_0xd328('0x25'));_0x2433e6[_0xd328('0x2d')]=_[_0xd328('0x2e')](_0x541fc8[_0xd328('0x2d')]);_0x2433e6[_0xd328('0x2f')]=_[_0xd328('0x30')](_0x2433e6[_0xd328('0x31')],_0x2433e6[_0xd328('0x2d')]);_0x31a26e[_0xd328('0x32')]=_[_0xd328('0x30')](_0x2433e6[_0xd328('0x31')],qs['fields'](_0x541fc8['query']['fields']));_0x31a26e[_0xd328('0x32')]=_0x31a26e[_0xd328('0x32')]['length']?_0x31a26e[_0xd328('0x32')]:_0x2433e6[_0xd328('0x31')];if(!_0x541fc8['query'][_0xd328('0x33')](_0xd328('0x34'))){_0x31a26e[_0xd328('0x1a')]=qs['limit'](_0x541fc8[_0xd328('0x2d')][_0xd328('0x1a')]);_0x31a26e[_0xd328('0x17')]=qs[_0xd328('0x17')](_0x541fc8['query'][_0xd328('0x17')]);}_0x31a26e[_0xd328('0x35')]=qs[_0xd328('0x36')](_0x541fc8[_0xd328('0x2d')]['sort']);_0x31a26e[_0xd328('0x37')]=qs['filters'](_[_0xd328('0x38')](_0x541fc8[_0xd328('0x2d')],_0x2433e6[_0xd328('0x2f')]),_0x42e827);if(_0x541fc8[_0xd328('0x2d')][_0xd328('0x39')]){_0x31a26e[_0xd328('0x37')]=_[_0xd328('0x3a')](_0x31a26e['where'],{'$or':_[_0xd328('0x28')](_0x42e827,function(_0x2b3443){if(_0x2b3443[_0xd328('0x2c')]!==_0xd328('0x3b')){var _0x16d322={};_0x16d322[_0x2b3443[_0xd328('0x25')]]={'$like':'%'+_0x541fc8[_0xd328('0x2d')][_0xd328('0x39')]+'%'};return _0x16d322;}})});}_0x31a26e=_[_0xd328('0x3a')]({},_0x31a26e,_0x541fc8['options']);var _0x14de58={'where':_0x31a26e[_0xd328('0x37')]};return db[_0xd328('0x29')][_0xd328('0x19')](_0x14de58)[_0xd328('0x20')](function(_0x477876){_0x18c17f[_0xd328('0x19')]=_0x477876;if(_0x541fc8[_0xd328('0x2d')][_0xd328('0x3c')]){_0x31a26e[_0xd328('0x3d')]=[{'all':!![]}];}return db[_0xd328('0x29')]['findAll'](_0x31a26e);})[_0xd328('0x20')](function(_0x149bdf){_0x18c17f['rows']=_0x149bdf;return _0x18c17f;})['then'](respondWithFilteredResult(_0x12e8c6,_0x31a26e))['catch'](handleError(_0x12e8c6,null));};exports['show']=function(_0x5064c0,_0x50420f){var _0x40c785={'raw':!![],'where':{'id':_0x5064c0[_0xd328('0x3e')]['id']}},_0x4fde3b={};_0x4fde3b[_0xd328('0x31')]=_['keys'](db[_0xd328('0x29')]['rawAttributes']);_0x4fde3b['query']=_[_0xd328('0x2e')](_0x5064c0[_0xd328('0x2d')]);_0x4fde3b[_0xd328('0x2f')]=_['intersection'](_0x4fde3b[_0xd328('0x31')],_0x4fde3b[_0xd328('0x2d')]);_0x40c785['attributes']=_[_0xd328('0x30')](_0x4fde3b[_0xd328('0x31')],qs[_0xd328('0x3f')](_0x5064c0[_0xd328('0x2d')]['fields']));_0x40c785[_0xd328('0x32')]=_0x40c785[_0xd328('0x32')][_0xd328('0x40')]?_0x40c785[_0xd328('0x32')]:_0x4fde3b[_0xd328('0x31')];if(_0x5064c0[_0xd328('0x2d')][_0xd328('0x3c')]){_0x40c785[_0xd328('0x3d')]=[{'all':!![]}];}_0x40c785=_[_0xd328('0x3a')]({},_0x40c785,_0x5064c0[_0xd328('0x41')]);return db[_0xd328('0x29')][_0xd328('0x42')](_0x40c785)[_0xd328('0x20')](handleEntityNotFound(_0x50420f,null))['then'](respondWithResult(_0x50420f,null))[_0xd328('0x43')](handleError(_0x50420f,null));};exports[_0xd328('0x44')]=function(_0xfa777,_0xba0c3b){return db[_0xd328('0x29')][_0xd328('0x44')](_0xfa777[_0xd328('0x45')],{})[_0xd328('0x20')](respondWithResult(_0xba0c3b,0xc9))[_0xd328('0x43')](handleError(_0xba0c3b,null));};exports[_0xd328('0x1f')]=function(_0x3d24c7,_0x453649){if(_0x3d24c7[_0xd328('0x45')]['id']){delete _0x3d24c7['body']['id'];}return db[_0xd328('0x29')][_0xd328('0x42')]({'where':{'id':_0x3d24c7['params']['id']}})['then'](handleEntityNotFound(_0x453649,null))[_0xd328('0x20')](saveUpdates(_0x3d24c7[_0xd328('0x45')],null))[_0xd328('0x20')](respondWithResult(_0x453649,null))[_0xd328('0x43')](handleError(_0x453649,null));};exports[_0xd328('0x21')]=function(_0x46bbb0,_0x16833c){return db[_0xd328('0x29')][_0xd328('0x42')]({'where':{'id':_0x46bbb0[_0xd328('0x3e')]['id']}})[_0xd328('0x20')](handleEntityNotFound(_0x16833c,null))[_0xd328('0x20')](removeEntity(_0x16833c,null))['catch'](handleError(_0x16833c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 109c2d7..1a14afd 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 _0x4e70=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_zendesk_fields','idField','lodash','../../config/logger','api','moment'];(function(_0x383d6c,_0x38ddc7){var _0x1f6e14=function(_0x45d6a1){while(--_0x45d6a1){_0x383d6c['push'](_0x383d6c['shift']());}};_0x1f6e14(++_0x38ddc7);}(_0x4e70,0x64));var _0x04e7=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4e70[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x04e7('0x0'));var util=require('util');var logger=require(_0x04e7('0x1'))(_0x04e7('0x2'));var moment=require(_0x04e7('0x3'));var BPromise=require(_0x04e7('0x4'));var rp=require(_0x04e7('0x5'));var fs=require('fs');var path=require(_0x04e7('0x6'));var rimraf=require(_0x04e7('0x7'));var config=require(_0x04e7('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x04e7('0x9')]=function(_0x20e727,_0x1f16db){return _0x20e727[_0x04e7('0xa')]('ZendeskField',attributes,{'tableName':_0x04e7('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x04e7('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bbb=['zendesk_unique_index','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x1bbb,0xf3));var _0xb1bb=function(_0xabe2cc,_0x101459){_0xabe2cc=_0xabe2cc-0x0;var _0x3810c9=_0x1bbb[_0xabe2cc];return _0x3810c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb1bb('0x0'))(_0xb1bb('0x1'));var moment=require('moment');var BPromise=require(_0xb1bb('0x2'));var rp=require(_0xb1bb('0x3'));var fs=require('fs');var path=require(_0xb1bb('0x4'));var rimraf=require(_0xb1bb('0x5'));var config=require('../../config/environment');var attributes=require(_0xb1bb('0x6'));module[_0xb1bb('0x7')]=function(_0x1e9b51,_0x2926ae){return _0x1e9b51[_0xb1bb('0x8')](_0xb1bb('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xb1bb('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index d24d8ea..5ff3b24 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 _0x90f3=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x1e3e59,_0x15b234){var _0x4df62f=function(_0x23661e){while(--_0x23661e){_0x1e3e59['push'](_0x1e3e59['shift']());}};_0x4df62f(++_0x15b234);}(_0x90f3,0x1b2));var _0x390f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x90f3[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x390f('0x0'));var BPromise=require(_0x390f('0x1'));var rs=require(_0x390f('0x2'));var fs=require('fs');var Redis=require(_0x390f('0x3'));var db=require(_0x390f('0x4'))['db'];var utils=require(_0x390f('0x5'));var logger=require(_0x390f('0x6'))(_0x390f('0x7'));var config=require(_0x390f('0x8'));var jayson=require(_0x390f('0x9'));var client=jayson[_0x390f('0xa')][_0x390f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7aa5c8,_0x2a65f0,_0x2ce1c3){return new BPromise(function(_0xf6045d,_0x136b89){return client[_0x390f('0xc')](_0x7aa5c8,_0x2ce1c3)[_0x390f('0xd')](function(_0x1152ca){logger[_0x390f('0xe')](_0x390f('0xf'),_0x2a65f0,_0x390f('0x10'));logger[_0x390f('0x11')](_0x390f('0x12'),_0x2a65f0,_0x390f('0x10'),JSON[_0x390f('0x13')](_0x1152ca));if(_0x1152ca[_0x390f('0x14')]){if(_0x1152ca[_0x390f('0x14')][_0x390f('0x15')]===0x1f4){logger[_0x390f('0x14')]('ZendeskField,\x20%s,\x20%s',_0x2a65f0,_0x1152ca['error'][_0x390f('0x16')]);return _0x136b89(_0x1152ca[_0x390f('0x14')][_0x390f('0x16')]);}logger['error'](_0x390f('0xf'),_0x2a65f0,_0x1152ca['error'][_0x390f('0x16')]);return _0xf6045d(_0x1152ca['error'][_0x390f('0x16')]);}else{logger[_0x390f('0xe')](_0x390f('0xf'),_0x2a65f0,'request\x20sent');_0xf6045d(_0x1152ca[_0x390f('0x17')][_0x390f('0x16')]);}})[_0x390f('0x18')](function(_0x234439){logger['error'](_0x390f('0xf'),_0x2a65f0,_0x234439);_0x136b89(_0x234439);});});} \ No newline at end of file +var _0x9221=['ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskField,\x20%s,\x20%s'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x9221,0x105));var _0x1922=function(_0x38a045,_0x402d6b){_0x38a045=_0x38a045-0x0;var _0x45c34c=_0x9221[_0x38a045];return _0x45c34c;};'use strict';var _=require(_0x1922('0x0'));var util=require(_0x1922('0x1'));var moment=require(_0x1922('0x2'));var BPromise=require(_0x1922('0x3'));var rs=require(_0x1922('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1922('0x5'))['db'];var utils=require(_0x1922('0x6'));var logger=require(_0x1922('0x7'))(_0x1922('0x8'));var config=require(_0x1922('0x9'));var jayson=require(_0x1922('0xa'));var client=jayson[_0x1922('0xb')][_0x1922('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43ef6b,_0x5dbfc3,_0x1decf3){return new BPromise(function(_0x3a7b53,_0x4c4da8){return client[_0x1922('0xd')](_0x43ef6b,_0x1decf3)['then'](function(_0x49a603){logger['info'](_0x1922('0xe'),_0x5dbfc3,'request\x20sent');logger['debug'](_0x1922('0xf'),_0x5dbfc3,_0x1922('0x10'),JSON[_0x1922('0x11')](_0x49a603));if(_0x49a603[_0x1922('0x12')]){if(_0x49a603['error'][_0x1922('0x13')]===0x1f4){logger[_0x1922('0x12')](_0x1922('0xe'),_0x5dbfc3,_0x49a603[_0x1922('0x12')][_0x1922('0x14')]);return _0x4c4da8(_0x49a603['error'][_0x1922('0x14')]);}logger['error'](_0x1922('0xe'),_0x5dbfc3,_0x49a603[_0x1922('0x12')][_0x1922('0x14')]);return _0x3a7b53(_0x49a603['error'][_0x1922('0x14')]);}else{logger[_0x1922('0x15')](_0x1922('0xe'),_0x5dbfc3,_0x1922('0x10'));_0x3a7b53(_0x49a603['result'][_0x1922('0x14')]);}})[_0x1922('0x16')](function(_0x3233c2){logger[_0x1922('0x12')](_0x1922('0xe'),_0x5dbfc3,_0x3233c2);_0x4c4da8(_0x3233c2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 0750ceb..56deabe 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 _0xbb97=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','exports'];(function(_0x22c4c2,_0x281dec){var _0x47c6f0=function(_0x3747ec){while(--_0x3747ec){_0x22c4c2['push'](_0x22c4c2['shift']());}};_0x47c6f0(++_0x281dec);}(_0xbb97,0xa8));var _0x7bb9=function(_0x2956db,_0x40cb86){_0x2956db=_0x2956db-0x0;var _0x4b10ee=_0xbb97[_0x2956db];return _0x4b10ee;};'use strict';var multer=require('multer');var util=require(_0x7bb9('0x0'));var path=require(_0x7bb9('0x1'));var timeout=require(_0x7bb9('0x2'));var express=require(_0x7bb9('0x3'));var router=express[_0x7bb9('0x4')]();var fs_extra=require(_0x7bb9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7bb9('0x6'));var controller=require(_0x7bb9('0x7'));router[_0x7bb9('0x8')]('/',auth[_0x7bb9('0x9')](),controller['index']);router[_0x7bb9('0x8')](_0x7bb9('0xa'),auth['isAuthenticated'](),controller[_0x7bb9('0xb')]);router[_0x7bb9('0x8')](_0x7bb9('0xc'),auth[_0x7bb9('0x9')](),controller[_0x7bb9('0xd')]);router['get']('/:id/fields',auth[_0x7bb9('0x9')](),controller['getFields']);router[_0x7bb9('0xe')]('/',auth['isAuthenticated'](),controller[_0x7bb9('0xf')]);router[_0x7bb9('0xe')]('/:id/configurations',auth[_0x7bb9('0x9')](),controller[_0x7bb9('0x10')]);router[_0x7bb9('0x11')](_0x7bb9('0xa'),auth[_0x7bb9('0x9')](),controller[_0x7bb9('0x12')]);router[_0x7bb9('0x13')](_0x7bb9('0xa'),auth[_0x7bb9('0x9')](),controller['destroy']);module[_0x7bb9('0x14')]=router; \ No newline at end of file +var _0x1d3b=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','post','create','addConfiguration','put','update','delete'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0x1d3b,0x1db));var _0xb1d3=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x1d3b[_0x75f869];return _0x10af8b;};'use strict';var multer=require(_0xb1d3('0x0'));var util=require(_0xb1d3('0x1'));var path=require(_0xb1d3('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1d3('0x3'));var router=express[_0xb1d3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb1d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb1d3('0x6'));var controller=require('./intZohoAccount.controller');router[_0xb1d3('0x7')]('/',auth[_0xb1d3('0x8')](),controller[_0xb1d3('0x9')]);router[_0xb1d3('0x7')](_0xb1d3('0xa'),auth[_0xb1d3('0x8')](),controller[_0xb1d3('0xb')]);router[_0xb1d3('0x7')](_0xb1d3('0xc'),auth[_0xb1d3('0x8')](),controller['getConfigurations']);router[_0xb1d3('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xb1d3('0xd')]('/',auth[_0xb1d3('0x8')](),controller[_0xb1d3('0xe')]);router['post'](_0xb1d3('0xc'),auth[_0xb1d3('0x8')](),controller[_0xb1d3('0xf')]);router[_0xb1d3('0x10')]('/:id',auth[_0xb1d3('0x8')](),controller[_0xb1d3('0x11')]);router[_0xb1d3('0x12')](_0xb1d3('0xa'),auth[_0xb1d3('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e5d0790..fd9c351 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 _0xe5b3=['STRING','exports'];(function(_0x29495f,_0x5273ab){var _0x4ef44a=function(_0x46b3e2){while(--_0x46b3e2){_0x29495f['push'](_0x29495f['shift']());}};_0x4ef44a(++_0x5273ab);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4064b1,_0x58acce){_0x4064b1=_0x4064b1-0x0;var _0x482624=_0xe5b3[_0x4064b1];return _0x482624;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file +var _0xa8a8=['exports','STRING','sequelize'];(function(_0x5c3ac1,_0x1de1e5){var _0x34d3a7=function(_0x53e202){while(--_0x53e202){_0x5c3ac1['push'](_0x5c3ac1['shift']());}};_0x34d3a7(++_0x1de1e5);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1fd140,_0x4439b8){_0x1fd140=_0x1fd140-0x0;var _0x536a6e=_0xa8a8[_0x1fd140];return _0x536a6e;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 63ee211..a1202d2 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 _0xb7d8=['format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','WhoId','Call_Duration','Call_Result','Call_Type','includes','api_name','system_mandatory','push','display_label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','ZohoConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','code','refreshToken','zoho.eu','com','serverUrl','slice','substring','lastIndexOf'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0xb7d8,0x112));var _0x8b7d=function(_0xc721d1,_0x21717c){_0xc721d1=_0xc721d1-0x0;var _0x34b2ec=_0xb7d8[_0xc721d1];return _0x34b2ec;};'use strict';var emlformat=require(_0x8b7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b7d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b7d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8b7d('0x3'));var path=require(_0x8b7d('0x4'));var sox=require(_0x8b7d('0x5'));var csv=require(_0x8b7d('0x6'));var ejs=require(_0x8b7d('0x7'));var fs=require('fs');var fs_extra=require(_0x8b7d('0x8'));var _=require(_0x8b7d('0x9'));var squel=require(_0x8b7d('0xa'));var crypto=require(_0x8b7d('0xb'));var jsforce=require(_0x8b7d('0xc'));var deskjs=require(_0x8b7d('0xd'));var toCsv=require(_0x8b7d('0x6'));var querystring=require(_0x8b7d('0xe'));var Papa=require(_0x8b7d('0xf'));var Redis=require(_0x8b7d('0x10'));var authService=require(_0x8b7d('0x11'));var qs=require(_0x8b7d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b7d('0x13'));var logger=require('../../config/logger')(_0x8b7d('0x14'));var utils=require(_0x8b7d('0x15'));var config=require(_0x8b7d('0x16'));var licenseUtil=require(_0x8b7d('0x17'));var db=require(_0x8b7d('0x18'))['db'];var integrations=require(_0x8b7d('0x19'));function respondWithStatusCode(_0x297106,_0x145884){_0x145884=_0x145884||0xcc;return function(_0x292728){if(_0x292728){return _0x297106[_0x8b7d('0x1a')](_0x145884);}return _0x297106[_0x8b7d('0x1b')](_0x145884)[_0x8b7d('0x1c')]();};}function respondWithResult(_0x1f8a46,_0x35c3e8){_0x35c3e8=_0x35c3e8||0xc8;return function(_0x3bfb34){if(_0x3bfb34){return _0x1f8a46['status'](_0x35c3e8)['json'](_0x3bfb34);}};}function respondWithFilteredResult(_0x40801d,_0x48512e){return function(_0x537c9e){if(_0x537c9e){var _0x5452b2=typeof _0x48512e[_0x8b7d('0x1d')]==='undefined'&&typeof _0x48512e[_0x8b7d('0x1e')]===_0x8b7d('0x1f');var _0x23a9c2=_0x537c9e[_0x8b7d('0x20')];var _0x3fba1e=_0x5452b2?0x0:_0x48512e['offset'];var _0x16523e=_0x5452b2?_0x537c9e['count']:_0x48512e[_0x8b7d('0x1d')]+_0x48512e[_0x8b7d('0x1e')];var _0x24f16d;if(_0x16523e>=_0x23a9c2){_0x16523e=_0x23a9c2;_0x24f16d=0xc8;}else{_0x24f16d=0xce;}_0x40801d[_0x8b7d('0x1b')](_0x24f16d);return _0x40801d[_0x8b7d('0x21')](_0x8b7d('0x22'),_0x3fba1e+'-'+_0x16523e+'/'+_0x23a9c2)['json'](_0x537c9e);}return null;};}function patchUpdates(_0x340f01){return function(_0x4851cb){try{jsonpatch[_0x8b7d('0x23')](_0x4851cb,_0x340f01,!![]);}catch(_0x5cc371){return BPromise[_0x8b7d('0x24')](_0x5cc371);}return _0x4851cb[_0x8b7d('0x25')]();};}function saveUpdates(_0x27cf51,_0x448670){return function(_0x3a4427){if(_0x3a4427){return _0x3a4427[_0x8b7d('0x26')](_0x27cf51)['then'](function(_0x145f79){return _0x145f79;});}return null;};}function removeEntity(_0xaa57f0,_0x227b56){return function(_0x1774b5){if(_0x1774b5){return _0x1774b5[_0x8b7d('0x27')]()[_0x8b7d('0x28')](function(){_0xaa57f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a17e,_0x414cc4){return function(_0x47c5c5){if(!_0x47c5c5){_0x14a17e[_0x8b7d('0x1a')](0x194);}return _0x47c5c5;};}function handleError(_0x2bfb62,_0x5adb50){_0x5adb50=_0x5adb50||0x1f4;return function(_0x43f2da){logger[_0x8b7d('0x29')](_0x43f2da[_0x8b7d('0x2a')]);if(_0x43f2da[_0x8b7d('0x2b')]){delete _0x43f2da[_0x8b7d('0x2b')];}_0x2bfb62['status'](_0x5adb50)['send'](_0x43f2da);};}exports[_0x8b7d('0x2c')]=function(_0x5f0dd1,_0x256e5e){var _0x4dfa00={},_0x3777df={},_0x47c548={'count':0x0,'rows':[]};var _0x1297aa=_[_0x8b7d('0x2d')](db[_0x8b7d('0x2e')][_0x8b7d('0x2f')],function(_0x46c4d7){return{'name':_0x46c4d7[_0x8b7d('0x30')],'type':_0x46c4d7[_0x8b7d('0x31')]['key']};});_0x3777df['model']=_[_0x8b7d('0x2d')](_0x1297aa,_0x8b7d('0x2b'));_0x3777df['query']=_[_0x8b7d('0x32')](_0x5f0dd1[_0x8b7d('0x33')]);_0x3777df[_0x8b7d('0x34')]=_[_0x8b7d('0x35')](_0x3777df['model'],_0x3777df[_0x8b7d('0x33')]);_0x4dfa00[_0x8b7d('0x36')]=_['intersection'](_0x3777df[_0x8b7d('0x37')],qs[_0x8b7d('0x38')](_0x5f0dd1[_0x8b7d('0x33')]['fields']));_0x4dfa00[_0x8b7d('0x36')]=_0x4dfa00[_0x8b7d('0x36')][_0x8b7d('0x39')]?_0x4dfa00['attributes']:_0x3777df['model'];if(!_0x5f0dd1[_0x8b7d('0x33')]['hasOwnProperty'](_0x8b7d('0x3a'))){_0x4dfa00[_0x8b7d('0x1e')]=qs[_0x8b7d('0x1e')](_0x5f0dd1['query'][_0x8b7d('0x1e')]);_0x4dfa00[_0x8b7d('0x1d')]=qs[_0x8b7d('0x1d')](_0x5f0dd1[_0x8b7d('0x33')]['offset']);}_0x4dfa00['order']=qs[_0x8b7d('0x3b')](_0x5f0dd1[_0x8b7d('0x33')][_0x8b7d('0x3b')]);_0x4dfa00['where']=qs[_0x8b7d('0x34')](_[_0x8b7d('0x3c')](_0x5f0dd1[_0x8b7d('0x33')],_0x3777df[_0x8b7d('0x34')]),_0x1297aa);if(_0x5f0dd1[_0x8b7d('0x33')][_0x8b7d('0x3d')]){_0x4dfa00[_0x8b7d('0x3e')]=_[_0x8b7d('0x3f')](_0x4dfa00[_0x8b7d('0x3e')],{'$or':_[_0x8b7d('0x2d')](_0x1297aa,function(_0x4e885d){if(_0x4e885d[_0x8b7d('0x31')]!==_0x8b7d('0x40')){var _0x4e653e={};_0x4e653e[_0x4e885d['name']]={'$like':'%'+_0x5f0dd1[_0x8b7d('0x33')][_0x8b7d('0x3d')]+'%'};return _0x4e653e;}})});}_0x4dfa00=_[_0x8b7d('0x3f')]({},_0x4dfa00,_0x5f0dd1[_0x8b7d('0x41')]);var _0x28f8a={'where':_0x4dfa00['where']};return db[_0x8b7d('0x2e')]['count'](_0x28f8a)[_0x8b7d('0x28')](function(_0x49b0f0){_0x47c548[_0x8b7d('0x20')]=_0x49b0f0;if(_0x5f0dd1[_0x8b7d('0x33')][_0x8b7d('0x42')]){_0x4dfa00['include']=[{'all':!![]}];}return db[_0x8b7d('0x2e')][_0x8b7d('0x43')](_0x4dfa00);})[_0x8b7d('0x28')](function(_0x48a568){_0x47c548[_0x8b7d('0x44')]=_0x48a568;return _0x47c548;})[_0x8b7d('0x28')](respondWithFilteredResult(_0x256e5e,_0x4dfa00))[_0x8b7d('0x45')](handleError(_0x256e5e,null));};exports[_0x8b7d('0x46')]=function(_0x442a2e,_0x4adeba){var _0x12feaa={'raw':![],'where':{'id':_0x442a2e[_0x8b7d('0x47')]['id']}},_0x45aadc={};_0x45aadc[_0x8b7d('0x37')]=_['keys'](db[_0x8b7d('0x2e')][_0x8b7d('0x2f')]);_0x45aadc[_0x8b7d('0x33')]=_[_0x8b7d('0x32')](_0x442a2e[_0x8b7d('0x33')]);_0x45aadc[_0x8b7d('0x34')]=_['intersection'](_0x45aadc[_0x8b7d('0x37')],_0x45aadc[_0x8b7d('0x33')]);_0x12feaa[_0x8b7d('0x36')]=_['intersection'](_0x45aadc[_0x8b7d('0x37')],qs[_0x8b7d('0x38')](_0x442a2e[_0x8b7d('0x33')][_0x8b7d('0x38')]));_0x12feaa[_0x8b7d('0x36')]=_0x12feaa['attributes']['length']?_0x12feaa[_0x8b7d('0x36')]:_0x45aadc[_0x8b7d('0x37')];if(_0x442a2e[_0x8b7d('0x33')]['includeAll']){_0x12feaa[_0x8b7d('0x48')]=[{'all':!![]}];}_0x12feaa=_[_0x8b7d('0x3f')]({},_0x12feaa,_0x442a2e[_0x8b7d('0x41')]);return db['ZohoAccount'][_0x8b7d('0x49')](_0x12feaa)[_0x8b7d('0x28')](handleEntityNotFound(_0x4adeba,null))['then'](respondWithResult(_0x4adeba,null))[_0x8b7d('0x45')](handleError(_0x4adeba,null));};exports[_0x8b7d('0x4a')]=function(_0x447e0e,_0x110b1a){return db[_0x8b7d('0x2e')][_0x8b7d('0x4a')](_0x447e0e[_0x8b7d('0x4b')],{})[_0x8b7d('0x28')](respondWithResult(_0x110b1a,0xc9))['catch'](handleError(_0x110b1a,null));};exports['update']=function(_0x3f9082,_0x3c20cb){if(_0x3f9082[_0x8b7d('0x4b')]['id']){delete _0x3f9082[_0x8b7d('0x4b')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x3f9082['params']['id']}})['then'](handleEntityNotFound(_0x3c20cb,null))[_0x8b7d('0x28')](saveUpdates(_0x3f9082[_0x8b7d('0x4b')],null))['then'](respondWithResult(_0x3c20cb,null))[_0x8b7d('0x45')](handleError(_0x3c20cb,null));};exports[_0x8b7d('0x27')]=function(_0x507c4d,_0x4642c7){return db[_0x8b7d('0x2e')]['find']({'where':{'id':_0x507c4d[_0x8b7d('0x47')]['id']}})[_0x8b7d('0x28')](handleEntityNotFound(_0x4642c7,null))[_0x8b7d('0x28')](removeEntity(_0x4642c7,null))[_0x8b7d('0x45')](handleError(_0x4642c7,null));};exports[_0x8b7d('0x4c')]=function(_0x1053cf,_0x76f3ef,_0x4d17e7){var _0x3bc530={};var _0x170ba1={};var _0x190519;var _0x4886a0;return db[_0x8b7d('0x2e')][_0x8b7d('0x4d')]({'where':{'id':_0x1053cf['params']['id']}})[_0x8b7d('0x28')](handleEntityNotFound(_0x76f3ef,null))[_0x8b7d('0x28')](function(_0x22d449){if(_0x22d449){_0x190519=_0x22d449;_0x170ba1[_0x8b7d('0x37')]=_[_0x8b7d('0x32')](db[_0x8b7d('0x4e')]['rawAttributes']);_0x170ba1[_0x8b7d('0x33')]=_[_0x8b7d('0x32')](_0x1053cf[_0x8b7d('0x33')]);_0x170ba1['filters']=_[_0x8b7d('0x35')](_0x170ba1['model'],_0x170ba1[_0x8b7d('0x33')]);_0x3bc530['attributes']=_[_0x8b7d('0x35')](_0x170ba1['model'],qs[_0x8b7d('0x38')](_0x1053cf[_0x8b7d('0x33')][_0x8b7d('0x38')]));_0x3bc530['attributes']=_0x3bc530[_0x8b7d('0x36')]['length']?_0x3bc530[_0x8b7d('0x36')]:_0x170ba1[_0x8b7d('0x37')];_0x3bc530[_0x8b7d('0x4f')]=qs['sort'](_0x1053cf[_0x8b7d('0x33')][_0x8b7d('0x3b')]);_0x3bc530[_0x8b7d('0x3e')]=qs[_0x8b7d('0x34')](_[_0x8b7d('0x3c')](_0x1053cf[_0x8b7d('0x33')],_0x170ba1['filters']));if(_0x1053cf[_0x8b7d('0x33')][_0x8b7d('0x3d')]){_0x3bc530['where']=_['merge'](_0x3bc530['where'],{'$or':_[_0x8b7d('0x2d')](_0x3bc530[_0x8b7d('0x36')],function(_0x48ac76){var _0x4107ef={};_0x4107ef[_0x48ac76]={'$like':'%'+_0x1053cf[_0x8b7d('0x33')][_0x8b7d('0x3d')]+'%'};return _0x4107ef;})});}_0x3bc530=_[_0x8b7d('0x3f')]({},_0x3bc530,_0x1053cf[_0x8b7d('0x41')]);return _0x190519[_0x8b7d('0x4c')](_0x3bc530);}})[_0x8b7d('0x28')](function(_0x39c154){if(_0x39c154){_0x4886a0=_0x39c154['length'];if(!_0x1053cf[_0x8b7d('0x33')]['hasOwnProperty']('nolimit')){_0x3bc530['limit']=qs[_0x8b7d('0x1e')](_0x1053cf[_0x8b7d('0x33')][_0x8b7d('0x1e')]);_0x3bc530[_0x8b7d('0x1d')]=qs['offset'](_0x1053cf[_0x8b7d('0x33')][_0x8b7d('0x1d')]);}return _0x190519[_0x8b7d('0x4c')](_0x3bc530);}})[_0x8b7d('0x28')](function(_0x54f8e9){if(_0x54f8e9){return _0x54f8e9?{'count':_0x4886a0,'rows':_0x54f8e9}:null;}})['then'](respondWithResult(_0x76f3ef,null))[_0x8b7d('0x45')](handleError(_0x76f3ef,null));};exports[_0x8b7d('0x50')]=function(_0x40c1c8,_0x7fcb01,_0x170d5f){if(_0x40c1c8['body']['id']){delete _0x40c1c8['body']['id'];}return db['ZohoAccount'][_0x8b7d('0x4d')]({'where':{'id':_0x40c1c8['params']['id']}})[_0x8b7d('0x28')](handleEntityNotFound(_0x7fcb01,null))[_0x8b7d('0x28')](function(_0x5d9fa4){if(_0x5d9fa4){_0x40c1c8['body'][_0x8b7d('0x51')]=_0x5d9fa4['id'];_0x40c1c8[_0x8b7d('0x4b')][_0x8b7d('0x52')]=integrations[_0x8b7d('0x53')](_0x40c1c8[_0x8b7d('0x4b')]['channel'],_0x40c1c8[_0x8b7d('0x4b')]['type']);_0x40c1c8[_0x8b7d('0x4b')][_0x8b7d('0x54')]=integrations['getDescriptions'](_0x40c1c8[_0x8b7d('0x4b')][_0x8b7d('0x55')],_0x40c1c8['body']['type']);return db['ZohoConfiguration'][_0x8b7d('0x4a')](_0x40c1c8['body'],{'include':[{'model':db['ZohoField'],'as':_0x8b7d('0x52')},{'model':db[_0x8b7d('0x56')],'as':_0x8b7d('0x54')}]});}return null;})[_0x8b7d('0x28')](respondWithResult(_0x7fcb01,null))['catch'](handleError(_0x7fcb01,null));};function getAccessToken(_0x5f34cc){return new Promise(function(_0x55b190,_0x27553f){var _0x193ab7;switch(_0x5f34cc[_0x8b7d('0x57')]){case'US':_0x193ab7=_0x8b7d('0x58');break;case'AU':_0x193ab7=_0x8b7d('0x59');break;case'EU':_0x193ab7=_0x8b7d('0x5a');break;case'IN':_0x193ab7=_0x8b7d('0x5b');break;case'CN':_0x193ab7=_0x8b7d('0x5c');break;default:_0x193ab7=_0x8b7d('0x5a');break;}var _0x3abb09={'method':'POST','uri':_0x193ab7+_0x8b7d('0x5d'),'qs':{'refresh_token':_0x5f34cc['refreshToken'],'client_id':_0x5f34cc[_0x8b7d('0x5e')],'client_secret':_0x5f34cc[_0x8b7d('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3abb09)[_0x8b7d('0x28')](function(_0x1ffb81){if(_0x1ffb81[_0x8b7d('0x60')]){_0x55b190(_0x1ffb81['access_token']);}else{_0x27553f(_0x8b7d('0x61'));}})['catch'](function(_0x280c0f){_0x27553f(_0x280c0f);});});}exports['getFields']=function(_0x13f2d4,_0xad16b7,_0x19a3db){var _0xf25213,_0x2d97c5,_0x11e0eb,_0x5772a5,_0xca7dfd;return db[_0x8b7d('0x2e')][_0x8b7d('0x4d')]({'where':{'id':_0x13f2d4['params']['id']},'attributes':['id',_0x8b7d('0x62'),_0x8b7d('0x57'),'clientId',_0x8b7d('0x5f'),'serverUrl',_0x8b7d('0x63'),_0x8b7d('0x64')]})[_0x8b7d('0x28')](handleEntityNotFound(_0xad16b7,null))[_0x8b7d('0x28')](function(_0x262690){_0xca7dfd=_0x262690;_0xf25213=_0xca7dfd[_0x8b7d('0x62')];_0x2d97c5=_0xf25213===_0x8b7d('0x65')?'eu':_0x8b7d('0x66');_0x11e0eb=_0xca7dfd[_0x8b7d('0x67')];var _0x42f3ea=_0x11e0eb[_0x8b7d('0x68')](-0x1);if(_0x42f3ea==='/'||_0x42f3ea==='\x5c'||_0x42f3ea===':'){_0x11e0eb=_0x11e0eb[_0x8b7d('0x69')](0x0,_0x11e0eb[_0x8b7d('0x6a')](_0x42f3ea));}if(!_0xca7dfd['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0xca7dfd);})[_0x8b7d('0x28')](function(_0x311125){if(_0x311125){return rp({'method':'GET','uri':util[_0x8b7d('0x6b')](_0x8b7d('0x6c'),_0x2d97c5),'qs':{'module':_0x8b7d('0x6d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x311125},'json':!![]});}})[_0x8b7d('0x28')](function(_0x131fb5){if(_0x131fb5){if(_0x131fb5[_0x8b7d('0x6e')]&&_0x131fb5[_0x8b7d('0x6e')][_0x8b7d('0x29')]){throw new Error(_0x131fb5['response'][_0x8b7d('0x29')]['message']);}var _0x186786=[];var _0x2adadd=[];var _0x17aa02=['Owner','Subject','Description',_0x8b7d('0x6f'),_0x8b7d('0x70'),_0x8b7d('0x71'),'Call_Start_Time',_0x8b7d('0x72')];_0x2adadd=_['remove'](_0x131fb5[_0x8b7d('0x38')],function(_0x1a91e2){return _0x17aa02[_0x8b7d('0x73')](_0x1a91e2[_0x8b7d('0x74')]);});for(var _0x4b86d3=0x0;_0x4b86d3<_0x2adadd['length'];_0x4b86d3++){if(_0x2adadd[_0x4b86d3][_0x8b7d('0x75')]===![]){_0x186786[_0x8b7d('0x76')]({'id':_0x2adadd[_0x4b86d3]['id'],'name':_0x2adadd[_0x4b86d3][_0x8b7d('0x77')],'custom':_0x2adadd[_0x4b86d3]['custom_field'],'options':_0x2adadd[_0x4b86d3]['data_type']==='picklist'&&_0x2adadd[_0x4b86d3]['pick_list_values']['length']>-0x1?_[_0x8b7d('0x2d')](_0x2adadd[_0x4b86d3]['pick_list_values'],function(_0x4e2370){return{'name':_0x4e2370,'value':_0x4e2370};}):[]});}}return{'count':_0x186786['length'],'rows':_0x186786};}else{return{'count':0x0,'rows':[]};}})[_0x8b7d('0x28')](respondWithResult(_0xad16b7,null))[_0x8b7d('0x45')](function(_0x3f910b){var _0x39ef5f=_0x13f2d4[_0x8b7d('0x33')][_0x8b7d('0x78')]?0x1f4:_0x3f910b[_0x8b7d('0x79')]||0x1f4;logger['error'](_0x8b7d('0x7a'),_0x8b7d('0x7b'),_0x39ef5f,JSON[_0x8b7d('0x7c')](_0x3f910b));delete _0x3f910b[_0x8b7d('0x2b')];if(_0x39ef5f===0x191){_0x39ef5f=0x190;}_0xad16b7[_0x8b7d('0x1b')](_0x39ef5f)[_0x8b7d('0x7d')](_0x13f2d4[_0x8b7d('0x33')][_0x8b7d('0x78')]?{'message':_0x8b7d('0x7e'),'statusCode':_0x3f910b['statusCode']}:_0x3f910b);});}; \ No newline at end of file +var _0xe73f=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','limit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','catch','show','params','length','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','nolimit','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','name','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x11dfbb,_0x1f4c8a){var _0x22d016=function(_0x38285c){while(--_0x38285c){_0x11dfbb['push'](_0x11dfbb['shift']());}};_0x22d016(++_0x1f4c8a);}(_0xe73f,0x1ed));var _0xfe73=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe73f[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0xfe73('0x0'));var rimraf=require(_0xfe73('0x1'));var zipdir=require(_0xfe73('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe73('0x3'));var moment=require(_0xfe73('0x4'));var BPromise=require(_0xfe73('0x5'));var Mustache=require('mustache');var util=require(_0xfe73('0x6'));var path=require('path');var sox=require(_0xfe73('0x7'));var csv=require(_0xfe73('0x8'));var ejs=require(_0xfe73('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe73('0xa'));var squel=require(_0xfe73('0xb'));var crypto=require(_0xfe73('0xc'));var jsforce=require(_0xfe73('0xd'));var deskjs=require(_0xfe73('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfe73('0xf'));var Papa=require('papaparse');var Redis=require(_0xfe73('0x10'));var authService=require(_0xfe73('0x11'));var qs=require(_0xfe73('0x12'));var as=require(_0xfe73('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe73('0x14'))(_0xfe73('0x15'));var utils=require(_0xfe73('0x16'));var config=require(_0xfe73('0x17'));var licenseUtil=require(_0xfe73('0x18'));var db=require(_0xfe73('0x19'))['db'];var integrations=require(_0xfe73('0x1a'));function respondWithStatusCode(_0x379409,_0x198b2d){_0x198b2d=_0x198b2d||0xcc;return function(_0x17b311){if(_0x17b311){return _0x379409[_0xfe73('0x1b')](_0x198b2d);}return _0x379409[_0xfe73('0x1c')](_0x198b2d)['end']();};}function respondWithResult(_0x1678ea,_0x4665e5){_0x4665e5=_0x4665e5||0xc8;return function(_0x1d47e1){if(_0x1d47e1){return _0x1678ea[_0xfe73('0x1c')](_0x4665e5)[_0xfe73('0x1d')](_0x1d47e1);}};}function respondWithFilteredResult(_0x469aaf,_0x55967b){return function(_0xadf573){if(_0xadf573){var _0x35985e=typeof _0x55967b[_0xfe73('0x1e')]===_0xfe73('0x1f')&&typeof _0x55967b['limit']===_0xfe73('0x1f');var _0x1b01e3=_0xadf573['count'];var _0x293fdc=_0x35985e?0x0:_0x55967b['offset'];var _0x58d132=_0x35985e?_0xadf573[_0xfe73('0x20')]:_0x55967b[_0xfe73('0x1e')]+_0x55967b['limit'];var _0x204caa;if(_0x58d132>=_0x1b01e3){_0x58d132=_0x1b01e3;_0x204caa=0xc8;}else{_0x204caa=0xce;}_0x469aaf[_0xfe73('0x1c')](_0x204caa);return _0x469aaf[_0xfe73('0x21')](_0xfe73('0x22'),_0x293fdc+'-'+_0x58d132+'/'+_0x1b01e3)[_0xfe73('0x1d')](_0xadf573);}return null;};}function patchUpdates(_0x78ecfc){return function(_0x4ebe3e){try{jsonpatch[_0xfe73('0x23')](_0x4ebe3e,_0x78ecfc,!![]);}catch(_0x24954e){return BPromise[_0xfe73('0x24')](_0x24954e);}return _0x4ebe3e[_0xfe73('0x25')]();};}function saveUpdates(_0xf9c70a,_0x3d485){return function(_0x4e2924){if(_0x4e2924){return _0x4e2924[_0xfe73('0x26')](_0xf9c70a)[_0xfe73('0x27')](function(_0x56619f){return _0x56619f;});}return null;};}function removeEntity(_0x4fc70d,_0x493644){return function(_0x2ed7c8){if(_0x2ed7c8){return _0x2ed7c8[_0xfe73('0x28')]()[_0xfe73('0x27')](function(){_0x4fc70d['status'](0xcc)[_0xfe73('0x29')]();});}};}function handleEntityNotFound(_0x4c50ef,_0x10d0ad){return function(_0x5dcb86){if(!_0x5dcb86){_0x4c50ef['sendStatus'](0x194);}return _0x5dcb86;};}function handleError(_0x547ca1,_0x9b5032){_0x9b5032=_0x9b5032||0x1f4;return function(_0x27e56c){logger['error'](_0x27e56c[_0xfe73('0x2a')]);if(_0x27e56c['name']){delete _0x27e56c['name'];}_0x547ca1[_0xfe73('0x1c')](_0x9b5032)[_0xfe73('0x2b')](_0x27e56c);};}exports[_0xfe73('0x2c')]=function(_0x1a2a34,_0x41be6c){var _0x3123cb={},_0x13aef4={},_0xebba10={'count':0x0,'rows':[]};var _0x51c9ac=_[_0xfe73('0x2d')](db[_0xfe73('0x2e')][_0xfe73('0x2f')],function(_0x568a2a){return{'name':_0x568a2a[_0xfe73('0x30')],'type':_0x568a2a[_0xfe73('0x31')][_0xfe73('0x32')]};});_0x13aef4[_0xfe73('0x33')]=_[_0xfe73('0x2d')](_0x51c9ac,'name');_0x13aef4[_0xfe73('0x34')]=_[_0xfe73('0x35')](_0x1a2a34['query']);_0x13aef4[_0xfe73('0x36')]=_[_0xfe73('0x37')](_0x13aef4[_0xfe73('0x33')],_0x13aef4['query']);_0x3123cb[_0xfe73('0x38')]=_[_0xfe73('0x37')](_0x13aef4[_0xfe73('0x33')],qs['fields'](_0x1a2a34['query'][_0xfe73('0x39')]));_0x3123cb[_0xfe73('0x38')]=_0x3123cb['attributes']['length']?_0x3123cb[_0xfe73('0x38')]:_0x13aef4[_0xfe73('0x33')];if(!_0x1a2a34[_0xfe73('0x34')]['hasOwnProperty']('nolimit')){_0x3123cb[_0xfe73('0x3a')]=qs[_0xfe73('0x3a')](_0x1a2a34[_0xfe73('0x34')]['limit']);_0x3123cb[_0xfe73('0x1e')]=qs[_0xfe73('0x1e')](_0x1a2a34[_0xfe73('0x34')]['offset']);}_0x3123cb[_0xfe73('0x3b')]=qs[_0xfe73('0x3c')](_0x1a2a34[_0xfe73('0x34')][_0xfe73('0x3c')]);_0x3123cb['where']=qs['filters'](_[_0xfe73('0x3d')](_0x1a2a34[_0xfe73('0x34')],_0x13aef4[_0xfe73('0x36')]),_0x51c9ac);if(_0x1a2a34[_0xfe73('0x34')]['filter']){_0x3123cb['where']=_[_0xfe73('0x3e')](_0x3123cb[_0xfe73('0x3f')],{'$or':_['map'](_0x51c9ac,function(_0x4d8a01){if(_0x4d8a01[_0xfe73('0x31')]!==_0xfe73('0x40')){var _0x432637={};_0x432637[_0x4d8a01['name']]={'$like':'%'+_0x1a2a34[_0xfe73('0x34')][_0xfe73('0x41')]+'%'};return _0x432637;}})});}_0x3123cb=_['merge']({},_0x3123cb,_0x1a2a34[_0xfe73('0x42')]);var _0x17aae8={'where':_0x3123cb[_0xfe73('0x3f')]};return db['ZohoAccount'][_0xfe73('0x20')](_0x17aae8)[_0xfe73('0x27')](function(_0x427e14){_0xebba10[_0xfe73('0x20')]=_0x427e14;if(_0x1a2a34[_0xfe73('0x34')]['includeAll']){_0x3123cb[_0xfe73('0x43')]=[{'all':!![]}];}return db[_0xfe73('0x2e')][_0xfe73('0x44')](_0x3123cb);})[_0xfe73('0x27')](function(_0x348ac4){_0xebba10['rows']=_0x348ac4;return _0xebba10;})[_0xfe73('0x27')](respondWithFilteredResult(_0x41be6c,_0x3123cb))[_0xfe73('0x45')](handleError(_0x41be6c,null));};exports[_0xfe73('0x46')]=function(_0x2af7e8,_0x455d30){var _0x887bbd={'raw':![],'where':{'id':_0x2af7e8[_0xfe73('0x47')]['id']}},_0x3cb5f3={};_0x3cb5f3['model']=_[_0xfe73('0x35')](db[_0xfe73('0x2e')][_0xfe73('0x2f')]);_0x3cb5f3[_0xfe73('0x34')]=_['keys'](_0x2af7e8[_0xfe73('0x34')]);_0x3cb5f3[_0xfe73('0x36')]=_[_0xfe73('0x37')](_0x3cb5f3['model'],_0x3cb5f3[_0xfe73('0x34')]);_0x887bbd[_0xfe73('0x38')]=_[_0xfe73('0x37')](_0x3cb5f3['model'],qs['fields'](_0x2af7e8[_0xfe73('0x34')][_0xfe73('0x39')]));_0x887bbd[_0xfe73('0x38')]=_0x887bbd['attributes'][_0xfe73('0x48')]?_0x887bbd[_0xfe73('0x38')]:_0x3cb5f3['model'];if(_0x2af7e8['query']['includeAll']){_0x887bbd[_0xfe73('0x43')]=[{'all':!![]}];}_0x887bbd=_[_0xfe73('0x3e')]({},_0x887bbd,_0x2af7e8[_0xfe73('0x42')]);return db[_0xfe73('0x2e')][_0xfe73('0x49')](_0x887bbd)[_0xfe73('0x27')](handleEntityNotFound(_0x455d30,null))[_0xfe73('0x27')](respondWithResult(_0x455d30,null))[_0xfe73('0x45')](handleError(_0x455d30,null));};exports[_0xfe73('0x4a')]=function(_0x53ac98,_0x2bb8cd){return db[_0xfe73('0x2e')][_0xfe73('0x4a')](_0x53ac98[_0xfe73('0x4b')],{})[_0xfe73('0x27')](respondWithResult(_0x2bb8cd,0xc9))[_0xfe73('0x45')](handleError(_0x2bb8cd,null));};exports[_0xfe73('0x26')]=function(_0x60b13a,_0x3f530d){if(_0x60b13a[_0xfe73('0x4b')]['id']){delete _0x60b13a[_0xfe73('0x4b')]['id'];}return db[_0xfe73('0x2e')]['find']({'where':{'id':_0x60b13a['params']['id']}})[_0xfe73('0x27')](handleEntityNotFound(_0x3f530d,null))[_0xfe73('0x27')](saveUpdates(_0x60b13a[_0xfe73('0x4b')],null))[_0xfe73('0x27')](respondWithResult(_0x3f530d,null))['catch'](handleError(_0x3f530d,null));};exports[_0xfe73('0x28')]=function(_0x271cf2,_0x42f3fe){return db[_0xfe73('0x2e')][_0xfe73('0x49')]({'where':{'id':_0x271cf2['params']['id']}})[_0xfe73('0x27')](handleEntityNotFound(_0x42f3fe,null))[_0xfe73('0x27')](removeEntity(_0x42f3fe,null))[_0xfe73('0x45')](handleError(_0x42f3fe,null));};exports[_0xfe73('0x4c')]=function(_0x108a9f,_0x4ca995,_0xc9327b){var _0xe3cd5e={};var _0xa19efd={};var _0x3b9a5f;var _0x5e5136;return db[_0xfe73('0x2e')][_0xfe73('0x4d')]({'where':{'id':_0x108a9f[_0xfe73('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ca995,null))[_0xfe73('0x27')](function(_0x29480e){if(_0x29480e){_0x3b9a5f=_0x29480e;_0xa19efd[_0xfe73('0x33')]=_['keys'](db[_0xfe73('0x4e')][_0xfe73('0x2f')]);_0xa19efd[_0xfe73('0x34')]=_[_0xfe73('0x35')](_0x108a9f['query']);_0xa19efd[_0xfe73('0x36')]=_[_0xfe73('0x37')](_0xa19efd[_0xfe73('0x33')],_0xa19efd[_0xfe73('0x34')]);_0xe3cd5e[_0xfe73('0x38')]=_[_0xfe73('0x37')](_0xa19efd[_0xfe73('0x33')],qs[_0xfe73('0x39')](_0x108a9f[_0xfe73('0x34')][_0xfe73('0x39')]));_0xe3cd5e['attributes']=_0xe3cd5e[_0xfe73('0x38')][_0xfe73('0x48')]?_0xe3cd5e[_0xfe73('0x38')]:_0xa19efd[_0xfe73('0x33')];_0xe3cd5e[_0xfe73('0x3b')]=qs[_0xfe73('0x3c')](_0x108a9f[_0xfe73('0x34')][_0xfe73('0x3c')]);_0xe3cd5e[_0xfe73('0x3f')]=qs[_0xfe73('0x36')](_['pick'](_0x108a9f[_0xfe73('0x34')],_0xa19efd[_0xfe73('0x36')]));if(_0x108a9f[_0xfe73('0x34')]['filter']){_0xe3cd5e['where']=_[_0xfe73('0x3e')](_0xe3cd5e[_0xfe73('0x3f')],{'$or':_['map'](_0xe3cd5e[_0xfe73('0x38')],function(_0x1423f9){var _0x2baf3={};_0x2baf3[_0x1423f9]={'$like':'%'+_0x108a9f['query'][_0xfe73('0x41')]+'%'};return _0x2baf3;})});}_0xe3cd5e=_['merge']({},_0xe3cd5e,_0x108a9f[_0xfe73('0x42')]);return _0x3b9a5f[_0xfe73('0x4c')](_0xe3cd5e);}})[_0xfe73('0x27')](function(_0x5f3187){if(_0x5f3187){_0x5e5136=_0x5f3187['length'];if(!_0x108a9f[_0xfe73('0x34')][_0xfe73('0x4f')](_0xfe73('0x50'))){_0xe3cd5e[_0xfe73('0x3a')]=qs['limit'](_0x108a9f[_0xfe73('0x34')][_0xfe73('0x3a')]);_0xe3cd5e[_0xfe73('0x1e')]=qs[_0xfe73('0x1e')](_0x108a9f[_0xfe73('0x34')][_0xfe73('0x1e')]);}return _0x3b9a5f[_0xfe73('0x4c')](_0xe3cd5e);}})[_0xfe73('0x27')](function(_0xb34cbb){if(_0xb34cbb){return _0xb34cbb?{'count':_0x5e5136,'rows':_0xb34cbb}:null;}})[_0xfe73('0x27')](respondWithResult(_0x4ca995,null))[_0xfe73('0x45')](handleError(_0x4ca995,null));};exports['addConfiguration']=function(_0x8913e0,_0x3f947e,_0x523ed5){if(_0x8913e0[_0xfe73('0x4b')]['id']){delete _0x8913e0[_0xfe73('0x4b')]['id'];}return db[_0xfe73('0x2e')][_0xfe73('0x4d')]({'where':{'id':_0x8913e0[_0xfe73('0x47')]['id']}})[_0xfe73('0x27')](handleEntityNotFound(_0x3f947e,null))[_0xfe73('0x27')](function(_0x1dff1){if(_0x1dff1){_0x8913e0[_0xfe73('0x4b')]['AccountId']=_0x1dff1['id'];_0x8913e0[_0xfe73('0x4b')][_0xfe73('0x51')]=integrations[_0xfe73('0x52')](_0x8913e0[_0xfe73('0x4b')][_0xfe73('0x53')],_0x8913e0[_0xfe73('0x4b')][_0xfe73('0x31')]);_0x8913e0[_0xfe73('0x4b')]['Descriptions']=integrations[_0xfe73('0x54')](_0x8913e0[_0xfe73('0x4b')][_0xfe73('0x53')],_0x8913e0[_0xfe73('0x4b')][_0xfe73('0x31')]);return db['ZohoConfiguration']['create'](_0x8913e0[_0xfe73('0x4b')],{'include':[{'model':db[_0xfe73('0x55')],'as':_0xfe73('0x51')},{'model':db[_0xfe73('0x55')],'as':_0xfe73('0x56')}]});}return null;})[_0xfe73('0x27')](respondWithResult(_0x3f947e,null))[_0xfe73('0x45')](handleError(_0x3f947e,null));};function getAccessToken(_0x371b1a){return new Promise(function(_0x171ee3,_0x57a9cd){var _0x99aad4;switch(_0x371b1a[_0xfe73('0x57')]){case'US':_0x99aad4=_0xfe73('0x58');break;case'AU':_0x99aad4=_0xfe73('0x59');break;case'EU':_0x99aad4=_0xfe73('0x5a');break;case'IN':_0x99aad4=_0xfe73('0x5b');break;case'CN':_0x99aad4='https://accounts.zoho.com.cn';break;default:_0x99aad4=_0xfe73('0x5a');break;}var _0x2037ae={'method':'POST','uri':_0x99aad4+'/oauth/v2/token','qs':{'refresh_token':_0x371b1a[_0xfe73('0x5c')],'client_id':_0x371b1a[_0xfe73('0x5d')],'client_secret':_0x371b1a['clientSecret'],'grant_type':_0xfe73('0x5e')},'json':!![]};return rp(_0x2037ae)[_0xfe73('0x27')](function(_0x224bdb){if(_0x224bdb[_0xfe73('0x5f')]){_0x171ee3(_0x224bdb[_0xfe73('0x5f')]);}else{_0x57a9cd(_0xfe73('0x60'));}})[_0xfe73('0x45')](function(_0x3866c8){_0x57a9cd(_0x3866c8);});});}exports[_0xfe73('0x61')]=function(_0x4f91f8,_0x1f7026,_0x219e4f){var _0x256ba5,_0x1a2404,_0x173628,_0x4addfc,_0x3314fd;return db[_0xfe73('0x2e')][_0xfe73('0x4d')]({'where':{'id':_0x4f91f8[_0xfe73('0x47')]['id']},'attributes':['id',_0xfe73('0x62'),'zone',_0xfe73('0x5d'),_0xfe73('0x63'),_0xfe73('0x64'),_0xfe73('0x65'),'refreshToken']})['then'](handleEntityNotFound(_0x1f7026,null))['then'](function(_0x1b4e49){_0x3314fd=_0x1b4e49;_0x256ba5=_0x3314fd[_0xfe73('0x62')];_0x1a2404=_0x256ba5==='zoho.eu'?'eu':'com';_0x173628=_0x3314fd[_0xfe73('0x64')];var _0x10e395=_0x173628['slice'](-0x1);if(_0x10e395==='/'||_0x10e395==='\x5c'||_0x10e395===':'){_0x173628=_0x173628['substring'](0x0,_0x173628[_0xfe73('0x66')](_0x10e395));}if(!_0x3314fd['refreshToken']){throw new Error(_0xfe73('0x67'));}return getAccessToken(_0x3314fd);})[_0xfe73('0x27')](function(_0x5767e4){if(_0x5767e4){return rp({'method':'GET','uri':util['format'](_0xfe73('0x68'),_0x1a2404),'qs':{'module':_0xfe73('0x69')},'headers':{'Authorization':_0xfe73('0x6a')+_0x5767e4},'json':!![]});}})[_0xfe73('0x27')](function(_0x5bec4f){if(_0x5bec4f){if(_0x5bec4f['response']&&_0x5bec4f[_0xfe73('0x6b')][_0xfe73('0x6c')]){throw new Error(_0x5bec4f[_0xfe73('0x6b')]['error'][_0xfe73('0x6d')]);}var _0x3210ce=[];var _0x518b07=[];var _0x43fa50=[_0xfe73('0x6e'),'Subject',_0xfe73('0x6f'),_0xfe73('0x70'),_0xfe73('0x71'),_0xfe73('0x72'),_0xfe73('0x73'),_0xfe73('0x74')];_0x518b07=_['remove'](_0x5bec4f[_0xfe73('0x39')],function(_0x4e893b){return _0x43fa50[_0xfe73('0x75')](_0x4e893b[_0xfe73('0x76')]);});for(var _0x3e081d=0x0;_0x3e081d<_0x518b07[_0xfe73('0x48')];_0x3e081d++){if(_0x518b07[_0x3e081d][_0xfe73('0x77')]===![]){_0x3210ce['push']({'id':_0x518b07[_0x3e081d]['id'],'name':_0x518b07[_0x3e081d]['display_label'],'custom':_0x518b07[_0x3e081d][_0xfe73('0x78')],'options':_0x518b07[_0x3e081d][_0xfe73('0x79')]==='picklist'&&_0x518b07[_0x3e081d]['pick_list_values'][_0xfe73('0x48')]>-0x1?_[_0xfe73('0x2d')](_0x518b07[_0x3e081d][_0xfe73('0x7a')],function(_0x2b8f85){return{'name':_0x2b8f85,'value':_0x2b8f85};}):[]});}}return{'count':_0x3210ce[_0xfe73('0x48')],'rows':_0x3210ce};}else{return{'count':0x0,'rows':[]};}})[_0xfe73('0x27')](respondWithResult(_0x1f7026,null))[_0xfe73('0x45')](function(_0x5dd257){var _0x4bb1f4=_0x4f91f8['query']['test']?0x1f4:_0x5dd257[_0xfe73('0x7b')]||0x1f4;logger[_0xfe73('0x6c')](_0xfe73('0x7c'),_0xfe73('0x61'),_0x4bb1f4,JSON[_0xfe73('0x7d')](_0x5dd257));delete _0x5dd257[_0xfe73('0x7e')];if(_0x4bb1f4===0x191){_0x4bb1f4=0x190;}_0x1f7026[_0xfe73('0x1c')](_0x4bb1f4)[_0xfe73('0x2b')](_0x4f91f8[_0xfe73('0x34')]['test']?{'message':_0xfe73('0x7f'),'statusCode':_0x5dd257[_0xfe73('0x7b')]}:_0x5dd257);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ce6b86d..f87f9e3 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 _0xd434=['clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','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','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','format','inspect','https://accounts.zoho.com.cn','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts','changed','zone','serverUrl','clientId'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd434,0x162));var _0x4d43=function(_0x45f32b,_0x1f2670){_0x45f32b=_0x45f32b-0x0;var _0x4c2259=_0xd434[_0x45f32b];return _0x4c2259;};'use strict';var _=require(_0x4d43('0x0'));var util=require(_0x4d43('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d43('0x2'));var rp=require(_0x4d43('0x3'));var fs=require('fs');var path=require(_0x4d43('0x4'));var rimraf=require(_0x4d43('0x5'));var config=require(_0x4d43('0x6'));var attributes=require(_0x4d43('0x7'));var integrations=require(_0x4d43('0x8'));module[_0x4d43('0x9')]=function(_0x2be114,_0x4e6ef7){return _0x2be114['define']('ZohoAccount',attributes,{'tableName':_0x4d43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a8120,_0x1d46f1,_0x2d2d95){if(_0x1a8120[_0x4d43('0xb')](_0x4d43('0xc'))||_0x1a8120[_0x4d43('0xb')](_0x4d43('0xd'))||_0x1a8120[_0x4d43('0xb')](_0x4d43('0xe'))||_0x1a8120[_0x4d43('0xb')](_0x4d43('0xf'))||_0x1a8120['changed'](_0x4d43('0x10'))||_0x1a8120[_0x4d43('0xb')](_0x4d43('0x11'))){var _0x180af2,_0x14f438;_0x180af2=_0x1a8120['serverUrl'];var _0x146d27=_0x180af2['slice'](-0x1);if(_0x146d27==='/'||_0x146d27==='\x5c'||_0x146d27===':'){_0x180af2=_0x180af2[_0x4d43('0x12')](0x0,_0x180af2[_0x4d43('0x13')](_0x146d27));}switch(_0x1a8120[_0x4d43('0xc')]){case'US':_0x14f438=_0x4d43('0x14');break;case'AU':_0x14f438=_0x4d43('0x15');break;case'IN':_0x14f438=_0x4d43('0x16');break;case'CN':_0x14f438='https://accounts.zoho.com.cn';break;default:_0x14f438=_0x4d43('0x17');break;}var _0x22a7ff={'method':_0x4d43('0x18'),'uri':_0x14f438+_0x4d43('0x19'),'form':{'grant_type':_0x4d43('0x1a'),'client_id':_0x1a8120[_0x4d43('0xe')],'client_secret':_0x1a8120[_0x4d43('0xf')],'redirect_uri':_0x1a8120[_0x4d43('0xd')],'code':_0x1a8120[_0x4d43('0x10')]},'headers':{'Content-Type':_0x4d43('0x1b')}};return rp(_0x22a7ff)[_0x4d43('0x1c')](function(_0x26dc4b){var _0x4ab98f=JSON[_0x4d43('0x1d')](_0x26dc4b);if(_0x4ab98f[_0x4d43('0x1e')]){_0x1a8120[_0x4d43('0x1f')]=_0x4ab98f[_0x4d43('0x1e')];logger[_0x4d43('0x20')](util['format'](_0x4d43('0x21'),_0x1a8120[_0x4d43('0x22')],_0x1a8120['id']));}else{logger[_0x4d43('0x23')](util['format'](_0x4d43('0x24'),_0x1a8120['name'],_0x1a8120['id']),util['inspect'](_0x4ab98f,{'showHidden':![],'depth':null}));}return _0x2d2d95(null,_0x1d46f1);})[_0x4d43('0x25')](function(_0x18b7f1){logger[_0x4d43('0x23')](util[_0x4d43('0x26')](_0x4d43('0x24'),_0x1a8120[_0x4d43('0x22')],_0x1a8120['id']),util[_0x4d43('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x2d2d95(_0x18b7f1);});}else{return _0x2d2d95(null,_0x1d46f1);}},'beforeUpdate':function(_0x520592,_0x1ccc7f,_0x237427){if(_0x520592['changed'](_0x4d43('0xc'))||_0x520592['changed'](_0x4d43('0xd'))||_0x520592[_0x4d43('0xb')](_0x4d43('0xe'))||_0x520592[_0x4d43('0xb')]('clientSecret')||_0x520592[_0x4d43('0xb')](_0x4d43('0x10'))||_0x520592[_0x4d43('0xb')](_0x4d43('0x11'))){var _0x162e43,_0x4a2e43;_0x162e43=_0x520592[_0x4d43('0xd')];var _0x531509=_0x162e43['slice'](-0x1);if(_0x531509==='/'||_0x531509==='\x5c'||_0x531509===':'){_0x162e43=_0x162e43[_0x4d43('0x12')](0x0,_0x162e43[_0x4d43('0x13')](_0x531509));}switch(_0x520592[_0x4d43('0xc')]){case'US':_0x4a2e43='https://accounts.zoho.com';break;case'AU':_0x4a2e43=_0x4d43('0x15');break;case'IN':_0x4a2e43=_0x4d43('0x16');break;case'CN':_0x4a2e43=_0x4d43('0x28');break;default:_0x4a2e43=_0x4d43('0x17');break;}var _0x5c0569={'method':_0x4d43('0x18'),'uri':_0x4a2e43+_0x4d43('0x19'),'form':{'grant_type':_0x4d43('0x1a'),'client_id':_0x520592[_0x4d43('0xe')],'client_secret':_0x520592[_0x4d43('0xf')],'redirect_uri':_0x520592['serverUrl'],'code':_0x520592[_0x4d43('0x10')]},'headers':{'Content-Type':_0x4d43('0x1b')}};return rp(_0x5c0569)[_0x4d43('0x1c')](function(_0x29a99c){var _0x1081e9=JSON['parse'](_0x29a99c);if(_0x1081e9['refresh_token']){_0x520592[_0x4d43('0x1f')]=_0x1081e9['refresh_token'];logger[_0x4d43('0x20')](util[_0x4d43('0x26')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x520592[_0x4d43('0x22')],_0x520592['id']));}else{logger[_0x4d43('0x23')](util[_0x4d43('0x26')](_0x4d43('0x24'),_0x520592[_0x4d43('0x22')],_0x520592['id']),util['inspect'](_0x1081e9,{'showHidden':![],'depth':null}));}return _0x237427(null,_0x1ccc7f);})['catch'](function(_0x409465){logger[_0x4d43('0x23')](util[_0x4d43('0x26')](_0x4d43('0x24'),_0x520592[_0x4d43('0x22')],_0x520592['id']),util[_0x4d43('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x237427(_0x409465);});}else{return _0x237427(null,_0x1ccc7f);}}}});}; \ No newline at end of file +var _0x526a=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','host','serverUrl','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x526a,0x1b5));var _0xa526=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x526a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa526('0x0'));var logger=require(_0xa526('0x1'))(_0xa526('0x2'));var moment=require('moment');var BPromise=require(_0xa526('0x3'));var rp=require(_0xa526('0x4'));var fs=require('fs');var path=require(_0xa526('0x5'));var rimraf=require(_0xa526('0x6'));var config=require('../../config/environment');var attributes=require(_0xa526('0x7'));var integrations=require(_0xa526('0x8'));module[_0xa526('0x9')]=function(_0x3bbb0c,_0x453ee3){return _0x3bbb0c[_0xa526('0xa')](_0xa526('0xb'),attributes,{'tableName':_0xa526('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e8d0,_0x3d95b9,_0x53b49f){if(_0x2e8d0[_0xa526('0xd')](_0xa526('0xe'))||_0x2e8d0[_0xa526('0xd')]('serverUrl')||_0x2e8d0[_0xa526('0xd')](_0xa526('0xf'))||_0x2e8d0['changed'](_0xa526('0x10'))||_0x2e8d0[_0xa526('0xd')]('code')||_0x2e8d0['changed'](_0xa526('0x11'))){var _0x5e0a25,_0x3ad84f;_0x5e0a25=_0x2e8d0[_0xa526('0x12')];var _0x1fc120=_0x5e0a25[_0xa526('0x13')](-0x1);if(_0x1fc120==='/'||_0x1fc120==='\x5c'||_0x1fc120===':'){_0x5e0a25=_0x5e0a25[_0xa526('0x14')](0x0,_0x5e0a25['lastIndexOf'](_0x1fc120));}switch(_0x2e8d0[_0xa526('0xe')]){case'US':_0x3ad84f='https://accounts.zoho.com';break;case'AU':_0x3ad84f=_0xa526('0x15');break;case'IN':_0x3ad84f='https://accounts.zoho.in';break;case'CN':_0x3ad84f=_0xa526('0x16');break;default:_0x3ad84f=_0xa526('0x17');break;}var _0x3f2956={'method':_0xa526('0x18'),'uri':_0x3ad84f+_0xa526('0x19'),'form':{'grant_type':_0xa526('0x1a'),'client_id':_0x2e8d0[_0xa526('0xf')],'client_secret':_0x2e8d0[_0xa526('0x10')],'redirect_uri':_0x2e8d0[_0xa526('0x12')],'code':_0x2e8d0[_0xa526('0x1b')]},'headers':{'Content-Type':_0xa526('0x1c')}};return rp(_0x3f2956)[_0xa526('0x1d')](function(_0x44b3d1){var _0x37d443=JSON['parse'](_0x44b3d1);if(_0x37d443[_0xa526('0x1e')]){_0x2e8d0[_0xa526('0x1f')]=_0x37d443[_0xa526('0x1e')];logger[_0xa526('0x20')](util[_0xa526('0x21')](_0xa526('0x22'),_0x2e8d0[_0xa526('0x23')],_0x2e8d0['id']));}else{logger[_0xa526('0x24')](util[_0xa526('0x21')](_0xa526('0x25'),_0x2e8d0[_0xa526('0x23')],_0x2e8d0['id']),util[_0xa526('0x26')](_0x37d443,{'showHidden':![],'depth':null}));}return _0x53b49f(null,_0x3d95b9);})[_0xa526('0x27')](function(_0x401a6c){logger[_0xa526('0x24')](util['format'](_0xa526('0x25'),_0x2e8d0[_0xa526('0x23')],_0x2e8d0['id']),util[_0xa526('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x53b49f(_0x401a6c);});}else{return _0x53b49f(null,_0x3d95b9);}},'beforeUpdate':function(_0x2c788a,_0x424d3b,_0x298953){if(_0x2c788a[_0xa526('0xd')](_0xa526('0xe'))||_0x2c788a[_0xa526('0xd')]('serverUrl')||_0x2c788a[_0xa526('0xd')](_0xa526('0xf'))||_0x2c788a[_0xa526('0xd')](_0xa526('0x10'))||_0x2c788a[_0xa526('0xd')](_0xa526('0x1b'))||_0x2c788a['changed']('host')){var _0x23751b,_0x340a0a;_0x23751b=_0x2c788a['serverUrl'];var _0x193617=_0x23751b[_0xa526('0x13')](-0x1);if(_0x193617==='/'||_0x193617==='\x5c'||_0x193617===':'){_0x23751b=_0x23751b[_0xa526('0x14')](0x0,_0x23751b[_0xa526('0x28')](_0x193617));}switch(_0x2c788a[_0xa526('0xe')]){case'US':_0x340a0a=_0xa526('0x29');break;case'AU':_0x340a0a=_0xa526('0x15');break;case'IN':_0x340a0a=_0xa526('0x2a');break;case'CN':_0x340a0a=_0xa526('0x16');break;default:_0x340a0a=_0xa526('0x17');break;}var _0x433d3d={'method':_0xa526('0x18'),'uri':_0x340a0a+'/oauth/v2/token','form':{'grant_type':_0xa526('0x1a'),'client_id':_0x2c788a[_0xa526('0xf')],'client_secret':_0x2c788a[_0xa526('0x10')],'redirect_uri':_0x2c788a['serverUrl'],'code':_0x2c788a[_0xa526('0x1b')]},'headers':{'Content-Type':_0xa526('0x1c')}};return rp(_0x433d3d)[_0xa526('0x1d')](function(_0x2a6837){var _0x5c0dbc=JSON['parse'](_0x2a6837);if(_0x5c0dbc['refresh_token']){_0x2c788a[_0xa526('0x1f')]=_0x5c0dbc[_0xa526('0x1e')];logger['info'](util['format'](_0xa526('0x22'),_0x2c788a[_0xa526('0x23')],_0x2c788a['id']));}else{logger['error'](util['format'](_0xa526('0x25'),_0x2c788a[_0xa526('0x23')],_0x2c788a['id']),util['inspect'](_0x5c0dbc,{'showHidden':![],'depth':null}));}return _0x298953(null,_0x424d3b);})['catch'](function(_0x33aaf2){logger[_0xa526('0x24')](util['format'](_0xa526('0x25'),_0x2c788a['name'],_0x2c788a['id']),util[_0xa526('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x298953(_0x33aaf2);});}else{return _0x298953(null,_0x424d3b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index cf3ee9b..50b4db7 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 _0xd1d3=['model','GetZohoAccount','ShowZohoAccount','find','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ZohoAccount','findAll','options','where','attributes','limit','include','map'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x16c4a6,_0x2907bd){_0x16c4a6=_0x16c4a6-0x0;var _0x52a4bc=_0xd1d3[_0x16c4a6];return _0x52a4bc;};'use strict';var _=require(_0x3d1d('0x0'));var util=require('util');var moment=require(_0x3d1d('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d1d('0x2'));var fs=require('fs');var Redis=require(_0x3d1d('0x3'));var db=require(_0x3d1d('0x4'))['db'];var utils=require(_0x3d1d('0x5'));var logger=require(_0x3d1d('0x6'))('rpc');var config=require(_0x3d1d('0x7'));var jayson=require(_0x3d1d('0x8'));var client=jayson['client'][_0x3d1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4431f6,_0x57d7db,_0x160c87){return new BPromise(function(_0x70ca94,_0x7ba595){return client[_0x3d1d('0xa')](_0x4431f6,_0x160c87)[_0x3d1d('0xb')](function(_0x41e786){logger[_0x3d1d('0xc')](_0x3d1d('0xd'),_0x57d7db,_0x3d1d('0xe'));logger[_0x3d1d('0xf')](_0x3d1d('0x10'),_0x57d7db,_0x3d1d('0xe'),JSON[_0x3d1d('0x11')](_0x41e786));if(_0x41e786[_0x3d1d('0x12')]){if(_0x41e786[_0x3d1d('0x12')][_0x3d1d('0x13')]===0x1f4){logger[_0x3d1d('0x12')](_0x3d1d('0xd'),_0x57d7db,_0x41e786[_0x3d1d('0x12')]['message']);return _0x7ba595(_0x41e786[_0x3d1d('0x12')][_0x3d1d('0x14')]);}logger[_0x3d1d('0x12')](_0x3d1d('0xd'),_0x57d7db,_0x41e786[_0x3d1d('0x12')][_0x3d1d('0x14')]);return _0x70ca94(_0x41e786[_0x3d1d('0x12')][_0x3d1d('0x14')]);}else{logger['info'](_0x3d1d('0xd'),_0x57d7db,_0x3d1d('0xe'));_0x70ca94(_0x41e786['result']['message']);}})[_0x3d1d('0x15')](function(_0x2c9c51){logger[_0x3d1d('0x12')](_0x3d1d('0xd'),_0x57d7db,_0x2c9c51);_0x7ba595(_0x2c9c51);});});}exports['GetZohoAccount']=function(_0x1898ce){var _0x46bc02=this;return new Promise(function(_0x1f6035,_0x328374){return db[_0x3d1d('0x16')][_0x3d1d('0x17')]({'raw':_0x1898ce['options']?_0x1898ce['options']['raw']===undefined?!![]:![]:!![],'where':_0x1898ce[_0x3d1d('0x18')]?_0x1898ce[_0x3d1d('0x18')][_0x3d1d('0x19')]||null:null,'attributes':_0x1898ce[_0x3d1d('0x18')]?_0x1898ce[_0x3d1d('0x18')][_0x3d1d('0x1a')]||null:null,'limit':_0x1898ce[_0x3d1d('0x18')]?_0x1898ce[_0x3d1d('0x18')][_0x3d1d('0x1b')]||null:null,'include':_0x1898ce['options']?_0x1898ce[_0x3d1d('0x18')][_0x3d1d('0x1c')]?_[_0x3d1d('0x1d')](_0x1898ce[_0x3d1d('0x18')]['include'],function(_0x228735){return{'model':db[_0x228735[_0x3d1d('0x1e')]],'as':_0x228735['as'],'attributes':_0x228735[_0x3d1d('0x1a')],'include':_0x228735[_0x3d1d('0x1c')]?_[_0x3d1d('0x1d')](_0x228735['include'],function(_0xb56ae1){return{'model':db[_0xb56ae1[_0x3d1d('0x1e')]],'as':_0xb56ae1['as'],'attributes':_0xb56ae1[_0x3d1d('0x1a')],'include':_0xb56ae1[_0x3d1d('0x1c')]?_[_0x3d1d('0x1d')](_0xb56ae1[_0x3d1d('0x1c')],function(_0x49b800){return{'model':db[_0x49b800['model']],'as':_0x49b800['as'],'attributes':_0x49b800['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d1d('0xb')](function(_0x2a983f){logger[_0x3d1d('0xc')](_0x3d1d('0x1f'),_0x1898ce);logger['debug']('GetZohoAccount',_0x1898ce,JSON[_0x3d1d('0x11')](_0x2a983f));_0x1f6035(_0x2a983f);})['catch'](function(_0x181d71){logger[_0x3d1d('0x12')](_0x3d1d('0x1f'),_0x181d71[_0x3d1d('0x14')],_0x1898ce);_0x328374(_0x46bc02[_0x3d1d('0x12')](0x1f4,_0x181d71[_0x3d1d('0x14')]));});});};exports[_0x3d1d('0x20')]=function(_0x635ca5){var _0x33bbed=this;return new Promise(function(_0x58b541,_0x1de5cf){return db[_0x3d1d('0x16')][_0x3d1d('0x21')]({'raw':_0x635ca5[_0x3d1d('0x18')]?_0x635ca5[_0x3d1d('0x18')][_0x3d1d('0x22')]===undefined?!![]:![]:!![],'where':_0x635ca5[_0x3d1d('0x18')]?_0x635ca5[_0x3d1d('0x18')]['where']||null:null,'attributes':_0x635ca5[_0x3d1d('0x18')]?_0x635ca5[_0x3d1d('0x18')][_0x3d1d('0x1a')]||null:null,'include':_0x635ca5[_0x3d1d('0x18')]?_0x635ca5[_0x3d1d('0x18')][_0x3d1d('0x1c')]?_[_0x3d1d('0x1d')](_0x635ca5[_0x3d1d('0x18')][_0x3d1d('0x1c')],function(_0xb65cbc){return{'model':db[_0xb65cbc['model']],'as':_0xb65cbc['as'],'attributes':_0xb65cbc[_0x3d1d('0x1a')],'include':_0xb65cbc[_0x3d1d('0x1c')]?_[_0x3d1d('0x1d')](_0xb65cbc[_0x3d1d('0x1c')],function(_0x183063){return{'model':db[_0x183063[_0x3d1d('0x1e')]],'as':_0x183063['as'],'attributes':_0x183063[_0x3d1d('0x1a')],'include':_0x183063[_0x3d1d('0x1c')]?_[_0x3d1d('0x1d')](_0x183063[_0x3d1d('0x1c')],function(_0x2f1362){return{'model':db[_0x2f1362[_0x3d1d('0x1e')]],'as':_0x2f1362['as'],'attributes':_0x2f1362['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d1d('0xb')](function(_0x41c260){logger[_0x3d1d('0xc')]('ShowZohoAccount',_0x635ca5);logger[_0x3d1d('0xf')](_0x3d1d('0x20'),_0x635ca5,JSON[_0x3d1d('0x11')](_0x41c260));_0x58b541(_0x41c260);})['catch'](function(_0x4c9b95){logger[_0x3d1d('0x12')]('ShowZohoAccount',_0x4c9b95['message'],_0x635ca5);_0x1de5cf(_0x33bbed[_0x3d1d('0x12')](0x1f4,_0x4c9b95[_0x3d1d('0x14')]));});});}; \ No newline at end of file +var _0x5d59=['debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','catch','ShowZohoAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x39acb8,_0x31d58d){var _0x521785=function(_0xc4441b){while(--_0xc4441b){_0x39acb8['push'](_0x39acb8['shift']());}};_0x521785(++_0x31d58d);}(_0x5d59,0x15f));var _0x95d5=function(_0x3b1fa6,_0x2f720c){_0x3b1fa6=_0x3b1fa6-0x0;var _0x3ad104=_0x5d59[_0x3b1fa6];return _0x3ad104;};'use strict';var _=require('lodash');var util=require(_0x95d5('0x0'));var moment=require(_0x95d5('0x1'));var BPromise=require(_0x95d5('0x2'));var rs=require(_0x95d5('0x3'));var fs=require('fs');var Redis=require(_0x95d5('0x4'));var db=require(_0x95d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95d5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x95d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfe94c,_0x11b2d4,_0x121537){return new BPromise(function(_0x489fab,_0x179d43){return client['request'](_0xfe94c,_0x121537)[_0x95d5('0x8')](function(_0x55249d){logger[_0x95d5('0x9')](_0x95d5('0xa'),_0x11b2d4,_0x95d5('0xb'));logger[_0x95d5('0xc')](_0x95d5('0xd'),_0x11b2d4,_0x95d5('0xb'),JSON[_0x95d5('0xe')](_0x55249d));if(_0x55249d[_0x95d5('0xf')]){if(_0x55249d['error'][_0x95d5('0x10')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x11b2d4,_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);return _0x179d43(_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);}logger['error'](_0x95d5('0xa'),_0x11b2d4,_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);return _0x489fab(_0x55249d[_0x95d5('0xf')][_0x95d5('0x11')]);}else{logger[_0x95d5('0x9')](_0x95d5('0xa'),_0x11b2d4,_0x95d5('0xb'));_0x489fab(_0x55249d[_0x95d5('0x12')]['message']);}})['catch'](function(_0x1747f2){logger['error'](_0x95d5('0xa'),_0x11b2d4,_0x1747f2);_0x179d43(_0x1747f2);});});}exports[_0x95d5('0x13')]=function(_0x5bdf14){var _0x1fe609=this;return new Promise(function(_0x3793eb,_0x233a32){return db[_0x95d5('0x14')][_0x95d5('0x15')]({'raw':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14['options'][_0x95d5('0x17')]===undefined?!![]:![]:!![],'where':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14[_0x95d5('0x16')]['where']||null:null,'attributes':_0x5bdf14['options']?_0x5bdf14[_0x95d5('0x16')][_0x95d5('0x18')]||null:null,'limit':_0x5bdf14['options']?_0x5bdf14[_0x95d5('0x16')][_0x95d5('0x19')]||null:null,'include':_0x5bdf14[_0x95d5('0x16')]?_0x5bdf14['options'][_0x95d5('0x1a')]?_['map'](_0x5bdf14['options']['include'],function(_0x554f4d){return{'model':db[_0x554f4d['model']],'as':_0x554f4d['as'],'attributes':_0x554f4d['attributes'],'include':_0x554f4d[_0x95d5('0x1a')]?_[_0x95d5('0x1b')](_0x554f4d[_0x95d5('0x1a')],function(_0x260582){return{'model':db[_0x260582['model']],'as':_0x260582['as'],'attributes':_0x260582[_0x95d5('0x18')],'include':_0x260582[_0x95d5('0x1a')]?_[_0x95d5('0x1b')](_0x260582[_0x95d5('0x1a')],function(_0xe12a95){return{'model':db[_0xe12a95[_0x95d5('0x1c')]],'as':_0xe12a95['as'],'attributes':_0xe12a95[_0x95d5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x95d5('0x8')](function(_0x3fde81){logger[_0x95d5('0x9')]('GetZohoAccount',_0x5bdf14);logger['debug'](_0x95d5('0x13'),_0x5bdf14,JSON[_0x95d5('0xe')](_0x3fde81));_0x3793eb(_0x3fde81);})[_0x95d5('0x1d')](function(_0x5dfe00){logger[_0x95d5('0xf')]('GetZohoAccount',_0x5dfe00[_0x95d5('0x11')],_0x5bdf14);_0x233a32(_0x1fe609['error'](0x1f4,_0x5dfe00[_0x95d5('0x11')]));});});};exports[_0x95d5('0x1e')]=function(_0x333459){var _0x21d4ff=this;return new Promise(function(_0x44d803,_0x362b8){return db[_0x95d5('0x14')][_0x95d5('0x1f')]({'raw':_0x333459['options']?_0x333459['options']['raw']===undefined?!![]:![]:!![],'where':_0x333459[_0x95d5('0x16')]?_0x333459[_0x95d5('0x16')][_0x95d5('0x20')]||null:null,'attributes':_0x333459[_0x95d5('0x16')]?_0x333459[_0x95d5('0x16')][_0x95d5('0x18')]||null:null,'include':_0x333459['options']?_0x333459[_0x95d5('0x16')][_0x95d5('0x1a')]?_[_0x95d5('0x1b')](_0x333459[_0x95d5('0x16')][_0x95d5('0x1a')],function(_0x435ee8){return{'model':db[_0x435ee8[_0x95d5('0x1c')]],'as':_0x435ee8['as'],'attributes':_0x435ee8[_0x95d5('0x18')],'include':_0x435ee8[_0x95d5('0x1a')]?_['map'](_0x435ee8['include'],function(_0x294314){return{'model':db[_0x294314[_0x95d5('0x1c')]],'as':_0x294314['as'],'attributes':_0x294314[_0x95d5('0x18')],'include':_0x294314[_0x95d5('0x1a')]?_['map'](_0x294314[_0x95d5('0x1a')],function(_0x5ee972){return{'model':db[_0x5ee972[_0x95d5('0x1c')]],'as':_0x5ee972['as'],'attributes':_0x5ee972[_0x95d5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x95d5('0x8')](function(_0x56501c){logger[_0x95d5('0x9')](_0x95d5('0x1e'),_0x333459);logger[_0x95d5('0xc')](_0x95d5('0x1e'),_0x333459,JSON[_0x95d5('0xe')](_0x56501c));_0x44d803(_0x56501c);})[_0x95d5('0x1d')](function(_0x4f9bf5){logger[_0x95d5('0xf')](_0x95d5('0x1e'),_0x4f9bf5[_0x95d5('0x11')],_0x333459);_0x362b8(_0x21d4ff[_0x95d5('0xf')](0x1f4,_0x4f9bf5[_0x95d5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1931308..a3b27a1 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 _0xd65c=['post','create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x3ff9d8,_0x36ae4e){var _0x4fa389=function(_0x18b0ea){while(--_0x18b0ea){_0x3ff9d8['push'](_0x3ff9d8['shift']());}};_0x4fa389(++_0x36ae4e);}(_0xd65c,0x119));var _0xcd65=function(_0x2c7acd,_0x22a6ef){_0x2c7acd=_0x2c7acd-0x0;var _0x4be951=_0xd65c[_0x2c7acd];return _0x4be951;};'use strict';var multer=require('multer');var util=require(_0xcd65('0x0'));var path=require(_0xcd65('0x1'));var timeout=require(_0xcd65('0x2'));var express=require('express');var router=express[_0xcd65('0x3')]();var fs_extra=require(_0xcd65('0x4'));var auth=require(_0xcd65('0x5'));var interaction=require(_0xcd65('0x6'));var config=require(_0xcd65('0x7'));var controller=require(_0xcd65('0x8'));router[_0xcd65('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd65('0x9')](_0xcd65('0xa'),auth['isAuthenticated'](),controller[_0xcd65('0xb')]);router[_0xcd65('0x9')](_0xcd65('0xc'),auth[_0xcd65('0xd')](),controller[_0xcd65('0xe')]);router['get'](_0xcd65('0xf'),auth[_0xcd65('0xd')](),controller[_0xcd65('0x10')]);router[_0xcd65('0x9')](_0xcd65('0x11'),auth['isAuthenticated'](),controller[_0xcd65('0x12')]);router[_0xcd65('0x13')]('/',auth[_0xcd65('0xd')](),controller[_0xcd65('0x14')]);router[_0xcd65('0x15')](_0xcd65('0xa'),auth[_0xcd65('0xd')](),controller[_0xcd65('0x16')]);router[_0xcd65('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xcd65('0x18')]=router; \ No newline at end of file +var _0x3eb9=['post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x55eb94,_0x492c3f){var _0x3873ed=function(_0x3824bd){while(--_0x3824bd){_0x55eb94['push'](_0x55eb94['shift']());}};_0x3873ed(++_0x492c3f);}(_0x3eb9,0x13e));var _0x93eb=function(_0xc471d2,_0x26ab16){_0xc471d2=_0xc471d2-0x0;var _0x334c68=_0x3eb9[_0xc471d2];return _0x334c68;};'use strict';var multer=require('multer');var util=require(_0x93eb('0x0'));var path=require(_0x93eb('0x1'));var timeout=require(_0x93eb('0x2'));var express=require('express');var router=express[_0x93eb('0x3')]();var fs_extra=require(_0x93eb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x93eb('0x5'));var config=require(_0x93eb('0x6'));var controller=require(_0x93eb('0x7'));router[_0x93eb('0x8')]('/',auth[_0x93eb('0x9')](),controller['index']);router['get'](_0x93eb('0xa'),auth[_0x93eb('0x9')](),controller[_0x93eb('0xb')]);router[_0x93eb('0x8')](_0x93eb('0xc'),auth['isAuthenticated'](),controller[_0x93eb('0xd')]);router[_0x93eb('0x8')](_0x93eb('0xe'),auth[_0x93eb('0x9')](),controller[_0x93eb('0xf')]);router['get'](_0x93eb('0x10'),auth[_0x93eb('0x9')](),controller[_0x93eb('0x11')]);router[_0x93eb('0x12')]('/',auth[_0x93eb('0x9')](),controller[_0x93eb('0x13')]);router[_0x93eb('0x14')](_0x93eb('0xa'),auth[_0x93eb('0x9')](),controller[_0x93eb('0x15')]);router['delete'](_0x93eb('0xa'),auth['isAuthenticated'](),controller[_0x93eb('0x16')]);module[_0x93eb('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 0d58319..c4ec467 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 _0x10b2=['exports','STRING','ENUM','lead','contact','contact_lead','sequelize'];(function(_0xe7d210,_0x53ff48){var _0x12aefb=function(_0x6895f){while(--_0x6895f){_0xe7d210['push'](_0xe7d210['shift']());}};_0x12aefb(++_0x53ff48);}(_0x10b2,0x18e));var _0x210b=function(_0x59dbbd,_0x37bd85){_0x59dbbd=_0x59dbbd-0x0;var _0x4a484d=_0x10b2[_0x59dbbd];return _0x4a484d;};'use strict';var Sequelize=require(_0x210b('0x0'));module[_0x210b('0x1')]={'name':{'type':Sequelize[_0x210b('0x2')]},'moduleCreate':{'type':Sequelize[_0x210b('0x3')](_0x210b('0x4'),_0x210b('0x5'),'nothing'),'defaultValue':_0x210b('0x4')},'moduleSearch':{'type':Sequelize[_0x210b('0x3')](_0x210b('0x6'),_0x210b('0x5'),_0x210b('0x4')),'defaultValue':_0x210b('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbc58=['STRING','sequelize','ENUM','contact','nothing','lead','contact_lead'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xbc58,0xcc));var _0x8bc5=function(_0x10cb3d,_0x5af43f){_0x10cb3d=_0x10cb3d-0x0;var _0x207dfb=_0xbc58[_0x10cb3d];return _0x207dfb;};'use strict';var Sequelize=require(_0x8bc5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x8bc5('0x1')]('lead',_0x8bc5('0x2'),_0x8bc5('0x3')),'defaultValue':_0x8bc5('0x4')},'moduleSearch':{'type':Sequelize[_0x8bc5('0x1')](_0x8bc5('0x5'),_0x8bc5('0x2'),_0x8bc5('0x4')),'defaultValue':_0x8bc5('0x5')},'description':{'type':Sequelize[_0x8bc5('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index fb3881c..4f1f277 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 _0xa139=['options','includeAll','include','catch','show','params','keys','filters','merge','find','create','body','findOne','ZohoField','getFields','nolimit','getSubjects','sort','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','VIRTUAL'];(function(_0x4588bd,_0x57222b){var _0x1becaa=function(_0x2ec59d){while(--_0x2ec59d){_0x4588bd['push'](_0x4588bd['shift']());}};_0x1becaa(++_0x57222b);}(_0xa139,0x14b));var _0x9a13=function(_0x2fb10f,_0x4b9bc6){_0x2fb10f=_0x2fb10f-0x0;var _0x3aaef0=_0xa139[_0x2fb10f];return _0x3aaef0;};'use strict';var emlformat=require(_0x9a13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a13('0x1'));var jsonpatch=require(_0x9a13('0x2'));var rp=require(_0x9a13('0x3'));var moment=require('moment');var BPromise=require(_0x9a13('0x4'));var Mustache=require(_0x9a13('0x5'));var util=require(_0x9a13('0x6'));var path=require('path');var sox=require(_0x9a13('0x7'));var csv=require(_0x9a13('0x8'));var ejs=require(_0x9a13('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a13('0xa'));var squel=require(_0x9a13('0xb'));var crypto=require(_0x9a13('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9a13('0xd'));var toCsv=require(_0x9a13('0x8'));var querystring=require(_0x9a13('0xe'));var Papa=require(_0x9a13('0xf'));var Redis=require('ioredis');var authService=require(_0x9a13('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9a13('0x11'));var hardwareService=require(_0x9a13('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9a13('0x13'));var config=require(_0x9a13('0x14'));var licenseUtil=require(_0x9a13('0x15'));var db=require(_0x9a13('0x16'))['db'];function respondWithStatusCode(_0x520db7,_0x4a2884){_0x4a2884=_0x4a2884||0xcc;return function(_0xfb836e){if(_0xfb836e){return _0x520db7[_0x9a13('0x17')](_0x4a2884);}return _0x520db7[_0x9a13('0x18')](_0x4a2884)[_0x9a13('0x19')]();};}function respondWithResult(_0x24e2cd,_0x4fba50){_0x4fba50=_0x4fba50||0xc8;return function(_0x2c5365){if(_0x2c5365){return _0x24e2cd['status'](_0x4fba50)['json'](_0x2c5365);}};}function respondWithFilteredResult(_0x426e20,_0x3016b7){return function(_0x3f4cf8){if(_0x3f4cf8){var _0x448114=typeof _0x3016b7[_0x9a13('0x1a')]===_0x9a13('0x1b')&&typeof _0x3016b7[_0x9a13('0x1c')]===_0x9a13('0x1b');var _0x5d2c72=_0x3f4cf8[_0x9a13('0x1d')];var _0x2ee13c=_0x448114?0x0:_0x3016b7[_0x9a13('0x1a')];var _0x4727d7=_0x448114?_0x3f4cf8[_0x9a13('0x1d')]:_0x3016b7[_0x9a13('0x1a')]+_0x3016b7['limit'];var _0x5e5245;if(_0x4727d7>=_0x5d2c72){_0x4727d7=_0x5d2c72;_0x5e5245=0xc8;}else{_0x5e5245=0xce;}_0x426e20[_0x9a13('0x18')](_0x5e5245);return _0x426e20[_0x9a13('0x1e')](_0x9a13('0x1f'),_0x2ee13c+'-'+_0x4727d7+'/'+_0x5d2c72)[_0x9a13('0x20')](_0x3f4cf8);}return null;};}function patchUpdates(_0x28045a){return function(_0x24acdc){try{jsonpatch[_0x9a13('0x21')](_0x24acdc,_0x28045a,!![]);}catch(_0x1bfef3){return BPromise['reject'](_0x1bfef3);}return _0x24acdc[_0x9a13('0x22')]();};}function saveUpdates(_0x203aa2,_0x5045aa){return function(_0x56cc70){if(_0x56cc70){return _0x56cc70[_0x9a13('0x23')](_0x203aa2)[_0x9a13('0x24')](function(_0x2fb585){return _0x2fb585;});}return null;};}function removeEntity(_0x57ad1f,_0x3ae1a7){return function(_0x3e1cd8){if(_0x3e1cd8){return _0x3e1cd8[_0x9a13('0x25')]()[_0x9a13('0x24')](function(){_0x57ad1f[_0x9a13('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1107,_0x5014c7){return function(_0x369a0a){if(!_0x369a0a){_0xc1107[_0x9a13('0x17')](0x194);}return _0x369a0a;};}function handleError(_0x1c8067,_0x1e10ba){_0x1e10ba=_0x1e10ba||0x1f4;return function(_0x626a78){logger['error'](_0x626a78['stack']);if(_0x626a78[_0x9a13('0x26')]){delete _0x626a78[_0x9a13('0x26')];}_0x1c8067[_0x9a13('0x18')](_0x1e10ba)[_0x9a13('0x27')](_0x626a78);};}exports[_0x9a13('0x28')]=function(_0x771dba,_0x235dcd){var _0x3880b7={},_0x4bc424={},_0x40ab91={'count':0x0,'rows':[]};var _0x1f24f9=_[_0x9a13('0x29')](db[_0x9a13('0x2a')][_0x9a13('0x2b')],function(_0xbb54ae){return{'name':_0xbb54ae[_0x9a13('0x2c')],'type':_0xbb54ae[_0x9a13('0x2d')][_0x9a13('0x2e')]};});_0x4bc424[_0x9a13('0x2f')]=_[_0x9a13('0x29')](_0x1f24f9,_0x9a13('0x26'));_0x4bc424[_0x9a13('0x30')]=_['keys'](_0x771dba[_0x9a13('0x30')]);_0x4bc424['filters']=_[_0x9a13('0x31')](_0x4bc424[_0x9a13('0x2f')],_0x4bc424[_0x9a13('0x30')]);_0x3880b7[_0x9a13('0x32')]=_[_0x9a13('0x31')](_0x4bc424['model'],qs[_0x9a13('0x33')](_0x771dba[_0x9a13('0x30')]['fields']));_0x3880b7[_0x9a13('0x32')]=_0x3880b7[_0x9a13('0x32')][_0x9a13('0x34')]?_0x3880b7[_0x9a13('0x32')]:_0x4bc424[_0x9a13('0x2f')];if(!_0x771dba['query'][_0x9a13('0x35')]('nolimit')){_0x3880b7[_0x9a13('0x1c')]=qs[_0x9a13('0x1c')](_0x771dba[_0x9a13('0x30')][_0x9a13('0x1c')]);_0x3880b7['offset']=qs[_0x9a13('0x1a')](_0x771dba[_0x9a13('0x30')][_0x9a13('0x1a')]);}_0x3880b7[_0x9a13('0x36')]=qs['sort'](_0x771dba[_0x9a13('0x30')]['sort']);_0x3880b7['where']=qs['filters'](_[_0x9a13('0x37')](_0x771dba[_0x9a13('0x30')],_0x4bc424['filters']),_0x1f24f9);if(_0x771dba[_0x9a13('0x30')][_0x9a13('0x38')]){_0x3880b7[_0x9a13('0x39')]=_['merge'](_0x3880b7[_0x9a13('0x39')],{'$or':_['map'](_0x1f24f9,function(_0x10de1e){if(_0x10de1e[_0x9a13('0x2d')]!==_0x9a13('0x3a')){var _0x49569f={};_0x49569f[_0x10de1e['name']]={'$like':'%'+_0x771dba[_0x9a13('0x30')][_0x9a13('0x38')]+'%'};return _0x49569f;}})});}_0x3880b7=_['merge']({},_0x3880b7,_0x771dba[_0x9a13('0x3b')]);var _0xc60f20={'where':_0x3880b7[_0x9a13('0x39')]};return db[_0x9a13('0x2a')][_0x9a13('0x1d')](_0xc60f20)[_0x9a13('0x24')](function(_0x15abc3){_0x40ab91[_0x9a13('0x1d')]=_0x15abc3;if(_0x771dba[_0x9a13('0x30')][_0x9a13('0x3c')]){_0x3880b7[_0x9a13('0x3d')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x3880b7);})[_0x9a13('0x24')](function(_0x4ab244){_0x40ab91['rows']=_0x4ab244;return _0x40ab91;})[_0x9a13('0x24')](respondWithFilteredResult(_0x235dcd,_0x3880b7))[_0x9a13('0x3e')](handleError(_0x235dcd,null));};exports[_0x9a13('0x3f')]=function(_0x5c7663,_0x22ede0){var _0x4fc728={'raw':![],'where':{'id':_0x5c7663[_0x9a13('0x40')]['id']}},_0xe436d={};_0xe436d['model']=_['keys'](db[_0x9a13('0x2a')][_0x9a13('0x2b')]);_0xe436d[_0x9a13('0x30')]=_[_0x9a13('0x41')](_0x5c7663[_0x9a13('0x30')]);_0xe436d[_0x9a13('0x42')]=_[_0x9a13('0x31')](_0xe436d[_0x9a13('0x2f')],_0xe436d['query']);_0x4fc728[_0x9a13('0x32')]=_['intersection'](_0xe436d[_0x9a13('0x2f')],qs[_0x9a13('0x33')](_0x5c7663[_0x9a13('0x30')][_0x9a13('0x33')]));_0x4fc728[_0x9a13('0x32')]=_0x4fc728['attributes'][_0x9a13('0x34')]?_0x4fc728[_0x9a13('0x32')]:_0xe436d[_0x9a13('0x2f')];if(_0x5c7663['query'][_0x9a13('0x3c')]){_0x4fc728['include']=[{'all':!![]}];}_0x4fc728=_[_0x9a13('0x43')]({},_0x4fc728,_0x5c7663[_0x9a13('0x3b')]);return db['ZohoConfiguration'][_0x9a13('0x44')](_0x4fc728)[_0x9a13('0x24')](handleEntityNotFound(_0x22ede0,null))[_0x9a13('0x24')](respondWithResult(_0x22ede0,null))[_0x9a13('0x3e')](handleError(_0x22ede0,null));};exports[_0x9a13('0x45')]=function(_0x5d8c3a,_0x580959){return db[_0x9a13('0x2a')][_0x9a13('0x45')](_0x5d8c3a[_0x9a13('0x46')],{})[_0x9a13('0x24')](respondWithResult(_0x580959,0xc9))[_0x9a13('0x3e')](handleError(_0x580959,null));};exports[_0x9a13('0x23')]=function(_0x40aaaf,_0xec0f91){if(_0x40aaaf[_0x9a13('0x46')]['id']){delete _0x40aaaf[_0x9a13('0x46')]['id'];}return db[_0x9a13('0x2a')][_0x9a13('0x44')]({'where':{'id':_0x40aaaf[_0x9a13('0x40')]['id']}})[_0x9a13('0x24')](handleEntityNotFound(_0xec0f91,null))[_0x9a13('0x24')](saveUpdates(_0x40aaaf[_0x9a13('0x46')],null))[_0x9a13('0x24')](respondWithResult(_0xec0f91,null))[_0x9a13('0x3e')](handleError(_0xec0f91,null));};exports[_0x9a13('0x25')]=function(_0x44eec1,_0x2dba51){return db[_0x9a13('0x2a')]['find']({'where':{'id':_0x44eec1[_0x9a13('0x40')]['id']}})['then'](handleEntityNotFound(_0x2dba51,null))[_0x9a13('0x24')](removeEntity(_0x2dba51,null))['catch'](handleError(_0x2dba51,null));};exports['getFields']=function(_0x1e7cff,_0x166aa1,_0x66cc49){var _0x2d64ff={};var _0x11c472={};var _0x195d01;var _0x4b9d6e;return db[_0x9a13('0x2a')][_0x9a13('0x47')]({'where':{'id':_0x1e7cff['params']['id']}})['then'](handleEntityNotFound(_0x166aa1,null))[_0x9a13('0x24')](function(_0x1b7760){if(_0x1b7760){_0x195d01=_0x1b7760;_0x11c472[_0x9a13('0x2f')]=_[_0x9a13('0x41')](db[_0x9a13('0x48')][_0x9a13('0x2b')]);_0x11c472['query']=_['keys'](_0x1e7cff[_0x9a13('0x30')]);_0x11c472[_0x9a13('0x42')]=_['intersection'](_0x11c472[_0x9a13('0x2f')],_0x11c472[_0x9a13('0x30')]);_0x2d64ff[_0x9a13('0x32')]=_[_0x9a13('0x31')](_0x11c472['model'],qs[_0x9a13('0x33')](_0x1e7cff[_0x9a13('0x30')][_0x9a13('0x33')]));_0x2d64ff[_0x9a13('0x32')]=_0x2d64ff[_0x9a13('0x32')][_0x9a13('0x34')]?_0x2d64ff[_0x9a13('0x32')]:_0x11c472[_0x9a13('0x2f')];_0x2d64ff[_0x9a13('0x36')]=qs['sort'](_0x1e7cff[_0x9a13('0x30')]['sort']);_0x2d64ff[_0x9a13('0x39')]=qs['filters'](_[_0x9a13('0x37')](_0x1e7cff['query'],_0x11c472[_0x9a13('0x42')]));if(_0x1e7cff[_0x9a13('0x30')][_0x9a13('0x38')]){_0x2d64ff['where']=_[_0x9a13('0x43')](_0x2d64ff['where'],{'$or':_[_0x9a13('0x29')](_0x2d64ff['attributes'],function(_0x4e79f5){var _0x258ddc={};_0x258ddc[_0x4e79f5]={'$like':'%'+_0x1e7cff['query'][_0x9a13('0x38')]+'%'};return _0x258ddc;})});}_0x2d64ff=_[_0x9a13('0x43')]({},_0x2d64ff,_0x1e7cff[_0x9a13('0x3b')]);return _0x195d01[_0x9a13('0x49')](_0x2d64ff);}})[_0x9a13('0x24')](function(_0x642363){if(_0x642363){_0x4b9d6e=_0x642363['length'];if(!_0x1e7cff[_0x9a13('0x30')][_0x9a13('0x35')](_0x9a13('0x4a'))){_0x2d64ff[_0x9a13('0x1c')]=qs[_0x9a13('0x1c')](_0x1e7cff[_0x9a13('0x30')][_0x9a13('0x1c')]);_0x2d64ff[_0x9a13('0x1a')]=qs[_0x9a13('0x1a')](_0x1e7cff['query'][_0x9a13('0x1a')]);}return _0x195d01[_0x9a13('0x49')](_0x2d64ff);}})[_0x9a13('0x24')](function(_0x45bed0){if(_0x45bed0){return _0x45bed0?{'count':_0x4b9d6e,'rows':_0x45bed0}:null;}})[_0x9a13('0x24')](respondWithResult(_0x166aa1,null))[_0x9a13('0x3e')](handleError(_0x166aa1,null));};exports[_0x9a13('0x4b')]=function(_0x4c3392,_0x48604d,_0x242644){var _0x453725={};var _0x2fc4d7={};var _0x50d894;var _0x58b176;return db[_0x9a13('0x2a')][_0x9a13('0x47')]({'where':{'id':_0x4c3392['params']['id']}})[_0x9a13('0x24')](handleEntityNotFound(_0x48604d,null))[_0x9a13('0x24')](function(_0x44374b){if(_0x44374b){_0x50d894=_0x44374b;_0x2fc4d7['model']=_[_0x9a13('0x41')](db[_0x9a13('0x48')]['rawAttributes']);_0x2fc4d7[_0x9a13('0x30')]=_[_0x9a13('0x41')](_0x4c3392[_0x9a13('0x30')]);_0x2fc4d7[_0x9a13('0x42')]=_[_0x9a13('0x31')](_0x2fc4d7['model'],_0x2fc4d7[_0x9a13('0x30')]);_0x453725[_0x9a13('0x32')]=_['intersection'](_0x2fc4d7[_0x9a13('0x2f')],qs[_0x9a13('0x33')](_0x4c3392[_0x9a13('0x30')]['fields']));_0x453725['attributes']=_0x453725[_0x9a13('0x32')]['length']?_0x453725[_0x9a13('0x32')]:_0x2fc4d7[_0x9a13('0x2f')];_0x453725['order']=qs[_0x9a13('0x4c')](_0x4c3392[_0x9a13('0x30')][_0x9a13('0x4c')]);_0x453725['where']=qs[_0x9a13('0x42')](_[_0x9a13('0x37')](_0x4c3392[_0x9a13('0x30')],_0x2fc4d7['filters']));if(_0x4c3392[_0x9a13('0x30')][_0x9a13('0x38')]){_0x453725['where']=_['merge'](_0x453725['where'],{'$or':_[_0x9a13('0x29')](_0x453725['attributes'],function(_0x45e011){var _0x335b84={};_0x335b84[_0x45e011]={'$like':'%'+_0x4c3392['query'][_0x9a13('0x38')]+'%'};return _0x335b84;})});}_0x453725=_['merge']({},_0x453725,_0x4c3392['options']);return _0x50d894[_0x9a13('0x4b')](_0x453725);}})['then'](function(_0xd26529){if(_0xd26529){_0x58b176=_0xd26529[_0x9a13('0x34')];if(!_0x4c3392['query'][_0x9a13('0x35')]('nolimit')){_0x453725[_0x9a13('0x1c')]=qs[_0x9a13('0x1c')](_0x4c3392[_0x9a13('0x30')]['limit']);_0x453725[_0x9a13('0x1a')]=qs[_0x9a13('0x1a')](_0x4c3392[_0x9a13('0x30')][_0x9a13('0x1a')]);}return _0x50d894['getSubjects'](_0x453725);}})[_0x9a13('0x24')](function(_0x3c2b33){if(_0x3c2b33){return _0x3c2b33?{'count':_0x58b176,'rows':_0x3c2b33}:null;}})[_0x9a13('0x24')](respondWithResult(_0x48604d,null))['catch'](handleError(_0x48604d,null));};exports[_0x9a13('0x4d')]=function(_0x20091e,_0x190fd2,_0x372d1e){var _0x4f8faa={};var _0x3b9322={};var _0x3d4258;var _0x2cc5bc;return db['ZohoConfiguration'][_0x9a13('0x47')]({'where':{'id':_0x20091e[_0x9a13('0x40')]['id']}})['then'](handleEntityNotFound(_0x190fd2,null))[_0x9a13('0x24')](function(_0x5426e4){if(_0x5426e4){_0x3d4258=_0x5426e4;_0x3b9322[_0x9a13('0x2f')]=_[_0x9a13('0x41')](db[_0x9a13('0x48')][_0x9a13('0x2b')]);_0x3b9322[_0x9a13('0x30')]=_[_0x9a13('0x41')](_0x20091e[_0x9a13('0x30')]);_0x3b9322[_0x9a13('0x42')]=_['intersection'](_0x3b9322[_0x9a13('0x2f')],_0x3b9322[_0x9a13('0x30')]);_0x4f8faa['attributes']=_['intersection'](_0x3b9322[_0x9a13('0x2f')],qs['fields'](_0x20091e[_0x9a13('0x30')][_0x9a13('0x33')]));_0x4f8faa[_0x9a13('0x32')]=_0x4f8faa[_0x9a13('0x32')][_0x9a13('0x34')]?_0x4f8faa[_0x9a13('0x32')]:_0x3b9322[_0x9a13('0x2f')];_0x4f8faa[_0x9a13('0x36')]=qs[_0x9a13('0x4c')](_0x20091e[_0x9a13('0x30')]['sort']);_0x4f8faa[_0x9a13('0x39')]=qs[_0x9a13('0x42')](_['pick'](_0x20091e[_0x9a13('0x30')],_0x3b9322['filters']));if(_0x20091e[_0x9a13('0x30')]['filter']){_0x4f8faa[_0x9a13('0x39')]=_['merge'](_0x4f8faa['where'],{'$or':_[_0x9a13('0x29')](_0x4f8faa['attributes'],function(_0x2cc71b){var _0x35b61e={};_0x35b61e[_0x2cc71b]={'$like':'%'+_0x20091e[_0x9a13('0x30')][_0x9a13('0x38')]+'%'};return _0x35b61e;})});}_0x4f8faa=_[_0x9a13('0x43')]({},_0x4f8faa,_0x20091e[_0x9a13('0x3b')]);return _0x3d4258[_0x9a13('0x4d')](_0x4f8faa);}})[_0x9a13('0x24')](function(_0xed1527){if(_0xed1527){_0x2cc5bc=_0xed1527[_0x9a13('0x34')];if(!_0x20091e[_0x9a13('0x30')][_0x9a13('0x35')](_0x9a13('0x4a'))){_0x4f8faa[_0x9a13('0x1c')]=qs[_0x9a13('0x1c')](_0x20091e[_0x9a13('0x30')][_0x9a13('0x1c')]);_0x4f8faa['offset']=qs[_0x9a13('0x1a')](_0x20091e[_0x9a13('0x30')][_0x9a13('0x1a')]);}return _0x3d4258[_0x9a13('0x4d')](_0x4f8faa);}})['then'](function(_0x34bc10){if(_0x34bc10){return _0x34bc10?{'count':_0x2cc5bc,'rows':_0x34bc10}:null;}})[_0x9a13('0x24')](respondWithResult(_0x190fd2,null))[_0x9a13('0x3e')](handleError(_0x190fd2,null));}; \ No newline at end of file +var _0xdef4=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','reject','save','update','then','destroy','error','stack','send','map','ZohoConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','count','includeAll','include','findAll','rows','show','params','find','catch','body','findOne','ZohoField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce'];(function(_0x2dba7e,_0x36b2ac){var _0x373601=function(_0x136714){while(--_0x136714){_0x2dba7e['push'](_0x2dba7e['shift']());}};_0x373601(++_0x36b2ac);}(_0xdef4,0xe3));var _0x4def=function(_0x5d4460,_0x400e28){_0x5d4460=_0x5d4460-0x0;var _0x5bdc5e=_0xdef4[_0x5d4460];return _0x5bdc5e;};'use strict';var emlformat=require(_0x4def('0x0'));var rimraf=require(_0x4def('0x1'));var zipdir=require(_0x4def('0x2'));var jsonpatch=require(_0x4def('0x3'));var rp=require(_0x4def('0x4'));var moment=require('moment');var BPromise=require(_0x4def('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4def('0x6'));var sox=require(_0x4def('0x7'));var csv=require(_0x4def('0x8'));var ejs=require(_0x4def('0x9'));var fs=require('fs');var fs_extra=require(_0x4def('0xa'));var _=require('lodash');var squel=require(_0x4def('0xb'));var crypto=require('crypto');var jsforce=require(_0x4def('0xc'));var deskjs=require(_0x4def('0xd'));var toCsv=require(_0x4def('0x8'));var querystring=require('querystring');var Papa=require(_0x4def('0xe'));var Redis=require(_0x4def('0xf'));var authService=require(_0x4def('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4def('0x11'));var hardwareService=require(_0x4def('0x12'));var logger=require('../../config/logger')(_0x4def('0x13'));var utils=require(_0x4def('0x14'));var config=require(_0x4def('0x15'));var licenseUtil=require(_0x4def('0x16'));var db=require(_0x4def('0x17'))['db'];function respondWithStatusCode(_0x4e2278,_0x510447){_0x510447=_0x510447||0xcc;return function(_0x12fcd5){if(_0x12fcd5){return _0x4e2278[_0x4def('0x18')](_0x510447);}return _0x4e2278[_0x4def('0x19')](_0x510447)[_0x4def('0x1a')]();};}function respondWithResult(_0xce3f2f,_0x79992){_0x79992=_0x79992||0xc8;return function(_0x122494){if(_0x122494){return _0xce3f2f[_0x4def('0x19')](_0x79992)[_0x4def('0x1b')](_0x122494);}};}function respondWithFilteredResult(_0x19d5b9,_0x4f7b38){return function(_0x5d5675){if(_0x5d5675){var _0xebc271=typeof _0x4f7b38[_0x4def('0x1c')]===_0x4def('0x1d')&&typeof _0x4f7b38[_0x4def('0x1e')]===_0x4def('0x1d');var _0x56dd3c=_0x5d5675['count'];var _0x5443e1=_0xebc271?0x0:_0x4f7b38['offset'];var _0x1bdc60=_0xebc271?_0x5d5675['count']:_0x4f7b38[_0x4def('0x1c')]+_0x4f7b38[_0x4def('0x1e')];var _0x39be05;if(_0x1bdc60>=_0x56dd3c){_0x1bdc60=_0x56dd3c;_0x39be05=0xc8;}else{_0x39be05=0xce;}_0x19d5b9[_0x4def('0x19')](_0x39be05);return _0x19d5b9[_0x4def('0x1f')]('Content-Range',_0x5443e1+'-'+_0x1bdc60+'/'+_0x56dd3c)[_0x4def('0x1b')](_0x5d5675);}return null;};}function patchUpdates(_0x91c4a4){return function(_0x5b3da3){try{jsonpatch['apply'](_0x5b3da3,_0x91c4a4,!![]);}catch(_0x3ab6a1){return BPromise[_0x4def('0x20')](_0x3ab6a1);}return _0x5b3da3[_0x4def('0x21')]();};}function saveUpdates(_0x3d0318,_0x4caa50){return function(_0x130d00){if(_0x130d00){return _0x130d00[_0x4def('0x22')](_0x3d0318)[_0x4def('0x23')](function(_0x56be26){return _0x56be26;});}return null;};}function removeEntity(_0x139043,_0x1b13b6){return function(_0x4ec611){if(_0x4ec611){return _0x4ec611[_0x4def('0x24')]()[_0x4def('0x23')](function(){_0x139043[_0x4def('0x19')](0xcc)[_0x4def('0x1a')]();});}};}function handleEntityNotFound(_0xbb72fc,_0xa3c9e){return function(_0x598662){if(!_0x598662){_0xbb72fc[_0x4def('0x18')](0x194);}return _0x598662;};}function handleError(_0x375b31,_0xa384d3){_0xa384d3=_0xa384d3||0x1f4;return function(_0x756f6f){logger[_0x4def('0x25')](_0x756f6f[_0x4def('0x26')]);if(_0x756f6f['name']){delete _0x756f6f['name'];}_0x375b31[_0x4def('0x19')](_0xa384d3)[_0x4def('0x27')](_0x756f6f);};}exports['index']=function(_0x52b928,_0xfab32){var _0x36081b={},_0x5a9629={},_0xf601a2={'count':0x0,'rows':[]};var _0x3ed2af=_[_0x4def('0x28')](db[_0x4def('0x29')][_0x4def('0x2a')],function(_0x7e8191){return{'name':_0x7e8191[_0x4def('0x2b')],'type':_0x7e8191['type'][_0x4def('0x2c')]};});_0x5a9629[_0x4def('0x2d')]=_[_0x4def('0x28')](_0x3ed2af,'name');_0x5a9629['query']=_[_0x4def('0x2e')](_0x52b928[_0x4def('0x2f')]);_0x5a9629[_0x4def('0x30')]=_['intersection'](_0x5a9629['model'],_0x5a9629['query']);_0x36081b['attributes']=_[_0x4def('0x31')](_0x5a9629['model'],qs[_0x4def('0x32')](_0x52b928[_0x4def('0x2f')]['fields']));_0x36081b[_0x4def('0x33')]=_0x36081b[_0x4def('0x33')][_0x4def('0x34')]?_0x36081b['attributes']:_0x5a9629[_0x4def('0x2d')];if(!_0x52b928[_0x4def('0x2f')][_0x4def('0x35')](_0x4def('0x36'))){_0x36081b[_0x4def('0x1e')]=qs[_0x4def('0x1e')](_0x52b928['query'][_0x4def('0x1e')]);_0x36081b[_0x4def('0x1c')]=qs[_0x4def('0x1c')](_0x52b928[_0x4def('0x2f')][_0x4def('0x1c')]);}_0x36081b[_0x4def('0x37')]=qs[_0x4def('0x38')](_0x52b928[_0x4def('0x2f')]['sort']);_0x36081b[_0x4def('0x39')]=qs[_0x4def('0x30')](_[_0x4def('0x3a')](_0x52b928[_0x4def('0x2f')],_0x5a9629[_0x4def('0x30')]),_0x3ed2af);if(_0x52b928[_0x4def('0x2f')][_0x4def('0x3b')]){_0x36081b[_0x4def('0x39')]=_[_0x4def('0x3c')](_0x36081b[_0x4def('0x39')],{'$or':_[_0x4def('0x28')](_0x3ed2af,function(_0x4f9f0e){if(_0x4f9f0e[_0x4def('0x3d')]!==_0x4def('0x3e')){var _0x459f06={};_0x459f06[_0x4f9f0e[_0x4def('0x3f')]]={'$like':'%'+_0x52b928[_0x4def('0x2f')][_0x4def('0x3b')]+'%'};return _0x459f06;}})});}_0x36081b=_[_0x4def('0x3c')]({},_0x36081b,_0x52b928[_0x4def('0x40')]);var _0x1e9601={'where':_0x36081b[_0x4def('0x39')]};return db['ZohoConfiguration'][_0x4def('0x41')](_0x1e9601)[_0x4def('0x23')](function(_0x11dc36){_0xf601a2[_0x4def('0x41')]=_0x11dc36;if(_0x52b928[_0x4def('0x2f')][_0x4def('0x42')]){_0x36081b[_0x4def('0x43')]=[{'all':!![]}];}return db[_0x4def('0x29')][_0x4def('0x44')](_0x36081b);})[_0x4def('0x23')](function(_0x383018){_0xf601a2[_0x4def('0x45')]=_0x383018;return _0xf601a2;})['then'](respondWithFilteredResult(_0xfab32,_0x36081b))['catch'](handleError(_0xfab32,null));};exports[_0x4def('0x46')]=function(_0x44a703,_0x2c393f){var _0x191325={'raw':![],'where':{'id':_0x44a703[_0x4def('0x47')]['id']}},_0x1a98ce={};_0x1a98ce[_0x4def('0x2d')]=_['keys'](db[_0x4def('0x29')][_0x4def('0x2a')]);_0x1a98ce[_0x4def('0x2f')]=_['keys'](_0x44a703['query']);_0x1a98ce['filters']=_[_0x4def('0x31')](_0x1a98ce[_0x4def('0x2d')],_0x1a98ce[_0x4def('0x2f')]);_0x191325[_0x4def('0x33')]=_[_0x4def('0x31')](_0x1a98ce[_0x4def('0x2d')],qs[_0x4def('0x32')](_0x44a703['query'][_0x4def('0x32')]));_0x191325[_0x4def('0x33')]=_0x191325['attributes'][_0x4def('0x34')]?_0x191325[_0x4def('0x33')]:_0x1a98ce[_0x4def('0x2d')];if(_0x44a703[_0x4def('0x2f')]['includeAll']){_0x191325[_0x4def('0x43')]=[{'all':!![]}];}_0x191325=_[_0x4def('0x3c')]({},_0x191325,_0x44a703[_0x4def('0x40')]);return db['ZohoConfiguration'][_0x4def('0x48')](_0x191325)[_0x4def('0x23')](handleEntityNotFound(_0x2c393f,null))['then'](respondWithResult(_0x2c393f,null))[_0x4def('0x49')](handleError(_0x2c393f,null));};exports['create']=function(_0x10c721,_0x32429a){return db[_0x4def('0x29')]['create'](_0x10c721[_0x4def('0x4a')],{})[_0x4def('0x23')](respondWithResult(_0x32429a,0xc9))[_0x4def('0x49')](handleError(_0x32429a,null));};exports[_0x4def('0x22')]=function(_0x39862f,_0x2f0ed1){if(_0x39862f[_0x4def('0x4a')]['id']){delete _0x39862f[_0x4def('0x4a')]['id'];}return db[_0x4def('0x29')][_0x4def('0x48')]({'where':{'id':_0x39862f[_0x4def('0x47')]['id']}})[_0x4def('0x23')](handleEntityNotFound(_0x2f0ed1,null))['then'](saveUpdates(_0x39862f[_0x4def('0x4a')],null))[_0x4def('0x23')](respondWithResult(_0x2f0ed1,null))[_0x4def('0x49')](handleError(_0x2f0ed1,null));};exports[_0x4def('0x24')]=function(_0x5a4ebc,_0x3af32d){return db[_0x4def('0x29')][_0x4def('0x48')]({'where':{'id':_0x5a4ebc[_0x4def('0x47')]['id']}})[_0x4def('0x23')](handleEntityNotFound(_0x3af32d,null))[_0x4def('0x23')](removeEntity(_0x3af32d,null))['catch'](handleError(_0x3af32d,null));};exports['getFields']=function(_0x576b6b,_0x58d3cb,_0x49c33a){var _0x5bf48f={};var _0x223dce={};var _0x4af02a;var _0x19b68c;return db[_0x4def('0x29')][_0x4def('0x4b')]({'where':{'id':_0x576b6b[_0x4def('0x47')]['id']}})[_0x4def('0x23')](handleEntityNotFound(_0x58d3cb,null))[_0x4def('0x23')](function(_0x14230c){if(_0x14230c){_0x4af02a=_0x14230c;_0x223dce[_0x4def('0x2d')]=_[_0x4def('0x2e')](db[_0x4def('0x4c')]['rawAttributes']);_0x223dce[_0x4def('0x2f')]=_[_0x4def('0x2e')](_0x576b6b['query']);_0x223dce[_0x4def('0x30')]=_[_0x4def('0x31')](_0x223dce[_0x4def('0x2d')],_0x223dce[_0x4def('0x2f')]);_0x5bf48f[_0x4def('0x33')]=_[_0x4def('0x31')](_0x223dce['model'],qs['fields'](_0x576b6b[_0x4def('0x2f')][_0x4def('0x32')]));_0x5bf48f[_0x4def('0x33')]=_0x5bf48f[_0x4def('0x33')]['length']?_0x5bf48f[_0x4def('0x33')]:_0x223dce['model'];_0x5bf48f['order']=qs['sort'](_0x576b6b[_0x4def('0x2f')]['sort']);_0x5bf48f['where']=qs[_0x4def('0x30')](_['pick'](_0x576b6b['query'],_0x223dce[_0x4def('0x30')]));if(_0x576b6b[_0x4def('0x2f')][_0x4def('0x3b')]){_0x5bf48f[_0x4def('0x39')]=_[_0x4def('0x3c')](_0x5bf48f['where'],{'$or':_[_0x4def('0x28')](_0x5bf48f['attributes'],function(_0x288ced){var _0x22dcd4={};_0x22dcd4[_0x288ced]={'$like':'%'+_0x576b6b['query'][_0x4def('0x3b')]+'%'};return _0x22dcd4;})});}_0x5bf48f=_[_0x4def('0x3c')]({},_0x5bf48f,_0x576b6b[_0x4def('0x40')]);return _0x4af02a[_0x4def('0x4d')](_0x5bf48f);}})[_0x4def('0x23')](function(_0x286a80){if(_0x286a80){_0x19b68c=_0x286a80[_0x4def('0x34')];if(!_0x576b6b[_0x4def('0x2f')][_0x4def('0x35')]('nolimit')){_0x5bf48f['limit']=qs[_0x4def('0x1e')](_0x576b6b['query'][_0x4def('0x1e')]);_0x5bf48f[_0x4def('0x1c')]=qs[_0x4def('0x1c')](_0x576b6b[_0x4def('0x2f')][_0x4def('0x1c')]);}return _0x4af02a[_0x4def('0x4d')](_0x5bf48f);}})[_0x4def('0x23')](function(_0x7bd4cd){if(_0x7bd4cd){return _0x7bd4cd?{'count':_0x19b68c,'rows':_0x7bd4cd}:null;}})['then'](respondWithResult(_0x58d3cb,null))[_0x4def('0x49')](handleError(_0x58d3cb,null));};exports[_0x4def('0x4e')]=function(_0x23f4f1,_0x34f14b,_0x577f3e){var _0x2f5fca={};var _0x1b1613={};var _0x41ed96;var _0x1969c8;return db[_0x4def('0x29')][_0x4def('0x4b')]({'where':{'id':_0x23f4f1[_0x4def('0x47')]['id']}})[_0x4def('0x23')](handleEntityNotFound(_0x34f14b,null))[_0x4def('0x23')](function(_0x349949){if(_0x349949){_0x41ed96=_0x349949;_0x1b1613['model']=_[_0x4def('0x2e')](db[_0x4def('0x4c')][_0x4def('0x2a')]);_0x1b1613[_0x4def('0x2f')]=_[_0x4def('0x2e')](_0x23f4f1[_0x4def('0x2f')]);_0x1b1613[_0x4def('0x30')]=_[_0x4def('0x31')](_0x1b1613[_0x4def('0x2d')],_0x1b1613[_0x4def('0x2f')]);_0x2f5fca[_0x4def('0x33')]=_['intersection'](_0x1b1613['model'],qs['fields'](_0x23f4f1[_0x4def('0x2f')][_0x4def('0x32')]));_0x2f5fca[_0x4def('0x33')]=_0x2f5fca[_0x4def('0x33')][_0x4def('0x34')]?_0x2f5fca[_0x4def('0x33')]:_0x1b1613[_0x4def('0x2d')];_0x2f5fca['order']=qs[_0x4def('0x38')](_0x23f4f1[_0x4def('0x2f')][_0x4def('0x38')]);_0x2f5fca[_0x4def('0x39')]=qs[_0x4def('0x30')](_['pick'](_0x23f4f1['query'],_0x1b1613[_0x4def('0x30')]));if(_0x23f4f1[_0x4def('0x2f')]['filter']){_0x2f5fca[_0x4def('0x39')]=_['merge'](_0x2f5fca[_0x4def('0x39')],{'$or':_[_0x4def('0x28')](_0x2f5fca[_0x4def('0x33')],function(_0x2d6626){var _0xf4cf2={};_0xf4cf2[_0x2d6626]={'$like':'%'+_0x23f4f1[_0x4def('0x2f')]['filter']+'%'};return _0xf4cf2;})});}_0x2f5fca=_['merge']({},_0x2f5fca,_0x23f4f1['options']);return _0x41ed96[_0x4def('0x4e')](_0x2f5fca);}})['then'](function(_0xc3836d){if(_0xc3836d){_0x1969c8=_0xc3836d[_0x4def('0x34')];if(!_0x23f4f1[_0x4def('0x2f')]['hasOwnProperty'](_0x4def('0x36'))){_0x2f5fca[_0x4def('0x1e')]=qs['limit'](_0x23f4f1[_0x4def('0x2f')][_0x4def('0x1e')]);_0x2f5fca[_0x4def('0x1c')]=qs[_0x4def('0x1c')](_0x23f4f1['query'][_0x4def('0x1c')]);}return _0x41ed96['getSubjects'](_0x2f5fca);}})['then'](function(_0x7603a4){if(_0x7603a4){return _0x7603a4?{'count':_0x1969c8,'rows':_0x7603a4}:null;}})['then'](respondWithResult(_0x34f14b,null))[_0x4def('0x49')](handleError(_0x34f14b,null));};exports[_0x4def('0x4f')]=function(_0x530da8,_0x125807,_0x2e82ac){var _0x32b48d={};var _0xa8197f={};var _0x1cb68e;var _0x248fa2;return db[_0x4def('0x29')]['findOne']({'where':{'id':_0x530da8[_0x4def('0x47')]['id']}})['then'](handleEntityNotFound(_0x125807,null))[_0x4def('0x23')](function(_0x2852fc){if(_0x2852fc){_0x1cb68e=_0x2852fc;_0xa8197f[_0x4def('0x2d')]=_[_0x4def('0x2e')](db[_0x4def('0x4c')][_0x4def('0x2a')]);_0xa8197f['query']=_[_0x4def('0x2e')](_0x530da8[_0x4def('0x2f')]);_0xa8197f[_0x4def('0x30')]=_[_0x4def('0x31')](_0xa8197f[_0x4def('0x2d')],_0xa8197f[_0x4def('0x2f')]);_0x32b48d[_0x4def('0x33')]=_[_0x4def('0x31')](_0xa8197f['model'],qs['fields'](_0x530da8[_0x4def('0x2f')][_0x4def('0x32')]));_0x32b48d[_0x4def('0x33')]=_0x32b48d[_0x4def('0x33')][_0x4def('0x34')]?_0x32b48d[_0x4def('0x33')]:_0xa8197f[_0x4def('0x2d')];_0x32b48d[_0x4def('0x37')]=qs['sort'](_0x530da8[_0x4def('0x2f')][_0x4def('0x38')]);_0x32b48d[_0x4def('0x39')]=qs[_0x4def('0x30')](_[_0x4def('0x3a')](_0x530da8[_0x4def('0x2f')],_0xa8197f[_0x4def('0x30')]));if(_0x530da8[_0x4def('0x2f')][_0x4def('0x3b')]){_0x32b48d[_0x4def('0x39')]=_[_0x4def('0x3c')](_0x32b48d[_0x4def('0x39')],{'$or':_[_0x4def('0x28')](_0x32b48d[_0x4def('0x33')],function(_0x4f4ce2){var _0x33803a={};_0x33803a[_0x4f4ce2]={'$like':'%'+_0x530da8[_0x4def('0x2f')][_0x4def('0x3b')]+'%'};return _0x33803a;})});}_0x32b48d=_[_0x4def('0x3c')]({},_0x32b48d,_0x530da8[_0x4def('0x40')]);return _0x1cb68e[_0x4def('0x4f')](_0x32b48d);}})[_0x4def('0x23')](function(_0x1c9741){if(_0x1c9741){_0x248fa2=_0x1c9741['length'];if(!_0x530da8['query'][_0x4def('0x35')](_0x4def('0x36'))){_0x32b48d[_0x4def('0x1e')]=qs[_0x4def('0x1e')](_0x530da8[_0x4def('0x2f')][_0x4def('0x1e')]);_0x32b48d['offset']=qs[_0x4def('0x1c')](_0x530da8['query'][_0x4def('0x1c')]);}return _0x1cb68e[_0x4def('0x4f')](_0x32b48d);}})[_0x4def('0x23')](function(_0x3aa316){if(_0x3aa316){return _0x3aa316?{'count':_0x248fa2,'rows':_0x3aa316}:null;}})['then'](respondWithResult(_0x125807,null))[_0x4def('0x49')](handleError(_0x125807,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2f67775..837edbc 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 _0x65a8=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x65a8,0x177));var _0x865a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x65a8[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x865a('0x0'));var util=require(_0x865a('0x1'));var logger=require(_0x865a('0x2'))(_0x865a('0x3'));var moment=require(_0x865a('0x4'));var BPromise=require(_0x865a('0x5'));var rp=require(_0x865a('0x6'));var fs=require('fs');var path=require(_0x865a('0x7'));var rimraf=require('rimraf');var config=require(_0x865a('0x8'));var attributes=require(_0x865a('0x9'));module[_0x865a('0xa')]=function(_0x1287b3,_0x2acd8b){return _0x1287b3['define'](_0x865a('0xb'),attributes,{'tableName':_0x865a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ec9=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','int_zoho_configurations'];(function(_0x4c1c95,_0x35b973){var _0x102620=function(_0x5eecea){while(--_0x5eecea){_0x4c1c95['push'](_0x4c1c95['shift']());}};_0x102620(++_0x35b973);}(_0x5ec9,0x1a4));var _0x95ec=function(_0x548d4c,_0x28c311){_0x548d4c=_0x548d4c-0x0;var _0x37e253=_0x5ec9[_0x548d4c];return _0x37e253;};'use strict';var _=require(_0x95ec('0x0'));var util=require(_0x95ec('0x1'));var logger=require(_0x95ec('0x2'))(_0x95ec('0x3'));var moment=require(_0x95ec('0x4'));var BPromise=require(_0x95ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95ec('0x6'));var rimraf=require(_0x95ec('0x7'));var config=require(_0x95ec('0x8'));var attributes=require(_0x95ec('0x9'));module['exports']=function(_0xd1347c,_0x26e997){return _0xd1347c[_0x95ec('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x95ec('0xb'),'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 aec8a43..f08b467 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 _0x3b52=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x2fd237,_0x27af27){var _0xf79359=function(_0xffb567){while(--_0xffb567){_0x2fd237['push'](_0x2fd237['shift']());}};_0xf79359(++_0x27af27);}(_0x3b52,0x173));var _0x23b5=function(_0x3ba38f,_0x1c29b2){_0x3ba38f=_0x3ba38f-0x0;var _0x174ebe=_0x3b52[_0x3ba38f];return _0x174ebe;};'use strict';var _=require(_0x23b5('0x0'));var util=require(_0x23b5('0x1'));var moment=require(_0x23b5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23b5('0x3'))['db'];var utils=require(_0x23b5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x23b5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x23b5('0x6')][_0x23b5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7e497c,_0x3d51c3,_0x1489dd){return new BPromise(function(_0x56235c,_0x503bf9){return client[_0x23b5('0x8')](_0x7e497c,_0x1489dd)[_0x23b5('0x9')](function(_0x14b068){logger[_0x23b5('0xa')](_0x23b5('0xb'),_0x3d51c3,_0x23b5('0xc'));logger[_0x23b5('0xd')](_0x23b5('0xe'),_0x3d51c3,'request\x20sent',JSON[_0x23b5('0xf')](_0x14b068));if(_0x14b068[_0x23b5('0x10')]){if(_0x14b068[_0x23b5('0x10')][_0x23b5('0x11')]===0x1f4){logger[_0x23b5('0x10')](_0x23b5('0xb'),_0x3d51c3,_0x14b068[_0x23b5('0x10')][_0x23b5('0x12')]);return _0x503bf9(_0x14b068[_0x23b5('0x10')]['message']);}logger[_0x23b5('0x10')](_0x23b5('0xb'),_0x3d51c3,_0x14b068['error'][_0x23b5('0x12')]);return _0x56235c(_0x14b068[_0x23b5('0x10')][_0x23b5('0x12')]);}else{logger[_0x23b5('0xa')](_0x23b5('0xb'),_0x3d51c3,_0x23b5('0xc'));_0x56235c(_0x14b068[_0x23b5('0x13')][_0x23b5('0x12')]);}})[_0x23b5('0x14')](function(_0x5a041b){logger['error'](_0x23b5('0xb'),_0x3d51c3,_0x5a041b);_0x503bf9(_0x5a041b);});});} \ No newline at end of file +var _0xe0de=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x859795,_0x52094e){var _0x3a2c46=function(_0x5e58b9){while(--_0x5e58b9){_0x859795['push'](_0x859795['shift']());}};_0x3a2c46(++_0x52094e);}(_0xe0de,0x10d));var _0xee0d=function(_0x2e4925,_0x2a859a){_0x2e4925=_0x2e4925-0x0;var _0x5d639e=_0xe0de[_0x2e4925];return _0x5d639e;};'use strict';var _=require(_0xee0d('0x0'));var util=require(_0xee0d('0x1'));var moment=require(_0xee0d('0x2'));var BPromise=require(_0xee0d('0x3'));var rs=require(_0xee0d('0x4'));var fs=require('fs');var Redis=require(_0xee0d('0x5'));var db=require(_0xee0d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee0d('0x7'));var config=require(_0xee0d('0x8'));var jayson=require(_0xee0d('0x9'));var client=jayson['client'][_0xee0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1181b0,_0x3ecd53,_0x4856a1){return new BPromise(function(_0x2245ed,_0xc4c449){return client['request'](_0x1181b0,_0x4856a1)[_0xee0d('0xb')](function(_0x52a9ac){logger[_0xee0d('0xc')](_0xee0d('0xd'),_0x3ecd53,_0xee0d('0xe'));logger['debug'](_0xee0d('0xf'),_0x3ecd53,_0xee0d('0xe'),JSON['stringify'](_0x52a9ac));if(_0x52a9ac['error']){if(_0x52a9ac['error'][_0xee0d('0x10')]===0x1f4){logger[_0xee0d('0x11')](_0xee0d('0xd'),_0x3ecd53,_0x52a9ac[_0xee0d('0x11')][_0xee0d('0x12')]);return _0xc4c449(_0x52a9ac[_0xee0d('0x11')][_0xee0d('0x12')]);}logger[_0xee0d('0x11')](_0xee0d('0xd'),_0x3ecd53,_0x52a9ac[_0xee0d('0x11')]['message']);return _0x2245ed(_0x52a9ac['error'][_0xee0d('0x12')]);}else{logger[_0xee0d('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3ecd53,'request\x20sent');_0x2245ed(_0x52a9ac[_0xee0d('0x13')][_0xee0d('0x12')]);}})[_0xee0d('0x14')](function(_0xd07043){logger[_0xee0d('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x3ecd53,_0xd07043);_0xc4c449(_0xd07043);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index ef56dcd..b41d7ff 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 _0xe650=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','/:id','post','create','put'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xe650,0x144));var _0x0e65=function(_0x25cdb9,_0x4d338f){_0x25cdb9=_0x25cdb9-0x0;var _0x2ce804=_0xe650[_0x25cdb9];return _0x2ce804;};'use strict';var multer=require(_0x0e65('0x0'));var util=require(_0x0e65('0x1'));var path=require(_0x0e65('0x2'));var timeout=require(_0x0e65('0x3'));var express=require(_0x0e65('0x4'));var router=express['Router']();var fs_extra=require(_0x0e65('0x5'));var auth=require(_0x0e65('0x6'));var interaction=require(_0x0e65('0x7'));var config=require(_0x0e65('0x8'));var controller=require(_0x0e65('0x9'));router['get']('/',auth[_0x0e65('0xa')](),controller[_0x0e65('0xb')]);router['get'](_0x0e65('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0e65('0xd')]('/',auth[_0x0e65('0xa')](),controller[_0x0e65('0xe')]);router[_0x0e65('0xf')](_0x0e65('0xc'),auth[_0x0e65('0xa')](),controller[_0x0e65('0x10')]);router[_0x0e65('0x11')]('/:id',auth[_0x0e65('0xa')](),controller[_0x0e65('0x12')]);module[_0x0e65('0x13')]=router; \ No newline at end of file +var _0x977d=['post','create','put','/:id','update','delete','exports','util','path','connect-timeout','fs-extra','../../config/environment','isAuthenticated','index','get','show'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x977d,0xb7));var _0xd977=function(_0x2cb2c7,_0x495c25){_0x2cb2c7=_0x2cb2c7-0x0;var _0x4d4166=_0x977d[_0x2cb2c7];return _0x4d4166;};'use strict';var multer=require('multer');var util=require(_0xd977('0x0'));var path=require(_0xd977('0x1'));var timeout=require(_0xd977('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd977('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd977('0x4'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0xd977('0x5')](),controller[_0xd977('0x6')]);router[_0xd977('0x7')]('/:id',auth[_0xd977('0x5')](),controller[_0xd977('0x8')]);router[_0xd977('0x9')]('/',auth['isAuthenticated'](),controller[_0xd977('0xa')]);router[_0xd977('0xb')](_0xd977('0xc'),auth['isAuthenticated'](),controller[_0xd977('0xd')]);router[_0xd977('0xe')](_0xd977('0xc'),auth[_0xd977('0x5')](),controller['destroy']);module[_0xd977('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 4d914a2..07ab89b 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 _0xdb78=['STRING','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x26db66,_0x2786c1){var _0x37af44=function(_0x330761){while(--_0x330761){_0x26db66['push'](_0x26db66['shift']());}};_0x37af44(++_0x2786c1);}(_0xdb78,0x142));var _0x8db7=function(_0x3a2be3,_0x226a5e){_0x3a2be3=_0x3a2be3-0x0;var _0x4d7e85=_0xdb78[_0x3a2be3];return _0x4d7e85;};'use strict';var Sequelize=require('sequelize');module[_0x8db7('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8db7('0x1'),_0x8db7('0x2'),_0x8db7('0x3'),_0x8db7('0x4'),_0x8db7('0x5')),'defaultValue':_0x8db7('0x1')},'content':{'type':Sequelize[_0x8db7('0x6')]},'key':{'type':Sequelize[_0x8db7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8db7('0x1'),_0x8db7('0x2'),_0x8db7('0x3'))},'keyContent':{'type':Sequelize[_0x8db7('0x6')]},'idField':{'type':Sequelize[_0x8db7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8db7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8db7('0x6')]}}; \ No newline at end of file +var _0xe9c2=['keyValue','picklist','ENUM','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe9c2,0x109));var _0x2e9c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe9c2[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x2e9c('0x0'));module[_0x2e9c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2e9c('0x2'),_0x2e9c('0x3'),_0x2e9c('0x4'),_0x2e9c('0x5'),_0x2e9c('0x6')),'defaultValue':_0x2e9c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2e9c('0x7')](_0x2e9c('0x2'),_0x2e9c('0x3'),_0x2e9c('0x4'))},'keyContent':{'type':Sequelize[_0x2e9c('0x8')]},'idField':{'type':Sequelize[_0x2e9c('0x8')]},'nameField':{'type':Sequelize[_0x2e9c('0x8')]},'customField':{'type':Sequelize[_0x2e9c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2e9c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ed1794e..3582159 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 _0x92c1=['../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','merge','where','filter','options','ZohoField','includeAll','findAll','rows','include','catch','create','body','params','find','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x53fdea,_0x5d3514){var _0x53dec4=function(_0x5dc237){while(--_0x5dc237){_0x53fdea['push'](_0x53fdea['shift']());}};_0x53dec4(++_0x5d3514);}(_0x92c1,0xc1));var _0x192c=function(_0x441a8b,_0x4c6cc9){_0x441a8b=_0x441a8b-0x0;var _0x367ac5=_0x92c1[_0x441a8b];return _0x367ac5;};'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(_0x192c('0x0'));var moment=require('moment');var BPromise=require(_0x192c('0x1'));var Mustache=require(_0x192c('0x2'));var util=require('util');var path=require(_0x192c('0x3'));var sox=require(_0x192c('0x4'));var csv=require(_0x192c('0x5'));var ejs=require(_0x192c('0x6'));var fs=require('fs');var fs_extra=require(_0x192c('0x7'));var _=require(_0x192c('0x8'));var squel=require(_0x192c('0x9'));var crypto=require(_0x192c('0xa'));var jsforce=require(_0x192c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x192c('0x5'));var querystring=require(_0x192c('0xc'));var Papa=require(_0x192c('0xd'));var Redis=require(_0x192c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x192c('0xf'));var hardwareService=require(_0x192c('0x10'));var logger=require(_0x192c('0x11'))(_0x192c('0x12'));var utils=require('../../config/utils');var config=require(_0x192c('0x13'));var licenseUtil=require(_0x192c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ac967,_0x2c42a5){_0x2c42a5=_0x2c42a5||0xcc;return function(_0x1953cf){if(_0x1953cf){return _0x3ac967[_0x192c('0x15')](_0x2c42a5);}return _0x3ac967[_0x192c('0x16')](_0x2c42a5)[_0x192c('0x17')]();};}function respondWithResult(_0x1d5f47,_0x2a025a){_0x2a025a=_0x2a025a||0xc8;return function(_0x2c550a){if(_0x2c550a){return _0x1d5f47[_0x192c('0x16')](_0x2a025a)['json'](_0x2c550a);}};}function respondWithFilteredResult(_0x1b8614,_0x317f00){return function(_0x21c3a0){if(_0x21c3a0){var _0x43a565=typeof _0x317f00[_0x192c('0x18')]===_0x192c('0x19')&&typeof _0x317f00['limit']===_0x192c('0x19');var _0x3c0524=_0x21c3a0[_0x192c('0x1a')];var _0x2d9cf6=_0x43a565?0x0:_0x317f00[_0x192c('0x18')];var _0x577c37=_0x43a565?_0x21c3a0['count']:_0x317f00[_0x192c('0x18')]+_0x317f00['limit'];var _0x399f33;if(_0x577c37>=_0x3c0524){_0x577c37=_0x3c0524;_0x399f33=0xc8;}else{_0x399f33=0xce;}_0x1b8614[_0x192c('0x16')](_0x399f33);return _0x1b8614[_0x192c('0x1b')](_0x192c('0x1c'),_0x2d9cf6+'-'+_0x577c37+'/'+_0x3c0524)[_0x192c('0x1d')](_0x21c3a0);}return null;};}function patchUpdates(_0x5ea821){return function(_0x4e9ede){try{jsonpatch['apply'](_0x4e9ede,_0x5ea821,!![]);}catch(_0x30319c){return BPromise[_0x192c('0x1e')](_0x30319c);}return _0x4e9ede['save']();};}function saveUpdates(_0x1f0037,_0x18a51e){return function(_0x516921){if(_0x516921){return _0x516921[_0x192c('0x1f')](_0x1f0037)[_0x192c('0x20')](function(_0x558622){return _0x558622;});}return null;};}function removeEntity(_0x8b449f,_0x573fde){return function(_0x3d58f5){if(_0x3d58f5){return _0x3d58f5[_0x192c('0x21')]()[_0x192c('0x20')](function(){_0x8b449f[_0x192c('0x16')](0xcc)[_0x192c('0x17')]();});}};}function handleEntityNotFound(_0x2080fa,_0x465b33){return function(_0x3de585){if(!_0x3de585){_0x2080fa[_0x192c('0x15')](0x194);}return _0x3de585;};}function handleError(_0x32d5d7,_0x1219cc){_0x1219cc=_0x1219cc||0x1f4;return function(_0x4c9f45){logger[_0x192c('0x22')](_0x4c9f45[_0x192c('0x23')]);if(_0x4c9f45['name']){delete _0x4c9f45[_0x192c('0x24')];}_0x32d5d7[_0x192c('0x16')](_0x1219cc)[_0x192c('0x25')](_0x4c9f45);};}exports[_0x192c('0x26')]=function(_0x5c4e4d,_0x3e89a0){var _0x3ccedc={},_0x54ed30={},_0x524926={'count':0x0,'rows':[]};var _0x143ffb=_[_0x192c('0x27')](db['ZohoField'][_0x192c('0x28')],function(_0x3e9120){return{'name':_0x3e9120['fieldName'],'type':_0x3e9120[_0x192c('0x29')][_0x192c('0x2a')]};});_0x54ed30[_0x192c('0x2b')]=_[_0x192c('0x27')](_0x143ffb,'name');_0x54ed30[_0x192c('0x2c')]=_[_0x192c('0x2d')](_0x5c4e4d[_0x192c('0x2c')]);_0x54ed30[_0x192c('0x2e')]=_[_0x192c('0x2f')](_0x54ed30[_0x192c('0x2b')],_0x54ed30['query']);_0x3ccedc[_0x192c('0x30')]=_[_0x192c('0x2f')](_0x54ed30[_0x192c('0x2b')],qs['fields'](_0x5c4e4d[_0x192c('0x2c')][_0x192c('0x31')]));_0x3ccedc[_0x192c('0x30')]=_0x3ccedc['attributes'][_0x192c('0x32')]?_0x3ccedc[_0x192c('0x30')]:_0x54ed30[_0x192c('0x2b')];if(!_0x5c4e4d['query'][_0x192c('0x33')](_0x192c('0x34'))){_0x3ccedc['limit']=qs['limit'](_0x5c4e4d[_0x192c('0x2c')][_0x192c('0x35')]);_0x3ccedc[_0x192c('0x18')]=qs[_0x192c('0x18')](_0x5c4e4d[_0x192c('0x2c')][_0x192c('0x18')]);}_0x3ccedc['order']=qs['sort'](_0x5c4e4d['query'][_0x192c('0x36')]);_0x3ccedc['where']=qs[_0x192c('0x2e')](_[_0x192c('0x37')](_0x5c4e4d[_0x192c('0x2c')],_0x54ed30[_0x192c('0x2e')]),_0x143ffb);if(_0x5c4e4d[_0x192c('0x2c')]['filter']){_0x3ccedc['where']=_[_0x192c('0x38')](_0x3ccedc[_0x192c('0x39')],{'$or':_[_0x192c('0x27')](_0x143ffb,function(_0x53e593){if(_0x53e593[_0x192c('0x29')]!=='VIRTUAL'){var _0x5803dd={};_0x5803dd[_0x53e593[_0x192c('0x24')]]={'$like':'%'+_0x5c4e4d['query'][_0x192c('0x3a')]+'%'};return _0x5803dd;}})});}_0x3ccedc=_[_0x192c('0x38')]({},_0x3ccedc,_0x5c4e4d[_0x192c('0x3b')]);var _0x65009a={'where':_0x3ccedc[_0x192c('0x39')]};return db[_0x192c('0x3c')][_0x192c('0x1a')](_0x65009a)['then'](function(_0x5a0601){_0x524926[_0x192c('0x1a')]=_0x5a0601;if(_0x5c4e4d[_0x192c('0x2c')][_0x192c('0x3d')]){_0x3ccedc['include']=[{'all':!![]}];}return db['ZohoField'][_0x192c('0x3e')](_0x3ccedc);})[_0x192c('0x20')](function(_0x494fbd){_0x524926[_0x192c('0x3f')]=_0x494fbd;return _0x524926;})['then'](respondWithFilteredResult(_0x3e89a0,_0x3ccedc))['catch'](handleError(_0x3e89a0,null));};exports['show']=function(_0x52880b,_0x523c08){var _0x329974={'raw':!![],'where':{'id':_0x52880b['params']['id']}},_0x5d53b3={};_0x5d53b3['model']=_[_0x192c('0x2d')](db[_0x192c('0x3c')]['rawAttributes']);_0x5d53b3[_0x192c('0x2c')]=_[_0x192c('0x2d')](_0x52880b[_0x192c('0x2c')]);_0x5d53b3['filters']=_[_0x192c('0x2f')](_0x5d53b3['model'],_0x5d53b3[_0x192c('0x2c')]);_0x329974[_0x192c('0x30')]=_[_0x192c('0x2f')](_0x5d53b3[_0x192c('0x2b')],qs[_0x192c('0x31')](_0x52880b[_0x192c('0x2c')]['fields']));_0x329974[_0x192c('0x30')]=_0x329974[_0x192c('0x30')][_0x192c('0x32')]?_0x329974[_0x192c('0x30')]:_0x5d53b3['model'];if(_0x52880b[_0x192c('0x2c')][_0x192c('0x3d')]){_0x329974[_0x192c('0x40')]=[{'all':!![]}];}_0x329974=_[_0x192c('0x38')]({},_0x329974,_0x52880b[_0x192c('0x3b')]);return db[_0x192c('0x3c')]['find'](_0x329974)['then'](handleEntityNotFound(_0x523c08,null))[_0x192c('0x20')](respondWithResult(_0x523c08,null))[_0x192c('0x41')](handleError(_0x523c08,null));};exports[_0x192c('0x42')]=function(_0x1135cb,_0x53ee47){return db[_0x192c('0x3c')][_0x192c('0x42')](_0x1135cb[_0x192c('0x43')],{})[_0x192c('0x20')](respondWithResult(_0x53ee47,0xc9))[_0x192c('0x41')](handleError(_0x53ee47,null));};exports[_0x192c('0x1f')]=function(_0x5d2d2f,_0x5938ca){if(_0x5d2d2f['body']['id']){delete _0x5d2d2f[_0x192c('0x43')]['id'];}return db[_0x192c('0x3c')]['find']({'where':{'id':_0x5d2d2f[_0x192c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5938ca,null))[_0x192c('0x20')](saveUpdates(_0x5d2d2f[_0x192c('0x43')],null))[_0x192c('0x20')](respondWithResult(_0x5938ca,null))[_0x192c('0x41')](handleError(_0x5938ca,null));};exports[_0x192c('0x21')]=function(_0x267190,_0x15296f){return db[_0x192c('0x3c')][_0x192c('0x45')]({'where':{'id':_0x267190[_0x192c('0x44')]['id']}})[_0x192c('0x20')](handleEntityNotFound(_0x15296f,null))[_0x192c('0x20')](removeEntity(_0x15296f,null))[_0x192c('0x41')](handleError(_0x15296f,null));}; \ No newline at end of file +var _0x87e1=['keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','length','include','options','create','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','ZohoField','rawAttributes','key','model','query'];(function(_0x33f139,_0x4d6b91){var _0x21cb72=function(_0x502558){while(--_0x502558){_0x33f139['push'](_0x33f139['shift']());}};_0x21cb72(++_0x4d6b91);}(_0x87e1,0xb1));var _0x187e=function(_0x588820,_0x4daf15){_0x588820=_0x588820-0x0;var _0x4d7d77=_0x87e1[_0x588820];return _0x4d7d77;};'use strict';var emlformat=require(_0x187e('0x0'));var rimraf=require(_0x187e('0x1'));var zipdir=require(_0x187e('0x2'));var jsonpatch=require(_0x187e('0x3'));var rp=require('request-promise');var moment=require(_0x187e('0x4'));var BPromise=require(_0x187e('0x5'));var Mustache=require(_0x187e('0x6'));var util=require(_0x187e('0x7'));var path=require(_0x187e('0x8'));var sox=require(_0x187e('0x9'));var csv=require(_0x187e('0xa'));var ejs=require(_0x187e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x187e('0xc'));var squel=require(_0x187e('0xd'));var crypto=require(_0x187e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x187e('0xf'));var Papa=require(_0x187e('0x10'));var Redis=require(_0x187e('0x11'));var authService=require(_0x187e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x187e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x187e('0x14'))(_0x187e('0x15'));var utils=require(_0x187e('0x16'));var config=require(_0x187e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x187e('0x18'))['db'];function respondWithStatusCode(_0x55c9a6,_0x100c0d){_0x100c0d=_0x100c0d||0xcc;return function(_0x2ad42c){if(_0x2ad42c){return _0x55c9a6[_0x187e('0x19')](_0x100c0d);}return _0x55c9a6[_0x187e('0x1a')](_0x100c0d)[_0x187e('0x1b')]();};}function respondWithResult(_0x5eea3d,_0xc663ad){_0xc663ad=_0xc663ad||0xc8;return function(_0x4d79a7){if(_0x4d79a7){return _0x5eea3d[_0x187e('0x1a')](_0xc663ad)[_0x187e('0x1c')](_0x4d79a7);}};}function respondWithFilteredResult(_0x4b6746,_0x23faf7){return function(_0x12f40d){if(_0x12f40d){var _0x3f6400=typeof _0x23faf7['offset']==='undefined'&&typeof _0x23faf7[_0x187e('0x1d')]==='undefined';var _0x8aa0ca=_0x12f40d[_0x187e('0x1e')];var _0x1610e9=_0x3f6400?0x0:_0x23faf7[_0x187e('0x1f')];var _0x1c3fe8=_0x3f6400?_0x12f40d[_0x187e('0x1e')]:_0x23faf7[_0x187e('0x1f')]+_0x23faf7[_0x187e('0x1d')];var _0x3dd0cf;if(_0x1c3fe8>=_0x8aa0ca){_0x1c3fe8=_0x8aa0ca;_0x3dd0cf=0xc8;}else{_0x3dd0cf=0xce;}_0x4b6746[_0x187e('0x1a')](_0x3dd0cf);return _0x4b6746[_0x187e('0x20')](_0x187e('0x21'),_0x1610e9+'-'+_0x1c3fe8+'/'+_0x8aa0ca)[_0x187e('0x1c')](_0x12f40d);}return null;};}function patchUpdates(_0x5bdde3){return function(_0x2ebd0f){try{jsonpatch[_0x187e('0x22')](_0x2ebd0f,_0x5bdde3,!![]);}catch(_0xaae6af){return BPromise[_0x187e('0x23')](_0xaae6af);}return _0x2ebd0f[_0x187e('0x24')]();};}function saveUpdates(_0x39605e,_0xdffa86){return function(_0x5846c3){if(_0x5846c3){return _0x5846c3[_0x187e('0x25')](_0x39605e)[_0x187e('0x26')](function(_0x76873f){return _0x76873f;});}return null;};}function removeEntity(_0x80f394,_0x21997b){return function(_0x196f59){if(_0x196f59){return _0x196f59['destroy']()[_0x187e('0x26')](function(){_0x80f394['status'](0xcc)[_0x187e('0x1b')]();});}};}function handleEntityNotFound(_0x152c11,_0x248871){return function(_0x29d468){if(!_0x29d468){_0x152c11[_0x187e('0x19')](0x194);}return _0x29d468;};}function handleError(_0xdcd39d,_0x247eb3){_0x247eb3=_0x247eb3||0x1f4;return function(_0x419e62){logger[_0x187e('0x27')](_0x419e62[_0x187e('0x28')]);if(_0x419e62[_0x187e('0x29')]){delete _0x419e62['name'];}_0xdcd39d[_0x187e('0x1a')](_0x247eb3)['send'](_0x419e62);};}exports['index']=function(_0x113673,_0x217d3a){var _0x51d33c={},_0x3d8498={},_0x57d80c={'count':0x0,'rows':[]};var _0x5eb547=_[_0x187e('0x2a')](db[_0x187e('0x2b')][_0x187e('0x2c')],function(_0x4fd17a){return{'name':_0x4fd17a['fieldName'],'type':_0x4fd17a['type'][_0x187e('0x2d')]};});_0x3d8498[_0x187e('0x2e')]=_['map'](_0x5eb547,_0x187e('0x29'));_0x3d8498[_0x187e('0x2f')]=_[_0x187e('0x30')](_0x113673[_0x187e('0x2f')]);_0x3d8498[_0x187e('0x31')]=_['intersection'](_0x3d8498[_0x187e('0x2e')],_0x3d8498['query']);_0x51d33c[_0x187e('0x32')]=_[_0x187e('0x33')](_0x3d8498[_0x187e('0x2e')],qs[_0x187e('0x34')](_0x113673[_0x187e('0x2f')][_0x187e('0x34')]));_0x51d33c[_0x187e('0x32')]=_0x51d33c['attributes']['length']?_0x51d33c[_0x187e('0x32')]:_0x3d8498[_0x187e('0x2e')];if(!_0x113673[_0x187e('0x2f')][_0x187e('0x35')]('nolimit')){_0x51d33c[_0x187e('0x1d')]=qs[_0x187e('0x1d')](_0x113673[_0x187e('0x2f')]['limit']);_0x51d33c[_0x187e('0x1f')]=qs[_0x187e('0x1f')](_0x113673['query'][_0x187e('0x1f')]);}_0x51d33c[_0x187e('0x36')]=qs[_0x187e('0x37')](_0x113673[_0x187e('0x2f')]['sort']);_0x51d33c[_0x187e('0x38')]=qs[_0x187e('0x31')](_[_0x187e('0x39')](_0x113673['query'],_0x3d8498[_0x187e('0x31')]),_0x5eb547);if(_0x113673[_0x187e('0x2f')][_0x187e('0x3a')]){_0x51d33c[_0x187e('0x38')]=_[_0x187e('0x3b')](_0x51d33c[_0x187e('0x38')],{'$or':_[_0x187e('0x2a')](_0x5eb547,function(_0x295c48){if(_0x295c48[_0x187e('0x3c')]!==_0x187e('0x3d')){var _0x55edf4={};_0x55edf4[_0x295c48[_0x187e('0x29')]]={'$like':'%'+_0x113673['query'][_0x187e('0x3a')]+'%'};return _0x55edf4;}})});}_0x51d33c=_[_0x187e('0x3b')]({},_0x51d33c,_0x113673['options']);var _0x387832={'where':_0x51d33c['where']};return db['ZohoField'][_0x187e('0x1e')](_0x387832)[_0x187e('0x26')](function(_0xcbda57){_0x57d80c['count']=_0xcbda57;if(_0x113673['query'][_0x187e('0x3e')]){_0x51d33c['include']=[{'all':!![]}];}return db['ZohoField'][_0x187e('0x3f')](_0x51d33c);})['then'](function(_0x2a347c){_0x57d80c[_0x187e('0x40')]=_0x2a347c;return _0x57d80c;})['then'](respondWithFilteredResult(_0x217d3a,_0x51d33c))[_0x187e('0x41')](handleError(_0x217d3a,null));};exports[_0x187e('0x42')]=function(_0x26749c,_0x495cf8){var _0x416370={'raw':!![],'where':{'id':_0x26749c['params']['id']}},_0x35feff={};_0x35feff[_0x187e('0x2e')]=_[_0x187e('0x30')](db[_0x187e('0x2b')][_0x187e('0x2c')]);_0x35feff[_0x187e('0x2f')]=_[_0x187e('0x30')](_0x26749c[_0x187e('0x2f')]);_0x35feff[_0x187e('0x31')]=_['intersection'](_0x35feff[_0x187e('0x2e')],_0x35feff[_0x187e('0x2f')]);_0x416370[_0x187e('0x32')]=_[_0x187e('0x33')](_0x35feff['model'],qs[_0x187e('0x34')](_0x26749c[_0x187e('0x2f')][_0x187e('0x34')]));_0x416370[_0x187e('0x32')]=_0x416370[_0x187e('0x32')][_0x187e('0x43')]?_0x416370[_0x187e('0x32')]:_0x35feff[_0x187e('0x2e')];if(_0x26749c[_0x187e('0x2f')][_0x187e('0x3e')]){_0x416370[_0x187e('0x44')]=[{'all':!![]}];}_0x416370=_[_0x187e('0x3b')]({},_0x416370,_0x26749c[_0x187e('0x45')]);return db[_0x187e('0x2b')]['find'](_0x416370)['then'](handleEntityNotFound(_0x495cf8,null))[_0x187e('0x26')](respondWithResult(_0x495cf8,null))[_0x187e('0x41')](handleError(_0x495cf8,null));};exports['create']=function(_0x110f90,_0x4cc207){return db['ZohoField'][_0x187e('0x46')](_0x110f90[_0x187e('0x47')],{})[_0x187e('0x26')](respondWithResult(_0x4cc207,0xc9))[_0x187e('0x41')](handleError(_0x4cc207,null));};exports[_0x187e('0x25')]=function(_0x5f4dde,_0xf09489){if(_0x5f4dde[_0x187e('0x47')]['id']){delete _0x5f4dde[_0x187e('0x47')]['id'];}return db[_0x187e('0x2b')][_0x187e('0x48')]({'where':{'id':_0x5f4dde[_0x187e('0x49')]['id']}})[_0x187e('0x26')](handleEntityNotFound(_0xf09489,null))[_0x187e('0x26')](saveUpdates(_0x5f4dde[_0x187e('0x47')],null))[_0x187e('0x26')](respondWithResult(_0xf09489,null))[_0x187e('0x41')](handleError(_0xf09489,null));};exports[_0x187e('0x4a')]=function(_0x8f789a,_0x17b8e0){return db[_0x187e('0x2b')]['find']({'where':{'id':_0x8f789a['params']['id']}})['then'](handleEntityNotFound(_0x17b8e0,null))[_0x187e('0x26')](removeEntity(_0x17b8e0,null))[_0x187e('0x41')](handleError(_0x17b8e0,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index fed6097..86cd20f 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 _0x32b6=['int_zoho_fields','idField','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x32b6,0x1d1));var _0x632b=function(_0x1234c3,_0x1225ab){_0x1234c3=_0x1234c3-0x0;var _0x408398=_0x32b6[_0x1234c3];return _0x408398;};'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':[{'name':'zoho_unique_index','fields':[_0x632b('0xc'),_0x632b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0120=['rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xd4d369,_0x4f6ad2){var _0x293e5d=function(_0xb0e6a4){while(--_0xb0e6a4){_0xd4d369['push'](_0xd4d369['shift']());}};_0x293e5d(++_0x4f6ad2);}(_0x0120,0x6f));var _0x0012=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0120[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'paranoid':![],'indexes':[{'name':_0x0012('0xe'),'fields':[_0x0012('0xf'),_0x0012('0x10')],'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 43e8c8f..bc97fa9 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 _0x25d8=['rpc','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x25d8,0xc7));var _0x825d=function(_0x4e3444,_0xc4e0f8){_0x4e3444=_0x4e3444-0x0;var _0x65c72b=_0x25d8[_0x4e3444];return _0x65c72b;};'use strict';var _=require(_0x825d('0x0'));var util=require(_0x825d('0x1'));var moment=require(_0x825d('0x2'));var BPromise=require(_0x825d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x825d('0x4'));var db=require(_0x825d('0x5'))['db'];var utils=require(_0x825d('0x6'));var logger=require(_0x825d('0x7'))(_0x825d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x825d('0x9')][_0x825d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c44a8,_0x5515e3,_0x2098d6){return new BPromise(function(_0xdb1b40,_0x5976b5){return client[_0x825d('0xb')](_0x5c44a8,_0x2098d6)[_0x825d('0xc')](function(_0x1b6858){logger[_0x825d('0xd')](_0x825d('0xe'),_0x5515e3,_0x825d('0xf'));logger[_0x825d('0x10')](_0x825d('0x11'),_0x5515e3,_0x825d('0xf'),JSON['stringify'](_0x1b6858));if(_0x1b6858[_0x825d('0x12')]){if(_0x1b6858[_0x825d('0x12')][_0x825d('0x13')]===0x1f4){logger[_0x825d('0x12')](_0x825d('0xe'),_0x5515e3,_0x1b6858[_0x825d('0x12')][_0x825d('0x14')]);return _0x5976b5(_0x1b6858['error'][_0x825d('0x14')]);}logger['error'](_0x825d('0xe'),_0x5515e3,_0x1b6858[_0x825d('0x12')][_0x825d('0x14')]);return _0xdb1b40(_0x1b6858[_0x825d('0x12')][_0x825d('0x14')]);}else{logger['info'](_0x825d('0xe'),_0x5515e3,_0x825d('0xf'));_0xdb1b40(_0x1b6858[_0x825d('0x15')][_0x825d('0x14')]);}})[_0x825d('0x16')](function(_0x4fafec){logger[_0x825d('0x12')]('ZohoField,\x20%s,\x20%s',_0x5515e3,_0x4fafec);_0x5976b5(_0x4fafec);});});} \ No newline at end of file +var _0xa1c0=['message','request\x20sent','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','error','code'];(function(_0x32827d,_0x1145f0){var _0x5f5d75=function(_0x35dbce){while(--_0x35dbce){_0x32827d['push'](_0x32827d['shift']());}};_0x5f5d75(++_0x1145f0);}(_0xa1c0,0x135));var _0x0a1c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa1c0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a1c('0x0'));var BPromise=require('bluebird');var rs=require(_0x0a1c('0x1'));var fs=require('fs');var Redis=require(_0x0a1c('0x2'));var db=require(_0x0a1c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a1c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0a1c('0x5'));var client=jayson[_0x0a1c('0x6')][_0x0a1c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5175de,_0xf97f96,_0x5c2133){return new BPromise(function(_0x3e1a92,_0x2da180){return client[_0x0a1c('0x8')](_0x5175de,_0x5c2133)[_0x0a1c('0x9')](function(_0x2c2c44){logger[_0x0a1c('0xa')](_0x0a1c('0xb'),_0xf97f96,'request\x20sent');logger[_0x0a1c('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0xf97f96,'request\x20sent',JSON['stringify'](_0x2c2c44));if(_0x2c2c44[_0x0a1c('0xd')]){if(_0x2c2c44[_0x0a1c('0xd')][_0x0a1c('0xe')]===0x1f4){logger[_0x0a1c('0xd')](_0x0a1c('0xb'),_0xf97f96,_0x2c2c44['error'][_0x0a1c('0xf')]);return _0x2da180(_0x2c2c44[_0x0a1c('0xd')][_0x0a1c('0xf')]);}logger[_0x0a1c('0xd')](_0x0a1c('0xb'),_0xf97f96,_0x2c2c44[_0x0a1c('0xd')][_0x0a1c('0xf')]);return _0x3e1a92(_0x2c2c44['error'][_0x0a1c('0xf')]);}else{logger[_0x0a1c('0xa')]('ZohoField,\x20%s,\x20%s',_0xf97f96,_0x0a1c('0x10'));_0x3e1a92(_0x2c2c44[_0x0a1c('0x11')][_0x0a1c('0xf')]);}})['catch'](function(_0x18cfac){logger[_0x0a1c('0xd')]('ZohoField,\x20%s,\x20%s',_0xf97f96,_0x18cfac);_0x2da180(_0x18cfac);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2bdd71d..bc0ead4 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2ce2c4,_0x574e86){var _0x334b06=function(_0x205d51){while(--_0x205d51){_0x2ce2c4['push'](_0x2ce2c4['shift']());}};_0x334b06(++_0x574e86);}(_0x70e0,0x17b));var _0x070e=function(_0x3ad196,_0x137989){_0x3ad196=_0x3ad196-0x0;var _0x59cf58=_0x70e0[_0x3ad196];return _0x59cf58;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d3771,_0x402f05){var _0x1d5e03=function(_0x4d224c){while(--_0x4d224c){_0x3d3771['push'](_0x3d3771['shift']());}};_0x1d5e03(++_0x402f05);}(_0xe706,0xa3));var _0x6e70=function(_0x204e52,_0x1d553a){_0x204e52=_0x204e52-0x0;var _0xe5dd25=_0xe706[_0x204e52];return _0xe5dd25;};'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 5ed0698..9d5edf0 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 _0x8856=['STRING','unique_name_and_version','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x4a5c02,_0x5dc14a){var _0x39a30f=function(_0x3fd756){while(--_0x3fd756){_0x4a5c02['push'](_0x4a5c02['shift']());}};_0x39a30f(++_0x5dc14a);}(_0x8856,0xe2));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6885('0x0'));module[_0x6885('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x6885('0x2')],'allowNull':![],'unique':_0x6885('0x3')},'main':{'type':Sequelize[_0x6885('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x6885('0x2')]},'type':{'type':Sequelize[_0x6885('0x2')]},'size':{'type':Sequelize[_0x6885('0x4')]},'active':{'type':Sequelize[_0x6885('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x6885('0x2')]},'state':{'type':Sequelize[_0x6885('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x6885('0x2')]},'remoteUri':{'type':Sequelize[_0x6885('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x7e7b=['exports','unique_name_and_version','STRING','app.js','INTEGER','state','sequelize'];(function(_0x531a3e,_0x3d647b){var _0x510c5f=function(_0x2ef82e){while(--_0x2ef82e){_0x531a3e['push'](_0x531a3e['shift']());}};_0x510c5f(++_0x3d647b);}(_0x7e7b,0x133));var _0xb7e7=function(_0x1f8a35,_0x496a73){_0x1f8a35=_0x1f8a35-0x0;var _0x3fe941=_0x7e7b[_0x1f8a35];return _0x3fe941;};'use strict';var Sequelize=require(_0xb7e7('0x0'));module[_0xb7e7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb7e7('0x2')},'version':{'type':Sequelize[_0xb7e7('0x3')],'allowNull':![],'unique':_0xb7e7('0x2')},'main':{'type':Sequelize[_0xb7e7('0x3')],'defaultValue':_0xb7e7('0x4')},'filename':{'type':Sequelize[_0xb7e7('0x3')]},'path':{'type':Sequelize[_0xb7e7('0x3')]},'type':{'type':Sequelize[_0xb7e7('0x3')]},'size':{'type':Sequelize[_0xb7e7('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xb7e7('0x3')]},'state':{'type':Sequelize[_0xb7e7('0x3')],'unique':_0xb7e7('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb7e7('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 51bfa6e..247f966 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 _0x524e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Integration','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x524e,0x15e));var _0xe524=function(_0x442d0a,_0x3a40aa){_0x442d0a=_0x442d0a-0x0;var _0x3f0ab9=_0x524e[_0x442d0a];return _0x3f0ab9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['Integration'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['Integration'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Integration','includeAll','rows','catch','show'];(function(_0x30c1d6,_0x4de4ba){var _0x34433a=function(_0xb9761d){while(--_0xb9761d){_0x30c1d6['push'](_0x30c1d6['shift']());}};_0x34433a(++_0x4de4ba);}(_0x0295,0x1f0));var _0x5029=function(_0x44124b,_0x2b2b32){_0x44124b=_0x44124b-0x0;var _0xafe8bf=_0x0295[_0x44124b];return _0xafe8bf;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['Integration'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['Integration'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index bac0eb8..cbd256f 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 _0xa894=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','integrations','lodash','util'];(function(_0xe2e6b,_0x122af2){var _0x2656d3=function(_0x214b7c){while(--_0x214b7c){_0xe2e6b['push'](_0xe2e6b['shift']());}};_0x2656d3(++_0x122af2);}(_0xa894,0x11e));var _0x4a89=function(_0x3ef984,_0x3f5981){_0x3ef984=_0x3ef984-0x0;var _0x578b03=_0xa894[_0x3ef984];return _0x578b03;};'use strict';var _=require(_0x4a89('0x0'));var util=require(_0x4a89('0x1'));var logger=require(_0x4a89('0x2'))(_0x4a89('0x3'));var moment=require(_0x4a89('0x4'));var BPromise=require(_0x4a89('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a89('0x6'));var rimraf=require(_0x4a89('0x7'));var config=require(_0x4a89('0x8'));var attributes=require(_0x4a89('0x9'));module[_0x4a89('0xa')]=function(_0x590d82,_0x2d5823){return _0x590d82['define']('Integration',attributes,{'tableName':_0x4a89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc699=['../../config/environment','exports','define','Integration','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc699,0x1d0));var _0x9c69=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0xc699[_0x59e862];return _0x1a25ee;};'use strict';var _=require('lodash');var util=require(_0x9c69('0x0'));var logger=require(_0x9c69('0x1'))('api');var moment=require(_0x9c69('0x2'));var BPromise=require('bluebird');var rp=require(_0x9c69('0x3'));var fs=require('fs');var path=require(_0x9c69('0x4'));var rimraf=require(_0x9c69('0x5'));var config=require(_0x9c69('0x6'));var attributes=require('./integration.attributes');module[_0x9c69('0x7')]=function(_0x59835a,_0xfaf2a6){return _0x59835a[_0x9c69('0x8')](_0x9c69('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 69b2d43..8467107 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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x35d8d5,_0x53b9fa){var _0x540655=function(_0x486868){while(--_0x486868){_0x35d8d5['push'](_0x35d8d5['shift']());}};_0x540655(++_0x53b9fa);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var 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']('Integration,\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 +var _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1b2113,_0x211652){var _0x3874a9=function(_0x4d4ea7){while(--_0x4d4ea7){_0x1b2113['push'](_0x1b2113['shift']());}};_0x3874a9(++_0x211652);}(_0xef0f,0x168));var _0xfef0=function(_0x8a4271,_0x70d1b7){_0x8a4271=_0x8a4271-0x0;var _0x37b801=_0xef0f[_0x8a4271];return _0x37b801;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b31906f..38ba8bb 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(_0x5ac81b,_0x5b2f34){var _0x286915=function(_0x24b01e){while(--_0x24b01e){_0x5ac81b['push'](_0x5ac81b['shift']());}};_0x286915(++_0x5b2f34);}(_0x187d,0x93));var _0xd187=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x187d[_0x3e112d];return _0x531c31;};'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 _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3551eb,_0x15b993){var _0x2bc467=function(_0x562dd7){while(--_0x562dd7){_0x3551eb['push'](_0x3551eb['shift']());}};_0x2bc467(++_0x15b993);}(_0x57ca,0x108));var _0xa57c=function(_0x5831fc,_0xab9a0a){_0x5831fc=_0x5831fc-0x0;var _0x47c212=_0x57ca[_0x5831fc];return _0x47c212;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 803cbaf..90ff48f 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 _0x6677=['TEXT','ENUM','SENT','RECEIVED','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x2cd1c3,_0x2fc338){var _0x19348c=function(_0x114f05){while(--_0x114f05){_0x2cd1c3['push'](_0x2cd1c3['shift']());}};_0x19348c(++_0x2fc338);}(_0x6677,0x1d8));var _0x7667=function(_0x176541,_0xc07131){_0x176541=_0x176541-0x0;var _0x54ff55=_0x6677[_0x176541];return _0x54ff55;};'use strict';var Sequelize=require('sequelize');module[_0x7667('0x0')]={'integration':{'type':Sequelize[_0x7667('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x7667('0x1')]},'integrationId':{'type':Sequelize[_0x7667('0x2')]},'contacts':{'type':Sequelize[_0x7667('0x1')]},'uniqueid':{'type':Sequelize[_0x7667('0x1')]},'calleridnum':{'type':Sequelize[_0x7667('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7667('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7667('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7667('0x3')]},'holdtime':{'type':Sequelize[_0x7667('0x2')]},'agentcomplete':{'type':Sequelize[_0x7667('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7667('0x3')]},'talktime':{'type':Sequelize[_0x7667('0x2')]},'agentacw':{'type':Sequelize[_0x7667('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7667('0x2')]},'reason':{'type':Sequelize[_0x7667('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x7667('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x7667('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7667('0x1')]},'channelstate':{'type':Sequelize[_0x7667('0x2')]},'channelstatedesc':{'type':Sequelize[_0x7667('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7667('0x1')]},'language':{'type':Sequelize[_0x7667('0x1')]},'accountcode':{'type':Sequelize[_0x7667('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7667('0x1')]},'priority':{'type':Sequelize[_0x7667('0x1')]},'destchannel':{'type':Sequelize[_0x7667('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x7667('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7667('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7667('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7667('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7667('0x1')]},'destcontext':{'type':Sequelize[_0x7667('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7667('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7667('0x1')]},'subject':{'type':Sequelize[_0x7667('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x7667('0x1')]},'cc':{'type':Sequelize[_0x7667('0x1')]},'attachment':{'type':Sequelize[_0x7667('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x7667('0x5')]},'status':{'type':Sequelize[_0x7667('0x6')](_0x7667('0x7'),'SENDING',_0x7667('0x8'),'FAILED')},'url':{'type':Sequelize[_0x7667('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x7667('0x1')]},'projectId':{'type':Sequelize[_0x7667('0x2')]}}; \ No newline at end of file +var _0x767f=['TEXT','SENT','RECEIVED','sequelize','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x2818eb,_0x19aa77){var _0x1223d0=function(_0x193549){while(--_0x193549){_0x2818eb['push'](_0x2818eb['shift']());}};_0x1223d0(++_0x19aa77);}(_0x767f,0xe3));var _0xf767=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x767f[_0xda464c];return _0x19e222;};'use strict';var Sequelize=require(_0xf767('0x0'));module['exports']={'integration':{'type':Sequelize[_0xf767('0x1')]},'eventChannel':{'type':Sequelize[_0xf767('0x1')]},'exitStatus':{'type':Sequelize[_0xf767('0x1')]},'ticketId':{'type':Sequelize[_0xf767('0x1')]},'integrationId':{'type':Sequelize[_0xf767('0x2')]},'contacts':{'type':Sequelize[_0xf767('0x1')]},'uniqueid':{'type':Sequelize[_0xf767('0x1')]},'calleridnum':{'type':Sequelize[_0xf767('0x1')]},'calleridname':{'type':Sequelize[_0xf767('0x1')]},'queue':{'type':Sequelize[_0xf767('0x1')]},'interface':{'type':Sequelize[_0xf767('0x1')]},'membername':{'type':Sequelize[_0xf767('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf767('0x3')]},'agentconnectAt':{'type':Sequelize[_0xf767('0x3')]},'holdtime':{'type':Sequelize[_0xf767('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf767('0x3')]},'talktime':{'type':Sequelize[_0xf767('0x2')]},'agentacw':{'type':Sequelize[_0xf767('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf767('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xf767('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf767('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf767('0x1')]},'channelstate':{'type':Sequelize[_0xf767('0x2')]},'channelstatedesc':{'type':Sequelize[_0xf767('0x1')]},'connectedlinenum':{'type':Sequelize[_0xf767('0x1')]},'connectedlinename':{'type':Sequelize[_0xf767('0x1')]},'language':{'type':Sequelize[_0xf767('0x1')]},'accountcode':{'type':Sequelize[_0xf767('0x1')]},'context':{'type':Sequelize[_0xf767('0x1')]},'exten':{'type':Sequelize[_0xf767('0x1')]},'priority':{'type':Sequelize[_0xf767('0x1')]},'destchannel':{'type':Sequelize[_0xf767('0x1')]},'destchannelstate':{'type':Sequelize[_0xf767('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xf767('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xf767('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf767('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf767('0x1')]},'destlanguage':{'type':Sequelize[_0xf767('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf767('0x1')]},'destexten':{'type':Sequelize[_0xf767('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xf767('0x1')]},'messageId':{'type':Sequelize[_0xf767('0x1')]},'inReplyTo':{'type':Sequelize[_0xf767('0x1')]},'subject':{'type':Sequelize[_0xf767('0x1')]},'from':{'type':Sequelize[_0xf767('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xf767('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xf767('0x5')]},'status':{'type':Sequelize['ENUM'](_0xf767('0x6'),'SENDING',_0xf767('0x7'),'FAILED')},'url':{'type':Sequelize[_0xf767('0x1')]},'app':{'type':Sequelize[_0xf767('0x1')]},'appdata':{'type':Sequelize[_0xf767('0x1')]},'projectId':{'type':Sequelize[_0xf767('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8208ad8..74c48cf 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 _0x5a06=['intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','IntegrationReport','model','query','keys'];(function(_0x5ace25,_0x536239){var _0x4ba17a=function(_0x1ee54e){while(--_0x1ee54e){_0x5ace25['push'](_0x5ace25['shift']());}};_0x4ba17a(++_0x536239);}(_0x5a06,0x185));var _0x65a0=function(_0x593099,_0x2faaa2){_0x593099=_0x593099-0x0;var _0x29cd56=_0x5a06[_0x593099];return _0x29cd56;};'use strict';var emlformat=require(_0x65a0('0x0'));var rimraf=require(_0x65a0('0x1'));var zipdir=require(_0x65a0('0x2'));var jsonpatch=require(_0x65a0('0x3'));var rp=require(_0x65a0('0x4'));var moment=require(_0x65a0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x65a0('0x6'));var util=require('util');var path=require(_0x65a0('0x7'));var sox=require(_0x65a0('0x8'));var csv=require(_0x65a0('0x9'));var ejs=require(_0x65a0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65a0('0xb'));var squel=require(_0x65a0('0xc'));var crypto=require('crypto');var jsforce=require(_0x65a0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x65a0('0x9'));var querystring=require(_0x65a0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65a0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x65a0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x65a0('0x11'));var utils=require(_0x65a0('0x12'));var config=require(_0x65a0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x65a0('0x14'))['db'];function respondWithStatusCode(_0x188dd3,_0x150143){_0x150143=_0x150143||0xcc;return function(_0x5ba50e){if(_0x5ba50e){return _0x188dd3[_0x65a0('0x15')](_0x150143);}return _0x188dd3[_0x65a0('0x16')](_0x150143)[_0x65a0('0x17')]();};}function respondWithResult(_0x186f09,_0x3260e6){_0x3260e6=_0x3260e6||0xc8;return function(_0x17e062){if(_0x17e062){return _0x186f09[_0x65a0('0x16')](_0x3260e6)[_0x65a0('0x18')](_0x17e062);}};}function respondWithFilteredResult(_0x3d3157,_0xe2f1e){return function(_0x528950){if(_0x528950){var _0x74084b=typeof _0xe2f1e['offset']===_0x65a0('0x19')&&typeof _0xe2f1e[_0x65a0('0x1a')]===_0x65a0('0x19');var _0x1fa9a1=_0x528950['count'];var _0x4f8e9b=_0x74084b?0x0:_0xe2f1e['offset'];var _0x5b67b5=_0x74084b?_0x528950['count']:_0xe2f1e[_0x65a0('0x1b')]+_0xe2f1e[_0x65a0('0x1a')];var _0x377d5f;if(_0x5b67b5>=_0x1fa9a1){_0x5b67b5=_0x1fa9a1;_0x377d5f=0xc8;}else{_0x377d5f=0xce;}_0x3d3157[_0x65a0('0x16')](_0x377d5f);return _0x3d3157[_0x65a0('0x1c')](_0x65a0('0x1d'),_0x4f8e9b+'-'+_0x5b67b5+'/'+_0x1fa9a1)['json'](_0x528950);}return null;};}function patchUpdates(_0x3d38e1){return function(_0x491fa0){try{jsonpatch[_0x65a0('0x1e')](_0x491fa0,_0x3d38e1,!![]);}catch(_0x40e25f){return BPromise[_0x65a0('0x1f')](_0x40e25f);}return _0x491fa0[_0x65a0('0x20')]();};}function saveUpdates(_0x1bc275,_0x36f7b2){return function(_0x2ecdc0){if(_0x2ecdc0){return _0x2ecdc0['update'](_0x1bc275)[_0x65a0('0x21')](function(_0x2b4c41){return _0x2b4c41;});}return null;};}function removeEntity(_0x5e8ada,_0x186242){return function(_0x2bed60){if(_0x2bed60){return _0x2bed60['destroy']()[_0x65a0('0x21')](function(){_0x5e8ada[_0x65a0('0x16')](0xcc)[_0x65a0('0x17')]();});}};}function handleEntityNotFound(_0x4c70f9,_0x4da7e9){return function(_0x75673e){if(!_0x75673e){_0x4c70f9['sendStatus'](0x194);}return _0x75673e;};}function handleError(_0xeedc55,_0x2beba8){_0x2beba8=_0x2beba8||0x1f4;return function(_0x30816){logger['error'](_0x30816[_0x65a0('0x22')]);if(_0x30816[_0x65a0('0x23')]){delete _0x30816['name'];}_0xeedc55['status'](_0x2beba8)[_0x65a0('0x24')](_0x30816);};}exports[_0x65a0('0x25')]=function(_0x367852,_0x4b200b){var _0x42937f={},_0x5414c0={},_0x3f131a={'count':0x0,'rows':[]};var _0x4b278b=_[_0x65a0('0x26')](db[_0x65a0('0x27')]['rawAttributes'],function(_0x497373){return{'name':_0x497373['fieldName'],'type':_0x497373['type']['key']};});_0x5414c0[_0x65a0('0x28')]=_['map'](_0x4b278b,'name');_0x5414c0[_0x65a0('0x29')]=_[_0x65a0('0x2a')](_0x367852[_0x65a0('0x29')]);_0x5414c0['filters']=_[_0x65a0('0x2b')](_0x5414c0[_0x65a0('0x28')],_0x5414c0[_0x65a0('0x29')]);_0x42937f['attributes']=_[_0x65a0('0x2b')](_0x5414c0[_0x65a0('0x28')],qs['fields'](_0x367852[_0x65a0('0x29')]['fields']));_0x42937f['attributes']=_0x42937f[_0x65a0('0x2c')]['length']?_0x42937f[_0x65a0('0x2c')]:_0x5414c0[_0x65a0('0x28')];if(!_0x367852['query'][_0x65a0('0x2d')](_0x65a0('0x2e'))){_0x42937f['limit']=qs[_0x65a0('0x1a')](_0x367852[_0x65a0('0x29')]['limit']);_0x42937f['offset']=qs['offset'](_0x367852['query'][_0x65a0('0x1b')]);}_0x42937f[_0x65a0('0x2f')]=qs['sort'](_0x367852[_0x65a0('0x29')][_0x65a0('0x30')]);_0x42937f[_0x65a0('0x31')]=qs[_0x65a0('0x32')](_[_0x65a0('0x33')](_0x367852['query'],_0x5414c0[_0x65a0('0x32')]),_0x4b278b);if(_0x367852[_0x65a0('0x29')]['filter']){_0x42937f['where']=_[_0x65a0('0x34')](_0x42937f['where'],{'$or':_[_0x65a0('0x26')](_0x4b278b,function(_0x1b6a2b){if(_0x1b6a2b[_0x65a0('0x35')]!==_0x65a0('0x36')){var _0x5e4a56={};_0x5e4a56[_0x1b6a2b[_0x65a0('0x23')]]={'$like':'%'+_0x367852[_0x65a0('0x29')][_0x65a0('0x37')]+'%'};return _0x5e4a56;}})});}_0x42937f=_[_0x65a0('0x34')]({},_0x42937f,_0x367852[_0x65a0('0x38')]);var _0x53a064={'where':_0x42937f[_0x65a0('0x31')]};return db[_0x65a0('0x27')][_0x65a0('0x39')](_0x53a064)[_0x65a0('0x21')](function(_0x1750ce){_0x3f131a[_0x65a0('0x39')]=_0x1750ce;if(_0x367852[_0x65a0('0x29')][_0x65a0('0x3a')]){_0x42937f[_0x65a0('0x3b')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x42937f);})['then'](function(_0x21aaea){_0x3f131a[_0x65a0('0x3c')]=_0x21aaea;return _0x3f131a;})[_0x65a0('0x21')](respondWithFilteredResult(_0x4b200b,_0x42937f))[_0x65a0('0x3d')](handleError(_0x4b200b,null));};exports[_0x65a0('0x3e')]=function(_0x4666af,_0x1b3e17){var _0x5898d5={'raw':![],'where':{'id':_0x4666af[_0x65a0('0x3f')]['id']}},_0xb2b42b={};_0xb2b42b['model']=_['keys'](db[_0x65a0('0x27')][_0x65a0('0x40')]);_0xb2b42b[_0x65a0('0x29')]=_[_0x65a0('0x2a')](_0x4666af[_0x65a0('0x29')]);_0xb2b42b[_0x65a0('0x32')]=_['intersection'](_0xb2b42b[_0x65a0('0x28')],_0xb2b42b['query']);_0x5898d5[_0x65a0('0x2c')]=_[_0x65a0('0x2b')](_0xb2b42b['model'],qs[_0x65a0('0x41')](_0x4666af[_0x65a0('0x29')][_0x65a0('0x41')]));_0x5898d5['attributes']=_0x5898d5[_0x65a0('0x2c')]['length']?_0x5898d5[_0x65a0('0x2c')]:_0xb2b42b[_0x65a0('0x28')];if(_0x4666af[_0x65a0('0x29')]['includeAll']){_0x5898d5['include']=[{'all':!![]}];}_0x5898d5=_[_0x65a0('0x34')]({},_0x5898d5,_0x4666af['options']);return db[_0x65a0('0x27')][_0x65a0('0x42')](_0x5898d5)[_0x65a0('0x21')](handleEntityNotFound(_0x1b3e17,null))['then'](respondWithResult(_0x1b3e17,null))[_0x65a0('0x3d')](handleError(_0x1b3e17,null));};exports[_0x65a0('0x43')]=function(_0x39e2f7,_0x4fbe7d){return db[_0x65a0('0x27')][_0x65a0('0x43')](_0x39e2f7[_0x65a0('0x44')],{})[_0x65a0('0x21')](respondWithResult(_0x4fbe7d,0xc9))[_0x65a0('0x3d')](handleError(_0x4fbe7d,null));};exports[_0x65a0('0x45')]=function(_0x27c77c,_0x5ecd54){if(_0x27c77c[_0x65a0('0x44')]['id']){delete _0x27c77c[_0x65a0('0x44')]['id'];}return db[_0x65a0('0x27')][_0x65a0('0x42')]({'where':{'id':_0x27c77c['params']['id']}})[_0x65a0('0x21')](handleEntityNotFound(_0x5ecd54,null))[_0x65a0('0x21')](saveUpdates(_0x27c77c['body'],null))[_0x65a0('0x21')](respondWithResult(_0x5ecd54,null))[_0x65a0('0x3d')](handleError(_0x5ecd54,null));};exports[_0x65a0('0x46')]=function(_0x50f754,_0x2ebd0f){return db[_0x65a0('0x27')]['find']({'where':{'id':_0x50f754[_0x65a0('0x3f')]['id']}})[_0x65a0('0x21')](handleEntityNotFound(_0x2ebd0f,null))[_0x65a0('0x21')](removeEntity(_0x2ebd0f,null))[_0x65a0('0x3d')](handleError(_0x2ebd0f,null));};exports[_0x65a0('0x47')]=function(_0x5c6c96,_0x4eb7f9){return db[_0x65a0('0x27')][_0x65a0('0x47')]()[_0x65a0('0x21')](respondWithResult(_0x4eb7f9,null))['catch'](handleError(_0x4eb7f9,null));}; \ No newline at end of file +var _0x1a19=['map','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','sendStatus','stack','name'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x1a19,0x14d));var _0x91a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a19[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x91a1('0x0'));var rimraf=require(_0x91a1('0x1'));var zipdir=require(_0x91a1('0x2'));var jsonpatch=require(_0x91a1('0x3'));var rp=require(_0x91a1('0x4'));var moment=require('moment');var BPromise=require(_0x91a1('0x5'));var Mustache=require(_0x91a1('0x6'));var util=require(_0x91a1('0x7'));var path=require(_0x91a1('0x8'));var sox=require('sox');var csv=require(_0x91a1('0x9'));var ejs=require(_0x91a1('0xa'));var fs=require('fs');var fs_extra=require(_0x91a1('0xb'));var _=require(_0x91a1('0xc'));var squel=require(_0x91a1('0xd'));var crypto=require(_0x91a1('0xe'));var jsforce=require(_0x91a1('0xf'));var deskjs=require(_0x91a1('0x10'));var toCsv=require(_0x91a1('0x9'));var querystring=require(_0x91a1('0x11'));var Papa=require('papaparse');var Redis=require(_0x91a1('0x12'));var authService=require(_0x91a1('0x13'));var qs=require(_0x91a1('0x14'));var as=require(_0x91a1('0x15'));var hardwareService=require(_0x91a1('0x16'));var logger=require('../../config/logger')(_0x91a1('0x17'));var utils=require('../../config/utils');var config=require(_0x91a1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x91a1('0x19'))['db'];function respondWithStatusCode(_0x21ce42,_0x55df29){_0x55df29=_0x55df29||0xcc;return function(_0x3be6a8){if(_0x3be6a8){return _0x21ce42['sendStatus'](_0x55df29);}return _0x21ce42[_0x91a1('0x1a')](_0x55df29)[_0x91a1('0x1b')]();};}function respondWithResult(_0x31877b,_0x5da373){_0x5da373=_0x5da373||0xc8;return function(_0x40c829){if(_0x40c829){return _0x31877b[_0x91a1('0x1a')](_0x5da373)[_0x91a1('0x1c')](_0x40c829);}};}function respondWithFilteredResult(_0x22dfcb,_0x377012){return function(_0x19fa10){if(_0x19fa10){var _0x51b66d=typeof _0x377012['offset']===_0x91a1('0x1d')&&typeof _0x377012[_0x91a1('0x1e')]==='undefined';var _0x202001=_0x19fa10[_0x91a1('0x1f')];var _0x1b9a89=_0x51b66d?0x0:_0x377012[_0x91a1('0x20')];var _0x303d7e=_0x51b66d?_0x19fa10[_0x91a1('0x1f')]:_0x377012[_0x91a1('0x20')]+_0x377012[_0x91a1('0x1e')];var _0x39ccdd;if(_0x303d7e>=_0x202001){_0x303d7e=_0x202001;_0x39ccdd=0xc8;}else{_0x39ccdd=0xce;}_0x22dfcb[_0x91a1('0x1a')](_0x39ccdd);return _0x22dfcb[_0x91a1('0x21')](_0x91a1('0x22'),_0x1b9a89+'-'+_0x303d7e+'/'+_0x202001)[_0x91a1('0x1c')](_0x19fa10);}return null;};}function patchUpdates(_0x17382c){return function(_0x2a422f){try{jsonpatch['apply'](_0x2a422f,_0x17382c,!![]);}catch(_0x5abeb8){return BPromise['reject'](_0x5abeb8);}return _0x2a422f[_0x91a1('0x23')]();};}function saveUpdates(_0x5dd380,_0x6f04b6){return function(_0x35f778){if(_0x35f778){return _0x35f778[_0x91a1('0x24')](_0x5dd380)[_0x91a1('0x25')](function(_0x3c007a){return _0x3c007a;});}return null;};}function removeEntity(_0xc58ae8,_0x27d3f5){return function(_0x33ad92){if(_0x33ad92){return _0x33ad92[_0x91a1('0x26')]()[_0x91a1('0x25')](function(){_0xc58ae8['status'](0xcc)[_0x91a1('0x1b')]();});}};}function handleEntityNotFound(_0x46e489,_0xa1bd65){return function(_0x4f2a0b){if(!_0x4f2a0b){_0x46e489[_0x91a1('0x27')](0x194);}return _0x4f2a0b;};}function handleError(_0x163a00,_0x5a6a7c){_0x5a6a7c=_0x5a6a7c||0x1f4;return function(_0x67fb42){logger['error'](_0x67fb42[_0x91a1('0x28')]);if(_0x67fb42[_0x91a1('0x29')]){delete _0x67fb42[_0x91a1('0x29')];}_0x163a00['status'](_0x5a6a7c)['send'](_0x67fb42);};}exports['index']=function(_0x910ce6,_0x358117){var _0x2c0426={},_0x31f047={},_0x564cdb={'count':0x0,'rows':[]};var _0x70d9af=_[_0x91a1('0x2a')](db['IntegrationReport']['rawAttributes'],function(_0xbd61bf){return{'name':_0xbd61bf[_0x91a1('0x2b')],'type':_0xbd61bf['type'][_0x91a1('0x2c')]};});_0x31f047[_0x91a1('0x2d')]=_[_0x91a1('0x2a')](_0x70d9af,'name');_0x31f047['query']=_[_0x91a1('0x2e')](_0x910ce6['query']);_0x31f047['filters']=_[_0x91a1('0x2f')](_0x31f047[_0x91a1('0x2d')],_0x31f047[_0x91a1('0x30')]);_0x2c0426[_0x91a1('0x31')]=_[_0x91a1('0x2f')](_0x31f047[_0x91a1('0x2d')],qs['fields'](_0x910ce6[_0x91a1('0x30')][_0x91a1('0x32')]));_0x2c0426['attributes']=_0x2c0426[_0x91a1('0x31')][_0x91a1('0x33')]?_0x2c0426[_0x91a1('0x31')]:_0x31f047[_0x91a1('0x2d')];if(!_0x910ce6['query'][_0x91a1('0x34')](_0x91a1('0x35'))){_0x2c0426['limit']=qs['limit'](_0x910ce6[_0x91a1('0x30')][_0x91a1('0x1e')]);_0x2c0426['offset']=qs[_0x91a1('0x20')](_0x910ce6['query'][_0x91a1('0x20')]);}_0x2c0426['order']=qs[_0x91a1('0x36')](_0x910ce6[_0x91a1('0x30')]['sort']);_0x2c0426[_0x91a1('0x37')]=qs['filters'](_[_0x91a1('0x38')](_0x910ce6['query'],_0x31f047[_0x91a1('0x39')]),_0x70d9af);if(_0x910ce6[_0x91a1('0x30')][_0x91a1('0x3a')]){_0x2c0426[_0x91a1('0x37')]=_[_0x91a1('0x3b')](_0x2c0426[_0x91a1('0x37')],{'$or':_['map'](_0x70d9af,function(_0x5088b1){if(_0x5088b1[_0x91a1('0x3c')]!==_0x91a1('0x3d')){var _0x448281={};_0x448281[_0x5088b1[_0x91a1('0x29')]]={'$like':'%'+_0x910ce6[_0x91a1('0x30')][_0x91a1('0x3a')]+'%'};return _0x448281;}})});}_0x2c0426=_[_0x91a1('0x3b')]({},_0x2c0426,_0x910ce6[_0x91a1('0x3e')]);var _0x4bc29e={'where':_0x2c0426[_0x91a1('0x37')]};return db[_0x91a1('0x3f')]['count'](_0x4bc29e)[_0x91a1('0x25')](function(_0x284ab9){_0x564cdb[_0x91a1('0x1f')]=_0x284ab9;if(_0x910ce6['query'][_0x91a1('0x40')]){_0x2c0426[_0x91a1('0x41')]=[{'all':!![]}];}return db[_0x91a1('0x3f')][_0x91a1('0x42')](_0x2c0426);})[_0x91a1('0x25')](function(_0x32f7a4){_0x564cdb[_0x91a1('0x43')]=_0x32f7a4;return _0x564cdb;})[_0x91a1('0x25')](respondWithFilteredResult(_0x358117,_0x2c0426))[_0x91a1('0x44')](handleError(_0x358117,null));};exports[_0x91a1('0x45')]=function(_0x20c39a,_0x3a1af7){var _0x134006={'raw':![],'where':{'id':_0x20c39a[_0x91a1('0x46')]['id']}},_0x149f10={};_0x149f10['model']=_[_0x91a1('0x2e')](db[_0x91a1('0x3f')]['rawAttributes']);_0x149f10['query']=_['keys'](_0x20c39a[_0x91a1('0x30')]);_0x149f10[_0x91a1('0x39')]=_[_0x91a1('0x2f')](_0x149f10['model'],_0x149f10[_0x91a1('0x30')]);_0x134006[_0x91a1('0x31')]=_[_0x91a1('0x2f')](_0x149f10[_0x91a1('0x2d')],qs[_0x91a1('0x32')](_0x20c39a[_0x91a1('0x30')]['fields']));_0x134006[_0x91a1('0x31')]=_0x134006['attributes']['length']?_0x134006[_0x91a1('0x31')]:_0x149f10['model'];if(_0x20c39a[_0x91a1('0x30')][_0x91a1('0x40')]){_0x134006['include']=[{'all':!![]}];}_0x134006=_[_0x91a1('0x3b')]({},_0x134006,_0x20c39a[_0x91a1('0x3e')]);return db[_0x91a1('0x3f')]['find'](_0x134006)[_0x91a1('0x25')](handleEntityNotFound(_0x3a1af7,null))[_0x91a1('0x25')](respondWithResult(_0x3a1af7,null))[_0x91a1('0x44')](handleError(_0x3a1af7,null));};exports[_0x91a1('0x47')]=function(_0x3acb6f,_0x2d7c56){return db[_0x91a1('0x3f')][_0x91a1('0x47')](_0x3acb6f['body'],{})[_0x91a1('0x25')](respondWithResult(_0x2d7c56,0xc9))[_0x91a1('0x44')](handleError(_0x2d7c56,null));};exports['update']=function(_0x5bb4a6,_0x43907c){if(_0x5bb4a6[_0x91a1('0x48')]['id']){delete _0x5bb4a6[_0x91a1('0x48')]['id'];}return db[_0x91a1('0x3f')][_0x91a1('0x49')]({'where':{'id':_0x5bb4a6['params']['id']}})[_0x91a1('0x25')](handleEntityNotFound(_0x43907c,null))[_0x91a1('0x25')](saveUpdates(_0x5bb4a6[_0x91a1('0x48')],null))[_0x91a1('0x25')](respondWithResult(_0x43907c,null))[_0x91a1('0x44')](handleError(_0x43907c,null));};exports['destroy']=function(_0x20a8e1,_0x107b98){return db[_0x91a1('0x3f')]['find']({'where':{'id':_0x20a8e1['params']['id']}})[_0x91a1('0x25')](handleEntityNotFound(_0x107b98,null))[_0x91a1('0x25')](removeEntity(_0x107b98,null))[_0x91a1('0x44')](handleError(_0x107b98,null));};exports[_0x91a1('0x4a')]=function(_0xed653b,_0x106f36){return db[_0x91a1('0x3f')][_0x91a1('0x4a')]()['then'](respondWithResult(_0x106f36,null))[_0x91a1('0x44')](handleError(_0x106f36,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ce64e30..e2e8e70 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 _0x3159=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x4bb685,_0x53636e){var _0x7f8fee=function(_0x11d290){while(--_0x11d290){_0x4bb685['push'](_0x4bb685['shift']());}};_0x7f8fee(++_0x53636e);}(_0x3159,0x8a));var _0x9315=function(_0x1f76a2,_0x59e592){_0x1f76a2=_0x1f76a2-0x0;var _0x4da05d=_0x3159[_0x1f76a2];return _0x4da05d;};'use strict';var _=require(_0x9315('0x0'));var util=require(_0x9315('0x1'));var logger=require(_0x9315('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9315('0x3'));var rp=require(_0x9315('0x4'));var fs=require('fs');var path=require(_0x9315('0x5'));var rimraf=require(_0x9315('0x6'));var config=require(_0x9315('0x7'));var attributes=require(_0x9315('0x8'));module[_0x9315('0x9')]=function(_0xa9f259,_0x232012){return _0xa9f259[_0x9315('0xa')](_0x9315('0xb'),attributes,{'tableName':_0x9315('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24de=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','api','moment','bluebird','request-promise'];(function(_0x324d84,_0x3b8852){var _0x804635=function(_0x169c7a){while(--_0x169c7a){_0x324d84['push'](_0x324d84['shift']());}};_0x804635(++_0x3b8852);}(_0x24de,0x94));var _0xe24d=function(_0x2d37a8,_0x4101c0){_0x2d37a8=_0x2d37a8-0x0;var _0x1a4dc8=_0x24de[_0x2d37a8];return _0x1a4dc8;};'use strict';var _=require(_0xe24d('0x0'));var util=require(_0xe24d('0x1'));var logger=require('../../config/logger')(_0xe24d('0x2'));var moment=require(_0xe24d('0x3'));var BPromise=require(_0xe24d('0x4'));var rp=require(_0xe24d('0x5'));var fs=require('fs');var path=require(_0xe24d('0x6'));var rimraf=require(_0xe24d('0x7'));var config=require(_0xe24d('0x8'));var attributes=require(_0xe24d('0x9'));module[_0xe24d('0xa')]=function(_0x52db04,_0x4c8f8b){return _0x52db04[_0xe24d('0xb')](_0xe24d('0xc'),attributes,{'tableName':_0xe24d('0xd'),'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 e8ce3ea..d9cc4d4 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 _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x87f29b,_0x62866f){var _0x24771e=function(_0x373f10){while(--_0x373f10){_0x87f29b['push'](_0x87f29b['shift']());}};_0x24771e(++_0x62866f);}(_0x57ca,0x108));var _0xa57c=function(_0x200eb4,_0x393166){_0x200eb4=_0x200eb4-0x0;var _0x3026fd=_0x57ca[_0x200eb4];return _0x3026fd;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5b1b07,_0x119df6){var _0x59fbbc=function(_0xc8f58a){while(--_0xc8f58a){_0x5b1b07['push'](_0x5b1b07['shift']());}};_0x59fbbc(++_0x119df6);}(_0x2ef3,0xba));var _0x32ef=function(_0x4e457c,_0x4b0bc7){_0x4e457c=_0x4e457c-0x0;var _0x5e7897=_0x2ef3[_0x4e457c];return _0x5e7897;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 678af7d..44dfb17 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 _0xb1dc=['create','addInterval','/:id/sub_intervals/create_many','put','update','delete','/:id','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id/sub_intervals','getIntervals','post'];(function(_0x2fd034,_0x36b038){var _0x47d477=function(_0x1d4fe9){while(--_0x1d4fe9){_0x2fd034['push'](_0x2fd034['shift']());}};_0x47d477(++_0x36b038);}(_0xb1dc,0x133));var _0xcb1d=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xb1dc[_0x100682];return _0xcb6e87;};'use strict';var multer=require('multer');var util=require(_0xcb1d('0x0'));var path=require('path');var timeout=require(_0xcb1d('0x1'));var express=require(_0xcb1d('0x2'));var router=express[_0xcb1d('0x3')]();var fs_extra=require(_0xcb1d('0x4'));var auth=require(_0xcb1d('0x5'));var interaction=require(_0xcb1d('0x6'));var config=require(_0xcb1d('0x7'));var controller=require(_0xcb1d('0x8'));router[_0xcb1d('0x9')]('/',auth[_0xcb1d('0xa')](),controller[_0xcb1d('0xb')]);router[_0xcb1d('0x9')]('/:id',auth[_0xcb1d('0xa')](),controller['show']);router[_0xcb1d('0x9')](_0xcb1d('0xc'),auth[_0xcb1d('0xa')](),controller[_0xcb1d('0xd')]);router[_0xcb1d('0xe')]('/',auth[_0xcb1d('0xa')](),controller[_0xcb1d('0xf')]);router[_0xcb1d('0xe')](_0xcb1d('0xc'),auth['isAuthenticated'](),controller[_0xcb1d('0x10')]);router[_0xcb1d('0xe')](_0xcb1d('0x11'),auth['isAuthenticated'](),controller['addIntervals']);router[_0xcb1d('0x12')]('/:id',auth[_0xcb1d('0xa')](),controller[_0xcb1d('0x13')]);router[_0xcb1d('0x14')](_0xcb1d('0x15'),auth['isAuthenticated'](),controller[_0xcb1d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7b92=['getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','destroy','multer','path','connect-timeout','fs-extra','../../config/environment','./interval.controller','isAuthenticated','index','/:id','get','/:id/sub_intervals'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7b92,0x1e3));var _0x27b9=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7b92[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x27b9('0x0'));var util=require('util');var path=require(_0x27b9('0x1'));var timeout=require(_0x27b9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x27b9('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x27b9('0x4'));var controller=require(_0x27b9('0x5'));router['get']('/',auth[_0x27b9('0x6')](),controller[_0x27b9('0x7')]);router['get'](_0x27b9('0x8'),auth[_0x27b9('0x6')](),controller['show']);router[_0x27b9('0x9')](_0x27b9('0xa'),auth[_0x27b9('0x6')](),controller[_0x27b9('0xb')]);router[_0x27b9('0xc')]('/',auth[_0x27b9('0x6')](),controller[_0x27b9('0xd')]);router['post'](_0x27b9('0xa'),auth[_0x27b9('0x6')](),controller[_0x27b9('0xe')]);router[_0x27b9('0xc')](_0x27b9('0xf'),auth['isAuthenticated'](),controller[_0x27b9('0x10')]);router[_0x27b9('0x11')]('/:id',auth[_0x27b9('0x6')](),controller['update']);router['delete'](_0x27b9('0x8'),auth['isAuthenticated'](),controller[_0x27b9('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 886b358..4ff9857 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 _0xaac0=['STRING','sequelize','exports'];(function(_0x3cd68e,_0x4dbc09){var _0x27d52b=function(_0x1d8994){while(--_0x1d8994){_0x3cd68e['push'](_0x3cd68e['shift']());}};_0x27d52b(++_0x4dbc09);}(_0xaac0,0x18d));var _0x0aac=function(_0xce2ee4,_0x3fe1e1){_0xce2ee4=_0xce2ee4-0x0;var _0x3fd000=_0xaac0[_0xce2ee4];return _0x3fd000;};'use strict';var Sequelize=require(_0x0aac('0x0'));module[_0x0aac('0x1')]={'name':{'type':Sequelize[_0x0aac('0x2')]},'description':{'type':Sequelize[_0x0aac('0x2')]},'interval':{'type':Sequelize[_0x0aac('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1d49=['STRING','exports'];(function(_0x459a04,_0x47d93d){var _0xb4e47=function(_0x442143){while(--_0x442143){_0x459a04['push'](_0x459a04['shift']());}};_0xb4e47(++_0x47d93d);}(_0x1d49,0xc9));var _0x91d4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1d49[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x91d4('0x0')]={'name':{'type':Sequelize[_0x91d4('0x1')]},'description':{'type':Sequelize[_0x91d4('0x1')]},'interval':{'type':Sequelize[_0x91d4('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 e5d1594..cac933a 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 _0x9c0f=['findAll','rows','catch','show','params','includeAll','find','create','body','user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Interval','include'];(function(_0x42b256,_0x4710e0){var _0x1995e4=function(_0x5671e9){while(--_0x5671e9){_0x42b256['push'](_0x42b256['shift']());}};_0x1995e4(++_0x4710e0);}(_0x9c0f,0x1e8));var _0xf9c0=function(_0x264b79,_0xc62859){_0x264b79=_0x264b79-0x0;var _0x548c85=_0x9c0f[_0x264b79];return _0x548c85;};'use strict';var emlformat=require(_0xf9c0('0x0'));var rimraf=require(_0xf9c0('0x1'));var zipdir=require(_0xf9c0('0x2'));var jsonpatch=require(_0xf9c0('0x3'));var rp=require(_0xf9c0('0x4'));var moment=require(_0xf9c0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf9c0('0x6'));var util=require(_0xf9c0('0x7'));var path=require(_0xf9c0('0x8'));var sox=require(_0xf9c0('0x9'));var csv=require(_0xf9c0('0xa'));var ejs=require(_0xf9c0('0xb'));var fs=require('fs');var fs_extra=require(_0xf9c0('0xc'));var _=require(_0xf9c0('0xd'));var squel=require(_0xf9c0('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf9c0('0xf'));var toCsv=require(_0xf9c0('0xa'));var querystring=require(_0xf9c0('0x10'));var Papa=require(_0xf9c0('0x11'));var Redis=require('ioredis');var authService=require(_0xf9c0('0x12'));var qs=require(_0xf9c0('0x13'));var as=require(_0xf9c0('0x14'));var hardwareService=require(_0xf9c0('0x15'));var logger=require(_0xf9c0('0x16'))(_0xf9c0('0x17'));var utils=require('../../config/utils');var config=require(_0xf9c0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9c0('0x19'))['db'];var extensions=require(_0xf9c0('0x1a'));function respondWithStatusCode(_0x471047,_0x5a61da){_0x5a61da=_0x5a61da||0xcc;return function(_0x1a6e19){if(_0x1a6e19){return _0x471047[_0xf9c0('0x1b')](_0x5a61da);}return _0x471047[_0xf9c0('0x1c')](_0x5a61da)['end']();};}function respondWithResult(_0x4136e1,_0x3a96b5){_0x3a96b5=_0x3a96b5||0xc8;return function(_0x27612f){if(_0x27612f){return _0x4136e1[_0xf9c0('0x1c')](_0x3a96b5)['json'](_0x27612f);}};}function respondWithFilteredResult(_0x5239be,_0x51bb82){return function(_0x7484f8){if(_0x7484f8){var _0x4d545d=typeof _0x51bb82[_0xf9c0('0x1d')]===_0xf9c0('0x1e')&&typeof _0x51bb82[_0xf9c0('0x1f')]===_0xf9c0('0x1e');var _0x57b5ff=_0x7484f8[_0xf9c0('0x20')];var _0x296e98=_0x4d545d?0x0:_0x51bb82[_0xf9c0('0x1d')];var _0xc24e1d=_0x4d545d?_0x7484f8[_0xf9c0('0x20')]:_0x51bb82[_0xf9c0('0x1d')]+_0x51bb82[_0xf9c0('0x1f')];var _0x60ea8e;if(_0xc24e1d>=_0x57b5ff){_0xc24e1d=_0x57b5ff;_0x60ea8e=0xc8;}else{_0x60ea8e=0xce;}_0x5239be[_0xf9c0('0x1c')](_0x60ea8e);return _0x5239be[_0xf9c0('0x21')](_0xf9c0('0x22'),_0x296e98+'-'+_0xc24e1d+'/'+_0x57b5ff)[_0xf9c0('0x23')](_0x7484f8);}return null;};}function patchUpdates(_0xf04750){return function(_0x364046){try{jsonpatch[_0xf9c0('0x24')](_0x364046,_0xf04750,!![]);}catch(_0x4cf682){return BPromise['reject'](_0x4cf682);}return _0x364046[_0xf9c0('0x25')]();};}function saveUpdates(_0xcac1ee,_0x3b3775){return function(_0x34c96d){if(_0x34c96d){return _0x34c96d[_0xf9c0('0x26')](_0xcac1ee)[_0xf9c0('0x27')](function(_0x13f5ee){return _0x13f5ee;});}return null;};}function removeEntity(_0x1d8956,_0x30e5a9){return function(_0x1c0d4d){if(_0x1c0d4d){return _0x1c0d4d[_0xf9c0('0x28')]()[_0xf9c0('0x27')](function(){var _0x5416d0=_0x1c0d4d[_0xf9c0('0x29')]({'plain':!![]});var _0x46d0b8='Intervals';return db[_0xf9c0('0x2a')][_0xf9c0('0x28')]({'where':{'type':_0x46d0b8,'resourceId':_0x5416d0['id']}})[_0xf9c0('0x27')](function(){return _0x1c0d4d;});})[_0xf9c0('0x27')](function(){_0x1d8956[_0xf9c0('0x1c')](0xcc)[_0xf9c0('0x2b')]();});}};}function handleEntityNotFound(_0x199e0c,_0x2d9447){return function(_0x2a8c1b){if(!_0x2a8c1b){_0x199e0c[_0xf9c0('0x1b')](0x194);}return _0x2a8c1b;};}function handleError(_0x1dee2a,_0x491caf){_0x491caf=_0x491caf||0x1f4;return function(_0x2c3daf){logger['error'](_0x2c3daf[_0xf9c0('0x2c')]);if(_0x2c3daf[_0xf9c0('0x2d')]){delete _0x2c3daf[_0xf9c0('0x2d')];}_0x1dee2a[_0xf9c0('0x1c')](_0x491caf)['send'](_0x2c3daf);};}exports[_0xf9c0('0x2e')]=function(_0x61d96a,_0x1c7035){var _0x1009f4={},_0x267c8b={},_0x3c9ed0={'count':0x0,'rows':[]};var _0x18af48=_['map'](db['Interval']['rawAttributes'],function(_0x330c8f){return{'name':_0x330c8f[_0xf9c0('0x2f')],'type':_0x330c8f[_0xf9c0('0x30')]['key']};});_0x267c8b[_0xf9c0('0x31')]=_[_0xf9c0('0x32')](_0x18af48,_0xf9c0('0x2d'));_0x267c8b[_0xf9c0('0x33')]=_[_0xf9c0('0x34')](_0x61d96a[_0xf9c0('0x33')]);_0x267c8b['filters']=_[_0xf9c0('0x35')](_0x267c8b[_0xf9c0('0x31')],_0x267c8b['query']);_0x1009f4[_0xf9c0('0x36')]=_[_0xf9c0('0x35')](_0x267c8b[_0xf9c0('0x31')],qs[_0xf9c0('0x37')](_0x61d96a[_0xf9c0('0x33')][_0xf9c0('0x37')]));_0x1009f4[_0xf9c0('0x36')]=_0x1009f4[_0xf9c0('0x36')][_0xf9c0('0x38')]?_0x1009f4['attributes']:_0x267c8b[_0xf9c0('0x31')];if(!_0x61d96a[_0xf9c0('0x33')][_0xf9c0('0x39')](_0xf9c0('0x3a'))){_0x1009f4[_0xf9c0('0x1f')]=qs[_0xf9c0('0x1f')](_0x61d96a[_0xf9c0('0x33')]['limit']);_0x1009f4[_0xf9c0('0x1d')]=qs[_0xf9c0('0x1d')](_0x61d96a[_0xf9c0('0x33')][_0xf9c0('0x1d')]);}_0x1009f4[_0xf9c0('0x3b')]=qs['sort'](_0x61d96a[_0xf9c0('0x33')][_0xf9c0('0x3c')]);_0x1009f4['where']=qs[_0xf9c0('0x3d')](_[_0xf9c0('0x3e')](_0x61d96a[_0xf9c0('0x33')],_0x267c8b[_0xf9c0('0x3d')]),_0x18af48);if(_0x61d96a[_0xf9c0('0x33')][_0xf9c0('0x3f')]){_0x1009f4[_0xf9c0('0x40')]=_[_0xf9c0('0x41')](_0x1009f4['where'],{'$or':_[_0xf9c0('0x32')](_0x18af48,function(_0x47a547){if(_0x47a547[_0xf9c0('0x30')]!==_0xf9c0('0x42')){var _0x4a568d={};_0x4a568d[_0x47a547['name']]={'$like':'%'+_0x61d96a[_0xf9c0('0x33')]['filter']+'%'};return _0x4a568d;}})});}_0x1009f4=_[_0xf9c0('0x41')]({},_0x1009f4,_0x61d96a[_0xf9c0('0x43')]);var _0x5705a2={'where':_0x1009f4[_0xf9c0('0x40')]};return db[_0xf9c0('0x44')][_0xf9c0('0x20')](_0x5705a2)[_0xf9c0('0x27')](function(_0x27341a){_0x3c9ed0['count']=_0x27341a;if(_0x61d96a[_0xf9c0('0x33')]['includeAll']){_0x1009f4[_0xf9c0('0x45')]=[{'all':!![]}];}return db[_0xf9c0('0x44')][_0xf9c0('0x46')](_0x1009f4);})['then'](function(_0x222cda){_0x3c9ed0[_0xf9c0('0x47')]=_0x222cda;return _0x3c9ed0;})['then'](respondWithFilteredResult(_0x1c7035,_0x1009f4))[_0xf9c0('0x48')](handleError(_0x1c7035,null));};exports[_0xf9c0('0x49')]=function(_0x317f77,_0x154986){var _0x33bbd7={'raw':!![],'where':{'id':_0x317f77[_0xf9c0('0x4a')]['id']}},_0x2b4a74={};_0x2b4a74[_0xf9c0('0x31')]=_[_0xf9c0('0x34')](db[_0xf9c0('0x44')]['rawAttributes']);_0x2b4a74[_0xf9c0('0x33')]=_[_0xf9c0('0x34')](_0x317f77['query']);_0x2b4a74['filters']=_[_0xf9c0('0x35')](_0x2b4a74[_0xf9c0('0x31')],_0x2b4a74[_0xf9c0('0x33')]);_0x33bbd7[_0xf9c0('0x36')]=_[_0xf9c0('0x35')](_0x2b4a74['model'],qs[_0xf9c0('0x37')](_0x317f77['query'][_0xf9c0('0x37')]));_0x33bbd7['attributes']=_0x33bbd7[_0xf9c0('0x36')][_0xf9c0('0x38')]?_0x33bbd7[_0xf9c0('0x36')]:_0x2b4a74[_0xf9c0('0x31')];if(_0x317f77['query'][_0xf9c0('0x4b')]){_0x33bbd7[_0xf9c0('0x45')]=[{'all':!![]}];}_0x33bbd7=_[_0xf9c0('0x41')]({},_0x33bbd7,_0x317f77[_0xf9c0('0x43')]);return db['Interval'][_0xf9c0('0x4c')](_0x33bbd7)[_0xf9c0('0x27')](handleEntityNotFound(_0x154986,null))[_0xf9c0('0x27')](respondWithResult(_0x154986,null))[_0xf9c0('0x48')](handleError(_0x154986,null));};exports['create']=function(_0x6892bc,_0x482f4a){return db[_0xf9c0('0x44')][_0xf9c0('0x4d')](_0x6892bc[_0xf9c0('0x4e')],{})[_0xf9c0('0x27')](function(_0x54f040){var _0xc21332=_0x6892bc[_0xf9c0('0x4f')][_0xf9c0('0x29')]({'plain':!![]});if(!_0xc21332)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc21332[_0xf9c0('0x50')]===_0xf9c0('0x4f')){var _0x36c739=_0x54f040['get']({'plain':!![]});var _0x380703=_0xf9c0('0x51');return db[_0xf9c0('0x52')][_0xf9c0('0x4c')]({'where':{'name':_0x380703,'userProfileId':_0xc21332[_0xf9c0('0x53')]},'raw':!![]})[_0xf9c0('0x27')](function(_0x26f5f1){if(_0x26f5f1&&_0x26f5f1[_0xf9c0('0x54')]===0x0){return db['UserProfileResource'][_0xf9c0('0x4d')]({'name':_0x36c739[_0xf9c0('0x2d')],'resourceId':_0x36c739['id'],'type':_0x26f5f1['name'],'sectionId':_0x26f5f1['id']},{})[_0xf9c0('0x27')](function(){return _0x54f040;});}else{return _0x54f040;}})[_0xf9c0('0x48')](function(_0xd7d0bf){logger[_0xf9c0('0x55')](_0xf9c0('0x56'),_0xd7d0bf);throw _0xd7d0bf;});}return _0x54f040;})['then'](respondWithResult(_0x482f4a,0xc9))[_0xf9c0('0x48')](handleError(_0x482f4a,null));};exports[_0xf9c0('0x26')]=function(_0x261e82,_0x4757b1){if(_0x261e82[_0xf9c0('0x4e')]['id']){delete _0x261e82[_0xf9c0('0x4e')]['id'];}return db[_0xf9c0('0x44')]['find']({'where':{'id':_0x261e82['params']['id']}})[_0xf9c0('0x27')](handleEntityNotFound(_0x4757b1,null))[_0xf9c0('0x27')](saveUpdates(_0x261e82['body'],null))[_0xf9c0('0x27')](respondWithResult(_0x4757b1,null))[_0xf9c0('0x48')](handleError(_0x4757b1,null));};exports[_0xf9c0('0x28')]=function(_0x53847f,_0x54f989){return db[_0xf9c0('0x44')]['find']({'where':{'id':_0x53847f[_0xf9c0('0x4a')]['id']}})[_0xf9c0('0x27')](handleEntityNotFound(_0x54f989,null))[_0xf9c0('0x27')](removeEntity(_0x54f989,null))[_0xf9c0('0x48')](handleError(_0x54f989,null));};exports['addInterval']=function(_0x323bac,_0x22b96e,_0x1e7fa6){if(_0x323bac['body']['id']){delete _0x323bac[_0xf9c0('0x4e')]['id'];}return db[_0xf9c0('0x44')]['find']({'where':{'id':_0x323bac[_0xf9c0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x22b96e,null))[_0xf9c0('0x27')](function(_0x43430b){if(_0x43430b){_0x323bac[_0xf9c0('0x4e')]['IntervalId']=_0x43430b['id'];return db[_0xf9c0('0x44')][_0xf9c0('0x4d')](_0x323bac[_0xf9c0('0x4e')]);}})[_0xf9c0('0x27')](respondWithResult(_0x22b96e,null))['catch'](handleError(_0x22b96e,null));};exports['getIntervals']=function(_0x1c0dca,_0x2222fa,_0x20dcab){var _0x25e7a6={};var _0x190c03={};var _0x1aead7;var _0x1d8d26;return db[_0xf9c0('0x44')][_0xf9c0('0x57')]({'where':{'id':_0x1c0dca[_0xf9c0('0x4a')]['id']}})[_0xf9c0('0x27')](handleEntityNotFound(_0x2222fa,null))[_0xf9c0('0x27')](function(_0x1e7bea){if(_0x1e7bea){_0x1aead7=_0x1e7bea;_0x190c03[_0xf9c0('0x31')]=_[_0xf9c0('0x34')](db[_0xf9c0('0x44')]['rawAttributes']);_0x190c03['query']=_[_0xf9c0('0x34')](_0x1c0dca['query']);_0x190c03[_0xf9c0('0x3d')]=_[_0xf9c0('0x35')](_0x190c03[_0xf9c0('0x31')],_0x190c03[_0xf9c0('0x33')]);_0x25e7a6['attributes']=_[_0xf9c0('0x35')](_0x190c03[_0xf9c0('0x31')],qs[_0xf9c0('0x37')](_0x1c0dca[_0xf9c0('0x33')][_0xf9c0('0x37')]));_0x25e7a6[_0xf9c0('0x36')]=_0x25e7a6[_0xf9c0('0x36')][_0xf9c0('0x38')]?_0x25e7a6[_0xf9c0('0x36')]:_0x190c03[_0xf9c0('0x31')];_0x25e7a6[_0xf9c0('0x3b')]=qs[_0xf9c0('0x3c')](_0x1c0dca['query'][_0xf9c0('0x3c')]);_0x25e7a6['where']=qs[_0xf9c0('0x3d')](_[_0xf9c0('0x3e')](_0x1c0dca[_0xf9c0('0x33')],_0x190c03['filters']));if(_0x1c0dca['query'][_0xf9c0('0x3f')]){_0x25e7a6[_0xf9c0('0x40')]=_[_0xf9c0('0x41')](_0x25e7a6[_0xf9c0('0x40')],{'$or':_[_0xf9c0('0x32')](_0x25e7a6[_0xf9c0('0x36')],function(_0x7d92da){var _0x3ddf99={};_0x3ddf99[_0x7d92da]={'$like':'%'+_0x1c0dca[_0xf9c0('0x33')][_0xf9c0('0x3f')]+'%'};return _0x3ddf99;})});}_0x25e7a6=_[_0xf9c0('0x41')]({},_0x25e7a6,_0x1c0dca['options']);return _0x1aead7[_0xf9c0('0x58')](_0x25e7a6);}})['then'](function(_0xb881a){if(_0xb881a){_0x1d8d26=_0xb881a[_0xf9c0('0x38')];if(!_0x1c0dca['query']['hasOwnProperty']('nolimit')){_0x25e7a6[_0xf9c0('0x1f')]=qs[_0xf9c0('0x1f')](_0x1c0dca[_0xf9c0('0x33')]['limit']);_0x25e7a6[_0xf9c0('0x1d')]=qs[_0xf9c0('0x1d')](_0x1c0dca['query'][_0xf9c0('0x1d')]);}return _0x1aead7[_0xf9c0('0x58')](_0x25e7a6);}})[_0xf9c0('0x27')](function(_0x5214d4){if(_0x5214d4){return _0x5214d4?{'count':_0x1d8d26,'rows':_0x5214d4}:null;}})[_0xf9c0('0x27')](respondWithResult(_0x2222fa,null))[_0xf9c0('0x48')](handleError(_0x2222fa,null));};exports[_0xf9c0('0x59')]=function(_0x4245da,_0x563f8b,_0x29eeec){return db[_0xf9c0('0x44')][_0xf9c0('0x57')]({'where':{'id':_0x4245da[_0xf9c0('0x4a')]['id']}})[_0xf9c0('0x27')](handleEntityNotFound(_0x563f8b,null))['then'](function(_0x4fb9ad){if(_0x4fb9ad){return db[_0xf9c0('0x5a')][_0xf9c0('0x5b')](function(_0x2ef6d0){return db[_0xf9c0('0x44')]['destroy']({'where':{'IntervalId':_0x4245da['params']['id']},'transaction':_0x2ef6d0})[_0xf9c0('0x27')](function(_0x1429db){var _0xde9e2e=_['map'](_0x4245da[_0xf9c0('0x4e')],function(_0x42bd55){delete _0x42bd55['id'];_0x42bd55['IntervalId']=_0x4245da[_0xf9c0('0x4a')]['id'];return _0x42bd55;});return db[_0xf9c0('0x44')][_0xf9c0('0x5c')](_0xde9e2e,{'transaction':_0x2ef6d0});});})['then'](function(){return db[_0xf9c0('0x44')][_0xf9c0('0x46')]({'where':{'IntervalId':_0x4245da[_0xf9c0('0x4a')]['id']}});});}})[_0xf9c0('0x27')](respondWithResult(_0x563f8b,null))[_0xf9c0('0x48')](handleError(_0x563f8b,null));}; \ No newline at end of file +var _0xf699=['lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','map','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Interval','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','rawAttributes','pick','addIntervals','sequelize','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra'];(function(_0x4eec46,_0x513505){var _0x125ca7=function(_0x6cdfb6){while(--_0x6cdfb6){_0x4eec46['push'](_0x4eec46['shift']());}};_0x125ca7(++_0x513505);}(_0xf699,0xac));var _0x9f69=function(_0x41da14,_0x2ef581){_0x41da14=_0x41da14-0x0;var _0x12acc5=_0xf699[_0x41da14];return _0x12acc5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f69('0x0'));var zipdir=require(_0x9f69('0x1'));var jsonpatch=require(_0x9f69('0x2'));var rp=require(_0x9f69('0x3'));var moment=require(_0x9f69('0x4'));var BPromise=require(_0x9f69('0x5'));var Mustache=require('mustache');var util=require(_0x9f69('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f69('0x7'));var _=require(_0x9f69('0x8'));var squel=require(_0x9f69('0x9'));var crypto=require(_0x9f69('0xa'));var jsforce=require(_0x9f69('0xb'));var deskjs=require(_0x9f69('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9f69('0xd'));var qs=require(_0x9f69('0xe'));var as=require(_0x9f69('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f69('0x10'))(_0x9f69('0x11'));var utils=require('../../config/utils');var config=require(_0x9f69('0x12'));var licenseUtil=require(_0x9f69('0x13'));var db=require(_0x9f69('0x14'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x5385ea,_0x4397eb){_0x4397eb=_0x4397eb||0xcc;return function(_0x3b7474){if(_0x3b7474){return _0x5385ea[_0x9f69('0x15')](_0x4397eb);}return _0x5385ea['status'](_0x4397eb)[_0x9f69('0x16')]();};}function respondWithResult(_0x3532ca,_0x5607d1){_0x5607d1=_0x5607d1||0xc8;return function(_0x517ffd){if(_0x517ffd){return _0x3532ca[_0x9f69('0x17')](_0x5607d1)[_0x9f69('0x18')](_0x517ffd);}};}function respondWithFilteredResult(_0x7a33e0,_0x9e1d55){return function(_0x14cf6a){if(_0x14cf6a){var _0x33b02c=typeof _0x9e1d55['offset']===_0x9f69('0x19')&&typeof _0x9e1d55[_0x9f69('0x1a')]===_0x9f69('0x19');var _0x3bf003=_0x14cf6a[_0x9f69('0x1b')];var _0x570411=_0x33b02c?0x0:_0x9e1d55['offset'];var _0xba0a0b=_0x33b02c?_0x14cf6a[_0x9f69('0x1b')]:_0x9e1d55[_0x9f69('0x1c')]+_0x9e1d55[_0x9f69('0x1a')];var _0xdc54d9;if(_0xba0a0b>=_0x3bf003){_0xba0a0b=_0x3bf003;_0xdc54d9=0xc8;}else{_0xdc54d9=0xce;}_0x7a33e0[_0x9f69('0x17')](_0xdc54d9);return _0x7a33e0[_0x9f69('0x1d')](_0x9f69('0x1e'),_0x570411+'-'+_0xba0a0b+'/'+_0x3bf003)[_0x9f69('0x18')](_0x14cf6a);}return null;};}function patchUpdates(_0x175652){return function(_0x252d46){try{jsonpatch[_0x9f69('0x1f')](_0x252d46,_0x175652,!![]);}catch(_0x166a11){return BPromise[_0x9f69('0x20')](_0x166a11);}return _0x252d46['save']();};}function saveUpdates(_0x5516ef,_0x31cf8d){return function(_0x564545){if(_0x564545){return _0x564545['update'](_0x5516ef)[_0x9f69('0x21')](function(_0xbdf7c1){return _0xbdf7c1;});}return null;};}function removeEntity(_0x3254d4,_0x470e08){return function(_0xc5226){if(_0xc5226){return _0xc5226[_0x9f69('0x22')]()['then'](function(){var _0x5aaadf=_0xc5226[_0x9f69('0x23')]({'plain':!![]});var _0x97acb3='Intervals';return db[_0x9f69('0x24')][_0x9f69('0x22')]({'where':{'type':_0x97acb3,'resourceId':_0x5aaadf['id']}})[_0x9f69('0x21')](function(){return _0xc5226;});})['then'](function(){_0x3254d4[_0x9f69('0x17')](0xcc)[_0x9f69('0x16')]();});}};}function handleEntityNotFound(_0xfd4269,_0xf209f0){return function(_0x1e0e32){if(!_0x1e0e32){_0xfd4269[_0x9f69('0x15')](0x194);}return _0x1e0e32;};}function handleError(_0x1494bc,_0x305ff7){_0x305ff7=_0x305ff7||0x1f4;return function(_0x1d7fb5){logger[_0x9f69('0x25')](_0x1d7fb5[_0x9f69('0x26')]);if(_0x1d7fb5[_0x9f69('0x27')]){delete _0x1d7fb5[_0x9f69('0x27')];}_0x1494bc[_0x9f69('0x17')](_0x305ff7)[_0x9f69('0x28')](_0x1d7fb5);};}exports['index']=function(_0x8ff0b6,_0x5b58e7){var _0x2454c6={},_0x43bb7e={},_0x4c7689={'count':0x0,'rows':[]};var _0x444b6c=_[_0x9f69('0x29')](db['Interval']['rawAttributes'],function(_0x1f71be){return{'name':_0x1f71be[_0x9f69('0x2a')],'type':_0x1f71be['type']['key']};});_0x43bb7e[_0x9f69('0x2b')]=_['map'](_0x444b6c,'name');_0x43bb7e[_0x9f69('0x2c')]=_[_0x9f69('0x2d')](_0x8ff0b6[_0x9f69('0x2c')]);_0x43bb7e[_0x9f69('0x2e')]=_[_0x9f69('0x2f')](_0x43bb7e[_0x9f69('0x2b')],_0x43bb7e[_0x9f69('0x2c')]);_0x2454c6['attributes']=_[_0x9f69('0x2f')](_0x43bb7e[_0x9f69('0x2b')],qs['fields'](_0x8ff0b6[_0x9f69('0x2c')][_0x9f69('0x30')]));_0x2454c6[_0x9f69('0x31')]=_0x2454c6[_0x9f69('0x31')][_0x9f69('0x32')]?_0x2454c6[_0x9f69('0x31')]:_0x43bb7e[_0x9f69('0x2b')];if(!_0x8ff0b6[_0x9f69('0x2c')][_0x9f69('0x33')](_0x9f69('0x34'))){_0x2454c6[_0x9f69('0x1a')]=qs['limit'](_0x8ff0b6[_0x9f69('0x2c')]['limit']);_0x2454c6[_0x9f69('0x1c')]=qs[_0x9f69('0x1c')](_0x8ff0b6[_0x9f69('0x2c')]['offset']);}_0x2454c6[_0x9f69('0x35')]=qs[_0x9f69('0x36')](_0x8ff0b6[_0x9f69('0x2c')]['sort']);_0x2454c6[_0x9f69('0x37')]=qs[_0x9f69('0x2e')](_['pick'](_0x8ff0b6['query'],_0x43bb7e['filters']),_0x444b6c);if(_0x8ff0b6['query'][_0x9f69('0x38')]){_0x2454c6[_0x9f69('0x37')]=_[_0x9f69('0x39')](_0x2454c6['where'],{'$or':_['map'](_0x444b6c,function(_0x280296){if(_0x280296[_0x9f69('0x3a')]!==_0x9f69('0x3b')){var _0xd81cc2={};_0xd81cc2[_0x280296[_0x9f69('0x27')]]={'$like':'%'+_0x8ff0b6[_0x9f69('0x2c')]['filter']+'%'};return _0xd81cc2;}})});}_0x2454c6=_[_0x9f69('0x39')]({},_0x2454c6,_0x8ff0b6[_0x9f69('0x3c')]);var _0x265afe={'where':_0x2454c6[_0x9f69('0x37')]};return db[_0x9f69('0x3d')][_0x9f69('0x1b')](_0x265afe)[_0x9f69('0x21')](function(_0x5b08d1){_0x4c7689[_0x9f69('0x1b')]=_0x5b08d1;if(_0x8ff0b6[_0x9f69('0x2c')][_0x9f69('0x3e')]){_0x2454c6[_0x9f69('0x3f')]=[{'all':!![]}];}return db[_0x9f69('0x3d')][_0x9f69('0x40')](_0x2454c6);})[_0x9f69('0x21')](function(_0x236f45){_0x4c7689[_0x9f69('0x41')]=_0x236f45;return _0x4c7689;})[_0x9f69('0x21')](respondWithFilteredResult(_0x5b58e7,_0x2454c6))[_0x9f69('0x42')](handleError(_0x5b58e7,null));};exports[_0x9f69('0x43')]=function(_0x646fa7,_0x16aaa2){var _0x24da97={'raw':!![],'where':{'id':_0x646fa7[_0x9f69('0x44')]['id']}},_0x368c66={};_0x368c66[_0x9f69('0x2b')]=_['keys'](db['Interval']['rawAttributes']);_0x368c66[_0x9f69('0x2c')]=_[_0x9f69('0x2d')](_0x646fa7[_0x9f69('0x2c')]);_0x368c66[_0x9f69('0x2e')]=_[_0x9f69('0x2f')](_0x368c66[_0x9f69('0x2b')],_0x368c66[_0x9f69('0x2c')]);_0x24da97[_0x9f69('0x31')]=_[_0x9f69('0x2f')](_0x368c66[_0x9f69('0x2b')],qs[_0x9f69('0x30')](_0x646fa7[_0x9f69('0x2c')][_0x9f69('0x30')]));_0x24da97[_0x9f69('0x31')]=_0x24da97[_0x9f69('0x31')][_0x9f69('0x32')]?_0x24da97['attributes']:_0x368c66[_0x9f69('0x2b')];if(_0x646fa7[_0x9f69('0x2c')][_0x9f69('0x3e')]){_0x24da97[_0x9f69('0x3f')]=[{'all':!![]}];}_0x24da97=_[_0x9f69('0x39')]({},_0x24da97,_0x646fa7[_0x9f69('0x3c')]);return db[_0x9f69('0x3d')][_0x9f69('0x45')](_0x24da97)[_0x9f69('0x21')](handleEntityNotFound(_0x16aaa2,null))[_0x9f69('0x21')](respondWithResult(_0x16aaa2,null))[_0x9f69('0x42')](handleError(_0x16aaa2,null));};exports[_0x9f69('0x46')]=function(_0xc89364,_0x159689){return db[_0x9f69('0x3d')][_0x9f69('0x46')](_0xc89364[_0x9f69('0x47')],{})[_0x9f69('0x21')](function(_0x208496){var _0x5dd292=_0xc89364[_0x9f69('0x48')][_0x9f69('0x23')]({'plain':!![]});if(!_0x5dd292)throw new Error(_0x9f69('0x49'));if(_0x5dd292[_0x9f69('0x4a')]==='user'){var _0x405068=_0x208496[_0x9f69('0x23')]({'plain':!![]});var _0x2c85c3=_0x9f69('0x4b');return db[_0x9f69('0x4c')][_0x9f69('0x45')]({'where':{'name':_0x2c85c3,'userProfileId':_0x5dd292[_0x9f69('0x4d')]},'raw':!![]})[_0x9f69('0x21')](function(_0x2434b2){if(_0x2434b2&&_0x2434b2[_0x9f69('0x4e')]===0x0){return db[_0x9f69('0x24')][_0x9f69('0x46')]({'name':_0x405068[_0x9f69('0x27')],'resourceId':_0x405068['id'],'type':_0x2434b2[_0x9f69('0x27')],'sectionId':_0x2434b2['id']},{})[_0x9f69('0x21')](function(){return _0x208496;});}else{return _0x208496;}})[_0x9f69('0x42')](function(_0x2309b1){logger['error'](_0x9f69('0x4f'),_0x2309b1);throw _0x2309b1;});}return _0x208496;})[_0x9f69('0x21')](respondWithResult(_0x159689,0xc9))['catch'](handleError(_0x159689,null));};exports[_0x9f69('0x50')]=function(_0x1c95b3,_0x4d3c84){if(_0x1c95b3[_0x9f69('0x47')]['id']){delete _0x1c95b3[_0x9f69('0x47')]['id'];}return db[_0x9f69('0x3d')][_0x9f69('0x45')]({'where':{'id':_0x1c95b3[_0x9f69('0x44')]['id']}})[_0x9f69('0x21')](handleEntityNotFound(_0x4d3c84,null))['then'](saveUpdates(_0x1c95b3[_0x9f69('0x47')],null))[_0x9f69('0x21')](respondWithResult(_0x4d3c84,null))[_0x9f69('0x42')](handleError(_0x4d3c84,null));};exports[_0x9f69('0x22')]=function(_0x169132,_0x5e1986){return db[_0x9f69('0x3d')][_0x9f69('0x45')]({'where':{'id':_0x169132[_0x9f69('0x44')]['id']}})[_0x9f69('0x21')](handleEntityNotFound(_0x5e1986,null))[_0x9f69('0x21')](removeEntity(_0x5e1986,null))[_0x9f69('0x42')](handleError(_0x5e1986,null));};exports[_0x9f69('0x51')]=function(_0x421354,_0x2d3117,_0x3a38fd){if(_0x421354[_0x9f69('0x47')]['id']){delete _0x421354['body']['id'];}return db[_0x9f69('0x3d')][_0x9f69('0x45')]({'where':{'id':_0x421354[_0x9f69('0x44')]['id']}})[_0x9f69('0x21')](handleEntityNotFound(_0x2d3117,null))[_0x9f69('0x21')](function(_0x5a39a5){if(_0x5a39a5){_0x421354[_0x9f69('0x47')][_0x9f69('0x52')]=_0x5a39a5['id'];return db[_0x9f69('0x3d')][_0x9f69('0x46')](_0x421354['body']);}})[_0x9f69('0x21')](respondWithResult(_0x2d3117,null))[_0x9f69('0x42')](handleError(_0x2d3117,null));};exports[_0x9f69('0x53')]=function(_0x5fb1dc,_0x19938d,_0x4a32f2){var _0x90a424={};var _0x15e11c={};var _0x4a9695;var _0x532a12;return db[_0x9f69('0x3d')][_0x9f69('0x54')]({'where':{'id':_0x5fb1dc['params']['id']}})[_0x9f69('0x21')](handleEntityNotFound(_0x19938d,null))['then'](function(_0x5849b4){if(_0x5849b4){_0x4a9695=_0x5849b4;_0x15e11c['model']=_[_0x9f69('0x2d')](db[_0x9f69('0x3d')][_0x9f69('0x55')]);_0x15e11c[_0x9f69('0x2c')]=_['keys'](_0x5fb1dc[_0x9f69('0x2c')]);_0x15e11c[_0x9f69('0x2e')]=_['intersection'](_0x15e11c['model'],_0x15e11c['query']);_0x90a424[_0x9f69('0x31')]=_['intersection'](_0x15e11c[_0x9f69('0x2b')],qs[_0x9f69('0x30')](_0x5fb1dc[_0x9f69('0x2c')][_0x9f69('0x30')]));_0x90a424['attributes']=_0x90a424[_0x9f69('0x31')]['length']?_0x90a424['attributes']:_0x15e11c[_0x9f69('0x2b')];_0x90a424[_0x9f69('0x35')]=qs[_0x9f69('0x36')](_0x5fb1dc[_0x9f69('0x2c')][_0x9f69('0x36')]);_0x90a424['where']=qs[_0x9f69('0x2e')](_[_0x9f69('0x56')](_0x5fb1dc[_0x9f69('0x2c')],_0x15e11c[_0x9f69('0x2e')]));if(_0x5fb1dc['query']['filter']){_0x90a424['where']=_['merge'](_0x90a424[_0x9f69('0x37')],{'$or':_[_0x9f69('0x29')](_0x90a424[_0x9f69('0x31')],function(_0x5953f5){var _0x26597a={};_0x26597a[_0x5953f5]={'$like':'%'+_0x5fb1dc[_0x9f69('0x2c')][_0x9f69('0x38')]+'%'};return _0x26597a;})});}_0x90a424=_[_0x9f69('0x39')]({},_0x90a424,_0x5fb1dc['options']);return _0x4a9695[_0x9f69('0x53')](_0x90a424);}})[_0x9f69('0x21')](function(_0x421f3d){if(_0x421f3d){_0x532a12=_0x421f3d[_0x9f69('0x32')];if(!_0x5fb1dc[_0x9f69('0x2c')][_0x9f69('0x33')](_0x9f69('0x34'))){_0x90a424[_0x9f69('0x1a')]=qs[_0x9f69('0x1a')](_0x5fb1dc[_0x9f69('0x2c')][_0x9f69('0x1a')]);_0x90a424[_0x9f69('0x1c')]=qs['offset'](_0x5fb1dc['query']['offset']);}return _0x4a9695[_0x9f69('0x53')](_0x90a424);}})[_0x9f69('0x21')](function(_0x4de2e1){if(_0x4de2e1){return _0x4de2e1?{'count':_0x532a12,'rows':_0x4de2e1}:null;}})[_0x9f69('0x21')](respondWithResult(_0x19938d,null))[_0x9f69('0x42')](handleError(_0x19938d,null));};exports[_0x9f69('0x57')]=function(_0x4641fd,_0xee1edc,_0x12521b){return db[_0x9f69('0x3d')]['findOne']({'where':{'id':_0x4641fd[_0x9f69('0x44')]['id']}})['then'](handleEntityNotFound(_0xee1edc,null))[_0x9f69('0x21')](function(_0x3bb957){if(_0x3bb957){return db[_0x9f69('0x58')]['transaction'](function(_0x14aef5){return db[_0x9f69('0x3d')][_0x9f69('0x22')]({'where':{'IntervalId':_0x4641fd[_0x9f69('0x44')]['id']},'transaction':_0x14aef5})[_0x9f69('0x21')](function(_0x107c19){var _0x2c547b=_[_0x9f69('0x29')](_0x4641fd['body'],function(_0x2ac93d){delete _0x2ac93d['id'];_0x2ac93d[_0x9f69('0x52')]=_0x4641fd[_0x9f69('0x44')]['id'];return _0x2ac93d;});return db[_0x9f69('0x3d')][_0x9f69('0x59')](_0x2c547b,{'transaction':_0x14aef5});});})['then'](function(){return db[_0x9f69('0x3d')][_0x9f69('0x40')]({'where':{'IntervalId':_0x4641fd[_0x9f69('0x44')]['id']}});});}})[_0x9f69('0x21')](respondWithResult(_0xee1edc,null))[_0x9f69('0x42')](handleError(_0xee1edc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6753d52..52d0596 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 _0x13ec=['tools_intervals','rewrite','string','interval','getIntervals','then','all','map','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports'];(function(_0xeeb8e9,_0x24debf){var _0x4d6d14=function(_0x485221){while(--_0x485221){_0xeeb8e9['push'](_0xeeb8e9['shift']());}};_0x4d6d14(++_0x24debf);}(_0x13ec,0xa3));var _0xc13e=function(_0x25b563,_0x1c4ac1){_0x25b563=_0x25b563-0x0;var _0x327204=_0x13ec[_0x25b563];return _0x327204;};'use strict';var attributes=require(_0xc13e('0x0'));var extensions=require(_0xc13e('0x1'));var iftime=require(_0xc13e('0x2'))[_0xc13e('0x3')];module[_0xc13e('0x4')]=function(_0x35243f){return _0x35243f['define']('Interval',attributes,{'tableName':_0xc13e('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37ee37){extensions['rewrite'](_0x35243f,_0x37ee37);},'afterBulkCreate':function(_0x5aae4b,_0x1fe702,_0x4d5f57){_0x4d5f57();extensions['rewrite'](_0x35243f,_0x5aae4b[0x0]);},'afterUpdate':function(_0x5c071f){extensions[_0xc13e('0x6')](_0x35243f,_0x5c071f);},'afterDestroy':function(_0x1b8e3c){extensions['rewrite'](_0x35243f,_0x1b8e3c);}},'instanceMethods':{'ifTime':function(_0x5dae76=undefined,_0x432580=new Date()){if(typeof this['interval']===_0xc13e('0x7')){return iftime(this[_0xc13e('0x8')],_0x5dae76,_0x432580);}else{return this[_0xc13e('0x9')]()[_0xc13e('0xa')](function(_0x233ebe){return Promise[_0xc13e('0xb')](_0x233ebe[_0xc13e('0xc')](function(_0x2d31e8){return _0x2d31e8['ifTime'](_0x5dae76,_0x432580);}));})[_0xc13e('0xa')](function(_0x202a3d){return _0x202a3d[_0xc13e('0xd')](function(_0x107a4f,_0x12e1ac){return _0x107a4f||_0x12e1ac;},![]);});}}}});}; \ No newline at end of file +var _0xdec2=['../../components/extensions/rewrite','../../utils/iftime','iftime','rewrite','string','getIntervals','then','map','ifTime','reduce','./interval.attributes'];(function(_0x53a2a4,_0x2258f5){var _0x2d42ca=function(_0x167e27){while(--_0x167e27){_0x53a2a4['push'](_0x53a2a4['shift']());}};_0x2d42ca(++_0x2258f5);}(_0xdec2,0xfc));var _0x2dec=function(_0x2e8b01,_0x38b147){_0x2e8b01=_0x2e8b01-0x0;var _0x200785=_0xdec2[_0x2e8b01];return _0x200785;};'use strict';var attributes=require(_0x2dec('0x0'));var extensions=require(_0x2dec('0x1'));var iftime=require(_0x2dec('0x2'))[_0x2dec('0x3')];module['exports']=function(_0x96023e){return _0x96023e['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a0d94){extensions[_0x2dec('0x4')](_0x96023e,_0x5a0d94);},'afterBulkCreate':function(_0x4cc6b4,_0xe9d7c9,_0x74c5fd){_0x74c5fd();extensions[_0x2dec('0x4')](_0x96023e,_0x4cc6b4[0x0]);},'afterUpdate':function(_0x4d9c23){extensions['rewrite'](_0x96023e,_0x4d9c23);},'afterDestroy':function(_0x4f068b){extensions[_0x2dec('0x4')](_0x96023e,_0x4f068b);}},'instanceMethods':{'ifTime':function(_0x3e1d36=undefined,_0x2408ce=new Date()){if(typeof this['interval']===_0x2dec('0x5')){return iftime(this['interval'],_0x3e1d36,_0x2408ce);}else{return this[_0x2dec('0x6')]()[_0x2dec('0x7')](function(_0x41856c){return Promise['all'](_0x41856c[_0x2dec('0x8')](function(_0x1c4b6a){return _0x1c4b6a[_0x2dec('0x9')](_0x3e1d36,_0x2408ce);}));})[_0x2dec('0x7')](function(_0x40b6b5){return _0x40b6b5[_0x2dec('0xa')](function(_0x46a512,_0x5bed33){return _0x46a512||_0x5bed33;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 042e252..3f235bd 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 _0x4b7d=['../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','raw','options','attributes','limit','include','map','model','then','info','debug','catch','error','message','ShowInterval','where','stringify','findAll','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','reduce','util'];(function(_0x5cd7a3,_0x1aa14f){var _0x21235d=function(_0x3152a9){while(--_0x3152a9){_0x5cd7a3['push'](_0x5cd7a3['shift']());}};_0x21235d(++_0x1aa14f);}(_0x4b7d,0xab));var _0xd4b7=function(_0x40952b,_0x1872a1){_0x40952b=_0x40952b-0x0;var _0x420324=_0x4b7d[_0x40952b];return _0x420324;};'use strict';var _=require('lodash');var util=require(_0xd4b7('0x0'));var db=require(_0xd4b7('0x1'))['db'];var iftime=require(_0xd4b7('0x2'))[_0xd4b7('0x3')];var logger=require(_0xd4b7('0x4'))(_0xd4b7('0x5'));exports[_0xd4b7('0x6')]=function(_0x42a52f){var _0x44fa60=this;return new Promise(function(_0x493ac3,_0x10e29e){return db[_0xd4b7('0x7')]['findAll']({'raw':_0x42a52f['options']?_0x42a52f['options'][_0xd4b7('0x8')]===undefined?!![]:![]:!![],'where':_0x42a52f[_0xd4b7('0x9')]?_0x42a52f['options']['where']||null:null,'attributes':_0x42a52f[_0xd4b7('0x9')]?_0x42a52f[_0xd4b7('0x9')][_0xd4b7('0xa')]||null:null,'limit':_0x42a52f[_0xd4b7('0x9')]?_0x42a52f[_0xd4b7('0x9')][_0xd4b7('0xb')]||null:null,'include':_0x42a52f['options']?_0x42a52f['options'][_0xd4b7('0xc')]?_[_0xd4b7('0xd')](_0x42a52f[_0xd4b7('0x9')]['include'],function(_0x114909){return{'model':db[_0x114909['model']],'as':_0x114909['as'],'attributes':_0x114909[_0xd4b7('0xa')],'include':_0x114909[_0xd4b7('0xc')]?_[_0xd4b7('0xd')](_0x114909[_0xd4b7('0xc')],function(_0x58d541){return{'model':db[_0x58d541['model']],'as':_0x58d541['as'],'attributes':_0x58d541[_0xd4b7('0xa')],'include':_0x58d541[_0xd4b7('0xc')]?_[_0xd4b7('0xd')](_0x58d541[_0xd4b7('0xc')],function(_0x3b1317){return{'model':db[_0x3b1317[_0xd4b7('0xe')]],'as':_0x3b1317['as'],'attributes':_0x3b1317[_0xd4b7('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd4b7('0xf')](function(_0x30866c){logger[_0xd4b7('0x10')](_0xd4b7('0x6'),_0x42a52f);logger[_0xd4b7('0x11')](_0xd4b7('0x6'),_0x42a52f,JSON['stringify'](_0x30866c));_0x493ac3(_0x30866c);})[_0xd4b7('0x12')](function(_0x139d89){logger[_0xd4b7('0x13')]('GetInterval',_0x139d89['message'],_0x42a52f);_0x10e29e(_0x44fa60[_0xd4b7('0x13')](0x1f4,_0x139d89[_0xd4b7('0x14')]));});});};exports[_0xd4b7('0x15')]=function(_0x58394f){var _0x42697c=this;return new Promise(function(_0x45588f,_0x176fa9){return db['Interval']['find']({'raw':_0x58394f[_0xd4b7('0x9')]?_0x58394f[_0xd4b7('0x9')][_0xd4b7('0x8')]===undefined?!![]:![]:!![],'where':_0x58394f['options']?_0x58394f[_0xd4b7('0x9')][_0xd4b7('0x16')]||null:null,'attributes':_0x58394f[_0xd4b7('0x9')]?_0x58394f[_0xd4b7('0x9')][_0xd4b7('0xa')]||null:null,'include':_0x58394f['options']?_0x58394f[_0xd4b7('0x9')][_0xd4b7('0xc')]?_[_0xd4b7('0xd')](_0x58394f['options']['include'],function(_0x144e93){return{'model':db[_0x144e93[_0xd4b7('0xe')]],'as':_0x144e93['as'],'attributes':_0x144e93[_0xd4b7('0xa')],'include':_0x144e93[_0xd4b7('0xc')]?_[_0xd4b7('0xd')](_0x144e93[_0xd4b7('0xc')],function(_0x4adb7c){return{'model':db[_0x4adb7c[_0xd4b7('0xe')]],'as':_0x4adb7c['as'],'attributes':_0x4adb7c[_0xd4b7('0xa')],'include':_0x4adb7c['include']?_[_0xd4b7('0xd')](_0x4adb7c[_0xd4b7('0xc')],function(_0x56b44b){return{'model':db[_0x56b44b[_0xd4b7('0xe')]],'as':_0x56b44b['as'],'attributes':_0x56b44b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55fd33){logger[_0xd4b7('0x10')](_0xd4b7('0x15'),_0x58394f);logger['debug']('ShowInterval',_0x58394f,JSON[_0xd4b7('0x17')](_0x55fd33));_0x45588f(_0x55fd33);})[_0xd4b7('0x12')](function(_0x294cef){logger[_0xd4b7('0x13')](_0xd4b7('0x15'),_0x294cef[_0xd4b7('0x14')],_0x58394f);_0x176fa9(_0x42697c[_0xd4b7('0x13')](0x1f4,_0x294cef[_0xd4b7('0x14')]));});});};function checkArrayOfIntervals(_0x34903d,_0x449d41){var _0x3ecc0a=[];return db[_0xd4b7('0x7')][_0xd4b7('0x18')]({'where':{'id':_0x34903d}})['then'](function(_0x3cacc9){_0x3ecc0a=_0x3cacc9;return Promise['all'](_0x3ecc0a[_0xd4b7('0xd')](function(_0x53e0f8){return _0x53e0f8[_0xd4b7('0x19')](_0x449d41);}));})['then'](function(_0x4db748){var _0x21c92e=_0x4db748['reduce'](function(_0x31de23,_0x55977b){return _0x31de23||_0x55977b;},![]);logger[_0xd4b7('0x10')](util[_0xd4b7('0x1a')](_0xd4b7('0x1b'),_0x3ecc0a[_0xd4b7('0xd')](function(_0x318000){return _0x318000[_0xd4b7('0x1c')];})[_0xd4b7('0x1d')](',\x20'),_0x3ecc0a[_0xd4b7('0xd')](function(_0x38d62f){return _0x38d62f['id'];})[_0xd4b7('0x1d')](',\x20')));return _0x21c92e;});}function checkSingleInterval(_0x3e89dd,_0x208aa6){return db[_0xd4b7('0x7')][_0xd4b7('0x1e')](_0x3e89dd)['then'](function(_0x56c8f8){if(_0x56c8f8){logger[_0xd4b7('0x10')](util[_0xd4b7('0x1a')](_0xd4b7('0x1f'),_0x56c8f8[_0xd4b7('0x1c')],_0x56c8f8['id']));return _0x56c8f8['ifTime'](_0x208aa6);}});}exports[_0xd4b7('0x20')]=function(_0x5006f0){var _0x116215=_0x5006f0['intervalIds'];var _0x335e85=Array[_0xd4b7('0x21')](_0x5006f0['intervals'])?_0x5006f0[_0xd4b7('0x22')]:typeof _0x5006f0[_0xd4b7('0x22')]===_0xd4b7('0x23')?[_0x5006f0[_0xd4b7('0x22')]]:[];var _0x38f148=_0x5006f0[_0xd4b7('0x24')]||undefined;var _0x425f32=![];if(_0x335e85[_0xd4b7('0x25')]){logger['info'](util['format'](_0xd4b7('0x26'),_0x335e85[_0xd4b7('0x1d')](';\x20')));}if(_0x38f148){logger['info'](util[_0xd4b7('0x1a')](_0xd4b7('0x27'),_0x38f148));}logger[_0xd4b7('0x11')](_0xd4b7('0x28'),_0x425f32);logger['silly'](_0xd4b7('0x20'),_0x5006f0);return Promise[_0xd4b7('0x29')]()['then'](function(){if(Array[_0xd4b7('0x21')](_0x116215)){return checkArrayOfIntervals(_0x116215,_0x38f148);}else if(_0x116215){return checkSingleInterval(_0x116215,_0x38f148);}})[_0xd4b7('0xf')](function(_0x2d7c8e){var _0x2d5cb7=_0x335e85[_0xd4b7('0x2a')](function(_0x3f0b0a,_0x5d0c77){return _0x3f0b0a||iftime(_0x5d0c77,_0x38f148);},![]);_0x425f32=_0x2d7c8e||_0x2d5cb7;return _0x425f32;})['catch'](function(_0xb4751b){logger['error'](_0xd4b7('0x20'),_0x5006f0,_0xb4751b);throw this[_0xd4b7('0x13')](0x1f4,_0xb4751b[_0xd4b7('0x14')]);});}; \ No newline at end of file +var _0x78e7=['stringify','catch','error','message','ShowInterval','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','ifTime','intervalIds','intervals','string','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','isArray','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','raw','options','where','attributes','limit','include','model','map','then','info','debug'];(function(_0x4443d2,_0x3290b0){var _0x31d0b6=function(_0x1aa6ce){while(--_0x1aa6ce){_0x4443d2['push'](_0x4443d2['shift']());}};_0x31d0b6(++_0x3290b0);}(_0x78e7,0x191));var _0x778e=function(_0x285ee9,_0x1711c0){_0x285ee9=_0x285ee9-0x0;var _0x1a9e22=_0x78e7[_0x285ee9];return _0x1a9e22;};'use strict';var _=require('lodash');var util=require(_0x778e('0x0'));var db=require(_0x778e('0x1'))['db'];var iftime=require(_0x778e('0x2'))[_0x778e('0x3')];var logger=require('../../config/logger')(_0x778e('0x4'));exports[_0x778e('0x5')]=function(_0x177422){var _0x161fe8=this;return new Promise(function(_0x16b40e,_0x1f1944){return db[_0x778e('0x6')][_0x778e('0x7')]({'raw':_0x177422['options']?_0x177422['options'][_0x778e('0x8')]===undefined?!![]:![]:!![],'where':_0x177422[_0x778e('0x9')]?_0x177422['options'][_0x778e('0xa')]||null:null,'attributes':_0x177422[_0x778e('0x9')]?_0x177422[_0x778e('0x9')][_0x778e('0xb')]||null:null,'limit':_0x177422['options']?_0x177422['options'][_0x778e('0xc')]||null:null,'include':_0x177422[_0x778e('0x9')]?_0x177422[_0x778e('0x9')][_0x778e('0xd')]?_['map'](_0x177422[_0x778e('0x9')][_0x778e('0xd')],function(_0x59c3fc){return{'model':db[_0x59c3fc[_0x778e('0xe')]],'as':_0x59c3fc['as'],'attributes':_0x59c3fc['attributes'],'include':_0x59c3fc[_0x778e('0xd')]?_[_0x778e('0xf')](_0x59c3fc['include'],function(_0x30fad4){return{'model':db[_0x30fad4[_0x778e('0xe')]],'as':_0x30fad4['as'],'attributes':_0x30fad4['attributes'],'include':_0x30fad4['include']?_[_0x778e('0xf')](_0x30fad4[_0x778e('0xd')],function(_0x5129e9){return{'model':db[_0x5129e9['model']],'as':_0x5129e9['as'],'attributes':_0x5129e9[_0x778e('0xb')]};}):[]};}):[]};}):[]:[]})[_0x778e('0x10')](function(_0x5c2f0b){logger[_0x778e('0x11')](_0x778e('0x5'),_0x177422);logger[_0x778e('0x12')]('GetInterval',_0x177422,JSON[_0x778e('0x13')](_0x5c2f0b));_0x16b40e(_0x5c2f0b);})[_0x778e('0x14')](function(_0x2a5306){logger[_0x778e('0x15')]('GetInterval',_0x2a5306[_0x778e('0x16')],_0x177422);_0x1f1944(_0x161fe8['error'](0x1f4,_0x2a5306[_0x778e('0x16')]));});});};exports[_0x778e('0x17')]=function(_0x135f39){var _0x58c04b=this;return new Promise(function(_0x5ced03,_0x5d187a){return db[_0x778e('0x6')]['find']({'raw':_0x135f39['options']?_0x135f39[_0x778e('0x9')][_0x778e('0x8')]===undefined?!![]:![]:!![],'where':_0x135f39[_0x778e('0x9')]?_0x135f39[_0x778e('0x9')]['where']||null:null,'attributes':_0x135f39['options']?_0x135f39[_0x778e('0x9')][_0x778e('0xb')]||null:null,'include':_0x135f39[_0x778e('0x9')]?_0x135f39['options'][_0x778e('0xd')]?_['map'](_0x135f39[_0x778e('0x9')]['include'],function(_0x1419f1){return{'model':db[_0x1419f1[_0x778e('0xe')]],'as':_0x1419f1['as'],'attributes':_0x1419f1[_0x778e('0xb')],'include':_0x1419f1[_0x778e('0xd')]?_[_0x778e('0xf')](_0x1419f1['include'],function(_0x5b013e){return{'model':db[_0x5b013e['model']],'as':_0x5b013e['as'],'attributes':_0x5b013e[_0x778e('0xb')],'include':_0x5b013e[_0x778e('0xd')]?_[_0x778e('0xf')](_0x5b013e[_0x778e('0xd')],function(_0x18c4fb){return{'model':db[_0x18c4fb['model']],'as':_0x18c4fb['as'],'attributes':_0x18c4fb[_0x778e('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29de42){logger['info']('ShowInterval',_0x135f39);logger['debug'](_0x778e('0x17'),_0x135f39,JSON[_0x778e('0x13')](_0x29de42));_0x5ced03(_0x29de42);})[_0x778e('0x14')](function(_0xbbb264){logger['error'](_0x778e('0x17'),_0xbbb264[_0x778e('0x16')],_0x135f39);_0x5d187a(_0x58c04b[_0x778e('0x15')](0x1f4,_0xbbb264[_0x778e('0x16')]));});});};function checkArrayOfIntervals(_0x2895b1,_0x57f2a6){var _0x261294=[];return db[_0x778e('0x6')][_0x778e('0x7')]({'where':{'id':_0x2895b1}})['then'](function(_0x5a8b0e){_0x261294=_0x5a8b0e;return Promise[_0x778e('0x18')](_0x261294[_0x778e('0xf')](function(_0x35b963){return _0x35b963['ifTime'](_0x57f2a6);}));})[_0x778e('0x10')](function(_0x41bf8e){var _0x5ec3c8=_0x41bf8e[_0x778e('0x19')](function(_0x4a15a1,_0x3e22ce){return _0x4a15a1||_0x3e22ce;},![]);logger[_0x778e('0x11')](util[_0x778e('0x1a')](_0x778e('0x1b'),_0x261294[_0x778e('0xf')](function(_0x22b559){return _0x22b559[_0x778e('0x1c')];})[_0x778e('0x1d')](',\x20'),_0x261294[_0x778e('0xf')](function(_0xb1d59c){return _0xb1d59c['id'];})['join'](',\x20')));return _0x5ec3c8;});}function checkSingleInterval(_0x57bfad,_0x560d96){return db[_0x778e('0x6')][_0x778e('0x1e')](_0x57bfad)[_0x778e('0x10')](function(_0x5659f5){if(_0x5659f5){logger['info'](util[_0x778e('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x5659f5['name'],_0x5659f5['id']));return _0x5659f5[_0x778e('0x1f')](_0x560d96);}});}exports['IntervalIftime']=function(_0x23a017){var _0x2b1091=_0x23a017[_0x778e('0x20')];var _0x4d779d=Array['isArray'](_0x23a017[_0x778e('0x21')])?_0x23a017[_0x778e('0x21')]:typeof _0x23a017[_0x778e('0x21')]===_0x778e('0x22')?[_0x23a017['intervals']]:[];var _0x576c4d=_0x23a017['timezone']||undefined;var _0x8d5c1=![];if(_0x4d779d[_0x778e('0x23')]){logger['info'](util[_0x778e('0x1a')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x4d779d[_0x778e('0x1d')](';\x20')));}if(_0x576c4d){logger[_0x778e('0x11')](util[_0x778e('0x1a')](_0x778e('0x24'),_0x576c4d));}logger[_0x778e('0x12')](_0x778e('0x25'),_0x8d5c1);logger[_0x778e('0x26')](_0x778e('0x27'),_0x23a017);return Promise[_0x778e('0x28')]()['then'](function(){if(Array[_0x778e('0x29')](_0x2b1091)){return checkArrayOfIntervals(_0x2b1091,_0x576c4d);}else if(_0x2b1091){return checkSingleInterval(_0x2b1091,_0x576c4d);}})[_0x778e('0x10')](function(_0x1ebabf){var _0x442df2=_0x4d779d[_0x778e('0x19')](function(_0x56bd90,_0x23c0d4){return _0x56bd90||iftime(_0x23c0d4,_0x576c4d);},![]);_0x8d5c1=_0x1ebabf||_0x442df2;return _0x8d5c1;})[_0x778e('0x14')](function(_0x200ed3){logger[_0x778e('0x15')](_0x778e('0x27'),_0x23a017,_0x200ed3);throw this[_0x778e('0x15')](0x1f4,_0x200ed3[_0x778e('0x16')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b6f004e..ff1557f 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f0f2c,_0x9817bf){_0x5f0f2c=_0x5f0f2c-0x0;var _0x104e69=_0xb10b[_0x5f0f2c];return _0x104e69;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x5e4c19,_0x28006b){var _0x4451ac=function(_0x1102f4){while(--_0x1102f4){_0x5e4c19['push'](_0x5e4c19['shift']());}};_0x4451ac(++_0x28006b);}(_0x2ef3,0xba));var _0x32ef=function(_0x356fb1,_0xa86f8f){_0x356fb1=_0x356fb1-0x0;var _0x5ab84c=_0x2ef3[_0x356fb1];return _0x5ab84c;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6878103..683e77a 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 _0x8b7a=['MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','setEncoding','utf8','data','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x8b7a,0xe1));var _0xa8b7=function(_0x4a78fb,_0x21ef49){_0x4a78fb=_0x4a78fb-0x0;var _0x45b341=_0x8b7a[_0x4a78fb];return _0x45b341;};'use strict';var BPromise=require(_0xa8b7('0x0'));var https=require(_0xa8b7('0x1'));var logger=require(_0xa8b7('0x2'))('api');var USERNAME=_0xa8b7('0x3');var PASSWORD=_0xa8b7('0x4');function openIssue(_0x13925e,_0x3ad802){var _0x452b33={'fields':{'project':{'key':_0x13925e['key']||_0xa8b7('0x5')},'summary':(_0x13925e[_0xa8b7('0x6')]||_0xa8b7('0x7'))+_0xa8b7('0x8')+_0x13925e['ip'],'description':_0x13925e[_0xa8b7('0x9')]||JSON[_0xa8b7('0xa')](_0x13925e),'issuetype':{'name':_0x13925e[_0xa8b7('0xb')]||_0xa8b7('0xc')}}};_0x452b33[_0xa8b7('0xd')][_0xa8b7('0xe')]=_0x13925e[_0xa8b7('0xf')];_0x452b33[_0xa8b7('0xd')][_0xa8b7('0x10')]=_0x13925e[_0xa8b7('0x11')];_0x452b33['fields']['customfield_11502']=_0x13925e[_0xa8b7('0x12')];_0x452b33['fields']['customfield_11503']=_0x13925e[_0xa8b7('0x13')];_0x452b33[_0xa8b7('0xd')][_0xa8b7('0x14')]=_0x13925e[_0xa8b7('0x15')];_0x452b33[_0xa8b7('0xd')][_0xa8b7('0x16')]=_0x13925e['ip'];var _0x106eeb={'host':_0xa8b7('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xa8b7('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xa8b7('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa8b7('0x1a')](_0xa8b7('0x1b'))}};var _0x1e8f4f=JSON[_0xa8b7('0xa')](_0x452b33);var _0x1c7130=https['request'](_0x106eeb,function(_0x135cc2){_0x135cc2[_0xa8b7('0x1c')](_0xa8b7('0x1d'));var _0x2b9b60='';_0x135cc2['on'](_0xa8b7('0x1e'),function(_0x386718){_0x2b9b60+=_0x386718;});_0x135cc2['on']('end',function(){if(_0x3ad802){return _0x3ad802[_0xa8b7('0x1f')](_0x135cc2[_0xa8b7('0x20')])['json'](JSON[_0xa8b7('0x21')](_0x2b9b60));}});});_0x1c7130['on']('error',function(_0x586d0e){if(_0x3ad802){return _0x3ad802[_0xa8b7('0x1f')](0x1f4)[_0xa8b7('0x22')]({'errors':[{'message':_0xa8b7('0x23'),'type':_0xa8b7('0x24')}]});}});_0x1c7130[_0xa8b7('0x25')](_0x1e8f4f);_0x1c7130[_0xa8b7('0x26')]();}exports[_0xa8b7('0x27')]=openIssue;exports[_0xa8b7('0x28')]=function(_0x5c96ab,_0x29ca12){_0x5c96ab[_0xa8b7('0x29')]['ip']=_0x5c96ab['headers'][_0xa8b7('0x2a')]||_0x5c96ab[_0xa8b7('0x2b')][_0xa8b7('0x2c')]||_0x5c96ab[_0xa8b7('0x2d')]['remoteAddress']||_0x5c96ab[_0xa8b7('0x2b')]['socket'][_0xa8b7('0x2c')];return openIssue(_0x5c96ab[_0xa8b7('0x29')],_0x29ca12);}; \ No newline at end of file +var _0x520b=['x-forwarded-for','connection','socket','remoteAddress','https','../../config/logger','api','support','key','MOTGUI','summary','Report','stringify','issuetype','Bug','customfield_11500','customfield_11501','fields','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','setEncoding','utf8','data','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x520b,0x15c));var _0xb520=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x520b[_0x4defd6];return _0x4c9276;};'use strict';var BPromise=require('bluebird');var https=require(_0xb520('0x0'));var logger=require(_0xb520('0x1'))(_0xb520('0x2'));var USERNAME=_0xb520('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x46ac3f,_0x45f765){var _0x5063e9={'fields':{'project':{'key':_0x46ac3f[_0xb520('0x4')]||_0xb520('0x5')},'summary':(_0x46ac3f[_0xb520('0x6')]||_0xb520('0x7'))+'\x20from\x20'+_0x46ac3f['ip'],'description':_0x46ac3f['description']||JSON[_0xb520('0x8')](_0x46ac3f),'issuetype':{'name':_0x46ac3f[_0xb520('0x9')]||_0xb520('0xa')}}};_0x5063e9['fields'][_0xb520('0xb')]=_0x46ac3f['email'];_0x5063e9['fields'][_0xb520('0xc')]=_0x46ac3f['oldToken'];_0x5063e9[_0xb520('0xd')]['customfield_11502']=_0x46ac3f[_0xb520('0xe')];_0x5063e9[_0xb520('0xd')][_0xb520('0xf')]=_0x46ac3f[_0xb520('0x10')];_0x5063e9[_0xb520('0xd')][_0xb520('0x11')]=_0x46ac3f[_0xb520('0x12')];_0x5063e9['fields'][_0xb520('0x13')]=_0x46ac3f['ip'];var _0x46ddd7={'host':_0xb520('0x14'),'port':0x1bb,'path':_0xb520('0x15'),'method':_0xb520('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xb520('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xb520('0x18')](_0xb520('0x19'))}};var _0xb494c1=JSON[_0xb520('0x8')](_0x5063e9);var _0x59f331=https['request'](_0x46ddd7,function(_0x17ba30){_0x17ba30[_0xb520('0x1a')](_0xb520('0x1b'));var _0x418c3a='';_0x17ba30['on'](_0xb520('0x1c'),function(_0x526e3a){_0x418c3a+=_0x526e3a;});_0x17ba30['on'](_0xb520('0x1d'),function(){if(_0x45f765){return _0x45f765[_0xb520('0x1e')](_0x17ba30['statusCode'])[_0xb520('0x1f')](JSON[_0xb520('0x20')](_0x418c3a));}});});_0x59f331['on']('error',function(_0x2d7400){if(_0x45f765){return _0x45f765[_0xb520('0x1e')](0x1f4)[_0xb520('0x1f')]({'errors':[{'message':_0xb520('0x21'),'type':_0xb520('0x22')}]});}});_0x59f331['write'](_0xb494c1);_0x59f331[_0xb520('0x1d')]();}exports[_0xb520('0x23')]=openIssue;exports[_0xb520('0x24')]=function(_0x42fad7,_0x1a97c5){_0x42fad7[_0xb520('0x25')]['ip']=_0x42fad7[_0xb520('0x26')][_0xb520('0x27')]||_0x42fad7[_0xb520('0x28')]['remoteAddress']||_0x42fad7['socket']['remoteAddress']||_0x42fad7[_0xb520('0x28')][_0xb520('0x29')][_0xb520('0x2a')];return openIssue(_0x42fad7[_0xb520('0x25')],_0x1a97c5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 99cd251..7766175 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(_0x5ef405,_0x36c147){var _0xdadafd=function(_0x47437d){while(--_0x47437d){_0x5ef405['push'](_0x5ef405['shift']());}};_0xdadafd(++_0x36c147);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x29d4e5,_0x4cdef2){var _0x34e48b=function(_0x2af478){while(--_0x2af478){_0x29d4e5['push'](_0x29d4e5['shift']());}};_0x34e48b(++_0x4cdef2);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0xf3cd[_0x2b0f81];return _0x5ce74c;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 49ebabd..5b07420 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x246971,_0x53f6a6){_0x246971=_0x246971-0x0;var _0x22e7f5=_0x7a54[_0x246971];return _0x22e7f5;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x3b88bd,_0x3da0e5){_0x3b88bd=_0x3b88bd-0x0;var _0x39838b=_0x7a54[_0x3b88bd];return _0x39838b;};'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 13a348d..918cf31 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 _0x6b8f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','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','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x37e97a,_0x1bc8c0){_0x37e97a=_0x37e97a-0x0;var _0x1cbced=_0x6b8f[_0x37e97a];return _0x1cbced;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));};exports['describe']=function(_0x55c392,_0x22c1eb){return db[_0xf6b8('0x25')][_0xf6b8('0x45')]()[_0xf6b8('0x1f')](respondWithResult(_0x22c1eb,null))['catch'](handleError(_0x22c1eb,null));}; \ No newline at end of file +var _0xb194=['moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','params','merge','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x1aafc8,_0x30336d){var _0xc2006d=function(_0x4c3c13){while(--_0x4c3c13){_0x1aafc8['push'](_0x1aafc8['shift']());}};_0xc2006d(++_0x30336d);}(_0xb194,0x1b2));var _0x4b19=function(_0xeb3257,_0xfa4e63){_0xeb3257=_0xeb3257-0x0;var _0x426c59=_0xb194[_0xeb3257];return _0x426c59;};'use strict';var emlformat=require(_0x4b19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b19('0x1'));var jsonpatch=require(_0x4b19('0x2'));var rp=require(_0x4b19('0x3'));var moment=require(_0x4b19('0x4'));var BPromise=require(_0x4b19('0x5'));var Mustache=require('mustache');var util=require(_0x4b19('0x6'));var path=require(_0x4b19('0x7'));var sox=require('sox');var csv=require(_0x4b19('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b19('0x9'));var _=require('lodash');var squel=require(_0x4b19('0xa'));var crypto=require(_0x4b19('0xb'));var jsforce=require(_0x4b19('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b19('0xd'));var Papa=require('papaparse');var Redis=require(_0x4b19('0xe'));var authService=require(_0x4b19('0xf'));var qs=require(_0x4b19('0x10'));var as=require(_0x4b19('0x11'));var hardwareService=require(_0x4b19('0x12'));var logger=require(_0x4b19('0x13'))(_0x4b19('0x14'));var utils=require(_0x4b19('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4b19('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5be1b2,_0x1ba972){_0x1ba972=_0x1ba972||0xcc;return function(_0x5167ae){if(_0x5167ae){return _0x5be1b2[_0x4b19('0x17')](_0x1ba972);}return _0x5be1b2['status'](_0x1ba972)[_0x4b19('0x18')]();};}function respondWithResult(_0x820063,_0x317d3b){_0x317d3b=_0x317d3b||0xc8;return function(_0x3a3af4){if(_0x3a3af4){return _0x820063[_0x4b19('0x19')](_0x317d3b)['json'](_0x3a3af4);}};}function respondWithFilteredResult(_0xcaaaf6,_0xffedd7){return function(_0x17c334){if(_0x17c334){var _0x3a19cf=typeof _0xffedd7[_0x4b19('0x1a')]===_0x4b19('0x1b')&&typeof _0xffedd7['limit']===_0x4b19('0x1b');var _0xd3f210=_0x17c334[_0x4b19('0x1c')];var _0xe7696a=_0x3a19cf?0x0:_0xffedd7[_0x4b19('0x1a')];var _0x17c7da=_0x3a19cf?_0x17c334[_0x4b19('0x1c')]:_0xffedd7[_0x4b19('0x1a')]+_0xffedd7['limit'];var _0x28a433;if(_0x17c7da>=_0xd3f210){_0x17c7da=_0xd3f210;_0x28a433=0xc8;}else{_0x28a433=0xce;}_0xcaaaf6['status'](_0x28a433);return _0xcaaaf6[_0x4b19('0x1d')](_0x4b19('0x1e'),_0xe7696a+'-'+_0x17c7da+'/'+_0xd3f210)[_0x4b19('0x1f')](_0x17c334);}return null;};}function patchUpdates(_0x2f2082){return function(_0x37cb0a){try{jsonpatch[_0x4b19('0x20')](_0x37cb0a,_0x2f2082,!![]);}catch(_0x56b421){return BPromise[_0x4b19('0x21')](_0x56b421);}return _0x37cb0a['save']();};}function saveUpdates(_0x19db04,_0x10d407){return function(_0x234632){if(_0x234632){return _0x234632['update'](_0x19db04)[_0x4b19('0x22')](function(_0x52e144){return _0x52e144;});}return null;};}function removeEntity(_0x313108,_0x18d376){return function(_0x53f903){if(_0x53f903){return _0x53f903[_0x4b19('0x23')]()[_0x4b19('0x22')](function(){_0x313108[_0x4b19('0x19')](0xcc)[_0x4b19('0x18')]();});}};}function handleEntityNotFound(_0x4c5f27,_0x12c4ac){return function(_0x4ceba3){if(!_0x4ceba3){_0x4c5f27['sendStatus'](0x194);}return _0x4ceba3;};}function handleError(_0x1d5fea,_0x5a84a2){_0x5a84a2=_0x5a84a2||0x1f4;return function(_0x294372){logger[_0x4b19('0x24')](_0x294372[_0x4b19('0x25')]);if(_0x294372[_0x4b19('0x26')]){delete _0x294372['name'];}_0x1d5fea[_0x4b19('0x19')](_0x5a84a2)[_0x4b19('0x27')](_0x294372);};}exports['index']=function(_0x2e1fab,_0x3bcc26){var _0x37d99b={},_0x5aec18={},_0x5240f9={'count':0x0,'rows':[]};var _0x160071=_[_0x4b19('0x28')](db[_0x4b19('0x29')][_0x4b19('0x2a')],function(_0x1d63a3){return{'name':_0x1d63a3['fieldName'],'type':_0x1d63a3[_0x4b19('0x2b')][_0x4b19('0x2c')]};});_0x5aec18[_0x4b19('0x2d')]=_[_0x4b19('0x28')](_0x160071,_0x4b19('0x26'));_0x5aec18[_0x4b19('0x2e')]=_[_0x4b19('0x2f')](_0x2e1fab[_0x4b19('0x2e')]);_0x5aec18[_0x4b19('0x30')]=_[_0x4b19('0x31')](_0x5aec18[_0x4b19('0x2d')],_0x5aec18[_0x4b19('0x2e')]);_0x37d99b['attributes']=_[_0x4b19('0x31')](_0x5aec18['model'],qs[_0x4b19('0x32')](_0x2e1fab[_0x4b19('0x2e')]['fields']));_0x37d99b[_0x4b19('0x33')]=_0x37d99b[_0x4b19('0x33')][_0x4b19('0x34')]?_0x37d99b[_0x4b19('0x33')]:_0x5aec18[_0x4b19('0x2d')];if(!_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x35')](_0x4b19('0x36'))){_0x37d99b[_0x4b19('0x37')]=qs[_0x4b19('0x37')](_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x37')]);_0x37d99b[_0x4b19('0x1a')]=qs['offset'](_0x2e1fab[_0x4b19('0x2e')]['offset']);}_0x37d99b['order']=qs[_0x4b19('0x38')](_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x38')]);_0x37d99b[_0x4b19('0x39')]=qs[_0x4b19('0x30')](_[_0x4b19('0x3a')](_0x2e1fab[_0x4b19('0x2e')],_0x5aec18[_0x4b19('0x30')]),_0x160071);if(_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x3b')]){_0x37d99b[_0x4b19('0x39')]=_['merge'](_0x37d99b[_0x4b19('0x39')],{'$or':_[_0x4b19('0x28')](_0x160071,function(_0x4c770a){if(_0x4c770a['type']!==_0x4b19('0x3c')){var _0x43a277={};_0x43a277[_0x4c770a[_0x4b19('0x26')]]={'$like':'%'+_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x3b')]+'%'};return _0x43a277;}})});}_0x37d99b=_['merge']({},_0x37d99b,_0x2e1fab['options']);var _0xfd7c70={'where':_0x37d99b[_0x4b19('0x39')]};return db[_0x4b19('0x29')][_0x4b19('0x1c')](_0xfd7c70)[_0x4b19('0x22')](function(_0x277a54){_0x5240f9[_0x4b19('0x1c')]=_0x277a54;if(_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x3d')]){_0x37d99b[_0x4b19('0x3e')]=[{'all':!![]}];}return db[_0x4b19('0x29')][_0x4b19('0x3f')](_0x37d99b);})[_0x4b19('0x22')](function(_0x516999){_0x5240f9[_0x4b19('0x40')]=_0x516999;return _0x5240f9;})[_0x4b19('0x22')](respondWithFilteredResult(_0x3bcc26,_0x37d99b))[_0x4b19('0x41')](handleError(_0x3bcc26,null));};exports['show']=function(_0x77640a,_0x372fdc){var _0x5fab72={'raw':!![],'where':{'id':_0x77640a[_0x4b19('0x42')]['id']}},_0x30023b={};_0x30023b['model']=_[_0x4b19('0x2f')](db['JscriptyAnswerReport'][_0x4b19('0x2a')]);_0x30023b[_0x4b19('0x2e')]=_[_0x4b19('0x2f')](_0x77640a['query']);_0x30023b[_0x4b19('0x30')]=_[_0x4b19('0x31')](_0x30023b[_0x4b19('0x2d')],_0x30023b[_0x4b19('0x2e')]);_0x5fab72['attributes']=_['intersection'](_0x30023b['model'],qs[_0x4b19('0x32')](_0x77640a[_0x4b19('0x2e')][_0x4b19('0x32')]));_0x5fab72['attributes']=_0x5fab72[_0x4b19('0x33')]['length']?_0x5fab72[_0x4b19('0x33')]:_0x30023b[_0x4b19('0x2d')];if(_0x77640a[_0x4b19('0x2e')][_0x4b19('0x3d')]){_0x5fab72[_0x4b19('0x3e')]=[{'all':!![]}];}_0x5fab72=_[_0x4b19('0x43')]({},_0x5fab72,_0x77640a['options']);return db[_0x4b19('0x29')][_0x4b19('0x44')](_0x5fab72)[_0x4b19('0x22')](handleEntityNotFound(_0x372fdc,null))[_0x4b19('0x22')](respondWithResult(_0x372fdc,null))[_0x4b19('0x41')](handleError(_0x372fdc,null));};exports['create']=function(_0x52da1b,_0x20b465){return db[_0x4b19('0x29')][_0x4b19('0x45')](_0x52da1b[_0x4b19('0x46')],{})['then'](respondWithResult(_0x20b465,0xc9))['catch'](handleError(_0x20b465,null));};exports[_0x4b19('0x47')]=function(_0xe70530,_0x53b0df){if(_0xe70530['body']['id']){delete _0xe70530[_0x4b19('0x46')]['id'];}return db[_0x4b19('0x29')][_0x4b19('0x44')]({'where':{'id':_0xe70530[_0x4b19('0x42')]['id']}})[_0x4b19('0x22')](handleEntityNotFound(_0x53b0df,null))['then'](saveUpdates(_0xe70530[_0x4b19('0x46')],null))[_0x4b19('0x22')](respondWithResult(_0x53b0df,null))['catch'](handleError(_0x53b0df,null));};exports[_0x4b19('0x23')]=function(_0x4314ff,_0x5a9e77){return db[_0x4b19('0x29')][_0x4b19('0x44')]({'where':{'id':_0x4314ff[_0x4b19('0x42')]['id']}})[_0x4b19('0x22')](handleEntityNotFound(_0x5a9e77,null))[_0x4b19('0x22')](removeEntity(_0x5a9e77,null))[_0x4b19('0x41')](handleError(_0x5a9e77,null));};exports[_0x4b19('0x48')]=function(_0x1436c7,_0x10cc59){return db[_0x4b19('0x29')][_0x4b19('0x48')]()[_0x4b19('0x22')](respondWithResult(_0x10cc59,null))['catch'](handleError(_0x10cc59,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3daf20f..ebd2c4b 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 _0xd8e4=['bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment'];(function(_0x28430c,_0x9686de){var _0x4d7e54=function(_0xeb1fe3){while(--_0xeb1fe3){_0x28430c['push'](_0x28430c['shift']());}};_0x4d7e54(++_0x9686de);}(_0xd8e4,0x188));var _0x4d8e=function(_0x4150e8,_0x5b86c6){_0x4150e8=_0x4150e8-0x0;var _0x2ba282=_0xd8e4[_0x4150e8];return _0x2ba282;};'use strict';var _=require(_0x4d8e('0x0'));var util=require(_0x4d8e('0x1'));var logger=require(_0x4d8e('0x2'))('api');var moment=require(_0x4d8e('0x3'));var BPromise=require(_0x4d8e('0x4'));var rp=require(_0x4d8e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d8e('0x6'));var config=require(_0x4d8e('0x7'));var attributes=require(_0x4d8e('0x8'));module['exports']=function(_0x319062,_0x5a151f){return _0x319062[_0x4d8e('0x9')](_0x4d8e('0xa'),attributes,{'tableName':_0x4d8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46fe=['bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x1bbce7,_0x581b65){var _0xe3a3ef=function(_0x58c0c7){while(--_0x58c0c7){_0x1bbce7['push'](_0x1bbce7['shift']());}};_0xe3a3ef(++_0x581b65);}(_0x46fe,0xa4));var _0xe46f=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x46fe[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0xe46f('0x0'));var util=require(_0xe46f('0x1'));var logger=require(_0xe46f('0x2'))(_0xe46f('0x3'));var moment=require(_0xe46f('0x4'));var BPromise=require(_0xe46f('0x5'));var rp=require(_0xe46f('0x6'));var fs=require('fs');var path=require(_0xe46f('0x7'));var rimraf=require('rimraf');var config=require(_0xe46f('0x8'));var attributes=require(_0xe46f('0x9'));module[_0xe46f('0xa')]=function(_0x4adad5,_0x5c8ddc){return _0x4adad5[_0xe46f('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0xe46f('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 38fa443..5a9f598 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 _0xf255=['request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x447ff6,_0x589527){var _0x1be7cb=function(_0x8666d5){while(--_0x8666d5){_0x447ff6['push'](_0x447ff6['shift']());}};_0x1be7cb(++_0x589527);}(_0xf255,0x156));var _0x5f25=function(_0x55661f,_0x586bee){_0x55661f=_0x55661f-0x0;var _0xd65f4a=_0xf255[_0x55661f];return _0xd65f4a;};'use strict';var _=require(_0x5f25('0x0'));var util=require(_0x5f25('0x1'));var moment=require(_0x5f25('0x2'));var BPromise=require(_0x5f25('0x3'));var rs=require(_0x5f25('0x4'));var fs=require('fs');var Redis=require(_0x5f25('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f25('0x6'));var logger=require('../../config/logger')(_0x5f25('0x7'));var config=require(_0x5f25('0x8'));var jayson=require(_0x5f25('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1654e5,_0x365c81,_0x387133){return new BPromise(function(_0x183a56,_0x3d6470){return client[_0x5f25('0xa')](_0x1654e5,_0x387133)[_0x5f25('0xb')](function(_0x1895e3){logger['info'](_0x5f25('0xc'),_0x365c81,_0x5f25('0xd'));logger[_0x5f25('0xe')](_0x5f25('0xf'),_0x365c81,_0x5f25('0xd'),JSON[_0x5f25('0x10')](_0x1895e3));if(_0x1895e3['error']){if(_0x1895e3['error'][_0x5f25('0x11')]===0x1f4){logger[_0x5f25('0x12')](_0x5f25('0xc'),_0x365c81,_0x1895e3['error'][_0x5f25('0x13')]);return _0x3d6470(_0x1895e3[_0x5f25('0x12')][_0x5f25('0x13')]);}logger['error'](_0x5f25('0xc'),_0x365c81,_0x1895e3['error'][_0x5f25('0x13')]);return _0x183a56(_0x1895e3[_0x5f25('0x12')][_0x5f25('0x13')]);}else{logger['info'](_0x5f25('0xc'),_0x365c81,'request\x20sent');_0x183a56(_0x1895e3[_0x5f25('0x14')][_0x5f25('0x13')]);}})[_0x5f25('0x15')](function(_0x281f60){logger[_0x5f25('0x12')](_0x5f25('0xc'),_0x365c81,_0x281f60);_0x3d6470(_0x281f60);});});} \ No newline at end of file +var _0xc917=['debug','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3f38b0,_0x38ba25){var _0x475fd9=function(_0x4d9ccf){while(--_0x4d9ccf){_0x3f38b0['push'](_0x3f38b0['shift']());}};_0x475fd9(++_0x38ba25);}(_0xc917,0xcf));var _0x7c91=function(_0x27998f,_0x3caf38){_0x27998f=_0x27998f-0x0;var _0x21b0ad=_0xc917[_0x27998f];return _0x21b0ad;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7c91('0x0'));var rs=require(_0x7c91('0x1'));var fs=require('fs');var Redis=require(_0x7c91('0x2'));var db=require(_0x7c91('0x3'))['db'];var utils=require(_0x7c91('0x4'));var logger=require(_0x7c91('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c91('0x6'));var client=jayson['client'][_0x7c91('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x41e7fe,_0x1033be,_0x5a8677){return new BPromise(function(_0x2dbe77,_0x5a1454){return client[_0x7c91('0x8')](_0x41e7fe,_0x5a8677)[_0x7c91('0x9')](function(_0x176807){logger[_0x7c91('0xa')](_0x7c91('0xb'),_0x1033be,_0x7c91('0xc'));logger[_0x7c91('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1033be,_0x7c91('0xc'),JSON[_0x7c91('0xe')](_0x176807));if(_0x176807[_0x7c91('0xf')]){if(_0x176807['error'][_0x7c91('0x10')]===0x1f4){logger[_0x7c91('0xf')](_0x7c91('0xb'),_0x1033be,_0x176807['error'][_0x7c91('0x11')]);return _0x5a1454(_0x176807['error'][_0x7c91('0x11')]);}logger['error'](_0x7c91('0xb'),_0x1033be,_0x176807[_0x7c91('0xf')][_0x7c91('0x11')]);return _0x2dbe77(_0x176807['error'][_0x7c91('0x11')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1033be,'request\x20sent');_0x2dbe77(_0x176807[_0x7c91('0x12')]['message']);}})[_0x7c91('0x13')](function(_0x1e931a){logger['error'](_0x7c91('0xb'),_0x1033be,_0x1e931a);_0x5a1454(_0x1e931a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index a16c7b6..f7368da 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 _0xc9b5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','post','create','clone','put','update','delete','destroy','exports','path','connect-timeout','Router'];(function(_0xd3838f,_0x10a0cc){var _0x8c073b=function(_0x389c82){while(--_0x389c82){_0xd3838f['push'](_0xd3838f['shift']());}};_0x8c073b(++_0x10a0cc);}(_0xc9b5,0x1bf));var _0x5c9b=function(_0x7cb764,_0x417900){_0x7cb764=_0x7cb764-0x0;var _0x37714b=_0xc9b5[_0x7cb764];return _0x37714b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c9b('0x0'));var timeout=require(_0x5c9b('0x1'));var express=require('express');var router=express[_0x5c9b('0x2')]();var fs_extra=require(_0x5c9b('0x3'));var auth=require(_0x5c9b('0x4'));var interaction=require(_0x5c9b('0x5'));var config=require(_0x5c9b('0x6'));var controller=require('./jscriptyProject.controller');router[_0x5c9b('0x7')]('/',auth[_0x5c9b('0x8')](),controller[_0x5c9b('0x9')]);router[_0x5c9b('0x7')](_0x5c9b('0xa'),auth['isAuthenticated'](),controller[_0x5c9b('0xb')]);router[_0x5c9b('0x7')](_0x5c9b('0xc'),auth['isAuthenticated'](),controller[_0x5c9b('0xd')]);router[_0x5c9b('0x7')](_0x5c9b('0xe'),auth[_0x5c9b('0x8')](),controller[_0x5c9b('0xf')]);router['get'](_0x5c9b('0x10'),auth[_0x5c9b('0x8')](),timeout('30s'),controller['getSummary']);router[_0x5c9b('0x11')]('/',auth[_0x5c9b('0x8')](),controller[_0x5c9b('0x12')]);router['post']('/:id/clone',auth[_0x5c9b('0x8')](),controller[_0x5c9b('0x13')]);router[_0x5c9b('0x14')]('/:id',auth[_0x5c9b('0x8')](),controller[_0x5c9b('0x15')]);router[_0x5c9b('0x16')]('/:id',auth[_0x5c9b('0x8')](),controller[_0x5c9b('0x17')]);module[_0x5c9b('0x18')]=router; \ No newline at end of file +var _0x41ef=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','delete','destroy'];(function(_0x972b1a,_0x441730){var _0x388a8e=function(_0x19bf91){while(--_0x19bf91){_0x972b1a['push'](_0x972b1a['shift']());}};_0x388a8e(++_0x441730);}(_0x41ef,0x196));var _0xf41e=function(_0x3b6598,_0x26a880){_0x3b6598=_0x3b6598-0x0;var _0x1f12f1=_0x41ef[_0x3b6598];return _0x1f12f1;};'use strict';var multer=require(_0xf41e('0x0'));var util=require('util');var path=require(_0xf41e('0x1'));var timeout=require(_0xf41e('0x2'));var express=require(_0xf41e('0x3'));var router=express[_0xf41e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf41e('0x5'));var interaction=require(_0xf41e('0x6'));var config=require(_0xf41e('0x7'));var controller=require(_0xf41e('0x8'));router[_0xf41e('0x9')]('/',auth[_0xf41e('0xa')](),controller[_0xf41e('0xb')]);router[_0xf41e('0x9')](_0xf41e('0xc'),auth['isAuthenticated'](),controller[_0xf41e('0xd')]);router[_0xf41e('0x9')](_0xf41e('0xe'),auth[_0xf41e('0xa')](),controller['getSessions']);router[_0xf41e('0x9')](_0xf41e('0xf'),auth['isAuthenticated'](),controller[_0xf41e('0x10')]);router[_0xf41e('0x9')](_0xf41e('0x11'),auth[_0xf41e('0xa')](),timeout(_0xf41e('0x12')),controller[_0xf41e('0x13')]);router[_0xf41e('0x14')]('/',auth[_0xf41e('0xa')](),controller[_0xf41e('0x15')]);router[_0xf41e('0x14')](_0xf41e('0x16'),auth[_0xf41e('0xa')](),controller[_0xf41e('0x17')]);router['put'](_0xf41e('0xc'),auth[_0xf41e('0xa')](),controller['update']);router[_0xf41e('0x18')]('/:id',auth[_0xf41e('0xa')](),controller[_0xf41e('0x19')]);module[_0xf41e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 60bbeb7..e25dba5 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 _0xe59a=['exports','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify','format','getDataValue','BOOLEAN','sequelize'];(function(_0x52ef03,_0x498331){var _0x2182ac=function(_0x1026b4){while(--_0x1026b4){_0x52ef03['push'](_0x52ef03['shift']());}};_0x2182ac(++_0x498331);}(_0xe59a,0xd7));var _0xae59=function(_0x1607aa,_0x11cbb4){_0x1607aa=_0x1607aa-0x0;var _0x386193=_0xe59a[_0x1607aa];return _0x386193;};'use strict';var Sequelize=require(_0xae59('0x0'));var _=require('lodash');var util=require('util');module[_0xae59('0x1')]={'name':{'type':Sequelize[_0xae59('0x2')],'unique':_0xae59('0x3')},'description':{'type':Sequelize[_0xae59('0x2')]},'formData':{'type':Sequelize[_0xae59('0x4')]('long'),'set':function(_0x5b8179){if(_[_0xae59('0x5')](_0x5b8179)){this[_0xae59('0x6')](_0xae59('0x7'),JSON[_0xae59('0x8')](_0x5b8179));}else if(_['isString'](_0x5b8179)){this['setDataValue'](_0xae59('0x7'),_0x5b8179);}else{this[_0xae59('0x6')](_0xae59('0x7'),util[_0xae59('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xae59('0xa')](_0xae59('0x3'))||'',this[_0xae59('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xae59('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x8089=['TEXT','long','setDataValue','formData','stringify','isString','format','getDataValue','BOOLEAN','sequelize','lodash','exports','STRING','name'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x8089,0xf7));var _0x9808=function(_0x48a00c,_0x3b4eb7){_0x48a00c=_0x48a00c-0x0;var _0x4f57aa=_0x8089[_0x48a00c];return _0x4f57aa;};'use strict';var Sequelize=require(_0x9808('0x0'));var _=require(_0x9808('0x1'));var util=require('util');module[_0x9808('0x2')]={'name':{'type':Sequelize[_0x9808('0x3')],'unique':_0x9808('0x4')},'description':{'type':Sequelize[_0x9808('0x3')]},'formData':{'type':Sequelize[_0x9808('0x5')](_0x9808('0x6')),'set':function(_0x2c68de){if(_['isObjectLike'](_0x2c68de)){this[_0x9808('0x7')](_0x9808('0x8'),JSON[_0x9808('0x9')](_0x2c68de));}else if(_[_0x9808('0xa')](_0x2c68de)){this[_0x9808('0x7')](_0x9808('0x8'),_0x2c68de);}else{this[_0x9808('0x7')](_0x9808('0x8'),util[_0x9808('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x9808('0x4'))||'',this[_0x9808('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9808('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9808('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 8f18781..43cdaed 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 _0x32d4=['startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','SessionId','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','download','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','map','JscriptyProject','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','userProfileId','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','rows','getAnswers','JscriptyAnswerReport','toString','indexOf','replace'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x32d4,0x82));var _0x432d=function(_0x483b16,_0x156325){_0x483b16=_0x483b16-0x0;var _0x10e5e9=_0x32d4[_0x483b16];return _0x10e5e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x432d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x432d('0x1'));var rp=require(_0x432d('0x2'));var moment=require(_0x432d('0x3'));var BPromise=require(_0x432d('0x4'));var Mustache=require(_0x432d('0x5'));var util=require(_0x432d('0x6'));var path=require(_0x432d('0x7'));var sox=require('sox');var csv=require(_0x432d('0x8'));var ejs=require(_0x432d('0x9'));var fs=require('fs');var fs_extra=require(_0x432d('0xa'));var _=require('lodash');var squel=require(_0x432d('0xb'));var crypto=require(_0x432d('0xc'));var jsforce=require(_0x432d('0xd'));var deskjs=require(_0x432d('0xe'));var toCsv=require(_0x432d('0x8'));var querystring=require(_0x432d('0xf'));var Papa=require(_0x432d('0x10'));var Redis=require(_0x432d('0x11'));var authService=require(_0x432d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x432d('0x13'));var hardwareService=require(_0x432d('0x14'));var logger=require(_0x432d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x432d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d899c,_0x2be426){_0x2be426=_0x2be426||0xcc;return function(_0x1d51c0){if(_0x1d51c0){return _0x3d899c[_0x432d('0x17')](_0x2be426);}return _0x3d899c[_0x432d('0x18')](_0x2be426)[_0x432d('0x19')]();};}function respondWithResult(_0x4d542d,_0x4d2b72){_0x4d2b72=_0x4d2b72||0xc8;return function(_0x111406){if(_0x111406){return _0x4d542d[_0x432d('0x18')](_0x4d2b72)['json'](_0x111406);}};}function respondWithFilteredResult(_0x448537,_0x54bbb0){return function(_0x49a410){if(_0x49a410){var _0x459af7=typeof _0x54bbb0[_0x432d('0x1a')]===_0x432d('0x1b')&&typeof _0x54bbb0['limit']===_0x432d('0x1b');var _0x5331cd=_0x49a410[_0x432d('0x1c')];var _0x2484e6=_0x459af7?0x0:_0x54bbb0['offset'];var _0x3fb47c=_0x459af7?_0x49a410[_0x432d('0x1c')]:_0x54bbb0[_0x432d('0x1a')]+_0x54bbb0[_0x432d('0x1d')];var _0x241609;if(_0x3fb47c>=_0x5331cd){_0x3fb47c=_0x5331cd;_0x241609=0xc8;}else{_0x241609=0xce;}_0x448537['status'](_0x241609);return _0x448537['set'](_0x432d('0x1e'),_0x2484e6+'-'+_0x3fb47c+'/'+_0x5331cd)[_0x432d('0x1f')](_0x49a410);}return null;};}function patchUpdates(_0x27bdef){return function(_0x3a4bb2){try{jsonpatch[_0x432d('0x20')](_0x3a4bb2,_0x27bdef,!![]);}catch(_0x1254a1){return BPromise[_0x432d('0x21')](_0x1254a1);}return _0x3a4bb2[_0x432d('0x22')]();};}function saveUpdates(_0x2dea38,_0x1c317d){return function(_0x59a68c){if(_0x59a68c){return _0x59a68c[_0x432d('0x23')](_0x2dea38)[_0x432d('0x24')](function(_0x23f427){return _0x23f427;});}return null;};}function removeEntity(_0x210ebc,_0x1e9247){return function(_0xa76f36){if(_0xa76f36){return _0xa76f36[_0x432d('0x25')]()[_0x432d('0x24')](function(){var _0x42b9d4=_0xa76f36[_0x432d('0x26')]({'plain':!![]});var _0xd5049f=_0x432d('0x27');return db[_0x432d('0x28')][_0x432d('0x25')]({'where':{'type':_0xd5049f,'resourceId':_0x42b9d4['id']}})[_0x432d('0x24')](function(){return _0xa76f36;});})[_0x432d('0x24')](function(){_0x210ebc[_0x432d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55650a,_0x3cefaf){return function(_0x518a38){if(!_0x518a38){_0x55650a['sendStatus'](0x194);}return _0x518a38;};}function handleError(_0x53ba4d,_0x1a7aae){_0x1a7aae=_0x1a7aae||0x1f4;return function(_0x263e6d){logger[_0x432d('0x29')](_0x263e6d[_0x432d('0x2a')]);if(_0x263e6d['name']){delete _0x263e6d[_0x432d('0x2b')];}_0x53ba4d[_0x432d('0x18')](_0x1a7aae)['send'](_0x263e6d);};}exports['index']=function(_0x19a875,_0x4a6d23){var _0xb0d98={},_0x10d9a1={},_0x7dc9ef={'count':0x0,'rows':[]};var _0x3a439d=_[_0x432d('0x2c')](db[_0x432d('0x2d')][_0x432d('0x2e')],function(_0x13bc73){return{'name':_0x13bc73[_0x432d('0x2f')],'type':_0x13bc73['type'][_0x432d('0x30')]};});_0x10d9a1[_0x432d('0x31')]=_[_0x432d('0x2c')](_0x3a439d,_0x432d('0x2b'));_0x10d9a1['query']=_[_0x432d('0x32')](_0x19a875['query']);_0x10d9a1[_0x432d('0x33')]=_['intersection'](_0x10d9a1[_0x432d('0x31')],_0x10d9a1[_0x432d('0x34')]);_0xb0d98[_0x432d('0x35')]=_[_0x432d('0x36')](_0x10d9a1['model'],qs[_0x432d('0x37')](_0x19a875[_0x432d('0x34')][_0x432d('0x37')]));_0xb0d98[_0x432d('0x35')]=_0xb0d98[_0x432d('0x35')][_0x432d('0x38')]?_0xb0d98[_0x432d('0x35')]:_0x10d9a1[_0x432d('0x31')];if(!_0x19a875['query']['hasOwnProperty'](_0x432d('0x39'))){_0xb0d98[_0x432d('0x1d')]=qs[_0x432d('0x1d')](_0x19a875[_0x432d('0x34')][_0x432d('0x1d')]);_0xb0d98['offset']=qs['offset'](_0x19a875[_0x432d('0x34')]['offset']);}_0xb0d98[_0x432d('0x3a')]=qs[_0x432d('0x3b')](_0x19a875[_0x432d('0x34')][_0x432d('0x3b')]);_0xb0d98[_0x432d('0x3c')]=qs[_0x432d('0x33')](_[_0x432d('0x3d')](_0x19a875[_0x432d('0x34')],_0x10d9a1[_0x432d('0x33')]),_0x3a439d);if(_0x19a875['query'][_0x432d('0x3e')]){_0xb0d98[_0x432d('0x3c')]=_[_0x432d('0x3f')](_0xb0d98[_0x432d('0x3c')],{'$or':_[_0x432d('0x2c')](_0x3a439d,function(_0x152a88){if(_0x152a88[_0x432d('0x40')]!==_0x432d('0x41')){var _0x5857d9={};_0x5857d9[_0x152a88[_0x432d('0x2b')]]={'$like':'%'+_0x19a875['query'][_0x432d('0x3e')]+'%'};return _0x5857d9;}})});}_0xb0d98=_[_0x432d('0x3f')]({},_0xb0d98,_0x19a875[_0x432d('0x42')]);var _0x56c4da={'where':_0xb0d98[_0x432d('0x3c')]};return db[_0x432d('0x2d')][_0x432d('0x1c')](_0x56c4da)[_0x432d('0x24')](function(_0x2de505){_0x7dc9ef[_0x432d('0x1c')]=_0x2de505;if(_0x19a875[_0x432d('0x34')][_0x432d('0x43')]){_0xb0d98[_0x432d('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0x432d('0x45')](_0xb0d98);})['then'](function(_0x2564d0){_0x7dc9ef['rows']=_0x2564d0;return _0x7dc9ef;})[_0x432d('0x24')](respondWithFilteredResult(_0x4a6d23,_0xb0d98))[_0x432d('0x46')](handleError(_0x4a6d23,null));};exports[_0x432d('0x47')]=function(_0xa7a1ee,_0x227adc){var _0x5ba360={'raw':![],'where':{'id':_0xa7a1ee['params']['id']}},_0x12534a={};_0x12534a['model']=_[_0x432d('0x32')](db[_0x432d('0x2d')][_0x432d('0x2e')]);_0x12534a[_0x432d('0x34')]=_[_0x432d('0x32')](_0xa7a1ee[_0x432d('0x34')]);_0x12534a[_0x432d('0x33')]=_[_0x432d('0x36')](_0x12534a[_0x432d('0x31')],_0x12534a[_0x432d('0x34')]);_0x5ba360[_0x432d('0x35')]=_[_0x432d('0x36')](_0x12534a[_0x432d('0x31')],qs[_0x432d('0x37')](_0xa7a1ee[_0x432d('0x34')][_0x432d('0x37')]));_0x5ba360[_0x432d('0x35')]=_0x5ba360['attributes'][_0x432d('0x38')]?_0x5ba360['attributes']:_0x12534a[_0x432d('0x31')];if(_0xa7a1ee['query'][_0x432d('0x43')]){_0x5ba360[_0x432d('0x44')]=[{'all':!![]}];}_0x5ba360=_[_0x432d('0x3f')]({},_0x5ba360,_0xa7a1ee[_0x432d('0x42')]);return db[_0x432d('0x2d')][_0x432d('0x48')](_0x5ba360)[_0x432d('0x24')](handleEntityNotFound(_0x227adc,null))['then'](respondWithResult(_0x227adc,null))[_0x432d('0x46')](handleError(_0x227adc,null));};exports[_0x432d('0x49')]=function(_0x2cad30,_0x4d56ce){return db[_0x432d('0x2d')][_0x432d('0x49')](_0x2cad30['body'],{})[_0x432d('0x24')](function(_0xbd9b11){var _0x3ed02d=_0x2cad30[_0x432d('0x4a')][_0x432d('0x26')]({'plain':!![]});if(!_0x3ed02d)throw new Error(_0x432d('0x4b'));if(_0x3ed02d[_0x432d('0x4c')]===_0x432d('0x4a')){var _0x36348b=_0xbd9b11[_0x432d('0x26')]({'plain':!![]});var _0x5ad801=_0x432d('0x27');return db[_0x432d('0x4d')]['find']({'where':{'name':_0x5ad801,'userProfileId':_0x3ed02d['userProfileId']},'raw':!![]})[_0x432d('0x24')](function(_0x2d98db){if(_0x2d98db&&_0x2d98db[_0x432d('0x4e')]===0x0){return db[_0x432d('0x28')][_0x432d('0x49')]({'name':_0x36348b[_0x432d('0x2b')],'resourceId':_0x36348b['id'],'type':_0x2d98db[_0x432d('0x2b')],'sectionId':_0x2d98db['id']},{})[_0x432d('0x24')](function(){return _0xbd9b11;});}else{return _0xbd9b11;}})[_0x432d('0x46')](function(_0x313556){logger[_0x432d('0x29')](_0x432d('0x4f'),_0x313556);throw _0x313556;});}return _0xbd9b11;})[_0x432d('0x24')](respondWithResult(_0x4d56ce,0xc9))[_0x432d('0x46')](handleError(_0x4d56ce,null));};exports[_0x432d('0x50')]=function(_0x3ca77c,_0x36e562){var _0x2b99d3={'where':{'id':_0x3ca77c[_0x432d('0x51')]['id']}},_0x39e53e={};_0x39e53e['model']=_[_0x432d('0x32')](db[_0x432d('0x2d')]['rawAttributes']);_0x2b99d3[_0x432d('0x35')]=_[_0x432d('0x36')](_0x39e53e[_0x432d('0x31')],qs[_0x432d('0x37')](_0x3ca77c['query'][_0x432d('0x37')]));_0x2b99d3[_0x432d('0x35')]=_0x2b99d3['attributes'][_0x432d('0x38')]?_0x2b99d3[_0x432d('0x35')]:_0x39e53e['model'];if(_0x3ca77c[_0x432d('0x34')][_0x432d('0x43')]){_0x2b99d3[_0x432d('0x44')]=[{'all':!![]}];}_0x2b99d3=_['merge']({},_0x2b99d3,_0x3ca77c['options']);return db[_0x432d('0x2d')][_0x432d('0x48')](_0x2b99d3)[_0x432d('0x24')](handleEntityNotFound(_0x36e562,null))[_0x432d('0x24')](function(_0x4682a2){if(_0x4682a2){var _0x26c523=_0x4682a2[_0x432d('0x26')]({'plain':!![]});_0x26c523=qs[_0x432d('0x52')](_0x26c523,['id',_0x432d('0x53'),_0x432d('0x54')]);_0x3ca77c[_0x432d('0x55')]=_[_0x432d('0x52')](_0x3ca77c['body'],['id',_0x432d('0x53'),'updatedAt']);return db[_0x432d('0x2d')]['create'](_[_0x432d('0x3f')](_0x26c523,_0x3ca77c[_0x432d('0x55')]),{'include':_0x3ca77c[_0x432d('0x34')][_0x432d('0x43')]?[{'all':!![]}]:undefined})[_0x432d('0x24')](function(_0x39f88d){var _0x117806=_0x3ca77c[_0x432d('0x4a')][_0x432d('0x26')]({'plain':!![]});if(!_0x117806)throw new Error(_0x432d('0x4b'));if(_0x117806[_0x432d('0x4c')]===_0x432d('0x4a')){var _0x23b474=_0x39f88d[_0x432d('0x26')]({'plain':!![]});var _0x167fa9=_0x432d('0x27');return db[_0x432d('0x4d')]['find']({'where':{'name':_0x167fa9,'userProfileId':_0x117806[_0x432d('0x56')]},'raw':!![]})[_0x432d('0x24')](function(_0x260662){if(_0x260662&&_0x260662[_0x432d('0x4e')]===0x0){return db[_0x432d('0x28')][_0x432d('0x49')]({'name':_0x23b474[_0x432d('0x2b')],'resourceId':_0x23b474['id'],'type':_0x260662[_0x432d('0x2b')],'sectionId':_0x260662['id']},{})['then'](function(){return _0x39f88d;});}else{return _0x39f88d;}})[_0x432d('0x46')](function(_0x5945c8){logger['error'](_0x432d('0x4f'),_0x5945c8);throw _0x5945c8;});}return _0x39f88d;});}})[_0x432d('0x24')](respondWithResult(_0x36e562,0xc9))[_0x432d('0x46')](handleError(_0x36e562,null));};exports[_0x432d('0x23')]=function(_0x410345,_0x1f440a){if(_0x410345[_0x432d('0x55')]['id']){delete _0x410345[_0x432d('0x55')]['id'];}return db[_0x432d('0x2d')]['find']({'where':{'id':_0x410345['params']['id']}})['then'](handleEntityNotFound(_0x1f440a,null))['then'](saveUpdates(_0x410345['body'],null))['then'](respondWithResult(_0x1f440a,null))[_0x432d('0x46')](handleError(_0x1f440a,null));};exports[_0x432d('0x25')]=function(_0x5ccae6,_0x22b979){return db[_0x432d('0x2d')][_0x432d('0x48')]({'where':{'id':_0x5ccae6[_0x432d('0x51')]['id']}})[_0x432d('0x24')](handleEntityNotFound(_0x22b979,null))['then'](removeEntity(_0x22b979,null))[_0x432d('0x46')](handleError(_0x22b979,null));};exports[_0x432d('0x57')]=function(_0x1b7cf3,_0x3ddd4b,_0x15f129){var _0x5bc34f={'raw':!![],'where':{}};var _0x4bd393={};var _0x55c1ea={'count':0x0,'rows':[]};return db[_0x432d('0x2d')][_0x432d('0x58')]({'where':{'id':_0x1b7cf3[_0x432d('0x51')]['id']}})['then'](handleEntityNotFound(_0x3ddd4b,null))[_0x432d('0x24')](function(_0x2f97ae){if(_0x2f97ae){_0x4bd393[_0x432d('0x31')]=_[_0x432d('0x32')](db[_0x432d('0x59')]['rawAttributes']);_0x4bd393['query']=_[_0x432d('0x32')](_0x1b7cf3[_0x432d('0x34')]);_0x4bd393[_0x432d('0x33')]=_[_0x432d('0x36')](_0x4bd393[_0x432d('0x31')],_0x4bd393[_0x432d('0x34')]);_0x5bc34f['attributes']=_[_0x432d('0x36')](_0x4bd393[_0x432d('0x31')],qs[_0x432d('0x37')](_0x1b7cf3[_0x432d('0x34')][_0x432d('0x37')]));_0x5bc34f['attributes']=_0x5bc34f[_0x432d('0x35')][_0x432d('0x38')]?_0x5bc34f['attributes']:_0x4bd393[_0x432d('0x31')];if(!_0x1b7cf3[_0x432d('0x34')][_0x432d('0x5a')](_0x432d('0x39'))){_0x5bc34f[_0x432d('0x1d')]=qs[_0x432d('0x1d')](_0x1b7cf3[_0x432d('0x34')][_0x432d('0x1d')]);_0x5bc34f[_0x432d('0x1a')]=qs[_0x432d('0x1a')](_0x1b7cf3[_0x432d('0x34')][_0x432d('0x1a')]);}_0x5bc34f[_0x432d('0x3a')]=qs[_0x432d('0x3b')](_0x1b7cf3[_0x432d('0x34')][_0x432d('0x3b')]);_0x5bc34f[_0x432d('0x3c')]=qs[_0x432d('0x33')](_['pick'](_0x1b7cf3['query'],_0x4bd393[_0x432d('0x33')]));_0x5bc34f[_0x432d('0x3c')][_0x432d('0x5b')]=_0x2f97ae['id'];if(_0x1b7cf3[_0x432d('0x34')]['filter']){_0x5bc34f['where']=_[_0x432d('0x3f')](_0x5bc34f[_0x432d('0x3c')],{'$or':_[_0x432d('0x2c')](_0x5bc34f[_0x432d('0x35')],function(_0x3b0ed2){var _0x205e12={};_0x205e12[_0x3b0ed2]={'$like':'%'+_0x1b7cf3['query'][_0x432d('0x3e')]+'%'};return _0x205e12;})});}_0x5bc34f=_[_0x432d('0x3f')]({},_0x5bc34f,_0x1b7cf3[_0x432d('0x42')]);return db[_0x432d('0x59')]['count']({'where':_0x5bc34f['where']})[_0x432d('0x24')](function(_0x26a87a){_0x55c1ea['count']=_0x26a87a;if(_0x1b7cf3['query'][_0x432d('0x43')]){_0x5bc34f[_0x432d('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x432d('0x45')](_0x5bc34f);})[_0x432d('0x24')](function(_0x29bbda){_0x55c1ea[_0x432d('0x5c')]=_0x29bbda;return _0x55c1ea;});}})[_0x432d('0x24')](respondWithFilteredResult(_0x3ddd4b,_0x5bc34f))['catch'](handleError(_0x3ddd4b,null));};exports[_0x432d('0x5d')]=function(_0xae2d39,_0x2fe0a0,_0x44aa38){var _0x585694={'raw':!![],'where':{}};var _0x5603e8={};var _0x419778={'count':0x0,'rows':[]};return db[_0x432d('0x2d')][_0x432d('0x58')]({'where':{'id':_0xae2d39[_0x432d('0x51')]['id']}})[_0x432d('0x24')](handleEntityNotFound(_0x2fe0a0,null))[_0x432d('0x24')](function(_0x6f0c97){if(_0x6f0c97){_0x5603e8[_0x432d('0x31')]=_[_0x432d('0x32')](db[_0x432d('0x5e')][_0x432d('0x2e')]);_0x5603e8[_0x432d('0x34')]=_['keys'](_0xae2d39[_0x432d('0x34')]);_0x5603e8['filters']=_[_0x432d('0x36')](_0x5603e8['model'],_0x5603e8['query']);_0x585694[_0x432d('0x35')]=_[_0x432d('0x36')](_0x5603e8[_0x432d('0x31')],qs[_0x432d('0x37')](_0xae2d39[_0x432d('0x34')][_0x432d('0x37')]));_0x585694[_0x432d('0x35')]=_0x585694[_0x432d('0x35')][_0x432d('0x38')]?_0x585694[_0x432d('0x35')]:_0x5603e8[_0x432d('0x31')];if(!_0xae2d39['query'][_0x432d('0x5a')](_0x432d('0x39'))){_0x585694[_0x432d('0x1d')]=qs[_0x432d('0x1d')](_0xae2d39[_0x432d('0x34')]['limit']);_0x585694[_0x432d('0x1a')]=qs[_0x432d('0x1a')](_0xae2d39[_0x432d('0x34')]['offset']);}_0x585694[_0x432d('0x3a')]=qs[_0x432d('0x3b')](_0xae2d39[_0x432d('0x34')][_0x432d('0x3b')]);_0x585694[_0x432d('0x3c')]=qs[_0x432d('0x33')](_[_0x432d('0x3d')](_0xae2d39[_0x432d('0x34')],_0x5603e8[_0x432d('0x33')]));_0x585694[_0x432d('0x3c')][_0x432d('0x5b')]=_0x6f0c97['id'];if(_0xae2d39[_0x432d('0x34')][_0x432d('0x3e')]){_0x585694[_0x432d('0x3c')]=_['merge'](_0x585694['where'],{'$or':_[_0x432d('0x2c')](_0x585694[_0x432d('0x35')],function(_0x4f220e){var _0x5103d5={};_0x5103d5[_0x4f220e]={'$like':'%'+_0xae2d39[_0x432d('0x34')][_0x432d('0x3e')]+'%'};return _0x5103d5;})});}_0x585694=_[_0x432d('0x3f')]({},_0x585694,_0xae2d39[_0x432d('0x42')]);return db[_0x432d('0x5e')][_0x432d('0x1c')]({'where':_0x585694[_0x432d('0x3c')]})[_0x432d('0x24')](function(_0xc81f7e){_0x419778['count']=_0xc81f7e;if(_0xae2d39['query'][_0x432d('0x43')]){_0x585694[_0x432d('0x44')]=[{'all':!![]}];}return db[_0x432d('0x5e')][_0x432d('0x45')](_0x585694);})[_0x432d('0x24')](function(_0x9e977d){_0x419778[_0x432d('0x5c')]=_0x9e977d;return _0x419778;});}})[_0x432d('0x24')](respondWithFilteredResult(_0x2fe0a0,_0x585694))[_0x432d('0x46')](handleError(_0x2fe0a0,null));};function char(_0x3996bc){return'number'===typeof _0x3996bc?String['fromCharCode'][_0x432d('0x20')](null,arguments):_0x3996bc;}function needsEncapsulation(_0x22acf0){return!!_0x22acf0&&(_0x22acf0[_0x432d('0x5f')]()[_0x432d('0x60')](char(0xd))>=0x0||_0x22acf0[_0x432d('0x5f')]()[_0x432d('0x60')](char(0xa))>=0x0||_0x22acf0[_0x432d('0x5f')]()[_0x432d('0x60')](char(0x2c))>=0x0||_0x22acf0['toString']()[_0x432d('0x60')](char(0x22))>=0x0);}function encapsulate(_0x803a8f){var _0xad591b=char(0x22),_0x49e259='\x5c'+char(0x22),_0x316076=_0x803a8f[_0x432d('0x5f')]()[_0x432d('0x61')](new RegExp(_0xad591b,'g'),_0x49e259);return _0xad591b+_0x316076+_0xad591b;}exports['getSummary']=function(_0x276135,_0x43d40d,_0x36c674){var _0x21808a,_0xead355;var _0xf29485={'where':{'ProjectId':_0x276135[_0x432d('0x51')]['id']}};if(_0x276135[_0x432d('0x34')][_0x432d('0x62')]){_0xf29485[_0x432d('0x3c')]['starttime']=JSON[_0x432d('0x63')](_0x276135['query'][_0x432d('0x62')]);}return db[_0x432d('0x59')][_0x432d('0x45')](_0xf29485)['then'](handleEntityNotFound(_0x43d40d,null))[_0x432d('0x24')](function(_0x4742b6){if(_0x4742b6){_0x21808a=_0x4742b6;return db[_0x432d('0x64')][_0x432d('0x45')]({'where':{'SessionId':{'$in':_[_0x432d('0x2c')](_0x21808a,'id')},'ProjectId':_0x276135['params']['id']},'order':_0x432d('0x65')});}})[_0x432d('0x24')](handleEntityNotFound(_0x43d40d,null))['then'](function(_0x1574ca){if(_0x1574ca){_0xead355=_0x1574ca;var _0x1f576c={};for(var _0x1c5c24=0x0,_0x1627d2=_0xead355[_0x432d('0x38')];_0x1c5c24<_0x1627d2;_0x1c5c24++){if(!_0x1f576c[_0x432d('0x5a')](_0xead355[_0x1c5c24][_0x432d('0x66')])){_0x1f576c[_0xead355[_0x1c5c24][_0x432d('0x66')]]=needsEncapsulation(_0xead355[_0x1c5c24][_0x432d('0x67')])?encapsulate(_0xead355[_0x1c5c24][_0x432d('0x67')]):_0xead355[_0x1c5c24][_0x432d('0x67')];}}var _0x4e3744=[],_0x223550={};for(var _0x4d9605=0x0,_0x2b3258=_0x21808a[_0x432d('0x38')];_0x4d9605<_0x2b3258;_0x4d9605++){_0x223550={'ProjectId':_0x276135[_0x432d('0x51')]['id'],'SessionId':_0x21808a[_0x4d9605]['id'],'StartTime':moment(_0x21808a[_0x4d9605][_0x432d('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x349d96=0x0,_0x254884=_0xead355[_0x432d('0x38')];_0x349d96<_0x254884;_0x349d96++){if(_0xead355[_0x349d96][_0x432d('0x69')]==_0x21808a[_0x4d9605]['id']&&_0x1f576c['hasOwnProperty'](_0xead355[_0x349d96]['questionId'])){_0x223550[_0x1f576c[_0xead355[_0x349d96]['questionId']]]=_0xead355[_0x349d96]['answer'];}}for(var _0x475724 in _0x1f576c){if(!_0x223550['hasOwnProperty'](_0x1f576c[_0x475724])){_0x223550[_0x1f576c[_0x475724]]=null;}}_0x4e3744['push'](_0x223550);}return _0x4e3744;}})[_0x432d('0x24')](function(_0x571b9e){if(!_['isEmpty'](_0x571b9e)){var _0xcbc0fd=toCsv(_0x571b9e);var _0x3c32d7=Date[_0x432d('0x6a')]();fs['writeFileSync'](util[_0x432d('0x6b')](_0x432d('0x6c'),_0x276135[_0x432d('0x51')]['id'],_0x3c32d7),_0xcbc0fd);_0x43d40d['setHeader'](_0x432d('0x6d'),_0x432d('0x6e')+util[_0x432d('0x6b')]('Jscripty_Project_%d_Summary_%s.csv',_0x276135['params']['id'],_0x3c32d7));_0x43d40d[_0x432d('0x6f')](_0x432d('0x70'),'text/csv');return _0x43d40d[_0x432d('0x71')](util['format'](_0x432d('0x6c'),_0x276135[_0x432d('0x51')]['id'],_0x3c32d7));}else{return _0x43d40d['sendStatus'](0xcc);}})['catch'](handleError(_0x43d40d,null));}; \ No newline at end of file +var _0xb1fa=['params','keys','find','create','body','user','role','Projects','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getSessions','findOne','JscriptySessionReport','order','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','indexOf','toString','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','sendStatus','zip-dir','request-promise','sox','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show'];(function(_0x43c1cb,_0xc89b7){var _0x1b5cc9=function(_0x577fb6){while(--_0x577fb6){_0x43c1cb['push'](_0x43c1cb['shift']());}};_0x1b5cc9(++_0xc89b7);}(_0xb1fa,0x9e));var _0xab1f=function(_0x2029a3,_0x16340e){_0x2029a3=_0x2029a3-0x0;var _0x5c87ad=_0xb1fa[_0x2029a3];return _0x5c87ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab1f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xab1f('0x2'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab1f('0x3'));var squel=require('squel');var crypto=require(_0xab1f('0x4'));var jsforce=require(_0xab1f('0x5'));var deskjs=require('desk.js');var toCsv=require(_0xab1f('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab1f('0x7'));var authService=require(_0xab1f('0x8'));var qs=require(_0xab1f('0x9'));var as=require(_0xab1f('0xa'));var hardwareService=require(_0xab1f('0xb'));var logger=require('../../config/logger')(_0xab1f('0xc'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xab1f('0xd'));var db=require(_0xab1f('0xe'))['db'];function respondWithStatusCode(_0x5168bb,_0x4cb402){_0x4cb402=_0x4cb402||0xcc;return function(_0xea4a03){if(_0xea4a03){return _0x5168bb['sendStatus'](_0x4cb402);}return _0x5168bb[_0xab1f('0xf')](_0x4cb402)[_0xab1f('0x10')]();};}function respondWithResult(_0x68b4e4,_0x58a0fb){_0x58a0fb=_0x58a0fb||0xc8;return function(_0x2ee266){if(_0x2ee266){return _0x68b4e4[_0xab1f('0xf')](_0x58a0fb)[_0xab1f('0x11')](_0x2ee266);}};}function respondWithFilteredResult(_0x1c0260,_0x5124d6){return function(_0x33fc3a){if(_0x33fc3a){var _0x4c68b0=typeof _0x5124d6[_0xab1f('0x12')]===_0xab1f('0x13')&&typeof _0x5124d6[_0xab1f('0x14')]==='undefined';var _0x1582bd=_0x33fc3a[_0xab1f('0x15')];var _0x558c52=_0x4c68b0?0x0:_0x5124d6[_0xab1f('0x12')];var _0x4ba3f4=_0x4c68b0?_0x33fc3a[_0xab1f('0x15')]:_0x5124d6[_0xab1f('0x12')]+_0x5124d6[_0xab1f('0x14')];var _0x547fc0;if(_0x4ba3f4>=_0x1582bd){_0x4ba3f4=_0x1582bd;_0x547fc0=0xc8;}else{_0x547fc0=0xce;}_0x1c0260[_0xab1f('0xf')](_0x547fc0);return _0x1c0260[_0xab1f('0x16')]('Content-Range',_0x558c52+'-'+_0x4ba3f4+'/'+_0x1582bd)[_0xab1f('0x11')](_0x33fc3a);}return null;};}function patchUpdates(_0x30f973){return function(_0x4fe6d7){try{jsonpatch['apply'](_0x4fe6d7,_0x30f973,!![]);}catch(_0x3103e1){return BPromise[_0xab1f('0x17')](_0x3103e1);}return _0x4fe6d7[_0xab1f('0x18')]();};}function saveUpdates(_0x425b61,_0x1bd51b){return function(_0x2915b9){if(_0x2915b9){return _0x2915b9[_0xab1f('0x19')](_0x425b61)['then'](function(_0x37ae5e){return _0x37ae5e;});}return null;};}function removeEntity(_0x85f20a,_0x3662b8){return function(_0x33b647){if(_0x33b647){return _0x33b647['destroy']()[_0xab1f('0x1a')](function(){var _0x219f01=_0x33b647[_0xab1f('0x1b')]({'plain':!![]});var _0x162041='Projects';return db[_0xab1f('0x1c')][_0xab1f('0x1d')]({'where':{'type':_0x162041,'resourceId':_0x219f01['id']}})[_0xab1f('0x1a')](function(){return _0x33b647;});})[_0xab1f('0x1a')](function(){_0x85f20a[_0xab1f('0xf')](0xcc)[_0xab1f('0x10')]();});}};}function handleEntityNotFound(_0x357c51,_0x4ffb2e){return function(_0x2216ca){if(!_0x2216ca){_0x357c51['sendStatus'](0x194);}return _0x2216ca;};}function handleError(_0x38ee2b,_0x5b869d){_0x5b869d=_0x5b869d||0x1f4;return function(_0x3357b9){logger[_0xab1f('0x1e')](_0x3357b9[_0xab1f('0x1f')]);if(_0x3357b9[_0xab1f('0x20')]){delete _0x3357b9[_0xab1f('0x20')];}_0x38ee2b[_0xab1f('0xf')](_0x5b869d)[_0xab1f('0x21')](_0x3357b9);};}exports[_0xab1f('0x22')]=function(_0x12be07,_0x5d924b){var _0x355706={},_0x5e6170={},_0x1c1bce={'count':0x0,'rows':[]};var _0x24c678=_[_0xab1f('0x23')](db[_0xab1f('0x24')][_0xab1f('0x25')],function(_0x5c3de8){return{'name':_0x5c3de8[_0xab1f('0x26')],'type':_0x5c3de8[_0xab1f('0x27')][_0xab1f('0x28')]};});_0x5e6170['model']=_[_0xab1f('0x23')](_0x24c678,'name');_0x5e6170[_0xab1f('0x29')]=_['keys'](_0x12be07[_0xab1f('0x29')]);_0x5e6170['filters']=_[_0xab1f('0x2a')](_0x5e6170[_0xab1f('0x2b')],_0x5e6170[_0xab1f('0x29')]);_0x355706[_0xab1f('0x2c')]=_['intersection'](_0x5e6170['model'],qs[_0xab1f('0x2d')](_0x12be07['query'][_0xab1f('0x2d')]));_0x355706[_0xab1f('0x2c')]=_0x355706[_0xab1f('0x2c')][_0xab1f('0x2e')]?_0x355706[_0xab1f('0x2c')]:_0x5e6170[_0xab1f('0x2b')];if(!_0x12be07['query'][_0xab1f('0x2f')](_0xab1f('0x30'))){_0x355706['limit']=qs['limit'](_0x12be07[_0xab1f('0x29')][_0xab1f('0x14')]);_0x355706[_0xab1f('0x12')]=qs[_0xab1f('0x12')](_0x12be07[_0xab1f('0x29')][_0xab1f('0x12')]);}_0x355706['order']=qs[_0xab1f('0x31')](_0x12be07[_0xab1f('0x29')][_0xab1f('0x31')]);_0x355706[_0xab1f('0x32')]=qs[_0xab1f('0x33')](_[_0xab1f('0x34')](_0x12be07[_0xab1f('0x29')],_0x5e6170['filters']),_0x24c678);if(_0x12be07[_0xab1f('0x29')][_0xab1f('0x35')]){_0x355706[_0xab1f('0x32')]=_[_0xab1f('0x36')](_0x355706[_0xab1f('0x32')],{'$or':_[_0xab1f('0x23')](_0x24c678,function(_0x353ec8){if(_0x353ec8[_0xab1f('0x27')]!==_0xab1f('0x37')){var _0x5b28b0={};_0x5b28b0[_0x353ec8[_0xab1f('0x20')]]={'$like':'%'+_0x12be07[_0xab1f('0x29')][_0xab1f('0x35')]+'%'};return _0x5b28b0;}})});}_0x355706=_[_0xab1f('0x36')]({},_0x355706,_0x12be07[_0xab1f('0x38')]);var _0x1da2dc={'where':_0x355706[_0xab1f('0x32')]};return db[_0xab1f('0x24')][_0xab1f('0x15')](_0x1da2dc)[_0xab1f('0x1a')](function(_0xe349a6){_0x1c1bce[_0xab1f('0x15')]=_0xe349a6;if(_0x12be07[_0xab1f('0x29')][_0xab1f('0x39')]){_0x355706[_0xab1f('0x3a')]=[{'all':!![]}];}return db['JscriptyProject'][_0xab1f('0x3b')](_0x355706);})['then'](function(_0x3e12c3){_0x1c1bce['rows']=_0x3e12c3;return _0x1c1bce;})[_0xab1f('0x1a')](respondWithFilteredResult(_0x5d924b,_0x355706))[_0xab1f('0x3c')](handleError(_0x5d924b,null));};exports[_0xab1f('0x3d')]=function(_0x2240cc,_0x57e397){var _0x1fd5ee={'raw':![],'where':{'id':_0x2240cc[_0xab1f('0x3e')]['id']}},_0x26c50c={};_0x26c50c['model']=_[_0xab1f('0x3f')](db['JscriptyProject']['rawAttributes']);_0x26c50c[_0xab1f('0x29')]=_['keys'](_0x2240cc[_0xab1f('0x29')]);_0x26c50c['filters']=_['intersection'](_0x26c50c[_0xab1f('0x2b')],_0x26c50c[_0xab1f('0x29')]);_0x1fd5ee[_0xab1f('0x2c')]=_['intersection'](_0x26c50c[_0xab1f('0x2b')],qs['fields'](_0x2240cc[_0xab1f('0x29')][_0xab1f('0x2d')]));_0x1fd5ee[_0xab1f('0x2c')]=_0x1fd5ee['attributes'][_0xab1f('0x2e')]?_0x1fd5ee[_0xab1f('0x2c')]:_0x26c50c['model'];if(_0x2240cc[_0xab1f('0x29')][_0xab1f('0x39')]){_0x1fd5ee[_0xab1f('0x3a')]=[{'all':!![]}];}_0x1fd5ee=_['merge']({},_0x1fd5ee,_0x2240cc[_0xab1f('0x38')]);return db[_0xab1f('0x24')][_0xab1f('0x40')](_0x1fd5ee)[_0xab1f('0x1a')](handleEntityNotFound(_0x57e397,null))[_0xab1f('0x1a')](respondWithResult(_0x57e397,null))['catch'](handleError(_0x57e397,null));};exports[_0xab1f('0x41')]=function(_0xa21313,_0x2c11df){return db[_0xab1f('0x24')]['create'](_0xa21313[_0xab1f('0x42')],{})['then'](function(_0x3491d3){var _0x1d3d41=_0xa21313[_0xab1f('0x43')]['get']({'plain':!![]});if(!_0x1d3d41)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d3d41[_0xab1f('0x44')]==='user'){var _0x4905b0=_0x3491d3['get']({'plain':!![]});var _0xe2eced=_0xab1f('0x45');return db[_0xab1f('0x46')][_0xab1f('0x40')]({'where':{'name':_0xe2eced,'userProfileId':_0x1d3d41['userProfileId']},'raw':!![]})[_0xab1f('0x1a')](function(_0x37f819){if(_0x37f819&&_0x37f819['autoAssociation']===0x0){return db[_0xab1f('0x1c')][_0xab1f('0x41')]({'name':_0x4905b0[_0xab1f('0x20')],'resourceId':_0x4905b0['id'],'type':_0x37f819['name'],'sectionId':_0x37f819['id']},{})[_0xab1f('0x1a')](function(){return _0x3491d3;});}else{return _0x3491d3;}})[_0xab1f('0x3c')](function(_0x331754){logger[_0xab1f('0x1e')](_0xab1f('0x47'),_0x331754);throw _0x331754;});}return _0x3491d3;})[_0xab1f('0x1a')](respondWithResult(_0x2c11df,0xc9))[_0xab1f('0x3c')](handleError(_0x2c11df,null));};exports[_0xab1f('0x48')]=function(_0x2b1400,_0x3bf108){var _0x308e3e={'where':{'id':_0x2b1400[_0xab1f('0x3e')]['id']}},_0xb09f6d={};_0xb09f6d[_0xab1f('0x2b')]=_[_0xab1f('0x3f')](db['JscriptyProject'][_0xab1f('0x25')]);_0x308e3e[_0xab1f('0x2c')]=_[_0xab1f('0x2a')](_0xb09f6d[_0xab1f('0x2b')],qs[_0xab1f('0x2d')](_0x2b1400[_0xab1f('0x29')][_0xab1f('0x2d')]));_0x308e3e[_0xab1f('0x2c')]=_0x308e3e[_0xab1f('0x2c')][_0xab1f('0x2e')]?_0x308e3e[_0xab1f('0x2c')]:_0xb09f6d[_0xab1f('0x2b')];if(_0x2b1400['query'][_0xab1f('0x39')]){_0x308e3e[_0xab1f('0x3a')]=[{'all':!![]}];}_0x308e3e=_['merge']({},_0x308e3e,_0x2b1400[_0xab1f('0x38')]);return db[_0xab1f('0x24')][_0xab1f('0x40')](_0x308e3e)[_0xab1f('0x1a')](handleEntityNotFound(_0x3bf108,null))[_0xab1f('0x1a')](function(_0x557b50){if(_0x557b50){var _0x26ba40=_0x557b50[_0xab1f('0x1b')]({'plain':!![]});_0x26ba40=qs['omit'](_0x26ba40,['id',_0xab1f('0x49'),_0xab1f('0x4a')]);_0x2b1400['body']=_['omit'](_0x2b1400['body'],['id',_0xab1f('0x49'),_0xab1f('0x4a')]);return db[_0xab1f('0x24')]['create'](_[_0xab1f('0x36')](_0x26ba40,_0x2b1400[_0xab1f('0x42')]),{'include':_0x2b1400[_0xab1f('0x29')][_0xab1f('0x39')]?[{'all':!![]}]:undefined})[_0xab1f('0x1a')](function(_0x1899df){var _0x20e5af=_0x2b1400['user'][_0xab1f('0x1b')]({'plain':!![]});if(!_0x20e5af)throw new Error(_0xab1f('0x4b'));if(_0x20e5af[_0xab1f('0x44')]===_0xab1f('0x43')){var _0x28e5a4=_0x1899df['get']({'plain':!![]});var _0x3ff76e=_0xab1f('0x45');return db['UserProfileSection'][_0xab1f('0x40')]({'where':{'name':_0x3ff76e,'userProfileId':_0x20e5af['userProfileId']},'raw':!![]})['then'](function(_0x4bf0f3){if(_0x4bf0f3&&_0x4bf0f3[_0xab1f('0x4c')]===0x0){return db['UserProfileResource'][_0xab1f('0x41')]({'name':_0x28e5a4[_0xab1f('0x20')],'resourceId':_0x28e5a4['id'],'type':_0x4bf0f3[_0xab1f('0x20')],'sectionId':_0x4bf0f3['id']},{})[_0xab1f('0x1a')](function(){return _0x1899df;});}else{return _0x1899df;}})[_0xab1f('0x3c')](function(_0x2832f3){logger[_0xab1f('0x1e')](_0xab1f('0x47'),_0x2832f3);throw _0x2832f3;});}return _0x1899df;});}})[_0xab1f('0x1a')](respondWithResult(_0x3bf108,0xc9))[_0xab1f('0x3c')](handleError(_0x3bf108,null));};exports[_0xab1f('0x19')]=function(_0x260456,_0x1ce532){if(_0x260456[_0xab1f('0x42')]['id']){delete _0x260456[_0xab1f('0x42')]['id'];}return db['JscriptyProject'][_0xab1f('0x40')]({'where':{'id':_0x260456[_0xab1f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1ce532,null))[_0xab1f('0x1a')](saveUpdates(_0x260456['body'],null))['then'](respondWithResult(_0x1ce532,null))[_0xab1f('0x3c')](handleError(_0x1ce532,null));};exports[_0xab1f('0x1d')]=function(_0x15b9a4,_0x43e45b){return db[_0xab1f('0x24')]['find']({'where':{'id':_0x15b9a4[_0xab1f('0x3e')]['id']}})[_0xab1f('0x1a')](handleEntityNotFound(_0x43e45b,null))['then'](removeEntity(_0x43e45b,null))[_0xab1f('0x3c')](handleError(_0x43e45b,null));};exports[_0xab1f('0x4d')]=function(_0x51a9e3,_0x340298,_0x340652){var _0x2562c6={'raw':!![],'where':{}};var _0x557dab={};var _0x49e901={'count':0x0,'rows':[]};return db[_0xab1f('0x24')][_0xab1f('0x4e')]({'where':{'id':_0x51a9e3[_0xab1f('0x3e')]['id']}})[_0xab1f('0x1a')](handleEntityNotFound(_0x340298,null))[_0xab1f('0x1a')](function(_0x21502c){if(_0x21502c){_0x557dab['model']=_[_0xab1f('0x3f')](db[_0xab1f('0x4f')][_0xab1f('0x25')]);_0x557dab['query']=_[_0xab1f('0x3f')](_0x51a9e3['query']);_0x557dab[_0xab1f('0x33')]=_[_0xab1f('0x2a')](_0x557dab[_0xab1f('0x2b')],_0x557dab[_0xab1f('0x29')]);_0x2562c6['attributes']=_[_0xab1f('0x2a')](_0x557dab[_0xab1f('0x2b')],qs['fields'](_0x51a9e3['query'][_0xab1f('0x2d')]));_0x2562c6[_0xab1f('0x2c')]=_0x2562c6[_0xab1f('0x2c')][_0xab1f('0x2e')]?_0x2562c6['attributes']:_0x557dab[_0xab1f('0x2b')];if(!_0x51a9e3[_0xab1f('0x29')][_0xab1f('0x2f')](_0xab1f('0x30'))){_0x2562c6[_0xab1f('0x14')]=qs[_0xab1f('0x14')](_0x51a9e3[_0xab1f('0x29')]['limit']);_0x2562c6[_0xab1f('0x12')]=qs['offset'](_0x51a9e3[_0xab1f('0x29')][_0xab1f('0x12')]);}_0x2562c6[_0xab1f('0x50')]=qs['sort'](_0x51a9e3[_0xab1f('0x29')][_0xab1f('0x31')]);_0x2562c6[_0xab1f('0x32')]=qs[_0xab1f('0x33')](_[_0xab1f('0x34')](_0x51a9e3['query'],_0x557dab[_0xab1f('0x33')]));_0x2562c6[_0xab1f('0x32')][_0xab1f('0x51')]=_0x21502c['id'];if(_0x51a9e3['query'][_0xab1f('0x35')]){_0x2562c6[_0xab1f('0x32')]=_[_0xab1f('0x36')](_0x2562c6[_0xab1f('0x32')],{'$or':_['map'](_0x2562c6[_0xab1f('0x2c')],function(_0x331d06){var _0x5a6cb3={};_0x5a6cb3[_0x331d06]={'$like':'%'+_0x51a9e3[_0xab1f('0x29')][_0xab1f('0x35')]+'%'};return _0x5a6cb3;})});}_0x2562c6=_['merge']({},_0x2562c6,_0x51a9e3['options']);return db[_0xab1f('0x4f')][_0xab1f('0x15')]({'where':_0x2562c6[_0xab1f('0x32')]})[_0xab1f('0x1a')](function(_0x5055d7){_0x49e901['count']=_0x5055d7;if(_0x51a9e3[_0xab1f('0x29')][_0xab1f('0x39')]){_0x2562c6[_0xab1f('0x3a')]=[{'all':!![]}];}return db[_0xab1f('0x4f')][_0xab1f('0x3b')](_0x2562c6);})[_0xab1f('0x1a')](function(_0x15733b){_0x49e901[_0xab1f('0x52')]=_0x15733b;return _0x49e901;});}})[_0xab1f('0x1a')](respondWithFilteredResult(_0x340298,_0x2562c6))['catch'](handleError(_0x340298,null));};exports[_0xab1f('0x53')]=function(_0x573953,_0x36b5d2,_0x1b744a){var _0x5118b3={'raw':!![],'where':{}};var _0x3dc03a={};var _0x19e16a={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xab1f('0x4e')]({'where':{'id':_0x573953[_0xab1f('0x3e')]['id']}})[_0xab1f('0x1a')](handleEntityNotFound(_0x36b5d2,null))[_0xab1f('0x1a')](function(_0x405368){if(_0x405368){_0x3dc03a[_0xab1f('0x2b')]=_['keys'](db[_0xab1f('0x54')][_0xab1f('0x25')]);_0x3dc03a[_0xab1f('0x29')]=_['keys'](_0x573953[_0xab1f('0x29')]);_0x3dc03a['filters']=_[_0xab1f('0x2a')](_0x3dc03a[_0xab1f('0x2b')],_0x3dc03a[_0xab1f('0x29')]);_0x5118b3[_0xab1f('0x2c')]=_['intersection'](_0x3dc03a[_0xab1f('0x2b')],qs[_0xab1f('0x2d')](_0x573953[_0xab1f('0x29')][_0xab1f('0x2d')]));_0x5118b3[_0xab1f('0x2c')]=_0x5118b3[_0xab1f('0x2c')]['length']?_0x5118b3['attributes']:_0x3dc03a[_0xab1f('0x2b')];if(!_0x573953[_0xab1f('0x29')]['hasOwnProperty'](_0xab1f('0x30'))){_0x5118b3[_0xab1f('0x14')]=qs[_0xab1f('0x14')](_0x573953[_0xab1f('0x29')][_0xab1f('0x14')]);_0x5118b3[_0xab1f('0x12')]=qs[_0xab1f('0x12')](_0x573953[_0xab1f('0x29')][_0xab1f('0x12')]);}_0x5118b3[_0xab1f('0x50')]=qs[_0xab1f('0x31')](_0x573953[_0xab1f('0x29')][_0xab1f('0x31')]);_0x5118b3[_0xab1f('0x32')]=qs['filters'](_[_0xab1f('0x34')](_0x573953['query'],_0x3dc03a['filters']));_0x5118b3[_0xab1f('0x32')][_0xab1f('0x51')]=_0x405368['id'];if(_0x573953['query'][_0xab1f('0x35')]){_0x5118b3['where']=_[_0xab1f('0x36')](_0x5118b3[_0xab1f('0x32')],{'$or':_[_0xab1f('0x23')](_0x5118b3[_0xab1f('0x2c')],function(_0x42005f){var _0x3e1472={};_0x3e1472[_0x42005f]={'$like':'%'+_0x573953['query']['filter']+'%'};return _0x3e1472;})});}_0x5118b3=_[_0xab1f('0x36')]({},_0x5118b3,_0x573953[_0xab1f('0x38')]);return db[_0xab1f('0x54')][_0xab1f('0x15')]({'where':_0x5118b3['where']})[_0xab1f('0x1a')](function(_0x28f1b6){_0x19e16a['count']=_0x28f1b6;if(_0x573953[_0xab1f('0x29')][_0xab1f('0x39')]){_0x5118b3['include']=[{'all':!![]}];}return db[_0xab1f('0x54')][_0xab1f('0x3b')](_0x5118b3);})[_0xab1f('0x1a')](function(_0x14cb9d){_0x19e16a[_0xab1f('0x52')]=_0x14cb9d;return _0x19e16a;});}})[_0xab1f('0x1a')](respondWithFilteredResult(_0x36b5d2,_0x5118b3))['catch'](handleError(_0x36b5d2,null));};function char(_0x3d3f51){return _0xab1f('0x55')===typeof _0x3d3f51?String[_0xab1f('0x56')][_0xab1f('0x57')](null,arguments):_0x3d3f51;}function needsEncapsulation(_0xe851f7){return!!_0xe851f7&&(_0xe851f7['toString']()[_0xab1f('0x58')](char(0xd))>=0x0||_0xe851f7[_0xab1f('0x59')]()[_0xab1f('0x58')](char(0xa))>=0x0||_0xe851f7['toString']()[_0xab1f('0x58')](char(0x2c))>=0x0||_0xe851f7['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x21a891){var _0x44d765=char(0x22),_0x4e0da0='\x5c'+char(0x22),_0x1686c0=_0x21a891['toString']()['replace'](new RegExp(_0x44d765,'g'),_0x4e0da0);return _0x44d765+_0x1686c0+_0x44d765;}exports[_0xab1f('0x5a')]=function(_0x45af59,_0x461683,_0x3f9cd0){var _0x18b816,_0x2aa733;var _0x1bed49={'where':{'ProjectId':_0x45af59[_0xab1f('0x3e')]['id']}};if(_0x45af59[_0xab1f('0x29')]['startTime']){_0x1bed49[_0xab1f('0x32')]['starttime']=JSON['parse'](_0x45af59['query'][_0xab1f('0x5b')]);}return db[_0xab1f('0x4f')]['findAll'](_0x1bed49)[_0xab1f('0x1a')](handleEntityNotFound(_0x461683,null))[_0xab1f('0x1a')](function(_0x2d3a50){if(_0x2d3a50){_0x18b816=_0x2d3a50;return db[_0xab1f('0x5c')]['findAll']({'where':{'SessionId':{'$in':_[_0xab1f('0x23')](_0x18b816,'id')},'ProjectId':_0x45af59[_0xab1f('0x3e')]['id']},'order':_0xab1f('0x5d')});}})['then'](handleEntityNotFound(_0x461683,null))[_0xab1f('0x1a')](function(_0xa4ed29){if(_0xa4ed29){_0x2aa733=_0xa4ed29;var _0x4fea54={};for(var _0x1f14ed=0x0,_0x3b2ba0=_0x2aa733[_0xab1f('0x2e')];_0x1f14ed<_0x3b2ba0;_0x1f14ed++){if(!_0x4fea54[_0xab1f('0x2f')](_0x2aa733[_0x1f14ed][_0xab1f('0x5e')])){_0x4fea54[_0x2aa733[_0x1f14ed][_0xab1f('0x5e')]]=needsEncapsulation(_0x2aa733[_0x1f14ed][_0xab1f('0x5f')])?encapsulate(_0x2aa733[_0x1f14ed][_0xab1f('0x5f')]):_0x2aa733[_0x1f14ed][_0xab1f('0x5f')];}}var _0x19d501=[],_0x3ac58f={};for(var _0x14d6ff=0x0,_0x3d7d1f=_0x18b816[_0xab1f('0x2e')];_0x14d6ff<_0x3d7d1f;_0x14d6ff++){_0x3ac58f={'ProjectId':_0x45af59[_0xab1f('0x3e')]['id'],'SessionId':_0x18b816[_0x14d6ff]['id'],'StartTime':moment(_0x18b816[_0x14d6ff]['starttime'])[_0xab1f('0x60')](_0xab1f('0x61'))};for(var _0x377858=0x0,_0x1c8efd=_0x2aa733['length'];_0x377858<_0x1c8efd;_0x377858++){if(_0x2aa733[_0x377858][_0xab1f('0x62')]==_0x18b816[_0x14d6ff]['id']&&_0x4fea54['hasOwnProperty'](_0x2aa733[_0x377858]['questionId'])){_0x3ac58f[_0x4fea54[_0x2aa733[_0x377858]['questionId']]]=_0x2aa733[_0x377858][_0xab1f('0x63')];}}for(var _0x8a57e1 in _0x4fea54){if(!_0x3ac58f[_0xab1f('0x2f')](_0x4fea54[_0x8a57e1])){_0x3ac58f[_0x4fea54[_0x8a57e1]]=null;}}_0x19d501[_0xab1f('0x64')](_0x3ac58f);}return _0x19d501;}})[_0xab1f('0x1a')](function(_0x56fb8a){if(!_['isEmpty'](_0x56fb8a)){var _0x522fd2=toCsv(_0x56fb8a);var _0x5b2d62=Date[_0xab1f('0x65')]();fs[_0xab1f('0x66')](util[_0xab1f('0x60')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x45af59[_0xab1f('0x3e')]['id'],_0x5b2d62),_0x522fd2);_0x461683[_0xab1f('0x67')](_0xab1f('0x68'),_0xab1f('0x69')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x45af59['params']['id'],_0x5b2d62));_0x461683[_0xab1f('0x67')](_0xab1f('0x6a'),_0xab1f('0x6b'));return _0x461683[_0xab1f('0x6c')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x45af59[_0xab1f('0x3e')]['id'],_0x5b2d62));}else{return _0x461683[_0xab1f('0x6d')](0xcc);}})[_0xab1f('0x3c')](handleError(_0x461683,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 16c4801..f1fd457 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 _0x4491=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x58b44a,_0x1a7aa6){var _0xd6779d=function(_0x40d8f3){while(--_0x40d8f3){_0x58b44a['push'](_0x58b44a['shift']());}};_0xd6779d(++_0x1a7aa6);}(_0x4491,0x1bb));var _0x1449=function(_0x3b9464,_0x59ba3e){_0x3b9464=_0x3b9464-0x0;var _0x52e1f8=_0x4491[_0x3b9464];return _0x52e1f8;};'use strict';var _=require(_0x1449('0x0'));var util=require('util');var logger=require(_0x1449('0x1'))('api');var moment=require(_0x1449('0x2'));var BPromise=require(_0x1449('0x3'));var rp=require(_0x1449('0x4'));var fs=require('fs');var path=require(_0x1449('0x5'));var rimraf=require(_0x1449('0x6'));var config=require(_0x1449('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x1449('0x8')]=function(_0x557482,_0x1d45eb){return _0x557482[_0x1449('0x9')](_0x1449('0xa'),attributes,{'tableName':_0x1449('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb79=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects'];(function(_0x245d07,_0x7786c7){var _0x324186=function(_0x34e73c){while(--_0x34e73c){_0x245d07['push'](_0x245d07['shift']());}};_0x324186(++_0x7786c7);}(_0xeb79,0x87));var _0x9eb7=function(_0x47686b,_0x4c98c7){_0x47686b=_0x47686b-0x0;var _0xa0beaf=_0xeb79[_0x47686b];return _0xa0beaf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9eb7('0x0'))('api');var moment=require(_0x9eb7('0x1'));var BPromise=require('bluebird');var rp=require(_0x9eb7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eb7('0x3'));var config=require(_0x9eb7('0x4'));var attributes=require(_0x9eb7('0x5'));module[_0x9eb7('0x6')]=function(_0x58bc03,_0x501d0c){return _0x58bc03[_0x9eb7('0x7')]('JscriptyProject',attributes,{'tableName':_0x9eb7('0x8'),'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 b24f5a1..cd57da8 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x2548c9,_0x47fbcc){var _0x369f98=function(_0x259d89){while(--_0x259d89){_0x2548c9['push'](_0x2548c9['shift']());}};_0x369f98(++_0x47fbcc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0xcb91[_0x1f530d];return _0x22103f;};'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')]('JscriptyProject,\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 +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x50e5f1,_0x1cd56f){var _0x2f017e=function(_0x3a132f){while(--_0x3a132f){_0x50e5f1['push'](_0x50e5f1['shift']());}};_0x2f017e(++_0x1cd56f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2067d9,_0x2b2d89){_0x2067d9=_0x2067d9-0x0;var _0x1fa358=_0xb43b[_0x2067d9];return _0x1fa358;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 6f93754..3e78f79 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 _0x2df3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer'];(function(_0x12974f,_0x3f3394){var _0x46f9a0=function(_0x3acdde){while(--_0x3acdde){_0x12974f['push'](_0x12974f['shift']());}};_0x46f9a0(++_0x3f3394);}(_0x2df3,0x8b));var _0x32df=function(_0x46538c,_0x17cd67){_0x46538c=_0x46538c-0x0;var _0x37adb9=_0x2df3[_0x46538c];return _0x37adb9;};'use strict';var multer=require(_0x32df('0x0'));var util=require(_0x32df('0x1'));var path=require(_0x32df('0x2'));var timeout=require(_0x32df('0x3'));var express=require(_0x32df('0x4'));var router=express[_0x32df('0x5')]();var fs_extra=require(_0x32df('0x6'));var auth=require(_0x32df('0x7'));var interaction=require(_0x32df('0x8'));var config=require(_0x32df('0x9'));var controller=require(_0x32df('0xa'));router[_0x32df('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32df('0xb')]('/describe',auth[_0x32df('0xc')](),controller['describe']);router[_0x32df('0xb')](_0x32df('0xd'),auth[_0x32df('0xc')](),controller['show']);router[_0x32df('0xe')]('/',auth[_0x32df('0xc')](),controller[_0x32df('0xf')]);router[_0x32df('0x10')](_0x32df('0xd'),auth['isAuthenticated'](),controller[_0x32df('0x11')]);router['delete'](_0x32df('0xd'),auth[_0x32df('0xc')](),controller[_0x32df('0x12')]);module[_0x32df('0x13')]=router; \ No newline at end of file +var _0xc7f1=['/describe','/:id','show','create','put','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index'];(function(_0x20d168,_0x5214be){var _0x15ec18=function(_0x18d99f){while(--_0x18d99f){_0x20d168['push'](_0x20d168['shift']());}};_0x15ec18(++_0x5214be);}(_0xc7f1,0x1da));var _0x1c7f=function(_0x3e88b7,_0x5b98a1){_0x3e88b7=_0x3e88b7-0x0;var _0x4fa7f5=_0xc7f1[_0x3e88b7];return _0x4fa7f5;};'use strict';var multer=require(_0x1c7f('0x0'));var util=require(_0x1c7f('0x1'));var path=require(_0x1c7f('0x2'));var timeout=require(_0x1c7f('0x3'));var express=require('express');var router=express[_0x1c7f('0x4')]();var fs_extra=require(_0x1c7f('0x5'));var auth=require(_0x1c7f('0x6'));var interaction=require(_0x1c7f('0x7'));var config=require(_0x1c7f('0x8'));var controller=require(_0x1c7f('0x9'));router['get']('/',auth[_0x1c7f('0xa')](),controller[_0x1c7f('0xb')]);router['get'](_0x1c7f('0xc'),auth[_0x1c7f('0xa')](),controller['describe']);router['get'](_0x1c7f('0xd'),auth['isAuthenticated'](),controller[_0x1c7f('0xe')]);router['post']('/',auth[_0x1c7f('0xa')](),controller[_0x1c7f('0xf')]);router[_0x1c7f('0x10')]('/:id',auth[_0x1c7f('0xa')](),controller['update']);router['delete'](_0x1c7f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1c7f('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index bffe928..a88aeb1 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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x4f5921,_0x197765){_0x4f5921=_0x4f5921-0x0;var _0x52d5fc=_0x7a54[_0x4f5921];return _0x52d5fc;};'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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x5a2c31,_0x2d1faa){_0x5a2c31=_0x5a2c31-0x0;var _0x5473d8=_0x7a54[_0x5a2c31];return _0x5473d8;};'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 a756fb8..1e1ad25 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 _0x62a8=['fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','JscriptyQuestionReport','includeAll','findAll','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x62a8,0x142));var _0x862a=function(_0x2697fe,_0x2c04dd){_0x2697fe=_0x2697fe-0x0;var _0x48b4e1=_0x62a8[_0x2697fe];return _0x48b4e1;};'use strict';var emlformat=require(_0x862a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x862a('0x1'));var jsonpatch=require(_0x862a('0x2'));var rp=require(_0x862a('0x3'));var moment=require(_0x862a('0x4'));var BPromise=require(_0x862a('0x5'));var Mustache=require(_0x862a('0x6'));var util=require(_0x862a('0x7'));var path=require(_0x862a('0x8'));var sox=require(_0x862a('0x9'));var csv=require(_0x862a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x862a('0xb'));var _=require('lodash');var squel=require(_0x862a('0xc'));var crypto=require(_0x862a('0xd'));var jsforce=require(_0x862a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x862a('0xf'));var Papa=require(_0x862a('0x10'));var Redis=require(_0x862a('0x11'));var authService=require(_0x862a('0x12'));var qs=require(_0x862a('0x13'));var as=require(_0x862a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x862a('0x15'));var utils=require('../../config/utils');var config=require(_0x862a('0x16'));var licenseUtil=require(_0x862a('0x17'));var db=require(_0x862a('0x18'))['db'];function respondWithStatusCode(_0x4bdc84,_0x3af92c){_0x3af92c=_0x3af92c||0xcc;return function(_0x8cfe5a){if(_0x8cfe5a){return _0x4bdc84['sendStatus'](_0x3af92c);}return _0x4bdc84['status'](_0x3af92c)[_0x862a('0x19')]();};}function respondWithResult(_0x491d3b,_0x356cf2){_0x356cf2=_0x356cf2||0xc8;return function(_0x10c4dd){if(_0x10c4dd){return _0x491d3b[_0x862a('0x1a')](_0x356cf2)[_0x862a('0x1b')](_0x10c4dd);}};}function respondWithFilteredResult(_0x2a11b1,_0x3246d6){return function(_0x251be3){if(_0x251be3){var _0x2c2652=typeof _0x3246d6[_0x862a('0x1c')]===_0x862a('0x1d')&&typeof _0x3246d6[_0x862a('0x1e')]===_0x862a('0x1d');var _0x4f4a76=_0x251be3[_0x862a('0x1f')];var _0x298bbb=_0x2c2652?0x0:_0x3246d6['offset'];var _0x1be16c=_0x2c2652?_0x251be3[_0x862a('0x1f')]:_0x3246d6['offset']+_0x3246d6[_0x862a('0x1e')];var _0x5d27fa;if(_0x1be16c>=_0x4f4a76){_0x1be16c=_0x4f4a76;_0x5d27fa=0xc8;}else{_0x5d27fa=0xce;}_0x2a11b1['status'](_0x5d27fa);return _0x2a11b1[_0x862a('0x20')](_0x862a('0x21'),_0x298bbb+'-'+_0x1be16c+'/'+_0x4f4a76)['json'](_0x251be3);}return null;};}function patchUpdates(_0x1c0457){return function(_0x149954){try{jsonpatch[_0x862a('0x22')](_0x149954,_0x1c0457,!![]);}catch(_0x5db1b3){return BPromise['reject'](_0x5db1b3);}return _0x149954[_0x862a('0x23')]();};}function saveUpdates(_0x1887b7,_0x917774){return function(_0x58a04c){if(_0x58a04c){return _0x58a04c[_0x862a('0x24')](_0x1887b7)[_0x862a('0x25')](function(_0x3bd42e){return _0x3bd42e;});}return null;};}function removeEntity(_0x18ed66,_0x30154f){return function(_0x38973f){if(_0x38973f){return _0x38973f[_0x862a('0x26')]()[_0x862a('0x25')](function(){_0x18ed66[_0x862a('0x1a')](0xcc)[_0x862a('0x19')]();});}};}function handleEntityNotFound(_0x1d823c,_0x3f5b53){return function(_0x7f2897){if(!_0x7f2897){_0x1d823c[_0x862a('0x27')](0x194);}return _0x7f2897;};}function handleError(_0x3fa757,_0x324596){_0x324596=_0x324596||0x1f4;return function(_0x54a8a0){logger['error'](_0x54a8a0[_0x862a('0x28')]);if(_0x54a8a0[_0x862a('0x29')]){delete _0x54a8a0[_0x862a('0x29')];}_0x3fa757[_0x862a('0x1a')](_0x324596)['send'](_0x54a8a0);};}exports[_0x862a('0x2a')]=function(_0x435b6d,_0x4bafdf){var _0x557aa1={},_0x50db2f={},_0x2e8c08={'count':0x0,'rows':[]};var _0x2d6653=_[_0x862a('0x2b')](db['JscriptyQuestionReport'][_0x862a('0x2c')],function(_0x4b45bd){return{'name':_0x4b45bd[_0x862a('0x2d')],'type':_0x4b45bd[_0x862a('0x2e')][_0x862a('0x2f')]};});_0x50db2f[_0x862a('0x30')]=_[_0x862a('0x2b')](_0x2d6653,_0x862a('0x29'));_0x50db2f[_0x862a('0x31')]=_[_0x862a('0x32')](_0x435b6d[_0x862a('0x31')]);_0x50db2f['filters']=_['intersection'](_0x50db2f['model'],_0x50db2f[_0x862a('0x31')]);_0x557aa1[_0x862a('0x33')]=_[_0x862a('0x34')](_0x50db2f[_0x862a('0x30')],qs[_0x862a('0x35')](_0x435b6d[_0x862a('0x31')]['fields']));_0x557aa1['attributes']=_0x557aa1[_0x862a('0x33')][_0x862a('0x36')]?_0x557aa1[_0x862a('0x33')]:_0x50db2f[_0x862a('0x30')];if(!_0x435b6d[_0x862a('0x31')]['hasOwnProperty'](_0x862a('0x37'))){_0x557aa1['limit']=qs['limit'](_0x435b6d['query'][_0x862a('0x1e')]);_0x557aa1[_0x862a('0x1c')]=qs[_0x862a('0x1c')](_0x435b6d[_0x862a('0x31')][_0x862a('0x1c')]);}_0x557aa1[_0x862a('0x38')]=qs[_0x862a('0x39')](_0x435b6d[_0x862a('0x31')][_0x862a('0x39')]);_0x557aa1['where']=qs[_0x862a('0x3a')](_[_0x862a('0x3b')](_0x435b6d['query'],_0x50db2f[_0x862a('0x3a')]),_0x2d6653);if(_0x435b6d['query'][_0x862a('0x3c')]){_0x557aa1[_0x862a('0x3d')]=_['merge'](_0x557aa1['where'],{'$or':_[_0x862a('0x2b')](_0x2d6653,function(_0x255314){if(_0x255314[_0x862a('0x2e')]!==_0x862a('0x3e')){var _0x44e0cc={};_0x44e0cc[_0x255314[_0x862a('0x29')]]={'$like':'%'+_0x435b6d['query'][_0x862a('0x3c')]+'%'};return _0x44e0cc;}})});}_0x557aa1=_[_0x862a('0x3f')]({},_0x557aa1,_0x435b6d['options']);var _0x6c4bf7={'where':_0x557aa1['where']};return db[_0x862a('0x40')]['count'](_0x6c4bf7)[_0x862a('0x25')](function(_0x482449){_0x2e8c08[_0x862a('0x1f')]=_0x482449;if(_0x435b6d[_0x862a('0x31')][_0x862a('0x41')]){_0x557aa1['include']=[{'all':!![]}];}return db[_0x862a('0x40')][_0x862a('0x42')](_0x557aa1);})[_0x862a('0x25')](function(_0x549148){_0x2e8c08['rows']=_0x549148;return _0x2e8c08;})[_0x862a('0x25')](respondWithFilteredResult(_0x4bafdf,_0x557aa1))[_0x862a('0x43')](handleError(_0x4bafdf,null));};exports[_0x862a('0x44')]=function(_0x3ce466,_0x307999){var _0x21a584={'raw':!![],'where':{'id':_0x3ce466['params']['id']}},_0x5471b6={};_0x5471b6[_0x862a('0x30')]=_[_0x862a('0x32')](db[_0x862a('0x40')][_0x862a('0x2c')]);_0x5471b6[_0x862a('0x31')]=_[_0x862a('0x32')](_0x3ce466['query']);_0x5471b6[_0x862a('0x3a')]=_[_0x862a('0x34')](_0x5471b6['model'],_0x5471b6[_0x862a('0x31')]);_0x21a584[_0x862a('0x33')]=_[_0x862a('0x34')](_0x5471b6[_0x862a('0x30')],qs['fields'](_0x3ce466[_0x862a('0x31')]['fields']));_0x21a584[_0x862a('0x33')]=_0x21a584[_0x862a('0x33')][_0x862a('0x36')]?_0x21a584[_0x862a('0x33')]:_0x5471b6['model'];if(_0x3ce466[_0x862a('0x31')][_0x862a('0x41')]){_0x21a584[_0x862a('0x45')]=[{'all':!![]}];}_0x21a584=_[_0x862a('0x3f')]({},_0x21a584,_0x3ce466['options']);return db[_0x862a('0x40')][_0x862a('0x46')](_0x21a584)[_0x862a('0x25')](handleEntityNotFound(_0x307999,null))[_0x862a('0x25')](respondWithResult(_0x307999,null))[_0x862a('0x43')](handleError(_0x307999,null));};exports[_0x862a('0x47')]=function(_0x2966d7,_0x1c1111){return db[_0x862a('0x40')][_0x862a('0x47')](_0x2966d7['body'],{})['then'](respondWithResult(_0x1c1111,0xc9))[_0x862a('0x43')](handleError(_0x1c1111,null));};exports[_0x862a('0x24')]=function(_0x571189,_0x8a94dc){if(_0x571189[_0x862a('0x48')]['id']){delete _0x571189[_0x862a('0x48')]['id'];}return db[_0x862a('0x40')][_0x862a('0x46')]({'where':{'id':_0x571189[_0x862a('0x49')]['id']}})[_0x862a('0x25')](handleEntityNotFound(_0x8a94dc,null))[_0x862a('0x25')](saveUpdates(_0x571189[_0x862a('0x48')],null))[_0x862a('0x25')](respondWithResult(_0x8a94dc,null))['catch'](handleError(_0x8a94dc,null));};exports['destroy']=function(_0xb7ea7e,_0x4c8721){return db[_0x862a('0x40')][_0x862a('0x46')]({'where':{'id':_0xb7ea7e[_0x862a('0x49')]['id']}})[_0x862a('0x25')](handleEntityNotFound(_0x4c8721,null))[_0x862a('0x25')](removeEntity(_0x4c8721,null))[_0x862a('0x43')](handleError(_0x4c8721,null));};exports[_0x862a('0x4a')]=function(_0x5482ef,_0x287670){return db[_0x862a('0x40')][_0x862a('0x4a')]()[_0x862a('0x25')](respondWithResult(_0x287670,null))['catch'](handleError(_0x287670,null));}; \ No newline at end of file +var _0x1711=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x45a862,_0x26892a){var _0x88ce56=function(_0x231d6a){while(--_0x231d6a){_0x45a862['push'](_0x45a862['shift']());}};_0x88ce56(++_0x26892a);}(_0x1711,0xc0));var _0x1171=function(_0x337de0,_0x44c6bb){_0x337de0=_0x337de0-0x0;var _0x481d60=_0x1711[_0x337de0];return _0x481d60;};'use strict';var emlformat=require(_0x1171('0x0'));var rimraf=require(_0x1171('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1171('0x2'));var BPromise=require(_0x1171('0x3'));var Mustache=require(_0x1171('0x4'));var util=require('util');var path=require(_0x1171('0x5'));var sox=require(_0x1171('0x6'));var csv=require(_0x1171('0x7'));var ejs=require(_0x1171('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1171('0x9'));var squel=require(_0x1171('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1171('0xb'));var toCsv=require(_0x1171('0x7'));var querystring=require('querystring');var Papa=require(_0x1171('0xc'));var Redis=require(_0x1171('0xd'));var authService=require(_0x1171('0xe'));var qs=require(_0x1171('0xf'));var as=require(_0x1171('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1171('0x11'))('api');var utils=require(_0x1171('0x12'));var config=require(_0x1171('0x13'));var licenseUtil=require(_0x1171('0x14'));var db=require(_0x1171('0x15'))['db'];function respondWithStatusCode(_0x4db7f6,_0x565d3c){_0x565d3c=_0x565d3c||0xcc;return function(_0x12f5ea){if(_0x12f5ea){return _0x4db7f6[_0x1171('0x16')](_0x565d3c);}return _0x4db7f6[_0x1171('0x17')](_0x565d3c)[_0x1171('0x18')]();};}function respondWithResult(_0x12d8c4,_0x762e97){_0x762e97=_0x762e97||0xc8;return function(_0x1a53a2){if(_0x1a53a2){return _0x12d8c4['status'](_0x762e97)[_0x1171('0x19')](_0x1a53a2);}};}function respondWithFilteredResult(_0x59afb3,_0x4ab65e){return function(_0x2afbe8){if(_0x2afbe8){var _0x357779=typeof _0x4ab65e[_0x1171('0x1a')]==='undefined'&&typeof _0x4ab65e['limit']===_0x1171('0x1b');var _0x1abb9d=_0x2afbe8[_0x1171('0x1c')];var _0x3d8255=_0x357779?0x0:_0x4ab65e[_0x1171('0x1a')];var _0x3203c7=_0x357779?_0x2afbe8['count']:_0x4ab65e[_0x1171('0x1a')]+_0x4ab65e[_0x1171('0x1d')];var _0x5c2c96;if(_0x3203c7>=_0x1abb9d){_0x3203c7=_0x1abb9d;_0x5c2c96=0xc8;}else{_0x5c2c96=0xce;}_0x59afb3[_0x1171('0x17')](_0x5c2c96);return _0x59afb3[_0x1171('0x1e')](_0x1171('0x1f'),_0x3d8255+'-'+_0x3203c7+'/'+_0x1abb9d)[_0x1171('0x19')](_0x2afbe8);}return null;};}function patchUpdates(_0x791e16){return function(_0x4b4fec){try{jsonpatch['apply'](_0x4b4fec,_0x791e16,!![]);}catch(_0x258c84){return BPromise[_0x1171('0x20')](_0x258c84);}return _0x4b4fec['save']();};}function saveUpdates(_0x41842c,_0x2cbf6f){return function(_0x931ec4){if(_0x931ec4){return _0x931ec4[_0x1171('0x21')](_0x41842c)[_0x1171('0x22')](function(_0x537257){return _0x537257;});}return null;};}function removeEntity(_0x2db745,_0x1691d0){return function(_0x878cdd){if(_0x878cdd){return _0x878cdd[_0x1171('0x23')]()[_0x1171('0x22')](function(){_0x2db745[_0x1171('0x17')](0xcc)[_0x1171('0x18')]();});}};}function handleEntityNotFound(_0x310823,_0x3c07fb){return function(_0x49131d){if(!_0x49131d){_0x310823[_0x1171('0x16')](0x194);}return _0x49131d;};}function handleError(_0x4d14d5,_0x72c3d9){_0x72c3d9=_0x72c3d9||0x1f4;return function(_0x1b1fa3){logger[_0x1171('0x24')](_0x1b1fa3[_0x1171('0x25')]);if(_0x1b1fa3[_0x1171('0x26')]){delete _0x1b1fa3[_0x1171('0x26')];}_0x4d14d5[_0x1171('0x17')](_0x72c3d9)[_0x1171('0x27')](_0x1b1fa3);};}exports['index']=function(_0x114492,_0x678d08){var _0x47eb27={},_0x50c8a9={},_0x58a79f={'count':0x0,'rows':[]};var _0x76844a=_[_0x1171('0x28')](db['JscriptyQuestionReport'][_0x1171('0x29')],function(_0xb8f97a){return{'name':_0xb8f97a['fieldName'],'type':_0xb8f97a[_0x1171('0x2a')][_0x1171('0x2b')]};});_0x50c8a9['model']=_['map'](_0x76844a,_0x1171('0x26'));_0x50c8a9[_0x1171('0x2c')]=_[_0x1171('0x2d')](_0x114492[_0x1171('0x2c')]);_0x50c8a9[_0x1171('0x2e')]=_[_0x1171('0x2f')](_0x50c8a9[_0x1171('0x30')],_0x50c8a9[_0x1171('0x2c')]);_0x47eb27['attributes']=_[_0x1171('0x2f')](_0x50c8a9['model'],qs[_0x1171('0x31')](_0x114492[_0x1171('0x2c')][_0x1171('0x31')]));_0x47eb27[_0x1171('0x32')]=_0x47eb27[_0x1171('0x32')][_0x1171('0x33')]?_0x47eb27[_0x1171('0x32')]:_0x50c8a9[_0x1171('0x30')];if(!_0x114492[_0x1171('0x2c')][_0x1171('0x34')]('nolimit')){_0x47eb27[_0x1171('0x1d')]=qs[_0x1171('0x1d')](_0x114492[_0x1171('0x2c')]['limit']);_0x47eb27[_0x1171('0x1a')]=qs[_0x1171('0x1a')](_0x114492[_0x1171('0x2c')][_0x1171('0x1a')]);}_0x47eb27['order']=qs[_0x1171('0x35')](_0x114492[_0x1171('0x2c')]['sort']);_0x47eb27[_0x1171('0x36')]=qs[_0x1171('0x2e')](_[_0x1171('0x37')](_0x114492[_0x1171('0x2c')],_0x50c8a9[_0x1171('0x2e')]),_0x76844a);if(_0x114492['query'][_0x1171('0x38')]){_0x47eb27[_0x1171('0x36')]=_[_0x1171('0x39')](_0x47eb27[_0x1171('0x36')],{'$or':_['map'](_0x76844a,function(_0x2a19ba){if(_0x2a19ba[_0x1171('0x2a')]!==_0x1171('0x3a')){var _0x48c91f={};_0x48c91f[_0x2a19ba[_0x1171('0x26')]]={'$like':'%'+_0x114492[_0x1171('0x2c')][_0x1171('0x38')]+'%'};return _0x48c91f;}})});}_0x47eb27=_[_0x1171('0x39')]({},_0x47eb27,_0x114492[_0x1171('0x3b')]);var _0x52acb5={'where':_0x47eb27[_0x1171('0x36')]};return db[_0x1171('0x3c')][_0x1171('0x1c')](_0x52acb5)[_0x1171('0x22')](function(_0x3a521b){_0x58a79f[_0x1171('0x1c')]=_0x3a521b;if(_0x114492['query']['includeAll']){_0x47eb27[_0x1171('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x47eb27);})[_0x1171('0x22')](function(_0x1d6888){_0x58a79f[_0x1171('0x3e')]=_0x1d6888;return _0x58a79f;})[_0x1171('0x22')](respondWithFilteredResult(_0x678d08,_0x47eb27))[_0x1171('0x3f')](handleError(_0x678d08,null));};exports[_0x1171('0x40')]=function(_0x39b8bc,_0xcebda4){var _0x1df2dd={'raw':!![],'where':{'id':_0x39b8bc[_0x1171('0x41')]['id']}},_0x566c84={};_0x566c84['model']=_['keys'](db[_0x1171('0x3c')][_0x1171('0x29')]);_0x566c84[_0x1171('0x2c')]=_[_0x1171('0x2d')](_0x39b8bc[_0x1171('0x2c')]);_0x566c84['filters']=_[_0x1171('0x2f')](_0x566c84[_0x1171('0x30')],_0x566c84[_0x1171('0x2c')]);_0x1df2dd[_0x1171('0x32')]=_[_0x1171('0x2f')](_0x566c84[_0x1171('0x30')],qs[_0x1171('0x31')](_0x39b8bc[_0x1171('0x2c')][_0x1171('0x31')]));_0x1df2dd[_0x1171('0x32')]=_0x1df2dd[_0x1171('0x32')][_0x1171('0x33')]?_0x1df2dd['attributes']:_0x566c84['model'];if(_0x39b8bc['query'][_0x1171('0x42')]){_0x1df2dd[_0x1171('0x3d')]=[{'all':!![]}];}_0x1df2dd=_['merge']({},_0x1df2dd,_0x39b8bc[_0x1171('0x3b')]);return db['JscriptyQuestionReport'][_0x1171('0x43')](_0x1df2dd)[_0x1171('0x22')](handleEntityNotFound(_0xcebda4,null))[_0x1171('0x22')](respondWithResult(_0xcebda4,null))[_0x1171('0x3f')](handleError(_0xcebda4,null));};exports[_0x1171('0x44')]=function(_0x1b3202,_0x4ab67b){return db[_0x1171('0x3c')][_0x1171('0x44')](_0x1b3202['body'],{})[_0x1171('0x22')](respondWithResult(_0x4ab67b,0xc9))[_0x1171('0x3f')](handleError(_0x4ab67b,null));};exports['update']=function(_0x1202f4,_0x54f309){if(_0x1202f4['body']['id']){delete _0x1202f4[_0x1171('0x45')]['id'];}return db[_0x1171('0x3c')]['find']({'where':{'id':_0x1202f4[_0x1171('0x41')]['id']}})[_0x1171('0x22')](handleEntityNotFound(_0x54f309,null))[_0x1171('0x22')](saveUpdates(_0x1202f4[_0x1171('0x45')],null))[_0x1171('0x22')](respondWithResult(_0x54f309,null))['catch'](handleError(_0x54f309,null));};exports[_0x1171('0x23')]=function(_0x48f139,_0x117af5){return db[_0x1171('0x3c')][_0x1171('0x43')]({'where':{'id':_0x48f139[_0x1171('0x41')]['id']}})['then'](handleEntityNotFound(_0x117af5,null))[_0x1171('0x22')](removeEntity(_0x117af5,null))['catch'](handleError(_0x117af5,null));};exports[_0x1171('0x46')]=function(_0x38a805,_0x17bd8b){return db[_0x1171('0x3c')][_0x1171('0x46')]()[_0x1171('0x22')](respondWithResult(_0x17bd8b,null))[_0x1171('0x3f')](handleError(_0x17bd8b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 867e09a..8e2d097 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 _0x0db3=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9c6c7d,_0x2d8484){var _0x433f1e=function(_0x2ba713){while(--_0x2ba713){_0x9c6c7d['push'](_0x9c6c7d['shift']());}};_0x433f1e(++_0x2d8484);}(_0x0db3,0x147));var _0x30db=function(_0x2e83f7,_0x574d85){_0x2e83f7=_0x2e83f7-0x0;var _0x57ec20=_0x0db3[_0x2e83f7];return _0x57ec20;};'use strict';var _=require(_0x30db('0x0'));var util=require(_0x30db('0x1'));var logger=require(_0x30db('0x2'))(_0x30db('0x3'));var moment=require(_0x30db('0x4'));var BPromise=require(_0x30db('0x5'));var rp=require(_0x30db('0x6'));var fs=require('fs');var path=require(_0x30db('0x7'));var rimraf=require(_0x30db('0x8'));var config=require(_0x30db('0x9'));var attributes=require(_0x30db('0xa'));module[_0x30db('0xb')]=function(_0x4ed03b,_0x18cacf){return _0x4ed03b[_0x30db('0xc')](_0x30db('0xd'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cb0=['api','moment','bluebird','request-promise','path','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x33783a,_0x22f32e){var _0x4351c4=function(_0x29fa97){while(--_0x29fa97){_0x33783a['push'](_0x33783a['shift']());}};_0x4351c4(++_0x22f32e);}(_0x5cb0,0x105));var _0x05cb=function(_0x59a3e8,_0x28bec8){_0x59a3e8=_0x59a3e8-0x0;var _0x5958bb=_0x5cb0[_0x59a3e8];return _0x5958bb;};'use strict';var _=require(_0x05cb('0x0'));var util=require(_0x05cb('0x1'));var logger=require(_0x05cb('0x2'))(_0x05cb('0x3'));var moment=require(_0x05cb('0x4'));var BPromise=require(_0x05cb('0x5'));var rp=require(_0x05cb('0x6'));var fs=require('fs');var path=require(_0x05cb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x05cb('0x8'));module['exports']=function(_0x52f72a,_0x4cd85b){return _0x52f72a[_0x05cb('0x9')](_0x05cb('0xa'),attributes,{'tableName':_0x05cb('0xb'),'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 b0551bf..aa59a28 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 _0x14ae=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','bluebird','randomstring'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x14ae,0x141));var _0xe14a=function(_0x465154,_0xa33b26){_0x465154=_0x465154-0x0;var _0x561b8f=_0x14ae[_0x465154];return _0x561b8f;};'use strict';var _=require(_0xe14a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe14a('0x1'));var rs=require(_0xe14a('0x2'));var fs=require('fs');var Redis=require(_0xe14a('0x3'));var db=require(_0xe14a('0x4'))['db'];var utils=require(_0xe14a('0x5'));var logger=require('../../config/logger')(_0xe14a('0x6'));var config=require(_0xe14a('0x7'));var jayson=require(_0xe14a('0x8'));var client=jayson[_0xe14a('0x9')][_0xe14a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x546096,_0x3b25a4,_0x90766c){return new BPromise(function(_0x2b1b3f,_0x12ea33){return client[_0xe14a('0xb')](_0x546096,_0x90766c)['then'](function(_0x161f7b){logger[_0xe14a('0xc')](_0xe14a('0xd'),_0x3b25a4,_0xe14a('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3b25a4,_0xe14a('0xe'),JSON['stringify'](_0x161f7b));if(_0x161f7b[_0xe14a('0xf')]){if(_0x161f7b[_0xe14a('0xf')]['code']===0x1f4){logger[_0xe14a('0xf')](_0xe14a('0xd'),_0x3b25a4,_0x161f7b[_0xe14a('0xf')][_0xe14a('0x10')]);return _0x12ea33(_0x161f7b[_0xe14a('0xf')][_0xe14a('0x10')]);}logger[_0xe14a('0xf')](_0xe14a('0xd'),_0x3b25a4,_0x161f7b[_0xe14a('0xf')][_0xe14a('0x10')]);return _0x2b1b3f(_0x161f7b[_0xe14a('0xf')][_0xe14a('0x10')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3b25a4,_0xe14a('0xe'));_0x2b1b3f(_0x161f7b['result'][_0xe14a('0x10')]);}})[_0xe14a('0x11')](function(_0x214345){logger[_0xe14a('0xf')](_0xe14a('0xd'),_0x3b25a4,_0x214345);_0x12ea33(_0x214345);});});} \ No newline at end of file +var _0xf8d8=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x155788,_0xf6e32f){var _0x4fddcd=function(_0x3b478c){while(--_0x3b478c){_0x155788['push'](_0x155788['shift']());}};_0x4fddcd(++_0xf6e32f);}(_0xf8d8,0x17e));var _0x8f8d=function(_0x559e51,_0x2836f7){_0x559e51=_0x559e51-0x0;var _0x3d228c=_0xf8d8[_0x559e51];return _0x3d228c;};'use strict';var _=require(_0x8f8d('0x0'));var util=require('util');var moment=require(_0x8f8d('0x1'));var BPromise=require(_0x8f8d('0x2'));var rs=require(_0x8f8d('0x3'));var fs=require('fs');var Redis=require(_0x8f8d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f8d('0x5'));var logger=require(_0x8f8d('0x6'))(_0x8f8d('0x7'));var config=require(_0x8f8d('0x8'));var jayson=require(_0x8f8d('0x9'));var client=jayson['client'][_0x8f8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b1a29,_0x440e23,_0x2ff291){return new BPromise(function(_0x211f6a,_0x5de725){return client[_0x8f8d('0xb')](_0x2b1a29,_0x2ff291)[_0x8f8d('0xc')](function(_0x6161df){logger[_0x8f8d('0xd')](_0x8f8d('0xe'),_0x440e23,_0x8f8d('0xf'));logger[_0x8f8d('0x10')](_0x8f8d('0x11'),_0x440e23,_0x8f8d('0xf'),JSON['stringify'](_0x6161df));if(_0x6161df[_0x8f8d('0x12')]){if(_0x6161df[_0x8f8d('0x12')]['code']===0x1f4){logger[_0x8f8d('0x12')](_0x8f8d('0xe'),_0x440e23,_0x6161df[_0x8f8d('0x12')][_0x8f8d('0x13')]);return _0x5de725(_0x6161df[_0x8f8d('0x12')][_0x8f8d('0x13')]);}logger[_0x8f8d('0x12')](_0x8f8d('0xe'),_0x440e23,_0x6161df[_0x8f8d('0x12')]['message']);return _0x211f6a(_0x6161df['error'][_0x8f8d('0x13')]);}else{logger[_0x8f8d('0xd')](_0x8f8d('0xe'),_0x440e23,_0x8f8d('0xf'));_0x211f6a(_0x6161df[_0x8f8d('0x14')][_0x8f8d('0x13')]);}})['catch'](function(_0x22d522){logger[_0x8f8d('0x12')](_0x8f8d('0xe'),_0x440e23,_0x22d522);_0x5de725(_0x22d522);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a32aad3..8a2f7e2 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 _0x061f=['delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','update'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x061f,0x17e));var _0xf061=function(_0x41fc63,_0x927b6c){_0x41fc63=_0x41fc63-0x0;var _0x40492a=_0x061f[_0x41fc63];return _0x40492a;};'use strict';var multer=require(_0xf061('0x0'));var util=require(_0xf061('0x1'));var path=require('path');var timeout=require(_0xf061('0x2'));var express=require('express');var router=express[_0xf061('0x3')]();var fs_extra=require(_0xf061('0x4'));var auth=require(_0xf061('0x5'));var interaction=require(_0xf061('0x6'));var config=require(_0xf061('0x7'));var controller=require(_0xf061('0x8'));router[_0xf061('0x9')]('/',auth[_0xf061('0xa')](),controller['index']);router[_0xf061('0x9')](_0xf061('0xb'),auth[_0xf061('0xa')](),controller[_0xf061('0xc')]);router[_0xf061('0x9')](_0xf061('0xd'),auth['isAuthenticated'](),controller[_0xf061('0xe')]);router[_0xf061('0x9')]('/:id/questions',auth[_0xf061('0xa')](),controller['getQuestions']);router['post']('/',auth[_0xf061('0xa')](),controller[_0xf061('0xf')]);router['put'](_0xf061('0xd'),auth['isAuthenticated'](),controller[_0xf061('0x10')]);router[_0xf061('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf061('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd711=['index','/describe','describe','/:id','show','/:id/questions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0x207a83,_0x453824){var _0x3186e4=function(_0x57c8a8){while(--_0x57c8a8){_0x207a83['push'](_0x207a83['shift']());}};_0x3186e4(++_0x453824);}(_0xd711,0xa3));var _0x1d71=function(_0x1c8e23,_0x2c6a85){_0x1c8e23=_0x1c8e23-0x0;var _0x3a3ebc=_0xd711[_0x1c8e23];return _0x3a3ebc;};'use strict';var multer=require(_0x1d71('0x0'));var util=require('util');var path=require(_0x1d71('0x1'));var timeout=require(_0x1d71('0x2'));var express=require(_0x1d71('0x3'));var router=express[_0x1d71('0x4')]();var fs_extra=require(_0x1d71('0x5'));var auth=require(_0x1d71('0x6'));var interaction=require(_0x1d71('0x7'));var config=require(_0x1d71('0x8'));var controller=require(_0x1d71('0x9'));router[_0x1d71('0xa')]('/',auth[_0x1d71('0xb')](),controller[_0x1d71('0xc')]);router[_0x1d71('0xa')](_0x1d71('0xd'),auth['isAuthenticated'](),controller[_0x1d71('0xe')]);router['get'](_0x1d71('0xf'),auth['isAuthenticated'](),controller[_0x1d71('0x10')]);router[_0x1d71('0xa')](_0x1d71('0x11'),auth[_0x1d71('0xb')](),controller['getQuestions']);router[_0x1d71('0x12')]('/',auth[_0x1d71('0xb')](),controller[_0x1d71('0x13')]);router[_0x1d71('0x14')]('/:id',auth[_0x1d71('0xb')](),controller[_0x1d71('0x15')]);router[_0x1d71('0x16')]('/:id',auth[_0x1d71('0xb')](),controller[_0x1d71('0x17')]);module[_0x1d71('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 8b29cab..454d683 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 _0x094f=['sequelize','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x38a13a,_0x2b0ac0){var _0x37f0d6=function(_0x112d09){while(--_0x112d09){_0x38a13a['push'](_0x38a13a['shift']());}};_0x37f0d6(++_0x2b0ac0);}(_0x094f,0x150));var _0xf094=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x094f[_0x1b6c6d];return _0x290d9d;};'use strict';var moment=require('moment');var Sequelize=require(_0xf094('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xf094('0x1')],'set':function(_0x303695){this[_0xf094('0x2')]('starttime',_0x303695);this['setDataValue'](_0xf094('0x3'),moment()['format'](_0xf094('0x4')));}},'endtime':{'type':Sequelize[_0xf094('0x1')]},'membername':{'type':Sequelize[_0xf094('0x5')]},'projectname':{'type':Sequelize[_0xf094('0x5')]},'queue':{'type':Sequelize[_0xf094('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf094('0x5')]},'calleridnum':{'type':Sequelize[_0xf094('0x5')]},'completed':{'type':Sequelize[_0xf094('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x62ce=['STRING','BOOLEAN','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x49dc3f,_0x142303){var _0x3c109a=function(_0x5993b3){while(--_0x5993b3){_0x49dc3f['push'](_0x49dc3f['shift']());}};_0x3c109a(++_0x142303);}(_0x62ce,0x1a6));var _0xe62c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x62ce[_0x397e5f];return _0x5302b8;};'use strict';var moment=require('moment');var Sequelize=require(_0xe62c('0x0'));module[_0xe62c('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x53afb0){this[_0xe62c('0x2')](_0xe62c('0x3'),_0x53afb0);this['setDataValue'](_0xe62c('0x4'),moment()[_0xe62c('0x5')](_0xe62c('0x6')));}},'endtime':{'type':Sequelize[_0xe62c('0x7')]},'membername':{'type':Sequelize[_0xe62c('0x8')]},'projectname':{'type':Sequelize[_0xe62c('0x8')]},'queue':{'type':Sequelize[_0xe62c('0x8')]},'uniqueid':{'type':Sequelize[_0xe62c('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xe62c('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 946aac7..b541a18 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 _0xd913=['show','params','include','find','create','body','catch','describe','findOne','JscriptyQuestionReport','pick','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xd913,0xb4));var _0x3d91=function(_0x1009fa,_0x40aa84){_0x1009fa=_0x1009fa-0x0;var _0x2508f9=_0xd913[_0x1009fa];return _0x2508f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d91('0x0'));var zipdir=require(_0x3d91('0x1'));var jsonpatch=require(_0x3d91('0x2'));var rp=require(_0x3d91('0x3'));var moment=require(_0x3d91('0x4'));var BPromise=require(_0x3d91('0x5'));var Mustache=require(_0x3d91('0x6'));var util=require(_0x3d91('0x7'));var path=require(_0x3d91('0x8'));var sox=require(_0x3d91('0x9'));var csv=require(_0x3d91('0xa'));var ejs=require(_0x3d91('0xb'));var fs=require('fs');var fs_extra=require(_0x3d91('0xc'));var _=require(_0x3d91('0xd'));var squel=require(_0x3d91('0xe'));var crypto=require(_0x3d91('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d91('0xa'));var querystring=require(_0x3d91('0x10'));var Papa=require(_0x3d91('0x11'));var Redis=require(_0x3d91('0x12'));var authService=require(_0x3d91('0x13'));var qs=require(_0x3d91('0x14'));var as=require(_0x3d91('0x15'));var hardwareService=require(_0x3d91('0x16'));var logger=require(_0x3d91('0x17'))(_0x3d91('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3d91('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e06e,_0x4f5841){_0x4f5841=_0x4f5841||0xcc;return function(_0x4d2bb){if(_0x4d2bb){return _0x23e06e[_0x3d91('0x1a')](_0x4f5841);}return _0x23e06e['status'](_0x4f5841)[_0x3d91('0x1b')]();};}function respondWithResult(_0x1d88f7,_0x542c52){_0x542c52=_0x542c52||0xc8;return function(_0x255d41){if(_0x255d41){return _0x1d88f7['status'](_0x542c52)['json'](_0x255d41);}};}function respondWithFilteredResult(_0x2964ed,_0x1008d7){return function(_0x478fce){if(_0x478fce){var _0x40e4ab=typeof _0x1008d7[_0x3d91('0x1c')]===_0x3d91('0x1d')&&typeof _0x1008d7[_0x3d91('0x1e')]===_0x3d91('0x1d');var _0x273e29=_0x478fce[_0x3d91('0x1f')];var _0xae21c=_0x40e4ab?0x0:_0x1008d7[_0x3d91('0x1c')];var _0x5794dc=_0x40e4ab?_0x478fce[_0x3d91('0x1f')]:_0x1008d7[_0x3d91('0x1c')]+_0x1008d7[_0x3d91('0x1e')];var _0x8c881c;if(_0x5794dc>=_0x273e29){_0x5794dc=_0x273e29;_0x8c881c=0xc8;}else{_0x8c881c=0xce;}_0x2964ed[_0x3d91('0x20')](_0x8c881c);return _0x2964ed[_0x3d91('0x21')](_0x3d91('0x22'),_0xae21c+'-'+_0x5794dc+'/'+_0x273e29)[_0x3d91('0x23')](_0x478fce);}return null;};}function patchUpdates(_0x4ba4e2){return function(_0x421340){try{jsonpatch['apply'](_0x421340,_0x4ba4e2,!![]);}catch(_0x4f948f){return BPromise[_0x3d91('0x24')](_0x4f948f);}return _0x421340[_0x3d91('0x25')]();};}function saveUpdates(_0x13b3de,_0x29fb91){return function(_0x5752dc){if(_0x5752dc){return _0x5752dc[_0x3d91('0x26')](_0x13b3de)[_0x3d91('0x27')](function(_0x4cf070){return _0x4cf070;});}return null;};}function removeEntity(_0x5949cf,_0xcfe253){return function(_0x5433d7){if(_0x5433d7){return _0x5433d7[_0x3d91('0x28')]()[_0x3d91('0x27')](function(){_0x5949cf[_0x3d91('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f5bec,_0x5482c6){return function(_0x1e8934){if(!_0x1e8934){_0x1f5bec['sendStatus'](0x194);}return _0x1e8934;};}function handleError(_0x418876,_0x11eb2e){_0x11eb2e=_0x11eb2e||0x1f4;return function(_0x6c7900){logger[_0x3d91('0x29')](_0x6c7900[_0x3d91('0x2a')]);if(_0x6c7900['name']){delete _0x6c7900[_0x3d91('0x2b')];}_0x418876[_0x3d91('0x20')](_0x11eb2e)[_0x3d91('0x2c')](_0x6c7900);};}exports[_0x3d91('0x2d')]=function(_0x14d5b1,_0x166e9f){var _0x4d4613={},_0x3d49fb={},_0x1d784b={'count':0x0,'rows':[]};var _0x12001e=_[_0x3d91('0x2e')](db[_0x3d91('0x2f')][_0x3d91('0x30')],function(_0x4f0aa6){return{'name':_0x4f0aa6[_0x3d91('0x31')],'type':_0x4f0aa6[_0x3d91('0x32')][_0x3d91('0x33')]};});_0x3d49fb[_0x3d91('0x34')]=_[_0x3d91('0x2e')](_0x12001e,'name');_0x3d49fb[_0x3d91('0x35')]=_[_0x3d91('0x36')](_0x14d5b1[_0x3d91('0x35')]);_0x3d49fb[_0x3d91('0x37')]=_[_0x3d91('0x38')](_0x3d49fb[_0x3d91('0x34')],_0x3d49fb[_0x3d91('0x35')]);_0x4d4613[_0x3d91('0x39')]=_[_0x3d91('0x38')](_0x3d49fb[_0x3d91('0x34')],qs[_0x3d91('0x3a')](_0x14d5b1[_0x3d91('0x35')]['fields']));_0x4d4613[_0x3d91('0x39')]=_0x4d4613[_0x3d91('0x39')][_0x3d91('0x3b')]?_0x4d4613['attributes']:_0x3d49fb[_0x3d91('0x34')];if(!_0x14d5b1['query'][_0x3d91('0x3c')](_0x3d91('0x3d'))){_0x4d4613[_0x3d91('0x1e')]=qs[_0x3d91('0x1e')](_0x14d5b1['query']['limit']);_0x4d4613['offset']=qs[_0x3d91('0x1c')](_0x14d5b1[_0x3d91('0x35')][_0x3d91('0x1c')]);}_0x4d4613[_0x3d91('0x3e')]=qs[_0x3d91('0x3f')](_0x14d5b1[_0x3d91('0x35')][_0x3d91('0x3f')]);_0x4d4613[_0x3d91('0x40')]=qs[_0x3d91('0x37')](_['pick'](_0x14d5b1['query'],_0x3d49fb['filters']),_0x12001e);if(_0x14d5b1[_0x3d91('0x35')][_0x3d91('0x41')]){_0x4d4613[_0x3d91('0x40')]=_[_0x3d91('0x42')](_0x4d4613[_0x3d91('0x40')],{'$or':_[_0x3d91('0x2e')](_0x12001e,function(_0x1ded65){if(_0x1ded65[_0x3d91('0x32')]!==_0x3d91('0x43')){var _0x5d4fc3={};_0x5d4fc3[_0x1ded65[_0x3d91('0x2b')]]={'$like':'%'+_0x14d5b1[_0x3d91('0x35')][_0x3d91('0x41')]+'%'};return _0x5d4fc3;}})});}_0x4d4613=_['merge']({},_0x4d4613,_0x14d5b1[_0x3d91('0x44')]);var _0x3c6fc3={'where':_0x4d4613[_0x3d91('0x40')]};return db[_0x3d91('0x2f')][_0x3d91('0x1f')](_0x3c6fc3)[_0x3d91('0x27')](function(_0x446609){_0x1d784b[_0x3d91('0x1f')]=_0x446609;if(_0x14d5b1[_0x3d91('0x35')][_0x3d91('0x45')]){_0x4d4613['include']=[{'all':!![]}];}return db[_0x3d91('0x2f')][_0x3d91('0x46')](_0x4d4613);})['then'](function(_0x35b310){_0x1d784b[_0x3d91('0x47')]=_0x35b310;return _0x1d784b;})[_0x3d91('0x27')](respondWithFilteredResult(_0x166e9f,_0x4d4613))['catch'](handleError(_0x166e9f,null));};exports[_0x3d91('0x48')]=function(_0x13d19f,_0x4d791a){var _0x555056={'raw':!![],'where':{'id':_0x13d19f[_0x3d91('0x49')]['id']}},_0x38a4ec={};_0x38a4ec[_0x3d91('0x34')]=_[_0x3d91('0x36')](db[_0x3d91('0x2f')][_0x3d91('0x30')]);_0x38a4ec[_0x3d91('0x35')]=_[_0x3d91('0x36')](_0x13d19f['query']);_0x38a4ec[_0x3d91('0x37')]=_[_0x3d91('0x38')](_0x38a4ec[_0x3d91('0x34')],_0x38a4ec['query']);_0x555056[_0x3d91('0x39')]=_[_0x3d91('0x38')](_0x38a4ec[_0x3d91('0x34')],qs[_0x3d91('0x3a')](_0x13d19f[_0x3d91('0x35')][_0x3d91('0x3a')]));_0x555056[_0x3d91('0x39')]=_0x555056['attributes'][_0x3d91('0x3b')]?_0x555056[_0x3d91('0x39')]:_0x38a4ec[_0x3d91('0x34')];if(_0x13d19f[_0x3d91('0x35')][_0x3d91('0x45')]){_0x555056[_0x3d91('0x4a')]=[{'all':!![]}];}_0x555056=_[_0x3d91('0x42')]({},_0x555056,_0x13d19f[_0x3d91('0x44')]);return db[_0x3d91('0x2f')][_0x3d91('0x4b')](_0x555056)[_0x3d91('0x27')](handleEntityNotFound(_0x4d791a,null))[_0x3d91('0x27')](respondWithResult(_0x4d791a,null))['catch'](handleError(_0x4d791a,null));};exports[_0x3d91('0x4c')]=function(_0x248f2f,_0x327fa2){return db['JscriptySessionReport'][_0x3d91('0x4c')](_0x248f2f[_0x3d91('0x4d')],{})[_0x3d91('0x27')](respondWithResult(_0x327fa2,0xc9))[_0x3d91('0x4e')](handleError(_0x327fa2,null));};exports[_0x3d91('0x26')]=function(_0xe81424,_0xca0ece){if(_0xe81424['body']['id']){delete _0xe81424[_0x3d91('0x4d')]['id'];}return db['JscriptySessionReport'][_0x3d91('0x4b')]({'where':{'id':_0xe81424[_0x3d91('0x49')]['id']}})[_0x3d91('0x27')](handleEntityNotFound(_0xca0ece,null))[_0x3d91('0x27')](saveUpdates(_0xe81424['body'],null))[_0x3d91('0x27')](respondWithResult(_0xca0ece,null))[_0x3d91('0x4e')](handleError(_0xca0ece,null));};exports[_0x3d91('0x28')]=function(_0x4e2c1e,_0x280b22){return db[_0x3d91('0x2f')][_0x3d91('0x4b')]({'where':{'id':_0x4e2c1e['params']['id']}})[_0x3d91('0x27')](handleEntityNotFound(_0x280b22,null))[_0x3d91('0x27')](removeEntity(_0x280b22,null))['catch'](handleError(_0x280b22,null));};exports[_0x3d91('0x4f')]=function(_0x51c289,_0x56d3e7){return db['JscriptySessionReport'][_0x3d91('0x4f')]()[_0x3d91('0x27')](respondWithResult(_0x56d3e7,null))[_0x3d91('0x4e')](handleError(_0x56d3e7,null));};exports['getQuestions']=function(_0x4e6bb3,_0x5d882d,_0x2d3fb6){var _0x3b5489={'raw':!![],'where':{}};var _0x74daef={};var _0x322bcf={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x3d91('0x50')]({'where':{'id':_0x4e6bb3[_0x3d91('0x49')]['id']}})[_0x3d91('0x27')](handleEntityNotFound(_0x5d882d,null))[_0x3d91('0x27')](function(_0x54d8f4){if(_0x54d8f4){_0x74daef[_0x3d91('0x34')]=_['keys'](db[_0x3d91('0x51')]['rawAttributes']);_0x74daef['query']=_[_0x3d91('0x36')](_0x4e6bb3['query']);_0x74daef['filters']=_[_0x3d91('0x38')](_0x74daef[_0x3d91('0x34')],_0x74daef[_0x3d91('0x35')]);_0x3b5489['attributes']=_[_0x3d91('0x38')](_0x74daef['model'],qs[_0x3d91('0x3a')](_0x4e6bb3[_0x3d91('0x35')][_0x3d91('0x3a')]));_0x3b5489[_0x3d91('0x39')]=_0x3b5489['attributes'][_0x3d91('0x3b')]?_0x3b5489[_0x3d91('0x39')]:_0x74daef[_0x3d91('0x34')];if(!_0x4e6bb3[_0x3d91('0x35')][_0x3d91('0x3c')](_0x3d91('0x3d'))){_0x3b5489['limit']=qs[_0x3d91('0x1e')](_0x4e6bb3[_0x3d91('0x35')][_0x3d91('0x1e')]);_0x3b5489['offset']=qs[_0x3d91('0x1c')](_0x4e6bb3[_0x3d91('0x35')]['offset']);}_0x3b5489['order']=qs['sort'](_0x4e6bb3[_0x3d91('0x35')][_0x3d91('0x3f')]);_0x3b5489['where']=qs[_0x3d91('0x37')](_[_0x3d91('0x52')](_0x4e6bb3['query'],_0x74daef[_0x3d91('0x37')]));_0x3b5489[_0x3d91('0x40')][_0x3d91('0x53')]=_0x54d8f4['id'];if(_0x4e6bb3[_0x3d91('0x35')][_0x3d91('0x41')]){_0x3b5489[_0x3d91('0x40')]=_[_0x3d91('0x42')](_0x3b5489[_0x3d91('0x40')],{'$or':_[_0x3d91('0x2e')](_0x3b5489[_0x3d91('0x39')],function(_0x30351a){var _0xb38be2={};_0xb38be2[_0x30351a]={'$like':'%'+_0x4e6bb3[_0x3d91('0x35')][_0x3d91('0x41')]+'%'};return _0xb38be2;})});}_0x3b5489=_[_0x3d91('0x42')]({},_0x3b5489,_0x4e6bb3[_0x3d91('0x44')]);return db[_0x3d91('0x51')][_0x3d91('0x1f')]({'where':_0x3b5489[_0x3d91('0x40')]})['then'](function(_0x8e4cdd){_0x322bcf[_0x3d91('0x1f')]=_0x8e4cdd;if(_0x4e6bb3[_0x3d91('0x35')][_0x3d91('0x45')]){_0x3b5489[_0x3d91('0x4a')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3d91('0x46')](_0x3b5489);})[_0x3d91('0x27')](function(_0x18161f){_0x322bcf['rows']=_0x18161f;return _0x322bcf;});}})[_0x3d91('0x27')](respondWithFilteredResult(_0x5d882d,_0x3b5489))['catch'](handleError(_0x5d882d,null));}; \ No newline at end of file +var _0x1138=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','json','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','JscriptySessionReport','findAll','rows','catch','show','keys','fields','length','find','create','body','destroy','params','describe','findOne','JscriptyQuestionReport','sort','SessionId','eml-format','rimraf','fast-json-patch'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x1138,0x18d));var _0x8113=function(_0x240f11,_0x1e5f12){_0x240f11=_0x240f11-0x0;var _0x1495e1=_0x1138[_0x240f11];return _0x1495e1;};'use strict';var emlformat=require(_0x8113('0x0'));var rimraf=require(_0x8113('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8113('0x2'));var rp=require(_0x8113('0x3'));var moment=require(_0x8113('0x4'));var BPromise=require(_0x8113('0x5'));var Mustache=require(_0x8113('0x6'));var util=require(_0x8113('0x7'));var path=require(_0x8113('0x8'));var sox=require(_0x8113('0x9'));var csv=require('to-csv');var ejs=require(_0x8113('0xa'));var fs=require('fs');var fs_extra=require(_0x8113('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8113('0xc'));var jsforce=require(_0x8113('0xd'));var deskjs=require(_0x8113('0xe'));var toCsv=require(_0x8113('0xf'));var querystring=require(_0x8113('0x10'));var Papa=require(_0x8113('0x11'));var Redis=require(_0x8113('0x12'));var authService=require(_0x8113('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8113('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8113('0x15'))(_0x8113('0x16'));var utils=require(_0x8113('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8113('0x18'));var db=require(_0x8113('0x19'))['db'];function respondWithStatusCode(_0x3b3527,_0xdd34de){_0xdd34de=_0xdd34de||0xcc;return function(_0x55f2b8){if(_0x55f2b8){return _0x3b3527['sendStatus'](_0xdd34de);}return _0x3b3527['status'](_0xdd34de)['end']();};}function respondWithResult(_0x124f6b,_0x3e124f){_0x3e124f=_0x3e124f||0xc8;return function(_0x3db68a){if(_0x3db68a){return _0x124f6b[_0x8113('0x1a')](_0x3e124f)['json'](_0x3db68a);}};}function respondWithFilteredResult(_0x59f385,_0xf5ac73){return function(_0x4f084d){if(_0x4f084d){var _0x25aa67=typeof _0xf5ac73[_0x8113('0x1b')]===_0x8113('0x1c')&&typeof _0xf5ac73[_0x8113('0x1d')]===_0x8113('0x1c');var _0x493fa3=_0x4f084d[_0x8113('0x1e')];var _0x2f2d98=_0x25aa67?0x0:_0xf5ac73[_0x8113('0x1b')];var _0x4089b0=_0x25aa67?_0x4f084d[_0x8113('0x1e')]:_0xf5ac73['offset']+_0xf5ac73[_0x8113('0x1d')];var _0xd6a75e;if(_0x4089b0>=_0x493fa3){_0x4089b0=_0x493fa3;_0xd6a75e=0xc8;}else{_0xd6a75e=0xce;}_0x59f385[_0x8113('0x1a')](_0xd6a75e);return _0x59f385['set']('Content-Range',_0x2f2d98+'-'+_0x4089b0+'/'+_0x493fa3)[_0x8113('0x1f')](_0x4f084d);}return null;};}function patchUpdates(_0x5c08c3){return function(_0x2e3c5f){try{jsonpatch[_0x8113('0x20')](_0x2e3c5f,_0x5c08c3,!![]);}catch(_0x1a239d){return BPromise[_0x8113('0x21')](_0x1a239d);}return _0x2e3c5f[_0x8113('0x22')]();};}function saveUpdates(_0x52faab,_0x110da7){return function(_0x2e5ad1){if(_0x2e5ad1){return _0x2e5ad1[_0x8113('0x23')](_0x52faab)[_0x8113('0x24')](function(_0x253f2c){return _0x253f2c;});}return null;};}function removeEntity(_0x3c9720,_0x52d8c3){return function(_0x2b7fb3){if(_0x2b7fb3){return _0x2b7fb3['destroy']()[_0x8113('0x24')](function(){_0x3c9720[_0x8113('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37d912,_0x24b603){return function(_0x2f51a9){if(!_0x2f51a9){_0x37d912['sendStatus'](0x194);}return _0x2f51a9;};}function handleError(_0x633a74,_0x4b9224){_0x4b9224=_0x4b9224||0x1f4;return function(_0x58dbcd){logger[_0x8113('0x25')](_0x58dbcd[_0x8113('0x26')]);if(_0x58dbcd[_0x8113('0x27')]){delete _0x58dbcd[_0x8113('0x27')];}_0x633a74['status'](_0x4b9224)[_0x8113('0x28')](_0x58dbcd);};}exports['index']=function(_0x1c996a,_0x3a4922){var _0x2ff943={},_0x500110={},_0x2b27a3={'count':0x0,'rows':[]};var _0x34fbaf=_[_0x8113('0x29')](db['JscriptySessionReport'][_0x8113('0x2a')],function(_0x5836c4){return{'name':_0x5836c4[_0x8113('0x2b')],'type':_0x5836c4[_0x8113('0x2c')][_0x8113('0x2d')]};});_0x500110[_0x8113('0x2e')]=_[_0x8113('0x29')](_0x34fbaf,_0x8113('0x27'));_0x500110[_0x8113('0x2f')]=_['keys'](_0x1c996a[_0x8113('0x2f')]);_0x500110[_0x8113('0x30')]=_[_0x8113('0x31')](_0x500110[_0x8113('0x2e')],_0x500110[_0x8113('0x2f')]);_0x2ff943[_0x8113('0x32')]=_[_0x8113('0x31')](_0x500110[_0x8113('0x2e')],qs['fields'](_0x1c996a[_0x8113('0x2f')]['fields']));_0x2ff943['attributes']=_0x2ff943[_0x8113('0x32')]['length']?_0x2ff943['attributes']:_0x500110[_0x8113('0x2e')];if(!_0x1c996a[_0x8113('0x2f')][_0x8113('0x33')](_0x8113('0x34'))){_0x2ff943[_0x8113('0x1d')]=qs[_0x8113('0x1d')](_0x1c996a[_0x8113('0x2f')][_0x8113('0x1d')]);_0x2ff943[_0x8113('0x1b')]=qs[_0x8113('0x1b')](_0x1c996a[_0x8113('0x2f')][_0x8113('0x1b')]);}_0x2ff943[_0x8113('0x35')]=qs['sort'](_0x1c996a[_0x8113('0x2f')]['sort']);_0x2ff943[_0x8113('0x36')]=qs[_0x8113('0x30')](_[_0x8113('0x37')](_0x1c996a[_0x8113('0x2f')],_0x500110[_0x8113('0x30')]),_0x34fbaf);if(_0x1c996a[_0x8113('0x2f')][_0x8113('0x38')]){_0x2ff943[_0x8113('0x36')]=_[_0x8113('0x39')](_0x2ff943[_0x8113('0x36')],{'$or':_[_0x8113('0x29')](_0x34fbaf,function(_0x5bafdd){if(_0x5bafdd[_0x8113('0x2c')]!==_0x8113('0x3a')){var _0x584616={};_0x584616[_0x5bafdd[_0x8113('0x27')]]={'$like':'%'+_0x1c996a['query']['filter']+'%'};return _0x584616;}})});}_0x2ff943=_[_0x8113('0x39')]({},_0x2ff943,_0x1c996a[_0x8113('0x3b')]);var _0xe819be={'where':_0x2ff943[_0x8113('0x36')]};return db['JscriptySessionReport'][_0x8113('0x1e')](_0xe819be)[_0x8113('0x24')](function(_0x486626){_0x2b27a3['count']=_0x486626;if(_0x1c996a[_0x8113('0x2f')][_0x8113('0x3c')]){_0x2ff943[_0x8113('0x3d')]=[{'all':!![]}];}return db[_0x8113('0x3e')][_0x8113('0x3f')](_0x2ff943);})[_0x8113('0x24')](function(_0x3e0910){_0x2b27a3[_0x8113('0x40')]=_0x3e0910;return _0x2b27a3;})['then'](respondWithFilteredResult(_0x3a4922,_0x2ff943))[_0x8113('0x41')](handleError(_0x3a4922,null));};exports[_0x8113('0x42')]=function(_0xf703fa,_0x1b2cd5){var _0x21ae5c={'raw':!![],'where':{'id':_0xf703fa['params']['id']}},_0x1bbb5d={};_0x1bbb5d[_0x8113('0x2e')]=_[_0x8113('0x43')](db['JscriptySessionReport'][_0x8113('0x2a')]);_0x1bbb5d['query']=_['keys'](_0xf703fa[_0x8113('0x2f')]);_0x1bbb5d[_0x8113('0x30')]=_[_0x8113('0x31')](_0x1bbb5d[_0x8113('0x2e')],_0x1bbb5d[_0x8113('0x2f')]);_0x21ae5c[_0x8113('0x32')]=_[_0x8113('0x31')](_0x1bbb5d[_0x8113('0x2e')],qs[_0x8113('0x44')](_0xf703fa[_0x8113('0x2f')][_0x8113('0x44')]));_0x21ae5c['attributes']=_0x21ae5c[_0x8113('0x32')][_0x8113('0x45')]?_0x21ae5c[_0x8113('0x32')]:_0x1bbb5d[_0x8113('0x2e')];if(_0xf703fa[_0x8113('0x2f')][_0x8113('0x3c')]){_0x21ae5c[_0x8113('0x3d')]=[{'all':!![]}];}_0x21ae5c=_['merge']({},_0x21ae5c,_0xf703fa[_0x8113('0x3b')]);return db[_0x8113('0x3e')][_0x8113('0x46')](_0x21ae5c)[_0x8113('0x24')](handleEntityNotFound(_0x1b2cd5,null))[_0x8113('0x24')](respondWithResult(_0x1b2cd5,null))[_0x8113('0x41')](handleError(_0x1b2cd5,null));};exports['create']=function(_0x1ece4d,_0x29d8eb){return db[_0x8113('0x3e')][_0x8113('0x47')](_0x1ece4d[_0x8113('0x48')],{})['then'](respondWithResult(_0x29d8eb,0xc9))[_0x8113('0x41')](handleError(_0x29d8eb,null));};exports[_0x8113('0x23')]=function(_0xc17881,_0x6dbf02){if(_0xc17881[_0x8113('0x48')]['id']){delete _0xc17881[_0x8113('0x48')]['id'];}return db[_0x8113('0x3e')][_0x8113('0x46')]({'where':{'id':_0xc17881['params']['id']}})['then'](handleEntityNotFound(_0x6dbf02,null))['then'](saveUpdates(_0xc17881[_0x8113('0x48')],null))[_0x8113('0x24')](respondWithResult(_0x6dbf02,null))[_0x8113('0x41')](handleError(_0x6dbf02,null));};exports[_0x8113('0x49')]=function(_0x59a707,_0x34c89b){return db[_0x8113('0x3e')][_0x8113('0x46')]({'where':{'id':_0x59a707[_0x8113('0x4a')]['id']}})[_0x8113('0x24')](handleEntityNotFound(_0x34c89b,null))[_0x8113('0x24')](removeEntity(_0x34c89b,null))[_0x8113('0x41')](handleError(_0x34c89b,null));};exports['describe']=function(_0x435859,_0x15eaab){return db[_0x8113('0x3e')][_0x8113('0x4b')]()[_0x8113('0x24')](respondWithResult(_0x15eaab,null))[_0x8113('0x41')](handleError(_0x15eaab,null));};exports['getQuestions']=function(_0x3976f8,_0xba3dd5,_0x351660){var _0x41c758={'raw':!![],'where':{}};var _0x3af5fe={};var _0x5e1f99={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x8113('0x4c')]({'where':{'id':_0x3976f8[_0x8113('0x4a')]['id']}})['then'](handleEntityNotFound(_0xba3dd5,null))[_0x8113('0x24')](function(_0x4858ff){if(_0x4858ff){_0x3af5fe[_0x8113('0x2e')]=_[_0x8113('0x43')](db[_0x8113('0x4d')]['rawAttributes']);_0x3af5fe['query']=_[_0x8113('0x43')](_0x3976f8[_0x8113('0x2f')]);_0x3af5fe[_0x8113('0x30')]=_[_0x8113('0x31')](_0x3af5fe['model'],_0x3af5fe['query']);_0x41c758[_0x8113('0x32')]=_[_0x8113('0x31')](_0x3af5fe[_0x8113('0x2e')],qs[_0x8113('0x44')](_0x3976f8[_0x8113('0x2f')][_0x8113('0x44')]));_0x41c758[_0x8113('0x32')]=_0x41c758[_0x8113('0x32')][_0x8113('0x45')]?_0x41c758[_0x8113('0x32')]:_0x3af5fe[_0x8113('0x2e')];if(!_0x3976f8[_0x8113('0x2f')][_0x8113('0x33')](_0x8113('0x34'))){_0x41c758[_0x8113('0x1d')]=qs[_0x8113('0x1d')](_0x3976f8[_0x8113('0x2f')][_0x8113('0x1d')]);_0x41c758['offset']=qs[_0x8113('0x1b')](_0x3976f8[_0x8113('0x2f')][_0x8113('0x1b')]);}_0x41c758[_0x8113('0x35')]=qs[_0x8113('0x4e')](_0x3976f8['query'][_0x8113('0x4e')]);_0x41c758[_0x8113('0x36')]=qs[_0x8113('0x30')](_[_0x8113('0x37')](_0x3976f8[_0x8113('0x2f')],_0x3af5fe[_0x8113('0x30')]));_0x41c758[_0x8113('0x36')][_0x8113('0x4f')]=_0x4858ff['id'];if(_0x3976f8[_0x8113('0x2f')][_0x8113('0x38')]){_0x41c758[_0x8113('0x36')]=_[_0x8113('0x39')](_0x41c758[_0x8113('0x36')],{'$or':_[_0x8113('0x29')](_0x41c758[_0x8113('0x32')],function(_0x45fd25){var _0x358764={};_0x358764[_0x45fd25]={'$like':'%'+_0x3976f8['query'][_0x8113('0x38')]+'%'};return _0x358764;})});}_0x41c758=_[_0x8113('0x39')]({},_0x41c758,_0x3976f8['options']);return db['JscriptyQuestionReport']['count']({'where':_0x41c758[_0x8113('0x36')]})[_0x8113('0x24')](function(_0x42d767){_0x5e1f99[_0x8113('0x1e')]=_0x42d767;if(_0x3976f8['query']['includeAll']){_0x41c758['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8113('0x3f')](_0x41c758);})[_0x8113('0x24')](function(_0x504e55){_0x5e1f99[_0x8113('0x40')]=_0x504e55;return _0x5e1f99;});}})[_0x8113('0x24')](respondWithFilteredResult(_0xba3dd5,_0x41c758))['catch'](handleError(_0xba3dd5,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 6fdd5ca..3c5f03b 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 _0x5334=['moment','request-promise','rimraf','../../config/environment','lodash','util','../../config/logger','api'];(function(_0x23a15d,_0x1e17e8){var _0x1151f9=function(_0x837430){while(--_0x837430){_0x23a15d['push'](_0x23a15d['shift']());}};_0x1151f9(++_0x1e17e8);}(_0x5334,0x84));var _0x4533=function(_0x4e6c6a,_0x3faf0b){_0x4e6c6a=_0x4e6c6a-0x0;var _0x30d48a=_0x5334[_0x4e6c6a];return _0x30d48a;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var logger=require(_0x4533('0x2'))(_0x4533('0x3'));var moment=require(_0x4533('0x4'));var BPromise=require('bluebird');var rp=require(_0x4533('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x51b4ce,_0x201673){return _0x51b4ce['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5401c5,_0x3ae01d){_0x5401c5=_0x5401c5-0x0;var _0x48b681=_0xc6ac[_0x5401c5];return _0x48b681;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'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 8f30af7..e1ced5a 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1b7418,_0x2dcad6){var _0x4d55b1=function(_0x5f237f){while(--_0x5f237f){_0x1b7418['push'](_0x1b7418['shift']());}};_0x4d55b1(++_0x2dcad6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'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')]('JscriptySessionReport,\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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2b38a6,_0x4fbc47){var _0x118544=function(_0x530952){while(--_0x530952){_0x2b38a6['push'](_0x2b38a6['shift']());}};_0x118544(++_0x4fbc47);}(_0x2ef3,0xba));var _0x32ef=function(_0x36ca4e,_0x35590c){_0x36ca4e=_0x36ca4e-0x0;var _0x2de077=_0x2ef3[_0x36ca4e];return _0x2de077;};'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')]('JscriptySessionReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 59deaa1..72be7e8 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 _0x3101=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file'];(function(_0x367451,_0xfefc05){var _0x274efd=function(_0x23637f){while(--_0x23637f){_0x367451['push'](_0x367451['shift']());}};_0x274efd(++_0xfefc05);}(_0x3101,0x1e1));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1310('0x0'));var util=require(_0x1310('0x1'));var path=require(_0x1310('0x2'));var timeout=require(_0x1310('0x3'));var express=require(_0x1310('0x4'));var router=express['Router']();var fs_extra=require(_0x1310('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1310('0x6'));var config=require(_0x1310('0x7'));var controller=require(_0x1310('0x8'));router[_0x1310('0x9')]('/',controller['index']);router[_0x1310('0xa')](_0x1310('0xb'),auth[_0x1310('0xc')](),controller[_0x1310('0xd')]);router[_0x1310('0x9')](_0x1310('0xe'),auth[_0x1310('0xc')](),controller['downloadLogFile']);module[_0x1310('0xf')]=router; \ No newline at end of file +var _0x5589=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer'];(function(_0x2735f8,_0x1246dd){var _0x4935c9=function(_0x3cef0c){while(--_0x3cef0c){_0x2735f8['push'](_0x2735f8['shift']());}};_0x4935c9(++_0x1246dd);}(_0x5589,0x131));var _0x9558=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5589[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x9558('0x0'));var util=require('util');var path=require(_0x9558('0x1'));var timeout=require(_0x9558('0x2'));var express=require(_0x9558('0x3'));var router=express[_0x9558('0x4')]();var fs_extra=require(_0x9558('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9558('0x6'));var config=require(_0x9558('0x7'));var controller=require(_0x9558('0x8'));router[_0x9558('0x9')]('/',controller[_0x9558('0xa')]);router[_0x9558('0xb')](_0x9558('0xc'),auth[_0x9558('0xd')](),controller[_0x9558('0xe')]);router[_0x9558('0x9')](_0x9558('0xf'),auth[_0x9558('0xd')](),controller[_0x9558('0x10')]);module[_0x9558('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0805036..9c01b3c 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 _0x1721=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x1721,0x176));var _0x1172=function(_0x435fdd,_0x311fb5){_0x435fdd=_0x435fdd-0x0;var _0x9ba46c=_0x1721[_0x435fdd];return _0x9ba46c;};'use strict';var Sequelize=require(_0x1172('0x0'));module[_0x1172('0x1')]={'license':{'type':Sequelize[_0x1172('0x2')]},'data1':{'type':Sequelize[_0x1172('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x1172('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x173c=['sequelize','TEXT','STRING'];(function(_0x44d9e8,_0x2f0bc2){var _0x64816e=function(_0x3e9a6d){while(--_0x3e9a6d){_0x44d9e8['push'](_0x44d9e8['shift']());}};_0x64816e(++_0x2f0bc2);}(_0x173c,0xd5));var _0xc173=function(_0x1f0ea0,_0x5a4e65){_0x1f0ea0=_0x1f0ea0-0x0;var _0x3e43a4=_0x173c[_0x1f0ea0];return _0x3e43a4;};'use strict';var Sequelize=require(_0xc173('0x0'));module['exports']={'license':{'type':Sequelize[_0xc173('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc173('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 550206e..9a66c40 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 _0xd76a=['request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','model','License','rawAttributes','query','keys','filters','intersection','fields','attributes','merge','getLicense','catch','body','find','get','checkLicense','downloadLogFile','license-info.log','/var','log','xcally','attachment;\x20filename=','Content-Type','text/plain','eml-format','zip-dir','fast-json-patch'];(function(_0x2c7864,_0x378de3){var _0x116063=function(_0x5c2581){while(--_0x5c2581){_0x2c7864['push'](_0x2c7864['shift']());}};_0x116063(++_0x378de3);}(_0xd76a,0x138));var _0xad76=function(_0x511ce6,_0x5f1b0e){_0x511ce6=_0x511ce6-0x0;var _0x28d8a5=_0xd76a[_0x511ce6];return _0x28d8a5;};'use strict';var emlformat=require(_0xad76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad76('0x1'));var jsonpatch=require(_0xad76('0x2'));var rp=require(_0xad76('0x3'));var moment=require(_0xad76('0x4'));var BPromise=require(_0xad76('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xad76('0x6'));var sox=require(_0xad76('0x7'));var csv=require(_0xad76('0x8'));var ejs=require(_0xad76('0x9'));var fs=require('fs');var fs_extra=require(_0xad76('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xad76('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xad76('0xc'));var toCsv=require(_0xad76('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xad76('0xd'));var authService=require(_0xad76('0xe'));var qs=require(_0xad76('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad76('0x10'));var logger=require(_0xad76('0x11'))(_0xad76('0x12'));var utils=require(_0xad76('0x13'));var config=require(_0xad76('0x14'));var licenseUtil=require(_0xad76('0x15'));var db=require(_0xad76('0x16'))['db'];function respondWithStatusCode(_0x1ac669,_0x25626e){_0x25626e=_0x25626e||0xcc;return function(_0x2a0cf0){if(_0x2a0cf0){return _0x1ac669['sendStatus'](_0x25626e);}return _0x1ac669[_0xad76('0x17')](_0x25626e)['end']();};}function respondWithResult(_0x205da2,_0x431473){_0x431473=_0x431473||0xc8;return function(_0x406553){if(_0x406553){return _0x205da2['status'](_0x431473)[_0xad76('0x18')](_0x406553);}};}function respondWithFilteredResult(_0x11aef0,_0x408c44){return function(_0x5365ac){if(_0x5365ac){var _0x63c682=typeof _0x408c44[_0xad76('0x19')]===_0xad76('0x1a')&&typeof _0x408c44[_0xad76('0x1b')]===_0xad76('0x1a');var _0x5c4d95=_0x5365ac['count'];var _0x3df0b2=_0x63c682?0x0:_0x408c44[_0xad76('0x19')];var _0x432aac=_0x63c682?_0x5365ac[_0xad76('0x1c')]:_0x408c44[_0xad76('0x19')]+_0x408c44[_0xad76('0x1b')];var _0x1ba1e9;if(_0x432aac>=_0x5c4d95){_0x432aac=_0x5c4d95;_0x1ba1e9=0xc8;}else{_0x1ba1e9=0xce;}_0x11aef0[_0xad76('0x17')](_0x1ba1e9);return _0x11aef0[_0xad76('0x1d')]('Content-Range',_0x3df0b2+'-'+_0x432aac+'/'+_0x5c4d95)[_0xad76('0x18')](_0x5365ac);}return null;};}function patchUpdates(_0x273ed6){return function(_0x1a2979){try{jsonpatch[_0xad76('0x1e')](_0x1a2979,_0x273ed6,!![]);}catch(_0x30b6cb){return BPromise[_0xad76('0x1f')](_0x30b6cb);}return _0x1a2979['save']();};}function saveUpdates(_0x556f4c,_0x43109d){return function(_0x1791f4){if(_0x1791f4){return _0x1791f4[_0xad76('0x20')](_0x556f4c)[_0xad76('0x21')](function(_0x4096e7){return _0x4096e7;});}return null;};}function removeEntity(_0x55bee5,_0x51417a){return function(_0x4d8899){if(_0x4d8899){return _0x4d8899['destroy']()[_0xad76('0x21')](function(){_0x55bee5[_0xad76('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x466cc1,_0x5b41ad){return function(_0x5af742){if(!_0x5af742){_0x466cc1['sendStatus'](0x194);}return _0x5af742;};}function handleError(_0x997ca1,_0x351890){_0x351890=_0x351890||0x1f4;return function(_0xc3fa92){logger[_0xad76('0x22')](_0xc3fa92[_0xad76('0x23')]);if(_0xc3fa92[_0xad76('0x24')]){delete _0xc3fa92['name'];}_0x997ca1[_0xad76('0x17')](_0x351890)[_0xad76('0x25')](_0xc3fa92);};}var utilLicense=require('../../config/license/util');exports[_0xad76('0x26')]=function(_0x27fc59,_0x238655){var _0x3507ee={'raw':!![],'where':{'id':0x1}},_0x474585={};_0x474585[_0xad76('0x27')]=_['keys'](db[_0xad76('0x28')][_0xad76('0x29')]);_0x474585[_0xad76('0x2a')]=_[_0xad76('0x2b')](_0x27fc59[_0xad76('0x2a')]);_0x474585[_0xad76('0x2c')]=_[_0xad76('0x2d')](_0x474585['model'],_0x474585[_0xad76('0x2a')]);_0x3507ee['attributes']=_['intersection'](_0x474585[_0xad76('0x27')],qs['fields'](_0x27fc59['query'][_0xad76('0x2e')]));_0x3507ee[_0xad76('0x2f')]=_0x3507ee[_0xad76('0x2f')]['length']?_0x3507ee[_0xad76('0x2f')]:_0x474585[_0xad76('0x27')];_0x3507ee=_[_0xad76('0x30')]({},_0x3507ee,_0x27fc59['options']);return utilLicense[_0xad76('0x31')](_0x3507ee)[_0xad76('0x21')](respondWithResult(_0x238655,null))[_0xad76('0x32')](handleError(_0x238655,null));};exports[_0xad76('0x20')]=function(_0x1f7547,_0x2df06e){if(_0x1f7547['body']['id']){delete _0x1f7547[_0xad76('0x33')]['id'];}return db[_0xad76('0x28')][_0xad76('0x34')]({'where':{'id':_0x1f7547['params']['id']}})['then'](handleEntityNotFound(_0x2df06e,null))[_0xad76('0x21')](function(_0x42e95c){var _0x5a4bdb=_0x42e95c[_0xad76('0x35')]({'plain':!![]});return utilLicense[_0xad76('0x36')](_0x5a4bdb,_0x1f7547[_0xad76('0x33')]['key']);})['then'](function(_0x3d0744){if(!_0x3d0744['demo']){return saveUpdates(_0x1f7547[_0xad76('0x33')],null);}return _0x3d0744;})['then'](respondWithResult(_0x2df06e,null))['catch'](handleError(_0x2df06e,null));};exports[_0xad76('0x37')]=function(_0xe207e9,_0x21ae28){var _0x2c10c0=_0xad76('0x38');var _0x25b327=path['join'](_0xad76('0x39'),_0xad76('0x3a'),_0xad76('0x3b'),_0x2c10c0);_0x21ae28['setHeader']('Content-disposition',_0xad76('0x3c')+_0x2c10c0);_0x21ae28[_0xad76('0x1d')](_0xad76('0x3d'),_0xad76('0x3e'));_0x21ae28['download'](_0x25b327);}; \ No newline at end of file +var _0x72cc=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','stack','name','index','model','keys','License','query','intersection','attributes','fields','length','merge','options','getLicense','body','params','get','checkLicense','key','demo','catch','downloadLogFile','license-info.log','join','/var','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x2d401a,_0x2f84b1){var _0x251869=function(_0x37d33f){while(--_0x37d33f){_0x2d401a['push'](_0x2d401a['shift']());}};_0x251869(++_0x2f84b1);}(_0x72cc,0xc1));var _0xc72c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x72cc[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xc72c('0x0'));var rimraf=require(_0xc72c('0x1'));var zipdir=require(_0xc72c('0x2'));var jsonpatch=require(_0xc72c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc72c('0x4'));var Mustache=require('mustache');var util=require(_0xc72c('0x5'));var path=require(_0xc72c('0x6'));var sox=require(_0xc72c('0x7'));var csv=require('to-csv');var ejs=require(_0xc72c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc72c('0x9'));var squel=require(_0xc72c('0xa'));var crypto=require(_0xc72c('0xb'));var jsforce=require(_0xc72c('0xc'));var deskjs=require(_0xc72c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc72c('0xe'));var Papa=require(_0xc72c('0xf'));var Redis=require('ioredis');var authService=require(_0xc72c('0x10'));var qs=require(_0xc72c('0x11'));var as=require(_0xc72c('0x12'));var hardwareService=require(_0xc72c('0x13'));var logger=require(_0xc72c('0x14'))(_0xc72c('0x15'));var utils=require('../../config/utils');var config=require(_0xc72c('0x16'));var licenseUtil=require(_0xc72c('0x17'));var db=require(_0xc72c('0x18'))['db'];function respondWithStatusCode(_0x135b05,_0x235875){_0x235875=_0x235875||0xcc;return function(_0x1768f4){if(_0x1768f4){return _0x135b05[_0xc72c('0x19')](_0x235875);}return _0x135b05['status'](_0x235875)[_0xc72c('0x1a')]();};}function respondWithResult(_0x8ffb60,_0x1b602){_0x1b602=_0x1b602||0xc8;return function(_0x577cac){if(_0x577cac){return _0x8ffb60[_0xc72c('0x1b')](_0x1b602)[_0xc72c('0x1c')](_0x577cac);}};}function respondWithFilteredResult(_0x4179ba,_0x29a428){return function(_0x632f7c){if(_0x632f7c){var _0x49b1ca=typeof _0x29a428[_0xc72c('0x1d')]===_0xc72c('0x1e')&&typeof _0x29a428[_0xc72c('0x1f')]===_0xc72c('0x1e');var _0x302255=_0x632f7c[_0xc72c('0x20')];var _0x4f3549=_0x49b1ca?0x0:_0x29a428[_0xc72c('0x1d')];var _0x447256=_0x49b1ca?_0x632f7c['count']:_0x29a428[_0xc72c('0x1d')]+_0x29a428[_0xc72c('0x1f')];var _0x1ae875;if(_0x447256>=_0x302255){_0x447256=_0x302255;_0x1ae875=0xc8;}else{_0x1ae875=0xce;}_0x4179ba[_0xc72c('0x1b')](_0x1ae875);return _0x4179ba[_0xc72c('0x21')]('Content-Range',_0x4f3549+'-'+_0x447256+'/'+_0x302255)[_0xc72c('0x1c')](_0x632f7c);}return null;};}function patchUpdates(_0x5c0b6e){return function(_0x3581c6){try{jsonpatch[_0xc72c('0x22')](_0x3581c6,_0x5c0b6e,!![]);}catch(_0x5d8cfe){return BPromise[_0xc72c('0x23')](_0x5d8cfe);}return _0x3581c6['save']();};}function saveUpdates(_0x41e0b9,_0x17d9a3){return function(_0x2d91a1){if(_0x2d91a1){return _0x2d91a1[_0xc72c('0x24')](_0x41e0b9)['then'](function(_0x2436b6){return _0x2436b6;});}return null;};}function removeEntity(_0xd9df15,_0x24d042){return function(_0x4fd563){if(_0x4fd563){return _0x4fd563[_0xc72c('0x25')]()[_0xc72c('0x26')](function(){_0xd9df15[_0xc72c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27e28b,_0x194af6){return function(_0xdd9f1b){if(!_0xdd9f1b){_0x27e28b['sendStatus'](0x194);}return _0xdd9f1b;};}function handleError(_0x39ac8b,_0xa46f02){_0xa46f02=_0xa46f02||0x1f4;return function(_0xf218d6){logger['error'](_0xf218d6[_0xc72c('0x27')]);if(_0xf218d6[_0xc72c('0x28')]){delete _0xf218d6[_0xc72c('0x28')];}_0x39ac8b['status'](_0xa46f02)['send'](_0xf218d6);};}var utilLicense=require(_0xc72c('0x17'));exports[_0xc72c('0x29')]=function(_0x2eda34,_0x2573f7){var _0x4ea7d4={'raw':!![],'where':{'id':0x1}},_0x1550b1={};_0x1550b1[_0xc72c('0x2a')]=_[_0xc72c('0x2b')](db[_0xc72c('0x2c')]['rawAttributes']);_0x1550b1[_0xc72c('0x2d')]=_['keys'](_0x2eda34[_0xc72c('0x2d')]);_0x1550b1['filters']=_[_0xc72c('0x2e')](_0x1550b1['model'],_0x1550b1[_0xc72c('0x2d')]);_0x4ea7d4[_0xc72c('0x2f')]=_[_0xc72c('0x2e')](_0x1550b1[_0xc72c('0x2a')],qs['fields'](_0x2eda34[_0xc72c('0x2d')][_0xc72c('0x30')]));_0x4ea7d4[_0xc72c('0x2f')]=_0x4ea7d4['attributes'][_0xc72c('0x31')]?_0x4ea7d4['attributes']:_0x1550b1[_0xc72c('0x2a')];_0x4ea7d4=_[_0xc72c('0x32')]({},_0x4ea7d4,_0x2eda34[_0xc72c('0x33')]);return utilLicense[_0xc72c('0x34')](_0x4ea7d4)[_0xc72c('0x26')](respondWithResult(_0x2573f7,null))['catch'](handleError(_0x2573f7,null));};exports['update']=function(_0x5ab8fa,_0x527342){if(_0x5ab8fa[_0xc72c('0x35')]['id']){delete _0x5ab8fa[_0xc72c('0x35')]['id'];}return db['License']['find']({'where':{'id':_0x5ab8fa[_0xc72c('0x36')]['id']}})[_0xc72c('0x26')](handleEntityNotFound(_0x527342,null))[_0xc72c('0x26')](function(_0x3b4e5e){var _0x13236e=_0x3b4e5e[_0xc72c('0x37')]({'plain':!![]});return utilLicense[_0xc72c('0x38')](_0x13236e,_0x5ab8fa[_0xc72c('0x35')][_0xc72c('0x39')]);})[_0xc72c('0x26')](function(_0x5636fb){if(!_0x5636fb[_0xc72c('0x3a')]){return saveUpdates(_0x5ab8fa['body'],null);}return _0x5636fb;})[_0xc72c('0x26')](respondWithResult(_0x527342,null))[_0xc72c('0x3b')](handleError(_0x527342,null));};exports[_0xc72c('0x3c')]=function(_0x5f09e7,_0x4b9632){var _0x204979=_0xc72c('0x3d');var _0x4e18ec=path[_0xc72c('0x3e')](_0xc72c('0x3f'),'log',_0xc72c('0x40'),_0x204979);_0x4b9632['setHeader'](_0xc72c('0x41'),_0xc72c('0x42')+_0x204979);_0x4b9632[_0xc72c('0x21')](_0xc72c('0x43'),_0xc72c('0x44'));_0x4b9632[_0xc72c('0x45')](_0x4e18ec);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 950c74d..e239fa9 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 _0x2614=['license','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','define','License'];(function(_0x16b22f,_0x41c429){var _0x191abc=function(_0x5a062b){while(--_0x5a062b){_0x16b22f['push'](_0x16b22f['shift']());}};_0x191abc(++_0x41c429);}(_0x2614,0xfb));var _0x4261=function(_0x241b79,_0x4841a7){_0x241b79=_0x241b79-0x0;var _0x5a233d=_0x2614[_0x241b79];return _0x5a233d;};'use strict';var _=require(_0x4261('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4261('0x1'));var moment=require('moment');var BPromise=require(_0x4261('0x2'));var rp=require(_0x4261('0x3'));var fs=require('fs');var path=require(_0x4261('0x4'));var rimraf=require(_0x4261('0x5'));var config=require(_0x4261('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f7f50,_0x2c6b5b){return _0x3f7f50[_0x4261('0x7')](_0x4261('0x8'),attributes,{'tableName':_0x4261('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b55=['License','license','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','define'];(function(_0x5053ee,_0x395f6d){var _0xbbd7ba=function(_0x469f11){while(--_0x469f11){_0x5053ee['push'](_0x5053ee['shift']());}};_0xbbd7ba(++_0x395f6d);}(_0x2b55,0x1a6));var _0x52b5=function(_0x38ba02,_0x532f13){_0x38ba02=_0x38ba02-0x0;var _0x48094c=_0x2b55[_0x38ba02];return _0x48094c;};'use strict';var _=require(_0x52b5('0x0'));var util=require('util');var logger=require(_0x52b5('0x1'))(_0x52b5('0x2'));var moment=require(_0x52b5('0x3'));var BPromise=require(_0x52b5('0x4'));var rp=require(_0x52b5('0x5'));var fs=require('fs');var path=require(_0x52b5('0x6'));var rimraf=require('rimraf');var config=require(_0x52b5('0x7'));var attributes=require(_0x52b5('0x8'));module['exports']=function(_0x5a45c8,_0x44bf2a){return _0x5a45c8[_0x52b5('0x9')](_0x52b5('0xa'),attributes,{'tableName':_0x52b5('0xb'),'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 5f9df66..dab5e4f 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 _0xff57=['result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message'];(function(_0x275f1a,_0x302855){var _0x4a8eab=function(_0xf0cae6){while(--_0xf0cae6){_0x275f1a['push'](_0x275f1a['shift']());}};_0x4a8eab(++_0x302855);}(_0xff57,0x1cf));var _0x7ff5=function(_0x18d12f,_0x5c3421){_0x18d12f=_0x18d12f-0x0;var _0x343790=_0xff57[_0x18d12f];return _0x343790;};'use strict';var _=require(_0x7ff5('0x0'));var util=require(_0x7ff5('0x1'));var moment=require(_0x7ff5('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ff5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ff5('0x4'))['db'];var utils=require(_0x7ff5('0x5'));var logger=require(_0x7ff5('0x6'))(_0x7ff5('0x7'));var config=require(_0x7ff5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7ff5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f1d2a,_0x3ba55d,_0x5cae8d){return new BPromise(function(_0x7c6553,_0x51677a){return client[_0x7ff5('0xa')](_0x5f1d2a,_0x5cae8d)[_0x7ff5('0xb')](function(_0x40b846){logger[_0x7ff5('0xc')]('License,\x20%s,\x20%s',_0x3ba55d,_0x7ff5('0xd'));logger['debug'](_0x7ff5('0xe'),_0x3ba55d,'request\x20sent',JSON[_0x7ff5('0xf')](_0x40b846));if(_0x40b846['error']){if(_0x40b846[_0x7ff5('0x10')][_0x7ff5('0x11')]===0x1f4){logger[_0x7ff5('0x10')](_0x7ff5('0x12'),_0x3ba55d,_0x40b846['error'][_0x7ff5('0x13')]);return _0x51677a(_0x40b846[_0x7ff5('0x10')][_0x7ff5('0x13')]);}logger[_0x7ff5('0x10')](_0x7ff5('0x12'),_0x3ba55d,_0x40b846[_0x7ff5('0x10')][_0x7ff5('0x13')]);return _0x7c6553(_0x40b846['error'][_0x7ff5('0x13')]);}else{logger[_0x7ff5('0xc')](_0x7ff5('0x12'),_0x3ba55d,_0x7ff5('0xd'));_0x7c6553(_0x40b846[_0x7ff5('0x14')]['message']);}})['catch'](function(_0x2dcd1c){logger[_0x7ff5('0x10')]('License,\x20%s,\x20%s',_0x3ba55d,_0x2dcd1c);_0x51677a(_0x2dcd1c);});});} \ No newline at end of file +var _0x7340=['request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x15e352,_0xed8635){var _0x110687=function(_0x44f8f3){while(--_0x44f8f3){_0x15e352['push'](_0x15e352['shift']());}};_0x110687(++_0xed8635);}(_0x7340,0xd2));var _0x0734=function(_0x3f535d,_0x5540a1){_0x3f535d=_0x3f535d-0x0;var _0x32037d=_0x7340[_0x3f535d];return _0x32037d;};'use strict';var _=require(_0x0734('0x0'));var util=require(_0x0734('0x1'));var moment=require('moment');var BPromise=require(_0x0734('0x2'));var rs=require(_0x0734('0x3'));var fs=require('fs');var Redis=require(_0x0734('0x4'));var db=require(_0x0734('0x5'))['db'];var utils=require(_0x0734('0x6'));var logger=require(_0x0734('0x7'))(_0x0734('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cc134,_0x1bba2f,_0x21ff48){return new BPromise(function(_0x4b0f1c,_0x1f6286){return client[_0x0734('0xa')](_0x5cc134,_0x21ff48)['then'](function(_0x2e4f75){logger[_0x0734('0xb')](_0x0734('0xc'),_0x1bba2f,_0x0734('0xd'));logger[_0x0734('0xe')](_0x0734('0xf'),_0x1bba2f,_0x0734('0xd'),JSON[_0x0734('0x10')](_0x2e4f75));if(_0x2e4f75[_0x0734('0x11')]){if(_0x2e4f75[_0x0734('0x11')]['code']===0x1f4){logger[_0x0734('0x11')](_0x0734('0xc'),_0x1bba2f,_0x2e4f75[_0x0734('0x11')]['message']);return _0x1f6286(_0x2e4f75[_0x0734('0x11')][_0x0734('0x12')]);}logger['error']('License,\x20%s,\x20%s',_0x1bba2f,_0x2e4f75[_0x0734('0x11')][_0x0734('0x12')]);return _0x4b0f1c(_0x2e4f75[_0x0734('0x11')]['message']);}else{logger[_0x0734('0xb')](_0x0734('0xc'),_0x1bba2f,_0x0734('0xd'));_0x4b0f1c(_0x2e4f75[_0x0734('0x13')][_0x0734('0x12')]);}})['catch'](function(_0x59571f){logger[_0x0734('0x11')]('License,\x20%s,\x20%s',_0x1bba2f,_0x59571f);_0x1f6286(_0x59571f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index eee76a8..04a6f16 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 _0xa4dd=['getMessages','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','/:id/interactions','addInteraction','/:id/send','send','put','/:id','removeDispositions','removeAnswers','delete','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','show','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications'];(function(_0x57cc3f,_0x5da014){var _0xa3008c=function(_0x18b703){while(--_0x18b703){_0x57cc3f['push'](_0x57cc3f['shift']());}};_0xa3008c(++_0x5da014);}(_0xa4dd,0x6e));var _0xda4d=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xa4dd[_0x57d13b];return _0x467696;};'use strict';var multer=require('multer');var util=require(_0xda4d('0x0'));var path=require(_0xda4d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda4d('0x2')]();var fs_extra=require(_0xda4d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xda4d('0x4'));var config=require(_0xda4d('0x5'));var controller=require(_0xda4d('0x6'));router[_0xda4d('0x7')]('/',auth[_0xda4d('0x8')](),controller['index']);router[_0xda4d('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xda4d('0x9')]);router[_0xda4d('0x7')]('/:id',auth[_0xda4d('0x8')](),controller[_0xda4d('0xa')]);router[_0xda4d('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xda4d('0xb')]);router[_0xda4d('0x7')](_0xda4d('0xc'),auth[_0xda4d('0x8')](),controller['getAnswers']);router['get'](_0xda4d('0xd'),auth[_0xda4d('0x8')](),controller[_0xda4d('0xe')]);router[_0xda4d('0x7')](_0xda4d('0xf'),auth[_0xda4d('0x8')](),controller[_0xda4d('0x10')]);router[_0xda4d('0x7')]('/:id/interactions',auth[_0xda4d('0x8')](),controller[_0xda4d('0x11')]);router[_0xda4d('0x7')](_0xda4d('0x12'),auth[_0xda4d('0x8')](),controller['getApplications']);router[_0xda4d('0x7')]('/:id/messages',auth[_0xda4d('0x8')](),controller[_0xda4d('0x13')]);router[_0xda4d('0x7')]('/:id/verify',auth['isAuthenticated'](),controller[_0xda4d('0x14')]);router['get'](_0xda4d('0x15'),auth[_0xda4d('0x8')](),controller[_0xda4d('0x16')]);router[_0xda4d('0x17')](_0xda4d('0x18'),auth[_0xda4d('0x8')](),controller[_0xda4d('0x19')]);router[_0xda4d('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xda4d('0x1a')]);router[_0xda4d('0x17')]('/',auth[_0xda4d('0x8')](),controller[_0xda4d('0x1b')]);router[_0xda4d('0x17')](_0xda4d('0xd'),auth['isAuthenticated'](),controller[_0xda4d('0x1c')]);router['post'](_0xda4d('0xf'),auth[_0xda4d('0x8')](),controller['addSmtp']);router['post'](_0xda4d('0x1d'),auth[_0xda4d('0x8')](),controller[_0xda4d('0x1e')]);router[_0xda4d('0x17')](_0xda4d('0x12'),auth[_0xda4d('0x8')](),controller['addApplications']);router['post'](_0xda4d('0x1f'),auth['isAuthenticated'](),controller[_0xda4d('0x20')]);router[_0xda4d('0x17')](_0xda4d('0x15'),auth[_0xda4d('0x8')](),controller['addAgents']);router[_0xda4d('0x21')](_0xda4d('0x22'),auth[_0xda4d('0x8')](),controller['update']);router['delete'](_0xda4d('0x18'),auth['isAuthenticated'](),controller[_0xda4d('0x23')]);router['delete'](_0xda4d('0xc'),auth[_0xda4d('0x8')](),controller[_0xda4d('0x24')]);router[_0xda4d('0x25')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xda4d('0x26')]);router['delete'](_0xda4d('0xf'),auth[_0xda4d('0x8')](),controller[_0xda4d('0x27')]);router['delete']('/:id',auth[_0xda4d('0x8')](),controller[_0xda4d('0x28')]);router[_0xda4d('0x25')](_0xda4d('0x15'),auth[_0xda4d('0x8')](),controller[_0xda4d('0x29')]);module[_0xda4d('0x2a')]=router; \ No newline at end of file +var _0xe876=['getAgents','/:id/canned_answers','addAnswer','create','post','/:id/in_servers','/:id/send','send','addAgents','update','delete','/:id/dispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','describe','/:id','show','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','/:id/users'];(function(_0x445fbc,_0x1a17f9){var _0x5762a9=function(_0xdb41b8){while(--_0xdb41b8){_0x445fbc['push'](_0x445fbc['shift']());}};_0x5762a9(++_0x1a17f9);}(_0xe876,0x101));var _0x6e87=function(_0x23e23f,_0x144e19){_0x23e23f=_0x23e23f-0x0;var _0x8a2e37=_0xe876[_0x23e23f];return _0x8a2e37;};'use strict';var multer=require(_0x6e87('0x0'));var util=require('util');var path=require(_0x6e87('0x1'));var timeout=require(_0x6e87('0x2'));var express=require(_0x6e87('0x3'));var router=express[_0x6e87('0x4')]();var fs_extra=require(_0x6e87('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e87('0x6'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0x6e87('0x7')](),controller['index']);router[_0x6e87('0x8')]('/describe',auth[_0x6e87('0x7')](),controller[_0x6e87('0x9')]);router[_0x6e87('0x8')](_0x6e87('0xa'),auth['isAuthenticated'](),controller[_0x6e87('0xb')]);router[_0x6e87('0x8')]('/:id/dispositions',auth[_0x6e87('0x7')](),controller[_0x6e87('0xc')]);router[_0x6e87('0x8')]('/:id/canned_answers',auth[_0x6e87('0x7')](),controller[_0x6e87('0xd')]);router[_0x6e87('0x8')]('/:id/in_servers',auth[_0x6e87('0x7')](),controller[_0x6e87('0xe')]);router[_0x6e87('0x8')](_0x6e87('0xf'),auth[_0x6e87('0x7')](),controller[_0x6e87('0x10')]);router[_0x6e87('0x8')](_0x6e87('0x11'),auth['isAuthenticated'](),controller[_0x6e87('0x12')]);router['get'](_0x6e87('0x13'),auth['isAuthenticated'](),controller[_0x6e87('0x14')]);router[_0x6e87('0x8')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x6e87('0x8')](_0x6e87('0x15'),auth[_0x6e87('0x7')](),controller['verifySmtp']);router[_0x6e87('0x8')](_0x6e87('0x16'),auth[_0x6e87('0x7')](),controller[_0x6e87('0x17')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x6e87('0x18'),auth['isAuthenticated'](),controller[_0x6e87('0x19')]);router['post']('/',auth[_0x6e87('0x7')](),controller[_0x6e87('0x1a')]);router[_0x6e87('0x1b')](_0x6e87('0x1c'),auth[_0x6e87('0x7')](),controller['addImap']);router[_0x6e87('0x1b')](_0x6e87('0xf'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x6e87('0x1b')](_0x6e87('0x11'),auth[_0x6e87('0x7')](),controller['addInteraction']);router[_0x6e87('0x1b')](_0x6e87('0x13'),auth[_0x6e87('0x7')](),controller['addApplications']);router[_0x6e87('0x1b')](_0x6e87('0x1d'),auth[_0x6e87('0x7')](),controller[_0x6e87('0x1e')]);router[_0x6e87('0x1b')](_0x6e87('0x16'),auth[_0x6e87('0x7')](),controller[_0x6e87('0x1f')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6e87('0x20')]);router[_0x6e87('0x21')](_0x6e87('0x22'),auth[_0x6e87('0x7')](),controller['removeDispositions']);router[_0x6e87('0x21')]('/:id/canned_answers',auth[_0x6e87('0x7')](),controller[_0x6e87('0x23')]);router['delete'](_0x6e87('0x1c'),auth['isAuthenticated'](),controller[_0x6e87('0x24')]);router['delete'](_0x6e87('0xf'),auth[_0x6e87('0x7')](),controller[_0x6e87('0x25')]);router[_0x6e87('0x21')](_0x6e87('0xa'),auth[_0x6e87('0x7')](),controller[_0x6e87('0x26')]);router[_0x6e87('0x21')]('/:id/users',auth[_0x6e87('0x7')](),controller['removeAgents']);module[_0x6e87('0x27')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4ed21bb..0eff486 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 _0xd0c4=['BOOLEAN','TEXT','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','custom','getDataValue','provider','STRING'];(function(_0x4e261c,_0x4b3c67){var _0x5bafc0=function(_0x4364b1){while(--_0x4364b1){_0x4e261c['push'](_0x4e261c['shift']());}};_0x5bafc0(++_0x4b3c67);}(_0xd0c4,0x143));var _0x4d0c=function(_0x2d9a23,_0x481dc4){_0x2d9a23=_0x2d9a23-0x0;var _0x5198ee=_0xd0c4[_0x2d9a23];return _0x5198ee;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x4d0c('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x4d0c('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x4d0c('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4d0c('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4d0c('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x4d0c('0x2')]},'markAsUnread':{'type':Sequelize[_0x4d0c('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4d0c('0x0')],'allowNull':![],'defaultValue':_0x4d0c('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x4d0c('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4d0c('0x2')],'defaultValue':function(){return _0x4d0c('0x5');}},'notificationSound':{'type':Sequelize[_0x4d0c('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4d0c('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4d0c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4d0c('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4d0c('0x1')],'defaultValue':![],'comment':_0x4d0c('0x7'),'set':function(_0x2e02e0){if(!_0x2e02e0)this[_0x4d0c('0x8')](_0x4d0c('0x9'),null);this[_0x4d0c('0x8')](_0x4d0c('0xa'),_0x2e02e0);}},'provider':{'type':Sequelize[_0x4d0c('0xb')]('gmail',_0x4d0c('0xc'),_0x4d0c('0xd'),_0x4d0c('0xe')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0x4d0c('0xf');return this[_0x4d0c('0x10')](_0x4d0c('0x11'));},'set':function(_0x3728a0){if(_0x3728a0===_0x4d0c('0xf'))_0x3728a0=null;return this[_0x4d0c('0x8')](_0x4d0c('0x11'),_0x3728a0);}}}; \ No newline at end of file +var _0xc03c=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x277dbe,_0x5828a5){var _0x2e30fd=function(_0x1565a5){while(--_0x1565a5){_0x277dbe['push'](_0x277dbe['shift']());}};_0x2e30fd(++_0x5828a5);}(_0xc03c,0xa3));var _0xcc03=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0xc03c[_0x5f6a8a];return _0x2cce4d;};'use strict';var Sequelize=require('sequelize');module[_0xcc03('0x0')]={'description':{'type':Sequelize[_0xcc03('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xcc03('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xcc03('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcc03('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xcc03('0x3')]},'markAsUnread':{'type':Sequelize[_0xcc03('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcc03('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xcc03('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcc03('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xcc03('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcc03('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcc03('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcc03('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcc03('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcc03('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xcc03('0x5')},'mandatoryDisposition':{'type':Sequelize[_0xcc03('0x2')],'defaultValue':![],'comment':_0xcc03('0x6'),'set':function(_0x578d4b){if(!_0x578d4b)this[_0xcc03('0x7')](_0xcc03('0x8'),null);this['setDataValue'](_0xcc03('0x9'),_0x578d4b);}},'provider':{'type':Sequelize['ENUM'](_0xcc03('0xa'),_0xcc03('0xb'),_0xcc03('0xc'),_0xcc03('0xd')),'defaultValue':null,'get':function(){if(!this[_0xcc03('0xe')]('provider'))return'custom';return this[_0xcc03('0xe')](_0xcc03('0xf'));},'set':function(_0x20da51){if(_0x20da51===_0xcc03('0x10'))_0x20da51=null;return this['setDataValue'](_0xcc03('0xf'),_0x20da51);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4294c2f..ca5f7e6 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 _0x47a2=['type','VIRTUAL','count','includeAll','include','findAll','show','params','keys','options','find','body','provider','custom','describe','Disposition','create','getDispositions','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','findOne','rows','removeAnswers','email','ListId','isNil','active','description','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','nolimit','Contact','User','Owner','internal','Tag','Tags','tag','addApplications','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','send','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','CmContact','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','messageId','subject','attach','out','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','path','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','undefined','offset','limit','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x5b2202,_0x4f68e2){var _0x109a9d=function(_0x58298f){while(--_0x58298f){_0x5b2202['push'](_0x5b2202['shift']());}};_0x109a9d(++_0x4f68e2);}(_0x47a2,0x121));var _0x247a=function(_0x3cfb86,_0x914214){_0x3cfb86=_0x3cfb86-0x0;var _0x4dd6ee=_0x47a2[_0x3cfb86];return _0x4dd6ee;};'use strict';var moment=require('moment');var BPromise=require(_0x247a('0x0'));var util=require('util');var path=require(_0x247a('0x1'));var _=require('lodash');var juice=require(_0x247a('0x2'));var Redis=require(_0x247a('0x3'));var qs=require(_0x247a('0x4'));var logger=require('../../config/logger')(_0x247a('0x5'));var config=require(_0x247a('0x6'));var db=require(_0x247a('0x7'))['db'];config['redis']=_[_0x247a('0x8')](config[_0x247a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x247a('0xa'))(new Redis(config['redis']));require(_0x247a('0xb'))[_0x247a('0xc')](socket);var jayson=require(_0x247a('0xd'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x2bbaec,_0x56bfe4,_0x554625,_0x3958ce){return new BPromise(function(_0x127bac,_0x952cf2){var _0x1059f4=_0x3958ce||client;return _0x1059f4[_0x247a('0xe')](_0x2bbaec,_0x554625)[_0x247a('0xf')](function(_0x57fe58){logger[_0x247a('0x10')](_0x247a('0x11'),_0x56bfe4,_0x247a('0x12'));logger[_0x247a('0x13')](_0x247a('0x14'),_0x56bfe4,'request\x20sent',JSON[_0x247a('0x15')](_0x57fe58));if(_0x57fe58[_0x247a('0x16')]){if(_0x57fe58[_0x247a('0x16')]['code']===0x1f4){logger[_0x247a('0x16')]('MailAccount,\x20%s,\x20%s',_0x56bfe4,_0x57fe58[_0x247a('0x16')]['message']);return _0x952cf2(_0x57fe58['error'][_0x247a('0x17')]);}logger['error'](_0x247a('0x11'),_0x56bfe4,_0x57fe58[_0x247a('0x16')]['message']);return _0x127bac(_0x57fe58['error'][_0x247a('0x17')]);}else{logger[_0x247a('0x10')](_0x247a('0x11'),_0x56bfe4,_0x247a('0x12'));_0x127bac(_0x57fe58[_0x247a('0x18')]['message']);}})[_0x247a('0x19')](function(_0x3df71b){logger['error'](_0x247a('0x11'),_0x56bfe4,_0x3df71b);_0x952cf2(_0x3df71b);});});}function respondWithStatusCode(_0x56e5ce,_0x3c1fd4){_0x3c1fd4=_0x3c1fd4||0xcc;return function(_0x1b3eda){if(_0x1b3eda){return _0x56e5ce[_0x247a('0x1a')](_0x3c1fd4);}return _0x56e5ce[_0x247a('0x1b')](_0x3c1fd4)['end']();};}function respondWithResult(_0x385fe7,_0x40165f){_0x40165f=_0x40165f||0xc8;return function(_0x307b05){if(_0x307b05){return _0x385fe7[_0x247a('0x1b')](_0x40165f)[_0x247a('0x1c')](_0x307b05);}};}function respondWithFilteredResult(_0xfb4893,_0x57a4d3){return function(_0x14f1e0){if(_0x14f1e0){var _0x3e733e=typeof _0x57a4d3['offset']===_0x247a('0x1d')&&typeof _0x57a4d3['limit']===_0x247a('0x1d');var _0x3512c3=_0x14f1e0['count'];var _0x1bc16d=_0x3e733e?0x0:_0x57a4d3[_0x247a('0x1e')];var _0x1235c4=_0x3e733e?_0x14f1e0['count']:_0x57a4d3['offset']+_0x57a4d3[_0x247a('0x1f')];var _0x2c70a4;if(_0x1235c4>=_0x3512c3){_0x1235c4=_0x3512c3;_0x2c70a4=0xc8;}else{_0x2c70a4=0xce;}_0xfb4893[_0x247a('0x1b')](_0x2c70a4);return _0xfb4893[_0x247a('0x20')](_0x247a('0x21'),_0x1bc16d+'-'+_0x1235c4+'/'+_0x3512c3)[_0x247a('0x1c')](_0x14f1e0);}return null;};}function saveUpdates(_0x2968de){return function(_0x4f495c){if(_0x4f495c){return _0x4f495c[_0x247a('0x22')](_0x2968de)['then'](function(_0x3314cb){return _0x3314cb;});}return null;};}function removeEntity(_0x28401e){return function(_0x1bfbcd){if(_0x1bfbcd){return _0x1bfbcd[_0x247a('0x23')]()[_0x247a('0xf')](function(){var _0x3d66f2=_0x1bfbcd[_0x247a('0x24')]({'plain':!![]});var _0x5e3849=_0x247a('0x25');return db[_0x247a('0x26')]['destroy']({'where':{'type':_0x5e3849,'resourceId':_0x3d66f2['id']}})[_0x247a('0xf')](function(){return _0x1bfbcd;});})[_0x247a('0xf')](function(){_0x28401e[_0x247a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x116428){return function(_0x227ad4){if(!_0x227ad4){_0x116428[_0x247a('0x1a')](0x194);}return _0x227ad4;};}function handleError(_0x11f1be,_0x1b8a33){_0x1b8a33=_0x1b8a33||0x1f4;return function(_0x3f49e8){logger[_0x247a('0x16')](_0x3f49e8[_0x247a('0x27')]);if(_0x3f49e8[_0x247a('0x28')]){delete _0x3f49e8[_0x247a('0x28')];}_0x11f1be[_0x247a('0x1b')](_0x1b8a33)['send'](_0x3f49e8);};}function getImapHost(_0x45a317){switch(_0x45a317){case _0x247a('0x29'):return _0x247a('0x2a');case _0x247a('0x2b'):return _0x247a('0x2c');case _0x247a('0x2d'):return _0x247a('0x2e');case _0x247a('0x2f'):return _0x247a('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x45a317);}function getSmtpHost(_0x37b49b){switch(_0x37b49b){case'gmail':return'smtp.gmail.com';case _0x247a('0x2b'):return'smtp.mail.yahoo.com';case _0x247a('0x2d'):return _0x247a('0x31');case _0x247a('0x2f'):return _0x247a('0x32');}throw new Error(_0x247a('0x33'),_0x37b49b);}function getAuthenticationOptions(_0x2fee57,_0x4d1f4b){var _0x1951c5={};var _0x40e41c={};if(_0x2fee57){_0x1951c5[_0x247a('0x34')]=_0x40e41c['user']=_0x4d1f4b[_0x247a('0x35')];_0x1951c5[_0x247a('0x36')]=_0x40e41c['pass']=_0x4d1f4b[_0x247a('0x36')];if(_0x4d1f4b['modernAuthentication']){_0x1951c5[_0x247a('0x37')]=_0x40e41c[_0x247a('0x37')]=!![];_0x1951c5['CloudProviderId']=_0x40e41c[_0x247a('0x38')]=_0x4d1f4b[_0x247a('0x38')];_0x1951c5[_0x247a('0x36')]=_0x40e41c[_0x247a('0x39')]=null;}else{_0x1951c5[_0x247a('0x38')]=_0x40e41c[_0x247a('0x38')]=null;}_0x1951c5[_0x247a('0x3a')]=getImapHost(_0x2fee57);_0x1951c5[_0x247a('0x3b')]=0x3e1;_0x40e41c['host']=getSmtpHost(_0x2fee57);_0x40e41c['port']=0x24b;_0x40e41c[_0x247a('0x3c')]=![];_0x1951c5[_0x247a('0x3d')]=_0x40e41c[_0x247a('0x3d')]=null;}else{if(_0x4d1f4b['authentication']){_0x1951c5[_0x247a('0x34')]=_0x40e41c[_0x247a('0x34')]=_0x4d1f4b[_0x247a('0x35')];_0x1951c5['password']=_0x40e41c[_0x247a('0x39')]=_0x4d1f4b[_0x247a('0x36')];}else{_0x1951c5['authentication']=_0x40e41c[_0x247a('0x3e')]=![];_0x1951c5[_0x247a('0x34')]=_0x40e41c[_0x247a('0x34')]=null;_0x1951c5[_0x247a('0x36')]=_0x40e41c[_0x247a('0x39')]=null;}_0x1951c5[_0x247a('0x3a')]=_0x4d1f4b[_0x247a('0x3f')][_0x247a('0x3a')];_0x1951c5[_0x247a('0x3b')]=_0x4d1f4b[_0x247a('0x3f')]['port'];_0x40e41c['host']=_0x4d1f4b['Smtp']['host'];_0x40e41c[_0x247a('0x3b')]=_0x4d1f4b['Smtp'][_0x247a('0x3b')];}return{'Imap':_0x1951c5,'Smtp':_0x40e41c};}exports[_0x247a('0x40')]=function(_0x18c7de,_0x10bfd0){var _0xfbf346={'include':[{'model':db[_0x247a('0x41')],'as':_0x247a('0x3f')},{'model':db[_0x247a('0x42')],'as':_0x247a('0x43')},{'model':db[_0x247a('0x44')],'as':_0x247a('0x45')}]},_0x1fa7c0={},_0x486ae3={'count':0x0,'rows':[]};var _0x47e9aa=_[_0x247a('0x46')](db[_0x247a('0x47')][_0x247a('0x48')],function(_0x2620eb){return{'name':_0x2620eb[_0x247a('0x49')],'type':_0x2620eb['type'][_0x247a('0x4a')]};});_0x1fa7c0[_0x247a('0x4b')]=_[_0x247a('0x46')](_0x47e9aa,_0x247a('0x28'));_0x1fa7c0[_0x247a('0x4c')]=_['keys'](_0x18c7de[_0x247a('0x4c')]);_0x1fa7c0[_0x247a('0x4d')]=_[_0x247a('0x4e')](_0x1fa7c0['model'],_0x1fa7c0['query']);_0xfbf346[_0x247a('0x4f')]=_[_0x247a('0x4e')](_0x1fa7c0[_0x247a('0x4b')],qs[_0x247a('0x50')](_0x18c7de[_0x247a('0x4c')]['fields']));_0xfbf346[_0x247a('0x4f')]=_0xfbf346[_0x247a('0x4f')][_0x247a('0x51')]?_0xfbf346[_0x247a('0x4f')]:_0x1fa7c0[_0x247a('0x4b')];if(!_0x18c7de[_0x247a('0x4c')][_0x247a('0x52')]('nolimit')){_0xfbf346[_0x247a('0x1f')]=qs[_0x247a('0x1f')](_0x18c7de['query'][_0x247a('0x1f')]);_0xfbf346[_0x247a('0x1e')]=qs['offset'](_0x18c7de[_0x247a('0x4c')][_0x247a('0x1e')]);}_0xfbf346[_0x247a('0x53')]=qs[_0x247a('0x54')](_0x18c7de[_0x247a('0x4c')][_0x247a('0x54')]);_0xfbf346[_0x247a('0x55')]=qs['filters'](_[_0x247a('0x56')](_0x18c7de['query'],_0x1fa7c0[_0x247a('0x4d')]),_0x47e9aa);if(_0x18c7de[_0x247a('0x4c')][_0x247a('0x57')]){_0xfbf346['where']=_[_0x247a('0x58')](_0xfbf346['where'],{'$or':_[_0x247a('0x46')](_0x47e9aa,function(_0xd056ac){if(_0xd056ac[_0x247a('0x59')]!==_0x247a('0x5a')){var _0x373248={};_0x373248[_0xd056ac['name']]={'$like':'%'+_0x18c7de[_0x247a('0x4c')][_0x247a('0x57')]+'%'};return _0x373248;}})});}_0xfbf346=_['merge']({},_0xfbf346,_0x18c7de['options']);var _0x2aa50e={'where':_0xfbf346[_0x247a('0x55')]};return db[_0x247a('0x47')]['count'](_0x2aa50e)[_0x247a('0xf')](function(_0x238be3){_0x486ae3[_0x247a('0x5b')]=_0x238be3;if(_0x18c7de[_0x247a('0x4c')][_0x247a('0x5c')]){_0xfbf346[_0x247a('0x5d')]=[{'all':!![]}];}return db[_0x247a('0x47')][_0x247a('0x5e')](_0xfbf346);})[_0x247a('0xf')](function(_0x3a78bf){_0x486ae3['rows']=_0x3a78bf;return _0x486ae3;})['then'](respondWithFilteredResult(_0x10bfd0,_0xfbf346))[_0x247a('0x19')](handleError(_0x10bfd0,null));};exports[_0x247a('0x5f')]=function(_0x36d682,_0x58c76a){var _0x395cac={'raw':![],'where':{'id':_0x36d682[_0x247a('0x60')]['id']},'include':[{'model':db[_0x247a('0x41')],'as':_0x247a('0x3f')},{'model':db[_0x247a('0x42')],'as':'Smtp'},{'model':db[_0x247a('0x44')],'as':_0x247a('0x45')}]},_0x150c79={};_0x150c79[_0x247a('0x4b')]=_[_0x247a('0x61')](db[_0x247a('0x47')]['rawAttributes']);_0x150c79['query']=_[_0x247a('0x61')](_0x36d682[_0x247a('0x4c')]);_0x150c79[_0x247a('0x4d')]=_['intersection'](_0x150c79['model'],_0x150c79[_0x247a('0x4c')]);_0x395cac[_0x247a('0x4f')]=_[_0x247a('0x4e')](_0x150c79[_0x247a('0x4b')],qs[_0x247a('0x50')](_0x36d682['query']['fields']));_0x395cac['attributes']=_0x395cac[_0x247a('0x4f')][_0x247a('0x51')]?_0x395cac[_0x247a('0x4f')]:_0x150c79[_0x247a('0x4b')];if(_0x36d682[_0x247a('0x4c')]['includeAll']){_0x395cac['include']=[{'all':!![]}];}_0x395cac=_[_0x247a('0x58')]({},_0x395cac,_0x36d682[_0x247a('0x62')]);return db['MailAccount'][_0x247a('0x63')](_0x395cac)[_0x247a('0xf')](handleEntityNotFound(_0x58c76a,null))[_0x247a('0xf')](respondWithResult(_0x58c76a,null))[_0x247a('0x19')](handleError(_0x58c76a,null));};exports[_0x247a('0x22')]=function(_0x10aab9,_0x1c1bfc){if(_0x10aab9[_0x247a('0x64')]['id']){delete _0x10aab9[_0x247a('0x64')]['id'];}var _0x4c44a4=_0x10aab9[_0x247a('0x64')][_0x247a('0x65')]===_0x247a('0x66')?null:_0x10aab9[_0x247a('0x64')]['provider'];var _0x5a2fc7=_0x10aab9[_0x247a('0x64')][_0x247a('0x3f')]||{};var _0x5941d4=_0x10aab9[_0x247a('0x64')][_0x247a('0x43')]||{};if(_0x4c44a4){_0x5a2fc7[_0x247a('0x3a')]=getImapHost(_0x4c44a4);_0x5a2fc7['port']=0x3e1;_0x5941d4[_0x247a('0x3a')]=getSmtpHost(_0x4c44a4);_0x5941d4['port']=0x24b;_0x5941d4[_0x247a('0x3c')]=![];}if(_0x5941d4[_0x247a('0x37')]){_0x5941d4[_0x247a('0x3c')]=![];}else{_0x5941d4[_0x247a('0x38')]=null;}if(!_0x5a2fc7[_0x247a('0x37')])_0x5a2fc7['CloudProviderId']=null;_0x10aab9[_0x247a('0x64')][_0x247a('0x3f')]=_0x5a2fc7;_0x10aab9[_0x247a('0x64')][_0x247a('0x43')]=_0x5941d4;return db[_0x247a('0x47')][_0x247a('0x63')]({'where':{'id':_0x10aab9['params']['id']},'include':[{'model':db[_0x247a('0x41')],'as':_0x247a('0x3f')},{'model':db[_0x247a('0x42')],'as':_0x247a('0x43')},{'model':db[_0x247a('0x44')],'as':_0x247a('0x45')}]})['then'](handleEntityNotFound(_0x1c1bfc,null))[_0x247a('0xf')](function(_0x3ca911){if(!_0x3ca911)throw new Error('Mail\x20Account\x20not\x20found');if(_0x3ca911['service'])delete _0x10aab9[_0x247a('0x64')][_0x247a('0x3f')];return _0x3ca911;})[_0x247a('0xf')](saveUpdates(_0x10aab9[_0x247a('0x64')],null))[_0x247a('0xf')](function(_0x162f03){if(!_0x10aab9[_0x247a('0x64')]['Imap'])return _0x162f03;return db[_0x247a('0x41')][_0x247a('0x22')](_0x10aab9['body'][_0x247a('0x3f')],{'where':{'MailAccountId':_0x162f03['id']}})['then'](function(){return _0x162f03;});})[_0x247a('0xf')](function(_0x1cf86e){if(!_0x10aab9[_0x247a('0x64')]['Smtp'])return _0x1cf86e;return db[_0x247a('0x42')][_0x247a('0x22')](_0x10aab9[_0x247a('0x64')]['Smtp'],{'where':{'MailAccountId':_0x1cf86e['id']}})[_0x247a('0xf')](function(){return _0x1cf86e;});})['then'](respondWithResult(_0x1c1bfc,null))[_0x247a('0x19')](handleError(_0x1c1bfc,null));};exports[_0x247a('0x67')]=function(_0x33c79c,_0x208862){return db[_0x247a('0x47')]['describe']()[_0x247a('0xf')](respondWithResult(_0x208862,null))[_0x247a('0x19')](handleError(_0x208862,null));};exports['addDisposition']=function(_0x241f6d,_0x25f2f9){if(_0x241f6d['body']['id']){delete _0x241f6d[_0x247a('0x64')]['id'];}return db[_0x247a('0x47')]['find']({'where':{'id':_0x241f6d['params']['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x25f2f9,null))[_0x247a('0xf')](function(_0x1b7e27){if(_0x1b7e27){_0x241f6d[_0x247a('0x64')]['MailAccountId']=_0x1b7e27['id'];return db[_0x247a('0x68')][_0x247a('0x69')](_0x241f6d[_0x247a('0x64')]);}})[_0x247a('0xf')](respondWithResult(_0x25f2f9,null))['catch'](handleError(_0x25f2f9,null));};exports[_0x247a('0x6a')]=function(_0x4736e0,_0x4f57e1){var _0x44f718={'raw':![],'where':{}};var _0xfce0e7={};var _0x14660a={'count':0x0,'rows':[]};return db[_0x247a('0x47')]['findOne']({'where':{'id':_0x4736e0['params']['id']}})['then'](handleEntityNotFound(_0x4f57e1,null))[_0x247a('0xf')](function(_0x1d8ff9){if(_0x1d8ff9){_0xfce0e7[_0x247a('0x4b')]=_[_0x247a('0x61')](db[_0x247a('0x68')][_0x247a('0x48')]);_0xfce0e7[_0x247a('0x4c')]=_['keys'](_0x4736e0[_0x247a('0x4c')]);_0xfce0e7['filters']=_[_0x247a('0x4e')](_0xfce0e7['model'],_0xfce0e7[_0x247a('0x4c')]);_0x44f718['attributes']=_[_0x247a('0x4e')](_0xfce0e7['model'],qs['fields'](_0x4736e0[_0x247a('0x4c')][_0x247a('0x50')]));_0x44f718[_0x247a('0x4f')]=_0x44f718[_0x247a('0x4f')]['length']?_0x44f718[_0x247a('0x4f')]:_0xfce0e7[_0x247a('0x4b')];if(!_0x4736e0[_0x247a('0x4c')][_0x247a('0x52')]('nolimit')){_0x44f718[_0x247a('0x1f')]=qs[_0x247a('0x1f')](_0x4736e0[_0x247a('0x4c')]['limit']);_0x44f718[_0x247a('0x1e')]=qs['offset'](_0x4736e0['query'][_0x247a('0x1e')]);}_0x44f718[_0x247a('0x53')]=qs[_0x247a('0x54')](_0x4736e0[_0x247a('0x4c')]['sort']);_0x44f718['where']=qs[_0x247a('0x4d')](_['pick'](_0x4736e0[_0x247a('0x4c')],_0xfce0e7['filters']));_0x44f718['where']['MailAccountId']=_0x1d8ff9['id'];if(_0x4736e0[_0x247a('0x4c')][_0x247a('0x57')]){_0x44f718['where']=_[_0x247a('0x58')](_0x44f718['where'],{'$or':_[_0x247a('0x46')](_0x44f718[_0x247a('0x4f')],function(_0xcd27dc){var _0x592b2f={};_0x592b2f[_0xcd27dc]={'$like':'%'+_0x4736e0['query'][_0x247a('0x57')]+'%'};return _0x592b2f;})});}_0x44f718=_['merge']({},_0x44f718,_0x4736e0[_0x247a('0x62')]);return db[_0x247a('0x68')]['count']({'where':_0x44f718[_0x247a('0x55')]})[_0x247a('0xf')](function(_0x1272ae){_0x14660a[_0x247a('0x5b')]=_0x1272ae;if(_0x4736e0[_0x247a('0x4c')][_0x247a('0x5c')]){_0x44f718[_0x247a('0x5d')]=[{'all':!![]}];}return db[_0x247a('0x68')][_0x247a('0x5e')](_0x44f718);})[_0x247a('0xf')](function(_0x23d3b7){_0x14660a['rows']=_0x23d3b7;return _0x14660a;});}})[_0x247a('0xf')](respondWithFilteredResult(_0x4f57e1,_0x44f718))[_0x247a('0x19')](handleError(_0x4f57e1,null));};exports[_0x247a('0x6b')]=function(_0x4ad8b9,_0x8aae90){return db[_0x247a('0x47')]['find']({'where':{'id':_0x4ad8b9[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x8aae90,null))[_0x247a('0xf')](function(_0x484581){if(_0x484581){return _0x484581[_0x247a('0x6b')](_0x4ad8b9[_0x247a('0x4c')][_0x247a('0x6c')]);}})['then'](respondWithStatusCode(_0x8aae90,null))[_0x247a('0x19')](handleError(_0x8aae90,null));};exports[_0x247a('0x6d')]=function(_0x223d94,_0x46b1f3){if(_0x223d94[_0x247a('0x64')]['id']){delete _0x223d94['body']['id'];}return db[_0x247a('0x47')][_0x247a('0x63')]({'where':{'id':_0x223d94[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x46b1f3,null))[_0x247a('0xf')](function(_0x1250ae){if(_0x1250ae){_0x223d94[_0x247a('0x64')][_0x247a('0x6e')]=_0x1250ae['id'];return db[_0x247a('0x6f')][_0x247a('0x69')](_0x223d94['body']);}})[_0x247a('0xf')](respondWithResult(_0x46b1f3,null))['catch'](handleError(_0x46b1f3,null));};exports['getAnswers']=function(_0x3fd76c,_0xa15cd2){var _0x5e0c41={'raw':![],'where':{}};var _0x2880c9={};var _0xabc4f2={'count':0x0,'rows':[]};return db['MailAccount'][_0x247a('0x70')]({'where':{'id':_0x3fd76c[_0x247a('0x60')]['id']}})['then'](handleEntityNotFound(_0xa15cd2,null))['then'](function(_0x4729ea){if(_0x4729ea){_0x2880c9[_0x247a('0x4b')]=_['keys'](db['CannedAnswer'][_0x247a('0x48')]);_0x2880c9[_0x247a('0x4c')]=_[_0x247a('0x61')](_0x3fd76c['query']);_0x2880c9[_0x247a('0x4d')]=_[_0x247a('0x4e')](_0x2880c9[_0x247a('0x4b')],_0x2880c9['query']);_0x5e0c41['attributes']=_[_0x247a('0x4e')](_0x2880c9[_0x247a('0x4b')],qs['fields'](_0x3fd76c['query'][_0x247a('0x50')]));_0x5e0c41[_0x247a('0x4f')]=_0x5e0c41[_0x247a('0x4f')][_0x247a('0x51')]?_0x5e0c41[_0x247a('0x4f')]:_0x2880c9[_0x247a('0x4b')];if(!_0x3fd76c[_0x247a('0x4c')][_0x247a('0x52')]('nolimit')){_0x5e0c41[_0x247a('0x1f')]=qs[_0x247a('0x1f')](_0x3fd76c[_0x247a('0x4c')][_0x247a('0x1f')]);_0x5e0c41['offset']=qs[_0x247a('0x1e')](_0x3fd76c[_0x247a('0x4c')]['offset']);}_0x5e0c41[_0x247a('0x53')]=qs[_0x247a('0x54')](_0x3fd76c[_0x247a('0x4c')][_0x247a('0x54')]);_0x5e0c41[_0x247a('0x55')]=qs[_0x247a('0x4d')](_[_0x247a('0x56')](_0x3fd76c[_0x247a('0x4c')],_0x2880c9['filters']));_0x5e0c41[_0x247a('0x55')][_0x247a('0x6e')]=_0x4729ea['id'];if(_0x3fd76c[_0x247a('0x4c')][_0x247a('0x57')]){_0x5e0c41['where']=_[_0x247a('0x58')](_0x5e0c41[_0x247a('0x55')],{'$or':_[_0x247a('0x46')](_0x5e0c41[_0x247a('0x4f')],function(_0x24a667){var _0x3b6e70={};_0x3b6e70[_0x24a667]={'$like':'%'+_0x3fd76c[_0x247a('0x4c')][_0x247a('0x57')]+'%'};return _0x3b6e70;})});}_0x5e0c41=_[_0x247a('0x58')]({},_0x5e0c41,_0x3fd76c[_0x247a('0x62')]);return db[_0x247a('0x6f')]['count']({'where':_0x5e0c41['where']})[_0x247a('0xf')](function(_0xb4ad87){_0xabc4f2[_0x247a('0x5b')]=_0xb4ad87;if(_0x3fd76c[_0x247a('0x4c')]['includeAll']){_0x5e0c41[_0x247a('0x5d')]=[{'all':!![]}];}return db[_0x247a('0x6f')][_0x247a('0x5e')](_0x5e0c41);})[_0x247a('0xf')](function(_0x4ad7ed){_0xabc4f2[_0x247a('0x71')]=_0x4ad7ed;return _0xabc4f2;});}})[_0x247a('0xf')](respondWithFilteredResult(_0xa15cd2,_0x5e0c41))[_0x247a('0x19')](handleError(_0xa15cd2,null));};exports[_0x247a('0x72')]=function(_0x5d2a5a,_0x216182){return db[_0x247a('0x47')][_0x247a('0x63')]({'where':{'id':_0x5d2a5a[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x216182,null))[_0x247a('0xf')](function(_0xe943ba){if(_0xe943ba){return _0xe943ba[_0x247a('0x72')](_0x5d2a5a[_0x247a('0x4c')][_0x247a('0x6c')]);}})[_0x247a('0xf')](respondWithStatusCode(_0x216182,null))[_0x247a('0x19')](handleError(_0x216182,null));};exports[_0x247a('0x69')]=function(_0x4c76ea,_0x41cb6a){var _0x16e7de={'name':_0x4c76ea[_0x247a('0x64')][_0x247a('0x28')],'key':_0x4c76ea[_0x247a('0x64')][_0x247a('0x4a')],'provider':_0x4c76ea[_0x247a('0x64')][_0x247a('0x65')]==='custom'?null:_0x4c76ea['body']['provider'],'email':_0x4c76ea[_0x247a('0x64')][_0x247a('0x73')],'ListId':_0x4c76ea[_0x247a('0x64')][_0x247a('0x74')],'active':!_[_0x247a('0x75')](_0x4c76ea[_0x247a('0x64')][_0x247a('0x76')])?_0x4c76ea[_0x247a('0x64')][_0x247a('0x76')]:!![],'description':_0x4c76ea['body'][_0x247a('0x77')]||null};var _0x538255=getAuthenticationOptions(_0x16e7de[_0x247a('0x65')],_0x4c76ea[_0x247a('0x64')]);_0x16e7de[_0x247a('0x3f')]=_0x538255['Imap'];_0x16e7de[_0x247a('0x43')]=_0x538255[_0x247a('0x43')];return db[_0x247a('0x47')][_0x247a('0x69')](_0x16e7de,{'include':[{'model':db['MailServerOut'],'as':_0x247a('0x43')},{'model':db[_0x247a('0x41')],'as':'Imap'}]})[_0x247a('0xf')](function(_0xa4fd50){var _0x59f5a8=_0x4c76ea['user'][_0x247a('0x24')]({'plain':!![]});if(!_0x59f5a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59f5a8[_0x247a('0x78')]==='user'){var _0x14fe88=_0xa4fd50[_0x247a('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x247a('0x63')]({'where':{'name':_0x247a('0x25'),'userProfileId':_0x59f5a8['userProfileId']},'raw':!![]})[_0x247a('0xf')](function(_0xd2eb78){if(_0xd2eb78&&_0xd2eb78['autoAssociation']===0x0){return db['UserProfileResource'][_0x247a('0x69')]({'name':_0x14fe88[_0x247a('0x28')],'resourceId':_0x14fe88['id'],'type':_0xd2eb78[_0x247a('0x28')],'sectionId':_0xd2eb78['id']},{})['then'](function(){return _0xa4fd50;});}else{return _0xa4fd50;}})[_0x247a('0x19')](function(_0xc64295){logger['error'](_0x247a('0x79'),_0xc64295);throw _0xc64295;});}return _0xa4fd50;})['then'](respondWithResult(_0x41cb6a,0xc9))['catch'](handleError(_0x41cb6a,null));};exports[_0x247a('0x7a')]=function(_0x457268,_0x338f57){return db['MailAccount'][_0x247a('0x70')]({'where':{'id':_0x457268[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x338f57,null))[_0x247a('0xf')](function(_0x55ec21){if(_0x55ec21){return _0x55ec21[_0x247a('0x7a')]();}return null;})[_0x247a('0xf')](respondWithResult(_0x338f57,null))[_0x247a('0x19')](handleError(_0x338f57,null));};exports['addImap']=function(_0x5ec1f9,_0x25e20e){if(_0x5ec1f9[_0x247a('0x64')]['id']){delete _0x5ec1f9[_0x247a('0x64')]['id'];}return db[_0x247a('0x47')]['find']({'where':{'id':_0x5ec1f9[_0x247a('0x60')]['id']}})['then'](handleEntityNotFound(_0x25e20e,null))[_0x247a('0xf')](function(_0x4559b8){if(_0x4559b8){_0x5ec1f9[_0x247a('0x64')]['MailAccountId']=_0x4559b8['id'];return db[_0x247a('0x41')][_0x247a('0x69')](_0x5ec1f9[_0x247a('0x64')]);}})['then'](respondWithResult(_0x25e20e,null))['catch'](handleError(_0x25e20e,null));};exports[_0x247a('0x7b')]=function(_0x24d1f2,_0x5bc07f){return db[_0x247a('0x47')][_0x247a('0x70')]({'where':{'id':_0x24d1f2[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x5bc07f,null))[_0x247a('0xf')](function(_0x303140){if(_0x303140){return _0x303140['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x5bc07f,null))[_0x247a('0x19')](handleError(_0x5bc07f,null));};exports[_0x247a('0x7c')]=function(_0x95bece,_0x2d792e){return db[_0x247a('0x47')][_0x247a('0x70')]({'where':{'id':_0x95bece[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x2d792e,null))[_0x247a('0xf')](function(_0x53f36d){if(_0x53f36d){return _0x53f36d[_0x247a('0x7c')]();}return null;})[_0x247a('0xf')](respondWithResult(_0x2d792e,null))['catch'](handleError(_0x2d792e,null));};exports[_0x247a('0x7d')]=function(_0x2ac804,_0x382202){if(_0x2ac804[_0x247a('0x64')]['id']){delete _0x2ac804['body']['id'];}return db[_0x247a('0x47')][_0x247a('0x63')]({'where':{'id':_0x2ac804[_0x247a('0x60')]['id']}})['then'](handleEntityNotFound(_0x382202,null))[_0x247a('0xf')](function(_0x2f90eb){if(_0x2f90eb){_0x2ac804[_0x247a('0x64')][_0x247a('0x6e')]=_0x2f90eb['id'];return db['MailServerOut']['create'](_0x2ac804[_0x247a('0x64')]);}})[_0x247a('0xf')](respondWithResult(_0x382202,null))[_0x247a('0x19')](handleError(_0x382202,null));};exports[_0x247a('0x7e')]=function(_0x55706b,_0x1b6d38){return db['MailAccount']['findOne']({'where':{'id':_0x55706b[_0x247a('0x60')]['id']}})['then'](handleEntityNotFound(_0x1b6d38,null))[_0x247a('0xf')](function(_0x27c5a0){if(_0x27c5a0){return _0x27c5a0[_0x247a('0x7f')](null);}return null;})[_0x247a('0xf')](respondWithStatusCode(_0x1b6d38,null))[_0x247a('0x19')](handleError(_0x1b6d38,null));};exports[_0x247a('0x80')]=function(_0x199711,_0x3dae12){return db[_0x247a('0x81')][_0x247a('0x63')]({'where':{'id':_0x199711[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x3dae12,null))[_0x247a('0xf')](function(_0x46a63a){if(_0x46a63a){return _0x46a63a[_0x247a('0x80')](_0x199711[_0x247a('0x64')][_0x247a('0x6c')],_[_0x247a('0x82')](_0x199711['body'],[_0x247a('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x3dae12,null))[_0x247a('0x19')](handleError(_0x3dae12,null));};exports['getInteractions']=function(_0x535679,_0x2efca4){var _0x4d88d8={'raw':![],'where':{}};var _0x1ca530={};var _0x5da2e7={'count':0x0,'rows':[]};return db[_0x247a('0x47')][_0x247a('0x70')]({'where':{'id':_0x535679['params']['id']}})['then'](handleEntityNotFound(_0x2efca4,null))[_0x247a('0xf')](function(_0x34c5af){if(_0x34c5af){_0x1ca530[_0x247a('0x4b')]=_['keys'](db[_0x247a('0x81')][_0x247a('0x48')]);_0x1ca530[_0x247a('0x4c')]=_[_0x247a('0x61')](_0x535679[_0x247a('0x4c')]);_0x1ca530['filters']=_[_0x247a('0x4e')](_0x1ca530['model'],_0x1ca530[_0x247a('0x4c')]);_0x4d88d8[_0x247a('0x4f')]=_['intersection'](_0x1ca530['model'],qs[_0x247a('0x50')](_0x535679[_0x247a('0x4c')][_0x247a('0x50')]));_0x4d88d8[_0x247a('0x4f')]=_0x4d88d8[_0x247a('0x4f')][_0x247a('0x51')]?_0x4d88d8['attributes']:_0x1ca530[_0x247a('0x4b')];if(!_0x535679['query'][_0x247a('0x52')](_0x247a('0x83'))){_0x4d88d8['limit']=qs[_0x247a('0x1f')](_0x535679['query'][_0x247a('0x1f')]);_0x4d88d8['offset']=qs[_0x247a('0x1e')](_0x535679[_0x247a('0x4c')]['offset']);}_0x4d88d8[_0x247a('0x53')]=qs['sort'](_0x535679['query'][_0x247a('0x54')]);_0x4d88d8[_0x247a('0x55')]=qs[_0x247a('0x4d')](_[_0x247a('0x56')](_0x535679[_0x247a('0x4c')],_0x1ca530[_0x247a('0x4d')]));_0x4d88d8[_0x247a('0x55')][_0x247a('0x6e')]=_0x34c5af['id'];if(_0x535679[_0x247a('0x4c')][_0x247a('0x57')]){_0x4d88d8[_0x247a('0x55')]=_[_0x247a('0x58')](_0x4d88d8[_0x247a('0x55')],{'$or':_[_0x247a('0x46')](_0x4d88d8[_0x247a('0x4f')],function(_0x3842b8){var _0xcd4559={};_0xcd4559[_0x3842b8]={'$like':'%'+_0x535679['query']['filter']+'%'};return _0xcd4559;})});}_0x4d88d8=_[_0x247a('0x58')]({},_0x4d88d8,_0x535679['options']);return db[_0x247a('0x81')][_0x247a('0x5b')]({'where':_0x4d88d8[_0x247a('0x55')]})[_0x247a('0xf')](function(_0xc993e6){_0x5da2e7[_0x247a('0x5b')]=_0xc993e6;if(_0x535679[_0x247a('0x4c')][_0x247a('0x5c')]){_0x4d88d8['include']=[{'model':db['CmContact'],'as':_0x247a('0x84'),'required':![]},{'model':db[_0x247a('0x85')],'as':_0x247a('0x86'),'attributes':[_0x247a('0x28'),'fullname',_0x247a('0x87')],'required':![]},{'model':db[_0x247a('0x88')],'as':_0x247a('0x89'),'attributes':['id',_0x247a('0x28'),'color'],'where':_0x535679[_0x247a('0x4c')][_0x247a('0x8a')]?{'id':_0x535679['query']['tag']}:undefined,'required':_0x535679[_0x247a('0x4c')]['tag']?!![]:![]}];}return db[_0x247a('0x81')][_0x247a('0x5e')](_0x4d88d8);})['then'](function(_0x170aef){_0x5da2e7[_0x247a('0x71')]=_0x170aef;return _0x5da2e7;});}})[_0x247a('0xf')](respondWithFilteredResult(_0x2efca4,_0x4d88d8))[_0x247a('0x19')](handleError(_0x2efca4,null));};exports[_0x247a('0x8b')]=function addApplications(_0x441ff9,_0x2bedf4){var _0x9beb7c=_0x441ff9[_0x247a('0x60')]['id'];var _0x1f7b76=_0x441ff9[_0x247a('0x64')];var _0x5cc403=0xc8;var _0x29258a=null;return db[_0x247a('0x8c')]['transaction']({'isolationLevel':db[_0x247a('0x8c')][_0x247a('0x8d')]['ISOLATION_LEVELS'][_0x247a('0x8e')]},function(_0x273ce8){return db[_0x247a('0x47')][_0x247a('0x70')]({'where':{'id':_0x9beb7c},'transaction':_0x273ce8})[_0x247a('0xf')](function(_0x575924){if(_0x575924){return db[_0x247a('0x8f')][_0x247a('0x23')]({'where':{'MailAccountId':_0x9beb7c},'transaction':_0x273ce8})[_0x247a('0xf')](function(){var _0x5c5cf0=_['map'](_0x1f7b76,function(_0x34ac5c){_0x34ac5c[_0x247a('0x6e')]=_0x9beb7c;return _0x34ac5c;});return db[_0x247a('0x8f')][_0x247a('0x90')](_0x5c5cf0,{'transaction':_0x273ce8});});}else{_0x5cc403=0x194;_0x29258a=[];}});})[_0x247a('0xf')](function(){if(_0x5cc403!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x9beb7c},'order':_0x247a('0x91')})[_0x247a('0xf')](function(_0x166dee){_0x29258a=_0x166dee;});}})[_0x247a('0x19')](function(_0x52ba07){_0x5cc403=0x1f4;logger[_0x247a('0x16')](_0x52ba07[_0x247a('0x27')]);if(_0x52ba07[_0x247a('0x28')]){delete _0x52ba07['name'];}_0x29258a=_0x52ba07;})[_0x247a('0x92')](function(){if(_0x29258a===null){_0x2bedf4[_0x247a('0x1a')](_0x5cc403);}else{if(_0x5cc403===0x1f4){_0x2bedf4['status'](_0x5cc403)[_0x247a('0x93')](_0x29258a);}else{_0x2bedf4[_0x247a('0x1b')](_0x5cc403)['json'](_0x29258a);}}});};exports[_0x247a('0x94')]=function(_0x58a259,_0x2c046b){var _0x1997ea={};var _0x2ac418={};var _0x111c55;var _0x2642de;return db[_0x247a('0x47')][_0x247a('0x70')]({'where':{'id':_0x58a259[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x2c046b,null))['then'](function(_0x4ff2f5){if(_0x4ff2f5){_0x111c55=_0x4ff2f5;_0x2ac418[_0x247a('0x4b')]=_['keys'](db[_0x247a('0x8f')][_0x247a('0x48')]);_0x2ac418['query']=_['keys'](_0x58a259[_0x247a('0x4c')]);_0x2ac418['filters']=_[_0x247a('0x4e')](_0x2ac418[_0x247a('0x4b')],_0x2ac418[_0x247a('0x4c')]);_0x1997ea[_0x247a('0x4f')]=_['intersection'](_0x2ac418[_0x247a('0x4b')],qs[_0x247a('0x50')](_0x58a259[_0x247a('0x4c')][_0x247a('0x50')]));_0x1997ea[_0x247a('0x4f')]=_0x1997ea[_0x247a('0x4f')][_0x247a('0x51')]?_0x1997ea['attributes']:_0x2ac418['model'];_0x1997ea[_0x247a('0x53')]=qs[_0x247a('0x54')](_0x58a259['query']['sort']);_0x1997ea[_0x247a('0x55')]=qs[_0x247a('0x4d')](_[_0x247a('0x56')](_0x58a259[_0x247a('0x4c')],_0x2ac418[_0x247a('0x4d')]));if(_0x58a259['query'][_0x247a('0x57')]){_0x1997ea[_0x247a('0x55')]=_['merge'](_0x1997ea['where'],{'$or':_[_0x247a('0x46')](_0x1997ea['attributes'],function(_0x26d3c2){var _0x3d15a6={};_0x3d15a6[_0x26d3c2]={'$like':'%'+_0x58a259[_0x247a('0x4c')][_0x247a('0x57')]+'%'};return _0x3d15a6;})});}_0x1997ea=_[_0x247a('0x58')]({},_0x1997ea,_0x58a259[_0x247a('0x62')]);return _0x111c55[_0x247a('0x94')](_0x1997ea);}})[_0x247a('0xf')](function(_0x598263){if(_0x598263){_0x2642de=_0x598263[_0x247a('0x51')];if(!_0x58a259[_0x247a('0x4c')][_0x247a('0x52')](_0x247a('0x83'))){_0x1997ea['limit']=qs['limit'](_0x58a259[_0x247a('0x4c')]['limit']);_0x1997ea[_0x247a('0x1e')]=qs['offset'](_0x58a259['query'][_0x247a('0x1e')]);}return _0x111c55['getApplications'](_0x1997ea);}})['then'](function(_0x38c1c1){if(_0x38c1c1){return _0x38c1c1?{'count':_0x2642de,'rows':_0x38c1c1}:null;}})[_0x247a('0xf')](respondWithResult(_0x2c046b,null))[_0x247a('0x19')](handleError(_0x2c046b,null));};exports[_0x247a('0x95')]=function(_0x1c0c4e,_0x59e944){var _0x20e725={'raw':!![],'where':{}};var _0x5503ac={};var _0x3a220c={'count':0x0,'rows':[]};return db[_0x247a('0x47')]['findOne']({'where':{'id':_0x1c0c4e[_0x247a('0x60')]['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x59e944,null))['then'](function(_0x469a07){if(_0x469a07){_0x5503ac[_0x247a('0x4b')]=_['keys'](db['MailMessage'][_0x247a('0x48')]);_0x5503ac[_0x247a('0x4c')]=_[_0x247a('0x61')](_0x1c0c4e['query']);_0x5503ac['filters']=_[_0x247a('0x4e')](_0x5503ac[_0x247a('0x4b')],_0x5503ac['query']);_0x20e725[_0x247a('0x4f')]=_[_0x247a('0x4e')](_0x5503ac[_0x247a('0x4b')],qs[_0x247a('0x50')](_0x1c0c4e[_0x247a('0x4c')][_0x247a('0x50')]));_0x20e725[_0x247a('0x4f')]=_0x20e725[_0x247a('0x4f')][_0x247a('0x51')]?_0x20e725[_0x247a('0x4f')]:_0x5503ac[_0x247a('0x4b')];if(!_0x1c0c4e['query'][_0x247a('0x52')](_0x247a('0x83'))){_0x20e725[_0x247a('0x1f')]=qs[_0x247a('0x1f')](_0x1c0c4e[_0x247a('0x4c')][_0x247a('0x1f')]);_0x20e725[_0x247a('0x1e')]=qs[_0x247a('0x1e')](_0x1c0c4e['query'][_0x247a('0x1e')]);}_0x20e725['order']=qs[_0x247a('0x54')](_0x1c0c4e[_0x247a('0x4c')][_0x247a('0x54')]);_0x20e725['where']=qs[_0x247a('0x4d')](_[_0x247a('0x56')](_0x1c0c4e[_0x247a('0x4c')],_0x5503ac['filters']));_0x20e725[_0x247a('0x55')][_0x247a('0x6e')]=_0x469a07['id'];if(_0x1c0c4e['query'][_0x247a('0x57')]){_0x20e725[_0x247a('0x55')]=_[_0x247a('0x58')](_0x20e725['where'],{'$or':_['map'](_0x20e725[_0x247a('0x4f')],function(_0x159661){var _0x5d67f4={};_0x5d67f4[_0x159661]={'$like':'%'+_0x1c0c4e[_0x247a('0x4c')][_0x247a('0x57')]+'%'};return _0x5d67f4;})});}if(_0x1c0c4e[_0x247a('0x4c')][_0x247a('0x96')]){var _0x58541d=_0x1c0c4e[_0x247a('0x4c')][_0x247a('0x96')][_0x247a('0x97')](',');var _0x5b1d0b={};_0x5b1d0b[_0x58541d[0x0]]={'$gte':moment(_0x58541d[0x1])['format'](_0x247a('0x98'))};_0x20e725['where']=_[_0x247a('0x58')](_0x20e725[_0x247a('0x55')],_0x5b1d0b);}_0x20e725=_['merge']({},_0x20e725,_0x1c0c4e[_0x247a('0x62')]);return db[_0x247a('0x99')][_0x247a('0x5b')]({'where':_0x20e725['where']})[_0x247a('0xf')](function(_0x2429d9){_0x3a220c[_0x247a('0x5b')]=_0x2429d9;if(_0x1c0c4e[_0x247a('0x4c')][_0x247a('0x5c')]){_0x20e725[_0x247a('0x5d')]=[{'all':!![]}];}return db[_0x247a('0x99')][_0x247a('0x5e')](_0x20e725);})[_0x247a('0xf')](function(_0x440100){if(_0x1c0c4e['query'][_0x247a('0x9a')]===_0x247a('0x9b')){for(var _0x1f6d99=0x0;_0x1f6d99<_0x440100[_0x247a('0x51')];_0x1f6d99++){_0x440100[_0x1f6d99][_0x247a('0x64')]=juice(_0x440100[_0x1f6d99][_0x247a('0x64')]);}}_0x3a220c[_0x247a('0x71')]=_0x440100;return _0x3a220c;});}})[_0x247a('0xf')](respondWithFilteredResult(_0x59e944,_0x20e725))[_0x247a('0x19')](handleError(_0x59e944,null));};exports['send']=function(_0x2322bb,_0x3c59fa){var _0x1260e6,_0x57eeb4={},_0x5ce1de;if(_0x2322bb[_0x247a('0x64')]['to']){_0x5ce1de=_0x2322bb[_0x247a('0x64')]['to'][_0x247a('0x97')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x2322bb[_0x247a('0x60')]['id']},'include':[{'model':db[_0x247a('0x9c')],'as':_0x247a('0x9d'),'include':[{'model':db[_0x247a('0x9e')],'as':_0x247a('0x9f'),'where':{'email':_0x5ce1de},'limit':0x1,'order':[['updatedAt',_0x247a('0xa0')]]}]},{'model':db[_0x247a('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x247a('0xa1'),'raw':!![]}]}]})[_0x247a('0xf')](handleEntityNotFound(_0x3c59fa,null))[_0x247a('0xf')](function(_0x46193f){if(!_0x46193f)return;_0x1260e6=_0x46193f;if(!_0x46193f[_0x247a('0x43')])throw new Error(_0x247a('0xa2'));if(_['isNil'](_0x2322bb[_0x247a('0x64')][_0x247a('0xa3')])){_0x2322bb['body'][_0x247a('0xa3')]=util[_0x247a('0xa4')]('%s\x20<%s>',_0x46193f[_0x247a('0x28')],_0x46193f[_0x247a('0x73')]||_0x46193f['Smtp'][_0x247a('0x34')]);}if(_0x2322bb[_0x247a('0x64')]['attachments']&&_0x2322bb['body']['attachments'][_0x247a('0x51')]){for(var _0x4ca189=0x0;_0x4ca189<_0x2322bb[_0x247a('0x64')][_0x247a('0xa5')]['length'];_0x4ca189+=0x1){_0x2322bb[_0x247a('0x64')][_0x247a('0xa5')][_0x4ca189]={'filename':_0x2322bb[_0x247a('0x64')][_0x247a('0xa5')][_0x4ca189][_0x247a('0x28')],'path':path['join'](config[_0x247a('0xa6')],_0x247a('0xa7'),_0x2322bb['body'][_0x247a('0xa5')][_0x4ca189][_0x247a('0xa8')])};}}var _0x1f1e52=_0x46193f[_0x247a('0xa9')]();return respondWithRpcPromise(_0x247a('0xaa'),'sendMail',{'account':_0x1f1e52,'message':_0x2322bb[_0x247a('0x64')]});})['then'](function(_0x9d89b5){if(!_0x9d89b5)return;_0x57eeb4=_0x9d89b5;if(!_0x1260e6['List'])throw new Error(_0x247a('0xab'));if(_0x1260e6[_0x247a('0x9d')][_0x247a('0x9f')][_0x247a('0x51')])return _0x1260e6[_0x247a('0x9d')]['Contacts'][0x0];return db[_0x247a('0x9e')][_0x247a('0x69')](_[_0x247a('0x8')](_0x2322bb[_0x247a('0x64')],{'firstName':_0x2322bb[_0x247a('0x64')]['to'],'email':_0x2322bb['body']['to'],'phone':_0x2322bb[_0x247a('0x64')]['to'],'ListId':_0x1260e6[_0x247a('0x74')]}));})[_0x247a('0xf')](function(_0x328cf5){if(!_0x328cf5)return;var _0x292d47={'UserId':_0x2322bb[_0x247a('0x34')]['id'],'ContactId':_0x328cf5['id'],'MailAccountId':_0x1260e6['id'],'inReplyTo':_0x57eeb4[_0x247a('0xac')],'to':_0x2322bb[_0x247a('0x64')][_0x247a('0xa3')],'cc':_0x2322bb[_0x247a('0x64')]['cc'],'subject':_0x2322bb[_0x247a('0x64')][_0x247a('0xad')],'attach':_0x2322bb[_0x247a('0x64')][_0x247a('0xae')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x247a('0x98')),'lastMsgDirection':_0x247a('0xaf'),'Messages':[_['merge'](_0x2322bb[_0x247a('0x64')],{'messageId':_0x57eeb4[_0x247a('0xac')],'sentAt':moment()[_0x247a('0xa4')](_0x247a('0x98')),'read':!![],'MailAccountId':_0x1260e6['id'],'UserId':_0x2322bb[_0x247a('0x34')]['id'],'ContactId':_0x328cf5['id']})]};if(_0x2322bb[_0x247a('0x64')]['Interaction']){_0x292d47=_[_0x247a('0x58')](_0x292d47,_0x2322bb['body']['Interaction']);}return db[_0x247a('0x81')][_0x247a('0x69')](_0x292d47,{'include':[{'model':db[_0x247a('0x99')],'as':_0x247a('0xb0')}]});})[_0x247a('0xf')](respondWithResult(_0x3c59fa,null))[_0x247a('0x19')](handleError(_0x3c59fa,null));};exports[_0x247a('0xb1')]=function(_0x4dbc9b,_0x43ee47){return db['MailAccount'][_0x247a('0x63')]({'where':{'id':_0x4dbc9b[_0x247a('0x60')]['id']},'include':[{'model':db[_0x247a('0x42')],'as':_0x247a('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x247a('0xa1'),'raw':!![]}]}]})[_0x247a('0xf')](handleEntityNotFound(_0x43ee47,null))[_0x247a('0xf')](function(_0x4f6ec3){if(!_0x4f6ec3[_0x247a('0x43')])return;var _0x4def4c=_0x4f6ec3[_0x247a('0xa9')]();return respondWithRpcPromise(_0x247a('0xb2'),_0x247a('0xb1'),{'account':_0x4def4c});})[_0x247a('0xf')](respondWithResult(_0x43ee47,null))[_0x247a('0x19')](handleError(_0x43ee47,null));};exports[_0x247a('0x23')]=function(_0x26c4e0,_0x342bf9){return db[_0x247a('0x47')]['find']({'where':{'id':_0x26c4e0['params']['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x342bf9,null))[_0x247a('0xf')](function(_0x50c89c){if(_0x50c89c&&_0x50c89c['service']){throw new db[(_0x247a('0xb3'))][(_0x247a('0xb4'))](_0x247a('0xb5'));}return _0x50c89c;})['then'](removeEntity(_0x342bf9,null))['catch'](handleError(_0x342bf9,null));};exports[_0x247a('0xb6')]=function(_0x20adcd,_0x52d1f7){return db[_0x247a('0x47')][_0x247a('0x63')]({'where':{'id':_0x20adcd['params']['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x52d1f7,null))[_0x247a('0xf')](function(_0x4e41f9){if(_0x4e41f9){return _0x4e41f9[_0x247a('0xb6')](_0x20adcd[_0x247a('0x64')]['ids'],_[_0x247a('0x82')](_0x20adcd[_0x247a('0x64')],[_0x247a('0x6c'),'id'])||{})['spread'](function(_0x12a7d0){for(var _0x1558f3=0x0;_0x1558f3<_0x20adcd['body'][_0x247a('0x6c')][_0x247a('0x51')];_0x1558f3+=0x1){socket[_0x247a('0xb7')](_0x247a('0xb8'),{'UserId':Number(_0x20adcd[_0x247a('0x64')][_0x247a('0x6c')][_0x1558f3]),'MailAccountId':Number(_0x20adcd['params']['id'])});}return _0x12a7d0;});}})['then'](respondWithResult(_0x52d1f7,null))['catch'](handleError(_0x52d1f7,null));};exports[_0x247a('0xb9')]=function(_0x5b66cd,_0x557e90){return db['MailAccount'][_0x247a('0x63')]({'where':{'id':_0x5b66cd['params']['id']}})[_0x247a('0xf')](handleEntityNotFound(_0x557e90,null))[_0x247a('0xf')](function(_0x2c4431){if(_0x2c4431){return _0x2c4431[_0x247a('0xb9')](_0x5b66cd['query'][_0x247a('0x6c')])[_0x247a('0xf')](function(){if(_[_0x247a('0xba')](_0x5b66cd[_0x247a('0x4c')]['ids'])){for(var _0x24c38c=0x0;_0x24c38c<_0x5b66cd[_0x247a('0x4c')][_0x247a('0x6c')][_0x247a('0x51')];_0x24c38c+=0x1){socket[_0x247a('0xb7')](_0x247a('0xbb'),{'UserId':Number(_0x5b66cd[_0x247a('0x4c')][_0x247a('0x6c')][_0x24c38c]),'MailAccountId':Number(_0x5b66cd[_0x247a('0x60')]['id'])});}}else{socket[_0x247a('0xb7')](_0x247a('0xbb'),{'UserId':Number(_0x5b66cd[_0x247a('0x4c')]['ids']),'MailAccountId':Number(_0x5b66cd['params']['id'])});}});}})[_0x247a('0xf')](respondWithStatusCode(_0x557e90,null))['catch'](handleError(_0x557e90,null));};exports[_0x247a('0xbc')]=function(_0x32301d,_0x50f266){var _0x5cf525={};var _0x1f2bbf={};var _0x37f6f8;var _0x3f4880;return db[_0x247a('0x47')]['findOne']({'where':{'id':_0x32301d[_0x247a('0x60')]['id']}})['then'](handleEntityNotFound(_0x50f266,null))['then'](function(_0x288b79){if(_0x288b79){_0x37f6f8=_0x288b79;_0x1f2bbf[_0x247a('0x4b')]=_[_0x247a('0x61')](db[_0x247a('0x85')]['rawAttributes']);_0x1f2bbf[_0x247a('0x4c')]=_['keys'](_0x32301d[_0x247a('0x4c')]);_0x1f2bbf[_0x247a('0x4d')]=_['intersection'](_0x1f2bbf[_0x247a('0x4b')],_0x1f2bbf[_0x247a('0x4c')]);_0x5cf525[_0x247a('0x4f')]=_[_0x247a('0x4e')](_0x1f2bbf[_0x247a('0x4b')],qs[_0x247a('0x50')](_0x32301d[_0x247a('0x4c')][_0x247a('0x50')]));_0x5cf525[_0x247a('0x4f')]=_0x5cf525[_0x247a('0x4f')][_0x247a('0x51')]?_0x5cf525['attributes']:_0x1f2bbf[_0x247a('0x4b')];_0x5cf525[_0x247a('0x53')]=qs['sort'](_0x32301d[_0x247a('0x4c')]['sort']);_0x5cf525['where']=qs[_0x247a('0x4d')](_[_0x247a('0x56')](_0x32301d[_0x247a('0x4c')],_0x1f2bbf[_0x247a('0x4d')]));if(_0x32301d['query']['filter']){_0x5cf525[_0x247a('0x55')]=_[_0x247a('0x58')](_0x5cf525[_0x247a('0x55')],{'$or':_['map'](_0x5cf525[_0x247a('0x4f')],function(_0x5a83c0){var _0x7a44e5={};_0x7a44e5[_0x5a83c0]={'$like':'%'+_0x32301d[_0x247a('0x4c')]['filter']+'%'};return _0x7a44e5;})});}_0x5cf525=_['merge']({},_0x5cf525,_0x32301d[_0x247a('0x62')]);return _0x37f6f8['getAgents'](_0x5cf525);}})[_0x247a('0xf')](function(_0x5708e6){if(_0x5708e6){_0x3f4880=_0x5708e6['length'];if(!_0x32301d[_0x247a('0x4c')][_0x247a('0x52')]('nolimit')){_0x5cf525[_0x247a('0x1f')]=qs[_0x247a('0x1f')](_0x32301d[_0x247a('0x4c')][_0x247a('0x1f')]);_0x5cf525['offset']=qs[_0x247a('0x1e')](_0x32301d[_0x247a('0x4c')][_0x247a('0x1e')]);}return _0x37f6f8['getAgents'](_0x5cf525);}})[_0x247a('0xf')](function(_0x526324){if(_0x526324){return _0x526324?{'count':_0x3f4880,'rows':_0x526324}:null;}})[_0x247a('0xf')](respondWithResult(_0x50f266,null))['catch'](handleError(_0x50f266,null));}; \ No newline at end of file +var _0xe236=['username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','pick','merge','VIRTUAL','findAll','show','params','includeAll','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','rawAttributes','sort','filter','Disposition','include','rows','removeDispositions','ids','CannedAnswer','nolimit','removeAnswers','email','ListId','isNil','active','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','setSmtp','omit','getInteractions','MailInteraction','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','split','format','inlineCss','true','CmList','List','CmContact','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','server/files/attachments','SendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','MailAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp.office365.com','user'];(function(_0x3d6b9d,_0x65126c){var _0x2bedc1=function(_0x2a5785){while(--_0x2a5785){_0x3d6b9d['push'](_0x3d6b9d['shift']());}};_0x2bedc1(++_0x65126c);}(_0xe236,0x142));var _0x6e23=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0xe236[_0x5f25b3];return _0x4ab9bf;};'use strict';var moment=require(_0x6e23('0x0'));var BPromise=require(_0x6e23('0x1'));var util=require(_0x6e23('0x2'));var path=require(_0x6e23('0x3'));var _=require(_0x6e23('0x4'));var juice=require(_0x6e23('0x5'));var Redis=require(_0x6e23('0x6'));var qs=require(_0x6e23('0x7'));var logger=require('../../config/logger')(_0x6e23('0x8'));var config=require('../../config/environment');var db=require(_0x6e23('0x9'))['db'];config['redis']=_[_0x6e23('0xa')](config[_0x6e23('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e23('0xc'))(new Redis(config['redis']));require(_0x6e23('0xd'))[_0x6e23('0xe')](socket);var jayson=require(_0x6e23('0xf'));var client=jayson[_0x6e23('0x10')][_0x6e23('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x110b1f,_0x1dcedf,_0xe58852,_0x2d2285){return new BPromise(function(_0x249c71,_0x3a4869){var _0x3193fe=_0x2d2285||client;return _0x3193fe['request'](_0x110b1f,_0xe58852)[_0x6e23('0x12')](function(_0x50eb72){logger['info'](_0x6e23('0x13'),_0x1dcedf,_0x6e23('0x14'));logger['debug'](_0x6e23('0x15'),_0x1dcedf,_0x6e23('0x14'),JSON[_0x6e23('0x16')](_0x50eb72));if(_0x50eb72[_0x6e23('0x17')]){if(_0x50eb72['error'][_0x6e23('0x18')]===0x1f4){logger[_0x6e23('0x17')](_0x6e23('0x13'),_0x1dcedf,_0x50eb72['error']['message']);return _0x3a4869(_0x50eb72[_0x6e23('0x17')][_0x6e23('0x19')]);}logger[_0x6e23('0x17')](_0x6e23('0x13'),_0x1dcedf,_0x50eb72[_0x6e23('0x17')]['message']);return _0x249c71(_0x50eb72[_0x6e23('0x17')][_0x6e23('0x19')]);}else{logger['info'](_0x6e23('0x13'),_0x1dcedf,_0x6e23('0x14'));_0x249c71(_0x50eb72['result'][_0x6e23('0x19')]);}})[_0x6e23('0x1a')](function(_0x146292){logger[_0x6e23('0x17')](_0x6e23('0x13'),_0x1dcedf,_0x146292);_0x3a4869(_0x146292);});});}function respondWithStatusCode(_0x10f419,_0x5b89e7){_0x5b89e7=_0x5b89e7||0xcc;return function(_0x1c0558){if(_0x1c0558){return _0x10f419['sendStatus'](_0x5b89e7);}return _0x10f419[_0x6e23('0x1b')](_0x5b89e7)[_0x6e23('0x1c')]();};}function respondWithResult(_0x5cbdae,_0x545fff){_0x545fff=_0x545fff||0xc8;return function(_0x4779d4){if(_0x4779d4){return _0x5cbdae[_0x6e23('0x1b')](_0x545fff)[_0x6e23('0x1d')](_0x4779d4);}};}function respondWithFilteredResult(_0x857c29,_0x14163f){return function(_0xcee3){if(_0xcee3){var _0x35eaff=typeof _0x14163f[_0x6e23('0x1e')]===_0x6e23('0x1f')&&typeof _0x14163f[_0x6e23('0x20')]===_0x6e23('0x1f');var _0x455a2e=_0xcee3[_0x6e23('0x21')];var _0x490d0f=_0x35eaff?0x0:_0x14163f[_0x6e23('0x1e')];var _0x2386bb=_0x35eaff?_0xcee3[_0x6e23('0x21')]:_0x14163f[_0x6e23('0x1e')]+_0x14163f[_0x6e23('0x20')];var _0x3ff21b;if(_0x2386bb>=_0x455a2e){_0x2386bb=_0x455a2e;_0x3ff21b=0xc8;}else{_0x3ff21b=0xce;}_0x857c29[_0x6e23('0x1b')](_0x3ff21b);return _0x857c29[_0x6e23('0x22')](_0x6e23('0x23'),_0x490d0f+'-'+_0x2386bb+'/'+_0x455a2e)[_0x6e23('0x1d')](_0xcee3);}return null;};}function saveUpdates(_0x2bcc8d){return function(_0x32e1b0){if(_0x32e1b0){return _0x32e1b0[_0x6e23('0x24')](_0x2bcc8d)[_0x6e23('0x12')](function(_0x30637b){return _0x30637b;});}return null;};}function removeEntity(_0xd75fb1){return function(_0x2fd342){if(_0x2fd342){return _0x2fd342['destroy']()[_0x6e23('0x12')](function(){var _0x1116e8=_0x2fd342['get']({'plain':!![]});var _0x2ffd2f=_0x6e23('0x25');return db[_0x6e23('0x26')][_0x6e23('0x27')]({'where':{'type':_0x2ffd2f,'resourceId':_0x1116e8['id']}})[_0x6e23('0x12')](function(){return _0x2fd342;});})[_0x6e23('0x12')](function(){_0xd75fb1[_0x6e23('0x1b')](0xcc)[_0x6e23('0x1c')]();});}};}function handleEntityNotFound(_0x3f2e4e){return function(_0xb41b8f){if(!_0xb41b8f){_0x3f2e4e[_0x6e23('0x28')](0x194);}return _0xb41b8f;};}function handleError(_0x37a274,_0x225b15){_0x225b15=_0x225b15||0x1f4;return function(_0x7ce11c){logger[_0x6e23('0x17')](_0x7ce11c[_0x6e23('0x29')]);if(_0x7ce11c[_0x6e23('0x2a')]){delete _0x7ce11c['name'];}_0x37a274[_0x6e23('0x1b')](_0x225b15)[_0x6e23('0x2b')](_0x7ce11c);};}function getImapHost(_0x1f937c){switch(_0x1f937c){case _0x6e23('0x2c'):return'imap.gmail.com';case _0x6e23('0x2d'):return'imap.mail.yahoo.com';case _0x6e23('0x2e'):return _0x6e23('0x2f');case _0x6e23('0x30'):return _0x6e23('0x31');}throw new Error(_0x6e23('0x32'),_0x1f937c);}function getSmtpHost(_0x78c840){switch(_0x78c840){case'gmail':return'smtp.gmail.com';case _0x6e23('0x2d'):return _0x6e23('0x33');case _0x6e23('0x2e'):return'smtp-mail.outlook.com';case _0x6e23('0x30'):return _0x6e23('0x34');}throw new Error(_0x6e23('0x32'),_0x78c840);}function getAuthenticationOptions(_0x20e8cd,_0x261002){var _0x2cc164={};var _0x59d644={};if(_0x20e8cd){_0x2cc164[_0x6e23('0x35')]=_0x59d644[_0x6e23('0x35')]=_0x261002[_0x6e23('0x36')];_0x2cc164[_0x6e23('0x37')]=_0x59d644[_0x6e23('0x38')]=_0x261002[_0x6e23('0x37')];if(_0x261002[_0x6e23('0x39')]){_0x2cc164[_0x6e23('0x39')]=_0x59d644[_0x6e23('0x39')]=!![];_0x2cc164['CloudProviderId']=_0x59d644[_0x6e23('0x3a')]=_0x261002[_0x6e23('0x3a')];_0x2cc164[_0x6e23('0x37')]=_0x59d644['pass']=null;}else{_0x2cc164[_0x6e23('0x3a')]=_0x59d644[_0x6e23('0x3a')]=null;}_0x2cc164[_0x6e23('0x3b')]=getImapHost(_0x20e8cd);_0x2cc164['port']=0x3e1;_0x59d644[_0x6e23('0x3b')]=getSmtpHost(_0x20e8cd);_0x59d644[_0x6e23('0x3c')]=0x24b;_0x59d644[_0x6e23('0x3d')]=![];_0x2cc164[_0x6e23('0x3e')]=_0x59d644['service']=null;}else{if(_0x261002[_0x6e23('0x3f')]){_0x2cc164[_0x6e23('0x35')]=_0x59d644['user']=_0x261002[_0x6e23('0x36')];_0x2cc164[_0x6e23('0x37')]=_0x59d644[_0x6e23('0x38')]=_0x261002['password'];}else{_0x2cc164[_0x6e23('0x3f')]=_0x59d644[_0x6e23('0x3f')]=![];_0x2cc164[_0x6e23('0x35')]=_0x59d644[_0x6e23('0x35')]=null;_0x2cc164[_0x6e23('0x37')]=_0x59d644[_0x6e23('0x38')]=null;}_0x2cc164[_0x6e23('0x3b')]=_0x261002[_0x6e23('0x40')]['host'];_0x2cc164[_0x6e23('0x3c')]=_0x261002[_0x6e23('0x40')][_0x6e23('0x3c')];_0x59d644[_0x6e23('0x3b')]=_0x261002['Smtp'][_0x6e23('0x3b')];_0x59d644[_0x6e23('0x3c')]=_0x261002[_0x6e23('0x41')][_0x6e23('0x3c')];}return{'Imap':_0x2cc164,'Smtp':_0x59d644};}exports[_0x6e23('0x42')]=function(_0x3f6381,_0x2e2b1e){var _0x2dcfe7={'include':[{'model':db[_0x6e23('0x43')],'as':'Imap'},{'model':db[_0x6e23('0x44')],'as':_0x6e23('0x41')},{'model':db[_0x6e23('0x45')],'as':_0x6e23('0x46')}]},_0x5e0cc7={},_0x426b17={'count':0x0,'rows':[]};var _0x550122=_[_0x6e23('0x47')](db[_0x6e23('0x48')]['rawAttributes'],function(_0x4994c5){return{'name':_0x4994c5[_0x6e23('0x49')],'type':_0x4994c5[_0x6e23('0x4a')][_0x6e23('0x4b')]};});_0x5e0cc7[_0x6e23('0x4c')]=_[_0x6e23('0x47')](_0x550122,_0x6e23('0x2a'));_0x5e0cc7[_0x6e23('0x4d')]=_[_0x6e23('0x4e')](_0x3f6381[_0x6e23('0x4d')]);_0x5e0cc7['filters']=_['intersection'](_0x5e0cc7[_0x6e23('0x4c')],_0x5e0cc7[_0x6e23('0x4d')]);_0x2dcfe7[_0x6e23('0x4f')]=_[_0x6e23('0x50')](_0x5e0cc7['model'],qs[_0x6e23('0x51')](_0x3f6381[_0x6e23('0x4d')][_0x6e23('0x51')]));_0x2dcfe7[_0x6e23('0x4f')]=_0x2dcfe7[_0x6e23('0x4f')][_0x6e23('0x52')]?_0x2dcfe7[_0x6e23('0x4f')]:_0x5e0cc7[_0x6e23('0x4c')];if(!_0x3f6381[_0x6e23('0x4d')][_0x6e23('0x53')]('nolimit')){_0x2dcfe7[_0x6e23('0x20')]=qs[_0x6e23('0x20')](_0x3f6381[_0x6e23('0x4d')]['limit']);_0x2dcfe7[_0x6e23('0x1e')]=qs[_0x6e23('0x1e')](_0x3f6381['query']['offset']);}_0x2dcfe7[_0x6e23('0x54')]=qs['sort'](_0x3f6381[_0x6e23('0x4d')]['sort']);_0x2dcfe7[_0x6e23('0x55')]=qs[_0x6e23('0x56')](_[_0x6e23('0x57')](_0x3f6381[_0x6e23('0x4d')],_0x5e0cc7[_0x6e23('0x56')]),_0x550122);if(_0x3f6381['query']['filter']){_0x2dcfe7[_0x6e23('0x55')]=_[_0x6e23('0x58')](_0x2dcfe7[_0x6e23('0x55')],{'$or':_[_0x6e23('0x47')](_0x550122,function(_0x14efe6){if(_0x14efe6[_0x6e23('0x4a')]!==_0x6e23('0x59')){var _0x3dc1c9={};_0x3dc1c9[_0x14efe6[_0x6e23('0x2a')]]={'$like':'%'+_0x3f6381[_0x6e23('0x4d')]['filter']+'%'};return _0x3dc1c9;}})});}_0x2dcfe7=_[_0x6e23('0x58')]({},_0x2dcfe7,_0x3f6381['options']);var _0x433fab={'where':_0x2dcfe7['where']};return db[_0x6e23('0x48')]['count'](_0x433fab)[_0x6e23('0x12')](function(_0xa4d12a){_0x426b17[_0x6e23('0x21')]=_0xa4d12a;if(_0x3f6381[_0x6e23('0x4d')]['includeAll']){_0x2dcfe7['include']=[{'all':!![]}];}return db['MailAccount'][_0x6e23('0x5a')](_0x2dcfe7);})[_0x6e23('0x12')](function(_0x2ad9fd){_0x426b17['rows']=_0x2ad9fd;return _0x426b17;})[_0x6e23('0x12')](respondWithFilteredResult(_0x2e2b1e,_0x2dcfe7))['catch'](handleError(_0x2e2b1e,null));};exports[_0x6e23('0x5b')]=function(_0x5e56e1,_0x1ab849){var _0x179765={'raw':![],'where':{'id':_0x5e56e1[_0x6e23('0x5c')]['id']},'include':[{'model':db[_0x6e23('0x43')],'as':_0x6e23('0x40')},{'model':db[_0x6e23('0x44')],'as':'Smtp'},{'model':db[_0x6e23('0x45')],'as':_0x6e23('0x46')}]},_0x375098={};_0x375098[_0x6e23('0x4c')]=_[_0x6e23('0x4e')](db[_0x6e23('0x48')]['rawAttributes']);_0x375098[_0x6e23('0x4d')]=_[_0x6e23('0x4e')](_0x5e56e1['query']);_0x375098[_0x6e23('0x56')]=_[_0x6e23('0x50')](_0x375098[_0x6e23('0x4c')],_0x375098['query']);_0x179765[_0x6e23('0x4f')]=_['intersection'](_0x375098[_0x6e23('0x4c')],qs[_0x6e23('0x51')](_0x5e56e1[_0x6e23('0x4d')][_0x6e23('0x51')]));_0x179765[_0x6e23('0x4f')]=_0x179765[_0x6e23('0x4f')][_0x6e23('0x52')]?_0x179765['attributes']:_0x375098[_0x6e23('0x4c')];if(_0x5e56e1[_0x6e23('0x4d')][_0x6e23('0x5d')]){_0x179765['include']=[{'all':!![]}];}_0x179765=_[_0x6e23('0x58')]({},_0x179765,_0x5e56e1[_0x6e23('0x5e')]);return db[_0x6e23('0x48')][_0x6e23('0x5f')](_0x179765)['then'](handleEntityNotFound(_0x1ab849,null))['then'](respondWithResult(_0x1ab849,null))[_0x6e23('0x1a')](handleError(_0x1ab849,null));};exports['update']=function(_0xdd2140,_0x5190a8){if(_0xdd2140[_0x6e23('0x60')]['id']){delete _0xdd2140[_0x6e23('0x60')]['id'];}var _0x45cfb7=_0xdd2140[_0x6e23('0x60')][_0x6e23('0x61')]===_0x6e23('0x62')?null:_0xdd2140['body'][_0x6e23('0x61')];var _0x2a2e2f=_0xdd2140['body']['Imap']||{};var _0x547a02=_0xdd2140[_0x6e23('0x60')][_0x6e23('0x41')]||{};if(_0x45cfb7){_0x2a2e2f[_0x6e23('0x3b')]=getImapHost(_0x45cfb7);_0x2a2e2f[_0x6e23('0x3c')]=0x3e1;_0x547a02['host']=getSmtpHost(_0x45cfb7);_0x547a02[_0x6e23('0x3c')]=0x24b;_0x547a02[_0x6e23('0x3d')]=![];}if(_0x547a02[_0x6e23('0x39')]){_0x547a02['secure']=![];}else{_0x547a02[_0x6e23('0x3a')]=null;}if(!_0x2a2e2f[_0x6e23('0x39')])_0x2a2e2f[_0x6e23('0x3a')]=null;_0xdd2140[_0x6e23('0x60')][_0x6e23('0x40')]=_0x2a2e2f;_0xdd2140[_0x6e23('0x60')][_0x6e23('0x41')]=_0x547a02;return db[_0x6e23('0x48')][_0x6e23('0x5f')]({'where':{'id':_0xdd2140[_0x6e23('0x5c')]['id']},'include':[{'model':db[_0x6e23('0x43')],'as':_0x6e23('0x40')},{'model':db['MailServerOut'],'as':_0x6e23('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x6e23('0x12')](handleEntityNotFound(_0x5190a8,null))['then'](function(_0xdce5dd){if(!_0xdce5dd)throw new Error(_0x6e23('0x63'));if(_0xdce5dd[_0x6e23('0x3e')])delete _0xdd2140['body'][_0x6e23('0x40')];return _0xdce5dd;})[_0x6e23('0x12')](saveUpdates(_0xdd2140[_0x6e23('0x60')],null))['then'](function(_0x182f2b){if(!_0xdd2140[_0x6e23('0x60')][_0x6e23('0x40')])return _0x182f2b;return db[_0x6e23('0x43')][_0x6e23('0x24')](_0xdd2140['body'][_0x6e23('0x40')],{'where':{'MailAccountId':_0x182f2b['id']}})[_0x6e23('0x12')](function(){return _0x182f2b;});})[_0x6e23('0x12')](function(_0x153366){if(!_0xdd2140[_0x6e23('0x60')][_0x6e23('0x41')])return _0x153366;return db[_0x6e23('0x44')][_0x6e23('0x24')](_0xdd2140['body'][_0x6e23('0x41')],{'where':{'MailAccountId':_0x153366['id']}})[_0x6e23('0x12')](function(){return _0x153366;});})['then'](respondWithResult(_0x5190a8,null))['catch'](handleError(_0x5190a8,null));};exports[_0x6e23('0x64')]=function(_0x224f32,_0x5e8add){return db[_0x6e23('0x48')][_0x6e23('0x64')]()[_0x6e23('0x12')](respondWithResult(_0x5e8add,null))[_0x6e23('0x1a')](handleError(_0x5e8add,null));};exports[_0x6e23('0x65')]=function(_0x20d5d4,_0x4507a0){if(_0x20d5d4['body']['id']){delete _0x20d5d4[_0x6e23('0x60')]['id'];}return db[_0x6e23('0x48')][_0x6e23('0x5f')]({'where':{'id':_0x20d5d4[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x4507a0,null))[_0x6e23('0x12')](function(_0x10fec2){if(_0x10fec2){_0x20d5d4[_0x6e23('0x60')][_0x6e23('0x66')]=_0x10fec2['id'];return db['Disposition'][_0x6e23('0x67')](_0x20d5d4[_0x6e23('0x60')]);}})[_0x6e23('0x12')](respondWithResult(_0x4507a0,null))['catch'](handleError(_0x4507a0,null));};exports[_0x6e23('0x68')]=function(_0x188fe7,_0xf79099){var _0x20be7c={'raw':![],'where':{}};var _0x474193={};var _0x406371={'count':0x0,'rows':[]};return db[_0x6e23('0x48')][_0x6e23('0x69')]({'where':{'id':_0x188fe7[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0xf79099,null))[_0x6e23('0x12')](function(_0xa79d0f){if(_0xa79d0f){_0x474193[_0x6e23('0x4c')]=_['keys'](db['Disposition'][_0x6e23('0x6a')]);_0x474193['query']=_['keys'](_0x188fe7['query']);_0x474193[_0x6e23('0x56')]=_[_0x6e23('0x50')](_0x474193[_0x6e23('0x4c')],_0x474193['query']);_0x20be7c[_0x6e23('0x4f')]=_[_0x6e23('0x50')](_0x474193[_0x6e23('0x4c')],qs[_0x6e23('0x51')](_0x188fe7[_0x6e23('0x4d')][_0x6e23('0x51')]));_0x20be7c[_0x6e23('0x4f')]=_0x20be7c[_0x6e23('0x4f')]['length']?_0x20be7c[_0x6e23('0x4f')]:_0x474193[_0x6e23('0x4c')];if(!_0x188fe7['query'][_0x6e23('0x53')]('nolimit')){_0x20be7c[_0x6e23('0x20')]=qs[_0x6e23('0x20')](_0x188fe7[_0x6e23('0x4d')][_0x6e23('0x20')]);_0x20be7c[_0x6e23('0x1e')]=qs[_0x6e23('0x1e')](_0x188fe7[_0x6e23('0x4d')]['offset']);}_0x20be7c['order']=qs[_0x6e23('0x6b')](_0x188fe7[_0x6e23('0x4d')][_0x6e23('0x6b')]);_0x20be7c[_0x6e23('0x55')]=qs[_0x6e23('0x56')](_['pick'](_0x188fe7['query'],_0x474193['filters']));_0x20be7c[_0x6e23('0x55')]['MailAccountId']=_0xa79d0f['id'];if(_0x188fe7[_0x6e23('0x4d')][_0x6e23('0x6c')]){_0x20be7c[_0x6e23('0x55')]=_[_0x6e23('0x58')](_0x20be7c[_0x6e23('0x55')],{'$or':_['map'](_0x20be7c[_0x6e23('0x4f')],function(_0x391ea5){var _0x3e7a39={};_0x3e7a39[_0x391ea5]={'$like':'%'+_0x188fe7[_0x6e23('0x4d')][_0x6e23('0x6c')]+'%'};return _0x3e7a39;})});}_0x20be7c=_['merge']({},_0x20be7c,_0x188fe7[_0x6e23('0x5e')]);return db[_0x6e23('0x6d')]['count']({'where':_0x20be7c['where']})[_0x6e23('0x12')](function(_0x48513e){_0x406371[_0x6e23('0x21')]=_0x48513e;if(_0x188fe7[_0x6e23('0x4d')]['includeAll']){_0x20be7c[_0x6e23('0x6e')]=[{'all':!![]}];}return db[_0x6e23('0x6d')]['findAll'](_0x20be7c);})[_0x6e23('0x12')](function(_0x12d8f7){_0x406371[_0x6e23('0x6f')]=_0x12d8f7;return _0x406371;});}})['then'](respondWithFilteredResult(_0xf79099,_0x20be7c))[_0x6e23('0x1a')](handleError(_0xf79099,null));};exports[_0x6e23('0x70')]=function(_0x5f1229,_0x200bf6){return db[_0x6e23('0x48')]['find']({'where':{'id':_0x5f1229[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x200bf6,null))['then'](function(_0x2a7852){if(_0x2a7852){return _0x2a7852[_0x6e23('0x70')](_0x5f1229[_0x6e23('0x4d')][_0x6e23('0x71')]);}})['then'](respondWithStatusCode(_0x200bf6,null))[_0x6e23('0x1a')](handleError(_0x200bf6,null));};exports['addAnswer']=function(_0x36b1cc,_0x4d44bd){if(_0x36b1cc[_0x6e23('0x60')]['id']){delete _0x36b1cc[_0x6e23('0x60')]['id'];}return db[_0x6e23('0x48')][_0x6e23('0x5f')]({'where':{'id':_0x36b1cc[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x4d44bd,null))['then'](function(_0xd251fc){if(_0xd251fc){_0x36b1cc[_0x6e23('0x60')][_0x6e23('0x66')]=_0xd251fc['id'];return db[_0x6e23('0x72')][_0x6e23('0x67')](_0x36b1cc[_0x6e23('0x60')]);}})['then'](respondWithResult(_0x4d44bd,null))['catch'](handleError(_0x4d44bd,null));};exports['getAnswers']=function(_0x1e5d90,_0x4874ee){var _0x13b5c6={'raw':![],'where':{}};var _0x35828c={};var _0x3db6f3={'count':0x0,'rows':[]};return db[_0x6e23('0x48')][_0x6e23('0x69')]({'where':{'id':_0x1e5d90['params']['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x4874ee,null))[_0x6e23('0x12')](function(_0x3938eb){if(_0x3938eb){_0x35828c['model']=_['keys'](db['CannedAnswer'][_0x6e23('0x6a')]);_0x35828c[_0x6e23('0x4d')]=_[_0x6e23('0x4e')](_0x1e5d90[_0x6e23('0x4d')]);_0x35828c['filters']=_[_0x6e23('0x50')](_0x35828c[_0x6e23('0x4c')],_0x35828c[_0x6e23('0x4d')]);_0x13b5c6['attributes']=_[_0x6e23('0x50')](_0x35828c['model'],qs[_0x6e23('0x51')](_0x1e5d90[_0x6e23('0x4d')][_0x6e23('0x51')]));_0x13b5c6[_0x6e23('0x4f')]=_0x13b5c6[_0x6e23('0x4f')][_0x6e23('0x52')]?_0x13b5c6[_0x6e23('0x4f')]:_0x35828c[_0x6e23('0x4c')];if(!_0x1e5d90['query'][_0x6e23('0x53')](_0x6e23('0x73'))){_0x13b5c6[_0x6e23('0x20')]=qs[_0x6e23('0x20')](_0x1e5d90[_0x6e23('0x4d')][_0x6e23('0x20')]);_0x13b5c6[_0x6e23('0x1e')]=qs[_0x6e23('0x1e')](_0x1e5d90[_0x6e23('0x4d')][_0x6e23('0x1e')]);}_0x13b5c6[_0x6e23('0x54')]=qs['sort'](_0x1e5d90['query'][_0x6e23('0x6b')]);_0x13b5c6[_0x6e23('0x55')]=qs['filters'](_[_0x6e23('0x57')](_0x1e5d90[_0x6e23('0x4d')],_0x35828c['filters']));_0x13b5c6[_0x6e23('0x55')][_0x6e23('0x66')]=_0x3938eb['id'];if(_0x1e5d90[_0x6e23('0x4d')][_0x6e23('0x6c')]){_0x13b5c6['where']=_[_0x6e23('0x58')](_0x13b5c6['where'],{'$or':_['map'](_0x13b5c6[_0x6e23('0x4f')],function(_0x3edc37){var _0x261e00={};_0x261e00[_0x3edc37]={'$like':'%'+_0x1e5d90[_0x6e23('0x4d')][_0x6e23('0x6c')]+'%'};return _0x261e00;})});}_0x13b5c6=_[_0x6e23('0x58')]({},_0x13b5c6,_0x1e5d90['options']);return db[_0x6e23('0x72')]['count']({'where':_0x13b5c6[_0x6e23('0x55')]})['then'](function(_0xce9640){_0x3db6f3[_0x6e23('0x21')]=_0xce9640;if(_0x1e5d90[_0x6e23('0x4d')][_0x6e23('0x5d')]){_0x13b5c6[_0x6e23('0x6e')]=[{'all':!![]}];}return db[_0x6e23('0x72')][_0x6e23('0x5a')](_0x13b5c6);})[_0x6e23('0x12')](function(_0x568fd1){_0x3db6f3[_0x6e23('0x6f')]=_0x568fd1;return _0x3db6f3;});}})[_0x6e23('0x12')](respondWithFilteredResult(_0x4874ee,_0x13b5c6))[_0x6e23('0x1a')](handleError(_0x4874ee,null));};exports['removeAnswers']=function(_0x3b2684,_0x29e600){return db['MailAccount'][_0x6e23('0x5f')]({'where':{'id':_0x3b2684[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x29e600,null))['then'](function(_0x439ec7){if(_0x439ec7){return _0x439ec7[_0x6e23('0x74')](_0x3b2684[_0x6e23('0x4d')][_0x6e23('0x71')]);}})[_0x6e23('0x12')](respondWithStatusCode(_0x29e600,null))[_0x6e23('0x1a')](handleError(_0x29e600,null));};exports[_0x6e23('0x67')]=function(_0x42742c,_0x11780a){var _0x1b8425={'name':_0x42742c[_0x6e23('0x60')][_0x6e23('0x2a')],'key':_0x42742c[_0x6e23('0x60')]['key'],'provider':_0x42742c[_0x6e23('0x60')]['provider']===_0x6e23('0x62')?null:_0x42742c['body']['provider'],'email':_0x42742c['body'][_0x6e23('0x75')],'ListId':_0x42742c[_0x6e23('0x60')][_0x6e23('0x76')],'active':!_[_0x6e23('0x77')](_0x42742c['body']['active'])?_0x42742c[_0x6e23('0x60')][_0x6e23('0x78')]:!![],'description':_0x42742c[_0x6e23('0x60')]['description']||null};var _0x195313=getAuthenticationOptions(_0x1b8425[_0x6e23('0x61')],_0x42742c['body']);_0x1b8425['Imap']=_0x195313[_0x6e23('0x40')];_0x1b8425[_0x6e23('0x41')]=_0x195313[_0x6e23('0x41')];return db[_0x6e23('0x48')][_0x6e23('0x67')](_0x1b8425,{'include':[{'model':db[_0x6e23('0x44')],'as':'Smtp'},{'model':db[_0x6e23('0x43')],'as':_0x6e23('0x40')}]})['then'](function(_0x2312d3){var _0x14a1d7=_0x42742c[_0x6e23('0x35')][_0x6e23('0x79')]({'plain':!![]});if(!_0x14a1d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14a1d7[_0x6e23('0x7a')]===_0x6e23('0x35')){var _0x4198a7=_0x2312d3['get']({'plain':!![]});return db[_0x6e23('0x7b')][_0x6e23('0x5f')]({'where':{'name':_0x6e23('0x25'),'userProfileId':_0x14a1d7['userProfileId']},'raw':!![]})[_0x6e23('0x12')](function(_0xe81256){if(_0xe81256&&_0xe81256[_0x6e23('0x7c')]===0x0){return db[_0x6e23('0x26')]['create']({'name':_0x4198a7[_0x6e23('0x2a')],'resourceId':_0x4198a7['id'],'type':_0xe81256['name'],'sectionId':_0xe81256['id']},{})['then'](function(){return _0x2312d3;});}else{return _0x2312d3;}})[_0x6e23('0x1a')](function(_0x251fb6){logger[_0x6e23('0x17')](_0x6e23('0x7d'),_0x251fb6);throw _0x251fb6;});}return _0x2312d3;})[_0x6e23('0x12')](respondWithResult(_0x11780a,0xc9))['catch'](handleError(_0x11780a,null));};exports['getImap']=function(_0x5f13d4,_0x38ed58){return db[_0x6e23('0x48')]['findOne']({'where':{'id':_0x5f13d4[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x38ed58,null))[_0x6e23('0x12')](function(_0x20ca13){if(_0x20ca13){return _0x20ca13[_0x6e23('0x7e')]();}return null;})[_0x6e23('0x12')](respondWithResult(_0x38ed58,null))['catch'](handleError(_0x38ed58,null));};exports['addImap']=function(_0x3f8514,_0x47deae){if(_0x3f8514[_0x6e23('0x60')]['id']){delete _0x3f8514[_0x6e23('0x60')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3f8514[_0x6e23('0x5c')]['id']}})['then'](handleEntityNotFound(_0x47deae,null))[_0x6e23('0x12')](function(_0x42d1d0){if(_0x42d1d0){_0x3f8514[_0x6e23('0x60')][_0x6e23('0x66')]=_0x42d1d0['id'];return db['MailServerIn'][_0x6e23('0x67')](_0x3f8514[_0x6e23('0x60')]);}})[_0x6e23('0x12')](respondWithResult(_0x47deae,null))['catch'](handleError(_0x47deae,null));};exports[_0x6e23('0x7f')]=function(_0x55ef65,_0x345696){return db[_0x6e23('0x48')][_0x6e23('0x69')]({'where':{'id':_0x55ef65['params']['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x345696,null))['then'](function(_0x399832){if(_0x399832){return _0x399832['setImap'](null);}return null;})[_0x6e23('0x12')](respondWithStatusCode(_0x345696,null))['catch'](handleError(_0x345696,null));};exports[_0x6e23('0x80')]=function(_0x40bba2,_0x332beb){return db[_0x6e23('0x48')]['findOne']({'where':{'id':_0x40bba2[_0x6e23('0x5c')]['id']}})['then'](handleEntityNotFound(_0x332beb,null))[_0x6e23('0x12')](function(_0x567877){if(_0x567877){return _0x567877[_0x6e23('0x80')]();}return null;})['then'](respondWithResult(_0x332beb,null))[_0x6e23('0x1a')](handleError(_0x332beb,null));};exports[_0x6e23('0x81')]=function(_0x39b9a9,_0x42a2ad){if(_0x39b9a9[_0x6e23('0x60')]['id']){delete _0x39b9a9[_0x6e23('0x60')]['id'];}return db['MailAccount'][_0x6e23('0x5f')]({'where':{'id':_0x39b9a9[_0x6e23('0x5c')]['id']}})['then'](handleEntityNotFound(_0x42a2ad,null))[_0x6e23('0x12')](function(_0x5bc759){if(_0x5bc759){_0x39b9a9[_0x6e23('0x60')]['MailAccountId']=_0x5bc759['id'];return db[_0x6e23('0x44')][_0x6e23('0x67')](_0x39b9a9[_0x6e23('0x60')]);}})['then'](respondWithResult(_0x42a2ad,null))[_0x6e23('0x1a')](handleError(_0x42a2ad,null));};exports['removeSmtp']=function(_0x3b7865,_0x383b40){return db[_0x6e23('0x48')][_0x6e23('0x69')]({'where':{'id':_0x3b7865['params']['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x383b40,null))[_0x6e23('0x12')](function(_0x859c6a){if(_0x859c6a){return _0x859c6a[_0x6e23('0x82')](null);}return null;})[_0x6e23('0x12')](respondWithStatusCode(_0x383b40,null))[_0x6e23('0x1a')](handleError(_0x383b40,null));};exports['addInteraction']=function(_0x5c7a35,_0x26a714){return db['MailInteraction']['find']({'where':{'id':_0x5c7a35['params']['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x26a714,null))[_0x6e23('0x12')](function(_0x29497c){if(_0x29497c){return _0x29497c['addInteraction'](_0x5c7a35[_0x6e23('0x60')][_0x6e23('0x71')],_[_0x6e23('0x83')](_0x5c7a35[_0x6e23('0x60')],[_0x6e23('0x71'),'id'])||{});}})['then'](respondWithResult(_0x26a714,null))[_0x6e23('0x1a')](handleError(_0x26a714,null));};exports[_0x6e23('0x84')]=function(_0x99715a,_0x456521){var _0x2df8c8={'raw':![],'where':{}};var _0x373526={};var _0x5b5495={'count':0x0,'rows':[]};return db[_0x6e23('0x48')]['findOne']({'where':{'id':_0x99715a[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x456521,null))[_0x6e23('0x12')](function(_0x560774){if(_0x560774){_0x373526[_0x6e23('0x4c')]=_['keys'](db[_0x6e23('0x85')][_0x6e23('0x6a')]);_0x373526[_0x6e23('0x4d')]=_[_0x6e23('0x4e')](_0x99715a[_0x6e23('0x4d')]);_0x373526[_0x6e23('0x56')]=_[_0x6e23('0x50')](_0x373526['model'],_0x373526['query']);_0x2df8c8[_0x6e23('0x4f')]=_['intersection'](_0x373526['model'],qs[_0x6e23('0x51')](_0x99715a['query'][_0x6e23('0x51')]));_0x2df8c8[_0x6e23('0x4f')]=_0x2df8c8['attributes'][_0x6e23('0x52')]?_0x2df8c8[_0x6e23('0x4f')]:_0x373526['model'];if(!_0x99715a[_0x6e23('0x4d')][_0x6e23('0x53')](_0x6e23('0x73'))){_0x2df8c8[_0x6e23('0x20')]=qs[_0x6e23('0x20')](_0x99715a[_0x6e23('0x4d')][_0x6e23('0x20')]);_0x2df8c8['offset']=qs[_0x6e23('0x1e')](_0x99715a[_0x6e23('0x4d')]['offset']);}_0x2df8c8[_0x6e23('0x54')]=qs[_0x6e23('0x6b')](_0x99715a[_0x6e23('0x4d')][_0x6e23('0x6b')]);_0x2df8c8[_0x6e23('0x55')]=qs[_0x6e23('0x56')](_[_0x6e23('0x57')](_0x99715a[_0x6e23('0x4d')],_0x373526[_0x6e23('0x56')]));_0x2df8c8[_0x6e23('0x55')][_0x6e23('0x66')]=_0x560774['id'];if(_0x99715a[_0x6e23('0x4d')][_0x6e23('0x6c')]){_0x2df8c8[_0x6e23('0x55')]=_[_0x6e23('0x58')](_0x2df8c8[_0x6e23('0x55')],{'$or':_[_0x6e23('0x47')](_0x2df8c8[_0x6e23('0x4f')],function(_0x4a6fbf){var _0x17c7ad={};_0x17c7ad[_0x4a6fbf]={'$like':'%'+_0x99715a[_0x6e23('0x4d')][_0x6e23('0x6c')]+'%'};return _0x17c7ad;})});}_0x2df8c8=_['merge']({},_0x2df8c8,_0x99715a[_0x6e23('0x5e')]);return db[_0x6e23('0x85')]['count']({'where':_0x2df8c8['where']})[_0x6e23('0x12')](function(_0x1c7a43){_0x5b5495[_0x6e23('0x21')]=_0x1c7a43;if(_0x99715a[_0x6e23('0x4d')][_0x6e23('0x5d')]){_0x2df8c8['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x6e23('0x86')],'as':_0x6e23('0x87'),'attributes':['name',_0x6e23('0x88'),_0x6e23('0x89')],'required':![]},{'model':db['Tag'],'as':_0x6e23('0x8a'),'attributes':['id',_0x6e23('0x2a'),_0x6e23('0x8b')],'where':_0x99715a[_0x6e23('0x4d')][_0x6e23('0x8c')]?{'id':_0x99715a[_0x6e23('0x4d')][_0x6e23('0x8c')]}:undefined,'required':_0x99715a[_0x6e23('0x4d')][_0x6e23('0x8c')]?!![]:![]}];}return db[_0x6e23('0x85')][_0x6e23('0x5a')](_0x2df8c8);})[_0x6e23('0x12')](function(_0x3760e7){_0x5b5495['rows']=_0x3760e7;return _0x5b5495;});}})['then'](respondWithFilteredResult(_0x456521,_0x2df8c8))[_0x6e23('0x1a')](handleError(_0x456521,null));};exports[_0x6e23('0x8d')]=function addApplications(_0x3f0954,_0x57d11f){var _0x425211=_0x3f0954['params']['id'];var _0x36dc49=_0x3f0954[_0x6e23('0x60')];var _0x2b8cc7=0xc8;var _0x4b42d2=null;return db[_0x6e23('0x8e')]['transaction']({'isolationLevel':db['sequelize'][_0x6e23('0x8f')]['ISOLATION_LEVELS'][_0x6e23('0x90')]},function(_0x122d20){return db['MailAccount'][_0x6e23('0x69')]({'where':{'id':_0x425211},'transaction':_0x122d20})[_0x6e23('0x12')](function(_0x1ff806){if(_0x1ff806){return db['MailApplication'][_0x6e23('0x27')]({'where':{'MailAccountId':_0x425211},'transaction':_0x122d20})['then'](function(){var _0x2c993b=_[_0x6e23('0x47')](_0x36dc49,function(_0x32cdff){_0x32cdff['MailAccountId']=_0x425211;return _0x32cdff;});return db['MailApplication']['bulkCreate'](_0x2c993b,{'transaction':_0x122d20});});}else{_0x2b8cc7=0x194;_0x4b42d2=[];}});})[_0x6e23('0x12')](function(){if(_0x2b8cc7!==0x194){return db[_0x6e23('0x91')][_0x6e23('0x92')]({'where':{'MailAccountId':_0x425211},'order':_0x6e23('0x93')})['then'](function(_0x1b5bfa){_0x4b42d2=_0x1b5bfa;});}})[_0x6e23('0x1a')](function(_0x186e0b){_0x2b8cc7=0x1f4;logger[_0x6e23('0x17')](_0x186e0b[_0x6e23('0x29')]);if(_0x186e0b[_0x6e23('0x2a')]){delete _0x186e0b[_0x6e23('0x2a')];}_0x4b42d2=_0x186e0b;})[_0x6e23('0x94')](function(){if(_0x4b42d2===null){_0x57d11f['sendStatus'](_0x2b8cc7);}else{if(_0x2b8cc7===0x1f4){_0x57d11f[_0x6e23('0x1b')](_0x2b8cc7)['send'](_0x4b42d2);}else{_0x57d11f[_0x6e23('0x1b')](_0x2b8cc7)[_0x6e23('0x1d')](_0x4b42d2);}}});};exports[_0x6e23('0x95')]=function(_0x4172f0,_0x36d8bd){var _0x41fa8f={};var _0x58675c={};var _0x165920;var _0x1ab0cc;return db[_0x6e23('0x48')]['findOne']({'where':{'id':_0x4172f0[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x36d8bd,null))['then'](function(_0x42f9a5){if(_0x42f9a5){_0x165920=_0x42f9a5;_0x58675c[_0x6e23('0x4c')]=_[_0x6e23('0x4e')](db[_0x6e23('0x91')][_0x6e23('0x6a')]);_0x58675c['query']=_[_0x6e23('0x4e')](_0x4172f0['query']);_0x58675c[_0x6e23('0x56')]=_['intersection'](_0x58675c[_0x6e23('0x4c')],_0x58675c[_0x6e23('0x4d')]);_0x41fa8f[_0x6e23('0x4f')]=_[_0x6e23('0x50')](_0x58675c[_0x6e23('0x4c')],qs[_0x6e23('0x51')](_0x4172f0[_0x6e23('0x4d')][_0x6e23('0x51')]));_0x41fa8f['attributes']=_0x41fa8f['attributes'][_0x6e23('0x52')]?_0x41fa8f[_0x6e23('0x4f')]:_0x58675c[_0x6e23('0x4c')];_0x41fa8f['order']=qs['sort'](_0x4172f0[_0x6e23('0x4d')][_0x6e23('0x6b')]);_0x41fa8f['where']=qs[_0x6e23('0x56')](_['pick'](_0x4172f0[_0x6e23('0x4d')],_0x58675c[_0x6e23('0x56')]));if(_0x4172f0['query'][_0x6e23('0x6c')]){_0x41fa8f[_0x6e23('0x55')]=_['merge'](_0x41fa8f[_0x6e23('0x55')],{'$or':_[_0x6e23('0x47')](_0x41fa8f[_0x6e23('0x4f')],function(_0x5708e1){var _0x56e8a9={};_0x56e8a9[_0x5708e1]={'$like':'%'+_0x4172f0[_0x6e23('0x4d')][_0x6e23('0x6c')]+'%'};return _0x56e8a9;})});}_0x41fa8f=_[_0x6e23('0x58')]({},_0x41fa8f,_0x4172f0[_0x6e23('0x5e')]);return _0x165920[_0x6e23('0x95')](_0x41fa8f);}})['then'](function(_0x46854e){if(_0x46854e){_0x1ab0cc=_0x46854e[_0x6e23('0x52')];if(!_0x4172f0[_0x6e23('0x4d')][_0x6e23('0x53')]('nolimit')){_0x41fa8f[_0x6e23('0x20')]=qs[_0x6e23('0x20')](_0x4172f0['query']['limit']);_0x41fa8f[_0x6e23('0x1e')]=qs[_0x6e23('0x1e')](_0x4172f0[_0x6e23('0x4d')]['offset']);}return _0x165920['getApplications'](_0x41fa8f);}})['then'](function(_0x2192b4){if(_0x2192b4){return _0x2192b4?{'count':_0x1ab0cc,'rows':_0x2192b4}:null;}})[_0x6e23('0x12')](respondWithResult(_0x36d8bd,null))[_0x6e23('0x1a')](handleError(_0x36d8bd,null));};exports['getMessages']=function(_0x2865df,_0x53adbb){var _0x570e3e={'raw':!![],'where':{}};var _0x5b36bf={};var _0x13f38a={'count':0x0,'rows':[]};return db[_0x6e23('0x48')]['findOne']({'where':{'id':_0x2865df[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x53adbb,null))[_0x6e23('0x12')](function(_0x5db147){if(_0x5db147){_0x5b36bf[_0x6e23('0x4c')]=_['keys'](db[_0x6e23('0x96')]['rawAttributes']);_0x5b36bf['query']=_[_0x6e23('0x4e')](_0x2865df[_0x6e23('0x4d')]);_0x5b36bf[_0x6e23('0x56')]=_[_0x6e23('0x50')](_0x5b36bf['model'],_0x5b36bf[_0x6e23('0x4d')]);_0x570e3e[_0x6e23('0x4f')]=_[_0x6e23('0x50')](_0x5b36bf[_0x6e23('0x4c')],qs[_0x6e23('0x51')](_0x2865df[_0x6e23('0x4d')]['fields']));_0x570e3e[_0x6e23('0x4f')]=_0x570e3e[_0x6e23('0x4f')][_0x6e23('0x52')]?_0x570e3e[_0x6e23('0x4f')]:_0x5b36bf['model'];if(!_0x2865df[_0x6e23('0x4d')][_0x6e23('0x53')](_0x6e23('0x73'))){_0x570e3e['limit']=qs[_0x6e23('0x20')](_0x2865df[_0x6e23('0x4d')]['limit']);_0x570e3e['offset']=qs[_0x6e23('0x1e')](_0x2865df[_0x6e23('0x4d')][_0x6e23('0x1e')]);}_0x570e3e[_0x6e23('0x54')]=qs[_0x6e23('0x6b')](_0x2865df[_0x6e23('0x4d')]['sort']);_0x570e3e[_0x6e23('0x55')]=qs[_0x6e23('0x56')](_['pick'](_0x2865df['query'],_0x5b36bf[_0x6e23('0x56')]));_0x570e3e[_0x6e23('0x55')][_0x6e23('0x66')]=_0x5db147['id'];if(_0x2865df[_0x6e23('0x4d')]['filter']){_0x570e3e[_0x6e23('0x55')]=_['merge'](_0x570e3e[_0x6e23('0x55')],{'$or':_[_0x6e23('0x47')](_0x570e3e[_0x6e23('0x4f')],function(_0x2e0d47){var _0x2b9dc5={};_0x2b9dc5[_0x2e0d47]={'$like':'%'+_0x2865df[_0x6e23('0x4d')][_0x6e23('0x6c')]+'%'};return _0x2b9dc5;})});}if(_0x2865df[_0x6e23('0x4d')][_0x6e23('0x97')]){var _0x3209c9=_0x2865df[_0x6e23('0x4d')]['$gte'][_0x6e23('0x98')](',');var _0x507fe0={};_0x507fe0[_0x3209c9[0x0]]={'$gte':moment(_0x3209c9[0x1])[_0x6e23('0x99')]('YYYY-MM-DD\x20HH:mm:ss')};_0x570e3e[_0x6e23('0x55')]=_[_0x6e23('0x58')](_0x570e3e[_0x6e23('0x55')],_0x507fe0);}_0x570e3e=_[_0x6e23('0x58')]({},_0x570e3e,_0x2865df[_0x6e23('0x5e')]);return db[_0x6e23('0x96')]['count']({'where':_0x570e3e['where']})[_0x6e23('0x12')](function(_0x47f0c0){_0x13f38a['count']=_0x47f0c0;if(_0x2865df[_0x6e23('0x4d')][_0x6e23('0x5d')]){_0x570e3e['include']=[{'all':!![]}];}return db[_0x6e23('0x96')][_0x6e23('0x5a')](_0x570e3e);})[_0x6e23('0x12')](function(_0x2d059c){if(_0x2865df[_0x6e23('0x4d')][_0x6e23('0x9a')]===_0x6e23('0x9b')){for(var _0xc7da93=0x0;_0xc7da93<_0x2d059c['length'];_0xc7da93++){_0x2d059c[_0xc7da93][_0x6e23('0x60')]=juice(_0x2d059c[_0xc7da93][_0x6e23('0x60')]);}}_0x13f38a['rows']=_0x2d059c;return _0x13f38a;});}})[_0x6e23('0x12')](respondWithFilteredResult(_0x53adbb,_0x570e3e))[_0x6e23('0x1a')](handleError(_0x53adbb,null));};exports[_0x6e23('0x2b')]=function(_0x21a018,_0x66eb94){var _0x4efa7b,_0x5b1180={},_0x1dfbc7;if(_0x21a018[_0x6e23('0x60')]['to']){_0x1dfbc7=_0x21a018['body']['to']['split'](',')[0x0];}return db[_0x6e23('0x48')][_0x6e23('0x5f')]({'where':{'id':_0x21a018[_0x6e23('0x5c')]['id']},'include':[{'model':db[_0x6e23('0x9c')],'as':_0x6e23('0x9d'),'include':[{'model':db[_0x6e23('0x9e')],'as':'Contacts','where':{'email':_0x1dfbc7},'limit':0x1,'order':[[_0x6e23('0x9f'),_0x6e23('0xa0')]]}]},{'model':db['MailServerOut'],'as':_0x6e23('0x41'),'raw':!![],'include':[{'model':db[_0x6e23('0xa1')],'as':_0x6e23('0xa1'),'raw':!![]}]}]})[_0x6e23('0x12')](handleEntityNotFound(_0x66eb94,null))[_0x6e23('0x12')](function(_0x1a8815){if(!_0x1a8815)return;_0x4efa7b=_0x1a8815;if(!_0x1a8815[_0x6e23('0x41')])throw new Error(_0x6e23('0xa2'));if(_['isNil'](_0x21a018[_0x6e23('0x60')][_0x6e23('0xa3')])){_0x21a018[_0x6e23('0x60')][_0x6e23('0xa3')]=util[_0x6e23('0x99')]('%s\x20<%s>',_0x1a8815[_0x6e23('0x2a')],_0x1a8815[_0x6e23('0x75')]||_0x1a8815[_0x6e23('0x41')][_0x6e23('0x35')]);}if(_0x21a018[_0x6e23('0x60')][_0x6e23('0xa4')]&&_0x21a018[_0x6e23('0x60')][_0x6e23('0xa4')][_0x6e23('0x52')]){for(var _0x141d90=0x0;_0x141d90<_0x21a018[_0x6e23('0x60')][_0x6e23('0xa4')][_0x6e23('0x52')];_0x141d90+=0x1){_0x21a018['body']['attachments'][_0x141d90]={'filename':_0x21a018[_0x6e23('0x60')][_0x6e23('0xa4')][_0x141d90]['name'],'path':path[_0x6e23('0xa5')](config['root'],_0x6e23('0xa6'),_0x21a018[_0x6e23('0x60')][_0x6e23('0xa4')][_0x141d90]['basename'])};}}var _0x103b11=_0x1a8815['getSmtpOptions']();return respondWithRpcPromise(_0x6e23('0xa7'),'sendMail',{'account':_0x103b11,'message':_0x21a018[_0x6e23('0x60')]});})[_0x6e23('0x12')](function(_0x163574){if(!_0x163574)return;_0x5b1180=_0x163574;if(!_0x4efa7b[_0x6e23('0x9d')])throw new Error(_0x6e23('0xa8'));if(_0x4efa7b['List']['Contacts']['length'])return _0x4efa7b[_0x6e23('0x9d')]['Contacts'][0x0];return db['CmContact'][_0x6e23('0x67')](_['defaults'](_0x21a018[_0x6e23('0x60')],{'firstName':_0x21a018['body']['to'],'email':_0x21a018[_0x6e23('0x60')]['to'],'phone':_0x21a018[_0x6e23('0x60')]['to'],'ListId':_0x4efa7b[_0x6e23('0x76')]}));})[_0x6e23('0x12')](function(_0x4b47bb){if(!_0x4b47bb)return;var _0x30694a={'UserId':_0x21a018[_0x6e23('0x35')]['id'],'ContactId':_0x4b47bb['id'],'MailAccountId':_0x4efa7b['id'],'inReplyTo':_0x5b1180[_0x6e23('0xa9')],'to':_0x21a018[_0x6e23('0x60')][_0x6e23('0xa3')],'cc':_0x21a018[_0x6e23('0x60')]['cc'],'subject':_0x21a018['body'][_0x6e23('0xaa')],'attach':_0x21a018[_0x6e23('0x60')][_0x6e23('0xab')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x6e23('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x6e23('0xac'),'Messages':[_['merge'](_0x21a018[_0x6e23('0x60')],{'messageId':_0x5b1180[_0x6e23('0xa9')],'sentAt':moment()['format'](_0x6e23('0xad')),'read':!![],'MailAccountId':_0x4efa7b['id'],'UserId':_0x21a018[_0x6e23('0x35')]['id'],'ContactId':_0x4b47bb['id']})]};if(_0x21a018[_0x6e23('0x60')][_0x6e23('0xae')]){_0x30694a=_[_0x6e23('0x58')](_0x30694a,_0x21a018[_0x6e23('0x60')][_0x6e23('0xae')]);}return db['MailInteraction']['create'](_0x30694a,{'include':[{'model':db['MailMessage'],'as':_0x6e23('0xaf')}]});})[_0x6e23('0x12')](respondWithResult(_0x66eb94,null))[_0x6e23('0x1a')](handleError(_0x66eb94,null));};exports[_0x6e23('0xb0')]=function(_0xce3f94,_0x4d2a42){return db[_0x6e23('0x48')][_0x6e23('0x5f')]({'where':{'id':_0xce3f94[_0x6e23('0x5c')]['id']},'include':[{'model':db[_0x6e23('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6e23('0xa1'),'raw':!![]}]}]})[_0x6e23('0x12')](handleEntityNotFound(_0x4d2a42,null))[_0x6e23('0x12')](function(_0x46fe78){if(!_0x46fe78[_0x6e23('0x41')])return;var _0x338af9=_0x46fe78[_0x6e23('0xb1')]();return respondWithRpcPromise(_0x6e23('0xb2'),_0x6e23('0xb0'),{'account':_0x338af9});})[_0x6e23('0x12')](respondWithResult(_0x4d2a42,null))['catch'](handleError(_0x4d2a42,null));};exports[_0x6e23('0x27')]=function(_0x383349,_0x170e3c){return db['MailAccount'][_0x6e23('0x5f')]({'where':{'id':_0x383349['params']['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x170e3c,null))[_0x6e23('0x12')](function(_0x14a78f){if(_0x14a78f&&_0x14a78f[_0x6e23('0x3e')]){throw new db[(_0x6e23('0xb3'))][(_0x6e23('0xb4'))](_0x6e23('0xb5'));}return _0x14a78f;})[_0x6e23('0x12')](removeEntity(_0x170e3c,null))[_0x6e23('0x1a')](handleError(_0x170e3c,null));};exports[_0x6e23('0xb6')]=function(_0x17fe5f,_0x40d874){return db['MailAccount']['find']({'where':{'id':_0x17fe5f[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x40d874,null))[_0x6e23('0x12')](function(_0x1095a0){if(_0x1095a0){return _0x1095a0[_0x6e23('0xb6')](_0x17fe5f['body'][_0x6e23('0x71')],_[_0x6e23('0x83')](_0x17fe5f['body'],['ids','id'])||{})[_0x6e23('0xb7')](function(_0x1e6aaa){for(var _0x4776b6=0x0;_0x4776b6<_0x17fe5f[_0x6e23('0x60')][_0x6e23('0x71')][_0x6e23('0x52')];_0x4776b6+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x17fe5f[_0x6e23('0x60')][_0x6e23('0x71')][_0x4776b6]),'MailAccountId':Number(_0x17fe5f[_0x6e23('0x5c')]['id'])});}return _0x1e6aaa;});}})[_0x6e23('0x12')](respondWithResult(_0x40d874,null))[_0x6e23('0x1a')](handleError(_0x40d874,null));};exports['removeAgents']=function(_0x492cd1,_0x256114){return db['MailAccount'][_0x6e23('0x5f')]({'where':{'id':_0x492cd1[_0x6e23('0x5c')]['id']}})[_0x6e23('0x12')](handleEntityNotFound(_0x256114,null))[_0x6e23('0x12')](function(_0x4eb87c){if(_0x4eb87c){return _0x4eb87c[_0x6e23('0xb8')](_0x492cd1[_0x6e23('0x4d')][_0x6e23('0x71')])[_0x6e23('0x12')](function(){if(_[_0x6e23('0xb9')](_0x492cd1[_0x6e23('0x4d')]['ids'])){for(var _0x42529f=0x0;_0x42529f<_0x492cd1[_0x6e23('0x4d')][_0x6e23('0x71')]['length'];_0x42529f+=0x1){socket['emit'](_0x6e23('0xba'),{'UserId':Number(_0x492cd1[_0x6e23('0x4d')][_0x6e23('0x71')][_0x42529f]),'MailAccountId':Number(_0x492cd1[_0x6e23('0x5c')]['id'])});}}else{socket['emit'](_0x6e23('0xba'),{'UserId':Number(_0x492cd1['query'][_0x6e23('0x71')]),'MailAccountId':Number(_0x492cd1[_0x6e23('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x256114,null))[_0x6e23('0x1a')](handleError(_0x256114,null));};exports[_0x6e23('0xbb')]=function(_0x401788,_0x35f562){var _0x282862={};var _0x321167={};var _0x5b759d;var _0x3fedc9;return db['MailAccount'][_0x6e23('0x69')]({'where':{'id':_0x401788[_0x6e23('0x5c')]['id']}})['then'](handleEntityNotFound(_0x35f562,null))[_0x6e23('0x12')](function(_0x2d12c9){if(_0x2d12c9){_0x5b759d=_0x2d12c9;_0x321167[_0x6e23('0x4c')]=_['keys'](db[_0x6e23('0x86')][_0x6e23('0x6a')]);_0x321167['query']=_['keys'](_0x401788[_0x6e23('0x4d')]);_0x321167[_0x6e23('0x56')]=_[_0x6e23('0x50')](_0x321167['model'],_0x321167['query']);_0x282862['attributes']=_[_0x6e23('0x50')](_0x321167['model'],qs[_0x6e23('0x51')](_0x401788['query'][_0x6e23('0x51')]));_0x282862[_0x6e23('0x4f')]=_0x282862['attributes'][_0x6e23('0x52')]?_0x282862['attributes']:_0x321167[_0x6e23('0x4c')];_0x282862[_0x6e23('0x54')]=qs['sort'](_0x401788['query'][_0x6e23('0x6b')]);_0x282862['where']=qs[_0x6e23('0x56')](_[_0x6e23('0x57')](_0x401788[_0x6e23('0x4d')],_0x321167[_0x6e23('0x56')]));if(_0x401788['query'][_0x6e23('0x6c')]){_0x282862[_0x6e23('0x55')]=_['merge'](_0x282862[_0x6e23('0x55')],{'$or':_[_0x6e23('0x47')](_0x282862[_0x6e23('0x4f')],function(_0x5c47f7){var _0x305267={};_0x305267[_0x5c47f7]={'$like':'%'+_0x401788['query'][_0x6e23('0x6c')]+'%'};return _0x305267;})});}_0x282862=_[_0x6e23('0x58')]({},_0x282862,_0x401788[_0x6e23('0x5e')]);return _0x5b759d[_0x6e23('0xbb')](_0x282862);}})[_0x6e23('0x12')](function(_0x1c6368){if(_0x1c6368){_0x3fedc9=_0x1c6368[_0x6e23('0x52')];if(!_0x401788[_0x6e23('0x4d')][_0x6e23('0x53')]('nolimit')){_0x282862[_0x6e23('0x20')]=qs['limit'](_0x401788[_0x6e23('0x4d')][_0x6e23('0x20')]);_0x282862[_0x6e23('0x1e')]=qs[_0x6e23('0x1e')](_0x401788[_0x6e23('0x4d')]['offset']);}return _0x5b759d[_0x6e23('0xbb')](_0x282862);}})['then'](function(_0x354def){if(_0x354def){return _0x354def?{'count':_0x3fedc9,'rows':_0x354def}:null;}})['then'](respondWithResult(_0x35f562,null))[_0x6e23('0x1a')](handleError(_0x35f562,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4d79e16..c9baa89 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 _0xd545=['emit','hasOwnProperty','hook','events','setMaxListeners','save','remove'];(function(_0xc3c473,_0x2660fe){var _0x4d4cae=function(_0x3aafc6){while(--_0x3aafc6){_0xc3c473['push'](_0xc3c473['shift']());}};_0x4d4cae(++_0x2660fe);}(_0xd545,0xff));var _0x5d54=function(_0x282679,_0x3b82ee){_0x282679=_0x282679-0x0;var _0x401bd0=_0xd545[_0x282679];return _0x401bd0;};'use strict';var EventEmitter=require(_0x5d54('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5d54('0x1')](0x0);var events={'afterCreate':_0x5d54('0x2'),'afterUpdate':'update','afterDestroy':_0x5d54('0x3')};function emitEvent(_0x2ec34e){return function(_0x16788d,_0x37080e,_0x2dab73){MailAccountEvents[_0x5d54('0x4')](_0x2ec34e+':'+_0x16788d['id'],_0x16788d);MailAccountEvents[_0x5d54('0x4')](_0x2ec34e,_0x16788d);_0x2dab73(null);};}for(var e in events){if(events[_0x5d54('0x5')](e)){var event=events[e];MailAccount[_0x5d54('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xf7a8=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount'];(function(_0x19fc3e,_0x1a060e){var _0x56a220=function(_0x4edc8d){while(--_0x4edc8d){_0x19fc3e['push'](_0x19fc3e['shift']());}};_0x56a220(++_0x1a060e);}(_0xf7a8,0xfa));var _0x8f7a=function(_0x460b63,_0x4dd692){_0x460b63=_0x460b63-0x0;var _0x3a3039=_0xf7a8[_0x460b63];return _0x3a3039;};'use strict';var EventEmitter=require(_0x8f7a('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8f7a('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8f7a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8f7a('0x3'),'afterDestroy':_0x8f7a('0x4')};function emitEvent(_0x2243d9){return function(_0x25846,_0x127479,_0xee8437){MailAccountEvents[_0x8f7a('0x5')](_0x2243d9+':'+_0x25846['id'],_0x25846);MailAccountEvents[_0x8f7a('0x5')](_0x2243d9,_0x25846);_0xee8437(null);};}for(var e in events){if(events[_0x8f7a('0x6')](e)){var event=events[e];MailAccount[_0x8f7a('0x7')](e,emitEvent(event));}}module[_0x8f7a('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9b88270..6d0338f 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 _0x0f68=['user','data5','pass','exports','define','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0f68,0x1d7));var _0x80f6=function(_0x50754d,_0x38c32d){_0x50754d=_0x50754d-0x0;var _0x21de24=_0x0f68[_0x50754d];return _0x21de24;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x80f6('0x0')]=function(_0x3941e5){return _0x3941e5[_0x80f6('0x1')]('MailAccount',attributes,{'tableName':_0x80f6('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x45a44e=this;var _0x3b0f21={'id':_0x45a44e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x45a44e[_0x80f6('0x3')]!==_0x80f6('0x4')){_0x3b0f21[_0x80f6('0x5')]=_0x45a44e[_0x80f6('0x3')];}else{_0x3b0f21[_0x80f6('0x6')]=_0x45a44e[_0x80f6('0x7')][_0x80f6('0x6')];_0x3b0f21[_0x80f6('0x8')]=_0x45a44e[_0x80f6('0x7')][_0x80f6('0x8')];_0x3b0f21['secure']=_0x45a44e['Smtp'][_0x80f6('0x9')];}if(_0x45a44e['Smtp'][_0x80f6('0xa')]){if(_0x45a44e[_0x80f6('0x7')][_0x80f6('0xb')]){if(!_0x45a44e[_0x80f6('0x7')][_0x80f6('0xc')])throw new Error(_0x80f6('0xd'));_0x3b0f21[_0x80f6('0xe')]={'type':'OAuth2','user':_0x45a44e[_0x80f6('0x7')][_0x80f6('0xf')],'accessToken':_0x45a44e[_0x80f6('0x7')][_0x80f6('0xc')][_0x80f6('0x10')]};}else{_0x3b0f21[_0x80f6('0xe')]={'user':_0x45a44e['Smtp'][_0x80f6('0xf')],'pass':_0x45a44e[_0x80f6('0x7')][_0x80f6('0x11')]};}}return _0x3b0f21;}}});}; \ No newline at end of file +var _0x55af=['OAuth2','data5','pass','exports','define','MailAccount','mail_accounts','provider','custom','Smtp','host','port','secure','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55af,0x8b));var _0xf55a=function(_0x23f123,_0x4c27e1){_0x23f123=_0x23f123-0x0;var _0x32413b=_0x55af[_0x23f123];return _0x32413b;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xf55a('0x0')]=function(_0xa873a4){return _0xa873a4[_0xf55a('0x1')](_0xf55a('0x2'),attributes,{'tableName':_0xf55a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5236bd=this;var _0x1cb630={'id':_0x5236bd['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5236bd[_0xf55a('0x4')]!==_0xf55a('0x5')){_0x1cb630['service']=_0x5236bd[_0xf55a('0x4')];}else{_0x1cb630['host']=_0x5236bd[_0xf55a('0x6')][_0xf55a('0x7')];_0x1cb630[_0xf55a('0x8')]=_0x5236bd[_0xf55a('0x6')][_0xf55a('0x8')];_0x1cb630[_0xf55a('0x9')]=_0x5236bd[_0xf55a('0x6')]['secure'];}if(_0x5236bd[_0xf55a('0x6')][_0xf55a('0xa')]){if(_0x5236bd[_0xf55a('0x6')]['modernAuthentication']){if(!_0x5236bd[_0xf55a('0x6')][_0xf55a('0xb')])throw new Error(_0xf55a('0xc'));_0x1cb630[_0xf55a('0xd')]={'type':_0xf55a('0xe'),'user':_0x5236bd[_0xf55a('0x6')]['user'],'accessToken':_0x5236bd[_0xf55a('0x6')][_0xf55a('0xb')][_0xf55a('0xf')]};}else{_0x1cb630[_0xf55a('0xd')]={'user':_0x5236bd['Smtp']['user'],'pass':_0x5236bd[_0xf55a('0x6')][_0xf55a('0x10')]};}}return _0x1cb630;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index fd09a0a..89d0477 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 _0x66fa=['ShowMailAccount','smtp','getSmtpOptions','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','Applications','MailServerOut','Smtp','List','get','omit','smtpOptions','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','attach','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','catch'];(function(_0x3883e2,_0x27792e){var _0x2d7f25=function(_0x1b0bde){while(--_0x1b0bde){_0x3883e2['push'](_0x3883e2['shift']());}};_0x2d7f25(++_0x27792e);}(_0x66fa,0x117));var _0xa66f=function(_0x485caf,_0x2131e9){_0x485caf=_0x485caf-0x0;var _0x3f94a3=_0x66fa[_0x485caf];return _0x3f94a3;};'use strict';var _=require(_0xa66f('0x0'));var moment=require(_0xa66f('0x1'));var BPromise=require('bluebird');var rs=require(_0xa66f('0x2'));var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var logger=require(_0xa66f('0x5'))(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var jayson=require(_0xa66f('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0xa66f('0x9')]=_[_0xa66f('0xa')](config[_0xa66f('0x9')],{'host':_0xa66f('0xb'),'port':0x18eb});var socket=require(_0xa66f('0xc'))(new Redis(config['redis']));require(_0xa66f('0xd'))['register'](socket);function respondWithRpcPromise(_0x46c788,_0x597c7c,_0x101e10){return new BPromise(function(_0x53ca76,_0x52d802){return client['request'](_0x46c788,_0x101e10)[_0xa66f('0xe')](function(_0x825868){logger['info'](_0xa66f('0xf'),_0x597c7c,'request\x20sent');logger[_0xa66f('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x597c7c,_0xa66f('0x11'),JSON[_0xa66f('0x12')](_0x825868));if(_0x825868[_0xa66f('0x13')]){if(_0x825868['error']['code']===0x1f4){logger[_0xa66f('0x13')]('MailAccount,\x20%s,\x20%s',_0x597c7c,_0x825868['error']['message']);return _0x52d802(_0x825868[_0xa66f('0x13')][_0xa66f('0x14')]);}logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x597c7c,_0x825868[_0xa66f('0x13')]['message']);return _0x53ca76(_0x825868['error'][_0xa66f('0x14')]);}else{logger[_0xa66f('0x15')](_0xa66f('0xf'),_0x597c7c,_0xa66f('0x11'));_0x53ca76(_0x825868['result'][_0xa66f('0x14')]);}})['catch'](function(_0x4a28d4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x597c7c,_0x4a28d4);_0x52d802(_0x4a28d4);});});}exports[_0xa66f('0x16')]=function(_0x355ddc){var _0x2c5b76=this;return new Promise(function(_0x408bc7,_0x251f60){return db[_0xa66f('0x17')][_0xa66f('0x18')]({'raw':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1a')]===undefined?!![]:![]:!![],'where':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1b')]||null:null,'attributes':_0x355ddc['options']?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1c')]||null:null,'limit':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')]['limit']||null:null,'include':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x355ddc['options']['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x1c')],'include':_0xed98b9[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1f')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x1c')],'include':_0x4683c7[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x4683c7[_0xa66f('0x1d')],function(_0x1eb86a){return{'model':db[_0x1eb86a[_0xa66f('0x1f')]],'as':_0x1eb86a['as'],'attributes':_0x1eb86a[_0xa66f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xe')](function(_0x45f71c){logger[_0xa66f('0x15')](_0xa66f('0x16'),_0x355ddc);logger[_0xa66f('0x10')]('GetMailAccount',_0x355ddc,JSON['stringify'](_0x45f71c));_0x408bc7(_0x45f71c);})[_0xa66f('0x20')](function(_0x27ceae){logger['error'](_0xa66f('0x16'),_0x27ceae[_0xa66f('0x14')],_0x355ddc);_0x251f60(_0x2c5b76['error'](0x1f4,_0x27ceae[_0xa66f('0x14')]));});});};exports[_0xa66f('0x21')]=function(_0x9d78d5){var _0x2c2ace=this;return new Promise(function(_0x395623,_0x548add){return db[_0xa66f('0x17')]['find']({'raw':_0x9d78d5[_0xa66f('0x19')]?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1a')]===undefined?!![]:![]:!![],'where':_0x9d78d5['options']?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1b')]||null:null,'attributes':_0x9d78d5['options']?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1c')]||null:null,'include':_0x9d78d5[_0xa66f('0x19')]?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1d')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1f')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1d')]?_['map'](_0x35ef27[_0xa66f('0x1d')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1f')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x1c')],'include':_0x46f6cc[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x46f6cc[_0xa66f('0x1d')],function(_0xcee582){return{'model':db[_0xcee582['model']],'as':_0xcee582['as'],'attributes':_0xcee582[_0xa66f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4477cf){if(_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x22')]===!![])_0x4477cf['setDataValue']('smtpOptions',_0x4477cf[_0xa66f('0x23')]());logger[_0xa66f('0x15')](_0xa66f('0x21'),_0x9d78d5);logger[_0xa66f('0x10')](_0xa66f('0x21'),_0x9d78d5,JSON['stringify'](_0x4477cf));_0x395623(_0x4477cf);})['catch'](function(_0x49b869){logger[_0xa66f('0x13')]('ShowMailAccount',_0x49b869['message'],_0x9d78d5);_0x548add(_0x2c2ace['error'](0x1f4,_0x49b869[_0xa66f('0x14')]));});});};exports['NotifyMailAccount']=function(_0x8965d3){var _0x17d942=this;return new Promise(function(_0x23a546,_0x1647a0){var _0xd65c5d={'body':_0x8965d3[_0xa66f('0x24')],'channel':_0xa66f('0x25')};var _0x261089=_[_0xa66f('0x26')](_[_0xa66f('0x27')](db[_0xa66f('0x28')][_0xa66f('0x29')]),[_0xa66f('0x2a'),_0xa66f('0x2b'),'CompanyId',_0xa66f('0x2c')]);var _0x25c2cb=![];if(_0x8965d3['body']['id']){delete _0x8965d3[_0xa66f('0x24')]['id'];}if(_['isNil'](_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')])){return _0x1647a0(_0x17d942['error'](0x1f4,_0xa66f('0x2e')));}if(_[_0xa66f('0x2f')](_0x8965d3[_0xa66f('0x24')]['body'])||_0x8965d3[_0xa66f('0x24')]['body']===''){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x30')));}if(_[_0xa66f('0x2f')](_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')])){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x32')+_0x261089));}if(!_['includes'](_0x261089,_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')])){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x33')+_0x261089));}var _0x374e53={};_0x374e53[_0x8965d3['body']['mapKey']]=_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')];return db[_0xa66f('0x17')][_0xa66f('0x34')]({'where':{'id':_0x8965d3[_0xa66f('0x35')]['id']},'include':[{'model':db[_0xa66f('0x36')],'as':'List','include':[{'model':db[_0xa66f('0x28')],'as':_0xa66f('0x37'),'where':_0x374e53,'limit':0x1,'order':[[_0xa66f('0x2b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0xa66f('0x38')},{'model':db[_0xa66f('0x39')],'as':_0xa66f('0x3a'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x19e7ce){if(_0x19e7ce&&_0x19e7ce[_0xa66f('0x3b')]){var _0x40d3b6=_0x19e7ce[_0xa66f('0x3c')]({'plain':!![]});_0xd65c5d[_0xa66f('0x35')]=_[_0xa66f('0x3d')](_0x40d3b6,[_0xa66f('0x38'),_0xa66f('0x3b')]);_0xd65c5d['account'][_0xa66f('0x3e')]=_0x19e7ce[_0xa66f('0x23')]();_0xd65c5d[_0xa66f('0x3f')]=_0x40d3b6[_0xa66f('0x38')];_0xd65c5d[_0xa66f('0x40')]=_0x40d3b6[_0xa66f('0x3b')];_0xd65c5d['applications']=_[_0xa66f('0x41')](_0xd65c5d[_0xa66f('0x3f')],[_0xa66f('0x42')],[_0xa66f('0x43')]);if(_0xd65c5d[_0xa66f('0x35')]&&_0xd65c5d['account'][_0xa66f('0x44')]){_0xd65c5d['applications'][_0xa66f('0x45')]({'id':0x0,'priority':_0xd65c5d['applications']['length']+0x1,'app':_0xa66f('0x46'),'appdata':_0xa66f('0x44'),'interval':_0xa66f('0x47')});}if(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x38')]){delete _0xd65c5d[_0xa66f('0x35')]['Applications'];}if(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x3b')]){delete _0xd65c5d[_0xa66f('0x35')][_0xa66f('0x3b')];}if(_0x40d3b6['List'][_0xa66f('0x37')]['length']){return _0x40d3b6[_0xa66f('0x3b')][_0xa66f('0x37')][0x0];}var _0x21482f=_[_0xa66f('0xa')](_0x8965d3[_0xa66f('0x24')],{'firstName':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')],'ListId':_0x40d3b6['ListId']});_0x21482f[_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')]]=_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')];return db[_0xa66f('0x28')][_0xa66f('0x48')](_0x21482f);}else{throw new Error(_0xa66f('0x49'));}})[_0xa66f('0xe')](function(_0x350fce){_0xd65c5d['contact']=_0x350fce;if(_0x350fce){if(!_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4a')]){_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x4a')]=rs[_0xa66f('0x4b')]()+'\x20'+_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x2d')];}var _0x11c89e={'ContactId':_0x350fce['id'],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id'],'inReplyTo':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x4a')],'to':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x2d')],'cc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['cc'],'subject':_0x8965d3['body']['message'][_0xa66f('0x4c')],'attach':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['attach'],'lastMsgAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgDirection':'in'};return db[_0xa66f('0x4f')][_0xa66f('0x34')]({'where':{'closed':![],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id']},'include':[{'model':db[_0xa66f('0x50')],'as':_0xa66f('0x51'),'attributes':[_0xa66f('0x4a')],'where':{'messageId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x52')]}}]})[_0xa66f('0xe')](function(_0x235e4f){if(_0x235e4f){return[_0x235e4f,![]];}return db[_0xa66f('0x4f')][_0xa66f('0x48')](_0x11c89e)[_0xa66f('0xe')](function(_0x41ffa7){return[_0x41ffa7,!![]];});});}else{throw new Error(_0xa66f('0x53'));}})['spread'](function(_0x52f22d,_0x46327d){if(_0x52f22d){_0x25c2cb=_0x46327d;if(!_0x46327d){return _0x52f22d[_0xa66f('0x54')]({'inReplyTo':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x4a')],'to':_0x8965d3['body'][_0xa66f('0x14')]['from'],'cc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['cc'],'subject':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['subject'],'attach':_0x52f22d[_0xa66f('0x55')]?_0x52f22d[_0xa66f('0x55')]:_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x55')],'substatus':null,'substatusAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgDirection':'in'});}else{return _0x52f22d;}}})[_0xa66f('0xe')](function(_0x290323){_0xd65c5d[_0xa66f('0x56')]=_0x290323['get']({'plain':!![]});_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x57')]=_0x25c2cb;return db[_0xa66f('0x50')][_0xa66f('0x48')]({'body':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x24')],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id'],'MailInteractionId':_0x290323['id'],'direction':'in','ContactId':_0xd65c5d[_0xa66f('0x58')]['id'],'messageId':_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4a')],'from':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x2d')],'to':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['to'],'cc':_0x8965d3[_0xa66f('0x24')]['message']['cc'],'subject':_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4c')],'attach':_0x8965d3[_0xa66f('0x24')]['message']['attach'],'Attachments':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x59')],'originTo':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5a')],'originCc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x5b')],'bcc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x5c')],'ChatWebsiteId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5d')]||null,'originChannel':_0x8965d3[_0xa66f('0x24')]['message']['originChannel']||_0xa66f('0x5e'),'ChatOfflineMessageId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0xa66f('0x60')}]});})['then'](function(_0x4feda0){_0xd65c5d['message']=_0x4feda0;if(_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x61')]){return db[_0xa66f('0x62')][_0xa66f('0x34')]({'attributes':['id',_0xa66f('0x63')],'where':{'id':_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x61')]}})[_0xa66f('0xe')](function(_0x1ee6e0){if(_0x1ee6e0){_0xd65c5d[_0xa66f('0x3f')][_0xa66f('0x64')]({'id':0x0,'priority':0x0,'app':_0xa66f('0x65'),'appdata':_0x1ee6e0[_0xa66f('0x63')]+','+(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x66')]||0xa),'interval':_0xa66f('0x47')});}return respondWithRpcPromise('Start',_0xa66f('0x67'),_0xd65c5d);});}return respondWithRpcPromise('Start',_0xa66f('0x67'),_0xd65c5d);})['then'](function(_0xc4b32b){_0x23a546(_0xc4b32b);})[_0xa66f('0x20')](function(_0x2bb4e5){_0x1647a0(_0x17d942['error'](0x1f4,_0x2bb4e5['message']));});});}; \ No newline at end of file +var _0x4137=['Smtp','CloudProvider','get','omit','Applications','applications','priority','asc','push','length','Contacts','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailServerOut'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7413('0x0'));var moment=require(_0x7413('0x1'));var BPromise=require(_0x7413('0x2'));var rs=require(_0x7413('0x3'));var Redis=require(_0x7413('0x4'));var db=require(_0x7413('0x5'))['db'];var logger=require(_0x7413('0x6'))(_0x7413('0x7'));var config=require(_0x7413('0x8'));var jayson=require(_0x7413('0x9'));var client=jayson[_0x7413('0xa')][_0x7413('0xb')]({'port':0x232c});config['redis']=_[_0x7413('0xc')](config[_0x7413('0xd')],{'host':_0x7413('0xe'),'port':0x18eb});var socket=require(_0x7413('0xf'))(new Redis(config['redis']));require(_0x7413('0x10'))[_0x7413('0x11')](socket);function respondWithRpcPromise(_0x4e320b,_0x422bf5,_0x2f4b54){return new BPromise(function(_0x50fde0,_0x29f124){return client[_0x7413('0x12')](_0x4e320b,_0x2f4b54)[_0x7413('0x13')](function(_0x3e026b){logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));logger[_0x7413('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'),JSON[_0x7413('0x17')](_0x3e026b));if(_0x3e026b[_0x7413('0x18')]){if(_0x3e026b['error']['code']===0x1f4){logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b[_0x7413('0x18')]['message']);return _0x29f124(_0x3e026b[_0x7413('0x18')][_0x7413('0x1a')]);}logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b['error']['message']);return _0x50fde0(_0x3e026b[_0x7413('0x18')]['message']);}else{logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));_0x50fde0(_0x3e026b[_0x7413('0x1b')][_0x7413('0x1a')]);}})[_0x7413('0x1c')](function(_0x2a3417){logger[_0x7413('0x18')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x2a3417);_0x29f124(_0x2a3417);});});}exports[_0x7413('0x1d')]=function(_0x17c062){var _0x11f8a1=this;return new Promise(function(_0xfe5b8c,_0x5bee15){return db[_0x7413('0x1e')][_0x7413('0x1f')]({'raw':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x21')]===undefined?!![]:![]:!![],'where':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x22')]||null:null,'attributes':_0x17c062['options']?_0x17c062['options'][_0x7413('0x23')]||null:null,'limit':_0x17c062['options']?_0x17c062[_0x7413('0x20')][_0x7413('0x24')]||null:null,'include':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x25')]?_[_0x7413('0x26')](_0x17c062[_0x7413('0x20')][_0x7413('0x25')],function(_0x1d455b){return{'model':db[_0x1d455b['model']],'as':_0x1d455b['as'],'attributes':_0x1d455b['attributes'],'include':_0x1d455b[_0x7413('0x25')]?_['map'](_0x1d455b[_0x7413('0x25')],function(_0x71cbb4){return{'model':db[_0x71cbb4[_0x7413('0x27')]],'as':_0x71cbb4['as'],'attributes':_0x71cbb4['attributes'],'include':_0x71cbb4[_0x7413('0x25')]?_[_0x7413('0x26')](_0x71cbb4[_0x7413('0x25')],function(_0x4843fd){return{'model':db[_0x4843fd[_0x7413('0x27')]],'as':_0x4843fd['as'],'attributes':_0x4843fd[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24dce7){logger['info'](_0x7413('0x1d'),_0x17c062);logger[_0x7413('0x16')](_0x7413('0x1d'),_0x17c062,JSON[_0x7413('0x17')](_0x24dce7));_0xfe5b8c(_0x24dce7);})[_0x7413('0x1c')](function(_0x2004ea){logger['error'](_0x7413('0x1d'),_0x2004ea[_0x7413('0x1a')],_0x17c062);_0x5bee15(_0x11f8a1[_0x7413('0x18')](0x1f4,_0x2004ea[_0x7413('0x1a')]));});});};exports[_0x7413('0x28')]=function(_0x256395){var _0x185cfe=this;return new Promise(function(_0x5b4426,_0xd763f9){return db[_0x7413('0x1e')][_0x7413('0x29')]({'raw':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x22')]||null:null,'attributes':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['attributes']||null:null,'include':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x25')]?_[_0x7413('0x26')](_0x256395['options']['include'],function(_0x440bfe){return{'model':db[_0x440bfe[_0x7413('0x27')]],'as':_0x440bfe['as'],'attributes':_0x440bfe[_0x7413('0x23')],'include':_0x440bfe['include']?_['map'](_0x440bfe[_0x7413('0x25')],function(_0x5a92ab){return{'model':db[_0x5a92ab['model']],'as':_0x5a92ab['as'],'attributes':_0x5a92ab[_0x7413('0x23')],'include':_0x5a92ab['include']?_[_0x7413('0x26')](_0x5a92ab[_0x7413('0x25')],function(_0xf34b21){return{'model':db[_0xf34b21[_0x7413('0x27')]],'as':_0xf34b21['as'],'attributes':_0xf34b21[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa58bd2){if(_0x256395[_0x7413('0x20')][_0x7413('0x2a')]===!![])_0xa58bd2[_0x7413('0x2b')](_0x7413('0x2c'),_0xa58bd2[_0x7413('0x2d')]());logger[_0x7413('0x14')](_0x7413('0x28'),_0x256395);logger[_0x7413('0x16')](_0x7413('0x28'),_0x256395,JSON[_0x7413('0x17')](_0xa58bd2));_0x5b4426(_0xa58bd2);})[_0x7413('0x1c')](function(_0x5a9791){logger[_0x7413('0x18')]('ShowMailAccount',_0x5a9791['message'],_0x256395);_0xd763f9(_0x185cfe['error'](0x1f4,_0x5a9791['message']));});});};exports['NotifyMailAccount']=function(_0x44af7d){var _0x4c1770=this;return new Promise(function(_0x535e49,_0x5dc077){var _0x4d0008={'body':_0x44af7d['body'],'channel':_0x7413('0x2e')};var _0x32f1e8=_[_0x7413('0x2f')](_[_0x7413('0x30')](db[_0x7413('0x31')]['rawAttributes']),[_0x7413('0x32'),'updatedAt',_0x7413('0x33'),_0x7413('0x34')]);var _0xa063d1=![];if(_0x44af7d[_0x7413('0x35')]['id']){delete _0x44af7d[_0x7413('0x35')]['id'];}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x37')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x38')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x35')])||_0x44af7d['body'][_0x7413('0x35')]===''){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x39')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x3b')+_0x32f1e8));}if(!_[_0x7413('0x3c')](_0x32f1e8,_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770['error'](0x1f4,_0x7413('0x3d')+_0x32f1e8));}var _0x52a088={};_0x52a088[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d[_0x7413('0x35')][_0x7413('0x37')];return db[_0x7413('0x1e')][_0x7413('0x29')]({'where':{'id':_0x44af7d[_0x7413('0x3e')]['id']},'include':[{'model':db[_0x7413('0x3f')],'as':_0x7413('0x40'),'include':[{'model':db[_0x7413('0x31')],'as':'Contacts','where':_0x52a088,'limit':0x1,'order':[['updatedAt',_0x7413('0x41')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x7413('0x42')],'as':_0x7413('0x43'),'include':[{'model':db['CloudProvider'],'as':_0x7413('0x44')}]}]})['then'](function(_0x562bae){if(_0x562bae&&_0x562bae[_0x7413('0x40')]){var _0x5f263e=_0x562bae[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x3e')]=_[_0x7413('0x46')](_0x5f263e,[_0x7413('0x47'),_0x7413('0x40')]);_0x4d0008[_0x7413('0x3e')][_0x7413('0x2c')]=_0x562bae[_0x7413('0x2d')]();_0x4d0008[_0x7413('0x48')]=_0x5f263e[_0x7413('0x47')];_0x4d0008['list']=_0x5f263e[_0x7413('0x40')];_0x4d0008['applications']=_['orderBy'](_0x4d0008['applications'],[_0x7413('0x49')],[_0x7413('0x4a')]);if(_0x4d0008[_0x7413('0x3e')]&&_0x4d0008[_0x7413('0x3e')]['autoclose']){_0x4d0008['applications'][_0x7413('0x4b')]({'id':0x0,'priority':_0x4d0008['applications'][_0x7413('0x4c')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x4d0008['account']['Applications']){delete _0x4d0008[_0x7413('0x3e')][_0x7413('0x47')];}if(_0x4d0008[_0x7413('0x3e')][_0x7413('0x40')]){delete _0x4d0008[_0x7413('0x3e')]['List'];}if(_0x5f263e[_0x7413('0x40')][_0x7413('0x4d')][_0x7413('0x4c')]){return _0x5f263e['List'][_0x7413('0x4d')][0x0];}var _0x5c3324=_['defaults'](_0x44af7d[_0x7413('0x35')],{'firstName':_0x44af7d[_0x7413('0x35')][_0x7413('0x37')],'ListId':_0x5f263e[_0x7413('0x34')]});_0x5c3324[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d['body'][_0x7413('0x37')];return db['CmContact'][_0x7413('0x4e')](_0x5c3324);}else{throw new Error('List\x20not\x20found');}})[_0x7413('0x13')](function(_0x4d4faa){_0x4d0008[_0x7413('0x4f')]=_0x4d4faa;if(_0x4d4faa){if(!_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x50')]){_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')]=rs['generate']()+'\x20'+_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'];}var _0x3ce34c={'ContactId':_0x4d4faa['id'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'inReplyTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x52')],'lastMsgAt':moment()[_0x7413('0x53')](_0x7413('0x54')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x44af7d['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x7413('0x50')],'where':{'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['inReplyTo']}}]})[_0x7413('0x13')](function(_0xb7dd83){if(_0xb7dd83){return[_0xb7dd83,![]];}return db[_0x7413('0x55')][_0x7413('0x4e')](_0x3ce34c)[_0x7413('0x13')](function(_0x3db284){return[_0x3db284,!![]];});});}else{throw new Error(_0x7413('0x56'));}})[_0x7413('0x57')](function(_0x1ec131,_0x47512d){if(_0x1ec131){_0xa063d1=_0x47512d;if(!_0x47512d){return _0x1ec131[_0x7413('0x58')]({'inReplyTo':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['messageId'],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x1ec131[_0x7413('0x52')]?_0x1ec131['attach']:_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0x7413('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x7413('0x54')),'lastMsgDirection':'in'});}else{return _0x1ec131;}}})[_0x7413('0x13')](function(_0x167c6b){_0x4d0008[_0x7413('0x59')]=_0x167c6b[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x59')][_0x7413('0x5a')]=_0xa063d1;return db[_0x7413('0x5b')]['create']({'body':_0x44af7d[_0x7413('0x35')]['body'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'MailInteractionId':_0x167c6b['id'],'direction':'in','ContactId':_0x4d0008[_0x7413('0x4f')]['id'],'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x50')],'from':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'to':_0x44af7d[_0x7413('0x35')]['message']['to'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')]['attach'],'Attachments':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attachments'],'originTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x5c')],'originCc':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x5d')],'bcc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5e')],'ChatWebsiteId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5f')]||'Email','ChatOfflineMessageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x60')]||null},{'include':[{'model':db[_0x7413('0x61')],'as':_0x7413('0x62')}]});})[_0x7413('0x13')](function(_0x46e9f8){_0x4d0008[_0x7413('0x1a')]=_0x46e9f8;if(_0x4d0008[_0x7413('0x59')]['UserId']){return db[_0x7413('0x63')][_0x7413('0x29')]({'attributes':['id',_0x7413('0x64')],'where':{'id':_0x4d0008[_0x7413('0x59')][_0x7413('0x65')]}})[_0x7413('0x13')](function(_0x4c9d1b){if(_0x4c9d1b){_0x4d0008[_0x7413('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c9d1b[_0x7413('0x64')]+','+(_0x4d0008[_0x7413('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0x7413('0x66')});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);})[_0x7413('0x13')](function(_0x2d361c){_0x535e49(_0x2d361c);})[_0x7413('0x1c')](function(_0x5f4765){_0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x5f4765['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 866ca38..f78823b 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 _0x26d0=['mailAccount:','./mailAccount.events','save','emit','removeListener','length'];(function(_0x299db8,_0x1ef1f5){var _0x38ada8=function(_0x4ac54a){while(--_0x4ac54a){_0x299db8['push'](_0x299db8['shift']());}};_0x38ada8(++_0x1ef1f5);}(_0x26d0,0x67));var _0x026d=function(_0x143c47,_0x3b1257){_0x143c47=_0x143c47-0x0;var _0x31703d=_0x26d0[_0x143c47];return _0x31703d;};'use strict';var MailAccountEvents=require(_0x026d('0x0'));var events=[_0x026d('0x1'),'remove','update'];function createListener(_0x4a3831,_0x4e2a17){return function(_0x4c4630){_0x4e2a17[_0x026d('0x2')](_0x4a3831,_0x4c4630);};}function removeListener(_0x8e4ee1,_0x377256){return function(){MailAccountEvents[_0x026d('0x3')](_0x8e4ee1,_0x377256);};}exports['register']=function(_0x467135){for(var _0x2c39be=0x0,_0x5906d0=events[_0x026d('0x4')];_0x2c39be<_0x5906d0;_0x2c39be++){var _0x4a465b=events[_0x2c39be];var _0x3ab647=createListener(_0x026d('0x5')+_0x4a465b,_0x467135);MailAccountEvents['on'](_0x4a465b,_0x3ab647);}}; \ No newline at end of file +var _0x88be=['save','remove','update','emit','removeListener','length','mailAccount:'];(function(_0x1d8b92,_0x54bbae){var _0x2a8750=function(_0x1a5cb5){while(--_0x1a5cb5){_0x1d8b92['push'](_0x1d8b92['shift']());}};_0x2a8750(++_0x54bbae);}(_0x88be,0xcb));var _0xe88b=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x88be[_0x411add];return _0x238242;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe88b('0x0'),_0xe88b('0x1'),_0xe88b('0x2')];function createListener(_0x16ed90,_0xf1f325){return function(_0x3bd96f){_0xf1f325[_0xe88b('0x3')](_0x16ed90,_0x3bd96f);};}function removeListener(_0x4acaad,_0x2b96bc){return function(){MailAccountEvents[_0xe88b('0x4')](_0x4acaad,_0x2b96bc);};}exports['register']=function(_0x172c97){for(var _0xadead7=0x0,_0x3c0570=events[_0xe88b('0x5')];_0xadead7<_0x3c0570;_0xadead7++){var _0x3ca74e=events[_0xadead7];var _0x238037=createListener(_0xe88b('0x6')+_0x3ca74e,_0x172c97);MailAccountEvents['on'](_0x3ca74e,_0x238037);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2af646b..f2bad35 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 _0xc0ae=['put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x1dab1d,_0x2bfadf){var _0x1e63f0=function(_0x311381){while(--_0x311381){_0x1dab1d['push'](_0x1dab1d['shift']());}};_0x1e63f0(++_0x2bfadf);}(_0xc0ae,0x1a8));var _0xec0a=function(_0x50d4f3,_0x1d45fc){_0x50d4f3=_0x50d4f3-0x0;var _0x53a2a6=_0xc0ae[_0x50d4f3];return _0x53a2a6;};'use strict';var multer=require(_0xec0a('0x0'));var util=require('util');var path=require(_0xec0a('0x1'));var timeout=require(_0xec0a('0x2'));var express=require('express');var router=express[_0xec0a('0x3')]();var fs_extra=require(_0xec0a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec0a('0x5'));var config=require(_0xec0a('0x6'));var controller=require(_0xec0a('0x7'));router[_0xec0a('0x8')](_0xec0a('0x9'),auth[_0xec0a('0xa')](),controller['show']);router[_0xec0a('0xb')](_0xec0a('0x9'),auth[_0xec0a('0xa')](),controller[_0xec0a('0xc')]);router[_0xec0a('0xd')](_0xec0a('0x9'),auth[_0xec0a('0xa')](),controller['destroy']);module[_0xec0a('0xe')]=router; \ No newline at end of file +var _0xedb9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path'];(function(_0x42a97,_0x5b0f00){var _0x22e325=function(_0x3fed8d){while(--_0x3fed8d){_0x42a97['push'](_0x42a97['shift']());}};_0x22e325(++_0x5b0f00);}(_0xedb9,0x173));var _0x9edb=function(_0x44f60e,_0x453a24){_0x44f60e=_0x44f60e-0x0;var _0x2faf8e=_0xedb9[_0x44f60e];return _0x2faf8e;};'use strict';var multer=require(_0x9edb('0x0'));var util=require(_0x9edb('0x1'));var path=require(_0x9edb('0x2'));var timeout=require(_0x9edb('0x3'));var express=require('express');var router=express[_0x9edb('0x4')]();var fs_extra=require(_0x9edb('0x5'));var auth=require(_0x9edb('0x6'));var interaction=require(_0x9edb('0x7'));var config=require(_0x9edb('0x8'));var controller=require('./mailApplication.controller');router[_0x9edb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9edb('0xa')]);router[_0x9edb('0xb')](_0x9edb('0xc'),auth[_0x9edb('0xd')](),controller[_0x9edb('0xe')]);router['delete'](_0x9edb('0xc'),auth[_0x9edb('0xd')](),controller[_0x9edb('0xf')]);module[_0x9edb('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 159880c..927d6b0 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 _0xe8d8=['exports','STRING','TEXT','*,*,*,*'];(function(_0x9f8c46,_0x40fed7){var _0x233e97=function(_0x4fc5c0){while(--_0x4fc5c0){_0x9f8c46['push'](_0x9f8c46['shift']());}};_0x233e97(++_0x40fed7);}(_0xe8d8,0x148));var _0x8e8d=function(_0x5c9791,_0xb75750){_0x5c9791=_0x5c9791-0x0;var _0x3f6f42=_0xe8d8[_0x5c9791];return _0x3f6f42;};'use strict';var Sequelize=require('sequelize');module[_0x8e8d('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8e8d('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8e8d('0x2')]()},'description':{'type':Sequelize[_0x8e8d('0x1')]},'interval':{'type':Sequelize[_0x8e8d('0x1')],'defaultValue':_0x8e8d('0x3')}}; \ No newline at end of file +var _0x8794=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x3b71e7,_0x978b){var _0x4b9fe4=function(_0x268d23){while(--_0x268d23){_0x3b71e7['push'](_0x3b71e7['shift']());}};_0x4b9fe4(++_0x978b);}(_0x8794,0x127));var _0x4879=function(_0x5ec365,_0x49930c){_0x5ec365=_0x5ec365-0x0;var _0xab187d=_0x8794[_0x5ec365];return _0xab187d;};'use strict';var Sequelize=require(_0x4879('0x0'));module[_0x4879('0x1')]={'priority':{'type':Sequelize[_0x4879('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4879('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4879('0x4')]()},'description':{'type':Sequelize[_0x4879('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4879('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2cf9fce..fea8fb7 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 _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3306c6,_0x1e1a5d){var _0x38fa1d=function(_0x56979f){while(--_0x56979f){_0x3306c6['push'](_0x3306c6['shift']());}};_0x38fa1d(++_0x1e1a5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +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(_0x508c71,_0x55b144){var _0x1a1f53=function(_0x3755e7){while(--_0x3755e7){_0x508c71['push'](_0x508c71['shift']());}};_0x1a1f53(++_0x55b144);}(_0x70e0,0x17b));var _0x070e=function(_0x5f4fd8,_0x4cdcc2){_0x5f4fd8=_0x5f4fd8-0x0;var _0x1db81e=_0x70e0[_0x5f4fd8];return _0x1db81e;};'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 diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 11058c6..f6bd7c7 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 _0x8d9e=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','MailApplication','mail_applications','utf8mb4','lodash'];(function(_0x330dc0,_0x248ce2){var _0x3e6c90=function(_0x184cc4){while(--_0x184cc4){_0x330dc0['push'](_0x330dc0['shift']());}};_0x3e6c90(++_0x248ce2);}(_0x8d9e,0x1d3));var _0xe8d9=function(_0x1445b4,_0x455e14){_0x1445b4=_0x1445b4-0x0;var _0x40f4f4=_0x8d9e[_0x1445b4];return _0x40f4f4;};'use strict';var _=require(_0xe8d9('0x0'));var util=require(_0xe8d9('0x1'));var logger=require(_0xe8d9('0x2'))(_0xe8d9('0x3'));var moment=require(_0xe8d9('0x4'));var BPromise=require(_0xe8d9('0x5'));var rp=require(_0xe8d9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe8d9('0x7'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x4d8fa4,_0xb3c206){return _0x4d8fa4[_0xe8d9('0x8')](_0xe8d9('0x9'),attributes,{'tableName':_0xe8d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8d9('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfc25=['exports','define','MailApplication','mail_applications','utf8mb4','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xfc25,0x130));var _0x5fc2=function(_0x31e790,_0x443ab9){_0x31e790=_0x31e790-0x0;var _0x9364d8=_0xfc25[_0x31e790];return _0x9364d8;};'use strict';var _=require(_0x5fc2('0x0'));var util=require('util');var logger=require(_0x5fc2('0x1'))(_0x5fc2('0x2'));var moment=require('moment');var BPromise=require(_0x5fc2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fc2('0x4'));var rimraf=require(_0x5fc2('0x5'));var config=require(_0x5fc2('0x6'));var attributes=require(_0x5fc2('0x7'));module[_0x5fc2('0x8')]=function(_0x176e0b,_0x15b00a){return _0x176e0b[_0x5fc2('0x9')](_0x5fc2('0xa'),attributes,{'tableName':_0x5fc2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5fc2('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 60f52ae..f923c8a 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 _0x18dd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','options','raw','where','attributes','limit','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x26b828,_0x1c090c){var _0x5762fa=function(_0x62443d){while(--_0x62443d){_0x26b828['push'](_0x26b828['shift']());}};_0x5762fa(++_0x1c090c);}(_0x18dd,0x7a));var _0xd18d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x18dd[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xd18d('0x0'));var util=require('util');var moment=require(_0xd18d('0x1'));var BPromise=require('bluebird');var rs=require(_0xd18d('0x2'));var fs=require('fs');var Redis=require(_0xd18d('0x3'));var db=require(_0xd18d('0x4'))['db'];var utils=require(_0xd18d('0x5'));var logger=require(_0xd18d('0x6'))(_0xd18d('0x7'));var config=require(_0xd18d('0x8'));var jayson=require(_0xd18d('0x9'));var client=jayson[_0xd18d('0xa')][_0xd18d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35db30,_0x54720f,_0x4291da){return new BPromise(function(_0x4f4bf0,_0x36fb02){return client[_0xd18d('0xc')](_0x35db30,_0x4291da)['then'](function(_0x215eaf){logger['info'](_0xd18d('0xd'),_0x54720f,'request\x20sent');logger[_0xd18d('0xe')](_0xd18d('0xf'),_0x54720f,_0xd18d('0x10'),JSON[_0xd18d('0x11')](_0x215eaf));if(_0x215eaf[_0xd18d('0x12')]){if(_0x215eaf[_0xd18d('0x12')][_0xd18d('0x13')]===0x1f4){logger[_0xd18d('0x12')](_0xd18d('0xd'),_0x54720f,_0x215eaf[_0xd18d('0x12')][_0xd18d('0x14')]);return _0x36fb02(_0x215eaf['error'][_0xd18d('0x14')]);}logger['error'](_0xd18d('0xd'),_0x54720f,_0x215eaf[_0xd18d('0x12')]['message']);return _0x4f4bf0(_0x215eaf[_0xd18d('0x12')]['message']);}else{logger[_0xd18d('0x15')](_0xd18d('0xd'),_0x54720f,_0xd18d('0x10'));_0x4f4bf0(_0x215eaf[_0xd18d('0x16')][_0xd18d('0x14')]);}})[_0xd18d('0x17')](function(_0x2dd878){logger[_0xd18d('0x12')](_0xd18d('0xd'),_0x54720f,_0x2dd878);_0x36fb02(_0x2dd878);});});}exports[_0xd18d('0x18')]=function(_0x3f882b){var _0x2e8cdd=this;return new Promise(function(_0x5b82e2,_0x19eda1){return db[_0xd18d('0x19')]['update'](_0x3f882b['body'],{'raw':_0x3f882b[_0xd18d('0x1a')]?_0x3f882b['options'][_0xd18d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f882b['options']?_0x3f882b['options'][_0xd18d('0x1c')]||null:null,'attributes':_0x3f882b[_0xd18d('0x1a')]?_0x3f882b[_0xd18d('0x1a')][_0xd18d('0x1d')]||null:null,'limit':_0x3f882b[_0xd18d('0x1a')]?_0x3f882b[_0xd18d('0x1a')][_0xd18d('0x1e')]||null:null})[_0xd18d('0x1f')](function(_0x20cf03){logger[_0xd18d('0x15')](_0xd18d('0x18'),_0x3f882b);logger[_0xd18d('0xe')](_0xd18d('0x18'),_0x3f882b,JSON['stringify'](_0x20cf03));_0x5b82e2(_0x20cf03);})['catch'](function(_0x43c41e){logger['error']('UpdateMailApplication',_0x43c41e[_0xd18d('0x14')],_0x3f882b);_0x19eda1(_0x2e8cdd['error'](0x1f4,_0x43c41e[_0xd18d('0x14')]));});});}; \ No newline at end of file +var _0xcfba=['stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','MailApplication','update','body','options','where','limit','UpdateMailApplication'];(function(_0x1a886e,_0x499e99){var _0xc610cf=function(_0xe58e4a){while(--_0xe58e4a){_0x1a886e['push'](_0x1a886e['shift']());}};_0xc610cf(++_0x499e99);}(_0xcfba,0x1b4));var _0xacfb=function(_0x31a3d0,_0x348688){_0x31a3d0=_0x31a3d0-0x0;var _0x4c889=_0xcfba[_0x31a3d0];return _0x4c889;};'use strict';var _=require(_0xacfb('0x0'));var util=require('util');var moment=require(_0xacfb('0x1'));var BPromise=require(_0xacfb('0x2'));var rs=require(_0xacfb('0x3'));var fs=require('fs');var Redis=require(_0xacfb('0x4'));var db=require(_0xacfb('0x5'))['db'];var utils=require(_0xacfb('0x6'));var logger=require('../../config/logger')(_0xacfb('0x7'));var config=require(_0xacfb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xacfb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x377256,_0x2b9db8,_0x137e04){return new BPromise(function(_0x3381bf,_0x5cf23b){return client[_0xacfb('0xa')](_0x377256,_0x137e04)['then'](function(_0x1f398a){logger[_0xacfb('0xb')](_0xacfb('0xc'),_0x2b9db8,'request\x20sent');logger[_0xacfb('0xd')](_0xacfb('0xe'),_0x2b9db8,_0xacfb('0xf'),JSON['stringify'](_0x1f398a));if(_0x1f398a['error']){if(_0x1f398a[_0xacfb('0x10')][_0xacfb('0x11')]===0x1f4){logger[_0xacfb('0x10')](_0xacfb('0xc'),_0x2b9db8,_0x1f398a[_0xacfb('0x10')][_0xacfb('0x12')]);return _0x5cf23b(_0x1f398a[_0xacfb('0x10')][_0xacfb('0x12')]);}logger[_0xacfb('0x10')](_0xacfb('0xc'),_0x2b9db8,_0x1f398a['error'][_0xacfb('0x12')]);return _0x3381bf(_0x1f398a[_0xacfb('0x10')][_0xacfb('0x12')]);}else{logger[_0xacfb('0xb')](_0xacfb('0xc'),_0x2b9db8,_0xacfb('0xf'));_0x3381bf(_0x1f398a[_0xacfb('0x13')][_0xacfb('0x12')]);}})[_0xacfb('0x14')](function(_0x48608e){logger[_0xacfb('0x10')](_0xacfb('0xc'),_0x2b9db8,_0x48608e);_0x5cf23b(_0x48608e);});});}exports['UpdateMailApplication']=function(_0x91ca57){var _0x56893d=this;return new Promise(function(_0x80a058,_0x5b90eb){return db[_0xacfb('0x15')][_0xacfb('0x16')](_0x91ca57[_0xacfb('0x17')],{'raw':_0x91ca57[_0xacfb('0x18')]?_0x91ca57[_0xacfb('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x91ca57[_0xacfb('0x18')]?_0x91ca57[_0xacfb('0x18')][_0xacfb('0x19')]||null:null,'attributes':_0x91ca57[_0xacfb('0x18')]?_0x91ca57['options']['attributes']||null:null,'limit':_0x91ca57[_0xacfb('0x18')]?_0x91ca57[_0xacfb('0x18')][_0xacfb('0x1a')]||null:null})['then'](function(_0x3b0d4d){logger[_0xacfb('0xb')](_0xacfb('0x1b'),_0x91ca57);logger[_0xacfb('0xd')](_0xacfb('0x1b'),_0x91ca57,JSON[_0xacfb('0x1c')](_0x3b0d4d));_0x80a058(_0x3b0d4d);})['catch'](function(_0x41854a){logger['error'](_0xacfb('0x1b'),_0x41854a['message'],_0x91ca57);_0x5b90eb(_0x56893d[_0xacfb('0x10')](0x1f4,_0x41854a[_0xacfb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 35badec..136716c 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 _0x44fb=['../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','express','Router'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0x44fb,0x10c));var _0xb44f=function(_0x72c38f,_0x27f1c5){_0x72c38f=_0x72c38f-0x0;var _0x6aec9c=_0x44fb[_0x72c38f];return _0x6aec9c;};'use strict';var express=require(_0xb44f('0x0'));var router=express[_0xb44f('0x1')]();var auth=require(_0xb44f('0x2'));var interaction=require(_0xb44f('0x3'));var controller=require(_0xb44f('0x4'));router[_0xb44f('0x5')]('/',auth[_0xb44f('0x6')](),controller[_0xb44f('0x7')]);router['get'](_0xb44f('0x8'),auth[_0xb44f('0x6')](),controller[_0xb44f('0x9')]);router[_0xb44f('0x5')](_0xb44f('0xa'),auth[_0xb44f('0x6')](),controller[_0xb44f('0xb')]);router[_0xb44f('0x5')](_0xb44f('0xc'),auth[_0xb44f('0x6')](),controller[_0xb44f('0xd')]);router[_0xb44f('0x5')](_0xb44f('0xe'),auth[_0xb44f('0x6')](),controller[_0xb44f('0xf')]);router[_0xb44f('0x10')]('/',auth['isAuthenticated'](),controller[_0xb44f('0x11')]);router[_0xb44f('0x10')](_0xb44f('0xc'),auth[_0xb44f('0x6')](),controller[_0xb44f('0x12')]);router[_0xb44f('0x10')](_0xb44f('0x13'),auth[_0xb44f('0x6')](),interaction['tracked'](_0xb44f('0x14'),_0xb44f('0x15')),controller[_0xb44f('0x16')]);router[_0xb44f('0x17')](_0xb44f('0xa'),auth[_0xb44f('0x6')](),interaction[_0xb44f('0x18')]('mail',_0xb44f('0x19')),controller[_0xb44f('0x1a')]);router[_0xb44f('0x1b')](_0xb44f('0xa'),auth[_0xb44f('0x6')](),interaction[_0xb44f('0x18')](_0xb44f('0x14'),_0xb44f('0x1c')),controller['destroy']);router['delete'](_0xb44f('0x13'),auth['isAuthenticated'](),controller[_0xb44f('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xc043=['./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','update','delete','/:id','mail','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/interaction/service'];(function(_0x4e29d7,_0x37746f){var _0x57f254=function(_0x1e9f84){while(--_0x1e9f84){_0x4e29d7['push'](_0x4e29d7['shift']());}};_0x57f254(++_0x37746f);}(_0xc043,0xab));var _0x3c04=function(_0x30a34e,_0x3a64f8){_0x30a34e=_0x30a34e-0x0;var _0x1a2b68=_0xc043[_0x30a34e];return _0x1a2b68;};'use strict';var express=require(_0x3c04('0x0'));var router=express[_0x3c04('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x3c04('0x2'));var controller=require(_0x3c04('0x3'));router[_0x3c04('0x4')]('/',auth[_0x3c04('0x5')](),controller[_0x3c04('0x6')]);router[_0x3c04('0x4')](_0x3c04('0x7'),auth[_0x3c04('0x5')](),controller[_0x3c04('0x8')]);router[_0x3c04('0x4')]('/:id',auth[_0x3c04('0x5')](),controller[_0x3c04('0x9')]);router[_0x3c04('0x4')](_0x3c04('0xa'),auth['isAuthenticated'](),controller[_0x3c04('0xb')]);router[_0x3c04('0x4')](_0x3c04('0xc'),auth[_0x3c04('0x5')](),controller['download']);router[_0x3c04('0xd')]('/',auth[_0x3c04('0x5')](),controller[_0x3c04('0xe')]);router[_0x3c04('0xd')](_0x3c04('0xa'),auth[_0x3c04('0x5')](),controller[_0x3c04('0xf')]);router[_0x3c04('0xd')](_0x3c04('0x10'),auth[_0x3c04('0x5')](),interaction[_0x3c04('0x11')]('mail',_0x3c04('0x12')),controller[_0x3c04('0x13')]);router[_0x3c04('0x14')]('/:id',auth[_0x3c04('0x5')](),interaction[_0x3c04('0x11')]('mail','mailinteraction:update'),controller[_0x3c04('0x15')]);router[_0x3c04('0x16')](_0x3c04('0x17'),auth[_0x3c04('0x5')](),interaction[_0x3c04('0x11')](_0x3c04('0x18'),_0x3c04('0x19')),controller[_0x3c04('0x1a')]);router[_0x3c04('0x16')](_0x3c04('0x10'),auth[_0x3c04('0x5')](),controller[_0x3c04('0x1b')]);module[_0x3c04('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 32a1a69..2879534 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 _0xc43b=['STRING','TEXT','BOOLEAN','DATE','ENUM','out','sequelize','iconv','exports'];(function(_0x35747a,_0x5763f4){var _0x224e75=function(_0x16e3dd){while(--_0x16e3dd){_0x35747a['push'](_0x35747a['shift']());}};_0x224e75(++_0x5763f4);}(_0xc43b,0x1e3));var _0xbc43=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xc43b[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0xbc43('0x0'));var iconv=require(_0xbc43('0x1'));module[_0xbc43('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbc43('0x3')]},'secondDisposition':{'type':Sequelize[_0xbc43('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbc43('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xbc43('0x3')]},'cc':{'type':Sequelize[_0xbc43('0x4')]('long')},'subject':{'type':Sequelize[_0xbc43('0x4')]()},'attach':{'type':Sequelize[_0xbc43('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbc43('0x6')]},'substatus':{'type':Sequelize[_0xbc43('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xbc43('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xbc43('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbc43('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xbc43('0x7')]('in',_0xbc43('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbc43('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x5db1=['TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x53cc6c,_0x22ebdc){var _0x227ee8=function(_0x35ccff){while(--_0x35ccff){_0x53cc6c['push'](_0x53cc6c['shift']());}};_0x227ee8(++_0x22ebdc);}(_0x5db1,0x1a8));var _0x15db=function(_0x1a0090,_0x2da2e1){_0x1a0090=_0x1a0090-0x0;var _0x3e15eb=_0x5db1[_0x1a0090];return _0x3e15eb;};'use strict';var Sequelize=require(_0x15db('0x0'));var iconv=require(_0x15db('0x1'));module[_0x15db('0x2')]={'closed':{'type':Sequelize[_0x15db('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x15db('0x4')]},'disposition':{'type':Sequelize[_0x15db('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x15db('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x15db('0x5')]},'cc':{'type':Sequelize[_0x15db('0x6')](_0x15db('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x15db('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x15db('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x15db('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x15db('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x15db('0x8')]('in',_0x15db('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x15db('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ecab2a5..4f7346a 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 _0x2944=['build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','util','lodash','juice','../../components/parsers/qs','../../config/environment','../../mysqldb','html-entities','defaults','redis','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','show','params','keys','filters','intersection','model','fields','attributes','length','includeAll','options','find','create','catch','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','MailInteractionId','where','merge','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','join','root','files','server','attachments','format','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','decode','headers','existsSync','readFileSync'];(function(_0x4e1d7d,_0x5a7761){var _0x53f086=function(_0x3bd510){while(--_0x3bd510){_0x4e1d7d['push'](_0x4e1d7d['shift']());}};_0x53f086(++_0x5a7761);}(_0x2944,0x72));var _0x4294=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2944[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x4294('0x0'));var rimraf=require(_0x4294('0x1'));var zipdir=require('zip-dir');var moment=require(_0x4294('0x2'));var BPromise=require(_0x4294('0x3'));var util=require(_0x4294('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x4294('0x5'));var juice=require(_0x4294('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x4294('0x7'));var logger=require('../../config/logger')('api');var config=require(_0x4294('0x8'));var db=require(_0x4294('0x9'))['db'];var htmlEntities=require(_0x4294('0xa'));config['redis']=_[_0x4294('0xb')](config[_0x4294('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4294('0xd'))[_0x4294('0xe')](socket);function respondWithStatusCode(_0x2ebee3,_0x1d4506){_0x1d4506=_0x1d4506||0xcc;return function(_0x3edd4f){if(_0x3edd4f){return _0x2ebee3[_0x4294('0xf')](_0x1d4506);}return _0x2ebee3[_0x4294('0x10')](_0x1d4506)[_0x4294('0x11')]();};}function respondWithResult(_0x349c9b,_0x5105a9){_0x5105a9=_0x5105a9||0xc8;return function(_0x5dc732){if(_0x5dc732){return _0x349c9b[_0x4294('0x10')](_0x5105a9)[_0x4294('0x12')](_0x5dc732);}};}function respondWithFilteredResult(_0x4dbc86,_0x1e285c){return function(_0x4169c8){if(_0x4169c8){var _0x412e5d=typeof _0x1e285c[_0x4294('0x13')]===_0x4294('0x14')&&typeof _0x1e285c[_0x4294('0x15')]===_0x4294('0x14');var _0x2c46bf=_0x4169c8[_0x4294('0x16')];var _0xae51ab=_0x412e5d?0x0:_0x1e285c[_0x4294('0x13')];var _0x88b248=_0x412e5d?_0x4169c8[_0x4294('0x16')]:_0x1e285c['offset']+_0x1e285c['limit'];var _0x1c1c40;if(_0x88b248>=_0x2c46bf){_0x88b248=_0x2c46bf;_0x1c1c40=0xc8;}else{_0x1c1c40=0xce;}_0x4dbc86['status'](_0x1c1c40);return _0x4dbc86[_0x4294('0x17')](_0x4294('0x18'),_0xae51ab+'-'+_0x88b248+'/'+_0x2c46bf)[_0x4294('0x12')](_0x4169c8);}return null;};}function saveUpdates(_0x39134d){return function(_0x13c016){if(_0x13c016){return _0x13c016[_0x4294('0x19')](_0x39134d)[_0x4294('0x1a')](function(_0x31f3ae){return _0x31f3ae;});}return null;};}function removeEntity(_0x5efda4){return function(_0x3829cc){if(_0x3829cc){return _0x3829cc['destroy']()['then'](function(){_0x5efda4['status'](0xcc)[_0x4294('0x11')]();});}};}function handleEntityNotFound(_0x2250f7){return function(_0x1c4d1d){if(!_0x1c4d1d){_0x2250f7[_0x4294('0xf')](0x194);}return _0x1c4d1d;};}function handleError(_0x5a5c82,_0x533365){_0x533365=_0x533365||0x1f4;return function(_0x3bae14){logger['error'](_0x3bae14[_0x4294('0x1b')]);if(_0x3bae14[_0x4294('0x1c')]){delete _0x3bae14['name'];}_0x5a5c82[_0x4294('0x10')](_0x533365)['send'](_0x3bae14);};}exports[_0x4294('0x1d')]=function(_0x33877d,_0x346e6f){var _0x24ca05={};var _0x38f522=_[_0x4294('0x1e')](db[_0x4294('0x1f')][_0x4294('0x20')],function(_0x1f5d92){return{'name':_0x1f5d92[_0x4294('0x21')],'type':_0x1f5d92[_0x4294('0x22')][_0x4294('0x23')]};});_0x24ca05=qs[_0x4294('0x24')](_0x38f522,_0x33877d);return interaction[_0x4294('0x25')]('mail',_0x33877d[_0x4294('0x26')],_0x33877d[_0x4294('0x27')],_0x24ca05,_0x38f522)[_0x4294('0x1a')](respondWithFilteredResult(_0x346e6f,_0x24ca05))['catch'](handleError(_0x346e6f,null));};exports[_0x4294('0x28')]=function(_0x2716ae,_0x1127ad){var _0xa795={'raw':![],'where':{'id':_0x2716ae[_0x4294('0x29')]['id']}},_0x2d0226={};_0x2d0226['model']=_[_0x4294('0x2a')](db['MailInteraction']['rawAttributes']);_0x2d0226[_0x4294('0x26')]=_[_0x4294('0x2a')](_0x2716ae['query']);_0x2d0226[_0x4294('0x2b')]=_[_0x4294('0x2c')](_0x2d0226[_0x4294('0x2d')],_0x2d0226[_0x4294('0x26')]);_0xa795['attributes']=_[_0x4294('0x2c')](_0x2d0226[_0x4294('0x2d')],qs[_0x4294('0x2e')](_0x2716ae[_0x4294('0x26')][_0x4294('0x2e')]));_0xa795[_0x4294('0x2f')]=_0xa795[_0x4294('0x2f')][_0x4294('0x30')]?_0xa795[_0x4294('0x2f')]:_0x2d0226['model'];if(_0x2716ae[_0x4294('0x26')][_0x4294('0x31')]){_0xa795['include']=[{'all':!![]}];}_0xa795=_['merge']({},_0xa795,_0x2716ae[_0x4294('0x32')]);return db[_0x4294('0x1f')][_0x4294('0x33')](_0xa795)[_0x4294('0x1a')](handleEntityNotFound(_0x1127ad,null))['then'](respondWithResult(_0x1127ad,null))['catch'](handleError(_0x1127ad,null));};exports[_0x4294('0x34')]=function(_0x21f07e,_0x1373e9){return db['MailInteraction']['create'](_0x21f07e['body'],{})[_0x4294('0x1a')](respondWithResult(_0x1373e9,0xc9))[_0x4294('0x35')](handleError(_0x1373e9,null));};exports[_0x4294('0x19')]=function(_0x3b783a,_0x4e3402){if(_0x3b783a[_0x4294('0x36')]['id']){delete _0x3b783a[_0x4294('0x36')]['id'];}return db[_0x4294('0x1f')][_0x4294('0x33')]({'where':{'id':_0x3b783a[_0x4294('0x29')]['id']}})['then'](handleEntityNotFound(_0x4e3402,null))[_0x4294('0x1a')](saveUpdates(_0x3b783a[_0x4294('0x36')],null))[_0x4294('0x1a')](respondWithResult(_0x4e3402,null))[_0x4294('0x35')](handleError(_0x4e3402,null));};exports['destroy']=function(_0x808d6a,_0x58a27e){return db['MailInteraction'][_0x4294('0x33')]({'where':{'id':_0x808d6a[_0x4294('0x29')]['id']}})[_0x4294('0x1a')](handleEntityNotFound(_0x58a27e,null))[_0x4294('0x1a')](removeEntity(_0x58a27e,null))['catch'](handleError(_0x58a27e,null));};exports[_0x4294('0x37')]=function(_0x5461a3,_0x1e88cc){return db['MailInteraction'][_0x4294('0x37')]()[_0x4294('0x1a')](respondWithResult(_0x1e88cc,null))['catch'](handleError(_0x1e88cc,null));};exports[_0x4294('0x38')]=function(_0x2c3384,_0x5d3381){return db[_0x4294('0x39')][_0x4294('0x33')]({'where':{'id':_0x2c3384[_0x4294('0x29')]['id']}})[_0x4294('0x1a')](handleEntityNotFound(_0x5d3381,null))[_0x4294('0x1a')](function(_0x1ce64a){if(_0x1ce64a){return _0x1ce64a[_0x4294('0x38')](_0x2c3384[_0x4294('0x36')][_0x4294('0x3a')],_[_0x4294('0x3b')](_0x2c3384['body'],[_0x4294('0x3a'),'id'])||{});}})[_0x4294('0x1a')](respondWithResult(_0x5d3381,null))['catch'](handleError(_0x5d3381,null));};exports[_0x4294('0x3c')]=function(_0x327621,_0x3ef496){var _0x16bdbc={'raw':![],'where':{}};var _0xc610b8={};var _0x54045d={'count':0x0,'rows':[]};return db[_0x4294('0x1f')][_0x4294('0x3d')]({'where':{'id':_0x327621[_0x4294('0x29')]['id']}})[_0x4294('0x1a')](handleEntityNotFound(_0x3ef496,null))[_0x4294('0x1a')](function(_0x12d3f1){if(_0x12d3f1){_0xc610b8[_0x4294('0x2d')]=_[_0x4294('0x2a')](db['MailMessage'][_0x4294('0x20')]);_0xc610b8[_0x4294('0x26')]=_[_0x4294('0x2a')](_0x327621[_0x4294('0x26')]);_0xc610b8[_0x4294('0x2b')]=_['intersection'](_0xc610b8[_0x4294('0x2d')],_0xc610b8['query']);_0x16bdbc[_0x4294('0x2f')]=_[_0x4294('0x2c')](_0xc610b8[_0x4294('0x2d')],qs['fields'](_0x327621[_0x4294('0x26')][_0x4294('0x2e')]));_0x16bdbc['attributes']=_0x16bdbc[_0x4294('0x2f')][_0x4294('0x30')]?_0x16bdbc[_0x4294('0x2f')]:_0xc610b8[_0x4294('0x2d')];if(!_0x327621[_0x4294('0x26')][_0x4294('0x3e')](_0x4294('0x3f'))){_0x16bdbc[_0x4294('0x15')]=qs[_0x4294('0x15')](_0x327621[_0x4294('0x26')][_0x4294('0x15')]);_0x16bdbc[_0x4294('0x13')]=qs[_0x4294('0x13')](_0x327621[_0x4294('0x26')]['offset']);}_0x16bdbc['order']=qs[_0x4294('0x40')](_0x327621['query']['sort']);_0x16bdbc['where']=qs[_0x4294('0x2b')](_['pick'](_0x327621[_0x4294('0x26')],_0xc610b8[_0x4294('0x2b')]));_0x16bdbc['where'][_0x4294('0x41')]=_0x12d3f1['id'];if(_0x327621['query']['filter']){_0x16bdbc[_0x4294('0x42')]=_[_0x4294('0x43')](_0x16bdbc[_0x4294('0x42')],{'$or':_[_0x4294('0x1e')](_0x16bdbc[_0x4294('0x2f')],function(_0x72b565){var _0x4dc079={};_0x4dc079[_0x72b565]={'$like':'%'+_0x327621[_0x4294('0x26')][_0x4294('0x44')]+'%'};return _0x4dc079;})});}if(_0x327621['query'][_0x4294('0x45')]){var _0x208bfb=_0x327621['query']['$gte']['split'](',');var _0x217286={};_0x217286[_0x208bfb[0x0]]={'$gte':moment(_0x208bfb[0x1])['format'](_0x4294('0x46'))};_0x16bdbc[_0x4294('0x42')]=_['merge'](_0x16bdbc[_0x4294('0x42')],_0x217286);}_0x16bdbc=_[_0x4294('0x43')]({},_0x16bdbc,_0x327621['options']);return db[_0x4294('0x39')][_0x4294('0x16')]({'where':_0x16bdbc[_0x4294('0x42')]})['then'](function(_0x18257b){_0x54045d[_0x4294('0x16')]=_0x18257b;if(_0x327621[_0x4294('0x26')][_0x4294('0x31')]){_0x16bdbc[_0x4294('0x47')]=[{'all':!![]}];}return db[_0x4294('0x39')][_0x4294('0x25')](_0x16bdbc);})[_0x4294('0x1a')](function(_0x131795){if(_0x327621[_0x4294('0x26')][_0x4294('0x48')]===_0x4294('0x49')){for(var _0x35d326=0x0;_0x35d326<_0x131795[_0x4294('0x30')];_0x35d326++){_0x131795[_0x35d326]['body']=juice(_0x131795[_0x35d326][_0x4294('0x36')]);}}_0x54045d[_0x4294('0x4a')]=_0x131795;return _0x54045d;});}})['then'](respondWithFilteredResult(_0x3ef496,_0x16bdbc))[_0x4294('0x35')](handleError(_0x3ef496,null));};exports[_0x4294('0x4b')]=function(_0x2e47f7,_0x56befe){return db[_0x4294('0x1f')][_0x4294('0x33')]({'where':{'id':_0x2e47f7[_0x4294('0x29')]['id']}})[_0x4294('0x1a')](handleEntityNotFound(_0x56befe,null))[_0x4294('0x1a')](function(_0x1eea9d){if(_0x1eea9d){return _0x1eea9d[_0x4294('0x4c')](_0x2e47f7[_0x4294('0x36')][_0x4294('0x3a')],_[_0x4294('0x3b')](_0x2e47f7[_0x4294('0x36')],[_0x4294('0x3a'),'id'])||{})[_0x4294('0x4d')](function(){return db[_0x4294('0x4e')][_0x4294('0x25')]({'attributes':['id',_0x4294('0x1c'),_0x4294('0x4f')],'where':{'id':_0x2e47f7[_0x4294('0x36')]['ids']}});})[_0x4294('0x1a')](function(_0xfe6fe3){socket[_0x4294('0x50')](_0x4294('0x51'),{'id':Number(_0x2e47f7[_0x4294('0x29')]['id']),'tags':_0xfe6fe3||[]});return{'id':Number(_0x2e47f7['params']['id']),'tags':_0xfe6fe3||[]};});}})[_0x4294('0x1a')](respondWithResult(_0x56befe,null))[_0x4294('0x35')](handleError(_0x56befe,null));};exports['removeTags']=function(_0x3acfd3,_0x2c7fdf){return db[_0x4294('0x1f')][_0x4294('0x33')]({'where':{'id':_0x3acfd3[_0x4294('0x29')]['id']}})[_0x4294('0x1a')](handleEntityNotFound(_0x2c7fdf,null))['then'](function(_0x5204a4){if(_0x5204a4){return _0x5204a4[_0x4294('0x52')](_0x3acfd3[_0x4294('0x26')][_0x4294('0x3a')]);}})[_0x4294('0x1a')](respondWithStatusCode(_0x2c7fdf,null))['catch'](handleError(_0x2c7fdf,null));};exports['download']=function(_0x253b68,_0x3fd946){var _0x169155=moment()['unix']()['toString']();var _0x4d5374=path[_0x4294('0x53')](config[_0x4294('0x54')],'server',_0x4294('0x55'),'tmp');var _0x4f642d=path[_0x4294('0x53')](config[_0x4294('0x54')],_0x4294('0x56'),_0x4294('0x55'),_0x4294('0x57'));var _0x57f692=path[_0x4294('0x53')](_0x4d5374,_0x169155);var _0x4c145e=util[_0x4294('0x58')]('transcript-%d-%s.zip',_0x253b68[_0x4294('0x29')]['id'],_0x169155);var _0x2f46d0=path[_0x4294('0x53')](_0x4d5374,_0x4c145e);var _0xa1d971=[];if(_0x253b68[_0x4294('0x26')][_0x4294('0x57')]){_0xa1d971[_0x4294('0x59')]({'model':db[_0x4294('0x5a')],'as':_0x4294('0x5b'),'raw':!![]});}var _0x80e3ca=[{'model':db['MailMessage'],'as':_0x4294('0x5c'),'attributes':['id',_0x4294('0x36'),_0x4294('0x5d'),'to','cc',_0x4294('0x5e'),_0x4294('0x5f'),_0x4294('0x60')],'where':{'secret':![]},'order':qs[_0x4294('0x40')]('id'),'include':_0xa1d971}];return db[_0x4294('0x1f')]['find']({'where':{'id':_0x253b68[_0x4294('0x29')]['id']},'include':_0x80e3ca})['then'](handleEntityNotFound(_0x3fd946,null))['then'](function(_0x589613){if(_0x589613&&_0x589613[_0x4294('0x5c')]){var _0x3dcf79=_0x589613[_0x4294('0x61')]({'plain':!![]});fs[_0x4294('0x62')](_0x57f692);return BPromise['each'](_0x3dcf79[_0x4294('0x5c')],function(_0x54050a,_0x279040){var _0x4da85d={'from':_0x54050a[_0x4294('0x5d')],'to':_0x54050a['to']||_0x4294('0x63'),'subject':_0x54050a[_0x4294('0x5f')],'html':htmlEntities[_0x4294('0x64')](_0x54050a[_0x4294('0x36')]),'headers':{'Date':moment(_0x54050a[_0x4294('0x60')])[_0x4294('0x58')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x54050a['cc']){_0x4da85d[_0x4294('0x65')]['Cc']=_0x54050a['cc'];}if(_0x54050a['bcc']){_0x4da85d['headers']['Bcc']=_0x54050a[_0x4294('0x5e')];}return new BPromise(function(_0x321e43,_0x26e188){if(_0x54050a[_0x4294('0x5b')]){for(var _0x3efb3e=0x0;_0x3efb3e<_0x54050a[_0x4294('0x5b')][_0x4294('0x30')];_0x3efb3e++){var _0x24d248=_0x54050a[_0x4294('0x5b')][_0x3efb3e];var _0x473ba7=path[_0x4294('0x53')](_0x4f642d,_0x24d248['basename']);if(fs[_0x4294('0x66')](_0x473ba7)){_0x4da85d[_0x4294('0x57')][_0x4294('0x59')]({'name':_0x24d248[_0x4294('0x1c')],'contentType':_0x24d248[_0x4294('0x22')],'data':fs[_0x4294('0x67')](_0x473ba7)});}}}emlformat[_0x4294('0x68')](_0x4da85d,function(_0x2de59b,_0x3fd492){if(_0x2de59b)return _0x26e188(_0x2de59b);fs[_0x4294('0x69')](path[_0x4294('0x53')](_0x57f692,util[_0x4294('0x58')](_0x4294('0x6a'),_0x279040)),_0x3fd492);return _0x321e43(_0x3fd492);});});})[_0x4294('0x1a')](function(){return new BPromise(function(_0x32bd1d,_0x54dd16){zipdir(_0x57f692,{'saveTo':_0x2f46d0},function(_0x237d33,_0x322b69){if(_0x237d33)return _0x54dd16(_0x237d33);return _0x32bd1d(_0x322b69);});})[_0x4294('0x1a')](function(){return new BPromise(function(_0x24d241,_0x5c273e){rimraf(_0x57f692,function(_0x2090ee){if(_0x2090ee)_0x5c273e(_0x2090ee);return _0x24d241();});});})[_0x4294('0x1a')](function(){return _0x3fd946[_0x4294('0x6b')](_0x2f46d0,_0x4c145e,function(_0x31ca5c){if(!_0x31ca5c)fs[_0x4294('0x6c')](_0x2f46d0);});});});}else{return _0x3fd946[_0x4294('0xf')](0xc8);}})[_0x4294('0x35')](handleError(_0x3fd946,null));}; \ No newline at end of file +var _0x0a67=['../../components/interaction/service','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','MailMessage','addMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','true','rows','addTags','setTags','omit','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','push','Attachments','Messages','from','bcc','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','juice'];(function(_0x5fff1a,_0x18b698){var _0x2cc24c=function(_0x1a0894){while(--_0x1a0894){_0x5fff1a['push'](_0x5fff1a['shift']());}};_0x2cc24c(++_0x18b698);}(_0x0a67,0x71));var _0x70a6=function(_0x471ec9,_0x2e5bdb){_0x471ec9=_0x471ec9-0x0;var _0x3b1784=_0x0a67[_0x471ec9];return _0x3b1784;};'use strict';var emlformat=require(_0x70a6('0x0'));var rimraf=require(_0x70a6('0x1'));var zipdir=require('zip-dir');var moment=require(_0x70a6('0x2'));var BPromise=require(_0x70a6('0x3'));var util=require(_0x70a6('0x4'));var path=require(_0x70a6('0x5'));var fs=require('fs');var _=require(_0x70a6('0x6'));var juice=require(_0x70a6('0x7'));var Redis=require('ioredis');var interaction=require(_0x70a6('0x8'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x70a6('0x9'));var config=require(_0x70a6('0xa'));var db=require(_0x70a6('0xb'))['db'];var htmlEntities=require(_0x70a6('0xc'));config[_0x70a6('0xd')]=_[_0x70a6('0xe')](config[_0x70a6('0xd')],{'host':_0x70a6('0xf'),'port':0x18eb});var socket=require(_0x70a6('0x10'))(new Redis(config[_0x70a6('0xd')]));require(_0x70a6('0x11'))[_0x70a6('0x12')](socket);function respondWithStatusCode(_0x2f3dd8,_0x50da08){_0x50da08=_0x50da08||0xcc;return function(_0x5cb7b3){if(_0x5cb7b3){return _0x2f3dd8[_0x70a6('0x13')](_0x50da08);}return _0x2f3dd8[_0x70a6('0x14')](_0x50da08)[_0x70a6('0x15')]();};}function respondWithResult(_0x9f0944,_0x306c95){_0x306c95=_0x306c95||0xc8;return function(_0x4d4553){if(_0x4d4553){return _0x9f0944[_0x70a6('0x14')](_0x306c95)[_0x70a6('0x16')](_0x4d4553);}};}function respondWithFilteredResult(_0x3b119c,_0x56372d){return function(_0x125961){if(_0x125961){var _0x25944b=typeof _0x56372d[_0x70a6('0x17')]===_0x70a6('0x18')&&typeof _0x56372d[_0x70a6('0x19')]==='undefined';var _0x24fe57=_0x125961['count'];var _0x3052bf=_0x25944b?0x0:_0x56372d[_0x70a6('0x17')];var _0x4cfedb=_0x25944b?_0x125961['count']:_0x56372d['offset']+_0x56372d[_0x70a6('0x19')];var _0x4a7a5f;if(_0x4cfedb>=_0x24fe57){_0x4cfedb=_0x24fe57;_0x4a7a5f=0xc8;}else{_0x4a7a5f=0xce;}_0x3b119c[_0x70a6('0x14')](_0x4a7a5f);return _0x3b119c[_0x70a6('0x1a')](_0x70a6('0x1b'),_0x3052bf+'-'+_0x4cfedb+'/'+_0x24fe57)[_0x70a6('0x16')](_0x125961);}return null;};}function saveUpdates(_0x337bab){return function(_0xf5a070){if(_0xf5a070){return _0xf5a070[_0x70a6('0x1c')](_0x337bab)[_0x70a6('0x1d')](function(_0x1d242d){return _0x1d242d;});}return null;};}function removeEntity(_0x5dc316){return function(_0x125295){if(_0x125295){return _0x125295[_0x70a6('0x1e')]()['then'](function(){_0x5dc316[_0x70a6('0x14')](0xcc)[_0x70a6('0x15')]();});}};}function handleEntityNotFound(_0x205c14){return function(_0x899ff9){if(!_0x899ff9){_0x205c14[_0x70a6('0x13')](0x194);}return _0x899ff9;};}function handleError(_0x549405,_0x84417a){_0x84417a=_0x84417a||0x1f4;return function(_0x4f6f82){logger[_0x70a6('0x1f')](_0x4f6f82['stack']);if(_0x4f6f82['name']){delete _0x4f6f82[_0x70a6('0x20')];}_0x549405['status'](_0x84417a)[_0x70a6('0x21')](_0x4f6f82);};}exports[_0x70a6('0x22')]=function(_0x151f13,_0x5e2acd){var _0x27175c={};var _0x3a613c=_[_0x70a6('0x23')](db[_0x70a6('0x24')][_0x70a6('0x25')],function(_0x19f22b){return{'name':_0x19f22b[_0x70a6('0x26')],'type':_0x19f22b[_0x70a6('0x27')][_0x70a6('0x28')]};});_0x27175c=qs[_0x70a6('0x29')](_0x3a613c,_0x151f13);return interaction[_0x70a6('0x2a')](_0x70a6('0x2b'),_0x151f13[_0x70a6('0x2c')],_0x151f13[_0x70a6('0x2d')],_0x27175c,_0x3a613c)[_0x70a6('0x1d')](respondWithFilteredResult(_0x5e2acd,_0x27175c))[_0x70a6('0x2e')](handleError(_0x5e2acd,null));};exports[_0x70a6('0x2f')]=function(_0x2d9797,_0x50ae1b){var _0x23e53e={'raw':![],'where':{'id':_0x2d9797[_0x70a6('0x30')]['id']}},_0x4f0bf9={};_0x4f0bf9[_0x70a6('0x31')]=_['keys'](db['MailInteraction'][_0x70a6('0x25')]);_0x4f0bf9[_0x70a6('0x2c')]=_[_0x70a6('0x32')](_0x2d9797[_0x70a6('0x2c')]);_0x4f0bf9[_0x70a6('0x33')]=_[_0x70a6('0x34')](_0x4f0bf9[_0x70a6('0x31')],_0x4f0bf9[_0x70a6('0x2c')]);_0x23e53e[_0x70a6('0x35')]=_['intersection'](_0x4f0bf9['model'],qs['fields'](_0x2d9797[_0x70a6('0x2c')][_0x70a6('0x36')]));_0x23e53e[_0x70a6('0x35')]=_0x23e53e[_0x70a6('0x35')][_0x70a6('0x37')]?_0x23e53e[_0x70a6('0x35')]:_0x4f0bf9[_0x70a6('0x31')];if(_0x2d9797['query'][_0x70a6('0x38')]){_0x23e53e[_0x70a6('0x39')]=[{'all':!![]}];}_0x23e53e=_['merge']({},_0x23e53e,_0x2d9797[_0x70a6('0x3a')]);return db['MailInteraction'][_0x70a6('0x3b')](_0x23e53e)['then'](handleEntityNotFound(_0x50ae1b,null))['then'](respondWithResult(_0x50ae1b,null))[_0x70a6('0x2e')](handleError(_0x50ae1b,null));};exports[_0x70a6('0x3c')]=function(_0x1aee6a,_0x4127c4){return db[_0x70a6('0x24')][_0x70a6('0x3c')](_0x1aee6a[_0x70a6('0x3d')],{})[_0x70a6('0x1d')](respondWithResult(_0x4127c4,0xc9))[_0x70a6('0x2e')](handleError(_0x4127c4,null));};exports[_0x70a6('0x1c')]=function(_0x45a99d,_0x330659){if(_0x45a99d[_0x70a6('0x3d')]['id']){delete _0x45a99d[_0x70a6('0x3d')]['id'];}return db['MailInteraction'][_0x70a6('0x3b')]({'where':{'id':_0x45a99d['params']['id']}})[_0x70a6('0x1d')](handleEntityNotFound(_0x330659,null))[_0x70a6('0x1d')](saveUpdates(_0x45a99d['body'],null))[_0x70a6('0x1d')](respondWithResult(_0x330659,null))[_0x70a6('0x2e')](handleError(_0x330659,null));};exports['destroy']=function(_0x25b03a,_0x265dfc){return db[_0x70a6('0x24')][_0x70a6('0x3b')]({'where':{'id':_0x25b03a[_0x70a6('0x30')]['id']}})[_0x70a6('0x1d')](handleEntityNotFound(_0x265dfc,null))[_0x70a6('0x1d')](removeEntity(_0x265dfc,null))[_0x70a6('0x2e')](handleError(_0x265dfc,null));};exports[_0x70a6('0x3e')]=function(_0x17dd46,_0x57f80f){return db[_0x70a6('0x24')]['describe']()['then'](respondWithResult(_0x57f80f,null))[_0x70a6('0x2e')](handleError(_0x57f80f,null));};exports['addMessage']=function(_0x22aa52,_0x3bb15){return db[_0x70a6('0x3f')][_0x70a6('0x3b')]({'where':{'id':_0x22aa52[_0x70a6('0x30')]['id']}})['then'](handleEntityNotFound(_0x3bb15,null))[_0x70a6('0x1d')](function(_0x10ff98){if(_0x10ff98){return _0x10ff98[_0x70a6('0x40')](_0x22aa52[_0x70a6('0x3d')][_0x70a6('0x41')],_['omit'](_0x22aa52[_0x70a6('0x3d')],[_0x70a6('0x41'),'id'])||{});}})[_0x70a6('0x1d')](respondWithResult(_0x3bb15,null))['catch'](handleError(_0x3bb15,null));};exports[_0x70a6('0x42')]=function(_0x7c2ce3,_0x445e51){var _0xcc9a36={'raw':![],'where':{}};var _0x300a2c={};var _0x31d199={'count':0x0,'rows':[]};return db[_0x70a6('0x24')][_0x70a6('0x43')]({'where':{'id':_0x7c2ce3[_0x70a6('0x30')]['id']}})[_0x70a6('0x1d')](handleEntityNotFound(_0x445e51,null))[_0x70a6('0x1d')](function(_0x54b827){if(_0x54b827){_0x300a2c['model']=_[_0x70a6('0x32')](db[_0x70a6('0x3f')][_0x70a6('0x25')]);_0x300a2c[_0x70a6('0x2c')]=_['keys'](_0x7c2ce3[_0x70a6('0x2c')]);_0x300a2c[_0x70a6('0x33')]=_['intersection'](_0x300a2c[_0x70a6('0x31')],_0x300a2c[_0x70a6('0x2c')]);_0xcc9a36[_0x70a6('0x35')]=_[_0x70a6('0x34')](_0x300a2c['model'],qs[_0x70a6('0x36')](_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x36')]));_0xcc9a36[_0x70a6('0x35')]=_0xcc9a36[_0x70a6('0x35')][_0x70a6('0x37')]?_0xcc9a36[_0x70a6('0x35')]:_0x300a2c['model'];if(!_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x44')](_0x70a6('0x45'))){_0xcc9a36[_0x70a6('0x19')]=qs[_0x70a6('0x19')](_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x19')]);_0xcc9a36['offset']=qs[_0x70a6('0x17')](_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x17')]);}_0xcc9a36['order']=qs['sort'](_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x46')]);_0xcc9a36[_0x70a6('0x47')]=qs[_0x70a6('0x33')](_[_0x70a6('0x48')](_0x7c2ce3['query'],_0x300a2c[_0x70a6('0x33')]));_0xcc9a36[_0x70a6('0x47')][_0x70a6('0x49')]=_0x54b827['id'];if(_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x4a')]){_0xcc9a36[_0x70a6('0x47')]=_[_0x70a6('0x4b')](_0xcc9a36[_0x70a6('0x47')],{'$or':_[_0x70a6('0x23')](_0xcc9a36[_0x70a6('0x35')],function(_0xbe6b84){var _0x39ae1f={};_0x39ae1f[_0xbe6b84]={'$like':'%'+_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x4a')]+'%'};return _0x39ae1f;})});}if(_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x4c')]){var _0x42f310=_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x4c')][_0x70a6('0x4d')](',');var _0x65060b={};_0x65060b[_0x42f310[0x0]]={'$gte':moment(_0x42f310[0x1])[_0x70a6('0x4e')](_0x70a6('0x4f'))};_0xcc9a36[_0x70a6('0x47')]=_['merge'](_0xcc9a36[_0x70a6('0x47')],_0x65060b);}_0xcc9a36=_[_0x70a6('0x4b')]({},_0xcc9a36,_0x7c2ce3[_0x70a6('0x3a')]);return db['MailMessage'][_0x70a6('0x50')]({'where':_0xcc9a36[_0x70a6('0x47')]})[_0x70a6('0x1d')](function(_0x47bbc7){_0x31d199[_0x70a6('0x50')]=_0x47bbc7;if(_0x7c2ce3[_0x70a6('0x2c')][_0x70a6('0x38')]){_0xcc9a36[_0x70a6('0x39')]=[{'all':!![]}];}return db[_0x70a6('0x3f')][_0x70a6('0x2a')](_0xcc9a36);})[_0x70a6('0x1d')](function(_0x56409d){if(_0x7c2ce3['query'][_0x70a6('0x51')]===_0x70a6('0x52')){for(var _0x214ec8=0x0;_0x214ec8<_0x56409d['length'];_0x214ec8++){_0x56409d[_0x214ec8][_0x70a6('0x3d')]=juice(_0x56409d[_0x214ec8][_0x70a6('0x3d')]);}}_0x31d199[_0x70a6('0x53')]=_0x56409d;return _0x31d199;});}})[_0x70a6('0x1d')](respondWithFilteredResult(_0x445e51,_0xcc9a36))[_0x70a6('0x2e')](handleError(_0x445e51,null));};exports[_0x70a6('0x54')]=function(_0x4f0c93,_0x3c581d){return db[_0x70a6('0x24')][_0x70a6('0x3b')]({'where':{'id':_0x4f0c93[_0x70a6('0x30')]['id']}})[_0x70a6('0x1d')](handleEntityNotFound(_0x3c581d,null))[_0x70a6('0x1d')](function(_0x44b913){if(_0x44b913){return _0x44b913[_0x70a6('0x55')](_0x4f0c93[_0x70a6('0x3d')][_0x70a6('0x41')],_[_0x70a6('0x56')](_0x4f0c93[_0x70a6('0x3d')],['ids','id'])||{})[_0x70a6('0x57')](function(){return db[_0x70a6('0x58')]['findAll']({'attributes':['id',_0x70a6('0x20'),'color'],'where':{'id':_0x4f0c93[_0x70a6('0x3d')][_0x70a6('0x41')]}});})[_0x70a6('0x1d')](function(_0x56f7e3){socket[_0x70a6('0x59')](_0x70a6('0x5a'),{'id':Number(_0x4f0c93[_0x70a6('0x30')]['id']),'tags':_0x56f7e3||[]});return{'id':Number(_0x4f0c93[_0x70a6('0x30')]['id']),'tags':_0x56f7e3||[]};});}})[_0x70a6('0x1d')](respondWithResult(_0x3c581d,null))[_0x70a6('0x2e')](handleError(_0x3c581d,null));};exports[_0x70a6('0x5b')]=function(_0x3f66cb,_0x566f15){return db[_0x70a6('0x24')][_0x70a6('0x3b')]({'where':{'id':_0x3f66cb['params']['id']}})[_0x70a6('0x1d')](handleEntityNotFound(_0x566f15,null))[_0x70a6('0x1d')](function(_0x49e105){if(_0x49e105){return _0x49e105[_0x70a6('0x5b')](_0x3f66cb[_0x70a6('0x2c')]['ids']);}})[_0x70a6('0x1d')](respondWithStatusCode(_0x566f15,null))[_0x70a6('0x2e')](handleError(_0x566f15,null));};exports[_0x70a6('0x5c')]=function(_0xbba872,_0x34704a){var _0x285ffe=moment()[_0x70a6('0x5d')]()[_0x70a6('0x5e')]();var _0x3c239e=path[_0x70a6('0x5f')](config['root'],_0x70a6('0x60'),_0x70a6('0x61'),_0x70a6('0x62'));var _0x1c4e87=path[_0x70a6('0x5f')](config[_0x70a6('0x63')],_0x70a6('0x60'),_0x70a6('0x61'),'attachments');var _0x25697c=path[_0x70a6('0x5f')](_0x3c239e,_0x285ffe);var _0x499f59=util['format']('transcript-%d-%s.zip',_0xbba872[_0x70a6('0x30')]['id'],_0x285ffe);var _0x2d6fa8=path[_0x70a6('0x5f')](_0x3c239e,_0x499f59);var _0x3200d9=[];if(_0xbba872[_0x70a6('0x2c')][_0x70a6('0x64')]){_0x3200d9[_0x70a6('0x65')]({'model':db['Attachment'],'as':_0x70a6('0x66'),'raw':!![]});}var _0x2d3146=[{'model':db[_0x70a6('0x3f')],'as':_0x70a6('0x67'),'attributes':['id',_0x70a6('0x3d'),_0x70a6('0x68'),'to','cc',_0x70a6('0x69'),'subject',_0x70a6('0x6a')],'where':{'secret':![]},'order':qs[_0x70a6('0x46')]('id'),'include':_0x3200d9}];return db[_0x70a6('0x24')][_0x70a6('0x3b')]({'where':{'id':_0xbba872[_0x70a6('0x30')]['id']},'include':_0x2d3146})[_0x70a6('0x1d')](handleEntityNotFound(_0x34704a,null))[_0x70a6('0x1d')](function(_0x5f509b){if(_0x5f509b&&_0x5f509b[_0x70a6('0x67')]){var _0x58b940=_0x5f509b[_0x70a6('0x6b')]({'plain':!![]});fs[_0x70a6('0x6c')](_0x25697c);return BPromise[_0x70a6('0x6d')](_0x58b940[_0x70a6('0x67')],function(_0x30cfb1,_0x5737d7){var _0x148a7a={'from':_0x30cfb1['from'],'to':_0x30cfb1['to']||_0x70a6('0x6e'),'subject':_0x30cfb1[_0x70a6('0x6f')],'html':htmlEntities['decode'](_0x30cfb1[_0x70a6('0x3d')]),'headers':{'Date':moment(_0x30cfb1[_0x70a6('0x6a')])[_0x70a6('0x4e')](_0x70a6('0x70'))},'attachments':[]};if(_0x30cfb1['cc']){_0x148a7a[_0x70a6('0x71')]['Cc']=_0x30cfb1['cc'];}if(_0x30cfb1[_0x70a6('0x69')]){_0x148a7a['headers'][_0x70a6('0x72')]=_0x30cfb1[_0x70a6('0x69')];}return new BPromise(function(_0x48aa50,_0xc761f7){if(_0x30cfb1['Attachments']){for(var _0x37f0e7=0x0;_0x37f0e7<_0x30cfb1[_0x70a6('0x66')][_0x70a6('0x37')];_0x37f0e7++){var _0x2d70a0=_0x30cfb1[_0x70a6('0x66')][_0x37f0e7];var _0x34fafc=path['join'](_0x1c4e87,_0x2d70a0[_0x70a6('0x73')]);if(fs[_0x70a6('0x74')](_0x34fafc)){_0x148a7a[_0x70a6('0x64')][_0x70a6('0x65')]({'name':_0x2d70a0[_0x70a6('0x20')],'contentType':_0x2d70a0[_0x70a6('0x27')],'data':fs[_0x70a6('0x75')](_0x34fafc)});}}}emlformat['build'](_0x148a7a,function(_0x2356e8,_0x2bcb8d){if(_0x2356e8)return _0xc761f7(_0x2356e8);fs[_0x70a6('0x76')](path['join'](_0x25697c,util[_0x70a6('0x4e')](_0x70a6('0x77'),_0x5737d7)),_0x2bcb8d);return _0x48aa50(_0x2bcb8d);});});})[_0x70a6('0x1d')](function(){return new BPromise(function(_0x527137,_0x4ceccb){zipdir(_0x25697c,{'saveTo':_0x2d6fa8},function(_0x185a88,_0x44479b){if(_0x185a88)return _0x4ceccb(_0x185a88);return _0x527137(_0x44479b);});})[_0x70a6('0x1d')](function(){return new BPromise(function(_0x19dcee,_0x37cee4){rimraf(_0x25697c,function(_0x3b5d94){if(_0x3b5d94)_0x37cee4(_0x3b5d94);return _0x19dcee();});});})[_0x70a6('0x1d')](function(){return _0x34704a[_0x70a6('0x5c')](_0x2d6fa8,_0x499f59,function(_0x3cd694){if(!_0x3cd694)fs[_0x70a6('0x78')](_0x2d6fa8);});});});}else{return _0x34704a['sendStatus'](0xc8);}})[_0x70a6('0x2e')](handleError(_0x34704a,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b03e76d..2477cfc 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 _0xaaab=['getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','save','update'];(function(_0x554e9e,_0xcb21e5){var _0x1ba47c=function(_0x535af9){while(--_0x535af9){_0x554e9e['push'](_0x554e9e['shift']());}};_0x1ba47c(++_0xcb21e5);}(_0xaaab,0x11c));var _0xbaaa=function(_0x30e891,_0x2b34bb){_0x30e891=_0x30e891-0x0;var _0x2e47d8=_0xaaab[_0x30e891];return _0x2e47d8;};'use strict';var EventEmitter=require(_0xbaaa('0x0'));var MailInteraction=require(_0xbaaa('0x1'))['db'][_0xbaaa('0x2')];var MailMessage=require(_0xbaaa('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbaaa('0x3'),'afterUpdate':_0xbaaa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x17c04e){return function(_0x48b2e6,_0xb8aa18,_0x51d2dc){_0x48b2e6[_0xbaaa('0x5')]({'attributes':['id'],'raw':!![]})[_0xbaaa('0x6')](function(_0x129ba5){_0x48b2e6[_0xbaaa('0x7')](_0xbaaa('0x8'),_0x129ba5['map'](function(_0x3af4bc){return{'id':_0x3af4bc['id']};}));return MailMessage[_0xbaaa('0x9')]({'where':{'MailInteractionId':_0x48b2e6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4a390e){_0x48b2e6['setDataValue'](_0xbaaa('0xa'),_0x4a390e[_0xbaaa('0xb')]);MailInteractionEvents[_0xbaaa('0xc')](_0x17c04e+':'+_0x48b2e6['id'],_0x48b2e6);MailInteractionEvents[_0xbaaa('0xc')](_0x17c04e,_0x48b2e6);_0x51d2dc(null);})[_0xbaaa('0xd')](_0x51d2dc(null));};}for(var e in events){if(events[_0xbaaa('0xe')](e)){var event=events[e];MailInteraction[_0xbaaa('0xf')](e,emitEvent(event));}}module[_0xbaaa('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xdc18=['catch','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x488b74,_0x1d3896){var _0x1c5d63=function(_0x3fc05f){while(--_0x3fc05f){_0x488b74['push'](_0x488b74['shift']());}};_0x1c5d63(++_0x1d3896);}(_0xdc18,0xa5));var _0x8dc1=function(_0x458787,_0x100c3b){_0x458787=_0x458787-0x0;var _0x469d4c=_0xdc18[_0x458787];return _0x469d4c;};'use strict';var EventEmitter=require(_0x8dc1('0x0'));var MailInteraction=require(_0x8dc1('0x1'))['db'][_0x8dc1('0x2')];var MailMessage=require(_0x8dc1('0x1'))['db'][_0x8dc1('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8dc1('0x4')](0x0);var events={'afterCreate':_0x8dc1('0x5'),'afterUpdate':'update','afterDestroy':_0x8dc1('0x6')};function emitEvent(_0x3c0a6d){return function(_0x4b9aed,_0x331b1d,_0x4fc0c2){_0x4b9aed['getUsers']({'attributes':['id'],'raw':!![]})[_0x8dc1('0x7')](function(_0x135e53){_0x4b9aed[_0x8dc1('0x8')](_0x8dc1('0x9'),_0x135e53[_0x8dc1('0xa')](function(_0x4f1818){return{'id':_0x4f1818['id']};}));return MailMessage[_0x8dc1('0xb')]({'where':{'MailInteractionId':_0x4b9aed['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8dc1('0x7')](function(_0x21ba3a){_0x4b9aed[_0x8dc1('0x8')](_0x8dc1('0xc'),_0x21ba3a[_0x8dc1('0xd')]);MailInteractionEvents[_0x8dc1('0xe')](_0x3c0a6d+':'+_0x4b9aed['id'],_0x4b9aed);MailInteractionEvents[_0x8dc1('0xe')](_0x3c0a6d,_0x4b9aed);_0x4fc0c2(null);})[_0x8dc1('0xf')](_0x4fc0c2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x8dc1('0x10')](e,emitEvent(event));}}module[_0x8dc1('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 893749a..d35a175 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 _0xa977=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','MailMessage','update','then','utf8mb4','lodash','../../config/logger'];(function(_0x5caed4,_0x4b3a23){var _0x24c1b5=function(_0x134260){while(--_0x134260){_0x5caed4['push'](_0x5caed4['shift']());}};_0x24c1b5(++_0x4b3a23);}(_0xa977,0x94));var _0x7a97=function(_0x447fa2,_0x5b48ee){_0x447fa2=_0x447fa2-0x0;var _0x4a635f=_0xa977[_0x447fa2];return _0x4a635f;};'use strict';var _=require(_0x7a97('0x0'));var util=require('util');var logger=require(_0x7a97('0x1'))(_0x7a97('0x2'));var moment=require(_0x7a97('0x3'));var BPromise=require(_0x7a97('0x4'));var rp=require(_0x7a97('0x5'));var fs=require('fs');var path=require(_0x7a97('0x6'));var rimraf=require(_0x7a97('0x7'));var config=require(_0x7a97('0x8'));var attributes=require(_0x7a97('0x9'));module[_0x7a97('0xa')]=function(_0x136a3d,_0x22dea6){return _0x136a3d[_0x7a97('0xb')](_0x7a97('0xc'),attributes,{'tableName':_0x7a97('0xd'),'paranoid':![],'indexes':[{'name':_0x7a97('0xe'),'fields':[_0x7a97('0xf'),'to'],'type':_0x7a97('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5298b6,_0x2d8fc7,_0x4d8e86){if(_0x5298b6[_0x7a97('0x11')]){_0x5298b6[_0x7a97('0x12')]=moment()['format'](_0x7a97('0x13'));}if(_0x5298b6[_0x7a97('0x14')]){_0x5298b6[_0x7a97('0x15')]=moment()[_0x7a97('0x16')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4d8e86(null,_0x2d8fc7);},'beforeUpdate':function(_0x5033b0,_0x9034ea,_0x5414cc){if(_0x5033b0[_0x7a97('0x17')](_0x7a97('0x11'))){_0x5033b0[_0x7a97('0x12')]=_0x5033b0[_0x7a97('0x11')]?moment()['format'](_0x7a97('0x13')):null;}if(_0x5033b0['changed'](_0x7a97('0x14'))){_0x5033b0[_0x7a97('0x15')]=moment()[_0x7a97('0x16')](_0x7a97('0x13'));_0x5033b0['substatus']=null;_0x5033b0[_0x7a97('0x12')]=null;}_0x5414cc(null,_0x5033b0);},'afterUpdate':function(_0x3f3065,_0x211f93,_0x4b2e9f){var _0x11294a=_0x136a3d[_0x7a97('0x18')];var _0x24376a=_0x3f3065[_0x7a97('0x19')]({'plain':!![]});if(_0x24376a[_0x7a97('0x14')]){return _0x11294a[_0x7a97('0x1a')][_0x7a97('0x1b')]({'read':!![]},{'where':{'MailInteractionId':_0x24376a['id']}})[_0x7a97('0x1c')](function(){_0x4b2e9f();})['catch'](function(_0x2f81f8){_0x4b2e9f(_0x2f81f8);});}else{_0x4b2e9f();}}},'charset':_0x7a97('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x01ff=['utf8mb4','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','closed','format','YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','models','update','then','catch'];(function(_0x44f0b8,_0x17ee1f){var _0x3e7880=function(_0x10e8a8){while(--_0x10e8a8){_0x44f0b8['push'](_0x44f0b8['shift']());}};_0x3e7880(++_0x17ee1f);}(_0x01ff,0x91));var _0xf01f=function(_0xa4299c,_0x234e0b){_0xa4299c=_0xa4299c-0x0;var _0x5d13d3=_0x01ff[_0xa4299c];return _0x5d13d3;};'use strict';var _=require(_0xf01f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf01f('0x1'));var moment=require(_0xf01f('0x2'));var BPromise=require(_0xf01f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf01f('0x4'));var rimraf=require(_0xf01f('0x5'));var config=require(_0xf01f('0x6'));var attributes=require(_0xf01f('0x7'));module['exports']=function(_0x5c456e,_0x546760){return _0x5c456e[_0xf01f('0x8')]('MailInteraction',attributes,{'tableName':_0xf01f('0x9'),'paranoid':![],'indexes':[{'name':_0xf01f('0xa'),'fields':['subject','to'],'type':_0xf01f('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x232446,_0x4317ad,_0x28de61){if(_0x232446[_0xf01f('0xc')]){_0x232446[_0xf01f('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x232446[_0xf01f('0xe')]){_0x232446['closedAt']=moment()[_0xf01f('0xf')](_0xf01f('0x10'));}_0x28de61(null,_0x4317ad);},'beforeUpdate':function(_0x4b2beb,_0x4b5f9d,_0x180a8f){if(_0x4b2beb[_0xf01f('0x11')](_0xf01f('0xc'))){_0x4b2beb[_0xf01f('0xd')]=_0x4b2beb[_0xf01f('0xc')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4b2beb['changed'](_0xf01f('0xe'))){_0x4b2beb[_0xf01f('0x12')]=moment()['format'](_0xf01f('0x10'));_0x4b2beb[_0xf01f('0xc')]=null;_0x4b2beb[_0xf01f('0xd')]=null;}_0x180a8f(null,_0x4b2beb);},'afterUpdate':function(_0x1a2138,_0x234988,_0xf0a429){var _0x28acb3=_0x5c456e[_0xf01f('0x13')];var _0x569b27=_0x1a2138['get']({'plain':!![]});if(_0x569b27[_0xf01f('0xe')]){return _0x28acb3['MailMessage'][_0xf01f('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x569b27['id']}})[_0xf01f('0x15')](function(){_0xf0a429();})[_0xf01f('0x16')](function(_0x396d57){_0xf0a429(_0x396d57);});}else{_0xf0a429();}}},'charset':_0xf01f('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index a633eeb..03ec6fa 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 _0xf1c6=['attributes','limit','then','debug','AddTagsToMailInteraction','find','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','stringify','code','MailInteraction,\x20%s,\x20%s','error','message','catch','UpdateMailInteraction','MailInteraction','update','options','where'];(function(_0x5f48e1,_0x51fcad){var _0xd4a205=function(_0x23d6ab){while(--_0x23d6ab){_0x5f48e1['push'](_0x5f48e1['shift']());}};_0xd4a205(++_0x51fcad);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x2d3088,_0x5df21c){_0x2d3088=_0x2d3088-0x0;var _0x2eb90d=_0xf1c6[_0x2d3088];return _0x2eb90d;};'use strict';var _=require(_0x6f1c('0x0'));var util=require(_0x6f1c('0x1'));var moment=require(_0x6f1c('0x2'));var BPromise=require(_0x6f1c('0x3'));var rs=require(_0x6f1c('0x4'));var fs=require('fs');var Redis=require(_0x6f1c('0x5'));var db=require(_0x6f1c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f1c('0x7'))(_0x6f1c('0x8'));var config=require(_0x6f1c('0x9'));var jayson=require(_0x6f1c('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x6f1c('0xb')]=_[_0x6f1c('0xc')](config[_0x6f1c('0xb')],{'host':_0x6f1c('0xd'),'port':0x18eb});var socket=require(_0x6f1c('0xe'))(new Redis(config[_0x6f1c('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x424895,_0x33459a,_0xed1cca){return new BPromise(function(_0x1d6a01,_0x1421aa){return client[_0x6f1c('0xf')](_0x424895,_0xed1cca)['then'](function(_0x2c8881){logger[_0x6f1c('0x10')]('MailInteraction,\x20%s,\x20%s',_0x33459a,_0x6f1c('0x11'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x33459a,_0x6f1c('0x11'),JSON[_0x6f1c('0x12')](_0x2c8881));if(_0x2c8881['error']){if(_0x2c8881['error'][_0x6f1c('0x13')]===0x1f4){logger['error'](_0x6f1c('0x14'),_0x33459a,_0x2c8881[_0x6f1c('0x15')][_0x6f1c('0x16')]);return _0x1421aa(_0x2c8881[_0x6f1c('0x15')][_0x6f1c('0x16')]);}logger[_0x6f1c('0x15')](_0x6f1c('0x14'),_0x33459a,_0x2c8881['error'][_0x6f1c('0x16')]);return _0x1d6a01(_0x2c8881['error'][_0x6f1c('0x16')]);}else{logger['info'](_0x6f1c('0x14'),_0x33459a,_0x6f1c('0x11'));_0x1d6a01(_0x2c8881['result']['message']);}})[_0x6f1c('0x17')](function(_0x842773){logger[_0x6f1c('0x15')]('MailInteraction,\x20%s,\x20%s',_0x33459a,_0x842773);_0x1421aa(_0x842773);});});}exports[_0x6f1c('0x18')]=function(_0x253ed9){var _0xd19619=this;return new Promise(function(_0x4b4889,_0x36068a){return db[_0x6f1c('0x19')][_0x6f1c('0x1a')](_0x253ed9['body'],{'raw':_0x253ed9[_0x6f1c('0x1b')]?_0x253ed9[_0x6f1c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x253ed9[_0x6f1c('0x1b')]?_0x253ed9[_0x6f1c('0x1b')][_0x6f1c('0x1c')]||null:null,'attributes':_0x253ed9[_0x6f1c('0x1b')]?_0x253ed9['options'][_0x6f1c('0x1d')]||null:null,'limit':_0x253ed9[_0x6f1c('0x1b')]?_0x253ed9[_0x6f1c('0x1b')][_0x6f1c('0x1e')]||null:null})[_0x6f1c('0x1f')](function(_0x21fdd4){logger['info'](_0x6f1c('0x18'),_0x253ed9);logger[_0x6f1c('0x20')](_0x6f1c('0x18'),_0x253ed9,JSON[_0x6f1c('0x12')](_0x21fdd4));_0x4b4889(_0x21fdd4);})[_0x6f1c('0x17')](function(_0x4fd4a2){logger[_0x6f1c('0x15')](_0x6f1c('0x18'),_0x4fd4a2[_0x6f1c('0x16')],_0x253ed9);_0x36068a(_0xd19619[_0x6f1c('0x15')](0x1f4,_0x4fd4a2[_0x6f1c('0x16')]));});});};exports[_0x6f1c('0x21')]=function(_0x4d120d){return new Promise(function(_0x492912,_0x30ba57){return db[_0x6f1c('0x19')][_0x6f1c('0x22')]({'where':_0x4d120d['options']?_0x4d120d[_0x6f1c('0x1b')][_0x6f1c('0x1c')]||null:null})[_0x6f1c('0x1f')](function(_0x68aeda){if(_0x68aeda){return _0x68aeda['addTags'](_0x4d120d[_0x6f1c('0x23')][_0x6f1c('0x24')],_['omit'](_0x4d120d[_0x6f1c('0x23')],[_0x6f1c('0x24'),'id'])||{});}})[_0x6f1c('0x25')](function(_0x5a25ec){logger[_0x6f1c('0x10')]('AddTags',_0x4d120d);logger[_0x6f1c('0x20')](_0x6f1c('0x26'),_0x4d120d,JSON[_0x6f1c('0x12')](_0x5a25ec));_0x492912(_0x5a25ec);})['catch'](function(_0x5e786f){logger[_0x6f1c('0x15')](_0x6f1c('0x26'),_0x5e786f[_0x6f1c('0x16')],_0x4d120d);_0x30ba57(_this[_0x6f1c('0x15')](0x1f4,_0x5e786f[_0x6f1c('0x16')]));});});}; \ No newline at end of file +var _0x3588=['result','catch','MailInteraction','update','options','raw','where','attributes','info','UpdateMailInteraction','AddTagsToMailInteraction','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3b2f3c,_0x259a84){var _0x1956bc=function(_0x1b4a95){while(--_0x1b4a95){_0x3b2f3c['push'](_0x3b2f3c['shift']());}};_0x1956bc(++_0x259a84);}(_0x3588,0x1d4));var _0x8358=function(_0x56f151,_0x281759){_0x56f151=_0x56f151-0x0;var _0x52c1e3=_0x3588[_0x56f151];return _0x52c1e3;};'use strict';var _=require(_0x8358('0x0'));var util=require(_0x8358('0x1'));var moment=require(_0x8358('0x2'));var BPromise=require(_0x8358('0x3'));var rs=require(_0x8358('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8358('0x5'))['db'];var utils=require(_0x8358('0x6'));var logger=require('../../config/logger')(_0x8358('0x7'));var config=require(_0x8358('0x8'));var jayson=require(_0x8358('0x9'));var client=jayson[_0x8358('0xa')]['http']({'port':0x232a});config[_0x8358('0xb')]=_[_0x8358('0xc')](config[_0x8358('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8358('0xb')]));require(_0x8358('0xd'))[_0x8358('0xe')](socket);function respondWithRpcPromise(_0x39d6a7,_0x22be8a,_0x31c1e6){return new BPromise(function(_0x55640e,_0x110259){return client[_0x8358('0xf')](_0x39d6a7,_0x31c1e6)[_0x8358('0x10')](function(_0x45a684){logger['info'](_0x8358('0x11'),_0x22be8a,_0x8358('0x12'));logger[_0x8358('0x13')](_0x8358('0x14'),_0x22be8a,_0x8358('0x12'),JSON[_0x8358('0x15')](_0x45a684));if(_0x45a684['error']){if(_0x45a684[_0x8358('0x16')]['code']===0x1f4){logger[_0x8358('0x16')]('MailInteraction,\x20%s,\x20%s',_0x22be8a,_0x45a684[_0x8358('0x16')][_0x8358('0x17')]);return _0x110259(_0x45a684['error'][_0x8358('0x17')]);}logger[_0x8358('0x16')]('MailInteraction,\x20%s,\x20%s',_0x22be8a,_0x45a684[_0x8358('0x16')][_0x8358('0x17')]);return _0x55640e(_0x45a684[_0x8358('0x16')][_0x8358('0x17')]);}else{logger['info'](_0x8358('0x11'),_0x22be8a,_0x8358('0x12'));_0x55640e(_0x45a684[_0x8358('0x18')][_0x8358('0x17')]);}})[_0x8358('0x19')](function(_0x5d0627){logger['error']('MailInteraction,\x20%s,\x20%s',_0x22be8a,_0x5d0627);_0x110259(_0x5d0627);});});}exports['UpdateMailInteraction']=function(_0x34bd38){var _0x50390f=this;return new Promise(function(_0x4d13f8,_0x3e6d79){return db[_0x8358('0x1a')][_0x8358('0x1b')](_0x34bd38['body'],{'raw':_0x34bd38[_0x8358('0x1c')]?_0x34bd38[_0x8358('0x1c')][_0x8358('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34bd38[_0x8358('0x1c')]?_0x34bd38[_0x8358('0x1c')][_0x8358('0x1e')]||null:null,'attributes':_0x34bd38[_0x8358('0x1c')]?_0x34bd38[_0x8358('0x1c')][_0x8358('0x1f')]||null:null,'limit':_0x34bd38[_0x8358('0x1c')]?_0x34bd38['options']['limit']||null:null})[_0x8358('0x10')](function(_0x4e141a){logger[_0x8358('0x20')](_0x8358('0x21'),_0x34bd38);logger[_0x8358('0x13')](_0x8358('0x21'),_0x34bd38,JSON['stringify'](_0x4e141a));_0x4d13f8(_0x4e141a);})['catch'](function(_0x352ddc){logger[_0x8358('0x16')]('UpdateMailInteraction',_0x352ddc['message'],_0x34bd38);_0x3e6d79(_0x50390f[_0x8358('0x16')](0x1f4,_0x352ddc['message']));});});};exports[_0x8358('0x22')]=function(_0x3e95fc){return new Promise(function(_0x30d956,_0x34362b){return db[_0x8358('0x1a')]['find']({'where':_0x3e95fc[_0x8358('0x1c')]?_0x3e95fc[_0x8358('0x1c')][_0x8358('0x1e')]||null:null})[_0x8358('0x10')](function(_0x44cac4){if(_0x44cac4){return _0x44cac4[_0x8358('0x23')](_0x3e95fc[_0x8358('0x24')]['ids'],_[_0x8358('0x25')](_0x3e95fc['body'],[_0x8358('0x26'),'id'])||{});}})[_0x8358('0x27')](function(_0x2012af){logger[_0x8358('0x20')]('AddTags',_0x3e95fc);logger[_0x8358('0x13')](_0x8358('0x28'),_0x3e95fc,JSON['stringify'](_0x2012af));_0x30d956(_0x2012af);})[_0x8358('0x19')](function(_0x393d68){logger['error'](_0x8358('0x28'),_0x393d68[_0x8358('0x17')],_0x3e95fc);_0x34362b(_this[_0x8358('0x16')](0x1f4,_0x393d68['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d6c6b15..fdbe2e7 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 _0x66a8=['mailInteraction:','./mailInteraction.events','update','removeListener','register','length'];(function(_0xd6bd49,_0x4299a3){var _0x434fb5=function(_0x5e5396){while(--_0x5e5396){_0xd6bd49['push'](_0xd6bd49['shift']());}};_0x434fb5(++_0x4299a3);}(_0x66a8,0xd3));var _0x866a=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x66a8[_0xc4001c];return _0x49f7bc;};'use strict';var MailInteractionEvents=require(_0x866a('0x0'));var events=['save','remove',_0x866a('0x1')];function createListener(_0x11013b,_0x6680b2){return function(_0x376604){_0x6680b2['emit'](_0x11013b,_0x376604);};}function removeListener(_0x32f275,_0x27acb5){return function(){MailInteractionEvents[_0x866a('0x2')](_0x32f275,_0x27acb5);};}exports[_0x866a('0x3')]=function(_0xd6dd73){for(var _0xc48729=0x0,_0x5bb545=events[_0x866a('0x4')];_0xc48729<_0x5bb545;_0xc48729++){var _0xa7fbe=events[_0xc48729];var _0x3d3c98=createListener(_0x866a('0x5')+_0xa7fbe,_0xd6dd73);MailInteractionEvents['on'](_0xa7fbe,_0x3d3c98);}}; \ No newline at end of file +var _0xe4dc=['emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0xeef8f7,_0x1a5eab){var _0x4c457b=function(_0x47cf49){while(--_0x47cf49){_0xeef8f7['push'](_0xeef8f7['shift']());}};_0x4c457b(++_0x1a5eab);}(_0xe4dc,0x155));var _0xce4d=function(_0x281273,_0x477f54){_0x281273=_0x281273-0x0;var _0x13a437=_0xe4dc[_0x281273];return _0x13a437;};'use strict';var MailInteractionEvents=require(_0xce4d('0x0'));var events=['save',_0xce4d('0x1'),_0xce4d('0x2')];function createListener(_0x97a286,_0x4aea4a){return function(_0x353899){_0x4aea4a[_0xce4d('0x3')](_0x97a286,_0x353899);};}function removeListener(_0x58e1be,_0x2b5309){return function(){MailInteractionEvents[_0xce4d('0x4')](_0x58e1be,_0x2b5309);};}exports[_0xce4d('0x5')]=function(_0x1b675f){for(var _0x439649=0x0,_0x31a004=events[_0xce4d('0x6')];_0x439649<_0x31a004;_0x439649++){var _0x57758e=events[_0x439649];var _0x4a279d=createListener(_0xce4d('0x7')+_0x57758e,_0x1b675f);MailInteractionEvents['on'](_0x57758e,_0x4a279d);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 17a41cc..fad8e46 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 _0xbd5f=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','tracked','mail','mailmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','multer'];(function(_0x133541,_0x51f4e0){var _0x2a9263=function(_0x5a2ebe){while(--_0x5a2ebe){_0x133541['push'](_0x133541['shift']());}};_0x2a9263(++_0x51f4e0);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x40d5cc,_0xf9d2c7){_0x40d5cc=_0x40d5cc-0x0;var _0x6950af=_0xbd5f[_0x40d5cc];return _0x6950af;};'use strict';var multer=require(_0xfbd5('0x0'));var util=require(_0xfbd5('0x1'));var path=require(_0xfbd5('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbd5('0x3'));var router=express['Router']();var fs_extra=require(_0xfbd5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfbd5('0x5'));var config=require(_0xfbd5('0x6'));var controller=require(_0xfbd5('0x7'));router[_0xfbd5('0x8')]('/',auth[_0xfbd5('0x9')](),controller[_0xfbd5('0xa')]);router[_0xfbd5('0x8')]('/describe',auth[_0xfbd5('0x9')](),controller['describe']);router['get'](_0xfbd5('0xb'),auth['isAuthenticated'](),controller[_0xfbd5('0xc')]);router[_0xfbd5('0x8')](_0xfbd5('0xd'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xfbd5('0x9')](),interaction[_0xfbd5('0xe')](_0xfbd5('0xf'),_0xfbd5('0x10')),controller[_0xfbd5('0x11')]);router[_0xfbd5('0x12')]('/:id',auth[_0xfbd5('0x9')](),controller['update']);router[_0xfbd5('0x12')](_0xfbd5('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0xfbd5('0x12')](_0xfbd5('0x14'),auth[_0xfbd5('0x9')](),controller[_0xfbd5('0x15')]);router[_0xfbd5('0x16')](_0xfbd5('0xb'),auth[_0xfbd5('0x9')](),controller[_0xfbd5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x07c3=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy'];(function(_0x2055a7,_0x415a4c){var _0x42a14d=function(_0x83139b){while(--_0x83139b){_0x2055a7['push'](_0x2055a7['shift']());}};_0x42a14d(++_0x415a4c);}(_0x07c3,0x14b));var _0x307c=function(_0x1f1305,_0x2435f5){_0x1f1305=_0x1f1305-0x0;var _0x571a9d=_0x07c3[_0x1f1305];return _0x571a9d;};'use strict';var multer=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var path=require(_0x307c('0x2'));var timeout=require(_0x307c('0x3'));var express=require(_0x307c('0x4'));var router=express['Router']();var fs_extra=require(_0x307c('0x5'));var auth=require(_0x307c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x307c('0x7'));var controller=require(_0x307c('0x8'));router[_0x307c('0x9')]('/',auth[_0x307c('0xa')](),controller[_0x307c('0xb')]);router[_0x307c('0x9')](_0x307c('0xc'),auth[_0x307c('0xa')](),controller[_0x307c('0xd')]);router['get'](_0x307c('0xe'),auth[_0x307c('0xa')](),controller[_0x307c('0xf')]);router[_0x307c('0x9')](_0x307c('0x10'),auth[_0x307c('0xa')](),controller[_0x307c('0x11')]);router[_0x307c('0x12')]('/',auth[_0x307c('0xa')](),interaction['tracked'](_0x307c('0x13'),_0x307c('0x14')),controller[_0x307c('0x15')]);router['put'](_0x307c('0xe'),auth[_0x307c('0xa')](),controller[_0x307c('0x16')]);router[_0x307c('0x17')]('/:id/accept',auth[_0x307c('0xa')](),controller[_0x307c('0x18')]);router[_0x307c('0x17')](_0x307c('0x19'),auth[_0x307c('0xa')](),controller[_0x307c('0x1a')]);router[_0x307c('0x1b')](_0x307c('0xe'),auth[_0x307c('0xa')](),controller[_0x307c('0x1c')]);module[_0x307c('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 8905a7f..1062d5b 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 _0x13a5=['BOOLEAN','Email','Chat','sequelize','lodash','exports','TEXT','medium','ENUM','out','STRING','long','DATE','INTEGER'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x13a5,0x11b));var _0x513a=function(_0x12b75b,_0x2d02c3){_0x12b75b=_0x12b75b-0x0;var _0x24a995=_0x13a5[_0x12b75b];return _0x24a995;};'use strict';var Sequelize=require(_0x513a('0x0'));var _=require(_0x513a('0x1'));module[_0x513a('0x2')]={'body':{'type':Sequelize[_0x513a('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x513a('0x3')](_0x513a('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x513a('0x5')]('in',_0x513a('0x6')),'defaultValue':_0x513a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x513a('0x7')]},'to':{'type':Sequelize[_0x513a('0x3')](_0x513a('0x8'))},'cc':{'type':Sequelize[_0x513a('0x3')](_0x513a('0x8'))},'bcc':{'type':Sequelize[_0x513a('0x3')](_0x513a('0x8'))},'subject':{'type':Sequelize[_0x513a('0x3')]},'sentAt':{'type':Sequelize[_0x513a('0x9')]},'attach':{'type':Sequelize[_0x513a('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x513a('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x513a('0x8'))},'originCc':{'type':Sequelize['TEXT'](_0x513a('0x8'))},'originChannel':{'type':Sequelize[_0x513a('0x5')](_0x513a('0xc'),_0x513a('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xda90=['BOOLEAN','ENUM','out','STRING','DATE','Email','lodash','TEXT','long','medium'];(function(_0x29bcb2,_0x3d3d27){var _0xe5b001=function(_0x30dc1c){while(--_0x30dc1c){_0x29bcb2['push'](_0x29bcb2['shift']());}};_0xe5b001(++_0x3d3d27);}(_0xda90,0x128));var _0x0da9=function(_0x18a17b,_0x3f0482){_0x18a17b=_0x18a17b-0x0;var _0x3f1420=_0xda90[_0x18a17b];return _0x3f1420;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0da9('0x0'));module['exports']={'body':{'type':Sequelize[_0x0da9('0x1')](_0x0da9('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x0da9('0x3'))},'read':{'type':Sequelize[_0x0da9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0da9('0x5')]('in',_0x0da9('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x0da9('0x7')]},'to':{'type':Sequelize[_0x0da9('0x1')](_0x0da9('0x2'))},'cc':{'type':Sequelize[_0x0da9('0x1')]('long')},'bcc':{'type':Sequelize[_0x0da9('0x1')]('long')},'subject':{'type':Sequelize[_0x0da9('0x1')]},'sentAt':{'type':Sequelize[_0x0da9('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0da9('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x0da9('0x1')]('long')},'originCc':{'type':Sequelize[_0x0da9('0x1')](_0x0da9('0x2'))},'originChannel':{'type':Sequelize[_0x0da9('0x5')](_0x0da9('0x9'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 25a4b17..06f6903 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 _0xc481=['find','describe','create','direction','secret','CmContact','Contacts','updatedAt','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','List','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','readAt','UserId','get','MailInteraction','MailInteractionId','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','QueryTypes','User','agent','manual','channel','motionChannel','event','fromString','acceptmessage','reject','RejectMessage','SELECT','contact','email','interface','SIP/%s','EventManager','download','toString','files','server','message-%s.eml','bcc','subject','createdAt','Attachment','from','decode','headers','Attachments','basename','existsSync','push','readFileSync','build','moment','bluebird','util','path','lodash','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','sendStatus','name','send','index','map','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailMessage','includeAll','include','findAll','rows','params','rawAttributes','body'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xc481,0xdb));var _0x1c48=function(_0x443520,_0x2fe333){_0x443520=_0x443520-0x0;var _0x20afa5=_0xc481[_0x443520];return _0x20afa5;};'use strict';var emlformat=require('eml-format');var moment=require(_0x1c48('0x0'));var BPromise=require(_0x1c48('0x1'));var util=require(_0x1c48('0x2'));var path=require(_0x1c48('0x3'));var fs=require('fs');var _=require(_0x1c48('0x4'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x1c48('0x5'))('api');var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x1c48('0x6'));var db=require(_0x1c48('0x7'))['db'];config[_0x1c48('0x8')]=_[_0x1c48('0x9')](config[_0x1c48('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c48('0xa'))(new Redis(config[_0x1c48('0x8')]));var htmlEntities=require(_0x1c48('0xb'));require('./mailMessage.socket')[_0x1c48('0xc')](socket);var jayson=require(_0x1c48('0xd'));var client=jayson[_0x1c48('0xe')][_0x1c48('0xf')]({'port':0x232c});var client9003=jayson[_0x1c48('0xe')][_0x1c48('0xf')]({'port':0x232b});var client9002=jayson[_0x1c48('0xe')][_0x1c48('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x554308,_0x32674b,_0x4e2ab7,_0x4fb074){return new BPromise(function(_0xaf251d,_0x1e5af7){var _0x4e78be=_0x4fb074||client;return _0x4e78be[_0x1c48('0x10')](_0x554308,_0x4e2ab7)[_0x1c48('0x11')](function(_0x59f50b){logger[_0x1c48('0x12')](_0x1c48('0x13'),_0x32674b,_0x1c48('0x14'));logger[_0x1c48('0x15')](_0x1c48('0x16'),_0x32674b,'request\x20sent',JSON[_0x1c48('0x17')](_0x59f50b));if(_0x59f50b[_0x1c48('0x18')]){if(_0x59f50b['error']['code']===0x1f4){logger[_0x1c48('0x18')](_0x1c48('0x13'),_0x32674b,_0x59f50b[_0x1c48('0x18')][_0x1c48('0x19')]);return _0x1e5af7(_0x59f50b['error'][_0x1c48('0x19')]);}logger[_0x1c48('0x18')](_0x1c48('0x13'),_0x32674b,_0x59f50b[_0x1c48('0x18')][_0x1c48('0x19')]);return _0xaf251d(_0x59f50b[_0x1c48('0x18')][_0x1c48('0x19')]);}else{logger[_0x1c48('0x12')](_0x1c48('0x13'),_0x32674b,_0x1c48('0x14'));_0xaf251d(_0x59f50b[_0x1c48('0x1a')][_0x1c48('0x19')]);}})[_0x1c48('0x1b')](function(_0x1554d8){logger[_0x1c48('0x18')](_0x1c48('0x13'),_0x32674b,_0x1554d8);_0x1e5af7(_0x1554d8);});});}function respondWithResult(_0x5b2d73,_0x414b91){_0x414b91=_0x414b91||0xc8;return function(_0x41e3f6){if(_0x41e3f6){return _0x5b2d73[_0x1c48('0x1c')](_0x414b91)[_0x1c48('0x1d')](_0x41e3f6);}};}function respondWithFilteredResult(_0x2d5d95,_0x26f266){return function(_0x2df5a5){if(_0x2df5a5){var _0x1846e7=typeof _0x26f266[_0x1c48('0x1e')]===_0x1c48('0x1f')&&typeof _0x26f266[_0x1c48('0x20')]===_0x1c48('0x1f');var _0xa14f7d=_0x2df5a5[_0x1c48('0x21')];var _0x4e1631=_0x1846e7?0x0:_0x26f266[_0x1c48('0x1e')];var _0x1af8d8=_0x1846e7?_0x2df5a5[_0x1c48('0x21')]:_0x26f266[_0x1c48('0x1e')]+_0x26f266['limit'];var _0xb7bf08;if(_0x1af8d8>=_0xa14f7d){_0x1af8d8=_0xa14f7d;_0xb7bf08=0xc8;}else{_0xb7bf08=0xce;}_0x2d5d95[_0x1c48('0x1c')](_0xb7bf08);return _0x2d5d95['set'](_0x1c48('0x22'),_0x4e1631+'-'+_0x1af8d8+'/'+_0xa14f7d)[_0x1c48('0x1d')](_0x2df5a5);}return null;};}function saveUpdates(_0x26b207){return function(_0x23a1ce){if(_0x23a1ce){return _0x23a1ce[_0x1c48('0x23')](_0x26b207)[_0x1c48('0x11')](function(_0x512728){return _0x512728;});}return null;};}function removeEntity(_0x29f497){return function(_0x35364e){if(_0x35364e){return _0x35364e[_0x1c48('0x24')]()[_0x1c48('0x11')](function(){_0x29f497['status'](0xcc)[_0x1c48('0x25')]();});}};}function handleEntityNotFound(_0x5061c6){return function(_0x1ba36c){if(!_0x1ba36c){_0x5061c6[_0x1c48('0x26')](0x194);}return _0x1ba36c;};}function handleError(_0xc42517,_0x45d4b6){_0x45d4b6=_0x45d4b6||0x1f4;return function(_0x2229d7){logger[_0x1c48('0x18')](_0x2229d7['stack']);if(_0x2229d7[_0x1c48('0x27')]){delete _0x2229d7['name'];}_0xc42517[_0x1c48('0x1c')](_0x45d4b6)[_0x1c48('0x28')](_0x2229d7);};}exports[_0x1c48('0x29')]=function(_0x57ec54,_0x38e5d8){var _0x49fc9c={},_0x24a6a8={},_0x432fbd={'count':0x0,'rows':[]};var _0xb54f5b=_[_0x1c48('0x2a')](db['MailMessage']['rawAttributes'],function(_0x338f08){return{'name':_0x338f08['fieldName'],'type':_0x338f08['type'][_0x1c48('0x2b')]};});_0x24a6a8[_0x1c48('0x2c')]=_[_0x1c48('0x2a')](_0xb54f5b,_0x1c48('0x27'));_0x24a6a8[_0x1c48('0x2d')]=_[_0x1c48('0x2e')](_0x57ec54[_0x1c48('0x2d')]);_0x24a6a8[_0x1c48('0x2f')]=_[_0x1c48('0x30')](_0x24a6a8[_0x1c48('0x2c')],_0x24a6a8[_0x1c48('0x2d')]);_0x49fc9c['attributes']=_[_0x1c48('0x30')](_0x24a6a8['model'],qs[_0x1c48('0x31')](_0x57ec54['query'][_0x1c48('0x31')]));_0x49fc9c[_0x1c48('0x32')]=_0x49fc9c[_0x1c48('0x32')][_0x1c48('0x33')]?_0x49fc9c['attributes']:_0x24a6a8[_0x1c48('0x2c')];if(!_0x57ec54[_0x1c48('0x2d')][_0x1c48('0x34')](_0x1c48('0x35'))){_0x49fc9c[_0x1c48('0x20')]=qs[_0x1c48('0x20')](_0x57ec54[_0x1c48('0x2d')][_0x1c48('0x20')]);_0x49fc9c[_0x1c48('0x1e')]=qs[_0x1c48('0x1e')](_0x57ec54['query'][_0x1c48('0x1e')]);}_0x49fc9c[_0x1c48('0x36')]=qs[_0x1c48('0x37')](_0x57ec54[_0x1c48('0x2d')][_0x1c48('0x37')]);_0x49fc9c[_0x1c48('0x38')]=qs[_0x1c48('0x2f')](_[_0x1c48('0x39')](_0x57ec54['query'],_0x24a6a8[_0x1c48('0x2f')]),_0xb54f5b);if(_0x57ec54[_0x1c48('0x2d')][_0x1c48('0x3a')]){_0x49fc9c[_0x1c48('0x38')]=_[_0x1c48('0x3b')](_0x49fc9c['where'],{'$or':_[_0x1c48('0x2a')](_0xb54f5b,function(_0x21eecd){if(_0x21eecd[_0x1c48('0x3c')]!==_0x1c48('0x3d')){var _0x366a5a={};_0x366a5a[_0x21eecd['name']]={'$like':'%'+_0x57ec54['query']['filter']+'%'};return _0x366a5a;}})});}_0x49fc9c=_[_0x1c48('0x3b')]({},_0x49fc9c,_0x57ec54[_0x1c48('0x3e')]);var _0x21eb3c={'where':_0x49fc9c[_0x1c48('0x38')]};return db[_0x1c48('0x3f')][_0x1c48('0x21')](_0x21eb3c)['then'](function(_0x534b83){_0x432fbd['count']=_0x534b83;if(_0x57ec54[_0x1c48('0x2d')][_0x1c48('0x40')]){_0x49fc9c[_0x1c48('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0x1c48('0x42')](_0x49fc9c);})[_0x1c48('0x11')](function(_0x114ad9){_0x432fbd[_0x1c48('0x43')]=_0x114ad9;return _0x432fbd;})[_0x1c48('0x11')](respondWithFilteredResult(_0x38e5d8,_0x49fc9c))['catch'](handleError(_0x38e5d8,null));};exports['show']=function(_0x56ef58,_0x22c322){var _0x3e61b1={'raw':!![],'where':{'id':_0x56ef58[_0x1c48('0x44')]['id']}},_0x13e1d2={};_0x13e1d2[_0x1c48('0x2c')]=_[_0x1c48('0x2e')](db['MailMessage'][_0x1c48('0x45')]);_0x13e1d2[_0x1c48('0x2d')]=_[_0x1c48('0x2e')](_0x56ef58['query']);_0x13e1d2[_0x1c48('0x2f')]=_[_0x1c48('0x30')](_0x13e1d2['model'],_0x13e1d2['query']);_0x3e61b1['attributes']=_[_0x1c48('0x30')](_0x13e1d2[_0x1c48('0x2c')],qs[_0x1c48('0x31')](_0x56ef58['query'][_0x1c48('0x31')]));_0x3e61b1['attributes']=_0x3e61b1[_0x1c48('0x32')][_0x1c48('0x33')]?_0x3e61b1['attributes']:_0x13e1d2[_0x1c48('0x2c')];if(_0x56ef58[_0x1c48('0x2d')]['includeAll']){_0x3e61b1[_0x1c48('0x41')]=[{'all':!![]}];}_0x3e61b1=_[_0x1c48('0x3b')]({},_0x3e61b1,_0x56ef58[_0x1c48('0x3e')]);return db[_0x1c48('0x3f')]['find'](_0x3e61b1)[_0x1c48('0x11')](handleEntityNotFound(_0x22c322,null))[_0x1c48('0x11')](respondWithResult(_0x22c322,null))[_0x1c48('0x1b')](handleError(_0x22c322,null));};exports[_0x1c48('0x23')]=function(_0x58ec38,_0x274bdc){if(_0x58ec38[_0x1c48('0x46')]['id']){delete _0x58ec38[_0x1c48('0x46')]['id'];}return db[_0x1c48('0x3f')][_0x1c48('0x47')]({'where':{'id':_0x58ec38[_0x1c48('0x44')]['id']}})[_0x1c48('0x11')](handleEntityNotFound(_0x274bdc,null))[_0x1c48('0x11')](saveUpdates(_0x58ec38[_0x1c48('0x46')],null))[_0x1c48('0x11')](respondWithResult(_0x274bdc,null))[_0x1c48('0x1b')](handleError(_0x274bdc,null));};exports[_0x1c48('0x24')]=function(_0x416cda,_0xebb13d){return db[_0x1c48('0x3f')][_0x1c48('0x47')]({'where':{'id':_0x416cda[_0x1c48('0x44')]['id']}})[_0x1c48('0x11')](handleEntityNotFound(_0xebb13d,null))[_0x1c48('0x11')](removeEntity(_0xebb13d,null))['catch'](handleError(_0xebb13d,null));};exports[_0x1c48('0x48')]=function(_0x8fdec1,_0x38b2f0){return db[_0x1c48('0x3f')][_0x1c48('0x48')]()[_0x1c48('0x11')](respondWithResult(_0x38b2f0,null))['catch'](handleError(_0x38b2f0,null));};exports[_0x1c48('0x49')]=function(_0x20238f,_0x3d1a30){return db['MailMessage'][_0x1c48('0x49')](_0x20238f['body'])['then'](function(_0x4a3d98){if(_0x4a3d98){if(_0x4a3d98[_0x1c48('0x4a')]==='out'&&!_0x4a3d98[_0x1c48('0x4b')]){var _0x40380e,_0x35c16e,_0x9a672e;if(_0x20238f[_0x1c48('0x46')]['to']){_0x35c16e=_0x20238f[_0x1c48('0x46')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x4a3d98['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1c48('0x4c')],'as':_0x1c48('0x4d'),'where':{'email':_0x35c16e},'limit':0x1,'order':[[_0x1c48('0x4e'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x1c48('0x4f'),'raw':!![],'include':[{'model':db[_0x1c48('0x50')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x323a1f){_0x40380e=_0x323a1f;if(!_0x40380e||!_0x40380e['Smtp'])return;var _0x259ae2=_0x40380e[_0x1c48('0x51')]();if(_0x20238f['body'][_0x1c48('0x52')]&&_0x20238f['body']['attachments'][_0x1c48('0x33')]){for(var _0x5b79a0=0x0;_0x5b79a0<_0x20238f[_0x1c48('0x46')]['attachments']['length'];_0x5b79a0+=0x1){_0x20238f['body'][_0x1c48('0x52')][_0x5b79a0]={'filename':_0x20238f[_0x1c48('0x46')][_0x1c48('0x52')][_0x5b79a0][_0x1c48('0x27')],'path':path[_0x1c48('0x53')](config[_0x1c48('0x54')],_0x1c48('0x55'),_0x20238f[_0x1c48('0x46')]['attachments'][_0x5b79a0]['basename'])};}}_0x9a672e={'account':_0x259ae2,'message':_0x20238f[_0x1c48('0x46')]};return;})[_0x1c48('0x11')](function(){if(_0x40380e[_0x1c48('0x56')]){if(_0x40380e['List'][_0x1c48('0x4d')][_0x1c48('0x33')]){return _0x40380e['List'][_0x1c48('0x4d')][0x0];}else{return db['CmContact']['create'](_[_0x1c48('0x9')](_0x20238f[_0x1c48('0x46')],{'firstName':_0x20238f[_0x1c48('0x46')]['to'],'email':_0x20238f[_0x1c48('0x46')]['to'],'phone':_0x20238f[_0x1c48('0x46')]['to'],'ListId':_0x40380e[_0x1c48('0x57')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x9a672e){return respondWithRpcPromise(_0x1c48('0x58'),_0x1c48('0x59'),_0x9a672e,client9003)[_0x1c48('0x11')](function(_0x464e8f){return _0x4a3d98[_0x1c48('0x23')]({'read':!![],'messageId':_0x464e8f[_0x1c48('0x5a')],'sentAt':moment()[_0x1c48('0x5b')](_0x1c48('0x5c'))});})[_0x1c48('0x1b')](function(_0x30f9bb){logger[_0x1c48('0x18')]('%s',JSON[_0x1c48('0x17')](_0x30f9bb));return _0x4a3d98;});}return _0x4a3d98;});}return _0x4a3d98;}})[_0x1c48('0x11')](respondWithResult(_0x3d1a30,0xc9))[_0x1c48('0x1b')](handleError(_0x3d1a30,null));};exports['accept']=function(_0x52644d,_0x126c13){var _0xd125b8={'agent':{},'channel':_0x1c48('0x5d')};if(_0x52644d[_0x1c48('0x46')]['id']){delete _0x52644d['body']['id'];}_0x52644d['body']['read']=!![];_0x52644d[_0x1c48('0x46')][_0x1c48('0x5e')]=moment()['format'](_0x1c48('0x5c'));_0x52644d[_0x1c48('0x46')][_0x1c48('0x5f')]=_0x52644d[_0x1c48('0x46')]['UserId']||_0x52644d['user']['id'];_0xd125b8['agent']['id']=_0x52644d[_0x1c48('0x46')][_0x1c48('0x5f')];return db['MailMessage']['find']({'where':{'id':_0x52644d[_0x1c48('0x44')]['id'],'UserId':null}})[_0x1c48('0x11')](handleEntityNotFound(_0x126c13,null))['then'](saveUpdates(_0x52644d[_0x1c48('0x46')],null))[_0x1c48('0x11')](function(_0x49afa1){if(_0x49afa1){_0xd125b8[_0x1c48('0x19')]=_0x49afa1[_0x1c48('0x60')]({'plain':!![]});return db[_0x1c48('0x61')][_0x1c48('0x47')]({'where':{'id':_0x49afa1[_0x1c48('0x62')]}});}return null;})[_0x1c48('0x11')](handleEntityNotFound(_0x126c13,null))[_0x1c48('0x11')](function(_0x3baf34){if(_0x3baf34){return _0x3baf34['update']({'UserId':_0x52644d[_0x1c48('0x46')][_0x1c48('0x5f')],'read1stAt':_['isNil'](_0x3baf34[_0x1c48('0x63')])?moment()[_0x1c48('0x5b')](_0x1c48('0x5c')):undefined});}return null;})[_0x1c48('0x11')](function(_0x3f0d70){if(_0x3f0d70){_0xd125b8[_0x1c48('0x64')]=_0x3f0d70[_0x1c48('0x60')]({'plain':!![]});interaction_log[_0x1c48('0x12')](_0x1c48('0x65'),_0x52644d[_0x1c48('0x66')]['id'],_0x52644d['user'][_0x1c48('0x27')],_0x52644d['user'][_0x1c48('0x67')],_0xd125b8[_0x1c48('0x64')]['id'],_0x52644d['body']?JSON['stringify'](_0x52644d[_0x1c48('0x46')]):_0x1c48('0x68'));return respondWithRpcPromise(_0x1c48('0x69'),_0x1c48('0x6a'),_0xd125b8);}return null;})[_0x1c48('0x11')](function(_0x4e7abb){var _0x5830a5=_0x1c48('0x6b')+_0x4e7abb[_0x1c48('0x19')][_0x1c48('0x6c')];return db[_0x1c48('0x6d')][_0x1c48('0x2d')](_0x5830a5,{'type':db['Sequelize'][_0x1c48('0x6e')]['SELECT'],'raw':!![]})[_0x1c48('0x11')](function(_0x18e70d){return _0x18e70d;});})['then'](function(_0x174f04){if(_0x174f04){_0xd125b8[_0x1c48('0x19')]['contact']=_0x174f04[0x0];if(!_0x52644d[_0x1c48('0x46')][_0x1c48('0x5f')])return;return db[_0x1c48('0x6f')]['find']({'where':{'id':_0x52644d[_0x1c48('0x46')][_0x1c48('0x5f')],'role':_0x1c48('0x70')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x1c48('0x11')](function(_0x15090b){if(!_0x15090b)return null;_0xd125b8['message'][_0x1c48('0x70')]=_0x15090b;return _0xd125b8;})['then'](function(_0x170adc){if(_0x170adc){if(_0x52644d[_0x1c48('0x46')][_0x1c48('0x71')]){_0xd125b8['message']['interface']=util['format']('SIP/%s',_0x52644d[_0x1c48('0x66')][_0x1c48('0x27')]);_0xd125b8[_0x1c48('0x19')][_0x1c48('0x72')]=_0xd125b8['channel'];_0xd125b8[_0x1c48('0x19')][_0x1c48('0x73')]=_0xd125b8[_0x1c48('0x72')];_0xd125b8['message'][_0x1c48('0x74')]='accept';_0xd125b8['message'][_0x1c48('0x46')]=htmlToText[_0x1c48('0x75')](_0xd125b8[_0x1c48('0x19')]['body']);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x1c48('0x76'),'message':_0xd125b8[_0x1c48('0x19')]},client9002)[_0x1c48('0x11')](function(){return _0xd125b8;});}return _0xd125b8;}return null;})['then'](respondWithResult(_0x126c13,null))[_0x1c48('0x1b')](handleError(_0x126c13,null));};exports[_0x1c48('0x77')]=function(_0x9d7517,_0x16f179){var _0x28d40e={'agent':{},'channel':'mail'};if(_0x9d7517[_0x1c48('0x46')]['id']){delete _0x9d7517[_0x1c48('0x46')]['id'];}_0x9d7517['body'][_0x1c48('0x5f')]=_0x9d7517[_0x1c48('0x46')]['UserId']||_0x9d7517['user']['id'];_0x28d40e[_0x1c48('0x70')]['id']=_0x9d7517[_0x1c48('0x46')][_0x1c48('0x5f')];return db[_0x1c48('0x3f')][_0x1c48('0x47')]({'where':{'id':_0x9d7517[_0x1c48('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x16f179,null))[_0x1c48('0x11')](function(_0x2ee6f4){if(_0x2ee6f4){_0x28d40e[_0x1c48('0x19')]=_0x2ee6f4[_0x1c48('0x60')]({'plain':!![]});return db[_0x1c48('0x61')][_0x1c48('0x47')]({'where':{'id':_0x2ee6f4[_0x1c48('0x62')]}});}return null;})[_0x1c48('0x11')](handleEntityNotFound(_0x16f179,null))['then'](function(_0xf8dde8){if(_0xf8dde8){_0x28d40e[_0x1c48('0x64')]=_0xf8dde8[_0x1c48('0x60')]({'plain':!![]});interaction_log[_0x1c48('0x12')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x9d7517['user']['id'],_0x9d7517[_0x1c48('0x66')][_0x1c48('0x27')],_0x9d7517[_0x1c48('0x66')][_0x1c48('0x67')],_0x28d40e[_0x1c48('0x64')]['id'],_0x9d7517[_0x1c48('0x46')]?JSON['stringify'](_0x9d7517[_0x1c48('0x46')]):_0x1c48('0x68'));return respondWithRpcPromise(_0x1c48('0x78'),'rejectMessage',_0x28d40e);}return null;})[_0x1c48('0x11')](function(_0x375b2f){var _0x5018c8=_0x1c48('0x6b')+_0x375b2f[_0x1c48('0x19')]['ContactId'];return db[_0x1c48('0x6d')][_0x1c48('0x2d')](_0x5018c8,{'type':db['Sequelize'][_0x1c48('0x6e')][_0x1c48('0x79')],'raw':!![]})[_0x1c48('0x11')](function(_0x393941){return _0x393941;});})['then'](function(_0x10ef39){if(_0x10ef39){_0x28d40e[_0x1c48('0x19')][_0x1c48('0x7a')]=_0x10ef39[0x0];if(!_0x9d7517[_0x1c48('0x46')][_0x1c48('0x5f')])return;return db[_0x1c48('0x6f')][_0x1c48('0x47')]({'where':{'id':_0x9d7517[_0x1c48('0x46')]['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0x1c48('0x7b'),'internal'],'raw':!![]});}return null;})[_0x1c48('0x11')](function(_0x46e072){if(!_0x46e072)return null;_0x28d40e[_0x1c48('0x19')][_0x1c48('0x70')]=_0x46e072;return _0x28d40e;})[_0x1c48('0x11')](function(_0x31ad58){if(_0x31ad58){_0x31ad58[_0x1c48('0x19')][_0x1c48('0x7c')]=util[_0x1c48('0x5b')](_0x1c48('0x7d'),_0x9d7517['user']['name']);_0x31ad58['message'][_0x1c48('0x72')]=_0x28d40e['channel'];_0x31ad58[_0x1c48('0x19')][_0x1c48('0x73')]=_0x28d40e[_0x1c48('0x72')];_0x31ad58[_0x1c48('0x19')][_0x1c48('0x74')]='reject';_0x31ad58[_0x1c48('0x19')][_0x1c48('0x46')]=htmlToText[_0x1c48('0x75')](_0x28d40e[_0x1c48('0x19')][_0x1c48('0x46')]);respondWithRpcPromise(_0x1c48('0x7e'),_0x1c48('0x7e'),{'event':'rejectmessage','message':_0x31ad58['message']},client9002);return _0x28d40e;}return null;})[_0x1c48('0x11')](respondWithResult(_0x16f179,null))['catch'](handleError(_0x16f179,null));};exports[_0x1c48('0x7f')]=function(_0x4c13c7,_0x85d91e){var _0x46058e=moment()['unix']()[_0x1c48('0x80')]();var _0xb369b7=path[_0x1c48('0x53')](config[_0x1c48('0x54')],'server',_0x1c48('0x81'),'tmp');var _0x33abb9=path['join'](config[_0x1c48('0x54')],_0x1c48('0x82'),_0x1c48('0x81'),_0x1c48('0x52'));var _0x145fc1=util[_0x1c48('0x5b')](_0x1c48('0x83'),_0x46058e);return db[_0x1c48('0x3f')]['find']({'where':{'id':_0x4c13c7[_0x1c48('0x44')]['id']},'attributes':['id',_0x1c48('0x46'),'from','to','cc',_0x1c48('0x84'),_0x1c48('0x85'),_0x1c48('0x86')],'include':_0x4c13c7[_0x1c48('0x2d')][_0x1c48('0x52')]?[{'model':db[_0x1c48('0x87')],'as':'Attachments'}]:undefined})[_0x1c48('0x11')](handleEntityNotFound(_0x85d91e,null))[_0x1c48('0x11')](function(_0x1a07b5){if(_0x1a07b5){var _0x3a97de=_0x1a07b5;var _0xdfcf4={'from':_0x3a97de[_0x1c48('0x88')],'to':_0x3a97de['to'],'subject':_0x3a97de['subject'],'html':htmlEntities[_0x1c48('0x89')](_0x3a97de['body']),'headers':{'Date':moment(_0x3a97de[_0x1c48('0x86')])[_0x1c48('0x5b')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1a07b5['cc']){_0xdfcf4['headers']['Cc']=_0x1a07b5['cc'];}if(_0x1a07b5[_0x1c48('0x84')]){_0xdfcf4[_0x1c48('0x8a')]['Bcc']=_0x1a07b5[_0x1c48('0x84')];}return new BPromise(function(_0xb6d7e6,_0x372056){if(_0x1a07b5[_0x1c48('0x8b')]){for(var _0x494a8f=0x0;_0x494a8f<_0x1a07b5[_0x1c48('0x8b')]['length'];_0x494a8f++){var _0x3478a2=_0x1a07b5[_0x1c48('0x8b')][_0x494a8f];var _0x2e02af=path[_0x1c48('0x53')](_0x33abb9,_0x3478a2[_0x1c48('0x8c')]);if(fs[_0x1c48('0x8d')](_0x2e02af)){_0xdfcf4[_0x1c48('0x52')][_0x1c48('0x8e')]({'name':_0x3478a2[_0x1c48('0x27')],'contentType':_0x3478a2[_0x1c48('0x3c')],'data':fs[_0x1c48('0x8f')](_0x2e02af)});}}}emlformat[_0x1c48('0x90')](_0xdfcf4,function(_0x41ea71,_0x2ed40e){if(_0x41ea71)return _0x372056(_0x41ea71);fs['writeFileSync'](path['join'](_0xb369b7,_0x145fc1),_0x2ed40e);return _0xb6d7e6(_0x2ed40e);});});}})[_0x1c48('0x11')](function(_0x3d4465){if(_0x3d4465){return _0x85d91e[_0x1c48('0x7f')](path[_0x1c48('0x53')](_0xb369b7,_0x145fc1),_0x145fc1,function(_0x7b8acf){if(!_0x7b8acf)fs['unlinkSync'](path[_0x1c48('0x53')](_0xb369b7,_0x145fc1));});}})[_0x1c48('0x1b')](handleError(_0x85d91e,null));}; \ No newline at end of file +var _0x2800=['readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','util','lodash','ioredis','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','request','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','request\x20sent','catch','status','json','offset','undefined','count','limit','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','update','body','describe','create','direction','out','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','User','interface','reject','download','unix','toString','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push'];(function(_0x5e4759,_0x1f8793){var _0x1aefe3=function(_0x1be07e){while(--_0x1be07e){_0x5e4759['push'](_0x5e4759['shift']());}};_0x1aefe3(++_0x1f8793);}(_0x2800,0x148));var _0x0280=function(_0x2ba562,_0x127b75){_0x2ba562=_0x2ba562-0x0;var _0xc3dfe2=_0x2800[_0x2ba562];return _0xc3dfe2;};'use strict';var emlformat=require('eml-format');var moment=require(_0x0280('0x0'));var BPromise=require(_0x0280('0x1'));var util=require(_0x0280('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x0280('0x3'));var Redis=require(_0x0280('0x4'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x0280('0x5'))(_0x0280('0x6'));var interaction_log=require(_0x0280('0x5'))(_0x0280('0x7'));var config=require(_0x0280('0x8'));var db=require(_0x0280('0x9'))['db'];config['redis']=_[_0x0280('0xa')](config[_0x0280('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0280('0xc'))(new Redis(config[_0x0280('0xb')]));var htmlEntities=require('html-entities');require(_0x0280('0xd'))[_0x0280('0xe')](socket);var jayson=require(_0x0280('0xf'));var client=jayson['client'][_0x0280('0x10')]({'port':0x232c});var client9003=jayson[_0x0280('0x11')][_0x0280('0x10')]({'port':0x232b});var client9002=jayson[_0x0280('0x11')][_0x0280('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x18ee22,_0x34aa9a,_0x18d8b6,_0x54e020){return new BPromise(function(_0x401cda,_0x570dba){var _0xe2607b=_0x54e020||client;return _0xe2607b[_0x0280('0x12')](_0x18ee22,_0x18d8b6)[_0x0280('0x13')](function(_0xd9684e){logger['info']('MailMessage,\x20%s,\x20%s',_0x34aa9a,'request\x20sent');logger[_0x0280('0x14')](_0x0280('0x15'),_0x34aa9a,'request\x20sent',JSON[_0x0280('0x16')](_0xd9684e));if(_0xd9684e[_0x0280('0x17')]){if(_0xd9684e['error'][_0x0280('0x18')]===0x1f4){logger[_0x0280('0x17')](_0x0280('0x19'),_0x34aa9a,_0xd9684e[_0x0280('0x17')][_0x0280('0x1a')]);return _0x570dba(_0xd9684e['error'][_0x0280('0x1a')]);}logger[_0x0280('0x17')]('MailMessage,\x20%s,\x20%s',_0x34aa9a,_0xd9684e['error'][_0x0280('0x1a')]);return _0x401cda(_0xd9684e[_0x0280('0x17')][_0x0280('0x1a')]);}else{logger[_0x0280('0x1b')](_0x0280('0x19'),_0x34aa9a,_0x0280('0x1c'));_0x401cda(_0xd9684e['result'][_0x0280('0x1a')]);}})[_0x0280('0x1d')](function(_0x292a6f){logger[_0x0280('0x17')](_0x0280('0x19'),_0x34aa9a,_0x292a6f);_0x570dba(_0x292a6f);});});}function respondWithResult(_0x31c18e,_0x394a6c){_0x394a6c=_0x394a6c||0xc8;return function(_0x5310b1){if(_0x5310b1){return _0x31c18e[_0x0280('0x1e')](_0x394a6c)[_0x0280('0x1f')](_0x5310b1);}};}function respondWithFilteredResult(_0x356c47,_0x15af32){return function(_0x464a0e){if(_0x464a0e){var _0x4d8829=typeof _0x15af32[_0x0280('0x20')]==='undefined'&&typeof _0x15af32['limit']===_0x0280('0x21');var _0x23cfe3=_0x464a0e[_0x0280('0x22')];var _0x42b80b=_0x4d8829?0x0:_0x15af32[_0x0280('0x20')];var _0x24ade4=_0x4d8829?_0x464a0e[_0x0280('0x22')]:_0x15af32[_0x0280('0x20')]+_0x15af32[_0x0280('0x23')];var _0x51ab62;if(_0x24ade4>=_0x23cfe3){_0x24ade4=_0x23cfe3;_0x51ab62=0xc8;}else{_0x51ab62=0xce;}_0x356c47[_0x0280('0x1e')](_0x51ab62);return _0x356c47['set'](_0x0280('0x24'),_0x42b80b+'-'+_0x24ade4+'/'+_0x23cfe3)[_0x0280('0x1f')](_0x464a0e);}return null;};}function saveUpdates(_0x48af3a){return function(_0x21564a){if(_0x21564a){return _0x21564a['update'](_0x48af3a)[_0x0280('0x13')](function(_0x3c5ec8){return _0x3c5ec8;});}return null;};}function removeEntity(_0x43c1ba){return function(_0x69dfc0){if(_0x69dfc0){return _0x69dfc0[_0x0280('0x25')]()[_0x0280('0x13')](function(){_0x43c1ba[_0x0280('0x1e')](0xcc)[_0x0280('0x26')]();});}};}function handleEntityNotFound(_0x30ff3e){return function(_0x28cb0d){if(!_0x28cb0d){_0x30ff3e[_0x0280('0x27')](0x194);}return _0x28cb0d;};}function handleError(_0x2692d2,_0x147204){_0x147204=_0x147204||0x1f4;return function(_0x5d0f20){logger[_0x0280('0x17')](_0x5d0f20[_0x0280('0x28')]);if(_0x5d0f20['name']){delete _0x5d0f20[_0x0280('0x29')];}_0x2692d2[_0x0280('0x1e')](_0x147204)[_0x0280('0x2a')](_0x5d0f20);};}exports[_0x0280('0x2b')]=function(_0x4f9489,_0x642ac){var _0x2d650b={},_0x342ba0={},_0x63773a={'count':0x0,'rows':[]};var _0x32b6ba=_[_0x0280('0x2c')](db[_0x0280('0x2d')][_0x0280('0x2e')],function(_0x56aaae){return{'name':_0x56aaae[_0x0280('0x2f')],'type':_0x56aaae['type'][_0x0280('0x30')]};});_0x342ba0[_0x0280('0x31')]=_[_0x0280('0x2c')](_0x32b6ba,_0x0280('0x29'));_0x342ba0[_0x0280('0x32')]=_[_0x0280('0x33')](_0x4f9489['query']);_0x342ba0['filters']=_[_0x0280('0x34')](_0x342ba0[_0x0280('0x31')],_0x342ba0['query']);_0x2d650b[_0x0280('0x35')]=_[_0x0280('0x34')](_0x342ba0['model'],qs[_0x0280('0x36')](_0x4f9489[_0x0280('0x32')][_0x0280('0x36')]));_0x2d650b[_0x0280('0x35')]=_0x2d650b['attributes'][_0x0280('0x37')]?_0x2d650b[_0x0280('0x35')]:_0x342ba0[_0x0280('0x31')];if(!_0x4f9489[_0x0280('0x32')][_0x0280('0x38')](_0x0280('0x39'))){_0x2d650b[_0x0280('0x23')]=qs['limit'](_0x4f9489[_0x0280('0x32')]['limit']);_0x2d650b[_0x0280('0x20')]=qs['offset'](_0x4f9489[_0x0280('0x32')][_0x0280('0x20')]);}_0x2d650b[_0x0280('0x3a')]=qs[_0x0280('0x3b')](_0x4f9489[_0x0280('0x32')][_0x0280('0x3b')]);_0x2d650b['where']=qs[_0x0280('0x3c')](_[_0x0280('0x3d')](_0x4f9489[_0x0280('0x32')],_0x342ba0['filters']),_0x32b6ba);if(_0x4f9489[_0x0280('0x32')][_0x0280('0x3e')]){_0x2d650b[_0x0280('0x3f')]=_[_0x0280('0x40')](_0x2d650b[_0x0280('0x3f')],{'$or':_[_0x0280('0x2c')](_0x32b6ba,function(_0x1c2065){if(_0x1c2065[_0x0280('0x41')]!==_0x0280('0x42')){var _0x4be55c={};_0x4be55c[_0x1c2065[_0x0280('0x29')]]={'$like':'%'+_0x4f9489[_0x0280('0x32')][_0x0280('0x3e')]+'%'};return _0x4be55c;}})});}_0x2d650b=_[_0x0280('0x40')]({},_0x2d650b,_0x4f9489[_0x0280('0x43')]);var _0x5f1923={'where':_0x2d650b[_0x0280('0x3f')]};return db[_0x0280('0x2d')][_0x0280('0x22')](_0x5f1923)[_0x0280('0x13')](function(_0x33506f){_0x63773a['count']=_0x33506f;if(_0x4f9489['query'][_0x0280('0x44')]){_0x2d650b[_0x0280('0x45')]=[{'all':!![]}];}return db[_0x0280('0x2d')]['findAll'](_0x2d650b);})['then'](function(_0x3200bc){_0x63773a[_0x0280('0x46')]=_0x3200bc;return _0x63773a;})[_0x0280('0x13')](respondWithFilteredResult(_0x642ac,_0x2d650b))[_0x0280('0x1d')](handleError(_0x642ac,null));};exports[_0x0280('0x47')]=function(_0x5e564e,_0x57077e){var _0x3ca243={'raw':!![],'where':{'id':_0x5e564e[_0x0280('0x48')]['id']}},_0x3294e4={};_0x3294e4[_0x0280('0x31')]=_[_0x0280('0x33')](db[_0x0280('0x2d')][_0x0280('0x2e')]);_0x3294e4[_0x0280('0x32')]=_[_0x0280('0x33')](_0x5e564e['query']);_0x3294e4['filters']=_[_0x0280('0x34')](_0x3294e4[_0x0280('0x31')],_0x3294e4['query']);_0x3ca243[_0x0280('0x35')]=_[_0x0280('0x34')](_0x3294e4[_0x0280('0x31')],qs[_0x0280('0x36')](_0x5e564e[_0x0280('0x32')][_0x0280('0x36')]));_0x3ca243[_0x0280('0x35')]=_0x3ca243[_0x0280('0x35')][_0x0280('0x37')]?_0x3ca243[_0x0280('0x35')]:_0x3294e4['model'];if(_0x5e564e[_0x0280('0x32')][_0x0280('0x44')]){_0x3ca243[_0x0280('0x45')]=[{'all':!![]}];}_0x3ca243=_[_0x0280('0x40')]({},_0x3ca243,_0x5e564e[_0x0280('0x43')]);return db[_0x0280('0x2d')][_0x0280('0x49')](_0x3ca243)[_0x0280('0x13')](handleEntityNotFound(_0x57077e,null))[_0x0280('0x13')](respondWithResult(_0x57077e,null))[_0x0280('0x1d')](handleError(_0x57077e,null));};exports[_0x0280('0x4a')]=function(_0x266bcc,_0x10c87a){if(_0x266bcc[_0x0280('0x4b')]['id']){delete _0x266bcc[_0x0280('0x4b')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x266bcc[_0x0280('0x48')]['id']}})[_0x0280('0x13')](handleEntityNotFound(_0x10c87a,null))[_0x0280('0x13')](saveUpdates(_0x266bcc[_0x0280('0x4b')],null))['then'](respondWithResult(_0x10c87a,null))[_0x0280('0x1d')](handleError(_0x10c87a,null));};exports[_0x0280('0x25')]=function(_0x3d0841,_0x1821b9){return db['MailMessage'][_0x0280('0x49')]({'where':{'id':_0x3d0841[_0x0280('0x48')]['id']}})[_0x0280('0x13')](handleEntityNotFound(_0x1821b9,null))[_0x0280('0x13')](removeEntity(_0x1821b9,null))[_0x0280('0x1d')](handleError(_0x1821b9,null));};exports[_0x0280('0x4c')]=function(_0x874d3f,_0x517fd7){return db[_0x0280('0x2d')][_0x0280('0x4c')]()[_0x0280('0x13')](respondWithResult(_0x517fd7,null))[_0x0280('0x1d')](handleError(_0x517fd7,null));};exports[_0x0280('0x4d')]=function(_0x27d7cf,_0x3ca3c9){return db['MailMessage']['create'](_0x27d7cf[_0x0280('0x4b')])[_0x0280('0x13')](function(_0x6a58fa){if(_0x6a58fa){if(_0x6a58fa[_0x0280('0x4e')]===_0x0280('0x4f')&&!_0x6a58fa['secret']){var _0x3c8f76,_0x1a8f4e,_0x538b69;if(_0x27d7cf[_0x0280('0x4b')]['to']){_0x1a8f4e=_0x27d7cf[_0x0280('0x4b')]['to'][_0x0280('0x50')](',')[0x0];}return db[_0x0280('0x51')]['findOne']({'where':{'id':_0x6a58fa[_0x0280('0x52')]},'include':[{'model':db[_0x0280('0x53')],'as':_0x0280('0x54'),'include':[{'model':db[_0x0280('0x55')],'as':_0x0280('0x56'),'where':{'email':_0x1a8f4e},'limit':0x1,'order':[[_0x0280('0x57'),'DESC']]}]},{'model':db[_0x0280('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0280('0x59'),'raw':!![]}]}]})[_0x0280('0x13')](function(_0x5a6e46){_0x3c8f76=_0x5a6e46;if(!_0x3c8f76||!_0x3c8f76[_0x0280('0x5a')])return;var _0x50e9d3=_0x3c8f76[_0x0280('0x5b')]();if(_0x27d7cf['body'][_0x0280('0x5c')]&&_0x27d7cf[_0x0280('0x4b')][_0x0280('0x5c')]['length']){for(var _0x11d240=0x0;_0x11d240<_0x27d7cf[_0x0280('0x4b')][_0x0280('0x5c')]['length'];_0x11d240+=0x1){_0x27d7cf['body'][_0x0280('0x5c')][_0x11d240]={'filename':_0x27d7cf[_0x0280('0x4b')][_0x0280('0x5c')][_0x11d240][_0x0280('0x29')],'path':path[_0x0280('0x5d')](config[_0x0280('0x5e')],_0x0280('0x5f'),_0x27d7cf[_0x0280('0x4b')]['attachments'][_0x11d240][_0x0280('0x60')])};}}_0x538b69={'account':_0x50e9d3,'message':_0x27d7cf[_0x0280('0x4b')]};return;})[_0x0280('0x13')](function(){if(_0x3c8f76[_0x0280('0x54')]){if(_0x3c8f76[_0x0280('0x54')][_0x0280('0x56')][_0x0280('0x37')]){return _0x3c8f76[_0x0280('0x54')][_0x0280('0x56')][0x0];}else{return db['CmContact'][_0x0280('0x4d')](_[_0x0280('0xa')](_0x27d7cf[_0x0280('0x4b')],{'firstName':_0x27d7cf['body']['to'],'email':_0x27d7cf[_0x0280('0x4b')]['to'],'phone':_0x27d7cf[_0x0280('0x4b')]['to'],'ListId':_0x3c8f76['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x0280('0x13')](function(){if(_0x538b69){return respondWithRpcPromise(_0x0280('0x61'),_0x0280('0x62'),_0x538b69,client9003)['then'](function(_0x5a76cc){return _0x6a58fa['update']({'read':!![],'messageId':_0x5a76cc[_0x0280('0x63')],'sentAt':moment()[_0x0280('0x64')](_0x0280('0x65'))});})[_0x0280('0x1d')](function(_0x52f964){logger[_0x0280('0x17')]('%s',JSON[_0x0280('0x16')](_0x52f964));return _0x6a58fa;});}return _0x6a58fa;});}return _0x6a58fa;}})[_0x0280('0x13')](respondWithResult(_0x3ca3c9,0xc9))['catch'](handleError(_0x3ca3c9,null));};exports[_0x0280('0x66')]=function(_0x1e5b95,_0x3a1fde){var _0x173a23={'agent':{},'channel':_0x0280('0x67')};if(_0x1e5b95[_0x0280('0x4b')]['id']){delete _0x1e5b95[_0x0280('0x4b')]['id'];}_0x1e5b95[_0x0280('0x4b')][_0x0280('0x68')]=!![];_0x1e5b95['body'][_0x0280('0x69')]=moment()[_0x0280('0x64')](_0x0280('0x65'));_0x1e5b95[_0x0280('0x4b')][_0x0280('0x6a')]=_0x1e5b95['body'][_0x0280('0x6a')]||_0x1e5b95[_0x0280('0x6b')]['id'];_0x173a23[_0x0280('0x6c')]['id']=_0x1e5b95[_0x0280('0x4b')][_0x0280('0x6a')];return db[_0x0280('0x2d')][_0x0280('0x49')]({'where':{'id':_0x1e5b95[_0x0280('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3a1fde,null))[_0x0280('0x13')](saveUpdates(_0x1e5b95[_0x0280('0x4b')],null))[_0x0280('0x13')](function(_0x1ae12c){if(_0x1ae12c){_0x173a23['message']=_0x1ae12c[_0x0280('0x6d')]({'plain':!![]});return db[_0x0280('0x6e')][_0x0280('0x49')]({'where':{'id':_0x1ae12c[_0x0280('0x6f')]}});}return null;})[_0x0280('0x13')](handleEntityNotFound(_0x3a1fde,null))[_0x0280('0x13')](function(_0x307fb2){if(_0x307fb2){return _0x307fb2['update']({'UserId':_0x1e5b95[_0x0280('0x4b')][_0x0280('0x6a')],'read1stAt':_[_0x0280('0x70')](_0x307fb2[_0x0280('0x71')])?moment()[_0x0280('0x64')](_0x0280('0x65')):undefined});}return null;})[_0x0280('0x13')](function(_0x815397){if(_0x815397){_0x173a23[_0x0280('0x72')]=_0x815397[_0x0280('0x6d')]({'plain':!![]});interaction_log[_0x0280('0x1b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1e5b95[_0x0280('0x6b')]['id'],_0x1e5b95['user']['name'],_0x1e5b95[_0x0280('0x6b')][_0x0280('0x73')],_0x173a23['interaction']['id'],_0x1e5b95[_0x0280('0x4b')]?JSON[_0x0280('0x16')](_0x1e5b95[_0x0280('0x4b')]):'null');return respondWithRpcPromise(_0x0280('0x74'),'acceptMessage',_0x173a23);}return null;})[_0x0280('0x13')](function(_0x31c1da){var _0x1f5cf1=_0x0280('0x75')+_0x31c1da[_0x0280('0x1a')][_0x0280('0x76')];return db[_0x0280('0x77')][_0x0280('0x32')](_0x1f5cf1,{'type':db[_0x0280('0x78')][_0x0280('0x79')][_0x0280('0x7a')],'raw':!![]})[_0x0280('0x13')](function(_0x4b26ed){return _0x4b26ed;});})[_0x0280('0x13')](function(_0x18baab){if(_0x18baab){_0x173a23[_0x0280('0x1a')][_0x0280('0x7b')]=_0x18baab[0x0];if(!_0x1e5b95[_0x0280('0x4b')]['UserId'])return;return db['User'][_0x0280('0x49')]({'where':{'id':_0x1e5b95['body'][_0x0280('0x6a')],'role':_0x0280('0x6c')},'attributes':['id','name',_0x0280('0x7c'),_0x0280('0x7d'),_0x0280('0x7e')],'raw':!![]});}return null;})[_0x0280('0x13')](function(_0x4340c8){if(!_0x4340c8)return null;_0x173a23['message'][_0x0280('0x6c')]=_0x4340c8;return _0x173a23;})['then'](function(_0x55ce0b){if(_0x55ce0b){if(_0x1e5b95[_0x0280('0x4b')]['manual']){_0x173a23['message']['interface']=util['format'](_0x0280('0x7f'),_0x1e5b95[_0x0280('0x6b')]['name']);_0x173a23[_0x0280('0x1a')]['channel']=_0x173a23[_0x0280('0x80')];_0x173a23['message'][_0x0280('0x81')]=_0x173a23[_0x0280('0x80')];_0x173a23[_0x0280('0x1a')][_0x0280('0x82')]=_0x0280('0x66');_0x173a23[_0x0280('0x1a')]['body']=htmlToText[_0x0280('0x83')](_0x173a23[_0x0280('0x1a')][_0x0280('0x4b')]);return respondWithRpcPromise('EventManager',_0x0280('0x84'),{'event':_0x0280('0x85'),'message':_0x173a23[_0x0280('0x1a')]},client9002)[_0x0280('0x13')](function(){return _0x173a23;});}return _0x173a23;}return null;})['then'](respondWithResult(_0x3a1fde,null))[_0x0280('0x1d')](handleError(_0x3a1fde,null));};exports['reject']=function(_0x39cc79,_0x2d0555){var _0x364586={'agent':{},'channel':_0x0280('0x67')};if(_0x39cc79[_0x0280('0x4b')]['id']){delete _0x39cc79['body']['id'];}_0x39cc79['body'][_0x0280('0x6a')]=_0x39cc79[_0x0280('0x4b')][_0x0280('0x6a')]||_0x39cc79[_0x0280('0x6b')]['id'];_0x364586['agent']['id']=_0x39cc79[_0x0280('0x4b')][_0x0280('0x6a')];return db[_0x0280('0x2d')][_0x0280('0x49')]({'where':{'id':_0x39cc79[_0x0280('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d0555,null))[_0x0280('0x13')](function(_0x4633a6){if(_0x4633a6){_0x364586[_0x0280('0x1a')]=_0x4633a6[_0x0280('0x6d')]({'plain':!![]});return db[_0x0280('0x6e')][_0x0280('0x49')]({'where':{'id':_0x4633a6[_0x0280('0x6f')]}});}return null;})[_0x0280('0x13')](handleEntityNotFound(_0x2d0555,null))[_0x0280('0x13')](function(_0x3ed654){if(_0x3ed654){_0x364586['interaction']=_0x3ed654['get']({'plain':!![]});interaction_log['info'](_0x0280('0x86'),_0x39cc79[_0x0280('0x6b')]['id'],_0x39cc79[_0x0280('0x6b')][_0x0280('0x29')],_0x39cc79[_0x0280('0x6b')][_0x0280('0x73')],_0x364586[_0x0280('0x72')]['id'],_0x39cc79[_0x0280('0x4b')]?JSON['stringify'](_0x39cc79[_0x0280('0x4b')]):_0x0280('0x87'));return respondWithRpcPromise(_0x0280('0x88'),_0x0280('0x89'),_0x364586);}return null;})['then'](function(_0x174daa){var _0x19f8f6=_0x0280('0x75')+_0x174daa[_0x0280('0x1a')][_0x0280('0x76')];return db['sequelize'][_0x0280('0x32')](_0x19f8f6,{'type':db['Sequelize'][_0x0280('0x79')][_0x0280('0x7a')],'raw':!![]})['then'](function(_0x2ef1b9){return _0x2ef1b9;});})[_0x0280('0x13')](function(_0x39899d){if(_0x39899d){_0x364586[_0x0280('0x1a')][_0x0280('0x7b')]=_0x39899d[0x0];if(!_0x39cc79[_0x0280('0x4b')][_0x0280('0x6a')])return;return db[_0x0280('0x8a')][_0x0280('0x49')]({'where':{'id':_0x39cc79[_0x0280('0x4b')][_0x0280('0x6a')],'role':_0x0280('0x6c')},'attributes':['id',_0x0280('0x29'),_0x0280('0x7c'),'email',_0x0280('0x7e')],'raw':!![]});}return null;})[_0x0280('0x13')](function(_0x41874e){if(!_0x41874e)return null;_0x364586[_0x0280('0x1a')][_0x0280('0x6c')]=_0x41874e;return _0x364586;})[_0x0280('0x13')](function(_0x12533e){if(_0x12533e){_0x12533e[_0x0280('0x1a')][_0x0280('0x8b')]=util[_0x0280('0x64')](_0x0280('0x7f'),_0x39cc79[_0x0280('0x6b')][_0x0280('0x29')]);_0x12533e[_0x0280('0x1a')]['channel']=_0x364586[_0x0280('0x80')];_0x12533e['message'][_0x0280('0x81')]=_0x364586[_0x0280('0x80')];_0x12533e[_0x0280('0x1a')][_0x0280('0x82')]=_0x0280('0x8c');_0x12533e['message'][_0x0280('0x4b')]=htmlToText[_0x0280('0x83')](_0x364586['message'][_0x0280('0x4b')]);respondWithRpcPromise(_0x0280('0x84'),'EventManager',{'event':'rejectmessage','message':_0x12533e[_0x0280('0x1a')]},client9002);return _0x364586;}return null;})['then'](respondWithResult(_0x2d0555,null))['catch'](handleError(_0x2d0555,null));};exports[_0x0280('0x8d')]=function(_0x11189b,_0x8ec07a){var _0xa77b69=moment()[_0x0280('0x8e')]()[_0x0280('0x8f')]();var _0x5dc421=path[_0x0280('0x5d')](config[_0x0280('0x5e')],_0x0280('0x90'),_0x0280('0x91'),_0x0280('0x92'));var _0x4a8efe=path[_0x0280('0x5d')](config[_0x0280('0x5e')],_0x0280('0x90'),'files',_0x0280('0x5c'));var _0x456bea=util[_0x0280('0x64')]('message-%s.eml',_0xa77b69);return db[_0x0280('0x2d')][_0x0280('0x49')]({'where':{'id':_0x11189b['params']['id']},'attributes':['id',_0x0280('0x4b'),_0x0280('0x93'),'to','cc',_0x0280('0x94'),_0x0280('0x95'),_0x0280('0x96')],'include':_0x11189b[_0x0280('0x32')][_0x0280('0x5c')]?[{'model':db[_0x0280('0x97')],'as':_0x0280('0x98')}]:undefined})[_0x0280('0x13')](handleEntityNotFound(_0x8ec07a,null))[_0x0280('0x13')](function(_0x37630e){if(_0x37630e){var _0x1d0e46=_0x37630e;var _0x220c51={'from':_0x1d0e46[_0x0280('0x93')],'to':_0x1d0e46['to'],'subject':_0x1d0e46['subject'],'html':htmlEntities[_0x0280('0x99')](_0x1d0e46[_0x0280('0x4b')]),'headers':{'Date':moment(_0x1d0e46[_0x0280('0x96')])['format'](_0x0280('0x9a'))},'attachments':[]};if(_0x37630e['cc']){_0x220c51[_0x0280('0x9b')]['Cc']=_0x37630e['cc'];}if(_0x37630e[_0x0280('0x94')]){_0x220c51[_0x0280('0x9b')]['Bcc']=_0x37630e[_0x0280('0x94')];}return new BPromise(function(_0x4d8026,_0x59f230){if(_0x37630e['Attachments']){for(var _0x48781a=0x0;_0x48781a<_0x37630e[_0x0280('0x98')]['length'];_0x48781a++){var _0x3dda40=_0x37630e[_0x0280('0x98')][_0x48781a];var _0x1b199d=path[_0x0280('0x5d')](_0x4a8efe,_0x3dda40[_0x0280('0x60')]);if(fs[_0x0280('0x9c')](_0x1b199d)){_0x220c51[_0x0280('0x5c')][_0x0280('0x9d')]({'name':_0x3dda40[_0x0280('0x29')],'contentType':_0x3dda40[_0x0280('0x41')],'data':fs[_0x0280('0x9e')](_0x1b199d)});}}}emlformat[_0x0280('0x9f')](_0x220c51,function(_0xf0c88e,_0x3b0dc7){if(_0xf0c88e)return _0x59f230(_0xf0c88e);fs[_0x0280('0xa0')](path['join'](_0x5dc421,_0x456bea),_0x3b0dc7);return _0x4d8026(_0x3b0dc7);});});}})[_0x0280('0x13')](function(_0x4a6a33){if(_0x4a6a33){return _0x8ec07a['download'](path[_0x0280('0x5d')](_0x5dc421,_0x456bea),_0x456bea,function(_0x42c6bd){if(!_0x42c6bd)fs[_0x0280('0xa1')](path[_0x0280('0x5d')](_0x5dc421,_0x456bea));});}})[_0x0280('0x1d')](handleError(_0x8ec07a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a85130f..58f7d46 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 _0x75a5=['save','update','remove','emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x75a5,0x92));var _0x575a=function(_0x37525d,_0x31a26f){_0x37525d=_0x37525d-0x0;var _0x40c836=_0x75a5[_0x37525d];return _0x40c836;};'use strict';var EventEmitter=require(_0x575a('0x0'));var MailMessage=require(_0x575a('0x1'))['db'][_0x575a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x575a('0x3')](0x0);var events={'afterCreate':_0x575a('0x4'),'afterUpdate':_0x575a('0x5'),'afterDestroy':_0x575a('0x6')};function emitEvent(_0xc87f86){return function(_0x53e9c7,_0x587392,_0x36ec51){MailMessageEvents[_0x575a('0x7')](_0xc87f86+':'+_0x53e9c7['id'],_0x53e9c7);MailMessageEvents[_0x575a('0x7')](_0xc87f86,_0x53e9c7);_0x36ec51(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x575a('0x8')](e,emitEvent(event));}}module[_0x575a('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xc40c=['exports','events','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1296de,_0x1c9e29){var _0x5832cc=function(_0x27593c){while(--_0x27593c){_0x1296de['push'](_0x1296de['shift']());}};_0x5832cc(++_0x1c9e29);}(_0xc40c,0x1cf));var _0xcc40=function(_0x19e1e9,_0x50de49){_0x19e1e9=_0x19e1e9-0x0;var _0x5d441b=_0xc40c[_0x19e1e9];return _0x5d441b;};'use strict';var EventEmitter=require(_0xcc40('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcc40('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc40('0x2'),'afterDestroy':_0xcc40('0x3')};function emitEvent(_0x4f2fcd){return function(_0x20252d,_0xb53a52,_0x819ecf){MailMessageEvents[_0xcc40('0x4')](_0x4f2fcd+':'+_0x20252d['id'],_0x20252d);MailMessageEvents[_0xcc40('0x4')](_0x4f2fcd,_0x20252d);_0x819ecf(null);};}for(var e in events){if(events[_0xcc40('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xcc40('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9096860..175237f 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 _0x41ce=['toLowerCase','direction','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString'];(function(_0x321655,_0x31f687){var _0x2f79d2=function(_0x10a1ee){while(--_0x10a1ee){_0x321655['push'](_0x321655['shift']());}};_0x2f79d2(++_0x31f687);}(_0x41ce,0x1a1));var _0xe41c=function(_0x259913,_0x16ba9b){_0x259913=_0x259913-0x0;var _0x4ff013=_0x41ce[_0x259913];return _0x4ff013;};'use strict';var _=require('lodash');var util=require(_0xe41c('0x0'));var logger=require(_0xe41c('0x1'))('api');var moment=require(_0xe41c('0x2'));var BPromise=require(_0xe41c('0x3'));var rp=require('request-promise');var htmlToText=require(_0xe41c('0x4'));var fs=require('fs');var path=require(_0xe41c('0x5'));var rimraf=require(_0xe41c('0x6'));var config=require(_0xe41c('0x7'));var attributes=require(_0xe41c('0x8'));module['exports']=function(_0x2cdb17,_0x55b158){return _0x2cdb17['define'](_0xe41c('0x9'),attributes,{'tableName':_0xe41c('0xa'),'paranoid':![],'indexes':[{'name':_0xe41c('0xb'),'fields':[_0xe41c('0xb')]},{'name':'fti_mail_messages','fields':[_0xe41c('0xc'),_0xe41c('0xd')],'type':_0xe41c('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24b731,_0x269b80,_0x554b50){if(_0x24b731[_0xe41c('0xf')]){_0x24b731[_0xe41c('0xc')]=htmlToText[_0xe41c('0x10')](_0x24b731['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x554b50(null,_0x269b80);},'afterCreate':function(_0xf5fafe,_0x1f2ea1,_0x4ae516){var _0x371995=_0x2cdb17['models'];var _0x2c4eec=_0xf5fafe['get']({'plain':!![]});if(_0x2c4eec['direction'][_0xe41c('0x11')]()==='in'||_0x2c4eec[_0xe41c('0x12')][_0xe41c('0x11')]()===_0xe41c('0x13')&&!_0x2c4eec[_0xe41c('0x14')]&&!_[_0xe41c('0x15')](_0x2c4eec['UserId'])){_0x371995[_0xe41c('0x16')][_0xe41c('0x17')]({'where':{'id':_0x2c4eec[_0xe41c('0x18')]}})[_0xe41c('0x19')](function(_0x564f13){if(_0x564f13){_0x564f13[_0xe41c('0x1a')]({'lastMsgAt':_0x2c4eec[_0xe41c('0x1b')],'lastMsgDirection':_0x2c4eec[_0xe41c('0x12')][_0xe41c('0x11')]()});}})[_0xe41c('0x1c')](function(_0x173133){console['error'](_0x173133);});}_0x4ae516();}},'charset':_0xe41c('0x1d'),'collate':_0xe41c('0x1e')});}; \ No newline at end of file +var _0xb813=['rimraf','../../config/environment','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','isNil','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','html-to-text','path'];(function(_0x55c485,_0x2c9d9){var _0x7923af=function(_0x3f391f){while(--_0x3f391f){_0x55c485['push'](_0x55c485['shift']());}};_0x7923af(++_0x2c9d9);}(_0xb813,0x99));var _0x3b81=function(_0x4670e,_0x19e50c){_0x4670e=_0x4670e-0x0;var _0xab329a=_0xb813[_0x4670e];return _0xab329a;};'use strict';var _=require(_0x3b81('0x0'));var util=require('util');var logger=require(_0x3b81('0x1'))(_0x3b81('0x2'));var moment=require(_0x3b81('0x3'));var BPromise=require(_0x3b81('0x4'));var rp=require('request-promise');var htmlToText=require(_0x3b81('0x5'));var fs=require('fs');var path=require(_0x3b81('0x6'));var rimraf=require(_0x3b81('0x7'));var config=require(_0x3b81('0x8'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x174b55,_0xecc630){return _0x174b55[_0x3b81('0x9')](_0x3b81('0xa'),attributes,{'tableName':_0x3b81('0xb'),'paranoid':![],'indexes':[{'name':_0x3b81('0xc'),'fields':[_0x3b81('0xc')]},{'name':_0x3b81('0xd'),'fields':[_0x3b81('0xe'),_0x3b81('0xf')],'type':_0x3b81('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x37b8aa,_0x37e96d,_0x1fce16){if(_0x37b8aa[_0x3b81('0x11')]){_0x37b8aa[_0x3b81('0xe')]=htmlToText[_0x3b81('0x12')](_0x37b8aa[_0x3b81('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1fce16(null,_0x37e96d);},'afterCreate':function(_0x3cb671,_0x2e5544,_0xfccce4){var _0x1527c2=_0x174b55[_0x3b81('0x13')];var _0x52f607=_0x3cb671['get']({'plain':!![]});if(_0x52f607[_0x3b81('0x14')]['toLowerCase']()==='in'||_0x52f607[_0x3b81('0x14')][_0x3b81('0x15')]()===_0x3b81('0x16')&&!_0x52f607[_0x3b81('0x17')]&&!_[_0x3b81('0x18')](_0x52f607['UserId'])){_0x1527c2['MailInteraction']['findOne']({'where':{'id':_0x52f607[_0x3b81('0x19')]}})[_0x3b81('0x1a')](function(_0x397dc6){if(_0x397dc6){_0x397dc6[_0x3b81('0x1b')]({'lastMsgAt':_0x52f607[_0x3b81('0x1c')],'lastMsgDirection':_0x52f607[_0x3b81('0x14')][_0x3b81('0x15')]()});}})[_0x3b81('0x1d')](function(_0x4fbdb6){console[_0x3b81('0x1e')](_0x4fbdb6);});}_0xfccce4();}},'charset':'utf8mb4','collate':_0x3b81('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 8b51947..9b36323 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 _0xb44a=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x1f1108,_0x87574a){var _0x397e72=function(_0x4e7f30){while(--_0x4e7f30){_0x1f1108['push'](_0x1f1108['shift']());}};_0x397e72(++_0x87574a);}(_0xb44a,0x1c2));var _0xab44=function(_0x13cd20,_0x1d9211){_0x13cd20=_0x13cd20-0x0;var _0x22b6de=_0xb44a[_0x13cd20];return _0x22b6de;};'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});config[_0xab44('0x8')]=_[_0xab44('0x9')](config[_0xab44('0x8')],{'host':_0xab44('0xa'),'port':0x18eb});var socket=require(_0xab44('0xb'))(new Redis(config[_0xab44('0x8')]));require(_0xab44('0xc'))[_0xab44('0xd')](socket);function respondWithRpcPromise(_0x55c7d2,_0x2a670e,_0x500a9f){return new BPromise(function(_0x15e64e,_0x5168fa){return client['request'](_0x55c7d2,_0x500a9f)[_0xab44('0xe')](function(_0x6746cc){logger[_0xab44('0xf')](_0xab44('0x10'),_0x2a670e,_0xab44('0x11'));logger[_0xab44('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2a670e,'request\x20sent',JSON[_0xab44('0x13')](_0x6746cc));if(_0x6746cc['error']){if(_0x6746cc[_0xab44('0x14')]['code']===0x1f4){logger[_0xab44('0x14')](_0xab44('0x10'),_0x2a670e,_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);return _0x5168fa(_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2a670e,_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);return _0x15e64e(_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);}else{logger[_0xab44('0xf')](_0xab44('0x10'),_0x2a670e,_0xab44('0x11'));_0x15e64e(_0x6746cc[_0xab44('0x16')][_0xab44('0x15')]);}})[_0xab44('0x17')](function(_0x27fc7f){logger['error'](_0xab44('0x10'),_0x2a670e,_0x27fc7f);_0x5168fa(_0x27fc7f);});});}exports[_0xab44('0x18')]=function(_0x101a1b){var _0x2902ca=this;return new Promise(function(_0x29bb73,_0x5123b1){return db[_0xab44('0x19')]['create'](_0x101a1b[_0xab44('0x1a')],{'raw':_0x101a1b[_0xab44('0x1b')]?_0x101a1b[_0xab44('0x1b')][_0xab44('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3a2b1d){logger[_0xab44('0xf')](_0xab44('0x18'),_0x101a1b);logger[_0xab44('0x12')](_0xab44('0x18'),_0x101a1b,JSON[_0xab44('0x13')](_0x3a2b1d));_0x29bb73(_0x3a2b1d);})[_0xab44('0x17')](function(_0x554955){logger['error'](_0xab44('0x18'),_0x554955['message'],_0x101a1b);_0x5123b1(_0x2902ca[_0xab44('0x14')](0x1f4,_0x554955['message']));});});}; \ No newline at end of file +var _0xab40=['raw','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateMailMessage','MailMessage','create','options'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xab40,0xcd));var _0x0ab4=function(_0x3e06ff,_0x3bda75){_0x3e06ff=_0x3e06ff-0x0;var _0x1a3871=_0xab40[_0x3e06ff];return _0x1a3871;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});config[_0x0ab4('0x8')]=_[_0x0ab4('0x9')](config[_0x0ab4('0x8')],{'host':_0x0ab4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0x0ab4('0xb')](socket);function respondWithRpcPromise(_0x30e726,_0x40e4d1,_0x464f7e){return new BPromise(function(_0x413d9b,_0x24c6c1){return client[_0x0ab4('0xc')](_0x30e726,_0x464f7e)[_0x0ab4('0xd')](function(_0x4e1708){logger['info'](_0x0ab4('0xe'),_0x40e4d1,'request\x20sent');logger[_0x0ab4('0xf')](_0x0ab4('0x10'),_0x40e4d1,_0x0ab4('0x11'),JSON[_0x0ab4('0x12')](_0x4e1708));if(_0x4e1708[_0x0ab4('0x13')]){if(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x14')]===0x1f4){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x24c6c1(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);}logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x413d9b(_0x4e1708[_0x0ab4('0x13')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x40e4d1,_0x0ab4('0x11'));_0x413d9b(_0x4e1708[_0x0ab4('0x16')][_0x0ab4('0x15')]);}})['catch'](function(_0x1e3fe2){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x1e3fe2);_0x24c6c1(_0x1e3fe2);});});}exports[_0x0ab4('0x17')]=function(_0x4e7852){var _0x4ff836=this;return new Promise(function(_0xdb0797,_0x5b1ed5){return db[_0x0ab4('0x18')][_0x0ab4('0x19')](_0x4e7852['body'],{'raw':_0x4e7852[_0x0ab4('0x1a')]?_0x4e7852[_0x0ab4('0x1a')][_0x0ab4('0x1b')]===undefined?!![]:![]:!![]})[_0x0ab4('0xd')](function(_0x12d06d){logger['info']('CreateMailMessage',_0x4e7852);logger[_0x0ab4('0xf')](_0x0ab4('0x17'),_0x4e7852,JSON[_0x0ab4('0x12')](_0x12d06d));_0xdb0797(_0x12d06d);})[_0x0ab4('0x1c')](function(_0x4e4b80){logger[_0x0ab4('0x13')](_0x0ab4('0x17'),_0x4e4b80[_0x0ab4('0x15')],_0x4e7852);_0x5b1ed5(_0x4ff836['error'](0x1f4,_0x4e4b80['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 0cc8ae8..e09e85a 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 _0x5137=['mailMessage:','./mailMessage.events','remove','update','removeListener','register'];(function(_0x98641f,_0x388a00){var _0x17dde0=function(_0x2d9956){while(--_0x2d9956){_0x98641f['push'](_0x98641f['shift']());}};_0x17dde0(++_0x388a00);}(_0x5137,0x1c9));var _0x7513=function(_0x28ab6e,_0x545fb4){_0x28ab6e=_0x28ab6e-0x0;var _0xaeab39=_0x5137[_0x28ab6e];return _0xaeab39;};'use strict';var MailMessageEvents=require(_0x7513('0x0'));var events=['save',_0x7513('0x1'),_0x7513('0x2')];function createListener(_0x5e348c,_0x82f2d4){return function(_0x3cf486){_0x82f2d4['emit'](_0x5e348c,_0x3cf486);};}function removeListener(_0x14f0db,_0x29981a){return function(){MailMessageEvents[_0x7513('0x3')](_0x14f0db,_0x29981a);};}exports[_0x7513('0x4')]=function(_0xe53634){for(var _0xefb353=0x0,_0x49a090=events['length'];_0xefb353<_0x49a090;_0xefb353++){var _0x5bad5f=events[_0xefb353];var _0x13dbe8=createListener(_0x7513('0x5')+_0x5bad5f,_0xe53634);MailMessageEvents['on'](_0x5bad5f,_0x13dbe8);}}; \ No newline at end of file +var _0x2aec=['removeListener','register','mailMessage:','./mailMessage.events','remove','emit'];(function(_0x2a9b9b,_0x3801e5){var _0x592dc4=function(_0x4e9689){while(--_0x4e9689){_0x2a9b9b['push'](_0x2a9b9b['shift']());}};_0x592dc4(++_0x3801e5);}(_0x2aec,0x1dd));var _0xc2ae=function(_0x100d84,_0x503e28){_0x100d84=_0x100d84-0x0;var _0xc2d343=_0x2aec[_0x100d84];return _0xc2d343;};'use strict';var MailMessageEvents=require(_0xc2ae('0x0'));var events=['save',_0xc2ae('0x1'),'update'];function createListener(_0x157bd4,_0x341177){return function(_0xa65d64){_0x341177[_0xc2ae('0x2')](_0x157bd4,_0xa65d64);};}function removeListener(_0x4b2707,_0x5b4a3d){return function(){MailMessageEvents[_0xc2ae('0x3')](_0x4b2707,_0x5b4a3d);};}exports[_0xc2ae('0x4')]=function(_0x1e8862){for(var _0x24d14a=0x0,_0x3fbe0f=events['length'];_0x24d14a<_0x3fbe0f;_0x24d14a++){var _0x336865=events[_0x24d14a];var _0x4394a9=createListener(_0xc2ae('0x5')+_0x336865,_0x1e8862);MailMessageEvents['on'](_0x336865,_0x4394a9);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 2e3b9b3..455c118 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 _0x097e=['/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index'];(function(_0x20c4a2,_0x83cf29){var _0x151d44=function(_0x3f2f36){while(--_0x3f2f36){_0x20c4a2['push'](_0x20c4a2['shift']());}};_0x151d44(++_0x83cf29);}(_0x097e,0x133));var _0xe097=function(_0x5cdbe2,_0x15daf7){_0x5cdbe2=_0x5cdbe2-0x0;var _0x256a36=_0x097e[_0x5cdbe2];return _0x256a36;};'use strict';var multer=require(_0xe097('0x0'));var util=require(_0xe097('0x1'));var path=require(_0xe097('0x2'));var timeout=require(_0xe097('0x3'));var express=require('express');var router=express[_0xe097('0x4')]();var fs_extra=require(_0xe097('0x5'));var auth=require(_0xe097('0x6'));var interaction=require(_0xe097('0x7'));var config=require('../../config/environment');var controller=require(_0xe097('0x8'));router[_0xe097('0x9')]('/',auth[_0xe097('0xa')](),controller[_0xe097('0xb')]);router[_0xe097('0x9')](_0xe097('0xc'),auth[_0xe097('0xa')](),controller[_0xe097('0xd')]);router[_0xe097('0x9')](_0xe097('0xe'),auth[_0xe097('0xa')](),controller[_0xe097('0xf')]);router['get'](_0xe097('0x10'),auth[_0xe097('0xa')](),controller[_0xe097('0x11')]);router['get'](_0xe097('0x12'),auth[_0xe097('0xa')](),controller[_0xe097('0x13')]);router[_0xe097('0x9')]('/:id/users',auth[_0xe097('0xa')](),controller[_0xe097('0x14')]);router[_0xe097('0x15')]('/',auth[_0xe097('0xa')](),controller['create']);router['post'](_0xe097('0x12'),auth[_0xe097('0xa')](),controller[_0xe097('0x16')]);router[_0xe097('0x15')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xe097('0x17')](_0xe097('0xe'),auth['isAuthenticated'](),controller[_0xe097('0x18')]);router[_0xe097('0x19')](_0xe097('0xe'),auth['isAuthenticated'](),controller[_0xe097('0x1a')]);router[_0xe097('0x19')](_0xe097('0x12'),auth[_0xe097('0xa')](),controller[_0xe097('0x1b')]);router[_0xe097('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0xe097('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb669=['create','addTeams','post','addAgents','put','update','delete','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0xab5a2f,_0x55e4f4){var _0x5c01e0=function(_0x245168){while(--_0x245168){_0xab5a2f['push'](_0xab5a2f['shift']());}};_0x5c01e0(++_0x55e4f4);}(_0xb669,0x1bc));var _0x9b66=function(_0x38d7e9,_0x1038c4){_0x38d7e9=_0x38d7e9-0x0;var _0x5d7557=_0xb669[_0x38d7e9];return _0x5d7557;};'use strict';var multer=require('multer');var util=require(_0x9b66('0x0'));var path=require(_0x9b66('0x1'));var timeout=require(_0x9b66('0x2'));var express=require(_0x9b66('0x3'));var router=express[_0x9b66('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b66('0x5'));var interaction=require(_0x9b66('0x6'));var config=require(_0x9b66('0x7'));var controller=require(_0x9b66('0x8'));router[_0x9b66('0x9')]('/',auth[_0x9b66('0xa')](),controller[_0x9b66('0xb')]);router['get'](_0x9b66('0xc'),auth[_0x9b66('0xa')](),controller[_0x9b66('0xd')]);router[_0x9b66('0x9')](_0x9b66('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x9b66('0x9')](_0x9b66('0xf'),auth[_0x9b66('0xa')](),controller[_0x9b66('0x10')]);router['get'](_0x9b66('0x11'),auth[_0x9b66('0xa')](),controller['getTeams']);router[_0x9b66('0x9')](_0x9b66('0x12'),auth['isAuthenticated'](),controller[_0x9b66('0x13')]);router['post']('/',auth[_0x9b66('0xa')](),controller[_0x9b66('0x14')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x9b66('0x15')]);router[_0x9b66('0x16')]('/:id/users',auth[_0x9b66('0xa')](),controller[_0x9b66('0x17')]);router[_0x9b66('0x18')](_0x9b66('0xe'),auth[_0x9b66('0xa')](),controller[_0x9b66('0x19')]);router['delete'](_0x9b66('0xe'),auth[_0x9b66('0xa')](),controller['destroy']);router[_0x9b66('0x1a')](_0x9b66('0x11'),auth[_0x9b66('0xa')](),controller[_0x9b66('0x1b')]);router[_0x9b66('0x1a')](_0x9b66('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9b66('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 3a5b7da..5c9bef8 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 _0xd9af=['name','INTEGER','ENUM','rrmemory','sequelize','exports','STRING'];(function(_0x296d42,_0x3d7972){var _0x5d3b25=function(_0x458ec3){while(--_0x458ec3){_0x296d42['push'](_0x296d42['shift']());}};_0x5d3b25(++_0x3d7972);}(_0xd9af,0x177));var _0xfd9a=function(_0x2e17c3,_0x525610){_0x2e17c3=_0x2e17c3-0x0;var _0x8253bc=_0xd9af[_0x2e17c3];return _0x8253bc;};'use strict';var Sequelize=require(_0xfd9a('0x0'));module[_0xfd9a('0x1')]={'name':{'type':Sequelize[_0xfd9a('0x2')],'unique':_0xfd9a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfd9a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd9a('0x5')](_0xfd9a('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xdc60=['exports','name','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x2e9f2c,_0x39460c){var _0x5a023f=function(_0x14a64e){while(--_0x14a64e){_0x2e9f2c['push'](_0x2e9f2c['shift']());}};_0x5a023f(++_0x39460c);}(_0xdc60,0x14f));var _0x0dc6=function(_0x35bc5d,_0x595cea){_0x35bc5d=_0x35bc5d-0x0;var _0x583eda=_0xdc60[_0x35bc5d];return _0x583eda;};'use strict';var Sequelize=require(_0x0dc6('0x0'));module[_0x0dc6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0dc6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0dc6('0x3')]},'timeout':{'type':Sequelize[_0x0dc6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0dc6('0x5'),_0x0dc6('0x6'),_0x0dc6('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 210c230..35c392e 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 _0x8f73=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','MailQueues','error','stack','name','index','MailQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','order','findAll','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5e4fdc,_0x183475){var _0xe2d401=function(_0x59ac98){while(--_0x59ac98){_0x5e4fdc['push'](_0x5e4fdc['shift']());}};_0xe2d401(++_0x183475);}(_0x8f73,0x79));var _0x38f7=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8f73[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0x38f7('0x0'));var rimraf=require(_0x38f7('0x1'));var zipdir=require(_0x38f7('0x2'));var jsonpatch=require(_0x38f7('0x3'));var rp=require(_0x38f7('0x4'));var moment=require(_0x38f7('0x5'));var BPromise=require(_0x38f7('0x6'));var Mustache=require('mustache');var util=require(_0x38f7('0x7'));var path=require(_0x38f7('0x8'));var sox=require(_0x38f7('0x9'));var csv=require(_0x38f7('0xa'));var ejs=require(_0x38f7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38f7('0xc'));var squel=require(_0x38f7('0xd'));var crypto=require('crypto');var jsforce=require(_0x38f7('0xe'));var deskjs=require(_0x38f7('0xf'));var toCsv=require(_0x38f7('0xa'));var querystring=require(_0x38f7('0x10'));var Papa=require('papaparse');var Redis=require(_0x38f7('0x11'));var authService=require(_0x38f7('0x12'));var qs=require(_0x38f7('0x13'));var as=require(_0x38f7('0x14'));var hardwareService=require(_0x38f7('0x15'));var logger=require('../../config/logger')(_0x38f7('0x16'));var utils=require(_0x38f7('0x17'));var config=require(_0x38f7('0x18'));var licenseUtil=require(_0x38f7('0x19'));var db=require(_0x38f7('0x1a'))['db'];config['redis']=_[_0x38f7('0x1b')](config[_0x38f7('0x1c')],{'host':_0x38f7('0x1d'),'port':0x18eb});var socket=require(_0x38f7('0x1e'))(new Redis(config[_0x38f7('0x1c')]));require(_0x38f7('0x1f'))['register'](socket);function respondWithStatusCode(_0x5581a5,_0x2dbac1){_0x2dbac1=_0x2dbac1||0xcc;return function(_0x59b879){if(_0x59b879){return _0x5581a5[_0x38f7('0x20')](_0x2dbac1);}return _0x5581a5['status'](_0x2dbac1)[_0x38f7('0x21')]();};}function respondWithResult(_0x173a44,_0x4e6b9f){_0x4e6b9f=_0x4e6b9f||0xc8;return function(_0x9f807d){if(_0x9f807d){return _0x173a44[_0x38f7('0x22')](_0x4e6b9f)[_0x38f7('0x23')](_0x9f807d);}};}function respondWithFilteredResult(_0x408e72,_0x40c574){return function(_0x213776){if(_0x213776){var _0x54898e=typeof _0x40c574[_0x38f7('0x24')]===_0x38f7('0x25')&&typeof _0x40c574[_0x38f7('0x26')]===_0x38f7('0x25');var _0x37d05d=_0x213776['count'];var _0x530ed4=_0x54898e?0x0:_0x40c574[_0x38f7('0x24')];var _0x76dfb3=_0x54898e?_0x213776[_0x38f7('0x27')]:_0x40c574['offset']+_0x40c574[_0x38f7('0x26')];var _0x1c447e;if(_0x76dfb3>=_0x37d05d){_0x76dfb3=_0x37d05d;_0x1c447e=0xc8;}else{_0x1c447e=0xce;}_0x408e72[_0x38f7('0x22')](_0x1c447e);return _0x408e72[_0x38f7('0x28')](_0x38f7('0x29'),_0x530ed4+'-'+_0x76dfb3+'/'+_0x37d05d)['json'](_0x213776);}return null;};}function patchUpdates(_0x28cbbe){return function(_0xe74959){try{jsonpatch[_0x38f7('0x2a')](_0xe74959,_0x28cbbe,!![]);}catch(_0x1dc35d){return BPromise[_0x38f7('0x2b')](_0x1dc35d);}return _0xe74959[_0x38f7('0x2c')]();};}function saveUpdates(_0x45bb89,_0x3d4f7d){return function(_0x28d3f1){if(_0x28d3f1){return _0x28d3f1['update'](_0x45bb89)['then'](function(_0x37c09e){return _0x37c09e;});}return null;};}function removeEntity(_0x29cba1,_0x809d5c){return function(_0x511aa6){if(_0x511aa6){return _0x511aa6[_0x38f7('0x2d')]()[_0x38f7('0x2e')](function(){var _0x25903c=_0x511aa6[_0x38f7('0x2f')]({'plain':!![]});var _0x57518b=_0x38f7('0x30');return db['UserProfileResource'][_0x38f7('0x2d')]({'where':{'type':_0x57518b,'resourceId':_0x25903c['id']}})['then'](function(){return _0x511aa6;});})[_0x38f7('0x2e')](function(){_0x29cba1[_0x38f7('0x22')](0xcc)[_0x38f7('0x21')]();});}};}function handleEntityNotFound(_0x2e150e,_0x426314){return function(_0x33ff8f){if(!_0x33ff8f){_0x2e150e[_0x38f7('0x20')](0x194);}return _0x33ff8f;};}function handleError(_0x233ff9,_0x38fac0){_0x38fac0=_0x38fac0||0x1f4;return function(_0x320874){logger[_0x38f7('0x31')](_0x320874[_0x38f7('0x32')]);if(_0x320874[_0x38f7('0x33')]){delete _0x320874[_0x38f7('0x33')];}_0x233ff9[_0x38f7('0x22')](_0x38fac0)['send'](_0x320874);};}exports[_0x38f7('0x34')]=function(_0x22ae01,_0x3dda60){var _0x208fa0={},_0x3f245b={},_0x470050={'count':0x0,'rows':[]};var _0x1c6758=_['map'](db[_0x38f7('0x35')][_0x38f7('0x36')],function(_0x7b2bee){return{'name':_0x7b2bee[_0x38f7('0x37')],'type':_0x7b2bee[_0x38f7('0x38')]['key']};});_0x3f245b[_0x38f7('0x39')]=_[_0x38f7('0x3a')](_0x1c6758,_0x38f7('0x33'));_0x3f245b[_0x38f7('0x3b')]=_[_0x38f7('0x3c')](_0x22ae01['query']);_0x3f245b[_0x38f7('0x3d')]=_[_0x38f7('0x3e')](_0x3f245b[_0x38f7('0x39')],_0x3f245b[_0x38f7('0x3b')]);_0x208fa0[_0x38f7('0x3f')]=_['intersection'](_0x3f245b['model'],qs[_0x38f7('0x40')](_0x22ae01[_0x38f7('0x3b')]['fields']));_0x208fa0[_0x38f7('0x3f')]=_0x208fa0[_0x38f7('0x3f')]['length']?_0x208fa0[_0x38f7('0x3f')]:_0x3f245b['model'];if(!_0x22ae01['query'][_0x38f7('0x41')](_0x38f7('0x42'))){_0x208fa0[_0x38f7('0x26')]=qs[_0x38f7('0x26')](_0x22ae01[_0x38f7('0x3b')][_0x38f7('0x26')]);_0x208fa0[_0x38f7('0x24')]=qs[_0x38f7('0x24')](_0x22ae01['query'][_0x38f7('0x24')]);}_0x208fa0['order']=qs[_0x38f7('0x43')](_0x22ae01[_0x38f7('0x3b')][_0x38f7('0x43')]);_0x208fa0['where']=qs['filters'](_[_0x38f7('0x44')](_0x22ae01[_0x38f7('0x3b')],_0x3f245b['filters']),_0x1c6758);if(_0x22ae01[_0x38f7('0x3b')]['filter']){_0x208fa0[_0x38f7('0x45')]=_['merge'](_0x208fa0[_0x38f7('0x45')],{'$or':_[_0x38f7('0x3a')](_0x1c6758,function(_0x5a2109){if(_0x5a2109['type']!==_0x38f7('0x46')){var _0x1cc794={};_0x1cc794[_0x5a2109[_0x38f7('0x33')]]={'$like':'%'+_0x22ae01[_0x38f7('0x3b')][_0x38f7('0x47')]+'%'};return _0x1cc794;}})});}_0x208fa0=_['merge']({},_0x208fa0,_0x22ae01[_0x38f7('0x48')]);var _0x2da06f={'where':_0x208fa0[_0x38f7('0x45')]};return db[_0x38f7('0x35')]['count'](_0x2da06f)[_0x38f7('0x2e')](function(_0x51129d){_0x470050[_0x38f7('0x27')]=_0x51129d;if(_0x22ae01['query'][_0x38f7('0x49')]){_0x208fa0[_0x38f7('0x4a')]=[{'all':!![]}];}return db[_0x38f7('0x35')]['findAll'](_0x208fa0);})[_0x38f7('0x2e')](function(_0x66e04){_0x470050[_0x38f7('0x4b')]=_0x66e04;return _0x470050;})[_0x38f7('0x2e')](respondWithFilteredResult(_0x3dda60,_0x208fa0))[_0x38f7('0x4c')](handleError(_0x3dda60,null));};exports[_0x38f7('0x4d')]=function(_0x1567a7,_0x21fb2d){var _0x3b7f55={'raw':!![],'where':{'id':_0x1567a7[_0x38f7('0x4e')]['id']}},_0x512b0e={};_0x512b0e['model']=_[_0x38f7('0x3c')](db[_0x38f7('0x35')]['rawAttributes']);_0x512b0e[_0x38f7('0x3b')]=_['keys'](_0x1567a7[_0x38f7('0x3b')]);_0x512b0e[_0x38f7('0x3d')]=_[_0x38f7('0x3e')](_0x512b0e[_0x38f7('0x39')],_0x512b0e[_0x38f7('0x3b')]);_0x3b7f55[_0x38f7('0x3f')]=_[_0x38f7('0x3e')](_0x512b0e[_0x38f7('0x39')],qs[_0x38f7('0x40')](_0x1567a7[_0x38f7('0x3b')][_0x38f7('0x40')]));_0x3b7f55[_0x38f7('0x3f')]=_0x3b7f55['attributes'][_0x38f7('0x4f')]?_0x3b7f55[_0x38f7('0x3f')]:_0x512b0e['model'];if(_0x1567a7[_0x38f7('0x3b')][_0x38f7('0x49')]){_0x3b7f55['include']=[{'all':!![]}];}_0x3b7f55=_[_0x38f7('0x50')]({},_0x3b7f55,_0x1567a7[_0x38f7('0x48')]);return db[_0x38f7('0x35')]['find'](_0x3b7f55)[_0x38f7('0x2e')](handleEntityNotFound(_0x21fb2d,null))[_0x38f7('0x2e')](respondWithResult(_0x21fb2d,null))['catch'](handleError(_0x21fb2d,null));};exports['create']=function(_0x13d6ad,_0x15e1c7){return db[_0x38f7('0x35')][_0x38f7('0x51')](_0x13d6ad[_0x38f7('0x52')],{})['then'](function(_0x38c309){var _0x3c0a85=_0x13d6ad[_0x38f7('0x53')][_0x38f7('0x2f')]({'plain':!![]});if(!_0x3c0a85)throw new Error(_0x38f7('0x54'));if(_0x3c0a85['role']===_0x38f7('0x53')){var _0x562ef8=_0x38c309[_0x38f7('0x2f')]({'plain':!![]});var _0x2e21ea=_0x38f7('0x30');return db[_0x38f7('0x55')][_0x38f7('0x56')]({'where':{'name':_0x2e21ea,'userProfileId':_0x3c0a85[_0x38f7('0x57')]},'raw':!![]})[_0x38f7('0x2e')](function(_0x38fdae){if(_0x38fdae&&_0x38fdae[_0x38f7('0x58')]===0x0){return db[_0x38f7('0x59')][_0x38f7('0x51')]({'name':_0x562ef8['name'],'resourceId':_0x562ef8['id'],'type':_0x38fdae[_0x38f7('0x33')],'sectionId':_0x38fdae['id']},{})[_0x38f7('0x2e')](function(){return _0x38c309;});}else{return _0x38c309;}})[_0x38f7('0x4c')](function(_0x17f24f){logger[_0x38f7('0x31')](_0x38f7('0x5a'),_0x17f24f);throw _0x17f24f;});}return _0x38c309;})[_0x38f7('0x2e')](respondWithResult(_0x15e1c7,0xc9))[_0x38f7('0x4c')](handleError(_0x15e1c7,null));};exports[_0x38f7('0x5b')]=function(_0x24e92f,_0x1ae0fe){if(_0x24e92f[_0x38f7('0x52')]['id']){delete _0x24e92f[_0x38f7('0x52')]['id'];}return db[_0x38f7('0x35')][_0x38f7('0x56')]({'where':{'id':_0x24e92f[_0x38f7('0x4e')]['id']}})[_0x38f7('0x2e')](handleEntityNotFound(_0x1ae0fe,null))[_0x38f7('0x2e')](saveUpdates(_0x24e92f[_0x38f7('0x52')],null))[_0x38f7('0x2e')](respondWithResult(_0x1ae0fe,null))[_0x38f7('0x4c')](handleError(_0x1ae0fe,null));};exports[_0x38f7('0x2d')]=function(_0x5d9e2f,_0x4436d9){return db[_0x38f7('0x35')][_0x38f7('0x56')]({'where':{'id':_0x5d9e2f[_0x38f7('0x4e')]['id']}})[_0x38f7('0x2e')](handleEntityNotFound(_0x4436d9,null))['then'](removeEntity(_0x4436d9,null))['catch'](handleError(_0x4436d9,null));};exports[_0x38f7('0x5c')]=function(_0x4cd8e7,_0x2601d3){return db[_0x38f7('0x35')]['describe']()[_0x38f7('0x2e')](respondWithResult(_0x2601d3,null))['catch'](handleError(_0x2601d3,null));};exports[_0x38f7('0x5d')]=function(_0x31f812,_0x4c01f1,_0x2fbfcb){var _0x5d0d06={'raw':!![],'where':{}},_0x72836e={},_0x52e208;return db['MailQueue'][_0x38f7('0x5e')]({'where':{'id':_0x31f812[_0x38f7('0x4e')]['id']}})[_0x38f7('0x2e')](handleEntityNotFound(_0x4c01f1,null))[_0x38f7('0x2e')](function(_0x291af0){if(_0x291af0){_0x52e208=_0x291af0['get']({'plain':!![]});_0x72836e[_0x38f7('0x39')]=_[_0x38f7('0x3c')](db[_0x38f7('0x5f')][_0x38f7('0x36')]);_0x72836e['query']=_[_0x38f7('0x3c')](_0x31f812[_0x38f7('0x3b')]);_0x72836e[_0x38f7('0x3d')]=_[_0x38f7('0x3e')](_0x72836e['model'],_0x72836e[_0x38f7('0x3b')]);_0x5d0d06[_0x38f7('0x3f')]=_[_0x38f7('0x3e')](_0x72836e[_0x38f7('0x39')],qs[_0x38f7('0x40')](_0x31f812['query'][_0x38f7('0x40')]));_0x5d0d06[_0x38f7('0x3f')]=_0x5d0d06['attributes'][_0x38f7('0x4f')]?_0x5d0d06[_0x38f7('0x3f')]:_0x72836e[_0x38f7('0x39')];if(!_0x31f812[_0x38f7('0x3b')][_0x38f7('0x41')](_0x38f7('0x42'))){_0x5d0d06[_0x38f7('0x26')]=qs[_0x38f7('0x26')](_0x31f812[_0x38f7('0x3b')]['limit']);_0x5d0d06['offset']=qs[_0x38f7('0x24')](_0x31f812[_0x38f7('0x3b')]['offset']);}_0x5d0d06[_0x38f7('0x60')]=qs[_0x38f7('0x43')](_0x31f812['query'][_0x38f7('0x43')]);_0x5d0d06[_0x38f7('0x45')]=qs[_0x38f7('0x3d')](_[_0x38f7('0x44')](_0x31f812[_0x38f7('0x3b')],_0x72836e['filters']));_0x5d0d06[_0x38f7('0x45')]['MailQueueId']=_0x291af0['id'];if(_0x31f812['query']['filter']){_0x5d0d06[_0x38f7('0x45')]=_[_0x38f7('0x50')](_0x5d0d06[_0x38f7('0x45')],{'$or':_[_0x38f7('0x3a')](_0x5d0d06[_0x38f7('0x3f')],function(_0x4d98cd){var _0x401319={};_0x401319[_0x4d98cd]={'$like':'%'+_0x31f812[_0x38f7('0x3b')][_0x38f7('0x47')]+'%'};return _0x401319;})});}_0x5d0d06=_[_0x38f7('0x50')]({},_0x5d0d06,_0x31f812[_0x38f7('0x48')]);return db[_0x38f7('0x5f')][_0x38f7('0x61')](_0x5d0d06);}})[_0x38f7('0x2e')](function(_0x163ada){if(_0x163ada){return db[_0x38f7('0x62')][_0x38f7('0x63')]({'where':{'id':_['map'](_0x163ada,_0x38f7('0x64')),'role':'agent'},'attributes':['id',_0x38f7('0x33'),_0x38f7('0x65'),_0x38f7('0x66'),_0x38f7('0x67')]});}})[_0x38f7('0x2e')](function(_0x1d2234){if(_0x1d2234){return{'count':_0x1d2234['count'],'rows':_[_0x38f7('0x3a')](_0x1d2234[_0x38f7('0x4b')],function(_0x49f7d5){return{'membername':_0x49f7d5['name'],'UserId':_0x49f7d5['id'],'queue_name':_0x52e208[_0x38f7('0x33')],'MailQueueId':_0x52e208['id'],'interface':util[_0x38f7('0x68')](_0x38f7('0x69'),_0x38f7('0x6a'),_0x49f7d5[_0x38f7('0x33')]),'penalty':0x0,'paused':_0x49f7d5[_0x38f7('0x65')],'createdAt':_0x49f7d5[_0x38f7('0x67')],'updatedAt':_0x49f7d5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x38f7('0x2e')](respondWithFilteredResult(_0x4c01f1,_0x5d0d06))[_0x38f7('0x4c')](handleError(_0x4c01f1,null));};exports[_0x38f7('0x6b')]=function(_0x23bcb8,_0x20eb5e,_0x13a16f){var _0x2adc7e={};var _0x348031={};var _0xf74ec6;var _0x16eab4;return db[_0x38f7('0x35')][_0x38f7('0x5e')]({'where':{'id':_0x23bcb8[_0x38f7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x20eb5e,null))[_0x38f7('0x2e')](function(_0x3baccf){if(_0x3baccf){_0xf74ec6=_0x3baccf;_0x348031['model']=_[_0x38f7('0x3c')](db[_0x38f7('0x6c')][_0x38f7('0x36')]);_0x348031[_0x38f7('0x3b')]=_['keys'](_0x23bcb8['query']);_0x348031['filters']=_[_0x38f7('0x3e')](_0x348031[_0x38f7('0x39')],_0x348031[_0x38f7('0x3b')]);_0x2adc7e[_0x38f7('0x3f')]=_['intersection'](_0x348031['model'],qs[_0x38f7('0x40')](_0x23bcb8['query'][_0x38f7('0x40')]));_0x2adc7e[_0x38f7('0x3f')]=_0x2adc7e[_0x38f7('0x3f')]['length']?_0x2adc7e[_0x38f7('0x3f')]:_0x348031['model'];_0x2adc7e[_0x38f7('0x60')]=qs['sort'](_0x23bcb8[_0x38f7('0x3b')][_0x38f7('0x43')]);_0x2adc7e[_0x38f7('0x45')]=qs[_0x38f7('0x3d')](_[_0x38f7('0x44')](_0x23bcb8[_0x38f7('0x3b')],_0x348031[_0x38f7('0x3d')]));if(_0x23bcb8[_0x38f7('0x3b')][_0x38f7('0x47')]){_0x2adc7e['where']=_[_0x38f7('0x50')](_0x2adc7e[_0x38f7('0x45')],{'$or':_[_0x38f7('0x3a')](_0x2adc7e[_0x38f7('0x3f')],function(_0x3939c3){var _0xabdd2e={};_0xabdd2e[_0x3939c3]={'$like':'%'+_0x23bcb8[_0x38f7('0x3b')][_0x38f7('0x47')]+'%'};return _0xabdd2e;})});}_0x2adc7e=_['merge']({},_0x2adc7e,_0x23bcb8[_0x38f7('0x48')]);return _0xf74ec6[_0x38f7('0x6b')](_0x2adc7e);}})[_0x38f7('0x2e')](function(_0x5d6440){if(_0x5d6440){_0x16eab4=_0x5d6440['length'];if(!_0x23bcb8['query'][_0x38f7('0x41')](_0x38f7('0x42'))){_0x2adc7e[_0x38f7('0x26')]=qs[_0x38f7('0x26')](_0x23bcb8[_0x38f7('0x3b')][_0x38f7('0x26')]);_0x2adc7e['offset']=qs[_0x38f7('0x24')](_0x23bcb8[_0x38f7('0x3b')][_0x38f7('0x24')]);}return _0xf74ec6[_0x38f7('0x6b')](_0x2adc7e);}})[_0x38f7('0x2e')](function(_0x27d0f2){if(_0x27d0f2){return _0x27d0f2?{'count':_0x16eab4,'rows':_0x27d0f2}:null;}})[_0x38f7('0x2e')](respondWithResult(_0x20eb5e,null))['catch'](handleError(_0x20eb5e,null));};exports['addTeams']=function(_0x3b9591,_0x1f6620,_0x399c74){var _0x2a6b79=_0x3b9591[_0x38f7('0x52')][_0x38f7('0x6d')];return db[_0x38f7('0x6c')]['findAll']({'where':{'id':_0x2a6b79},'attributes':['id'],'include':[{'model':db[_0x38f7('0x62')],'as':_0x38f7('0x6e'),'attributes':['id',_0x38f7('0x33'),_0x38f7('0x6f'),_0x38f7('0x70'),_0x38f7('0x71')],'raw':!![]}]})['then'](function(_0xd367bd){if(_0xd367bd){var _0x466d46=_[_0x38f7('0x72')](_0xd367bd,function(_0x33e16c){var _0x24dd6f=_0x33e16c['get']({'plain':!![]});return _0x24dd6f[_0x38f7('0x6e')];});return db[_0x38f7('0x35')]['find']({'where':{'id':_0x3b9591['params']['id']}})[_0x38f7('0x2e')](function(_0x348db4){return db['sequelize'][_0x38f7('0x73')](function(_0x25ed76){return _0x348db4[_0x38f7('0x74')](_0x2a6b79,{'transaction':_0x25ed76})[_0x38f7('0x2e')](function(){return BPromise[_0x38f7('0x75')](_0x466d46,function(_0x5102a7){return db['UserMailQueue'][_0x38f7('0x76')]({'where':{'UserId':_0x5102a7['id'],'MailQueueId':_0x3b9591[_0x38f7('0x4e')]['id']},'transaction':_0x25ed76});});})[_0x38f7('0x2e')](function(){_0x466d46[_0x38f7('0x77')](function(_0xc69ebb){socket[_0x38f7('0x78')](_0x38f7('0x79'),{'UserId':_0xc69ebb['id'],'MailQueueId':_0x348db4['id']});});});});});}})['then'](respondWithStatusCode(_0x1f6620,null))[_0x38f7('0x4c')](handleError(_0x1f6620,null));};exports[_0x38f7('0x7a')]=function(_0x4a764e,_0x2e66ab,_0x429f6c){return db[_0x38f7('0x6c')][_0x38f7('0x61')]({'where':{'id':_0x4a764e[_0x38f7('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x38f7('0x62')],'as':_0x38f7('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2e66ab,null))[_0x38f7('0x2e')](function(_0x3c1288){var _0x3dc3c5=_[_0x38f7('0x3a')](_0x3c1288,'id');var _0x2025ac=[];var _0x27cbcf=[];var _0x18897c=squel[_0x38f7('0x7b')]();_0x18897c[_0x38f7('0x7c')]('tq.TeamId')[_0x38f7('0x7d')](_0x38f7('0x7e'),'tq')[_0x38f7('0x7f')](_0x38f7('0x80'),'ut',_0x38f7('0x81'))[_0x38f7('0x45')](_0x38f7('0x82'),_0x4a764e[_0x38f7('0x4e')]['id']);for(var _0x17122a=0x0;_0x17122a<_0x3c1288[_0x38f7('0x4f')];_0x17122a+=0x1){let _0x40f219=_0x3c1288[_0x17122a];for(var _0x4c64fd=0x0;_0x4c64fd<_0x40f219[_0x38f7('0x6e')][_0x38f7('0x4f')];_0x4c64fd+=0x1){let _0x5bb15b=_0x40f219[_0x38f7('0x6e')][_0x4c64fd];var _0x3ac136=_0x18897c[_0x38f7('0x83')]();_0x3ac136[_0x38f7('0x45')]('ut.UserId\x20=\x20?',_0x5bb15b['id']);_0x27cbcf['push'](db[_0x38f7('0x84')]['query'](_0x3ac136[_0x38f7('0x85')](),{'type':db['sequelize'][_0x38f7('0x86')][_0x38f7('0x87')]})['then'](function(_0x2f5bcc){if(_0x2f5bcc['length']===0x1){return _0x5bb15b['id'];}else{var _0x1d09c6=_[_0x38f7('0x88')](_['map'](_0x2f5bcc,'TeamId'),function(_0x5b2b9b){return _[_0x38f7('0x89')](_0x3dc3c5,_0x5b2b9b);});if(_0x1d09c6){return _0x5bb15b['id'];}}}));}}return BPromise[_0x38f7('0x8a')](_0x27cbcf)[_0x38f7('0x2e')](function(_0x46bcb4){_0x2025ac=_(_0x2025ac)[_0x38f7('0x8b')](_0x46bcb4)[_0x38f7('0x8c')]()[_0x38f7('0x8d')]();return db['MailQueue'][_0x38f7('0x56')]({'where':{'id':_0x4a764e[_0x38f7('0x4e')]['id']}})[_0x38f7('0x2e')](function(_0x160597){return db['sequelize'][_0x38f7('0x73')](function(_0x58ec44){return _0x160597[_0x38f7('0x7a')](_0x4a764e['query'][_0x38f7('0x6d')],{'transaction':_0x58ec44})[_0x38f7('0x2e')](function(){if(!_[_0x38f7('0x8e')](_0x2025ac)){return _0x160597[_0x38f7('0x8f')](_0x2025ac,{'transaction':_0x58ec44});}})[_0x38f7('0x2e')](function(){_0x2025ac['forEach'](function(_0x5afd21){socket['emit'](_0x38f7('0x90'),{'UserId':_0x5afd21,'MailQueueId':_0x160597['id']});});});});});});})['then'](respondWithStatusCode(_0x2e66ab,null))['catch'](handleError(_0x2e66ab,null));};exports['addAgents']=function(_0x5f3165,_0x5d7038,_0x2958ec){return db[_0x38f7('0x35')][_0x38f7('0x56')]({'where':{'id':_0x5f3165[_0x38f7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5d7038,null))['then'](function(_0x159aea){if(_0x159aea){return _0x159aea['addAgents'](_0x5f3165['body'][_0x38f7('0x6d')],_['omit'](_0x5f3165[_0x38f7('0x52')],['ids','id'])||{})['spread'](function(_0xbc2b6e){for(var _0x211bbc=0x0;_0x211bbc<_0x5f3165['body'][_0x38f7('0x6d')]['length'];_0x211bbc+=0x1){socket[_0x38f7('0x78')]('userMailQueue:save',{'UserId':Number(_0x5f3165['body']['ids'][_0x211bbc]),'MailQueueId':Number(_0x5f3165['params']['id'])});}return _0xbc2b6e;});}})[_0x38f7('0x2e')](respondWithResult(_0x5d7038,null))['catch'](handleError(_0x5d7038,null));};exports['removeAgents']=function(_0x1dd390,_0x3ecc4b,_0x4fa3a0){return db[_0x38f7('0x35')][_0x38f7('0x56')]({'where':{'id':_0x1dd390[_0x38f7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3ecc4b,null))[_0x38f7('0x2e')](function(_0x10224e){if(_0x10224e){return _0x10224e[_0x38f7('0x8f')](_0x1dd390[_0x38f7('0x3b')][_0x38f7('0x6d')])[_0x38f7('0x2e')](function(){if(_[_0x38f7('0x91')](_0x1dd390[_0x38f7('0x3b')][_0x38f7('0x6d')])){for(var _0x348d03=0x0;_0x348d03<_0x1dd390['query'][_0x38f7('0x6d')][_0x38f7('0x4f')];_0x348d03+=0x1){socket['emit'](_0x38f7('0x90'),{'UserId':Number(_0x1dd390[_0x38f7('0x3b')][_0x38f7('0x6d')][_0x348d03]),'MailQueueId':Number(_0x1dd390[_0x38f7('0x4e')]['id'])});}}else{socket['emit'](_0x38f7('0x90'),{'UserId':Number(_0x1dd390[_0x38f7('0x3b')][_0x38f7('0x6d')]),'MailQueueId':Number(_0x1dd390['params']['id'])});}});}})[_0x38f7('0x2e')](respondWithStatusCode(_0x3ecc4b,null))[_0x38f7('0x4c')](handleError(_0x3ecc4b,null));};exports[_0x38f7('0x92')]=function(_0x2b9477,_0x53dca2,_0x450ec7){var _0x46a871={};var _0x388333={};var _0x592f1c;var _0x484c59;return db[_0x38f7('0x35')][_0x38f7('0x5e')]({'where':{'id':_0x2b9477['params']['id']}})['then'](handleEntityNotFound(_0x53dca2,null))['then'](function(_0x4c9e65){if(_0x4c9e65){_0x592f1c=_0x4c9e65;_0x388333['model']=_[_0x38f7('0x3c')](db['User'][_0x38f7('0x36')]);_0x388333[_0x38f7('0x3b')]=_['keys'](_0x2b9477[_0x38f7('0x3b')]);_0x388333[_0x38f7('0x3d')]=_[_0x38f7('0x3e')](_0x388333[_0x38f7('0x39')],_0x388333[_0x38f7('0x3b')]);_0x46a871[_0x38f7('0x3f')]=_[_0x38f7('0x3e')](_0x388333[_0x38f7('0x39')],qs[_0x38f7('0x40')](_0x2b9477[_0x38f7('0x3b')]['fields']));_0x46a871[_0x38f7('0x3f')]=_0x46a871[_0x38f7('0x3f')][_0x38f7('0x4f')]?_0x46a871[_0x38f7('0x3f')]:_0x388333[_0x38f7('0x39')];_0x46a871[_0x38f7('0x60')]=qs[_0x38f7('0x43')](_0x2b9477[_0x38f7('0x3b')][_0x38f7('0x43')]);_0x46a871['where']=qs['filters'](_[_0x38f7('0x44')](_0x2b9477[_0x38f7('0x3b')],_0x388333[_0x38f7('0x3d')]));if(_0x2b9477[_0x38f7('0x3b')][_0x38f7('0x47')]){_0x46a871[_0x38f7('0x45')]=_[_0x38f7('0x50')](_0x46a871[_0x38f7('0x45')],{'$or':_[_0x38f7('0x3a')](_0x46a871['attributes'],function(_0x11fe01){var _0x58aef1={};_0x58aef1[_0x11fe01]={'$like':'%'+_0x2b9477['query'][_0x38f7('0x47')]+'%'};return _0x58aef1;})});}_0x46a871=_['merge']({},_0x46a871,_0x2b9477[_0x38f7('0x48')]);return _0x592f1c['getAgents'](_0x46a871);}})[_0x38f7('0x2e')](function(_0xd0aa0d){if(_0xd0aa0d){_0x484c59=_0xd0aa0d['length'];if(!_0x2b9477[_0x38f7('0x3b')]['hasOwnProperty'](_0x38f7('0x42'))){_0x46a871[_0x38f7('0x26')]=qs[_0x38f7('0x26')](_0x2b9477[_0x38f7('0x3b')][_0x38f7('0x26')]);_0x46a871[_0x38f7('0x24')]=qs['offset'](_0x2b9477[_0x38f7('0x3b')][_0x38f7('0x24')]);}return _0x592f1c['getAgents'](_0x46a871);}})['then'](function(_0x287e3e){if(_0x287e3e){return _0x287e3e?{'count':_0x484c59,'rows':_0x287e3e}:null;}})['then'](respondWithResult(_0x53dca2,null))[_0x38f7('0x4c')](handleError(_0x53dca2,null));}; \ No newline at end of file +var _0x208d=['userMailQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','addAgents','omit','spread','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','set','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','MailQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','findAll','catch','rawAttributes','include','create','body','user','get','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','MailQueueId','UserMailQueue','User','findAndCountAll','agent','updatedAt','createdAt','rows','format','%s/%s','findOne','Team','order','getTeams','addTeams','online','interface','flatMap','Agents','sequelize','transaction','findOrCreate','emit'];(function(_0x46c1f5,_0x505b91){var _0x1a044d=function(_0x8a44a9){while(--_0x8a44a9){_0x46c1f5['push'](_0x46c1f5['shift']());}};_0x1a044d(++_0x505b91);}(_0x208d,0xa4));var _0xd208=function(_0x3cd975,_0x23f21f){_0x3cd975=_0x3cd975-0x0;var _0x579111=_0x208d[_0x3cd975];return _0x579111;};'use strict';var emlformat=require(_0xd208('0x0'));var rimraf=require(_0xd208('0x1'));var zipdir=require(_0xd208('0x2'));var jsonpatch=require(_0xd208('0x3'));var rp=require('request-promise');var moment=require(_0xd208('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd208('0x5'));var util=require(_0xd208('0x6'));var path=require(_0xd208('0x7'));var sox=require(_0xd208('0x8'));var csv=require(_0xd208('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd208('0xa'));var _=require(_0xd208('0xb'));var squel=require(_0xd208('0xc'));var crypto=require('crypto');var jsforce=require(_0xd208('0xd'));var deskjs=require(_0xd208('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd208('0xf'));var Papa=require(_0xd208('0x10'));var Redis=require('ioredis');var authService=require(_0xd208('0x11'));var qs=require(_0xd208('0x12'));var as=require(_0xd208('0x13'));var hardwareService=require(_0xd208('0x14'));var logger=require('../../config/logger')(_0xd208('0x15'));var utils=require(_0xd208('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd208('0x17'));var db=require(_0xd208('0x18'))['db'];config[_0xd208('0x19')]=_[_0xd208('0x1a')](config[_0xd208('0x19')],{'host':_0xd208('0x1b'),'port':0x18eb});var socket=require(_0xd208('0x1c'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xd208('0x1d')](socket);function respondWithStatusCode(_0x273606,_0x2ba11c){_0x2ba11c=_0x2ba11c||0xcc;return function(_0x3a8da5){if(_0x3a8da5){return _0x273606[_0xd208('0x1e')](_0x2ba11c);}return _0x273606[_0xd208('0x1f')](_0x2ba11c)['end']();};}function respondWithResult(_0x21a27b,_0x3d057a){_0x3d057a=_0x3d057a||0xc8;return function(_0x522b7c){if(_0x522b7c){return _0x21a27b[_0xd208('0x1f')](_0x3d057a)['json'](_0x522b7c);}};}function respondWithFilteredResult(_0x2a0c4a,_0xf0a058){return function(_0x337671){if(_0x337671){var _0x370c66=typeof _0xf0a058[_0xd208('0x20')]===_0xd208('0x21')&&typeof _0xf0a058[_0xd208('0x22')]===_0xd208('0x21');var _0x3c0af7=_0x337671['count'];var _0x178841=_0x370c66?0x0:_0xf0a058['offset'];var _0x1ed92f=_0x370c66?_0x337671['count']:_0xf0a058[_0xd208('0x20')]+_0xf0a058[_0xd208('0x22')];var _0xac43f0;if(_0x1ed92f>=_0x3c0af7){_0x1ed92f=_0x3c0af7;_0xac43f0=0xc8;}else{_0xac43f0=0xce;}_0x2a0c4a[_0xd208('0x1f')](_0xac43f0);return _0x2a0c4a[_0xd208('0x23')]('Content-Range',_0x178841+'-'+_0x1ed92f+'/'+_0x3c0af7)[_0xd208('0x24')](_0x337671);}return null;};}function patchUpdates(_0x1c4540){return function(_0x5ab17a){try{jsonpatch[_0xd208('0x25')](_0x5ab17a,_0x1c4540,!![]);}catch(_0x228271){return BPromise[_0xd208('0x26')](_0x228271);}return _0x5ab17a[_0xd208('0x27')]();};}function saveUpdates(_0x42d90c,_0x174297){return function(_0x514bb5){if(_0x514bb5){return _0x514bb5[_0xd208('0x28')](_0x42d90c)[_0xd208('0x29')](function(_0x139a0d){return _0x139a0d;});}return null;};}function removeEntity(_0x366aa9,_0x443901){return function(_0x836063){if(_0x836063){return _0x836063['destroy']()['then'](function(){var _0x5d014c=_0x836063['get']({'plain':!![]});var _0x2816e5='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x2816e5,'resourceId':_0x5d014c['id']}})[_0xd208('0x29')](function(){return _0x836063;});})[_0xd208('0x29')](function(){_0x366aa9['status'](0xcc)[_0xd208('0x2a')]();});}};}function handleEntityNotFound(_0x554927,_0x2369bd){return function(_0x2d8562){if(!_0x2d8562){_0x554927[_0xd208('0x1e')](0x194);}return _0x2d8562;};}function handleError(_0x2b62e5,_0x42af88){_0x42af88=_0x42af88||0x1f4;return function(_0x130a29){logger[_0xd208('0x2b')](_0x130a29[_0xd208('0x2c')]);if(_0x130a29[_0xd208('0x2d')]){delete _0x130a29['name'];}_0x2b62e5[_0xd208('0x1f')](_0x42af88)[_0xd208('0x2e')](_0x130a29);};}exports[_0xd208('0x2f')]=function(_0x481fb5,_0xdb1568){var _0x44a9e4={},_0x5b026c={},_0x4acf53={'count':0x0,'rows':[]};var _0x1dd170=_[_0xd208('0x30')](db[_0xd208('0x31')]['rawAttributes'],function(_0x341615){return{'name':_0x341615[_0xd208('0x32')],'type':_0x341615[_0xd208('0x33')][_0xd208('0x34')]};});_0x5b026c[_0xd208('0x35')]=_['map'](_0x1dd170,'name');_0x5b026c[_0xd208('0x36')]=_[_0xd208('0x37')](_0x481fb5[_0xd208('0x36')]);_0x5b026c[_0xd208('0x38')]=_[_0xd208('0x39')](_0x5b026c[_0xd208('0x35')],_0x5b026c[_0xd208('0x36')]);_0x44a9e4[_0xd208('0x3a')]=_[_0xd208('0x39')](_0x5b026c[_0xd208('0x35')],qs[_0xd208('0x3b')](_0x481fb5[_0xd208('0x36')]['fields']));_0x44a9e4[_0xd208('0x3a')]=_0x44a9e4[_0xd208('0x3a')][_0xd208('0x3c')]?_0x44a9e4[_0xd208('0x3a')]:_0x5b026c[_0xd208('0x35')];if(!_0x481fb5[_0xd208('0x36')][_0xd208('0x3d')](_0xd208('0x3e'))){_0x44a9e4[_0xd208('0x22')]=qs[_0xd208('0x22')](_0x481fb5[_0xd208('0x36')]['limit']);_0x44a9e4[_0xd208('0x20')]=qs[_0xd208('0x20')](_0x481fb5[_0xd208('0x36')]['offset']);}_0x44a9e4['order']=qs[_0xd208('0x3f')](_0x481fb5['query'][_0xd208('0x3f')]);_0x44a9e4[_0xd208('0x40')]=qs[_0xd208('0x38')](_[_0xd208('0x41')](_0x481fb5[_0xd208('0x36')],_0x5b026c[_0xd208('0x38')]),_0x1dd170);if(_0x481fb5['query'][_0xd208('0x42')]){_0x44a9e4[_0xd208('0x40')]=_[_0xd208('0x43')](_0x44a9e4[_0xd208('0x40')],{'$or':_[_0xd208('0x30')](_0x1dd170,function(_0x201328){if(_0x201328['type']!=='VIRTUAL'){var _0x14aaf4={};_0x14aaf4[_0x201328[_0xd208('0x2d')]]={'$like':'%'+_0x481fb5[_0xd208('0x36')][_0xd208('0x42')]+'%'};return _0x14aaf4;}})});}_0x44a9e4=_[_0xd208('0x43')]({},_0x44a9e4,_0x481fb5[_0xd208('0x44')]);var _0x52f8cb={'where':_0x44a9e4[_0xd208('0x40')]};return db[_0xd208('0x31')][_0xd208('0x45')](_0x52f8cb)[_0xd208('0x29')](function(_0x58359b){_0x4acf53[_0xd208('0x45')]=_0x58359b;if(_0x481fb5[_0xd208('0x36')][_0xd208('0x46')]){_0x44a9e4['include']=[{'all':!![]}];}return db['MailQueue'][_0xd208('0x47')](_0x44a9e4);})[_0xd208('0x29')](function(_0x5a711e){_0x4acf53['rows']=_0x5a711e;return _0x4acf53;})[_0xd208('0x29')](respondWithFilteredResult(_0xdb1568,_0x44a9e4))[_0xd208('0x48')](handleError(_0xdb1568,null));};exports['show']=function(_0x1ce90c,_0xd00096){var _0x5a7a86={'raw':!![],'where':{'id':_0x1ce90c['params']['id']}},_0x1ab080={};_0x1ab080[_0xd208('0x35')]=_['keys'](db[_0xd208('0x31')][_0xd208('0x49')]);_0x1ab080[_0xd208('0x36')]=_[_0xd208('0x37')](_0x1ce90c[_0xd208('0x36')]);_0x1ab080[_0xd208('0x38')]=_[_0xd208('0x39')](_0x1ab080[_0xd208('0x35')],_0x1ab080[_0xd208('0x36')]);_0x5a7a86[_0xd208('0x3a')]=_[_0xd208('0x39')](_0x1ab080[_0xd208('0x35')],qs['fields'](_0x1ce90c['query'][_0xd208('0x3b')]));_0x5a7a86['attributes']=_0x5a7a86['attributes']['length']?_0x5a7a86[_0xd208('0x3a')]:_0x1ab080[_0xd208('0x35')];if(_0x1ce90c[_0xd208('0x36')]['includeAll']){_0x5a7a86[_0xd208('0x4a')]=[{'all':!![]}];}_0x5a7a86=_['merge']({},_0x5a7a86,_0x1ce90c[_0xd208('0x44')]);return db[_0xd208('0x31')]['find'](_0x5a7a86)[_0xd208('0x29')](handleEntityNotFound(_0xd00096,null))[_0xd208('0x29')](respondWithResult(_0xd00096,null))[_0xd208('0x48')](handleError(_0xd00096,null));};exports[_0xd208('0x4b')]=function(_0x334232,_0x4f1892){return db['MailQueue'][_0xd208('0x4b')](_0x334232[_0xd208('0x4c')],{})[_0xd208('0x29')](function(_0x2a607b){var _0x3d4a72=_0x334232[_0xd208('0x4d')][_0xd208('0x4e')]({'plain':!![]});if(!_0x3d4a72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d4a72[_0xd208('0x4f')]===_0xd208('0x4d')){var _0x4b4e92=_0x2a607b[_0xd208('0x4e')]({'plain':!![]});var _0x3c7374='MailQueues';return db[_0xd208('0x50')][_0xd208('0x51')]({'where':{'name':_0x3c7374,'userProfileId':_0x3d4a72[_0xd208('0x52')]},'raw':!![]})[_0xd208('0x29')](function(_0x5e777d){if(_0x5e777d&&_0x5e777d['autoAssociation']===0x0){return db[_0xd208('0x53')][_0xd208('0x4b')]({'name':_0x4b4e92[_0xd208('0x2d')],'resourceId':_0x4b4e92['id'],'type':_0x5e777d['name'],'sectionId':_0x5e777d['id']},{})[_0xd208('0x29')](function(){return _0x2a607b;});}else{return _0x2a607b;}})[_0xd208('0x48')](function(_0x3cd9d2){logger[_0xd208('0x2b')](_0xd208('0x54'),_0x3cd9d2);throw _0x3cd9d2;});}return _0x2a607b;})[_0xd208('0x29')](respondWithResult(_0x4f1892,0xc9))[_0xd208('0x48')](handleError(_0x4f1892,null));};exports[_0xd208('0x28')]=function(_0x2bedcc,_0x1457db){if(_0x2bedcc[_0xd208('0x4c')]['id']){delete _0x2bedcc[_0xd208('0x4c')]['id'];}return db[_0xd208('0x31')][_0xd208('0x51')]({'where':{'id':_0x2bedcc[_0xd208('0x55')]['id']}})[_0xd208('0x29')](handleEntityNotFound(_0x1457db,null))[_0xd208('0x29')](saveUpdates(_0x2bedcc[_0xd208('0x4c')],null))[_0xd208('0x29')](respondWithResult(_0x1457db,null))[_0xd208('0x48')](handleError(_0x1457db,null));};exports[_0xd208('0x56')]=function(_0x3b6a95,_0x429a96){return db['MailQueue'][_0xd208('0x51')]({'where':{'id':_0x3b6a95['params']['id']}})[_0xd208('0x29')](handleEntityNotFound(_0x429a96,null))[_0xd208('0x29')](removeEntity(_0x429a96,null))[_0xd208('0x48')](handleError(_0x429a96,null));};exports['describe']=function(_0x2b6acc,_0x508d89){return db[_0xd208('0x31')][_0xd208('0x57')]()['then'](respondWithResult(_0x508d89,null))['catch'](handleError(_0x508d89,null));};exports[_0xd208('0x58')]=function(_0x4c3407,_0x1fea53,_0x1509e0){var _0x5c44af={'raw':!![],'where':{}},_0x3391df={},_0x20df3c;return db[_0xd208('0x31')]['findOne']({'where':{'id':_0x4c3407[_0xd208('0x55')]['id']}})[_0xd208('0x29')](handleEntityNotFound(_0x1fea53,null))[_0xd208('0x29')](function(_0xdd16a3){if(_0xdd16a3){_0x20df3c=_0xdd16a3['get']({'plain':!![]});_0x3391df[_0xd208('0x35')]=_['keys'](db['UserMailQueue'][_0xd208('0x49')]);_0x3391df[_0xd208('0x36')]=_['keys'](_0x4c3407['query']);_0x3391df['filters']=_[_0xd208('0x39')](_0x3391df[_0xd208('0x35')],_0x3391df[_0xd208('0x36')]);_0x5c44af[_0xd208('0x3a')]=_[_0xd208('0x39')](_0x3391df['model'],qs['fields'](_0x4c3407[_0xd208('0x36')][_0xd208('0x3b')]));_0x5c44af[_0xd208('0x3a')]=_0x5c44af[_0xd208('0x3a')][_0xd208('0x3c')]?_0x5c44af[_0xd208('0x3a')]:_0x3391df['model'];if(!_0x4c3407['query']['hasOwnProperty'](_0xd208('0x3e'))){_0x5c44af[_0xd208('0x22')]=qs[_0xd208('0x22')](_0x4c3407[_0xd208('0x36')][_0xd208('0x22')]);_0x5c44af[_0xd208('0x20')]=qs[_0xd208('0x20')](_0x4c3407[_0xd208('0x36')][_0xd208('0x20')]);}_0x5c44af['order']=qs[_0xd208('0x3f')](_0x4c3407['query'][_0xd208('0x3f')]);_0x5c44af[_0xd208('0x40')]=qs[_0xd208('0x38')](_[_0xd208('0x41')](_0x4c3407['query'],_0x3391df['filters']));_0x5c44af[_0xd208('0x40')][_0xd208('0x59')]=_0xdd16a3['id'];if(_0x4c3407[_0xd208('0x36')]['filter']){_0x5c44af[_0xd208('0x40')]=_[_0xd208('0x43')](_0x5c44af['where'],{'$or':_[_0xd208('0x30')](_0x5c44af[_0xd208('0x3a')],function(_0x154a6b){var _0x524c43={};_0x524c43[_0x154a6b]={'$like':'%'+_0x4c3407['query'][_0xd208('0x42')]+'%'};return _0x524c43;})});}_0x5c44af=_[_0xd208('0x43')]({},_0x5c44af,_0x4c3407[_0xd208('0x44')]);return db[_0xd208('0x5a')][_0xd208('0x47')](_0x5c44af);}})[_0xd208('0x29')](function(_0x18fcf4){if(_0x18fcf4){return db[_0xd208('0x5b')][_0xd208('0x5c')]({'where':{'id':_[_0xd208('0x30')](_0x18fcf4,'UserId'),'role':_0xd208('0x5d')},'attributes':['id',_0xd208('0x2d'),'mailPause',_0xd208('0x5e'),_0xd208('0x5f')]});}})['then'](function(_0x27c61c){if(_0x27c61c){return{'count':_0x27c61c['count'],'rows':_['map'](_0x27c61c[_0xd208('0x60')],function(_0x4c1b53){return{'membername':_0x4c1b53[_0xd208('0x2d')],'UserId':_0x4c1b53['id'],'queue_name':_0x20df3c[_0xd208('0x2d')],'MailQueueId':_0x20df3c['id'],'interface':util[_0xd208('0x61')](_0xd208('0x62'),'SIP',_0x4c1b53['name']),'penalty':0x0,'paused':_0x4c1b53['mailPause'],'createdAt':_0x4c1b53['createdAt'],'updatedAt':_0x4c1b53[_0xd208('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd208('0x29')](respondWithFilteredResult(_0x1fea53,_0x5c44af))[_0xd208('0x48')](handleError(_0x1fea53,null));};exports['getTeams']=function(_0x2a6058,_0x28320a,_0x24bede){var _0x2ff763={};var _0xe3520f={};var _0xe0701c;var _0x33a1bd;return db[_0xd208('0x31')][_0xd208('0x63')]({'where':{'id':_0x2a6058[_0xd208('0x55')]['id']}})[_0xd208('0x29')](handleEntityNotFound(_0x28320a,null))[_0xd208('0x29')](function(_0xefba87){if(_0xefba87){_0xe0701c=_0xefba87;_0xe3520f['model']=_[_0xd208('0x37')](db[_0xd208('0x64')][_0xd208('0x49')]);_0xe3520f[_0xd208('0x36')]=_[_0xd208('0x37')](_0x2a6058[_0xd208('0x36')]);_0xe3520f[_0xd208('0x38')]=_[_0xd208('0x39')](_0xe3520f[_0xd208('0x35')],_0xe3520f[_0xd208('0x36')]);_0x2ff763[_0xd208('0x3a')]=_[_0xd208('0x39')](_0xe3520f[_0xd208('0x35')],qs[_0xd208('0x3b')](_0x2a6058['query']['fields']));_0x2ff763[_0xd208('0x3a')]=_0x2ff763[_0xd208('0x3a')][_0xd208('0x3c')]?_0x2ff763[_0xd208('0x3a')]:_0xe3520f['model'];_0x2ff763[_0xd208('0x65')]=qs[_0xd208('0x3f')](_0x2a6058[_0xd208('0x36')][_0xd208('0x3f')]);_0x2ff763[_0xd208('0x40')]=qs[_0xd208('0x38')](_[_0xd208('0x41')](_0x2a6058[_0xd208('0x36')],_0xe3520f[_0xd208('0x38')]));if(_0x2a6058[_0xd208('0x36')][_0xd208('0x42')]){_0x2ff763[_0xd208('0x40')]=_[_0xd208('0x43')](_0x2ff763[_0xd208('0x40')],{'$or':_[_0xd208('0x30')](_0x2ff763['attributes'],function(_0x599917){var _0x6254f6={};_0x6254f6[_0x599917]={'$like':'%'+_0x2a6058[_0xd208('0x36')][_0xd208('0x42')]+'%'};return _0x6254f6;})});}_0x2ff763=_[_0xd208('0x43')]({},_0x2ff763,_0x2a6058[_0xd208('0x44')]);return _0xe0701c[_0xd208('0x66')](_0x2ff763);}})[_0xd208('0x29')](function(_0x3f8de5){if(_0x3f8de5){_0x33a1bd=_0x3f8de5[_0xd208('0x3c')];if(!_0x2a6058['query'][_0xd208('0x3d')](_0xd208('0x3e'))){_0x2ff763[_0xd208('0x22')]=qs['limit'](_0x2a6058[_0xd208('0x36')][_0xd208('0x22')]);_0x2ff763['offset']=qs[_0xd208('0x20')](_0x2a6058[_0xd208('0x36')][_0xd208('0x20')]);}return _0xe0701c[_0xd208('0x66')](_0x2ff763);}})[_0xd208('0x29')](function(_0x552bc5){if(_0x552bc5){return _0x552bc5?{'count':_0x33a1bd,'rows':_0x552bc5}:null;}})[_0xd208('0x29')](respondWithResult(_0x28320a,null))[_0xd208('0x48')](handleError(_0x28320a,null));};exports[_0xd208('0x67')]=function(_0x2589ba,_0x515d56,_0x4fc07d){var _0xe1726=_0x2589ba[_0xd208('0x4c')]['ids'];return db[_0xd208('0x64')][_0xd208('0x47')]({'where':{'id':_0xe1726},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd208('0x2d'),_0xd208('0x68'),'voicePause',_0xd208('0x69')],'raw':!![]}]})['then'](function(_0x5063df){if(_0x5063df){var _0x34638e=_[_0xd208('0x6a')](_0x5063df,function(_0x3f3592){var _0x40359f=_0x3f3592[_0xd208('0x4e')]({'plain':!![]});return _0x40359f[_0xd208('0x6b')];});return db[_0xd208('0x31')]['find']({'where':{'id':_0x2589ba[_0xd208('0x55')]['id']}})[_0xd208('0x29')](function(_0x34774d){return db[_0xd208('0x6c')][_0xd208('0x6d')](function(_0x2c2dbc){return _0x34774d['addTeams'](_0xe1726,{'transaction':_0x2c2dbc})[_0xd208('0x29')](function(){return BPromise['each'](_0x34638e,function(_0x189931){return db[_0xd208('0x5a')][_0xd208('0x6e')]({'where':{'UserId':_0x189931['id'],'MailQueueId':_0x2589ba[_0xd208('0x55')]['id']},'transaction':_0x2c2dbc});});})[_0xd208('0x29')](function(){_0x34638e['forEach'](function(_0x21cc33){socket[_0xd208('0x6f')](_0xd208('0x70'),{'UserId':_0x21cc33['id'],'MailQueueId':_0x34774d['id']});});});});});}})[_0xd208('0x29')](respondWithStatusCode(_0x515d56,null))[_0xd208('0x48')](handleError(_0x515d56,null));};exports[_0xd208('0x71')]=function(_0x1a79ff,_0x4d7797,_0x93ca3e){return db[_0xd208('0x64')]['findAll']({'where':{'id':_0x1a79ff[_0xd208('0x36')][_0xd208('0x72')]},'attributes':['id'],'include':[{'model':db[_0xd208('0x5b')],'as':_0xd208('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xd208('0x29')](handleEntityNotFound(_0x4d7797,null))[_0xd208('0x29')](function(_0x31631d){var _0x4ea113=_[_0xd208('0x30')](_0x31631d,'id');var _0x5d3ab0=[];var _0x533cb4=[];var _0x64d9d3=squel['select']();_0x64d9d3[_0xd208('0x73')](_0xd208('0x74'))[_0xd208('0x75')](_0xd208('0x76'),'tq')['join']('user_has_teams','ut',_0xd208('0x77'))['where'](_0xd208('0x78'),_0x1a79ff[_0xd208('0x55')]['id']);for(var _0x361250=0x0;_0x361250<_0x31631d['length'];_0x361250+=0x1){let _0x82eb74=_0x31631d[_0x361250];for(var _0x3f614c=0x0;_0x3f614c<_0x82eb74['Agents'][_0xd208('0x3c')];_0x3f614c+=0x1){let _0x5a0503=_0x82eb74[_0xd208('0x6b')][_0x3f614c];var _0x5a3f72=_0x64d9d3[_0xd208('0x79')]();_0x5a3f72[_0xd208('0x40')]('ut.UserId\x20=\x20?',_0x5a0503['id']);_0x533cb4[_0xd208('0x7a')](db[_0xd208('0x6c')][_0xd208('0x36')](_0x5a3f72[_0xd208('0x7b')](),{'type':db[_0xd208('0x6c')][_0xd208('0x7c')][_0xd208('0x7d')]})['then'](function(_0x2fe438){if(_0x2fe438[_0xd208('0x3c')]===0x1){return _0x5a0503['id'];}else{var _0x124fdc=_[_0xd208('0x7e')](_[_0xd208('0x30')](_0x2fe438,'TeamId'),function(_0x21ea1a){return _[_0xd208('0x7f')](_0x4ea113,_0x21ea1a);});if(_0x124fdc){return _0x5a0503['id'];}}}));}}return BPromise[_0xd208('0x80')](_0x533cb4)['then'](function(_0x5c1bbf){_0x5d3ab0=_(_0x5d3ab0)[_0xd208('0x81')](_0x5c1bbf)['compact']()[_0xd208('0x82')]();return db[_0xd208('0x31')][_0xd208('0x51')]({'where':{'id':_0x1a79ff['params']['id']}})[_0xd208('0x29')](function(_0x111a17){return db[_0xd208('0x6c')][_0xd208('0x6d')](function(_0x9e650){return _0x111a17[_0xd208('0x71')](_0x1a79ff[_0xd208('0x36')][_0xd208('0x72')],{'transaction':_0x9e650})[_0xd208('0x29')](function(){if(!_[_0xd208('0x83')](_0x5d3ab0)){return _0x111a17[_0xd208('0x84')](_0x5d3ab0,{'transaction':_0x9e650});}})[_0xd208('0x29')](function(){_0x5d3ab0['forEach'](function(_0x592021){socket[_0xd208('0x6f')]('userMailQueue:remove',{'UserId':_0x592021,'MailQueueId':_0x111a17['id']});});});});});});})[_0xd208('0x29')](respondWithStatusCode(_0x4d7797,null))[_0xd208('0x48')](handleError(_0x4d7797,null));};exports[_0xd208('0x85')]=function(_0x4b4e64,_0x44a360,_0x4e0a1c){return db[_0xd208('0x31')][_0xd208('0x51')]({'where':{'id':_0x4b4e64[_0xd208('0x55')]['id']}})[_0xd208('0x29')](handleEntityNotFound(_0x44a360,null))[_0xd208('0x29')](function(_0x32806d){if(_0x32806d){return _0x32806d[_0xd208('0x85')](_0x4b4e64['body']['ids'],_[_0xd208('0x86')](_0x4b4e64[_0xd208('0x4c')],[_0xd208('0x72'),'id'])||{})[_0xd208('0x87')](function(_0x433b09){for(var _0x11ffa1=0x0;_0x11ffa1<_0x4b4e64['body'][_0xd208('0x72')][_0xd208('0x3c')];_0x11ffa1+=0x1){socket[_0xd208('0x6f')](_0xd208('0x70'),{'UserId':Number(_0x4b4e64[_0xd208('0x4c')][_0xd208('0x72')][_0x11ffa1]),'MailQueueId':Number(_0x4b4e64[_0xd208('0x55')]['id'])});}return _0x433b09;});}})['then'](respondWithResult(_0x44a360,null))[_0xd208('0x48')](handleError(_0x44a360,null));};exports['removeAgents']=function(_0x44ef48,_0x59c77c,_0x23e9ba){return db[_0xd208('0x31')]['find']({'where':{'id':_0x44ef48[_0xd208('0x55')]['id']}})['then'](handleEntityNotFound(_0x59c77c,null))[_0xd208('0x29')](function(_0x1db329){if(_0x1db329){return _0x1db329[_0xd208('0x84')](_0x44ef48['query'][_0xd208('0x72')])[_0xd208('0x29')](function(){if(_['isArray'](_0x44ef48[_0xd208('0x36')]['ids'])){for(var _0x4076f3=0x0;_0x4076f3<_0x44ef48[_0xd208('0x36')][_0xd208('0x72')][_0xd208('0x3c')];_0x4076f3+=0x1){socket['emit'](_0xd208('0x88'),{'UserId':Number(_0x44ef48[_0xd208('0x36')][_0xd208('0x72')][_0x4076f3]),'MailQueueId':Number(_0x44ef48[_0xd208('0x55')]['id'])});}}else{socket['emit'](_0xd208('0x88'),{'UserId':Number(_0x44ef48['query']['ids']),'MailQueueId':Number(_0x44ef48['params']['id'])});}});}})[_0xd208('0x29')](respondWithStatusCode(_0x59c77c,null))[_0xd208('0x48')](handleError(_0x59c77c,null));};exports[_0xd208('0x89')]=function(_0xfe0dbc,_0xdddd67,_0x1763a4){var _0x381b9a={};var _0x2a7bdd={};var _0x3dd8a1;var _0x28076a;return db[_0xd208('0x31')][_0xd208('0x63')]({'where':{'id':_0xfe0dbc[_0xd208('0x55')]['id']}})[_0xd208('0x29')](handleEntityNotFound(_0xdddd67,null))[_0xd208('0x29')](function(_0x2716c3){if(_0x2716c3){_0x3dd8a1=_0x2716c3;_0x2a7bdd[_0xd208('0x35')]=_['keys'](db[_0xd208('0x5b')][_0xd208('0x49')]);_0x2a7bdd[_0xd208('0x36')]=_[_0xd208('0x37')](_0xfe0dbc['query']);_0x2a7bdd['filters']=_['intersection'](_0x2a7bdd[_0xd208('0x35')],_0x2a7bdd[_0xd208('0x36')]);_0x381b9a[_0xd208('0x3a')]=_[_0xd208('0x39')](_0x2a7bdd[_0xd208('0x35')],qs[_0xd208('0x3b')](_0xfe0dbc[_0xd208('0x36')][_0xd208('0x3b')]));_0x381b9a[_0xd208('0x3a')]=_0x381b9a['attributes'][_0xd208('0x3c')]?_0x381b9a[_0xd208('0x3a')]:_0x2a7bdd[_0xd208('0x35')];_0x381b9a[_0xd208('0x65')]=qs[_0xd208('0x3f')](_0xfe0dbc[_0xd208('0x36')]['sort']);_0x381b9a[_0xd208('0x40')]=qs[_0xd208('0x38')](_[_0xd208('0x41')](_0xfe0dbc[_0xd208('0x36')],_0x2a7bdd[_0xd208('0x38')]));if(_0xfe0dbc[_0xd208('0x36')][_0xd208('0x42')]){_0x381b9a[_0xd208('0x40')]=_[_0xd208('0x43')](_0x381b9a[_0xd208('0x40')],{'$or':_['map'](_0x381b9a[_0xd208('0x3a')],function(_0x46ac40){var _0x33a608={};_0x33a608[_0x46ac40]={'$like':'%'+_0xfe0dbc[_0xd208('0x36')][_0xd208('0x42')]+'%'};return _0x33a608;})});}_0x381b9a=_[_0xd208('0x43')]({},_0x381b9a,_0xfe0dbc['options']);return _0x3dd8a1['getAgents'](_0x381b9a);}})[_0xd208('0x29')](function(_0xb3b690){if(_0xb3b690){_0x28076a=_0xb3b690[_0xd208('0x3c')];if(!_0xfe0dbc['query']['hasOwnProperty'](_0xd208('0x3e'))){_0x381b9a[_0xd208('0x22')]=qs[_0xd208('0x22')](_0xfe0dbc[_0xd208('0x36')][_0xd208('0x22')]);_0x381b9a[_0xd208('0x20')]=qs[_0xd208('0x20')](_0xfe0dbc[_0xd208('0x36')][_0xd208('0x20')]);}return _0x3dd8a1[_0xd208('0x89')](_0x381b9a);}})[_0xd208('0x29')](function(_0xadb6d2){if(_0xadb6d2){return _0xadb6d2?{'count':_0x28076a,'rows':_0xadb6d2}:null;}})[_0xd208('0x29')](respondWithResult(_0xdddd67,null))[_0xd208('0x48')](handleError(_0xdddd67,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5eb121f..e566857 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 _0x305e=['remove','emit','hasOwnProperty','hook','exports','events','MailQueue','setMaxListeners','update'];(function(_0x2441dc,_0x468683){var _0x221325=function(_0x3aaadd){while(--_0x3aaadd){_0x2441dc['push'](_0x2441dc['shift']());}};_0x221325(++_0x468683);}(_0x305e,0xd4));var _0xe305=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x305e[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xe305('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xe305('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe305('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe305('0x3'),'afterDestroy':_0xe305('0x4')};function emitEvent(_0x41564d){return function(_0x581588,_0xcc0208,_0x30be14){MailQueueEvents[_0xe305('0x5')](_0x41564d+':'+_0x581588['id'],_0x581588);MailQueueEvents[_0xe305('0x5')](_0x41564d,_0x581588);_0x30be14(null);};}for(var e in events){if(events[_0xe305('0x6')](e)){var event=events[e];MailQueue[_0xe305('0x7')](e,emitEvent(event));}}module[_0xe305('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xb9ae=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xd43aed,_0x556f54){var _0x4aa694=function(_0x56817d){while(--_0x56817d){_0xd43aed['push'](_0xd43aed['shift']());}};_0x4aa694(++_0x556f54);}(_0xb9ae,0x1b0));var _0xeb9a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb9ae[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0xeb9a('0x0'));var MailQueue=require(_0xeb9a('0x1'))['db'][_0xeb9a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xeb9a('0x3')](0x0);var events={'afterCreate':_0xeb9a('0x4'),'afterUpdate':_0xeb9a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x238bbb){return function(_0x398a40,_0x45e18b,_0x53893d){MailQueueEvents['emit'](_0x238bbb+':'+_0x398a40['id'],_0x398a40);MailQueueEvents[_0xeb9a('0x6')](_0x238bbb,_0x398a40);_0x53893d(null);};}for(var e in events){if(events[_0xeb9a('0x7')](e)){var event=events[e];MailQueue[_0xeb9a('0x8')](e,emitEvent(event));}}module[_0xeb9a('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f0f73c3..74f9db6 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 _0xca1f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash'];(function(_0x302c24,_0xec395b){var _0x36969d=function(_0x368266){while(--_0x368266){_0x302c24['push'](_0x302c24['shift']());}};_0x36969d(++_0xec395b);}(_0xca1f,0x1b1));var _0xfca1=function(_0x49661a,_0x3d0885){_0x49661a=_0x49661a-0x0;var _0x10e734=_0xca1f[_0x49661a];return _0x10e734;};'use strict';var _=require(_0xfca1('0x0'));var util=require(_0xfca1('0x1'));var logger=require(_0xfca1('0x2'))(_0xfca1('0x3'));var moment=require(_0xfca1('0x4'));var BPromise=require(_0xfca1('0x5'));var rp=require(_0xfca1('0x6'));var fs=require('fs');var path=require(_0xfca1('0x7'));var rimraf=require(_0xfca1('0x8'));var config=require('../../config/environment');var attributes=require(_0xfca1('0x9'));module[_0xfca1('0xa')]=function(_0x339eac,_0x3ae21c){return _0x339eac[_0xfca1('0xb')](_0xfca1('0xc'),attributes,{'tableName':_0xfca1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe65e=['moment','bluebird','request-promise','../../config/environment','exports','define','MailQueue','mail_queues','util','../../config/logger','api'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0xe65e,0xa2));var _0xee65=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xe65e[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0xee65('0x0'));var logger=require(_0xee65('0x1'))(_0xee65('0x2'));var moment=require(_0xee65('0x3'));var BPromise=require(_0xee65('0x4'));var rp=require(_0xee65('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee65('0x6'));var attributes=require('./mailQueue.attributes');module[_0xee65('0x7')]=function(_0x4fc1fc,_0x4be765){return _0x4fc1fc[_0xee65('0x8')](_0xee65('0x9'),attributes,{'tableName':_0xee65('0xa'),'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 ffcfecc..ad2c67b 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 _0x4fdb=['../../config/logger','../../config/environment','client','defaults','redis','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailQueue','findAll','options','where','limit','include','map','model','attributes','GetMailQueue','find','raw','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x59b238,_0xc68ddd){var _0x25226c=function(_0x2ba458){while(--_0x2ba458){_0x59b238['push'](_0x59b238['shift']());}};_0x25226c(++_0xc68ddd);}(_0x4fdb,0x9c));var _0xb4fd=function(_0xc76cfe,_0xdd0c76){_0xc76cfe=_0xc76cfe-0x0;var _0x336a3b=_0x4fdb[_0xc76cfe];return _0x336a3b;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var moment=require(_0xb4fd('0x2'));var BPromise=require(_0xb4fd('0x3'));var rs=require(_0xb4fd('0x4'));var fs=require('fs');var Redis=require(_0xb4fd('0x5'));var db=require(_0xb4fd('0x6'))['db'];var utils=require(_0xb4fd('0x7'));var logger=require(_0xb4fd('0x8'))('rpc');var config=require(_0xb4fd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb4fd('0xa')]['http']({'port':0x232a});config['redis']=_[_0xb4fd('0xb')](config[_0xb4fd('0xc')],{'host':_0xb4fd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb4fd('0xe'))[_0xb4fd('0xf')](socket);function respondWithRpcPromise(_0x18c0f7,_0x4eb1ae,_0x1e1e16){return new BPromise(function(_0x17ac4b,_0x2148db){return client[_0xb4fd('0x10')](_0x18c0f7,_0x1e1e16)[_0xb4fd('0x11')](function(_0x502379){logger[_0xb4fd('0x12')](_0xb4fd('0x13'),_0x4eb1ae,_0xb4fd('0x14'));logger[_0xb4fd('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4eb1ae,_0xb4fd('0x14'),JSON[_0xb4fd('0x16')](_0x502379));if(_0x502379[_0xb4fd('0x17')]){if(_0x502379['error'][_0xb4fd('0x18')]===0x1f4){logger[_0xb4fd('0x17')](_0xb4fd('0x13'),_0x4eb1ae,_0x502379[_0xb4fd('0x17')][_0xb4fd('0x19')]);return _0x2148db(_0x502379[_0xb4fd('0x17')][_0xb4fd('0x19')]);}logger['error'](_0xb4fd('0x13'),_0x4eb1ae,_0x502379[_0xb4fd('0x17')][_0xb4fd('0x19')]);return _0x17ac4b(_0x502379[_0xb4fd('0x17')][_0xb4fd('0x19')]);}else{logger[_0xb4fd('0x12')](_0xb4fd('0x13'),_0x4eb1ae,_0xb4fd('0x14'));_0x17ac4b(_0x502379[_0xb4fd('0x1a')][_0xb4fd('0x19')]);}})[_0xb4fd('0x1b')](function(_0x5e930d){logger['error']('MailQueue,\x20%s,\x20%s',_0x4eb1ae,_0x5e930d);_0x2148db(_0x5e930d);});});}exports['GetMailQueue']=function(_0x278726){var _0x4413ad=this;return new Promise(function(_0x299764,_0x1392c4){return db[_0xb4fd('0x1c')][_0xb4fd('0x1d')]({'raw':_0x278726[_0xb4fd('0x1e')]?_0x278726['options']['raw']===undefined?!![]:![]:!![],'where':_0x278726[_0xb4fd('0x1e')]?_0x278726[_0xb4fd('0x1e')][_0xb4fd('0x1f')]||null:null,'attributes':_0x278726['options']?_0x278726[_0xb4fd('0x1e')]['attributes']||null:null,'limit':_0x278726[_0xb4fd('0x1e')]?_0x278726['options'][_0xb4fd('0x20')]||null:null,'include':_0x278726[_0xb4fd('0x1e')]?_0x278726[_0xb4fd('0x1e')][_0xb4fd('0x21')]?_[_0xb4fd('0x22')](_0x278726[_0xb4fd('0x1e')][_0xb4fd('0x21')],function(_0x3498ad){return{'model':db[_0x3498ad['model']],'as':_0x3498ad['as'],'attributes':_0x3498ad['attributes'],'include':_0x3498ad['include']?_[_0xb4fd('0x22')](_0x3498ad['include'],function(_0x3617b2){return{'model':db[_0x3617b2['model']],'as':_0x3617b2['as'],'attributes':_0x3617b2['attributes'],'include':_0x3617b2[_0xb4fd('0x21')]?_[_0xb4fd('0x22')](_0x3617b2[_0xb4fd('0x21')],function(_0x4a057d){return{'model':db[_0x4a057d[_0xb4fd('0x23')]],'as':_0x4a057d['as'],'attributes':_0x4a057d[_0xb4fd('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb4fd('0x11')](function(_0x1a653b){logger['info'](_0xb4fd('0x25'),_0x278726);logger[_0xb4fd('0x15')]('GetMailQueue',_0x278726,JSON[_0xb4fd('0x16')](_0x1a653b));_0x299764(_0x1a653b);})[_0xb4fd('0x1b')](function(_0xbe7d2c){logger['error'](_0xb4fd('0x25'),_0xbe7d2c[_0xb4fd('0x19')],_0x278726);_0x1392c4(_0x4413ad[_0xb4fd('0x17')](0x1f4,_0xbe7d2c['message']));});});};exports['ShowMailQueue']=function(_0x4d7a63){var _0x5f36e4=this;return new Promise(function(_0x1eeb9c,_0xf5e2c4){return db[_0xb4fd('0x1c')][_0xb4fd('0x26')]({'raw':_0x4d7a63[_0xb4fd('0x1e')]?_0x4d7a63[_0xb4fd('0x1e')][_0xb4fd('0x27')]===undefined?!![]:![]:!![],'where':_0x4d7a63[_0xb4fd('0x1e')]?_0x4d7a63[_0xb4fd('0x1e')][_0xb4fd('0x1f')]||null:null,'attributes':_0x4d7a63[_0xb4fd('0x1e')]?_0x4d7a63[_0xb4fd('0x1e')][_0xb4fd('0x24')]||null:null,'include':_0x4d7a63[_0xb4fd('0x1e')]?_0x4d7a63[_0xb4fd('0x1e')][_0xb4fd('0x21')]?_[_0xb4fd('0x22')](_0x4d7a63[_0xb4fd('0x1e')]['include'],function(_0x4fadd4){return{'model':db[_0x4fadd4[_0xb4fd('0x23')]],'as':_0x4fadd4['as'],'attributes':_0x4fadd4[_0xb4fd('0x24')],'include':_0x4fadd4[_0xb4fd('0x21')]?_[_0xb4fd('0x22')](_0x4fadd4[_0xb4fd('0x21')],function(_0x50c771){return{'model':db[_0x50c771[_0xb4fd('0x23')]],'as':_0x50c771['as'],'attributes':_0x50c771[_0xb4fd('0x24')],'include':_0x50c771[_0xb4fd('0x21')]?_[_0xb4fd('0x22')](_0x50c771[_0xb4fd('0x21')],function(_0x5502e4){return{'model':db[_0x5502e4[_0xb4fd('0x23')]],'as':_0x5502e4['as'],'attributes':_0x5502e4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4fd('0x11')](function(_0x3cdf58){logger['info']('ShowMailQueue',_0x4d7a63);logger[_0xb4fd('0x15')](_0xb4fd('0x28'),_0x4d7a63,JSON[_0xb4fd('0x16')](_0x3cdf58));_0x1eeb9c(_0x3cdf58);})[_0xb4fd('0x1b')](function(_0x28487b){logger[_0xb4fd('0x17')]('ShowMailQueue',_0x28487b[_0xb4fd('0x19')],_0x4d7a63);_0xf5e2c4(_0x5f36e4[_0xb4fd('0x17')](0x1f4,_0x28487b['message']));});});}; \ No newline at end of file +var _0x219f=['info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetMailQueue','findAll','options','where','limit','include','map','model','attributes','stringify','ShowMailQueue','MailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x219f,0xc3));var _0xf219=function(_0x15f68d,_0x4cc98c){_0x15f68d=_0x15f68d-0x0;var _0x2a4cf0=_0x219f[_0x15f68d];return _0x2a4cf0;};'use strict';var _=require(_0xf219('0x0'));var util=require(_0xf219('0x1'));var moment=require(_0xf219('0x2'));var BPromise=require(_0xf219('0x3'));var rs=require(_0xf219('0x4'));var fs=require('fs');var Redis=require(_0xf219('0x5'));var db=require(_0xf219('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf219('0x7'))(_0xf219('0x8'));var config=require(_0xf219('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf219('0xa')][_0xf219('0xb')]({'port':0x232a});config[_0xf219('0xc')]=_[_0xf219('0xd')](config[_0xf219('0xc')],{'host':_0xf219('0xe'),'port':0x18eb});var socket=require(_0xf219('0xf'))(new Redis(config[_0xf219('0xc')]));require(_0xf219('0x10'))[_0xf219('0x11')](socket);function respondWithRpcPromise(_0x165c19,_0x223ef5,_0x273518){return new BPromise(function(_0x2389e7,_0x1f73b7){return client[_0xf219('0x12')](_0x165c19,_0x273518)[_0xf219('0x13')](function(_0x497e03){logger[_0xf219('0x14')](_0xf219('0x15'),_0x223ef5,_0xf219('0x16'));logger[_0xf219('0x17')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x223ef5,_0xf219('0x16'),JSON['stringify'](_0x497e03));if(_0x497e03[_0xf219('0x18')]){if(_0x497e03['error'][_0xf219('0x19')]===0x1f4){logger[_0xf219('0x18')](_0xf219('0x15'),_0x223ef5,_0x497e03['error']['message']);return _0x1f73b7(_0x497e03[_0xf219('0x18')][_0xf219('0x1a')]);}logger[_0xf219('0x18')](_0xf219('0x15'),_0x223ef5,_0x497e03['error']['message']);return _0x2389e7(_0x497e03[_0xf219('0x18')]['message']);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x223ef5,_0xf219('0x16'));_0x2389e7(_0x497e03[_0xf219('0x1b')][_0xf219('0x1a')]);}})[_0xf219('0x1c')](function(_0x17a65b){logger[_0xf219('0x18')](_0xf219('0x15'),_0x223ef5,_0x17a65b);_0x1f73b7(_0x17a65b);});});}exports[_0xf219('0x1d')]=function(_0x16a80a){var _0xbdc3d8=this;return new Promise(function(_0x268e74,_0x1e08ff){return db['MailQueue'][_0xf219('0x1e')]({'raw':_0x16a80a[_0xf219('0x1f')]?_0x16a80a[_0xf219('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x16a80a[_0xf219('0x1f')]?_0x16a80a[_0xf219('0x1f')][_0xf219('0x20')]||null:null,'attributes':_0x16a80a[_0xf219('0x1f')]?_0x16a80a[_0xf219('0x1f')]['attributes']||null:null,'limit':_0x16a80a[_0xf219('0x1f')]?_0x16a80a[_0xf219('0x1f')][_0xf219('0x21')]||null:null,'include':_0x16a80a[_0xf219('0x1f')]?_0x16a80a[_0xf219('0x1f')][_0xf219('0x22')]?_[_0xf219('0x23')](_0x16a80a[_0xf219('0x1f')][_0xf219('0x22')],function(_0x3de470){return{'model':db[_0x3de470[_0xf219('0x24')]],'as':_0x3de470['as'],'attributes':_0x3de470[_0xf219('0x25')],'include':_0x3de470[_0xf219('0x22')]?_['map'](_0x3de470['include'],function(_0x1b5591){return{'model':db[_0x1b5591[_0xf219('0x24')]],'as':_0x1b5591['as'],'attributes':_0x1b5591[_0xf219('0x25')],'include':_0x1b5591['include']?_[_0xf219('0x23')](_0x1b5591[_0xf219('0x22')],function(_0xcda7c0){return{'model':db[_0xcda7c0['model']],'as':_0xcda7c0['as'],'attributes':_0xcda7c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xf219('0x13')](function(_0x2b96c0){logger[_0xf219('0x14')]('GetMailQueue',_0x16a80a);logger[_0xf219('0x17')](_0xf219('0x1d'),_0x16a80a,JSON[_0xf219('0x26')](_0x2b96c0));_0x268e74(_0x2b96c0);})[_0xf219('0x1c')](function(_0x27add7){logger[_0xf219('0x18')](_0xf219('0x1d'),_0x27add7[_0xf219('0x1a')],_0x16a80a);_0x1e08ff(_0xbdc3d8[_0xf219('0x18')](0x1f4,_0x27add7['message']));});});};exports[_0xf219('0x27')]=function(_0x1acfe3){var _0x1e0171=this;return new Promise(function(_0x228dc2,_0x33e242){return db[_0xf219('0x28')][_0xf219('0x29')]({'raw':_0x1acfe3[_0xf219('0x1f')]?_0x1acfe3[_0xf219('0x1f')][_0xf219('0x2a')]===undefined?!![]:![]:!![],'where':_0x1acfe3[_0xf219('0x1f')]?_0x1acfe3[_0xf219('0x1f')][_0xf219('0x20')]||null:null,'attributes':_0x1acfe3['options']?_0x1acfe3[_0xf219('0x1f')][_0xf219('0x25')]||null:null,'include':_0x1acfe3[_0xf219('0x1f')]?_0x1acfe3[_0xf219('0x1f')][_0xf219('0x22')]?_[_0xf219('0x23')](_0x1acfe3['options'][_0xf219('0x22')],function(_0x28ec4c){return{'model':db[_0x28ec4c[_0xf219('0x24')]],'as':_0x28ec4c['as'],'attributes':_0x28ec4c[_0xf219('0x25')],'include':_0x28ec4c[_0xf219('0x22')]?_[_0xf219('0x23')](_0x28ec4c[_0xf219('0x22')],function(_0x3a6626){return{'model':db[_0x3a6626[_0xf219('0x24')]],'as':_0x3a6626['as'],'attributes':_0x3a6626[_0xf219('0x25')],'include':_0x3a6626[_0xf219('0x22')]?_[_0xf219('0x23')](_0x3a6626[_0xf219('0x22')],function(_0x2a4188){return{'model':db[_0x2a4188[_0xf219('0x24')]],'as':_0x2a4188['as'],'attributes':_0x2a4188['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19efdc){logger[_0xf219('0x14')](_0xf219('0x27'),_0x1acfe3);logger[_0xf219('0x17')](_0xf219('0x27'),_0x1acfe3,JSON['stringify'](_0x19efdc));_0x228dc2(_0x19efdc);})['catch'](function(_0x1447a2){logger[_0xf219('0x18')]('ShowMailQueue',_0x1447a2[_0xf219('0x1a')],_0x1acfe3);_0x33e242(_0x1e0171[_0xf219('0x18')](0x1f4,_0x1447a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 57c826e..3314b87 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 _0xc737=['./mailQueue.events','save','update','emit','removeListener','register','length'];(function(_0x573699,_0x2c8560){var _0x369f65=function(_0x17aefb){while(--_0x17aefb){_0x573699['push'](_0x573699['shift']());}};_0x369f65(++_0x2c8560);}(_0xc737,0xb6));var _0x7c73=function(_0x57efaa,_0x1d0a41){_0x57efaa=_0x57efaa-0x0;var _0x3c7ecb=_0xc737[_0x57efaa];return _0x3c7ecb;};'use strict';var MailQueueEvents=require(_0x7c73('0x0'));var events=[_0x7c73('0x1'),'remove',_0x7c73('0x2')];function createListener(_0x46498,_0x37c0dd){return function(_0x7b66ec){_0x37c0dd[_0x7c73('0x3')](_0x46498,_0x7b66ec);};}function removeListener(_0xc7eab6,_0x1d0cbd){return function(){MailQueueEvents[_0x7c73('0x4')](_0xc7eab6,_0x1d0cbd);};}exports[_0x7c73('0x5')]=function(_0x336e16){for(var _0x424701=0x0,_0x40ca6e=events[_0x7c73('0x6')];_0x424701<_0x40ca6e;_0x424701++){var _0x34cc13=events[_0x424701];var _0x13f074=createListener('mailQueue:'+_0x34cc13,_0x336e16);MailQueueEvents['on'](_0x34cc13,_0x13f074);}}; \ No newline at end of file +var _0xc9f4=['update','emit','register','mailQueue:','./mailQueue.events','remove'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xc9f4,0x1cc));var _0x4c9f=function(_0x14851b,_0x2c45a5){_0x14851b=_0x14851b-0x0;var _0x225f16=_0xc9f4[_0x14851b];return _0x225f16;};'use strict';var MailQueueEvents=require(_0x4c9f('0x0'));var events=['save',_0x4c9f('0x1'),_0x4c9f('0x2')];function createListener(_0x129e6c,_0xfa7397){return function(_0x3b8bf5){_0xfa7397[_0x4c9f('0x3')](_0x129e6c,_0x3b8bf5);};}function removeListener(_0x3ef737,_0x42397a){return function(){MailQueueEvents['removeListener'](_0x3ef737,_0x42397a);};}exports[_0x4c9f('0x4')]=function(_0x2038e9){for(var _0x45427e=0x0,_0x2e169e=events['length'];_0x45427e<_0x2e169e;_0x45427e++){var _0x39a70a=events[_0x45427e];var _0x47c142=createListener(_0x4c9f('0x5')+_0x39a70a,_0x2038e9);MailQueueEvents['on'](_0x39a70a,_0x47c142);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 821dfa9..3c15038 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 _0xe5f6=['isAuthenticated','/:id','post','put','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','/describe'];(function(_0x362607,_0x9c9a65){var _0x2f4bd3=function(_0x12241b){while(--_0x12241b){_0x362607['push'](_0x362607['shift']());}};_0x2f4bd3(++_0x9c9a65);}(_0xe5f6,0xe3));var _0x6e5f=function(_0x514d6,_0x303177){_0x514d6=_0x514d6-0x0;var _0x48abf6=_0xe5f6[_0x514d6];return _0x48abf6;};'use strict';var multer=require(_0x6e5f('0x0'));var util=require('util');var path=require(_0x6e5f('0x1'));var timeout=require(_0x6e5f('0x2'));var express=require('express');var router=express[_0x6e5f('0x3')]();var fs_extra=require(_0x6e5f('0x4'));var auth=require(_0x6e5f('0x5'));var interaction=require(_0x6e5f('0x6'));var config=require(_0x6e5f('0x7'));var controller=require(_0x6e5f('0x8'));router[_0x6e5f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6e5f('0x9')](_0x6e5f('0xa'),auth[_0x6e5f('0xb')](),controller['describe']);router[_0x6e5f('0x9')](_0x6e5f('0xc'),auth[_0x6e5f('0xb')](),controller['show']);router[_0x6e5f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6e5f('0xe')](_0x6e5f('0xc'),auth[_0x6e5f('0xb')](),controller['update']);router['delete'](_0x6e5f('0xc'),auth[_0x6e5f('0xb')](),controller[_0x6e5f('0xf')]);module[_0x6e5f('0x10')]=router; \ No newline at end of file +var _0x09eb=['/describe','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index'];(function(_0x42c767,_0x4c6f4c){var _0x112c7a=function(_0x1e6604){while(--_0x1e6604){_0x42c767['push'](_0x42c767['shift']());}};_0x112c7a(++_0x4c6f4c);}(_0x09eb,0x171));var _0xb09e=function(_0x41dfac,_0x278319){_0x41dfac=_0x41dfac-0x0;var _0x12900b=_0x09eb[_0x41dfac];return _0x12900b;};'use strict';var multer=require(_0xb09e('0x0'));var util=require(_0xb09e('0x1'));var path=require(_0xb09e('0x2'));var timeout=require(_0xb09e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb09e('0x4'));var auth=require(_0xb09e('0x5'));var interaction=require(_0xb09e('0x6'));var config=require(_0xb09e('0x7'));var controller=require(_0xb09e('0x8'));router[_0xb09e('0x9')]('/',auth['isAuthenticated'](),controller[_0xb09e('0xa')]);router['get'](_0xb09e('0xb'),auth[_0xb09e('0xc')](),controller['describe']);router[_0xb09e('0x9')]('/:id',auth[_0xb09e('0xc')](),controller[_0xb09e('0xd')]);router[_0xb09e('0xe')]('/',auth['isAuthenticated'](),controller[_0xb09e('0xf')]);router[_0xb09e('0x10')](_0xb09e('0x11'),auth[_0xb09e('0xc')](),controller['update']);router[_0xb09e('0x12')](_0xb09e('0x11'),auth['isAuthenticated'](),controller['destroy']);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 a572c63..9126fc9 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 _0x13d1=['exports','STRING','DATE','moment','sequelize'];(function(_0x4eb4ad,_0x183488){var _0x1312b2=function(_0x19aabe){while(--_0x19aabe){_0x4eb4ad['push'](_0x4eb4ad['shift']());}};_0x1312b2(++_0x183488);}(_0x13d1,0xa3));var _0x113d=function(_0x1ed0da,_0xcb6bb9){_0x1ed0da=_0x1ed0da-0x0;var _0x59f0f8=_0x13d1[_0x1ed0da];return _0x59f0f8;};'use strict';var moment=require(_0x113d('0x0'));var Sequelize=require(_0x113d('0x1'));module[_0x113d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x113d('0x3')]},'joinAt':{'type':Sequelize[_0x113d('0x4')]},'leaveAt':{'type':Sequelize[_0x113d('0x4')]},'acceptAt':{'type':Sequelize[_0x113d('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x113d('0x3')]}}; \ No newline at end of file +var _0x9540=['exports','STRING','DATE','moment','sequelize'];(function(_0x1bfe12,_0x5850ab){var _0x4b1517=function(_0x23e6bc){while(--_0x23e6bc){_0x1bfe12['push'](_0x1bfe12['shift']());}};_0x4b1517(++_0x5850ab);}(_0x9540,0x10c));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x0954('0x0'));var Sequelize=require(_0x0954('0x1'));module[_0x0954('0x2')]={'uniqueid':{'type':Sequelize[_0x0954('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0954('0x3')]},'joinAt':{'type':Sequelize[_0x0954('0x4')]},'leaveAt':{'type':Sequelize[_0x0954('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0954('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 62b128a..d8ca8a8 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 _0x81c6=['includeAll','include','findAll','rows','catch','show','keys','fields','length','create','body','find','params','describe','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','MailQueueReport'];(function(_0x2ee425,_0x4ed3b7){var _0x398a3c=function(_0x2956ef){while(--_0x2956ef){_0x2ee425['push'](_0x2ee425['shift']());}};_0x398a3c(++_0x4ed3b7);}(_0x81c6,0x1d5));var _0x681c=function(_0x3c4e48,_0x43a5eb){_0x3c4e48=_0x3c4e48-0x0;var _0x37fd7e=_0x81c6[_0x3c4e48];return _0x37fd7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];function respondWithStatusCode(_0x2d379b,_0x50cae8){_0x50cae8=_0x50cae8||0xcc;return function(_0x2e4651){if(_0x2e4651){return _0x2d379b['sendStatus'](_0x50cae8);}return _0x2d379b[_0x681c('0x13')](_0x50cae8)['end']();};}function respondWithResult(_0x2c059e,_0x27c3a2){_0x27c3a2=_0x27c3a2||0xc8;return function(_0xe8bb4d){if(_0xe8bb4d){return _0x2c059e[_0x681c('0x13')](_0x27c3a2)[_0x681c('0x14')](_0xe8bb4d);}};}function respondWithFilteredResult(_0x2bc3fb,_0x50a4ec){return function(_0x2b0939){if(_0x2b0939){var _0x1135c9=typeof _0x50a4ec[_0x681c('0x15')]===_0x681c('0x16')&&typeof _0x50a4ec[_0x681c('0x17')]===_0x681c('0x16');var _0x4e7df2=_0x2b0939[_0x681c('0x18')];var _0x42f506=_0x1135c9?0x0:_0x50a4ec[_0x681c('0x15')];var _0x42304f=_0x1135c9?_0x2b0939['count']:_0x50a4ec[_0x681c('0x15')]+_0x50a4ec[_0x681c('0x17')];var _0x54d27f;if(_0x42304f>=_0x4e7df2){_0x42304f=_0x4e7df2;_0x54d27f=0xc8;}else{_0x54d27f=0xce;}_0x2bc3fb[_0x681c('0x13')](_0x54d27f);return _0x2bc3fb['set'](_0x681c('0x19'),_0x42f506+'-'+_0x42304f+'/'+_0x4e7df2)[_0x681c('0x14')](_0x2b0939);}return null;};}function patchUpdates(_0x11d68d){return function(_0x33c495){try{jsonpatch[_0x681c('0x1a')](_0x33c495,_0x11d68d,!![]);}catch(_0x51d626){return BPromise['reject'](_0x51d626);}return _0x33c495['save']();};}function saveUpdates(_0x2e5331,_0x39c8b7){return function(_0x3adfe3){if(_0x3adfe3){return _0x3adfe3[_0x681c('0x1b')](_0x2e5331)[_0x681c('0x1c')](function(_0x29f3fa){return _0x29f3fa;});}return null;};}function removeEntity(_0x415a0a,_0x3d0297){return function(_0x1b3d2b){if(_0x1b3d2b){return _0x1b3d2b[_0x681c('0x1d')]()[_0x681c('0x1c')](function(){_0x415a0a[_0x681c('0x13')](0xcc)[_0x681c('0x1e')]();});}};}function handleEntityNotFound(_0x218410,_0x3237ed){return function(_0x228f59){if(!_0x228f59){_0x218410['sendStatus'](0x194);}return _0x228f59;};}function handleError(_0x11063b,_0x5705a7){_0x5705a7=_0x5705a7||0x1f4;return function(_0x5f8d64){logger['error'](_0x5f8d64['stack']);if(_0x5f8d64[_0x681c('0x1f')]){delete _0x5f8d64[_0x681c('0x1f')];}_0x11063b[_0x681c('0x13')](_0x5705a7)[_0x681c('0x20')](_0x5f8d64);};}exports['index']=function(_0x3b1031,_0x39fca3){var _0x2fde4b={},_0x936fce={},_0x147cda={'count':0x0,'rows':[]};var _0x204006=_[_0x681c('0x21')](db['MailQueueReport'][_0x681c('0x22')],function(_0x390be5){return{'name':_0x390be5[_0x681c('0x23')],'type':_0x390be5['type'][_0x681c('0x24')]};});_0x936fce[_0x681c('0x25')]=_[_0x681c('0x21')](_0x204006,'name');_0x936fce[_0x681c('0x26')]=_['keys'](_0x3b1031['query']);_0x936fce[_0x681c('0x27')]=_[_0x681c('0x28')](_0x936fce[_0x681c('0x25')],_0x936fce['query']);_0x2fde4b[_0x681c('0x29')]=_['intersection'](_0x936fce[_0x681c('0x25')],qs['fields'](_0x3b1031['query']['fields']));_0x2fde4b[_0x681c('0x29')]=_0x2fde4b[_0x681c('0x29')]['length']?_0x2fde4b[_0x681c('0x29')]:_0x936fce['model'];if(!_0x3b1031['query'][_0x681c('0x2a')]('nolimit')){_0x2fde4b[_0x681c('0x17')]=qs[_0x681c('0x17')](_0x3b1031[_0x681c('0x26')]['limit']);_0x2fde4b['offset']=qs[_0x681c('0x15')](_0x3b1031[_0x681c('0x26')]['offset']);}_0x2fde4b[_0x681c('0x2b')]=qs[_0x681c('0x2c')](_0x3b1031[_0x681c('0x26')]['sort']);_0x2fde4b[_0x681c('0x2d')]=qs[_0x681c('0x27')](_['pick'](_0x3b1031[_0x681c('0x26')],_0x936fce[_0x681c('0x27')]),_0x204006);if(_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]){_0x2fde4b[_0x681c('0x2d')]=_['merge'](_0x2fde4b['where'],{'$or':_[_0x681c('0x21')](_0x204006,function(_0x373f33){if(_0x373f33['type']!==_0x681c('0x2f')){var _0x183f13={};_0x183f13[_0x373f33['name']]={'$like':'%'+_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]+'%'};return _0x183f13;}})});}_0x2fde4b=_[_0x681c('0x30')]({},_0x2fde4b,_0x3b1031[_0x681c('0x31')]);var _0x3b258b={'where':_0x2fde4b[_0x681c('0x2d')]};return db[_0x681c('0x32')][_0x681c('0x18')](_0x3b258b)[_0x681c('0x1c')](function(_0x1ece6f){_0x147cda['count']=_0x1ece6f;if(_0x3b1031[_0x681c('0x26')][_0x681c('0x33')]){_0x2fde4b[_0x681c('0x34')]=[{'all':!![]}];}return db[_0x681c('0x32')][_0x681c('0x35')](_0x2fde4b);})[_0x681c('0x1c')](function(_0x542c02){_0x147cda[_0x681c('0x36')]=_0x542c02;return _0x147cda;})[_0x681c('0x1c')](respondWithFilteredResult(_0x39fca3,_0x2fde4b))[_0x681c('0x37')](handleError(_0x39fca3,null));};exports[_0x681c('0x38')]=function(_0x30abe8,_0x5dd2f4){var _0x2143a9={'raw':!![],'where':{'id':_0x30abe8['params']['id']}},_0x5d7031={};_0x5d7031[_0x681c('0x25')]=_[_0x681c('0x39')](db[_0x681c('0x32')][_0x681c('0x22')]);_0x5d7031['query']=_[_0x681c('0x39')](_0x30abe8['query']);_0x5d7031['filters']=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],_0x5d7031[_0x681c('0x26')]);_0x2143a9[_0x681c('0x29')]=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],qs['fields'](_0x30abe8[_0x681c('0x26')][_0x681c('0x3a')]));_0x2143a9['attributes']=_0x2143a9['attributes'][_0x681c('0x3b')]?_0x2143a9['attributes']:_0x5d7031[_0x681c('0x25')];if(_0x30abe8['query']['includeAll']){_0x2143a9['include']=[{'all':!![]}];}_0x2143a9=_[_0x681c('0x30')]({},_0x2143a9,_0x30abe8[_0x681c('0x31')]);return db[_0x681c('0x32')]['find'](_0x2143a9)[_0x681c('0x1c')](handleEntityNotFound(_0x5dd2f4,null))[_0x681c('0x1c')](respondWithResult(_0x5dd2f4,null))['catch'](handleError(_0x5dd2f4,null));};exports[_0x681c('0x3c')]=function(_0x17bb48,_0x15d1c0){return db[_0x681c('0x32')]['create'](_0x17bb48[_0x681c('0x3d')],{})['then'](respondWithResult(_0x15d1c0,0xc9))[_0x681c('0x37')](handleError(_0x15d1c0,null));};exports[_0x681c('0x1b')]=function(_0xa56f20,_0x5731f0){if(_0xa56f20[_0x681c('0x3d')]['id']){delete _0xa56f20[_0x681c('0x3d')]['id'];}return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0xa56f20[_0x681c('0x3f')]['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x5731f0,null))[_0x681c('0x1c')](saveUpdates(_0xa56f20[_0x681c('0x3d')],null))[_0x681c('0x1c')](respondWithResult(_0x5731f0,null))[_0x681c('0x37')](handleError(_0x5731f0,null));};exports[_0x681c('0x1d')]=function(_0x37bdf6,_0x4cae41){return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0x37bdf6['params']['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x4cae41,null))[_0x681c('0x1c')](removeEntity(_0x4cae41,null))['catch'](handleError(_0x4cae41,null));};exports[_0x681c('0x40')]=function(_0x5e58bf,_0x38daf8){return db[_0x681c('0x32')][_0x681c('0x40')]()['then'](respondWithResult(_0x38daf8,null))[_0x681c('0x37')](handleError(_0x38daf8,null));}; \ No newline at end of file +var _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','MailQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':!![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f0f7e14..069b5d9 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 _0x3630=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ea4ce,_0x6bf6f1){var _0x36cf6e=function(_0x1aca49){while(--_0x1aca49){_0x3ea4ce['push'](_0x3ea4ce['shift']());}};_0x36cf6e(++_0x6bf6f1);}(_0x3630,0x199));var _0x0363=function(_0x5175cf,_0x44abcf){_0x5175cf=_0x5175cf-0x0;var _0x43a50e=_0x3630[_0x5175cf];return _0x43a50e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0363('0x0'))(_0x0363('0x1'));var moment=require(_0x0363('0x2'));var BPromise=require(_0x0363('0x3'));var rp=require(_0x0363('0x4'));var fs=require('fs');var path=require(_0x0363('0x5'));var rimraf=require(_0x0363('0x6'));var config=require(_0x0363('0x7'));var attributes=require(_0x0363('0x8'));module[_0x0363('0x9')]=function(_0x5eb5ff,_0x2088fa){return _0x5eb5ff[_0x0363('0xa')](_0x0363('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x0363('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x732b=['../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','bluebird','path','rimraf'];(function(_0x16799b,_0xdcf5c4){var _0x3b699f=function(_0x411b42){while(--_0x411b42){_0x16799b['push'](_0x16799b['shift']());}};_0x3b699f(++_0xdcf5c4);}(_0x732b,0xf6));var _0xb732=function(_0x6173ed,_0x1054ca){_0x6173ed=_0x6173ed-0x0;var _0x58f671=_0x732b[_0x6173ed];return _0x58f671;};'use strict';var _=require(_0xb732('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb732('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb732('0x2'));var rimraf=require(_0xb732('0x3'));var config=require(_0xb732('0x4'));var attributes=require('./mailQueueReport.attributes');module[_0xb732('0x5')]=function(_0x1be636,_0x1c3668){return _0x1be636[_0xb732('0x6')](_0xb732('0x7'),attributes,{'tableName':_0xb732('0x8'),'paranoid':![],'indexes':[{'name':_0xb732('0x9'),'fields':[_0xb732('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d2975ee..0361074 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0xe5e762,_0x5daf6e){var _0x3b12be=function(_0x4ee262){while(--_0x4ee262){_0xe5e762['push'](_0xe5e762['shift']());}};_0x3b12be(++_0x5daf6e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57fee9,_0xd6e805){_0x57fee9=_0x57fee9-0x0;var _0x15167a=_0x5f2f[_0x57fee9];return _0x15167a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x595be4,_0x59fa81){var _0x43e103=function(_0x1533e5){while(--_0x1533e5){_0x595be4['push'](_0x595be4['shift']());}};_0x43e103(++_0x59fa81);}(_0x326f,0xd1));var _0xf326=function(_0x5ebdf1,_0x5e65fe){_0x5ebdf1=_0x5ebdf1-0x0;var _0x2ee4cc=_0x326f[_0x5ebdf1];return _0x2ee4cc;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f6141bf..1120204 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1a2750,_0x108b26){var _0x280f0c=function(_0x15d53d){while(--_0x15d53d){_0x1a2750['push'](_0x1a2750['shift']());}};_0x280f0c(++_0x108b26);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0xcb91[_0x1486e5];return _0x29d89b;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1640ad,_0x4a00a4){var _0x5915b2=function(_0x39e633){while(--_0x39e633){_0x1640ad['push'](_0x1640ad['shift']());}};_0x5915b2(++_0x4a00a4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xcb91[_0x3a1ea5];return _0xfac9b2;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 6183616..d23944e 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 _0x219d=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x454db7,_0x19898f){var _0x520d54=function(_0x5c5195){while(--_0x5c5195){_0x454db7['push'](_0x454db7['shift']());}};_0x520d54(++_0x19898f);}(_0x219d,0xa4));var _0xd219=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x219d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xd219('0x0'));module[_0xd219('0x1')]={'description':{'type':Sequelize[_0xd219('0x2')]},'host':{'type':Sequelize[_0xd219('0x2')]},'authentication':{'type':Sequelize[_0xd219('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd219('0x2')]},'password':{'type':Sequelize[_0xd219('0x2')]},'port':{'type':Sequelize[_0xd219('0x4')]},'tls':{'type':Sequelize[_0xd219('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd219('0x2')],'defaultValue':_0xd219('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xd219('0x2')]},'modernAuthentication':{'type':Sequelize[_0xd219('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5483=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x431d0d,_0x1a4fce){var _0x1036ef=function(_0x361238){while(--_0x361238){_0x431d0d['push'](_0x431d0d['shift']());}};_0x1036ef(++_0x1a4fce);}(_0x5483,0x6b));var _0x3548=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x5483[_0x34f701];return _0x3e2429;};'use strict';var Sequelize=require(_0x3548('0x0'));module['exports']={'description':{'type':Sequelize[_0x3548('0x1')]},'host':{'type':Sequelize[_0x3548('0x1')]},'authentication':{'type':Sequelize[_0x3548('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3548('0x1')]},'password':{'type':Sequelize[_0x3548('0x1')]},'port':{'type':Sequelize[_0x3548('0x3')]},'tls':{'type':Sequelize[_0x3548('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3548('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x3548('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2ae1c33..d932c24 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 _0x8b9e=['exports','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0xa59d49,_0x528721){var _0x2d0df4=function(_0x2c2f2e){while(--_0x2c2f2e){_0xa59d49['push'](_0xa59d49['shift']());}};_0x2d0df4(++_0x528721);}(_0x8b9e,0xda));var _0xe8b9=function(_0x1b02ce,_0x389bf6){_0x1b02ce=_0x1b02ce-0x0;var _0x4b4af3=_0x8b9e[_0x1b02ce];return _0x4b4af3;};'use strict';var _=require(_0xe8b9('0x0'));var util=require(_0xe8b9('0x1'));var logger=require('../../config/logger')(_0xe8b9('0x2'));var moment=require(_0xe8b9('0x3'));var BPromise=require(_0xe8b9('0x4'));var rp=require(_0xe8b9('0x5'));var fs=require('fs');var path=require(_0xe8b9('0x6'));var rimraf=require(_0xe8b9('0x7'));var config=require(_0xe8b9('0x8'));var attributes=require(_0xe8b9('0x9'));module[_0xe8b9('0xa')]=function(_0x2047b6,_0x337f6b){return _0x2047b6['define']('MailServerIn',attributes,{'tableName':_0xe8b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fd4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x5313fd,_0x46cfff){var _0x340302=function(_0x2f8b0b){while(--_0x2f8b0b){_0x5313fd['push'](_0x5313fd['shift']());}};_0x340302(++_0x46cfff);}(_0x6fd4,0x1bd));var _0x46fd=function(_0x5f0d74,_0x399d0e){_0x5f0d74=_0x5f0d74-0x0;var _0x45766b=_0x6fd4[_0x5f0d74];return _0x45766b;};'use strict';var _=require(_0x46fd('0x0'));var util=require(_0x46fd('0x1'));var logger=require(_0x46fd('0x2'))(_0x46fd('0x3'));var moment=require(_0x46fd('0x4'));var BPromise=require(_0x46fd('0x5'));var rp=require(_0x46fd('0x6'));var fs=require('fs');var path=require(_0x46fd('0x7'));var rimraf=require(_0x46fd('0x8'));var config=require(_0x46fd('0x9'));var attributes=require(_0x46fd('0xa'));module['exports']=function(_0x28ed86,_0xaa9843){return _0x28ed86[_0x46fd('0xb')](_0x46fd('0xc'),attributes,{'tableName':_0x46fd('0xd'),'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 e2c5b89..39d1ca8 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 _0xdeff=['jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','options','raw','limit','include','model','attributes','map','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2e9612,_0x2e5078){var _0x44fd72=function(_0x193c0f){while(--_0x193c0f){_0x2e9612['push'](_0x2e9612['shift']());}};_0x44fd72(++_0x2e5078);}(_0xdeff,0xef));var _0xfdef=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0xdeff[_0x277af0];return _0x43bd7c;};'use strict';var _=require(_0xfdef('0x0'));var util=require(_0xfdef('0x1'));var moment=require(_0xfdef('0x2'));var BPromise=require(_0xfdef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdef('0x5'));var logger=require(_0xfdef('0x6'))(_0xfdef('0x7'));var config=require(_0xfdef('0x8'));var jayson=require(_0xfdef('0x9'));var client=jayson[_0xfdef('0xa')][_0xfdef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48c2f8,_0xb9a0ec,_0x3b5c67){return new BPromise(function(_0x22bb85,_0x187212){return client['request'](_0x48c2f8,_0x3b5c67)[_0xfdef('0xc')](function(_0x4e2a58){logger[_0xfdef('0xd')]('MailServerIn,\x20%s,\x20%s',_0xb9a0ec,_0xfdef('0xe'));logger[_0xfdef('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0xb9a0ec,_0xfdef('0xe'),JSON[_0xfdef('0x10')](_0x4e2a58));if(_0x4e2a58[_0xfdef('0x11')]){if(_0x4e2a58[_0xfdef('0x11')][_0xfdef('0x12')]===0x1f4){logger[_0xfdef('0x11')](_0xfdef('0x13'),_0xb9a0ec,_0x4e2a58['error'][_0xfdef('0x14')]);return _0x187212(_0x4e2a58[_0xfdef('0x11')][_0xfdef('0x14')]);}logger[_0xfdef('0x11')](_0xfdef('0x13'),_0xb9a0ec,_0x4e2a58['error'][_0xfdef('0x14')]);return _0x22bb85(_0x4e2a58[_0xfdef('0x11')]['message']);}else{logger[_0xfdef('0xd')](_0xfdef('0x13'),_0xb9a0ec,_0xfdef('0xe'));_0x22bb85(_0x4e2a58['result'][_0xfdef('0x14')]);}})[_0xfdef('0x15')](function(_0x5e79ef){logger[_0xfdef('0x11')](_0xfdef('0x13'),_0xb9a0ec,_0x5e79ef);_0x187212(_0x5e79ef);});});}exports[_0xfdef('0x16')]=function(_0x1d386e){var _0x389bd4=this;return new Promise(function(_0x51867e,_0x560cc6){return db[_0xfdef('0x17')]['findAll']({'raw':_0x1d386e[_0xfdef('0x18')]?_0x1d386e[_0xfdef('0x18')][_0xfdef('0x19')]===undefined?!![]:![]:!![],'where':_0x1d386e['options']?_0x1d386e[_0xfdef('0x18')]['where']||null:null,'attributes':_0x1d386e[_0xfdef('0x18')]?_0x1d386e[_0xfdef('0x18')]['attributes']||null:null,'limit':_0x1d386e['options']?_0x1d386e['options'][_0xfdef('0x1a')]||null:null,'include':_0x1d386e[_0xfdef('0x18')]?_0x1d386e[_0xfdef('0x18')][_0xfdef('0x1b')]?_['map'](_0x1d386e[_0xfdef('0x18')][_0xfdef('0x1b')],function(_0x4cd1f7){return{'model':db[_0x4cd1f7[_0xfdef('0x1c')]],'as':_0x4cd1f7['as'],'attributes':_0x4cd1f7[_0xfdef('0x1d')],'include':_0x4cd1f7[_0xfdef('0x1b')]?_[_0xfdef('0x1e')](_0x4cd1f7['include'],function(_0x45a27d){return{'model':db[_0x45a27d[_0xfdef('0x1c')]],'as':_0x45a27d['as'],'attributes':_0x45a27d[_0xfdef('0x1d')],'include':_0x45a27d['include']?_[_0xfdef('0x1e')](_0x45a27d['include'],function(_0x55f085){return{'model':db[_0x55f085[_0xfdef('0x1c')]],'as':_0x55f085['as'],'attributes':_0x55f085[_0xfdef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfdef('0xc')](function(_0x4f9d23){logger[_0xfdef('0xd')](_0xfdef('0x16'),_0x1d386e);logger[_0xfdef('0xf')](_0xfdef('0x16'),_0x1d386e,JSON[_0xfdef('0x10')](_0x4f9d23));_0x51867e(_0x4f9d23);})[_0xfdef('0x15')](function(_0x5019a1){logger[_0xfdef('0x11')]('GetMailServerIn',_0x5019a1[_0xfdef('0x14')],_0x1d386e);_0x560cc6(_0x389bd4[_0xfdef('0x11')](0x1f4,_0x5019a1[_0xfdef('0x14')]));});});}; \ No newline at end of file +var _0xcf2d=['options','raw','where','attributes','limit','map','model','include','then','GetMailServerIn','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','findAll'];(function(_0x383971,_0x1cd3f4){var _0x365817=function(_0x234da5){while(--_0x234da5){_0x383971['push'](_0x383971['shift']());}};_0x365817(++_0x1cd3f4);}(_0xcf2d,0x1ea));var _0xdcf2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdcf2('0x0'));var util=require(_0xdcf2('0x1'));var moment=require(_0xdcf2('0x2'));var BPromise=require(_0xdcf2('0x3'));var rs=require(_0xdcf2('0x4'));var fs=require('fs');var Redis=require(_0xdcf2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdcf2('0x6'));var config=require(_0xdcf2('0x7'));var jayson=require(_0xdcf2('0x8'));var client=jayson[_0xdcf2('0x9')][_0xdcf2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x298837,_0x435edf,_0x34d448){return new BPromise(function(_0x4a1c7f,_0x5cf8d0){return client[_0xdcf2('0xb')](_0x298837,_0x34d448)['then'](function(_0x399984){logger[_0xdcf2('0xc')](_0xdcf2('0xd'),_0x435edf,'request\x20sent');logger[_0xdcf2('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x435edf,_0xdcf2('0xf'),JSON[_0xdcf2('0x10')](_0x399984));if(_0x399984[_0xdcf2('0x11')]){if(_0x399984['error'][_0xdcf2('0x12')]===0x1f4){logger[_0xdcf2('0x11')](_0xdcf2('0xd'),_0x435edf,_0x399984[_0xdcf2('0x11')]['message']);return _0x5cf8d0(_0x399984[_0xdcf2('0x11')][_0xdcf2('0x13')]);}logger[_0xdcf2('0x11')](_0xdcf2('0xd'),_0x435edf,_0x399984[_0xdcf2('0x11')][_0xdcf2('0x13')]);return _0x4a1c7f(_0x399984[_0xdcf2('0x11')][_0xdcf2('0x13')]);}else{logger[_0xdcf2('0xc')](_0xdcf2('0xd'),_0x435edf,_0xdcf2('0xf'));_0x4a1c7f(_0x399984['result'][_0xdcf2('0x13')]);}})[_0xdcf2('0x14')](function(_0xc7869c){logger['error']('MailServerIn,\x20%s,\x20%s',_0x435edf,_0xc7869c);_0x5cf8d0(_0xc7869c);});});}exports['GetMailServerIn']=function(_0x3f0d7a){var _0x4b372d=this;return new Promise(function(_0x2f3264,_0x58c032){return db['MailServerIn'][_0xdcf2('0x15')]({'raw':_0x3f0d7a[_0xdcf2('0x16')]?_0x3f0d7a[_0xdcf2('0x16')][_0xdcf2('0x17')]===undefined?!![]:![]:!![],'where':_0x3f0d7a[_0xdcf2('0x16')]?_0x3f0d7a['options'][_0xdcf2('0x18')]||null:null,'attributes':_0x3f0d7a[_0xdcf2('0x16')]?_0x3f0d7a['options'][_0xdcf2('0x19')]||null:null,'limit':_0x3f0d7a[_0xdcf2('0x16')]?_0x3f0d7a['options'][_0xdcf2('0x1a')]||null:null,'include':_0x3f0d7a[_0xdcf2('0x16')]?_0x3f0d7a[_0xdcf2('0x16')]['include']?_[_0xdcf2('0x1b')](_0x3f0d7a[_0xdcf2('0x16')]['include'],function(_0x33cb33){return{'model':db[_0x33cb33[_0xdcf2('0x1c')]],'as':_0x33cb33['as'],'attributes':_0x33cb33[_0xdcf2('0x19')],'include':_0x33cb33[_0xdcf2('0x1d')]?_[_0xdcf2('0x1b')](_0x33cb33[_0xdcf2('0x1d')],function(_0x16fee9){return{'model':db[_0x16fee9[_0xdcf2('0x1c')]],'as':_0x16fee9['as'],'attributes':_0x16fee9[_0xdcf2('0x19')],'include':_0x16fee9[_0xdcf2('0x1d')]?_[_0xdcf2('0x1b')](_0x16fee9[_0xdcf2('0x1d')],function(_0x1ffb3a){return{'model':db[_0x1ffb3a[_0xdcf2('0x1c')]],'as':_0x1ffb3a['as'],'attributes':_0x1ffb3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdcf2('0x1e')](function(_0x19caa0){logger['info']('GetMailServerIn',_0x3f0d7a);logger['debug'](_0xdcf2('0x1f'),_0x3f0d7a,JSON[_0xdcf2('0x10')](_0x19caa0));_0x2f3264(_0x19caa0);})[_0xdcf2('0x14')](function(_0x4e0b90){logger[_0xdcf2('0x11')](_0xdcf2('0x1f'),_0x4e0b90[_0xdcf2('0x13')],_0x3f0d7a);_0x58c032(_0x4b372d['error'](0x1f4,_0x4e0b90[_0xdcf2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2dcb565..7a75389 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(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_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('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(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x356b6c,_0x57a2e6){_0x356b6c=_0x356b6c-0x0;var _0x1aa4f3=_0x7a54[_0x356b6c];return _0x1aa4f3;};'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 2ffc949..044c5da 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 _0xb574=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x2c67c7,_0x1c596d){var _0x484555=function(_0x4adc89){while(--_0x4adc89){_0x2c67c7['push'](_0x2c67c7['shift']());}};_0x484555(++_0x1c596d);}(_0xb574,0x106));var _0x4b57=function(_0x404e9c,_0x460a7b){_0x404e9c=_0x404e9c-0x0;var _0x72167d=_0xb574[_0x404e9c];return _0x72167d;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4b57('0x2')]},'user':{'type':Sequelize[_0x4b57('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4b57('0x3')]},'secure':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4b57('0x2')]},'authentication':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x1eba=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4e29f4,_0x5e8fdf){var _0x1c9f93=function(_0x371ff8){while(--_0x371ff8){_0x4e29f4['push'](_0x4e29f4['shift']());}};_0x1c9f93(++_0x5e8fdf);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1eba[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'description':{'type':Sequelize[_0xa1eb('0x2')]},'host':{'type':Sequelize[_0xa1eb('0x2')]},'user':{'type':Sequelize[_0xa1eb('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xa1eb('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xa1eb('0x2')]},'authentication':{'type':Sequelize[_0xa1eb('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xa1eb('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 3fce7e9..96e0734 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 _0xc204=['bluebird','path','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','set','apply','update','error','stack','name','send','index','MailServerOut','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment'];(function(_0x1d5d6a,_0x1ec6b4){var _0x1c2058=function(_0x3ebde2){while(--_0x3ebde2){_0x1d5d6a['push'](_0x1d5d6a['shift']());}};_0x1c2058(++_0x1ec6b4);}(_0xc204,0x150));var _0x4c20=function(_0x4ab58e,_0x3f19cc){_0x4ab58e=_0x4ab58e-0x0;var _0x163644=_0xc204[_0x4ab58e];return _0x163644;};'use strict';var emlformat=require(_0x4c20('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c20('0x1'));var rp=require(_0x4c20('0x2'));var moment=require(_0x4c20('0x3'));var BPromise=require(_0x4c20('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4c20('0x5'));var sox=require('sox');var csv=require(_0x4c20('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4c20('0x7'));var crypto=require(_0x4c20('0x8'));var jsforce=require(_0x4c20('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4c20('0x6'));var querystring=require(_0x4c20('0xa'));var Papa=require('papaparse');var Redis=require(_0x4c20('0xb'));var authService=require(_0x4c20('0xc'));var qs=require(_0x4c20('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c20('0xe'));var logger=require(_0x4c20('0xf'))(_0x4c20('0x10'));var utils=require(_0x4c20('0x11'));var config=require(_0x4c20('0x12'));var licenseUtil=require(_0x4c20('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa7b511,_0x52ee71){_0x52ee71=_0x52ee71||0xcc;return function(_0x4162b0){if(_0x4162b0){return _0xa7b511[_0x4c20('0x14')](_0x52ee71);}return _0xa7b511['status'](_0x52ee71)[_0x4c20('0x15')]();};}function respondWithResult(_0xffc4d3,_0x10bd71){_0x10bd71=_0x10bd71||0xc8;return function(_0x5e1861){if(_0x5e1861){return _0xffc4d3[_0x4c20('0x16')](_0x10bd71)[_0x4c20('0x17')](_0x5e1861);}};}function respondWithFilteredResult(_0x581603,_0x405e40){return function(_0x13530c){if(_0x13530c){var _0x398e2e=typeof _0x405e40['offset']==='undefined'&&typeof _0x405e40[_0x4c20('0x18')]===_0x4c20('0x19');var _0x6dfe91=_0x13530c['count'];var _0x5ecf6c=_0x398e2e?0x0:_0x405e40['offset'];var _0x5b90a0=_0x398e2e?_0x13530c[_0x4c20('0x1a')]:_0x405e40['offset']+_0x405e40[_0x4c20('0x18')];var _0x4542ef;if(_0x5b90a0>=_0x6dfe91){_0x5b90a0=_0x6dfe91;_0x4542ef=0xc8;}else{_0x4542ef=0xce;}_0x581603[_0x4c20('0x16')](_0x4542ef);return _0x581603[_0x4c20('0x1b')]('Content-Range',_0x5ecf6c+'-'+_0x5b90a0+'/'+_0x6dfe91)[_0x4c20('0x17')](_0x13530c);}return null;};}function patchUpdates(_0xfacaef){return function(_0x2db19e){try{jsonpatch[_0x4c20('0x1c')](_0x2db19e,_0xfacaef,!![]);}catch(_0x4219c8){return BPromise['reject'](_0x4219c8);}return _0x2db19e['save']();};}function saveUpdates(_0x710d0d,_0x136206){return function(_0x5ac150){if(_0x5ac150){return _0x5ac150[_0x4c20('0x1d')](_0x710d0d)['then'](function(_0x5c8ad9){return _0x5c8ad9;});}return null;};}function removeEntity(_0x3c797f,_0x1cd32a){return function(_0x52e99a){if(_0x52e99a){return _0x52e99a['destroy']()['then'](function(){_0x3c797f[_0x4c20('0x16')](0xcc)[_0x4c20('0x15')]();});}};}function handleEntityNotFound(_0x1b65a8,_0x507abc){return function(_0x5528f9){if(!_0x5528f9){_0x1b65a8[_0x4c20('0x14')](0x194);}return _0x5528f9;};}function handleError(_0x45c0d4,_0x34d436){_0x34d436=_0x34d436||0x1f4;return function(_0x211d83){logger[_0x4c20('0x1e')](_0x211d83[_0x4c20('0x1f')]);if(_0x211d83[_0x4c20('0x20')]){delete _0x211d83[_0x4c20('0x20')];}_0x45c0d4[_0x4c20('0x16')](_0x34d436)[_0x4c20('0x21')](_0x211d83);};}exports[_0x4c20('0x22')]=function(_0x380cf0,_0x4938bc){var _0x7524a2={},_0x30b89e={},_0x172e60={'count':0x0,'rows':[]};var _0x4aa5f1=_['map'](db[_0x4c20('0x23')][_0x4c20('0x24')],function(_0x448bc4){return{'name':_0x448bc4['fieldName'],'type':_0x448bc4['type']['key']};});_0x30b89e[_0x4c20('0x25')]=_[_0x4c20('0x26')](_0x4aa5f1,_0x4c20('0x20'));_0x30b89e[_0x4c20('0x27')]=_[_0x4c20('0x28')](_0x380cf0[_0x4c20('0x27')]);_0x30b89e[_0x4c20('0x29')]=_[_0x4c20('0x2a')](_0x30b89e[_0x4c20('0x25')],_0x30b89e[_0x4c20('0x27')]);_0x7524a2[_0x4c20('0x2b')]=_['intersection'](_0x30b89e[_0x4c20('0x25')],qs['fields'](_0x380cf0[_0x4c20('0x27')][_0x4c20('0x2c')]));_0x7524a2[_0x4c20('0x2b')]=_0x7524a2['attributes']['length']?_0x7524a2[_0x4c20('0x2b')]:_0x30b89e[_0x4c20('0x25')];if(!_0x380cf0[_0x4c20('0x27')][_0x4c20('0x2d')](_0x4c20('0x2e'))){_0x7524a2[_0x4c20('0x18')]=qs[_0x4c20('0x18')](_0x380cf0[_0x4c20('0x27')]['limit']);_0x7524a2['offset']=qs[_0x4c20('0x2f')](_0x380cf0[_0x4c20('0x27')][_0x4c20('0x2f')]);}_0x7524a2[_0x4c20('0x30')]=qs[_0x4c20('0x31')](_0x380cf0[_0x4c20('0x27')]['sort']);_0x7524a2[_0x4c20('0x32')]=qs[_0x4c20('0x29')](_[_0x4c20('0x33')](_0x380cf0[_0x4c20('0x27')],_0x30b89e[_0x4c20('0x29')]),_0x4aa5f1);if(_0x380cf0[_0x4c20('0x27')][_0x4c20('0x34')]){_0x7524a2['where']=_[_0x4c20('0x35')](_0x7524a2['where'],{'$or':_[_0x4c20('0x26')](_0x4aa5f1,function(_0x33233e){if(_0x33233e['type']!==_0x4c20('0x36')){var _0x246b26={};_0x246b26[_0x33233e[_0x4c20('0x20')]]={'$like':'%'+_0x380cf0[_0x4c20('0x27')][_0x4c20('0x34')]+'%'};return _0x246b26;}})});}_0x7524a2=_[_0x4c20('0x35')]({},_0x7524a2,_0x380cf0[_0x4c20('0x37')]);var _0x374c05={'where':_0x7524a2[_0x4c20('0x32')]};return db['MailServerOut'][_0x4c20('0x1a')](_0x374c05)[_0x4c20('0x38')](function(_0x2cdca6){_0x172e60['count']=_0x2cdca6;if(_0x380cf0[_0x4c20('0x27')][_0x4c20('0x39')]){_0x7524a2[_0x4c20('0x3a')]=[{'all':!![]}];}return db['MailServerOut'][_0x4c20('0x3b')](_0x7524a2);})[_0x4c20('0x38')](function(_0x35bbd3){_0x172e60[_0x4c20('0x3c')]=_0x35bbd3;return _0x172e60;})[_0x4c20('0x38')](respondWithFilteredResult(_0x4938bc,_0x7524a2))[_0x4c20('0x3d')](handleError(_0x4938bc,null));};exports[_0x4c20('0x3e')]=function(_0x210a00,_0x36bcd4){var _0x6991c4={'raw':!![],'where':{'id':_0x210a00[_0x4c20('0x3f')]['id']}},_0x4010ec={};_0x4010ec[_0x4c20('0x25')]=_['keys'](db[_0x4c20('0x23')][_0x4c20('0x24')]);_0x4010ec[_0x4c20('0x27')]=_['keys'](_0x210a00['query']);_0x4010ec[_0x4c20('0x29')]=_[_0x4c20('0x2a')](_0x4010ec[_0x4c20('0x25')],_0x4010ec[_0x4c20('0x27')]);_0x6991c4[_0x4c20('0x2b')]=_[_0x4c20('0x2a')](_0x4010ec[_0x4c20('0x25')],qs[_0x4c20('0x2c')](_0x210a00[_0x4c20('0x27')][_0x4c20('0x2c')]));_0x6991c4[_0x4c20('0x2b')]=_0x6991c4[_0x4c20('0x2b')][_0x4c20('0x40')]?_0x6991c4['attributes']:_0x4010ec[_0x4c20('0x25')];if(_0x210a00[_0x4c20('0x27')][_0x4c20('0x39')]){_0x6991c4[_0x4c20('0x3a')]=[{'all':!![]}];}_0x6991c4=_[_0x4c20('0x35')]({},_0x6991c4,_0x210a00['options']);return db[_0x4c20('0x23')][_0x4c20('0x41')](_0x6991c4)['then'](handleEntityNotFound(_0x36bcd4,null))[_0x4c20('0x38')](respondWithResult(_0x36bcd4,null))['catch'](handleError(_0x36bcd4,null));};exports[_0x4c20('0x42')]=function(_0x327f11,_0x185bab){return db[_0x4c20('0x23')][_0x4c20('0x42')](_0x327f11[_0x4c20('0x43')],{})['then'](respondWithResult(_0x185bab,0xc9))[_0x4c20('0x3d')](handleError(_0x185bab,null));};exports[_0x4c20('0x1d')]=function(_0x251d00,_0x30c68f){if(_0x251d00[_0x4c20('0x43')]['id']){delete _0x251d00[_0x4c20('0x43')]['id'];}return db[_0x4c20('0x23')][_0x4c20('0x41')]({'where':{'id':_0x251d00['params']['id']}})[_0x4c20('0x38')](handleEntityNotFound(_0x30c68f,null))['then'](saveUpdates(_0x251d00[_0x4c20('0x43')],null))[_0x4c20('0x38')](respondWithResult(_0x30c68f,null))[_0x4c20('0x3d')](handleError(_0x30c68f,null));};exports['destroy']=function(_0x4d7aef,_0x327da1){return db['MailServerOut'][_0x4c20('0x41')]({'where':{'id':_0x4d7aef[_0x4c20('0x3f')]['id']}})[_0x4c20('0x38')](handleEntityNotFound(_0x327da1,null))[_0x4c20('0x38')](removeEntity(_0x327da1,null))[_0x4c20('0x3d')](handleError(_0x327da1,null));}; \ No newline at end of file +var _0x278f=['hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x3c57f0,_0x335633){var _0x5c3398=function(_0x48921c){while(--_0x48921c){_0x3c57f0['push'](_0x3c57f0['shift']());}};_0x5c3398(++_0x335633);}(_0x278f,0xa0));var _0xf278=function(_0x15639f,_0x56e964){_0x15639f=_0x15639f-0x0;var _0x17f403=_0x278f[_0x15639f];return _0x17f403;};'use strict';var emlformat=require(_0xf278('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf278('0x1'));var jsonpatch=require(_0xf278('0x2'));var rp=require(_0xf278('0x3'));var moment=require(_0xf278('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf278('0x5'));var util=require(_0xf278('0x6'));var path=require(_0xf278('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf278('0x8'));var fs=require('fs');var fs_extra=require(_0xf278('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf278('0xa'));var deskjs=require(_0xf278('0xb'));var toCsv=require(_0xf278('0xc'));var querystring=require(_0xf278('0xd'));var Papa=require(_0xf278('0xe'));var Redis=require(_0xf278('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf278('0x10'));var as=require(_0xf278('0x11'));var hardwareService=require(_0xf278('0x12'));var logger=require('../../config/logger')(_0xf278('0x13'));var utils=require(_0xf278('0x14'));var config=require(_0xf278('0x15'));var licenseUtil=require(_0xf278('0x16'));var db=require(_0xf278('0x17'))['db'];function respondWithStatusCode(_0x523aea,_0x2c9a94){_0x2c9a94=_0x2c9a94||0xcc;return function(_0x249201){if(_0x249201){return _0x523aea[_0xf278('0x18')](_0x2c9a94);}return _0x523aea[_0xf278('0x19')](_0x2c9a94)['end']();};}function respondWithResult(_0x3ca62c,_0x240a0f){_0x240a0f=_0x240a0f||0xc8;return function(_0x4a0e06){if(_0x4a0e06){return _0x3ca62c[_0xf278('0x19')](_0x240a0f)['json'](_0x4a0e06);}};}function respondWithFilteredResult(_0x30d28b,_0x2aab50){return function(_0x461e29){if(_0x461e29){var _0x5cf08a=typeof _0x2aab50[_0xf278('0x1a')]===_0xf278('0x1b')&&typeof _0x2aab50[_0xf278('0x1c')]===_0xf278('0x1b');var _0x2a5cc9=_0x461e29[_0xf278('0x1d')];var _0x28ba4e=_0x5cf08a?0x0:_0x2aab50[_0xf278('0x1a')];var _0x1c99d9=_0x5cf08a?_0x461e29[_0xf278('0x1d')]:_0x2aab50[_0xf278('0x1a')]+_0x2aab50[_0xf278('0x1c')];var _0x2def4d;if(_0x1c99d9>=_0x2a5cc9){_0x1c99d9=_0x2a5cc9;_0x2def4d=0xc8;}else{_0x2def4d=0xce;}_0x30d28b[_0xf278('0x19')](_0x2def4d);return _0x30d28b[_0xf278('0x1e')](_0xf278('0x1f'),_0x28ba4e+'-'+_0x1c99d9+'/'+_0x2a5cc9)[_0xf278('0x20')](_0x461e29);}return null;};}function patchUpdates(_0x4f1db1){return function(_0x3fe2a1){try{jsonpatch[_0xf278('0x21')](_0x3fe2a1,_0x4f1db1,!![]);}catch(_0x536556){return BPromise[_0xf278('0x22')](_0x536556);}return _0x3fe2a1[_0xf278('0x23')]();};}function saveUpdates(_0x480769,_0x327670){return function(_0x59890a){if(_0x59890a){return _0x59890a[_0xf278('0x24')](_0x480769)[_0xf278('0x25')](function(_0xdf8d39){return _0xdf8d39;});}return null;};}function removeEntity(_0x2fcdf2,_0x5b5536){return function(_0x5af26e){if(_0x5af26e){return _0x5af26e[_0xf278('0x26')]()['then'](function(){_0x2fcdf2['status'](0xcc)[_0xf278('0x27')]();});}};}function handleEntityNotFound(_0x3ecc58,_0x4c0fba){return function(_0x41d2ef){if(!_0x41d2ef){_0x3ecc58[_0xf278('0x18')](0x194);}return _0x41d2ef;};}function handleError(_0x5f4236,_0x323c09){_0x323c09=_0x323c09||0x1f4;return function(_0x15bc01){logger[_0xf278('0x28')](_0x15bc01['stack']);if(_0x15bc01['name']){delete _0x15bc01[_0xf278('0x29')];}_0x5f4236[_0xf278('0x19')](_0x323c09)[_0xf278('0x2a')](_0x15bc01);};}exports['index']=function(_0x5eacd8,_0x286e8a){var _0x330b36={},_0x1628ef={},_0x18e34d={'count':0x0,'rows':[]};var _0x53c914=_[_0xf278('0x2b')](db[_0xf278('0x2c')][_0xf278('0x2d')],function(_0x23685d){return{'name':_0x23685d[_0xf278('0x2e')],'type':_0x23685d[_0xf278('0x2f')][_0xf278('0x30')]};});_0x1628ef[_0xf278('0x31')]=_[_0xf278('0x2b')](_0x53c914,_0xf278('0x29'));_0x1628ef[_0xf278('0x32')]=_['keys'](_0x5eacd8[_0xf278('0x32')]);_0x1628ef[_0xf278('0x33')]=_[_0xf278('0x34')](_0x1628ef[_0xf278('0x31')],_0x1628ef[_0xf278('0x32')]);_0x330b36[_0xf278('0x35')]=_[_0xf278('0x34')](_0x1628ef[_0xf278('0x31')],qs[_0xf278('0x36')](_0x5eacd8[_0xf278('0x32')][_0xf278('0x36')]));_0x330b36['attributes']=_0x330b36[_0xf278('0x35')][_0xf278('0x37')]?_0x330b36['attributes']:_0x1628ef['model'];if(!_0x5eacd8[_0xf278('0x32')][_0xf278('0x38')]('nolimit')){_0x330b36[_0xf278('0x1c')]=qs[_0xf278('0x1c')](_0x5eacd8[_0xf278('0x32')][_0xf278('0x1c')]);_0x330b36[_0xf278('0x1a')]=qs[_0xf278('0x1a')](_0x5eacd8[_0xf278('0x32')][_0xf278('0x1a')]);}_0x330b36['order']=qs[_0xf278('0x39')](_0x5eacd8[_0xf278('0x32')][_0xf278('0x39')]);_0x330b36[_0xf278('0x3a')]=qs[_0xf278('0x33')](_['pick'](_0x5eacd8[_0xf278('0x32')],_0x1628ef[_0xf278('0x33')]),_0x53c914);if(_0x5eacd8[_0xf278('0x32')][_0xf278('0x3b')]){_0x330b36[_0xf278('0x3a')]=_[_0xf278('0x3c')](_0x330b36[_0xf278('0x3a')],{'$or':_['map'](_0x53c914,function(_0x177f5c){if(_0x177f5c[_0xf278('0x2f')]!==_0xf278('0x3d')){var _0x572d51={};_0x572d51[_0x177f5c[_0xf278('0x29')]]={'$like':'%'+_0x5eacd8[_0xf278('0x32')][_0xf278('0x3b')]+'%'};return _0x572d51;}})});}_0x330b36=_[_0xf278('0x3c')]({},_0x330b36,_0x5eacd8[_0xf278('0x3e')]);var _0x28d068={'where':_0x330b36[_0xf278('0x3a')]};return db[_0xf278('0x2c')][_0xf278('0x1d')](_0x28d068)[_0xf278('0x25')](function(_0x4d4215){_0x18e34d[_0xf278('0x1d')]=_0x4d4215;if(_0x5eacd8[_0xf278('0x32')]['includeAll']){_0x330b36[_0xf278('0x3f')]=[{'all':!![]}];}return db[_0xf278('0x2c')]['findAll'](_0x330b36);})['then'](function(_0x407c5e){_0x18e34d[_0xf278('0x40')]=_0x407c5e;return _0x18e34d;})[_0xf278('0x25')](respondWithFilteredResult(_0x286e8a,_0x330b36))[_0xf278('0x41')](handleError(_0x286e8a,null));};exports[_0xf278('0x42')]=function(_0x1b7ba6,_0x4b9e83){var _0x4a8228={'raw':!![],'where':{'id':_0x1b7ba6[_0xf278('0x43')]['id']}},_0x1b48f7={};_0x1b48f7[_0xf278('0x31')]=_[_0xf278('0x44')](db[_0xf278('0x2c')][_0xf278('0x2d')]);_0x1b48f7[_0xf278('0x32')]=_[_0xf278('0x44')](_0x1b7ba6[_0xf278('0x32')]);_0x1b48f7[_0xf278('0x33')]=_[_0xf278('0x34')](_0x1b48f7[_0xf278('0x31')],_0x1b48f7[_0xf278('0x32')]);_0x4a8228[_0xf278('0x35')]=_[_0xf278('0x34')](_0x1b48f7['model'],qs[_0xf278('0x36')](_0x1b7ba6[_0xf278('0x32')][_0xf278('0x36')]));_0x4a8228[_0xf278('0x35')]=_0x4a8228['attributes']['length']?_0x4a8228[_0xf278('0x35')]:_0x1b48f7[_0xf278('0x31')];if(_0x1b7ba6[_0xf278('0x32')][_0xf278('0x45')]){_0x4a8228[_0xf278('0x3f')]=[{'all':!![]}];}_0x4a8228=_[_0xf278('0x3c')]({},_0x4a8228,_0x1b7ba6[_0xf278('0x3e')]);return db[_0xf278('0x2c')]['find'](_0x4a8228)[_0xf278('0x25')](handleEntityNotFound(_0x4b9e83,null))[_0xf278('0x25')](respondWithResult(_0x4b9e83,null))[_0xf278('0x41')](handleError(_0x4b9e83,null));};exports['create']=function(_0x1252f7,_0x7e1fa6){return db[_0xf278('0x2c')]['create'](_0x1252f7['body'],{})[_0xf278('0x25')](respondWithResult(_0x7e1fa6,0xc9))['catch'](handleError(_0x7e1fa6,null));};exports[_0xf278('0x24')]=function(_0x5129f4,_0x20036f){if(_0x5129f4[_0xf278('0x46')]['id']){delete _0x5129f4['body']['id'];}return db[_0xf278('0x2c')]['find']({'where':{'id':_0x5129f4['params']['id']}})[_0xf278('0x25')](handleEntityNotFound(_0x20036f,null))[_0xf278('0x25')](saveUpdates(_0x5129f4[_0xf278('0x46')],null))['then'](respondWithResult(_0x20036f,null))[_0xf278('0x41')](handleError(_0x20036f,null));};exports[_0xf278('0x26')]=function(_0x533b14,_0x150f39){return db[_0xf278('0x2c')][_0xf278('0x47')]({'where':{'id':_0x533b14['params']['id']}})[_0xf278('0x25')](handleEntityNotFound(_0x150f39,null))[_0xf278('0x25')](removeEntity(_0x150f39,null))[_0xf278('0x41')](handleError(_0x150f39,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1828150..0986dc9 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 _0xe14f=['moment','request-promise','rimraf','exports','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xe14f,0x11e));var _0xfe14=function(_0x536039,_0x1c568e){_0x536039=_0x536039-0x0;var _0x24919a=_0xe14f[_0x536039];return _0x24919a;};'use strict';var _=require(_0xfe14('0x0'));var util=require(_0xfe14('0x1'));var logger=require(_0xfe14('0x2'))(_0xfe14('0x3'));var moment=require(_0xfe14('0x4'));var BPromise=require('bluebird');var rp=require(_0xfe14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe14('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0xfe14('0x7')]=function(_0x47f9db,_0x12660b){return _0x47f9db['define'](_0xfe14('0x8'),attributes,{'tableName':_0xfe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd96=['define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x257841,_0x389b4d){var _0x1b87ed=function(_0xceb19e){while(--_0xceb19e){_0x257841['push'](_0x257841['shift']());}};_0x1b87ed(++_0x389b4d);}(_0xfd96,0xab));var _0x6fd9=function(_0x21d163,_0x24e41a){_0x21d163=_0x21d163-0x0;var _0x2ba445=_0xfd96[_0x21d163];return _0x2ba445;};'use strict';var _=require(_0x6fd9('0x0'));var util=require(_0x6fd9('0x1'));var logger=require(_0x6fd9('0x2'))(_0x6fd9('0x3'));var moment=require(_0x6fd9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fd9('0x5'));var rimraf=require(_0x6fd9('0x6'));var config=require(_0x6fd9('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x6fd9('0x8')]=function(_0x5cf03e,_0x66dbde){return _0x5cf03e[_0x6fd9('0x9')](_0x6fd9('0xa'),attributes,{'tableName':_0x6fd9('0xb'),'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 cbc4b3a..afd15bc 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x359fae,_0x1635d5){_0x359fae=_0x359fae-0x0;var _0x22226a=_0x7a54[_0x359fae];return _0x22226a;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x1e4c16,_0x4bf959){var _0xd55b1a=function(_0x40ce01){while(--_0x40ce01){_0x1e4c16['push'](_0x1e4c16['shift']());}};_0xd55b1a(++_0x4bf959);}(_0x5f2f,0x73));var _0xf5f2=function(_0x42a293,_0x525f28){_0x42a293=_0x42a293-0x0;var _0x5a57f1=_0x5f2f[_0x42a293];return _0x5a57f1;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index cc27555..ba88714 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 _0x6a7d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x59c6db,_0x1e07c7){var _0x31e3b4=function(_0x3e3db5){while(--_0x3e3db5){_0x59c6db['push'](_0x59c6db['shift']());}};_0x31e3b4(++_0x1e07c7);}(_0x6a7d,0xa5));var _0xd6a7=function(_0x14a84e,_0xffb06){_0x14a84e=_0x14a84e-0x0;var _0x2aca47=_0x6a7d[_0x14a84e];return _0x2aca47;};'use strict';var multer=require(_0xd6a7('0x0'));var util=require(_0xd6a7('0x1'));var path=require('path');var timeout=require(_0xd6a7('0x2'));var express=require(_0xd6a7('0x3'));var router=express['Router']();var fs_extra=require(_0xd6a7('0x4'));var auth=require(_0xd6a7('0x5'));var interaction=require(_0xd6a7('0x6'));var config=require(_0xd6a7('0x7'));var controller=require(_0xd6a7('0x8'));router[_0xd6a7('0x9')]('/',auth[_0xd6a7('0xa')](),controller[_0xd6a7('0xb')]);router[_0xd6a7('0x9')](_0xd6a7('0xc'),auth[_0xd6a7('0xa')](),controller[_0xd6a7('0xd')]);router['get'](_0xd6a7('0xe'),auth[_0xd6a7('0xa')](),controller['show']);router[_0xd6a7('0xf')]('/',auth[_0xd6a7('0xa')](),controller['create']);router[_0xd6a7('0x10')](_0xd6a7('0xe'),auth[_0xd6a7('0xa')](),controller[_0xd6a7('0x11')]);router[_0xd6a7('0x12')]('/:id',auth[_0xd6a7('0xa')](),controller[_0xd6a7('0x13')]);module[_0xd6a7('0x14')]=router; \ No newline at end of file +var _0x6a94=['../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x106526,_0x39d8fe){var _0x16420d=function(_0x183f18){while(--_0x183f18){_0x106526['push'](_0x106526['shift']());}};_0x16420d(++_0x39d8fe);}(_0x6a94,0xfd));var _0x46a9=function(_0x3ad99c,_0x5957a5){_0x3ad99c=_0x3ad99c-0x0;var _0x4d3914=_0x6a94[_0x3ad99c];return _0x4d3914;};'use strict';var multer=require(_0x46a9('0x0'));var util=require(_0x46a9('0x1'));var path=require(_0x46a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x46a9('0x3'));var router=express[_0x46a9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46a9('0x5'));var interaction=require(_0x46a9('0x6'));var config=require(_0x46a9('0x7'));var controller=require(_0x46a9('0x8'));router[_0x46a9('0x9')]('/',auth[_0x46a9('0xa')](),controller[_0x46a9('0xb')]);router[_0x46a9('0x9')](_0x46a9('0xc'),auth[_0x46a9('0xa')](),controller[_0x46a9('0xd')]);router[_0x46a9('0x9')](_0x46a9('0xe'),auth[_0x46a9('0xa')](),controller['show']);router[_0x46a9('0xf')]('/',auth[_0x46a9('0xa')](),controller[_0x46a9('0x10')]);router[_0x46a9('0x11')](_0x46a9('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x46a9('0x12')](_0x46a9('0xe'),auth[_0x46a9('0xa')](),controller[_0x46a9('0x13')]);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 2c4f08a..fdd45f4 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 _0xbacd=['STRING','sequelize','exports','name'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xbacd,0x1c5));var _0xdbac=function(_0x100706,_0xb54890){_0x100706=_0x100706-0x0;var _0x33469f=_0xbacd[_0x100706];return _0x33469f;};'use strict';var Sequelize=require(_0xdbac('0x0'));module[_0xdbac('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdbac('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdbac('0x3')]}}; \ No newline at end of file +var _0xc492=['exports','STRING','sequelize'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc492,0xd7));var _0x2c49=function(_0x46e7ee,_0xdd88bb){_0x46e7ee=_0x46e7ee-0x0;var _0x1ae6f2=_0xc492[_0x46e7ee];return _0x1ae6f2;};'use strict';var Sequelize=require(_0x2c49('0x0'));module[_0x2c49('0x1')]={'name':{'type':Sequelize[_0x2c49('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 272c505..431d491 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 _0x5264=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','include','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','name','send','rawAttributes','fieldName','type'];(function(_0x3b7766,_0x2ad415){var _0x2aa947=function(_0x2e3558){while(--_0x2e3558){_0x3b7766['push'](_0x3b7766['shift']());}};_0x2aa947(++_0x2ad415);}(_0x5264,0x146));var _0x4526=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5264[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x4526('0x0'));var rimraf=require(_0x4526('0x1'));var zipdir=require(_0x4526('0x2'));var jsonpatch=require(_0x4526('0x3'));var rp=require(_0x4526('0x4'));var moment=require(_0x4526('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4526('0x6'));var util=require('util');var path=require(_0x4526('0x7'));var sox=require(_0x4526('0x8'));var csv=require(_0x4526('0x9'));var ejs=require(_0x4526('0xa'));var fs=require('fs');var fs_extra=require(_0x4526('0xb'));var _=require(_0x4526('0xc'));var squel=require('squel');var crypto=require(_0x4526('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4526('0xe'));var toCsv=require(_0x4526('0x9'));var querystring=require(_0x4526('0xf'));var Papa=require(_0x4526('0x10'));var Redis=require('ioredis');var authService=require(_0x4526('0x11'));var qs=require(_0x4526('0x12'));var as=require(_0x4526('0x13'));var hardwareService=require(_0x4526('0x14'));var logger=require(_0x4526('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4526('0x16'));var licenseUtil=require(_0x4526('0x17'));var db=require(_0x4526('0x18'))['db'];function respondWithStatusCode(_0x4330c9,_0x65ecba){_0x65ecba=_0x65ecba||0xcc;return function(_0x4de11f){if(_0x4de11f){return _0x4330c9['sendStatus'](_0x65ecba);}return _0x4330c9[_0x4526('0x19')](_0x65ecba)['end']();};}function respondWithResult(_0x1c6f36,_0x5a48f7){_0x5a48f7=_0x5a48f7||0xc8;return function(_0x149401){if(_0x149401){return _0x1c6f36[_0x4526('0x19')](_0x5a48f7)[_0x4526('0x1a')](_0x149401);}};}function respondWithFilteredResult(_0x19143b,_0x2f2596){return function(_0x4730fb){if(_0x4730fb){var _0x4f21db=typeof _0x2f2596['offset']===_0x4526('0x1b')&&typeof _0x2f2596[_0x4526('0x1c')]===_0x4526('0x1b');var _0x5092a3=_0x4730fb[_0x4526('0x1d')];var _0xfc3715=_0x4f21db?0x0:_0x2f2596[_0x4526('0x1e')];var _0x4a9dcc=_0x4f21db?_0x4730fb[_0x4526('0x1d')]:_0x2f2596['offset']+_0x2f2596[_0x4526('0x1c')];var _0xf78349;if(_0x4a9dcc>=_0x5092a3){_0x4a9dcc=_0x5092a3;_0xf78349=0xc8;}else{_0xf78349=0xce;}_0x19143b[_0x4526('0x19')](_0xf78349);return _0x19143b[_0x4526('0x1f')](_0x4526('0x20'),_0xfc3715+'-'+_0x4a9dcc+'/'+_0x5092a3)['json'](_0x4730fb);}return null;};}function patchUpdates(_0x25531c){return function(_0x25ff98){try{jsonpatch['apply'](_0x25ff98,_0x25531c,!![]);}catch(_0x22008d){return BPromise[_0x4526('0x21')](_0x22008d);}return _0x25ff98[_0x4526('0x22')]();};}function saveUpdates(_0x1ab453,_0x53d2a8){return function(_0x1d12d2){if(_0x1d12d2){return _0x1d12d2[_0x4526('0x23')](_0x1ab453)[_0x4526('0x24')](function(_0x47fc88){return _0x47fc88;});}return null;};}function removeEntity(_0x51f749,_0x17033c){return function(_0x2b4cb1){if(_0x2b4cb1){return _0x2b4cb1[_0x4526('0x25')]()[_0x4526('0x24')](function(){_0x51f749['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d1f2,_0xdc550b){return function(_0x39cb6a){if(!_0x39cb6a){_0x29d1f2[_0x4526('0x26')](0x194);}return _0x39cb6a;};}function handleError(_0x82b810,_0x53a2c6){_0x53a2c6=_0x53a2c6||0x1f4;return function(_0x346f60){logger['error'](_0x346f60['stack']);if(_0x346f60[_0x4526('0x27')]){delete _0x346f60['name'];}_0x82b810[_0x4526('0x19')](_0x53a2c6)[_0x4526('0x28')](_0x346f60);};}exports['index']=function(_0x560d89,_0x107302){var _0x31d565={},_0x1d3147={},_0x16caee={'count':0x0,'rows':[]};var _0x426e4a=_['map'](db['MailSubstatus'][_0x4526('0x29')],function(_0x592cf6){return{'name':_0x592cf6[_0x4526('0x2a')],'type':_0x592cf6[_0x4526('0x2b')][_0x4526('0x2c')]};});_0x1d3147[_0x4526('0x2d')]=_[_0x4526('0x2e')](_0x426e4a,_0x4526('0x27'));_0x1d3147[_0x4526('0x2f')]=_[_0x4526('0x30')](_0x560d89['query']);_0x1d3147[_0x4526('0x31')]=_[_0x4526('0x32')](_0x1d3147[_0x4526('0x2d')],_0x1d3147['query']);_0x31d565[_0x4526('0x33')]=_[_0x4526('0x32')](_0x1d3147[_0x4526('0x2d')],qs['fields'](_0x560d89[_0x4526('0x2f')][_0x4526('0x34')]));_0x31d565['attributes']=_0x31d565[_0x4526('0x33')][_0x4526('0x35')]?_0x31d565[_0x4526('0x33')]:_0x1d3147[_0x4526('0x2d')];if(!_0x560d89[_0x4526('0x2f')][_0x4526('0x36')](_0x4526('0x37'))){_0x31d565[_0x4526('0x1c')]=qs[_0x4526('0x1c')](_0x560d89['query']['limit']);_0x31d565[_0x4526('0x1e')]=qs[_0x4526('0x1e')](_0x560d89[_0x4526('0x2f')][_0x4526('0x1e')]);}_0x31d565['order']=qs['sort'](_0x560d89['query'][_0x4526('0x38')]);_0x31d565[_0x4526('0x39')]=qs[_0x4526('0x31')](_[_0x4526('0x3a')](_0x560d89[_0x4526('0x2f')],_0x1d3147[_0x4526('0x31')]),_0x426e4a);if(_0x560d89[_0x4526('0x2f')][_0x4526('0x3b')]){_0x31d565[_0x4526('0x39')]=_[_0x4526('0x3c')](_0x31d565['where'],{'$or':_[_0x4526('0x2e')](_0x426e4a,function(_0x2d5b6d){if(_0x2d5b6d[_0x4526('0x2b')]!==_0x4526('0x3d')){var _0xf351a0={};_0xf351a0[_0x2d5b6d['name']]={'$like':'%'+_0x560d89[_0x4526('0x2f')][_0x4526('0x3b')]+'%'};return _0xf351a0;}})});}_0x31d565=_[_0x4526('0x3c')]({},_0x31d565,_0x560d89[_0x4526('0x3e')]);var _0x4b7ba6={'where':_0x31d565[_0x4526('0x39')]};return db[_0x4526('0x3f')][_0x4526('0x1d')](_0x4b7ba6)['then'](function(_0x640bc7){_0x16caee[_0x4526('0x1d')]=_0x640bc7;if(_0x560d89[_0x4526('0x2f')][_0x4526('0x40')]){_0x31d565[_0x4526('0x41')]=[{'all':!![]}];}return db[_0x4526('0x3f')]['findAll'](_0x31d565);})[_0x4526('0x24')](function(_0xd826a1){_0x16caee[_0x4526('0x42')]=_0xd826a1;return _0x16caee;})['then'](respondWithFilteredResult(_0x107302,_0x31d565))['catch'](handleError(_0x107302,null));};exports[_0x4526('0x43')]=function(_0x4a4c78,_0x35d14b){var _0x296020={'raw':!![],'where':{'id':_0x4a4c78[_0x4526('0x44')]['id']}},_0x3b4858={};_0x3b4858['model']=_[_0x4526('0x30')](db['MailSubstatus'][_0x4526('0x29')]);_0x3b4858['query']=_[_0x4526('0x30')](_0x4a4c78['query']);_0x3b4858[_0x4526('0x31')]=_['intersection'](_0x3b4858[_0x4526('0x2d')],_0x3b4858[_0x4526('0x2f')]);_0x296020[_0x4526('0x33')]=_[_0x4526('0x32')](_0x3b4858['model'],qs[_0x4526('0x34')](_0x4a4c78[_0x4526('0x2f')][_0x4526('0x34')]));_0x296020[_0x4526('0x33')]=_0x296020[_0x4526('0x33')][_0x4526('0x35')]?_0x296020[_0x4526('0x33')]:_0x3b4858[_0x4526('0x2d')];if(_0x4a4c78['query'][_0x4526('0x40')]){_0x296020[_0x4526('0x41')]=[{'all':!![]}];}_0x296020=_[_0x4526('0x3c')]({},_0x296020,_0x4a4c78[_0x4526('0x3e')]);return db[_0x4526('0x3f')]['find'](_0x296020)[_0x4526('0x24')](handleEntityNotFound(_0x35d14b,null))[_0x4526('0x24')](respondWithResult(_0x35d14b,null))[_0x4526('0x45')](handleError(_0x35d14b,null));};exports[_0x4526('0x46')]=function(_0x775bc5,_0x7ba9ee){return db['MailSubstatus'][_0x4526('0x46')](_0x775bc5[_0x4526('0x47')],{})[_0x4526('0x24')](respondWithResult(_0x7ba9ee,0xc9))[_0x4526('0x45')](handleError(_0x7ba9ee,null));};exports['update']=function(_0x12acee,_0x20f972){if(_0x12acee[_0x4526('0x47')]['id']){delete _0x12acee[_0x4526('0x47')]['id'];}return db[_0x4526('0x3f')]['find']({'where':{'id':_0x12acee[_0x4526('0x44')]['id']}})[_0x4526('0x24')](handleEntityNotFound(_0x20f972,null))['then'](saveUpdates(_0x12acee[_0x4526('0x47')],null))[_0x4526('0x24')](respondWithResult(_0x20f972,null))[_0x4526('0x45')](handleError(_0x20f972,null));};exports[_0x4526('0x25')]=function(_0x39ae12,_0x15d581){return db['MailSubstatus'][_0x4526('0x48')]({'where':{'id':_0x39ae12[_0x4526('0x44')]['id']}})[_0x4526('0x24')](handleEntityNotFound(_0x15d581,null))[_0x4526('0x24')](removeEntity(_0x15d581,null))['catch'](handleError(_0x15d581,null));};exports[_0x4526('0x49')]=function(_0x21e697,_0x46538d){return db[_0x4526('0x3f')][_0x4526('0x49')]()[_0x4526('0x24')](respondWithResult(_0x46538d,null))[_0x4526('0x45')](handleError(_0x46538d,null));}; \ No newline at end of file +var _0xd2e0=['query','keys','filters','intersection','attributes','fields','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','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/environment','../../config/license/util','status','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','model'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xd2e0,0x1f4));var _0x0d2e=function(_0x1c5b75,_0x11791c){_0x1c5b75=_0x1c5b75-0x0;var _0x3fce38=_0xd2e0[_0x1c5b75];return _0x3fce38;};'use strict';var emlformat=require(_0x0d2e('0x0'));var rimraf=require(_0x0d2e('0x1'));var zipdir=require(_0x0d2e('0x2'));var jsonpatch=require(_0x0d2e('0x3'));var rp=require(_0x0d2e('0x4'));var moment=require(_0x0d2e('0x5'));var BPromise=require(_0x0d2e('0x6'));var Mustache=require('mustache');var util=require(_0x0d2e('0x7'));var path=require(_0x0d2e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d2e('0x9'));var fs=require('fs');var fs_extra=require(_0x0d2e('0xa'));var _=require(_0x0d2e('0xb'));var squel=require(_0x0d2e('0xc'));var crypto=require(_0x0d2e('0xd'));var jsforce=require(_0x0d2e('0xe'));var deskjs=require(_0x0d2e('0xf'));var toCsv=require(_0x0d2e('0x10'));var querystring=require(_0x0d2e('0x11'));var Papa=require(_0x0d2e('0x12'));var Redis=require(_0x0d2e('0x13'));var authService=require(_0x0d2e('0x14'));var qs=require(_0x0d2e('0x15'));var as=require(_0x0d2e('0x16'));var hardwareService=require(_0x0d2e('0x17'));var logger=require(_0x0d2e('0x18'))(_0x0d2e('0x19'));var utils=require('../../config/utils');var config=require(_0x0d2e('0x1a'));var licenseUtil=require(_0x0d2e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x359598,_0x3d42aa){_0x3d42aa=_0x3d42aa||0xcc;return function(_0x53d005){if(_0x53d005){return _0x359598['sendStatus'](_0x3d42aa);}return _0x359598[_0x0d2e('0x1c')](_0x3d42aa)['end']();};}function respondWithResult(_0x4346b9,_0x3bd638){_0x3bd638=_0x3bd638||0xc8;return function(_0xd3e091){if(_0xd3e091){return _0x4346b9[_0x0d2e('0x1c')](_0x3bd638)['json'](_0xd3e091);}};}function respondWithFilteredResult(_0x34044f,_0x289158){return function(_0xf27e4f){if(_0xf27e4f){var _0x434683=typeof _0x289158['offset']==='undefined'&&typeof _0x289158[_0x0d2e('0x1d')]===_0x0d2e('0x1e');var _0x5d18f4=_0xf27e4f['count'];var _0x38c968=_0x434683?0x0:_0x289158[_0x0d2e('0x1f')];var _0x36d58b=_0x434683?_0xf27e4f[_0x0d2e('0x20')]:_0x289158['offset']+_0x289158[_0x0d2e('0x1d')];var _0x5508b2;if(_0x36d58b>=_0x5d18f4){_0x36d58b=_0x5d18f4;_0x5508b2=0xc8;}else{_0x5508b2=0xce;}_0x34044f['status'](_0x5508b2);return _0x34044f[_0x0d2e('0x21')]('Content-Range',_0x38c968+'-'+_0x36d58b+'/'+_0x5d18f4)[_0x0d2e('0x22')](_0xf27e4f);}return null;};}function patchUpdates(_0x18011e){return function(_0x5f12b0){try{jsonpatch['apply'](_0x5f12b0,_0x18011e,!![]);}catch(_0x11e62d){return BPromise[_0x0d2e('0x23')](_0x11e62d);}return _0x5f12b0[_0x0d2e('0x24')]();};}function saveUpdates(_0x5208b,_0x357b49){return function(_0x5ef8dd){if(_0x5ef8dd){return _0x5ef8dd[_0x0d2e('0x25')](_0x5208b)[_0x0d2e('0x26')](function(_0x4dadab){return _0x4dadab;});}return null;};}function removeEntity(_0x1ccbb9,_0x480383){return function(_0x5e7dbf){if(_0x5e7dbf){return _0x5e7dbf[_0x0d2e('0x27')]()['then'](function(){_0x1ccbb9['status'](0xcc)[_0x0d2e('0x28')]();});}};}function handleEntityNotFound(_0x2024e2,_0x53e1ab){return function(_0xca9e8f){if(!_0xca9e8f){_0x2024e2[_0x0d2e('0x29')](0x194);}return _0xca9e8f;};}function handleError(_0x418757,_0x17b965){_0x17b965=_0x17b965||0x1f4;return function(_0x8423ed){logger[_0x0d2e('0x2a')](_0x8423ed[_0x0d2e('0x2b')]);if(_0x8423ed[_0x0d2e('0x2c')]){delete _0x8423ed[_0x0d2e('0x2c')];}_0x418757['status'](_0x17b965)[_0x0d2e('0x2d')](_0x8423ed);};}exports[_0x0d2e('0x2e')]=function(_0x2bd9d4,_0x58ad45){var _0x5c7010={},_0x3f0c80={},_0x13ff57={'count':0x0,'rows':[]};var _0x261d44=_[_0x0d2e('0x2f')](db[_0x0d2e('0x30')][_0x0d2e('0x31')],function(_0x5e3e5f){return{'name':_0x5e3e5f['fieldName'],'type':_0x5e3e5f[_0x0d2e('0x32')][_0x0d2e('0x33')]};});_0x3f0c80[_0x0d2e('0x34')]=_[_0x0d2e('0x2f')](_0x261d44,'name');_0x3f0c80[_0x0d2e('0x35')]=_[_0x0d2e('0x36')](_0x2bd9d4[_0x0d2e('0x35')]);_0x3f0c80[_0x0d2e('0x37')]=_[_0x0d2e('0x38')](_0x3f0c80[_0x0d2e('0x34')],_0x3f0c80[_0x0d2e('0x35')]);_0x5c7010[_0x0d2e('0x39')]=_[_0x0d2e('0x38')](_0x3f0c80[_0x0d2e('0x34')],qs['fields'](_0x2bd9d4[_0x0d2e('0x35')][_0x0d2e('0x3a')]));_0x5c7010['attributes']=_0x5c7010['attributes']['length']?_0x5c7010[_0x0d2e('0x39')]:_0x3f0c80['model'];if(!_0x2bd9d4[_0x0d2e('0x35')]['hasOwnProperty']('nolimit')){_0x5c7010[_0x0d2e('0x1d')]=qs[_0x0d2e('0x1d')](_0x2bd9d4['query'][_0x0d2e('0x1d')]);_0x5c7010[_0x0d2e('0x1f')]=qs[_0x0d2e('0x1f')](_0x2bd9d4[_0x0d2e('0x35')]['offset']);}_0x5c7010[_0x0d2e('0x3b')]=qs['sort'](_0x2bd9d4[_0x0d2e('0x35')][_0x0d2e('0x3c')]);_0x5c7010['where']=qs['filters'](_[_0x0d2e('0x3d')](_0x2bd9d4['query'],_0x3f0c80[_0x0d2e('0x37')]),_0x261d44);if(_0x2bd9d4[_0x0d2e('0x35')]['filter']){_0x5c7010[_0x0d2e('0x3e')]=_[_0x0d2e('0x3f')](_0x5c7010['where'],{'$or':_['map'](_0x261d44,function(_0x441a93){if(_0x441a93['type']!==_0x0d2e('0x40')){var _0x198093={};_0x198093[_0x441a93['name']]={'$like':'%'+_0x2bd9d4[_0x0d2e('0x35')][_0x0d2e('0x41')]+'%'};return _0x198093;}})});}_0x5c7010=_[_0x0d2e('0x3f')]({},_0x5c7010,_0x2bd9d4[_0x0d2e('0x42')]);var _0x25d064={'where':_0x5c7010[_0x0d2e('0x3e')]};return db['MailSubstatus'][_0x0d2e('0x20')](_0x25d064)[_0x0d2e('0x26')](function(_0x17a9dd){_0x13ff57['count']=_0x17a9dd;if(_0x2bd9d4[_0x0d2e('0x35')][_0x0d2e('0x43')]){_0x5c7010[_0x0d2e('0x44')]=[{'all':!![]}];}return db[_0x0d2e('0x30')][_0x0d2e('0x45')](_0x5c7010);})[_0x0d2e('0x26')](function(_0x724885){_0x13ff57[_0x0d2e('0x46')]=_0x724885;return _0x13ff57;})[_0x0d2e('0x26')](respondWithFilteredResult(_0x58ad45,_0x5c7010))[_0x0d2e('0x47')](handleError(_0x58ad45,null));};exports[_0x0d2e('0x48')]=function(_0x3d5305,_0x6d843f){var _0x281283={'raw':!![],'where':{'id':_0x3d5305[_0x0d2e('0x49')]['id']}},_0x2385a9={};_0x2385a9[_0x0d2e('0x34')]=_[_0x0d2e('0x36')](db[_0x0d2e('0x30')][_0x0d2e('0x31')]);_0x2385a9[_0x0d2e('0x35')]=_[_0x0d2e('0x36')](_0x3d5305[_0x0d2e('0x35')]);_0x2385a9[_0x0d2e('0x37')]=_['intersection'](_0x2385a9[_0x0d2e('0x34')],_0x2385a9['query']);_0x281283[_0x0d2e('0x39')]=_[_0x0d2e('0x38')](_0x2385a9[_0x0d2e('0x34')],qs[_0x0d2e('0x3a')](_0x3d5305[_0x0d2e('0x35')][_0x0d2e('0x3a')]));_0x281283['attributes']=_0x281283[_0x0d2e('0x39')][_0x0d2e('0x4a')]?_0x281283[_0x0d2e('0x39')]:_0x2385a9['model'];if(_0x3d5305[_0x0d2e('0x35')][_0x0d2e('0x43')]){_0x281283[_0x0d2e('0x44')]=[{'all':!![]}];}_0x281283=_[_0x0d2e('0x3f')]({},_0x281283,_0x3d5305['options']);return db[_0x0d2e('0x30')][_0x0d2e('0x4b')](_0x281283)[_0x0d2e('0x26')](handleEntityNotFound(_0x6d843f,null))[_0x0d2e('0x26')](respondWithResult(_0x6d843f,null))[_0x0d2e('0x47')](handleError(_0x6d843f,null));};exports[_0x0d2e('0x4c')]=function(_0x51270b,_0x16c3c8){return db['MailSubstatus'][_0x0d2e('0x4c')](_0x51270b[_0x0d2e('0x4d')],{})['then'](respondWithResult(_0x16c3c8,0xc9))['catch'](handleError(_0x16c3c8,null));};exports[_0x0d2e('0x25')]=function(_0x2f3feb,_0xca1977){if(_0x2f3feb[_0x0d2e('0x4d')]['id']){delete _0x2f3feb[_0x0d2e('0x4d')]['id'];}return db['MailSubstatus'][_0x0d2e('0x4b')]({'where':{'id':_0x2f3feb['params']['id']}})[_0x0d2e('0x26')](handleEntityNotFound(_0xca1977,null))['then'](saveUpdates(_0x2f3feb[_0x0d2e('0x4d')],null))[_0x0d2e('0x26')](respondWithResult(_0xca1977,null))[_0x0d2e('0x47')](handleError(_0xca1977,null));};exports['destroy']=function(_0x2620a3,_0x4d4718){return db[_0x0d2e('0x30')]['find']({'where':{'id':_0x2620a3[_0x0d2e('0x49')]['id']}})[_0x0d2e('0x26')](handleEntityNotFound(_0x4d4718,null))[_0x0d2e('0x26')](removeEntity(_0x4d4718,null))['catch'](handleError(_0x4d4718,null));};exports[_0x0d2e('0x4e')]=function(_0x109e0f,_0x4ac6c6){return db[_0x0d2e('0x30')]['describe']()['then'](respondWithResult(_0x4ac6c6,null))[_0x0d2e('0x47')](handleError(_0x4ac6c6,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index e7acc8e..3ca62d5 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 _0x3da9=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x33c260,_0x118d6b){var _0x360c35=function(_0x3eebc3){while(--_0x3eebc3){_0x33c260['push'](_0x33c260['shift']());}};_0x360c35(++_0x118d6b);}(_0x3da9,0x7a));var _0x93da=function(_0x430ba8,_0x49e36b){_0x430ba8=_0x430ba8-0x0;var _0x4a746e=_0x3da9[_0x430ba8];return _0x4a746e;};'use strict';var EventEmitter=require(_0x93da('0x0'));var MailSubstatus=require(_0x93da('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x93da('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x53774a){return function(_0x40cb20,_0x167e11,_0x3957b0){MailSubstatusEvents[_0x93da('0x3')](_0x53774a+':'+_0x40cb20['id'],_0x40cb20);MailSubstatusEvents['emit'](_0x53774a,_0x40cb20);_0x3957b0(null);};}for(var e in events){if(events[_0x93da('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x7f87=['hook','exports','events','setMaxListeners','update','emit'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7f87,0x1ac));var _0x77f8=function(_0x580be6,_0x5147a3){_0x580be6=_0x580be6-0x0;var _0x422f62=_0x7f87[_0x580be6];return _0x422f62;};'use strict';var EventEmitter=require(_0x77f8('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x77f8('0x1')](0x0);var events={'afterUpdate':_0x77f8('0x2')};function emitEvent(_0x147fa4){return function(_0x159d9e,_0x11ffd5,_0x3e315d){MailSubstatusEvents['emit'](_0x147fa4+':'+_0x159d9e['id'],_0x159d9e);MailSubstatusEvents[_0x77f8('0x3')](_0x147fa4,_0x159d9e);_0x3e315d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x77f8('0x4')](e,emitEvent(event));}}module[_0x77f8('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3126ade..b2bc67c 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 _0xced6=['define','MailSubstatus','mail_substatuses','Condition','update','name','_previousDataValues','then','catch'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xced6,0x1dd));var _0x6ced=function(_0x5b55cd,_0x1ccf2a){_0x5b55cd=_0x5b55cd-0x0;var _0x87cdf1=_0xced6[_0x5b55cd];return _0x87cdf1;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x40fd7d){var _0x526d96=_0x40fd7d['models'];return _0x40fd7d[_0x6ced('0x0')](_0x6ced('0x1'),attributes,{'tableName':_0x6ced('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xb5d18,_0x2b3d8e,_0x37865c){return _0x526d96[_0x6ced('0x3')][_0x6ced('0x4')]({'value':_0xb5d18[_0x6ced('0x5')]},{'where':{'field':'mailSubstatus','value':_0xb5d18[_0x6ced('0x6')][_0x6ced('0x5')]}})[_0x6ced('0x7')](function(){_0x37865c();})[_0x6ced('0x8')](function(_0x4abae7){_0x37865c(_0x4abae7);});}}});}; \ No newline at end of file +var _0x6b15=['exports','MailSubstatus','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x6b15,0x1b7));var _0x56b1=function(_0x4f56a5,_0x37bf88){_0x4f56a5=_0x4f56a5-0x0;var _0x22c364=_0x6b15[_0x4f56a5];return _0x22c364;};'use strict';var attributes=require(_0x56b1('0x0'));module[_0x56b1('0x1')]=function(_0xb18156){var _0xc5ff6d=_0xb18156['models'];return _0xb18156['define'](_0x56b1('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x446b34,_0x221174,_0x3b93f5){return _0xc5ff6d[_0x56b1('0x3')][_0x56b1('0x4')]({'value':_0x446b34[_0x56b1('0x5')]},{'where':{'field':_0x56b1('0x6'),'value':_0x446b34[_0x56b1('0x7')][_0x56b1('0x5')]}})[_0x56b1('0x8')](function(){_0x3b93f5();})[_0x56b1('0x9')](function(_0x1b66a3){_0x3b93f5(_0x1b66a3);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index df35007..2ba9536 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 _0x160c=['message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','debug','error','code'];(function(_0x1a74f7,_0x5514d1){var _0x1007a2=function(_0x21e35d){while(--_0x21e35d){_0x1a74f7['push'](_0x1a74f7['shift']());}};_0x1007a2(++_0x5514d1);}(_0x160c,0x122));var _0xc160=function(_0x51133b,_0x37c017){_0x51133b=_0x51133b-0x0;var _0x2eae72=_0x160c[_0x51133b];return _0x2eae72;};'use strict';var _=require(_0xc160('0x0'));var util=require(_0xc160('0x1'));var moment=require(_0xc160('0x2'));var BPromise=require('bluebird');var rs=require(_0xc160('0x3'));var fs=require('fs');var Redis=require(_0xc160('0x4'));var db=require(_0xc160('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc160('0x6'))(_0xc160('0x7'));var config=require(_0xc160('0x8'));var jayson=require(_0xc160('0x9'));var client=jayson[_0xc160('0xa')][_0xc160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20a0d8,_0x380d2a,_0x53f8e5){return new BPromise(function(_0x38618,_0x456b0c){return client[_0xc160('0xc')](_0x20a0d8,_0x53f8e5)['then'](function(_0x465e45){logger[_0xc160('0xd')](_0xc160('0xe'),_0x380d2a,'request\x20sent');logger[_0xc160('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x380d2a,'request\x20sent',JSON['stringify'](_0x465e45));if(_0x465e45[_0xc160('0x10')]){if(_0x465e45[_0xc160('0x10')][_0xc160('0x11')]===0x1f4){logger[_0xc160('0x10')](_0xc160('0xe'),_0x380d2a,_0x465e45['error'][_0xc160('0x12')]);return _0x456b0c(_0x465e45['error']['message']);}logger['error'](_0xc160('0xe'),_0x380d2a,_0x465e45[_0xc160('0x10')]['message']);return _0x38618(_0x465e45['error']['message']);}else{logger['info'](_0xc160('0xe'),_0x380d2a,_0xc160('0x13'));_0x38618(_0x465e45[_0xc160('0x14')][_0xc160('0x12')]);}})[_0xc160('0x15')](function(_0x504499){logger[_0xc160('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x380d2a,_0x504499);_0x456b0c(_0x504499);});});} \ No newline at end of file +var _0xa88e=['error','code','message','MailSubstatus,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x4d155c,_0x400ff5){var _0x51f33a=function(_0x3a5acd){while(--_0x3a5acd){_0x4d155c['push'](_0x4d155c['shift']());}};_0x51f33a(++_0x400ff5);}(_0xa88e,0x65));var _0xea88=function(_0x2546f8,_0x2ed8e1){_0x2546f8=_0x2546f8-0x0;var _0x5625c5=_0xa88e[_0x2546f8];return _0x5625c5;};'use strict';var _=require(_0xea88('0x0'));var util=require('util');var moment=require(_0xea88('0x1'));var BPromise=require(_0xea88('0x2'));var rs=require(_0xea88('0x3'));var fs=require('fs');var Redis=require(_0xea88('0x4'));var db=require(_0xea88('0x5'))['db'];var utils=require(_0xea88('0x6'));var logger=require(_0xea88('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xea88('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e32ee,_0x83c812,_0x56f036){return new BPromise(function(_0x16d7fc,_0x5f5990){return client['request'](_0x2e32ee,_0x56f036)['then'](function(_0x330b2f){logger[_0xea88('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x83c812,_0xea88('0xa'));logger[_0xea88('0xb')](_0xea88('0xc'),_0x83c812,_0xea88('0xa'),JSON['stringify'](_0x330b2f));if(_0x330b2f[_0xea88('0xd')]){if(_0x330b2f[_0xea88('0xd')][_0xea88('0xe')]===0x1f4){logger[_0xea88('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x83c812,_0x330b2f[_0xea88('0xd')][_0xea88('0xf')]);return _0x5f5990(_0x330b2f[_0xea88('0xd')]['message']);}logger[_0xea88('0xd')](_0xea88('0x10'),_0x83c812,_0x330b2f[_0xea88('0xd')][_0xea88('0xf')]);return _0x16d7fc(_0x330b2f[_0xea88('0xd')][_0xea88('0xf')]);}else{logger[_0xea88('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x83c812,_0xea88('0xa'));_0x16d7fc(_0x330b2f[_0xea88('0x11')][_0xea88('0xf')]);}})[_0xea88('0x12')](function(_0x10c3e5){logger['error'](_0xea88('0x10'),_0x83c812,_0x10c3e5);_0x5f5990(_0x10c3e5);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index caeb401..34f83ca 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 _0x04f3=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x04f3,0x140));var _0x304f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x04f3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x304f('0x0'));var util=require(_0x304f('0x1'));var path=require(_0x304f('0x2'));var timeout=require(_0x304f('0x3'));var express=require(_0x304f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x304f('0x5'));var interaction=require(_0x304f('0x6'));var config=require(_0x304f('0x7'));var controller=require(_0x304f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x304f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x304f('0xa')](_0x304f('0xb'),auth[_0x304f('0xc')](),controller[_0x304f('0xd')]);router['post']('/',auth[_0x304f('0xc')](),controller[_0x304f('0xe')]);router[_0x304f('0xf')](_0x304f('0xb'),auth[_0x304f('0xc')](),controller[_0x304f('0x10')]);router[_0x304f('0x11')](_0x304f('0xb'),auth['isAuthenticated'](),controller[_0x304f('0x12')]);module[_0x304f('0x13')]=router; \ No newline at end of file +var _0x08a0=['post','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4f7e62,_0xc9f627){var _0x13e2b6=function(_0x1f4e84){while(--_0x1f4e84){_0x4f7e62['push'](_0x4f7e62['shift']());}};_0x13e2b6(++_0xc9f627);}(_0x08a0,0x11c));var _0x008a=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x08a0[_0x31991b];return _0x307304;};'use strict';var multer=require(_0x008a('0x0'));var util=require(_0x008a('0x1'));var path=require(_0x008a('0x2'));var timeout=require(_0x008a('0x3'));var express=require(_0x008a('0x4'));var router=express[_0x008a('0x5')]();var fs_extra=require(_0x008a('0x6'));var auth=require(_0x008a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x008a('0x8'));var controller=require('./mailTransferReport.controller');router[_0x008a('0x9')]('/',auth[_0x008a('0xa')](),controller[_0x008a('0xb')]);router[_0x008a('0x9')](_0x008a('0xc'),auth[_0x008a('0xa')](),controller[_0x008a('0xd')]);router[_0x008a('0x9')](_0x008a('0xe'),auth[_0x008a('0xa')](),controller[_0x008a('0xf')]);router[_0x008a('0x10')]('/',auth[_0x008a('0xa')](),controller[_0x008a('0x11')]);router[_0x008a('0x12')]('/:id',auth[_0x008a('0xa')](),controller[_0x008a('0x13')]);router['delete'](_0x008a('0xe'),auth[_0x008a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index b411346..e67c66e 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x55e9e9,_0x1afc74){var _0x39cb0c=function(_0x4c02f3){while(--_0x4c02f3){_0x55e9e9['push'](_0x55e9e9['shift']());}};_0x39cb0c(++_0x1afc74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3336eb,_0x4bfc84){var _0x59e358=function(_0x180127){while(--_0x180127){_0x3336eb['push'](_0x3336eb['shift']());}};_0x59e358(++_0x4bfc84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ae140c0..00482d9 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 _0x0294=['sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','MailTransferReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','order','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x51a240,_0x556a09){var _0x16fc16=function(_0x1e09d9){while(--_0x1e09d9){_0x51a240['push'](_0x51a240['shift']());}};_0x16fc16(++_0x556a09);}(_0x0294,0x7a));var _0x4029=function(_0x4a0c28,_0x558479){_0x4a0c28=_0x4a0c28-0x0;var _0x27aead=_0x0294[_0x4a0c28];return _0x27aead;};'use strict';var emlformat=require(_0x4029('0x0'));var rimraf=require(_0x4029('0x1'));var zipdir=require(_0x4029('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4029('0x3'));var moment=require(_0x4029('0x4'));var BPromise=require(_0x4029('0x5'));var Mustache=require(_0x4029('0x6'));var util=require(_0x4029('0x7'));var path=require(_0x4029('0x8'));var sox=require(_0x4029('0x9'));var csv=require('to-csv');var ejs=require(_0x4029('0xa'));var fs=require('fs');var fs_extra=require(_0x4029('0xb'));var _=require(_0x4029('0xc'));var squel=require(_0x4029('0xd'));var crypto=require(_0x4029('0xe'));var jsforce=require(_0x4029('0xf'));var deskjs=require(_0x4029('0x10'));var toCsv=require(_0x4029('0x11'));var querystring=require('querystring');var Papa=require(_0x4029('0x12'));var Redis=require(_0x4029('0x13'));var authService=require(_0x4029('0x14'));var qs=require(_0x4029('0x15'));var as=require(_0x4029('0x16'));var hardwareService=require(_0x4029('0x17'));var logger=require(_0x4029('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x4029('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f4133,_0x3648a2){_0x3648a2=_0x3648a2||0xcc;return function(_0x592c75){if(_0x592c75){return _0x5f4133[_0x4029('0x1a')](_0x3648a2);}return _0x5f4133[_0x4029('0x1b')](_0x3648a2)[_0x4029('0x1c')]();};}function respondWithResult(_0x4e9dc2,_0xf8150f){_0xf8150f=_0xf8150f||0xc8;return function(_0x20a66a){if(_0x20a66a){return _0x4e9dc2['status'](_0xf8150f)[_0x4029('0x1d')](_0x20a66a);}};}function respondWithFilteredResult(_0x5dbfda,_0x4d2d80){return function(_0x495dec){if(_0x495dec){var _0x1cae45=typeof _0x4d2d80['offset']===_0x4029('0x1e')&&typeof _0x4d2d80[_0x4029('0x1f')]===_0x4029('0x1e');var _0x3a6695=_0x495dec['count'];var _0x6a378e=_0x1cae45?0x0:_0x4d2d80['offset'];var _0x31ccd1=_0x1cae45?_0x495dec[_0x4029('0x20')]:_0x4d2d80[_0x4029('0x21')]+_0x4d2d80[_0x4029('0x1f')];var _0x568ca7;if(_0x31ccd1>=_0x3a6695){_0x31ccd1=_0x3a6695;_0x568ca7=0xc8;}else{_0x568ca7=0xce;}_0x5dbfda[_0x4029('0x1b')](_0x568ca7);return _0x5dbfda[_0x4029('0x22')](_0x4029('0x23'),_0x6a378e+'-'+_0x31ccd1+'/'+_0x3a6695)[_0x4029('0x1d')](_0x495dec);}return null;};}function patchUpdates(_0x2c9ed4){return function(_0xb35f4){try{jsonpatch[_0x4029('0x24')](_0xb35f4,_0x2c9ed4,!![]);}catch(_0x2934e1){return BPromise['reject'](_0x2934e1);}return _0xb35f4[_0x4029('0x25')]();};}function saveUpdates(_0x8391ba,_0x3ed06c){return function(_0x1a9459){if(_0x1a9459){return _0x1a9459['update'](_0x8391ba)[_0x4029('0x26')](function(_0x13d883){return _0x13d883;});}return null;};}function removeEntity(_0x32d786,_0x90a401){return function(_0x133230){if(_0x133230){return _0x133230[_0x4029('0x27')]()['then'](function(){_0x32d786['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22ec9f,_0x31d043){return function(_0x480270){if(!_0x480270){_0x22ec9f['sendStatus'](0x194);}return _0x480270;};}function handleError(_0x416b7a,_0x1cb68a){_0x1cb68a=_0x1cb68a||0x1f4;return function(_0x5d38a4){logger[_0x4029('0x28')](_0x5d38a4[_0x4029('0x29')]);if(_0x5d38a4[_0x4029('0x2a')]){delete _0x5d38a4[_0x4029('0x2a')];}_0x416b7a[_0x4029('0x1b')](_0x1cb68a)[_0x4029('0x2b')](_0x5d38a4);};}exports['index']=function(_0x3039e3,_0x208deb){var _0x58501c={},_0x266532={},_0x5e36f7={'count':0x0,'rows':[]};var _0x1fc523=_['map'](db[_0x4029('0x2c')][_0x4029('0x2d')],function(_0x337b24){return{'name':_0x337b24[_0x4029('0x2e')],'type':_0x337b24[_0x4029('0x2f')]['key']};});_0x266532[_0x4029('0x30')]=_[_0x4029('0x31')](_0x1fc523,'name');_0x266532[_0x4029('0x32')]=_[_0x4029('0x33')](_0x3039e3['query']);_0x266532['filters']=_['intersection'](_0x266532[_0x4029('0x30')],_0x266532[_0x4029('0x32')]);_0x58501c['attributes']=_[_0x4029('0x34')](_0x266532['model'],qs[_0x4029('0x35')](_0x3039e3[_0x4029('0x32')][_0x4029('0x35')]));_0x58501c[_0x4029('0x36')]=_0x58501c[_0x4029('0x36')][_0x4029('0x37')]?_0x58501c[_0x4029('0x36')]:_0x266532[_0x4029('0x30')];if(!_0x3039e3[_0x4029('0x32')]['hasOwnProperty']('nolimit')){_0x58501c[_0x4029('0x1f')]=qs[_0x4029('0x1f')](_0x3039e3[_0x4029('0x32')][_0x4029('0x1f')]);_0x58501c[_0x4029('0x21')]=qs['offset'](_0x3039e3[_0x4029('0x32')][_0x4029('0x21')]);}_0x58501c[_0x4029('0x38')]=qs['sort'](_0x3039e3[_0x4029('0x32')]['sort']);_0x58501c['where']=qs[_0x4029('0x39')](_['pick'](_0x3039e3[_0x4029('0x32')],_0x266532[_0x4029('0x39')]),_0x1fc523);if(_0x3039e3[_0x4029('0x32')][_0x4029('0x3a')]){_0x58501c[_0x4029('0x3b')]=_[_0x4029('0x3c')](_0x58501c[_0x4029('0x3b')],{'$or':_[_0x4029('0x31')](_0x1fc523,function(_0x1dc6ec){if(_0x1dc6ec[_0x4029('0x2f')]!==_0x4029('0x3d')){var _0x3b03f9={};_0x3b03f9[_0x1dc6ec[_0x4029('0x2a')]]={'$like':'%'+_0x3039e3[_0x4029('0x32')][_0x4029('0x3a')]+'%'};return _0x3b03f9;}})});}_0x58501c=_[_0x4029('0x3c')]({},_0x58501c,_0x3039e3[_0x4029('0x3e')]);var _0x4a1ffe={'where':_0x58501c[_0x4029('0x3b')]};return db[_0x4029('0x2c')]['count'](_0x4a1ffe)['then'](function(_0x9b5925){_0x5e36f7[_0x4029('0x20')]=_0x9b5925;if(_0x3039e3[_0x4029('0x32')][_0x4029('0x3f')]){_0x58501c[_0x4029('0x40')]=[{'all':!![]}];}return db[_0x4029('0x2c')][_0x4029('0x41')](_0x58501c);})['then'](function(_0x3febdd){_0x5e36f7[_0x4029('0x42')]=_0x3febdd;return _0x5e36f7;})['then'](respondWithFilteredResult(_0x208deb,_0x58501c))[_0x4029('0x43')](handleError(_0x208deb,null));};exports[_0x4029('0x44')]=function(_0xd6a105,_0x47f699){var _0x170256={'raw':!![],'where':{'id':_0xd6a105[_0x4029('0x45')]['id']}},_0x3db66d={};_0x3db66d[_0x4029('0x30')]=_[_0x4029('0x33')](db[_0x4029('0x2c')][_0x4029('0x2d')]);_0x3db66d['query']=_[_0x4029('0x33')](_0xd6a105['query']);_0x3db66d[_0x4029('0x39')]=_[_0x4029('0x34')](_0x3db66d[_0x4029('0x30')],_0x3db66d[_0x4029('0x32')]);_0x170256['attributes']=_[_0x4029('0x34')](_0x3db66d[_0x4029('0x30')],qs['fields'](_0xd6a105[_0x4029('0x32')][_0x4029('0x35')]));_0x170256[_0x4029('0x36')]=_0x170256['attributes'][_0x4029('0x37')]?_0x170256[_0x4029('0x36')]:_0x3db66d[_0x4029('0x30')];if(_0xd6a105['query'][_0x4029('0x3f')]){_0x170256['include']=[{'all':!![]}];}_0x170256=_[_0x4029('0x3c')]({},_0x170256,_0xd6a105['options']);return db[_0x4029('0x2c')][_0x4029('0x46')](_0x170256)['then'](handleEntityNotFound(_0x47f699,null))[_0x4029('0x26')](respondWithResult(_0x47f699,null))[_0x4029('0x43')](handleError(_0x47f699,null));};exports[_0x4029('0x47')]=function(_0x129c48,_0x1c2958){return db[_0x4029('0x2c')]['create'](_0x129c48[_0x4029('0x48')],{})[_0x4029('0x26')](respondWithResult(_0x1c2958,0xc9))[_0x4029('0x43')](handleError(_0x1c2958,null));};exports[_0x4029('0x49')]=function(_0x28e834,_0x1b4942){if(_0x28e834[_0x4029('0x48')]['id']){delete _0x28e834[_0x4029('0x48')]['id'];}return db['MailTransferReport'][_0x4029('0x46')]({'where':{'id':_0x28e834['params']['id']}})['then'](handleEntityNotFound(_0x1b4942,null))[_0x4029('0x26')](saveUpdates(_0x28e834['body'],null))[_0x4029('0x26')](respondWithResult(_0x1b4942,null))[_0x4029('0x43')](handleError(_0x1b4942,null));};exports['destroy']=function(_0x1b1abd,_0x5b13f5){return db['MailTransferReport']['find']({'where':{'id':_0x1b1abd[_0x4029('0x45')]['id']}})[_0x4029('0x26')](handleEntityNotFound(_0x5b13f5,null))[_0x4029('0x26')](removeEntity(_0x5b13f5,null))['catch'](handleError(_0x5b13f5,null));};exports['describe']=function(_0x4b6b5e,_0x375962){return db['MailTransferReport']['describe']()[_0x4029('0x26')](respondWithResult(_0x375962,null))[_0x4029('0x43')](handleError(_0x375962,null));}; \ No newline at end of file +var _0x30a3=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','destroy','describe','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30a3,0xdb));var _0x330a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x30a3[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x330a('0x0'));var rimraf=require(_0x330a('0x1'));var zipdir=require(_0x330a('0x2'));var jsonpatch=require(_0x330a('0x3'));var rp=require(_0x330a('0x4'));var moment=require('moment');var BPromise=require(_0x330a('0x5'));var Mustache=require(_0x330a('0x6'));var util=require(_0x330a('0x7'));var path=require(_0x330a('0x8'));var sox=require(_0x330a('0x9'));var csv=require(_0x330a('0xa'));var ejs=require(_0x330a('0xb'));var fs=require('fs');var fs_extra=require(_0x330a('0xc'));var _=require('lodash');var squel=require(_0x330a('0xd'));var crypto=require(_0x330a('0xe'));var jsforce=require(_0x330a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x330a('0x10'));var Papa=require(_0x330a('0x11'));var Redis=require('ioredis');var authService=require(_0x330a('0x12'));var qs=require(_0x330a('0x13'));var as=require(_0x330a('0x14'));var hardwareService=require(_0x330a('0x15'));var logger=require('../../config/logger')(_0x330a('0x16'));var utils=require(_0x330a('0x17'));var config=require(_0x330a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x330a('0x19'))['db'];function respondWithStatusCode(_0x3a46ed,_0x3366cd){_0x3366cd=_0x3366cd||0xcc;return function(_0x4beaa5){if(_0x4beaa5){return _0x3a46ed[_0x330a('0x1a')](_0x3366cd);}return _0x3a46ed[_0x330a('0x1b')](_0x3366cd)[_0x330a('0x1c')]();};}function respondWithResult(_0x191c5b,_0x3e2cc4){_0x3e2cc4=_0x3e2cc4||0xc8;return function(_0x4c3159){if(_0x4c3159){return _0x191c5b[_0x330a('0x1b')](_0x3e2cc4)[_0x330a('0x1d')](_0x4c3159);}};}function respondWithFilteredResult(_0x922570,_0xcf5b81){return function(_0x434809){if(_0x434809){var _0x54015c=typeof _0xcf5b81[_0x330a('0x1e')]==='undefined'&&typeof _0xcf5b81['limit']===_0x330a('0x1f');var _0x39e956=_0x434809[_0x330a('0x20')];var _0x15591e=_0x54015c?0x0:_0xcf5b81[_0x330a('0x1e')];var _0x1f9b26=_0x54015c?_0x434809[_0x330a('0x20')]:_0xcf5b81[_0x330a('0x1e')]+_0xcf5b81[_0x330a('0x21')];var _0x34b316;if(_0x1f9b26>=_0x39e956){_0x1f9b26=_0x39e956;_0x34b316=0xc8;}else{_0x34b316=0xce;}_0x922570[_0x330a('0x1b')](_0x34b316);return _0x922570[_0x330a('0x22')](_0x330a('0x23'),_0x15591e+'-'+_0x1f9b26+'/'+_0x39e956)[_0x330a('0x1d')](_0x434809);}return null;};}function patchUpdates(_0x116815){return function(_0x3dbb96){try{jsonpatch[_0x330a('0x24')](_0x3dbb96,_0x116815,!![]);}catch(_0x194261){return BPromise[_0x330a('0x25')](_0x194261);}return _0x3dbb96[_0x330a('0x26')]();};}function saveUpdates(_0x1bb294,_0x4dc525){return function(_0x78a314){if(_0x78a314){return _0x78a314[_0x330a('0x27')](_0x1bb294)['then'](function(_0x30bcc2){return _0x30bcc2;});}return null;};}function removeEntity(_0x9b6dbd,_0x3c4e06){return function(_0x476c63){if(_0x476c63){return _0x476c63['destroy']()[_0x330a('0x28')](function(){_0x9b6dbd['status'](0xcc)[_0x330a('0x1c')]();});}};}function handleEntityNotFound(_0x4be7ba,_0x5b0748){return function(_0x4026e9){if(!_0x4026e9){_0x4be7ba[_0x330a('0x1a')](0x194);}return _0x4026e9;};}function handleError(_0x26177d,_0x510ced){_0x510ced=_0x510ced||0x1f4;return function(_0x50c082){logger[_0x330a('0x29')](_0x50c082[_0x330a('0x2a')]);if(_0x50c082['name']){delete _0x50c082[_0x330a('0x2b')];}_0x26177d[_0x330a('0x1b')](_0x510ced)['send'](_0x50c082);};}exports[_0x330a('0x2c')]=function(_0x1b6e0b,_0x4dbd96){var _0x2b4a74={},_0x284e86={},_0xf47b80={'count':0x0,'rows':[]};var _0x39c46e=_[_0x330a('0x2d')](db[_0x330a('0x2e')][_0x330a('0x2f')],function(_0x5b3fd4){return{'name':_0x5b3fd4['fieldName'],'type':_0x5b3fd4[_0x330a('0x30')][_0x330a('0x31')]};});_0x284e86[_0x330a('0x32')]=_[_0x330a('0x2d')](_0x39c46e,_0x330a('0x2b'));_0x284e86[_0x330a('0x33')]=_[_0x330a('0x34')](_0x1b6e0b[_0x330a('0x33')]);_0x284e86[_0x330a('0x35')]=_[_0x330a('0x36')](_0x284e86['model'],_0x284e86[_0x330a('0x33')]);_0x2b4a74[_0x330a('0x37')]=_[_0x330a('0x36')](_0x284e86[_0x330a('0x32')],qs[_0x330a('0x38')](_0x1b6e0b[_0x330a('0x33')][_0x330a('0x38')]));_0x2b4a74[_0x330a('0x37')]=_0x2b4a74[_0x330a('0x37')][_0x330a('0x39')]?_0x2b4a74[_0x330a('0x37')]:_0x284e86[_0x330a('0x32')];if(!_0x1b6e0b[_0x330a('0x33')][_0x330a('0x3a')](_0x330a('0x3b'))){_0x2b4a74['limit']=qs[_0x330a('0x21')](_0x1b6e0b[_0x330a('0x33')][_0x330a('0x21')]);_0x2b4a74['offset']=qs[_0x330a('0x1e')](_0x1b6e0b[_0x330a('0x33')][_0x330a('0x1e')]);}_0x2b4a74[_0x330a('0x3c')]=qs[_0x330a('0x3d')](_0x1b6e0b[_0x330a('0x33')][_0x330a('0x3d')]);_0x2b4a74[_0x330a('0x3e')]=qs[_0x330a('0x35')](_[_0x330a('0x3f')](_0x1b6e0b[_0x330a('0x33')],_0x284e86[_0x330a('0x35')]),_0x39c46e);if(_0x1b6e0b[_0x330a('0x33')][_0x330a('0x40')]){_0x2b4a74[_0x330a('0x3e')]=_[_0x330a('0x41')](_0x2b4a74['where'],{'$or':_[_0x330a('0x2d')](_0x39c46e,function(_0x1781ff){if(_0x1781ff[_0x330a('0x30')]!==_0x330a('0x42')){var _0x2807fd={};_0x2807fd[_0x1781ff['name']]={'$like':'%'+_0x1b6e0b[_0x330a('0x33')][_0x330a('0x40')]+'%'};return _0x2807fd;}})});}_0x2b4a74=_[_0x330a('0x41')]({},_0x2b4a74,_0x1b6e0b[_0x330a('0x43')]);var _0x57ca42={'where':_0x2b4a74[_0x330a('0x3e')]};return db[_0x330a('0x2e')][_0x330a('0x20')](_0x57ca42)[_0x330a('0x28')](function(_0x2d4d4c){_0xf47b80['count']=_0x2d4d4c;if(_0x1b6e0b[_0x330a('0x33')][_0x330a('0x44')]){_0x2b4a74[_0x330a('0x45')]=[{'all':!![]}];}return db[_0x330a('0x2e')][_0x330a('0x46')](_0x2b4a74);})[_0x330a('0x28')](function(_0x3f10bd){_0xf47b80['rows']=_0x3f10bd;return _0xf47b80;})[_0x330a('0x28')](respondWithFilteredResult(_0x4dbd96,_0x2b4a74))['catch'](handleError(_0x4dbd96,null));};exports[_0x330a('0x47')]=function(_0x26e3d6,_0x1650cb){var _0x1f0b96={'raw':!![],'where':{'id':_0x26e3d6[_0x330a('0x48')]['id']}},_0x1b7f41={};_0x1b7f41[_0x330a('0x32')]=_[_0x330a('0x34')](db['MailTransferReport'][_0x330a('0x2f')]);_0x1b7f41[_0x330a('0x33')]=_[_0x330a('0x34')](_0x26e3d6[_0x330a('0x33')]);_0x1b7f41[_0x330a('0x35')]=_[_0x330a('0x36')](_0x1b7f41[_0x330a('0x32')],_0x1b7f41['query']);_0x1f0b96[_0x330a('0x37')]=_[_0x330a('0x36')](_0x1b7f41['model'],qs[_0x330a('0x38')](_0x26e3d6[_0x330a('0x33')][_0x330a('0x38')]));_0x1f0b96[_0x330a('0x37')]=_0x1f0b96[_0x330a('0x37')][_0x330a('0x39')]?_0x1f0b96[_0x330a('0x37')]:_0x1b7f41['model'];if(_0x26e3d6[_0x330a('0x33')][_0x330a('0x44')]){_0x1f0b96['include']=[{'all':!![]}];}_0x1f0b96=_[_0x330a('0x41')]({},_0x1f0b96,_0x26e3d6[_0x330a('0x43')]);return db[_0x330a('0x2e')][_0x330a('0x49')](_0x1f0b96)[_0x330a('0x28')](handleEntityNotFound(_0x1650cb,null))[_0x330a('0x28')](respondWithResult(_0x1650cb,null))[_0x330a('0x4a')](handleError(_0x1650cb,null));};exports['create']=function(_0x89c6d4,_0x30629c){return db['MailTransferReport'][_0x330a('0x4b')](_0x89c6d4['body'],{})[_0x330a('0x28')](respondWithResult(_0x30629c,0xc9))['catch'](handleError(_0x30629c,null));};exports['update']=function(_0x2c67eb,_0x47acac){if(_0x2c67eb[_0x330a('0x4c')]['id']){delete _0x2c67eb[_0x330a('0x4c')]['id'];}return db[_0x330a('0x2e')]['find']({'where':{'id':_0x2c67eb[_0x330a('0x48')]['id']}})[_0x330a('0x28')](handleEntityNotFound(_0x47acac,null))[_0x330a('0x28')](saveUpdates(_0x2c67eb[_0x330a('0x4c')],null))[_0x330a('0x28')](respondWithResult(_0x47acac,null))[_0x330a('0x4a')](handleError(_0x47acac,null));};exports[_0x330a('0x4d')]=function(_0x3a3068,_0x250c5e){return db[_0x330a('0x2e')][_0x330a('0x49')]({'where':{'id':_0x3a3068[_0x330a('0x48')]['id']}})[_0x330a('0x28')](handleEntityNotFound(_0x250c5e,null))[_0x330a('0x28')](removeEntity(_0x250c5e,null))['catch'](handleError(_0x250c5e,null));};exports[_0x330a('0x4e')]=function(_0xedc1f4,_0x8c1fca){return db[_0x330a('0x2e')][_0x330a('0x4e')]()[_0x330a('0x28')](respondWithResult(_0x8c1fca,null))[_0x330a('0x4a')](handleError(_0x8c1fca,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index cb8b502..61ad4cf 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 _0xff16=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer'];(function(_0x413ade,_0x5e0d5a){var _0x4abafd=function(_0x170d3e){while(--_0x170d3e){_0x413ade['push'](_0x413ade['shift']());}};_0x4abafd(++_0x5e0d5a);}(_0xff16,0x7f));var _0x6ff1=function(_0x5d8ca6,_0x29de4f){_0x5d8ca6=_0x5d8ca6-0x0;var _0xa1768b=_0xff16[_0x5d8ca6];return _0xa1768b;};'use strict';var _=require(_0x6ff1('0x0'));var util=require(_0x6ff1('0x1'));var logger=require('../../config/logger')(_0x6ff1('0x2'));var moment=require(_0x6ff1('0x3'));var BPromise=require(_0x6ff1('0x4'));var rp=require(_0x6ff1('0x5'));var fs=require('fs');var path=require(_0x6ff1('0x6'));var rimraf=require(_0x6ff1('0x7'));var config=require(_0x6ff1('0x8'));var attributes=require(_0x6ff1('0x9'));module['exports']=function(_0x153a91,_0x4f8f24){return _0x153a91[_0x6ff1('0xa')](_0x6ff1('0xb'),attributes,{'tableName':_0x6ff1('0xc'),'paranoid':![],'indexes':[{'name':_0x6ff1('0xd'),'fields':[_0x6ff1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c0=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','report_mail_transfer'];(function(_0x279088,_0x156c7c){var _0x5444a6=function(_0x3f0070){while(--_0x3f0070){_0x279088['push'](_0x279088['shift']());}};_0x5444a6(++_0x156c7c);}(_0xa5c0,0xbf));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0a5c('0x0'));var util=require(_0x0a5c('0x1'));var logger=require(_0x0a5c('0x2'))('api');var moment=require(_0x0a5c('0x3'));var BPromise=require(_0x0a5c('0x4'));var rp=require(_0x0a5c('0x5'));var fs=require('fs');var path=require(_0x0a5c('0x6'));var rimraf=require(_0x0a5c('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x48540c,_0x456437){return _0x48540c['define']('MailTransferReport',attributes,{'tableName':_0x0a5c('0x8'),'paranoid':![],'indexes':[{'name':_0x0a5c('0x9'),'fields':[_0x0a5c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 013c34a..1a4dff8 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 _0x4d1a=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x16a816,_0x54e6ab){var _0xc7cf2c=function(_0x252bfc){while(--_0x252bfc){_0x16a816['push'](_0x16a816['shift']());}};_0xc7cf2c(++_0x54e6ab);}(_0x4d1a,0x18b));var _0xa4d1=function(_0x2eb5a3,_0x5cfa19){_0x2eb5a3=_0x2eb5a3-0x0;var _0x2e4e5b=_0x4d1a[_0x2eb5a3];return _0x2e4e5b;};'use strict';var _=require(_0xa4d1('0x0'));var util=require(_0xa4d1('0x1'));var moment=require(_0xa4d1('0x2'));var BPromise=require(_0xa4d1('0x3'));var rs=require(_0xa4d1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4d1('0x6'))(_0xa4d1('0x7'));var config=require(_0xa4d1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa4d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3642fc,_0x40b948,_0x158fd1){return new BPromise(function(_0x21362d,_0x195cfb){return client['request'](_0x3642fc,_0x158fd1)[_0xa4d1('0xa')](function(_0x146e25){logger[_0xa4d1('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x40b948,_0xa4d1('0xc'));logger[_0xa4d1('0xd')](_0xa4d1('0xe'),_0x40b948,_0xa4d1('0xc'),JSON['stringify'](_0x146e25));if(_0x146e25[_0xa4d1('0xf')]){if(_0x146e25[_0xa4d1('0xf')][_0xa4d1('0x10')]===0x1f4){logger[_0xa4d1('0xf')](_0xa4d1('0x11'),_0x40b948,_0x146e25[_0xa4d1('0xf')]['message']);return _0x195cfb(_0x146e25['error'][_0xa4d1('0x12')]);}logger[_0xa4d1('0xf')](_0xa4d1('0x11'),_0x40b948,_0x146e25[_0xa4d1('0xf')][_0xa4d1('0x12')]);return _0x21362d(_0x146e25['error'][_0xa4d1('0x12')]);}else{logger[_0xa4d1('0xb')](_0xa4d1('0x11'),_0x40b948,_0xa4d1('0xc'));_0x21362d(_0x146e25[_0xa4d1('0x13')][_0xa4d1('0x12')]);}})[_0xa4d1('0x14')](function(_0x26608a){logger[_0xa4d1('0xf')](_0xa4d1('0x11'),_0x40b948,_0x26608a);_0x195cfb(_0x26608a);});});} \ No newline at end of file +var _0x427d=['jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5db32d,_0x2849c6){var _0x2d4d9d=function(_0x50ff35){while(--_0x50ff35){_0x5db32d['push'](_0x5db32d['shift']());}};_0x2d4d9d(++_0x2849c6);}(_0x427d,0x189));var _0xd427=function(_0x732889,_0x2cd3d0){_0x732889=_0x732889-0x0;var _0x15ab9e=_0x427d[_0x732889];return _0x15ab9e;};'use strict';var _=require(_0xd427('0x0'));var util=require('util');var moment=require(_0xd427('0x1'));var BPromise=require(_0xd427('0x2'));var rs=require(_0xd427('0x3'));var fs=require('fs');var Redis=require(_0xd427('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd427('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd427('0x6'));var client=jayson['client'][_0xd427('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x234037,_0x58a2ae,_0x5e2be7){return new BPromise(function(_0x1ecd4f,_0x26789b){return client[_0xd427('0x8')](_0x234037,_0x5e2be7)[_0xd427('0x9')](function(_0x1c3d99){logger[_0xd427('0xa')](_0xd427('0xb'),_0x58a2ae,_0xd427('0xc'));logger[_0xd427('0xd')](_0xd427('0xe'),_0x58a2ae,'request\x20sent',JSON['stringify'](_0x1c3d99));if(_0x1c3d99[_0xd427('0xf')]){if(_0x1c3d99[_0xd427('0xf')][_0xd427('0x10')]===0x1f4){logger[_0xd427('0xf')](_0xd427('0xb'),_0x58a2ae,_0x1c3d99['error']['message']);return _0x26789b(_0x1c3d99[_0xd427('0xf')][_0xd427('0x11')]);}logger[_0xd427('0xf')](_0xd427('0xb'),_0x58a2ae,_0x1c3d99[_0xd427('0xf')]['message']);return _0x1ecd4f(_0x1c3d99[_0xd427('0xf')][_0xd427('0x11')]);}else{logger['info'](_0xd427('0xb'),_0x58a2ae,_0xd427('0xc'));_0x1ecd4f(_0x1c3d99[_0xd427('0x12')][_0xd427('0x11')]);}})['catch'](function(_0x4f8bfe){logger[_0xd427('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x58a2ae,_0x4f8bfe);_0x26789b(_0x4f8bfe);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 44b2f14..8f456d1 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 _0x388d=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x2ff750,_0x2dca1e){var _0x40d868=function(_0x30f04c){while(--_0x30f04c){_0x2ff750['push'](_0x2ff750['shift']());}};_0x40d868(++_0x2dca1e);}(_0x388d,0x8c));var _0xd388=function(_0x5628ca,_0x3c88e4){_0x5628ca=_0x5628ca-0x0;var _0x2dc711=_0x388d[_0x5628ca];return _0x2dc711;};'use strict';var multer=require(_0xd388('0x0'));var util=require(_0xd388('0x1'));var path=require(_0xd388('0x2'));var timeout=require(_0xd388('0x3'));var express=require('express');var router=express[_0xd388('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd388('0x5'));var config=require(_0xd388('0x6'));var controller=require('./memberReport.controller');router[_0xd388('0x7')]('/',auth[_0xd388('0x8')](),controller[_0xd388('0x9')]);router[_0xd388('0x7')](_0xd388('0xa'),auth[_0xd388('0x8')](),controller['describe']);router['get'](_0xd388('0xb'),auth['isAuthenticated'](),controller[_0xd388('0xc')]);router[_0xd388('0xd')]('/',auth[_0xd388('0x8')](),controller['create']);router[_0xd388('0xe')](_0xd388('0xb'),auth[_0xd388('0x8')](),controller[_0xd388('0xf')]);router[_0xd388('0x10')](_0xd388('0xb'),auth[_0xd388('0x8')](),controller[_0xd388('0x11')]);module[_0xd388('0x12')]=router; \ No newline at end of file +var _0x3b6c=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x143ca0,_0x586bd3){var _0x11f1c5=function(_0xe32f94){while(--_0xe32f94){_0x143ca0['push'](_0x143ca0['shift']());}};_0x11f1c5(++_0x586bd3);}(_0x3b6c,0x91));var _0xc3b6=function(_0x4bde03,_0x55605a){_0x4bde03=_0x4bde03-0x0;var _0x2533c0=_0x3b6c[_0x4bde03];return _0x2533c0;};'use strict';var multer=require('multer');var util=require(_0xc3b6('0x0'));var path=require(_0xc3b6('0x1'));var timeout=require(_0xc3b6('0x2'));var express=require('express');var router=express[_0xc3b6('0x3')]();var fs_extra=require(_0xc3b6('0x4'));var auth=require(_0xc3b6('0x5'));var interaction=require(_0xc3b6('0x6'));var config=require(_0xc3b6('0x7'));var controller=require(_0xc3b6('0x8'));router[_0xc3b6('0x9')]('/',auth[_0xc3b6('0xa')](),controller[_0xc3b6('0xb')]);router[_0xc3b6('0x9')](_0xc3b6('0xc'),auth[_0xc3b6('0xa')](),controller[_0xc3b6('0xd')]);router[_0xc3b6('0x9')](_0xc3b6('0xe'),auth[_0xc3b6('0xa')](),controller['show']);router[_0xc3b6('0xf')]('/',auth[_0xc3b6('0xa')](),controller['create']);router[_0xc3b6('0x10')](_0xc3b6('0xe'),auth['isAuthenticated'](),controller[_0xc3b6('0x11')]);router[_0xc3b6('0x12')](_0xc3b6('0xe'),auth[_0xc3b6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 3cb7119..b054b3f 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 _0x650c=['moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x431f6c,_0x427405){var _0x1cd17e=function(_0x38bce2){while(--_0x38bce2){_0x431f6c['push'](_0x431f6c['shift']());}};_0x1cd17e(++_0x427405);}(_0x650c,0x179));var _0xc650=function(_0x27a01c,_0x5614d1){_0x27a01c=_0x27a01c-0x0;var _0x479a17=_0x650c[_0x27a01c];return _0x479a17;};'use strict';var Sequelize=require(_0xc650('0x0'));var moment=require(_0xc650('0x1'));module[_0xc650('0x2')]={'channel':{'type':Sequelize[_0xc650('0x3')]},'membername':{'type':Sequelize[_0xc650('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc650('0x3')],'defaultValue':_0xc650('0x4'),'comment':_0xc650('0x5')},'duration':{'type':Sequelize[_0xc650('0x6')]},'enterAt':{'type':Sequelize[_0xc650('0x7')]},'exitAt':{'type':Sequelize[_0xc650('0x7')],'set':function(_0x33c5e0){var _0x467947=moment(_0x33c5e0);var _0x3977cf=moment(this['getDataValue'](_0xc650('0x8')));var _0x292d87=_0x467947[_0xc650('0x9')](_0x3977cf,'seconds');this['setDataValue'](_0xc650('0xa'),_0x33c5e0);this[_0xc650('0xb')](_0xc650('0xc'),_0x292d87>=0x0?_0x292d87:null);}},'data1':{'type':Sequelize[_0xc650('0x3')],'comment':_0xc650('0xd')},'data2':{'type':Sequelize[_0xc650('0x3')],'comment':_0xc650('0xe')},'data3':{'type':Sequelize[_0xc650('0x3')],'comment':_0xc650('0xf')},'data4':{'type':Sequelize[_0xc650('0x3')],'comment':_0xc650('0x10')},'data5':{'type':Sequelize[_0xc650('0x3')],'comment':_0xc650('0x11')},'role':{'type':Sequelize[_0xc650('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc650('0x3')]}}; \ No newline at end of file +var _0x7bf7=['moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7bf7,0x8f));var _0x77bf=function(_0x903290,_0x2b6098){_0x903290=_0x903290-0x0;var _0x27b7f2=_0x7bf7[_0x903290];return _0x27b7f2;};'use strict';var Sequelize=require(_0x77bf('0x0'));var moment=require(_0x77bf('0x1'));module[_0x77bf('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x77bf('0x3')]},'interface':{'type':Sequelize[_0x77bf('0x3')]},'type':{'type':Sequelize[_0x77bf('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x77bf('0x4')},'duration':{'type':Sequelize[_0x77bf('0x5')]},'enterAt':{'type':Sequelize[_0x77bf('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x532d86){var _0x4f9ee5=moment(_0x532d86);var _0x2208eb=moment(this[_0x77bf('0x7')](_0x77bf('0x8')));var _0xbd63ed=_0x4f9ee5[_0x77bf('0x9')](_0x2208eb,_0x77bf('0xa'));this[_0x77bf('0xb')](_0x77bf('0xc'),_0x532d86);this[_0x77bf('0xb')]('duration',_0xbd63ed>=0x0?_0xbd63ed:null);}},'data1':{'type':Sequelize[_0x77bf('0x3')],'comment':_0x77bf('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0x77bf('0xe')},'data3':{'type':Sequelize[_0x77bf('0x3')],'comment':_0x77bf('0xf')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x77bf('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x77bf('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d607b96..0b3ffa2 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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x392ec2,_0x4e9f85){var _0x16e517=function(_0x379e8b){while(--_0x379e8b){_0x392ec2['push'](_0x392ec2['shift']());}};_0x16e517(++_0x4e9f85);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x53eeac,_0x1babff){var _0x41dddf=function(_0x2e8176){while(--_0x2e8176){_0x53eeac['push'](_0x53eeac['shift']());}};_0x41dddf(++_0x1babff);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 114c6f7..c0fb205 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 _0x4f0d=['bluebird','request-promise','path','../../config/environment','define','MemberReport','membername_interface','membername','interface'];(function(_0x53eb01,_0x11d6ba){var _0x321ba9=function(_0x287b43){while(--_0x287b43){_0x53eb01['push'](_0x53eb01['shift']());}};_0x321ba9(++_0x11d6ba);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x48f791,_0x57dbd7){_0x48f791=_0x48f791-0x0;var _0x5ec5ea=_0x4f0d[_0x48f791];return _0x5ec5ea;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd4f0('0x0'));var rp=require(_0xd4f0('0x1'));var fs=require('fs');var path=require(_0xd4f0('0x2'));var rimraf=require('rimraf');var config=require(_0xd4f0('0x3'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x1809dd,_0x4da370){return _0x1809dd[_0xd4f0('0x4')](_0xd4f0('0x5'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xd4f0('0x6'),'fields':[_0xd4f0('0x7'),_0xd4f0('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6143=['interface','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface','membername'];(function(_0x45607c,_0x3bcf90){var _0x1b3646=function(_0x9aefca){while(--_0x9aefca){_0x45607c['push'](_0x45607c['shift']());}};_0x1b3646(++_0x3bcf90);}(_0x6143,0x135));var _0x3614=function(_0x1a06be,_0x2ab608){_0x1a06be=_0x1a06be-0x0;var _0x5dc1bc=_0x6143[_0x1a06be];return _0x5dc1bc;};'use strict';var _=require('lodash');var util=require(_0x3614('0x0'));var logger=require('../../config/logger')(_0x3614('0x1'));var moment=require(_0x3614('0x2'));var BPromise=require(_0x3614('0x3'));var rp=require(_0x3614('0x4'));var fs=require('fs');var path=require(_0x3614('0x5'));var rimraf=require(_0x3614('0x6'));var config=require(_0x3614('0x7'));var attributes=require(_0x3614('0x8'));module['exports']=function(_0x9e5c75,_0x5c5e13){return _0x9e5c75['define'](_0x3614('0x9'),attributes,{'tableName':_0x3614('0xa'),'paranoid':![],'indexes':[{'name':_0x3614('0xb'),'fields':[_0x3614('0xc'),_0x3614('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7b919a0..17d7e8f 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 _0x199c=['catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','model','CreateMemberReport','create','raw','UpdateMemberReport','update','body','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result'];(function(_0x1fb899,_0x6d801d){var _0x5a7202=function(_0x3710b9){while(--_0x3710b9){_0x1fb899['push'](_0x1fb899['shift']());}};_0x5a7202(++_0x6d801d);}(_0x199c,0x1d8));var _0xc199=function(_0x45120b,_0x5d71e8){_0x45120b=_0x45120b-0x0;var _0xde5a7d=_0x199c[_0x45120b];return _0xde5a7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc199('0x0'));var BPromise=require(_0xc199('0x1'));var rs=require(_0xc199('0x2'));var fs=require('fs');var Redis=require(_0xc199('0x3'));var db=require(_0xc199('0x4'))['db'];var utils=require(_0xc199('0x5'));var logger=require(_0xc199('0x6'))(_0xc199('0x7'));var config=require('../../config/environment');var jayson=require(_0xc199('0x8'));var client=jayson[_0xc199('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd9cb,_0xc2b40a,_0x126236){return new BPromise(function(_0x12d6df,_0x2619ea){return client[_0xc199('0xa')](_0x4cd9cb,_0x126236)[_0xc199('0xb')](function(_0x211733){logger[_0xc199('0xc')]('MemberReport,\x20%s,\x20%s',_0xc2b40a,_0xc199('0xd'));logger[_0xc199('0xe')](_0xc199('0xf'),_0xc2b40a,_0xc199('0xd'),JSON[_0xc199('0x10')](_0x211733));if(_0x211733[_0xc199('0x11')]){if(_0x211733['error'][_0xc199('0x12')]===0x1f4){logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x211733[_0xc199('0x11')][_0xc199('0x14')]);return _0x2619ea(_0x211733['error'][_0xc199('0x14')]);}logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x211733[_0xc199('0x11')][_0xc199('0x14')]);return _0x12d6df(_0x211733['error']['message']);}else{logger[_0xc199('0xc')]('MemberReport,\x20%s,\x20%s',_0xc2b40a,_0xc199('0xd'));_0x12d6df(_0x211733[_0xc199('0x15')]['message']);}})[_0xc199('0x16')](function(_0x4f268d){logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x4f268d);_0x2619ea(_0x4f268d);});});}exports[_0xc199('0x17')]=function(_0x6e8d4c){var _0x34c3cf=this;return new Promise(function(_0x40de74,_0x155ce2){return db[_0xc199('0x18')][_0xc199('0x19')]({'raw':_0x6e8d4c[_0xc199('0x1a')]?_0x6e8d4c[_0xc199('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x6e8d4c[_0xc199('0x1a')]?_0x6e8d4c[_0xc199('0x1a')][_0xc199('0x1b')]||null:null,'attributes':_0x6e8d4c[_0xc199('0x1a')]?_0x6e8d4c['options'][_0xc199('0x1c')]||null:null,'limit':_0x6e8d4c[_0xc199('0x1a')]?_0x6e8d4c[_0xc199('0x1a')][_0xc199('0x1d')]||null:null,'include':_0x6e8d4c[_0xc199('0x1a')]?_0x6e8d4c[_0xc199('0x1a')]['include']?_['map'](_0x6e8d4c[_0xc199('0x1a')]['include'],function(_0x30f576){return{'model':db[_0x30f576['model']],'as':_0x30f576['as'],'attributes':_0x30f576[_0xc199('0x1c')],'include':_0x30f576[_0xc199('0x1e')]?_['map'](_0x30f576[_0xc199('0x1e')],function(_0x838760){return{'model':db[_0x838760['model']],'as':_0x838760['as'],'attributes':_0x838760[_0xc199('0x1c')],'include':_0x838760['include']?_['map'](_0x838760[_0xc199('0x1e')],function(_0x4494b5){return{'model':db[_0x4494b5[_0xc199('0x1f')]],'as':_0x4494b5['as'],'attributes':_0x4494b5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc199('0xb')](function(_0x138443){logger['info'](_0xc199('0x17'),_0x6e8d4c);logger['debug'](_0xc199('0x17'),_0x6e8d4c,JSON['stringify'](_0x138443));_0x40de74(_0x138443);})[_0xc199('0x16')](function(_0x13e53e){logger[_0xc199('0x11')](_0xc199('0x17'),_0x13e53e[_0xc199('0x14')],_0x6e8d4c);_0x155ce2(_0x34c3cf[_0xc199('0x11')](0x1f4,_0x13e53e[_0xc199('0x14')]));});});};exports[_0xc199('0x20')]=function(_0x57a3e2){var _0x23f080=this;return new Promise(function(_0x8d7945,_0x4553a3){return db['MemberReport'][_0xc199('0x21')](_0x57a3e2['body'],{'raw':_0x57a3e2['options']?_0x57a3e2[_0xc199('0x1a')][_0xc199('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x1d98b7){logger['info']('CreateMemberReport',_0x57a3e2);logger[_0xc199('0xe')]('CreateMemberReport',_0x57a3e2,JSON[_0xc199('0x10')](_0x1d98b7));_0x8d7945(_0x1d98b7);})[_0xc199('0x16')](function(_0x310fcb){logger[_0xc199('0x11')](_0xc199('0x20'),_0x310fcb['message'],_0x57a3e2);_0x4553a3(_0x23f080['error'](0x1f4,_0x310fcb['message']));});});};exports[_0xc199('0x23')]=function(_0x490e0e){var _0x3bf1cf=this;return new Promise(function(_0x7f8f7f,_0x3785f9){return db[_0xc199('0x18')][_0xc199('0x24')](_0x490e0e[_0xc199('0x25')],{'raw':_0x490e0e[_0xc199('0x1a')]?_0x490e0e[_0xc199('0x1a')][_0xc199('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x490e0e[_0xc199('0x1a')]?_0x490e0e['options']['where']||null:null,'attributes':_0x490e0e[_0xc199('0x1a')]?_0x490e0e[_0xc199('0x1a')][_0xc199('0x1c')]||null:null,'limit':_0x490e0e[_0xc199('0x1a')]?_0x490e0e[_0xc199('0x1a')][_0xc199('0x1d')]||null:null})[_0xc199('0xb')](function(_0x2d71a3){logger['info']('UpdateMemberReport',_0x490e0e);logger['debug'](_0xc199('0x23'),_0x490e0e,JSON[_0xc199('0x10')](_0x2d71a3));_0x7f8f7f(_0x2d71a3);})[_0xc199('0x16')](function(_0x5cc817){logger[_0xc199('0x11')](_0xc199('0x23'),_0x5cc817['message'],_0x490e0e);_0x3785f9(_0x3bf1cf[_0xc199('0x11')](0x1f4,_0x5cc817[_0xc199('0x14')]));});});}; \ No newline at end of file +var _0xbf4e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','create','body','UpdateMemberReport'];(function(_0x4f539d,_0x5d0e3b){var _0x22ccfa=function(_0x20be8b){while(--_0x20be8b){_0x4f539d['push'](_0x4f539d['shift']());}};_0x22ccfa(++_0x5d0e3b);}(_0xbf4e,0x172));var _0xebf4=function(_0x4cb4d6,_0x320c6a){_0x4cb4d6=_0x4cb4d6-0x0;var _0x2a6c4c=_0xbf4e[_0x4cb4d6];return _0x2a6c4c;};'use strict';var _=require(_0xebf4('0x0'));var util=require(_0xebf4('0x1'));var moment=require(_0xebf4('0x2'));var BPromise=require(_0xebf4('0x3'));var rs=require(_0xebf4('0x4'));var fs=require('fs');var Redis=require(_0xebf4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xebf4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xebf4('0x7'));var jayson=require(_0xebf4('0x8'));var client=jayson['client'][_0xebf4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x995254,_0x33ff2b,_0x48764f){return new BPromise(function(_0x2f17c0,_0xcfaf52){return client[_0xebf4('0xa')](_0x995254,_0x48764f)[_0xebf4('0xb')](function(_0x50df01){logger[_0xebf4('0xc')](_0xebf4('0xd'),_0x33ff2b,_0xebf4('0xe'));logger[_0xebf4('0xf')](_0xebf4('0x10'),_0x33ff2b,_0xebf4('0xe'),JSON[_0xebf4('0x11')](_0x50df01));if(_0x50df01[_0xebf4('0x12')]){if(_0x50df01[_0xebf4('0x12')]['code']===0x1f4){logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x50df01[_0xebf4('0x12')]['message']);return _0xcfaf52(_0x50df01['error'][_0xebf4('0x13')]);}logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x50df01[_0xebf4('0x12')][_0xebf4('0x13')]);return _0x2f17c0(_0x50df01[_0xebf4('0x12')][_0xebf4('0x13')]);}else{logger[_0xebf4('0xc')](_0xebf4('0xd'),_0x33ff2b,_0xebf4('0xe'));_0x2f17c0(_0x50df01[_0xebf4('0x14')][_0xebf4('0x13')]);}})[_0xebf4('0x15')](function(_0x2b0259){logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x2b0259);_0xcfaf52(_0x2b0259);});});}exports[_0xebf4('0x16')]=function(_0x4e83a8){var _0x5e1b61=this;return new Promise(function(_0x5db628,_0x4256a3){return db[_0xebf4('0x17')][_0xebf4('0x18')]({'raw':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1b')]||null:null,'attributes':_0x4e83a8['options']?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1c')]||null:null,'limit':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1d')]||null:null,'include':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')]['include']?_[_0xebf4('0x1e')](_0x4e83a8[_0xebf4('0x19')]['include'],function(_0x526034){return{'model':db[_0x526034['model']],'as':_0x526034['as'],'attributes':_0x526034['attributes'],'include':_0x526034[_0xebf4('0x1f')]?_[_0xebf4('0x1e')](_0x526034[_0xebf4('0x1f')],function(_0x31c070){return{'model':db[_0x31c070[_0xebf4('0x20')]],'as':_0x31c070['as'],'attributes':_0x31c070[_0xebf4('0x1c')],'include':_0x31c070[_0xebf4('0x1f')]?_[_0xebf4('0x1e')](_0x31c070['include'],function(_0x19527e){return{'model':db[_0x19527e['model']],'as':_0x19527e['as'],'attributes':_0x19527e[_0xebf4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xebf4('0xb')](function(_0x534272){logger[_0xebf4('0xc')](_0xebf4('0x16'),_0x4e83a8);logger['debug'](_0xebf4('0x16'),_0x4e83a8,JSON['stringify'](_0x534272));_0x5db628(_0x534272);})[_0xebf4('0x15')](function(_0x3632c9){logger['error'](_0xebf4('0x16'),_0x3632c9['message'],_0x4e83a8);_0x4256a3(_0x5e1b61['error'](0x1f4,_0x3632c9['message']));});});};exports[_0xebf4('0x21')]=function(_0x329804){var _0x4a3b36=this;return new Promise(function(_0x416b66,_0x24f35a){return db['MemberReport'][_0xebf4('0x22')](_0x329804[_0xebf4('0x23')],{'raw':_0x329804[_0xebf4('0x19')]?_0x329804[_0xebf4('0x19')][_0xebf4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1580ea){logger[_0xebf4('0xc')](_0xebf4('0x21'),_0x329804);logger[_0xebf4('0xf')](_0xebf4('0x21'),_0x329804,JSON[_0xebf4('0x11')](_0x1580ea));_0x416b66(_0x1580ea);})[_0xebf4('0x15')](function(_0x1e253d){logger['error'](_0xebf4('0x21'),_0x1e253d[_0xebf4('0x13')],_0x329804);_0x24f35a(_0x4a3b36[_0xebf4('0x12')](0x1f4,_0x1e253d[_0xebf4('0x13')]));});});};exports['UpdateMemberReport']=function(_0x4b2a98){var _0x2e84e1=this;return new Promise(function(_0x8bd741,_0xd982a0){return db['MemberReport']['update'](_0x4b2a98[_0xebf4('0x23')],{'raw':_0x4b2a98[_0xebf4('0x19')]?_0x4b2a98['options'][_0xebf4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2a98['options']?_0x4b2a98[_0xebf4('0x19')][_0xebf4('0x1b')]||null:null,'attributes':_0x4b2a98[_0xebf4('0x19')]?_0x4b2a98['options'][_0xebf4('0x1c')]||null:null,'limit':_0x4b2a98['options']?_0x4b2a98[_0xebf4('0x19')][_0xebf4('0x1d')]||null:null})[_0xebf4('0xb')](function(_0xf6da9a){logger[_0xebf4('0xc')](_0xebf4('0x24'),_0x4b2a98);logger[_0xebf4('0xf')](_0xebf4('0x24'),_0x4b2a98,JSON[_0xebf4('0x11')](_0xf6da9a));_0x8bd741(_0xf6da9a);})['catch'](function(_0x5b8d85){logger[_0xebf4('0x12')](_0xebf4('0x24'),_0x5b8d85[_0xebf4('0x13')],_0x4b2a98);_0xd982a0(_0x2e84e1['error'](0x1f4,_0x5b8d85[_0xebf4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 6626219..97c9b00 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 _0x9f4b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','exports'];(function(_0x53b199,_0x38ff21){var _0x1ba42d=function(_0x35dc53){while(--_0x35dc53){_0x53b199['push'](_0x53b199['shift']());}};_0x1ba42d(++_0x38ff21);}(_0x9f4b,0xfc));var _0xb9f4=function(_0x4b9306,_0x517ef5){_0x4b9306=_0x4b9306-0x0;var _0x3087e1=_0x9f4b[_0x4b9306];return _0x3087e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb9f4('0x0'));var timeout=require(_0xb9f4('0x1'));var express=require(_0xb9f4('0x2'));var router=express[_0xb9f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb9f4('0x4'));var interaction=require(_0xb9f4('0x5'));var config=require(_0xb9f4('0x6'));var controller=require(_0xb9f4('0x7'));router['get']('/',controller['index']);module[_0xb9f4('0x8')]=router; \ No newline at end of file +var _0x2c1b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x18f87a,_0x5ac217){var _0x56276c=function(_0xca6109){while(--_0xca6109){_0x18f87a['push'](_0x18f87a['shift']());}};_0x56276c(++_0x5ac217);}(_0x2c1b,0x186));var _0xb2c1=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x2c1b[_0x1cd47d];return _0x29d52f;};'use strict';var multer=require(_0xb2c1('0x0'));var util=require(_0xb2c1('0x1'));var path=require(_0xb2c1('0x2'));var timeout=require(_0xb2c1('0x3'));var express=require(_0xb2c1('0x4'));var router=express[_0xb2c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb2c1('0x6'));var interaction=require(_0xb2c1('0x7'));var config=require(_0xb2c1('0x8'));var controller=require(_0xb2c1('0x9'));router[_0xb2c1('0xa')]('/',controller['index']);module[_0xb2c1('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 21538f6..381386a 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 _0x2cb8=['version','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2cb8,0x95));var _0x82cb=function(_0x2948f3,_0x580d90){_0x2948f3=_0x2948f3-0x0;var _0x24708f=_0x2cb8[_0x2948f3];return _0x24708f;};'use strict';var Sequelize=require('sequelize');module[_0x82cb('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x82cb('0x1')}}; \ No newline at end of file +var _0x93cd=['STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x93cd,0x165));var _0xd93c=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0x93cd[_0x1fa381];return _0x47eefe;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xd93c('0x0')],'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 30a587b..56e55f4 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 _0xe041=['offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe041,0x17b));var _0x1e04=function(_0x5b80a4,_0x1f2fcd){_0x5b80a4=_0x5b80a4-0x0;var _0x562152=_0xe041[_0x5b80a4];return _0x562152;};'use strict';var emlformat=require(_0x1e04('0x0'));var rimraf=require(_0x1e04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e04('0x2'));var rp=require('request-promise');var moment=require(_0x1e04('0x3'));var BPromise=require(_0x1e04('0x4'));var Mustache=require(_0x1e04('0x5'));var util=require('util');var path=require(_0x1e04('0x6'));var sox=require(_0x1e04('0x7'));var csv=require(_0x1e04('0x8'));var ejs=require(_0x1e04('0x9'));var fs=require('fs');var fs_extra=require(_0x1e04('0xa'));var _=require(_0x1e04('0xb'));var squel=require(_0x1e04('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e04('0x8'));var querystring=require('querystring');var Papa=require(_0x1e04('0xd'));var Redis=require(_0x1e04('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1e04('0xf'));var as=require(_0x1e04('0x10'));var hardwareService=require(_0x1e04('0x11'));var logger=require('../../config/logger')(_0x1e04('0x12'));var utils=require(_0x1e04('0x13'));var config=require(_0x1e04('0x14'));var licenseUtil=require(_0x1e04('0x15'));var db=require(_0x1e04('0x16'))['db'];function respondWithStatusCode(_0x1ff1d3,_0x2d7eb8){_0x2d7eb8=_0x2d7eb8||0xcc;return function(_0x5393c6){if(_0x5393c6){return _0x1ff1d3[_0x1e04('0x17')](_0x2d7eb8);}return _0x1ff1d3[_0x1e04('0x18')](_0x2d7eb8)['end']();};}function respondWithResult(_0x43267f,_0xbb07bb){_0xbb07bb=_0xbb07bb||0xc8;return function(_0x21de04){if(_0x21de04){return _0x43267f['status'](_0xbb07bb)[_0x1e04('0x19')](_0x21de04);}};}function respondWithFilteredResult(_0x47761b,_0x25bd72){return function(_0x3e8a9f){if(_0x3e8a9f){var _0x5e1e0e=typeof _0x25bd72['offset']===_0x1e04('0x1a')&&typeof _0x25bd72[_0x1e04('0x1b')]===_0x1e04('0x1a');var _0x4af7f1=_0x3e8a9f[_0x1e04('0x1c')];var _0x44a002=_0x5e1e0e?0x0:_0x25bd72[_0x1e04('0x1d')];var _0x33f8b7=_0x5e1e0e?_0x3e8a9f[_0x1e04('0x1c')]:_0x25bd72[_0x1e04('0x1d')]+_0x25bd72[_0x1e04('0x1b')];var _0x5340f4;if(_0x33f8b7>=_0x4af7f1){_0x33f8b7=_0x4af7f1;_0x5340f4=0xc8;}else{_0x5340f4=0xce;}_0x47761b[_0x1e04('0x18')](_0x5340f4);return _0x47761b[_0x1e04('0x1e')](_0x1e04('0x1f'),_0x44a002+'-'+_0x33f8b7+'/'+_0x4af7f1)[_0x1e04('0x19')](_0x3e8a9f);}return null;};}function patchUpdates(_0x3625f1){return function(_0x347164){try{jsonpatch[_0x1e04('0x20')](_0x347164,_0x3625f1,!![]);}catch(_0xe13f1e){return BPromise[_0x1e04('0x21')](_0xe13f1e);}return _0x347164[_0x1e04('0x22')]();};}function saveUpdates(_0x2867d2,_0x4c3e0b){return function(_0x1123d2){if(_0x1123d2){return _0x1123d2[_0x1e04('0x23')](_0x2867d2)[_0x1e04('0x24')](function(_0x3a058c){return _0x3a058c;});}return null;};}function removeEntity(_0x3c3a29,_0x3d851e){return function(_0x28d03f){if(_0x28d03f){return _0x28d03f[_0x1e04('0x25')]()[_0x1e04('0x24')](function(){_0x3c3a29[_0x1e04('0x18')](0xcc)[_0x1e04('0x26')]();});}};}function handleEntityNotFound(_0x3bc376,_0x1156c8){return function(_0x432ba6){if(!_0x432ba6){_0x3bc376[_0x1e04('0x17')](0x194);}return _0x432ba6;};}function handleError(_0x51876c,_0x2e9f06){_0x2e9f06=_0x2e9f06||0x1f4;return function(_0x398b8f){logger[_0x1e04('0x27')](_0x398b8f[_0x1e04('0x28')]);if(_0x398b8f[_0x1e04('0x29')]){delete _0x398b8f[_0x1e04('0x29')];}_0x51876c['status'](_0x2e9f06)[_0x1e04('0x2a')](_0x398b8f);};}exports['index']=function(_0x292450,_0x7e0f4b){var _0x346466={},_0x3d396b={},_0x9afd74={'count':0x0,'rows':[]};var _0x540bbe=_[_0x1e04('0x2b')](db[_0x1e04('0x2c')][_0x1e04('0x2d')],function(_0x3c6d44){return{'name':_0x3c6d44[_0x1e04('0x2e')],'type':_0x3c6d44[_0x1e04('0x2f')][_0x1e04('0x30')]};});_0x3d396b[_0x1e04('0x31')]=_['map'](_0x540bbe,_0x1e04('0x29'));_0x3d396b[_0x1e04('0x32')]=_['keys'](_0x292450[_0x1e04('0x32')]);_0x3d396b[_0x1e04('0x33')]=_[_0x1e04('0x34')](_0x3d396b['model'],_0x3d396b[_0x1e04('0x32')]);_0x346466[_0x1e04('0x35')]=_[_0x1e04('0x34')](_0x3d396b[_0x1e04('0x31')],qs[_0x1e04('0x36')](_0x292450[_0x1e04('0x32')][_0x1e04('0x36')]));_0x346466['attributes']=_0x346466[_0x1e04('0x35')][_0x1e04('0x37')]?_0x346466['attributes']:_0x3d396b[_0x1e04('0x31')];if(!_0x292450[_0x1e04('0x32')][_0x1e04('0x38')](_0x1e04('0x39'))){_0x346466['limit']=qs[_0x1e04('0x1b')](_0x292450[_0x1e04('0x32')][_0x1e04('0x1b')]);_0x346466[_0x1e04('0x1d')]=qs[_0x1e04('0x1d')](_0x292450['query'][_0x1e04('0x1d')]);}_0x346466['order']=qs['sort'](_0x292450['query'][_0x1e04('0x3a')]);_0x346466[_0x1e04('0x3b')]=qs[_0x1e04('0x33')](_['pick'](_0x292450[_0x1e04('0x32')],_0x3d396b[_0x1e04('0x33')]),_0x540bbe);if(_0x292450[_0x1e04('0x32')][_0x1e04('0x3c')]){_0x346466[_0x1e04('0x3b')]=_[_0x1e04('0x3d')](_0x346466['where'],{'$or':_[_0x1e04('0x2b')](_0x540bbe,function(_0x1b5c50){if(_0x1b5c50[_0x1e04('0x2f')]!==_0x1e04('0x3e')){var _0x2830fc={};_0x2830fc[_0x1b5c50[_0x1e04('0x29')]]={'$like':'%'+_0x292450['query'][_0x1e04('0x3c')]+'%'};return _0x2830fc;}})});}_0x346466=_[_0x1e04('0x3d')]({},_0x346466,_0x292450[_0x1e04('0x3f')]);var _0x1029ec={'where':_0x346466[_0x1e04('0x3b')]};return db[_0x1e04('0x2c')]['count'](_0x1029ec)[_0x1e04('0x24')](function(_0x552f6d){_0x9afd74[_0x1e04('0x1c')]=_0x552f6d;if(_0x292450['query'][_0x1e04('0x40')]){_0x346466[_0x1e04('0x41')]=[{'all':!![]}];}return db[_0x1e04('0x2c')][_0x1e04('0x42')](_0x346466);})[_0x1e04('0x24')](function(_0x473459){_0x9afd74[_0x1e04('0x43')]=_0x473459;return _0x9afd74;})[_0x1e04('0x24')](respondWithFilteredResult(_0x7e0f4b,_0x346466))['catch'](handleError(_0x7e0f4b,null));}; \ No newline at end of file +var _0x9cbb=['to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x388c1c,_0x45ac57){var _0x2dada8=function(_0x2ab137){while(--_0x2ab137){_0x388c1c['push'](_0x388c1c['shift']());}};_0x2dada8(++_0x45ac57);}(_0x9cbb,0xf6));var _0xb9cb=function(_0x22ca59,_0x33db1f){_0x22ca59=_0x22ca59-0x0;var _0x4c875d=_0x9cbb[_0x22ca59];return _0x4c875d;};'use strict';var emlformat=require(_0xb9cb('0x0'));var rimraf=require(_0xb9cb('0x1'));var zipdir=require(_0xb9cb('0x2'));var jsonpatch=require(_0xb9cb('0x3'));var rp=require(_0xb9cb('0x4'));var moment=require('moment');var BPromise=require(_0xb9cb('0x5'));var Mustache=require(_0xb9cb('0x6'));var util=require(_0xb9cb('0x7'));var path=require(_0xb9cb('0x8'));var sox=require(_0xb9cb('0x9'));var csv=require(_0xb9cb('0xa'));var ejs=require(_0xb9cb('0xb'));var fs=require('fs');var fs_extra=require(_0xb9cb('0xc'));var _=require(_0xb9cb('0xd'));var squel=require('squel');var crypto=require(_0xb9cb('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb9cb('0xa'));var querystring=require(_0xb9cb('0xf'));var Papa=require(_0xb9cb('0x10'));var Redis=require('ioredis');var authService=require(_0xb9cb('0x11'));var qs=require(_0xb9cb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb9cb('0x13'));var config=require(_0xb9cb('0x14'));var licenseUtil=require(_0xb9cb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305111,_0x5e4cdd){_0x5e4cdd=_0x5e4cdd||0xcc;return function(_0x231584){if(_0x231584){return _0x305111[_0xb9cb('0x16')](_0x5e4cdd);}return _0x305111['status'](_0x5e4cdd)[_0xb9cb('0x17')]();};}function respondWithResult(_0x3c97fa,_0x572864){_0x572864=_0x572864||0xc8;return function(_0x1aabd7){if(_0x1aabd7){return _0x3c97fa[_0xb9cb('0x18')](_0x572864)[_0xb9cb('0x19')](_0x1aabd7);}};}function respondWithFilteredResult(_0x1939b6,_0x145232){return function(_0x5a3d04){if(_0x5a3d04){var _0x243b50=typeof _0x145232[_0xb9cb('0x1a')]==='undefined'&&typeof _0x145232[_0xb9cb('0x1b')]===_0xb9cb('0x1c');var _0x547a16=_0x5a3d04['count'];var _0x1307ec=_0x243b50?0x0:_0x145232[_0xb9cb('0x1a')];var _0x33e957=_0x243b50?_0x5a3d04[_0xb9cb('0x1d')]:_0x145232['offset']+_0x145232[_0xb9cb('0x1b')];var _0x4bffe1;if(_0x33e957>=_0x547a16){_0x33e957=_0x547a16;_0x4bffe1=0xc8;}else{_0x4bffe1=0xce;}_0x1939b6[_0xb9cb('0x18')](_0x4bffe1);return _0x1939b6['set'](_0xb9cb('0x1e'),_0x1307ec+'-'+_0x33e957+'/'+_0x547a16)[_0xb9cb('0x19')](_0x5a3d04);}return null;};}function patchUpdates(_0x21df48){return function(_0x5294cb){try{jsonpatch['apply'](_0x5294cb,_0x21df48,!![]);}catch(_0x700aa6){return BPromise[_0xb9cb('0x1f')](_0x700aa6);}return _0x5294cb['save']();};}function saveUpdates(_0x1c3363,_0x5e0905){return function(_0x16cd39){if(_0x16cd39){return _0x16cd39[_0xb9cb('0x20')](_0x1c3363)[_0xb9cb('0x21')](function(_0x427523){return _0x427523;});}return null;};}function removeEntity(_0xa14a52,_0x260dce){return function(_0x26989b){if(_0x26989b){return _0x26989b['destroy']()[_0xb9cb('0x21')](function(){_0xa14a52[_0xb9cb('0x18')](0xcc)[_0xb9cb('0x17')]();});}};}function handleEntityNotFound(_0x6e199,_0x5a1e13){return function(_0x112b64){if(!_0x112b64){_0x6e199[_0xb9cb('0x16')](0x194);}return _0x112b64;};}function handleError(_0x321b1d,_0x230228){_0x230228=_0x230228||0x1f4;return function(_0x21f3eb){logger[_0xb9cb('0x22')](_0x21f3eb[_0xb9cb('0x23')]);if(_0x21f3eb[_0xb9cb('0x24')]){delete _0x21f3eb['name'];}_0x321b1d[_0xb9cb('0x18')](_0x230228)[_0xb9cb('0x25')](_0x21f3eb);};}exports[_0xb9cb('0x26')]=function(_0x482f9b,_0x2442ac){var _0x5b0f3e={},_0x404513={},_0x9e14d3={'count':0x0,'rows':[]};var _0x11bdff=_[_0xb9cb('0x27')](db[_0xb9cb('0x28')][_0xb9cb('0x29')],function(_0x261d03){return{'name':_0x261d03[_0xb9cb('0x2a')],'type':_0x261d03[_0xb9cb('0x2b')][_0xb9cb('0x2c')]};});_0x404513['model']=_[_0xb9cb('0x27')](_0x11bdff,_0xb9cb('0x24'));_0x404513[_0xb9cb('0x2d')]=_['keys'](_0x482f9b[_0xb9cb('0x2d')]);_0x404513[_0xb9cb('0x2e')]=_['intersection'](_0x404513['model'],_0x404513['query']);_0x5b0f3e[_0xb9cb('0x2f')]=_[_0xb9cb('0x30')](_0x404513[_0xb9cb('0x31')],qs[_0xb9cb('0x32')](_0x482f9b[_0xb9cb('0x2d')][_0xb9cb('0x32')]));_0x5b0f3e['attributes']=_0x5b0f3e[_0xb9cb('0x2f')][_0xb9cb('0x33')]?_0x5b0f3e['attributes']:_0x404513['model'];if(!_0x482f9b[_0xb9cb('0x2d')][_0xb9cb('0x34')](_0xb9cb('0x35'))){_0x5b0f3e[_0xb9cb('0x1b')]=qs[_0xb9cb('0x1b')](_0x482f9b[_0xb9cb('0x2d')]['limit']);_0x5b0f3e[_0xb9cb('0x1a')]=qs['offset'](_0x482f9b[_0xb9cb('0x2d')][_0xb9cb('0x1a')]);}_0x5b0f3e[_0xb9cb('0x36')]=qs[_0xb9cb('0x37')](_0x482f9b[_0xb9cb('0x2d')][_0xb9cb('0x37')]);_0x5b0f3e[_0xb9cb('0x38')]=qs[_0xb9cb('0x2e')](_[_0xb9cb('0x39')](_0x482f9b[_0xb9cb('0x2d')],_0x404513[_0xb9cb('0x2e')]),_0x11bdff);if(_0x482f9b['query']['filter']){_0x5b0f3e[_0xb9cb('0x38')]=_[_0xb9cb('0x3a')](_0x5b0f3e['where'],{'$or':_['map'](_0x11bdff,function(_0x43d127){if(_0x43d127[_0xb9cb('0x2b')]!=='VIRTUAL'){var _0x5df092={};_0x5df092[_0x43d127[_0xb9cb('0x24')]]={'$like':'%'+_0x482f9b[_0xb9cb('0x2d')][_0xb9cb('0x3b')]+'%'};return _0x5df092;}})});}_0x5b0f3e=_[_0xb9cb('0x3a')]({},_0x5b0f3e,_0x482f9b[_0xb9cb('0x3c')]);var _0x435015={'where':_0x5b0f3e[_0xb9cb('0x38')]};return db[_0xb9cb('0x28')][_0xb9cb('0x1d')](_0x435015)[_0xb9cb('0x21')](function(_0x4f5cd3){_0x9e14d3[_0xb9cb('0x1d')]=_0x4f5cd3;if(_0x482f9b[_0xb9cb('0x2d')][_0xb9cb('0x3d')]){_0x5b0f3e[_0xb9cb('0x3e')]=[{'all':!![]}];}return db[_0xb9cb('0x28')][_0xb9cb('0x3f')](_0x5b0f3e);})[_0xb9cb('0x21')](function(_0x347ed3){_0x9e14d3['rows']=_0x347ed3;return _0x9e14d3;})['then'](respondWithFilteredResult(_0x2442ac,_0x5b0f3e))['catch'](handleError(_0x2442ac,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 40c8d15..bfa0d7b 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 _0xda5d=['lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xda5d,0xaa));var _0xdda5=function(_0x2d1678,_0x48d87b){_0x2d1678=_0x2d1678-0x0;var _0x238c77=_0xda5d[_0x2d1678];return _0x238c77;};'use strict';var _=require(_0xdda5('0x0'));var util=require('util');var logger=require(_0xdda5('0x1'))('api');var moment=require(_0xdda5('0x2'));var BPromise=require(_0xdda5('0x3'));var rp=require(_0xdda5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda5('0x5'));var attributes=require(_0xdda5('0x6'));module[_0xdda5('0x7')]=function(_0x27457b,_0x5ebd15){return _0x27457b[_0xdda5('0x8')](_0xdda5('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c9e=['./migration.attributes','define','Migration','migrations','lodash','moment','request-promise','path','rimraf'];(function(_0x1587e1,_0x44f543){var _0x333dbd=function(_0x3780a7){while(--_0x3780a7){_0x1587e1['push'](_0x1587e1['shift']());}};_0x333dbd(++_0x44f543);}(_0x1c9e,0xd3));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe1c9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe1c9('0x1'));var BPromise=require('bluebird');var rp=require(_0xe1c9('0x2'));var fs=require('fs');var path=require(_0xe1c9('0x3'));var rimraf=require(_0xe1c9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe1c9('0x5'));module['exports']=function(_0x2291ed,_0x56b02f){return _0x2291ed[_0xe1c9('0x6')](_0xe1c9('0x7'),attributes,{'tableName':_0xe1c9('0x8'),'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 270d9aa..1afd3be 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 _0xc17f=['Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x3941c7,_0x37b4d3){var _0x526098=function(_0x5bc288){while(--_0x5bc288){_0x3941c7['push'](_0x3941c7['shift']());}};_0x526098(++_0x37b4d3);}(_0xc17f,0xb8));var _0xfc17=function(_0x4ad323,_0x40e25e){_0x4ad323=_0x4ad323-0x0;var _0xe4b67d=_0xc17f[_0x4ad323];return _0xe4b67d;};'use strict';var _=require(_0xfc17('0x0'));var util=require(_0xfc17('0x1'));var moment=require(_0xfc17('0x2'));var BPromise=require(_0xfc17('0x3'));var rs=require(_0xfc17('0x4'));var fs=require('fs');var Redis=require(_0xfc17('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc17('0x6'));var logger=require(_0xfc17('0x7'))(_0xfc17('0x8'));var config=require(_0xfc17('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfc17('0xa')][_0xfc17('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21c2ef,_0x11fa33,_0x404ee0){return new BPromise(function(_0x3cd590,_0x149054){return client[_0xfc17('0xc')](_0x21c2ef,_0x404ee0)['then'](function(_0x33bd35){logger[_0xfc17('0xd')](_0xfc17('0xe'),_0x11fa33,_0xfc17('0xf'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x11fa33,_0xfc17('0xf'),JSON[_0xfc17('0x10')](_0x33bd35));if(_0x33bd35[_0xfc17('0x11')]){if(_0x33bd35[_0xfc17('0x11')][_0xfc17('0x12')]===0x1f4){logger[_0xfc17('0x11')](_0xfc17('0xe'),_0x11fa33,_0x33bd35[_0xfc17('0x11')][_0xfc17('0x13')]);return _0x149054(_0x33bd35[_0xfc17('0x11')]['message']);}logger[_0xfc17('0x11')](_0xfc17('0xe'),_0x11fa33,_0x33bd35[_0xfc17('0x11')]['message']);return _0x3cd590(_0x33bd35[_0xfc17('0x11')][_0xfc17('0x13')]);}else{logger[_0xfc17('0xd')](_0xfc17('0xe'),_0x11fa33,_0xfc17('0xf'));_0x3cd590(_0x33bd35[_0xfc17('0x14')][_0xfc17('0x13')]);}})[_0xfc17('0x15')](function(_0x35f947){logger[_0xfc17('0x11')](_0xfc17('0xe'),_0x11fa33,_0x35f947);_0x149054(_0x35f947);});});} \ No newline at end of file +var _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x41c66d,_0x512755){var _0x4b3302=function(_0x5e6307){while(--_0x5e6307){_0x41c66d['push'](_0x41c66d['shift']());}};_0x4b3302(++_0x512755);}(_0x702d,0x147));var _0xd702=function(_0x376cd9,_0x46d50f){_0x376cd9=_0x376cd9-0x0;var _0x111f08=_0x702d[_0x376cd9];return _0x111f08;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 622c816..d3d276b 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 _0xc82c=['post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show'];(function(_0x33d813,_0x487090){var _0x50dace=function(_0x309886){while(--_0x309886){_0x33d813['push'](_0x33d813['shift']());}};_0x50dace(++_0x487090);}(_0xc82c,0x125));var _0xcc82=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc82c[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xcc82('0x0'));var util=require(_0xcc82('0x1'));var path=require('path');var timeout=require(_0xcc82('0x2'));var express=require(_0xcc82('0x3'));var router=express[_0xcc82('0x4')]();var fs_extra=require(_0xcc82('0x5'));var auth=require(_0xcc82('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router[_0xcc82('0x7')]('/',auth[_0xcc82('0x8')](),controller['index']);router['get'](_0xcc82('0x9'),auth['isAuthenticated'](),controller[_0xcc82('0xa')]);router[_0xcc82('0xb')]('/',auth[_0xcc82('0x8')](),controller['create']);router[_0xcc82('0xc')](_0xcc82('0x9'),auth[_0xcc82('0x8')](),controller[_0xcc82('0xd')]);router[_0xcc82('0xe')](_0xcc82('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc82('0xf')]=router; \ No newline at end of file +var _0xb44a=['destroy','exports','path','express','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x407118,_0x42fd8a){var _0x4f38b3=function(_0x1a591f){while(--_0x1a591f){_0x407118['push'](_0x407118['shift']());}};_0x4f38b3(++_0x42fd8a);}(_0xb44a,0x1c2));var _0xab44=function(_0x18a81a,_0x4fc65b){_0x18a81a=_0x18a81a-0x0;var _0x114027=_0xb44a[_0x18a81a];return _0x114027;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab44('0x0'));var timeout=require('connect-timeout');var express=require(_0xab44('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xab44('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xab44('0x3'));var controller=require(_0xab44('0x4'));router[_0xab44('0x5')]('/',auth[_0xab44('0x6')](),controller[_0xab44('0x7')]);router[_0xab44('0x5')](_0xab44('0x8'),auth[_0xab44('0x6')](),controller[_0xab44('0x9')]);router[_0xab44('0xa')]('/',auth[_0xab44('0x6')](),controller[_0xab44('0xb')]);router[_0xab44('0xc')]('/:id',auth[_0xab44('0x6')](),controller['update']);router[_0xab44('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xab44('0xe')]);module[_0xab44('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 32dd3c7..a2deb76 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 _0x4fe9=['sequelize','exports','ENUM','localnet','externip','STRING'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x4fe9,0xba));var _0x94fe=function(_0x18562f,_0x41ad01){_0x18562f=_0x18562f-0x0;var _0x5e64e7=_0x4fe9[_0x18562f];return _0x5e64e7;};'use strict';var Sequelize=require(_0x94fe('0x0'));module[_0x94fe('0x1')]={'type':{'type':Sequelize[_0x94fe('0x2')](_0x94fe('0x3'),_0x94fe('0x4'),'stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x94fe('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x60e6=['exports','ENUM','localnet','externip','STRING','sequelize'];(function(_0x836bb4,_0x565f4b){var _0x4f5a56=function(_0x183a19){while(--_0x183a19){_0x836bb4['push'](_0x836bb4['shift']());}};_0x4f5a56(++_0x565f4b);}(_0x60e6,0x1d9));var _0x660e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x60e6[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x660e('0x0'));module[_0x660e('0x1')]={'type':{'type':Sequelize[_0x660e('0x2')](_0x660e('0x3'),_0x660e('0x4'),'stun','turn')},'value':{'type':Sequelize[_0x660e('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b6741bd..63c1450 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 _0x99f3=['readFileSync','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','TURN','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','body','chan_sip.so','res_stun_monitor.so','toLowerCase','params','util','lodash','../../mysqldb','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','json','offset','undefined','limit','count','set','Content-Range','update','destroy','status','end','sendStatus','stack','name','send','index','Network','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','toUpperCase','STUN'];(function(_0x292146,_0x365624){var _0x255f39=function(_0x4aacd1){while(--_0x4aacd1){_0x292146['push'](_0x292146['shift']());}};_0x255f39(++_0x365624);}(_0x99f3,0x68));var _0x399f=function(_0x2716c6,_0x38dd17){_0x2716c6=_0x2716c6-0x0;var _0x518dc2=_0x99f3[_0x2716c6];return _0x518dc2;};'use strict';var util=require(_0x399f('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x399f('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x399f('0x2'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x399f('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x267ea3,_0x480108,_0x3b654c,_0x15d6ca){return new Promise(function(_0xa88b35,_0x272504){var _0x180090=_0x15d6ca||client;return _0x180090[_0x399f('0x4')](_0x267ea3,_0x3b654c)[_0x399f('0x5')](function(_0x482bc6){logger[_0x399f('0x6')](_0x399f('0x7'),_0x480108,_0x399f('0x8'));logger['debug'](_0x399f('0x9'),_0x480108,_0x399f('0x8'),JSON[_0x399f('0xa')](_0x482bc6));if(_0x482bc6[_0x399f('0xb')]){if(_0x482bc6[_0x399f('0xb')][_0x399f('0xc')]===0x1f4){logger[_0x399f('0xb')](_0x399f('0x7'),_0x480108,_0x482bc6[_0x399f('0xb')][_0x399f('0xd')]);return _0x272504(_0x482bc6[_0x399f('0xb')][_0x399f('0xd')]);}logger['error'](_0x399f('0x7'),_0x480108,_0x482bc6[_0x399f('0xb')][_0x399f('0xd')]);return _0xa88b35(_0x482bc6[_0x399f('0xb')][_0x399f('0xd')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x480108,_0x399f('0x8'));_0xa88b35(_0x482bc6[_0x399f('0xe')][_0x399f('0xd')]);}})['catch'](function(_0x3f986e){logger[_0x399f('0xb')]('Network,\x20%s,\x20%s',_0x480108,_0x3f986e);_0x272504(_0x3f986e);});});}function respondWithResult(_0x84568a,_0x142250){_0x142250=_0x142250||0xc8;return function(_0x509e16){if(_0x509e16){return _0x84568a['status'](_0x142250)[_0x399f('0xf')](_0x509e16);}};}function respondWithFilteredResult(_0x286ab2,_0x551626){return function(_0x1253aa){if(_0x1253aa){var _0x1887aa=typeof _0x551626[_0x399f('0x10')]===_0x399f('0x11')&&typeof _0x551626[_0x399f('0x12')]==='undefined';var _0x56080=_0x1253aa[_0x399f('0x13')];var _0x29bff2=_0x1887aa?0x0:_0x551626[_0x399f('0x10')];var _0x455fe1=_0x1887aa?_0x1253aa['count']:_0x551626[_0x399f('0x10')]+_0x551626['limit'];var _0x5d4ecb;if(_0x455fe1>=_0x56080){_0x455fe1=_0x56080;_0x5d4ecb=0xc8;}else{_0x5d4ecb=0xce;}_0x286ab2['status'](_0x5d4ecb);return _0x286ab2[_0x399f('0x14')](_0x399f('0x15'),_0x29bff2+'-'+_0x455fe1+'/'+_0x56080)[_0x399f('0xf')](_0x1253aa);}return null;};}function saveUpdates(_0xc34993){return function(_0x35c310){if(_0x35c310){return _0x35c310[_0x399f('0x16')](_0xc34993)[_0x399f('0x5')](function(_0x5741b8){return _0x5741b8;});}return null;};}function removeEntity(_0x346b3c){return function(_0x2624d9){if(_0x2624d9){return _0x2624d9[_0x399f('0x17')]()[_0x399f('0x5')](function(){_0x346b3c[_0x399f('0x18')](0xcc)[_0x399f('0x19')]();});}};}function handleEntityNotFound(_0x4e29c4){return function(_0x5a18d7){if(!_0x5a18d7){_0x4e29c4[_0x399f('0x1a')](0x194);}return _0x5a18d7;};}function handleError(_0x1bc6d8,_0x1e3321){_0x1e3321=_0x1e3321||0x1f4;return function(_0x3a0bfa){logger['error'](_0x3a0bfa[_0x399f('0x1b')]);if(_0x3a0bfa[_0x399f('0x1c')]){delete _0x3a0bfa['name'];}_0x1bc6d8['status'](_0x1e3321)[_0x399f('0x1d')](_0x3a0bfa);};}exports[_0x399f('0x1e')]=function(_0x1f0eaa,_0x26f648){var _0xde747f={},_0x37f5ec={},_0x20cfee={'count':0x0,'rows':[]};var _0x1332ff=_['map'](db[_0x399f('0x1f')][_0x399f('0x20')],function(_0x1d65d7){return{'name':_0x1d65d7[_0x399f('0x21')],'type':_0x1d65d7[_0x399f('0x22')][_0x399f('0x23')]};});_0x37f5ec[_0x399f('0x24')]=_['map'](_0x1332ff,_0x399f('0x1c'));_0x37f5ec['query']=_[_0x399f('0x25')](_0x1f0eaa['query']);_0x37f5ec['filters']=_['intersection'](_0x37f5ec[_0x399f('0x24')],_0x37f5ec[_0x399f('0x26')]);_0xde747f['attributes']=_[_0x399f('0x27')](_0x37f5ec[_0x399f('0x24')],qs['fields'](_0x1f0eaa[_0x399f('0x26')][_0x399f('0x28')]));_0xde747f[_0x399f('0x29')]=_0xde747f[_0x399f('0x29')]['length']?_0xde747f[_0x399f('0x29')]:_0x37f5ec[_0x399f('0x24')];if(!_0x1f0eaa[_0x399f('0x26')][_0x399f('0x2a')]('nolimit')){_0xde747f[_0x399f('0x12')]=qs['limit'](_0x1f0eaa[_0x399f('0x26')][_0x399f('0x12')]);_0xde747f[_0x399f('0x10')]=qs[_0x399f('0x10')](_0x1f0eaa[_0x399f('0x26')][_0x399f('0x10')]);}_0xde747f[_0x399f('0x2b')]=qs[_0x399f('0x2c')](_0x1f0eaa['query'][_0x399f('0x2c')]);_0xde747f[_0x399f('0x2d')]=qs['filters'](_[_0x399f('0x2e')](_0x1f0eaa[_0x399f('0x26')],_0x37f5ec[_0x399f('0x2f')]),_0x1332ff);if(_0x1f0eaa[_0x399f('0x26')][_0x399f('0x30')]){_0xde747f[_0x399f('0x2d')]=_[_0x399f('0x31')](_0xde747f[_0x399f('0x2d')],{'$or':_[_0x399f('0x32')](_0x1332ff,function(_0x448304){if(_0x448304[_0x399f('0x22')]!==_0x399f('0x33')){var _0x98479={};_0x98479[_0x448304[_0x399f('0x1c')]]={'$like':'%'+_0x1f0eaa['query'][_0x399f('0x30')]+'%'};return _0x98479;}})});}_0xde747f=_[_0x399f('0x31')]({},_0xde747f,_0x1f0eaa['options']);var _0x1ffd4b={'where':_0xde747f[_0x399f('0x2d')]};return db[_0x399f('0x1f')][_0x399f('0x13')](_0x1ffd4b)[_0x399f('0x5')](function(_0xd1e9e6){_0x20cfee[_0x399f('0x13')]=_0xd1e9e6;if(_0x1f0eaa[_0x399f('0x26')][_0x399f('0x34')]){_0xde747f[_0x399f('0x35')]=[{'all':!![]}];}return db[_0x399f('0x1f')][_0x399f('0x36')](_0xde747f);})[_0x399f('0x5')](function(_0x3ada75){_0x20cfee[_0x399f('0x37')]=_0x3ada75;return _0x20cfee;})[_0x399f('0x5')](respondWithFilteredResult(_0x26f648,_0xde747f))[_0x399f('0x38')](handleError(_0x26f648,null));};exports[_0x399f('0x39')]=function(_0x107c6e,_0x4c8407){var _0x509261={'raw':!![],'where':{'id':_0x107c6e['params']['id']}},_0x41977c={};_0x41977c[_0x399f('0x24')]=_['keys'](db[_0x399f('0x1f')]['rawAttributes']);_0x41977c['query']=_[_0x399f('0x25')](_0x107c6e[_0x399f('0x26')]);_0x41977c[_0x399f('0x2f')]=_[_0x399f('0x27')](_0x41977c[_0x399f('0x24')],_0x41977c[_0x399f('0x26')]);_0x509261[_0x399f('0x29')]=_[_0x399f('0x27')](_0x41977c[_0x399f('0x24')],qs[_0x399f('0x28')](_0x107c6e['query'][_0x399f('0x28')]));_0x509261[_0x399f('0x29')]=_0x509261['attributes'][_0x399f('0x3a')]?_0x509261[_0x399f('0x29')]:_0x41977c[_0x399f('0x24')];if(_0x107c6e[_0x399f('0x26')]['includeAll']){_0x509261[_0x399f('0x35')]=[{'all':!![]}];}_0x509261=_[_0x399f('0x31')]({},_0x509261,_0x107c6e[_0x399f('0x3b')]);return db[_0x399f('0x1f')][_0x399f('0x3c')](_0x509261)[_0x399f('0x5')](handleEntityNotFound(_0x4c8407,null))['then'](respondWithResult(_0x4c8407,null))[_0x399f('0x38')](handleError(_0x4c8407,null));};exports['create']=function(_0x599e6e,_0x419b4c){var _0xfbb9c2;return db[_0x399f('0x1f')][_0x399f('0x3d')](_0x599e6e['body'],{'raw':!![]})['then'](function(_0x2cd5c0){_0xfbb9c2=_0x2cd5c0;return db[_0x399f('0x1f')][_0x399f('0x36')]({'where':{'type':_0x599e6e['body'][_0x399f('0x22')]},'raw':!![]});})[_0x399f('0x5')](function(_0x20b144){if(_0xfbb9c2['type'][_0x399f('0x3e')]()==_0x399f('0x3f')){var _0x372653=fs[_0x399f('0x40')](path['join'](config['root'],_0x399f('0x41')),_0x399f('0x42'));var _0x224cbd=ejs['render'](_0x372653,{'networks':_0x20b144||[]});fs['writeFileSync'](_0x399f('0x43'),_0x224cbd);return respondWithRpcPromise(_0x399f('0x44'),_0x399f('0x3d'),{'module':'res_stun_monitor.so'});}else if(_0xfbb9c2[_0x399f('0x22')][_0x399f('0x3e')]()==_0x399f('0x45')){var _0x5c8c80=fs['readFileSync'](path['join'](config[_0x399f('0x46')],_0x399f('0x47')),_0x399f('0x42'));var _0x26726d=ejs['render'](_0x5c8c80,{'networks':_0x20b144||[]});fs[_0x399f('0x48')](_0x399f('0x49'),_0x26726d);return respondWithRpcPromise(_0x399f('0x44'),_0x399f('0x3d'),{'module':'res_stun_monitor.so'});}else{var _0x5e5403=fs[_0x399f('0x40')](path[_0x399f('0x4a')](config[_0x399f('0x46')],_0x399f('0x4b')),_0x399f('0x42'));var _0x60d847=ejs[_0x399f('0x4c')](_0x5e5403,{'networks':_0x20b144||[]});fs[_0x399f('0x48')](util[_0x399f('0x4d')](_0x399f('0x4e'),_0x599e6e[_0x399f('0x4f')][_0x399f('0x22')]['toLowerCase']()),_0x60d847);return respondWithRpcPromise(_0x399f('0x44'),_0x399f('0x3d'),{'module':_0x399f('0x50')});}})[_0x399f('0x5')](function(){return _0xfbb9c2;})[_0x399f('0x5')](respondWithResult(_0x419b4c,0xc9))[_0x399f('0x38')](handleError(_0x419b4c,null));};exports[_0x399f('0x16')]=function(_0xd1d36d,_0x273c53){var _0x52ff01;return db[_0x399f('0x1f')][_0x399f('0x3c')]({'where':{'id':_0xd1d36d['params']['id']}})[_0x399f('0x5')](handleEntityNotFound(_0x273c53,null))[_0x399f('0x5')](saveUpdates(_0xd1d36d[_0x399f('0x4f')],null))[_0x399f('0x5')](function(_0xc975cb){if(_0xc975cb){_0x52ff01=_0xc975cb;return db[_0x399f('0x1f')][_0x399f('0x36')]({'where':{'type':_0x52ff01['type']},'raw':!![]});}return null;})[_0x399f('0x5')](function(_0x1c6376){if(_0x52ff01[_0x399f('0x22')][_0x399f('0x3e')]()==_0x399f('0x3f')){var _0x4fdf34=fs['readFileSync'](path[_0x399f('0x4a')](config[_0x399f('0x46')],_0x399f('0x41')),'utf8');var _0x17595f=ejs['render'](_0x4fdf34,{'networks':_0x1c6376||[]});fs[_0x399f('0x48')](_0x399f('0x43'),_0x17595f);return respondWithRpcPromise(_0x399f('0x44'),_0x399f('0x16'),{'module':_0x399f('0x51')});}else if(_0x52ff01[_0x399f('0x22')][_0x399f('0x3e')]()==_0x399f('0x45')){var _0x141e88=fs[_0x399f('0x40')](path[_0x399f('0x4a')](config[_0x399f('0x46')],_0x399f('0x47')),_0x399f('0x42'));var _0x8a35a8=ejs[_0x399f('0x4c')](_0x141e88,{'networks':_0x1c6376||[]});fs[_0x399f('0x48')](_0x399f('0x49'),_0x8a35a8);return respondWithRpcPromise(_0x399f('0x44'),_0x399f('0x16'),{'module':'res_stun_monitor.so'});}else{var _0x35886c=fs[_0x399f('0x40')](path[_0x399f('0x4a')](config[_0x399f('0x46')],_0x399f('0x4b')),_0x399f('0x42'));var _0xaa8dda=ejs['render'](_0x35886c,{'networks':_0x1c6376||[]});fs[_0x399f('0x48')](util[_0x399f('0x4d')](_0x399f('0x4e'),_0xd1d36d[_0x399f('0x4f')][_0x399f('0x22')][_0x399f('0x52')]()),_0xaa8dda);return respondWithRpcPromise('Reload',_0x399f('0x16'),{'module':_0x399f('0x50')});}})['then'](function(_0x27ee3d){if(_0x27ee3d){return _0x52ff01;}return null;})['then'](respondWithResult(_0x273c53,null))['catch'](handleError(_0x273c53,null));};exports[_0x399f('0x17')]=function(_0x50417d,_0x483fea){var _0x3723f7;return db[_0x399f('0x1f')][_0x399f('0x3c')]({'where':{'id':_0x50417d[_0x399f('0x53')]['id']}})[_0x399f('0x5')](function(_0x3a4909){_0x3723f7=_0x3a4909;return _0x3a4909;})['then'](handleEntityNotFound(_0x483fea,null))['then'](removeEntity(_0x483fea,null))['then'](function(){if(_0x3723f7){return db[_0x399f('0x1f')][_0x399f('0x36')]({'where':{'type':_0x3723f7[_0x399f('0x22')]},'raw':!![]});}})['then'](function(_0x23c49f){if(_0x3723f7[_0x399f('0x22')][_0x399f('0x3e')]()=='STUN'){var _0x362f40=fs[_0x399f('0x40')](path[_0x399f('0x4a')](config[_0x399f('0x46')],'server/files/templates/stun_multiple.ejs'),_0x399f('0x42'));var _0x3a2218=ejs['render'](_0x362f40,{'networks':_0x23c49f||[]});fs['writeFileSync'](_0x399f('0x43'),_0x3a2218);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else if(_0x3723f7['type']['toUpperCase']()==_0x399f('0x45')){var _0x318ae3=fs['readFileSync'](path[_0x399f('0x4a')](config['root'],_0x399f('0x47')),'utf8');var _0x44684c=ejs[_0x399f('0x4c')](_0x318ae3,{'networks':_0x23c49f||[]});fs[_0x399f('0x48')](_0x399f('0x49'),_0x44684c);return respondWithRpcPromise(_0x399f('0x44'),_0x399f('0x17'),{'module':_0x399f('0x51')});}else{var _0x5e1a2a=fs[_0x399f('0x40')](path['join'](config[_0x399f('0x46')],_0x399f('0x4b')),'utf8');var _0x54aa81=ejs['render'](_0x5e1a2a,{'networks':_0x23c49f||[]});fs[_0x399f('0x48')](util[_0x399f('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x3723f7['type'][_0x399f('0x52')]()),_0x54aa81);return respondWithRpcPromise(_0x399f('0x44'),_0x399f('0x17'),{'module':_0x399f('0x50')});}})['catch'](handleError(_0x483fea,null));}; \ No newline at end of file +var _0x3585=['STUN','/etc/asterisk/stun_xcally.conf','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','find','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so'];(function(_0x1d8c2f,_0x19fb62){var _0x4af6a6=function(_0x1564d5){while(--_0x1564d5){_0x1d8c2f['push'](_0x1d8c2f['shift']());}};_0x4af6a6(++_0x19fb62);}(_0x3585,0x1ab));var _0x5358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3585[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x5358('0x0'));var fs=require('fs');var _=require(_0x5358('0x1'));var qs=require(_0x5358('0x2'));var logger=require(_0x5358('0x3'))('api');var config=require(_0x5358('0x4'));var db=require(_0x5358('0x5'))['db'];var jayson=require(_0x5358('0x6'));var client=jayson[_0x5358('0x7')][_0x5358('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x156613,_0x5a9d29,_0x2037ff,_0x39cfd3){return new Promise(function(_0x30130b,_0x16df43){var _0xa01e2a=_0x39cfd3||client;return _0xa01e2a[_0x5358('0x9')](_0x156613,_0x2037ff)[_0x5358('0xa')](function(_0x4e107b){logger[_0x5358('0xb')]('Network,\x20%s,\x20%s',_0x5a9d29,_0x5358('0xc'));logger[_0x5358('0xd')](_0x5358('0xe'),_0x5a9d29,_0x5358('0xc'),JSON[_0x5358('0xf')](_0x4e107b));if(_0x4e107b['error']){if(_0x4e107b['error']['code']===0x1f4){logger[_0x5358('0x10')](_0x5358('0x11'),_0x5a9d29,_0x4e107b[_0x5358('0x10')]['message']);return _0x16df43(_0x4e107b[_0x5358('0x10')][_0x5358('0x12')]);}logger['error'](_0x5358('0x11'),_0x5a9d29,_0x4e107b[_0x5358('0x10')][_0x5358('0x12')]);return _0x30130b(_0x4e107b[_0x5358('0x10')][_0x5358('0x12')]);}else{logger['info'](_0x5358('0x11'),_0x5a9d29,_0x5358('0xc'));_0x30130b(_0x4e107b[_0x5358('0x13')][_0x5358('0x12')]);}})[_0x5358('0x14')](function(_0x222c2e){logger['error']('Network,\x20%s,\x20%s',_0x5a9d29,_0x222c2e);_0x16df43(_0x222c2e);});});}function respondWithResult(_0xf8d20,_0x20ac0a){_0x20ac0a=_0x20ac0a||0xc8;return function(_0x380b61){if(_0x380b61){return _0xf8d20[_0x5358('0x15')](_0x20ac0a)[_0x5358('0x16')](_0x380b61);}};}function respondWithFilteredResult(_0x3def36,_0x3d0889){return function(_0x1d66b0){if(_0x1d66b0){var _0x2be999=typeof _0x3d0889[_0x5358('0x17')]==='undefined'&&typeof _0x3d0889['limit']===_0x5358('0x18');var _0x3f55e8=_0x1d66b0[_0x5358('0x19')];var _0x268dbb=_0x2be999?0x0:_0x3d0889[_0x5358('0x17')];var _0xcc900f=_0x2be999?_0x1d66b0[_0x5358('0x19')]:_0x3d0889[_0x5358('0x17')]+_0x3d0889['limit'];var _0x279205;if(_0xcc900f>=_0x3f55e8){_0xcc900f=_0x3f55e8;_0x279205=0xc8;}else{_0x279205=0xce;}_0x3def36[_0x5358('0x15')](_0x279205);return _0x3def36['set'](_0x5358('0x1a'),_0x268dbb+'-'+_0xcc900f+'/'+_0x3f55e8)[_0x5358('0x16')](_0x1d66b0);}return null;};}function saveUpdates(_0xccf30b){return function(_0x2609ae){if(_0x2609ae){return _0x2609ae[_0x5358('0x1b')](_0xccf30b)[_0x5358('0xa')](function(_0x17ef2d){return _0x17ef2d;});}return null;};}function removeEntity(_0x125fc2){return function(_0x241b51){if(_0x241b51){return _0x241b51[_0x5358('0x1c')]()[_0x5358('0xa')](function(){_0x125fc2[_0x5358('0x15')](0xcc)[_0x5358('0x1d')]();});}};}function handleEntityNotFound(_0x473896){return function(_0x397d88){if(!_0x397d88){_0x473896[_0x5358('0x1e')](0x194);}return _0x397d88;};}function handleError(_0x295084,_0x42bbe5){_0x42bbe5=_0x42bbe5||0x1f4;return function(_0x364ad9){logger[_0x5358('0x10')](_0x364ad9[_0x5358('0x1f')]);if(_0x364ad9[_0x5358('0x20')]){delete _0x364ad9['name'];}_0x295084[_0x5358('0x15')](_0x42bbe5)[_0x5358('0x21')](_0x364ad9);};}exports[_0x5358('0x22')]=function(_0x5e42fb,_0x1c7ead){var _0x103138={},_0x5eb019={},_0x32ca52={'count':0x0,'rows':[]};var _0x13984a=_[_0x5358('0x23')](db[_0x5358('0x24')][_0x5358('0x25')],function(_0x443d3b){return{'name':_0x443d3b['fieldName'],'type':_0x443d3b[_0x5358('0x26')][_0x5358('0x27')]};});_0x5eb019[_0x5358('0x28')]=_[_0x5358('0x23')](_0x13984a,_0x5358('0x20'));_0x5eb019[_0x5358('0x29')]=_['keys'](_0x5e42fb[_0x5358('0x29')]);_0x5eb019['filters']=_[_0x5358('0x2a')](_0x5eb019[_0x5358('0x28')],_0x5eb019[_0x5358('0x29')]);_0x103138['attributes']=_[_0x5358('0x2a')](_0x5eb019[_0x5358('0x28')],qs[_0x5358('0x2b')](_0x5e42fb['query'][_0x5358('0x2b')]));_0x103138[_0x5358('0x2c')]=_0x103138[_0x5358('0x2c')][_0x5358('0x2d')]?_0x103138[_0x5358('0x2c')]:_0x5eb019['model'];if(!_0x5e42fb[_0x5358('0x29')][_0x5358('0x2e')]('nolimit')){_0x103138['limit']=qs[_0x5358('0x2f')](_0x5e42fb['query'][_0x5358('0x2f')]);_0x103138[_0x5358('0x17')]=qs[_0x5358('0x17')](_0x5e42fb[_0x5358('0x29')][_0x5358('0x17')]);}_0x103138[_0x5358('0x30')]=qs[_0x5358('0x31')](_0x5e42fb['query'][_0x5358('0x31')]);_0x103138[_0x5358('0x32')]=qs['filters'](_[_0x5358('0x33')](_0x5e42fb[_0x5358('0x29')],_0x5eb019[_0x5358('0x34')]),_0x13984a);if(_0x5e42fb[_0x5358('0x29')][_0x5358('0x35')]){_0x103138[_0x5358('0x32')]=_[_0x5358('0x36')](_0x103138['where'],{'$or':_[_0x5358('0x23')](_0x13984a,function(_0x13c644){if(_0x13c644['type']!==_0x5358('0x37')){var _0x1b775a={};_0x1b775a[_0x13c644['name']]={'$like':'%'+_0x5e42fb['query']['filter']+'%'};return _0x1b775a;}})});}_0x103138=_[_0x5358('0x36')]({},_0x103138,_0x5e42fb[_0x5358('0x38')]);var _0x3fe49d={'where':_0x103138['where']};return db['Network'][_0x5358('0x19')](_0x3fe49d)['then'](function(_0x13f66c){_0x32ca52['count']=_0x13f66c;if(_0x5e42fb['query'][_0x5358('0x39')]){_0x103138[_0x5358('0x3a')]=[{'all':!![]}];}return db[_0x5358('0x24')]['findAll'](_0x103138);})[_0x5358('0xa')](function(_0x1a292a){_0x32ca52['rows']=_0x1a292a;return _0x32ca52;})[_0x5358('0xa')](respondWithFilteredResult(_0x1c7ead,_0x103138))[_0x5358('0x14')](handleError(_0x1c7ead,null));};exports[_0x5358('0x3b')]=function(_0x3ccf3e,_0x507a3c){var _0x1ee2b5={'raw':!![],'where':{'id':_0x3ccf3e[_0x5358('0x3c')]['id']}},_0x493b86={};_0x493b86['model']=_[_0x5358('0x3d')](db[_0x5358('0x24')]['rawAttributes']);_0x493b86[_0x5358('0x29')]=_[_0x5358('0x3d')](_0x3ccf3e[_0x5358('0x29')]);_0x493b86[_0x5358('0x34')]=_['intersection'](_0x493b86[_0x5358('0x28')],_0x493b86[_0x5358('0x29')]);_0x1ee2b5[_0x5358('0x2c')]=_['intersection'](_0x493b86[_0x5358('0x28')],qs[_0x5358('0x2b')](_0x3ccf3e['query'][_0x5358('0x2b')]));_0x1ee2b5['attributes']=_0x1ee2b5['attributes'][_0x5358('0x2d')]?_0x1ee2b5[_0x5358('0x2c')]:_0x493b86[_0x5358('0x28')];if(_0x3ccf3e[_0x5358('0x29')]['includeAll']){_0x1ee2b5[_0x5358('0x3a')]=[{'all':!![]}];}_0x1ee2b5=_[_0x5358('0x36')]({},_0x1ee2b5,_0x3ccf3e[_0x5358('0x38')]);return db[_0x5358('0x24')][_0x5358('0x3e')](_0x1ee2b5)[_0x5358('0xa')](handleEntityNotFound(_0x507a3c,null))['then'](respondWithResult(_0x507a3c,null))[_0x5358('0x14')](handleError(_0x507a3c,null));};exports[_0x5358('0x3f')]=function(_0x3ba1b5,_0x29b37d){var _0x3b7bb2;return db[_0x5358('0x24')][_0x5358('0x3f')](_0x3ba1b5[_0x5358('0x40')],{'raw':!![]})[_0x5358('0xa')](function(_0xad0a3b){_0x3b7bb2=_0xad0a3b;return db[_0x5358('0x24')]['findAll']({'where':{'type':_0x3ba1b5['body'][_0x5358('0x26')]},'raw':!![]});})[_0x5358('0xa')](function(_0xc3f2f6){if(_0x3b7bb2['type'][_0x5358('0x41')]()=='STUN'){var _0x5a05a0=fs[_0x5358('0x42')](path[_0x5358('0x43')](config[_0x5358('0x44')],_0x5358('0x45')),_0x5358('0x46'));var _0x18d5b5=ejs['render'](_0x5a05a0,{'networks':_0xc3f2f6||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x18d5b5);return respondWithRpcPromise(_0x5358('0x47'),_0x5358('0x3f'),{'module':_0x5358('0x48')});}else if(_0x3b7bb2[_0x5358('0x26')][_0x5358('0x41')]()==_0x5358('0x49')){var _0x563e38=fs[_0x5358('0x42')](path[_0x5358('0x43')](config[_0x5358('0x44')],_0x5358('0x4a')),'utf8');var _0x4626a4=ejs['render'](_0x563e38,{'networks':_0xc3f2f6||[]});fs[_0x5358('0x4b')](_0x5358('0x4c'),_0x4626a4);return respondWithRpcPromise(_0x5358('0x47'),_0x5358('0x3f'),{'module':_0x5358('0x48')});}else{var _0x1f8cc6=fs[_0x5358('0x42')](path[_0x5358('0x43')](config['root'],_0x5358('0x4d')),_0x5358('0x46'));var _0x508cc0=ejs[_0x5358('0x4e')](_0x1f8cc6,{'networks':_0xc3f2f6||[]});fs[_0x5358('0x4b')](util[_0x5358('0x4f')](_0x5358('0x50'),_0x3ba1b5['body'][_0x5358('0x26')][_0x5358('0x51')]()),_0x508cc0);return respondWithRpcPromise('Reload',_0x5358('0x3f'),{'module':_0x5358('0x52')});}})[_0x5358('0xa')](function(){return _0x3b7bb2;})[_0x5358('0xa')](respondWithResult(_0x29b37d,0xc9))[_0x5358('0x14')](handleError(_0x29b37d,null));};exports[_0x5358('0x1b')]=function(_0x35f01e,_0x186b06){var _0x9b359d;return db[_0x5358('0x24')][_0x5358('0x3e')]({'where':{'id':_0x35f01e[_0x5358('0x3c')]['id']}})[_0x5358('0xa')](handleEntityNotFound(_0x186b06,null))['then'](saveUpdates(_0x35f01e[_0x5358('0x40')],null))[_0x5358('0xa')](function(_0x11f263){if(_0x11f263){_0x9b359d=_0x11f263;return db[_0x5358('0x24')]['findAll']({'where':{'type':_0x9b359d[_0x5358('0x26')]},'raw':!![]});}return null;})['then'](function(_0x3078ce){if(_0x9b359d[_0x5358('0x26')][_0x5358('0x41')]()==_0x5358('0x53')){var _0x422d6b=fs[_0x5358('0x42')](path[_0x5358('0x43')](config[_0x5358('0x44')],_0x5358('0x45')),_0x5358('0x46'));var _0x41ea3c=ejs['render'](_0x422d6b,{'networks':_0x3078ce||[]});fs[_0x5358('0x4b')]('/etc/asterisk/stun_xcally.conf',_0x41ea3c);return respondWithRpcPromise(_0x5358('0x47'),_0x5358('0x1b'),{'module':_0x5358('0x48')});}else if(_0x9b359d[_0x5358('0x26')]['toUpperCase']()=='TURN'){var _0x1a60d6=fs[_0x5358('0x42')](path[_0x5358('0x43')](config[_0x5358('0x44')],_0x5358('0x4a')),_0x5358('0x46'));var _0x5d6331=ejs[_0x5358('0x4e')](_0x1a60d6,{'networks':_0x3078ce||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5d6331);return respondWithRpcPromise(_0x5358('0x47'),_0x5358('0x1b'),{'module':_0x5358('0x48')});}else{var _0x257e92=fs['readFileSync'](path[_0x5358('0x43')](config['root'],_0x5358('0x4d')),_0x5358('0x46'));var _0x5efcf4=ejs[_0x5358('0x4e')](_0x257e92,{'networks':_0x3078ce||[]});fs[_0x5358('0x4b')](util[_0x5358('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x35f01e[_0x5358('0x40')][_0x5358('0x26')][_0x5358('0x51')]()),_0x5efcf4);return respondWithRpcPromise('Reload',_0x5358('0x1b'),{'module':_0x5358('0x52')});}})[_0x5358('0xa')](function(_0x40cc97){if(_0x40cc97){return _0x9b359d;}return null;})[_0x5358('0xa')](respondWithResult(_0x186b06,null))[_0x5358('0x14')](handleError(_0x186b06,null));};exports[_0x5358('0x1c')]=function(_0x1cda62,_0x52d323){var _0x43ada2;return db[_0x5358('0x24')][_0x5358('0x3e')]({'where':{'id':_0x1cda62['params']['id']}})['then'](function(_0x3448c9){_0x43ada2=_0x3448c9;return _0x3448c9;})[_0x5358('0xa')](handleEntityNotFound(_0x52d323,null))[_0x5358('0xa')](removeEntity(_0x52d323,null))['then'](function(){if(_0x43ada2){return db[_0x5358('0x24')]['findAll']({'where':{'type':_0x43ada2[_0x5358('0x26')]},'raw':!![]});}})[_0x5358('0xa')](function(_0x1d84c2){if(_0x43ada2[_0x5358('0x26')][_0x5358('0x41')]()=='STUN'){var _0x3c4ecb=fs[_0x5358('0x42')](path['join'](config[_0x5358('0x44')],_0x5358('0x45')),_0x5358('0x46'));var _0x3f3ba1=ejs[_0x5358('0x4e')](_0x3c4ecb,{'networks':_0x1d84c2||[]});fs[_0x5358('0x4b')](_0x5358('0x54'),_0x3f3ba1);return respondWithRpcPromise(_0x5358('0x47'),'destroy',{'module':_0x5358('0x48')});}else if(_0x43ada2[_0x5358('0x26')][_0x5358('0x41')]()=='TURN'){var _0x2bbe9c=fs[_0x5358('0x42')](path[_0x5358('0x43')](config[_0x5358('0x44')],_0x5358('0x4a')),_0x5358('0x46'));var _0x2d7e5c=ejs[_0x5358('0x4e')](_0x2bbe9c,{'networks':_0x1d84c2||[]});fs[_0x5358('0x4b')](_0x5358('0x4c'),_0x2d7e5c);return respondWithRpcPromise(_0x5358('0x47'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x3b3378=fs[_0x5358('0x42')](path['join'](config[_0x5358('0x44')],'server/files/templates/network.ejs'),_0x5358('0x46'));var _0x1c209b=ejs[_0x5358('0x4e')](_0x3b3378,{'networks':_0x1d84c2||[]});fs[_0x5358('0x4b')](util[_0x5358('0x4f')](_0x5358('0x50'),_0x43ada2[_0x5358('0x26')][_0x5358('0x51')]()),_0x1c209b);return respondWithRpcPromise(_0x5358('0x47'),'destroy',{'module':_0x5358('0x52')});}})['catch'](handleError(_0x52d323,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 449e38d..e79940e 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 _0x6e6c=['moment','path','../../config/environment','exports','define','Network','lodash','util','api'];(function(_0x213bb1,_0x47af78){var _0x114197=function(_0x36aa8d){while(--_0x36aa8d){_0x213bb1['push'](_0x213bb1['shift']());}};_0x114197(++_0x47af78);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var logger=require('../../config/logger')(_0xc6e6('0x2'));var moment=require(_0xc6e6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6e6('0x4'));var rimraf=require('rimraf');var config=require(_0xc6e6('0x5'));var attributes=require('./network.attributes');module[_0xc6e6('0x6')]=function(_0x1182c7,_0x4bf906){return _0x1182c7[_0xc6e6('0x7')](_0xc6e6('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b24=['api','moment','rimraf','./network.attributes','Network','network','util','../../config/logger'];(function(_0x4ac6bf,_0x5a575c){var _0x512540=function(_0x1e044e){while(--_0x1e044e){_0x4ac6bf['push'](_0x4ac6bf['shift']());}};_0x512540(++_0x5a575c);}(_0x6b24,0x1ce));var _0x46b2=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0x6b24[_0x562ec5];return _0x279c8c;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var logger=require(_0x46b2('0x1'))(_0x46b2('0x2'));var moment=require(_0x46b2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46b2('0x4'));var config=require('../../config/environment');var attributes=require(_0x46b2('0x5'));module['exports']=function(_0x2e5227,_0x5598df){return _0x2e5227['define'](_0x46b2('0x6'),attributes,{'tableName':_0x46b2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 0d25546..1288852 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(_0x2d4db4,_0x15b72a){var _0x2052db=function(_0x231cc7){while(--_0x231cc7){_0x2d4db4['push'](_0x2d4db4['shift']());}};_0x2052db(++_0x15b72a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x479141,_0x47bfe0){var _0x3a45e5=function(_0x6d91e){while(--_0x6d91e){_0x479141['push'](_0x479141['shift']());}};_0x3a45e5(++_0x47bfe0);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 296b7e5..075bd0a 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 _0xf420=['getInteractions','/:id/users','create','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications'];(function(_0x19a459,_0x2a56f9){var _0x193433=function(_0x156bf8){while(--_0x156bf8){_0x19a459['push'](_0x19a459['shift']());}};_0x193433(++_0x2a56f9);}(_0xf420,0x12b));var _0x0f42=function(_0x413dba,_0x34d326){_0x413dba=_0x413dba-0x0;var _0x1caf85=_0xf420[_0x413dba];return _0x1caf85;};'use strict';var multer=require(_0x0f42('0x0'));var util=require('util');var path=require(_0x0f42('0x1'));var timeout=require(_0x0f42('0x2'));var express=require(_0x0f42('0x3'));var router=express[_0x0f42('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f42('0x5'));var config=require(_0x0f42('0x6'));var controller=require('./openchannelAccount.controller');router[_0x0f42('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f42('0x8')]);router['get']('/describe',auth[_0x0f42('0x9')](),controller[_0x0f42('0xa')]);router[_0x0f42('0x7')](_0x0f42('0xb'),auth['isAuthenticated'](),controller[_0x0f42('0xc')]);router[_0x0f42('0x7')](_0x0f42('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x0f42('0x7')]('/:id/canned_answers',auth[_0x0f42('0x9')](),controller[_0x0f42('0xe')]);router[_0x0f42('0x7')](_0x0f42('0xf'),auth['isAuthenticated'](),controller['getApplications']);router[_0x0f42('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x0f42('0x10')]);router[_0x0f42('0x7')](_0x0f42('0x11'),auth[_0x0f42('0x9')](),controller['getAgents']);router['post']('/',auth[_0x0f42('0x9')](),controller[_0x0f42('0x12')]);router[_0x0f42('0x13')](_0x0f42('0xd'),auth[_0x0f42('0x9')](),controller[_0x0f42('0x14')]);router[_0x0f42('0x13')](_0x0f42('0x15'),auth[_0x0f42('0x9')](),controller[_0x0f42('0x16')]);router[_0x0f42('0x13')]('/:id/notify',controller['notify']);router[_0x0f42('0x13')](_0x0f42('0xf'),auth[_0x0f42('0x9')](),controller[_0x0f42('0x17')]);router['post']('/:id/users',auth[_0x0f42('0x9')](),controller[_0x0f42('0x18')]);router[_0x0f42('0x13')](_0x0f42('0x19'),auth[_0x0f42('0x9')](),controller[_0x0f42('0x1a')]);router[_0x0f42('0x1b')](_0x0f42('0xb'),auth[_0x0f42('0x9')](),controller[_0x0f42('0x1c')]);router[_0x0f42('0x1d')](_0x0f42('0xb'),auth[_0x0f42('0x9')](),controller[_0x0f42('0x1e')]);router[_0x0f42('0x1d')](_0x0f42('0xd'),auth['isAuthenticated'](),controller[_0x0f42('0x1f')]);router['delete'](_0x0f42('0x15'),auth['isAuthenticated'](),controller[_0x0f42('0x20')]);router[_0x0f42('0x1d')](_0x0f42('0x11'),auth[_0x0f42('0x9')](),controller[_0x0f42('0x21')]);module[_0x0f42('0x22')]=router; \ No newline at end of file +var _0x8e50=['getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','show'];(function(_0x3db3df,_0x49689a){var _0x24fa0a=function(_0x28466e){while(--_0x28466e){_0x3db3df['push'](_0x3db3df['shift']());}};_0x24fa0a(++_0x49689a);}(_0x8e50,0x132));var _0x08e5=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x8e50[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x08e5('0x0'));var util=require(_0x08e5('0x1'));var path=require(_0x08e5('0x2'));var timeout=require(_0x08e5('0x3'));var express=require('express');var router=express[_0x08e5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x08e5('0x5'));var interaction=require(_0x08e5('0x6'));var config=require(_0x08e5('0x7'));var controller=require(_0x08e5('0x8'));router[_0x08e5('0x9')]('/',auth[_0x08e5('0xa')](),controller[_0x08e5('0xb')]);router[_0x08e5('0x9')]('/describe',auth[_0x08e5('0xa')](),controller[_0x08e5('0xc')]);router['get']('/:id',auth[_0x08e5('0xa')](),controller[_0x08e5('0xd')]);router[_0x08e5('0x9')]('/:id/dispositions',auth[_0x08e5('0xa')](),controller[_0x08e5('0xe')]);router['get'](_0x08e5('0xf'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x10')]);router[_0x08e5('0x9')](_0x08e5('0x11'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x12')]);router[_0x08e5('0x9')](_0x08e5('0x13'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x14')]);router[_0x08e5('0x9')](_0x08e5('0x15'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x16')]);router[_0x08e5('0x17')]('/',auth[_0x08e5('0xa')](),controller['create']);router['post'](_0x08e5('0x18'),auth['isAuthenticated'](),controller[_0x08e5('0x19')]);router['post'](_0x08e5('0xf'),auth[_0x08e5('0xa')](),controller['addAnswer']);router['post'](_0x08e5('0x1a'),controller[_0x08e5('0x1b')]);router[_0x08e5('0x17')](_0x08e5('0x11'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x1c')]);router[_0x08e5('0x17')](_0x08e5('0x15'),auth['isAuthenticated'](),controller[_0x08e5('0x1d')]);router[_0x08e5('0x17')](_0x08e5('0x1e'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x1f')]);router[_0x08e5('0x20')](_0x08e5('0x21'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x22')]);router['delete']('/:id',auth[_0x08e5('0xa')](),controller[_0x08e5('0x23')]);router[_0x08e5('0x24')](_0x08e5('0x18'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x25')]);router[_0x08e5('0x24')](_0x08e5('0xf'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x26')]);router[_0x08e5('0x24')](_0x08e5('0x15'),auth[_0x08e5('0xa')](),controller[_0x08e5('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 3323d69..531e858 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 _0x2e00=['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','sequelize','randomstring','exports','name','STRING','generate','TEXT'];(function(_0x1765a6,_0x38ddbb){var _0x38f86b=function(_0x15a303){while(--_0x15a303){_0x1765a6['push'](_0x1765a6['shift']());}};_0x38f86b(++_0x38ddbb);}(_0x2e00,0x13e));var _0x02e0=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x2e00[_0x1af98d];return _0x3553ea;};'use strict';var Sequelize=require(_0x02e0('0x0'));var rs=require(_0x02e0('0x1'));module[_0x02e0('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x02e0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x02e0('0x4')]},'token':{'type':Sequelize[_0x02e0('0x4')],'defaultValue':function(){return rs[_0x02e0('0x5')]();}},'replyUri':{'type':Sequelize[_0x02e0('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x02e0('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x02e0('0x6')],'defaultValue':function(){return _0x02e0('0x7');}},'notificationSound':{'type':Sequelize[_0x02e0('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x02e0('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x02e0('0x4')]},'queueTransfer':{'type':Sequelize[_0x02e0('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x02e0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x02e0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x02e0('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x02e0('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x02e0('0x8')],'defaultValue':![],'comment':_0x02e0('0xb'),'set':function(_0x48877d){if(!_0x48877d)this[_0x02e0('0xc')]('mandatoryDispositionPauseId',null);this[_0x02e0('0xc')]('mandatoryDisposition',_0x48877d);}}}; \ No newline at end of file +var _0x3b4e=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x59ae80,_0x56b205){var _0x473bf9=function(_0x2f484e){while(--_0x2f484e){_0x59ae80['push'](_0x59ae80['shift']());}};_0x473bf9(++_0x56b205);}(_0x3b4e,0x131));var _0xe3b4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b4e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe3b4('0x0'));module[_0xe3b4('0x1')]={'name':{'type':Sequelize[_0xe3b4('0x2')],'unique':_0xe3b4('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe3b4('0x4')]();}},'replyUri':{'type':Sequelize[_0xe3b4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe3b4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe3b4('0x5');}},'notificationSound':{'type':Sequelize[_0xe3b4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe3b4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe3b4('0x2')]},'queueTransfer':{'type':Sequelize[_0xe3b4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe3b4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe3b4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe3b4('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xe3b4('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe3b4('0x6')],'defaultValue':![],'comment':_0xe3b4('0x9'),'set':function(_0x15afeb){if(!_0x15afeb)this['setDataValue'](_0xe3b4('0xa'),null);this[_0xe3b4('0xb')](_0xe3b4('0xc'),_0x15afeb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 50d98d3..b688123 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 _0x861a=['OpenchannelApplication','findAndCountAll','finally','getApplications','Owner','fullname','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','isNil','CmList','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','Pause','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','Disposition','getDispositions','nolimit','order','pick','OpenchannelAccountId','rows','removeDispositions','addAnswer','CannedAnswer','findOne','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','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','List','Contacts','DESC','Applications','account','list','applications','priority','asc','contact','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS'];(function(_0x4b67ef,_0x15106b){var _0x726907=function(_0x50a6c1){while(--_0x50a6c1){_0x4b67ef['push'](_0x4b67ef['shift']());}};_0x726907(++_0x15106b);}(_0x861a,0x194));var _0xa861=function(_0x4f3962,_0x49d52f){_0x4f3962=_0x4f3962-0x0;var _0x2a202c=_0x861a[_0x4f3962];return _0x2a202c;};'use strict';var emlformat=require(_0xa861('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa861('0x1'));var jsonpatch=require(_0xa861('0x2'));var rp=require(_0xa861('0x3'));var moment=require(_0xa861('0x4'));var BPromise=require(_0xa861('0x5'));var Mustache=require(_0xa861('0x6'));var util=require('util');var path=require(_0xa861('0x7'));var sox=require(_0xa861('0x8'));var csv=require(_0xa861('0x9'));var ejs=require(_0xa861('0xa'));var fs=require('fs');var fs_extra=require(_0xa861('0xb'));var _=require('lodash');var squel=require(_0xa861('0xc'));var crypto=require(_0xa861('0xd'));var jsforce=require(_0xa861('0xe'));var deskjs=require(_0xa861('0xf'));var toCsv=require(_0xa861('0x9'));var querystring=require(_0xa861('0x10'));var Papa=require(_0xa861('0x11'));var Redis=require(_0xa861('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa861('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa861('0x14'));var utils=require(_0xa861('0x15'));var config=require(_0xa861('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa861('0x17'))['db'];config[_0xa861('0x18')]=_[_0xa861('0x19')](config[_0xa861('0x18')],{'host':_0xa861('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa861('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa861('0x1c')][_0xa861('0x1d')]({'port':0x232c});var client9002=jayson[_0xa861('0x1c')][_0xa861('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4792d3,_0x2e69c1,_0x56500f,_0x5e8bb6){return new BPromise(function(_0x5503fd,_0x12697d){var _0x18c897=_0x5e8bb6||client;return _0x18c897['request'](_0x4792d3,_0x56500f)[_0xa861('0x1e')](function(_0x270452){logger[_0xa861('0x1f')](_0xa861('0x20'),_0x2e69c1,_0xa861('0x21'));logger['debug'](_0xa861('0x22'),_0x2e69c1,_0xa861('0x21'),JSON[_0xa861('0x23')](_0x270452));if(_0x270452[_0xa861('0x24')]){if(_0x270452[_0xa861('0x24')]['code']===0x1f4){logger[_0xa861('0x24')](_0xa861('0x20'),_0x2e69c1,_0x270452[_0xa861('0x24')]['message']);return _0x12697d(_0x270452[_0xa861('0x24')][_0xa861('0x25')]);}logger['error'](_0xa861('0x20'),_0x2e69c1,_0x270452[_0xa861('0x24')][_0xa861('0x25')]);return _0x5503fd(_0x270452['error'][_0xa861('0x25')]);}else{logger[_0xa861('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x2e69c1,_0xa861('0x21'));_0x5503fd(_0x270452[_0xa861('0x26')]['message']);}})[_0xa861('0x27')](function(_0x133c81){logger[_0xa861('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x2e69c1,_0x133c81);_0x12697d(_0x133c81);});});}function respondWithStatusCode(_0x3e89ae,_0x358915){_0x358915=_0x358915||0xcc;return function(_0x364589){if(_0x364589){return _0x3e89ae[_0xa861('0x28')](_0x358915);}return _0x3e89ae[_0xa861('0x29')](_0x358915)[_0xa861('0x2a')]();};}function respondWithResult(_0x6b28e7,_0x48625f){_0x48625f=_0x48625f||0xc8;return function(_0x25eed9){if(_0x25eed9){return _0x6b28e7[_0xa861('0x29')](_0x48625f)[_0xa861('0x2b')](_0x25eed9);}};}function respondWithFilteredResult(_0x58a58c,_0x332f41){return function(_0x27d3fd){if(_0x27d3fd){var _0x332fad=typeof _0x332f41[_0xa861('0x2c')]===_0xa861('0x2d')&&typeof _0x332f41[_0xa861('0x2e')]==='undefined';var _0x519c21=_0x27d3fd['count'];var _0x429a49=_0x332fad?0x0:_0x332f41['offset'];var _0x14aba2=_0x332fad?_0x27d3fd[_0xa861('0x2f')]:_0x332f41[_0xa861('0x2c')]+_0x332f41[_0xa861('0x2e')];var _0x5a26c2;if(_0x14aba2>=_0x519c21){_0x14aba2=_0x519c21;_0x5a26c2=0xc8;}else{_0x5a26c2=0xce;}_0x58a58c[_0xa861('0x29')](_0x5a26c2);return _0x58a58c[_0xa861('0x30')](_0xa861('0x31'),_0x429a49+'-'+_0x14aba2+'/'+_0x519c21)[_0xa861('0x2b')](_0x27d3fd);}return null;};}function patchUpdates(_0x5dd3b7){return function(_0x386036){try{jsonpatch['apply'](_0x386036,_0x5dd3b7,!![]);}catch(_0xe37c63){return BPromise[_0xa861('0x32')](_0xe37c63);}return _0x386036[_0xa861('0x33')]();};}function saveUpdates(_0x2e051e,_0x1585d0){return function(_0x11f327){if(_0x11f327){return _0x11f327['update'](_0x2e051e)[_0xa861('0x1e')](function(_0x11985f){return _0x11985f;});}return null;};}function removeEntity(_0x5872c3,_0x27833c){return function(_0x396a00){if(_0x396a00){return _0x396a00[_0xa861('0x34')]()[_0xa861('0x1e')](function(){var _0xe49c5d=_0x396a00[_0xa861('0x35')]({'plain':!![]});var _0xcb0ad2=_0xa861('0x36');return db[_0xa861('0x37')][_0xa861('0x34')]({'where':{'type':_0xcb0ad2,'resourceId':_0xe49c5d['id']}})[_0xa861('0x1e')](function(){return _0x396a00;});})[_0xa861('0x1e')](function(){_0x5872c3[_0xa861('0x29')](0xcc)[_0xa861('0x2a')]();});}};}function handleEntityNotFound(_0x276429,_0xedb164){return function(_0x48d5a7){if(!_0x48d5a7){_0x276429[_0xa861('0x28')](0x194);}return _0x48d5a7;};}function handleError(_0x304c75,_0x5d74b3){_0x5d74b3=_0x5d74b3||0x1f4;return function(_0x16ae73){logger[_0xa861('0x24')](_0x16ae73[_0xa861('0x38')]);if(_0x16ae73[_0xa861('0x39')]){delete _0x16ae73[_0xa861('0x39')];}_0x304c75['status'](_0x5d74b3)[_0xa861('0x3a')](_0x16ae73);};}exports[_0xa861('0x3b')]=function(_0x24b1ac,_0x2ace28){var _0x5236e6={'include':[{'model':db['Pause'],'as':_0xa861('0x3c')}]},_0x1b71c8={},_0x26cfed={'count':0x0,'rows':[]};var _0x1f0f0c=_['map'](db[_0xa861('0x3d')][_0xa861('0x3e')],function(_0x589c6f){return{'name':_0x589c6f[_0xa861('0x3f')],'type':_0x589c6f[_0xa861('0x40')]['key']};});_0x1b71c8[_0xa861('0x41')]=_[_0xa861('0x42')](_0x1f0f0c,_0xa861('0x39'));_0x1b71c8[_0xa861('0x43')]=_[_0xa861('0x44')](_0x24b1ac[_0xa861('0x43')]);_0x1b71c8[_0xa861('0x45')]=_[_0xa861('0x46')](_0x1b71c8[_0xa861('0x41')],_0x1b71c8[_0xa861('0x43')]);_0x5236e6[_0xa861('0x47')]=_[_0xa861('0x46')](_0x1b71c8['model'],qs[_0xa861('0x48')](_0x24b1ac[_0xa861('0x43')][_0xa861('0x48')]));_0x5236e6[_0xa861('0x47')]=_0x5236e6['attributes']['length']?_0x5236e6[_0xa861('0x47')]:_0x1b71c8[_0xa861('0x41')];if(!_0x24b1ac['query'][_0xa861('0x49')]('nolimit')){_0x5236e6['limit']=qs[_0xa861('0x2e')](_0x24b1ac[_0xa861('0x43')][_0xa861('0x2e')]);_0x5236e6['offset']=qs[_0xa861('0x2c')](_0x24b1ac[_0xa861('0x43')][_0xa861('0x2c')]);}_0x5236e6['order']=qs[_0xa861('0x4a')](_0x24b1ac[_0xa861('0x43')]['sort']);_0x5236e6['where']=qs[_0xa861('0x45')](_['pick'](_0x24b1ac[_0xa861('0x43')],_0x1b71c8[_0xa861('0x45')]),_0x1f0f0c);if(_0x24b1ac[_0xa861('0x43')]['filter']){_0x5236e6[_0xa861('0x4b')]=_[_0xa861('0x4c')](_0x5236e6[_0xa861('0x4b')],{'$or':_['map'](_0x1f0f0c,function(_0x4aca5b){if(_0x4aca5b[_0xa861('0x40')]!==_0xa861('0x4d')){var _0xeb75a3={};_0xeb75a3[_0x4aca5b['name']]={'$like':'%'+_0x24b1ac[_0xa861('0x43')][_0xa861('0x4e')]+'%'};return _0xeb75a3;}})});}_0x5236e6=_[_0xa861('0x4c')]({},_0x5236e6,_0x24b1ac[_0xa861('0x4f')]);var _0x1a4e74={'where':_0x5236e6[_0xa861('0x4b')]};return db[_0xa861('0x3d')][_0xa861('0x2f')](_0x1a4e74)[_0xa861('0x1e')](function(_0x597935){_0x26cfed['count']=_0x597935;if(_0x24b1ac[_0xa861('0x43')][_0xa861('0x50')]){_0x5236e6[_0xa861('0x51')]=[{'all':!![]}];}return db[_0xa861('0x3d')][_0xa861('0x52')](_0x5236e6);})['then'](function(_0x45cdc0){_0x26cfed['rows']=_0x45cdc0;return _0x26cfed;})[_0xa861('0x1e')](respondWithFilteredResult(_0x2ace28,_0x5236e6))['catch'](handleError(_0x2ace28,null));};exports[_0xa861('0x53')]=function(_0x23d055,_0x13364f){var _0x2c3705={'raw':![],'where':{'id':_0x23d055[_0xa861('0x54')]['id']},'include':[{'model':db[_0xa861('0x55')],'as':_0xa861('0x3c')}]},_0x2d443c={};_0x2d443c['model']=_['keys'](db[_0xa861('0x3d')][_0xa861('0x3e')]);_0x2d443c[_0xa861('0x43')]=_['keys'](_0x23d055['query']);_0x2d443c['filters']=_[_0xa861('0x46')](_0x2d443c['model'],_0x2d443c[_0xa861('0x43')]);_0x2c3705['attributes']=_[_0xa861('0x46')](_0x2d443c[_0xa861('0x41')],qs['fields'](_0x23d055[_0xa861('0x43')][_0xa861('0x48')]));_0x2c3705[_0xa861('0x47')]=_0x2c3705['attributes'][_0xa861('0x56')]?_0x2c3705['attributes']:_0x2d443c['model'];if(_0x23d055[_0xa861('0x43')][_0xa861('0x50')]){_0x2c3705[_0xa861('0x51')]=[{'all':!![]}];}_0x2c3705=_['merge']({},_0x2c3705,_0x23d055['options']);return db[_0xa861('0x3d')]['find'](_0x2c3705)[_0xa861('0x1e')](handleEntityNotFound(_0x13364f,null))[_0xa861('0x1e')](respondWithResult(_0x13364f,null))[_0xa861('0x27')](handleError(_0x13364f,null));};exports[_0xa861('0x57')]=function(_0x141b13,_0x5e831d){return db[_0xa861('0x3d')]['create'](_0x141b13[_0xa861('0x58')],{})[_0xa861('0x1e')](function(_0x3b8680){var _0x29b120=_0x141b13[_0xa861('0x59')]['get']({'plain':!![]});if(!_0x29b120)throw new Error(_0xa861('0x5a'));if(_0x29b120[_0xa861('0x5b')]==='user'){var _0x43b09a=_0x3b8680[_0xa861('0x35')]({'plain':!![]});var _0x5764af=_0xa861('0x36');return db[_0xa861('0x5c')]['find']({'where':{'name':_0x5764af,'userProfileId':_0x29b120[_0xa861('0x5d')]},'raw':!![]})[_0xa861('0x1e')](function(_0x38df66){if(_0x38df66&&_0x38df66[_0xa861('0x5e')]===0x0){return db[_0xa861('0x37')][_0xa861('0x57')]({'name':_0x43b09a[_0xa861('0x39')],'resourceId':_0x43b09a['id'],'type':_0x38df66[_0xa861('0x39')],'sectionId':_0x38df66['id']},{})[_0xa861('0x1e')](function(){return _0x3b8680;});}else{return _0x3b8680;}})[_0xa861('0x27')](function(_0x45ebba){logger[_0xa861('0x24')](_0xa861('0x5f'),_0x45ebba);throw _0x45ebba;});}return _0x3b8680;})[_0xa861('0x1e')](respondWithResult(_0x5e831d,0xc9))['catch'](handleError(_0x5e831d,null));};exports[_0xa861('0x60')]=function(_0x417259,_0x22da40){if(_0x417259['body']['id']){delete _0x417259['body']['id'];}return db[_0xa861('0x3d')][_0xa861('0x61')]({'where':{'id':_0x417259['params']['id']},'include':[{'model':db['Pause'],'as':_0xa861('0x3c')}]})[_0xa861('0x1e')](handleEntityNotFound(_0x22da40,null))[_0xa861('0x1e')](saveUpdates(_0x417259[_0xa861('0x58')],null))[_0xa861('0x1e')](respondWithResult(_0x22da40,null))[_0xa861('0x27')](handleError(_0x22da40,null));};exports[_0xa861('0x34')]=function(_0x3b7ba3,_0x528d53){return db['OpenchannelAccount']['find']({'where':{'id':_0x3b7ba3[_0xa861('0x54')]['id']}})['then'](handleEntityNotFound(_0x528d53,null))['then'](removeEntity(_0x528d53,null))[_0xa861('0x27')](handleError(_0x528d53,null));};exports[_0xa861('0x62')]=function(_0x212a98,_0x337b37){return db['OpenchannelAccount'][_0xa861('0x62')]()[_0xa861('0x1e')](respondWithResult(_0x337b37,null))[_0xa861('0x27')](handleError(_0x337b37,null));};exports[_0xa861('0x63')]=function(_0x555e54,_0x418d5e,_0x27d754){if(_0x555e54[_0xa861('0x58')]['id']){delete _0x555e54[_0xa861('0x58')]['id'];}return db[_0xa861('0x3d')][_0xa861('0x61')]({'where':{'id':_0x555e54[_0xa861('0x54')]['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0x418d5e,null))[_0xa861('0x1e')](function(_0x48140b){if(_0x48140b){_0x555e54[_0xa861('0x58')]['OpenchannelAccountId']=_0x48140b['id'];return db[_0xa861('0x64')][_0xa861('0x57')](_0x555e54['body']);}})[_0xa861('0x1e')](respondWithResult(_0x418d5e,null))[_0xa861('0x27')](handleError(_0x418d5e,null));};exports[_0xa861('0x65')]=function(_0x14e2be,_0x1d2d3c,_0xd7d064){var _0x4dd532={'raw':![],'where':{}};var _0x2430fd={};var _0x5b3b19={'count':0x0,'rows':[]};return db[_0xa861('0x3d')]['findOne']({'where':{'id':_0x14e2be[_0xa861('0x54')]['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0x1d2d3c,null))[_0xa861('0x1e')](function(_0x5cdf23){if(_0x5cdf23){_0x2430fd[_0xa861('0x41')]=_[_0xa861('0x44')](db[_0xa861('0x64')]['rawAttributes']);_0x2430fd[_0xa861('0x43')]=_[_0xa861('0x44')](_0x14e2be['query']);_0x2430fd[_0xa861('0x45')]=_[_0xa861('0x46')](_0x2430fd[_0xa861('0x41')],_0x2430fd[_0xa861('0x43')]);_0x4dd532['attributes']=_[_0xa861('0x46')](_0x2430fd[_0xa861('0x41')],qs[_0xa861('0x48')](_0x14e2be[_0xa861('0x43')][_0xa861('0x48')]));_0x4dd532[_0xa861('0x47')]=_0x4dd532[_0xa861('0x47')][_0xa861('0x56')]?_0x4dd532[_0xa861('0x47')]:_0x2430fd['model'];if(!_0x14e2be[_0xa861('0x43')][_0xa861('0x49')](_0xa861('0x66'))){_0x4dd532[_0xa861('0x2e')]=qs[_0xa861('0x2e')](_0x14e2be[_0xa861('0x43')]['limit']);_0x4dd532[_0xa861('0x2c')]=qs['offset'](_0x14e2be[_0xa861('0x43')][_0xa861('0x2c')]);}_0x4dd532[_0xa861('0x67')]=qs['sort'](_0x14e2be['query'][_0xa861('0x4a')]);_0x4dd532[_0xa861('0x4b')]=qs['filters'](_[_0xa861('0x68')](_0x14e2be[_0xa861('0x43')],_0x2430fd[_0xa861('0x45')]));_0x4dd532[_0xa861('0x4b')][_0xa861('0x69')]=_0x5cdf23['id'];if(_0x14e2be[_0xa861('0x43')][_0xa861('0x4e')]){_0x4dd532[_0xa861('0x4b')]=_[_0xa861('0x4c')](_0x4dd532['where'],{'$or':_[_0xa861('0x42')](_0x4dd532[_0xa861('0x47')],function(_0x525b07){var _0x350db3={};_0x350db3[_0x525b07]={'$like':'%'+_0x14e2be[_0xa861('0x43')]['filter']+'%'};return _0x350db3;})});}_0x4dd532=_['merge']({},_0x4dd532,_0x14e2be[_0xa861('0x4f')]);return db['Disposition'][_0xa861('0x2f')]({'where':_0x4dd532[_0xa861('0x4b')]})['then'](function(_0x5a795a){_0x5b3b19[_0xa861('0x2f')]=_0x5a795a;if(_0x14e2be[_0xa861('0x43')][_0xa861('0x50')]){_0x4dd532[_0xa861('0x51')]=[{'all':!![]}];}return db[_0xa861('0x64')][_0xa861('0x52')](_0x4dd532);})['then'](function(_0x5ed3a2){_0x5b3b19[_0xa861('0x6a')]=_0x5ed3a2;return _0x5b3b19;});}})[_0xa861('0x1e')](respondWithFilteredResult(_0x1d2d3c,_0x4dd532))[_0xa861('0x27')](handleError(_0x1d2d3c,null));};exports['removeDispositions']=function(_0x301955,_0xe8db37,_0x42e24f){return db[_0xa861('0x3d')][_0xa861('0x61')]({'where':{'id':_0x301955['params']['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0xe8db37,null))[_0xa861('0x1e')](function(_0x249469){if(_0x249469){return _0x249469[_0xa861('0x6b')](_0x301955['query']['ids']);}})['then'](respondWithStatusCode(_0xe8db37,null))['catch'](handleError(_0xe8db37,null));};exports[_0xa861('0x6c')]=function(_0x6fb96a,_0x1c6462,_0x12db57){if(_0x6fb96a[_0xa861('0x58')]['id']){delete _0x6fb96a[_0xa861('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x6fb96a['params']['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0x1c6462,null))[_0xa861('0x1e')](function(_0x93ef81){if(_0x93ef81){_0x6fb96a[_0xa861('0x58')]['OpenchannelAccountId']=_0x93ef81['id'];return db[_0xa861('0x6d')][_0xa861('0x57')](_0x6fb96a[_0xa861('0x58')]);}})[_0xa861('0x1e')](respondWithResult(_0x1c6462,null))[_0xa861('0x27')](handleError(_0x1c6462,null));};exports['getAnswers']=function(_0x3faa8f,_0x35a96c,_0x8accbe){var _0x38f87b={'raw':![],'where':{}};var _0x35f5c7={};var _0x1ae5a7={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa861('0x6e')]({'where':{'id':_0x3faa8f['params']['id']}})['then'](handleEntityNotFound(_0x35a96c,null))[_0xa861('0x1e')](function(_0x48574b){if(_0x48574b){_0x35f5c7['model']=_['keys'](db[_0xa861('0x6d')][_0xa861('0x3e')]);_0x35f5c7[_0xa861('0x43')]=_[_0xa861('0x44')](_0x3faa8f[_0xa861('0x43')]);_0x35f5c7[_0xa861('0x45')]=_[_0xa861('0x46')](_0x35f5c7['model'],_0x35f5c7[_0xa861('0x43')]);_0x38f87b[_0xa861('0x47')]=_['intersection'](_0x35f5c7[_0xa861('0x41')],qs[_0xa861('0x48')](_0x3faa8f[_0xa861('0x43')][_0xa861('0x48')]));_0x38f87b['attributes']=_0x38f87b[_0xa861('0x47')][_0xa861('0x56')]?_0x38f87b['attributes']:_0x35f5c7[_0xa861('0x41')];if(!_0x3faa8f[_0xa861('0x43')][_0xa861('0x49')]('nolimit')){_0x38f87b['limit']=qs[_0xa861('0x2e')](_0x3faa8f[_0xa861('0x43')][_0xa861('0x2e')]);_0x38f87b[_0xa861('0x2c')]=qs['offset'](_0x3faa8f[_0xa861('0x43')][_0xa861('0x2c')]);}_0x38f87b[_0xa861('0x67')]=qs['sort'](_0x3faa8f['query'][_0xa861('0x4a')]);_0x38f87b[_0xa861('0x4b')]=qs[_0xa861('0x45')](_[_0xa861('0x68')](_0x3faa8f[_0xa861('0x43')],_0x35f5c7['filters']));_0x38f87b[_0xa861('0x4b')][_0xa861('0x69')]=_0x48574b['id'];if(_0x3faa8f['query'][_0xa861('0x4e')]){_0x38f87b[_0xa861('0x4b')]=_[_0xa861('0x4c')](_0x38f87b['where'],{'$or':_[_0xa861('0x42')](_0x38f87b[_0xa861('0x47')],function(_0x7a3846){var _0x30565={};_0x30565[_0x7a3846]={'$like':'%'+_0x3faa8f[_0xa861('0x43')]['filter']+'%'};return _0x30565;})});}_0x38f87b=_[_0xa861('0x4c')]({},_0x38f87b,_0x3faa8f[_0xa861('0x4f')]);return db['CannedAnswer'][_0xa861('0x2f')]({'where':_0x38f87b[_0xa861('0x4b')]})['then'](function(_0x49b68e){_0x1ae5a7['count']=_0x49b68e;if(_0x3faa8f['query'][_0xa861('0x50')]){_0x38f87b[_0xa861('0x51')]=[{'all':!![]}];}return db[_0xa861('0x6d')][_0xa861('0x52')](_0x38f87b);})['then'](function(_0x5e5720){_0x1ae5a7[_0xa861('0x6a')]=_0x5e5720;return _0x1ae5a7;});}})[_0xa861('0x1e')](respondWithFilteredResult(_0x35a96c,_0x38f87b))['catch'](handleError(_0x35a96c,null));};exports[_0xa861('0x6f')]=function(_0x4d372c,_0x5715d6,_0xfc4a6c){return db[_0xa861('0x3d')][_0xa861('0x61')]({'where':{'id':_0x4d372c[_0xa861('0x54')]['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0x5715d6,null))[_0xa861('0x1e')](function(_0x8d83e0){if(_0x8d83e0){return _0x8d83e0[_0xa861('0x6f')](_0x4d372c[_0xa861('0x43')][_0xa861('0x70')]);}})[_0xa861('0x1e')](respondWithStatusCode(_0x5715d6,null))[_0xa861('0x27')](handleError(_0x5715d6,null));};exports[_0xa861('0x71')]=function(_0x255219,_0x20a201,_0x1bdb63){var _0x50a7e8={'body':_0x255219[_0xa861('0x58')],'channel':_0xa861('0x72')};var _0x387b89=[];var _0x559ea8=[];var _0x3c8db4={};var _0x3cf5a5=![];return db[_0xa861('0x73')]['describe']()[_0xa861('0x1e')](function(_0x757f7a){if(!_0x757f7a){throw new db[(_0xa861('0x74'))][(_0xa861('0x75'))]('no\x20available\x20attributes');}_0x387b89=_[_0xa861('0x76')](_[_0xa861('0x44')](_0x757f7a),[_0xa861('0x77'),_0xa861('0x78')]);_0x559ea8=_[_0xa861('0x76')](_['keys'](_0x757f7a),['createdAt',_0xa861('0x78'),_0xa861('0x79'),_0xa861('0x7a')]);if(_0x255219[_0xa861('0x58')]['id']){delete _0x255219['body']['id'];}if(_['isNil'](_0x255219[_0xa861('0x58')][_0xa861('0x7b')])){throw new db[(_0xa861('0x74'))]['ValidationError'](_0xa861('0x7c'));}if(_['isNil'](_0x255219[_0xa861('0x58')][_0xa861('0x58')])||_0x255219['body'][_0xa861('0x58')]===''){throw new db['Sequelize'][(_0xa861('0x75'))](_0xa861('0x7d'));}if(_['isNil'](_0x255219[_0xa861('0x58')]['mapKey'])){throw new db[(_0xa861('0x74'))][(_0xa861('0x75'))](_0xa861('0x7e')+_0x559ea8);}if(!_[_0xa861('0x7f')](_0x559ea8,_0x255219[_0xa861('0x58')][_0xa861('0x80')])){throw new db[(_0xa861('0x74'))]['ValidationError'](_0xa861('0x81')+_0x559ea8);}_0x3c8db4[_0x255219['body'][_0xa861('0x80')]]=_0x255219[_0xa861('0x58')][_0xa861('0x7b')];})[_0xa861('0x1e')](function(){return db[_0xa861('0x3d')][_0xa861('0x61')]({'where':{'id':_0x255219[_0xa861('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xa861('0x82'),'include':[{'model':db[_0xa861('0x73')],'as':_0xa861('0x83'),'where':_0x3c8db4,'limit':0x1,'order':[['updatedAt',_0xa861('0x84')]]}]},{'model':db['OpenchannelApplication'],'as':_0xa861('0x85')}]});})[_0xa861('0x1e')](handleEntityNotFound(_0x20a201,null))[_0xa861('0x1e')](function(_0x16c1b3){if(_0x16c1b3&&_0x16c1b3['List']){_0x50a7e8[_0xa861('0x86')]=_0x16c1b3;_0x50a7e8['applications']=_0x16c1b3[_0xa861('0x85')];_0x50a7e8[_0xa861('0x87')]=_0x16c1b3[_0xa861('0x82')];_0x50a7e8[_0xa861('0x88')]=_['orderBy'](_0x50a7e8[_0xa861('0x88')],[_0xa861('0x89')],[_0xa861('0x8a')]);if(_0x50a7e8[_0xa861('0x86')][_0xa861('0x85')]){delete _0x50a7e8[_0xa861('0x86')][_0xa861('0x85')];}if(_0x50a7e8[_0xa861('0x86')][_0xa861('0x82')]&&_0x50a7e8[_0xa861('0x86')]['List'][_0xa861('0x83')][_0xa861('0x56')]){return _0x50a7e8[_0xa861('0x86')]['List'][_0xa861('0x83')][0x0];}var _0x14853e=_[_0xa861('0x19')](_0x255219[_0xa861('0x58')],{'firstName':_0x255219[_0xa861('0x58')]['from'],'ListId':_0x16c1b3[_0xa861('0x7a')]});_0x14853e[_0x255219[_0xa861('0x58')][_0xa861('0x80')]]=_0x255219[_0xa861('0x58')]['from'];return db[_0xa861('0x73')][_0xa861('0x57')](_0x14853e,{'fields':_0x387b89,'raw':!![]});}})[_0xa861('0x1e')](handleEntityNotFound(_0x20a201,null))[_0xa861('0x1e')](function(_0x27d5fa){_0x50a7e8[_0xa861('0x8b')]=_0x27d5fa;if(_0x27d5fa){var _0x4f49d3={'ContactId':_0x27d5fa['id'],'OpenchannelAccountId':_0x255219[_0xa861('0x54')]['id'],'from':(_0x27d5fa['firstName']||'')+'\x20'+(_0x27d5fa[_0xa861('0x8c')]||'')};var _0x39cc3a={'OpenchannelAccountId':_0x255219[_0xa861('0x54')]['id'],'closed':![]};if(_0x255219[_0xa861('0x58')][_0xa861('0x8d')]){_0x39cc3a[_0xa861('0x8d')]=_0x255219[_0xa861('0x58')][_0xa861('0x8d')];return db['OpenchannelInteraction'][_0xa861('0x61')]({'where':_0x39cc3a})['then'](function(_0x52dbbc){if(_0x52dbbc){return[_0x52dbbc,![]];}_0x4f49d3[_0xa861('0x8d')]=_0x255219['body'][_0xa861('0x8d')];_0x4f49d3[_0xa861('0x8e')]=_0x255219['body'][_0xa861('0x8e')];return db[_0xa861('0x8f')][_0xa861('0x57')](_0x4f49d3)[_0xa861('0x1e')](function(_0xc2be95){return[_0xc2be95,!![]];});});}else{_0x39cc3a[_0xa861('0x8d')]=null;}_0x39cc3a[_0xa861('0x90')]=_0x27d5fa['id'];return db['OpenchannelInteraction'][_0xa861('0x61')]({'where':_0x39cc3a})[_0xa861('0x1e')](function(_0x482a37){if(_0x482a37){return[_0x482a37,![]];}return db[_0xa861('0x8f')]['create'](_0x4f49d3)[_0xa861('0x1e')](function(_0x48032e){return[_0x48032e,!![]];});});}})[_0xa861('0x91')](function(_0x2b279b,_0x1940b6){if(_0x2b279b){_0x3cf5a5=_0x1940b6;if(!_0x1940b6){var _0x508ba4={'from':(_0x50a7e8['contact'][_0xa861('0x92')]||'')+'\x20'+(_0x50a7e8[_0xa861('0x8b')]['lastName']||'')};if(_0x255219[_0xa861('0x58')][_0xa861('0x8d')]&&_0x255219[_0xa861('0x58')][_0xa861('0x93')]&&_0x255219[_0xa861('0x58')][_0xa861('0x8d')]!=_0x255219[_0xa861('0x58')][_0xa861('0x93')]){_0x508ba4['threadId']=_0x255219['body'][_0xa861('0x93')];}return _0x2b279b[_0xa861('0x60')](_0x508ba4);}else{return _0x2b279b;}}})[_0xa861('0x1e')](function(_0x7fde1){_0x50a7e8[_0xa861('0x94')]=_0x7fde1[_0xa861('0x35')]({'plain':!![]});_0x50a7e8[_0xa861('0x94')][_0xa861('0x95')]=_0x3cf5a5;if(_0x50a7e8[_0xa861('0x94')]['created']){if(_0x50a7e8[_0xa861('0x86')][_0xa861('0x96')]){_0x50a7e8['applications'][_0xa861('0x97')]({'id':0x0,'priority':_0x50a7e8[_0xa861('0x88')][_0xa861('0x56')]+0x1,'app':_0xa861('0x98'),'appdata':_0xa861('0x99'),'interval':_0xa861('0x9a')});}}return db[_0xa861('0x9b')][_0xa861('0x57')]({'body':_0x255219['body'][_0xa861('0x58')],'OpenchannelAccountId':_0x255219[_0xa861('0x54')]['id'],'OpenchannelInteractionId':_0x7fde1['id'],'direction':'in','ContactId':_0x50a7e8['contact']['id'],'AttachmentId':_0x255219['body']['AttachmentId']});})['then'](function(_0x1ac416){_0x50a7e8[_0xa861('0x25')]=_0x1ac416;if(_0x50a7e8[_0xa861('0x94')][_0xa861('0x9c')]){return db[_0xa861('0x9d')][_0xa861('0x61')]({'attributes':['id','name'],'where':{'id':_0x50a7e8[_0xa861('0x94')][_0xa861('0x9c')]}})[_0xa861('0x1e')](function(_0x11727d){if(_0x11727d){_0x50a7e8[_0xa861('0x88')][_0xa861('0x9e')]({'id':0x0,'priority':0x0,'app':_0xa861('0x9f'),'appdata':_0x11727d[_0xa861('0x39')]+','+(_0x50a7e8[_0xa861('0x86')][_0xa861('0xa0')]||0xa),'interval':_0xa861('0x9a')});_0x50a7e8[_0xa861('0xa1')]=![];}return respondWithRpcPromise(_0xa861('0xa2'),'startRouting',_0x50a7e8);});}return respondWithRpcPromise(_0xa861('0xa2'),'startRouting',_0x50a7e8);})[_0xa861('0x1e')](function(_0x790249){respondWithRpcPromise('EventManager',_0xa861('0xa3'),{'event':_0xa861('0x71'),'message':_0x790249},client9002);return _0x790249;})[_0xa861('0x1e')](respondWithResult(_0x20a201,null))[_0xa861('0x27')](handleError(_0x20a201,null));};exports[_0xa861('0xa4')]=function(_0x30b482,_0xce81a){var _0x4a4779=_0x30b482['params']['id'];var _0x48b956=_0x30b482[_0xa861('0x58')];var _0x56c92e=0xc8;var _0x1829a1=null;return db[_0xa861('0xa5')][_0xa861('0xa6')]({'isolationLevel':db[_0xa861('0xa5')][_0xa861('0xa7')][_0xa861('0xa8')]['READ_COMMITTED']},function(_0x28af3d){return db[_0xa861('0x3d')][_0xa861('0x6e')]({'where':{'id':_0x4a4779},'transaction':_0x28af3d})[_0xa861('0x1e')](function(_0x277fb5){if(_0x277fb5){return db[_0xa861('0xa9')]['destroy']({'where':{'OpenchannelAccountId':_0x4a4779},'transaction':_0x28af3d})[_0xa861('0x1e')](function(){var _0x3a1446=_[_0xa861('0x42')](_0x48b956,function(_0x3632ed){_0x3632ed[_0xa861('0x69')]=_0x4a4779;return _0x3632ed;});return db[_0xa861('0xa9')]['bulkCreate'](_0x3a1446,{'transaction':_0x28af3d});});}else{_0x56c92e=0x194;_0x1829a1=[];}});})[_0xa861('0x1e')](function(){if(_0x56c92e!==0x194){return db[_0xa861('0xa9')][_0xa861('0xaa')]({'where':{'OpenchannelAccountId':_0x4a4779},'order':'priority'})[_0xa861('0x1e')](function(_0x13e635){_0x1829a1=_0x13e635;});}})[_0xa861('0x27')](function(_0x1afab7){_0x56c92e=0x1f4;logger['error'](_0x1afab7[_0xa861('0x38')]);if(_0x1afab7[_0xa861('0x39')]){delete _0x1afab7['name'];}_0x1829a1=_0x1afab7;})[_0xa861('0xab')](function(){if(_0x1829a1===null){_0xce81a[_0xa861('0x28')](_0x56c92e);}else{if(_0x56c92e===0x1f4){_0xce81a[_0xa861('0x29')](_0x56c92e)[_0xa861('0x3a')](_0x1829a1);}else{_0xce81a[_0xa861('0x29')](_0x56c92e)[_0xa861('0x2b')](_0x1829a1);}}});};exports['getApplications']=function(_0xaaf0a,_0xc318e1,_0xcc250c){var _0x532201={};var _0x2dbc39={};var _0x562bba;var _0x33257a;return db[_0xa861('0x3d')][_0xa861('0x6e')]({'where':{'id':_0xaaf0a['params']['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0xc318e1,null))['then'](function(_0x4b1c89){if(_0x4b1c89){_0x562bba=_0x4b1c89;_0x2dbc39['model']=_['keys'](db[_0xa861('0xa9')][_0xa861('0x3e')]);_0x2dbc39[_0xa861('0x43')]=_['keys'](_0xaaf0a[_0xa861('0x43')]);_0x2dbc39[_0xa861('0x45')]=_[_0xa861('0x46')](_0x2dbc39[_0xa861('0x41')],_0x2dbc39['query']);_0x532201[_0xa861('0x47')]=_[_0xa861('0x46')](_0x2dbc39[_0xa861('0x41')],qs[_0xa861('0x48')](_0xaaf0a['query'][_0xa861('0x48')]));_0x532201[_0xa861('0x47')]=_0x532201[_0xa861('0x47')]['length']?_0x532201['attributes']:_0x2dbc39[_0xa861('0x41')];_0x532201['order']=qs[_0xa861('0x4a')](_0xaaf0a[_0xa861('0x43')][_0xa861('0x4a')]);_0x532201[_0xa861('0x4b')]=qs[_0xa861('0x45')](_[_0xa861('0x68')](_0xaaf0a['query'],_0x2dbc39[_0xa861('0x45')]));if(_0xaaf0a[_0xa861('0x43')]['filter']){_0x532201['where']=_[_0xa861('0x4c')](_0x532201[_0xa861('0x4b')],{'$or':_[_0xa861('0x42')](_0x532201['attributes'],function(_0x1c798f){var _0x1e5d6c={};_0x1e5d6c[_0x1c798f]={'$like':'%'+_0xaaf0a[_0xa861('0x43')]['filter']+'%'};return _0x1e5d6c;})});}_0x532201=_[_0xa861('0x4c')]({},_0x532201,_0xaaf0a[_0xa861('0x4f')]);return _0x562bba[_0xa861('0xac')](_0x532201);}})['then'](function(_0x5021e9){if(_0x5021e9){_0x33257a=_0x5021e9[_0xa861('0x56')];if(!_0xaaf0a[_0xa861('0x43')][_0xa861('0x49')](_0xa861('0x66'))){_0x532201['limit']=qs[_0xa861('0x2e')](_0xaaf0a[_0xa861('0x43')][_0xa861('0x2e')]);_0x532201[_0xa861('0x2c')]=qs[_0xa861('0x2c')](_0xaaf0a[_0xa861('0x43')][_0xa861('0x2c')]);}return _0x562bba[_0xa861('0xac')](_0x532201);}})[_0xa861('0x1e')](function(_0x14ca0f){if(_0x14ca0f){return _0x14ca0f?{'count':_0x33257a,'rows':_0x14ca0f}:null;}})['then'](respondWithResult(_0xc318e1,null))[_0xa861('0x27')](handleError(_0xc318e1,null));};exports['getInteractions']=function(_0x32040a,_0x4fd27e,_0x10b396){var _0x976c84={'raw':![],'where':{}};var _0x419bf7={};var _0x58bad2={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa861('0x6e')]({'where':{'id':_0x32040a[_0xa861('0x54')]['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0x4fd27e,null))[_0xa861('0x1e')](function(_0xec98c3){if(_0xec98c3){_0x419bf7[_0xa861('0x41')]=_[_0xa861('0x44')](db[_0xa861('0x8f')][_0xa861('0x3e')]);_0x419bf7[_0xa861('0x43')]=_[_0xa861('0x44')](_0x32040a[_0xa861('0x43')]);_0x419bf7['filters']=_[_0xa861('0x46')](_0x419bf7[_0xa861('0x41')],_0x419bf7['query']);_0x976c84[_0xa861('0x47')]=_[_0xa861('0x46')](_0x419bf7['model'],qs[_0xa861('0x48')](_0x32040a['query'][_0xa861('0x48')]));_0x976c84[_0xa861('0x47')]=_0x976c84['attributes'][_0xa861('0x56')]?_0x976c84[_0xa861('0x47')]:_0x419bf7['model'];if(!_0x32040a[_0xa861('0x43')][_0xa861('0x49')](_0xa861('0x66'))){_0x976c84['limit']=qs[_0xa861('0x2e')](_0x32040a[_0xa861('0x43')]['limit']);_0x976c84[_0xa861('0x2c')]=qs[_0xa861('0x2c')](_0x32040a[_0xa861('0x43')][_0xa861('0x2c')]);}_0x976c84[_0xa861('0x67')]=qs[_0xa861('0x4a')](_0x32040a[_0xa861('0x43')][_0xa861('0x4a')]);_0x976c84[_0xa861('0x4b')]=qs['filters'](_[_0xa861('0x68')](_0x32040a[_0xa861('0x43')],_0x419bf7[_0xa861('0x45')]));_0x976c84[_0xa861('0x4b')][_0xa861('0x69')]=_0xec98c3['id'];if(_0x32040a[_0xa861('0x43')][_0xa861('0x4e')]){_0x976c84['where']=_[_0xa861('0x4c')](_0x976c84[_0xa861('0x4b')],{'$or':_['map'](_0x976c84[_0xa861('0x47')],function(_0x250e69){var _0x3f8099={};_0x3f8099[_0x250e69]={'$like':'%'+_0x32040a['query'][_0xa861('0x4e')]+'%'};return _0x3f8099;})});}_0x976c84=_['merge']({},_0x976c84,_0x32040a[_0xa861('0x4f')]);return db['OpenchannelInteraction'][_0xa861('0x2f')]({'where':_0x976c84[_0xa861('0x4b')]})['then'](function(_0x250877){_0x58bad2[_0xa861('0x2f')]=_0x250877;if(_0x32040a[_0xa861('0x43')]['includeAll']){_0x976c84['include']=[{'model':db[_0xa861('0x73')],'as':'Contact','required':![]},{'model':db[_0xa861('0x9d')],'as':_0xa861('0xad'),'attributes':[_0xa861('0x39'),_0xa861('0xae'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xa861('0xaf'),'attributes':['id',_0xa861('0x39'),_0xa861('0xb0')],'where':_0x32040a[_0xa861('0x43')][_0xa861('0xb1')]?{'id':_0x32040a['query'][_0xa861('0xb1')]}:undefined,'required':_0x32040a[_0xa861('0x43')][_0xa861('0xb1')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xa861('0x52')](_0x976c84);})[_0xa861('0x1e')](function(_0x5582af){_0x58bad2[_0xa861('0x6a')]=_0x5582af;return _0x58bad2;});}})[_0xa861('0x1e')](respondWithFilteredResult(_0x4fd27e,_0x976c84))[_0xa861('0x27')](handleError(_0x4fd27e,null));};exports[_0xa861('0xb2')]=function(_0x33a325,_0x46d314,_0x3b83f1){return db[_0xa861('0x3d')]['find']({'where':{'id':_0x33a325['params']['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0x46d314,null))[_0xa861('0x1e')](function(_0x5978c0){if(_0x5978c0){return _0x5978c0[_0xa861('0xb2')](_0x33a325[_0xa861('0x58')]['ids'],_[_0xa861('0xb3')](_0x33a325[_0xa861('0x58')],[_0xa861('0x70'),'id'])||{})['spread'](function(_0x566953){for(var _0x3adb2d=0x0;_0x3adb2d<_0x33a325[_0xa861('0x58')][_0xa861('0x70')][_0xa861('0x56')];_0x3adb2d+=0x1){socket[_0xa861('0xb4')](_0xa861('0xb5'),{'UserId':Number(_0x33a325['body'][_0xa861('0x70')][_0x3adb2d]),'OpenchannelAccountId':Number(_0x33a325[_0xa861('0x54')]['id'])});}return _0x566953;});}})[_0xa861('0x1e')](respondWithResult(_0x46d314,null))[_0xa861('0x27')](handleError(_0x46d314,null));};exports['removeAgents']=function(_0x582d26,_0x572941,_0x35c75){return db[_0xa861('0x3d')][_0xa861('0x61')]({'where':{'id':_0x582d26['params']['id']}})['then'](handleEntityNotFound(_0x572941,null))[_0xa861('0x1e')](function(_0x868411){if(_0x868411){return _0x868411[_0xa861('0xb6')](_0x582d26[_0xa861('0x43')][_0xa861('0x70')])[_0xa861('0x1e')](function(){if(_[_0xa861('0xb7')](_0x582d26['query'][_0xa861('0x70')])){for(var _0x119346=0x0;_0x119346<_0x582d26[_0xa861('0x43')][_0xa861('0x70')][_0xa861('0x56')];_0x119346+=0x1){socket[_0xa861('0xb4')](_0xa861('0xb8'),{'UserId':Number(_0x582d26[_0xa861('0x43')][_0xa861('0x70')][_0x119346]),'OpenchannelAccountId':Number(_0x582d26[_0xa861('0x54')]['id'])});}}else{socket[_0xa861('0xb4')](_0xa861('0xb8'),{'UserId':Number(_0x582d26[_0xa861('0x43')]['ids']),'OpenchannelAccountId':Number(_0x582d26['params']['id'])});}});}})['then'](respondWithStatusCode(_0x572941,null))['catch'](handleError(_0x572941,null));};exports[_0xa861('0xb9')]=function(_0x27ccbb,_0x287a7d,_0x5e88e4){var _0x32513c={};var _0x1337b7={};var _0x320aed;var _0x5b7f4a;return db[_0xa861('0x3d')]['findOne']({'where':{'id':_0x27ccbb[_0xa861('0x54')]['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0x287a7d,null))[_0xa861('0x1e')](function(_0xb71c2b){if(_0xb71c2b){_0x320aed=_0xb71c2b;_0x1337b7[_0xa861('0x41')]=_[_0xa861('0x44')](db[_0xa861('0x9d')]['rawAttributes']);_0x1337b7[_0xa861('0x43')]=_[_0xa861('0x44')](_0x27ccbb[_0xa861('0x43')]);_0x1337b7['filters']=_[_0xa861('0x46')](_0x1337b7['model'],_0x1337b7['query']);_0x32513c[_0xa861('0x47')]=_['intersection'](_0x1337b7['model'],qs['fields'](_0x27ccbb[_0xa861('0x43')][_0xa861('0x48')]));_0x32513c[_0xa861('0x47')]=_0x32513c[_0xa861('0x47')]['length']?_0x32513c['attributes']:_0x1337b7[_0xa861('0x41')];_0x32513c[_0xa861('0x67')]=qs['sort'](_0x27ccbb[_0xa861('0x43')]['sort']);_0x32513c['where']=qs[_0xa861('0x45')](_['pick'](_0x27ccbb[_0xa861('0x43')],_0x1337b7[_0xa861('0x45')]));if(_0x27ccbb[_0xa861('0x43')][_0xa861('0x4e')]){_0x32513c['where']=_[_0xa861('0x4c')](_0x32513c['where'],{'$or':_[_0xa861('0x42')](_0x32513c['attributes'],function(_0x574145){var _0x3c4bc6={};_0x3c4bc6[_0x574145]={'$like':'%'+_0x27ccbb[_0xa861('0x43')][_0xa861('0x4e')]+'%'};return _0x3c4bc6;})});}_0x32513c=_['merge']({},_0x32513c,_0x27ccbb[_0xa861('0x4f')]);return _0x320aed[_0xa861('0xb9')](_0x32513c);}})['then'](function(_0x9538a5){if(_0x9538a5){_0x5b7f4a=_0x9538a5['length'];if(!_0x27ccbb[_0xa861('0x43')]['hasOwnProperty']('nolimit')){_0x32513c['limit']=qs[_0xa861('0x2e')](_0x27ccbb[_0xa861('0x43')][_0xa861('0x2e')]);_0x32513c[_0xa861('0x2c')]=qs[_0xa861('0x2c')](_0x27ccbb[_0xa861('0x43')][_0xa861('0x2c')]);}return _0x320aed['getAgents'](_0x32513c);}})[_0xa861('0x1e')](function(_0x3ad3f7){if(_0x3ad3f7){return _0x3ad3f7?{'count':_0x5b7f4a,'rows':_0x3ad3f7}:null;}})[_0xa861('0x1e')](respondWithResult(_0x287a7d,null))[_0xa861('0x27')](handleError(_0x287a7d,null));};exports['send']=function(_0x5155ff,_0x1e6125,_0x4f9d94){var _0x43de59,_0x54867c,_0x4faa96;if(_[_0xa861('0xba')](_0x5155ff[_0xa861('0x58')]['body'])||_0x5155ff['body'][_0xa861('0x58')]===''){throw new db[(_0xa861('0x74'))][(_0xa861('0x75'))](_0xa861('0x7d'));}if(_['isNil'](_0x5155ff[_0xa861('0x58')]['to'])){}_0x43de59=_0x5155ff[_0xa861('0x58')]['to'];return db[_0xa861('0x3d')]['findOne']({'where':{'id':_0x5155ff[_0xa861('0x54')]['id']}})[_0xa861('0x1e')](handleEntityNotFound(_0x1e6125,null))[_0xa861('0x1e')](function(_0x14ed18){if(_0x14ed18){return db['OpenchannelAccount'][_0xa861('0x61')]({'where':{'id':_0x14ed18['id']},'include':[{'model':db[_0xa861('0xbb')],'as':'List','include':[{'model':db[_0xa861('0x73')],'as':'Contacts','where':{[_0x14ed18[_0xa861('0x80')]]:_0x43de59},'limit':0x1,'order':[[_0xa861('0x78'),'DESC']]}]}]})[_0xa861('0x1e')](handleEntityNotFound(_0x1e6125,null))[_0xa861('0x1e')](function(_0x14dc1a){if(_0x14dc1a&&_0x14dc1a[_0xa861('0x82')]){_0x54867c=_0x14dc1a[_0xa861('0x35')]({'plain':!![]});if(_0x54867c[_0xa861('0x82')]&&_0x54867c['List']['Contacts'][_0xa861('0x56')]){return _0x54867c[_0xa861('0x82')][_0xa861('0x83')][0x0];}return db[_0xa861('0x73')][_0xa861('0x57')](_['defaults'](_0x5155ff[_0xa861('0x58')],{'firstName':_0x43de59,[_0x14dc1a[_0xa861('0x80')]]:_0x43de59,'phone':_0x43de59,'ListId':_0x54867c[_0xa861('0x7a')]}));}})['then'](handleEntityNotFound(_0x1e6125,null))[_0xa861('0x1e')](function(_0xc6b66c){if(_0xc6b66c){_0x4faa96=_0xc6b66c;return db['OpenchannelInteraction'][_0xa861('0x61')]({'where':{'ContactId':_0x4faa96['id'],'closed':![],'OpenchannelAccountId':_0x54867c['id']}})[_0xa861('0x1e')](function(_0x114f0c){if(_0x114f0c){return[_0x114f0c,![]];}return db['OpenchannelInteraction'][_0xa861('0x57')]({'UserId':_0x5155ff['user']['id'],'ContactId':_0x4faa96['id'],'OpenchannelAccountId':_0x54867c['id'],'lastMsgDirection':_0xa861('0xbc'),'firstMsgDirection':_0xa861('0xbc'),'Messages':[_[_0xa861('0x4c')](_0x5155ff[_0xa861('0x58')],{'read':![],'body':_0x5155ff[_0xa861('0x58')][_0xa861('0x58')],'OpenchannelAccountId':_0x54867c['id'],'UserId':_0x5155ff[_0xa861('0x59')]['id'],'ContactId':_0x4faa96['id']})]},{'include':[{'model':db[_0xa861('0x9b')],'as':_0xa861('0xbd')}]})[_0xa861('0x1e')](function(_0xa11ad0){return[_0xa11ad0,!![]];});});}})[_0xa861('0x91')](function(_0x15beba,_0x3bb74b){if(_0x3bb74b){return _0x15beba;}return db[_0xa861('0x9b')][_0xa861('0x57')](_[_0xa861('0x4c')](_0x5155ff[_0xa861('0x58')],{'read':![],'body':_0x5155ff['body'][_0xa861('0x58')],'OpenchannelAccountId':_0x54867c['id'],'OpenchannelInteractionId':_0x15beba['id'],'UserId':_0x5155ff['user']['id'],'ContactId':_0x4faa96['id']}))[_0xa861('0x1e')](function(_0x51bb82){_0x15beba[_0xa861('0xbe')]['Messages']=[];_0x15beba[_0xa861('0xbe')][_0xa861('0xbd')][_0xa861('0x97')](_0x51bb82[_0xa861('0xbe')]);return _0x15beba;});});}})[_0xa861('0x1e')](respondWithResult(_0x1e6125,null))[_0xa861('0x27')](handleError(_0x1e6125,null));}; \ No newline at end of file +var _0x1782=['userOpenchannelAccount:remove','getAgents','CmList','out','dataValues','Messages','rimraf','zip-dir','moment','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','include','findAll','rows','show','params','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','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','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','asc','account','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','Contact','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray'];(function(_0x1ebca7,_0x5ee2fa){var _0x5a9923=function(_0xd8d07d){while(--_0xd8d07d){_0x1ebca7['push'](_0x1ebca7['shift']());}};_0x5a9923(++_0x5ee2fa);}(_0x1782,0x188));var _0x2178=function(_0x3140d0,_0x1fd2e5){_0x3140d0=_0x3140d0-0x0;var _0x1f478b=_0x1782[_0x3140d0];return _0x1f478b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2178('0x0'));var zipdir=require(_0x2178('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2178('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2178('0x3'));var util=require(_0x2178('0x4'));var path=require('path');var sox=require(_0x2178('0x5'));var csv=require('to-csv');var ejs=require(_0x2178('0x6'));var fs=require('fs');var fs_extra=require(_0x2178('0x7'));var _=require(_0x2178('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2178('0x9'));var deskjs=require(_0x2178('0xa'));var toCsv=require(_0x2178('0xb'));var querystring=require(_0x2178('0xc'));var Papa=require(_0x2178('0xd'));var Redis=require(_0x2178('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2178('0xf'));var as=require(_0x2178('0x10'));var hardwareService=require(_0x2178('0x11'));var logger=require('../../config/logger')(_0x2178('0x12'));var utils=require(_0x2178('0x13'));var config=require(_0x2178('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2178('0x15'))['db'];config['redis']=_[_0x2178('0x16')](config[_0x2178('0x17')],{'host':_0x2178('0x18'),'port':0x18eb});var socket=require(_0x2178('0x19'))(new Redis(config[_0x2178('0x17')]));require(_0x2178('0x1a'))[_0x2178('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2178('0x1c')][_0x2178('0x1d')]({'port':0x232c});var client9002=jayson[_0x2178('0x1c')][_0x2178('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3808d7,_0x461ab6,_0x3ac64d,_0x50c5f2){return new BPromise(function(_0xc75c80,_0x5a8115){var _0x492882=_0x50c5f2||client;return _0x492882[_0x2178('0x1e')](_0x3808d7,_0x3ac64d)[_0x2178('0x1f')](function(_0x2b9604){logger[_0x2178('0x20')](_0x2178('0x21'),_0x461ab6,_0x2178('0x22'));logger[_0x2178('0x23')](_0x2178('0x24'),_0x461ab6,_0x2178('0x22'),JSON[_0x2178('0x25')](_0x2b9604));if(_0x2b9604['error']){if(_0x2b9604[_0x2178('0x26')][_0x2178('0x27')]===0x1f4){logger[_0x2178('0x26')](_0x2178('0x21'),_0x461ab6,_0x2b9604[_0x2178('0x26')][_0x2178('0x28')]);return _0x5a8115(_0x2b9604[_0x2178('0x26')]['message']);}logger[_0x2178('0x26')](_0x2178('0x21'),_0x461ab6,_0x2b9604[_0x2178('0x26')][_0x2178('0x28')]);return _0xc75c80(_0x2b9604[_0x2178('0x26')][_0x2178('0x28')]);}else{logger['info'](_0x2178('0x21'),_0x461ab6,_0x2178('0x22'));_0xc75c80(_0x2b9604[_0x2178('0x29')][_0x2178('0x28')]);}})[_0x2178('0x2a')](function(_0x18fae4){logger[_0x2178('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x461ab6,_0x18fae4);_0x5a8115(_0x18fae4);});});}function respondWithStatusCode(_0x31b849,_0x4cac73){_0x4cac73=_0x4cac73||0xcc;return function(_0x1c0ed8){if(_0x1c0ed8){return _0x31b849[_0x2178('0x2b')](_0x4cac73);}return _0x31b849[_0x2178('0x2c')](_0x4cac73)[_0x2178('0x2d')]();};}function respondWithResult(_0x5aab3a,_0x2edce3){_0x2edce3=_0x2edce3||0xc8;return function(_0x342448){if(_0x342448){return _0x5aab3a[_0x2178('0x2c')](_0x2edce3)[_0x2178('0x2e')](_0x342448);}};}function respondWithFilteredResult(_0x4321b3,_0x2d030d){return function(_0x28c0a3){if(_0x28c0a3){var _0x1580d2=typeof _0x2d030d[_0x2178('0x2f')]===_0x2178('0x30')&&typeof _0x2d030d[_0x2178('0x31')]===_0x2178('0x30');var _0x864ee8=_0x28c0a3['count'];var _0x8eb8c8=_0x1580d2?0x0:_0x2d030d[_0x2178('0x2f')];var _0x30fd5f=_0x1580d2?_0x28c0a3[_0x2178('0x32')]:_0x2d030d[_0x2178('0x2f')]+_0x2d030d[_0x2178('0x31')];var _0x3782ac;if(_0x30fd5f>=_0x864ee8){_0x30fd5f=_0x864ee8;_0x3782ac=0xc8;}else{_0x3782ac=0xce;}_0x4321b3[_0x2178('0x2c')](_0x3782ac);return _0x4321b3['set']('Content-Range',_0x8eb8c8+'-'+_0x30fd5f+'/'+_0x864ee8)[_0x2178('0x2e')](_0x28c0a3);}return null;};}function patchUpdates(_0x4db342){return function(_0xdd1a91){try{jsonpatch[_0x2178('0x33')](_0xdd1a91,_0x4db342,!![]);}catch(_0x2cbcae){return BPromise[_0x2178('0x34')](_0x2cbcae);}return _0xdd1a91[_0x2178('0x35')]();};}function saveUpdates(_0x25f70f,_0x51473b){return function(_0x4ebf33){if(_0x4ebf33){return _0x4ebf33[_0x2178('0x36')](_0x25f70f)[_0x2178('0x1f')](function(_0x2b60d6){return _0x2b60d6;});}return null;};}function removeEntity(_0x1297e3,_0x49ab2f){return function(_0x4b1830){if(_0x4b1830){return _0x4b1830[_0x2178('0x37')]()[_0x2178('0x1f')](function(){var _0x17e3cb=_0x4b1830[_0x2178('0x38')]({'plain':!![]});var _0xf4df67=_0x2178('0x39');return db[_0x2178('0x3a')]['destroy']({'where':{'type':_0xf4df67,'resourceId':_0x17e3cb['id']}})[_0x2178('0x1f')](function(){return _0x4b1830;});})[_0x2178('0x1f')](function(){_0x1297e3[_0x2178('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e6d3,_0x2ee9fb){return function(_0x108472){if(!_0x108472){_0x51e6d3[_0x2178('0x2b')](0x194);}return _0x108472;};}function handleError(_0x3bdc80,_0x53c9bb){_0x53c9bb=_0x53c9bb||0x1f4;return function(_0x1ed8ce){logger[_0x2178('0x26')](_0x1ed8ce[_0x2178('0x3b')]);if(_0x1ed8ce[_0x2178('0x3c')]){delete _0x1ed8ce[_0x2178('0x3c')];}_0x3bdc80[_0x2178('0x2c')](_0x53c9bb)['send'](_0x1ed8ce);};}exports[_0x2178('0x3d')]=function(_0x2e22a4,_0x5f17cd){var _0x54570e={'include':[{'model':db['Pause'],'as':_0x2178('0x3e')}]},_0x18818e={},_0x465e00={'count':0x0,'rows':[]};var _0x28afe1=_[_0x2178('0x3f')](db[_0x2178('0x40')][_0x2178('0x41')],function(_0x4112f6){return{'name':_0x4112f6[_0x2178('0x42')],'type':_0x4112f6[_0x2178('0x43')][_0x2178('0x44')]};});_0x18818e[_0x2178('0x45')]=_[_0x2178('0x3f')](_0x28afe1,'name');_0x18818e[_0x2178('0x46')]=_[_0x2178('0x47')](_0x2e22a4[_0x2178('0x46')]);_0x18818e[_0x2178('0x48')]=_['intersection'](_0x18818e['model'],_0x18818e[_0x2178('0x46')]);_0x54570e[_0x2178('0x49')]=_[_0x2178('0x4a')](_0x18818e[_0x2178('0x45')],qs['fields'](_0x2e22a4['query'][_0x2178('0x4b')]));_0x54570e[_0x2178('0x49')]=_0x54570e[_0x2178('0x49')]['length']?_0x54570e[_0x2178('0x49')]:_0x18818e[_0x2178('0x45')];if(!_0x2e22a4[_0x2178('0x46')]['hasOwnProperty'](_0x2178('0x4c'))){_0x54570e['limit']=qs[_0x2178('0x31')](_0x2e22a4[_0x2178('0x46')][_0x2178('0x31')]);_0x54570e[_0x2178('0x2f')]=qs[_0x2178('0x2f')](_0x2e22a4[_0x2178('0x46')][_0x2178('0x2f')]);}_0x54570e['order']=qs[_0x2178('0x4d')](_0x2e22a4[_0x2178('0x46')][_0x2178('0x4d')]);_0x54570e[_0x2178('0x4e')]=qs['filters'](_[_0x2178('0x4f')](_0x2e22a4[_0x2178('0x46')],_0x18818e[_0x2178('0x48')]),_0x28afe1);if(_0x2e22a4['query'][_0x2178('0x50')]){_0x54570e[_0x2178('0x4e')]=_['merge'](_0x54570e[_0x2178('0x4e')],{'$or':_[_0x2178('0x3f')](_0x28afe1,function(_0x5b4f5e){if(_0x5b4f5e[_0x2178('0x43')]!=='VIRTUAL'){var _0x4e94ad={};_0x4e94ad[_0x5b4f5e[_0x2178('0x3c')]]={'$like':'%'+_0x2e22a4['query'][_0x2178('0x50')]+'%'};return _0x4e94ad;}})});}_0x54570e=_[_0x2178('0x51')]({},_0x54570e,_0x2e22a4['options']);var _0x5cfbfc={'where':_0x54570e[_0x2178('0x4e')]};return db[_0x2178('0x40')][_0x2178('0x32')](_0x5cfbfc)['then'](function(_0x32ca07){_0x465e00[_0x2178('0x32')]=_0x32ca07;if(_0x2e22a4[_0x2178('0x46')]['includeAll']){_0x54570e[_0x2178('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x2178('0x53')](_0x54570e);})[_0x2178('0x1f')](function(_0x209319){_0x465e00[_0x2178('0x54')]=_0x209319;return _0x465e00;})['then'](respondWithFilteredResult(_0x5f17cd,_0x54570e))[_0x2178('0x2a')](handleError(_0x5f17cd,null));};exports[_0x2178('0x55')]=function(_0x53c105,_0x4e3b9d){var _0x3662a0={'raw':![],'where':{'id':_0x53c105[_0x2178('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x2178('0x3e')}]},_0xe4a4f5={};_0xe4a4f5[_0x2178('0x45')]=_[_0x2178('0x47')](db[_0x2178('0x40')][_0x2178('0x41')]);_0xe4a4f5[_0x2178('0x46')]=_[_0x2178('0x47')](_0x53c105[_0x2178('0x46')]);_0xe4a4f5[_0x2178('0x48')]=_[_0x2178('0x4a')](_0xe4a4f5[_0x2178('0x45')],_0xe4a4f5[_0x2178('0x46')]);_0x3662a0['attributes']=_['intersection'](_0xe4a4f5[_0x2178('0x45')],qs[_0x2178('0x4b')](_0x53c105[_0x2178('0x46')][_0x2178('0x4b')]));_0x3662a0[_0x2178('0x49')]=_0x3662a0[_0x2178('0x49')][_0x2178('0x57')]?_0x3662a0[_0x2178('0x49')]:_0xe4a4f5['model'];if(_0x53c105[_0x2178('0x46')][_0x2178('0x58')]){_0x3662a0[_0x2178('0x52')]=[{'all':!![]}];}_0x3662a0=_[_0x2178('0x51')]({},_0x3662a0,_0x53c105[_0x2178('0x59')]);return db[_0x2178('0x40')][_0x2178('0x5a')](_0x3662a0)['then'](handleEntityNotFound(_0x4e3b9d,null))[_0x2178('0x1f')](respondWithResult(_0x4e3b9d,null))[_0x2178('0x2a')](handleError(_0x4e3b9d,null));};exports[_0x2178('0x5b')]=function(_0x1cf44e,_0x476fa8){return db[_0x2178('0x40')][_0x2178('0x5b')](_0x1cf44e[_0x2178('0x5c')],{})['then'](function(_0x2f8faf){var _0x36d81a=_0x1cf44e[_0x2178('0x5d')]['get']({'plain':!![]});if(!_0x36d81a)throw new Error(_0x2178('0x5e'));if(_0x36d81a[_0x2178('0x5f')]===_0x2178('0x5d')){var _0x1bc6ee=_0x2f8faf[_0x2178('0x38')]({'plain':!![]});var _0x3697a9=_0x2178('0x39');return db[_0x2178('0x60')][_0x2178('0x5a')]({'where':{'name':_0x3697a9,'userProfileId':_0x36d81a[_0x2178('0x61')]},'raw':!![]})[_0x2178('0x1f')](function(_0x303c54){if(_0x303c54&&_0x303c54[_0x2178('0x62')]===0x0){return db['UserProfileResource'][_0x2178('0x5b')]({'name':_0x1bc6ee['name'],'resourceId':_0x1bc6ee['id'],'type':_0x303c54[_0x2178('0x3c')],'sectionId':_0x303c54['id']},{})[_0x2178('0x1f')](function(){return _0x2f8faf;});}else{return _0x2f8faf;}})[_0x2178('0x2a')](function(_0x37cbfd){logger[_0x2178('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37cbfd);throw _0x37cbfd;});}return _0x2f8faf;})[_0x2178('0x1f')](respondWithResult(_0x476fa8,0xc9))['catch'](handleError(_0x476fa8,null));};exports['update']=function(_0x297d2f,_0x442b58){if(_0x297d2f[_0x2178('0x5c')]['id']){delete _0x297d2f['body']['id'];}return db['OpenchannelAccount'][_0x2178('0x5a')]({'where':{'id':_0x297d2f['params']['id']},'include':[{'model':db[_0x2178('0x63')],'as':_0x2178('0x3e')}]})[_0x2178('0x1f')](handleEntityNotFound(_0x442b58,null))[_0x2178('0x1f')](saveUpdates(_0x297d2f[_0x2178('0x5c')],null))[_0x2178('0x1f')](respondWithResult(_0x442b58,null))[_0x2178('0x2a')](handleError(_0x442b58,null));};exports['destroy']=function(_0x320867,_0x39e565){return db[_0x2178('0x40')][_0x2178('0x5a')]({'where':{'id':_0x320867[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x39e565,null))['then'](removeEntity(_0x39e565,null))[_0x2178('0x2a')](handleError(_0x39e565,null));};exports[_0x2178('0x64')]=function(_0x32ed43,_0x99dcef){return db[_0x2178('0x40')][_0x2178('0x64')]()[_0x2178('0x1f')](respondWithResult(_0x99dcef,null))[_0x2178('0x2a')](handleError(_0x99dcef,null));};exports[_0x2178('0x65')]=function(_0x169318,_0x42b558,_0x2f601e){if(_0x169318[_0x2178('0x5c')]['id']){delete _0x169318[_0x2178('0x5c')]['id'];}return db[_0x2178('0x40')][_0x2178('0x5a')]({'where':{'id':_0x169318[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x42b558,null))[_0x2178('0x1f')](function(_0x2edf8b){if(_0x2edf8b){_0x169318[_0x2178('0x5c')][_0x2178('0x66')]=_0x2edf8b['id'];return db[_0x2178('0x67')][_0x2178('0x5b')](_0x169318['body']);}})[_0x2178('0x1f')](respondWithResult(_0x42b558,null))[_0x2178('0x2a')](handleError(_0x42b558,null));};exports['getDispositions']=function(_0x46ec25,_0x2f79b4,_0x4ac87e){var _0x16b4e6={'raw':![],'where':{}};var _0x275188={};var _0x2e24={'count':0x0,'rows':[]};return db[_0x2178('0x40')][_0x2178('0x68')]({'where':{'id':_0x46ec25['params']['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x2f79b4,null))['then'](function(_0x4fc61e){if(_0x4fc61e){_0x275188['model']=_[_0x2178('0x47')](db[_0x2178('0x67')][_0x2178('0x41')]);_0x275188[_0x2178('0x46')]=_[_0x2178('0x47')](_0x46ec25[_0x2178('0x46')]);_0x275188[_0x2178('0x48')]=_[_0x2178('0x4a')](_0x275188[_0x2178('0x45')],_0x275188[_0x2178('0x46')]);_0x16b4e6['attributes']=_[_0x2178('0x4a')](_0x275188[_0x2178('0x45')],qs[_0x2178('0x4b')](_0x46ec25[_0x2178('0x46')][_0x2178('0x4b')]));_0x16b4e6[_0x2178('0x49')]=_0x16b4e6[_0x2178('0x49')]['length']?_0x16b4e6[_0x2178('0x49')]:_0x275188[_0x2178('0x45')];if(!_0x46ec25['query'][_0x2178('0x69')](_0x2178('0x4c'))){_0x16b4e6[_0x2178('0x31')]=qs[_0x2178('0x31')](_0x46ec25[_0x2178('0x46')][_0x2178('0x31')]);_0x16b4e6[_0x2178('0x2f')]=qs[_0x2178('0x2f')](_0x46ec25[_0x2178('0x46')][_0x2178('0x2f')]);}_0x16b4e6[_0x2178('0x6a')]=qs[_0x2178('0x4d')](_0x46ec25[_0x2178('0x46')]['sort']);_0x16b4e6[_0x2178('0x4e')]=qs['filters'](_[_0x2178('0x4f')](_0x46ec25[_0x2178('0x46')],_0x275188['filters']));_0x16b4e6[_0x2178('0x4e')][_0x2178('0x66')]=_0x4fc61e['id'];if(_0x46ec25[_0x2178('0x46')][_0x2178('0x50')]){_0x16b4e6['where']=_[_0x2178('0x51')](_0x16b4e6[_0x2178('0x4e')],{'$or':_['map'](_0x16b4e6[_0x2178('0x49')],function(_0x27fe76){var _0x5120a1={};_0x5120a1[_0x27fe76]={'$like':'%'+_0x46ec25[_0x2178('0x46')][_0x2178('0x50')]+'%'};return _0x5120a1;})});}_0x16b4e6=_[_0x2178('0x51')]({},_0x16b4e6,_0x46ec25[_0x2178('0x59')]);return db[_0x2178('0x67')][_0x2178('0x32')]({'where':_0x16b4e6['where']})[_0x2178('0x1f')](function(_0x4ec559){_0x2e24[_0x2178('0x32')]=_0x4ec559;if(_0x46ec25[_0x2178('0x46')][_0x2178('0x58')]){_0x16b4e6['include']=[{'all':!![]}];}return db[_0x2178('0x67')][_0x2178('0x53')](_0x16b4e6);})['then'](function(_0x23586e){_0x2e24[_0x2178('0x54')]=_0x23586e;return _0x2e24;});}})['then'](respondWithFilteredResult(_0x2f79b4,_0x16b4e6))[_0x2178('0x2a')](handleError(_0x2f79b4,null));};exports[_0x2178('0x6b')]=function(_0x3eec23,_0x57ec96,_0x33b38a){return db[_0x2178('0x40')]['find']({'where':{'id':_0x3eec23[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x57ec96,null))[_0x2178('0x1f')](function(_0x431ce7){if(_0x431ce7){return _0x431ce7[_0x2178('0x6b')](_0x3eec23[_0x2178('0x46')][_0x2178('0x6c')]);}})[_0x2178('0x1f')](respondWithStatusCode(_0x57ec96,null))[_0x2178('0x2a')](handleError(_0x57ec96,null));};exports[_0x2178('0x6d')]=function(_0x5ac6ac,_0x15cbcc,_0x115521){if(_0x5ac6ac[_0x2178('0x5c')]['id']){delete _0x5ac6ac[_0x2178('0x5c')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x5ac6ac[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x15cbcc,null))[_0x2178('0x1f')](function(_0x2591c9){if(_0x2591c9){_0x5ac6ac[_0x2178('0x5c')][_0x2178('0x66')]=_0x2591c9['id'];return db['CannedAnswer'][_0x2178('0x5b')](_0x5ac6ac[_0x2178('0x5c')]);}})['then'](respondWithResult(_0x15cbcc,null))[_0x2178('0x2a')](handleError(_0x15cbcc,null));};exports[_0x2178('0x6e')]=function(_0x330a09,_0x31ab3a,_0x3de4a0){var _0x2c85cf={'raw':![],'where':{}};var _0x397781={};var _0x53540b={'count':0x0,'rows':[]};return db[_0x2178('0x40')][_0x2178('0x68')]({'where':{'id':_0x330a09[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x31ab3a,null))[_0x2178('0x1f')](function(_0x23ff60){if(_0x23ff60){_0x397781['model']=_['keys'](db[_0x2178('0x6f')][_0x2178('0x41')]);_0x397781[_0x2178('0x46')]=_[_0x2178('0x47')](_0x330a09[_0x2178('0x46')]);_0x397781[_0x2178('0x48')]=_[_0x2178('0x4a')](_0x397781[_0x2178('0x45')],_0x397781[_0x2178('0x46')]);_0x2c85cf['attributes']=_['intersection'](_0x397781[_0x2178('0x45')],qs[_0x2178('0x4b')](_0x330a09[_0x2178('0x46')]['fields']));_0x2c85cf[_0x2178('0x49')]=_0x2c85cf[_0x2178('0x49')][_0x2178('0x57')]?_0x2c85cf[_0x2178('0x49')]:_0x397781[_0x2178('0x45')];if(!_0x330a09[_0x2178('0x46')][_0x2178('0x69')](_0x2178('0x4c'))){_0x2c85cf[_0x2178('0x31')]=qs['limit'](_0x330a09[_0x2178('0x46')]['limit']);_0x2c85cf[_0x2178('0x2f')]=qs[_0x2178('0x2f')](_0x330a09['query'][_0x2178('0x2f')]);}_0x2c85cf[_0x2178('0x6a')]=qs[_0x2178('0x4d')](_0x330a09['query']['sort']);_0x2c85cf[_0x2178('0x4e')]=qs['filters'](_[_0x2178('0x4f')](_0x330a09['query'],_0x397781['filters']));_0x2c85cf[_0x2178('0x4e')][_0x2178('0x66')]=_0x23ff60['id'];if(_0x330a09[_0x2178('0x46')][_0x2178('0x50')]){_0x2c85cf[_0x2178('0x4e')]=_['merge'](_0x2c85cf[_0x2178('0x4e')],{'$or':_[_0x2178('0x3f')](_0x2c85cf[_0x2178('0x49')],function(_0x3134d2){var _0x1bf92b={};_0x1bf92b[_0x3134d2]={'$like':'%'+_0x330a09['query'][_0x2178('0x50')]+'%'};return _0x1bf92b;})});}_0x2c85cf=_[_0x2178('0x51')]({},_0x2c85cf,_0x330a09[_0x2178('0x59')]);return db[_0x2178('0x6f')][_0x2178('0x32')]({'where':_0x2c85cf[_0x2178('0x4e')]})[_0x2178('0x1f')](function(_0x5247e1){_0x53540b[_0x2178('0x32')]=_0x5247e1;if(_0x330a09[_0x2178('0x46')]['includeAll']){_0x2c85cf[_0x2178('0x52')]=[{'all':!![]}];}return db[_0x2178('0x6f')][_0x2178('0x53')](_0x2c85cf);})[_0x2178('0x1f')](function(_0x4a4afc){_0x53540b[_0x2178('0x54')]=_0x4a4afc;return _0x53540b;});}})[_0x2178('0x1f')](respondWithFilteredResult(_0x31ab3a,_0x2c85cf))['catch'](handleError(_0x31ab3a,null));};exports[_0x2178('0x70')]=function(_0x3a2a26,_0x159133,_0x300587){return db[_0x2178('0x40')][_0x2178('0x5a')]({'where':{'id':_0x3a2a26[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x159133,null))[_0x2178('0x1f')](function(_0x58f43a){if(_0x58f43a){return _0x58f43a[_0x2178('0x70')](_0x3a2a26[_0x2178('0x46')][_0x2178('0x6c')]);}})['then'](respondWithStatusCode(_0x159133,null))[_0x2178('0x2a')](handleError(_0x159133,null));};exports[_0x2178('0x71')]=function(_0x2558fd,_0x7763c1,_0x2f1647){var _0x3a4846={'body':_0x2558fd[_0x2178('0x5c')],'channel':_0x2178('0x72')};var _0x25dbb4=[];var _0x43d9a5=[];var _0x28815b={};var _0x29948c=![];return db[_0x2178('0x73')][_0x2178('0x64')]()[_0x2178('0x1f')](function(_0x419c56){if(!_0x419c56){throw new db[(_0x2178('0x74'))][(_0x2178('0x75'))](_0x2178('0x76'));}_0x25dbb4=_[_0x2178('0x77')](_[_0x2178('0x47')](_0x419c56),[_0x2178('0x78'),'updatedAt']);_0x43d9a5=_[_0x2178('0x77')](_[_0x2178('0x47')](_0x419c56),['createdAt',_0x2178('0x79'),_0x2178('0x7a'),_0x2178('0x7b')]);if(_0x2558fd[_0x2178('0x5c')]['id']){delete _0x2558fd[_0x2178('0x5c')]['id'];}if(_[_0x2178('0x7c')](_0x2558fd[_0x2178('0x5c')][_0x2178('0x7d')])){throw new db[(_0x2178('0x74'))]['ValidationError'](_0x2178('0x7e'));}if(_['isNil'](_0x2558fd[_0x2178('0x5c')][_0x2178('0x5c')])||_0x2558fd[_0x2178('0x5c')][_0x2178('0x5c')]===''){throw new db[(_0x2178('0x74'))][(_0x2178('0x75'))](_0x2178('0x7f'));}if(_[_0x2178('0x7c')](_0x2558fd[_0x2178('0x5c')][_0x2178('0x80')])){throw new db[(_0x2178('0x74'))][(_0x2178('0x75'))](_0x2178('0x81')+_0x43d9a5);}if(!_[_0x2178('0x82')](_0x43d9a5,_0x2558fd['body'][_0x2178('0x80')])){throw new db[(_0x2178('0x74'))][(_0x2178('0x75'))](_0x2178('0x83')+_0x43d9a5);}_0x28815b[_0x2558fd[_0x2178('0x5c')][_0x2178('0x80')]]=_0x2558fd[_0x2178('0x5c')][_0x2178('0x7d')];})['then'](function(){return db['OpenchannelAccount'][_0x2178('0x5a')]({'where':{'id':_0x2558fd['params']['id']},'include':[{'model':db['CmList'],'as':_0x2178('0x84'),'include':[{'model':db[_0x2178('0x73')],'as':_0x2178('0x85'),'where':_0x28815b,'limit':0x1,'order':[['updatedAt',_0x2178('0x86')]]}]},{'model':db[_0x2178('0x87')],'as':_0x2178('0x88')}]});})[_0x2178('0x1f')](handleEntityNotFound(_0x7763c1,null))[_0x2178('0x1f')](function(_0xbc227b){if(_0xbc227b&&_0xbc227b['List']){_0x3a4846['account']=_0xbc227b;_0x3a4846[_0x2178('0x89')]=_0xbc227b['Applications'];_0x3a4846[_0x2178('0x8a')]=_0xbc227b[_0x2178('0x84')];_0x3a4846[_0x2178('0x89')]=_['orderBy'](_0x3a4846['applications'],['priority'],[_0x2178('0x8b')]);if(_0x3a4846[_0x2178('0x8c')][_0x2178('0x88')]){delete _0x3a4846[_0x2178('0x8c')][_0x2178('0x88')];}if(_0x3a4846[_0x2178('0x8c')][_0x2178('0x84')]&&_0x3a4846['account']['List'][_0x2178('0x85')][_0x2178('0x57')]){return _0x3a4846[_0x2178('0x8c')][_0x2178('0x84')][_0x2178('0x85')][0x0];}var _0x523f0b=_[_0x2178('0x16')](_0x2558fd[_0x2178('0x5c')],{'firstName':_0x2558fd[_0x2178('0x5c')][_0x2178('0x7d')],'ListId':_0xbc227b[_0x2178('0x7b')]});_0x523f0b[_0x2558fd[_0x2178('0x5c')][_0x2178('0x80')]]=_0x2558fd[_0x2178('0x5c')][_0x2178('0x7d')];return db[_0x2178('0x73')][_0x2178('0x5b')](_0x523f0b,{'fields':_0x25dbb4,'raw':!![]});}})['then'](handleEntityNotFound(_0x7763c1,null))[_0x2178('0x1f')](function(_0x2500f3){_0x3a4846['contact']=_0x2500f3;if(_0x2500f3){var _0x5359ba={'ContactId':_0x2500f3['id'],'OpenchannelAccountId':_0x2558fd[_0x2178('0x56')]['id'],'from':(_0x2500f3[_0x2178('0x8d')]||'')+'\x20'+(_0x2500f3[_0x2178('0x8e')]||'')};var _0x5118fa={'OpenchannelAccountId':_0x2558fd[_0x2178('0x56')]['id'],'closed':![]};if(_0x2558fd['body'][_0x2178('0x8f')]){_0x5118fa['threadId']=_0x2558fd[_0x2178('0x5c')]['threadId'];return db['OpenchannelInteraction']['find']({'where':_0x5118fa})[_0x2178('0x1f')](function(_0x16c679){if(_0x16c679){return[_0x16c679,![]];}_0x5359ba[_0x2178('0x8f')]=_0x2558fd[_0x2178('0x5c')][_0x2178('0x8f')];_0x5359ba[_0x2178('0x90')]=_0x2558fd[_0x2178('0x5c')][_0x2178('0x90')];return db['OpenchannelInteraction'][_0x2178('0x5b')](_0x5359ba)[_0x2178('0x1f')](function(_0x398b70){return[_0x398b70,!![]];});});}else{_0x5118fa[_0x2178('0x8f')]=null;}_0x5118fa[_0x2178('0x91')]=_0x2500f3['id'];return db[_0x2178('0x92')][_0x2178('0x5a')]({'where':_0x5118fa})['then'](function(_0x58cc29){if(_0x58cc29){return[_0x58cc29,![]];}return db['OpenchannelInteraction'][_0x2178('0x5b')](_0x5359ba)['then'](function(_0x307a26){return[_0x307a26,!![]];});});}})[_0x2178('0x93')](function(_0x1093bd,_0x5cb02d){if(_0x1093bd){_0x29948c=_0x5cb02d;if(!_0x5cb02d){var _0x5b1797={'from':(_0x3a4846['contact']['firstName']||'')+'\x20'+(_0x3a4846[_0x2178('0x94')]['lastName']||'')};if(_0x2558fd[_0x2178('0x5c')]['threadId']&&_0x2558fd[_0x2178('0x5c')]['messageId']&&_0x2558fd[_0x2178('0x5c')]['threadId']!=_0x2558fd[_0x2178('0x5c')]['messageId']){_0x5b1797[_0x2178('0x8f')]=_0x2558fd[_0x2178('0x5c')][_0x2178('0x95')];}return _0x1093bd['update'](_0x5b1797);}else{return _0x1093bd;}}})['then'](function(_0x59b7db){_0x3a4846[_0x2178('0x96')]=_0x59b7db['get']({'plain':!![]});_0x3a4846['interaction'][_0x2178('0x97')]=_0x29948c;if(_0x3a4846[_0x2178('0x96')]['created']){if(_0x3a4846[_0x2178('0x8c')][_0x2178('0x98')]){_0x3a4846[_0x2178('0x89')][_0x2178('0x99')]({'id':0x0,'priority':_0x3a4846['applications']['length']+0x1,'app':_0x2178('0x9a'),'appdata':_0x2178('0x9b'),'interval':'*,*,*,*'});}}return db[_0x2178('0x9c')]['create']({'body':_0x2558fd[_0x2178('0x5c')]['body'],'OpenchannelAccountId':_0x2558fd['params']['id'],'OpenchannelInteractionId':_0x59b7db['id'],'direction':'in','ContactId':_0x3a4846[_0x2178('0x94')]['id'],'AttachmentId':_0x2558fd['body'][_0x2178('0x9d')]});})[_0x2178('0x1f')](function(_0x2334a1){_0x3a4846[_0x2178('0x28')]=_0x2334a1;if(_0x3a4846['interaction']['UserId']){return db[_0x2178('0x9e')][_0x2178('0x5a')]({'attributes':['id',_0x2178('0x3c')],'where':{'id':_0x3a4846[_0x2178('0x96')]['UserId']}})[_0x2178('0x1f')](function(_0x5a21e5){if(_0x5a21e5){_0x3a4846['applications'][_0x2178('0x9f')]({'id':0x0,'priority':0x0,'app':_0x2178('0xa0'),'appdata':_0x5a21e5[_0x2178('0x3c')]+','+(_0x3a4846[_0x2178('0x8c')][_0x2178('0xa1')]||0xa),'interval':_0x2178('0xa2')});_0x3a4846[_0x2178('0xa3')]=![];}return respondWithRpcPromise(_0x2178('0xa4'),_0x2178('0xa5'),_0x3a4846);});}return respondWithRpcPromise(_0x2178('0xa4'),_0x2178('0xa5'),_0x3a4846);})['then'](function(_0x2169d9){respondWithRpcPromise(_0x2178('0xa6'),_0x2178('0xa6'),{'event':_0x2178('0x71'),'message':_0x2169d9},client9002);return _0x2169d9;})['then'](respondWithResult(_0x7763c1,null))['catch'](handleError(_0x7763c1,null));};exports['addApplications']=function(_0x44cb80,_0x5076f2){var _0x3256d3=_0x44cb80[_0x2178('0x56')]['id'];var _0x3a9ef1=_0x44cb80[_0x2178('0x5c')];var _0x5eb26d=0xc8;var _0x4832b1=null;return db[_0x2178('0xa7')][_0x2178('0xa8')]({'isolationLevel':db[_0x2178('0xa7')][_0x2178('0xa9')][_0x2178('0xaa')][_0x2178('0xab')]},function(_0x407874){return db[_0x2178('0x40')][_0x2178('0x68')]({'where':{'id':_0x3256d3},'transaction':_0x407874})[_0x2178('0x1f')](function(_0x2256c9){if(_0x2256c9){return db[_0x2178('0x87')][_0x2178('0x37')]({'where':{'OpenchannelAccountId':_0x3256d3},'transaction':_0x407874})['then'](function(){var _0x13298e=_[_0x2178('0x3f')](_0x3a9ef1,function(_0x2073bf){_0x2073bf[_0x2178('0x66')]=_0x3256d3;return _0x2073bf;});return db[_0x2178('0x87')][_0x2178('0xac')](_0x13298e,{'transaction':_0x407874});});}else{_0x5eb26d=0x194;_0x4832b1=[];}});})['then'](function(){if(_0x5eb26d!==0x194){return db['OpenchannelApplication'][_0x2178('0xad')]({'where':{'OpenchannelAccountId':_0x3256d3},'order':'priority'})[_0x2178('0x1f')](function(_0x1aca25){_0x4832b1=_0x1aca25;});}})['catch'](function(_0x211ad5){_0x5eb26d=0x1f4;logger[_0x2178('0x26')](_0x211ad5[_0x2178('0x3b')]);if(_0x211ad5[_0x2178('0x3c')]){delete _0x211ad5[_0x2178('0x3c')];}_0x4832b1=_0x211ad5;})[_0x2178('0xae')](function(){if(_0x4832b1===null){_0x5076f2[_0x2178('0x2b')](_0x5eb26d);}else{if(_0x5eb26d===0x1f4){_0x5076f2[_0x2178('0x2c')](_0x5eb26d)[_0x2178('0xaf')](_0x4832b1);}else{_0x5076f2[_0x2178('0x2c')](_0x5eb26d)[_0x2178('0x2e')](_0x4832b1);}}});};exports[_0x2178('0xb0')]=function(_0x2998cf,_0x3629d8,_0x22dbb1){var _0x78afe6={};var _0x180ee1={};var _0x1bd4ca;var _0x46d619;return db[_0x2178('0x40')][_0x2178('0x68')]({'where':{'id':_0x2998cf[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x3629d8,null))[_0x2178('0x1f')](function(_0x11b607){if(_0x11b607){_0x1bd4ca=_0x11b607;_0x180ee1[_0x2178('0x45')]=_[_0x2178('0x47')](db[_0x2178('0x87')][_0x2178('0x41')]);_0x180ee1[_0x2178('0x46')]=_[_0x2178('0x47')](_0x2998cf[_0x2178('0x46')]);_0x180ee1[_0x2178('0x48')]=_['intersection'](_0x180ee1['model'],_0x180ee1[_0x2178('0x46')]);_0x78afe6[_0x2178('0x49')]=_['intersection'](_0x180ee1[_0x2178('0x45')],qs['fields'](_0x2998cf[_0x2178('0x46')]['fields']));_0x78afe6[_0x2178('0x49')]=_0x78afe6['attributes']['length']?_0x78afe6[_0x2178('0x49')]:_0x180ee1[_0x2178('0x45')];_0x78afe6[_0x2178('0x6a')]=qs[_0x2178('0x4d')](_0x2998cf[_0x2178('0x46')][_0x2178('0x4d')]);_0x78afe6[_0x2178('0x4e')]=qs[_0x2178('0x48')](_[_0x2178('0x4f')](_0x2998cf[_0x2178('0x46')],_0x180ee1[_0x2178('0x48')]));if(_0x2998cf[_0x2178('0x46')][_0x2178('0x50')]){_0x78afe6['where']=_['merge'](_0x78afe6[_0x2178('0x4e')],{'$or':_[_0x2178('0x3f')](_0x78afe6[_0x2178('0x49')],function(_0x13e32b){var _0x552e5c={};_0x552e5c[_0x13e32b]={'$like':'%'+_0x2998cf[_0x2178('0x46')]['filter']+'%'};return _0x552e5c;})});}_0x78afe6=_[_0x2178('0x51')]({},_0x78afe6,_0x2998cf[_0x2178('0x59')]);return _0x1bd4ca[_0x2178('0xb0')](_0x78afe6);}})['then'](function(_0x373d06){if(_0x373d06){_0x46d619=_0x373d06[_0x2178('0x57')];if(!_0x2998cf[_0x2178('0x46')][_0x2178('0x69')]('nolimit')){_0x78afe6['limit']=qs[_0x2178('0x31')](_0x2998cf['query'][_0x2178('0x31')]);_0x78afe6[_0x2178('0x2f')]=qs[_0x2178('0x2f')](_0x2998cf['query']['offset']);}return _0x1bd4ca[_0x2178('0xb0')](_0x78afe6);}})[_0x2178('0x1f')](function(_0x21b48e){if(_0x21b48e){return _0x21b48e?{'count':_0x46d619,'rows':_0x21b48e}:null;}})[_0x2178('0x1f')](respondWithResult(_0x3629d8,null))[_0x2178('0x2a')](handleError(_0x3629d8,null));};exports['getInteractions']=function(_0x4aace7,_0x4c1a94,_0x4c085a){var _0x26afd3={'raw':![],'where':{}};var _0x5d03fa={};var _0x1f0d39={'count':0x0,'rows':[]};return db[_0x2178('0x40')]['findOne']({'where':{'id':_0x4aace7['params']['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x4c1a94,null))['then'](function(_0x360e56){if(_0x360e56){_0x5d03fa[_0x2178('0x45')]=_['keys'](db[_0x2178('0x92')]['rawAttributes']);_0x5d03fa[_0x2178('0x46')]=_[_0x2178('0x47')](_0x4aace7[_0x2178('0x46')]);_0x5d03fa[_0x2178('0x48')]=_[_0x2178('0x4a')](_0x5d03fa[_0x2178('0x45')],_0x5d03fa[_0x2178('0x46')]);_0x26afd3[_0x2178('0x49')]=_[_0x2178('0x4a')](_0x5d03fa[_0x2178('0x45')],qs[_0x2178('0x4b')](_0x4aace7['query']['fields']));_0x26afd3[_0x2178('0x49')]=_0x26afd3['attributes'][_0x2178('0x57')]?_0x26afd3[_0x2178('0x49')]:_0x5d03fa['model'];if(!_0x4aace7['query'][_0x2178('0x69')](_0x2178('0x4c'))){_0x26afd3[_0x2178('0x31')]=qs[_0x2178('0x31')](_0x4aace7[_0x2178('0x46')][_0x2178('0x31')]);_0x26afd3['offset']=qs[_0x2178('0x2f')](_0x4aace7[_0x2178('0x46')][_0x2178('0x2f')]);}_0x26afd3[_0x2178('0x6a')]=qs[_0x2178('0x4d')](_0x4aace7['query'][_0x2178('0x4d')]);_0x26afd3[_0x2178('0x4e')]=qs[_0x2178('0x48')](_[_0x2178('0x4f')](_0x4aace7[_0x2178('0x46')],_0x5d03fa[_0x2178('0x48')]));_0x26afd3['where'][_0x2178('0x66')]=_0x360e56['id'];if(_0x4aace7[_0x2178('0x46')][_0x2178('0x50')]){_0x26afd3[_0x2178('0x4e')]=_[_0x2178('0x51')](_0x26afd3[_0x2178('0x4e')],{'$or':_['map'](_0x26afd3['attributes'],function(_0x48237a){var _0x5213d0={};_0x5213d0[_0x48237a]={'$like':'%'+_0x4aace7[_0x2178('0x46')][_0x2178('0x50')]+'%'};return _0x5213d0;})});}_0x26afd3=_[_0x2178('0x51')]({},_0x26afd3,_0x4aace7['options']);return db[_0x2178('0x92')][_0x2178('0x32')]({'where':_0x26afd3[_0x2178('0x4e')]})[_0x2178('0x1f')](function(_0xdc0d9){_0x1f0d39['count']=_0xdc0d9;if(_0x4aace7[_0x2178('0x46')][_0x2178('0x58')]){_0x26afd3['include']=[{'model':db['CmContact'],'as':_0x2178('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x2178('0x3c'),'fullname',_0x2178('0xb2')],'required':![]},{'model':db['Tag'],'as':_0x2178('0xb3'),'attributes':['id','name',_0x2178('0xb4')],'where':_0x4aace7[_0x2178('0x46')][_0x2178('0xb5')]?{'id':_0x4aace7['query']['tag']}:undefined,'required':_0x4aace7[_0x2178('0x46')][_0x2178('0xb5')]?!![]:![]}];}return db[_0x2178('0x92')][_0x2178('0x53')](_0x26afd3);})[_0x2178('0x1f')](function(_0x252e38){_0x1f0d39[_0x2178('0x54')]=_0x252e38;return _0x1f0d39;});}})[_0x2178('0x1f')](respondWithFilteredResult(_0x4c1a94,_0x26afd3))[_0x2178('0x2a')](handleError(_0x4c1a94,null));};exports[_0x2178('0xb6')]=function(_0x330870,_0x3474f6,_0x17ebae){return db[_0x2178('0x40')][_0x2178('0x5a')]({'where':{'id':_0x330870[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x3474f6,null))[_0x2178('0x1f')](function(_0x25a047){if(_0x25a047){return _0x25a047[_0x2178('0xb6')](_0x330870[_0x2178('0x5c')][_0x2178('0x6c')],_['omit'](_0x330870[_0x2178('0x5c')],['ids','id'])||{})[_0x2178('0x93')](function(_0xcdaf69){for(var _0x436345=0x0;_0x436345<_0x330870['body']['ids'][_0x2178('0x57')];_0x436345+=0x1){socket[_0x2178('0xb7')](_0x2178('0xb8'),{'UserId':Number(_0x330870[_0x2178('0x5c')][_0x2178('0x6c')][_0x436345]),'OpenchannelAccountId':Number(_0x330870[_0x2178('0x56')]['id'])});}return _0xcdaf69;});}})['then'](respondWithResult(_0x3474f6,null))[_0x2178('0x2a')](handleError(_0x3474f6,null));};exports[_0x2178('0xb9')]=function(_0x48f45d,_0x2c8867,_0x51deed){return db['OpenchannelAccount']['find']({'where':{'id':_0x48f45d[_0x2178('0x56')]['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x2c8867,null))[_0x2178('0x1f')](function(_0x1c2c4d){if(_0x1c2c4d){return _0x1c2c4d[_0x2178('0xb9')](_0x48f45d[_0x2178('0x46')][_0x2178('0x6c')])[_0x2178('0x1f')](function(){if(_[_0x2178('0xba')](_0x48f45d['query'][_0x2178('0x6c')])){for(var _0x5c077d=0x0;_0x5c077d<_0x48f45d[_0x2178('0x46')][_0x2178('0x6c')][_0x2178('0x57')];_0x5c077d+=0x1){socket[_0x2178('0xb7')]('userOpenchannelAccount:remove',{'UserId':Number(_0x48f45d[_0x2178('0x46')][_0x2178('0x6c')][_0x5c077d]),'OpenchannelAccountId':Number(_0x48f45d[_0x2178('0x56')]['id'])});}}else{socket[_0x2178('0xb7')](_0x2178('0xbb'),{'UserId':Number(_0x48f45d[_0x2178('0x46')][_0x2178('0x6c')]),'OpenchannelAccountId':Number(_0x48f45d[_0x2178('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c8867,null))[_0x2178('0x2a')](handleError(_0x2c8867,null));};exports['getAgents']=function(_0x163f0f,_0x5d8ceb,_0xb66fe8){var _0x50e4d3={};var _0x4a6ffb={};var _0x572db8;var _0x5c42b5;return db['OpenchannelAccount'][_0x2178('0x68')]({'where':{'id':_0x163f0f['params']['id']}})[_0x2178('0x1f')](handleEntityNotFound(_0x5d8ceb,null))[_0x2178('0x1f')](function(_0xd273a9){if(_0xd273a9){_0x572db8=_0xd273a9;_0x4a6ffb['model']=_['keys'](db[_0x2178('0x9e')][_0x2178('0x41')]);_0x4a6ffb[_0x2178('0x46')]=_[_0x2178('0x47')](_0x163f0f['query']);_0x4a6ffb[_0x2178('0x48')]=_[_0x2178('0x4a')](_0x4a6ffb[_0x2178('0x45')],_0x4a6ffb[_0x2178('0x46')]);_0x50e4d3[_0x2178('0x49')]=_[_0x2178('0x4a')](_0x4a6ffb[_0x2178('0x45')],qs['fields'](_0x163f0f['query'][_0x2178('0x4b')]));_0x50e4d3[_0x2178('0x49')]=_0x50e4d3[_0x2178('0x49')][_0x2178('0x57')]?_0x50e4d3[_0x2178('0x49')]:_0x4a6ffb[_0x2178('0x45')];_0x50e4d3[_0x2178('0x6a')]=qs[_0x2178('0x4d')](_0x163f0f['query']['sort']);_0x50e4d3[_0x2178('0x4e')]=qs['filters'](_[_0x2178('0x4f')](_0x163f0f[_0x2178('0x46')],_0x4a6ffb[_0x2178('0x48')]));if(_0x163f0f[_0x2178('0x46')]['filter']){_0x50e4d3['where']=_['merge'](_0x50e4d3[_0x2178('0x4e')],{'$or':_[_0x2178('0x3f')](_0x50e4d3['attributes'],function(_0xed7d16){var _0x5658c8={};_0x5658c8[_0xed7d16]={'$like':'%'+_0x163f0f[_0x2178('0x46')][_0x2178('0x50')]+'%'};return _0x5658c8;})});}_0x50e4d3=_['merge']({},_0x50e4d3,_0x163f0f[_0x2178('0x59')]);return _0x572db8['getAgents'](_0x50e4d3);}})[_0x2178('0x1f')](function(_0x1edab5){if(_0x1edab5){_0x5c42b5=_0x1edab5[_0x2178('0x57')];if(!_0x163f0f[_0x2178('0x46')]['hasOwnProperty'](_0x2178('0x4c'))){_0x50e4d3[_0x2178('0x31')]=qs[_0x2178('0x31')](_0x163f0f[_0x2178('0x46')]['limit']);_0x50e4d3[_0x2178('0x2f')]=qs[_0x2178('0x2f')](_0x163f0f['query'][_0x2178('0x2f')]);}return _0x572db8[_0x2178('0xbc')](_0x50e4d3);}})[_0x2178('0x1f')](function(_0xa753d0){if(_0xa753d0){return _0xa753d0?{'count':_0x5c42b5,'rows':_0xa753d0}:null;}})[_0x2178('0x1f')](respondWithResult(_0x5d8ceb,null))[_0x2178('0x2a')](handleError(_0x5d8ceb,null));};exports[_0x2178('0xaf')]=function(_0x59f0eb,_0x527b9c,_0x142b71){var _0x22b74b,_0x554fea,_0x54a785;if(_['isNil'](_0x59f0eb[_0x2178('0x5c')][_0x2178('0x5c')])||_0x59f0eb[_0x2178('0x5c')][_0x2178('0x5c')]===''){throw new db[(_0x2178('0x74'))][(_0x2178('0x75'))](_0x2178('0x7f'));}if(_['isNil'](_0x59f0eb[_0x2178('0x5c')]['to'])){}_0x22b74b=_0x59f0eb[_0x2178('0x5c')]['to'];return db[_0x2178('0x40')][_0x2178('0x68')]({'where':{'id':_0x59f0eb[_0x2178('0x56')]['id']}})['then'](handleEntityNotFound(_0x527b9c,null))[_0x2178('0x1f')](function(_0x35d109){if(_0x35d109){return db[_0x2178('0x40')][_0x2178('0x5a')]({'where':{'id':_0x35d109['id']},'include':[{'model':db[_0x2178('0xbd')],'as':_0x2178('0x84'),'include':[{'model':db['CmContact'],'as':_0x2178('0x85'),'where':{[_0x35d109[_0x2178('0x80')]]:_0x22b74b},'limit':0x1,'order':[['updatedAt',_0x2178('0x86')]]}]}]})[_0x2178('0x1f')](handleEntityNotFound(_0x527b9c,null))[_0x2178('0x1f')](function(_0x3f6745){if(_0x3f6745&&_0x3f6745[_0x2178('0x84')]){_0x554fea=_0x3f6745[_0x2178('0x38')]({'plain':!![]});if(_0x554fea[_0x2178('0x84')]&&_0x554fea[_0x2178('0x84')]['Contacts']['length']){return _0x554fea[_0x2178('0x84')]['Contacts'][0x0];}return db['CmContact'][_0x2178('0x5b')](_['defaults'](_0x59f0eb[_0x2178('0x5c')],{'firstName':_0x22b74b,[_0x3f6745[_0x2178('0x80')]]:_0x22b74b,'phone':_0x22b74b,'ListId':_0x554fea[_0x2178('0x7b')]}));}})['then'](handleEntityNotFound(_0x527b9c,null))[_0x2178('0x1f')](function(_0x3afc14){if(_0x3afc14){_0x54a785=_0x3afc14;return db['OpenchannelInteraction'][_0x2178('0x5a')]({'where':{'ContactId':_0x54a785['id'],'closed':![],'OpenchannelAccountId':_0x554fea['id']}})[_0x2178('0x1f')](function(_0x4ed54e){if(_0x4ed54e){return[_0x4ed54e,![]];}return db['OpenchannelInteraction'][_0x2178('0x5b')]({'UserId':_0x59f0eb[_0x2178('0x5d')]['id'],'ContactId':_0x54a785['id'],'OpenchannelAccountId':_0x554fea['id'],'lastMsgDirection':'out','firstMsgDirection':_0x2178('0xbe'),'Messages':[_[_0x2178('0x51')](_0x59f0eb[_0x2178('0x5c')],{'read':![],'body':_0x59f0eb[_0x2178('0x5c')][_0x2178('0x5c')],'OpenchannelAccountId':_0x554fea['id'],'UserId':_0x59f0eb[_0x2178('0x5d')]['id'],'ContactId':_0x54a785['id']})]},{'include':[{'model':db[_0x2178('0x9c')],'as':'Messages'}]})[_0x2178('0x1f')](function(_0x384238){return[_0x384238,!![]];});});}})[_0x2178('0x93')](function(_0x45bf6d,_0x27382){if(_0x27382){return _0x45bf6d;}return db['OpenchannelMessage'][_0x2178('0x5b')](_[_0x2178('0x51')](_0x59f0eb[_0x2178('0x5c')],{'read':![],'body':_0x59f0eb[_0x2178('0x5c')][_0x2178('0x5c')],'OpenchannelAccountId':_0x554fea['id'],'OpenchannelInteractionId':_0x45bf6d['id'],'UserId':_0x59f0eb[_0x2178('0x5d')]['id'],'ContactId':_0x54a785['id']}))[_0x2178('0x1f')](function(_0x3d7d0b){_0x45bf6d[_0x2178('0xbf')]['Messages']=[];_0x45bf6d[_0x2178('0xbf')][_0x2178('0xc0')][_0x2178('0x99')](_0x3d7d0b[_0x2178('0xbf')]);return _0x45bf6d;});});}})[_0x2178('0x1f')](respondWithResult(_0x527b9c,null))[_0x2178('0x2a')](handleError(_0x527b9c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 879b281..d41e0e2 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 _0x2547=['hasOwnProperty','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x2547,0x1cd));var _0x7254=function(_0x19cfc4,_0x2da0a0){_0x19cfc4=_0x19cfc4-0x0;var _0x3b563a=_0x2547[_0x19cfc4];return _0x3b563a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7254('0x0'))['db'][_0x7254('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7254('0x2')](0x0);var events={'afterCreate':_0x7254('0x3'),'afterUpdate':_0x7254('0x4'),'afterDestroy':_0x7254('0x5')};function emitEvent(_0x9f3435){return function(_0x265ebf,_0x53a02f,_0x2ddeae){OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435+':'+_0x265ebf['id'],_0x265ebf);OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435,_0x265ebf);_0x2ddeae(null);};}for(var e in events){if(events[_0x7254('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x7254('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x40cac6,_0x57bc1a){var _0x235807=function(_0x29518b){while(--_0x29518b){_0x40cac6['push'](_0x40cac6['shift']());}};_0x235807(++_0x57bc1a);}(_0x9348,0x10d));var _0x8934=function(_0x25c258,_0x51da65){_0x25c258=_0x25c258-0x0;var _0xa93c81=_0x9348[_0x25c258];return _0xa93c81;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 6ef51ee..2e6223d 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(_0x28a95c,_0x6c1e33){var _0x5dcf1d=function(_0x3e9892){while(--_0x3e9892){_0x28a95c['push'](_0x28a95c['shift']());}};_0x5dcf1d(++_0x6c1e33);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x16cac5,_0x25c4fa){var _0x350eeb=function(_0x541c7b){while(--_0x541c7b){_0x16cac5['push'](_0x16cac5['shift']());}};_0x350eeb(++_0x25c4fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 2f34c79..adb9257 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(_0x1ccc19,_0x5464d6){var _0x37cc35=function(_0x26866a){while(--_0x26866a){_0x1ccc19['push'](_0x1ccc19['shift']());}};_0x37cc35(++_0x5464d6);}(_0x98e5,0x8a));var _0x598e=function(_0x29d335,_0x4de1d9){_0x29d335=_0x29d335-0x0;var _0x409c22=_0x98e5[_0x29d335];return _0x409c22;};'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 _0xbee3=['./openchannelAccount.socket','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x70660,_0x4540e4){var _0x8114d9=function(_0x205b01){while(--_0x205b01){_0x70660['push'](_0x70660['shift']());}};_0x8114d9(++_0x4540e4);}(_0xbee3,0xd5));var _0x3bee=function(_0x17cf81,_0x2d447e){_0x17cf81=_0x17cf81-0x0;var _0x55eba4=_0xbee3[_0x17cf81];return _0x55eba4;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});config[_0x3bee('0x8')]=_[_0x3bee('0x9')](config[_0x3bee('0x8')],{'host':_0x3bee('0xa'),'port':0x18eb});var socket=require(_0x3bee('0xb'))(new Redis(config[_0x3bee('0x8')]));require(_0x3bee('0xc'))['register'](socket);function respondWithRpcPromise(_0x34cd74,_0x3c7964,_0x6cd504){return new BPromise(function(_0x280dcf,_0x356fef){return client[_0x3bee('0xd')](_0x34cd74,_0x6cd504)['then'](function(_0x32c0b){logger['info'](_0x3bee('0xe'),_0x3c7964,_0x3bee('0xf'));logger[_0x3bee('0x10')](_0x3bee('0x11'),_0x3c7964,_0x3bee('0xf'),JSON[_0x3bee('0x12')](_0x32c0b));if(_0x32c0b[_0x3bee('0x13')]){if(_0x32c0b['error'][_0x3bee('0x14')]===0x1f4){logger[_0x3bee('0x13')](_0x3bee('0xe'),_0x3c7964,_0x32c0b[_0x3bee('0x13')][_0x3bee('0x15')]);return _0x356fef(_0x32c0b['error']['message']);}logger[_0x3bee('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c7964,_0x32c0b[_0x3bee('0x13')][_0x3bee('0x15')]);return _0x280dcf(_0x32c0b['error']['message']);}else{logger[_0x3bee('0x16')](_0x3bee('0xe'),_0x3c7964,_0x3bee('0xf'));_0x280dcf(_0x32c0b[_0x3bee('0x17')]['message']);}})[_0x3bee('0x18')](function(_0x43f5d3){logger[_0x3bee('0x13')](_0x3bee('0xe'),_0x3c7964,_0x43f5d3);_0x356fef(_0x43f5d3);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e592c37..102bda4 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 _0x65b3=['remove','update','emit','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x27498,_0x4352d8){var _0x5c1f34=function(_0x4895c2){while(--_0x4895c2){_0x27498['push'](_0x27498['shift']());}};_0x5c1f34(++_0x4352d8);}(_0x65b3,0xc6));var _0x365b=function(_0x55c979,_0x36c5f0){_0x55c979=_0x55c979-0x0;var _0x690107=_0x65b3[_0x55c979];return _0x690107;};'use strict';var OpenchannelAccountEvents=require(_0x365b('0x0'));var events=[_0x365b('0x1'),_0x365b('0x2'),_0x365b('0x3')];function createListener(_0x2ea7a9,_0x86c875){return function(_0x4b0b05){_0x86c875[_0x365b('0x4')](_0x2ea7a9,_0x4b0b05);};}function removeListener(_0x386c02,_0x44ced6){return function(){OpenchannelAccountEvents['removeListener'](_0x386c02,_0x44ced6);};}exports[_0x365b('0x5')]=function(_0x43cb8f){for(var _0x2ca1d8=0x0,_0x5b7869=events[_0x365b('0x6')];_0x2ca1d8<_0x5b7869;_0x2ca1d8++){var _0xe6670a=events[_0x2ca1d8];var _0x2ed50a=createListener(_0x365b('0x7')+_0xe6670a,_0x43cb8f);OpenchannelAccountEvents['on'](_0xe6670a,_0x2ed50a);}}; \ No newline at end of file +var _0xdf0c=['register','length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xdf0c,0x1ab));var _0xcdf0=function(_0x339b2f,_0xf4081c){_0x339b2f=_0x339b2f-0x0;var _0x203fa2=_0xdf0c[_0x339b2f];return _0x203fa2;};'use strict';var OpenchannelAccountEvents=require(_0xcdf0('0x0'));var events=['save',_0xcdf0('0x1'),_0xcdf0('0x2')];function createListener(_0x5233f6,_0x436e7e){return function(_0x27f933){_0x436e7e[_0xcdf0('0x3')](_0x5233f6,_0x27f933);};}function removeListener(_0x2917be,_0x57a58c){return function(){OpenchannelAccountEvents[_0xcdf0('0x4')](_0x2917be,_0x57a58c);};}exports[_0xcdf0('0x5')]=function(_0x5f4c9c){for(var _0x3c97df=0x0,_0xe282be=events[_0xcdf0('0x6')];_0x3c97df<_0xe282be;_0x3c97df++){var _0x5b39b8=events[_0x3c97df];var _0x62e18=createListener(_0xcdf0('0x7')+_0x5b39b8,_0x5f4c9c);OpenchannelAccountEvents['on'](_0x5b39b8,_0x62e18);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index bae4127..fcbc77e 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 _0x25e6=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','fs-extra'];(function(_0x2551f4,_0x48d3ca){var _0x4700b3=function(_0x51fad7){while(--_0x51fad7){_0x2551f4['push'](_0x2551f4['shift']());}};_0x4700b3(++_0x48d3ca);}(_0x25e6,0xeb));var _0x625e=function(_0x1dc953,_0x1ae375){_0x1dc953=_0x1dc953-0x0;var _0x13bea9=_0x25e6[_0x1dc953];return _0x13bea9;};'use strict';var multer=require(_0x625e('0x0'));var util=require('util');var path=require(_0x625e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x625e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x625e('0x3'));var config=require(_0x625e('0x4'));var controller=require(_0x625e('0x5'));router[_0x625e('0x6')]('/',auth[_0x625e('0x7')](),controller[_0x625e('0x8')]);router['get'](_0x625e('0x9'),auth['isAuthenticated'](),controller[_0x625e('0xa')]);router[_0x625e('0xb')]('/',auth['isAuthenticated'](),controller[_0x625e('0xc')]);router[_0x625e('0xd')](_0x625e('0x9'),auth['isAuthenticated'](),controller[_0x625e('0xe')]);router[_0x625e('0xf')](_0x625e('0x9'),auth[_0x625e('0x7')](),controller['destroy']);module[_0x625e('0x10')]=router; \ No newline at end of file +var _0xf0bd=['show','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x3c834d,_0x4f9feb){var _0x508ff4=function(_0x25b7a3){while(--_0x25b7a3){_0x3c834d['push'](_0x3c834d['shift']());}};_0x508ff4(++_0x4f9feb);}(_0xf0bd,0x1eb));var _0xdf0b=function(_0x164b41,_0x27a831){_0x164b41=_0x164b41-0x0;var _0x5bb942=_0xf0bd[_0x164b41];return _0x5bb942;};'use strict';var multer=require(_0xdf0b('0x0'));var util=require(_0xdf0b('0x1'));var path=require(_0xdf0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf0b('0x3'));var router=express[_0xdf0b('0x4')]();var fs_extra=require(_0xdf0b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdf0b('0x6'));var config=require(_0xdf0b('0x7'));var controller=require(_0xdf0b('0x8'));router[_0xdf0b('0x9')]('/',auth['isAuthenticated'](),controller[_0xdf0b('0xa')]);router[_0xdf0b('0x9')](_0xdf0b('0xb'),auth[_0xdf0b('0xc')](),controller[_0xdf0b('0xd')]);router['post']('/',auth[_0xdf0b('0xc')](),controller[_0xdf0b('0xe')]);router[_0xdf0b('0xf')]('/:id',auth[_0xdf0b('0xc')](),controller[_0xdf0b('0x10')]);router['delete'](_0xdf0b('0xb'),auth[_0xdf0b('0xc')](),controller[_0xdf0b('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 8fc06d5..dc9636d 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 _0xe6e0=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0xe6e0,0x10d));var _0x0e6e=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe6e0[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x0e6e('0x0'));module[_0x0e6e('0x1')]={'priority':{'type':Sequelize[_0x0e6e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0e6e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0e6e('0x4')]()},'description':{'type':Sequelize[_0x0e6e('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0e6e('0x5')}}; \ No newline at end of file +var _0x41a4=['noop','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5ac7d7,_0x109040){var _0x23955f=function(_0x52a2ac){while(--_0x52a2ac){_0x5ac7d7['push'](_0x5ac7d7['shift']());}};_0x23955f(++_0x109040);}(_0x41a4,0xcf));var _0x441a=function(_0x3d90a9,_0x5a728){_0x3d90a9=_0x3d90a9-0x0;var _0x58eecd=_0x41a4[_0x3d90a9];return _0x58eecd;};'use strict';var Sequelize=require(_0x441a('0x0'));module[_0x441a('0x1')]={'priority':{'type':Sequelize[_0x441a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x441a('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x441a('0x4')]},'interval':{'type':Sequelize[_0x441a('0x4')],'defaultValue':_0x441a('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 5e34022..b27104a 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 _0x1d27=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','destroy','then','error','stack','name','send','index','OpenchannelApplication','rawAttributes'];(function(_0x44bd84,_0x3c0aff){var _0x5ec1f9=function(_0x446e54){while(--_0x446e54){_0x44bd84['push'](_0x44bd84['shift']());}};_0x5ec1f9(++_0x3c0aff);}(_0x1d27,0x151));var _0x71d2=function(_0x317027,_0x13bcaa){_0x317027=_0x317027-0x0;var _0x33fb7f=_0x1d27[_0x317027];return _0x33fb7f;};'use strict';var emlformat=require(_0x71d2('0x0'));var rimraf=require(_0x71d2('0x1'));var zipdir=require(_0x71d2('0x2'));var jsonpatch=require(_0x71d2('0x3'));var rp=require(_0x71d2('0x4'));var moment=require('moment');var BPromise=require(_0x71d2('0x5'));var Mustache=require(_0x71d2('0x6'));var util=require(_0x71d2('0x7'));var path=require('path');var sox=require(_0x71d2('0x8'));var csv=require(_0x71d2('0x9'));var ejs=require(_0x71d2('0xa'));var fs=require('fs');var fs_extra=require(_0x71d2('0xb'));var _=require(_0x71d2('0xc'));var squel=require(_0x71d2('0xd'));var crypto=require('crypto');var jsforce=require(_0x71d2('0xe'));var deskjs=require(_0x71d2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x71d2('0x10'));var Papa=require(_0x71d2('0x11'));var Redis=require(_0x71d2('0x12'));var authService=require(_0x71d2('0x13'));var qs=require(_0x71d2('0x14'));var as=require(_0x71d2('0x15'));var hardwareService=require(_0x71d2('0x16'));var logger=require(_0x71d2('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x71d2('0x18'));var licenseUtil=require(_0x71d2('0x19'));var db=require(_0x71d2('0x1a'))['db'];function respondWithStatusCode(_0x38ba11,_0x2d8f5d){_0x2d8f5d=_0x2d8f5d||0xcc;return function(_0x3ad776){if(_0x3ad776){return _0x38ba11[_0x71d2('0x1b')](_0x2d8f5d);}return _0x38ba11[_0x71d2('0x1c')](_0x2d8f5d)[_0x71d2('0x1d')]();};}function respondWithResult(_0x50b1da,_0xad7cbd){_0xad7cbd=_0xad7cbd||0xc8;return function(_0x528289){if(_0x528289){return _0x50b1da[_0x71d2('0x1c')](_0xad7cbd)['json'](_0x528289);}};}function respondWithFilteredResult(_0x47efc3,_0x3e5ee3){return function(_0x8898e9){if(_0x8898e9){var _0x1dd741=typeof _0x3e5ee3['offset']==='undefined'&&typeof _0x3e5ee3['limit']===_0x71d2('0x1e');var _0x1e57b8=_0x8898e9[_0x71d2('0x1f')];var _0x3b5bee=_0x1dd741?0x0:_0x3e5ee3[_0x71d2('0x20')];var _0x5539d4=_0x1dd741?_0x8898e9['count']:_0x3e5ee3[_0x71d2('0x20')]+_0x3e5ee3[_0x71d2('0x21')];var _0x10e359;if(_0x5539d4>=_0x1e57b8){_0x5539d4=_0x1e57b8;_0x10e359=0xc8;}else{_0x10e359=0xce;}_0x47efc3[_0x71d2('0x1c')](_0x10e359);return _0x47efc3[_0x71d2('0x22')]('Content-Range',_0x3b5bee+'-'+_0x5539d4+'/'+_0x1e57b8)[_0x71d2('0x23')](_0x8898e9);}return null;};}function patchUpdates(_0x4bb60c){return function(_0xf10bbc){try{jsonpatch[_0x71d2('0x24')](_0xf10bbc,_0x4bb60c,!![]);}catch(_0x2374fa){return BPromise[_0x71d2('0x25')](_0x2374fa);}return _0xf10bbc[_0x71d2('0x26')]();};}function saveUpdates(_0x4f92be,_0xa32da6){return function(_0x4888e2){if(_0x4888e2){return _0x4888e2['update'](_0x4f92be)['then'](function(_0x1a6f93){return _0x1a6f93;});}return null;};}function removeEntity(_0x569548,_0x2cd968){return function(_0x390b1f){if(_0x390b1f){return _0x390b1f[_0x71d2('0x27')]()[_0x71d2('0x28')](function(){_0x569548['status'](0xcc)[_0x71d2('0x1d')]();});}};}function handleEntityNotFound(_0x37dff9,_0x13eb4e){return function(_0x4997bb){if(!_0x4997bb){_0x37dff9[_0x71d2('0x1b')](0x194);}return _0x4997bb;};}function handleError(_0x5d5a08,_0x22d3c5){_0x22d3c5=_0x22d3c5||0x1f4;return function(_0x5de1dd){logger[_0x71d2('0x29')](_0x5de1dd[_0x71d2('0x2a')]);if(_0x5de1dd[_0x71d2('0x2b')]){delete _0x5de1dd[_0x71d2('0x2b')];}_0x5d5a08[_0x71d2('0x1c')](_0x22d3c5)[_0x71d2('0x2c')](_0x5de1dd);};}exports[_0x71d2('0x2d')]=function(_0x39d7d8,_0x24ac02){var _0x157667={},_0x29db35={},_0xb6816a={'count':0x0,'rows':[]};var _0x411c53=_['map'](db[_0x71d2('0x2e')][_0x71d2('0x2f')],function(_0x1269b2){return{'name':_0x1269b2[_0x71d2('0x30')],'type':_0x1269b2[_0x71d2('0x31')][_0x71d2('0x32')]};});_0x29db35[_0x71d2('0x33')]=_['map'](_0x411c53,'name');_0x29db35[_0x71d2('0x34')]=_[_0x71d2('0x35')](_0x39d7d8[_0x71d2('0x34')]);_0x29db35[_0x71d2('0x36')]=_[_0x71d2('0x37')](_0x29db35[_0x71d2('0x33')],_0x29db35[_0x71d2('0x34')]);_0x157667['attributes']=_[_0x71d2('0x37')](_0x29db35[_0x71d2('0x33')],qs[_0x71d2('0x38')](_0x39d7d8[_0x71d2('0x34')][_0x71d2('0x38')]));_0x157667[_0x71d2('0x39')]=_0x157667[_0x71d2('0x39')][_0x71d2('0x3a')]?_0x157667['attributes']:_0x29db35[_0x71d2('0x33')];if(!_0x39d7d8[_0x71d2('0x34')][_0x71d2('0x3b')](_0x71d2('0x3c'))){_0x157667[_0x71d2('0x21')]=qs[_0x71d2('0x21')](_0x39d7d8[_0x71d2('0x34')][_0x71d2('0x21')]);_0x157667['offset']=qs[_0x71d2('0x20')](_0x39d7d8[_0x71d2('0x34')][_0x71d2('0x20')]);}_0x157667[_0x71d2('0x3d')]=qs['sort'](_0x39d7d8[_0x71d2('0x34')][_0x71d2('0x3e')]);_0x157667[_0x71d2('0x3f')]=qs[_0x71d2('0x36')](_[_0x71d2('0x40')](_0x39d7d8['query'],_0x29db35[_0x71d2('0x36')]),_0x411c53);if(_0x39d7d8[_0x71d2('0x34')][_0x71d2('0x41')]){_0x157667[_0x71d2('0x3f')]=_[_0x71d2('0x42')](_0x157667['where'],{'$or':_['map'](_0x411c53,function(_0x3c8aa8){if(_0x3c8aa8[_0x71d2('0x31')]!==_0x71d2('0x43')){var _0x471dd5={};_0x471dd5[_0x3c8aa8[_0x71d2('0x2b')]]={'$like':'%'+_0x39d7d8[_0x71d2('0x34')]['filter']+'%'};return _0x471dd5;}})});}_0x157667=_['merge']({},_0x157667,_0x39d7d8[_0x71d2('0x44')]);var _0x208c73={'where':_0x157667[_0x71d2('0x3f')]};return db[_0x71d2('0x2e')][_0x71d2('0x1f')](_0x208c73)['then'](function(_0x5861c3){_0xb6816a[_0x71d2('0x1f')]=_0x5861c3;if(_0x39d7d8[_0x71d2('0x34')]['includeAll']){_0x157667[_0x71d2('0x45')]=[{'all':!![]}];}return db[_0x71d2('0x2e')]['findAll'](_0x157667);})[_0x71d2('0x28')](function(_0x153af5){_0xb6816a[_0x71d2('0x46')]=_0x153af5;return _0xb6816a;})[_0x71d2('0x28')](respondWithFilteredResult(_0x24ac02,_0x157667))[_0x71d2('0x47')](handleError(_0x24ac02,null));};exports[_0x71d2('0x48')]=function(_0x5dffa4,_0x1aa794){var _0x5d4610={'raw':!![],'where':{'id':_0x5dffa4[_0x71d2('0x49')]['id']}},_0x26cfb9={};_0x26cfb9['model']=_[_0x71d2('0x35')](db[_0x71d2('0x2e')][_0x71d2('0x2f')]);_0x26cfb9[_0x71d2('0x34')]=_[_0x71d2('0x35')](_0x5dffa4[_0x71d2('0x34')]);_0x26cfb9[_0x71d2('0x36')]=_[_0x71d2('0x37')](_0x26cfb9[_0x71d2('0x33')],_0x26cfb9[_0x71d2('0x34')]);_0x5d4610[_0x71d2('0x39')]=_[_0x71d2('0x37')](_0x26cfb9[_0x71d2('0x33')],qs[_0x71d2('0x38')](_0x5dffa4[_0x71d2('0x34')][_0x71d2('0x38')]));_0x5d4610[_0x71d2('0x39')]=_0x5d4610[_0x71d2('0x39')][_0x71d2('0x3a')]?_0x5d4610[_0x71d2('0x39')]:_0x26cfb9['model'];if(_0x5dffa4[_0x71d2('0x34')]['includeAll']){_0x5d4610[_0x71d2('0x45')]=[{'all':!![]}];}_0x5d4610=_[_0x71d2('0x42')]({},_0x5d4610,_0x5dffa4[_0x71d2('0x44')]);return db[_0x71d2('0x2e')][_0x71d2('0x4a')](_0x5d4610)['then'](handleEntityNotFound(_0x1aa794,null))[_0x71d2('0x28')](respondWithResult(_0x1aa794,null))['catch'](handleError(_0x1aa794,null));};exports['create']=function(_0x26096f,_0x11092f){return db[_0x71d2('0x2e')][_0x71d2('0x4b')](_0x26096f['body'],{})[_0x71d2('0x28')](respondWithResult(_0x11092f,0xc9))[_0x71d2('0x47')](handleError(_0x11092f,null));};exports['update']=function(_0x10477d,_0x2b250f){if(_0x10477d['body']['id']){delete _0x10477d['body']['id'];}return db[_0x71d2('0x2e')]['find']({'where':{'id':_0x10477d[_0x71d2('0x49')]['id']}})[_0x71d2('0x28')](handleEntityNotFound(_0x2b250f,null))[_0x71d2('0x28')](saveUpdates(_0x10477d[_0x71d2('0x4c')],null))['then'](respondWithResult(_0x2b250f,null))[_0x71d2('0x47')](handleError(_0x2b250f,null));};exports['destroy']=function(_0x2478e2,_0x4a7c50){return db[_0x71d2('0x2e')][_0x71d2('0x4a')]({'where':{'id':_0x2478e2[_0x71d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a7c50,null))['then'](removeEntity(_0x4a7c50,null))[_0x71d2('0x47')](handleError(_0x4a7c50,null));}; \ No newline at end of file +var _0x95da=['stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x2924f7,_0x286468){var _0x40b4fc=function(_0x4691a1){while(--_0x4691a1){_0x2924f7['push'](_0x2924f7['shift']());}};_0x40b4fc(++_0x286468);}(_0x95da,0x73));var _0xa95d=function(_0x36e965,_0x352c9c){_0x36e965=_0x36e965-0x0;var _0x443d4b=_0x95da[_0x36e965];return _0x443d4b;};'use strict';var emlformat=require(_0xa95d('0x0'));var rimraf=require(_0xa95d('0x1'));var zipdir=require(_0xa95d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa95d('0x3'));var moment=require(_0xa95d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa95d('0x5'));var sox=require(_0xa95d('0x6'));var csv=require(_0xa95d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa95d('0x8'));var squel=require(_0xa95d('0x9'));var crypto=require('crypto');var jsforce=require(_0xa95d('0xa'));var deskjs=require(_0xa95d('0xb'));var toCsv=require(_0xa95d('0x7'));var querystring=require(_0xa95d('0xc'));var Papa=require('papaparse');var Redis=require(_0xa95d('0xd'));var authService=require(_0xa95d('0xe'));var qs=require(_0xa95d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa95d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xa95d('0x11'));var config=require(_0xa95d('0x12'));var licenseUtil=require(_0xa95d('0x13'));var db=require(_0xa95d('0x14'))['db'];function respondWithStatusCode(_0x1f8d76,_0x157c8a){_0x157c8a=_0x157c8a||0xcc;return function(_0x2bff4){if(_0x2bff4){return _0x1f8d76[_0xa95d('0x15')](_0x157c8a);}return _0x1f8d76[_0xa95d('0x16')](_0x157c8a)[_0xa95d('0x17')]();};}function respondWithResult(_0x46101e,_0x4e75e2){_0x4e75e2=_0x4e75e2||0xc8;return function(_0x44a33f){if(_0x44a33f){return _0x46101e[_0xa95d('0x16')](_0x4e75e2)[_0xa95d('0x18')](_0x44a33f);}};}function respondWithFilteredResult(_0x58e708,_0x56ded8){return function(_0x1984bc){if(_0x1984bc){var _0x432d67=typeof _0x56ded8[_0xa95d('0x19')]==='undefined'&&typeof _0x56ded8['limit']===_0xa95d('0x1a');var _0x5ac25f=_0x1984bc['count'];var _0x218a15=_0x432d67?0x0:_0x56ded8['offset'];var _0x56fc14=_0x432d67?_0x1984bc[_0xa95d('0x1b')]:_0x56ded8[_0xa95d('0x19')]+_0x56ded8['limit'];var _0x1dae0e;if(_0x56fc14>=_0x5ac25f){_0x56fc14=_0x5ac25f;_0x1dae0e=0xc8;}else{_0x1dae0e=0xce;}_0x58e708[_0xa95d('0x16')](_0x1dae0e);return _0x58e708[_0xa95d('0x1c')](_0xa95d('0x1d'),_0x218a15+'-'+_0x56fc14+'/'+_0x5ac25f)[_0xa95d('0x18')](_0x1984bc);}return null;};}function patchUpdates(_0x1abb61){return function(_0x2d67e1){try{jsonpatch[_0xa95d('0x1e')](_0x2d67e1,_0x1abb61,!![]);}catch(_0x20dbf0){return BPromise[_0xa95d('0x1f')](_0x20dbf0);}return _0x2d67e1[_0xa95d('0x20')]();};}function saveUpdates(_0x1b0be5,_0x2ea76c){return function(_0x53b31c){if(_0x53b31c){return _0x53b31c[_0xa95d('0x21')](_0x1b0be5)[_0xa95d('0x22')](function(_0x49bce2){return _0x49bce2;});}return null;};}function removeEntity(_0xaa7619,_0x2e471c){return function(_0x31e9e9){if(_0x31e9e9){return _0x31e9e9[_0xa95d('0x23')]()[_0xa95d('0x22')](function(){_0xaa7619[_0xa95d('0x16')](0xcc)[_0xa95d('0x17')]();});}};}function handleEntityNotFound(_0xb0f79d,_0x105ec0){return function(_0x14c603){if(!_0x14c603){_0xb0f79d[_0xa95d('0x15')](0x194);}return _0x14c603;};}function handleError(_0x1d7b8c,_0x28316b){_0x28316b=_0x28316b||0x1f4;return function(_0x57d0b1){logger[_0xa95d('0x24')](_0x57d0b1[_0xa95d('0x25')]);if(_0x57d0b1[_0xa95d('0x26')]){delete _0x57d0b1[_0xa95d('0x26')];}_0x1d7b8c[_0xa95d('0x16')](_0x28316b)[_0xa95d('0x27')](_0x57d0b1);};}exports[_0xa95d('0x28')]=function(_0x12a0e5,_0x4021c0){var _0x3182bb={},_0x47cebe={},_0xd4fac={'count':0x0,'rows':[]};var _0x4afe8a=_['map'](db[_0xa95d('0x29')][_0xa95d('0x2a')],function(_0x3ba0f3){return{'name':_0x3ba0f3[_0xa95d('0x2b')],'type':_0x3ba0f3[_0xa95d('0x2c')][_0xa95d('0x2d')]};});_0x47cebe['model']=_[_0xa95d('0x2e')](_0x4afe8a,_0xa95d('0x26'));_0x47cebe['query']=_[_0xa95d('0x2f')](_0x12a0e5[_0xa95d('0x30')]);_0x47cebe['filters']=_[_0xa95d('0x31')](_0x47cebe[_0xa95d('0x32')],_0x47cebe['query']);_0x3182bb[_0xa95d('0x33')]=_[_0xa95d('0x31')](_0x47cebe[_0xa95d('0x32')],qs[_0xa95d('0x34')](_0x12a0e5[_0xa95d('0x30')]['fields']));_0x3182bb[_0xa95d('0x33')]=_0x3182bb[_0xa95d('0x33')][_0xa95d('0x35')]?_0x3182bb[_0xa95d('0x33')]:_0x47cebe['model'];if(!_0x12a0e5['query'][_0xa95d('0x36')](_0xa95d('0x37'))){_0x3182bb['limit']=qs[_0xa95d('0x38')](_0x12a0e5[_0xa95d('0x30')]['limit']);_0x3182bb[_0xa95d('0x19')]=qs[_0xa95d('0x19')](_0x12a0e5['query'][_0xa95d('0x19')]);}_0x3182bb[_0xa95d('0x39')]=qs[_0xa95d('0x3a')](_0x12a0e5[_0xa95d('0x30')][_0xa95d('0x3a')]);_0x3182bb['where']=qs[_0xa95d('0x3b')](_[_0xa95d('0x3c')](_0x12a0e5[_0xa95d('0x30')],_0x47cebe[_0xa95d('0x3b')]),_0x4afe8a);if(_0x12a0e5['query'][_0xa95d('0x3d')]){_0x3182bb[_0xa95d('0x3e')]=_['merge'](_0x3182bb[_0xa95d('0x3e')],{'$or':_[_0xa95d('0x2e')](_0x4afe8a,function(_0x39eb77){if(_0x39eb77[_0xa95d('0x2c')]!==_0xa95d('0x3f')){var _0x5ca099={};_0x5ca099[_0x39eb77['name']]={'$like':'%'+_0x12a0e5[_0xa95d('0x30')][_0xa95d('0x3d')]+'%'};return _0x5ca099;}})});}_0x3182bb=_[_0xa95d('0x40')]({},_0x3182bb,_0x12a0e5[_0xa95d('0x41')]);var _0x36e0f8={'where':_0x3182bb[_0xa95d('0x3e')]};return db[_0xa95d('0x29')][_0xa95d('0x1b')](_0x36e0f8)[_0xa95d('0x22')](function(_0x3b3d08){_0xd4fac[_0xa95d('0x1b')]=_0x3b3d08;if(_0x12a0e5['query'][_0xa95d('0x42')]){_0x3182bb[_0xa95d('0x43')]=[{'all':!![]}];}return db[_0xa95d('0x29')][_0xa95d('0x44')](_0x3182bb);})[_0xa95d('0x22')](function(_0x25f73e){_0xd4fac[_0xa95d('0x45')]=_0x25f73e;return _0xd4fac;})[_0xa95d('0x22')](respondWithFilteredResult(_0x4021c0,_0x3182bb))[_0xa95d('0x46')](handleError(_0x4021c0,null));};exports[_0xa95d('0x47')]=function(_0x12ab01,_0x5149af){var _0x491e6d={'raw':!![],'where':{'id':_0x12ab01[_0xa95d('0x48')]['id']}},_0x243c44={};_0x243c44[_0xa95d('0x32')]=_['keys'](db[_0xa95d('0x29')]['rawAttributes']);_0x243c44['query']=_[_0xa95d('0x2f')](_0x12ab01[_0xa95d('0x30')]);_0x243c44['filters']=_['intersection'](_0x243c44[_0xa95d('0x32')],_0x243c44[_0xa95d('0x30')]);_0x491e6d[_0xa95d('0x33')]=_['intersection'](_0x243c44[_0xa95d('0x32')],qs['fields'](_0x12ab01[_0xa95d('0x30')][_0xa95d('0x34')]));_0x491e6d[_0xa95d('0x33')]=_0x491e6d[_0xa95d('0x33')][_0xa95d('0x35')]?_0x491e6d[_0xa95d('0x33')]:_0x243c44[_0xa95d('0x32')];if(_0x12ab01[_0xa95d('0x30')][_0xa95d('0x42')]){_0x491e6d[_0xa95d('0x43')]=[{'all':!![]}];}_0x491e6d=_[_0xa95d('0x40')]({},_0x491e6d,_0x12ab01[_0xa95d('0x41')]);return db[_0xa95d('0x29')]['find'](_0x491e6d)[_0xa95d('0x22')](handleEntityNotFound(_0x5149af,null))[_0xa95d('0x22')](respondWithResult(_0x5149af,null))[_0xa95d('0x46')](handleError(_0x5149af,null));};exports[_0xa95d('0x49')]=function(_0x5a23c1,_0x46c776){return db[_0xa95d('0x29')]['create'](_0x5a23c1[_0xa95d('0x4a')],{})[_0xa95d('0x22')](respondWithResult(_0x46c776,0xc9))[_0xa95d('0x46')](handleError(_0x46c776,null));};exports[_0xa95d('0x21')]=function(_0x1080e3,_0x5f1ada){if(_0x1080e3[_0xa95d('0x4a')]['id']){delete _0x1080e3[_0xa95d('0x4a')]['id'];}return db[_0xa95d('0x29')]['find']({'where':{'id':_0x1080e3['params']['id']}})['then'](handleEntityNotFound(_0x5f1ada,null))[_0xa95d('0x22')](saveUpdates(_0x1080e3['body'],null))[_0xa95d('0x22')](respondWithResult(_0x5f1ada,null))[_0xa95d('0x46')](handleError(_0x5f1ada,null));};exports[_0xa95d('0x23')]=function(_0x9b1c09,_0x143394){return db[_0xa95d('0x29')][_0xa95d('0x4b')]({'where':{'id':_0x9b1c09[_0xa95d('0x48')]['id']}})['then'](handleEntityNotFound(_0x143394,null))[_0xa95d('0x22')](removeEntity(_0x143394,null))[_0xa95d('0x46')](handleError(_0x143394,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0760e2d..dbbbbf4 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 _0x2d74=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x2d74,0x99));var _0x42d7=function(_0x493a21,_0x8c32ad){_0x493a21=_0x493a21-0x0;var _0x16557d=_0x2d74[_0x493a21];return _0x16557d;};'use strict';var _=require(_0x42d7('0x0'));var util=require(_0x42d7('0x1'));var logger=require('../../config/logger')(_0x42d7('0x2'));var moment=require(_0x42d7('0x3'));var BPromise=require(_0x42d7('0x4'));var rp=require(_0x42d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42d7('0x6'));var config=require(_0x42d7('0x7'));var attributes=require(_0x42d7('0x8'));module[_0x42d7('0x9')]=function(_0x69b732,_0x41dd9d){return _0x69b732[_0x42d7('0xa')](_0x42d7('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42d7('0xc'),'collate':_0x42d7('0xd')});}; \ No newline at end of file +var _0xfd0c=['../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','path','rimraf'];(function(_0xff4af9,_0x3e12bc){var _0x4d26ce=function(_0x1b50f6){while(--_0x1b50f6){_0xff4af9['push'](_0xff4af9['shift']());}};_0x4d26ce(++_0x3e12bc);}(_0xfd0c,0x193));var _0xcfd0=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0xfd0c[_0x41e8c4];return _0x54ffbe;};'use strict';var _=require(_0xcfd0('0x0'));var util=require('util');var logger=require(_0xcfd0('0x1'))('api');var moment=require(_0xcfd0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfd0('0x3'));var rimraf=require(_0xcfd0('0x4'));var config=require(_0xcfd0('0x5'));var attributes=require(_0xcfd0('0x6'));module[_0xcfd0('0x7')]=function(_0x6333b6,_0x22a562){return _0x6333b6[_0xcfd0('0x8')]('OpenchannelApplication',attributes,{'tableName':_0xcfd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcfd0('0xa'),'collate':_0xcfd0('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b7c016d..c31db9e 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 _0x30ff=['request\x20sent','debug','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','update','body','options','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x30ff,0x1d0));var _0xf30f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x30ff[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf30f('0x0'));var util=require(_0xf30f('0x1'));var moment=require(_0xf30f('0x2'));var BPromise=require(_0xf30f('0x3'));var rs=require(_0xf30f('0x4'));var fs=require('fs');var Redis=require(_0xf30f('0x5'));var db=require(_0xf30f('0x6'))['db'];var utils=require(_0xf30f('0x7'));var logger=require(_0xf30f('0x8'))(_0xf30f('0x9'));var config=require(_0xf30f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf30f('0xb')][_0xf30f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ebc0c,_0x5b8317,_0x40d1b0){return new BPromise(function(_0xba9fbe,_0x3cc10d){return client[_0xf30f('0xd')](_0x4ebc0c,_0x40d1b0)[_0xf30f('0xe')](function(_0x2e9423){logger[_0xf30f('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x5b8317,_0xf30f('0x10'));logger[_0xf30f('0x11')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x5b8317,_0xf30f('0x10'),JSON[_0xf30f('0x12')](_0x2e9423));if(_0x2e9423[_0xf30f('0x13')]){if(_0x2e9423[_0xf30f('0x13')][_0xf30f('0x14')]===0x1f4){logger['error'](_0xf30f('0x15'),_0x5b8317,_0x2e9423[_0xf30f('0x13')][_0xf30f('0x16')]);return _0x3cc10d(_0x2e9423['error'][_0xf30f('0x16')]);}logger[_0xf30f('0x13')](_0xf30f('0x15'),_0x5b8317,_0x2e9423[_0xf30f('0x13')][_0xf30f('0x16')]);return _0xba9fbe(_0x2e9423['error'][_0xf30f('0x16')]);}else{logger[_0xf30f('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x5b8317,'request\x20sent');_0xba9fbe(_0x2e9423[_0xf30f('0x17')][_0xf30f('0x16')]);}})[_0xf30f('0x18')](function(_0x55479a){logger['error'](_0xf30f('0x15'),_0x5b8317,_0x55479a);_0x3cc10d(_0x55479a);});});}exports[_0xf30f('0x19')]=function(_0x1c984f){var _0x4564e5=this;return new Promise(function(_0x3e80c6,_0x49c6d8){return db['OpenchannelApplication'][_0xf30f('0x1a')](_0x1c984f[_0xf30f('0x1b')],{'raw':_0x1c984f[_0xf30f('0x1c')]?_0x1c984f[_0xf30f('0x1c')][_0xf30f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c984f[_0xf30f('0x1c')]?_0x1c984f[_0xf30f('0x1c')]['where']||null:null,'attributes':_0x1c984f[_0xf30f('0x1c')]?_0x1c984f[_0xf30f('0x1c')][_0xf30f('0x1e')]||null:null,'limit':_0x1c984f[_0xf30f('0x1c')]?_0x1c984f['options'][_0xf30f('0x1f')]||null:null})['then'](function(_0x3ce630){logger['info'](_0xf30f('0x19'),_0x1c984f);logger['debug'](_0xf30f('0x19'),_0x1c984f,JSON[_0xf30f('0x12')](_0x3ce630));_0x3e80c6(_0x3ce630);})[_0xf30f('0x18')](function(_0x415abf){logger['error'](_0xf30f('0x19'),_0x415abf[_0xf30f('0x16')],_0x1c984f);_0x49c6d8(_0x4564e5[_0xf30f('0x13')](0x1f4,_0x415abf[_0xf30f('0x16')]));});});}; \ No newline at end of file +var _0x5a3d=['message','OpenchannelApplication,\x20%s,\x20%s','info','result','catch','UpdateOpenchannelApplication','update','options','where','attributes','limit','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x5a3d,0x13f));var _0xd5a3=function(_0x6a4c44,_0x406bd7){_0x6a4c44=_0x6a4c44-0x0;var _0x34fb6f=_0x5a3d[_0x6a4c44];return _0x34fb6f;};'use strict';var _=require(_0xd5a3('0x0'));var util=require(_0xd5a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5a3('0x2'));var db=require(_0xd5a3('0x3'))['db'];var utils=require(_0xd5a3('0x4'));var logger=require(_0xd5a3('0x5'))('rpc');var config=require(_0xd5a3('0x6'));var jayson=require(_0xd5a3('0x7'));var client=jayson[_0xd5a3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16241e,_0x32907d,_0x4d8d3e){return new BPromise(function(_0x526332,_0x34408d){return client[_0xd5a3('0x9')](_0x16241e,_0x4d8d3e)[_0xd5a3('0xa')](function(_0x425522){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x32907d,_0xd5a3('0xb'));logger[_0xd5a3('0xc')](_0xd5a3('0xd'),_0x32907d,_0xd5a3('0xb'),JSON[_0xd5a3('0xe')](_0x425522));if(_0x425522[_0xd5a3('0xf')]){if(_0x425522['error'][_0xd5a3('0x10')]===0x1f4){logger[_0xd5a3('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x32907d,_0x425522[_0xd5a3('0xf')]['message']);return _0x34408d(_0x425522[_0xd5a3('0xf')][_0xd5a3('0x11')]);}logger[_0xd5a3('0xf')](_0xd5a3('0x12'),_0x32907d,_0x425522[_0xd5a3('0xf')][_0xd5a3('0x11')]);return _0x526332(_0x425522[_0xd5a3('0xf')][_0xd5a3('0x11')]);}else{logger[_0xd5a3('0x13')](_0xd5a3('0x12'),_0x32907d,_0xd5a3('0xb'));_0x526332(_0x425522[_0xd5a3('0x14')]['message']);}})[_0xd5a3('0x15')](function(_0x1835af){logger[_0xd5a3('0xf')](_0xd5a3('0x12'),_0x32907d,_0x1835af);_0x34408d(_0x1835af);});});}exports[_0xd5a3('0x16')]=function(_0x556bb0){var _0x15a80f=this;return new Promise(function(_0x497d75,_0x15d5c0){return db['OpenchannelApplication'][_0xd5a3('0x17')](_0x556bb0['body'],{'raw':_0x556bb0[_0xd5a3('0x18')]?_0x556bb0[_0xd5a3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x556bb0[_0xd5a3('0x18')]?_0x556bb0[_0xd5a3('0x18')][_0xd5a3('0x19')]||null:null,'attributes':_0x556bb0[_0xd5a3('0x18')]?_0x556bb0['options'][_0xd5a3('0x1a')]||null:null,'limit':_0x556bb0['options']?_0x556bb0['options'][_0xd5a3('0x1b')]||null:null})[_0xd5a3('0xa')](function(_0x390256){logger[_0xd5a3('0x13')](_0xd5a3('0x16'),_0x556bb0);logger[_0xd5a3('0xc')](_0xd5a3('0x16'),_0x556bb0,JSON['stringify'](_0x390256));_0x497d75(_0x390256);})[_0xd5a3('0x15')](function(_0x58409b){logger['error'](_0xd5a3('0x16'),_0x58409b['message'],_0x556bb0);_0x15d5c0(_0x15a80f[_0xd5a3('0xf')](0x1f4,_0x58409b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 26d5b1d..7486f8d 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 _0xc5a4=['post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x578ed9,_0x4453f7){var _0x42490f=function(_0x4e2caf){while(--_0x4e2caf){_0x578ed9['push'](_0x578ed9['shift']());}};_0x42490f(++_0x4453f7);}(_0xc5a4,0x93));var _0x4c5a=function(_0x4dc513,_0x722675){_0x4dc513=_0x4dc513-0x0;var _0x2b50ef=_0xc5a4[_0x4dc513];return _0x2b50ef;};'use strict';var multer=require('multer');var util=require(_0x4c5a('0x0'));var path=require(_0x4c5a('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c5a('0x2'));var router=express[_0x4c5a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4c5a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4c5a('0x5'));var controller=require(_0x4c5a('0x6'));router[_0x4c5a('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c5a('0x8')]);router['get'](_0x4c5a('0x9'),auth[_0x4c5a('0xa')](),controller[_0x4c5a('0xb')]);router[_0x4c5a('0x7')](_0x4c5a('0xc'),auth[_0x4c5a('0xa')](),controller[_0x4c5a('0xd')]);router['get'](_0x4c5a('0xe'),auth[_0x4c5a('0xa')](),controller[_0x4c5a('0xf')]);router[_0x4c5a('0x7')](_0x4c5a('0x10'),auth[_0x4c5a('0xa')](),controller[_0x4c5a('0x11')]);router[_0x4c5a('0x12')]('/',auth[_0x4c5a('0xa')](),controller[_0x4c5a('0x13')]);router['post'](_0x4c5a('0xe'),auth[_0x4c5a('0xa')](),controller[_0x4c5a('0x14')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x4c5a('0x15')](_0x4c5a('0x16'),_0x4c5a('0x17')),controller[_0x4c5a('0x18')]);router[_0x4c5a('0x19')](_0x4c5a('0xc'),auth['isAuthenticated'](),interaction[_0x4c5a('0x15')](_0x4c5a('0x16'),_0x4c5a('0x1a')),controller[_0x4c5a('0x1b')]);router[_0x4c5a('0x1c')]('/:id',auth[_0x4c5a('0xa')](),interaction[_0x4c5a('0x15')](_0x4c5a('0x16'),_0x4c5a('0x1d')),controller[_0x4c5a('0x1e')]);router[_0x4c5a('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x4c5a('0x1f')]);module[_0x4c5a('0x20')]=router; \ No newline at end of file +var _0xf575=['/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id'];(function(_0x46c30c,_0x1ac896){var _0x45c5c1=function(_0x21ad77){while(--_0x21ad77){_0x46c30c['push'](_0x46c30c['shift']());}};_0x45c5c1(++_0x1ac896);}(_0xf575,0xac));var _0x5f57=function(_0x5b4f3f,_0x2b9bff){_0x5b4f3f=_0x5b4f3f-0x0;var _0x34fe19=_0xf575[_0x5b4f3f];return _0x34fe19;};'use strict';var multer=require(_0x5f57('0x0'));var util=require(_0x5f57('0x1'));var path=require(_0x5f57('0x2'));var timeout=require(_0x5f57('0x3'));var express=require(_0x5f57('0x4'));var router=express[_0x5f57('0x5')]();var fs_extra=require(_0x5f57('0x6'));var auth=require(_0x5f57('0x7'));var interaction=require(_0x5f57('0x8'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x5f57('0x9')]('/',auth[_0x5f57('0xa')](),controller[_0x5f57('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x5f57('0xc')]);router['get'](_0x5f57('0xd'),auth[_0x5f57('0xa')](),controller['show']);router['get'](_0x5f57('0xe'),auth[_0x5f57('0xa')](),controller[_0x5f57('0xf')]);router[_0x5f57('0x9')](_0x5f57('0x10'),auth[_0x5f57('0xa')](),controller[_0x5f57('0x11')]);router[_0x5f57('0x12')]('/',auth[_0x5f57('0xa')](),controller[_0x5f57('0x13')]);router[_0x5f57('0x12')](_0x5f57('0xe'),auth[_0x5f57('0xa')](),controller['addMessage']);router['post'](_0x5f57('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x5f57('0x15'),_0x5f57('0x16')),controller[_0x5f57('0x17')]);router[_0x5f57('0x18')](_0x5f57('0xd'),auth[_0x5f57('0xa')](),interaction[_0x5f57('0x19')]('openchannel',_0x5f57('0x1a')),controller['update']);router[_0x5f57('0x1b')]('/:id',auth[_0x5f57('0xa')](),interaction[_0x5f57('0x19')]('openchannel',_0x5f57('0x1c')),controller[_0x5f57('0x1d')]);router[_0x5f57('0x1b')](_0x5f57('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0x5f57('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 b20b7bd..05eddde 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 _0x851d=['STRING','out','ENUM','sequelize','BOOLEAN','DATE'];(function(_0x1306f3,_0x1da761){var _0xc1c7bf=function(_0x1ca08e){while(--_0x1ca08e){_0x1306f3['push'](_0x1306f3['shift']());}};_0xc1c7bf(++_0x1da761);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd851('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd851('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd851('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd851('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd851('0x3')]},'note':{'type':Sequelize[_0xd851('0x3')]},'read1stAt':{'type':Sequelize[_0xd851('0x2')]},'threadId':{'type':Sequelize[_0xd851('0x3')]},'externalUrl':{'type':Sequelize[_0xd851('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd851('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd851('0x5')]('in',_0xd851('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd851('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xd851('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xadb8=['STRING','DATE','ENUM','out','BOOLEAN'];(function(_0xb729d2,_0x131a0e){var _0x181500=function(_0x38cdec){while(--_0x38cdec){_0xb729d2['push'](_0xb729d2['shift']());}};_0x181500(++_0x131a0e);}(_0xadb8,0x1d0));var _0x8adb=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0xadb8[_0xf5d71c];return _0x5af672;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x8adb('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8adb('0x1')]},'secondDisposition':{'type':Sequelize[_0x8adb('0x1')]},'thirdDisposition':{'type':Sequelize[_0x8adb('0x1')]},'note':{'type':Sequelize[_0x8adb('0x1')]},'read1stAt':{'type':Sequelize[_0x8adb('0x2')]},'threadId':{'type':Sequelize[_0x8adb('0x1')]},'externalUrl':{'type':Sequelize[_0x8adb('0x1')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8adb('0x3')]('in',_0x8adb('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x8adb('0x3')]('in',_0x8adb('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8adb('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0x8adb('0x0')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 394632e..289627b 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 _0x1f9f=['$gte','format','rows','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','basename','createReadStream','pipe','createWriteStream','out','System','secret','read','value','renderFile','views','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','end','json','offset','undefined','limit','count','set','update','then','destroy','error','name','status','send','index','map','rawAttributes','fieldName','key','findAll','query','user','catch','show','type','from','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','includeAll','include','merge','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','sort','pick','where','filter'];(function(_0x2675da,_0x56ac68){var _0x3995b7=function(_0x47759c){while(--_0x47759c){_0x2675da['push'](_0x2675da['shift']());}};_0x3995b7(++_0x56ac68);}(_0x1f9f,0xb4));var _0xf1f9=function(_0x5b685e,_0x3e69ad){_0x5b685e=_0x5b685e-0x0;var _0x9a0173=_0x1f9f[_0x5b685e];return _0x9a0173;};'use strict';var rimraf=require(_0xf1f9('0x0'));var zipdir=require('zip-dir');var moment=require(_0xf1f9('0x1'));var util=require(_0xf1f9('0x2'));var path=require(_0xf1f9('0x3'));var ejs=require(_0xf1f9('0x4'));var fs=require('fs');var _=require(_0xf1f9('0x5'));var Redis=require(_0xf1f9('0x6'));var interaction=require(_0xf1f9('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xf1f9('0x8'))(_0xf1f9('0x9'));var config=require(_0xf1f9('0xa'));var db=require('../../mysqldb')['db'];config[_0xf1f9('0xb')]=_[_0xf1f9('0xc')](config[_0xf1f9('0xb')],{'host':_0xf1f9('0xd'),'port':0x18eb});var socket=require(_0xf1f9('0xe'))(new Redis(config[_0xf1f9('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2c68e8,_0x279f3c){_0x279f3c=_0x279f3c||0xcc;return function(_0x24f2b8){if(_0x24f2b8){return _0x2c68e8[_0xf1f9('0xf')](_0x279f3c);}return _0x2c68e8['status'](_0x279f3c)[_0xf1f9('0x10')]();};}function respondWithResult(_0x2ea652,_0x18a842){_0x18a842=_0x18a842||0xc8;return function(_0x15fb31){if(_0x15fb31){return _0x2ea652['status'](_0x18a842)[_0xf1f9('0x11')](_0x15fb31);}};}function respondWithFilteredResult(_0x42b4a8,_0x8156ff){return function(_0x290b60){if(_0x290b60){var _0x61d210=typeof _0x8156ff[_0xf1f9('0x12')]===_0xf1f9('0x13')&&typeof _0x8156ff[_0xf1f9('0x14')]===_0xf1f9('0x13');var _0x5f5bcb=_0x290b60[_0xf1f9('0x15')];var _0x35f70e=_0x61d210?0x0:_0x8156ff['offset'];var _0x5e082d=_0x61d210?_0x290b60[_0xf1f9('0x15')]:_0x8156ff[_0xf1f9('0x12')]+_0x8156ff['limit'];var _0x16fb90;if(_0x5e082d>=_0x5f5bcb){_0x5e082d=_0x5f5bcb;_0x16fb90=0xc8;}else{_0x16fb90=0xce;}_0x42b4a8['status'](_0x16fb90);return _0x42b4a8[_0xf1f9('0x16')]('Content-Range',_0x35f70e+'-'+_0x5e082d+'/'+_0x5f5bcb)['json'](_0x290b60);}return null;};}function saveUpdates(_0x3d41c0){return function(_0x29517c){if(_0x29517c){return _0x29517c[_0xf1f9('0x17')](_0x3d41c0)[_0xf1f9('0x18')](function(_0x3199f4){return _0x3199f4;});}return null;};}function removeEntity(_0x305082){return function(_0x11a493){if(_0x11a493){return _0x11a493[_0xf1f9('0x19')]()[_0xf1f9('0x18')](function(){_0x305082['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7845){return function(_0x507cd2){if(!_0x507cd2){_0x4b7845[_0xf1f9('0xf')](0x194);}return _0x507cd2;};}function handleError(_0x3f959a,_0x3a6eed){_0x3a6eed=_0x3a6eed||0x1f4;return function(_0x481a1c){logger[_0xf1f9('0x1a')](_0x481a1c['stack']);if(_0x481a1c[_0xf1f9('0x1b')]){delete _0x481a1c['name'];}_0x3f959a[_0xf1f9('0x1c')](_0x3a6eed)[_0xf1f9('0x1d')](_0x481a1c);};}exports[_0xf1f9('0x1e')]=function(_0x176706,_0xd83f90){var _0x18e44d={};var _0x430dcd=_[_0xf1f9('0x1f')](db['OpenchannelInteraction'][_0xf1f9('0x20')],function(_0x1bd555){return{'name':_0x1bd555[_0xf1f9('0x21')],'type':_0x1bd555['type'][_0xf1f9('0x22')]};});_0x18e44d=qs['getOptions'](_0x430dcd,_0x176706);return interaction[_0xf1f9('0x23')]('openchannel',_0x176706[_0xf1f9('0x24')],_0x176706[_0xf1f9('0x25')],_0x18e44d,_0x430dcd)[_0xf1f9('0x18')](respondWithFilteredResult(_0xd83f90,_0x18e44d))[_0xf1f9('0x26')](handleError(_0xd83f90,null));};exports[_0xf1f9('0x27')]=function(_0x2c22d4,_0x1e2560){var _0x48df3e={};if(_0x2c22d4['query'][_0xf1f9('0x28')]&&_0x2c22d4['query'][_0xf1f9('0x28')]===_0xf1f9('0x29')){_0x48df3e[_0xf1f9('0x29')]=_0x2c22d4[_0xf1f9('0x2a')]['id'];}else{_0x48df3e['id']=_0x2c22d4['params']['id'];}var _0x5df2b3={'raw':![],'where':_0x48df3e},_0x3851d5={};_0x3851d5[_0xf1f9('0x2b')]=_[_0xf1f9('0x2c')](db[_0xf1f9('0x2d')][_0xf1f9('0x20')]);_0x3851d5['query']=_['keys'](_0x2c22d4[_0xf1f9('0x24')]);_0x3851d5[_0xf1f9('0x2e')]=_[_0xf1f9('0x2f')](_0x3851d5['model'],_0x3851d5[_0xf1f9('0x24')]);_0x5df2b3[_0xf1f9('0x30')]=_['intersection'](_0x3851d5[_0xf1f9('0x2b')],qs[_0xf1f9('0x31')](_0x2c22d4[_0xf1f9('0x24')][_0xf1f9('0x31')]));_0x5df2b3['attributes']=_0x5df2b3[_0xf1f9('0x30')]['length']?_0x5df2b3['attributes']:_0x3851d5[_0xf1f9('0x2b')];if(_0x2c22d4[_0xf1f9('0x24')][_0xf1f9('0x32')]){_0x5df2b3[_0xf1f9('0x33')]=[{'all':!![]}];}_0x5df2b3=_[_0xf1f9('0x34')]({},_0x5df2b3,_0x2c22d4['options']);return db[_0xf1f9('0x2d')][_0xf1f9('0x35')](_0x5df2b3)[_0xf1f9('0x18')](handleEntityNotFound(_0x1e2560,null))[_0xf1f9('0x18')](respondWithResult(_0x1e2560,null))[_0xf1f9('0x26')](handleError(_0x1e2560,null));};exports['create']=function(_0x40f6ea,_0x2909fe){return db['OpenchannelInteraction'][_0xf1f9('0x36')](_0x40f6ea['body'],{})[_0xf1f9('0x18')](respondWithResult(_0x2909fe,0xc9))[_0xf1f9('0x26')](handleError(_0x2909fe,null));};exports['update']=function(_0x3b1229,_0x568f73){if(_0x3b1229['body']['id']){delete _0x3b1229['body']['id'];}return db['OpenchannelInteraction'][_0xf1f9('0x35')]({'where':{'id':_0x3b1229[_0xf1f9('0x2a')]['id']}})[_0xf1f9('0x18')](handleEntityNotFound(_0x568f73,null))['then'](saveUpdates(_0x3b1229[_0xf1f9('0x37')],null))[_0xf1f9('0x18')](respondWithResult(_0x568f73,null))['catch'](handleError(_0x568f73,null));};exports[_0xf1f9('0x19')]=function(_0x2a7dc6,_0x5a3e1a){return db[_0xf1f9('0x2d')][_0xf1f9('0x35')]({'where':{'id':_0x2a7dc6['params']['id']}})[_0xf1f9('0x18')](handleEntityNotFound(_0x5a3e1a,null))['then'](removeEntity(_0x5a3e1a,null))[_0xf1f9('0x26')](handleError(_0x5a3e1a,null));};exports['describe']=function(_0x37d3ae,_0x37de52){return db[_0xf1f9('0x2d')][_0xf1f9('0x38')]()[_0xf1f9('0x18')](respondWithResult(_0x37de52,null))[_0xf1f9('0x26')](handleError(_0x37de52,null));};exports[_0xf1f9('0x39')]=function(_0x266c86,_0x3bf86d){return db[_0xf1f9('0x3a')][_0xf1f9('0x35')]({'where':{'id':_0x266c86['params']['id']}})[_0xf1f9('0x18')](handleEntityNotFound(_0x3bf86d,null))['then'](function(_0x2899c2){if(_0x2899c2){return _0x2899c2['addMessage'](_0x266c86[_0xf1f9('0x37')][_0xf1f9('0x3b')],_['omit'](_0x266c86[_0xf1f9('0x37')],['ids','id'])||{});}})[_0xf1f9('0x18')](respondWithResult(_0x3bf86d,null))[_0xf1f9('0x26')](handleError(_0x3bf86d,null));};exports[_0xf1f9('0x3c')]=function(_0x127fb6,_0x1adb59){var _0x30fac0={'raw':![],'where':{}};var _0x4680c2={};var _0x125c92={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xf1f9('0x3d')]({'where':{'id':_0x127fb6[_0xf1f9('0x2a')]['id']}})[_0xf1f9('0x18')](handleEntityNotFound(_0x1adb59,null))[_0xf1f9('0x18')](function(_0x1b99f8){if(_0x1b99f8){_0x4680c2[_0xf1f9('0x2b')]=_[_0xf1f9('0x2c')](db[_0xf1f9('0x3a')]['rawAttributes']);_0x4680c2[_0xf1f9('0x24')]=_['keys'](_0x127fb6['query']);_0x4680c2['filters']=_[_0xf1f9('0x2f')](_0x4680c2[_0xf1f9('0x2b')],_0x4680c2[_0xf1f9('0x24')]);_0x30fac0[_0xf1f9('0x30')]=_[_0xf1f9('0x2f')](_0x4680c2[_0xf1f9('0x2b')],qs[_0xf1f9('0x31')](_0x127fb6[_0xf1f9('0x24')][_0xf1f9('0x31')]));_0x30fac0['attributes']=_0x30fac0['attributes']['length']?_0x30fac0[_0xf1f9('0x30')]:_0x4680c2[_0xf1f9('0x2b')];if(!_0x127fb6[_0xf1f9('0x24')][_0xf1f9('0x3e')](_0xf1f9('0x3f'))){_0x30fac0[_0xf1f9('0x14')]=qs[_0xf1f9('0x14')](_0x127fb6['query'][_0xf1f9('0x14')]);_0x30fac0[_0xf1f9('0x12')]=qs[_0xf1f9('0x12')](_0x127fb6['query'][_0xf1f9('0x12')]);}_0x30fac0['order']=qs[_0xf1f9('0x40')](_0x127fb6['query'][_0xf1f9('0x40')]);_0x30fac0['where']=qs[_0xf1f9('0x2e')](_[_0xf1f9('0x41')](_0x127fb6[_0xf1f9('0x24')],_0x4680c2[_0xf1f9('0x2e')]));_0x30fac0[_0xf1f9('0x42')]['OpenchannelInteractionId']=_0x1b99f8['id'];if(_0x127fb6[_0xf1f9('0x24')][_0xf1f9('0x43')]){_0x30fac0['where']=_[_0xf1f9('0x34')](_0x30fac0['where'],{'$or':_[_0xf1f9('0x1f')](_0x30fac0[_0xf1f9('0x30')],function(_0x39514e){var _0x32c6b4={};_0x32c6b4[_0x39514e]={'$like':'%'+_0x127fb6[_0xf1f9('0x24')][_0xf1f9('0x43')]+'%'};return _0x32c6b4;})});}if(_0x127fb6[_0xf1f9('0x24')]['$gte']){var _0x235576=_0x127fb6[_0xf1f9('0x24')][_0xf1f9('0x44')]['split'](',');var _0x32b4c4={};_0x32b4c4[_0x235576[0x0]]={'$gte':moment(_0x235576[0x1])[_0xf1f9('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30fac0[_0xf1f9('0x42')]=_[_0xf1f9('0x34')](_0x30fac0[_0xf1f9('0x42')],_0x32b4c4);}_0x30fac0=_[_0xf1f9('0x34')]({},_0x30fac0,_0x127fb6['options']);return db[_0xf1f9('0x3a')][_0xf1f9('0x15')]({'where':_0x30fac0['where']})[_0xf1f9('0x18')](function(_0x4c17d3){_0x125c92[_0xf1f9('0x15')]=_0x4c17d3;if(_0x127fb6[_0xf1f9('0x24')][_0xf1f9('0x32')]){_0x30fac0[_0xf1f9('0x33')]=[{'all':!![]}];}return db[_0xf1f9('0x3a')][_0xf1f9('0x23')](_0x30fac0);})['then'](function(_0x362cb7){_0x125c92[_0xf1f9('0x46')]=_0x362cb7;return _0x125c92;});}})[_0xf1f9('0x18')](respondWithFilteredResult(_0x1adb59,_0x30fac0))[_0xf1f9('0x26')](handleError(_0x1adb59,null));};exports['addTags']=function(_0x4112df,_0x256975){return db[_0xf1f9('0x2d')][_0xf1f9('0x35')]({'where':{'id':_0x4112df[_0xf1f9('0x2a')]['id']}})[_0xf1f9('0x18')](handleEntityNotFound(_0x256975,null))[_0xf1f9('0x18')](function(_0xd791e2){if(_0xd791e2){return _0xd791e2[_0xf1f9('0x47')](_0x4112df[_0xf1f9('0x37')]['ids'],_['omit'](_0x4112df[_0xf1f9('0x37')],['ids','id'])||{})[_0xf1f9('0x48')](function(){return db[_0xf1f9('0x49')][_0xf1f9('0x23')]({'attributes':['id','name',_0xf1f9('0x4a')],'where':{'id':_0x4112df[_0xf1f9('0x37')][_0xf1f9('0x3b')]}});})[_0xf1f9('0x18')](function(_0x5d4db3){socket[_0xf1f9('0x4b')](_0xf1f9('0x4c'),{'id':Number(_0x4112df[_0xf1f9('0x2a')]['id']),'tags':_0x5d4db3||[]});return{'id':Number(_0x4112df[_0xf1f9('0x2a')]['id']),'tags':_0x5d4db3||[]};});}})['then'](respondWithResult(_0x256975,null))[_0xf1f9('0x26')](handleError(_0x256975,null));};exports[_0xf1f9('0x4d')]=function(_0x18f955,_0x5014e1){return db[_0xf1f9('0x2d')]['find']({'where':{'id':_0x18f955['params']['id']}})[_0xf1f9('0x18')](handleEntityNotFound(_0x5014e1,null))[_0xf1f9('0x18')](function(_0x12dfd5){if(_0x12dfd5){return _0x12dfd5[_0xf1f9('0x4d')](_0x18f955[_0xf1f9('0x24')]['ids']);}})[_0xf1f9('0x18')](respondWithStatusCode(_0x5014e1,null))[_0xf1f9('0x26')](handleError(_0x5014e1,null));};exports[_0xf1f9('0x4e')]=function(_0x2832e0,_0x44ae32){var _0x2cb49d=moment()[_0xf1f9('0x4f')]()[_0xf1f9('0x50')]();var _0x145f6d=path[_0xf1f9('0x51')](config[_0xf1f9('0x52')],_0xf1f9('0x53'),_0xf1f9('0x54'),_0xf1f9('0x55'));var _0x21e3d6=path['join'](config[_0xf1f9('0x52')],'server','files','attachments');var _0xbb2865=path[_0xf1f9('0x51')](_0x145f6d,_0x2cb49d);var _0x46e6c5=util['format'](_0xf1f9('0x56'),_0x2832e0[_0xf1f9('0x2a')]['id'],_0x2cb49d);var _0x52af8b=path['join'](_0x145f6d,_0x46e6c5);var _0x3bc19f=[];_0x3bc19f['push']({'model':db[_0xf1f9('0x57')],'as':_0xf1f9('0x57'),'attributes':['id',_0xf1f9('0x58')],'raw':!![]});_0x3bc19f[_0xf1f9('0x59')]({'model':db[_0xf1f9('0x5a')],'as':'Contact','attributes':['id',_0xf1f9('0x5b'),_0xf1f9('0x5c')],'raw':!![]});if(_0x2832e0['query'][_0xf1f9('0x5d')]){_0x3bc19f[_0xf1f9('0x59')]({'model':db[_0xf1f9('0x5e')],'as':_0xf1f9('0x5e'),'raw':!![]});}var _0x33ecf9=[{'model':db[_0xf1f9('0x3a')],'as':_0xf1f9('0x5f'),'attributes':['id','body',_0xf1f9('0x60'),_0xf1f9('0x61'),'secret','read'],'include':_0x3bc19f}];_0x33ecf9[_0xf1f9('0x59')]({'model':db[_0xf1f9('0x62')],'as':_0xf1f9('0x63'),'attributes':['id','name']});_0x33ecf9[_0xf1f9('0x59')]({'model':db[_0xf1f9('0x57')],'as':_0xf1f9('0x64'),'attributes':['id','fullname']});return db[_0xf1f9('0x2d')][_0xf1f9('0x35')]({'where':{'id':_0x2832e0['params']['id']},'include':_0x33ecf9})[_0xf1f9('0x18')](handleEntityNotFound(_0x44ae32,null))[_0xf1f9('0x18')](function(_0x1d2527){if(_0x1d2527){var _0x13f8e3=_0x1d2527[_0xf1f9('0x65')]({'plain':!![]});fs[_0xf1f9('0x66')](_0xbb2865);var _0x13e99c={'channel':'Openchannel','account':_0x13f8e3[_0xf1f9('0x63')][_0xf1f9('0x1b')],'agent':_0x13f8e3[_0xf1f9('0x64')]?_0x13f8e3[_0xf1f9('0x64')][_0xf1f9('0x58')]:'N.A.','createdAt':moment(_0x13f8e3[_0xf1f9('0x60')])[_0xf1f9('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf1f9('0x50')](),'closedAt':_0x13f8e3[_0xf1f9('0x67')]?moment(_0x13f8e3[_0xf1f9('0x68')])[_0xf1f9('0x45')](_0xf1f9('0x69'))['toString']():'','disposition':_0x13f8e3[_0xf1f9('0x6a')],'visibility':_0x13f8e3[_0xf1f9('0x6b')]?'Public':'Private','messages':_(_0x13f8e3['Messages'])[_0xf1f9('0x43')]({'secret':![]})[_0xf1f9('0x1f')](function(_0x35fe62){if(_0x35fe62[_0xf1f9('0x5e')]){var _0x4ecc02=path[_0xf1f9('0x51')](_0x21e3d6,_0x35fe62['Attachment'][_0xf1f9('0x6c')]);if(fs['existsSync'](_0x4ecc02)){fs[_0xf1f9('0x6d')](_0x4ecc02)[_0xf1f9('0x6e')](fs[_0xf1f9('0x6f')](path['join'](_0xbb2865,_0x35fe62[_0xf1f9('0x5e')][_0xf1f9('0x6c')])));}}return{'date':moment(_0x35fe62[_0xf1f9('0x60')])[_0xf1f9('0x45')](_0xf1f9('0x69'))[_0xf1f9('0x50')](),'sender':_0x35fe62[_0xf1f9('0x61')]===_0xf1f9('0x70')?_0x35fe62[_0xf1f9('0x57')]?_0x35fe62[_0xf1f9('0x57')][_0xf1f9('0x58')]:_0xf1f9('0x71'):_0x35fe62['Contact']['firstName']+(_0x35fe62['Contact']['lastName']?'\x20'+_0x35fe62['Contact'][_0xf1f9('0x5c')]:''),'body':_0x35fe62['Attachment']?_0x35fe62[_0xf1f9('0x5e')][_0xf1f9('0x6c')]:_0x35fe62['body'],'direction':_0x35fe62[_0xf1f9('0x61')]===_0xf1f9('0x70')?'A':'C','secret':_0x35fe62[_0xf1f9('0x72')],'read':_0x35fe62[_0xf1f9('0x73')],'attachment':_0x35fe62[_0xf1f9('0x5e')]};})[_0xf1f9('0x74')]()};return ejs[_0xf1f9('0x75')](path[_0xf1f9('0x51')](config[_0xf1f9('0x52')],_0xf1f9('0x53'),_0xf1f9('0x76'),'downloadInteraction.ejs'),{'interaction':_0x13e99c})[_0xf1f9('0x18')](function(_0x2ba757){var _0x2a0165=path[_0xf1f9('0x51')](_0xbb2865,'transcript-'+_0x13f8e3['id']+'-'+_0x2cb49d+_0xf1f9('0x77'));var _0x51db5b={'path':_0x2a0165,'channel':_0xf1f9('0x78'),'interactionId':_0x13f8e3['id']};return pdf[_0xf1f9('0x79')](_0x2ba757,_0x51db5b);})[_0xf1f9('0x18')](function(){return new Promise(function(_0xa9edd3,_0x1b4d31){zipdir(_0xbb2865,{'saveTo':_0x52af8b},function(_0x1bb5d1,_0x4093a3){if(_0x1bb5d1)return _0x1b4d31(_0x1bb5d1);return _0xa9edd3(_0x4093a3);});})[_0xf1f9('0x18')](function(){return new Promise(function(_0x25edf3,_0x1cafac){rimraf(_0xbb2865,function(_0x10f51d){if(_0x10f51d)_0x1cafac(_0x10f51d);return _0x25edf3();});});})['then'](function(){return _0x44ae32[_0xf1f9('0x4e')](_0x52af8b,_0x46e6c5,function(_0x5df1ee){if(_0x5df1ee){logger[_0xf1f9('0x1a')](_0xf1f9('0x7a'),_0x5df1ee);}else{fs[_0xf1f9('0x7b')](_0x52af8b);}});});});}else{return _0x44ae32['sendStatus'](0xc8);}})[_0xf1f9('0x26')](handleError(_0x44ae32,null));}; \ No newline at end of file +var _0x4a0c=['transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','Owner','mkdirSync','Openchannel','Account','createdAt','toString','closed','closedAt','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','out','value','renderFile','server','transcript-','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','update','then','destroy','end','stack','name','send','map','OpenchannelInteraction','fieldName','type','getOptions','findAll','openchannel','query','user','catch','from','params','model','rawAttributes','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','findOne','length','hasOwnProperty','sort','where','pick','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','omit','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','tmp','files','attachments'];(function(_0x3770ef,_0xbe038b){var _0x30a940=function(_0x3f324c){while(--_0x3f324c){_0x3770ef['push'](_0x3770ef['shift']());}};_0x30a940(++_0xbe038b);}(_0x4a0c,0x19b));var _0xc4a0=function(_0x4d81ac,_0x4a5246){_0x4d81ac=_0x4d81ac-0x0;var _0x3f5858=_0x4a0c[_0x4d81ac];return _0x3f5858;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc4a0('0x0'));var moment=require(_0xc4a0('0x1'));var util=require(_0xc4a0('0x2'));var path=require(_0xc4a0('0x3'));var ejs=require(_0xc4a0('0x4'));var fs=require('fs');var _=require(_0xc4a0('0x5'));var Redis=require(_0xc4a0('0x6'));var interaction=require(_0xc4a0('0x7'));var qs=require(_0xc4a0('0x8'));var pdf=require(_0xc4a0('0x9'));var logger=require(_0xc4a0('0xa'))(_0xc4a0('0xb'));var config=require(_0xc4a0('0xc'));var db=require('../../mysqldb')['db'];config[_0xc4a0('0xd')]=_['defaults'](config[_0xc4a0('0xd')],{'host':_0xc4a0('0xe'),'port':0x18eb});var socket=require(_0xc4a0('0xf'))(new Redis(config[_0xc4a0('0xd')]));require(_0xc4a0('0x10'))[_0xc4a0('0x11')](socket);function respondWithStatusCode(_0x22e1d4,_0x1a9a22){_0x1a9a22=_0x1a9a22||0xcc;return function(_0x1105e5){if(_0x1105e5){return _0x22e1d4[_0xc4a0('0x12')](_0x1a9a22);}return _0x22e1d4[_0xc4a0('0x13')](_0x1a9a22)['end']();};}function respondWithResult(_0x510f64,_0x50bde0){_0x50bde0=_0x50bde0||0xc8;return function(_0x329c2a){if(_0x329c2a){return _0x510f64['status'](_0x50bde0)[_0xc4a0('0x14')](_0x329c2a);}};}function respondWithFilteredResult(_0x5b9f27,_0x968cbd){return function(_0x333a97){if(_0x333a97){var _0x48d141=typeof _0x968cbd['offset']===_0xc4a0('0x15')&&typeof _0x968cbd['limit']===_0xc4a0('0x15');var _0x3d5a23=_0x333a97[_0xc4a0('0x16')];var _0x1c34bc=_0x48d141?0x0:_0x968cbd[_0xc4a0('0x17')];var _0x5b6822=_0x48d141?_0x333a97[_0xc4a0('0x16')]:_0x968cbd['offset']+_0x968cbd[_0xc4a0('0x18')];var _0x39dfd7;if(_0x5b6822>=_0x3d5a23){_0x5b6822=_0x3d5a23;_0x39dfd7=0xc8;}else{_0x39dfd7=0xce;}_0x5b9f27['status'](_0x39dfd7);return _0x5b9f27[_0xc4a0('0x19')]('Content-Range',_0x1c34bc+'-'+_0x5b6822+'/'+_0x3d5a23)[_0xc4a0('0x14')](_0x333a97);}return null;};}function saveUpdates(_0x2fa931){return function(_0x99c7b7){if(_0x99c7b7){return _0x99c7b7[_0xc4a0('0x1a')](_0x2fa931)[_0xc4a0('0x1b')](function(_0x315e81){return _0x315e81;});}return null;};}function removeEntity(_0x186a1f){return function(_0x4d8f0e){if(_0x4d8f0e){return _0x4d8f0e[_0xc4a0('0x1c')]()['then'](function(){_0x186a1f[_0xc4a0('0x13')](0xcc)[_0xc4a0('0x1d')]();});}};}function handleEntityNotFound(_0x419f82){return function(_0x1c451f){if(!_0x1c451f){_0x419f82['sendStatus'](0x194);}return _0x1c451f;};}function handleError(_0x43d6cb,_0x528c0f){_0x528c0f=_0x528c0f||0x1f4;return function(_0x5ab9e3){logger['error'](_0x5ab9e3[_0xc4a0('0x1e')]);if(_0x5ab9e3[_0xc4a0('0x1f')]){delete _0x5ab9e3['name'];}_0x43d6cb[_0xc4a0('0x13')](_0x528c0f)[_0xc4a0('0x20')](_0x5ab9e3);};}exports['index']=function(_0x4a93f9,_0x44d5d5){var _0x58b13d={};var _0x26393c=_[_0xc4a0('0x21')](db[_0xc4a0('0x22')]['rawAttributes'],function(_0x4ef9a1){return{'name':_0x4ef9a1[_0xc4a0('0x23')],'type':_0x4ef9a1[_0xc4a0('0x24')]['key']};});_0x58b13d=qs[_0xc4a0('0x25')](_0x26393c,_0x4a93f9);return interaction[_0xc4a0('0x26')](_0xc4a0('0x27'),_0x4a93f9[_0xc4a0('0x28')],_0x4a93f9[_0xc4a0('0x29')],_0x58b13d,_0x26393c)[_0xc4a0('0x1b')](respondWithFilteredResult(_0x44d5d5,_0x58b13d))[_0xc4a0('0x2a')](handleError(_0x44d5d5,null));};exports['show']=function(_0x1974e6,_0x5c1d0e){var _0x42c220={};if(_0x1974e6[_0xc4a0('0x28')]['type']&&_0x1974e6[_0xc4a0('0x28')][_0xc4a0('0x24')]===_0xc4a0('0x2b')){_0x42c220[_0xc4a0('0x2b')]=_0x1974e6[_0xc4a0('0x2c')]['id'];}else{_0x42c220['id']=_0x1974e6[_0xc4a0('0x2c')]['id'];}var _0x4ce9ab={'raw':![],'where':_0x42c220},_0x76f581={};_0x76f581[_0xc4a0('0x2d')]=_['keys'](db[_0xc4a0('0x22')][_0xc4a0('0x2e')]);_0x76f581[_0xc4a0('0x28')]=_[_0xc4a0('0x2f')](_0x1974e6['query']);_0x76f581[_0xc4a0('0x30')]=_[_0xc4a0('0x31')](_0x76f581[_0xc4a0('0x2d')],_0x76f581[_0xc4a0('0x28')]);_0x4ce9ab[_0xc4a0('0x32')]=_['intersection'](_0x76f581[_0xc4a0('0x2d')],qs['fields'](_0x1974e6[_0xc4a0('0x28')][_0xc4a0('0x33')]));_0x4ce9ab[_0xc4a0('0x32')]=_0x4ce9ab[_0xc4a0('0x32')]['length']?_0x4ce9ab[_0xc4a0('0x32')]:_0x76f581[_0xc4a0('0x2d')];if(_0x1974e6['query'][_0xc4a0('0x34')]){_0x4ce9ab['include']=[{'all':!![]}];}_0x4ce9ab=_[_0xc4a0('0x35')]({},_0x4ce9ab,_0x1974e6[_0xc4a0('0x36')]);return db[_0xc4a0('0x22')][_0xc4a0('0x37')](_0x4ce9ab)[_0xc4a0('0x1b')](handleEntityNotFound(_0x5c1d0e,null))['then'](respondWithResult(_0x5c1d0e,null))['catch'](handleError(_0x5c1d0e,null));};exports[_0xc4a0('0x38')]=function(_0x5bb6a0,_0x8c99fe){return db[_0xc4a0('0x22')][_0xc4a0('0x38')](_0x5bb6a0[_0xc4a0('0x39')],{})[_0xc4a0('0x1b')](respondWithResult(_0x8c99fe,0xc9))[_0xc4a0('0x2a')](handleError(_0x8c99fe,null));};exports[_0xc4a0('0x1a')]=function(_0x178805,_0x3f6950){if(_0x178805[_0xc4a0('0x39')]['id']){delete _0x178805[_0xc4a0('0x39')]['id'];}return db[_0xc4a0('0x22')][_0xc4a0('0x37')]({'where':{'id':_0x178805[_0xc4a0('0x2c')]['id']}})[_0xc4a0('0x1b')](handleEntityNotFound(_0x3f6950,null))[_0xc4a0('0x1b')](saveUpdates(_0x178805[_0xc4a0('0x39')],null))[_0xc4a0('0x1b')](respondWithResult(_0x3f6950,null))[_0xc4a0('0x2a')](handleError(_0x3f6950,null));};exports[_0xc4a0('0x1c')]=function(_0x21b970,_0x555ae4){return db['OpenchannelInteraction'][_0xc4a0('0x37')]({'where':{'id':_0x21b970[_0xc4a0('0x2c')]['id']}})[_0xc4a0('0x1b')](handleEntityNotFound(_0x555ae4,null))[_0xc4a0('0x1b')](removeEntity(_0x555ae4,null))['catch'](handleError(_0x555ae4,null));};exports[_0xc4a0('0x3a')]=function(_0x51ba6b,_0x4c0b6f){return db['OpenchannelInteraction'][_0xc4a0('0x3a')]()[_0xc4a0('0x1b')](respondWithResult(_0x4c0b6f,null))['catch'](handleError(_0x4c0b6f,null));};exports[_0xc4a0('0x3b')]=function(_0x217059,_0x1dcab6){return db[_0xc4a0('0x3c')][_0xc4a0('0x37')]({'where':{'id':_0x217059['params']['id']}})[_0xc4a0('0x1b')](handleEntityNotFound(_0x1dcab6,null))[_0xc4a0('0x1b')](function(_0x330a12){if(_0x330a12){return _0x330a12['addMessage'](_0x217059[_0xc4a0('0x39')][_0xc4a0('0x3d')],_['omit'](_0x217059[_0xc4a0('0x39')],['ids','id'])||{});}})[_0xc4a0('0x1b')](respondWithResult(_0x1dcab6,null))['catch'](handleError(_0x1dcab6,null));};exports['getMessages']=function(_0xfc3c0b,_0x2138e7){var _0x698eb0={'raw':![],'where':{}};var _0x533c25={};var _0x423c8e={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc4a0('0x3e')]({'where':{'id':_0xfc3c0b['params']['id']}})[_0xc4a0('0x1b')](handleEntityNotFound(_0x2138e7,null))['then'](function(_0x13a766){if(_0x13a766){_0x533c25['model']=_['keys'](db[_0xc4a0('0x3c')][_0xc4a0('0x2e')]);_0x533c25[_0xc4a0('0x28')]=_[_0xc4a0('0x2f')](_0xfc3c0b[_0xc4a0('0x28')]);_0x533c25[_0xc4a0('0x30')]=_[_0xc4a0('0x31')](_0x533c25[_0xc4a0('0x2d')],_0x533c25[_0xc4a0('0x28')]);_0x698eb0[_0xc4a0('0x32')]=_[_0xc4a0('0x31')](_0x533c25[_0xc4a0('0x2d')],qs[_0xc4a0('0x33')](_0xfc3c0b[_0xc4a0('0x28')][_0xc4a0('0x33')]));_0x698eb0[_0xc4a0('0x32')]=_0x698eb0[_0xc4a0('0x32')][_0xc4a0('0x3f')]?_0x698eb0[_0xc4a0('0x32')]:_0x533c25['model'];if(!_0xfc3c0b['query'][_0xc4a0('0x40')]('nolimit')){_0x698eb0['limit']=qs[_0xc4a0('0x18')](_0xfc3c0b[_0xc4a0('0x28')][_0xc4a0('0x18')]);_0x698eb0[_0xc4a0('0x17')]=qs[_0xc4a0('0x17')](_0xfc3c0b[_0xc4a0('0x28')]['offset']);}_0x698eb0['order']=qs[_0xc4a0('0x41')](_0xfc3c0b[_0xc4a0('0x28')][_0xc4a0('0x41')]);_0x698eb0[_0xc4a0('0x42')]=qs[_0xc4a0('0x30')](_[_0xc4a0('0x43')](_0xfc3c0b['query'],_0x533c25[_0xc4a0('0x30')]));_0x698eb0[_0xc4a0('0x42')]['OpenchannelInteractionId']=_0x13a766['id'];if(_0xfc3c0b[_0xc4a0('0x28')]['filter']){_0x698eb0[_0xc4a0('0x42')]=_[_0xc4a0('0x35')](_0x698eb0[_0xc4a0('0x42')],{'$or':_['map'](_0x698eb0[_0xc4a0('0x32')],function(_0x4a7699){var _0x2163d2={};_0x2163d2[_0x4a7699]={'$like':'%'+_0xfc3c0b['query'][_0xc4a0('0x44')]+'%'};return _0x2163d2;})});}if(_0xfc3c0b[_0xc4a0('0x28')]['$gte']){var _0x411a4c=_0xfc3c0b['query']['$gte'][_0xc4a0('0x45')](',');var _0x420ce8={};_0x420ce8[_0x411a4c[0x0]]={'$gte':moment(_0x411a4c[0x1])[_0xc4a0('0x46')](_0xc4a0('0x47'))};_0x698eb0[_0xc4a0('0x42')]=_[_0xc4a0('0x35')](_0x698eb0[_0xc4a0('0x42')],_0x420ce8);}_0x698eb0=_[_0xc4a0('0x35')]({},_0x698eb0,_0xfc3c0b[_0xc4a0('0x36')]);return db[_0xc4a0('0x3c')]['count']({'where':_0x698eb0[_0xc4a0('0x42')]})[_0xc4a0('0x1b')](function(_0x53f9a0){_0x423c8e['count']=_0x53f9a0;if(_0xfc3c0b[_0xc4a0('0x28')][_0xc4a0('0x34')]){_0x698eb0[_0xc4a0('0x48')]=[{'all':!![]}];}return db[_0xc4a0('0x3c')][_0xc4a0('0x26')](_0x698eb0);})[_0xc4a0('0x1b')](function(_0x386590){_0x423c8e[_0xc4a0('0x49')]=_0x386590;return _0x423c8e;});}})[_0xc4a0('0x1b')](respondWithFilteredResult(_0x2138e7,_0x698eb0))[_0xc4a0('0x2a')](handleError(_0x2138e7,null));};exports[_0xc4a0('0x4a')]=function(_0x43827d,_0x4acec9){return db['OpenchannelInteraction'][_0xc4a0('0x37')]({'where':{'id':_0x43827d[_0xc4a0('0x2c')]['id']}})[_0xc4a0('0x1b')](handleEntityNotFound(_0x4acec9,null))[_0xc4a0('0x1b')](function(_0x361f20){if(_0x361f20){return _0x361f20[_0xc4a0('0x4b')](_0x43827d[_0xc4a0('0x39')][_0xc4a0('0x3d')],_[_0xc4a0('0x4c')](_0x43827d['body'],[_0xc4a0('0x3d'),'id'])||{})[_0xc4a0('0x4d')](function(){return db['Tag'][_0xc4a0('0x26')]({'attributes':['id',_0xc4a0('0x1f'),_0xc4a0('0x4e')],'where':{'id':_0x43827d['body'][_0xc4a0('0x3d')]}});})[_0xc4a0('0x1b')](function(_0x411e19){socket[_0xc4a0('0x4f')](_0xc4a0('0x50'),{'id':Number(_0x43827d[_0xc4a0('0x2c')]['id']),'tags':_0x411e19||[]});return{'id':Number(_0x43827d[_0xc4a0('0x2c')]['id']),'tags':_0x411e19||[]};});}})['then'](respondWithResult(_0x4acec9,null))['catch'](handleError(_0x4acec9,null));};exports[_0xc4a0('0x51')]=function(_0x1dd8fb,_0x468098){return db[_0xc4a0('0x22')][_0xc4a0('0x37')]({'where':{'id':_0x1dd8fb[_0xc4a0('0x2c')]['id']}})['then'](handleEntityNotFound(_0x468098,null))[_0xc4a0('0x1b')](function(_0x1a62a5){if(_0x1a62a5){return _0x1a62a5[_0xc4a0('0x51')](_0x1dd8fb['query'][_0xc4a0('0x3d')]);}})[_0xc4a0('0x1b')](respondWithStatusCode(_0x468098,null))[_0xc4a0('0x2a')](handleError(_0x468098,null));};exports[_0xc4a0('0x52')]=function(_0x23010b,_0x158295){var _0xc411b1=moment()[_0xc4a0('0x53')]()['toString']();var _0xc3f16a=path[_0xc4a0('0x54')](config[_0xc4a0('0x55')],'server','files',_0xc4a0('0x56'));var _0x107605=path['join'](config['root'],'server',_0xc4a0('0x57'),_0xc4a0('0x58'));var _0x3e28eb=path[_0xc4a0('0x54')](_0xc3f16a,_0xc411b1);var _0x5528eb=util[_0xc4a0('0x46')](_0xc4a0('0x59'),_0x23010b[_0xc4a0('0x2c')]['id'],_0xc411b1);var _0x17af15=path[_0xc4a0('0x54')](_0xc3f16a,_0x5528eb);var _0x4692af=[];_0x4692af[_0xc4a0('0x5a')]({'model':db[_0xc4a0('0x5b')],'as':_0xc4a0('0x5b'),'attributes':['id',_0xc4a0('0x5c')],'raw':!![]});_0x4692af[_0xc4a0('0x5a')]({'model':db[_0xc4a0('0x5d')],'as':_0xc4a0('0x5e'),'attributes':['id',_0xc4a0('0x5f'),_0xc4a0('0x60')],'raw':!![]});if(_0x23010b[_0xc4a0('0x28')][_0xc4a0('0x58')]){_0x4692af['push']({'model':db['Attachment'],'as':_0xc4a0('0x61'),'raw':!![]});}var _0x4b78b7=[{'model':db[_0xc4a0('0x3c')],'as':_0xc4a0('0x62'),'attributes':['id',_0xc4a0('0x39'),'createdAt',_0xc4a0('0x63'),_0xc4a0('0x64'),_0xc4a0('0x65')],'include':_0x4692af}];_0x4b78b7[_0xc4a0('0x5a')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id','name']});_0x4b78b7[_0xc4a0('0x5a')]({'model':db[_0xc4a0('0x5b')],'as':_0xc4a0('0x66'),'attributes':['id',_0xc4a0('0x5c')]});return db[_0xc4a0('0x22')][_0xc4a0('0x37')]({'where':{'id':_0x23010b[_0xc4a0('0x2c')]['id']},'include':_0x4b78b7})[_0xc4a0('0x1b')](handleEntityNotFound(_0x158295,null))[_0xc4a0('0x1b')](function(_0x383ba0){if(_0x383ba0){var _0x36f08b=_0x383ba0['get']({'plain':!![]});fs[_0xc4a0('0x67')](_0x3e28eb);var _0x48ceb3={'channel':_0xc4a0('0x68'),'account':_0x36f08b[_0xc4a0('0x69')][_0xc4a0('0x1f')],'agent':_0x36f08b[_0xc4a0('0x66')]?_0x36f08b[_0xc4a0('0x66')]['fullname']:'N.A.','createdAt':moment(_0x36f08b[_0xc4a0('0x6a')])['format'](_0xc4a0('0x47'))[_0xc4a0('0x6b')](),'closedAt':_0x36f08b[_0xc4a0('0x6c')]?moment(_0x36f08b[_0xc4a0('0x6d')])[_0xc4a0('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc4a0('0x6b')]():'','disposition':_0x36f08b['disposition'],'visibility':_0x36f08b[_0xc4a0('0x6e')]?_0xc4a0('0x6f'):_0xc4a0('0x70'),'messages':_(_0x36f08b['Messages'])[_0xc4a0('0x44')]({'secret':![]})[_0xc4a0('0x21')](function(_0x482abe){if(_0x482abe[_0xc4a0('0x61')]){var _0x13bf60=path['join'](_0x107605,_0x482abe[_0xc4a0('0x61')][_0xc4a0('0x71')]);if(fs[_0xc4a0('0x72')](_0x13bf60)){fs['createReadStream'](_0x13bf60)[_0xc4a0('0x73')](fs[_0xc4a0('0x74')](path[_0xc4a0('0x54')](_0x3e28eb,_0x482abe[_0xc4a0('0x61')][_0xc4a0('0x71')])));}}return{'date':moment(_0x482abe['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc4a0('0x6b')](),'sender':_0x482abe[_0xc4a0('0x63')]===_0xc4a0('0x75')?_0x482abe['User']?_0x482abe[_0xc4a0('0x5b')][_0xc4a0('0x5c')]:'System':_0x482abe[_0xc4a0('0x5e')][_0xc4a0('0x5f')]+(_0x482abe[_0xc4a0('0x5e')]['lastName']?'\x20'+_0x482abe[_0xc4a0('0x5e')][_0xc4a0('0x60')]:''),'body':_0x482abe[_0xc4a0('0x61')]?_0x482abe[_0xc4a0('0x61')][_0xc4a0('0x71')]:_0x482abe['body'],'direction':_0x482abe['direction']===_0xc4a0('0x75')?'A':'C','secret':_0x482abe[_0xc4a0('0x64')],'read':_0x482abe['read'],'attachment':_0x482abe['Attachment']};})[_0xc4a0('0x76')]()};return ejs[_0xc4a0('0x77')](path[_0xc4a0('0x54')](config[_0xc4a0('0x55')],_0xc4a0('0x78'),'views','downloadInteraction.ejs'),{'interaction':_0x48ceb3})[_0xc4a0('0x1b')](function(_0x58902f){var _0x111049=path[_0xc4a0('0x54')](_0x3e28eb,_0xc4a0('0x79')+_0x36f08b['id']+'-'+_0xc411b1+'.pdf');var _0x216db1={'path':_0x111049,'channel':_0xc4a0('0x68'),'interactionId':_0x36f08b['id']};return pdf[_0xc4a0('0x7a')](_0x58902f,_0x216db1);})[_0xc4a0('0x1b')](function(){return new Promise(function(_0x5d1a21,_0x85ceb3){zipdir(_0x3e28eb,{'saveTo':_0x17af15},function(_0x372826,_0x3c6f7e){if(_0x372826)return _0x85ceb3(_0x372826);return _0x5d1a21(_0x3c6f7e);});})[_0xc4a0('0x1b')](function(){return new Promise(function(_0x5efa2a,_0x53af33){rimraf(_0x3e28eb,function(_0x117d6c){if(_0x117d6c)_0x53af33(_0x117d6c);return _0x5efa2a();});});})[_0xc4a0('0x1b')](function(){return _0x158295[_0xc4a0('0x52')](_0x17af15,_0x5528eb,function(_0x3ad79c){if(_0x3ad79c){logger['error'](_0xc4a0('0x7b'),_0x3ad79c);}else{fs[_0xc4a0('0x7c')](_0x17af15);}});});});}else{return _0x158295[_0xc4a0('0x12')](0xc8);}})[_0xc4a0('0x2a')](handleError(_0x158295,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 91b0f3b..e9beff3 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 _0x7e7f=['length','emit','catch','hook','exports','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','map','unreadMessages'];(function(_0x9c4579,_0x473c2f){var _0x5ab2d2=function(_0x3d0068){while(--_0x3d0068){_0x9c4579['push'](_0x9c4579['shift']());}};_0x5ab2d2(++_0x473c2f);}(_0x7e7f,0x8c));var _0xf7e7=function(_0x200e53,_0x106854){_0x200e53=_0x200e53-0x0;var _0x1c9eec=_0x7e7f[_0x200e53];return _0x1c9eec;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xf7e7('0x0')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xf7e7('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7e7('0x2'),'afterUpdate':_0xf7e7('0x3'),'afterDestroy':_0xf7e7('0x4')};function emitEvent(_0x48d67c){return function(_0x4da42a,_0x2d2ac5,_0x1ce914){_0x4da42a[_0xf7e7('0x5')]({'attributes':['id'],'raw':!![]})[_0xf7e7('0x6')](function(_0x21cde4){_0x4da42a[_0xf7e7('0x7')]('Users',_0x21cde4[_0xf7e7('0x8')](function(_0x1df35e){return{'id':_0x1df35e['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4da42a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf7e7('0x6')](function(_0x57c107){_0x4da42a[_0xf7e7('0x7')](_0xf7e7('0x9'),_0x57c107[_0xf7e7('0xa')]);OpenchannelInteractionEvents[_0xf7e7('0xb')](_0x48d67c+':'+_0x4da42a['id'],_0x4da42a);OpenchannelInteractionEvents[_0xf7e7('0xb')](_0x48d67c,_0x4da42a);_0x1ce914(null);})[_0xf7e7('0xc')](_0x1ce914(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xf7e7('0xd')](e,emitEvent(event));}}module[_0xf7e7('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xaf46=['events','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5bd254,_0x506a4e){var _0x33dfb8=function(_0xaa1cbb){while(--_0xaa1cbb){_0x5bd254['push'](_0x5bd254['shift']());}};_0x33dfb8(++_0x506a4e);}(_0xaf46,0x17a));var _0x6af4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaf46[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x6af4('0x0'));var OpenchannelInteraction=require(_0x6af4('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x6af4('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6af4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6af4('0x3'),'afterDestroy':_0x6af4('0x4')};function emitEvent(_0x31a198){return function(_0x51caf2,_0x5cb94b,_0x4a82c9){_0x51caf2[_0x6af4('0x5')]({'attributes':['id'],'raw':!![]})[_0x6af4('0x6')](function(_0x5cb41d){_0x51caf2[_0x6af4('0x7')](_0x6af4('0x8'),_0x5cb41d[_0x6af4('0x9')](function(_0x80c548){return{'id':_0x80c548['id']};}));return OpenchannelMessage[_0x6af4('0xa')]({'where':{'OpenchannelInteractionId':_0x51caf2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4a13aa){_0x51caf2[_0x6af4('0x7')](_0x6af4('0xb'),_0x4a13aa[_0x6af4('0xc')]);OpenchannelInteractionEvents[_0x6af4('0xd')](_0x31a198+':'+_0x51caf2['id'],_0x51caf2);OpenchannelInteractionEvents[_0x6af4('0xd')](_0x31a198,_0x51caf2);_0x4a82c9(null);})[_0x6af4('0xe')](_0x4a82c9(null));};}for(var e in events){if(events[_0x6af4('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x6af4('0x10')](e,emitEvent(event));}}module[_0x6af4('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 05887ce..7130735 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 _0x7281=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0xcf978d,_0x56538f){var _0x360cef=function(_0x9d68e3){while(--_0x9d68e3){_0xcf978d['push'](_0xcf978d['shift']());}};_0x360cef(++_0x56538f);}(_0x7281,0x153));var _0x1728=function(_0x53e368,_0xfc9c6c){_0x53e368=_0x53e368-0x0;var _0x53af6a=_0x7281[_0x53e368];return _0x53af6a;};'use strict';var _=require(_0x1728('0x0'));var util=require(_0x1728('0x1'));var logger=require(_0x1728('0x2'))(_0x1728('0x3'));var moment=require('moment');var BPromise=require(_0x1728('0x4'));var rp=require(_0x1728('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1728('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x1728('0x7')]=function(_0x40e8b3,_0x5eb5e0){return _0x40e8b3[_0x1728('0x8')](_0x1728('0x9'),attributes,{'tableName':_0x1728('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1728('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0xc0c39c,_0x599da9,_0x468f80){if(_0xc0c39c[_0x1728('0xc')](_0x1728('0xd'))){_0xc0c39c[_0x1728('0xe')]=moment()[_0x1728('0xf')](_0x1728('0x10'));}_0x468f80(null,_0xc0c39c);}}});}; \ No newline at end of file +var _0x9caf=['bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closedAt','format','lodash','util','../../config/logger','api'];(function(_0xeb80c9,_0x3fe888){var _0x259c37=function(_0x49478c){while(--_0x49478c){_0xeb80c9['push'](_0xeb80c9['shift']());}};_0x259c37(++_0x3fe888);}(_0x9caf,0x1ac));var _0xf9ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9caf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf9ca('0x0'));var util=require(_0xf9ca('0x1'));var logger=require(_0xf9ca('0x2'))(_0xf9ca('0x3'));var moment=require('moment');var BPromise=require(_0xf9ca('0x4'));var rp=require(_0xf9ca('0x5'));var fs=require('fs');var path=require(_0xf9ca('0x6'));var rimraf=require('rimraf');var config=require(_0xf9ca('0x7'));var attributes=require(_0xf9ca('0x8'));module[_0xf9ca('0x9')]=function(_0x3be087,_0x14833b){return _0x3be087[_0xf9ca('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0xf9ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf9ca('0xc'),'collate':_0xf9ca('0xd'),'hooks':{'beforeUpdate':function(_0x51a973,_0x1fee6b,_0xc9c2c7){if(_0x51a973['changed']('closed')){_0x51a973[_0xf9ca('0xe')]=moment()[_0xf9ca('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0xc9c2c7(null,_0x51a973);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 40833fa..404726b 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 _0x41e2=['raw','where','attributes','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','body','ids','spread','AddTags','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','options'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x41e2,0xac));var _0x241e=function(_0x1956dc,_0x31c0b5){_0x1956dc=_0x1956dc-0x0;var _0x3b644e=_0x41e2[_0x1956dc];return _0x3b644e;};'use strict';var _=require('lodash');var util=require(_0x241e('0x0'));var moment=require('moment');var BPromise=require(_0x241e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x241e('0x2'))['db'];var utils=require(_0x241e('0x3'));var logger=require('../../config/logger')(_0x241e('0x4'));var config=require(_0x241e('0x5'));var jayson=require(_0x241e('0x6'));var client=jayson[_0x241e('0x7')][_0x241e('0x8')]({'port':0x232a});config[_0x241e('0x9')]=_[_0x241e('0xa')](config['redis'],{'host':_0x241e('0xb'),'port':0x18eb});var socket=require(_0x241e('0xc'))(new Redis(config[_0x241e('0x9')]));require(_0x241e('0xd'))[_0x241e('0xe')](socket);function respondWithRpcPromise(_0x1285ed,_0x15235b,_0xf35b09){return new BPromise(function(_0x4d9aca,_0x306a59){return client['request'](_0x1285ed,_0xf35b09)['then'](function(_0x11e801){logger[_0x241e('0xf')](_0x241e('0x10'),_0x15235b,_0x241e('0x11'));logger[_0x241e('0x12')](_0x241e('0x13'),_0x15235b,_0x241e('0x11'),JSON[_0x241e('0x14')](_0x11e801));if(_0x11e801[_0x241e('0x15')]){if(_0x11e801[_0x241e('0x15')][_0x241e('0x16')]===0x1f4){logger[_0x241e('0x15')](_0x241e('0x10'),_0x15235b,_0x11e801[_0x241e('0x15')][_0x241e('0x17')]);return _0x306a59(_0x11e801[_0x241e('0x15')][_0x241e('0x17')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x15235b,_0x11e801['error']['message']);return _0x4d9aca(_0x11e801[_0x241e('0x15')][_0x241e('0x17')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x15235b,_0x241e('0x11'));_0x4d9aca(_0x11e801[_0x241e('0x18')][_0x241e('0x17')]);}})[_0x241e('0x19')](function(_0xef6bdb){logger[_0x241e('0x15')](_0x241e('0x10'),_0x15235b,_0xef6bdb);_0x306a59(_0xef6bdb);});});}exports['UpdateOpenchannelInteraction']=function(_0x402708){var _0x2a2f6d=this;return new Promise(function(_0x1fbee4,_0x54822f){return db[_0x241e('0x1a')]['update'](_0x402708['body'],{'raw':_0x402708[_0x241e('0x1b')]?_0x402708[_0x241e('0x1b')][_0x241e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x402708[_0x241e('0x1b')]?_0x402708[_0x241e('0x1b')][_0x241e('0x1d')]||null:null,'attributes':_0x402708['options']?_0x402708[_0x241e('0x1b')][_0x241e('0x1e')]||null:null,'limit':_0x402708['options']?_0x402708[_0x241e('0x1b')]['limit']||null:null})[_0x241e('0x1f')](function(_0x11f3b5){logger['info'](_0x241e('0x20'),_0x402708);logger[_0x241e('0x12')](_0x241e('0x20'),_0x402708,JSON[_0x241e('0x14')](_0x11f3b5));_0x1fbee4(_0x11f3b5);})[_0x241e('0x19')](function(_0x2ecef3){logger[_0x241e('0x15')]('UpdateOpenchannelInteraction',_0x2ecef3['message'],_0x402708);_0x54822f(_0x2a2f6d[_0x241e('0x15')](0x1f4,_0x2ecef3[_0x241e('0x17')]));});});};exports[_0x241e('0x21')]=function(_0x5de4b8){return new Promise(function(_0x5b966b,_0x3293be){return db['OpenchannelInteraction'][_0x241e('0x22')]({'where':_0x5de4b8['options']?_0x5de4b8['options'][_0x241e('0x1d')]||null:null})[_0x241e('0x1f')](function(_0x1f832b){if(_0x1f832b){return _0x1f832b[_0x241e('0x23')](_0x5de4b8[_0x241e('0x24')][_0x241e('0x25')],_['omit'](_0x5de4b8[_0x241e('0x24')],[_0x241e('0x25'),'id'])||{});}})[_0x241e('0x26')](function(_0x164990){logger['info']('AddTags',_0x5de4b8);logger[_0x241e('0x12')](_0x241e('0x27'),_0x5de4b8,JSON[_0x241e('0x14')](_0x164990));_0x5b966b(_0x164990);})[_0x241e('0x19')](function(_0x48e777){logger['error'](_0x241e('0x27'),_0x48e777[_0x241e('0x17')],_0x5de4b8);_0x3293be(_this['error'](0x1f4,_0x48e777[_0x241e('0x17')]));});});}; \ No newline at end of file +var _0xe7e2=['options','raw','where','attributes','limit','UpdateOpenchannelInteraction','ids','omit','spread','info','AddTags','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body'];(function(_0x127fba,_0x5180e5){var _0x169c96=function(_0x4eed76){while(--_0x4eed76){_0x127fba['push'](_0x127fba['shift']());}};_0x169c96(++_0x5180e5);}(_0xe7e2,0x1a5));var _0x2e7e=function(_0x5e2063,_0x56e580){_0x5e2063=_0x5e2063-0x0;var _0x505b1a=_0xe7e2[_0x5e2063];return _0x505b1a;};'use strict';var _=require(_0x2e7e('0x0'));var util=require(_0x2e7e('0x1'));var moment=require(_0x2e7e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e7e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e7e('0x4'));var logger=require('../../config/logger')(_0x2e7e('0x5'));var config=require(_0x2e7e('0x6'));var jayson=require(_0x2e7e('0x7'));var client=jayson[_0x2e7e('0x8')][_0x2e7e('0x9')]({'port':0x232a});config[_0x2e7e('0xa')]=_[_0x2e7e('0xb')](config[_0x2e7e('0xa')],{'host':_0x2e7e('0xc'),'port':0x18eb});var socket=require(_0x2e7e('0xd'))(new Redis(config['redis']));require(_0x2e7e('0xe'))['register'](socket);function respondWithRpcPromise(_0x3afdfb,_0x2d26e7,_0x10c37c){return new BPromise(function(_0x2a5273,_0x1c29fb){return client[_0x2e7e('0xf')](_0x3afdfb,_0x10c37c)[_0x2e7e('0x10')](function(_0x57babe){logger['info'](_0x2e7e('0x11'),_0x2d26e7,'request\x20sent');logger[_0x2e7e('0x12')](_0x2e7e('0x13'),_0x2d26e7,_0x2e7e('0x14'),JSON[_0x2e7e('0x15')](_0x57babe));if(_0x57babe[_0x2e7e('0x16')]){if(_0x57babe[_0x2e7e('0x16')][_0x2e7e('0x17')]===0x1f4){logger[_0x2e7e('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2d26e7,_0x57babe[_0x2e7e('0x16')]['message']);return _0x1c29fb(_0x57babe[_0x2e7e('0x16')][_0x2e7e('0x18')]);}logger[_0x2e7e('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2d26e7,_0x57babe[_0x2e7e('0x16')][_0x2e7e('0x18')]);return _0x2a5273(_0x57babe[_0x2e7e('0x16')][_0x2e7e('0x18')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2d26e7,'request\x20sent');_0x2a5273(_0x57babe[_0x2e7e('0x19')][_0x2e7e('0x18')]);}})[_0x2e7e('0x1a')](function(_0x183f9e){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2d26e7,_0x183f9e);_0x1c29fb(_0x183f9e);});});}exports['UpdateOpenchannelInteraction']=function(_0x5b22a4){var _0x107b26=this;return new Promise(function(_0x22a7b1,_0x1b64cc){return db[_0x2e7e('0x1b')][_0x2e7e('0x1c')](_0x5b22a4[_0x2e7e('0x1d')],{'raw':_0x5b22a4[_0x2e7e('0x1e')]?_0x5b22a4[_0x2e7e('0x1e')][_0x2e7e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b22a4[_0x2e7e('0x1e')]?_0x5b22a4['options'][_0x2e7e('0x20')]||null:null,'attributes':_0x5b22a4[_0x2e7e('0x1e')]?_0x5b22a4[_0x2e7e('0x1e')][_0x2e7e('0x21')]||null:null,'limit':_0x5b22a4[_0x2e7e('0x1e')]?_0x5b22a4[_0x2e7e('0x1e')][_0x2e7e('0x22')]||null:null})[_0x2e7e('0x10')](function(_0x1557ef){logger['info']('UpdateOpenchannelInteraction',_0x5b22a4);logger[_0x2e7e('0x12')]('UpdateOpenchannelInteraction',_0x5b22a4,JSON[_0x2e7e('0x15')](_0x1557ef));_0x22a7b1(_0x1557ef);})[_0x2e7e('0x1a')](function(_0x9d7df4){logger[_0x2e7e('0x16')](_0x2e7e('0x23'),_0x9d7df4[_0x2e7e('0x18')],_0x5b22a4);_0x1b64cc(_0x107b26['error'](0x1f4,_0x9d7df4['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x38e5ba){return new Promise(function(_0x4b929c,_0x41a559){return db[_0x2e7e('0x1b')]['find']({'where':_0x38e5ba[_0x2e7e('0x1e')]?_0x38e5ba['options'][_0x2e7e('0x20')]||null:null})['then'](function(_0x58beee){if(_0x58beee){return _0x58beee['addTags'](_0x38e5ba[_0x2e7e('0x1d')][_0x2e7e('0x24')],_[_0x2e7e('0x25')](_0x38e5ba[_0x2e7e('0x1d')],[_0x2e7e('0x24'),'id'])||{});}})[_0x2e7e('0x26')](function(_0x5e7462){logger[_0x2e7e('0x27')]('AddTags',_0x38e5ba);logger['debug'](_0x2e7e('0x28'),_0x38e5ba,JSON[_0x2e7e('0x15')](_0x5e7462));_0x4b929c(_0x5e7462);})['catch'](function(_0x527c46){logger[_0x2e7e('0x16')](_0x2e7e('0x28'),_0x527c46[_0x2e7e('0x18')],_0x38e5ba);_0x41a559(_this['error'](0x1f4,_0x527c46[_0x2e7e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e09fa16..85626f6 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 _0xd1bd=['remove','register','openchannelInteraction:','save'];(function(_0x4fbb1f,_0x1d1e9b){var _0x2e8dea=function(_0x1e4d95){while(--_0x1e4d95){_0x4fbb1f['push'](_0x4fbb1f['shift']());}};_0x2e8dea(++_0x1d1e9b);}(_0xd1bd,0xeb));var _0xdd1b=function(_0xdea277,_0x495b07){_0xdea277=_0xdea277-0x0;var _0x1cb40e=_0xd1bd[_0xdea277];return _0x1cb40e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xdd1b('0x0'),_0xdd1b('0x1'),'update'];function createListener(_0x10e9ca,_0x279c52){return function(_0x26f047){_0x279c52['emit'](_0x10e9ca,_0x26f047);};}function removeListener(_0x56482d,_0xbb11db){return function(){OpenchannelInteractionEvents['removeListener'](_0x56482d,_0xbb11db);};}exports[_0xdd1b('0x2')]=function(_0x470c34){for(var _0x5b0479=0x0,_0x2717bc=events['length'];_0x5b0479<_0x2717bc;_0x5b0479++){var _0x2f10f6=events[_0x5b0479];var _0x1ab746=createListener(_0xdd1b('0x3')+_0x2f10f6,_0x470c34);OpenchannelInteractionEvents['on'](_0x2f10f6,_0x1ab746);}}; \ No newline at end of file +var _0xcd1a=['openchannelInteraction:','save','remove','update','removeListener','register','length'];(function(_0xcf8c8a,_0xaf2cfc){var _0x2f84af=function(_0x5ab35b){while(--_0x5ab35b){_0xcf8c8a['push'](_0xcf8c8a['shift']());}};_0x2f84af(++_0xaf2cfc);}(_0xcd1a,0x1c1));var _0xacd1=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xcd1a[_0x53ccf2];return _0x5a2964;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xacd1('0x0'),_0xacd1('0x1'),_0xacd1('0x2')];function createListener(_0x2ac2ab,_0x14e653){return function(_0x213112){_0x14e653['emit'](_0x2ac2ab,_0x213112);};}function removeListener(_0x217641,_0x1a373b){return function(){OpenchannelInteractionEvents[_0xacd1('0x3')](_0x217641,_0x1a373b);};}exports[_0xacd1('0x4')]=function(_0xfa2078){for(var _0x54199c=0x0,_0x186d62=events[_0xacd1('0x5')];_0x54199c<_0x186d62;_0x54199c++){var _0x1f172c=events[_0x54199c];var _0x3696f4=createListener(_0xacd1('0x6')+_0x1f172c,_0xfa2078);OpenchannelInteractionEvents['on'](_0x1f172c,_0x3696f4);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d8cc74d..191e69f 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x565153,_0x2cdb52){var _0xe89dde=function(_0x51d8e0){while(--_0x51d8e0){_0x565153['push'](_0x565153['shift']());}};_0xe89dde(++_0x2cdb52);}(_0xedd9,0xfc));var _0x9edd=function(_0x1a2dc0,_0x4e9565){_0x1a2dc0=_0x1a2dc0-0x0;var _0x14affa=_0xedd9[_0x1a2dc0];return _0x14affa;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +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(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xcb91[_0x2ef8f1];return _0x17498d;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 78426c9..e0341d6 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 _0x9158=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x9158,0x16e));var _0x8915=function(_0x4e84a3,_0x4c4903){_0x4e84a3=_0x4e84a3-0x0;var _0x5ec9ef=_0x9158[_0x4e84a3];return _0x5ec9ef;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'body':{'type':Sequelize[_0x8915('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8915('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8915('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8915('0x5')]},'providerName':{'type':Sequelize[_0x8915('0x6')]},'providerResponse':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file +var _0x6ea9=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4b76cb,_0xba6fcc){var _0x4c23d3=function(_0x4d98ec){while(--_0x4d98ec){_0x4b76cb['push'](_0x4b76cb['shift']());}};_0x4c23d3(++_0xba6fcc);}(_0x6ea9,0x89));var _0x96ea=function(_0x55383f,_0x3c8425){_0x55383f=_0x55383f-0x0;var _0x50a725=_0x6ea9[_0x55383f];return _0x50a725;};'use strict';var Sequelize=require(_0x96ea('0x0'));module[_0x96ea('0x1')]={'body':{'type':Sequelize[_0x96ea('0x2')](_0x96ea('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96ea('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x96ea('0x5')]('in',_0x96ea('0x6')),'defaultValue':_0x96ea('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x96ea('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 25871e6..74ee371 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 _0xc8e0=['show','rawAttributes','includeAll','find','create','body','params','destroy','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','User','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','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','limit','undefined','count','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','OpenchannelMessage','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','rows'];(function(_0x39e424,_0x2fc104){var _0x4f7715=function(_0x4b6c59){while(--_0x4b6c59){_0x39e424['push'](_0x39e424['shift']());}};_0x4f7715(++_0x2fc104);}(_0xc8e0,0xb7));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x0c8e('0x0'));var rimraf=require(_0x0c8e('0x1'));var zipdir=require(_0x0c8e('0x2'));var jsonpatch=require(_0x0c8e('0x3'));var rp=require(_0x0c8e('0x4'));var moment=require(_0x0c8e('0x5'));var BPromise=require(_0x0c8e('0x6'));var Mustache=require(_0x0c8e('0x7'));var util=require(_0x0c8e('0x8'));var path=require(_0x0c8e('0x9'));var sox=require('sox');var csv=require(_0x0c8e('0xa'));var ejs=require(_0x0c8e('0xb'));var fs=require('fs');var fs_extra=require(_0x0c8e('0xc'));var _=require(_0x0c8e('0xd'));var squel=require(_0x0c8e('0xe'));var crypto=require('crypto');var jsforce=require(_0x0c8e('0xf'));var deskjs=require(_0x0c8e('0x10'));var toCsv=require(_0x0c8e('0xa'));var querystring=require('querystring');var Papa=require(_0x0c8e('0x11'));var Redis=require(_0x0c8e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c8e('0x13'));var as=require(_0x0c8e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0c8e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0c8e('0x16')]=_['defaults'](config[_0x0c8e('0x16')],{'host':_0x0c8e('0x17'),'port':0x18eb});var socket=require(_0x0c8e('0x18'))(new Redis(config['redis']));require(_0x0c8e('0x19'))[_0x0c8e('0x1a')](socket);var jayson=require(_0x0c8e('0x1b'));var client=jayson[_0x0c8e('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x0c8e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f465,_0x3a76ba,_0x448267,_0x1d984f){return new BPromise(function(_0x5c4436,_0x165c41){var _0x1f686c=_0x1d984f||client;return _0x1f686c['request'](_0x8f465,_0x448267)[_0x0c8e('0x1d')](function(_0x36757a){logger[_0x0c8e('0x1e')](_0x0c8e('0x1f'),_0x3a76ba,_0x0c8e('0x20'));logger[_0x0c8e('0x21')](_0x0c8e('0x22'),_0x3a76ba,_0x0c8e('0x20'),JSON['stringify'](_0x36757a));if(_0x36757a[_0x0c8e('0x23')]){if(_0x36757a['error'][_0x0c8e('0x24')]===0x1f4){logger[_0x0c8e('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x3a76ba,_0x36757a[_0x0c8e('0x23')]['message']);return _0x165c41(_0x36757a['error'][_0x0c8e('0x25')]);}logger[_0x0c8e('0x23')](_0x0c8e('0x1f'),_0x3a76ba,_0x36757a[_0x0c8e('0x23')][_0x0c8e('0x25')]);return _0x5c4436(_0x36757a['error'][_0x0c8e('0x25')]);}else{logger[_0x0c8e('0x1e')](_0x0c8e('0x1f'),_0x3a76ba,'request\x20sent');_0x5c4436(_0x36757a[_0x0c8e('0x26')][_0x0c8e('0x25')]);}})[_0x0c8e('0x27')](function(_0x2964d2){logger[_0x0c8e('0x23')](_0x0c8e('0x1f'),_0x3a76ba,_0x2964d2);_0x165c41(_0x2964d2);});});}function respondWithStatusCode(_0x5cc13d,_0x1c80d3){_0x1c80d3=_0x1c80d3||0xcc;return function(_0x3aa626){if(_0x3aa626){return _0x5cc13d[_0x0c8e('0x28')](_0x1c80d3);}return _0x5cc13d[_0x0c8e('0x29')](_0x1c80d3)['end']();};}function respondWithResult(_0x19bee7,_0x494569){_0x494569=_0x494569||0xc8;return function(_0xda9a78){if(_0xda9a78){return _0x19bee7['status'](_0x494569)[_0x0c8e('0x2a')](_0xda9a78);}};}function respondWithFilteredResult(_0x4ca5ca,_0xde03a3){return function(_0x1e07fd){if(_0x1e07fd){var _0x2d6df8=typeof _0xde03a3[_0x0c8e('0x2b')]==='undefined'&&typeof _0xde03a3[_0x0c8e('0x2c')]===_0x0c8e('0x2d');var _0x4093f6=_0x1e07fd[_0x0c8e('0x2e')];var _0x2514d4=_0x2d6df8?0x0:_0xde03a3[_0x0c8e('0x2b')];var _0x3e6462=_0x2d6df8?_0x1e07fd[_0x0c8e('0x2e')]:_0xde03a3[_0x0c8e('0x2b')]+_0xde03a3[_0x0c8e('0x2c')];var _0xfa7663;if(_0x3e6462>=_0x4093f6){_0x3e6462=_0x4093f6;_0xfa7663=0xc8;}else{_0xfa7663=0xce;}_0x4ca5ca[_0x0c8e('0x29')](_0xfa7663);return _0x4ca5ca[_0x0c8e('0x2f')](_0x0c8e('0x30'),_0x2514d4+'-'+_0x3e6462+'/'+_0x4093f6)['json'](_0x1e07fd);}return null;};}function patchUpdates(_0x25ac64){return function(_0x187bae){try{jsonpatch[_0x0c8e('0x31')](_0x187bae,_0x25ac64,!![]);}catch(_0x4d4c44){return BPromise[_0x0c8e('0x32')](_0x4d4c44);}return _0x187bae[_0x0c8e('0x33')]();};}function saveUpdates(_0x41501c,_0x43d38d){return function(_0x557c73){if(_0x557c73){return _0x557c73[_0x0c8e('0x34')](_0x41501c)[_0x0c8e('0x1d')](function(_0x204024){return _0x204024;});}return null;};}function removeEntity(_0x958a75,_0x347f9c){return function(_0x524f6c){if(_0x524f6c){return _0x524f6c['destroy']()[_0x0c8e('0x1d')](function(){_0x958a75[_0x0c8e('0x29')](0xcc)[_0x0c8e('0x35')]();});}};}function handleEntityNotFound(_0x311dd1,_0x5a466f){return function(_0x56c1ba){if(!_0x56c1ba){_0x311dd1[_0x0c8e('0x28')](0x194);}return _0x56c1ba;};}function handleError(_0x44b169,_0xf8c32a){_0xf8c32a=_0xf8c32a||0x1f4;return function(_0x1c692e){logger[_0x0c8e('0x23')](_0x1c692e[_0x0c8e('0x36')]);if(_0x1c692e[_0x0c8e('0x37')]){delete _0x1c692e[_0x0c8e('0x37')];}_0x44b169['status'](_0xf8c32a)[_0x0c8e('0x38')](_0x1c692e);};}exports[_0x0c8e('0x39')]=function(_0x5232cb,_0x40a5ed){var _0x54331a={},_0x2c2b67={},_0x115d89={'count':0x0,'rows':[]};var _0x9ef1a8=_[_0x0c8e('0x3a')](db[_0x0c8e('0x3b')]['rawAttributes'],function(_0x5ef5bb){return{'name':_0x5ef5bb['fieldName'],'type':_0x5ef5bb['type']['key']};});_0x2c2b67[_0x0c8e('0x3c')]=_[_0x0c8e('0x3a')](_0x9ef1a8,'name');_0x2c2b67[_0x0c8e('0x3d')]=_[_0x0c8e('0x3e')](_0x5232cb[_0x0c8e('0x3d')]);_0x2c2b67[_0x0c8e('0x3f')]=_[_0x0c8e('0x40')](_0x2c2b67[_0x0c8e('0x3c')],_0x2c2b67[_0x0c8e('0x3d')]);_0x54331a[_0x0c8e('0x41')]=_['intersection'](_0x2c2b67['model'],qs[_0x0c8e('0x42')](_0x5232cb['query'][_0x0c8e('0x42')]));_0x54331a[_0x0c8e('0x41')]=_0x54331a[_0x0c8e('0x41')][_0x0c8e('0x43')]?_0x54331a[_0x0c8e('0x41')]:_0x2c2b67[_0x0c8e('0x3c')];if(!_0x5232cb[_0x0c8e('0x3d')][_0x0c8e('0x44')]('nolimit')){_0x54331a['limit']=qs[_0x0c8e('0x2c')](_0x5232cb['query'][_0x0c8e('0x2c')]);_0x54331a[_0x0c8e('0x2b')]=qs[_0x0c8e('0x2b')](_0x5232cb[_0x0c8e('0x3d')]['offset']);}_0x54331a[_0x0c8e('0x45')]=qs[_0x0c8e('0x46')](_0x5232cb['query'][_0x0c8e('0x46')]);_0x54331a[_0x0c8e('0x47')]=qs['filters'](_[_0x0c8e('0x48')](_0x5232cb[_0x0c8e('0x3d')],_0x2c2b67[_0x0c8e('0x3f')]),_0x9ef1a8);if(_0x5232cb[_0x0c8e('0x3d')][_0x0c8e('0x49')]){_0x54331a[_0x0c8e('0x47')]=_['merge'](_0x54331a[_0x0c8e('0x47')],{'$or':_[_0x0c8e('0x3a')](_0x9ef1a8,function(_0x2a84e6){if(_0x2a84e6[_0x0c8e('0x4a')]!==_0x0c8e('0x4b')){var _0x3d44cf={};_0x3d44cf[_0x2a84e6[_0x0c8e('0x37')]]={'$like':'%'+_0x5232cb[_0x0c8e('0x3d')][_0x0c8e('0x49')]+'%'};return _0x3d44cf;}})});}_0x54331a=_[_0x0c8e('0x4c')]({},_0x54331a,_0x5232cb[_0x0c8e('0x4d')]);var _0x528016={'where':_0x54331a[_0x0c8e('0x47')]};return db[_0x0c8e('0x3b')][_0x0c8e('0x2e')](_0x528016)[_0x0c8e('0x1d')](function(_0x42e9bf){_0x115d89['count']=_0x42e9bf;if(_0x5232cb[_0x0c8e('0x3d')]['includeAll']){_0x54331a['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x54331a);})[_0x0c8e('0x1d')](function(_0x44d1ed){_0x115d89[_0x0c8e('0x4e')]=_0x44d1ed;return _0x115d89;})[_0x0c8e('0x1d')](respondWithFilteredResult(_0x40a5ed,_0x54331a))[_0x0c8e('0x27')](handleError(_0x40a5ed,null));};exports[_0x0c8e('0x4f')]=function(_0xb922f5,_0x146000){var _0x49fec9={'raw':!![],'where':{'id':_0xb922f5['params']['id']}},_0x565663={};_0x565663[_0x0c8e('0x3c')]=_[_0x0c8e('0x3e')](db[_0x0c8e('0x3b')][_0x0c8e('0x50')]);_0x565663[_0x0c8e('0x3d')]=_[_0x0c8e('0x3e')](_0xb922f5[_0x0c8e('0x3d')]);_0x565663[_0x0c8e('0x3f')]=_['intersection'](_0x565663[_0x0c8e('0x3c')],_0x565663[_0x0c8e('0x3d')]);_0x49fec9[_0x0c8e('0x41')]=_[_0x0c8e('0x40')](_0x565663['model'],qs['fields'](_0xb922f5[_0x0c8e('0x3d')]['fields']));_0x49fec9[_0x0c8e('0x41')]=_0x49fec9[_0x0c8e('0x41')][_0x0c8e('0x43')]?_0x49fec9[_0x0c8e('0x41')]:_0x565663[_0x0c8e('0x3c')];if(_0xb922f5[_0x0c8e('0x3d')][_0x0c8e('0x51')]){_0x49fec9['include']=[{'all':!![]}];}_0x49fec9=_['merge']({},_0x49fec9,_0xb922f5[_0x0c8e('0x4d')]);return db[_0x0c8e('0x3b')][_0x0c8e('0x52')](_0x49fec9)[_0x0c8e('0x1d')](handleEntityNotFound(_0x146000,null))['then'](respondWithResult(_0x146000,null))['catch'](handleError(_0x146000,null));};exports[_0x0c8e('0x53')]=function(_0x1bd8d5,_0x3e86cc){return db[_0x0c8e('0x3b')][_0x0c8e('0x53')](_0x1bd8d5[_0x0c8e('0x54')],{})[_0x0c8e('0x1d')](respondWithResult(_0x3e86cc,0xc9))[_0x0c8e('0x27')](handleError(_0x3e86cc,null));};exports[_0x0c8e('0x34')]=function(_0xe34b92,_0x136d04){if(_0xe34b92[_0x0c8e('0x54')]['id']){delete _0xe34b92[_0x0c8e('0x54')]['id'];}return db[_0x0c8e('0x3b')][_0x0c8e('0x52')]({'where':{'id':_0xe34b92[_0x0c8e('0x55')]['id']}})[_0x0c8e('0x1d')](handleEntityNotFound(_0x136d04,null))['then'](saveUpdates(_0xe34b92[_0x0c8e('0x54')],null))[_0x0c8e('0x1d')](respondWithResult(_0x136d04,null))[_0x0c8e('0x27')](handleError(_0x136d04,null));};exports[_0x0c8e('0x56')]=function(_0x374118,_0xdda705){return db[_0x0c8e('0x3b')][_0x0c8e('0x52')]({'where':{'id':_0x374118['params']['id']}})[_0x0c8e('0x1d')](handleEntityNotFound(_0xdda705,null))[_0x0c8e('0x1d')](removeEntity(_0xdda705,null))[_0x0c8e('0x27')](handleError(_0xdda705,null));};exports[_0x0c8e('0x57')]=function(_0x593f69,_0x4c56c1){return db[_0x0c8e('0x3b')][_0x0c8e('0x57')]()['then'](respondWithResult(_0x4c56c1,null))[_0x0c8e('0x27')](handleError(_0x4c56c1,null));};var interaction_log=require(_0x0c8e('0x58'))(_0x0c8e('0x59'));exports[_0x0c8e('0x5a')]=function(_0x2fc75c,_0x4ab22a,_0x712397){var _0x284917={'agent':{},'channel':_0x0c8e('0x5b')};if(_0x2fc75c[_0x0c8e('0x54')]['id']){delete _0x2fc75c['body']['id'];}_0x2fc75c[_0x0c8e('0x54')][_0x0c8e('0x5c')]=!![];_0x2fc75c[_0x0c8e('0x54')][_0x0c8e('0x5d')]=moment()[_0x0c8e('0x5e')](_0x0c8e('0x5f'));_0x2fc75c[_0x0c8e('0x54')]['UserId']=_0x2fc75c[_0x0c8e('0x54')][_0x0c8e('0x60')]||_0x2fc75c['user']['id'];_0x284917[_0x0c8e('0x61')]['id']=_0x2fc75c[_0x0c8e('0x54')][_0x0c8e('0x60')];return db['OpenchannelMessage'][_0x0c8e('0x52')]({'where':{'id':_0x2fc75c[_0x0c8e('0x55')]['id'],'UserId':null}})[_0x0c8e('0x1d')](handleEntityNotFound(_0x4ab22a,null))[_0x0c8e('0x1d')](saveUpdates(_0x2fc75c[_0x0c8e('0x54')],null))[_0x0c8e('0x1d')](function(_0x5139f7){if(_0x5139f7){_0x284917[_0x0c8e('0x25')]=_0x5139f7[_0x0c8e('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x0c8e('0x52')]({'where':{'id':_0x5139f7['OpenchannelInteractionId']}});}return null;})[_0x0c8e('0x1d')](handleEntityNotFound(_0x4ab22a,null))['then'](function(_0x3a0c8c){if(_0x3a0c8c){return _0x3a0c8c[_0x0c8e('0x34')]({'UserId':_0x2fc75c[_0x0c8e('0x54')][_0x0c8e('0x60')],'read1stAt':_[_0x0c8e('0x63')](_0x3a0c8c[_0x0c8e('0x64')])?moment()[_0x0c8e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1842e5){if(_0x1842e5){_0x284917[_0x0c8e('0x65')]=_0x1842e5[_0x0c8e('0x62')]({'plain':!![]});interaction_log[_0x0c8e('0x1e')](_0x0c8e('0x66'),_0x2fc75c[_0x0c8e('0x67')]['id'],_0x2fc75c[_0x0c8e('0x67')][_0x0c8e('0x37')],_0x2fc75c[_0x0c8e('0x67')][_0x0c8e('0x68')],_0x284917[_0x0c8e('0x65')]['id'],_0x2fc75c[_0x0c8e('0x54')]?JSON[_0x0c8e('0x69')](_0x2fc75c[_0x0c8e('0x54')]):_0x0c8e('0x6a'));return respondWithRpcPromise(_0x0c8e('0x6b'),'acceptMessage',_0x284917);}return null;})[_0x0c8e('0x1d')](function(_0x31847b){var _0x2bc206=_0x0c8e('0x6c')+_0x31847b[_0x0c8e('0x25')][_0x0c8e('0x6d')];return db[_0x0c8e('0x6e')][_0x0c8e('0x3d')](_0x2bc206,{'type':db['Sequelize'][_0x0c8e('0x6f')]['SELECT'],'raw':!![]})[_0x0c8e('0x1d')](function(_0x544072){return _0x544072;});})[_0x0c8e('0x1d')](function(_0x55ade1){if(_0x55ade1){_0x284917[_0x0c8e('0x25')]['contact']=_0x55ade1[0x0];if(!_0x2fc75c[_0x0c8e('0x54')][_0x0c8e('0x60')])return;return db['User']['find']({'where':{'id':_0x2fc75c[_0x0c8e('0x54')][_0x0c8e('0x60')],'role':'agent'},'attributes':['id',_0x0c8e('0x37'),_0x0c8e('0x70'),_0x0c8e('0x71'),_0x0c8e('0x72')],'raw':!![]});}return null;})[_0x0c8e('0x1d')](function(_0x42f03e){if(!_0x42f03e)return null;_0x284917[_0x0c8e('0x25')]['agent']=_0x42f03e;return _0x284917;})[_0x0c8e('0x1d')](function(_0x3c26dc){if(_0x3c26dc){if(_0x2fc75c[_0x0c8e('0x54')][_0x0c8e('0x73')]){_0x284917['message']['interface']=util[_0x0c8e('0x5e')](_0x0c8e('0x74'),_0x2fc75c[_0x0c8e('0x67')]['name']);_0x284917['message'][_0x0c8e('0x75')]=_0x284917['channel'];_0x284917[_0x0c8e('0x25')][_0x0c8e('0x76')]=_0x284917[_0x0c8e('0x75')];_0x284917['message'][_0x0c8e('0x77')]=_0x0c8e('0x5a');return respondWithRpcPromise('EventManager',_0x0c8e('0x78'),{'event':_0x0c8e('0x79'),'message':_0x284917[_0x0c8e('0x25')]},client9002)[_0x0c8e('0x1d')](function(){return _0x284917;});}return _0x284917;}return null;})[_0x0c8e('0x1d')](respondWithResult(_0x4ab22a,null))[_0x0c8e('0x27')](handleError(_0x4ab22a,null));};var interaction_log=require(_0x0c8e('0x58'))(_0x0c8e('0x59'));exports[_0x0c8e('0x32')]=function(_0x2cea57,_0x4a87ee,_0x5cec9e){var _0x266f92={'agent':{},'channel':'openchannel'};if(_0x2cea57[_0x0c8e('0x54')]['id']){delete _0x2cea57[_0x0c8e('0x54')]['id'];}_0x2cea57[_0x0c8e('0x54')][_0x0c8e('0x60')]=_0x2cea57[_0x0c8e('0x54')]['UserId']||_0x2cea57['user']['id'];_0x266f92['agent']['id']=_0x2cea57['body'][_0x0c8e('0x60')];return db[_0x0c8e('0x3b')][_0x0c8e('0x52')]({'where':{'id':_0x2cea57[_0x0c8e('0x55')]['id'],'UserId':null}})[_0x0c8e('0x1d')](handleEntityNotFound(_0x4a87ee,null))[_0x0c8e('0x1d')](function(_0x32f9cf){if(_0x32f9cf){_0x266f92[_0x0c8e('0x25')]=_0x32f9cf[_0x0c8e('0x62')]({'plain':!![]});return db[_0x0c8e('0x7a')][_0x0c8e('0x52')]({'where':{'id':_0x32f9cf['OpenchannelInteractionId']}});}return null;})[_0x0c8e('0x1d')](handleEntityNotFound(_0x4a87ee,null))['then'](function(_0x594786){if(_0x594786){_0x266f92['interaction']=_0x594786[_0x0c8e('0x62')]({'plain':!![]});interaction_log[_0x0c8e('0x1e')](_0x0c8e('0x7b'),_0x2cea57[_0x0c8e('0x67')]['id'],_0x2cea57[_0x0c8e('0x67')][_0x0c8e('0x37')],_0x2cea57[_0x0c8e('0x67')][_0x0c8e('0x68')],_0x266f92[_0x0c8e('0x65')]['id'],_0x2cea57[_0x0c8e('0x54')]?JSON['stringify'](_0x2cea57[_0x0c8e('0x54')]):_0x0c8e('0x6a'));return respondWithRpcPromise(_0x0c8e('0x7c'),_0x0c8e('0x7d'),_0x266f92);}return null;})[_0x0c8e('0x1d')](function(_0x12b077){var _0x4f20e7=_0x0c8e('0x6c')+_0x12b077[_0x0c8e('0x25')]['ContactId'];return db[_0x0c8e('0x6e')]['query'](_0x4f20e7,{'type':db[_0x0c8e('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x4c503c){return _0x4c503c;});})[_0x0c8e('0x1d')](function(_0x16742f){if(_0x16742f){_0x266f92[_0x0c8e('0x25')][_0x0c8e('0x7f')]=_0x16742f[0x0];if(!_0x2cea57[_0x0c8e('0x54')]['UserId'])return;return db[_0x0c8e('0x80')][_0x0c8e('0x52')]({'where':{'id':_0x2cea57[_0x0c8e('0x54')]['UserId'],'role':_0x0c8e('0x61')},'attributes':['id',_0x0c8e('0x37'),'fullname',_0x0c8e('0x71'),_0x0c8e('0x72')],'raw':!![]});}return null;})[_0x0c8e('0x1d')](function(_0x147f3c){if(!_0x147f3c)return null;_0x266f92[_0x0c8e('0x25')][_0x0c8e('0x61')]=_0x147f3c;return _0x266f92;})['then'](function(_0x413ede){if(_0x413ede){_0x413ede['message'][_0x0c8e('0x81')]=util[_0x0c8e('0x5e')](_0x0c8e('0x74'),_0x2cea57['user'][_0x0c8e('0x37')]);_0x413ede[_0x0c8e('0x25')][_0x0c8e('0x75')]=_0x266f92['channel'];_0x413ede[_0x0c8e('0x25')][_0x0c8e('0x76')]=_0x266f92[_0x0c8e('0x75')];_0x413ede[_0x0c8e('0x25')][_0x0c8e('0x77')]=_0x0c8e('0x32');respondWithRpcPromise(_0x0c8e('0x78'),_0x0c8e('0x78'),{'event':_0x0c8e('0x82'),'message':_0x413ede[_0x0c8e('0x25')]},client9002);return _0x266f92;}return null;})['then'](respondWithResult(_0x4a87ee,null))[_0x0c8e('0x27')](handleError(_0x4a87ee,null));}; \ No newline at end of file +var _0xa8d5=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','info','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','SELECT','motionChannel','rejectmessage','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','end','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','rows','show','params','fields','includeAll','options','find','create','body','update','describe','openchannel-interactions','openchannel','read','readAt','format'];(function(_0x42d26e,_0x20a7f0){var _0x21a42c=function(_0x1fdb22){while(--_0x1fdb22){_0x42d26e['push'](_0x42d26e['shift']());}};_0x21a42c(++_0x20a7f0);}(_0xa8d5,0x1b3));var _0x5a8d=function(_0x7f0382,_0x20071c){_0x7f0382=_0x7f0382-0x0;var _0x31be5e=_0xa8d5[_0x7f0382];return _0x31be5e;};'use strict';var emlformat=require(_0x5a8d('0x0'));var rimraf=require(_0x5a8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5a8d('0x2'));var moment=require(_0x5a8d('0x3'));var BPromise=require(_0x5a8d('0x4'));var Mustache=require(_0x5a8d('0x5'));var util=require('util');var path=require(_0x5a8d('0x6'));var sox=require('sox');var csv=require(_0x5a8d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a8d('0x8'));var _=require(_0x5a8d('0x9'));var squel=require(_0x5a8d('0xa'));var crypto=require('crypto');var jsforce=require(_0x5a8d('0xb'));var deskjs=require(_0x5a8d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5a8d('0xd'));var Papa=require('papaparse');var Redis=require(_0x5a8d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5a8d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a8d('0x10'));var logger=require(_0x5a8d('0x11'))(_0x5a8d('0x12'));var utils=require('../../config/utils');var config=require(_0x5a8d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a8d('0x14'))['db'];config[_0x5a8d('0x15')]=_[_0x5a8d('0x16')](config[_0x5a8d('0x15')],{'host':_0x5a8d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a8d('0x15')]));require(_0x5a8d('0x18'))[_0x5a8d('0x19')](socket);var jayson=require(_0x5a8d('0x1a'));var client=jayson[_0x5a8d('0x1b')][_0x5a8d('0x1c')]({'port':0x232c});var client9002=jayson[_0x5a8d('0x1b')][_0x5a8d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3b532a,_0x2feb2e,_0x6dea31,_0x32e1e1){return new BPromise(function(_0x179b33,_0x1f70d7){var _0x5e3a63=_0x32e1e1||client;return _0x5e3a63[_0x5a8d('0x1d')](_0x3b532a,_0x6dea31)[_0x5a8d('0x1e')](function(_0x3789f8){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2feb2e,'request\x20sent');logger[_0x5a8d('0x1f')](_0x5a8d('0x20'),_0x2feb2e,_0x5a8d('0x21'),JSON['stringify'](_0x3789f8));if(_0x3789f8['error']){if(_0x3789f8[_0x5a8d('0x22')][_0x5a8d('0x23')]===0x1f4){logger[_0x5a8d('0x22')](_0x5a8d('0x24'),_0x2feb2e,_0x3789f8[_0x5a8d('0x22')][_0x5a8d('0x25')]);return _0x1f70d7(_0x3789f8[_0x5a8d('0x22')][_0x5a8d('0x25')]);}logger[_0x5a8d('0x22')](_0x5a8d('0x24'),_0x2feb2e,_0x3789f8[_0x5a8d('0x22')][_0x5a8d('0x25')]);return _0x179b33(_0x3789f8[_0x5a8d('0x22')]['message']);}else{logger['info'](_0x5a8d('0x24'),_0x2feb2e,_0x5a8d('0x21'));_0x179b33(_0x3789f8[_0x5a8d('0x26')][_0x5a8d('0x25')]);}})[_0x5a8d('0x27')](function(_0x112f83){logger['error'](_0x5a8d('0x24'),_0x2feb2e,_0x112f83);_0x1f70d7(_0x112f83);});});}function respondWithStatusCode(_0x23ef9d,_0x13ab52){_0x13ab52=_0x13ab52||0xcc;return function(_0x396fc4){if(_0x396fc4){return _0x23ef9d[_0x5a8d('0x28')](_0x13ab52);}return _0x23ef9d[_0x5a8d('0x29')](_0x13ab52)['end']();};}function respondWithResult(_0x59700d,_0x5e9aa1){_0x5e9aa1=_0x5e9aa1||0xc8;return function(_0x3db417){if(_0x3db417){return _0x59700d[_0x5a8d('0x29')](_0x5e9aa1)[_0x5a8d('0x2a')](_0x3db417);}};}function respondWithFilteredResult(_0x5e6346,_0x48648f){return function(_0x5758ad){if(_0x5758ad){var _0x4adaab=typeof _0x48648f[_0x5a8d('0x2b')]===_0x5a8d('0x2c')&&typeof _0x48648f[_0x5a8d('0x2d')]===_0x5a8d('0x2c');var _0xcf5034=_0x5758ad['count'];var _0x52ace0=_0x4adaab?0x0:_0x48648f['offset'];var _0x1833a7=_0x4adaab?_0x5758ad[_0x5a8d('0x2e')]:_0x48648f[_0x5a8d('0x2b')]+_0x48648f['limit'];var _0x48d544;if(_0x1833a7>=_0xcf5034){_0x1833a7=_0xcf5034;_0x48d544=0xc8;}else{_0x48d544=0xce;}_0x5e6346[_0x5a8d('0x29')](_0x48d544);return _0x5e6346[_0x5a8d('0x2f')](_0x5a8d('0x30'),_0x52ace0+'-'+_0x1833a7+'/'+_0xcf5034)[_0x5a8d('0x2a')](_0x5758ad);}return null;};}function patchUpdates(_0x2e8b9d){return function(_0xc4718){try{jsonpatch[_0x5a8d('0x31')](_0xc4718,_0x2e8b9d,!![]);}catch(_0x4045bd){return BPromise[_0x5a8d('0x32')](_0x4045bd);}return _0xc4718[_0x5a8d('0x33')]();};}function saveUpdates(_0x9a6ecd,_0x21ce9f){return function(_0x1fa1c4){if(_0x1fa1c4){return _0x1fa1c4['update'](_0x9a6ecd)[_0x5a8d('0x1e')](function(_0x24a202){return _0x24a202;});}return null;};}function removeEntity(_0x59dd95,_0x461ed8){return function(_0x34e499){if(_0x34e499){return _0x34e499['destroy']()[_0x5a8d('0x1e')](function(){_0x59dd95['status'](0xcc)[_0x5a8d('0x34')]();});}};}function handleEntityNotFound(_0x107421,_0x40a743){return function(_0x27898b){if(!_0x27898b){_0x107421[_0x5a8d('0x28')](0x194);}return _0x27898b;};}function handleError(_0x2a54de,_0x5e91a0){_0x5e91a0=_0x5e91a0||0x1f4;return function(_0x26ab89){logger['error'](_0x26ab89['stack']);if(_0x26ab89[_0x5a8d('0x35')]){delete _0x26ab89['name'];}_0x2a54de['status'](_0x5e91a0)[_0x5a8d('0x36')](_0x26ab89);};}exports[_0x5a8d('0x37')]=function(_0x492fde,_0x25b33c){var _0x3cac2b={},_0x37f31f={},_0x471aba={'count':0x0,'rows':[]};var _0x4466c9=_['map'](db[_0x5a8d('0x38')][_0x5a8d('0x39')],function(_0x307587){return{'name':_0x307587[_0x5a8d('0x3a')],'type':_0x307587[_0x5a8d('0x3b')][_0x5a8d('0x3c')]};});_0x37f31f[_0x5a8d('0x3d')]=_[_0x5a8d('0x3e')](_0x4466c9,'name');_0x37f31f[_0x5a8d('0x3f')]=_[_0x5a8d('0x40')](_0x492fde[_0x5a8d('0x3f')]);_0x37f31f[_0x5a8d('0x41')]=_[_0x5a8d('0x42')](_0x37f31f['model'],_0x37f31f[_0x5a8d('0x3f')]);_0x3cac2b[_0x5a8d('0x43')]=_[_0x5a8d('0x42')](_0x37f31f['model'],qs['fields'](_0x492fde[_0x5a8d('0x3f')]['fields']));_0x3cac2b[_0x5a8d('0x43')]=_0x3cac2b[_0x5a8d('0x43')][_0x5a8d('0x44')]?_0x3cac2b[_0x5a8d('0x43')]:_0x37f31f[_0x5a8d('0x3d')];if(!_0x492fde['query'][_0x5a8d('0x45')](_0x5a8d('0x46'))){_0x3cac2b['limit']=qs[_0x5a8d('0x2d')](_0x492fde['query'][_0x5a8d('0x2d')]);_0x3cac2b['offset']=qs[_0x5a8d('0x2b')](_0x492fde[_0x5a8d('0x3f')]['offset']);}_0x3cac2b[_0x5a8d('0x47')]=qs[_0x5a8d('0x48')](_0x492fde[_0x5a8d('0x3f')][_0x5a8d('0x48')]);_0x3cac2b['where']=qs[_0x5a8d('0x41')](_['pick'](_0x492fde[_0x5a8d('0x3f')],_0x37f31f[_0x5a8d('0x41')]),_0x4466c9);if(_0x492fde[_0x5a8d('0x3f')][_0x5a8d('0x49')]){_0x3cac2b[_0x5a8d('0x4a')]=_[_0x5a8d('0x4b')](_0x3cac2b['where'],{'$or':_[_0x5a8d('0x3e')](_0x4466c9,function(_0x25d7d7){if(_0x25d7d7[_0x5a8d('0x3b')]!==_0x5a8d('0x4c')){var _0x1726a5={};_0x1726a5[_0x25d7d7['name']]={'$like':'%'+_0x492fde[_0x5a8d('0x3f')][_0x5a8d('0x49')]+'%'};return _0x1726a5;}})});}_0x3cac2b=_[_0x5a8d('0x4b')]({},_0x3cac2b,_0x492fde['options']);var _0x44dbb5={'where':_0x3cac2b['where']};return db[_0x5a8d('0x38')][_0x5a8d('0x2e')](_0x44dbb5)['then'](function(_0x1cddbe){_0x471aba[_0x5a8d('0x2e')]=_0x1cddbe;if(_0x492fde['query']['includeAll']){_0x3cac2b['include']=[{'all':!![]}];}return db[_0x5a8d('0x38')]['findAll'](_0x3cac2b);})[_0x5a8d('0x1e')](function(_0x2647fd){_0x471aba[_0x5a8d('0x4d')]=_0x2647fd;return _0x471aba;})[_0x5a8d('0x1e')](respondWithFilteredResult(_0x25b33c,_0x3cac2b))[_0x5a8d('0x27')](handleError(_0x25b33c,null));};exports[_0x5a8d('0x4e')]=function(_0x480af5,_0x3e2c1b){var _0x2d5d60={'raw':!![],'where':{'id':_0x480af5[_0x5a8d('0x4f')]['id']}},_0x1ad824={};_0x1ad824['model']=_[_0x5a8d('0x40')](db['OpenchannelMessage'][_0x5a8d('0x39')]);_0x1ad824[_0x5a8d('0x3f')]=_['keys'](_0x480af5[_0x5a8d('0x3f')]);_0x1ad824[_0x5a8d('0x41')]=_[_0x5a8d('0x42')](_0x1ad824[_0x5a8d('0x3d')],_0x1ad824[_0x5a8d('0x3f')]);_0x2d5d60['attributes']=_[_0x5a8d('0x42')](_0x1ad824['model'],qs['fields'](_0x480af5[_0x5a8d('0x3f')][_0x5a8d('0x50')]));_0x2d5d60[_0x5a8d('0x43')]=_0x2d5d60[_0x5a8d('0x43')][_0x5a8d('0x44')]?_0x2d5d60[_0x5a8d('0x43')]:_0x1ad824[_0x5a8d('0x3d')];if(_0x480af5[_0x5a8d('0x3f')][_0x5a8d('0x51')]){_0x2d5d60['include']=[{'all':!![]}];}_0x2d5d60=_[_0x5a8d('0x4b')]({},_0x2d5d60,_0x480af5[_0x5a8d('0x52')]);return db[_0x5a8d('0x38')][_0x5a8d('0x53')](_0x2d5d60)[_0x5a8d('0x1e')](handleEntityNotFound(_0x3e2c1b,null))[_0x5a8d('0x1e')](respondWithResult(_0x3e2c1b,null))[_0x5a8d('0x27')](handleError(_0x3e2c1b,null));};exports[_0x5a8d('0x54')]=function(_0x2f1008,_0x50e590){return db['OpenchannelMessage']['create'](_0x2f1008[_0x5a8d('0x55')],{})['then'](respondWithResult(_0x50e590,0xc9))[_0x5a8d('0x27')](handleError(_0x50e590,null));};exports[_0x5a8d('0x56')]=function(_0x30ff70,_0xc29090){if(_0x30ff70[_0x5a8d('0x55')]['id']){delete _0x30ff70[_0x5a8d('0x55')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x30ff70[_0x5a8d('0x4f')]['id']}})[_0x5a8d('0x1e')](handleEntityNotFound(_0xc29090,null))[_0x5a8d('0x1e')](saveUpdates(_0x30ff70['body'],null))[_0x5a8d('0x1e')](respondWithResult(_0xc29090,null))['catch'](handleError(_0xc29090,null));};exports['destroy']=function(_0x1535d8,_0xdc3ac4){return db[_0x5a8d('0x38')][_0x5a8d('0x53')]({'where':{'id':_0x1535d8[_0x5a8d('0x4f')]['id']}})[_0x5a8d('0x1e')](handleEntityNotFound(_0xdc3ac4,null))[_0x5a8d('0x1e')](removeEntity(_0xdc3ac4,null))[_0x5a8d('0x27')](handleError(_0xdc3ac4,null));};exports[_0x5a8d('0x57')]=function(_0x3a617b,_0x5ccd92){return db['OpenchannelMessage'][_0x5a8d('0x57')]()[_0x5a8d('0x1e')](respondWithResult(_0x5ccd92,null))['catch'](handleError(_0x5ccd92,null));};var interaction_log=require(_0x5a8d('0x11'))(_0x5a8d('0x58'));exports['accept']=function(_0x16d2c1,_0x2af214,_0x354eaf){var _0x2f979d={'agent':{},'channel':_0x5a8d('0x59')};if(_0x16d2c1['body']['id']){delete _0x16d2c1['body']['id'];}_0x16d2c1[_0x5a8d('0x55')][_0x5a8d('0x5a')]=!![];_0x16d2c1[_0x5a8d('0x55')][_0x5a8d('0x5b')]=moment()[_0x5a8d('0x5c')](_0x5a8d('0x5d'));_0x16d2c1['body'][_0x5a8d('0x5e')]=_0x16d2c1[_0x5a8d('0x55')][_0x5a8d('0x5e')]||_0x16d2c1[_0x5a8d('0x5f')]['id'];_0x2f979d[_0x5a8d('0x60')]['id']=_0x16d2c1['body'][_0x5a8d('0x5e')];return db[_0x5a8d('0x38')]['find']({'where':{'id':_0x16d2c1[_0x5a8d('0x4f')]['id'],'UserId':null}})[_0x5a8d('0x1e')](handleEntityNotFound(_0x2af214,null))[_0x5a8d('0x1e')](saveUpdates(_0x16d2c1['body'],null))['then'](function(_0x753a06){if(_0x753a06){_0x2f979d[_0x5a8d('0x25')]=_0x753a06[_0x5a8d('0x61')]({'plain':!![]});return db[_0x5a8d('0x62')][_0x5a8d('0x53')]({'where':{'id':_0x753a06[_0x5a8d('0x63')]}});}return null;})[_0x5a8d('0x1e')](handleEntityNotFound(_0x2af214,null))['then'](function(_0x4b6d0b){if(_0x4b6d0b){return _0x4b6d0b['update']({'UserId':_0x16d2c1[_0x5a8d('0x55')][_0x5a8d('0x5e')],'read1stAt':_[_0x5a8d('0x64')](_0x4b6d0b[_0x5a8d('0x65')])?moment()[_0x5a8d('0x5c')](_0x5a8d('0x5d')):undefined});}return null;})[_0x5a8d('0x1e')](function(_0x133844){if(_0x133844){_0x2f979d['interaction']=_0x133844['get']({'plain':!![]});interaction_log['info'](_0x5a8d('0x66'),_0x16d2c1[_0x5a8d('0x5f')]['id'],_0x16d2c1[_0x5a8d('0x5f')][_0x5a8d('0x35')],_0x16d2c1[_0x5a8d('0x5f')]['role'],_0x2f979d[_0x5a8d('0x67')]['id'],_0x16d2c1['body']?JSON[_0x5a8d('0x68')](_0x16d2c1[_0x5a8d('0x55')]):_0x5a8d('0x69'));return respondWithRpcPromise(_0x5a8d('0x6a'),_0x5a8d('0x6b'),_0x2f979d);}return null;})[_0x5a8d('0x1e')](function(_0x4285b4){var _0x49209c=_0x5a8d('0x6c')+_0x4285b4['message']['ContactId'];return db[_0x5a8d('0x6d')][_0x5a8d('0x3f')](_0x49209c,{'type':db['Sequelize'][_0x5a8d('0x6e')]['SELECT'],'raw':!![]})[_0x5a8d('0x1e')](function(_0x55403b){return _0x55403b;});})[_0x5a8d('0x1e')](function(_0x3056a0){if(_0x3056a0){_0x2f979d['message'][_0x5a8d('0x6f')]=_0x3056a0[0x0];if(!_0x16d2c1[_0x5a8d('0x55')]['UserId'])return;return db[_0x5a8d('0x70')][_0x5a8d('0x53')]({'where':{'id':_0x16d2c1[_0x5a8d('0x55')]['UserId'],'role':_0x5a8d('0x60')},'attributes':['id',_0x5a8d('0x35'),_0x5a8d('0x71'),_0x5a8d('0x72'),_0x5a8d('0x73')],'raw':!![]});}return null;})['then'](function(_0x4a4101){if(!_0x4a4101)return null;_0x2f979d[_0x5a8d('0x25')]['agent']=_0x4a4101;return _0x2f979d;})[_0x5a8d('0x1e')](function(_0x19f65e){if(_0x19f65e){if(_0x16d2c1[_0x5a8d('0x55')]['manual']){_0x2f979d['message'][_0x5a8d('0x74')]=util[_0x5a8d('0x5c')](_0x5a8d('0x75'),_0x16d2c1[_0x5a8d('0x5f')]['name']);_0x2f979d['message'][_0x5a8d('0x76')]=_0x2f979d[_0x5a8d('0x76')];_0x2f979d[_0x5a8d('0x25')]['motionChannel']=_0x2f979d[_0x5a8d('0x76')];_0x2f979d[_0x5a8d('0x25')][_0x5a8d('0x77')]=_0x5a8d('0x78');return respondWithRpcPromise(_0x5a8d('0x79'),_0x5a8d('0x79'),{'event':_0x5a8d('0x7a'),'message':_0x2f979d[_0x5a8d('0x25')]},client9002)[_0x5a8d('0x1e')](function(){return _0x2f979d;});}return _0x2f979d;}return null;})['then'](respondWithResult(_0x2af214,null))[_0x5a8d('0x27')](handleError(_0x2af214,null));};var interaction_log=require(_0x5a8d('0x11'))('openchannel-interactions');exports[_0x5a8d('0x32')]=function(_0x1232d6,_0xac78fd,_0x330d83){var _0x1f5191={'agent':{},'channel':_0x5a8d('0x59')};if(_0x1232d6['body']['id']){delete _0x1232d6['body']['id'];}_0x1232d6[_0x5a8d('0x55')][_0x5a8d('0x5e')]=_0x1232d6['body'][_0x5a8d('0x5e')]||_0x1232d6[_0x5a8d('0x5f')]['id'];_0x1f5191[_0x5a8d('0x60')]['id']=_0x1232d6['body'][_0x5a8d('0x5e')];return db[_0x5a8d('0x38')]['find']({'where':{'id':_0x1232d6['params']['id'],'UserId':null}})[_0x5a8d('0x1e')](handleEntityNotFound(_0xac78fd,null))[_0x5a8d('0x1e')](function(_0x3d904c){if(_0x3d904c){_0x1f5191[_0x5a8d('0x25')]=_0x3d904c[_0x5a8d('0x61')]({'plain':!![]});return db[_0x5a8d('0x62')]['find']({'where':{'id':_0x3d904c[_0x5a8d('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xac78fd,null))[_0x5a8d('0x1e')](function(_0x41c20c){if(_0x41c20c){_0x1f5191['interaction']=_0x41c20c[_0x5a8d('0x61')]({'plain':!![]});interaction_log[_0x5a8d('0x7b')](_0x5a8d('0x7c'),_0x1232d6['user']['id'],_0x1232d6[_0x5a8d('0x5f')][_0x5a8d('0x35')],_0x1232d6[_0x5a8d('0x5f')]['role'],_0x1f5191[_0x5a8d('0x67')]['id'],_0x1232d6[_0x5a8d('0x55')]?JSON[_0x5a8d('0x68')](_0x1232d6[_0x5a8d('0x55')]):_0x5a8d('0x69'));return respondWithRpcPromise(_0x5a8d('0x7d'),_0x5a8d('0x7e'),_0x1f5191);}return null;})[_0x5a8d('0x1e')](function(_0x3c6266){var _0x194a9d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c6266[_0x5a8d('0x25')][_0x5a8d('0x7f')];return db[_0x5a8d('0x6d')][_0x5a8d('0x3f')](_0x194a9d,{'type':db[_0x5a8d('0x80')]['QueryTypes'][_0x5a8d('0x81')],'raw':!![]})[_0x5a8d('0x1e')](function(_0x4ec60d){return _0x4ec60d;});})[_0x5a8d('0x1e')](function(_0x31f9a5){if(_0x31f9a5){_0x1f5191[_0x5a8d('0x25')]['contact']=_0x31f9a5[0x0];if(!_0x1232d6['body'][_0x5a8d('0x5e')])return;return db['User'][_0x5a8d('0x53')]({'where':{'id':_0x1232d6[_0x5a8d('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x5a8d('0x35'),_0x5a8d('0x71'),_0x5a8d('0x72'),_0x5a8d('0x73')],'raw':!![]});}return null;})[_0x5a8d('0x1e')](function(_0xd57683){if(!_0xd57683)return null;_0x1f5191['message']['agent']=_0xd57683;return _0x1f5191;})[_0x5a8d('0x1e')](function(_0x254958){if(_0x254958){_0x254958[_0x5a8d('0x25')][_0x5a8d('0x74')]=util['format'](_0x5a8d('0x75'),_0x1232d6['user'][_0x5a8d('0x35')]);_0x254958[_0x5a8d('0x25')][_0x5a8d('0x76')]=_0x1f5191[_0x5a8d('0x76')];_0x254958[_0x5a8d('0x25')][_0x5a8d('0x82')]=_0x1f5191[_0x5a8d('0x76')];_0x254958[_0x5a8d('0x25')][_0x5a8d('0x77')]=_0x5a8d('0x32');respondWithRpcPromise(_0x5a8d('0x79'),_0x5a8d('0x79'),{'event':_0x5a8d('0x83'),'message':_0x254958[_0x5a8d('0x25')]},client9002);return _0x1f5191;}return null;})[_0x5a8d('0x1e')](respondWithResult(_0xac78fd,null))['catch'](handleError(_0xac78fd,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 37e59de..378921d 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 _0x3650=['OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c74ca,_0x3b21d0){var _0x4e8c2a=function(_0x3b52c2){while(--_0x3b52c2){_0x1c74ca['push'](_0x1c74ca['shift']());}};_0x4e8c2a(++_0x3b21d0);}(_0x3650,0xe9));var _0x0365=function(_0x403cd4,_0x3b3c4f){_0x403cd4=_0x403cd4-0x0;var _0xe63a6a=_0x3650[_0x403cd4];return _0xe63a6a;};'use strict';var EventEmitter=require(_0x0365('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x0365('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0365('0x2')](0x0);var events={'afterCreate':_0x0365('0x3'),'afterUpdate':'update','afterDestroy':_0x0365('0x4')};function emitEvent(_0x4da98a){return function(_0x55beec,_0xcfd730,_0x4db8e2){OpenchannelMessageEvents['emit'](_0x4da98a+':'+_0x55beec['id'],_0x55beec);OpenchannelMessageEvents[_0x0365('0x5')](_0x4da98a,_0x55beec);_0x4db8e2(null);};}for(var e in events){if(events[_0x0365('0x6')](e)){var event=events[e];OpenchannelMessage[_0x0365('0x7')](e,emitEvent(event));}}module[_0x0365('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8c12=['events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x8c12,0x17a));var _0x28c1=function(_0x365b17,_0x1898d7){_0x365b17=_0x365b17-0x0;var _0x20119b=_0x8c12[_0x365b17];return _0x20119b;};'use strict';var EventEmitter=require(_0x28c1('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x28c1('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x28c1('0x2')](0x0);var events={'afterCreate':_0x28c1('0x3'),'afterUpdate':_0x28c1('0x4'),'afterDestroy':_0x28c1('0x5')};function emitEvent(_0x1361df){return function(_0x408b83,_0x2b0e33,_0x16ad25){OpenchannelMessageEvents['emit'](_0x1361df+':'+_0x408b83['id'],_0x408b83);OpenchannelMessageEvents[_0x28c1('0x6')](_0x1361df,_0x408b83);_0x16ad25(null);};}for(var e in events){if(events[_0x28c1('0x7')](e)){var event=events[e];OpenchannelMessage[_0x28c1('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 9ddbd92..d877fe2 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 _0x7c06=['Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelMessage,\x20%s,\x20%s','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','Contact','replyUri','info','afterCreate','format'];(function(_0x3a9832,_0x1cd572){var _0xab9961=function(_0x1994df){while(--_0x1994df){_0x3a9832['push'](_0x3a9832['shift']());}};_0xab9961(++_0x1cd572);}(_0x7c06,0x9d));var _0x67c0=function(_0x1c15e4,_0x266b49){_0x1c15e4=_0x1c15e4-0x0;var _0x1ebc71=_0x7c06[_0x1c15e4];return _0x1ebc71;};'use strict';var _=require('lodash');var util=require(_0x67c0('0x0'));var logger=require(_0x67c0('0x1'))(_0x67c0('0x2'));var moment=require(_0x67c0('0x3'));var BPromise=require(_0x67c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67c0('0x5'));var rimraf=require(_0x67c0('0x6'));var config=require(_0x67c0('0x7'));var attributes=require(_0x67c0('0x8'));module['exports']=function(_0x402692,_0x4b6f56){return _0x402692['define'](_0x67c0('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x67c0('0xa'),'fields':[_0x67c0('0xb')],'type':_0x67c0('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21bec8,_0x3061b9,_0x3a9d95){var _0x4fe02f=_0x402692[_0x67c0('0xd')];var _0x45857c=_0x21bec8[_0x67c0('0xe')]({'plain':!![]});if(_0x45857c[_0x67c0('0xf')][_0x67c0('0x10')]()==='in'||_0x45857c[_0x67c0('0xf')][_0x67c0('0x10')]()==='out'&&!_0x45857c[_0x67c0('0x11')]&&!_[_0x67c0('0x12')](_0x45857c['UserId'])){_0x4fe02f[_0x67c0('0x13')]['findOne']({'where':{'id':_0x45857c['OpenchannelInteractionId']}})[_0x67c0('0x14')](function(_0x1508ed){if(_0x1508ed){_0x1508ed[_0x67c0('0x15')]({'lastMsgAt':_0x45857c[_0x67c0('0x16')],'lastMsgDirection':_0x45857c[_0x67c0('0xf')]['toLowerCase']()});}})[_0x67c0('0x17')](function(_0x1b484b){console[_0x67c0('0x18')](_0x1b484b);});}if(_0x45857c[_0x67c0('0xf')]==='out'&&!_0x45857c[_0x67c0('0x11')]){var _0xb63f31;_0x4fe02f['CmContact'][_0x67c0('0x19')]()[_0x67c0('0x14')](function(_0x1820d2){return _0x4fe02f[_0x67c0('0x1a')][_0x67c0('0x1b')]({'where':{'id':_0x45857c['OpenchannelAccountId']},'include':[{'model':_0x4fe02f[_0x67c0('0x13')],'as':_0x67c0('0x1c'),'where':{'id':_0x45857c[_0x67c0('0x1d')]},'limit':0x1,'include':[{'model':_0x4fe02f['CmContact'],'as':_0x67c0('0x1e'),'attributes':_['keys'](_0x1820d2)}]}]});})[_0x67c0('0x14')](function(_0x18b18b){_0xb63f31=_0x18b18b[_0x67c0('0xe')]({'plain':!![]});if(_0xb63f31&&_0xb63f31[_0x67c0('0x1f')]){logger[_0x67c0('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x67c0('0x21'),util[_0x67c0('0x22')](_0x67c0('0x23'),_0x45857c['id'],_0xb63f31['replyUri']));if(_0xb63f31[_0x67c0('0x1c')]&&_0xb63f31['Interactions'][_0x67c0('0x24')]){_0x45857c[_0x67c0('0x25')]=_['omit'](_0xb63f31[_0x67c0('0x1c')][0x0],_0x67c0('0x1e'));_0x45857c[_0x67c0('0x1e')]=_0xb63f31[_0x67c0('0x1c')][0x0]['Contact'];}var _0x3061b9={'method':_0x67c0('0x26'),'uri':encodeURI(_0xb63f31[_0x67c0('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3061b9[_0x67c0('0x27')]){case _0x67c0('0x28'):_0x3061b9['qs']=_0x45857c;break;case _0x67c0('0x26'):_0x3061b9[_0x67c0('0xb')]=_0x45857c;break;}return rp(_0x3061b9)[_0x67c0('0x14')](function(_0x4a8025){logger[_0x67c0('0x20')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x67c0('0x29'),_0x45857c['id'],_0xb63f31[_0x67c0('0x1f')]));if(_0x4a8025[_0x67c0('0xb')][_0x67c0('0x2a')]&&_0x4a8025[_0x67c0('0xb')][_0x67c0('0x2a')]!=_0x45857c['Interaction'][_0x67c0('0x2a')]){return _0x4fe02f[_0x67c0('0x13')]['update']({'threadId':_0x4a8025['body'][_0x67c0('0x2a')]},{'where':{'id':_0x45857c[_0x67c0('0x25')]['id']}});}else{return;}})[_0x67c0('0x14')](function(){return _0x21bec8[_0x67c0('0x15')]({'read':!![]});})['catch'](function(_0x166976){logger[_0x67c0('0x18')](_0x67c0('0x2b'),'afterCreate',util[_0x67c0('0x2c')](_0x166976,{'showHidden':![],'depth':null}));_0x3a9d95();});}else{_0x3a9d95();}})[_0x67c0('0x2d')](function(){_0x3a9d95();});}else{_0x3a9d95();}}},'charset':_0x67c0('0x2e'),'collate':_0x67c0('0x2f')});}; \ No newline at end of file +var _0x9915=['FULLTEXT','models','get','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','update','createdAt','toLowerCase','catch','error','out','describe','then','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteractionId','CmContact','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Interactions','length','omit','Contact','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9915,0xbf));var _0x5991=function(_0xdeb3e9,_0x100fe5){_0xdeb3e9=_0xdeb3e9-0x0;var _0x22d7de=_0x9915[_0xdeb3e9];return _0x22d7de;};'use strict';var _=require(_0x5991('0x0'));var util=require(_0x5991('0x1'));var logger=require(_0x5991('0x2'))('api');var moment=require(_0x5991('0x3'));var BPromise=require(_0x5991('0x4'));var rp=require(_0x5991('0x5'));var fs=require('fs');var path=require(_0x5991('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5991('0x7'));module[_0x5991('0x8')]=function(_0x2e431e,_0xed62c9){return _0x2e431e[_0x5991('0x9')](_0x5991('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x5991('0xb'),'fields':[_0x5991('0xc')],'type':_0x5991('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14a0c1,_0x37e494,_0x5f1975){var _0x4809a7=_0x2e431e[_0x5991('0xe')];var _0x43b37f=_0x14a0c1[_0x5991('0xf')]({'plain':!![]});if(_0x43b37f[_0x5991('0x10')]['toLowerCase']()==='in'||_0x43b37f[_0x5991('0x10')]['toLowerCase']()==='out'&&!_0x43b37f[_0x5991('0x11')]&&!_[_0x5991('0x12')](_0x43b37f[_0x5991('0x13')])){_0x4809a7[_0x5991('0x14')][_0x5991('0x15')]({'where':{'id':_0x43b37f['OpenchannelInteractionId']}})['then'](function(_0x40e2b9){if(_0x40e2b9){_0x40e2b9[_0x5991('0x16')]({'lastMsgAt':_0x43b37f[_0x5991('0x17')],'lastMsgDirection':_0x43b37f[_0x5991('0x10')][_0x5991('0x18')]()});}})[_0x5991('0x19')](function(_0x115391){console[_0x5991('0x1a')](_0x115391);});}if(_0x43b37f[_0x5991('0x10')]===_0x5991('0x1b')&&!_0x43b37f[_0x5991('0x11')]){var _0x27f2fd;_0x4809a7['CmContact'][_0x5991('0x1c')]()[_0x5991('0x1d')](function(_0x2f6bf1){return _0x4809a7[_0x5991('0x1e')]['find']({'where':{'id':_0x43b37f[_0x5991('0x1f')]},'include':[{'model':_0x4809a7['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x43b37f[_0x5991('0x20')]},'limit':0x1,'include':[{'model':_0x4809a7[_0x5991('0x21')],'as':'Contact','attributes':_['keys'](_0x2f6bf1)}]}]});})[_0x5991('0x1d')](function(_0x45dfdb){_0x27f2fd=_0x45dfdb[_0x5991('0xf')]({'plain':!![]});if(_0x27f2fd&&_0x27f2fd[_0x5991('0x22')]){logger['info'](_0x5991('0x23'),_0x5991('0x24'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x43b37f['id'],_0x27f2fd['replyUri']));if(_0x27f2fd['Interactions']&&_0x27f2fd[_0x5991('0x25')][_0x5991('0x26')]){_0x43b37f['Interaction']=_[_0x5991('0x27')](_0x27f2fd['Interactions'][0x0],_0x5991('0x28'));_0x43b37f['Contact']=_0x27f2fd[_0x5991('0x25')][0x0]['Contact'];}var _0x37e494={'method':_0x5991('0x29'),'uri':encodeURI(_0x27f2fd[_0x5991('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x37e494[_0x5991('0x2a')]){case _0x5991('0x2b'):_0x37e494['qs']=_0x43b37f;break;case _0x5991('0x29'):_0x37e494[_0x5991('0xc')]=_0x43b37f;break;}return rp(_0x37e494)[_0x5991('0x1d')](function(_0x2f08de){logger[_0x5991('0x2c')](_0x5991('0x23'),'afterCreate',util['format'](_0x5991('0x2d'),_0x43b37f['id'],_0x27f2fd['replyUri']));if(_0x2f08de[_0x5991('0xc')][_0x5991('0x2e')]&&_0x2f08de[_0x5991('0xc')][_0x5991('0x2e')]!=_0x43b37f[_0x5991('0x2f')][_0x5991('0x2e')]){return _0x4809a7[_0x5991('0x14')][_0x5991('0x16')]({'threadId':_0x2f08de[_0x5991('0xc')][_0x5991('0x2e')]},{'where':{'id':_0x43b37f[_0x5991('0x2f')]['id']}});}else{return;}})[_0x5991('0x1d')](function(){return _0x14a0c1[_0x5991('0x16')]({'read':!![]});})[_0x5991('0x19')](function(_0x392081){logger['error'](_0x5991('0x23'),'afterCreate',util[_0x5991('0x30')](_0x392081,{'showHidden':![],'depth':null}));_0x5f1975();});}else{_0x5f1975();}})[_0x5991('0x31')](function(){_0x5f1975();});}else{_0x5f1975();}}},'charset':_0x5991('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 288ea41..c6d9e09 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x598964,_0x559c9e){var _0x3021c6=function(_0xc0aebf){while(--_0xc0aebf){_0x598964['push'](_0x598964['shift']());}};_0x3021c6(++_0x559c9e);}(_0x7a54,0x106));var _0x47a5=function(_0x5b6da6,_0x2e1935){_0x5b6da6=_0x5b6da6-0x0;var _0x2ac82a=_0x7a54[_0x5b6da6];return _0x2ac82a;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2713e9,_0x3953cd){var _0x19cd26=function(_0x34e370){while(--_0x34e370){_0x2713e9['push'](_0x2713e9['shift']());}};_0x19cd26(++_0x3953cd);}(_0x7a54,0x106));var _0x47a5=function(_0x3d33f6,_0xb84a4d){_0x3d33f6=_0x3d33f6-0x0;var _0x386d8c=_0x7a54[_0x3d33f6];return _0x386d8c;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index fc8a77d..b8280ac 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 _0xb4f3=['openchannelMessage:','./openchannelMessage.events','remove','update','removeListener','length'];(function(_0x4291dd,_0x95d82){var _0x152462=function(_0x2f7bb6){while(--_0x2f7bb6){_0x4291dd['push'](_0x4291dd['shift']());}};_0x152462(++_0x95d82);}(_0xb4f3,0x1d5));var _0x3b4f=function(_0x442f14,_0x1eeceb){_0x442f14=_0x442f14-0x0;var _0x2b49db=_0xb4f3[_0x442f14];return _0x2b49db;};'use strict';var OpenchannelMessageEvents=require(_0x3b4f('0x0'));var events=['save',_0x3b4f('0x1'),_0x3b4f('0x2')];function createListener(_0x4335d8,_0x2b6738){return function(_0x1d3108){_0x2b6738['emit'](_0x4335d8,_0x1d3108);};}function removeListener(_0x584214,_0x752dd5){return function(){OpenchannelMessageEvents[_0x3b4f('0x3')](_0x584214,_0x752dd5);};}exports['register']=function(_0x2224db){for(var _0x4dd3d1=0x0,_0x4c2e57=events[_0x3b4f('0x4')];_0x4dd3d1<_0x4c2e57;_0x4dd3d1++){var _0x281fca=events[_0x4dd3d1];var _0x3f49de=createListener(_0x3b4f('0x5')+_0x281fca,_0x2224db);OpenchannelMessageEvents['on'](_0x281fca,_0x3f49de);}}; \ No newline at end of file +var _0xdc7c=['length','openchannelMessage:','./openchannelMessage.events','remove','update','emit','removeListener','register'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xdc7c,0xf2));var _0xcdc7=function(_0x56dd83,_0x451d49){_0x56dd83=_0x56dd83-0x0;var _0x317fc7=_0xdc7c[_0x56dd83];return _0x317fc7;};'use strict';var OpenchannelMessageEvents=require(_0xcdc7('0x0'));var events=['save',_0xcdc7('0x1'),_0xcdc7('0x2')];function createListener(_0x13be0f,_0x3174df){return function(_0x199e48){_0x3174df[_0xcdc7('0x3')](_0x13be0f,_0x199e48);};}function removeListener(_0x540375,_0x99420c){return function(){OpenchannelMessageEvents[_0xcdc7('0x4')](_0x540375,_0x99420c);};}exports[_0xcdc7('0x5')]=function(_0x724e2e){for(var _0x5edd15=0x0,_0x4d5ac5=events[_0xcdc7('0x6')];_0x5edd15<_0x4d5ac5;_0x5edd15++){var _0x189c7f=events[_0x5edd15];var _0x246298=createListener(_0xcdc7('0x7')+_0x189c7f,_0x724e2e);OpenchannelMessageEvents['on'](_0x189c7f,_0x246298);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9c27230..c64aa8e 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 _0x48b5=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x163876,_0x443cbf){var _0x3d48fc=function(_0x5ad43f){while(--_0x5ad43f){_0x163876['push'](_0x163876['shift']());}};_0x3d48fc(++_0x443cbf);}(_0x48b5,0x1ec));var _0x548b=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x48b5[_0x456fb1];return _0x4083d6;};'use strict';var multer=require(_0x548b('0x0'));var util=require(_0x548b('0x1'));var path=require(_0x548b('0x2'));var timeout=require('connect-timeout');var express=require(_0x548b('0x3'));var router=express[_0x548b('0x4')]();var fs_extra=require(_0x548b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x548b('0x6'));var config=require(_0x548b('0x7'));var controller=require(_0x548b('0x8'));router[_0x548b('0x9')]('/',auth[_0x548b('0xa')](),controller[_0x548b('0xb')]);router[_0x548b('0x9')](_0x548b('0xc'),auth['isAuthenticated'](),controller[_0x548b('0xd')]);router['get'](_0x548b('0xe'),auth[_0x548b('0xa')](),controller[_0x548b('0xf')]);router[_0x548b('0x9')](_0x548b('0x10'),auth[_0x548b('0xa')](),controller[_0x548b('0x11')]);router[_0x548b('0x9')](_0x548b('0x12'),auth[_0x548b('0xa')](),controller[_0x548b('0x13')]);router[_0x548b('0x9')](_0x548b('0x14'),auth[_0x548b('0xa')](),controller[_0x548b('0x15')]);router['post']('/',auth[_0x548b('0xa')](),controller[_0x548b('0x16')]);router[_0x548b('0x17')](_0x548b('0x12'),auth[_0x548b('0xa')](),controller[_0x548b('0x18')]);router['post'](_0x548b('0x14'),auth['isAuthenticated'](),controller[_0x548b('0x19')]);router[_0x548b('0x1a')](_0x548b('0xe'),auth[_0x548b('0xa')](),controller[_0x548b('0x1b')]);router[_0x548b('0x1c')](_0x548b('0xe'),auth[_0x548b('0xa')](),controller[_0x548b('0x1d')]);router['delete'](_0x548b('0x12'),auth[_0x548b('0xa')](),controller[_0x548b('0x1e')]);router[_0x548b('0x1c')](_0x548b('0x14'),auth[_0x548b('0xa')](),controller[_0x548b('0x1f')]);module[_0x548b('0x20')]=router; \ No newline at end of file +var _0xca67=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','/:id','delete','destroy','multer','util'];(function(_0x195a66,_0x2a70e5){var _0x3c2d7c=function(_0x34d091){while(--_0x34d091){_0x195a66['push'](_0x195a66['shift']());}};_0x3c2d7c(++_0x2a70e5);}(_0xca67,0x12a));var _0x7ca6=function(_0x4a3849,_0x716c5d){_0x4a3849=_0x4a3849-0x0;var _0x251514=_0xca67[_0x4a3849];return _0x251514;};'use strict';var multer=require(_0x7ca6('0x0'));var util=require(_0x7ca6('0x1'));var path=require('path');var timeout=require(_0x7ca6('0x2'));var express=require('express');var router=express[_0x7ca6('0x3')]();var fs_extra=require(_0x7ca6('0x4'));var auth=require(_0x7ca6('0x5'));var interaction=require(_0x7ca6('0x6'));var config=require(_0x7ca6('0x7'));var controller=require(_0x7ca6('0x8'));router[_0x7ca6('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ca6('0xa')]);router[_0x7ca6('0x9')](_0x7ca6('0xb'),auth[_0x7ca6('0xc')](),controller[_0x7ca6('0xd')]);router[_0x7ca6('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7ca6('0x9')](_0x7ca6('0xe'),auth['isAuthenticated'](),controller[_0x7ca6('0xf')]);router[_0x7ca6('0x9')](_0x7ca6('0x10'),auth[_0x7ca6('0xc')](),controller[_0x7ca6('0x11')]);router['get'](_0x7ca6('0x12'),auth[_0x7ca6('0xc')](),controller['getAgents']);router[_0x7ca6('0x13')]('/',auth[_0x7ca6('0xc')](),controller[_0x7ca6('0x14')]);router['post'](_0x7ca6('0x10'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x7ca6('0x15')]);router['put'](_0x7ca6('0x16'),auth[_0x7ca6('0xc')](),controller['update']);router[_0x7ca6('0x17')](_0x7ca6('0x16'),auth[_0x7ca6('0xc')](),controller[_0x7ca6('0x18')]);router['delete']('/:id/teams',auth[_0x7ca6('0xc')](),controller['removeTeams']);router[_0x7ca6('0x17')](_0x7ca6('0x12'),auth[_0x7ca6('0xc')](),controller['removeAgents']);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 368590d..f97ee30 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 _0x7f36=['exports','STRING','name','INTEGER','beepall','roundrobin','sequelize'];(function(_0x51115e,_0x44b615){var _0x1c9dd6=function(_0x3605a9){while(--_0x3605a9){_0x51115e['push'](_0x51115e['shift']());}};_0x1c9dd6(++_0x44b615);}(_0x7f36,0x14f));var _0x67f3=function(_0x4e9c20,_0x2a698f){_0x4e9c20=_0x4e9c20-0x0;var _0x2449fd=_0x7f36[_0x4e9c20];return _0x2449fd;};'use strict';var Sequelize=require(_0x67f3('0x0'));module[_0x67f3('0x1')]={'name':{'type':Sequelize[_0x67f3('0x2')],'unique':_0x67f3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x67f3('0x2')]},'timeout':{'type':Sequelize[_0x67f3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x67f3('0x5'),_0x67f3('0x6'))}}; \ No newline at end of file +var _0xa9c3=['beepall','roundrobin','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x44fce0,_0x92278a){var _0x5c1498=function(_0x2a42b6){while(--_0x2a42b6){_0x44fce0['push'](_0x44fce0['shift']());}};_0x5c1498(++_0x92278a);}(_0xa9c3,0x172));var _0x3a9c=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xa9c3[_0x31ced5];return _0x10d9e5;};'use strict';var Sequelize=require('sequelize');module[_0x3a9c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x3a9c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3a9c('0x2')]},'timeout':{'type':Sequelize[_0x3a9c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3a9c('0x4')](_0x3a9c('0x5'),_0x3a9c('0x6'),_0x3a9c('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0ae2288..9856dd5 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 _0xef50=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','undefined','limit','apply','save','then','get','OpenchannelQueues','UserProfileResource','destroy','end','error','stack','name','send','map','OpenchannelQueue','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','UserId','updatedAt','createdAt','openchannelPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','eml-format'];(function(_0x1814b4,_0x509eff){var _0x10109e=function(_0x44b7b6){while(--_0x44b7b6){_0x1814b4['push'](_0x1814b4['shift']());}};_0x10109e(++_0x509eff);}(_0xef50,0x115));var _0x0ef5=function(_0x3f6162,_0x29f46e){_0x3f6162=_0x3f6162-0x0;var _0xca5af4=_0xef50[_0x3f6162];return _0xca5af4;};'use strict';var emlformat=require(_0x0ef5('0x0'));var rimraf=require(_0x0ef5('0x1'));var zipdir=require(_0x0ef5('0x2'));var jsonpatch=require(_0x0ef5('0x3'));var rp=require(_0x0ef5('0x4'));var moment=require(_0x0ef5('0x5'));var BPromise=require(_0x0ef5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0ef5('0x7'));var csv=require('to-csv');var ejs=require(_0x0ef5('0x8'));var fs=require('fs');var fs_extra=require(_0x0ef5('0x9'));var _=require(_0x0ef5('0xa'));var squel=require(_0x0ef5('0xb'));var crypto=require(_0x0ef5('0xc'));var jsforce=require(_0x0ef5('0xd'));var deskjs=require(_0x0ef5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ef5('0xf'));var Papa=require('papaparse');var Redis=require(_0x0ef5('0x10'));var authService=require(_0x0ef5('0x11'));var qs=require(_0x0ef5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ef5('0x13'));var logger=require('../../config/logger')(_0x0ef5('0x14'));var utils=require(_0x0ef5('0x15'));var config=require(_0x0ef5('0x16'));var licenseUtil=require(_0x0ef5('0x17'));var db=require(_0x0ef5('0x18'))['db'];config[_0x0ef5('0x19')]=_[_0x0ef5('0x1a')](config[_0x0ef5('0x19')],{'host':_0x0ef5('0x1b'),'port':0x18eb});var socket=require(_0x0ef5('0x1c'))(new Redis(config[_0x0ef5('0x19')]));require(_0x0ef5('0x1d'))['register'](socket);function respondWithStatusCode(_0x4eadcc,_0x2116ef){_0x2116ef=_0x2116ef||0xcc;return function(_0x5c752d){if(_0x5c752d){return _0x4eadcc[_0x0ef5('0x1e')](_0x2116ef);}return _0x4eadcc[_0x0ef5('0x1f')](_0x2116ef)['end']();};}function respondWithResult(_0x5d4060,_0x42b834){_0x42b834=_0x42b834||0xc8;return function(_0x26d1e4){if(_0x26d1e4){return _0x5d4060[_0x0ef5('0x1f')](_0x42b834)[_0x0ef5('0x20')](_0x26d1e4);}};}function respondWithFilteredResult(_0x2cb3be,_0x2794fd){return function(_0x1e3e7d){if(_0x1e3e7d){var _0x424e73=typeof _0x2794fd['offset']===_0x0ef5('0x21')&&typeof _0x2794fd[_0x0ef5('0x22')]==='undefined';var _0x10e3b7=_0x1e3e7d['count'];var _0xa2cfc=_0x424e73?0x0:_0x2794fd['offset'];var _0x4a369d=_0x424e73?_0x1e3e7d['count']:_0x2794fd['offset']+_0x2794fd['limit'];var _0x5e2c29;if(_0x4a369d>=_0x10e3b7){_0x4a369d=_0x10e3b7;_0x5e2c29=0xc8;}else{_0x5e2c29=0xce;}_0x2cb3be[_0x0ef5('0x1f')](_0x5e2c29);return _0x2cb3be['set']('Content-Range',_0xa2cfc+'-'+_0x4a369d+'/'+_0x10e3b7)['json'](_0x1e3e7d);}return null;};}function patchUpdates(_0x5a5146){return function(_0x347b7b){try{jsonpatch[_0x0ef5('0x23')](_0x347b7b,_0x5a5146,!![]);}catch(_0xfdcdf0){return BPromise['reject'](_0xfdcdf0);}return _0x347b7b[_0x0ef5('0x24')]();};}function saveUpdates(_0x4dbf44,_0x5c9c6a){return function(_0x2a797d){if(_0x2a797d){return _0x2a797d['update'](_0x4dbf44)[_0x0ef5('0x25')](function(_0x5ac9ee){return _0x5ac9ee;});}return null;};}function removeEntity(_0x1ffa47,_0x3eb3d0){return function(_0x29d0a1){if(_0x29d0a1){return _0x29d0a1['destroy']()[_0x0ef5('0x25')](function(){var _0x7bcbde=_0x29d0a1[_0x0ef5('0x26')]({'plain':!![]});var _0x564cb1=_0x0ef5('0x27');return db[_0x0ef5('0x28')][_0x0ef5('0x29')]({'where':{'type':_0x564cb1,'resourceId':_0x7bcbde['id']}})[_0x0ef5('0x25')](function(){return _0x29d0a1;});})[_0x0ef5('0x25')](function(){_0x1ffa47[_0x0ef5('0x1f')](0xcc)[_0x0ef5('0x2a')]();});}};}function handleEntityNotFound(_0x22daa5,_0x5c93ea){return function(_0x51492c){if(!_0x51492c){_0x22daa5['sendStatus'](0x194);}return _0x51492c;};}function handleError(_0x23d983,_0xce7bb2){_0xce7bb2=_0xce7bb2||0x1f4;return function(_0x5e5077){logger[_0x0ef5('0x2b')](_0x5e5077[_0x0ef5('0x2c')]);if(_0x5e5077[_0x0ef5('0x2d')]){delete _0x5e5077[_0x0ef5('0x2d')];}_0x23d983[_0x0ef5('0x1f')](_0xce7bb2)[_0x0ef5('0x2e')](_0x5e5077);};}exports['index']=function(_0x112d09,_0x29c3f2){var _0x5bf86a={},_0x567286={},_0x1e0c76={'count':0x0,'rows':[]};var _0x345a6b=_[_0x0ef5('0x2f')](db[_0x0ef5('0x30')][_0x0ef5('0x31')],function(_0x4906cc){return{'name':_0x4906cc['fieldName'],'type':_0x4906cc[_0x0ef5('0x32')][_0x0ef5('0x33')]};});_0x567286['model']=_[_0x0ef5('0x2f')](_0x345a6b,'name');_0x567286[_0x0ef5('0x34')]=_[_0x0ef5('0x35')](_0x112d09[_0x0ef5('0x34')]);_0x567286['filters']=_[_0x0ef5('0x36')](_0x567286[_0x0ef5('0x37')],_0x567286[_0x0ef5('0x34')]);_0x5bf86a[_0x0ef5('0x38')]=_[_0x0ef5('0x36')](_0x567286[_0x0ef5('0x37')],qs[_0x0ef5('0x39')](_0x112d09[_0x0ef5('0x34')][_0x0ef5('0x39')]));_0x5bf86a[_0x0ef5('0x38')]=_0x5bf86a[_0x0ef5('0x38')]['length']?_0x5bf86a[_0x0ef5('0x38')]:_0x567286[_0x0ef5('0x37')];if(!_0x112d09[_0x0ef5('0x34')][_0x0ef5('0x3a')](_0x0ef5('0x3b'))){_0x5bf86a['limit']=qs[_0x0ef5('0x22')](_0x112d09[_0x0ef5('0x34')]['limit']);_0x5bf86a[_0x0ef5('0x3c')]=qs['offset'](_0x112d09['query'][_0x0ef5('0x3c')]);}_0x5bf86a[_0x0ef5('0x3d')]=qs[_0x0ef5('0x3e')](_0x112d09[_0x0ef5('0x34')][_0x0ef5('0x3e')]);_0x5bf86a[_0x0ef5('0x3f')]=qs[_0x0ef5('0x40')](_[_0x0ef5('0x41')](_0x112d09[_0x0ef5('0x34')],_0x567286['filters']),_0x345a6b);if(_0x112d09[_0x0ef5('0x34')][_0x0ef5('0x42')]){_0x5bf86a[_0x0ef5('0x3f')]=_['merge'](_0x5bf86a[_0x0ef5('0x3f')],{'$or':_[_0x0ef5('0x2f')](_0x345a6b,function(_0x27cea9){if(_0x27cea9['type']!==_0x0ef5('0x43')){var _0x3c8bcb={};_0x3c8bcb[_0x27cea9[_0x0ef5('0x2d')]]={'$like':'%'+_0x112d09[_0x0ef5('0x34')][_0x0ef5('0x42')]+'%'};return _0x3c8bcb;}})});}_0x5bf86a=_[_0x0ef5('0x44')]({},_0x5bf86a,_0x112d09[_0x0ef5('0x45')]);var _0x13383a={'where':_0x5bf86a[_0x0ef5('0x3f')]};return db[_0x0ef5('0x30')]['count'](_0x13383a)[_0x0ef5('0x25')](function(_0x488763){_0x1e0c76['count']=_0x488763;if(_0x112d09['query'][_0x0ef5('0x46')]){_0x5bf86a[_0x0ef5('0x47')]=[{'all':!![]}];}return db[_0x0ef5('0x30')]['findAll'](_0x5bf86a);})[_0x0ef5('0x25')](function(_0x2817e4){_0x1e0c76[_0x0ef5('0x48')]=_0x2817e4;return _0x1e0c76;})[_0x0ef5('0x25')](respondWithFilteredResult(_0x29c3f2,_0x5bf86a))['catch'](handleError(_0x29c3f2,null));};exports[_0x0ef5('0x49')]=function(_0x48e7e8,_0x381ebd){var _0x2b4604={'raw':!![],'where':{'id':_0x48e7e8[_0x0ef5('0x4a')]['id']}},_0x1e5be7={};_0x1e5be7[_0x0ef5('0x37')]=_['keys'](db['OpenchannelQueue'][_0x0ef5('0x31')]);_0x1e5be7['query']=_[_0x0ef5('0x35')](_0x48e7e8[_0x0ef5('0x34')]);_0x1e5be7['filters']=_[_0x0ef5('0x36')](_0x1e5be7['model'],_0x1e5be7[_0x0ef5('0x34')]);_0x2b4604[_0x0ef5('0x38')]=_[_0x0ef5('0x36')](_0x1e5be7['model'],qs[_0x0ef5('0x39')](_0x48e7e8[_0x0ef5('0x34')][_0x0ef5('0x39')]));_0x2b4604[_0x0ef5('0x38')]=_0x2b4604[_0x0ef5('0x38')][_0x0ef5('0x4b')]?_0x2b4604[_0x0ef5('0x38')]:_0x1e5be7[_0x0ef5('0x37')];if(_0x48e7e8[_0x0ef5('0x34')]['includeAll']){_0x2b4604[_0x0ef5('0x47')]=[{'all':!![]}];}_0x2b4604=_[_0x0ef5('0x44')]({},_0x2b4604,_0x48e7e8[_0x0ef5('0x45')]);return db[_0x0ef5('0x30')][_0x0ef5('0x4c')](_0x2b4604)[_0x0ef5('0x25')](handleEntityNotFound(_0x381ebd,null))['then'](respondWithResult(_0x381ebd,null))[_0x0ef5('0x4d')](handleError(_0x381ebd,null));};exports[_0x0ef5('0x4e')]=function(_0x52d470,_0x4ad9b8){return db['OpenchannelQueue'][_0x0ef5('0x4e')](_0x52d470[_0x0ef5('0x4f')],{})['then'](function(_0x1de129){var _0x4fd986=_0x52d470[_0x0ef5('0x50')][_0x0ef5('0x26')]({'plain':!![]});if(!_0x4fd986)throw new Error(_0x0ef5('0x51'));if(_0x4fd986[_0x0ef5('0x52')]===_0x0ef5('0x50')){var _0x5531c5=_0x1de129['get']({'plain':!![]});var _0x5ed49a='OpenchannelQueues';return db[_0x0ef5('0x53')]['find']({'where':{'name':_0x5ed49a,'userProfileId':_0x4fd986[_0x0ef5('0x54')]},'raw':!![]})[_0x0ef5('0x25')](function(_0x3f0918){if(_0x3f0918&&_0x3f0918[_0x0ef5('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x5531c5['name'],'resourceId':_0x5531c5['id'],'type':_0x3f0918[_0x0ef5('0x2d')],'sectionId':_0x3f0918['id']},{})[_0x0ef5('0x25')](function(){return _0x1de129;});}else{return _0x1de129;}})['catch'](function(_0x5c1f4a){logger[_0x0ef5('0x2b')](_0x0ef5('0x56'),_0x5c1f4a);throw _0x5c1f4a;});}return _0x1de129;})[_0x0ef5('0x25')](respondWithResult(_0x4ad9b8,0xc9))['catch'](handleError(_0x4ad9b8,null));};exports['update']=function(_0x4ffaed,_0x47212a){if(_0x4ffaed['body']['id']){delete _0x4ffaed[_0x0ef5('0x4f')]['id'];}return db[_0x0ef5('0x30')][_0x0ef5('0x4c')]({'where':{'id':_0x4ffaed[_0x0ef5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x47212a,null))['then'](saveUpdates(_0x4ffaed[_0x0ef5('0x4f')],null))[_0x0ef5('0x25')](respondWithResult(_0x47212a,null))[_0x0ef5('0x4d')](handleError(_0x47212a,null));};exports[_0x0ef5('0x29')]=function(_0x579310,_0x1ec041){return db['OpenchannelQueue'][_0x0ef5('0x4c')]({'where':{'id':_0x579310[_0x0ef5('0x4a')]['id']}})[_0x0ef5('0x25')](handleEntityNotFound(_0x1ec041,null))[_0x0ef5('0x25')](removeEntity(_0x1ec041,null))[_0x0ef5('0x4d')](handleError(_0x1ec041,null));};exports[_0x0ef5('0x57')]=function(_0x59d43e,_0x556a47){return db[_0x0ef5('0x30')][_0x0ef5('0x57')]()['then'](respondWithResult(_0x556a47,null))[_0x0ef5('0x4d')](handleError(_0x556a47,null));};exports[_0x0ef5('0x58')]=function(_0x1df719,_0x579f48,_0x470084){var _0x25c301={'raw':!![],'where':{}},_0x5f3a16={},_0x1ba8b4;return db[_0x0ef5('0x30')][_0x0ef5('0x59')]({'where':{'id':_0x1df719[_0x0ef5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x579f48,null))['then'](function(_0x5c4f9e){if(_0x5c4f9e){_0x1ba8b4=_0x5c4f9e[_0x0ef5('0x26')]({'plain':!![]});_0x5f3a16[_0x0ef5('0x37')]=_['keys'](db[_0x0ef5('0x5a')][_0x0ef5('0x31')]);_0x5f3a16[_0x0ef5('0x34')]=_[_0x0ef5('0x35')](_0x1df719[_0x0ef5('0x34')]);_0x5f3a16['filters']=_[_0x0ef5('0x36')](_0x5f3a16['model'],_0x5f3a16['query']);_0x25c301['attributes']=_[_0x0ef5('0x36')](_0x5f3a16[_0x0ef5('0x37')],qs[_0x0ef5('0x39')](_0x1df719[_0x0ef5('0x34')][_0x0ef5('0x39')]));_0x25c301['attributes']=_0x25c301[_0x0ef5('0x38')]['length']?_0x25c301['attributes']:_0x5f3a16[_0x0ef5('0x37')];if(!_0x1df719[_0x0ef5('0x34')][_0x0ef5('0x3a')]('nolimit')){_0x25c301[_0x0ef5('0x22')]=qs[_0x0ef5('0x22')](_0x1df719['query'][_0x0ef5('0x22')]);_0x25c301['offset']=qs[_0x0ef5('0x3c')](_0x1df719['query'][_0x0ef5('0x3c')]);}_0x25c301[_0x0ef5('0x3d')]=qs[_0x0ef5('0x3e')](_0x1df719[_0x0ef5('0x34')][_0x0ef5('0x3e')]);_0x25c301['where']=qs[_0x0ef5('0x40')](_[_0x0ef5('0x41')](_0x1df719[_0x0ef5('0x34')],_0x5f3a16[_0x0ef5('0x40')]));_0x25c301[_0x0ef5('0x3f')][_0x0ef5('0x5b')]=_0x5c4f9e['id'];if(_0x1df719['query'][_0x0ef5('0x42')]){_0x25c301[_0x0ef5('0x3f')]=_[_0x0ef5('0x44')](_0x25c301[_0x0ef5('0x3f')],{'$or':_[_0x0ef5('0x2f')](_0x25c301['attributes'],function(_0x368584){var _0x3132ed={};_0x3132ed[_0x368584]={'$like':'%'+_0x1df719[_0x0ef5('0x34')][_0x0ef5('0x42')]+'%'};return _0x3132ed;})});}_0x25c301=_[_0x0ef5('0x44')]({},_0x25c301,_0x1df719[_0x0ef5('0x45')]);return db[_0x0ef5('0x5a')][_0x0ef5('0x5c')](_0x25c301);}})['then'](function(_0xbc087e){if(_0xbc087e){return db[_0x0ef5('0x5d')]['findAndCountAll']({'where':{'id':_[_0x0ef5('0x2f')](_0xbc087e,_0x0ef5('0x5e')),'role':'agent'},'attributes':['id',_0x0ef5('0x2d'),'openchannelPause',_0x0ef5('0x5f'),_0x0ef5('0x60')]});}})[_0x0ef5('0x25')](function(_0x5c7781){if(_0x5c7781){return{'count':_0x5c7781['count'],'rows':_[_0x0ef5('0x2f')](_0x5c7781[_0x0ef5('0x48')],function(_0x237fa3){return{'membername':_0x237fa3[_0x0ef5('0x2d')],'UserId':_0x237fa3['id'],'queue_name':_0x1ba8b4[_0x0ef5('0x2d')],'OpenchannelQueueId':_0x1ba8b4['id'],'interface':util['format']('%s/%s','SIP',_0x237fa3[_0x0ef5('0x2d')]),'penalty':0x0,'paused':_0x237fa3[_0x0ef5('0x61')],'createdAt':_0x237fa3[_0x0ef5('0x60')],'updatedAt':_0x237fa3[_0x0ef5('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0ef5('0x25')](respondWithFilteredResult(_0x579f48,_0x25c301))[_0x0ef5('0x4d')](handleError(_0x579f48,null));};exports[_0x0ef5('0x62')]=function(_0x3aec4f,_0x262a86,_0x3098ce){var _0x495f7d={};var _0x32e952={};var _0x229066;var _0x148c1d;return db[_0x0ef5('0x30')]['findOne']({'where':{'id':_0x3aec4f[_0x0ef5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x262a86,null))[_0x0ef5('0x25')](function(_0x2fd908){if(_0x2fd908){_0x229066=_0x2fd908;_0x32e952['model']=_['keys'](db[_0x0ef5('0x63')][_0x0ef5('0x31')]);_0x32e952[_0x0ef5('0x34')]=_[_0x0ef5('0x35')](_0x3aec4f[_0x0ef5('0x34')]);_0x32e952['filters']=_[_0x0ef5('0x36')](_0x32e952[_0x0ef5('0x37')],_0x32e952['query']);_0x495f7d['attributes']=_[_0x0ef5('0x36')](_0x32e952['model'],qs[_0x0ef5('0x39')](_0x3aec4f[_0x0ef5('0x34')][_0x0ef5('0x39')]));_0x495f7d[_0x0ef5('0x38')]=_0x495f7d[_0x0ef5('0x38')][_0x0ef5('0x4b')]?_0x495f7d[_0x0ef5('0x38')]:_0x32e952[_0x0ef5('0x37')];_0x495f7d[_0x0ef5('0x3d')]=qs[_0x0ef5('0x3e')](_0x3aec4f[_0x0ef5('0x34')]['sort']);_0x495f7d[_0x0ef5('0x3f')]=qs[_0x0ef5('0x40')](_[_0x0ef5('0x41')](_0x3aec4f[_0x0ef5('0x34')],_0x32e952[_0x0ef5('0x40')]));if(_0x3aec4f[_0x0ef5('0x34')][_0x0ef5('0x42')]){_0x495f7d[_0x0ef5('0x3f')]=_[_0x0ef5('0x44')](_0x495f7d[_0x0ef5('0x3f')],{'$or':_[_0x0ef5('0x2f')](_0x495f7d[_0x0ef5('0x38')],function(_0x11aa89){var _0x4a47b2={};_0x4a47b2[_0x11aa89]={'$like':'%'+_0x3aec4f['query'][_0x0ef5('0x42')]+'%'};return _0x4a47b2;})});}_0x495f7d=_[_0x0ef5('0x44')]({},_0x495f7d,_0x3aec4f[_0x0ef5('0x45')]);return _0x229066[_0x0ef5('0x62')](_0x495f7d);}})[_0x0ef5('0x25')](function(_0x1428d2){if(_0x1428d2){_0x148c1d=_0x1428d2[_0x0ef5('0x4b')];if(!_0x3aec4f[_0x0ef5('0x34')][_0x0ef5('0x3a')](_0x0ef5('0x3b'))){_0x495f7d[_0x0ef5('0x22')]=qs['limit'](_0x3aec4f[_0x0ef5('0x34')][_0x0ef5('0x22')]);_0x495f7d[_0x0ef5('0x3c')]=qs[_0x0ef5('0x3c')](_0x3aec4f['query']['offset']);}return _0x229066[_0x0ef5('0x62')](_0x495f7d);}})['then'](function(_0x407fea){if(_0x407fea){return _0x407fea?{'count':_0x148c1d,'rows':_0x407fea}:null;}})[_0x0ef5('0x25')](respondWithResult(_0x262a86,null))[_0x0ef5('0x4d')](handleError(_0x262a86,null));};exports[_0x0ef5('0x64')]=function(_0x2b9966,_0x417c37,_0x1b0515){var _0x201b62=_0x2b9966[_0x0ef5('0x4f')][_0x0ef5('0x65')];return db[_0x0ef5('0x63')][_0x0ef5('0x5c')]({'where':{'id':_0x201b62},'attributes':['id'],'include':[{'model':db[_0x0ef5('0x5d')],'as':_0x0ef5('0x66'),'attributes':['id',_0x0ef5('0x2d'),_0x0ef5('0x67'),_0x0ef5('0x68'),_0x0ef5('0x69')],'raw':!![]}]})['then'](function(_0x1d24c2){if(_0x1d24c2){var _0x3e8d8e=_['flatMap'](_0x1d24c2,function(_0x5a6509){var _0x4f9634=_0x5a6509['get']({'plain':!![]});return _0x4f9634['Agents'];});return db['OpenchannelQueue'][_0x0ef5('0x4c')]({'where':{'id':_0x2b9966[_0x0ef5('0x4a')]['id']}})[_0x0ef5('0x25')](function(_0x32fe52){return db[_0x0ef5('0x6a')][_0x0ef5('0x6b')](function(_0x3e1467){return _0x32fe52[_0x0ef5('0x64')](_0x201b62,{'transaction':_0x3e1467})['then'](function(){return BPromise['each'](_0x3e8d8e,function(_0x4783d0){return db[_0x0ef5('0x5a')][_0x0ef5('0x6c')]({'where':{'UserId':_0x4783d0['id'],'OpenchannelQueueId':_0x2b9966['params']['id']},'transaction':_0x3e1467});});})[_0x0ef5('0x25')](function(){_0x3e8d8e[_0x0ef5('0x6d')](function(_0x1c812e){socket[_0x0ef5('0x6e')](_0x0ef5('0x6f'),{'UserId':_0x1c812e['id'],'OpenchannelQueueId':_0x32fe52['id']});});});});});}})['then'](respondWithStatusCode(_0x417c37,null))['catch'](handleError(_0x417c37,null));};exports[_0x0ef5('0x70')]=function(_0x3813c0,_0x481ed0,_0x1d3263){return db[_0x0ef5('0x63')]['findAll']({'where':{'id':_0x3813c0[_0x0ef5('0x34')][_0x0ef5('0x65')]},'attributes':['id'],'include':[{'model':db[_0x0ef5('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0ef5('0x25')](handleEntityNotFound(_0x481ed0,null))[_0x0ef5('0x25')](function(_0x2a009e){var _0x2fdd49=_[_0x0ef5('0x2f')](_0x2a009e,'id');var _0x2ce177=[];var _0x276577=[];var _0x404e31=squel[_0x0ef5('0x71')]();_0x404e31[_0x0ef5('0x72')](_0x0ef5('0x73'))[_0x0ef5('0x74')](_0x0ef5('0x75'),'tq')[_0x0ef5('0x76')](_0x0ef5('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0ef5('0x3f')](_0x0ef5('0x78'),_0x3813c0['params']['id']);for(var _0x4daf52=0x0;_0x4daf52<_0x2a009e['length'];_0x4daf52+=0x1){let _0x1e8c5b=_0x2a009e[_0x4daf52];for(var _0x38f54a=0x0;_0x38f54a<_0x1e8c5b[_0x0ef5('0x66')][_0x0ef5('0x4b')];_0x38f54a+=0x1){let _0x44f685=_0x1e8c5b[_0x0ef5('0x66')][_0x38f54a];var _0xbb3988=_0x404e31['clone']();_0xbb3988[_0x0ef5('0x3f')]('ut.UserId\x20=\x20?',_0x44f685['id']);_0x276577[_0x0ef5('0x79')](db['sequelize'][_0x0ef5('0x34')](_0xbb3988[_0x0ef5('0x7a')](),{'type':db[_0x0ef5('0x6a')][_0x0ef5('0x7b')][_0x0ef5('0x7c')]})[_0x0ef5('0x25')](function(_0x55a4b1){if(_0x55a4b1[_0x0ef5('0x4b')]===0x1){return _0x44f685['id'];}else{var _0x1be1fe=_[_0x0ef5('0x7d')](_[_0x0ef5('0x2f')](_0x55a4b1,_0x0ef5('0x7e')),function(_0xc31d94){return _[_0x0ef5('0x7f')](_0x2fdd49,_0xc31d94);});if(_0x1be1fe){return _0x44f685['id'];}}}));}}return BPromise[_0x0ef5('0x80')](_0x276577)[_0x0ef5('0x25')](function(_0x225b70){_0x2ce177=_(_0x2ce177)[_0x0ef5('0x81')](_0x225b70)[_0x0ef5('0x82')]()[_0x0ef5('0x83')]();return db[_0x0ef5('0x30')]['find']({'where':{'id':_0x3813c0['params']['id']}})['then'](function(_0x2fd7d1){return db[_0x0ef5('0x6a')][_0x0ef5('0x6b')](function(_0xf3b451){return _0x2fd7d1[_0x0ef5('0x70')](_0x3813c0['query'][_0x0ef5('0x65')],{'transaction':_0xf3b451})[_0x0ef5('0x25')](function(){if(!_[_0x0ef5('0x84')](_0x2ce177)){return _0x2fd7d1[_0x0ef5('0x85')](_0x2ce177,{'transaction':_0xf3b451});}})[_0x0ef5('0x25')](function(){_0x2ce177[_0x0ef5('0x6d')](function(_0x5e9b84){socket[_0x0ef5('0x6e')](_0x0ef5('0x86'),{'UserId':_0x5e9b84,'OpenchannelQueueId':_0x2fd7d1['id']});});});});});});})[_0x0ef5('0x25')](respondWithStatusCode(_0x481ed0,null))[_0x0ef5('0x4d')](handleError(_0x481ed0,null));};exports[_0x0ef5('0x87')]=function(_0x5d6da6,_0x2376fe,_0x4b3c0e){return db[_0x0ef5('0x30')][_0x0ef5('0x4c')]({'where':{'id':_0x5d6da6['params']['id']}})[_0x0ef5('0x25')](handleEntityNotFound(_0x2376fe,null))[_0x0ef5('0x25')](function(_0x83167b){if(_0x83167b){return _0x83167b[_0x0ef5('0x87')](_0x5d6da6[_0x0ef5('0x4f')][_0x0ef5('0x65')],_[_0x0ef5('0x88')](_0x5d6da6[_0x0ef5('0x4f')],[_0x0ef5('0x65'),'id'])||{})['spread'](function(_0xe009cd){for(var _0x1ca052=0x0;_0x1ca052<_0x5d6da6[_0x0ef5('0x4f')]['ids'][_0x0ef5('0x4b')];_0x1ca052+=0x1){socket[_0x0ef5('0x6e')]('userOpenchannelQueue:save',{'UserId':Number(_0x5d6da6[_0x0ef5('0x4f')][_0x0ef5('0x65')][_0x1ca052]),'OpenchannelQueueId':Number(_0x5d6da6['params']['id'])});}return _0xe009cd;});}})[_0x0ef5('0x25')](respondWithResult(_0x2376fe,null))[_0x0ef5('0x4d')](handleError(_0x2376fe,null));};exports[_0x0ef5('0x85')]=function(_0x47afa7,_0x50191f,_0x49a67a){return db[_0x0ef5('0x30')][_0x0ef5('0x4c')]({'where':{'id':_0x47afa7[_0x0ef5('0x4a')]['id']}})[_0x0ef5('0x25')](handleEntityNotFound(_0x50191f,null))[_0x0ef5('0x25')](function(_0x2d05e8){if(_0x2d05e8){return _0x2d05e8[_0x0ef5('0x85')](_0x47afa7['query'][_0x0ef5('0x65')])['then'](function(){if(_[_0x0ef5('0x89')](_0x47afa7['query'][_0x0ef5('0x65')])){for(var _0x5b0891=0x0;_0x5b0891<_0x47afa7[_0x0ef5('0x34')][_0x0ef5('0x65')][_0x0ef5('0x4b')];_0x5b0891+=0x1){socket[_0x0ef5('0x6e')](_0x0ef5('0x86'),{'UserId':Number(_0x47afa7['query'][_0x0ef5('0x65')][_0x5b0891]),'OpenchannelQueueId':Number(_0x47afa7[_0x0ef5('0x4a')]['id'])});}}else{socket[_0x0ef5('0x6e')](_0x0ef5('0x86'),{'UserId':Number(_0x47afa7['query'][_0x0ef5('0x65')]),'OpenchannelQueueId':Number(_0x47afa7[_0x0ef5('0x4a')]['id'])});}});}})[_0x0ef5('0x25')](respondWithStatusCode(_0x50191f,null))[_0x0ef5('0x4d')](handleError(_0x50191f,null));};exports[_0x0ef5('0x8a')]=function(_0x5c914c,_0x2bc9a8,_0x486821){var _0xdc2c1d={};var _0x459bea={};var _0x1be6a8;var _0x16403c;return db[_0x0ef5('0x30')][_0x0ef5('0x59')]({'where':{'id':_0x5c914c['params']['id']}})[_0x0ef5('0x25')](handleEntityNotFound(_0x2bc9a8,null))[_0x0ef5('0x25')](function(_0xb0b09b){if(_0xb0b09b){_0x1be6a8=_0xb0b09b;_0x459bea[_0x0ef5('0x37')]=_[_0x0ef5('0x35')](db['User']['rawAttributes']);_0x459bea[_0x0ef5('0x34')]=_[_0x0ef5('0x35')](_0x5c914c[_0x0ef5('0x34')]);_0x459bea['filters']=_['intersection'](_0x459bea[_0x0ef5('0x37')],_0x459bea[_0x0ef5('0x34')]);_0xdc2c1d[_0x0ef5('0x38')]=_[_0x0ef5('0x36')](_0x459bea[_0x0ef5('0x37')],qs[_0x0ef5('0x39')](_0x5c914c['query'][_0x0ef5('0x39')]));_0xdc2c1d[_0x0ef5('0x38')]=_0xdc2c1d[_0x0ef5('0x38')][_0x0ef5('0x4b')]?_0xdc2c1d[_0x0ef5('0x38')]:_0x459bea[_0x0ef5('0x37')];_0xdc2c1d[_0x0ef5('0x3d')]=qs[_0x0ef5('0x3e')](_0x5c914c[_0x0ef5('0x34')][_0x0ef5('0x3e')]);_0xdc2c1d[_0x0ef5('0x3f')]=qs[_0x0ef5('0x40')](_[_0x0ef5('0x41')](_0x5c914c[_0x0ef5('0x34')],_0x459bea[_0x0ef5('0x40')]));if(_0x5c914c[_0x0ef5('0x34')]['filter']){_0xdc2c1d['where']=_[_0x0ef5('0x44')](_0xdc2c1d[_0x0ef5('0x3f')],{'$or':_[_0x0ef5('0x2f')](_0xdc2c1d[_0x0ef5('0x38')],function(_0x34abce){var _0x88d236={};_0x88d236[_0x34abce]={'$like':'%'+_0x5c914c[_0x0ef5('0x34')][_0x0ef5('0x42')]+'%'};return _0x88d236;})});}_0xdc2c1d=_[_0x0ef5('0x44')]({},_0xdc2c1d,_0x5c914c[_0x0ef5('0x45')]);return _0x1be6a8[_0x0ef5('0x8a')](_0xdc2c1d);}})[_0x0ef5('0x25')](function(_0x4a97b0){if(_0x4a97b0){_0x16403c=_0x4a97b0[_0x0ef5('0x4b')];if(!_0x5c914c[_0x0ef5('0x34')][_0x0ef5('0x3a')](_0x0ef5('0x3b'))){_0xdc2c1d[_0x0ef5('0x22')]=qs[_0x0ef5('0x22')](_0x5c914c[_0x0ef5('0x34')][_0x0ef5('0x22')]);_0xdc2c1d['offset']=qs[_0x0ef5('0x3c')](_0x5c914c[_0x0ef5('0x34')][_0x0ef5('0x3c')]);}return _0x1be6a8[_0x0ef5('0x8a')](_0xdc2c1d);}})[_0x0ef5('0x25')](function(_0x1a0a6a){if(_0x1a0a6a){return _0x1a0a6a?{'count':_0x16403c,'rows':_0x1a0a6a}:null;}})[_0x0ef5('0x25')](respondWithResult(_0x2bc9a8,null))[_0x0ef5('0x4d')](handleError(_0x2bc9a8,null));}; \ No newline at end of file +var _0x7257=['error','describe','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','openchannelPause','Team','getTeams','addTeams','ids','Agents','voicePause','sequelize','transaction','each','forEach','select','field','tq.TeamId','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeTeams','isEmpty','emit','addAgents','spread','userOpenchannelQueue:save','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','get','destroy','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','OpenchannelQueue','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x272666,_0x422b6d){var _0x13bb5e=function(_0x41bea9){while(--_0x41bea9){_0x272666['push'](_0x272666['shift']());}};_0x13bb5e(++_0x422b6d);}(_0x7257,0x1d7));var _0x7725=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0x7257[_0x2f16e5];return _0x5d082a;};'use strict';var emlformat=require(_0x7725('0x0'));var rimraf=require(_0x7725('0x1'));var zipdir=require(_0x7725('0x2'));var jsonpatch=require(_0x7725('0x3'));var rp=require(_0x7725('0x4'));var moment=require(_0x7725('0x5'));var BPromise=require(_0x7725('0x6'));var Mustache=require(_0x7725('0x7'));var util=require('util');var path=require(_0x7725('0x8'));var sox=require(_0x7725('0x9'));var csv=require(_0x7725('0xa'));var ejs=require(_0x7725('0xb'));var fs=require('fs');var fs_extra=require(_0x7725('0xc'));var _=require(_0x7725('0xd'));var squel=require(_0x7725('0xe'));var crypto=require('crypto');var jsforce=require(_0x7725('0xf'));var deskjs=require(_0x7725('0x10'));var toCsv=require(_0x7725('0xa'));var querystring=require('querystring');var Papa=require(_0x7725('0x11'));var Redis=require(_0x7725('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7725('0x13'));var as=require(_0x7725('0x14'));var hardwareService=require(_0x7725('0x15'));var logger=require('../../config/logger')(_0x7725('0x16'));var utils=require(_0x7725('0x17'));var config=require(_0x7725('0x18'));var licenseUtil=require(_0x7725('0x19'));var db=require(_0x7725('0x1a'))['db'];config[_0x7725('0x1b')]=_[_0x7725('0x1c')](config[_0x7725('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x7725('0x1d'))(new Redis(config[_0x7725('0x1b')]));require(_0x7725('0x1e'))[_0x7725('0x1f')](socket);function respondWithStatusCode(_0x16a654,_0x1871be){_0x1871be=_0x1871be||0xcc;return function(_0x2f4c2b){if(_0x2f4c2b){return _0x16a654[_0x7725('0x20')](_0x1871be);}return _0x16a654[_0x7725('0x21')](_0x1871be)[_0x7725('0x22')]();};}function respondWithResult(_0x2607a7,_0x20e66a){_0x20e66a=_0x20e66a||0xc8;return function(_0x42b62b){if(_0x42b62b){return _0x2607a7['status'](_0x20e66a)[_0x7725('0x23')](_0x42b62b);}};}function respondWithFilteredResult(_0x3e4a77,_0x45e758){return function(_0x133057){if(_0x133057){var _0x1ff270=typeof _0x45e758['offset']===_0x7725('0x24')&&typeof _0x45e758['limit']===_0x7725('0x24');var _0x80b05e=_0x133057['count'];var _0x3f9646=_0x1ff270?0x0:_0x45e758['offset'];var _0x1e4aed=_0x1ff270?_0x133057[_0x7725('0x25')]:_0x45e758[_0x7725('0x26')]+_0x45e758[_0x7725('0x27')];var _0x48fa3a;if(_0x1e4aed>=_0x80b05e){_0x1e4aed=_0x80b05e;_0x48fa3a=0xc8;}else{_0x48fa3a=0xce;}_0x3e4a77[_0x7725('0x21')](_0x48fa3a);return _0x3e4a77[_0x7725('0x28')](_0x7725('0x29'),_0x3f9646+'-'+_0x1e4aed+'/'+_0x80b05e)[_0x7725('0x23')](_0x133057);}return null;};}function patchUpdates(_0x1c0df8){return function(_0x284d7c){try{jsonpatch[_0x7725('0x2a')](_0x284d7c,_0x1c0df8,!![]);}catch(_0x22c055){return BPromise['reject'](_0x22c055);}return _0x284d7c['save']();};}function saveUpdates(_0xe09361,_0x519540){return function(_0x3e1379){if(_0x3e1379){return _0x3e1379[_0x7725('0x2b')](_0xe09361)[_0x7725('0x2c')](function(_0x4a5383){return _0x4a5383;});}return null;};}function removeEntity(_0x381425,_0x252625){return function(_0xb7e9b){if(_0xb7e9b){return _0xb7e9b['destroy']()['then'](function(){var _0xbeda4e=_0xb7e9b[_0x7725('0x2d')]({'plain':!![]});var _0x3f0540='OpenchannelQueues';return db['UserProfileResource'][_0x7725('0x2e')]({'where':{'type':_0x3f0540,'resourceId':_0xbeda4e['id']}})[_0x7725('0x2c')](function(){return _0xb7e9b;});})['then'](function(){_0x381425[_0x7725('0x21')](0xcc)[_0x7725('0x22')]();});}};}function handleEntityNotFound(_0x110c9f,_0x36b71c){return function(_0x5b874d){if(!_0x5b874d){_0x110c9f[_0x7725('0x20')](0x194);}return _0x5b874d;};}function handleError(_0x49fd37,_0x574ba0){_0x574ba0=_0x574ba0||0x1f4;return function(_0x2ee249){logger['error'](_0x2ee249[_0x7725('0x2f')]);if(_0x2ee249[_0x7725('0x30')]){delete _0x2ee249['name'];}_0x49fd37[_0x7725('0x21')](_0x574ba0)[_0x7725('0x31')](_0x2ee249);};}exports[_0x7725('0x32')]=function(_0x340e0b,_0x4a13f7){var _0x2796b2={},_0x1a50d7={},_0x508ebd={'count':0x0,'rows':[]};var _0x156f59=_[_0x7725('0x33')](db['OpenchannelQueue'][_0x7725('0x34')],function(_0x2ccc08){return{'name':_0x2ccc08['fieldName'],'type':_0x2ccc08['type'][_0x7725('0x35')]};});_0x1a50d7[_0x7725('0x36')]=_[_0x7725('0x33')](_0x156f59,_0x7725('0x30'));_0x1a50d7[_0x7725('0x37')]=_[_0x7725('0x38')](_0x340e0b[_0x7725('0x37')]);_0x1a50d7[_0x7725('0x39')]=_[_0x7725('0x3a')](_0x1a50d7[_0x7725('0x36')],_0x1a50d7['query']);_0x2796b2['attributes']=_['intersection'](_0x1a50d7[_0x7725('0x36')],qs[_0x7725('0x3b')](_0x340e0b['query'][_0x7725('0x3b')]));_0x2796b2[_0x7725('0x3c')]=_0x2796b2[_0x7725('0x3c')][_0x7725('0x3d')]?_0x2796b2[_0x7725('0x3c')]:_0x1a50d7[_0x7725('0x36')];if(!_0x340e0b[_0x7725('0x37')][_0x7725('0x3e')](_0x7725('0x3f'))){_0x2796b2[_0x7725('0x27')]=qs[_0x7725('0x27')](_0x340e0b['query'][_0x7725('0x27')]);_0x2796b2[_0x7725('0x26')]=qs[_0x7725('0x26')](_0x340e0b['query']['offset']);}_0x2796b2[_0x7725('0x40')]=qs['sort'](_0x340e0b[_0x7725('0x37')][_0x7725('0x41')]);_0x2796b2[_0x7725('0x42')]=qs[_0x7725('0x39')](_['pick'](_0x340e0b[_0x7725('0x37')],_0x1a50d7[_0x7725('0x39')]),_0x156f59);if(_0x340e0b[_0x7725('0x37')]['filter']){_0x2796b2[_0x7725('0x42')]=_[_0x7725('0x43')](_0x2796b2['where'],{'$or':_[_0x7725('0x33')](_0x156f59,function(_0x39e099){if(_0x39e099[_0x7725('0x44')]!==_0x7725('0x45')){var _0x3d8dda={};_0x3d8dda[_0x39e099[_0x7725('0x30')]]={'$like':'%'+_0x340e0b[_0x7725('0x37')][_0x7725('0x46')]+'%'};return _0x3d8dda;}})});}_0x2796b2=_[_0x7725('0x43')]({},_0x2796b2,_0x340e0b[_0x7725('0x47')]);var _0x564492={'where':_0x2796b2[_0x7725('0x42')]};return db['OpenchannelQueue'][_0x7725('0x25')](_0x564492)[_0x7725('0x2c')](function(_0x2d71e3){_0x508ebd[_0x7725('0x25')]=_0x2d71e3;if(_0x340e0b[_0x7725('0x37')]['includeAll']){_0x2796b2[_0x7725('0x48')]=[{'all':!![]}];}return db[_0x7725('0x49')][_0x7725('0x4a')](_0x2796b2);})[_0x7725('0x2c')](function(_0x2f0235){_0x508ebd[_0x7725('0x4b')]=_0x2f0235;return _0x508ebd;})[_0x7725('0x2c')](respondWithFilteredResult(_0x4a13f7,_0x2796b2))['catch'](handleError(_0x4a13f7,null));};exports[_0x7725('0x4c')]=function(_0x1aa321,_0x5d8175){var _0x3c9860={'raw':!![],'where':{'id':_0x1aa321[_0x7725('0x4d')]['id']}},_0xe496dd={};_0xe496dd[_0x7725('0x36')]=_[_0x7725('0x38')](db[_0x7725('0x49')][_0x7725('0x34')]);_0xe496dd['query']=_[_0x7725('0x38')](_0x1aa321[_0x7725('0x37')]);_0xe496dd['filters']=_[_0x7725('0x3a')](_0xe496dd['model'],_0xe496dd[_0x7725('0x37')]);_0x3c9860['attributes']=_[_0x7725('0x3a')](_0xe496dd[_0x7725('0x36')],qs[_0x7725('0x3b')](_0x1aa321[_0x7725('0x37')]['fields']));_0x3c9860[_0x7725('0x3c')]=_0x3c9860[_0x7725('0x3c')][_0x7725('0x3d')]?_0x3c9860[_0x7725('0x3c')]:_0xe496dd[_0x7725('0x36')];if(_0x1aa321[_0x7725('0x37')]['includeAll']){_0x3c9860[_0x7725('0x48')]=[{'all':!![]}];}_0x3c9860=_['merge']({},_0x3c9860,_0x1aa321[_0x7725('0x47')]);return db[_0x7725('0x49')][_0x7725('0x4e')](_0x3c9860)['then'](handleEntityNotFound(_0x5d8175,null))['then'](respondWithResult(_0x5d8175,null))[_0x7725('0x4f')](handleError(_0x5d8175,null));};exports['create']=function(_0x1f62e9,_0x21be3c){return db[_0x7725('0x49')][_0x7725('0x50')](_0x1f62e9[_0x7725('0x51')],{})[_0x7725('0x2c')](function(_0x346fe0){var _0x2698ec=_0x1f62e9[_0x7725('0x52')]['get']({'plain':!![]});if(!_0x2698ec)throw new Error(_0x7725('0x53'));if(_0x2698ec['role']===_0x7725('0x52')){var _0x38bb5c=_0x346fe0['get']({'plain':!![]});var _0x54ea58=_0x7725('0x54');return db[_0x7725('0x55')][_0x7725('0x4e')]({'where':{'name':_0x54ea58,'userProfileId':_0x2698ec[_0x7725('0x56')]},'raw':!![]})[_0x7725('0x2c')](function(_0x347bf3){if(_0x347bf3&&_0x347bf3[_0x7725('0x57')]===0x0){return db[_0x7725('0x58')][_0x7725('0x50')]({'name':_0x38bb5c[_0x7725('0x30')],'resourceId':_0x38bb5c['id'],'type':_0x347bf3[_0x7725('0x30')],'sectionId':_0x347bf3['id']},{})[_0x7725('0x2c')](function(){return _0x346fe0;});}else{return _0x346fe0;}})['catch'](function(_0xae3cda){logger[_0x7725('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xae3cda);throw _0xae3cda;});}return _0x346fe0;})['then'](respondWithResult(_0x21be3c,0xc9))[_0x7725('0x4f')](handleError(_0x21be3c,null));};exports[_0x7725('0x2b')]=function(_0x8826ce,_0x358ac3){if(_0x8826ce[_0x7725('0x51')]['id']){delete _0x8826ce[_0x7725('0x51')]['id'];}return db[_0x7725('0x49')][_0x7725('0x4e')]({'where':{'id':_0x8826ce[_0x7725('0x4d')]['id']}})[_0x7725('0x2c')](handleEntityNotFound(_0x358ac3,null))[_0x7725('0x2c')](saveUpdates(_0x8826ce[_0x7725('0x51')],null))[_0x7725('0x2c')](respondWithResult(_0x358ac3,null))['catch'](handleError(_0x358ac3,null));};exports['destroy']=function(_0x597599,_0x391d89){return db[_0x7725('0x49')][_0x7725('0x4e')]({'where':{'id':_0x597599['params']['id']}})[_0x7725('0x2c')](handleEntityNotFound(_0x391d89,null))['then'](removeEntity(_0x391d89,null))['catch'](handleError(_0x391d89,null));};exports[_0x7725('0x5a')]=function(_0x322289,_0xf0f2dd){return db[_0x7725('0x49')][_0x7725('0x5a')]()['then'](respondWithResult(_0xf0f2dd,null))[_0x7725('0x4f')](handleError(_0xf0f2dd,null));};exports['getMembers']=function(_0x2375e6,_0x3a8781,_0x187bc5){var _0x4b3fd4={'raw':!![],'where':{}},_0x30f778={},_0x1a5fba;return db[_0x7725('0x49')][_0x7725('0x5b')]({'where':{'id':_0x2375e6[_0x7725('0x4d')]['id']}})[_0x7725('0x2c')](handleEntityNotFound(_0x3a8781,null))[_0x7725('0x2c')](function(_0x673963){if(_0x673963){_0x1a5fba=_0x673963[_0x7725('0x2d')]({'plain':!![]});_0x30f778[_0x7725('0x36')]=_[_0x7725('0x38')](db[_0x7725('0x5c')][_0x7725('0x34')]);_0x30f778[_0x7725('0x37')]=_[_0x7725('0x38')](_0x2375e6['query']);_0x30f778[_0x7725('0x39')]=_['intersection'](_0x30f778['model'],_0x30f778[_0x7725('0x37')]);_0x4b3fd4[_0x7725('0x3c')]=_[_0x7725('0x3a')](_0x30f778[_0x7725('0x36')],qs['fields'](_0x2375e6[_0x7725('0x37')][_0x7725('0x3b')]));_0x4b3fd4[_0x7725('0x3c')]=_0x4b3fd4[_0x7725('0x3c')]['length']?_0x4b3fd4[_0x7725('0x3c')]:_0x30f778[_0x7725('0x36')];if(!_0x2375e6['query'][_0x7725('0x3e')]('nolimit')){_0x4b3fd4['limit']=qs[_0x7725('0x27')](_0x2375e6[_0x7725('0x37')]['limit']);_0x4b3fd4[_0x7725('0x26')]=qs[_0x7725('0x26')](_0x2375e6['query'][_0x7725('0x26')]);}_0x4b3fd4[_0x7725('0x40')]=qs['sort'](_0x2375e6[_0x7725('0x37')][_0x7725('0x41')]);_0x4b3fd4['where']=qs[_0x7725('0x39')](_[_0x7725('0x5d')](_0x2375e6[_0x7725('0x37')],_0x30f778[_0x7725('0x39')]));_0x4b3fd4[_0x7725('0x42')][_0x7725('0x5e')]=_0x673963['id'];if(_0x2375e6[_0x7725('0x37')]['filter']){_0x4b3fd4[_0x7725('0x42')]=_[_0x7725('0x43')](_0x4b3fd4[_0x7725('0x42')],{'$or':_['map'](_0x4b3fd4['attributes'],function(_0x48f0d4){var _0x1932bc={};_0x1932bc[_0x48f0d4]={'$like':'%'+_0x2375e6[_0x7725('0x37')]['filter']+'%'};return _0x1932bc;})});}_0x4b3fd4=_[_0x7725('0x43')]({},_0x4b3fd4,_0x2375e6['options']);return db['UserOpenchannelQueue'][_0x7725('0x4a')](_0x4b3fd4);}})[_0x7725('0x2c')](function(_0xcbf319){if(_0xcbf319){return db[_0x7725('0x5f')][_0x7725('0x60')]({'where':{'id':_[_0x7725('0x33')](_0xcbf319,'UserId'),'role':_0x7725('0x61')},'attributes':['id',_0x7725('0x30'),'openchannelPause',_0x7725('0x62'),_0x7725('0x63')]});}})[_0x7725('0x2c')](function(_0x4e30b3){if(_0x4e30b3){return{'count':_0x4e30b3[_0x7725('0x25')],'rows':_['map'](_0x4e30b3[_0x7725('0x4b')],function(_0x4bd276){return{'membername':_0x4bd276[_0x7725('0x30')],'UserId':_0x4bd276['id'],'queue_name':_0x1a5fba['name'],'OpenchannelQueueId':_0x1a5fba['id'],'interface':util[_0x7725('0x64')](_0x7725('0x65'),'SIP',_0x4bd276[_0x7725('0x30')]),'penalty':0x0,'paused':_0x4bd276[_0x7725('0x66')],'createdAt':_0x4bd276[_0x7725('0x63')],'updatedAt':_0x4bd276[_0x7725('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3a8781,_0x4b3fd4))[_0x7725('0x4f')](handleError(_0x3a8781,null));};exports['getTeams']=function(_0x17a35d,_0x23a75a,_0xe55321){var _0x7cc01f={};var _0x571859={};var _0x58a6b8;var _0xf65673;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x17a35d[_0x7725('0x4d')]['id']}})[_0x7725('0x2c')](handleEntityNotFound(_0x23a75a,null))[_0x7725('0x2c')](function(_0x1bb539){if(_0x1bb539){_0x58a6b8=_0x1bb539;_0x571859[_0x7725('0x36')]=_['keys'](db[_0x7725('0x67')][_0x7725('0x34')]);_0x571859['query']=_['keys'](_0x17a35d[_0x7725('0x37')]);_0x571859['filters']=_[_0x7725('0x3a')](_0x571859[_0x7725('0x36')],_0x571859['query']);_0x7cc01f['attributes']=_[_0x7725('0x3a')](_0x571859[_0x7725('0x36')],qs[_0x7725('0x3b')](_0x17a35d[_0x7725('0x37')][_0x7725('0x3b')]));_0x7cc01f[_0x7725('0x3c')]=_0x7cc01f['attributes'][_0x7725('0x3d')]?_0x7cc01f[_0x7725('0x3c')]:_0x571859[_0x7725('0x36')];_0x7cc01f[_0x7725('0x40')]=qs[_0x7725('0x41')](_0x17a35d['query'][_0x7725('0x41')]);_0x7cc01f[_0x7725('0x42')]=qs[_0x7725('0x39')](_[_0x7725('0x5d')](_0x17a35d[_0x7725('0x37')],_0x571859[_0x7725('0x39')]));if(_0x17a35d[_0x7725('0x37')][_0x7725('0x46')]){_0x7cc01f[_0x7725('0x42')]=_[_0x7725('0x43')](_0x7cc01f[_0x7725('0x42')],{'$or':_['map'](_0x7cc01f[_0x7725('0x3c')],function(_0x59a064){var _0x4b4828={};_0x4b4828[_0x59a064]={'$like':'%'+_0x17a35d[_0x7725('0x37')]['filter']+'%'};return _0x4b4828;})});}_0x7cc01f=_[_0x7725('0x43')]({},_0x7cc01f,_0x17a35d['options']);return _0x58a6b8[_0x7725('0x68')](_0x7cc01f);}})[_0x7725('0x2c')](function(_0x2308c4){if(_0x2308c4){_0xf65673=_0x2308c4[_0x7725('0x3d')];if(!_0x17a35d[_0x7725('0x37')][_0x7725('0x3e')]('nolimit')){_0x7cc01f[_0x7725('0x27')]=qs[_0x7725('0x27')](_0x17a35d[_0x7725('0x37')][_0x7725('0x27')]);_0x7cc01f['offset']=qs[_0x7725('0x26')](_0x17a35d[_0x7725('0x37')][_0x7725('0x26')]);}return _0x58a6b8['getTeams'](_0x7cc01f);}})['then'](function(_0x1e1521){if(_0x1e1521){return _0x1e1521?{'count':_0xf65673,'rows':_0x1e1521}:null;}})[_0x7725('0x2c')](respondWithResult(_0x23a75a,null))[_0x7725('0x4f')](handleError(_0x23a75a,null));};exports[_0x7725('0x69')]=function(_0x384eb4,_0x12cd68,_0x355bf5){var _0x4f345e=_0x384eb4[_0x7725('0x51')][_0x7725('0x6a')];return db[_0x7725('0x67')][_0x7725('0x4a')]({'where':{'id':_0x4f345e},'attributes':['id'],'include':[{'model':db[_0x7725('0x5f')],'as':_0x7725('0x6b'),'attributes':['id',_0x7725('0x30'),'online',_0x7725('0x6c'),'interface'],'raw':!![]}]})[_0x7725('0x2c')](function(_0x3bfa27){if(_0x3bfa27){var _0x9a3fac=_['flatMap'](_0x3bfa27,function(_0x34a6a5){var _0x90db2a=_0x34a6a5[_0x7725('0x2d')]({'plain':!![]});return _0x90db2a[_0x7725('0x6b')];});return db[_0x7725('0x49')][_0x7725('0x4e')]({'where':{'id':_0x384eb4[_0x7725('0x4d')]['id']}})[_0x7725('0x2c')](function(_0x2e52fb){return db[_0x7725('0x6d')][_0x7725('0x6e')](function(_0x489060){return _0x2e52fb[_0x7725('0x69')](_0x4f345e,{'transaction':_0x489060})[_0x7725('0x2c')](function(){return BPromise[_0x7725('0x6f')](_0x9a3fac,function(_0x4125f4){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x4125f4['id'],'OpenchannelQueueId':_0x384eb4['params']['id']},'transaction':_0x489060});});})[_0x7725('0x2c')](function(){_0x9a3fac[_0x7725('0x70')](function(_0x1056d6){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x1056d6['id'],'OpenchannelQueueId':_0x2e52fb['id']});});});});});}})[_0x7725('0x2c')](respondWithStatusCode(_0x12cd68,null))[_0x7725('0x4f')](handleError(_0x12cd68,null));};exports['removeTeams']=function(_0x9fb8cc,_0x1d924d,_0x49903f){return db[_0x7725('0x67')][_0x7725('0x4a')]({'where':{'id':_0x9fb8cc['query'][_0x7725('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x7725('0x5f')],'as':_0x7725('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x7725('0x2c')](handleEntityNotFound(_0x1d924d,null))[_0x7725('0x2c')](function(_0x5f0683){var _0x2257f6=_[_0x7725('0x33')](_0x5f0683,'id');var _0x18b650=[];var _0x1a8d74=[];var _0x1ccb23=squel[_0x7725('0x71')]();_0x1ccb23[_0x7725('0x72')](_0x7725('0x73'))['from'](_0x7725('0x74'),'tq')['join']('user_has_teams','ut',_0x7725('0x75'))[_0x7725('0x42')](_0x7725('0x76'),_0x9fb8cc[_0x7725('0x4d')]['id']);for(var _0x16ac5f=0x0;_0x16ac5f<_0x5f0683[_0x7725('0x3d')];_0x16ac5f+=0x1){let _0x1463ba=_0x5f0683[_0x16ac5f];for(var _0x149abe=0x0;_0x149abe<_0x1463ba[_0x7725('0x6b')]['length'];_0x149abe+=0x1){let _0x5ec548=_0x1463ba[_0x7725('0x6b')][_0x149abe];var _0x5df4f7=_0x1ccb23[_0x7725('0x77')]();_0x5df4f7[_0x7725('0x42')](_0x7725('0x78'),_0x5ec548['id']);_0x1a8d74[_0x7725('0x79')](db['sequelize'][_0x7725('0x37')](_0x5df4f7[_0x7725('0x7a')](),{'type':db[_0x7725('0x6d')][_0x7725('0x7b')][_0x7725('0x7c')]})[_0x7725('0x2c')](function(_0x5886b1){if(_0x5886b1[_0x7725('0x3d')]===0x1){return _0x5ec548['id'];}else{var _0x4edfda=_['every'](_[_0x7725('0x33')](_0x5886b1,_0x7725('0x7d')),function(_0x116988){return _[_0x7725('0x7e')](_0x2257f6,_0x116988);});if(_0x4edfda){return _0x5ec548['id'];}}}));}}return BPromise['all'](_0x1a8d74)['then'](function(_0x295877){_0x18b650=_(_0x18b650)[_0x7725('0x7f')](_0x295877)[_0x7725('0x80')]()[_0x7725('0x81')]();return db[_0x7725('0x49')][_0x7725('0x4e')]({'where':{'id':_0x9fb8cc[_0x7725('0x4d')]['id']}})['then'](function(_0x593f3e){return db[_0x7725('0x6d')][_0x7725('0x6e')](function(_0x5cc5cb){return _0x593f3e[_0x7725('0x82')](_0x9fb8cc[_0x7725('0x37')][_0x7725('0x6a')],{'transaction':_0x5cc5cb})[_0x7725('0x2c')](function(){if(!_[_0x7725('0x83')](_0x18b650)){return _0x593f3e['removeAgents'](_0x18b650,{'transaction':_0x5cc5cb});}})[_0x7725('0x2c')](function(){_0x18b650[_0x7725('0x70')](function(_0x16f41c){socket[_0x7725('0x84')]('userOpenchannelQueue:remove',{'UserId':_0x16f41c,'OpenchannelQueueId':_0x593f3e['id']});});});});});});})['then'](respondWithStatusCode(_0x1d924d,null))[_0x7725('0x4f')](handleError(_0x1d924d,null));};exports['addAgents']=function(_0xa56751,_0x895564,_0x2240a5){return db[_0x7725('0x49')][_0x7725('0x4e')]({'where':{'id':_0xa56751['params']['id']}})[_0x7725('0x2c')](handleEntityNotFound(_0x895564,null))['then'](function(_0x5cbd84){if(_0x5cbd84){return _0x5cbd84[_0x7725('0x85')](_0xa56751[_0x7725('0x51')][_0x7725('0x6a')],_['omit'](_0xa56751[_0x7725('0x51')],['ids','id'])||{})[_0x7725('0x86')](function(_0x346441){for(var _0x5217aa=0x0;_0x5217aa<_0xa56751[_0x7725('0x51')]['ids'][_0x7725('0x3d')];_0x5217aa+=0x1){socket['emit'](_0x7725('0x87'),{'UserId':Number(_0xa56751[_0x7725('0x51')][_0x7725('0x6a')][_0x5217aa]),'OpenchannelQueueId':Number(_0xa56751['params']['id'])});}return _0x346441;});}})[_0x7725('0x2c')](respondWithResult(_0x895564,null))[_0x7725('0x4f')](handleError(_0x895564,null));};exports[_0x7725('0x88')]=function(_0x2c966a,_0x42baca,_0x1463b6){return db[_0x7725('0x49')][_0x7725('0x4e')]({'where':{'id':_0x2c966a[_0x7725('0x4d')]['id']}})['then'](handleEntityNotFound(_0x42baca,null))['then'](function(_0x3463cb){if(_0x3463cb){return _0x3463cb[_0x7725('0x88')](_0x2c966a[_0x7725('0x37')][_0x7725('0x6a')])[_0x7725('0x2c')](function(){if(_[_0x7725('0x89')](_0x2c966a[_0x7725('0x37')][_0x7725('0x6a')])){for(var _0x2cb18d=0x0;_0x2cb18d<_0x2c966a[_0x7725('0x37')]['ids'][_0x7725('0x3d')];_0x2cb18d+=0x1){socket[_0x7725('0x84')](_0x7725('0x8a'),{'UserId':Number(_0x2c966a[_0x7725('0x37')]['ids'][_0x2cb18d]),'OpenchannelQueueId':Number(_0x2c966a[_0x7725('0x4d')]['id'])});}}else{socket[_0x7725('0x84')](_0x7725('0x8a'),{'UserId':Number(_0x2c966a[_0x7725('0x37')][_0x7725('0x6a')]),'OpenchannelQueueId':Number(_0x2c966a[_0x7725('0x4d')]['id'])});}});}})[_0x7725('0x2c')](respondWithStatusCode(_0x42baca,null))[_0x7725('0x4f')](handleError(_0x42baca,null));};exports[_0x7725('0x8b')]=function(_0x38995c,_0x36ae62,_0x42d6cd){var _0x1b452a={};var _0x442efa={};var _0x17cafd;var _0x30cde3;return db[_0x7725('0x49')][_0x7725('0x5b')]({'where':{'id':_0x38995c[_0x7725('0x4d')]['id']}})[_0x7725('0x2c')](handleEntityNotFound(_0x36ae62,null))[_0x7725('0x2c')](function(_0x26121a){if(_0x26121a){_0x17cafd=_0x26121a;_0x442efa[_0x7725('0x36')]=_[_0x7725('0x38')](db[_0x7725('0x5f')][_0x7725('0x34')]);_0x442efa[_0x7725('0x37')]=_['keys'](_0x38995c[_0x7725('0x37')]);_0x442efa[_0x7725('0x39')]=_[_0x7725('0x3a')](_0x442efa[_0x7725('0x36')],_0x442efa[_0x7725('0x37')]);_0x1b452a[_0x7725('0x3c')]=_[_0x7725('0x3a')](_0x442efa[_0x7725('0x36')],qs[_0x7725('0x3b')](_0x38995c['query'][_0x7725('0x3b')]));_0x1b452a[_0x7725('0x3c')]=_0x1b452a['attributes'][_0x7725('0x3d')]?_0x1b452a[_0x7725('0x3c')]:_0x442efa[_0x7725('0x36')];_0x1b452a['order']=qs[_0x7725('0x41')](_0x38995c[_0x7725('0x37')][_0x7725('0x41')]);_0x1b452a['where']=qs['filters'](_[_0x7725('0x5d')](_0x38995c['query'],_0x442efa[_0x7725('0x39')]));if(_0x38995c[_0x7725('0x37')]['filter']){_0x1b452a['where']=_['merge'](_0x1b452a['where'],{'$or':_[_0x7725('0x33')](_0x1b452a['attributes'],function(_0x3bb133){var _0x327d4d={};_0x327d4d[_0x3bb133]={'$like':'%'+_0x38995c[_0x7725('0x37')][_0x7725('0x46')]+'%'};return _0x327d4d;})});}_0x1b452a=_[_0x7725('0x43')]({},_0x1b452a,_0x38995c['options']);return _0x17cafd['getAgents'](_0x1b452a);}})[_0x7725('0x2c')](function(_0x299d47){if(_0x299d47){_0x30cde3=_0x299d47['length'];if(!_0x38995c['query'][_0x7725('0x3e')](_0x7725('0x3f'))){_0x1b452a[_0x7725('0x27')]=qs['limit'](_0x38995c[_0x7725('0x37')][_0x7725('0x27')]);_0x1b452a['offset']=qs['offset'](_0x38995c[_0x7725('0x37')][_0x7725('0x26')]);}return _0x17cafd['getAgents'](_0x1b452a);}})[_0x7725('0x2c')](function(_0x1adb94){if(_0x1adb94){return _0x1adb94?{'count':_0x30cde3,'rows':_0x1adb94}:null;}})[_0x7725('0x2c')](respondWithResult(_0x36ae62,null))[_0x7725('0x4f')](handleError(_0x36ae62,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index de215c3..33ed03d 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 _0xd6df=['OpenchannelQueue','save','emit','hasOwnProperty','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6df,0x149));var _0xfd6d=function(_0x442839,_0x4b98d5){_0x442839=_0x442839-0x0;var _0x253a04=_0xd6df[_0x442839];return _0x253a04;};'use strict';var EventEmitter=require(_0xfd6d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xfd6d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd6d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45815d){return function(_0x2cf684,_0x3fcdb1,_0x4c4d38){OpenchannelQueueEvents[_0xfd6d('0x3')](_0x45815d+':'+_0x2cf684['id'],_0x2cf684);OpenchannelQueueEvents['emit'](_0x45815d,_0x2cf684);_0x4c4d38(null);};}for(var e in events){if(events[_0xfd6d('0x4')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x2edc=['../../mysqldb','OpenchannelQueue','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x3f561c,_0x17f491){var _0x2ed927=function(_0x17f43b){while(--_0x17f43b){_0x3f561c['push'](_0x3f561c['shift']());}};_0x2ed927(++_0x17f491);}(_0x2edc,0x187));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc2ed('0x0'));var OpenchannelQueue=require(_0xc2ed('0x1'))['db'][_0xc2ed('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc2ed('0x3'),'afterDestroy':_0xc2ed('0x4')};function emitEvent(_0x5c8525){return function(_0x459d46,_0x4b27f6,_0x43d2ba){OpenchannelQueueEvents[_0xc2ed('0x5')](_0x5c8525+':'+_0x459d46['id'],_0x459d46);OpenchannelQueueEvents[_0xc2ed('0x5')](_0x5c8525,_0x459d46);_0x43d2ba(null);};}for(var e in events){if(events[_0xc2ed('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xc2ed('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 91519e4..0e72945 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 _0x803e=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x34b1f8,_0x16d2eb){var _0x1cef5a=function(_0x2e2269){while(--_0x2e2269){_0x34b1f8['push'](_0x34b1f8['shift']());}};_0x1cef5a(++_0x16d2eb);}(_0x803e,0x155));var _0xe803=function(_0x2d3c60,_0x4df458){_0x2d3c60=_0x2d3c60-0x0;var _0x560041=_0x803e[_0x2d3c60];return _0x560041;};'use strict';var _=require(_0xe803('0x0'));var util=require(_0xe803('0x1'));var logger=require(_0xe803('0x2'))(_0xe803('0x3'));var moment=require('moment');var BPromise=require(_0xe803('0x4'));var rp=require(_0xe803('0x5'));var fs=require('fs');var path=require(_0xe803('0x6'));var rimraf=require('rimraf');var config=require(_0xe803('0x7'));var attributes=require(_0xe803('0x8'));module[_0xe803('0x9')]=function(_0x4bccbe,_0x1dc81d){return _0x4bccbe[_0xe803('0xa')](_0xe803('0xb'),attributes,{'tableName':_0xe803('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x424f=['openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x424f,0xc4));var _0xf424=function(_0x204fb2,_0x53dca6){_0x204fb2=_0x204fb2-0x0;var _0x5395fa=_0x424f[_0x204fb2];return _0x5395fa;};'use strict';var _=require(_0xf424('0x0'));var util=require(_0xf424('0x1'));var logger=require(_0xf424('0x2'))(_0xf424('0x3'));var moment=require(_0xf424('0x4'));var BPromise=require(_0xf424('0x5'));var rp=require(_0xf424('0x6'));var fs=require('fs');var path=require(_0xf424('0x7'));var rimraf=require('rimraf');var config=require(_0xf424('0x8'));var attributes=require(_0xf424('0x9'));module[_0xf424('0xa')]=function(_0x55bf99,_0x2e144a){return _0x55bf99['define'](_0xf424('0xb'),attributes,{'tableName':_0xf424('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index fc16cfc..84137b5 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 _0x2a4d=['OpenchannelQueue,\x20%s,\x20%s','message','request\x20sent','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','model','map','ShowOpenchannelQueue','find','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','redis','./openchannelQueue.socket','register','request','then','info','debug','stringify','error','code'];(function(_0x2f65ff,_0xe90c7c){var _0x521f16=function(_0xd5b128){while(--_0xd5b128){_0x2f65ff['push'](_0x2f65ff['shift']());}};_0x521f16(++_0xe90c7c);}(_0x2a4d,0x1a8));var _0xd2a4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2a4d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd2a4('0x0'));var util=require(_0xd2a4('0x1'));var moment=require(_0xd2a4('0x2'));var BPromise=require(_0xd2a4('0x3'));var rs=require(_0xd2a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd2a4('0x5'));var logger=require(_0xd2a4('0x6'))('rpc');var config=require(_0xd2a4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd2a4('0x8')][_0xd2a4('0x9')]({'port':0x232a});config[_0xd2a4('0xa')]=_['defaults'](config[_0xd2a4('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd2a4('0xb'))[_0xd2a4('0xc')](socket);function respondWithRpcPromise(_0x498aaa,_0x289643,_0x4298cc){return new BPromise(function(_0x17a08e,_0x101018){return client[_0xd2a4('0xd')](_0x498aaa,_0x4298cc)[_0xd2a4('0xe')](function(_0x4b0dda){logger[_0xd2a4('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x289643,'request\x20sent');logger[_0xd2a4('0x10')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x289643,'request\x20sent',JSON[_0xd2a4('0x11')](_0x4b0dda));if(_0x4b0dda[_0xd2a4('0x12')]){if(_0x4b0dda[_0xd2a4('0x12')][_0xd2a4('0x13')]===0x1f4){logger[_0xd2a4('0x12')](_0xd2a4('0x14'),_0x289643,_0x4b0dda['error'][_0xd2a4('0x15')]);return _0x101018(_0x4b0dda['error']['message']);}logger['error'](_0xd2a4('0x14'),_0x289643,_0x4b0dda[_0xd2a4('0x12')][_0xd2a4('0x15')]);return _0x17a08e(_0x4b0dda['error'][_0xd2a4('0x15')]);}else{logger[_0xd2a4('0xf')](_0xd2a4('0x14'),_0x289643,_0xd2a4('0x16'));_0x17a08e(_0x4b0dda[_0xd2a4('0x17')][_0xd2a4('0x15')]);}})['catch'](function(_0x32ad8c){logger[_0xd2a4('0x12')](_0xd2a4('0x14'),_0x289643,_0x32ad8c);_0x101018(_0x32ad8c);});});}exports[_0xd2a4('0x18')]=function(_0x4f4383){var _0x4b3aab=this;return new Promise(function(_0x588627,_0x164509){return db[_0xd2a4('0x19')][_0xd2a4('0x1a')]({'raw':_0x4f4383['options']?_0x4f4383[_0xd2a4('0x1b')][_0xd2a4('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f4383[_0xd2a4('0x1b')]?_0x4f4383[_0xd2a4('0x1b')]['where']||null:null,'attributes':_0x4f4383['options']?_0x4f4383[_0xd2a4('0x1b')][_0xd2a4('0x1d')]||null:null,'limit':_0x4f4383[_0xd2a4('0x1b')]?_0x4f4383[_0xd2a4('0x1b')][_0xd2a4('0x1e')]||null:null,'include':_0x4f4383[_0xd2a4('0x1b')]?_0x4f4383[_0xd2a4('0x1b')][_0xd2a4('0x1f')]?_['map'](_0x4f4383[_0xd2a4('0x1b')][_0xd2a4('0x1f')],function(_0x2527d0){return{'model':db[_0x2527d0[_0xd2a4('0x20')]],'as':_0x2527d0['as'],'attributes':_0x2527d0['attributes'],'include':_0x2527d0['include']?_[_0xd2a4('0x21')](_0x2527d0[_0xd2a4('0x1f')],function(_0x39d4f7){return{'model':db[_0x39d4f7[_0xd2a4('0x20')]],'as':_0x39d4f7['as'],'attributes':_0x39d4f7[_0xd2a4('0x1d')],'include':_0x39d4f7['include']?_['map'](_0x39d4f7[_0xd2a4('0x1f')],function(_0x414935){return{'model':db[_0x414935['model']],'as':_0x414935['as'],'attributes':_0x414935['attributes']};}):[]};}):[]};}):[]:[]})[_0xd2a4('0xe')](function(_0x5a2487){logger[_0xd2a4('0xf')](_0xd2a4('0x18'),_0x4f4383);logger[_0xd2a4('0x10')](_0xd2a4('0x18'),_0x4f4383,JSON[_0xd2a4('0x11')](_0x5a2487));_0x588627(_0x5a2487);})['catch'](function(_0xf71ef7){logger['error'](_0xd2a4('0x18'),_0xf71ef7[_0xd2a4('0x15')],_0x4f4383);_0x164509(_0x4b3aab[_0xd2a4('0x12')](0x1f4,_0xf71ef7[_0xd2a4('0x15')]));});});};exports[_0xd2a4('0x22')]=function(_0x2e5ac7){var _0xf59056=this;return new Promise(function(_0x11d9a2,_0x4ba73b){return db[_0xd2a4('0x19')][_0xd2a4('0x23')]({'raw':_0x2e5ac7['options']?_0x2e5ac7[_0xd2a4('0x1b')][_0xd2a4('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e5ac7[_0xd2a4('0x1b')]?_0x2e5ac7[_0xd2a4('0x1b')]['where']||null:null,'attributes':_0x2e5ac7[_0xd2a4('0x1b')]?_0x2e5ac7[_0xd2a4('0x1b')][_0xd2a4('0x1d')]||null:null,'include':_0x2e5ac7[_0xd2a4('0x1b')]?_0x2e5ac7[_0xd2a4('0x1b')]['include']?_[_0xd2a4('0x21')](_0x2e5ac7[_0xd2a4('0x1b')][_0xd2a4('0x1f')],function(_0x3b38aa){return{'model':db[_0x3b38aa['model']],'as':_0x3b38aa['as'],'attributes':_0x3b38aa['attributes'],'include':_0x3b38aa['include']?_[_0xd2a4('0x21')](_0x3b38aa[_0xd2a4('0x1f')],function(_0x53c1de){return{'model':db[_0x53c1de[_0xd2a4('0x20')]],'as':_0x53c1de['as'],'attributes':_0x53c1de[_0xd2a4('0x1d')],'include':_0x53c1de['include']?_[_0xd2a4('0x21')](_0x53c1de[_0xd2a4('0x1f')],function(_0x41ab88){return{'model':db[_0x41ab88[_0xd2a4('0x20')]],'as':_0x41ab88['as'],'attributes':_0x41ab88[_0xd2a4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eda0c){logger['info'](_0xd2a4('0x22'),_0x2e5ac7);logger[_0xd2a4('0x10')](_0xd2a4('0x22'),_0x2e5ac7,JSON[_0xd2a4('0x11')](_0x4eda0c));_0x11d9a2(_0x4eda0c);})[_0xd2a4('0x24')](function(_0x144a05){logger[_0xd2a4('0x12')](_0xd2a4('0x22'),_0x144a05[_0xd2a4('0x15')],_0x2e5ac7);_0x4ba73b(_0xf59056[_0xd2a4('0x12')](0x1f4,_0x144a05[_0xd2a4('0x15')]));});});}; \ No newline at end of file +var _0x54e7=['message','result','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','catch','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x49d34a,_0x1dafc0){var _0x164371=function(_0x4bc78a){while(--_0x4bc78a){_0x49d34a['push'](_0x49d34a['shift']());}};_0x164371(++_0x1dafc0);}(_0x54e7,0xe7));var _0x754e=function(_0x1accad,_0x5b7856){_0x1accad=_0x1accad-0x0;var _0x8f2553=_0x54e7[_0x1accad];return _0x8f2553;};'use strict';var _=require(_0x754e('0x0'));var util=require(_0x754e('0x1'));var moment=require(_0x754e('0x2'));var BPromise=require(_0x754e('0x3'));var rs=require(_0x754e('0x4'));var fs=require('fs');var Redis=require(_0x754e('0x5'));var db=require(_0x754e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x754e('0x7'))(_0x754e('0x8'));var config=require('../../config/environment');var jayson=require(_0x754e('0x9'));var client=jayson[_0x754e('0xa')][_0x754e('0xb')]({'port':0x232a});config[_0x754e('0xc')]=_[_0x754e('0xd')](config[_0x754e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x754e('0xe'))(new Redis(config[_0x754e('0xc')]));require(_0x754e('0xf'))[_0x754e('0x10')](socket);function respondWithRpcPromise(_0x3279ff,_0x2d33de,_0x175556){return new BPromise(function(_0x5b4d87,_0x2eaae8){return client[_0x754e('0x11')](_0x3279ff,_0x175556)[_0x754e('0x12')](function(_0x579f5a){logger[_0x754e('0x13')](_0x754e('0x14'),_0x2d33de,_0x754e('0x15'));logger[_0x754e('0x16')](_0x754e('0x17'),_0x2d33de,'request\x20sent',JSON[_0x754e('0x18')](_0x579f5a));if(_0x579f5a[_0x754e('0x19')]){if(_0x579f5a[_0x754e('0x19')][_0x754e('0x1a')]===0x1f4){logger[_0x754e('0x19')](_0x754e('0x14'),_0x2d33de,_0x579f5a[_0x754e('0x19')][_0x754e('0x1b')]);return _0x2eaae8(_0x579f5a['error'][_0x754e('0x1b')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2d33de,_0x579f5a['error']['message']);return _0x5b4d87(_0x579f5a[_0x754e('0x19')]['message']);}else{logger['info'](_0x754e('0x14'),_0x2d33de,'request\x20sent');_0x5b4d87(_0x579f5a[_0x754e('0x1c')][_0x754e('0x1b')]);}})['catch'](function(_0x4286ec){logger[_0x754e('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x2d33de,_0x4286ec);_0x2eaae8(_0x4286ec);});});}exports['GetOpenchannelQueue']=function(_0x1c0069){var _0x2ed3ad=this;return new Promise(function(_0x328381,_0x467925){return db[_0x754e('0x1d')][_0x754e('0x1e')]({'raw':_0x1c0069[_0x754e('0x1f')]?_0x1c0069[_0x754e('0x1f')][_0x754e('0x20')]===undefined?!![]:![]:!![],'where':_0x1c0069[_0x754e('0x1f')]?_0x1c0069[_0x754e('0x1f')][_0x754e('0x21')]||null:null,'attributes':_0x1c0069[_0x754e('0x1f')]?_0x1c0069[_0x754e('0x1f')][_0x754e('0x22')]||null:null,'limit':_0x1c0069[_0x754e('0x1f')]?_0x1c0069[_0x754e('0x1f')][_0x754e('0x23')]||null:null,'include':_0x1c0069[_0x754e('0x1f')]?_0x1c0069[_0x754e('0x1f')][_0x754e('0x24')]?_[_0x754e('0x25')](_0x1c0069['options'][_0x754e('0x24')],function(_0x179af7){return{'model':db[_0x179af7[_0x754e('0x26')]],'as':_0x179af7['as'],'attributes':_0x179af7[_0x754e('0x22')],'include':_0x179af7[_0x754e('0x24')]?_[_0x754e('0x25')](_0x179af7[_0x754e('0x24')],function(_0x1e3a14){return{'model':db[_0x1e3a14['model']],'as':_0x1e3a14['as'],'attributes':_0x1e3a14[_0x754e('0x22')],'include':_0x1e3a14['include']?_[_0x754e('0x25')](_0x1e3a14[_0x754e('0x24')],function(_0x58104a){return{'model':db[_0x58104a[_0x754e('0x26')]],'as':_0x58104a['as'],'attributes':_0x58104a[_0x754e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x754e('0x12')](function(_0x3ccea3){logger[_0x754e('0x13')](_0x754e('0x27'),_0x1c0069);logger[_0x754e('0x16')](_0x754e('0x27'),_0x1c0069,JSON[_0x754e('0x18')](_0x3ccea3));_0x328381(_0x3ccea3);})[_0x754e('0x28')](function(_0x1089c6){logger[_0x754e('0x19')]('GetOpenchannelQueue',_0x1089c6[_0x754e('0x1b')],_0x1c0069);_0x467925(_0x2ed3ad[_0x754e('0x19')](0x1f4,_0x1089c6[_0x754e('0x1b')]));});});};exports['ShowOpenchannelQueue']=function(_0x5ad6f5){var _0xa97354=this;return new Promise(function(_0x58aeab,_0x167499){return db[_0x754e('0x1d')][_0x754e('0x29')]({'raw':_0x5ad6f5[_0x754e('0x1f')]?_0x5ad6f5['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ad6f5['options']?_0x5ad6f5[_0x754e('0x1f')][_0x754e('0x21')]||null:null,'attributes':_0x5ad6f5['options']?_0x5ad6f5[_0x754e('0x1f')][_0x754e('0x22')]||null:null,'include':_0x5ad6f5[_0x754e('0x1f')]?_0x5ad6f5[_0x754e('0x1f')][_0x754e('0x24')]?_[_0x754e('0x25')](_0x5ad6f5[_0x754e('0x1f')][_0x754e('0x24')],function(_0x5ac3e6){return{'model':db[_0x5ac3e6[_0x754e('0x26')]],'as':_0x5ac3e6['as'],'attributes':_0x5ac3e6[_0x754e('0x22')],'include':_0x5ac3e6[_0x754e('0x24')]?_[_0x754e('0x25')](_0x5ac3e6[_0x754e('0x24')],function(_0x5e310a){return{'model':db[_0x5e310a['model']],'as':_0x5e310a['as'],'attributes':_0x5e310a[_0x754e('0x22')],'include':_0x5e310a[_0x754e('0x24')]?_['map'](_0x5e310a[_0x754e('0x24')],function(_0x12eb70){return{'model':db[_0x12eb70[_0x754e('0x26')]],'as':_0x12eb70['as'],'attributes':_0x12eb70[_0x754e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x754e('0x12')](function(_0x4d59d1){logger[_0x754e('0x13')]('ShowOpenchannelQueue',_0x5ad6f5);logger['debug'](_0x754e('0x2a'),_0x5ad6f5,JSON[_0x754e('0x18')](_0x4d59d1));_0x58aeab(_0x4d59d1);})[_0x754e('0x28')](function(_0x9ca734){logger[_0x754e('0x19')](_0x754e('0x2a'),_0x9ca734[_0x754e('0x1b')],_0x5ad6f5);_0x167499(_0xa97354[_0x754e('0x19')](0x1f4,_0x9ca734[_0x754e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3ed29e4..0987128 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 _0x9136=['openchannelQueue:','./openchannelQueue.events','save','remove','update','removeListener','register'];(function(_0x5e533c,_0x18d8ad){var _0x36f4f5=function(_0x311d98){while(--_0x311d98){_0x5e533c['push'](_0x5e533c['shift']());}};_0x36f4f5(++_0x18d8ad);}(_0x9136,0xe8));var _0x6913=function(_0x3e4376,_0x29296c){_0x3e4376=_0x3e4376-0x0;var _0x5cd02e=_0x9136[_0x3e4376];return _0x5cd02e;};'use strict';var OpenchannelQueueEvents=require(_0x6913('0x0'));var events=[_0x6913('0x1'),_0x6913('0x2'),_0x6913('0x3')];function createListener(_0x37534d,_0x3e5d6a){return function(_0x3aec88){_0x3e5d6a['emit'](_0x37534d,_0x3aec88);};}function removeListener(_0x3d01e4,_0x1791f0){return function(){OpenchannelQueueEvents[_0x6913('0x4')](_0x3d01e4,_0x1791f0);};}exports[_0x6913('0x5')]=function(_0x231bdd){for(var _0x45b20a=0x0,_0x536517=events['length'];_0x45b20a<_0x536517;_0x45b20a++){var _0x4ac03a=events[_0x45b20a];var _0x28da07=createListener(_0x6913('0x6')+_0x4ac03a,_0x231bdd);OpenchannelQueueEvents['on'](_0x4ac03a,_0x28da07);}}; \ No newline at end of file +var _0xe354=['openchannelQueue:','remove','update','emit','removeListener','register'];(function(_0x333678,_0x4c0d03){var _0x45079a=function(_0x2dfa66){while(--_0x2dfa66){_0x333678['push'](_0x333678['shift']());}};_0x45079a(++_0x4c0d03);}(_0xe354,0x187));var _0x4e35=function(_0xe4e730,_0x26085f){_0xe4e730=_0xe4e730-0x0;var _0x1dc5d0=_0xe354[_0xe4e730];return _0x1dc5d0;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x4e35('0x0'),_0x4e35('0x1')];function createListener(_0x4bae07,_0x369f8e){return function(_0x4a7d19){_0x369f8e[_0x4e35('0x2')](_0x4bae07,_0x4a7d19);};}function removeListener(_0x13573a,_0x178fd0){return function(){OpenchannelQueueEvents[_0x4e35('0x3')](_0x13573a,_0x178fd0);};}exports[_0x4e35('0x4')]=function(_0x985806){for(var _0x2429b3=0x0,_0x7ef7c1=events['length'];_0x2429b3<_0x7ef7c1;_0x2429b3++){var _0x3d8ef0=events[_0x2429b3];var _0x25c66c=createListener(_0x4e35('0x5')+_0x3d8ef0,_0x985806);OpenchannelQueueEvents['on'](_0x3d8ef0,_0x25c66c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8aee810..3c4d2d3 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 _0x1587=['isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','index','get','/describe'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x1587,0x145));var _0x7158=function(_0x5408c7,_0x2de489){_0x5408c7=_0x5408c7-0x0;var _0x20f269=_0x1587[_0x5408c7];return _0x20f269;};'use strict';var multer=require(_0x7158('0x0'));var util=require(_0x7158('0x1'));var path=require('path');var timeout=require(_0x7158('0x2'));var express=require(_0x7158('0x3'));var router=express['Router']();var fs_extra=require(_0x7158('0x4'));var auth=require(_0x7158('0x5'));var interaction=require(_0x7158('0x6'));var config=require('../../config/environment');var controller=require(_0x7158('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7158('0x8')]);router[_0x7158('0x9')](_0x7158('0xa'),auth[_0x7158('0xb')](),controller[_0x7158('0xc')]);router[_0x7158('0x9')](_0x7158('0xd'),auth[_0x7158('0xb')](),controller[_0x7158('0xe')]);router[_0x7158('0xf')]('/',auth[_0x7158('0xb')](),controller[_0x7158('0x10')]);router[_0x7158('0x11')](_0x7158('0xd'),auth[_0x7158('0xb')](),controller['update']);router[_0x7158('0x12')]('/:id',auth[_0x7158('0xb')](),controller[_0x7158('0x13')]);module[_0x7158('0x14')]=router; \ No newline at end of file +var _0xcf19=['put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./openchannelQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcf19,0xa4));var _0x9cf1=function(_0x5e0914,_0x481afe){_0x5e0914=_0x5e0914-0x0;var _0x5eebff=_0xcf19[_0x5e0914];return _0x5eebff;};'use strict';var multer=require(_0x9cf1('0x0'));var util=require('util');var path=require(_0x9cf1('0x1'));var timeout=require(_0x9cf1('0x2'));var express=require('express');var router=express[_0x9cf1('0x3')]();var fs_extra=require(_0x9cf1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9cf1('0x5'));var controller=require(_0x9cf1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9cf1('0x7')]);router[_0x9cf1('0x8')](_0x9cf1('0x9'),auth[_0x9cf1('0xa')](),controller[_0x9cf1('0xb')]);router['get'](_0x9cf1('0xc'),auth['isAuthenticated'](),controller[_0x9cf1('0xd')]);router[_0x9cf1('0xe')]('/',auth[_0x9cf1('0xa')](),controller[_0x9cf1('0xf')]);router[_0x9cf1('0x10')](_0x9cf1('0xc'),auth[_0x9cf1('0xa')](),controller[_0x9cf1('0x11')]);router['delete'](_0x9cf1('0xc'),auth[_0x9cf1('0xa')](),controller[_0x9cf1('0x12')]);module[_0x9cf1('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 297a971..6036086 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 _0x5204=['sequelize','STRING','DATE'];(function(_0x4608a3,_0x431f16){var _0x3db42c=function(_0x2a3822){while(--_0x2a3822){_0x4608a3['push'](_0x4608a3['shift']());}};_0x3db42c(++_0x431f16);}(_0x5204,0x192));var _0x4520=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x5204[_0x2a3c4d];return _0x55c390;};'use strict';var moment=require('moment');var Sequelize=require(_0x4520('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4520('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4520('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4520('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4520('0x2')]},'reason':{'type':Sequelize[_0x4520('0x1')]}}; \ No newline at end of file +var _0x7a1a=['sequelize','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a1a,0x13e));var _0xa7a1=function(_0x22c37e,_0x1a011c){_0x22c37e=_0x22c37e-0x0;var _0x3897f5=_0x7a1a[_0x22c37e];return _0x3897f5;};'use strict';var moment=require('moment');var Sequelize=require(_0xa7a1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa7a1('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xa7a1('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa7a1('0x2')]},'acceptAt':{'type':Sequelize[_0xa7a1('0x2')]},'exitAt':{'type':Sequelize[_0xa7a1('0x2')]},'reason':{'type':Sequelize[_0xa7a1('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 16c7a75..10bacfa 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 _0x5093=['stack','name','index','map','OpenchannelQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','then','show','rawAttributes','merge','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','error'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x5093,0x147));var _0x3509=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x5093[_0xcfd89f];return _0x59acd4;};'use strict';var emlformat=require(_0x3509('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3509('0x1'));var jsonpatch=require(_0x3509('0x2'));var rp=require(_0x3509('0x3'));var moment=require('moment');var BPromise=require(_0x3509('0x4'));var Mustache=require(_0x3509('0x5'));var util=require('util');var path=require(_0x3509('0x6'));var sox=require(_0x3509('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3509('0x8'));var _=require('lodash');var squel=require(_0x3509('0x9'));var crypto=require(_0x3509('0xa'));var jsforce=require(_0x3509('0xb'));var deskjs=require(_0x3509('0xc'));var toCsv=require(_0x3509('0xd'));var querystring=require(_0x3509('0xe'));var Papa=require(_0x3509('0xf'));var Redis=require(_0x3509('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3509('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3509('0x12'))(_0x3509('0x13'));var utils=require(_0x3509('0x14'));var config=require(_0x3509('0x15'));var licenseUtil=require(_0x3509('0x16'));var db=require(_0x3509('0x17'))['db'];function respondWithStatusCode(_0xaeec93,_0x6a842f){_0x6a842f=_0x6a842f||0xcc;return function(_0xc54fba){if(_0xc54fba){return _0xaeec93[_0x3509('0x18')](_0x6a842f);}return _0xaeec93[_0x3509('0x19')](_0x6a842f)[_0x3509('0x1a')]();};}function respondWithResult(_0x1483b2,_0x506a63){_0x506a63=_0x506a63||0xc8;return function(_0x5c7d4c){if(_0x5c7d4c){return _0x1483b2[_0x3509('0x19')](_0x506a63)[_0x3509('0x1b')](_0x5c7d4c);}};}function respondWithFilteredResult(_0x4eb538,_0x4e782a){return function(_0x335ab5){if(_0x335ab5){var _0x480662=typeof _0x4e782a[_0x3509('0x1c')]===_0x3509('0x1d')&&typeof _0x4e782a[_0x3509('0x1e')]==='undefined';var _0x56d326=_0x335ab5['count'];var _0x1f1f74=_0x480662?0x0:_0x4e782a['offset'];var _0x4fa6a3=_0x480662?_0x335ab5[_0x3509('0x1f')]:_0x4e782a[_0x3509('0x1c')]+_0x4e782a[_0x3509('0x1e')];var _0x216033;if(_0x4fa6a3>=_0x56d326){_0x4fa6a3=_0x56d326;_0x216033=0xc8;}else{_0x216033=0xce;}_0x4eb538[_0x3509('0x19')](_0x216033);return _0x4eb538[_0x3509('0x20')](_0x3509('0x21'),_0x1f1f74+'-'+_0x4fa6a3+'/'+_0x56d326)['json'](_0x335ab5);}return null;};}function patchUpdates(_0x2273d1){return function(_0x5b6907){try{jsonpatch[_0x3509('0x22')](_0x5b6907,_0x2273d1,!![]);}catch(_0x52361c){return BPromise['reject'](_0x52361c);}return _0x5b6907['save']();};}function saveUpdates(_0x20e429,_0x456080){return function(_0xb94dbe){if(_0xb94dbe){return _0xb94dbe[_0x3509('0x23')](_0x20e429)['then'](function(_0x28d1d4){return _0x28d1d4;});}return null;};}function removeEntity(_0x39d942,_0xab5e26){return function(_0x45226f){if(_0x45226f){return _0x45226f[_0x3509('0x24')]()['then'](function(){_0x39d942[_0x3509('0x19')](0xcc)[_0x3509('0x1a')]();});}};}function handleEntityNotFound(_0xe29fe,_0x248753){return function(_0x122637){if(!_0x122637){_0xe29fe['sendStatus'](0x194);}return _0x122637;};}function handleError(_0x386809,_0x3c5670){_0x3c5670=_0x3c5670||0x1f4;return function(_0x49242b){logger[_0x3509('0x25')](_0x49242b[_0x3509('0x26')]);if(_0x49242b[_0x3509('0x27')]){delete _0x49242b['name'];}_0x386809['status'](_0x3c5670)['send'](_0x49242b);};}exports[_0x3509('0x28')]=function(_0x46813c,_0x1b6b79){var _0x24235e={},_0x391516={},_0x2e06f6={'count':0x0,'rows':[]};var _0x263cf5=_[_0x3509('0x29')](db[_0x3509('0x2a')]['rawAttributes'],function(_0x3bbb18){return{'name':_0x3bbb18['fieldName'],'type':_0x3bbb18[_0x3509('0x2b')][_0x3509('0x2c')]};});_0x391516[_0x3509('0x2d')]=_['map'](_0x263cf5,'name');_0x391516[_0x3509('0x2e')]=_[_0x3509('0x2f')](_0x46813c[_0x3509('0x2e')]);_0x391516[_0x3509('0x30')]=_[_0x3509('0x31')](_0x391516[_0x3509('0x2d')],_0x391516['query']);_0x24235e[_0x3509('0x32')]=_['intersection'](_0x391516[_0x3509('0x2d')],qs[_0x3509('0x33')](_0x46813c[_0x3509('0x2e')][_0x3509('0x33')]));_0x24235e[_0x3509('0x32')]=_0x24235e[_0x3509('0x32')]['length']?_0x24235e['attributes']:_0x391516['model'];if(!_0x46813c[_0x3509('0x2e')]['hasOwnProperty'](_0x3509('0x34'))){_0x24235e['limit']=qs[_0x3509('0x1e')](_0x46813c[_0x3509('0x2e')][_0x3509('0x1e')]);_0x24235e[_0x3509('0x1c')]=qs['offset'](_0x46813c[_0x3509('0x2e')][_0x3509('0x1c')]);}_0x24235e[_0x3509('0x35')]=qs['sort'](_0x46813c[_0x3509('0x2e')][_0x3509('0x36')]);_0x24235e[_0x3509('0x37')]=qs[_0x3509('0x30')](_[_0x3509('0x38')](_0x46813c['query'],_0x391516['filters']),_0x263cf5);if(_0x46813c[_0x3509('0x2e')][_0x3509('0x39')]){_0x24235e[_0x3509('0x37')]=_['merge'](_0x24235e[_0x3509('0x37')],{'$or':_['map'](_0x263cf5,function(_0x4dd683){if(_0x4dd683[_0x3509('0x2b')]!==_0x3509('0x3a')){var _0x3bc3a5={};_0x3bc3a5[_0x4dd683['name']]={'$like':'%'+_0x46813c[_0x3509('0x2e')][_0x3509('0x39')]+'%'};return _0x3bc3a5;}})});}_0x24235e=_['merge']({},_0x24235e,_0x46813c[_0x3509('0x3b')]);var _0x307d35={'where':_0x24235e[_0x3509('0x37')]};return db['OpenchannelQueueReport'][_0x3509('0x1f')](_0x307d35)['then'](function(_0x345d06){_0x2e06f6[_0x3509('0x1f')]=_0x345d06;if(_0x46813c[_0x3509('0x2e')][_0x3509('0x3c')]){_0x24235e[_0x3509('0x3d')]=[{'all':!![]}];}return db[_0x3509('0x2a')][_0x3509('0x3e')](_0x24235e);})[_0x3509('0x3f')](function(_0x2c17c4){_0x2e06f6['rows']=_0x2c17c4;return _0x2e06f6;})[_0x3509('0x3f')](respondWithFilteredResult(_0x1b6b79,_0x24235e))['catch'](handleError(_0x1b6b79,null));};exports[_0x3509('0x40')]=function(_0x2c9d64,_0x6c0bec){var _0x21dd96={'raw':!![],'where':{'id':_0x2c9d64['params']['id']}},_0x12f647={};_0x12f647['model']=_[_0x3509('0x2f')](db[_0x3509('0x2a')][_0x3509('0x41')]);_0x12f647[_0x3509('0x2e')]=_[_0x3509('0x2f')](_0x2c9d64[_0x3509('0x2e')]);_0x12f647[_0x3509('0x30')]=_['intersection'](_0x12f647[_0x3509('0x2d')],_0x12f647[_0x3509('0x2e')]);_0x21dd96[_0x3509('0x32')]=_['intersection'](_0x12f647['model'],qs[_0x3509('0x33')](_0x2c9d64[_0x3509('0x2e')][_0x3509('0x33')]));_0x21dd96[_0x3509('0x32')]=_0x21dd96[_0x3509('0x32')]['length']?_0x21dd96['attributes']:_0x12f647['model'];if(_0x2c9d64[_0x3509('0x2e')][_0x3509('0x3c')]){_0x21dd96['include']=[{'all':!![]}];}_0x21dd96=_[_0x3509('0x42')]({},_0x21dd96,_0x2c9d64[_0x3509('0x3b')]);return db[_0x3509('0x2a')][_0x3509('0x43')](_0x21dd96)['then'](handleEntityNotFound(_0x6c0bec,null))[_0x3509('0x3f')](respondWithResult(_0x6c0bec,null))[_0x3509('0x44')](handleError(_0x6c0bec,null));};exports[_0x3509('0x45')]=function(_0x48d213,_0x4ef604){return db[_0x3509('0x2a')][_0x3509('0x45')](_0x48d213[_0x3509('0x46')],{})[_0x3509('0x3f')](respondWithResult(_0x4ef604,0xc9))[_0x3509('0x44')](handleError(_0x4ef604,null));};exports[_0x3509('0x23')]=function(_0x482cc3,_0x31dc5f){if(_0x482cc3['body']['id']){delete _0x482cc3[_0x3509('0x46')]['id'];}return db[_0x3509('0x2a')][_0x3509('0x43')]({'where':{'id':_0x482cc3[_0x3509('0x47')]['id']}})['then'](handleEntityNotFound(_0x31dc5f,null))[_0x3509('0x3f')](saveUpdates(_0x482cc3['body'],null))[_0x3509('0x3f')](respondWithResult(_0x31dc5f,null))[_0x3509('0x44')](handleError(_0x31dc5f,null));};exports[_0x3509('0x24')]=function(_0xc44f17,_0x54fc37){return db['OpenchannelQueueReport'][_0x3509('0x43')]({'where':{'id':_0xc44f17['params']['id']}})['then'](handleEntityNotFound(_0x54fc37,null))[_0x3509('0x3f')](removeEntity(_0x54fc37,null))[_0x3509('0x44')](handleError(_0x54fc37,null));};exports['describe']=function(_0x54bcf0,_0x5d16f7){return db[_0x3509('0x2a')][_0x3509('0x48')]()[_0x3509('0x3f')](respondWithResult(_0x5d16f7,null))['catch'](handleError(_0x5d16f7,null));}; \ No newline at end of file +var _0x8d4b=['type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','rimraf','request-promise','bluebird','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','sendStatus','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes'];(function(_0x5e0c4a,_0x186464){var _0x2600d1=function(_0x379716){while(--_0x379716){_0x5e0c4a['push'](_0x5e0c4a['shift']());}};_0x2600d1(++_0x186464);}(_0x8d4b,0xeb));var _0xb8d4=function(_0x6db320,_0x21d4f3){_0x6db320=_0x6db320-0x0;var _0x2a55ab=_0x8d4b[_0x6db320];return _0x2a55ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8d4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb8d4('0x1'));var moment=require('moment');var BPromise=require(_0xb8d4('0x2'));var Mustache=require('mustache');var util=require(_0xb8d4('0x3'));var path=require('path');var sox=require(_0xb8d4('0x4'));var csv=require('to-csv');var ejs=require(_0xb8d4('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8d4('0x6'));var squel=require('squel');var crypto=require(_0xb8d4('0x7'));var jsforce=require(_0xb8d4('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xb8d4('0x9'));var querystring=require(_0xb8d4('0xa'));var Papa=require(_0xb8d4('0xb'));var Redis=require(_0xb8d4('0xc'));var authService=require(_0xb8d4('0xd'));var qs=require(_0xb8d4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8d4('0xf'));var logger=require(_0xb8d4('0x10'))(_0xb8d4('0x11'));var utils=require(_0xb8d4('0x12'));var config=require(_0xb8d4('0x13'));var licenseUtil=require(_0xb8d4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a3671,_0x17f4f7){_0x17f4f7=_0x17f4f7||0xcc;return function(_0x851b5f){if(_0x851b5f){return _0x1a3671['sendStatus'](_0x17f4f7);}return _0x1a3671[_0xb8d4('0x15')](_0x17f4f7)[_0xb8d4('0x16')]();};}function respondWithResult(_0x5c619a,_0x46c315){_0x46c315=_0x46c315||0xc8;return function(_0x3b59cc){if(_0x3b59cc){return _0x5c619a['status'](_0x46c315)[_0xb8d4('0x17')](_0x3b59cc);}};}function respondWithFilteredResult(_0x4467c9,_0x461cc2){return function(_0x43e62f){if(_0x43e62f){var _0xb92840=typeof _0x461cc2[_0xb8d4('0x18')]===_0xb8d4('0x19')&&typeof _0x461cc2[_0xb8d4('0x1a')]===_0xb8d4('0x19');var _0x4f7d63=_0x43e62f[_0xb8d4('0x1b')];var _0x2d93f3=_0xb92840?0x0:_0x461cc2[_0xb8d4('0x18')];var _0x364cf7=_0xb92840?_0x43e62f[_0xb8d4('0x1b')]:_0x461cc2[_0xb8d4('0x18')]+_0x461cc2[_0xb8d4('0x1a')];var _0x2eb90e;if(_0x364cf7>=_0x4f7d63){_0x364cf7=_0x4f7d63;_0x2eb90e=0xc8;}else{_0x2eb90e=0xce;}_0x4467c9[_0xb8d4('0x15')](_0x2eb90e);return _0x4467c9['set'](_0xb8d4('0x1c'),_0x2d93f3+'-'+_0x364cf7+'/'+_0x4f7d63)[_0xb8d4('0x17')](_0x43e62f);}return null;};}function patchUpdates(_0x388ea3){return function(_0x4999b9){try{jsonpatch['apply'](_0x4999b9,_0x388ea3,!![]);}catch(_0xaace31){return BPromise[_0xb8d4('0x1d')](_0xaace31);}return _0x4999b9['save']();};}function saveUpdates(_0x16d0fd,_0x1181f9){return function(_0x23a215){if(_0x23a215){return _0x23a215[_0xb8d4('0x1e')](_0x16d0fd)[_0xb8d4('0x1f')](function(_0x574197){return _0x574197;});}return null;};}function removeEntity(_0x40843e,_0xcf8a7f){return function(_0x5cf890){if(_0x5cf890){return _0x5cf890[_0xb8d4('0x20')]()['then'](function(){_0x40843e[_0xb8d4('0x15')](0xcc)[_0xb8d4('0x16')]();});}};}function handleEntityNotFound(_0x52f7bf,_0x25a2eb){return function(_0x595d2e){if(!_0x595d2e){_0x52f7bf[_0xb8d4('0x21')](0x194);}return _0x595d2e;};}function handleError(_0x54d50a,_0x7785c5){_0x7785c5=_0x7785c5||0x1f4;return function(_0x2eb845){logger['error'](_0x2eb845[_0xb8d4('0x22')]);if(_0x2eb845[_0xb8d4('0x23')]){delete _0x2eb845[_0xb8d4('0x23')];}_0x54d50a[_0xb8d4('0x15')](_0x7785c5)[_0xb8d4('0x24')](_0x2eb845);};}exports[_0xb8d4('0x25')]=function(_0x17b62a,_0x4cd27f){var _0x532425={},_0xfad5d5={},_0x1617f8={'count':0x0,'rows':[]};var _0x5564ff=_[_0xb8d4('0x26')](db[_0xb8d4('0x27')][_0xb8d4('0x28')],function(_0x27c872){return{'name':_0x27c872['fieldName'],'type':_0x27c872[_0xb8d4('0x29')]['key']};});_0xfad5d5[_0xb8d4('0x2a')]=_['map'](_0x5564ff,_0xb8d4('0x23'));_0xfad5d5['query']=_[_0xb8d4('0x2b')](_0x17b62a[_0xb8d4('0x2c')]);_0xfad5d5[_0xb8d4('0x2d')]=_[_0xb8d4('0x2e')](_0xfad5d5[_0xb8d4('0x2a')],_0xfad5d5[_0xb8d4('0x2c')]);_0x532425[_0xb8d4('0x2f')]=_[_0xb8d4('0x2e')](_0xfad5d5[_0xb8d4('0x2a')],qs['fields'](_0x17b62a['query'][_0xb8d4('0x30')]));_0x532425[_0xb8d4('0x2f')]=_0x532425[_0xb8d4('0x2f')][_0xb8d4('0x31')]?_0x532425[_0xb8d4('0x2f')]:_0xfad5d5[_0xb8d4('0x2a')];if(!_0x17b62a['query'][_0xb8d4('0x32')](_0xb8d4('0x33'))){_0x532425['limit']=qs[_0xb8d4('0x1a')](_0x17b62a[_0xb8d4('0x2c')][_0xb8d4('0x1a')]);_0x532425['offset']=qs[_0xb8d4('0x18')](_0x17b62a['query'][_0xb8d4('0x18')]);}_0x532425['order']=qs[_0xb8d4('0x34')](_0x17b62a[_0xb8d4('0x2c')]['sort']);_0x532425[_0xb8d4('0x35')]=qs['filters'](_[_0xb8d4('0x36')](_0x17b62a[_0xb8d4('0x2c')],_0xfad5d5[_0xb8d4('0x2d')]),_0x5564ff);if(_0x17b62a[_0xb8d4('0x2c')]['filter']){_0x532425['where']=_['merge'](_0x532425['where'],{'$or':_['map'](_0x5564ff,function(_0x2d2977){if(_0x2d2977[_0xb8d4('0x29')]!==_0xb8d4('0x37')){var _0x48f2e3={};_0x48f2e3[_0x2d2977[_0xb8d4('0x23')]]={'$like':'%'+_0x17b62a['query'][_0xb8d4('0x38')]+'%'};return _0x48f2e3;}})});}_0x532425=_[_0xb8d4('0x39')]({},_0x532425,_0x17b62a[_0xb8d4('0x3a')]);var _0xf36e5={'where':_0x532425[_0xb8d4('0x35')]};return db[_0xb8d4('0x27')][_0xb8d4('0x1b')](_0xf36e5)['then'](function(_0x33fbed){_0x1617f8[_0xb8d4('0x1b')]=_0x33fbed;if(_0x17b62a['query'][_0xb8d4('0x3b')]){_0x532425[_0xb8d4('0x3c')]=[{'all':!![]}];}return db[_0xb8d4('0x27')][_0xb8d4('0x3d')](_0x532425);})[_0xb8d4('0x1f')](function(_0x57aa95){_0x1617f8['rows']=_0x57aa95;return _0x1617f8;})['then'](respondWithFilteredResult(_0x4cd27f,_0x532425))[_0xb8d4('0x3e')](handleError(_0x4cd27f,null));};exports[_0xb8d4('0x3f')]=function(_0x1ffb56,_0x3dd234){var _0x2b03ce={'raw':!![],'where':{'id':_0x1ffb56[_0xb8d4('0x40')]['id']}},_0x94b9ab={};_0x94b9ab[_0xb8d4('0x2a')]=_[_0xb8d4('0x2b')](db[_0xb8d4('0x27')][_0xb8d4('0x28')]);_0x94b9ab[_0xb8d4('0x2c')]=_[_0xb8d4('0x2b')](_0x1ffb56[_0xb8d4('0x2c')]);_0x94b9ab['filters']=_[_0xb8d4('0x2e')](_0x94b9ab[_0xb8d4('0x2a')],_0x94b9ab[_0xb8d4('0x2c')]);_0x2b03ce[_0xb8d4('0x2f')]=_[_0xb8d4('0x2e')](_0x94b9ab[_0xb8d4('0x2a')],qs['fields'](_0x1ffb56[_0xb8d4('0x2c')][_0xb8d4('0x30')]));_0x2b03ce['attributes']=_0x2b03ce[_0xb8d4('0x2f')][_0xb8d4('0x31')]?_0x2b03ce['attributes']:_0x94b9ab['model'];if(_0x1ffb56[_0xb8d4('0x2c')]['includeAll']){_0x2b03ce['include']=[{'all':!![]}];}_0x2b03ce=_[_0xb8d4('0x39')]({},_0x2b03ce,_0x1ffb56[_0xb8d4('0x3a')]);return db[_0xb8d4('0x27')]['find'](_0x2b03ce)[_0xb8d4('0x1f')](handleEntityNotFound(_0x3dd234,null))[_0xb8d4('0x1f')](respondWithResult(_0x3dd234,null))[_0xb8d4('0x3e')](handleError(_0x3dd234,null));};exports[_0xb8d4('0x41')]=function(_0x5e51ce,_0x2cc14c){return db[_0xb8d4('0x27')]['create'](_0x5e51ce['body'],{})[_0xb8d4('0x1f')](respondWithResult(_0x2cc14c,0xc9))[_0xb8d4('0x3e')](handleError(_0x2cc14c,null));};exports[_0xb8d4('0x1e')]=function(_0x4fcc9a,_0x12d2c5){if(_0x4fcc9a[_0xb8d4('0x42')]['id']){delete _0x4fcc9a[_0xb8d4('0x42')]['id'];}return db[_0xb8d4('0x27')]['find']({'where':{'id':_0x4fcc9a[_0xb8d4('0x40')]['id']}})['then'](handleEntityNotFound(_0x12d2c5,null))[_0xb8d4('0x1f')](saveUpdates(_0x4fcc9a[_0xb8d4('0x42')],null))[_0xb8d4('0x1f')](respondWithResult(_0x12d2c5,null))[_0xb8d4('0x3e')](handleError(_0x12d2c5,null));};exports['destroy']=function(_0x2e3f27,_0x38023f){return db[_0xb8d4('0x27')][_0xb8d4('0x43')]({'where':{'id':_0x2e3f27[_0xb8d4('0x40')]['id']}})['then'](handleEntityNotFound(_0x38023f,null))[_0xb8d4('0x1f')](removeEntity(_0x38023f,null))[_0xb8d4('0x3e')](handleError(_0x38023f,null));};exports[_0xb8d4('0x44')]=function(_0x303ba0,_0x2587b4){return db[_0xb8d4('0x27')]['describe']()[_0xb8d4('0x1f')](respondWithResult(_0x2587b4,null))[_0xb8d4('0x3e')](handleError(_0x2587b4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index d10b0dc..bedb8ad 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(_0x4d16b8,_0x3fac95){var _0x2d4257=function(_0x4e5a3a){while(--_0x4e5a3a){_0x4d16b8['push'](_0x4d16b8['shift']());}};_0x2d4257(++_0x3fac95);}(_0x2ef3,0xba));var _0x32ef=function(_0x2b0088,_0x447cb5){_0x2b0088=_0x2b0088-0x0;var _0x1dfa93=_0x2ef3[_0x2b0088];return _0x1dfa93;};'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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x4ee533,_0x5a6aec){var _0x33cc1e=function(_0x17e987){while(--_0x17e987){_0x4ee533['push'](_0x4ee533['shift']());}};_0x33cc1e(++_0x5a6aec);}(_0x7a54,0x106));var _0x47a5=function(_0x44cafb,_0x17de30){_0x44cafb=_0x44cafb-0x0;var _0x3c78c3=_0x7a54[_0x44cafb];return _0x3c78c3;};'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':'uniqueid','fields':[_0x47a5('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 66cfd37..e5823d1 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 _0x4af8=['catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4af8,0x1ad));var _0x84af=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x4af8[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550ee6,_0x422c5b,_0x294bc8){return new BPromise(function(_0x483ecc,_0x5b5e45){return client[_0x84af('0x8')](_0x550ee6,_0x294bc8)[_0x84af('0x9')](function(_0x479e1b){logger[_0x84af('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x84af('0xb'));logger[_0x84af('0xc')](_0x84af('0xd'),_0x422c5b,_0x84af('0xb'),JSON['stringify'](_0x479e1b));if(_0x479e1b[_0x84af('0xe')]){if(_0x479e1b['error'][_0x84af('0xf')]===0x1f4){logger[_0x84af('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);return _0x5b5e45(_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);}logger['error'](_0x84af('0x11'),_0x422c5b,_0x479e1b['error'][_0x84af('0x10')]);return _0x483ecc(_0x479e1b[_0x84af('0xe')]['message']);}else{logger[_0x84af('0xa')](_0x84af('0x11'),_0x422c5b,'request\x20sent');_0x483ecc(_0x479e1b[_0x84af('0x12')]['message']);}})[_0x84af('0x13')](function(_0x33baf1){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x33baf1);_0x5b5e45(_0x33baf1);});});}exports[_0x84af('0x14')]=function(_0xd8120b){var _0x38a120=this;return new Promise(function(_0x4cf5b4,_0x4d0cf0){return db[_0x84af('0x15')][_0x84af('0x16')](_0xd8120b[_0x84af('0x17')],{'raw':_0xd8120b[_0x84af('0x18')]?_0xd8120b[_0x84af('0x18')][_0x84af('0x19')]===undefined?!![]:![]:!![]})[_0x84af('0x9')](function(_0x334875){logger[_0x84af('0xa')]('CreateOpenchannelQueueReport',_0xd8120b);logger[_0x84af('0xc')](_0x84af('0x14'),_0xd8120b,JSON[_0x84af('0x1a')](_0x334875));_0x4cf5b4(_0x334875);})['catch'](function(_0x2f40d6){logger[_0x84af('0xe')](_0x84af('0x14'),_0x2f40d6['message'],_0xd8120b);_0x4d0cf0(_0x38a120['error'](0x1f4,_0x2f40d6[_0x84af('0x10')]));});});};exports[_0x84af('0x1b')]=function(_0xf72093){var _0x24aa07=this;return new Promise(function(_0x21823e,_0x1b23fb){return db[_0x84af('0x15')][_0x84af('0x1c')](_0xf72093[_0x84af('0x17')],{'raw':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')][_0x84af('0x1d')]||null:null,'attributes':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')][_0x84af('0x1e')]||null:null,'limit':_0xf72093[_0x84af('0x18')]?_0xf72093['options'][_0x84af('0x1f')]||null:null})[_0x84af('0x9')](function(_0x59417e){logger[_0x84af('0xa')](_0x84af('0x1b'),_0xf72093);logger[_0x84af('0xc')](_0x84af('0x1b'),_0xf72093,JSON['stringify'](_0x59417e));_0x21823e(_0x59417e);})['catch'](function(_0x3f37a0){logger[_0x84af('0xe')](_0x84af('0x1b'),_0x3f37a0[_0x84af('0x10')],_0xf72093);_0x1b23fb(_0x24aa07[_0x84af('0xe')](0x1f4,_0x3f37a0[_0x84af('0x10')]));});});}; \ No newline at end of file +var _0x896e=['message','info','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x896e,0x1e9));var _0xe896=function(_0x26dfec,_0x5ba1c2){_0x26dfec=_0x26dfec-0x0;var _0x5124ef=_0x896e[_0x26dfec];return _0x5124ef;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});}exports[_0xe896('0x18')]=function(_0x32f86d){var _0x2d4cf0=this;return new Promise(function(_0x5dc89d,_0x782813){return db[_0xe896('0x19')][_0xe896('0x1a')](_0x32f86d[_0xe896('0x1b')],{'raw':_0x32f86d[_0xe896('0x1c')]?_0x32f86d[_0xe896('0x1c')][_0xe896('0x1d')]===undefined?!![]:![]:!![]})[_0xe896('0xe')](function(_0x49547b){logger[_0xe896('0x16')]('CreateOpenchannelQueueReport',_0x32f86d);logger['debug'](_0xe896('0x18'),_0x32f86d,JSON[_0xe896('0x12')](_0x49547b));_0x5dc89d(_0x49547b);})[_0xe896('0x17')](function(_0xeeec7c){logger['error'](_0xe896('0x18'),_0xeeec7c['message'],_0x32f86d);_0x782813(_0x2d4cf0['error'](0x1f4,_0xeeec7c[_0xe896('0x15')]));});});};exports[_0xe896('0x1e')]=function(_0x1e952a){var _0x2e2c10=this;return new Promise(function(_0x20e295,_0x4d9f03){return db[_0xe896('0x19')]['update'](_0x1e952a[_0xe896('0x1b')],{'raw':_0x1e952a[_0xe896('0x1c')]?_0x1e952a[_0xe896('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e952a[_0xe896('0x1c')]?_0x1e952a[_0xe896('0x1c')][_0xe896('0x1f')]||null:null,'attributes':_0x1e952a[_0xe896('0x1c')]?_0x1e952a[_0xe896('0x1c')][_0xe896('0x20')]||null:null,'limit':_0x1e952a['options']?_0x1e952a[_0xe896('0x1c')][_0xe896('0x21')]||null:null})[_0xe896('0xe')](function(_0xbfb15b){logger[_0xe896('0x16')]('UpdateOpenchannelQueueReport',_0x1e952a);logger['debug']('UpdateOpenchannelQueueReport',_0x1e952a,JSON['stringify'](_0xbfb15b));_0x20e295(_0xbfb15b);})['catch'](function(_0x291290){logger[_0xe896('0x13')](_0xe896('0x1e'),_0x291290[_0xe896('0x15')],_0x1e952a);_0x4d9f03(_0x2e2c10[_0xe896('0x13')](0x1f4,_0x291290[_0xe896('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 6546af4..e1fdaae 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 _0xb60b=['delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb60b,0x1e2));var _0xbb60=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb60b[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbb60('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb60('0x1')]();var fs_extra=require(_0xbb60('0x2'));var auth=require(_0xbb60('0x3'));var interaction=require(_0xbb60('0x4'));var config=require(_0xbb60('0x5'));var controller=require(_0xbb60('0x6'));router[_0xbb60('0x7')]('/',auth[_0xbb60('0x8')](),controller[_0xbb60('0x9')]);router[_0xbb60('0x7')](_0xbb60('0xa'),auth[_0xbb60('0x8')](),controller[_0xbb60('0xb')]);router[_0xbb60('0x7')](_0xbb60('0xc'),auth['isAuthenticated'](),controller[_0xbb60('0xd')]);router[_0xbb60('0xe')]('/',auth[_0xbb60('0x8')](),controller[_0xbb60('0xf')]);router[_0xbb60('0x10')](_0xbb60('0xc'),auth[_0xbb60('0x8')](),controller[_0xbb60('0x11')]);router[_0xbb60('0x12')](_0xbb60('0xc'),auth[_0xbb60('0x8')](),controller['destroy']);module[_0xbb60('0x13')]=router; \ No newline at end of file +var _0x4f9d=['get','index','/describe','/:id','isAuthenticated','show','post','create','put','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','./openchannelTransferReport.controller'];(function(_0x31f9c6,_0x54065a){var _0x3d4a40=function(_0x2b6942){while(--_0x2b6942){_0x31f9c6['push'](_0x31f9c6['shift']());}};_0x3d4a40(++_0x54065a);}(_0x4f9d,0x12c));var _0xd4f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd4f9('0x0'));var path=require(_0xd4f9('0x1'));var timeout=require(_0xd4f9('0x2'));var express=require(_0xd4f9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd4f9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd4f9('0x5'));router[_0xd4f9('0x6')]('/',auth['isAuthenticated'](),controller[_0xd4f9('0x7')]);router[_0xd4f9('0x6')](_0xd4f9('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xd4f9('0x9'),auth[_0xd4f9('0xa')](),controller[_0xd4f9('0xb')]);router[_0xd4f9('0xc')]('/',auth['isAuthenticated'](),controller[_0xd4f9('0xd')]);router[_0xd4f9('0xe')]('/:id',auth[_0xd4f9('0xa')](),controller['update']);router['delete'](_0xd4f9('0x9'),auth['isAuthenticated'](),controller[_0xd4f9('0xf')]);module[_0xd4f9('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f133a44..245c301 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5a3791,_0x11a3de){_0x5a3791=_0x5a3791-0x0;var _0x2b6981=_0x9bde[_0x5a3791];return _0x2b6981;};'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 +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0xb43b,0x1b2));var _0xbb43=function(_0xad20d2,_0x1db23c){_0xad20d2=_0xad20d2-0x0;var _0x11b0a2=_0xb43b[_0xad20d2];return _0x11b0a2;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e34bc54..7e86ad0 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 _0xb0ea=['model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','type','VIRTUAL','merge','options','includeAll','findAll','catch','include','find','create','body','params','describe','eml-format','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/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','save','update','then','destroy','end','error','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key'];(function(_0x3025e5,_0x101867){var _0x7fc6ed=function(_0x45c94d){while(--_0x45c94d){_0x3025e5['push'](_0x3025e5['shift']());}};_0x7fc6ed(++_0x101867);}(_0xb0ea,0x1a6));var _0xab0e=function(_0x5448a9,_0x4764da){_0x5448a9=_0x5448a9-0x0;var _0x1924af=_0xb0ea[_0x5448a9];return _0x1924af;};'use strict';var emlformat=require(_0xab0e('0x0'));var rimraf=require(_0xab0e('0x1'));var zipdir=require(_0xab0e('0x2'));var jsonpatch=require(_0xab0e('0x3'));var rp=require('request-promise');var moment=require(_0xab0e('0x4'));var BPromise=require(_0xab0e('0x5'));var Mustache=require(_0xab0e('0x6'));var util=require(_0xab0e('0x7'));var path=require(_0xab0e('0x8'));var sox=require(_0xab0e('0x9'));var csv=require(_0xab0e('0xa'));var ejs=require(_0xab0e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab0e('0xc'));var squel=require(_0xab0e('0xd'));var crypto=require(_0xab0e('0xe'));var jsforce=require(_0xab0e('0xf'));var deskjs=require(_0xab0e('0x10'));var toCsv=require(_0xab0e('0xa'));var querystring=require(_0xab0e('0x11'));var Papa=require(_0xab0e('0x12'));var Redis=require(_0xab0e('0x13'));var authService=require(_0xab0e('0x14'));var qs=require(_0xab0e('0x15'));var as=require(_0xab0e('0x16'));var hardwareService=require(_0xab0e('0x17'));var logger=require(_0xab0e('0x18'))(_0xab0e('0x19'));var utils=require(_0xab0e('0x1a'));var config=require(_0xab0e('0x1b'));var licenseUtil=require(_0xab0e('0x1c'));var db=require(_0xab0e('0x1d'))['db'];function respondWithStatusCode(_0x2eeb24,_0x12b033){_0x12b033=_0x12b033||0xcc;return function(_0x4e2045){if(_0x4e2045){return _0x2eeb24[_0xab0e('0x1e')](_0x12b033);}return _0x2eeb24[_0xab0e('0x1f')](_0x12b033)['end']();};}function respondWithResult(_0x32a531,_0x17b714){_0x17b714=_0x17b714||0xc8;return function(_0x259205){if(_0x259205){return _0x32a531[_0xab0e('0x1f')](_0x17b714)[_0xab0e('0x20')](_0x259205);}};}function respondWithFilteredResult(_0x2cd471,_0x19bc87){return function(_0x3a4188){if(_0x3a4188){var _0x209941=typeof _0x19bc87[_0xab0e('0x21')]==='undefined'&&typeof _0x19bc87[_0xab0e('0x22')]===_0xab0e('0x23');var _0x18e2bd=_0x3a4188[_0xab0e('0x24')];var _0x57183a=_0x209941?0x0:_0x19bc87[_0xab0e('0x21')];var _0x54f29a=_0x209941?_0x3a4188['count']:_0x19bc87[_0xab0e('0x21')]+_0x19bc87[_0xab0e('0x22')];var _0xfc1da9;if(_0x54f29a>=_0x18e2bd){_0x54f29a=_0x18e2bd;_0xfc1da9=0xc8;}else{_0xfc1da9=0xce;}_0x2cd471[_0xab0e('0x1f')](_0xfc1da9);return _0x2cd471[_0xab0e('0x25')](_0xab0e('0x26'),_0x57183a+'-'+_0x54f29a+'/'+_0x18e2bd)[_0xab0e('0x20')](_0x3a4188);}return null;};}function patchUpdates(_0x1a82e2){return function(_0x1b62d2){try{jsonpatch['apply'](_0x1b62d2,_0x1a82e2,!![]);}catch(_0x357027){return BPromise['reject'](_0x357027);}return _0x1b62d2[_0xab0e('0x27')]();};}function saveUpdates(_0x320ac2,_0x522e42){return function(_0x28cfbd){if(_0x28cfbd){return _0x28cfbd[_0xab0e('0x28')](_0x320ac2)[_0xab0e('0x29')](function(_0x3bded9){return _0x3bded9;});}return null;};}function removeEntity(_0x455150,_0x58d964){return function(_0x404602){if(_0x404602){return _0x404602[_0xab0e('0x2a')]()[_0xab0e('0x29')](function(){_0x455150[_0xab0e('0x1f')](0xcc)[_0xab0e('0x2b')]();});}};}function handleEntityNotFound(_0x5f1437,_0x63264){return function(_0x26d30f){if(!_0x26d30f){_0x5f1437['sendStatus'](0x194);}return _0x26d30f;};}function handleError(_0x2cc337,_0x1c7019){_0x1c7019=_0x1c7019||0x1f4;return function(_0x2938b5){logger[_0xab0e('0x2c')](_0x2938b5['stack']);if(_0x2938b5['name']){delete _0x2938b5[_0xab0e('0x2d')];}_0x2cc337[_0xab0e('0x1f')](_0x1c7019)[_0xab0e('0x2e')](_0x2938b5);};}exports[_0xab0e('0x2f')]=function(_0xce53a2,_0x2646f8){var _0x4126bb={},_0x2aa44f={},_0x120d1f={'count':0x0,'rows':[]};var _0x3ba3d5=_['map'](db[_0xab0e('0x30')][_0xab0e('0x31')],function(_0x538675){return{'name':_0x538675[_0xab0e('0x32')],'type':_0x538675['type'][_0xab0e('0x33')]};});_0x2aa44f[_0xab0e('0x34')]=_[_0xab0e('0x35')](_0x3ba3d5,_0xab0e('0x2d'));_0x2aa44f[_0xab0e('0x36')]=_[_0xab0e('0x37')](_0xce53a2[_0xab0e('0x36')]);_0x2aa44f[_0xab0e('0x38')]=_['intersection'](_0x2aa44f[_0xab0e('0x34')],_0x2aa44f['query']);_0x4126bb[_0xab0e('0x39')]=_[_0xab0e('0x3a')](_0x2aa44f[_0xab0e('0x34')],qs['fields'](_0xce53a2['query'][_0xab0e('0x3b')]));_0x4126bb[_0xab0e('0x39')]=_0x4126bb['attributes'][_0xab0e('0x3c')]?_0x4126bb[_0xab0e('0x39')]:_0x2aa44f[_0xab0e('0x34')];if(!_0xce53a2[_0xab0e('0x36')][_0xab0e('0x3d')](_0xab0e('0x3e'))){_0x4126bb[_0xab0e('0x22')]=qs[_0xab0e('0x22')](_0xce53a2[_0xab0e('0x36')][_0xab0e('0x22')]);_0x4126bb[_0xab0e('0x21')]=qs[_0xab0e('0x21')](_0xce53a2[_0xab0e('0x36')][_0xab0e('0x21')]);}_0x4126bb['order']=qs[_0xab0e('0x3f')](_0xce53a2[_0xab0e('0x36')][_0xab0e('0x3f')]);_0x4126bb['where']=qs[_0xab0e('0x38')](_[_0xab0e('0x40')](_0xce53a2[_0xab0e('0x36')],_0x2aa44f['filters']),_0x3ba3d5);if(_0xce53a2['query']['filter']){_0x4126bb['where']=_['merge'](_0x4126bb[_0xab0e('0x41')],{'$or':_['map'](_0x3ba3d5,function(_0x116c1b){if(_0x116c1b[_0xab0e('0x42')]!==_0xab0e('0x43')){var _0x20f34e={};_0x20f34e[_0x116c1b['name']]={'$like':'%'+_0xce53a2[_0xab0e('0x36')]['filter']+'%'};return _0x20f34e;}})});}_0x4126bb=_[_0xab0e('0x44')]({},_0x4126bb,_0xce53a2[_0xab0e('0x45')]);var _0x51e8b2={'where':_0x4126bb[_0xab0e('0x41')]};return db[_0xab0e('0x30')][_0xab0e('0x24')](_0x51e8b2)[_0xab0e('0x29')](function(_0x240f0d){_0x120d1f[_0xab0e('0x24')]=_0x240f0d;if(_0xce53a2[_0xab0e('0x36')][_0xab0e('0x46')]){_0x4126bb['include']=[{'all':!![]}];}return db[_0xab0e('0x30')][_0xab0e('0x47')](_0x4126bb);})[_0xab0e('0x29')](function(_0x234b38){_0x120d1f['rows']=_0x234b38;return _0x120d1f;})[_0xab0e('0x29')](respondWithFilteredResult(_0x2646f8,_0x4126bb))[_0xab0e('0x48')](handleError(_0x2646f8,null));};exports['show']=function(_0x1ac813,_0x140b73){var _0x3b47c8={'raw':!![],'where':{'id':_0x1ac813['params']['id']}},_0x480a72={};_0x480a72['model']=_['keys'](db[_0xab0e('0x30')]['rawAttributes']);_0x480a72[_0xab0e('0x36')]=_['keys'](_0x1ac813['query']);_0x480a72[_0xab0e('0x38')]=_[_0xab0e('0x3a')](_0x480a72[_0xab0e('0x34')],_0x480a72['query']);_0x3b47c8[_0xab0e('0x39')]=_['intersection'](_0x480a72[_0xab0e('0x34')],qs[_0xab0e('0x3b')](_0x1ac813[_0xab0e('0x36')][_0xab0e('0x3b')]));_0x3b47c8[_0xab0e('0x39')]=_0x3b47c8[_0xab0e('0x39')][_0xab0e('0x3c')]?_0x3b47c8[_0xab0e('0x39')]:_0x480a72['model'];if(_0x1ac813['query'][_0xab0e('0x46')]){_0x3b47c8[_0xab0e('0x49')]=[{'all':!![]}];}_0x3b47c8=_['merge']({},_0x3b47c8,_0x1ac813[_0xab0e('0x45')]);return db[_0xab0e('0x30')][_0xab0e('0x4a')](_0x3b47c8)[_0xab0e('0x29')](handleEntityNotFound(_0x140b73,null))['then'](respondWithResult(_0x140b73,null))['catch'](handleError(_0x140b73,null));};exports['create']=function(_0x225b3f,_0x3cd845){return db[_0xab0e('0x30')][_0xab0e('0x4b')](_0x225b3f[_0xab0e('0x4c')],{})[_0xab0e('0x29')](respondWithResult(_0x3cd845,0xc9))[_0xab0e('0x48')](handleError(_0x3cd845,null));};exports[_0xab0e('0x28')]=function(_0x29c6cb,_0xc8ce63){if(_0x29c6cb[_0xab0e('0x4c')]['id']){delete _0x29c6cb[_0xab0e('0x4c')]['id'];}return db[_0xab0e('0x30')][_0xab0e('0x4a')]({'where':{'id':_0x29c6cb[_0xab0e('0x4d')]['id']}})[_0xab0e('0x29')](handleEntityNotFound(_0xc8ce63,null))['then'](saveUpdates(_0x29c6cb[_0xab0e('0x4c')],null))[_0xab0e('0x29')](respondWithResult(_0xc8ce63,null))[_0xab0e('0x48')](handleError(_0xc8ce63,null));};exports[_0xab0e('0x2a')]=function(_0x2a88e8,_0x574861){return db[_0xab0e('0x30')]['find']({'where':{'id':_0x2a88e8[_0xab0e('0x4d')]['id']}})[_0xab0e('0x29')](handleEntityNotFound(_0x574861,null))[_0xab0e('0x29')](removeEntity(_0x574861,null))[_0xab0e('0x48')](handleError(_0x574861,null));};exports[_0xab0e('0x4e')]=function(_0x4cc4d6,_0x29c405){return db['OpenchannelTransferReport'][_0xab0e('0x4e')]()[_0xab0e('0x29')](respondWithResult(_0x29c405,null))[_0xab0e('0x48')](handleError(_0x29c405,null));}; \ No newline at end of file +var _0xc163=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','type','VIRTUAL','filter','options','OpenchannelTransferReport','includeAll','include','rows','show','params','rawAttributes','catch','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5bfde1,_0x3cc158){var _0x3a1de4=function(_0x3c716a){while(--_0x3c716a){_0x5bfde1['push'](_0x5bfde1['shift']());}};_0x3a1de4(++_0x3cc158);}(_0xc163,0x16b));var _0x3c16=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc163[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c16('0x0'));var zipdir=require(_0x3c16('0x1'));var jsonpatch=require(_0x3c16('0x2'));var rp=require(_0x3c16('0x3'));var moment=require(_0x3c16('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3c16('0x5'));var util=require('util');var path=require(_0x3c16('0x6'));var sox=require(_0x3c16('0x7'));var csv=require(_0x3c16('0x8'));var ejs=require(_0x3c16('0x9'));var fs=require('fs');var fs_extra=require(_0x3c16('0xa'));var _=require(_0x3c16('0xb'));var squel=require(_0x3c16('0xc'));var crypto=require(_0x3c16('0xd'));var jsforce=require(_0x3c16('0xe'));var deskjs=require(_0x3c16('0xf'));var toCsv=require(_0x3c16('0x8'));var querystring=require(_0x3c16('0x10'));var Papa=require(_0x3c16('0x11'));var Redis=require('ioredis');var authService=require(_0x3c16('0x12'));var qs=require(_0x3c16('0x13'));var as=require(_0x3c16('0x14'));var hardwareService=require(_0x3c16('0x15'));var logger=require(_0x3c16('0x16'))('api');var utils=require(_0x3c16('0x17'));var config=require(_0x3c16('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3c16('0x19'))['db'];function respondWithStatusCode(_0x477cfd,_0x3ba8da){_0x3ba8da=_0x3ba8da||0xcc;return function(_0xeb5fde){if(_0xeb5fde){return _0x477cfd['sendStatus'](_0x3ba8da);}return _0x477cfd[_0x3c16('0x1a')](_0x3ba8da)['end']();};}function respondWithResult(_0x33be86,_0x17c543){_0x17c543=_0x17c543||0xc8;return function(_0x111638){if(_0x111638){return _0x33be86['status'](_0x17c543)[_0x3c16('0x1b')](_0x111638);}};}function respondWithFilteredResult(_0x558056,_0x2d8987){return function(_0x54ccd6){if(_0x54ccd6){var _0x3163ee=typeof _0x2d8987[_0x3c16('0x1c')]===_0x3c16('0x1d')&&typeof _0x2d8987['limit']===_0x3c16('0x1d');var _0xb2ea25=_0x54ccd6[_0x3c16('0x1e')];var _0x196270=_0x3163ee?0x0:_0x2d8987[_0x3c16('0x1c')];var _0x58c2c2=_0x3163ee?_0x54ccd6[_0x3c16('0x1e')]:_0x2d8987[_0x3c16('0x1c')]+_0x2d8987['limit'];var _0x487829;if(_0x58c2c2>=_0xb2ea25){_0x58c2c2=_0xb2ea25;_0x487829=0xc8;}else{_0x487829=0xce;}_0x558056[_0x3c16('0x1a')](_0x487829);return _0x558056[_0x3c16('0x1f')]('Content-Range',_0x196270+'-'+_0x58c2c2+'/'+_0xb2ea25)[_0x3c16('0x1b')](_0x54ccd6);}return null;};}function patchUpdates(_0x113192){return function(_0x37f5c6){try{jsonpatch[_0x3c16('0x20')](_0x37f5c6,_0x113192,!![]);}catch(_0x2dcedf){return BPromise[_0x3c16('0x21')](_0x2dcedf);}return _0x37f5c6[_0x3c16('0x22')]();};}function saveUpdates(_0xf08698,_0x56ef99){return function(_0x834ff7){if(_0x834ff7){return _0x834ff7[_0x3c16('0x23')](_0xf08698)['then'](function(_0x1f2693){return _0x1f2693;});}return null;};}function removeEntity(_0x314839,_0x5cd1e0){return function(_0x169d3b){if(_0x169d3b){return _0x169d3b[_0x3c16('0x24')]()[_0x3c16('0x25')](function(){_0x314839[_0x3c16('0x1a')](0xcc)[_0x3c16('0x26')]();});}};}function handleEntityNotFound(_0x4f9b97,_0x4a7361){return function(_0x374246){if(!_0x374246){_0x4f9b97['sendStatus'](0x194);}return _0x374246;};}function handleError(_0x407a75,_0x562cf6){_0x562cf6=_0x562cf6||0x1f4;return function(_0x595e82){logger[_0x3c16('0x27')](_0x595e82[_0x3c16('0x28')]);if(_0x595e82[_0x3c16('0x29')]){delete _0x595e82[_0x3c16('0x29')];}_0x407a75[_0x3c16('0x1a')](_0x562cf6)[_0x3c16('0x2a')](_0x595e82);};}exports['index']=function(_0x19b118,_0x48478d){var _0x16198d={},_0x5d9e5b={},_0x2afd55={'count':0x0,'rows':[]};var _0x322033=_['map'](db['OpenchannelTransferReport']['rawAttributes'],function(_0x287f5f){return{'name':_0x287f5f[_0x3c16('0x2b')],'type':_0x287f5f['type'][_0x3c16('0x2c')]};});_0x5d9e5b[_0x3c16('0x2d')]=_[_0x3c16('0x2e')](_0x322033,_0x3c16('0x29'));_0x5d9e5b[_0x3c16('0x2f')]=_[_0x3c16('0x30')](_0x19b118['query']);_0x5d9e5b[_0x3c16('0x31')]=_[_0x3c16('0x32')](_0x5d9e5b[_0x3c16('0x2d')],_0x5d9e5b['query']);_0x16198d[_0x3c16('0x33')]=_[_0x3c16('0x32')](_0x5d9e5b['model'],qs['fields'](_0x19b118[_0x3c16('0x2f')][_0x3c16('0x34')]));_0x16198d[_0x3c16('0x33')]=_0x16198d[_0x3c16('0x33')][_0x3c16('0x35')]?_0x16198d['attributes']:_0x5d9e5b[_0x3c16('0x2d')];if(!_0x19b118[_0x3c16('0x2f')][_0x3c16('0x36')](_0x3c16('0x37'))){_0x16198d[_0x3c16('0x38')]=qs[_0x3c16('0x38')](_0x19b118['query'][_0x3c16('0x38')]);_0x16198d['offset']=qs[_0x3c16('0x1c')](_0x19b118[_0x3c16('0x2f')][_0x3c16('0x1c')]);}_0x16198d['order']=qs[_0x3c16('0x39')](_0x19b118[_0x3c16('0x2f')][_0x3c16('0x39')]);_0x16198d[_0x3c16('0x3a')]=qs[_0x3c16('0x31')](_[_0x3c16('0x3b')](_0x19b118[_0x3c16('0x2f')],_0x5d9e5b[_0x3c16('0x31')]),_0x322033);if(_0x19b118[_0x3c16('0x2f')]['filter']){_0x16198d[_0x3c16('0x3a')]=_[_0x3c16('0x3c')](_0x16198d[_0x3c16('0x3a')],{'$or':_[_0x3c16('0x2e')](_0x322033,function(_0x545f86){if(_0x545f86[_0x3c16('0x3d')]!==_0x3c16('0x3e')){var _0x17b565={};_0x17b565[_0x545f86['name']]={'$like':'%'+_0x19b118[_0x3c16('0x2f')][_0x3c16('0x3f')]+'%'};return _0x17b565;}})});}_0x16198d=_['merge']({},_0x16198d,_0x19b118[_0x3c16('0x40')]);var _0x3c4f25={'where':_0x16198d[_0x3c16('0x3a')]};return db[_0x3c16('0x41')][_0x3c16('0x1e')](_0x3c4f25)[_0x3c16('0x25')](function(_0xc98019){_0x2afd55[_0x3c16('0x1e')]=_0xc98019;if(_0x19b118[_0x3c16('0x2f')][_0x3c16('0x42')]){_0x16198d[_0x3c16('0x43')]=[{'all':!![]}];}return db[_0x3c16('0x41')]['findAll'](_0x16198d);})[_0x3c16('0x25')](function(_0x46bc79){_0x2afd55[_0x3c16('0x44')]=_0x46bc79;return _0x2afd55;})['then'](respondWithFilteredResult(_0x48478d,_0x16198d))['catch'](handleError(_0x48478d,null));};exports[_0x3c16('0x45')]=function(_0x4a5de4,_0x5898b8){var _0x262e76={'raw':!![],'where':{'id':_0x4a5de4[_0x3c16('0x46')]['id']}},_0x4c137b={};_0x4c137b['model']=_[_0x3c16('0x30')](db[_0x3c16('0x41')][_0x3c16('0x47')]);_0x4c137b[_0x3c16('0x2f')]=_[_0x3c16('0x30')](_0x4a5de4['query']);_0x4c137b[_0x3c16('0x31')]=_[_0x3c16('0x32')](_0x4c137b['model'],_0x4c137b['query']);_0x262e76['attributes']=_[_0x3c16('0x32')](_0x4c137b['model'],qs[_0x3c16('0x34')](_0x4a5de4[_0x3c16('0x2f')]['fields']));_0x262e76[_0x3c16('0x33')]=_0x262e76['attributes'][_0x3c16('0x35')]?_0x262e76['attributes']:_0x4c137b[_0x3c16('0x2d')];if(_0x4a5de4[_0x3c16('0x2f')][_0x3c16('0x42')]){_0x262e76[_0x3c16('0x43')]=[{'all':!![]}];}_0x262e76=_[_0x3c16('0x3c')]({},_0x262e76,_0x4a5de4[_0x3c16('0x40')]);return db[_0x3c16('0x41')]['find'](_0x262e76)[_0x3c16('0x25')](handleEntityNotFound(_0x5898b8,null))[_0x3c16('0x25')](respondWithResult(_0x5898b8,null))['catch'](handleError(_0x5898b8,null));};exports['create']=function(_0x32cbac,_0x3c1ee7){return db[_0x3c16('0x41')]['create'](_0x32cbac['body'],{})[_0x3c16('0x25')](respondWithResult(_0x3c1ee7,0xc9))[_0x3c16('0x48')](handleError(_0x3c1ee7,null));};exports[_0x3c16('0x23')]=function(_0x32f038,_0x4d699f){if(_0x32f038[_0x3c16('0x49')]['id']){delete _0x32f038[_0x3c16('0x49')]['id'];}return db['OpenchannelTransferReport'][_0x3c16('0x4a')]({'where':{'id':_0x32f038[_0x3c16('0x46')]['id']}})[_0x3c16('0x25')](handleEntityNotFound(_0x4d699f,null))[_0x3c16('0x25')](saveUpdates(_0x32f038['body'],null))[_0x3c16('0x25')](respondWithResult(_0x4d699f,null))['catch'](handleError(_0x4d699f,null));};exports[_0x3c16('0x24')]=function(_0x2a9ce2,_0x5fb821){return db[_0x3c16('0x41')][_0x3c16('0x4a')]({'where':{'id':_0x2a9ce2[_0x3c16('0x46')]['id']}})[_0x3c16('0x25')](handleEntityNotFound(_0x5fb821,null))[_0x3c16('0x25')](removeEntity(_0x5fb821,null))['catch'](handleError(_0x5fb821,null));};exports[_0x3c16('0x4b')]=function(_0x5d80ae,_0x3f0d45){return db[_0x3c16('0x41')][_0x3c16('0x4b')]()[_0x3c16('0x25')](respondWithResult(_0x3f0d45,null))[_0x3c16('0x48')](handleError(_0x3f0d45,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ca2ac24..0b8317e 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 _0x8810=['lodash','util','api','moment','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid'];(function(_0x54e217,_0x243297){var _0x590ead=function(_0x2f1d78){while(--_0x2f1d78){_0x54e217['push'](_0x54e217['shift']());}};_0x590ead(++_0x243297);}(_0x8810,0x198));var _0x0881=function(_0x482ea4,_0x990a3){_0x482ea4=_0x482ea4-0x0;var _0x29f676=_0x8810[_0x482ea4];return _0x29f676;};'use strict';var _=require(_0x0881('0x0'));var util=require(_0x0881('0x1'));var logger=require('../../config/logger')(_0x0881('0x2'));var moment=require(_0x0881('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0881('0x4'));var rimraf=require(_0x0881('0x5'));var config=require(_0x0881('0x6'));var attributes=require(_0x0881('0x7'));module[_0x0881('0x8')]=function(_0x8c6370,_0xdbe262){return _0x8c6370[_0x0881('0x9')](_0x0881('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0881('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x532e=['./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x19e9e3,_0x2ed90e){var _0x337b8b=function(_0x3f80bc){while(--_0x3f80bc){_0x19e9e3['push'](_0x19e9e3['shift']());}};_0x337b8b(++_0x2ed90e);}(_0x532e,0x1d2));var _0xe532=function(_0x29539d,_0x25c623){_0x29539d=_0x29539d-0x0;var _0x18e169=_0x532e[_0x29539d];return _0x18e169;};'use strict';var _=require(_0xe532('0x0'));var util=require(_0xe532('0x1'));var logger=require(_0xe532('0x2'))('api');var moment=require(_0xe532('0x3'));var BPromise=require(_0xe532('0x4'));var rp=require(_0xe532('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe532('0x6'));var attributes=require(_0xe532('0x7'));module['exports']=function(_0x14bc7c,_0x4d5fb5){return _0x14bc7c[_0xe532('0x8')](_0xe532('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xe532('0xa'),'fields':[_0xe532('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index d8a76ab..a77ed40 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 _0x9589=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x3e4e5c,_0x4d2966){var _0x46f0bf=function(_0x2d1982){while(--_0x2d1982){_0x3e4e5c['push'](_0x3e4e5c['shift']());}};_0x46f0bf(++_0x4d2966);}(_0x9589,0xbc));var _0x9958=function(_0x20784a,_0x3326b4){_0x20784a=_0x20784a-0x0;var _0x2c0df2=_0x9589[_0x20784a];return _0x2c0df2;};'use strict';var _=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var moment=require(_0x9958('0x2'));var BPromise=require(_0x9958('0x3'));var rs=require(_0x9958('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9958('0x5'))['db'];var utils=require(_0x9958('0x6'));var logger=require(_0x9958('0x7'))('rpc');var config=require(_0x9958('0x8'));var jayson=require(_0x9958('0x9'));var client=jayson[_0x9958('0xa')][_0x9958('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4225da,_0x2c3eaf,_0x5750c5){return new BPromise(function(_0x2ac795,_0x19f3b3){return client[_0x9958('0xc')](_0x4225da,_0x5750c5)[_0x9958('0xd')](function(_0x21f35c){logger[_0x9958('0xe')](_0x9958('0xf'),_0x2c3eaf,_0x9958('0x10'));logger[_0x9958('0x11')](_0x9958('0x12'),_0x2c3eaf,_0x9958('0x10'),JSON[_0x9958('0x13')](_0x21f35c));if(_0x21f35c[_0x9958('0x14')]){if(_0x21f35c[_0x9958('0x14')][_0x9958('0x15')]===0x1f4){logger[_0x9958('0x14')](_0x9958('0xf'),_0x2c3eaf,_0x21f35c[_0x9958('0x14')]['message']);return _0x19f3b3(_0x21f35c[_0x9958('0x14')]['message']);}logger[_0x9958('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2c3eaf,_0x21f35c[_0x9958('0x14')][_0x9958('0x16')]);return _0x2ac795(_0x21f35c[_0x9958('0x14')][_0x9958('0x16')]);}else{logger['info'](_0x9958('0xf'),_0x2c3eaf,_0x9958('0x10'));_0x2ac795(_0x21f35c['result']['message']);}})[_0x9958('0x17')](function(_0x4a27cf){logger[_0x9958('0x14')](_0x9958('0xf'),_0x2c3eaf,_0x4a27cf);_0x19f3b3(_0x4a27cf);});});} \ No newline at end of file +var _0xef8b=['error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3bd357,_0x14bf3d){var _0x46b238=function(_0x2b91ca){while(--_0x2b91ca){_0x3bd357['push'](_0x3bd357['shift']());}};_0x46b238(++_0x14bf3d);}(_0xef8b,0x192));var _0xbef8=function(_0x4fa738,_0x2a491c){_0x4fa738=_0x4fa738-0x0;var _0x55bf55=_0xef8b[_0x4fa738];return _0x55bf55;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var moment=require(_0xbef8('0x1'));var BPromise=require(_0xbef8('0x2'));var rs=require(_0xbef8('0x3'));var fs=require('fs');var Redis=require(_0xbef8('0x4'));var db=require(_0xbef8('0x5'))['db'];var utils=require(_0xbef8('0x6'));var logger=require(_0xbef8('0x7'))(_0xbef8('0x8'));var config=require(_0xbef8('0x9'));var jayson=require(_0xbef8('0xa'));var client=jayson['client'][_0xbef8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359be9,_0x26b756,_0x5d2773){return new BPromise(function(_0x22d84e,_0x1a6d83){return client['request'](_0x359be9,_0x5d2773)['then'](function(_0x48addc){logger[_0xbef8('0xc')](_0xbef8('0xd'),_0x26b756,_0xbef8('0xe'));logger[_0xbef8('0xf')](_0xbef8('0x10'),_0x26b756,_0xbef8('0xe'),JSON[_0xbef8('0x11')](_0x48addc));if(_0x48addc[_0xbef8('0x12')]){if(_0x48addc[_0xbef8('0x12')]['code']===0x1f4){logger[_0xbef8('0x12')](_0xbef8('0xd'),_0x26b756,_0x48addc[_0xbef8('0x12')]['message']);return _0x1a6d83(_0x48addc['error']['message']);}logger[_0xbef8('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x26b756,_0x48addc[_0xbef8('0x12')][_0xbef8('0x13')]);return _0x22d84e(_0x48addc['error'][_0xbef8('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x26b756,_0xbef8('0xe'));_0x22d84e(_0x48addc['result']['message']);}})[_0xbef8('0x14')](function(_0x1e8060){logger[_0xbef8('0x12')](_0xbef8('0xd'),_0x26b756,_0x1e8060);_0x1a6d83(_0x1e8060);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index bbea2e0..6261f54 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 _0x3bc2=['exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4f3da4,_0x121375){var _0x1df1a1=function(_0x329dfc){while(--_0x329dfc){_0x4f3da4['push'](_0x4f3da4['shift']());}};_0x1df1a1(++_0x121375);}(_0x3bc2,0x91));var _0x23bc=function(_0x635f72,_0x4171b8){_0x635f72=_0x635f72-0x0;var _0x17a383=_0x3bc2[_0x635f72];return _0x17a383;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x23bc('0x0'));var express=require(_0x23bc('0x1'));var router=express[_0x23bc('0x2')]();var fs_extra=require(_0x23bc('0x3'));var auth=require(_0x23bc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x23bc('0x5'));var controller=require(_0x23bc('0x6'));router[_0x23bc('0x7')]('/',auth[_0x23bc('0x8')](),controller[_0x23bc('0x9')]);router[_0x23bc('0x7')](_0x23bc('0xa'),auth[_0x23bc('0x8')](),controller[_0x23bc('0xb')]);router[_0x23bc('0xc')]('/',auth[_0x23bc('0x8')](),controller[_0x23bc('0xd')]);router[_0x23bc('0xe')]('/:id',auth[_0x23bc('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x23bc('0xf')]=router; \ No newline at end of file +var _0xf50f=['destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x11766f,_0x3da259){var _0x3405d8=function(_0x216ab4){while(--_0x216ab4){_0x11766f['push'](_0x11766f['shift']());}};_0x3405d8(++_0x3da259);}(_0xf50f,0x179));var _0xff50=function(_0x3e63e7,_0x2fb36a){_0x3e63e7=_0x3e63e7-0x0;var _0x6ca6e5=_0xf50f[_0x3e63e7];return _0x6ca6e5;};'use strict';var multer=require(_0xff50('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xff50('0x1'));var express=require(_0xff50('0x2'));var router=express[_0xff50('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xff50('0x4'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0xff50('0x5')]('/',auth['isAuthenticated'](),controller[_0xff50('0x6')]);router[_0xff50('0x5')](_0xff50('0x7'),auth[_0xff50('0x8')](),controller['show']);router[_0xff50('0x9')]('/',auth['isAuthenticated'](),controller[_0xff50('0xa')]);router[_0xff50('0xb')](_0xff50('0x7'),auth[_0xff50('0x8')](),controller[_0xff50('0xc')]);router['delete']('/:id',auth[_0xff50('0x8')](),controller[_0xff50('0xd')]);module[_0xff50('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index fad0adc..41f4164 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 _0x5d80=['sequelize','name','STRING'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x5d80,0xe4));var _0x05d8=function(_0x16a2cb,_0x142e32){_0x16a2cb=_0x16a2cb-0x0;var _0x2af13c=_0x5d80[_0x16a2cb];return _0x2af13c;};'use strict';var Sequelize=require(_0x05d8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x05d8('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x05d8('0x2')]}}; \ No newline at end of file +var _0x1c54=['exports','STRING','name','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1c54,0x167));var _0x41c5=function(_0x100531,_0x56620d){_0x100531=_0x100531-0x0;var _0x54a6a3=_0x1c54[_0x100531];return _0x54a6a3;};'use strict';var Sequelize=require(_0x41c5('0x0'));module[_0x41c5('0x1')]={'name':{'type':Sequelize[_0x41c5('0x2')],'unique':_0x41c5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x41c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f403587..e8b5f37 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 _0x373f=['destroy','get','Pauses','error','stack','name','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','filter','options','Pause','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','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','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x373f,0x7c));var _0xf373=function(_0x2cef55,_0x11c9e9){_0x2cef55=_0x2cef55-0x0;var _0x2b696b=_0x373f[_0x2cef55];return _0x2b696b;};'use strict';var emlformat=require(_0xf373('0x0'));var rimraf=require(_0xf373('0x1'));var zipdir=require(_0xf373('0x2'));var jsonpatch=require(_0xf373('0x3'));var rp=require(_0xf373('0x4'));var moment=require('moment');var BPromise=require(_0xf373('0x5'));var Mustache=require('mustache');var util=require(_0xf373('0x6'));var path=require('path');var sox=require(_0xf373('0x7'));var csv=require(_0xf373('0x8'));var ejs=require(_0xf373('0x9'));var fs=require('fs');var fs_extra=require(_0xf373('0xa'));var _=require(_0xf373('0xb'));var squel=require(_0xf373('0xc'));var crypto=require('crypto');var jsforce=require(_0xf373('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf373('0x8'));var querystring=require('querystring');var Papa=require(_0xf373('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf373('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf373('0x10'));var logger=require(_0xf373('0x11'))(_0xf373('0x12'));var utils=require(_0xf373('0x13'));var config=require(_0xf373('0x14'));var licenseUtil=require(_0xf373('0x15'));var db=require(_0xf373('0x16'))['db'];function respondWithStatusCode(_0x386621,_0x355f38){_0x355f38=_0x355f38||0xcc;return function(_0x3bc30d){if(_0x3bc30d){return _0x386621[_0xf373('0x17')](_0x355f38);}return _0x386621[_0xf373('0x18')](_0x355f38)[_0xf373('0x19')]();};}function respondWithResult(_0x2ccfbd,_0x4f9f4e){_0x4f9f4e=_0x4f9f4e||0xc8;return function(_0x289f2c){if(_0x289f2c){return _0x2ccfbd['status'](_0x4f9f4e)[_0xf373('0x1a')](_0x289f2c);}};}function respondWithFilteredResult(_0x2483a8,_0x1835b7){return function(_0x1a971f){if(_0x1a971f){var _0x512d57=typeof _0x1835b7[_0xf373('0x1b')]==='undefined'&&typeof _0x1835b7[_0xf373('0x1c')]===_0xf373('0x1d');var _0x4e581c=_0x1a971f[_0xf373('0x1e')];var _0x154da0=_0x512d57?0x0:_0x1835b7[_0xf373('0x1b')];var _0x551333=_0x512d57?_0x1a971f[_0xf373('0x1e')]:_0x1835b7[_0xf373('0x1b')]+_0x1835b7['limit'];var _0x19d3ce;if(_0x551333>=_0x4e581c){_0x551333=_0x4e581c;_0x19d3ce=0xc8;}else{_0x19d3ce=0xce;}_0x2483a8[_0xf373('0x18')](_0x19d3ce);return _0x2483a8['set'](_0xf373('0x1f'),_0x154da0+'-'+_0x551333+'/'+_0x4e581c)[_0xf373('0x1a')](_0x1a971f);}return null;};}function patchUpdates(_0x38f75b){return function(_0x4551b8){try{jsonpatch['apply'](_0x4551b8,_0x38f75b,!![]);}catch(_0x5af293){return BPromise[_0xf373('0x20')](_0x5af293);}return _0x4551b8[_0xf373('0x21')]();};}function saveUpdates(_0x43d0fd,_0x7ea3a1){return function(_0x38f22c){if(_0x38f22c){return _0x38f22c[_0xf373('0x22')](_0x43d0fd)[_0xf373('0x23')](function(_0x5731f4){return _0x5731f4;});}return null;};}function removeEntity(_0xbef6a2,_0x95993a){return function(_0x24c473){if(_0x24c473){return _0x24c473[_0xf373('0x24')]()['then'](function(){var _0x53620f=_0x24c473[_0xf373('0x25')]({'plain':!![]});var _0x112068=_0xf373('0x26');return db['UserProfileResource'][_0xf373('0x24')]({'where':{'type':_0x112068,'resourceId':_0x53620f['id']}})['then'](function(){return _0x24c473;});})[_0xf373('0x23')](function(){_0xbef6a2['status'](0xcc)[_0xf373('0x19')]();});}};}function handleEntityNotFound(_0x132c7c,_0xdaa87b){return function(_0x3be897){if(!_0x3be897){_0x132c7c[_0xf373('0x17')](0x194);}return _0x3be897;};}function handleError(_0x2ed2d7,_0x106139){_0x106139=_0x106139||0x1f4;return function(_0x5f46c1){logger[_0xf373('0x27')](_0x5f46c1[_0xf373('0x28')]);if(_0x5f46c1[_0xf373('0x29')]){delete _0x5f46c1['name'];}_0x2ed2d7['status'](_0x106139)['send'](_0x5f46c1);};}exports['index']=function(_0x1d93a1,_0x1d10cc){var _0x1f8157={},_0x259412={},_0x2a8519={'count':0x0,'rows':[]};var _0x531fb7=_[_0xf373('0x2a')](db['Pause']['rawAttributes'],function(_0x24c348){return{'name':_0x24c348[_0xf373('0x2b')],'type':_0x24c348[_0xf373('0x2c')][_0xf373('0x2d')]};});_0x259412[_0xf373('0x2e')]=_['map'](_0x531fb7,'name');_0x259412[_0xf373('0x2f')]=_[_0xf373('0x30')](_0x1d93a1[_0xf373('0x2f')]);_0x259412[_0xf373('0x31')]=_[_0xf373('0x32')](_0x259412[_0xf373('0x2e')],_0x259412['query']);_0x1f8157['attributes']=_['intersection'](_0x259412[_0xf373('0x2e')],qs[_0xf373('0x33')](_0x1d93a1[_0xf373('0x2f')]['fields']));_0x1f8157[_0xf373('0x34')]=_0x1f8157['attributes'][_0xf373('0x35')]?_0x1f8157[_0xf373('0x34')]:_0x259412[_0xf373('0x2e')];if(!_0x1d93a1[_0xf373('0x2f')]['hasOwnProperty'](_0xf373('0x36'))){_0x1f8157[_0xf373('0x1c')]=qs[_0xf373('0x1c')](_0x1d93a1[_0xf373('0x2f')][_0xf373('0x1c')]);_0x1f8157[_0xf373('0x1b')]=qs['offset'](_0x1d93a1[_0xf373('0x2f')][_0xf373('0x1b')]);}_0x1f8157[_0xf373('0x37')]=qs['sort'](_0x1d93a1[_0xf373('0x2f')][_0xf373('0x38')]);_0x1f8157[_0xf373('0x39')]=qs[_0xf373('0x31')](_['pick'](_0x1d93a1['query'],_0x259412[_0xf373('0x31')]),_0x531fb7);if(_0x1d93a1[_0xf373('0x2f')]['filter']){_0x1f8157[_0xf373('0x39')]=_[_0xf373('0x3a')](_0x1f8157[_0xf373('0x39')],{'$or':_[_0xf373('0x2a')](_0x531fb7,function(_0x3c4b23){if(_0x3c4b23['type']!=='VIRTUAL'){var _0x24f8d5={};_0x24f8d5[_0x3c4b23[_0xf373('0x29')]]={'$like':'%'+_0x1d93a1[_0xf373('0x2f')][_0xf373('0x3b')]+'%'};return _0x24f8d5;}})});}_0x1f8157=_[_0xf373('0x3a')]({},_0x1f8157,_0x1d93a1[_0xf373('0x3c')]);var _0x404c2b={'where':_0x1f8157['where']};return db[_0xf373('0x3d')][_0xf373('0x1e')](_0x404c2b)[_0xf373('0x23')](function(_0x570268){_0x2a8519[_0xf373('0x1e')]=_0x570268;if(_0x1d93a1[_0xf373('0x2f')]['includeAll']){_0x1f8157[_0xf373('0x3e')]=[{'all':!![]}];}return db[_0xf373('0x3d')][_0xf373('0x3f')](_0x1f8157);})[_0xf373('0x23')](function(_0x584548){_0x2a8519[_0xf373('0x40')]=_0x584548;return _0x2a8519;})[_0xf373('0x23')](respondWithFilteredResult(_0x1d10cc,_0x1f8157))[_0xf373('0x41')](handleError(_0x1d10cc,null));};exports['show']=function(_0x524f43,_0x377f4a){var _0x4ca4da={'raw':!![],'where':{'id':_0x524f43[_0xf373('0x42')]['id']}},_0xb064dd={};_0xb064dd['model']=_['keys'](db[_0xf373('0x3d')][_0xf373('0x43')]);_0xb064dd[_0xf373('0x2f')]=_[_0xf373('0x30')](_0x524f43[_0xf373('0x2f')]);_0xb064dd[_0xf373('0x31')]=_[_0xf373('0x32')](_0xb064dd[_0xf373('0x2e')],_0xb064dd['query']);_0x4ca4da[_0xf373('0x34')]=_[_0xf373('0x32')](_0xb064dd['model'],qs['fields'](_0x524f43[_0xf373('0x2f')][_0xf373('0x33')]));_0x4ca4da[_0xf373('0x34')]=_0x4ca4da[_0xf373('0x34')][_0xf373('0x35')]?_0x4ca4da[_0xf373('0x34')]:_0xb064dd['model'];if(_0x524f43[_0xf373('0x2f')][_0xf373('0x44')]){_0x4ca4da['include']=[{'all':!![]}];}_0x4ca4da=_[_0xf373('0x3a')]({},_0x4ca4da,_0x524f43[_0xf373('0x3c')]);return db[_0xf373('0x3d')][_0xf373('0x45')](_0x4ca4da)['then'](handleEntityNotFound(_0x377f4a,null))[_0xf373('0x23')](respondWithResult(_0x377f4a,null))['catch'](handleError(_0x377f4a,null));};exports[_0xf373('0x46')]=function(_0x58c5d6,_0x2c49e7){return db[_0xf373('0x3d')][_0xf373('0x46')](_0x58c5d6[_0xf373('0x47')],{})['then'](function(_0x431160){var _0xf9c175=_0x58c5d6[_0xf373('0x48')][_0xf373('0x25')]({'plain':!![]});if(!_0xf9c175)throw new Error(_0xf373('0x49'));if(_0xf9c175[_0xf373('0x4a')]==='user'){var _0x2e0c94=_0x431160[_0xf373('0x25')]({'plain':!![]});var _0x472a5e=_0xf373('0x26');return db[_0xf373('0x4b')][_0xf373('0x45')]({'where':{'name':_0x472a5e,'userProfileId':_0xf9c175[_0xf373('0x4c')]},'raw':!![]})[_0xf373('0x23')](function(_0x3339e5){if(_0x3339e5&&_0x3339e5[_0xf373('0x4d')]===0x0){return db[_0xf373('0x4e')][_0xf373('0x46')]({'name':_0x2e0c94[_0xf373('0x29')],'resourceId':_0x2e0c94['id'],'type':_0x3339e5['name'],'sectionId':_0x3339e5['id']},{})[_0xf373('0x23')](function(){return _0x431160;});}else{return _0x431160;}})[_0xf373('0x41')](function(_0x257e6c){logger['error'](_0xf373('0x4f'),_0x257e6c);throw _0x257e6c;});}return _0x431160;})['then'](respondWithResult(_0x2c49e7,0xc9))['catch'](handleError(_0x2c49e7,null));};exports[_0xf373('0x22')]=function(_0x436bc9,_0x21673e){if(_0x436bc9[_0xf373('0x47')]['id']){delete _0x436bc9[_0xf373('0x47')]['id'];}return db[_0xf373('0x3d')][_0xf373('0x45')]({'where':{'id':_0x436bc9[_0xf373('0x42')]['id']}})['then'](handleEntityNotFound(_0x21673e,null))[_0xf373('0x23')](saveUpdates(_0x436bc9['body'],null))[_0xf373('0x23')](respondWithResult(_0x21673e,null))[_0xf373('0x41')](handleError(_0x21673e,null));};exports[_0xf373('0x24')]=function(_0xdd94d5,_0x5a7fd9){return db[_0xf373('0x3d')][_0xf373('0x45')]({'where':{'id':_0xdd94d5[_0xf373('0x42')]['id']}})[_0xf373('0x23')](handleEntityNotFound(_0x5a7fd9,null))[_0xf373('0x23')](removeEntity(_0x5a7fd9,null))['catch'](handleError(_0x5a7fd9,null));}; \ No newline at end of file +var _0x9fb2=['end','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','error','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource'];(function(_0x53081b,_0x5bf1c1){var _0x45f471=function(_0x32a5f1){while(--_0x32a5f1){_0x53081b['push'](_0x53081b['shift']());}};_0x45f471(++_0x5bf1c1);}(_0x9fb2,0x1c6));var _0x29fb=function(_0x4cc593,_0x82927){_0x4cc593=_0x4cc593-0x0;var _0x1ac9e7=_0x9fb2[_0x4cc593];return _0x1ac9e7;};'use strict';var emlformat=require(_0x29fb('0x0'));var rimraf=require(_0x29fb('0x1'));var zipdir=require(_0x29fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29fb('0x3'));var moment=require(_0x29fb('0x4'));var BPromise=require(_0x29fb('0x5'));var Mustache=require(_0x29fb('0x6'));var util=require('util');var path=require(_0x29fb('0x7'));var sox=require(_0x29fb('0x8'));var csv=require('to-csv');var ejs=require(_0x29fb('0x9'));var fs=require('fs');var fs_extra=require(_0x29fb('0xa'));var _=require(_0x29fb('0xb'));var squel=require(_0x29fb('0xc'));var crypto=require(_0x29fb('0xd'));var jsforce=require(_0x29fb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x29fb('0xf'));var querystring=require('querystring');var Papa=require(_0x29fb('0x10'));var Redis=require(_0x29fb('0x11'));var authService=require(_0x29fb('0x12'));var qs=require(_0x29fb('0x13'));var as=require(_0x29fb('0x14'));var hardwareService=require(_0x29fb('0x15'));var logger=require('../../config/logger')(_0x29fb('0x16'));var utils=require(_0x29fb('0x17'));var config=require(_0x29fb('0x18'));var licenseUtil=require(_0x29fb('0x19'));var db=require(_0x29fb('0x1a'))['db'];function respondWithStatusCode(_0x383ed6,_0x209312){_0x209312=_0x209312||0xcc;return function(_0x4dfd1d){if(_0x4dfd1d){return _0x383ed6[_0x29fb('0x1b')](_0x209312);}return _0x383ed6[_0x29fb('0x1c')](_0x209312)['end']();};}function respondWithResult(_0x11c927,_0x381b5a){_0x381b5a=_0x381b5a||0xc8;return function(_0x5228b4){if(_0x5228b4){return _0x11c927[_0x29fb('0x1c')](_0x381b5a)[_0x29fb('0x1d')](_0x5228b4);}};}function respondWithFilteredResult(_0x489ba6,_0x57f762){return function(_0x11a84b){if(_0x11a84b){var _0x2f5e6a=typeof _0x57f762[_0x29fb('0x1e')]===_0x29fb('0x1f')&&typeof _0x57f762['limit']===_0x29fb('0x1f');var _0x5bdc89=_0x11a84b[_0x29fb('0x20')];var _0x1c5d7f=_0x2f5e6a?0x0:_0x57f762['offset'];var _0x474dd6=_0x2f5e6a?_0x11a84b['count']:_0x57f762['offset']+_0x57f762[_0x29fb('0x21')];var _0x339c67;if(_0x474dd6>=_0x5bdc89){_0x474dd6=_0x5bdc89;_0x339c67=0xc8;}else{_0x339c67=0xce;}_0x489ba6[_0x29fb('0x1c')](_0x339c67);return _0x489ba6[_0x29fb('0x22')](_0x29fb('0x23'),_0x1c5d7f+'-'+_0x474dd6+'/'+_0x5bdc89)[_0x29fb('0x1d')](_0x11a84b);}return null;};}function patchUpdates(_0x4b70b0){return function(_0x3f3d12){try{jsonpatch[_0x29fb('0x24')](_0x3f3d12,_0x4b70b0,!![]);}catch(_0x5ec36a){return BPromise[_0x29fb('0x25')](_0x5ec36a);}return _0x3f3d12[_0x29fb('0x26')]();};}function saveUpdates(_0x41b08c,_0x162a66){return function(_0x78cfdd){if(_0x78cfdd){return _0x78cfdd['update'](_0x41b08c)[_0x29fb('0x27')](function(_0x3e0338){return _0x3e0338;});}return null;};}function removeEntity(_0x46db0a,_0x481605){return function(_0x151da2){if(_0x151da2){return _0x151da2[_0x29fb('0x28')]()[_0x29fb('0x27')](function(){var _0xb2907=_0x151da2[_0x29fb('0x29')]({'plain':!![]});var _0x4f9140=_0x29fb('0x2a');return db[_0x29fb('0x2b')][_0x29fb('0x28')]({'where':{'type':_0x4f9140,'resourceId':_0xb2907['id']}})['then'](function(){return _0x151da2;});})['then'](function(){_0x46db0a['status'](0xcc)[_0x29fb('0x2c')]();});}};}function handleEntityNotFound(_0x36157d,_0x3d39a4){return function(_0x15c822){if(!_0x15c822){_0x36157d[_0x29fb('0x1b')](0x194);}return _0x15c822;};}function handleError(_0x482c1a,_0x39555c){_0x39555c=_0x39555c||0x1f4;return function(_0x5cf944){logger['error'](_0x5cf944['stack']);if(_0x5cf944['name']){delete _0x5cf944[_0x29fb('0x2d')];}_0x482c1a[_0x29fb('0x1c')](_0x39555c)[_0x29fb('0x2e')](_0x5cf944);};}exports['index']=function(_0x3f494c,_0xf1b663){var _0x245a70={},_0x2601c4={},_0x516ca3={'count':0x0,'rows':[]};var _0x46ac52=_[_0x29fb('0x2f')](db[_0x29fb('0x30')][_0x29fb('0x31')],function(_0x35af7b){return{'name':_0x35af7b[_0x29fb('0x32')],'type':_0x35af7b[_0x29fb('0x33')][_0x29fb('0x34')]};});_0x2601c4[_0x29fb('0x35')]=_[_0x29fb('0x2f')](_0x46ac52,_0x29fb('0x2d'));_0x2601c4[_0x29fb('0x36')]=_[_0x29fb('0x37')](_0x3f494c['query']);_0x2601c4[_0x29fb('0x38')]=_[_0x29fb('0x39')](_0x2601c4[_0x29fb('0x35')],_0x2601c4[_0x29fb('0x36')]);_0x245a70[_0x29fb('0x3a')]=_[_0x29fb('0x39')](_0x2601c4['model'],qs[_0x29fb('0x3b')](_0x3f494c[_0x29fb('0x36')][_0x29fb('0x3b')]));_0x245a70[_0x29fb('0x3a')]=_0x245a70[_0x29fb('0x3a')][_0x29fb('0x3c')]?_0x245a70['attributes']:_0x2601c4[_0x29fb('0x35')];if(!_0x3f494c[_0x29fb('0x36')][_0x29fb('0x3d')](_0x29fb('0x3e'))){_0x245a70[_0x29fb('0x21')]=qs[_0x29fb('0x21')](_0x3f494c['query'][_0x29fb('0x21')]);_0x245a70[_0x29fb('0x1e')]=qs[_0x29fb('0x1e')](_0x3f494c[_0x29fb('0x36')][_0x29fb('0x1e')]);}_0x245a70['order']=qs[_0x29fb('0x3f')](_0x3f494c[_0x29fb('0x36')][_0x29fb('0x3f')]);_0x245a70[_0x29fb('0x40')]=qs[_0x29fb('0x38')](_[_0x29fb('0x41')](_0x3f494c['query'],_0x2601c4[_0x29fb('0x38')]),_0x46ac52);if(_0x3f494c[_0x29fb('0x36')][_0x29fb('0x42')]){_0x245a70['where']=_[_0x29fb('0x43')](_0x245a70[_0x29fb('0x40')],{'$or':_['map'](_0x46ac52,function(_0x443538){if(_0x443538['type']!==_0x29fb('0x44')){var _0x4c05e4={};_0x4c05e4[_0x443538[_0x29fb('0x2d')]]={'$like':'%'+_0x3f494c[_0x29fb('0x36')]['filter']+'%'};return _0x4c05e4;}})});}_0x245a70=_[_0x29fb('0x43')]({},_0x245a70,_0x3f494c['options']);var _0x3f9102={'where':_0x245a70[_0x29fb('0x40')]};return db['Pause'][_0x29fb('0x20')](_0x3f9102)[_0x29fb('0x27')](function(_0x576404){_0x516ca3[_0x29fb('0x20')]=_0x576404;if(_0x3f494c[_0x29fb('0x36')][_0x29fb('0x45')]){_0x245a70['include']=[{'all':!![]}];}return db[_0x29fb('0x30')][_0x29fb('0x46')](_0x245a70);})[_0x29fb('0x27')](function(_0x36c303){_0x516ca3[_0x29fb('0x47')]=_0x36c303;return _0x516ca3;})[_0x29fb('0x27')](respondWithFilteredResult(_0xf1b663,_0x245a70))[_0x29fb('0x48')](handleError(_0xf1b663,null));};exports['show']=function(_0x5afd0a,_0x5a2a8c){var _0x2c20ce={'raw':!![],'where':{'id':_0x5afd0a[_0x29fb('0x49')]['id']}},_0x328e5a={};_0x328e5a[_0x29fb('0x35')]=_[_0x29fb('0x37')](db[_0x29fb('0x30')][_0x29fb('0x31')]);_0x328e5a[_0x29fb('0x36')]=_[_0x29fb('0x37')](_0x5afd0a[_0x29fb('0x36')]);_0x328e5a[_0x29fb('0x38')]=_[_0x29fb('0x39')](_0x328e5a[_0x29fb('0x35')],_0x328e5a[_0x29fb('0x36')]);_0x2c20ce[_0x29fb('0x3a')]=_[_0x29fb('0x39')](_0x328e5a[_0x29fb('0x35')],qs[_0x29fb('0x3b')](_0x5afd0a[_0x29fb('0x36')]['fields']));_0x2c20ce[_0x29fb('0x3a')]=_0x2c20ce[_0x29fb('0x3a')][_0x29fb('0x3c')]?_0x2c20ce['attributes']:_0x328e5a[_0x29fb('0x35')];if(_0x5afd0a[_0x29fb('0x36')][_0x29fb('0x45')]){_0x2c20ce['include']=[{'all':!![]}];}_0x2c20ce=_[_0x29fb('0x43')]({},_0x2c20ce,_0x5afd0a[_0x29fb('0x4a')]);return db[_0x29fb('0x30')]['find'](_0x2c20ce)[_0x29fb('0x27')](handleEntityNotFound(_0x5a2a8c,null))[_0x29fb('0x27')](respondWithResult(_0x5a2a8c,null))['catch'](handleError(_0x5a2a8c,null));};exports[_0x29fb('0x4b')]=function(_0x4886ec,_0x3b2b8a){return db['Pause']['create'](_0x4886ec[_0x29fb('0x4c')],{})['then'](function(_0x2794b2){var _0xdadafd=_0x4886ec[_0x29fb('0x4d')][_0x29fb('0x29')]({'plain':!![]});if(!_0xdadafd)throw new Error(_0x29fb('0x4e'));if(_0xdadafd['role']==='user'){var _0x5bbaf3=_0x2794b2[_0x29fb('0x29')]({'plain':!![]});var _0x4a80d6='Pauses';return db[_0x29fb('0x4f')][_0x29fb('0x50')]({'where':{'name':_0x4a80d6,'userProfileId':_0xdadafd['userProfileId']},'raw':!![]})[_0x29fb('0x27')](function(_0x4e67db){if(_0x4e67db&&_0x4e67db['autoAssociation']===0x0){return db[_0x29fb('0x2b')][_0x29fb('0x4b')]({'name':_0x5bbaf3[_0x29fb('0x2d')],'resourceId':_0x5bbaf3['id'],'type':_0x4e67db[_0x29fb('0x2d')],'sectionId':_0x4e67db['id']},{})[_0x29fb('0x27')](function(){return _0x2794b2;});}else{return _0x2794b2;}})['catch'](function(_0x2fc9a5){logger[_0x29fb('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc9a5);throw _0x2fc9a5;});}return _0x2794b2;})[_0x29fb('0x27')](respondWithResult(_0x3b2b8a,0xc9))['catch'](handleError(_0x3b2b8a,null));};exports[_0x29fb('0x52')]=function(_0x2b5961,_0x237d10){if(_0x2b5961[_0x29fb('0x4c')]['id']){delete _0x2b5961[_0x29fb('0x4c')]['id'];}return db[_0x29fb('0x30')]['find']({'where':{'id':_0x2b5961['params']['id']}})[_0x29fb('0x27')](handleEntityNotFound(_0x237d10,null))[_0x29fb('0x27')](saveUpdates(_0x2b5961[_0x29fb('0x4c')],null))[_0x29fb('0x27')](respondWithResult(_0x237d10,null))[_0x29fb('0x48')](handleError(_0x237d10,null));};exports[_0x29fb('0x28')]=function(_0x123c4d,_0x5c2095){return db[_0x29fb('0x30')][_0x29fb('0x50')]({'where':{'id':_0x123c4d[_0x29fb('0x49')]['id']}})[_0x29fb('0x27')](handleEntityNotFound(_0x5c2095,null))['then'](removeEntity(_0x5c2095,null))['catch'](handleError(_0x5c2095,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b59bd0b..16cf832 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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x18b36c,_0x3fd9e5){var _0x3efbfa=function(_0x87e516){while(--_0x87e516){_0x18b36c['push'](_0x18b36c['shift']());}};_0x3efbfa(++_0x3fd9e5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x555ec3,_0x262d98){_0x555ec3=_0x555ec3-0x0;var _0x16bed4=_0x8ef6[_0x555ec3];return _0x16bed4;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xc0cef,_0x2a464c){var _0x1e0cf2=function(_0x5b8335){while(--_0x5b8335){_0xc0cef['push'](_0xc0cef['shift']());}};_0x1e0cf2(++_0x2a464c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3d3167,_0x10240b){_0x3d3167=_0x3d3167-0x0;var _0x57ca6d=_0x1cb9[_0x3d3167];return _0x57ca6d;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index fcc3666..054d54d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x534791,_0x430577){var _0x5ce4cb=function(_0x37bbcb){while(--_0x37bbcb){_0x534791['push'](_0x534791['shift']());}};_0x5ce4cb(++_0x430577);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cd65a,_0x29fa8f){_0x1cd65a=_0x1cd65a-0x0;var _0xf93849=_0xb10b[_0x1cd65a];return _0xf93849;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x537607,_0x2a928f){var _0x25e583=function(_0x18fc97){while(--_0x18fc97){_0x537607['push'](_0x537607['shift']());}};_0x25e583(++_0x2a928f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a5852,_0x21f861){_0x1a5852=_0x1a5852-0x0;var _0x4080ca=_0xb10b[_0x1a5852];return _0x4080ca;};'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 587be3e..6271e24 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 _0xac31=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','single','file','upload','put','update','delete','exports','multer','util'];(function(_0x504b54,_0x282c60){var _0x33f872=function(_0x159f39){while(--_0x159f39){_0x504b54['push'](_0x504b54['shift']());}};_0x33f872(++_0x282c60);}(_0xac31,0xca));var _0x1ac3=function(_0x834ebb,_0x1eb999){_0x834ebb=_0x834ebb-0x0;var _0x42223b=_0xac31[_0x834ebb];return _0x42223b;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./plugin.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0xb')](_0x1ac3('0x10'),auth['isAuthenticated'](),controller[_0x1ac3('0x11')]);var upload=multer({'storage':multer[_0x1ac3('0x12')]({'destination':function(_0x3e835b,_0x24f0d2,_0x2a8dc7){_0x2a8dc7(null,path[_0x1ac3('0x13')](config['root'],_0x1ac3('0x14')));},'filename':function(_0x376814,_0x2eeabf,_0x2338b9){_0x2eeabf['originalname']=_0x2eeabf[_0x1ac3('0x15')][_0x1ac3('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2338b9(null,util[_0x1ac3('0x17')](_0x1ac3('0x18'),path['basename'](_0x2eeabf[_0x1ac3('0x15')],path[_0x1ac3('0x19')](_0x2eeabf['originalname'])),Date[_0x1ac3('0x1a')](),path[_0x1ac3('0x19')](_0x2eeabf[_0x1ac3('0x15')])));}})});router['post']('/',upload[_0x1ac3('0x1b')](_0x1ac3('0x1c')),controller[_0x1ac3('0x1d')]);router['post'](_0x1ac3('0xc'),controller['webhookPost']);router[_0x1ac3('0x1e')](_0x1ac3('0xe'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x1f')]);router[_0x1ac3('0x20')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x20')]);module[_0x1ac3('0x21')]=router; \ No newline at end of file +var _0x4c4e=['webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook'];(function(_0xc3050a,_0x3f50b5){var _0x433e7a=function(_0x1fd962){while(--_0x1fd962){_0xc3050a['push'](_0xc3050a['shift']());}};_0x433e7a(++_0x3f50b5);}(_0x4c4e,0x152));var _0xe4c4=function(_0x2894ce,_0x59911c){_0x2894ce=_0x2894ce-0x0;var _0x520a13=_0x4c4e[_0x2894ce];return _0x520a13;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['show']);router['get'](_0xe4c4('0xe'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);var upload=multer({'storage':multer[_0xe4c4('0x10')]({'destination':function(_0x333c08,_0x2f4d5f,_0x50264f){_0x50264f(null,path[_0xe4c4('0x11')](config[_0xe4c4('0x12')],_0xe4c4('0x13')));},'filename':function(_0x2483d0,_0x50bfab,_0x262083){_0x50bfab[_0xe4c4('0x14')]=_0x50bfab['originalname'][_0xe4c4('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x262083(null,util[_0xe4c4('0x16')]('%s-%s%s',path[_0xe4c4('0x17')](_0x50bfab[_0xe4c4('0x14')],path['extname'](_0x50bfab[_0xe4c4('0x14')])),Date[_0xe4c4('0x18')](),path[_0xe4c4('0x19')](_0x50bfab[_0xe4c4('0x14')])));}})});router[_0xe4c4('0x1a')]('/',upload[_0xe4c4('0x1b')](_0xe4c4('0x1c')),controller[_0xe4c4('0x1d')]);router[_0xe4c4('0x1a')](_0xe4c4('0xb'),controller[_0xe4c4('0x1e')]);router[_0xe4c4('0x1f')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x20')]);router['delete'](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x21')]);module[_0xe4c4('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c7edfc3..4e49f9a 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 _0xe857=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM'];(function(_0x3ad133,_0x377068){var _0x33b86a=function(_0xda36c2){while(--_0xda36c2){_0x3ad133['push'](_0x3ad133['shift']());}};_0x33b86a(++_0x377068);}(_0xe857,0xdd));var _0x7e85=function(_0x597754,_0x2d9f95){_0x597754=_0x597754-0x0;var _0x49e7ef=_0xe857[_0x597754];return _0x49e7ef;};'use strict';var Sequelize=require(_0x7e85('0x0'));module[_0x7e85('0x1')]={'name':{'type':Sequelize[_0x7e85('0x2')]},'type':{'type':Sequelize[_0x7e85('0x3')](_0x7e85('0x4'),_0x7e85('0x5'))},'description':{'type':Sequelize[_0x7e85('0x6')]},'version':{'type':Sequelize[_0x7e85('0x6')]},'path':{'type':Sequelize[_0x7e85('0x2')],'comment':_0x7e85('0x7')},'active':{'type':Sequelize[_0x7e85('0x8')],'defaultValue':0x0,'comment':_0x7e85('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0x7e85('0xa'),_0x7e85('0xb'),'always',_0x7e85('0xc')),'defaultValue':_0x7e85('0xd'),'comment':_0x7e85('0xe')},'icon':{'type':Sequelize[_0x7e85('0x2')]},'adminUrl':{'type':Sequelize[_0x7e85('0x2')]},'agentUrl':{'type':Sequelize[_0x7e85('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x7e85('0x2')]}}; \ No newline at end of file +var _0xf79c=['exports','ENUM','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','sequelize'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0xf79c,0x107));var _0xcf79=function(_0x12143c,_0x47dfa9){_0x12143c=_0x12143c-0x0;var _0x12e594=_0xf79c[_0x12143c];return _0x12e594;};'use strict';var Sequelize=require(_0xcf79('0x0'));module[_0xcf79('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcf79('0x2')]('html','script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xcf79('0x3')]},'path':{'type':Sequelize[_0xcf79('0x4')],'comment':_0xcf79('0x5')},'active':{'type':Sequelize[_0xcf79('0x6')],'defaultValue':0x0,'comment':_0xcf79('0x7')},'sidebar':{'type':Sequelize[_0xcf79('0x2')](_0xcf79('0x8'),_0xcf79('0x9'),_0xcf79('0xa'),_0xcf79('0xb')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xcf79('0x4')]},'agentUrl':{'type':Sequelize[_0xcf79('0x4')]},'scriptName':{'type':Sequelize[_0xcf79('0x4')]},'scriptPath':{'type':Sequelize[_0xcf79('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 910b52e..6774854 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 _0x1906=['sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','fields','length','include','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','version','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','role','body','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','headers','content-length','content-type','set','statusCode','webhookPost','%s%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','extract-zip','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','limit','Content-Range','reject','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','nolimit','order'];(function(_0x491eeb,_0x194066){var _0x123d15=function(_0x35d5d6){while(--_0x35d5d6){_0x491eeb['push'](_0x491eeb['shift']());}};_0x123d15(++_0x194066);}(_0x1906,0x69));var _0x6190=function(_0x40ce4f,_0x3cf557){_0x40ce4f=_0x40ce4f-0x0;var _0xb9b23d=_0x1906[_0x40ce4f];return _0xb9b23d;};'use strict';var emlformat=require(_0x6190('0x0'));var rimraf=require(_0x6190('0x1'));var zipdir=require(_0x6190('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6190('0x3'));var moment=require(_0x6190('0x4'));var BPromise=require(_0x6190('0x5'));var Mustache=require(_0x6190('0x6'));var util=require(_0x6190('0x7'));var path=require(_0x6190('0x8'));var sox=require('sox');var csv=require(_0x6190('0x9'));var ejs=require(_0x6190('0xa'));var fs=require('fs');var fs_extra=require(_0x6190('0xb'));var _=require('lodash');var squel=require(_0x6190('0xc'));var crypto=require(_0x6190('0xd'));var jsforce=require(_0x6190('0xe'));var deskjs=require(_0x6190('0xf'));var toCsv=require(_0x6190('0x9'));var querystring=require('querystring');var Papa=require(_0x6190('0x10'));var extract=require(_0x6190('0x11'));var rimraf=require(_0x6190('0x1'));var archiver=require('archiver');var Redis=require(_0x6190('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6190('0x13'));var hardwareService=require(_0x6190('0x14'));var logger=require(_0x6190('0x15'))(_0x6190('0x16'));var utils=require('../../config/utils');var config=require(_0x6190('0x17'));var licenseUtil=require(_0x6190('0x18'));var db=require(_0x6190('0x19'))['db'];config[_0x6190('0x1a')]=_['defaults'](config[_0x6190('0x1a')],{'host':_0x6190('0x1b'),'port':0x18eb});var socket=require(_0x6190('0x1c'))(new Redis(config[_0x6190('0x1a')]));require(_0x6190('0x1d'))[_0x6190('0x1e')](socket);function respondWithStatusCode(_0x4461b3,_0x58628c){_0x58628c=_0x58628c||0xcc;return function(_0x3d7c8f){if(_0x3d7c8f){return _0x4461b3[_0x6190('0x1f')](_0x58628c);}return _0x4461b3[_0x6190('0x20')](_0x58628c)['end']();};}function respondWithResult(_0xc4223d,_0x24dd2e){_0x24dd2e=_0x24dd2e||0xc8;return function(_0x51752e){if(_0x51752e){return _0xc4223d[_0x6190('0x20')](_0x24dd2e)['json'](_0x51752e);}};}function respondWithFilteredResult(_0x15bc44,_0x54f7d1){return function(_0x173005){if(_0x173005){var _0x2420ae=typeof _0x54f7d1[_0x6190('0x21')]===_0x6190('0x22')&&typeof _0x54f7d1[_0x6190('0x23')]===_0x6190('0x22');var _0x403e09=_0x173005['count'];var _0x137620=_0x2420ae?0x0:_0x54f7d1[_0x6190('0x21')];var _0x18b05d=_0x2420ae?_0x173005['count']:_0x54f7d1[_0x6190('0x21')]+_0x54f7d1['limit'];var _0x17be94;if(_0x18b05d>=_0x403e09){_0x18b05d=_0x403e09;_0x17be94=0xc8;}else{_0x17be94=0xce;}_0x15bc44[_0x6190('0x20')](_0x17be94);return _0x15bc44['set'](_0x6190('0x24'),_0x137620+'-'+_0x18b05d+'/'+_0x403e09)['json'](_0x173005);}return null;};}function patchUpdates(_0x83f1b6){return function(_0x488e33){try{jsonpatch['apply'](_0x488e33,_0x83f1b6,!![]);}catch(_0x3bdc33){return BPromise[_0x6190('0x25')](_0x3bdc33);}return _0x488e33['save']();};}function saveUpdates(_0x406c6d,_0x448323){return function(_0x182c51){if(_0x182c51){return _0x182c51['update'](_0x406c6d)[_0x6190('0x26')](function(_0x46957b){return _0x46957b;});}return null;};}function removeEntity(_0x40fbb9,_0x4fec66){return function(_0x4c82ba){if(_0x4c82ba){return _0x4c82ba[_0x6190('0x27')]()[_0x6190('0x26')](function(){var _0x1b95e6=_0x4c82ba[_0x6190('0x28')]({'plain':!![]});var _0x1d0a58=_0x6190('0x29');return db[_0x6190('0x2a')][_0x6190('0x27')]({'where':{'type':_0x1d0a58,'resourceId':_0x1b95e6['id']}})[_0x6190('0x26')](function(){return _0x4c82ba;});})['then'](function(){_0x40fbb9[_0x6190('0x20')](0xcc)[_0x6190('0x2b')]();});}};}function handleEntityNotFound(_0x5dc993,_0x161b71){return function(_0x2a2ab1){if(!_0x2a2ab1){_0x5dc993[_0x6190('0x1f')](0x194);}return _0x2a2ab1;};}function handleError(_0x2aadee,_0x8a7b53){_0x8a7b53=_0x8a7b53||0x1f4;return function(_0x52d9e1){logger[_0x6190('0x2c')](_0x52d9e1[_0x6190('0x2d')]);if(_0x52d9e1[_0x6190('0x2e')]){delete _0x52d9e1['name'];}_0x2aadee['status'](_0x8a7b53)[_0x6190('0x2f')](_0x52d9e1);};}exports[_0x6190('0x30')]=function(_0x40537e,_0x4a577e){var _0x3eb08c={},_0x327d8d={},_0x2fd4dc={'count':0x0,'rows':[]};var _0x5c88af=_[_0x6190('0x31')](db[_0x6190('0x32')][_0x6190('0x33')],function(_0x226090){return{'name':_0x226090[_0x6190('0x34')],'type':_0x226090['type'][_0x6190('0x35')]};});_0x327d8d[_0x6190('0x36')]=_[_0x6190('0x31')](_0x5c88af,_0x6190('0x2e'));_0x327d8d[_0x6190('0x37')]=_[_0x6190('0x38')](_0x40537e[_0x6190('0x37')]);_0x327d8d['filters']=_[_0x6190('0x39')](_0x327d8d[_0x6190('0x36')],_0x327d8d[_0x6190('0x37')]);_0x3eb08c[_0x6190('0x3a')]=_['intersection'](_0x327d8d['model'],qs['fields'](_0x40537e[_0x6190('0x37')]['fields']));_0x3eb08c[_0x6190('0x3a')]=_0x3eb08c['attributes']['length']?_0x3eb08c[_0x6190('0x3a')]:_0x327d8d['model'];if(!_0x40537e[_0x6190('0x37')]['hasOwnProperty'](_0x6190('0x3b'))){_0x3eb08c['limit']=qs[_0x6190('0x23')](_0x40537e[_0x6190('0x37')][_0x6190('0x23')]);_0x3eb08c[_0x6190('0x21')]=qs[_0x6190('0x21')](_0x40537e[_0x6190('0x37')]['offset']);}_0x3eb08c[_0x6190('0x3c')]=qs['sort'](_0x40537e[_0x6190('0x37')][_0x6190('0x3d')]);_0x3eb08c['where']=qs[_0x6190('0x3e')](_[_0x6190('0x3f')](_0x40537e[_0x6190('0x37')],_0x327d8d[_0x6190('0x3e')]),_0x5c88af);if(_0x40537e[_0x6190('0x37')][_0x6190('0x40')]){_0x3eb08c[_0x6190('0x41')]=_[_0x6190('0x42')](_0x3eb08c[_0x6190('0x41')],{'$or':_[_0x6190('0x31')](_0x5c88af,function(_0x2bf379){if(_0x2bf379['type']!==_0x6190('0x43')){var _0x517e0b={};_0x517e0b[_0x2bf379['name']]={'$like':'%'+_0x40537e[_0x6190('0x37')][_0x6190('0x40')]+'%'};return _0x517e0b;}})});}_0x3eb08c=_[_0x6190('0x42')]({},_0x3eb08c,_0x40537e[_0x6190('0x44')]);var _0x6db435={'where':_0x3eb08c[_0x6190('0x41')]};return db['Plugin'][_0x6190('0x45')](_0x6db435)[_0x6190('0x26')](function(_0x271a34){_0x2fd4dc['count']=_0x271a34;if(_0x40537e[_0x6190('0x37')][_0x6190('0x46')]){_0x3eb08c['include']=[{'all':!![]}];}return db[_0x6190('0x32')][_0x6190('0x47')](_0x3eb08c);})[_0x6190('0x26')](function(_0x40e942){_0x2fd4dc[_0x6190('0x48')]=_0x40e942;return _0x2fd4dc;})[_0x6190('0x26')](respondWithFilteredResult(_0x4a577e,_0x3eb08c))[_0x6190('0x49')](handleError(_0x4a577e,null));};exports['show']=function(_0x693573,_0x3002bf){var _0x24312b={'raw':!![],'where':{'id':_0x693573[_0x6190('0x4a')]['id']}},_0x5d53ba={};_0x5d53ba[_0x6190('0x36')]=_[_0x6190('0x38')](db['Plugin'][_0x6190('0x33')]);_0x5d53ba[_0x6190('0x37')]=_[_0x6190('0x38')](_0x693573[_0x6190('0x37')]);_0x5d53ba['filters']=_['intersection'](_0x5d53ba[_0x6190('0x36')],_0x5d53ba[_0x6190('0x37')]);_0x24312b[_0x6190('0x3a')]=_[_0x6190('0x39')](_0x5d53ba[_0x6190('0x36')],qs[_0x6190('0x4b')](_0x693573[_0x6190('0x37')][_0x6190('0x4b')]));_0x24312b[_0x6190('0x3a')]=_0x24312b['attributes'][_0x6190('0x4c')]?_0x24312b[_0x6190('0x3a')]:_0x5d53ba[_0x6190('0x36')];if(_0x693573[_0x6190('0x37')]['includeAll']){_0x24312b[_0x6190('0x4d')]=[{'all':!![]}];}_0x24312b=_['merge']({},_0x24312b,_0x693573[_0x6190('0x44')]);return db[_0x6190('0x32')][_0x6190('0x4e')](_0x24312b)[_0x6190('0x26')](handleEntityNotFound(_0x3002bf,null))['then'](respondWithResult(_0x3002bf,null))['catch'](handleError(_0x3002bf,null));};exports['download']=function(_0x3a774d,_0x507c8c,_0x331caa){return db[_0x6190('0x32')][_0x6190('0x4e')]({'where':{'id':_0x3a774d[_0x6190('0x4a')]['id']},'attributes':[_0x6190('0x2e'),_0x6190('0x8')],'raw':!![]})[_0x6190('0x26')](handleEntityNotFound(_0x507c8c,null))[_0x6190('0x26')](function(_0x162d8d){if(_0x162d8d){var _0x3f5ee9=path[_0x6190('0x4f')](config[_0x6190('0x50')],_0x6190('0x51'),util[_0x6190('0x52')](_0x6190('0x53'),path[_0x6190('0x54')](_0x162d8d['path'])));var _0x1c0db2=fs[_0x6190('0x55')](_0x3f5ee9);var _0x5424eb=archiver('zip',{'zlib':{'level':0x9}});_0x5424eb['on'](_0x6190('0x56'),function(_0x29ec3f){if(_0x29ec3f[_0x6190('0x57')]===_0x6190('0x58')){logger[_0x6190('0x2c')](_0x29ec3f);}else{throw new db[(_0x6190('0x59'))][(_0x6190('0x5a'))](_0x6190('0x5b'));}});_0x5424eb['on'](_0x6190('0x2c'),function(_0x1cca00){throw new db[(_0x6190('0x59'))][(_0x6190('0x5a'))](_0x6190('0x5b'));});_0x5424eb[_0x6190('0x5c')](_0x1c0db2);_0x5424eb[_0x6190('0x5d')](_0x6190('0x5e'),{'cwd':path[_0x6190('0x4f')](config[_0x6190('0x50')],'server/files/plugins',path['dirname'](_0x162d8d[_0x6190('0x8')])),'ignore':[path[_0x6190('0x4f')](path[_0x6190('0x54')](_0x162d8d['path']),_0x6190('0x5f')),path[_0x6190('0x4f')](path[_0x6190('0x54')](_0x162d8d[_0x6190('0x8')]),_0x6190('0x60'))],'nodir':!![]})['finalize']();_0x1c0db2['on']('close',function(){if(!fs[_0x6190('0x61')](_0x3f5ee9)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x507c8c[_0x6190('0x62')](_0x3f5ee9,util[_0x6190('0x52')](_0x6190('0x53'),path['basename'](_0x162d8d['path'])),function(_0x81dd80){if(_0x81dd80){throw new db[(_0x6190('0x59'))]['Error'](_0x6190('0x63'));}fs[_0x6190('0x64')](_0x3f5ee9);logger['info'](_0x6190('0x65'));logger[_0x6190('0x66')](_0x6190('0x67'));});});}return null;})['catch'](handleError(_0x507c8c,null));};exports['upload']=function(_0x3cd194,_0x304658,_0x449005){var _0x239463=path[_0x6190('0x54')](_0x3cd194['file']['filename'],path[_0x6190('0x68')](_0x3cd194[_0x6190('0x69')][_0x6190('0x6a')]));var _0x46169a=path['join'](config[_0x6190('0x50')],'server/files/plugins',_0x3cd194[_0x6190('0x69')][_0x6190('0x6a')]);var _0xdd3b93=path['join'](config[_0x6190('0x50')],_0x6190('0x51'),_0x239463);logger[_0x6190('0x66')](_0x6190('0x6b'),_0x46169a);logger[_0x6190('0x66')](_0x6190('0x6c'),_0xdd3b93);try{fs['chmodSync'](_0x46169a,parseInt(_0x6190('0x6d'),0x8));extract(_0x46169a,{'dir':_0xdd3b93},function(_0x254b4e){if(_0x254b4e){logger['error'](_0x254b4e);handleError(_0x254b4e,!![]);};var _0x4928c0=fs['readdirSync'](_0xdd3b93);if(_0x4928c0[_0x6190('0x4c')]>0x1){removeReferences(_0x46169a,_0xdd3b93);logger[_0x6190('0x2c')]('Invalid\x20plugin\x20structure');return _0x449005(new Error(_0x6190('0x6e')));}var _0x5f74cc=fs['lstatSync'](path[_0x6190('0x4f')](_0xdd3b93,_0x4928c0[0x0]));if(_0x5f74cc[_0x6190('0x6f')]()){removeReferences(_0x46169a,_0xdd3b93);logger[_0x6190('0x2c')](_0x6190('0x6e'));return _0x449005(new Error(_0x6190('0x6e')));}if(_0x5f74cc[_0x6190('0x70')]()){var _0x34701c=fs[_0x6190('0x71')](path[_0x6190('0x4f')](_0xdd3b93,_0x4928c0[0x0]));if(_0x34701c[_0x6190('0x4c')]===0x0){removeReferences(_0x46169a,_0xdd3b93);logger['error'](_0x6190('0x6e'));return _0x449005(new Error('Invalid\x20plugin\x20structure'));}var _0x362687=_0x34701c['some'](function(_0x484151){return _0x484151===_0x6190('0x72');});if(!_0x362687){return _0x449005(new Error(_0x6190('0x73')));}var _0x2f2a9e=fs[_0x6190('0x74')](path['join'](_0xdd3b93,_0x4928c0[0x0],_0x6190('0x72')));var _0x4a621d=JSON[_0x6190('0x75')](_0x2f2a9e);if(_0x6190('0x22')==typeof _0x4a621d[_0x6190('0x2e')]){return _0x449005(new Error(_0x6190('0x76')));}if(_0x6190('0x22')==typeof _0x4a621d[_0x6190('0x77')]){return _0x449005(new Error(_0x6190('0x78')));}if('undefined'==typeof _0x4a621d['version']){return _0x449005(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x6190('0x22')==typeof _0x4a621d['parameters']){return _0x449005(new Error(_0x6190('0x79')));}if(_0x4a621d['type']==='html'){if(_0x6190('0x22')==typeof _0x4a621d[_0x6190('0x7a')][_0x6190('0x7b')]){return _0x449005(new Error(_0x6190('0x7c')));}if(_0x6190('0x22')==typeof _0x4a621d[_0x6190('0x7a')]['views'][_0x6190('0x7d')]&&_0x6190('0x22')==typeof _0x4a621d['parameters'][_0x6190('0x7b')][_0x6190('0x7e')]){return _0x449005(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4a621d[_0x6190('0x77')]===_0x6190('0x7f')){if('undefined'==typeof _0x4a621d[_0x6190('0x7a')][_0x6190('0x80')]){return _0x449005(new Error(_0x6190('0x81')));}if('undefined'==typeof _0x4a621d['parameters']['scriptPath']){return _0x449005(new Error(_0x6190('0x82')));}}else{return _0x449005(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x22fc34=_0x4a621d[_0x6190('0x2e')];var _0x1adc6e=_0x4a621d[_0x6190('0x83')];var _0xabbebf=_0x4a621d[_0x6190('0x77')];var _0x3c5db4=_0x4a621d[_0x6190('0x84')]?_0x4a621d[_0x6190('0x84')]:'always';var _0xfc0727=_0x4a621d[_0x6190('0x85')]?_0x4a621d[_0x6190('0x85')]:'icon-apps';var _0x321cdc='';var _0x1f052c='';var _0x561b6d='';var _0x3510e9='';var _0x5a34d9=_0x4a621d[_0x6190('0x86')];if(_0xabbebf===_0x6190('0x87')){if(_0x6190('0x22')!=typeof _0x4a621d[_0x6190('0x7a')][_0x6190('0x7b')][_0x6190('0x7d')]){var _0x331197=_0x4a621d[_0x6190('0x7a')][_0x6190('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x6190('0x88')](_0x331197)){_0x321cdc=path[_0x6190('0x4f')](_0x6190('0x89'),_0x239463,_0x4928c0[0x0],_0x331197);}else{_0x321cdc=_0x331197;}}else{logger[_0x6190('0x66')](_0x6190('0x8a'));}if(_0x6190('0x22')!=typeof _0x4a621d[_0x6190('0x7a')][_0x6190('0x7b')][_0x6190('0x7e')]){var _0x5b88a7=_0x4a621d[_0x6190('0x7a')][_0x6190('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6190('0x88')](_0x5b88a7)){_0x1f052c=path['join'](_0x6190('0x89'),_0x239463,_0x4928c0[0x0],_0x5b88a7);}else{_0x1f052c=_0x5b88a7;}}else{logger['info'](_0x6190('0x8b'));}}else if(_0xabbebf===_0x6190('0x7f')){_0x561b6d=_0x4a621d[_0x6190('0x7a')]['scriptName'];_0x3510e9=_0x4a621d[_0x6190('0x7a')][_0x6190('0x8c')];if(_0x6190('0x22')!=typeof _0x4a621d[_0x6190('0x7a')][_0x6190('0x7b')]){if(_0x6190('0x22')!=typeof _0x4a621d[_0x6190('0x7a')]['views'][_0x6190('0x7d')]){var _0x331197=_0x4a621d['parameters'][_0x6190('0x7b')][_0x6190('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x331197)){_0x321cdc=path[_0x6190('0x4f')](_0x6190('0x89'),_0x239463,_0x4928c0[0x0],_0x331197);}else{_0x321cdc=_0x331197;}}if(_0x6190('0x22')!=typeof _0x4a621d[_0x6190('0x7a')][_0x6190('0x7b')][_0x6190('0x7e')]){var _0x5b88a7=_0x4a621d[_0x6190('0x7a')][_0x6190('0x7b')][_0x6190('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x6190('0x88')](_0x5b88a7)){_0x1f052c=path[_0x6190('0x4f')](_0x6190('0x89'),_0x239463,_0x4928c0[0x0],_0x5b88a7);}else{_0x1f052c=_0x5b88a7;}}}}var _0x3bf5ae={'name':_0x22fc34,'description':_0x1adc6e,'path':path['join'](_0x239463,_0x4928c0[0x0]),'type':_0xabbebf,'sidebar':_0x3c5db4,'icon':_0xfc0727,'adminUrl':_0x321cdc,'agentUrl':_0x1f052c,'scriptName':_0x561b6d,'scriptPath':_0x3510e9,'version':_0x5a34d9};removeReferences(_0x46169a,null);return db[_0x6190('0x32')]['create'](_0x3bf5ae)[_0x6190('0x26')](function(_0x20ca00){var _0x198f78={'role':_0x3cd194['body'][_0x6190('0x8d')],'userProfileId':_0x3cd194[_0x6190('0x8e')]['userProfileId']};if(!_0x198f78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x198f78[_0x6190('0x8d')]==='user'){var _0x18bda2=_0x20ca00[_0x6190('0x28')]({'plain':!![]});return db[_0x6190('0x8f')]['find']({'where':{'name':'Plugins','userProfileId':_0x198f78[_0x6190('0x90')]},'raw':!![]})[_0x6190('0x26')](function(_0x1e4bfd){if(_0x1e4bfd&&_0x1e4bfd[_0x6190('0x91')]===0x0){return db['UserProfileResource'][_0x6190('0x92')]({'name':_0x18bda2['name'],'resourceId':_0x18bda2['id'],'type':_0x1e4bfd[_0x6190('0x2e')],'sectionId':_0x1e4bfd['id']},{})[_0x6190('0x26')](function(){return _0x20ca00;});}else{return _0x20ca00;}})[_0x6190('0x49')](function(_0xab08f5){logger[_0x6190('0x2c')](_0x6190('0x93'),_0xab08f5);throw _0xab08f5;});}return _0x20ca00;})[_0x6190('0x26')](respondWithResult(_0x304658,null))[_0x6190('0x49')](handleError(_0x304658,null));}});}catch(_0x3b9324){_0x304658[_0x6190('0x20')](0x1f4)['send'](_0x3b9324);}};function removeReferences(_0x3e102b,_0x578d54){try{if(_0x3e102b){fs[_0x6190('0x64')](_0x3e102b);logger[_0x6190('0x66')](_0x6190('0x94'));}if(_0x578d54){rimraf(_0x578d54,function(){});logger['info'](_0x6190('0x95'));}}catch(_0x35ad9a){logger['error'](_0x35ad9a);}}exports['update']=function(_0x2d8693,_0x54f34f,_0x556319){return db[_0x6190('0x32')][_0x6190('0x4e')]({'where':{'id':_0x2d8693['params']['id']}})[_0x6190('0x26')](handleEntityNotFound(_0x54f34f,null))[_0x6190('0x26')](saveUpdates(_0x2d8693['body'],null))['then'](respondWithResult(_0x54f34f,null))[_0x6190('0x49')](handleError(_0x54f34f,null));};exports['delete']=function(_0x3d4c7e,_0x5c2054,_0x3e8830){return db[_0x6190('0x32')][_0x6190('0x4e')]({'where':{'id':_0x3d4c7e[_0x6190('0x4a')]['id']}})[_0x6190('0x26')](function(_0x59f0a5){if(_0x59f0a5){return _0x59f0a5[_0x6190('0x27')]();}})[_0x6190('0x26')](function(_0x56647c){rimraf(path[_0x6190('0x4f')](config['root'],_0x6190('0x51'),path['dirname'](_0x56647c[_0x6190('0x8')])),function(){});return _0x56647c;})[_0x6190('0x26')](handleEntityNotFound(_0x5c2054,null))[_0x6190('0x26')](respondWithStatusCode(_0x5c2054,null))[_0x6190('0x49')](handleError(_0x5c2054,null));};exports['webhookGet']=function(_0xbc3f47,_0x50c491,_0x4e8426){return BPromise[_0x6190('0x96')]()['then'](function(){if(!_0xbc3f47['query'][_0x6190('0x8')]){throw new Error(_0x6190('0x97'));}if(!_0xbc3f47[_0x6190('0x37')][_0x6190('0x98')]){throw new Error(_0x6190('0x99'));}var _0x412aa2=_0xbc3f47['query'][_0x6190('0x9a')]?_0xbc3f47['query']['hostname']+':'+_0xbc3f47[_0x6190('0x37')]['port']:_0x6190('0x9b')+_0xbc3f47[_0x6190('0x37')]['port'];var _0x24b8a5=_0xbc3f47[_0x6190('0x37')][_0x6190('0x9c')]?_0xbc3f47[_0x6190('0x37')][_0x6190('0x9c')]:!![];var _0x22aa24=_0xbc3f47[_0x6190('0x37')][_0x6190('0x9d')]?_0xbc3f47[_0x6190('0x37')][_0x6190('0x9d')]:null;var _0x520452={'method':_0xbc3f47[_0x6190('0x9e')],'uri':util[_0x6190('0x52')]('%s%s',_0x412aa2,_0xbc3f47['query']['path']),'json':_0x24b8a5,'resolveWithFullResponse':!![],'encoding':_0x22aa24,'qs':_0xbc3f47['query']};if(_0xbc3f47['headers']){_0x520452[_0x6190('0x9f')]=_0xbc3f47[_0x6190('0x9f')];if(_0x520452[_0x6190('0x9f')][_0x6190('0xa0')]){delete _0x520452['headers'][_0x6190('0xa0')];}}if(_0x520452[_0x6190('0x9f')][_0x6190('0xa1')]){delete _0x520452[_0x6190('0x9f')][_0x6190('0xa1')];}return rp(_0x520452);})[_0x6190('0x26')](function(_0x10cfa6){if(_0x10cfa6){_0x50c491[_0x6190('0xa2')](_0x10cfa6[_0x6190('0x9f')]);logger[_0x6190('0x66')](_0x10cfa6[_0x6190('0x8e')]);if(_['endsWith'](_0xbc3f47[_0x6190('0x37')]['path'],_0x6190('0x62'))&&_0x10cfa6[_0x6190('0xa3')]==0x1f4){return _0x50c491['sendStatus'](_0x10cfa6[_0x6190('0xa3')]);}else{return _0x50c491[_0x6190('0x20')](_0x10cfa6['statusCode'])[_0x6190('0x2f')](_0x10cfa6[_0x6190('0x8e')]);}}else{return _0x50c491['sendStatus'](0xc8);}})[_0x6190('0x49')](handleError(_0x50c491,null));};exports[_0x6190('0xa4')]=function(_0x3aeeaf,_0x4a91e2,_0x3c6f37){return BPromise[_0x6190('0x96')]()[_0x6190('0x26')](function(){if(!_0x3aeeaf[_0x6190('0x37')]['path']){throw new Error(_0x6190('0x97'));}if(!_0x3aeeaf['query'][_0x6190('0x98')]){throw new Error(_0x6190('0x99'));}var _0x5482a9=_0x3aeeaf[_0x6190('0x37')]['hostname']?_0x3aeeaf[_0x6190('0x37')][_0x6190('0x9a')]+':'+_0x3aeeaf[_0x6190('0x37')][_0x6190('0x98')]:'http://localhost:'+_0x3aeeaf[_0x6190('0x37')][_0x6190('0x98')];var _0x309ea6=_0x3aeeaf[_0x6190('0x37')][_0x6190('0x9c')]?_0x3aeeaf['query'][_0x6190('0x9c')]:!![];var _0x48a653=_0x3aeeaf[_0x6190('0x37')][_0x6190('0x9d')]?_0x3aeeaf['query']['encoding']:null;var _0xf229bf={'method':_0x3aeeaf['method'],'uri':util['format'](_0x6190('0xa5'),_0x5482a9,_0x3aeeaf['query'][_0x6190('0x8')]),'json':_0x309ea6,'resolveWithFullResponse':!![],'encoding':_0x48a653,'body':_0x3aeeaf['body']};if(_0x3aeeaf[_0x6190('0x9f')]){_0xf229bf[_0x6190('0x9f')]=_0x3aeeaf[_0x6190('0x9f')];if(_0xf229bf['headers'][_0x6190('0xa0')]){delete _0xf229bf['headers']['content-length'];}}if(_0xf229bf[_0x6190('0x9f')]['content-type']){delete _0xf229bf['headers'][_0x6190('0xa1')];}return rp(_0xf229bf);})[_0x6190('0x26')](function(_0x19b982){if(_0x19b982){_0x4a91e2['set'](_0x19b982[_0x6190('0x9f')]);logger[_0x6190('0x66')](_0x19b982['body']);return _0x4a91e2[_0x6190('0x20')](_0x19b982['statusCode'])['send'](_0x19b982['body']);}else{return _0x4a91e2['sendStatus'](0xc8);}})[_0x6190('0x49')](handleError(_0x4a91e2,null));}; \ No newline at end of file +var _0x5f03=['querystring','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','offset','limit','count','json','apply','save','update','destroy','then','get','Plugins','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Plugin','includeAll','include','findAll','catch','show','params','find','path','join','server/files/plugins','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','root','Plugin\x20upload\x20destination:\x20%s','readdirSync','length','lstatSync','Invalid\x20plugin\x20structure','some','manifest.json','readFileSync','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','script','admin','body','role','userProfileId','user','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','hostname','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x10a5b3,_0x54a1b8){var _0xf6449a=function(_0x55a193){while(--_0x55a193){_0x10a5b3['push'](_0x10a5b3['shift']());}};_0xf6449a(++_0x54a1b8);}(_0x5f03,0x98));var _0x35f0=function(_0x34d774,_0x22d8fb){_0x34d774=_0x34d774-0x0;var _0x5bd9a3=_0x5f03[_0x34d774];return _0x5bd9a3;};'use strict';var emlformat=require(_0x35f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35f0('0x1'));var jsonpatch=require(_0x35f0('0x2'));var rp=require(_0x35f0('0x3'));var moment=require(_0x35f0('0x4'));var BPromise=require(_0x35f0('0x5'));var Mustache=require(_0x35f0('0x6'));var util=require(_0x35f0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x35f0('0x8'));var ejs=require(_0x35f0('0x9'));var fs=require('fs');var fs_extra=require(_0x35f0('0xa'));var _=require('lodash');var squel=require(_0x35f0('0xb'));var crypto=require(_0x35f0('0xc'));var jsforce=require(_0x35f0('0xd'));var deskjs=require(_0x35f0('0xe'));var toCsv=require(_0x35f0('0x8'));var querystring=require(_0x35f0('0xf'));var Papa=require('papaparse');var extract=require(_0x35f0('0x10'));var rimraf=require(_0x35f0('0x11'));var archiver=require(_0x35f0('0x12'));var Redis=require(_0x35f0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x35f0('0x14'));var as=require(_0x35f0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x35f0('0x16'));var utils=require(_0x35f0('0x17'));var config=require(_0x35f0('0x18'));var licenseUtil=require(_0x35f0('0x19'));var db=require(_0x35f0('0x1a'))['db'];config[_0x35f0('0x1b')]=_['defaults'](config[_0x35f0('0x1b')],{'host':_0x35f0('0x1c'),'port':0x18eb});var socket=require(_0x35f0('0x1d'))(new Redis(config[_0x35f0('0x1b')]));require(_0x35f0('0x1e'))[_0x35f0('0x1f')](socket);function respondWithStatusCode(_0x4262f4,_0x47e5a6){_0x47e5a6=_0x47e5a6||0xcc;return function(_0x13476d){if(_0x13476d){return _0x4262f4['sendStatus'](_0x47e5a6);}return _0x4262f4[_0x35f0('0x20')](_0x47e5a6)[_0x35f0('0x21')]();};}function respondWithResult(_0x35a0e5,_0x3b96d3){_0x3b96d3=_0x3b96d3||0xc8;return function(_0x3360d5){if(_0x3360d5){return _0x35a0e5[_0x35f0('0x20')](_0x3b96d3)['json'](_0x3360d5);}};}function respondWithFilteredResult(_0x2c1817,_0x43b0e0){return function(_0x5a8921){if(_0x5a8921){var _0x3d7f08=typeof _0x43b0e0[_0x35f0('0x22')]==='undefined'&&typeof _0x43b0e0[_0x35f0('0x23')]==='undefined';var _0x4a6d5c=_0x5a8921[_0x35f0('0x24')];var _0x3bd79e=_0x3d7f08?0x0:_0x43b0e0[_0x35f0('0x22')];var _0x5b63e2=_0x3d7f08?_0x5a8921[_0x35f0('0x24')]:_0x43b0e0[_0x35f0('0x22')]+_0x43b0e0[_0x35f0('0x23')];var _0x3c662e;if(_0x5b63e2>=_0x4a6d5c){_0x5b63e2=_0x4a6d5c;_0x3c662e=0xc8;}else{_0x3c662e=0xce;}_0x2c1817[_0x35f0('0x20')](_0x3c662e);return _0x2c1817['set']('Content-Range',_0x3bd79e+'-'+_0x5b63e2+'/'+_0x4a6d5c)[_0x35f0('0x25')](_0x5a8921);}return null;};}function patchUpdates(_0x4bacaf){return function(_0x4898fc){try{jsonpatch[_0x35f0('0x26')](_0x4898fc,_0x4bacaf,!![]);}catch(_0x197fcd){return BPromise['reject'](_0x197fcd);}return _0x4898fc[_0x35f0('0x27')]();};}function saveUpdates(_0x3de9d2,_0x2bc98e){return function(_0xa4d9b1){if(_0xa4d9b1){return _0xa4d9b1[_0x35f0('0x28')](_0x3de9d2)['then'](function(_0x2a99e7){return _0x2a99e7;});}return null;};}function removeEntity(_0x36666c,_0x3dda1c){return function(_0x4d1f90){if(_0x4d1f90){return _0x4d1f90[_0x35f0('0x29')]()[_0x35f0('0x2a')](function(){var _0x5ee56f=_0x4d1f90[_0x35f0('0x2b')]({'plain':!![]});var _0x39ee57=_0x35f0('0x2c');return db['UserProfileResource'][_0x35f0('0x29')]({'where':{'type':_0x39ee57,'resourceId':_0x5ee56f['id']}})['then'](function(){return _0x4d1f90;});})['then'](function(){_0x36666c['status'](0xcc)[_0x35f0('0x21')]();});}};}function handleEntityNotFound(_0x4bda7d,_0x170498){return function(_0x273116){if(!_0x273116){_0x4bda7d[_0x35f0('0x2d')](0x194);}return _0x273116;};}function handleError(_0x19e2c3,_0x356490){_0x356490=_0x356490||0x1f4;return function(_0x2dd418){logger[_0x35f0('0x2e')](_0x2dd418[_0x35f0('0x2f')]);if(_0x2dd418['name']){delete _0x2dd418[_0x35f0('0x30')];}_0x19e2c3['status'](_0x356490)[_0x35f0('0x31')](_0x2dd418);};}exports['index']=function(_0x59ee1b,_0x1ebc23){var _0x277a03={},_0x6dd735={},_0x495661={'count':0x0,'rows':[]};var _0x3b39c4=_[_0x35f0('0x32')](db['Plugin'][_0x35f0('0x33')],function(_0x4fc402){return{'name':_0x4fc402[_0x35f0('0x34')],'type':_0x4fc402[_0x35f0('0x35')][_0x35f0('0x36')]};});_0x6dd735['model']=_[_0x35f0('0x32')](_0x3b39c4,_0x35f0('0x30'));_0x6dd735[_0x35f0('0x37')]=_[_0x35f0('0x38')](_0x59ee1b['query']);_0x6dd735[_0x35f0('0x39')]=_[_0x35f0('0x3a')](_0x6dd735[_0x35f0('0x3b')],_0x6dd735[_0x35f0('0x37')]);_0x277a03[_0x35f0('0x3c')]=_[_0x35f0('0x3a')](_0x6dd735['model'],qs[_0x35f0('0x3d')](_0x59ee1b[_0x35f0('0x37')]['fields']));_0x277a03['attributes']=_0x277a03['attributes']['length']?_0x277a03[_0x35f0('0x3c')]:_0x6dd735['model'];if(!_0x59ee1b[_0x35f0('0x37')][_0x35f0('0x3e')](_0x35f0('0x3f'))){_0x277a03['limit']=qs[_0x35f0('0x23')](_0x59ee1b['query'][_0x35f0('0x23')]);_0x277a03[_0x35f0('0x22')]=qs['offset'](_0x59ee1b[_0x35f0('0x37')][_0x35f0('0x22')]);}_0x277a03[_0x35f0('0x40')]=qs[_0x35f0('0x41')](_0x59ee1b['query'][_0x35f0('0x41')]);_0x277a03[_0x35f0('0x42')]=qs['filters'](_['pick'](_0x59ee1b['query'],_0x6dd735[_0x35f0('0x39')]),_0x3b39c4);if(_0x59ee1b[_0x35f0('0x37')][_0x35f0('0x43')]){_0x277a03[_0x35f0('0x42')]=_[_0x35f0('0x44')](_0x277a03['where'],{'$or':_[_0x35f0('0x32')](_0x3b39c4,function(_0x1d86f9){if(_0x1d86f9['type']!=='VIRTUAL'){var _0x35b797={};_0x35b797[_0x1d86f9[_0x35f0('0x30')]]={'$like':'%'+_0x59ee1b[_0x35f0('0x37')]['filter']+'%'};return _0x35b797;}})});}_0x277a03=_[_0x35f0('0x44')]({},_0x277a03,_0x59ee1b[_0x35f0('0x45')]);var _0x46b67f={'where':_0x277a03['where']};return db[_0x35f0('0x46')][_0x35f0('0x24')](_0x46b67f)[_0x35f0('0x2a')](function(_0xea0666){_0x495661[_0x35f0('0x24')]=_0xea0666;if(_0x59ee1b[_0x35f0('0x37')][_0x35f0('0x47')]){_0x277a03[_0x35f0('0x48')]=[{'all':!![]}];}return db['Plugin'][_0x35f0('0x49')](_0x277a03);})[_0x35f0('0x2a')](function(_0x41db5d){_0x495661['rows']=_0x41db5d;return _0x495661;})['then'](respondWithFilteredResult(_0x1ebc23,_0x277a03))[_0x35f0('0x4a')](handleError(_0x1ebc23,null));};exports[_0x35f0('0x4b')]=function(_0x258d33,_0x47acec){var _0x5b0da6={'raw':!![],'where':{'id':_0x258d33[_0x35f0('0x4c')]['id']}},_0x211227={};_0x211227['model']=_[_0x35f0('0x38')](db[_0x35f0('0x46')][_0x35f0('0x33')]);_0x211227[_0x35f0('0x37')]=_[_0x35f0('0x38')](_0x258d33[_0x35f0('0x37')]);_0x211227['filters']=_['intersection'](_0x211227[_0x35f0('0x3b')],_0x211227[_0x35f0('0x37')]);_0x5b0da6['attributes']=_[_0x35f0('0x3a')](_0x211227[_0x35f0('0x3b')],qs[_0x35f0('0x3d')](_0x258d33[_0x35f0('0x37')][_0x35f0('0x3d')]));_0x5b0da6[_0x35f0('0x3c')]=_0x5b0da6['attributes']['length']?_0x5b0da6[_0x35f0('0x3c')]:_0x211227[_0x35f0('0x3b')];if(_0x258d33[_0x35f0('0x37')]['includeAll']){_0x5b0da6[_0x35f0('0x48')]=[{'all':!![]}];}_0x5b0da6=_[_0x35f0('0x44')]({},_0x5b0da6,_0x258d33['options']);return db['Plugin'][_0x35f0('0x4d')](_0x5b0da6)[_0x35f0('0x2a')](handleEntityNotFound(_0x47acec,null))[_0x35f0('0x2a')](respondWithResult(_0x47acec,null))['catch'](handleError(_0x47acec,null));};exports['download']=function(_0x4c54f7,_0xfa0075,_0x343bcb){return db[_0x35f0('0x46')][_0x35f0('0x4d')]({'where':{'id':_0x4c54f7[_0x35f0('0x4c')]['id']},'attributes':[_0x35f0('0x30'),_0x35f0('0x4e')],'raw':!![]})[_0x35f0('0x2a')](handleEntityNotFound(_0xfa0075,null))[_0x35f0('0x2a')](function(_0x274ba6){if(_0x274ba6){var _0x475601=path[_0x35f0('0x4f')](config['root'],_0x35f0('0x50'),util['format'](_0x35f0('0x51'),path[_0x35f0('0x52')](_0x274ba6[_0x35f0('0x4e')])));var _0x3dc84e=fs[_0x35f0('0x53')](_0x475601);var _0xca3cf8=archiver('zip',{'zlib':{'level':0x9}});_0xca3cf8['on'](_0x35f0('0x54'),function(_0x53bd9f){if(_0x53bd9f[_0x35f0('0x55')]===_0x35f0('0x56')){logger[_0x35f0('0x2e')](_0x53bd9f);}else{throw new db[(_0x35f0('0x57'))][(_0x35f0('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xca3cf8['on']('error',function(_0x167e12){throw new db['Sequelize'][(_0x35f0('0x58'))](_0x35f0('0x59'));});_0xca3cf8[_0x35f0('0x5a')](_0x3dc84e);_0xca3cf8[_0x35f0('0x5b')]('**/*',{'cwd':path['join'](config['root'],_0x35f0('0x50'),path['dirname'](_0x274ba6[_0x35f0('0x4e')])),'ignore':[path['join'](path['basename'](_0x274ba6[_0x35f0('0x4e')]),_0x35f0('0x5c')),path[_0x35f0('0x4f')](path['basename'](_0x274ba6[_0x35f0('0x4e')]),'attachments/**/*')],'nodir':!![]})[_0x35f0('0x5d')]();_0x3dc84e['on'](_0x35f0('0x5e'),function(){if(!fs[_0x35f0('0x5f')](_0x475601)){throw new db[(_0x35f0('0x57'))]['Error'](_0x35f0('0x60'));}return _0xfa0075[_0x35f0('0x61')](_0x475601,util[_0x35f0('0x62')](_0x35f0('0x51'),path[_0x35f0('0x52')](_0x274ba6[_0x35f0('0x4e')])),function(_0x410f14){if(_0x410f14){throw new db[(_0x35f0('0x57'))][(_0x35f0('0x58'))](_0x35f0('0x63'));}fs[_0x35f0('0x64')](_0x475601);logger['info'](_0x35f0('0x65'));logger[_0x35f0('0x66')](_0x35f0('0x67'));});});}return null;})[_0x35f0('0x4a')](handleError(_0xfa0075,null));};exports[_0x35f0('0x68')]=function(_0x4e3e62,_0x358000,_0x19cff8){var _0x95eb8b=path[_0x35f0('0x52')](_0x4e3e62[_0x35f0('0x69')][_0x35f0('0x6a')],path['extname'](_0x4e3e62[_0x35f0('0x69')][_0x35f0('0x6a')]));var _0x33520d=path[_0x35f0('0x4f')](config[_0x35f0('0x6b')],_0x35f0('0x50'),_0x4e3e62[_0x35f0('0x69')][_0x35f0('0x6a')]);var _0x44864d=path[_0x35f0('0x4f')](config[_0x35f0('0x6b')],'server/files/plugins',_0x95eb8b);logger[_0x35f0('0x66')]('Plugin\x20upload\x20filepath:\x20%s',_0x33520d);logger[_0x35f0('0x66')](_0x35f0('0x6c'),_0x44864d);try{fs['chmodSync'](_0x33520d,parseInt('0777',0x8));extract(_0x33520d,{'dir':_0x44864d},function(_0xa1ddea){if(_0xa1ddea){logger[_0x35f0('0x2e')](_0xa1ddea);handleError(_0xa1ddea,!![]);};var _0xebf1f3=fs[_0x35f0('0x6d')](_0x44864d);if(_0xebf1f3[_0x35f0('0x6e')]>0x1){removeReferences(_0x33520d,_0x44864d);logger[_0x35f0('0x2e')]('Invalid\x20plugin\x20structure');return _0x19cff8(new Error('Invalid\x20plugin\x20structure'));}var _0x15a688=fs[_0x35f0('0x6f')](path[_0x35f0('0x4f')](_0x44864d,_0xebf1f3[0x0]));if(_0x15a688['isFile']()){removeReferences(_0x33520d,_0x44864d);logger[_0x35f0('0x2e')](_0x35f0('0x70'));return _0x19cff8(new Error(_0x35f0('0x70')));}if(_0x15a688['isDirectory']()){var _0x5e28f1=fs[_0x35f0('0x6d')](path[_0x35f0('0x4f')](_0x44864d,_0xebf1f3[0x0]));if(_0x5e28f1[_0x35f0('0x6e')]===0x0){removeReferences(_0x33520d,_0x44864d);logger[_0x35f0('0x2e')](_0x35f0('0x70'));return _0x19cff8(new Error('Invalid\x20plugin\x20structure'));}var _0x3cba65=_0x5e28f1[_0x35f0('0x71')](function(_0x2b3a8e){return _0x2b3a8e===_0x35f0('0x72');});if(!_0x3cba65){return _0x19cff8(new Error('Plugin\x20manifest\x20missing'));}var _0x34272d=fs[_0x35f0('0x73')](path[_0x35f0('0x4f')](_0x44864d,_0xebf1f3[0x0],'manifest.json'));var _0x57301f=JSON['parse'](_0x34272d);if(_0x35f0('0x74')==typeof _0x57301f[_0x35f0('0x30')]){return _0x19cff8(new Error(_0x35f0('0x75')));}if(_0x35f0('0x74')==typeof _0x57301f[_0x35f0('0x35')]){return _0x19cff8(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x35f0('0x74')==typeof _0x57301f[_0x35f0('0x76')]){return _0x19cff8(new Error(_0x35f0('0x77')));}if('undefined'==typeof _0x57301f[_0x35f0('0x78')]){return _0x19cff8(new Error(_0x35f0('0x79')));}if(_0x57301f['type']==='html'){if(_0x35f0('0x74')==typeof _0x57301f[_0x35f0('0x78')][_0x35f0('0x7a')]){return _0x19cff8(new Error(_0x35f0('0x7b')));}if(_0x35f0('0x74')==typeof _0x57301f[_0x35f0('0x78')]['views']['admin']&&'undefined'==typeof _0x57301f[_0x35f0('0x78')][_0x35f0('0x7a')][_0x35f0('0x7c')]){return _0x19cff8(new Error(_0x35f0('0x7d')));}}else if(_0x57301f[_0x35f0('0x35')]==='script'){if(_0x35f0('0x74')==typeof _0x57301f['parameters'][_0x35f0('0x7e')]){return _0x19cff8(new Error(_0x35f0('0x7f')));}if(_0x35f0('0x74')==typeof _0x57301f[_0x35f0('0x78')][_0x35f0('0x80')]){return _0x19cff8(new Error(_0x35f0('0x81')));}}else{return _0x19cff8(new Error(_0x35f0('0x82')));}var _0x4016cc=_0x57301f['name'];var _0x9aee54=_0x57301f[_0x35f0('0x83')];var _0x47b976=_0x57301f['type'];var _0x54c913=_0x57301f['sidebar']?_0x57301f[_0x35f0('0x84')]:_0x35f0('0x85');var _0x5a427d=_0x57301f['icon']?_0x57301f['icon']:'icon-apps';var _0x4fde80='';var _0x40bf84='';var _0x21e180='';var _0x4ee0df='';var _0x144f2c=_0x57301f[_0x35f0('0x76')];if(_0x47b976===_0x35f0('0x86')){if(_0x35f0('0x74')!=typeof _0x57301f[_0x35f0('0x78')]['views']['admin']){var _0x25056e=_0x57301f[_0x35f0('0x78')][_0x35f0('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x25056e)){_0x4fde80=path['join'](_0x35f0('0x87'),_0x95eb8b,_0xebf1f3[0x0],_0x25056e);}else{_0x4fde80=_0x25056e;}}else{logger['info'](_0x35f0('0x88'));}if(_0x35f0('0x74')!=typeof _0x57301f[_0x35f0('0x78')]['views'][_0x35f0('0x7c')]){var _0x192942=_0x57301f['parameters'][_0x35f0('0x7a')][_0x35f0('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x35f0('0x89')](_0x192942)){_0x40bf84=path[_0x35f0('0x4f')](_0x35f0('0x87'),_0x95eb8b,_0xebf1f3[0x0],_0x192942);}else{_0x40bf84=_0x192942;}}else{logger['info'](_0x35f0('0x8a'));}}else if(_0x47b976===_0x35f0('0x8b')){_0x21e180=_0x57301f[_0x35f0('0x78')][_0x35f0('0x7e')];_0x4ee0df=_0x57301f[_0x35f0('0x78')]['scriptPath'];if(_0x35f0('0x74')!=typeof _0x57301f[_0x35f0('0x78')][_0x35f0('0x7a')]){if(_0x35f0('0x74')!=typeof _0x57301f['parameters'][_0x35f0('0x7a')][_0x35f0('0x8c')]){var _0x25056e=_0x57301f[_0x35f0('0x78')][_0x35f0('0x7a')][_0x35f0('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x35f0('0x89')](_0x25056e)){_0x4fde80=path[_0x35f0('0x4f')](_0x35f0('0x87'),_0x95eb8b,_0xebf1f3[0x0],_0x25056e);}else{_0x4fde80=_0x25056e;}}if(_0x35f0('0x74')!=typeof _0x57301f[_0x35f0('0x78')][_0x35f0('0x7a')][_0x35f0('0x7c')]){var _0x192942=_0x57301f[_0x35f0('0x78')][_0x35f0('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x35f0('0x89')](_0x192942)){_0x40bf84=path[_0x35f0('0x4f')](_0x35f0('0x87'),_0x95eb8b,_0xebf1f3[0x0],_0x192942);}else{_0x40bf84=_0x192942;}}}}var _0x4097d4={'name':_0x4016cc,'description':_0x9aee54,'path':path['join'](_0x95eb8b,_0xebf1f3[0x0]),'type':_0x47b976,'sidebar':_0x54c913,'icon':_0x5a427d,'adminUrl':_0x4fde80,'agentUrl':_0x40bf84,'scriptName':_0x21e180,'scriptPath':_0x4ee0df,'version':_0x144f2c};removeReferences(_0x33520d,null);return db[_0x35f0('0x46')]['create'](_0x4097d4)[_0x35f0('0x2a')](function(_0x30013a){var _0x3d8fdf={'role':_0x4e3e62[_0x35f0('0x8d')][_0x35f0('0x8e')],'userProfileId':_0x4e3e62[_0x35f0('0x8d')][_0x35f0('0x8f')]};if(!_0x3d8fdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d8fdf[_0x35f0('0x8e')]===_0x35f0('0x90')){var _0x16f23e=_0x30013a[_0x35f0('0x2b')]({'plain':!![]});return db[_0x35f0('0x91')]['find']({'where':{'name':'Plugins','userProfileId':_0x3d8fdf[_0x35f0('0x8f')]},'raw':!![]})['then'](function(_0x313898){if(_0x313898&&_0x313898[_0x35f0('0x92')]===0x0){return db[_0x35f0('0x93')][_0x35f0('0x94')]({'name':_0x16f23e[_0x35f0('0x30')],'resourceId':_0x16f23e['id'],'type':_0x313898['name'],'sectionId':_0x313898['id']},{})[_0x35f0('0x2a')](function(){return _0x30013a;});}else{return _0x30013a;}})[_0x35f0('0x4a')](function(_0x2ff6d7){logger['error'](_0x35f0('0x95'),_0x2ff6d7);throw _0x2ff6d7;});}return _0x30013a;})[_0x35f0('0x2a')](respondWithResult(_0x358000,null))[_0x35f0('0x4a')](handleError(_0x358000,null));}});}catch(_0x263bfd){_0x358000['status'](0x1f4)[_0x35f0('0x31')](_0x263bfd);}};function removeReferences(_0xd0b4a9,_0x529c5e){try{if(_0xd0b4a9){fs[_0x35f0('0x64')](_0xd0b4a9);logger[_0x35f0('0x66')]('Zip\x20archive\x20removed');}if(_0x529c5e){rimraf(_0x529c5e,function(){});logger[_0x35f0('0x66')](_0x35f0('0x96'));}}catch(_0x2ca6bc){logger['error'](_0x2ca6bc);}}exports[_0x35f0('0x28')]=function(_0x1aeb95,_0x44fac9,_0x4d61ed){return db['Plugin'][_0x35f0('0x4d')]({'where':{'id':_0x1aeb95[_0x35f0('0x4c')]['id']}})[_0x35f0('0x2a')](handleEntityNotFound(_0x44fac9,null))[_0x35f0('0x2a')](saveUpdates(_0x1aeb95[_0x35f0('0x8d')],null))[_0x35f0('0x2a')](respondWithResult(_0x44fac9,null))[_0x35f0('0x4a')](handleError(_0x44fac9,null));};exports['delete']=function(_0x12ca97,_0x494d0a,_0x28cb36){return db[_0x35f0('0x46')]['find']({'where':{'id':_0x12ca97['params']['id']}})['then'](function(_0x4522e1){if(_0x4522e1){return _0x4522e1['destroy']();}})[_0x35f0('0x2a')](function(_0x34d5e5){rimraf(path[_0x35f0('0x4f')](config[_0x35f0('0x6b')],_0x35f0('0x50'),path['dirname'](_0x34d5e5[_0x35f0('0x4e')])),function(){});return _0x34d5e5;})['then'](handleEntityNotFound(_0x494d0a,null))['then'](respondWithStatusCode(_0x494d0a,null))['catch'](handleError(_0x494d0a,null));};exports[_0x35f0('0x97')]=function(_0x3969c0,_0x5e0a34,_0x55d82a){return BPromise[_0x35f0('0x98')]()['then'](function(){if(!_0x3969c0[_0x35f0('0x37')][_0x35f0('0x4e')]){throw new Error(_0x35f0('0x99'));}if(!_0x3969c0[_0x35f0('0x37')]['port']){throw new Error(_0x35f0('0x9a'));}var _0x579124=_0x3969c0[_0x35f0('0x37')]['hostname']?_0x3969c0[_0x35f0('0x37')]['hostname']+':'+_0x3969c0['query'][_0x35f0('0x9b')]:_0x35f0('0x9c')+_0x3969c0[_0x35f0('0x37')][_0x35f0('0x9b')];var _0x451af6=_0x3969c0['query'][_0x35f0('0x25')]?_0x3969c0[_0x35f0('0x37')][_0x35f0('0x25')]:!![];var _0x17085d=_0x3969c0[_0x35f0('0x37')][_0x35f0('0x9d')]?_0x3969c0[_0x35f0('0x37')][_0x35f0('0x9d')]:null;var _0x577698={'method':_0x3969c0[_0x35f0('0x9e')],'uri':util['format'](_0x35f0('0x9f'),_0x579124,_0x3969c0[_0x35f0('0x37')][_0x35f0('0x4e')]),'json':_0x451af6,'resolveWithFullResponse':!![],'encoding':_0x17085d,'qs':_0x3969c0[_0x35f0('0x37')]};if(_0x3969c0[_0x35f0('0xa0')]){_0x577698[_0x35f0('0xa0')]=_0x3969c0['headers'];if(_0x577698[_0x35f0('0xa0')][_0x35f0('0xa1')]){delete _0x577698['headers'][_0x35f0('0xa1')];}}if(_0x577698['headers'][_0x35f0('0xa2')]){delete _0x577698['headers'][_0x35f0('0xa2')];}return rp(_0x577698);})[_0x35f0('0x2a')](function(_0x5a078a){if(_0x5a078a){_0x5e0a34[_0x35f0('0xa3')](_0x5a078a[_0x35f0('0xa0')]);logger[_0x35f0('0x66')](_0x5a078a[_0x35f0('0x8d')]);if(_['endsWith'](_0x3969c0['query']['path'],_0x35f0('0x61'))&&_0x5a078a[_0x35f0('0xa4')]==0x1f4){return _0x5e0a34[_0x35f0('0x2d')](_0x5a078a['statusCode']);}else{return _0x5e0a34[_0x35f0('0x20')](_0x5a078a['statusCode'])[_0x35f0('0x31')](_0x5a078a[_0x35f0('0x8d')]);}}else{return _0x5e0a34[_0x35f0('0x2d')](0xc8);}})['catch'](handleError(_0x5e0a34,null));};exports[_0x35f0('0xa5')]=function(_0x5e1c97,_0x517aeb,_0x48ea48){return BPromise['resolve']()['then'](function(){if(!_0x5e1c97['query'][_0x35f0('0x4e')]){throw new Error(_0x35f0('0x99'));}if(!_0x5e1c97['query'][_0x35f0('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x123f90=_0x5e1c97[_0x35f0('0x37')][_0x35f0('0xa6')]?_0x5e1c97[_0x35f0('0x37')][_0x35f0('0xa6')]+':'+_0x5e1c97[_0x35f0('0x37')]['port']:'http://localhost:'+_0x5e1c97[_0x35f0('0x37')]['port'];var _0x12cec4=_0x5e1c97[_0x35f0('0x37')][_0x35f0('0x25')]?_0x5e1c97['query'][_0x35f0('0x25')]:!![];var _0x2cecb9=_0x5e1c97['query'][_0x35f0('0x9d')]?_0x5e1c97[_0x35f0('0x37')][_0x35f0('0x9d')]:null;var _0x5e9757={'method':_0x5e1c97[_0x35f0('0x9e')],'uri':util[_0x35f0('0x62')](_0x35f0('0x9f'),_0x123f90,_0x5e1c97[_0x35f0('0x37')]['path']),'json':_0x12cec4,'resolveWithFullResponse':!![],'encoding':_0x2cecb9,'body':_0x5e1c97[_0x35f0('0x8d')]};if(_0x5e1c97[_0x35f0('0xa0')]){_0x5e9757[_0x35f0('0xa0')]=_0x5e1c97[_0x35f0('0xa0')];if(_0x5e9757[_0x35f0('0xa0')][_0x35f0('0xa1')]){delete _0x5e9757['headers'][_0x35f0('0xa1')];}}if(_0x5e9757[_0x35f0('0xa0')][_0x35f0('0xa2')]){delete _0x5e9757['headers'][_0x35f0('0xa2')];}return rp(_0x5e9757);})[_0x35f0('0x2a')](function(_0x3d5c66){if(_0x3d5c66){_0x517aeb[_0x35f0('0xa3')](_0x3d5c66['headers']);logger['info'](_0x3d5c66[_0x35f0('0x8d')]);return _0x517aeb[_0x35f0('0x20')](_0x3d5c66[_0x35f0('0xa4')])[_0x35f0('0x31')](_0x3d5c66[_0x35f0('0x8d')]);}else{return _0x517aeb['sendStatus'](0xc8);}})[_0x35f0('0x4a')](handleError(_0x517aeb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index adbd529..55c5a9b 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 _0xfdbd=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','Plugin'];(function(_0x3de450,_0x2fc702){var _0xcf137=function(_0x1eea59){while(--_0x1eea59){_0x3de450['push'](_0x3de450['shift']());}};_0xcf137(++_0x2fc702);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0xfdbd[_0x4f3c9b];return _0x84e58a;};'use strict';var EventEmitter=require(_0xdfdb('0x0'));var Plugin=require(_0xdfdb('0x1'))['db'][_0xdfdb('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xdfdb('0x3')](0x0);var events={'afterCreate':_0xdfdb('0x4'),'afterUpdate':_0xdfdb('0x5'),'afterDestroy':_0xdfdb('0x6')};function emitEvent(_0x66533b){return function(_0x330ad3,_0x5945e0,_0x3f5b2d){PluginEvents['emit'](_0x66533b+':'+_0x330ad3['id'],_0x330ad3);PluginEvents[_0xdfdb('0x7')](_0x66533b,_0x330ad3);_0x3f5b2d(null);};}for(var e in events){if(events[_0xdfdb('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xf966=['Plugin','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5a614a,_0x18a18b){var _0x12e908=function(_0x557fb2){while(--_0x557fb2){_0x5a614a['push'](_0x5a614a['shift']());}};_0x12e908(++_0x18a18b);}(_0xf966,0x184));var _0x6f96=function(_0x3d85b9,_0x3cd42b){_0x3d85b9=_0x3d85b9-0x0;var _0x4823e3=_0xf966[_0x3d85b9];return _0x4823e3;};'use strict';var EventEmitter=require(_0x6f96('0x0'));var Plugin=require(_0x6f96('0x1'))['db'][_0x6f96('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6f96('0x3'),'afterUpdate':_0x6f96('0x4'),'afterDestroy':_0x6f96('0x5')};function emitEvent(_0x5500f4){return function(_0x1820d1,_0x33a4e6,_0x23019c){PluginEvents['emit'](_0x5500f4+':'+_0x1820d1['id'],_0x1820d1);PluginEvents[_0x6f96('0x6')](_0x5500f4,_0x1820d1);_0x23019c(null);};}for(var e in events){if(events[_0x6f96('0x7')](e)){var event=events[e];Plugin[_0x6f96('0x8')](e,emitEvent(event));}}module[_0x6f96('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 199c0d2..d0a362e 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 _0xbb02=['request-promise','path','rimraf','./plugin.attributes','define','Plugin','plugins','lodash','api','moment','bluebird'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xbb02,0xe3));var _0x2bb0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbb02[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x2bb0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2bb0('0x1'));var moment=require(_0x2bb0('0x2'));var BPromise=require(_0x2bb0('0x3'));var rp=require(_0x2bb0('0x4'));var fs=require('fs');var path=require(_0x2bb0('0x5'));var rimraf=require(_0x2bb0('0x6'));var config=require('../../config/environment');var attributes=require(_0x2bb0('0x7'));module['exports']=function(_0x47916b,_0x15d4c6){return _0x47916b[_0x2bb0('0x8')](_0x2bb0('0x9'),attributes,{'tableName':_0x2bb0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x102c=['./plugin.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x572b88,_0x114b08){var _0x13919d=function(_0x39a03b){while(--_0x39a03b){_0x572b88['push'](_0x572b88['shift']());}};_0x13919d(++_0x114b08);}(_0x102c,0x16b));var _0xc102=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x102c[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xc102('0x0'));var util=require(_0xc102('0x1'));var logger=require(_0xc102('0x2'))(_0xc102('0x3'));var moment=require(_0xc102('0x4'));var BPromise=require(_0xc102('0x5'));var rp=require(_0xc102('0x6'));var fs=require('fs');var path=require(_0xc102('0x7'));var rimraf=require(_0xc102('0x8'));var config=require('../../config/environment');var attributes=require(_0xc102('0x9'));module[_0xc102('0xa')]=function(_0x463a6d,_0x37ca91){return _0x463a6d[_0xc102('0xb')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 72373ac..845d492 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 _0x4045=['debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','request','then','info','request\x20sent'];(function(_0x58bbfd,_0x2554cf){var _0x31c79c=function(_0x3af47d){while(--_0x3af47d){_0x58bbfd['push'](_0x58bbfd['shift']());}};_0x31c79c(++_0x2554cf);}(_0x4045,0x7e));var _0x5404=function(_0x302090,_0x5a5567){_0x302090=_0x302090-0x0;var _0x3ef55f=_0x4045[_0x302090];return _0x3ef55f;};'use strict';var _=require('lodash');var util=require(_0x5404('0x0'));var moment=require(_0x5404('0x1'));var BPromise=require(_0x5404('0x2'));var rs=require(_0x5404('0x3'));var fs=require('fs');var Redis=require(_0x5404('0x4'));var db=require(_0x5404('0x5'))['db'];var utils=require(_0x5404('0x6'));var logger=require(_0x5404('0x7'))(_0x5404('0x8'));var config=require(_0x5404('0x9'));var jayson=require(_0x5404('0xa'));var client=jayson['client'][_0x5404('0xb')]({'port':0x232a});config['redis']=_[_0x5404('0xc')](config['redis'],{'host':_0x5404('0xd'),'port':0x18eb});var socket=require(_0x5404('0xe'))(new Redis(config[_0x5404('0xf')]));require(_0x5404('0x10'))[_0x5404('0x11')](socket);function respondWithRpcPromise(_0xfec561,_0xf60662,_0x35c2c6){return new BPromise(function(_0x579122,_0x27df80){return client[_0x5404('0x12')](_0xfec561,_0x35c2c6)[_0x5404('0x13')](function(_0x5a899c){logger[_0x5404('0x14')]('Plugin,\x20%s,\x20%s',_0xf60662,_0x5404('0x15'));logger[_0x5404('0x16')](_0x5404('0x17'),_0xf60662,_0x5404('0x15'),JSON[_0x5404('0x18')](_0x5a899c));if(_0x5a899c[_0x5404('0x19')]){if(_0x5a899c[_0x5404('0x19')][_0x5404('0x1a')]===0x1f4){logger[_0x5404('0x19')](_0x5404('0x1b'),_0xf60662,_0x5a899c[_0x5404('0x19')][_0x5404('0x1c')]);return _0x27df80(_0x5a899c[_0x5404('0x19')][_0x5404('0x1c')]);}logger['error']('Plugin,\x20%s,\x20%s',_0xf60662,_0x5a899c[_0x5404('0x19')][_0x5404('0x1c')]);return _0x579122(_0x5a899c[_0x5404('0x19')][_0x5404('0x1c')]);}else{logger[_0x5404('0x14')](_0x5404('0x1b'),_0xf60662,'request\x20sent');_0x579122(_0x5a899c[_0x5404('0x1d')][_0x5404('0x1c')]);}})[_0x5404('0x1e')](function(_0x23befe){logger[_0x5404('0x19')]('Plugin,\x20%s,\x20%s',_0xf60662,_0x23befe);_0x27df80(_0x23befe);});});}exports[_0x5404('0x1f')]=function(_0x529961){var _0x329667=this;return new Promise(function(_0x47e4ed,_0x53b084){return db[_0x5404('0x20')][_0x5404('0x21')](_0x529961[_0x5404('0x22')],{'raw':_0x529961[_0x5404('0x23')]?_0x529961[_0x5404('0x23')][_0x5404('0x24')]===undefined?!![]:![]:!![]})[_0x5404('0x13')](function(_0x4644c9){logger[_0x5404('0x14')]('CreatePlugin',_0x529961);logger[_0x5404('0x16')](_0x5404('0x1f'),_0x529961,JSON[_0x5404('0x18')](_0x4644c9));_0x47e4ed(_0x4644c9);})['catch'](function(_0x2e3a25){logger[_0x5404('0x19')](_0x5404('0x1f'),_0x2e3a25['message'],_0x529961);_0x53b084(_0x329667['error'](0x1f4,_0x2e3a25[_0x5404('0x1c')]));});});}; \ No newline at end of file +var _0x43c8=['CreatePlugin','create','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x167b19,_0x56081a){var _0x1fcca2=function(_0x544ca4){while(--_0x544ca4){_0x167b19['push'](_0x167b19['shift']());}};_0x1fcca2(++_0x56081a);}(_0x43c8,0xaf));var _0x843c=function(_0x1e088e,_0x243d62){_0x1e088e=_0x1e088e-0x0;var _0x382500=_0x43c8[_0x1e088e];return _0x382500;};'use strict';var _=require('lodash');var util=require(_0x843c('0x0'));var moment=require('moment');var BPromise=require(_0x843c('0x1'));var rs=require(_0x843c('0x2'));var fs=require('fs');var Redis=require(_0x843c('0x3'));var db=require(_0x843c('0x4'))['db'];var utils=require(_0x843c('0x5'));var logger=require(_0x843c('0x6'))(_0x843c('0x7'));var config=require('../../config/environment');var jayson=require(_0x843c('0x8'));var client=jayson[_0x843c('0x9')][_0x843c('0xa')]({'port':0x232a});config[_0x843c('0xb')]=_[_0x843c('0xc')](config['redis'],{'host':_0x843c('0xd'),'port':0x18eb});var socket=require(_0x843c('0xe'))(new Redis(config['redis']));require(_0x843c('0xf'))['register'](socket);function respondWithRpcPromise(_0x4eed13,_0x204fdb,_0x5f0005){return new BPromise(function(_0x3a360e,_0x11f460){return client[_0x843c('0x10')](_0x4eed13,_0x5f0005)[_0x843c('0x11')](function(_0x4d7aeb){logger[_0x843c('0x12')](_0x843c('0x13'),_0x204fdb,_0x843c('0x14'));logger[_0x843c('0x15')](_0x843c('0x16'),_0x204fdb,_0x843c('0x14'),JSON[_0x843c('0x17')](_0x4d7aeb));if(_0x4d7aeb[_0x843c('0x18')]){if(_0x4d7aeb[_0x843c('0x18')][_0x843c('0x19')]===0x1f4){logger[_0x843c('0x18')](_0x843c('0x13'),_0x204fdb,_0x4d7aeb[_0x843c('0x18')][_0x843c('0x1a')]);return _0x11f460(_0x4d7aeb[_0x843c('0x18')]['message']);}logger[_0x843c('0x18')](_0x843c('0x13'),_0x204fdb,_0x4d7aeb[_0x843c('0x18')][_0x843c('0x1a')]);return _0x3a360e(_0x4d7aeb[_0x843c('0x18')]['message']);}else{logger[_0x843c('0x12')](_0x843c('0x13'),_0x204fdb,_0x843c('0x14'));_0x3a360e(_0x4d7aeb[_0x843c('0x1b')]['message']);}})[_0x843c('0x1c')](function(_0x44b41a){logger[_0x843c('0x18')](_0x843c('0x13'),_0x204fdb,_0x44b41a);_0x11f460(_0x44b41a);});});}exports[_0x843c('0x1d')]=function(_0x556049){var _0x23cd34=this;return new Promise(function(_0x5d0920,_0x505d5c){return db['Plugin'][_0x843c('0x1e')](_0x556049[_0x843c('0x1f')],{'raw':_0x556049['options']?_0x556049[_0x843c('0x20')][_0x843c('0x21')]===undefined?!![]:![]:!![]})[_0x843c('0x11')](function(_0x15513d){logger['info']('CreatePlugin',_0x556049);logger['debug'](_0x843c('0x1d'),_0x556049,JSON[_0x843c('0x17')](_0x15513d));_0x5d0920(_0x15513d);})[_0x843c('0x1c')](function(_0x408bf1){logger[_0x843c('0x18')](_0x843c('0x1d'),_0x408bf1[_0x843c('0x1a')],_0x556049);_0x505d5c(_0x23cd34['error'](0x1f4,_0x408bf1[_0x843c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 165d501..dc95329 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 _0xc10d=['update','emit','removeListener','length','plugin:','./plugin.events'];(function(_0x549755,_0x44670b){var _0x2a6219=function(_0x2b65be){while(--_0x2b65be){_0x549755['push'](_0x549755['shift']());}};_0x2a6219(++_0x44670b);}(_0xc10d,0x95));var _0xdc10=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0xc10d[_0x1bc762];return _0x40f70c;};'use strict';var PluginEvents=require(_0xdc10('0x0'));var events=['save','remove',_0xdc10('0x1')];function createListener(_0x1f6b62,_0x1b8eb4){return function(_0x34f3af){_0x1b8eb4[_0xdc10('0x2')](_0x1f6b62,_0x34f3af);};}function removeListener(_0x4fb92c,_0x2a476c){return function(){PluginEvents[_0xdc10('0x3')](_0x4fb92c,_0x2a476c);};}exports['register']=function(_0x441ee5){for(var _0x862e8d=0x0,_0x5644b7=events[_0xdc10('0x4')];_0x862e8d<_0x5644b7;_0x862e8d++){var _0x4f8b23=events[_0x862e8d];var _0x3274d5=createListener(_0xdc10('0x5')+_0x4f8b23,_0x441ee5);PluginEvents['on'](_0x4f8b23,_0x3274d5);}}; \ No newline at end of file +var _0x0fec=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x59eb76,_0x42ccfe){var _0x165aba=function(_0x46eb49){while(--_0x46eb49){_0x59eb76['push'](_0x59eb76['shift']());}};_0x165aba(++_0x42ccfe);}(_0x0fec,0x1c4));var _0xc0fe=function(_0x267540,_0x49c982){_0x267540=_0x267540-0x0;var _0x1469ff=_0x0fec[_0x267540];return _0x1469ff;};'use strict';var PluginEvents=require(_0xc0fe('0x0'));var events=[_0xc0fe('0x1'),_0xc0fe('0x2'),_0xc0fe('0x3')];function createListener(_0x59fb4a,_0x2572b3){return function(_0x38ffd5){_0x2572b3[_0xc0fe('0x4')](_0x59fb4a,_0x38ffd5);};}function removeListener(_0x42f9e2,_0x533c17){return function(){PluginEvents[_0xc0fe('0x5')](_0x42f9e2,_0x533c17);};}exports[_0xc0fe('0x6')]=function(_0x1f4c16){for(var _0x20d15b=0x0,_0x5f54aa=events[_0xc0fe('0x7')];_0x20d15b<_0x5f54aa;_0x20d15b++){var _0x5c742c=events[_0x20d15b];var _0x2d6f3e=createListener(_0xc0fe('0x8')+_0x5c742c,_0x1f4c16);PluginEvents['on'](_0x5c742c,_0x2d6f3e);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 2fbf02f..6fd89d7 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(_0x54133d,_0x34e438){var _0x387b83=function(_0x8f4518){while(--_0x8f4518){_0x54133d['push'](_0x54133d['shift']());}};_0x387b83(++_0x34e438);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x52cd65,_0x52010a){var _0x54ff0f=function(_0x306c82){while(--_0x306c82){_0x52cd65['push'](_0x52cd65['shift']());}};_0x54ff0f(++_0x52010a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 d675a12..e9e00ca 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 _0x16d2=['cwd','chdir','start','dump','update','stop','send','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','express','motion2','length','then','catch','show','params','create','body','script','join'];(function(_0x3a9af7,_0x6143f9){var _0x277307=function(_0x21a8ac){while(--_0x21a8ac){_0x3a9af7['push'](_0x3a9af7['shift']());}};_0x277307(++_0x6143f9);}(_0x16d2,0x123));var _0x216d=function(_0x526406,_0x549226){_0x526406=_0x526406-0x0;var _0xdd3e6d=_0x16d2[_0x526406];return _0xdd3e6d;};'use strict';var _=require(_0x216d('0x0'));var pm2=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var path=require(_0x216d('0x4'));var exec=require(_0x216d('0x5'))[_0x216d('0x6')];var BPromise=require(_0x216d('0x7'));function handleEntityNotFound(_0xfd7306,_0x593bb0){return function(_0x2c662d){if(!_0x2c662d){_0xfd7306[_0x216d('0x8')](0x194);;}return _0x2c662d;};}function respondWithResult(_0xef687c,_0x205101){_0x205101=_0x205101||0xc8;return function(_0x1dd8e2){if(_0x1dd8e2){return _0xef687c[_0x216d('0x9')](_0x205101)[_0x216d('0xa')](_0x1dd8e2);}return null;};}function handleError(_0x28da14,_0x57accc){_0x57accc=_0x57accc||0x1f4;return function(_0x22c7b3){logger[_0x216d('0xb')](_0x22c7b3[_0x216d('0xc')]);if(_0x22c7b3[_0x216d('0xd')]){delete _0x22c7b3[_0x216d('0xd')];}_0x28da14[_0x216d('0x9')](_0x57accc)['send'](_0x22c7b3);};}function execChildProcess(){return new BPromise(function(_0x7ca9c9,_0x50db30){exec(_0x216d('0xe'),function(_0x2e02ce,_0x332e30,_0x398970){logger[_0x216d('0xf')](_0x332e30);logger[_0x216d('0xf')](_0x398970);if(_0x2e02ce){logger['error'](_0x2e02ce);return _0x50db30(_0x2e02ce);}return _0x7ca9c9(_0x332e30);});});}exports[_0x216d('0x10')]=function(_0x4c07d0,_0x271bb1){return pm2[_0x216d('0x11')]()['then'](function(_0x165c19){if(_0x165c19){var _0x322e4b=_['reject'](_0x165c19,function(_0x1b3215){return _0x1b3215['name']===_0x216d('0x12')||_0x1b3215[_0x216d('0xd')]===_0x216d('0x13');});return{'rows':_0x322e4b,'count':_0x322e4b[_0x216d('0x14')]};}return null;})[_0x216d('0x15')](respondWithResult(_0x271bb1,null))[_0x216d('0x16')](handleError(_0x271bb1,null));};exports[_0x216d('0x17')]=function(_0x1496fe,_0x19fdac){return pm2['describe'](_0x1496fe[_0x216d('0x18')]['id'])['then'](respondWithResult(_0x19fdac,null))['then'](handleEntityNotFound(_0x19fdac,null))[_0x216d('0x16')](handleError(_0x19fdac,null));};exports[_0x216d('0x19')]=function(_0x574758,_0x3f32e0){if(_0x574758[_0x216d('0x1a')]['name']&&_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]){var _0x430e81=path[_0x216d('0x1c')](__dirname,'../../files/plugins',_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]);var _0x10f299=process[_0x216d('0x1d')]();process[_0x216d('0x1e')](path['dirname'](_0x430e81));return execChildProcess()[_0x216d('0x15')](function(_0x1bd4db){process[_0x216d('0x1e')](_0x10f299);return pm2[_0x216d('0x1f')]({'name':_0x574758[_0x216d('0x1a')]['name'],'script':_0x430e81});})[_0x216d('0x15')](function(_0xab672){pm2[_0x216d('0x20')]();return _0xab672[0x0];})['then'](respondWithResult(_0x3f32e0,0xc9))['catch'](handleError(_0x3f32e0,null));}else{return _0x3f32e0['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x216d('0x21')]=function(_0x470d8a,_0x189413){if(_0x470d8a[_0x216d('0x1a')]['id']){delete _0x470d8a[_0x216d('0x1a')]['id'];}var _0x47fa6d={'online':'restart','stopped':_0x216d('0x22')};if(_0x47fa6d['hasOwnProperty'](_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')])){return pm2[_0x47fa6d[_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')]]](_0x470d8a[_0x216d('0x18')]['id'])[_0x216d('0x15')](respondWithResult(_0x189413,0xc8))[_0x216d('0x16')](handleError(_0x189413,null));}else{return _0x189413[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x24')});}};exports[_0x216d('0x25')]=function(_0x260134,_0x4537fd){if(_0x260134['body']['id']){delete _0x260134[_0x216d('0x1a')]['id'];}if(_0x260134[_0x216d('0x18')]['id']){return pm2[_0x216d('0x26')](_0x260134['params']['id'])[_0x216d('0x15')](function(_0x1743ee){pm2[_0x216d('0x20')]();return _0x1743ee[0x0];})[_0x216d('0x15')](respondWithResult(_0x4537fd,null))['catch'](handleError(_0x4537fd,null));}else{return _0x4537fd[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x27')});}}; \ No newline at end of file +var _0xe5b5=['../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','then','reject','motion2','length','show','describe','catch','body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x4a4ee6,_0x293fca){var _0xb8c8d=function(_0x64d8ca){while(--_0x64d8ca){_0x4a4ee6['push'](_0x4a4ee6['shift']());}};_0xb8c8d(++_0x293fca);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0xe5b5[_0x217ff6];return _0x417c93;};'use strict';var _=require(_0x5e5b('0x0'));var pm2=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var path=require(_0x5e5b('0x4'));var exec=require(_0x5e5b('0x5'))[_0x5e5b('0x6')];var BPromise=require(_0x5e5b('0x7'));function handleEntityNotFound(_0xf20c6a,_0x20a50c){return function(_0xdc6616){if(!_0xdc6616){_0xf20c6a[_0x5e5b('0x8')](0x194);;}return _0xdc6616;};}function respondWithResult(_0xf1fbe2,_0x11e0e0){_0x11e0e0=_0x11e0e0||0xc8;return function(_0x545eb3){if(_0x545eb3){return _0xf1fbe2[_0x5e5b('0x9')](_0x11e0e0)[_0x5e5b('0xa')](_0x545eb3);}return null;};}function handleError(_0xcbd478,_0x258414){_0x258414=_0x258414||0x1f4;return function(_0xb9d72b){logger[_0x5e5b('0xb')](_0xb9d72b[_0x5e5b('0xc')]);if(_0xb9d72b[_0x5e5b('0xd')]){delete _0xb9d72b['name'];}_0xcbd478[_0x5e5b('0x9')](_0x258414)['send'](_0xb9d72b);};}function execChildProcess(){return new BPromise(function(_0x108c34,_0x58185){exec(_0x5e5b('0xe'),function(_0x3f64b6,_0x55c974,_0x4a1424){logger['info'](_0x55c974);logger[_0x5e5b('0xf')](_0x4a1424);if(_0x3f64b6){logger[_0x5e5b('0xb')](_0x3f64b6);return _0x58185(_0x3f64b6);}return _0x108c34(_0x55c974);});});}exports[_0x5e5b('0x10')]=function(_0x1694ff,_0x13a01e){return pm2[_0x5e5b('0x11')]()[_0x5e5b('0x12')](function(_0x49edd0){if(_0x49edd0){var _0x2b37fa=_[_0x5e5b('0x13')](_0x49edd0,function(_0x4ff37b){return _0x4ff37b[_0x5e5b('0xd')]==='express'||_0x4ff37b['name']===_0x5e5b('0x14');});return{'rows':_0x2b37fa,'count':_0x2b37fa[_0x5e5b('0x15')]};}return null;})[_0x5e5b('0x12')](respondWithResult(_0x13a01e,null))['catch'](handleError(_0x13a01e,null));};exports[_0x5e5b('0x16')]=function(_0x4d490c,_0x1796af){return pm2[_0x5e5b('0x17')](_0x4d490c['params']['id'])[_0x5e5b('0x12')](respondWithResult(_0x1796af,null))[_0x5e5b('0x12')](handleEntityNotFound(_0x1796af,null))[_0x5e5b('0x18')](handleError(_0x1796af,null));};exports['create']=function(_0x2bf0b7,_0x3f1103){if(_0x2bf0b7['body'][_0x5e5b('0xd')]&&_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]){var _0x2d8252=path[_0x5e5b('0x1b')](__dirname,_0x5e5b('0x1c'),_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]);var _0x4a78e3=process['cwd']();process[_0x5e5b('0x1d')](path[_0x5e5b('0x1e')](_0x2d8252));return execChildProcess()[_0x5e5b('0x12')](function(_0xe1c268){process[_0x5e5b('0x1d')](_0x4a78e3);return pm2[_0x5e5b('0x1f')]({'name':_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0xd')],'script':_0x2d8252});})[_0x5e5b('0x12')](function(_0x26bc02){pm2[_0x5e5b('0x20')]();return _0x26bc02[0x0];})['then'](respondWithResult(_0x3f1103,0xc9))[_0x5e5b('0x18')](handleError(_0x3f1103,null));}else{return _0x3f1103[_0x5e5b('0x9')](0x1f4)[_0x5e5b('0x21')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5e5b('0x22')]=function(_0xdb2863,_0x5ee866){if(_0xdb2863[_0x5e5b('0x19')]['id']){delete _0xdb2863[_0x5e5b('0x19')]['id'];}var _0x39ce16={'online':_0x5e5b('0x23'),'stopped':_0x5e5b('0x24')};if(_0x39ce16[_0x5e5b('0x25')](_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')])){return pm2[_0x39ce16[_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')]]](_0xdb2863[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](respondWithResult(_0x5ee866,0xc8))['catch'](handleError(_0x5ee866,null));}else{return _0x5ee866['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x27')});}};exports[_0x5e5b('0x28')]=function(_0x3dcdab,_0x12f1ee){if(_0x3dcdab['body']['id']){delete _0x3dcdab[_0x5e5b('0x19')]['id'];}if(_0x3dcdab['params']['id']){return pm2[_0x5e5b('0x29')](_0x3dcdab[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](function(_0xc2bc09){pm2['dump']();return _0xc2bc09[0x0];})[_0x5e5b('0x12')](respondWithResult(_0x12f1ee,null))[_0x5e5b('0x18')](handleError(_0x12f1ee,null));}else{return _0x12f1ee['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x2a')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9dcb0a0..2b582ad 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 _0x1d3c=['/queues','getQueues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x5b3e55,_0x205c49){var _0x532950=function(_0x2bf2e3){while(--_0x2bf2e3){_0x5b3e55['push'](_0x5b3e55['shift']());}};_0x532950(++_0x205c49);}(_0x1d3c,0x7a));var _0xc1d3=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0x1d3c[_0x4b2251];return _0x5d22fb;};'use strict';var express=require(_0xc1d3('0x0'));var router=express[_0xc1d3('0x1')]();var auth=require(_0xc1d3('0x2'));var controller=require(_0xc1d3('0x3'));router[_0xc1d3('0x4')](_0xc1d3('0x5'),auth[_0xc1d3('0x6')](),controller[_0xc1d3('0x7')]);router[_0xc1d3('0x4')](_0xc1d3('0x8'),auth[_0xc1d3('0x6')](),controller[_0xc1d3('0x9')]);module['exports']=router; \ No newline at end of file +var _0xc5f3=['isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','get','/agents'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0xc5f3,0x91));var _0x3c5f=function(_0xcecc7d,_0x2f2899){_0xcecc7d=_0xcecc7d-0x0;var _0x5883ba=_0xc5f3[_0xcecc7d];return _0x5883ba;};'use strict';var express=require(_0x3c5f('0x0'));var router=express[_0x3c5f('0x1')]();var auth=require(_0x3c5f('0x2'));var controller=require('./realtime.controller');router[_0x3c5f('0x3')](_0x3c5f('0x4'),auth[_0x3c5f('0x5')](),controller[_0x3c5f('0x6')]);router[_0x3c5f('0x3')](_0x3c5f('0x7'),auth[_0x3c5f('0x5')](),controller[_0x3c5f('0x8')]);module[_0x3c5f('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 6842295..f4a5790 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 _0x99ce=['APIBadRequestError','handleError','offset','undefined','limit','count','set','Content-Range','json','getAgents','query','globalQueueFilter','globalStatusFilter','pause','*pause','then','channel','isValidChannel','format','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','key','role','agent','online','getOptions','sequelize','literal','FIELD(id,','push','Pause','where','merge','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','rows','map','find','filterAgentAttributes','getAgentStatus','forEach','split','pick','catch','Channel\x20parameter\x20%s\x20is\x20invalid','Queue','fieldName','name','type','outbound','dialActive','dialMethod','voice','QueueCampaigns','startCase','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api'];(function(_0x434150,_0x217a35){var _0x1b5548=function(_0xc17e5c){while(--_0xc17e5c){_0x434150['push'](_0x434150['shift']());}};_0x1b5548(++_0x217a35);}(_0x99ce,0xf5));var _0xe99c=function(_0x5d82ae,_0x3cdc32){_0x5d82ae=_0x5d82ae-0x0;var _0x162a7c=_0x99ce[_0x5d82ae];return _0x162a7c;};'use strict';var _=require(_0xe99c('0x0'));var util=require(_0xe99c('0x1'));var rta=require(_0xe99c('0x2'));var rtq=require(_0xe99c('0x3'));var qs=require(_0xe99c('0x4'));var utils=require(_0xe99c('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xe99c('0x6'))[_0xe99c('0x7')];var APIHandleError=require(_0xe99c('0x6'))[_0xe99c('0x8')];function respondWithFilteredResult(_0x57c988,_0x3e8346){return function(_0x13915e){if(_0x13915e){var _0x56239a=typeof _0x3e8346[_0xe99c('0x9')]===_0xe99c('0xa')&&typeof _0x3e8346[_0xe99c('0xb')]===_0xe99c('0xa');var _0x334774=_0x13915e['count'];var _0x32043d=_0x56239a?0x0:_0x3e8346[_0xe99c('0x9')];var _0x12cee7=_0x56239a?_0x13915e[_0xe99c('0xc')]:_0x3e8346['offset']+_0x3e8346[_0xe99c('0xb')];var _0x4e09f4;if(_0x12cee7>=_0x334774){_0x12cee7=_0x334774;_0x4e09f4=0xc8;}else{_0x4e09f4=0xce;}_0x57c988['status'](_0x4e09f4);return _0x57c988[_0xe99c('0xd')](_0xe99c('0xe'),_0x32043d+'-'+_0x12cee7+'/'+_0x334774)[_0xe99c('0xf')](_0x13915e);}return null;};}exports[_0xe99c('0x10')]=function(_0x14a2e3,_0x55b532){var _0x181507={'count':0x0,'rows':[]};var _0x109bbe={};var _0x5c8791;var _0x326a4b=utils['getChannels']();var _0x5c1ca8;var _0x1ace0d;var _0x109d59=_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x12')];var _0x1bdfcd=_0x14a2e3['query'][_0xe99c('0x13')];var _0x4092b3=_0x14a2e3[_0xe99c('0x11')]['pauseTypeFilter'];var _0x3ee174=_0x1bdfcd===_0xe99c('0x14')||_0x1bdfcd===_0xe99c('0x15')?!![]:![];var _0x16c786=[];var _0x43bb66;var _0x526ef9;Promise['resolve']()[_0xe99c('0x16')](function(){if(_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x17')]){if(!utils[_0xe99c('0x18')](_0x14a2e3['query'][_0xe99c('0x17')])){throw new APIBadRequestError(util[_0xe99c('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x17')]));}_0x5c8791=_0x14a2e3['query'][_0xe99c('0x17')][_0xe99c('0x1a')]();}if(!_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x1b')]||!_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x1b')][_0xe99c('0x1c')](_0xe99c('0x1d'))){_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x1b')]=rta[_0xe99c('0x1e')](_0x14a2e3['query'][_0xe99c('0x1b')]);return;}var _0x2cf045=rta['getUpdatedSortOptions'](_0x14a2e3['query'][_0xe99c('0x1b')]);_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x1b')]=_0x2cf045[_0xe99c('0x1f')][_0xe99c('0x20')](',');_0x43bb66=_0x2cf045[_0xe99c('0x21')];})[_0xe99c('0x16')](function(){if(!_0x109d59){return[];}return rta['getAgentIdsByQueues'](_0x109d59,_0x5c8791);})[_0xe99c('0x16')](function(_0x2bca97){_0x16c786=_0x2bca97;return rta[_0xe99c('0x22')]();})['then'](function(_0xc2dfcc){_0x1ace0d=_0xc2dfcc['rows'];if((!_0x1bdfcd||_0x3ee174)&&!_0x43bb66){return _0x16c786;}if(_0x43bb66&&!_0x1bdfcd){return rta[_0xe99c('0x23')](_0x1ace0d,_0x16c786,_0x43bb66);}else{return rta[_0xe99c('0x24')](_0x1ace0d,_0x16c786,_0x1bdfcd);}})[_0xe99c('0x16')](function(_0x1baf57){_0x16c786=_0x1baf57;var _0x487a7a=![];if(_0x16c786[_0xe99c('0x25')]===0x0){if(_0x109d59||_0x1bdfcd){_0x487a7a=!![];}if(_0x3ee174){_0x487a7a=![];}}if(_0x487a7a){return _0x181507;}var _0xc89a0c=_['map'](db[_0xe99c('0x26')][_0xe99c('0x27')],function(_0x2f3b11){return{'name':_0x2f3b11['fieldName'],'type':_0x2f3b11['type'][_0xe99c('0x28')]};});_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x29')]=_0xe99c('0x2a');_0x14a2e3[_0xe99c('0x11')][_0xe99c('0x2b')]=!![];_0x109bbe=qs[_0xe99c('0x2c')](_0xc89a0c,_0x14a2e3);_0x109bbe['raw']=!![];var _0x5421ed=[];if(_0x16c786[_0xe99c('0x25')]>0x0){_0x5421ed['push']({'id':{'$in':_0x16c786}});if(_0x43bb66&&!_0x1bdfcd){_0x526ef9=[db[_0xe99c('0x2d')][_0xe99c('0x2e')](_0xe99c('0x2f')+_0x16c786+')')];_0x109bbe[_0xe99c('0x21')]=_0x526ef9;}}if(_0x3ee174){_0x326a4b['forEach'](function(_0x30ec14){var _0x3f956c=!![];if(_0x1bdfcd==='*pause'&&_0x5c8791!==_0x30ec14){_0x3f956c=![];}_0x5421ed[_0xe99c('0x30')]({[_0x30ec14+_0xe99c('0x31')]:_0x3f956c});});if(_0x4092b3){_0x5421ed['push']({'pauseType':_0x4092b3});}}else if(_0x1bdfcd){_0x326a4b['forEach'](function(_0x3c12ac){_0x5421ed[_0xe99c('0x30')]({[_0x3c12ac+_0xe99c('0x31')]:![]});});}_0x109bbe[_0xe99c('0x32')]=_[_0xe99c('0x33')](_0x109bbe['where'],{'$and':_0x5421ed});if(_0x14a2e3[_0xe99c('0x34')][_0xe99c('0x29')]==='user'){var _0x44686c={'params':{'id':_0x14a2e3[_0xe99c('0x34')][_0xe99c('0x35')]},'query':{'section':_0xe99c('0x36'),'role':_0xe99c('0x2a'),'online':!![],'raw':!![],'ids':_0x16c786,'customSorting':_0x526ef9}};if(_0x3ee174){_0x44686c['query'][_0xe99c('0x37')]=_0x5421ed;}_0x44686c['query']=Object[_0xe99c('0x38')](_0x44686c['query'],_0x14a2e3[_0xe99c('0x11')]);delete _0x44686c['query']['id'];return db[_0xe99c('0x39')][_0xe99c('0x3a')](_0x44686c);}return db[_0xe99c('0x26')][_0xe99c('0x3b')](_0x109bbe);})[_0xe99c('0x16')](function(_0x4be098){_0x181507['count']=_0x4be098['count'];_0x5c1ca8=_0x4be098[_0xe99c('0x3c')];return _0x5c1ca8[_0xe99c('0x3d')](function(_0x353d48){var _0x5b24e8=_[_0xe99c('0x3e')](_0x1ace0d,['id',_0x353d48['id']]);if(_0x5b24e8){var _0x115504=rta[_0xe99c('0x3f')](_0x5b24e8);_[_0xe99c('0x33')](_0x353d48,_0x115504);}_0x353d48[_0xe99c('0x1d')]=rta[_0xe99c('0x40')](_0x353d48);if(_0x353d48['globalStatus'][_0xe99c('0x1c')](_0xe99c('0x14'))){_0x326a4b[_0xe99c('0x41')](function(_0x1800d3){if(_0x353d48[_0x1800d3+_0xe99c('0x31')]){_0x353d48[_0x1800d3+'Status']=_0xe99c('0x14');}});}return _0x353d48;});})['then'](function(_0x44ca01){if(!_0x43bb66||_0x526ef9){return _0x44ca01;}return rta['sortAgentsByStatus'](_0x44ca01,_0x43bb66);})[_0xe99c('0x16')](function(_0x5b48b3){var _0x1ee8b9=null;if(_0x14a2e3['query'][_0xe99c('0x1f')]){var _0x25ecb4=_0x14a2e3['query'][_0xe99c('0x1f')][_0xe99c('0x42')](',');_0x1ee8b9=_0x5b48b3[_0xe99c('0x3d')](function(_0xafe69c){return _[_0xe99c('0x43')](_0xafe69c,_0x25ecb4);});}_0x181507['rows']=_0x1ee8b9||_0x5b48b3;return _0x181507;})['then'](respondWithFilteredResult(_0x55b532,_0x109bbe))[_0xe99c('0x44')](APIHandleError(_0x55b532));};exports['getQueues']=function(_0x2bc4f9,_0x2b21c9){var _0x32ae6a={'count':0x0,'rows':[]};var _0x55a36d={};var _0x142b35;var _0x57a7eb;var _0x4380ab;Promise['resolve']()[_0xe99c('0x16')](function(){if(_0x2bc4f9[_0xe99c('0x11')][_0xe99c('0x17')]){if(!utils[_0xe99c('0x18')](_0x2bc4f9['query'][_0xe99c('0x17')])){throw new APIBadRequestError(util[_0xe99c('0x19')](_0xe99c('0x45'),_0x2bc4f9['query'][_0xe99c('0x17')]));}_0x142b35=_0x2bc4f9[_0xe99c('0x11')][_0xe99c('0x17')][_0xe99c('0x1a')]();}var _0x217dd7=_['startCase'](_0x142b35)+_0xe99c('0x46');var _0x5b4335=_[_0xe99c('0x3d')](db[_0x217dd7][_0xe99c('0x27')],function(_0xf0dd41){return{'name':_0xf0dd41[_0xe99c('0x47')],'type':_0xf0dd41['type']['key']};});if(!_0x2bc4f9[_0xe99c('0x11')][_0xe99c('0x1f')]){var _0x4de9ee=['id',_0xe99c('0x48')];if(_0x142b35==='voice'){_0x4de9ee[_0xe99c('0x30')](_0xe99c('0x49'));if(_0x2bc4f9[_0xe99c('0x11')][_0xe99c('0x49')]===_0xe99c('0x4a')){_0x4de9ee['push']([_0xe99c('0x4b'),_0xe99c('0x4c')]);}}_0x2bc4f9[_0xe99c('0x11')][_0xe99c('0x1f')]=_0x4de9ee[_0xe99c('0x20')](',');}_0x55a36d=qs['getOptions'](_0x5b4335,_0x2bc4f9);if(_0x2bc4f9['user'][_0xe99c('0x29')]===_0xe99c('0x34')){var _0xa4263d={'params':{'id':_0x2bc4f9[_0xe99c('0x34')][_0xe99c('0x35')]},'query':{'section':_0x142b35===_0xe99c('0x4d')&&_0x2bc4f9[_0xe99c('0x11')]['type']===_0xe99c('0x4a')?_0xe99c('0x4e'):_[_0xe99c('0x4f')](_0x142b35)+_0xe99c('0x50'),'type':_0x2bc4f9[_0xe99c('0x11')][_0xe99c('0x49')],'nolimit':!![],'sort':'name','filter':_0x2bc4f9[_0xe99c('0x11')][_0xe99c('0x51')]}};return db[_0xe99c('0x39')][_0xe99c('0x3a')](_0xa4263d);}return db[_0x217dd7]['findAndCountAll'](_0x55a36d);})['then'](function(_0x5264e9){_0x32ae6a['count']=_0x5264e9['count'];_0x57a7eb=_0x5264e9[_0xe99c('0x3c')];return rtq[_0xe99c('0x52')](_0x2bc4f9,_0x142b35);})[_0xe99c('0x16')](function(_0x3910e1){_0x4380ab=_0x3910e1[_0xe99c('0x3c')];return rtq[_0xe99c('0x53')](_0x57a7eb,_0x4380ab,_0x142b35,_0x2bc4f9['query'][_0xe99c('0x49')]);})[_0xe99c('0x16')](function(_0x589946){_0x32ae6a[_0xe99c('0x3c')]=_0x589946;return _0x32ae6a;})[_0xe99c('0x16')](respondWithFilteredResult(_0x2b21c9,_0x55a36d))[_0xe99c('0x44')](APIHandleError(_0x2b21c9));}; \ No newline at end of file +var _0x530e=['../../errors/api','APIBadRequestError','undefined','limit','count','offset','status','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','push','sequelize','FIELD(id,','forEach','Pause','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','rows','find','filterAgentAttributes','merge','getAgentStatus','Status','split','pick','catch','getQueues','toLowerCase','startCase','Queue','name','outbound','dialActive','dialMethod','voice','QueueCampaigns','Queues','filter','findAndCountAll','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils'];(function(_0x2ef35b,_0xdd897e){var _0x4dd727=function(_0x53f286){while(--_0x53f286){_0x2ef35b['push'](_0x2ef35b['shift']());}};_0x4dd727(++_0xdd897e);}(_0x530e,0x19a));var _0xe530=function(_0x270aff,_0x15ce61){_0x270aff=_0x270aff-0x0;var _0x1a4116=_0x530e[_0x270aff];return _0x1a4116;};'use strict';var _=require(_0xe530('0x0'));var util=require(_0xe530('0x1'));var rta=require(_0xe530('0x2'));var rtq=require(_0xe530('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0xe530('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xe530('0x5'))[_0xe530('0x6')];var APIHandleError=require(_0xe530('0x5'))['handleError'];function respondWithFilteredResult(_0x407139,_0x496d73){return function(_0x24fc6d){if(_0x24fc6d){var _0x29f5f4=typeof _0x496d73['offset']===_0xe530('0x7')&&typeof _0x496d73[_0xe530('0x8')]===_0xe530('0x7');var _0x41b644=_0x24fc6d[_0xe530('0x9')];var _0x25bf7e=_0x29f5f4?0x0:_0x496d73[_0xe530('0xa')];var _0x1ef7e3=_0x29f5f4?_0x24fc6d['count']:_0x496d73[_0xe530('0xa')]+_0x496d73[_0xe530('0x8')];var _0x5c1fe0;if(_0x1ef7e3>=_0x41b644){_0x1ef7e3=_0x41b644;_0x5c1fe0=0xc8;}else{_0x5c1fe0=0xce;}_0x407139[_0xe530('0xb')](_0x5c1fe0);return _0x407139['set'](_0xe530('0xc'),_0x25bf7e+'-'+_0x1ef7e3+'/'+_0x41b644)[_0xe530('0xd')](_0x24fc6d);}return null;};}exports[_0xe530('0xe')]=function(_0x2117c7,_0x39eacd){var _0x14cc6e={'count':0x0,'rows':[]};var _0x1fd23f={};var _0x31a982;var _0x500f10=utils[_0xe530('0xf')]();var _0x545b97;var _0x52f233;var _0x1a9327=_0x2117c7[_0xe530('0x10')]['globalQueueFilter'];var _0x333a26=_0x2117c7[_0xe530('0x10')][_0xe530('0x11')];var _0x39d79a=_0x2117c7['query'][_0xe530('0x12')];var _0x14b4e8=_0x333a26===_0xe530('0x13')||_0x333a26===_0xe530('0x14')?!![]:![];var _0x3c62ef=[];var _0x279745;var _0x296d54;Promise['resolve']()[_0xe530('0x15')](function(){if(_0x2117c7['query'][_0xe530('0x16')]){if(!utils[_0xe530('0x17')](_0x2117c7['query'][_0xe530('0x16')])){throw new APIBadRequestError(util[_0xe530('0x18')](_0xe530('0x19'),_0x2117c7[_0xe530('0x10')][_0xe530('0x16')]));}_0x31a982=_0x2117c7[_0xe530('0x10')]['channel']['toLowerCase']();}if(!_0x2117c7[_0xe530('0x10')][_0xe530('0x1a')]||!_0x2117c7[_0xe530('0x10')][_0xe530('0x1a')][_0xe530('0x1b')](_0xe530('0x1c'))){_0x2117c7[_0xe530('0x10')][_0xe530('0x1a')]=rta[_0xe530('0x1d')](_0x2117c7[_0xe530('0x10')][_0xe530('0x1a')]);return;}var _0x3ba594=rta[_0xe530('0x1e')](_0x2117c7[_0xe530('0x10')]['sort']);_0x2117c7['query']['sort']=_0x3ba594[_0xe530('0x1f')][_0xe530('0x20')](',');_0x279745=_0x3ba594[_0xe530('0x21')];})['then'](function(){if(!_0x1a9327){return[];}return rta[_0xe530('0x22')](_0x1a9327,_0x31a982);})[_0xe530('0x15')](function(_0x2b7db4){_0x3c62ef=_0x2b7db4;return rta[_0xe530('0x23')]();})['then'](function(_0x50a875){_0x52f233=_0x50a875['rows'];if((!_0x333a26||_0x14b4e8)&&!_0x279745){return _0x3c62ef;}if(_0x279745&&!_0x333a26){return rta[_0xe530('0x24')](_0x52f233,_0x3c62ef,_0x279745);}else{return rta['getAgentIdsByStatus'](_0x52f233,_0x3c62ef,_0x333a26);}})['then'](function(_0x36bbc5){_0x3c62ef=_0x36bbc5;var _0x2cbf36=![];if(_0x3c62ef[_0xe530('0x25')]===0x0){if(_0x1a9327||_0x333a26){_0x2cbf36=!![];}if(_0x14b4e8){_0x2cbf36=![];}}if(_0x2cbf36){return _0x14cc6e;}var _0x42261c=_[_0xe530('0x26')](db[_0xe530('0x27')][_0xe530('0x28')],function(_0x5e3ea4){return{'name':_0x5e3ea4[_0xe530('0x29')],'type':_0x5e3ea4[_0xe530('0x2a')][_0xe530('0x2b')]};});_0x2117c7[_0xe530('0x10')][_0xe530('0x2c')]=_0xe530('0x2d');_0x2117c7['query'][_0xe530('0x2e')]=!![];_0x1fd23f=qs[_0xe530('0x2f')](_0x42261c,_0x2117c7);_0x1fd23f['raw']=!![];var _0x1fd4db=[];if(_0x3c62ef[_0xe530('0x25')]>0x0){_0x1fd4db[_0xe530('0x30')]({'id':{'$in':_0x3c62ef}});if(_0x279745&&!_0x333a26){_0x296d54=[db[_0xe530('0x31')]['literal'](_0xe530('0x32')+_0x3c62ef+')')];_0x1fd23f['order']=_0x296d54;}}if(_0x14b4e8){_0x500f10[_0xe530('0x33')](function(_0x571d40){var _0x51e3e1=!![];if(_0x333a26===_0xe530('0x14')&&_0x31a982!==_0x571d40){_0x51e3e1=![];}_0x1fd4db[_0xe530('0x30')]({[_0x571d40+_0xe530('0x34')]:_0x51e3e1});});if(_0x39d79a){_0x1fd4db['push']({'pauseType':_0x39d79a});}}else if(_0x333a26){_0x500f10[_0xe530('0x33')](function(_0x418acc){_0x1fd4db['push']({[_0x418acc+_0xe530('0x34')]:![]});});}_0x1fd23f['where']=_['merge'](_0x1fd23f['where'],{'$and':_0x1fd4db});if(_0x2117c7[_0xe530('0x35')][_0xe530('0x2c')]==='user'){var _0x1ab1cc={'params':{'id':_0x2117c7[_0xe530('0x35')][_0xe530('0x36')]},'query':{'section':_0xe530('0x37'),'role':_0xe530('0x2d'),'online':!![],'raw':!![],'ids':_0x3c62ef,'customSorting':_0x296d54}};if(_0x14b4e8){_0x1ab1cc['query'][_0xe530('0x38')]=_0x1fd4db;}_0x1ab1cc[_0xe530('0x10')]=Object[_0xe530('0x39')](_0x1ab1cc[_0xe530('0x10')],_0x2117c7['query']);delete _0x1ab1cc[_0xe530('0x10')]['id'];return db[_0xe530('0x3a')][_0xe530('0x3b')](_0x1ab1cc);}return db[_0xe530('0x27')]['findAndCountAll'](_0x1fd23f);})[_0xe530('0x15')](function(_0x16f95c){_0x14cc6e[_0xe530('0x9')]=_0x16f95c[_0xe530('0x9')];_0x545b97=_0x16f95c[_0xe530('0x3c')];return _0x545b97[_0xe530('0x26')](function(_0x2c61e0){var _0x16ab48=_[_0xe530('0x3d')](_0x52f233,['id',_0x2c61e0['id']]);if(_0x16ab48){var _0x185fa4=rta[_0xe530('0x3e')](_0x16ab48);_[_0xe530('0x3f')](_0x2c61e0,_0x185fa4);}_0x2c61e0[_0xe530('0x1c')]=rta[_0xe530('0x40')](_0x2c61e0);if(_0x2c61e0['globalStatus']['includes'](_0xe530('0x13'))){_0x500f10[_0xe530('0x33')](function(_0xc7a993){if(_0x2c61e0[_0xc7a993+'Pause']){_0x2c61e0[_0xc7a993+_0xe530('0x41')]='pause';}});}return _0x2c61e0;});})['then'](function(_0xf34838){if(!_0x279745||_0x296d54){return _0xf34838;}return rta['sortAgentsByStatus'](_0xf34838,_0x279745);})[_0xe530('0x15')](function(_0x4c6dbe){var _0x24de83=null;if(_0x2117c7['query'][_0xe530('0x1f')]){var _0x555d7b=_0x2117c7[_0xe530('0x10')][_0xe530('0x1f')][_0xe530('0x42')](',');_0x24de83=_0x4c6dbe[_0xe530('0x26')](function(_0x31341b){return _[_0xe530('0x43')](_0x31341b,_0x555d7b);});}_0x14cc6e[_0xe530('0x3c')]=_0x24de83||_0x4c6dbe;return _0x14cc6e;})[_0xe530('0x15')](respondWithFilteredResult(_0x39eacd,_0x1fd23f))[_0xe530('0x44')](APIHandleError(_0x39eacd));};exports[_0xe530('0x45')]=function(_0x45728c,_0x23e5a2){var _0x46c8ba={'count':0x0,'rows':[]};var _0x54b619={};var _0x2838f0;var _0x98692c;var _0x362b54;Promise['resolve']()['then'](function(){if(_0x45728c['query'][_0xe530('0x16')]){if(!utils[_0xe530('0x17')](_0x45728c['query'][_0xe530('0x16')])){throw new APIBadRequestError(util[_0xe530('0x18')](_0xe530('0x19'),_0x45728c['query'][_0xe530('0x16')]));}_0x2838f0=_0x45728c[_0xe530('0x10')][_0xe530('0x16')][_0xe530('0x46')]();}var _0x2bd74b=_[_0xe530('0x47')](_0x2838f0)+_0xe530('0x48');var _0x4463c8=_[_0xe530('0x26')](db[_0x2bd74b][_0xe530('0x28')],function(_0x25a447){return{'name':_0x25a447['fieldName'],'type':_0x25a447[_0xe530('0x2a')]['key']};});if(!_0x45728c[_0xe530('0x10')][_0xe530('0x1f')]){var _0x34f7c4=['id',_0xe530('0x49')];if(_0x2838f0==='voice'){_0x34f7c4[_0xe530('0x30')]('type');if(_0x45728c[_0xe530('0x10')][_0xe530('0x2a')]===_0xe530('0x4a')){_0x34f7c4[_0xe530('0x30')]([_0xe530('0x4b'),_0xe530('0x4c')]);}}_0x45728c[_0xe530('0x10')][_0xe530('0x1f')]=_0x34f7c4[_0xe530('0x20')](',');}_0x54b619=qs[_0xe530('0x2f')](_0x4463c8,_0x45728c);if(_0x45728c[_0xe530('0x35')]['role']===_0xe530('0x35')){var _0x3a2395={'params':{'id':_0x45728c[_0xe530('0x35')][_0xe530('0x36')]},'query':{'section':_0x2838f0===_0xe530('0x4d')&&_0x45728c[_0xe530('0x10')]['type']==='outbound'?_0xe530('0x4e'):_['startCase'](_0x2838f0)+_0xe530('0x4f'),'type':_0x45728c[_0xe530('0x10')][_0xe530('0x2a')],'nolimit':!![],'sort':_0xe530('0x49'),'filter':_0x45728c[_0xe530('0x10')][_0xe530('0x50')]}};return db[_0xe530('0x3a')]['getResources'](_0x3a2395);}return db[_0x2bd74b][_0xe530('0x51')](_0x54b619);})[_0xe530('0x15')](function(_0x258d09){_0x46c8ba[_0xe530('0x9')]=_0x258d09['count'];_0x98692c=_0x258d09['rows'];return rtq[_0xe530('0x52')](_0x45728c,_0x2838f0);})[_0xe530('0x15')](function(_0x152df5){_0x362b54=_0x152df5['rows'];return rtq['initializeQueues'](_0x98692c,_0x362b54,_0x2838f0,_0x45728c['query']['type']);})[_0xe530('0x15')](function(_0x18cfea){_0x46c8ba['rows']=_0x18cfea;return _0x46c8ba;})[_0xe530('0x15')](respondWithFilteredResult(_0x23e5a2,_0x54b619))['catch'](APIHandleError(_0x23e5a2));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4416edc..b6f160a 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3e1e5f,_0x36c749){var _0x2696d0=function(_0x4f593b){while(--_0x4f593b){_0x3e1e5f['push'](_0x3e1e5f['shift']());}};_0x2696d0(++_0x36c749);}(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1966a3,_0x563da3){var _0xb0efc3=function(_0x7bcd77){while(--_0x7bcd77){_0x1966a3['push'](_0x1966a3['shift']());}};_0xb0efc3(++_0x563da3);}(_0xe706,0xa3));var _0x6e70=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xe706[_0x1afabf];return _0x497ff1;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index d28c9d6..c9f21fa 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 _0x12e9=['INTEGER','DATE','STRING'];(function(_0x3a25ab,_0x32c7fe){var _0x512888=function(_0x12da3a){while(--_0x12da3a){_0x3a25ab['push'](_0x3a25ab['shift']());}};_0x512888(++_0x32c7fe);}(_0x12e9,0x66));var _0x912e=function(_0x585a17,_0x2740be){_0x585a17=_0x585a17-0x0;var _0x55f47e=_0x12e9[_0x585a17];return _0x55f47e;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x912e('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x912e('0x1')]},'uniqueid':{'type':Sequelize[_0x912e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x912e('0x1')]},'ringtime':{'type':Sequelize[_0x912e('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x912e('0x2')]},'membername':{'type':Sequelize[_0x912e('0x2')]}}; \ No newline at end of file +var _0x8ad5=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x246691,_0x86858d){var _0x11783a=function(_0x58cc5a){while(--_0x58cc5a){_0x246691['push'](_0x246691['shift']());}};_0x11783a(++_0x86858d);}(_0x8ad5,0xf1));var _0x58ad=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8ad5[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x58ad('0x0'));module[_0x58ad('0x1')]={'state':{'type':Sequelize[_0x58ad('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x58ad('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x58ad('0x4')]},'responsetime':{'type':Sequelize[_0x58ad('0x4')]},'ringtime':{'type':Sequelize[_0x58ad('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x58ad('0x3')]},'campaigntype':{'type':Sequelize[_0x58ad('0x3')]},'membername':{'type':Sequelize[_0x58ad('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6d8774d..b3bc762 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 _0x473f=['util','api','moment','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x4c9754,_0xbff4b){var _0x149a02=function(_0x3446be){while(--_0x3446be){_0x4c9754['push'](_0x4c9754['shift']());}};_0x149a02(++_0xbff4b);}(_0x473f,0x18b));var _0xf473=function(_0x2a44d3,_0x528ea8){_0x2a44d3=_0x2a44d3-0x0;var _0x2d9014=_0x473f[_0x2a44d3];return _0x2d9014;};'use strict';var _=require(_0xf473('0x0'));var util=require(_0xf473('0x1'));var logger=require('../../config/logger')(_0xf473('0x2'));var moment=require(_0xf473('0x3'));var BPromise=require('bluebird');var rp=require(_0xf473('0x4'));var fs=require('fs');var path=require(_0xf473('0x5'));var rimraf=require('rimraf');var config=require(_0xf473('0x6'));var attributes=require(_0xf473('0x7'));module[_0xf473('0x8')]=function(_0x5bcca5,_0x3c6091){return _0x5bcca5[_0xf473('0x9')](_0xf473('0xa'),attributes,{'tableName':_0xf473('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43bc=['moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0x331066,_0x517520){var _0x4816c0=function(_0x7a61d6){while(--_0x7a61d6){_0x331066['push'](_0x331066['shift']());}};_0x4816c0(++_0x517520);}(_0x43bc,0xa4));var _0xc43b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x43bc[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xc43b('0x0'));var util=require(_0xc43b('0x1'));var logger=require(_0xc43b('0x2'))(_0xc43b('0x3'));var moment=require(_0xc43b('0x4'));var BPromise=require(_0xc43b('0x5'));var rp=require(_0xc43b('0x6'));var fs=require('fs');var path=require(_0xc43b('0x7'));var rimraf=require(_0xc43b('0x8'));var config=require('../../config/environment');var attributes=require(_0xc43b('0x9'));module[_0xc43b('0xa')]=function(_0x64a041,_0x4ad5c1){return _0x64a041[_0xc43b('0xb')](_0xc43b('0xc'),attributes,{'tableName':_0xc43b('0xd'),'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 24a4526..7736a3a 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 _0x350a=['body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','create'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x350a,0xb1));var _0xa350=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x350a[_0x3be7ff];return _0x186721;};'use strict';var _=require(_0xa350('0x0'));var util=require(_0xa350('0x1'));var moment=require(_0xa350('0x2'));var BPromise=require('bluebird');var rs=require(_0xa350('0x3'));var fs=require('fs');var Redis=require(_0xa350('0x4'));var db=require(_0xa350('0x5'))['db'];var utils=require(_0xa350('0x6'));var logger=require(_0xa350('0x7'))(_0xa350('0x8'));var config=require('../../config/environment');var jayson=require(_0xa350('0x9'));var client=jayson[_0xa350('0xa')][_0xa350('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x279c69,_0x578c99,_0x229c80){return new BPromise(function(_0x3973fc,_0x5b04af){return client[_0xa350('0xc')](_0x279c69,_0x229c80)[_0xa350('0xd')](function(_0xce8765){logger['info'](_0xa350('0xe'),_0x578c99,_0xa350('0xf'));logger[_0xa350('0x10')](_0xa350('0x11'),_0x578c99,_0xa350('0xf'),JSON[_0xa350('0x12')](_0xce8765));if(_0xce8765[_0xa350('0x13')]){if(_0xce8765[_0xa350('0x13')][_0xa350('0x14')]===0x1f4){logger['error'](_0xa350('0xe'),_0x578c99,_0xce8765[_0xa350('0x13')][_0xa350('0x15')]);return _0x5b04af(_0xce8765['error'][_0xa350('0x15')]);}logger['error'](_0xa350('0xe'),_0x578c99,_0xce8765[_0xa350('0x13')][_0xa350('0x15')]);return _0x3973fc(_0xce8765[_0xa350('0x13')]['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x578c99,_0xa350('0xf'));_0x3973fc(_0xce8765[_0xa350('0x16')][_0xa350('0x15')]);}})[_0xa350('0x17')](function(_0x538d69){logger[_0xa350('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x578c99,_0x538d69);_0x5b04af(_0x538d69);});});}exports[_0xa350('0x18')]=function(_0x1aec00){var _0x5bca8a=this;return new Promise(function(_0x1a7abd,_0x9cef1c){return db['ReportAgentPreview'][_0xa350('0x19')](_0x1aec00[_0xa350('0x1a')],{'raw':_0x1aec00[_0xa350('0x1b')]?_0x1aec00[_0xa350('0x1b')][_0xa350('0x1c')]===undefined?!![]:![]:!![]})[_0xa350('0xd')](function(_0x447255){logger['info'](_0xa350('0x18'),_0x1aec00);logger[_0xa350('0x10')](_0xa350('0x18'),_0x1aec00,JSON['stringify'](_0x447255));_0x1a7abd(_0x447255);})['catch'](function(_0x5481dc){logger['error'](_0xa350('0x18'),_0x5481dc[_0xa350('0x15')],_0x1aec00);_0x9cef1c(_0x5bca8a[_0xa350('0x13')](0x1f4,_0x5481dc['message']));});});}; \ No newline at end of file +var _0xb23f=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x324189,_0x202ac1){var _0x495eee=function(_0x4380b9){while(--_0x4380b9){_0x324189['push'](_0x324189['shift']());}};_0x495eee(++_0x202ac1);}(_0xb23f,0x90));var _0xfb23=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb23f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfb23('0x0'));var util=require(_0xfb23('0x1'));var moment=require(_0xfb23('0x2'));var BPromise=require(_0xfb23('0x3'));var rs=require(_0xfb23('0x4'));var fs=require('fs');var Redis=require(_0xfb23('0x5'));var db=require(_0xfb23('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb23('0x7'))(_0xfb23('0x8'));var config=require(_0xfb23('0x9'));var jayson=require(_0xfb23('0xa'));var client=jayson[_0xfb23('0xb')][_0xfb23('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x488f00,_0x5199c5,_0x79082f){return new BPromise(function(_0x36a395,_0x4cda88){return client[_0xfb23('0xd')](_0x488f00,_0x79082f)[_0xfb23('0xe')](function(_0x43f65e){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x5199c5,_0xfb23('0xf'));logger[_0xfb23('0x10')](_0xfb23('0x11'),_0x5199c5,_0xfb23('0xf'),JSON[_0xfb23('0x12')](_0x43f65e));if(_0x43f65e[_0xfb23('0x13')]){if(_0x43f65e[_0xfb23('0x13')][_0xfb23('0x14')]===0x1f4){logger[_0xfb23('0x13')](_0xfb23('0x15'),_0x5199c5,_0x43f65e[_0xfb23('0x13')]['message']);return _0x4cda88(_0x43f65e[_0xfb23('0x13')]['message']);}logger[_0xfb23('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x5199c5,_0x43f65e[_0xfb23('0x13')][_0xfb23('0x16')]);return _0x36a395(_0x43f65e[_0xfb23('0x13')][_0xfb23('0x16')]);}else{logger['info'](_0xfb23('0x15'),_0x5199c5,'request\x20sent');_0x36a395(_0x43f65e['result'][_0xfb23('0x16')]);}})[_0xfb23('0x17')](function(_0x598198){logger[_0xfb23('0x13')](_0xfb23('0x15'),_0x5199c5,_0x598198);_0x4cda88(_0x598198);});});}exports[_0xfb23('0x18')]=function(_0x318eb7){var _0xc92f52=this;return new Promise(function(_0x52266a,_0x4ea6ed){return db[_0xfb23('0x19')][_0xfb23('0x1a')](_0x318eb7[_0xfb23('0x1b')],{'raw':_0x318eb7[_0xfb23('0x1c')]?_0x318eb7['options'][_0xfb23('0x1d')]===undefined?!![]:![]:!![]})[_0xfb23('0xe')](function(_0x72b361){logger['info']('CreateReportAgentPreview',_0x318eb7);logger[_0xfb23('0x10')](_0xfb23('0x18'),_0x318eb7,JSON['stringify'](_0x72b361));_0x52266a(_0x72b361);})['catch'](function(_0x214001){logger[_0xfb23('0x13')](_0xfb23('0x18'),_0x214001[_0xfb23('0x16')],_0x318eb7);_0x4ea6ed(_0xc92f52['error'](0x1f4,_0x214001['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index eeba370..67d9488 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 _0x20dd=['put','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues'];(function(_0x16e7e9,_0x55cdc8){var _0x467eca=function(_0x5f4977){while(--_0x5f4977){_0x16e7e9['push'](_0x16e7e9['shift']());}};_0x467eca(++_0x55cdc8);}(_0x20dd,0xc8));var _0xd20d=function(_0x33bc12,_0x1f1091){_0x33bc12=_0x33bc12-0x0;var _0xface15=_0x20dd[_0x33bc12];return _0xface15;};'use strict';var multer=require(_0xd20d('0x0'));var util=require(_0xd20d('0x1'));var path=require(_0xd20d('0x2'));var express=require(_0xd20d('0x3'));var router=express[_0xd20d('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xd20d('0x5'));router[_0xd20d('0x6')](_0xd20d('0x7'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x9')]);router[_0xd20d('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xd20d('0x8')](),controller[_0xd20d('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0xd20d('0xb')]);router[_0xd20d('0x6')](_0xd20d('0xc'),auth[_0xd20d('0x8')](),controller['voiceQueues']);router['get'](_0xd20d('0xd'),auth[_0xd20d('0x8')](),controller[_0xd20d('0xe')]);router[_0xd20d('0x6')]('/mail/queues',auth[_0xd20d('0x8')](),controller['mailQueues']);router[_0xd20d('0x6')]('/mail/accounts',auth[_0xd20d('0x8')](),controller['mailAccounts']);router[_0xd20d('0x6')](_0xd20d('0xf'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xd20d('0x6')](_0xd20d('0x10'),auth[_0xd20d('0x8')](),controller['smsQueues']);router[_0xd20d('0x6')](_0xd20d('0x11'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x12')]);router[_0xd20d('0x6')](_0xd20d('0x13'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x14')]);router['get'](_0xd20d('0x15'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x16')]);router[_0xd20d('0x6')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0xd20d('0x6')](_0xd20d('0x17'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x18')]);router['get'](_0xd20d('0x19'),auth['isAuthenticated'](),controller[_0xd20d('0x1a')]);router['get'](_0xd20d('0x1b'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x1c')]);router[_0xd20d('0x6')](_0xd20d('0x1d'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x1e')]);router[_0xd20d('0x1f')]('/voice/queues/:id',auth[_0xd20d('0x8')](),controller['updateVoiceQueue']);router['get']('/outbound',auth[_0xd20d('0x8')](),controller[_0xd20d('0x20')]);router[_0xd20d('0x6')](_0xd20d('0x21'),auth[_0xd20d('0x8')](),controller['outboundChannels']);router[_0xd20d('0x6')](_0xd20d('0x22'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x23')]);router[_0xd20d('0x1f')](_0xd20d('0x24'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x25')]);router[_0xd20d('0x6')](_0xd20d('0x26'),auth[_0xd20d('0x8')](),controller['telephones']);router[_0xd20d('0x6')]('/trunks',auth['isAuthenticated'](),controller['trunks']);router[_0xd20d('0x6')](_0xd20d('0x27'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x28')]);router[_0xd20d('0x6')](_0xd20d('0x29'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x2a')]);router[_0xd20d('0x6')](_0xd20d('0x2b'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x2c')]);router['get']('/mail/queues/waitinginteractions',auth[_0xd20d('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0xd20d('0x6')](_0xd20d('0x2d'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x2e')]);router[_0xd20d('0x6')](_0xd20d('0x2f'),auth['isAuthenticated'](),controller[_0xd20d('0x30')]);router[_0xd20d('0x6')]('/sms/queues/waitinginteractions',auth[_0xd20d('0x8')](),controller[_0xd20d('0x31')]);router[_0xd20d('0x6')](_0xd20d('0x32'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x33')]);router[_0xd20d('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xd20d('0x34')]);router[_0xd20d('0x35')](_0xd20d('0x36'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x37')](_0xd20d('0x38')));router[_0xd20d('0x6')](_0xd20d('0x39'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x3a')]);router[_0xd20d('0x35')](_0xd20d('0x3b'),auth[_0xd20d('0x8')](),controller['queueNotify'](_0xd20d('0x3c')));router[_0xd20d('0x6')](_0xd20d('0x3d'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x3e')]);router['post'](_0xd20d('0x3f'),auth['isAuthenticated'](),controller[_0xd20d('0x37')]('fax'));router[_0xd20d('0x6')](_0xd20d('0x40'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x41')]);router[_0xd20d('0x35')](_0xd20d('0x42'),auth['isAuthenticated'](),controller[_0xd20d('0x37')](_0xd20d('0x43')));router[_0xd20d('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xd20d('0x44')]);router['post']('/sms/queues/:id/notify',auth[_0xd20d('0x8')](),controller[_0xd20d('0x37')](_0xd20d('0x45')));router[_0xd20d('0x35')](_0xd20d('0x46'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x37')](_0xd20d('0x47')));router[_0xd20d('0x6')]('/sms/queues/:id',auth[_0xd20d('0x8')](),controller[_0xd20d('0x48')]);router[_0xd20d('0x6')](_0xd20d('0x49'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x4a')]);router[_0xd20d('0x35')]('/agents/:id/notify',auth[_0xd20d('0x8')](),controller[_0xd20d('0x4b')]);module[_0xd20d('0x4c')]=router; \ No newline at end of file +var _0x6118=['/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','multer','util','./rpc.controller','/voice/channels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','isAuthenticated','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','sms'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x6118,0x17c));var _0x8611=function(_0x5ba74f,_0x200bf4){_0x5ba74f=_0x5ba74f-0x0;var _0x534d79=_0x6118[_0x5ba74f];return _0x534d79;};'use strict';var multer=require(_0x8611('0x0'));var util=require(_0x8611('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x8611('0x2'));router['get'](_0x8611('0x3'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x8611('0x4')](_0x8611('0x5'),auth['isAuthenticated'](),controller[_0x8611('0x6')]);router[_0x8611('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x8611('0x7')]);router[_0x8611('0x4')]('/voice/queues',auth['isAuthenticated'](),controller[_0x8611('0x8')]);router[_0x8611('0x4')](_0x8611('0x9'),auth[_0x8611('0xa')](),controller[_0x8611('0xb')]);router[_0x8611('0x4')](_0x8611('0xc'),auth['isAuthenticated'](),controller[_0x8611('0xd')]);router[_0x8611('0x4')](_0x8611('0xe'),auth['isAuthenticated'](),controller[_0x8611('0xf')]);router[_0x8611('0x4')](_0x8611('0x10'),auth[_0x8611('0xa')](),controller[_0x8611('0x11')]);router[_0x8611('0x4')]('/sms/queues',auth[_0x8611('0xa')](),controller['smsQueues']);router[_0x8611('0x4')](_0x8611('0x12'),auth[_0x8611('0xa')](),controller[_0x8611('0x13')]);router[_0x8611('0x4')](_0x8611('0x14'),auth[_0x8611('0xa')](),controller[_0x8611('0x15')]);router[_0x8611('0x4')]('/voice/queues/preview/:id',auth[_0x8611('0xa')](),controller[_0x8611('0x16')]);router['get'](_0x8611('0x17'),auth[_0x8611('0xa')](),controller['voiceQueuesChannels']);router['get'](_0x8611('0x18'),auth[_0x8611('0xa')](),controller[_0x8611('0x19')]);router['get'](_0x8611('0x1a'),auth[_0x8611('0xa')](),controller[_0x8611('0x1b')]);router[_0x8611('0x4')](_0x8611('0x1c'),auth['isAuthenticated'](),controller[_0x8611('0x1d')]);router[_0x8611('0x4')]('/voice/queues/:id',auth[_0x8611('0xa')](),controller[_0x8611('0x1e')]);router[_0x8611('0x1f')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x8611('0x20')]);router[_0x8611('0x4')](_0x8611('0x21'),auth[_0x8611('0xa')](),controller[_0x8611('0x22')]);router['get'](_0x8611('0x23'),auth['isAuthenticated'](),controller[_0x8611('0x24')]);router[_0x8611('0x4')]('/agents',auth[_0x8611('0xa')](),controller[_0x8611('0x25')]);router[_0x8611('0x1f')](_0x8611('0x26'),auth[_0x8611('0xa')](),controller['agentCapacity']);router[_0x8611('0x4')](_0x8611('0x27'),auth['isAuthenticated'](),controller[_0x8611('0x28')]);router[_0x8611('0x4')](_0x8611('0x29'),auth['isAuthenticated'](),controller[_0x8611('0x2a')]);router[_0x8611('0x4')](_0x8611('0x2b'),auth[_0x8611('0xa')](),controller[_0x8611('0x2c')]);router[_0x8611('0x4')](_0x8611('0x2d'),auth[_0x8611('0xa')](),controller['faxAccounts']);router[_0x8611('0x4')](_0x8611('0x2e'),auth[_0x8611('0xa')](),controller[_0x8611('0x2f')]);router[_0x8611('0x4')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x8611('0x30')]);router['get'](_0x8611('0x31'),auth[_0x8611('0xa')](),controller[_0x8611('0x32')]);router[_0x8611('0x4')](_0x8611('0x33'),auth[_0x8611('0xa')](),controller[_0x8611('0x34')]);router[_0x8611('0x4')](_0x8611('0x35'),auth[_0x8611('0xa')](),controller[_0x8611('0x36')]);router[_0x8611('0x4')](_0x8611('0x37'),auth[_0x8611('0xa')](),controller[_0x8611('0x38')]);router[_0x8611('0x4')](_0x8611('0x39'),auth[_0x8611('0xa')](),controller['faxQueuesWaitingInteractions']);router[_0x8611('0x3a')]('/mail/queues/:id/notify',auth[_0x8611('0xa')](),controller[_0x8611('0x3b')]('mail'));router[_0x8611('0x4')]('/mail/queues/:id',auth[_0x8611('0xa')](),controller['showMailQueues']);router[_0x8611('0x3a')]('/chat/queues/:id/notify',auth[_0x8611('0xa')](),controller[_0x8611('0x3b')](_0x8611('0x3c')));router['get'](_0x8611('0x3d'),auth[_0x8611('0xa')](),controller[_0x8611('0x3e')]);router[_0x8611('0x3a')](_0x8611('0x3f'),auth[_0x8611('0xa')](),controller[_0x8611('0x3b')](_0x8611('0x40')));router['get'](_0x8611('0x41'),auth[_0x8611('0xa')](),controller['showFaxQueues']);router[_0x8611('0x3a')](_0x8611('0x42'),auth['isAuthenticated'](),controller[_0x8611('0x3b')](_0x8611('0x43')));router[_0x8611('0x4')]('/openchannel/queues/:id',auth[_0x8611('0xa')](),controller[_0x8611('0x44')]);router['post']('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x8611('0x3b')](_0x8611('0x45')));router[_0x8611('0x3a')](_0x8611('0x46'),auth[_0x8611('0xa')](),controller[_0x8611('0x3b')]('whatsapp'));router[_0x8611('0x4')](_0x8611('0x47'),auth[_0x8611('0xa')](),controller[_0x8611('0x48')]);router[_0x8611('0x4')](_0x8611('0x49'),auth[_0x8611('0xa')](),controller[_0x8611('0x4a')]);router[_0x8611('0x3a')]('/agents/:id/notify',auth[_0x8611('0xa')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 917dc31..55aaed9 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 _0xa630=['user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','MailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','Account','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','update','agentTransferTimeout','bluebird','moment','../../mysqldb','api','client','http','then','error','code','message','result','json','stack','name','status','isNil','rows','find','voiceChannels','VoiceChannels','catch','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity'];(function(_0x12ec8a,_0x3174d8){var _0x326d69=function(_0x2e09bb){while(--_0x2e09bb){_0x12ec8a['push'](_0x12ec8a['shift']());}};_0x326d69(++_0x3174d8);}(_0xa630,0xbe));var _0x0a63=function(_0x5a0200,_0x48a45a){_0x5a0200=_0x5a0200-0x0;var _0x530544=_0xa630[_0x5a0200];return _0x530544;};'use strict';var BPromise=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));var _=require('lodash');var util=require('util');var db=require(_0x0a63('0x2'))['db'];var logger=require('../../config/logger')(_0x0a63('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0a63('0x4')][_0x0a63('0x5')]({'port':0x232a});var mailClient=jayson[_0x0a63('0x4')][_0x0a63('0x5')]({'port':0x232b});var routingClient=jayson[_0x0a63('0x4')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2760b0,_0x3d5f0b,_0xc2dcd7){return new BPromise(function(_0x41d21d,_0x12a7df){var _0x2a1bd7=_0xc2dcd7?_0xc2dcd7:amiClient;return _0x2a1bd7['request'](_0x2760b0,_0x3d5f0b)[_0x0a63('0x6')](function(_0xb714c7){if(_0xb714c7[_0x0a63('0x7')]){if(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x8')]===0x1f4){return _0x12a7df(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x9')]);}return _0x41d21d(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x9')]);}else{_0x41d21d(_0xb714c7[_0x0a63('0xa')]);}})['catch'](function(_0x345f56){_0x12a7df(_0x345f56);});});}function respondWithResult(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xc8;return function(_0x3d6323){if(_0x3d6323){return _0x420043['status'](_0x2fce86)[_0x0a63('0xb')](_0x3d6323);}return _0x420043['sendStatus'](0x194);};}function handleError(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0x1f4;return function(_0x26b2bc){logger[_0x0a63('0x7')](_0x26b2bc[_0x0a63('0xc')]);if(_0x26b2bc[_0x0a63('0xd')]){delete _0x26b2bc[_0x0a63('0xd')];}_0x331e99[_0x0a63('0xe')](_0x19e922)['send'](_0x26b2bc);};}function findById(_0x47788e){return function(_0x56b314){if(!_[_0x0a63('0xf')](_0x47788e)&&!_[_0x0a63('0xf')](_0x56b314)&&!_[_0x0a63('0xf')](_0x56b314[_0x0a63('0x10')])){return _[_0x0a63('0x11')](_0x56b314[_0x0a63('0x10')],function(_0x30f292){return _0x30f292['id']==_0x47788e;});}return null;};}exports[_0x0a63('0x12')]=function(_0x2fd06c,_0x3cc74d){return respondWithRpcPromise(_0x0a63('0x13'),_0x2fd06c['query'])['then'](respondWithResult(_0x3cc74d,null))[_0x0a63('0x14')](handleError(_0x3cc74d,null));};exports['voiceChannelMixMonitor']=function(_0x2fc87c,_0x5937df){return respondWithRpcPromise(_0x0a63('0x15'),_[_0x0a63('0x16')](_0x2fc87c[_0x0a63('0x17')],_0x2fc87c[_0x0a63('0x18')]))['then'](respondWithResult(_0x5937df,null))[_0x0a63('0x14')](handleError(_0x5937df,null));};exports['voiceChannelStopMixMonitor']=function(_0x3a7f9d,_0x11fe64){return respondWithRpcPromise(_0x0a63('0x19'),_[_0x0a63('0x16')](_0x3a7f9d[_0x0a63('0x17')],_0x3a7f9d[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x11fe64,null))[_0x0a63('0x14')](handleError(_0x11fe64,null));};exports['voiceQueues']=function(_0x5e5987,_0x55fb70){return respondWithRpcPromise('VoiceQueues',_0x5e5987[_0x0a63('0x17')])['then'](respondWithResult(_0x55fb70,null))['catch'](handleError(_0x55fb70,null));};exports[_0x0a63('0x1a')]=function(_0x1d5448,_0x362d6a){return respondWithRpcPromise(_0x0a63('0x1b'),_0x1d5448['query'])[_0x0a63('0x6')](findById(_0x1d5448[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x362d6a,null))['catch'](handleError(_0x362d6a,null));};exports[_0x0a63('0x1c')]=function(_0xcf409,_0x1b7bdb){return respondWithRpcPromise(_0x0a63('0x1d'),_[_0x0a63('0x16')](_0xcf409[_0x0a63('0x1e')],_0xcf409[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x1b7bdb,null))['catch'](handleError(_0x1b7bdb,null));};exports[_0x0a63('0x1f')]=function(_0x574c06,_0x151cb6){return respondWithRpcPromise(_0x0a63('0x20'),_[_0x0a63('0x16')](_0x574c06[_0x0a63('0x17')],_0x574c06[_0x0a63('0x18')]))['then'](respondWithResult(_0x151cb6,null))[_0x0a63('0x14')](handleError(_0x151cb6,null));};exports[_0x0a63('0x21')]=function(_0x33a717,_0x46fb40){return respondWithRpcPromise('VoiceQueuesChannels',_0x33a717[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x46fb40,null))['catch'](handleError(_0x46fb40,null));};exports['voiceQueuesChannel']=function(_0x34a170,_0x51d959){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0a63('0x16')](_0x34a170[_0x0a63('0x17')],_0x34a170['params']))[_0x0a63('0x6')](respondWithResult(_0x51d959,null))[_0x0a63('0x14')](handleError(_0x51d959,null));};exports[_0x0a63('0x22')]=function(_0x333130,_0x395cce){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x333130[_0x0a63('0x17')],_0x333130[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x395cce,null))[_0x0a63('0x14')](handleError(_0x395cce,null));};exports[_0x0a63('0x23')]=function(_0x273bcf,_0x59912d){return respondWithRpcPromise(_0x0a63('0x24'),_[_0x0a63('0x16')](_0x273bcf['query'],_0x273bcf[_0x0a63('0x18')]))['then'](respondWithResult(_0x59912d,null))['catch'](handleError(_0x59912d,null));};exports[_0x0a63('0x25')]=function(_0x232388,_0xdc602c){return respondWithRpcPromise('Outbound',_0x232388[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0xdc602c,null))[_0x0a63('0x14')](handleError(_0xdc602c,null));};exports[_0x0a63('0x26')]=function(_0x3f88a1,_0x876bc6){return respondWithRpcPromise(_0x0a63('0x27'),_0x3f88a1['query'])[_0x0a63('0x6')](respondWithResult(_0x876bc6,null))[_0x0a63('0x14')](handleError(_0x876bc6,null));};exports[_0x0a63('0x28')]=function(_0x53d034,_0x5d9952){var _0x28f904;return respondWithRpcPromise('Agents',_0x53d034[_0x0a63('0x17')])[_0x0a63('0x6')](function(_0x128e9e){_0x28f904=_0x128e9e;return respondWithRpcPromise('Agents',_0x53d034[_0x0a63('0x17')],routingClient);})[_0x0a63('0x6')](function(_0x46b6ee){return _[_0x0a63('0x16')]({},_0x46b6ee,_0x28f904);})['then'](respondWithResult(_0x5d9952,null))[_0x0a63('0x14')](handleError(_0x5d9952,null));};exports[_0x0a63('0x29')]=function(_0x4234cd,_0x2ccd99){if(_0x4234cd[_0x0a63('0x1e')]&&_0x4234cd[_0x0a63('0x1e')]['interaction']&&_0x4234cd[_0x0a63('0x2a')]&&_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')]){for(var _0x793502 in _0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')]){if(_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x0a63('0x2c')](_0x793502)){db[_0x0a63('0x2d')][_0x0a63('0x2e')]({'where':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')],'type':_0x0a63('0x2f'),'exitAt':null,'uniqueid':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502]&&_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502]['length']?{'$notIn':_0x4234cd[_0x0a63('0x1e')]['interaction'][_0x793502]}:{'$ne':null}}})['then'](function(_0xd9eddc){var _0x223ecf=moment()[_0x0a63('0x30')](_0x0a63('0x31'));for(var _0xd9149d=0x0,_0x9c89ed=_0xd9eddc[_0x0a63('0x32')];_0xd9149d<_0x9c89ed;_0xd9149d+=0x1){_0xd9eddc[_0xd9149d][_0x0a63('0x33')]({'exitAt':_0x223ecf});}});for(var _0x3d0667=0x0;_0x3d0667<_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502][_0x0a63('0x32')];_0x3d0667+=0x1){db[_0x0a63('0x2d')][_0x0a63('0x34')]({'where':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')],'type':_0x0a63('0x2f'),'uniqueid':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502][_0x3d0667],'exitAt':null},'defaults':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')]['name'],'interface':_[_0x0a63('0xf')](_0x4234cd[_0x0a63('0x2a')]['interface'])?util['format']('SIP/%s',_0x4234cd['user'][_0x0a63('0xd')]):_0x4234cd[_0x0a63('0x2a')]['interface'],'type':_0x0a63('0x2f'),'enterAt':moment()['format'](_0x0a63('0x31')),'role':_0x0a63('0x35'),'internal':_0x4234cd['user']['internal'],'uniqueid':_0x4234cd['body'][_0x0a63('0x2b')][_0x793502][_0x3d0667]}});}}}}return respondWithRpcPromise(_0x0a63('0x36'),{'id':_0x4234cd[_0x0a63('0x18')]['id'],'capacity':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x37')]},routingClient)['then'](respondWithResult(_0x2ccd99,null))[_0x0a63('0x14')](handleError(_0x2ccd99,null));};exports[_0x0a63('0x38')]=function(_0x22b3ea,_0x10adf1){return respondWithRpcPromise(_0x0a63('0x39'),_0x22b3ea['query'])[_0x0a63('0x6')](respondWithResult(_0x10adf1,null))[_0x0a63('0x14')](handleError(_0x10adf1,null));};exports[_0x0a63('0x3a')]=function(_0x1fbd2b,_0x4f3414){return respondWithRpcPromise(_0x0a63('0x3b'),_0x1fbd2b[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x4f3414,null))[_0x0a63('0x14')](handleError(_0x4f3414,null));};exports[_0x0a63('0x3c')]=function(_0x258ed3,_0x4d4e20){return respondWithRpcPromise(_0x0a63('0x3d'),_0x258ed3[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x4d4e20,null))[_0x0a63('0x14')](handleError(_0x4d4e20,null));};exports['chatQueues']=function(_0x4c1e34,_0x2ac98b){return respondWithRpcPromise(_0x0a63('0x3e'),_0x4c1e34[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x2ac98b,null))[_0x0a63('0x14')](handleError(_0x2ac98b,null));};exports['showChatQueues']=function(_0x5e6aae,_0x58b3a8){return respondWithRpcPromise(_0x0a63('0x3e'),_0x5e6aae['query'],routingClient)[_0x0a63('0x6')](findById(_0x5e6aae[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x58b3a8,null))['catch'](handleError(_0x58b3a8,null));};exports['mailQueues']=function(_0x2d63c6,_0x226279){return respondWithRpcPromise(_0x0a63('0x3f'),_0x2d63c6[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x226279,null))[_0x0a63('0x14')](handleError(_0x226279,null));};exports[_0x0a63('0x40')]=function(_0xc3415c,_0xe454ef){return respondWithRpcPromise(_0x0a63('0x3f'),_0xc3415c[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0xc3415c[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0xe454ef,null))['catch'](handleError(_0xe454ef,null));};exports['mailAccounts']=function(_0x1adea6,_0x24c9e0){return respondWithRpcPromise('MailAccounts',_0x1adea6[_0x0a63('0x17')],mailClient)[_0x0a63('0x6')](respondWithResult(_0x24c9e0,null))['catch'](handleError(_0x24c9e0,null));};exports[_0x0a63('0x41')]=function(_0x3053e4,_0x5e5495){return respondWithRpcPromise('OpenchannelQueues',_0x3053e4[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x5e5495,null))[_0x0a63('0x14')](handleError(_0x5e5495,null));};exports['showOpenchannelQueues']=function(_0x116e05,_0x375acd){return respondWithRpcPromise(_0x0a63('0x42'),_0x116e05[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x116e05['params']['id']))[_0x0a63('0x6')](respondWithResult(_0x375acd,null))[_0x0a63('0x14')](handleError(_0x375acd,null));};exports[_0x0a63('0x43')]=function(_0x1fa9cd,_0x295c06){return respondWithRpcPromise(_0x0a63('0x44'),_0x1fa9cd[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x295c06,null))[_0x0a63('0x14')](handleError(_0x295c06,null));};exports[_0x0a63('0x45')]=function(_0x252f70,_0x1155f1){return respondWithRpcPromise(_0x0a63('0x44'),_0x252f70[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x252f70[_0x0a63('0x18')]['id']))['then'](respondWithResult(_0x1155f1,null))['catch'](handleError(_0x1155f1,null));};exports[_0x0a63('0x46')]=function(_0x30e5f0,_0x4137bc){return respondWithRpcPromise(_0x0a63('0x47'),_0x30e5f0[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x4137bc,null))[_0x0a63('0x14')](handleError(_0x4137bc,null));};exports[_0x0a63('0x48')]=function(_0x1aefc4,_0x2a2f1b){return respondWithRpcPromise(_0x0a63('0x47'),_0x1aefc4[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x1aefc4[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x2a2f1b,null))[_0x0a63('0x14')](handleError(_0x2a2f1b,null));};exports[_0x0a63('0x49')]=function(_0x485969,_0x25276f){return respondWithRpcPromise('FaxQueues',_0x485969[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x25276f,null))['catch'](handleError(_0x25276f,null));};exports['showFaxQueues']=function(_0x480acb,_0x31481f){return respondWithRpcPromise(_0x0a63('0x4a'),_0x480acb[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x480acb[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x31481f,null))['catch'](handleError(_0x31481f,null));};exports['faxAccounts']=function(_0x5cb325,_0x1213a5){return respondWithRpcPromise(_0x0a63('0x4b'),_0x5cb325[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x1213a5,null))['catch'](handleError(_0x1213a5,null));};exports[_0x0a63('0x4c')]=function(_0x5ed2db,_0x5de3de){return respondWithRpcPromise(_0x0a63('0x4d'),_0x5ed2db['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x5de3de,null))[_0x0a63('0x14')](handleError(_0x5de3de,null));};exports['mailQueuesWaitingInteractions']=function(_0x267583,_0x4d1e35){return respondWithRpcPromise(_0x0a63('0x4e'),_0x267583['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x4d1e35,null))[_0x0a63('0x14')](handleError(_0x4d1e35,null));};exports[_0x0a63('0x4f')]=function(_0x4fba49,_0x3b8442){return respondWithRpcPromise(_0x0a63('0x50'),_0x4fba49[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x3b8442,null))[_0x0a63('0x14')](handleError(_0x3b8442,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x55174c,_0x550dbb){return respondWithRpcPromise(_0x0a63('0x50'),_0x55174c['query'],routingClient)[_0x0a63('0x6')](function(_0xa27da4){if(_0x55174c[_0x0a63('0x17')][_0x0a63('0x51')]!==undefined){var _0x5540c6=_(_0xa27da4[_0x0a63('0x10')])[_0x0a63('0x52')]([_0x55174c['query'][_0x0a63('0x51')],_0x55174c[_0x0a63('0x18')]['id']])[_0x0a63('0x53')](_0x0a63('0x54'))[_0x0a63('0x55')]()['value']();return _0xa27da4[_0x0a63('0x10')][_0x0a63('0x52')](function(_0x3941f6){return _0x5540c6['indexOf'](_0x3941f6['queue_id'])>-0x1;});}else{return _0xa27da4['rows'][_0x0a63('0x52')](function(_0x3b94ae){return _0x3b94ae[_0x0a63('0x54')]===parseInt(_0x55174c[_0x0a63('0x18')]['id']);});}})[_0x0a63('0x6')](respondWithResult(_0x550dbb,null))[_0x0a63('0x14')](handleError(_0x550dbb,null));};exports[_0x0a63('0x56')]=function(_0x37255d,_0x1dc593){return respondWithRpcPromise(_0x0a63('0x57'),_0x37255d['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x1dc593,null))[_0x0a63('0x14')](handleError(_0x1dc593,null));};exports[_0x0a63('0x58')]=function(_0x229954,_0x3d62ca){return respondWithRpcPromise(_0x0a63('0x59'),_0x229954['query'],routingClient)['then'](respondWithResult(_0x3d62ca,null))[_0x0a63('0x14')](handleError(_0x3d62ca,null));};exports[_0x0a63('0x5a')]=function(_0x425c8c,_0x3caea6){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x425c8c[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x3caea6,null))[_0x0a63('0x14')](handleError(_0x3caea6,null));};exports[_0x0a63('0x5b')]=function(_0x1e256e){return function(_0xee586,_0x486ffc){var _0x3710fa,_0x2173ee;var _0x430065=_[_0x0a63('0x5c')](_0x1e256e);var _0x540953=_0x1e256e==='chat'?_0x0a63('0x5d'):'Account';return db[_0x430065+_0x0a63('0x5e')][_0x0a63('0x5f')]({'raw':!![],'where':{'id':_0xee586[_0x0a63('0x18')]['id']}})[_0x0a63('0x6')](function(_0x65a390){if(_['isNil'](_0x65a390)){throw new Error(_0x430065+_0x0a63('0x60'));}_0x3710fa=_0x65a390;return db[_0x430065+_0x0a63('0x61')][_0x0a63('0x5f')]({'where':{'id':_0xee586[_0x0a63('0x1e')][_0x0a63('0x62')]},'include':[{'model':db[_0x430065+_0x0a63('0x63')],'as':_0x0a63('0x63')},{'model':db[_0x430065+_0x540953],'as':'Account'}]});})[_0x0a63('0x6')](function(_0x1a329c){if(_[_0x0a63('0xf')](_0x1a329c)){throw new Error(_0x430065+_0x0a63('0x64'));}_0x2173ee=_0x1a329c;return _0x1a329c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0a63('0x6')](function(){var _0x148bbd={'uniqueid':_0x1e256e+'.'+_0x2173ee['id']+'.'+_0x2173ee[_0x0a63('0x63')]['id'],'FromUserId':_0xee586['user']['id'],'type':_0x0a63('0x65')};_0x148bbd[_0x430065+_0x0a63('0x66')]=_0x2173ee['id'];_0x148bbd[_0x430065+_0x0a63('0x67')]=_0x2173ee['Interaction']['id'];_0x148bbd[_0x0a63('0x68')+_0x430065+_0x540953+'Id']=_0x2173ee[_0x0a63('0x69')]['id'];_0x148bbd['To'+_0x430065+_0x0a63('0x6a')]=_0x3710fa['id'];return db[_0x430065+_0x0a63('0x6b')][_0x0a63('0x6c')](_0x148bbd);})[_0x0a63('0x6')](function(){return respondWithRpcPromise(_0x0a63('0x6d'),{'channel':_0x1e256e,'interaction':_0x2173ee[_0x0a63('0x63')],'message':_0x2173ee,'account':_0x2173ee[_0x0a63('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a63('0x65'),'appdata':_0x3710fa[_0x0a63('0xd')]+','+(_0x2173ee[_0x0a63('0x69')][_0x0a63('0x6e')]||0x12c),'interval':_0x0a63('0x6f')}]},routingClient);})[_0x0a63('0x6')](respondWithResult(_0x486ffc,null))[_0x0a63('0x14')](handleError(_0x486ffc,null));};};exports['agentNotify']=function(_0x3ddf5e,_0x5f0510){var _0x19a46f,_0x36fd48;if(_['isNil'](_0x3ddf5e[_0x0a63('0x1e')][_0x0a63('0x70')])){throw new Error(_0x0a63('0x71'));}var _0x2e1dc6=_0x3ddf5e[_0x0a63('0x1e')][_0x0a63('0x70')];var _0x1030f7=_[_0x0a63('0x5c')](_0x2e1dc6);var _0x393399=_0x2e1dc6==='chat'?_0x0a63('0x5d'):'Account';return db['User'][_0x0a63('0x5f')]({'raw':!![],'where':{'id':_0x3ddf5e[_0x0a63('0x18')]['id'],'role':_0x0a63('0x35')}})[_0x0a63('0x6')](function(_0x5e1f76){if(_[_0x0a63('0xf')](_0x5e1f76)){throw new Error('Agent\x20not\x20found');}_0x19a46f=_0x5e1f76;return db[_0x1030f7+'Message'][_0x0a63('0x5f')]({'where':{'id':_0x3ddf5e['body']['messageId']},'include':[{'model':db[_0x1030f7+_0x0a63('0x63')],'as':_0x0a63('0x63')},{'model':db[_0x1030f7+_0x393399],'as':_0x0a63('0x69')}]});})[_0x0a63('0x6')](function(_0x52488a){if(_[_0x0a63('0xf')](_0x52488a)){throw new Error(_0x1030f7+'\x20Message\x20not\x20found');}_0x36fd48=_0x52488a;return _0x52488a[_0x0a63('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x11dd21={'uniqueid':_0x2e1dc6+'.'+_0x36fd48['id']+'.'+_0x36fd48['Interaction']['id'],'FromUserId':_0x3ddf5e[_0x0a63('0x2a')]['id'],'type':_0x0a63('0x65'),'ToUserId':_0x19a46f['id']};_0x11dd21[_0x1030f7+_0x0a63('0x66')]=_0x36fd48['id'];_0x11dd21[_0x1030f7+_0x0a63('0x67')]=_0x36fd48[_0x0a63('0x63')]['id'];_0x11dd21[_0x0a63('0x68')+_0x1030f7+_0x393399+'Id']=_0x36fd48[_0x0a63('0x69')]['id'];return db[_0x1030f7+_0x0a63('0x6b')][_0x0a63('0x6c')](_0x11dd21);})['then'](function(){return respondWithRpcPromise(_0x0a63('0x6d'),{'channel':_0x2e1dc6,'interaction':_0x36fd48['Interaction'],'message':_0x36fd48,'account':_0x36fd48[_0x0a63('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a63('0x35'),'appdata':_0x19a46f[_0x0a63('0xd')]+','+(_0x36fd48[_0x0a63('0x69')][_0x0a63('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x0a63('0x6')](respondWithResult(_0x5f0510,null))[_0x0a63('0x14')](handleError(_0x5f0510,null));}; \ No newline at end of file +var _0x9c5a=['Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','From','Start','bluebird','moment','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','merge','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','SIP/%s','format','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2af36f,_0x33ae77){_0x2af36f=_0x2af36f-0x0;var _0x14064c=_0x9c5a[_0x2af36f];return _0x14064c;};'use strict';var BPromise=require(_0xa9c5('0x0'));var moment=require(_0xa9c5('0x1'));var _=require('lodash');var util=require(_0xa9c5('0x2'));var db=require(_0xa9c5('0x3'))['db'];var logger=require(_0xa9c5('0x4'))(_0xa9c5('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa9c5('0x6')][_0xa9c5('0x7')]({'port':0x232a});var mailClient=jayson['client'][_0xa9c5('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xa9c5('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){var _0x52afb2=_0x4b6db6?_0x4b6db6:amiClient;return _0x52afb2[_0xa9c5('0x8')](_0x3df556,_0x4cb597)[_0xa9c5('0x9')](function(_0x51c14c){if(_0x51c14c[_0xa9c5('0xa')]){if(_0x51c14c[_0xa9c5('0xa')]['code']===0x1f4){return _0x16f331(_0x51c14c['error'][_0xa9c5('0xb')]);}return _0x3d6b50(_0x51c14c[_0xa9c5('0xa')][_0xa9c5('0xb')]);}else{_0x3d6b50(_0x51c14c[_0xa9c5('0xc')]);}})[_0xa9c5('0xd')](function(_0x4492a4){_0x16f331(_0x4492a4);});});}function respondWithResult(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xc8;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0xe')](_0x42d5cf)['json'](_0x3c5ac7);}return _0x51c8d[_0xa9c5('0xf')](0x194);};}function handleError(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0x1f4;return function(_0x3806c4){logger[_0xa9c5('0xa')](_0x3806c4[_0xa9c5('0x10')]);if(_0x3806c4[_0xa9c5('0x11')]){delete _0x3806c4[_0xa9c5('0x11')];}_0x1276d2[_0xa9c5('0xe')](_0x7df76d)[_0xa9c5('0x12')](_0x3806c4);};}function findById(_0x4bb57e){return function(_0x2b0d73){if(!_[_0xa9c5('0x13')](_0x4bb57e)&&!_[_0xa9c5('0x13')](_0x2b0d73)&&!_['isNil'](_0x2b0d73[_0xa9c5('0x14')])){return _[_0xa9c5('0x15')](_0x2b0d73[_0xa9c5('0x14')],function(_0x3b8cf7){return _0x3b8cf7['id']==_0x4bb57e;});}return null;};}exports[_0xa9c5('0x16')]=function(_0x349f27,_0x3b8d4d){return respondWithRpcPromise(_0xa9c5('0x17'),_0x349f27[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x3b8d4d,null))[_0xa9c5('0xd')](handleError(_0x3b8d4d,null));};exports[_0xa9c5('0x19')]=function(_0x54f8b9,_0x1115ad){return respondWithRpcPromise(_0xa9c5('0x1a'),_['merge'](_0x54f8b9['query'],_0x54f8b9[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x1115ad,null))[_0xa9c5('0xd')](handleError(_0x1115ad,null));};exports[_0xa9c5('0x1c')]=function(_0xc0bca3,_0xd4b8a1){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0xc0bca3[_0xa9c5('0x18')],_0xc0bca3[_0xa9c5('0x1b')]))['then'](respondWithResult(_0xd4b8a1,null))[_0xa9c5('0xd')](handleError(_0xd4b8a1,null));};exports[_0xa9c5('0x1d')]=function(_0x306c9b,_0x32fc7d){return respondWithRpcPromise(_0xa9c5('0x1e'),_0x306c9b[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x32fc7d,null))['catch'](handleError(_0x32fc7d,null));};exports['showVoiceQueues']=function(_0x242771,_0x4cd5e6){return respondWithRpcPromise(_0xa9c5('0x1e'),_0x242771[_0xa9c5('0x18')])['then'](findById(_0x242771[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4cd5e6,null))['catch'](handleError(_0x4cd5e6,null));};exports[_0xa9c5('0x1f')]=function(_0x32baf9,_0x198cdf){return respondWithRpcPromise(_0xa9c5('0x20'),_[_0xa9c5('0x21')](_0x32baf9['body'],_0x32baf9[_0xa9c5('0x1b')]))['then'](respondWithResult(_0x198cdf,null))[_0xa9c5('0xd')](handleError(_0x198cdf,null));};exports[_0xa9c5('0x22')]=function(_0x2eeed1,_0x541475){return respondWithRpcPromise(_0xa9c5('0x23'),_[_0xa9c5('0x21')](_0x2eeed1['query'],_0x2eeed1[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x541475,null))[_0xa9c5('0xd')](handleError(_0x541475,null));};exports[_0xa9c5('0x24')]=function(_0x22ee21,_0x3392d0){return respondWithRpcPromise(_0xa9c5('0x25'),_0x22ee21['query'])[_0xa9c5('0x9')](respondWithResult(_0x3392d0,null))[_0xa9c5('0xd')](handleError(_0x3392d0,null));};exports[_0xa9c5('0x26')]=function(_0x1c01f9,_0x1c617c){return respondWithRpcPromise(_0xa9c5('0x27'),_[_0xa9c5('0x21')](_0x1c01f9[_0xa9c5('0x18')],_0x1c01f9['params']))['then'](respondWithResult(_0x1c617c,null))[_0xa9c5('0xd')](handleError(_0x1c617c,null));};exports[_0xa9c5('0x28')]=function(_0xf2bebc,_0x1313b2){return respondWithRpcPromise(_0xa9c5('0x29'),_[_0xa9c5('0x21')](_0xf2bebc['query'],_0xf2bebc['params']))['then'](respondWithResult(_0x1313b2,null))[_0xa9c5('0xd')](handleError(_0x1313b2,null));};exports[_0xa9c5('0x2a')]=function(_0x5087e4,_0x13a1f5){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa9c5('0x21')](_0x5087e4[_0xa9c5('0x18')],_0x5087e4[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x13a1f5,null))['catch'](handleError(_0x13a1f5,null));};exports[_0xa9c5('0x2b')]=function(_0x2cd721,_0x191153){return respondWithRpcPromise(_0xa9c5('0x2c'),_0x2cd721[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x191153,null))[_0xa9c5('0xd')](handleError(_0x191153,null));};exports[_0xa9c5('0x2d')]=function(_0x573fc0,_0x11b2b2){return respondWithRpcPromise(_0xa9c5('0x2e'),_0x573fc0[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x11b2b2,null))[_0xa9c5('0xd')](handleError(_0x11b2b2,null));};exports[_0xa9c5('0x2f')]=function(_0x493b20,_0x307736){var _0x5b7a0a;return respondWithRpcPromise(_0xa9c5('0x30'),_0x493b20['query'])[_0xa9c5('0x9')](function(_0xd4305d){_0x5b7a0a=_0xd4305d;return respondWithRpcPromise(_0xa9c5('0x30'),_0x493b20['query'],routingClient);})[_0xa9c5('0x9')](function(_0x1ddd72){return _[_0xa9c5('0x21')]({},_0x1ddd72,_0x5b7a0a);})[_0xa9c5('0x9')](respondWithResult(_0x307736,null))['catch'](handleError(_0x307736,null));};exports[_0xa9c5('0x31')]=function(_0x97803f,_0x3db918){if(_0x97803f[_0xa9c5('0x32')]&&_0x97803f[_0xa9c5('0x32')]['interaction']&&_0x97803f[_0xa9c5('0x33')]&&_0x97803f['user'][_0xa9c5('0x11')]){for(var _0x397614 in _0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')]){if(_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0xa9c5('0x35')](_0x397614)){db[_0xa9c5('0x36')][_0xa9c5('0x37')]({'where':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')]['name'],'type':_0xa9c5('0x38'),'exitAt':null,'uniqueid':_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614]&&_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0xa9c5('0x39')]?{'$notIn':_0x97803f['body'][_0xa9c5('0x34')][_0x397614]}:{'$ne':null}}})[_0xa9c5('0x9')](function(_0x557c21){var _0x52cfbf=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4e97bf=0x0,_0x160020=_0x557c21[_0xa9c5('0x39')];_0x4e97bf<_0x160020;_0x4e97bf+=0x1){_0x557c21[_0x4e97bf][_0xa9c5('0x3a')]({'exitAt':_0x52cfbf});}});for(var _0x1e8f5f=0x0;_0x1e8f5f<_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0xa9c5('0x39')];_0x1e8f5f+=0x1){db[_0xa9c5('0x36')][_0xa9c5('0x3b')]({'where':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x11')],'type':_0xa9c5('0x38'),'uniqueid':_0x97803f[_0xa9c5('0x32')]['interaction'][_0x397614][_0x1e8f5f],'exitAt':null},'defaults':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')]['name'],'interface':_[_0xa9c5('0x13')](_0x97803f[_0xa9c5('0x33')]['interface'])?util['format'](_0xa9c5('0x3c'),_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x11')]):_0x97803f['user']['interface'],'type':_0xa9c5('0x38'),'enterAt':moment()[_0xa9c5('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa9c5('0x3e'),'internal':_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x3f')],'uniqueid':_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0x1e8f5f]}});}}}}return respondWithRpcPromise(_0xa9c5('0x40'),{'id':_0x97803f['params']['id'],'capacity':_0x97803f['body']['capacity']},routingClient)[_0xa9c5('0x9')](respondWithResult(_0x3db918,null))[_0xa9c5('0xd')](handleError(_0x3db918,null));};exports[_0xa9c5('0x41')]=function(_0xef4d2,_0x380266){return respondWithRpcPromise(_0xa9c5('0x42'),_0xef4d2['query'])[_0xa9c5('0x9')](respondWithResult(_0x380266,null))[_0xa9c5('0xd')](handleError(_0x380266,null));};exports[_0xa9c5('0x43')]=function(_0x2bdc77,_0xa0b458){return respondWithRpcPromise(_0xa9c5('0x44'),_0x2bdc77['query'])['then'](respondWithResult(_0xa0b458,null))[_0xa9c5('0xd')](handleError(_0xa0b458,null));};exports['campaigns']=function(_0x1b158f,_0x5ea9b0){return respondWithRpcPromise(_0xa9c5('0x45'),_0x1b158f[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x46')]=function(_0xe5390f,_0x1a75f3){return respondWithRpcPromise(_0xa9c5('0x47'),_0xe5390f['query'],routingClient)['then'](respondWithResult(_0x1a75f3,null))[_0xa9c5('0xd')](handleError(_0x1a75f3,null));};exports[_0xa9c5('0x48')]=function(_0x3205f2,_0x5b4323){return respondWithRpcPromise(_0xa9c5('0x47'),_0x3205f2[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x3205f2[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x5b4323,null))[_0xa9c5('0xd')](handleError(_0x5b4323,null));};exports[_0xa9c5('0x49')]=function(_0x298b3d,_0x5a7f0a){return respondWithRpcPromise(_0xa9c5('0x4a'),_0x298b3d['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5a7f0a,null))[_0xa9c5('0xd')](handleError(_0x5a7f0a,null));};exports[_0xa9c5('0x4b')]=function(_0x4dfe3a,_0x4d475a){return respondWithRpcPromise(_0xa9c5('0x4a'),_0x4dfe3a['query'],routingClient)[_0xa9c5('0x9')](findById(_0x4dfe3a[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4d475a,null))[_0xa9c5('0xd')](handleError(_0x4d475a,null));};exports['mailAccounts']=function(_0x3505d3,_0x222091){return respondWithRpcPromise(_0xa9c5('0x4c'),_0x3505d3[_0xa9c5('0x18')],mailClient)['then'](respondWithResult(_0x222091,null))['catch'](handleError(_0x222091,null));};exports[_0xa9c5('0x4d')]=function(_0x3deb64,_0x67c1f8){return respondWithRpcPromise(_0xa9c5('0x4e'),_0x3deb64[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x67c1f8,null))['catch'](handleError(_0x67c1f8,null));};exports[_0xa9c5('0x4f')]=function(_0x1e787e,_0x2497e1){return respondWithRpcPromise(_0xa9c5('0x4e'),_0x1e787e[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1e787e[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x2497e1,null))[_0xa9c5('0xd')](handleError(_0x2497e1,null));};exports[_0xa9c5('0x50')]=function(_0x50d438,_0x5e17a2){return respondWithRpcPromise(_0xa9c5('0x51'),_0x50d438[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5e17a2,null))[_0xa9c5('0xd')](handleError(_0x5e17a2,null));};exports['showSmsQueues']=function(_0x1c2478,_0x4aa699){return respondWithRpcPromise(_0xa9c5('0x51'),_0x1c2478[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1c2478[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4aa699,null))[_0xa9c5('0xd')](handleError(_0x4aa699,null));};exports[_0xa9c5('0x52')]=function(_0x3890b4,_0x2f323e){return respondWithRpcPromise(_0xa9c5('0x53'),_0x3890b4[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2f323e,null))['catch'](handleError(_0x2f323e,null));};exports[_0xa9c5('0x54')]=function(_0x1a4aa7,_0x15eb25){return respondWithRpcPromise(_0xa9c5('0x53'),_0x1a4aa7[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1a4aa7[_0xa9c5('0x1b')]['id']))['then'](respondWithResult(_0x15eb25,null))['catch'](handleError(_0x15eb25,null));};exports[_0xa9c5('0x55')]=function(_0x502a00,_0x2ae087){return respondWithRpcPromise(_0xa9c5('0x56'),_0x502a00['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2ae087,null))[_0xa9c5('0xd')](handleError(_0x2ae087,null));};exports['showFaxQueues']=function(_0x4f8d9e,_0x14c4f2){return respondWithRpcPromise(_0xa9c5('0x56'),_0x4f8d9e[_0xa9c5('0x18')],routingClient)['then'](findById(_0x4f8d9e['params']['id']))[_0xa9c5('0x9')](respondWithResult(_0x14c4f2,null))[_0xa9c5('0xd')](handleError(_0x14c4f2,null));};exports['faxAccounts']=function(_0xd0371c,_0x393b00){return respondWithRpcPromise(_0xa9c5('0x57'),_0xd0371c[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x393b00,null))[_0xa9c5('0xd')](handleError(_0x393b00,null));};exports['chatQueuesWaitingInteractions']=function(_0x44d969,_0x3aeb3c){return respondWithRpcPromise(_0xa9c5('0x58'),_0x44d969[_0xa9c5('0x18')],routingClient)['then'](respondWithResult(_0x3aeb3c,null))[_0xa9c5('0xd')](handleError(_0x3aeb3c,null));};exports[_0xa9c5('0x59')]=function(_0x59e917,_0x112d64){return respondWithRpcPromise(_0xa9c5('0x5a'),_0x59e917[_0xa9c5('0x18')],routingClient)['then'](respondWithResult(_0x112d64,null))[_0xa9c5('0xd')](handleError(_0x112d64,null));};exports[_0xa9c5('0x5b')]=function(_0x18dbfa,_0x2e00f5){return respondWithRpcPromise(_0xa9c5('0x5c'),_0x18dbfa[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2e00f5,null))['catch'](handleError(_0x2e00f5,null));};exports[_0xa9c5('0x5d')]=function(_0x40468b,_0x7f9e83){return respondWithRpcPromise(_0xa9c5('0x5c'),_0x40468b[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](function(_0x39fae1){if(_0x40468b[_0xa9c5('0x18')][_0xa9c5('0x5e')]!==undefined){var _0x7d0e85=_(_0x39fae1[_0xa9c5('0x14')])['filter']([_0x40468b[_0xa9c5('0x18')][_0xa9c5('0x5e')],_0x40468b['params']['id']])[_0xa9c5('0x5f')](_0xa9c5('0x60'))[_0xa9c5('0x61')]()['value']();return _0x39fae1[_0xa9c5('0x14')][_0xa9c5('0x62')](function(_0x22dfd7){return _0x7d0e85[_0xa9c5('0x63')](_0x22dfd7['queue_id'])>-0x1;});}else{return _0x39fae1[_0xa9c5('0x14')][_0xa9c5('0x62')](function(_0x4f4fa1){return _0x4f4fa1['queue_id']===parseInt(_0x40468b['params']['id']);});}})['then'](respondWithResult(_0x7f9e83,null))['catch'](handleError(_0x7f9e83,null));};exports['smsQueuesWaitingInteractions']=function(_0x5277ee,_0x54c8f5){return respondWithRpcPromise(_0xa9c5('0x64'),_0x5277ee[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x54c8f5,null))[_0xa9c5('0xd')](handleError(_0x54c8f5,null));};exports[_0xa9c5('0x65')]=function(_0x592594,_0x4d7772){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x592594['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x4d7772,null))[_0xa9c5('0xd')](handleError(_0x4d7772,null));};exports[_0xa9c5('0x66')]=function(_0x2eda17,_0x5253e8){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2eda17[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5253e8,null))[_0xa9c5('0xd')](handleError(_0x5253e8,null));};exports[_0xa9c5('0x67')]=function(_0x1d89ec){return function(_0x5673f1,_0x2b69b9){var _0x43ae9,_0xd063cf;var _0x58de52=_[_0xa9c5('0x68')](_0x1d89ec);var _0x2741df=_0x1d89ec===_0xa9c5('0x69')?_0xa9c5('0x6a'):'Account';return db[_0x58de52+_0xa9c5('0x6b')][_0xa9c5('0x6c')]({'raw':!![],'where':{'id':_0x5673f1['params']['id']}})['then'](function(_0x2f1e9f){if(_['isNil'](_0x2f1e9f)){throw new Error(_0x58de52+'\x20Queue\x20not\x20found');}_0x43ae9=_0x2f1e9f;return db[_0x58de52+_0xa9c5('0x6d')][_0xa9c5('0x6c')]({'where':{'id':_0x5673f1[_0xa9c5('0x32')][_0xa9c5('0x6e')]},'include':[{'model':db[_0x58de52+_0xa9c5('0x6f')],'as':'Interaction'},{'model':db[_0x58de52+_0x2741df],'as':_0xa9c5('0x70')}]});})['then'](function(_0x129157){if(_[_0xa9c5('0x13')](_0x129157)){throw new Error(_0x58de52+_0xa9c5('0x71'));}_0xd063cf=_0x129157;return _0x129157[_0xa9c5('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4b056e={'uniqueid':_0x1d89ec+'.'+_0xd063cf['id']+'.'+_0xd063cf[_0xa9c5('0x6f')]['id'],'FromUserId':_0x5673f1['user']['id'],'type':'queue'};_0x4b056e[_0x58de52+_0xa9c5('0x73')]=_0xd063cf['id'];_0x4b056e[_0x58de52+_0xa9c5('0x74')]=_0xd063cf['Interaction']['id'];_0x4b056e['From'+_0x58de52+_0x2741df+'Id']=_0xd063cf[_0xa9c5('0x70')]['id'];_0x4b056e['To'+_0x58de52+_0xa9c5('0x75')]=_0x43ae9['id'];return db[_0x58de52+_0xa9c5('0x76')][_0xa9c5('0x77')](_0x4b056e);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x1d89ec,'interaction':_0xd063cf[_0xa9c5('0x6f')],'message':_0xd063cf,'account':_0xd063cf[_0xa9c5('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa9c5('0x78'),'appdata':_0x43ae9[_0xa9c5('0x11')]+','+(_0xd063cf[_0xa9c5('0x70')][_0xa9c5('0x79')]||0x12c),'interval':_0xa9c5('0x7a')}]},routingClient);})['then'](respondWithResult(_0x2b69b9,null))[_0xa9c5('0xd')](handleError(_0x2b69b9,null));};};exports[_0xa9c5('0x7b')]=function(_0x5065e2,_0x328869){var _0x2488aa,_0x5544d8;if(_[_0xa9c5('0x13')](_0x5065e2[_0xa9c5('0x32')][_0xa9c5('0x7c')])){throw new Error(_0xa9c5('0x7d'));}var _0x21e3ba=_0x5065e2[_0xa9c5('0x32')][_0xa9c5('0x7c')];var _0x13e233=_[_0xa9c5('0x68')](_0x21e3ba);var _0x24a6d3=_0x21e3ba===_0xa9c5('0x69')?_0xa9c5('0x6a'):_0xa9c5('0x70');return db[_0xa9c5('0x7e')][_0xa9c5('0x6c')]({'raw':!![],'where':{'id':_0x5065e2[_0xa9c5('0x1b')]['id'],'role':_0xa9c5('0x3e')}})['then'](function(_0x425b92){if(_[_0xa9c5('0x13')](_0x425b92)){throw new Error(_0xa9c5('0x7f'));}_0x2488aa=_0x425b92;return db[_0x13e233+'Message'][_0xa9c5('0x6c')]({'where':{'id':_0x5065e2[_0xa9c5('0x32')]['messageId']},'include':[{'model':db[_0x13e233+_0xa9c5('0x6f')],'as':_0xa9c5('0x6f')},{'model':db[_0x13e233+_0x24a6d3],'as':_0xa9c5('0x70')}]});})[_0xa9c5('0x9')](function(_0x343b35){if(_[_0xa9c5('0x13')](_0x343b35)){throw new Error(_0x13e233+_0xa9c5('0x71'));}_0x5544d8=_0x343b35;return _0x343b35[_0xa9c5('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa9c5('0x9')](function(){var _0xb09d88={'uniqueid':_0x21e3ba+'.'+_0x5544d8['id']+'.'+_0x5544d8[_0xa9c5('0x6f')]['id'],'FromUserId':_0x5065e2[_0xa9c5('0x33')]['id'],'type':_0xa9c5('0x78'),'ToUserId':_0x2488aa['id']};_0xb09d88[_0x13e233+'MessageId']=_0x5544d8['id'];_0xb09d88[_0x13e233+'InteractionId']=_0x5544d8[_0xa9c5('0x6f')]['id'];_0xb09d88[_0xa9c5('0x80')+_0x13e233+_0x24a6d3+'Id']=_0x5544d8['Account']['id'];return db[_0x13e233+_0xa9c5('0x76')][_0xa9c5('0x77')](_0xb09d88);})[_0xa9c5('0x9')](function(){return respondWithRpcPromise(_0xa9c5('0x81'),{'channel':_0x21e3ba,'interaction':_0x5544d8['Interaction'],'message':_0x5544d8,'account':_0x5544d8['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xa9c5('0x3e'),'appdata':_0x2488aa[_0xa9c5('0x11')]+','+(_0x5544d8[_0xa9c5('0x70')]['agentTransferTimeout']||0x12c),'interval':_0xa9c5('0x7a')}]},routingClient);})[_0xa9c5('0x9')](respondWithResult(_0x328869,null))[_0xa9c5('0xd')](handleError(_0x328869,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 7a6c258..43eaf26 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 _0xae64=['run','post','create','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','show'];(function(_0x59b3dd,_0x5ca67e){var _0xe21cd6=function(_0x29744d){while(--_0x29744d){_0x59b3dd['push'](_0x59b3dd['shift']());}};_0xe21cd6(++_0x5ca67e);}(_0xae64,0xfe));var _0x4ae6=function(_0x31bca3,_0x209a1e){_0x31bca3=_0x31bca3-0x0;var _0x2f10ea=_0xae64[_0x31bca3];return _0x2f10ea;};'use strict';var multer=require('multer');var util=require(_0x4ae6('0x0'));var path=require(_0x4ae6('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae6('0x2'));var router=express[_0x4ae6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4ae6('0x4'));var interaction=require(_0x4ae6('0x5'));var config=require('../../config/environment');var controller=require(_0x4ae6('0x6'));router[_0x4ae6('0x7')]('/',auth[_0x4ae6('0x8')](),controller[_0x4ae6('0x9')]);router['get'](_0x4ae6('0xa'),auth[_0x4ae6('0x8')](),controller[_0x4ae6('0xb')]);router[_0x4ae6('0x7')]('/:id/run',auth['isAuthenticated'](),controller[_0x4ae6('0xc')]);router[_0x4ae6('0xd')]('/',auth[_0x4ae6('0x8')](),controller[_0x4ae6('0xe')]);router[_0x4ae6('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4ae6('0x10')](_0x4ae6('0xa'),auth[_0x4ae6('0x8')](),controller[_0x4ae6('0x11')]);module[_0x4ae6('0x12')]=router; \ No newline at end of file +var _0x67b6=['./schedule.controller','get','isAuthenticated','index','run','create','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e40f4,_0x16bd61){var _0x68063b=function(_0x4c12d0){while(--_0x4c12d0){_0x4e40f4['push'](_0x4e40f4['shift']());}};_0x68063b(++_0x16bd61);}(_0x67b6,0x1ac));var _0x667b=function(_0x26b0b6,_0x2ccde5){_0x26b0b6=_0x26b0b6-0x0;var _0x59f455=_0x67b6[_0x26b0b6];return _0x59f455;};'use strict';var multer=require(_0x667b('0x0'));var util=require(_0x667b('0x1'));var path=require(_0x667b('0x2'));var timeout=require(_0x667b('0x3'));var express=require(_0x667b('0x4'));var router=express[_0x667b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x667b('0x6'));var interaction=require(_0x667b('0x7'));var config=require(_0x667b('0x8'));var controller=require(_0x667b('0x9'));router[_0x667b('0xa')]('/',auth[_0x667b('0xb')](),controller[_0x667b('0xc')]);router['get']('/:id',auth[_0x667b('0xb')](),controller['show']);router[_0x667b('0xa')]('/:id/run',auth[_0x667b('0xb')](),controller[_0x667b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x667b('0xe')]);router[_0x667b('0xf')]('/:id',auth[_0x667b('0xb')](),controller[_0x667b('0x10')]);router['delete'](_0x667b('0x11'),auth[_0x667b('0xb')](),controller[_0x667b('0x12')]);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 9209f54..8f8e1b9 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 _0x3c4e=['default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom'];(function(_0x42fce4,_0x39207c){var _0x28ff77=function(_0x185dad){while(--_0x185dad){_0x42fce4['push'](_0x42fce4['shift']());}};_0x28ff77(++_0x39207c);}(_0x3c4e,0x11f));var _0xe3c4=function(_0x483882,_0xa3ee97){_0x483882=_0x483882-0x0;var _0x1ce74d=_0x3c4e[_0x483882];return _0x1ce74d;};'use strict';var Sequelize=require(_0xe3c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe3c4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe3c4('0x1')]},'active':{'type':Sequelize[_0xe3c4('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe3c4('0x1')],'allowNull':![],'defaultValue':_0xe3c4('0x3')},'startAt':{'type':Sequelize[_0xe3c4('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe3c4('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe3c4('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe3c4('0x6')](_0xe3c4('0x7'),'quarters',_0xe3c4('0x8'),_0xe3c4('0x9'),_0xe3c4('0xa'),_0xe3c4('0xb'),_0xe3c4('0xc')),'allowNull':![],'defaultValue':_0xe3c4('0xa')},'output':{'type':Sequelize[_0xe3c4('0x6')](_0xe3c4('0xd'),_0xe3c4('0xe'),_0xe3c4('0xf')),'allowNull':![],'defaultValue':_0xe3c4('0xd')},'type':{'type':Sequelize[_0xe3c4('0x6')](_0xe3c4('0x10'),_0xe3c4('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xe3c4('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe3c4('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xe3c4('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa45d=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','minutes','pdf','csv','custom','TEXT'];(function(_0x1c11de,_0x1d764b){var _0x1dd086=function(_0x3dc483){while(--_0x3dc483){_0x1c11de['push'](_0x1c11de['shift']());}};_0x1dd086(++_0x1d764b);}(_0xa45d,0xdd));var _0xda45=function(_0x412fc4,_0x4fc268){_0x412fc4=_0x412fc4-0x0;var _0x1cd3ee=_0xa45d[_0x412fc4];return _0x1cd3ee;};'use strict';var Sequelize=require(_0xda45('0x0'));module[_0xda45('0x1')]={'name':{'type':Sequelize[_0xda45('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xda45('0x2')]},'active':{'type':Sequelize[_0xda45('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xda45('0x2')],'allowNull':![],'defaultValue':_0xda45('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xda45('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xda45('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xda45('0x7'),_0xda45('0x8'),_0xda45('0x9'),_0xda45('0xa'),_0xda45('0xb'),'hours',_0xda45('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv',_0xda45('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xda45('0xe')},'type':{'type':Sequelize['ENUM']('custom','default'),'allowNull':![],'defaultValue':_0xda45('0xf')},'sendMail':{'type':Sequelize[_0xda45('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xda45('0x2')]},'cc':{'type':Sequelize[_0xda45('0x10')]},'bcc':{'type':Sequelize[_0xda45('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xda45('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d0635ff..69a849f 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 _0x7a33=['filters','filter','merge','options','findAll','rows','catch','show','params','length','include','find','create','body','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4f34f5,_0x1c5391){var _0xc883f2=function(_0x5ab39e){while(--_0x5ab39e){_0x4f34f5['push'](_0x4f34f5['shift']());}};_0xc883f2(++_0x1c5391);}(_0x7a33,0x118));var _0x37a3=function(_0x3bcdb7,_0x445e82){_0x3bcdb7=_0x3bcdb7-0x0;var _0x1a767e=_0x7a33[_0x3bcdb7];return _0x1a767e;};'use strict';var emlformat=require(_0x37a3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x37a3('0x1'));var rp=require('request-promise');var moment=require(_0x37a3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x37a3('0x3'));var util=require(_0x37a3('0x4'));var path=require(_0x37a3('0x5'));var sox=require(_0x37a3('0x6'));var csv=require('to-csv');var ejs=require(_0x37a3('0x7'));var fs=require('fs');var fs_extra=require(_0x37a3('0x8'));var _=require(_0x37a3('0x9'));var squel=require(_0x37a3('0xa'));var crypto=require(_0x37a3('0xb'));var jsforce=require(_0x37a3('0xc'));var deskjs=require(_0x37a3('0xd'));var toCsv=require(_0x37a3('0xe'));var querystring=require(_0x37a3('0xf'));var Papa=require(_0x37a3('0x10'));var Redis=require(_0x37a3('0x11'));var authService=require(_0x37a3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x37a3('0x13'));var hardwareService=require(_0x37a3('0x14'));var logger=require(_0x37a3('0x15'))(_0x37a3('0x16'));var utils=require('../../config/utils');var config=require(_0x37a3('0x17'));var licenseUtil=require(_0x37a3('0x18'));var db=require(_0x37a3('0x19'))['db'];function respondWithStatusCode(_0x36e8ca,_0x2db8fc){_0x2db8fc=_0x2db8fc||0xcc;return function(_0x3e5b1a){if(_0x3e5b1a){return _0x36e8ca[_0x37a3('0x1a')](_0x2db8fc);}return _0x36e8ca[_0x37a3('0x1b')](_0x2db8fc)[_0x37a3('0x1c')]();};}function respondWithResult(_0x51c7e8,_0x3198de){_0x3198de=_0x3198de||0xc8;return function(_0x48b70c){if(_0x48b70c){return _0x51c7e8[_0x37a3('0x1b')](_0x3198de)[_0x37a3('0x1d')](_0x48b70c);}};}function respondWithFilteredResult(_0x115b21,_0x371895){return function(_0x95c8ec){if(_0x95c8ec){var _0x7a43b=typeof _0x371895[_0x37a3('0x1e')]===_0x37a3('0x1f')&&typeof _0x371895[_0x37a3('0x20')]===_0x37a3('0x1f');var _0x2068eb=_0x95c8ec[_0x37a3('0x21')];var _0x15f981=_0x7a43b?0x0:_0x371895['offset'];var _0x2cbf14=_0x7a43b?_0x95c8ec[_0x37a3('0x21')]:_0x371895[_0x37a3('0x1e')]+_0x371895[_0x37a3('0x20')];var _0x39f7a1;if(_0x2cbf14>=_0x2068eb){_0x2cbf14=_0x2068eb;_0x39f7a1=0xc8;}else{_0x39f7a1=0xce;}_0x115b21[_0x37a3('0x1b')](_0x39f7a1);return _0x115b21['set'](_0x37a3('0x22'),_0x15f981+'-'+_0x2cbf14+'/'+_0x2068eb)[_0x37a3('0x1d')](_0x95c8ec);}return null;};}function patchUpdates(_0x17bf4d){return function(_0x2dcfca){try{jsonpatch[_0x37a3('0x23')](_0x2dcfca,_0x17bf4d,!![]);}catch(_0x1b5a74){return BPromise[_0x37a3('0x24')](_0x1b5a74);}return _0x2dcfca[_0x37a3('0x25')]();};}function saveUpdates(_0x311264,_0x4db75b){return function(_0x455da8){if(_0x455da8){return _0x455da8[_0x37a3('0x26')](_0x311264)[_0x37a3('0x27')](function(_0x31688e){return _0x31688e;});}return null;};}function removeEntity(_0x290287,_0x2f68d9){return function(_0x2b7309){if(_0x2b7309){return _0x2b7309[_0x37a3('0x28')]()[_0x37a3('0x27')](function(){var _0x272b56=_0x2b7309[_0x37a3('0x29')]({'plain':!![]});var _0x3a9180=_0x37a3('0x2a');return db['UserProfileResource'][_0x37a3('0x28')]({'where':{'type':_0x3a9180,'resourceId':_0x272b56['id']}})[_0x37a3('0x27')](function(){return _0x2b7309;});})[_0x37a3('0x27')](function(){_0x290287[_0x37a3('0x1b')](0xcc)[_0x37a3('0x1c')]();});}};}function handleEntityNotFound(_0x122d0c,_0x1bf2d4){return function(_0x439adb){if(!_0x439adb){_0x122d0c[_0x37a3('0x1a')](0x194);}return _0x439adb;};}function handleError(_0x29bd64,_0x359b53){_0x359b53=_0x359b53||0x1f4;return function(_0x3bb06a){logger[_0x37a3('0x2b')](_0x3bb06a['stack']);if(_0x3bb06a[_0x37a3('0x2c')]){delete _0x3bb06a['name'];}_0x29bd64['status'](_0x359b53)[_0x37a3('0x2d')](_0x3bb06a);};}exports[_0x37a3('0x2e')]=function(_0x38c19a,_0x4c7703){var _0x48ba52={},_0x2b5347={},_0xe78786={'count':0x0,'rows':[]};var _0x14d1ab=_[_0x37a3('0x2f')](db[_0x37a3('0x30')][_0x37a3('0x31')],function(_0x232bfc){return{'name':_0x232bfc[_0x37a3('0x32')],'type':_0x232bfc[_0x37a3('0x33')][_0x37a3('0x34')]};});_0x2b5347[_0x37a3('0x35')]=_[_0x37a3('0x2f')](_0x14d1ab,_0x37a3('0x2c'));_0x2b5347['query']=_[_0x37a3('0x36')](_0x38c19a[_0x37a3('0x37')]);_0x2b5347['filters']=_[_0x37a3('0x38')](_0x2b5347[_0x37a3('0x35')],_0x2b5347[_0x37a3('0x37')]);_0x48ba52[_0x37a3('0x39')]=_[_0x37a3('0x38')](_0x2b5347[_0x37a3('0x35')],qs['fields'](_0x38c19a[_0x37a3('0x37')][_0x37a3('0x3a')]));_0x48ba52[_0x37a3('0x39')]=_0x48ba52[_0x37a3('0x39')]['length']?_0x48ba52[_0x37a3('0x39')]:_0x2b5347['model'];if(!_0x38c19a['query'][_0x37a3('0x3b')](_0x37a3('0x3c'))){_0x48ba52['limit']=qs['limit'](_0x38c19a[_0x37a3('0x37')][_0x37a3('0x20')]);_0x48ba52[_0x37a3('0x1e')]=qs['offset'](_0x38c19a[_0x37a3('0x37')][_0x37a3('0x1e')]);}_0x48ba52[_0x37a3('0x3d')]=qs[_0x37a3('0x3e')](_0x38c19a[_0x37a3('0x37')]['sort']);_0x48ba52[_0x37a3('0x3f')]=qs[_0x37a3('0x40')](_['pick'](_0x38c19a[_0x37a3('0x37')],_0x2b5347['filters']),_0x14d1ab);if(_0x38c19a[_0x37a3('0x37')][_0x37a3('0x41')]){_0x48ba52[_0x37a3('0x3f')]=_['merge'](_0x48ba52[_0x37a3('0x3f')],{'$or':_[_0x37a3('0x2f')](_0x14d1ab,function(_0x508dd9){if(_0x508dd9['type']!=='VIRTUAL'){var _0x21c190={};_0x21c190[_0x508dd9[_0x37a3('0x2c')]]={'$like':'%'+_0x38c19a[_0x37a3('0x37')][_0x37a3('0x41')]+'%'};return _0x21c190;}})});}_0x48ba52=_[_0x37a3('0x42')]({},_0x48ba52,_0x38c19a[_0x37a3('0x43')]);var _0x461087={'where':_0x48ba52[_0x37a3('0x3f')]};return db[_0x37a3('0x30')]['count'](_0x461087)[_0x37a3('0x27')](function(_0x46b442){_0xe78786[_0x37a3('0x21')]=_0x46b442;if(_0x38c19a[_0x37a3('0x37')]['includeAll']){_0x48ba52['include']=[{'all':!![]}];}return db[_0x37a3('0x30')][_0x37a3('0x44')](_0x48ba52);})[_0x37a3('0x27')](function(_0x41c750){_0xe78786[_0x37a3('0x45')]=_0x41c750;return _0xe78786;})[_0x37a3('0x27')](respondWithFilteredResult(_0x4c7703,_0x48ba52))[_0x37a3('0x46')](handleError(_0x4c7703,null));};exports[_0x37a3('0x47')]=function(_0x4cf51e,_0x1f5ca1){var _0x212999={'raw':![],'where':{'id':_0x4cf51e[_0x37a3('0x48')]['id']}},_0x37777a={};_0x37777a[_0x37a3('0x35')]=_[_0x37a3('0x36')](db[_0x37a3('0x30')][_0x37a3('0x31')]);_0x37777a['query']=_[_0x37a3('0x36')](_0x4cf51e['query']);_0x37777a['filters']=_[_0x37a3('0x38')](_0x37777a[_0x37a3('0x35')],_0x37777a[_0x37a3('0x37')]);_0x212999['attributes']=_['intersection'](_0x37777a[_0x37a3('0x35')],qs[_0x37a3('0x3a')](_0x4cf51e['query']['fields']));_0x212999['attributes']=_0x212999[_0x37a3('0x39')][_0x37a3('0x49')]?_0x212999[_0x37a3('0x39')]:_0x37777a[_0x37a3('0x35')];if(_0x4cf51e[_0x37a3('0x37')]['includeAll']){_0x212999[_0x37a3('0x4a')]=[{'all':!![]}];}_0x212999=_[_0x37a3('0x42')]({},_0x212999,_0x4cf51e['options']);return db['Schedule'][_0x37a3('0x4b')](_0x212999)[_0x37a3('0x27')](handleEntityNotFound(_0x1f5ca1,null))['then'](respondWithResult(_0x1f5ca1,null))[_0x37a3('0x46')](handleError(_0x1f5ca1,null));};exports['create']=function(_0x44fb5a,_0x16ae78){return db[_0x37a3('0x30')][_0x37a3('0x4c')](_0x44fb5a[_0x37a3('0x4d')],{})[_0x37a3('0x27')](function(_0x890199){var _0x3fb2cc=_0x44fb5a['user'][_0x37a3('0x29')]({'plain':!![]});if(!_0x3fb2cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fb2cc[_0x37a3('0x4e')]===_0x37a3('0x4f')){var _0x1566c7=_0x890199['get']({'plain':!![]});var _0x2fcb37=_0x37a3('0x2a');return db['UserProfileSection'][_0x37a3('0x4b')]({'where':{'name':_0x2fcb37,'userProfileId':_0x3fb2cc[_0x37a3('0x50')]},'raw':!![]})[_0x37a3('0x27')](function(_0xc81851){if(_0xc81851&&_0xc81851[_0x37a3('0x51')]===0x0){return db[_0x37a3('0x52')]['create']({'name':_0x1566c7[_0x37a3('0x2c')],'resourceId':_0x1566c7['id'],'type':_0xc81851[_0x37a3('0x2c')],'sectionId':_0xc81851['id']},{})[_0x37a3('0x27')](function(){return _0x890199;});}else{return _0x890199;}})['catch'](function(_0x353036){logger['error'](_0x37a3('0x53'),_0x353036);throw _0x353036;});}return _0x890199;})[_0x37a3('0x27')](respondWithResult(_0x16ae78,0xc9))['catch'](handleError(_0x16ae78,null));};exports[_0x37a3('0x26')]=function(_0x11c97c,_0x58c4d2){if(_0x11c97c[_0x37a3('0x4d')]['id']){delete _0x11c97c['body']['id'];}return db['Schedule'][_0x37a3('0x4b')]({'where':{'id':_0x11c97c['params']['id']}})[_0x37a3('0x27')](handleEntityNotFound(_0x58c4d2,null))[_0x37a3('0x27')](saveUpdates(_0x11c97c[_0x37a3('0x4d')],null))[_0x37a3('0x27')](respondWithResult(_0x58c4d2,null))[_0x37a3('0x46')](handleError(_0x58c4d2,null));};exports[_0x37a3('0x28')]=function(_0xde8f10,_0x16e2e0){return db[_0x37a3('0x30')][_0x37a3('0x4b')]({'where':{'id':_0xde8f10[_0x37a3('0x48')]['id']}})[_0x37a3('0x27')](handleEntityNotFound(_0x16e2e0,null))[_0x37a3('0x27')](removeEntity(_0x16e2e0,null))['catch'](handleError(_0x16e2e0,null));};exports['run']=function(_0x151dfc,_0xf95365,_0x3e8419){var _0x177bc9=require(_0x37a3('0x54'));return db[_0x37a3('0x30')]['find']({'where':{'id':_0x151dfc['params']['id']},'raw':!![]})[_0x37a3('0x27')](handleEntityNotFound(_0xf95365,null))['then'](function(){_0x177bc9[_0x37a3('0x55')](_0x151dfc[_0x37a3('0x48')]['id']);})[_0x37a3('0x27')](respondWithStatusCode(_0xf95365,null))[_0x37a3('0x46')](handleError(_0xf95365,null));}; \ No newline at end of file +var _0xa108=['Scheduler','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','rows','catch','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','../../config/schedule','run','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get'];(function(_0x553d6a,_0x64cd62){var _0x51cc52=function(_0xd97a02){while(--_0xd97a02){_0x553d6a['push'](_0x553d6a['shift']());}};_0x51cc52(++_0x64cd62);}(_0xa108,0x18a));var _0x8a10=function(_0x244706,_0x225097){_0x244706=_0x244706-0x0;var _0x286e3e=_0xa108[_0x244706];return _0x286e3e;};'use strict';var emlformat=require(_0x8a10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a10('0x1'));var jsonpatch=require(_0x8a10('0x2'));var rp=require(_0x8a10('0x3'));var moment=require(_0x8a10('0x4'));var BPromise=require(_0x8a10('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8a10('0x6'));var sox=require(_0x8a10('0x7'));var csv=require('to-csv');var ejs=require(_0x8a10('0x8'));var fs=require('fs');var fs_extra=require(_0x8a10('0x9'));var _=require(_0x8a10('0xa'));var squel=require(_0x8a10('0xb'));var crypto=require(_0x8a10('0xc'));var jsforce=require(_0x8a10('0xd'));var deskjs=require(_0x8a10('0xe'));var toCsv=require(_0x8a10('0xf'));var querystring=require('querystring');var Papa=require(_0x8a10('0x10'));var Redis=require(_0x8a10('0x11'));var authService=require(_0x8a10('0x12'));var qs=require(_0x8a10('0x13'));var as=require(_0x8a10('0x14'));var hardwareService=require(_0x8a10('0x15'));var logger=require(_0x8a10('0x16'))(_0x8a10('0x17'));var utils=require(_0x8a10('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8a10('0x19'));var db=require(_0x8a10('0x1a'))['db'];function respondWithStatusCode(_0x178531,_0x35d4f6){_0x35d4f6=_0x35d4f6||0xcc;return function(_0x4fdbb7){if(_0x4fdbb7){return _0x178531['sendStatus'](_0x35d4f6);}return _0x178531['status'](_0x35d4f6)[_0x8a10('0x1b')]();};}function respondWithResult(_0x564124,_0x33f480){_0x33f480=_0x33f480||0xc8;return function(_0x2e44cc){if(_0x2e44cc){return _0x564124[_0x8a10('0x1c')](_0x33f480)[_0x8a10('0x1d')](_0x2e44cc);}};}function respondWithFilteredResult(_0xa92be9,_0x491734){return function(_0x563c07){if(_0x563c07){var _0x556a13=typeof _0x491734['offset']===_0x8a10('0x1e')&&typeof _0x491734[_0x8a10('0x1f')]===_0x8a10('0x1e');var _0x34906e=_0x563c07[_0x8a10('0x20')];var _0x4ee4a2=_0x556a13?0x0:_0x491734[_0x8a10('0x21')];var _0x42ac5d=_0x556a13?_0x563c07[_0x8a10('0x20')]:_0x491734[_0x8a10('0x21')]+_0x491734[_0x8a10('0x1f')];var _0x5930ad;if(_0x42ac5d>=_0x34906e){_0x42ac5d=_0x34906e;_0x5930ad=0xc8;}else{_0x5930ad=0xce;}_0xa92be9['status'](_0x5930ad);return _0xa92be9[_0x8a10('0x22')](_0x8a10('0x23'),_0x4ee4a2+'-'+_0x42ac5d+'/'+_0x34906e)[_0x8a10('0x1d')](_0x563c07);}return null;};}function patchUpdates(_0x119cc0){return function(_0x3c5c89){try{jsonpatch['apply'](_0x3c5c89,_0x119cc0,!![]);}catch(_0x58e402){return BPromise[_0x8a10('0x24')](_0x58e402);}return _0x3c5c89['save']();};}function saveUpdates(_0x145abb,_0x2d7396){return function(_0x587dde){if(_0x587dde){return _0x587dde[_0x8a10('0x25')](_0x145abb)[_0x8a10('0x26')](function(_0x3cb7f0){return _0x3cb7f0;});}return null;};}function removeEntity(_0x17f824,_0xdeed0a){return function(_0x58a2c3){if(_0x58a2c3){return _0x58a2c3[_0x8a10('0x27')]()[_0x8a10('0x26')](function(){var _0x42e795=_0x58a2c3[_0x8a10('0x28')]({'plain':!![]});var _0x4ccc4e=_0x8a10('0x29');return db['UserProfileResource'][_0x8a10('0x27')]({'where':{'type':_0x4ccc4e,'resourceId':_0x42e795['id']}})['then'](function(){return _0x58a2c3;});})[_0x8a10('0x26')](function(){_0x17f824[_0x8a10('0x1c')](0xcc)[_0x8a10('0x1b')]();});}};}function handleEntityNotFound(_0x42ba99,_0x57a78f){return function(_0x1f628e){if(!_0x1f628e){_0x42ba99[_0x8a10('0x2a')](0x194);}return _0x1f628e;};}function handleError(_0x4dcbd7,_0xf85980){_0xf85980=_0xf85980||0x1f4;return function(_0x3e9b9d){logger[_0x8a10('0x2b')](_0x3e9b9d[_0x8a10('0x2c')]);if(_0x3e9b9d['name']){delete _0x3e9b9d[_0x8a10('0x2d')];}_0x4dcbd7[_0x8a10('0x1c')](_0xf85980)[_0x8a10('0x2e')](_0x3e9b9d);};}exports[_0x8a10('0x2f')]=function(_0x1b3fba,_0x2c6e9a){var _0x3bdee6={},_0x29c5ac={},_0x1e8b1a={'count':0x0,'rows':[]};var _0x3d90b1=_[_0x8a10('0x30')](db['Schedule'][_0x8a10('0x31')],function(_0x452f2){return{'name':_0x452f2[_0x8a10('0x32')],'type':_0x452f2[_0x8a10('0x33')][_0x8a10('0x34')]};});_0x29c5ac['model']=_[_0x8a10('0x30')](_0x3d90b1,_0x8a10('0x2d'));_0x29c5ac['query']=_[_0x8a10('0x35')](_0x1b3fba[_0x8a10('0x36')]);_0x29c5ac['filters']=_[_0x8a10('0x37')](_0x29c5ac['model'],_0x29c5ac[_0x8a10('0x36')]);_0x3bdee6['attributes']=_[_0x8a10('0x37')](_0x29c5ac[_0x8a10('0x38')],qs[_0x8a10('0x39')](_0x1b3fba[_0x8a10('0x36')][_0x8a10('0x39')]));_0x3bdee6[_0x8a10('0x3a')]=_0x3bdee6[_0x8a10('0x3a')][_0x8a10('0x3b')]?_0x3bdee6['attributes']:_0x29c5ac[_0x8a10('0x38')];if(!_0x1b3fba[_0x8a10('0x36')][_0x8a10('0x3c')]('nolimit')){_0x3bdee6[_0x8a10('0x1f')]=qs[_0x8a10('0x1f')](_0x1b3fba[_0x8a10('0x36')][_0x8a10('0x1f')]);_0x3bdee6[_0x8a10('0x21')]=qs[_0x8a10('0x21')](_0x1b3fba[_0x8a10('0x36')][_0x8a10('0x21')]);}_0x3bdee6[_0x8a10('0x3d')]=qs['sort'](_0x1b3fba[_0x8a10('0x36')][_0x8a10('0x3e')]);_0x3bdee6[_0x8a10('0x3f')]=qs[_0x8a10('0x40')](_['pick'](_0x1b3fba[_0x8a10('0x36')],_0x29c5ac['filters']),_0x3d90b1);if(_0x1b3fba[_0x8a10('0x36')][_0x8a10('0x41')]){_0x3bdee6[_0x8a10('0x3f')]=_[_0x8a10('0x42')](_0x3bdee6[_0x8a10('0x3f')],{'$or':_['map'](_0x3d90b1,function(_0x59d949){if(_0x59d949[_0x8a10('0x33')]!==_0x8a10('0x43')){var _0x64e3f3={};_0x64e3f3[_0x59d949['name']]={'$like':'%'+_0x1b3fba[_0x8a10('0x36')][_0x8a10('0x41')]+'%'};return _0x64e3f3;}})});}_0x3bdee6=_['merge']({},_0x3bdee6,_0x1b3fba[_0x8a10('0x44')]);var _0x40eecb={'where':_0x3bdee6[_0x8a10('0x3f')]};return db[_0x8a10('0x45')][_0x8a10('0x20')](_0x40eecb)[_0x8a10('0x26')](function(_0x17072e){_0x1e8b1a[_0x8a10('0x20')]=_0x17072e;if(_0x1b3fba['query'][_0x8a10('0x46')]){_0x3bdee6[_0x8a10('0x47')]=[{'all':!![]}];}return db[_0x8a10('0x45')][_0x8a10('0x48')](_0x3bdee6);})['then'](function(_0x586fd1){_0x1e8b1a[_0x8a10('0x49')]=_0x586fd1;return _0x1e8b1a;})[_0x8a10('0x26')](respondWithFilteredResult(_0x2c6e9a,_0x3bdee6))[_0x8a10('0x4a')](handleError(_0x2c6e9a,null));};exports['show']=function(_0x5c1c9f,_0x1a7331){var _0x39ba2a={'raw':![],'where':{'id':_0x5c1c9f['params']['id']}},_0x49be94={};_0x49be94[_0x8a10('0x38')]=_[_0x8a10('0x35')](db[_0x8a10('0x45')][_0x8a10('0x31')]);_0x49be94[_0x8a10('0x36')]=_[_0x8a10('0x35')](_0x5c1c9f[_0x8a10('0x36')]);_0x49be94['filters']=_['intersection'](_0x49be94[_0x8a10('0x38')],_0x49be94[_0x8a10('0x36')]);_0x39ba2a[_0x8a10('0x3a')]=_['intersection'](_0x49be94[_0x8a10('0x38')],qs['fields'](_0x5c1c9f[_0x8a10('0x36')]['fields']));_0x39ba2a[_0x8a10('0x3a')]=_0x39ba2a[_0x8a10('0x3a')][_0x8a10('0x3b')]?_0x39ba2a[_0x8a10('0x3a')]:_0x49be94[_0x8a10('0x38')];if(_0x5c1c9f[_0x8a10('0x36')][_0x8a10('0x46')]){_0x39ba2a[_0x8a10('0x47')]=[{'all':!![]}];}_0x39ba2a=_[_0x8a10('0x42')]({},_0x39ba2a,_0x5c1c9f[_0x8a10('0x44')]);return db[_0x8a10('0x45')][_0x8a10('0x4b')](_0x39ba2a)[_0x8a10('0x26')](handleEntityNotFound(_0x1a7331,null))[_0x8a10('0x26')](respondWithResult(_0x1a7331,null))[_0x8a10('0x4a')](handleError(_0x1a7331,null));};exports[_0x8a10('0x4c')]=function(_0x271e8c,_0x537a80){return db[_0x8a10('0x45')][_0x8a10('0x4c')](_0x271e8c[_0x8a10('0x4d')],{})[_0x8a10('0x26')](function(_0x5417f9){var _0x3a7d3d=_0x271e8c['user']['get']({'plain':!![]});if(!_0x3a7d3d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a7d3d[_0x8a10('0x4e')]===_0x8a10('0x4f')){var _0x56f054=_0x5417f9[_0x8a10('0x28')]({'plain':!![]});var _0x1f7dfe=_0x8a10('0x29');return db[_0x8a10('0x50')][_0x8a10('0x4b')]({'where':{'name':_0x1f7dfe,'userProfileId':_0x3a7d3d[_0x8a10('0x51')]},'raw':!![]})[_0x8a10('0x26')](function(_0x20a2fd){if(_0x20a2fd&&_0x20a2fd['autoAssociation']===0x0){return db[_0x8a10('0x52')]['create']({'name':_0x56f054[_0x8a10('0x2d')],'resourceId':_0x56f054['id'],'type':_0x20a2fd[_0x8a10('0x2d')],'sectionId':_0x20a2fd['id']},{})['then'](function(){return _0x5417f9;});}else{return _0x5417f9;}})['catch'](function(_0x57b091){logger['error'](_0x8a10('0x53'),_0x57b091);throw _0x57b091;});}return _0x5417f9;})[_0x8a10('0x26')](respondWithResult(_0x537a80,0xc9))[_0x8a10('0x4a')](handleError(_0x537a80,null));};exports[_0x8a10('0x25')]=function(_0xe9cff5,_0x5c493b){if(_0xe9cff5[_0x8a10('0x4d')]['id']){delete _0xe9cff5[_0x8a10('0x4d')]['id'];}return db[_0x8a10('0x45')][_0x8a10('0x4b')]({'where':{'id':_0xe9cff5[_0x8a10('0x54')]['id']}})[_0x8a10('0x26')](handleEntityNotFound(_0x5c493b,null))[_0x8a10('0x26')](saveUpdates(_0xe9cff5[_0x8a10('0x4d')],null))[_0x8a10('0x26')](respondWithResult(_0x5c493b,null))['catch'](handleError(_0x5c493b,null));};exports['destroy']=function(_0x3f655a,_0x54a3c4){return db[_0x8a10('0x45')][_0x8a10('0x4b')]({'where':{'id':_0x3f655a[_0x8a10('0x54')]['id']}})['then'](handleEntityNotFound(_0x54a3c4,null))[_0x8a10('0x26')](removeEntity(_0x54a3c4,null))[_0x8a10('0x4a')](handleError(_0x54a3c4,null));};exports['run']=function(_0x677ca5,_0x241d44,_0x3d8eec){var _0x3a3088=require(_0x8a10('0x55'));return db[_0x8a10('0x45')][_0x8a10('0x4b')]({'where':{'id':_0x677ca5['params']['id']},'raw':!![]})[_0x8a10('0x26')](handleEntityNotFound(_0x241d44,null))['then'](function(){_0x3a3088[_0x8a10('0x56')](_0x677ca5[_0x8a10('0x54')]['id']);})['then'](respondWithStatusCode(_0x241d44,null))['catch'](handleError(_0x241d44,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 143c22f..2db2e5b 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 _0x4d94=['define','Schedule','tools_schedules','lodash','util','../../config/logger','api','request-promise','../../config/environment','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4d94,0x12f));var _0x44d9=function(_0x352f7c,_0x4ca582){_0x352f7c=_0x352f7c-0x0;var _0x7e9a09=_0x4d94[_0x352f7c];return _0x7e9a09;};'use strict';var _=require(_0x44d9('0x0'));var util=require(_0x44d9('0x1'));var logger=require(_0x44d9('0x2'))(_0x44d9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x44d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44d9('0x5'));var attributes=require('./schedule.attributes');module[_0x44d9('0x6')]=function(_0x5c2a7c,_0x33d6fa){return _0x5c2a7c[_0x44d9('0x7')](_0x44d9('0x8'),attributes,{'tableName':_0x44d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2798=['bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','util','../../config/logger','api'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x2798,0x11b));var _0x8279=function(_0x3289ab,_0x4e9920){_0x3289ab=_0x3289ab-0x0;var _0x44903f=_0x2798[_0x3289ab];return _0x44903f;};'use strict';var _=require('lodash');var util=require(_0x8279('0x0'));var logger=require(_0x8279('0x1'))(_0x8279('0x2'));var moment=require('moment');var BPromise=require(_0x8279('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8279('0x4'));var rimraf=require(_0x8279('0x5'));var config=require(_0x8279('0x6'));var attributes=require(_0x8279('0x7'));module[_0x8279('0x8')]=function(_0xba7186,_0x599181){return _0xba7186[_0x8279('0x9')](_0x8279('0xa'),attributes,{'tableName':'tools_schedules','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 79f62cb..cc60dec 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 _0x69cf=['client','http','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x317083,_0x91791a){var _0x313969=function(_0x2b8998){while(--_0x2b8998){_0x317083['push'](_0x317083['shift']());}};_0x313969(++_0x91791a);}(_0x69cf,0xde));var _0xf69c=function(_0x323708,_0x4bebf2){_0x323708=_0x323708-0x0;var _0x3da3d7=_0x69cf[_0x323708];return _0x3da3d7;};'use strict';var _=require(_0xf69c('0x0'));var util=require('util');var moment=require(_0xf69c('0x1'));var BPromise=require(_0xf69c('0x2'));var rs=require(_0xf69c('0x3'));var fs=require('fs');var Redis=require(_0xf69c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf69c('0x5'))(_0xf69c('0x6'));var config=require(_0xf69c('0x7'));var jayson=require(_0xf69c('0x8'));var client=jayson[_0xf69c('0x9')][_0xf69c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f187,_0x538536,_0x51339c){return new BPromise(function(_0x3949ca,_0x30a3d8){return client['request'](_0x51f187,_0x51339c)['then'](function(_0x2a5398){logger[_0xf69c('0xb')](_0xf69c('0xc'),_0x538536,_0xf69c('0xd'));logger[_0xf69c('0xe')](_0xf69c('0xf'),_0x538536,_0xf69c('0xd'),JSON['stringify'](_0x2a5398));if(_0x2a5398['error']){if(_0x2a5398[_0xf69c('0x10')][_0xf69c('0x11')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x538536,_0x2a5398['error'][_0xf69c('0x12')]);return _0x30a3d8(_0x2a5398[_0xf69c('0x10')][_0xf69c('0x12')]);}logger[_0xf69c('0x10')](_0xf69c('0xc'),_0x538536,_0x2a5398[_0xf69c('0x10')]['message']);return _0x3949ca(_0x2a5398[_0xf69c('0x10')][_0xf69c('0x12')]);}else{logger[_0xf69c('0xb')](_0xf69c('0xc'),_0x538536,'request\x20sent');_0x3949ca(_0x2a5398[_0xf69c('0x13')][_0xf69c('0x12')]);}})[_0xf69c('0x14')](function(_0x4bffe6){logger[_0xf69c('0x10')](_0xf69c('0xc'),_0x538536,_0x4bffe6);_0x30a3d8(_0x4bffe6);});});} \ No newline at end of file +var _0x4a96=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x4a96,0x8f));var _0x64a9=function(_0x25edb4,_0x15aae6){_0x25edb4=_0x25edb4-0x0;var _0xe222cf=_0x4a96[_0x25edb4];return _0xe222cf;};'use strict';var _=require(_0x64a9('0x0'));var util=require(_0x64a9('0x1'));var moment=require(_0x64a9('0x2'));var BPromise=require(_0x64a9('0x3'));var rs=require(_0x64a9('0x4'));var fs=require('fs');var Redis=require(_0x64a9('0x5'));var db=require(_0x64a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x64a9('0x7'));var client=jayson[_0x64a9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1824b5,_0x3767be,_0x271980){return new BPromise(function(_0x432004,_0x16cb0f){return client['request'](_0x1824b5,_0x271980)[_0x64a9('0x9')](function(_0x328f0f){logger[_0x64a9('0xa')]('Schedule,\x20%s,\x20%s',_0x3767be,_0x64a9('0xb'));logger[_0x64a9('0xc')](_0x64a9('0xd'),_0x3767be,'request\x20sent',JSON['stringify'](_0x328f0f));if(_0x328f0f[_0x64a9('0xe')]){if(_0x328f0f[_0x64a9('0xe')][_0x64a9('0xf')]===0x1f4){logger['error'](_0x64a9('0x10'),_0x3767be,_0x328f0f[_0x64a9('0xe')]['message']);return _0x16cb0f(_0x328f0f[_0x64a9('0xe')][_0x64a9('0x11')]);}logger['error'](_0x64a9('0x10'),_0x3767be,_0x328f0f[_0x64a9('0xe')][_0x64a9('0x11')]);return _0x432004(_0x328f0f[_0x64a9('0xe')]['message']);}else{logger['info'](_0x64a9('0x10'),_0x3767be,_0x64a9('0xb'));_0x432004(_0x328f0f[_0x64a9('0x12')][_0x64a9('0x11')]);}})[_0x64a9('0x13')](function(_0x32da95){logger[_0x64a9('0xe')](_0x64a9('0x10'),_0x3767be,_0x32da95);_0x16cb0f(_0x32da95);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b32b4fd..fda85be 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 _0xd737=['update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','post','create','put'];(function(_0x1201d3,_0x45adec){var _0x4d502b=function(_0x5cc6b7){while(--_0x5cc6b7){_0x1201d3['push'](_0x1201d3['shift']());}};_0x4d502b(++_0x45adec);}(_0xd737,0x1e6));var _0x7d73=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0xd737[_0x3c51d4];return _0x53c45f;};'use strict';var multer=require(_0x7d73('0x0'));var util=require(_0x7d73('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7d73('0x2'));var router=express[_0x7d73('0x3')]();var fs_extra=require(_0x7d73('0x4'));var auth=require(_0x7d73('0x5'));var interaction=require(_0x7d73('0x6'));var config=require(_0x7d73('0x7'));var controller=require(_0x7d73('0x8'));router[_0x7d73('0x9')]('/',auth[_0x7d73('0xa')](),controller[_0x7d73('0xb')]);router['get'](_0x7d73('0xc'),auth[_0x7d73('0xa')](),controller['describe']);router['get'](_0x7d73('0xd'),auth['isAuthenticated'](),controller[_0x7d73('0xe')]);router[_0x7d73('0x9')](_0x7d73('0xf'),auth[_0x7d73('0xa')](),controller[_0x7d73('0x10')]);router[_0x7d73('0x11')]('/',auth[_0x7d73('0xa')](),controller[_0x7d73('0x12')]);router[_0x7d73('0x13')](_0x7d73('0xd'),auth[_0x7d73('0xa')](),controller[_0x7d73('0x14')]);router[_0x7d73('0x15')](_0x7d73('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7d73('0x16')]=router; \ No newline at end of file +var _0x1a35=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','post','create'];(function(_0x662a3,_0x4f3ea7){var _0x1f5797=function(_0x5b3adb){while(--_0x5b3adb){_0x662a3['push'](_0x662a3['shift']());}};_0x1f5797(++_0x4f3ea7);}(_0x1a35,0x1a3));var _0x51a3=function(_0x4ff819,_0x2f2232){_0x4ff819=_0x4ff819-0x0;var _0x24274e=_0x1a35[_0x4ff819];return _0x24274e;};'use strict';var multer=require(_0x51a3('0x0'));var util=require(_0x51a3('0x1'));var path=require('path');var timeout=require(_0x51a3('0x2'));var express=require(_0x51a3('0x3'));var router=express[_0x51a3('0x4')]();var fs_extra=require(_0x51a3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x51a3('0x6'));var config=require(_0x51a3('0x7'));var controller=require(_0x51a3('0x8'));router[_0x51a3('0x9')]('/',auth[_0x51a3('0xa')](),controller['index']);router['get'](_0x51a3('0xb'),auth['isAuthenticated'](),controller[_0x51a3('0xc')]);router[_0x51a3('0x9')](_0x51a3('0xd'),auth[_0x51a3('0xa')](),controller[_0x51a3('0xe')]);router[_0x51a3('0x9')]('/:id/download',auth[_0x51a3('0xa')](),controller[_0x51a3('0xf')]);router[_0x51a3('0x10')]('/',auth[_0x51a3('0xa')](),controller[_0x51a3('0x11')]);router[_0x51a3('0x12')](_0x51a3('0xd'),auth['isAuthenticated'](),controller[_0x51a3('0x13')]);router[_0x51a3('0x14')](_0x51a3('0xd'),auth['isAuthenticated'](),controller[_0x51a3('0x15')]);module[_0x51a3('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0739f06..d70514f 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 _0xa866=['duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt'];(function(_0xb55eae,_0x2c060d){var _0x59e784=function(_0x50e6af){while(--_0x50e6af){_0xb55eae['push'](_0xb55eae['shift']());}};_0x59e784(++_0x2c060d);}(_0xa866,0x6a));var _0x6a86=function(_0x3f617b,_0x270ef2){_0x3f617b=_0x3f617b-0x0;var _0x3faca4=_0xa866[_0x3f617b];return _0x3faca4;};'use strict';var Sequelize=require(_0x6a86('0x0'));var moment=require(_0x6a86('0x1'));var path=require(_0x6a86('0x2'));var config=require(_0x6a86('0x3'));module[_0x6a86('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6a86('0x5')](_0x6a86('0x6'))?path[_0x6a86('0x7')](this['getDataValue'](_0x6a86('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x6a86('0x8')]},'channel':{'type':Sequelize[_0x6a86('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x183997){var _0x288910=_0x183997[_0x6a86('0x9')](/\\/g,'/');this[_0x6a86('0xa')](_0x6a86('0x6'),_0x288910);}},'rating':{'type':Sequelize[_0x6a86('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6a86('0xb')],'set':function(_0x4a83c9){this[_0x6a86('0xa')]('startedAt',moment()[_0x6a86('0xc')](_0x4a83c9,'ms'));this[_0x6a86('0xa')](_0x6a86('0xd'),moment());this['setDataValue'](_0x6a86('0xe'),_0x4a83c9);}},'startedAt':{'type':Sequelize[_0x6a86('0xf')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x6a86('0x10')](_0x6a86('0x11'))[_0x6a86('0x12')]();}},'closedAt':{'type':Sequelize[_0x6a86('0xf')],'get':function(){return moment(this[_0x6a86('0x5')](_0x6a86('0xd')))[_0x6a86('0x10')](_0x6a86('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x6a86('0xf')],'get':function(){return moment(this[_0x6a86('0x5')]('createdAt'))[_0x6a86('0x10')](_0x6a86('0x11'))[_0x6a86('0x12')]();}},'updatedAt':{'type':Sequelize[_0x6a86('0xf')],'get':function(){return moment(this[_0x6a86('0x5')](_0x6a86('0x13')))['format'](_0x6a86('0x11'))[_0x6a86('0x12')]();}}}; \ No newline at end of file +var _0xc113=['duration','DATE','startedAt','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','subtract','closedAt'];(function(_0x3b03f2,_0x140c77){var _0x27ea50=function(_0x48efb2){while(--_0x48efb2){_0x3b03f2['push'](_0x3b03f2['shift']());}};_0x27ea50(++_0x140c77);}(_0xc113,0x1ab));var _0x3c11=function(_0x5ca493,_0x2490d7){_0x5ca493=_0x5ca493-0x0;var _0xdeda64=_0xc113[_0x5ca493];return _0xdeda64;};'use strict';var Sequelize=require(_0x3c11('0x0'));var moment=require(_0x3c11('0x1'));var path=require(_0x3c11('0x2'));var config=require(_0x3c11('0x3'));module[_0x3c11('0x4')]={'format':{'type':Sequelize[_0x3c11('0x5')],'get':function(){return this[_0x3c11('0x6')](_0x3c11('0x7'))?path[_0x3c11('0x8')](this['getDataValue'](_0x3c11('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x3c11('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x3c11('0x9')],'set':function(_0x3b181f){var _0x2fa44d=_0x3b181f['replace'](/\\/g,'/');this[_0x3c11('0xa')]('value',_0x2fa44d);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x7f14e6){this[_0x3c11('0xa')]('startedAt',moment()[_0x3c11('0xb')](_0x7f14e6,'ms'));this[_0x3c11('0xa')](_0x3c11('0xc'),moment());this['setDataValue'](_0x3c11('0xd'),_0x7f14e6);}},'startedAt':{'type':Sequelize[_0x3c11('0xe')],'get':function(){return moment(this[_0x3c11('0x6')](_0x3c11('0xf')))[_0x3c11('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3c11('0x11')]();}},'closedAt':{'type':Sequelize[_0x3c11('0xe')],'get':function(){return moment(this['getDataValue'](_0x3c11('0xc')))[_0x3c11('0x10')](_0x3c11('0x12'))[_0x3c11('0x11')]();}},'createdAt':{'type':Sequelize[_0x3c11('0xe')],'get':function(){return moment(this['getDataValue'](_0x3c11('0x13')))[_0x3c11('0x10')](_0x3c11('0x12'))[_0x3c11('0x11')]();}},'updatedAt':{'type':Sequelize[_0x3c11('0xe')],'get':function(){return moment(this['getDataValue']('updatedAt'))['format'](_0x3c11('0x12'))[_0x3c11('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index fe76fbd..9c9f99d 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 _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x15b9be,_0x520ca2){var _0xd3800e=function(_0xd429ab){while(--_0xd429ab){_0x15b9be['push'](_0x15b9be['shift']());}};_0xd3800e(++_0x520ca2);}(_0xe14b,0x93));var _0xbe14=function(_0x334abc,_0x40aca5){_0x334abc=_0x334abc-0x0;var _0x348971=_0xe14b[_0x334abc];return _0x348971;};'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('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file +var _0x9957=['sort','pick','filter','where','merge','map','VIRTUAL','options','ScreenRecording','includeAll','include','catch','show','rawAttributes','find','create','body','duration','closedAt','params','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','filename','extname','unlink','message','ScreenRecording\x20not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x14e40f,_0x4d9f19){var _0x263b9f=function(_0xe3f3a1){while(--_0xe3f3a1){_0x14e40f['push'](_0x14e40f['shift']());}};_0x263b9f(++_0x4d9f19);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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['ScreenRecording']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_['map'](_0x4253e5,'name'),[_0x7995('0x31')]);_0x456a28['query']=_[_0x7995('0x32')](_0x4b6f99[_0x7995('0x33')]);_0x456a28[_0x7995('0x34')]=_[_0x7995('0x35')](_0x456a28[_0x7995('0x2f')],_0x456a28['query']);_0x514445[_0x7995('0x36')]=_[_0x7995('0x35')](_0x456a28['model'],qs['fields'](_0x4b6f99['query'][_0x7995('0x37')]));_0x514445[_0x7995('0x36')]=_0x514445['attributes'][_0x7995('0x38')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99[_0x7995('0x33')][_0x7995('0x39')]('nolimit')){_0x514445['limit']=qs[_0x7995('0x21')](_0x4b6f99['query']['limit']);_0x514445[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x4b6f99['query'][_0x7995('0x20')]);}_0x514445[_0x7995('0x3a')]=qs[_0x7995('0x3b')](_0x4b6f99[_0x7995('0x33')][_0x7995('0x3b')]);_0x514445['where']=qs[_0x7995('0x34')](_[_0x7995('0x3c')](_0x4b6f99[_0x7995('0x33')],_0x456a28[_0x7995('0x34')]),_0x4253e5);if(_0x4b6f99['query'][_0x7995('0x3d')]){_0x514445[_0x7995('0x3e')]=_[_0x7995('0x3f')](_0x514445[_0x7995('0x3e')],{'$or':_[_0x7995('0x40')](_0x4253e5,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x41')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x33')][_0x7995('0x3d')]+'%'};return _0x3be298;}})});}_0x514445=_[_0x7995('0x3f')]({},_0x514445,_0x4b6f99[_0x7995('0x42')]);var _0x270c0e={'where':_0x514445[_0x7995('0x3e')]};return db[_0x7995('0x43')][_0x7995('0x1f')](_0x270c0e)[_0x7995('0x26')](function(_0x7b4e67){_0x3250e0['count']=_0x7b4e67;if(_0x4b6f99['query'][_0x7995('0x44')]){_0x514445[_0x7995('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x514445);})[_0x7995('0x26')](function(_0x4a9fef){_0x3250e0['rows']=_0x4a9fef;return _0x3250e0;})[_0x7995('0x26')](respondWithFilteredResult(_0x9b2a15,_0x514445))[_0x7995('0x46')](handleError(_0x9b2a15,null));};exports[_0x7995('0x47')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x32')](db[_0x7995('0x43')][_0x7995('0x48')]);_0x3993b5[_0x7995('0x33')]=_['keys'](_0x576b96[_0x7995('0x33')]);_0x3993b5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x3993b5[_0x7995('0x2f')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x35')](_0x3993b5['model'],qs[_0x7995('0x37')](_0x576b96['query'][_0x7995('0x37')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x36')][_0x7995('0x38')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x2f')];if(_0x576b96[_0x7995('0x33')][_0x7995('0x44')]){_0x5e85b9[_0x7995('0x45')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x42')]);return db[_0x7995('0x43')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x26')](respondWithResult(_0x46ac4f,null))[_0x7995('0x46')](handleError(_0x46ac4f,null));};exports[_0x7995('0x4a')]=function(_0x3d8ae3,_0x255313){return db['ScreenRecording'][_0x7995('0x4a')](_0x3d8ae3[_0x7995('0x4b')],{})['then'](respondWithResult(_0x255313,0xc9))[_0x7995('0x46')](handleError(_0x255313,null));};exports['update']=function(_0x1d87f9,_0x187735){if(_0x1d87f9[_0x7995('0x4b')]['id']){delete _0x1d87f9[_0x7995('0x4b')]['id'];}delete _0x1d87f9[_0x7995('0x4b')][_0x7995('0x4c')];delete _0x1d87f9[_0x7995('0x4b')]['createdAt'];delete _0x1d87f9[_0x7995('0x4b')][_0x7995('0x4d')];delete _0x1d87f9[_0x7995('0x4b')]['value'];return db[_0x7995('0x43')][_0x7995('0x49')]({'where':{'id':_0x1d87f9[_0x7995('0x4e')]['id']}})['then'](handleEntityNotFound(_0x187735,null))['then'](saveUpdates(_0x1d87f9['body'],null))[_0x7995('0x26')](respondWithResult(_0x187735,null))[_0x7995('0x46')](handleError(_0x187735,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x43')][_0x7995('0x4f')]()[_0x7995('0x26')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x50')]=function(_0x4ab09f,_0x14fe7f,_0x33c801){var _0x206d2a=require('../../components/encryptor');var _0x5e1f34=![];var _0x54e2b1={};if(_0x4ab09f['query'][_0x7995('0x2d')]&&_0x4ab09f[_0x7995('0x33')][_0x7995('0x2d')]===_0x7995('0x51')){_0x54e2b1[_0x7995('0x51')]=_0x4ab09f[_0x7995('0x4e')]['id'];}else{_0x54e2b1['id']=_0x4ab09f[_0x7995('0x4e')]['id'];}return db[_0x7995('0x43')][_0x7995('0x49')]({'where':_0x54e2b1,'attributes':['id',_0x7995('0x52')],'raw':!![]})[_0x7995('0x26')](handleEntityNotFound(_0x14fe7f,null))[_0x7995('0x26')](function(_0x3da72b){if(_0x3da72b){var _0x35bea3=path[_0x7995('0x53')](config[_0x7995('0x54')],_0x7995('0x55'),_0x3da72b[_0x7995('0x52')]);var _0x45e86e=util['format'](_0x7995('0x56'),_0x35bea3);if(fs[_0x7995('0x57')](_0x45e86e)){_0x5e1f34=!![];return _0x206d2a[_0x7995('0x58')](_0x45e86e,_0x35bea3,config[_0x7995('0x59')]['recording'])['then'](function(){return _0x3da72b;});}return _0x3da72b;}})[_0x7995('0x26')](function(_0x197b52){if(_0x197b52){var _0x5b9467=path[_0x7995('0x53')](config['root'],_0x7995('0x55'),_0x197b52[_0x7995('0x52')]);if(!fs[_0x7995('0x57')](_0x5b9467)){throw new db[(_0x7995('0x5a'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x197b52[_0x7995('0x5b')]){return _0x14fe7f[_0x7995('0x50')](_0x5b9467,_0x197b52[_0x7995('0x5b')]+path[_0x7995('0x5c')](_0x5b9467),function(){if(_0x5e1f34){fs[_0x7995('0x5d')](_0x5b9467);}});}else{return _0x14fe7f[_0x7995('0x50')](_0x5b9467,function(_0x1d4689){if(_0x5e1f34){fs[_0x7995('0x5d')](_0x5b9467);}});}}})[_0x7995('0x46')](function(_0x50caf5){if(_0x50caf5[_0x7995('0x5e')]===_0x7995('0x5f')){_0x14fe7f[_0x7995('0x1c')](0x194)[_0x7995('0x2a')]('Not\x20found');}else{return handleError(_0x14fe7f,null);}});};exports['destroy']=function(_0x3053fd,_0xebb5c8){return db['ScreenRecording'][_0x7995('0x49')]({'where':{'id':_0x3053fd[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](function(_0x57727e){if(_[_0x7995('0x60')](_0x57727e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x57727e;})[_0x7995('0x26')](function(_0x564fca){var _0x3e0a46=path[_0x7995('0x53')](config[_0x7995('0x54')],_0x7995('0x55'),_0x564fca[_0x7995('0x52')]);logger[_0x7995('0x61')](_0x7995('0x62'),_0x3e0a46);if(!_[_0x7995('0x60')](_0x564fca[_0x7995('0x52')])&&fs[_0x7995('0x57')](_0x3e0a46)){logger[_0x7995('0x61')](_0x7995('0x63')+_0x3e0a46+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7995('0x64')](_0x3e0a46);}_0x3e0a46=_0x3e0a46+_0x7995('0x65');if(!_[_0x7995('0x60')](_0x564fca[_0x7995('0x52')])&&fs[_0x7995('0x57')](_0x3e0a46)){logger['info']('File:\x20\x22'+_0x3e0a46+_0x7995('0x66'));fs[_0x7995('0x64')](_0x3e0a46);}return _0x564fca;})[_0x7995('0x26')](function(_0xae6166){if(!_0xae6166)throw new InternalError();return _0xae6166['destroy']();})[_0x7995('0x26')](function(){_0xebb5c8['status'](0xcc)['end']();})[_0x7995('0x46')](handleError(_0xebb5c8,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 4c08d2b..6212a1c 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 _0x3b6e=['util','api','moment','bluebird','request-promise','./screenRecording.attributes','exports','define','screen_recordings','interactionid'];(function(_0x523912,_0x55ffbb){var _0x3bc739=function(_0x45223e){while(--_0x45223e){_0x523912['push'](_0x523912['shift']());}};_0x3bc739(++_0x55ffbb);}(_0x3b6e,0x1d6));var _0xe3b6=function(_0x24e721,_0x4aec0c){_0x24e721=_0x24e721-0x0;var _0x16434e=_0x3b6e[_0x24e721];return _0x16434e;};'use strict';var _=require('lodash');var util=require(_0xe3b6('0x0'));var logger=require('../../config/logger')(_0xe3b6('0x1'));var moment=require(_0xe3b6('0x2'));var BPromise=require(_0xe3b6('0x3'));var rp=require(_0xe3b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3b6('0x5'));module[_0xe3b6('0x6')]=function(_0x5e9172,_0x8a1e7a){return _0x5e9172[_0xe3b6('0x7')]('ScreenRecording',attributes,{'tableName':_0xe3b6('0x8'),'paranoid':![],'indexes':[{'name':_0xe3b6('0x9'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x08be=['exports','define','screen_recordings','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes'];(function(_0x5f12a5,_0x127c6f){var _0x3a70e9=function(_0x3e7688){while(--_0x3e7688){_0x5f12a5['push'](_0x5f12a5['shift']());}};_0x3a70e9(++_0x127c6f);}(_0x08be,0x16e));var _0xe08b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x08be[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe08b('0x0'));var util=require(_0xe08b('0x1'));var logger=require(_0xe08b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe08b('0x3'));var rp=require(_0xe08b('0x4'));var fs=require('fs');var path=require(_0xe08b('0x5'));var rimraf=require('rimraf');var config=require(_0xe08b('0x6'));var attributes=require(_0xe08b('0x7'));module[_0xe08b('0x8')]=function(_0x1ea6e7,_0x10025a){return _0x1ea6e7[_0xe08b('0x9')]('ScreenRecording',attributes,{'tableName':_0xe08b('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','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 9efe6f9..7fba370 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 _0x8818=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x8818,0x1b1));var _0x8881=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x8818[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x8881('0x0'));var util=require(_0x8881('0x1'));var moment=require(_0x8881('0x2'));var BPromise=require('bluebird');var rs=require(_0x8881('0x3'));var fs=require('fs');var Redis=require(_0x8881('0x4'));var db=require(_0x8881('0x5'))['db'];var utils=require(_0x8881('0x6'));var logger=require(_0x8881('0x7'))('rpc');var config=require(_0x8881('0x8'));var jayson=require(_0x8881('0x9'));var client=jayson[_0x8881('0xa')][_0x8881('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x383470,_0x336e7f,_0x330a3a){return new BPromise(function(_0x73fde7,_0x5be88f){return client[_0x8881('0xc')](_0x383470,_0x330a3a)[_0x8881('0xd')](function(_0x42e10a){logger[_0x8881('0xe')](_0x8881('0xf'),_0x336e7f,_0x8881('0x10'));logger[_0x8881('0x11')](_0x8881('0x12'),_0x336e7f,_0x8881('0x10'),JSON[_0x8881('0x13')](_0x42e10a));if(_0x42e10a[_0x8881('0x14')]){if(_0x42e10a[_0x8881('0x14')][_0x8881('0x15')]===0x1f4){logger[_0x8881('0x14')](_0x8881('0xf'),_0x336e7f,_0x42e10a[_0x8881('0x14')][_0x8881('0x16')]);return _0x5be88f(_0x42e10a['error'][_0x8881('0x16')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x336e7f,_0x42e10a['error'][_0x8881('0x16')]);return _0x73fde7(_0x42e10a[_0x8881('0x14')][_0x8881('0x16')]);}else{logger[_0x8881('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x336e7f,_0x8881('0x10'));_0x73fde7(_0x42e10a[_0x8881('0x17')][_0x8881('0x16')]);}})[_0x8881('0x18')](function(_0x41beb5){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x336e7f,_0x41beb5);_0x5be88f(_0x41beb5);});});} \ No newline at end of file +var _0xfe25=['client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x4ea6ed,_0x5845bf){var _0x35010e=function(_0x1d51b1){while(--_0x1d51b1){_0x4ea6ed['push'](_0x4ea6ed['shift']());}};_0x35010e(++_0x5845bf);}(_0xfe25,0x139));var _0x5fe2=function(_0x4dcef2,_0x57cb27){_0x4dcef2=_0x4dcef2-0x0;var _0x433a2f=_0xfe25[_0x4dcef2];return _0x433a2f;};'use strict';var _=require(_0x5fe2('0x0'));var util=require(_0x5fe2('0x1'));var moment=require(_0x5fe2('0x2'));var BPromise=require(_0x5fe2('0x3'));var rs=require(_0x5fe2('0x4'));var fs=require('fs');var Redis=require(_0x5fe2('0x5'));var db=require(_0x5fe2('0x6'))['db'];var utils=require(_0x5fe2('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5fe2('0x8'));var client=jayson[_0x5fe2('0x9')][_0x5fe2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594cf1,_0x22a242,_0x29a4c2){return new BPromise(function(_0x26eed2,_0xb5a9e0){return client[_0x5fe2('0xb')](_0x594cf1,_0x29a4c2)[_0x5fe2('0xc')](function(_0x4b9f18){logger[_0x5fe2('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x22a242,_0x5fe2('0xe'));logger[_0x5fe2('0xf')](_0x5fe2('0x10'),_0x22a242,_0x5fe2('0xe'),JSON['stringify'](_0x4b9f18));if(_0x4b9f18[_0x5fe2('0x11')]){if(_0x4b9f18[_0x5fe2('0x11')][_0x5fe2('0x12')]===0x1f4){logger[_0x5fe2('0x11')](_0x5fe2('0x13'),_0x22a242,_0x4b9f18[_0x5fe2('0x11')][_0x5fe2('0x14')]);return _0xb5a9e0(_0x4b9f18[_0x5fe2('0x11')][_0x5fe2('0x14')]);}logger[_0x5fe2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x22a242,_0x4b9f18[_0x5fe2('0x11')][_0x5fe2('0x14')]);return _0x26eed2(_0x4b9f18[_0x5fe2('0x11')][_0x5fe2('0x14')]);}else{logger[_0x5fe2('0xd')](_0x5fe2('0x13'),_0x22a242,_0x5fe2('0xe'));_0x26eed2(_0x4b9f18[_0x5fe2('0x15')]['message']);}})[_0x5fe2('0x16')](function(_0x8a770a){logger[_0x5fe2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x22a242,_0x8a770a);_0xb5a9e0(_0x8a770a);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1572e38..987b561 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 _0xcf8d=['gdpr','/:id/preferred','getPreferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','post','single','file','addLogo','extname','originalname','addLogoLogin','preferred','addPreferred','favicon','addFavicon','/:id','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcf8d,0xbe));var _0xdcf8=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xcf8d[_0x507ac5];return _0x12c1bc;};'use strict';var multer=require(_0xdcf8('0x0'));var util=require(_0xdcf8('0x1'));var path=require('path');var timeout=require(_0xdcf8('0x2'));var express=require(_0xdcf8('0x3'));var router=express[_0xdcf8('0x4')]();var fs_extra=require(_0xdcf8('0x5'));var auth=require(_0xdcf8('0x6'));var interaction=require(_0xdcf8('0x7'));var config=require(_0xdcf8('0x8'));var controller=require(_0xdcf8('0x9'));router[_0xdcf8('0xa')]('/',auth[_0xdcf8('0xb')](),controller[_0xdcf8('0xc')]);router[_0xdcf8('0xa')](_0xdcf8('0xd'),controller['getDate']);router[_0xdcf8('0xa')]('/:id',controller[_0xdcf8('0xe')]);router[_0xdcf8('0xa')](_0xdcf8('0xf'),controller[_0xdcf8('0x10')]);router['get'](_0xdcf8('0x11'),controller[_0xdcf8('0x12')]);router[_0xdcf8('0xa')](_0xdcf8('0x13'),controller[_0xdcf8('0x14')]);router['get'](_0xdcf8('0x15'),controller[_0xdcf8('0x16')]);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xdcf8('0x17')]({'destination':function(_0x3e10c8,_0x1d65df,_0x1ef1e1){_0x1ef1e1(null,path[_0xdcf8('0x18')](config[_0xdcf8('0x19')],_0xdcf8('0x1a')));},'filename':function(_0x24c489,_0x233b1f,_0x27e991){_0x27e991(null,util[_0xdcf8('0x1b')](_0xdcf8('0x1c'),'logo',path['extname'](_0x233b1f['originalname'])));}})});router[_0xdcf8('0x1d')](_0xdcf8('0xf'),upload[_0xdcf8('0x1e')](_0xdcf8('0x1f')),controller[_0xdcf8('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x825e2d,_0xae6c05,_0x40b9ab){_0x40b9ab(null,path[_0xdcf8('0x18')](config[_0xdcf8('0x19')],_0xdcf8('0x1a')));},'filename':function(_0xde9e5f,_0x297863,_0x1acd23){_0x1acd23(null,util[_0xdcf8('0x1b')](_0xdcf8('0x1c'),'logologin',path[_0xdcf8('0x21')](_0x297863[_0xdcf8('0x22')])));}})});router[_0xdcf8('0x1d')](_0xdcf8('0x11'),upload['single']('file'),controller[_0xdcf8('0x23')]);var upload=multer({'storage':multer[_0xdcf8('0x17')]({'destination':function(_0x502e98,_0x4ec1d5,_0x8224aa){_0x8224aa(null,path[_0xdcf8('0x18')](config[_0xdcf8('0x19')],_0xdcf8('0x1a')));},'filename':function(_0xadc816,_0xefaba6,_0x31a185){_0x31a185(null,util[_0xdcf8('0x1b')](_0xdcf8('0x1c'),_0xdcf8('0x24'),path[_0xdcf8('0x21')](_0xefaba6[_0xdcf8('0x22')])));}})});router[_0xdcf8('0x1d')](_0xdcf8('0x15'),upload[_0xdcf8('0x1e')](_0xdcf8('0x1f')),controller[_0xdcf8('0x25')]);var upload=multer({'storage':multer[_0xdcf8('0x17')]({'destination':function(_0x5baa0f,_0x4e933e,_0x2666eb){_0x2666eb(null,path['join'](config[_0xdcf8('0x19')],_0xdcf8('0x1a')));},'filename':function(_0x3949ab,_0x22d32d,_0x50a634){_0x50a634(null,util[_0xdcf8('0x1b')]('%s%s',_0xdcf8('0x26'),path[_0xdcf8('0x21')](_0x22d32d['originalname'])));}})});router['post']('/:id/favicon',upload['single'](_0xdcf8('0x1f')),controller[_0xdcf8('0x27')]);router['put'](_0xdcf8('0x28'),auth[_0xdcf8('0xb')](),controller[_0xdcf8('0x29')]);module['exports']=router; \ No newline at end of file +var _0x413c=['/:id/logo','getLogo','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','file','addLogo','%s%s','extname','/:id/logo_login','addLogoLogin','addPreferred','favicon','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','index','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x413c,0x104));var _0xc413=function(_0x1b9f71,_0x4f0dbd){_0x1b9f71=_0x1b9f71-0x0;var _0x35c66a=_0x413c[_0x1b9f71];return _0x35c66a;};'use strict';var multer=require(_0xc413('0x0'));var util=require(_0xc413('0x1'));var path=require(_0xc413('0x2'));var timeout=require(_0xc413('0x3'));var express=require(_0xc413('0x4'));var router=express[_0xc413('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc413('0x6'));var interaction=require(_0xc413('0x7'));var config=require('../../config/environment');var controller=require(_0xc413('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc413('0x9')]);router[_0xc413('0xa')]('/now',controller['getDate']);router[_0xc413('0xa')](_0xc413('0xb'),controller[_0xc413('0xc')]);router[_0xc413('0xa')](_0xc413('0xd'),controller[_0xc413('0xe')]);router[_0xc413('0xa')]('/:id/logo_login',controller['getLogoLogin']);router['get'](_0xc413('0xf'),controller['gdpr']);router[_0xc413('0xa')](_0xc413('0x10'),controller[_0xc413('0x11')]);router[_0xc413('0xa')](_0xc413('0x12'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc413('0x13')]({'destination':function(_0x2999ac,_0x28d505,_0x488b0f){_0x488b0f(null,path[_0xc413('0x14')](config[_0xc413('0x15')],_0xc413('0x16')));},'filename':function(_0xc7533b,_0x60f025,_0x3a4b54){_0x3a4b54(null,util[_0xc413('0x17')]('%s%s',_0xc413('0x18'),path['extname'](_0x60f025[_0xc413('0x19')])));}})});router[_0xc413('0x1a')](_0xc413('0xd'),upload[_0xc413('0x1b')](_0xc413('0x1c')),controller[_0xc413('0x1d')]);var upload=multer({'storage':multer[_0xc413('0x13')]({'destination':function(_0x4b3152,_0x3beb16,_0x2868b4){_0x2868b4(null,path['join'](config[_0xc413('0x15')],_0xc413('0x16')));},'filename':function(_0x1655ee,_0x49bded,_0x3757b7){_0x3757b7(null,util[_0xc413('0x17')](_0xc413('0x1e'),'logologin',path[_0xc413('0x1f')](_0x49bded[_0xc413('0x19')])));}})});router[_0xc413('0x1a')](_0xc413('0x20'),upload[_0xc413('0x1b')](_0xc413('0x1c')),controller[_0xc413('0x21')]);var upload=multer({'storage':multer[_0xc413('0x13')]({'destination':function(_0x2ee401,_0xe3927d,_0x19f733){_0x19f733(null,path[_0xc413('0x14')](config[_0xc413('0x15')],_0xc413('0x16')));},'filename':function(_0x1c5fff,_0x54df18,_0x8a35fd){_0x8a35fd(null,util[_0xc413('0x17')](_0xc413('0x1e'),'preferred',path[_0xc413('0x1f')](_0x54df18[_0xc413('0x19')])));}})});router[_0xc413('0x1a')](_0xc413('0x10'),upload['single'](_0xc413('0x1c')),controller[_0xc413('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22aedc,_0x1fb0ae,_0x74eea3){_0x74eea3(null,path[_0xc413('0x14')](config[_0xc413('0x15')],_0xc413('0x16')));},'filename':function(_0x385bb3,_0x3a1e28,_0x21162a){_0x21162a(null,util[_0xc413('0x17')](_0xc413('0x1e'),_0xc413('0x23'),path[_0xc413('0x1f')](_0x3a1e28[_0xc413('0x19')])));}})});router[_0xc413('0x1a')](_0xc413('0x12'),upload['single']('file'),controller['addFavicon']);router['put'](_0xc413('0xb'),auth[_0xc413('0x24')](),controller[_0xc413('0x25')]);module[_0xc413('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c5b867e..2f366c9 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(_0x105f81,_0x28bf90){var _0x5a081b=function(_0x5c61ed){while(--_0x5c61ed){_0x105f81['push'](_0x105f81['shift']());}};_0x5a081b(++_0x28bf90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x457b0a,_0x411f5e){var _0xd1ec00=function(_0x5e7eab){while(--_0x5e7eab){_0x457b0a['push'](_0x457b0a['shift']());}};_0xd1ec00(++_0x411f5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 83b2fde..55c6b4f 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 _0x13ad=['update','destroy','stack','name','send','index','Setting','fieldName','key','model','map','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','show','keys','rawAttributes','length','merge','find','body','params','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','preferred','default_loginLogo.svg','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','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','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject'];(function(_0x119d80,_0x193e53){var _0x3c505d=function(_0x3f4c7a){while(--_0x3f4c7a){_0x119d80['push'](_0x119d80['shift']());}};_0x3c505d(++_0x193e53);}(_0x13ad,0x142));var _0xd13a=function(_0x5c4968,_0x4ae4f3){_0x5c4968=_0x5c4968-0x0;var _0x5df1c3=_0x13ad[_0x5c4968];return _0x5df1c3;};'use strict';var emlformat=require(_0xd13a('0x0'));var rimraf=require(_0xd13a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd13a('0x2'));var rp=require(_0xd13a('0x3'));var moment=require(_0xd13a('0x4'));var BPromise=require(_0xd13a('0x5'));var Mustache=require(_0xd13a('0x6'));var util=require('util');var path=require(_0xd13a('0x7'));var sox=require(_0xd13a('0x8'));var csv=require(_0xd13a('0x9'));var ejs=require(_0xd13a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd13a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd13a('0xc'));var toCsv=require(_0xd13a('0x9'));var querystring=require('querystring');var Papa=require(_0xd13a('0xd'));var Redis=require('ioredis');var authService=require(_0xd13a('0xe'));var qs=require(_0xd13a('0xf'));var as=require(_0xd13a('0x10'));var hardwareService=require(_0xd13a('0x11'));var logger=require(_0xd13a('0x12'))(_0xd13a('0x13'));var utils=require(_0xd13a('0x14'));var config=require(_0xd13a('0x15'));var licenseUtil=require(_0xd13a('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd13a('0x17'));var client=jayson[_0xd13a('0x18')][_0xd13a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3dc68e,_0x34ee52,_0x35869b,_0x23ce90){return new BPromise(function(_0x46a04f,_0x4a59e1){var _0x173a8b=_0x23ce90||client;return _0x173a8b[_0xd13a('0x1a')](_0x3dc68e,_0x35869b)[_0xd13a('0x1b')](function(_0x568a6d){logger[_0xd13a('0x1c')](_0xd13a('0x1d'),_0x34ee52,_0xd13a('0x1e'));logger[_0xd13a('0x1f')](_0xd13a('0x20'),_0x34ee52,'request\x20sent',JSON[_0xd13a('0x21')](_0x568a6d));if(_0x568a6d['error']){if(_0x568a6d[_0xd13a('0x22')][_0xd13a('0x23')]===0x1f4){logger['error'](_0xd13a('0x1d'),_0x34ee52,_0x568a6d[_0xd13a('0x22')][_0xd13a('0x24')]);return _0x4a59e1(_0x568a6d['error'][_0xd13a('0x24')]);}logger[_0xd13a('0x22')](_0xd13a('0x1d'),_0x34ee52,_0x568a6d['error']['message']);return _0x46a04f(_0x568a6d[_0xd13a('0x22')][_0xd13a('0x24')]);}else{logger[_0xd13a('0x1c')]('Setting,\x20%s,\x20%s',_0x34ee52,_0xd13a('0x1e'));_0x46a04f(_0x568a6d[_0xd13a('0x25')][_0xd13a('0x24')]);}})[_0xd13a('0x26')](function(_0x46b061){logger[_0xd13a('0x22')](_0xd13a('0x1d'),_0x34ee52,_0x46b061);_0x4a59e1(_0x46b061);});});}function respondWithStatusCode(_0x368efc,_0x4a06cc){_0x4a06cc=_0x4a06cc||0xcc;return function(_0x452885){if(_0x452885){return _0x368efc[_0xd13a('0x27')](_0x4a06cc);}return _0x368efc[_0xd13a('0x28')](_0x4a06cc)[_0xd13a('0x29')]();};}function respondWithResult(_0x445268,_0x52652b){_0x52652b=_0x52652b||0xc8;return function(_0x2376b4){if(_0x2376b4){return _0x445268['status'](_0x52652b)[_0xd13a('0x2a')](_0x2376b4);}};}function respondWithFilteredResult(_0x4d3aec,_0x4e7bf2){return function(_0x412755){if(_0x412755){var _0x1ee631=typeof _0x4e7bf2['offset']===_0xd13a('0x2b')&&typeof _0x4e7bf2[_0xd13a('0x2c')]==='undefined';var _0x3eb21d=_0x412755[_0xd13a('0x2d')];var _0x5bc796=_0x1ee631?0x0:_0x4e7bf2[_0xd13a('0x2e')];var _0x586c31=_0x1ee631?_0x412755[_0xd13a('0x2d')]:_0x4e7bf2[_0xd13a('0x2e')]+_0x4e7bf2['limit'];var _0x5cea1c;if(_0x586c31>=_0x3eb21d){_0x586c31=_0x3eb21d;_0x5cea1c=0xc8;}else{_0x5cea1c=0xce;}_0x4d3aec[_0xd13a('0x28')](_0x5cea1c);return _0x4d3aec['set'](_0xd13a('0x2f'),_0x5bc796+'-'+_0x586c31+'/'+_0x3eb21d)[_0xd13a('0x2a')](_0x412755);}return null;};}function patchUpdates(_0x54a3ef){return function(_0x7a23b3){try{jsonpatch[_0xd13a('0x30')](_0x7a23b3,_0x54a3ef,!![]);}catch(_0x1ed131){return BPromise[_0xd13a('0x31')](_0x1ed131);}return _0x7a23b3['save']();};}function saveUpdates(_0x410510,_0x548b32){return function(_0x3ee377){if(_0x3ee377){return _0x3ee377[_0xd13a('0x32')](_0x410510)[_0xd13a('0x1b')](function(_0x2357d9){return _0x2357d9;});}return null;};}function removeEntity(_0x5a4323,_0x437a3c){return function(_0x4bfee7){if(_0x4bfee7){return _0x4bfee7[_0xd13a('0x33')]()['then'](function(){_0x5a4323[_0xd13a('0x28')](0xcc)[_0xd13a('0x29')]();});}};}function handleEntityNotFound(_0x469938,_0x3ea609){return function(_0xa02508){if(!_0xa02508){_0x469938[_0xd13a('0x27')](0x194);}return _0xa02508;};}function handleError(_0x48f391,_0xadeb85){_0xadeb85=_0xadeb85||0x1f4;return function(_0x1be02f){logger[_0xd13a('0x22')](_0x1be02f[_0xd13a('0x34')]);if(_0x1be02f['name']){delete _0x1be02f[_0xd13a('0x35')];}_0x48f391[_0xd13a('0x28')](_0xadeb85)[_0xd13a('0x36')](_0x1be02f);};}exports[_0xd13a('0x37')]=function(_0x503a6a,_0x2e3484){var _0x509a48={},_0x1cd45b={},_0x5daa37={'count':0x0,'rows':[]};var _0x51c479=_['map'](db[_0xd13a('0x38')]['rawAttributes'],function(_0x44945b){return{'name':_0x44945b[_0xd13a('0x39')],'type':_0x44945b['type'][_0xd13a('0x3a')]};});_0x1cd45b[_0xd13a('0x3b')]=_[_0xd13a('0x3c')](_0x51c479,_0xd13a('0x35'));_0x1cd45b[_0xd13a('0x3d')]=_['keys'](_0x503a6a[_0xd13a('0x3d')]);_0x1cd45b['filters']=_[_0xd13a('0x3e')](_0x1cd45b[_0xd13a('0x3b')],_0x1cd45b['query']);_0x509a48['attributes']=_[_0xd13a('0x3e')](_0x1cd45b['model'],qs[_0xd13a('0x3f')](_0x503a6a[_0xd13a('0x3d')][_0xd13a('0x3f')]));_0x509a48['attributes']=_0x509a48[_0xd13a('0x40')]['length']?_0x509a48['attributes']:_0x1cd45b['model'];if(!_0x503a6a['query']['hasOwnProperty'](_0xd13a('0x41'))){_0x509a48['limit']=qs['limit'](_0x503a6a[_0xd13a('0x3d')][_0xd13a('0x2c')]);_0x509a48[_0xd13a('0x2e')]=qs[_0xd13a('0x2e')](_0x503a6a['query'][_0xd13a('0x2e')]);}_0x509a48[_0xd13a('0x42')]=qs[_0xd13a('0x43')](_0x503a6a[_0xd13a('0x3d')]['sort']);_0x509a48[_0xd13a('0x44')]=qs[_0xd13a('0x45')](_[_0xd13a('0x46')](_0x503a6a[_0xd13a('0x3d')],_0x1cd45b['filters']),_0x51c479);if(_0x503a6a['query'][_0xd13a('0x47')]){_0x509a48[_0xd13a('0x44')]=_['merge'](_0x509a48[_0xd13a('0x44')],{'$or':_[_0xd13a('0x3c')](_0x51c479,function(_0x309961){if(_0x309961[_0xd13a('0x48')]!==_0xd13a('0x49')){var _0x36f9df={};_0x36f9df[_0x309961[_0xd13a('0x35')]]={'$like':'%'+_0x503a6a[_0xd13a('0x3d')][_0xd13a('0x47')]+'%'};return _0x36f9df;}})});}_0x509a48=_['merge']({},_0x509a48,_0x503a6a['options']);var _0x541099={'where':_0x509a48[_0xd13a('0x44')]};return db[_0xd13a('0x38')][_0xd13a('0x2d')](_0x541099)[_0xd13a('0x1b')](function(_0x157e1d){_0x5daa37['count']=_0x157e1d;if(_0x503a6a[_0xd13a('0x3d')][_0xd13a('0x4a')]){_0x509a48[_0xd13a('0x4b')]=[{'all':!![]}];}return db['Setting'][_0xd13a('0x4c')](_0x509a48);})[_0xd13a('0x1b')](function(_0x1c18cf){_0x5daa37[_0xd13a('0x4d')]=_0x1c18cf;return _0x5daa37;})[_0xd13a('0x1b')](respondWithFilteredResult(_0x2e3484,_0x509a48))['catch'](handleError(_0x2e3484,null));};exports[_0xd13a('0x4e')]=function(_0x3939c8,_0x5221f1){var _0x8c388a={'raw':![],'where':{'id':_0x3939c8['params']['id']}},_0x4f92bb={};_0x4f92bb[_0xd13a('0x3b')]=_[_0xd13a('0x4f')](db[_0xd13a('0x38')][_0xd13a('0x50')]);_0x4f92bb[_0xd13a('0x3d')]=_[_0xd13a('0x4f')](_0x3939c8[_0xd13a('0x3d')]);_0x4f92bb[_0xd13a('0x45')]=_['intersection'](_0x4f92bb['model'],_0x4f92bb[_0xd13a('0x3d')]);_0x8c388a['attributes']=_['intersection'](_0x4f92bb[_0xd13a('0x3b')],qs[_0xd13a('0x3f')](_0x3939c8[_0xd13a('0x3d')][_0xd13a('0x3f')]));_0x8c388a[_0xd13a('0x40')]=_0x8c388a[_0xd13a('0x40')][_0xd13a('0x51')]?_0x8c388a[_0xd13a('0x40')]:_0x4f92bb[_0xd13a('0x3b')];if(_0x3939c8[_0xd13a('0x3d')][_0xd13a('0x4a')]){_0x8c388a[_0xd13a('0x4b')]=[{'all':!![]}];}_0x8c388a=_[_0xd13a('0x52')]({},_0x8c388a,_0x3939c8['options']);return db[_0xd13a('0x38')][_0xd13a('0x53')](_0x8c388a)['then'](handleEntityNotFound(_0x5221f1,null))[_0xd13a('0x1b')](respondWithResult(_0x5221f1,null))[_0xd13a('0x26')](handleError(_0x5221f1,null));};exports[_0xd13a('0x32')]=function(_0x5475e1,_0x541eea){if(_0x5475e1[_0xd13a('0x54')]['id']){delete _0x5475e1[_0xd13a('0x54')]['id'];}return db[_0xd13a('0x38')][_0xd13a('0x53')]({'where':{'id':_0x5475e1[_0xd13a('0x55')]['id']}})['then'](handleEntityNotFound(_0x541eea,null))[_0xd13a('0x1b')](saveUpdates(_0x5475e1[_0xd13a('0x54')],null))['then'](respondWithResult(_0x541eea,null))[_0xd13a('0x26')](handleError(_0x541eea,null));};exports[_0xd13a('0x56')]=function(_0x59ddd3,_0x2d93c6,_0x5c9d7e){if(_0x59ddd3['file']&&_0x59ddd3[_0xd13a('0x57')]['filename']){_0x59ddd3[_0xd13a('0x54')][_0xd13a('0x58')]=_0x59ddd3['file'][_0xd13a('0x59')];}return db[_0xd13a('0x38')][_0xd13a('0x53')]({'where':{'id':_0x59ddd3[_0xd13a('0x55')]['id']}})['then'](handleEntityNotFound(_0x2d93c6,null))['then'](saveUpdates(_0x59ddd3[_0xd13a('0x54')],null))[_0xd13a('0x1b')](respondWithResult(_0x2d93c6,null))[_0xd13a('0x26')](handleError(_0x2d93c6,null));};exports[_0xd13a('0x5a')]=function(_0x50ec91,_0x55aa44,_0x1305e1){if(_0x50ec91[_0xd13a('0x57')]&&_0x50ec91[_0xd13a('0x57')][_0xd13a('0x59')]){_0x50ec91[_0xd13a('0x54')][_0xd13a('0x5b')]=_0x50ec91[_0xd13a('0x57')][_0xd13a('0x59')];}return db[_0xd13a('0x38')]['find']({'where':{'id':_0x50ec91[_0xd13a('0x55')]['id']}})[_0xd13a('0x1b')](handleEntityNotFound(_0x55aa44,null))['then'](saveUpdates(_0x50ec91[_0xd13a('0x54')],null))[_0xd13a('0x1b')](respondWithResult(_0x55aa44,null))[_0xd13a('0x26')](handleError(_0x55aa44,null));};var utilLicense=require(_0xd13a('0x16'));exports[_0xd13a('0x5c')]=function(_0x2b1350,_0xdb485d,_0x3148ff){var _0x1a30c3=_0xd13a('0x5d');var _0x4d14ca={'custom':![]};return utilLicense[_0xd13a('0x5e')]()['then'](function(_0x182ba2){if(_0x182ba2){_0x4d14ca=_0x182ba2;}return db[_0xd13a('0x38')][_0xd13a('0x53')]({'where':{'id':_0x2b1350[_0xd13a('0x55')]['id']},'attributes':[_0xd13a('0x58'),'loginLogo','preferred',_0xd13a('0x5f'),_0xd13a('0x60'),_0xd13a('0x61'),_0xd13a('0x62'),_0xd13a('0x63')],'raw':!![]});})[_0xd13a('0x1b')](handleEntityNotFound(_0xdb485d,null))[_0xd13a('0x1b')](function(_0x268d6a){if(_0x268d6a){var _0x439aa5=_0x268d6a[_0xd13a('0x58')]&&fs[_0xd13a('0x64')](path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x1a30c3,_[_0xd13a('0x67')](_0x268d6a['logo'])))?path[_0xd13a('0x65')](config['root'],_0x1a30c3,_[_0xd13a('0x67')](_0x268d6a[_0xd13a('0x58')])):path['join'](config['root'],_0x1a30c3,_[_0xd13a('0x67')]('default_logo.svg'));var _0xaa5a93=_0xd13a('0x68')+_[_0xd13a('0x69')](_0xd13a('0x58'));if(_0x268d6a[_0xaa5a93]||!_0x4d14ca[_0xd13a('0x6a')]){_0x439aa5=path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x1a30c3,_[_0xd13a('0x67')](_0xd13a('0x6b')));}if(!fs[_0xd13a('0x64')](_0x439aa5)){throw new db[(_0xd13a('0x6c'))][(_0xd13a('0x6d'))](_['upperFirst'](_0xd13a('0x58'))+_0xd13a('0x6e'));}return _0xdb485d[_0xd13a('0x6f')](_0x439aa5);}})['catch'](handleError(_0xdb485d,null));};var utilLicense=require(_0xd13a('0x16'));exports['getLogoLogin']=function(_0x117bb0,_0x3020de,_0x8bd00b){var _0x4bdb75=_0xd13a('0x5d');var _0x31db3d={'custom':![]};return utilLicense[_0xd13a('0x5e')]()[_0xd13a('0x1b')](function(_0x17242d){if(_0x17242d){_0x31db3d=_0x17242d;}return db[_0xd13a('0x38')]['find']({'where':{'id':_0x117bb0[_0xd13a('0x55')]['id']},'attributes':[_0xd13a('0x58'),_0xd13a('0x5b'),_0xd13a('0x70'),_0xd13a('0x5f'),_0xd13a('0x60'),_0xd13a('0x61'),_0xd13a('0x62'),_0xd13a('0x63')],'raw':!![]});})[_0xd13a('0x1b')](handleEntityNotFound(_0x3020de,null))[_0xd13a('0x1b')](function(_0x1c74a4){if(_0x1c74a4){var _0x1ac821=_0x1c74a4[_0xd13a('0x5b')]&&fs[_0xd13a('0x64')](path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x4bdb75,_[_0xd13a('0x67')](_0x1c74a4[_0xd13a('0x5b')])))?path['join'](config[_0xd13a('0x66')],_0x4bdb75,_[_0xd13a('0x67')](_0x1c74a4[_0xd13a('0x5b')])):path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x4bdb75,_['toLower'](_0xd13a('0x71')));var _0x396631=_0xd13a('0x68')+_[_0xd13a('0x69')](_0xd13a('0x5b'));if(_0x1c74a4[_0x396631]||!_0x31db3d['custom']){_0x1ac821=path[_0xd13a('0x65')](config['root'],_0x4bdb75,_[_0xd13a('0x67')](_0xd13a('0x71')));}if(!fs[_0xd13a('0x64')](_0x1ac821)){throw new db[(_0xd13a('0x6c'))][(_0xd13a('0x6d'))](_[_0xd13a('0x69')](_0xd13a('0x5b'))+_0xd13a('0x6e'));}return _0x3020de[_0xd13a('0x6f')](_0x1ac821);}})[_0xd13a('0x26')](handleError(_0x3020de,null));};exports['gdpr']=function(_0xa5ce39,_0x40427f){return db['Setting'][_0xd13a('0x53')]({'where':{'id':_0xa5ce39[_0xd13a('0x55')]['id']},'attributes':[_0xd13a('0x72')]})['then'](respondWithResult(_0x40427f,null))['catch'](handleError(_0x40427f,null));};exports['addPreferred']=function(_0x508120,_0x50f194,_0xc56b7d){if(_0x508120[_0xd13a('0x57')]&&_0x508120[_0xd13a('0x57')]['filename']){_0x508120[_0xd13a('0x54')][_0xd13a('0x70')]=_0x508120['file'][_0xd13a('0x59')];}return db[_0xd13a('0x38')][_0xd13a('0x53')]({'where':{'id':_0x508120[_0xd13a('0x55')]['id']}})[_0xd13a('0x1b')](handleEntityNotFound(_0x50f194,null))[_0xd13a('0x1b')](saveUpdates(_0x508120[_0xd13a('0x54')],null))[_0xd13a('0x1b')](respondWithResult(_0x50f194,null))['catch'](handleError(_0x50f194,null));};var utilLicense=require(_0xd13a('0x16'));exports[_0xd13a('0x73')]=function(_0x2a84ed,_0x55bdc4,_0x40610e){var _0x462f0e=_0xd13a('0x5d');var _0x3516d1={'custom':![]};return utilLicense[_0xd13a('0x5e')]()['then'](function(_0xe90ba6){if(_0xe90ba6){_0x3516d1=_0xe90ba6;}return db['Setting'][_0xd13a('0x53')]({'where':{'id':_0x2a84ed[_0xd13a('0x55')]['id']},'attributes':[_0xd13a('0x58'),_0xd13a('0x5b'),'preferred',_0xd13a('0x5f'),_0xd13a('0x60'),'defaultLoginLogo',_0xd13a('0x62'),_0xd13a('0x63')],'raw':!![]});})[_0xd13a('0x1b')](handleEntityNotFound(_0x55bdc4,null))[_0xd13a('0x1b')](function(_0xc4977b){if(_0xc4977b){var _0x77eff=_0xc4977b['preferred']&&fs[_0xd13a('0x64')](path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x462f0e,_[_0xd13a('0x67')](_0xc4977b['preferred'])))?path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x462f0e,_[_0xd13a('0x67')](_0xc4977b[_0xd13a('0x70')])):path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x462f0e,_[_0xd13a('0x67')]('default_preferred.png'));var _0x8ceacc=_0xd13a('0x68')+_['upperFirst'](_0xd13a('0x70'));if(_0xc4977b[_0x8ceacc]||!_0x3516d1[_0xd13a('0x6a')]||!_0x3516d1[_0xd13a('0x70')]){_0x77eff=path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x462f0e,_['toLower'](_0xd13a('0x74')));}if(!fs[_0xd13a('0x64')](_0x77eff)){throw new db[(_0xd13a('0x6c'))]['ValidationError'](_[_0xd13a('0x69')](_0xd13a('0x70'))+_0xd13a('0x6e'));}return _0x55bdc4[_0xd13a('0x6f')](_0x77eff);}})['catch'](handleError(_0x55bdc4,null));};exports[_0xd13a('0x75')]=function(_0x428ed3,_0x31e0b1,_0x148dcf){if(_0x428ed3[_0xd13a('0x57')]&&_0x428ed3[_0xd13a('0x57')][_0xd13a('0x59')]){_0x428ed3[_0xd13a('0x54')][_0xd13a('0x5f')]=_0x428ed3[_0xd13a('0x57')][_0xd13a('0x59')];}return db[_0xd13a('0x38')][_0xd13a('0x53')]({'where':{'id':_0x428ed3[_0xd13a('0x55')]['id']}})[_0xd13a('0x1b')](handleEntityNotFound(_0x31e0b1,null))[_0xd13a('0x1b')](saveUpdates(_0x428ed3['body'],null))[_0xd13a('0x1b')](respondWithResult(_0x31e0b1,null))['catch'](handleError(_0x31e0b1,null));};var utilLicense=require(_0xd13a('0x16'));exports[_0xd13a('0x76')]=function(_0x2a9bc4,_0x45c7bb,_0x3f310f){var _0x723516=_0xd13a('0x5d');var _0x45dc15={'custom':![]};return utilLicense[_0xd13a('0x5e')]()[_0xd13a('0x1b')](function(_0xec8cfb){if(_0xec8cfb){_0x45dc15=_0xec8cfb;}return db[_0xd13a('0x38')][_0xd13a('0x53')]({'where':{'id':_0x2a9bc4[_0xd13a('0x55')]['id']},'attributes':[_0xd13a('0x58'),'loginLogo',_0xd13a('0x70'),_0xd13a('0x5f'),_0xd13a('0x60'),_0xd13a('0x61'),'defaultPreferred',_0xd13a('0x63')],'raw':!![]});})[_0xd13a('0x1b')](handleEntityNotFound(_0x45c7bb,null))[_0xd13a('0x1b')](function(_0x5881d1){if(_0x5881d1){var _0x468e20=_0x5881d1[_0xd13a('0x5f')]&&fs['existsSync'](path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x723516,_[_0xd13a('0x67')](_0x5881d1[_0xd13a('0x5f')])))?path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x723516,_[_0xd13a('0x67')](_0x5881d1[_0xd13a('0x5f')])):path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x723516,_['toLower'](_0xd13a('0x77')));var _0x3b6eec='default'+_[_0xd13a('0x69')](_0xd13a('0x5f'));if(_0x5881d1[_0x3b6eec]||!_0x45dc15['custom']){_0x468e20=path[_0xd13a('0x65')](config[_0xd13a('0x66')],_0x723516,_[_0xd13a('0x67')]('default_favicon.ico'));}if(!fs[_0xd13a('0x64')](_0x468e20)){throw new db[(_0xd13a('0x6c'))]['ValidationError'](_[_0xd13a('0x69')](_0xd13a('0x5f'))+_0xd13a('0x6e'));}return _0x45c7bb[_0xd13a('0x6f')](_0x468e20);}})[_0xd13a('0x26')](handleError(_0x45c7bb,null));};exports[_0xd13a('0x78')]=function(_0x4eb4d6,_0x7110b1){var _0x5362d7={'offset':moment()[_0xd13a('0x79')]()};_0x5362d7['now']=moment()[_0xd13a('0x79')](_0x5362d7[_0xd13a('0x2e')])[_0xd13a('0x7a')](_0xd13a('0x7b'));return _0x7110b1[_0xd13a('0x28')](0xc8)[_0xd13a('0x36')](_0x5362d7);}; \ No newline at end of file +var _0x27c9=['message','result','catch','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','include','params','fields','options','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','getLicense','loginLogo','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','getLogoLogin','server/files/images/logos','preferred','defaultLoginLogo','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','Sequelize','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x15674c,_0x166ebf){var _0x12dd5b=function(_0x3266f9){while(--_0x3266f9){_0x15674c['push'](_0x15674c['shift']());}};_0x12dd5b(++_0x166ebf);}(_0x27c9,0x1e7));var _0x927c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x27c9[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x927c('0x0'));var rimraf=require(_0x927c('0x1'));var zipdir=require(_0x927c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x927c('0x3'));var moment=require(_0x927c('0x4'));var BPromise=require(_0x927c('0x5'));var Mustache=require(_0x927c('0x6'));var util=require(_0x927c('0x7'));var path=require(_0x927c('0x8'));var sox=require(_0x927c('0x9'));var csv=require(_0x927c('0xa'));var ejs=require(_0x927c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x927c('0xc'));var squel=require(_0x927c('0xd'));var crypto=require(_0x927c('0xe'));var jsforce=require(_0x927c('0xf'));var deskjs=require(_0x927c('0x10'));var toCsv=require(_0x927c('0xa'));var querystring=require(_0x927c('0x11'));var Papa=require('papaparse');var Redis=require(_0x927c('0x12'));var authService=require(_0x927c('0x13'));var qs=require(_0x927c('0x14'));var as=require(_0x927c('0x15'));var hardwareService=require(_0x927c('0x16'));var logger=require(_0x927c('0x17'))(_0x927c('0x18'));var utils=require(_0x927c('0x19'));var config=require(_0x927c('0x1a'));var licenseUtil=require(_0x927c('0x1b'));var db=require(_0x927c('0x1c'))['db'];var jayson=require(_0x927c('0x1d'));var client=jayson[_0x927c('0x1e')][_0x927c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xb173d6,_0x9c49d,_0x6ae7c3,_0xda0cc1){return new BPromise(function(_0x3d6a73,_0x1af932){var _0x4202f=_0xda0cc1||client;return _0x4202f[_0x927c('0x20')](_0xb173d6,_0x6ae7c3)['then'](function(_0x4e60b6){logger[_0x927c('0x21')](_0x927c('0x22'),_0x9c49d,'request\x20sent');logger[_0x927c('0x23')](_0x927c('0x24'),_0x9c49d,_0x927c('0x25'),JSON[_0x927c('0x26')](_0x4e60b6));if(_0x4e60b6[_0x927c('0x27')]){if(_0x4e60b6[_0x927c('0x27')][_0x927c('0x28')]===0x1f4){logger[_0x927c('0x27')](_0x927c('0x22'),_0x9c49d,_0x4e60b6['error'][_0x927c('0x29')]);return _0x1af932(_0x4e60b6[_0x927c('0x27')]['message']);}logger[_0x927c('0x27')](_0x927c('0x22'),_0x9c49d,_0x4e60b6['error'][_0x927c('0x29')]);return _0x3d6a73(_0x4e60b6[_0x927c('0x27')][_0x927c('0x29')]);}else{logger[_0x927c('0x21')]('Setting,\x20%s,\x20%s',_0x9c49d,_0x927c('0x25'));_0x3d6a73(_0x4e60b6[_0x927c('0x2a')][_0x927c('0x29')]);}})[_0x927c('0x2b')](function(_0x342266){logger['error'](_0x927c('0x22'),_0x9c49d,_0x342266);_0x1af932(_0x342266);});});}function respondWithStatusCode(_0x11bc90,_0x171bc6){_0x171bc6=_0x171bc6||0xcc;return function(_0x35f9ba){if(_0x35f9ba){return _0x11bc90[_0x927c('0x2c')](_0x171bc6);}return _0x11bc90[_0x927c('0x2d')](_0x171bc6)[_0x927c('0x2e')]();};}function respondWithResult(_0x38a238,_0x3e89a9){_0x3e89a9=_0x3e89a9||0xc8;return function(_0x5b1a44){if(_0x5b1a44){return _0x38a238['status'](_0x3e89a9)[_0x927c('0x2f')](_0x5b1a44);}};}function respondWithFilteredResult(_0x10b11b,_0x5bb058){return function(_0x37eac7){if(_0x37eac7){var _0x488f77=typeof _0x5bb058['offset']===_0x927c('0x30')&&typeof _0x5bb058['limit']===_0x927c('0x30');var _0xd8b58=_0x37eac7['count'];var _0x1f9895=_0x488f77?0x0:_0x5bb058[_0x927c('0x31')];var _0x16eeec=_0x488f77?_0x37eac7[_0x927c('0x32')]:_0x5bb058[_0x927c('0x31')]+_0x5bb058[_0x927c('0x33')];var _0x283894;if(_0x16eeec>=_0xd8b58){_0x16eeec=_0xd8b58;_0x283894=0xc8;}else{_0x283894=0xce;}_0x10b11b[_0x927c('0x2d')](_0x283894);return _0x10b11b[_0x927c('0x34')](_0x927c('0x35'),_0x1f9895+'-'+_0x16eeec+'/'+_0xd8b58)[_0x927c('0x2f')](_0x37eac7);}return null;};}function patchUpdates(_0x2857e3){return function(_0x17e0a3){try{jsonpatch[_0x927c('0x36')](_0x17e0a3,_0x2857e3,!![]);}catch(_0x2b58e2){return BPromise[_0x927c('0x37')](_0x2b58e2);}return _0x17e0a3[_0x927c('0x38')]();};}function saveUpdates(_0x2a3f9c,_0x1c798c){return function(_0x38ae98){if(_0x38ae98){return _0x38ae98[_0x927c('0x39')](_0x2a3f9c)[_0x927c('0x3a')](function(_0x343fbf){return _0x343fbf;});}return null;};}function removeEntity(_0x1cea8c,_0x596e42){return function(_0x17f0cb){if(_0x17f0cb){return _0x17f0cb['destroy']()[_0x927c('0x3a')](function(){_0x1cea8c[_0x927c('0x2d')](0xcc)[_0x927c('0x2e')]();});}};}function handleEntityNotFound(_0x49eb28,_0x44510c){return function(_0x253839){if(!_0x253839){_0x49eb28[_0x927c('0x2c')](0x194);}return _0x253839;};}function handleError(_0x3fc8fc,_0x47929){_0x47929=_0x47929||0x1f4;return function(_0x2db56c){logger[_0x927c('0x27')](_0x2db56c[_0x927c('0x3b')]);if(_0x2db56c[_0x927c('0x3c')]){delete _0x2db56c[_0x927c('0x3c')];}_0x3fc8fc[_0x927c('0x2d')](_0x47929)[_0x927c('0x3d')](_0x2db56c);};}exports[_0x927c('0x3e')]=function(_0x3d9440,_0x4b7aaf){var _0x8478b3={},_0x2e90ad={},_0x234cfc={'count':0x0,'rows':[]};var _0x3c5655=_[_0x927c('0x3f')](db[_0x927c('0x40')][_0x927c('0x41')],function(_0xc34c2e){return{'name':_0xc34c2e[_0x927c('0x42')],'type':_0xc34c2e[_0x927c('0x43')][_0x927c('0x44')]};});_0x2e90ad[_0x927c('0x45')]=_[_0x927c('0x3f')](_0x3c5655,_0x927c('0x3c'));_0x2e90ad[_0x927c('0x46')]=_[_0x927c('0x47')](_0x3d9440[_0x927c('0x46')]);_0x2e90ad['filters']=_[_0x927c('0x48')](_0x2e90ad[_0x927c('0x45')],_0x2e90ad[_0x927c('0x46')]);_0x8478b3[_0x927c('0x49')]=_[_0x927c('0x48')](_0x2e90ad['model'],qs['fields'](_0x3d9440[_0x927c('0x46')]['fields']));_0x8478b3['attributes']=_0x8478b3[_0x927c('0x49')][_0x927c('0x4a')]?_0x8478b3['attributes']:_0x2e90ad[_0x927c('0x45')];if(!_0x3d9440[_0x927c('0x46')][_0x927c('0x4b')](_0x927c('0x4c'))){_0x8478b3['limit']=qs[_0x927c('0x33')](_0x3d9440['query'][_0x927c('0x33')]);_0x8478b3['offset']=qs[_0x927c('0x31')](_0x3d9440['query'][_0x927c('0x31')]);}_0x8478b3[_0x927c('0x4d')]=qs['sort'](_0x3d9440[_0x927c('0x46')][_0x927c('0x4e')]);_0x8478b3['where']=qs['filters'](_[_0x927c('0x4f')](_0x3d9440[_0x927c('0x46')],_0x2e90ad[_0x927c('0x50')]),_0x3c5655);if(_0x3d9440[_0x927c('0x46')][_0x927c('0x51')]){_0x8478b3[_0x927c('0x52')]=_[_0x927c('0x53')](_0x8478b3[_0x927c('0x52')],{'$or':_[_0x927c('0x3f')](_0x3c5655,function(_0x443c3b){if(_0x443c3b[_0x927c('0x43')]!=='VIRTUAL'){var _0x43c019={};_0x43c019[_0x443c3b[_0x927c('0x3c')]]={'$like':'%'+_0x3d9440[_0x927c('0x46')][_0x927c('0x51')]+'%'};return _0x43c019;}})});}_0x8478b3=_[_0x927c('0x53')]({},_0x8478b3,_0x3d9440['options']);var _0x49c89b={'where':_0x8478b3[_0x927c('0x52')]};return db['Setting'][_0x927c('0x32')](_0x49c89b)['then'](function(_0x33cd84){_0x234cfc[_0x927c('0x32')]=_0x33cd84;if(_0x3d9440[_0x927c('0x46')]['includeAll']){_0x8478b3[_0x927c('0x54')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x8478b3);})[_0x927c('0x3a')](function(_0x1d2144){_0x234cfc['rows']=_0x1d2144;return _0x234cfc;})[_0x927c('0x3a')](respondWithFilteredResult(_0x4b7aaf,_0x8478b3))[_0x927c('0x2b')](handleError(_0x4b7aaf,null));};exports['show']=function(_0x8578a7,_0x1c59b3){var _0x168add={'raw':![],'where':{'id':_0x8578a7[_0x927c('0x55')]['id']}},_0x4506df={};_0x4506df[_0x927c('0x45')]=_['keys'](db[_0x927c('0x40')][_0x927c('0x41')]);_0x4506df[_0x927c('0x46')]=_[_0x927c('0x47')](_0x8578a7[_0x927c('0x46')]);_0x4506df['filters']=_[_0x927c('0x48')](_0x4506df[_0x927c('0x45')],_0x4506df[_0x927c('0x46')]);_0x168add[_0x927c('0x49')]=_['intersection'](_0x4506df[_0x927c('0x45')],qs[_0x927c('0x56')](_0x8578a7[_0x927c('0x46')][_0x927c('0x56')]));_0x168add[_0x927c('0x49')]=_0x168add[_0x927c('0x49')]['length']?_0x168add[_0x927c('0x49')]:_0x4506df[_0x927c('0x45')];if(_0x8578a7[_0x927c('0x46')]['includeAll']){_0x168add[_0x927c('0x54')]=[{'all':!![]}];}_0x168add=_[_0x927c('0x53')]({},_0x168add,_0x8578a7[_0x927c('0x57')]);return db['Setting'][_0x927c('0x58')](_0x168add)[_0x927c('0x3a')](handleEntityNotFound(_0x1c59b3,null))['then'](respondWithResult(_0x1c59b3,null))[_0x927c('0x2b')](handleError(_0x1c59b3,null));};exports[_0x927c('0x39')]=function(_0x41af35,_0x50599a){if(_0x41af35[_0x927c('0x59')]['id']){delete _0x41af35[_0x927c('0x59')]['id'];}return db[_0x927c('0x40')][_0x927c('0x58')]({'where':{'id':_0x41af35[_0x927c('0x55')]['id']}})['then'](handleEntityNotFound(_0x50599a,null))[_0x927c('0x3a')](saveUpdates(_0x41af35['body'],null))[_0x927c('0x3a')](respondWithResult(_0x50599a,null))[_0x927c('0x2b')](handleError(_0x50599a,null));};exports[_0x927c('0x5a')]=function(_0x58cb97,_0x35c1be,_0x246250){if(_0x58cb97[_0x927c('0x5b')]&&_0x58cb97[_0x927c('0x5b')][_0x927c('0x5c')]){_0x58cb97[_0x927c('0x59')][_0x927c('0x5d')]=_0x58cb97[_0x927c('0x5b')][_0x927c('0x5c')];}return db[_0x927c('0x40')][_0x927c('0x58')]({'where':{'id':_0x58cb97[_0x927c('0x55')]['id']}})['then'](handleEntityNotFound(_0x35c1be,null))[_0x927c('0x3a')](saveUpdates(_0x58cb97[_0x927c('0x59')],null))[_0x927c('0x3a')](respondWithResult(_0x35c1be,null))[_0x927c('0x2b')](handleError(_0x35c1be,null));};exports[_0x927c('0x5e')]=function(_0x232984,_0x34921d,_0x50d51e){if(_0x232984[_0x927c('0x5b')]&&_0x232984[_0x927c('0x5b')][_0x927c('0x5c')]){_0x232984[_0x927c('0x59')]['loginLogo']=_0x232984[_0x927c('0x5b')][_0x927c('0x5c')];}return db[_0x927c('0x40')]['find']({'where':{'id':_0x232984[_0x927c('0x55')]['id']}})['then'](handleEntityNotFound(_0x34921d,null))[_0x927c('0x3a')](saveUpdates(_0x232984['body'],null))['then'](respondWithResult(_0x34921d,null))['catch'](handleError(_0x34921d,null));};var utilLicense=require(_0x927c('0x1b'));exports[_0x927c('0x5f')]=function(_0x2b7125,_0x352d45,_0x20ac31){var _0x4228b2='server/files/images/logos';var _0x44aa8c={'custom':![]};return utilLicense[_0x927c('0x60')]()[_0x927c('0x3a')](function(_0xacf376){if(_0xacf376){_0x44aa8c=_0xacf376;}return db['Setting']['find']({'where':{'id':_0x2b7125[_0x927c('0x55')]['id']},'attributes':[_0x927c('0x5d'),_0x927c('0x61'),'preferred',_0x927c('0x62'),_0x927c('0x63'),'defaultLoginLogo',_0x927c('0x64'),_0x927c('0x65')],'raw':!![]});})[_0x927c('0x3a')](handleEntityNotFound(_0x352d45,null))['then'](function(_0x5379a0){if(_0x5379a0){var _0x3e1065=_0x5379a0[_0x927c('0x5d')]&&fs[_0x927c('0x66')](path['join'](config[_0x927c('0x67')],_0x4228b2,_[_0x927c('0x68')](_0x5379a0[_0x927c('0x5d')])))?path['join'](config[_0x927c('0x67')],_0x4228b2,_[_0x927c('0x68')](_0x5379a0['logo'])):path[_0x927c('0x69')](config[_0x927c('0x67')],_0x4228b2,_[_0x927c('0x68')](_0x927c('0x6a')));var _0x30449d=_0x927c('0x6b')+_[_0x927c('0x6c')](_0x927c('0x5d'));if(_0x5379a0[_0x30449d]||!_0x44aa8c[_0x927c('0x6d')]){_0x3e1065=path[_0x927c('0x69')](config[_0x927c('0x67')],_0x4228b2,_[_0x927c('0x68')](_0x927c('0x6a')));}if(!fs[_0x927c('0x66')](_0x3e1065)){throw new db['Sequelize'][(_0x927c('0x6e'))](_['upperFirst'](_0x927c('0x5d'))+_0x927c('0x6f'));}return _0x352d45['download'](_0x3e1065);}})[_0x927c('0x2b')](handleError(_0x352d45,null));};var utilLicense=require(_0x927c('0x1b'));exports[_0x927c('0x70')]=function(_0x3c3b8,_0x549b80,_0x4b382b){var _0x42ffa6=_0x927c('0x71');var _0x5285cc={'custom':![]};return utilLicense[_0x927c('0x60')]()[_0x927c('0x3a')](function(_0x598528){if(_0x598528){_0x5285cc=_0x598528;}return db[_0x927c('0x40')][_0x927c('0x58')]({'where':{'id':_0x3c3b8[_0x927c('0x55')]['id']},'attributes':[_0x927c('0x5d'),_0x927c('0x61'),_0x927c('0x72'),_0x927c('0x62'),_0x927c('0x63'),_0x927c('0x73'),_0x927c('0x64'),_0x927c('0x65')],'raw':!![]});})[_0x927c('0x3a')](handleEntityNotFound(_0x549b80,null))['then'](function(_0x2272ca){if(_0x2272ca){var _0x2014cd=_0x2272ca[_0x927c('0x61')]&&fs[_0x927c('0x66')](path[_0x927c('0x69')](config[_0x927c('0x67')],_0x42ffa6,_[_0x927c('0x68')](_0x2272ca[_0x927c('0x61')])))?path['join'](config['root'],_0x42ffa6,_[_0x927c('0x68')](_0x2272ca[_0x927c('0x61')])):path['join'](config[_0x927c('0x67')],_0x42ffa6,_[_0x927c('0x68')](_0x927c('0x74')));var _0xd07ea4=_0x927c('0x6b')+_[_0x927c('0x6c')]('loginLogo');if(_0x2272ca[_0xd07ea4]||!_0x5285cc[_0x927c('0x6d')]){_0x2014cd=path[_0x927c('0x69')](config[_0x927c('0x67')],_0x42ffa6,_['toLower'](_0x927c('0x74')));}if(!fs[_0x927c('0x66')](_0x2014cd)){throw new db['Sequelize'][(_0x927c('0x6e'))](_['upperFirst'](_0x927c('0x61'))+_0x927c('0x6f'));}return _0x549b80[_0x927c('0x75')](_0x2014cd);}})[_0x927c('0x2b')](handleError(_0x549b80,null));};exports[_0x927c('0x76')]=function(_0x52d4e6,_0x5c26ce){return db[_0x927c('0x40')]['find']({'where':{'id':_0x52d4e6[_0x927c('0x55')]['id']},'attributes':[_0x927c('0x77')]})['then'](respondWithResult(_0x5c26ce,null))[_0x927c('0x2b')](handleError(_0x5c26ce,null));};exports[_0x927c('0x78')]=function(_0x4bf3bb,_0x45d971,_0x391065){if(_0x4bf3bb[_0x927c('0x5b')]&&_0x4bf3bb['file'][_0x927c('0x5c')]){_0x4bf3bb[_0x927c('0x59')]['preferred']=_0x4bf3bb[_0x927c('0x5b')]['filename'];}return db['Setting'][_0x927c('0x58')]({'where':{'id':_0x4bf3bb[_0x927c('0x55')]['id']}})[_0x927c('0x3a')](handleEntityNotFound(_0x45d971,null))[_0x927c('0x3a')](saveUpdates(_0x4bf3bb['body'],null))['then'](respondWithResult(_0x45d971,null))['catch'](handleError(_0x45d971,null));};var utilLicense=require('../../config/license/util');exports[_0x927c('0x79')]=function(_0x1c8803,_0x52a488,_0x545c3c){var _0x5736fe=_0x927c('0x71');var _0x1934ff={'custom':![]};return utilLicense[_0x927c('0x60')]()[_0x927c('0x3a')](function(_0x46315b){if(_0x46315b){_0x1934ff=_0x46315b;}return db[_0x927c('0x40')]['find']({'where':{'id':_0x1c8803['params']['id']},'attributes':['logo',_0x927c('0x61'),_0x927c('0x72'),_0x927c('0x62'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x927c('0x65')],'raw':!![]});})[_0x927c('0x3a')](handleEntityNotFound(_0x52a488,null))['then'](function(_0x5707e3){if(_0x5707e3){var _0x55a542=_0x5707e3['preferred']&&fs['existsSync'](path[_0x927c('0x69')](config[_0x927c('0x67')],_0x5736fe,_[_0x927c('0x68')](_0x5707e3['preferred'])))?path[_0x927c('0x69')](config[_0x927c('0x67')],_0x5736fe,_[_0x927c('0x68')](_0x5707e3['preferred'])):path[_0x927c('0x69')](config[_0x927c('0x67')],_0x5736fe,_[_0x927c('0x68')](_0x927c('0x7a')));var _0x507eee='default'+_['upperFirst'](_0x927c('0x72'));if(_0x5707e3[_0x507eee]||!_0x1934ff[_0x927c('0x6d')]||!_0x1934ff[_0x927c('0x72')]){_0x55a542=path[_0x927c('0x69')](config[_0x927c('0x67')],_0x5736fe,_[_0x927c('0x68')](_0x927c('0x7a')));}if(!fs[_0x927c('0x66')](_0x55a542)){throw new db[(_0x927c('0x7b'))][(_0x927c('0x6e'))](_[_0x927c('0x6c')](_0x927c('0x72'))+_0x927c('0x6f'));}return _0x52a488[_0x927c('0x75')](_0x55a542);}})[_0x927c('0x2b')](handleError(_0x52a488,null));};exports[_0x927c('0x7c')]=function(_0x287c9a,_0x59f024,_0x533c59){if(_0x287c9a[_0x927c('0x5b')]&&_0x287c9a[_0x927c('0x5b')][_0x927c('0x5c')]){_0x287c9a['body'][_0x927c('0x62')]=_0x287c9a[_0x927c('0x5b')]['filename'];}return db[_0x927c('0x40')][_0x927c('0x58')]({'where':{'id':_0x287c9a['params']['id']}})[_0x927c('0x3a')](handleEntityNotFound(_0x59f024,null))[_0x927c('0x3a')](saveUpdates(_0x287c9a[_0x927c('0x59')],null))[_0x927c('0x3a')](respondWithResult(_0x59f024,null))[_0x927c('0x2b')](handleError(_0x59f024,null));};var utilLicense=require(_0x927c('0x1b'));exports[_0x927c('0x7d')]=function(_0x2ffbb5,_0x26b864,_0x1accd1){var _0x443853=_0x927c('0x71');var _0x4f826b={'custom':![]};return utilLicense[_0x927c('0x60')]()[_0x927c('0x3a')](function(_0x185cc5){if(_0x185cc5){_0x4f826b=_0x185cc5;}return db['Setting'][_0x927c('0x58')]({'where':{'id':_0x2ffbb5[_0x927c('0x55')]['id']},'attributes':[_0x927c('0x5d'),_0x927c('0x61'),_0x927c('0x72'),_0x927c('0x62'),_0x927c('0x63'),_0x927c('0x73'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x26b864,null))[_0x927c('0x3a')](function(_0x4ff478){if(_0x4ff478){var _0x4f9837=_0x4ff478[_0x927c('0x62')]&&fs[_0x927c('0x66')](path[_0x927c('0x69')](config[_0x927c('0x67')],_0x443853,_[_0x927c('0x68')](_0x4ff478['favicon'])))?path[_0x927c('0x69')](config[_0x927c('0x67')],_0x443853,_[_0x927c('0x68')](_0x4ff478['favicon'])):path[_0x927c('0x69')](config[_0x927c('0x67')],_0x443853,_[_0x927c('0x68')](_0x927c('0x7e')));var _0x3cc894=_0x927c('0x6b')+_[_0x927c('0x6c')](_0x927c('0x62'));if(_0x4ff478[_0x3cc894]||!_0x4f826b['custom']){_0x4f9837=path[_0x927c('0x69')](config[_0x927c('0x67')],_0x443853,_[_0x927c('0x68')](_0x927c('0x7e')));}if(!fs[_0x927c('0x66')](_0x4f9837)){throw new db[(_0x927c('0x7b'))][(_0x927c('0x6e'))](_['upperFirst'](_0x927c('0x62'))+_0x927c('0x6f'));}return _0x26b864[_0x927c('0x75')](_0x4f9837);}})[_0x927c('0x2b')](handleError(_0x26b864,null));};exports[_0x927c('0x7f')]=function(_0x42c62c,_0x1608a8){var _0x8fc40a={'offset':moment()['utcOffset']()};_0x8fc40a[_0x927c('0x80')]=moment()[_0x927c('0x81')](_0x8fc40a['offset'])[_0x927c('0x82')](_0x927c('0x83'));return _0x1608a8[_0x927c('0x2d')](0xc8)['send'](_0x8fc40a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 3af4b27..2b7b2d6 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x159ed2,_0x3de4c6){var _0x560e71=function(_0x25f375){while(--_0x25f375){_0x159ed2['push'](_0x159ed2['shift']());}};_0x560e71(++_0x3de4c6);}(_0xedd9,0xfc));var _0x9edd=function(_0x51acdf,_0x2cf30e){_0x51acdf=_0x51acdf-0x0;var _0x493d31=_0xedd9[_0x51acdf];return _0x493d31;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x528bb5,_0x119c5b){var _0x58e8ca=function(_0x5a8077){while(--_0x5a8077){_0x528bb5['push'](_0x528bb5['shift']());}};_0x58e8ca(++_0x119c5b);}(_0x008c,0x188));var _0xc008=function(_0x4074d5,_0xa57194){_0x4074d5=_0x4074d5-0x0;var _0x502cfe=_0x008c[_0x4074d5];return _0x502cfe;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'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 322ede1..fa8ef2b 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 _0xc43f=['map','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','where','attributes','model','include'];(function(_0x100ffb,_0x5a8adc){var _0x54e870=function(_0x40ceca){while(--_0x40ceca){_0x100ffb['push'](_0x100ffb['shift']());}};_0x54e870(++_0x5a8adc);}(_0xc43f,0x1d3));var _0xfc43=function(_0x293bf9,_0x461650){_0x293bf9=_0x293bf9-0x0;var _0x5cbc58=_0xc43f[_0x293bf9];return _0x5cbc58;};'use strict';var _=require(_0xfc43('0x0'));var util=require(_0xfc43('0x1'));var moment=require(_0xfc43('0x2'));var BPromise=require(_0xfc43('0x3'));var rs=require(_0xfc43('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc43('0x5'))['db'];var utils=require(_0xfc43('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfc43('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc43('0x8')][_0xfc43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x176080,_0x47fbf5,_0x106d57){return new BPromise(function(_0x57edfd,_0x4346c2){return client['request'](_0x176080,_0x106d57)[_0xfc43('0xa')](function(_0x317983){logger['info']('Setting,\x20%s,\x20%s',_0x47fbf5,_0xfc43('0xb'));logger[_0xfc43('0xc')](_0xfc43('0xd'),_0x47fbf5,_0xfc43('0xb'),JSON[_0xfc43('0xe')](_0x317983));if(_0x317983[_0xfc43('0xf')]){if(_0x317983['error'][_0xfc43('0x10')]===0x1f4){logger['error'](_0xfc43('0x11'),_0x47fbf5,_0x317983['error']['message']);return _0x4346c2(_0x317983['error'][_0xfc43('0x12')]);}logger[_0xfc43('0xf')](_0xfc43('0x11'),_0x47fbf5,_0x317983['error'][_0xfc43('0x12')]);return _0x57edfd(_0x317983[_0xfc43('0xf')]['message']);}else{logger['info'](_0xfc43('0x11'),_0x47fbf5,'request\x20sent');_0x57edfd(_0x317983[_0xfc43('0x13')][_0xfc43('0x12')]);}})[_0xfc43('0x14')](function(_0x1750c1){logger[_0xfc43('0xf')]('Setting,\x20%s,\x20%s',_0x47fbf5,_0x1750c1);_0x4346c2(_0x1750c1);});});}exports[_0xfc43('0x15')]=function(_0x573163){var _0x3255c4=this;return new Promise(function(_0x5019df,_0x39ce5b){return db[_0xfc43('0x16')][_0xfc43('0x17')]({'raw':_0x573163[_0xfc43('0x18')]?_0x573163[_0xfc43('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x573163[_0xfc43('0x18')]?_0x573163[_0xfc43('0x18')][_0xfc43('0x19')]||null:null,'attributes':_0x573163['options']?_0x573163[_0xfc43('0x18')][_0xfc43('0x1a')]||null:null,'include':_0x573163['options']?_0x573163['options']['include']?_['map'](_0x573163[_0xfc43('0x18')]['include'],function(_0x1771b3){return{'model':db[_0x1771b3[_0xfc43('0x1b')]],'as':_0x1771b3['as'],'attributes':_0x1771b3[_0xfc43('0x1a')],'include':_0x1771b3[_0xfc43('0x1c')]?_[_0xfc43('0x1d')](_0x1771b3[_0xfc43('0x1c')],function(_0x33bd7c){return{'model':db[_0x33bd7c[_0xfc43('0x1b')]],'as':_0x33bd7c['as'],'attributes':_0x33bd7c['attributes'],'include':_0x33bd7c[_0xfc43('0x1c')]?_[_0xfc43('0x1d')](_0x33bd7c['include'],function(_0x318d19){return{'model':db[_0x318d19[_0xfc43('0x1b')]],'as':_0x318d19['as'],'attributes':_0x318d19[_0xfc43('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x298bb0){logger[_0xfc43('0x1e')]('ShowSetting',_0x573163);logger[_0xfc43('0xc')](_0xfc43('0x15'),_0x573163,JSON[_0xfc43('0xe')](_0x298bb0));_0x5019df(_0x298bb0);})[_0xfc43('0x14')](function(_0x4e03dd){logger['error'](_0xfc43('0x15'),_0x4e03dd[_0xfc43('0x12')],_0x573163);_0x39ce5b(_0x3255c4[_0xfc43('0xf')](0x1f4,_0x4e03dd[_0xfc43('0x12')]));});});}; \ No newline at end of file +var _0x9350=['result','ShowSetting','Setting','options','raw','where','attributes','include','map','model','catch','lodash','util','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4c20cb,_0x224158){var _0x1ea6ad=function(_0x2b4a53){while(--_0x2b4a53){_0x4c20cb['push'](_0x4c20cb['shift']());}};_0x1ea6ad(++_0x224158);}(_0x9350,0x110));var _0x0935=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x9350[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0x0935('0x0'));var util=require(_0x0935('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0935('0x2'));var logger=require(_0x0935('0x3'))('rpc');var config=require(_0x0935('0x4'));var jayson=require(_0x0935('0x5'));var client=jayson['client'][_0x0935('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3c307e,_0x317f69,_0x4da4b6){return new BPromise(function(_0x54db0a,_0xd5d8f0){return client[_0x0935('0x7')](_0x3c307e,_0x4da4b6)[_0x0935('0x8')](function(_0x8917ec){logger[_0x0935('0x9')](_0x0935('0xa'),_0x317f69,_0x0935('0xb'));logger[_0x0935('0xc')](_0x0935('0xd'),_0x317f69,'request\x20sent',JSON[_0x0935('0xe')](_0x8917ec));if(_0x8917ec[_0x0935('0xf')]){if(_0x8917ec['error'][_0x0935('0x10')]===0x1f4){logger[_0x0935('0xf')](_0x0935('0xa'),_0x317f69,_0x8917ec[_0x0935('0xf')][_0x0935('0x11')]);return _0xd5d8f0(_0x8917ec['error']['message']);}logger[_0x0935('0xf')](_0x0935('0xa'),_0x317f69,_0x8917ec[_0x0935('0xf')][_0x0935('0x11')]);return _0x54db0a(_0x8917ec['error'][_0x0935('0x11')]);}else{logger[_0x0935('0x9')](_0x0935('0xa'),_0x317f69,_0x0935('0xb'));_0x54db0a(_0x8917ec[_0x0935('0x12')][_0x0935('0x11')]);}})['catch'](function(_0xd19393){logger[_0x0935('0xf')]('Setting,\x20%s,\x20%s',_0x317f69,_0xd19393);_0xd5d8f0(_0xd19393);});});}exports[_0x0935('0x13')]=function(_0x2bf56d){var _0x2dfe74=this;return new Promise(function(_0xf6f97a,_0x1f5956){return db[_0x0935('0x14')]['find']({'raw':_0x2bf56d[_0x0935('0x15')]?_0x2bf56d[_0x0935('0x15')][_0x0935('0x16')]===undefined?!![]:![]:!![],'where':_0x2bf56d[_0x0935('0x15')]?_0x2bf56d['options'][_0x0935('0x17')]||null:null,'attributes':_0x2bf56d[_0x0935('0x15')]?_0x2bf56d[_0x0935('0x15')][_0x0935('0x18')]||null:null,'include':_0x2bf56d['options']?_0x2bf56d[_0x0935('0x15')][_0x0935('0x19')]?_[_0x0935('0x1a')](_0x2bf56d[_0x0935('0x15')][_0x0935('0x19')],function(_0x478864){return{'model':db[_0x478864[_0x0935('0x1b')]],'as':_0x478864['as'],'attributes':_0x478864[_0x0935('0x18')],'include':_0x478864[_0x0935('0x19')]?_[_0x0935('0x1a')](_0x478864['include'],function(_0x445696){return{'model':db[_0x445696[_0x0935('0x1b')]],'as':_0x445696['as'],'attributes':_0x445696['attributes'],'include':_0x445696[_0x0935('0x19')]?_[_0x0935('0x1a')](_0x445696[_0x0935('0x19')],function(_0x5db954){return{'model':db[_0x5db954[_0x0935('0x1b')]],'as':_0x5db954['as'],'attributes':_0x5db954['attributes']};}):[]};}):[]};}):[]:[]})[_0x0935('0x8')](function(_0x383097){logger['info']('ShowSetting',_0x2bf56d);logger[_0x0935('0xc')](_0x0935('0x13'),_0x2bf56d,JSON['stringify'](_0x383097));_0xf6f97a(_0x383097);})[_0x0935('0x1c')](function(_0x584a70){logger[_0x0935('0xf')](_0x0935('0x13'),_0x584a70['message'],_0x2bf56d);_0x1f5956(_0x2dfe74['error'](0x1f4,_0x584a70['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 435d642..2045b3d 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 _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x460d0f,_0x5bffea){var _0x3720c7=function(_0x4a6195){while(--_0x4a6195){_0x460d0f['push'](_0x460d0f['shift']());}};_0x3720c7(++_0x5bffea);}(_0x53ec,0x192));var _0xc53e=function(_0x4af3b7,_0x30c116){_0x4af3b7=_0x4af3b7-0x0;var _0x24727c=_0x53ec[_0x4af3b7];return _0x24727c;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x55ca=['describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x55ca,0x126));var _0xa55c=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x55ca[_0xa60623];return _0x4a6487;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getApplications']);router['get'](_0xa55c('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xa55c('0x12'),controller[_0xa55c('0x13')]);router[_0xa55c('0x7')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x17')](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);router[_0xa55c('0x17')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller['addAnswer']);router[_0xa55c('0x17')](_0xa55c('0x19'),controller[_0xa55c('0x1a')]);router[_0xa55c('0x17')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['addApplications']);router['post'](_0xa55c('0x1b'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1c')]);router['post'](_0xa55c('0x12'),controller[_0xa55c('0x1d')]);router['post'](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1e')]);router[_0xa55c('0x1f')](_0xa55c('0xb'),auth['isAuthenticated'](),controller[_0xa55c('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x21')]);router['delete'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x22')]);router[_0xa55c('0x23')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x24')]);router[_0xa55c('0x23')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index eb9cdee..50299cc 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 _0x3f0a=['ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3f0a,0x79));var _0xa3f0=function(_0xbeab0a,_0x38f521){_0xbeab0a=_0xbeab0a-0x0;var _0x4c7fd0=_0x3f0a[_0xbeab0a];return _0x4c7fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa3f0('0x0'));module[_0xa3f0('0x1')]={'name':{'type':Sequelize[_0xa3f0('0x2')],'unique':_0xa3f0('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa3f0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa3f0('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa3f0('0x2')],'defaultValue':function(){return rs[_0xa3f0('0x4')]();}},'phone':{'type':Sequelize[_0xa3f0('0x2')]},'type':{'type':Sequelize[_0xa3f0('0x5')](_0xa3f0('0x6'),_0xa3f0('0x7'),_0xa3f0('0x8'),_0xa3f0('0x9'),_0xa3f0('0xa'),_0xa3f0('0xb'),_0xa3f0('0xc'),'csc',_0xa3f0('0xd'),_0xa3f0('0xe'))},'accountSid':{'type':Sequelize[_0xa3f0('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa3f0('0x2')]},'smsMethod':{'type':Sequelize[_0xa3f0('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa3f0('0x2')]},'password':{'type':Sequelize[_0xa3f0('0x2')]},'apiKey':{'type':Sequelize[_0xa3f0('0x2')]},'applicationId':{'type':Sequelize[_0xa3f0('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xa3f0('0x2')]},'deliveryReport':{'type':Sequelize[_0xa3f0('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xa3f0('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa3f0('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa3f0('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa3f0('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa3f0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa3f0('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa3f0('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa3f0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa3f0('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa3f0('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3306b7){if(!_0x3306b7)this[_0xa3f0('0x12')](_0xa3f0('0x13'),null);this[_0xa3f0('0x12')](_0xa3f0('0x14'),_0x3306b7);}}}; \ No newline at end of file +var _0x6c58=['name','generate','ENUM','skebby','connectel','intelepeer','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6c58,0x84));var _0x86c5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6c58[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x86c5('0x0'));var rs=require(_0x86c5('0x1'));module['exports']={'name':{'type':Sequelize[_0x86c5('0x2')],'unique':_0x86c5('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x86c5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x86c5('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x86c5('0x4')]();}},'phone':{'type':Sequelize[_0x86c5('0x2')]},'type':{'type':Sequelize[_0x86c5('0x5')]('twilio',_0x86c5('0x6'),_0x86c5('0x7'),'clicksend','plivo','clickatell','bandwidth','csc','infobip',_0x86c5('0x8'))},'accountSid':{'type':Sequelize[_0x86c5('0x2')]},'authId':{'type':Sequelize[_0x86c5('0x2')]},'authToken':{'type':Sequelize[_0x86c5('0x2')]},'smsMethod':{'type':Sequelize[_0x86c5('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x86c5('0x2')]},'apiKey':{'type':Sequelize[_0x86c5('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x86c5('0x2')]},'senderString':{'type':Sequelize[_0x86c5('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x86c5('0x9')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x86c5('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x86c5('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x86c5('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x86c5('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x86c5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x86c5('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x86c5('0xa')],'defaultValue':![],'comment':_0x86c5('0xc'),'set':function(_0x1b06f1){if(!_0x1b06f1)this[_0x86c5('0xd')](_0x86c5('0xe'),null);this[_0x86c5('0xd')]('mandatoryDisposition',_0x1b06f1);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 726c2ab..f3e4921 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 _0xe1d4=['client','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','offset','undefined','limit','count','set','save','then','destroy','SmsAccounts','UserProfileResource','name','SmsAccount','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','Pause','mandatoryDispositionPause','rawAttributes','options','catch','create','user','role','get','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','CannedAnswer','getAnswers','findAll','removeAnswers','sms','Applications','account','orderBy','priority','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','from','From','Body','messageId','MessageSid','skebby','connectel','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','ListId','CmContact','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','send','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','SmsApplication','stack','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','tag','to\x20is\x20mandatory','CmList','List','DESC','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','groupName','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','localhost','socket.io-emitter','redis','./smsAccount.socket','register'];(function(_0x4ba579,_0x35a68c){var _0x364bb8=function(_0x17265e){while(--_0x17265e){_0x4ba579['push'](_0x4ba579['shift']());}};_0x364bb8(++_0x35a68c);}(_0xe1d4,0xc0));var _0x4e1d=function(_0x316332,_0x129570){_0x316332=_0x316332-0x0;var _0x463229=_0xe1d4[_0x316332];return _0x463229;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e1d('0x0'));var zipdir=require(_0x4e1d('0x1'));var jsonpatch=require(_0x4e1d('0x2'));var rp=require(_0x4e1d('0x3'));var moment=require(_0x4e1d('0x4'));var BPromise=require(_0x4e1d('0x5'));var Mustache=require(_0x4e1d('0x6'));var util=require(_0x4e1d('0x7'));var path=require(_0x4e1d('0x8'));var sox=require(_0x4e1d('0x9'));var csv=require(_0x4e1d('0xa'));var ejs=require(_0x4e1d('0xb'));var fs=require('fs');var fs_extra=require(_0x4e1d('0xc'));var _=require(_0x4e1d('0xd'));var squel=require(_0x4e1d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e1d('0xf'));var toCsv=require(_0x4e1d('0xa'));var querystring=require(_0x4e1d('0x10'));var Papa=require(_0x4e1d('0x11'));var Redis=require(_0x4e1d('0x12'));var authService=require(_0x4e1d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4e1d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e1d('0x15'))(_0x4e1d('0x16'));var utils=require(_0x4e1d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4e1d('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4e1d('0x19'),'port':0x18eb});var socket=require(_0x4e1d('0x1a'))(new Redis(config[_0x4e1d('0x1b')]));require(_0x4e1d('0x1c'))[_0x4e1d('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4e1d('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5012b3,_0x4c5a27,_0x20c90b,_0x3fdc9f){return new BPromise(function(_0x355a92,_0x154e41){var _0x2a1267=_0x3fdc9f||client;return _0x2a1267[_0x4e1d('0x1f')](_0x5012b3,_0x20c90b)['then'](function(_0xf56830){logger['info'](_0x4e1d('0x20'),_0x4c5a27,_0x4e1d('0x21'));logger[_0x4e1d('0x22')](_0x4e1d('0x23'),_0x4c5a27,'request\x20sent',JSON[_0x4e1d('0x24')](_0xf56830));if(_0xf56830[_0x4e1d('0x25')]){if(_0xf56830[_0x4e1d('0x25')][_0x4e1d('0x26')]===0x1f4){logger[_0x4e1d('0x25')](_0x4e1d('0x20'),_0x4c5a27,_0xf56830[_0x4e1d('0x25')][_0x4e1d('0x27')]);return _0x154e41(_0xf56830['error']['message']);}logger['error'](_0x4e1d('0x20'),_0x4c5a27,_0xf56830[_0x4e1d('0x25')][_0x4e1d('0x27')]);return _0x355a92(_0xf56830[_0x4e1d('0x25')][_0x4e1d('0x27')]);}else{logger['info'](_0x4e1d('0x20'),_0x4c5a27,_0x4e1d('0x21'));_0x355a92(_0xf56830['result'][_0x4e1d('0x27')]);}})['catch'](function(_0x87e436){logger['error'](_0x4e1d('0x20'),_0x4c5a27,_0x87e436);_0x154e41(_0x87e436);});});}function respondWithStatusCode(_0x5a3a6d,_0x3b6c49){_0x3b6c49=_0x3b6c49||0xcc;return function(_0x322d41){if(_0x322d41){return _0x5a3a6d[_0x4e1d('0x28')](_0x3b6c49);}return _0x5a3a6d['status'](_0x3b6c49)[_0x4e1d('0x29')]();};}function respondWithResult(_0x56d6d1,_0x3f517a){_0x3f517a=_0x3f517a||0xc8;return function(_0x553e4b){if(_0x553e4b){return _0x56d6d1[_0x4e1d('0x2a')](_0x3f517a)[_0x4e1d('0x2b')](_0x553e4b);}};}function respondWithFilteredResult(_0x26473e,_0x380560){return function(_0x3ebefa){if(_0x3ebefa){var _0x3fea84=typeof _0x380560[_0x4e1d('0x2c')]===_0x4e1d('0x2d')&&typeof _0x380560[_0x4e1d('0x2e')]===_0x4e1d('0x2d');var _0x44ca08=_0x3ebefa[_0x4e1d('0x2f')];var _0x44e22d=_0x3fea84?0x0:_0x380560['offset'];var _0x6ece36=_0x3fea84?_0x3ebefa[_0x4e1d('0x2f')]:_0x380560[_0x4e1d('0x2c')]+_0x380560['limit'];var _0x336e43;if(_0x6ece36>=_0x44ca08){_0x6ece36=_0x44ca08;_0x336e43=0xc8;}else{_0x336e43=0xce;}_0x26473e[_0x4e1d('0x2a')](_0x336e43);return _0x26473e[_0x4e1d('0x30')]('Content-Range',_0x44e22d+'-'+_0x6ece36+'/'+_0x44ca08)[_0x4e1d('0x2b')](_0x3ebefa);}return null;};}function patchUpdates(_0x405aec){return function(_0x2dc017){try{jsonpatch['apply'](_0x2dc017,_0x405aec,!![]);}catch(_0x3a2cc3){return BPromise['reject'](_0x3a2cc3);}return _0x2dc017[_0x4e1d('0x31')]();};}function saveUpdates(_0x19ba7e,_0x511dec){return function(_0x13c921){if(_0x13c921){return _0x13c921['update'](_0x19ba7e)[_0x4e1d('0x32')](function(_0x3d38e5){return _0x3d38e5;});}return null;};}function removeEntity(_0x2557cf,_0x586cfd){return function(_0x54410f){if(_0x54410f){return _0x54410f[_0x4e1d('0x33')]()['then'](function(){var _0x4b67af=_0x54410f['get']({'plain':!![]});var _0x4f4008=_0x4e1d('0x34');return db[_0x4e1d('0x35')][_0x4e1d('0x33')]({'where':{'type':_0x4f4008,'resourceId':_0x4b67af['id']}})[_0x4e1d('0x32')](function(){return _0x54410f;});})[_0x4e1d('0x32')](function(){_0x2557cf[_0x4e1d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d803a,_0x41cda7){return function(_0x4dfec8){if(!_0x4dfec8){_0x5d803a[_0x4e1d('0x28')](0x194);}return _0x4dfec8;};}function handleError(_0x174b21,_0x14df09){_0x14df09=_0x14df09||0x1f4;return function(_0x331e26){logger[_0x4e1d('0x25')](_0x331e26['stack']);if(_0x331e26[_0x4e1d('0x36')]){delete _0x331e26[_0x4e1d('0x36')];}_0x174b21[_0x4e1d('0x2a')](_0x14df09)['send'](_0x331e26);};}exports['index']=function(_0x3629ed,_0x8def35){var _0x416ed8={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x25b284={},_0x289550={'count':0x0,'rows':[]};var _0x2ba7ef=_['map'](db[_0x4e1d('0x37')]['rawAttributes'],function(_0x207062){return{'name':_0x207062[_0x4e1d('0x38')],'type':_0x207062[_0x4e1d('0x39')][_0x4e1d('0x3a')]};});_0x25b284[_0x4e1d('0x3b')]=_[_0x4e1d('0x3c')](_0x2ba7ef,_0x4e1d('0x36'));_0x25b284[_0x4e1d('0x3d')]=_[_0x4e1d('0x3e')](_0x3629ed['query']);_0x25b284['filters']=_[_0x4e1d('0x3f')](_0x25b284[_0x4e1d('0x3b')],_0x25b284[_0x4e1d('0x3d')]);_0x416ed8[_0x4e1d('0x40')]=_[_0x4e1d('0x3f')](_0x25b284[_0x4e1d('0x3b')],qs[_0x4e1d('0x41')](_0x3629ed[_0x4e1d('0x3d')][_0x4e1d('0x41')]));_0x416ed8['attributes']=_0x416ed8[_0x4e1d('0x40')][_0x4e1d('0x42')]?_0x416ed8[_0x4e1d('0x40')]:_0x25b284['model'];if(!_0x3629ed[_0x4e1d('0x3d')][_0x4e1d('0x43')](_0x4e1d('0x44'))){_0x416ed8[_0x4e1d('0x2e')]=qs[_0x4e1d('0x2e')](_0x3629ed[_0x4e1d('0x3d')][_0x4e1d('0x2e')]);_0x416ed8[_0x4e1d('0x2c')]=qs[_0x4e1d('0x2c')](_0x3629ed[_0x4e1d('0x3d')]['offset']);}_0x416ed8[_0x4e1d('0x45')]=qs['sort'](_0x3629ed['query']['sort']);_0x416ed8[_0x4e1d('0x46')]=qs[_0x4e1d('0x47')](_[_0x4e1d('0x48')](_0x3629ed['query'],_0x25b284[_0x4e1d('0x47')]),_0x2ba7ef);if(_0x3629ed[_0x4e1d('0x3d')][_0x4e1d('0x49')]){_0x416ed8[_0x4e1d('0x46')]=_[_0x4e1d('0x4a')](_0x416ed8[_0x4e1d('0x46')],{'$or':_[_0x4e1d('0x3c')](_0x2ba7ef,function(_0xdc33bb){if(_0xdc33bb[_0x4e1d('0x39')]!==_0x4e1d('0x4b')){var _0x47a8ad={};_0x47a8ad[_0xdc33bb[_0x4e1d('0x36')]]={'$like':'%'+_0x3629ed[_0x4e1d('0x3d')][_0x4e1d('0x49')]+'%'};return _0x47a8ad;}})});}_0x416ed8=_[_0x4e1d('0x4a')]({},_0x416ed8,_0x3629ed['options']);var _0x836915={'where':_0x416ed8['where']};return db[_0x4e1d('0x37')][_0x4e1d('0x2f')](_0x836915)['then'](function(_0x263b51){_0x289550[_0x4e1d('0x2f')]=_0x263b51;if(_0x3629ed['query'][_0x4e1d('0x4c')]){_0x416ed8[_0x4e1d('0x4d')]=[{'all':!![]}];}return db[_0x4e1d('0x37')]['findAll'](_0x416ed8);})[_0x4e1d('0x32')](function(_0x519a62){_0x289550[_0x4e1d('0x4e')]=_0x519a62;return _0x289550;})[_0x4e1d('0x32')](respondWithFilteredResult(_0x8def35,_0x416ed8))['catch'](handleError(_0x8def35,null));};exports[_0x4e1d('0x4f')]=function(_0x264723,_0x3e8d71){var _0x1211b4={'raw':![],'where':{'id':_0x264723[_0x4e1d('0x50')]['id']},'include':[{'model':db[_0x4e1d('0x51')],'as':_0x4e1d('0x52')}]},_0x866f30={};_0x866f30[_0x4e1d('0x3b')]=_[_0x4e1d('0x3e')](db[_0x4e1d('0x37')][_0x4e1d('0x53')]);_0x866f30[_0x4e1d('0x3d')]=_['keys'](_0x264723[_0x4e1d('0x3d')]);_0x866f30[_0x4e1d('0x47')]=_['intersection'](_0x866f30[_0x4e1d('0x3b')],_0x866f30[_0x4e1d('0x3d')]);_0x1211b4[_0x4e1d('0x40')]=_[_0x4e1d('0x3f')](_0x866f30[_0x4e1d('0x3b')],qs['fields'](_0x264723['query'][_0x4e1d('0x41')]));_0x1211b4[_0x4e1d('0x40')]=_0x1211b4[_0x4e1d('0x40')]['length']?_0x1211b4[_0x4e1d('0x40')]:_0x866f30[_0x4e1d('0x3b')];if(_0x264723[_0x4e1d('0x3d')][_0x4e1d('0x4c')]){_0x1211b4[_0x4e1d('0x4d')]=[{'all':!![]}];}_0x1211b4=_[_0x4e1d('0x4a')]({},_0x1211b4,_0x264723[_0x4e1d('0x54')]);return db['SmsAccount']['find'](_0x1211b4)['then'](handleEntityNotFound(_0x3e8d71,null))['then'](respondWithResult(_0x3e8d71,null))[_0x4e1d('0x55')](handleError(_0x3e8d71,null));};exports[_0x4e1d('0x56')]=function(_0x309840,_0xe1f6b){return db[_0x4e1d('0x37')][_0x4e1d('0x56')](_0x309840['body'],{})[_0x4e1d('0x32')](function(_0x21d501){var _0xcdb9e2=_0x309840[_0x4e1d('0x57')]['get']({'plain':!![]});if(!_0xcdb9e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcdb9e2[_0x4e1d('0x58')]===_0x4e1d('0x57')){var _0x36b894=_0x21d501[_0x4e1d('0x59')]({'plain':!![]});var _0x26be11=_0x4e1d('0x34');return db['UserProfileSection'][_0x4e1d('0x5a')]({'where':{'name':_0x26be11,'userProfileId':_0xcdb9e2[_0x4e1d('0x5b')]},'raw':!![]})['then'](function(_0x1c8bee){if(_0x1c8bee&&_0x1c8bee['autoAssociation']===0x0){return db[_0x4e1d('0x35')][_0x4e1d('0x56')]({'name':_0x36b894['name'],'resourceId':_0x36b894['id'],'type':_0x1c8bee[_0x4e1d('0x36')],'sectionId':_0x1c8bee['id']},{})['then'](function(){return _0x21d501;});}else{return _0x21d501;}})[_0x4e1d('0x55')](function(_0x4b7fb3){logger['error'](_0x4e1d('0x5c'),_0x4b7fb3);throw _0x4b7fb3;});}return _0x21d501;})[_0x4e1d('0x32')](respondWithResult(_0xe1f6b,0xc9))[_0x4e1d('0x55')](handleError(_0xe1f6b,null));};exports[_0x4e1d('0x5d')]=function(_0x47f8e8,_0x3a4a10){if(_0x47f8e8['body']['id']){delete _0x47f8e8['body']['id'];}return db[_0x4e1d('0x37')][_0x4e1d('0x5a')]({'where':{'id':_0x47f8e8['params']['id']},'include':[{'model':db[_0x4e1d('0x51')],'as':_0x4e1d('0x52')}]})[_0x4e1d('0x32')](handleEntityNotFound(_0x3a4a10,null))['then'](saveUpdates(_0x47f8e8[_0x4e1d('0x5e')],null))['then'](respondWithResult(_0x3a4a10,null))[_0x4e1d('0x55')](handleError(_0x3a4a10,null));};exports[_0x4e1d('0x33')]=function(_0x4c9abd,_0x2154c2){return db[_0x4e1d('0x37')][_0x4e1d('0x5a')]({'where':{'id':_0x4c9abd[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x2154c2,null))['then'](removeEntity(_0x2154c2,null))[_0x4e1d('0x55')](handleError(_0x2154c2,null));};exports[_0x4e1d('0x5f')]=function(_0x1d7fcc,_0x21fa60){return db[_0x4e1d('0x37')][_0x4e1d('0x5f')]()[_0x4e1d('0x32')](respondWithResult(_0x21fa60,null))['catch'](handleError(_0x21fa60,null));};exports[_0x4e1d('0x60')]=function(_0x5413c5,_0x508cfe,_0x592c1c){if(_0x5413c5['body']['id']){delete _0x5413c5[_0x4e1d('0x5e')]['id'];}return db[_0x4e1d('0x37')]['find']({'where':{'id':_0x5413c5['params']['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x508cfe,null))[_0x4e1d('0x32')](function(_0xa9467c){if(_0xa9467c){_0x5413c5[_0x4e1d('0x5e')][_0x4e1d('0x61')]=_0xa9467c['id'];return db[_0x4e1d('0x62')]['create'](_0x5413c5[_0x4e1d('0x5e')]);}})[_0x4e1d('0x32')](respondWithResult(_0x508cfe,null))['catch'](handleError(_0x508cfe,null));};exports[_0x4e1d('0x63')]=function(_0x3295e7,_0x19d941,_0x1377cf){var _0xc6d96={'raw':![],'where':{}};var _0x20dcbf={};var _0x3de44d={'count':0x0,'rows':[]};return db[_0x4e1d('0x37')][_0x4e1d('0x64')]({'where':{'id':_0x3295e7[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x19d941,null))[_0x4e1d('0x32')](function(_0x2e1213){if(_0x2e1213){_0x20dcbf['model']=_[_0x4e1d('0x3e')](db[_0x4e1d('0x62')][_0x4e1d('0x53')]);_0x20dcbf[_0x4e1d('0x3d')]=_[_0x4e1d('0x3e')](_0x3295e7[_0x4e1d('0x3d')]);_0x20dcbf[_0x4e1d('0x47')]=_[_0x4e1d('0x3f')](_0x20dcbf['model'],_0x20dcbf[_0x4e1d('0x3d')]);_0xc6d96['attributes']=_[_0x4e1d('0x3f')](_0x20dcbf[_0x4e1d('0x3b')],qs[_0x4e1d('0x41')](_0x3295e7[_0x4e1d('0x3d')]['fields']));_0xc6d96[_0x4e1d('0x40')]=_0xc6d96[_0x4e1d('0x40')][_0x4e1d('0x42')]?_0xc6d96[_0x4e1d('0x40')]:_0x20dcbf[_0x4e1d('0x3b')];if(!_0x3295e7[_0x4e1d('0x3d')][_0x4e1d('0x43')](_0x4e1d('0x44'))){_0xc6d96[_0x4e1d('0x2e')]=qs['limit'](_0x3295e7[_0x4e1d('0x3d')][_0x4e1d('0x2e')]);_0xc6d96[_0x4e1d('0x2c')]=qs[_0x4e1d('0x2c')](_0x3295e7[_0x4e1d('0x3d')][_0x4e1d('0x2c')]);}_0xc6d96[_0x4e1d('0x45')]=qs[_0x4e1d('0x65')](_0x3295e7[_0x4e1d('0x3d')]['sort']);_0xc6d96[_0x4e1d('0x46')]=qs[_0x4e1d('0x47')](_['pick'](_0x3295e7[_0x4e1d('0x3d')],_0x20dcbf[_0x4e1d('0x47')]));_0xc6d96[_0x4e1d('0x46')][_0x4e1d('0x61')]=_0x2e1213['id'];if(_0x3295e7[_0x4e1d('0x3d')]['filter']){_0xc6d96[_0x4e1d('0x46')]=_[_0x4e1d('0x4a')](_0xc6d96[_0x4e1d('0x46')],{'$or':_[_0x4e1d('0x3c')](_0xc6d96[_0x4e1d('0x40')],function(_0x4434af){var _0xf1fa0a={};_0xf1fa0a[_0x4434af]={'$like':'%'+_0x3295e7[_0x4e1d('0x3d')]['filter']+'%'};return _0xf1fa0a;})});}_0xc6d96=_['merge']({},_0xc6d96,_0x3295e7[_0x4e1d('0x54')]);return db[_0x4e1d('0x62')][_0x4e1d('0x2f')]({'where':_0xc6d96[_0x4e1d('0x46')]})[_0x4e1d('0x32')](function(_0x126c7c){_0x3de44d['count']=_0x126c7c;if(_0x3295e7['query'][_0x4e1d('0x4c')]){_0xc6d96[_0x4e1d('0x4d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xc6d96);})['then'](function(_0xd93d23){_0x3de44d[_0x4e1d('0x4e')]=_0xd93d23;return _0x3de44d;});}})[_0x4e1d('0x32')](respondWithFilteredResult(_0x19d941,_0xc6d96))[_0x4e1d('0x55')](handleError(_0x19d941,null));};exports[_0x4e1d('0x66')]=function(_0x28d4f1,_0x45c01b,_0x44bc73){return db[_0x4e1d('0x37')]['find']({'where':{'id':_0x28d4f1[_0x4e1d('0x50')]['id']}})['then'](handleEntityNotFound(_0x45c01b,null))[_0x4e1d('0x32')](function(_0xce05a5){if(_0xce05a5){return _0xce05a5[_0x4e1d('0x66')](_0x28d4f1[_0x4e1d('0x3d')][_0x4e1d('0x67')]);}})['then'](respondWithStatusCode(_0x45c01b,null))[_0x4e1d('0x55')](handleError(_0x45c01b,null));};exports['addAnswer']=function(_0x2efa05,_0x2242c9,_0x2f3e5a){if(_0x2efa05[_0x4e1d('0x5e')]['id']){delete _0x2efa05['body']['id'];}return db[_0x4e1d('0x37')][_0x4e1d('0x5a')]({'where':{'id':_0x2efa05[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x2242c9,null))[_0x4e1d('0x32')](function(_0x2e3bf4){if(_0x2e3bf4){_0x2efa05['body'][_0x4e1d('0x61')]=_0x2e3bf4['id'];return db[_0x4e1d('0x68')][_0x4e1d('0x56')](_0x2efa05[_0x4e1d('0x5e')]);}})['then'](respondWithResult(_0x2242c9,null))['catch'](handleError(_0x2242c9,null));};exports[_0x4e1d('0x69')]=function(_0x4870f4,_0x6f727,_0x5dc35f){var _0x1f4000={'raw':![],'where':{}};var _0x22f957={};var _0xbcd073={'count':0x0,'rows':[]};return db[_0x4e1d('0x37')][_0x4e1d('0x64')]({'where':{'id':_0x4870f4['params']['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x6f727,null))[_0x4e1d('0x32')](function(_0x1a6809){if(_0x1a6809){_0x22f957[_0x4e1d('0x3b')]=_[_0x4e1d('0x3e')](db[_0x4e1d('0x68')][_0x4e1d('0x53')]);_0x22f957[_0x4e1d('0x3d')]=_[_0x4e1d('0x3e')](_0x4870f4[_0x4e1d('0x3d')]);_0x22f957[_0x4e1d('0x47')]=_[_0x4e1d('0x3f')](_0x22f957[_0x4e1d('0x3b')],_0x22f957[_0x4e1d('0x3d')]);_0x1f4000[_0x4e1d('0x40')]=_[_0x4e1d('0x3f')](_0x22f957[_0x4e1d('0x3b')],qs['fields'](_0x4870f4['query'][_0x4e1d('0x41')]));_0x1f4000['attributes']=_0x1f4000[_0x4e1d('0x40')][_0x4e1d('0x42')]?_0x1f4000['attributes']:_0x22f957[_0x4e1d('0x3b')];if(!_0x4870f4[_0x4e1d('0x3d')][_0x4e1d('0x43')](_0x4e1d('0x44'))){_0x1f4000[_0x4e1d('0x2e')]=qs[_0x4e1d('0x2e')](_0x4870f4[_0x4e1d('0x3d')][_0x4e1d('0x2e')]);_0x1f4000[_0x4e1d('0x2c')]=qs[_0x4e1d('0x2c')](_0x4870f4['query'][_0x4e1d('0x2c')]);}_0x1f4000[_0x4e1d('0x45')]=qs[_0x4e1d('0x65')](_0x4870f4[_0x4e1d('0x3d')][_0x4e1d('0x65')]);_0x1f4000[_0x4e1d('0x46')]=qs[_0x4e1d('0x47')](_[_0x4e1d('0x48')](_0x4870f4[_0x4e1d('0x3d')],_0x22f957[_0x4e1d('0x47')]));_0x1f4000['where']['SmsAccountId']=_0x1a6809['id'];if(_0x4870f4[_0x4e1d('0x3d')][_0x4e1d('0x49')]){_0x1f4000[_0x4e1d('0x46')]=_['merge'](_0x1f4000[_0x4e1d('0x46')],{'$or':_['map'](_0x1f4000[_0x4e1d('0x40')],function(_0x10cf2d){var _0x52c2d4={};_0x52c2d4[_0x10cf2d]={'$like':'%'+_0x4870f4[_0x4e1d('0x3d')][_0x4e1d('0x49')]+'%'};return _0x52c2d4;})});}_0x1f4000=_[_0x4e1d('0x4a')]({},_0x1f4000,_0x4870f4[_0x4e1d('0x54')]);return db[_0x4e1d('0x68')][_0x4e1d('0x2f')]({'where':_0x1f4000[_0x4e1d('0x46')]})[_0x4e1d('0x32')](function(_0x2a6759){_0xbcd073['count']=_0x2a6759;if(_0x4870f4['query'][_0x4e1d('0x4c')]){_0x1f4000[_0x4e1d('0x4d')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4e1d('0x6a')](_0x1f4000);})['then'](function(_0x490f98){_0xbcd073['rows']=_0x490f98;return _0xbcd073;});}})['then'](respondWithFilteredResult(_0x6f727,_0x1f4000))['catch'](handleError(_0x6f727,null));};exports[_0x4e1d('0x6b')]=function(_0x12cb77,_0x4db260,_0x5da907){return db[_0x4e1d('0x37')]['find']({'where':{'id':_0x12cb77[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x4db260,null))['then'](function(_0x563476){if(_0x563476){return _0x563476['removeAnswers'](_0x12cb77['query'][_0x4e1d('0x67')]);}})[_0x4e1d('0x32')](respondWithStatusCode(_0x4db260,null))[_0x4e1d('0x55')](handleError(_0x4db260,null));};exports['notify']=function(_0x5ac2d9,_0x2d1942,_0x522319){var _0x4efda0={'channel':_0x4e1d('0x6c')};var _0x6c96ca=[];var _0x1ea43a=[];var _0x13284a={};return db['SmsAccount'][_0x4e1d('0x5a')]({'where':{'id':_0x5ac2d9['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x4e1d('0x6d')}]})['then'](handleEntityNotFound(_0x2d1942,null))[_0x4e1d('0x32')](function(_0x3f7e5d){_0x4efda0[_0x4e1d('0x6e')]=_0x3f7e5d;_0x4efda0['applications']=_[_0x4e1d('0x6f')](_0x3f7e5d[_0x4e1d('0x6d')],[_0x4e1d('0x70')],[_0x4e1d('0x71')]);if(_0x4efda0[_0x4e1d('0x6e')][_0x4e1d('0x6d')]){delete _0x4efda0['account'][_0x4e1d('0x6d')];}return db['CmContact'][_0x4e1d('0x5f')]();})[_0x4e1d('0x32')](function(_0x55bd2f){if(!_0x55bd2f){throw new db['Sequelize'][(_0x4e1d('0x72'))](_0x4e1d('0x73'));}_0x6c96ca=_[_0x4e1d('0x74')](_['keys'](_0x55bd2f),[_0x4e1d('0x75'),_0x4e1d('0x76')]);_0x1ea43a=_['difference'](_[_0x4e1d('0x3e')](_0x55bd2f),[_0x4e1d('0x75'),_0x4e1d('0x76'),'CompanyId','ListId']);_0x4efda0[_0x4e1d('0x5e')]={'mapKey':_0x4e1d('0x77')};if(_0x4efda0[_0x4e1d('0x6e')][_0x4e1d('0x39')]){switch(_0x4efda0['account'][_0x4e1d('0x39')]){case'twilio':_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x79')];_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x5e')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x7a')];_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x7b')]=_0x5ac2d9['body'][_0x4e1d('0x7c')];break;case _0x4e1d('0x7d'):_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')]='+'+_0x5ac2d9[_0x4e1d('0x5e')]['sender'];_0x4efda0['body'][_0x4e1d('0x5e')]=_0x5ac2d9[_0x4e1d('0x5e')]['text'];break;case _0x4e1d('0x7e'):_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')]=_0x5ac2d9[_0x4e1d('0x5e')]['from'];_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x5e')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x27')];break;case'clicksend':_0x4efda0['body'][_0x4e1d('0x78')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x78')];_0x4efda0[_0x4e1d('0x5e')]['body']=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x5e')];_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x7b')]=_0x5ac2d9[_0x4e1d('0x5e')]['message_id'];break;case'plivo':_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')]=_0x5ac2d9['body'][_0x4e1d('0x79')];_0x4efda0[_0x4e1d('0x5e')]['body']=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x7f')];_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x7b')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x80')];break;case _0x4e1d('0x81'):_0x4efda0['body'][_0x4e1d('0x78')]='+'+_0x5ac2d9['body'][_0x4e1d('0x82')][0x0]['from'];_0x4efda0['body'][_0x4e1d('0x5e')]=_0x5ac2d9[_0x4e1d('0x5e')]['results'][0x0][_0x4e1d('0x83')];_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x7b')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x82')][0x0][_0x4e1d('0x7b')];break;case _0x4e1d('0x84'):_0x4efda0['body']['from']=_0x5ac2d9[_0x4e1d('0x5e')]['originatingAddress'];_0x4efda0['body'][_0x4e1d('0x5e')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x85')][_0x4e1d('0x27')];break;case _0x4e1d('0x86'):_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x87')];_0x4efda0['body']['body']=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x83')];_0x4efda0['body'][_0x4e1d('0x7b')]=_0x5ac2d9[_0x4e1d('0x5e')][_0x4e1d('0x88')];break;case _0x4e1d('0x89'):_0x4efda0['body']['messageId']=_0x5ac2d9[_0x4e1d('0x5e')][0x0][_0x4e1d('0x27')]['id'];_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')]=_0x5ac2d9['body'][0x0][_0x4e1d('0x27')][_0x4e1d('0x78')];_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x5e')]=_0x5ac2d9[_0x4e1d('0x5e')][0x0][_0x4e1d('0x27')][_0x4e1d('0x83')];break;case _0x4e1d('0x8a'):_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')]=_0x5ac2d9[_0x4e1d('0x5e')]['from'];_0x4efda0['body'][_0x4e1d('0x5e')]=_0x5ac2d9['body']['message'];_0x4efda0[_0x4e1d('0x5e')]['messageId']=_0x5ac2d9[_0x4e1d('0x5e')]['refid'];break;}}if(_0x4efda0[_0x4e1d('0x5e')]['id']){delete _0x4efda0['body']['id'];}if(_[_0x4e1d('0x8b')](_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')])){throw new db[(_0x4e1d('0x8c'))][(_0x4e1d('0x72'))](_0x4e1d('0x8d'));}if(_[_0x4e1d('0x8b')](_0x4efda0[_0x4e1d('0x5e')]['body'])||_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x5e')]===''){throw new db[(_0x4e1d('0x8c'))]['ValidationError'](_0x4e1d('0x8e'));}if(_[_0x4e1d('0x8b')](_0x4efda0[_0x4e1d('0x5e')]['mapKey'])){throw new db[(_0x4e1d('0x8c'))]['ValidationError'](_0x4e1d('0x8f')+_0x1ea43a);}if(!_[_0x4e1d('0x90')](_0x1ea43a,_0x4efda0['body']['mapKey'])){throw new db['Sequelize'][(_0x4e1d('0x72'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ea43a);}_0x13284a[_0x4efda0['body'][_0x4e1d('0x91')]]=_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')];return db['CmList'][_0x4e1d('0x5a')]({'where':{'id':_0x4efda0[_0x4e1d('0x6e')][_0x4e1d('0x92')]},'include':[{'model':db[_0x4e1d('0x93')],'as':'Contacts','where':_0x13284a,'limit':0x1,'order':[[_0x4e1d('0x76'),'DESC']]}]});})[_0x4e1d('0x32')](handleEntityNotFound(_0x2d1942,null))[_0x4e1d('0x32')](function(_0x30733d){if(_0x30733d){_0x4efda0[_0x4e1d('0x94')]=_[_0x4e1d('0x95')](_0x30733d,[_0x4e1d('0x96')]);if(_0x30733d[_0x4e1d('0x96')][_0x4e1d('0x42')]){return _0x30733d['Contacts'][0x0];}var _0x38f6b1=_[_0x4e1d('0x97')](_0x4efda0[_0x4e1d('0x5e')],{'firstName':_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x78')],'ListId':_0x30733d['id']});_0x38f6b1[_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x91')]]=_0x4efda0['body'][_0x4e1d('0x78')];return db[_0x4e1d('0x93')][_0x4e1d('0x56')](_0x38f6b1,{'fields':_0x6c96ca,'raw':!![]});}})['then'](handleEntityNotFound(_0x2d1942,null))[_0x4e1d('0x32')](function(_0x2b828e){if(_0x2b828e){_0x4efda0[_0x4e1d('0x98')]=_0x2b828e;var _0x4c0638={'ContactId':_0x2b828e['id'],'phone':_0x4efda0[_0x4e1d('0x5e')]['from'],'SmsAccountId':_0x5ac2d9['params']['id']};var _0x3aed37={'ContactId':_0x2b828e['id'],'SmsAccountId':_0x5ac2d9['params']['id'],'closed':![]};return db[_0x4e1d('0x99')][_0x4e1d('0x5a')]({'where':_0x3aed37})[_0x4e1d('0x32')](function(_0xa75267){if(_0xa75267){return[_0xa75267,![]];}return db[_0x4e1d('0x99')][_0x4e1d('0x56')](_0x4c0638)[_0x4e1d('0x32')](function(_0x45c507){return[_0x45c507,!![]];});});}})[_0x4e1d('0x9a')](function(_0x14fc68,_0x460337){_0x4efda0[_0x4e1d('0x9b')]=_0x14fc68['get']({'plain':!![]});_0x4efda0['interaction'][_0x4e1d('0x9c')]=![];if(_0x460337){if(_0x4efda0[_0x4e1d('0x6e')]['autoclose']){_0x4efda0[_0x4e1d('0x9d')][_0x4e1d('0x9e')]({'id':0x0,'priority':_0x4efda0[_0x4e1d('0x9d')][_0x4e1d('0x42')]+0x1,'app':_0x4e1d('0x9f'),'appdata':_0x4e1d('0xa0'),'interval':_0x4e1d('0xa1')});}_0x4efda0[_0x4e1d('0x9b')][_0x4e1d('0x9c')]=!![];}return db[_0x4e1d('0xa2')]['create']({'phone':_0x4efda0['body'][_0x4e1d('0x78')],'messageId':_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x7b')],'body':_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0x5e')],'SmsAccountId':_0x5ac2d9['params']['id'],'SmsInteractionId':_0x14fc68['id'],'direction':'in','ContactId':_0x14fc68[_0x4e1d('0xa3')],'AttachmentId':_0x4efda0[_0x4e1d('0x5e')][_0x4e1d('0xa4')]});})['then'](function(_0x170cc0){_0x4efda0[_0x4e1d('0x27')]=_0x170cc0;if(_0x4efda0[_0x4e1d('0x9b')][_0x4e1d('0xa5')]){return db[_0x4e1d('0xa6')][_0x4e1d('0x5a')]({'attributes':['id',_0x4e1d('0x36')],'where':{'id':_0x4efda0[_0x4e1d('0x9b')][_0x4e1d('0xa5')]}})['then'](function(_0x9063a){if(_0x9063a){_0x4efda0[_0x4e1d('0x9d')][_0x4e1d('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x9063a[_0x4e1d('0x36')]+','+(_0x4efda0[_0x4e1d('0x6e')][_0x4e1d('0xa8')]||0xa),'interval':_0x4e1d('0xa1')});}return respondWithRpcPromise('Start','startRouting',_0x4efda0);});}return respondWithRpcPromise(_0x4e1d('0xa9'),_0x4e1d('0xaa'),_0x4efda0);})['then'](function(_0x48e261){if(_0x48e261){var _0x2d7437=0xc8;var _0x15fbde=_0x4e1d('0xab');logger['info'](_0x4e1d('0x23'),_0x15fbde,_0x2d7437,_0x4e1d('0xac'));logger[_0x4e1d('0x22')](_0x4e1d('0xad'),_0x15fbde,_0x2d7437,_0x4e1d('0xac'),JSON[_0x4e1d('0x24')](_0x48e261));if(_0x4efda0[_0x4e1d('0x6e')][_0x4e1d('0x39')]===_0x4e1d('0xae')){return _0x2d1942[_0x4e1d('0x2a')](_0x2d7437)[_0x4e1d('0x30')]('Content-Type','text/xml')[_0x4e1d('0xaf')]('\x0a');}else{return _0x2d1942[_0x4e1d('0x2a')](_0x2d7437)[_0x4e1d('0x2b')](_0x48e261);}}})[_0x4e1d('0x55')](handleError(_0x2d1942,null));};exports[_0x4e1d('0xb0')]=function(_0x1590bb,_0x540d02){var _0x89c7d4=_0x1590bb[_0x4e1d('0x50')]['id'];var _0x4774e1=_0x1590bb[_0x4e1d('0x5e')];var _0x260481=0xc8;var _0x3027f0=null;return db[_0x4e1d('0xb1')]['transaction']({'isolationLevel':db[_0x4e1d('0xb1')][_0x4e1d('0xb2')][_0x4e1d('0xb3')][_0x4e1d('0xb4')]},function(_0x365c96){return db['SmsAccount']['findOne']({'where':{'id':_0x89c7d4},'transaction':_0x365c96})[_0x4e1d('0x32')](function(_0x46883d){if(_0x46883d){return db['SmsApplication'][_0x4e1d('0x33')]({'where':{'SmsAccountId':_0x89c7d4},'transaction':_0x365c96})[_0x4e1d('0x32')](function(){var _0x33612d=_[_0x4e1d('0x3c')](_0x4774e1,function(_0x3eb28c){_0x3eb28c[_0x4e1d('0x61')]=_0x89c7d4;return _0x3eb28c;});return db['SmsApplication'][_0x4e1d('0xb5')](_0x33612d,{'transaction':_0x365c96});});}else{_0x260481=0x194;_0x3027f0=[];}});})[_0x4e1d('0x32')](function(){if(_0x260481!==0x194){return db[_0x4e1d('0xb6')]['findAndCountAll']({'where':{'SmsAccountId':_0x89c7d4},'order':'priority'})[_0x4e1d('0x32')](function(_0x4a401b){_0x3027f0=_0x4a401b;});}})[_0x4e1d('0x55')](function(_0x3ac14d){_0x260481=0x1f4;logger[_0x4e1d('0x25')](_0x3ac14d[_0x4e1d('0xb7')]);if(_0x3ac14d[_0x4e1d('0x36')]){delete _0x3ac14d[_0x4e1d('0x36')];}_0x3027f0=_0x3ac14d;})[_0x4e1d('0xb8')](function(){if(_0x3027f0===null){_0x540d02['sendStatus'](_0x260481);}else{if(_0x260481===0x1f4){_0x540d02[_0x4e1d('0x2a')](_0x260481)[_0x4e1d('0xaf')](_0x3027f0);}else{_0x540d02[_0x4e1d('0x2a')](_0x260481)[_0x4e1d('0x2b')](_0x3027f0);}}});};exports[_0x4e1d('0xb9')]=function(_0x32e167,_0x573508,_0xc516a8){var _0x138b12={};var _0x5c7d14={};var _0xf1f478;var _0x32b401;return db[_0x4e1d('0x37')][_0x4e1d('0x64')]({'where':{'id':_0x32e167[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x573508,null))[_0x4e1d('0x32')](function(_0x4fe276){if(_0x4fe276){_0xf1f478=_0x4fe276;_0x5c7d14[_0x4e1d('0x3b')]=_['keys'](db['SmsApplication'][_0x4e1d('0x53')]);_0x5c7d14['query']=_[_0x4e1d('0x3e')](_0x32e167[_0x4e1d('0x3d')]);_0x5c7d14[_0x4e1d('0x47')]=_[_0x4e1d('0x3f')](_0x5c7d14[_0x4e1d('0x3b')],_0x5c7d14[_0x4e1d('0x3d')]);_0x138b12[_0x4e1d('0x40')]=_[_0x4e1d('0x3f')](_0x5c7d14[_0x4e1d('0x3b')],qs[_0x4e1d('0x41')](_0x32e167[_0x4e1d('0x3d')]['fields']));_0x138b12[_0x4e1d('0x40')]=_0x138b12[_0x4e1d('0x40')][_0x4e1d('0x42')]?_0x138b12[_0x4e1d('0x40')]:_0x5c7d14[_0x4e1d('0x3b')];_0x138b12[_0x4e1d('0x45')]=qs[_0x4e1d('0x65')](_0x32e167[_0x4e1d('0x3d')][_0x4e1d('0x65')]);_0x138b12['where']=qs[_0x4e1d('0x47')](_['pick'](_0x32e167[_0x4e1d('0x3d')],_0x5c7d14['filters']));if(_0x32e167[_0x4e1d('0x3d')][_0x4e1d('0x49')]){_0x138b12[_0x4e1d('0x46')]=_['merge'](_0x138b12[_0x4e1d('0x46')],{'$or':_[_0x4e1d('0x3c')](_0x138b12['attributes'],function(_0x31c2a9){var _0x3247bc={};_0x3247bc[_0x31c2a9]={'$like':'%'+_0x32e167[_0x4e1d('0x3d')][_0x4e1d('0x49')]+'%'};return _0x3247bc;})});}_0x138b12=_[_0x4e1d('0x4a')]({},_0x138b12,_0x32e167[_0x4e1d('0x54')]);return _0xf1f478[_0x4e1d('0xb9')](_0x138b12);}})[_0x4e1d('0x32')](function(_0x2eadf9){if(_0x2eadf9){_0x32b401=_0x2eadf9[_0x4e1d('0x42')];if(!_0x32e167[_0x4e1d('0x3d')][_0x4e1d('0x43')](_0x4e1d('0x44'))){_0x138b12[_0x4e1d('0x2e')]=qs[_0x4e1d('0x2e')](_0x32e167[_0x4e1d('0x3d')]['limit']);_0x138b12[_0x4e1d('0x2c')]=qs[_0x4e1d('0x2c')](_0x32e167[_0x4e1d('0x3d')][_0x4e1d('0x2c')]);}return _0xf1f478['getApplications'](_0x138b12);}})['then'](function(_0xec1288){if(_0xec1288){return _0xec1288?{'count':_0x32b401,'rows':_0xec1288}:null;}})['then'](respondWithResult(_0x573508,null))[_0x4e1d('0x55')](handleError(_0x573508,null));};exports[_0x4e1d('0xba')]=function(_0x5689fd,_0x42d38c,_0x2559f5){var _0x38f86e={'raw':![],'where':{}};var _0x4af01d={};var _0x49a6b7={'count':0x0,'rows':[]};return db[_0x4e1d('0x37')][_0x4e1d('0x64')]({'where':{'id':_0x5689fd[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x42d38c,null))[_0x4e1d('0x32')](function(_0x1bb1b6){if(_0x1bb1b6){_0x4af01d[_0x4e1d('0x3b')]=_['keys'](db[_0x4e1d('0x99')]['rawAttributes']);_0x4af01d['query']=_[_0x4e1d('0x3e')](_0x5689fd[_0x4e1d('0x3d')]);_0x4af01d[_0x4e1d('0x47')]=_[_0x4e1d('0x3f')](_0x4af01d[_0x4e1d('0x3b')],_0x4af01d['query']);_0x38f86e[_0x4e1d('0x40')]=_[_0x4e1d('0x3f')](_0x4af01d['model'],qs['fields'](_0x5689fd['query'][_0x4e1d('0x41')]));_0x38f86e[_0x4e1d('0x40')]=_0x38f86e[_0x4e1d('0x40')][_0x4e1d('0x42')]?_0x38f86e[_0x4e1d('0x40')]:_0x4af01d[_0x4e1d('0x3b')];if(!_0x5689fd[_0x4e1d('0x3d')]['hasOwnProperty'](_0x4e1d('0x44'))){_0x38f86e['limit']=qs['limit'](_0x5689fd[_0x4e1d('0x3d')][_0x4e1d('0x2e')]);_0x38f86e[_0x4e1d('0x2c')]=qs[_0x4e1d('0x2c')](_0x5689fd[_0x4e1d('0x3d')][_0x4e1d('0x2c')]);}_0x38f86e[_0x4e1d('0x45')]=qs[_0x4e1d('0x65')](_0x5689fd[_0x4e1d('0x3d')][_0x4e1d('0x65')]);_0x38f86e[_0x4e1d('0x46')]=qs[_0x4e1d('0x47')](_[_0x4e1d('0x48')](_0x5689fd[_0x4e1d('0x3d')],_0x4af01d[_0x4e1d('0x47')]));_0x38f86e[_0x4e1d('0x46')][_0x4e1d('0x61')]=_0x1bb1b6['id'];if(_0x5689fd[_0x4e1d('0x3d')][_0x4e1d('0x49')]){_0x38f86e[_0x4e1d('0x46')]=_[_0x4e1d('0x4a')](_0x38f86e[_0x4e1d('0x46')],{'$or':_[_0x4e1d('0x3c')](_0x38f86e['attributes'],function(_0x4afad0){var _0x32d8f1={};_0x32d8f1[_0x4afad0]={'$like':'%'+_0x5689fd[_0x4e1d('0x3d')][_0x4e1d('0x49')]+'%'};return _0x32d8f1;})});}_0x38f86e=_[_0x4e1d('0x4a')]({},_0x38f86e,_0x5689fd['options']);return db[_0x4e1d('0x99')][_0x4e1d('0x2f')]({'where':_0x38f86e[_0x4e1d('0x46')]})[_0x4e1d('0x32')](function(_0x2149a9){_0x49a6b7['count']=_0x2149a9;if(_0x5689fd[_0x4e1d('0x3d')][_0x4e1d('0x4c')]){_0x38f86e[_0x4e1d('0x4d')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4e1d('0xa6')],'as':_0x4e1d('0xbb'),'attributes':[_0x4e1d('0x36'),_0x4e1d('0xbc'),_0x4e1d('0xbd')],'required':![]},{'model':db[_0x4e1d('0xbe')],'as':'Tags','attributes':['id','name','color'],'where':_0x5689fd['query'][_0x4e1d('0xbf')]?{'id':_0x5689fd[_0x4e1d('0x3d')][_0x4e1d('0xbf')]}:undefined,'required':_0x5689fd[_0x4e1d('0x3d')][_0x4e1d('0xbf')]?!![]:![]}];}return db[_0x4e1d('0x99')]['findAll'](_0x38f86e);})[_0x4e1d('0x32')](function(_0x5d1522){_0x49a6b7[_0x4e1d('0x4e')]=_0x5d1522;return _0x49a6b7;});}})['then'](respondWithFilteredResult(_0x42d38c,_0x38f86e))[_0x4e1d('0x55')](handleError(_0x42d38c,null));};exports['send']=function(_0x517859,_0x400af5,_0x4d80ab){var _0x1fb106,_0xa2eb64,_0x449cfd;if(_[_0x4e1d('0x8b')](_0x517859[_0x4e1d('0x5e')][_0x4e1d('0x5e')])||_0x517859[_0x4e1d('0x5e')][_0x4e1d('0x5e')]===''){throw new db[(_0x4e1d('0x8c'))][(_0x4e1d('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4e1d('0x8b')](_0x517859['body']['to'])){throw new db[(_0x4e1d('0x8c'))][(_0x4e1d('0x72'))](_0x4e1d('0xc0'));}_0x1fb106=_0x517859[_0x4e1d('0x5e')]['to'];return db[_0x4e1d('0x37')][_0x4e1d('0x5a')]({'where':{'id':_0x517859[_0x4e1d('0x50')]['id']},'include':[{'model':db[_0x4e1d('0xc1')],'as':_0x4e1d('0xc2'),'include':[{'model':db[_0x4e1d('0x93')],'as':_0x4e1d('0x96'),'where':{'mobile':_0x1fb106},'limit':0x1,'order':[['updatedAt',_0x4e1d('0xc3')]]}]}]})[_0x4e1d('0x32')](handleEntityNotFound(_0x400af5,null))[_0x4e1d('0x32')](function(_0x5b1fd7){if(_0x5b1fd7&&_0x5b1fd7[_0x4e1d('0xc2')]){_0xa2eb64=_0x5b1fd7[_0x4e1d('0x59')]({'plain':!![]});if(_0xa2eb64['List']&&_0xa2eb64[_0x4e1d('0xc2')][_0x4e1d('0x96')][_0x4e1d('0x42')]){return _0xa2eb64['List'][_0x4e1d('0x96')][0x0];}return db[_0x4e1d('0x93')][_0x4e1d('0x56')](_[_0x4e1d('0x97')](_0x517859[_0x4e1d('0x5e')],{'firstName':_0x1fb106,'mobile':_0x1fb106,'phone':_0x1fb106,'ListId':_0xa2eb64['ListId']}));}})[_0x4e1d('0x32')](handleEntityNotFound(_0x400af5,null))['then'](function(_0x3c46d8){if(_0x3c46d8){_0x449cfd=_0x3c46d8;return db[_0x4e1d('0x99')][_0x4e1d('0x5a')]({'where':{'ContactId':_0x449cfd['id'],'closed':![],'SmsAccountId':_0xa2eb64['id']}})['then'](function(_0x1dddfb){if(_0x1dddfb){return[_0x1dddfb,![]];}return db['SmsInteraction'][_0x4e1d('0x56')]({'UserId':_0x517859[_0x4e1d('0x57')]['id'],'ContactId':_0x449cfd['id'],'SmsAccountId':_0xa2eb64['id'],'phone':_0x1fb106,'firstMsgDirection':'out','Messages':[_[_0x4e1d('0x4a')](_0x517859[_0x4e1d('0x5e')],{'read':![],'body':_0x517859[_0x4e1d('0x5e')][_0x4e1d('0x5e')],'phone':_0x1fb106,'SmsAccountId':_0xa2eb64['id'],'UserId':_0x517859[_0x4e1d('0x57')]['id'],'ContactId':_0x449cfd['id']})]},{'include':[{'model':db[_0x4e1d('0xa2')],'as':_0x4e1d('0xc4')}]})[_0x4e1d('0x32')](function(_0x118fb3){return[_0x118fb3,!![]];});});}})[_0x4e1d('0x9a')](function(_0x1e66c1,_0x30a228){if(_0x30a228){return _0x1e66c1;}return db['SmsMessage'][_0x4e1d('0x56')](_[_0x4e1d('0x4a')](_0x517859[_0x4e1d('0x5e')],{'read':![],'body':_0x517859[_0x4e1d('0x5e')][_0x4e1d('0x5e')],'phone':_0x1fb106,'SmsAccountId':_0xa2eb64['id'],'SmsInteractionId':_0x1e66c1['id'],'UserId':_0x517859[_0x4e1d('0x57')]['id'],'ContactId':_0x449cfd['id']}))[_0x4e1d('0x32')](function(_0x2e1876){_0x1e66c1['dataValues']['Messages']=[];_0x1e66c1[_0x4e1d('0xc5')][_0x4e1d('0xc4')]['push'](_0x2e1876[_0x4e1d('0xc5')]);return _0x1e66c1;});})[_0x4e1d('0x32')](respondWithResult(_0x400af5,null))['catch'](handleError(_0x400af5,null));};exports['status']=function(_0x482532,_0x17273e,_0x1b3698){if(_0x482532['body']['id']){delete _0x482532['body']['id'];}var _0x331e45,_0x185702,_0xe2bb37;return db[_0x4e1d('0x37')][_0x4e1d('0x5a')]({'where':{'id':_0x482532['params']['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x17273e,null))[_0x4e1d('0x32')](function(_0x49ffbf){if(_0x49ffbf){_0xe2bb37=_0x49ffbf;logger[_0x4e1d('0x22')](_0x4e1d('0x23'),'status','received\x20delivery\x20report\x20from',_0x49ffbf[_0x4e1d('0x39')],util[_0x4e1d('0xc6')](_0x482532[_0x4e1d('0x5e')],{'showHidden':![],'depth':null}));switch(_0x49ffbf['type']){case _0x4e1d('0x7d'):if(_0x482532['body'][_0x4e1d('0xc7')]&&_0x482532[_0x4e1d('0x5e')]['status']){_0x185702=_0x482532['body']['status'];return db[_0x4e1d('0xa2')][_0x4e1d('0x5a')]({'where':{'messageId':_0x482532[_0x4e1d('0x5e')][_0x4e1d('0xc7')]}});}break;case'connectel':if(_0x482532[_0x4e1d('0x5e')][_0x4e1d('0xc8')]&&_0x482532[_0x4e1d('0x5e')][_0x4e1d('0xc9')]){_0x185702=_0x482532[_0x4e1d('0x5e')]['statusInt'];return db[_0x4e1d('0xa2')][_0x4e1d('0x5a')]({'where':{'messageId':_0x482532[_0x4e1d('0x5e')]['requestid']}});}break;case _0x4e1d('0xca'):if(_0x482532[_0x4e1d('0x5e')][_0x4e1d('0xcb')]&&_0x482532[_0x4e1d('0x5e')]['status_code']){_0x185702=_0x482532[_0x4e1d('0x5e')][_0x4e1d('0xcc')];return db[_0x4e1d('0xa2')]['find']({'where':{'messageId':_0x482532[_0x4e1d('0x5e')]['message_id']}});}break;case _0x4e1d('0x81'):var _0x3a057d=_0x482532['body']['results'][0x0];if(_0x3a057d[_0x4e1d('0x7b')]&&_0x3a057d[_0x4e1d('0x2a')][_0x4e1d('0xcd')]==='DELIVERED'){_0x185702=_0x3a057d[_0x4e1d('0x2a')][_0x4e1d('0xcd')];return db['SmsMessage']['find']({'where':{'messageId':_0x3a057d['messageId']}});}break;case _0x4e1d('0x86'):if(_0x482532[_0x4e1d('0x5e')]['messageId']&&_0x482532[_0x4e1d('0x5e')]['status']){_0x185702=_0x482532[_0x4e1d('0x5e')]['status'];return db[_0x4e1d('0xa2')][_0x4e1d('0x5a')]({'where':{'messageId':_0x482532['body'][_0x4e1d('0x7b')]}});}break;case _0x4e1d('0x89'):if(_0x482532[_0x4e1d('0x5e')][0x0][_0x4e1d('0x27')]['id']){_0x185702=_0x482532['body'][0x0][_0x4e1d('0x39')];return db['SmsMessage'][_0x4e1d('0x5a')]({'where':{'messageId':_0x482532['body'][0x0][_0x4e1d('0x27')]['id']}});}break;case _0x4e1d('0x8a'):if(_0x482532[_0x4e1d('0x5e')]['redif']&&_0x482532[_0x4e1d('0x5e')][_0x4e1d('0x2a')]){_0x185702=_0x482532[_0x4e1d('0x5e')][_0x4e1d('0x2a')];return db['SmsMessage'][_0x4e1d('0x5a')]({'where':{'messageId':_0x482532['body'][_0x4e1d('0xce')]}});}break;}}})[_0x4e1d('0x32')](handleEntityNotFound(_0x17273e,null))['then'](function(_0x56c7a2){if(_0x56c7a2){_0x331e45=_0x56c7a2;switch(_0xe2bb37[_0x4e1d('0x39')]){case'skebby':if(_0x185702===_0x4e1d('0xcf')){return _0x331e45[_0x4e1d('0x5d')]({'read':!![]});}else{logger[_0x4e1d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4e1d('0x2a'),_0x4e1d('0x7d'),util[_0x4e1d('0xc6')](_0x482532['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x185702==='1'){return _0x331e45[_0x4e1d('0x5d')]({'read':!![]});}else{logger[_0x4e1d('0x25')](_0x4e1d('0x23'),_0x4e1d('0x2a'),_0x4e1d('0x7d'),util[_0x4e1d('0xc6')](_0x482532[_0x4e1d('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x482532[_0x4e1d('0x5e')][_0x4e1d('0xd0')]&&_0x185702>=0xc8&&_0x185702<=0xce){return _0x331e45['update']({'read':!![]});}else{logger[_0x4e1d('0x25')](_0x4e1d('0x23'),_0x4e1d('0x2a'),_0x4e1d('0xca'),util[_0x4e1d('0xc6')](_0x482532[_0x4e1d('0x5e')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x564f36=_0x482532['body']['results'][0x0];if(_0x564f36[_0x4e1d('0x2a')][_0x4e1d('0xcd')]===_0x4e1d('0xcf')){return _0x331e45[_0x4e1d('0x5d')]({'read':!![]});}else{logger[_0x4e1d('0x25')](_0x4e1d('0x23'),_0x4e1d('0x2a'),_0x4e1d('0x81'),util[_0x4e1d('0xc6')](_0x482532['body'],{'showHidden':![],'depth':null}));}break;case _0x4e1d('0x86'):if(_0x185702=='DELIVERED_TO_GATEWAY'||_0x185702==_0x4e1d('0xd1')){return _0x331e45[_0x4e1d('0x5d')]({'read':!![]});}else{logger[_0x4e1d('0x25')](_0x4e1d('0x23'),_0x4e1d('0x2a'),_0x4e1d('0x86'),util['inspect'](_0x482532['body'],{'showHidden':![],'depth':null}));}break;case _0x4e1d('0x89'):if(_0x185702==_0x4e1d('0xd2')){return _0x331e45['update']({'read':!![]});}else{logger[_0x4e1d('0x25')](_0x4e1d('0x23'),_0x4e1d('0x2a'),_0x4e1d('0x89'),util[_0x4e1d('0xc6')](_0x482532[_0x4e1d('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x185702==='DELIVRD'||_0x185702===_0x4e1d('0xd3')){return _0x331e45['update']({'read':!![]});}else{logger[_0x4e1d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4e1d('0x2a'),_0x4e1d('0x8a'),util['inspect'](_0x482532['body'],{'showHidden':![],'depth':null}));}break;}return _0x331e45;}})[_0x4e1d('0x32')](respondWithResult(_0x17273e,null))[_0x4e1d('0x55')](handleError(_0x17273e,null));};exports[_0x4e1d('0xd4')]=function(_0x5a7c9d,_0x20f2cd,_0x3817cf){var _0x33eb20,_0x3d5652,_0xafeaef;return db[_0x4e1d('0x37')][_0x4e1d('0x5a')]({'where':{'id':_0x5a7c9d[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x20f2cd,null))[_0x4e1d('0x32')](function(_0x12922b){if(_0x12922b){_0xafeaef=_0x12922b;logger[_0x4e1d('0x22')](_0x4e1d('0x23'),_0x4e1d('0x2a'),_0x4e1d('0xd5'),_0x12922b['type'],util[_0x4e1d('0xc6')](_0x5a7c9d[_0x4e1d('0x3d')],{'showHidden':![],'depth':null}));switch(_0x12922b['type']){case'csc':if(_0x5a7c9d[_0x4e1d('0x3d')][_0x4e1d('0xd6')]&&_0x5a7c9d[_0x4e1d('0x3d')][_0x4e1d('0xd7')]){_0x3d5652=_0x5a7c9d['query']['state'];return db['SmsMessage'][_0x4e1d('0x5a')]({'where':{'messageId':_0x5a7c9d[_0x4e1d('0x3d')]['message-id']}});}break;}}})[_0x4e1d('0x32')](handleEntityNotFound(_0x20f2cd,null))[_0x4e1d('0x32')](function(_0xcfb599){if(_0xcfb599){_0x33eb20=_0xcfb599;switch(_0xafeaef[_0x4e1d('0x39')]){case _0x4e1d('0x84'):if(_0x3d5652==='2'||_0x3d5652==='6'){return _0x33eb20['update']({'read':!![]});}else{logger[_0x4e1d('0x25')](_0x4e1d('0x23'),_0x4e1d('0x2a'),_0x4e1d('0x84'),util[_0x4e1d('0xc6')](_0x5a7c9d[_0x4e1d('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0x33eb20;}})['then'](respondWithResult(_0x20f2cd,null))[_0x4e1d('0x55')](handleError(_0x20f2cd,null));};exports[_0x4e1d('0xd8')]=function(_0x4573b1,_0x46d7c3,_0x5a87a2){return db['SmsAccount']['find']({'where':{'id':_0x4573b1[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x46d7c3,null))[_0x4e1d('0x32')](function(_0x247b1e){if(_0x247b1e){return _0x247b1e['addAgents'](_0x4573b1[_0x4e1d('0x5e')][_0x4e1d('0x67')],_[_0x4e1d('0x95')](_0x4573b1[_0x4e1d('0x5e')],['ids','id'])||{})[_0x4e1d('0x9a')](function(_0x3ff36b){for(var _0x313428=0x0;_0x313428<_0x4573b1[_0x4e1d('0x5e')]['ids'][_0x4e1d('0x42')];_0x313428+=0x1){socket[_0x4e1d('0xd9')]('userSmsAccount:save',{'UserId':Number(_0x4573b1[_0x4e1d('0x5e')][_0x4e1d('0x67')][_0x313428]),'SmsAccountId':Number(_0x4573b1[_0x4e1d('0x50')]['id'])});}return _0x3ff36b;});}})[_0x4e1d('0x32')](respondWithResult(_0x46d7c3,null))['catch'](handleError(_0x46d7c3,null));};exports[_0x4e1d('0xda')]=function(_0x511688,_0x10cc02,_0x118ba2){return db[_0x4e1d('0x37')][_0x4e1d('0x5a')]({'where':{'id':_0x511688[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x10cc02,null))['then'](function(_0x440561){if(_0x440561){return _0x440561[_0x4e1d('0xda')](_0x511688['query'][_0x4e1d('0x67')])['then'](function(){if(_[_0x4e1d('0xdb')](_0x511688[_0x4e1d('0x3d')][_0x4e1d('0x67')])){for(var _0x43dbe1=0x0;_0x43dbe1<_0x511688['query'][_0x4e1d('0x67')][_0x4e1d('0x42')];_0x43dbe1+=0x1){socket[_0x4e1d('0xd9')](_0x4e1d('0xdc'),{'UserId':Number(_0x511688[_0x4e1d('0x3d')][_0x4e1d('0x67')][_0x43dbe1]),'SmsAccountId':Number(_0x511688[_0x4e1d('0x50')]['id'])});}}else{socket['emit'](_0x4e1d('0xdc'),{'UserId':Number(_0x511688['query'][_0x4e1d('0x67')]),'SmsAccountId':Number(_0x511688['params']['id'])});}});}})[_0x4e1d('0x32')](respondWithStatusCode(_0x10cc02,null))[_0x4e1d('0x55')](handleError(_0x10cc02,null));};exports[_0x4e1d('0xdd')]=function(_0x21cfbb,_0x5f4b6d,_0x19380f){var _0x58de52={};var _0x3389cf={};var _0x1be4c4;var _0x4be809;return db[_0x4e1d('0x37')][_0x4e1d('0x64')]({'where':{'id':_0x21cfbb[_0x4e1d('0x50')]['id']}})[_0x4e1d('0x32')](handleEntityNotFound(_0x5f4b6d,null))['then'](function(_0x33523e){if(_0x33523e){_0x1be4c4=_0x33523e;_0x3389cf['model']=_[_0x4e1d('0x3e')](db[_0x4e1d('0xa6')][_0x4e1d('0x53')]);_0x3389cf[_0x4e1d('0x3d')]=_[_0x4e1d('0x3e')](_0x21cfbb[_0x4e1d('0x3d')]);_0x3389cf[_0x4e1d('0x47')]=_[_0x4e1d('0x3f')](_0x3389cf[_0x4e1d('0x3b')],_0x3389cf['query']);_0x58de52['attributes']=_[_0x4e1d('0x3f')](_0x3389cf[_0x4e1d('0x3b')],qs[_0x4e1d('0x41')](_0x21cfbb[_0x4e1d('0x3d')][_0x4e1d('0x41')]));_0x58de52[_0x4e1d('0x40')]=_0x58de52[_0x4e1d('0x40')][_0x4e1d('0x42')]?_0x58de52[_0x4e1d('0x40')]:_0x3389cf['model'];_0x58de52[_0x4e1d('0x45')]=qs['sort'](_0x21cfbb['query']['sort']);_0x58de52[_0x4e1d('0x46')]=qs[_0x4e1d('0x47')](_[_0x4e1d('0x48')](_0x21cfbb[_0x4e1d('0x3d')],_0x3389cf['filters']));if(_0x21cfbb[_0x4e1d('0x3d')][_0x4e1d('0x49')]){_0x58de52[_0x4e1d('0x46')]=_[_0x4e1d('0x4a')](_0x58de52[_0x4e1d('0x46')],{'$or':_[_0x4e1d('0x3c')](_0x58de52['attributes'],function(_0x10b6c0){var _0x491f8a={};_0x491f8a[_0x10b6c0]={'$like':'%'+_0x21cfbb[_0x4e1d('0x3d')][_0x4e1d('0x49')]+'%'};return _0x491f8a;})});}_0x58de52=_['merge']({},_0x58de52,_0x21cfbb[_0x4e1d('0x54')]);return _0x1be4c4[_0x4e1d('0xdd')](_0x58de52);}})[_0x4e1d('0x32')](function(_0x48d049){if(_0x48d049){_0x4be809=_0x48d049[_0x4e1d('0x42')];if(!_0x21cfbb[_0x4e1d('0x3d')][_0x4e1d('0x43')]('nolimit')){_0x58de52[_0x4e1d('0x2e')]=qs[_0x4e1d('0x2e')](_0x21cfbb['query'][_0x4e1d('0x2e')]);_0x58de52[_0x4e1d('0x2c')]=qs[_0x4e1d('0x2c')](_0x21cfbb[_0x4e1d('0x3d')][_0x4e1d('0x2c')]);}return _0x1be4c4['getAgents'](_0x58de52);}})[_0x4e1d('0x32')](function(_0x404556){if(_0x404556){return _0x404556?{'count':_0x4be809,'rows':_0x404556}:null;}})['then'](respondWithResult(_0x5f4b6d,null))['catch'](handleError(_0x5f4b6d,null));}; \ No newline at end of file +var _0x2761=['From','messageId','MessageSid','skebby','from','sender','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','text','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','error_code','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','redis','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','get','SmsAccounts','destroy','end','stack','name','mandatoryDispositionPause','map','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','SmsAccount','includeAll','include','findAll','rows','params','Pause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','keys','rawAttributes','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','options','removeAnswers','SmsApplication','Applications','account','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile'];(function(_0x2b0ed6,_0xd4789){var _0x5d2065=function(_0x25aa3d){while(--_0x25aa3d){_0x2b0ed6['push'](_0x2b0ed6['shift']());}};_0x5d2065(++_0xd4789);}(_0x2761,0x66));var _0x1276=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2761[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1276('0x0'));var zipdir=require(_0x1276('0x1'));var jsonpatch=require(_0x1276('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1276('0x3'));var Mustache=require(_0x1276('0x4'));var util=require(_0x1276('0x5'));var path=require(_0x1276('0x6'));var sox=require(_0x1276('0x7'));var csv=require('to-csv');var ejs=require(_0x1276('0x8'));var fs=require('fs');var fs_extra=require(_0x1276('0x9'));var _=require(_0x1276('0xa'));var squel=require(_0x1276('0xb'));var crypto=require(_0x1276('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1276('0xd'));var toCsv=require(_0x1276('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1276('0xf'));var authService=require(_0x1276('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1276('0x11'));var hardwareService=require(_0x1276('0x12'));var logger=require(_0x1276('0x13'))(_0x1276('0x14'));var utils=require('../../config/utils');var config=require(_0x1276('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1276('0x16'))['db'];config['redis']=_[_0x1276('0x17')](config['redis'],{'host':_0x1276('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1276('0x19')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x1276('0x1a'));var client=jayson[_0x1276('0x1b')][_0x1276('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x4b18ea,_0x130988,_0x24d316,_0x379ddd){return new BPromise(function(_0x12111c,_0xf2c989){var _0x24f5df=_0x379ddd||client;return _0x24f5df[_0x1276('0x1d')](_0x4b18ea,_0x24d316)[_0x1276('0x1e')](function(_0x46a620){logger[_0x1276('0x1f')](_0x1276('0x20'),_0x130988,'request\x20sent');logger[_0x1276('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x130988,'request\x20sent',JSON[_0x1276('0x22')](_0x46a620));if(_0x46a620['error']){if(_0x46a620[_0x1276('0x23')][_0x1276('0x24')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x130988,_0x46a620[_0x1276('0x23')][_0x1276('0x25')]);return _0xf2c989(_0x46a620[_0x1276('0x23')][_0x1276('0x25')]);}logger['error'](_0x1276('0x20'),_0x130988,_0x46a620[_0x1276('0x23')]['message']);return _0x12111c(_0x46a620[_0x1276('0x23')][_0x1276('0x25')]);}else{logger[_0x1276('0x1f')](_0x1276('0x20'),_0x130988,'request\x20sent');_0x12111c(_0x46a620['result'][_0x1276('0x25')]);}})[_0x1276('0x26')](function(_0x5167e3){logger[_0x1276('0x23')](_0x1276('0x20'),_0x130988,_0x5167e3);_0xf2c989(_0x5167e3);});});}function respondWithStatusCode(_0x576c34,_0x5e2d6a){_0x5e2d6a=_0x5e2d6a||0xcc;return function(_0x32813b){if(_0x32813b){return _0x576c34[_0x1276('0x27')](_0x5e2d6a);}return _0x576c34['status'](_0x5e2d6a)['end']();};}function respondWithResult(_0x103c9e,_0x587bd8){_0x587bd8=_0x587bd8||0xc8;return function(_0x20069e){if(_0x20069e){return _0x103c9e[_0x1276('0x28')](_0x587bd8)[_0x1276('0x29')](_0x20069e);}};}function respondWithFilteredResult(_0x30a018,_0x562ea1){return function(_0x578a71){if(_0x578a71){var _0x44e1a1=typeof _0x562ea1['offset']===_0x1276('0x2a')&&typeof _0x562ea1[_0x1276('0x2b')]==='undefined';var _0x221cf1=_0x578a71[_0x1276('0x2c')];var _0x305b95=_0x44e1a1?0x0:_0x562ea1[_0x1276('0x2d')];var _0xd2639b=_0x44e1a1?_0x578a71[_0x1276('0x2c')]:_0x562ea1[_0x1276('0x2d')]+_0x562ea1[_0x1276('0x2b')];var _0x230757;if(_0xd2639b>=_0x221cf1){_0xd2639b=_0x221cf1;_0x230757=0xc8;}else{_0x230757=0xce;}_0x30a018[_0x1276('0x28')](_0x230757);return _0x30a018[_0x1276('0x2e')](_0x1276('0x2f'),_0x305b95+'-'+_0xd2639b+'/'+_0x221cf1)[_0x1276('0x29')](_0x578a71);}return null;};}function patchUpdates(_0x315e0d){return function(_0x5a9f25){try{jsonpatch[_0x1276('0x30')](_0x5a9f25,_0x315e0d,!![]);}catch(_0x5205b8){return BPromise['reject'](_0x5205b8);}return _0x5a9f25['save']();};}function saveUpdates(_0x19b35f,_0x1da8d0){return function(_0x38564d){if(_0x38564d){return _0x38564d[_0x1276('0x31')](_0x19b35f)[_0x1276('0x1e')](function(_0x2b619a){return _0x2b619a;});}return null;};}function removeEntity(_0x35fa15,_0x3ce29c){return function(_0x592038){if(_0x592038){return _0x592038['destroy']()['then'](function(){var _0x4c45d7=_0x592038[_0x1276('0x32')]({'plain':!![]});var _0x291815=_0x1276('0x33');return db['UserProfileResource'][_0x1276('0x34')]({'where':{'type':_0x291815,'resourceId':_0x4c45d7['id']}})[_0x1276('0x1e')](function(){return _0x592038;});})[_0x1276('0x1e')](function(){_0x35fa15[_0x1276('0x28')](0xcc)[_0x1276('0x35')]();});}};}function handleEntityNotFound(_0x163df9,_0xfac0b3){return function(_0x5e4560){if(!_0x5e4560){_0x163df9['sendStatus'](0x194);}return _0x5e4560;};}function handleError(_0xfffacd,_0x50af6d){_0x50af6d=_0x50af6d||0x1f4;return function(_0x267aa2){logger['error'](_0x267aa2[_0x1276('0x36')]);if(_0x267aa2[_0x1276('0x37')]){delete _0x267aa2['name'];}_0xfffacd[_0x1276('0x28')](_0x50af6d)['send'](_0x267aa2);};}exports['index']=function(_0xc0dcd5,_0x48cd14){var _0x249325={'include':[{'model':db['Pause'],'as':_0x1276('0x38')}]},_0x535a66={},_0x19cff8={'count':0x0,'rows':[]};var _0x47484c=_[_0x1276('0x39')](db['SmsAccount']['rawAttributes'],function(_0x441a5c){return{'name':_0x441a5c[_0x1276('0x3a')],'type':_0x441a5c['type'][_0x1276('0x3b')]};});_0x535a66['model']=_[_0x1276('0x39')](_0x47484c,'name');_0x535a66['query']=_['keys'](_0xc0dcd5[_0x1276('0x3c')]);_0x535a66[_0x1276('0x3d')]=_[_0x1276('0x3e')](_0x535a66['model'],_0x535a66['query']);_0x249325[_0x1276('0x3f')]=_[_0x1276('0x3e')](_0x535a66[_0x1276('0x40')],qs[_0x1276('0x41')](_0xc0dcd5[_0x1276('0x3c')]['fields']));_0x249325['attributes']=_0x249325['attributes'][_0x1276('0x42')]?_0x249325['attributes']:_0x535a66[_0x1276('0x40')];if(!_0xc0dcd5[_0x1276('0x3c')][_0x1276('0x43')](_0x1276('0x44'))){_0x249325['limit']=qs[_0x1276('0x2b')](_0xc0dcd5['query']['limit']);_0x249325[_0x1276('0x2d')]=qs[_0x1276('0x2d')](_0xc0dcd5['query'][_0x1276('0x2d')]);}_0x249325[_0x1276('0x45')]=qs['sort'](_0xc0dcd5[_0x1276('0x3c')][_0x1276('0x46')]);_0x249325['where']=qs[_0x1276('0x3d')](_[_0x1276('0x47')](_0xc0dcd5['query'],_0x535a66[_0x1276('0x3d')]),_0x47484c);if(_0xc0dcd5[_0x1276('0x3c')][_0x1276('0x48')]){_0x249325['where']=_['merge'](_0x249325[_0x1276('0x49')],{'$or':_[_0x1276('0x39')](_0x47484c,function(_0x1f1a34){if(_0x1f1a34[_0x1276('0x4a')]!==_0x1276('0x4b')){var _0x411736={};_0x411736[_0x1f1a34[_0x1276('0x37')]]={'$like':'%'+_0xc0dcd5[_0x1276('0x3c')][_0x1276('0x48')]+'%'};return _0x411736;}})});}_0x249325=_[_0x1276('0x4c')]({},_0x249325,_0xc0dcd5['options']);var _0x4a3b20={'where':_0x249325['where']};return db[_0x1276('0x4d')][_0x1276('0x2c')](_0x4a3b20)[_0x1276('0x1e')](function(_0x53d382){_0x19cff8['count']=_0x53d382;if(_0xc0dcd5[_0x1276('0x3c')][_0x1276('0x4e')]){_0x249325[_0x1276('0x4f')]=[{'all':!![]}];}return db[_0x1276('0x4d')][_0x1276('0x50')](_0x249325);})[_0x1276('0x1e')](function(_0x40e090){_0x19cff8[_0x1276('0x51')]=_0x40e090;return _0x19cff8;})['then'](respondWithFilteredResult(_0x48cd14,_0x249325))['catch'](handleError(_0x48cd14,null));};exports['show']=function(_0x4ea787,_0x4e59fb){var _0xd01b8d={'raw':![],'where':{'id':_0x4ea787[_0x1276('0x52')]['id']},'include':[{'model':db[_0x1276('0x53')],'as':_0x1276('0x38')}]},_0x10b218={};_0x10b218[_0x1276('0x40')]=_['keys'](db[_0x1276('0x4d')]['rawAttributes']);_0x10b218[_0x1276('0x3c')]=_['keys'](_0x4ea787['query']);_0x10b218['filters']=_[_0x1276('0x3e')](_0x10b218[_0x1276('0x40')],_0x10b218[_0x1276('0x3c')]);_0xd01b8d[_0x1276('0x3f')]=_[_0x1276('0x3e')](_0x10b218[_0x1276('0x40')],qs[_0x1276('0x41')](_0x4ea787[_0x1276('0x3c')]['fields']));_0xd01b8d[_0x1276('0x3f')]=_0xd01b8d['attributes'][_0x1276('0x42')]?_0xd01b8d['attributes']:_0x10b218[_0x1276('0x40')];if(_0x4ea787['query'][_0x1276('0x4e')]){_0xd01b8d[_0x1276('0x4f')]=[{'all':!![]}];}_0xd01b8d=_[_0x1276('0x4c')]({},_0xd01b8d,_0x4ea787['options']);return db['SmsAccount'][_0x1276('0x54')](_0xd01b8d)[_0x1276('0x1e')](handleEntityNotFound(_0x4e59fb,null))[_0x1276('0x1e')](respondWithResult(_0x4e59fb,null))[_0x1276('0x26')](handleError(_0x4e59fb,null));};exports[_0x1276('0x55')]=function(_0x57cf16,_0x4ff91b){return db['SmsAccount'][_0x1276('0x55')](_0x57cf16['body'],{})['then'](function(_0x3e42da){var _0x170317=_0x57cf16[_0x1276('0x56')][_0x1276('0x32')]({'plain':!![]});if(!_0x170317)throw new Error(_0x1276('0x57'));if(_0x170317['role']===_0x1276('0x56')){var _0x341f66=_0x3e42da[_0x1276('0x32')]({'plain':!![]});var _0x46bb76=_0x1276('0x33');return db[_0x1276('0x58')]['find']({'where':{'name':_0x46bb76,'userProfileId':_0x170317[_0x1276('0x59')]},'raw':!![]})[_0x1276('0x1e')](function(_0x386e66){if(_0x386e66&&_0x386e66[_0x1276('0x5a')]===0x0){return db['UserProfileResource'][_0x1276('0x55')]({'name':_0x341f66[_0x1276('0x37')],'resourceId':_0x341f66['id'],'type':_0x386e66[_0x1276('0x37')],'sectionId':_0x386e66['id']},{})['then'](function(){return _0x3e42da;});}else{return _0x3e42da;}})['catch'](function(_0x19ef2){logger[_0x1276('0x23')](_0x1276('0x5b'),_0x19ef2);throw _0x19ef2;});}return _0x3e42da;})[_0x1276('0x1e')](respondWithResult(_0x4ff91b,0xc9))['catch'](handleError(_0x4ff91b,null));};exports[_0x1276('0x31')]=function(_0x391c3e,_0x36c37a){if(_0x391c3e[_0x1276('0x5c')]['id']){delete _0x391c3e[_0x1276('0x5c')]['id'];}return db['SmsAccount'][_0x1276('0x54')]({'where':{'id':_0x391c3e[_0x1276('0x52')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x36c37a,null))[_0x1276('0x1e')](saveUpdates(_0x391c3e[_0x1276('0x5c')],null))[_0x1276('0x1e')](respondWithResult(_0x36c37a,null))['catch'](handleError(_0x36c37a,null));};exports[_0x1276('0x34')]=function(_0x59eac5,_0x2e13f5){return db[_0x1276('0x4d')][_0x1276('0x54')]({'where':{'id':_0x59eac5['params']['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x2e13f5,null))[_0x1276('0x1e')](removeEntity(_0x2e13f5,null))[_0x1276('0x26')](handleError(_0x2e13f5,null));};exports[_0x1276('0x5d')]=function(_0x4ed150,_0x2f1a30){return db[_0x1276('0x4d')][_0x1276('0x5d')]()[_0x1276('0x1e')](respondWithResult(_0x2f1a30,null))['catch'](handleError(_0x2f1a30,null));};exports[_0x1276('0x5e')]=function(_0x30b309,_0x3ab72b,_0x3f687a){if(_0x30b309[_0x1276('0x5c')]['id']){delete _0x30b309[_0x1276('0x5c')]['id'];}return db['SmsAccount'][_0x1276('0x54')]({'where':{'id':_0x30b309[_0x1276('0x52')]['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x3ab72b,null))[_0x1276('0x1e')](function(_0x4cb470){if(_0x4cb470){_0x30b309['body'][_0x1276('0x5f')]=_0x4cb470['id'];return db[_0x1276('0x60')][_0x1276('0x55')](_0x30b309[_0x1276('0x5c')]);}})[_0x1276('0x1e')](respondWithResult(_0x3ab72b,null))[_0x1276('0x26')](handleError(_0x3ab72b,null));};exports[_0x1276('0x61')]=function(_0x4fe40d,_0x304674,_0x4ab823){var _0xc78141={'raw':![],'where':{}};var _0x41aa36={};var _0x38339b={'count':0x0,'rows':[]};return db[_0x1276('0x4d')][_0x1276('0x62')]({'where':{'id':_0x4fe40d['params']['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x304674,null))[_0x1276('0x1e')](function(_0x57506b){if(_0x57506b){_0x41aa36[_0x1276('0x40')]=_[_0x1276('0x63')](db[_0x1276('0x60')][_0x1276('0x64')]);_0x41aa36[_0x1276('0x3c')]=_[_0x1276('0x63')](_0x4fe40d[_0x1276('0x3c')]);_0x41aa36[_0x1276('0x3d')]=_[_0x1276('0x3e')](_0x41aa36[_0x1276('0x40')],_0x41aa36['query']);_0xc78141[_0x1276('0x3f')]=_['intersection'](_0x41aa36['model'],qs[_0x1276('0x41')](_0x4fe40d[_0x1276('0x3c')][_0x1276('0x41')]));_0xc78141[_0x1276('0x3f')]=_0xc78141['attributes'][_0x1276('0x42')]?_0xc78141[_0x1276('0x3f')]:_0x41aa36[_0x1276('0x40')];if(!_0x4fe40d[_0x1276('0x3c')][_0x1276('0x43')](_0x1276('0x44'))){_0xc78141['limit']=qs['limit'](_0x4fe40d[_0x1276('0x3c')][_0x1276('0x2b')]);_0xc78141[_0x1276('0x2d')]=qs['offset'](_0x4fe40d[_0x1276('0x3c')][_0x1276('0x2d')]);}_0xc78141[_0x1276('0x45')]=qs[_0x1276('0x46')](_0x4fe40d['query'][_0x1276('0x46')]);_0xc78141[_0x1276('0x49')]=qs[_0x1276('0x3d')](_[_0x1276('0x47')](_0x4fe40d[_0x1276('0x3c')],_0x41aa36['filters']));_0xc78141[_0x1276('0x49')][_0x1276('0x5f')]=_0x57506b['id'];if(_0x4fe40d[_0x1276('0x3c')][_0x1276('0x48')]){_0xc78141[_0x1276('0x49')]=_['merge'](_0xc78141['where'],{'$or':_[_0x1276('0x39')](_0xc78141[_0x1276('0x3f')],function(_0x54131b){var _0x37b5bd={};_0x37b5bd[_0x54131b]={'$like':'%'+_0x4fe40d[_0x1276('0x3c')][_0x1276('0x48')]+'%'};return _0x37b5bd;})});}_0xc78141=_[_0x1276('0x4c')]({},_0xc78141,_0x4fe40d['options']);return db[_0x1276('0x60')][_0x1276('0x2c')]({'where':_0xc78141['where']})[_0x1276('0x1e')](function(_0x50f824){_0x38339b[_0x1276('0x2c')]=_0x50f824;if(_0x4fe40d[_0x1276('0x3c')][_0x1276('0x4e')]){_0xc78141['include']=[{'all':!![]}];}return db['Disposition'][_0x1276('0x50')](_0xc78141);})[_0x1276('0x1e')](function(_0x21501a){_0x38339b['rows']=_0x21501a;return _0x38339b;});}})[_0x1276('0x1e')](respondWithFilteredResult(_0x304674,_0xc78141))[_0x1276('0x26')](handleError(_0x304674,null));};exports['removeDispositions']=function(_0x33b6a1,_0x490865,_0xf985ec){return db['SmsAccount'][_0x1276('0x54')]({'where':{'id':_0x33b6a1[_0x1276('0x52')]['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x490865,null))['then'](function(_0x5ae614){if(_0x5ae614){return _0x5ae614[_0x1276('0x65')](_0x33b6a1[_0x1276('0x3c')][_0x1276('0x66')]);}})[_0x1276('0x1e')](respondWithStatusCode(_0x490865,null))[_0x1276('0x26')](handleError(_0x490865,null));};exports[_0x1276('0x67')]=function(_0x545ae0,_0x544703,_0x135e88){if(_0x545ae0[_0x1276('0x5c')]['id']){delete _0x545ae0[_0x1276('0x5c')]['id'];}return db[_0x1276('0x4d')][_0x1276('0x54')]({'where':{'id':_0x545ae0[_0x1276('0x52')]['id']}})['then'](handleEntityNotFound(_0x544703,null))[_0x1276('0x1e')](function(_0x4a20c4){if(_0x4a20c4){_0x545ae0[_0x1276('0x5c')]['SmsAccountId']=_0x4a20c4['id'];return db[_0x1276('0x68')][_0x1276('0x55')](_0x545ae0['body']);}})[_0x1276('0x1e')](respondWithResult(_0x544703,null))[_0x1276('0x26')](handleError(_0x544703,null));};exports[_0x1276('0x69')]=function(_0x121f3f,_0x58c0cf,_0x4cbef3){var _0x1e8bc4={'raw':![],'where':{}};var _0x2e8d77={};var _0x38e410={'count':0x0,'rows':[]};return db[_0x1276('0x4d')][_0x1276('0x62')]({'where':{'id':_0x121f3f[_0x1276('0x52')]['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x58c0cf,null))[_0x1276('0x1e')](function(_0x546a86){if(_0x546a86){_0x2e8d77[_0x1276('0x40')]=_[_0x1276('0x63')](db[_0x1276('0x68')][_0x1276('0x64')]);_0x2e8d77['query']=_[_0x1276('0x63')](_0x121f3f['query']);_0x2e8d77[_0x1276('0x3d')]=_[_0x1276('0x3e')](_0x2e8d77[_0x1276('0x40')],_0x2e8d77[_0x1276('0x3c')]);_0x1e8bc4[_0x1276('0x3f')]=_[_0x1276('0x3e')](_0x2e8d77[_0x1276('0x40')],qs[_0x1276('0x41')](_0x121f3f[_0x1276('0x3c')]['fields']));_0x1e8bc4[_0x1276('0x3f')]=_0x1e8bc4['attributes'][_0x1276('0x42')]?_0x1e8bc4['attributes']:_0x2e8d77['model'];if(!_0x121f3f['query']['hasOwnProperty'](_0x1276('0x44'))){_0x1e8bc4[_0x1276('0x2b')]=qs[_0x1276('0x2b')](_0x121f3f[_0x1276('0x3c')]['limit']);_0x1e8bc4['offset']=qs['offset'](_0x121f3f[_0x1276('0x3c')][_0x1276('0x2d')]);}_0x1e8bc4[_0x1276('0x45')]=qs['sort'](_0x121f3f[_0x1276('0x3c')]['sort']);_0x1e8bc4[_0x1276('0x49')]=qs[_0x1276('0x3d')](_[_0x1276('0x47')](_0x121f3f[_0x1276('0x3c')],_0x2e8d77[_0x1276('0x3d')]));_0x1e8bc4[_0x1276('0x49')][_0x1276('0x5f')]=_0x546a86['id'];if(_0x121f3f[_0x1276('0x3c')][_0x1276('0x48')]){_0x1e8bc4[_0x1276('0x49')]=_['merge'](_0x1e8bc4['where'],{'$or':_[_0x1276('0x39')](_0x1e8bc4['attributes'],function(_0x3996ea){var _0x1be6ca={};_0x1be6ca[_0x3996ea]={'$like':'%'+_0x121f3f[_0x1276('0x3c')]['filter']+'%'};return _0x1be6ca;})});}_0x1e8bc4=_[_0x1276('0x4c')]({},_0x1e8bc4,_0x121f3f[_0x1276('0x6a')]);return db[_0x1276('0x68')][_0x1276('0x2c')]({'where':_0x1e8bc4[_0x1276('0x49')]})[_0x1276('0x1e')](function(_0x4c7d9e){_0x38e410['count']=_0x4c7d9e;if(_0x121f3f[_0x1276('0x3c')][_0x1276('0x4e')]){_0x1e8bc4[_0x1276('0x4f')]=[{'all':!![]}];}return db[_0x1276('0x68')][_0x1276('0x50')](_0x1e8bc4);})[_0x1276('0x1e')](function(_0x261b0d){_0x38e410[_0x1276('0x51')]=_0x261b0d;return _0x38e410;});}})[_0x1276('0x1e')](respondWithFilteredResult(_0x58c0cf,_0x1e8bc4))['catch'](handleError(_0x58c0cf,null));};exports['removeAnswers']=function(_0x5e5b3f,_0x4bc70c,_0x3ba910){return db[_0x1276('0x4d')][_0x1276('0x54')]({'where':{'id':_0x5e5b3f[_0x1276('0x52')]['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x4bc70c,null))[_0x1276('0x1e')](function(_0x2c70a8){if(_0x2c70a8){return _0x2c70a8[_0x1276('0x6b')](_0x5e5b3f[_0x1276('0x3c')][_0x1276('0x66')]);}})['then'](respondWithStatusCode(_0x4bc70c,null))[_0x1276('0x26')](handleError(_0x4bc70c,null));};exports['notify']=function(_0x4791d1,_0x22b2d2,_0x159ab0){var _0x5215e5={'channel':'sms'};var _0x5ba8ae=[];var _0x31c8e9=[];var _0x19b6f0={};return db[_0x1276('0x4d')][_0x1276('0x54')]({'where':{'id':_0x4791d1[_0x1276('0x52')]['id']},'include':[{'model':db[_0x1276('0x6c')],'as':_0x1276('0x6d')}]})['then'](handleEntityNotFound(_0x22b2d2,null))[_0x1276('0x1e')](function(_0x5aa918){_0x5215e5[_0x1276('0x6e')]=_0x5aa918;_0x5215e5['applications']=_['orderBy'](_0x5aa918['Applications'],[_0x1276('0x6f')],[_0x1276('0x70')]);if(_0x5215e5['account']['Applications']){delete _0x5215e5[_0x1276('0x6e')][_0x1276('0x6d')];}return db[_0x1276('0x71')][_0x1276('0x5d')]();})[_0x1276('0x1e')](function(_0xba9e08){if(!_0xba9e08){throw new db['Sequelize'][(_0x1276('0x72'))](_0x1276('0x73'));}_0x5ba8ae=_[_0x1276('0x74')](_[_0x1276('0x63')](_0xba9e08),['createdAt',_0x1276('0x75')]);_0x31c8e9=_['difference'](_[_0x1276('0x63')](_0xba9e08),[_0x1276('0x76'),_0x1276('0x75'),_0x1276('0x77'),_0x1276('0x78')]);_0x5215e5[_0x1276('0x5c')]={'mapKey':_0x1276('0x79')};if(_0x5215e5[_0x1276('0x6e')][_0x1276('0x4a')]){switch(_0x5215e5[_0x1276('0x6e')][_0x1276('0x4a')]){case'twilio':_0x5215e5[_0x1276('0x5c')]['from']=_0x4791d1[_0x1276('0x5c')][_0x1276('0x7a')];_0x5215e5[_0x1276('0x5c')][_0x1276('0x5c')]=_0x4791d1[_0x1276('0x5c')]['Body'];_0x5215e5[_0x1276('0x5c')][_0x1276('0x7b')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x7c')];break;case _0x1276('0x7d'):_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')]='+'+_0x4791d1[_0x1276('0x5c')][_0x1276('0x7f')];_0x5215e5['body']['body']=_0x4791d1['body']['text'];break;case'connectel':_0x5215e5['body'][_0x1276('0x7e')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x7e')];_0x5215e5[_0x1276('0x5c')][_0x1276('0x5c')]=_0x4791d1[_0x1276('0x5c')]['message'];break;case _0x1276('0x80'):_0x5215e5[_0x1276('0x5c')]['from']=_0x4791d1[_0x1276('0x5c')]['from'];_0x5215e5[_0x1276('0x5c')][_0x1276('0x5c')]=_0x4791d1['body'][_0x1276('0x5c')];_0x5215e5[_0x1276('0x5c')][_0x1276('0x7b')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x81')];break;case _0x1276('0x82'):_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')]=_0x4791d1['body']['From'];_0x5215e5[_0x1276('0x5c')][_0x1276('0x5c')]=_0x4791d1['body']['Text'];_0x5215e5[_0x1276('0x5c')][_0x1276('0x7b')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x83')];break;case _0x1276('0x84'):_0x5215e5[_0x1276('0x5c')]['from']='+'+_0x4791d1[_0x1276('0x5c')][_0x1276('0x85')][0x0][_0x1276('0x7e')];_0x5215e5[_0x1276('0x5c')]['body']=_0x4791d1[_0x1276('0x5c')][_0x1276('0x85')][0x0]['text'];_0x5215e5[_0x1276('0x5c')][_0x1276('0x7b')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x85')][0x0][_0x1276('0x7b')];break;case _0x1276('0x86'):_0x5215e5['body'][_0x1276('0x7e')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x87')];_0x5215e5[_0x1276('0x5c')][_0x1276('0x5c')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x88')][_0x1276('0x25')];break;case _0x1276('0x89'):_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')]=_0x4791d1[_0x1276('0x5c')]['fromNumber'];_0x5215e5['body'][_0x1276('0x5c')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x8a')];_0x5215e5[_0x1276('0x5c')][_0x1276('0x7b')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x8b')];break;case _0x1276('0x8c'):_0x5215e5[_0x1276('0x5c')][_0x1276('0x7b')]=_0x4791d1[_0x1276('0x5c')][0x0][_0x1276('0x25')]['id'];_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')]=_0x4791d1[_0x1276('0x5c')][0x0][_0x1276('0x25')][_0x1276('0x7e')];_0x5215e5[_0x1276('0x5c')][_0x1276('0x5c')]=_0x4791d1['body'][0x0][_0x1276('0x25')][_0x1276('0x8a')];break;case _0x1276('0x8d'):_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x7e')];_0x5215e5[_0x1276('0x5c')][_0x1276('0x5c')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x25')];_0x5215e5[_0x1276('0x5c')][_0x1276('0x7b')]=_0x4791d1[_0x1276('0x5c')][_0x1276('0x8e')];break;}}if(_0x5215e5[_0x1276('0x5c')]['id']){delete _0x5215e5[_0x1276('0x5c')]['id'];}if(_[_0x1276('0x8f')](_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')])){throw new db['Sequelize']['ValidationError'](_0x1276('0x90'));}if(_[_0x1276('0x8f')](_0x5215e5[_0x1276('0x5c')]['body'])||_0x5215e5[_0x1276('0x5c')][_0x1276('0x5c')]===''){throw new db[(_0x1276('0x91'))][(_0x1276('0x72'))](_0x1276('0x92'));}if(_[_0x1276('0x8f')](_0x5215e5['body'][_0x1276('0x93')])){throw new db[(_0x1276('0x91'))][(_0x1276('0x72'))](_0x1276('0x94')+_0x31c8e9);}if(!_['includes'](_0x31c8e9,_0x5215e5[_0x1276('0x5c')][_0x1276('0x93')])){throw new db[(_0x1276('0x91'))]['ValidationError'](_0x1276('0x95')+_0x31c8e9);}_0x19b6f0[_0x5215e5[_0x1276('0x5c')]['mapKey']]=_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')];return db['CmList'][_0x1276('0x54')]({'where':{'id':_0x5215e5[_0x1276('0x6e')][_0x1276('0x78')]},'include':[{'model':db[_0x1276('0x71')],'as':_0x1276('0x96'),'where':_0x19b6f0,'limit':0x1,'order':[[_0x1276('0x75'),'DESC']]}]});})[_0x1276('0x1e')](handleEntityNotFound(_0x22b2d2,null))[_0x1276('0x1e')](function(_0x3d7839){if(_0x3d7839){_0x5215e5['list']=_['omit'](_0x3d7839,['Contacts']);if(_0x3d7839[_0x1276('0x96')][_0x1276('0x42')]){return _0x3d7839[_0x1276('0x96')][0x0];}var _0x90439f=_[_0x1276('0x17')](_0x5215e5[_0x1276('0x5c')],{'firstName':_0x5215e5['body'][_0x1276('0x7e')],'ListId':_0x3d7839['id']});_0x90439f[_0x5215e5['body']['mapKey']]=_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')];return db['CmContact'][_0x1276('0x55')](_0x90439f,{'fields':_0x5ba8ae,'raw':!![]});}})['then'](handleEntityNotFound(_0x22b2d2,null))[_0x1276('0x1e')](function(_0x3af489){if(_0x3af489){_0x5215e5['contact']=_0x3af489;var _0x5d43c7={'ContactId':_0x3af489['id'],'phone':_0x5215e5[_0x1276('0x5c')][_0x1276('0x7e')],'SmsAccountId':_0x4791d1[_0x1276('0x52')]['id']};var _0x6a9d83={'ContactId':_0x3af489['id'],'SmsAccountId':_0x4791d1[_0x1276('0x52')]['id'],'closed':![]};return db[_0x1276('0x97')][_0x1276('0x54')]({'where':_0x6a9d83})[_0x1276('0x1e')](function(_0x15039f){if(_0x15039f){return[_0x15039f,![]];}return db[_0x1276('0x97')][_0x1276('0x55')](_0x5d43c7)[_0x1276('0x1e')](function(_0x506cc0){return[_0x506cc0,!![]];});});}})[_0x1276('0x98')](function(_0x2bc56a,_0x29d335){_0x5215e5[_0x1276('0x99')]=_0x2bc56a[_0x1276('0x32')]({'plain':!![]});_0x5215e5[_0x1276('0x99')][_0x1276('0x9a')]=![];if(_0x29d335){if(_0x5215e5[_0x1276('0x6e')][_0x1276('0x9b')]){_0x5215e5[_0x1276('0x9c')][_0x1276('0x9d')]({'id':0x0,'priority':_0x5215e5[_0x1276('0x9c')][_0x1276('0x42')]+0x1,'app':_0x1276('0x9e'),'appdata':_0x1276('0x9f'),'interval':_0x1276('0xa0')});}_0x5215e5['interaction'][_0x1276('0x9a')]=!![];}return db[_0x1276('0xa1')][_0x1276('0x55')]({'phone':_0x5215e5['body'][_0x1276('0x7e')],'messageId':_0x5215e5[_0x1276('0x5c')][_0x1276('0x7b')],'body':_0x5215e5['body'][_0x1276('0x5c')],'SmsAccountId':_0x4791d1[_0x1276('0x52')]['id'],'SmsInteractionId':_0x2bc56a['id'],'direction':'in','ContactId':_0x2bc56a[_0x1276('0xa2')],'AttachmentId':_0x5215e5[_0x1276('0x5c')][_0x1276('0xa3')]});})[_0x1276('0x1e')](function(_0x265188){_0x5215e5[_0x1276('0x25')]=_0x265188;if(_0x5215e5[_0x1276('0x99')][_0x1276('0xa4')]){return db[_0x1276('0xa5')]['find']({'attributes':['id',_0x1276('0x37')],'where':{'id':_0x5215e5[_0x1276('0x99')][_0x1276('0xa4')]}})[_0x1276('0x1e')](function(_0x7ed380){if(_0x7ed380){_0x5215e5['applications'][_0x1276('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x7ed380[_0x1276('0x37')]+','+(_0x5215e5[_0x1276('0x6e')][_0x1276('0xa7')]||0xa),'interval':_0x1276('0xa0')});}return respondWithRpcPromise(_0x1276('0xa8'),_0x1276('0xa9'),_0x5215e5);});}return respondWithRpcPromise(_0x1276('0xa8'),_0x1276('0xa9'),_0x5215e5);})[_0x1276('0x1e')](function(_0x113fea){if(_0x113fea){var _0x4cd2f9=0xc8;var _0x474b09='receiveMessage';logger[_0x1276('0x1f')](_0x1276('0xaa'),_0x474b09,_0x4cd2f9,_0x1276('0xab'));logger[_0x1276('0x21')](_0x1276('0xac'),_0x474b09,_0x4cd2f9,_0x1276('0xab'),JSON[_0x1276('0x22')](_0x113fea));if(_0x5215e5[_0x1276('0x6e')][_0x1276('0x4a')]===_0x1276('0xad')){return _0x22b2d2[_0x1276('0x28')](_0x4cd2f9)['set'](_0x1276('0xae'),_0x1276('0xaf'))[_0x1276('0xb0')](_0x1276('0xb1'));}else{return _0x22b2d2['status'](_0x4cd2f9)['json'](_0x113fea);}}})['catch'](handleError(_0x22b2d2,null));};exports[_0x1276('0xb2')]=function(_0x385b27,_0x56051a){var _0x5dd783=_0x385b27[_0x1276('0x52')]['id'];var _0x3337f9=_0x385b27[_0x1276('0x5c')];var _0x2f95ed=0xc8;var _0x426c2b=null;return db[_0x1276('0xb3')]['transaction']({'isolationLevel':db[_0x1276('0xb3')][_0x1276('0xb4')][_0x1276('0xb5')][_0x1276('0xb6')]},function(_0xc63db0){return db['SmsAccount'][_0x1276('0x62')]({'where':{'id':_0x5dd783},'transaction':_0xc63db0})[_0x1276('0x1e')](function(_0x9eb746){if(_0x9eb746){return db[_0x1276('0x6c')][_0x1276('0x34')]({'where':{'SmsAccountId':_0x5dd783},'transaction':_0xc63db0})[_0x1276('0x1e')](function(){var _0x52af6c=_[_0x1276('0x39')](_0x3337f9,function(_0x20903c){_0x20903c['SmsAccountId']=_0x5dd783;return _0x20903c;});return db['SmsApplication']['bulkCreate'](_0x52af6c,{'transaction':_0xc63db0});});}else{_0x2f95ed=0x194;_0x426c2b=[];}});})[_0x1276('0x1e')](function(){if(_0x2f95ed!==0x194){return db[_0x1276('0x6c')][_0x1276('0xb7')]({'where':{'SmsAccountId':_0x5dd783},'order':_0x1276('0x6f')})[_0x1276('0x1e')](function(_0x504ce2){_0x426c2b=_0x504ce2;});}})[_0x1276('0x26')](function(_0x1e9119){_0x2f95ed=0x1f4;logger[_0x1276('0x23')](_0x1e9119[_0x1276('0x36')]);if(_0x1e9119['name']){delete _0x1e9119[_0x1276('0x37')];}_0x426c2b=_0x1e9119;})[_0x1276('0xb8')](function(){if(_0x426c2b===null){_0x56051a[_0x1276('0x27')](_0x2f95ed);}else{if(_0x2f95ed===0x1f4){_0x56051a[_0x1276('0x28')](_0x2f95ed)['send'](_0x426c2b);}else{_0x56051a[_0x1276('0x28')](_0x2f95ed)[_0x1276('0x29')](_0x426c2b);}}});};exports[_0x1276('0xb9')]=function(_0x225100,_0x1e3747,_0x4dd6e2){var _0x111e4e={};var _0x59c765={};var _0x1b6e20;var _0xa8899c;return db[_0x1276('0x4d')][_0x1276('0x62')]({'where':{'id':_0x225100[_0x1276('0x52')]['id']}})['then'](handleEntityNotFound(_0x1e3747,null))[_0x1276('0x1e')](function(_0x41e7ed){if(_0x41e7ed){_0x1b6e20=_0x41e7ed;_0x59c765[_0x1276('0x40')]=_['keys'](db[_0x1276('0x6c')][_0x1276('0x64')]);_0x59c765[_0x1276('0x3c')]=_[_0x1276('0x63')](_0x225100['query']);_0x59c765[_0x1276('0x3d')]=_[_0x1276('0x3e')](_0x59c765[_0x1276('0x40')],_0x59c765['query']);_0x111e4e[_0x1276('0x3f')]=_[_0x1276('0x3e')](_0x59c765[_0x1276('0x40')],qs[_0x1276('0x41')](_0x225100[_0x1276('0x3c')][_0x1276('0x41')]));_0x111e4e['attributes']=_0x111e4e[_0x1276('0x3f')][_0x1276('0x42')]?_0x111e4e['attributes']:_0x59c765['model'];_0x111e4e[_0x1276('0x45')]=qs['sort'](_0x225100['query'][_0x1276('0x46')]);_0x111e4e[_0x1276('0x49')]=qs[_0x1276('0x3d')](_[_0x1276('0x47')](_0x225100[_0x1276('0x3c')],_0x59c765['filters']));if(_0x225100[_0x1276('0x3c')][_0x1276('0x48')]){_0x111e4e[_0x1276('0x49')]=_[_0x1276('0x4c')](_0x111e4e[_0x1276('0x49')],{'$or':_['map'](_0x111e4e['attributes'],function(_0x16da9f){var _0x303417={};_0x303417[_0x16da9f]={'$like':'%'+_0x225100[_0x1276('0x3c')][_0x1276('0x48')]+'%'};return _0x303417;})});}_0x111e4e=_['merge']({},_0x111e4e,_0x225100[_0x1276('0x6a')]);return _0x1b6e20[_0x1276('0xb9')](_0x111e4e);}})[_0x1276('0x1e')](function(_0xcf5b52){if(_0xcf5b52){_0xa8899c=_0xcf5b52[_0x1276('0x42')];if(!_0x225100[_0x1276('0x3c')]['hasOwnProperty']('nolimit')){_0x111e4e['limit']=qs['limit'](_0x225100[_0x1276('0x3c')][_0x1276('0x2b')]);_0x111e4e[_0x1276('0x2d')]=qs[_0x1276('0x2d')](_0x225100[_0x1276('0x3c')]['offset']);}return _0x1b6e20[_0x1276('0xb9')](_0x111e4e);}})['then'](function(_0x2723d5){if(_0x2723d5){return _0x2723d5?{'count':_0xa8899c,'rows':_0x2723d5}:null;}})[_0x1276('0x1e')](respondWithResult(_0x1e3747,null))[_0x1276('0x26')](handleError(_0x1e3747,null));};exports['getInteractions']=function(_0x3b0639,_0x5cad9b,_0xa187d8){var _0x2bd552={'raw':![],'where':{}};var _0x15ac72={};var _0xb6a660={'count':0x0,'rows':[]};return db[_0x1276('0x4d')]['findOne']({'where':{'id':_0x3b0639['params']['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x5cad9b,null))[_0x1276('0x1e')](function(_0x5d1dd3){if(_0x5d1dd3){_0x15ac72['model']=_[_0x1276('0x63')](db['SmsInteraction'][_0x1276('0x64')]);_0x15ac72[_0x1276('0x3c')]=_[_0x1276('0x63')](_0x3b0639[_0x1276('0x3c')]);_0x15ac72[_0x1276('0x3d')]=_[_0x1276('0x3e')](_0x15ac72['model'],_0x15ac72[_0x1276('0x3c')]);_0x2bd552[_0x1276('0x3f')]=_[_0x1276('0x3e')](_0x15ac72[_0x1276('0x40')],qs['fields'](_0x3b0639[_0x1276('0x3c')][_0x1276('0x41')]));_0x2bd552[_0x1276('0x3f')]=_0x2bd552[_0x1276('0x3f')][_0x1276('0x42')]?_0x2bd552[_0x1276('0x3f')]:_0x15ac72[_0x1276('0x40')];if(!_0x3b0639[_0x1276('0x3c')][_0x1276('0x43')]('nolimit')){_0x2bd552[_0x1276('0x2b')]=qs['limit'](_0x3b0639[_0x1276('0x3c')]['limit']);_0x2bd552[_0x1276('0x2d')]=qs[_0x1276('0x2d')](_0x3b0639[_0x1276('0x3c')][_0x1276('0x2d')]);}_0x2bd552[_0x1276('0x45')]=qs['sort'](_0x3b0639[_0x1276('0x3c')][_0x1276('0x46')]);_0x2bd552[_0x1276('0x49')]=qs['filters'](_[_0x1276('0x47')](_0x3b0639[_0x1276('0x3c')],_0x15ac72['filters']));_0x2bd552[_0x1276('0x49')][_0x1276('0x5f')]=_0x5d1dd3['id'];if(_0x3b0639[_0x1276('0x3c')][_0x1276('0x48')]){_0x2bd552[_0x1276('0x49')]=_['merge'](_0x2bd552[_0x1276('0x49')],{'$or':_[_0x1276('0x39')](_0x2bd552[_0x1276('0x3f')],function(_0x39aa42){var _0xa5df93={};_0xa5df93[_0x39aa42]={'$like':'%'+_0x3b0639[_0x1276('0x3c')]['filter']+'%'};return _0xa5df93;})});}_0x2bd552=_[_0x1276('0x4c')]({},_0x2bd552,_0x3b0639['options']);return db[_0x1276('0x97')][_0x1276('0x2c')]({'where':_0x2bd552[_0x1276('0x49')]})[_0x1276('0x1e')](function(_0x38c007){_0xb6a660[_0x1276('0x2c')]=_0x38c007;if(_0x3b0639[_0x1276('0x3c')][_0x1276('0x4e')]){_0x2bd552[_0x1276('0x4f')]=[{'model':db[_0x1276('0x71')],'as':_0x1276('0xba'),'required':![]},{'model':db['User'],'as':_0x1276('0xbb'),'attributes':[_0x1276('0x37'),_0x1276('0xbc'),_0x1276('0xbd')],'required':![]},{'model':db[_0x1276('0xbe')],'as':_0x1276('0xbf'),'attributes':['id','name',_0x1276('0xc0')],'where':_0x3b0639['query'][_0x1276('0xc1')]?{'id':_0x3b0639['query'][_0x1276('0xc1')]}:undefined,'required':_0x3b0639['query'][_0x1276('0xc1')]?!![]:![]}];}return db[_0x1276('0x97')][_0x1276('0x50')](_0x2bd552);})[_0x1276('0x1e')](function(_0x404914){_0xb6a660[_0x1276('0x51')]=_0x404914;return _0xb6a660;});}})[_0x1276('0x1e')](respondWithFilteredResult(_0x5cad9b,_0x2bd552))['catch'](handleError(_0x5cad9b,null));};exports[_0x1276('0xb0')]=function(_0x35990e,_0x4f523f,_0x367b58){var _0x2adf32,_0x156b9b,_0x46ea56;if(_[_0x1276('0x8f')](_0x35990e['body'][_0x1276('0x5c')])||_0x35990e[_0x1276('0x5c')][_0x1276('0x5c')]===''){throw new db[(_0x1276('0x91'))]['ValidationError'](_0x1276('0x92'));}if(_[_0x1276('0x8f')](_0x35990e[_0x1276('0x5c')]['to'])){throw new db[(_0x1276('0x91'))][(_0x1276('0x72'))]('to\x20is\x20mandatory');}_0x2adf32=_0x35990e[_0x1276('0x5c')]['to'];return db[_0x1276('0x4d')][_0x1276('0x54')]({'where':{'id':_0x35990e[_0x1276('0x52')]['id']},'include':[{'model':db[_0x1276('0xc2')],'as':_0x1276('0xc3'),'include':[{'model':db[_0x1276('0x71')],'as':'Contacts','where':{'mobile':_0x2adf32},'limit':0x1,'order':[[_0x1276('0x75'),'DESC']]}]}]})[_0x1276('0x1e')](handleEntityNotFound(_0x4f523f,null))[_0x1276('0x1e')](function(_0x210533){if(_0x210533&&_0x210533[_0x1276('0xc3')]){_0x156b9b=_0x210533['get']({'plain':!![]});if(_0x156b9b[_0x1276('0xc3')]&&_0x156b9b['List']['Contacts']['length']){return _0x156b9b[_0x1276('0xc3')][_0x1276('0x96')][0x0];}return db[_0x1276('0x71')][_0x1276('0x55')](_['defaults'](_0x35990e[_0x1276('0x5c')],{'firstName':_0x2adf32,'mobile':_0x2adf32,'phone':_0x2adf32,'ListId':_0x156b9b['ListId']}));}})['then'](handleEntityNotFound(_0x4f523f,null))[_0x1276('0x1e')](function(_0x5bc106){if(_0x5bc106){_0x46ea56=_0x5bc106;return db[_0x1276('0x97')][_0x1276('0x54')]({'where':{'ContactId':_0x46ea56['id'],'closed':![],'SmsAccountId':_0x156b9b['id']}})[_0x1276('0x1e')](function(_0x44f89d){if(_0x44f89d){return[_0x44f89d,![]];}return db[_0x1276('0x97')][_0x1276('0x55')]({'UserId':_0x35990e[_0x1276('0x56')]['id'],'ContactId':_0x46ea56['id'],'SmsAccountId':_0x156b9b['id'],'phone':_0x2adf32,'firstMsgDirection':_0x1276('0xc4'),'Messages':[_[_0x1276('0x4c')](_0x35990e[_0x1276('0x5c')],{'read':![],'body':_0x35990e[_0x1276('0x5c')][_0x1276('0x5c')],'phone':_0x2adf32,'SmsAccountId':_0x156b9b['id'],'UserId':_0x35990e['user']['id'],'ContactId':_0x46ea56['id']})]},{'include':[{'model':db[_0x1276('0xa1')],'as':_0x1276('0xc5')}]})[_0x1276('0x1e')](function(_0x2bcf31){return[_0x2bcf31,!![]];});});}})[_0x1276('0x98')](function(_0x2cf5ac,_0x10c4d8){if(_0x10c4d8){return _0x2cf5ac;}return db[_0x1276('0xa1')]['create'](_[_0x1276('0x4c')](_0x35990e[_0x1276('0x5c')],{'read':![],'body':_0x35990e[_0x1276('0x5c')]['body'],'phone':_0x2adf32,'SmsAccountId':_0x156b9b['id'],'SmsInteractionId':_0x2cf5ac['id'],'UserId':_0x35990e[_0x1276('0x56')]['id'],'ContactId':_0x46ea56['id']}))[_0x1276('0x1e')](function(_0x36b6b3){_0x2cf5ac[_0x1276('0xc6')]['Messages']=[];_0x2cf5ac[_0x1276('0xc6')][_0x1276('0xc5')][_0x1276('0x9d')](_0x36b6b3['dataValues']);return _0x2cf5ac;});})[_0x1276('0x1e')](respondWithResult(_0x4f523f,null))['catch'](handleError(_0x4f523f,null));};exports['status']=function(_0x18eba5,_0x1434b6,_0x1e680b){if(_0x18eba5[_0x1276('0x5c')]['id']){delete _0x18eba5['body']['id'];}var _0x4b6ab9,_0x1bc18f,_0x3ded37;return db['SmsAccount'][_0x1276('0x54')]({'where':{'id':_0x18eba5['params']['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x1434b6,null))[_0x1276('0x1e')](function(_0x51c54c){if(_0x51c54c){_0x3ded37=_0x51c54c;logger['debug'](_0x1276('0xaa'),_0x1276('0x28'),_0x1276('0xc7'),_0x51c54c['type'],util[_0x1276('0xc8')](_0x18eba5[_0x1276('0x5c')],{'showHidden':![],'depth':null}));switch(_0x51c54c[_0x1276('0x4a')]){case'skebby':if(_0x18eba5['body']['skebby_dispatch_id']&&_0x18eba5[_0x1276('0x5c')][_0x1276('0x28')]){_0x1bc18f=_0x18eba5[_0x1276('0x5c')]['status'];return db[_0x1276('0xa1')][_0x1276('0x54')]({'where':{'messageId':_0x18eba5['body'][_0x1276('0xc9')]}});}break;case _0x1276('0xca'):if(_0x18eba5[_0x1276('0x5c')][_0x1276('0xcb')]&&_0x18eba5[_0x1276('0x5c')][_0x1276('0xcc')]){_0x1bc18f=_0x18eba5[_0x1276('0x5c')][_0x1276('0xcc')];return db['SmsMessage']['find']({'where':{'messageId':_0x18eba5[_0x1276('0x5c')]['requestid']}});}break;case _0x1276('0x80'):if(_0x18eba5[_0x1276('0x5c')][_0x1276('0x81')]&&_0x18eba5[_0x1276('0x5c')]['status_code']){_0x1bc18f=_0x18eba5[_0x1276('0x5c')][_0x1276('0xcd')];return db[_0x1276('0xa1')][_0x1276('0x54')]({'where':{'messageId':_0x18eba5[_0x1276('0x5c')]['message_id']}});}break;case _0x1276('0x84'):var _0x35daef=_0x18eba5[_0x1276('0x5c')][_0x1276('0x85')][0x0];if(_0x35daef[_0x1276('0x7b')]&&_0x35daef[_0x1276('0x28')]['groupName']===_0x1276('0xce')){_0x1bc18f=_0x35daef['status']['groupName'];return db[_0x1276('0xa1')][_0x1276('0x54')]({'where':{'messageId':_0x35daef[_0x1276('0x7b')]}});}break;case _0x1276('0x89'):if(_0x18eba5[_0x1276('0x5c')][_0x1276('0x7b')]&&_0x18eba5[_0x1276('0x5c')][_0x1276('0x28')]){_0x1bc18f=_0x18eba5['body']['status'];return db['SmsMessage'][_0x1276('0x54')]({'where':{'messageId':_0x18eba5[_0x1276('0x5c')][_0x1276('0x7b')]}});}break;case _0x1276('0x8c'):if(_0x18eba5[_0x1276('0x5c')][0x0][_0x1276('0x25')]['id']){_0x1bc18f=_0x18eba5['body'][0x0][_0x1276('0x4a')];return db['SmsMessage']['find']({'where':{'messageId':_0x18eba5[_0x1276('0x5c')][0x0][_0x1276('0x25')]['id']}});}break;case _0x1276('0x8d'):if(_0x18eba5['body']['redif']&&_0x18eba5[_0x1276('0x5c')]['status']){_0x1bc18f=_0x18eba5[_0x1276('0x5c')][_0x1276('0x28')];return db[_0x1276('0xa1')]['find']({'where':{'messageId':_0x18eba5[_0x1276('0x5c')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x1434b6,null))[_0x1276('0x1e')](function(_0x4c31f0){if(_0x4c31f0){_0x4b6ab9=_0x4c31f0;switch(_0x3ded37['type']){case _0x1276('0x7d'):if(_0x1bc18f===_0x1276('0xce')){return _0x4b6ab9[_0x1276('0x31')]({'read':!![]});}else{logger[_0x1276('0x23')](_0x1276('0xaa'),_0x1276('0x28'),_0x1276('0x7d'),util['inspect'](_0x18eba5[_0x1276('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1bc18f==='1'){return _0x4b6ab9[_0x1276('0x31')]({'read':!![]});}else{logger[_0x1276('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1276('0x7d'),util['inspect'](_0x18eba5[_0x1276('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x1276('0x80'):if(!_0x18eba5[_0x1276('0x5c')][_0x1276('0xcf')]&&_0x1bc18f>=0xc8&&_0x1bc18f<=0xce){return _0x4b6ab9['update']({'read':!![]});}else{logger[_0x1276('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util[_0x1276('0xc8')](_0x18eba5[_0x1276('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4b808c=_0x18eba5[_0x1276('0x5c')][_0x1276('0x85')][0x0];if(_0x4b808c[_0x1276('0x28')][_0x1276('0xd0')]==='DELIVERED'){return _0x4b6ab9[_0x1276('0x31')]({'read':!![]});}else{logger['error'](_0x1276('0xaa'),_0x1276('0x28'),'infobip',util[_0x1276('0xc8')](_0x18eba5[_0x1276('0x5c')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x1bc18f==_0x1276('0xd1')||_0x1bc18f==_0x1276('0xd2')){return _0x4b6ab9[_0x1276('0x31')]({'read':!![]});}else{logger[_0x1276('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1276('0x28'),_0x1276('0x89'),util['inspect'](_0x18eba5['body'],{'showHidden':![],'depth':null}));}break;case _0x1276('0x8c'):if(_0x1bc18f==_0x1276('0xd3')){return _0x4b6ab9[_0x1276('0x31')]({'read':!![]});}else{logger[_0x1276('0x23')](_0x1276('0xaa'),_0x1276('0x28'),_0x1276('0x8c'),util[_0x1276('0xc8')](_0x18eba5[_0x1276('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1bc18f===_0x1276('0xd4')||_0x1bc18f===_0x1276('0xd5')){return _0x4b6ab9[_0x1276('0x31')]({'read':!![]});}else{logger[_0x1276('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util['inspect'](_0x18eba5[_0x1276('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4b6ab9;}})['then'](respondWithResult(_0x1434b6,null))[_0x1276('0x26')](handleError(_0x1434b6,null));};exports[_0x1276('0xd6')]=function(_0x2e6598,_0x2013a8,_0x433a4b){var _0x38345a,_0x444485,_0x501806;return db['SmsAccount']['find']({'where':{'id':_0x2e6598[_0x1276('0x52')]['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x2013a8,null))[_0x1276('0x1e')](function(_0x37c308){if(_0x37c308){_0x501806=_0x37c308;logger[_0x1276('0x21')](_0x1276('0xaa'),_0x1276('0x28'),'received\x20delivery\x20report\x20from',_0x37c308['type'],util['inspect'](_0x2e6598[_0x1276('0x3c')],{'showHidden':![],'depth':null}));switch(_0x37c308[_0x1276('0x4a')]){case'csc':if(_0x2e6598[_0x1276('0x3c')][_0x1276('0xd7')]&&_0x2e6598[_0x1276('0x3c')][_0x1276('0xd8')]){_0x444485=_0x2e6598[_0x1276('0x3c')][_0x1276('0xd8')];return db[_0x1276('0xa1')][_0x1276('0x54')]({'where':{'messageId':_0x2e6598[_0x1276('0x3c')][_0x1276('0xd7')]}});}break;}}})[_0x1276('0x1e')](handleEntityNotFound(_0x2013a8,null))[_0x1276('0x1e')](function(_0x4757d4){if(_0x4757d4){_0x38345a=_0x4757d4;switch(_0x501806['type']){case _0x1276('0x86'):if(_0x444485==='2'||_0x444485==='6'){return _0x38345a[_0x1276('0x31')]({'read':!![]});}else{logger[_0x1276('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1276('0x28'),_0x1276('0x86'),util[_0x1276('0xc8')](_0x2e6598[_0x1276('0x3c')],{'showHidden':![],'depth':null}));};break;}return _0x38345a;}})['then'](respondWithResult(_0x2013a8,null))[_0x1276('0x26')](handleError(_0x2013a8,null));};exports[_0x1276('0xd9')]=function(_0x2e8935,_0x40f3b0,_0x15e404){return db[_0x1276('0x4d')]['find']({'where':{'id':_0x2e8935[_0x1276('0x52')]['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x40f3b0,null))[_0x1276('0x1e')](function(_0x3abc13){if(_0x3abc13){return _0x3abc13[_0x1276('0xd9')](_0x2e8935['body'][_0x1276('0x66')],_[_0x1276('0xda')](_0x2e8935[_0x1276('0x5c')],[_0x1276('0x66'),'id'])||{})[_0x1276('0x98')](function(_0xd4940a){for(var _0x2251c9=0x0;_0x2251c9<_0x2e8935[_0x1276('0x5c')]['ids'][_0x1276('0x42')];_0x2251c9+=0x1){socket['emit'](_0x1276('0xdb'),{'UserId':Number(_0x2e8935['body']['ids'][_0x2251c9]),'SmsAccountId':Number(_0x2e8935[_0x1276('0x52')]['id'])});}return _0xd4940a;});}})[_0x1276('0x1e')](respondWithResult(_0x40f3b0,null))[_0x1276('0x26')](handleError(_0x40f3b0,null));};exports['removeAgents']=function(_0x106b97,_0x4260c3,_0x52b35f){return db[_0x1276('0x4d')][_0x1276('0x54')]({'where':{'id':_0x106b97[_0x1276('0x52')]['id']}})[_0x1276('0x1e')](handleEntityNotFound(_0x4260c3,null))['then'](function(_0x3bad4a){if(_0x3bad4a){return _0x3bad4a[_0x1276('0xdc')](_0x106b97[_0x1276('0x3c')][_0x1276('0x66')])['then'](function(){if(_['isArray'](_0x106b97[_0x1276('0x3c')][_0x1276('0x66')])){for(var _0x1e999d=0x0;_0x1e999d<_0x106b97[_0x1276('0x3c')][_0x1276('0x66')]['length'];_0x1e999d+=0x1){socket[_0x1276('0xdd')](_0x1276('0xde'),{'UserId':Number(_0x106b97['query'][_0x1276('0x66')][_0x1e999d]),'SmsAccountId':Number(_0x106b97[_0x1276('0x52')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x106b97[_0x1276('0x3c')][_0x1276('0x66')]),'SmsAccountId':Number(_0x106b97[_0x1276('0x52')]['id'])});}});}})[_0x1276('0x1e')](respondWithStatusCode(_0x4260c3,null))[_0x1276('0x26')](handleError(_0x4260c3,null));};exports[_0x1276('0xdf')]=function(_0x193230,_0x4d2d37,_0x53cf47){var _0x236267={};var _0x3a684b={};var _0x4caac3;var _0x5ec6f9;return db['SmsAccount'][_0x1276('0x62')]({'where':{'id':_0x193230[_0x1276('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d2d37,null))[_0x1276('0x1e')](function(_0x599897){if(_0x599897){_0x4caac3=_0x599897;_0x3a684b[_0x1276('0x40')]=_[_0x1276('0x63')](db[_0x1276('0xa5')][_0x1276('0x64')]);_0x3a684b[_0x1276('0x3c')]=_['keys'](_0x193230[_0x1276('0x3c')]);_0x3a684b[_0x1276('0x3d')]=_[_0x1276('0x3e')](_0x3a684b[_0x1276('0x40')],_0x3a684b['query']);_0x236267[_0x1276('0x3f')]=_[_0x1276('0x3e')](_0x3a684b[_0x1276('0x40')],qs[_0x1276('0x41')](_0x193230[_0x1276('0x3c')][_0x1276('0x41')]));_0x236267[_0x1276('0x3f')]=_0x236267['attributes'][_0x1276('0x42')]?_0x236267['attributes']:_0x3a684b[_0x1276('0x40')];_0x236267[_0x1276('0x45')]=qs['sort'](_0x193230['query'][_0x1276('0x46')]);_0x236267[_0x1276('0x49')]=qs['filters'](_[_0x1276('0x47')](_0x193230[_0x1276('0x3c')],_0x3a684b[_0x1276('0x3d')]));if(_0x193230[_0x1276('0x3c')][_0x1276('0x48')]){_0x236267[_0x1276('0x49')]=_[_0x1276('0x4c')](_0x236267[_0x1276('0x49')],{'$or':_[_0x1276('0x39')](_0x236267[_0x1276('0x3f')],function(_0x1e37c9){var _0x45969a={};_0x45969a[_0x1e37c9]={'$like':'%'+_0x193230[_0x1276('0x3c')][_0x1276('0x48')]+'%'};return _0x45969a;})});}_0x236267=_[_0x1276('0x4c')]({},_0x236267,_0x193230[_0x1276('0x6a')]);return _0x4caac3[_0x1276('0xdf')](_0x236267);}})[_0x1276('0x1e')](function(_0x1fd8b1){if(_0x1fd8b1){_0x5ec6f9=_0x1fd8b1[_0x1276('0x42')];if(!_0x193230[_0x1276('0x3c')][_0x1276('0x43')]('nolimit')){_0x236267[_0x1276('0x2b')]=qs['limit'](_0x193230['query'][_0x1276('0x2b')]);_0x236267[_0x1276('0x2d')]=qs[_0x1276('0x2d')](_0x193230[_0x1276('0x3c')][_0x1276('0x2d')]);}return _0x4caac3[_0x1276('0xdf')](_0x236267);}})['then'](function(_0x3ecccb){if(_0x3ecccb){return _0x3ecccb?{'count':_0x5ec6f9,'rows':_0x3ecccb}:null;}})[_0x1276('0x1e')](respondWithResult(_0x4d2d37,null))[_0x1276('0x26')](handleError(_0x4d2d37,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 8fa1abe..3ff2fc3 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 _0xb1d6=['SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xb1d6,0xd7));var _0x6b1d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb1d6[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x6b1d('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x6b1d('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6b1d('0x2')](0x0);var events={'afterCreate':_0x6b1d('0x3'),'afterUpdate':_0x6b1d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35ae7d){return function(_0x15119a,_0x258d7d,_0x112061){SmsAccountEvents[_0x6b1d('0x5')](_0x35ae7d+':'+_0x15119a['id'],_0x15119a);SmsAccountEvents['emit'](_0x35ae7d,_0x15119a);_0x112061(null);};}for(var e in events){if(events[_0x6b1d('0x6')](e)){var event=events[e];SmsAccount[_0x6b1d('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x3f21=['save','update','emit','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x3f21,0x1d5));var _0x13f2=function(_0x236cf4,_0x199d53){_0x236cf4=_0x236cf4-0x0;var _0x443e41=_0x3f21[_0x236cf4];return _0x443e41;};'use strict';var EventEmitter=require(_0x13f2('0x0'));var SmsAccount=require(_0x13f2('0x1'))['db'][_0x13f2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x13f2('0x3'),'afterUpdate':_0x13f2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x68a3d7){return function(_0x14489d,_0x12a619,_0x52936a){SmsAccountEvents[_0x13f2('0x5')](_0x68a3d7+':'+_0x14489d['id'],_0x14489d);SmsAccountEvents[_0x13f2('0x5')](_0x68a3d7,_0x14489d);_0x52936a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x13f2('0x6')](e,emitEvent(event));}}module[_0x13f2('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d8f8bd8..507e3d6 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 _0x79d3=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4bd687,_0x562484){var _0x5e2336=function(_0x402a84){while(--_0x402a84){_0x4bd687['push'](_0x4bd687['shift']());}};_0x5e2336(++_0x562484);}(_0x79d3,0x1c6));var _0x379d=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x79d3[_0x3e69ae];return _0x3d7f42;};'use strict';var _=require(_0x379d('0x0'));var util=require(_0x379d('0x1'));var logger=require(_0x379d('0x2'))(_0x379d('0x3'));var moment=require(_0x379d('0x4'));var BPromise=require(_0x379d('0x5'));var rp=require(_0x379d('0x6'));var fs=require('fs');var path=require(_0x379d('0x7'));var rimraf=require('rimraf');var config=require(_0x379d('0x8'));var attributes=require(_0x379d('0x9'));module[_0x379d('0xa')]=function(_0x163c5e,_0x5b1b16){return _0x163c5e[_0x379d('0xb')](_0x379d('0xc'),attributes,{'tableName':_0x379d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc176=['path','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x86a93,_0x35b32f){var _0x4ce615=function(_0x1e9392){while(--_0x1e9392){_0x86a93['push'](_0x86a93['shift']());}};_0x4ce615(++_0x35b32f);}(_0xc176,0x1c2));var _0x6c17=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0xc176[_0x35fb56];return _0x2fd52c;};'use strict';var _=require(_0x6c17('0x0'));var util=require('util');var logger=require(_0x6c17('0x1'))(_0x6c17('0x2'));var moment=require(_0x6c17('0x3'));var BPromise=require(_0x6c17('0x4'));var rp=require(_0x6c17('0x5'));var fs=require('fs');var path=require(_0x6c17('0x6'));var rimraf=require('rimraf');var config=require(_0x6c17('0x7'));var attributes=require(_0x6c17('0x8'));module['exports']=function(_0x475f47,_0x1afe62){return _0x475f47[_0x6c17('0x9')](_0x6c17('0xa'),attributes,{'tableName':_0x6c17('0xb'),'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 4351ee4..f86bf47 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 _0xb638=['request\x20sent','stringify','error','message','result','catch','SmsAccount','find','options','raw','attributes','include','map','model','ShowSmsAccount','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb638,0x1e4));var _0x8b63=function(_0x57192c,_0x4cb1f8){_0x57192c=_0x57192c-0x0;var _0x44b320=_0xb638[_0x57192c];return _0x44b320;};'use strict';var _=require('lodash');var util=require(_0x8b63('0x0'));var moment=require(_0x8b63('0x1'));var BPromise=require(_0x8b63('0x2'));var rs=require(_0x8b63('0x3'));var fs=require('fs');var Redis=require(_0x8b63('0x4'));var db=require(_0x8b63('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b63('0x6'))(_0x8b63('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b63('0x8'));var client=jayson[_0x8b63('0x9')][_0x8b63('0xa')]({'port':0x232a});config['redis']=_[_0x8b63('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8b63('0xc'))(new Redis(config[_0x8b63('0xd')]));require(_0x8b63('0xe'))[_0x8b63('0xf')](socket);function respondWithRpcPromise(_0x314112,_0x74a48a,_0x16107f){return new BPromise(function(_0x5f4e27,_0x3d795b){return client[_0x8b63('0x10')](_0x314112,_0x16107f)[_0x8b63('0x11')](function(_0xbeb4f4){logger[_0x8b63('0x12')](_0x8b63('0x13'),_0x74a48a,_0x8b63('0x14'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x74a48a,_0x8b63('0x14'),JSON[_0x8b63('0x15')](_0xbeb4f4));if(_0xbeb4f4[_0x8b63('0x16')]){if(_0xbeb4f4[_0x8b63('0x16')]['code']===0x1f4){logger[_0x8b63('0x16')]('SmsAccount,\x20%s,\x20%s',_0x74a48a,_0xbeb4f4[_0x8b63('0x16')]['message']);return _0x3d795b(_0xbeb4f4[_0x8b63('0x16')][_0x8b63('0x17')]);}logger[_0x8b63('0x16')]('SmsAccount,\x20%s,\x20%s',_0x74a48a,_0xbeb4f4[_0x8b63('0x16')][_0x8b63('0x17')]);return _0x5f4e27(_0xbeb4f4[_0x8b63('0x16')][_0x8b63('0x17')]);}else{logger[_0x8b63('0x12')](_0x8b63('0x13'),_0x74a48a,_0x8b63('0x14'));_0x5f4e27(_0xbeb4f4[_0x8b63('0x18')][_0x8b63('0x17')]);}})[_0x8b63('0x19')](function(_0x53d30d){logger[_0x8b63('0x16')]('SmsAccount,\x20%s,\x20%s',_0x74a48a,_0x53d30d);_0x3d795b(_0x53d30d);});});}exports['ShowSmsAccount']=function(_0x46afd6){var _0x4717ee=this;return new Promise(function(_0x3e4522,_0x69f7f){return db[_0x8b63('0x1a')][_0x8b63('0x1b')]({'raw':_0x46afd6[_0x8b63('0x1c')]?_0x46afd6['options'][_0x8b63('0x1d')]===undefined?!![]:![]:!![],'where':_0x46afd6[_0x8b63('0x1c')]?_0x46afd6['options']['where']||null:null,'attributes':_0x46afd6['options']?_0x46afd6[_0x8b63('0x1c')][_0x8b63('0x1e')]||null:null,'include':_0x46afd6[_0x8b63('0x1c')]?_0x46afd6['options'][_0x8b63('0x1f')]?_[_0x8b63('0x20')](_0x46afd6['options']['include'],function(_0x340b4b){return{'model':db[_0x340b4b['model']],'as':_0x340b4b['as'],'attributes':_0x340b4b['attributes'],'include':_0x340b4b[_0x8b63('0x1f')]?_['map'](_0x340b4b[_0x8b63('0x1f')],function(_0x454702){return{'model':db[_0x454702[_0x8b63('0x21')]],'as':_0x454702['as'],'attributes':_0x454702[_0x8b63('0x1e')],'include':_0x454702[_0x8b63('0x1f')]?_[_0x8b63('0x20')](_0x454702[_0x8b63('0x1f')],function(_0x3587ca){return{'model':db[_0x3587ca[_0x8b63('0x21')]],'as':_0x3587ca['as'],'attributes':_0x3587ca[_0x8b63('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8b63('0x11')](function(_0x32ee86){logger[_0x8b63('0x12')](_0x8b63('0x22'),_0x46afd6);logger[_0x8b63('0x23')](_0x8b63('0x22'),_0x46afd6,JSON[_0x8b63('0x15')](_0x32ee86));_0x3e4522(_0x32ee86);})[_0x8b63('0x19')](function(_0x58c18a){logger['error'](_0x8b63('0x22'),_0x58c18a[_0x8b63('0x17')],_0x46afd6);_0x69f7f(_0x4717ee[_0x8b63('0x16')](0x1f4,_0x58c18a[_0x8b63('0x17')]));});});}; \ No newline at end of file +var _0xbda7=['message','result','ShowSmsAccount','SmsAccount','find','options','attributes','include','map','model','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0xbda7,0x12c));var _0x7bda=function(_0x4967e3,_0x20768b){_0x4967e3=_0x4967e3-0x0;var _0x2a6dae=_0xbda7[_0x4967e3];return _0x2a6dae;};'use strict';var _=require(_0x7bda('0x0'));var util=require(_0x7bda('0x1'));var moment=require(_0x7bda('0x2'));var BPromise=require(_0x7bda('0x3'));var rs=require(_0x7bda('0x4'));var fs=require('fs');var Redis=require(_0x7bda('0x5'));var db=require(_0x7bda('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7bda('0x7'));var config=require(_0x7bda('0x8'));var jayson=require(_0x7bda('0x9'));var client=jayson['client'][_0x7bda('0xa')]({'port':0x232a});config[_0x7bda('0xb')]=_['defaults'](config['redis'],{'host':_0x7bda('0xc'),'port':0x18eb});var socket=require(_0x7bda('0xd'))(new Redis(config[_0x7bda('0xb')]));require(_0x7bda('0xe'))['register'](socket);function respondWithRpcPromise(_0x19aa13,_0x125456,_0xd3b1){return new BPromise(function(_0xb1ba54,_0x47141e){return client[_0x7bda('0xf')](_0x19aa13,_0xd3b1)['then'](function(_0x5efa0c){logger[_0x7bda('0x10')](_0x7bda('0x11'),_0x125456,_0x7bda('0x12'));logger[_0x7bda('0x13')](_0x7bda('0x14'),_0x125456,_0x7bda('0x12'),JSON[_0x7bda('0x15')](_0x5efa0c));if(_0x5efa0c[_0x7bda('0x16')]){if(_0x5efa0c[_0x7bda('0x16')][_0x7bda('0x17')]===0x1f4){logger[_0x7bda('0x16')]('SmsAccount,\x20%s,\x20%s',_0x125456,_0x5efa0c[_0x7bda('0x16')][_0x7bda('0x18')]);return _0x47141e(_0x5efa0c[_0x7bda('0x16')][_0x7bda('0x18')]);}logger['error'](_0x7bda('0x11'),_0x125456,_0x5efa0c['error'][_0x7bda('0x18')]);return _0xb1ba54(_0x5efa0c[_0x7bda('0x16')]['message']);}else{logger['info'](_0x7bda('0x11'),_0x125456,_0x7bda('0x12'));_0xb1ba54(_0x5efa0c[_0x7bda('0x19')]['message']);}})['catch'](function(_0x5e5aa2){logger['error'](_0x7bda('0x11'),_0x125456,_0x5e5aa2);_0x47141e(_0x5e5aa2);});});}exports[_0x7bda('0x1a')]=function(_0x519ca3){var _0x151fb9=this;return new Promise(function(_0x1519f1,_0x308cdd){return db[_0x7bda('0x1b')][_0x7bda('0x1c')]({'raw':_0x519ca3[_0x7bda('0x1d')]?_0x519ca3[_0x7bda('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x519ca3[_0x7bda('0x1d')]?_0x519ca3[_0x7bda('0x1d')]['where']||null:null,'attributes':_0x519ca3[_0x7bda('0x1d')]?_0x519ca3[_0x7bda('0x1d')][_0x7bda('0x1e')]||null:null,'include':_0x519ca3[_0x7bda('0x1d')]?_0x519ca3[_0x7bda('0x1d')][_0x7bda('0x1f')]?_[_0x7bda('0x20')](_0x519ca3['options'][_0x7bda('0x1f')],function(_0x587ebc){return{'model':db[_0x587ebc[_0x7bda('0x21')]],'as':_0x587ebc['as'],'attributes':_0x587ebc['attributes'],'include':_0x587ebc[_0x7bda('0x1f')]?_[_0x7bda('0x20')](_0x587ebc['include'],function(_0xb3ff36){return{'model':db[_0xb3ff36[_0x7bda('0x21')]],'as':_0xb3ff36['as'],'attributes':_0xb3ff36[_0x7bda('0x1e')],'include':_0xb3ff36[_0x7bda('0x1f')]?_['map'](_0xb3ff36[_0x7bda('0x1f')],function(_0x1d1bd6){return{'model':db[_0x1d1bd6[_0x7bda('0x21')]],'as':_0x1d1bd6['as'],'attributes':_0x1d1bd6[_0x7bda('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7bda('0x22')](function(_0x646d5c){logger[_0x7bda('0x10')](_0x7bda('0x1a'),_0x519ca3);logger[_0x7bda('0x13')](_0x7bda('0x1a'),_0x519ca3,JSON[_0x7bda('0x15')](_0x646d5c));_0x1519f1(_0x646d5c);})[_0x7bda('0x23')](function(_0x5ed974){logger[_0x7bda('0x16')](_0x7bda('0x1a'),_0x5ed974[_0x7bda('0x18')],_0x519ca3);_0x308cdd(_0x151fb9[_0x7bda('0x16')](0x1f4,_0x5ed974[_0x7bda('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 711df62..3fc74dd 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 d28040f..bdadba6 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5b3a7c,_0x275e07){var _0x2ff8cf=function(_0x2aeb19){while(--_0x2aeb19){_0x5b3a7c['push'](_0x5b3a7c['shift']());}};_0x2ff8cf(++_0x275e07);}(_0x34e8,0x12c));var _0x834e=function(_0x373b35,_0x55acee){_0x373b35=_0x373b35-0x0;var _0x393299=_0x34e8[_0x373b35];return _0x393299;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x4b354f,_0x350965){var _0xe3f93c=function(_0x3cb787){while(--_0x3cb787){_0x4b354f['push'](_0x4b354f['shift']());}};_0xe3f93c(++_0x350965);}(_0x3e74,0x175));var _0x43e7=function(_0x1b739f,_0x3b7a10){_0x1b739f=_0x1b739f-0x0;var _0x37d93f=_0x3e74[_0x1b739f];return _0x37d93f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('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 8de4540..939732d 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 _0x1c75=['STRING','noop','*,*,*,*','sequelize','INTEGER'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x1c75,0xdf));var _0x51c7=function(_0x54514c,_0xf1c84a){_0x54514c=_0x54514c-0x0;var _0x5cd80e=_0x1c75[_0x54514c];return _0x5cd80e;};'use strict';var Sequelize=require(_0x51c7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x51c7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x51c7('0x2')],'allowNull':![],'defaultValue':_0x51c7('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x51c7('0x2')]},'interval':{'type':Sequelize[_0x51c7('0x2')],'defaultValue':_0x51c7('0x4')}}; \ No newline at end of file +var _0xdccf=['TEXT','STRING','exports','INTEGER','noop'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xdccf,0xed));var _0xfdcc=function(_0x492f6a,_0x4cdd05){_0x492f6a=_0x492f6a-0x0;var _0x2082ca=_0xdccf[_0x492f6a];return _0x2082ca;};'use strict';var Sequelize=require('sequelize');module[_0xfdcc('0x0')]={'priority':{'type':Sequelize[_0xfdcc('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfdcc('0x2')},'appdata':{'type':Sequelize[_0xfdcc('0x3')]()},'description':{'type':Sequelize[_0xfdcc('0x4')]},'interval':{'type':Sequelize[_0xfdcc('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index bed28f4..6f87416 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 _0x9adc=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','params','intersection','length','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x826040,_0x293211){var _0x4f8c12=function(_0x26aaeb){while(--_0x26aaeb){_0x826040['push'](_0x826040['shift']());}};_0x4f8c12(++_0x293211);}(_0x9adc,0xc2));var _0xc9ad=function(_0x21f8b7,_0x9a3278){_0x21f8b7=_0x21f8b7-0x0;var _0x294bd0=_0x9adc[_0x21f8b7];return _0x294bd0;};'use strict';var emlformat=require(_0xc9ad('0x0'));var rimraf=require(_0xc9ad('0x1'));var zipdir=require(_0xc9ad('0x2'));var jsonpatch=require(_0xc9ad('0x3'));var rp=require(_0xc9ad('0x4'));var moment=require(_0xc9ad('0x5'));var BPromise=require(_0xc9ad('0x6'));var Mustache=require(_0xc9ad('0x7'));var util=require('util');var path=require(_0xc9ad('0x8'));var sox=require(_0xc9ad('0x9'));var csv=require(_0xc9ad('0xa'));var ejs=require(_0xc9ad('0xb'));var fs=require('fs');var fs_extra=require(_0xc9ad('0xc'));var _=require('lodash');var squel=require(_0xc9ad('0xd'));var crypto=require(_0xc9ad('0xe'));var jsforce=require(_0xc9ad('0xf'));var deskjs=require(_0xc9ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc9ad('0x11'));var Papa=require(_0xc9ad('0x12'));var Redis=require(_0xc9ad('0x13'));var authService=require(_0xc9ad('0x14'));var qs=require(_0xc9ad('0x15'));var as=require(_0xc9ad('0x16'));var hardwareService=require(_0xc9ad('0x17'));var logger=require('../../config/logger')(_0xc9ad('0x18'));var utils=require(_0xc9ad('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc9ad('0x1a'));var db=require(_0xc9ad('0x1b'))['db'];function respondWithStatusCode(_0x4a7a73,_0x333f28){_0x333f28=_0x333f28||0xcc;return function(_0x57d9ab){if(_0x57d9ab){return _0x4a7a73[_0xc9ad('0x1c')](_0x333f28);}return _0x4a7a73['status'](_0x333f28)[_0xc9ad('0x1d')]();};}function respondWithResult(_0x58787a,_0x435a50){_0x435a50=_0x435a50||0xc8;return function(_0x2d1fb3){if(_0x2d1fb3){return _0x58787a[_0xc9ad('0x1e')](_0x435a50)['json'](_0x2d1fb3);}};}function respondWithFilteredResult(_0x5da3bc,_0x166f5a){return function(_0x90d13){if(_0x90d13){var _0x34efc2=typeof _0x166f5a[_0xc9ad('0x1f')]===_0xc9ad('0x20')&&typeof _0x166f5a[_0xc9ad('0x21')]===_0xc9ad('0x20');var _0x389e46=_0x90d13['count'];var _0xc78ff1=_0x34efc2?0x0:_0x166f5a[_0xc9ad('0x1f')];var _0x2469e3=_0x34efc2?_0x90d13[_0xc9ad('0x22')]:_0x166f5a['offset']+_0x166f5a[_0xc9ad('0x21')];var _0x3f1506;if(_0x2469e3>=_0x389e46){_0x2469e3=_0x389e46;_0x3f1506=0xc8;}else{_0x3f1506=0xce;}_0x5da3bc[_0xc9ad('0x1e')](_0x3f1506);return _0x5da3bc[_0xc9ad('0x23')](_0xc9ad('0x24'),_0xc78ff1+'-'+_0x2469e3+'/'+_0x389e46)['json'](_0x90d13);}return null;};}function patchUpdates(_0xf42a7e){return function(_0x263438){try{jsonpatch['apply'](_0x263438,_0xf42a7e,!![]);}catch(_0x2d74ed){return BPromise['reject'](_0x2d74ed);}return _0x263438[_0xc9ad('0x25')]();};}function saveUpdates(_0xe8c37f,_0x267f0e){return function(_0x2d5fd0){if(_0x2d5fd0){return _0x2d5fd0['update'](_0xe8c37f)[_0xc9ad('0x26')](function(_0x50d39d){return _0x50d39d;});}return null;};}function removeEntity(_0x1628b1,_0x4bbfbd){return function(_0x20e3f5){if(_0x20e3f5){return _0x20e3f5[_0xc9ad('0x27')]()[_0xc9ad('0x26')](function(){_0x1628b1[_0xc9ad('0x1e')](0xcc)[_0xc9ad('0x1d')]();});}};}function handleEntityNotFound(_0x1cb31f,_0x865689){return function(_0xd72fc0){if(!_0xd72fc0){_0x1cb31f[_0xc9ad('0x1c')](0x194);}return _0xd72fc0;};}function handleError(_0x37dc80,_0x10339f){_0x10339f=_0x10339f||0x1f4;return function(_0x5bb1f8){logger[_0xc9ad('0x28')](_0x5bb1f8[_0xc9ad('0x29')]);if(_0x5bb1f8['name']){delete _0x5bb1f8[_0xc9ad('0x2a')];}_0x37dc80[_0xc9ad('0x1e')](_0x10339f)['send'](_0x5bb1f8);};}exports['index']=function(_0x4f0274,_0x421c71){var _0x3bcd09={},_0x102247={},_0x32a7c9={'count':0x0,'rows':[]};var _0x36ab45=_[_0xc9ad('0x2b')](db[_0xc9ad('0x2c')][_0xc9ad('0x2d')],function(_0x49761e){return{'name':_0x49761e['fieldName'],'type':_0x49761e['type'][_0xc9ad('0x2e')]};});_0x102247['model']=_[_0xc9ad('0x2b')](_0x36ab45,_0xc9ad('0x2a'));_0x102247[_0xc9ad('0x2f')]=_[_0xc9ad('0x30')](_0x4f0274[_0xc9ad('0x2f')]);_0x102247[_0xc9ad('0x31')]=_['intersection'](_0x102247['model'],_0x102247[_0xc9ad('0x2f')]);_0x3bcd09['attributes']=_['intersection'](_0x102247[_0xc9ad('0x32')],qs[_0xc9ad('0x33')](_0x4f0274[_0xc9ad('0x2f')]['fields']));_0x3bcd09[_0xc9ad('0x34')]=_0x3bcd09[_0xc9ad('0x34')]['length']?_0x3bcd09[_0xc9ad('0x34')]:_0x102247[_0xc9ad('0x32')];if(!_0x4f0274[_0xc9ad('0x2f')][_0xc9ad('0x35')](_0xc9ad('0x36'))){_0x3bcd09['limit']=qs[_0xc9ad('0x21')](_0x4f0274[_0xc9ad('0x2f')][_0xc9ad('0x21')]);_0x3bcd09[_0xc9ad('0x1f')]=qs[_0xc9ad('0x1f')](_0x4f0274['query'][_0xc9ad('0x1f')]);}_0x3bcd09['order']=qs[_0xc9ad('0x37')](_0x4f0274[_0xc9ad('0x2f')][_0xc9ad('0x37')]);_0x3bcd09[_0xc9ad('0x38')]=qs[_0xc9ad('0x31')](_[_0xc9ad('0x39')](_0x4f0274['query'],_0x102247['filters']),_0x36ab45);if(_0x4f0274[_0xc9ad('0x2f')][_0xc9ad('0x3a')]){_0x3bcd09[_0xc9ad('0x38')]=_[_0xc9ad('0x3b')](_0x3bcd09[_0xc9ad('0x38')],{'$or':_[_0xc9ad('0x2b')](_0x36ab45,function(_0x5b635a){if(_0x5b635a[_0xc9ad('0x3c')]!==_0xc9ad('0x3d')){var _0x2b4603={};_0x2b4603[_0x5b635a[_0xc9ad('0x2a')]]={'$like':'%'+_0x4f0274[_0xc9ad('0x2f')][_0xc9ad('0x3a')]+'%'};return _0x2b4603;}})});}_0x3bcd09=_['merge']({},_0x3bcd09,_0x4f0274[_0xc9ad('0x3e')]);var _0x18c0a5={'where':_0x3bcd09[_0xc9ad('0x38')]};return db[_0xc9ad('0x2c')][_0xc9ad('0x22')](_0x18c0a5)['then'](function(_0x5a2f6d){_0x32a7c9['count']=_0x5a2f6d;if(_0x4f0274['query'][_0xc9ad('0x3f')]){_0x3bcd09['include']=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x3bcd09);})[_0xc9ad('0x26')](function(_0x519770){_0x32a7c9[_0xc9ad('0x40')]=_0x519770;return _0x32a7c9;})[_0xc9ad('0x26')](respondWithFilteredResult(_0x421c71,_0x3bcd09))['catch'](handleError(_0x421c71,null));};exports[_0xc9ad('0x41')]=function(_0x567bc0,_0x3e61b6){var _0x153416={'raw':!![],'where':{'id':_0x567bc0[_0xc9ad('0x42')]['id']}},_0x522c27={};_0x522c27[_0xc9ad('0x32')]=_[_0xc9ad('0x30')](db[_0xc9ad('0x2c')][_0xc9ad('0x2d')]);_0x522c27[_0xc9ad('0x2f')]=_[_0xc9ad('0x30')](_0x567bc0[_0xc9ad('0x2f')]);_0x522c27[_0xc9ad('0x31')]=_[_0xc9ad('0x43')](_0x522c27['model'],_0x522c27['query']);_0x153416[_0xc9ad('0x34')]=_[_0xc9ad('0x43')](_0x522c27[_0xc9ad('0x32')],qs[_0xc9ad('0x33')](_0x567bc0['query'][_0xc9ad('0x33')]));_0x153416['attributes']=_0x153416[_0xc9ad('0x34')][_0xc9ad('0x44')]?_0x153416[_0xc9ad('0x34')]:_0x522c27['model'];if(_0x567bc0[_0xc9ad('0x2f')][_0xc9ad('0x3f')]){_0x153416['include']=[{'all':!![]}];}_0x153416=_[_0xc9ad('0x3b')]({},_0x153416,_0x567bc0[_0xc9ad('0x3e')]);return db['SmsApplication']['find'](_0x153416)[_0xc9ad('0x26')](handleEntityNotFound(_0x3e61b6,null))['then'](respondWithResult(_0x3e61b6,null))[_0xc9ad('0x45')](handleError(_0x3e61b6,null));};exports[_0xc9ad('0x46')]=function(_0x54ced0,_0xfc4bf5){return db[_0xc9ad('0x2c')]['create'](_0x54ced0[_0xc9ad('0x47')],{})[_0xc9ad('0x26')](respondWithResult(_0xfc4bf5,0xc9))['catch'](handleError(_0xfc4bf5,null));};exports['update']=function(_0xc892e3,_0xda62fa){if(_0xc892e3[_0xc9ad('0x47')]['id']){delete _0xc892e3[_0xc9ad('0x47')]['id'];}return db[_0xc9ad('0x2c')][_0xc9ad('0x48')]({'where':{'id':_0xc892e3[_0xc9ad('0x42')]['id']}})[_0xc9ad('0x26')](handleEntityNotFound(_0xda62fa,null))['then'](saveUpdates(_0xc892e3[_0xc9ad('0x47')],null))[_0xc9ad('0x26')](respondWithResult(_0xda62fa,null))[_0xc9ad('0x45')](handleError(_0xda62fa,null));};exports[_0xc9ad('0x27')]=function(_0x36cdd8,_0x1bf2e9){return db[_0xc9ad('0x2c')]['find']({'where':{'id':_0x36cdd8['params']['id']}})[_0xc9ad('0x26')](handleEntityNotFound(_0x1bf2e9,null))[_0xc9ad('0x26')](removeEntity(_0x1bf2e9,null))[_0xc9ad('0x45')](handleError(_0x1bf2e9,null));}; \ No newline at end of file +var _0xb158=['includeAll','include','findAll','rows','catch','show','params','length','find','create','body','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x30d479,_0x5c68ac){var _0x25a415=function(_0x348b46){while(--_0x348b46){_0x30d479['push'](_0x30d479['shift']());}};_0x25a415(++_0x5c68ac);}(_0xb158,0xa1));var _0x8b15=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xb158[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b15('0x0'));var zipdir=require(_0x8b15('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b15('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b15('0x3'));var util=require(_0x8b15('0x4'));var path=require(_0x8b15('0x5'));var sox=require(_0x8b15('0x6'));var csv=require(_0x8b15('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b15('0x8'));var _=require('lodash');var squel=require(_0x8b15('0x9'));var crypto=require(_0x8b15('0xa'));var jsforce=require(_0x8b15('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8b15('0x7'));var querystring=require('querystring');var Papa=require(_0x8b15('0xc'));var Redis=require(_0x8b15('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8b15('0xe'));var as=require(_0x8b15('0xf'));var hardwareService=require(_0x8b15('0x10'));var logger=require(_0x8b15('0x11'))(_0x8b15('0x12'));var utils=require(_0x8b15('0x13'));var config=require(_0x8b15('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b15('0x15'))['db'];function respondWithStatusCode(_0x414149,_0x2d0b73){_0x2d0b73=_0x2d0b73||0xcc;return function(_0x4dfd19){if(_0x4dfd19){return _0x414149['sendStatus'](_0x2d0b73);}return _0x414149[_0x8b15('0x16')](_0x2d0b73)[_0x8b15('0x17')]();};}function respondWithResult(_0x4c5587,_0xa99770){_0xa99770=_0xa99770||0xc8;return function(_0x446b87){if(_0x446b87){return _0x4c5587[_0x8b15('0x16')](_0xa99770)[_0x8b15('0x18')](_0x446b87);}};}function respondWithFilteredResult(_0x3d5e60,_0x595b8b){return function(_0x42b240){if(_0x42b240){var _0x18521e=typeof _0x595b8b['offset']===_0x8b15('0x19')&&typeof _0x595b8b['limit']===_0x8b15('0x19');var _0x49ea65=_0x42b240['count'];var _0x345d7b=_0x18521e?0x0:_0x595b8b['offset'];var _0x39f644=_0x18521e?_0x42b240[_0x8b15('0x1a')]:_0x595b8b[_0x8b15('0x1b')]+_0x595b8b['limit'];var _0x351b36;if(_0x39f644>=_0x49ea65){_0x39f644=_0x49ea65;_0x351b36=0xc8;}else{_0x351b36=0xce;}_0x3d5e60[_0x8b15('0x16')](_0x351b36);return _0x3d5e60[_0x8b15('0x1c')](_0x8b15('0x1d'),_0x345d7b+'-'+_0x39f644+'/'+_0x49ea65)[_0x8b15('0x18')](_0x42b240);}return null;};}function patchUpdates(_0x10061c){return function(_0xca7943){try{jsonpatch[_0x8b15('0x1e')](_0xca7943,_0x10061c,!![]);}catch(_0x495937){return BPromise[_0x8b15('0x1f')](_0x495937);}return _0xca7943[_0x8b15('0x20')]();};}function saveUpdates(_0x22f414,_0x6d551e){return function(_0x23e954){if(_0x23e954){return _0x23e954[_0x8b15('0x21')](_0x22f414)[_0x8b15('0x22')](function(_0x3ee5ec){return _0x3ee5ec;});}return null;};}function removeEntity(_0x742ca5,_0x1fcfe2){return function(_0x4b5511){if(_0x4b5511){return _0x4b5511[_0x8b15('0x23')]()[_0x8b15('0x22')](function(){_0x742ca5[_0x8b15('0x16')](0xcc)[_0x8b15('0x17')]();});}};}function handleEntityNotFound(_0x3bc235,_0x4a2569){return function(_0x46d624){if(!_0x46d624){_0x3bc235['sendStatus'](0x194);}return _0x46d624;};}function handleError(_0x189485,_0x2d9ef7){_0x2d9ef7=_0x2d9ef7||0x1f4;return function(_0x3e5dc5){logger[_0x8b15('0x24')](_0x3e5dc5[_0x8b15('0x25')]);if(_0x3e5dc5[_0x8b15('0x26')]){delete _0x3e5dc5[_0x8b15('0x26')];}_0x189485[_0x8b15('0x16')](_0x2d9ef7)[_0x8b15('0x27')](_0x3e5dc5);};}exports[_0x8b15('0x28')]=function(_0x101cb5,_0x484e84){var _0x1d4199={},_0x421943={},_0x5658b3={'count':0x0,'rows':[]};var _0x257231=_[_0x8b15('0x29')](db[_0x8b15('0x2a')][_0x8b15('0x2b')],function(_0x1be0c8){return{'name':_0x1be0c8[_0x8b15('0x2c')],'type':_0x1be0c8[_0x8b15('0x2d')][_0x8b15('0x2e')]};});_0x421943['model']=_['map'](_0x257231,_0x8b15('0x26'));_0x421943[_0x8b15('0x2f')]=_[_0x8b15('0x30')](_0x101cb5[_0x8b15('0x2f')]);_0x421943[_0x8b15('0x31')]=_['intersection'](_0x421943[_0x8b15('0x32')],_0x421943[_0x8b15('0x2f')]);_0x1d4199[_0x8b15('0x33')]=_[_0x8b15('0x34')](_0x421943['model'],qs[_0x8b15('0x35')](_0x101cb5[_0x8b15('0x2f')]['fields']));_0x1d4199[_0x8b15('0x33')]=_0x1d4199[_0x8b15('0x33')]['length']?_0x1d4199['attributes']:_0x421943[_0x8b15('0x32')];if(!_0x101cb5[_0x8b15('0x2f')]['hasOwnProperty'](_0x8b15('0x36'))){_0x1d4199[_0x8b15('0x37')]=qs['limit'](_0x101cb5[_0x8b15('0x2f')]['limit']);_0x1d4199['offset']=qs['offset'](_0x101cb5[_0x8b15('0x2f')][_0x8b15('0x1b')]);}_0x1d4199[_0x8b15('0x38')]=qs[_0x8b15('0x39')](_0x101cb5['query'][_0x8b15('0x39')]);_0x1d4199[_0x8b15('0x3a')]=qs['filters'](_[_0x8b15('0x3b')](_0x101cb5[_0x8b15('0x2f')],_0x421943['filters']),_0x257231);if(_0x101cb5[_0x8b15('0x2f')][_0x8b15('0x3c')]){_0x1d4199[_0x8b15('0x3a')]=_[_0x8b15('0x3d')](_0x1d4199['where'],{'$or':_[_0x8b15('0x29')](_0x257231,function(_0x39ae6a){if(_0x39ae6a[_0x8b15('0x2d')]!==_0x8b15('0x3e')){var _0x21db65={};_0x21db65[_0x39ae6a['name']]={'$like':'%'+_0x101cb5[_0x8b15('0x2f')][_0x8b15('0x3c')]+'%'};return _0x21db65;}})});}_0x1d4199=_['merge']({},_0x1d4199,_0x101cb5[_0x8b15('0x3f')]);var _0x27552a={'where':_0x1d4199[_0x8b15('0x3a')]};return db[_0x8b15('0x2a')][_0x8b15('0x1a')](_0x27552a)[_0x8b15('0x22')](function(_0x2b010e){_0x5658b3[_0x8b15('0x1a')]=_0x2b010e;if(_0x101cb5['query'][_0x8b15('0x40')]){_0x1d4199[_0x8b15('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0x8b15('0x42')](_0x1d4199);})[_0x8b15('0x22')](function(_0x4d66d2){_0x5658b3[_0x8b15('0x43')]=_0x4d66d2;return _0x5658b3;})[_0x8b15('0x22')](respondWithFilteredResult(_0x484e84,_0x1d4199))[_0x8b15('0x44')](handleError(_0x484e84,null));};exports[_0x8b15('0x45')]=function(_0x993920,_0x70fb){var _0x4a72bf={'raw':!![],'where':{'id':_0x993920[_0x8b15('0x46')]['id']}},_0x1d25a5={};_0x1d25a5['model']=_[_0x8b15('0x30')](db[_0x8b15('0x2a')][_0x8b15('0x2b')]);_0x1d25a5['query']=_[_0x8b15('0x30')](_0x993920['query']);_0x1d25a5[_0x8b15('0x31')]=_[_0x8b15('0x34')](_0x1d25a5[_0x8b15('0x32')],_0x1d25a5[_0x8b15('0x2f')]);_0x4a72bf['attributes']=_[_0x8b15('0x34')](_0x1d25a5[_0x8b15('0x32')],qs[_0x8b15('0x35')](_0x993920[_0x8b15('0x2f')][_0x8b15('0x35')]));_0x4a72bf['attributes']=_0x4a72bf['attributes'][_0x8b15('0x47')]?_0x4a72bf[_0x8b15('0x33')]:_0x1d25a5[_0x8b15('0x32')];if(_0x993920['query']['includeAll']){_0x4a72bf[_0x8b15('0x41')]=[{'all':!![]}];}_0x4a72bf=_['merge']({},_0x4a72bf,_0x993920[_0x8b15('0x3f')]);return db[_0x8b15('0x2a')][_0x8b15('0x48')](_0x4a72bf)['then'](handleEntityNotFound(_0x70fb,null))[_0x8b15('0x22')](respondWithResult(_0x70fb,null))[_0x8b15('0x44')](handleError(_0x70fb,null));};exports[_0x8b15('0x49')]=function(_0x107671,_0x26731b){return db[_0x8b15('0x2a')][_0x8b15('0x49')](_0x107671['body'],{})['then'](respondWithResult(_0x26731b,0xc9))['catch'](handleError(_0x26731b,null));};exports[_0x8b15('0x21')]=function(_0x56e33b,_0x55b1ee){if(_0x56e33b['body']['id']){delete _0x56e33b[_0x8b15('0x4a')]['id'];}return db[_0x8b15('0x2a')][_0x8b15('0x48')]({'where':{'id':_0x56e33b[_0x8b15('0x46')]['id']}})[_0x8b15('0x22')](handleEntityNotFound(_0x55b1ee,null))[_0x8b15('0x22')](saveUpdates(_0x56e33b[_0x8b15('0x4a')],null))[_0x8b15('0x22')](respondWithResult(_0x55b1ee,null))[_0x8b15('0x44')](handleError(_0x55b1ee,null));};exports[_0x8b15('0x23')]=function(_0x41a55b,_0x1d0c32){return db[_0x8b15('0x2a')]['find']({'where':{'id':_0x41a55b['params']['id']}})[_0x8b15('0x22')](handleEntityNotFound(_0x1d0c32,null))[_0x8b15('0x22')](removeEntity(_0x1d0c32,null))[_0x8b15('0x44')](handleError(_0x1d0c32,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ec0b818..3f5f195 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 _0x5d19=['request-promise','rimraf','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x426ab0,_0x13c67d){var _0x3bdb3d=function(_0x14f669){while(--_0x14f669){_0x426ab0['push'](_0x426ab0['shift']());}};_0x3bdb3d(++_0x13c67d);}(_0x5d19,0x1a9));var _0x95d1=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x5d19[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0x95d1('0x0'));var util=require(_0x95d1('0x1'));var logger=require(_0x95d1('0x2'))(_0x95d1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95d1('0x5'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x95d1('0x6')]=function(_0x234804,_0x346634){return _0x234804[_0x95d1('0x7')]('SmsApplication',attributes,{'tableName':_0x95d1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95d1('0x9'),'collate':_0x95d1('0xa')});}; \ No newline at end of file +var _0xf99c=['rimraf','exports','SmsApplication','util','api','bluebird','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf99c,0x88));var _0xcf99=function(_0x2c03c2,_0x190200){_0x2c03c2=_0x2c03c2-0x0;var _0xfd4013=_0xf99c[_0x2c03c2];return _0xfd4013;};'use strict';var _=require('lodash');var util=require(_0xcf99('0x0'));var logger=require('../../config/logger')(_0xcf99('0x1'));var moment=require('moment');var BPromise=require(_0xcf99('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf99('0x3'));var rimraf=require(_0xcf99('0x4'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xcf99('0x5')]=function(_0x563c68,_0x420c09){return _0x563c68['define'](_0xcf99('0x6'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index a724f20..c0bb4f4 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 _0xb6fa=['then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2a005d,_0x4b17d9){var _0x507f83=function(_0x102719){while(--_0x102719){_0x2a005d['push'](_0x2a005d['shift']());}};_0x507f83(++_0x4b17d9);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xb6fa[_0x946518];return _0x909b69;};'use strict';var _=require(_0xab6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab6f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab6f('0x2'))['db'];var utils=require(_0xab6f('0x3'));var logger=require('../../config/logger')(_0xab6f('0x4'));var config=require(_0xab6f('0x5'));var jayson=require(_0xab6f('0x6'));var client=jayson[_0xab6f('0x7')][_0xab6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x895acc,_0x16b84e,_0x1b4da9){return new BPromise(function(_0x46b0f6,_0x85cb19){return client[_0xab6f('0x9')](_0x895acc,_0x1b4da9)[_0xab6f('0xa')](function(_0x199f2d){logger[_0xab6f('0xb')](_0xab6f('0xc'),_0x16b84e,_0xab6f('0xd'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x16b84e,_0xab6f('0xd'),JSON[_0xab6f('0xe')](_0x199f2d));if(_0x199f2d['error']){if(_0x199f2d[_0xab6f('0xf')][_0xab6f('0x10')]===0x1f4){logger[_0xab6f('0xf')](_0xab6f('0xc'),_0x16b84e,_0x199f2d[_0xab6f('0xf')][_0xab6f('0x11')]);return _0x85cb19(_0x199f2d[_0xab6f('0xf')]['message']);}logger[_0xab6f('0xf')](_0xab6f('0xc'),_0x16b84e,_0x199f2d[_0xab6f('0xf')]['message']);return _0x46b0f6(_0x199f2d[_0xab6f('0xf')]['message']);}else{logger['info'](_0xab6f('0xc'),_0x16b84e,'request\x20sent');_0x46b0f6(_0x199f2d[_0xab6f('0x12')][_0xab6f('0x11')]);}})[_0xab6f('0x13')](function(_0x59b934){logger[_0xab6f('0xf')]('SmsApplication,\x20%s,\x20%s',_0x16b84e,_0x59b934);_0x85cb19(_0x59b934);});});} \ No newline at end of file +var _0xdaa8=['client','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../config/environment','jayson/promise'];(function(_0x4f9dbf,_0x50b96b){var _0x2a1a89=function(_0x3810de){while(--_0x3810de){_0x4f9dbf['push'](_0x4f9dbf['shift']());}};_0x2a1a89(++_0x50b96b);}(_0xdaa8,0xe4));var _0x8daa=function(_0x2544a1,_0xed396d){_0x2544a1=_0x2544a1-0x0;var _0xb7bb88=_0xdaa8[_0x2544a1];return _0xb7bb88;};'use strict';var _=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var moment=require(_0x8daa('0x2'));var BPromise=require(_0x8daa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8daa('0x4'));var jayson=require(_0x8daa('0x5'));var client=jayson[_0x8daa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e8116,_0x1f5a97,_0x48bf41){return new BPromise(function(_0x41de3e,_0x2df1a0){return client[_0x8daa('0x7')](_0x4e8116,_0x48bf41)[_0x8daa('0x8')](function(_0x207291){logger['info'](_0x8daa('0x9'),_0x1f5a97,_0x8daa('0xa'));logger[_0x8daa('0xb')](_0x8daa('0xc'),_0x1f5a97,_0x8daa('0xa'),JSON[_0x8daa('0xd')](_0x207291));if(_0x207291[_0x8daa('0xe')]){if(_0x207291[_0x8daa('0xe')][_0x8daa('0xf')]===0x1f4){logger[_0x8daa('0xe')](_0x8daa('0x9'),_0x1f5a97,_0x207291['error'][_0x8daa('0x10')]);return _0x2df1a0(_0x207291[_0x8daa('0xe')][_0x8daa('0x10')]);}logger['error'](_0x8daa('0x9'),_0x1f5a97,_0x207291['error'][_0x8daa('0x10')]);return _0x41de3e(_0x207291[_0x8daa('0xe')][_0x8daa('0x10')]);}else{logger['info'](_0x8daa('0x9'),_0x1f5a97,_0x8daa('0xa'));_0x41de3e(_0x207291['result']['message']);}})[_0x8daa('0x11')](function(_0x2fc822){logger[_0x8daa('0xe')](_0x8daa('0x9'),_0x1f5a97,_0x2fc822);_0x2df1a0(_0x2fc822);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a2607aa..ca25170 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 _0x4cf8=['/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','describe'];(function(_0x5211a6,_0x1b8295){var _0x5651c3=function(_0x40da62){while(--_0x40da62){_0x5211a6['push'](_0x5211a6['shift']());}};_0x5651c3(++_0x1b8295);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x39f375,_0x3aa8ec){_0x39f375=_0x39f375-0x0;var _0x463f93=_0x4cf8[_0x39f375];return _0x463f93;};'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')]('/describe',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['get'](_0x84cf('0xe'),auth[_0x84cf('0xc')](),controller['show']);router[_0x84cf('0xb')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router['get'](_0x84cf('0x11'),auth[_0x84cf('0xc')](),controller['download']);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x14')]);router[_0x84cf('0x13')](_0x84cf('0x15'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x18')),controller[_0x84cf('0x19')]);router[_0x84cf('0x1a')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1b')),controller['update']);router[_0x84cf('0x1c')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1d')),controller[_0x84cf('0x1e')]);router['delete']('/:id/tags',auth[_0x84cf('0xc')](),controller[_0x84cf('0x1f')]);module[_0x84cf('0x20')]=router; \ No newline at end of file +var _0xf7b4=['/describe','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index'];(function(_0x2c57fa,_0xadc694){var _0x5398cc=function(_0x251129){while(--_0x251129){_0x2c57fa['push'](_0x2c57fa['shift']());}};_0x5398cc(++_0xadc694);}(_0xf7b4,0x152));var _0x4f7b=function(_0x105ede,_0x6ecf){_0x105ede=_0x105ede-0x0;var _0x4993fb=_0xf7b4[_0x105ede];return _0x4993fb;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/messages',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0x7')](_0x4f7b('0xf'),auth[_0x4f7b('0x8')](),controller['download']);router[_0x4f7b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f7b('0x10')](_0x4f7b('0x11'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['post'](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x16')),controller[_0x4f7b('0x17')]);router[_0x4f7b('0x18')](_0x4f7b('0xc'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x19')),controller['update']);router[_0x4f7b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),'smsinteraction:destroy'),controller[_0x4f7b('0x1b')]);router[_0x4f7b('0x1a')](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),controller['removeTags']);module[_0x4f7b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index b1463ba..7d5d3f1 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 _0x1f75=['moment','exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x27a45e,_0x4b6550){var _0x418a22=function(_0x31329b){while(--_0x31329b){_0x27a45e['push'](_0x27a45e['shift']());}};_0x418a22(++_0x4b6550);}(_0x1f75,0x12c));var _0x51f7=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x1f75[_0x455c6c];return _0x488242;};'use strict';var Sequelize=require(_0x51f7('0x0'));var moment=require(_0x51f7('0x1'));module[_0x51f7('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x51f7('0x3')]},'disposition':{'type':Sequelize[_0x51f7('0x4')]},'secondDisposition':{'type':Sequelize[_0x51f7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x51f7('0x4')]},'note':{'type':Sequelize[_0x51f7('0x4')]},'phone':{'type':Sequelize[_0x51f7('0x4')]},'read1stAt':{'type':Sequelize[_0x51f7('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x51f7('0x5')]('in',_0x51f7('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x51f7('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x51f7('0x5')]('in',_0x51f7('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6208=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x5dbdf4,_0x822045){var _0xbc5bbe=function(_0x59d7dd){while(--_0x59d7dd){_0x5dbdf4['push'](_0x5dbdf4['shift']());}};_0xbc5bbe(++_0x822045);}(_0x6208,0x17d));var _0x8620=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x6208[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x8620('0x0'));var moment=require('moment');module[_0x8620('0x1')]={'closed':{'type':Sequelize[_0x8620('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8620('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8620('0x3')]},'note':{'type':Sequelize[_0x8620('0x3')]},'phone':{'type':Sequelize[_0x8620('0x3')]},'read1stAt':{'type':Sequelize[_0x8620('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8620('0x5')]('in',_0x8620('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8620('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8620('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8620('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3c85c2b..e75ad00 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 _0x8ee8=['closedAt','disposition','out','System','Contact','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','sendStatus','rimraf','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','name','send','index','map','SmsInteraction','rawAttributes','type','getOptions','findAll','sms','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','catch','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','pick','where','SmsInteractionId','filter','merge','$gte','split','format','SmsMessage','rows','addTags','spread','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','fullname','CmContact','lastName','Messages','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x1dbe0d,_0x105382){var _0x405ea4=function(_0x2c0e0f){while(--_0x2c0e0f){_0x1dbe0d['push'](_0x1dbe0d['shift']());}};_0x405ea4(++_0x105382);}(_0x8ee8,0x8b));var _0x88ee=function(_0x4a93e9,_0x5b569f){_0x4a93e9=_0x4a93e9-0x0;var _0x4b3ba7=_0x8ee8[_0x4a93e9];return _0x4b3ba7;};'use strict';var rimraf=require(_0x88ee('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x88ee('0x1'));var util=require(_0x88ee('0x2'));var path=require(_0x88ee('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x88ee('0x4'));var Redis=require(_0x88ee('0x5'));var interaction=require(_0x88ee('0x6'));var qs=require(_0x88ee('0x7'));var pdf=require(_0x88ee('0x8'));var logger=require(_0x88ee('0x9'))(_0x88ee('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x88ee('0xb')]=_[_0x88ee('0xc')](config[_0x88ee('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x88ee('0xd'))(new Redis(config[_0x88ee('0xb')]));require(_0x88ee('0xe'))[_0x88ee('0xf')](socket);function respondWithStatusCode(_0x303ce4,_0x11ff5c){_0x11ff5c=_0x11ff5c||0xcc;return function(_0x16dabb){if(_0x16dabb){return _0x303ce4['sendStatus'](_0x11ff5c);}return _0x303ce4[_0x88ee('0x10')](_0x11ff5c)[_0x88ee('0x11')]();};}function respondWithResult(_0x285012,_0x18b442){_0x18b442=_0x18b442||0xc8;return function(_0x12ed86){if(_0x12ed86){return _0x285012[_0x88ee('0x10')](_0x18b442)[_0x88ee('0x12')](_0x12ed86);}};}function respondWithFilteredResult(_0x332f31,_0xbe6411){return function(_0x77a127){if(_0x77a127){var _0x14f804=typeof _0xbe6411[_0x88ee('0x13')]==='undefined'&&typeof _0xbe6411[_0x88ee('0x14')]==='undefined';var _0x33613a=_0x77a127[_0x88ee('0x15')];var _0x36ab8c=_0x14f804?0x0:_0xbe6411[_0x88ee('0x13')];var _0x47fad5=_0x14f804?_0x77a127[_0x88ee('0x15')]:_0xbe6411[_0x88ee('0x13')]+_0xbe6411[_0x88ee('0x14')];var _0x33d201;if(_0x47fad5>=_0x33613a){_0x47fad5=_0x33613a;_0x33d201=0xc8;}else{_0x33d201=0xce;}_0x332f31[_0x88ee('0x10')](_0x33d201);return _0x332f31[_0x88ee('0x16')](_0x88ee('0x17'),_0x36ab8c+'-'+_0x47fad5+'/'+_0x33613a)['json'](_0x77a127);}return null;};}function saveUpdates(_0x101796){return function(_0x29ba8f){if(_0x29ba8f){return _0x29ba8f[_0x88ee('0x18')](_0x101796)[_0x88ee('0x19')](function(_0x52d73d){return _0x52d73d;});}return null;};}function removeEntity(_0x28fcff){return function(_0x1a37a2){if(_0x1a37a2){return _0x1a37a2[_0x88ee('0x1a')]()[_0x88ee('0x19')](function(){_0x28fcff[_0x88ee('0x10')](0xcc)[_0x88ee('0x11')]();});}};}function handleEntityNotFound(_0x555ab6){return function(_0x1b17fe){if(!_0x1b17fe){_0x555ab6['sendStatus'](0x194);}return _0x1b17fe;};}function handleError(_0x1f56c2,_0x48b73c){_0x48b73c=_0x48b73c||0x1f4;return function(_0x165fea){logger['error'](_0x165fea['stack']);if(_0x165fea['name']){delete _0x165fea[_0x88ee('0x1b')];}_0x1f56c2[_0x88ee('0x10')](_0x48b73c)[_0x88ee('0x1c')](_0x165fea);};}exports[_0x88ee('0x1d')]=function(_0x399864,_0x41f152){var _0x409630={};var _0x213c84=_[_0x88ee('0x1e')](db[_0x88ee('0x1f')][_0x88ee('0x20')],function(_0x1ff5e2){return{'name':_0x1ff5e2['fieldName'],'type':_0x1ff5e2[_0x88ee('0x21')]['key']};});_0x409630=qs[_0x88ee('0x22')](_0x213c84,_0x399864);return interaction[_0x88ee('0x23')](_0x88ee('0x24'),_0x399864[_0x88ee('0x25')],_0x399864[_0x88ee('0x26')],_0x409630,_0x213c84)[_0x88ee('0x19')](respondWithFilteredResult(_0x41f152,_0x409630))['catch'](handleError(_0x41f152,null));};exports[_0x88ee('0x27')]=function(_0x19c473,_0x1f7380){var _0xbc1f22={'raw':![],'where':{'id':_0x19c473[_0x88ee('0x28')]['id']}},_0x5b51b0={};_0x5b51b0[_0x88ee('0x29')]=_['keys'](db[_0x88ee('0x1f')][_0x88ee('0x20')]);_0x5b51b0[_0x88ee('0x25')]=_[_0x88ee('0x2a')](_0x19c473[_0x88ee('0x25')]);_0x5b51b0[_0x88ee('0x2b')]=_[_0x88ee('0x2c')](_0x5b51b0[_0x88ee('0x29')],_0x5b51b0[_0x88ee('0x25')]);_0xbc1f22[_0x88ee('0x2d')]=_['intersection'](_0x5b51b0[_0x88ee('0x29')],qs[_0x88ee('0x2e')](_0x19c473[_0x88ee('0x25')][_0x88ee('0x2e')]));_0xbc1f22[_0x88ee('0x2d')]=_0xbc1f22[_0x88ee('0x2d')][_0x88ee('0x2f')]?_0xbc1f22['attributes']:_0x5b51b0[_0x88ee('0x29')];if(_0x19c473[_0x88ee('0x25')][_0x88ee('0x30')]){_0xbc1f22[_0x88ee('0x31')]=[{'all':!![]}];}_0xbc1f22=_['merge']({},_0xbc1f22,_0x19c473[_0x88ee('0x32')]);return db[_0x88ee('0x1f')]['find'](_0xbc1f22)['then'](handleEntityNotFound(_0x1f7380,null))[_0x88ee('0x19')](respondWithResult(_0x1f7380,null))[_0x88ee('0x33')](handleError(_0x1f7380,null));};exports[_0x88ee('0x34')]=function(_0x168b74,_0x404c95){return db[_0x88ee('0x1f')][_0x88ee('0x34')](_0x168b74[_0x88ee('0x35')],{})['then'](respondWithResult(_0x404c95,0xc9))[_0x88ee('0x33')](handleError(_0x404c95,null));};exports['update']=function(_0x10eb58,_0x4c7ebf){if(_0x10eb58[_0x88ee('0x35')]['id']){delete _0x10eb58[_0x88ee('0x35')]['id'];}return db[_0x88ee('0x1f')][_0x88ee('0x36')]({'where':{'id':_0x10eb58[_0x88ee('0x28')]['id']}})[_0x88ee('0x19')](handleEntityNotFound(_0x4c7ebf,null))[_0x88ee('0x19')](saveUpdates(_0x10eb58[_0x88ee('0x35')],null))[_0x88ee('0x19')](respondWithResult(_0x4c7ebf,null))[_0x88ee('0x33')](handleError(_0x4c7ebf,null));};exports[_0x88ee('0x1a')]=function(_0x245dcf,_0x5c6c1e){return db[_0x88ee('0x1f')][_0x88ee('0x36')]({'where':{'id':_0x245dcf[_0x88ee('0x28')]['id']}})['then'](handleEntityNotFound(_0x5c6c1e,null))[_0x88ee('0x19')](removeEntity(_0x5c6c1e,null))[_0x88ee('0x33')](handleError(_0x5c6c1e,null));};exports[_0x88ee('0x37')]=function(_0x52baf6,_0x54a4c9){return db[_0x88ee('0x1f')][_0x88ee('0x37')]()[_0x88ee('0x19')](respondWithResult(_0x54a4c9,null))['catch'](handleError(_0x54a4c9,null));};exports[_0x88ee('0x38')]=function(_0x494c7e,_0x98a30){return db['SmsMessage'][_0x88ee('0x36')]({'where':{'id':_0x494c7e['params']['id']}})[_0x88ee('0x19')](handleEntityNotFound(_0x98a30,null))[_0x88ee('0x19')](function(_0x4d743d){if(_0x4d743d){return _0x4d743d[_0x88ee('0x38')](_0x494c7e['body'][_0x88ee('0x39')],_[_0x88ee('0x3a')](_0x494c7e[_0x88ee('0x35')],[_0x88ee('0x39'),'id'])||{});}})['then'](respondWithResult(_0x98a30,null))[_0x88ee('0x33')](handleError(_0x98a30,null));};exports[_0x88ee('0x3b')]=function(_0x54d465,_0x3c54a4){var _0xbf8344={'raw':![],'where':{}};var _0x9a6075={};var _0x4a8b3c={'count':0x0,'rows':[]};return db[_0x88ee('0x1f')][_0x88ee('0x3c')]({'where':{'id':_0x54d465[_0x88ee('0x28')]['id']}})[_0x88ee('0x19')](handleEntityNotFound(_0x3c54a4,null))['then'](function(_0x58d6e3){if(_0x58d6e3){_0x9a6075['model']=_[_0x88ee('0x2a')](db['SmsMessage'][_0x88ee('0x20')]);_0x9a6075[_0x88ee('0x25')]=_[_0x88ee('0x2a')](_0x54d465['query']);_0x9a6075[_0x88ee('0x2b')]=_[_0x88ee('0x2c')](_0x9a6075['model'],_0x9a6075[_0x88ee('0x25')]);_0xbf8344[_0x88ee('0x2d')]=_[_0x88ee('0x2c')](_0x9a6075['model'],qs['fields'](_0x54d465['query'][_0x88ee('0x2e')]));_0xbf8344['attributes']=_0xbf8344['attributes'][_0x88ee('0x2f')]?_0xbf8344['attributes']:_0x9a6075[_0x88ee('0x29')];if(!_0x54d465[_0x88ee('0x25')][_0x88ee('0x3d')](_0x88ee('0x3e'))){_0xbf8344[_0x88ee('0x14')]=qs[_0x88ee('0x14')](_0x54d465[_0x88ee('0x25')][_0x88ee('0x14')]);_0xbf8344[_0x88ee('0x13')]=qs[_0x88ee('0x13')](_0x54d465['query'][_0x88ee('0x13')]);}_0xbf8344['order']=qs[_0x88ee('0x3f')](_0x54d465[_0x88ee('0x25')][_0x88ee('0x3f')]);_0xbf8344['where']=qs[_0x88ee('0x2b')](_[_0x88ee('0x40')](_0x54d465[_0x88ee('0x25')],_0x9a6075[_0x88ee('0x2b')]));_0xbf8344[_0x88ee('0x41')][_0x88ee('0x42')]=_0x58d6e3['id'];if(_0x54d465[_0x88ee('0x25')][_0x88ee('0x43')]){_0xbf8344['where']=_[_0x88ee('0x44')](_0xbf8344[_0x88ee('0x41')],{'$or':_[_0x88ee('0x1e')](_0xbf8344[_0x88ee('0x2d')],function(_0x217308){var _0x1682ea={};_0x1682ea[_0x217308]={'$like':'%'+_0x54d465[_0x88ee('0x25')][_0x88ee('0x43')]+'%'};return _0x1682ea;})});}if(_0x54d465['query'][_0x88ee('0x45')]){var _0x944044=_0x54d465[_0x88ee('0x25')][_0x88ee('0x45')][_0x88ee('0x46')](',');var _0x4517b5={};_0x4517b5[_0x944044[0x0]]={'$gte':moment(_0x944044[0x1])[_0x88ee('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0xbf8344['where']=_['merge'](_0xbf8344[_0x88ee('0x41')],_0x4517b5);}_0xbf8344=_[_0x88ee('0x44')]({},_0xbf8344,_0x54d465[_0x88ee('0x32')]);return db[_0x88ee('0x48')][_0x88ee('0x15')]({'where':_0xbf8344[_0x88ee('0x41')]})[_0x88ee('0x19')](function(_0x15fe97){_0x4a8b3c[_0x88ee('0x15')]=_0x15fe97;if(_0x54d465[_0x88ee('0x25')][_0x88ee('0x30')]){_0xbf8344['include']=[{'all':!![]}];}return db['SmsMessage'][_0x88ee('0x23')](_0xbf8344);})['then'](function(_0x277ef5){_0x4a8b3c[_0x88ee('0x49')]=_0x277ef5;return _0x4a8b3c;});}})[_0x88ee('0x19')](respondWithFilteredResult(_0x3c54a4,_0xbf8344))['catch'](handleError(_0x3c54a4,null));};exports[_0x88ee('0x4a')]=function(_0x494b8b,_0x3279e8){return db['SmsInteraction'][_0x88ee('0x36')]({'where':{'id':_0x494b8b[_0x88ee('0x28')]['id']}})[_0x88ee('0x19')](handleEntityNotFound(_0x3279e8,null))[_0x88ee('0x19')](function(_0x2776b1){if(_0x2776b1){return _0x2776b1['setTags'](_0x494b8b[_0x88ee('0x35')]['ids'],_[_0x88ee('0x3a')](_0x494b8b[_0x88ee('0x35')],[_0x88ee('0x39'),'id'])||{})[_0x88ee('0x4b')](function(){return db[_0x88ee('0x4c')][_0x88ee('0x23')]({'attributes':['id',_0x88ee('0x1b'),_0x88ee('0x4d')],'where':{'id':_0x494b8b[_0x88ee('0x35')][_0x88ee('0x39')]}});})[_0x88ee('0x19')](function(_0x499554){socket['emit'](_0x88ee('0x4e'),{'id':Number(_0x494b8b[_0x88ee('0x28')]['id']),'tags':_0x499554||[]});return{'id':Number(_0x494b8b[_0x88ee('0x28')]['id']),'tags':_0x499554||[]};});}})[_0x88ee('0x19')](respondWithResult(_0x3279e8,null))['catch'](handleError(_0x3279e8,null));};exports[_0x88ee('0x4f')]=function(_0x4ab15c,_0x2d6fd7){return db[_0x88ee('0x1f')][_0x88ee('0x36')]({'where':{'id':_0x4ab15c[_0x88ee('0x28')]['id']}})[_0x88ee('0x19')](handleEntityNotFound(_0x2d6fd7,null))[_0x88ee('0x19')](function(_0x18a28b){if(_0x18a28b){return _0x18a28b[_0x88ee('0x4f')](_0x4ab15c[_0x88ee('0x25')]['ids']);}})[_0x88ee('0x19')](respondWithStatusCode(_0x2d6fd7,null))[_0x88ee('0x33')](handleError(_0x2d6fd7,null));};exports[_0x88ee('0x50')]=function(_0x73010c,_0x3e7d91){var _0x3dbc02=moment()[_0x88ee('0x51')]()[_0x88ee('0x52')]();var _0x3c1655=path[_0x88ee('0x53')](config[_0x88ee('0x54')],_0x88ee('0x55'),_0x88ee('0x56'),'tmp');var _0x3f8517=path[_0x88ee('0x53')](_0x3c1655,_0x3dbc02);var _0x492e50=util[_0x88ee('0x47')](_0x88ee('0x57'),_0x73010c[_0x88ee('0x28')]['id'],_0x3dbc02);var _0x1cf014=path[_0x88ee('0x53')](_0x3c1655,_0x492e50);var _0x39b65d=[];_0x39b65d[_0x88ee('0x58')]({'model':db[_0x88ee('0x59')],'as':'User','attributes':['id',_0x88ee('0x5a')],'raw':!![]});_0x39b65d[_0x88ee('0x58')]({'model':db[_0x88ee('0x5b')],'as':'Contact','attributes':['id','firstName',_0x88ee('0x5c')],'raw':!![]});var _0x1702e5=[{'model':db[_0x88ee('0x48')],'as':_0x88ee('0x5d'),'attributes':['id',_0x88ee('0x35'),'createdAt',_0x88ee('0x5e'),_0x88ee('0x5f'),'read'],'include':_0x39b65d}];_0x1702e5[_0x88ee('0x58')]({'model':db[_0x88ee('0x60')],'as':_0x88ee('0x61'),'attributes':['id','name']});_0x1702e5[_0x88ee('0x58')]({'model':db[_0x88ee('0x59')],'as':_0x88ee('0x62'),'attributes':['id',_0x88ee('0x5a')]});return db[_0x88ee('0x1f')][_0x88ee('0x36')]({'where':{'id':_0x73010c['params']['id']},'include':_0x1702e5})[_0x88ee('0x19')](handleEntityNotFound(_0x3e7d91,null))[_0x88ee('0x19')](function(_0x1119a5){if(_0x1119a5){var _0x2ab825=_0x1119a5['get']({'plain':!![]});fs[_0x88ee('0x63')](_0x3f8517);var _0xfbb2d4={'channel':_0x88ee('0x64'),'account':_0x2ab825['Account'][_0x88ee('0x1b')],'agent':_0x2ab825[_0x88ee('0x62')]?_0x2ab825[_0x88ee('0x62')]['fullname']:_0x88ee('0x65'),'createdAt':moment(_0x2ab825[_0x88ee('0x66')])['format'](_0x88ee('0x67'))[_0x88ee('0x52')](),'closedAt':_0x2ab825[_0x88ee('0x68')]?moment(_0x2ab825[_0x88ee('0x69')])[_0x88ee('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x88ee('0x52')]():'','disposition':_0x2ab825[_0x88ee('0x6a')],'messages':_(_0x2ab825[_0x88ee('0x5d')])[_0x88ee('0x43')]({'secret':![]})['map'](function(_0x5a003e){return{'date':moment(_0x5a003e[_0x88ee('0x66')])['format'](_0x88ee('0x67'))[_0x88ee('0x52')](),'sender':_0x5a003e[_0x88ee('0x5e')]===_0x88ee('0x6b')?_0x5a003e['User']?_0x5a003e['User'][_0x88ee('0x5a')]:_0x88ee('0x6c'):_0x5a003e[_0x88ee('0x6d')]['firstName']+(_0x5a003e['Contact'][_0x88ee('0x5c')]?'\x20'+_0x5a003e[_0x88ee('0x6d')][_0x88ee('0x5c')]:''),'body':_0x5a003e['body'],'direction':_0x5a003e['direction']===_0x88ee('0x6b')?'A':'C','secret':_0x5a003e[_0x88ee('0x5f')],'read':_0x5a003e[_0x88ee('0x6e')]};})[_0x88ee('0x6f')]()};return ejs[_0x88ee('0x70')](path[_0x88ee('0x53')](config[_0x88ee('0x54')],_0x88ee('0x55'),_0x88ee('0x71'),_0x88ee('0x72')),{'interaction':_0xfbb2d4})[_0x88ee('0x19')](function(_0x1aaf55){var _0x304396=path['join'](_0x3f8517,_0x88ee('0x73')+_0x2ab825['id']+'-'+_0x3dbc02+_0x88ee('0x74'));var _0x1f6859={'path':_0x304396,'channel':_0x88ee('0x64'),'interactionId':_0x2ab825['id']};return pdf[_0x88ee('0x75')](_0x1aaf55,_0x1f6859);})[_0x88ee('0x19')](function(){return new BPromise(function(_0x34039d,_0x474dc2){zipdir(_0x3f8517,{'saveTo':_0x1cf014},function(_0x559726,_0x68871){if(_0x559726)return _0x474dc2(_0x559726);return _0x34039d(_0x68871);});})[_0x88ee('0x19')](function(){return new BPromise(function(_0x1c427b,_0x191663){rimraf(_0x3f8517,function(_0x569d9d){if(_0x569d9d)_0x191663(_0x569d9d);return _0x1c427b();});});})[_0x88ee('0x19')](function(){return _0x3e7d91['download'](_0x1cf014,_0x492e50,function(_0xffc9ee){if(_0xffc9ee){console[_0x88ee('0x76')](_0x88ee('0x77'),_0xffc9ee);}else{fs[_0x88ee('0x78')](_0x1cf014);}});});});}else{return _0x3e7d91[_0x88ee('0x79')](0xc8);}})[_0x88ee('0x33')](handleError(_0x3e7d91,null));}; \ No newline at end of file +var _0xf2d7=['update','then','error','name','send','index','map','rawAttributes','type','key','getOptions','sms','query','user','catch','model','SmsInteraction','keys','filters','intersection','fields','attributes','length','include','create','body','find','destroy','describe','addMessage','SmsMessage','params','ids','getMessages','findOne','nolimit','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','options','includeAll','findAll','rows','setTags','omit','spread','Tag','emit','smsInteractionTags:save','removeTags','toString','join','root','server','files','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','get','Sms','Owner','N.A.','closedAt','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','log','err','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','./smsInteraction.socket','register','status','end','offset','undefined','limit','count','json'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xf2d7,0xd3));var _0x7f2d=function(_0x32a8c4,_0x468716){_0x32a8c4=_0x32a8c4-0x0;var _0xb3065f=_0xf2d7[_0x32a8c4];return _0xb3065f;};'use strict';var rimraf=require(_0x7f2d('0x0'));var zipdir=require(_0x7f2d('0x1'));var moment=require(_0x7f2d('0x2'));var BPromise=require(_0x7f2d('0x3'));var util=require(_0x7f2d('0x4'));var path=require(_0x7f2d('0x5'));var ejs=require(_0x7f2d('0x6'));var fs=require('fs');var _=require(_0x7f2d('0x7'));var Redis=require(_0x7f2d('0x8'));var interaction=require(_0x7f2d('0x9'));var qs=require(_0x7f2d('0xa'));var pdf=require(_0x7f2d('0xb'));var logger=require(_0x7f2d('0xc'))('api');var config=require(_0x7f2d('0xd'));var db=require('../../mysqldb')['db'];config[_0x7f2d('0xe')]=_[_0x7f2d('0xf')](config[_0x7f2d('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f2d('0xe')]));require(_0x7f2d('0x10'))[_0x7f2d('0x11')](socket);function respondWithStatusCode(_0x205de2,_0x5157cb){_0x5157cb=_0x5157cb||0xcc;return function(_0x4577de){if(_0x4577de){return _0x205de2['sendStatus'](_0x5157cb);}return _0x205de2[_0x7f2d('0x12')](_0x5157cb)[_0x7f2d('0x13')]();};}function respondWithResult(_0x380164,_0x5c8fb1){_0x5c8fb1=_0x5c8fb1||0xc8;return function(_0x66da5c){if(_0x66da5c){return _0x380164[_0x7f2d('0x12')](_0x5c8fb1)['json'](_0x66da5c);}};}function respondWithFilteredResult(_0xa8dd81,_0x194ed6){return function(_0x29cf68){if(_0x29cf68){var _0x152eb5=typeof _0x194ed6[_0x7f2d('0x14')]===_0x7f2d('0x15')&&typeof _0x194ed6[_0x7f2d('0x16')]==='undefined';var _0x298a03=_0x29cf68[_0x7f2d('0x17')];var _0x23b7ae=_0x152eb5?0x0:_0x194ed6[_0x7f2d('0x14')];var _0x4e678f=_0x152eb5?_0x29cf68['count']:_0x194ed6[_0x7f2d('0x14')]+_0x194ed6[_0x7f2d('0x16')];var _0x3ebbd8;if(_0x4e678f>=_0x298a03){_0x4e678f=_0x298a03;_0x3ebbd8=0xc8;}else{_0x3ebbd8=0xce;}_0xa8dd81[_0x7f2d('0x12')](_0x3ebbd8);return _0xa8dd81['set']('Content-Range',_0x23b7ae+'-'+_0x4e678f+'/'+_0x298a03)[_0x7f2d('0x18')](_0x29cf68);}return null;};}function saveUpdates(_0x2aff5a){return function(_0x2a5c3f){if(_0x2a5c3f){return _0x2a5c3f[_0x7f2d('0x19')](_0x2aff5a)[_0x7f2d('0x1a')](function(_0x2bdb4c){return _0x2bdb4c;});}return null;};}function removeEntity(_0x503878){return function(_0x32e455){if(_0x32e455){return _0x32e455['destroy']()[_0x7f2d('0x1a')](function(){_0x503878[_0x7f2d('0x12')](0xcc)[_0x7f2d('0x13')]();});}};}function handleEntityNotFound(_0x1079fa){return function(_0x44f62b){if(!_0x44f62b){_0x1079fa['sendStatus'](0x194);}return _0x44f62b;};}function handleError(_0x259523,_0x106924){_0x106924=_0x106924||0x1f4;return function(_0x4f42c8){logger[_0x7f2d('0x1b')](_0x4f42c8['stack']);if(_0x4f42c8[_0x7f2d('0x1c')]){delete _0x4f42c8[_0x7f2d('0x1c')];}_0x259523[_0x7f2d('0x12')](_0x106924)[_0x7f2d('0x1d')](_0x4f42c8);};}exports[_0x7f2d('0x1e')]=function(_0x2a3fc3,_0x52774e){var _0x36c7ab={};var _0x37402e=_[_0x7f2d('0x1f')](db['SmsInteraction'][_0x7f2d('0x20')],function(_0x405d89){return{'name':_0x405d89['fieldName'],'type':_0x405d89[_0x7f2d('0x21')][_0x7f2d('0x22')]};});_0x36c7ab=qs[_0x7f2d('0x23')](_0x37402e,_0x2a3fc3);return interaction['findAll'](_0x7f2d('0x24'),_0x2a3fc3[_0x7f2d('0x25')],_0x2a3fc3[_0x7f2d('0x26')],_0x36c7ab,_0x37402e)[_0x7f2d('0x1a')](respondWithFilteredResult(_0x52774e,_0x36c7ab))[_0x7f2d('0x27')](handleError(_0x52774e,null));};exports['show']=function(_0x25c34e,_0x171376){var _0x11060d={'raw':![],'where':{'id':_0x25c34e['params']['id']}},_0x2be01d={};_0x2be01d[_0x7f2d('0x28')]=_['keys'](db[_0x7f2d('0x29')][_0x7f2d('0x20')]);_0x2be01d[_0x7f2d('0x25')]=_[_0x7f2d('0x2a')](_0x25c34e[_0x7f2d('0x25')]);_0x2be01d[_0x7f2d('0x2b')]=_[_0x7f2d('0x2c')](_0x2be01d[_0x7f2d('0x28')],_0x2be01d[_0x7f2d('0x25')]);_0x11060d['attributes']=_[_0x7f2d('0x2c')](_0x2be01d[_0x7f2d('0x28')],qs[_0x7f2d('0x2d')](_0x25c34e['query'][_0x7f2d('0x2d')]));_0x11060d[_0x7f2d('0x2e')]=_0x11060d['attributes'][_0x7f2d('0x2f')]?_0x11060d[_0x7f2d('0x2e')]:_0x2be01d['model'];if(_0x25c34e[_0x7f2d('0x25')]['includeAll']){_0x11060d[_0x7f2d('0x30')]=[{'all':!![]}];}_0x11060d=_['merge']({},_0x11060d,_0x25c34e['options']);return db['SmsInteraction']['find'](_0x11060d)[_0x7f2d('0x1a')](handleEntityNotFound(_0x171376,null))[_0x7f2d('0x1a')](respondWithResult(_0x171376,null))[_0x7f2d('0x27')](handleError(_0x171376,null));};exports['create']=function(_0x2a063a,_0x56632b){return db[_0x7f2d('0x29')][_0x7f2d('0x31')](_0x2a063a[_0x7f2d('0x32')],{})[_0x7f2d('0x1a')](respondWithResult(_0x56632b,0xc9))[_0x7f2d('0x27')](handleError(_0x56632b,null));};exports['update']=function(_0x22f04f,_0x2f194f){if(_0x22f04f[_0x7f2d('0x32')]['id']){delete _0x22f04f['body']['id'];}return db[_0x7f2d('0x29')][_0x7f2d('0x33')]({'where':{'id':_0x22f04f['params']['id']}})[_0x7f2d('0x1a')](handleEntityNotFound(_0x2f194f,null))[_0x7f2d('0x1a')](saveUpdates(_0x22f04f[_0x7f2d('0x32')],null))[_0x7f2d('0x1a')](respondWithResult(_0x2f194f,null))[_0x7f2d('0x27')](handleError(_0x2f194f,null));};exports[_0x7f2d('0x34')]=function(_0x3490bb,_0x50a5a4){return db[_0x7f2d('0x29')]['find']({'where':{'id':_0x3490bb['params']['id']}})[_0x7f2d('0x1a')](handleEntityNotFound(_0x50a5a4,null))[_0x7f2d('0x1a')](removeEntity(_0x50a5a4,null))[_0x7f2d('0x27')](handleError(_0x50a5a4,null));};exports[_0x7f2d('0x35')]=function(_0x34c6af,_0xe91b4c){return db['SmsInteraction'][_0x7f2d('0x35')]()[_0x7f2d('0x1a')](respondWithResult(_0xe91b4c,null))['catch'](handleError(_0xe91b4c,null));};exports[_0x7f2d('0x36')]=function(_0x261ca6,_0x2dcc28){return db[_0x7f2d('0x37')][_0x7f2d('0x33')]({'where':{'id':_0x261ca6[_0x7f2d('0x38')]['id']}})[_0x7f2d('0x1a')](handleEntityNotFound(_0x2dcc28,null))[_0x7f2d('0x1a')](function(_0x3224b6){if(_0x3224b6){return _0x3224b6[_0x7f2d('0x36')](_0x261ca6[_0x7f2d('0x32')][_0x7f2d('0x39')],_['omit'](_0x261ca6['body'],[_0x7f2d('0x39'),'id'])||{});}})['then'](respondWithResult(_0x2dcc28,null))['catch'](handleError(_0x2dcc28,null));};exports[_0x7f2d('0x3a')]=function(_0x570968,_0x3a63e7){var _0x46ca1e={'raw':![],'where':{}};var _0x5cff12={};var _0x4f9efc={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x7f2d('0x3b')]({'where':{'id':_0x570968[_0x7f2d('0x38')]['id']}})['then'](handleEntityNotFound(_0x3a63e7,null))[_0x7f2d('0x1a')](function(_0x4cba72){if(_0x4cba72){_0x5cff12[_0x7f2d('0x28')]=_[_0x7f2d('0x2a')](db['SmsMessage'][_0x7f2d('0x20')]);_0x5cff12[_0x7f2d('0x25')]=_[_0x7f2d('0x2a')](_0x570968[_0x7f2d('0x25')]);_0x5cff12[_0x7f2d('0x2b')]=_[_0x7f2d('0x2c')](_0x5cff12[_0x7f2d('0x28')],_0x5cff12[_0x7f2d('0x25')]);_0x46ca1e[_0x7f2d('0x2e')]=_[_0x7f2d('0x2c')](_0x5cff12[_0x7f2d('0x28')],qs[_0x7f2d('0x2d')](_0x570968[_0x7f2d('0x25')][_0x7f2d('0x2d')]));_0x46ca1e[_0x7f2d('0x2e')]=_0x46ca1e[_0x7f2d('0x2e')][_0x7f2d('0x2f')]?_0x46ca1e[_0x7f2d('0x2e')]:_0x5cff12['model'];if(!_0x570968[_0x7f2d('0x25')]['hasOwnProperty'](_0x7f2d('0x3c'))){_0x46ca1e[_0x7f2d('0x16')]=qs[_0x7f2d('0x16')](_0x570968[_0x7f2d('0x25')][_0x7f2d('0x16')]);_0x46ca1e[_0x7f2d('0x14')]=qs['offset'](_0x570968['query'][_0x7f2d('0x14')]);}_0x46ca1e[_0x7f2d('0x3d')]=qs[_0x7f2d('0x3e')](_0x570968[_0x7f2d('0x25')][_0x7f2d('0x3e')]);_0x46ca1e[_0x7f2d('0x3f')]=qs['filters'](_[_0x7f2d('0x40')](_0x570968[_0x7f2d('0x25')],_0x5cff12['filters']));_0x46ca1e['where']['SmsInteractionId']=_0x4cba72['id'];if(_0x570968[_0x7f2d('0x25')][_0x7f2d('0x41')]){_0x46ca1e['where']=_['merge'](_0x46ca1e[_0x7f2d('0x3f')],{'$or':_[_0x7f2d('0x1f')](_0x46ca1e[_0x7f2d('0x2e')],function(_0xc0a842){var _0x321658={};_0x321658[_0xc0a842]={'$like':'%'+_0x570968['query'][_0x7f2d('0x41')]+'%'};return _0x321658;})});}if(_0x570968[_0x7f2d('0x25')][_0x7f2d('0x42')]){var _0x1d6dbe=_0x570968['query']['$gte']['split'](',');var _0x1a77a6={};_0x1a77a6[_0x1d6dbe[0x0]]={'$gte':moment(_0x1d6dbe[0x1])[_0x7f2d('0x43')](_0x7f2d('0x44'))};_0x46ca1e[_0x7f2d('0x3f')]=_[_0x7f2d('0x45')](_0x46ca1e['where'],_0x1a77a6);}_0x46ca1e=_[_0x7f2d('0x45')]({},_0x46ca1e,_0x570968[_0x7f2d('0x46')]);return db[_0x7f2d('0x37')][_0x7f2d('0x17')]({'where':_0x46ca1e['where']})[_0x7f2d('0x1a')](function(_0x457e66){_0x4f9efc[_0x7f2d('0x17')]=_0x457e66;if(_0x570968[_0x7f2d('0x25')][_0x7f2d('0x47')]){_0x46ca1e['include']=[{'all':!![]}];}return db[_0x7f2d('0x37')][_0x7f2d('0x48')](_0x46ca1e);})['then'](function(_0x1e1b75){_0x4f9efc[_0x7f2d('0x49')]=_0x1e1b75;return _0x4f9efc;});}})['then'](respondWithFilteredResult(_0x3a63e7,_0x46ca1e))['catch'](handleError(_0x3a63e7,null));};exports['addTags']=function(_0x18dad6,_0x465560){return db[_0x7f2d('0x29')]['find']({'where':{'id':_0x18dad6['params']['id']}})[_0x7f2d('0x1a')](handleEntityNotFound(_0x465560,null))[_0x7f2d('0x1a')](function(_0x40fd95){if(_0x40fd95){return _0x40fd95[_0x7f2d('0x4a')](_0x18dad6[_0x7f2d('0x32')][_0x7f2d('0x39')],_[_0x7f2d('0x4b')](_0x18dad6[_0x7f2d('0x32')],[_0x7f2d('0x39'),'id'])||{})[_0x7f2d('0x4c')](function(){return db[_0x7f2d('0x4d')]['findAll']({'attributes':['id',_0x7f2d('0x1c'),'color'],'where':{'id':_0x18dad6[_0x7f2d('0x32')][_0x7f2d('0x39')]}});})[_0x7f2d('0x1a')](function(_0x1b0c79){socket[_0x7f2d('0x4e')](_0x7f2d('0x4f'),{'id':Number(_0x18dad6[_0x7f2d('0x38')]['id']),'tags':_0x1b0c79||[]});return{'id':Number(_0x18dad6['params']['id']),'tags':_0x1b0c79||[]};});}})[_0x7f2d('0x1a')](respondWithResult(_0x465560,null))['catch'](handleError(_0x465560,null));};exports[_0x7f2d('0x50')]=function(_0x4e799a,_0x23dc9c){return db['SmsInteraction'][_0x7f2d('0x33')]({'where':{'id':_0x4e799a[_0x7f2d('0x38')]['id']}})['then'](handleEntityNotFound(_0x23dc9c,null))['then'](function(_0x191596){if(_0x191596){return _0x191596[_0x7f2d('0x50')](_0x4e799a[_0x7f2d('0x25')]['ids']);}})[_0x7f2d('0x1a')](respondWithStatusCode(_0x23dc9c,null))[_0x7f2d('0x27')](handleError(_0x23dc9c,null));};exports['download']=function(_0x2e8cd8,_0x196f1a){var _0x5903db=moment()['unix']()[_0x7f2d('0x51')]();var _0x12ff9d=path[_0x7f2d('0x52')](config[_0x7f2d('0x53')],_0x7f2d('0x54'),_0x7f2d('0x55'),'tmp');var _0x52063a=path[_0x7f2d('0x52')](_0x12ff9d,_0x5903db);var _0x8d6b2=util[_0x7f2d('0x43')](_0x7f2d('0x56'),_0x2e8cd8[_0x7f2d('0x38')]['id'],_0x5903db);var _0xdcd74f=path[_0x7f2d('0x52')](_0x12ff9d,_0x8d6b2);var _0x40b4f7=[];_0x40b4f7[_0x7f2d('0x57')]({'model':db[_0x7f2d('0x58')],'as':'User','attributes':['id',_0x7f2d('0x59')],'raw':!![]});_0x40b4f7[_0x7f2d('0x57')]({'model':db['CmContact'],'as':_0x7f2d('0x5a'),'attributes':['id',_0x7f2d('0x5b'),_0x7f2d('0x5c')],'raw':!![]});var _0x516566=[{'model':db[_0x7f2d('0x37')],'as':_0x7f2d('0x5d'),'attributes':['id',_0x7f2d('0x32'),_0x7f2d('0x5e'),_0x7f2d('0x5f'),_0x7f2d('0x60'),_0x7f2d('0x61')],'include':_0x40b4f7}];_0x516566[_0x7f2d('0x57')]({'model':db[_0x7f2d('0x62')],'as':_0x7f2d('0x63'),'attributes':['id',_0x7f2d('0x1c')]});_0x516566[_0x7f2d('0x57')]({'model':db[_0x7f2d('0x58')],'as':'Owner','attributes':['id',_0x7f2d('0x59')]});return db['SmsInteraction'][_0x7f2d('0x33')]({'where':{'id':_0x2e8cd8[_0x7f2d('0x38')]['id']},'include':_0x516566})[_0x7f2d('0x1a')](handleEntityNotFound(_0x196f1a,null))['then'](function(_0x2d51eb){if(_0x2d51eb){var _0x464b4d=_0x2d51eb[_0x7f2d('0x64')]({'plain':!![]});fs['mkdirSync'](_0x52063a);var _0x42b80c={'channel':_0x7f2d('0x65'),'account':_0x464b4d[_0x7f2d('0x63')][_0x7f2d('0x1c')],'agent':_0x464b4d[_0x7f2d('0x66')]?_0x464b4d[_0x7f2d('0x66')][_0x7f2d('0x59')]:_0x7f2d('0x67'),'createdAt':moment(_0x464b4d[_0x7f2d('0x5e')])[_0x7f2d('0x43')](_0x7f2d('0x44'))[_0x7f2d('0x51')](),'closedAt':_0x464b4d['closed']?moment(_0x464b4d[_0x7f2d('0x68')])['format'](_0x7f2d('0x44'))[_0x7f2d('0x51')]():'','disposition':_0x464b4d['disposition'],'messages':_(_0x464b4d['Messages'])['filter']({'secret':![]})[_0x7f2d('0x1f')](function(_0x216aa5){return{'date':moment(_0x216aa5[_0x7f2d('0x5e')])[_0x7f2d('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7f2d('0x51')](),'sender':_0x216aa5[_0x7f2d('0x5f')]===_0x7f2d('0x69')?_0x216aa5['User']?_0x216aa5['User']['fullname']:_0x7f2d('0x6a'):_0x216aa5['Contact']['firstName']+(_0x216aa5[_0x7f2d('0x5a')][_0x7f2d('0x5c')]?'\x20'+_0x216aa5[_0x7f2d('0x5a')][_0x7f2d('0x5c')]:''),'body':_0x216aa5[_0x7f2d('0x32')],'direction':_0x216aa5[_0x7f2d('0x5f')]===_0x7f2d('0x69')?'A':'C','secret':_0x216aa5[_0x7f2d('0x60')],'read':_0x216aa5['read']};})[_0x7f2d('0x6b')]()};return ejs[_0x7f2d('0x6c')](path[_0x7f2d('0x52')](config[_0x7f2d('0x53')],_0x7f2d('0x54'),_0x7f2d('0x6d'),_0x7f2d('0x6e')),{'interaction':_0x42b80c})[_0x7f2d('0x1a')](function(_0x18de2d){var _0x5337bd=path[_0x7f2d('0x52')](_0x52063a,_0x7f2d('0x6f')+_0x464b4d['id']+'-'+_0x5903db+_0x7f2d('0x70'));var _0x5220aa={'path':_0x5337bd,'channel':_0x7f2d('0x65'),'interactionId':_0x464b4d['id']};return pdf['createPdfFromHTML'](_0x18de2d,_0x5220aa);})[_0x7f2d('0x1a')](function(){return new BPromise(function(_0xcda9ca,_0x5769ba){zipdir(_0x52063a,{'saveTo':_0xdcd74f},function(_0x462827,_0x26abde){if(_0x462827)return _0x5769ba(_0x462827);return _0xcda9ca(_0x26abde);});})[_0x7f2d('0x1a')](function(){return new BPromise(function(_0x220be7,_0x21b86c){rimraf(_0x52063a,function(_0x35ad57){if(_0x35ad57)_0x21b86c(_0x35ad57);return _0x220be7();});});})[_0x7f2d('0x1a')](function(){return _0x196f1a[_0x7f2d('0x71')](_0xdcd74f,_0x8d6b2,function(_0x4e56a8){if(_0x4e56a8){console[_0x7f2d('0x72')](_0x7f2d('0x73'),_0x4e56a8);}else{fs[_0x7f2d('0x74')](_0xdcd74f);}});});});}else{return _0x196f1a[_0x7f2d('0x75')](0xc8);}})['catch'](handleError(_0x196f1a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 0f86331..e48164d 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 _0x5f66=['update','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x3cd133,_0x222fcb){var _0x2512c8=function(_0x484491){while(--_0x484491){_0x3cd133['push'](_0x3cd133['shift']());}};_0x2512c8(++_0x222fcb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x65f6('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x65f6('0x0'))['db'][_0x65f6('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x65f6('0x2')](0x0);var events={'afterCreate':_0x65f6('0x3'),'afterUpdate':_0x65f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c5029){return function(_0x5150c8,_0x1c9f5b,_0x22b017){_0x5150c8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c0e12){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x6'),_0x1c0e12[_0x65f6('0x7')](function(_0xc44c70){return{'id':_0xc44c70['id']};}));return SmsMessage[_0x65f6('0x8')]({'where':{'SmsInteractionId':_0x5150c8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5123ee){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x9'),_0x5123ee[_0x65f6('0xa')]);SmsInteractionEvents[_0x65f6('0xb')](_0x3c5029+':'+_0x5150c8['id'],_0x5150c8);SmsInteractionEvents['emit'](_0x3c5029,_0x5150c8);_0x22b017(null);})[_0x65f6('0xc')](_0x22b017(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x65f6('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0x1399=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x3f8c32,_0xf776e2){var _0x546899=function(_0x26eebf){while(--_0x26eebf){_0x3f8c32['push'](_0x3f8c32['shift']());}};_0x546899(++_0xf776e2);}(_0x1399,0x16c));var _0x9139=function(_0xf31593,_0x3da036){_0xf31593=_0xf31593-0x0;var _0x4bd676=_0x1399[_0xf31593];return _0x4bd676;};'use strict';var EventEmitter=require(_0x9139('0x0'));var SmsInteraction=require(_0x9139('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x9139('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9139('0x2')](0x0);var events={'afterCreate':_0x9139('0x3'),'afterUpdate':_0x9139('0x4'),'afterDestroy':_0x9139('0x5')};function emitEvent(_0x251798){return function(_0x2acb38,_0x5ac80b,_0x54af2d){_0x2acb38[_0x9139('0x6')]({'attributes':['id'],'raw':!![]})[_0x9139('0x7')](function(_0x4d5d1e){_0x2acb38['setDataValue'](_0x9139('0x8'),_0x4d5d1e['map'](function(_0x504ced){return{'id':_0x504ced['id']};}));return SmsMessage[_0x9139('0x9')]({'where':{'SmsInteractionId':_0x2acb38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9139('0x7')](function(_0x4830cd){_0x2acb38[_0x9139('0xa')](_0x9139('0xb'),_0x4830cd['length']);SmsInteractionEvents['emit'](_0x251798+':'+_0x2acb38['id'],_0x2acb38);SmsInteractionEvents[_0x9139('0xc')](_0x251798,_0x2acb38);_0x54af2d(null);})[_0x9139('0xd')](_0x54af2d(null));};}for(var e in events){if(events[_0x9139('0xe')](e)){var event=events[e];SmsInteraction[_0x9139('0xf')](e,emitEvent(event));}}module[_0x9139('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 d163de0..8fa4252 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 _0x3039=['SmsInteraction','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x3039,0x1c4));var _0x9303=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3039[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x9303('0x0'));var logger=require('../../config/logger')(_0x9303('0x1'));var moment=require(_0x9303('0x2'));var BPromise=require(_0x9303('0x3'));var rp=require(_0x9303('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9303('0x5'));var config=require(_0x9303('0x6'));var attributes=require(_0x9303('0x7'));module[_0x9303('0x8')]=function(_0x541168,_0x31d0eb){return _0x541168[_0x9303('0x9')](_0x9303('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1863f8,_0x2bae2c,_0xa7f03b){if(_0x1863f8['changed'](_0x9303('0xb'))){_0x1863f8[_0x9303('0xc')]=moment()['format'](_0x9303('0xd'));}_0xa7f03b(null,_0x1863f8);}}});}; \ No newline at end of file +var _0xb5bf=['SmsInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x2f1908,_0x5d837d){var _0x357795=function(_0x5bf606){while(--_0x5bf606){_0x2f1908['push'](_0x2f1908['shift']());}};_0x357795(++_0x5d837d);}(_0xb5bf,0xc9));var _0xfb5b=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb5bf[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0xfb5b('0x0'));var util=require(_0xfb5b('0x1'));var logger=require(_0xfb5b('0x2'))(_0xfb5b('0x3'));var moment=require('moment');var BPromise=require(_0xfb5b('0x4'));var rp=require(_0xfb5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb5b('0x6'));var config=require(_0xfb5b('0x7'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3926de,_0x54ff03){return _0x3926de[_0xfb5b('0x8')](_0xfb5b('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xab65dc,_0x54ab11,_0xd50804){if(_0xab65dc[_0xfb5b('0xa')]('closed')){_0xab65dc[_0xfb5b('0xb')]=moment()[_0xfb5b('0xc')](_0xfb5b('0xd'));}_0xd50804(null,_0xab65dc);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ff5ee97..5e5410c 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 _0x3520=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','info','stringify','AddTagsToSmsInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x2e617d,_0x17c590){var _0x34c295=function(_0x273f83){while(--_0x273f83){_0x2e617d['push'](_0x2e617d['shift']());}};_0x34c295(++_0x17c590);}(_0x3520,0x11b));var _0x0352=function(_0x4f652a,_0x58e269){_0x4f652a=_0x4f652a-0x0;var _0x57587b=_0x3520[_0x4f652a];return _0x57587b;};'use strict';var _=require(_0x0352('0x0'));var util=require(_0x0352('0x1'));var moment=require(_0x0352('0x2'));var BPromise=require(_0x0352('0x3'));var rs=require(_0x0352('0x4'));var fs=require('fs');var Redis=require(_0x0352('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0352('0x6'))(_0x0352('0x7'));var config=require(_0x0352('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0352('0x9')][_0x0352('0xa')]({'port':0x232a});config[_0x0352('0xb')]=_[_0x0352('0xc')](config[_0x0352('0xb')],{'host':_0x0352('0xd'),'port':0x18eb});var socket=require(_0x0352('0xe'))(new Redis(config[_0x0352('0xb')]));require(_0x0352('0xf'))[_0x0352('0x10')](socket);function respondWithRpcPromise(_0x9f5817,_0x1fc32e,_0x27fdf6){return new BPromise(function(_0x1ce657,_0x4b37cf){return client[_0x0352('0x11')](_0x9f5817,_0x27fdf6)[_0x0352('0x12')](function(_0x5a9f1e){logger['info'](_0x0352('0x13'),_0x1fc32e,_0x0352('0x14'));logger[_0x0352('0x15')](_0x0352('0x16'),_0x1fc32e,_0x0352('0x14'),JSON['stringify'](_0x5a9f1e));if(_0x5a9f1e[_0x0352('0x17')]){if(_0x5a9f1e[_0x0352('0x17')][_0x0352('0x18')]===0x1f4){logger[_0x0352('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x1fc32e,_0x5a9f1e[_0x0352('0x17')][_0x0352('0x19')]);return _0x4b37cf(_0x5a9f1e['error']['message']);}logger['error'](_0x0352('0x13'),_0x1fc32e,_0x5a9f1e[_0x0352('0x17')][_0x0352('0x19')]);return _0x1ce657(_0x5a9f1e['error'][_0x0352('0x19')]);}else{logger['info'](_0x0352('0x13'),_0x1fc32e,'request\x20sent');_0x1ce657(_0x5a9f1e['result'][_0x0352('0x19')]);}})[_0x0352('0x1a')](function(_0x62111a){logger[_0x0352('0x17')](_0x0352('0x13'),_0x1fc32e,_0x62111a);_0x4b37cf(_0x62111a);});});}exports[_0x0352('0x1b')]=function(_0x50748c){var _0x326845=this;return new Promise(function(_0x44c790,_0x2d182f){return db[_0x0352('0x1c')][_0x0352('0x1d')](_0x50748c[_0x0352('0x1e')],{'raw':_0x50748c[_0x0352('0x1f')]?_0x50748c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50748c[_0x0352('0x1f')]?_0x50748c['options'][_0x0352('0x20')]||null:null,'attributes':_0x50748c[_0x0352('0x1f')]?_0x50748c[_0x0352('0x1f')][_0x0352('0x21')]||null:null,'limit':_0x50748c[_0x0352('0x1f')]?_0x50748c[_0x0352('0x1f')]['limit']||null:null})[_0x0352('0x12')](function(_0x166f27){logger[_0x0352('0x22')](_0x0352('0x1b'),_0x50748c);logger[_0x0352('0x15')](_0x0352('0x1b'),_0x50748c,JSON[_0x0352('0x23')](_0x166f27));_0x44c790(_0x166f27);})[_0x0352('0x1a')](function(_0x13c222){logger[_0x0352('0x17')]('UpdateSmsInteraction',_0x13c222['message'],_0x50748c);_0x2d182f(_0x326845['error'](0x1f4,_0x13c222[_0x0352('0x19')]));});});};exports[_0x0352('0x24')]=function(_0x4279a9){return new Promise(function(_0x4dc336,_0x4d20b6){return db[_0x0352('0x1c')][_0x0352('0x25')]({'where':_0x4279a9[_0x0352('0x1f')]?_0x4279a9[_0x0352('0x1f')][_0x0352('0x20')]||null:null})[_0x0352('0x12')](function(_0x5eeca0){if(_0x5eeca0){return _0x5eeca0['addTags'](_0x4279a9[_0x0352('0x1e')]['ids'],_['omit'](_0x4279a9[_0x0352('0x1e')],[_0x0352('0x26'),'id'])||{});}})[_0x0352('0x27')](function(_0x3f510c){logger['info']('AddTags',_0x4279a9);logger['debug']('AddTags',_0x4279a9,JSON[_0x0352('0x23')](_0x3f510c));_0x4dc336(_0x3f510c);})['catch'](function(_0x3dc77c){logger[_0x0352('0x17')](_0x0352('0x28'),_0x3dc77c[_0x0352('0x19')],_0x4279a9);_0x4d20b6(_this[_0x0352('0x17')](0x1f4,_0x3dc77c[_0x0352('0x19')]));});});}; \ No newline at end of file +var _0x7e9d=['localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','catch','AddTagsToSmsInteraction','find','addTags','omit','AddTags','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis'];(function(_0x1634e7,_0x557eec){var _0x50a44d=function(_0x24ffc6){while(--_0x24ffc6){_0x1634e7['push'](_0x1634e7['shift']());}};_0x50a44d(++_0x557eec);}(_0x7e9d,0x171));var _0xd7e9=function(_0x439a1d,_0x3652f3){_0x439a1d=_0x439a1d-0x0;var _0x5ddeef=_0x7e9d[_0x439a1d];return _0x5ddeef;};'use strict';var _=require('lodash');var util=require(_0xd7e9('0x0'));var moment=require(_0xd7e9('0x1'));var BPromise=require(_0xd7e9('0x2'));var rs=require(_0xd7e9('0x3'));var fs=require('fs');var Redis=require(_0xd7e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7e9('0x5'));var logger=require(_0xd7e9('0x6'))(_0xd7e9('0x7'));var config=require('../../config/environment');var jayson=require(_0xd7e9('0x8'));var client=jayson['client'][_0xd7e9('0x9')]({'port':0x232a});config[_0xd7e9('0xa')]=_['defaults'](config[_0xd7e9('0xa')],{'host':_0xd7e9('0xb'),'port':0x18eb});var socket=require(_0xd7e9('0xc'))(new Redis(config[_0xd7e9('0xa')]));require(_0xd7e9('0xd'))[_0xd7e9('0xe')](socket);function respondWithRpcPromise(_0x54bfd4,_0xd31b65,_0x1f8b8b){return new BPromise(function(_0x47b839,_0xd240fc){return client['request'](_0x54bfd4,_0x1f8b8b)[_0xd7e9('0xf')](function(_0x777fa0){logger[_0xd7e9('0x10')](_0xd7e9('0x11'),_0xd31b65,'request\x20sent');logger[_0xd7e9('0x12')](_0xd7e9('0x13'),_0xd31b65,_0xd7e9('0x14'),JSON['stringify'](_0x777fa0));if(_0x777fa0[_0xd7e9('0x15')]){if(_0x777fa0['error'][_0xd7e9('0x16')]===0x1f4){logger[_0xd7e9('0x15')](_0xd7e9('0x11'),_0xd31b65,_0x777fa0['error'][_0xd7e9('0x17')]);return _0xd240fc(_0x777fa0[_0xd7e9('0x15')][_0xd7e9('0x17')]);}logger[_0xd7e9('0x15')](_0xd7e9('0x11'),_0xd31b65,_0x777fa0[_0xd7e9('0x15')][_0xd7e9('0x17')]);return _0x47b839(_0x777fa0[_0xd7e9('0x15')][_0xd7e9('0x17')]);}else{logger['info'](_0xd7e9('0x11'),_0xd31b65,_0xd7e9('0x14'));_0x47b839(_0x777fa0['result']['message']);}})['catch'](function(_0x307ee4){logger[_0xd7e9('0x15')](_0xd7e9('0x11'),_0xd31b65,_0x307ee4);_0xd240fc(_0x307ee4);});});}exports[_0xd7e9('0x18')]=function(_0xa51527){var _0x385a46=this;return new Promise(function(_0x1ce1d6,_0xb441c7){return db[_0xd7e9('0x19')][_0xd7e9('0x1a')](_0xa51527[_0xd7e9('0x1b')],{'raw':_0xa51527[_0xd7e9('0x1c')]?_0xa51527[_0xd7e9('0x1c')][_0xd7e9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa51527[_0xd7e9('0x1c')]?_0xa51527[_0xd7e9('0x1c')][_0xd7e9('0x1e')]||null:null,'attributes':_0xa51527['options']?_0xa51527[_0xd7e9('0x1c')]['attributes']||null:null,'limit':_0xa51527['options']?_0xa51527[_0xd7e9('0x1c')]['limit']||null:null})['then'](function(_0x5531d8){logger[_0xd7e9('0x10')](_0xd7e9('0x18'),_0xa51527);logger[_0xd7e9('0x12')](_0xd7e9('0x18'),_0xa51527,JSON['stringify'](_0x5531d8));_0x1ce1d6(_0x5531d8);})[_0xd7e9('0x1f')](function(_0x1ab04e){logger['error'](_0xd7e9('0x18'),_0x1ab04e[_0xd7e9('0x17')],_0xa51527);_0xb441c7(_0x385a46['error'](0x1f4,_0x1ab04e[_0xd7e9('0x17')]));});});};exports[_0xd7e9('0x20')]=function(_0x964bfd){return new Promise(function(_0x2409c3,_0xf07766){return db[_0xd7e9('0x19')][_0xd7e9('0x21')]({'where':_0x964bfd['options']?_0x964bfd[_0xd7e9('0x1c')][_0xd7e9('0x1e')]||null:null})['then'](function(_0x395c6a){if(_0x395c6a){return _0x395c6a[_0xd7e9('0x22')](_0x964bfd[_0xd7e9('0x1b')]['ids'],_[_0xd7e9('0x23')](_0x964bfd[_0xd7e9('0x1b')],['ids','id'])||{});}})['spread'](function(_0x3eebf1){logger[_0xd7e9('0x10')](_0xd7e9('0x24'),_0x964bfd);logger['debug'](_0xd7e9('0x24'),_0x964bfd,JSON[_0xd7e9('0x25')](_0x3eebf1));_0x2409c3(_0x3eebf1);})['catch'](function(_0x529f94){logger[_0xd7e9('0x15')](_0xd7e9('0x24'),_0x529f94[_0xd7e9('0x17')],_0x964bfd);_0xf07766(_this[_0xd7e9('0x15')](0x1f4,_0x529f94[_0xd7e9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 73ed5a7..88c5a92 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 _0x99dd=['emit','removeListener','register','length','./smsInteraction.events','save','remove','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x99dd,0xb4));var _0xd99d=function(_0x23ff6e,_0x55b787){_0x23ff6e=_0x23ff6e-0x0;var _0x5a8e68=_0x99dd[_0x23ff6e];return _0x5a8e68;};'use strict';var SmsInteractionEvents=require(_0xd99d('0x0'));var events=[_0xd99d('0x1'),_0xd99d('0x2'),_0xd99d('0x3')];function createListener(_0x3453df,_0x4d4f23){return function(_0x1c9a98){_0x4d4f23[_0xd99d('0x4')](_0x3453df,_0x1c9a98);};}function removeListener(_0x432ca1,_0x4183f8){return function(){SmsInteractionEvents[_0xd99d('0x5')](_0x432ca1,_0x4183f8);};}exports[_0xd99d('0x6')]=function(_0xb90582){for(var _0x35557b=0x0,_0x4c1260=events[_0xd99d('0x7')];_0x35557b<_0x4c1260;_0x35557b++){var _0x4b1646=events[_0x35557b];var _0x1f51d6=createListener('smsInteraction:'+_0x4b1646,_0xb90582);SmsInteractionEvents['on'](_0x4b1646,_0x1f51d6);}}; \ No newline at end of file +var _0x0aaa=['removeListener','register','length','smsInteraction:','./smsInteraction.events','save','emit'];(function(_0x2d2baf,_0x2dac58){var _0x54c2ac=function(_0xebbd20){while(--_0xebbd20){_0x2d2baf['push'](_0x2d2baf['shift']());}};_0x54c2ac(++_0x2dac58);}(_0x0aaa,0xa5));var _0xa0aa=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x0aaa[_0x43444b];return _0x392fe5;};'use strict';var SmsInteractionEvents=require(_0xa0aa('0x0'));var events=[_0xa0aa('0x1'),'remove','update'];function createListener(_0x26d25d,_0x53acaf){return function(_0x3f6de5){_0x53acaf[_0xa0aa('0x2')](_0x26d25d,_0x3f6de5);};}function removeListener(_0x4b4276,_0x49ae1d){return function(){SmsInteractionEvents[_0xa0aa('0x3')](_0x4b4276,_0x49ae1d);};}exports[_0xa0aa('0x4')]=function(_0x1e455d){for(var _0x159e2d=0x0,_0x4be0a6=events[_0xa0aa('0x5')];_0x159e2d<_0x4be0a6;_0x159e2d++){var _0x25095a=events[_0x159e2d];var _0x129293=createListener(_0xa0aa('0x6')+_0x25095a,_0x1e455d);SmsInteractionEvents['on'](_0x25095a,_0x129293);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 99dac97..17e8937 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 _0x69ad=['../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','smsmessage:create','create','/:id/status','/:id','/:id/accept','accept','put','/:id/reject','reject','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x28fedb,_0x1e8b43){var _0x4d4b67=function(_0x33b059){while(--_0x33b059){_0x28fedb['push'](_0x28fedb['shift']());}};_0x4d4b67(++_0x1e8b43);}(_0x69ad,0xed));var _0xd69a=function(_0x5ca405,_0x451ec5){_0x5ca405=_0x5ca405-0x0;var _0xd07abf=_0x69ad[_0x5ca405];return _0xd07abf;};'use strict';var multer=require(_0xd69a('0x0'));var util=require('util');var path=require(_0xd69a('0x1'));var timeout=require('connect-timeout');var express=require(_0xd69a('0x2'));var router=express[_0xd69a('0x3')]();var fs_extra=require(_0xd69a('0x4'));var auth=require(_0xd69a('0x5'));var interaction=require(_0xd69a('0x6'));var config=require(_0xd69a('0x7'));var controller=require(_0xd69a('0x8'));router[_0xd69a('0x9')]('/',auth[_0xd69a('0xa')](),controller[_0xd69a('0xb')]);router[_0xd69a('0x9')](_0xd69a('0xc'),auth[_0xd69a('0xa')](),controller[_0xd69a('0xd')]);router[_0xd69a('0x9')]('/:id',auth[_0xd69a('0xa')](),controller['show']);router[_0xd69a('0xe')]('/',auth['isAuthenticated'](),interaction[_0xd69a('0xf')]('sms',_0xd69a('0x10')),controller[_0xd69a('0x11')]);router[_0xd69a('0xe')](_0xd69a('0x12'),controller['status']);router['put'](_0xd69a('0x13'),auth[_0xd69a('0xa')](),controller['update']);router['put'](_0xd69a('0x14'),auth[_0xd69a('0xa')](),controller[_0xd69a('0x15')]);router[_0xd69a('0x16')](_0xd69a('0x17'),auth[_0xd69a('0xa')](),controller[_0xd69a('0x18')]);router[_0xd69a('0x19')](_0xd69a('0x13'),auth[_0xd69a('0xa')](),controller['destroy']);module[_0xd69a('0x1a')]=router; \ No newline at end of file +var _0x93c1=['fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','post','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','reject','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3f63b1,_0x15a04a){var _0x5953ee=function(_0x1c39cd){while(--_0x1c39cd){_0x3f63b1['push'](_0x3f63b1['shift']());}};_0x5953ee(++_0x15a04a);}(_0x93c1,0x181));var _0x193c=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x93c1[_0x42bc91];return _0x3f5507;};'use strict';var multer=require('multer');var util=require(_0x193c('0x0'));var path=require(_0x193c('0x1'));var timeout=require(_0x193c('0x2'));var express=require(_0x193c('0x3'));var router=express[_0x193c('0x4')]();var fs_extra=require(_0x193c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x193c('0x6'));var config=require(_0x193c('0x7'));var controller=require(_0x193c('0x8'));router[_0x193c('0x9')]('/',auth[_0x193c('0xa')](),controller['index']);router[_0x193c('0x9')](_0x193c('0xb'),auth['isAuthenticated'](),controller[_0x193c('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x193c('0xd')]('/',auth[_0x193c('0xa')](),interaction['tracked'](_0x193c('0xe'),_0x193c('0xf')),controller[_0x193c('0x10')]);router[_0x193c('0xd')](_0x193c('0x11'),controller[_0x193c('0x12')]);router[_0x193c('0x13')](_0x193c('0x14'),auth[_0x193c('0xa')](),controller[_0x193c('0x15')]);router['put'](_0x193c('0x16'),auth[_0x193c('0xa')](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x193c('0x17')]);router['delete'](_0x193c('0x14'),auth[_0x193c('0xa')](),controller[_0x193c('0x18')]);module[_0x193c('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 3373c1c..9e93715 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 _0xa506=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xa506,0x181));var _0x6a50=function(_0x19c7c2,_0x56059a){_0x19c7c2=_0x19c7c2-0x0;var _0x4336f4=_0xa506[_0x19c7c2];return _0x4336f4;};'use strict';var Sequelize=require('sequelize');module[_0x6a50('0x0')]={'body':{'type':Sequelize[_0x6a50('0x1')](_0x6a50('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6a50('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a50('0x4')]('in',_0x6a50('0x5')),'defaultValue':_0x6a50('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x6a50('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x6a50('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6a50('0x6')]},'providerResponse':{'type':Sequelize[_0x6a50('0x1')]}}; \ No newline at end of file +var _0x9c5a=['out','STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3e1c16,_0x41cc6a){_0x3e1c16=_0x3e1c16-0x0;var _0x6c3561=_0x9c5a[_0x3e1c16];return _0x6c3561;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa9c5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa9c5('0x4')]('in',_0xa9c5('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa9c5('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa9c5('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa9c5('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e719c8c..0a95a75 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 _0x8fd4=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','describe','sms-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteractionId','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','fullname','interface','SmsAccountId','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','inspect','infobip','groupName','DELIVERED','rimraf','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','name','index','SmsMessage','fieldName','type','model','query','keys','filters'];(function(_0xa3c43c,_0x26a7a6){var _0x4d9829=function(_0x48f7ef){while(--_0x48f7ef){_0xa3c43c['push'](_0xa3c43c['shift']());}};_0x4d9829(++_0x26a7a6);}(_0x8fd4,0x178));var _0x48fd=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x8fd4[_0x62c958];return _0x57ec61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48fd('0x0'));var zipdir=require(_0x48fd('0x1'));var jsonpatch=require(_0x48fd('0x2'));var rp=require(_0x48fd('0x3'));var moment=require(_0x48fd('0x4'));var BPromise=require(_0x48fd('0x5'));var Mustache=require(_0x48fd('0x6'));var util=require('util');var path=require(_0x48fd('0x7'));var sox=require(_0x48fd('0x8'));var csv=require('to-csv');var ejs=require(_0x48fd('0x9'));var fs=require('fs');var fs_extra=require(_0x48fd('0xa'));var _=require(_0x48fd('0xb'));var squel=require(_0x48fd('0xc'));var crypto=require(_0x48fd('0xd'));var jsforce=require(_0x48fd('0xe'));var deskjs=require(_0x48fd('0xf'));var toCsv=require(_0x48fd('0x10'));var querystring=require(_0x48fd('0x11'));var Papa=require(_0x48fd('0x12'));var Redis=require(_0x48fd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x48fd('0x14'));var as=require(_0x48fd('0x15'));var hardwareService=require(_0x48fd('0x16'));var logger=require(_0x48fd('0x17'))(_0x48fd('0x18'));var utils=require(_0x48fd('0x19'));var config=require(_0x48fd('0x1a'));var licenseUtil=require(_0x48fd('0x1b'));var db=require(_0x48fd('0x1c'))['db'];config[_0x48fd('0x1d')]=_['defaults'](config[_0x48fd('0x1d')],{'host':_0x48fd('0x1e'),'port':0x18eb});var socket=require(_0x48fd('0x1f'))(new Redis(config[_0x48fd('0x1d')]));require(_0x48fd('0x20'))[_0x48fd('0x21')](socket);var jayson=require(_0x48fd('0x22'));var client=jayson[_0x48fd('0x23')][_0x48fd('0x24')]({'port':0x232c});var client9002=jayson[_0x48fd('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0abe,_0x4d0040,_0x59399c,_0x440405){return new BPromise(function(_0x39033f,_0xd2d3e1){var _0x1e515a=_0x440405||client;return _0x1e515a[_0x48fd('0x25')](_0x5a0abe,_0x59399c)[_0x48fd('0x26')](function(_0x219c77){logger[_0x48fd('0x27')](_0x48fd('0x28'),_0x4d0040,_0x48fd('0x29'));logger[_0x48fd('0x2a')](_0x48fd('0x2b'),_0x4d0040,_0x48fd('0x29'),JSON[_0x48fd('0x2c')](_0x219c77));if(_0x219c77[_0x48fd('0x2d')]){if(_0x219c77['error'][_0x48fd('0x2e')]===0x1f4){logger['error'](_0x48fd('0x28'),_0x4d0040,_0x219c77[_0x48fd('0x2d')][_0x48fd('0x2f')]);return _0xd2d3e1(_0x219c77[_0x48fd('0x2d')][_0x48fd('0x2f')]);}logger[_0x48fd('0x2d')]('SmsMessage,\x20%s,\x20%s',_0x4d0040,_0x219c77[_0x48fd('0x2d')][_0x48fd('0x2f')]);return _0x39033f(_0x219c77[_0x48fd('0x2d')][_0x48fd('0x2f')]);}else{logger[_0x48fd('0x27')](_0x48fd('0x28'),_0x4d0040,_0x48fd('0x29'));_0x39033f(_0x219c77['result']['message']);}})[_0x48fd('0x30')](function(_0x2e3d6c){logger[_0x48fd('0x2d')](_0x48fd('0x28'),_0x4d0040,_0x2e3d6c);_0xd2d3e1(_0x2e3d6c);});});}function respondWithStatusCode(_0x811310,_0x4f3b1b){_0x4f3b1b=_0x4f3b1b||0xcc;return function(_0x513a5a){if(_0x513a5a){return _0x811310['sendStatus'](_0x4f3b1b);}return _0x811310[_0x48fd('0x31')](_0x4f3b1b)[_0x48fd('0x32')]();};}function respondWithResult(_0x225708,_0x20406c){_0x20406c=_0x20406c||0xc8;return function(_0x3a6eee){if(_0x3a6eee){return _0x225708[_0x48fd('0x31')](_0x20406c)['json'](_0x3a6eee);}};}function respondWithFilteredResult(_0xe8e4e9,_0x415979){return function(_0x3b9ba8){if(_0x3b9ba8){var _0x5b16d0=typeof _0x415979[_0x48fd('0x33')]===_0x48fd('0x34')&&typeof _0x415979[_0x48fd('0x35')]==='undefined';var _0x18ee4a=_0x3b9ba8[_0x48fd('0x36')];var _0x30ce8b=_0x5b16d0?0x0:_0x415979[_0x48fd('0x33')];var _0x31b807=_0x5b16d0?_0x3b9ba8[_0x48fd('0x36')]:_0x415979[_0x48fd('0x33')]+_0x415979[_0x48fd('0x35')];var _0x223f63;if(_0x31b807>=_0x18ee4a){_0x31b807=_0x18ee4a;_0x223f63=0xc8;}else{_0x223f63=0xce;}_0xe8e4e9[_0x48fd('0x31')](_0x223f63);return _0xe8e4e9[_0x48fd('0x37')](_0x48fd('0x38'),_0x30ce8b+'-'+_0x31b807+'/'+_0x18ee4a)[_0x48fd('0x39')](_0x3b9ba8);}return null;};}function patchUpdates(_0x32a309){return function(_0x26fff0){try{jsonpatch['apply'](_0x26fff0,_0x32a309,!![]);}catch(_0x52557f){return BPromise[_0x48fd('0x3a')](_0x52557f);}return _0x26fff0[_0x48fd('0x3b')]();};}function saveUpdates(_0x2af889,_0x20a8c9){return function(_0x357f91){if(_0x357f91){return _0x357f91[_0x48fd('0x3c')](_0x2af889)[_0x48fd('0x26')](function(_0xb4d7ea){return _0xb4d7ea;});}return null;};}function removeEntity(_0x511303,_0x34f4ff){return function(_0x333d72){if(_0x333d72){return _0x333d72[_0x48fd('0x3d')]()[_0x48fd('0x26')](function(){_0x511303[_0x48fd('0x31')](0xcc)[_0x48fd('0x32')]();});}};}function handleEntityNotFound(_0x466a56,_0x3fc11e){return function(_0x3bc5bd){if(!_0x3bc5bd){_0x466a56['sendStatus'](0x194);}return _0x3bc5bd;};}function handleError(_0x5bbab1,_0x2e2112){_0x2e2112=_0x2e2112||0x1f4;return function(_0x4705e3){logger[_0x48fd('0x2d')](_0x4705e3['stack']);if(_0x4705e3[_0x48fd('0x3e')]){delete _0x4705e3[_0x48fd('0x3e')];}_0x5bbab1['status'](_0x2e2112)['send'](_0x4705e3);};}exports[_0x48fd('0x3f')]=function(_0x47f2aa,_0x5dc6d7){var _0x196399={},_0x4d55bb={},_0x54a22c={'count':0x0,'rows':[]};var _0x44da12=_['map'](db[_0x48fd('0x40')]['rawAttributes'],function(_0x13f11d){return{'name':_0x13f11d[_0x48fd('0x41')],'type':_0x13f11d[_0x48fd('0x42')]['key']};});_0x4d55bb[_0x48fd('0x43')]=_['map'](_0x44da12,_0x48fd('0x3e'));_0x4d55bb[_0x48fd('0x44')]=_[_0x48fd('0x45')](_0x47f2aa[_0x48fd('0x44')]);_0x4d55bb[_0x48fd('0x46')]=_[_0x48fd('0x47')](_0x4d55bb[_0x48fd('0x43')],_0x4d55bb[_0x48fd('0x44')]);_0x196399['attributes']=_[_0x48fd('0x47')](_0x4d55bb[_0x48fd('0x43')],qs['fields'](_0x47f2aa[_0x48fd('0x44')][_0x48fd('0x48')]));_0x196399['attributes']=_0x196399[_0x48fd('0x49')][_0x48fd('0x4a')]?_0x196399[_0x48fd('0x49')]:_0x4d55bb[_0x48fd('0x43')];if(!_0x47f2aa['query'][_0x48fd('0x4b')](_0x48fd('0x4c'))){_0x196399[_0x48fd('0x35')]=qs[_0x48fd('0x35')](_0x47f2aa[_0x48fd('0x44')]['limit']);_0x196399[_0x48fd('0x33')]=qs[_0x48fd('0x33')](_0x47f2aa['query']['offset']);}_0x196399[_0x48fd('0x4d')]=qs[_0x48fd('0x4e')](_0x47f2aa[_0x48fd('0x44')]['sort']);_0x196399[_0x48fd('0x4f')]=qs[_0x48fd('0x46')](_[_0x48fd('0x50')](_0x47f2aa[_0x48fd('0x44')],_0x4d55bb[_0x48fd('0x46')]),_0x44da12);if(_0x47f2aa['query']['filter']){_0x196399[_0x48fd('0x4f')]=_['merge'](_0x196399[_0x48fd('0x4f')],{'$or':_[_0x48fd('0x51')](_0x44da12,function(_0x547f5f){if(_0x547f5f['type']!==_0x48fd('0x52')){var _0x1e76e5={};_0x1e76e5[_0x547f5f['name']]={'$like':'%'+_0x47f2aa[_0x48fd('0x44')][_0x48fd('0x53')]+'%'};return _0x1e76e5;}})});}_0x196399=_[_0x48fd('0x54')]({},_0x196399,_0x47f2aa[_0x48fd('0x55')]);var _0x4cb7c1={'where':_0x196399[_0x48fd('0x4f')]};return db[_0x48fd('0x40')][_0x48fd('0x36')](_0x4cb7c1)[_0x48fd('0x26')](function(_0x3ff464){_0x54a22c[_0x48fd('0x36')]=_0x3ff464;if(_0x47f2aa[_0x48fd('0x44')][_0x48fd('0x56')]){_0x196399[_0x48fd('0x57')]=[{'all':!![]}];}return db[_0x48fd('0x40')]['findAll'](_0x196399);})[_0x48fd('0x26')](function(_0x296b75){_0x54a22c[_0x48fd('0x58')]=_0x296b75;return _0x54a22c;})[_0x48fd('0x26')](respondWithFilteredResult(_0x5dc6d7,_0x196399))[_0x48fd('0x30')](handleError(_0x5dc6d7,null));};exports[_0x48fd('0x59')]=function(_0x18ed43,_0x5b124){var _0x27157d={'raw':!![],'where':{'id':_0x18ed43[_0x48fd('0x5a')]['id']}},_0x48ce71={};_0x48ce71[_0x48fd('0x43')]=_[_0x48fd('0x45')](db[_0x48fd('0x40')][_0x48fd('0x5b')]);_0x48ce71[_0x48fd('0x44')]=_[_0x48fd('0x45')](_0x18ed43[_0x48fd('0x44')]);_0x48ce71['filters']=_[_0x48fd('0x47')](_0x48ce71[_0x48fd('0x43')],_0x48ce71[_0x48fd('0x44')]);_0x27157d[_0x48fd('0x49')]=_[_0x48fd('0x47')](_0x48ce71[_0x48fd('0x43')],qs[_0x48fd('0x48')](_0x18ed43['query']['fields']));_0x27157d['attributes']=_0x27157d['attributes'][_0x48fd('0x4a')]?_0x27157d['attributes']:_0x48ce71['model'];if(_0x18ed43[_0x48fd('0x44')][_0x48fd('0x56')]){_0x27157d['include']=[{'all':!![]}];}_0x27157d=_[_0x48fd('0x54')]({},_0x27157d,_0x18ed43['options']);return db[_0x48fd('0x40')][_0x48fd('0x5c')](_0x27157d)[_0x48fd('0x26')](handleEntityNotFound(_0x5b124,null))[_0x48fd('0x26')](respondWithResult(_0x5b124,null))['catch'](handleError(_0x5b124,null));};exports[_0x48fd('0x5d')]=function(_0x4e76ce,_0x191701){return db['SmsMessage'][_0x48fd('0x5d')](_0x4e76ce[_0x48fd('0x5e')],{})[_0x48fd('0x26')](respondWithResult(_0x191701,0xc9))[_0x48fd('0x30')](handleError(_0x191701,null));};exports[_0x48fd('0x3c')]=function(_0x43e68a,_0xe444b8){if(_0x43e68a[_0x48fd('0x5e')]['id']){delete _0x43e68a[_0x48fd('0x5e')]['id'];}return db[_0x48fd('0x40')][_0x48fd('0x5c')]({'where':{'id':_0x43e68a[_0x48fd('0x5a')]['id']}})[_0x48fd('0x26')](handleEntityNotFound(_0xe444b8,null))[_0x48fd('0x26')](saveUpdates(_0x43e68a['body'],null))[_0x48fd('0x26')](respondWithResult(_0xe444b8,null))[_0x48fd('0x30')](handleError(_0xe444b8,null));};exports[_0x48fd('0x3d')]=function(_0x771afe,_0x2a1279){return db[_0x48fd('0x40')][_0x48fd('0x5c')]({'where':{'id':_0x771afe[_0x48fd('0x5a')]['id']}})[_0x48fd('0x26')](handleEntityNotFound(_0x2a1279,null))[_0x48fd('0x26')](removeEntity(_0x2a1279,null))['catch'](handleError(_0x2a1279,null));};exports[_0x48fd('0x5f')]=function(_0x2adeb1,_0x22b8e1){return db['SmsMessage'][_0x48fd('0x5f')]()[_0x48fd('0x26')](respondWithResult(_0x22b8e1,null))[_0x48fd('0x30')](handleError(_0x22b8e1,null));};var interaction_log=require(_0x48fd('0x17'))(_0x48fd('0x60'));exports[_0x48fd('0x61')]=function(_0x391d0a,_0x775383,_0x40d823){var _0x4bc86b={'agent':{},'channel':'sms'};if(_0x391d0a[_0x48fd('0x5e')]['id']){delete _0x391d0a[_0x48fd('0x5e')]['id'];}_0x391d0a[_0x48fd('0x5e')]['read']=!![];_0x391d0a[_0x48fd('0x5e')][_0x48fd('0x62')]=moment()['format'](_0x48fd('0x63'));_0x391d0a['body'][_0x48fd('0x64')]=_0x391d0a[_0x48fd('0x5e')][_0x48fd('0x64')]||_0x391d0a[_0x48fd('0x65')]['id'];_0x4bc86b[_0x48fd('0x66')]['id']=_0x391d0a[_0x48fd('0x5e')][_0x48fd('0x64')];return db[_0x48fd('0x40')][_0x48fd('0x5c')]({'where':{'id':_0x391d0a[_0x48fd('0x5a')]['id'],'UserId':null}})[_0x48fd('0x26')](handleEntityNotFound(_0x775383,null))[_0x48fd('0x26')](saveUpdates(_0x391d0a[_0x48fd('0x5e')],null))[_0x48fd('0x26')](function(_0x1b36ee){if(_0x1b36ee){_0x4bc86b[_0x48fd('0x2f')]=_0x1b36ee['get']({'plain':!![]});return db['SmsInteraction'][_0x48fd('0x5c')]({'where':{'id':_0x1b36ee[_0x48fd('0x67')]}});}return null;})[_0x48fd('0x26')](handleEntityNotFound(_0x775383,null))[_0x48fd('0x26')](function(_0x1f0004){if(_0x1f0004){return _0x1f0004[_0x48fd('0x3c')]({'UserId':_0x391d0a[_0x48fd('0x5e')][_0x48fd('0x64')],'read1stAt':_['isNil'](_0x1f0004[_0x48fd('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x48fd('0x26')](function(_0x3c38ac){if(_0x3c38ac){_0x4bc86b[_0x48fd('0x69')]=_0x3c38ac[_0x48fd('0x6a')]({'plain':!![]});interaction_log['info'](_0x48fd('0x6b'),_0x391d0a[_0x48fd('0x65')]['id'],_0x391d0a[_0x48fd('0x65')][_0x48fd('0x3e')],_0x391d0a[_0x48fd('0x65')][_0x48fd('0x6c')],_0x4bc86b[_0x48fd('0x69')]['id'],_0x391d0a[_0x48fd('0x5e')]?JSON[_0x48fd('0x2c')](_0x391d0a[_0x48fd('0x5e')]):'null');return respondWithRpcPromise(_0x48fd('0x6d'),_0x48fd('0x6e'),_0x4bc86b);}return null;})[_0x48fd('0x26')](function(_0x31fb9a){var _0x27b258=_0x48fd('0x6f')+_0x31fb9a['message'][_0x48fd('0x70')];return db[_0x48fd('0x71')]['query'](_0x27b258,{'type':db[_0x48fd('0x72')][_0x48fd('0x73')][_0x48fd('0x74')],'raw':!![]})[_0x48fd('0x26')](function(_0x21eab6){return _0x21eab6;});})['then'](function(_0x42eadf){if(_0x42eadf){_0x4bc86b[_0x48fd('0x2f')][_0x48fd('0x75')]=_0x42eadf[0x0];if(!_0x391d0a[_0x48fd('0x5e')][_0x48fd('0x64')])return;return db[_0x48fd('0x76')]['find']({'where':{'id':_0x391d0a[_0x48fd('0x5e')][_0x48fd('0x64')],'role':_0x48fd('0x66')},'attributes':['id','name','fullname',_0x48fd('0x77'),_0x48fd('0x78')],'raw':!![]});}return null;})[_0x48fd('0x26')](function(_0x513dca){if(!_0x513dca)return null;_0x4bc86b[_0x48fd('0x2f')][_0x48fd('0x66')]=_0x513dca;return _0x4bc86b;})[_0x48fd('0x26')](function(_0x2a6f4a){if(_0x2a6f4a){if(_0x391d0a[_0x48fd('0x5e')]['manual']){_0x4bc86b[_0x48fd('0x2f')]['interface']=util[_0x48fd('0x79')](_0x48fd('0x7a'),_0x391d0a[_0x48fd('0x65')][_0x48fd('0x3e')]);_0x4bc86b[_0x48fd('0x2f')][_0x48fd('0x7b')]=_0x4bc86b[_0x48fd('0x7b')];_0x4bc86b[_0x48fd('0x2f')][_0x48fd('0x7c')]=_0x4bc86b[_0x48fd('0x7b')];_0x4bc86b[_0x48fd('0x2f')][_0x48fd('0x7d')]=_0x48fd('0x61');return respondWithRpcPromise(_0x48fd('0x7e'),_0x48fd('0x7e'),{'event':_0x48fd('0x7f'),'message':_0x4bc86b['message']},client9002)[_0x48fd('0x26')](function(){return _0x4bc86b;});}return _0x4bc86b;}return null;})[_0x48fd('0x26')](respondWithResult(_0x775383,null))['catch'](handleError(_0x775383,null));};var interaction_log=require('../../config/logger')(_0x48fd('0x60'));exports['reject']=function(_0x41efe0,_0xc1b1a0,_0x23b731){var _0x2cf4ff={'agent':{},'channel':_0x48fd('0x80')};if(_0x41efe0[_0x48fd('0x5e')]['id']){delete _0x41efe0[_0x48fd('0x5e')]['id'];}_0x41efe0['body'][_0x48fd('0x64')]=_0x41efe0[_0x48fd('0x5e')]['UserId']||_0x41efe0['user']['id'];_0x2cf4ff[_0x48fd('0x66')]['id']=_0x41efe0[_0x48fd('0x5e')]['UserId'];return db[_0x48fd('0x40')][_0x48fd('0x5c')]({'where':{'id':_0x41efe0[_0x48fd('0x5a')]['id'],'UserId':null}})[_0x48fd('0x26')](handleEntityNotFound(_0xc1b1a0,null))[_0x48fd('0x26')](function(_0x50f94d){if(_0x50f94d){_0x2cf4ff['message']=_0x50f94d[_0x48fd('0x6a')]({'plain':!![]});return db[_0x48fd('0x81')][_0x48fd('0x5c')]({'where':{'id':_0x50f94d[_0x48fd('0x67')]}});}return null;})[_0x48fd('0x26')](handleEntityNotFound(_0xc1b1a0,null))[_0x48fd('0x26')](function(_0x570740){if(_0x570740){_0x2cf4ff[_0x48fd('0x69')]=_0x570740[_0x48fd('0x6a')]({'plain':!![]});interaction_log[_0x48fd('0x27')](_0x48fd('0x82'),_0x41efe0['user']['id'],_0x41efe0[_0x48fd('0x65')]['name'],_0x41efe0['user'][_0x48fd('0x6c')],_0x2cf4ff[_0x48fd('0x69')]['id'],_0x41efe0['body']?JSON['stringify'](_0x41efe0['body']):_0x48fd('0x83'));return respondWithRpcPromise(_0x48fd('0x84'),'rejectMessage',_0x2cf4ff);}return null;})['then'](function(_0x1a17e5){var _0x123f51=_0x48fd('0x6f')+_0x1a17e5[_0x48fd('0x2f')][_0x48fd('0x70')];return db[_0x48fd('0x71')][_0x48fd('0x44')](_0x123f51,{'type':db[_0x48fd('0x72')][_0x48fd('0x73')][_0x48fd('0x74')],'raw':!![]})[_0x48fd('0x26')](function(_0x5240de){return _0x5240de;});})[_0x48fd('0x26')](function(_0x393bbe){if(_0x393bbe){_0x2cf4ff[_0x48fd('0x2f')][_0x48fd('0x75')]=_0x393bbe[0x0];if(!_0x41efe0[_0x48fd('0x5e')][_0x48fd('0x64')])return;return db[_0x48fd('0x76')][_0x48fd('0x5c')]({'where':{'id':_0x41efe0[_0x48fd('0x5e')][_0x48fd('0x64')],'role':_0x48fd('0x66')},'attributes':['id',_0x48fd('0x3e'),_0x48fd('0x85'),_0x48fd('0x77'),_0x48fd('0x78')],'raw':!![]});}return null;})['then'](function(_0x13333e){if(!_0x13333e)return null;_0x2cf4ff[_0x48fd('0x2f')][_0x48fd('0x66')]=_0x13333e;return _0x2cf4ff;})[_0x48fd('0x26')](function(_0x40ef66){if(_0x40ef66){_0x40ef66[_0x48fd('0x2f')][_0x48fd('0x86')]=util['format'](_0x48fd('0x7a'),_0x41efe0[_0x48fd('0x65')][_0x48fd('0x3e')]);_0x40ef66[_0x48fd('0x2f')][_0x48fd('0x7b')]=_0x2cf4ff[_0x48fd('0x7b')];_0x40ef66['message']['motionChannel']=_0x2cf4ff['channel'];_0x40ef66[_0x48fd('0x2f')]['event']=_0x48fd('0x3a');respondWithRpcPromise('EventManager',_0x48fd('0x7e'),{'event':'rejectmessage','message':_0x40ef66[_0x48fd('0x2f')]},client9002);return _0x2cf4ff;}return null;})[_0x48fd('0x26')](respondWithResult(_0xc1b1a0,null))[_0x48fd('0x30')](handleError(_0xc1b1a0,null));};exports[_0x48fd('0x31')]=function(_0x2c8556,_0x3d8371,_0x44a7d1){if(_0x2c8556[_0x48fd('0x5e')]['id']){delete _0x2c8556['body']['id'];}var _0x840f17;return db[_0x48fd('0x40')][_0x48fd('0x5c')]({'where':{'id':_0x2c8556[_0x48fd('0x5a')]['id']}})[_0x48fd('0x26')](handleEntityNotFound(_0x3d8371,null))['then'](function(_0x229592){if(_0x229592){_0x840f17=_0x229592;return db['SmsAccount'][_0x48fd('0x5c')]({'where':{'id':_0x229592[_0x48fd('0x87')]}});}})[_0x48fd('0x26')](handleEntityNotFound(_0x3d8371,null))[_0x48fd('0x26')](function(_0x58376a){if(_0x58376a){logger[_0x48fd('0x2a')](_0x48fd('0x2b'),_0x48fd('0x31'),'received\x20delivery\x20report\x20from',_0x58376a[_0x48fd('0x42')],util['inspect'](_0x2c8556['body'],{'showHidden':![],'depth':null}));switch(_0x58376a[_0x48fd('0x42')]){case _0x48fd('0x88'):if(_0x2c8556[_0x48fd('0x5e')]['MessageSid']&&_0x2c8556['body']['MessageSid']===_0x840f17[_0x48fd('0x89')]){return _0x840f17['update']({'read':!![]});}else{logger[_0x48fd('0x2d')](_0x48fd('0x8a'),'status','twilio',util['inspect'](_0x2c8556[_0x48fd('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x48fd('0x8b'):if(_0x2c8556[_0x48fd('0x5e')][_0x48fd('0x8c')]&&_0x2c8556[_0x48fd('0x5e')][_0x48fd('0x8c')]===_0x840f17[_0x48fd('0x89')]&&_['indexOf']([_0x48fd('0x8d'),_0x48fd('0x8e')],_0x2c8556[_0x48fd('0x5e')][_0x48fd('0x8f')])>=0x0){return _0x840f17[_0x48fd('0x3c')]({'read':!![]});}else{logger[_0x48fd('0x2d')](_0x48fd('0x8a'),'status',_0x48fd('0x90'),util[_0x48fd('0x91')](_0x2c8556[_0x48fd('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x48fd('0x92'):var _0x267668=_0x2c8556[_0x48fd('0x5e')]['results'][0x0];if(_0x267668[_0x48fd('0x31')][_0x48fd('0x93')]===_0x48fd('0x94')){return _0x840f17[_0x48fd('0x3c')]({'read':!![]});}else{logger['error'](_0x48fd('0x8a'),_0x48fd('0x31'),_0x48fd('0x92'),util['inspect'](_0x2c8556[_0x48fd('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x840f17;}})[_0x48fd('0x26')](respondWithResult(_0x3d8371,null))[_0x48fd('0x30')](handleError(_0x3d8371,null));}; \ No newline at end of file +var _0x4e2e=['read1stAt','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','internal','motionChannel','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','SmsMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','find','create','body','describe','sms-interactions','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil'];(function(_0x5738f7,_0x17df47){var _0x2e6d3c=function(_0x5c9b13){while(--_0x5c9b13){_0x5738f7['push'](_0x5738f7['shift']());}};_0x2e6d3c(++_0x17df47);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2ce6fa,_0x3de4a4){_0x2ce6fa=_0x2ce6fa-0x0;var _0x3689e2=_0x4e2e[_0x2ce6fa];return _0x3689e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];config[_0xe4e2('0x1a')]=_[_0xe4e2('0x1b')](config[_0xe4e2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4e2('0x1c'))(new Redis(config[_0xe4e2('0x1a')]));require(_0xe4e2('0x1d'))[_0xe4e2('0x1e')](socket);var jayson=require(_0xe4e2('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe4e2('0x20')][_0xe4e2('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1f9b2d,_0x28ee12,_0x217ea5,_0x54107a){return new BPromise(function(_0x754778,_0x3e8bb6){var _0x340935=_0x54107a||client;return _0x340935['request'](_0x1f9b2d,_0x217ea5)[_0xe4e2('0x22')](function(_0x54c80b){logger[_0xe4e2('0x23')](_0xe4e2('0x24'),_0x28ee12,_0xe4e2('0x25'));logger[_0xe4e2('0x26')](_0xe4e2('0x27'),_0x28ee12,_0xe4e2('0x25'),JSON[_0xe4e2('0x28')](_0x54c80b));if(_0x54c80b[_0xe4e2('0x29')]){if(_0x54c80b[_0xe4e2('0x29')][_0xe4e2('0x2a')]===0x1f4){logger['error'](_0xe4e2('0x24'),_0x28ee12,_0x54c80b[_0xe4e2('0x29')][_0xe4e2('0x2b')]);return _0x3e8bb6(_0x54c80b[_0xe4e2('0x29')][_0xe4e2('0x2b')]);}logger[_0xe4e2('0x29')](_0xe4e2('0x24'),_0x28ee12,_0x54c80b['error'][_0xe4e2('0x2b')]);return _0x754778(_0x54c80b[_0xe4e2('0x29')][_0xe4e2('0x2b')]);}else{logger['info'](_0xe4e2('0x24'),_0x28ee12,_0xe4e2('0x25'));_0x754778(_0x54c80b['result'][_0xe4e2('0x2b')]);}})[_0xe4e2('0x2c')](function(_0x29143c){logger[_0xe4e2('0x29')](_0xe4e2('0x24'),_0x28ee12,_0x29143c);_0x3e8bb6(_0x29143c);});});}function respondWithStatusCode(_0x5887c9,_0x166610){_0x166610=_0x166610||0xcc;return function(_0x357903){if(_0x357903){return _0x5887c9[_0xe4e2('0x2d')](_0x166610);}return _0x5887c9['status'](_0x166610)[_0xe4e2('0x2e')]();};}function respondWithResult(_0x41cfd9,_0x31f651){_0x31f651=_0x31f651||0xc8;return function(_0x5ec692){if(_0x5ec692){return _0x41cfd9[_0xe4e2('0x2f')](_0x31f651)['json'](_0x5ec692);}};}function respondWithFilteredResult(_0x477b5c,_0x1e21c0){return function(_0x52c849){if(_0x52c849){var _0x46926a=typeof _0x1e21c0[_0xe4e2('0x30')]===_0xe4e2('0x31')&&typeof _0x1e21c0[_0xe4e2('0x32')]===_0xe4e2('0x31');var _0x4d33de=_0x52c849['count'];var _0x2cb235=_0x46926a?0x0:_0x1e21c0[_0xe4e2('0x30')];var _0x12848d=_0x46926a?_0x52c849[_0xe4e2('0x33')]:_0x1e21c0[_0xe4e2('0x30')]+_0x1e21c0[_0xe4e2('0x32')];var _0x1c7f9a;if(_0x12848d>=_0x4d33de){_0x12848d=_0x4d33de;_0x1c7f9a=0xc8;}else{_0x1c7f9a=0xce;}_0x477b5c[_0xe4e2('0x2f')](_0x1c7f9a);return _0x477b5c[_0xe4e2('0x34')](_0xe4e2('0x35'),_0x2cb235+'-'+_0x12848d+'/'+_0x4d33de)[_0xe4e2('0x36')](_0x52c849);}return null;};}function patchUpdates(_0x3fb693){return function(_0x4ce75b){try{jsonpatch[_0xe4e2('0x37')](_0x4ce75b,_0x3fb693,!![]);}catch(_0x8ffc6){return BPromise[_0xe4e2('0x38')](_0x8ffc6);}return _0x4ce75b[_0xe4e2('0x39')]();};}function saveUpdates(_0x1431b0,_0x201e77){return function(_0x554344){if(_0x554344){return _0x554344[_0xe4e2('0x3a')](_0x1431b0)[_0xe4e2('0x22')](function(_0xea95fe){return _0xea95fe;});}return null;};}function removeEntity(_0x11ca74,_0x2b0fe9){return function(_0x2706a3){if(_0x2706a3){return _0x2706a3[_0xe4e2('0x3b')]()[_0xe4e2('0x22')](function(){_0x11ca74[_0xe4e2('0x2f')](0xcc)[_0xe4e2('0x2e')]();});}};}function handleEntityNotFound(_0x2767df,_0x4ac14d){return function(_0x2c831f){if(!_0x2c831f){_0x2767df['sendStatus'](0x194);}return _0x2c831f;};}function handleError(_0x44554f,_0x2cd933){_0x2cd933=_0x2cd933||0x1f4;return function(_0x54de19){logger[_0xe4e2('0x29')](_0x54de19[_0xe4e2('0x3c')]);if(_0x54de19[_0xe4e2('0x3d')]){delete _0x54de19[_0xe4e2('0x3d')];}_0x44554f['status'](_0x2cd933)[_0xe4e2('0x3e')](_0x54de19);};}exports['index']=function(_0x2164d2,_0x58e5fe){var _0x15deaa={},_0x1c6f9a={},_0x237ad2={'count':0x0,'rows':[]};var _0x57c1c3=_[_0xe4e2('0x3f')](db[_0xe4e2('0x40')]['rawAttributes'],function(_0x2b0f61){return{'name':_0x2b0f61[_0xe4e2('0x41')],'type':_0x2b0f61[_0xe4e2('0x42')][_0xe4e2('0x43')]};});_0x1c6f9a[_0xe4e2('0x44')]=_[_0xe4e2('0x3f')](_0x57c1c3,_0xe4e2('0x3d'));_0x1c6f9a[_0xe4e2('0x45')]=_[_0xe4e2('0x46')](_0x2164d2['query']);_0x1c6f9a['filters']=_[_0xe4e2('0x47')](_0x1c6f9a[_0xe4e2('0x44')],_0x1c6f9a[_0xe4e2('0x45')]);_0x15deaa[_0xe4e2('0x48')]=_['intersection'](_0x1c6f9a['model'],qs[_0xe4e2('0x49')](_0x2164d2[_0xe4e2('0x45')][_0xe4e2('0x49')]));_0x15deaa[_0xe4e2('0x48')]=_0x15deaa['attributes'][_0xe4e2('0x4a')]?_0x15deaa[_0xe4e2('0x48')]:_0x1c6f9a[_0xe4e2('0x44')];if(!_0x2164d2['query'][_0xe4e2('0x4b')]('nolimit')){_0x15deaa[_0xe4e2('0x32')]=qs[_0xe4e2('0x32')](_0x2164d2['query']['limit']);_0x15deaa[_0xe4e2('0x30')]=qs[_0xe4e2('0x30')](_0x2164d2[_0xe4e2('0x45')]['offset']);}_0x15deaa[_0xe4e2('0x4c')]=qs[_0xe4e2('0x4d')](_0x2164d2['query'][_0xe4e2('0x4d')]);_0x15deaa[_0xe4e2('0x4e')]=qs[_0xe4e2('0x4f')](_[_0xe4e2('0x50')](_0x2164d2[_0xe4e2('0x45')],_0x1c6f9a[_0xe4e2('0x4f')]),_0x57c1c3);if(_0x2164d2[_0xe4e2('0x45')][_0xe4e2('0x51')]){_0x15deaa['where']=_[_0xe4e2('0x52')](_0x15deaa[_0xe4e2('0x4e')],{'$or':_['map'](_0x57c1c3,function(_0x47c50c){if(_0x47c50c[_0xe4e2('0x42')]!==_0xe4e2('0x53')){var _0x1ae6a9={};_0x1ae6a9[_0x47c50c['name']]={'$like':'%'+_0x2164d2[_0xe4e2('0x45')][_0xe4e2('0x51')]+'%'};return _0x1ae6a9;}})});}_0x15deaa=_[_0xe4e2('0x52')]({},_0x15deaa,_0x2164d2[_0xe4e2('0x54')]);var _0x57d241={'where':_0x15deaa[_0xe4e2('0x4e')]};return db[_0xe4e2('0x40')][_0xe4e2('0x33')](_0x57d241)[_0xe4e2('0x22')](function(_0x5ba324){_0x237ad2[_0xe4e2('0x33')]=_0x5ba324;if(_0x2164d2[_0xe4e2('0x45')]['includeAll']){_0x15deaa[_0xe4e2('0x55')]=[{'all':!![]}];}return db[_0xe4e2('0x40')][_0xe4e2('0x56')](_0x15deaa);})['then'](function(_0x11855d){_0x237ad2[_0xe4e2('0x57')]=_0x11855d;return _0x237ad2;})[_0xe4e2('0x22')](respondWithFilteredResult(_0x58e5fe,_0x15deaa))['catch'](handleError(_0x58e5fe,null));};exports['show']=function(_0xccf95e,_0x4c6253){var _0xb0f89d={'raw':!![],'where':{'id':_0xccf95e[_0xe4e2('0x58')]['id']}},_0x5b2cab={};_0x5b2cab[_0xe4e2('0x44')]=_[_0xe4e2('0x46')](db['SmsMessage'][_0xe4e2('0x59')]);_0x5b2cab['query']=_[_0xe4e2('0x46')](_0xccf95e[_0xe4e2('0x45')]);_0x5b2cab['filters']=_[_0xe4e2('0x47')](_0x5b2cab['model'],_0x5b2cab[_0xe4e2('0x45')]);_0xb0f89d[_0xe4e2('0x48')]=_['intersection'](_0x5b2cab[_0xe4e2('0x44')],qs[_0xe4e2('0x49')](_0xccf95e[_0xe4e2('0x45')][_0xe4e2('0x49')]));_0xb0f89d[_0xe4e2('0x48')]=_0xb0f89d[_0xe4e2('0x48')][_0xe4e2('0x4a')]?_0xb0f89d[_0xe4e2('0x48')]:_0x5b2cab[_0xe4e2('0x44')];if(_0xccf95e['query'][_0xe4e2('0x5a')]){_0xb0f89d[_0xe4e2('0x55')]=[{'all':!![]}];}_0xb0f89d=_[_0xe4e2('0x52')]({},_0xb0f89d,_0xccf95e[_0xe4e2('0x54')]);return db[_0xe4e2('0x40')][_0xe4e2('0x5b')](_0xb0f89d)[_0xe4e2('0x22')](handleEntityNotFound(_0x4c6253,null))[_0xe4e2('0x22')](respondWithResult(_0x4c6253,null))[_0xe4e2('0x2c')](handleError(_0x4c6253,null));};exports[_0xe4e2('0x5c')]=function(_0xf0c187,_0x561f7c){return db[_0xe4e2('0x40')][_0xe4e2('0x5c')](_0xf0c187[_0xe4e2('0x5d')],{})[_0xe4e2('0x22')](respondWithResult(_0x561f7c,0xc9))['catch'](handleError(_0x561f7c,null));};exports[_0xe4e2('0x3a')]=function(_0x1250a2,_0x54f07d){if(_0x1250a2[_0xe4e2('0x5d')]['id']){delete _0x1250a2[_0xe4e2('0x5d')]['id'];}return db[_0xe4e2('0x40')][_0xe4e2('0x5b')]({'where':{'id':_0x1250a2['params']['id']}})[_0xe4e2('0x22')](handleEntityNotFound(_0x54f07d,null))['then'](saveUpdates(_0x1250a2[_0xe4e2('0x5d')],null))[_0xe4e2('0x22')](respondWithResult(_0x54f07d,null))[_0xe4e2('0x2c')](handleError(_0x54f07d,null));};exports[_0xe4e2('0x3b')]=function(_0x2cc813,_0x26ab38){return db[_0xe4e2('0x40')][_0xe4e2('0x5b')]({'where':{'id':_0x2cc813[_0xe4e2('0x58')]['id']}})[_0xe4e2('0x22')](handleEntityNotFound(_0x26ab38,null))[_0xe4e2('0x22')](removeEntity(_0x26ab38,null))[_0xe4e2('0x2c')](handleError(_0x26ab38,null));};exports['describe']=function(_0x435dbc,_0x58dc01){return db['SmsMessage'][_0xe4e2('0x5e')]()[_0xe4e2('0x22')](respondWithResult(_0x58dc01,null))[_0xe4e2('0x2c')](handleError(_0x58dc01,null));};var interaction_log=require('../../config/logger')(_0xe4e2('0x5f'));exports['accept']=function(_0xb9e975,_0x9ba757,_0x495e69){var _0x15eb35={'agent':{},'channel':_0xe4e2('0x60')};if(_0xb9e975['body']['id']){delete _0xb9e975[_0xe4e2('0x5d')]['id'];}_0xb9e975[_0xe4e2('0x5d')]['read']=!![];_0xb9e975[_0xe4e2('0x5d')][_0xe4e2('0x61')]=moment()[_0xe4e2('0x62')](_0xe4e2('0x63'));_0xb9e975['body'][_0xe4e2('0x64')]=_0xb9e975[_0xe4e2('0x5d')][_0xe4e2('0x64')]||_0xb9e975[_0xe4e2('0x65')]['id'];_0x15eb35[_0xe4e2('0x66')]['id']=_0xb9e975[_0xe4e2('0x5d')][_0xe4e2('0x64')];return db[_0xe4e2('0x40')][_0xe4e2('0x5b')]({'where':{'id':_0xb9e975['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x9ba757,null))['then'](saveUpdates(_0xb9e975[_0xe4e2('0x5d')],null))[_0xe4e2('0x22')](function(_0x4126f7){if(_0x4126f7){_0x15eb35[_0xe4e2('0x2b')]=_0x4126f7[_0xe4e2('0x67')]({'plain':!![]});return db[_0xe4e2('0x68')][_0xe4e2('0x5b')]({'where':{'id':_0x4126f7['SmsInteractionId']}});}return null;})[_0xe4e2('0x22')](handleEntityNotFound(_0x9ba757,null))[_0xe4e2('0x22')](function(_0x1a96af){if(_0x1a96af){return _0x1a96af[_0xe4e2('0x3a')]({'UserId':_0xb9e975[_0xe4e2('0x5d')][_0xe4e2('0x64')],'read1stAt':_[_0xe4e2('0x69')](_0x1a96af[_0xe4e2('0x6a')])?moment()[_0xe4e2('0x62')](_0xe4e2('0x63')):undefined});}return null;})[_0xe4e2('0x22')](function(_0x608633){if(_0x608633){_0x15eb35[_0xe4e2('0x6b')]=_0x608633[_0xe4e2('0x67')]({'plain':!![]});interaction_log[_0xe4e2('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb9e975[_0xe4e2('0x65')]['id'],_0xb9e975[_0xe4e2('0x65')][_0xe4e2('0x3d')],_0xb9e975[_0xe4e2('0x65')][_0xe4e2('0x6c')],_0x15eb35[_0xe4e2('0x6b')]['id'],_0xb9e975[_0xe4e2('0x5d')]?JSON[_0xe4e2('0x28')](_0xb9e975[_0xe4e2('0x5d')]):_0xe4e2('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xe4e2('0x6e'),_0x15eb35);}return null;})[_0xe4e2('0x22')](function(_0x11679c){var _0x277384=_0xe4e2('0x6f')+_0x11679c[_0xe4e2('0x2b')][_0xe4e2('0x70')];return db[_0xe4e2('0x71')]['query'](_0x277384,{'type':db[_0xe4e2('0x72')][_0xe4e2('0x73')][_0xe4e2('0x74')],'raw':!![]})[_0xe4e2('0x22')](function(_0x4f09a){return _0x4f09a;});})[_0xe4e2('0x22')](function(_0x22f79e){if(_0x22f79e){_0x15eb35[_0xe4e2('0x2b')][_0xe4e2('0x75')]=_0x22f79e[0x0];if(!_0xb9e975[_0xe4e2('0x5d')]['UserId'])return;return db[_0xe4e2('0x76')][_0xe4e2('0x5b')]({'where':{'id':_0xb9e975['body'][_0xe4e2('0x64')],'role':_0xe4e2('0x66')},'attributes':['id',_0xe4e2('0x3d'),_0xe4e2('0x77'),_0xe4e2('0x78'),'internal'],'raw':!![]});}return null;})[_0xe4e2('0x22')](function(_0x1447ee){if(!_0x1447ee)return null;_0x15eb35[_0xe4e2('0x2b')][_0xe4e2('0x66')]=_0x1447ee;return _0x15eb35;})[_0xe4e2('0x22')](function(_0x113c47){if(_0x113c47){if(_0xb9e975[_0xe4e2('0x5d')][_0xe4e2('0x79')]){_0x15eb35['message'][_0xe4e2('0x7a')]=util[_0xe4e2('0x62')](_0xe4e2('0x7b'),_0xb9e975[_0xe4e2('0x65')][_0xe4e2('0x3d')]);_0x15eb35[_0xe4e2('0x2b')][_0xe4e2('0x7c')]=_0x15eb35[_0xe4e2('0x7c')];_0x15eb35[_0xe4e2('0x2b')]['motionChannel']=_0x15eb35[_0xe4e2('0x7c')];_0x15eb35[_0xe4e2('0x2b')][_0xe4e2('0x7d')]=_0xe4e2('0x7e');return respondWithRpcPromise(_0xe4e2('0x7f'),_0xe4e2('0x7f'),{'event':_0xe4e2('0x80'),'message':_0x15eb35[_0xe4e2('0x2b')]},client9002)[_0xe4e2('0x22')](function(){return _0x15eb35;});}return _0x15eb35;}return null;})[_0xe4e2('0x22')](respondWithResult(_0x9ba757,null))[_0xe4e2('0x2c')](handleError(_0x9ba757,null));};var interaction_log=require(_0xe4e2('0x15'))(_0xe4e2('0x5f'));exports['reject']=function(_0x3b4556,_0x5ed108,_0x17d765){var _0x18e8b3={'agent':{},'channel':'sms'};if(_0x3b4556[_0xe4e2('0x5d')]['id']){delete _0x3b4556[_0xe4e2('0x5d')]['id'];}_0x3b4556[_0xe4e2('0x5d')][_0xe4e2('0x64')]=_0x3b4556[_0xe4e2('0x5d')][_0xe4e2('0x64')]||_0x3b4556[_0xe4e2('0x65')]['id'];_0x18e8b3['agent']['id']=_0x3b4556[_0xe4e2('0x5d')][_0xe4e2('0x64')];return db['SmsMessage']['find']({'where':{'id':_0x3b4556[_0xe4e2('0x58')]['id'],'UserId':null}})[_0xe4e2('0x22')](handleEntityNotFound(_0x5ed108,null))[_0xe4e2('0x22')](function(_0x4ef70f){if(_0x4ef70f){_0x18e8b3[_0xe4e2('0x2b')]=_0x4ef70f['get']({'plain':!![]});return db[_0xe4e2('0x68')][_0xe4e2('0x5b')]({'where':{'id':_0x4ef70f['SmsInteractionId']}});}return null;})[_0xe4e2('0x22')](handleEntityNotFound(_0x5ed108,null))[_0xe4e2('0x22')](function(_0x45ecb8){if(_0x45ecb8){_0x18e8b3[_0xe4e2('0x6b')]=_0x45ecb8[_0xe4e2('0x67')]({'plain':!![]});interaction_log[_0xe4e2('0x23')](_0xe4e2('0x81'),_0x3b4556[_0xe4e2('0x65')]['id'],_0x3b4556[_0xe4e2('0x65')][_0xe4e2('0x3d')],_0x3b4556['user'][_0xe4e2('0x6c')],_0x18e8b3[_0xe4e2('0x6b')]['id'],_0x3b4556['body']?JSON[_0xe4e2('0x28')](_0x3b4556['body']):_0xe4e2('0x6d'));return respondWithRpcPromise(_0xe4e2('0x82'),_0xe4e2('0x83'),_0x18e8b3);}return null;})[_0xe4e2('0x22')](function(_0x4ac90a){var _0x18de85=_0xe4e2('0x6f')+_0x4ac90a[_0xe4e2('0x2b')][_0xe4e2('0x70')];return db[_0xe4e2('0x71')][_0xe4e2('0x45')](_0x18de85,{'type':db[_0xe4e2('0x72')]['QueryTypes']['SELECT'],'raw':!![]})[_0xe4e2('0x22')](function(_0x3d7f70){return _0x3d7f70;});})[_0xe4e2('0x22')](function(_0x2708fe){if(_0x2708fe){_0x18e8b3[_0xe4e2('0x2b')][_0xe4e2('0x75')]=_0x2708fe[0x0];if(!_0x3b4556[_0xe4e2('0x5d')][_0xe4e2('0x64')])return;return db[_0xe4e2('0x76')][_0xe4e2('0x5b')]({'where':{'id':_0x3b4556[_0xe4e2('0x5d')][_0xe4e2('0x64')],'role':_0xe4e2('0x66')},'attributes':['id',_0xe4e2('0x3d'),_0xe4e2('0x77'),_0xe4e2('0x78'),_0xe4e2('0x84')],'raw':!![]});}return null;})[_0xe4e2('0x22')](function(_0x1930b9){if(!_0x1930b9)return null;_0x18e8b3['message'][_0xe4e2('0x66')]=_0x1930b9;return _0x18e8b3;})[_0xe4e2('0x22')](function(_0x38f5ea){if(_0x38f5ea){_0x38f5ea['message']['interface']=util[_0xe4e2('0x62')]('SIP/%s',_0x3b4556[_0xe4e2('0x65')][_0xe4e2('0x3d')]);_0x38f5ea[_0xe4e2('0x2b')][_0xe4e2('0x7c')]=_0x18e8b3[_0xe4e2('0x7c')];_0x38f5ea[_0xe4e2('0x2b')][_0xe4e2('0x85')]=_0x18e8b3[_0xe4e2('0x7c')];_0x38f5ea[_0xe4e2('0x2b')]['event']=_0xe4e2('0x38');respondWithRpcPromise(_0xe4e2('0x7f'),'EventManager',{'event':'rejectmessage','message':_0x38f5ea[_0xe4e2('0x2b')]},client9002);return _0x18e8b3;}return null;})[_0xe4e2('0x22')](respondWithResult(_0x5ed108,null))[_0xe4e2('0x2c')](handleError(_0x5ed108,null));};exports[_0xe4e2('0x2f')]=function(_0x11707e,_0x11a6f4,_0x38675b){if(_0x11707e[_0xe4e2('0x5d')]['id']){delete _0x11707e[_0xe4e2('0x5d')]['id'];}var _0x2558c2;return db['SmsMessage'][_0xe4e2('0x5b')]({'where':{'id':_0x11707e[_0xe4e2('0x58')]['id']}})[_0xe4e2('0x22')](handleEntityNotFound(_0x11a6f4,null))[_0xe4e2('0x22')](function(_0x46d566){if(_0x46d566){_0x2558c2=_0x46d566;return db[_0xe4e2('0x86')][_0xe4e2('0x5b')]({'where':{'id':_0x46d566['SmsAccountId']}});}})[_0xe4e2('0x22')](handleEntityNotFound(_0x11a6f4,null))[_0xe4e2('0x22')](function(_0x256b6d){if(_0x256b6d){logger[_0xe4e2('0x26')](_0xe4e2('0x27'),_0xe4e2('0x2f'),_0xe4e2('0x87'),_0x256b6d[_0xe4e2('0x42')],util[_0xe4e2('0x88')](_0x11707e['body'],{'showHidden':![],'depth':null}));switch(_0x256b6d[_0xe4e2('0x42')]){case _0xe4e2('0x89'):if(_0x11707e[_0xe4e2('0x5d')]['MessageSid']&&_0x11707e[_0xe4e2('0x5d')][_0xe4e2('0x8a')]===_0x2558c2[_0xe4e2('0x8b')]){return _0x2558c2[_0xe4e2('0x3a')]({'read':!![]});}else{logger[_0xe4e2('0x29')](_0xe4e2('0x8c'),'status',_0xe4e2('0x89'),util[_0xe4e2('0x88')](_0x11707e[_0xe4e2('0x5d')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x11707e[_0xe4e2('0x5d')][_0xe4e2('0x8d')]&&_0x11707e[_0xe4e2('0x5d')][_0xe4e2('0x8d')]===_0x2558c2[_0xe4e2('0x8b')]&&_[_0xe4e2('0x8e')]([_0xe4e2('0x8f'),_0xe4e2('0x90')],_0x11707e[_0xe4e2('0x5d')][_0xe4e2('0x91')])>=0x0){return _0x2558c2[_0xe4e2('0x3a')]({'read':!![]});}else{logger[_0xe4e2('0x29')](_0xe4e2('0x8c'),_0xe4e2('0x2f'),_0xe4e2('0x92'),util['inspect'](_0x11707e['body'],{'showHidden':![],'depth':null}));}break;case _0xe4e2('0x93'):var _0x4d730e=_0x11707e['body'][_0xe4e2('0x94')][0x0];if(_0x4d730e[_0xe4e2('0x2f')][_0xe4e2('0x95')]===_0xe4e2('0x96')){return _0x2558c2['update']({'read':!![]});}else{logger[_0xe4e2('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe4e2('0x93'),util['inspect'](_0x11707e[_0xe4e2('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x2558c2;}})[_0xe4e2('0x22')](respondWithResult(_0x11a6f4,null))[_0xe4e2('0x2c')](handleError(_0x11a6f4,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a3239a2..e9812a6 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 _0xf210=['SmsMessage','setMaxListeners','update','remove','emit','hook','../../mysqldb'];(function(_0x3577d0,_0x431a3f){var _0x286f32=function(_0x28c2e1){while(--_0x28c2e1){_0x3577d0['push'](_0x3577d0['shift']());}};_0x286f32(++_0x431a3f);}(_0xf210,0xfb));var _0x0f21=function(_0x4bad5d,_0x4f9c1f){_0x4bad5d=_0x4bad5d-0x0;var _0x32b170=_0xf210[_0x4bad5d];return _0x32b170;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x0f21('0x0'))['db'][_0x0f21('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0f21('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f21('0x3'),'afterDestroy':_0x0f21('0x4')};function emitEvent(_0x1a0328){return function(_0x421540,_0x569262,_0x161131){SmsMessageEvents[_0x0f21('0x5')](_0x1a0328+':'+_0x421540['id'],_0x421540);SmsMessageEvents[_0x0f21('0x5')](_0x1a0328,_0x421540);_0x161131(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x0f21('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x47eb=['hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','remove','emit'];(function(_0x61780e,_0x44b778){var _0x460363=function(_0x53c154){while(--_0x53c154){_0x61780e['push'](_0x61780e['shift']());}};_0x460363(++_0x44b778);}(_0x47eb,0x6b));var _0xb47e=function(_0x12cbd8,_0x8ef0ce){_0x12cbd8=_0x12cbd8-0x0;var _0x2fb1ab=_0x47eb[_0x12cbd8];return _0x2fb1ab;};'use strict';var EventEmitter=require(_0xb47e('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xb47e('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb47e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb47e('0x3')};function emitEvent(_0x306be2){return function(_0x3101f2,_0x12798f,_0xf64244){SmsMessageEvents[_0xb47e('0x4')](_0x306be2+':'+_0x3101f2['id'],_0x3101f2);SmsMessageEvents['emit'](_0x306be2,_0x3101f2);_0xf64244(null);};}for(var e in events){if(events[_0xb47e('0x5')](e)){var event=events[e];SmsMessage[_0xb47e('0x6')](e,emitEvent(event));}}module[_0xb47e('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 c72aeef..d2d3933 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 _0xb2b5=['password','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','csc','crypto','apiKey','login','text','timestamp','keys','sort','md5','digest','hex','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','bandwidth','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','out','find','type','twilio','accountSid','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password='];(function(_0x51c11f,_0x2adce2){var _0xc5d3c7=function(_0x34e1c5){while(--_0x34e1c5){_0x51c11f['push'](_0x51c11f['shift']());}};_0xc5d3c7(++_0x2adce2);}(_0xb2b5,0xb7));var _0x5b2b=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xb2b5[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x5b2b('0x0'));var util=require(_0x5b2b('0x1'));var logger=require('../../config/logger')(_0x5b2b('0x2'));var moment=require(_0x5b2b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b2b('0x4'));var attributes=require(_0x5b2b('0x5'));module[_0x5b2b('0x6')]=function(_0x3fc116,_0x98c34c){return _0x3fc116[_0x5b2b('0x7')]('SmsMessage',attributes,{'tableName':_0x5b2b('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5b2b('0x9')]},{'name':'fti_sms_messages','fields':[_0x5b2b('0xa')],'type':_0x5b2b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x521814,_0x2f1dc7,_0x2156d9){var _0x86a712=_0x3fc116[_0x5b2b('0xc')];var _0x591686=_0x521814[_0x5b2b('0xd')]({'plain':!![]});if(_0x591686[_0x5b2b('0xe')]['toLowerCase']()==='in'||_0x591686['direction'][_0x5b2b('0xf')]()==='out'&&!_0x591686[_0x5b2b('0x10')]&&!_[_0x5b2b('0x11')](_0x591686['UserId'])&&!_['isNil'](_0x591686[_0x5b2b('0x12')])){_0x86a712[_0x5b2b('0x13')]['findOne']({'where':{'id':_0x591686[_0x5b2b('0x12')]}})[_0x5b2b('0x14')](function(_0x2a2399){if(_0x2a2399){_0x2a2399[_0x5b2b('0x15')]({'lastMsgAt':_0x591686[_0x5b2b('0x16')],'lastMsgDirection':_0x591686[_0x5b2b('0xe')]['toLowerCase']()});}})[_0x5b2b('0x17')](function(_0x5e241e){console[_0x5b2b('0x18')](_0x5e241e);});}if(_0x591686['direction']===_0x5b2b('0x19')&&!_0x591686[_0x5b2b('0x10')]){var _0x33dfbb;_0x86a712['SmsAccount'][_0x5b2b('0x1a')]({'where':{'id':_0x591686['SmsAccountId']},'raw':!![]})[_0x5b2b('0x14')](function(_0x32b3b8){_0x33dfbb=_0x32b3b8;if(_0x33dfbb&&_0x33dfbb[_0x5b2b('0x1b')]){switch(_0x33dfbb[_0x5b2b('0x1b')]){case _0x5b2b('0x1c'):var _0x241adb=require(_0x5b2b('0x1c'));if(_0x33dfbb[_0x5b2b('0x1d')]&&_0x33dfbb['authToken']&&_0x33dfbb['phone']){var _0x2b381d=new _0x241adb(_0x33dfbb['accountSid'],_0x33dfbb['authToken']);_0x2b381d[_0x5b2b('0x1e')][_0x5b2b('0x1f')]({'body':_0x591686[_0x5b2b('0xa')],'to':_0x591686[_0x5b2b('0x20')],'from':_0x33dfbb[_0x5b2b('0x20')],'statusCallback':_0x33dfbb[_0x5b2b('0x21')]+_0x5b2b('0x22')+_0x591686['id']+_0x5b2b('0x23')+_0x33dfbb[_0x5b2b('0x24')]})[_0x5b2b('0x14')](function(_0x490902){if(_0x490902['sid']){return _0x521814[_0x5b2b('0x15')]({'messageId':_0x490902[_0x5b2b('0x25')]});}})[_0x5b2b('0x17')](function(_0x3baba8){logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),'twilio',util[_0x5b2b('0x28')](_0x3baba8,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5b2b('0x1c'),_0x5b2b('0x29'));}break;case _0x5b2b('0x2a'):var _0x3b6109=_0x5b2b('0x2b');if(_0x33dfbb[_0x5b2b('0x2c')]&&_0x33dfbb['password']){var _0x320c75={'recipient':[_0x591686['phone']],'message':_0x591686[_0x5b2b('0xa')],'message_type':_0x33dfbb[_0x5b2b('0x2d')]};if(_0x33dfbb[_0x5b2b('0x2d')]&&_0x33dfbb[_0x5b2b('0x2d')]!=='SI'){_0x320c75[_0x5b2b('0x2e')]=_0x33dfbb[_0x5b2b('0x20')];}var _0x524b55={'url':_0x3b6109+_0x5b2b('0x2f')+_0x33dfbb[_0x5b2b('0x2c')]+_0x5b2b('0x30')+_0x33dfbb[_0x5b2b('0x31')],'method':'GET'};rp(_0x524b55)['then'](function(_0x32ca38){var _0x3022cb=_0x32ca38[_0x5b2b('0x32')](';');var _0xbe8331={'user_key':_0x3022cb[0x0],'session_key':_0x3022cb[0x1]};_0x524b55={'url':_0x3b6109+_0x5b2b('0x33'),'method':_0x5b2b('0x34'),'headers':{'user_key':_0xbe8331['user_key'],'Session_key':_0xbe8331[_0x5b2b('0x35')]},'json':!![],'body':_0x320c75};return rp(_0x524b55);})[_0x5b2b('0x14')](function(_0x3a18d7){if(_0x3a18d7[_0x5b2b('0x36')]>=0x1){var _0x3f1e80={'messageId':_0x3a18d7[_0x5b2b('0x37')]};if(_0x33dfbb[_0x5b2b('0x2d')]!=='GP'||!_0x33dfbb[_0x5b2b('0x38')]){_0x3f1e80[_0x5b2b('0x39')]=!![];}return _0x521814[_0x5b2b('0x15')](_0x3f1e80);}else{return logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x2a'),util[_0x5b2b('0x28')](_0x3a18d7,{'showHidden':![],'depth':null}));}})[_0x5b2b('0x17')](function(_0x56762f){return logger[_0x5b2b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b2b('0x27'),'skebby',util[_0x5b2b('0x28')](_0x56762f,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x2a'),_0x5b2b('0x3a'));}break;case _0x5b2b('0x3b'):if(_0x33dfbb[_0x5b2b('0x3c')]){var _0x58fb09={'recipient':_0x591686[_0x5b2b('0x20')],'message':_0x591686[_0x5b2b('0xa')],'sender':_0x33dfbb[_0x5b2b('0x3d')]||_0x33dfbb[_0x5b2b('0x20')],'authorization':_0x33dfbb[_0x5b2b('0x3c')]};var _0x2f1dc7={'method':_0x5b2b('0x34'),'uri':_0x5b2b('0x3e'),'body':_0x58fb09,'json':!![]};rp(_0x2f1dc7)['then'](function(_0x316434){var _0xcd3b59={'messageId':_0x316434[_0x5b2b('0x3f')]};if(!_0x33dfbb[_0x5b2b('0x38')]){_0xcd3b59[_0x5b2b('0x39')]=!![];}return _0x521814[_0x5b2b('0x15')](_0xcd3b59);})[_0x5b2b('0x17')](function(_0x22d1c4){logger[_0x5b2b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b2b('0x27'),_0x5b2b('0x3b'),util[_0x5b2b('0x28')](_0x22d1c4,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x5b2b('0x40'):if(_0x33dfbb[_0x5b2b('0x2c')]&&_0x33dfbb['password']){var _0x58fb09={'messages':[{'source':_0x5b2b('0x41'),'to':_0x591686[_0x5b2b('0x20')],'body':_0x591686['body'],'from':_0x33dfbb[_0x5b2b('0x3d')]||_0x33dfbb[_0x5b2b('0x20')]}]};var _0x50eb79=util[_0x5b2b('0x42')](_0x5b2b('0x43'),_0x33dfbb[_0x5b2b('0x2c')],_0x33dfbb[_0x5b2b('0x31')]);var _0x2f1dc7={'method':_0x5b2b('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x58fb09,'headers':{'Authorization':util[_0x5b2b('0x42')](_0x5b2b('0x44'),new Buffer(_0x50eb79)[_0x5b2b('0x45')](_0x5b2b('0x46')))},'json':!![]};rp(_0x2f1dc7)['then'](function(_0x3b321e){if(_0x3b321e[_0x5b2b('0x47')]>=0xc8&&_0x3b321e['http_code']<=0xce){if(_0x3b321e[_0x5b2b('0x48')]&&_0x3b321e[_0x5b2b('0x48')][_0x5b2b('0x49')]>0x0){var _0x35121f=_[_0x5b2b('0x4a')](_0x3b321e[_0x5b2b('0x48')][_0x5b2b('0x1e')]);var _0x2a6b95={'messageId':_0x35121f[_0x5b2b('0x4b')]};if(!_0x33dfbb[_0x5b2b('0x38')]){_0x2a6b95['read']=!![];}return _0x521814['update'](_0x2a6b95);}else{logger['error'](_0x5b2b('0x26'),'afterCreate','clickSend',util['inspect'](_0x3b321e,{'showHidden':![],'depth':null}));}}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x4c'),util['inspect'](_0x3b321e,{'showHidden':![],'depth':null}));}})[_0x5b2b('0x17')](function(_0x11e304){logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),'clickSend',util['inspect'](_0x11e304,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x4c'),_0x5b2b('0x3a'));}break;case _0x5b2b('0x4d'):if(_0x33dfbb['authId']&&_0x33dfbb[_0x5b2b('0x3c')]){var _0x58fb09={'dst':_0x591686[_0x5b2b('0x20')],'text':_0x591686[_0x5b2b('0xa')],'src':_0x33dfbb['senderString']||_0x33dfbb['phone'],'url':_0x33dfbb['remote']+_0x5b2b('0x22')+_0x591686['id']+_0x5b2b('0x23')+_0x33dfbb[_0x5b2b('0x24')]};var _0x50eb79=util[_0x5b2b('0x42')](_0x5b2b('0x43'),_0x33dfbb['authId'],_0x33dfbb[_0x5b2b('0x3c')]);var _0x2f1dc7={'method':_0x5b2b('0x34'),'uri':util[_0x5b2b('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x33dfbb[_0x5b2b('0x4e')]),'body':_0x58fb09,'headers':{'Authorization':util['format'](_0x5b2b('0x44'),new Buffer(_0x50eb79)[_0x5b2b('0x45')](_0x5b2b('0x46')))},'json':!![]};rp(_0x2f1dc7)[_0x5b2b('0x14')](function(_0x308c6a){var _0x32663a={'messageId':_0x308c6a[_0x5b2b('0x4f')][0x0]};return _0x521814[_0x5b2b('0x15')](_0x32663a);})[_0x5b2b('0x17')](function(_0x5da4c5){logger[_0x5b2b('0x18')](_0x5b2b('0x26'),'afterCreate',_0x5b2b('0x4d'),util['inspect'](_0x5da4c5,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x33dfbb[_0x5b2b('0x2c')]&&_0x33dfbb[_0x5b2b('0x31')]){if(_0x33dfbb[_0x5b2b('0x50')]){var _0x7f661e={'method':_0x5b2b('0x34'),'uri':_0x33dfbb[_0x5b2b('0x50')]+_0x5b2b('0x51'),'body':{'username':_0x33dfbb[_0x5b2b('0x2c')],'password':_0x33dfbb[_0x5b2b('0x31')]},'json':!![]};return rp(_0x7f661e)[_0x5b2b('0x14')](function(_0x31fab3){var _0x5cfded={'method':'POST','uri':_0x33dfbb[_0x5b2b('0x50')]+_0x5b2b('0x52'),'body':{'messages':[{'from':_0x33dfbb[_0x5b2b('0x20')],'destinations':[{'to':_0x591686[_0x5b2b('0x20')]}],'text':_0x591686[_0x5b2b('0xa')],'notifyUrl':_0x33dfbb[_0x5b2b('0x21')]+_0x5b2b('0x22')+_0x591686['id']+_0x5b2b('0x23')+_0x33dfbb[_0x5b2b('0x24')],'notifyContentType':_0x5b2b('0x53'),'callbackData':_0x33dfbb[_0x5b2b('0x20')]+';'+_0x591686[_0x5b2b('0xa')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x31fab3['token']},'json':!![]};return rp(_0x5cfded)[_0x5b2b('0x14')](function(_0x3054e3){if(_0x3054e3[_0x5b2b('0x1e')]){var _0x3472ff={'messageId':_0x3054e3[_0x5b2b('0x1e')][0x0][_0x5b2b('0x9')]};if(!_0x33dfbb[_0x5b2b('0x38')]){_0x3472ff[_0x5b2b('0x39')]=!![];}return _0x521814[_0x5b2b('0x15')](_0x3472ff);}else{return logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x54'),util[_0x5b2b('0x28')](_0x3054e3,{'showHidden':![],'depth':null}));}});})['catch'](function(_0xd07e03){return logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x54'),util[_0x5b2b('0x28')](_0xd07e03,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),'afterCreate',_0x5b2b('0x54'),_0x5b2b('0x3a'));}break;case _0x5b2b('0x55'):var _0x2a81e8=require(_0x5b2b('0x56'));if(_0x33dfbb[_0x5b2b('0x57')]){var _0x570a88={};_0x570a88[_0x5b2b('0x58')]=_0x33dfbb['username'];_0x570a88['phone']=_0x591686[_0x5b2b('0x20')];_0x570a88[_0x5b2b('0x2e')]=_0x33dfbb[_0x5b2b('0x20')];_0x570a88[_0x5b2b('0x59')]=_0x591686['body'];_0x570a88[_0x5b2b('0x5a')]=+new Date();var _0xb6b235='';var _0x1bf117='';var _0x596969=Object[_0x5b2b('0x5b')](_0x570a88);_0x596969[_0x5b2b('0x5c')]();for(var _0x39d9b4=0x0;_0x39d9b4<_0x596969['length'];_0x39d9b4++){if(_0xb6b235!=''){_0xb6b235+='&';}_0xb6b235+=_0x596969[_0x39d9b4]+'='+encodeURIComponent(_0x570a88[_0x596969[_0x39d9b4]]);_0x1bf117+=_0x570a88[_0x596969[_0x39d9b4]];}_0x1bf117+=_0x33dfbb[_0x5b2b('0x57')];_0x1bf117=_0x2a81e8['createHash'](_0x5b2b('0x5d'))[_0x5b2b('0x15')](_0x1bf117)[_0x5b2b('0x5e')](_0x5b2b('0x5f'));if(_0xb6b235!==''){_0xb6b235+='&';}_0xb6b235+='signature='+_0x1bf117;var _0x524b55={'method':_0x5b2b('0x60'),'uri':_0x33dfbb['baseUrl']+_0x5b2b('0x61')+_0xb6b235,'json':!![]};return rp(_0x524b55)[_0x5b2b('0x14')](function(_0x36b5b5){var _0x1c46ad=Object[_0x5b2b('0x5b')](_0x36b5b5);if(_0x36b5b5[_0x1c46ad[0x0]][_0x5b2b('0x18')]&&parseInt(_0x36b5b5[_0x1c46ad[0x0]]['error'])===0x0){var _0x5b496d={'messageId':_0x36b5b5[_0x1c46ad[0x0]][_0x5b2b('0x62')]};if(!_0x33dfbb[_0x5b2b('0x38')]){_0x5b496d[_0x5b2b('0x39')]=!![];}return _0x521814[_0x5b2b('0x15')](_0x5b496d);}else{return logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x55'),util[_0x5b2b('0x28')](_0x36b5b5[_0x5b2b('0x18')],{'showHidden':![],'depth':null}));}})[_0x5b2b('0x17')](function(_0x53b78a){return logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x55'),util[_0x5b2b('0x28')](_0x53b78a,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x55'),_0x5b2b('0x63'));}break;case _0x5b2b('0x64'):if(_0x33dfbb[_0x5b2b('0x57')]){var _0x3d5b1c={'method':_0x5b2b('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x33dfbb[_0x5b2b('0x57')]},'body':{'content':_0x591686[_0x5b2b('0xa')],'to':[_0x591686[_0x5b2b('0x20')]],'from':_0x33dfbb[_0x5b2b('0x20')],'binary':![],'clientMessageId':_0x5b2b('0x65'),'charset':'UTF-8'},'json':!![]};rp(_0x3d5b1c)['then'](function(_0x9e9747){if(!_0x9e9747['error']){var _0x1b1031={'messageId':_0x9e9747[_0x5b2b('0x1e')][0x0]['apiMessageId']};if(!_0x33dfbb[_0x5b2b('0x38')]){_0x1b1031[_0x5b2b('0x39')]=!![];}return _0x521814[_0x5b2b('0x15')](_0x1b1031);}else{return logger['error'](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x64'),util['inspect'](_0x9e9747['error'],{'showHidden':![],'depth':null}));}})[_0x5b2b('0x17')](function(_0xef2731){return logger[_0x5b2b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util['inspect'](_0xef2731,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),'afterCreate',_0x5b2b('0x64'),_0x5b2b('0x63'));}break;case _0x5b2b('0x66'):if(_0x33dfbb['username']&&_0x33dfbb['password']){var _0x50eb79=util['format'](_0x5b2b('0x43'),_0x33dfbb[_0x5b2b('0x2c')],_0x33dfbb[_0x5b2b('0x31')]);var _0x2f1dc7={'method':_0x5b2b('0x34'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x33dfbb[_0x5b2b('0x67')]+_0x5b2b('0x68'),'body':{'to':[_0x591686[_0x5b2b('0x20')]],'text':_0x591686[_0x5b2b('0xa')],'from':_0x33dfbb[_0x5b2b('0x20')],'applicationId':_0x33dfbb[_0x5b2b('0x69')]},'headers':{'Authorization':util[_0x5b2b('0x42')](_0x5b2b('0x44'),new Buffer(_0x50eb79)[_0x5b2b('0x45')]('base64'))},'json':!![]};rp(_0x2f1dc7)[_0x5b2b('0x14')](function(_0x2e20b7){if(_0x2e20b7['id']){var _0x1f9d5f={'messageId':_0x2e20b7['id']};return _0x521814[_0x5b2b('0x15')](_0x1f9d5f);}else{logger['error'](_0x5b2b('0x26'),'afterCreate',_0x5b2b('0x66'),util['inspect'](_0x2e20b7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2d2f9d){logger[_0x5b2b('0x18')](_0x5b2b('0x26'),'afterCreate',_0x5b2b('0x66'),util[_0x5b2b('0x28')](_0x2d2f9d,{'showHidden':![],'depth':null}));});}else{logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x66'),_0x5b2b('0x3a'));}break;case _0x5b2b('0x6a'):if(_0x33dfbb[_0x5b2b('0x57')]){var _0x5f22cc={};var _0x524b55={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x5b2b('0x6b')+_0x33dfbb[_0x5b2b('0x57')],'Content-Type':'application/json'},'body':{'from':_0x33dfbb['phone'],'to':_0x591686['phone'],'text':_0x591686[_0x5b2b('0xa')]},'json':!![]};return rp(_0x524b55)['then'](function(_0x468e44){if(_0x468e44[_0x5b2b('0x6c')]==0xca){_0x5f22cc[_0x5b2b('0x6d')]=_0x468e44;var _0x2876e8={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x5b2b('0x6b')+_0x33dfbb[_0x5b2b('0x57')],'Content-Type':'application/json'},'body':{'refid':_0x5f22cc[_0x5b2b('0x6d')][_0x5b2b('0x6e')]},'json':!![]};return rp(_0x2876e8)[_0x5b2b('0x14')](function(_0x146660){_0x5f22cc[_0x5b2b('0x6f')]=_0x146660;var _0x1e40fc={'messageId':_0x5f22cc[_0x5b2b('0x6d')]['refid'],'read':!![]};return _0x521814['update'](_0x1e40fc);});}else{return logger[_0x5b2b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b2b('0x27'),_0x5b2b('0x6a'),util[_0x5b2b('0x28')](_0x468e44,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb882b6){return logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x6a'),util[_0x5b2b('0x28')](_0xb882b6,{'showHidden':![],'depth':null}));});}else{return logger[_0x5b2b('0x18')](_0x5b2b('0x26'),_0x5b2b('0x27'),_0x5b2b('0x6a'),_0x5b2b('0x70'));}break;}}})[_0x5b2b('0x71')](function(){_0x2156d9();});}else{_0x2156d9();}}},'charset':_0x5b2b('0x72'),'collate':_0x5b2b('0x73')});}; \ No newline at end of file +var _0xf1b5=['define','SmsMessage','messageId','fti_sms_messages','FULLTEXT','models','get','toLowerCase','direction','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','error','out','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','body','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','split','sms','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','connectel','clicksend','xCALLY\x20Motion','POST','format','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','baseUrl','application/json','IBSSO\x20','messages','infobip','csc','crypto','login','text','keys','apiKey','md5','digest','signature=','GET','id_sms','clickatell','uuid','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','intelepeer','finally','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x1f0508,_0xcc63f2){var _0x301bf2=function(_0xd5d7f1){while(--_0xd5d7f1){_0x1f0508['push'](_0x1f0508['shift']());}};_0x301bf2(++_0xcc63f2);}(_0xf1b5,0x150));var _0x5f1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf1b5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5f1b('0x0'));var util=require(_0x5f1b('0x1'));var logger=require(_0x5f1b('0x2'))(_0x5f1b('0x3'));var moment=require(_0x5f1b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f1b('0x5'));var rimraf=require(_0x5f1b('0x6'));var config=require(_0x5f1b('0x7'));var attributes=require('./smsMessage.attributes');module[_0x5f1b('0x8')]=function(_0x57129a,_0xef440f){return _0x57129a[_0x5f1b('0x9')](_0x5f1b('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x5f1b('0xb'),'fields':[_0x5f1b('0xb')]},{'name':_0x5f1b('0xc'),'fields':['body'],'type':_0x5f1b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x106d47,_0x716e12,_0x27138f){var _0x32ce91=_0x57129a[_0x5f1b('0xe')];var _0x53fb0c=_0x106d47[_0x5f1b('0xf')]({'plain':!![]});if(_0x53fb0c['direction'][_0x5f1b('0x10')]()==='in'||_0x53fb0c[_0x5f1b('0x11')][_0x5f1b('0x10')]()==='out'&&!_0x53fb0c['secret']&&!_[_0x5f1b('0x12')](_0x53fb0c[_0x5f1b('0x13')])&&!_[_0x5f1b('0x12')](_0x53fb0c[_0x5f1b('0x14')])){_0x32ce91[_0x5f1b('0x15')][_0x5f1b('0x16')]({'where':{'id':_0x53fb0c[_0x5f1b('0x14')]}})[_0x5f1b('0x17')](function(_0x5c26e4){if(_0x5c26e4){_0x5c26e4[_0x5f1b('0x18')]({'lastMsgAt':_0x53fb0c[_0x5f1b('0x19')],'lastMsgDirection':_0x53fb0c[_0x5f1b('0x11')]['toLowerCase']()});}})['catch'](function(_0x2efd65){console[_0x5f1b('0x1a')](_0x2efd65);});}if(_0x53fb0c['direction']===_0x5f1b('0x1b')&&!_0x53fb0c['secret']){var _0x5364ff;_0x32ce91[_0x5f1b('0x1c')]['find']({'where':{'id':_0x53fb0c[_0x5f1b('0x1d')]},'raw':!![]})['then'](function(_0x384c0e){_0x5364ff=_0x384c0e;if(_0x5364ff&&_0x5364ff['type']){switch(_0x5364ff[_0x5f1b('0x1e')]){case _0x5f1b('0x1f'):var _0x11caab=require('twilio');if(_0x5364ff[_0x5f1b('0x20')]&&_0x5364ff[_0x5f1b('0x21')]&&_0x5364ff[_0x5f1b('0x22')]){var _0x4c516d=new _0x11caab(_0x5364ff[_0x5f1b('0x20')],_0x5364ff[_0x5f1b('0x21')]);_0x4c516d['messages']['create']({'body':_0x53fb0c[_0x5f1b('0x23')],'to':_0x53fb0c['phone'],'from':_0x5364ff[_0x5f1b('0x22')],'statusCallback':_0x5364ff[_0x5f1b('0x24')]+_0x5f1b('0x25')+_0x53fb0c['id']+_0x5f1b('0x26')+_0x5364ff[_0x5f1b('0x27')]})[_0x5f1b('0x17')](function(_0x30fa0c){if(_0x30fa0c[_0x5f1b('0x28')]){return _0x106d47['update']({'messageId':_0x30fa0c[_0x5f1b('0x28')]});}})[_0x5f1b('0x29')](function(_0xc6b636){logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x1f'),util[_0x5f1b('0x2c')](_0xc6b636,{'showHidden':![],'depth':null}));});}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x1f'),_0x5f1b('0x2d'));}break;case _0x5f1b('0x2e'):var _0x2940d4='https://api.skebby.it/API/v1.0/REST/';if(_0x5364ff[_0x5f1b('0x2f')]&&_0x5364ff[_0x5f1b('0x30')]){var _0x400fcd={'recipient':[_0x53fb0c[_0x5f1b('0x22')]],'message':_0x53fb0c[_0x5f1b('0x23')],'message_type':_0x5364ff[_0x5f1b('0x31')]};if(_0x5364ff['smsMethod']&&_0x5364ff[_0x5f1b('0x31')]!=='SI'){_0x400fcd[_0x5f1b('0x32')]=_0x5364ff[_0x5f1b('0x22')];}var _0x304e26={'url':_0x2940d4+'login?username='+_0x5364ff['username']+'&password='+_0x5364ff[_0x5f1b('0x30')],'method':'GET'};rp(_0x304e26)[_0x5f1b('0x17')](function(_0x17230c){var _0x3f2421=_0x17230c[_0x5f1b('0x33')](';');var _0x412715={'user_key':_0x3f2421[0x0],'session_key':_0x3f2421[0x1]};_0x304e26={'url':_0x2940d4+_0x5f1b('0x34'),'method':'POST','headers':{'user_key':_0x412715[_0x5f1b('0x35')],'Session_key':_0x412715[_0x5f1b('0x36')]},'json':!![],'body':_0x400fcd};return rp(_0x304e26);})['then'](function(_0x666a98){if(_0x666a98[_0x5f1b('0x37')]>=0x1){var _0x21438a={'messageId':_0x666a98[_0x5f1b('0x38')]};if(_0x5364ff[_0x5f1b('0x31')]!=='GP'||!_0x5364ff['deliveryReport']){_0x21438a[_0x5f1b('0x39')]=!![];}return _0x106d47['update'](_0x21438a);}else{return logger['error'](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x2e'),util[_0x5f1b('0x2c')](_0x666a98,{'showHidden':![],'depth':null}));}})['catch'](function(_0x49c5c8){return logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),'skebby',util[_0x5f1b('0x2c')](_0x49c5c8,{'showHidden':![],'depth':null}));});}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x2e'),_0x5f1b('0x3a'));}break;case'connectel':if(_0x5364ff[_0x5f1b('0x21')]){var _0x259b2e={'recipient':_0x53fb0c[_0x5f1b('0x22')],'message':_0x53fb0c[_0x5f1b('0x23')],'sender':_0x5364ff[_0x5f1b('0x3b')]||_0x5364ff[_0x5f1b('0x22')],'authorization':_0x5364ff[_0x5f1b('0x21')]};var _0x716e12={'method':'POST','uri':_0x5f1b('0x3c'),'body':_0x259b2e,'json':!![]};rp(_0x716e12)['then'](function(_0x35ec8a){var _0x1b0104={'messageId':_0x35ec8a[_0x5f1b('0x3d')]};if(!_0x5364ff[_0x5f1b('0x3e')]){_0x1b0104[_0x5f1b('0x39')]=!![];}return _0x106d47[_0x5f1b('0x18')](_0x1b0104);})[_0x5f1b('0x29')](function(_0x209c93){logger['error'](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x3f'),util[_0x5f1b('0x2c')](_0x209c93,{'showHidden':![],'depth':null}));});}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),'afterCreate','connectel','Missing\x20parameters:\x20authToken');}break;case _0x5f1b('0x40'):if(_0x5364ff['username']&&_0x5364ff[_0x5f1b('0x30')]){var _0x259b2e={'messages':[{'source':_0x5f1b('0x41'),'to':_0x53fb0c['phone'],'body':_0x53fb0c['body'],'from':_0x5364ff[_0x5f1b('0x3b')]||_0x5364ff['phone']}]};var _0x41ca8a=util['format']('%s:%s',_0x5364ff[_0x5f1b('0x2f')],_0x5364ff[_0x5f1b('0x30')]);var _0x716e12={'method':_0x5f1b('0x42'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x259b2e,'headers':{'Authorization':util[_0x5f1b('0x43')]('Basic\x20%s',new Buffer(_0x41ca8a)[_0x5f1b('0x44')](_0x5f1b('0x45')))},'json':!![]};rp(_0x716e12)[_0x5f1b('0x17')](function(_0x5283ad){if(_0x5283ad[_0x5f1b('0x46')]>=0xc8&&_0x5283ad[_0x5f1b('0x46')]<=0xce){if(_0x5283ad[_0x5f1b('0x47')]&&_0x5283ad[_0x5f1b('0x47')][_0x5f1b('0x48')]>0x0){var _0xf76d8c=_[_0x5f1b('0x49')](_0x5283ad['data']['messages']);var _0x3e125e={'messageId':_0xf76d8c[_0x5f1b('0x4a')]};if(!_0x5364ff['deliveryReport']){_0x3e125e['read']=!![];}return _0x106d47[_0x5f1b('0x18')](_0x3e125e);}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x4b'),util[_0x5f1b('0x2c')](_0x5283ad,{'showHidden':![],'depth':null}));}}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x4b'),util['inspect'](_0x5283ad,{'showHidden':![],'depth':null}));}})[_0x5f1b('0x29')](function(_0x5880f7){logger['error'](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x4b'),util[_0x5f1b('0x2c')](_0x5880f7,{'showHidden':![],'depth':null}));});}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x4b'),_0x5f1b('0x3a'));}break;case _0x5f1b('0x4c'):if(_0x5364ff[_0x5f1b('0x4d')]&&_0x5364ff[_0x5f1b('0x21')]){var _0x259b2e={'dst':_0x53fb0c['phone'],'text':_0x53fb0c['body'],'src':_0x5364ff[_0x5f1b('0x3b')]||_0x5364ff[_0x5f1b('0x22')],'url':_0x5364ff[_0x5f1b('0x24')]+_0x5f1b('0x25')+_0x53fb0c['id']+_0x5f1b('0x26')+_0x5364ff[_0x5f1b('0x27')]};var _0x41ca8a=util[_0x5f1b('0x43')](_0x5f1b('0x4e'),_0x5364ff[_0x5f1b('0x4d')],_0x5364ff['authToken']);var _0x716e12={'method':_0x5f1b('0x42'),'uri':util[_0x5f1b('0x43')](_0x5f1b('0x4f'),_0x5364ff[_0x5f1b('0x4d')]),'body':_0x259b2e,'headers':{'Authorization':util['format'](_0x5f1b('0x50'),new Buffer(_0x41ca8a)['toString'](_0x5f1b('0x45')))},'json':!![]};rp(_0x716e12)[_0x5f1b('0x17')](function(_0x39e707){var _0x227ba0={'messageId':_0x39e707[_0x5f1b('0x51')][0x0]};return _0x106d47[_0x5f1b('0x18')](_0x227ba0);})[_0x5f1b('0x29')](function(_0x411e69){logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),'afterCreate','plivo',util[_0x5f1b('0x2c')](_0x411e69,{'showHidden':![],'depth':null}));});}else{logger[_0x5f1b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f1b('0x2b'),_0x5f1b('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x5364ff['username']&&_0x5364ff['password']){if(_0x5364ff[_0x5f1b('0x52')]){var _0x4bfe6f={'method':_0x5f1b('0x42'),'uri':_0x5364ff[_0x5f1b('0x52')]+'/auth/1/session','body':{'username':_0x5364ff[_0x5f1b('0x2f')],'password':_0x5364ff['password']},'json':!![]};return rp(_0x4bfe6f)['then'](function(_0x242576){var _0x972eab={'method':_0x5f1b('0x42'),'uri':_0x5364ff['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5364ff[_0x5f1b('0x22')],'destinations':[{'to':_0x53fb0c[_0x5f1b('0x22')]}],'text':_0x53fb0c['body'],'notifyUrl':_0x5364ff[_0x5f1b('0x24')]+_0x5f1b('0x25')+_0x53fb0c['id']+_0x5f1b('0x26')+_0x5364ff[_0x5f1b('0x27')],'notifyContentType':_0x5f1b('0x53'),'callbackData':_0x5364ff['phone']+';'+_0x53fb0c[_0x5f1b('0x23')]}]},'headers':{'Authorization':_0x5f1b('0x54')+_0x242576[_0x5f1b('0x27')]},'json':!![]};return rp(_0x972eab)['then'](function(_0x219cb2){if(_0x219cb2[_0x5f1b('0x55')]){var _0x5b4d2e={'messageId':_0x219cb2['messages'][0x0][_0x5f1b('0xb')]};if(!_0x5364ff[_0x5f1b('0x3e')]){_0x5b4d2e['read']=!![];}return _0x106d47[_0x5f1b('0x18')](_0x5b4d2e);}else{return logger[_0x5f1b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5f1b('0x56'),util['inspect'](_0x219cb2,{'showHidden':![],'depth':null}));}});})[_0x5f1b('0x29')](function(_0x284724){return logger['error'](_0x5f1b('0x2a'),'afterCreate',_0x5f1b('0x56'),util[_0x5f1b('0x2c')](_0x284724,{'showHidden':![],'depth':null}));});}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),'infobip',_0x5f1b('0x3a'));}break;case _0x5f1b('0x57'):var _0x166107=require(_0x5f1b('0x58'));if(_0x5364ff['apiKey']){var _0x4c77ee={};_0x4c77ee[_0x5f1b('0x59')]=_0x5364ff['username'];_0x4c77ee[_0x5f1b('0x22')]=_0x53fb0c['phone'];_0x4c77ee['sender']=_0x5364ff[_0x5f1b('0x22')];_0x4c77ee[_0x5f1b('0x5a')]=_0x53fb0c[_0x5f1b('0x23')];_0x4c77ee['timestamp']=+new Date();var _0xf13f89='';var _0x21025f='';var _0x17bb56=Object[_0x5f1b('0x5b')](_0x4c77ee);_0x17bb56['sort']();for(var _0xe66dc0=0x0;_0xe66dc0<_0x17bb56['length'];_0xe66dc0++){if(_0xf13f89!=''){_0xf13f89+='&';}_0xf13f89+=_0x17bb56[_0xe66dc0]+'='+encodeURIComponent(_0x4c77ee[_0x17bb56[_0xe66dc0]]);_0x21025f+=_0x4c77ee[_0x17bb56[_0xe66dc0]];}_0x21025f+=_0x5364ff[_0x5f1b('0x5c')];_0x21025f=_0x166107['createHash'](_0x5f1b('0x5d'))[_0x5f1b('0x18')](_0x21025f)[_0x5f1b('0x5e')]('hex');if(_0xf13f89!==''){_0xf13f89+='&';}_0xf13f89+=_0x5f1b('0x5f')+_0x21025f;var _0x304e26={'method':_0x5f1b('0x60'),'uri':_0x5364ff['baseUrl']+'/external/get/send.php?'+_0xf13f89,'json':!![]};return rp(_0x304e26)['then'](function(_0x4be1d0){var _0x26bb3f=Object['keys'](_0x4be1d0);if(_0x4be1d0[_0x26bb3f[0x0]][_0x5f1b('0x1a')]&&parseInt(_0x4be1d0[_0x26bb3f[0x0]][_0x5f1b('0x1a')])===0x0){var _0x21afdb={'messageId':_0x4be1d0[_0x26bb3f[0x0]][_0x5f1b('0x61')]};if(!_0x5364ff[_0x5f1b('0x3e')]){_0x21afdb['read']=!![];}return _0x106d47[_0x5f1b('0x18')](_0x21afdb);}else{return logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x57'),util[_0x5f1b('0x2c')](_0x4be1d0[_0x5f1b('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x555655){return logger['error'](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x57'),util['inspect'](_0x555655,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5f1b('0x57'),'Missing\x20parameters:\x20apiKey');}break;case _0x5f1b('0x62'):if(_0x5364ff[_0x5f1b('0x5c')]){var _0x4d0b9d={'method':_0x5f1b('0x42'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x5364ff[_0x5f1b('0x5c')]},'body':{'content':_0x53fb0c[_0x5f1b('0x23')],'to':[_0x53fb0c['phone']],'from':_0x5364ff['phone'],'binary':![],'clientMessageId':_0x5f1b('0x63'),'charset':_0x5f1b('0x64')},'json':!![]};rp(_0x4d0b9d)['then'](function(_0x1b039b){if(!_0x1b039b['error']){var _0x27f9c3={'messageId':_0x1b039b[_0x5f1b('0x55')][0x0]['apiMessageId']};if(!_0x5364ff[_0x5f1b('0x3e')]){_0x27f9c3[_0x5f1b('0x39')]=!![];}return _0x106d47[_0x5f1b('0x18')](_0x27f9c3);}else{return logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x62'),util[_0x5f1b('0x2c')](_0x1b039b['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2cc42f){return logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x62'),util[_0x5f1b('0x2c')](_0x2cc42f,{'showHidden':![],'depth':null}));});}else{logger[_0x5f1b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5f1b('0x62'),_0x5f1b('0x65'));}break;case _0x5f1b('0x66'):if(_0x5364ff[_0x5f1b('0x2f')]&&_0x5364ff[_0x5f1b('0x30')]){var _0x41ca8a=util['format'](_0x5f1b('0x4e'),_0x5364ff[_0x5f1b('0x2f')],_0x5364ff[_0x5f1b('0x30')]);var _0x716e12={'method':'POST','uri':_0x5f1b('0x67')+_0x5364ff[_0x5f1b('0x68')]+_0x5f1b('0x69'),'body':{'to':[_0x53fb0c[_0x5f1b('0x22')]],'text':_0x53fb0c[_0x5f1b('0x23')],'from':_0x5364ff['phone'],'applicationId':_0x5364ff[_0x5f1b('0x6a')]},'headers':{'Authorization':util['format'](_0x5f1b('0x50'),new Buffer(_0x41ca8a)[_0x5f1b('0x44')]('base64'))},'json':!![]};rp(_0x716e12)[_0x5f1b('0x17')](function(_0x162568){if(_0x162568['id']){var _0x4980e3={'messageId':_0x162568['id']};return _0x106d47[_0x5f1b('0x18')](_0x4980e3);}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),'afterCreate',_0x5f1b('0x66'),util[_0x5f1b('0x2c')](_0x162568,{'showHidden':![],'depth':null}));}})[_0x5f1b('0x29')](function(_0x472f01){logger[_0x5f1b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f1b('0x2b'),_0x5f1b('0x66'),util[_0x5f1b('0x2c')](_0x472f01,{'showHidden':![],'depth':null}));});}else{logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x66'),_0x5f1b('0x3a'));}break;case'intelepeer':if(_0x5364ff['apiKey']){var _0x77403={};var _0x304e26={'method':_0x5f1b('0x42'),'uri':_0x5f1b('0x6b'),'headers':{'Authorization':'Bearer\x20'+_0x5364ff[_0x5f1b('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x5364ff[_0x5f1b('0x22')],'to':_0x53fb0c[_0x5f1b('0x22')],'text':_0x53fb0c[_0x5f1b('0x23')]},'json':!![]};return rp(_0x304e26)[_0x5f1b('0x17')](function(_0x527c27){if(_0x527c27[_0x5f1b('0x6c')]==0xca){_0x77403['message']=_0x527c27;var _0x4607c8={'method':'POST','uri':_0x5f1b('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x5364ff[_0x5f1b('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x77403[_0x5f1b('0x6e')][_0x5f1b('0x6f')]},'json':!![]};return rp(_0x4607c8)[_0x5f1b('0x17')](function(_0x3cdbc7){_0x77403[_0x5f1b('0x70')]=_0x3cdbc7;var _0x4bce3d={'messageId':_0x77403[_0x5f1b('0x6e')]['refid'],'read':!![]};return _0x106d47[_0x5f1b('0x18')](_0x4bce3d);});}else{return logger[_0x5f1b('0x1a')](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x71'),util[_0x5f1b('0x2c')](_0x527c27,{'showHidden':![],'depth':null}));}})[_0x5f1b('0x29')](function(_0x4f24a7){return logger[_0x5f1b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f1b('0x2b'),_0x5f1b('0x71'),util['inspect'](_0x4f24a7,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x5f1b('0x2a'),_0x5f1b('0x2b'),_0x5f1b('0x71'),'Token\x20not\x20received');}break;}}})[_0x5f1b('0x72')](function(){_0x27138f();});}else{_0x27138f();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index f2d30f2..e6b66cf 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 _0xdbfa=['defaults','localhost','socket.io-emitter','redis','request','info','request\x20sent','debug','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0xdbfa,0xdb));var _0xadbf=function(_0x316e42,_0x1f11ed){_0x316e42=_0x316e42-0x0;var _0x169500=_0xdbfa[_0x316e42];return _0x169500;};'use strict';var _=require(_0xadbf('0x0'));var util=require(_0xadbf('0x1'));var moment=require(_0xadbf('0x2'));var BPromise=require('bluebird');var rs=require(_0xadbf('0x3'));var fs=require('fs');var Redis=require(_0xadbf('0x4'));var db=require(_0xadbf('0x5'))['db'];var utils=require(_0xadbf('0x6'));var logger=require(_0xadbf('0x7'))(_0xadbf('0x8'));var config=require('../../config/environment');var jayson=require(_0xadbf('0x9'));var client=jayson[_0xadbf('0xa')][_0xadbf('0xb')]({'port':0x232a});config['redis']=_[_0xadbf('0xc')](config['redis'],{'host':_0xadbf('0xd'),'port':0x18eb});var socket=require(_0xadbf('0xe'))(new Redis(config[_0xadbf('0xf')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2011d8,_0x52df39,_0x128186){return new BPromise(function(_0x32d247,_0x366a05){return client[_0xadbf('0x10')](_0x2011d8,_0x128186)['then'](function(_0xd09f2c){logger[_0xadbf('0x11')]('SmsMessage,\x20%s,\x20%s',_0x52df39,_0xadbf('0x12'));logger[_0xadbf('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x52df39,_0xadbf('0x12'),JSON['stringify'](_0xd09f2c));if(_0xd09f2c[_0xadbf('0x14')]){if(_0xd09f2c['error'][_0xadbf('0x15')]===0x1f4){logger[_0xadbf('0x14')](_0xadbf('0x16'),_0x52df39,_0xd09f2c[_0xadbf('0x14')][_0xadbf('0x17')]);return _0x366a05(_0xd09f2c[_0xadbf('0x14')][_0xadbf('0x17')]);}logger[_0xadbf('0x14')](_0xadbf('0x16'),_0x52df39,_0xd09f2c[_0xadbf('0x14')][_0xadbf('0x17')]);return _0x32d247(_0xd09f2c[_0xadbf('0x14')][_0xadbf('0x17')]);}else{logger[_0xadbf('0x11')](_0xadbf('0x16'),_0x52df39,_0xadbf('0x12'));_0x32d247(_0xd09f2c[_0xadbf('0x18')]['message']);}})[_0xadbf('0x19')](function(_0x499fd9){logger['error'](_0xadbf('0x16'),_0x52df39,_0x499fd9);_0x366a05(_0x499fd9);});});}exports[_0xadbf('0x1a')]=function(_0x867b8f){var _0x387195=this;return new Promise(function(_0x12cb6f,_0x5825dd){return db[_0xadbf('0x1b')][_0xadbf('0x1c')](_0x867b8f[_0xadbf('0x1d')],{'raw':_0x867b8f['options']?_0x867b8f[_0xadbf('0x1e')][_0xadbf('0x1f')]===undefined?!![]:![]:!![]})[_0xadbf('0x20')](function(_0x1473ef){logger[_0xadbf('0x11')](_0xadbf('0x1a'),_0x867b8f);logger[_0xadbf('0x13')](_0xadbf('0x1a'),_0x867b8f,JSON['stringify'](_0x1473ef));_0x12cb6f(_0x1473ef);})[_0xadbf('0x19')](function(_0x16a0cf){logger[_0xadbf('0x14')]('CreateSmsMessage',_0x16a0cf['message'],_0x867b8f);_0x5825dd(_0x387195[_0xadbf('0x14')](0x1f4,_0x16a0cf[_0xadbf('0x17')]));});});}; \ No newline at end of file +var _0xf0e1=['code','message','info','result','catch','SmsMessage','create','options','then','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x173bf1,_0x1754aa){var _0x472895=function(_0x37d209){while(--_0x37d209){_0x173bf1['push'](_0x173bf1['shift']());}};_0x472895(++_0x1754aa);}(_0xf0e1,0x154));var _0x1f0e=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0xf0e1[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0x1f0e('0x0'));var util=require(_0x1f0e('0x1'));var moment=require(_0x1f0e('0x2'));var BPromise=require(_0x1f0e('0x3'));var rs=require(_0x1f0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f0e('0x6'))(_0x1f0e('0x7'));var config=require(_0x1f0e('0x8'));var jayson=require(_0x1f0e('0x9'));var client=jayson[_0x1f0e('0xa')][_0x1f0e('0xb')]({'port':0x232a});config[_0x1f0e('0xc')]=_['defaults'](config[_0x1f0e('0xc')],{'host':_0x1f0e('0xd'),'port':0x18eb});var socket=require(_0x1f0e('0xe'))(new Redis(config['redis']));require(_0x1f0e('0xf'))[_0x1f0e('0x10')](socket);function respondWithRpcPromise(_0xf34f39,_0x890ab,_0x1d4aa4){return new BPromise(function(_0x76e750,_0x2a3e8b){return client[_0x1f0e('0x11')](_0xf34f39,_0x1d4aa4)['then'](function(_0x4fa433){logger['info'](_0x1f0e('0x12'),_0x890ab,_0x1f0e('0x13'));logger[_0x1f0e('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x890ab,_0x1f0e('0x13'),JSON[_0x1f0e('0x15')](_0x4fa433));if(_0x4fa433[_0x1f0e('0x16')]){if(_0x4fa433[_0x1f0e('0x16')][_0x1f0e('0x17')]===0x1f4){logger['error'](_0x1f0e('0x12'),_0x890ab,_0x4fa433[_0x1f0e('0x16')][_0x1f0e('0x18')]);return _0x2a3e8b(_0x4fa433[_0x1f0e('0x16')]['message']);}logger[_0x1f0e('0x16')](_0x1f0e('0x12'),_0x890ab,_0x4fa433[_0x1f0e('0x16')][_0x1f0e('0x18')]);return _0x76e750(_0x4fa433[_0x1f0e('0x16')][_0x1f0e('0x18')]);}else{logger[_0x1f0e('0x19')](_0x1f0e('0x12'),_0x890ab,'request\x20sent');_0x76e750(_0x4fa433[_0x1f0e('0x1a')][_0x1f0e('0x18')]);}})[_0x1f0e('0x1b')](function(_0x870be7){logger['error'](_0x1f0e('0x12'),_0x890ab,_0x870be7);_0x2a3e8b(_0x870be7);});});}exports['CreateSmsMessage']=function(_0x3b3c5c){var _0x1b7c9c=this;return new Promise(function(_0x30e458,_0x20efb7){return db[_0x1f0e('0x1c')][_0x1f0e('0x1d')](_0x3b3c5c['body'],{'raw':_0x3b3c5c[_0x1f0e('0x1e')]?_0x3b3c5c[_0x1f0e('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x1f0e('0x1f')](function(_0x18bebd){logger['info'](_0x1f0e('0x20'),_0x3b3c5c);logger['debug']('CreateSmsMessage',_0x3b3c5c,JSON[_0x1f0e('0x15')](_0x18bebd));_0x30e458(_0x18bebd);})[_0x1f0e('0x1b')](function(_0x26990b){logger[_0x1f0e('0x16')](_0x1f0e('0x20'),_0x26990b[_0x1f0e('0x18')],_0x3b3c5c);_0x20efb7(_0x1b7c9c[_0x1f0e('0x16')](0x1f4,_0x26990b[_0x1f0e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 4397caa..32b22da 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 _0xccd2=['length','smsMessage:','update','emit','removeListener','register'];(function(_0x12849e,_0x3f9cce){var _0xaec77b=function(_0x35ccb4){while(--_0x35ccb4){_0x12849e['push'](_0x12849e['shift']());}};_0xaec77b(++_0x3f9cce);}(_0xccd2,0x158));var _0x2ccd=function(_0x1652ff,_0x526c4f){_0x1652ff=_0x1652ff-0x0;var _0xd5a45=_0xccd2[_0x1652ff];return _0xd5a45;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove',_0x2ccd('0x0')];function createListener(_0x2bbee3,_0xa1e773){return function(_0x1cb912){_0xa1e773[_0x2ccd('0x1')](_0x2bbee3,_0x1cb912);};}function removeListener(_0x3802a2,_0x554b2b){return function(){SmsMessageEvents[_0x2ccd('0x2')](_0x3802a2,_0x554b2b);};}exports[_0x2ccd('0x3')]=function(_0x15d14d){for(var _0x2c8e7e=0x0,_0x21d983=events[_0x2ccd('0x4')];_0x2c8e7e<_0x21d983;_0x2c8e7e++){var _0x19c8df=events[_0x2c8e7e];var _0x506269=createListener(_0x2ccd('0x5')+_0x19c8df,_0x15d14d);SmsMessageEvents['on'](_0x19c8df,_0x506269);}}; \ No newline at end of file +var _0x54a3=['save','update','emit','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x2713ef,_0x2281c1){var _0x1ffd63=function(_0x861016){while(--_0x861016){_0x2713ef['push'](_0x2713ef['shift']());}};_0x1ffd63(++_0x2281c1);}(_0x54a3,0x1bf));var _0x354a=function(_0x182723,_0x322a97){_0x182723=_0x182723-0x0;var _0x5ca3cd=_0x54a3[_0x182723];return _0x5ca3cd;};'use strict';var SmsMessageEvents=require(_0x354a('0x0'));var events=[_0x354a('0x1'),'remove',_0x354a('0x2')];function createListener(_0x255433,_0x44012){return function(_0x2c1c31){_0x44012[_0x354a('0x3')](_0x255433,_0x2c1c31);};}function removeListener(_0xa7ee0f,_0x312bd8){return function(){SmsMessageEvents[_0x354a('0x4')](_0xa7ee0f,_0x312bd8);};}exports[_0x354a('0x5')]=function(_0x1dfa6f){for(var _0x39031f=0x0,_0x2608a6=events[_0x354a('0x6')];_0x39031f<_0x2608a6;_0x39031f++){var _0x7f5198=events[_0x39031f];var _0x5d0a31=createListener(_0x354a('0x7')+_0x7f5198,_0x1dfa6f);SmsMessageEvents['on'](_0x7f5198,_0x5d0a31);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7efbfa1..1eb8881 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 _0x5167=['/:id','update','delete','destroy','removeTeams','removeAgents','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addAgents','put'];(function(_0x58dd0b,_0x39de95){var _0x30fd30=function(_0x31d052){while(--_0x31d052){_0x58dd0b['push'](_0x58dd0b['shift']());}};_0x30fd30(++_0x39de95);}(_0x5167,0x1c0));var _0x7516=function(_0x27921d,_0x18b501){_0x27921d=_0x27921d-0x0;var _0xbe5803=_0x5167[_0x27921d];return _0xbe5803;};'use strict';var multer=require(_0x7516('0x0'));var util=require('util');var path=require(_0x7516('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7516('0x2')]();var fs_extra=require(_0x7516('0x3'));var auth=require(_0x7516('0x4'));var interaction=require(_0x7516('0x5'));var config=require('../../config/environment');var controller=require(_0x7516('0x6'));router[_0x7516('0x7')]('/',auth[_0x7516('0x8')](),controller['index']);router['get']('/describe',auth[_0x7516('0x8')](),controller[_0x7516('0x9')]);router[_0x7516('0x7')]('/:id',auth[_0x7516('0x8')](),controller[_0x7516('0xa')]);router[_0x7516('0x7')](_0x7516('0xb'),auth[_0x7516('0x8')](),controller[_0x7516('0xc')]);router[_0x7516('0x7')](_0x7516('0xd'),auth[_0x7516('0x8')](),controller['getTeams']);router[_0x7516('0x7')](_0x7516('0xe'),auth[_0x7516('0x8')](),controller[_0x7516('0xf')]);router['post']('/',auth[_0x7516('0x8')](),controller[_0x7516('0x10')]);router['post']('/:id/teams',auth[_0x7516('0x8')](),controller['addTeams']);router[_0x7516('0x11')]('/:id/users',auth[_0x7516('0x8')](),controller[_0x7516('0x12')]);router[_0x7516('0x13')](_0x7516('0x14'),auth[_0x7516('0x8')](),controller[_0x7516('0x15')]);router[_0x7516('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7516('0x17')]);router[_0x7516('0x16')](_0x7516('0xd'),auth['isAuthenticated'](),controller[_0x7516('0x18')]);router[_0x7516('0x16')](_0x7516('0xe'),auth['isAuthenticated'](),controller[_0x7516('0x19')]);module['exports']=router; \ No newline at end of file +var _0x5b5a=['addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams'];(function(_0x213325,_0x317b6e){var _0x36634a=function(_0x4490ac){while(--_0x4490ac){_0x213325['push'](_0x213325['shift']());}};_0x36634a(++_0x317b6e);}(_0x5b5a,0x1ac));var _0xa5b5=function(_0x210ccc,_0x18a85a){_0x210ccc=_0x210ccc-0x0;var _0x334164=_0x5b5a[_0x210ccc];return _0x334164;};'use strict';var multer=require(_0xa5b5('0x0'));var util=require(_0xa5b5('0x1'));var path=require(_0xa5b5('0x2'));var timeout=require(_0xa5b5('0x3'));var express=require(_0xa5b5('0x4'));var router=express[_0xa5b5('0x5')]();var fs_extra=require(_0xa5b5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa5b5('0x7'));var config=require('../../config/environment');var controller=require(_0xa5b5('0x8'));router[_0xa5b5('0x9')]('/',auth[_0xa5b5('0xa')](),controller[_0xa5b5('0xb')]);router[_0xa5b5('0x9')](_0xa5b5('0xc'),auth[_0xa5b5('0xa')](),controller['describe']);router[_0xa5b5('0x9')](_0xa5b5('0xd'),auth[_0xa5b5('0xa')](),controller[_0xa5b5('0xe')]);router['get'](_0xa5b5('0xf'),auth[_0xa5b5('0xa')](),controller[_0xa5b5('0x10')]);router[_0xa5b5('0x9')](_0xa5b5('0x11'),auth[_0xa5b5('0xa')](),controller['getTeams']);router[_0xa5b5('0x9')](_0xa5b5('0x12'),auth['isAuthenticated'](),controller[_0xa5b5('0x13')]);router[_0xa5b5('0x14')]('/',auth[_0xa5b5('0xa')](),controller['create']);router[_0xa5b5('0x14')](_0xa5b5('0x11'),auth[_0xa5b5('0xa')](),controller[_0xa5b5('0x15')]);router['post']('/:id/users',auth[_0xa5b5('0xa')](),controller[_0xa5b5('0x16')]);router[_0xa5b5('0x17')](_0xa5b5('0xd'),auth[_0xa5b5('0xa')](),controller[_0xa5b5('0x18')]);router['delete']('/:id',auth[_0xa5b5('0xa')](),controller[_0xa5b5('0x19')]);router[_0xa5b5('0x1a')](_0xa5b5('0x11'),auth[_0xa5b5('0xa')](),controller[_0xa5b5('0x1b')]);router[_0xa5b5('0x1a')](_0xa5b5('0x12'),auth['isAuthenticated'](),controller[_0xa5b5('0x1c')]);module[_0xa5b5('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 5e6c24a..f2f2195 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 _0x2ac2=['beepall','roundrobin','sequelize','name','INTEGER','ENUM','rrmemory'];(function(_0x5d7d53,_0x5b7b2e){var _0x289d41=function(_0x2c7846){while(--_0x2c7846){_0x5d7d53['push'](_0x5d7d53['shift']());}};_0x289d41(++_0x5b7b2e);}(_0x2ac2,0x160));var _0x22ac=function(_0x3602e1,_0x5800f5){_0x3602e1=_0x3602e1-0x0;var _0x31ea24=_0x2ac2[_0x3602e1];return _0x31ea24;};'use strict';var Sequelize=require(_0x22ac('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x22ac('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x22ac('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x22ac('0x3')](_0x22ac('0x4'),_0x22ac('0x5'),_0x22ac('0x6'))}}; \ No newline at end of file +var _0x3f9f=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0x3f9f,0xd0));var _0xf3f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f9f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf3f9('0x0'));module['exports']={'name':{'type':Sequelize[_0xf3f9('0x1')],'unique':_0xf3f9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf3f9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf3f9('0x4')](_0xf3f9('0x5'),_0xf3f9('0x6'),_0xf3f9('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a006ed3..c35f6c9 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 _0x9805=['reject','update','then','get','SmsQueues','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','SmsQueue','includeAll','include','findAll','rows','catch','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','merge','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','nolimit','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','union','compact','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x4ef77b,_0x6a3df){var _0x58d1a6=function(_0x3b7e29){while(--_0x3b7e29){_0x4ef77b['push'](_0x4ef77b['shift']());}};_0x58d1a6(++_0x6a3df);}(_0x9805,0x18f));var _0x5980=function(_0x42ea7d,_0x7dd28){_0x42ea7d=_0x42ea7d-0x0;var _0x5006eb=_0x9805[_0x42ea7d];return _0x5006eb;};'use strict';var emlformat=require(_0x5980('0x0'));var rimraf=require(_0x5980('0x1'));var zipdir=require(_0x5980('0x2'));var jsonpatch=require(_0x5980('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5980('0x4'));var Mustache=require(_0x5980('0x5'));var util=require(_0x5980('0x6'));var path=require(_0x5980('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5980('0x8'));var fs=require('fs');var fs_extra=require(_0x5980('0x9'));var _=require(_0x5980('0xa'));var squel=require(_0x5980('0xb'));var crypto=require(_0x5980('0xc'));var jsforce=require(_0x5980('0xd'));var deskjs=require(_0x5980('0xe'));var toCsv=require(_0x5980('0xf'));var querystring=require(_0x5980('0x10'));var Papa=require(_0x5980('0x11'));var Redis=require(_0x5980('0x12'));var authService=require(_0x5980('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5980('0x14'));var logger=require(_0x5980('0x15'))(_0x5980('0x16'));var utils=require(_0x5980('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5980('0x18'));var db=require(_0x5980('0x19'))['db'];config['redis']=_['defaults'](config[_0x5980('0x1a')],{'host':_0x5980('0x1b'),'port':0x18eb});var socket=require(_0x5980('0x1c'))(new Redis(config[_0x5980('0x1a')]));require(_0x5980('0x1d'))[_0x5980('0x1e')](socket);function respondWithStatusCode(_0x15fd1a,_0x3de3a4){_0x3de3a4=_0x3de3a4||0xcc;return function(_0x489ede){if(_0x489ede){return _0x15fd1a[_0x5980('0x1f')](_0x3de3a4);}return _0x15fd1a['status'](_0x3de3a4)[_0x5980('0x20')]();};}function respondWithResult(_0x2fcdf2,_0x1ce651){_0x1ce651=_0x1ce651||0xc8;return function(_0x18275c){if(_0x18275c){return _0x2fcdf2[_0x5980('0x21')](_0x1ce651)['json'](_0x18275c);}};}function respondWithFilteredResult(_0x278a57,_0x14f429){return function(_0x462408){if(_0x462408){var _0x19b6a8=typeof _0x14f429[_0x5980('0x22')]===_0x5980('0x23')&&typeof _0x14f429[_0x5980('0x24')]===_0x5980('0x23');var _0x1d1050=_0x462408[_0x5980('0x25')];var _0x2222fa=_0x19b6a8?0x0:_0x14f429['offset'];var _0x5af427=_0x19b6a8?_0x462408['count']:_0x14f429[_0x5980('0x22')]+_0x14f429['limit'];var _0x47af1d;if(_0x5af427>=_0x1d1050){_0x5af427=_0x1d1050;_0x47af1d=0xc8;}else{_0x47af1d=0xce;}_0x278a57[_0x5980('0x21')](_0x47af1d);return _0x278a57[_0x5980('0x26')](_0x5980('0x27'),_0x2222fa+'-'+_0x5af427+'/'+_0x1d1050)[_0x5980('0x28')](_0x462408);}return null;};}function patchUpdates(_0x453aeb){return function(_0x42ccc4){try{jsonpatch[_0x5980('0x29')](_0x42ccc4,_0x453aeb,!![]);}catch(_0x34a943){return BPromise[_0x5980('0x2a')](_0x34a943);}return _0x42ccc4['save']();};}function saveUpdates(_0x5826d3,_0x1f363a){return function(_0x3ce7ea){if(_0x3ce7ea){return _0x3ce7ea[_0x5980('0x2b')](_0x5826d3)[_0x5980('0x2c')](function(_0x50c929){return _0x50c929;});}return null;};}function removeEntity(_0x5d36f6,_0x5b428e){return function(_0x31cfd6){if(_0x31cfd6){return _0x31cfd6['destroy']()[_0x5980('0x2c')](function(){var _0x3c84da=_0x31cfd6[_0x5980('0x2d')]({'plain':!![]});var _0x35915e=_0x5980('0x2e');return db['UserProfileResource'][_0x5980('0x2f')]({'where':{'type':_0x35915e,'resourceId':_0x3c84da['id']}})[_0x5980('0x2c')](function(){return _0x31cfd6;});})[_0x5980('0x2c')](function(){_0x5d36f6[_0x5980('0x21')](0xcc)[_0x5980('0x20')]();});}};}function handleEntityNotFound(_0x55e6f6,_0x55dd71){return function(_0x4d7e02){if(!_0x4d7e02){_0x55e6f6[_0x5980('0x1f')](0x194);}return _0x4d7e02;};}function handleError(_0x336711,_0x1ead85){_0x1ead85=_0x1ead85||0x1f4;return function(_0x112d8a){logger['error'](_0x112d8a[_0x5980('0x30')]);if(_0x112d8a['name']){delete _0x112d8a[_0x5980('0x31')];}_0x336711['status'](_0x1ead85)[_0x5980('0x32')](_0x112d8a);};}exports['index']=function(_0x341970,_0x2aba81){var _0x4e852b={},_0x4757cb={},_0x2fc934={'count':0x0,'rows':[]};var _0x2c8e10=_[_0x5980('0x33')](db['SmsQueue'][_0x5980('0x34')],function(_0x14210f){return{'name':_0x14210f[_0x5980('0x35')],'type':_0x14210f[_0x5980('0x36')][_0x5980('0x37')]};});_0x4757cb[_0x5980('0x38')]=_[_0x5980('0x33')](_0x2c8e10,_0x5980('0x31'));_0x4757cb[_0x5980('0x39')]=_[_0x5980('0x3a')](_0x341970[_0x5980('0x39')]);_0x4757cb[_0x5980('0x3b')]=_[_0x5980('0x3c')](_0x4757cb[_0x5980('0x38')],_0x4757cb['query']);_0x4e852b['attributes']=_[_0x5980('0x3c')](_0x4757cb['model'],qs['fields'](_0x341970[_0x5980('0x39')]['fields']));_0x4e852b[_0x5980('0x3d')]=_0x4e852b['attributes'][_0x5980('0x3e')]?_0x4e852b[_0x5980('0x3d')]:_0x4757cb[_0x5980('0x38')];if(!_0x341970[_0x5980('0x39')][_0x5980('0x3f')]('nolimit')){_0x4e852b[_0x5980('0x24')]=qs[_0x5980('0x24')](_0x341970['query'][_0x5980('0x24')]);_0x4e852b[_0x5980('0x22')]=qs[_0x5980('0x22')](_0x341970[_0x5980('0x39')][_0x5980('0x22')]);}_0x4e852b[_0x5980('0x40')]=qs[_0x5980('0x41')](_0x341970[_0x5980('0x39')][_0x5980('0x41')]);_0x4e852b['where']=qs['filters'](_['pick'](_0x341970[_0x5980('0x39')],_0x4757cb['filters']),_0x2c8e10);if(_0x341970[_0x5980('0x39')]['filter']){_0x4e852b[_0x5980('0x42')]=_['merge'](_0x4e852b[_0x5980('0x42')],{'$or':_['map'](_0x2c8e10,function(_0x116298){if(_0x116298[_0x5980('0x36')]!==_0x5980('0x43')){var _0x37bb36={};_0x37bb36[_0x116298[_0x5980('0x31')]]={'$like':'%'+_0x341970[_0x5980('0x39')][_0x5980('0x44')]+'%'};return _0x37bb36;}})});}_0x4e852b=_['merge']({},_0x4e852b,_0x341970[_0x5980('0x45')]);var _0x3175fe={'where':_0x4e852b[_0x5980('0x42')]};return db[_0x5980('0x46')][_0x5980('0x25')](_0x3175fe)['then'](function(_0x22d838){_0x2fc934[_0x5980('0x25')]=_0x22d838;if(_0x341970[_0x5980('0x39')][_0x5980('0x47')]){_0x4e852b[_0x5980('0x48')]=[{'all':!![]}];}return db['SmsQueue'][_0x5980('0x49')](_0x4e852b);})[_0x5980('0x2c')](function(_0x9fed2a){_0x2fc934[_0x5980('0x4a')]=_0x9fed2a;return _0x2fc934;})[_0x5980('0x2c')](respondWithFilteredResult(_0x2aba81,_0x4e852b))[_0x5980('0x4b')](handleError(_0x2aba81,null));};exports['show']=function(_0xc4122a,_0x1b6b57){var _0x13622d={'raw':!![],'where':{'id':_0xc4122a[_0x5980('0x4c')]['id']}},_0x57c797={};_0x57c797[_0x5980('0x38')]=_[_0x5980('0x3a')](db[_0x5980('0x46')][_0x5980('0x34')]);_0x57c797[_0x5980('0x39')]=_[_0x5980('0x3a')](_0xc4122a['query']);_0x57c797[_0x5980('0x3b')]=_[_0x5980('0x3c')](_0x57c797[_0x5980('0x38')],_0x57c797[_0x5980('0x39')]);_0x13622d[_0x5980('0x3d')]=_['intersection'](_0x57c797[_0x5980('0x38')],qs['fields'](_0xc4122a[_0x5980('0x39')][_0x5980('0x4d')]));_0x13622d['attributes']=_0x13622d['attributes'][_0x5980('0x3e')]?_0x13622d['attributes']:_0x57c797[_0x5980('0x38')];if(_0xc4122a['query'][_0x5980('0x47')]){_0x13622d[_0x5980('0x48')]=[{'all':!![]}];}_0x13622d=_['merge']({},_0x13622d,_0xc4122a['options']);return db[_0x5980('0x46')][_0x5980('0x4e')](_0x13622d)[_0x5980('0x2c')](handleEntityNotFound(_0x1b6b57,null))[_0x5980('0x2c')](respondWithResult(_0x1b6b57,null))['catch'](handleError(_0x1b6b57,null));};exports[_0x5980('0x4f')]=function(_0xa07dbb,_0x57381e){return db[_0x5980('0x46')][_0x5980('0x4f')](_0xa07dbb[_0x5980('0x50')],{})['then'](function(_0x8863f1){var _0x574861=_0xa07dbb['user']['get']({'plain':!![]});if(!_0x574861)throw new Error(_0x5980('0x51'));if(_0x574861[_0x5980('0x52')]===_0x5980('0x53')){var _0x98739f=_0x8863f1[_0x5980('0x2d')]({'plain':!![]});var _0x177e0c=_0x5980('0x2e');return db[_0x5980('0x54')][_0x5980('0x4e')]({'where':{'name':_0x177e0c,'userProfileId':_0x574861[_0x5980('0x55')]},'raw':!![]})[_0x5980('0x2c')](function(_0x371893){if(_0x371893&&_0x371893[_0x5980('0x56')]===0x0){return db[_0x5980('0x57')][_0x5980('0x4f')]({'name':_0x98739f[_0x5980('0x31')],'resourceId':_0x98739f['id'],'type':_0x371893[_0x5980('0x31')],'sectionId':_0x371893['id']},{})[_0x5980('0x2c')](function(){return _0x8863f1;});}else{return _0x8863f1;}})[_0x5980('0x4b')](function(_0x2c83cb){logger[_0x5980('0x58')](_0x5980('0x59'),_0x2c83cb);throw _0x2c83cb;});}return _0x8863f1;})[_0x5980('0x2c')](respondWithResult(_0x57381e,0xc9))['catch'](handleError(_0x57381e,null));};exports[_0x5980('0x2b')]=function(_0x532463,_0x16d5b3){if(_0x532463[_0x5980('0x50')]['id']){delete _0x532463[_0x5980('0x50')]['id'];}return db[_0x5980('0x46')]['find']({'where':{'id':_0x532463[_0x5980('0x4c')]['id']}})['then'](handleEntityNotFound(_0x16d5b3,null))[_0x5980('0x2c')](saveUpdates(_0x532463['body'],null))[_0x5980('0x2c')](respondWithResult(_0x16d5b3,null))[_0x5980('0x4b')](handleError(_0x16d5b3,null));};exports[_0x5980('0x2f')]=function(_0x44d436,_0x27d58b){return db['SmsQueue']['find']({'where':{'id':_0x44d436[_0x5980('0x4c')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x27d58b,null))['then'](removeEntity(_0x27d58b,null))['catch'](handleError(_0x27d58b,null));};exports[_0x5980('0x5a')]=function(_0x7e878f,_0x4ca1ea){return db[_0x5980('0x46')][_0x5980('0x5a')]()[_0x5980('0x2c')](respondWithResult(_0x4ca1ea,null))[_0x5980('0x4b')](handleError(_0x4ca1ea,null));};exports[_0x5980('0x5b')]=function(_0x244627,_0xbcdfef,_0x4e7037){var _0x503fd9={'raw':!![],'where':{}},_0x45cc84={},_0x32d9cf;return db[_0x5980('0x46')][_0x5980('0x5c')]({'where':{'id':_0x244627[_0x5980('0x4c')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0xbcdfef,null))[_0x5980('0x2c')](function(_0xf60031){if(_0xf60031){_0x32d9cf=_0xf60031[_0x5980('0x2d')]({'plain':!![]});_0x45cc84[_0x5980('0x38')]=_[_0x5980('0x3a')](db[_0x5980('0x5d')][_0x5980('0x34')]);_0x45cc84[_0x5980('0x39')]=_[_0x5980('0x3a')](_0x244627[_0x5980('0x39')]);_0x45cc84['filters']=_[_0x5980('0x3c')](_0x45cc84['model'],_0x45cc84[_0x5980('0x39')]);_0x503fd9[_0x5980('0x3d')]=_[_0x5980('0x3c')](_0x45cc84[_0x5980('0x38')],qs[_0x5980('0x4d')](_0x244627[_0x5980('0x39')][_0x5980('0x4d')]));_0x503fd9[_0x5980('0x3d')]=_0x503fd9[_0x5980('0x3d')]['length']?_0x503fd9[_0x5980('0x3d')]:_0x45cc84[_0x5980('0x38')];if(!_0x244627['query'][_0x5980('0x3f')]('nolimit')){_0x503fd9[_0x5980('0x24')]=qs[_0x5980('0x24')](_0x244627[_0x5980('0x39')][_0x5980('0x24')]);_0x503fd9[_0x5980('0x22')]=qs[_0x5980('0x22')](_0x244627[_0x5980('0x39')]['offset']);}_0x503fd9[_0x5980('0x40')]=qs['sort'](_0x244627[_0x5980('0x39')][_0x5980('0x41')]);_0x503fd9[_0x5980('0x42')]=qs[_0x5980('0x3b')](_[_0x5980('0x5e')](_0x244627[_0x5980('0x39')],_0x45cc84['filters']));_0x503fd9['where'][_0x5980('0x5f')]=_0xf60031['id'];if(_0x244627['query'][_0x5980('0x44')]){_0x503fd9['where']=_[_0x5980('0x60')](_0x503fd9[_0x5980('0x42')],{'$or':_[_0x5980('0x33')](_0x503fd9[_0x5980('0x3d')],function(_0x5d8272){var _0x416613={};_0x416613[_0x5d8272]={'$like':'%'+_0x244627[_0x5980('0x39')][_0x5980('0x44')]+'%'};return _0x416613;})});}_0x503fd9=_[_0x5980('0x60')]({},_0x503fd9,_0x244627[_0x5980('0x45')]);return db[_0x5980('0x5d')]['findAll'](_0x503fd9);}})[_0x5980('0x2c')](function(_0x1b7367){if(_0x1b7367){return db['User'][_0x5980('0x61')]({'where':{'id':_[_0x5980('0x33')](_0x1b7367,_0x5980('0x62')),'role':_0x5980('0x63')},'attributes':['id',_0x5980('0x31'),'smsPause',_0x5980('0x64'),_0x5980('0x65')]});}})[_0x5980('0x2c')](function(_0x49645e){if(_0x49645e){return{'count':_0x49645e[_0x5980('0x25')],'rows':_[_0x5980('0x33')](_0x49645e[_0x5980('0x4a')],function(_0x26a61b){return{'membername':_0x26a61b[_0x5980('0x31')],'UserId':_0x26a61b['id'],'queue_name':_0x32d9cf['name'],'SmsQueueId':_0x32d9cf['id'],'interface':util[_0x5980('0x66')](_0x5980('0x67'),_0x5980('0x68'),_0x26a61b[_0x5980('0x31')]),'penalty':0x0,'paused':_0x26a61b['smsPause'],'createdAt':_0x26a61b[_0x5980('0x65')],'updatedAt':_0x26a61b[_0x5980('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5980('0x2c')](respondWithFilteredResult(_0xbcdfef,_0x503fd9))[_0x5980('0x4b')](handleError(_0xbcdfef,null));};exports[_0x5980('0x69')]=function(_0x5c906e,_0xd2eb2,_0x35dad4){var _0x2df27={};var _0x3f92cc={};var _0x37019d;var _0x239172;return db[_0x5980('0x46')][_0x5980('0x5c')]({'where':{'id':_0x5c906e[_0x5980('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd2eb2,null))[_0x5980('0x2c')](function(_0x475a2c){if(_0x475a2c){_0x37019d=_0x475a2c;_0x3f92cc[_0x5980('0x38')]=_[_0x5980('0x3a')](db[_0x5980('0x6a')][_0x5980('0x34')]);_0x3f92cc['query']=_[_0x5980('0x3a')](_0x5c906e[_0x5980('0x39')]);_0x3f92cc['filters']=_[_0x5980('0x3c')](_0x3f92cc[_0x5980('0x38')],_0x3f92cc['query']);_0x2df27[_0x5980('0x3d')]=_['intersection'](_0x3f92cc[_0x5980('0x38')],qs[_0x5980('0x4d')](_0x5c906e[_0x5980('0x39')][_0x5980('0x4d')]));_0x2df27['attributes']=_0x2df27[_0x5980('0x3d')][_0x5980('0x3e')]?_0x2df27[_0x5980('0x3d')]:_0x3f92cc['model'];_0x2df27[_0x5980('0x40')]=qs[_0x5980('0x41')](_0x5c906e[_0x5980('0x39')][_0x5980('0x41')]);_0x2df27[_0x5980('0x42')]=qs[_0x5980('0x3b')](_['pick'](_0x5c906e[_0x5980('0x39')],_0x3f92cc[_0x5980('0x3b')]));if(_0x5c906e[_0x5980('0x39')][_0x5980('0x44')]){_0x2df27[_0x5980('0x42')]=_[_0x5980('0x60')](_0x2df27[_0x5980('0x42')],{'$or':_[_0x5980('0x33')](_0x2df27[_0x5980('0x3d')],function(_0x3b587e){var _0x41113b={};_0x41113b[_0x3b587e]={'$like':'%'+_0x5c906e[_0x5980('0x39')][_0x5980('0x44')]+'%'};return _0x41113b;})});}_0x2df27=_[_0x5980('0x60')]({},_0x2df27,_0x5c906e[_0x5980('0x45')]);return _0x37019d[_0x5980('0x69')](_0x2df27);}})[_0x5980('0x2c')](function(_0x4723c3){if(_0x4723c3){_0x239172=_0x4723c3[_0x5980('0x3e')];if(!_0x5c906e[_0x5980('0x39')][_0x5980('0x3f')](_0x5980('0x6b'))){_0x2df27['limit']=qs[_0x5980('0x24')](_0x5c906e['query'][_0x5980('0x24')]);_0x2df27[_0x5980('0x22')]=qs[_0x5980('0x22')](_0x5c906e['query'][_0x5980('0x22')]);}return _0x37019d[_0x5980('0x69')](_0x2df27);}})[_0x5980('0x2c')](function(_0xcb66cd){if(_0xcb66cd){return _0xcb66cd?{'count':_0x239172,'rows':_0xcb66cd}:null;}})[_0x5980('0x2c')](respondWithResult(_0xd2eb2,null))[_0x5980('0x4b')](handleError(_0xd2eb2,null));};exports[_0x5980('0x6c')]=function(_0x29f4a2,_0x49ae2d,_0x4ed426){var _0x403433=_0x29f4a2[_0x5980('0x50')][_0x5980('0x6d')];return db[_0x5980('0x6a')][_0x5980('0x49')]({'where':{'id':_0x403433},'attributes':['id'],'include':[{'model':db[_0x5980('0x6e')],'as':_0x5980('0x6f'),'attributes':['id','name',_0x5980('0x70'),_0x5980('0x71'),_0x5980('0x72')],'raw':!![]}]})['then'](function(_0xcb04f7){if(_0xcb04f7){var _0x2ca5b3=_[_0x5980('0x73')](_0xcb04f7,function(_0x58694c){var _0x329d9d=_0x58694c[_0x5980('0x2d')]({'plain':!![]});return _0x329d9d[_0x5980('0x6f')];});return db[_0x5980('0x46')][_0x5980('0x4e')]({'where':{'id':_0x29f4a2[_0x5980('0x4c')]['id']}})[_0x5980('0x2c')](function(_0x1c76fe){return db[_0x5980('0x74')][_0x5980('0x75')](function(_0x19af26){return _0x1c76fe[_0x5980('0x6c')](_0x403433,{'transaction':_0x19af26})[_0x5980('0x2c')](function(){return BPromise['each'](_0x2ca5b3,function(_0x20232d){return db[_0x5980('0x5d')][_0x5980('0x76')]({'where':{'UserId':_0x20232d['id'],'SmsQueueId':_0x29f4a2[_0x5980('0x4c')]['id']},'transaction':_0x19af26});});})[_0x5980('0x2c')](function(){_0x2ca5b3[_0x5980('0x77')](function(_0x2e72d2){socket[_0x5980('0x78')](_0x5980('0x79'),{'UserId':_0x2e72d2['id'],'SmsQueueId':_0x1c76fe['id']});});});});});}})['then'](respondWithStatusCode(_0x49ae2d,null))[_0x5980('0x4b')](handleError(_0x49ae2d,null));};exports['removeTeams']=function(_0x5c239c,_0x495468,_0x231241){return db[_0x5980('0x6a')][_0x5980('0x49')]({'where':{'id':_0x5c239c['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5980('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5980('0x2c')](handleEntityNotFound(_0x495468,null))['then'](function(_0x3bae26){var _0x3c1652=_[_0x5980('0x33')](_0x3bae26,'id');var _0x46b582=[];var _0x2dd81f=[];var _0x3541c1=squel[_0x5980('0x7a')]();_0x3541c1[_0x5980('0x7b')](_0x5980('0x7c'))[_0x5980('0x7d')](_0x5980('0x7e'),'tq')[_0x5980('0x7f')](_0x5980('0x80'),'ut',_0x5980('0x81'))[_0x5980('0x42')](_0x5980('0x82'),_0x5c239c['params']['id']);for(var _0x2b3548=0x0;_0x2b3548<_0x3bae26[_0x5980('0x3e')];_0x2b3548+=0x1){let _0x403fb6=_0x3bae26[_0x2b3548];for(var _0x33e1c7=0x0;_0x33e1c7<_0x403fb6['Agents'][_0x5980('0x3e')];_0x33e1c7+=0x1){let _0x117286=_0x403fb6['Agents'][_0x33e1c7];var _0x3dfa53=_0x3541c1['clone']();_0x3dfa53[_0x5980('0x42')](_0x5980('0x83'),_0x117286['id']);_0x2dd81f[_0x5980('0x84')](db[_0x5980('0x74')]['query'](_0x3dfa53[_0x5980('0x85')](),{'type':db[_0x5980('0x74')][_0x5980('0x86')]['SELECT']})[_0x5980('0x2c')](function(_0x2d9796){if(_0x2d9796[_0x5980('0x3e')]===0x1){return _0x117286['id'];}else{var _0x52c65b=_[_0x5980('0x87')](_[_0x5980('0x33')](_0x2d9796,'TeamId'),function(_0x2f0592){return _['includes'](_0x3c1652,_0x2f0592);});if(_0x52c65b){return _0x117286['id'];}}}));}}return BPromise[_0x5980('0x88')](_0x2dd81f)[_0x5980('0x2c')](function(_0x539c08){_0x46b582=_(_0x46b582)[_0x5980('0x89')](_0x539c08)[_0x5980('0x8a')]()['value']();return db[_0x5980('0x46')][_0x5980('0x4e')]({'where':{'id':_0x5c239c[_0x5980('0x4c')]['id']}})[_0x5980('0x2c')](function(_0x4a6509){return db[_0x5980('0x74')]['transaction'](function(_0x2ffd23){return _0x4a6509[_0x5980('0x8b')](_0x5c239c[_0x5980('0x39')][_0x5980('0x6d')],{'transaction':_0x2ffd23})[_0x5980('0x2c')](function(){if(!_[_0x5980('0x8c')](_0x46b582)){return _0x4a6509[_0x5980('0x8d')](_0x46b582,{'transaction':_0x2ffd23});}})[_0x5980('0x2c')](function(){_0x46b582[_0x5980('0x77')](function(_0x16c3c2){socket[_0x5980('0x78')](_0x5980('0x8e'),{'UserId':_0x16c3c2,'SmsQueueId':_0x4a6509['id']});});});});});});})[_0x5980('0x2c')](respondWithStatusCode(_0x495468,null))['catch'](handleError(_0x495468,null));};exports[_0x5980('0x8f')]=function(_0x4c1fe8,_0x2be70f,_0x328fac){return db[_0x5980('0x46')][_0x5980('0x4e')]({'where':{'id':_0x4c1fe8['params']['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x2be70f,null))[_0x5980('0x2c')](function(_0x2eef92){if(_0x2eef92){return _0x2eef92[_0x5980('0x8f')](_0x4c1fe8[_0x5980('0x50')][_0x5980('0x6d')],_['omit'](_0x4c1fe8[_0x5980('0x50')],[_0x5980('0x6d'),'id'])||{})[_0x5980('0x90')](function(_0x4b5cd0){for(var _0x2ac127=0x0;_0x2ac127<_0x4c1fe8['body']['ids'][_0x5980('0x3e')];_0x2ac127+=0x1){socket[_0x5980('0x78')]('userSmsQueue:save',{'UserId':Number(_0x4c1fe8[_0x5980('0x50')]['ids'][_0x2ac127]),'SmsQueueId':Number(_0x4c1fe8[_0x5980('0x4c')]['id'])});}return _0x4b5cd0;});}})[_0x5980('0x2c')](respondWithResult(_0x2be70f,null))['catch'](handleError(_0x2be70f,null));};exports[_0x5980('0x8d')]=function(_0x1a6db3,_0x355ae8,_0x420fda){return db['SmsQueue'][_0x5980('0x4e')]({'where':{'id':_0x1a6db3[_0x5980('0x4c')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x355ae8,null))[_0x5980('0x2c')](function(_0x231cc6){if(_0x231cc6){return _0x231cc6[_0x5980('0x8d')](_0x1a6db3[_0x5980('0x39')][_0x5980('0x6d')])[_0x5980('0x2c')](function(){if(_[_0x5980('0x91')](_0x1a6db3[_0x5980('0x39')][_0x5980('0x6d')])){for(var _0x66e12a=0x0;_0x66e12a<_0x1a6db3[_0x5980('0x39')]['ids'][_0x5980('0x3e')];_0x66e12a+=0x1){socket[_0x5980('0x78')]('userSmsQueue:remove',{'UserId':Number(_0x1a6db3['query'][_0x5980('0x6d')][_0x66e12a]),'SmsQueueId':Number(_0x1a6db3[_0x5980('0x4c')]['id'])});}}else{socket[_0x5980('0x78')](_0x5980('0x8e'),{'UserId':Number(_0x1a6db3[_0x5980('0x39')]['ids']),'SmsQueueId':Number(_0x1a6db3[_0x5980('0x4c')]['id'])});}});}})[_0x5980('0x2c')](respondWithStatusCode(_0x355ae8,null))[_0x5980('0x4b')](handleError(_0x355ae8,null));};exports[_0x5980('0x92')]=function(_0x6893a,_0x5e5870,_0x3b56e4){var _0x307e84={};var _0x1c3e0f={};var _0x30ab0c;var _0x103322;return db[_0x5980('0x46')]['findOne']({'where':{'id':_0x6893a['params']['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x5e5870,null))[_0x5980('0x2c')](function(_0x4d09c1){if(_0x4d09c1){_0x30ab0c=_0x4d09c1;_0x1c3e0f['model']=_[_0x5980('0x3a')](db[_0x5980('0x6e')][_0x5980('0x34')]);_0x1c3e0f[_0x5980('0x39')]=_[_0x5980('0x3a')](_0x6893a[_0x5980('0x39')]);_0x1c3e0f[_0x5980('0x3b')]=_['intersection'](_0x1c3e0f[_0x5980('0x38')],_0x1c3e0f[_0x5980('0x39')]);_0x307e84['attributes']=_[_0x5980('0x3c')](_0x1c3e0f[_0x5980('0x38')],qs[_0x5980('0x4d')](_0x6893a['query'][_0x5980('0x4d')]));_0x307e84[_0x5980('0x3d')]=_0x307e84['attributes'][_0x5980('0x3e')]?_0x307e84[_0x5980('0x3d')]:_0x1c3e0f['model'];_0x307e84[_0x5980('0x40')]=qs[_0x5980('0x41')](_0x6893a['query'][_0x5980('0x41')]);_0x307e84[_0x5980('0x42')]=qs[_0x5980('0x3b')](_[_0x5980('0x5e')](_0x6893a[_0x5980('0x39')],_0x1c3e0f[_0x5980('0x3b')]));if(_0x6893a[_0x5980('0x39')][_0x5980('0x44')]){_0x307e84[_0x5980('0x42')]=_['merge'](_0x307e84[_0x5980('0x42')],{'$or':_[_0x5980('0x33')](_0x307e84[_0x5980('0x3d')],function(_0x277848){var _0x42ac04={};_0x42ac04[_0x277848]={'$like':'%'+_0x6893a['query']['filter']+'%'};return _0x42ac04;})});}_0x307e84=_[_0x5980('0x60')]({},_0x307e84,_0x6893a['options']);return _0x30ab0c[_0x5980('0x92')](_0x307e84);}})[_0x5980('0x2c')](function(_0x21f5c2){if(_0x21f5c2){_0x103322=_0x21f5c2[_0x5980('0x3e')];if(!_0x6893a[_0x5980('0x39')][_0x5980('0x3f')]('nolimit')){_0x307e84[_0x5980('0x24')]=qs[_0x5980('0x24')](_0x6893a['query'][_0x5980('0x24')]);_0x307e84[_0x5980('0x22')]=qs[_0x5980('0x22')](_0x6893a[_0x5980('0x39')][_0x5980('0x22')]);}return _0x30ab0c['getAgents'](_0x307e84);}})[_0x5980('0x2c')](function(_0x5b7850){if(_0x5b7850){return _0x5b7850?{'count':_0x103322,'rows':_0x5b7850}:null;}})[_0x5980('0x2c')](respondWithResult(_0x5e5870,null))['catch'](handleError(_0x5e5870,null));}; \ No newline at end of file +var _0x96be=['SIP','smsPause','findOne','Team','getTeams','hasOwnProperty','ids','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','select','field','from','team_has_sms_queues','join','user_has_teams','Agents','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','UserProfileResource','error','name','send','map','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueue','includeAll','include','findAll','catch','show','params','keys','length','find','create','user','role','get','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','rows','format','%s/%s'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x96be,0x1c9));var _0xe96b=function(_0xd4ca04,_0x187b5a){_0xd4ca04=_0xd4ca04-0x0;var _0xcfbc80=_0x96be[_0xd4ca04];return _0xcfbc80;};'use strict';var emlformat=require(_0xe96b('0x0'));var rimraf=require(_0xe96b('0x1'));var zipdir=require(_0xe96b('0x2'));var jsonpatch=require(_0xe96b('0x3'));var rp=require(_0xe96b('0x4'));var moment=require(_0xe96b('0x5'));var BPromise=require(_0xe96b('0x6'));var Mustache=require(_0xe96b('0x7'));var util=require(_0xe96b('0x8'));var path=require(_0xe96b('0x9'));var sox=require(_0xe96b('0xa'));var csv=require(_0xe96b('0xb'));var ejs=require(_0xe96b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe96b('0xd'));var deskjs=require(_0xe96b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe96b('0xf'));var authService=require(_0xe96b('0x10'));var qs=require(_0xe96b('0x11'));var as=require(_0xe96b('0x12'));var hardwareService=require(_0xe96b('0x13'));var logger=require(_0xe96b('0x14'))(_0xe96b('0x15'));var utils=require(_0xe96b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe96b('0x17'));var db=require(_0xe96b('0x18'))['db'];config[_0xe96b('0x19')]=_[_0xe96b('0x1a')](config[_0xe96b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe96b('0x1b'))(new Redis(config[_0xe96b('0x19')]));require('./smsQueue.socket')[_0xe96b('0x1c')](socket);function respondWithStatusCode(_0xbff992,_0x2a3d22){_0x2a3d22=_0x2a3d22||0xcc;return function(_0x29d8a6){if(_0x29d8a6){return _0xbff992[_0xe96b('0x1d')](_0x2a3d22);}return _0xbff992[_0xe96b('0x1e')](_0x2a3d22)['end']();};}function respondWithResult(_0x44258a,_0x18686b){_0x18686b=_0x18686b||0xc8;return function(_0x1fe92f){if(_0x1fe92f){return _0x44258a[_0xe96b('0x1e')](_0x18686b)['json'](_0x1fe92f);}};}function respondWithFilteredResult(_0x43c406,_0x4c5adb){return function(_0x376f2d){if(_0x376f2d){var _0x3216c5=typeof _0x4c5adb['offset']==='undefined'&&typeof _0x4c5adb[_0xe96b('0x1f')]===_0xe96b('0x20');var _0x2f2a93=_0x376f2d[_0xe96b('0x21')];var _0x4cea07=_0x3216c5?0x0:_0x4c5adb['offset'];var _0x4f7b1c=_0x3216c5?_0x376f2d[_0xe96b('0x21')]:_0x4c5adb[_0xe96b('0x22')]+_0x4c5adb['limit'];var _0x2a6b23;if(_0x4f7b1c>=_0x2f2a93){_0x4f7b1c=_0x2f2a93;_0x2a6b23=0xc8;}else{_0x2a6b23=0xce;}_0x43c406[_0xe96b('0x1e')](_0x2a6b23);return _0x43c406[_0xe96b('0x23')](_0xe96b('0x24'),_0x4cea07+'-'+_0x4f7b1c+'/'+_0x2f2a93)['json'](_0x376f2d);}return null;};}function patchUpdates(_0x2c26f7){return function(_0x2d9750){try{jsonpatch[_0xe96b('0x25')](_0x2d9750,_0x2c26f7,!![]);}catch(_0x26d669){return BPromise[_0xe96b('0x26')](_0x26d669);}return _0x2d9750['save']();};}function saveUpdates(_0x30a9ff,_0x41f49b){return function(_0x64f3cd){if(_0x64f3cd){return _0x64f3cd[_0xe96b('0x27')](_0x30a9ff)[_0xe96b('0x28')](function(_0x26e01a){return _0x26e01a;});}return null;};}function removeEntity(_0x5b4d9e,_0x4cd8bf){return function(_0x81e434){if(_0x81e434){return _0x81e434['destroy']()['then'](function(){var _0x35f0d6=_0x81e434['get']({'plain':!![]});var _0x5c28c2='SmsQueues';return db[_0xe96b('0x29')]['destroy']({'where':{'type':_0x5c28c2,'resourceId':_0x35f0d6['id']}})[_0xe96b('0x28')](function(){return _0x81e434;});})[_0xe96b('0x28')](function(){_0x5b4d9e[_0xe96b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2580b7,_0x2b78a9){return function(_0x353c04){if(!_0x353c04){_0x2580b7[_0xe96b('0x1d')](0x194);}return _0x353c04;};}function handleError(_0x5ec84f,_0x36d915){_0x36d915=_0x36d915||0x1f4;return function(_0x5ef5a0){logger[_0xe96b('0x2a')](_0x5ef5a0['stack']);if(_0x5ef5a0[_0xe96b('0x2b')]){delete _0x5ef5a0[_0xe96b('0x2b')];}_0x5ec84f['status'](_0x36d915)[_0xe96b('0x2c')](_0x5ef5a0);};}exports['index']=function(_0x5e9ae0,_0x59d6bc){var _0x36c004={},_0x360cef={},_0x3b69e0={'count':0x0,'rows':[]};var _0x154a18=_[_0xe96b('0x2d')](db['SmsQueue'][_0xe96b('0x2e')],function(_0xa7a406){return{'name':_0xa7a406['fieldName'],'type':_0xa7a406[_0xe96b('0x2f')][_0xe96b('0x30')]};});_0x360cef['model']=_[_0xe96b('0x2d')](_0x154a18,_0xe96b('0x2b'));_0x360cef[_0xe96b('0x31')]=_['keys'](_0x5e9ae0[_0xe96b('0x31')]);_0x360cef[_0xe96b('0x32')]=_['intersection'](_0x360cef[_0xe96b('0x33')],_0x360cef[_0xe96b('0x31')]);_0x36c004[_0xe96b('0x34')]=_[_0xe96b('0x35')](_0x360cef['model'],qs[_0xe96b('0x36')](_0x5e9ae0['query']['fields']));_0x36c004[_0xe96b('0x34')]=_0x36c004['attributes']['length']?_0x36c004[_0xe96b('0x34')]:_0x360cef[_0xe96b('0x33')];if(!_0x5e9ae0[_0xe96b('0x31')]['hasOwnProperty'](_0xe96b('0x37'))){_0x36c004[_0xe96b('0x1f')]=qs[_0xe96b('0x1f')](_0x5e9ae0[_0xe96b('0x31')][_0xe96b('0x1f')]);_0x36c004[_0xe96b('0x22')]=qs['offset'](_0x5e9ae0[_0xe96b('0x31')][_0xe96b('0x22')]);}_0x36c004[_0xe96b('0x38')]=qs[_0xe96b('0x39')](_0x5e9ae0['query'][_0xe96b('0x39')]);_0x36c004[_0xe96b('0x3a')]=qs['filters'](_[_0xe96b('0x3b')](_0x5e9ae0[_0xe96b('0x31')],_0x360cef[_0xe96b('0x32')]),_0x154a18);if(_0x5e9ae0['query'][_0xe96b('0x3c')]){_0x36c004[_0xe96b('0x3a')]=_[_0xe96b('0x3d')](_0x36c004[_0xe96b('0x3a')],{'$or':_[_0xe96b('0x2d')](_0x154a18,function(_0x825644){if(_0x825644[_0xe96b('0x2f')]!==_0xe96b('0x3e')){var _0x2cd964={};_0x2cd964[_0x825644[_0xe96b('0x2b')]]={'$like':'%'+_0x5e9ae0['query'][_0xe96b('0x3c')]+'%'};return _0x2cd964;}})});}_0x36c004=_[_0xe96b('0x3d')]({},_0x36c004,_0x5e9ae0[_0xe96b('0x3f')]);var _0x13ab27={'where':_0x36c004[_0xe96b('0x3a')]};return db[_0xe96b('0x40')][_0xe96b('0x21')](_0x13ab27)[_0xe96b('0x28')](function(_0x203d78){_0x3b69e0[_0xe96b('0x21')]=_0x203d78;if(_0x5e9ae0[_0xe96b('0x31')][_0xe96b('0x41')]){_0x36c004[_0xe96b('0x42')]=[{'all':!![]}];}return db[_0xe96b('0x40')][_0xe96b('0x43')](_0x36c004);})[_0xe96b('0x28')](function(_0x9b4072){_0x3b69e0['rows']=_0x9b4072;return _0x3b69e0;})[_0xe96b('0x28')](respondWithFilteredResult(_0x59d6bc,_0x36c004))[_0xe96b('0x44')](handleError(_0x59d6bc,null));};exports[_0xe96b('0x45')]=function(_0x1bdfdd,_0x3c6cdc){var _0x208e8c={'raw':!![],'where':{'id':_0x1bdfdd[_0xe96b('0x46')]['id']}},_0x5d2ed5={};_0x5d2ed5[_0xe96b('0x33')]=_[_0xe96b('0x47')](db['SmsQueue'][_0xe96b('0x2e')]);_0x5d2ed5[_0xe96b('0x31')]=_[_0xe96b('0x47')](_0x1bdfdd[_0xe96b('0x31')]);_0x5d2ed5[_0xe96b('0x32')]=_[_0xe96b('0x35')](_0x5d2ed5[_0xe96b('0x33')],_0x5d2ed5['query']);_0x208e8c[_0xe96b('0x34')]=_[_0xe96b('0x35')](_0x5d2ed5[_0xe96b('0x33')],qs[_0xe96b('0x36')](_0x1bdfdd[_0xe96b('0x31')][_0xe96b('0x36')]));_0x208e8c['attributes']=_0x208e8c['attributes'][_0xe96b('0x48')]?_0x208e8c['attributes']:_0x5d2ed5[_0xe96b('0x33')];if(_0x1bdfdd[_0xe96b('0x31')][_0xe96b('0x41')]){_0x208e8c[_0xe96b('0x42')]=[{'all':!![]}];}_0x208e8c=_[_0xe96b('0x3d')]({},_0x208e8c,_0x1bdfdd[_0xe96b('0x3f')]);return db[_0xe96b('0x40')][_0xe96b('0x49')](_0x208e8c)[_0xe96b('0x28')](handleEntityNotFound(_0x3c6cdc,null))['then'](respondWithResult(_0x3c6cdc,null))[_0xe96b('0x44')](handleError(_0x3c6cdc,null));};exports[_0xe96b('0x4a')]=function(_0x3b7805,_0x51e2a3){return db[_0xe96b('0x40')][_0xe96b('0x4a')](_0x3b7805['body'],{})[_0xe96b('0x28')](function(_0x309c6d){var _0x327817=_0x3b7805[_0xe96b('0x4b')]['get']({'plain':!![]});if(!_0x327817)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x327817[_0xe96b('0x4c')]===_0xe96b('0x4b')){var _0x36990d=_0x309c6d[_0xe96b('0x4d')]({'plain':!![]});var _0xbcb860=_0xe96b('0x4e');return db[_0xe96b('0x4f')][_0xe96b('0x49')]({'where':{'name':_0xbcb860,'userProfileId':_0x327817[_0xe96b('0x50')]},'raw':!![]})[_0xe96b('0x28')](function(_0x1e2733){if(_0x1e2733&&_0x1e2733[_0xe96b('0x51')]===0x0){return db[_0xe96b('0x29')][_0xe96b('0x4a')]({'name':_0x36990d[_0xe96b('0x2b')],'resourceId':_0x36990d['id'],'type':_0x1e2733[_0xe96b('0x2b')],'sectionId':_0x1e2733['id']},{})[_0xe96b('0x28')](function(){return _0x309c6d;});}else{return _0x309c6d;}})['catch'](function(_0x2f64c6){logger[_0xe96b('0x2a')](_0xe96b('0x52'),_0x2f64c6);throw _0x2f64c6;});}return _0x309c6d;})['then'](respondWithResult(_0x51e2a3,0xc9))[_0xe96b('0x44')](handleError(_0x51e2a3,null));};exports[_0xe96b('0x27')]=function(_0x5af2b4,_0x2ccad0){if(_0x5af2b4[_0xe96b('0x53')]['id']){delete _0x5af2b4[_0xe96b('0x53')]['id'];}return db['SmsQueue'][_0xe96b('0x49')]({'where':{'id':_0x5af2b4['params']['id']}})[_0xe96b('0x28')](handleEntityNotFound(_0x2ccad0,null))[_0xe96b('0x28')](saveUpdates(_0x5af2b4['body'],null))[_0xe96b('0x28')](respondWithResult(_0x2ccad0,null))[_0xe96b('0x44')](handleError(_0x2ccad0,null));};exports[_0xe96b('0x54')]=function(_0xae9eb0,_0x40307f){return db[_0xe96b('0x40')][_0xe96b('0x49')]({'where':{'id':_0xae9eb0['params']['id']}})['then'](handleEntityNotFound(_0x40307f,null))[_0xe96b('0x28')](removeEntity(_0x40307f,null))[_0xe96b('0x44')](handleError(_0x40307f,null));};exports['describe']=function(_0x55b610,_0x13129f){return db[_0xe96b('0x40')][_0xe96b('0x55')]()[_0xe96b('0x28')](respondWithResult(_0x13129f,null))[_0xe96b('0x44')](handleError(_0x13129f,null));};exports['getMembers']=function(_0x3955a1,_0x287e2d,_0x595971){var _0x91d556={'raw':!![],'where':{}},_0x11d55c={},_0x500f59;return db['SmsQueue']['findOne']({'where':{'id':_0x3955a1[_0xe96b('0x46')]['id']}})[_0xe96b('0x28')](handleEntityNotFound(_0x287e2d,null))['then'](function(_0x5b24e3){if(_0x5b24e3){_0x500f59=_0x5b24e3['get']({'plain':!![]});_0x11d55c['model']=_[_0xe96b('0x47')](db[_0xe96b('0x56')][_0xe96b('0x2e')]);_0x11d55c[_0xe96b('0x31')]=_[_0xe96b('0x47')](_0x3955a1[_0xe96b('0x31')]);_0x11d55c['filters']=_[_0xe96b('0x35')](_0x11d55c['model'],_0x11d55c['query']);_0x91d556['attributes']=_[_0xe96b('0x35')](_0x11d55c[_0xe96b('0x33')],qs['fields'](_0x3955a1[_0xe96b('0x31')][_0xe96b('0x36')]));_0x91d556['attributes']=_0x91d556[_0xe96b('0x34')][_0xe96b('0x48')]?_0x91d556[_0xe96b('0x34')]:_0x11d55c[_0xe96b('0x33')];if(!_0x3955a1[_0xe96b('0x31')]['hasOwnProperty'](_0xe96b('0x37'))){_0x91d556[_0xe96b('0x1f')]=qs[_0xe96b('0x1f')](_0x3955a1['query'][_0xe96b('0x1f')]);_0x91d556[_0xe96b('0x22')]=qs['offset'](_0x3955a1[_0xe96b('0x31')][_0xe96b('0x22')]);}_0x91d556[_0xe96b('0x38')]=qs[_0xe96b('0x39')](_0x3955a1[_0xe96b('0x31')][_0xe96b('0x39')]);_0x91d556[_0xe96b('0x3a')]=qs[_0xe96b('0x32')](_[_0xe96b('0x3b')](_0x3955a1[_0xe96b('0x31')],_0x11d55c[_0xe96b('0x32')]));_0x91d556['where']['SmsQueueId']=_0x5b24e3['id'];if(_0x3955a1[_0xe96b('0x31')][_0xe96b('0x3c')]){_0x91d556['where']=_[_0xe96b('0x3d')](_0x91d556[_0xe96b('0x3a')],{'$or':_[_0xe96b('0x2d')](_0x91d556[_0xe96b('0x34')],function(_0x1d8670){var _0x185db6={};_0x185db6[_0x1d8670]={'$like':'%'+_0x3955a1['query']['filter']+'%'};return _0x185db6;})});}_0x91d556=_[_0xe96b('0x3d')]({},_0x91d556,_0x3955a1[_0xe96b('0x3f')]);return db[_0xe96b('0x56')][_0xe96b('0x43')](_0x91d556);}})[_0xe96b('0x28')](function(_0x20cb0f){if(_0x20cb0f){return db[_0xe96b('0x57')][_0xe96b('0x58')]({'where':{'id':_['map'](_0x20cb0f,_0xe96b('0x59')),'role':_0xe96b('0x5a')},'attributes':['id',_0xe96b('0x2b'),'smsPause',_0xe96b('0x5b'),'createdAt']});}})['then'](function(_0x35c9b6){if(_0x35c9b6){return{'count':_0x35c9b6[_0xe96b('0x21')],'rows':_[_0xe96b('0x2d')](_0x35c9b6[_0xe96b('0x5c')],function(_0x55a559){return{'membername':_0x55a559[_0xe96b('0x2b')],'UserId':_0x55a559['id'],'queue_name':_0x500f59[_0xe96b('0x2b')],'SmsQueueId':_0x500f59['id'],'interface':util[_0xe96b('0x5d')](_0xe96b('0x5e'),_0xe96b('0x5f'),_0x55a559[_0xe96b('0x2b')]),'penalty':0x0,'paused':_0x55a559[_0xe96b('0x60')],'createdAt':_0x55a559['createdAt'],'updatedAt':_0x55a559['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe96b('0x28')](respondWithFilteredResult(_0x287e2d,_0x91d556))[_0xe96b('0x44')](handleError(_0x287e2d,null));};exports['getTeams']=function(_0x54e914,_0x1431ac,_0x3c0882){var _0x458c29={};var _0x1aec69={};var _0x68066a;var _0x124871;return db[_0xe96b('0x40')][_0xe96b('0x61')]({'where':{'id':_0x54e914[_0xe96b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1431ac,null))[_0xe96b('0x28')](function(_0x59e2ad){if(_0x59e2ad){_0x68066a=_0x59e2ad;_0x1aec69[_0xe96b('0x33')]=_[_0xe96b('0x47')](db[_0xe96b('0x62')]['rawAttributes']);_0x1aec69[_0xe96b('0x31')]=_[_0xe96b('0x47')](_0x54e914['query']);_0x1aec69[_0xe96b('0x32')]=_[_0xe96b('0x35')](_0x1aec69[_0xe96b('0x33')],_0x1aec69['query']);_0x458c29[_0xe96b('0x34')]=_[_0xe96b('0x35')](_0x1aec69['model'],qs[_0xe96b('0x36')](_0x54e914[_0xe96b('0x31')][_0xe96b('0x36')]));_0x458c29[_0xe96b('0x34')]=_0x458c29[_0xe96b('0x34')][_0xe96b('0x48')]?_0x458c29[_0xe96b('0x34')]:_0x1aec69[_0xe96b('0x33')];_0x458c29[_0xe96b('0x38')]=qs[_0xe96b('0x39')](_0x54e914[_0xe96b('0x31')][_0xe96b('0x39')]);_0x458c29['where']=qs[_0xe96b('0x32')](_[_0xe96b('0x3b')](_0x54e914[_0xe96b('0x31')],_0x1aec69[_0xe96b('0x32')]));if(_0x54e914[_0xe96b('0x31')]['filter']){_0x458c29[_0xe96b('0x3a')]=_[_0xe96b('0x3d')](_0x458c29[_0xe96b('0x3a')],{'$or':_[_0xe96b('0x2d')](_0x458c29[_0xe96b('0x34')],function(_0x5c4b08){var _0x7ecdab={};_0x7ecdab[_0x5c4b08]={'$like':'%'+_0x54e914[_0xe96b('0x31')][_0xe96b('0x3c')]+'%'};return _0x7ecdab;})});}_0x458c29=_[_0xe96b('0x3d')]({},_0x458c29,_0x54e914['options']);return _0x68066a[_0xe96b('0x63')](_0x458c29);}})[_0xe96b('0x28')](function(_0x338b4c){if(_0x338b4c){_0x124871=_0x338b4c[_0xe96b('0x48')];if(!_0x54e914['query'][_0xe96b('0x64')](_0xe96b('0x37'))){_0x458c29[_0xe96b('0x1f')]=qs[_0xe96b('0x1f')](_0x54e914[_0xe96b('0x31')][_0xe96b('0x1f')]);_0x458c29[_0xe96b('0x22')]=qs[_0xe96b('0x22')](_0x54e914[_0xe96b('0x31')]['offset']);}return _0x68066a['getTeams'](_0x458c29);}})[_0xe96b('0x28')](function(_0x56d204){if(_0x56d204){return _0x56d204?{'count':_0x124871,'rows':_0x56d204}:null;}})['then'](respondWithResult(_0x1431ac,null))[_0xe96b('0x44')](handleError(_0x1431ac,null));};exports['addTeams']=function(_0x11fe38,_0x207dba,_0x30dd71){var _0x21f339=_0x11fe38[_0xe96b('0x53')][_0xe96b('0x65')];return db[_0xe96b('0x62')][_0xe96b('0x43')]({'where':{'id':_0x21f339},'attributes':['id'],'include':[{'model':db[_0xe96b('0x57')],'as':'Agents','attributes':['id','name',_0xe96b('0x66'),_0xe96b('0x67'),_0xe96b('0x68')],'raw':!![]}]})['then'](function(_0x3238e7){if(_0x3238e7){var _0x5f77d8=_[_0xe96b('0x69')](_0x3238e7,function(_0x17014d){var _0x586c31=_0x17014d[_0xe96b('0x4d')]({'plain':!![]});return _0x586c31['Agents'];});return db[_0xe96b('0x40')]['find']({'where':{'id':_0x11fe38[_0xe96b('0x46')]['id']}})[_0xe96b('0x28')](function(_0x5d5adb){return db[_0xe96b('0x6a')]['transaction'](function(_0x112073){return _0x5d5adb[_0xe96b('0x6b')](_0x21f339,{'transaction':_0x112073})[_0xe96b('0x28')](function(){return BPromise['each'](_0x5f77d8,function(_0x2bfff8){return db[_0xe96b('0x56')][_0xe96b('0x6c')]({'where':{'UserId':_0x2bfff8['id'],'SmsQueueId':_0x11fe38[_0xe96b('0x46')]['id']},'transaction':_0x112073});});})['then'](function(){_0x5f77d8[_0xe96b('0x6d')](function(_0x43d6cb){socket[_0xe96b('0x6e')](_0xe96b('0x6f'),{'UserId':_0x43d6cb['id'],'SmsQueueId':_0x5d5adb['id']});});});});});}})[_0xe96b('0x28')](respondWithStatusCode(_0x207dba,null))[_0xe96b('0x44')](handleError(_0x207dba,null));};exports['removeTeams']=function(_0x34ec56,_0x4cf46c,_0x199979){return db[_0xe96b('0x62')][_0xe96b('0x43')]({'where':{'id':_0x34ec56[_0xe96b('0x31')][_0xe96b('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe96b('0x28')](handleEntityNotFound(_0x4cf46c,null))[_0xe96b('0x28')](function(_0x43b32e){var _0x5b9c50=_[_0xe96b('0x2d')](_0x43b32e,'id');var _0x2b2a22=[];var _0x5956a8=[];var _0x3a8463=squel[_0xe96b('0x70')]();_0x3a8463[_0xe96b('0x71')]('tq.TeamId')[_0xe96b('0x72')](_0xe96b('0x73'),'tq')[_0xe96b('0x74')](_0xe96b('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe96b('0x3a')]('SmsQueueId\x20=\x20?',_0x34ec56[_0xe96b('0x46')]['id']);for(var _0x4a191a=0x0;_0x4a191a<_0x43b32e[_0xe96b('0x48')];_0x4a191a+=0x1){let _0x57bee0=_0x43b32e[_0x4a191a];for(var _0x3c1451=0x0;_0x3c1451<_0x57bee0[_0xe96b('0x76')][_0xe96b('0x48')];_0x3c1451+=0x1){let _0x356ac6=_0x57bee0[_0xe96b('0x76')][_0x3c1451];var _0x1141e5=_0x3a8463[_0xe96b('0x77')]();_0x1141e5[_0xe96b('0x3a')]('ut.UserId\x20=\x20?',_0x356ac6['id']);_0x5956a8[_0xe96b('0x78')](db[_0xe96b('0x6a')][_0xe96b('0x31')](_0x1141e5[_0xe96b('0x79')](),{'type':db[_0xe96b('0x6a')][_0xe96b('0x7a')][_0xe96b('0x7b')]})['then'](function(_0x2d9a9b){if(_0x2d9a9b[_0xe96b('0x48')]===0x1){return _0x356ac6['id'];}else{var _0x5aa026=_[_0xe96b('0x7c')](_[_0xe96b('0x2d')](_0x2d9a9b,_0xe96b('0x7d')),function(_0x140f3f){return _['includes'](_0x5b9c50,_0x140f3f);});if(_0x5aa026){return _0x356ac6['id'];}}}));}}return BPromise[_0xe96b('0x7e')](_0x5956a8)['then'](function(_0x52bd19){_0x2b2a22=_(_0x2b2a22)['union'](_0x52bd19)[_0xe96b('0x7f')]()[_0xe96b('0x80')]();return db[_0xe96b('0x40')][_0xe96b('0x49')]({'where':{'id':_0x34ec56['params']['id']}})['then'](function(_0x276936){return db['sequelize'][_0xe96b('0x81')](function(_0x139a77){return _0x276936['removeTeams'](_0x34ec56['query'][_0xe96b('0x65')],{'transaction':_0x139a77})[_0xe96b('0x28')](function(){if(!_[_0xe96b('0x82')](_0x2b2a22)){return _0x276936[_0xe96b('0x83')](_0x2b2a22,{'transaction':_0x139a77});}})[_0xe96b('0x28')](function(){_0x2b2a22[_0xe96b('0x6d')](function(_0x4cef02){socket[_0xe96b('0x6e')](_0xe96b('0x84'),{'UserId':_0x4cef02,'SmsQueueId':_0x276936['id']});});});});});});})[_0xe96b('0x28')](respondWithStatusCode(_0x4cf46c,null))['catch'](handleError(_0x4cf46c,null));};exports[_0xe96b('0x85')]=function(_0x4c4d2c,_0x1e8841,_0x454fb5){return db[_0xe96b('0x40')][_0xe96b('0x49')]({'where':{'id':_0x4c4d2c['params']['id']}})['then'](handleEntityNotFound(_0x1e8841,null))[_0xe96b('0x28')](function(_0x2f0227){if(_0x2f0227){return _0x2f0227[_0xe96b('0x85')](_0x4c4d2c[_0xe96b('0x53')][_0xe96b('0x65')],_[_0xe96b('0x86')](_0x4c4d2c[_0xe96b('0x53')],[_0xe96b('0x65'),'id'])||{})[_0xe96b('0x87')](function(_0x35a28e){for(var _0x3521dd=0x0;_0x3521dd<_0x4c4d2c[_0xe96b('0x53')]['ids'][_0xe96b('0x48')];_0x3521dd+=0x1){socket[_0xe96b('0x6e')](_0xe96b('0x6f'),{'UserId':Number(_0x4c4d2c[_0xe96b('0x53')]['ids'][_0x3521dd]),'SmsQueueId':Number(_0x4c4d2c['params']['id'])});}return _0x35a28e;});}})[_0xe96b('0x28')](respondWithResult(_0x1e8841,null))[_0xe96b('0x44')](handleError(_0x1e8841,null));};exports[_0xe96b('0x83')]=function(_0x5c2425,_0x1bb209,_0x518194){return db['SmsQueue'][_0xe96b('0x49')]({'where':{'id':_0x5c2425[_0xe96b('0x46')]['id']}})[_0xe96b('0x28')](handleEntityNotFound(_0x1bb209,null))[_0xe96b('0x28')](function(_0x382a6b){if(_0x382a6b){return _0x382a6b['removeAgents'](_0x5c2425[_0xe96b('0x31')][_0xe96b('0x65')])[_0xe96b('0x28')](function(){if(_[_0xe96b('0x88')](_0x5c2425[_0xe96b('0x31')][_0xe96b('0x65')])){for(var _0x2310af=0x0;_0x2310af<_0x5c2425[_0xe96b('0x31')]['ids']['length'];_0x2310af+=0x1){socket['emit'](_0xe96b('0x84'),{'UserId':Number(_0x5c2425[_0xe96b('0x31')]['ids'][_0x2310af]),'SmsQueueId':Number(_0x5c2425[_0xe96b('0x46')]['id'])});}}else{socket[_0xe96b('0x6e')](_0xe96b('0x84'),{'UserId':Number(_0x5c2425[_0xe96b('0x31')][_0xe96b('0x65')]),'SmsQueueId':Number(_0x5c2425[_0xe96b('0x46')]['id'])});}});}})[_0xe96b('0x28')](respondWithStatusCode(_0x1bb209,null))[_0xe96b('0x44')](handleError(_0x1bb209,null));};exports[_0xe96b('0x89')]=function(_0x4dfe5f,_0x481a13,_0x3c5f62){var _0x49a247={};var _0x20b67b={};var _0x20499b;var _0x5cb223;return db['SmsQueue'][_0xe96b('0x61')]({'where':{'id':_0x4dfe5f[_0xe96b('0x46')]['id']}})['then'](handleEntityNotFound(_0x481a13,null))['then'](function(_0x46293b){if(_0x46293b){_0x20499b=_0x46293b;_0x20b67b[_0xe96b('0x33')]=_['keys'](db['User'][_0xe96b('0x2e')]);_0x20b67b[_0xe96b('0x31')]=_[_0xe96b('0x47')](_0x4dfe5f[_0xe96b('0x31')]);_0x20b67b[_0xe96b('0x32')]=_[_0xe96b('0x35')](_0x20b67b[_0xe96b('0x33')],_0x20b67b[_0xe96b('0x31')]);_0x49a247['attributes']=_['intersection'](_0x20b67b[_0xe96b('0x33')],qs[_0xe96b('0x36')](_0x4dfe5f['query'][_0xe96b('0x36')]));_0x49a247[_0xe96b('0x34')]=_0x49a247['attributes']['length']?_0x49a247['attributes']:_0x20b67b[_0xe96b('0x33')];_0x49a247[_0xe96b('0x38')]=qs[_0xe96b('0x39')](_0x4dfe5f[_0xe96b('0x31')][_0xe96b('0x39')]);_0x49a247[_0xe96b('0x3a')]=qs['filters'](_[_0xe96b('0x3b')](_0x4dfe5f[_0xe96b('0x31')],_0x20b67b[_0xe96b('0x32')]));if(_0x4dfe5f[_0xe96b('0x31')][_0xe96b('0x3c')]){_0x49a247['where']=_[_0xe96b('0x3d')](_0x49a247[_0xe96b('0x3a')],{'$or':_['map'](_0x49a247['attributes'],function(_0xed5a5d){var _0x23c867={};_0x23c867[_0xed5a5d]={'$like':'%'+_0x4dfe5f[_0xe96b('0x31')]['filter']+'%'};return _0x23c867;})});}_0x49a247=_[_0xe96b('0x3d')]({},_0x49a247,_0x4dfe5f[_0xe96b('0x3f')]);return _0x20499b['getAgents'](_0x49a247);}})[_0xe96b('0x28')](function(_0x3e01f8){if(_0x3e01f8){_0x5cb223=_0x3e01f8[_0xe96b('0x48')];if(!_0x4dfe5f[_0xe96b('0x31')][_0xe96b('0x64')](_0xe96b('0x37'))){_0x49a247['limit']=qs[_0xe96b('0x1f')](_0x4dfe5f['query']['limit']);_0x49a247[_0xe96b('0x22')]=qs[_0xe96b('0x22')](_0x4dfe5f[_0xe96b('0x31')][_0xe96b('0x22')]);}return _0x20499b['getAgents'](_0x49a247);}})[_0xe96b('0x28')](function(_0x533b17){if(_0x533b17){return _0x533b17?{'count':_0x5cb223,'rows':_0x533b17}:null;}})[_0xe96b('0x28')](respondWithResult(_0x481a13,null))[_0xe96b('0x44')](handleError(_0x481a13,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 789d720..8685a06 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 _0x0355=['hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x792ccf,_0x350d69){var _0xe77e39=function(_0x1fa3fc){while(--_0x1fa3fc){_0x792ccf['push'](_0x792ccf['shift']());}};_0xe77e39(++_0x350d69);}(_0x0355,0xb6));var _0x5035=function(_0x3c9f8f,_0x52fbe9){_0x3c9f8f=_0x3c9f8f-0x0;var _0x1dbbca=_0x0355[_0x3c9f8f];return _0x1dbbca;};'use strict';var EventEmitter=require(_0x5035('0x0'));var SmsQueue=require(_0x5035('0x1'))['db'][_0x5035('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5035('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5035('0x4'),'afterDestroy':_0x5035('0x5')};function emitEvent(_0x300789){return function(_0xcef2a,_0x48765b,_0x48a7f5){SmsQueueEvents['emit'](_0x300789+':'+_0xcef2a['id'],_0xcef2a);SmsQueueEvents[_0x5035('0x6')](_0x300789,_0xcef2a);_0x48a7f5(null);};}for(var e in events){if(events[_0x5035('0x7')](e)){var event=events[e];SmsQueue[_0x5035('0x8')](e,emitEvent(event));}}module[_0x5035('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x3445=['events','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x29e72b,_0x1c04c3){var _0x5ce4d6=function(_0x15b13d){while(--_0x15b13d){_0x29e72b['push'](_0x29e72b['shift']());}};_0x5ce4d6(++_0x1c04c3);}(_0x3445,0xc4));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5344('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x5344('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5344('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5344('0x3'),'afterDestroy':_0x5344('0x4')};function emitEvent(_0x471f2e){return function(_0x30acaf,_0x424259,_0x3f7b87){SmsQueueEvents[_0x5344('0x5')](_0x471f2e+':'+_0x30acaf['id'],_0x30acaf);SmsQueueEvents[_0x5344('0x5')](_0x471f2e,_0x30acaf);_0x3f7b87(null);};}for(var e in events){if(events[_0x5344('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 3b26673..c9d2700 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 _0x309a=['api','moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger'];(function(_0x129d38,_0x33eb62){var _0x1e7227=function(_0x44f024){while(--_0x44f024){_0x129d38['push'](_0x129d38['shift']());}};_0x1e7227(++_0x33eb62);}(_0x309a,0x65));var _0xa309=function(_0xb09ae2,_0x5da819){_0xb09ae2=_0xb09ae2-0x0;var _0x3706c9=_0x309a[_0xb09ae2];return _0x3706c9;};'use strict';var _=require(_0xa309('0x0'));var util=require(_0xa309('0x1'));var logger=require(_0xa309('0x2'))(_0xa309('0x3'));var moment=require(_0xa309('0x4'));var BPromise=require(_0xa309('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa309('0x6'));var rimraf=require(_0xa309('0x7'));var config=require(_0xa309('0x8'));var attributes=require(_0xa309('0x9'));module[_0xa309('0xa')]=function(_0x3427db,_0x18318a){return _0x3427db[_0xa309('0xb')]('SmsQueue',attributes,{'tableName':_0xa309('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x591f=['sms_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x32e264,_0x41cee8){var _0x1d7175=function(_0x5913d9){while(--_0x5913d9){_0x32e264['push'](_0x32e264['shift']());}};_0x1d7175(++_0x41cee8);}(_0x591f,0x1a1));var _0xf591=function(_0x571852,_0x34ae1f){_0x571852=_0x571852-0x0;var _0x1ec365=_0x591f[_0x571852];return _0x1ec365;};'use strict';var _=require(_0xf591('0x0'));var util=require(_0xf591('0x1'));var logger=require(_0xf591('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf591('0x3'));var rp=require(_0xf591('0x4'));var fs=require('fs');var path=require(_0xf591('0x5'));var rimraf=require(_0xf591('0x6'));var config=require(_0xf591('0x7'));var attributes=require(_0xf591('0x8'));module[_0xf591('0x9')]=function(_0x47ca05,_0x5d9491){return _0x47ca05[_0xf591('0xa')](_0xf591('0xb'),attributes,{'tableName':_0xf591('0xc'),'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 093d11c..f9ebbc2 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 _0x6179=['socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','debug','stringify','find','raw','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x6179,0xee));var _0x9617=function(_0x2f7c3c,_0x52b503){_0x2f7c3c=_0x2f7c3c-0x0;var _0x56ea57=_0x6179[_0x2f7c3c];return _0x56ea57;};'use strict';var _=require(_0x9617('0x0'));var util=require(_0x9617('0x1'));var moment=require(_0x9617('0x2'));var BPromise=require(_0x9617('0x3'));var rs=require(_0x9617('0x4'));var fs=require('fs');var Redis=require(_0x9617('0x5'));var db=require(_0x9617('0x6'))['db'];var utils=require(_0x9617('0x7'));var logger=require('../../config/logger')(_0x9617('0x8'));var config=require(_0x9617('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9617('0xa')][_0x9617('0xb')]({'port':0x232a});config[_0x9617('0xc')]=_['defaults'](config['redis'],{'host':_0x9617('0xd'),'port':0x18eb});var socket=require(_0x9617('0xe'))(new Redis(config['redis']));require(_0x9617('0xf'))['register'](socket);function respondWithRpcPromise(_0x3523d5,_0x2af880,_0x3b3cbc){return new BPromise(function(_0x715488,_0x1d5a13){return client[_0x9617('0x10')](_0x3523d5,_0x3b3cbc)[_0x9617('0x11')](function(_0x421eb1){logger[_0x9617('0x12')](_0x9617('0x13'),_0x2af880,_0x9617('0x14'));logger['debug'](_0x9617('0x15'),_0x2af880,_0x9617('0x14'),JSON['stringify'](_0x421eb1));if(_0x421eb1[_0x9617('0x16')]){if(_0x421eb1[_0x9617('0x16')][_0x9617('0x17')]===0x1f4){logger[_0x9617('0x16')](_0x9617('0x13'),_0x2af880,_0x421eb1['error'][_0x9617('0x18')]);return _0x1d5a13(_0x421eb1[_0x9617('0x16')][_0x9617('0x18')]);}logger[_0x9617('0x16')](_0x9617('0x13'),_0x2af880,_0x421eb1['error'][_0x9617('0x18')]);return _0x715488(_0x421eb1[_0x9617('0x16')]['message']);}else{logger[_0x9617('0x12')](_0x9617('0x13'),_0x2af880,_0x9617('0x14'));_0x715488(_0x421eb1[_0x9617('0x19')][_0x9617('0x18')]);}})[_0x9617('0x1a')](function(_0x3f6d66){logger[_0x9617('0x16')](_0x9617('0x13'),_0x2af880,_0x3f6d66);_0x1d5a13(_0x3f6d66);});});}exports[_0x9617('0x1b')]=function(_0x32b140){var _0x119a72=this;return new Promise(function(_0x267f28,_0x117e2a){return db[_0x9617('0x1c')][_0x9617('0x1d')]({'raw':_0x32b140['options']?_0x32b140[_0x9617('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x32b140[_0x9617('0x1e')]?_0x32b140[_0x9617('0x1e')][_0x9617('0x1f')]||null:null,'attributes':_0x32b140[_0x9617('0x1e')]?_0x32b140['options'][_0x9617('0x20')]||null:null,'limit':_0x32b140[_0x9617('0x1e')]?_0x32b140[_0x9617('0x1e')][_0x9617('0x21')]||null:null,'include':_0x32b140[_0x9617('0x1e')]?_0x32b140[_0x9617('0x1e')][_0x9617('0x22')]?_[_0x9617('0x23')](_0x32b140['options'][_0x9617('0x22')],function(_0x20245a){return{'model':db[_0x20245a[_0x9617('0x24')]],'as':_0x20245a['as'],'attributes':_0x20245a[_0x9617('0x20')],'include':_0x20245a[_0x9617('0x22')]?_[_0x9617('0x23')](_0x20245a[_0x9617('0x22')],function(_0x3b1720){return{'model':db[_0x3b1720[_0x9617('0x24')]],'as':_0x3b1720['as'],'attributes':_0x3b1720[_0x9617('0x20')],'include':_0x3b1720['include']?_[_0x9617('0x23')](_0x3b1720[_0x9617('0x22')],function(_0x5c2ab7){return{'model':db[_0x5c2ab7[_0x9617('0x24')]],'as':_0x5c2ab7['as'],'attributes':_0x5c2ab7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c9df2){logger[_0x9617('0x12')](_0x9617('0x1b'),_0x32b140);logger[_0x9617('0x25')](_0x9617('0x1b'),_0x32b140,JSON[_0x9617('0x26')](_0x3c9df2));_0x267f28(_0x3c9df2);})[_0x9617('0x1a')](function(_0x426df8){logger['error'](_0x9617('0x1b'),_0x426df8[_0x9617('0x18')],_0x32b140);_0x117e2a(_0x119a72[_0x9617('0x16')](0x1f4,_0x426df8[_0x9617('0x18')]));});});};exports['ShowSmsQueue']=function(_0x6fccc2){var _0x2f5ca7=this;return new Promise(function(_0x58a44d,_0x1a90bc){return db[_0x9617('0x1c')][_0x9617('0x27')]({'raw':_0x6fccc2[_0x9617('0x1e')]?_0x6fccc2[_0x9617('0x1e')][_0x9617('0x28')]===undefined?!![]:![]:!![],'where':_0x6fccc2[_0x9617('0x1e')]?_0x6fccc2['options']['where']||null:null,'attributes':_0x6fccc2[_0x9617('0x1e')]?_0x6fccc2[_0x9617('0x1e')][_0x9617('0x20')]||null:null,'include':_0x6fccc2['options']?_0x6fccc2[_0x9617('0x1e')][_0x9617('0x22')]?_[_0x9617('0x23')](_0x6fccc2[_0x9617('0x1e')]['include'],function(_0x37e552){return{'model':db[_0x37e552['model']],'as':_0x37e552['as'],'attributes':_0x37e552['attributes'],'include':_0x37e552[_0x9617('0x22')]?_['map'](_0x37e552[_0x9617('0x22')],function(_0xd330b8){return{'model':db[_0xd330b8['model']],'as':_0xd330b8['as'],'attributes':_0xd330b8[_0x9617('0x20')],'include':_0xd330b8[_0x9617('0x22')]?_['map'](_0xd330b8[_0x9617('0x22')],function(_0x2f1ae3){return{'model':db[_0x2f1ae3[_0x9617('0x24')]],'as':_0x2f1ae3['as'],'attributes':_0x2f1ae3[_0x9617('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9617('0x11')](function(_0x3e1196){logger[_0x9617('0x12')](_0x9617('0x29'),_0x6fccc2);logger[_0x9617('0x25')](_0x9617('0x29'),_0x6fccc2,JSON['stringify'](_0x3e1196));_0x58a44d(_0x3e1196);})[_0x9617('0x1a')](function(_0xc44b65){logger[_0x9617('0x16')](_0x9617('0x29'),_0xc44b65[_0x9617('0x18')],_0x6fccc2);_0x1a90bc(_0x2f5ca7['error'](0x1f4,_0xc44b65[_0x9617('0x18')]));});});}; \ No newline at end of file +var _0x6fd5=['ShowSmsQueue','find','raw','where','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','attributes','limit','include','map','model','debug'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x6fd5,0xa0));var _0x56fd=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6fd5[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x56fd('0x0'));var moment=require(_0x56fd('0x1'));var BPromise=require(_0x56fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x56fd('0x4'))(_0x56fd('0x5'));var config=require('../../config/environment');var jayson=require(_0x56fd('0x6'));var client=jayson[_0x56fd('0x7')][_0x56fd('0x8')]({'port':0x232a});config[_0x56fd('0x9')]=_[_0x56fd('0xa')](config[_0x56fd('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x56fd('0xb'))(new Redis(config[_0x56fd('0x9')]));require(_0x56fd('0xc'))[_0x56fd('0xd')](socket);function respondWithRpcPromise(_0x14a95b,_0x1b1487,_0x284dd6){return new BPromise(function(_0x842644,_0x3e3955){return client[_0x56fd('0xe')](_0x14a95b,_0x284dd6)[_0x56fd('0xf')](function(_0x2ea152){logger[_0x56fd('0x10')](_0x56fd('0x11'),_0x1b1487,_0x56fd('0x12'));logger['debug'](_0x56fd('0x13'),_0x1b1487,'request\x20sent',JSON[_0x56fd('0x14')](_0x2ea152));if(_0x2ea152[_0x56fd('0x15')]){if(_0x2ea152[_0x56fd('0x15')][_0x56fd('0x16')]===0x1f4){logger[_0x56fd('0x15')]('SmsQueue,\x20%s,\x20%s',_0x1b1487,_0x2ea152[_0x56fd('0x15')]['message']);return _0x3e3955(_0x2ea152['error'][_0x56fd('0x17')]);}logger[_0x56fd('0x15')](_0x56fd('0x11'),_0x1b1487,_0x2ea152[_0x56fd('0x15')][_0x56fd('0x17')]);return _0x842644(_0x2ea152[_0x56fd('0x15')][_0x56fd('0x17')]);}else{logger[_0x56fd('0x10')](_0x56fd('0x11'),_0x1b1487,'request\x20sent');_0x842644(_0x2ea152[_0x56fd('0x18')][_0x56fd('0x17')]);}})[_0x56fd('0x19')](function(_0x28fdc2){logger[_0x56fd('0x15')](_0x56fd('0x11'),_0x1b1487,_0x28fdc2);_0x3e3955(_0x28fdc2);});});}exports[_0x56fd('0x1a')]=function(_0xd86d3c){var _0x3562e2=this;return new Promise(function(_0x3a8cec,_0x272b5e){return db[_0x56fd('0x1b')]['findAll']({'raw':_0xd86d3c[_0x56fd('0x1c')]?_0xd86d3c[_0x56fd('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd86d3c[_0x56fd('0x1c')]?_0xd86d3c['options']['where']||null:null,'attributes':_0xd86d3c[_0x56fd('0x1c')]?_0xd86d3c['options'][_0x56fd('0x1d')]||null:null,'limit':_0xd86d3c[_0x56fd('0x1c')]?_0xd86d3c[_0x56fd('0x1c')][_0x56fd('0x1e')]||null:null,'include':_0xd86d3c[_0x56fd('0x1c')]?_0xd86d3c[_0x56fd('0x1c')][_0x56fd('0x1f')]?_[_0x56fd('0x20')](_0xd86d3c[_0x56fd('0x1c')][_0x56fd('0x1f')],function(_0x203f62){return{'model':db[_0x203f62['model']],'as':_0x203f62['as'],'attributes':_0x203f62[_0x56fd('0x1d')],'include':_0x203f62[_0x56fd('0x1f')]?_[_0x56fd('0x20')](_0x203f62[_0x56fd('0x1f')],function(_0x81f70c){return{'model':db[_0x81f70c[_0x56fd('0x21')]],'as':_0x81f70c['as'],'attributes':_0x81f70c[_0x56fd('0x1d')],'include':_0x81f70c['include']?_['map'](_0x81f70c[_0x56fd('0x1f')],function(_0x56b131){return{'model':db[_0x56b131[_0x56fd('0x21')]],'as':_0x56b131['as'],'attributes':_0x56b131[_0x56fd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56fd('0xf')](function(_0x81681c){logger[_0x56fd('0x10')]('GetSmsQueue',_0xd86d3c);logger[_0x56fd('0x22')]('GetSmsQueue',_0xd86d3c,JSON[_0x56fd('0x14')](_0x81681c));_0x3a8cec(_0x81681c);})['catch'](function(_0x1d63bd){logger[_0x56fd('0x15')](_0x56fd('0x1a'),_0x1d63bd[_0x56fd('0x17')],_0xd86d3c);_0x272b5e(_0x3562e2['error'](0x1f4,_0x1d63bd['message']));});});};exports[_0x56fd('0x23')]=function(_0x18463c){var _0x46e124=this;return new Promise(function(_0x5918a7,_0x36ad6a){return db['SmsQueue'][_0x56fd('0x24')]({'raw':_0x18463c['options']?_0x18463c[_0x56fd('0x1c')][_0x56fd('0x25')]===undefined?!![]:![]:!![],'where':_0x18463c['options']?_0x18463c[_0x56fd('0x1c')][_0x56fd('0x26')]||null:null,'attributes':_0x18463c['options']?_0x18463c[_0x56fd('0x1c')]['attributes']||null:null,'include':_0x18463c[_0x56fd('0x1c')]?_0x18463c[_0x56fd('0x1c')]['include']?_['map'](_0x18463c[_0x56fd('0x1c')][_0x56fd('0x1f')],function(_0x43a856){return{'model':db[_0x43a856[_0x56fd('0x21')]],'as':_0x43a856['as'],'attributes':_0x43a856[_0x56fd('0x1d')],'include':_0x43a856['include']?_['map'](_0x43a856[_0x56fd('0x1f')],function(_0x112799){return{'model':db[_0x112799[_0x56fd('0x21')]],'as':_0x112799['as'],'attributes':_0x112799['attributes'],'include':_0x112799[_0x56fd('0x1f')]?_[_0x56fd('0x20')](_0x112799[_0x56fd('0x1f')],function(_0x476ae2){return{'model':db[_0x476ae2['model']],'as':_0x476ae2['as'],'attributes':_0x476ae2[_0x56fd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56fd('0xf')](function(_0x1bf5b5){logger[_0x56fd('0x10')](_0x56fd('0x23'),_0x18463c);logger['debug'](_0x56fd('0x23'),_0x18463c,JSON[_0x56fd('0x14')](_0x1bf5b5));_0x5918a7(_0x1bf5b5);})['catch'](function(_0x105bbd){logger['error'](_0x56fd('0x23'),_0x105bbd[_0x56fd('0x17')],_0x18463c);_0x36ad6a(_0x46e124[_0x56fd('0x15')](0x1f4,_0x105bbd[_0x56fd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2e1246b..dfcf6d3 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 _0x5527=['length','smsQueue:','save','remove','update','emit','register'];(function(_0x580ac3,_0x2d05ac){var _0x3e48be=function(_0x2ee32a){while(--_0x2ee32a){_0x580ac3['push'](_0x580ac3['shift']());}};_0x3e48be(++_0x2d05ac);}(_0x5527,0x1c9));var _0x7552=function(_0x185fae,_0x11dfbd){_0x185fae=_0x185fae-0x0;var _0x1085bd=_0x5527[_0x185fae];return _0x1085bd;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x7552('0x0'),_0x7552('0x1'),_0x7552('0x2')];function createListener(_0x5e36fe,_0x16f363){return function(_0x4f9f94){_0x16f363[_0x7552('0x3')](_0x5e36fe,_0x4f9f94);};}function removeListener(_0x28697d,_0x50f3a9){return function(){SmsQueueEvents['removeListener'](_0x28697d,_0x50f3a9);};}exports[_0x7552('0x4')]=function(_0x39b952){for(var _0x5b3907=0x0,_0x39923c=events[_0x7552('0x5')];_0x5b3907<_0x39923c;_0x5b3907++){var _0x1ff296=events[_0x5b3907];var _0x236f84=createListener(_0x7552('0x6')+_0x1ff296,_0x39b952);SmsQueueEvents['on'](_0x1ff296,_0x236f84);}}; \ No newline at end of file +var _0x79a0=['update','removeListener','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x4e55fb,_0x163c5a){var _0x5809d4=function(_0x104dc0){while(--_0x104dc0){_0x4e55fb['push'](_0x4e55fb['shift']());}};_0x5809d4(++_0x163c5a);}(_0x79a0,0x9e));var _0x079a=function(_0x238776,_0x86d6b3){_0x238776=_0x238776-0x0;var _0x5cc9f0=_0x79a0[_0x238776];return _0x5cc9f0;};'use strict';var SmsQueueEvents=require(_0x079a('0x0'));var events=[_0x079a('0x1'),_0x079a('0x2'),_0x079a('0x3')];function createListener(_0x2e8eab,_0xa5c675){return function(_0x4f68a3){_0xa5c675['emit'](_0x2e8eab,_0x4f68a3);};}function removeListener(_0x42fac4,_0x1afd7f){return function(){SmsQueueEvents[_0x079a('0x4')](_0x42fac4,_0x1afd7f);};}exports['register']=function(_0x518ea8){for(var _0x1ce476=0x0,_0x13aee4=events[_0x079a('0x5')];_0x1ce476<_0x13aee4;_0x1ce476++){var _0x398ce9=events[_0x1ce476];var _0x33d077=createListener(_0x079a('0x6')+_0x398ce9,_0x518ea8);SmsQueueEvents['on'](_0x398ce9,_0x33d077);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 100edaa..de6a9bd 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 _0x291c=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','/describe','describe','get','show','post','create','put'];(function(_0x40c8ab,_0x3a06e9){var _0x29299e=function(_0xdfc3c6){while(--_0xdfc3c6){_0x40c8ab['push'](_0x40c8ab['shift']());}};_0x29299e(++_0x3a06e9);}(_0x291c,0x137));var _0xc291=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x291c[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var path=require(_0xc291('0x2'));var timeout=require(_0xc291('0x3'));var express=require(_0xc291('0x4'));var router=express[_0xc291('0x5')]();var fs_extra=require(_0xc291('0x6'));var auth=require(_0xc291('0x7'));var interaction=require(_0xc291('0x8'));var config=require(_0xc291('0x9'));var controller=require(_0xc291('0xa'));router['get']('/',auth[_0xc291('0xb')](),controller['index']);router['get'](_0xc291('0xc'),auth[_0xc291('0xb')](),controller[_0xc291('0xd')]);router[_0xc291('0xe')]('/:id',auth[_0xc291('0xb')](),controller[_0xc291('0xf')]);router[_0xc291('0x10')]('/',auth[_0xc291('0xb')](),controller[_0xc291('0x11')]);router[_0xc291('0x12')](_0xc291('0x13'),auth[_0xc291('0xb')](),controller['update']);router['delete']('/:id',auth[_0xc291('0xb')](),controller[_0xc291('0x14')]);module[_0xc291('0x15')]=router; \ No newline at end of file +var _0xc431=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x58268b,_0x3b98f7){var _0x277d5a=function(_0x13fa36){while(--_0x13fa36){_0x58268b['push'](_0x58268b['shift']());}};_0x277d5a(++_0x3b98f7);}(_0xc431,0x15c));var _0x1c43=function(_0x4d5b0e,_0x1deaa6){_0x4d5b0e=_0x4d5b0e-0x0;var _0x336622=_0xc431[_0x4d5b0e];return _0x336622;};'use strict';var multer=require(_0x1c43('0x0'));var util=require(_0x1c43('0x1'));var path=require(_0x1c43('0x2'));var timeout=require(_0x1c43('0x3'));var express=require('express');var router=express[_0x1c43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1c43('0x5'));var interaction=require(_0x1c43('0x6'));var config=require(_0x1c43('0x7'));var controller=require('./smsQueueReport.controller');router[_0x1c43('0x8')]('/',auth[_0x1c43('0x9')](),controller[_0x1c43('0xa')]);router[_0x1c43('0x8')](_0x1c43('0xb'),auth[_0x1c43('0x9')](),controller['describe']);router[_0x1c43('0x8')](_0x1c43('0xc'),auth[_0x1c43('0x9')](),controller[_0x1c43('0xd')]);router['post']('/',auth[_0x1c43('0x9')](),controller[_0x1c43('0xe')]);router[_0x1c43('0xf')](_0x1c43('0xc'),auth[_0x1c43('0x9')](),controller[_0x1c43('0x10')]);router[_0x1c43('0x11')]('/:id',auth[_0x1c43('0x9')](),controller[_0x1c43('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 695fd83..b22788a 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 _0xd8fb=['exports','STRING','DATE','moment','sequelize'];(function(_0x1cdbb4,_0x2ee8bc){var _0x105f85=function(_0x4969d4){while(--_0x4969d4){_0x1cdbb4['push'](_0x1cdbb4['shift']());}};_0x105f85(++_0x2ee8bc);}(_0xd8fb,0x99));var _0xbd8f=function(_0x79b7bd,_0x5dae1e){_0x79b7bd=_0x79b7bd-0x0;var _0x5cb0e9=_0xd8fb[_0x79b7bd];return _0x5cb0e9;};'use strict';var moment=require(_0xbd8f('0x0'));var Sequelize=require(_0xbd8f('0x1'));module[_0xbd8f('0x2')]={'uniqueid':{'type':Sequelize[_0xbd8f('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbd8f('0x4')]},'exitAt':{'type':Sequelize[_0xbd8f('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd17b=['exports','STRING','DATE','moment','sequelize'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xd17b,0x16b));var _0xbd17=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xd17b[_0x4cfc1d];return _0x1c01a0;};'use strict';var moment=require(_0xbd17('0x0'));var Sequelize=require(_0xbd17('0x1'));module[_0xbd17('0x2')]={'uniqueid':{'type':Sequelize[_0xbd17('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbd17('0x3')]},'joinAt':{'type':Sequelize[_0xbd17('0x4')]},'leaveAt':{'type':Sequelize[_0xbd17('0x4')]},'acceptAt':{'type':Sequelize[_0xbd17('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbd17('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5dd0d61..188ebe0 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 _0xf3b4=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','VIRTUAL','merge','findAll','catch','show','includeAll','include','options','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x406916,_0x28796f){var _0x844fee=function(_0x4e199a){while(--_0x4e199a){_0x406916['push'](_0x406916['shift']());}};_0x844fee(++_0x28796f);}(_0xf3b4,0x15d));var _0x4f3b=function(_0x396d5d,_0x4055e3){_0x396d5d=_0x396d5d-0x0;var _0x505254=_0xf3b4[_0x396d5d];return _0x505254;};'use strict';var emlformat=require(_0x4f3b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f3b('0x1'));var jsonpatch=require(_0x4f3b('0x2'));var rp=require(_0x4f3b('0x3'));var moment=require(_0x4f3b('0x4'));var BPromise=require(_0x4f3b('0x5'));var Mustache=require('mustache');var util=require(_0x4f3b('0x6'));var path=require(_0x4f3b('0x7'));var sox=require(_0x4f3b('0x8'));var csv=require(_0x4f3b('0x9'));var ejs=require(_0x4f3b('0xa'));var fs=require('fs');var fs_extra=require(_0x4f3b('0xb'));var _=require('lodash');var squel=require(_0x4f3b('0xc'));var crypto=require(_0x4f3b('0xd'));var jsforce=require(_0x4f3b('0xe'));var deskjs=require(_0x4f3b('0xf'));var toCsv=require(_0x4f3b('0x9'));var querystring=require(_0x4f3b('0x10'));var Papa=require(_0x4f3b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4f3b('0x12'));var as=require(_0x4f3b('0x13'));var hardwareService=require(_0x4f3b('0x14'));var logger=require(_0x4f3b('0x15'))('api');var utils=require(_0x4f3b('0x16'));var config=require(_0x4f3b('0x17'));var licenseUtil=require(_0x4f3b('0x18'));var db=require(_0x4f3b('0x19'))['db'];function respondWithStatusCode(_0x51462e,_0x4dd210){_0x4dd210=_0x4dd210||0xcc;return function(_0x36bf62){if(_0x36bf62){return _0x51462e[_0x4f3b('0x1a')](_0x4dd210);}return _0x51462e['status'](_0x4dd210)[_0x4f3b('0x1b')]();};}function respondWithResult(_0x4384bf,_0x2f6c66){_0x2f6c66=_0x2f6c66||0xc8;return function(_0xa9178a){if(_0xa9178a){return _0x4384bf[_0x4f3b('0x1c')](_0x2f6c66)[_0x4f3b('0x1d')](_0xa9178a);}};}function respondWithFilteredResult(_0x1b2e9c,_0x3dfedf){return function(_0x5771c1){if(_0x5771c1){var _0x413905=typeof _0x3dfedf[_0x4f3b('0x1e')]===_0x4f3b('0x1f')&&typeof _0x3dfedf[_0x4f3b('0x20')]===_0x4f3b('0x1f');var _0x1311d3=_0x5771c1['count'];var _0x13fc3b=_0x413905?0x0:_0x3dfedf[_0x4f3b('0x1e')];var _0x571a80=_0x413905?_0x5771c1[_0x4f3b('0x21')]:_0x3dfedf[_0x4f3b('0x1e')]+_0x3dfedf[_0x4f3b('0x20')];var _0x3d6b77;if(_0x571a80>=_0x1311d3){_0x571a80=_0x1311d3;_0x3d6b77=0xc8;}else{_0x3d6b77=0xce;}_0x1b2e9c['status'](_0x3d6b77);return _0x1b2e9c['set']('Content-Range',_0x13fc3b+'-'+_0x571a80+'/'+_0x1311d3)['json'](_0x5771c1);}return null;};}function patchUpdates(_0x4b7a0c){return function(_0x52708c){try{jsonpatch[_0x4f3b('0x22')](_0x52708c,_0x4b7a0c,!![]);}catch(_0x4c9d80){return BPromise[_0x4f3b('0x23')](_0x4c9d80);}return _0x52708c[_0x4f3b('0x24')]();};}function saveUpdates(_0x2965c9,_0xb96070){return function(_0x466dd7){if(_0x466dd7){return _0x466dd7[_0x4f3b('0x25')](_0x2965c9)[_0x4f3b('0x26')](function(_0x371862){return _0x371862;});}return null;};}function removeEntity(_0x5ee728,_0x160dcd){return function(_0x5ec361){if(_0x5ec361){return _0x5ec361[_0x4f3b('0x27')]()[_0x4f3b('0x26')](function(){_0x5ee728[_0x4f3b('0x1c')](0xcc)[_0x4f3b('0x1b')]();});}};}function handleEntityNotFound(_0x47bbe2,_0x4efa1e){return function(_0x122b01){if(!_0x122b01){_0x47bbe2[_0x4f3b('0x1a')](0x194);}return _0x122b01;};}function handleError(_0x1c38ae,_0x28a91b){_0x28a91b=_0x28a91b||0x1f4;return function(_0x572b9e){logger['error'](_0x572b9e[_0x4f3b('0x28')]);if(_0x572b9e['name']){delete _0x572b9e[_0x4f3b('0x29')];}_0x1c38ae[_0x4f3b('0x1c')](_0x28a91b)['send'](_0x572b9e);};}exports[_0x4f3b('0x2a')]=function(_0x4b34be,_0x23d690){var _0x6fdd3c={},_0x3cd2d9={},_0x4d93f0={'count':0x0,'rows':[]};var _0x109c15=_['map'](db[_0x4f3b('0x2b')][_0x4f3b('0x2c')],function(_0x38bee3){return{'name':_0x38bee3[_0x4f3b('0x2d')],'type':_0x38bee3[_0x4f3b('0x2e')][_0x4f3b('0x2f')]};});_0x3cd2d9[_0x4f3b('0x30')]=_[_0x4f3b('0x31')](_0x109c15,_0x4f3b('0x29'));_0x3cd2d9[_0x4f3b('0x32')]=_[_0x4f3b('0x33')](_0x4b34be[_0x4f3b('0x32')]);_0x3cd2d9[_0x4f3b('0x34')]=_[_0x4f3b('0x35')](_0x3cd2d9[_0x4f3b('0x30')],_0x3cd2d9[_0x4f3b('0x32')]);_0x6fdd3c[_0x4f3b('0x36')]=_['intersection'](_0x3cd2d9[_0x4f3b('0x30')],qs[_0x4f3b('0x37')](_0x4b34be[_0x4f3b('0x32')][_0x4f3b('0x37')]));_0x6fdd3c['attributes']=_0x6fdd3c['attributes'][_0x4f3b('0x38')]?_0x6fdd3c['attributes']:_0x3cd2d9[_0x4f3b('0x30')];if(!_0x4b34be[_0x4f3b('0x32')][_0x4f3b('0x39')](_0x4f3b('0x3a'))){_0x6fdd3c[_0x4f3b('0x20')]=qs[_0x4f3b('0x20')](_0x4b34be['query'][_0x4f3b('0x20')]);_0x6fdd3c['offset']=qs[_0x4f3b('0x1e')](_0x4b34be[_0x4f3b('0x32')][_0x4f3b('0x1e')]);}_0x6fdd3c['order']=qs['sort'](_0x4b34be[_0x4f3b('0x32')]['sort']);_0x6fdd3c['where']=qs[_0x4f3b('0x34')](_[_0x4f3b('0x3b')](_0x4b34be['query'],_0x3cd2d9['filters']),_0x109c15);if(_0x4b34be['query'][_0x4f3b('0x3c')]){_0x6fdd3c[_0x4f3b('0x3d')]=_['merge'](_0x6fdd3c[_0x4f3b('0x3d')],{'$or':_[_0x4f3b('0x31')](_0x109c15,function(_0x1905a8){if(_0x1905a8[_0x4f3b('0x2e')]!==_0x4f3b('0x3e')){var _0x18e8aa={};_0x18e8aa[_0x1905a8['name']]={'$like':'%'+_0x4b34be[_0x4f3b('0x32')][_0x4f3b('0x3c')]+'%'};return _0x18e8aa;}})});}_0x6fdd3c=_[_0x4f3b('0x3f')]({},_0x6fdd3c,_0x4b34be['options']);var _0x167bbc={'where':_0x6fdd3c[_0x4f3b('0x3d')]};return db['SmsQueueReport'][_0x4f3b('0x21')](_0x167bbc)[_0x4f3b('0x26')](function(_0x3ba876){_0x4d93f0[_0x4f3b('0x21')]=_0x3ba876;if(_0x4b34be[_0x4f3b('0x32')]['includeAll']){_0x6fdd3c['include']=[{'all':!![]}];}return db[_0x4f3b('0x2b')][_0x4f3b('0x40')](_0x6fdd3c);})['then'](function(_0x1b441d){_0x4d93f0['rows']=_0x1b441d;return _0x4d93f0;})[_0x4f3b('0x26')](respondWithFilteredResult(_0x23d690,_0x6fdd3c))[_0x4f3b('0x41')](handleError(_0x23d690,null));};exports[_0x4f3b('0x42')]=function(_0x42bc46,_0x105b62){var _0x3752ec={'raw':!![],'where':{'id':_0x42bc46['params']['id']}},_0x2d0730={};_0x2d0730[_0x4f3b('0x30')]=_[_0x4f3b('0x33')](db['SmsQueueReport'][_0x4f3b('0x2c')]);_0x2d0730['query']=_[_0x4f3b('0x33')](_0x42bc46[_0x4f3b('0x32')]);_0x2d0730['filters']=_[_0x4f3b('0x35')](_0x2d0730[_0x4f3b('0x30')],_0x2d0730['query']);_0x3752ec[_0x4f3b('0x36')]=_[_0x4f3b('0x35')](_0x2d0730['model'],qs[_0x4f3b('0x37')](_0x42bc46[_0x4f3b('0x32')][_0x4f3b('0x37')]));_0x3752ec[_0x4f3b('0x36')]=_0x3752ec[_0x4f3b('0x36')][_0x4f3b('0x38')]?_0x3752ec[_0x4f3b('0x36')]:_0x2d0730[_0x4f3b('0x30')];if(_0x42bc46[_0x4f3b('0x32')][_0x4f3b('0x43')]){_0x3752ec[_0x4f3b('0x44')]=[{'all':!![]}];}_0x3752ec=_['merge']({},_0x3752ec,_0x42bc46[_0x4f3b('0x45')]);return db[_0x4f3b('0x2b')][_0x4f3b('0x46')](_0x3752ec)[_0x4f3b('0x26')](handleEntityNotFound(_0x105b62,null))[_0x4f3b('0x26')](respondWithResult(_0x105b62,null))[_0x4f3b('0x41')](handleError(_0x105b62,null));};exports['create']=function(_0x5ea965,_0x4a1052){return db[_0x4f3b('0x2b')]['create'](_0x5ea965[_0x4f3b('0x47')],{})[_0x4f3b('0x26')](respondWithResult(_0x4a1052,0xc9))['catch'](handleError(_0x4a1052,null));};exports['update']=function(_0x53bae5,_0x16135b){if(_0x53bae5['body']['id']){delete _0x53bae5['body']['id'];}return db[_0x4f3b('0x2b')][_0x4f3b('0x46')]({'where':{'id':_0x53bae5[_0x4f3b('0x48')]['id']}})[_0x4f3b('0x26')](handleEntityNotFound(_0x16135b,null))[_0x4f3b('0x26')](saveUpdates(_0x53bae5['body'],null))[_0x4f3b('0x26')](respondWithResult(_0x16135b,null))[_0x4f3b('0x41')](handleError(_0x16135b,null));};exports['destroy']=function(_0x3d7d47,_0x490883){return db[_0x4f3b('0x2b')][_0x4f3b('0x46')]({'where':{'id':_0x3d7d47['params']['id']}})[_0x4f3b('0x26')](handleEntityNotFound(_0x490883,null))[_0x4f3b('0x26')](removeEntity(_0x490883,null))[_0x4f3b('0x41')](handleError(_0x490883,null));};exports[_0x4f3b('0x49')]=function(_0x2ae5f2,_0x48425a){return db['SmsQueueReport']['describe']()[_0x4f3b('0x26')](respondWithResult(_0x48425a,null))[_0x4f3b('0x41')](handleError(_0x48425a,null));}; \ No newline at end of file +var _0x8628=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','SmsQueueReport','includeAll','include','catch','show','params','length','find','create','body','describe','eml-format','rimraf','request-promise','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x179169,_0x498ebd){var _0x5a576d=function(_0x3856a0){while(--_0x3856a0){_0x179169['push'](_0x179169['shift']());}};_0x5a576d(++_0x498ebd);}(_0x8628,0x160));var _0x8862=function(_0x2335bd,_0x54e892){_0x2335bd=_0x2335bd-0x0;var _0x2aac2c=_0x8628[_0x2335bd];return _0x2aac2c;};'use strict';var emlformat=require(_0x8862('0x0'));var rimraf=require(_0x8862('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8862('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8862('0x3'));var csv=require(_0x8862('0x4'));var ejs=require(_0x8862('0x5'));var fs=require('fs');var fs_extra=require(_0x8862('0x6'));var _=require(_0x8862('0x7'));var squel=require(_0x8862('0x8'));var crypto=require(_0x8862('0x9'));var jsforce=require(_0x8862('0xa'));var deskjs=require(_0x8862('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8862('0xc'));var Papa=require(_0x8862('0xd'));var Redis=require(_0x8862('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8862('0xf'));var as=require(_0x8862('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8862('0x11'));var utils=require(_0x8862('0x12'));var config=require(_0x8862('0x13'));var licenseUtil=require(_0x8862('0x14'));var db=require(_0x8862('0x15'))['db'];function respondWithStatusCode(_0x1256d8,_0x45dffa){_0x45dffa=_0x45dffa||0xcc;return function(_0x32e843){if(_0x32e843){return _0x1256d8[_0x8862('0x16')](_0x45dffa);}return _0x1256d8[_0x8862('0x17')](_0x45dffa)[_0x8862('0x18')]();};}function respondWithResult(_0x1f9c30,_0x35fe5a){_0x35fe5a=_0x35fe5a||0xc8;return function(_0x2328b8){if(_0x2328b8){return _0x1f9c30[_0x8862('0x17')](_0x35fe5a)[_0x8862('0x19')](_0x2328b8);}};}function respondWithFilteredResult(_0x4dd764,_0x1ac4a8){return function(_0x34f48d){if(_0x34f48d){var _0x5509a5=typeof _0x1ac4a8['offset']===_0x8862('0x1a')&&typeof _0x1ac4a8['limit']===_0x8862('0x1a');var _0x1dd069=_0x34f48d[_0x8862('0x1b')];var _0x5eb10e=_0x5509a5?0x0:_0x1ac4a8[_0x8862('0x1c')];var _0x3afc28=_0x5509a5?_0x34f48d[_0x8862('0x1b')]:_0x1ac4a8[_0x8862('0x1c')]+_0x1ac4a8['limit'];var _0x55f94a;if(_0x3afc28>=_0x1dd069){_0x3afc28=_0x1dd069;_0x55f94a=0xc8;}else{_0x55f94a=0xce;}_0x4dd764[_0x8862('0x17')](_0x55f94a);return _0x4dd764[_0x8862('0x1d')]('Content-Range',_0x5eb10e+'-'+_0x3afc28+'/'+_0x1dd069)['json'](_0x34f48d);}return null;};}function patchUpdates(_0x329ccd){return function(_0x3be043){try{jsonpatch[_0x8862('0x1e')](_0x3be043,_0x329ccd,!![]);}catch(_0x44b5a2){return BPromise['reject'](_0x44b5a2);}return _0x3be043[_0x8862('0x1f')]();};}function saveUpdates(_0x5b34de,_0x568132){return function(_0x5702de){if(_0x5702de){return _0x5702de[_0x8862('0x20')](_0x5b34de)[_0x8862('0x21')](function(_0xf3d430){return _0xf3d430;});}return null;};}function removeEntity(_0x51c89d,_0x364ddb){return function(_0x5bd46f){if(_0x5bd46f){return _0x5bd46f[_0x8862('0x22')]()[_0x8862('0x21')](function(){_0x51c89d['status'](0xcc)[_0x8862('0x18')]();});}};}function handleEntityNotFound(_0x34f321,_0xbb6115){return function(_0x4e5049){if(!_0x4e5049){_0x34f321['sendStatus'](0x194);}return _0x4e5049;};}function handleError(_0x38f2b6,_0xde7ad5){_0xde7ad5=_0xde7ad5||0x1f4;return function(_0x34fdf6){logger[_0x8862('0x23')](_0x34fdf6[_0x8862('0x24')]);if(_0x34fdf6['name']){delete _0x34fdf6[_0x8862('0x25')];}_0x38f2b6[_0x8862('0x17')](_0xde7ad5)[_0x8862('0x26')](_0x34fdf6);};}exports[_0x8862('0x27')]=function(_0x5f2a8a,_0x2b9eb9){var _0x2a4fec={},_0x187c75={},_0x27279d={'count':0x0,'rows':[]};var _0x24c8d3=_['map'](db['SmsQueueReport'][_0x8862('0x28')],function(_0x5141b2){return{'name':_0x5141b2[_0x8862('0x29')],'type':_0x5141b2[_0x8862('0x2a')][_0x8862('0x2b')]};});_0x187c75[_0x8862('0x2c')]=_[_0x8862('0x2d')](_0x24c8d3,'name');_0x187c75[_0x8862('0x2e')]=_[_0x8862('0x2f')](_0x5f2a8a[_0x8862('0x2e')]);_0x187c75[_0x8862('0x30')]=_[_0x8862('0x31')](_0x187c75[_0x8862('0x2c')],_0x187c75[_0x8862('0x2e')]);_0x2a4fec[_0x8862('0x32')]=_[_0x8862('0x31')](_0x187c75[_0x8862('0x2c')],qs['fields'](_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x33')]));_0x2a4fec[_0x8862('0x32')]=_0x2a4fec['attributes']['length']?_0x2a4fec[_0x8862('0x32')]:_0x187c75['model'];if(!_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x34')](_0x8862('0x35'))){_0x2a4fec['limit']=qs[_0x8862('0x36')](_0x5f2a8a['query'][_0x8862('0x36')]);_0x2a4fec['offset']=qs[_0x8862('0x1c')](_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x1c')]);}_0x2a4fec['order']=qs[_0x8862('0x37')](_0x5f2a8a[_0x8862('0x2e')]['sort']);_0x2a4fec[_0x8862('0x38')]=qs[_0x8862('0x30')](_[_0x8862('0x39')](_0x5f2a8a[_0x8862('0x2e')],_0x187c75['filters']),_0x24c8d3);if(_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x3a')]){_0x2a4fec[_0x8862('0x38')]=_[_0x8862('0x3b')](_0x2a4fec[_0x8862('0x38')],{'$or':_[_0x8862('0x2d')](_0x24c8d3,function(_0x503205){if(_0x503205['type']!=='VIRTUAL'){var _0x54a4e9={};_0x54a4e9[_0x503205['name']]={'$like':'%'+_0x5f2a8a['query'][_0x8862('0x3a')]+'%'};return _0x54a4e9;}})});}_0x2a4fec=_['merge']({},_0x2a4fec,_0x5f2a8a[_0x8862('0x3c')]);var _0x4311c7={'where':_0x2a4fec[_0x8862('0x38')]};return db[_0x8862('0x3d')]['count'](_0x4311c7)[_0x8862('0x21')](function(_0x468244){_0x27279d['count']=_0x468244;if(_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x3e')]){_0x2a4fec[_0x8862('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x2a4fec);})['then'](function(_0x4473dc){_0x27279d['rows']=_0x4473dc;return _0x27279d;})[_0x8862('0x21')](respondWithFilteredResult(_0x2b9eb9,_0x2a4fec))[_0x8862('0x40')](handleError(_0x2b9eb9,null));};exports[_0x8862('0x41')]=function(_0x2a31a6,_0x4907f6){var _0x54a815={'raw':!![],'where':{'id':_0x2a31a6[_0x8862('0x42')]['id']}},_0x39ef18={};_0x39ef18[_0x8862('0x2c')]=_['keys'](db[_0x8862('0x3d')]['rawAttributes']);_0x39ef18[_0x8862('0x2e')]=_[_0x8862('0x2f')](_0x2a31a6[_0x8862('0x2e')]);_0x39ef18[_0x8862('0x30')]=_['intersection'](_0x39ef18[_0x8862('0x2c')],_0x39ef18[_0x8862('0x2e')]);_0x54a815[_0x8862('0x32')]=_[_0x8862('0x31')](_0x39ef18[_0x8862('0x2c')],qs[_0x8862('0x33')](_0x2a31a6['query']['fields']));_0x54a815[_0x8862('0x32')]=_0x54a815['attributes'][_0x8862('0x43')]?_0x54a815[_0x8862('0x32')]:_0x39ef18[_0x8862('0x2c')];if(_0x2a31a6['query'][_0x8862('0x3e')]){_0x54a815[_0x8862('0x3f')]=[{'all':!![]}];}_0x54a815=_[_0x8862('0x3b')]({},_0x54a815,_0x2a31a6['options']);return db[_0x8862('0x3d')][_0x8862('0x44')](_0x54a815)['then'](handleEntityNotFound(_0x4907f6,null))['then'](respondWithResult(_0x4907f6,null))[_0x8862('0x40')](handleError(_0x4907f6,null));};exports[_0x8862('0x45')]=function(_0x294c8e,_0xab96c){return db[_0x8862('0x3d')][_0x8862('0x45')](_0x294c8e[_0x8862('0x46')],{})['then'](respondWithResult(_0xab96c,0xc9))['catch'](handleError(_0xab96c,null));};exports[_0x8862('0x20')]=function(_0x2505e0,_0x332cce){if(_0x2505e0['body']['id']){delete _0x2505e0[_0x8862('0x46')]['id'];}return db[_0x8862('0x3d')][_0x8862('0x44')]({'where':{'id':_0x2505e0[_0x8862('0x42')]['id']}})['then'](handleEntityNotFound(_0x332cce,null))[_0x8862('0x21')](saveUpdates(_0x2505e0[_0x8862('0x46')],null))[_0x8862('0x21')](respondWithResult(_0x332cce,null))['catch'](handleError(_0x332cce,null));};exports[_0x8862('0x22')]=function(_0x22f3da,_0x460f61){return db[_0x8862('0x3d')][_0x8862('0x44')]({'where':{'id':_0x22f3da[_0x8862('0x42')]['id']}})[_0x8862('0x21')](handleEntityNotFound(_0x460f61,null))['then'](removeEntity(_0x460f61,null))['catch'](handleError(_0x460f61,null));};exports[_0x8862('0x47')]=function(_0x587006,_0x3e2679){return db[_0x8862('0x3d')][_0x8862('0x47')]()[_0x8862('0x21')](respondWithResult(_0x3e2679,null))['catch'](handleError(_0x3e2679,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9ed8ac4..6c98d39 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x39bcc2,_0x1ec475){var _0x34e716=function(_0x5ad69d){while(--_0x5ad69d){_0x39bcc2['push'](_0x39bcc2['shift']());}};_0x34e716(++_0x1ec475);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0xcb91[_0x5a7dd3];return _0x2f4d07;};'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 +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x27b3f9,_0x1be270){var _0x15f6fe=function(_0x1517a6){while(--_0x1517a6){_0x27b3f9['push'](_0x27b3f9['shift']());}};_0x15f6fe(++_0x1be270);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d34b99f..8b5c485 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 _0x9e0e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','raw','then','UpdateSmsQueueReport','update','where','attributes','limit'];(function(_0x4e67e3,_0x1ce625){var _0x14ba96=function(_0x54f61d){while(--_0x54f61d){_0x4e67e3['push'](_0x4e67e3['shift']());}};_0x14ba96(++_0x1ce625);}(_0x9e0e,0x1ba));var _0xe9e0=function(_0x2cc40b,_0x19dc74){_0x2cc40b=_0x2cc40b-0x0;var _0x1bd044=_0x9e0e[_0x2cc40b];return _0x1bd044;};'use strict';var _=require(_0xe9e0('0x0'));var util=require(_0xe9e0('0x1'));var moment=require(_0xe9e0('0x2'));var BPromise=require(_0xe9e0('0x3'));var rs=require(_0xe9e0('0x4'));var fs=require('fs');var Redis=require(_0xe9e0('0x5'));var db=require(_0xe9e0('0x6'))['db'];var utils=require(_0xe9e0('0x7'));var logger=require(_0xe9e0('0x8'))(_0xe9e0('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe9e0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1575f9,_0x3752f9,_0x5b6903){return new BPromise(function(_0x36e9d5,_0x39631b){return client[_0xe9e0('0xb')](_0x1575f9,_0x5b6903)['then'](function(_0x4546be){logger[_0xe9e0('0xc')](_0xe9e0('0xd'),_0x3752f9,_0xe9e0('0xe'));logger[_0xe9e0('0xf')](_0xe9e0('0x10'),_0x3752f9,'request\x20sent',JSON[_0xe9e0('0x11')](_0x4546be));if(_0x4546be[_0xe9e0('0x12')]){if(_0x4546be[_0xe9e0('0x12')][_0xe9e0('0x13')]===0x1f4){logger['error'](_0xe9e0('0xd'),_0x3752f9,_0x4546be[_0xe9e0('0x12')][_0xe9e0('0x14')]);return _0x39631b(_0x4546be[_0xe9e0('0x12')][_0xe9e0('0x14')]);}logger['error'](_0xe9e0('0xd'),_0x3752f9,_0x4546be[_0xe9e0('0x12')][_0xe9e0('0x14')]);return _0x36e9d5(_0x4546be['error'][_0xe9e0('0x14')]);}else{logger[_0xe9e0('0xc')](_0xe9e0('0xd'),_0x3752f9,_0xe9e0('0xe'));_0x36e9d5(_0x4546be[_0xe9e0('0x15')]['message']);}})[_0xe9e0('0x16')](function(_0x15dcae){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3752f9,_0x15dcae);_0x39631b(_0x15dcae);});});}exports[_0xe9e0('0x17')]=function(_0x4e204c){var _0x61039a=this;return new Promise(function(_0x432278,_0x4b0620){return db['SmsQueueReport'][_0xe9e0('0x18')](_0x4e204c[_0xe9e0('0x19')],{'raw':_0x4e204c[_0xe9e0('0x1a')]?_0x4e204c[_0xe9e0('0x1a')][_0xe9e0('0x1b')]===undefined?!![]:![]:!![]})[_0xe9e0('0x1c')](function(_0x2782d7){logger[_0xe9e0('0xc')](_0xe9e0('0x17'),_0x4e204c);logger[_0xe9e0('0xf')](_0xe9e0('0x17'),_0x4e204c,JSON[_0xe9e0('0x11')](_0x2782d7));_0x432278(_0x2782d7);})['catch'](function(_0x3847c8){logger[_0xe9e0('0x12')](_0xe9e0('0x17'),_0x3847c8[_0xe9e0('0x14')],_0x4e204c);_0x4b0620(_0x61039a[_0xe9e0('0x12')](0x1f4,_0x3847c8[_0xe9e0('0x14')]));});});};exports[_0xe9e0('0x1d')]=function(_0xb416f6){var _0x30ac4d=this;return new Promise(function(_0x2fea6b,_0x2aa6a2){return db['SmsQueueReport'][_0xe9e0('0x1e')](_0xb416f6[_0xe9e0('0x19')],{'raw':_0xb416f6[_0xe9e0('0x1a')]?_0xb416f6[_0xe9e0('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb416f6[_0xe9e0('0x1a')]?_0xb416f6[_0xe9e0('0x1a')][_0xe9e0('0x1f')]||null:null,'attributes':_0xb416f6[_0xe9e0('0x1a')]?_0xb416f6[_0xe9e0('0x1a')][_0xe9e0('0x20')]||null:null,'limit':_0xb416f6['options']?_0xb416f6['options'][_0xe9e0('0x21')]||null:null})[_0xe9e0('0x1c')](function(_0x4664bd){logger[_0xe9e0('0xc')](_0xe9e0('0x1d'),_0xb416f6);logger['debug'](_0xe9e0('0x1d'),_0xb416f6,JSON[_0xe9e0('0x11')](_0x4664bd));_0x2fea6b(_0x4664bd);})['catch'](function(_0x2cf6f9){logger[_0xe9e0('0x12')]('UpdateSmsQueueReport',_0x2cf6f9[_0xe9e0('0x14')],_0xb416f6);_0x2aa6a2(_0x30ac4d[_0xe9e0('0x12')](0x1f4,_0x2cf6f9['message']));});});}; \ No newline at end of file +var _0x2bdd=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSmsQueueReport','create','options','raw','then','catch','UpdateSmsQueueReport','update','body','attributes','lodash','randomstring','ioredis'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x2bdd,0x102));var _0xd2bd=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x2bdd[_0x3cae69];return _0x3128eb;};'use strict';var _=require(_0xd2bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd2bd('0x1'));var fs=require('fs');var Redis=require(_0xd2bd('0x2'));var db=require(_0xd2bd('0x3'))['db'];var utils=require(_0xd2bd('0x4'));var logger=require('../../config/logger')(_0xd2bd('0x5'));var config=require(_0xd2bd('0x6'));var jayson=require(_0xd2bd('0x7'));var client=jayson[_0xd2bd('0x8')][_0xd2bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x320e29,_0x2d34cc,_0x3c096c){return new BPromise(function(_0x25c548,_0x692855){return client['request'](_0x320e29,_0x3c096c)['then'](function(_0x5acbac){logger[_0xd2bd('0xa')](_0xd2bd('0xb'),_0x2d34cc,_0xd2bd('0xc'));logger[_0xd2bd('0xd')](_0xd2bd('0xe'),_0x2d34cc,_0xd2bd('0xc'),JSON[_0xd2bd('0xf')](_0x5acbac));if(_0x5acbac[_0xd2bd('0x10')]){if(_0x5acbac['error']['code']===0x1f4){logger[_0xd2bd('0x10')](_0xd2bd('0xb'),_0x2d34cc,_0x5acbac['error'][_0xd2bd('0x11')]);return _0x692855(_0x5acbac[_0xd2bd('0x10')][_0xd2bd('0x11')]);}logger[_0xd2bd('0x10')](_0xd2bd('0xb'),_0x2d34cc,_0x5acbac[_0xd2bd('0x10')][_0xd2bd('0x11')]);return _0x25c548(_0x5acbac[_0xd2bd('0x10')][_0xd2bd('0x11')]);}else{logger[_0xd2bd('0xa')](_0xd2bd('0xb'),_0x2d34cc,_0xd2bd('0xc'));_0x25c548(_0x5acbac[_0xd2bd('0x12')][_0xd2bd('0x11')]);}})['catch'](function(_0x55bf56){logger[_0xd2bd('0x10')](_0xd2bd('0xb'),_0x2d34cc,_0x55bf56);_0x692855(_0x55bf56);});});}exports[_0xd2bd('0x13')]=function(_0x2757de){var _0x183265=this;return new Promise(function(_0x1a64d3,_0x4cf6fa){return db['SmsQueueReport'][_0xd2bd('0x14')](_0x2757de['body'],{'raw':_0x2757de[_0xd2bd('0x15')]?_0x2757de[_0xd2bd('0x15')][_0xd2bd('0x16')]===undefined?!![]:![]:!![]})[_0xd2bd('0x17')](function(_0xacd0f4){logger[_0xd2bd('0xa')]('CreateSmsQueueReport',_0x2757de);logger[_0xd2bd('0xd')](_0xd2bd('0x13'),_0x2757de,JSON[_0xd2bd('0xf')](_0xacd0f4));_0x1a64d3(_0xacd0f4);})[_0xd2bd('0x18')](function(_0x423a26){logger[_0xd2bd('0x10')](_0xd2bd('0x13'),_0x423a26['message'],_0x2757de);_0x4cf6fa(_0x183265[_0xd2bd('0x10')](0x1f4,_0x423a26[_0xd2bd('0x11')]));});});};exports[_0xd2bd('0x19')]=function(_0x27edd3){var _0x5e0479=this;return new Promise(function(_0x7255be,_0x31bd19){return db['SmsQueueReport'][_0xd2bd('0x1a')](_0x27edd3[_0xd2bd('0x1b')],{'raw':_0x27edd3[_0xd2bd('0x15')]?_0x27edd3[_0xd2bd('0x15')][_0xd2bd('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27edd3[_0xd2bd('0x15')]?_0x27edd3[_0xd2bd('0x15')]['where']||null:null,'attributes':_0x27edd3['options']?_0x27edd3[_0xd2bd('0x15')][_0xd2bd('0x1c')]||null:null,'limit':_0x27edd3[_0xd2bd('0x15')]?_0x27edd3[_0xd2bd('0x15')]['limit']||null:null})[_0xd2bd('0x17')](function(_0x20e796){logger[_0xd2bd('0xa')](_0xd2bd('0x19'),_0x27edd3);logger[_0xd2bd('0xd')](_0xd2bd('0x19'),_0x27edd3,JSON['stringify'](_0x20e796));_0x7255be(_0x20e796);})[_0xd2bd('0x18')](function(_0x19d4de){logger[_0xd2bd('0x10')]('UpdateSmsQueueReport',_0x19d4de[_0xd2bd('0x11')],_0x27edd3);_0x31bd19(_0x5e0479[_0xd2bd('0x10')](0x1f4,_0x19d4de[_0xd2bd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index e028d2a..0e9077c 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 _0x4ab0=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x29ff46,_0x2aeb36){var _0x59630c=function(_0x1c11f8){while(--_0x1c11f8){_0x29ff46['push'](_0x29ff46['shift']());}};_0x59630c(++_0x2aeb36);}(_0x4ab0,0xd5));var _0x04ab=function(_0x77aca5,_0x241737){_0x77aca5=_0x77aca5-0x0;var _0x49f38e=_0x4ab0[_0x77aca5];return _0x49f38e;};'use strict';var multer=require('multer');var util=require(_0x04ab('0x0'));var path=require(_0x04ab('0x1'));var timeout=require(_0x04ab('0x2'));var express=require(_0x04ab('0x3'));var router=express[_0x04ab('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x04ab('0x5'));var config=require(_0x04ab('0x6'));var controller=require('./smsTransferReport.controller');router[_0x04ab('0x7')]('/',auth[_0x04ab('0x8')](),controller['index']);router[_0x04ab('0x7')](_0x04ab('0x9'),auth[_0x04ab('0x8')](),controller['describe']);router[_0x04ab('0x7')](_0x04ab('0xa'),auth[_0x04ab('0x8')](),controller[_0x04ab('0xb')]);router['post']('/',auth[_0x04ab('0x8')](),controller[_0x04ab('0xc')]);router[_0x04ab('0xd')](_0x04ab('0xa'),auth['isAuthenticated'](),controller[_0x04ab('0xe')]);router[_0x04ab('0xf')](_0x04ab('0xa'),auth[_0x04ab('0x8')](),controller[_0x04ab('0x10')]);module[_0x04ab('0x11')]=router; \ No newline at end of file +var _0xf006=['post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0xf006,0x146));var _0x6f00=function(_0x4a63db,_0x2b49ba){_0x4a63db=_0x4a63db-0x0;var _0x52cacb=_0xf006[_0x4a63db];return _0x52cacb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller['index']);router[_0x6f00('0x5')]('/describe',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router[_0x6f00('0xa')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xb')]);router[_0x6f00('0xc')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xd')]);router['delete'](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xe')]);module[_0x6f00('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3e70879..f9021ea 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x14461f,_0xfa892e){var _0x23f0c6=function(_0x2834ea){while(--_0x2834ea){_0x14461f['push'](_0x14461f['shift']());}};_0x23f0c6(++_0xfa892e);}(_0xedd9,0xfc));var _0x9edd=function(_0x24f6fb,_0xc144a7){_0x24f6fb=_0x24f6fb-0x0;var _0x94b1e4=_0xedd9[_0x24f6fb];return _0x94b1e4;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xb6613c,_0xdab4e1){var _0xcd8120=function(_0x3aa9df){while(--_0x3aa9df){_0xb6613c['push'](_0xb6613c['shift']());}};_0xcd8120(++_0xdab4e1);}(_0x70e0,0x17b));var _0x070e=function(_0x220855,_0x41919e){_0x220855=_0x220855-0x0;var _0x43ac76=_0x70e0[_0x220855];return _0x43ac76;};'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 349f443..50e6761 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 _0x6439=['jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','SmsTransferReport','findAll','rows','catch','params','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x6439,0x83));var _0x9643=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x6439[_0xc0a3d3];return _0x3386e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9643('0x0'));var zipdir=require(_0x9643('0x1'));var jsonpatch=require(_0x9643('0x2'));var rp=require(_0x9643('0x3'));var moment=require(_0x9643('0x4'));var BPromise=require(_0x9643('0x5'));var Mustache=require(_0x9643('0x6'));var util=require(_0x9643('0x7'));var path=require(_0x9643('0x8'));var sox=require(_0x9643('0x9'));var csv=require(_0x9643('0xa'));var ejs=require(_0x9643('0xb'));var fs=require('fs');var fs_extra=require(_0x9643('0xc'));var _=require(_0x9643('0xd'));var squel=require('squel');var crypto=require(_0x9643('0xe'));var jsforce=require(_0x9643('0xf'));var deskjs=require(_0x9643('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9643('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9643('0x12'));var logger=require(_0x9643('0x13'))(_0x9643('0x14'));var utils=require(_0x9643('0x15'));var config=require(_0x9643('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1250,_0x538430){_0x538430=_0x538430||0xcc;return function(_0x4e6ff7){if(_0x4e6ff7){return _0x3c1250[_0x9643('0x17')](_0x538430);}return _0x3c1250['status'](_0x538430)[_0x9643('0x18')]();};}function respondWithResult(_0x5bc7a8,_0x3d8a32){_0x3d8a32=_0x3d8a32||0xc8;return function(_0x3e7939){if(_0x3e7939){return _0x5bc7a8[_0x9643('0x19')](_0x3d8a32)[_0x9643('0x1a')](_0x3e7939);}};}function respondWithFilteredResult(_0x5da1b7,_0x39bde4){return function(_0x1f903e){if(_0x1f903e){var _0x1ae2b8=typeof _0x39bde4['offset']===_0x9643('0x1b')&&typeof _0x39bde4[_0x9643('0x1c')]===_0x9643('0x1b');var _0x59b98a=_0x1f903e[_0x9643('0x1d')];var _0x19d0c1=_0x1ae2b8?0x0:_0x39bde4[_0x9643('0x1e')];var _0x3d61cd=_0x1ae2b8?_0x1f903e[_0x9643('0x1d')]:_0x39bde4[_0x9643('0x1e')]+_0x39bde4[_0x9643('0x1c')];var _0x19b0e2;if(_0x3d61cd>=_0x59b98a){_0x3d61cd=_0x59b98a;_0x19b0e2=0xc8;}else{_0x19b0e2=0xce;}_0x5da1b7[_0x9643('0x19')](_0x19b0e2);return _0x5da1b7[_0x9643('0x1f')]('Content-Range',_0x19d0c1+'-'+_0x3d61cd+'/'+_0x59b98a)[_0x9643('0x1a')](_0x1f903e);}return null;};}function patchUpdates(_0x3ee4fb){return function(_0x51c429){try{jsonpatch[_0x9643('0x20')](_0x51c429,_0x3ee4fb,!![]);}catch(_0x543367){return BPromise['reject'](_0x543367);}return _0x51c429['save']();};}function saveUpdates(_0x4be116,_0x571bca){return function(_0x14c483){if(_0x14c483){return _0x14c483[_0x9643('0x21')](_0x4be116)[_0x9643('0x22')](function(_0x177f5b){return _0x177f5b;});}return null;};}function removeEntity(_0x38e1fe,_0x1e9b78){return function(_0x178603){if(_0x178603){return _0x178603[_0x9643('0x23')]()['then'](function(){_0x38e1fe[_0x9643('0x19')](0xcc)[_0x9643('0x18')]();});}};}function handleEntityNotFound(_0x2915e6,_0x436bb1){return function(_0x302165){if(!_0x302165){_0x2915e6[_0x9643('0x17')](0x194);}return _0x302165;};}function handleError(_0x3d6368,_0x288c88){_0x288c88=_0x288c88||0x1f4;return function(_0x22e835){logger[_0x9643('0x24')](_0x22e835[_0x9643('0x25')]);if(_0x22e835[_0x9643('0x26')]){delete _0x22e835[_0x9643('0x26')];}_0x3d6368[_0x9643('0x19')](_0x288c88)['send'](_0x22e835);};}exports[_0x9643('0x27')]=function(_0x823a0e,_0x58f5ec){var _0x3e54a3={},_0x238adc={},_0x4ae5f8={'count':0x0,'rows':[]};var _0x1dd815=_[_0x9643('0x28')](db['SmsTransferReport'][_0x9643('0x29')],function(_0x508815){return{'name':_0x508815[_0x9643('0x2a')],'type':_0x508815[_0x9643('0x2b')][_0x9643('0x2c')]};});_0x238adc[_0x9643('0x2d')]=_[_0x9643('0x28')](_0x1dd815,'name');_0x238adc[_0x9643('0x2e')]=_[_0x9643('0x2f')](_0x823a0e[_0x9643('0x2e')]);_0x238adc[_0x9643('0x30')]=_[_0x9643('0x31')](_0x238adc[_0x9643('0x2d')],_0x238adc['query']);_0x3e54a3[_0x9643('0x32')]=_[_0x9643('0x31')](_0x238adc[_0x9643('0x2d')],qs['fields'](_0x823a0e[_0x9643('0x2e')][_0x9643('0x33')]));_0x3e54a3[_0x9643('0x32')]=_0x3e54a3[_0x9643('0x32')][_0x9643('0x34')]?_0x3e54a3[_0x9643('0x32')]:_0x238adc[_0x9643('0x2d')];if(!_0x823a0e[_0x9643('0x2e')][_0x9643('0x35')](_0x9643('0x36'))){_0x3e54a3['limit']=qs[_0x9643('0x1c')](_0x823a0e[_0x9643('0x2e')]['limit']);_0x3e54a3[_0x9643('0x1e')]=qs['offset'](_0x823a0e[_0x9643('0x2e')][_0x9643('0x1e')]);}_0x3e54a3[_0x9643('0x37')]=qs[_0x9643('0x38')](_0x823a0e['query'][_0x9643('0x38')]);_0x3e54a3['where']=qs[_0x9643('0x30')](_['pick'](_0x823a0e[_0x9643('0x2e')],_0x238adc[_0x9643('0x30')]),_0x1dd815);if(_0x823a0e[_0x9643('0x2e')][_0x9643('0x39')]){_0x3e54a3[_0x9643('0x3a')]=_[_0x9643('0x3b')](_0x3e54a3[_0x9643('0x3a')],{'$or':_[_0x9643('0x28')](_0x1dd815,function(_0x503a41){if(_0x503a41['type']!==_0x9643('0x3c')){var _0x881cb1={};_0x881cb1[_0x503a41[_0x9643('0x26')]]={'$like':'%'+_0x823a0e[_0x9643('0x2e')][_0x9643('0x39')]+'%'};return _0x881cb1;}})});}_0x3e54a3=_['merge']({},_0x3e54a3,_0x823a0e[_0x9643('0x3d')]);var _0x19df2f={'where':_0x3e54a3[_0x9643('0x3a')]};return db['SmsTransferReport']['count'](_0x19df2f)[_0x9643('0x22')](function(_0x411a1b){_0x4ae5f8[_0x9643('0x1d')]=_0x411a1b;if(_0x823a0e[_0x9643('0x2e')]['includeAll']){_0x3e54a3[_0x9643('0x3e')]=[{'all':!![]}];}return db[_0x9643('0x3f')][_0x9643('0x40')](_0x3e54a3);})[_0x9643('0x22')](function(_0x1f6325){_0x4ae5f8[_0x9643('0x41')]=_0x1f6325;return _0x4ae5f8;})[_0x9643('0x22')](respondWithFilteredResult(_0x58f5ec,_0x3e54a3))[_0x9643('0x42')](handleError(_0x58f5ec,null));};exports['show']=function(_0x317e97,_0x46315a){var _0x441707={'raw':!![],'where':{'id':_0x317e97[_0x9643('0x43')]['id']}},_0x189233={};_0x189233[_0x9643('0x2d')]=_[_0x9643('0x2f')](db['SmsTransferReport']['rawAttributes']);_0x189233[_0x9643('0x2e')]=_[_0x9643('0x2f')](_0x317e97[_0x9643('0x2e')]);_0x189233['filters']=_[_0x9643('0x31')](_0x189233[_0x9643('0x2d')],_0x189233[_0x9643('0x2e')]);_0x441707[_0x9643('0x32')]=_['intersection'](_0x189233[_0x9643('0x2d')],qs[_0x9643('0x33')](_0x317e97[_0x9643('0x2e')][_0x9643('0x33')]));_0x441707['attributes']=_0x441707['attributes'][_0x9643('0x34')]?_0x441707[_0x9643('0x32')]:_0x189233[_0x9643('0x2d')];if(_0x317e97['query'][_0x9643('0x44')]){_0x441707[_0x9643('0x3e')]=[{'all':!![]}];}_0x441707=_[_0x9643('0x3b')]({},_0x441707,_0x317e97[_0x9643('0x3d')]);return db[_0x9643('0x3f')]['find'](_0x441707)[_0x9643('0x22')](handleEntityNotFound(_0x46315a,null))[_0x9643('0x22')](respondWithResult(_0x46315a,null))['catch'](handleError(_0x46315a,null));};exports[_0x9643('0x45')]=function(_0x4eaca7,_0x253c72){return db[_0x9643('0x3f')]['create'](_0x4eaca7[_0x9643('0x46')],{})[_0x9643('0x22')](respondWithResult(_0x253c72,0xc9))[_0x9643('0x42')](handleError(_0x253c72,null));};exports[_0x9643('0x21')]=function(_0x18127f,_0x4574b2){if(_0x18127f[_0x9643('0x46')]['id']){delete _0x18127f['body']['id'];}return db['SmsTransferReport'][_0x9643('0x47')]({'where':{'id':_0x18127f[_0x9643('0x43')]['id']}})['then'](handleEntityNotFound(_0x4574b2,null))[_0x9643('0x22')](saveUpdates(_0x18127f['body'],null))[_0x9643('0x22')](respondWithResult(_0x4574b2,null))[_0x9643('0x42')](handleError(_0x4574b2,null));};exports[_0x9643('0x23')]=function(_0x30571c,_0x1f0f50){return db['SmsTransferReport'][_0x9643('0x47')]({'where':{'id':_0x30571c[_0x9643('0x43')]['id']}})[_0x9643('0x22')](handleEntityNotFound(_0x1f0f50,null))[_0x9643('0x22')](removeEntity(_0x1f0f50,null))['catch'](handleError(_0x1f0f50,null));};exports[_0x9643('0x48')]=function(_0x2ad75c,_0x58c862){return db[_0x9643('0x3f')][_0x9643('0x48')]()[_0x9643('0x22')](respondWithResult(_0x58c862,null))[_0x9643('0x42')](handleError(_0x58c862,null));}; \ No newline at end of file +var _0xd442=['order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','SmsTransferReport','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd442,0x1dc));var _0x2d44=function(_0x5715c5,_0x542f8a){_0x5715c5=_0x5715c5-0x0;var _0x4a5c35=_0xd442[_0x5715c5];return _0x4a5c35;};'use strict';var emlformat=require(_0x2d44('0x0'));var rimraf=require(_0x2d44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2d44('0x2'));var moment=require(_0x2d44('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d44('0x4'));var path=require(_0x2d44('0x5'));var sox=require(_0x2d44('0x6'));var csv=require(_0x2d44('0x7'));var ejs=require(_0x2d44('0x8'));var fs=require('fs');var fs_extra=require(_0x2d44('0x9'));var _=require(_0x2d44('0xa'));var squel=require(_0x2d44('0xb'));var crypto=require('crypto');var jsforce=require(_0x2d44('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2d44('0x7'));var querystring=require(_0x2d44('0xd'));var Papa=require('papaparse');var Redis=require(_0x2d44('0xe'));var authService=require(_0x2d44('0xf'));var qs=require(_0x2d44('0x10'));var as=require(_0x2d44('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d44('0x12'))(_0x2d44('0x13'));var utils=require(_0x2d44('0x14'));var config=require(_0x2d44('0x15'));var licenseUtil=require(_0x2d44('0x16'));var db=require(_0x2d44('0x17'))['db'];function respondWithStatusCode(_0x180e29,_0x4e456a){_0x4e456a=_0x4e456a||0xcc;return function(_0x2ace1d){if(_0x2ace1d){return _0x180e29[_0x2d44('0x18')](_0x4e456a);}return _0x180e29[_0x2d44('0x19')](_0x4e456a)[_0x2d44('0x1a')]();};}function respondWithResult(_0x150d59,_0x3481d7){_0x3481d7=_0x3481d7||0xc8;return function(_0x3f0b69){if(_0x3f0b69){return _0x150d59[_0x2d44('0x19')](_0x3481d7)['json'](_0x3f0b69);}};}function respondWithFilteredResult(_0x3e541e,_0x4cbeed){return function(_0x3c830b){if(_0x3c830b){var _0x4f3ef4=typeof _0x4cbeed[_0x2d44('0x1b')]===_0x2d44('0x1c')&&typeof _0x4cbeed[_0x2d44('0x1d')]===_0x2d44('0x1c');var _0x435680=_0x3c830b[_0x2d44('0x1e')];var _0x4d938f=_0x4f3ef4?0x0:_0x4cbeed[_0x2d44('0x1b')];var _0x5c2942=_0x4f3ef4?_0x3c830b['count']:_0x4cbeed['offset']+_0x4cbeed[_0x2d44('0x1d')];var _0xbd479;if(_0x5c2942>=_0x435680){_0x5c2942=_0x435680;_0xbd479=0xc8;}else{_0xbd479=0xce;}_0x3e541e['status'](_0xbd479);return _0x3e541e[_0x2d44('0x1f')](_0x2d44('0x20'),_0x4d938f+'-'+_0x5c2942+'/'+_0x435680)[_0x2d44('0x21')](_0x3c830b);}return null;};}function patchUpdates(_0x2be2d1){return function(_0x3e7fae){try{jsonpatch['apply'](_0x3e7fae,_0x2be2d1,!![]);}catch(_0xdab11){return BPromise[_0x2d44('0x22')](_0xdab11);}return _0x3e7fae[_0x2d44('0x23')]();};}function saveUpdates(_0x47066b,_0x33f0e2){return function(_0x9c3ad1){if(_0x9c3ad1){return _0x9c3ad1[_0x2d44('0x24')](_0x47066b)[_0x2d44('0x25')](function(_0x1479e7){return _0x1479e7;});}return null;};}function removeEntity(_0xe435f1,_0x2bb768){return function(_0x45b515){if(_0x45b515){return _0x45b515[_0x2d44('0x26')]()[_0x2d44('0x25')](function(){_0xe435f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d4a9e,_0x2cb6fc){return function(_0x1e20be){if(!_0x1e20be){_0x7d4a9e[_0x2d44('0x18')](0x194);}return _0x1e20be;};}function handleError(_0x51ced2,_0x53647c){_0x53647c=_0x53647c||0x1f4;return function(_0x1d0fc4){logger[_0x2d44('0x27')](_0x1d0fc4[_0x2d44('0x28')]);if(_0x1d0fc4[_0x2d44('0x29')]){delete _0x1d0fc4[_0x2d44('0x29')];}_0x51ced2['status'](_0x53647c)['send'](_0x1d0fc4);};}exports['index']=function(_0x497077,_0x2ec559){var _0x25eb46={},_0x4f02fc={},_0x10340d={'count':0x0,'rows':[]};var _0x26fdd9=_['map'](db[_0x2d44('0x2a')][_0x2d44('0x2b')],function(_0x20df0f){return{'name':_0x20df0f[_0x2d44('0x2c')],'type':_0x20df0f['type']['key']};});_0x4f02fc['model']=_[_0x2d44('0x2d')](_0x26fdd9,_0x2d44('0x29'));_0x4f02fc[_0x2d44('0x2e')]=_[_0x2d44('0x2f')](_0x497077[_0x2d44('0x2e')]);_0x4f02fc[_0x2d44('0x30')]=_[_0x2d44('0x31')](_0x4f02fc[_0x2d44('0x32')],_0x4f02fc['query']);_0x25eb46[_0x2d44('0x33')]=_[_0x2d44('0x31')](_0x4f02fc['model'],qs['fields'](_0x497077[_0x2d44('0x2e')][_0x2d44('0x34')]));_0x25eb46['attributes']=_0x25eb46['attributes'][_0x2d44('0x35')]?_0x25eb46[_0x2d44('0x33')]:_0x4f02fc[_0x2d44('0x32')];if(!_0x497077[_0x2d44('0x2e')][_0x2d44('0x36')](_0x2d44('0x37'))){_0x25eb46[_0x2d44('0x1d')]=qs[_0x2d44('0x1d')](_0x497077[_0x2d44('0x2e')][_0x2d44('0x1d')]);_0x25eb46['offset']=qs[_0x2d44('0x1b')](_0x497077[_0x2d44('0x2e')][_0x2d44('0x1b')]);}_0x25eb46[_0x2d44('0x38')]=qs[_0x2d44('0x39')](_0x497077[_0x2d44('0x2e')]['sort']);_0x25eb46['where']=qs[_0x2d44('0x30')](_[_0x2d44('0x3a')](_0x497077['query'],_0x4f02fc[_0x2d44('0x30')]),_0x26fdd9);if(_0x497077[_0x2d44('0x2e')][_0x2d44('0x3b')]){_0x25eb46['where']=_[_0x2d44('0x3c')](_0x25eb46[_0x2d44('0x3d')],{'$or':_['map'](_0x26fdd9,function(_0x25f0a8){if(_0x25f0a8[_0x2d44('0x3e')]!==_0x2d44('0x3f')){var _0x4ff28c={};_0x4ff28c[_0x25f0a8['name']]={'$like':'%'+_0x497077['query']['filter']+'%'};return _0x4ff28c;}})});}_0x25eb46=_['merge']({},_0x25eb46,_0x497077[_0x2d44('0x40')]);var _0x1096b3={'where':_0x25eb46[_0x2d44('0x3d')]};return db[_0x2d44('0x2a')][_0x2d44('0x1e')](_0x1096b3)[_0x2d44('0x25')](function(_0x5c8855){_0x10340d['count']=_0x5c8855;if(_0x497077['query'][_0x2d44('0x41')]){_0x25eb46['include']=[{'all':!![]}];}return db[_0x2d44('0x2a')][_0x2d44('0x42')](_0x25eb46);})['then'](function(_0x3a6f42){_0x10340d[_0x2d44('0x43')]=_0x3a6f42;return _0x10340d;})[_0x2d44('0x25')](respondWithFilteredResult(_0x2ec559,_0x25eb46))[_0x2d44('0x44')](handleError(_0x2ec559,null));};exports[_0x2d44('0x45')]=function(_0x478f50,_0x2fd680){var _0x49df03={'raw':!![],'where':{'id':_0x478f50[_0x2d44('0x46')]['id']}},_0x262cf1={};_0x262cf1[_0x2d44('0x32')]=_[_0x2d44('0x2f')](db[_0x2d44('0x2a')]['rawAttributes']);_0x262cf1[_0x2d44('0x2e')]=_[_0x2d44('0x2f')](_0x478f50['query']);_0x262cf1[_0x2d44('0x30')]=_['intersection'](_0x262cf1[_0x2d44('0x32')],_0x262cf1[_0x2d44('0x2e')]);_0x49df03[_0x2d44('0x33')]=_[_0x2d44('0x31')](_0x262cf1[_0x2d44('0x32')],qs[_0x2d44('0x34')](_0x478f50[_0x2d44('0x2e')][_0x2d44('0x34')]));_0x49df03[_0x2d44('0x33')]=_0x49df03[_0x2d44('0x33')]['length']?_0x49df03[_0x2d44('0x33')]:_0x262cf1['model'];if(_0x478f50[_0x2d44('0x2e')][_0x2d44('0x41')]){_0x49df03[_0x2d44('0x47')]=[{'all':!![]}];}_0x49df03=_['merge']({},_0x49df03,_0x478f50[_0x2d44('0x40')]);return db[_0x2d44('0x2a')][_0x2d44('0x48')](_0x49df03)['then'](handleEntityNotFound(_0x2fd680,null))['then'](respondWithResult(_0x2fd680,null))[_0x2d44('0x44')](handleError(_0x2fd680,null));};exports[_0x2d44('0x49')]=function(_0x395006,_0x5d6c03){return db[_0x2d44('0x2a')][_0x2d44('0x49')](_0x395006[_0x2d44('0x4a')],{})['then'](respondWithResult(_0x5d6c03,0xc9))[_0x2d44('0x44')](handleError(_0x5d6c03,null));};exports[_0x2d44('0x24')]=function(_0x33ee41,_0xa57561){if(_0x33ee41[_0x2d44('0x4a')]['id']){delete _0x33ee41[_0x2d44('0x4a')]['id'];}return db[_0x2d44('0x2a')][_0x2d44('0x48')]({'where':{'id':_0x33ee41[_0x2d44('0x46')]['id']}})[_0x2d44('0x25')](handleEntityNotFound(_0xa57561,null))[_0x2d44('0x25')](saveUpdates(_0x33ee41['body'],null))[_0x2d44('0x25')](respondWithResult(_0xa57561,null))[_0x2d44('0x44')](handleError(_0xa57561,null));};exports[_0x2d44('0x26')]=function(_0x1646a9,_0x4ebd46){return db[_0x2d44('0x2a')][_0x2d44('0x48')]({'where':{'id':_0x1646a9[_0x2d44('0x46')]['id']}})[_0x2d44('0x25')](handleEntityNotFound(_0x4ebd46,null))[_0x2d44('0x25')](removeEntity(_0x4ebd46,null))[_0x2d44('0x44')](handleError(_0x4ebd46,null));};exports[_0x2d44('0x4b')]=function(_0x12b6b2,_0x5ef94c){return db[_0x2d44('0x2a')]['describe']()[_0x2d44('0x25')](respondWithResult(_0x5ef94c,null))[_0x2d44('0x44')](handleError(_0x5ef94c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1adcd40..38a2c74 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 _0xf1c9=['../../config/environment','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9e59dc,_0xced86f){var _0x41f1f4=function(_0x52cf00){while(--_0x52cf00){_0x9e59dc['push'](_0x9e59dc['shift']());}};_0x41f1f4(++_0xced86f);}(_0xf1c9,0xa0));var _0x9f1c=function(_0x48d300,_0x38aca0){_0x48d300=_0x48d300-0x0;var _0x1c1184=_0xf1c9[_0x48d300];return _0x1c1184;};'use strict';var _=require(_0x9f1c('0x0'));var util=require(_0x9f1c('0x1'));var logger=require(_0x9f1c('0x2'))(_0x9f1c('0x3'));var moment=require(_0x9f1c('0x4'));var BPromise=require(_0x9f1c('0x5'));var rp=require(_0x9f1c('0x6'));var fs=require('fs');var path=require(_0x9f1c('0x7'));var rimraf=require(_0x9f1c('0x8'));var config=require(_0x9f1c('0x9'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x57086d,_0x109722){return _0x57086d['define'](_0x9f1c('0xa'),attributes,{'tableName':_0x9f1c('0xb'),'paranoid':![],'indexes':[{'name':_0x9f1c('0xc'),'fields':[_0x9f1c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf364=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x277da2,_0x5367b3){var _0x202a6b=function(_0x5a64ab){while(--_0x5a64ab){_0x277da2['push'](_0x277da2['shift']());}};_0x202a6b(++_0x5367b3);}(_0xf364,0x78));var _0x4f36=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xf364[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x4f36('0x0'));var util=require('util');var logger=require(_0x4f36('0x1'))(_0x4f36('0x2'));var moment=require(_0x4f36('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f36('0x4'));var rimraf=require(_0x4f36('0x5'));var config=require(_0x4f36('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x4f36('0x7')]=function(_0x1de3ca,_0x38700d){return _0x1de3ca[_0x4f36('0x8')](_0x4f36('0x9'),attributes,{'tableName':_0x4f36('0xa'),'paranoid':![],'indexes':[{'name':_0x4f36('0xb'),'fields':[_0x4f36('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 073158f..9ff3de3 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 _0xe914=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1ad1f8,_0x543a44){var _0x35757e=function(_0xd7dc7d){while(--_0xd7dc7d){_0x1ad1f8['push'](_0x1ad1f8['shift']());}};_0x35757e(++_0x543a44);}(_0xe914,0x7f));var _0x4e91=function(_0x23b1d6,_0x2e344b){_0x23b1d6=_0x23b1d6-0x0;var _0x4d7840=_0xe914[_0x23b1d6];return _0x4d7840;};'use strict';var _=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var moment=require('moment');var BPromise=require(_0x4e91('0x2'));var rs=require(_0x4e91('0x3'));var fs=require('fs');var Redis=require(_0x4e91('0x4'));var db=require(_0x4e91('0x5'))['db'];var utils=require(_0x4e91('0x6'));var logger=require(_0x4e91('0x7'))('rpc');var config=require(_0x4e91('0x8'));var jayson=require(_0x4e91('0x9'));var client=jayson['client'][_0x4e91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4bd6,_0x3f09cb,_0x2f2098){return new BPromise(function(_0x532b72,_0x49174e){return client[_0x4e91('0xb')](_0x1d4bd6,_0x2f2098)['then'](function(_0x523dec){logger[_0x4e91('0xc')](_0x4e91('0xd'),_0x3f09cb,_0x4e91('0xe'));logger[_0x4e91('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3f09cb,_0x4e91('0xe'),JSON[_0x4e91('0x10')](_0x523dec));if(_0x523dec[_0x4e91('0x11')]){if(_0x523dec['error'][_0x4e91('0x12')]===0x1f4){logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);return _0x49174e(_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);}logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x523dec['error'][_0x4e91('0x13')]);return _0x532b72(_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);}else{logger['info'](_0x4e91('0xd'),_0x3f09cb,_0x4e91('0xe'));_0x532b72(_0x523dec[_0x4e91('0x14')][_0x4e91('0x13')]);}})[_0x4e91('0x15')](function(_0x34f91f){logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x34f91f);_0x49174e(_0x34f91f);});});} \ No newline at end of file +var _0x8ba0=['rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x3ba6e9,_0x1c7dc7){_0x3ba6e9=_0x3ba6e9-0x0;var _0x2e5a29=_0x8ba0[_0x3ba6e9];return _0x2e5a29;};'use strict';var _=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var moment=require(_0x08ba('0x2'));var BPromise=require(_0x08ba('0x3'));var rs=require(_0x08ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08ba('0x5'));var logger=require(_0x08ba('0x6'))(_0x08ba('0x7'));var config=require(_0x08ba('0x8'));var jayson=require(_0x08ba('0x9'));var client=jayson[_0x08ba('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235354,_0x11f6a1,_0x37bcdf){return new BPromise(function(_0x451f15,_0x1f6051){return client['request'](_0x235354,_0x37bcdf)[_0x08ba('0xb')](function(_0x5eb94f){logger[_0x08ba('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x11f6a1,_0x08ba('0xd'));logger[_0x08ba('0xe')](_0x08ba('0xf'),_0x11f6a1,_0x08ba('0xd'),JSON[_0x08ba('0x10')](_0x5eb94f));if(_0x5eb94f[_0x08ba('0x11')]){if(_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x12')]===0x1f4){logger[_0x08ba('0x11')](_0x08ba('0x13'),_0x11f6a1,_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x14')]);return _0x1f6051(_0x5eb94f['error'][_0x08ba('0x14')]);}logger[_0x08ba('0x11')](_0x08ba('0x13'),_0x11f6a1,_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x14')]);return _0x451f15(_0x5eb94f[_0x08ba('0x11')]['message']);}else{logger[_0x08ba('0xc')](_0x08ba('0x13'),_0x11f6a1,_0x08ba('0xd'));_0x451f15(_0x5eb94f[_0x08ba('0x15')][_0x08ba('0x14')]);}})['catch'](function(_0x4b5a04){logger[_0x08ba('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x11f6a1,_0x4b5a04);_0x1f6051(_0x4b5a04);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 054b8e9..44fdd6e 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 _0xffeb=['basename','extname','now','post','single','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','download','diskStorage','root','originalname','replace','format','%s-%s%s'];(function(_0x4a7252,_0x35d5e6){var _0x4ba94b=function(_0x2b0db1){while(--_0x2b0db1){_0x4a7252['push'](_0x4a7252['shift']());}};_0x4ba94b(++_0x35d5e6);}(_0xffeb,0xaa));var _0xbffe=function(_0x299590,_0x571eaf){_0x299590=_0x299590-0x0;var _0x58321b=_0xffeb[_0x299590];return _0x58321b;};'use strict';var multer=require(_0xbffe('0x0'));var util=require(_0xbffe('0x1'));var path=require(_0xbffe('0x2'));var timeout=require(_0xbffe('0x3'));var express=require(_0xbffe('0x4'));var router=express['Router']();var fs_extra=require(_0xbffe('0x5'));var auth=require(_0xbffe('0x6'));var interaction=require(_0xbffe('0x7'));var config=require(_0xbffe('0x8'));var controller=require(_0xbffe('0x9'));router[_0xbffe('0xa')]('/',auth[_0xbffe('0xb')](),controller[_0xbffe('0xc')]);router['get'](_0xbffe('0xd'),auth[_0xbffe('0xb')](),controller[_0xbffe('0xe')]);router[_0xbffe('0xa')]('/:id/download',auth[_0xbffe('0xb')](),controller[_0xbffe('0xf')]);var upload=multer({'storage':multer[_0xbffe('0x10')]({'destination':function(_0x31fd6a,_0xa2ae2a,_0x26fb88){_0x26fb88(null,path['join'](config[_0xbffe('0x11')],'server/files/sounds/original/'));},'filename':function(_0x394f0e,_0x2ed7e9,_0x3aa6a1){_0x2ed7e9[_0xbffe('0x12')]=_0x2ed7e9[_0xbffe('0x12')][_0xbffe('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3aa6a1(null,util[_0xbffe('0x14')](_0xbffe('0x15'),path[_0xbffe('0x16')](_0x2ed7e9['originalname'],path[_0xbffe('0x17')](_0x2ed7e9[_0xbffe('0x12')])),Date[_0xbffe('0x18')](),path[_0xbffe('0x17')](_0x2ed7e9[_0xbffe('0x12')])));}})});router[_0xbffe('0x19')]('/',upload[_0xbffe('0x1a')]('file'),controller[_0xbffe('0x1b')]);router[_0xbffe('0x1c')](_0xbffe('0xd'),auth[_0xbffe('0xb')](),controller[_0xbffe('0x1d')]);router[_0xbffe('0x1e')](_0xbffe('0xd'),auth[_0xbffe('0xb')](),controller[_0xbffe('0x1e')]);module[_0xbffe('0x1f')]=router; \ No newline at end of file +var _0x0974=['download','diskStorage','root','originalname','replace','format','basename','now','create','put','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x0974,0xed));var _0x4097=function(_0x111493,_0x3e916d){_0x111493=_0x111493-0x0;var _0x3b563c=_0x0974[_0x111493];return _0x3b563c;};'use strict';var multer=require(_0x4097('0x0'));var util=require(_0x4097('0x1'));var path=require(_0x4097('0x2'));var timeout=require(_0x4097('0x3'));var express=require(_0x4097('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4097('0x5'));var config=require(_0x4097('0x6'));var controller=require(_0x4097('0x7'));router[_0x4097('0x8')]('/',auth[_0x4097('0x9')](),controller[_0x4097('0xa')]);router['get'](_0x4097('0xb'),auth[_0x4097('0x9')](),controller[_0x4097('0xc')]);router[_0x4097('0x8')]('/:id/download',auth[_0x4097('0x9')](),controller[_0x4097('0xd')]);var upload=multer({'storage':multer[_0x4097('0xe')]({'destination':function(_0x30fb84,_0x1f6421,_0x5ef296){_0x5ef296(null,path['join'](config[_0x4097('0xf')],'server/files/sounds/original/'));},'filename':function(_0x332347,_0x4c6d50,_0x9b3d31){_0x4c6d50[_0x4097('0x10')]=_0x4c6d50['originalname'][_0x4097('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9b3d31(null,util[_0x4097('0x12')]('%s-%s%s',path[_0x4097('0x13')](_0x4c6d50[_0x4097('0x10')],path['extname'](_0x4c6d50[_0x4097('0x10')])),Date[_0x4097('0x14')](),path['extname'](_0x4c6d50[_0x4097('0x10')])));}})});router['post']('/',upload['single']('file'),controller[_0x4097('0x15')]);router[_0x4097('0x16')](_0x4097('0xb'),auth[_0x4097('0x9')](),controller['update']);router['delete'](_0x4097('0xb'),auth[_0x4097('0x9')](),controller[_0x4097('0x17')]);module[_0x4097('0x18')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 71c255d..3b2a4ae 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 _0x2c91=['STRING','BIGINT','INTEGER','sequelize','exports'];(function(_0x24f88a,_0x31b09d){var _0x544d3a=function(_0x317177){while(--_0x317177){_0x24f88a['push'](_0x24f88a['shift']());}};_0x544d3a(++_0x31b09d);}(_0x2c91,0xd5));var _0x12c9=function(_0xdf0134,_0x10623c){_0xdf0134=_0xdf0134-0x0;var _0x30b91c=_0x2c91[_0xdf0134];return _0x30b91c;};'use strict';var Sequelize=require(_0x12c9('0x0'));module[_0x12c9('0x1')]={'name':{'type':Sequelize[_0x12c9('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x12c9('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x12c9('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x12c9('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x12c9('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x12c9('0x4')]},'converted_bitRate':{'type':Sequelize[_0x12c9('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x12c9('0x4')]}}; \ No newline at end of file +var _0x61b5=['BIGINT','INTEGER','exports','STRING'];(function(_0xb18ae2,_0x13d5ec){var _0x499ee5=function(_0x447f60){while(--_0x447f60){_0xb18ae2['push'](_0xb18ae2['shift']());}};_0x499ee5(++_0x13d5ec);}(_0x61b5,0x86));var _0x561b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61b5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x561b('0x0')]={'name':{'type':Sequelize[_0x561b('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x561b('0x1')]},'display_name':{'type':Sequelize[_0x561b('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x561b('0x1')]},'original_format':{'type':Sequelize[_0x561b('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x561b('0x2')]},'original_channelCount':{'type':Sequelize[_0x561b('0x3')]},'original_bitRate':{'type':Sequelize[_0x561b('0x2')]},'original_sampleRate':{'type':Sequelize[_0x561b('0x3')]},'converted_format':{'type':Sequelize[_0x561b('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x561b('0x2')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x561b('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x561b('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index cf14ff4..714e188 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 _0xd769=['body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Sounds','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','keys','intersection','catch','download','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','filename','extname','originalname','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate'];(function(_0x487bbd,_0x4d1b85){var _0x4b2c56=function(_0x2eb269){while(--_0x2eb269){_0x487bbd['push'](_0x487bbd['shift']());}};_0x4b2c56(++_0x4d1b85);}(_0xd769,0x191));var _0x9d76=function(_0x5c64db,_0x3a0bd4){_0x5c64db=_0x5c64db-0x0;var _0x4975f0=_0xd769[_0x5c64db];return _0x4975f0;};'use strict';var emlformat=require(_0x9d76('0x0'));var rimraf=require(_0x9d76('0x1'));var zipdir=require(_0x9d76('0x2'));var jsonpatch=require(_0x9d76('0x3'));var rp=require(_0x9d76('0x4'));var moment=require(_0x9d76('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9d76('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9d76('0x7'));var csv=require('to-csv');var ejs=require(_0x9d76('0x8'));var fs=require('fs');var fs_extra=require(_0x9d76('0x9'));var _=require(_0x9d76('0xa'));var squel=require(_0x9d76('0xb'));var crypto=require(_0x9d76('0xc'));var jsforce=require(_0x9d76('0xd'));var deskjs=require(_0x9d76('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9d76('0xf'));var Papa=require(_0x9d76('0x10'));var Redis=require(_0x9d76('0x11'));var authService=require(_0x9d76('0x12'));var qs=require(_0x9d76('0x13'));var as=require(_0x9d76('0x14'));var hardwareService=require(_0x9d76('0x15'));var logger=require('../../config/logger')(_0x9d76('0x16'));var utils=require(_0x9d76('0x17'));var config=require(_0x9d76('0x18'));var licenseUtil=require(_0x9d76('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x586060,_0x33e7ac){_0x33e7ac=_0x33e7ac||0xcc;return function(_0x19e8af){if(_0x19e8af){return _0x586060[_0x9d76('0x1a')](_0x33e7ac);}return _0x586060['status'](_0x33e7ac)[_0x9d76('0x1b')]();};}function respondWithResult(_0x5b4bb0,_0x3d781f){_0x3d781f=_0x3d781f||0xc8;return function(_0x4252fc){if(_0x4252fc){return _0x5b4bb0[_0x9d76('0x1c')](_0x3d781f)['json'](_0x4252fc);}};}function respondWithFilteredResult(_0x533841,_0xbb12e1){return function(_0x1cd7de){if(_0x1cd7de){var _0x2eb3e5=typeof _0xbb12e1[_0x9d76('0x1d')]===_0x9d76('0x1e')&&typeof _0xbb12e1[_0x9d76('0x1f')]===_0x9d76('0x1e');var _0x3c057c=_0x1cd7de[_0x9d76('0x20')];var _0x19a3f2=_0x2eb3e5?0x0:_0xbb12e1[_0x9d76('0x1d')];var _0x148292=_0x2eb3e5?_0x1cd7de[_0x9d76('0x20')]:_0xbb12e1[_0x9d76('0x1d')]+_0xbb12e1['limit'];var _0x1ab743;if(_0x148292>=_0x3c057c){_0x148292=_0x3c057c;_0x1ab743=0xc8;}else{_0x1ab743=0xce;}_0x533841[_0x9d76('0x1c')](_0x1ab743);return _0x533841[_0x9d76('0x21')]('Content-Range',_0x19a3f2+'-'+_0x148292+'/'+_0x3c057c)['json'](_0x1cd7de);}return null;};}function patchUpdates(_0x4f1e8c){return function(_0x497bb6){try{jsonpatch[_0x9d76('0x22')](_0x497bb6,_0x4f1e8c,!![]);}catch(_0xfa4060){return BPromise[_0x9d76('0x23')](_0xfa4060);}return _0x497bb6[_0x9d76('0x24')]();};}function saveUpdates(_0x570411,_0x4fe7b3){return function(_0x189f12){if(_0x189f12){return _0x189f12[_0x9d76('0x25')](_0x570411)[_0x9d76('0x26')](function(_0x173c46){return _0x173c46;});}return null;};}function removeEntity(_0x1b6ff6,_0x41b5ca){return function(_0x2d93b3){if(_0x2d93b3){return _0x2d93b3[_0x9d76('0x27')]()[_0x9d76('0x26')](function(){var _0x47a6e1=_0x2d93b3[_0x9d76('0x28')]({'plain':!![]});var _0x36793d=_0x9d76('0x29');return db['UserProfileResource'][_0x9d76('0x27')]({'where':{'type':_0x36793d,'resourceId':_0x47a6e1['id']}})[_0x9d76('0x26')](function(){return _0x2d93b3;});})[_0x9d76('0x26')](function(){_0x1b6ff6[_0x9d76('0x1c')](0xcc)[_0x9d76('0x1b')]();});}};}function handleEntityNotFound(_0x29f8e3,_0x14a92f){return function(_0x927a44){if(!_0x927a44){_0x29f8e3['sendStatus'](0x194);}return _0x927a44;};}function handleError(_0x5ae2a7,_0x12c848){_0x12c848=_0x12c848||0x1f4;return function(_0x19357f){logger[_0x9d76('0x2a')](_0x19357f[_0x9d76('0x2b')]);if(_0x19357f[_0x9d76('0x2c')]){delete _0x19357f[_0x9d76('0x2c')];}_0x5ae2a7[_0x9d76('0x1c')](_0x12c848)[_0x9d76('0x2d')](_0x19357f);};}exports[_0x9d76('0x2e')]=function(_0x276c8b,_0x2f0df9){var _0x17fb79={},_0x4f9cec={},_0x182fa6={'count':0x0,'rows':[]};var _0xf99eb1=_[_0x9d76('0x2f')](db[_0x9d76('0x30')][_0x9d76('0x31')],function(_0x4a8710){return{'name':_0x4a8710[_0x9d76('0x32')],'type':_0x4a8710[_0x9d76('0x33')][_0x9d76('0x34')]};});_0x4f9cec[_0x9d76('0x35')]=_[_0x9d76('0x2f')](_0xf99eb1,'name');_0x4f9cec[_0x9d76('0x36')]=_['keys'](_0x276c8b[_0x9d76('0x36')]);_0x4f9cec[_0x9d76('0x37')]=_['intersection'](_0x4f9cec['model'],_0x4f9cec['query']);_0x17fb79[_0x9d76('0x38')]=_['intersection'](_0x4f9cec[_0x9d76('0x35')],qs[_0x9d76('0x39')](_0x276c8b['query'][_0x9d76('0x39')]));_0x17fb79[_0x9d76('0x38')]=_0x17fb79[_0x9d76('0x38')][_0x9d76('0x3a')]?_0x17fb79[_0x9d76('0x38')]:_0x4f9cec[_0x9d76('0x35')];if(!_0x276c8b[_0x9d76('0x36')][_0x9d76('0x3b')](_0x9d76('0x3c'))){_0x17fb79[_0x9d76('0x1f')]=qs['limit'](_0x276c8b[_0x9d76('0x36')][_0x9d76('0x1f')]);_0x17fb79[_0x9d76('0x1d')]=qs[_0x9d76('0x1d')](_0x276c8b['query'][_0x9d76('0x1d')]);}_0x17fb79[_0x9d76('0x3d')]=qs['sort'](_0x276c8b[_0x9d76('0x36')][_0x9d76('0x3e')]);_0x17fb79[_0x9d76('0x3f')]=qs[_0x9d76('0x37')](_[_0x9d76('0x40')](_0x276c8b[_0x9d76('0x36')],_0x4f9cec[_0x9d76('0x37')]),_0xf99eb1);if(_0x276c8b[_0x9d76('0x36')][_0x9d76('0x41')]){_0x17fb79[_0x9d76('0x3f')]=_[_0x9d76('0x42')](_0x17fb79[_0x9d76('0x3f')],{'$or':_[_0x9d76('0x2f')](_0xf99eb1,function(_0x273ddf){if(_0x273ddf[_0x9d76('0x33')]!==_0x9d76('0x43')){var _0x5a6117={};_0x5a6117[_0x273ddf['name']]={'$like':'%'+_0x276c8b[_0x9d76('0x36')][_0x9d76('0x41')]+'%'};return _0x5a6117;}})});}_0x17fb79=_[_0x9d76('0x42')]({},_0x17fb79,_0x276c8b[_0x9d76('0x44')]);var _0x1a6cc8={'where':_0x17fb79[_0x9d76('0x3f')]};return db[_0x9d76('0x30')][_0x9d76('0x20')](_0x1a6cc8)['then'](function(_0x3517b9){_0x182fa6[_0x9d76('0x20')]=_0x3517b9;if(_0x276c8b[_0x9d76('0x36')][_0x9d76('0x45')]){_0x17fb79[_0x9d76('0x46')]=[{'all':!![]}];}return db[_0x9d76('0x30')][_0x9d76('0x47')](_0x17fb79);})[_0x9d76('0x26')](function(_0x3d6092){_0x182fa6['rows']=_0x3d6092;return _0x182fa6;})['then'](respondWithFilteredResult(_0x2f0df9,_0x17fb79))['catch'](handleError(_0x2f0df9,null));};exports['show']=function(_0x15d1c0,_0x929845){var _0x1985bc={'raw':!![],'where':{'id':_0x15d1c0['params']['id']}},_0x514ba0={};_0x514ba0[_0x9d76('0x35')]=_[_0x9d76('0x48')](db[_0x9d76('0x30')]['rawAttributes']);_0x514ba0['query']=_[_0x9d76('0x48')](_0x15d1c0['query']);_0x514ba0['filters']=_[_0x9d76('0x49')](_0x514ba0[_0x9d76('0x35')],_0x514ba0[_0x9d76('0x36')]);_0x1985bc['attributes']=_['intersection'](_0x514ba0[_0x9d76('0x35')],qs['fields'](_0x15d1c0['query'][_0x9d76('0x39')]));_0x1985bc['attributes']=_0x1985bc['attributes'][_0x9d76('0x3a')]?_0x1985bc['attributes']:_0x514ba0[_0x9d76('0x35')];if(_0x15d1c0[_0x9d76('0x36')][_0x9d76('0x45')]){_0x1985bc[_0x9d76('0x46')]=[{'all':!![]}];}_0x1985bc=_['merge']({},_0x1985bc,_0x15d1c0['options']);return db['Sound']['find'](_0x1985bc)[_0x9d76('0x26')](handleEntityNotFound(_0x929845,null))['then'](respondWithResult(_0x929845,null))[_0x9d76('0x4a')](handleError(_0x929845,null));};exports[_0x9d76('0x4b')]=function(_0x239b4e,_0xab668,_0x59f919){return db[_0x9d76('0x30')][_0x9d76('0x4c')]({'where':{'id':_0x239b4e['params']['id']},'attributes':[_0x9d76('0x2c'),_0x9d76('0x4d'),_0x9d76('0x4e')],'raw':!![]})[_0x9d76('0x26')](handleEntityNotFound(_0xab668,null))['then'](function(_0x3008a1){if(_0x3008a1){if(!fs[_0x9d76('0x4f')](path[_0x9d76('0x50')](config[_0x9d76('0x51')],_0x9d76('0x52'),_0x3008a1[_0x9d76('0x4d')]+'.'+_0x3008a1[_0x9d76('0x4e')]))){throw new db[(_0x9d76('0x53'))][(_0x9d76('0x54'))](_0x9d76('0x55'));}return _0xab668['download'](path[_0x9d76('0x50')](config[_0x9d76('0x51')],_0x9d76('0x52'),util[_0x9d76('0x56')](_0x9d76('0x57'),_0x3008a1[_0x9d76('0x4d')],_0x3008a1[_0x9d76('0x4e')])),util[_0x9d76('0x56')](_0x9d76('0x57'),_0x3008a1[_0x9d76('0x2c')],_0x3008a1[_0x9d76('0x4e')]));}return null;})[_0x9d76('0x4a')](handleError(_0xab668,null));};exports[_0x9d76('0x58')]=function(_0x3948a2,_0x50b9a0,_0x54a105){var _0x107f70={'name':path[_0x9d76('0x59')](_0x3948a2[_0x9d76('0x5a')]['originalname'],path['extname'](_0x3948a2[_0x9d76('0x5a')]['originalname'])),'save_name':path['basename'](_0x3948a2['file'][_0x9d76('0x5b')],path[_0x9d76('0x5c')](_0x3948a2[_0x9d76('0x5a')][_0x9d76('0x5b')])),'original_format':path[_0x9d76('0x5c')](_0x3948a2['file'][_0x9d76('0x5d')])['substring'](0x1),'converted_format':'wav'};var _0x52b756=path[_0x9d76('0x50')](config[_0x9d76('0x51')],_0x9d76('0x5e'),_0x3948a2[_0x9d76('0x5a')][_0x9d76('0x5b')]);var _0x7d472c=path[_0x9d76('0x50')](config[_0x9d76('0x51')],_0x9d76('0x52'),util[_0x9d76('0x56')]('%s.%s',path[_0x9d76('0x59')](_0x3948a2[_0x9d76('0x5a')]['filename'],path[_0x9d76('0x5c')](_0x3948a2[_0x9d76('0x5a')][_0x9d76('0x5b')])),_0x107f70['converted_format']));logger[_0x9d76('0x5f')](_0x9d76('0x60'),_0x52b756);logger[_0x9d76('0x5f')](_0x9d76('0x61'),_0x7d472c);try{fs[_0x9d76('0x62')](_0x52b756,parseInt(_0x9d76('0x63'),0x8));var _0xc8fdd1=sox[_0x9d76('0x64')](_0x52b756,_0x7d472c,{'sampleRate':0x1f40,'format':_0x9d76('0x65'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xc8fdd1['on'](_0x9d76('0x2a'),function(_0x23139c){fs['unlinkSync'](_0x52b756);_0x50b9a0['status'](0x1f4)['send'](_0x23139c);});_0xc8fdd1['on'](_0x9d76('0x66'),function(_0x1fe8ca){_0x107f70['original_duration']=isNaN(_0x1fe8ca[_0x9d76('0x67')])?null:_0x1fe8ca[_0x9d76('0x67')]*0x3e8;_0x107f70['original_sampleCount']=isNaN(_0x1fe8ca[_0x9d76('0x68')])?null:_0x1fe8ca[_0x9d76('0x68')];_0x107f70[_0x9d76('0x69')]=isNaN(_0x1fe8ca[_0x9d76('0x6a')])?null:_0x1fe8ca['channelCount'];_0x107f70[_0x9d76('0x6b')]=isNaN(_0x1fe8ca['bitRate'])?null:_0x1fe8ca[_0x9d76('0x6c')];_0x107f70['original_sampleRate']=isNaN(_0x1fe8ca[_0x9d76('0x6d')])?null:_0x1fe8ca[_0x9d76('0x6d')];});_0xc8fdd1['on'](_0x9d76('0x6e'),function(_0x1cf603){_0x107f70[_0x9d76('0x6f')]=isNaN(_0x1cf603[_0x9d76('0x67')])?null:_0x1cf603['duration']*0x3e8;_0x107f70[_0x9d76('0x70')]=isNaN(_0x1cf603[_0x9d76('0x68')])?null:_0x1cf603[_0x9d76('0x68')];_0x107f70[_0x9d76('0x71')]=isNaN(_0x1cf603[_0x9d76('0x6a')])?null:_0x1cf603[_0x9d76('0x6a')];_0x107f70['converted_bitRate']=isNaN(_0x1cf603[_0x9d76('0x6c')])?null:_0x1cf603[_0x9d76('0x6c')];_0x107f70[_0x9d76('0x72')]=isNaN(_0x1cf603[_0x9d76('0x6d')])?null:_0x1cf603[_0x9d76('0x6d')];});_0xc8fdd1['on']('end',function(){fs['chmodSync'](_0x7d472c,parseInt(_0x9d76('0x63'),0x8));return db[_0x9d76('0x30')][_0x9d76('0x58')](_0x107f70)['then'](function(_0x2d35b3){var _0x3f5fad={'role':_0x3948a2[_0x9d76('0x73')]['role'],'userProfileId':_0x3948a2[_0x9d76('0x73')][_0x9d76('0x74')]};if(!_0x3f5fad)throw new Error(_0x9d76('0x75'));if(_0x3f5fad[_0x9d76('0x76')]===_0x9d76('0x77')){var _0xfb98c2=_0x2d35b3[_0x9d76('0x28')]({'plain':!![]});return db[_0x9d76('0x78')]['find']({'where':{'name':_0x9d76('0x29'),'userProfileId':_0x3f5fad['userProfileId']},'raw':!![]})[_0x9d76('0x26')](function(_0x44e394){if(_0x44e394&&_0x44e394[_0x9d76('0x79')]===0x0){return db[_0x9d76('0x7a')][_0x9d76('0x58')]({'name':_0xfb98c2[_0x9d76('0x2c')],'resourceId':_0xfb98c2['id'],'type':_0x44e394['name'],'sectionId':_0x44e394['id']},{})[_0x9d76('0x26')](function(){return _0x2d35b3;});}else{return _0x2d35b3;}})[_0x9d76('0x4a')](function(_0x1ba70a){logger[_0x9d76('0x2a')](_0x9d76('0x7b'),_0x1ba70a);throw _0x1ba70a;});}return _0x2d35b3;})[_0x9d76('0x26')](respondWithResult(_0x50b9a0,null))['catch'](handleError(_0x50b9a0,null));});_0xc8fdd1['start']();}catch(_0x2ab9c6){_0x50b9a0['status'](0x1f4)['send'](_0x2ab9c6);}};exports['update']=function(_0x5468a7,_0x44e9ab,_0x5996d3){return db[_0x9d76('0x30')][_0x9d76('0x4c')]({'where':{'id':_0x5468a7[_0x9d76('0x7c')]['id']}})[_0x9d76('0x26')](handleEntityNotFound(_0x44e9ab,null))['then'](saveUpdates(_[_0x9d76('0x40')](_0x5468a7[_0x9d76('0x73')],['name',_0x9d76('0x7d')]),null))[_0x9d76('0x26')](respondWithResult(_0x44e9ab,null))[_0x9d76('0x4a')](handleError(_0x44e9ab,null));};exports[_0x9d76('0x7e')]=function(_0x3de166,_0x562562,_0x8d0af1){return db[_0x9d76('0x30')][_0x9d76('0x4c')]({'where':{'id':_0x3de166[_0x9d76('0x7c')]['id']}})[_0x9d76('0x26')](function(_0x559477){if(_0x559477){return _0x559477[_0x9d76('0x27')]();}})['then'](function(_0x3442b0){var _0x3e7f0d=path[_0x9d76('0x50')](config[_0x9d76('0x51')],'server/files/sounds/original',util[_0x9d76('0x56')](_0x9d76('0x57'),_0x3442b0[_0x9d76('0x4d')],_0x3442b0[_0x9d76('0x7f')]));var _0xfd1ca=path['join'](config[_0x9d76('0x51')],_0x9d76('0x52'),util[_0x9d76('0x56')]('%s.%s',_0x3442b0[_0x9d76('0x4d')],_0x3442b0[_0x9d76('0x4e')]));fs[_0x9d76('0x80')](_0x3e7f0d);fs[_0x9d76('0x80')](_0xfd1ca);return _0x3442b0;})[_0x9d76('0x26')](function(_0x428784){if(_0x428784){return _0x562562[_0x9d76('0x1c')](0xcc)[_0x9d76('0x1b')]();}})[_0x9d76('0x26')](handleEntityNotFound(_0x562562,null))['catch'](handleError(_0x562562,null));}; \ No newline at end of file +var _0x29d8=['userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','delete','original_format','rimraf','request-promise','moment','bluebird','path','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','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','save','destroy','then','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','save_name','converted_format','existsSync','root','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','filename','extname','substring','wav','join','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x29d8,0x17f));var _0x829d=function(_0x2b3d5d,_0x5b23b5){_0x2b3d5d=_0x2b3d5d-0x0;var _0x64b796=_0x29d8[_0x2b3d5d];return _0x64b796;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x829d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x829d('0x1'));var moment=require(_0x829d('0x2'));var BPromise=require(_0x829d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x829d('0x4'));var sox=require(_0x829d('0x5'));var csv=require(_0x829d('0x6'));var ejs=require(_0x829d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x829d('0x8'));var crypto=require(_0x829d('0x9'));var jsforce=require(_0x829d('0xa'));var deskjs=require(_0x829d('0xb'));var toCsv=require(_0x829d('0x6'));var querystring=require(_0x829d('0xc'));var Papa=require(_0x829d('0xd'));var Redis=require(_0x829d('0xe'));var authService=require(_0x829d('0xf'));var qs=require(_0x829d('0x10'));var as=require(_0x829d('0x11'));var hardwareService=require(_0x829d('0x12'));var logger=require(_0x829d('0x13'))(_0x829d('0x14'));var utils=require(_0x829d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x829d('0x16'))['db'];function respondWithStatusCode(_0x4de80e,_0x392c53){_0x392c53=_0x392c53||0xcc;return function(_0x2e85ca){if(_0x2e85ca){return _0x4de80e['sendStatus'](_0x392c53);}return _0x4de80e[_0x829d('0x17')](_0x392c53)[_0x829d('0x18')]();};}function respondWithResult(_0x222e78,_0x44361d){_0x44361d=_0x44361d||0xc8;return function(_0x380c4a){if(_0x380c4a){return _0x222e78[_0x829d('0x17')](_0x44361d)[_0x829d('0x19')](_0x380c4a);}};}function respondWithFilteredResult(_0x807c04,_0x1b1f1e){return function(_0x104820){if(_0x104820){var _0x28377f=typeof _0x1b1f1e[_0x829d('0x1a')]==='undefined'&&typeof _0x1b1f1e['limit']===_0x829d('0x1b');var _0x4eba64=_0x104820[_0x829d('0x1c')];var _0x4b53f5=_0x28377f?0x0:_0x1b1f1e[_0x829d('0x1a')];var _0x4f6ded=_0x28377f?_0x104820['count']:_0x1b1f1e[_0x829d('0x1a')]+_0x1b1f1e[_0x829d('0x1d')];var _0x5b7f05;if(_0x4f6ded>=_0x4eba64){_0x4f6ded=_0x4eba64;_0x5b7f05=0xc8;}else{_0x5b7f05=0xce;}_0x807c04[_0x829d('0x17')](_0x5b7f05);return _0x807c04['set'](_0x829d('0x1e'),_0x4b53f5+'-'+_0x4f6ded+'/'+_0x4eba64)['json'](_0x104820);}return null;};}function patchUpdates(_0x3c9389){return function(_0xeda41b){try{jsonpatch['apply'](_0xeda41b,_0x3c9389,!![]);}catch(_0x7f0048){return BPromise['reject'](_0x7f0048);}return _0xeda41b[_0x829d('0x1f')]();};}function saveUpdates(_0x2bf374,_0x4e1726){return function(_0x63f32e){if(_0x63f32e){return _0x63f32e['update'](_0x2bf374)['then'](function(_0x35e03f){return _0x35e03f;});}return null;};}function removeEntity(_0x395219,_0x59d08b){return function(_0x952a){if(_0x952a){return _0x952a[_0x829d('0x20')]()[_0x829d('0x21')](function(){var _0x480790=_0x952a[_0x829d('0x22')]({'plain':!![]});var _0x402166=_0x829d('0x23');return db[_0x829d('0x24')][_0x829d('0x20')]({'where':{'type':_0x402166,'resourceId':_0x480790['id']}})[_0x829d('0x21')](function(){return _0x952a;});})['then'](function(){_0x395219['status'](0xcc)[_0x829d('0x18')]();});}};}function handleEntityNotFound(_0x1f89c8,_0x4f9178){return function(_0x4f026e){if(!_0x4f026e){_0x1f89c8[_0x829d('0x25')](0x194);}return _0x4f026e;};}function handleError(_0x252e19,_0x135fd9){_0x135fd9=_0x135fd9||0x1f4;return function(_0x3fd4ba){logger[_0x829d('0x26')](_0x3fd4ba[_0x829d('0x27')]);if(_0x3fd4ba[_0x829d('0x28')]){delete _0x3fd4ba[_0x829d('0x28')];}_0x252e19[_0x829d('0x17')](_0x135fd9)[_0x829d('0x29')](_0x3fd4ba);};}exports[_0x829d('0x2a')]=function(_0x2bc7c4,_0x2100d2){var _0x36195c={},_0x8bacfc={},_0x311fed={'count':0x0,'rows':[]};var _0x36959b=_[_0x829d('0x2b')](db[_0x829d('0x2c')][_0x829d('0x2d')],function(_0x20dd90){return{'name':_0x20dd90['fieldName'],'type':_0x20dd90[_0x829d('0x2e')][_0x829d('0x2f')]};});_0x8bacfc[_0x829d('0x30')]=_['map'](_0x36959b,'name');_0x8bacfc[_0x829d('0x31')]=_[_0x829d('0x32')](_0x2bc7c4[_0x829d('0x31')]);_0x8bacfc[_0x829d('0x33')]=_[_0x829d('0x34')](_0x8bacfc[_0x829d('0x30')],_0x8bacfc['query']);_0x36195c[_0x829d('0x35')]=_[_0x829d('0x34')](_0x8bacfc[_0x829d('0x30')],qs[_0x829d('0x36')](_0x2bc7c4[_0x829d('0x31')][_0x829d('0x36')]));_0x36195c[_0x829d('0x35')]=_0x36195c[_0x829d('0x35')][_0x829d('0x37')]?_0x36195c[_0x829d('0x35')]:_0x8bacfc[_0x829d('0x30')];if(!_0x2bc7c4[_0x829d('0x31')][_0x829d('0x38')](_0x829d('0x39'))){_0x36195c[_0x829d('0x1d')]=qs[_0x829d('0x1d')](_0x2bc7c4[_0x829d('0x31')][_0x829d('0x1d')]);_0x36195c[_0x829d('0x1a')]=qs[_0x829d('0x1a')](_0x2bc7c4[_0x829d('0x31')][_0x829d('0x1a')]);}_0x36195c[_0x829d('0x3a')]=qs[_0x829d('0x3b')](_0x2bc7c4[_0x829d('0x31')]['sort']);_0x36195c[_0x829d('0x3c')]=qs[_0x829d('0x33')](_['pick'](_0x2bc7c4[_0x829d('0x31')],_0x8bacfc[_0x829d('0x33')]),_0x36959b);if(_0x2bc7c4[_0x829d('0x31')][_0x829d('0x3d')]){_0x36195c[_0x829d('0x3c')]=_['merge'](_0x36195c[_0x829d('0x3c')],{'$or':_[_0x829d('0x2b')](_0x36959b,function(_0x2c5412){if(_0x2c5412['type']!==_0x829d('0x3e')){var _0x2dc54a={};_0x2dc54a[_0x2c5412[_0x829d('0x28')]]={'$like':'%'+_0x2bc7c4[_0x829d('0x31')][_0x829d('0x3d')]+'%'};return _0x2dc54a;}})});}_0x36195c=_[_0x829d('0x3f')]({},_0x36195c,_0x2bc7c4[_0x829d('0x40')]);var _0x3d6288={'where':_0x36195c['where']};return db['Sound'][_0x829d('0x1c')](_0x3d6288)['then'](function(_0x504e7a){_0x311fed[_0x829d('0x1c')]=_0x504e7a;if(_0x2bc7c4[_0x829d('0x31')][_0x829d('0x41')]){_0x36195c[_0x829d('0x42')]=[{'all':!![]}];}return db[_0x829d('0x2c')][_0x829d('0x43')](_0x36195c);})[_0x829d('0x21')](function(_0x3215ed){_0x311fed[_0x829d('0x44')]=_0x3215ed;return _0x311fed;})['then'](respondWithFilteredResult(_0x2100d2,_0x36195c))[_0x829d('0x45')](handleError(_0x2100d2,null));};exports[_0x829d('0x46')]=function(_0x287002,_0x5a0926){var _0x3c1a8c={'raw':!![],'where':{'id':_0x287002[_0x829d('0x47')]['id']}},_0x2ff7e5={};_0x2ff7e5['model']=_['keys'](db[_0x829d('0x2c')][_0x829d('0x2d')]);_0x2ff7e5[_0x829d('0x31')]=_['keys'](_0x287002[_0x829d('0x31')]);_0x2ff7e5[_0x829d('0x33')]=_[_0x829d('0x34')](_0x2ff7e5[_0x829d('0x30')],_0x2ff7e5[_0x829d('0x31')]);_0x3c1a8c[_0x829d('0x35')]=_[_0x829d('0x34')](_0x2ff7e5[_0x829d('0x30')],qs[_0x829d('0x36')](_0x287002[_0x829d('0x31')][_0x829d('0x36')]));_0x3c1a8c[_0x829d('0x35')]=_0x3c1a8c[_0x829d('0x35')]['length']?_0x3c1a8c[_0x829d('0x35')]:_0x2ff7e5[_0x829d('0x30')];if(_0x287002[_0x829d('0x31')][_0x829d('0x41')]){_0x3c1a8c[_0x829d('0x42')]=[{'all':!![]}];}_0x3c1a8c=_[_0x829d('0x3f')]({},_0x3c1a8c,_0x287002['options']);return db[_0x829d('0x2c')]['find'](_0x3c1a8c)[_0x829d('0x21')](handleEntityNotFound(_0x5a0926,null))[_0x829d('0x21')](respondWithResult(_0x5a0926,null))[_0x829d('0x45')](handleError(_0x5a0926,null));};exports['download']=function(_0x46c107,_0x35ba0a,_0x342d1c){return db[_0x829d('0x2c')]['find']({'where':{'id':_0x46c107[_0x829d('0x47')]['id']},'attributes':['name',_0x829d('0x48'),_0x829d('0x49')],'raw':!![]})[_0x829d('0x21')](handleEntityNotFound(_0x35ba0a,null))[_0x829d('0x21')](function(_0x19e35a){if(_0x19e35a){if(!fs[_0x829d('0x4a')](path['join'](config[_0x829d('0x4b')],'server/files/sounds/converted',_0x19e35a['save_name']+'.'+_0x19e35a[_0x829d('0x49')]))){throw new db[(_0x829d('0x4c'))]['ValidationError'](_0x829d('0x4d'));}return _0x35ba0a[_0x829d('0x4e')](path['join'](config['root'],'server/files/sounds/converted',util[_0x829d('0x4f')](_0x829d('0x50'),_0x19e35a[_0x829d('0x48')],_0x19e35a[_0x829d('0x49')])),util[_0x829d('0x4f')]('%s.%s',_0x19e35a[_0x829d('0x28')],_0x19e35a[_0x829d('0x49')]));}return null;})['catch'](handleError(_0x35ba0a,null));};exports[_0x829d('0x51')]=function(_0xb0a174,_0x3cbc7f,_0x5ce733){var _0x30e2dc={'name':path[_0x829d('0x52')](_0xb0a174['file']['originalname'],path['extname'](_0xb0a174[_0x829d('0x53')]['originalname'])),'save_name':path['basename'](_0xb0a174[_0x829d('0x53')][_0x829d('0x54')],path[_0x829d('0x55')](_0xb0a174[_0x829d('0x53')][_0x829d('0x54')])),'original_format':path[_0x829d('0x55')](_0xb0a174[_0x829d('0x53')]['originalname'])[_0x829d('0x56')](0x1),'converted_format':_0x829d('0x57')};var _0x548594=path[_0x829d('0x58')](config[_0x829d('0x4b')],_0x829d('0x59'),_0xb0a174[_0x829d('0x53')]['filename']);var _0x402eb3=path[_0x829d('0x58')](config['root'],_0x829d('0x5a'),util['format'](_0x829d('0x50'),path[_0x829d('0x52')](_0xb0a174[_0x829d('0x53')][_0x829d('0x54')],path[_0x829d('0x55')](_0xb0a174[_0x829d('0x53')][_0x829d('0x54')])),_0x30e2dc[_0x829d('0x49')]));logger[_0x829d('0x5b')](_0x829d('0x5c'),_0x548594);logger[_0x829d('0x5b')](_0x829d('0x5d'),_0x402eb3);try{fs[_0x829d('0x5e')](_0x548594,parseInt(_0x829d('0x5f'),0x8));var _0x4c7ed9=sox[_0x829d('0x60')](_0x548594,_0x402eb3,{'sampleRate':0x1f40,'format':_0x829d('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4c7ed9['on'](_0x829d('0x26'),function(_0x269279){fs[_0x829d('0x61')](_0x548594);_0x3cbc7f[_0x829d('0x17')](0x1f4)[_0x829d('0x29')](_0x269279);});_0x4c7ed9['on'](_0x829d('0x62'),function(_0x3e8b8b){_0x30e2dc['original_duration']=isNaN(_0x3e8b8b[_0x829d('0x63')])?null:_0x3e8b8b['duration']*0x3e8;_0x30e2dc[_0x829d('0x64')]=isNaN(_0x3e8b8b['sampleCount'])?null:_0x3e8b8b['sampleCount'];_0x30e2dc[_0x829d('0x65')]=isNaN(_0x3e8b8b[_0x829d('0x66')])?null:_0x3e8b8b['channelCount'];_0x30e2dc[_0x829d('0x67')]=isNaN(_0x3e8b8b['bitRate'])?null:_0x3e8b8b[_0x829d('0x68')];_0x30e2dc['original_sampleRate']=isNaN(_0x3e8b8b[_0x829d('0x69')])?null:_0x3e8b8b['sampleRate'];});_0x4c7ed9['on'](_0x829d('0x6a'),function(_0xebe666){_0x30e2dc[_0x829d('0x6b')]=isNaN(_0xebe666[_0x829d('0x63')])?null:_0xebe666[_0x829d('0x63')]*0x3e8;_0x30e2dc[_0x829d('0x6c')]=isNaN(_0xebe666['sampleCount'])?null:_0xebe666['sampleCount'];_0x30e2dc['converted_channelCount']=isNaN(_0xebe666[_0x829d('0x66')])?null:_0xebe666[_0x829d('0x66')];_0x30e2dc[_0x829d('0x6d')]=isNaN(_0xebe666['bitRate'])?null:_0xebe666[_0x829d('0x68')];_0x30e2dc[_0x829d('0x6e')]=isNaN(_0xebe666['sampleRate'])?null:_0xebe666[_0x829d('0x69')];});_0x4c7ed9['on'](_0x829d('0x18'),function(){fs[_0x829d('0x5e')](_0x402eb3,parseInt(_0x829d('0x5f'),0x8));return db[_0x829d('0x2c')][_0x829d('0x51')](_0x30e2dc)[_0x829d('0x21')](function(_0x356144){var _0xa6f480={'role':_0xb0a174[_0x829d('0x6f')][_0x829d('0x70')],'userProfileId':_0xb0a174[_0x829d('0x6f')][_0x829d('0x71')]};if(!_0xa6f480)throw new Error(_0x829d('0x72'));if(_0xa6f480[_0x829d('0x70')]===_0x829d('0x73')){var _0x33ec89=_0x356144[_0x829d('0x22')]({'plain':!![]});return db[_0x829d('0x74')][_0x829d('0x75')]({'where':{'name':_0x829d('0x23'),'userProfileId':_0xa6f480[_0x829d('0x71')]},'raw':!![]})[_0x829d('0x21')](function(_0x17c1a4){if(_0x17c1a4&&_0x17c1a4['autoAssociation']===0x0){return db[_0x829d('0x24')]['create']({'name':_0x33ec89['name'],'resourceId':_0x33ec89['id'],'type':_0x17c1a4[_0x829d('0x28')],'sectionId':_0x17c1a4['id']},{})[_0x829d('0x21')](function(){return _0x356144;});}else{return _0x356144;}})[_0x829d('0x45')](function(_0x530710){logger['error'](_0x829d('0x76'),_0x530710);throw _0x530710;});}return _0x356144;})[_0x829d('0x21')](respondWithResult(_0x3cbc7f,null))[_0x829d('0x45')](handleError(_0x3cbc7f,null));});_0x4c7ed9[_0x829d('0x77')]();}catch(_0xc7fc43){_0x3cbc7f[_0x829d('0x17')](0x1f4)[_0x829d('0x29')](_0xc7fc43);}};exports[_0x829d('0x78')]=function(_0x24c297,_0x1c6a40,_0x2c145c){return db[_0x829d('0x2c')][_0x829d('0x75')]({'where':{'id':_0x24c297['params']['id']}})[_0x829d('0x21')](handleEntityNotFound(_0x1c6a40,null))[_0x829d('0x21')](saveUpdates(_[_0x829d('0x79')](_0x24c297[_0x829d('0x6f')],[_0x829d('0x28'),'description']),null))[_0x829d('0x21')](respondWithResult(_0x1c6a40,null))[_0x829d('0x45')](handleError(_0x1c6a40,null));};exports[_0x829d('0x7a')]=function(_0x2c59de,_0x56282a,_0x55bdcc){return db[_0x829d('0x2c')][_0x829d('0x75')]({'where':{'id':_0x2c59de[_0x829d('0x47')]['id']}})[_0x829d('0x21')](function(_0x48106b){if(_0x48106b){return _0x48106b[_0x829d('0x20')]();}})[_0x829d('0x21')](function(_0x29a24d){var _0x52c99f=path[_0x829d('0x58')](config[_0x829d('0x4b')],'server/files/sounds/original',util[_0x829d('0x4f')](_0x829d('0x50'),_0x29a24d['save_name'],_0x29a24d[_0x829d('0x7b')]));var _0x73a1d7=path[_0x829d('0x58')](config[_0x829d('0x4b')],_0x829d('0x5a'),util[_0x829d('0x4f')](_0x829d('0x50'),_0x29a24d[_0x829d('0x48')],_0x29a24d[_0x829d('0x49')]));fs['unlinkSync'](_0x52c99f);fs[_0x829d('0x61')](_0x73a1d7);return _0x29a24d;})['then'](function(_0x21664c){if(_0x21664c){return _0x56282a['status'](0xcc)[_0x829d('0x18')]();}})[_0x829d('0x21')](handleEntityNotFound(_0x56282a,null))[_0x829d('0x45')](handleError(_0x56282a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index cfa9cee..7b0d055 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 _0x9a67=['rimraf','./sound.attributes','exports','tools_sounds','lodash','../../config/logger','api','bluebird','path'];(function(_0x428586,_0x5dabcb){var _0xabde22=function(_0xa64e6b){while(--_0xa64e6b){_0x428586['push'](_0x428586['shift']());}};_0xabde22(++_0x5dabcb);}(_0x9a67,0xca));var _0x79a6=function(_0x58f6b2,_0x834e0a){_0x58f6b2=_0x58f6b2-0x0;var _0x21d159=_0x9a67[_0x58f6b2];return _0x21d159;};'use strict';var _=require(_0x79a6('0x0'));var util=require('util');var logger=require(_0x79a6('0x1'))(_0x79a6('0x2'));var moment=require('moment');var BPromise=require(_0x79a6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79a6('0x4'));var rimraf=require(_0x79a6('0x5'));var config=require('../../config/environment');var attributes=require(_0x79a6('0x6'));module[_0x79a6('0x7')]=function(_0xa52e5f,_0x37f4dc){return _0xa52e5f['define']('Sound',attributes,{'tableName':_0x79a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadf4=['request-promise','path','rimraf','../../config/environment','./sound.attributes','define','../../config/logger','api','moment','bluebird'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0xadf4,0x132));var _0x4adf=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0xadf4[_0x254b22];return _0x1279db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4adf('0x0'))(_0x4adf('0x1'));var moment=require(_0x4adf('0x2'));var BPromise=require(_0x4adf('0x3'));var rp=require(_0x4adf('0x4'));var fs=require('fs');var path=require(_0x4adf('0x5'));var rimraf=require(_0x4adf('0x6'));var config=require(_0x4adf('0x7'));var attributes=require(_0x4adf('0x8'));module['exports']=function(_0x3b8832,_0x170f5b){return _0x3b8832[_0x4adf('0x9')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 5f16480..3d4ec60 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 _0x4570=['find','options','raw','where','attributes','include','model','map','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0x4570,0x129));var _0x0457=function(_0x1040c8,_0x1baa50){_0x1040c8=_0x1040c8-0x0;var _0x5d0df0=_0x4570[_0x1040c8];return _0x5d0df0;};'use strict';var _=require(_0x0457('0x0'));var util=require(_0x0457('0x1'));var moment=require(_0x0457('0x2'));var BPromise=require(_0x0457('0x3'));var rs=require(_0x0457('0x4'));var fs=require('fs');var Redis=require(_0x0457('0x5'));var db=require(_0x0457('0x6'))['db'];var utils=require(_0x0457('0x7'));var logger=require(_0x0457('0x8'))(_0x0457('0x9'));var config=require(_0x0457('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0457('0xb')][_0x0457('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54acd7,_0x4c92cc,_0x559952){return new BPromise(function(_0x4a2032,_0x3f8b64){return client[_0x0457('0xd')](_0x54acd7,_0x559952)[_0x0457('0xe')](function(_0x22157e){logger[_0x0457('0xf')](_0x0457('0x10'),_0x4c92cc,_0x0457('0x11'));logger['debug'](_0x0457('0x12'),_0x4c92cc,_0x0457('0x11'),JSON[_0x0457('0x13')](_0x22157e));if(_0x22157e[_0x0457('0x14')]){if(_0x22157e[_0x0457('0x14')][_0x0457('0x15')]===0x1f4){logger[_0x0457('0x14')](_0x0457('0x10'),_0x4c92cc,_0x22157e['error']['message']);return _0x3f8b64(_0x22157e[_0x0457('0x14')]['message']);}logger[_0x0457('0x14')](_0x0457('0x10'),_0x4c92cc,_0x22157e[_0x0457('0x14')][_0x0457('0x16')]);return _0x4a2032(_0x22157e['error'][_0x0457('0x16')]);}else{logger[_0x0457('0xf')]('Sound,\x20%s,\x20%s',_0x4c92cc,_0x0457('0x11'));_0x4a2032(_0x22157e[_0x0457('0x17')][_0x0457('0x16')]);}})[_0x0457('0x18')](function(_0x3ae336){logger[_0x0457('0x14')](_0x0457('0x10'),_0x4c92cc,_0x3ae336);_0x3f8b64(_0x3ae336);});});}exports[_0x0457('0x19')]=function(_0x15ce53){var _0x4d1aa7=this;return new Promise(function(_0x91cbfc,_0x4077f7){return db[_0x0457('0x1a')][_0x0457('0x1b')]({'raw':_0x15ce53[_0x0457('0x1c')]?_0x15ce53[_0x0457('0x1c')][_0x0457('0x1d')]===undefined?!![]:![]:!![],'where':_0x15ce53['options']?_0x15ce53[_0x0457('0x1c')][_0x0457('0x1e')]||null:null,'attributes':_0x15ce53['options']?_0x15ce53[_0x0457('0x1c')][_0x0457('0x1f')]||null:null,'include':_0x15ce53[_0x0457('0x1c')]?_0x15ce53[_0x0457('0x1c')][_0x0457('0x20')]?_['map'](_0x15ce53[_0x0457('0x1c')][_0x0457('0x20')],function(_0x1556af){return{'model':db[_0x1556af[_0x0457('0x21')]],'as':_0x1556af['as'],'attributes':_0x1556af[_0x0457('0x1f')],'include':_0x1556af[_0x0457('0x20')]?_[_0x0457('0x22')](_0x1556af[_0x0457('0x20')],function(_0x1e49f8){return{'model':db[_0x1e49f8[_0x0457('0x21')]],'as':_0x1e49f8['as'],'attributes':_0x1e49f8[_0x0457('0x1f')],'include':_0x1e49f8[_0x0457('0x20')]?_[_0x0457('0x22')](_0x1e49f8['include'],function(_0x4468fa){return{'model':db[_0x4468fa[_0x0457('0x21')]],'as':_0x4468fa['as'],'attributes':_0x4468fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x0457('0xe')](function(_0x97ec92){logger[_0x0457('0xf')]('ShowSound',_0x15ce53);logger[_0x0457('0x23')](_0x0457('0x19'),_0x15ce53,JSON[_0x0457('0x13')](_0x97ec92));_0x91cbfc(_0x97ec92);})[_0x0457('0x18')](function(_0x5d0e8d){logger[_0x0457('0x14')](_0x0457('0x19'),_0x5d0e8d['message'],_0x15ce53);_0x4077f7(_0x4d1aa7[_0x0457('0x14')](0x1f4,_0x5d0e8d['message']));});});}; \ No newline at end of file +var _0xa8bd=['message','result','catch','find','options','where','attributes','map','include','model','then','ShowSound','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xa8bd,0x85));var _0xda8b=function(_0x47ea50,_0x4f713f){_0x47ea50=_0x47ea50-0x0;var _0x4986bb=_0xa8bd[_0x47ea50];return _0x4986bb;};'use strict';var _=require(_0xda8b('0x0'));var util=require(_0xda8b('0x1'));var moment=require(_0xda8b('0x2'));var BPromise=require(_0xda8b('0x3'));var rs=require(_0xda8b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda8b('0x6'))(_0xda8b('0x7'));var config=require(_0xda8b('0x8'));var jayson=require(_0xda8b('0x9'));var client=jayson[_0xda8b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9c14,_0x243ae1,_0x561e3b){return new BPromise(function(_0xe6d649,_0x4e9037){return client['request'](_0x2c9c14,_0x561e3b)['then'](function(_0x80285){logger[_0xda8b('0xb')](_0xda8b('0xc'),_0x243ae1,_0xda8b('0xd'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x243ae1,_0xda8b('0xd'),JSON[_0xda8b('0xe')](_0x80285));if(_0x80285[_0xda8b('0xf')]){if(_0x80285[_0xda8b('0xf')][_0xda8b('0x10')]===0x1f4){logger[_0xda8b('0xf')]('Sound,\x20%s,\x20%s',_0x243ae1,_0x80285['error'][_0xda8b('0x11')]);return _0x4e9037(_0x80285[_0xda8b('0xf')][_0xda8b('0x11')]);}logger[_0xda8b('0xf')](_0xda8b('0xc'),_0x243ae1,_0x80285[_0xda8b('0xf')][_0xda8b('0x11')]);return _0xe6d649(_0x80285[_0xda8b('0xf')]['message']);}else{logger[_0xda8b('0xb')](_0xda8b('0xc'),_0x243ae1,_0xda8b('0xd'));_0xe6d649(_0x80285[_0xda8b('0x12')][_0xda8b('0x11')]);}})[_0xda8b('0x13')](function(_0x19873b){logger[_0xda8b('0xf')](_0xda8b('0xc'),_0x243ae1,_0x19873b);_0x4e9037(_0x19873b);});});}exports['ShowSound']=function(_0x1be4f2){var _0x3d5819=this;return new Promise(function(_0x2a7ef9,_0x277477){return db['Sound'][_0xda8b('0x14')]({'raw':_0x1be4f2[_0xda8b('0x15')]?_0x1be4f2[_0xda8b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1be4f2[_0xda8b('0x15')]?_0x1be4f2[_0xda8b('0x15')][_0xda8b('0x16')]||null:null,'attributes':_0x1be4f2[_0xda8b('0x15')]?_0x1be4f2[_0xda8b('0x15')][_0xda8b('0x17')]||null:null,'include':_0x1be4f2[_0xda8b('0x15')]?_0x1be4f2[_0xda8b('0x15')]['include']?_[_0xda8b('0x18')](_0x1be4f2[_0xda8b('0x15')][_0xda8b('0x19')],function(_0x45d622){return{'model':db[_0x45d622[_0xda8b('0x1a')]],'as':_0x45d622['as'],'attributes':_0x45d622[_0xda8b('0x17')],'include':_0x45d622[_0xda8b('0x19')]?_[_0xda8b('0x18')](_0x45d622[_0xda8b('0x19')],function(_0x1e1ad2){return{'model':db[_0x1e1ad2[_0xda8b('0x1a')]],'as':_0x1e1ad2['as'],'attributes':_0x1e1ad2[_0xda8b('0x17')],'include':_0x1e1ad2[_0xda8b('0x19')]?_['map'](_0x1e1ad2['include'],function(_0x455b7d){return{'model':db[_0x455b7d['model']],'as':_0x455b7d['as'],'attributes':_0x455b7d[_0xda8b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xda8b('0x1b')](function(_0x5737bb){logger[_0xda8b('0xb')](_0xda8b('0x1c'),_0x1be4f2);logger[_0xda8b('0x1d')](_0xda8b('0x1c'),_0x1be4f2,JSON[_0xda8b('0xe')](_0x5737bb));_0x2a7ef9(_0x5737bb);})[_0xda8b('0x13')](function(_0x2f6614){logger[_0xda8b('0xf')](_0xda8b('0x1c'),_0x2f6614[_0xda8b('0x11')],_0x1be4f2);_0x277477(_0x3d5819[_0xda8b('0xf')](0x1f4,_0x2f6614[_0xda8b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ebb889e..6cba960 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(_0x14d042,_0x19eaea){var _0x28f422=function(_0x351c7c){while(--_0x351c7c){_0x14d042['push'](_0x14d042['shift']());}};_0x28f422(++_0x19eaea);}(_0xda3f,0xec));var _0xfda3=function(_0x2e0fef,_0x3aea5a){_0x2e0fef=_0x2e0fef-0x0;var _0x537ece=_0xda3f[_0x2e0fef];return _0x537ece;};'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 _0x0b0e=['./squareMessage.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(_0x21dc70,_0x287214){var _0x47e638=function(_0x41445d){while(--_0x41445d){_0x21dc70['push'](_0x21dc70['shift']());}};_0x47e638(++_0x287214);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2cde2a,_0x4325c4){_0x2cde2a=_0x2cde2a-0x0;var _0x110f55=_0x0b0e[_0x2cde2a];return _0x110f55;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a5f04d7..9c8f82e 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 _0x9055=['medium','ENUM','out','sequelize','STRING','TEXT'];(function(_0x26a5f2,_0x1a8f7c){var _0x11eb73=function(_0x2dec8e){while(--_0x2dec8e){_0x26a5f2['push'](_0x26a5f2['shift']());}};_0x11eb73(++_0x1a8f7c);}(_0x9055,0x1a1));var _0x5905=function(_0x4362c4,_0x57b51f){_0x4362c4=_0x4362c4-0x0;var _0x4e2876=_0x9055[_0x4362c4];return _0x4e2876;};'use strict';var Sequelize=require(_0x5905('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5905('0x1')]},'body':{'type':Sequelize[_0x5905('0x2')](_0x5905('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x5905('0x4')]('in',_0x5905('0x5')),'defaultValue':_0x5905('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5905('0x1')]},'providerResponse':{'type':Sequelize[_0x5905('0x2')]}}; \ No newline at end of file +var _0x3ee0=['exports','STRING','TEXT','ENUM','sequelize'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x3ee0,0x9f));var _0x03ee=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3ee0[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x03ee('0x0'));module[_0x03ee('0x1')]={'uniqueid':{'type':Sequelize[_0x03ee('0x2')]},'body':{'type':Sequelize[_0x03ee('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x03ee('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x03ee('0x2')]},'providerResponse':{'type':Sequelize[_0x03ee('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f058e46..6b42e4d 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 _0xd5eb=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','params','keys','includeAll','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x1023c6,_0x53f56a){var _0x40b1f1=function(_0x5a9777){while(--_0x5a9777){_0x1023c6['push'](_0x1023c6['shift']());}};_0x40b1f1(++_0x53f56a);}(_0xd5eb,0x183));var _0xbd5e=function(_0x3edd95,_0x4acc0d){_0x3edd95=_0x3edd95-0x0;var _0x35e999=_0xd5eb[_0x3edd95];return _0x35e999;};'use strict';var emlformat=require(_0xbd5e('0x0'));var rimraf=require(_0xbd5e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd5e('0x2'));var rp=require(_0xbd5e('0x3'));var moment=require(_0xbd5e('0x4'));var BPromise=require(_0xbd5e('0x5'));var Mustache=require(_0xbd5e('0x6'));var util=require(_0xbd5e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd5e('0x8'));var fs=require('fs');var fs_extra=require(_0xbd5e('0x9'));var _=require('lodash');var squel=require(_0xbd5e('0xa'));var crypto=require(_0xbd5e('0xb'));var jsforce=require(_0xbd5e('0xc'));var deskjs=require(_0xbd5e('0xd'));var toCsv=require(_0xbd5e('0xe'));var querystring=require(_0xbd5e('0xf'));var Papa=require(_0xbd5e('0x10'));var Redis=require('ioredis');var authService=require(_0xbd5e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbd5e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd5e('0x13'))(_0xbd5e('0x14'));var utils=require(_0xbd5e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbd5e('0x16'));var db=require(_0xbd5e('0x17'))['db'];function respondWithStatusCode(_0x38c96d,_0x1951a5){_0x1951a5=_0x1951a5||0xcc;return function(_0x3b5c58){if(_0x3b5c58){return _0x38c96d[_0xbd5e('0x18')](_0x1951a5);}return _0x38c96d[_0xbd5e('0x19')](_0x1951a5)[_0xbd5e('0x1a')]();};}function respondWithResult(_0x369e7d,_0x408172){_0x408172=_0x408172||0xc8;return function(_0x4d3277){if(_0x4d3277){return _0x369e7d[_0xbd5e('0x19')](_0x408172)['json'](_0x4d3277);}};}function respondWithFilteredResult(_0x5cac38,_0x1bfa29){return function(_0x4eec01){if(_0x4eec01){var _0x57f8c9=typeof _0x1bfa29[_0xbd5e('0x1b')]===_0xbd5e('0x1c')&&typeof _0x1bfa29[_0xbd5e('0x1d')]===_0xbd5e('0x1c');var _0x55ab78=_0x4eec01[_0xbd5e('0x1e')];var _0xee4f1=_0x57f8c9?0x0:_0x1bfa29['offset'];var _0x444485=_0x57f8c9?_0x4eec01[_0xbd5e('0x1e')]:_0x1bfa29[_0xbd5e('0x1b')]+_0x1bfa29[_0xbd5e('0x1d')];var _0x5e0403;if(_0x444485>=_0x55ab78){_0x444485=_0x55ab78;_0x5e0403=0xc8;}else{_0x5e0403=0xce;}_0x5cac38[_0xbd5e('0x19')](_0x5e0403);return _0x5cac38[_0xbd5e('0x1f')]('Content-Range',_0xee4f1+'-'+_0x444485+'/'+_0x55ab78)[_0xbd5e('0x20')](_0x4eec01);}return null;};}function patchUpdates(_0x58d940){return function(_0x5ea1dd){try{jsonpatch['apply'](_0x5ea1dd,_0x58d940,!![]);}catch(_0x57f8df){return BPromise[_0xbd5e('0x21')](_0x57f8df);}return _0x5ea1dd[_0xbd5e('0x22')]();};}function saveUpdates(_0xceafe4,_0x74ab2d){return function(_0xdf174b){if(_0xdf174b){return _0xdf174b[_0xbd5e('0x23')](_0xceafe4)[_0xbd5e('0x24')](function(_0x46953a){return _0x46953a;});}return null;};}function removeEntity(_0xb81b86,_0x36bf14){return function(_0x9fc3d){if(_0x9fc3d){return _0x9fc3d[_0xbd5e('0x25')]()['then'](function(){_0xb81b86[_0xbd5e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f387d,_0x4ee632){return function(_0x10f812){if(!_0x10f812){_0x5f387d['sendStatus'](0x194);}return _0x10f812;};}function handleError(_0x2798a9,_0x84baf3){_0x84baf3=_0x84baf3||0x1f4;return function(_0x446b85){logger['error'](_0x446b85[_0xbd5e('0x26')]);if(_0x446b85[_0xbd5e('0x27')]){delete _0x446b85['name'];}_0x2798a9[_0xbd5e('0x19')](_0x84baf3)[_0xbd5e('0x28')](_0x446b85);};}exports[_0xbd5e('0x29')]=function(_0x1ced21,_0x3dcc17){var _0x3789ec={},_0x115deb={},_0x202408={'count':0x0,'rows':[]};var _0x270370=_[_0xbd5e('0x2a')](db[_0xbd5e('0x2b')][_0xbd5e('0x2c')],function(_0x2201a7){return{'name':_0x2201a7[_0xbd5e('0x2d')],'type':_0x2201a7[_0xbd5e('0x2e')][_0xbd5e('0x2f')]};});_0x115deb[_0xbd5e('0x30')]=_[_0xbd5e('0x2a')](_0x270370,'name');_0x115deb[_0xbd5e('0x31')]=_['keys'](_0x1ced21[_0xbd5e('0x31')]);_0x115deb[_0xbd5e('0x32')]=_[_0xbd5e('0x33')](_0x115deb[_0xbd5e('0x30')],_0x115deb[_0xbd5e('0x31')]);_0x3789ec['attributes']=_['intersection'](_0x115deb[_0xbd5e('0x30')],qs[_0xbd5e('0x34')](_0x1ced21[_0xbd5e('0x31')][_0xbd5e('0x34')]));_0x3789ec[_0xbd5e('0x35')]=_0x3789ec[_0xbd5e('0x35')][_0xbd5e('0x36')]?_0x3789ec['attributes']:_0x115deb['model'];if(!_0x1ced21[_0xbd5e('0x31')][_0xbd5e('0x37')](_0xbd5e('0x38'))){_0x3789ec['limit']=qs['limit'](_0x1ced21['query'][_0xbd5e('0x1d')]);_0x3789ec[_0xbd5e('0x1b')]=qs[_0xbd5e('0x1b')](_0x1ced21[_0xbd5e('0x31')]['offset']);}_0x3789ec[_0xbd5e('0x39')]=qs[_0xbd5e('0x3a')](_0x1ced21['query'][_0xbd5e('0x3a')]);_0x3789ec[_0xbd5e('0x3b')]=qs[_0xbd5e('0x32')](_[_0xbd5e('0x3c')](_0x1ced21[_0xbd5e('0x31')],_0x115deb[_0xbd5e('0x32')]),_0x270370);if(_0x1ced21['query']['filter']){_0x3789ec[_0xbd5e('0x3b')]=_[_0xbd5e('0x3d')](_0x3789ec[_0xbd5e('0x3b')],{'$or':_[_0xbd5e('0x2a')](_0x270370,function(_0x4055cc){if(_0x4055cc[_0xbd5e('0x2e')]!=='VIRTUAL'){var _0x413949={};_0x413949[_0x4055cc[_0xbd5e('0x27')]]={'$like':'%'+_0x1ced21['query'][_0xbd5e('0x3e')]+'%'};return _0x413949;}})});}_0x3789ec=_['merge']({},_0x3789ec,_0x1ced21[_0xbd5e('0x3f')]);var _0x2e4b99={'where':_0x3789ec[_0xbd5e('0x3b')]};return db[_0xbd5e('0x2b')][_0xbd5e('0x1e')](_0x2e4b99)[_0xbd5e('0x24')](function(_0x3374a1){_0x202408[_0xbd5e('0x1e')]=_0x3374a1;if(_0x1ced21[_0xbd5e('0x31')]['includeAll']){_0x3789ec[_0xbd5e('0x40')]=[{'all':!![]}];}return db['SquareMessage'][_0xbd5e('0x41')](_0x3789ec);})[_0xbd5e('0x24')](function(_0x4a3694){_0x202408['rows']=_0x4a3694;return _0x202408;})['then'](respondWithFilteredResult(_0x3dcc17,_0x3789ec))[_0xbd5e('0x42')](handleError(_0x3dcc17,null));};exports[_0xbd5e('0x43')]=function(_0x38e2d2,_0x1d920f){var _0x3fd7a8={'raw':!![],'where':{'id':_0x38e2d2[_0xbd5e('0x44')]['id']}},_0x41fa37={};_0x41fa37[_0xbd5e('0x30')]=_[_0xbd5e('0x45')](db[_0xbd5e('0x2b')]['rawAttributes']);_0x41fa37[_0xbd5e('0x31')]=_[_0xbd5e('0x45')](_0x38e2d2['query']);_0x41fa37[_0xbd5e('0x32')]=_[_0xbd5e('0x33')](_0x41fa37[_0xbd5e('0x30')],_0x41fa37['query']);_0x3fd7a8[_0xbd5e('0x35')]=_[_0xbd5e('0x33')](_0x41fa37[_0xbd5e('0x30')],qs[_0xbd5e('0x34')](_0x38e2d2[_0xbd5e('0x31')][_0xbd5e('0x34')]));_0x3fd7a8[_0xbd5e('0x35')]=_0x3fd7a8['attributes']['length']?_0x3fd7a8[_0xbd5e('0x35')]:_0x41fa37[_0xbd5e('0x30')];if(_0x38e2d2[_0xbd5e('0x31')][_0xbd5e('0x46')]){_0x3fd7a8[_0xbd5e('0x40')]=[{'all':!![]}];}_0x3fd7a8=_[_0xbd5e('0x3d')]({},_0x3fd7a8,_0x38e2d2[_0xbd5e('0x3f')]);return db[_0xbd5e('0x2b')]['find'](_0x3fd7a8)[_0xbd5e('0x24')](handleEntityNotFound(_0x1d920f,null))[_0xbd5e('0x24')](respondWithResult(_0x1d920f,null))[_0xbd5e('0x42')](handleError(_0x1d920f,null));};exports['create']=function(_0x2de5c6,_0x803ce4){return db['SquareMessage']['create'](_0x2de5c6[_0xbd5e('0x47')],{})[_0xbd5e('0x24')](respondWithResult(_0x803ce4,0xc9))['catch'](handleError(_0x803ce4,null));};exports[_0xbd5e('0x23')]=function(_0x198ba3,_0x135ef4){if(_0x198ba3[_0xbd5e('0x47')]['id']){delete _0x198ba3[_0xbd5e('0x47')]['id'];}return db[_0xbd5e('0x2b')][_0xbd5e('0x48')]({'where':{'id':_0x198ba3[_0xbd5e('0x44')]['id']}})[_0xbd5e('0x24')](handleEntityNotFound(_0x135ef4,null))[_0xbd5e('0x24')](saveUpdates(_0x198ba3[_0xbd5e('0x47')],null))['then'](respondWithResult(_0x135ef4,null))[_0xbd5e('0x42')](handleError(_0x135ef4,null));};exports[_0xbd5e('0x25')]=function(_0x543de0,_0x35bd1a){return db[_0xbd5e('0x2b')][_0xbd5e('0x48')]({'where':{'id':_0x543de0[_0xbd5e('0x44')]['id']}})['then'](handleEntityNotFound(_0x35bd1a,null))[_0xbd5e('0x24')](removeEntity(_0x35bd1a,null))[_0xbd5e('0x42')](handleError(_0x35bd1a,null));}; \ No newline at end of file +var _0x5098=['destroy','sendStatus','error','stack','name','send','index','map','SquareMessage','model','query','filters','attributes','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','rawAttributes','intersection','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','reject','update','then'];(function(_0x461c39,_0x2ffc4e){var _0x149a9b=function(_0x2c5463){while(--_0x2c5463){_0x461c39['push'](_0x461c39['shift']());}};_0x149a9b(++_0x2ffc4e);}(_0x5098,0x6a));var _0x8509=function(_0x27aece,_0x17c34e){_0x27aece=_0x27aece-0x0;var _0x367735=_0x5098[_0x27aece];return _0x367735;};'use strict';var emlformat=require(_0x8509('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8509('0x1'));var jsonpatch=require(_0x8509('0x2'));var rp=require(_0x8509('0x3'));var moment=require(_0x8509('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8509('0x5'));var util=require(_0x8509('0x6'));var path=require(_0x8509('0x7'));var sox=require(_0x8509('0x8'));var csv=require(_0x8509('0x9'));var ejs=require(_0x8509('0xa'));var fs=require('fs');var fs_extra=require(_0x8509('0xb'));var _=require(_0x8509('0xc'));var squel=require(_0x8509('0xd'));var crypto=require('crypto');var jsforce=require(_0x8509('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8509('0x9'));var querystring=require(_0x8509('0xf'));var Papa=require(_0x8509('0x10'));var Redis=require('ioredis');var authService=require(_0x8509('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8509('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8509('0x13'));var config=require(_0x8509('0x14'));var licenseUtil=require(_0x8509('0x15'));var db=require(_0x8509('0x16'))['db'];function respondWithStatusCode(_0x21b1a9,_0xc1d252){_0xc1d252=_0xc1d252||0xcc;return function(_0xae59d4){if(_0xae59d4){return _0x21b1a9['sendStatus'](_0xc1d252);}return _0x21b1a9[_0x8509('0x17')](_0xc1d252)[_0x8509('0x18')]();};}function respondWithResult(_0x5937d9,_0x1a45ee){_0x1a45ee=_0x1a45ee||0xc8;return function(_0x407fa7){if(_0x407fa7){return _0x5937d9[_0x8509('0x17')](_0x1a45ee)['json'](_0x407fa7);}};}function respondWithFilteredResult(_0x3fa86d,_0x4227d1){return function(_0x35e1ff){if(_0x35e1ff){var _0x12fcbe=typeof _0x4227d1[_0x8509('0x19')]==='undefined'&&typeof _0x4227d1[_0x8509('0x1a')]===_0x8509('0x1b');var _0x5c54ca=_0x35e1ff[_0x8509('0x1c')];var _0x7aacda=_0x12fcbe?0x0:_0x4227d1['offset'];var _0x16153e=_0x12fcbe?_0x35e1ff[_0x8509('0x1c')]:_0x4227d1[_0x8509('0x19')]+_0x4227d1['limit'];var _0x3678c4;if(_0x16153e>=_0x5c54ca){_0x16153e=_0x5c54ca;_0x3678c4=0xc8;}else{_0x3678c4=0xce;}_0x3fa86d['status'](_0x3678c4);return _0x3fa86d['set'](_0x8509('0x1d'),_0x7aacda+'-'+_0x16153e+'/'+_0x5c54ca)[_0x8509('0x1e')](_0x35e1ff);}return null;};}function patchUpdates(_0x3524f2){return function(_0x3d3847){try{jsonpatch['apply'](_0x3d3847,_0x3524f2,!![]);}catch(_0x822924){return BPromise[_0x8509('0x1f')](_0x822924);}return _0x3d3847['save']();};}function saveUpdates(_0x20e2e3,_0x1d630b){return function(_0x5eb4b9){if(_0x5eb4b9){return _0x5eb4b9[_0x8509('0x20')](_0x20e2e3)[_0x8509('0x21')](function(_0x325306){return _0x325306;});}return null;};}function removeEntity(_0x518684,_0x529c7f){return function(_0x2fd0b4){if(_0x2fd0b4){return _0x2fd0b4[_0x8509('0x22')]()['then'](function(){_0x518684[_0x8509('0x17')](0xcc)[_0x8509('0x18')]();});}};}function handleEntityNotFound(_0x5be63c,_0x3d110a){return function(_0x4edb6a){if(!_0x4edb6a){_0x5be63c[_0x8509('0x23')](0x194);}return _0x4edb6a;};}function handleError(_0x28efec,_0x14450d){_0x14450d=_0x14450d||0x1f4;return function(_0x64b55f){logger[_0x8509('0x24')](_0x64b55f[_0x8509('0x25')]);if(_0x64b55f['name']){delete _0x64b55f[_0x8509('0x26')];}_0x28efec['status'](_0x14450d)[_0x8509('0x27')](_0x64b55f);};}exports[_0x8509('0x28')]=function(_0x4ae060,_0x211f34){var _0xd9abf0={},_0x2aa947={},_0xc290a7={'count':0x0,'rows':[]};var _0x2b9b30=_[_0x8509('0x29')](db[_0x8509('0x2a')]['rawAttributes'],function(_0x5c1021){return{'name':_0x5c1021['fieldName'],'type':_0x5c1021['type']['key']};});_0x2aa947[_0x8509('0x2b')]=_['map'](_0x2b9b30,_0x8509('0x26'));_0x2aa947[_0x8509('0x2c')]=_['keys'](_0x4ae060[_0x8509('0x2c')]);_0x2aa947[_0x8509('0x2d')]=_['intersection'](_0x2aa947[_0x8509('0x2b')],_0x2aa947['query']);_0xd9abf0[_0x8509('0x2e')]=_['intersection'](_0x2aa947[_0x8509('0x2b')],qs[_0x8509('0x2f')](_0x4ae060[_0x8509('0x2c')][_0x8509('0x2f')]));_0xd9abf0['attributes']=_0xd9abf0[_0x8509('0x2e')][_0x8509('0x30')]?_0xd9abf0[_0x8509('0x2e')]:_0x2aa947[_0x8509('0x2b')];if(!_0x4ae060[_0x8509('0x2c')]['hasOwnProperty'](_0x8509('0x31'))){_0xd9abf0['limit']=qs[_0x8509('0x1a')](_0x4ae060[_0x8509('0x2c')][_0x8509('0x1a')]);_0xd9abf0[_0x8509('0x19')]=qs[_0x8509('0x19')](_0x4ae060[_0x8509('0x2c')]['offset']);}_0xd9abf0['order']=qs[_0x8509('0x32')](_0x4ae060[_0x8509('0x2c')]['sort']);_0xd9abf0[_0x8509('0x33')]=qs[_0x8509('0x2d')](_[_0x8509('0x34')](_0x4ae060['query'],_0x2aa947[_0x8509('0x2d')]),_0x2b9b30);if(_0x4ae060[_0x8509('0x2c')][_0x8509('0x35')]){_0xd9abf0[_0x8509('0x33')]=_['merge'](_0xd9abf0[_0x8509('0x33')],{'$or':_[_0x8509('0x29')](_0x2b9b30,function(_0x366bf0){if(_0x366bf0[_0x8509('0x36')]!==_0x8509('0x37')){var _0x5e9adb={};_0x5e9adb[_0x366bf0[_0x8509('0x26')]]={'$like':'%'+_0x4ae060['query'][_0x8509('0x35')]+'%'};return _0x5e9adb;}})});}_0xd9abf0=_[_0x8509('0x38')]({},_0xd9abf0,_0x4ae060[_0x8509('0x39')]);var _0x1c50a1={'where':_0xd9abf0[_0x8509('0x33')]};return db['SquareMessage'][_0x8509('0x1c')](_0x1c50a1)['then'](function(_0xf867a5){_0xc290a7[_0x8509('0x1c')]=_0xf867a5;if(_0x4ae060[_0x8509('0x2c')][_0x8509('0x3a')]){_0xd9abf0[_0x8509('0x3b')]=[{'all':!![]}];}return db['SquareMessage'][_0x8509('0x3c')](_0xd9abf0);})['then'](function(_0x19f344){_0xc290a7['rows']=_0x19f344;return _0xc290a7;})[_0x8509('0x21')](respondWithFilteredResult(_0x211f34,_0xd9abf0))['catch'](handleError(_0x211f34,null));};exports[_0x8509('0x3d')]=function(_0x349e2a,_0x1accef){var _0x567771={'raw':!![],'where':{'id':_0x349e2a[_0x8509('0x3e')]['id']}},_0x124acc={};_0x124acc[_0x8509('0x2b')]=_[_0x8509('0x3f')](db['SquareMessage'][_0x8509('0x40')]);_0x124acc[_0x8509('0x2c')]=_[_0x8509('0x3f')](_0x349e2a[_0x8509('0x2c')]);_0x124acc[_0x8509('0x2d')]=_[_0x8509('0x41')](_0x124acc['model'],_0x124acc[_0x8509('0x2c')]);_0x567771['attributes']=_[_0x8509('0x41')](_0x124acc[_0x8509('0x2b')],qs['fields'](_0x349e2a[_0x8509('0x2c')][_0x8509('0x2f')]));_0x567771[_0x8509('0x2e')]=_0x567771[_0x8509('0x2e')][_0x8509('0x30')]?_0x567771[_0x8509('0x2e')]:_0x124acc[_0x8509('0x2b')];if(_0x349e2a[_0x8509('0x2c')]['includeAll']){_0x567771['include']=[{'all':!![]}];}_0x567771=_[_0x8509('0x38')]({},_0x567771,_0x349e2a['options']);return db[_0x8509('0x2a')]['find'](_0x567771)[_0x8509('0x21')](handleEntityNotFound(_0x1accef,null))['then'](respondWithResult(_0x1accef,null))[_0x8509('0x42')](handleError(_0x1accef,null));};exports[_0x8509('0x43')]=function(_0x271d1d,_0x31ac73){return db[_0x8509('0x2a')][_0x8509('0x43')](_0x271d1d['body'],{})['then'](respondWithResult(_0x31ac73,0xc9))[_0x8509('0x42')](handleError(_0x31ac73,null));};exports[_0x8509('0x20')]=function(_0x398217,_0x1c5b0c){if(_0x398217[_0x8509('0x44')]['id']){delete _0x398217[_0x8509('0x44')]['id'];}return db[_0x8509('0x2a')][_0x8509('0x45')]({'where':{'id':_0x398217[_0x8509('0x3e')]['id']}})[_0x8509('0x21')](handleEntityNotFound(_0x1c5b0c,null))['then'](saveUpdates(_0x398217[_0x8509('0x44')],null))[_0x8509('0x21')](respondWithResult(_0x1c5b0c,null))[_0x8509('0x42')](handleError(_0x1c5b0c,null));};exports['destroy']=function(_0x1ef9d5,_0x2c2e9e){return db[_0x8509('0x2a')][_0x8509('0x45')]({'where':{'id':_0x1ef9d5[_0x8509('0x3e')]['id']}})[_0x8509('0x21')](handleEntityNotFound(_0x2c2e9e,null))[_0x8509('0x21')](removeEntity(_0x2c2e9e,null))['catch'](handleError(_0x2c2e9e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 5fe3e54..beec46d 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 _0x080b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash'];(function(_0x51f5af,_0x2a5178){var _0x563080=function(_0x1c7ea4){while(--_0x1c7ea4){_0x51f5af['push'](_0x51f5af['shift']());}};_0x563080(++_0x2a5178);}(_0x080b,0x179));var _0xb080=function(_0x5a3b97,_0xa0a058){_0x5a3b97=_0x5a3b97-0x0;var _0x1df2db=_0x080b[_0x5a3b97];return _0x1df2db;};'use strict';var _=require(_0xb080('0x0'));var util=require('util');var logger=require(_0xb080('0x1'))(_0xb080('0x2'));var moment=require(_0xb080('0x3'));var BPromise=require(_0xb080('0x4'));var rp=require(_0xb080('0x5'));var fs=require('fs');var path=require(_0xb080('0x6'));var rimraf=require(_0xb080('0x7'));var config=require(_0xb080('0x8'));var attributes=require(_0xb080('0x9'));module[_0xb080('0xa')]=function(_0x25c000,_0xa89f0b){return _0x25c000[_0xb080('0xb')](_0xb080('0xc'),attributes,{'tableName':_0xb080('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbb2=['request-promise','path','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','../../config/logger','api'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xfbb2,0x72));var _0x2fbb=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0xfbb2[_0x4a5f6c];return _0x281ffd;};'use strict';var _=require(_0x2fbb('0x0'));var util=require('util');var logger=require(_0x2fbb('0x1'))(_0x2fbb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2fbb('0x3'));var fs=require('fs');var path=require(_0x2fbb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2fbb('0x5'));module['exports']=function(_0x17e377,_0x2e71dd){return _0x17e377[_0x2fbb('0x6')](_0x2fbb('0x7'),attributes,{'tableName':_0x2fbb('0x8'),'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 21138ac..4947a2b 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 _0xce1b=['SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1539f5,_0x13f63d){var _0x163ab2=function(_0x287a54){while(--_0x287a54){_0x1539f5['push'](_0x1539f5['shift']());}};_0x163ab2(++_0x13f63d);}(_0xce1b,0xb1));var _0xbce1=function(_0x32fe4d,_0x43a773){_0x32fe4d=_0x32fe4d-0x0;var _0x4b9558=_0xce1b[_0x32fe4d];return _0x4b9558;};'use strict';var _=require(_0xbce1('0x0'));var util=require(_0xbce1('0x1'));var moment=require(_0xbce1('0x2'));var BPromise=require('bluebird');var rs=require(_0xbce1('0x3'));var fs=require('fs');var Redis=require(_0xbce1('0x4'));var db=require(_0xbce1('0x5'))['db'];var utils=require(_0xbce1('0x6'));var logger=require(_0xbce1('0x7'))(_0xbce1('0x8'));var config=require('../../config/environment');var jayson=require(_0xbce1('0x9'));var client=jayson['client'][_0xbce1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f4079,_0x5a364f,_0x151e16){return new BPromise(function(_0xb7276f,_0x23ae91){return client['request'](_0x1f4079,_0x151e16)[_0xbce1('0xb')](function(_0x42837c){logger[_0xbce1('0xc')]('SquareMessage,\x20%s,\x20%s',_0x5a364f,_0xbce1('0xd'));logger[_0xbce1('0xe')](_0xbce1('0xf'),_0x5a364f,_0xbce1('0xd'),JSON[_0xbce1('0x10')](_0x42837c));if(_0x42837c[_0xbce1('0x11')]){if(_0x42837c[_0xbce1('0x11')][_0xbce1('0x12')]===0x1f4){logger['error'](_0xbce1('0x13'),_0x5a364f,_0x42837c[_0xbce1('0x11')][_0xbce1('0x14')]);return _0x23ae91(_0x42837c[_0xbce1('0x11')][_0xbce1('0x14')]);}logger['error'](_0xbce1('0x13'),_0x5a364f,_0x42837c[_0xbce1('0x11')]['message']);return _0xb7276f(_0x42837c['error'][_0xbce1('0x14')]);}else{logger[_0xbce1('0xc')](_0xbce1('0x13'),_0x5a364f,'request\x20sent');_0xb7276f(_0x42837c[_0xbce1('0x15')][_0xbce1('0x14')]);}})[_0xbce1('0x16')](function(_0x1bb80e){logger[_0xbce1('0x11')](_0xbce1('0x13'),_0x5a364f,_0x1bb80e);_0x23ae91(_0x1bb80e);});});}exports[_0xbce1('0x17')]=function(_0x232b4b){var _0x2edec3=this;return new Promise(function(_0x1c6b3f,_0x525cc5){return db[_0xbce1('0x18')][_0xbce1('0x19')](_0x232b4b[_0xbce1('0x1a')],{'raw':_0x232b4b['options']?_0x232b4b[_0xbce1('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x375f65){logger[_0xbce1('0xc')]('CreateSquareMessage',_0x232b4b);logger['debug'](_0xbce1('0x17'),_0x232b4b,JSON['stringify'](_0x375f65));_0x1c6b3f(_0x375f65);})[_0xbce1('0x16')](function(_0x4b18a4){logger['error']('CreateSquareMessage',_0x4b18a4['message'],_0x232b4b);_0x525cc5(_0x2edec3[_0xbce1('0x11')](0x1f4,_0x4b18a4[_0xbce1('0x14')]));});});}; \ No newline at end of file +var _0x3ff3=['http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','CreateSquareMessage','body','options','raw','then','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3423bb,_0x5c31b5){var _0x1fb310=function(_0x29257e){while(--_0x29257e){_0x3423bb['push'](_0x3423bb['shift']());}};_0x1fb310(++_0x5c31b5);}(_0x3ff3,0xe8));var _0x33ff=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3ff3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x33ff('0x0'));var util=require(_0x33ff('0x1'));var moment=require(_0x33ff('0x2'));var BPromise=require(_0x33ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33ff('0x4'));var db=require(_0x33ff('0x5'))['db'];var utils=require(_0x33ff('0x6'));var logger=require(_0x33ff('0x7'))('rpc');var config=require(_0x33ff('0x8'));var jayson=require(_0x33ff('0x9'));var client=jayson[_0x33ff('0xa')][_0x33ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc01767,_0x5bd7f3,_0xd7e51e){return new BPromise(function(_0x4c5a3f,_0x1b6793){return client['request'](_0xc01767,_0xd7e51e)['then'](function(_0xd7181a){logger[_0x33ff('0xc')](_0x33ff('0xd'),_0x5bd7f3,_0x33ff('0xe'));logger['debug'](_0x33ff('0xf'),_0x5bd7f3,'request\x20sent',JSON[_0x33ff('0x10')](_0xd7181a));if(_0xd7181a['error']){if(_0xd7181a['error'][_0x33ff('0x11')]===0x1f4){logger[_0x33ff('0x12')]('SquareMessage,\x20%s,\x20%s',_0x5bd7f3,_0xd7181a[_0x33ff('0x12')][_0x33ff('0x13')]);return _0x1b6793(_0xd7181a[_0x33ff('0x12')][_0x33ff('0x13')]);}logger[_0x33ff('0x12')](_0x33ff('0xd'),_0x5bd7f3,_0xd7181a['error'][_0x33ff('0x13')]);return _0x4c5a3f(_0xd7181a[_0x33ff('0x12')][_0x33ff('0x13')]);}else{logger[_0x33ff('0xc')]('SquareMessage,\x20%s,\x20%s',_0x5bd7f3,_0x33ff('0xe'));_0x4c5a3f(_0xd7181a['result']['message']);}})['catch'](function(_0x2941fc){logger[_0x33ff('0x12')](_0x33ff('0xd'),_0x5bd7f3,_0x2941fc);_0x1b6793(_0x2941fc);});});}exports[_0x33ff('0x14')]=function(_0x52ce2c){var _0x15767d=this;return new Promise(function(_0x4bf152,_0x1f7880){return db['SquareMessage']['create'](_0x52ce2c[_0x33ff('0x15')],{'raw':_0x52ce2c['options']?_0x52ce2c[_0x33ff('0x16')][_0x33ff('0x17')]===undefined?!![]:![]:!![]})[_0x33ff('0x18')](function(_0x185f84){logger[_0x33ff('0xc')](_0x33ff('0x14'),_0x52ce2c);logger[_0x33ff('0x19')](_0x33ff('0x14'),_0x52ce2c,JSON[_0x33ff('0x10')](_0x185f84));_0x4bf152(_0x185f84);})[_0x33ff('0x1a')](function(_0x1ae29f){logger[_0x33ff('0x12')](_0x33ff('0x14'),_0x1ae29f[_0x33ff('0x13')],_0x52ce2c);_0x1f7880(_0x15767d[_0x33ff('0x12')](0x1f4,_0x1ae29f[_0x33ff('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f80f538..916018a 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 _0x1bbb=['connect-timeout','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','get','/:id','show','/:id/test','test','post','put','update','delete','destroy','exports','multer'];(function(_0x1fbeaf,_0x256fbd){var _0x13daa3=function(_0x295348){while(--_0x295348){_0x1fbeaf['push'](_0x1fbeaf['shift']());}};_0x13daa3(++_0x256fbd);}(_0x1bbb,0x164));var _0xb1bb=function(_0x47e3e5,_0x2cfd00){_0x47e3e5=_0x47e3e5-0x0;var _0x1d4454=_0x1bbb[_0x47e3e5];return _0x1d4454;};'use strict';var multer=require(_0xb1bb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb1bb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb1bb('0x2'));var config=require(_0xb1bb('0x3'));var controller=require(_0xb1bb('0x4'));router['get']('/',auth[_0xb1bb('0x5')](),controller['index']);router[_0xb1bb('0x6')](_0xb1bb('0x7'),auth[_0xb1bb('0x5')](),controller[_0xb1bb('0x8')]);router['get'](_0xb1bb('0x9'),auth[_0xb1bb('0x5')](),timeout('15s'),controller[_0xb1bb('0xa')]);router[_0xb1bb('0xb')]('/',auth[_0xb1bb('0x5')](),controller['create']);router[_0xb1bb('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb1bb('0xd')]);router[_0xb1bb('0xe')](_0xb1bb('0x7'),auth[_0xb1bb('0x5')](),controller[_0xb1bb('0xf')]);module[_0xb1bb('0x10')]=router; \ No newline at end of file +var _0x3cc9=['isAuthenticated','index','/:id','show','/:id/test','15s','test','post','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x54c7b1,_0x14546c){var _0x312390=function(_0x283a0f){while(--_0x283a0f){_0x54c7b1['push'](_0x54c7b1['shift']());}};_0x312390(++_0x14546c);}(_0x3cc9,0x161));var _0x93cc=function(_0x456ab1,_0x381b67){_0x456ab1=_0x456ab1-0x0;var _0x2eaf19=_0x3cc9[_0x456ab1];return _0x2eaf19;};'use strict';var multer=require(_0x93cc('0x0'));var util=require(_0x93cc('0x1'));var path=require(_0x93cc('0x2'));var timeout=require(_0x93cc('0x3'));var express=require('express');var router=express[_0x93cc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x93cc('0x5'));var interaction=require(_0x93cc('0x6'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x93cc('0x7')]('/',auth[_0x93cc('0x8')](),controller[_0x93cc('0x9')]);router[_0x93cc('0x7')](_0x93cc('0xa'),auth[_0x93cc('0x8')](),controller[_0x93cc('0xb')]);router['get'](_0x93cc('0xc'),auth[_0x93cc('0x8')](),timeout(_0x93cc('0xd')),controller[_0x93cc('0xe')]);router[_0x93cc('0xf')]('/',auth[_0x93cc('0x8')](),controller['create']);router['put'](_0x93cc('0xa'),auth[_0x93cc('0x8')](),controller['update']);router[_0x93cc('0x10')]('/:id',auth[_0x93cc('0x8')](),controller[_0x93cc('0x11')]);module[_0x93cc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 9620830..5574951 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 _0xe760=['exports','STRING'];(function(_0x2626cf,_0x4a96d9){var _0x205c8a=function(_0x43cc02){while(--_0x43cc02){_0x2626cf['push'](_0x2626cf['shift']());}};_0x205c8a(++_0x4a96d9);}(_0xe760,0x19e));var _0x0e76=function(_0x59daa3,_0x1257d4){_0x59daa3=_0x59daa3-0x0;var _0x210711=_0xe760[_0x59daa3];return _0x210711;};'use strict';var Sequelize=require('sequelize');module[_0x0e76('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0e76('0x1')]},'description':{'type':Sequelize[_0x0e76('0x1')]}}; \ No newline at end of file +var _0xac89=['name','sequelize','exports'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0xac89,0x139));var _0x9ac8=function(_0x520afc,_0xfa0f10){_0x520afc=_0x520afc-0x0;var _0x4836bc=_0xac89[_0x520afc];return _0x4836bc;};'use strict';var Sequelize=require(_0x9ac8('0x0'));module[_0x9ac8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9ac8('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a81688f..53a728e 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 _0x7de9=['filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','fields','create','body','user','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','ODBC','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys'];(function(_0x5a4b5a,_0x16af6e){var _0x2f57bf=function(_0x3215d7){while(--_0x3215d7){_0x5a4b5a['push'](_0x5a4b5a['shift']());}};_0x2f57bf(++_0x16af6e);}(_0x7de9,0x12b));var _0x97de=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7de9[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x97de('0x0'));var rimraf=require(_0x97de('0x1'));var zipdir=require(_0x97de('0x2'));var jsonpatch=require(_0x97de('0x3'));var rp=require(_0x97de('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x97de('0x5'));var util=require('util');var path=require(_0x97de('0x6'));var sox=require(_0x97de('0x7'));var csv=require(_0x97de('0x8'));var ejs=require(_0x97de('0x9'));var fs=require('fs');var fs_extra=require(_0x97de('0xa'));var _=require(_0x97de('0xb'));var squel=require(_0x97de('0xc'));var crypto=require(_0x97de('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x97de('0xe'));var toCsv=require(_0x97de('0x8'));var querystring=require(_0x97de('0xf'));var Papa=require(_0x97de('0x10'));var Redis=require(_0x97de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x97de('0x12'));var as=require(_0x97de('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97de('0x14'))('api');var utils=require(_0x97de('0x15'));var config=require(_0x97de('0x16'));var licenseUtil=require(_0x97de('0x17'));var db=require(_0x97de('0x18'))['db'];function respondWithStatusCode(_0xb676c1,_0x10414c){_0x10414c=_0x10414c||0xcc;return function(_0x5aa65e){if(_0x5aa65e){return _0xb676c1[_0x97de('0x19')](_0x10414c);}return _0xb676c1[_0x97de('0x1a')](_0x10414c)['end']();};}function respondWithResult(_0x11d5f1,_0x313ecc){_0x313ecc=_0x313ecc||0xc8;return function(_0x277746){if(_0x277746){return _0x11d5f1[_0x97de('0x1a')](_0x313ecc)[_0x97de('0x1b')](_0x277746);}};}function respondWithFilteredResult(_0x11fd9d,_0x4d71d4){return function(_0xdbdaf3){if(_0xdbdaf3){var _0x20311f=typeof _0x4d71d4[_0x97de('0x1c')]==='undefined'&&typeof _0x4d71d4[_0x97de('0x1d')]===_0x97de('0x1e');var _0x4a2fdf=_0xdbdaf3[_0x97de('0x1f')];var _0x20d94d=_0x20311f?0x0:_0x4d71d4[_0x97de('0x1c')];var _0x2fb556=_0x20311f?_0xdbdaf3['count']:_0x4d71d4[_0x97de('0x1c')]+_0x4d71d4[_0x97de('0x1d')];var _0x185843;if(_0x2fb556>=_0x4a2fdf){_0x2fb556=_0x4a2fdf;_0x185843=0xc8;}else{_0x185843=0xce;}_0x11fd9d['status'](_0x185843);return _0x11fd9d[_0x97de('0x20')](_0x97de('0x21'),_0x20d94d+'-'+_0x2fb556+'/'+_0x4a2fdf)[_0x97de('0x1b')](_0xdbdaf3);}return null;};}function patchUpdates(_0x253a67){return function(_0x1310aa){try{jsonpatch[_0x97de('0x22')](_0x1310aa,_0x253a67,!![]);}catch(_0x17379){return BPromise['reject'](_0x17379);}return _0x1310aa[_0x97de('0x23')]();};}function saveUpdates(_0x14c96f,_0x553bb7){return function(_0x370692){if(_0x370692){return _0x370692[_0x97de('0x24')](_0x14c96f)['then'](function(_0x4cf70f){return _0x4cf70f;});}return null;};}function removeEntity(_0xa82462,_0x4b68d4){return function(_0x45f581){if(_0x45f581){return _0x45f581[_0x97de('0x25')]()[_0x97de('0x26')](function(){var _0x4f6c50=_0x45f581['get']({'plain':!![]});var _0xf029b7=_0x97de('0x27');return db[_0x97de('0x28')][_0x97de('0x25')]({'where':{'type':_0xf029b7,'resourceId':_0x4f6c50['id']}})[_0x97de('0x26')](function(){return _0x45f581;});})[_0x97de('0x26')](function(){_0xa82462['status'](0xcc)[_0x97de('0x29')]();});}};}function handleEntityNotFound(_0x4630ec,_0x56983e){return function(_0x508c9f){if(!_0x508c9f){_0x4630ec['sendStatus'](0x194);}return _0x508c9f;};}function handleError(_0x30be0a,_0x43d655){_0x43d655=_0x43d655||0x1f4;return function(_0x4d28cd){logger['error'](_0x4d28cd[_0x97de('0x2a')]);if(_0x4d28cd['name']){delete _0x4d28cd[_0x97de('0x2b')];}_0x30be0a[_0x97de('0x1a')](_0x43d655)[_0x97de('0x2c')](_0x4d28cd);};}exports[_0x97de('0x2d')]=function(_0x1b95fe,_0x7e5cbc){var _0x54172f={},_0x462f59={},_0x361fe0={'count':0x0,'rows':[]};var _0x57c1e2=_[_0x97de('0x2e')](db['SquareOdbc'][_0x97de('0x2f')],function(_0x4a3b9b){return{'name':_0x4a3b9b[_0x97de('0x30')],'type':_0x4a3b9b['type'][_0x97de('0x31')]};});_0x462f59[_0x97de('0x32')]=_[_0x97de('0x2e')](_0x57c1e2,_0x97de('0x2b'));_0x462f59[_0x97de('0x33')]=_[_0x97de('0x34')](_0x1b95fe[_0x97de('0x33')]);_0x462f59[_0x97de('0x35')]=_[_0x97de('0x36')](_0x462f59[_0x97de('0x32')],_0x462f59[_0x97de('0x33')]);_0x54172f[_0x97de('0x37')]=_[_0x97de('0x36')](_0x462f59['model'],qs['fields'](_0x1b95fe[_0x97de('0x33')]['fields']));_0x54172f[_0x97de('0x37')]=_0x54172f[_0x97de('0x37')][_0x97de('0x38')]?_0x54172f[_0x97de('0x37')]:_0x462f59['model'];if(!_0x1b95fe['query'][_0x97de('0x39')]('nolimit')){_0x54172f[_0x97de('0x1d')]=qs[_0x97de('0x1d')](_0x1b95fe[_0x97de('0x33')][_0x97de('0x1d')]);_0x54172f[_0x97de('0x1c')]=qs[_0x97de('0x1c')](_0x1b95fe[_0x97de('0x33')][_0x97de('0x1c')]);}_0x54172f[_0x97de('0x3a')]=qs[_0x97de('0x3b')](_0x1b95fe[_0x97de('0x33')][_0x97de('0x3b')]);_0x54172f[_0x97de('0x3c')]=qs[_0x97de('0x35')](_[_0x97de('0x3d')](_0x1b95fe[_0x97de('0x33')],_0x462f59['filters']),_0x57c1e2);if(_0x1b95fe[_0x97de('0x33')][_0x97de('0x3e')]){_0x54172f[_0x97de('0x3c')]=_[_0x97de('0x3f')](_0x54172f[_0x97de('0x3c')],{'$or':_[_0x97de('0x2e')](_0x57c1e2,function(_0x927ef9){if(_0x927ef9['type']!==_0x97de('0x40')){var _0x58d888={};_0x58d888[_0x927ef9['name']]={'$like':'%'+_0x1b95fe['query'][_0x97de('0x3e')]+'%'};return _0x58d888;}})});}_0x54172f=_[_0x97de('0x3f')]({},_0x54172f,_0x1b95fe[_0x97de('0x41')]);var _0x4c9abf={'where':_0x54172f[_0x97de('0x3c')]};return db[_0x97de('0x42')][_0x97de('0x1f')](_0x4c9abf)[_0x97de('0x26')](function(_0x2d26e9){_0x361fe0[_0x97de('0x1f')]=_0x2d26e9;if(_0x1b95fe[_0x97de('0x33')][_0x97de('0x43')]){_0x54172f[_0x97de('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0x97de('0x45')](_0x54172f);})[_0x97de('0x26')](function(_0x3910ce){_0x361fe0[_0x97de('0x46')]=_0x3910ce;return _0x361fe0;})['then'](respondWithFilteredResult(_0x7e5cbc,_0x54172f))[_0x97de('0x47')](handleError(_0x7e5cbc,null));};exports[_0x97de('0x48')]=function(_0x9ef8ac,_0x33c33f){var _0x25d7ce={'raw':!![],'where':{'id':_0x9ef8ac['params']['id']}},_0x942d77={};_0x942d77[_0x97de('0x32')]=_[_0x97de('0x34')](db[_0x97de('0x42')]['rawAttributes']);_0x942d77['query']=_[_0x97de('0x34')](_0x9ef8ac[_0x97de('0x33')]);_0x942d77[_0x97de('0x35')]=_[_0x97de('0x36')](_0x942d77[_0x97de('0x32')],_0x942d77[_0x97de('0x33')]);_0x25d7ce[_0x97de('0x37')]=_['intersection'](_0x942d77[_0x97de('0x32')],qs[_0x97de('0x49')](_0x9ef8ac[_0x97de('0x33')][_0x97de('0x49')]));_0x25d7ce['attributes']=_0x25d7ce[_0x97de('0x37')]['length']?_0x25d7ce[_0x97de('0x37')]:_0x942d77[_0x97de('0x32')];if(_0x9ef8ac[_0x97de('0x33')][_0x97de('0x43')]){_0x25d7ce[_0x97de('0x44')]=[{'all':!![]}];}_0x25d7ce=_[_0x97de('0x3f')]({},_0x25d7ce,_0x9ef8ac[_0x97de('0x41')]);return db[_0x97de('0x42')]['find'](_0x25d7ce)[_0x97de('0x26')](handleEntityNotFound(_0x33c33f,null))['then'](respondWithResult(_0x33c33f,null))[_0x97de('0x47')](handleError(_0x33c33f,null));};exports['create']=function(_0x4bb0f5,_0x5aa0c0){return db[_0x97de('0x42')][_0x97de('0x4a')](_0x4bb0f5[_0x97de('0x4b')],{})[_0x97de('0x26')](function(_0x513a0c){var _0x6317c7=_0x4bb0f5[_0x97de('0x4c')][_0x97de('0x4d')]({'plain':!![]});if(!_0x6317c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6317c7['role']===_0x97de('0x4c')){var _0x362cd7=_0x513a0c['get']({'plain':!![]});var _0x15a0ec=_0x97de('0x27');return db[_0x97de('0x4e')]['find']({'where':{'name':_0x15a0ec,'userProfileId':_0x6317c7['userProfileId']},'raw':!![]})[_0x97de('0x26')](function(_0x55ba21){if(_0x55ba21&&_0x55ba21[_0x97de('0x4f')]===0x0){return db[_0x97de('0x28')][_0x97de('0x4a')]({'name':_0x362cd7['name'],'resourceId':_0x362cd7['id'],'type':_0x55ba21[_0x97de('0x2b')],'sectionId':_0x55ba21['id']},{})[_0x97de('0x26')](function(){return _0x513a0c;});}else{return _0x513a0c;}})[_0x97de('0x47')](function(_0x1c3436){logger[_0x97de('0x50')](_0x97de('0x51'),_0x1c3436);throw _0x1c3436;});}return _0x513a0c;})[_0x97de('0x26')](respondWithResult(_0x5aa0c0,0xc9))[_0x97de('0x47')](handleError(_0x5aa0c0,null));};exports[_0x97de('0x24')]=function(_0x255d22,_0x1ac425){if(_0x255d22['body']['id']){delete _0x255d22[_0x97de('0x4b')]['id'];}return db[_0x97de('0x42')][_0x97de('0x52')]({'where':{'id':_0x255d22[_0x97de('0x53')]['id']}})[_0x97de('0x26')](handleEntityNotFound(_0x1ac425,null))['then'](saveUpdates(_0x255d22[_0x97de('0x4b')],null))[_0x97de('0x26')](respondWithResult(_0x1ac425,null))[_0x97de('0x47')](handleError(_0x1ac425,null));};exports['destroy']=function(_0x1cb6a2,_0x1f6cf5){return db['SquareOdbc'][_0x97de('0x52')]({'where':{'id':_0x1cb6a2['params']['id']}})[_0x97de('0x26')](handleEntityNotFound(_0x1f6cf5,null))['then'](removeEntity(_0x1f6cf5,null))['catch'](handleError(_0x1f6cf5,null));};exports[_0x97de('0x54')]=function(_0x1438bd,_0x332021,_0x428b2c){var _0x2f11c0;return db[_0x97de('0x42')][_0x97de('0x52')]({'where':{'id':_0x1438bd[_0x97de('0x53')]['id']},'attributes':['id',_0x97de('0x55')]})[_0x97de('0x26')](handleEntityNotFound(_0x332021,null))[_0x97de('0x26')](function(_0x577dda){if(_0x577dda){var _0x3c285a=require(_0x97de('0x56'))();_0x3c285a[_0x97de('0x57')](_0x577dda[_0x97de('0x55')]);_0x3c285a['closeSync']();return _0x577dda;}})[_0x97de('0x26')](respondWithResult(_0x332021,null))[_0x97de('0x47')](handleError(_0x332021,null));}; \ No newline at end of file +var _0x5081=['sort','where','pick','filter','merge','VIRTUAL','SquareOdbc','includeAll','include','rows','catch','show','params','options','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0x5081,0xd3));var _0x1508=function(_0x1b377c,_0x119111){_0x1b377c=_0x1b377c-0x0;var _0x43e695=_0x5081[_0x1b377c];return _0x43e695;};'use strict';var emlformat=require(_0x1508('0x0'));var rimraf=require(_0x1508('0x1'));var zipdir=require(_0x1508('0x2'));var jsonpatch=require(_0x1508('0x3'));var rp=require(_0x1508('0x4'));var moment=require(_0x1508('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1508('0x6'));var util=require(_0x1508('0x7'));var path=require(_0x1508('0x8'));var sox=require(_0x1508('0x9'));var csv=require(_0x1508('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1508('0xb'));var _=require(_0x1508('0xc'));var squel=require(_0x1508('0xd'));var crypto=require(_0x1508('0xe'));var jsforce=require(_0x1508('0xf'));var deskjs=require(_0x1508('0x10'));var toCsv=require(_0x1508('0xa'));var querystring=require(_0x1508('0x11'));var Papa=require(_0x1508('0x12'));var Redis=require(_0x1508('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1508('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1508('0x15'));var logger=require('../../config/logger')(_0x1508('0x16'));var utils=require('../../config/utils');var config=require(_0x1508('0x17'));var licenseUtil=require(_0x1508('0x18'));var db=require(_0x1508('0x19'))['db'];function respondWithStatusCode(_0x2d12e3,_0x353381){_0x353381=_0x353381||0xcc;return function(_0x3cf37c){if(_0x3cf37c){return _0x2d12e3[_0x1508('0x1a')](_0x353381);}return _0x2d12e3[_0x1508('0x1b')](_0x353381)[_0x1508('0x1c')]();};}function respondWithResult(_0x141252,_0x2ac318){_0x2ac318=_0x2ac318||0xc8;return function(_0x228beb){if(_0x228beb){return _0x141252[_0x1508('0x1b')](_0x2ac318)[_0x1508('0x1d')](_0x228beb);}};}function respondWithFilteredResult(_0x5245d5,_0x5796c5){return function(_0x32afca){if(_0x32afca){var _0x19774a=typeof _0x5796c5['offset']==='undefined'&&typeof _0x5796c5[_0x1508('0x1e')]===_0x1508('0x1f');var _0x3231a5=_0x32afca[_0x1508('0x20')];var _0x286d5f=_0x19774a?0x0:_0x5796c5['offset'];var _0x246ea2=_0x19774a?_0x32afca['count']:_0x5796c5[_0x1508('0x21')]+_0x5796c5[_0x1508('0x1e')];var _0x275633;if(_0x246ea2>=_0x3231a5){_0x246ea2=_0x3231a5;_0x275633=0xc8;}else{_0x275633=0xce;}_0x5245d5[_0x1508('0x1b')](_0x275633);return _0x5245d5[_0x1508('0x22')]('Content-Range',_0x286d5f+'-'+_0x246ea2+'/'+_0x3231a5)[_0x1508('0x1d')](_0x32afca);}return null;};}function patchUpdates(_0x402ebe){return function(_0x3e6a94){try{jsonpatch[_0x1508('0x23')](_0x3e6a94,_0x402ebe,!![]);}catch(_0x5240a1){return BPromise['reject'](_0x5240a1);}return _0x3e6a94[_0x1508('0x24')]();};}function saveUpdates(_0x387676,_0x2f6cf9){return function(_0x26e2c0){if(_0x26e2c0){return _0x26e2c0['update'](_0x387676)['then'](function(_0x29a39a){return _0x29a39a;});}return null;};}function removeEntity(_0x3dc9c0,_0x1fa9b4){return function(_0x54728f){if(_0x54728f){return _0x54728f[_0x1508('0x25')]()[_0x1508('0x26')](function(){var _0x9f72d2=_0x54728f[_0x1508('0x27')]({'plain':!![]});var _0x29999c=_0x1508('0x28');return db[_0x1508('0x29')][_0x1508('0x25')]({'where':{'type':_0x29999c,'resourceId':_0x9f72d2['id']}})[_0x1508('0x26')](function(){return _0x54728f;});})[_0x1508('0x26')](function(){_0x3dc9c0[_0x1508('0x1b')](0xcc)[_0x1508('0x1c')]();});}};}function handleEntityNotFound(_0x33000a,_0x49bc46){return function(_0x17761e){if(!_0x17761e){_0x33000a['sendStatus'](0x194);}return _0x17761e;};}function handleError(_0xa71de9,_0x2fdfcd){_0x2fdfcd=_0x2fdfcd||0x1f4;return function(_0x588359){logger[_0x1508('0x2a')](_0x588359[_0x1508('0x2b')]);if(_0x588359[_0x1508('0x2c')]){delete _0x588359['name'];}_0xa71de9[_0x1508('0x1b')](_0x2fdfcd)[_0x1508('0x2d')](_0x588359);};}exports[_0x1508('0x2e')]=function(_0x423095,_0x5beabf){var _0x5471ae={},_0x277ea6={},_0x28070e={'count':0x0,'rows':[]};var _0x1d6ce8=_[_0x1508('0x2f')](db['SquareOdbc'][_0x1508('0x30')],function(_0x746a3d){return{'name':_0x746a3d[_0x1508('0x31')],'type':_0x746a3d[_0x1508('0x32')][_0x1508('0x33')]};});_0x277ea6['model']=_[_0x1508('0x2f')](_0x1d6ce8,'name');_0x277ea6[_0x1508('0x34')]=_[_0x1508('0x35')](_0x423095['query']);_0x277ea6[_0x1508('0x36')]=_[_0x1508('0x37')](_0x277ea6[_0x1508('0x38')],_0x277ea6['query']);_0x5471ae[_0x1508('0x39')]=_[_0x1508('0x37')](_0x277ea6['model'],qs[_0x1508('0x3a')](_0x423095[_0x1508('0x34')][_0x1508('0x3a')]));_0x5471ae[_0x1508('0x39')]=_0x5471ae['attributes'][_0x1508('0x3b')]?_0x5471ae[_0x1508('0x39')]:_0x277ea6[_0x1508('0x38')];if(!_0x423095[_0x1508('0x34')]['hasOwnProperty'](_0x1508('0x3c'))){_0x5471ae['limit']=qs[_0x1508('0x1e')](_0x423095[_0x1508('0x34')][_0x1508('0x1e')]);_0x5471ae[_0x1508('0x21')]=qs[_0x1508('0x21')](_0x423095['query']['offset']);}_0x5471ae[_0x1508('0x3d')]=qs[_0x1508('0x3e')](_0x423095['query'][_0x1508('0x3e')]);_0x5471ae[_0x1508('0x3f')]=qs[_0x1508('0x36')](_[_0x1508('0x40')](_0x423095['query'],_0x277ea6[_0x1508('0x36')]),_0x1d6ce8);if(_0x423095['query'][_0x1508('0x41')]){_0x5471ae['where']=_[_0x1508('0x42')](_0x5471ae[_0x1508('0x3f')],{'$or':_['map'](_0x1d6ce8,function(_0x16235e){if(_0x16235e['type']!==_0x1508('0x43')){var _0x4d6f3f={};_0x4d6f3f[_0x16235e['name']]={'$like':'%'+_0x423095[_0x1508('0x34')][_0x1508('0x41')]+'%'};return _0x4d6f3f;}})});}_0x5471ae=_[_0x1508('0x42')]({},_0x5471ae,_0x423095['options']);var _0x2c50ab={'where':_0x5471ae[_0x1508('0x3f')]};return db[_0x1508('0x44')][_0x1508('0x20')](_0x2c50ab)[_0x1508('0x26')](function(_0x47cdd3){_0x28070e[_0x1508('0x20')]=_0x47cdd3;if(_0x423095[_0x1508('0x34')][_0x1508('0x45')]){_0x5471ae[_0x1508('0x46')]=[{'all':!![]}];}return db[_0x1508('0x44')]['findAll'](_0x5471ae);})[_0x1508('0x26')](function(_0x3df8cf){_0x28070e[_0x1508('0x47')]=_0x3df8cf;return _0x28070e;})[_0x1508('0x26')](respondWithFilteredResult(_0x5beabf,_0x5471ae))[_0x1508('0x48')](handleError(_0x5beabf,null));};exports[_0x1508('0x49')]=function(_0x55d161,_0x3216b5){var _0x37eb6a={'raw':!![],'where':{'id':_0x55d161[_0x1508('0x4a')]['id']}},_0x49f0a3={};_0x49f0a3[_0x1508('0x38')]=_[_0x1508('0x35')](db[_0x1508('0x44')][_0x1508('0x30')]);_0x49f0a3[_0x1508('0x34')]=_[_0x1508('0x35')](_0x55d161[_0x1508('0x34')]);_0x49f0a3['filters']=_[_0x1508('0x37')](_0x49f0a3[_0x1508('0x38')],_0x49f0a3[_0x1508('0x34')]);_0x37eb6a[_0x1508('0x39')]=_[_0x1508('0x37')](_0x49f0a3[_0x1508('0x38')],qs['fields'](_0x55d161[_0x1508('0x34')][_0x1508('0x3a')]));_0x37eb6a[_0x1508('0x39')]=_0x37eb6a[_0x1508('0x39')]['length']?_0x37eb6a[_0x1508('0x39')]:_0x49f0a3['model'];if(_0x55d161[_0x1508('0x34')][_0x1508('0x45')]){_0x37eb6a[_0x1508('0x46')]=[{'all':!![]}];}_0x37eb6a=_[_0x1508('0x42')]({},_0x37eb6a,_0x55d161[_0x1508('0x4b')]);return db[_0x1508('0x44')][_0x1508('0x4c')](_0x37eb6a)['then'](handleEntityNotFound(_0x3216b5,null))[_0x1508('0x26')](respondWithResult(_0x3216b5,null))[_0x1508('0x48')](handleError(_0x3216b5,null));};exports['create']=function(_0x3ec0c,_0x23553c){return db[_0x1508('0x44')]['create'](_0x3ec0c[_0x1508('0x4d')],{})[_0x1508('0x26')](function(_0x429270){var _0x1ab151=_0x3ec0c['user'][_0x1508('0x27')]({'plain':!![]});if(!_0x1ab151)throw new Error(_0x1508('0x4e'));if(_0x1ab151['role']===_0x1508('0x4f')){var _0x3728d6=_0x429270[_0x1508('0x27')]({'plain':!![]});var _0x322e3d=_0x1508('0x28');return db[_0x1508('0x50')][_0x1508('0x4c')]({'where':{'name':_0x322e3d,'userProfileId':_0x1ab151[_0x1508('0x51')]},'raw':!![]})['then'](function(_0x40f420){if(_0x40f420&&_0x40f420[_0x1508('0x52')]===0x0){return db[_0x1508('0x29')][_0x1508('0x53')]({'name':_0x3728d6[_0x1508('0x2c')],'resourceId':_0x3728d6['id'],'type':_0x40f420['name'],'sectionId':_0x40f420['id']},{})[_0x1508('0x26')](function(){return _0x429270;});}else{return _0x429270;}})[_0x1508('0x48')](function(_0x2822ff){logger[_0x1508('0x2a')](_0x1508('0x54'),_0x2822ff);throw _0x2822ff;});}return _0x429270;})[_0x1508('0x26')](respondWithResult(_0x23553c,0xc9))[_0x1508('0x48')](handleError(_0x23553c,null));};exports[_0x1508('0x55')]=function(_0x91f5de,_0x57d60f){if(_0x91f5de[_0x1508('0x4d')]['id']){delete _0x91f5de['body']['id'];}return db['SquareOdbc'][_0x1508('0x4c')]({'where':{'id':_0x91f5de[_0x1508('0x4a')]['id']}})[_0x1508('0x26')](handleEntityNotFound(_0x57d60f,null))[_0x1508('0x26')](saveUpdates(_0x91f5de[_0x1508('0x4d')],null))[_0x1508('0x26')](respondWithResult(_0x57d60f,null))[_0x1508('0x48')](handleError(_0x57d60f,null));};exports[_0x1508('0x25')]=function(_0x183c1e,_0x358eef){return db[_0x1508('0x44')][_0x1508('0x4c')]({'where':{'id':_0x183c1e[_0x1508('0x4a')]['id']}})['then'](handleEntityNotFound(_0x358eef,null))[_0x1508('0x26')](removeEntity(_0x358eef,null))['catch'](handleError(_0x358eef,null));};exports[_0x1508('0x56')]=function(_0x345f7c,_0x4c0f94,_0x14357a){var _0x82de08;return db[_0x1508('0x44')]['find']({'where':{'id':_0x345f7c[_0x1508('0x4a')]['id']},'attributes':['id',_0x1508('0x57')]})['then'](handleEntityNotFound(_0x4c0f94,null))[_0x1508('0x26')](function(_0x1a03fd){if(_0x1a03fd){var _0x3b7a7f=require(_0x1508('0x58'))();_0x3b7a7f[_0x1508('0x59')](_0x1a03fd[_0x1508('0x57')]);_0x3b7a7f[_0x1508('0x5a')]();return _0x1a03fd;}})[_0x1508('0x26')](respondWithResult(_0x4c0f94,null))['catch'](handleError(_0x4c0f94,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ff5668f..5137c07 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 _0x63b7=['rimraf','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4fd6d5,_0x5161e3){var _0x34ada6=function(_0x325479){while(--_0x325479){_0x4fd6d5['push'](_0x4fd6d5['shift']());}};_0x34ada6(++_0x5161e3);}(_0x63b7,0x118));var _0x763b=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x63b7[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x763b('0x0'));var util=require(_0x763b('0x1'));var logger=require(_0x763b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x763b('0x3'));var rp=require(_0x763b('0x4'));var fs=require('fs');var path=require(_0x763b('0x5'));var rimraf=require(_0x763b('0x6'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x763b('0x7')]=function(_0x3a6974,_0x46f1bb){return _0x3a6974[_0x763b('0x8')](_0x763b('0x9'),attributes,{'tableName':_0x763b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd49c=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1bc215,_0x14c2a0){var _0x37f15e=function(_0x2d291f){while(--_0x2d291f){_0x1bc215['push'](_0x1bc215['shift']());}};_0x37f15e(++_0x14c2a0);}(_0xd49c,0x1d9));var _0xcd49=function(_0x24c418,_0x56da6a){_0x24c418=_0x24c418-0x0;var _0xaa7031=_0xd49c[_0x24c418];return _0xaa7031;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcd49('0x0'))(_0xcd49('0x1'));var moment=require(_0xcd49('0x2'));var BPromise=require(_0xcd49('0x3'));var rp=require(_0xcd49('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd49('0x5'));var config=require(_0xcd49('0x6'));var attributes=require(_0xcd49('0x7'));module[_0xcd49('0x8')]=function(_0x350082,_0x141169){return _0x350082[_0xcd49('0x9')](_0xcd49('0xa'),attributes,{'tableName':_0xcd49('0xb'),'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 25c4300..43e61bd 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 _0x332c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1381fa,_0x17aa78){var _0x5324e8=function(_0x913bc0){while(--_0x913bc0){_0x1381fa['push'](_0x1381fa['shift']());}};_0x5324e8(++_0x17aa78);}(_0x332c,0x1e8));var _0xc332=function(_0x2a0980,_0x1b7120){_0x2a0980=_0x2a0980-0x0;var _0x1b2f15=_0x332c[_0x2a0980];return _0x1b2f15;};'use strict';var _=require(_0xc332('0x0'));var util=require(_0xc332('0x1'));var moment=require(_0xc332('0x2'));var BPromise=require(_0xc332('0x3'));var rs=require(_0xc332('0x4'));var fs=require('fs');var Redis=require(_0xc332('0x5'));var db=require(_0xc332('0x6'))['db'];var utils=require(_0xc332('0x7'));var logger=require(_0xc332('0x8'))('rpc');var config=require(_0xc332('0x9'));var jayson=require(_0xc332('0xa'));var client=jayson[_0xc332('0xb')][_0xc332('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3deebd,_0x371a17,_0x3a99c1){return new BPromise(function(_0x369a87,_0x513ff1){return client[_0xc332('0xd')](_0x3deebd,_0x3a99c1)['then'](function(_0x289e33){logger[_0xc332('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x371a17,_0xc332('0xf'));logger[_0xc332('0x10')](_0xc332('0x11'),_0x371a17,'request\x20sent',JSON['stringify'](_0x289e33));if(_0x289e33[_0xc332('0x12')]){if(_0x289e33['error']['code']===0x1f4){logger['error'](_0xc332('0x13'),_0x371a17,_0x289e33['error']['message']);return _0x513ff1(_0x289e33[_0xc332('0x12')][_0xc332('0x14')]);}logger['error'](_0xc332('0x13'),_0x371a17,_0x289e33[_0xc332('0x12')][_0xc332('0x14')]);return _0x369a87(_0x289e33['error']['message']);}else{logger[_0xc332('0xe')](_0xc332('0x13'),_0x371a17,'request\x20sent');_0x369a87(_0x289e33[_0xc332('0x15')][_0xc332('0x14')]);}})[_0xc332('0x16')](function(_0x375aa5){logger['error'](_0xc332('0x13'),_0x371a17,_0x375aa5);_0x513ff1(_0x375aa5);});});}exports[_0xc332('0x17')]=function(_0x3e4de1){var _0x13214b=this;return new Promise(function(_0x5365dc,_0x42b7c3){return db[_0xc332('0x18')][_0xc332('0x19')]({'raw':_0x3e4de1[_0xc332('0x1a')]?_0x3e4de1[_0xc332('0x1a')][_0xc332('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e4de1[_0xc332('0x1a')]?_0x3e4de1['options'][_0xc332('0x1c')]||null:null,'attributes':_0x3e4de1[_0xc332('0x1a')]?_0x3e4de1[_0xc332('0x1a')][_0xc332('0x1d')]||null:null,'include':_0x3e4de1[_0xc332('0x1a')]?_0x3e4de1[_0xc332('0x1a')][_0xc332('0x1e')]?_[_0xc332('0x1f')](_0x3e4de1['options'][_0xc332('0x1e')],function(_0x128ca2){return{'model':db[_0x128ca2['model']],'as':_0x128ca2['as'],'attributes':_0x128ca2['attributes'],'include':_0x128ca2[_0xc332('0x1e')]?_[_0xc332('0x1f')](_0x128ca2[_0xc332('0x1e')],function(_0x200e01){return{'model':db[_0x200e01[_0xc332('0x20')]],'as':_0x200e01['as'],'attributes':_0x200e01[_0xc332('0x1d')],'include':_0x200e01[_0xc332('0x1e')]?_[_0xc332('0x1f')](_0x200e01['include'],function(_0x50b960){return{'model':db[_0x50b960['model']],'as':_0x50b960['as'],'attributes':_0x50b960['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x358cfd){logger[_0xc332('0xe')](_0xc332('0x17'),_0x3e4de1);logger[_0xc332('0x10')](_0xc332('0x17'),_0x3e4de1,JSON['stringify'](_0x358cfd));_0x5365dc(_0x358cfd);})['catch'](function(_0xe2ea34){logger[_0xc332('0x12')]('ShowSquareOdbc',_0xe2ea34[_0xc332('0x14')],_0x3e4de1);_0x42b7c3(_0x13214b[_0xc332('0x12')](0x1f4,_0xe2ea34[_0xc332('0x14')]));});});}; \ No newline at end of file +var _0x4d47=['client','http','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','SquareOdbc,\x20%s,\x20%s','message','result','ShowSquareOdbc','find','options','raw','where','attributes','include','model','map','stringify','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x4d47,0x74));var _0x74d4=function(_0x2041c5,_0x15ef7e){_0x2041c5=_0x2041c5-0x0;var _0x3cfb70=_0x4d47[_0x2041c5];return _0x3cfb70;};'use strict';var _=require(_0x74d4('0x0'));var util=require('util');var moment=require(_0x74d4('0x1'));var BPromise=require(_0x74d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74d4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74d4('0x4'));var logger=require('../../config/logger')(_0x74d4('0x5'));var config=require(_0x74d4('0x6'));var jayson=require(_0x74d4('0x7'));var client=jayson[_0x74d4('0x8')][_0x74d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x154d67,_0xb2def2,_0x2ec538){return new BPromise(function(_0xb3f387,_0x5d932c){return client['request'](_0x154d67,_0x2ec538)[_0x74d4('0xa')](function(_0x4301b2){logger[_0x74d4('0xb')]('SquareOdbc,\x20%s,\x20%s',_0xb2def2,_0x74d4('0xc'));logger[_0x74d4('0xd')](_0x74d4('0xe'),_0xb2def2,_0x74d4('0xc'),JSON['stringify'](_0x4301b2));if(_0x4301b2[_0x74d4('0xf')]){if(_0x4301b2[_0x74d4('0xf')][_0x74d4('0x10')]===0x1f4){logger['error'](_0x74d4('0x11'),_0xb2def2,_0x4301b2[_0x74d4('0xf')][_0x74d4('0x12')]);return _0x5d932c(_0x4301b2[_0x74d4('0xf')][_0x74d4('0x12')]);}logger['error'](_0x74d4('0x11'),_0xb2def2,_0x4301b2[_0x74d4('0xf')][_0x74d4('0x12')]);return _0xb3f387(_0x4301b2['error']['message']);}else{logger[_0x74d4('0xb')](_0x74d4('0x11'),_0xb2def2,'request\x20sent');_0xb3f387(_0x4301b2[_0x74d4('0x13')]['message']);}})['catch'](function(_0x1d57e2){logger[_0x74d4('0xf')](_0x74d4('0x11'),_0xb2def2,_0x1d57e2);_0x5d932c(_0x1d57e2);});});}exports[_0x74d4('0x14')]=function(_0x5acd94){var _0x146b03=this;return new Promise(function(_0x11b1b2,_0xb57f91){return db['SquareOdbc'][_0x74d4('0x15')]({'raw':_0x5acd94[_0x74d4('0x16')]?_0x5acd94[_0x74d4('0x16')][_0x74d4('0x17')]===undefined?!![]:![]:!![],'where':_0x5acd94[_0x74d4('0x16')]?_0x5acd94['options'][_0x74d4('0x18')]||null:null,'attributes':_0x5acd94[_0x74d4('0x16')]?_0x5acd94[_0x74d4('0x16')][_0x74d4('0x19')]||null:null,'include':_0x5acd94[_0x74d4('0x16')]?_0x5acd94[_0x74d4('0x16')][_0x74d4('0x1a')]?_['map'](_0x5acd94[_0x74d4('0x16')]['include'],function(_0x1eec84){return{'model':db[_0x1eec84[_0x74d4('0x1b')]],'as':_0x1eec84['as'],'attributes':_0x1eec84[_0x74d4('0x19')],'include':_0x1eec84[_0x74d4('0x1a')]?_[_0x74d4('0x1c')](_0x1eec84['include'],function(_0x1ebec8){return{'model':db[_0x1ebec8['model']],'as':_0x1ebec8['as'],'attributes':_0x1ebec8[_0x74d4('0x19')],'include':_0x1ebec8[_0x74d4('0x1a')]?_['map'](_0x1ebec8[_0x74d4('0x1a')],function(_0x554aca){return{'model':db[_0x554aca[_0x74d4('0x1b')]],'as':_0x554aca['as'],'attributes':_0x554aca['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x79a003){logger['info'](_0x74d4('0x14'),_0x5acd94);logger[_0x74d4('0xd')](_0x74d4('0x14'),_0x5acd94,JSON[_0x74d4('0x1d')](_0x79a003));_0x11b1b2(_0x79a003);})[_0x74d4('0x1e')](function(_0x21b78c){logger[_0x74d4('0xf')](_0x74d4('0x14'),_0x21b78c['message'],_0x5acd94);_0xb57f91(_0x146b03[_0x74d4('0xf')](0x1f4,_0x21b78c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b7dcd7d..272753b 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 _0x95a9=['index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated'];(function(_0x1f5b25,_0x1457c0){var _0x2ac021=function(_0xcba8c1){while(--_0xcba8c1){_0x1f5b25['push'](_0x1f5b25['shift']());}};_0x2ac021(++_0x1457c0);}(_0x95a9,0x12a));var _0x995a=function(_0x18cca4,_0x1d14eb){_0x18cca4=_0x18cca4-0x0;var _0x41c2a1=_0x95a9[_0x18cca4];return _0x41c2a1;};'use strict';var multer=require(_0x995a('0x0'));var util=require(_0x995a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x995a('0x2')]();var fs_extra=require(_0x995a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x995a('0x4'));var config=require(_0x995a('0x5'));var controller=require(_0x995a('0x6'));router['get']('/',auth[_0x995a('0x7')](),controller[_0x995a('0x8')]);router[_0x995a('0x9')](_0x995a('0xa'),auth[_0x995a('0x7')](),controller[_0x995a('0xb')]);router[_0x995a('0xc')]('/',auth[_0x995a('0x7')](),controller[_0x995a('0xd')]);router['put'](_0x995a('0xa'),auth['isAuthenticated'](),controller[_0x995a('0xe')]);router[_0x995a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x995a('0x10')]);module[_0x995a('0x11')]=router; \ No newline at end of file +var _0x2931=['express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2931,0x1e9));var _0x1293=function(_0x175f1c,_0x3a0497){_0x175f1c=_0x175f1c-0x0;var _0x4d4870=_0x2931[_0x175f1c];return _0x4d4870;};'use strict';var multer=require(_0x1293('0x0'));var util=require(_0x1293('0x1'));var path=require(_0x1293('0x2'));var timeout=require(_0x1293('0x3'));var express=require(_0x1293('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1293('0x5'));var interaction=require(_0x1293('0x6'));var config=require('../../config/environment');var controller=require(_0x1293('0x7'));router[_0x1293('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1293('0x8')](_0x1293('0x9'),auth[_0x1293('0xa')](),controller[_0x1293('0xb')]);router[_0x1293('0xc')]('/',auth[_0x1293('0xa')](),controller['create']);router[_0x1293('0xd')](_0x1293('0x9'),auth[_0x1293('0xa')](),controller['update']);router[_0x1293('0xe')](_0x1293('0x9'),auth['isAuthenticated'](),controller[_0x1293('0xf')]);module[_0x1293('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 dba5891..62dd26a 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 _0x5142=['STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','name'];(function(_0x4a5cf4,_0xc7dac7){var _0x2ce5c7=function(_0x4a4ed2){while(--_0x4a4ed2){_0x4a5cf4['push'](_0x4a5cf4['shift']());}};_0x2ce5c7(++_0xc7dac7);}(_0x5142,0x196));var _0x2514=function(_0x46fcc6,_0x41b12d){_0x46fcc6=_0x46fcc6-0x0;var _0x1079e2=_0x5142[_0x46fcc6];return _0x1079e2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2514('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x2514('0x1')]},'notes':{'type':Sequelize[_0x2514('0x2')]},'preproduction':{'type':Sequelize[_0x2514('0x3')](_0x2514('0x4')),'get':function(){if(this[_0x2514('0x5')](_0x2514('0x6'))){return this[_0x2514('0x5')](_0x2514('0x6'))[_0x2514('0x7')](_0x2514('0x8'));}}},'production':{'type':Sequelize[_0x2514('0x3')](_0x2514('0x4')),'get':function(){if(this[_0x2514('0x5')](_0x2514('0x9'))){return this[_0x2514('0x5')]('production')[_0x2514('0x7')](_0x2514('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x2514('0xa')]}}; \ No newline at end of file +var _0x890c=['BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','name','STRING','TEXT'];(function(_0x3ac179,_0x2832d4){var _0x5565f1=function(_0x7695a1){while(--_0x7695a1){_0x3ac179['push'](_0x3ac179['shift']());}};_0x5565f1(++_0x2832d4);}(_0x890c,0x18e));var _0xc890=function(_0x26e811,_0x26abaf){_0x26e811=_0x26e811-0x0;var _0xbd375c=_0x890c[_0x26e811];return _0xbd375c;};'use strict';var Sequelize=require(_0xc890('0x0'));module[_0xc890('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc890('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc890('0x3')]},'notes':{'type':Sequelize[_0xc890('0x4')]},'preproduction':{'type':Sequelize[_0xc890('0x5')](_0xc890('0x6')),'get':function(){if(this[_0xc890('0x7')](_0xc890('0x8'))){return this['getDataValue'](_0xc890('0x8'))[_0xc890('0x9')](_0xc890('0xa'));}}},'production':{'type':Sequelize[_0xc890('0x5')](_0xc890('0x6')),'get':function(){if(this[_0xc890('0x7')]('production')){return this[_0xc890('0x7')](_0xc890('0xb'))[_0xc890('0x9')](_0xc890('0xa'));}}},'savedAt':{'type':Sequelize[_0xc890('0xc')]},'publishedAt':{'type':Sequelize[_0xc890('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 4453011..2820f7c 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 _0xbbcd=['./squareProject.socket','register','json','offset','undefined','limit','count','status','Content-Range','then','destroy','SquareProjects','UserProfileResource','end','sendStatus','error','stack','name','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','show','find','catch','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','agi','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x210e5d,_0x553155){var _0x451390=function(_0xb622ad){while(--_0xb622ad){_0x210e5d['push'](_0x210e5d['shift']());}};_0x451390(++_0x553155);}(_0xbbcd,0x1da));var _0xdbbc=function(_0x357be0,_0x41a3d5){_0x357be0=_0x357be0-0x0;var _0x44e7b3=_0xbbcd[_0x357be0];return _0x44e7b3;};'use strict';var _=require(_0xdbbc('0x0'));var Redis=require(_0xdbbc('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xdbbc('0x2'))(_0xdbbc('0x3'));var config=require(_0xdbbc('0x4'));var db=require(_0xdbbc('0x5'))['db'];config[_0xdbbc('0x6')]=_['defaults'](config['redis'],{'host':_0xdbbc('0x7'),'port':0x18eb});var socket=require(_0xdbbc('0x8'))(new Redis(config[_0xdbbc('0x6')]));require(_0xdbbc('0x9'))[_0xdbbc('0xa')](socket);function respondWithResult(_0x2f1668,_0x29860f){_0x29860f=_0x29860f||0xc8;return function(_0x45a873){if(_0x45a873){return _0x2f1668['status'](_0x29860f)[_0xdbbc('0xb')](_0x45a873);}};}function respondWithFilteredResult(_0x2c8bb8,_0x48e8ad){return function(_0x4621d9){if(_0x4621d9){var _0x4f105e=typeof _0x48e8ad[_0xdbbc('0xc')]===_0xdbbc('0xd')&&typeof _0x48e8ad[_0xdbbc('0xe')]===_0xdbbc('0xd');var _0x126096=_0x4621d9[_0xdbbc('0xf')];var _0x130dfb=_0x4f105e?0x0:_0x48e8ad[_0xdbbc('0xc')];var _0x3ceb4e=_0x4f105e?_0x4621d9[_0xdbbc('0xf')]:_0x48e8ad[_0xdbbc('0xc')]+_0x48e8ad[_0xdbbc('0xe')];var _0x220077;if(_0x3ceb4e>=_0x126096){_0x3ceb4e=_0x126096;_0x220077=0xc8;}else{_0x220077=0xce;}_0x2c8bb8[_0xdbbc('0x10')](_0x220077);return _0x2c8bb8['set'](_0xdbbc('0x11'),_0x130dfb+'-'+_0x3ceb4e+'/'+_0x126096)[_0xdbbc('0xb')](_0x4621d9);}return null;};}function saveUpdates(_0x31f731){return function(_0x4b1f9d){if(_0x4b1f9d){return _0x4b1f9d['update'](_0x31f731)[_0xdbbc('0x12')](function(_0xc959d3){return _0xc959d3;});}return null;};}function removeEntity(_0x22672f){return function(_0x1903d8){if(_0x1903d8){return _0x1903d8[_0xdbbc('0x13')]()[_0xdbbc('0x12')](function(){var _0x2c96e7=_0x1903d8['get']({'plain':!![]});var _0x2d5c10=_0xdbbc('0x14');return db[_0xdbbc('0x15')][_0xdbbc('0x13')]({'where':{'type':_0x2d5c10,'resourceId':_0x2c96e7['id']}})[_0xdbbc('0x12')](function(){return _0x1903d8;});})[_0xdbbc('0x12')](function(){var _0xe77346=new Redis(config[_0xdbbc('0x6')]);_0xe77346['publish']('agi',JSON['stringify']({'id':_0x1903d8['id'],'deleted':!![]}));})['then'](function(){_0x22672f['status'](0xcc)[_0xdbbc('0x16')]();});}};}function handleEntityNotFound(_0x3a0147){return function(_0x403b5c){if(!_0x403b5c){_0x3a0147[_0xdbbc('0x17')](0x194);}return _0x403b5c;};}function handleError(_0x1f8598,_0x37b820){_0x37b820=_0x37b820||0x1f4;return function(_0x2165e2){logger[_0xdbbc('0x18')](_0x2165e2[_0xdbbc('0x19')]);if(_0x2165e2[_0xdbbc('0x1a')]){delete _0x2165e2[_0xdbbc('0x1a')];}_0x1f8598[_0xdbbc('0x10')](_0x37b820)['send'](_0x2165e2);};}exports[_0xdbbc('0x1b')]=function(_0x236dde,_0x475ab7){var _0x4ddcd8={},_0x2b88c9={},_0x137a5c={'count':0x0,'rows':[]};var _0xc6a93b=_['map'](db[_0xdbbc('0x1c')][_0xdbbc('0x1d')],function(_0x173a16){return{'name':_0x173a16[_0xdbbc('0x1e')],'type':_0x173a16[_0xdbbc('0x1f')][_0xdbbc('0x20')]};});_0x2b88c9[_0xdbbc('0x21')]=_[_0xdbbc('0x22')](_0xc6a93b,_0xdbbc('0x1a'));_0x2b88c9[_0xdbbc('0x23')]=_[_0xdbbc('0x24')](_0x236dde['query']);_0x2b88c9[_0xdbbc('0x25')]=_[_0xdbbc('0x26')](_0x2b88c9[_0xdbbc('0x21')],_0x2b88c9[_0xdbbc('0x23')]);_0x4ddcd8[_0xdbbc('0x27')]=_[_0xdbbc('0x26')](_0x2b88c9['model'],qs[_0xdbbc('0x28')](_0x236dde[_0xdbbc('0x23')][_0xdbbc('0x28')]));_0x4ddcd8[_0xdbbc('0x27')]=_0x4ddcd8[_0xdbbc('0x27')][_0xdbbc('0x29')]?_0x4ddcd8['attributes']:_0x2b88c9[_0xdbbc('0x21')];if(!_0x236dde[_0xdbbc('0x23')][_0xdbbc('0x2a')](_0xdbbc('0x2b'))){_0x4ddcd8[_0xdbbc('0xe')]=qs[_0xdbbc('0xe')](_0x236dde['query'][_0xdbbc('0xe')]);_0x4ddcd8[_0xdbbc('0xc')]=qs[_0xdbbc('0xc')](_0x236dde[_0xdbbc('0x23')][_0xdbbc('0xc')]);}_0x4ddcd8[_0xdbbc('0x2c')]=qs[_0xdbbc('0x2d')](_0x236dde['query']['sort']);_0x4ddcd8[_0xdbbc('0x2e')]=qs[_0xdbbc('0x25')](_[_0xdbbc('0x2f')](_0x236dde['query'],_0x2b88c9[_0xdbbc('0x25')]),_0xc6a93b);if(_0x236dde[_0xdbbc('0x23')]['filter']){_0x4ddcd8[_0xdbbc('0x2e')]=_[_0xdbbc('0x30')](_0x4ddcd8['where'],{'$or':_[_0xdbbc('0x22')](_0xc6a93b,function(_0x45d940){if(_0x45d940[_0xdbbc('0x1f')]!==_0xdbbc('0x31')){var _0x4b9fab={};_0x4b9fab[_0x45d940[_0xdbbc('0x1a')]]={'$like':'%'+_0x236dde[_0xdbbc('0x23')][_0xdbbc('0x32')]+'%'};return _0x4b9fab;}})});}_0x4ddcd8=_[_0xdbbc('0x30')]({},_0x4ddcd8,_0x236dde[_0xdbbc('0x33')]);var _0x546a87={'where':_0x4ddcd8['where']};return db['SquareProject']['count'](_0x546a87)[_0xdbbc('0x12')](function(_0x1b75c3){_0x137a5c[_0xdbbc('0xf')]=_0x1b75c3;if(_0x236dde[_0xdbbc('0x23')][_0xdbbc('0x34')]){_0x4ddcd8[_0xdbbc('0x35')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x4ddcd8);})[_0xdbbc('0x12')](function(_0x1c3fab){_0x137a5c['rows']=_0x1c3fab;return _0x137a5c;})[_0xdbbc('0x12')](respondWithFilteredResult(_0x475ab7,_0x4ddcd8))['catch'](handleError(_0x475ab7,null));};exports[_0xdbbc('0x36')]=function(_0x577da0,_0x688139){var _0x3cd1cc={'raw':![],'where':{'id':_0x577da0['params']['id']}},_0x502e6e={};_0x502e6e[_0xdbbc('0x21')]=_[_0xdbbc('0x24')](db[_0xdbbc('0x1c')][_0xdbbc('0x1d')]);_0x502e6e[_0xdbbc('0x23')]=_[_0xdbbc('0x24')](_0x577da0['query']);_0x502e6e['filters']=_[_0xdbbc('0x26')](_0x502e6e['model'],_0x502e6e[_0xdbbc('0x23')]);_0x3cd1cc[_0xdbbc('0x27')]=_[_0xdbbc('0x26')](_0x502e6e[_0xdbbc('0x21')],qs[_0xdbbc('0x28')](_0x577da0[_0xdbbc('0x23')][_0xdbbc('0x28')]));_0x3cd1cc[_0xdbbc('0x27')]=_0x3cd1cc[_0xdbbc('0x27')][_0xdbbc('0x29')]?_0x3cd1cc['attributes']:_0x502e6e[_0xdbbc('0x21')];if(_0x577da0[_0xdbbc('0x23')]['includeAll']){_0x3cd1cc['include']=[{'all':!![]}];}_0x3cd1cc=_[_0xdbbc('0x30')]({},_0x3cd1cc,_0x577da0[_0xdbbc('0x33')]);return db[_0xdbbc('0x1c')][_0xdbbc('0x37')](_0x3cd1cc)[_0xdbbc('0x12')](handleEntityNotFound(_0x688139,null))['then'](respondWithResult(_0x688139,null))[_0xdbbc('0x38')](handleError(_0x688139,null));};exports['create']=function(_0x2055f7,_0x44ed1a){return db[_0xdbbc('0x1c')]['create'](_0x2055f7['body'],{})[_0xdbbc('0x12')](function(_0x4fbb0e){var _0xd383c2=_0x2055f7[_0xdbbc('0x39')][_0xdbbc('0x3a')]({'plain':!![]});if(!_0xd383c2)throw new Error(_0xdbbc('0x3b'));if(_0xd383c2[_0xdbbc('0x3c')]===_0xdbbc('0x39')){var _0x30629d=_0x4fbb0e[_0xdbbc('0x3a')]({'plain':!![]});var _0x8de48=_0xdbbc('0x14');return db['UserProfileSection'][_0xdbbc('0x37')]({'where':{'name':_0x8de48,'userProfileId':_0xd383c2[_0xdbbc('0x3d')]},'raw':!![]})[_0xdbbc('0x12')](function(_0x4c0af1){if(_0x4c0af1&&_0x4c0af1['autoAssociation']===0x0){return db[_0xdbbc('0x15')][_0xdbbc('0x3e')]({'name':_0x30629d['name'],'resourceId':_0x30629d['id'],'type':_0x4c0af1[_0xdbbc('0x1a')],'sectionId':_0x4c0af1['id']},{})['then'](function(){return _0x4fbb0e;});}else{return _0x4fbb0e;}})['catch'](function(_0x1d8c4e){logger[_0xdbbc('0x18')](_0xdbbc('0x3f'),_0x1d8c4e);throw _0x1d8c4e;});}return _0x4fbb0e;})['then'](respondWithResult(_0x44ed1a,0xc9))[_0xdbbc('0x38')](handleError(_0x44ed1a,null));};exports[_0xdbbc('0x40')]=function(_0x5f0e97,_0x1df8ee){if(_0x5f0e97[_0xdbbc('0x41')]['id']){delete _0x5f0e97['body']['id'];}return db[_0xdbbc('0x1c')][_0xdbbc('0x37')]({'where':{'id':_0x5f0e97[_0xdbbc('0x42')]['id']}})['then'](handleEntityNotFound(_0x1df8ee,null))['then'](saveUpdates(_0x5f0e97[_0xdbbc('0x41')],null))[_0xdbbc('0x12')](function(_0x4a733f){if(!_0x4a733f)return;var _0x3311e2=_0x4a733f[_0xdbbc('0x3a')]({'plain':!![]});return _0x3311e2;})[_0xdbbc('0x12')](function(_0x4900bf){var _0x29b534=new Redis(config[_0xdbbc('0x6')]);_0x29b534['publish'](_0xdbbc('0x43'),JSON['stringify'](_['pick'](_0x4900bf,['id','name',_0xdbbc('0x44')])));return _0x4900bf;})['then'](respondWithResult(_0x1df8ee,null))[_0xdbbc('0x38')](handleError(_0x1df8ee,null));};exports[_0xdbbc('0x13')]=function(_0x2b4a38,_0x49ac91){return db[_0xdbbc('0x1c')][_0xdbbc('0x37')]({'where':{'id':_0x2b4a38[_0xdbbc('0x42')]['id']}})[_0xdbbc('0x12')](handleEntityNotFound(_0x49ac91,null))[_0xdbbc('0x12')](removeEntity(_0x49ac91,null))['catch'](handleError(_0x49ac91,null));}; \ No newline at end of file +var _0x9c5f=['then','destroy','UserProfileResource','stringify','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','SquareProjects','UserProfileSection','userProfileId','autoAssociation','catch','update','body','publish','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x319597,_0x219b2d){var _0x352df9=function(_0x25d56e){while(--_0x25d56e){_0x319597['push'](_0x319597['shift']());}};_0x352df9(++_0x219b2d);}(_0x9c5f,0x192));var _0xf9c5=function(_0x5a00ef,_0x4a8a08){_0x5a00ef=_0x5a00ef-0x0;var _0x57cd75=_0x9c5f[_0x5a00ef];return _0x57cd75;};'use strict';var _=require(_0xf9c5('0x0'));var Redis=require('ioredis');var qs=require(_0xf9c5('0x1'));var logger=require(_0xf9c5('0x2'))(_0xf9c5('0x3'));var config=require(_0xf9c5('0x4'));var db=require(_0xf9c5('0x5'))['db'];config[_0xf9c5('0x6')]=_[_0xf9c5('0x7')](config[_0xf9c5('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9c5('0x8'))(new Redis(config['redis']));require(_0xf9c5('0x9'))[_0xf9c5('0xa')](socket);function respondWithResult(_0x217781,_0x19d7ca){_0x19d7ca=_0x19d7ca||0xc8;return function(_0x52b152){if(_0x52b152){return _0x217781[_0xf9c5('0xb')](_0x19d7ca)[_0xf9c5('0xc')](_0x52b152);}};}function respondWithFilteredResult(_0x4a4662,_0x230d2a){return function(_0x51ffb7){if(_0x51ffb7){var _0x1b4c80=typeof _0x230d2a[_0xf9c5('0xd')]===_0xf9c5('0xe')&&typeof _0x230d2a[_0xf9c5('0xf')]===_0xf9c5('0xe');var _0x240e01=_0x51ffb7[_0xf9c5('0x10')];var _0x5dbc85=_0x1b4c80?0x0:_0x230d2a[_0xf9c5('0xd')];var _0x1dfe1d=_0x1b4c80?_0x51ffb7[_0xf9c5('0x10')]:_0x230d2a[_0xf9c5('0xd')]+_0x230d2a[_0xf9c5('0xf')];var _0x283f93;if(_0x1dfe1d>=_0x240e01){_0x1dfe1d=_0x240e01;_0x283f93=0xc8;}else{_0x283f93=0xce;}_0x4a4662['status'](_0x283f93);return _0x4a4662['set'](_0xf9c5('0x11'),_0x5dbc85+'-'+_0x1dfe1d+'/'+_0x240e01)[_0xf9c5('0xc')](_0x51ffb7);}return null;};}function saveUpdates(_0x2cf770){return function(_0x21ebc7){if(_0x21ebc7){return _0x21ebc7['update'](_0x2cf770)[_0xf9c5('0x12')](function(_0x1b4ed8){return _0x1b4ed8;});}return null;};}function removeEntity(_0x158af6){return function(_0x58bed9){if(_0x58bed9){return _0x58bed9[_0xf9c5('0x13')]()[_0xf9c5('0x12')](function(){var _0x18ee05=_0x58bed9['get']({'plain':!![]});var _0x35bbe8='SquareProjects';return db[_0xf9c5('0x14')][_0xf9c5('0x13')]({'where':{'type':_0x35bbe8,'resourceId':_0x18ee05['id']}})[_0xf9c5('0x12')](function(){return _0x58bed9;});})[_0xf9c5('0x12')](function(){var _0x4d3657=new Redis(config[_0xf9c5('0x6')]);_0x4d3657['publish']('agi',JSON[_0xf9c5('0x15')]({'id':_0x58bed9['id'],'deleted':!![]}));})['then'](function(){_0x158af6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2284af){return function(_0x3cfe5b){if(!_0x3cfe5b){_0x2284af['sendStatus'](0x194);}return _0x3cfe5b;};}function handleError(_0x177ae6,_0x377513){_0x377513=_0x377513||0x1f4;return function(_0x3af839){logger[_0xf9c5('0x16')](_0x3af839[_0xf9c5('0x17')]);if(_0x3af839[_0xf9c5('0x18')]){delete _0x3af839[_0xf9c5('0x18')];}_0x177ae6[_0xf9c5('0xb')](_0x377513)['send'](_0x3af839);};}exports[_0xf9c5('0x19')]=function(_0x5e9291,_0x55bbe5){var _0x2a7555={},_0x235514={},_0x433954={'count':0x0,'rows':[]};var _0x43db23=_[_0xf9c5('0x1a')](db[_0xf9c5('0x1b')][_0xf9c5('0x1c')],function(_0x17cc52){return{'name':_0x17cc52[_0xf9c5('0x1d')],'type':_0x17cc52[_0xf9c5('0x1e')][_0xf9c5('0x1f')]};});_0x235514[_0xf9c5('0x20')]=_[_0xf9c5('0x1a')](_0x43db23,_0xf9c5('0x18'));_0x235514[_0xf9c5('0x21')]=_['keys'](_0x5e9291[_0xf9c5('0x21')]);_0x235514[_0xf9c5('0x22')]=_[_0xf9c5('0x23')](_0x235514[_0xf9c5('0x20')],_0x235514[_0xf9c5('0x21')]);_0x2a7555[_0xf9c5('0x24')]=_[_0xf9c5('0x23')](_0x235514['model'],qs[_0xf9c5('0x25')](_0x5e9291['query']['fields']));_0x2a7555[_0xf9c5('0x24')]=_0x2a7555[_0xf9c5('0x24')][_0xf9c5('0x26')]?_0x2a7555[_0xf9c5('0x24')]:_0x235514['model'];if(!_0x5e9291[_0xf9c5('0x21')][_0xf9c5('0x27')](_0xf9c5('0x28'))){_0x2a7555['limit']=qs[_0xf9c5('0xf')](_0x5e9291['query'][_0xf9c5('0xf')]);_0x2a7555[_0xf9c5('0xd')]=qs[_0xf9c5('0xd')](_0x5e9291['query'][_0xf9c5('0xd')]);}_0x2a7555['order']=qs[_0xf9c5('0x29')](_0x5e9291[_0xf9c5('0x21')][_0xf9c5('0x29')]);_0x2a7555[_0xf9c5('0x2a')]=qs[_0xf9c5('0x22')](_[_0xf9c5('0x2b')](_0x5e9291[_0xf9c5('0x21')],_0x235514[_0xf9c5('0x22')]),_0x43db23);if(_0x5e9291[_0xf9c5('0x21')][_0xf9c5('0x2c')]){_0x2a7555[_0xf9c5('0x2a')]=_[_0xf9c5('0x2d')](_0x2a7555['where'],{'$or':_[_0xf9c5('0x1a')](_0x43db23,function(_0x13dd62){if(_0x13dd62['type']!==_0xf9c5('0x2e')){var _0x299126={};_0x299126[_0x13dd62[_0xf9c5('0x18')]]={'$like':'%'+_0x5e9291[_0xf9c5('0x21')][_0xf9c5('0x2c')]+'%'};return _0x299126;}})});}_0x2a7555=_[_0xf9c5('0x2d')]({},_0x2a7555,_0x5e9291[_0xf9c5('0x2f')]);var _0x1c34a5={'where':_0x2a7555[_0xf9c5('0x2a')]};return db[_0xf9c5('0x1b')][_0xf9c5('0x10')](_0x1c34a5)[_0xf9c5('0x12')](function(_0x1e1cb6){_0x433954[_0xf9c5('0x10')]=_0x1e1cb6;if(_0x5e9291['query'][_0xf9c5('0x30')]){_0x2a7555[_0xf9c5('0x31')]=[{'all':!![]}];}return db[_0xf9c5('0x1b')][_0xf9c5('0x32')](_0x2a7555);})['then'](function(_0x250c8e){_0x433954[_0xf9c5('0x33')]=_0x250c8e;return _0x433954;})[_0xf9c5('0x12')](respondWithFilteredResult(_0x55bbe5,_0x2a7555))['catch'](handleError(_0x55bbe5,null));};exports[_0xf9c5('0x34')]=function(_0x2e8eaa,_0x311550){var _0x438af1={'raw':![],'where':{'id':_0x2e8eaa[_0xf9c5('0x35')]['id']}},_0x74817a={};_0x74817a[_0xf9c5('0x20')]=_['keys'](db[_0xf9c5('0x1b')][_0xf9c5('0x1c')]);_0x74817a[_0xf9c5('0x21')]=_[_0xf9c5('0x36')](_0x2e8eaa[_0xf9c5('0x21')]);_0x74817a[_0xf9c5('0x22')]=_[_0xf9c5('0x23')](_0x74817a[_0xf9c5('0x20')],_0x74817a[_0xf9c5('0x21')]);_0x438af1[_0xf9c5('0x24')]=_[_0xf9c5('0x23')](_0x74817a[_0xf9c5('0x20')],qs[_0xf9c5('0x25')](_0x2e8eaa[_0xf9c5('0x21')][_0xf9c5('0x25')]));_0x438af1[_0xf9c5('0x24')]=_0x438af1[_0xf9c5('0x24')]['length']?_0x438af1[_0xf9c5('0x24')]:_0x74817a[_0xf9c5('0x20')];if(_0x2e8eaa['query'][_0xf9c5('0x30')]){_0x438af1[_0xf9c5('0x31')]=[{'all':!![]}];}_0x438af1=_['merge']({},_0x438af1,_0x2e8eaa[_0xf9c5('0x2f')]);return db[_0xf9c5('0x1b')][_0xf9c5('0x37')](_0x438af1)['then'](handleEntityNotFound(_0x311550,null))['then'](respondWithResult(_0x311550,null))['catch'](handleError(_0x311550,null));};exports[_0xf9c5('0x38')]=function(_0x32f1c2,_0x5ccd1f){return db[_0xf9c5('0x1b')]['create'](_0x32f1c2['body'],{})['then'](function(_0x5c6ec1){var _0x5630fa=_0x32f1c2[_0xf9c5('0x39')]['get']({'plain':!![]});if(!_0x5630fa)throw new Error(_0xf9c5('0x3a'));if(_0x5630fa[_0xf9c5('0x3b')]===_0xf9c5('0x39')){var _0x1dfc9f=_0x5c6ec1[_0xf9c5('0x3c')]({'plain':!![]});var _0x36c94b=_0xf9c5('0x3d');return db[_0xf9c5('0x3e')][_0xf9c5('0x37')]({'where':{'name':_0x36c94b,'userProfileId':_0x5630fa[_0xf9c5('0x3f')]},'raw':!![]})[_0xf9c5('0x12')](function(_0x3375a7){if(_0x3375a7&&_0x3375a7[_0xf9c5('0x40')]===0x0){return db[_0xf9c5('0x14')]['create']({'name':_0x1dfc9f[_0xf9c5('0x18')],'resourceId':_0x1dfc9f['id'],'type':_0x3375a7['name'],'sectionId':_0x3375a7['id']},{})['then'](function(){return _0x5c6ec1;});}else{return _0x5c6ec1;}})['catch'](function(_0x5e811b){logger[_0xf9c5('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e811b);throw _0x5e811b;});}return _0x5c6ec1;})[_0xf9c5('0x12')](respondWithResult(_0x5ccd1f,0xc9))[_0xf9c5('0x41')](handleError(_0x5ccd1f,null));};exports[_0xf9c5('0x42')]=function(_0x312433,_0x28ee7b){if(_0x312433[_0xf9c5('0x43')]['id']){delete _0x312433[_0xf9c5('0x43')]['id'];}return db[_0xf9c5('0x1b')]['find']({'where':{'id':_0x312433[_0xf9c5('0x35')]['id']}})[_0xf9c5('0x12')](handleEntityNotFound(_0x28ee7b,null))[_0xf9c5('0x12')](saveUpdates(_0x312433[_0xf9c5('0x43')],null))[_0xf9c5('0x12')](function(_0x21be27){if(!_0x21be27)return;var _0x52ea48=_0x21be27[_0xf9c5('0x3c')]({'plain':!![]});return _0x52ea48;})[_0xf9c5('0x12')](function(_0x57e1ac){var _0x29eeaa=new Redis(config[_0xf9c5('0x6')]);_0x29eeaa[_0xf9c5('0x44')]('agi',JSON[_0xf9c5('0x15')](_['pick'](_0x57e1ac,['id',_0xf9c5('0x18'),_0xf9c5('0x45')])));return _0x57e1ac;})[_0xf9c5('0x12')](respondWithResult(_0x28ee7b,null))['catch'](handleError(_0x28ee7b,null));};exports[_0xf9c5('0x13')]=function(_0x457e41,_0x1d5198){return db[_0xf9c5('0x1b')][_0xf9c5('0x37')]({'where':{'id':_0x457e41[_0xf9c5('0x35')]['id']}})[_0xf9c5('0x12')](handleEntityNotFound(_0x1d5198,null))[_0xf9c5('0x12')](removeEntity(_0x1d5198,null))[_0xf9c5('0x41')](handleError(_0x1d5198,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1fa61d2..f991e1b 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 _0xdc91=['exports','events','../../mysqldb','SquareProject','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0xdc91,0x12d));var _0x1dc9=function(_0x2dfb67,_0x3d8999){_0x2dfb67=_0x2dfb67-0x0;var _0x147e8b=_0xdc91[_0x2dfb67];return _0x147e8b;};'use strict';var EventEmitter=require(_0x1dc9('0x0'));var SquareProject=require(_0x1dc9('0x1'))['db'][_0x1dc9('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1dc9('0x3'),'afterUpdate':_0x1dc9('0x4'),'afterDestroy':_0x1dc9('0x5')};function emitEvent(_0x39928f){return function(_0x4019cc,_0xa91cd7,_0x598138){SquareProjectEvents[_0x1dc9('0x6')](_0x39928f+':'+_0x4019cc['id'],_0x4019cc);SquareProjectEvents[_0x1dc9('0x6')](_0x39928f,_0x4019cc);_0x598138(null);};}for(var e in events){if(events[_0x1dc9('0x7')](e)){var event=events[e];SquareProject[_0x1dc9('0x8')](e,emitEvent(event));}}module[_0x1dc9('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x659a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x659a,0x1e7));var _0xa659=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x659a[_0x2125f0];return _0x12d6eb;};'use strict';var EventEmitter=require(_0xa659('0x0'));var SquareProject=require(_0xa659('0x1'))['db'][_0xa659('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa659('0x3'),'afterUpdate':_0xa659('0x4'),'afterDestroy':_0xa659('0x5')};function emitEvent(_0x468dcf){return function(_0x295261,_0x1da640,_0x3ecf4f){SquareProjectEvents[_0xa659('0x6')](_0x468dcf+':'+_0x295261['id'],_0x295261);SquareProjectEvents['emit'](_0x468dcf,_0x295261);_0x3ecf4f(null);};}for(var e in events){if(events[_0xa659('0x7')](e)){var event=events[e];SquareProject[_0xa659('0x8')](e,emitEvent(event));}}module[_0xa659('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index a11d7d1..0022fed 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 _0x38d2=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','format','production','publishedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38d2,0x86));var _0x238d=function(_0x521d69,_0x319b01){_0x521d69=_0x521d69-0x0;var _0x199179=_0x38d2[_0x521d69];return _0x199179;};'use strict';var _=require(_0x238d('0x0'));var util=require(_0x238d('0x1'));var logger=require(_0x238d('0x2'))(_0x238d('0x3'));var moment=require(_0x238d('0x4'));var BPromise=require(_0x238d('0x5'));var rp=require(_0x238d('0x6'));var fs=require('fs');var path=require(_0x238d('0x7'));var rimraf=require(_0x238d('0x8'));var config=require(_0x238d('0x9'));var attributes=require(_0x238d('0xa'));module['exports']=function(_0x31d97d,_0x1b95a6){return _0x31d97d[_0x238d('0xb')](_0x238d('0xc'),attributes,{'tableName':_0x238d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3edf4e,_0x3dbccf,_0x58e219){if(_0x3edf4e[_0x238d('0xe')]('preproduction')){_0x3edf4e['savedAt']=moment()[_0x238d('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3edf4e['changed'](_0x238d('0x10'))){_0x3edf4e[_0x238d('0x11')]=moment()[_0x238d('0xf')](_0x238d('0x12'));}_0x58e219(null,_0x3edf4e);}}});}; \ No newline at end of file +var _0x8ddc=['YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird','request-promise','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','production','publishedAt','format'];(function(_0x443b3a,_0x3af254){var _0x12e766=function(_0xb6b3a7){while(--_0xb6b3a7){_0x443b3a['push'](_0x443b3a['shift']());}};_0x12e766(++_0x3af254);}(_0x8ddc,0x1cc));var _0xc8dd=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x8ddc[_0x5d4f12];return _0x4eb577;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc8dd('0x0'))(_0xc8dd('0x1'));var moment=require('moment');var BPromise=require(_0xc8dd('0x2'));var rp=require(_0xc8dd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8dd('0x4'));var attributes=require(_0xc8dd('0x5'));module[_0xc8dd('0x6')]=function(_0x576592,_0x508326){return _0x576592[_0xc8dd('0x7')](_0xc8dd('0x8'),attributes,{'tableName':_0xc8dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f9ec2,_0x47582a,_0x2f32c7){if(_0x3f9ec2[_0xc8dd('0xa')](_0xc8dd('0xb'))){_0x3f9ec2[_0xc8dd('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3f9ec2['changed'](_0xc8dd('0xd'))){_0x3f9ec2[_0xc8dd('0xe')]=moment()[_0xc8dd('0xf')](_0xc8dd('0x10'));}_0x2f32c7(null,_0x3f9ec2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 044742c..1ad3bbf 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 _0x3677=['ShowSquareProject','stringify','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','limit','include','map','attributes','model','then','info','debug','catch','error','message','find'];(function(_0x21fa1a,_0x127350){var _0x20845b=function(_0x160a7a){while(--_0x160a7a){_0x21fa1a['push'](_0x21fa1a['shift']());}};_0x20845b(++_0x127350);}(_0x3677,0x1c4));var _0x7367=function(_0x3f8ca7,_0x1cfd75){_0x3f8ca7=_0x3f8ca7-0x0;var _0x2ef97e=_0x3677[_0x3f8ca7];return _0x2ef97e;};'use strict';var _=require(_0x7367('0x0'));var Redis=require(_0x7367('0x1'));var db=require(_0x7367('0x2'))['db'];var logger=require(_0x7367('0x3'))(_0x7367('0x4'));var config=require(_0x7367('0x5'));config[_0x7367('0x6')]=_[_0x7367('0x7')](config['redis'],{'host':_0x7367('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7367('0x9'))[_0x7367('0xa')](socket);exports[_0x7367('0xb')]=function(_0x399293){var _0x5b4e8a=this;return new Promise(function(_0x5b7244,_0x49e27b){return db['SquareProject'][_0x7367('0xc')]({'raw':_0x399293[_0x7367('0xd')]?_0x399293['options'][_0x7367('0xe')]===undefined?!![]:![]:!![],'where':_0x399293['options']?_0x399293[_0x7367('0xd')][_0x7367('0xf')]||null:null,'attributes':_0x399293[_0x7367('0xd')]?_0x399293[_0x7367('0xd')]['attributes']||null:null,'limit':_0x399293[_0x7367('0xd')]?_0x399293[_0x7367('0xd')][_0x7367('0x10')]||null:null,'include':_0x399293['options']?_0x399293['options'][_0x7367('0x11')]?_[_0x7367('0x12')](_0x399293[_0x7367('0xd')][_0x7367('0x11')],function(_0x368c04){return{'model':db[_0x368c04['model']],'as':_0x368c04['as'],'attributes':_0x368c04[_0x7367('0x13')],'include':_0x368c04['include']?_['map'](_0x368c04[_0x7367('0x11')],function(_0x21ee93){return{'model':db[_0x21ee93[_0x7367('0x14')]],'as':_0x21ee93['as'],'attributes':_0x21ee93[_0x7367('0x13')],'include':_0x21ee93[_0x7367('0x11')]?_[_0x7367('0x12')](_0x21ee93[_0x7367('0x11')],function(_0x3a7b3c){return{'model':db[_0x3a7b3c[_0x7367('0x14')]],'as':_0x3a7b3c['as'],'attributes':_0x3a7b3c[_0x7367('0x13')]};}):[]};}):[]};}):[]:[]})[_0x7367('0x15')](function(_0x1c18cf){logger[_0x7367('0x16')](_0x7367('0xb'),_0x399293);logger[_0x7367('0x17')]('GetSquareProjects',_0x399293,JSON['stringify'](_0x1c18cf));_0x5b7244(_0x1c18cf);})[_0x7367('0x18')](function(_0x55fee8){logger[_0x7367('0x19')](_0x7367('0xb'),_0x55fee8[_0x7367('0x1a')],_0x399293);_0x49e27b(_0x5b4e8a[_0x7367('0x19')](0x1f4,_0x55fee8[_0x7367('0x1a')]));});});};exports['ShowSquareProject']=function(_0x594296){var _0x285124=this;return new Promise(function(_0x19d8a1,_0x451dea){return db['SquareProject'][_0x7367('0x1b')]({'raw':_0x594296[_0x7367('0xd')]?_0x594296[_0x7367('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x594296[_0x7367('0xd')]?_0x594296[_0x7367('0xd')][_0x7367('0xf')]||null:null,'attributes':_0x594296[_0x7367('0xd')]?_0x594296[_0x7367('0xd')][_0x7367('0x13')]||null:null,'include':_0x594296[_0x7367('0xd')]?_0x594296[_0x7367('0xd')]['include']?_[_0x7367('0x12')](_0x594296[_0x7367('0xd')][_0x7367('0x11')],function(_0x148951){return{'model':db[_0x148951[_0x7367('0x14')]],'as':_0x148951['as'],'attributes':_0x148951[_0x7367('0x13')],'include':_0x148951[_0x7367('0x11')]?_['map'](_0x148951[_0x7367('0x11')],function(_0x4f7569){return{'model':db[_0x4f7569[_0x7367('0x14')]],'as':_0x4f7569['as'],'attributes':_0x4f7569[_0x7367('0x13')],'include':_0x4f7569[_0x7367('0x11')]?_['map'](_0x4f7569['include'],function(_0x5be077){return{'model':db[_0x5be077['model']],'as':_0x5be077['as'],'attributes':_0x5be077[_0x7367('0x13')]};}):[]};}):[]};}):[]:[]})[_0x7367('0x15')](function(_0x5d4387){logger[_0x7367('0x16')](_0x7367('0x1c'),_0x594296);logger[_0x7367('0x17')](_0x7367('0x1c'),_0x594296,JSON[_0x7367('0x1d')](_0x5d4387));_0x19d8a1(_0x5d4387);})[_0x7367('0x18')](function(_0xe4300d){logger[_0x7367('0x19')](_0x7367('0x1c'),_0xe4300d[_0x7367('0x1a')],_0x594296);_0x451dea(_0x285124[_0x7367('0x19')](0x1f4,_0xe4300d['message']));});});}; \ No newline at end of file +var _0x709f=['catch','error','message','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','then','info','GetSquareProjects','debug','stringify'];(function(_0x556b16,_0x51f863){var _0x3f2a44=function(_0x297f08){while(--_0x297f08){_0x556b16['push'](_0x556b16['shift']());}};_0x3f2a44(++_0x51f863);}(_0x709f,0x78));var _0xf709=function(_0x55e059,_0x2df2c5){_0x55e059=_0x55e059-0x0;var _0x1e6bb7=_0x709f[_0x55e059];return _0x1e6bb7;};'use strict';var _=require(_0xf709('0x0'));var Redis=require(_0xf709('0x1'));var db=require(_0xf709('0x2'))['db'];var logger=require(_0xf709('0x3'))(_0xf709('0x4'));var config=require(_0xf709('0x5'));config[_0xf709('0x6')]=_['defaults'](config[_0xf709('0x6')],{'host':_0xf709('0x7'),'port':0x18eb});var socket=require(_0xf709('0x8'))(new Redis(config[_0xf709('0x6')]));require('./squareProject.socket')[_0xf709('0x9')](socket);exports['GetSquareProjects']=function(_0x4915f4){var _0x2ff662=this;return new Promise(function(_0x5d2393,_0xa9bec1){return db[_0xf709('0xa')][_0xf709('0xb')]({'raw':_0x4915f4[_0xf709('0xc')]?_0x4915f4[_0xf709('0xc')][_0xf709('0xd')]===undefined?!![]:![]:!![],'where':_0x4915f4['options']?_0x4915f4[_0xf709('0xc')][_0xf709('0xe')]||null:null,'attributes':_0x4915f4[_0xf709('0xc')]?_0x4915f4[_0xf709('0xc')][_0xf709('0xf')]||null:null,'limit':_0x4915f4['options']?_0x4915f4[_0xf709('0xc')][_0xf709('0x10')]||null:null,'include':_0x4915f4[_0xf709('0xc')]?_0x4915f4['options'][_0xf709('0x11')]?_['map'](_0x4915f4[_0xf709('0xc')][_0xf709('0x11')],function(_0x596e80){return{'model':db[_0x596e80[_0xf709('0x12')]],'as':_0x596e80['as'],'attributes':_0x596e80[_0xf709('0xf')],'include':_0x596e80[_0xf709('0x11')]?_[_0xf709('0x13')](_0x596e80['include'],function(_0x49c61e){return{'model':db[_0x49c61e[_0xf709('0x12')]],'as':_0x49c61e['as'],'attributes':_0x49c61e[_0xf709('0xf')],'include':_0x49c61e[_0xf709('0x11')]?_['map'](_0x49c61e[_0xf709('0x11')],function(_0x5bb0fd){return{'model':db[_0x5bb0fd['model']],'as':_0x5bb0fd['as'],'attributes':_0x5bb0fd['attributes']};}):[]};}):[]};}):[]:[]})[_0xf709('0x14')](function(_0x569bdb){logger[_0xf709('0x15')](_0xf709('0x16'),_0x4915f4);logger[_0xf709('0x17')](_0xf709('0x16'),_0x4915f4,JSON[_0xf709('0x18')](_0x569bdb));_0x5d2393(_0x569bdb);})[_0xf709('0x19')](function(_0x26900c){logger[_0xf709('0x1a')](_0xf709('0x16'),_0x26900c[_0xf709('0x1b')],_0x4915f4);_0xa9bec1(_0x2ff662['error'](0x1f4,_0x26900c[_0xf709('0x1b')]));});});};exports['ShowSquareProject']=function(_0x40c133){var _0x95e24f=this;return new Promise(function(_0x371b5e,_0x55eb23){return db['SquareProject']['find']({'raw':_0x40c133[_0xf709('0xc')]?_0x40c133[_0xf709('0xc')][_0xf709('0xd')]===undefined?!![]:![]:!![],'where':_0x40c133['options']?_0x40c133[_0xf709('0xc')]['where']||null:null,'attributes':_0x40c133[_0xf709('0xc')]?_0x40c133[_0xf709('0xc')][_0xf709('0xf')]||null:null,'include':_0x40c133[_0xf709('0xc')]?_0x40c133[_0xf709('0xc')][_0xf709('0x11')]?_[_0xf709('0x13')](_0x40c133['options']['include'],function(_0x1364ec){return{'model':db[_0x1364ec[_0xf709('0x12')]],'as':_0x1364ec['as'],'attributes':_0x1364ec['attributes'],'include':_0x1364ec[_0xf709('0x11')]?_['map'](_0x1364ec[_0xf709('0x11')],function(_0x2d4f48){return{'model':db[_0x2d4f48['model']],'as':_0x2d4f48['as'],'attributes':_0x2d4f48[_0xf709('0xf')],'include':_0x2d4f48[_0xf709('0x11')]?_[_0xf709('0x13')](_0x2d4f48['include'],function(_0x382fba){return{'model':db[_0x382fba[_0xf709('0x12')]],'as':_0x382fba['as'],'attributes':_0x382fba[_0xf709('0xf')]};}):[]};}):[]};}):[]:[]})[_0xf709('0x14')](function(_0x126938){logger[_0xf709('0x15')](_0xf709('0x1c'),_0x40c133);logger[_0xf709('0x17')](_0xf709('0x1c'),_0x40c133,JSON[_0xf709('0x18')](_0x126938));_0x371b5e(_0x126938);})[_0xf709('0x19')](function(_0xb3e3c4){logger['error']('ShowSquareProject',_0xb3e3c4['message'],_0x40c133);_0x55eb23(_0x95e24f[_0xf709('0x1a')](0x1f4,_0xb3e3c4['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 435f092..82a8ff7 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 _0x3c10=['removeListener','register','length','squareProject:','./squareProject.events','remove','update','emit'];(function(_0xbae1c8,_0xeff5f9){var _0xbad16=function(_0x419fb3){while(--_0x419fb3){_0xbae1c8['push'](_0xbae1c8['shift']());}};_0xbad16(++_0xeff5f9);}(_0x3c10,0x11c));var _0x03c1=function(_0x4aeae1,_0x240e9e){_0x4aeae1=_0x4aeae1-0x0;var _0x4979e4=_0x3c10[_0x4aeae1];return _0x4979e4;};'use strict';var SquareProjectEvents=require(_0x03c1('0x0'));var events=['save',_0x03c1('0x1'),_0x03c1('0x2')];function createListener(_0xb77bd3,_0x36a982){return function(_0x11d7bd){_0x36a982[_0x03c1('0x3')](_0xb77bd3,_0x11d7bd);};}function removeListener(_0x286497,_0x591905){return function(){SquareProjectEvents[_0x03c1('0x4')](_0x286497,_0x591905);};}exports[_0x03c1('0x5')]=function(_0x5da703){for(var _0x52c98a=0x0,_0x29889e=events[_0x03c1('0x6')];_0x52c98a<_0x29889e;_0x52c98a++){var _0x3dfc54=events[_0x52c98a];var _0x585cdc=createListener(_0x03c1('0x7')+_0x3dfc54,_0x5da703);SquareProjectEvents['on'](_0x3dfc54,_0x585cdc);}}; \ No newline at end of file +var _0x4d81=['register','length','squareProject:','save','remove','update','emit','removeListener'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4d81,0x123));var _0x14d8=function(_0x17f924,_0x1b131b){_0x17f924=_0x17f924-0x0;var _0x45b0cc=_0x4d81[_0x17f924];return _0x45b0cc;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x14d8('0x0'),_0x14d8('0x1'),_0x14d8('0x2')];function createListener(_0x574655,_0x1d703b){return function(_0x37d391){_0x1d703b[_0x14d8('0x3')](_0x574655,_0x37d391);};}function removeListener(_0x47d88b,_0x30822c){return function(){SquareProjectEvents[_0x14d8('0x4')](_0x47d88b,_0x30822c);};}exports[_0x14d8('0x5')]=function(_0x2855a3){for(var _0x40bd93=0x0,_0xf4cf5f=events[_0x14d8('0x6')];_0x40bd93<_0xf4cf5f;_0x40bd93++){var _0x28d4b9=events[_0x40bd93];var _0x445705=createListener(_0x14d8('0x7')+_0x28d4b9,_0x2855a3);SquareProjectEvents['on'](_0x28d4b9,_0x445705);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index abc6537..eac6fd8 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x17bbf8,_0x3635ae){var _0x70fec0=function(_0x7e35b8){while(--_0x7e35b8){_0x17bbf8['push'](_0x17bbf8['shift']());}};_0x70fec0(++_0x3635ae);}(_0x1261,0x144));var _0x1126=function(_0x21bef5,_0x27b94a){_0x21bef5=_0x21bef5-0x0;var _0x524300=_0x1261[_0x21bef5];return _0x524300;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x7217,0x19e));var _0x7721=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7217[_0x34bf97];return _0x292719;};'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('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ccaaf1a..31793c8 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 _0x2bd8=['STRING','VIRTUAL','getDataValue','substring','sequelize'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x2bd8,0x130));var _0x82bd=function(_0x1a9397,_0x102a8a){_0x1a9397=_0x1a9397-0x0;var _0x8a9bd1=_0x2bd8[_0x1a9397];return _0x8a9bd1;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x82bd('0x1')]},'callerid':{'type':Sequelize[_0x82bd('0x1')]},'calleridname':{'type':Sequelize[_0x82bd('0x1')]},'context':{'type':Sequelize[_0x82bd('0x1')]},'extension':{'type':Sequelize[_0x82bd('0x1')]},'priority':{'type':Sequelize[_0x82bd('0x1')]},'accountcode':{'type':Sequelize[_0x82bd('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x82bd('0x1')]},'saveName':{'type':Sequelize[_0x82bd('0x1')]},'filename':{'type':Sequelize[_0x82bd('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x82bd('0x2')],'get':function(){var _0x77d7a9='';var _0x226f60=this[_0x82bd('0x3')]('savePath');if(_0x226f60){_0x77d7a9=_0x226f60[_0x82bd('0x4')](_0x226f60['lastIndexOf']('.'));}return _0x77d7a9;}}}; \ No newline at end of file +var _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf494,0x1c6));var _0x4f49=function(_0x28b5e3,_0xa45531){_0x28b5e3=_0x28b5e3-0x0;var _0x199af8=_0xf494[_0x28b5e3];return _0x199af8;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 48df130..fa36890 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 _0xd0b3=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','length','create','catch','body','find','download','../../components/encryptor','uniqueid','savePath','format','existsSync','secrets','recording','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xfc72d8,_0x107d6a){var _0x33a838=function(_0x449985){while(--_0x449985){_0xfc72d8['push'](_0xfc72d8['shift']());}};_0x33a838(++_0x107d6a);}(_0xd0b3,0x118));var _0x3d0b=function(_0x3356cd,_0x1664e1){_0x3356cd=_0x3356cd-0x0;var _0x3d8582=_0xd0b3[_0x3356cd];return _0x3d8582;};'use strict';var emlformat=require(_0x3d0b('0x0'));var rimraf=require(_0x3d0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d0b('0x2'));var rp=require(_0x3d0b('0x3'));var moment=require(_0x3d0b('0x4'));var BPromise=require(_0x3d0b('0x5'));var Mustache=require(_0x3d0b('0x6'));var util=require(_0x3d0b('0x7'));var path=require(_0x3d0b('0x8'));var sox=require(_0x3d0b('0x9'));var csv=require(_0x3d0b('0xa'));var ejs=require(_0x3d0b('0xb'));var fs=require('fs');var fs_extra=require(_0x3d0b('0xc'));var _=require(_0x3d0b('0xd'));var squel=require(_0x3d0b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d0b('0xf'));var toCsv=require(_0x3d0b('0xa'));var querystring=require(_0x3d0b('0x10'));var Papa=require(_0x3d0b('0x11'));var Redis=require('ioredis');var authService=require(_0x3d0b('0x12'));var qs=require(_0x3d0b('0x13'));var as=require(_0x3d0b('0x14'));var hardwareService=require(_0x3d0b('0x15'));var logger=require(_0x3d0b('0x16'))(_0x3d0b('0x17'));var utils=require(_0x3d0b('0x18'));var config=require(_0x3d0b('0x19'));var licenseUtil=require(_0x3d0b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50b988,_0x20158f){_0x20158f=_0x20158f||0xcc;return function(_0x35e096){if(_0x35e096){return _0x50b988[_0x3d0b('0x1b')](_0x20158f);}return _0x50b988['status'](_0x20158f)[_0x3d0b('0x1c')]();};}function respondWithResult(_0x473e85,_0x5dcf69){_0x5dcf69=_0x5dcf69||0xc8;return function(_0x4d8287){if(_0x4d8287){return _0x473e85[_0x3d0b('0x1d')](_0x5dcf69)[_0x3d0b('0x1e')](_0x4d8287);}};}function respondWithFilteredResult(_0x289ec3,_0x27019e){return function(_0x4b5649){if(_0x4b5649){var _0x47cf67=typeof _0x27019e['offset']===_0x3d0b('0x1f')&&typeof _0x27019e[_0x3d0b('0x20')]===_0x3d0b('0x1f');var _0x316592=_0x4b5649['count'];var _0x39c5d7=_0x47cf67?0x0:_0x27019e[_0x3d0b('0x21')];var _0x5a347b=_0x47cf67?_0x4b5649[_0x3d0b('0x22')]:_0x27019e['offset']+_0x27019e[_0x3d0b('0x20')];var _0x5d9efd;if(_0x5a347b>=_0x316592){_0x5a347b=_0x316592;_0x5d9efd=0xc8;}else{_0x5d9efd=0xce;}_0x289ec3['status'](_0x5d9efd);return _0x289ec3['set'](_0x3d0b('0x23'),_0x39c5d7+'-'+_0x5a347b+'/'+_0x316592)[_0x3d0b('0x1e')](_0x4b5649);}return null;};}function patchUpdates(_0x1935e8){return function(_0x3c879d){try{jsonpatch[_0x3d0b('0x24')](_0x3c879d,_0x1935e8,!![]);}catch(_0xec5023){return BPromise[_0x3d0b('0x25')](_0xec5023);}return _0x3c879d[_0x3d0b('0x26')]();};}function saveUpdates(_0x3edd5b,_0x177fb5){return function(_0x22f13d){if(_0x22f13d){return _0x22f13d[_0x3d0b('0x27')](_0x3edd5b)['then'](function(_0x4a5d2c){return _0x4a5d2c;});}return null;};}function removeEntity(_0x22273a,_0x5a32b4){return function(_0x3489c6){if(_0x3489c6){return _0x3489c6[_0x3d0b('0x28')]()['then'](function(){_0x22273a[_0x3d0b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50959f,_0x3c2257){return function(_0x3afc52){if(!_0x3afc52){_0x50959f[_0x3d0b('0x1b')](0x194);}return _0x3afc52;};}function handleError(_0x49d0dc,_0x19b993){_0x19b993=_0x19b993||0x1f4;return function(_0xb201dc){logger[_0x3d0b('0x29')](_0xb201dc[_0x3d0b('0x2a')]);if(_0xb201dc['name']){delete _0xb201dc[_0x3d0b('0x2b')];}_0x49d0dc[_0x3d0b('0x1d')](_0x19b993)[_0x3d0b('0x2c')](_0xb201dc);};}exports[_0x3d0b('0x2d')]=function(_0x133adb,_0x2d2593){var _0x46ef14={},_0x39ee58={},_0x5673a2={'count':0x0,'rows':[]};var _0x33fbdd=_[_0x3d0b('0x2e')](db[_0x3d0b('0x2f')][_0x3d0b('0x30')],function(_0x48054b){return{'name':_0x48054b[_0x3d0b('0x31')],'type':_0x48054b['type'][_0x3d0b('0x32')]};});_0x39ee58[_0x3d0b('0x33')]=_[_0x3d0b('0x2e')](_0x33fbdd,_0x3d0b('0x2b'));_0x39ee58[_0x3d0b('0x34')]=_[_0x3d0b('0x35')](_0x133adb['query']);_0x39ee58['filters']=_[_0x3d0b('0x36')](_0x39ee58['model'],_0x39ee58['query']);_0x46ef14[_0x3d0b('0x37')]=_[_0x3d0b('0x36')](_0x39ee58['model'],qs['fields'](_0x133adb[_0x3d0b('0x34')][_0x3d0b('0x38')]));_0x46ef14[_0x3d0b('0x37')]=_0x46ef14[_0x3d0b('0x37')]['length']?_0x46ef14['attributes']:_0x39ee58[_0x3d0b('0x33')];if(!_0x133adb[_0x3d0b('0x34')][_0x3d0b('0x39')]('nolimit')){_0x46ef14[_0x3d0b('0x20')]=qs[_0x3d0b('0x20')](_0x133adb[_0x3d0b('0x34')][_0x3d0b('0x20')]);_0x46ef14['offset']=qs['offset'](_0x133adb[_0x3d0b('0x34')][_0x3d0b('0x21')]);}_0x46ef14[_0x3d0b('0x3a')]=qs[_0x3d0b('0x3b')](_0x133adb[_0x3d0b('0x34')][_0x3d0b('0x3b')]);_0x46ef14[_0x3d0b('0x3c')]=qs[_0x3d0b('0x3d')](_[_0x3d0b('0x3e')](_0x133adb[_0x3d0b('0x34')],_0x39ee58['filters']),_0x33fbdd);if(_0x133adb[_0x3d0b('0x34')][_0x3d0b('0x3f')]){_0x46ef14['where']=_[_0x3d0b('0x40')](_0x46ef14[_0x3d0b('0x3c')],{'$or':_[_0x3d0b('0x2e')](_0x33fbdd,function(_0x32530e){if(_0x32530e[_0x3d0b('0x41')]!==_0x3d0b('0x42')){var _0x12da18={};_0x12da18[_0x32530e['name']]={'$like':'%'+_0x133adb[_0x3d0b('0x34')][_0x3d0b('0x3f')]+'%'};return _0x12da18;}})});}_0x46ef14=_[_0x3d0b('0x40')]({},_0x46ef14,_0x133adb[_0x3d0b('0x43')]);var _0x653e3={'where':_0x46ef14['where']};return db[_0x3d0b('0x2f')]['count'](_0x653e3)[_0x3d0b('0x44')](function(_0x54aa35){_0x5673a2[_0x3d0b('0x22')]=_0x54aa35;if(_0x133adb['query'][_0x3d0b('0x45')]){_0x46ef14[_0x3d0b('0x46')]=[{'all':!![]}];}return db['SquareRecording'][_0x3d0b('0x47')](_0x46ef14);})[_0x3d0b('0x44')](function(_0x8acc40){_0x5673a2[_0x3d0b('0x48')]=_0x8acc40;return _0x5673a2;})[_0x3d0b('0x44')](respondWithFilteredResult(_0x2d2593,_0x46ef14))['catch'](handleError(_0x2d2593,null));};exports[_0x3d0b('0x49')]=function(_0x5d8e81,_0x50fa47){var _0x414718={'raw':!![],'where':{'id':_0x5d8e81[_0x3d0b('0x4a')]['id']}},_0x416b53={};_0x416b53[_0x3d0b('0x33')]=_['keys'](db[_0x3d0b('0x2f')]['rawAttributes']);_0x416b53[_0x3d0b('0x34')]=_[_0x3d0b('0x35')](_0x5d8e81[_0x3d0b('0x34')]);_0x416b53[_0x3d0b('0x3d')]=_['intersection'](_0x416b53['model'],_0x416b53[_0x3d0b('0x34')]);_0x414718['attributes']=_[_0x3d0b('0x36')](_0x416b53[_0x3d0b('0x33')],qs[_0x3d0b('0x38')](_0x5d8e81[_0x3d0b('0x34')]['fields']));_0x414718['attributes']=_0x414718[_0x3d0b('0x37')][_0x3d0b('0x4b')]?_0x414718['attributes']:_0x416b53['model'];if(_0x5d8e81[_0x3d0b('0x34')][_0x3d0b('0x45')]){_0x414718[_0x3d0b('0x46')]=[{'all':!![]}];}_0x414718=_[_0x3d0b('0x40')]({},_0x414718,_0x5d8e81[_0x3d0b('0x43')]);return db[_0x3d0b('0x2f')]['find'](_0x414718)[_0x3d0b('0x44')](handleEntityNotFound(_0x50fa47,null))[_0x3d0b('0x44')](respondWithResult(_0x50fa47,null))['catch'](handleError(_0x50fa47,null));};exports[_0x3d0b('0x4c')]=function(_0x5b9f65,_0x302d6c){return db[_0x3d0b('0x2f')][_0x3d0b('0x4c')](_0x5b9f65['body'],{})['then'](respondWithResult(_0x302d6c,0xc9))[_0x3d0b('0x4d')](handleError(_0x302d6c,null));};exports[_0x3d0b('0x27')]=function(_0x2134f7,_0x1fbee4){if(_0x2134f7[_0x3d0b('0x4e')]['id']){delete _0x2134f7[_0x3d0b('0x4e')]['id'];}return db[_0x3d0b('0x2f')][_0x3d0b('0x4f')]({'where':{'id':_0x2134f7[_0x3d0b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1fbee4,null))[_0x3d0b('0x44')](saveUpdates(_0x2134f7[_0x3d0b('0x4e')],null))[_0x3d0b('0x44')](respondWithResult(_0x1fbee4,null))[_0x3d0b('0x4d')](handleError(_0x1fbee4,null));};exports[_0x3d0b('0x50')]=function(_0x29be2b,_0x3c5b82,_0x37f769){var _0x2e2f03=require(_0x3d0b('0x51'));var _0x5efa0c=![];var _0xe320a8={};if(_0x29be2b[_0x3d0b('0x34')][_0x3d0b('0x41')]&&_0x29be2b[_0x3d0b('0x34')]['type']===_0x3d0b('0x52')){_0xe320a8[_0x3d0b('0x52')]=_0x29be2b[_0x3d0b('0x4a')]['id'];}else{_0xe320a8['id']=_0x29be2b[_0x3d0b('0x4a')]['id'];}return db[_0x3d0b('0x2f')]['find']({'where':_0xe320a8,'attributes':['id',_0x3d0b('0x53'),'filename'],'raw':!![]})[_0x3d0b('0x44')](handleEntityNotFound(_0x3c5b82,null))[_0x3d0b('0x44')](function(_0x263ea6){if(_0x263ea6){var _0x497be8=_0x263ea6[_0x3d0b('0x53')];var _0x24d3e7=util[_0x3d0b('0x54')]('%s.cypher',_0x497be8);if(fs[_0x3d0b('0x55')](_0x24d3e7)){_0x5efa0c=!![];return _0x2e2f03['decryptFile'](_0x24d3e7,_0x497be8,config[_0x3d0b('0x56')][_0x3d0b('0x57')])[_0x3d0b('0x44')](function(){return _0x263ea6;});}return _0x263ea6;}})['then'](function(_0x3a5a37){if(_0x3a5a37){var _0x2367f3=_0x3a5a37[_0x3d0b('0x53')];if(!fs[_0x3d0b('0x55')](_0x2367f3)){throw new db['Sequelize'][(_0x3d0b('0x58'))](_0x3d0b('0x59'));}if(_0x3a5a37[_0x3d0b('0x5a')]){return _0x3c5b82[_0x3d0b('0x50')](_0x2367f3,_0x3a5a37[_0x3d0b('0x5a')]+path[_0x3d0b('0x5b')](_0x2367f3),function(){if(_0x5efa0c){fs[_0x3d0b('0x5c')](_0x2367f3);}});}else{return _0x3c5b82[_0x3d0b('0x50')](_0x2367f3,function(_0x11b657){if(_0x5efa0c){fs[_0x3d0b('0x5c')](_0x2367f3);}});}}})[_0x3d0b('0x4d')](function(_0x4ad8cc){if(_0x4ad8cc[_0x3d0b('0x5d')]==='SquareRecording\x20not\x20found'){_0x3c5b82[_0x3d0b('0x1d')](0x194)['send'](_0x3d0b('0x5e'));}else{return handleError(_0x3c5b82,null);}});};exports[_0x3d0b('0x28')]=function(_0x325c2f,_0x29fca8){return db[_0x3d0b('0x2f')][_0x3d0b('0x4f')]({'where':{'id':_0x325c2f[_0x3d0b('0x4a')]['id']}})[_0x3d0b('0x44')](function(_0x11ac6b){if(_[_0x3d0b('0x5f')](_0x11ac6b)){throw new ReferenceError(_0x3d0b('0x60'));}return _0x11ac6b;})['then'](function(_0x418073){var _0x30119a=_0x418073['savePath'];logger[_0x3d0b('0x61')](_0x3d0b('0x62'),_0x30119a);if(!_[_0x3d0b('0x5f')](_0x418073[_0x3d0b('0x53')])&&fs[_0x3d0b('0x55')](_0x30119a)){logger['info'](_0x3d0b('0x63')+_0x30119a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x30119a);}_0x30119a=_0x30119a+'.cypher';if(!_[_0x3d0b('0x5f')](_0x418073[_0x3d0b('0x53')])&&fs['existsSync'](_0x30119a)){logger[_0x3d0b('0x61')](_0x3d0b('0x63')+_0x30119a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3d0b('0x64')](_0x30119a);}return _0x418073;})[_0x3d0b('0x44')](function(_0x191708){if(!_0x191708)throw new InternalError();return _0x191708[_0x3d0b('0x28')]();})[_0x3d0b('0x44')](function(){_0x29fca8[_0x3d0b('0x1d')](0xcc)[_0x3d0b('0x1c')]();})[_0x3d0b('0x4d')](handleError(_0x29fca8,null));}; \ No newline at end of file +var _0x5670=['fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','where','pick','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','Sequelize','SquareRecording\x20not\x20found','send','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','update','destroy','error','name','index','map','SquareRecording'];(function(_0x45d1b1,_0x328cb0){var _0x313c30=function(_0x2b3214){while(--_0x2b3214){_0x45d1b1['push'](_0x45d1b1['shift']());}};_0x313c30(++_0x328cb0);}(_0x5670,0x1af));var _0x0567=function(_0x4539ca,_0x3a07cd){_0x4539ca=_0x4539ca-0x0;var _0x552d4a=_0x5670[_0x4539ca];return _0x552d4a;};'use strict';var emlformat=require(_0x0567('0x0'));var rimraf=require(_0x0567('0x1'));var zipdir=require(_0x0567('0x2'));var jsonpatch=require(_0x0567('0x3'));var rp=require('request-promise');var moment=require(_0x0567('0x4'));var BPromise=require(_0x0567('0x5'));var Mustache=require(_0x0567('0x6'));var util=require(_0x0567('0x7'));var path=require(_0x0567('0x8'));var sox=require(_0x0567('0x9'));var csv=require(_0x0567('0xa'));var ejs=require(_0x0567('0xb'));var fs=require('fs');var fs_extra=require(_0x0567('0xc'));var _=require(_0x0567('0xd'));var squel=require(_0x0567('0xe'));var crypto=require(_0x0567('0xf'));var jsforce=require(_0x0567('0x10'));var deskjs=require(_0x0567('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0567('0x12'));var Redis=require('ioredis');var authService=require(_0x0567('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0567('0x14'));var hardwareService=require(_0x0567('0x15'));var logger=require(_0x0567('0x16'))('api');var utils=require(_0x0567('0x17'));var config=require(_0x0567('0x18'));var licenseUtil=require(_0x0567('0x19'));var db=require(_0x0567('0x1a'))['db'];function respondWithStatusCode(_0x400ffd,_0x5eccc2){_0x5eccc2=_0x5eccc2||0xcc;return function(_0x2a16fa){if(_0x2a16fa){return _0x400ffd[_0x0567('0x1b')](_0x5eccc2);}return _0x400ffd['status'](_0x5eccc2)[_0x0567('0x1c')]();};}function respondWithResult(_0x5064ac,_0x37ac8e){_0x37ac8e=_0x37ac8e||0xc8;return function(_0xf193d2){if(_0xf193d2){return _0x5064ac[_0x0567('0x1d')](_0x37ac8e)[_0x0567('0x1e')](_0xf193d2);}};}function respondWithFilteredResult(_0x2f79a6,_0x384102){return function(_0x1e04f9){if(_0x1e04f9){var _0x47117c=typeof _0x384102[_0x0567('0x1f')]==='undefined'&&typeof _0x384102[_0x0567('0x20')]===_0x0567('0x21');var _0x5ee4a8=_0x1e04f9[_0x0567('0x22')];var _0xb4fcac=_0x47117c?0x0:_0x384102[_0x0567('0x1f')];var _0x3d429e=_0x47117c?_0x1e04f9[_0x0567('0x22')]:_0x384102['offset']+_0x384102[_0x0567('0x20')];var _0x23e840;if(_0x3d429e>=_0x5ee4a8){_0x3d429e=_0x5ee4a8;_0x23e840=0xc8;}else{_0x23e840=0xce;}_0x2f79a6['status'](_0x23e840);return _0x2f79a6[_0x0567('0x23')]('Content-Range',_0xb4fcac+'-'+_0x3d429e+'/'+_0x5ee4a8)[_0x0567('0x1e')](_0x1e04f9);}return null;};}function patchUpdates(_0x449d07){return function(_0x954b74){try{jsonpatch['apply'](_0x954b74,_0x449d07,!![]);}catch(_0x44a53e){return BPromise[_0x0567('0x24')](_0x44a53e);}return _0x954b74['save']();};}function saveUpdates(_0x65c93d,_0x1fdb41){return function(_0x41d424){if(_0x41d424){return _0x41d424[_0x0567('0x25')](_0x65c93d)['then'](function(_0xf1d09b){return _0xf1d09b;});}return null;};}function removeEntity(_0x63e087,_0x1d64b1){return function(_0x32c60d){if(_0x32c60d){return _0x32c60d[_0x0567('0x26')]()['then'](function(){_0x63e087[_0x0567('0x1d')](0xcc)[_0x0567('0x1c')]();});}};}function handleEntityNotFound(_0x51e27e,_0x24f52f){return function(_0x1842dc){if(!_0x1842dc){_0x51e27e[_0x0567('0x1b')](0x194);}return _0x1842dc;};}function handleError(_0x23b260,_0x5c810e){_0x5c810e=_0x5c810e||0x1f4;return function(_0xe80a12){logger[_0x0567('0x27')](_0xe80a12['stack']);if(_0xe80a12[_0x0567('0x28')]){delete _0xe80a12[_0x0567('0x28')];}_0x23b260[_0x0567('0x1d')](_0x5c810e)['send'](_0xe80a12);};}exports[_0x0567('0x29')]=function(_0x2cef5c,_0x2b0b7a){var _0x13abf8={},_0x271bd4={},_0x3bd782={'count':0x0,'rows':[]};var _0x4df3f2=_[_0x0567('0x2a')](db[_0x0567('0x2b')]['rawAttributes'],function(_0x2946aa){return{'name':_0x2946aa[_0x0567('0x2c')],'type':_0x2946aa[_0x0567('0x2d')][_0x0567('0x2e')]};});_0x271bd4[_0x0567('0x2f')]=_[_0x0567('0x2a')](_0x4df3f2,_0x0567('0x28'));_0x271bd4['query']=_[_0x0567('0x30')](_0x2cef5c[_0x0567('0x31')]);_0x271bd4[_0x0567('0x32')]=_[_0x0567('0x33')](_0x271bd4['model'],_0x271bd4[_0x0567('0x31')]);_0x13abf8[_0x0567('0x34')]=_[_0x0567('0x33')](_0x271bd4[_0x0567('0x2f')],qs[_0x0567('0x35')](_0x2cef5c[_0x0567('0x31')][_0x0567('0x35')]));_0x13abf8[_0x0567('0x34')]=_0x13abf8[_0x0567('0x34')]['length']?_0x13abf8['attributes']:_0x271bd4[_0x0567('0x2f')];if(!_0x2cef5c[_0x0567('0x31')]['hasOwnProperty'](_0x0567('0x36'))){_0x13abf8[_0x0567('0x20')]=qs[_0x0567('0x20')](_0x2cef5c['query']['limit']);_0x13abf8[_0x0567('0x1f')]=qs['offset'](_0x2cef5c[_0x0567('0x31')]['offset']);}_0x13abf8[_0x0567('0x37')]=qs['sort'](_0x2cef5c[_0x0567('0x31')]['sort']);_0x13abf8[_0x0567('0x38')]=qs[_0x0567('0x32')](_[_0x0567('0x39')](_0x2cef5c[_0x0567('0x31')],_0x271bd4[_0x0567('0x32')]),_0x4df3f2);if(_0x2cef5c['query']['filter']){_0x13abf8[_0x0567('0x38')]=_['merge'](_0x13abf8[_0x0567('0x38')],{'$or':_['map'](_0x4df3f2,function(_0x2ad3e1){if(_0x2ad3e1[_0x0567('0x2d')]!==_0x0567('0x3a')){var _0x3c9a1e={};_0x3c9a1e[_0x2ad3e1[_0x0567('0x28')]]={'$like':'%'+_0x2cef5c[_0x0567('0x31')][_0x0567('0x3b')]+'%'};return _0x3c9a1e;}})});}_0x13abf8=_['merge']({},_0x13abf8,_0x2cef5c[_0x0567('0x3c')]);var _0x20c2b6={'where':_0x13abf8['where']};return db[_0x0567('0x2b')][_0x0567('0x22')](_0x20c2b6)[_0x0567('0x3d')](function(_0x5e2076){_0x3bd782[_0x0567('0x22')]=_0x5e2076;if(_0x2cef5c[_0x0567('0x31')][_0x0567('0x3e')]){_0x13abf8[_0x0567('0x3f')]=[{'all':!![]}];}return db[_0x0567('0x2b')][_0x0567('0x40')](_0x13abf8);})[_0x0567('0x3d')](function(_0x3ca545){_0x3bd782[_0x0567('0x41')]=_0x3ca545;return _0x3bd782;})['then'](respondWithFilteredResult(_0x2b0b7a,_0x13abf8))[_0x0567('0x42')](handleError(_0x2b0b7a,null));};exports[_0x0567('0x43')]=function(_0x192c40,_0x4a793a){var _0x311881={'raw':!![],'where':{'id':_0x192c40[_0x0567('0x44')]['id']}},_0x654ff={};_0x654ff[_0x0567('0x2f')]=_[_0x0567('0x30')](db['SquareRecording'][_0x0567('0x45')]);_0x654ff[_0x0567('0x31')]=_[_0x0567('0x30')](_0x192c40['query']);_0x654ff['filters']=_['intersection'](_0x654ff[_0x0567('0x2f')],_0x654ff[_0x0567('0x31')]);_0x311881[_0x0567('0x34')]=_[_0x0567('0x33')](_0x654ff['model'],qs[_0x0567('0x35')](_0x192c40[_0x0567('0x31')][_0x0567('0x35')]));_0x311881[_0x0567('0x34')]=_0x311881['attributes'][_0x0567('0x46')]?_0x311881[_0x0567('0x34')]:_0x654ff[_0x0567('0x2f')];if(_0x192c40[_0x0567('0x31')][_0x0567('0x3e')]){_0x311881['include']=[{'all':!![]}];}_0x311881=_[_0x0567('0x47')]({},_0x311881,_0x192c40['options']);return db[_0x0567('0x2b')][_0x0567('0x48')](_0x311881)['then'](handleEntityNotFound(_0x4a793a,null))['then'](respondWithResult(_0x4a793a,null))[_0x0567('0x42')](handleError(_0x4a793a,null));};exports['create']=function(_0x2087a9,_0x56344f){return db[_0x0567('0x2b')][_0x0567('0x49')](_0x2087a9[_0x0567('0x4a')],{})['then'](respondWithResult(_0x56344f,0xc9))[_0x0567('0x42')](handleError(_0x56344f,null));};exports['update']=function(_0x4ed10b,_0x492895){if(_0x4ed10b[_0x0567('0x4a')]['id']){delete _0x4ed10b[_0x0567('0x4a')]['id'];}return db[_0x0567('0x2b')][_0x0567('0x48')]({'where':{'id':_0x4ed10b[_0x0567('0x44')]['id']}})[_0x0567('0x3d')](handleEntityNotFound(_0x492895,null))['then'](saveUpdates(_0x4ed10b[_0x0567('0x4a')],null))[_0x0567('0x3d')](respondWithResult(_0x492895,null))[_0x0567('0x42')](handleError(_0x492895,null));};exports[_0x0567('0x4b')]=function(_0xa69f07,_0x104c69,_0x244d82){var _0x27eaf6=require(_0x0567('0x4c'));var _0x20ce73=![];var _0xf2fe0c={};if(_0xa69f07[_0x0567('0x31')]['type']&&_0xa69f07['query'][_0x0567('0x2d')]===_0x0567('0x4d')){_0xf2fe0c[_0x0567('0x4d')]=_0xa69f07[_0x0567('0x44')]['id'];}else{_0xf2fe0c['id']=_0xa69f07[_0x0567('0x44')]['id'];}return db['SquareRecording'][_0x0567('0x48')]({'where':_0xf2fe0c,'attributes':['id',_0x0567('0x4e'),_0x0567('0x4f')],'raw':!![]})[_0x0567('0x3d')](handleEntityNotFound(_0x104c69,null))[_0x0567('0x3d')](function(_0x53ebf3){if(_0x53ebf3){var _0x11e907=_0x53ebf3[_0x0567('0x4e')];var _0x3b4b61=util[_0x0567('0x50')](_0x0567('0x51'),_0x11e907);if(fs[_0x0567('0x52')](_0x3b4b61)){_0x20ce73=!![];return _0x27eaf6[_0x0567('0x53')](_0x3b4b61,_0x11e907,config['secrets']['recording'])[_0x0567('0x3d')](function(){return _0x53ebf3;});}return _0x53ebf3;}})[_0x0567('0x3d')](function(_0x3fd7c9){if(_0x3fd7c9){var _0x5b9a8c=_0x3fd7c9[_0x0567('0x4e')];if(!fs[_0x0567('0x52')](_0x5b9a8c)){throw new db[(_0x0567('0x54'))]['ValidationError'](_0x0567('0x55'));}if(_0x3fd7c9[_0x0567('0x4f')]){return _0x104c69['download'](_0x5b9a8c,_0x3fd7c9['filename']+path['extname'](_0x5b9a8c),function(){if(_0x20ce73){fs['unlink'](_0x5b9a8c);}});}else{return _0x104c69[_0x0567('0x4b')](_0x5b9a8c,function(_0x2a62d7){if(_0x20ce73){fs['unlink'](_0x5b9a8c);}});}}})[_0x0567('0x42')](function(_0x34a158){if(_0x34a158['message']===_0x0567('0x55')){_0x104c69[_0x0567('0x1d')](0x194)[_0x0567('0x56')]('Not\x20found');}else{return handleError(_0x104c69,null);}});};exports['destroy']=function(_0x246877,_0x5174fc){return db['SquareRecording'][_0x0567('0x48')]({'where':{'id':_0x246877[_0x0567('0x44')]['id']}})[_0x0567('0x3d')](function(_0x2fed1e){if(_[_0x0567('0x57')](_0x2fed1e)){throw new ReferenceError(_0x0567('0x58'));}return _0x2fed1e;})[_0x0567('0x3d')](function(_0x5882a3){var _0x2d320a=_0x5882a3[_0x0567('0x4e')];logger[_0x0567('0x59')](_0x0567('0x5a'),_0x2d320a);if(!_['isNil'](_0x5882a3['savePath'])&&fs[_0x0567('0x52')](_0x2d320a)){logger[_0x0567('0x59')](_0x0567('0x5b')+_0x2d320a+_0x0567('0x5c'));fs[_0x0567('0x5d')](_0x2d320a);}_0x2d320a=_0x2d320a+_0x0567('0x5e');if(!_[_0x0567('0x57')](_0x5882a3[_0x0567('0x4e')])&&fs[_0x0567('0x52')](_0x2d320a)){logger[_0x0567('0x59')](_0x0567('0x5b')+_0x2d320a+_0x0567('0x5c'));fs[_0x0567('0x5d')](_0x2d320a);}return _0x5882a3;})[_0x0567('0x3d')](function(_0x43f0f9){if(!_0x43f0f9)throw new InternalError();return _0x43f0f9['destroy']();})[_0x0567('0x3d')](function(){_0x5174fc[_0x0567('0x1d')](0xcc)[_0x0567('0x1c')]();})[_0x0567('0x42')](handleError(_0x5174fc,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ff6909a..48c3455 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 _0xd4ad=['moment','path','rimraf','SquareRecording','lodash','util','../../config/logger','api'];(function(_0x5a5bf9,_0x1179f1){var _0x221813=function(_0x6911fe){while(--_0x6911fe){_0x5a5bf9['push'](_0x5a5bf9['shift']());}};_0x221813(++_0x1179f1);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x1ae097,_0x315bb4){_0x1ae097=_0x1ae097-0x0;var _0x3c329a=_0xd4ad[_0x1ae097];return _0x3c329a;};'use strict';var _=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var logger=require(_0xdd4a('0x2'))(_0xdd4a('0x3'));var moment=require(_0xdd4a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd4a('0x5'));var rimraf=require(_0xdd4a('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x57c5c3,_0x381f07){return _0x57c5c3['define'](_0xdd4a('0x7'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58c9=['request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x278ea7,_0x543b97){var _0x328ab4=function(_0x4a8323){while(--_0x4a8323){_0x278ea7['push'](_0x278ea7['shift']());}};_0x328ab4(++_0x543b97);}(_0x58c9,0x1bc));var _0x958c=function(_0x3e4c1f,_0x40b8d7){_0x3e4c1f=_0x3e4c1f-0x0;var _0x10c795=_0x58c9[_0x3e4c1f];return _0x10c795;};'use strict';var _=require(_0x958c('0x0'));var util=require(_0x958c('0x1'));var logger=require(_0x958c('0x2'))(_0x958c('0x3'));var moment=require(_0x958c('0x4'));var BPromise=require(_0x958c('0x5'));var rp=require(_0x958c('0x6'));var fs=require('fs');var path=require(_0x958c('0x7'));var rimraf=require(_0x958c('0x8'));var config=require(_0x958c('0x9'));var attributes=require(_0x958c('0xa'));module[_0x958c('0xb')]=function(_0x3e5ce2,_0x4ddd59){return _0x3e5ce2[_0x958c('0xc')](_0x958c('0xd'),attributes,{'tableName':_0x958c('0xe'),'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 ab20f00..c856976 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 _0xd989=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSquareRecording','SquareRecording','create','body','options','lodash'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0xd989,0xe9));var _0x9d98=function(_0xe323e3,_0x110473){_0xe323e3=_0xe323e3-0x0;var _0x208a43=_0xd989[_0xe323e3];return _0x208a43;};'use strict';var _=require(_0x9d98('0x0'));var util=require('util');var moment=require(_0x9d98('0x1'));var BPromise=require(_0x9d98('0x2'));var rs=require(_0x9d98('0x3'));var fs=require('fs');var Redis=require(_0x9d98('0x4'));var db=require(_0x9d98('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d98('0x6'))(_0x9d98('0x7'));var config=require('../../config/environment');var jayson=require(_0x9d98('0x8'));var client=jayson[_0x9d98('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x67e60b,_0x35f7ad,_0x3e58c0){return new BPromise(function(_0x26976b,_0x527a71){return client[_0x9d98('0xa')](_0x67e60b,_0x3e58c0)[_0x9d98('0xb')](function(_0x4ca3d2){logger['info'](_0x9d98('0xc'),_0x35f7ad,_0x9d98('0xd'));logger[_0x9d98('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x35f7ad,'request\x20sent',JSON[_0x9d98('0xf')](_0x4ca3d2));if(_0x4ca3d2[_0x9d98('0x10')]){if(_0x4ca3d2[_0x9d98('0x10')][_0x9d98('0x11')]===0x1f4){logger[_0x9d98('0x10')](_0x9d98('0xc'),_0x35f7ad,_0x4ca3d2[_0x9d98('0x10')][_0x9d98('0x12')]);return _0x527a71(_0x4ca3d2['error'][_0x9d98('0x12')]);}logger[_0x9d98('0x10')](_0x9d98('0xc'),_0x35f7ad,_0x4ca3d2[_0x9d98('0x10')][_0x9d98('0x12')]);return _0x26976b(_0x4ca3d2[_0x9d98('0x10')]['message']);}else{logger[_0x9d98('0x13')](_0x9d98('0xc'),_0x35f7ad,_0x9d98('0xd'));_0x26976b(_0x4ca3d2['result'][_0x9d98('0x12')]);}})[_0x9d98('0x14')](function(_0x119d95){logger[_0x9d98('0x10')](_0x9d98('0xc'),_0x35f7ad,_0x119d95);_0x527a71(_0x119d95);});});}exports[_0x9d98('0x15')]=function(_0x22b74f){var _0xf718cf=this;return new Promise(function(_0x31da53,_0x18d397){return db[_0x9d98('0x16')][_0x9d98('0x17')](_0x22b74f[_0x9d98('0x18')],{'raw':_0x22b74f[_0x9d98('0x19')]?_0x22b74f[_0x9d98('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9d98('0xb')](function(_0x1ce1f2){logger['info'](_0x9d98('0x15'),_0x22b74f);logger[_0x9d98('0xe')](_0x9d98('0x15'),_0x22b74f,JSON['stringify'](_0x1ce1f2));_0x31da53(_0x1ce1f2);})[_0x9d98('0x14')](function(_0x1d3690){logger[_0x9d98('0x10')](_0x9d98('0x15'),_0x1d3690['message'],_0x22b74f);_0x18d397(_0xf718cf[_0x9d98('0x10')](0x1f4,_0x1d3690[_0x9d98('0x12')]));});});}; \ No newline at end of file +var _0x9e1e=['debug','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','info'];(function(_0x21e61a,_0x503d4b){var _0x8961fb=function(_0x5daebd){while(--_0x5daebd){_0x21e61a['push'](_0x21e61a['shift']());}};_0x8961fb(++_0x503d4b);}(_0x9e1e,0xb5));var _0xe9e1=function(_0x5d5263,_0x23889e){_0x5d5263=_0x5d5263-0x0;var _0x3aad39=_0x9e1e[_0x5d5263];return _0x3aad39;};'use strict';var _=require(_0xe9e1('0x0'));var util=require(_0xe9e1('0x1'));var moment=require(_0xe9e1('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9e1('0x5'))(_0xe9e1('0x6'));var config=require(_0xe9e1('0x7'));var jayson=require(_0xe9e1('0x8'));var client=jayson[_0xe9e1('0x9')][_0xe9e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa0ea42,_0x4ca9b6,_0x10d967){return new BPromise(function(_0xfb1261,_0x3fca3e){return client[_0xe9e1('0xb')](_0xa0ea42,_0x10d967)[_0xe9e1('0xc')](function(_0x329955){logger['info'](_0xe9e1('0xd'),_0x4ca9b6,_0xe9e1('0xe'));logger['debug'](_0xe9e1('0xf'),_0x4ca9b6,'request\x20sent',JSON[_0xe9e1('0x10')](_0x329955));if(_0x329955[_0xe9e1('0x11')]){if(_0x329955[_0xe9e1('0x11')][_0xe9e1('0x12')]===0x1f4){logger[_0xe9e1('0x11')](_0xe9e1('0xd'),_0x4ca9b6,_0x329955['error'][_0xe9e1('0x13')]);return _0x3fca3e(_0x329955[_0xe9e1('0x11')]['message']);}logger['error'](_0xe9e1('0xd'),_0x4ca9b6,_0x329955['error'][_0xe9e1('0x13')]);return _0xfb1261(_0x329955['error']['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x4ca9b6,_0xe9e1('0xe'));_0xfb1261(_0x329955[_0xe9e1('0x14')]['message']);}})[_0xe9e1('0x15')](function(_0x46a1b0){logger[_0xe9e1('0x11')]('SquareRecording,\x20%s,\x20%s',_0x4ca9b6,_0x46a1b0);_0x3fca3e(_0x46a1b0);});});}exports[_0xe9e1('0x16')]=function(_0x49ea56){var _0x4477c1=this;return new Promise(function(_0x46dcde,_0xff16f7){return db[_0xe9e1('0x17')][_0xe9e1('0x18')](_0x49ea56[_0xe9e1('0x19')],{'raw':_0x49ea56[_0xe9e1('0x1a')]?_0x49ea56[_0xe9e1('0x1a')][_0xe9e1('0x1b')]===undefined?!![]:![]:!![]})[_0xe9e1('0xc')](function(_0x916081){logger[_0xe9e1('0x1c')](_0xe9e1('0x16'),_0x49ea56);logger[_0xe9e1('0x1d')](_0xe9e1('0x16'),_0x49ea56,JSON[_0xe9e1('0x10')](_0x916081));_0x46dcde(_0x916081);})[_0xe9e1('0x15')](function(_0x487be6){logger[_0xe9e1('0x11')](_0xe9e1('0x16'),_0x487be6[_0xe9e1('0x13')],_0x49ea56);_0xff16f7(_0x4477c1[_0xe9e1('0x11')](0x1f4,_0x487be6[_0xe9e1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ad0a25c..5b7a5f9 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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2b4fca,_0xddd816){var _0x311a6b=function(_0x3b799b){while(--_0x3b799b){_0x2b4fca['push'](_0x2b4fca['shift']());}};_0x311a6b(++_0xddd816);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ca1f8,_0x4afa33){_0x3ca1f8=_0x3ca1f8-0x0;var _0x94fb6b=_0xb10b[_0x3ca1f8];return _0x94fb6b;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xfc23d9,_0x502988){var _0xacee34=function(_0x307968){while(--_0x307968){_0xfc23d9['push'](_0xfc23d9['shift']());}};_0xacee34(++_0x502988);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c7423d7..d688998 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 _0x5552=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x4d6535,_0xd1cf17){var _0x9e09b7=function(_0x49e11f){while(--_0x49e11f){_0x4d6535['push'](_0x4d6535['shift']());}};_0x9e09b7(++_0xd1cf17);}(_0x5552,0x108));var _0x2555=function(_0x1b0c4e,_0x2e5e82){_0x1b0c4e=_0x1b0c4e-0x0;var _0x4ef5ff=_0x5552[_0x1b0c4e];return _0x4ef5ff;};'use strict';var Sequelize=require(_0x2555('0x0'));module['exports']={'network':{'type':Sequelize[_0x2555('0x1')]},'network_script':{'type':Sequelize[_0x2555('0x1')]},'request':{'type':Sequelize[_0x2555('0x1')]},'channel':{'type':Sequelize[_0x2555('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2555('0x1')]},'uniqueid':{'type':Sequelize[_0x2555('0x1')]},'version':{'type':Sequelize[_0x2555('0x1')]},'callerid':{'type':Sequelize[_0x2555('0x1')]},'calleridname':{'type':Sequelize[_0x2555('0x1')]},'callingpres':{'type':Sequelize[_0x2555('0x1')]},'callingani2':{'type':Sequelize[_0x2555('0x1')]},'callington':{'type':Sequelize[_0x2555('0x1')]},'callingtns':{'type':Sequelize[_0x2555('0x1')]},'dnid':{'type':Sequelize[_0x2555('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2555('0x1')]},'extension':{'type':Sequelize[_0x2555('0x1')]},'priority':{'type':Sequelize[_0x2555('0x1')]},'enhanced':{'type':Sequelize[_0x2555('0x1')]},'accountcode':{'type':Sequelize[_0x2555('0x1')]},'threadid':{'type':Sequelize[_0x2555('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2555('0x2')]},'leaveAt':{'type':Sequelize[_0x2555('0x2')]},'bot':{'type':Sequelize[_0x2555('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf0ae=['DATE','BOOLEAN','exports','STRING'];(function(_0x2a4172,_0x5bd9f1){var _0x24e48d=function(_0x241747){while(--_0x241747){_0x2a4172['push'](_0x2a4172['shift']());}};_0x24e48d(++_0x5bd9f1);}(_0xf0ae,0x14e));var _0xef0a=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xf0ae[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require('sequelize');module[_0xef0a('0x0')]={'network':{'type':Sequelize[_0xef0a('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xef0a('0x1')]},'channel':{'type':Sequelize[_0xef0a('0x1')]},'language':{'type':Sequelize[_0xef0a('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xef0a('0x1')]},'version':{'type':Sequelize[_0xef0a('0x1')]},'callerid':{'type':Sequelize[_0xef0a('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xef0a('0x1')]},'callingani2':{'type':Sequelize[_0xef0a('0x1')]},'callington':{'type':Sequelize[_0xef0a('0x1')]},'callingtns':{'type':Sequelize[_0xef0a('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xef0a('0x1')]},'context':{'type':Sequelize[_0xef0a('0x1')]},'extension':{'type':Sequelize[_0xef0a('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xef0a('0x1')]},'accountcode':{'type':Sequelize[_0xef0a('0x1')]},'threadid':{'type':Sequelize[_0xef0a('0x1')]},'project_name':{'type':Sequelize[_0xef0a('0x1')]},'joinAt':{'type':Sequelize[_0xef0a('0x2')]},'leaveAt':{'type':Sequelize[_0xef0a('0x2')]},'bot':{'type':Sequelize[_0xef0a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 7a7f353..cee4129 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 _0xcafc=['rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareReport'];(function(_0x482166,_0x1cec2b){var _0x1e9820=function(_0x479993){while(--_0x479993){_0x482166['push'](_0x482166['shift']());}};_0x1e9820(++_0x1cec2b);}(_0xcafc,0xb6));var _0xccaf=function(_0xc109cb,_0x3e497b){_0xc109cb=_0xc109cb-0x0;var _0x1448f6=_0xcafc[_0xc109cb];return _0x1448f6;};'use strict';var emlformat=require(_0xccaf('0x0'));var rimraf=require(_0xccaf('0x1'));var zipdir=require(_0xccaf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccaf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xccaf('0x4'));var util=require(_0xccaf('0x5'));var path=require(_0xccaf('0x6'));var sox=require(_0xccaf('0x7'));var csv=require(_0xccaf('0x8'));var ejs=require(_0xccaf('0x9'));var fs=require('fs');var fs_extra=require(_0xccaf('0xa'));var _=require(_0xccaf('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xccaf('0xc'));var toCsv=require('to-csv');var querystring=require(_0xccaf('0xd'));var Papa=require('papaparse');var Redis=require(_0xccaf('0xe'));var authService=require(_0xccaf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xccaf('0x10'));var hardwareService=require(_0xccaf('0x11'));var logger=require(_0xccaf('0x12'))(_0xccaf('0x13'));var utils=require('../../config/utils');var config=require(_0xccaf('0x14'));var licenseUtil=require(_0xccaf('0x15'));var db=require(_0xccaf('0x16'))['db'];function respondWithStatusCode(_0x515bfb,_0x2be873){_0x2be873=_0x2be873||0xcc;return function(_0x2d91af){if(_0x2d91af){return _0x515bfb[_0xccaf('0x17')](_0x2be873);}return _0x515bfb['status'](_0x2be873)[_0xccaf('0x18')]();};}function respondWithResult(_0xd9bcf7,_0x37fbaa){_0x37fbaa=_0x37fbaa||0xc8;return function(_0x2ae129){if(_0x2ae129){return _0xd9bcf7[_0xccaf('0x19')](_0x37fbaa)[_0xccaf('0x1a')](_0x2ae129);}};}function respondWithFilteredResult(_0x3707e3,_0x2c22e7){return function(_0x2e4f69){if(_0x2e4f69){var _0xe1fb82=typeof _0x2c22e7['offset']==='undefined'&&typeof _0x2c22e7['limit']===_0xccaf('0x1b');var _0x290abf=_0x2e4f69['count'];var _0x4d6687=_0xe1fb82?0x0:_0x2c22e7[_0xccaf('0x1c')];var _0x1872a5=_0xe1fb82?_0x2e4f69[_0xccaf('0x1d')]:_0x2c22e7[_0xccaf('0x1c')]+_0x2c22e7['limit'];var _0x269d1b;if(_0x1872a5>=_0x290abf){_0x1872a5=_0x290abf;_0x269d1b=0xc8;}else{_0x269d1b=0xce;}_0x3707e3[_0xccaf('0x19')](_0x269d1b);return _0x3707e3[_0xccaf('0x1e')]('Content-Range',_0x4d6687+'-'+_0x1872a5+'/'+_0x290abf)['json'](_0x2e4f69);}return null;};}function patchUpdates(_0x2d6f02){return function(_0x3fa0da){try{jsonpatch['apply'](_0x3fa0da,_0x2d6f02,!![]);}catch(_0x311db3){return BPromise[_0xccaf('0x1f')](_0x311db3);}return _0x3fa0da[_0xccaf('0x20')]();};}function saveUpdates(_0xc87315,_0x2c0322){return function(_0x31ceaa){if(_0x31ceaa){return _0x31ceaa[_0xccaf('0x21')](_0xc87315)['then'](function(_0x42b4f1){return _0x42b4f1;});}return null;};}function removeEntity(_0x5a1531,_0x12122b){return function(_0x91c7c1){if(_0x91c7c1){return _0x91c7c1[_0xccaf('0x22')]()[_0xccaf('0x23')](function(){_0x5a1531[_0xccaf('0x19')](0xcc)[_0xccaf('0x18')]();});}};}function handleEntityNotFound(_0x5e8137,_0x3703bb){return function(_0x1e3853){if(!_0x1e3853){_0x5e8137[_0xccaf('0x17')](0x194);}return _0x1e3853;};}function handleError(_0x8a3a4e,_0x1b0cff){_0x1b0cff=_0x1b0cff||0x1f4;return function(_0x1e869b){logger[_0xccaf('0x24')](_0x1e869b[_0xccaf('0x25')]);if(_0x1e869b[_0xccaf('0x26')]){delete _0x1e869b[_0xccaf('0x26')];}_0x8a3a4e[_0xccaf('0x19')](_0x1b0cff)[_0xccaf('0x27')](_0x1e869b);};}exports[_0xccaf('0x28')]=function(_0x54c754,_0x442d05){var _0x3a08ee={},_0x586f94={},_0x38f3a={'count':0x0,'rows':[]};var _0x332427=_[_0xccaf('0x29')](db[_0xccaf('0x2a')][_0xccaf('0x2b')],function(_0x362ccc){return{'name':_0x362ccc[_0xccaf('0x2c')],'type':_0x362ccc[_0xccaf('0x2d')][_0xccaf('0x2e')]};});_0x586f94['model']=_['map'](_0x332427,_0xccaf('0x26'));_0x586f94[_0xccaf('0x2f')]=_['keys'](_0x54c754[_0xccaf('0x2f')]);_0x586f94[_0xccaf('0x30')]=_[_0xccaf('0x31')](_0x586f94[_0xccaf('0x32')],_0x586f94[_0xccaf('0x2f')]);_0x3a08ee[_0xccaf('0x33')]=_['intersection'](_0x586f94[_0xccaf('0x32')],qs[_0xccaf('0x34')](_0x54c754[_0xccaf('0x2f')][_0xccaf('0x34')]));_0x3a08ee[_0xccaf('0x33')]=_0x3a08ee[_0xccaf('0x33')][_0xccaf('0x35')]?_0x3a08ee[_0xccaf('0x33')]:_0x586f94[_0xccaf('0x32')];if(!_0x54c754[_0xccaf('0x2f')]['hasOwnProperty'](_0xccaf('0x36'))){_0x3a08ee[_0xccaf('0x37')]=qs['limit'](_0x54c754[_0xccaf('0x2f')][_0xccaf('0x37')]);_0x3a08ee[_0xccaf('0x1c')]=qs[_0xccaf('0x1c')](_0x54c754['query'][_0xccaf('0x1c')]);}_0x3a08ee[_0xccaf('0x38')]=qs[_0xccaf('0x39')](_0x54c754[_0xccaf('0x2f')]['sort']);_0x3a08ee['where']=qs[_0xccaf('0x30')](_[_0xccaf('0x3a')](_0x54c754['query'],_0x586f94[_0xccaf('0x30')]),_0x332427);if(_0x54c754['query'][_0xccaf('0x3b')]){_0x3a08ee[_0xccaf('0x3c')]=_['merge'](_0x3a08ee[_0xccaf('0x3c')],{'$or':_[_0xccaf('0x29')](_0x332427,function(_0x2bd538){if(_0x2bd538[_0xccaf('0x2d')]!==_0xccaf('0x3d')){var _0x5daf09={};_0x5daf09[_0x2bd538[_0xccaf('0x26')]]={'$like':'%'+_0x54c754[_0xccaf('0x2f')][_0xccaf('0x3b')]+'%'};return _0x5daf09;}})});}_0x3a08ee=_[_0xccaf('0x3e')]({},_0x3a08ee,_0x54c754[_0xccaf('0x3f')]);var _0xe914fd={'where':_0x3a08ee[_0xccaf('0x3c')]};return db[_0xccaf('0x2a')][_0xccaf('0x1d')](_0xe914fd)[_0xccaf('0x23')](function(_0x12cf43){_0x38f3a[_0xccaf('0x1d')]=_0x12cf43;if(_0x54c754['query'][_0xccaf('0x40')]){_0x3a08ee[_0xccaf('0x41')]=[{'all':!![]}];}return db[_0xccaf('0x2a')][_0xccaf('0x42')](_0x3a08ee);})[_0xccaf('0x23')](function(_0x1be62f){_0x38f3a[_0xccaf('0x43')]=_0x1be62f;return _0x38f3a;})[_0xccaf('0x23')](respondWithFilteredResult(_0x442d05,_0x3a08ee))['catch'](handleError(_0x442d05,null));};exports['show']=function(_0x54a92c,_0x1e7ac7){var _0x3d5816={'raw':!![],'where':{'id':_0x54a92c[_0xccaf('0x44')]['id']}},_0x564628={};_0x564628[_0xccaf('0x32')]=_[_0xccaf('0x45')](db[_0xccaf('0x2a')][_0xccaf('0x2b')]);_0x564628[_0xccaf('0x2f')]=_['keys'](_0x54a92c[_0xccaf('0x2f')]);_0x564628[_0xccaf('0x30')]=_[_0xccaf('0x31')](_0x564628[_0xccaf('0x32')],_0x564628[_0xccaf('0x2f')]);_0x3d5816[_0xccaf('0x33')]=_[_0xccaf('0x31')](_0x564628[_0xccaf('0x32')],qs[_0xccaf('0x34')](_0x54a92c[_0xccaf('0x2f')]['fields']));_0x3d5816[_0xccaf('0x33')]=_0x3d5816['attributes'][_0xccaf('0x35')]?_0x3d5816[_0xccaf('0x33')]:_0x564628[_0xccaf('0x32')];if(_0x54a92c[_0xccaf('0x2f')]['includeAll']){_0x3d5816['include']=[{'all':!![]}];}_0x3d5816=_[_0xccaf('0x3e')]({},_0x3d5816,_0x54a92c[_0xccaf('0x3f')]);return db[_0xccaf('0x2a')][_0xccaf('0x46')](_0x3d5816)[_0xccaf('0x23')](handleEntityNotFound(_0x1e7ac7,null))[_0xccaf('0x23')](respondWithResult(_0x1e7ac7,null))[_0xccaf('0x47')](handleError(_0x1e7ac7,null));};exports['create']=function(_0x48e8d2,_0x1482d3){return db[_0xccaf('0x2a')][_0xccaf('0x48')](_0x48e8d2[_0xccaf('0x49')],{})[_0xccaf('0x23')](respondWithResult(_0x1482d3,0xc9))['catch'](handleError(_0x1482d3,null));};exports[_0xccaf('0x21')]=function(_0x40b55d,_0x26d932){if(_0x40b55d[_0xccaf('0x49')]['id']){delete _0x40b55d[_0xccaf('0x49')]['id'];}return db[_0xccaf('0x2a')][_0xccaf('0x46')]({'where':{'id':_0x40b55d[_0xccaf('0x44')]['id']}})[_0xccaf('0x23')](handleEntityNotFound(_0x26d932,null))[_0xccaf('0x23')](saveUpdates(_0x40b55d['body'],null))[_0xccaf('0x23')](respondWithResult(_0x26d932,null))[_0xccaf('0x47')](handleError(_0x26d932,null));};exports[_0xccaf('0x22')]=function(_0x213fa4,_0x5929ee){return db[_0xccaf('0x2a')][_0xccaf('0x46')]({'where':{'id':_0x213fa4['params']['id']}})['then'](handleEntityNotFound(_0x5929ee,null))[_0xccaf('0x23')](removeEntity(_0x5929ee,null))[_0xccaf('0x47')](handleError(_0x5929ee,null));};exports['describe']=function(_0x566e34,_0x2324d2){return db['SquareReport'][_0xccaf('0x4a')]()[_0xccaf('0x23')](respondWithResult(_0x2324d2,null))['catch'](handleError(_0x2324d2,null));}; \ No newline at end of file +var _0x6073=['then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy'];(function(_0x36483c,_0x120c1c){var _0x5e189b=function(_0x55f7e5){while(--_0x55f7e5){_0x36483c['push'](_0x36483c['shift']());}};_0x5e189b(++_0x120c1c);}(_0x6073,0x143));var _0x3607=function(_0x537b1b,_0x12ad6f){_0x537b1b=_0x537b1b-0x0;var _0x2b2a0c=_0x6073[_0x537b1b];return _0x2b2a0c;};'use strict';var emlformat=require(_0x3607('0x0'));var rimraf=require(_0x3607('0x1'));var zipdir=require(_0x3607('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3607('0x3'));var util=require('util');var path=require('path');var sox=require(_0x3607('0x4'));var csv=require(_0x3607('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3607('0x6'));var _=require('lodash');var squel=require(_0x3607('0x7'));var crypto=require(_0x3607('0x8'));var jsforce=require(_0x3607('0x9'));var deskjs=require(_0x3607('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3607('0xb'));var Papa=require('papaparse');var Redis=require(_0x3607('0xc'));var authService=require(_0x3607('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3607('0xe'));var logger=require(_0x3607('0xf'))(_0x3607('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3607('0x11'))['db'];function respondWithStatusCode(_0x3c7fc7,_0x461e3e){_0x461e3e=_0x461e3e||0xcc;return function(_0x32143c){if(_0x32143c){return _0x3c7fc7[_0x3607('0x12')](_0x461e3e);}return _0x3c7fc7['status'](_0x461e3e)[_0x3607('0x13')]();};}function respondWithResult(_0x1df7bf,_0x5b826e){_0x5b826e=_0x5b826e||0xc8;return function(_0xd6f73e){if(_0xd6f73e){return _0x1df7bf['status'](_0x5b826e)[_0x3607('0x14')](_0xd6f73e);}};}function respondWithFilteredResult(_0x1ec5f2,_0x103e8b){return function(_0x48c085){if(_0x48c085){var _0x1eb078=typeof _0x103e8b[_0x3607('0x15')]===_0x3607('0x16')&&typeof _0x103e8b[_0x3607('0x17')]==='undefined';var _0x21e241=_0x48c085[_0x3607('0x18')];var _0x576d0c=_0x1eb078?0x0:_0x103e8b['offset'];var _0x380acd=_0x1eb078?_0x48c085['count']:_0x103e8b[_0x3607('0x15')]+_0x103e8b[_0x3607('0x17')];var _0x3f3a6b;if(_0x380acd>=_0x21e241){_0x380acd=_0x21e241;_0x3f3a6b=0xc8;}else{_0x3f3a6b=0xce;}_0x1ec5f2[_0x3607('0x19')](_0x3f3a6b);return _0x1ec5f2[_0x3607('0x1a')](_0x3607('0x1b'),_0x576d0c+'-'+_0x380acd+'/'+_0x21e241)[_0x3607('0x14')](_0x48c085);}return null;};}function patchUpdates(_0x319832){return function(_0x298078){try{jsonpatch[_0x3607('0x1c')](_0x298078,_0x319832,!![]);}catch(_0xc3edcc){return BPromise[_0x3607('0x1d')](_0xc3edcc);}return _0x298078[_0x3607('0x1e')]();};}function saveUpdates(_0x4e7531,_0x15b837){return function(_0x3b680a){if(_0x3b680a){return _0x3b680a['update'](_0x4e7531)['then'](function(_0x2ae5c3){return _0x2ae5c3;});}return null;};}function removeEntity(_0xf29599,_0x22885c){return function(_0x55312f){if(_0x55312f){return _0x55312f[_0x3607('0x1f')]()[_0x3607('0x20')](function(){_0xf29599[_0x3607('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e22d6,_0x504e1a){return function(_0x55cfef){if(!_0x55cfef){_0x2e22d6[_0x3607('0x12')](0x194);}return _0x55cfef;};}function handleError(_0x39d3e8,_0x5bf02d){_0x5bf02d=_0x5bf02d||0x1f4;return function(_0xe50bd1){logger[_0x3607('0x21')](_0xe50bd1[_0x3607('0x22')]);if(_0xe50bd1[_0x3607('0x23')]){delete _0xe50bd1['name'];}_0x39d3e8['status'](_0x5bf02d)[_0x3607('0x24')](_0xe50bd1);};}exports[_0x3607('0x25')]=function(_0x4ebe39,_0xfdf061){var _0x1dd473={},_0x19f7b6={},_0x152f1d={'count':0x0,'rows':[]};var _0x3a67ee=_[_0x3607('0x26')](db[_0x3607('0x27')][_0x3607('0x28')],function(_0x57aa7e){return{'name':_0x57aa7e[_0x3607('0x29')],'type':_0x57aa7e[_0x3607('0x2a')][_0x3607('0x2b')]};});_0x19f7b6[_0x3607('0x2c')]=_[_0x3607('0x26')](_0x3a67ee,_0x3607('0x23'));_0x19f7b6[_0x3607('0x2d')]=_[_0x3607('0x2e')](_0x4ebe39[_0x3607('0x2d')]);_0x19f7b6[_0x3607('0x2f')]=_['intersection'](_0x19f7b6[_0x3607('0x2c')],_0x19f7b6[_0x3607('0x2d')]);_0x1dd473['attributes']=_[_0x3607('0x30')](_0x19f7b6[_0x3607('0x2c')],qs[_0x3607('0x31')](_0x4ebe39[_0x3607('0x2d')][_0x3607('0x31')]));_0x1dd473['attributes']=_0x1dd473[_0x3607('0x32')]['length']?_0x1dd473[_0x3607('0x32')]:_0x19f7b6[_0x3607('0x2c')];if(!_0x4ebe39[_0x3607('0x2d')][_0x3607('0x33')](_0x3607('0x34'))){_0x1dd473['limit']=qs[_0x3607('0x17')](_0x4ebe39[_0x3607('0x2d')]['limit']);_0x1dd473['offset']=qs[_0x3607('0x15')](_0x4ebe39[_0x3607('0x2d')][_0x3607('0x15')]);}_0x1dd473[_0x3607('0x35')]=qs[_0x3607('0x36')](_0x4ebe39[_0x3607('0x2d')]['sort']);_0x1dd473[_0x3607('0x37')]=qs[_0x3607('0x2f')](_[_0x3607('0x38')](_0x4ebe39[_0x3607('0x2d')],_0x19f7b6['filters']),_0x3a67ee);if(_0x4ebe39[_0x3607('0x2d')][_0x3607('0x39')]){_0x1dd473[_0x3607('0x37')]=_[_0x3607('0x3a')](_0x1dd473[_0x3607('0x37')],{'$or':_[_0x3607('0x26')](_0x3a67ee,function(_0x46ebbb){if(_0x46ebbb[_0x3607('0x2a')]!==_0x3607('0x3b')){var _0x291659={};_0x291659[_0x46ebbb[_0x3607('0x23')]]={'$like':'%'+_0x4ebe39['query'][_0x3607('0x39')]+'%'};return _0x291659;}})});}_0x1dd473=_[_0x3607('0x3a')]({},_0x1dd473,_0x4ebe39[_0x3607('0x3c')]);var _0x98bb7b={'where':_0x1dd473[_0x3607('0x37')]};return db[_0x3607('0x27')]['count'](_0x98bb7b)[_0x3607('0x20')](function(_0x1df8e8){_0x152f1d[_0x3607('0x18')]=_0x1df8e8;if(_0x4ebe39[_0x3607('0x2d')]['includeAll']){_0x1dd473[_0x3607('0x3d')]=[{'all':!![]}];}return db[_0x3607('0x27')]['findAll'](_0x1dd473);})[_0x3607('0x20')](function(_0x48b50f){_0x152f1d[_0x3607('0x3e')]=_0x48b50f;return _0x152f1d;})[_0x3607('0x20')](respondWithFilteredResult(_0xfdf061,_0x1dd473))[_0x3607('0x3f')](handleError(_0xfdf061,null));};exports[_0x3607('0x40')]=function(_0x41f70a,_0x369b51){var _0x430b5c={'raw':!![],'where':{'id':_0x41f70a[_0x3607('0x41')]['id']}},_0x34d81b={};_0x34d81b[_0x3607('0x2c')]=_[_0x3607('0x2e')](db[_0x3607('0x27')][_0x3607('0x28')]);_0x34d81b['query']=_[_0x3607('0x2e')](_0x41f70a[_0x3607('0x2d')]);_0x34d81b['filters']=_[_0x3607('0x30')](_0x34d81b[_0x3607('0x2c')],_0x34d81b[_0x3607('0x2d')]);_0x430b5c[_0x3607('0x32')]=_[_0x3607('0x30')](_0x34d81b['model'],qs[_0x3607('0x31')](_0x41f70a[_0x3607('0x2d')][_0x3607('0x31')]));_0x430b5c[_0x3607('0x32')]=_0x430b5c[_0x3607('0x32')]['length']?_0x430b5c[_0x3607('0x32')]:_0x34d81b[_0x3607('0x2c')];if(_0x41f70a[_0x3607('0x2d')]['includeAll']){_0x430b5c[_0x3607('0x3d')]=[{'all':!![]}];}_0x430b5c=_[_0x3607('0x3a')]({},_0x430b5c,_0x41f70a['options']);return db[_0x3607('0x27')][_0x3607('0x42')](_0x430b5c)['then'](handleEntityNotFound(_0x369b51,null))[_0x3607('0x20')](respondWithResult(_0x369b51,null))['catch'](handleError(_0x369b51,null));};exports[_0x3607('0x43')]=function(_0x120543,_0x66122d){return db['SquareReport'][_0x3607('0x43')](_0x120543[_0x3607('0x44')],{})['then'](respondWithResult(_0x66122d,0xc9))[_0x3607('0x3f')](handleError(_0x66122d,null));};exports[_0x3607('0x45')]=function(_0x552056,_0x877d8f){if(_0x552056[_0x3607('0x44')]['id']){delete _0x552056[_0x3607('0x44')]['id'];}return db[_0x3607('0x27')][_0x3607('0x42')]({'where':{'id':_0x552056[_0x3607('0x41')]['id']}})[_0x3607('0x20')](handleEntityNotFound(_0x877d8f,null))[_0x3607('0x20')](saveUpdates(_0x552056[_0x3607('0x44')],null))[_0x3607('0x20')](respondWithResult(_0x877d8f,null))[_0x3607('0x3f')](handleError(_0x877d8f,null));};exports[_0x3607('0x1f')]=function(_0x47f80b,_0x4fe296){return db['SquareReport'][_0x3607('0x42')]({'where':{'id':_0x47f80b['params']['id']}})[_0x3607('0x20')](handleEntityNotFound(_0x4fe296,null))[_0x3607('0x20')](removeEntity(_0x4fe296,null))['catch'](handleError(_0x4fe296,null));};exports[_0x3607('0x46')]=function(_0x3abdd3,_0x2985e2){return db[_0x3607('0x27')]['describe']()[_0x3607('0x20')](respondWithResult(_0x2985e2,null))[_0x3607('0x3f')](handleError(_0x2985e2,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4611859..285807d 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 _0x8e8e=['uniqueid','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x304842,_0x139bda){var _0x52b6c3=function(_0x39b1f9){while(--_0x39b1f9){_0x304842['push'](_0x304842['shift']());}};_0x52b6c3(++_0x139bda);}(_0x8e8e,0x1d7));var _0xe8e8=function(_0xfe4397,_0x25bd77){_0xfe4397=_0xfe4397-0x0;var _0xb86ec4=_0x8e8e[_0xfe4397];return _0xb86ec4;};'use strict';var _=require('lodash');var util=require(_0xe8e8('0x0'));var logger=require(_0xe8e8('0x1'))(_0xe8e8('0x2'));var moment=require(_0xe8e8('0x3'));var BPromise=require(_0xe8e8('0x4'));var rp=require(_0xe8e8('0x5'));var fs=require('fs');var path=require(_0xe8e8('0x6'));var rimraf=require(_0xe8e8('0x7'));var config=require(_0xe8e8('0x8'));var attributes=require(_0xe8e8('0x9'));module[_0xe8e8('0xa')]=function(_0x4c2d76,_0x6e5663){return _0x4c2d76[_0xe8e8('0xb')](_0xe8e8('0xc'),attributes,{'tableName':_0xe8e8('0xd'),'paranoid':![],'indexes':[{'name':_0xe8e8('0xe'),'fields':[_0xe8e8('0xf'),_0xe8e8('0x10')]},{'name':'leaveAt','fields':[_0xe8e8('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6f5=['SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xc48886,_0x591f3f){var _0x5d6fca=function(_0x5196b4){while(--_0x5196b4){_0xc48886['push'](_0xc48886['shift']());}};_0x5d6fca(++_0x591f3f);}(_0xd6f5,0xef));var _0x5d6f=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0xd6f5[_0x203d64];return _0x462ab3;};'use strict';var _=require(_0x5d6f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5d6f('0x1'));var moment=require('moment');var BPromise=require(_0x5d6f('0x2'));var rp=require(_0x5d6f('0x3'));var fs=require('fs');var path=require(_0x5d6f('0x4'));var rimraf=require(_0x5d6f('0x5'));var config=require(_0x5d6f('0x6'));var attributes=require('./squareReport.attributes');module[_0x5d6f('0x7')]=function(_0x4d8b84,_0xa63b70){return _0x4d8b84['define'](_0x5d6f('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x5d6f('0x9'),'fields':[_0x5d6f('0xa'),_0x5d6f('0xb')]},{'name':_0x5d6f('0xc'),'fields':[_0x5d6f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 950d412..6f3dee1 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 _0x41c2=['update','raw','where','limit','UpdateSquareReport','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','create','body','options','then','CreateSquareReport','SquareReport'];(function(_0x5792eb,_0x4acd6e){var _0x4b9aaa=function(_0x155a32){while(--_0x155a32){_0x5792eb['push'](_0x5792eb['shift']());}};_0x4b9aaa(++_0x4acd6e);}(_0x41c2,0xa0));var _0x241c=function(_0xc66608,_0x313c84){_0xc66608=_0xc66608-0x0;var _0x52b140=_0x41c2[_0xc66608];return _0x52b140;};'use strict';var _=require(_0x241c('0x0'));var util=require('util');var moment=require(_0x241c('0x1'));var BPromise=require(_0x241c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x241c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x241c('0x4'));var logger=require(_0x241c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x241c('0x6'));var client=jayson[_0x241c('0x7')][_0x241c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4002eb,_0x2541f9,_0x25c1f4){return new BPromise(function(_0x3ee355,_0x2110d6){return client[_0x241c('0x9')](_0x4002eb,_0x25c1f4)['then'](function(_0x3535f7){logger[_0x241c('0xa')](_0x241c('0xb'),_0x2541f9,_0x241c('0xc'));logger[_0x241c('0xd')](_0x241c('0xe'),_0x2541f9,_0x241c('0xc'),JSON[_0x241c('0xf')](_0x3535f7));if(_0x3535f7['error']){if(_0x3535f7['error'][_0x241c('0x10')]===0x1f4){logger['error'](_0x241c('0xb'),_0x2541f9,_0x3535f7[_0x241c('0x11')][_0x241c('0x12')]);return _0x2110d6(_0x3535f7['error'][_0x241c('0x12')]);}logger[_0x241c('0x11')](_0x241c('0xb'),_0x2541f9,_0x3535f7[_0x241c('0x11')][_0x241c('0x12')]);return _0x3ee355(_0x3535f7['error'][_0x241c('0x12')]);}else{logger[_0x241c('0xa')](_0x241c('0xb'),_0x2541f9,_0x241c('0xc'));_0x3ee355(_0x3535f7['result'][_0x241c('0x12')]);}})[_0x241c('0x13')](function(_0x9a7faa){logger[_0x241c('0x11')](_0x241c('0xb'),_0x2541f9,_0x9a7faa);_0x2110d6(_0x9a7faa);});});}exports['CreateSquareReport']=function(_0x2cd074){var _0x2d5167=this;return new Promise(function(_0x3370b5,_0x5791f6){return db['SquareReport'][_0x241c('0x14')](_0x2cd074[_0x241c('0x15')],{'raw':_0x2cd074[_0x241c('0x16')]?_0x2cd074[_0x241c('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x241c('0x17')](function(_0xb62bd0){logger['info'](_0x241c('0x18'),_0x2cd074);logger[_0x241c('0xd')]('CreateSquareReport',_0x2cd074,JSON[_0x241c('0xf')](_0xb62bd0));_0x3370b5(_0xb62bd0);})[_0x241c('0x13')](function(_0x969e2c){logger[_0x241c('0x11')](_0x241c('0x18'),_0x969e2c[_0x241c('0x12')],_0x2cd074);_0x5791f6(_0x2d5167[_0x241c('0x11')](0x1f4,_0x969e2c[_0x241c('0x12')]));});});};exports['UpdateSquareReport']=function(_0xb99224){var _0x9f6675=this;return new Promise(function(_0x26bba5,_0xf2c214){return db[_0x241c('0x19')][_0x241c('0x1a')](_0xb99224[_0x241c('0x15')],{'raw':_0xb99224[_0x241c('0x16')]?_0xb99224['options'][_0x241c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb99224['options']?_0xb99224[_0x241c('0x16')][_0x241c('0x1c')]||null:null,'attributes':_0xb99224[_0x241c('0x16')]?_0xb99224[_0x241c('0x16')]['attributes']||null:null,'limit':_0xb99224[_0x241c('0x16')]?_0xb99224[_0x241c('0x16')][_0x241c('0x1d')]||null:null})['then'](function(_0x377819){logger[_0x241c('0xa')](_0x241c('0x1e'),_0xb99224);logger[_0x241c('0xd')](_0x241c('0x1e'),_0xb99224,JSON[_0x241c('0xf')](_0x377819));_0x26bba5(_0x377819);})[_0x241c('0x13')](function(_0x228a66){logger['error'](_0x241c('0x1e'),_0x228a66[_0x241c('0x12')],_0xb99224);_0xf2c214(_0x9f6675[_0x241c('0x11')](0x1f4,_0x228a66[_0x241c('0x12')]));});});}; \ No newline at end of file +var _0x1ace=['raw','update','where','limit','debug','UpdateSquareReport','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options'];(function(_0x410779,_0x44b4a1){var _0x4afa97=function(_0x574487){while(--_0x574487){_0x410779['push'](_0x410779['shift']());}};_0x4afa97(++_0x44b4a1);}(_0x1ace,0x86));var _0xe1ac=function(_0x114294,_0x14e0a3){_0x114294=_0x114294-0x0;var _0x907d61=_0x1ace[_0x114294];return _0x907d61;};'use strict';var _=require(_0xe1ac('0x0'));var util=require('util');var moment=require(_0xe1ac('0x1'));var BPromise=require(_0xe1ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1ac('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1ac('0x4'));var logger=require(_0xe1ac('0x5'))('rpc');var config=require(_0xe1ac('0x6'));var jayson=require(_0xe1ac('0x7'));var client=jayson[_0xe1ac('0x8')][_0xe1ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34abd9,_0x192d8d,_0x18e136){return new BPromise(function(_0x3b3d4d,_0x46741f){return client[_0xe1ac('0xa')](_0x34abd9,_0x18e136)[_0xe1ac('0xb')](function(_0x345e6b){logger[_0xe1ac('0xc')](_0xe1ac('0xd'),_0x192d8d,'request\x20sent');logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x192d8d,_0xe1ac('0xe'),JSON[_0xe1ac('0xf')](_0x345e6b));if(_0x345e6b[_0xe1ac('0x10')]){if(_0x345e6b['error'][_0xe1ac('0x11')]===0x1f4){logger[_0xe1ac('0x10')](_0xe1ac('0xd'),_0x192d8d,_0x345e6b[_0xe1ac('0x10')][_0xe1ac('0x12')]);return _0x46741f(_0x345e6b[_0xe1ac('0x10')][_0xe1ac('0x12')]);}logger['error'](_0xe1ac('0xd'),_0x192d8d,_0x345e6b['error']['message']);return _0x3b3d4d(_0x345e6b[_0xe1ac('0x10')][_0xe1ac('0x12')]);}else{logger[_0xe1ac('0xc')](_0xe1ac('0xd'),_0x192d8d,_0xe1ac('0xe'));_0x3b3d4d(_0x345e6b[_0xe1ac('0x13')][_0xe1ac('0x12')]);}})[_0xe1ac('0x14')](function(_0x126b68){logger[_0xe1ac('0x10')](_0xe1ac('0xd'),_0x192d8d,_0x126b68);_0x46741f(_0x126b68);});});}exports[_0xe1ac('0x15')]=function(_0xdaf79f){var _0x5aa842=this;return new Promise(function(_0x42d6ef,_0x196f76){return db[_0xe1ac('0x16')][_0xe1ac('0x17')](_0xdaf79f[_0xe1ac('0x18')],{'raw':_0xdaf79f[_0xe1ac('0x19')]?_0xdaf79f[_0xe1ac('0x19')][_0xe1ac('0x1a')]===undefined?!![]:![]:!![]})[_0xe1ac('0xb')](function(_0xafddce){logger[_0xe1ac('0xc')]('CreateSquareReport',_0xdaf79f);logger['debug'](_0xe1ac('0x15'),_0xdaf79f,JSON['stringify'](_0xafddce));_0x42d6ef(_0xafddce);})[_0xe1ac('0x14')](function(_0x51bc3a){logger[_0xe1ac('0x10')](_0xe1ac('0x15'),_0x51bc3a[_0xe1ac('0x12')],_0xdaf79f);_0x196f76(_0x5aa842[_0xe1ac('0x10')](0x1f4,_0x51bc3a['message']));});});};exports['UpdateSquareReport']=function(_0x1e0775){var _0x5f25e4=this;return new Promise(function(_0x86a85a,_0x10548d){return db[_0xe1ac('0x16')][_0xe1ac('0x1b')](_0x1e0775[_0xe1ac('0x18')],{'raw':_0x1e0775[_0xe1ac('0x19')]?_0x1e0775[_0xe1ac('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0775[_0xe1ac('0x19')]?_0x1e0775[_0xe1ac('0x19')][_0xe1ac('0x1c')]||null:null,'attributes':_0x1e0775['options']?_0x1e0775['options']['attributes']||null:null,'limit':_0x1e0775[_0xe1ac('0x19')]?_0x1e0775['options'][_0xe1ac('0x1d')]||null:null})[_0xe1ac('0xb')](function(_0x33fb1b){logger['info']('UpdateSquareReport',_0x1e0775);logger[_0xe1ac('0x1e')](_0xe1ac('0x1f'),_0x1e0775,JSON[_0xe1ac('0xf')](_0x33fb1b));_0x86a85a(_0x33fb1b);})[_0xe1ac('0x14')](function(_0x59a825){logger[_0xe1ac('0x10')](_0xe1ac('0x1f'),_0x59a825['message'],_0x1e0775);_0x10548d(_0x5f25e4[_0xe1ac('0x10')](0x1f4,_0x59a825[_0xe1ac('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 2387dd6..64ed44a 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 _0x15e0=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util'];(function(_0x195a3a,_0x2a00e8){var _0x5783eb=function(_0x6584d3){while(--_0x6584d3){_0x195a3a['push'](_0x195a3a['shift']());}};_0x5783eb(++_0x2a00e8);}(_0x15e0,0x178));var _0x015e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x15e0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x015e('0x0'));var util=require(_0x015e('0x1'));var path=require(_0x015e('0x2'));var timeout=require(_0x015e('0x3'));var express=require(_0x015e('0x4'));var router=express['Router']();var fs_extra=require(_0x015e('0x5'));var auth=require(_0x015e('0x6'));var interaction=require(_0x015e('0x7'));var config=require('../../config/environment');var controller=require(_0x015e('0x8'));router[_0x015e('0x9')]('/',auth[_0x015e('0xa')](),controller[_0x015e('0xb')]);router[_0x015e('0x9')](_0x015e('0xc'),auth['isAuthenticated'](),controller[_0x015e('0xd')]);router[_0x015e('0x9')](_0x015e('0xe'),auth[_0x015e('0xa')](),controller[_0x015e('0xf')]);router[_0x015e('0x10')]('/',auth[_0x015e('0xa')](),controller['create']);router['put'](_0x015e('0xe'),auth[_0x015e('0xa')](),controller[_0x015e('0x11')]);router[_0x015e('0x12')](_0x015e('0xe'),auth['isAuthenticated'](),controller[_0x015e('0x13')]);module[_0x015e('0x14')]=router; \ No newline at end of file +var _0x681b=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','post'];(function(_0x34947e,_0x45c404){var _0x87404f=function(_0x5e5027){while(--_0x5e5027){_0x34947e['push'](_0x34947e['shift']());}};_0x87404f(++_0x45c404);}(_0x681b,0xce));var _0xb681=function(_0x4882ee,_0x3ddd1d){_0x4882ee=_0x4882ee-0x0;var _0x19af18=_0x681b[_0x4882ee];return _0x19af18;};'use strict';var multer=require(_0xb681('0x0'));var util=require('util');var path=require(_0xb681('0x1'));var timeout=require(_0xb681('0x2'));var express=require(_0xb681('0x3'));var router=express[_0xb681('0x4')]();var fs_extra=require(_0xb681('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb681('0x6'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0xb681('0x7')](),controller['index']);router['get'](_0xb681('0x8'),auth[_0xb681('0x7')](),controller[_0xb681('0x9')]);router[_0xb681('0xa')](_0xb681('0xb'),auth[_0xb681('0x7')](),controller[_0xb681('0xc')]);router[_0xb681('0xd')]('/',auth[_0xb681('0x7')](),controller[_0xb681('0xe')]);router[_0xb681('0xf')](_0xb681('0xb'),auth[_0xb681('0x7')](),controller[_0xb681('0x10')]);router[_0xb681('0x11')](_0xb681('0xb'),auth['isAuthenticated'](),controller[_0xb681('0x12')]);module[_0xb681('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 690ae86..425d67f 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 _0xa814=['exports','STRING','sequelize'];(function(_0x46f631,_0x566575){var _0xd18702=function(_0x59a87d){while(--_0x59a87d){_0x46f631['push'](_0x46f631['shift']());}};_0xd18702(++_0x566575);}(_0xa814,0xb9));var _0x4a81=function(_0x16cde2,_0x2d8902){_0x16cde2=_0x16cde2-0x0;var _0x2de401=_0xa814[_0x16cde2];return _0x2de401;};'use strict';var Sequelize=require(_0x4a81('0x0'));module[_0x4a81('0x1')]={'uniqueid':{'type':Sequelize[_0x4a81('0x2')]},'node':{'type':Sequelize[_0x4a81('0x2')]},'application':{'type':Sequelize[_0x4a81('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x4a81('0x2')]},'callerid':{'type':Sequelize[_0x4a81('0x2')]}}; \ No newline at end of file +var _0x3946=['exports','STRING'];(function(_0x3f4875,_0x1eee06){var _0x1727cf=function(_0x92fc15){while(--_0x92fc15){_0x3f4875['push'](_0x3f4875['shift']());}};_0x1727cf(++_0x1eee06);}(_0x3946,0x112));var _0x6394=function(_0x28edf8,_0x3ab79f){_0x28edf8=_0x28edf8-0x0;var _0xb0bbba=_0x3946[_0x28edf8];return _0xb0bbba;};'use strict';var Sequelize=require('sequelize');module[_0x6394('0x0')]={'uniqueid':{'type':Sequelize[_0x6394('0x1')]},'node':{'type':Sequelize[_0x6394('0x1')]},'application':{'type':Sequelize[_0x6394('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6394('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e2f2ac5..80cd8ff 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 _0xccb6=['sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','includeAll','SquareDetailsReport','findAll','rows','catch','show','params','include','find','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy'];(function(_0x1c23f0,_0x5d78c9){var _0x5810ed=function(_0x4c87fc){while(--_0x4c87fc){_0x1c23f0['push'](_0x1c23f0['shift']());}};_0x5810ed(++_0x5d78c9);}(_0xccb6,0xfb));var _0x6ccb=function(_0x25948f,_0x4ac7e4){_0x25948f=_0x25948f-0x0;var _0x2b1976=_0xccb6[_0x25948f];return _0x2b1976;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ccb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ccb('0x1'));var rp=require(_0x6ccb('0x2'));var moment=require(_0x6ccb('0x3'));var BPromise=require(_0x6ccb('0x4'));var Mustache=require(_0x6ccb('0x5'));var util=require('util');var path=require(_0x6ccb('0x6'));var sox=require(_0x6ccb('0x7'));var csv=require(_0x6ccb('0x8'));var ejs=require(_0x6ccb('0x9'));var fs=require('fs');var fs_extra=require(_0x6ccb('0xa'));var _=require(_0x6ccb('0xb'));var squel=require(_0x6ccb('0xc'));var crypto=require(_0x6ccb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ccb('0x8'));var querystring=require(_0x6ccb('0xe'));var Papa=require('papaparse');var Redis=require(_0x6ccb('0xf'));var authService=require(_0x6ccb('0x10'));var qs=require(_0x6ccb('0x11'));var as=require(_0x6ccb('0x12'));var hardwareService=require(_0x6ccb('0x13'));var logger=require('../../config/logger')(_0x6ccb('0x14'));var utils=require(_0x6ccb('0x15'));var config=require(_0x6ccb('0x16'));var licenseUtil=require(_0x6ccb('0x17'));var db=require(_0x6ccb('0x18'))['db'];function respondWithStatusCode(_0x2e8842,_0xc4903a){_0xc4903a=_0xc4903a||0xcc;return function(_0x1446b7){if(_0x1446b7){return _0x2e8842['sendStatus'](_0xc4903a);}return _0x2e8842[_0x6ccb('0x19')](_0xc4903a)[_0x6ccb('0x1a')]();};}function respondWithResult(_0x5d0ab8,_0x27784c){_0x27784c=_0x27784c||0xc8;return function(_0x4b1577){if(_0x4b1577){return _0x5d0ab8[_0x6ccb('0x19')](_0x27784c)['json'](_0x4b1577);}};}function respondWithFilteredResult(_0x3281d5,_0x4ea1b9){return function(_0x4a6909){if(_0x4a6909){var _0x42eef0=typeof _0x4ea1b9[_0x6ccb('0x1b')]===_0x6ccb('0x1c')&&typeof _0x4ea1b9[_0x6ccb('0x1d')]===_0x6ccb('0x1c');var _0x4c1460=_0x4a6909[_0x6ccb('0x1e')];var _0x26782f=_0x42eef0?0x0:_0x4ea1b9['offset'];var _0x16d6d4=_0x42eef0?_0x4a6909['count']:_0x4ea1b9[_0x6ccb('0x1b')]+_0x4ea1b9['limit'];var _0x4e5a5c;if(_0x16d6d4>=_0x4c1460){_0x16d6d4=_0x4c1460;_0x4e5a5c=0xc8;}else{_0x4e5a5c=0xce;}_0x3281d5[_0x6ccb('0x19')](_0x4e5a5c);return _0x3281d5[_0x6ccb('0x1f')]('Content-Range',_0x26782f+'-'+_0x16d6d4+'/'+_0x4c1460)['json'](_0x4a6909);}return null;};}function patchUpdates(_0x15085e){return function(_0x3e2a3d){try{jsonpatch[_0x6ccb('0x20')](_0x3e2a3d,_0x15085e,!![]);}catch(_0xb27d1a){return BPromise[_0x6ccb('0x21')](_0xb27d1a);}return _0x3e2a3d['save']();};}function saveUpdates(_0xb76ca4,_0x55ed54){return function(_0x56fab3){if(_0x56fab3){return _0x56fab3[_0x6ccb('0x22')](_0xb76ca4)[_0x6ccb('0x23')](function(_0x65954e){return _0x65954e;});}return null;};}function removeEntity(_0x4582f3,_0x1325ef){return function(_0x592634){if(_0x592634){return _0x592634[_0x6ccb('0x24')]()['then'](function(){_0x4582f3[_0x6ccb('0x19')](0xcc)[_0x6ccb('0x1a')]();});}};}function handleEntityNotFound(_0x10e130,_0x249fb3){return function(_0x159c2e){if(!_0x159c2e){_0x10e130[_0x6ccb('0x25')](0x194);}return _0x159c2e;};}function handleError(_0x103e1a,_0x3ca8e0){_0x3ca8e0=_0x3ca8e0||0x1f4;return function(_0x191d8f){logger[_0x6ccb('0x26')](_0x191d8f[_0x6ccb('0x27')]);if(_0x191d8f['name']){delete _0x191d8f[_0x6ccb('0x28')];}_0x103e1a['status'](_0x3ca8e0)[_0x6ccb('0x29')](_0x191d8f);};}exports['index']=function(_0x3df6fb,_0x20e5fb){var _0x134643={},_0xbb08ef={},_0x660763={'count':0x0,'rows':[]};var _0x244c2c=_[_0x6ccb('0x2a')](db['SquareDetailsReport'][_0x6ccb('0x2b')],function(_0x56c495){return{'name':_0x56c495[_0x6ccb('0x2c')],'type':_0x56c495['type'][_0x6ccb('0x2d')]};});_0xbb08ef[_0x6ccb('0x2e')]=_[_0x6ccb('0x2a')](_0x244c2c,_0x6ccb('0x28'));_0xbb08ef[_0x6ccb('0x2f')]=_[_0x6ccb('0x30')](_0x3df6fb[_0x6ccb('0x2f')]);_0xbb08ef[_0x6ccb('0x31')]=_[_0x6ccb('0x32')](_0xbb08ef[_0x6ccb('0x2e')],_0xbb08ef[_0x6ccb('0x2f')]);_0x134643[_0x6ccb('0x33')]=_[_0x6ccb('0x32')](_0xbb08ef[_0x6ccb('0x2e')],qs[_0x6ccb('0x34')](_0x3df6fb[_0x6ccb('0x2f')][_0x6ccb('0x34')]));_0x134643[_0x6ccb('0x33')]=_0x134643[_0x6ccb('0x33')][_0x6ccb('0x35')]?_0x134643[_0x6ccb('0x33')]:_0xbb08ef[_0x6ccb('0x2e')];if(!_0x3df6fb[_0x6ccb('0x2f')]['hasOwnProperty']('nolimit')){_0x134643[_0x6ccb('0x1d')]=qs[_0x6ccb('0x1d')](_0x3df6fb['query']['limit']);_0x134643[_0x6ccb('0x1b')]=qs['offset'](_0x3df6fb[_0x6ccb('0x2f')][_0x6ccb('0x1b')]);}_0x134643[_0x6ccb('0x36')]=qs[_0x6ccb('0x37')](_0x3df6fb[_0x6ccb('0x2f')][_0x6ccb('0x37')]);_0x134643[_0x6ccb('0x38')]=qs['filters'](_[_0x6ccb('0x39')](_0x3df6fb[_0x6ccb('0x2f')],_0xbb08ef['filters']),_0x244c2c);if(_0x3df6fb['query']['filter']){_0x134643[_0x6ccb('0x38')]=_[_0x6ccb('0x3a')](_0x134643[_0x6ccb('0x38')],{'$or':_[_0x6ccb('0x2a')](_0x244c2c,function(_0x1da08b){if(_0x1da08b[_0x6ccb('0x3b')]!==_0x6ccb('0x3c')){var _0x188612={};_0x188612[_0x1da08b[_0x6ccb('0x28')]]={'$like':'%'+_0x3df6fb[_0x6ccb('0x2f')]['filter']+'%'};return _0x188612;}})});}_0x134643=_[_0x6ccb('0x3a')]({},_0x134643,_0x3df6fb['options']);var _0x201d6e={'where':_0x134643['where']};return db['SquareDetailsReport']['count'](_0x201d6e)[_0x6ccb('0x23')](function(_0x40f380){_0x660763['count']=_0x40f380;if(_0x3df6fb['query'][_0x6ccb('0x3d')]){_0x134643['include']=[{'all':!![]}];}return db[_0x6ccb('0x3e')][_0x6ccb('0x3f')](_0x134643);})[_0x6ccb('0x23')](function(_0xa5e504){_0x660763[_0x6ccb('0x40')]=_0xa5e504;return _0x660763;})[_0x6ccb('0x23')](respondWithFilteredResult(_0x20e5fb,_0x134643))[_0x6ccb('0x41')](handleError(_0x20e5fb,null));};exports[_0x6ccb('0x42')]=function(_0x1f5736,_0x5862b6){var _0x133152={'raw':!![],'where':{'id':_0x1f5736[_0x6ccb('0x43')]['id']}},_0x1f3e29={};_0x1f3e29[_0x6ccb('0x2e')]=_[_0x6ccb('0x30')](db[_0x6ccb('0x3e')][_0x6ccb('0x2b')]);_0x1f3e29[_0x6ccb('0x2f')]=_[_0x6ccb('0x30')](_0x1f5736[_0x6ccb('0x2f')]);_0x1f3e29[_0x6ccb('0x31')]=_[_0x6ccb('0x32')](_0x1f3e29[_0x6ccb('0x2e')],_0x1f3e29[_0x6ccb('0x2f')]);_0x133152[_0x6ccb('0x33')]=_['intersection'](_0x1f3e29[_0x6ccb('0x2e')],qs[_0x6ccb('0x34')](_0x1f5736[_0x6ccb('0x2f')][_0x6ccb('0x34')]));_0x133152[_0x6ccb('0x33')]=_0x133152[_0x6ccb('0x33')][_0x6ccb('0x35')]?_0x133152[_0x6ccb('0x33')]:_0x1f3e29[_0x6ccb('0x2e')];if(_0x1f5736[_0x6ccb('0x2f')][_0x6ccb('0x3d')]){_0x133152[_0x6ccb('0x44')]=[{'all':!![]}];}_0x133152=_[_0x6ccb('0x3a')]({},_0x133152,_0x1f5736['options']);return db['SquareDetailsReport'][_0x6ccb('0x45')](_0x133152)['then'](handleEntityNotFound(_0x5862b6,null))[_0x6ccb('0x23')](respondWithResult(_0x5862b6,null))[_0x6ccb('0x41')](handleError(_0x5862b6,null));};exports['create']=function(_0x4eabde,_0x5656b6){return db[_0x6ccb('0x3e')]['create'](_0x4eabde[_0x6ccb('0x46')],{})[_0x6ccb('0x23')](respondWithResult(_0x5656b6,0xc9))[_0x6ccb('0x41')](handleError(_0x5656b6,null));};exports[_0x6ccb('0x22')]=function(_0x411ead,_0x48f370){if(_0x411ead[_0x6ccb('0x46')]['id']){delete _0x411ead[_0x6ccb('0x46')]['id'];}return db['SquareDetailsReport'][_0x6ccb('0x45')]({'where':{'id':_0x411ead[_0x6ccb('0x43')]['id']}})['then'](handleEntityNotFound(_0x48f370,null))[_0x6ccb('0x23')](saveUpdates(_0x411ead[_0x6ccb('0x46')],null))['then'](respondWithResult(_0x48f370,null))[_0x6ccb('0x41')](handleError(_0x48f370,null));};exports[_0x6ccb('0x24')]=function(_0x59b7f5,_0x3f0aeb){return db[_0x6ccb('0x3e')][_0x6ccb('0x45')]({'where':{'id':_0x59b7f5['params']['id']}})['then'](handleEntityNotFound(_0x3f0aeb,null))[_0x6ccb('0x23')](removeEntity(_0x3f0aeb,null))[_0x6ccb('0x41')](handleError(_0x3f0aeb,null));};exports['describe']=function(_0x1e805e,_0x2923e5){return db[_0x6ccb('0x3e')][_0x6ccb('0x47')]()[_0x6ccb('0x23')](respondWithResult(_0x2923e5,null))['catch'](handleError(_0x2923e5,null));}; \ No newline at end of file +var _0x1627=['destroy','error','map','SquareDetailsReport','rawAttributes','fieldName','key','name','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','where','pick','filter','type','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x227cfb,_0x4f42cf){var _0x131407=function(_0x37ddbb){while(--_0x37ddbb){_0x227cfb['push'](_0x227cfb['shift']());}};_0x131407(++_0x4f42cf);}(_0x1627,0xbb));var _0x7162=function(_0x2cac41,_0x38e31f){_0x2cac41=_0x2cac41-0x0;var _0x53d1e3=_0x1627[_0x2cac41];return _0x53d1e3;};'use strict';var emlformat=require(_0x7162('0x0'));var rimraf=require(_0x7162('0x1'));var zipdir=require(_0x7162('0x2'));var jsonpatch=require(_0x7162('0x3'));var rp=require(_0x7162('0x4'));var moment=require(_0x7162('0x5'));var BPromise=require(_0x7162('0x6'));var Mustache=require('mustache');var util=require(_0x7162('0x7'));var path=require(_0x7162('0x8'));var sox=require(_0x7162('0x9'));var csv=require('to-csv');var ejs=require(_0x7162('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7162('0xb'));var squel=require(_0x7162('0xc'));var crypto=require(_0x7162('0xd'));var jsforce=require(_0x7162('0xe'));var deskjs=require(_0x7162('0xf'));var toCsv=require(_0x7162('0x10'));var querystring=require(_0x7162('0x11'));var Papa=require(_0x7162('0x12'));var Redis=require(_0x7162('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7162('0x14'));var as=require(_0x7162('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7162('0x16'));var utils=require('../../config/utils');var config=require(_0x7162('0x17'));var licenseUtil=require(_0x7162('0x18'));var db=require(_0x7162('0x19'))['db'];function respondWithStatusCode(_0xbd05b5,_0x496c4a){_0x496c4a=_0x496c4a||0xcc;return function(_0x196f33){if(_0x196f33){return _0xbd05b5[_0x7162('0x1a')](_0x496c4a);}return _0xbd05b5[_0x7162('0x1b')](_0x496c4a)[_0x7162('0x1c')]();};}function respondWithResult(_0x20596e,_0x3d29be){_0x3d29be=_0x3d29be||0xc8;return function(_0x443313){if(_0x443313){return _0x20596e[_0x7162('0x1b')](_0x3d29be)[_0x7162('0x1d')](_0x443313);}};}function respondWithFilteredResult(_0xfd891f,_0xc8d0fe){return function(_0xcfacf6){if(_0xcfacf6){var _0x538500=typeof _0xc8d0fe['offset']==='undefined'&&typeof _0xc8d0fe[_0x7162('0x1e')]===_0x7162('0x1f');var _0x25253a=_0xcfacf6[_0x7162('0x20')];var _0x3a653b=_0x538500?0x0:_0xc8d0fe['offset'];var _0x1e90a5=_0x538500?_0xcfacf6[_0x7162('0x20')]:_0xc8d0fe[_0x7162('0x21')]+_0xc8d0fe[_0x7162('0x1e')];var _0x13657a;if(_0x1e90a5>=_0x25253a){_0x1e90a5=_0x25253a;_0x13657a=0xc8;}else{_0x13657a=0xce;}_0xfd891f['status'](_0x13657a);return _0xfd891f[_0x7162('0x22')](_0x7162('0x23'),_0x3a653b+'-'+_0x1e90a5+'/'+_0x25253a)[_0x7162('0x1d')](_0xcfacf6);}return null;};}function patchUpdates(_0x1a8ef2){return function(_0x3a474b){try{jsonpatch[_0x7162('0x24')](_0x3a474b,_0x1a8ef2,!![]);}catch(_0x10362e){return BPromise[_0x7162('0x25')](_0x10362e);}return _0x3a474b[_0x7162('0x26')]();};}function saveUpdates(_0x383180,_0x4de6e4){return function(_0x12838f){if(_0x12838f){return _0x12838f[_0x7162('0x27')](_0x383180)[_0x7162('0x28')](function(_0x238c33){return _0x238c33;});}return null;};}function removeEntity(_0xef2498,_0x11f9ac){return function(_0x2f8e2d){if(_0x2f8e2d){return _0x2f8e2d[_0x7162('0x29')]()['then'](function(){_0xef2498[_0x7162('0x1b')](0xcc)[_0x7162('0x1c')]();});}};}function handleEntityNotFound(_0x9b12b8,_0x22483d){return function(_0x31e504){if(!_0x31e504){_0x9b12b8[_0x7162('0x1a')](0x194);}return _0x31e504;};}function handleError(_0x5973d1,_0x5678e7){_0x5678e7=_0x5678e7||0x1f4;return function(_0x300dcd){logger[_0x7162('0x2a')](_0x300dcd['stack']);if(_0x300dcd['name']){delete _0x300dcd['name'];}_0x5973d1[_0x7162('0x1b')](_0x5678e7)['send'](_0x300dcd);};}exports['index']=function(_0x1b2372,_0x4580a2){var _0x512170={},_0xc6b879={},_0x5bf353={'count':0x0,'rows':[]};var _0x21bc94=_[_0x7162('0x2b')](db[_0x7162('0x2c')][_0x7162('0x2d')],function(_0x101e3f){return{'name':_0x101e3f[_0x7162('0x2e')],'type':_0x101e3f['type'][_0x7162('0x2f')]};});_0xc6b879['model']=_[_0x7162('0x2b')](_0x21bc94,_0x7162('0x30'));_0xc6b879[_0x7162('0x31')]=_[_0x7162('0x32')](_0x1b2372['query']);_0xc6b879[_0x7162('0x33')]=_[_0x7162('0x34')](_0xc6b879['model'],_0xc6b879[_0x7162('0x31')]);_0x512170[_0x7162('0x35')]=_['intersection'](_0xc6b879[_0x7162('0x36')],qs[_0x7162('0x37')](_0x1b2372[_0x7162('0x31')][_0x7162('0x37')]));_0x512170[_0x7162('0x35')]=_0x512170[_0x7162('0x35')]['length']?_0x512170[_0x7162('0x35')]:_0xc6b879[_0x7162('0x36')];if(!_0x1b2372['query'][_0x7162('0x38')](_0x7162('0x39'))){_0x512170['limit']=qs[_0x7162('0x1e')](_0x1b2372['query'][_0x7162('0x1e')]);_0x512170[_0x7162('0x21')]=qs[_0x7162('0x21')](_0x1b2372['query'][_0x7162('0x21')]);}_0x512170[_0x7162('0x3a')]=qs['sort'](_0x1b2372['query']['sort']);_0x512170[_0x7162('0x3b')]=qs[_0x7162('0x33')](_[_0x7162('0x3c')](_0x1b2372['query'],_0xc6b879[_0x7162('0x33')]),_0x21bc94);if(_0x1b2372[_0x7162('0x31')][_0x7162('0x3d')]){_0x512170[_0x7162('0x3b')]=_['merge'](_0x512170[_0x7162('0x3b')],{'$or':_[_0x7162('0x2b')](_0x21bc94,function(_0x359e3d){if(_0x359e3d[_0x7162('0x3e')]!=='VIRTUAL'){var _0x3db532={};_0x3db532[_0x359e3d['name']]={'$like':'%'+_0x1b2372[_0x7162('0x31')]['filter']+'%'};return _0x3db532;}})});}_0x512170=_[_0x7162('0x3f')]({},_0x512170,_0x1b2372[_0x7162('0x40')]);var _0x14e1d5={'where':_0x512170['where']};return db[_0x7162('0x2c')]['count'](_0x14e1d5)[_0x7162('0x28')](function(_0xb7b2e0){_0x5bf353[_0x7162('0x20')]=_0xb7b2e0;if(_0x1b2372[_0x7162('0x31')][_0x7162('0x41')]){_0x512170[_0x7162('0x42')]=[{'all':!![]}];}return db[_0x7162('0x2c')]['findAll'](_0x512170);})[_0x7162('0x28')](function(_0xad105a){_0x5bf353[_0x7162('0x43')]=_0xad105a;return _0x5bf353;})['then'](respondWithFilteredResult(_0x4580a2,_0x512170))[_0x7162('0x44')](handleError(_0x4580a2,null));};exports[_0x7162('0x45')]=function(_0xad42ed,_0x1e38a2){var _0x55223d={'raw':!![],'where':{'id':_0xad42ed[_0x7162('0x46')]['id']}},_0x1363e6={};_0x1363e6[_0x7162('0x36')]=_[_0x7162('0x32')](db['SquareDetailsReport'][_0x7162('0x2d')]);_0x1363e6[_0x7162('0x31')]=_[_0x7162('0x32')](_0xad42ed[_0x7162('0x31')]);_0x1363e6[_0x7162('0x33')]=_['intersection'](_0x1363e6[_0x7162('0x36')],_0x1363e6[_0x7162('0x31')]);_0x55223d['attributes']=_[_0x7162('0x34')](_0x1363e6[_0x7162('0x36')],qs[_0x7162('0x37')](_0xad42ed['query'][_0x7162('0x37')]));_0x55223d['attributes']=_0x55223d[_0x7162('0x35')][_0x7162('0x47')]?_0x55223d[_0x7162('0x35')]:_0x1363e6[_0x7162('0x36')];if(_0xad42ed['query']['includeAll']){_0x55223d[_0x7162('0x42')]=[{'all':!![]}];}_0x55223d=_['merge']({},_0x55223d,_0xad42ed[_0x7162('0x40')]);return db['SquareDetailsReport'][_0x7162('0x48')](_0x55223d)[_0x7162('0x28')](handleEntityNotFound(_0x1e38a2,null))[_0x7162('0x28')](respondWithResult(_0x1e38a2,null))[_0x7162('0x44')](handleError(_0x1e38a2,null));};exports['create']=function(_0x204499,_0x5af9c8){return db[_0x7162('0x2c')][_0x7162('0x49')](_0x204499[_0x7162('0x4a')],{})[_0x7162('0x28')](respondWithResult(_0x5af9c8,0xc9))[_0x7162('0x44')](handleError(_0x5af9c8,null));};exports['update']=function(_0x2d5817,_0x1d2980){if(_0x2d5817[_0x7162('0x4a')]['id']){delete _0x2d5817[_0x7162('0x4a')]['id'];}return db[_0x7162('0x2c')][_0x7162('0x48')]({'where':{'id':_0x2d5817[_0x7162('0x46')]['id']}})[_0x7162('0x28')](handleEntityNotFound(_0x1d2980,null))[_0x7162('0x28')](saveUpdates(_0x2d5817[_0x7162('0x4a')],null))[_0x7162('0x28')](respondWithResult(_0x1d2980,null))[_0x7162('0x44')](handleError(_0x1d2980,null));};exports[_0x7162('0x29')]=function(_0x2b2efa,_0x1db967){return db[_0x7162('0x2c')][_0x7162('0x48')]({'where':{'id':_0x2b2efa[_0x7162('0x46')]['id']}})['then'](handleEntityNotFound(_0x1db967,null))[_0x7162('0x28')](removeEntity(_0x1db967,null))[_0x7162('0x44')](handleError(_0x1db967,null));};exports[_0x7162('0x4b')]=function(_0xad763b,_0xf61860){return db['SquareDetailsReport'][_0x7162('0x4b')]()[_0x7162('0x28')](respondWithResult(_0xf61860,null))[_0x7162('0x44')](handleError(_0xf61860,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 218eb5a..4400abd 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 _0x3b1d=['report_square_details','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','SquareDetailsReport'];(function(_0x28ebb9,_0x921702){var _0x532ed9=function(_0x29c1d9){while(--_0x29c1d9){_0x28ebb9['push'](_0x28ebb9['shift']());}};_0x532ed9(++_0x921702);}(_0x3b1d,0x198));var _0xd3b1=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x3b1d[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd3b1('0x0'));var util=require(_0xd3b1('0x1'));var logger=require('../../config/logger')(_0xd3b1('0x2'));var moment=require(_0xd3b1('0x3'));var BPromise=require(_0xd3b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3b1('0x5'));var rimraf=require(_0xd3b1('0x6'));var config=require(_0xd3b1('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0xd3b1('0x8')]=function(_0x56fa85,_0x578db8){return _0x56fa85['define'](_0xd3b1('0x9'),attributes,{'tableName':_0xd3b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ea7=['util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','SquareDetailsReport','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ea7,0xb3));var _0x73ea=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0x3ea7[_0x53f04f];return _0x16a824;};'use strict';var _=require(_0x73ea('0x0'));var util=require(_0x73ea('0x1'));var logger=require(_0x73ea('0x2'))(_0x73ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x73ea('0x4'));var fs=require('fs');var path=require(_0x73ea('0x5'));var rimraf=require('rimraf');var config=require(_0x73ea('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x73ea('0x7')]=function(_0x5a0ab8,_0x324782){return _0x5a0ab8[_0x73ea('0x8')](_0x73ea('0x9'),attributes,{'tableName':'report_square_details','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 3e04f46..4a9d232 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 _0x2884=['then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x53cfc2,_0x4cf54c){var _0x1685e2=function(_0x5eee4a){while(--_0x5eee4a){_0x53cfc2['push'](_0x53cfc2['shift']());}};_0x1685e2(++_0x4cf54c);}(_0x2884,0x1eb));var _0x4288=function(_0x5e4a6a,_0x287632){_0x5e4a6a=_0x5e4a6a-0x0;var _0xc8879f=_0x2884[_0x5e4a6a];return _0xc8879f;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526a07,_0x3a930e,_0x5e4cfc){return new BPromise(function(_0x25023a,_0x237b02){return client['request'](_0x526a07,_0x5e4cfc)[_0x4288('0x9')](function(_0x3c8d6e){logger[_0x4288('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x3a930e,'request\x20sent');logger[_0x4288('0xb')](_0x4288('0xc'),_0x3a930e,_0x4288('0xd'),JSON[_0x4288('0xe')](_0x3c8d6e));if(_0x3c8d6e[_0x4288('0xf')]){if(_0x3c8d6e[_0x4288('0xf')][_0x4288('0x10')]===0x1f4){logger['error'](_0x4288('0x11'),_0x3a930e,_0x3c8d6e[_0x4288('0xf')][_0x4288('0x12')]);return _0x237b02(_0x3c8d6e[_0x4288('0xf')]['message']);}logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x3c8d6e['error'][_0x4288('0x12')]);return _0x25023a(_0x3c8d6e['error'][_0x4288('0x12')]);}else{logger['info'](_0x4288('0x11'),_0x3a930e,_0x4288('0xd'));_0x25023a(_0x3c8d6e[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0x1db33b){logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x1db33b);_0x237b02(_0x1db33b);});});}exports[_0x4288('0x15')]=function(_0x53fb81){var _0x199919=this;return new Promise(function(_0xde03f4,_0x5e6de1){return db['SquareDetailsReport']['create'](_0x53fb81[_0x4288('0x16')],{'raw':_0x53fb81[_0x4288('0x17')]?_0x53fb81['options'][_0x4288('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x865365){logger[_0x4288('0xa')](_0x4288('0x15'),_0x53fb81);logger['debug'](_0x4288('0x15'),_0x53fb81,JSON[_0x4288('0xe')](_0x865365));_0xde03f4(_0x865365);})[_0x4288('0x14')](function(_0x4b9cda){logger['error'](_0x4288('0x15'),_0x4b9cda[_0x4288('0x12')],_0x53fb81);_0x5e6de1(_0x199919[_0x4288('0xf')](0x1f4,_0x4b9cda[_0x4288('0x12')]));});});}; \ No newline at end of file +var _0x4b17=['SquareDetailsReport,\x20%s,\x20%s','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message'];(function(_0x12012d,_0x46e1f6){var _0x2ccaf1=function(_0x3a9488){while(--_0x3a9488){_0x12012d['push'](_0x12012d['shift']());}};_0x2ccaf1(++_0x46e1f6);}(_0x4b17,0x10f));var _0x74b1=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x4b17[_0x57d13b];return _0x467696;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371c3b,_0x191d2b,_0x16761b){return new BPromise(function(_0x4c293c,_0x287e3e){return client[_0x74b1('0x9')](_0x371c3b,_0x16761b)[_0x74b1('0xa')](function(_0x25382b){logger[_0x74b1('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'));logger[_0x74b1('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'),JSON[_0x74b1('0xe')](_0x25382b));if(_0x25382b[_0x74b1('0xf')]){if(_0x25382b[_0x74b1('0xf')]['code']===0x1f4){logger[_0x74b1('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x191d2b,_0x25382b['error'][_0x74b1('0x10')]);return _0x287e3e(_0x25382b[_0x74b1('0xf')]['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x191d2b,_0x25382b[_0x74b1('0xf')]['message']);return _0x4c293c(_0x25382b['error'][_0x74b1('0x10')]);}else{logger[_0x74b1('0xb')](_0x74b1('0x11'),_0x191d2b,_0x74b1('0xc'));_0x4c293c(_0x25382b[_0x74b1('0x12')][_0x74b1('0x10')]);}})['catch'](function(_0x6237be){logger[_0x74b1('0xf')](_0x74b1('0x11'),_0x191d2b,_0x6237be);_0x287e3e(_0x6237be);});});}exports[_0x74b1('0x13')]=function(_0xde2736){var _0x8c9510=this;return new Promise(function(_0x1ab838,_0x4bb3d2){return db[_0x74b1('0x14')][_0x74b1('0x15')](_0xde2736['body'],{'raw':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![]})[_0x74b1('0xa')](function(_0x13bb44){logger[_0x74b1('0xb')](_0x74b1('0x13'),_0xde2736);logger[_0x74b1('0xd')]('CreateSquareDetailsReport',_0xde2736,JSON[_0x74b1('0xe')](_0x13bb44));_0x1ab838(_0x13bb44);})['catch'](function(_0x5da0f7){logger['error'](_0x74b1('0x13'),_0x5da0f7[_0x74b1('0x10')],_0xde2736);_0x4bb3d2(_0x8c9510[_0x74b1('0xf')](0x1f4,_0x5da0f7[_0x74b1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f9b848f..bf88fd5 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 _0x6455=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports'];(function(_0x197df3,_0x57d366){var _0xafdaf7=function(_0x5489b5){while(--_0x5489b5){_0x197df3['push'](_0x197df3['shift']());}};_0xafdaf7(++_0x57d366);}(_0x6455,0x80));var _0x5645=function(_0x5b3857,_0x13070a){_0x5b3857=_0x5b3857-0x0;var _0xe34ade=_0x6455[_0x5b3857];return _0xe34ade;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x5645('0x0'));var controller=require(_0x5645('0x1'));router[_0x5645('0x2')]('/',auth[_0x5645('0x3')](),controller[_0x5645('0x4')]);router['get'](_0x5645('0x5'),auth[_0x5645('0x3')](),controller[_0x5645('0x6')]);module[_0x5645('0x7')]=router; \ No newline at end of file +var _0x677c=['exports','express','Router','../../components/auth/service','index','isAuthenticated','killProcess'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x677c,0xc5));var _0xc677=function(_0x263235,_0x4ae18b){_0x263235=_0x263235-0x0;var _0x166d68=_0x677c[_0x263235];return _0x166d68;};'use strict';var express=require(_0xc677('0x0'));var router=express[_0xc677('0x1')]();var auth=require(_0xc677('0x2'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc677('0x3')]);router['get']('/process/:pid/kill',auth[_0xc677('0x4')](),controller[_0xc677('0x5')]);module[_0xc677('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 46c376b..9787f30 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 _0x43df=['child_process','exec','../../config/logger','api','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x52c408,_0x35f852){var _0x31ad08=function(_0x42da3f){while(--_0x42da3f){_0x52c408['push'](_0x52c408['shift']());}};_0x31ad08(++_0x35f852);}(_0x43df,0x18f));var _0xf43d=function(_0x22d89c,_0x48c46f){_0x22d89c=_0x22d89c-0x0;var _0x3dabbc=_0x43df[_0x22d89c];return _0x3dabbc;};'use strict';var info=require(_0xf43d('0x0'));var exec=require(_0xf43d('0x1'))[_0xf43d('0x2')];var logger=require(_0xf43d('0x3'))(_0xf43d('0x4'));var util=require('util');var BPromise=require(_0xf43d('0x5'));var _=require(_0xf43d('0x6'));function handleError(_0x26c2bc,_0xf7e47f,_0x2beb20){_0xf7e47f=_0xf7e47f||0x1f4;return function(_0xa72d1d){logger['error'](_0xf43d('0x7'),_0x2beb20,_0xf7e47f,util['inspect'](_0xa72d1d,{'showHidden':![],'depth':null}));delete _0xa72d1d[_0xf43d('0x8')];_0x26c2bc[_0xf43d('0x9')](_0xf7e47f)['send'](_0xa72d1d);};}exports[_0xf43d('0xa')]=function(_0x2d9bf8,_0x3c8ed1){return info[_0xf43d('0xb')]()[_0xf43d('0xc')](function(_0x16caad){return _0x3c8ed1[_0xf43d('0x9')](0xc8)[_0xf43d('0xd')](_0x16caad);})[_0xf43d('0xe')](function(_0x449982){return _0x3c8ed1[_0xf43d('0x9')](0x1f4)['json'](_0x449982);});};exports[_0xf43d('0xf')]=function(_0x2bd13b,_0x312191){var _0x429369=[_0xf43d('0x10')];return new BPromise(function(_0x102529,_0x24c678){return exec(util[_0xf43d('0x11')](_0xf43d('0x12'),_0x2bd13b[_0xf43d('0x13')][_0xf43d('0x14')]),function(_0x322d8a,_0x415159,_0x1412a4){if(_0x322d8a){return _0x24c678(_0x322d8a);}return _0x102529(_0x415159);});})[_0xf43d('0xc')](function(_0x1cc78e){var _0x2b4a86=![];var _0x4a2d86=_0x1cc78e[_0xf43d('0x15')](/\n/);for(var _0xf6613d=0x0,_0x165106=_0x429369[_0xf43d('0x16')];_0xf6613d<_0x165106,_0x2b4a86===![];_0xf6613d+=0x1){if(_0x1cc78e['indexOf'](_0x429369[_0xf6613d])>=0x0){_0x2b4a86=!![];}}if(!_0x2b4a86){throw new Error(util[_0xf43d('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x2bd13b[_0xf43d('0x13')][_0xf43d('0x14')]));}process[_0xf43d('0x17')](_0x2bd13b['params'][_0xf43d('0x14')],'SIGINT');return _0x312191[_0xf43d('0x9')](0xc8)[_0xf43d('0xd')]({'message':util[_0xf43d('0x11')](_0xf43d('0x18'),_0x2bd13b['params']['pid'])});})[_0xf43d('0xe')](handleError(_0x312191,null,'killProcess'));}; \ No newline at end of file +var _0x0606=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0606,0x1d6));var _0x6060=function(_0x153ed5,_0x2eb6e9){_0x153ed5=_0x153ed5-0x0;var _0x316b5b=_0x0606[_0x153ed5];return _0x316b5b;};'use strict';var info=require('systeminformation');var exec=require(_0x6060('0x0'))[_0x6060('0x1')];var logger=require(_0x6060('0x2'))(_0x6060('0x3'));var util=require(_0x6060('0x4'));var BPromise=require('bluebird');var _=require(_0x6060('0x5'));function handleError(_0x173be6,_0x5d5b2f,_0x242599){_0x5d5b2f=_0x5d5b2f||0x1f4;return function(_0x4166c3){logger[_0x6060('0x6')](_0x6060('0x7'),_0x242599,_0x5d5b2f,util['inspect'](_0x4166c3,{'showHidden':![],'depth':null}));delete _0x4166c3['name'];_0x173be6[_0x6060('0x8')](_0x5d5b2f)[_0x6060('0x9')](_0x4166c3);};}exports[_0x6060('0xa')]=function(_0x361f55,_0x583f6a){return info[_0x6060('0xb')]()['then'](function(_0x53e90a){return _0x583f6a[_0x6060('0x8')](0xc8)['json'](_0x53e90a);})[_0x6060('0xc')](function(_0x55e18d){return _0x583f6a[_0x6060('0x8')](0x1f4)[_0x6060('0xd')](_0x55e18d);});};exports[_0x6060('0xe')]=function(_0x124ae0,_0x249b04){var _0x514e7e=[_0x6060('0xf')];return new BPromise(function(_0x195bb9,_0x2e528f){return exec(util['format'](_0x6060('0x10'),_0x124ae0[_0x6060('0x11')][_0x6060('0x12')]),function(_0x460f5f,_0x3924b0,_0x444b93){if(_0x460f5f){return _0x2e528f(_0x460f5f);}return _0x195bb9(_0x3924b0);});})[_0x6060('0x13')](function(_0x39c9f0){var _0x82ea37=![];var _0x2c1c0e=_0x39c9f0[_0x6060('0x14')](/\n/);for(var _0x3f2d90=0x0,_0x39b560=_0x514e7e[_0x6060('0x15')];_0x3f2d90<_0x39b560,_0x82ea37===![];_0x3f2d90+=0x1){if(_0x39c9f0[_0x6060('0x16')](_0x514e7e[_0x3f2d90])>=0x0){_0x82ea37=!![];}}if(!_0x82ea37){throw new Error(util[_0x6060('0x17')](_0x6060('0x18'),_0x124ae0[_0x6060('0x11')]['pid']));}process[_0x6060('0x19')](_0x124ae0[_0x6060('0x11')]['pid'],_0x6060('0x1a'));return _0x249b04[_0x6060('0x8')](0xc8)[_0x6060('0xd')]({'message':util[_0x6060('0x17')](_0x6060('0x1b'),_0x124ae0[_0x6060('0x11')][_0x6060('0x12')])});})['catch'](handleError(_0x249b04,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c174503..aa7b831 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 _0xc2c5=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1273eb,_0x5a85de){var _0x2cbffe=function(_0xa6334d){while(--_0xa6334d){_0x1273eb['push'](_0x1273eb['shift']());}};_0x2cbffe(++_0x5a85de);}(_0xc2c5,0xe2));var _0x5c2c=function(_0x1f06c5,_0x28092b){_0x1f06c5=_0x1f06c5-0x0;var _0x1ec9b2=_0xc2c5[_0x1f06c5];return _0x1ec9b2;};'use strict';var multer=require(_0x5c2c('0x0'));var util=require(_0x5c2c('0x1'));var path=require(_0x5c2c('0x2'));var timeout=require(_0x5c2c('0x3'));var express=require(_0x5c2c('0x4'));var router=express[_0x5c2c('0x5')]();var fs_extra=require(_0x5c2c('0x6'));var auth=require(_0x5c2c('0x7'));var interaction=require(_0x5c2c('0x8'));var config=require(_0x5c2c('0x9'));var controller=require(_0x5c2c('0xa'));router[_0x5c2c('0xb')]('/',auth[_0x5c2c('0xc')](),controller[_0x5c2c('0xd')]);router[_0x5c2c('0xb')](_0x5c2c('0xe'),auth['isAuthenticated'](),controller[_0x5c2c('0xf')]);router['post']('/',auth[_0x5c2c('0xc')](),controller[_0x5c2c('0x10')]);router[_0x5c2c('0x11')](_0x5c2c('0xe'),auth[_0x5c2c('0xc')](),controller[_0x5c2c('0x12')]);router[_0x5c2c('0x13')](_0x5c2c('0xe'),auth[_0x5c2c('0xc')](),controller[_0x5c2c('0x14')]);module[_0x5c2c('0x15')]=router; \ No newline at end of file +var _0x2162=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','create','/:id','update','exports','multer','util','express'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x2162,0x1d1));var _0x2216=function(_0x490cd3,_0x97d5ee){_0x490cd3=_0x490cd3-0x0;var _0x3320d7=_0x2162[_0x490cd3];return _0x3320d7;};'use strict';var multer=require(_0x2216('0x0'));var util=require(_0x2216('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2216('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2216('0x3'));var config=require(_0x2216('0x4'));var controller=require('./tag.controller');router[_0x2216('0x5')]('/',auth['isAuthenticated'](),controller[_0x2216('0x6')]);router[_0x2216('0x5')]('/:id',auth[_0x2216('0x7')](),controller[_0x2216('0x8')]);router['post']('/',auth[_0x2216('0x7')](),controller[_0x2216('0x9')]);router['put'](_0x2216('0xa'),auth['isAuthenticated'](),controller[_0x2216('0xb')]);router['delete']('/:id',auth[_0x2216('0x7')](),controller['destroy']);module[_0x2216('0xc')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 19314aa..df94950 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 _0xb78e=['STRING','#0091EA','sequelize','exports','name'];(function(_0x1605a3,_0x439883){var _0x9cf0e3=function(_0xe52782){while(--_0xe52782){_0x1605a3['push'](_0x1605a3['shift']());}};_0x9cf0e3(++_0x439883);}(_0xb78e,0x1c9));var _0xeb78=function(_0x1778f7,_0x5b3a2f){_0x1778f7=_0x1778f7-0x0;var _0x295ede=_0xb78e[_0x1778f7];return _0x295ede;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xeb78('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xeb78('0x3')],'defaultValue':_0xeb78('0x4')},'description':{'type':Sequelize[_0xeb78('0x3')]}}; \ No newline at end of file +var _0x1752=['#0091EA','exports','STRING','name'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x1752,0xa5));var _0x2175=function(_0x318926,_0x426109){_0x318926=_0x318926-0x0;var _0x529867=_0x1752[_0x318926];return _0x529867;};'use strict';var Sequelize=require('sequelize');module[_0x2175('0x0')]={'name':{'type':Sequelize[_0x2175('0x1')],'unique':_0x2175('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x2175('0x1')],'defaultValue':_0x2175('0x3')},'description':{'type':Sequelize[_0x2175('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index c636ad8..47fb6f6 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 _0x765e=['end','status','undefined','limit','count','offset','set','json','apply','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','show','params','keys','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x765e,0x131));var _0xe765=function(_0x1756be,_0x4b17d6){_0x1756be=_0x1756be-0x0;var _0x1efb14=_0x765e[_0x1756be];return _0x1efb14;};'use strict';var emlformat=require(_0xe765('0x0'));var rimraf=require(_0xe765('0x1'));var zipdir=require(_0xe765('0x2'));var jsonpatch=require(_0xe765('0x3'));var rp=require(_0xe765('0x4'));var moment=require(_0xe765('0x5'));var BPromise=require(_0xe765('0x6'));var Mustache=require(_0xe765('0x7'));var util=require(_0xe765('0x8'));var path=require(_0xe765('0x9'));var sox=require(_0xe765('0xa'));var csv=require(_0xe765('0xb'));var ejs=require(_0xe765('0xc'));var fs=require('fs');var fs_extra=require(_0xe765('0xd'));var _=require(_0xe765('0xe'));var squel=require('squel');var crypto=require(_0xe765('0xf'));var jsforce=require(_0xe765('0x10'));var deskjs=require(_0xe765('0x11'));var toCsv=require(_0xe765('0xb'));var querystring=require(_0xe765('0x12'));var Papa=require(_0xe765('0x13'));var Redis=require(_0xe765('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe765('0x15'));var as=require(_0xe765('0x16'));var hardwareService=require(_0xe765('0x17'));var logger=require('../../config/logger')(_0xe765('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe765('0x19'))['db'];function respondWithStatusCode(_0x18177f,_0x9411a0){_0x9411a0=_0x9411a0||0xcc;return function(_0x27456b){if(_0x27456b){return _0x18177f[_0xe765('0x1a')](_0x9411a0);}return _0x18177f['status'](_0x9411a0)[_0xe765('0x1b')]();};}function respondWithResult(_0x3a26d8,_0x395312){_0x395312=_0x395312||0xc8;return function(_0x58dc37){if(_0x58dc37){return _0x3a26d8[_0xe765('0x1c')](_0x395312)['json'](_0x58dc37);}};}function respondWithFilteredResult(_0x50e2ab,_0x2f673b){return function(_0x1b1cfe){if(_0x1b1cfe){var _0x3c887b=typeof _0x2f673b['offset']===_0xe765('0x1d')&&typeof _0x2f673b[_0xe765('0x1e')]===_0xe765('0x1d');var _0x1db3ca=_0x1b1cfe[_0xe765('0x1f')];var _0xf93371=_0x3c887b?0x0:_0x2f673b[_0xe765('0x20')];var _0x2a95a9=_0x3c887b?_0x1b1cfe[_0xe765('0x1f')]:_0x2f673b['offset']+_0x2f673b[_0xe765('0x1e')];var _0x56905c;if(_0x2a95a9>=_0x1db3ca){_0x2a95a9=_0x1db3ca;_0x56905c=0xc8;}else{_0x56905c=0xce;}_0x50e2ab[_0xe765('0x1c')](_0x56905c);return _0x50e2ab[_0xe765('0x21')]('Content-Range',_0xf93371+'-'+_0x2a95a9+'/'+_0x1db3ca)[_0xe765('0x22')](_0x1b1cfe);}return null;};}function patchUpdates(_0x59118f){return function(_0x1c73c8){try{jsonpatch[_0xe765('0x23')](_0x1c73c8,_0x59118f,!![]);}catch(_0x1efb96){return BPromise['reject'](_0x1efb96);}return _0x1c73c8['save']();};}function saveUpdates(_0x4b789b,_0x1c6de4){return function(_0x2a4427){if(_0x2a4427){return _0x2a4427[_0xe765('0x24')](_0x4b789b)[_0xe765('0x25')](function(_0x54b59c){return _0x54b59c;});}return null;};}function removeEntity(_0x50cfcb,_0x18ba77){return function(_0x2e2a34){if(_0x2e2a34){return _0x2e2a34[_0xe765('0x26')]()[_0xe765('0x25')](function(){var _0xad34a7=_0x2e2a34['get']({'plain':!![]});var _0x1aacbc='Tags';return db[_0xe765('0x27')][_0xe765('0x26')]({'where':{'type':_0x1aacbc,'resourceId':_0xad34a7['id']}})[_0xe765('0x25')](function(){return _0x2e2a34;});})[_0xe765('0x25')](function(){_0x50cfcb[_0xe765('0x1c')](0xcc)[_0xe765('0x1b')]();});}};}function handleEntityNotFound(_0x471d57,_0x530838){return function(_0x55086d){if(!_0x55086d){_0x471d57[_0xe765('0x1a')](0x194);}return _0x55086d;};}function handleError(_0x4bc5c1,_0xf19724){_0xf19724=_0xf19724||0x1f4;return function(_0x3f7493){logger[_0xe765('0x28')](_0x3f7493[_0xe765('0x29')]);if(_0x3f7493[_0xe765('0x2a')]){delete _0x3f7493['name'];}_0x4bc5c1[_0xe765('0x1c')](_0xf19724)[_0xe765('0x2b')](_0x3f7493);};}exports[_0xe765('0x2c')]=function(_0x5b4a3f,_0x5947c1){var _0x315322={},_0x47d7e7={},_0x477eef={'count':0x0,'rows':[]};var _0xe81d01=_[_0xe765('0x2d')](db[_0xe765('0x2e')][_0xe765('0x2f')],function(_0x56127d){return{'name':_0x56127d['fieldName'],'type':_0x56127d[_0xe765('0x30')][_0xe765('0x31')]};});_0x47d7e7[_0xe765('0x32')]=_[_0xe765('0x2d')](_0xe81d01,_0xe765('0x2a'));_0x47d7e7['query']=_['keys'](_0x5b4a3f[_0xe765('0x33')]);_0x47d7e7['filters']=_[_0xe765('0x34')](_0x47d7e7[_0xe765('0x32')],_0x47d7e7[_0xe765('0x33')]);_0x315322[_0xe765('0x35')]=_[_0xe765('0x34')](_0x47d7e7[_0xe765('0x32')],qs[_0xe765('0x36')](_0x5b4a3f['query']['fields']));_0x315322['attributes']=_0x315322[_0xe765('0x35')][_0xe765('0x37')]?_0x315322[_0xe765('0x35')]:_0x47d7e7[_0xe765('0x32')];if(!_0x5b4a3f['query'][_0xe765('0x38')](_0xe765('0x39'))){_0x315322[_0xe765('0x1e')]=qs[_0xe765('0x1e')](_0x5b4a3f['query'][_0xe765('0x1e')]);_0x315322['offset']=qs[_0xe765('0x20')](_0x5b4a3f[_0xe765('0x33')][_0xe765('0x20')]);}_0x315322[_0xe765('0x3a')]=qs[_0xe765('0x3b')](_0x5b4a3f[_0xe765('0x33')][_0xe765('0x3b')]);_0x315322[_0xe765('0x3c')]=qs[_0xe765('0x3d')](_[_0xe765('0x3e')](_0x5b4a3f['query'],_0x47d7e7[_0xe765('0x3d')]),_0xe81d01);if(_0x5b4a3f[_0xe765('0x33')][_0xe765('0x3f')]){_0x315322['where']=_['merge'](_0x315322['where'],{'$or':_[_0xe765('0x2d')](_0xe81d01,function(_0x5898b3){if(_0x5898b3[_0xe765('0x30')]!==_0xe765('0x40')){var _0x3be7d7={};_0x3be7d7[_0x5898b3[_0xe765('0x2a')]]={'$like':'%'+_0x5b4a3f['query'][_0xe765('0x3f')]+'%'};return _0x3be7d7;}})});}_0x315322=_[_0xe765('0x41')]({},_0x315322,_0x5b4a3f[_0xe765('0x42')]);var _0x4199ea={'where':_0x315322[_0xe765('0x3c')]};return db[_0xe765('0x2e')][_0xe765('0x1f')](_0x4199ea)[_0xe765('0x25')](function(_0xb92246){_0x477eef[_0xe765('0x1f')]=_0xb92246;if(_0x5b4a3f['query'][_0xe765('0x43')]){_0x315322['include']=[{'all':!![]}];}return db[_0xe765('0x2e')][_0xe765('0x44')](_0x315322);})['then'](function(_0x3977e5){_0x477eef['rows']=_0x3977e5;return _0x477eef;})['then'](respondWithFilteredResult(_0x5947c1,_0x315322))['catch'](handleError(_0x5947c1,null));};exports[_0xe765('0x45')]=function(_0xb77b5e,_0x1ded88){var _0x54833a={'raw':!![],'where':{'id':_0xb77b5e[_0xe765('0x46')]['id']}},_0x2de9de={};_0x2de9de[_0xe765('0x32')]=_[_0xe765('0x47')](db[_0xe765('0x2e')][_0xe765('0x2f')]);_0x2de9de[_0xe765('0x33')]=_[_0xe765('0x47')](_0xb77b5e[_0xe765('0x33')]);_0x2de9de['filters']=_[_0xe765('0x34')](_0x2de9de['model'],_0x2de9de['query']);_0x54833a[_0xe765('0x35')]=_['intersection'](_0x2de9de[_0xe765('0x32')],qs[_0xe765('0x36')](_0xb77b5e[_0xe765('0x33')]['fields']));_0x54833a[_0xe765('0x35')]=_0x54833a['attributes'][_0xe765('0x37')]?_0x54833a[_0xe765('0x35')]:_0x2de9de[_0xe765('0x32')];if(_0xb77b5e['query'][_0xe765('0x43')]){_0x54833a[_0xe765('0x48')]=[{'all':!![]}];}_0x54833a=_[_0xe765('0x41')]({},_0x54833a,_0xb77b5e[_0xe765('0x42')]);return db['Tag']['find'](_0x54833a)['then'](handleEntityNotFound(_0x1ded88,null))[_0xe765('0x25')](respondWithResult(_0x1ded88,null))[_0xe765('0x49')](handleError(_0x1ded88,null));};exports[_0xe765('0x4a')]=function(_0x58310d,_0x14834c){return db['Tag'][_0xe765('0x4a')](_0x58310d[_0xe765('0x4b')],{})[_0xe765('0x25')](function(_0x29e661){var _0x7f132f=_0x58310d[_0xe765('0x4c')]['get']({'plain':!![]});if(!_0x7f132f)throw new Error(_0xe765('0x4d'));if(_0x7f132f[_0xe765('0x4e')]===_0xe765('0x4c')){var _0x1214a8=_0x29e661[_0xe765('0x4f')]({'plain':!![]});var _0x182957='Tags';return db['UserProfileSection'][_0xe765('0x50')]({'where':{'name':_0x182957,'userProfileId':_0x7f132f[_0xe765('0x51')]},'raw':!![]})[_0xe765('0x25')](function(_0x5199b2){if(_0x5199b2&&_0x5199b2[_0xe765('0x52')]===0x0){return db[_0xe765('0x27')][_0xe765('0x4a')]({'name':_0x1214a8[_0xe765('0x2a')],'resourceId':_0x1214a8['id'],'type':_0x5199b2[_0xe765('0x2a')],'sectionId':_0x5199b2['id']},{})[_0xe765('0x25')](function(){return _0x29e661;});}else{return _0x29e661;}})[_0xe765('0x49')](function(_0x292177){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x292177);throw _0x292177;});}return _0x29e661;})[_0xe765('0x25')](respondWithResult(_0x14834c,0xc9))['catch'](handleError(_0x14834c,null));};exports[_0xe765('0x24')]=function(_0x125b04,_0x8bcddb){if(_0x125b04['body']['id']){delete _0x125b04[_0xe765('0x4b')]['id'];}return db[_0xe765('0x2e')]['find']({'where':{'id':_0x125b04[_0xe765('0x46')]['id']}})[_0xe765('0x25')](handleEntityNotFound(_0x8bcddb,null))[_0xe765('0x25')](saveUpdates(_0x125b04[_0xe765('0x4b')],null))[_0xe765('0x25')](respondWithResult(_0x8bcddb,null))[_0xe765('0x49')](handleError(_0x8bcddb,null));};exports[_0xe765('0x26')]=function(_0x361e36,_0x45be53){return db[_0xe765('0x2e')][_0xe765('0x50')]({'where':{'id':_0x361e36[_0xe765('0x46')]['id']}})[_0xe765('0x25')](handleEntityNotFound(_0x45be53,null))['then'](removeEntity(_0x45be53,null))[_0xe765('0x49')](handleError(_0x45be53,null));}; \ No newline at end of file +var _0x2356=['sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','moment','bluebird','path','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','json','reject','save','destroy','then','Tags','UserProfileResource','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x117f18,_0x43cb2b){var _0x2d04e6=function(_0x15f1f7){while(--_0x15f1f7){_0x117f18['push'](_0x117f18['shift']());}};_0x2d04e6(++_0x43cb2b);}(_0x2356,0x14f));var _0x6235=function(_0x2851c4,_0x5ef2bf){_0x2851c4=_0x2851c4-0x0;var _0x273ce8=_0x2356[_0x2851c4];return _0x273ce8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6235('0x0'));var zipdir=require(_0x6235('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6235('0x2'));var BPromise=require(_0x6235('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6235('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6235('0x5'));var fs=require('fs');var fs_extra=require(_0x6235('0x6'));var _=require(_0x6235('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6235('0x8'));var toCsv=require('to-csv');var querystring=require(_0x6235('0x9'));var Papa=require(_0x6235('0xa'));var Redis=require(_0x6235('0xb'));var authService=require(_0x6235('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x6235('0xd'));var hardwareService=require(_0x6235('0xe'));var logger=require(_0x6235('0xf'))(_0x6235('0x10'));var utils=require(_0x6235('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6235('0x12'));var db=require(_0x6235('0x13'))['db'];function respondWithStatusCode(_0x1303e7,_0x6c422b){_0x6c422b=_0x6c422b||0xcc;return function(_0x48df2d){if(_0x48df2d){return _0x1303e7[_0x6235('0x14')](_0x6c422b);}return _0x1303e7[_0x6235('0x15')](_0x6c422b)['end']();};}function respondWithResult(_0x3f5b7d,_0x48e3a7){_0x48e3a7=_0x48e3a7||0xc8;return function(_0x35156f){if(_0x35156f){return _0x3f5b7d[_0x6235('0x15')](_0x48e3a7)['json'](_0x35156f);}};}function respondWithFilteredResult(_0x1cfd0b,_0x1f1c54){return function(_0x3f619b){if(_0x3f619b){var _0x3f32af=typeof _0x1f1c54['offset']===_0x6235('0x16')&&typeof _0x1f1c54[_0x6235('0x17')]===_0x6235('0x16');var _0x2e5a84=_0x3f619b[_0x6235('0x18')];var _0x2a3554=_0x3f32af?0x0:_0x1f1c54[_0x6235('0x19')];var _0x22f090=_0x3f32af?_0x3f619b[_0x6235('0x18')]:_0x1f1c54[_0x6235('0x19')]+_0x1f1c54['limit'];var _0x35103a;if(_0x22f090>=_0x2e5a84){_0x22f090=_0x2e5a84;_0x35103a=0xc8;}else{_0x35103a=0xce;}_0x1cfd0b[_0x6235('0x15')](_0x35103a);return _0x1cfd0b['set']('Content-Range',_0x2a3554+'-'+_0x22f090+'/'+_0x2e5a84)[_0x6235('0x1a')](_0x3f619b);}return null;};}function patchUpdates(_0x4f0aa2){return function(_0x5d3872){try{jsonpatch['apply'](_0x5d3872,_0x4f0aa2,!![]);}catch(_0x367207){return BPromise[_0x6235('0x1b')](_0x367207);}return _0x5d3872[_0x6235('0x1c')]();};}function saveUpdates(_0x1c60c7,_0x24c057){return function(_0x270c49){if(_0x270c49){return _0x270c49['update'](_0x1c60c7)['then'](function(_0x4663b3){return _0x4663b3;});}return null;};}function removeEntity(_0x5ac43d,_0x2189d0){return function(_0x1bed65){if(_0x1bed65){return _0x1bed65[_0x6235('0x1d')]()[_0x6235('0x1e')](function(){var _0x3eea59=_0x1bed65['get']({'plain':!![]});var _0x1e3d90=_0x6235('0x1f');return db[_0x6235('0x20')][_0x6235('0x1d')]({'where':{'type':_0x1e3d90,'resourceId':_0x3eea59['id']}})[_0x6235('0x1e')](function(){return _0x1bed65;});})['then'](function(){_0x5ac43d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f28f2,_0x5aa9fa){return function(_0x404e30){if(!_0x404e30){_0x4f28f2[_0x6235('0x14')](0x194);}return _0x404e30;};}function handleError(_0x20c633,_0x3e7cc8){_0x3e7cc8=_0x3e7cc8||0x1f4;return function(_0x2acc8c){logger['error'](_0x2acc8c['stack']);if(_0x2acc8c['name']){delete _0x2acc8c[_0x6235('0x21')];}_0x20c633['status'](_0x3e7cc8)[_0x6235('0x22')](_0x2acc8c);};}exports[_0x6235('0x23')]=function(_0x570d16,_0x37580b){var _0x3a9439={},_0x5bb691={},_0x3e3162={'count':0x0,'rows':[]};var _0x1dd384=_[_0x6235('0x24')](db[_0x6235('0x25')][_0x6235('0x26')],function(_0x452f60){return{'name':_0x452f60[_0x6235('0x27')],'type':_0x452f60[_0x6235('0x28')][_0x6235('0x29')]};});_0x5bb691[_0x6235('0x2a')]=_['map'](_0x1dd384,_0x6235('0x21'));_0x5bb691['query']=_['keys'](_0x570d16[_0x6235('0x2b')]);_0x5bb691['filters']=_['intersection'](_0x5bb691[_0x6235('0x2a')],_0x5bb691['query']);_0x3a9439['attributes']=_[_0x6235('0x2c')](_0x5bb691[_0x6235('0x2a')],qs[_0x6235('0x2d')](_0x570d16['query'][_0x6235('0x2d')]));_0x3a9439[_0x6235('0x2e')]=_0x3a9439[_0x6235('0x2e')]['length']?_0x3a9439[_0x6235('0x2e')]:_0x5bb691['model'];if(!_0x570d16[_0x6235('0x2b')][_0x6235('0x2f')](_0x6235('0x30'))){_0x3a9439[_0x6235('0x17')]=qs[_0x6235('0x17')](_0x570d16['query'][_0x6235('0x17')]);_0x3a9439['offset']=qs[_0x6235('0x19')](_0x570d16[_0x6235('0x2b')][_0x6235('0x19')]);}_0x3a9439[_0x6235('0x31')]=qs[_0x6235('0x32')](_0x570d16['query']['sort']);_0x3a9439[_0x6235('0x33')]=qs[_0x6235('0x34')](_[_0x6235('0x35')](_0x570d16[_0x6235('0x2b')],_0x5bb691[_0x6235('0x34')]),_0x1dd384);if(_0x570d16[_0x6235('0x2b')][_0x6235('0x36')]){_0x3a9439[_0x6235('0x33')]=_[_0x6235('0x37')](_0x3a9439[_0x6235('0x33')],{'$or':_['map'](_0x1dd384,function(_0x5529c1){if(_0x5529c1[_0x6235('0x28')]!=='VIRTUAL'){var _0x585744={};_0x585744[_0x5529c1[_0x6235('0x21')]]={'$like':'%'+_0x570d16[_0x6235('0x2b')][_0x6235('0x36')]+'%'};return _0x585744;}})});}_0x3a9439=_['merge']({},_0x3a9439,_0x570d16[_0x6235('0x38')]);var _0x535d80={'where':_0x3a9439[_0x6235('0x33')]};return db[_0x6235('0x25')][_0x6235('0x18')](_0x535d80)[_0x6235('0x1e')](function(_0x36abb1){_0x3e3162[_0x6235('0x18')]=_0x36abb1;if(_0x570d16[_0x6235('0x2b')][_0x6235('0x39')]){_0x3a9439['include']=[{'all':!![]}];}return db['Tag'][_0x6235('0x3a')](_0x3a9439);})['then'](function(_0x173c62){_0x3e3162[_0x6235('0x3b')]=_0x173c62;return _0x3e3162;})[_0x6235('0x1e')](respondWithFilteredResult(_0x37580b,_0x3a9439))[_0x6235('0x3c')](handleError(_0x37580b,null));};exports[_0x6235('0x3d')]=function(_0x38092e,_0x3c1ce7){var _0x4a5f6f={'raw':!![],'where':{'id':_0x38092e[_0x6235('0x3e')]['id']}},_0x3a99c4={};_0x3a99c4[_0x6235('0x2a')]=_['keys'](db[_0x6235('0x25')][_0x6235('0x26')]);_0x3a99c4[_0x6235('0x2b')]=_[_0x6235('0x3f')](_0x38092e[_0x6235('0x2b')]);_0x3a99c4[_0x6235('0x34')]=_[_0x6235('0x2c')](_0x3a99c4[_0x6235('0x2a')],_0x3a99c4['query']);_0x4a5f6f[_0x6235('0x2e')]=_[_0x6235('0x2c')](_0x3a99c4[_0x6235('0x2a')],qs['fields'](_0x38092e[_0x6235('0x2b')][_0x6235('0x2d')]));_0x4a5f6f[_0x6235('0x2e')]=_0x4a5f6f[_0x6235('0x2e')][_0x6235('0x40')]?_0x4a5f6f[_0x6235('0x2e')]:_0x3a99c4[_0x6235('0x2a')];if(_0x38092e[_0x6235('0x2b')][_0x6235('0x39')]){_0x4a5f6f['include']=[{'all':!![]}];}_0x4a5f6f=_[_0x6235('0x37')]({},_0x4a5f6f,_0x38092e['options']);return db[_0x6235('0x25')][_0x6235('0x41')](_0x4a5f6f)[_0x6235('0x1e')](handleEntityNotFound(_0x3c1ce7,null))['then'](respondWithResult(_0x3c1ce7,null))['catch'](handleError(_0x3c1ce7,null));};exports[_0x6235('0x42')]=function(_0x433263,_0x4468d4){return db[_0x6235('0x25')]['create'](_0x433263[_0x6235('0x43')],{})[_0x6235('0x1e')](function(_0x568aee){var _0x7e27cd=_0x433263['user'][_0x6235('0x44')]({'plain':!![]});if(!_0x7e27cd)throw new Error(_0x6235('0x45'));if(_0x7e27cd[_0x6235('0x46')]==='user'){var _0x2aa5f9=_0x568aee['get']({'plain':!![]});var _0x5b78db='Tags';return db[_0x6235('0x47')][_0x6235('0x41')]({'where':{'name':_0x5b78db,'userProfileId':_0x7e27cd[_0x6235('0x48')]},'raw':!![]})[_0x6235('0x1e')](function(_0x405e76){if(_0x405e76&&_0x405e76[_0x6235('0x49')]===0x0){return db[_0x6235('0x20')]['create']({'name':_0x2aa5f9[_0x6235('0x21')],'resourceId':_0x2aa5f9['id'],'type':_0x405e76[_0x6235('0x21')],'sectionId':_0x405e76['id']},{})[_0x6235('0x1e')](function(){return _0x568aee;});}else{return _0x568aee;}})[_0x6235('0x3c')](function(_0x589747){logger[_0x6235('0x4a')](_0x6235('0x4b'),_0x589747);throw _0x589747;});}return _0x568aee;})[_0x6235('0x1e')](respondWithResult(_0x4468d4,0xc9))['catch'](handleError(_0x4468d4,null));};exports[_0x6235('0x4c')]=function(_0x5c73ea,_0x4a4ad3){if(_0x5c73ea['body']['id']){delete _0x5c73ea[_0x6235('0x43')]['id'];}return db['Tag'][_0x6235('0x41')]({'where':{'id':_0x5c73ea[_0x6235('0x3e')]['id']}})[_0x6235('0x1e')](handleEntityNotFound(_0x4a4ad3,null))['then'](saveUpdates(_0x5c73ea[_0x6235('0x43')],null))['then'](respondWithResult(_0x4a4ad3,null))[_0x6235('0x3c')](handleError(_0x4a4ad3,null));};exports[_0x6235('0x1d')]=function(_0x3bc3ce,_0x457af6){return db[_0x6235('0x25')][_0x6235('0x41')]({'where':{'id':_0x3bc3ce[_0x6235('0x3e')]['id']}})[_0x6235('0x1e')](handleEntityNotFound(_0x457af6,null))['then'](removeEntity(_0x457af6,null))[_0x6235('0x3c')](handleError(_0x457af6,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 16be6ce..4bb8622 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 _0x22f6=['rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x6a2d8d,_0x4e5eb6){var _0x2670dd=function(_0x14d7b5){while(--_0x14d7b5){_0x6a2d8d['push'](_0x6a2d8d['shift']());}};_0x2670dd(++_0x4e5eb6);}(_0x22f6,0x10e));var _0x622f=function(_0x57406c,_0x3cb719){_0x57406c=_0x57406c-0x0;var _0x2a417a=_0x22f6[_0x57406c];return _0x2a417a;};'use strict';var _=require(_0x622f('0x0'));var util=require('util');var logger=require(_0x622f('0x1'))('api');var moment=require(_0x622f('0x2'));var BPromise=require(_0x622f('0x3'));var rp=require(_0x622f('0x4'));var fs=require('fs');var path=require(_0x622f('0x5'));var rimraf=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var attributes=require(_0x622f('0x8'));module[_0x622f('0x9')]=function(_0x659c64,_0x342d96){return _0x659c64['define'](_0x622f('0xa'),attributes,{'tableName':_0x622f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24c8=['Tag','lodash','../../config/logger','api','moment','bluebird','path','rimraf','define'];(function(_0xc3edb3,_0x476869){var _0x5cbd9f=function(_0x57e03b){while(--_0x57e03b){_0xc3edb3['push'](_0xc3edb3['shift']());}};_0x5cbd9f(++_0x476869);}(_0x24c8,0x196));var _0x824c=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x24c8[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0x824c('0x0'));var util=require('util');var logger=require(_0x824c('0x1'))(_0x824c('0x2'));var moment=require(_0x824c('0x3'));var BPromise=require(_0x824c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x824c('0x5'));var rimraf=require(_0x824c('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x5a640a,_0x2ef2ce){return _0x5a640a[_0x824c('0x7')](_0x824c('0x8'),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 a08de46..46d0eb2 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 _0x2494=['../../config/utils','../../config/environment','client','http','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x47623c,_0x5aa000){var _0xffa871=function(_0x42ff88){while(--_0x42ff88){_0x47623c['push'](_0x47623c['shift']());}};_0xffa871(++_0x5aa000);}(_0x2494,0x82));var _0x4249=function(_0x49c4d6,_0x1b074c){_0x49c4d6=_0x49c4d6-0x0;var _0x7a5adc=_0x2494[_0x49c4d6];return _0x7a5adc;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var moment=require(_0x4249('0x1'));var BPromise=require(_0x4249('0x2'));var rs=require(_0x4249('0x3'));var fs=require('fs');var Redis=require(_0x4249('0x4'));var db=require(_0x4249('0x5'))['db'];var utils=require(_0x4249('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4249('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4249('0x8')][_0x4249('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed716a,_0x5b1b17,_0x326336){return new BPromise(function(_0x2b7934,_0x21060d){return client['request'](_0xed716a,_0x326336)['then'](function(_0x3efaa6){logger[_0x4249('0xa')](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));logger[_0x4249('0xd')](_0x4249('0xe'),_0x5b1b17,_0x4249('0xc'),JSON['stringify'](_0x3efaa6));if(_0x3efaa6['error']){if(_0x3efaa6[_0x4249('0xf')]['code']===0x1f4){logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6['error'][_0x4249('0x10')]);return _0x21060d(_0x3efaa6[_0x4249('0xf')]['message']);}logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);return _0x2b7934(_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);}else{logger['info'](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));_0x2b7934(_0x3efaa6['result'][_0x4249('0x10')]);}})['catch'](function(_0x501e9c){logger['error'](_0x4249('0xb'),_0x5b1b17,_0x501e9c);_0x21060d(_0x501e9c);});});} \ No newline at end of file +var _0x984b=['Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x525c53,_0x2dd690){var _0x3eebd7=function(_0x2387e8){while(--_0x2387e8){_0x525c53['push'](_0x525c53['shift']());}};_0x3eebd7(++_0x2dd690);}(_0x984b,0xee));var _0xb984=function(_0x1901a6,_0x5dbf49){_0x1901a6=_0x1901a6-0x0;var _0x21ddd9=_0x984b[_0x1901a6];return _0x21ddd9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 249661e..4738af1 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 95f0230..3021ef0 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 _0xe706=['STRING','sequelize','exports'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe706,0xa3));var _0x6e70=function(_0x13eca7,_0x29b30d){_0x13eca7=_0x13eca7-0x0;var _0x1abd34=_0xe706[_0x13eca7];return _0x1abd34;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x46d662,_0x283a45){var _0x1221da=function(_0x58a72c){while(--_0x58a72c){_0x46d662['push'](_0x46d662['shift']());}};_0x1221da(++_0x283a45);}(_0xb10b,0x12a));var _0xbb10=function(_0xa522f,_0x5debbc){_0xa522f=_0xa522f-0x0;var _0x2083b0=_0xb10b[_0xa522f];return _0x2083b0;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index de47c90..6cd2106 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 _0xd2f0=['./team.socket','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','keys','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','userProfileId','autoAssociation','UserProfileResource','params','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','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','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','isValidChannel','channel','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','ValidationError','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','emit','User','findAll','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','isArray','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis'];(function(_0x316c2d,_0x2e7d2f){var _0x169444=function(_0x49a593){while(--_0x49a593){_0x316c2d['push'](_0x316c2d['shift']());}};_0x169444(++_0x2e7d2f);}(_0xd2f0,0x7f));var _0x0d2f=function(_0x5f182f,_0xf29320){_0x5f182f=_0x5f182f-0x0;var _0x5cda1f=_0xd2f0[_0x5f182f];return _0x5cda1f;};'use strict';var emlformat=require(_0x0d2f('0x0'));var rimraf=require(_0x0d2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d2f('0x2'));var moment=require(_0x0d2f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0d2f('0x4'));var util=require(_0x0d2f('0x5'));var path=require(_0x0d2f('0x6'));var sox=require(_0x0d2f('0x7'));var csv=require(_0x0d2f('0x8'));var ejs=require(_0x0d2f('0x9'));var fs=require('fs');var fs_extra=require(_0x0d2f('0xa'));var _=require(_0x0d2f('0xb'));var squel=require(_0x0d2f('0xc'));var crypto=require('crypto');var jsforce=require(_0x0d2f('0xd'));var deskjs=require(_0x0d2f('0xe'));var toCsv=require(_0x0d2f('0x8'));var querystring=require(_0x0d2f('0xf'));var Papa=require(_0x0d2f('0x10'));var Redis=require(_0x0d2f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d2f('0x12'));var as=require(_0x0d2f('0x13'));var hardwareService=require(_0x0d2f('0x14'));var logger=require(_0x0d2f('0x15'))(_0x0d2f('0x16'));var utils=require(_0x0d2f('0x17'));var config=require(_0x0d2f('0x18'));var licenseUtil=require(_0x0d2f('0x19'));var db=require(_0x0d2f('0x1a'))['db'];config['redis']=_[_0x0d2f('0x1b')](config['redis'],{'host':_0x0d2f('0x1c'),'port':0x18eb});var socket=require(_0x0d2f('0x1d'))(new Redis(config[_0x0d2f('0x1e')]));require(_0x0d2f('0x1f'))['register'](socket);function respondWithStatusCode(_0x1c007d,_0x511e2a){_0x511e2a=_0x511e2a||0xcc;return function(_0x68fca5){if(_0x68fca5){return _0x1c007d[_0x0d2f('0x20')](_0x511e2a);}return _0x1c007d['status'](_0x511e2a)['end']();};}function respondWithResult(_0x25ff0d,_0x2d09e4){_0x2d09e4=_0x2d09e4||0xc8;return function(_0x283102){if(_0x283102){return _0x25ff0d[_0x0d2f('0x21')](_0x2d09e4)[_0x0d2f('0x22')](_0x283102);}};}function respondWithFilteredResult(_0x2bea72,_0x3c8e7a){return function(_0x4b438c){if(_0x4b438c){var _0x341534=typeof _0x3c8e7a[_0x0d2f('0x23')]==='undefined'&&typeof _0x3c8e7a[_0x0d2f('0x24')]===_0x0d2f('0x25');var _0x109c79=_0x4b438c[_0x0d2f('0x26')];var _0x33aab9=_0x341534?0x0:_0x3c8e7a[_0x0d2f('0x23')];var _0x54e869=_0x341534?_0x4b438c[_0x0d2f('0x26')]:_0x3c8e7a[_0x0d2f('0x23')]+_0x3c8e7a['limit'];var _0x4c8ec9;if(_0x54e869>=_0x109c79){_0x54e869=_0x109c79;_0x4c8ec9=0xc8;}else{_0x4c8ec9=0xce;}_0x2bea72[_0x0d2f('0x21')](_0x4c8ec9);return _0x2bea72[_0x0d2f('0x27')](_0x0d2f('0x28'),_0x33aab9+'-'+_0x54e869+'/'+_0x109c79)['json'](_0x4b438c);}return null;};}function patchUpdates(_0x13b558){return function(_0x480b31){try{jsonpatch['apply'](_0x480b31,_0x13b558,!![]);}catch(_0x1b36cc){return BPromise[_0x0d2f('0x29')](_0x1b36cc);}return _0x480b31[_0x0d2f('0x2a')]();};}function saveUpdates(_0x506a85,_0xaab28b){return function(_0x3e0094){if(_0x3e0094){return _0x3e0094[_0x0d2f('0x2b')](_0x506a85)[_0x0d2f('0x2c')](function(_0x3b0168){return _0x3b0168;});}return null;};}function handleEntityNotFound(_0x58858d,_0x1c0c2b){return function(_0x4a7d59){if(!_0x4a7d59){_0x58858d[_0x0d2f('0x20')](0x194);}return _0x4a7d59;};}function handleError(_0xa69c7d,_0x3acd06){_0x3acd06=_0x3acd06||0x1f4;return function(_0x19fc13){logger[_0x0d2f('0x2d')](_0x19fc13[_0x0d2f('0x2e')]);if(_0x19fc13['name']){delete _0x19fc13[_0x0d2f('0x2f')];}_0xa69c7d['status'](_0x3acd06)[_0x0d2f('0x30')](_0x19fc13);};}exports[_0x0d2f('0x31')]=function(_0x259713,_0x30ebf7){var _0x2e2227={},_0x475119={},_0x5cfacf={'count':0x0,'rows':[]};var _0x1ad251=_[_0x0d2f('0x32')](db[_0x0d2f('0x33')][_0x0d2f('0x34')],function(_0x2338cd){return{'name':_0x2338cd[_0x0d2f('0x35')],'type':_0x2338cd[_0x0d2f('0x36')]['key']};});_0x475119[_0x0d2f('0x37')]=_[_0x0d2f('0x32')](_0x1ad251,'name');_0x475119[_0x0d2f('0x38')]=_['keys'](_0x259713[_0x0d2f('0x38')]);_0x475119[_0x0d2f('0x39')]=_['intersection'](_0x475119['model'],_0x475119['query']);_0x2e2227['attributes']=_['intersection'](_0x475119[_0x0d2f('0x37')],qs[_0x0d2f('0x3a')](_0x259713[_0x0d2f('0x38')][_0x0d2f('0x3a')]));_0x2e2227[_0x0d2f('0x3b')]=_0x2e2227[_0x0d2f('0x3b')][_0x0d2f('0x3c')]?_0x2e2227[_0x0d2f('0x3b')]:_0x475119[_0x0d2f('0x37')];if(!_0x259713[_0x0d2f('0x38')][_0x0d2f('0x3d')](_0x0d2f('0x3e'))){_0x2e2227[_0x0d2f('0x24')]=qs[_0x0d2f('0x24')](_0x259713['query']['limit']);_0x2e2227[_0x0d2f('0x23')]=qs[_0x0d2f('0x23')](_0x259713[_0x0d2f('0x38')][_0x0d2f('0x23')]);}_0x2e2227[_0x0d2f('0x3f')]=qs[_0x0d2f('0x40')](_0x259713[_0x0d2f('0x38')]['sort']);_0x2e2227['where']=qs['filters'](_[_0x0d2f('0x41')](_0x259713[_0x0d2f('0x38')],_0x475119[_0x0d2f('0x39')]),_0x1ad251);if(_0x259713[_0x0d2f('0x38')][_0x0d2f('0x42')]){_0x2e2227[_0x0d2f('0x43')]=_[_0x0d2f('0x44')](_0x2e2227[_0x0d2f('0x43')],{'$or':_[_0x0d2f('0x32')](_0x1ad251,function(_0x336e3f){if(_0x336e3f[_0x0d2f('0x36')]!=='VIRTUAL'){var _0x29dcaf={};_0x29dcaf[_0x336e3f[_0x0d2f('0x2f')]]={'$like':'%'+_0x259713['query']['filter']+'%'};return _0x29dcaf;}})});}_0x2e2227=_['merge']({},_0x2e2227,_0x259713[_0x0d2f('0x45')]);var _0x33f43c={'where':_0x2e2227[_0x0d2f('0x43')]};return db[_0x0d2f('0x33')][_0x0d2f('0x26')](_0x33f43c)['then'](function(_0xebb2c4){_0x5cfacf['count']=_0xebb2c4;if(_0x259713[_0x0d2f('0x38')][_0x0d2f('0x46')]){_0x2e2227[_0x0d2f('0x47')]=[{'all':!![]}];}return db['Team']['findAll'](_0x2e2227);})[_0x0d2f('0x2c')](function(_0x378e0c){_0x5cfacf[_0x0d2f('0x48')]=_0x378e0c;return _0x5cfacf;})[_0x0d2f('0x2c')](respondWithFilteredResult(_0x30ebf7,_0x2e2227))[_0x0d2f('0x49')](handleError(_0x30ebf7,null));};exports['show']=function(_0x4b2c70,_0x1e0a50){var _0x1cd6b7={'raw':![],'where':{'id':_0x4b2c70['params']['id']}},_0x5f3297={};_0x5f3297[_0x0d2f('0x37')]=_['keys'](db[_0x0d2f('0x33')][_0x0d2f('0x34')]);_0x5f3297[_0x0d2f('0x38')]=_[_0x0d2f('0x4a')](_0x4b2c70[_0x0d2f('0x38')]);_0x5f3297[_0x0d2f('0x39')]=_[_0x0d2f('0x4b')](_0x5f3297[_0x0d2f('0x37')],_0x5f3297[_0x0d2f('0x38')]);_0x1cd6b7[_0x0d2f('0x3b')]=_[_0x0d2f('0x4b')](_0x5f3297[_0x0d2f('0x37')],qs[_0x0d2f('0x3a')](_0x4b2c70[_0x0d2f('0x38')][_0x0d2f('0x3a')]));_0x1cd6b7[_0x0d2f('0x3b')]=_0x1cd6b7[_0x0d2f('0x3b')][_0x0d2f('0x3c')]?_0x1cd6b7[_0x0d2f('0x3b')]:_0x5f3297[_0x0d2f('0x37')];if(_0x4b2c70[_0x0d2f('0x38')][_0x0d2f('0x46')]){_0x1cd6b7[_0x0d2f('0x47')]=[{'all':!![]}];}_0x1cd6b7=_[_0x0d2f('0x44')]({},_0x1cd6b7,_0x4b2c70[_0x0d2f('0x45')]);return db[_0x0d2f('0x33')][_0x0d2f('0x4c')](_0x1cd6b7)[_0x0d2f('0x2c')](handleEntityNotFound(_0x1e0a50,null))[_0x0d2f('0x2c')](respondWithResult(_0x1e0a50,null))[_0x0d2f('0x49')](handleError(_0x1e0a50,null));};exports[_0x0d2f('0x4d')]=function(_0x37cc93,_0x5c4f79){return db[_0x0d2f('0x33')][_0x0d2f('0x4d')](_0x37cc93[_0x0d2f('0x4e')],{})[_0x0d2f('0x2c')](function(_0xe982bd){var _0x13e5df=_0x37cc93['user'][_0x0d2f('0x4f')]({'plain':!![]});if(!_0x13e5df)throw new Error(_0x0d2f('0x50'));if(_0x13e5df[_0x0d2f('0x51')]===_0x0d2f('0x52')){var _0x59c4ca=_0xe982bd[_0x0d2f('0x4f')]({'plain':!![]});var _0xcdb9b7=_0x0d2f('0x53');return db['UserProfileSection'][_0x0d2f('0x4c')]({'where':{'name':_0xcdb9b7,'userProfileId':_0x13e5df[_0x0d2f('0x54')]},'raw':!![]})['then'](function(_0x20c8d7){if(_0x20c8d7&&_0x20c8d7[_0x0d2f('0x55')]===0x0){return db[_0x0d2f('0x56')][_0x0d2f('0x4d')]({'name':_0x59c4ca[_0x0d2f('0x2f')],'resourceId':_0x59c4ca['id'],'type':_0x20c8d7[_0x0d2f('0x2f')],'sectionId':_0x20c8d7['id']},{})[_0x0d2f('0x2c')](function(){return _0xe982bd;});}else{return _0xe982bd;}})[_0x0d2f('0x49')](function(_0xcd1ac4){logger[_0x0d2f('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcd1ac4);throw _0xcd1ac4;});}return _0xe982bd;})[_0x0d2f('0x2c')](respondWithResult(_0x5c4f79,0xc9))[_0x0d2f('0x49')](handleError(_0x5c4f79,null));};exports['update']=function(_0x316d93,_0x51e0ed){if(_0x316d93[_0x0d2f('0x4e')]['id']){delete _0x316d93[_0x0d2f('0x4e')]['id'];}return db[_0x0d2f('0x33')]['find']({'where':{'id':_0x316d93[_0x0d2f('0x57')]['id']}})['then'](handleEntityNotFound(_0x51e0ed,null))[_0x0d2f('0x2c')](saveUpdates(_0x316d93[_0x0d2f('0x4e')],null))[_0x0d2f('0x2c')](respondWithResult(_0x51e0ed,null))[_0x0d2f('0x49')](handleError(_0x51e0ed,null));};exports['destroy']=function(_0x22f990,_0x170558){var _0x3cd220=_0x22f990[_0x0d2f('0x57')]['id'];var _0x1c680b=[];return db['sequelize']['transaction'](function(_0xae4605){var _0x3926bf=_0x0d2f('0x58')+_0x3cd220;return db[_0x0d2f('0x59')]['query'](_0x3926bf,{'type':db[_0x0d2f('0x5a')][_0x0d2f('0x5b')]['SELECT'],'raw':!![],'transaction':_0xae4605})[_0x0d2f('0x2c')](function(_0x4d8866){_0x1c680b=_[_0x0d2f('0x32')](_0x4d8866,function(_0x3f0d7e){return Number(_0x3f0d7e[_0x0d2f('0x5c')]);});})[_0x0d2f('0x2c')](function(){var _0x739e21=_0x0d2f('0x5d')+_0x3cd220;return db['sequelize'][_0x0d2f('0x38')](_0x739e21,{'type':db[_0x0d2f('0x5a')]['QueryTypes'][_0x0d2f('0x5e')],'raw':!![],'transaction':_0xae4605});})['then'](function(_0x865e31){var _0x124635=_[_0x0d2f('0x32')](_0x865e31,function(_0x16bc58){return Number(_0x16bc58[_0x0d2f('0x5f')]);});return db[_0x0d2f('0x60')][_0x0d2f('0x61')]({'where':{'UserId':{'$in':_0x1c680b},'VoiceQueueId':{'$in':_0x124635}},'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(){var _0x3951bb=_0x0d2f('0x62')+_0x3cd220;return db[_0x0d2f('0x59')]['query'](_0x3951bb,{'type':db['Sequelize'][_0x0d2f('0x5b')][_0x0d2f('0x5e')],'raw':!![],'transaction':_0xae4605});})['then'](function(_0x33ed8e){var _0x299239=_[_0x0d2f('0x32')](_0x33ed8e,function(_0x3af7e3){return Number(_0x3af7e3[_0x0d2f('0x63')]);});return db[_0x0d2f('0x64')][_0x0d2f('0x61')]({'where':{'UserId':{'$in':_0x1c680b},'MailQueueId':{'$in':_0x299239}},'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(){var _0x42825c=_0x0d2f('0x65')+_0x3cd220;return db[_0x0d2f('0x59')][_0x0d2f('0x38')](_0x42825c,{'type':db['Sequelize'][_0x0d2f('0x5b')][_0x0d2f('0x5e')],'raw':!![],'transaction':_0xae4605});})['then'](function(_0x1b6a9b){var _0x33b915=_[_0x0d2f('0x32')](_0x1b6a9b,function(_0x23a8b7){return Number(_0x23a8b7[_0x0d2f('0x66')]);});return db['UserSmsQueue'][_0x0d2f('0x61')]({'where':{'UserId':{'$in':_0x1c680b},'SmsQueueId':{'$in':_0x33b915}},'transaction':_0xae4605});})['then'](function(){var _0x539499=_0x0d2f('0x67')+_0x3cd220;return db[_0x0d2f('0x59')][_0x0d2f('0x38')](_0x539499,{'type':db[_0x0d2f('0x5a')][_0x0d2f('0x5b')][_0x0d2f('0x5e')],'raw':!![],'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(_0x1fe393){var _0x3e125e=_[_0x0d2f('0x32')](_0x1fe393,function(_0x236ee1){return Number(_0x236ee1[_0x0d2f('0x68')]);});return db[_0x0d2f('0x69')][_0x0d2f('0x61')]({'where':{'UserId':{'$in':_0x1c680b},'ChatQueueId':{'$in':_0x3e125e}},'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(){var _0xe9027='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3cd220;return db['sequelize'][_0x0d2f('0x38')](_0xe9027,{'type':db[_0x0d2f('0x5a')]['QueryTypes'][_0x0d2f('0x5e')],'raw':!![],'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(_0x3471c1){var _0x3b6de6=_['map'](_0x3471c1,function(_0x48c650){return Number(_0x48c650[_0x0d2f('0x6a')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x1c680b},'FaxQueueId':{'$in':_0x3b6de6}},'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(){var _0x40c71f=_0x0d2f('0x6b')+_0x3cd220;return db['sequelize']['query'](_0x40c71f,{'type':db[_0x0d2f('0x5a')][_0x0d2f('0x5b')][_0x0d2f('0x5e')],'raw':!![],'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(_0x1db7c2){var _0x143405=_[_0x0d2f('0x32')](_0x1db7c2,function(_0x3fe848){return Number(_0x3fe848['OpenchannelQueueId']);});return db[_0x0d2f('0x6c')][_0x0d2f('0x61')]({'where':{'UserId':{'$in':_0x1c680b},'OpenchannelQueueId':{'$in':_0x143405}},'transaction':_0xae4605});})['then'](function(){var _0x586868=_0x0d2f('0x6d')+_0x3cd220;return db[_0x0d2f('0x59')]['query'](_0x586868,{'type':db['Sequelize'][_0x0d2f('0x5b')][_0x0d2f('0x5e')],'raw':!![],'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(_0x41c715){var _0x2adf9a=_[_0x0d2f('0x32')](_0x41c715,function(_0x4fc03a){return Number(_0x4fc03a[_0x0d2f('0x6e')]);});return db['UserWhatsappQueue'][_0x0d2f('0x61')]({'where':{'UserId':{'$in':_0x1c680b},'WhatsappQueueId':{'$in':_0x2adf9a}},'transaction':_0xae4605});})['then'](function(){return db['TeamVoicePrefix'][_0x0d2f('0x4c')]({'where':{'TeamId':_0x3cd220}});})[_0x0d2f('0x2c')](function(_0x21ab7e){if(_0x21ab7e===null){return;}return db[_0x0d2f('0x6f')][_0x0d2f('0x61')]({'where':{'UserId':{'$in':_0x1c680b},'VoicePrefixId':_0x21ab7e[_0x0d2f('0x70')]},'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(){return db[_0x0d2f('0x33')][_0x0d2f('0x61')]({'where':{'id':_0x3cd220},'cascade':!![],'transaction':_0xae4605});})[_0x0d2f('0x2c')](function(_0x3f2d67){if(_0x3f2d67===0x0){_0x170558[_0x0d2f('0x20')](0x194);}else{return db[_0x0d2f('0x56')][_0x0d2f('0x61')]({'where':{'type':_0x0d2f('0x53'),'resourceId':_0x3cd220},'cascade':!![],'transaction':_0xae4605})['then'](function(){_0x170558[_0x0d2f('0x21')](0xcc)[_0x0d2f('0x71')]();});}})['catch'](function(_0x3b2143){_0x170558['status'](0x1f4)[_0x0d2f('0x30')](_0x3b2143);});});};exports[_0x0d2f('0x72')]=function(_0x354c5e,_0x209f1b,_0x5aa431){return db['Team'][_0x0d2f('0x73')]({'where':{'id':_0x354c5e[_0x0d2f('0x57')]['id']}})[_0x0d2f('0x2c')](handleEntityNotFound(_0x209f1b,null))[_0x0d2f('0x2c')](function(_0x5c08da){if(!_0x354c5e[_0x0d2f('0x38')]['channel']||!utils[_0x0d2f('0x74')](_0x354c5e[_0x0d2f('0x38')][_0x0d2f('0x75')])){throw new db[(_0x0d2f('0x5a'))]['ValidationError'](_0x0d2f('0x76'));}var _0x3cc346={};var _0x1cdf3f={};_0x1cdf3f[_0x0d2f('0x37')]=_[_0x0d2f('0x4a')](db[_[_0x0d2f('0x77')](_0x354c5e['query'][_0x0d2f('0x75')]['toLowerCase']())+_0x0d2f('0x78')]['rawAttributes']);_0x1cdf3f[_0x0d2f('0x38')]=_[_0x0d2f('0x4a')](_0x354c5e[_0x0d2f('0x38')]);_0x1cdf3f[_0x0d2f('0x39')]=_[_0x0d2f('0x4b')](_0x1cdf3f['model'],_0x1cdf3f[_0x0d2f('0x38')]);_0x3cc346[_0x0d2f('0x3b')]=_[_0x0d2f('0x4b')](_0x1cdf3f[_0x0d2f('0x37')],qs['fields'](_0x354c5e[_0x0d2f('0x38')][_0x0d2f('0x3a')]));_0x3cc346[_0x0d2f('0x3b')]=_0x3cc346[_0x0d2f('0x3b')]['length']?_0x3cc346['attributes']:_0x1cdf3f[_0x0d2f('0x37')];_0x3cc346[_0x0d2f('0x24')]=qs['limit'](_0x354c5e['query'][_0x0d2f('0x24')]);_0x3cc346['offset']=qs[_0x0d2f('0x23')](_0x354c5e[_0x0d2f('0x38')][_0x0d2f('0x23')]);_0x3cc346[_0x0d2f('0x3f')]=qs[_0x0d2f('0x40')](_0x354c5e[_0x0d2f('0x38')][_0x0d2f('0x40')]);_0x3cc346[_0x0d2f('0x43')]=qs['filters'](_['pick'](_0x354c5e[_0x0d2f('0x38')],_0x1cdf3f[_0x0d2f('0x39')]));_0x3cc346=_[_0x0d2f('0x44')]({},_0x3cc346,_0x354c5e[_0x0d2f('0x45')]);return _0x5c08da[_0x0d2f('0x4f')+_['capitalize'](_0x354c5e['query']['channel'][_0x0d2f('0x79')]())+_0x0d2f('0x7a')](_0x3cc346);})[_0x0d2f('0x2c')](respondWithResult(_0x209f1b,null))[_0x0d2f('0x49')](handleError(_0x209f1b,null));};exports[_0x0d2f('0x7b')]=function(_0xffc171,_0x2a0f0c,_0xf9ac84){return db[_0x0d2f('0x33')][_0x0d2f('0x73')]({'where':{'id':_0xffc171['params']['id']}})['then'](function(_0x413639){if(_0x413639){if(!_0xffc171[_0x0d2f('0x4e')]['channel']||!utils['isValidChannel'](_0xffc171[_0x0d2f('0x4e')][_0x0d2f('0x75')])){throw new db['Sequelize'][(_0x0d2f('0x7c'))](_0x0d2f('0x76'));}return _0x413639[_0x0d2f('0x7d')+_[_0x0d2f('0x77')](_0xffc171['body'][_0x0d2f('0x75')][_0x0d2f('0x79')]())+'Queues'](_0xffc171['body'][_0x0d2f('0x7e')]);}return null;})[_0x0d2f('0x2c')](handleEntityNotFound(_0x2a0f0c,null))['then'](respondWithStatusCode(_0x2a0f0c,null))[_0x0d2f('0x49')](handleError(_0x2a0f0c,null));};exports[_0x0d2f('0x7f')]=function(_0xbf9fc8,_0x2e0371,_0x2bd75f){return db[_0x0d2f('0x33')][_0x0d2f('0x73')]({'where':{'id':_0xbf9fc8['params']['id']}})['then'](function(_0x41f6a0){if(_0x41f6a0){if(!_0xbf9fc8[_0x0d2f('0x38')]['channel']||!utils['isValidChannel'](_0xbf9fc8['query'][_0x0d2f('0x75')])){throw new db[(_0x0d2f('0x5a'))][(_0x0d2f('0x7c'))](_0x0d2f('0x76'));}return _0x41f6a0[_0x0d2f('0x80')+_['capitalize'](_0xbf9fc8[_0x0d2f('0x38')][_0x0d2f('0x75')]['toLowerCase']())+_0x0d2f('0x7a')](_0xbf9fc8['query'][_0x0d2f('0x7e')]);}return null;})[_0x0d2f('0x2c')](handleEntityNotFound(_0x2e0371,null))['then'](respondWithStatusCode(_0x2e0371,null))[_0x0d2f('0x49')](handleError(_0x2e0371,null));};exports[_0x0d2f('0x81')]=function(_0x57ea83,_0xdd06bb){var _0x2f9eaa=_['isArray'](_0x57ea83[_0x0d2f('0x4e')][_0x0d2f('0x7e')])?_0x57ea83[_0x0d2f('0x4e')][_0x0d2f('0x7e')]:[_0x57ea83['body']['ids']];var _0x2c1114=_0x57ea83['params']['id'];return db[_0x0d2f('0x33')][_0x0d2f('0x4c')]({'where':{'id':_0x2c1114}})[_0x0d2f('0x2c')](handleEntityNotFound(_0xdd06bb,null))[_0x0d2f('0x2c')](function(_0x4835cf){if(_0x4835cf){var _0x396512=[_0x0d2f('0x82'),_0x0d2f('0x83'),_0x0d2f('0x84'),_0x0d2f('0x85'),_0x0d2f('0x86'),_0x0d2f('0x87'),_0x0d2f('0x88')];return db[_0x0d2f('0x59')][_0x0d2f('0x89')](function(_0x2897ab){var _0x6934bd=_[_0x0d2f('0x32')](_0x396512,function(_0x379a1c){var _0x5318e8={'attributes':['id','name']};if(_0x379a1c===_0x0d2f('0x82')){_0x5318e8[_0x0d2f('0x8a')]={'attributes':[_0x0d2f('0x8b')]};}return _0x4835cf['get'+_0x379a1c+_0x0d2f('0x7a')](_0x5318e8)[_0x0d2f('0x2c')](function(_0x38f0a5){var _0x105e04=_['map'](_0x38f0a5,function(_0x516bc2){var _0x4ece81=_[_0x0d2f('0x32')](_0x2f9eaa,function(_0xb2fb08){var _0x6b7cfd={'where':{'UserId':_0xb2fb08,[_0x379a1c+_0x0d2f('0x8c')]:_0x516bc2['id']},'transaction':_0x2897ab};if(_0x379a1c===_0x0d2f('0x82')){_0x6b7cfd['defaults']={'penalty':_0x516bc2['TeamVoiceQueue'][_0x0d2f('0x8b')]};}return db['User'+_0x379a1c+_0x0d2f('0x78')]['findOrCreate'](_0x6b7cfd)['then'](function(){socket[_0x0d2f('0x8d')](_0x0d2f('0x52')+_0x379a1c+'Queue:save',{'UserId':_0xb2fb08,[_0x379a1c+_0x0d2f('0x8c')]:_0x516bc2['id']});if(_0x379a1c!==_0x0d2f('0x82')){return;}return db[_0x0d2f('0x8e')][_0x0d2f('0x8f')]({'where':{'id':_0x2f9eaa,'online':0x1},'attributes':['id',_0x0d2f('0x2f'),'online',_0x0d2f('0x90'),_0x0d2f('0x91')],'raw':!![]})['then'](function(_0x29692f){var _0x20a9bd=_[_0x0d2f('0x32')](_0x29692f,function(_0x85c045){return db[_0x0d2f('0x92')][_0x0d2f('0x93')]({'membername':_0x85c045[_0x0d2f('0x2f')],'UserId':_0x85c045['id'],'queue_name':_0x516bc2[_0x0d2f('0x2f')],'VoiceQueueId':_0x516bc2['id'],'interface':_[_0x0d2f('0x94')](_0x85c045[_0x0d2f('0x91')])?util[_0x0d2f('0x95')](_0x0d2f('0x96'),_0x85c045[_0x0d2f('0x2f')]):_0x85c045[_0x0d2f('0x91')],'paused':_0x85c045[_0x0d2f('0x90')]||![],'penalty':_0x516bc2[_0x0d2f('0x97')][_0x0d2f('0x8b')]},{'transaction':_0x2897ab});});return Promise[_0x0d2f('0x98')](_0x20a9bd);});});});return Promise['all'](_0x4ece81);});return Promise[_0x0d2f('0x98')](_0x105e04);})[_0x0d2f('0x2c')](function(){return db[_0x0d2f('0x99')]['findOne']({'where':{'teamId':_0x2c1114}})[_0x0d2f('0x2c')](function(_0x52790f){if(_0x52790f){var _0x3b3641=_[_0x0d2f('0x32')](_0x2f9eaa,function(_0x401852){db['UserVoicePrefix']['upsert']({'UserId':_0x401852,'VoicePrefixId':_0x52790f[_0x0d2f('0x70')]});});return Promise[_0x0d2f('0x98')](_0x3b3641);}});});});return Promise[_0x0d2f('0x98')](_0x6934bd)[_0x0d2f('0x2c')](function(){return _0x4835cf[_0x0d2f('0x81')](_0x2f9eaa,{'transaction':_0x2897ab})[_0x0d2f('0x9a')](function(_0x15d285){return _0x15d285;});});});}})[_0x0d2f('0x2c')](respondWithResult(_0xdd06bb,null))[_0x0d2f('0x49')](handleError(_0xdd06bb,null));};exports[_0x0d2f('0x9b')]=function(_0x234f60,_0x143d96){var _0x2be70=_[_0x0d2f('0x9c')](_0x234f60[_0x0d2f('0x38')][_0x0d2f('0x7e')])?_0x234f60[_0x0d2f('0x38')]['ids']:[_0x234f60['query'][_0x0d2f('0x7e')]];var _0x5eb1c7=_0x234f60[_0x0d2f('0x57')]['id'];return db[_0x0d2f('0x33')][_0x0d2f('0x4c')]({'where':{'id':_0x5eb1c7}})[_0x0d2f('0x2c')](handleEntityNotFound(_0x143d96,null))[_0x0d2f('0x2c')](function(_0x2e4dab){if(_0x2e4dab){var _0x20fc5a=[_0x0d2f('0x82'),'Chat','Mail',_0x0d2f('0x85'),_0x0d2f('0x86'),_0x0d2f('0x87'),_0x0d2f('0x88')];return db[_0x0d2f('0x59')][_0x0d2f('0x89')](function(_0xe69577){var _0x2edc61=_[_0x0d2f('0x32')](_0x20fc5a,function(_0x3463cc){var _0x4b3d1c={'attributes':['id',_0x0d2f('0x2f')]};return _0x2e4dab[_0x0d2f('0x4f')+_0x3463cc+'Queues'](_0x4b3d1c)[_0x0d2f('0x2c')](function(_0x3ab5de){var _0x313ef8=_['map'](_0x3ab5de,function(_0x4aa657){return _0x4aa657[_0x0d2f('0x9b')](_0x2be70,{'transaction':_0xe69577})[_0x0d2f('0x2c')](function(){var _0x47f321=_[_0x0d2f('0x32')](_0x2be70,function(_0x117b20){socket[_0x0d2f('0x8d')](_0x0d2f('0x52')+_0x3463cc+'Queue:remove',{'UserId':Number(_0x117b20),[_0x3463cc+_0x0d2f('0x8c')]:_0x4aa657['id']});if(_0x3463cc!=='Voice'){return;}return db[_0x0d2f('0x92')][_0x0d2f('0x61')]({'where':{'VoiceQueueId':_0x4aa657['id'],'UserId':_0x117b20},'transaction':_0xe69577});});return Promise[_0x0d2f('0x98')](_0x47f321);});});return Promise[_0x0d2f('0x98')](_0x313ef8);});});return Promise[_0x0d2f('0x98')](_0x2edc61)[_0x0d2f('0x2c')](function(){return _0x2e4dab[_0x0d2f('0x9b')](_0x2be70,{'transaction':_0xe69577});})[_0x0d2f('0x2c')](function(){return db[_0x0d2f('0x99')]['findOne']({'where':{'teamId':_0x5eb1c7}})[_0x0d2f('0x2c')](function(_0x59f672){if(_0x59f672){var _0x14c92d=_['map'](_0x2be70,function(_0x365d73){db[_0x0d2f('0x6f')][_0x0d2f('0x61')]({'where':{'UserId':_0x365d73,'VoicePrefixId':_0x59f672[_0x0d2f('0x70')]}});});return Promise[_0x0d2f('0x98')](_0x14c92d);}});});});}})[_0x0d2f('0x2c')](respondWithStatusCode(_0x143d96,null))[_0x0d2f('0x49')](handleError(_0x143d96,null));};exports['getAgents']=function(_0xeca60d,_0x1629a1,_0x2225fe){var _0xf6706b={};var _0x42991d={};var _0x106bfc;var _0xd07f66;return db[_0x0d2f('0x33')]['findOne']({'where':{'id':_0xeca60d['params']['id']}})[_0x0d2f('0x2c')](handleEntityNotFound(_0x1629a1,null))[_0x0d2f('0x2c')](function(_0x2fe4e3){if(_0x2fe4e3){_0x106bfc=_0x2fe4e3;_0x42991d[_0x0d2f('0x37')]=_['keys'](db[_0x0d2f('0x8e')][_0x0d2f('0x34')]);_0x42991d['query']=_[_0x0d2f('0x4a')](_0xeca60d[_0x0d2f('0x38')]);_0x42991d[_0x0d2f('0x39')]=_[_0x0d2f('0x4b')](_0x42991d[_0x0d2f('0x37')],_0x42991d[_0x0d2f('0x38')]);_0xf6706b[_0x0d2f('0x3b')]=_[_0x0d2f('0x4b')](_0x42991d['model'],qs['fields'](_0xeca60d[_0x0d2f('0x38')][_0x0d2f('0x3a')]));_0xf6706b[_0x0d2f('0x3b')]=_0xf6706b[_0x0d2f('0x3b')]['length']?_0xf6706b['attributes']:_0x42991d[_0x0d2f('0x37')];_0xf6706b['order']=qs[_0x0d2f('0x40')](_0xeca60d[_0x0d2f('0x38')][_0x0d2f('0x40')]);_0xf6706b[_0x0d2f('0x43')]=qs[_0x0d2f('0x39')](_[_0x0d2f('0x41')](_0xeca60d[_0x0d2f('0x38')],_0x42991d[_0x0d2f('0x39')]));if(_0xeca60d[_0x0d2f('0x38')][_0x0d2f('0x42')]){_0xf6706b[_0x0d2f('0x43')]=_[_0x0d2f('0x44')](_0xf6706b[_0x0d2f('0x43')],{'$or':_[_0x0d2f('0x32')](_0xf6706b[_0x0d2f('0x3b')],function(_0x4390e7){var _0x238826={};_0x238826[_0x4390e7]={'$like':'%'+_0xeca60d[_0x0d2f('0x38')]['filter']+'%'};return _0x238826;})});}_0xf6706b=_[_0x0d2f('0x44')]({},_0xf6706b,_0xeca60d[_0x0d2f('0x45')]);return _0x106bfc[_0x0d2f('0x9d')](_0xf6706b);}})[_0x0d2f('0x2c')](function(_0x349b54){if(_0x349b54){_0xd07f66=_0x349b54[_0x0d2f('0x3c')];if(!_0xeca60d['query'][_0x0d2f('0x3d')](_0x0d2f('0x3e'))){_0xf6706b[_0x0d2f('0x24')]=qs['limit'](_0xeca60d[_0x0d2f('0x38')][_0x0d2f('0x24')]);_0xf6706b['offset']=qs[_0x0d2f('0x23')](_0xeca60d[_0x0d2f('0x38')][_0x0d2f('0x23')]);}return _0x106bfc[_0x0d2f('0x9d')](_0xf6706b);}})[_0x0d2f('0x2c')](function(_0xa366b8){if(_0xa366b8){return _0xa366b8?{'count':_0xd07f66,'rows':_0xa366b8}:null;}})[_0x0d2f('0x2c')](respondWithResult(_0x1629a1,null))[_0x0d2f('0x49')](handleError(_0x1629a1,null));}; \ No newline at end of file +var _0xb61f=['through','penalty','QueueId','defaults','TeamVoiceQueue','emit','User','online','voicePause','UserVoiceQueueRt','upsert','interface','format','SIP/%s','all','spread','removeAgents','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','name','send','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','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','UserVoicePrefix','VoicePrefixId','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','ids','remove','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp'];(function(_0xcf8fc7,_0x2a9c7c){var _0x790043=function(_0x39ee9d){while(--_0x39ee9d){_0xcf8fc7['push'](_0xcf8fc7['shift']());}};_0x790043(++_0x2a9c7c);}(_0xb61f,0x1c9));var _0xfb61=function(_0x3822e0,_0x37ceee){_0x3822e0=_0x3822e0-0x0;var _0x4673a9=_0xb61f[_0x3822e0];return _0x4673a9;};'use strict';var emlformat=require(_0xfb61('0x0'));var rimraf=require(_0xfb61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb61('0x2'));var rp=require(_0xfb61('0x3'));var moment=require('moment');var BPromise=require(_0xfb61('0x4'));var Mustache=require('mustache');var util=require(_0xfb61('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfb61('0x6'));var ejs=require(_0xfb61('0x7'));var fs=require('fs');var fs_extra=require(_0xfb61('0x8'));var _=require(_0xfb61('0x9'));var squel=require(_0xfb61('0xa'));var crypto=require(_0xfb61('0xb'));var jsforce=require(_0xfb61('0xc'));var deskjs=require(_0xfb61('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb61('0xe'));var Papa=require('papaparse');var Redis=require(_0xfb61('0xf'));var authService=require(_0xfb61('0x10'));var qs=require(_0xfb61('0x11'));var as=require(_0xfb61('0x12'));var hardwareService=require(_0xfb61('0x13'));var logger=require(_0xfb61('0x14'))('api');var utils=require(_0xfb61('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xfb61('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb61('0x16')]));require(_0xfb61('0x17'))[_0xfb61('0x18')](socket);function respondWithStatusCode(_0x1e8b64,_0xd135f1){_0xd135f1=_0xd135f1||0xcc;return function(_0x4b0b49){if(_0x4b0b49){return _0x1e8b64[_0xfb61('0x19')](_0xd135f1);}return _0x1e8b64[_0xfb61('0x1a')](_0xd135f1)[_0xfb61('0x1b')]();};}function respondWithResult(_0x553a84,_0x2857b5){_0x2857b5=_0x2857b5||0xc8;return function(_0x5f1efb){if(_0x5f1efb){return _0x553a84[_0xfb61('0x1a')](_0x2857b5)[_0xfb61('0x1c')](_0x5f1efb);}};}function respondWithFilteredResult(_0x191d07,_0x17f9c4){return function(_0x1746a2){if(_0x1746a2){var _0x58e20d=typeof _0x17f9c4['offset']===_0xfb61('0x1d')&&typeof _0x17f9c4[_0xfb61('0x1e')]===_0xfb61('0x1d');var _0x45b5c5=_0x1746a2[_0xfb61('0x1f')];var _0x1723b8=_0x58e20d?0x0:_0x17f9c4[_0xfb61('0x20')];var _0x47b0fe=_0x58e20d?_0x1746a2[_0xfb61('0x1f')]:_0x17f9c4['offset']+_0x17f9c4['limit'];var _0x59d39e;if(_0x47b0fe>=_0x45b5c5){_0x47b0fe=_0x45b5c5;_0x59d39e=0xc8;}else{_0x59d39e=0xce;}_0x191d07[_0xfb61('0x1a')](_0x59d39e);return _0x191d07[_0xfb61('0x21')](_0xfb61('0x22'),_0x1723b8+'-'+_0x47b0fe+'/'+_0x45b5c5)[_0xfb61('0x1c')](_0x1746a2);}return null;};}function patchUpdates(_0x2c15a4){return function(_0x49d42b){try{jsonpatch['apply'](_0x49d42b,_0x2c15a4,!![]);}catch(_0x521578){return BPromise[_0xfb61('0x23')](_0x521578);}return _0x49d42b[_0xfb61('0x24')]();};}function saveUpdates(_0x2c16ab,_0x281344){return function(_0x19a784){if(_0x19a784){return _0x19a784[_0xfb61('0x25')](_0x2c16ab)[_0xfb61('0x26')](function(_0x38104a){return _0x38104a;});}return null;};}function handleEntityNotFound(_0x7cf0f2,_0x484294){return function(_0x3d2e20){if(!_0x3d2e20){_0x7cf0f2[_0xfb61('0x19')](0x194);}return _0x3d2e20;};}function handleError(_0xc24d73,_0x34cf3c){_0x34cf3c=_0x34cf3c||0x1f4;return function(_0x2340d0){logger[_0xfb61('0x27')](_0x2340d0['stack']);if(_0x2340d0[_0xfb61('0x28')]){delete _0x2340d0['name'];}_0xc24d73[_0xfb61('0x1a')](_0x34cf3c)[_0xfb61('0x29')](_0x2340d0);};}exports['index']=function(_0x5ed52b,_0x1041ea){var _0x54afde={},_0x5c0125={},_0x13f75f={'count':0x0,'rows':[]};var _0x308bff=_[_0xfb61('0x2a')](db[_0xfb61('0x2b')][_0xfb61('0x2c')],function(_0x48dabd){return{'name':_0x48dabd[_0xfb61('0x2d')],'type':_0x48dabd[_0xfb61('0x2e')][_0xfb61('0x2f')]};});_0x5c0125[_0xfb61('0x30')]=_[_0xfb61('0x2a')](_0x308bff,_0xfb61('0x28'));_0x5c0125[_0xfb61('0x31')]=_[_0xfb61('0x32')](_0x5ed52b['query']);_0x5c0125[_0xfb61('0x33')]=_[_0xfb61('0x34')](_0x5c0125[_0xfb61('0x30')],_0x5c0125[_0xfb61('0x31')]);_0x54afde[_0xfb61('0x35')]=_['intersection'](_0x5c0125[_0xfb61('0x30')],qs[_0xfb61('0x36')](_0x5ed52b[_0xfb61('0x31')][_0xfb61('0x36')]));_0x54afde[_0xfb61('0x35')]=_0x54afde['attributes'][_0xfb61('0x37')]?_0x54afde['attributes']:_0x5c0125[_0xfb61('0x30')];if(!_0x5ed52b['query'][_0xfb61('0x38')](_0xfb61('0x39'))){_0x54afde[_0xfb61('0x1e')]=qs[_0xfb61('0x1e')](_0x5ed52b['query'][_0xfb61('0x1e')]);_0x54afde['offset']=qs[_0xfb61('0x20')](_0x5ed52b[_0xfb61('0x31')]['offset']);}_0x54afde[_0xfb61('0x3a')]=qs[_0xfb61('0x3b')](_0x5ed52b[_0xfb61('0x31')][_0xfb61('0x3b')]);_0x54afde[_0xfb61('0x3c')]=qs['filters'](_[_0xfb61('0x3d')](_0x5ed52b['query'],_0x5c0125['filters']),_0x308bff);if(_0x5ed52b[_0xfb61('0x31')][_0xfb61('0x3e')]){_0x54afde[_0xfb61('0x3c')]=_['merge'](_0x54afde[_0xfb61('0x3c')],{'$or':_[_0xfb61('0x2a')](_0x308bff,function(_0x3ed90c){if(_0x3ed90c[_0xfb61('0x2e')]!=='VIRTUAL'){var _0x18e3b8={};_0x18e3b8[_0x3ed90c[_0xfb61('0x28')]]={'$like':'%'+_0x5ed52b[_0xfb61('0x31')][_0xfb61('0x3e')]+'%'};return _0x18e3b8;}})});}_0x54afde=_[_0xfb61('0x3f')]({},_0x54afde,_0x5ed52b[_0xfb61('0x40')]);var _0x2bc85c={'where':_0x54afde[_0xfb61('0x3c')]};return db[_0xfb61('0x2b')][_0xfb61('0x1f')](_0x2bc85c)[_0xfb61('0x26')](function(_0x606daf){_0x13f75f[_0xfb61('0x1f')]=_0x606daf;if(_0x5ed52b[_0xfb61('0x31')][_0xfb61('0x41')]){_0x54afde['include']=[{'all':!![]}];}return db[_0xfb61('0x2b')][_0xfb61('0x42')](_0x54afde);})['then'](function(_0x149eac){_0x13f75f[_0xfb61('0x43')]=_0x149eac;return _0x13f75f;})[_0xfb61('0x26')](respondWithFilteredResult(_0x1041ea,_0x54afde))[_0xfb61('0x44')](handleError(_0x1041ea,null));};exports[_0xfb61('0x45')]=function(_0x216068,_0x40a773){var _0x4173f2={'raw':![],'where':{'id':_0x216068[_0xfb61('0x46')]['id']}},_0x1743c0={};_0x1743c0[_0xfb61('0x30')]=_[_0xfb61('0x32')](db['Team'][_0xfb61('0x2c')]);_0x1743c0[_0xfb61('0x31')]=_[_0xfb61('0x32')](_0x216068[_0xfb61('0x31')]);_0x1743c0[_0xfb61('0x33')]=_[_0xfb61('0x34')](_0x1743c0[_0xfb61('0x30')],_0x1743c0['query']);_0x4173f2[_0xfb61('0x35')]=_[_0xfb61('0x34')](_0x1743c0['model'],qs[_0xfb61('0x36')](_0x216068[_0xfb61('0x31')][_0xfb61('0x36')]));_0x4173f2[_0xfb61('0x35')]=_0x4173f2[_0xfb61('0x35')][_0xfb61('0x37')]?_0x4173f2[_0xfb61('0x35')]:_0x1743c0[_0xfb61('0x30')];if(_0x216068[_0xfb61('0x31')][_0xfb61('0x41')]){_0x4173f2[_0xfb61('0x47')]=[{'all':!![]}];}_0x4173f2=_[_0xfb61('0x3f')]({},_0x4173f2,_0x216068[_0xfb61('0x40')]);return db['Team'][_0xfb61('0x48')](_0x4173f2)[_0xfb61('0x26')](handleEntityNotFound(_0x40a773,null))[_0xfb61('0x26')](respondWithResult(_0x40a773,null))[_0xfb61('0x44')](handleError(_0x40a773,null));};exports[_0xfb61('0x49')]=function(_0x3fc066,_0xa14410){return db[_0xfb61('0x2b')]['create'](_0x3fc066[_0xfb61('0x4a')],{})[_0xfb61('0x26')](function(_0x222be7){var _0x4cac70=_0x3fc066[_0xfb61('0x4b')]['get']({'plain':!![]});if(!_0x4cac70)throw new Error(_0xfb61('0x4c'));if(_0x4cac70[_0xfb61('0x4d')]==='user'){var _0x18da31=_0x222be7[_0xfb61('0x4e')]({'plain':!![]});var _0x4f8c38=_0xfb61('0x4f');return db[_0xfb61('0x50')][_0xfb61('0x48')]({'where':{'name':_0x4f8c38,'userProfileId':_0x4cac70['userProfileId']},'raw':!![]})[_0xfb61('0x26')](function(_0x4bc3e8){if(_0x4bc3e8&&_0x4bc3e8[_0xfb61('0x51')]===0x0){return db[_0xfb61('0x52')][_0xfb61('0x49')]({'name':_0x18da31['name'],'resourceId':_0x18da31['id'],'type':_0x4bc3e8['name'],'sectionId':_0x4bc3e8['id']},{})[_0xfb61('0x26')](function(){return _0x222be7;});}else{return _0x222be7;}})[_0xfb61('0x44')](function(_0x2bfec1){logger[_0xfb61('0x27')](_0xfb61('0x53'),_0x2bfec1);throw _0x2bfec1;});}return _0x222be7;})[_0xfb61('0x26')](respondWithResult(_0xa14410,0xc9))[_0xfb61('0x44')](handleError(_0xa14410,null));};exports['update']=function(_0x1b03fc,_0x89e8b2){if(_0x1b03fc['body']['id']){delete _0x1b03fc[_0xfb61('0x4a')]['id'];}return db['Team']['find']({'where':{'id':_0x1b03fc[_0xfb61('0x46')]['id']}})[_0xfb61('0x26')](handleEntityNotFound(_0x89e8b2,null))[_0xfb61('0x26')](saveUpdates(_0x1b03fc[_0xfb61('0x4a')],null))[_0xfb61('0x26')](respondWithResult(_0x89e8b2,null))['catch'](handleError(_0x89e8b2,null));};exports[_0xfb61('0x54')]=function(_0x464584,_0xd6f20f){var _0x563807=_0x464584[_0xfb61('0x46')]['id'];var _0x51042f=[];return db[_0xfb61('0x55')][_0xfb61('0x56')](function(_0x2af5e7){var _0x4a62ce=_0xfb61('0x57')+_0x563807;return db[_0xfb61('0x55')][_0xfb61('0x31')](_0x4a62ce,{'type':db[_0xfb61('0x58')][_0xfb61('0x59')][_0xfb61('0x5a')],'raw':!![],'transaction':_0x2af5e7})[_0xfb61('0x26')](function(_0x55f201){_0x51042f=_[_0xfb61('0x2a')](_0x55f201,function(_0x5eedb1){return Number(_0x5eedb1['UserId']);});})[_0xfb61('0x26')](function(){var _0x48b6c0=_0xfb61('0x5b')+_0x563807;return db[_0xfb61('0x55')][_0xfb61('0x31')](_0x48b6c0,{'type':db[_0xfb61('0x58')]['QueryTypes'][_0xfb61('0x5a')],'raw':!![],'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(_0x173bff){var _0x2b3e92=_['map'](_0x173bff,function(_0x26cc54){return Number(_0x26cc54[_0xfb61('0x5c')]);});return db['UserVoiceQueue'][_0xfb61('0x54')]({'where':{'UserId':{'$in':_0x51042f},'VoiceQueueId':{'$in':_0x2b3e92}},'transaction':_0x2af5e7});})['then'](function(){var _0x31ef10=_0xfb61('0x5d')+_0x563807;return db[_0xfb61('0x55')][_0xfb61('0x31')](_0x31ef10,{'type':db['Sequelize'][_0xfb61('0x59')][_0xfb61('0x5a')],'raw':!![],'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(_0x1b904a){var _0x1104e3=_[_0xfb61('0x2a')](_0x1b904a,function(_0x1a047a){return Number(_0x1a047a['MailQueueId']);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x51042f},'MailQueueId':{'$in':_0x1104e3}},'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(){var _0x41b300='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x563807;return db[_0xfb61('0x55')]['query'](_0x41b300,{'type':db[_0xfb61('0x58')][_0xfb61('0x59')]['SELECT'],'raw':!![],'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(_0x4e05d1){var _0x32d459=_[_0xfb61('0x2a')](_0x4e05d1,function(_0x32214e){return Number(_0x32214e['SmsQueueId']);});return db[_0xfb61('0x5e')][_0xfb61('0x54')]({'where':{'UserId':{'$in':_0x51042f},'SmsQueueId':{'$in':_0x32d459}},'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(){var _0xc5277e=_0xfb61('0x5f')+_0x563807;return db[_0xfb61('0x55')][_0xfb61('0x31')](_0xc5277e,{'type':db[_0xfb61('0x58')][_0xfb61('0x59')][_0xfb61('0x5a')],'raw':!![],'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(_0x4eb009){var _0x2da0ac=_[_0xfb61('0x2a')](_0x4eb009,function(_0x4081f8){return Number(_0x4081f8['ChatQueueId']);});return db[_0xfb61('0x60')][_0xfb61('0x54')]({'where':{'UserId':{'$in':_0x51042f},'ChatQueueId':{'$in':_0x2da0ac}},'transaction':_0x2af5e7});})['then'](function(){var _0x5cf6cc=_0xfb61('0x61')+_0x563807;return db[_0xfb61('0x55')][_0xfb61('0x31')](_0x5cf6cc,{'type':db['Sequelize']['QueryTypes'][_0xfb61('0x5a')],'raw':!![],'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(_0x1982af){var _0x302cfc=_[_0xfb61('0x2a')](_0x1982af,function(_0x285b3a){return Number(_0x285b3a[_0xfb61('0x62')]);});return db['UserFaxQueue'][_0xfb61('0x54')]({'where':{'UserId':{'$in':_0x51042f},'FaxQueueId':{'$in':_0x302cfc}},'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(){var _0x25dfde=_0xfb61('0x63')+_0x563807;return db['sequelize'][_0xfb61('0x31')](_0x25dfde,{'type':db[_0xfb61('0x58')][_0xfb61('0x59')][_0xfb61('0x5a')],'raw':!![],'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(_0x465073){var _0x10adb0=_[_0xfb61('0x2a')](_0x465073,function(_0x23ed0a){return Number(_0x23ed0a[_0xfb61('0x64')]);});return db[_0xfb61('0x65')]['destroy']({'where':{'UserId':{'$in':_0x51042f},'OpenchannelQueueId':{'$in':_0x10adb0}},'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(){var _0xcae7cb=_0xfb61('0x66')+_0x563807;return db[_0xfb61('0x55')][_0xfb61('0x31')](_0xcae7cb,{'type':db[_0xfb61('0x58')]['QueryTypes'][_0xfb61('0x5a')],'raw':!![],'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(_0x40f054){var _0x1ee3c3=_[_0xfb61('0x2a')](_0x40f054,function(_0x1835ba){return Number(_0x1835ba[_0xfb61('0x67')]);});return db['UserWhatsappQueue'][_0xfb61('0x54')]({'where':{'UserId':{'$in':_0x51042f},'WhatsappQueueId':{'$in':_0x1ee3c3}},'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(){return db[_0xfb61('0x68')][_0xfb61('0x48')]({'where':{'TeamId':_0x563807}});})[_0xfb61('0x26')](function(_0x2d28c4){if(_0x2d28c4===null){return;}return db[_0xfb61('0x69')][_0xfb61('0x54')]({'where':{'UserId':{'$in':_0x51042f},'VoicePrefixId':_0x2d28c4[_0xfb61('0x6a')]},'transaction':_0x2af5e7});})[_0xfb61('0x26')](function(){return db[_0xfb61('0x2b')][_0xfb61('0x54')]({'where':{'id':_0x563807},'cascade':!![],'transaction':_0x2af5e7});})['then'](function(_0x23d5e3){if(_0x23d5e3===0x0){_0xd6f20f['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xfb61('0x54')]({'where':{'type':_0xfb61('0x4f'),'resourceId':_0x563807},'cascade':!![],'transaction':_0x2af5e7})[_0xfb61('0x26')](function(){_0xd6f20f['status'](0xcc)[_0xfb61('0x1b')]();});}})[_0xfb61('0x44')](function(_0x5397c3){_0xd6f20f[_0xfb61('0x1a')](0x1f4)[_0xfb61('0x29')](_0x5397c3);});});};exports['getQueues']=function(_0xf7d667,_0x4d1fc7,_0x5d74f1){return db['Team'][_0xfb61('0x6b')]({'where':{'id':_0xf7d667[_0xfb61('0x46')]['id']}})[_0xfb61('0x26')](handleEntityNotFound(_0x4d1fc7,null))[_0xfb61('0x26')](function(_0x15684d){if(!_0xf7d667[_0xfb61('0x31')]['channel']||!utils[_0xfb61('0x6c')](_0xf7d667[_0xfb61('0x31')][_0xfb61('0x6d')])){throw new db[(_0xfb61('0x58'))][(_0xfb61('0x6e'))](_0xfb61('0x6f'));}var _0x545ef7={};var _0x2fb42b={};_0x2fb42b[_0xfb61('0x30')]=_[_0xfb61('0x32')](db[_[_0xfb61('0x70')](_0xf7d667[_0xfb61('0x31')][_0xfb61('0x6d')][_0xfb61('0x71')]())+_0xfb61('0x72')][_0xfb61('0x2c')]);_0x2fb42b[_0xfb61('0x31')]=_[_0xfb61('0x32')](_0xf7d667[_0xfb61('0x31')]);_0x2fb42b[_0xfb61('0x33')]=_['intersection'](_0x2fb42b[_0xfb61('0x30')],_0x2fb42b['query']);_0x545ef7[_0xfb61('0x35')]=_[_0xfb61('0x34')](_0x2fb42b[_0xfb61('0x30')],qs['fields'](_0xf7d667['query'][_0xfb61('0x36')]));_0x545ef7['attributes']=_0x545ef7[_0xfb61('0x35')]['length']?_0x545ef7[_0xfb61('0x35')]:_0x2fb42b[_0xfb61('0x30')];_0x545ef7[_0xfb61('0x1e')]=qs[_0xfb61('0x1e')](_0xf7d667[_0xfb61('0x31')][_0xfb61('0x1e')]);_0x545ef7['offset']=qs[_0xfb61('0x20')](_0xf7d667[_0xfb61('0x31')][_0xfb61('0x20')]);_0x545ef7[_0xfb61('0x3a')]=qs['sort'](_0xf7d667[_0xfb61('0x31')][_0xfb61('0x3b')]);_0x545ef7[_0xfb61('0x3c')]=qs[_0xfb61('0x33')](_[_0xfb61('0x3d')](_0xf7d667[_0xfb61('0x31')],_0x2fb42b[_0xfb61('0x33')]));_0x545ef7=_[_0xfb61('0x3f')]({},_0x545ef7,_0xf7d667[_0xfb61('0x40')]);return _0x15684d[_0xfb61('0x4e')+_[_0xfb61('0x70')](_0xf7d667[_0xfb61('0x31')][_0xfb61('0x6d')][_0xfb61('0x71')]())+_0xfb61('0x73')](_0x545ef7);})[_0xfb61('0x26')](respondWithResult(_0x4d1fc7,null))['catch'](handleError(_0x4d1fc7,null));};exports[_0xfb61('0x74')]=function(_0x35f01c,_0x5b454f,_0xc0c35d){return db[_0xfb61('0x2b')][_0xfb61('0x6b')]({'where':{'id':_0x35f01c['params']['id']}})['then'](function(_0x4bc749){if(_0x4bc749){if(!_0x35f01c[_0xfb61('0x4a')][_0xfb61('0x6d')]||!utils[_0xfb61('0x6c')](_0x35f01c[_0xfb61('0x4a')][_0xfb61('0x6d')])){throw new db[(_0xfb61('0x58'))][(_0xfb61('0x6e'))]('Unknown\x20channel');}return _0x4bc749['add'+_[_0xfb61('0x70')](_0x35f01c[_0xfb61('0x4a')][_0xfb61('0x6d')][_0xfb61('0x71')]())+'Queues'](_0x35f01c[_0xfb61('0x4a')][_0xfb61('0x75')]);}return null;})['then'](handleEntityNotFound(_0x5b454f,null))[_0xfb61('0x26')](respondWithStatusCode(_0x5b454f,null))['catch'](handleError(_0x5b454f,null));};exports['removeQueues']=function(_0x2896d1,_0x325480,_0x29a54a){return db['Team'][_0xfb61('0x6b')]({'where':{'id':_0x2896d1['params']['id']}})['then'](function(_0x4ee3fe){if(_0x4ee3fe){if(!_0x2896d1[_0xfb61('0x31')][_0xfb61('0x6d')]||!utils[_0xfb61('0x6c')](_0x2896d1[_0xfb61('0x31')][_0xfb61('0x6d')])){throw new db[(_0xfb61('0x58'))][(_0xfb61('0x6e'))]('Unknown\x20channel');}return _0x4ee3fe[_0xfb61('0x76')+_['capitalize'](_0x2896d1['query']['channel']['toLowerCase']())+_0xfb61('0x73')](_0x2896d1['query'][_0xfb61('0x75')]);}return null;})[_0xfb61('0x26')](handleEntityNotFound(_0x325480,null))[_0xfb61('0x26')](respondWithStatusCode(_0x325480,null))[_0xfb61('0x44')](handleError(_0x325480,null));};exports['addAgents']=function(_0x4511f9,_0x10a289){var _0xec607f=_[_0xfb61('0x77')](_0x4511f9['body'][_0xfb61('0x75')])?_0x4511f9[_0xfb61('0x4a')][_0xfb61('0x75')]:[_0x4511f9[_0xfb61('0x4a')][_0xfb61('0x75')]];var _0x83cb04=_0x4511f9[_0xfb61('0x46')]['id'];return db['Team'][_0xfb61('0x48')]({'where':{'id':_0x83cb04}})[_0xfb61('0x26')](handleEntityNotFound(_0x10a289,null))[_0xfb61('0x26')](function(_0x5e7904){if(_0x5e7904){var _0x393fac=[_0xfb61('0x78'),_0xfb61('0x79'),_0xfb61('0x7a'),_0xfb61('0x7b'),_0xfb61('0x7c'),_0xfb61('0x7d'),_0xfb61('0x7e')];return db[_0xfb61('0x55')][_0xfb61('0x56')](function(_0x5e95f3){var _0x49debb=_[_0xfb61('0x2a')](_0x393fac,function(_0xfb40dc){var _0x23ea87={'attributes':['id',_0xfb61('0x28')]};if(_0xfb40dc===_0xfb61('0x78')){_0x23ea87[_0xfb61('0x7f')]={'attributes':[_0xfb61('0x80')]};}return _0x5e7904[_0xfb61('0x4e')+_0xfb40dc+_0xfb61('0x73')](_0x23ea87)[_0xfb61('0x26')](function(_0x3893a6){var _0x1f19d3=_[_0xfb61('0x2a')](_0x3893a6,function(_0x24ed42){var _0x515d76=_[_0xfb61('0x2a')](_0xec607f,function(_0x2e7a2f){var _0x343e0d={'where':{'UserId':_0x2e7a2f,[_0xfb40dc+_0xfb61('0x81')]:_0x24ed42['id']},'transaction':_0x5e95f3};if(_0xfb40dc===_0xfb61('0x78')){_0x343e0d[_0xfb61('0x82')]={'penalty':_0x24ed42[_0xfb61('0x83')][_0xfb61('0x80')]};}return db['User'+_0xfb40dc+'Queue']['findOrCreate'](_0x343e0d)['then'](function(){socket[_0xfb61('0x84')](_0xfb61('0x4b')+_0xfb40dc+'Queue:save',{'UserId':_0x2e7a2f,[_0xfb40dc+'QueueId']:_0x24ed42['id']});if(_0xfb40dc!==_0xfb61('0x78')){return;}return db[_0xfb61('0x85')][_0xfb61('0x42')]({'where':{'id':_0xec607f,'online':0x1},'attributes':['id',_0xfb61('0x28'),_0xfb61('0x86'),_0xfb61('0x87'),'interface'],'raw':!![]})[_0xfb61('0x26')](function(_0x4abf1e){var _0x23864d=_['map'](_0x4abf1e,function(_0x471262){return db[_0xfb61('0x88')][_0xfb61('0x89')]({'membername':_0x471262[_0xfb61('0x28')],'UserId':_0x471262['id'],'queue_name':_0x24ed42[_0xfb61('0x28')],'VoiceQueueId':_0x24ed42['id'],'interface':_['isNil'](_0x471262[_0xfb61('0x8a')])?util[_0xfb61('0x8b')](_0xfb61('0x8c'),_0x471262['name']):_0x471262['interface'],'paused':_0x471262[_0xfb61('0x87')]||![],'penalty':_0x24ed42[_0xfb61('0x83')][_0xfb61('0x80')]},{'transaction':_0x5e95f3});});return Promise['all'](_0x23864d);});});});return Promise[_0xfb61('0x8d')](_0x515d76);});return Promise[_0xfb61('0x8d')](_0x1f19d3);})[_0xfb61('0x26')](function(){return db[_0xfb61('0x68')]['findOne']({'where':{'teamId':_0x83cb04}})[_0xfb61('0x26')](function(_0x184708){if(_0x184708){var _0x50feea=_[_0xfb61('0x2a')](_0xec607f,function(_0x27f5e6){db[_0xfb61('0x69')][_0xfb61('0x89')]({'UserId':_0x27f5e6,'VoicePrefixId':_0x184708['VoicePrefixId']});});return Promise[_0xfb61('0x8d')](_0x50feea);}});});});return Promise[_0xfb61('0x8d')](_0x49debb)[_0xfb61('0x26')](function(){return _0x5e7904['addAgents'](_0xec607f,{'transaction':_0x5e95f3})[_0xfb61('0x8e')](function(_0xa31acf){return _0xa31acf;});});});}})[_0xfb61('0x26')](respondWithResult(_0x10a289,null))[_0xfb61('0x44')](handleError(_0x10a289,null));};exports['removeAgents']=function(_0x4c09c9,_0x1a817a){var _0x5b9fc6=_[_0xfb61('0x77')](_0x4c09c9[_0xfb61('0x31')][_0xfb61('0x75')])?_0x4c09c9['query'][_0xfb61('0x75')]:[_0x4c09c9[_0xfb61('0x31')][_0xfb61('0x75')]];var _0xcd2a89=_0x4c09c9[_0xfb61('0x46')]['id'];return db[_0xfb61('0x2b')][_0xfb61('0x48')]({'where':{'id':_0xcd2a89}})[_0xfb61('0x26')](handleEntityNotFound(_0x1a817a,null))[_0xfb61('0x26')](function(_0xed5585){if(_0xed5585){var _0x4ba533=[_0xfb61('0x78'),_0xfb61('0x79'),_0xfb61('0x7a'),_0xfb61('0x7b'),_0xfb61('0x7c'),_0xfb61('0x7d'),_0xfb61('0x7e')];return db[_0xfb61('0x55')][_0xfb61('0x56')](function(_0x482bef){var _0x334652=_['map'](_0x4ba533,function(_0x42efd4){var _0x2aec48={'attributes':['id','name']};return _0xed5585[_0xfb61('0x4e')+_0x42efd4+'Queues'](_0x2aec48)[_0xfb61('0x26')](function(_0x19ba9a){var _0x144a42=_[_0xfb61('0x2a')](_0x19ba9a,function(_0x299e7e){return _0x299e7e[_0xfb61('0x8f')](_0x5b9fc6,{'transaction':_0x482bef})[_0xfb61('0x26')](function(){var _0x283998=_[_0xfb61('0x2a')](_0x5b9fc6,function(_0x3b12e3){socket[_0xfb61('0x84')](_0xfb61('0x4b')+_0x42efd4+_0xfb61('0x90'),{'UserId':Number(_0x3b12e3),[_0x42efd4+_0xfb61('0x81')]:_0x299e7e['id']});if(_0x42efd4!=='Voice'){return;}return db[_0xfb61('0x88')][_0xfb61('0x54')]({'where':{'VoiceQueueId':_0x299e7e['id'],'UserId':_0x3b12e3},'transaction':_0x482bef});});return Promise['all'](_0x283998);});});return Promise[_0xfb61('0x8d')](_0x144a42);});});return Promise[_0xfb61('0x8d')](_0x334652)[_0xfb61('0x26')](function(){return _0xed5585['removeAgents'](_0x5b9fc6,{'transaction':_0x482bef});})['then'](function(){return db[_0xfb61('0x68')][_0xfb61('0x6b')]({'where':{'teamId':_0xcd2a89}})[_0xfb61('0x26')](function(_0x28c49f){if(_0x28c49f){var _0x41c9fc=_[_0xfb61('0x2a')](_0x5b9fc6,function(_0x19cbf4){db[_0xfb61('0x69')]['destroy']({'where':{'UserId':_0x19cbf4,'VoicePrefixId':_0x28c49f[_0xfb61('0x6a')]}});});return Promise['all'](_0x41c9fc);}});});});}})[_0xfb61('0x26')](respondWithStatusCode(_0x1a817a,null))[_0xfb61('0x44')](handleError(_0x1a817a,null));};exports[_0xfb61('0x91')]=function(_0x952007,_0x2af03c,_0x416b50){var _0x1ec949={};var _0x5b031f={};var _0x45f4d0;var _0x155584;return db[_0xfb61('0x2b')][_0xfb61('0x6b')]({'where':{'id':_0x952007[_0xfb61('0x46')]['id']}})[_0xfb61('0x26')](handleEntityNotFound(_0x2af03c,null))[_0xfb61('0x26')](function(_0x11aa38){if(_0x11aa38){_0x45f4d0=_0x11aa38;_0x5b031f[_0xfb61('0x30')]=_[_0xfb61('0x32')](db['User'][_0xfb61('0x2c')]);_0x5b031f[_0xfb61('0x31')]=_['keys'](_0x952007[_0xfb61('0x31')]);_0x5b031f[_0xfb61('0x33')]=_['intersection'](_0x5b031f[_0xfb61('0x30')],_0x5b031f[_0xfb61('0x31')]);_0x1ec949['attributes']=_[_0xfb61('0x34')](_0x5b031f[_0xfb61('0x30')],qs['fields'](_0x952007[_0xfb61('0x31')]['fields']));_0x1ec949[_0xfb61('0x35')]=_0x1ec949[_0xfb61('0x35')]['length']?_0x1ec949[_0xfb61('0x35')]:_0x5b031f[_0xfb61('0x30')];_0x1ec949[_0xfb61('0x3a')]=qs[_0xfb61('0x3b')](_0x952007[_0xfb61('0x31')]['sort']);_0x1ec949['where']=qs[_0xfb61('0x33')](_[_0xfb61('0x3d')](_0x952007[_0xfb61('0x31')],_0x5b031f[_0xfb61('0x33')]));if(_0x952007[_0xfb61('0x31')]['filter']){_0x1ec949[_0xfb61('0x3c')]=_['merge'](_0x1ec949[_0xfb61('0x3c')],{'$or':_[_0xfb61('0x2a')](_0x1ec949[_0xfb61('0x35')],function(_0x33a4b6){var _0x445779={};_0x445779[_0x33a4b6]={'$like':'%'+_0x952007[_0xfb61('0x31')]['filter']+'%'};return _0x445779;})});}_0x1ec949=_['merge']({},_0x1ec949,_0x952007['options']);return _0x45f4d0[_0xfb61('0x91')](_0x1ec949);}})['then'](function(_0x19c3f4){if(_0x19c3f4){_0x155584=_0x19c3f4[_0xfb61('0x37')];if(!_0x952007[_0xfb61('0x31')][_0xfb61('0x38')](_0xfb61('0x39'))){_0x1ec949['limit']=qs['limit'](_0x952007[_0xfb61('0x31')]['limit']);_0x1ec949[_0xfb61('0x20')]=qs[_0xfb61('0x20')](_0x952007[_0xfb61('0x31')][_0xfb61('0x20')]);}return _0x45f4d0[_0xfb61('0x91')](_0x1ec949);}})['then'](function(_0x2258b8){if(_0x2258b8){return _0x2258b8?{'count':_0x155584,'rows':_0x2258b8}:null;}})[_0xfb61('0x26')](respondWithResult(_0x2af03c,null))[_0xfb61('0x44')](handleError(_0x2af03c,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index cc6defa..241b1f3 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 _0x65d9=['../../mysqldb','Team','save','update','remove','emit','hasOwnProperty','events'];(function(_0x56e0e5,_0x2e3937){var _0x27bb15=function(_0x186336){while(--_0x186336){_0x56e0e5['push'](_0x56e0e5['shift']());}};_0x27bb15(++_0x2e3937);}(_0x65d9,0x1bf));var _0x965d=function(_0x4f612f,_0x88a4b1){_0x4f612f=_0x4f612f-0x0;var _0x20bb4a=_0x65d9[_0x4f612f];return _0x20bb4a;};'use strict';var EventEmitter=require(_0x965d('0x0'));var Team=require(_0x965d('0x1'))['db'][_0x965d('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x965d('0x3'),'afterUpdate':_0x965d('0x4'),'afterDestroy':_0x965d('0x5')};function emitEvent(_0x22ffa9){return function(_0x178a48,_0x50f6fb,_0x41e12c){TeamEvents['emit'](_0x22ffa9+':'+_0x178a48['id'],_0x178a48);TeamEvents[_0x965d('0x6')](_0x22ffa9,_0x178a48);_0x41e12c(null);};}for(var e in events){if(events[_0x965d('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xe36f=['exports','events','../../mysqldb','setMaxListeners','update','emit','hook'];(function(_0x2b0e82,_0x2e2103){var _0x53d84d=function(_0x148a99){while(--_0x148a99){_0x2b0e82['push'](_0x2b0e82['shift']());}};_0x53d84d(++_0x2e2103);}(_0xe36f,0x189));var _0xfe36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe36f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfe36('0x0'));var Team=require(_0xfe36('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xfe36('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe36('0x3'),'afterDestroy':'remove'};function emitEvent(_0x44adf0){return function(_0x52a70f,_0xaf0692,_0x10a708){TeamEvents[_0xfe36('0x4')](_0x44adf0+':'+_0x52a70f['id'],_0x52a70f);TeamEvents['emit'](_0x44adf0,_0x52a70f);_0x10a708(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xfe36('0x5')](e,emitEvent(event));}}module[_0xfe36('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 75debde..da46af4 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 _0xf810=['teams','Chat','Fax','Mail','Openchannel','Voice','Whatsapp','resolve','then','all','lodash','./team.attributes','get','Queues','map','channel','define','Team'];(function(_0xfea748,_0x1ad019){var _0x447ead=function(_0x40f1d6){while(--_0x40f1d6){_0xfea748['push'](_0xfea748['shift']());}};_0x447ead(++_0x1ad019);}(_0xf810,0x64));var _0x0f81=function(_0x2c8d9d,_0x4eecef){_0x2c8d9d=_0x2c8d9d-0x0;var _0x9e39f4=_0xf810[_0x2c8d9d];return _0x9e39f4;};'use strict';var _=require(_0x0f81('0x0'));var attributes=require(_0x0f81('0x1'));function getQueuesByChannel(_0xa819e2,_0x385124){var _0x147ec8=_0x0f81('0x2')+_0x385124+_0x0f81('0x3');return _0xa819e2[_0x147ec8]()['then'](function(_0x4bdf27){return _[_0x0f81('0x4')](_0x4bdf27,function(_0x414a30){_0x414a30['setDataValue'](_0x0f81('0x5'),_0x385124);return _0x414a30;});})['catch'](function(_0x4a2f2f){throw _0x4a2f2f;});}module['exports']=function(_0x47b3f0){return _0x47b3f0[_0x0f81('0x6')](_0x0f81('0x7'),attributes,{'tableName':_0x0f81('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1130f2=this;var _0x19b6ce=[_0x0f81('0x9'),_0x0f81('0xa'),_0x0f81('0xb'),_0x0f81('0xc'),'Sms',_0x0f81('0xd'),_0x0f81('0xe')];return Promise[_0x0f81('0xf')]()[_0x0f81('0x10')](function(){var _0x71cc96=_[_0x0f81('0x4')](_0x19b6ce,function(_0xe15a8f){return getQueuesByChannel(_0x1130f2,_0xe15a8f);});return Promise[_0x0f81('0x11')](_0x71cc96);})['catch'](function(_0x5bdf11){throw _0x5bdf11;});}}});}; \ No newline at end of file +var _0xca7f=['Sms','Voice','Whatsapp','resolve','all','lodash','get','then','map','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel'];(function(_0x4835d9,_0x2a37a2){var _0x9ad61a=function(_0x4ed89a){while(--_0x4ed89a){_0x4835d9['push'](_0x4835d9['shift']());}};_0x9ad61a(++_0x2a37a2);}(_0xca7f,0xd6));var _0xfca7=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xca7f[_0x1526e1];return _0x249a1e;};'use strict';var _=require(_0xfca7('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x5be471,_0x7b62f7){var _0x3c5535=_0xfca7('0x1')+_0x7b62f7+'Queues';return _0x5be471[_0x3c5535]()[_0xfca7('0x2')](function(_0xb88d88){return _[_0xfca7('0x3')](_0xb88d88,function(_0xe99898){_0xe99898['setDataValue'](_0xfca7('0x4'),_0x7b62f7);return _0xe99898;});})[_0xfca7('0x5')](function(_0x2114ca){throw _0x2114ca;});}module[_0xfca7('0x6')]=function(_0x281a5c){return _0x281a5c[_0xfca7('0x7')](_0xfca7('0x8'),attributes,{'tableName':_0xfca7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5740ca=this;var _0x42a6e5=[_0xfca7('0xa'),_0xfca7('0xb'),_0xfca7('0xc'),_0xfca7('0xd'),_0xfca7('0xe'),_0xfca7('0xf'),_0xfca7('0x10')];return Promise[_0xfca7('0x11')]()[_0xfca7('0x2')](function(){var _0x4140e2=_[_0xfca7('0x3')](_0x42a6e5,function(_0x4bd8d4){return getQueuesByChannel(_0x5740ca,_0x4bd8d4);});return Promise[_0xfca7('0x12')](_0x4140e2);})[_0xfca7('0x5')](function(_0x3966ae){throw _0x3966ae;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 60a287c..76cc090 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 _0xcf00=['client','http','defaults','redis','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x53c337,_0x1e25b8){var _0x468e30=function(_0x29d6b1){while(--_0x29d6b1){_0x53c337['push'](_0x53c337['shift']());}};_0x468e30(++_0x1e25b8);}(_0xcf00,0x86));var _0x0cf0=function(_0x52ef79,_0x23f3f0){_0x52ef79=_0x52ef79-0x0;var _0x23f33f=_0xcf00[_0x52ef79];return _0x23f33f;};'use strict';var _=require(_0x0cf0('0x0'));var util=require(_0x0cf0('0x1'));var moment=require(_0x0cf0('0x2'));var BPromise=require(_0x0cf0('0x3'));var rs=require(_0x0cf0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cf0('0x5'))['db'];var utils=require(_0x0cf0('0x6'));var logger=require(_0x0cf0('0x7'))(_0x0cf0('0x8'));var config=require(_0x0cf0('0x9'));var jayson=require(_0x0cf0('0xa'));var client=jayson[_0x0cf0('0xb')][_0x0cf0('0xc')]({'port':0x232a});config['redis']=_[_0x0cf0('0xd')](config[_0x0cf0('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x0cf0('0xf'))(new Redis(config[_0x0cf0('0xe')]));require('./team.socket')[_0x0cf0('0x10')](socket);function respondWithRpcPromise(_0xabcddd,_0x4f5428,_0x5de84b){return new BPromise(function(_0x1fe0a8,_0x583f7a){return client[_0x0cf0('0x11')](_0xabcddd,_0x5de84b)[_0x0cf0('0x12')](function(_0x3ff36f){logger['info'](_0x0cf0('0x13'),_0x4f5428,_0x0cf0('0x14'));logger[_0x0cf0('0x15')](_0x0cf0('0x16'),_0x4f5428,_0x0cf0('0x14'),JSON[_0x0cf0('0x17')](_0x3ff36f));if(_0x3ff36f[_0x0cf0('0x18')]){if(_0x3ff36f['error'][_0x0cf0('0x19')]===0x1f4){logger[_0x0cf0('0x18')](_0x0cf0('0x13'),_0x4f5428,_0x3ff36f[_0x0cf0('0x18')][_0x0cf0('0x1a')]);return _0x583f7a(_0x3ff36f[_0x0cf0('0x18')][_0x0cf0('0x1a')]);}logger[_0x0cf0('0x18')]('Team,\x20%s,\x20%s',_0x4f5428,_0x3ff36f['error'][_0x0cf0('0x1a')]);return _0x1fe0a8(_0x3ff36f['error'][_0x0cf0('0x1a')]);}else{logger[_0x0cf0('0x1b')](_0x0cf0('0x13'),_0x4f5428,_0x0cf0('0x14'));_0x1fe0a8(_0x3ff36f['result'][_0x0cf0('0x1a')]);}})[_0x0cf0('0x1c')](function(_0x20e448){logger[_0x0cf0('0x18')](_0x0cf0('0x13'),_0x4f5428,_0x20e448);_0x583f7a(_0x20e448);});});} \ No newline at end of file +var _0x6576=['info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6576,0x1af));var _0x6657=function(_0xf3b3e7,_0x1b2afc){_0xf3b3e7=_0xf3b3e7-0x0;var _0x4a22a2=_0x6576[_0xf3b3e7];return _0x4a22a2;};'use strict';var _=require(_0x6657('0x0'));var util=require(_0x6657('0x1'));var moment=require(_0x6657('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6657('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6657('0x4'));var logger=require(_0x6657('0x5'))(_0x6657('0x6'));var config=require(_0x6657('0x7'));var jayson=require(_0x6657('0x8'));var client=jayson[_0x6657('0x9')]['http']({'port':0x232a});config[_0x6657('0xa')]=_[_0x6657('0xb')](config[_0x6657('0xa')],{'host':_0x6657('0xc'),'port':0x18eb});var socket=require(_0x6657('0xd'))(new Redis(config[_0x6657('0xa')]));require(_0x6657('0xe'))[_0x6657('0xf')](socket);function respondWithRpcPromise(_0x15533d,_0x168f0b,_0x1bdc68){return new BPromise(function(_0xd9967c,_0x4c2b86){return client['request'](_0x15533d,_0x1bdc68)[_0x6657('0x10')](function(_0x4e22ca){logger[_0x6657('0x11')]('Team,\x20%s,\x20%s',_0x168f0b,_0x6657('0x12'));logger[_0x6657('0x13')](_0x6657('0x14'),_0x168f0b,'request\x20sent',JSON[_0x6657('0x15')](_0x4e22ca));if(_0x4e22ca[_0x6657('0x16')]){if(_0x4e22ca[_0x6657('0x16')][_0x6657('0x17')]===0x1f4){logger[_0x6657('0x16')](_0x6657('0x18'),_0x168f0b,_0x4e22ca[_0x6657('0x16')][_0x6657('0x19')]);return _0x4c2b86(_0x4e22ca[_0x6657('0x16')][_0x6657('0x19')]);}logger['error'](_0x6657('0x18'),_0x168f0b,_0x4e22ca[_0x6657('0x16')][_0x6657('0x19')]);return _0xd9967c(_0x4e22ca[_0x6657('0x16')][_0x6657('0x19')]);}else{logger['info'](_0x6657('0x18'),_0x168f0b,'request\x20sent');_0xd9967c(_0x4e22ca[_0x6657('0x1a')][_0x6657('0x19')]);}})[_0x6657('0x1b')](function(_0x347b4a){logger[_0x6657('0x16')](_0x6657('0x18'),_0x168f0b,_0x347b4a);_0x4c2b86(_0x347b4a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index fbfb48f..7765d56 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 _0x9b11=['register','length','team:','./team.events','save','update','emit','removeListener'];(function(_0x440597,_0x1548ca){var _0x293f81=function(_0x2e6baf){while(--_0x2e6baf){_0x440597['push'](_0x440597['shift']());}};_0x293f81(++_0x1548ca);}(_0x9b11,0x12b));var _0x19b1=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x9b11[_0x589aee];return _0x2f5ed4;};'use strict';var TeamEvents=require(_0x19b1('0x0'));var events=[_0x19b1('0x1'),'remove',_0x19b1('0x2')];function createListener(_0x1eba9f,_0x493084){return function(_0x590ed3){_0x493084[_0x19b1('0x3')](_0x1eba9f,_0x590ed3);};}function removeListener(_0x2e07ab,_0x40c058){return function(){TeamEvents[_0x19b1('0x4')](_0x2e07ab,_0x40c058);};}exports[_0x19b1('0x5')]=function(_0xad5a2d){for(var _0x56f829=0x0,_0x1717a4=events[_0x19b1('0x6')];_0x56f829<_0x1717a4;_0x56f829++){var _0x419c82=events[_0x56f829];var _0x564617=createListener(_0x19b1('0x7')+_0x419c82,_0xad5a2d);TeamEvents['on'](_0x419c82,_0x564617);}}; \ No newline at end of file +var _0x728e=['emit','removeListener','length','./team.events','save','remove','update'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x728e,0x153));var _0xe728=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x728e[_0x14add3];return _0x4a174f;};'use strict';var TeamEvents=require(_0xe728('0x0'));var events=[_0xe728('0x1'),_0xe728('0x2'),_0xe728('0x3')];function createListener(_0x199c08,_0x4e1336){return function(_0x48bce1){_0x4e1336[_0xe728('0x4')](_0x199c08,_0x48bce1);};}function removeListener(_0x35b2be,_0x2cd6ac){return function(){TeamEvents[_0xe728('0x5')](_0x35b2be,_0x2cd6ac);};}exports['register']=function(_0x57c328){for(var _0x4c8f92=0x0,_0x275eae=events[_0xe728('0x6')];_0x4c8f92<_0x275eae;_0x4c8f92++){var _0x269442=events[_0x4c8f92];var _0x200864=createListener('team:'+_0x269442,_0x57c328);TeamEvents['on'](_0x269442,_0x200864);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 419f349..3c34cb5 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 _0x6a55=['sequelize','INTEGER'];(function(_0x59d4dd,_0x3c4476){var _0x3f16c2=function(_0x3749a7){while(--_0x3749a7){_0x59d4dd['push'](_0x59d4dd['shift']());}};_0x3f16c2(++_0x3c4476);}(_0x6a55,0x154));var _0x56a5=function(_0x3213b7,_0x6789ca){_0x3213b7=_0x3213b7-0x0;var _0xb960bf=_0x6a55[_0x3213b7];return _0xb960bf;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x56a5('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x56a5('0x1')]}}; \ No newline at end of file +var _0x1df5=['INTEGER','sequelize','exports'];(function(_0x38494c,_0x5393f5){var _0x591aec=function(_0x1ac449){while(--_0x1ac449){_0x38494c['push'](_0x38494c['shift']());}};_0x591aec(++_0x5393f5);}(_0x1df5,0xfd));var _0x51df=function(_0x3d1312,_0x3b42a6){_0x3d1312=_0x3d1312-0x0;var _0x3aacd7=_0x1df5[_0x3d1312];return _0x3aacd7;};'use strict';var Sequelize=require(_0x51df('0x0'));module[_0x51df('0x1')]={'TeamId':{'type':Sequelize[_0x51df('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x51df('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index cc5636b..c91ae38 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 _0x4b74=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x4b74,0x103));var _0x44b7=function(_0x88b38f,_0x579907){_0x88b38f=_0x88b38f-0x0;var _0x4e6111=_0x4b74[_0x88b38f];return _0x4e6111;};'use strict';var _=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var logger=require(_0x44b7('0x2'))('api');var moment=require(_0x44b7('0x3'));var BPromise=require(_0x44b7('0x4'));var rp=require(_0x44b7('0x5'));var fs=require('fs');var path=require(_0x44b7('0x6'));var rimraf=require(_0x44b7('0x7'));var config=require(_0x44b7('0x8'));var attributes=require(_0x44b7('0x9'));module[_0x44b7('0xa')]=function(_0x5ef96c,_0xdfcf5){return _0x5ef96c[_0x44b7('0xb')](_0x44b7('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5fc=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','api','moment','rimraf'];(function(_0x239a04,_0x1e5d31){var _0xcfc93d=function(_0x27d502){while(--_0x27d502){_0x239a04['push'](_0x239a04['shift']());}};_0xcfc93d(++_0x1e5d31);}(_0xe5fc,0x109));var _0xce5f=function(_0x11a4a7,_0x48cf2e){_0x11a4a7=_0x11a4a7-0x0;var _0x33a1b3=_0xe5fc[_0x11a4a7];return _0x33a1b3;};'use strict';var _=require(_0xce5f('0x0'));var util=require('util');var logger=require(_0xce5f('0x1'))(_0xce5f('0x2'));var moment=require(_0xce5f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce5f('0x4'));var config=require('../../config/environment');var attributes=require(_0xce5f('0x5'));module[_0xce5f('0x6')]=function(_0x2c23b0,_0x12d30e){return _0x2c23b0[_0xce5f('0x7')](_0xce5f('0x8'),attributes,{'tableName':_0xce5f('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 657bdc4..703db61 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a09e9,_0x391256){var _0x5e4735=function(_0x23d780){while(--_0x23d780){_0x5a09e9['push'](_0x5a09e9['shift']());}};_0x5e4735(++_0x391256);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x928b87,_0x53480a){var _0x1e7638=function(_0x1e2184){while(--_0x1e2184){_0x928b87['push'](_0x928b87['shift']());}};_0x1e7638(++_0x53480a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9006424..5bdc2cc 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc358=['sequelize','exports','INTEGER'];(function(_0x4007b1,_0x206901){var _0x108d6c=function(_0x84fcb6){while(--_0x84fcb6){_0x4007b1['push'](_0x4007b1['shift']());}};_0x108d6c(++_0x206901);}(_0xc358,0x108));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8c35('0x0'));module[_0x8c35('0x1')]={'penalty':{'type':Sequelize[_0x8c35('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 48fb882..ff0ec6d 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 _0x5a52=['team_has_voice_queues','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue'];(function(_0x283b1c,_0x574f86){var _0xb7b3ae=function(_0x3999c2){while(--_0x3999c2){_0x283b1c['push'](_0x283b1c['shift']());}};_0xb7b3ae(++_0x574f86);}(_0x5a52,0x18d));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x25a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x25a5('0x1'));var BPromise=require(_0x25a5('0x2'));var rp=require(_0x25a5('0x3'));var fs=require('fs');var path=require(_0x25a5('0x4'));var rimraf=require(_0x25a5('0x5'));var config=require(_0x25a5('0x6'));var attributes=require(_0x25a5('0x7'));module[_0x25a5('0x8')]=function(_0x5db751,_0x2c210a){return _0x5db751['define'](_0x25a5('0x9'),attributes,{'tableName':_0x25a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x238f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','TeamVoiceQueue'];(function(_0x1ad5ee,_0x34d935){var _0x56052f=function(_0x591b9a){while(--_0x591b9a){_0x1ad5ee['push'](_0x1ad5ee['shift']());}};_0x56052f(++_0x34d935);}(_0x238f,0xa5));var _0xf238=function(_0x22e13b,_0x209f2e){_0x22e13b=_0x22e13b-0x0;var _0x2ad2d2=_0x238f[_0x22e13b];return _0x2ad2d2;};'use strict';var _=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var logger=require(_0xf238('0x2'))('api');var moment=require(_0xf238('0x3'));var BPromise=require(_0xf238('0x4'));var rp=require(_0xf238('0x5'));var fs=require('fs');var path=require(_0xf238('0x6'));var rimraf=require(_0xf238('0x7'));var config=require(_0xf238('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0xf238('0x9')]=function(_0x2b9e9f,_0x4e4685){return _0x2b9e9f['define'](_0xf238('0xa'),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 95c1272..188ee16 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 _0x4cc4=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message'];(function(_0x3a6acc,_0x4f51a1){var _0xeba8db=function(_0x482e66){while(--_0x482e66){_0x3a6acc['push'](_0x3a6acc['shift']());}};_0xeba8db(++_0x4f51a1);}(_0x4cc4,0x6f));var _0x44cc=function(_0xf35617,_0x19c0bf){_0xf35617=_0xf35617-0x0;var _0x4b4aed=_0x4cc4[_0xf35617];return _0x4b4aed;};'use strict';var _=require('lodash');var util=require(_0x44cc('0x0'));var moment=require(_0x44cc('0x1'));var BPromise=require(_0x44cc('0x2'));var rs=require(_0x44cc('0x3'));var fs=require('fs');var Redis=require(_0x44cc('0x4'));var db=require(_0x44cc('0x5'))['db'];var utils=require(_0x44cc('0x6'));var logger=require(_0x44cc('0x7'))(_0x44cc('0x8'));var config=require(_0x44cc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x44cc('0xa')][_0x44cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x936ff8,_0x28b04b,_0x26e496){return new BPromise(function(_0x201a6e,_0x1ff819){return client[_0x44cc('0xc')](_0x936ff8,_0x26e496)['then'](function(_0x301abe){logger[_0x44cc('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x28b04b,_0x44cc('0xe'));logger[_0x44cc('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x28b04b,'request\x20sent',JSON[_0x44cc('0x10')](_0x301abe));if(_0x301abe['error']){if(_0x301abe[_0x44cc('0x11')][_0x44cc('0x12')]===0x1f4){logger[_0x44cc('0x11')](_0x44cc('0x13'),_0x28b04b,_0x301abe[_0x44cc('0x11')][_0x44cc('0x14')]);return _0x1ff819(_0x301abe[_0x44cc('0x11')][_0x44cc('0x14')]);}logger[_0x44cc('0x11')](_0x44cc('0x13'),_0x28b04b,_0x301abe[_0x44cc('0x11')][_0x44cc('0x14')]);return _0x201a6e(_0x301abe[_0x44cc('0x11')]['message']);}else{logger[_0x44cc('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x28b04b,_0x44cc('0xe'));_0x201a6e(_0x301abe['result'][_0x44cc('0x14')]);}})[_0x44cc('0x15')](function(_0x3440ae){logger[_0x44cc('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x28b04b,_0x3440ae);_0x1ff819(_0x3440ae);});});} \ No newline at end of file +var _0xa0aa=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3b7f43,_0x35f9ef){var _0x5f28dd=function(_0x3e81c7){while(--_0x3e81c7){_0x3b7f43['push'](_0x3b7f43['shift']());}};_0x5f28dd(++_0x35f9ef);}(_0xa0aa,0x19b));var _0xaa0a=function(_0x2e51f8,_0x266415){_0x2e51f8=_0x2e51f8-0x0;var _0x448bfe=_0xa0aa[_0x2e51f8];return _0x448bfe;};'use strict';var _=require(_0xaa0a('0x0'));var util=require(_0xaa0a('0x1'));var moment=require('moment');var BPromise=require(_0xaa0a('0x2'));var rs=require(_0xaa0a('0x3'));var fs=require('fs');var Redis=require(_0xaa0a('0x4'));var db=require(_0xaa0a('0x5'))['db'];var utils=require(_0xaa0a('0x6'));var logger=require(_0xaa0a('0x7'))(_0xaa0a('0x8'));var config=require(_0xaa0a('0x9'));var jayson=require(_0xaa0a('0xa'));var client=jayson[_0xaa0a('0xb')][_0xaa0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf80d91,_0x1cc2da,_0x5431c8){return new BPromise(function(_0x18a450,_0x441c7f){return client[_0xaa0a('0xd')](_0xf80d91,_0x5431c8)[_0xaa0a('0xe')](function(_0x4e41e9){logger[_0xaa0a('0xf')](_0xaa0a('0x10'),_0x1cc2da,_0xaa0a('0x11'));logger['debug'](_0xaa0a('0x12'),_0x1cc2da,_0xaa0a('0x11'),JSON[_0xaa0a('0x13')](_0x4e41e9));if(_0x4e41e9[_0xaa0a('0x14')]){if(_0x4e41e9[_0xaa0a('0x14')][_0xaa0a('0x15')]===0x1f4){logger['error'](_0xaa0a('0x10'),_0x1cc2da,_0x4e41e9[_0xaa0a('0x14')]['message']);return _0x441c7f(_0x4e41e9['error'][_0xaa0a('0x16')]);}logger['error'](_0xaa0a('0x10'),_0x1cc2da,_0x4e41e9[_0xaa0a('0x14')][_0xaa0a('0x16')]);return _0x18a450(_0x4e41e9[_0xaa0a('0x14')][_0xaa0a('0x16')]);}else{logger['info'](_0xaa0a('0x10'),_0x1cc2da,_0xaa0a('0x11'));_0x18a450(_0x4e41e9['result']['message']);}})[_0xaa0a('0x17')](function(_0x439af3){logger[_0xaa0a('0x14')](_0xaa0a('0x10'),_0x1cc2da,_0x439af3);_0x441c7f(_0x439af3);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c66e4fa..5779112 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 _0x553a=['../../components/interaction/service','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x2007cf,_0x23a105){var _0x17d6c0=function(_0x329a29){while(--_0x329a29){_0x2007cf['push'](_0x2007cf['shift']());}};_0x17d6c0(++_0x23a105);}(_0x553a,0x192));var _0xa553=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x553a[_0x58381c];return _0x1a7440;};'use strict';var multer=require('multer');var util=require(_0xa553('0x0'));var path=require('path');var timeout=require(_0xa553('0x1'));var express=require(_0xa553('0x2'));var router=express[_0xa553('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa553('0x4'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0xa553('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa553('0x5')](_0xa553('0x6'),auth[_0xa553('0x7')](),controller['show']);router[_0xa553('0x8')]('/',auth['isAuthenticated'](),controller[_0xa553('0x9')]);router[_0xa553('0xa')](_0xa553('0x6'),auth['isAuthenticated'](),controller['update']);router[_0xa553('0xb')]('/:id',auth[_0xa553('0x7')](),controller[_0xa553('0xc')]);module[_0xa553('0xd')]=router; \ No newline at end of file +var _0xdf5d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0xc140f6,_0x34ae73){var _0x41cfc1=function(_0x55a289){while(--_0x55a289){_0xc140f6['push'](_0xc140f6['shift']());}};_0x41cfc1(++_0x34ae73);}(_0xdf5d,0x126));var _0xddf5=function(_0x123111,_0x5e0163){_0x123111=_0x123111-0x0;var _0x20c607=_0xdf5d[_0x123111];return _0x20c607;};'use strict';var multer=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var path=require(_0xddf5('0x2'));var timeout=require(_0xddf5('0x3'));var express=require(_0xddf5('0x4'));var router=express[_0xddf5('0x5')]();var fs_extra=require(_0xddf5('0x6'));var auth=require(_0xddf5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xddf5('0x8'));var controller=require(_0xddf5('0x9'));router[_0xddf5('0xa')]('/',auth[_0xddf5('0xb')](),controller[_0xddf5('0xc')]);router[_0xddf5('0xa')](_0xddf5('0xd'),auth[_0xddf5('0xb')](),controller[_0xddf5('0xe')]);router[_0xddf5('0xf')]('/',auth[_0xddf5('0xb')](),controller[_0xddf5('0x10')]);router[_0xddf5('0x11')](_0xddf5('0xd'),auth[_0xddf5('0xb')](),controller[_0xddf5('0x12')]);router['delete'](_0xddf5('0xd'),auth[_0xddf5('0xb')](),controller[_0xddf5('0x13')]);module[_0xddf5('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d39b8f4..f2df72b 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 _0xc8d6=['sequelize','exports','STRING'];(function(_0x1b1516,_0x17a510){var _0x14902e=function(_0x573007){while(--_0x573007){_0x1b1516['push'](_0x1b1516['shift']());}};_0x14902e(++_0x17a510);}(_0xc8d6,0x177));var _0x6c8d=function(_0x3611a4,_0x577693){_0x3611a4=_0x3611a4-0x0;var _0x3c8787=_0xc8d6[_0x3611a4];return _0x3c8787;};'use strict';var Sequelize=require(_0x6c8d('0x0'));module[_0x6c8d('0x1')]={'name':{'type':Sequelize[_0x6c8d('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x653d=['TEXT','exports','STRING'];(function(_0x5c6d2a,_0x5a3825){var _0x2d323b=function(_0x3c7674){while(--_0x3c7674){_0x5c6d2a['push'](_0x5c6d2a['shift']());}};_0x2d323b(++_0x5a3825);}(_0x653d,0x133));var _0xd653=function(_0x3fbc28,_0x10a519){_0x3fbc28=_0x3fbc28-0x0;var _0x43539a=_0x653d[_0x3fbc28];return _0x43539a;};'use strict';var Sequelize=require('sequelize');module[_0xd653('0x0')]={'name':{'type':Sequelize[_0xd653('0x1')]},'description':{'type':Sequelize[_0xd653('0x1')]},'html':{'type':Sequelize[_0xd653('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 4d93bf8..c070f58 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 _0x6e1d=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','Template','findAll','rows','catch','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','then','get','Templates','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1c1b63,_0x1cb6c6){var _0x58e0b2=function(_0x4c31cc){while(--_0x4c31cc){_0x1c1b63['push'](_0x1c1b63['shift']());}};_0x58e0b2(++_0x1cb6c6);}(_0x6e1d,0x1ae));var _0xd6e1=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x6e1d[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require(_0xd6e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd6e1('0x1'));var rp=require('request-promise');var moment=require(_0xd6e1('0x2'));var BPromise=require(_0xd6e1('0x3'));var Mustache=require(_0xd6e1('0x4'));var util=require(_0xd6e1('0x5'));var path=require(_0xd6e1('0x6'));var sox=require(_0xd6e1('0x7'));var csv=require(_0xd6e1('0x8'));var ejs=require(_0xd6e1('0x9'));var fs=require('fs');var fs_extra=require(_0xd6e1('0xa'));var _=require(_0xd6e1('0xb'));var squel=require('squel');var crypto=require(_0xd6e1('0xc'));var jsforce=require(_0xd6e1('0xd'));var deskjs=require(_0xd6e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd6e1('0xf'));var Papa=require(_0xd6e1('0x10'));var Redis=require(_0xd6e1('0x11'));var authService=require(_0xd6e1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd6e1('0x13'));var hardwareService=require(_0xd6e1('0x14'));var logger=require(_0xd6e1('0x15'))('api');var utils=require(_0xd6e1('0x16'));var config=require(_0xd6e1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6e1('0x18'))['db'];function respondWithStatusCode(_0x4e8bcc,_0x21603f){_0x21603f=_0x21603f||0xcc;return function(_0x266f9b){if(_0x266f9b){return _0x4e8bcc[_0xd6e1('0x19')](_0x21603f);}return _0x4e8bcc[_0xd6e1('0x1a')](_0x21603f)[_0xd6e1('0x1b')]();};}function respondWithResult(_0x45201d,_0x2ff4e8){_0x2ff4e8=_0x2ff4e8||0xc8;return function(_0x286bbd){if(_0x286bbd){return _0x45201d[_0xd6e1('0x1a')](_0x2ff4e8)['json'](_0x286bbd);}};}function respondWithFilteredResult(_0xe575d6,_0x1addf3){return function(_0x4da4fc){if(_0x4da4fc){var _0x3249f5=typeof _0x1addf3['offset']===_0xd6e1('0x1c')&&typeof _0x1addf3[_0xd6e1('0x1d')]==='undefined';var _0x405c53=_0x4da4fc[_0xd6e1('0x1e')];var _0x3c65a7=_0x3249f5?0x0:_0x1addf3['offset'];var _0x11293e=_0x3249f5?_0x4da4fc[_0xd6e1('0x1e')]:_0x1addf3[_0xd6e1('0x1f')]+_0x1addf3[_0xd6e1('0x1d')];var _0x583f14;if(_0x11293e>=_0x405c53){_0x11293e=_0x405c53;_0x583f14=0xc8;}else{_0x583f14=0xce;}_0xe575d6[_0xd6e1('0x1a')](_0x583f14);return _0xe575d6[_0xd6e1('0x20')](_0xd6e1('0x21'),_0x3c65a7+'-'+_0x11293e+'/'+_0x405c53)[_0xd6e1('0x22')](_0x4da4fc);}return null;};}function patchUpdates(_0x534816){return function(_0x4ab7a7){try{jsonpatch['apply'](_0x4ab7a7,_0x534816,!![]);}catch(_0x32bf47){return BPromise['reject'](_0x32bf47);}return _0x4ab7a7[_0xd6e1('0x23')]();};}function saveUpdates(_0x413547,_0x1c7ac7){return function(_0x402290){if(_0x402290){return _0x402290['update'](_0x413547)['then'](function(_0x2ccb20){return _0x2ccb20;});}return null;};}function removeEntity(_0x1576ef,_0x523316){return function(_0x5a0ea9){if(_0x5a0ea9){return _0x5a0ea9['destroy']()[_0xd6e1('0x24')](function(){var _0x4534c4=_0x5a0ea9[_0xd6e1('0x25')]({'plain':!![]});var _0xa485c6=_0xd6e1('0x26');return db['UserProfileResource'][_0xd6e1('0x27')]({'where':{'type':_0xa485c6,'resourceId':_0x4534c4['id']}})[_0xd6e1('0x24')](function(){return _0x5a0ea9;});})[_0xd6e1('0x24')](function(){_0x1576ef[_0xd6e1('0x1a')](0xcc)[_0xd6e1('0x1b')]();});}};}function handleEntityNotFound(_0x190a76,_0x590bd7){return function(_0x45f4da){if(!_0x45f4da){_0x190a76['sendStatus'](0x194);}return _0x45f4da;};}function handleError(_0x110942,_0x230c57){_0x230c57=_0x230c57||0x1f4;return function(_0x788235){logger['error'](_0x788235['stack']);if(_0x788235[_0xd6e1('0x28')]){delete _0x788235['name'];}_0x110942[_0xd6e1('0x1a')](_0x230c57)[_0xd6e1('0x29')](_0x788235);};}exports['index']=function(_0x2d4591,_0x577815){var _0x4a140b={},_0x17d170={},_0x180a13={'count':0x0,'rows':[]};var _0x3bd17b=_[_0xd6e1('0x2a')](db['Template'][_0xd6e1('0x2b')],function(_0x570f9a){return{'name':_0x570f9a[_0xd6e1('0x2c')],'type':_0x570f9a[_0xd6e1('0x2d')][_0xd6e1('0x2e')]};});_0x17d170[_0xd6e1('0x2f')]=_[_0xd6e1('0x2a')](_0x3bd17b,_0xd6e1('0x28'));_0x17d170['query']=_[_0xd6e1('0x30')](_0x2d4591[_0xd6e1('0x31')]);_0x17d170['filters']=_[_0xd6e1('0x32')](_0x17d170[_0xd6e1('0x2f')],_0x17d170[_0xd6e1('0x31')]);_0x4a140b[_0xd6e1('0x33')]=_[_0xd6e1('0x32')](_0x17d170['model'],qs[_0xd6e1('0x34')](_0x2d4591[_0xd6e1('0x31')][_0xd6e1('0x34')]));_0x4a140b[_0xd6e1('0x33')]=_0x4a140b[_0xd6e1('0x33')][_0xd6e1('0x35')]?_0x4a140b['attributes']:_0x17d170[_0xd6e1('0x2f')];if(!_0x2d4591[_0xd6e1('0x31')][_0xd6e1('0x36')](_0xd6e1('0x37'))){_0x4a140b[_0xd6e1('0x1d')]=qs['limit'](_0x2d4591['query'][_0xd6e1('0x1d')]);_0x4a140b[_0xd6e1('0x1f')]=qs[_0xd6e1('0x1f')](_0x2d4591[_0xd6e1('0x31')][_0xd6e1('0x1f')]);}_0x4a140b[_0xd6e1('0x38')]=qs['sort'](_0x2d4591[_0xd6e1('0x31')][_0xd6e1('0x39')]);_0x4a140b[_0xd6e1('0x3a')]=qs[_0xd6e1('0x3b')](_[_0xd6e1('0x3c')](_0x2d4591[_0xd6e1('0x31')],_0x17d170['filters']),_0x3bd17b);if(_0x2d4591[_0xd6e1('0x31')][_0xd6e1('0x3d')]){_0x4a140b[_0xd6e1('0x3a')]=_[_0xd6e1('0x3e')](_0x4a140b[_0xd6e1('0x3a')],{'$or':_[_0xd6e1('0x2a')](_0x3bd17b,function(_0x3e311c){if(_0x3e311c[_0xd6e1('0x2d')]!==_0xd6e1('0x3f')){var _0x3aa0ae={};_0x3aa0ae[_0x3e311c[_0xd6e1('0x28')]]={'$like':'%'+_0x2d4591[_0xd6e1('0x31')][_0xd6e1('0x3d')]+'%'};return _0x3aa0ae;}})});}_0x4a140b=_['merge']({},_0x4a140b,_0x2d4591[_0xd6e1('0x40')]);var _0x28c058={'where':_0x4a140b[_0xd6e1('0x3a')]};return db['Template'][_0xd6e1('0x1e')](_0x28c058)[_0xd6e1('0x24')](function(_0x4df7ff){_0x180a13[_0xd6e1('0x1e')]=_0x4df7ff;if(_0x2d4591[_0xd6e1('0x31')][_0xd6e1('0x41')]){_0x4a140b[_0xd6e1('0x42')]=[{'all':!![]}];}return db[_0xd6e1('0x43')][_0xd6e1('0x44')](_0x4a140b);})[_0xd6e1('0x24')](function(_0x5169e2){_0x180a13[_0xd6e1('0x45')]=_0x5169e2;return _0x180a13;})[_0xd6e1('0x24')](respondWithFilteredResult(_0x577815,_0x4a140b))[_0xd6e1('0x46')](handleError(_0x577815,null));};exports['show']=function(_0x20bca5,_0x443fc9){var _0x55084c={'raw':!![],'where':{'id':_0x20bca5[_0xd6e1('0x47')]['id']}},_0x798dfd={};_0x798dfd[_0xd6e1('0x2f')]=_[_0xd6e1('0x30')](db[_0xd6e1('0x43')][_0xd6e1('0x2b')]);_0x798dfd[_0xd6e1('0x31')]=_[_0xd6e1('0x30')](_0x20bca5[_0xd6e1('0x31')]);_0x798dfd[_0xd6e1('0x3b')]=_[_0xd6e1('0x32')](_0x798dfd[_0xd6e1('0x2f')],_0x798dfd[_0xd6e1('0x31')]);_0x55084c[_0xd6e1('0x33')]=_[_0xd6e1('0x32')](_0x798dfd[_0xd6e1('0x2f')],qs['fields'](_0x20bca5['query'][_0xd6e1('0x34')]));_0x55084c[_0xd6e1('0x33')]=_0x55084c['attributes'][_0xd6e1('0x35')]?_0x55084c[_0xd6e1('0x33')]:_0x798dfd[_0xd6e1('0x2f')];if(_0x20bca5['query']['includeAll']){_0x55084c[_0xd6e1('0x42')]=[{'all':!![]}];}_0x55084c=_[_0xd6e1('0x3e')]({},_0x55084c,_0x20bca5[_0xd6e1('0x40')]);return db[_0xd6e1('0x43')]['find'](_0x55084c)[_0xd6e1('0x24')](handleEntityNotFound(_0x443fc9,null))[_0xd6e1('0x24')](respondWithResult(_0x443fc9,null))[_0xd6e1('0x46')](handleError(_0x443fc9,null));};exports[_0xd6e1('0x48')]=function(_0x4a398d,_0x4d79f0){return db[_0xd6e1('0x43')]['create'](_0x4a398d[_0xd6e1('0x49')],{})[_0xd6e1('0x24')](function(_0x35747a){var _0x1ad66d=_0x4a398d['user']['get']({'plain':!![]});if(!_0x1ad66d)throw new Error(_0xd6e1('0x4a'));if(_0x1ad66d['role']==='user'){var _0x1e9568=_0x35747a[_0xd6e1('0x25')]({'plain':!![]});var _0x355ec5=_0xd6e1('0x26');return db['UserProfileSection'][_0xd6e1('0x4b')]({'where':{'name':_0x355ec5,'userProfileId':_0x1ad66d['userProfileId']},'raw':!![]})[_0xd6e1('0x24')](function(_0x496b93){if(_0x496b93&&_0x496b93[_0xd6e1('0x4c')]===0x0){return db[_0xd6e1('0x4d')][_0xd6e1('0x48')]({'name':_0x1e9568['name'],'resourceId':_0x1e9568['id'],'type':_0x496b93[_0xd6e1('0x28')],'sectionId':_0x496b93['id']},{})[_0xd6e1('0x24')](function(){return _0x35747a;});}else{return _0x35747a;}})['catch'](function(_0x25fddb){logger[_0xd6e1('0x4e')](_0xd6e1('0x4f'),_0x25fddb);throw _0x25fddb;});}return _0x35747a;})[_0xd6e1('0x24')](respondWithResult(_0x4d79f0,0xc9))[_0xd6e1('0x46')](handleError(_0x4d79f0,null));};exports[_0xd6e1('0x50')]=function(_0x44d61b,_0x4774f3){if(_0x44d61b[_0xd6e1('0x49')]['id']){delete _0x44d61b[_0xd6e1('0x49')]['id'];}return db[_0xd6e1('0x43')][_0xd6e1('0x4b')]({'where':{'id':_0x44d61b[_0xd6e1('0x47')]['id']}})[_0xd6e1('0x24')](handleEntityNotFound(_0x4774f3,null))[_0xd6e1('0x24')](saveUpdates(_0x44d61b[_0xd6e1('0x49')],null))['then'](respondWithResult(_0x4774f3,null))[_0xd6e1('0x46')](handleError(_0x4774f3,null));};exports['destroy']=function(_0x3e9170,_0x2a9147){return db[_0xd6e1('0x43')]['find']({'where':{'id':_0x3e9170['params']['id']}})[_0xd6e1('0x24')](handleEntityNotFound(_0x2a9147,null))[_0xd6e1('0x24')](removeEntity(_0x2a9147,null))[_0xd6e1('0x46')](handleError(_0x2a9147,null));}; \ No newline at end of file +var _0x3abd=['include','findAll','rows','catch','show','rawAttributes','length','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','save','then','destroy','get','Templates','error','stack','name','index','map','Template','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3abd,0x1b1));var _0xd3ab=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x3abd[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0xd3ab('0x0'));var rimraf=require(_0xd3ab('0x1'));var zipdir=require(_0xd3ab('0x2'));var jsonpatch=require(_0xd3ab('0x3'));var rp=require(_0xd3ab('0x4'));var moment=require(_0xd3ab('0x5'));var BPromise=require(_0xd3ab('0x6'));var Mustache=require(_0xd3ab('0x7'));var util=require(_0xd3ab('0x8'));var path=require(_0xd3ab('0x9'));var sox=require(_0xd3ab('0xa'));var csv=require('to-csv');var ejs=require(_0xd3ab('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3ab('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd3ab('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd3ab('0xe'));var Papa=require(_0xd3ab('0xf'));var Redis=require(_0xd3ab('0x10'));var authService=require(_0xd3ab('0x11'));var qs=require(_0xd3ab('0x12'));var as=require(_0xd3ab('0x13'));var hardwareService=require(_0xd3ab('0x14'));var logger=require(_0xd3ab('0x15'))(_0xd3ab('0x16'));var utils=require(_0xd3ab('0x17'));var config=require(_0xd3ab('0x18'));var licenseUtil=require(_0xd3ab('0x19'));var db=require(_0xd3ab('0x1a'))['db'];function respondWithStatusCode(_0x40f3ab,_0x27ecac){_0x27ecac=_0x27ecac||0xcc;return function(_0x318200){if(_0x318200){return _0x40f3ab[_0xd3ab('0x1b')](_0x27ecac);}return _0x40f3ab[_0xd3ab('0x1c')](_0x27ecac)[_0xd3ab('0x1d')]();};}function respondWithResult(_0xe3f016,_0x4bcd47){_0x4bcd47=_0x4bcd47||0xc8;return function(_0x16955c){if(_0x16955c){return _0xe3f016[_0xd3ab('0x1c')](_0x4bcd47)[_0xd3ab('0x1e')](_0x16955c);}};}function respondWithFilteredResult(_0x1fb2a6,_0x22a66f){return function(_0x24df12){if(_0x24df12){var _0x446fc9=typeof _0x22a66f['offset']===_0xd3ab('0x1f')&&typeof _0x22a66f['limit']==='undefined';var _0x2e4fa5=_0x24df12['count'];var _0x3a8fe1=_0x446fc9?0x0:_0x22a66f[_0xd3ab('0x20')];var _0x6f098=_0x446fc9?_0x24df12['count']:_0x22a66f[_0xd3ab('0x20')]+_0x22a66f[_0xd3ab('0x21')];var _0x2f22bc;if(_0x6f098>=_0x2e4fa5){_0x6f098=_0x2e4fa5;_0x2f22bc=0xc8;}else{_0x2f22bc=0xce;}_0x1fb2a6[_0xd3ab('0x1c')](_0x2f22bc);return _0x1fb2a6[_0xd3ab('0x22')](_0xd3ab('0x23'),_0x3a8fe1+'-'+_0x6f098+'/'+_0x2e4fa5)[_0xd3ab('0x1e')](_0x24df12);}return null;};}function patchUpdates(_0x291ec6){return function(_0x4e8883){try{jsonpatch['apply'](_0x4e8883,_0x291ec6,!![]);}catch(_0x3624ee){return BPromise['reject'](_0x3624ee);}return _0x4e8883[_0xd3ab('0x24')]();};}function saveUpdates(_0x4111eb,_0x4e47c0){return function(_0x53bad5){if(_0x53bad5){return _0x53bad5['update'](_0x4111eb)[_0xd3ab('0x25')](function(_0x134c15){return _0x134c15;});}return null;};}function removeEntity(_0x415883,_0x2c5b44){return function(_0x2e97a9){if(_0x2e97a9){return _0x2e97a9[_0xd3ab('0x26')]()['then'](function(){var _0x4f65a3=_0x2e97a9[_0xd3ab('0x27')]({'plain':!![]});var _0x35d43d=_0xd3ab('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x35d43d,'resourceId':_0x4f65a3['id']}})[_0xd3ab('0x25')](function(){return _0x2e97a9;});})[_0xd3ab('0x25')](function(){_0x415883['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x193ae1,_0x20a508){return function(_0x15f7b){if(!_0x15f7b){_0x193ae1[_0xd3ab('0x1b')](0x194);}return _0x15f7b;};}function handleError(_0x389bdb,_0x202bbe){_0x202bbe=_0x202bbe||0x1f4;return function(_0x3f6649){logger[_0xd3ab('0x29')](_0x3f6649[_0xd3ab('0x2a')]);if(_0x3f6649[_0xd3ab('0x2b')]){delete _0x3f6649[_0xd3ab('0x2b')];}_0x389bdb[_0xd3ab('0x1c')](_0x202bbe)['send'](_0x3f6649);};}exports[_0xd3ab('0x2c')]=function(_0x57d4bf,_0x5d7acb){var _0x326635={},_0x1a738a={},_0x1be23c={'count':0x0,'rows':[]};var _0x1bfafe=_[_0xd3ab('0x2d')](db[_0xd3ab('0x2e')]['rawAttributes'],function(_0x18fcec){return{'name':_0x18fcec[_0xd3ab('0x2f')],'type':_0x18fcec[_0xd3ab('0x30')][_0xd3ab('0x31')]};});_0x1a738a['model']=_[_0xd3ab('0x2d')](_0x1bfafe,'name');_0x1a738a['query']=_[_0xd3ab('0x32')](_0x57d4bf['query']);_0x1a738a[_0xd3ab('0x33')]=_[_0xd3ab('0x34')](_0x1a738a[_0xd3ab('0x35')],_0x1a738a[_0xd3ab('0x36')]);_0x326635[_0xd3ab('0x37')]=_[_0xd3ab('0x34')](_0x1a738a[_0xd3ab('0x35')],qs[_0xd3ab('0x38')](_0x57d4bf[_0xd3ab('0x36')]['fields']));_0x326635[_0xd3ab('0x37')]=_0x326635[_0xd3ab('0x37')]['length']?_0x326635[_0xd3ab('0x37')]:_0x1a738a['model'];if(!_0x57d4bf[_0xd3ab('0x36')]['hasOwnProperty'](_0xd3ab('0x39'))){_0x326635[_0xd3ab('0x21')]=qs[_0xd3ab('0x21')](_0x57d4bf['query']['limit']);_0x326635[_0xd3ab('0x20')]=qs['offset'](_0x57d4bf['query'][_0xd3ab('0x20')]);}_0x326635['order']=qs['sort'](_0x57d4bf[_0xd3ab('0x36')][_0xd3ab('0x3a')]);_0x326635['where']=qs['filters'](_[_0xd3ab('0x3b')](_0x57d4bf[_0xd3ab('0x36')],_0x1a738a[_0xd3ab('0x33')]),_0x1bfafe);if(_0x57d4bf['query'][_0xd3ab('0x3c')]){_0x326635[_0xd3ab('0x3d')]=_[_0xd3ab('0x3e')](_0x326635[_0xd3ab('0x3d')],{'$or':_[_0xd3ab('0x2d')](_0x1bfafe,function(_0x4dc4fc){if(_0x4dc4fc[_0xd3ab('0x30')]!==_0xd3ab('0x3f')){var _0x208aa0={};_0x208aa0[_0x4dc4fc[_0xd3ab('0x2b')]]={'$like':'%'+_0x57d4bf['query']['filter']+'%'};return _0x208aa0;}})});}_0x326635=_['merge']({},_0x326635,_0x57d4bf[_0xd3ab('0x40')]);var _0x4df5d1={'where':_0x326635[_0xd3ab('0x3d')]};return db['Template']['count'](_0x4df5d1)[_0xd3ab('0x25')](function(_0x223c5){_0x1be23c['count']=_0x223c5;if(_0x57d4bf['query']['includeAll']){_0x326635[_0xd3ab('0x41')]=[{'all':!![]}];}return db[_0xd3ab('0x2e')][_0xd3ab('0x42')](_0x326635);})[_0xd3ab('0x25')](function(_0x3af0f5){_0x1be23c[_0xd3ab('0x43')]=_0x3af0f5;return _0x1be23c;})['then'](respondWithFilteredResult(_0x5d7acb,_0x326635))[_0xd3ab('0x44')](handleError(_0x5d7acb,null));};exports[_0xd3ab('0x45')]=function(_0x56e19d,_0x39a6da){var _0x22552f={'raw':!![],'where':{'id':_0x56e19d['params']['id']}},_0x4a5f2a={};_0x4a5f2a[_0xd3ab('0x35')]=_[_0xd3ab('0x32')](db[_0xd3ab('0x2e')][_0xd3ab('0x46')]);_0x4a5f2a[_0xd3ab('0x36')]=_[_0xd3ab('0x32')](_0x56e19d['query']);_0x4a5f2a[_0xd3ab('0x33')]=_[_0xd3ab('0x34')](_0x4a5f2a[_0xd3ab('0x35')],_0x4a5f2a[_0xd3ab('0x36')]);_0x22552f['attributes']=_[_0xd3ab('0x34')](_0x4a5f2a[_0xd3ab('0x35')],qs[_0xd3ab('0x38')](_0x56e19d[_0xd3ab('0x36')]['fields']));_0x22552f[_0xd3ab('0x37')]=_0x22552f[_0xd3ab('0x37')][_0xd3ab('0x47')]?_0x22552f[_0xd3ab('0x37')]:_0x4a5f2a['model'];if(_0x56e19d[_0xd3ab('0x36')]['includeAll']){_0x22552f[_0xd3ab('0x41')]=[{'all':!![]}];}_0x22552f=_[_0xd3ab('0x3e')]({},_0x22552f,_0x56e19d[_0xd3ab('0x40')]);return db[_0xd3ab('0x2e')][_0xd3ab('0x48')](_0x22552f)[_0xd3ab('0x25')](handleEntityNotFound(_0x39a6da,null))['then'](respondWithResult(_0x39a6da,null))[_0xd3ab('0x44')](handleError(_0x39a6da,null));};exports['create']=function(_0x310bfe,_0x3495bc){return db[_0xd3ab('0x2e')][_0xd3ab('0x49')](_0x310bfe[_0xd3ab('0x4a')],{})[_0xd3ab('0x25')](function(_0x2386ce){var _0x532067=_0x310bfe[_0xd3ab('0x4b')][_0xd3ab('0x27')]({'plain':!![]});if(!_0x532067)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x532067[_0xd3ab('0x4c')]===_0xd3ab('0x4b')){var _0x17aa32=_0x2386ce[_0xd3ab('0x27')]({'plain':!![]});var _0x13055d=_0xd3ab('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x13055d,'userProfileId':_0x532067[_0xd3ab('0x4d')]},'raw':!![]})[_0xd3ab('0x25')](function(_0xbcdaa0){if(_0xbcdaa0&&_0xbcdaa0[_0xd3ab('0x4e')]===0x0){return db[_0xd3ab('0x4f')][_0xd3ab('0x49')]({'name':_0x17aa32['name'],'resourceId':_0x17aa32['id'],'type':_0xbcdaa0[_0xd3ab('0x2b')],'sectionId':_0xbcdaa0['id']},{})[_0xd3ab('0x25')](function(){return _0x2386ce;});}else{return _0x2386ce;}})[_0xd3ab('0x44')](function(_0x566f28){logger[_0xd3ab('0x29')](_0xd3ab('0x50'),_0x566f28);throw _0x566f28;});}return _0x2386ce;})['then'](respondWithResult(_0x3495bc,0xc9))[_0xd3ab('0x44')](handleError(_0x3495bc,null));};exports[_0xd3ab('0x51')]=function(_0x231fa1,_0x2fef29){if(_0x231fa1[_0xd3ab('0x4a')]['id']){delete _0x231fa1[_0xd3ab('0x4a')]['id'];}return db['Template'][_0xd3ab('0x48')]({'where':{'id':_0x231fa1[_0xd3ab('0x52')]['id']}})[_0xd3ab('0x25')](handleEntityNotFound(_0x2fef29,null))[_0xd3ab('0x25')](saveUpdates(_0x231fa1['body'],null))[_0xd3ab('0x25')](respondWithResult(_0x2fef29,null))[_0xd3ab('0x44')](handleError(_0x2fef29,null));};exports[_0xd3ab('0x26')]=function(_0x9b30d,_0x4f24a5){return db[_0xd3ab('0x2e')][_0xd3ab('0x48')]({'where':{'id':_0x9b30d[_0xd3ab('0x52')]['id']}})[_0xd3ab('0x25')](handleEntityNotFound(_0x4f24a5,null))[_0xd3ab('0x25')](removeEntity(_0x4f24a5,null))[_0xd3ab('0x44')](handleError(_0x4f24a5,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 925df23..6f29f81 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 _0xc575=['path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1658cd,_0x2dadd1){var _0x1f1151=function(_0x1e9025){while(--_0x1e9025){_0x1658cd['push'](_0x1658cd['shift']());}};_0x1f1151(++_0x2dadd1);}(_0xc575,0xf5));var _0x5c57=function(_0x5618c4,_0x4e8f57){_0x5618c4=_0x5618c4-0x0;var _0xdf390f=_0xc575[_0x5618c4];return _0xdf390f;};'use strict';var _=require(_0x5c57('0x0'));var util=require(_0x5c57('0x1'));var logger=require(_0x5c57('0x2'))(_0x5c57('0x3'));var moment=require(_0x5c57('0x4'));var BPromise=require(_0x5c57('0x5'));var rp=require(_0x5c57('0x6'));var fs=require('fs');var path=require(_0x5c57('0x7'));var rimraf=require(_0x5c57('0x8'));var config=require(_0x5c57('0x9'));var attributes=require(_0x5c57('0xa'));module[_0x5c57('0xb')]=function(_0xea2f43,_0x12bdbc){return _0xea2f43[_0x5c57('0xc')]('Template',attributes,{'tableName':_0x5c57('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4f3=['define','Template','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xe4f3,0x183));var _0x3e4f=function(_0x5eca0e,_0x474ca3){_0x5eca0e=_0x5eca0e-0x0;var _0x1a1364=_0xe4f3[_0x5eca0e];return _0x1a1364;};'use strict';var _=require(_0x3e4f('0x0'));var util=require(_0x3e4f('0x1'));var logger=require(_0x3e4f('0x2'))('api');var moment=require(_0x3e4f('0x3'));var BPromise=require(_0x3e4f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e4f('0x5'));var rimraf=require(_0x3e4f('0x6'));var config=require(_0x3e4f('0x7'));var attributes=require('./template.attributes');module[_0x3e4f('0x8')]=function(_0x305d03,_0x54d540){return _0x305d03[_0x3e4f('0x9')](_0x3e4f('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index f93ba21..49aeb8b 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 _0x98a7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','map','include','model','lodash','util'];(function(_0x193a58,_0x1565a7){var _0x146e69=function(_0x19df6e){while(--_0x19df6e){_0x193a58['push'](_0x193a58['shift']());}};_0x146e69(++_0x1565a7);}(_0x98a7,0x116));var _0x798a=function(_0x30a66c,_0x3b001a){_0x30a66c=_0x30a66c-0x0;var _0x45077c=_0x98a7[_0x30a66c];return _0x45077c;};'use strict';var _=require(_0x798a('0x0'));var util=require(_0x798a('0x1'));var moment=require(_0x798a('0x2'));var BPromise=require(_0x798a('0x3'));var rs=require(_0x798a('0x4'));var fs=require('fs');var Redis=require(_0x798a('0x5'));var db=require(_0x798a('0x6'))['db'];var utils=require(_0x798a('0x7'));var logger=require(_0x798a('0x8'))('rpc');var config=require(_0x798a('0x9'));var jayson=require(_0x798a('0xa'));var client=jayson[_0x798a('0xb')][_0x798a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c616f,_0x299c6d,_0x1d0dbd){return new BPromise(function(_0x1ba7c0,_0x220797){return client[_0x798a('0xd')](_0x1c616f,_0x1d0dbd)[_0x798a('0xe')](function(_0x342f2e){logger[_0x798a('0xf')]('Template,\x20%s,\x20%s',_0x299c6d,'request\x20sent');logger[_0x798a('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x299c6d,_0x798a('0x11'),JSON[_0x798a('0x12')](_0x342f2e));if(_0x342f2e[_0x798a('0x13')]){if(_0x342f2e[_0x798a('0x13')][_0x798a('0x14')]===0x1f4){logger[_0x798a('0x13')](_0x798a('0x15'),_0x299c6d,_0x342f2e[_0x798a('0x13')][_0x798a('0x16')]);return _0x220797(_0x342f2e[_0x798a('0x13')][_0x798a('0x16')]);}logger['error'](_0x798a('0x15'),_0x299c6d,_0x342f2e['error'][_0x798a('0x16')]);return _0x1ba7c0(_0x342f2e[_0x798a('0x13')][_0x798a('0x16')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x299c6d,'request\x20sent');_0x1ba7c0(_0x342f2e[_0x798a('0x17')][_0x798a('0x16')]);}})[_0x798a('0x18')](function(_0x3b8ae4){logger[_0x798a('0x13')](_0x798a('0x15'),_0x299c6d,_0x3b8ae4);_0x220797(_0x3b8ae4);});});}exports[_0x798a('0x19')]=function(_0x124592){var _0x5427ec=this;return new Promise(function(_0x5cb560,_0x56b933){return db[_0x798a('0x1a')][_0x798a('0x1b')]({'raw':_0x124592[_0x798a('0x1c')]?_0x124592[_0x798a('0x1c')][_0x798a('0x1d')]===undefined?!![]:![]:!![],'where':_0x124592[_0x798a('0x1c')]?_0x124592['options'][_0x798a('0x1e')]||null:null,'attributes':_0x124592[_0x798a('0x1c')]?_0x124592['options'][_0x798a('0x1f')]||null:null,'limit':_0x124592[_0x798a('0x1c')]?_0x124592[_0x798a('0x1c')]['limit']||null:null,'include':_0x124592[_0x798a('0x1c')]?_0x124592[_0x798a('0x1c')]['include']?_[_0x798a('0x20')](_0x124592[_0x798a('0x1c')][_0x798a('0x21')],function(_0x27d422){return{'model':db[_0x27d422[_0x798a('0x22')]],'as':_0x27d422['as'],'attributes':_0x27d422[_0x798a('0x1f')],'include':_0x27d422['include']?_[_0x798a('0x20')](_0x27d422[_0x798a('0x21')],function(_0x311e00){return{'model':db[_0x311e00[_0x798a('0x22')]],'as':_0x311e00['as'],'attributes':_0x311e00['attributes'],'include':_0x311e00[_0x798a('0x21')]?_[_0x798a('0x20')](_0x311e00['include'],function(_0x2fdecf){return{'model':db[_0x2fdecf[_0x798a('0x22')]],'as':_0x2fdecf['as'],'attributes':_0x2fdecf[_0x798a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x798a('0xe')](function(_0x27d5cd){logger[_0x798a('0xf')](_0x798a('0x19'),_0x124592);logger['debug']('GetTemplate',_0x124592,JSON[_0x798a('0x12')](_0x27d5cd));_0x5cb560(_0x27d5cd);})['catch'](function(_0x152e7e){logger['error'](_0x798a('0x19'),_0x152e7e[_0x798a('0x16')],_0x124592);_0x56b933(_0x5427ec[_0x798a('0x13')](0x1f4,_0x152e7e[_0x798a('0x16')]));});});}; \ No newline at end of file +var _0x3cb9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x2ef251,_0x3bffd7){var _0x413806=function(_0xe44627){while(--_0xe44627){_0x2ef251['push'](_0x2ef251['shift']());}};_0x413806(++_0x3bffd7);}(_0x3cb9,0x12d));var _0x93cb=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x3cb9[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require(_0x93cb('0x0'));var moment=require(_0x93cb('0x1'));var BPromise=require('bluebird');var rs=require(_0x93cb('0x2'));var fs=require('fs');var Redis=require(_0x93cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93cb('0x4'));var logger=require(_0x93cb('0x5'))(_0x93cb('0x6'));var config=require(_0x93cb('0x7'));var jayson=require(_0x93cb('0x8'));var client=jayson['client'][_0x93cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1390ac,_0x3d4c0a,_0x573b9f){return new BPromise(function(_0x160a44,_0x3a5c91){return client[_0x93cb('0xa')](_0x1390ac,_0x573b9f)[_0x93cb('0xb')](function(_0x51bbb2){logger[_0x93cb('0xc')](_0x93cb('0xd'),_0x3d4c0a,_0x93cb('0xe'));logger[_0x93cb('0xf')](_0x93cb('0x10'),_0x3d4c0a,_0x93cb('0xe'),JSON[_0x93cb('0x11')](_0x51bbb2));if(_0x51bbb2['error']){if(_0x51bbb2[_0x93cb('0x12')][_0x93cb('0x13')]===0x1f4){logger['error'](_0x93cb('0xd'),_0x3d4c0a,_0x51bbb2[_0x93cb('0x12')][_0x93cb('0x14')]);return _0x3a5c91(_0x51bbb2[_0x93cb('0x12')][_0x93cb('0x14')]);}logger[_0x93cb('0x12')](_0x93cb('0xd'),_0x3d4c0a,_0x51bbb2[_0x93cb('0x12')]['message']);return _0x160a44(_0x51bbb2[_0x93cb('0x12')]['message']);}else{logger[_0x93cb('0xc')](_0x93cb('0xd'),_0x3d4c0a,_0x93cb('0xe'));_0x160a44(_0x51bbb2[_0x93cb('0x15')][_0x93cb('0x14')]);}})[_0x93cb('0x16')](function(_0x132dd6){logger[_0x93cb('0x12')](_0x93cb('0xd'),_0x3d4c0a,_0x132dd6);_0x3a5c91(_0x132dd6);});});}exports[_0x93cb('0x17')]=function(_0x218f5f){var _0x98737c=this;return new Promise(function(_0xf16089,_0x3e6f14){return db[_0x93cb('0x18')][_0x93cb('0x19')]({'raw':_0x218f5f[_0x93cb('0x1a')]?_0x218f5f[_0x93cb('0x1a')][_0x93cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x218f5f[_0x93cb('0x1a')]?_0x218f5f[_0x93cb('0x1a')][_0x93cb('0x1c')]||null:null,'attributes':_0x218f5f[_0x93cb('0x1a')]?_0x218f5f[_0x93cb('0x1a')][_0x93cb('0x1d')]||null:null,'limit':_0x218f5f[_0x93cb('0x1a')]?_0x218f5f[_0x93cb('0x1a')][_0x93cb('0x1e')]||null:null,'include':_0x218f5f[_0x93cb('0x1a')]?_0x218f5f['options'][_0x93cb('0x1f')]?_[_0x93cb('0x20')](_0x218f5f['options'][_0x93cb('0x1f')],function(_0x30170c){return{'model':db[_0x30170c[_0x93cb('0x21')]],'as':_0x30170c['as'],'attributes':_0x30170c[_0x93cb('0x1d')],'include':_0x30170c[_0x93cb('0x1f')]?_['map'](_0x30170c[_0x93cb('0x1f')],function(_0x100de0){return{'model':db[_0x100de0[_0x93cb('0x21')]],'as':_0x100de0['as'],'attributes':_0x100de0[_0x93cb('0x1d')],'include':_0x100de0[_0x93cb('0x1f')]?_[_0x93cb('0x20')](_0x100de0[_0x93cb('0x1f')],function(_0x5d1c76){return{'model':db[_0x5d1c76['model']],'as':_0x5d1c76['as'],'attributes':_0x5d1c76[_0x93cb('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5afd51){logger['info'](_0x93cb('0x17'),_0x218f5f);logger[_0x93cb('0xf')](_0x93cb('0x17'),_0x218f5f,JSON['stringify'](_0x5afd51));_0xf16089(_0x5afd51);})[_0x93cb('0x16')](function(_0x54c21c){logger[_0x93cb('0x12')](_0x93cb('0x17'),_0x54c21c[_0x93cb('0x14')],_0x218f5f);_0x3e6f14(_0x98737c[_0x93cb('0x12')](0x1f4,_0x54c21c[_0x93cb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 02545c0..339fc68 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 _0xcfd1=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/:id','show','/:id/all_conditions','isAuthenticated','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAction','put'];(function(_0x27856c,_0x2961ce){var _0x4594e4=function(_0x460b36){while(--_0x460b36){_0x27856c['push'](_0x27856c['shift']());}};_0x4594e4(++_0x2961ce);}(_0xcfd1,0x1b8));var _0x1cfd=function(_0x5deea8,_0x58117f){_0x5deea8=_0x5deea8-0x0;var _0x1d4b0e=_0xcfd1[_0x5deea8];return _0x1d4b0e;};'use strict';var multer=require(_0x1cfd('0x0'));var util=require(_0x1cfd('0x1'));var path=require(_0x1cfd('0x2'));var timeout=require(_0x1cfd('0x3'));var express=require('express');var router=express[_0x1cfd('0x4')]();var fs_extra=require(_0x1cfd('0x5'));var auth=require(_0x1cfd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x1cfd('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cfd('0x8')]);router[_0x1cfd('0x7')](_0x1cfd('0x9'),auth['isAuthenticated'](),controller[_0x1cfd('0xa')]);router[_0x1cfd('0x7')](_0x1cfd('0xb'),auth[_0x1cfd('0xc')](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0x1cfd('0xc')](),controller[_0x1cfd('0xd')]);router['get'](_0x1cfd('0xe'),auth[_0x1cfd('0xc')](),controller[_0x1cfd('0xf')]);router[_0x1cfd('0x10')]('/',auth[_0x1cfd('0xc')](),controller['create']);router[_0x1cfd('0x10')](_0x1cfd('0xb'),auth['isAuthenticated'](),controller[_0x1cfd('0x11')]);router[_0x1cfd('0x10')]('/:id/any_conditions',auth[_0x1cfd('0xc')](),controller['addAnyCondition']);router[_0x1cfd('0x10')](_0x1cfd('0xe'),auth[_0x1cfd('0xc')](),controller[_0x1cfd('0x12')]);router[_0x1cfd('0x13')](_0x1cfd('0x9'),auth[_0x1cfd('0xc')](),controller[_0x1cfd('0x14')]);router['delete'](_0x1cfd('0x9'),auth[_0x1cfd('0xc')](),controller[_0x1cfd('0x15')]);module[_0x1cfd('0x16')]=router; \ No newline at end of file +var _0xa226=['show','/:id/all_conditions','isAuthenticated','/:id/any_conditions','/:id/actions','getActions','post','create','addAction','put','/:id','delete','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','index'];(function(_0x97ca17,_0x3d3d36){var _0x34f6cd=function(_0x45207b){while(--_0x45207b){_0x97ca17['push'](_0x97ca17['shift']());}};_0x34f6cd(++_0x3d3d36);}(_0xa226,0x64));var _0x6a22=function(_0x11b41d,_0x506a79){_0x11b41d=_0x11b41d-0x0;var _0x416e17=_0xa226[_0x11b41d];return _0x416e17;};'use strict';var multer=require('multer');var util=require(_0x6a22('0x0'));var path=require('path');var timeout=require(_0x6a22('0x1'));var express=require(_0x6a22('0x2'));var router=express[_0x6a22('0x3')]();var fs_extra=require(_0x6a22('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a22('0x5'));var config=require(_0x6a22('0x6'));var controller=require(_0x6a22('0x7'));router[_0x6a22('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a22('0x9')]);router[_0x6a22('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6a22('0xa')]);router[_0x6a22('0x8')](_0x6a22('0xb'),auth[_0x6a22('0xc')](),controller['getAllConditions']);router[_0x6a22('0x8')](_0x6a22('0xd'),auth[_0x6a22('0xc')](),controller['getAnyConditions']);router['get'](_0x6a22('0xe'),auth[_0x6a22('0xc')](),controller[_0x6a22('0xf')]);router[_0x6a22('0x10')]('/',auth[_0x6a22('0xc')](),controller[_0x6a22('0x11')]);router[_0x6a22('0x10')](_0x6a22('0xb'),auth[_0x6a22('0xc')](),controller['addAllCondition']);router[_0x6a22('0x10')](_0x6a22('0xd'),auth[_0x6a22('0xc')](),controller['addAnyCondition']);router[_0x6a22('0x10')](_0x6a22('0xe'),auth[_0x6a22('0xc')](),controller[_0x6a22('0x12')]);router[_0x6a22('0x13')](_0x6a22('0x14'),auth[_0x6a22('0xc')](),controller['update']);router[_0x6a22('0x15')]('/:id',auth[_0x6a22('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 4f26b45..46298fa 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 _0x194e=['STRING','BOOLEAN','sequelize','exports'];(function(_0xa49c67,_0x11d5b5){var _0x51630b=function(_0x204100){while(--_0x204100){_0xa49c67['push'](_0xa49c67['shift']());}};_0x51630b(++_0x11d5b5);}(_0x194e,0x1a2));var _0xe194=function(_0x4ba76a,_0x729a1){_0x4ba76a=_0x4ba76a-0x0;var _0x3c1d7b=_0x194e[_0x4ba76a];return _0x3c1d7b;};'use strict';var Sequelize=require(_0xe194('0x0'));module[_0xe194('0x1')]={'name':{'type':Sequelize[_0xe194('0x2')]},'channel':{'type':Sequelize[_0xe194('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xe194('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdfc5=['BOOLEAN','sequelize','exports','STRING'];(function(_0x22cb0f,_0x37c81a){var _0x51317f=function(_0x68e3b0){while(--_0x68e3b0){_0x22cb0f['push'](_0x22cb0f['shift']());}};_0x51317f(++_0x37c81a);}(_0xdfc5,0xa1));var _0x5dfc=function(_0x2c7a13,_0x22acbf){_0x2c7a13=_0x2c7a13-0x0;var _0x1ee3cf=_0xdfc5[_0x2c7a13];return _0x1ee3cf;};'use strict';var Sequelize=require(_0x5dfc('0x0'));module[_0x5dfc('0x1')]={'name':{'type':Sequelize[_0x5dfc('0x2')]},'channel':{'type':Sequelize[_0x5dfc('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5dfc('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 f89fbb5..fa86f24 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 _0xeaac=['nolimit','sort','where','pick','filter','merge','map','options','includeAll','findAll','catch','show','params','include','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','order','getAllConditions','getAnyConditions','getActions','Action','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','Trigger','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x12f104,_0x57cb37){var _0x38a6c2=function(_0x1c8f5b){while(--_0x1c8f5b){_0x12f104['push'](_0x12f104['shift']());}};_0x38a6c2(++_0x57cb37);}(_0xeaac,0x1dc));var _0xceaa=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xeaac[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xceaa('0x0'));var rimraf=require(_0xceaa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xceaa('0x2'));var Mustache=require(_0xceaa('0x3'));var util=require(_0xceaa('0x4'));var path=require(_0xceaa('0x5'));var sox=require(_0xceaa('0x6'));var csv=require(_0xceaa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xceaa('0x8'));var _=require('lodash');var squel=require(_0xceaa('0x9'));var crypto=require('crypto');var jsforce=require(_0xceaa('0xa'));var deskjs=require(_0xceaa('0xb'));var toCsv=require(_0xceaa('0x7'));var querystring=require(_0xceaa('0xc'));var Papa=require(_0xceaa('0xd'));var Redis=require('ioredis');var authService=require(_0xceaa('0xe'));var qs=require(_0xceaa('0xf'));var as=require(_0xceaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xceaa('0x11'));var utils=require(_0xceaa('0x12'));var config=require(_0xceaa('0x13'));var licenseUtil=require(_0xceaa('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422ba4,_0x8d26a){_0x8d26a=_0x8d26a||0xcc;return function(_0x11b786){if(_0x11b786){return _0x422ba4[_0xceaa('0x15')](_0x8d26a);}return _0x422ba4[_0xceaa('0x16')](_0x8d26a)[_0xceaa('0x17')]();};}function respondWithResult(_0x18d257,_0x392846){_0x392846=_0x392846||0xc8;return function(_0x122fc4){if(_0x122fc4){return _0x18d257['status'](_0x392846)['json'](_0x122fc4);}};}function respondWithFilteredResult(_0x258a55,_0x1baffc){return function(_0x518792){if(_0x518792){var _0x5172f2=typeof _0x1baffc[_0xceaa('0x18')]===_0xceaa('0x19')&&typeof _0x1baffc[_0xceaa('0x1a')]===_0xceaa('0x19');var _0xbc84bf=_0x518792[_0xceaa('0x1b')];var _0x14f069=_0x5172f2?0x0:_0x1baffc[_0xceaa('0x18')];var _0x4a7be5=_0x5172f2?_0x518792[_0xceaa('0x1b')]:_0x1baffc[_0xceaa('0x18')]+_0x1baffc[_0xceaa('0x1a')];var _0x5191fc;if(_0x4a7be5>=_0xbc84bf){_0x4a7be5=_0xbc84bf;_0x5191fc=0xc8;}else{_0x5191fc=0xce;}_0x258a55['status'](_0x5191fc);return _0x258a55[_0xceaa('0x1c')](_0xceaa('0x1d'),_0x14f069+'-'+_0x4a7be5+'/'+_0xbc84bf)[_0xceaa('0x1e')](_0x518792);}return null;};}function patchUpdates(_0x5195d5){return function(_0x30cfef){try{jsonpatch['apply'](_0x30cfef,_0x5195d5,!![]);}catch(_0x207a11){return BPromise[_0xceaa('0x1f')](_0x207a11);}return _0x30cfef[_0xceaa('0x20')]();};}function saveUpdates(_0x1b17b5,_0x5e0c24){return function(_0x1006af){if(_0x1006af){return _0x1006af[_0xceaa('0x21')](_0x1b17b5)[_0xceaa('0x22')](function(_0x179da0){return _0x179da0;});}return null;};}function removeEntity(_0x10514c,_0x4d593b){return function(_0x33a067){if(_0x33a067){return _0x33a067['destroy']()[_0xceaa('0x22')](function(){var _0x433dfe=_0x33a067['get']({'plain':!![]});var _0xf6853b='Triggers';return db['UserProfileResource'][_0xceaa('0x23')]({'where':{'type':_0xf6853b,'resourceId':_0x433dfe['id']}})[_0xceaa('0x22')](function(){return _0x33a067;});})[_0xceaa('0x22')](function(){_0x10514c[_0xceaa('0x16')](0xcc)[_0xceaa('0x17')]();});}};}function handleEntityNotFound(_0x42522c,_0x53c93f){return function(_0x17f1e2){if(!_0x17f1e2){_0x42522c[_0xceaa('0x15')](0x194);}return _0x17f1e2;};}function handleError(_0x30f874,_0x80ed94){_0x80ed94=_0x80ed94||0x1f4;return function(_0x303147){logger[_0xceaa('0x24')](_0x303147[_0xceaa('0x25')]);if(_0x303147[_0xceaa('0x26')]){delete _0x303147[_0xceaa('0x26')];}_0x30f874[_0xceaa('0x16')](_0x80ed94)['send'](_0x303147);};}exports[_0xceaa('0x27')]=function(_0x1b9b7c,_0x1822e2){var _0x1d4c33={},_0x2f7d56={},_0x9464af={'count':0x0,'rows':[]};var _0x1cc430=_['map'](db[_0xceaa('0x28')][_0xceaa('0x29')],function(_0x5d2e2e){return{'name':_0x5d2e2e['fieldName'],'type':_0x5d2e2e[_0xceaa('0x2a')]['key']};});_0x2f7d56[_0xceaa('0x2b')]=_['map'](_0x1cc430,_0xceaa('0x26'));_0x2f7d56[_0xceaa('0x2c')]=_[_0xceaa('0x2d')](_0x1b9b7c[_0xceaa('0x2c')]);_0x2f7d56[_0xceaa('0x2e')]=_[_0xceaa('0x2f')](_0x2f7d56[_0xceaa('0x2b')],_0x2f7d56[_0xceaa('0x2c')]);_0x1d4c33[_0xceaa('0x30')]=_['intersection'](_0x2f7d56[_0xceaa('0x2b')],qs[_0xceaa('0x31')](_0x1b9b7c[_0xceaa('0x2c')]['fields']));_0x1d4c33['attributes']=_0x1d4c33[_0xceaa('0x30')][_0xceaa('0x32')]?_0x1d4c33[_0xceaa('0x30')]:_0x2f7d56[_0xceaa('0x2b')];if(!_0x1b9b7c['query'][_0xceaa('0x33')](_0xceaa('0x34'))){_0x1d4c33[_0xceaa('0x1a')]=qs[_0xceaa('0x1a')](_0x1b9b7c[_0xceaa('0x2c')][_0xceaa('0x1a')]);_0x1d4c33['offset']=qs[_0xceaa('0x18')](_0x1b9b7c['query'][_0xceaa('0x18')]);}_0x1d4c33['order']=qs[_0xceaa('0x35')](_0x1b9b7c[_0xceaa('0x2c')][_0xceaa('0x35')]);_0x1d4c33[_0xceaa('0x36')]=qs[_0xceaa('0x2e')](_[_0xceaa('0x37')](_0x1b9b7c[_0xceaa('0x2c')],_0x2f7d56[_0xceaa('0x2e')]),_0x1cc430);if(_0x1b9b7c[_0xceaa('0x2c')][_0xceaa('0x38')]){_0x1d4c33[_0xceaa('0x36')]=_[_0xceaa('0x39')](_0x1d4c33[_0xceaa('0x36')],{'$or':_[_0xceaa('0x3a')](_0x1cc430,function(_0x575640){if(_0x575640[_0xceaa('0x2a')]!=='VIRTUAL'){var _0x235c75={};_0x235c75[_0x575640['name']]={'$like':'%'+_0x1b9b7c[_0xceaa('0x2c')][_0xceaa('0x38')]+'%'};return _0x235c75;}})});}_0x1d4c33=_[_0xceaa('0x39')]({},_0x1d4c33,_0x1b9b7c[_0xceaa('0x3b')]);var _0x3a9449={'where':_0x1d4c33['where']};return db['Trigger'][_0xceaa('0x1b')](_0x3a9449)[_0xceaa('0x22')](function(_0x98264){_0x9464af['count']=_0x98264;if(_0x1b9b7c['query'][_0xceaa('0x3c')]){_0x1d4c33['include']=[{'all':!![]}];}return db[_0xceaa('0x28')][_0xceaa('0x3d')](_0x1d4c33);})['then'](function(_0x3ecf92){_0x9464af['rows']=_0x3ecf92;return _0x9464af;})[_0xceaa('0x22')](respondWithFilteredResult(_0x1822e2,_0x1d4c33))[_0xceaa('0x3e')](handleError(_0x1822e2,null));};exports[_0xceaa('0x3f')]=function(_0x3458ce,_0x3188a5){var _0x279e75={'raw':![],'where':{'id':_0x3458ce[_0xceaa('0x40')]['id']}},_0x46acf5={};_0x46acf5[_0xceaa('0x2b')]=_[_0xceaa('0x2d')](db[_0xceaa('0x28')][_0xceaa('0x29')]);_0x46acf5[_0xceaa('0x2c')]=_[_0xceaa('0x2d')](_0x3458ce[_0xceaa('0x2c')]);_0x46acf5['filters']=_[_0xceaa('0x2f')](_0x46acf5['model'],_0x46acf5['query']);_0x279e75[_0xceaa('0x30')]=_[_0xceaa('0x2f')](_0x46acf5[_0xceaa('0x2b')],qs[_0xceaa('0x31')](_0x3458ce[_0xceaa('0x2c')]['fields']));_0x279e75[_0xceaa('0x30')]=_0x279e75[_0xceaa('0x30')][_0xceaa('0x32')]?_0x279e75['attributes']:_0x46acf5['model'];if(_0x3458ce[_0xceaa('0x2c')]['includeAll']){_0x279e75[_0xceaa('0x41')]=[{'all':!![]}];}_0x279e75=_[_0xceaa('0x39')]({},_0x279e75,_0x3458ce[_0xceaa('0x3b')]);return db[_0xceaa('0x28')]['find'](_0x279e75)[_0xceaa('0x22')](handleEntityNotFound(_0x3188a5,null))[_0xceaa('0x22')](respondWithResult(_0x3188a5,null))[_0xceaa('0x3e')](handleError(_0x3188a5,null));};exports['create']=function(_0x20a93c,_0x3a1b6a){return db['Trigger']['create'](_0x20a93c[_0xceaa('0x42')],{})[_0xceaa('0x22')](function(_0x256fef){var _0x3bd9f5=_0x20a93c[_0xceaa('0x43')][_0xceaa('0x44')]({'plain':!![]});if(!_0x3bd9f5)throw new Error(_0xceaa('0x45'));if(_0x3bd9f5['role']==='user'){var _0x2f0ac5=_0x256fef[_0xceaa('0x44')]({'plain':!![]});var _0x50ce3f=_0xceaa('0x46');return db[_0xceaa('0x47')][_0xceaa('0x48')]({'where':{'name':_0x50ce3f,'userProfileId':_0x3bd9f5[_0xceaa('0x49')]},'raw':!![]})[_0xceaa('0x22')](function(_0x1b4896){if(_0x1b4896&&_0x1b4896[_0xceaa('0x4a')]===0x0){return db[_0xceaa('0x4b')][_0xceaa('0x4c')]({'name':_0x2f0ac5['name'],'resourceId':_0x2f0ac5['id'],'type':_0x1b4896[_0xceaa('0x26')],'sectionId':_0x1b4896['id']},{})['then'](function(){return _0x256fef;});}else{return _0x256fef;}})[_0xceaa('0x3e')](function(_0x44435a){logger[_0xceaa('0x24')](_0xceaa('0x4d'),_0x44435a);throw _0x44435a;});}return _0x256fef;})[_0xceaa('0x22')](respondWithResult(_0x3a1b6a,0xc9))['catch'](handleError(_0x3a1b6a,null));};exports[_0xceaa('0x21')]=function(_0x4c1c56,_0x153716){if(_0x4c1c56[_0xceaa('0x42')]['id']){delete _0x4c1c56['body']['id'];}return db[_0xceaa('0x28')][_0xceaa('0x48')]({'where':{'id':_0x4c1c56[_0xceaa('0x40')]['id']}})[_0xceaa('0x22')](handleEntityNotFound(_0x153716,null))[_0xceaa('0x22')](saveUpdates(_0x4c1c56['body'],null))[_0xceaa('0x22')](respondWithResult(_0x153716,null))[_0xceaa('0x3e')](handleError(_0x153716,null));};exports['destroy']=function(_0xba6634,_0x49c101){return db[_0xceaa('0x28')][_0xceaa('0x48')]({'where':{'id':_0xba6634[_0xceaa('0x40')]['id']}})[_0xceaa('0x22')](handleEntityNotFound(_0x49c101,null))[_0xceaa('0x22')](removeEntity(_0x49c101,null))['catch'](handleError(_0x49c101,null));};exports[_0xceaa('0x4e')]=function(_0x18d2a6,_0x3186a3,_0x4f8f23){if(_0x18d2a6[_0xceaa('0x42')]['id']){delete _0x18d2a6['body']['id'];}return db[_0xceaa('0x28')]['find']({'where':{'id':_0x18d2a6[_0xceaa('0x40')]['id']}})[_0xceaa('0x22')](handleEntityNotFound(_0x3186a3,null))[_0xceaa('0x22')](function(_0x4d3634){if(_0x4d3634){_0x18d2a6['body'][_0xceaa('0x4f')]=_0x4d3634['id'];return db[_0xceaa('0x50')][_0xceaa('0x4c')](_0x18d2a6[_0xceaa('0x42')]);}})[_0xceaa('0x22')](respondWithResult(_0x3186a3,null))[_0xceaa('0x3e')](handleError(_0x3186a3,null));};exports['addAnyCondition']=function(_0x389d60,_0xfe4ce4,_0x42beec){if(_0x389d60[_0xceaa('0x42')]['id']){delete _0x389d60['body']['id'];}return db[_0xceaa('0x28')][_0xceaa('0x48')]({'where':{'id':_0x389d60[_0xceaa('0x40')]['id']}})[_0xceaa('0x22')](handleEntityNotFound(_0xfe4ce4,null))[_0xceaa('0x22')](function(_0x3013b4){if(_0x3013b4){_0x389d60[_0xceaa('0x42')][_0xceaa('0x51')]=_0x3013b4['id'];return db[_0xceaa('0x50')]['create'](_0x389d60[_0xceaa('0x42')]);}})[_0xceaa('0x22')](respondWithResult(_0xfe4ce4,null))['catch'](handleError(_0xfe4ce4,null));};exports['getAllConditions']=function(_0x2b276a,_0x42b8e5,_0x2a8b84){var _0x546082={};var _0x56279b={};var _0x44c1aa;var _0x44c451;return db[_0xceaa('0x28')][_0xceaa('0x52')]({'where':{'id':_0x2b276a[_0xceaa('0x40')]['id']}})[_0xceaa('0x22')](handleEntityNotFound(_0x42b8e5,null))[_0xceaa('0x22')](function(_0x25008e){if(_0x25008e){_0x44c1aa=_0x25008e;_0x56279b['model']=_[_0xceaa('0x2d')](db[_0xceaa('0x50')][_0xceaa('0x29')]);_0x56279b[_0xceaa('0x2c')]=_['keys'](_0x2b276a[_0xceaa('0x2c')]);_0x56279b[_0xceaa('0x2e')]=_[_0xceaa('0x2f')](_0x56279b[_0xceaa('0x2b')],_0x56279b[_0xceaa('0x2c')]);_0x546082[_0xceaa('0x30')]=_[_0xceaa('0x2f')](_0x56279b['model'],qs[_0xceaa('0x31')](_0x2b276a[_0xceaa('0x2c')][_0xceaa('0x31')]));_0x546082[_0xceaa('0x30')]=_0x546082['attributes'][_0xceaa('0x32')]?_0x546082[_0xceaa('0x30')]:_0x56279b[_0xceaa('0x2b')];_0x546082[_0xceaa('0x53')]=qs[_0xceaa('0x35')](_0x2b276a[_0xceaa('0x2c')][_0xceaa('0x35')]);_0x546082[_0xceaa('0x36')]=qs[_0xceaa('0x2e')](_[_0xceaa('0x37')](_0x2b276a[_0xceaa('0x2c')],_0x56279b[_0xceaa('0x2e')]));if(_0x2b276a[_0xceaa('0x2c')]['filter']){_0x546082['where']=_['merge'](_0x546082[_0xceaa('0x36')],{'$or':_[_0xceaa('0x3a')](_0x546082[_0xceaa('0x30')],function(_0x2f3be9){var _0x40e050={};_0x40e050[_0x2f3be9]={'$like':'%'+_0x2b276a[_0xceaa('0x2c')][_0xceaa('0x38')]+'%'};return _0x40e050;})});}_0x546082=_['merge']({},_0x546082,_0x2b276a['options']);return _0x44c1aa[_0xceaa('0x54')](_0x546082);}})['then'](function(_0x54d7a6){if(_0x54d7a6){_0x44c451=_0x54d7a6[_0xceaa('0x32')];if(!_0x2b276a[_0xceaa('0x2c')][_0xceaa('0x33')](_0xceaa('0x34'))){_0x546082['limit']=qs[_0xceaa('0x1a')](_0x2b276a[_0xceaa('0x2c')]['limit']);_0x546082[_0xceaa('0x18')]=qs[_0xceaa('0x18')](_0x2b276a[_0xceaa('0x2c')]['offset']);}return _0x44c1aa[_0xceaa('0x54')](_0x546082);}})[_0xceaa('0x22')](function(_0x317984){if(_0x317984){return _0x317984?{'count':_0x44c451,'rows':_0x317984}:null;}})['then'](respondWithResult(_0x42b8e5,null))[_0xceaa('0x3e')](handleError(_0x42b8e5,null));};exports['getAnyConditions']=function(_0xbc8713,_0x5d7c78,_0x13274e){var _0xa18fb5={};var _0x3fc246={};var _0x1d4f9e;var _0x58a3a8;return db[_0xceaa('0x28')]['findOne']({'where':{'id':_0xbc8713[_0xceaa('0x40')]['id']}})[_0xceaa('0x22')](handleEntityNotFound(_0x5d7c78,null))['then'](function(_0x12b956){if(_0x12b956){_0x1d4f9e=_0x12b956;_0x3fc246[_0xceaa('0x2b')]=_[_0xceaa('0x2d')](db[_0xceaa('0x50')]['rawAttributes']);_0x3fc246[_0xceaa('0x2c')]=_[_0xceaa('0x2d')](_0xbc8713['query']);_0x3fc246[_0xceaa('0x2e')]=_[_0xceaa('0x2f')](_0x3fc246['model'],_0x3fc246[_0xceaa('0x2c')]);_0xa18fb5['attributes']=_['intersection'](_0x3fc246[_0xceaa('0x2b')],qs['fields'](_0xbc8713[_0xceaa('0x2c')][_0xceaa('0x31')]));_0xa18fb5['attributes']=_0xa18fb5['attributes'][_0xceaa('0x32')]?_0xa18fb5[_0xceaa('0x30')]:_0x3fc246[_0xceaa('0x2b')];_0xa18fb5['order']=qs['sort'](_0xbc8713[_0xceaa('0x2c')][_0xceaa('0x35')]);_0xa18fb5[_0xceaa('0x36')]=qs[_0xceaa('0x2e')](_['pick'](_0xbc8713['query'],_0x3fc246[_0xceaa('0x2e')]));if(_0xbc8713[_0xceaa('0x2c')][_0xceaa('0x38')]){_0xa18fb5[_0xceaa('0x36')]=_[_0xceaa('0x39')](_0xa18fb5[_0xceaa('0x36')],{'$or':_[_0xceaa('0x3a')](_0xa18fb5[_0xceaa('0x30')],function(_0x16e414){var _0x11b0c1={};_0x11b0c1[_0x16e414]={'$like':'%'+_0xbc8713[_0xceaa('0x2c')][_0xceaa('0x38')]+'%'};return _0x11b0c1;})});}_0xa18fb5=_[_0xceaa('0x39')]({},_0xa18fb5,_0xbc8713[_0xceaa('0x3b')]);return _0x1d4f9e[_0xceaa('0x55')](_0xa18fb5);}})['then'](function(_0x10a166){if(_0x10a166){_0x58a3a8=_0x10a166['length'];if(!_0xbc8713['query'][_0xceaa('0x33')](_0xceaa('0x34'))){_0xa18fb5['limit']=qs[_0xceaa('0x1a')](_0xbc8713['query']['limit']);_0xa18fb5[_0xceaa('0x18')]=qs[_0xceaa('0x18')](_0xbc8713[_0xceaa('0x2c')][_0xceaa('0x18')]);}return _0x1d4f9e[_0xceaa('0x55')](_0xa18fb5);}})[_0xceaa('0x22')](function(_0x2abb5a){if(_0x2abb5a){return _0x2abb5a?{'count':_0x58a3a8,'rows':_0x2abb5a}:null;}})[_0xceaa('0x22')](respondWithResult(_0x5d7c78,null))[_0xceaa('0x3e')](handleError(_0x5d7c78,null));};exports['addAction']=function(_0x35596c,_0x29d689,_0x450aaa){if(_0x35596c[_0xceaa('0x42')]['id']){delete _0x35596c[_0xceaa('0x42')]['id'];}return db[_0xceaa('0x28')][_0xceaa('0x48')]({'where':{'id':_0x35596c[_0xceaa('0x40')]['id']}})[_0xceaa('0x22')](handleEntityNotFound(_0x29d689,null))[_0xceaa('0x22')](function(_0x3d7546){if(_0x3d7546){_0x35596c[_0xceaa('0x42')]['TriggerId']=_0x3d7546['id'];return db['Action'][_0xceaa('0x4c')](_0x35596c[_0xceaa('0x42')]);}})[_0xceaa('0x22')](respondWithResult(_0x29d689,null))[_0xceaa('0x3e')](handleError(_0x29d689,null));};exports[_0xceaa('0x56')]=function(_0xd5ab89,_0x479906,_0x1d52eb){var _0x1a4563={};var _0x2bc9e4={};var _0x1e1865;var _0x2d5c0b;return db[_0xceaa('0x28')][_0xceaa('0x52')]({'where':{'id':_0xd5ab89[_0xceaa('0x40')]['id']}})[_0xceaa('0x22')](handleEntityNotFound(_0x479906,null))[_0xceaa('0x22')](function(_0x1f028c){if(_0x1f028c){_0x1e1865=_0x1f028c;_0x2bc9e4['model']=_[_0xceaa('0x2d')](db[_0xceaa('0x57')][_0xceaa('0x29')]);_0x2bc9e4[_0xceaa('0x2c')]=_['keys'](_0xd5ab89['query']);_0x2bc9e4[_0xceaa('0x2e')]=_[_0xceaa('0x2f')](_0x2bc9e4[_0xceaa('0x2b')],_0x2bc9e4[_0xceaa('0x2c')]);_0x1a4563[_0xceaa('0x30')]=_['intersection'](_0x2bc9e4[_0xceaa('0x2b')],qs[_0xceaa('0x31')](_0xd5ab89[_0xceaa('0x2c')][_0xceaa('0x31')]));_0x1a4563[_0xceaa('0x30')]=_0x1a4563[_0xceaa('0x30')][_0xceaa('0x32')]?_0x1a4563['attributes']:_0x2bc9e4[_0xceaa('0x2b')];_0x1a4563[_0xceaa('0x53')]=qs[_0xceaa('0x35')](_0xd5ab89[_0xceaa('0x2c')]['sort']);_0x1a4563[_0xceaa('0x36')]=qs[_0xceaa('0x2e')](_['pick'](_0xd5ab89[_0xceaa('0x2c')],_0x2bc9e4[_0xceaa('0x2e')]));if(_0xd5ab89[_0xceaa('0x2c')][_0xceaa('0x38')]){_0x1a4563[_0xceaa('0x36')]=_[_0xceaa('0x39')](_0x1a4563[_0xceaa('0x36')],{'$or':_[_0xceaa('0x3a')](_0x1a4563['attributes'],function(_0x3b3993){var _0x5d265e={};_0x5d265e[_0x3b3993]={'$like':'%'+_0xd5ab89['query'][_0xceaa('0x38')]+'%'};return _0x5d265e;})});}_0x1a4563=_[_0xceaa('0x39')]({},_0x1a4563,_0xd5ab89['options']);return _0x1e1865['getActions'](_0x1a4563);}})['then'](function(_0x51cd31){if(_0x51cd31){_0x2d5c0b=_0x51cd31[_0xceaa('0x32')];if(!_0xd5ab89[_0xceaa('0x2c')]['hasOwnProperty'](_0xceaa('0x34'))){_0x1a4563['limit']=qs[_0xceaa('0x1a')](_0xd5ab89[_0xceaa('0x2c')][_0xceaa('0x1a')]);_0x1a4563['offset']=qs['offset'](_0xd5ab89['query'][_0xceaa('0x18')]);}return _0x1e1865['getActions'](_0x1a4563);}})['then'](function(_0x4c3d30){if(_0x4c3d30){return _0x4c3d30?{'count':_0x2d5c0b,'rows':_0x4c3d30}:null;}})[_0xceaa('0x22')](respondWithResult(_0x479906,null))[_0xceaa('0x3e')](handleError(_0x479906,null));}; \ No newline at end of file +var _0x86b8=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','getAnyConditions','nolimit','addAction','getActions','findOne','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','Trigger','rows','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x86b8,0x71));var _0x886b=function(_0x490e24,_0x121a0e){_0x490e24=_0x490e24-0x0;var _0x2ace4e=_0x86b8[_0x490e24];return _0x2ace4e;};'use strict';var emlformat=require(_0x886b('0x0'));var rimraf=require(_0x886b('0x1'));var zipdir=require(_0x886b('0x2'));var jsonpatch=require(_0x886b('0x3'));var rp=require(_0x886b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x886b('0x5'));var util=require('util');var path=require(_0x886b('0x6'));var sox=require(_0x886b('0x7'));var csv=require(_0x886b('0x8'));var ejs=require(_0x886b('0x9'));var fs=require('fs');var fs_extra=require(_0x886b('0xa'));var _=require(_0x886b('0xb'));var squel=require(_0x886b('0xc'));var crypto=require(_0x886b('0xd'));var jsforce=require(_0x886b('0xe'));var deskjs=require(_0x886b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x886b('0x10'));var Papa=require(_0x886b('0x11'));var Redis=require(_0x886b('0x12'));var authService=require(_0x886b('0x13'));var qs=require(_0x886b('0x14'));var as=require(_0x886b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x886b('0x16'));var utils=require(_0x886b('0x17'));var config=require(_0x886b('0x18'));var licenseUtil=require(_0x886b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10963d,_0x24c675){_0x24c675=_0x24c675||0xcc;return function(_0x3a24a3){if(_0x3a24a3){return _0x10963d[_0x886b('0x1a')](_0x24c675);}return _0x10963d['status'](_0x24c675)[_0x886b('0x1b')]();};}function respondWithResult(_0xff36f5,_0xb6fa99){_0xb6fa99=_0xb6fa99||0xc8;return function(_0x331b3d){if(_0x331b3d){return _0xff36f5['status'](_0xb6fa99)[_0x886b('0x1c')](_0x331b3d);}};}function respondWithFilteredResult(_0x171f55,_0x18b1e1){return function(_0x22da70){if(_0x22da70){var _0x1f0e34=typeof _0x18b1e1[_0x886b('0x1d')]===_0x886b('0x1e')&&typeof _0x18b1e1[_0x886b('0x1f')]===_0x886b('0x1e');var _0x4cfdc5=_0x22da70[_0x886b('0x20')];var _0xae8a09=_0x1f0e34?0x0:_0x18b1e1[_0x886b('0x1d')];var _0xc34466=_0x1f0e34?_0x22da70[_0x886b('0x20')]:_0x18b1e1[_0x886b('0x1d')]+_0x18b1e1[_0x886b('0x1f')];var _0x5bce65;if(_0xc34466>=_0x4cfdc5){_0xc34466=_0x4cfdc5;_0x5bce65=0xc8;}else{_0x5bce65=0xce;}_0x171f55[_0x886b('0x21')](_0x5bce65);return _0x171f55['set'](_0x886b('0x22'),_0xae8a09+'-'+_0xc34466+'/'+_0x4cfdc5)['json'](_0x22da70);}return null;};}function patchUpdates(_0x185443){return function(_0x418501){try{jsonpatch[_0x886b('0x23')](_0x418501,_0x185443,!![]);}catch(_0x7e578c){return BPromise[_0x886b('0x24')](_0x7e578c);}return _0x418501[_0x886b('0x25')]();};}function saveUpdates(_0x2c7004,_0x212ca8){return function(_0x4ae430){if(_0x4ae430){return _0x4ae430['update'](_0x2c7004)['then'](function(_0xb1c5d3){return _0xb1c5d3;});}return null;};}function removeEntity(_0x526b4d,_0x5e1b1c){return function(_0x5af548){if(_0x5af548){return _0x5af548['destroy']()[_0x886b('0x26')](function(){var _0x50e10a=_0x5af548[_0x886b('0x27')]({'plain':!![]});var _0xae889c=_0x886b('0x28');return db[_0x886b('0x29')][_0x886b('0x2a')]({'where':{'type':_0xae889c,'resourceId':_0x50e10a['id']}})[_0x886b('0x26')](function(){return _0x5af548;});})[_0x886b('0x26')](function(){_0x526b4d['status'](0xcc)[_0x886b('0x1b')]();});}};}function handleEntityNotFound(_0x377316,_0x143ef7){return function(_0x39f918){if(!_0x39f918){_0x377316['sendStatus'](0x194);}return _0x39f918;};}function handleError(_0x16e9ff,_0x12bcb0){_0x12bcb0=_0x12bcb0||0x1f4;return function(_0x409745){logger[_0x886b('0x2b')](_0x409745[_0x886b('0x2c')]);if(_0x409745[_0x886b('0x2d')]){delete _0x409745[_0x886b('0x2d')];}_0x16e9ff[_0x886b('0x21')](_0x12bcb0)[_0x886b('0x2e')](_0x409745);};}exports['index']=function(_0x100fc3,_0x228034){var _0x256466={},_0x2d959b={},_0x24536f={'count':0x0,'rows':[]};var _0x5008fb=_['map'](db['Trigger'][_0x886b('0x2f')],function(_0x49a8f4){return{'name':_0x49a8f4[_0x886b('0x30')],'type':_0x49a8f4[_0x886b('0x31')][_0x886b('0x32')]};});_0x2d959b[_0x886b('0x33')]=_[_0x886b('0x34')](_0x5008fb,_0x886b('0x2d'));_0x2d959b['query']=_['keys'](_0x100fc3[_0x886b('0x35')]);_0x2d959b[_0x886b('0x36')]=_[_0x886b('0x37')](_0x2d959b[_0x886b('0x33')],_0x2d959b[_0x886b('0x35')]);_0x256466[_0x886b('0x38')]=_[_0x886b('0x37')](_0x2d959b[_0x886b('0x33')],qs['fields'](_0x100fc3['query'][_0x886b('0x39')]));_0x256466[_0x886b('0x38')]=_0x256466[_0x886b('0x38')][_0x886b('0x3a')]?_0x256466[_0x886b('0x38')]:_0x2d959b[_0x886b('0x33')];if(!_0x100fc3[_0x886b('0x35')][_0x886b('0x3b')]('nolimit')){_0x256466[_0x886b('0x1f')]=qs[_0x886b('0x1f')](_0x100fc3[_0x886b('0x35')]['limit']);_0x256466[_0x886b('0x1d')]=qs[_0x886b('0x1d')](_0x100fc3[_0x886b('0x35')][_0x886b('0x1d')]);}_0x256466[_0x886b('0x3c')]=qs[_0x886b('0x3d')](_0x100fc3['query'][_0x886b('0x3d')]);_0x256466['where']=qs[_0x886b('0x36')](_[_0x886b('0x3e')](_0x100fc3['query'],_0x2d959b['filters']),_0x5008fb);if(_0x100fc3[_0x886b('0x35')]['filter']){_0x256466[_0x886b('0x3f')]=_[_0x886b('0x40')](_0x256466['where'],{'$or':_['map'](_0x5008fb,function(_0x30d8f3){if(_0x30d8f3['type']!==_0x886b('0x41')){var _0x26458={};_0x26458[_0x30d8f3[_0x886b('0x2d')]]={'$like':'%'+_0x100fc3['query'][_0x886b('0x42')]+'%'};return _0x26458;}})});}_0x256466=_[_0x886b('0x40')]({},_0x256466,_0x100fc3['options']);var _0x58fc11={'where':_0x256466['where']};return db['Trigger'][_0x886b('0x20')](_0x58fc11)[_0x886b('0x26')](function(_0x1ec02e){_0x24536f[_0x886b('0x20')]=_0x1ec02e;if(_0x100fc3[_0x886b('0x35')][_0x886b('0x43')]){_0x256466[_0x886b('0x44')]=[{'all':!![]}];}return db[_0x886b('0x45')]['findAll'](_0x256466);})[_0x886b('0x26')](function(_0x3e8e6e){_0x24536f[_0x886b('0x46')]=_0x3e8e6e;return _0x24536f;})[_0x886b('0x26')](respondWithFilteredResult(_0x228034,_0x256466))[_0x886b('0x47')](handleError(_0x228034,null));};exports[_0x886b('0x48')]=function(_0x35d280,_0x4e948){var _0x23d7bf={'raw':![],'where':{'id':_0x35d280[_0x886b('0x49')]['id']}},_0x12b5e3={};_0x12b5e3[_0x886b('0x33')]=_[_0x886b('0x4a')](db[_0x886b('0x45')]['rawAttributes']);_0x12b5e3[_0x886b('0x35')]=_[_0x886b('0x4a')](_0x35d280['query']);_0x12b5e3['filters']=_['intersection'](_0x12b5e3['model'],_0x12b5e3[_0x886b('0x35')]);_0x23d7bf[_0x886b('0x38')]=_[_0x886b('0x37')](_0x12b5e3[_0x886b('0x33')],qs[_0x886b('0x39')](_0x35d280[_0x886b('0x35')]['fields']));_0x23d7bf[_0x886b('0x38')]=_0x23d7bf['attributes'][_0x886b('0x3a')]?_0x23d7bf['attributes']:_0x12b5e3['model'];if(_0x35d280[_0x886b('0x35')][_0x886b('0x43')]){_0x23d7bf[_0x886b('0x44')]=[{'all':!![]}];}_0x23d7bf=_[_0x886b('0x40')]({},_0x23d7bf,_0x35d280[_0x886b('0x4b')]);return db['Trigger'][_0x886b('0x4c')](_0x23d7bf)['then'](handleEntityNotFound(_0x4e948,null))[_0x886b('0x26')](respondWithResult(_0x4e948,null))[_0x886b('0x47')](handleError(_0x4e948,null));};exports['create']=function(_0x72a328,_0x4139ed){return db['Trigger'][_0x886b('0x4d')](_0x72a328['body'],{})[_0x886b('0x26')](function(_0x42257e){var _0x5eb57a=_0x72a328[_0x886b('0x4e')][_0x886b('0x27')]({'plain':!![]});if(!_0x5eb57a)throw new Error(_0x886b('0x4f'));if(_0x5eb57a[_0x886b('0x50')]===_0x886b('0x4e')){var _0x5d46fd=_0x42257e[_0x886b('0x27')]({'plain':!![]});var _0x5d0afd=_0x886b('0x28');return db[_0x886b('0x51')][_0x886b('0x4c')]({'where':{'name':_0x5d0afd,'userProfileId':_0x5eb57a[_0x886b('0x52')]},'raw':!![]})[_0x886b('0x26')](function(_0x35c0ed){if(_0x35c0ed&&_0x35c0ed[_0x886b('0x53')]===0x0){return db[_0x886b('0x29')][_0x886b('0x4d')]({'name':_0x5d46fd[_0x886b('0x2d')],'resourceId':_0x5d46fd['id'],'type':_0x35c0ed['name'],'sectionId':_0x35c0ed['id']},{})[_0x886b('0x26')](function(){return _0x42257e;});}else{return _0x42257e;}})['catch'](function(_0x42e9ec){logger[_0x886b('0x2b')](_0x886b('0x54'),_0x42e9ec);throw _0x42e9ec;});}return _0x42257e;})[_0x886b('0x26')](respondWithResult(_0x4139ed,0xc9))['catch'](handleError(_0x4139ed,null));};exports[_0x886b('0x55')]=function(_0xe0e888,_0x2dcda0){if(_0xe0e888[_0x886b('0x56')]['id']){delete _0xe0e888[_0x886b('0x56')]['id'];}return db['Trigger'][_0x886b('0x4c')]({'where':{'id':_0xe0e888['params']['id']}})[_0x886b('0x26')](handleEntityNotFound(_0x2dcda0,null))[_0x886b('0x26')](saveUpdates(_0xe0e888['body'],null))[_0x886b('0x26')](respondWithResult(_0x2dcda0,null))[_0x886b('0x47')](handleError(_0x2dcda0,null));};exports['destroy']=function(_0x369134,_0x559b7a){return db['Trigger']['find']({'where':{'id':_0x369134['params']['id']}})[_0x886b('0x26')](handleEntityNotFound(_0x559b7a,null))['then'](removeEntity(_0x559b7a,null))[_0x886b('0x47')](handleError(_0x559b7a,null));};exports[_0x886b('0x57')]=function(_0x305ea4,_0x481af3,_0x17a4c6){if(_0x305ea4[_0x886b('0x56')]['id']){delete _0x305ea4[_0x886b('0x56')]['id'];}return db['Trigger']['find']({'where':{'id':_0x305ea4[_0x886b('0x49')]['id']}})[_0x886b('0x26')](handleEntityNotFound(_0x481af3,null))[_0x886b('0x26')](function(_0x51e521){if(_0x51e521){_0x305ea4['body'][_0x886b('0x58')]=_0x51e521['id'];return db[_0x886b('0x59')][_0x886b('0x4d')](_0x305ea4['body']);}})[_0x886b('0x26')](respondWithResult(_0x481af3,null))[_0x886b('0x47')](handleError(_0x481af3,null));};exports['addAnyCondition']=function(_0x3cb0a7,_0x123404,_0x5e7b72){if(_0x3cb0a7[_0x886b('0x56')]['id']){delete _0x3cb0a7['body']['id'];}return db[_0x886b('0x45')]['find']({'where':{'id':_0x3cb0a7['params']['id']}})[_0x886b('0x26')](handleEntityNotFound(_0x123404,null))[_0x886b('0x26')](function(_0x965dc7){if(_0x965dc7){_0x3cb0a7[_0x886b('0x56')][_0x886b('0x5a')]=_0x965dc7['id'];return db[_0x886b('0x59')][_0x886b('0x4d')](_0x3cb0a7[_0x886b('0x56')]);}})[_0x886b('0x26')](respondWithResult(_0x123404,null))['catch'](handleError(_0x123404,null));};exports[_0x886b('0x5b')]=function(_0x52237d,_0x56697d,_0x1e47af){var _0x4cb9ba={};var _0x2ddb02={};var _0x1291c8;var _0x40e319;return db[_0x886b('0x45')]['findOne']({'where':{'id':_0x52237d[_0x886b('0x49')]['id']}})['then'](handleEntityNotFound(_0x56697d,null))[_0x886b('0x26')](function(_0xbb4502){if(_0xbb4502){_0x1291c8=_0xbb4502;_0x2ddb02[_0x886b('0x33')]=_[_0x886b('0x4a')](db[_0x886b('0x59')][_0x886b('0x2f')]);_0x2ddb02['query']=_[_0x886b('0x4a')](_0x52237d['query']);_0x2ddb02[_0x886b('0x36')]=_[_0x886b('0x37')](_0x2ddb02[_0x886b('0x33')],_0x2ddb02[_0x886b('0x35')]);_0x4cb9ba[_0x886b('0x38')]=_['intersection'](_0x2ddb02[_0x886b('0x33')],qs['fields'](_0x52237d[_0x886b('0x35')][_0x886b('0x39')]));_0x4cb9ba[_0x886b('0x38')]=_0x4cb9ba['attributes'][_0x886b('0x3a')]?_0x4cb9ba[_0x886b('0x38')]:_0x2ddb02[_0x886b('0x33')];_0x4cb9ba[_0x886b('0x3c')]=qs[_0x886b('0x3d')](_0x52237d['query']['sort']);_0x4cb9ba[_0x886b('0x3f')]=qs[_0x886b('0x36')](_[_0x886b('0x3e')](_0x52237d['query'],_0x2ddb02[_0x886b('0x36')]));if(_0x52237d[_0x886b('0x35')][_0x886b('0x42')]){_0x4cb9ba[_0x886b('0x3f')]=_[_0x886b('0x40')](_0x4cb9ba[_0x886b('0x3f')],{'$or':_[_0x886b('0x34')](_0x4cb9ba[_0x886b('0x38')],function(_0x2f9922){var _0xbe9d07={};_0xbe9d07[_0x2f9922]={'$like':'%'+_0x52237d[_0x886b('0x35')]['filter']+'%'};return _0xbe9d07;})});}_0x4cb9ba=_[_0x886b('0x40')]({},_0x4cb9ba,_0x52237d[_0x886b('0x4b')]);return _0x1291c8['getAllConditions'](_0x4cb9ba);}})[_0x886b('0x26')](function(_0x3b0b5b){if(_0x3b0b5b){_0x40e319=_0x3b0b5b[_0x886b('0x3a')];if(!_0x52237d[_0x886b('0x35')]['hasOwnProperty']('nolimit')){_0x4cb9ba['limit']=qs['limit'](_0x52237d['query'][_0x886b('0x1f')]);_0x4cb9ba[_0x886b('0x1d')]=qs['offset'](_0x52237d[_0x886b('0x35')][_0x886b('0x1d')]);}return _0x1291c8['getAllConditions'](_0x4cb9ba);}})[_0x886b('0x26')](function(_0x583718){if(_0x583718){return _0x583718?{'count':_0x40e319,'rows':_0x583718}:null;}})['then'](respondWithResult(_0x56697d,null))[_0x886b('0x47')](handleError(_0x56697d,null));};exports[_0x886b('0x5c')]=function(_0x1ea8b2,_0x2f8d49,_0x3f0f83){var _0x563277={};var _0x349189={};var _0x2c079f;var _0x45f150;return db['Trigger']['findOne']({'where':{'id':_0x1ea8b2['params']['id']}})[_0x886b('0x26')](handleEntityNotFound(_0x2f8d49,null))['then'](function(_0x102421){if(_0x102421){_0x2c079f=_0x102421;_0x349189[_0x886b('0x33')]=_[_0x886b('0x4a')](db[_0x886b('0x59')][_0x886b('0x2f')]);_0x349189[_0x886b('0x35')]=_[_0x886b('0x4a')](_0x1ea8b2['query']);_0x349189[_0x886b('0x36')]=_['intersection'](_0x349189[_0x886b('0x33')],_0x349189[_0x886b('0x35')]);_0x563277[_0x886b('0x38')]=_[_0x886b('0x37')](_0x349189[_0x886b('0x33')],qs['fields'](_0x1ea8b2[_0x886b('0x35')][_0x886b('0x39')]));_0x563277['attributes']=_0x563277[_0x886b('0x38')]['length']?_0x563277['attributes']:_0x349189[_0x886b('0x33')];_0x563277[_0x886b('0x3c')]=qs['sort'](_0x1ea8b2[_0x886b('0x35')][_0x886b('0x3d')]);_0x563277[_0x886b('0x3f')]=qs[_0x886b('0x36')](_['pick'](_0x1ea8b2['query'],_0x349189['filters']));if(_0x1ea8b2[_0x886b('0x35')]['filter']){_0x563277[_0x886b('0x3f')]=_[_0x886b('0x40')](_0x563277['where'],{'$or':_['map'](_0x563277['attributes'],function(_0x4e4b36){var _0x483c79={};_0x483c79[_0x4e4b36]={'$like':'%'+_0x1ea8b2['query'][_0x886b('0x42')]+'%'};return _0x483c79;})});}_0x563277=_['merge']({},_0x563277,_0x1ea8b2[_0x886b('0x4b')]);return _0x2c079f[_0x886b('0x5c')](_0x563277);}})['then'](function(_0x21b356){if(_0x21b356){_0x45f150=_0x21b356[_0x886b('0x3a')];if(!_0x1ea8b2[_0x886b('0x35')][_0x886b('0x3b')](_0x886b('0x5d'))){_0x563277['limit']=qs[_0x886b('0x1f')](_0x1ea8b2[_0x886b('0x35')][_0x886b('0x1f')]);_0x563277[_0x886b('0x1d')]=qs['offset'](_0x1ea8b2[_0x886b('0x35')][_0x886b('0x1d')]);}return _0x2c079f[_0x886b('0x5c')](_0x563277);}})['then'](function(_0x3dd401){if(_0x3dd401){return _0x3dd401?{'count':_0x45f150,'rows':_0x3dd401}:null;}})[_0x886b('0x26')](respondWithResult(_0x2f8d49,null))[_0x886b('0x47')](handleError(_0x2f8d49,null));};exports[_0x886b('0x5e')]=function(_0x292b99,_0x1ce3b9,_0x3d7bbd){if(_0x292b99[_0x886b('0x56')]['id']){delete _0x292b99['body']['id'];}return db[_0x886b('0x45')][_0x886b('0x4c')]({'where':{'id':_0x292b99['params']['id']}})[_0x886b('0x26')](handleEntityNotFound(_0x1ce3b9,null))[_0x886b('0x26')](function(_0x2006fe){if(_0x2006fe){_0x292b99['body']['TriggerId']=_0x2006fe['id'];return db['Action']['create'](_0x292b99[_0x886b('0x56')]);}})[_0x886b('0x26')](respondWithResult(_0x1ce3b9,null))['catch'](handleError(_0x1ce3b9,null));};exports[_0x886b('0x5f')]=function(_0x4e36df,_0x6eb891,_0x55c0e3){var _0x3c5363={};var _0x274f9c={};var _0x520993;var _0x2d79b2;return db[_0x886b('0x45')][_0x886b('0x60')]({'where':{'id':_0x4e36df[_0x886b('0x49')]['id']}})[_0x886b('0x26')](handleEntityNotFound(_0x6eb891,null))[_0x886b('0x26')](function(_0x4bee80){if(_0x4bee80){_0x520993=_0x4bee80;_0x274f9c['model']=_[_0x886b('0x4a')](db[_0x886b('0x61')]['rawAttributes']);_0x274f9c[_0x886b('0x35')]=_[_0x886b('0x4a')](_0x4e36df[_0x886b('0x35')]);_0x274f9c[_0x886b('0x36')]=_['intersection'](_0x274f9c['model'],_0x274f9c[_0x886b('0x35')]);_0x3c5363['attributes']=_[_0x886b('0x37')](_0x274f9c['model'],qs[_0x886b('0x39')](_0x4e36df[_0x886b('0x35')][_0x886b('0x39')]));_0x3c5363[_0x886b('0x38')]=_0x3c5363[_0x886b('0x38')][_0x886b('0x3a')]?_0x3c5363['attributes']:_0x274f9c[_0x886b('0x33')];_0x3c5363[_0x886b('0x3c')]=qs[_0x886b('0x3d')](_0x4e36df['query'][_0x886b('0x3d')]);_0x3c5363['where']=qs['filters'](_['pick'](_0x4e36df[_0x886b('0x35')],_0x274f9c['filters']));if(_0x4e36df['query'][_0x886b('0x42')]){_0x3c5363[_0x886b('0x3f')]=_[_0x886b('0x40')](_0x3c5363[_0x886b('0x3f')],{'$or':_[_0x886b('0x34')](_0x3c5363[_0x886b('0x38')],function(_0x30f2a8){var _0xeddf4e={};_0xeddf4e[_0x30f2a8]={'$like':'%'+_0x4e36df[_0x886b('0x35')][_0x886b('0x42')]+'%'};return _0xeddf4e;})});}_0x3c5363=_['merge']({},_0x3c5363,_0x4e36df[_0x886b('0x4b')]);return _0x520993['getActions'](_0x3c5363);}})[_0x886b('0x26')](function(_0x219311){if(_0x219311){_0x2d79b2=_0x219311[_0x886b('0x3a')];if(!_0x4e36df[_0x886b('0x35')][_0x886b('0x3b')](_0x886b('0x5d'))){_0x3c5363['limit']=qs[_0x886b('0x1f')](_0x4e36df[_0x886b('0x35')]['limit']);_0x3c5363[_0x886b('0x1d')]=qs[_0x886b('0x1d')](_0x4e36df[_0x886b('0x35')][_0x886b('0x1d')]);}return _0x520993[_0x886b('0x5f')](_0x3c5363);}})[_0x886b('0x26')](function(_0x3976d3){if(_0x3976d3){return _0x3976d3?{'count':_0x2d79b2,'rows':_0x3976d3}:null;}})[_0x886b('0x26')](respondWithResult(_0x6eb891,null))[_0x886b('0x47')](handleError(_0x6eb891,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f9d4df1..d9d4ec0 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 _0x4e00=['moment','path','../../config/environment','./trigger.attributes','exports','define','Trigger','util','api'];(function(_0x1deb7f,_0x3f4c2e){var _0x48dcd5=function(_0x548f9f){while(--_0x548f9f){_0x1deb7f['push'](_0x1deb7f['shift']());}};_0x48dcd5(++_0x3f4c2e);}(_0x4e00,0xa0));var _0x04e0=function(_0x3c1927,_0x3d5253){_0x3c1927=_0x3c1927-0x0;var _0x43a9bc=_0x4e00[_0x3c1927];return _0x43a9bc;};'use strict';var _=require('lodash');var util=require(_0x04e0('0x0'));var logger=require('../../config/logger')(_0x04e0('0x1'));var moment=require(_0x04e0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04e0('0x3'));var rimraf=require('rimraf');var config=require(_0x04e0('0x4'));var attributes=require(_0x04e0('0x5'));module[_0x04e0('0x6')]=function(_0x2a5402,_0x424fec){return _0x2a5402[_0x04e0('0x7')](_0x04e0('0x8'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ce1=['../../config/environment','exports','Trigger','api','moment','bluebird','request-promise','rimraf'];(function(_0x294b68,_0x3f0093){var _0x4b104b=function(_0x2037eb){while(--_0x2037eb){_0x294b68['push'](_0x294b68['shift']());}};_0x4b104b(++_0x3f0093);}(_0x2ce1,0x8b));var _0x12ce=function(_0xc8adc0,_0x288b25){_0xc8adc0=_0xc8adc0-0x0;var _0x2b4338=_0x2ce1[_0xc8adc0];return _0x2b4338;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x12ce('0x0'));var moment=require(_0x12ce('0x1'));var BPromise=require(_0x12ce('0x2'));var rp=require(_0x12ce('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12ce('0x4'));var config=require(_0x12ce('0x5'));var attributes=require('./trigger.attributes');module[_0x12ce('0x6')]=function(_0x15aa00,_0x36562a){return _0x15aa00['define'](_0x12ce('0x7'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 3cfcbb3..50fd1cb 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 _0x6ee6=['Trigger,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTrigger','Trigger','raw','options','attributes','limit','include','map','model','find','ShowTrigger','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6ee6,0x123));var _0x66ee=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0x6ee6[_0x2cacef];return _0x289ba6;};'use strict';var _=require(_0x66ee('0x0'));var util=require(_0x66ee('0x1'));var moment=require(_0x66ee('0x2'));var BPromise=require(_0x66ee('0x3'));var rs=require(_0x66ee('0x4'));var fs=require('fs');var Redis=require(_0x66ee('0x5'));var db=require(_0x66ee('0x6'))['db'];var utils=require(_0x66ee('0x7'));var logger=require('../../config/logger')(_0x66ee('0x8'));var config=require(_0x66ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x66ee('0xa')][_0x66ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x481265,_0x154127,_0x3bea4f){return new BPromise(function(_0x3cd3fd,_0x29420f){return client[_0x66ee('0xc')](_0x481265,_0x3bea4f)[_0x66ee('0xd')](function(_0xb403e9){logger[_0x66ee('0xe')](_0x66ee('0xf'),_0x154127,_0x66ee('0x10'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x154127,'request\x20sent',JSON[_0x66ee('0x11')](_0xb403e9));if(_0xb403e9['error']){if(_0xb403e9[_0x66ee('0x12')]['code']===0x1f4){logger[_0x66ee('0x12')](_0x66ee('0xf'),_0x154127,_0xb403e9['error'][_0x66ee('0x13')]);return _0x29420f(_0xb403e9['error'][_0x66ee('0x13')]);}logger[_0x66ee('0x12')](_0x66ee('0xf'),_0x154127,_0xb403e9['error'][_0x66ee('0x13')]);return _0x3cd3fd(_0xb403e9[_0x66ee('0x12')][_0x66ee('0x13')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x154127,_0x66ee('0x10'));_0x3cd3fd(_0xb403e9[_0x66ee('0x14')]['message']);}})[_0x66ee('0x15')](function(_0x5b86da){logger[_0x66ee('0x12')](_0x66ee('0xf'),_0x154127,_0x5b86da);_0x29420f(_0x5b86da);});});}exports[_0x66ee('0x16')]=function(_0x3626fd){var _0x495259=this;return new Promise(function(_0x371756,_0x18ed5c){return db[_0x66ee('0x17')]['findAll']({'raw':_0x3626fd['options']?_0x3626fd['options'][_0x66ee('0x18')]===undefined?!![]:![]:!![],'where':_0x3626fd[_0x66ee('0x19')]?_0x3626fd[_0x66ee('0x19')]['where']||null:null,'attributes':_0x3626fd[_0x66ee('0x19')]?_0x3626fd[_0x66ee('0x19')][_0x66ee('0x1a')]||null:null,'limit':_0x3626fd[_0x66ee('0x19')]?_0x3626fd[_0x66ee('0x19')][_0x66ee('0x1b')]||null:null,'include':_0x3626fd[_0x66ee('0x19')]?_0x3626fd[_0x66ee('0x19')][_0x66ee('0x1c')]?_[_0x66ee('0x1d')](_0x3626fd['options'][_0x66ee('0x1c')],function(_0x2dbc67){return{'model':db[_0x2dbc67[_0x66ee('0x1e')]],'as':_0x2dbc67['as'],'attributes':_0x2dbc67[_0x66ee('0x1a')],'include':_0x2dbc67[_0x66ee('0x1c')]?_[_0x66ee('0x1d')](_0x2dbc67[_0x66ee('0x1c')],function(_0x49f2af){return{'model':db[_0x49f2af['model']],'as':_0x49f2af['as'],'attributes':_0x49f2af['attributes'],'include':_0x49f2af[_0x66ee('0x1c')]?_[_0x66ee('0x1d')](_0x49f2af[_0x66ee('0x1c')],function(_0x19e356){return{'model':db[_0x19e356[_0x66ee('0x1e')]],'as':_0x19e356['as'],'attributes':_0x19e356[_0x66ee('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x66ee('0xd')](function(_0x1716b5){logger['info'](_0x66ee('0x16'),_0x3626fd);logger['debug'](_0x66ee('0x16'),_0x3626fd,JSON[_0x66ee('0x11')](_0x1716b5));_0x371756(_0x1716b5);})['catch'](function(_0x53be3f){logger[_0x66ee('0x12')](_0x66ee('0x16'),_0x53be3f[_0x66ee('0x13')],_0x3626fd);_0x18ed5c(_0x495259[_0x66ee('0x12')](0x1f4,_0x53be3f[_0x66ee('0x13')]));});});};exports['ShowTrigger']=function(_0x431453){var _0x1ae266=this;return new Promise(function(_0x1fa26a,_0x21f3ff){return db[_0x66ee('0x17')][_0x66ee('0x1f')]({'raw':_0x431453[_0x66ee('0x19')]?_0x431453['options'][_0x66ee('0x18')]===undefined?!![]:![]:!![],'where':_0x431453['options']?_0x431453['options']['where']||null:null,'attributes':_0x431453[_0x66ee('0x19')]?_0x431453[_0x66ee('0x19')][_0x66ee('0x1a')]||null:null,'include':_0x431453[_0x66ee('0x19')]?_0x431453[_0x66ee('0x19')]['include']?_['map'](_0x431453[_0x66ee('0x19')][_0x66ee('0x1c')],function(_0xd03fda){return{'model':db[_0xd03fda[_0x66ee('0x1e')]],'as':_0xd03fda['as'],'attributes':_0xd03fda['attributes'],'include':_0xd03fda[_0x66ee('0x1c')]?_[_0x66ee('0x1d')](_0xd03fda['include'],function(_0x363648){return{'model':db[_0x363648[_0x66ee('0x1e')]],'as':_0x363648['as'],'attributes':_0x363648[_0x66ee('0x1a')],'include':_0x363648['include']?_[_0x66ee('0x1d')](_0x363648[_0x66ee('0x1c')],function(_0x275e69){return{'model':db[_0x275e69[_0x66ee('0x1e')]],'as':_0x275e69['as'],'attributes':_0x275e69['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5430b5){logger[_0x66ee('0xe')](_0x66ee('0x20'),_0x431453);logger[_0x66ee('0x21')](_0x66ee('0x20'),_0x431453,JSON[_0x66ee('0x11')](_0x5430b5));_0x1fa26a(_0x5430b5);})[_0x66ee('0x15')](function(_0x22d2e9){logger['error']('ShowTrigger',_0x22d2e9[_0x66ee('0x13')],_0x431453);_0x21f3ff(_0x1ae266[_0x66ee('0x12')](0x1f4,_0x22d2e9[_0x66ee('0x13')]));});});}; \ No newline at end of file +var _0x43bf=['http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','map','include','model','then','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18b275,_0x256a3f){var _0xfb0782=function(_0xed14d1){while(--_0xed14d1){_0x18b275['push'](_0x18b275['shift']());}};_0xfb0782(++_0x256a3f);}(_0x43bf,0x66));var _0xf43b=function(_0x46ed82,_0x1e2031){_0x46ed82=_0x46ed82-0x0;var _0x15b1d9=_0x43bf[_0x46ed82];return _0x15b1d9;};'use strict';var _=require(_0xf43b('0x0'));var util=require(_0xf43b('0x1'));var moment=require(_0xf43b('0x2'));var BPromise=require(_0xf43b('0x3'));var rs=require(_0xf43b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf43b('0x5'))['db'];var utils=require(_0xf43b('0x6'));var logger=require(_0xf43b('0x7'))(_0xf43b('0x8'));var config=require(_0xf43b('0x9'));var jayson=require(_0xf43b('0xa'));var client=jayson[_0xf43b('0xb')][_0xf43b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2af9c1,_0xf78169,_0x50ed4e){return new BPromise(function(_0x26daa9,_0x398543){return client[_0xf43b('0xd')](_0x2af9c1,_0x50ed4e)['then'](function(_0x347315){logger[_0xf43b('0xe')](_0xf43b('0xf'),_0xf78169,_0xf43b('0x10'));logger[_0xf43b('0x11')](_0xf43b('0x12'),_0xf78169,'request\x20sent',JSON[_0xf43b('0x13')](_0x347315));if(_0x347315['error']){if(_0x347315['error'][_0xf43b('0x14')]===0x1f4){logger['error'](_0xf43b('0xf'),_0xf78169,_0x347315['error']['message']);return _0x398543(_0x347315[_0xf43b('0x15')][_0xf43b('0x16')]);}logger[_0xf43b('0x15')]('Trigger,\x20%s,\x20%s',_0xf78169,_0x347315[_0xf43b('0x15')][_0xf43b('0x16')]);return _0x26daa9(_0x347315[_0xf43b('0x15')]['message']);}else{logger[_0xf43b('0xe')](_0xf43b('0xf'),_0xf78169,_0xf43b('0x10'));_0x26daa9(_0x347315[_0xf43b('0x17')]['message']);}})[_0xf43b('0x18')](function(_0x316960){logger[_0xf43b('0x15')](_0xf43b('0xf'),_0xf78169,_0x316960);_0x398543(_0x316960);});});}exports[_0xf43b('0x19')]=function(_0x12216b){var _0x1d29c7=this;return new Promise(function(_0x238ba9,_0xf98262){return db[_0xf43b('0x1a')][_0xf43b('0x1b')]({'raw':_0x12216b[_0xf43b('0x1c')]?_0x12216b[_0xf43b('0x1c')][_0xf43b('0x1d')]===undefined?!![]:![]:!![],'where':_0x12216b['options']?_0x12216b[_0xf43b('0x1c')][_0xf43b('0x1e')]||null:null,'attributes':_0x12216b[_0xf43b('0x1c')]?_0x12216b['options'][_0xf43b('0x1f')]||null:null,'limit':_0x12216b[_0xf43b('0x1c')]?_0x12216b[_0xf43b('0x1c')]['limit']||null:null,'include':_0x12216b[_0xf43b('0x1c')]?_0x12216b[_0xf43b('0x1c')]['include']?_[_0xf43b('0x20')](_0x12216b[_0xf43b('0x1c')][_0xf43b('0x21')],function(_0x22de74){return{'model':db[_0x22de74[_0xf43b('0x22')]],'as':_0x22de74['as'],'attributes':_0x22de74['attributes'],'include':_0x22de74[_0xf43b('0x21')]?_[_0xf43b('0x20')](_0x22de74[_0xf43b('0x21')],function(_0x1722bb){return{'model':db[_0x1722bb[_0xf43b('0x22')]],'as':_0x1722bb['as'],'attributes':_0x1722bb[_0xf43b('0x1f')],'include':_0x1722bb['include']?_[_0xf43b('0x20')](_0x1722bb[_0xf43b('0x21')],function(_0x2f1a8d){return{'model':db[_0x2f1a8d[_0xf43b('0x22')]],'as':_0x2f1a8d['as'],'attributes':_0x2f1a8d[_0xf43b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf43b('0x23')](function(_0x5730a6){logger[_0xf43b('0xe')](_0xf43b('0x19'),_0x12216b);logger[_0xf43b('0x11')](_0xf43b('0x19'),_0x12216b,JSON[_0xf43b('0x13')](_0x5730a6));_0x238ba9(_0x5730a6);})[_0xf43b('0x18')](function(_0x4dbd8f){logger['error'](_0xf43b('0x19'),_0x4dbd8f[_0xf43b('0x16')],_0x12216b);_0xf98262(_0x1d29c7[_0xf43b('0x15')](0x1f4,_0x4dbd8f['message']));});});};exports[_0xf43b('0x24')]=function(_0x55bca8){var _0x9debab=this;return new Promise(function(_0x2cb5cd,_0x2c5114){return db['Trigger'][_0xf43b('0x25')]({'raw':_0x55bca8[_0xf43b('0x1c')]?_0x55bca8['options']['raw']===undefined?!![]:![]:!![],'where':_0x55bca8['options']?_0x55bca8[_0xf43b('0x1c')]['where']||null:null,'attributes':_0x55bca8[_0xf43b('0x1c')]?_0x55bca8['options'][_0xf43b('0x1f')]||null:null,'include':_0x55bca8[_0xf43b('0x1c')]?_0x55bca8[_0xf43b('0x1c')]['include']?_['map'](_0x55bca8[_0xf43b('0x1c')][_0xf43b('0x21')],function(_0x12b78f){return{'model':db[_0x12b78f[_0xf43b('0x22')]],'as':_0x12b78f['as'],'attributes':_0x12b78f[_0xf43b('0x1f')],'include':_0x12b78f[_0xf43b('0x21')]?_[_0xf43b('0x20')](_0x12b78f[_0xf43b('0x21')],function(_0x5e510e){return{'model':db[_0x5e510e['model']],'as':_0x5e510e['as'],'attributes':_0x5e510e[_0xf43b('0x1f')],'include':_0x5e510e['include']?_[_0xf43b('0x20')](_0x5e510e[_0xf43b('0x21')],function(_0x33f50e){return{'model':db[_0x33f50e[_0xf43b('0x22')]],'as':_0x33f50e['as'],'attributes':_0x33f50e[_0xf43b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x599251){logger[_0xf43b('0xe')]('ShowTrigger',_0x55bca8);logger[_0xf43b('0x11')](_0xf43b('0x24'),_0x55bca8,JSON['stringify'](_0x599251));_0x2cb5cd(_0x599251);})[_0xf43b('0x18')](function(_0x52d50e){logger['error'](_0xf43b('0x24'),_0x52d50e[_0xf43b('0x16')],_0x55bca8);_0x2c5114(_0x9debab['error'](0x1f4,_0x52d50e['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 524e7a7..cd3b92b 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 _0xcdfb=['path','express','Router','fs-extra','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','create','put','update','delete','destroy','exports','multer'];(function(_0x5f3cab,_0x1b523d){var _0x2db243=function(_0x13ea97){while(--_0x13ea97){_0x5f3cab['push'](_0x5f3cab['shift']());}};_0x2db243(++_0x1b523d);}(_0xcdfb,0x1b7));var _0xbcdf=function(_0x41bdd8,_0x1ef1e3){_0x41bdd8=_0x41bdd8-0x0;var _0x33913f=_0xcdfb[_0x41bdd8];return _0x33913f;};'use strict';var multer=require(_0xbcdf('0x0'));var util=require('util');var path=require(_0xbcdf('0x1'));var timeout=require('connect-timeout');var express=require(_0xbcdf('0x2'));var router=express[_0xbcdf('0x3')]();var fs_extra=require(_0xbcdf('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbcdf('0x5'));var controller=require(_0xbcdf('0x6'));router[_0xbcdf('0x7')]('/',auth[_0xbcdf('0x8')](),controller[_0xbcdf('0x9')]);router[_0xbcdf('0x7')](_0xbcdf('0xa'),auth[_0xbcdf('0x8')](),controller[_0xbcdf('0xb')]);router['post'](_0xbcdf('0xc'),auth[_0xbcdf('0x8')](),controller[_0xbcdf('0xd')]);router['post']('/',auth[_0xbcdf('0x8')](),controller[_0xbcdf('0xe')]);router[_0xbcdf('0xf')](_0xbcdf('0xa'),auth[_0xbcdf('0x8')](),controller[_0xbcdf('0x10')]);router[_0xbcdf('0x11')](_0xbcdf('0xa'),auth[_0xbcdf('0x8')](),controller[_0xbcdf('0x12')]);module[_0xbcdf('0x13')]=router; \ No newline at end of file +var _0xa5e4=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','create','put','delete','destroy','exports'];(function(_0x91384,_0x545eef){var _0x44daa0=function(_0x5a0cc5){while(--_0x5a0cc5){_0x91384['push'](_0x91384['shift']());}};_0x44daa0(++_0x545eef);}(_0xa5e4,0x169));var _0x4a5e=function(_0x2d74db,_0x589556){_0x2d74db=_0x2d74db-0x0;var _0x5f357c=_0xa5e4[_0x2d74db];return _0x5f357c;};'use strict';var multer=require(_0x4a5e('0x0'));var util=require(_0x4a5e('0x1'));var path=require(_0x4a5e('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a5e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4a5e('0x4'));var interaction=require(_0x4a5e('0x5'));var config=require(_0x4a5e('0x6'));var controller=require(_0x4a5e('0x7'));router[_0x4a5e('0x8')]('/',auth[_0x4a5e('0x9')](),controller['index']);router[_0x4a5e('0x8')](_0x4a5e('0xa'),auth[_0x4a5e('0x9')](),controller[_0x4a5e('0xb')]);router[_0x4a5e('0xc')](_0x4a5e('0xd'),auth[_0x4a5e('0x9')](),controller['clone']);router['post']('/',auth[_0x4a5e('0x9')](),controller[_0x4a5e('0xe')]);router[_0x4a5e('0xf')]('/:id',auth[_0x4a5e('0x9')](),controller['update']);router[_0x4a5e('0x10')](_0x4a5e('0xa'),auth[_0x4a5e('0x9')](),controller[_0x4a5e('0x11')]);module[_0x4a5e('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7d1f093..b103cc2 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 _0xb7d3=['friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','sequelize','exports','STRING','name','ENUM'];(function(_0x37e26b,_0x25a124){var _0x1bafc9=function(_0x223124){while(--_0x223124){_0x37e26b['push'](_0x37e26b['shift']());}};_0x1bafc9(++_0x25a124);}(_0xb7d3,0xf5));var _0x3b7d=function(_0xd76c86,_0x3042e0){_0xd76c86=_0xd76c86-0x0;var _0x1c3482=_0xb7d3[_0xd76c86];return _0x1c3482;};'use strict';var Sequelize=require(_0x3b7d('0x0'));module[_0x3b7d('0x1')]={'name':{'type':Sequelize[_0x3b7d('0x2')],'allowNull':![],'unique':_0x3b7d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x5'),_0x3b7d('0x6'),_0x3b7d('0x7')),'allowNull':![],'defaultValue':_0x3b7d('0x5')},'context':{'type':Sequelize[_0x3b7d('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x8'),'ALLOWED_PASSED_SCREEN',_0x3b7d('0x9'),_0x3b7d('0xa'),_0x3b7d('0xb'),_0x3b7d('0xc'),_0x3b7d('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x3b7d('0x2')]},'permit':{'type':Sequelize[_0x3b7d('0x2')]},'secret':{'type':Sequelize[_0x3b7d('0x2')]},'md5secret':{'type':Sequelize[_0x3b7d('0x2')]},'remotesecret':{'type':Sequelize[_0x3b7d('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x3b7d('0xe'),'set':function(_0x3a7fe5){this[_0x3b7d('0xf')]('transport',_0x3a7fe5?_0x3a7fe5['join'](','):null);},'get':function(){return this[_0x3b7d('0x10')](_0x3b7d('0x11'))?this[_0x3b7d('0x10')](_0x3b7d('0x11'))[_0x3b7d('0x12')](','):null;},'comment':_0x3b7d('0x13')},'dtmfmode':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x14'),_0x3b7d('0x15'),_0x3b7d('0x16'),'inband',_0x3b7d('0x17')),'defaultValue':_0x3b7d('0x14')},'directmedia':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no',_0x3b7d('0x19'),_0x3b7d('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3b7d('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3b7d('0x2')],'defaultValue':_0x3b7d('0x1b'),'set':function(_0x2a01d5){this[_0x3b7d('0xf')](_0x3b7d('0x1c'),_0x2a01d5?_0x2a01d5[_0x3b7d('0x1d')](','):null);},'get':function(){return this['getDataValue'](_0x3b7d('0x1c'))?this[_0x3b7d('0x10')](_0x3b7d('0x1c'))[_0x3b7d('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3b7d('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3b7d('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3b7d('0x2')]},'language':{'type':Sequelize[_0x3b7d('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3b7d('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3b7d('0x2')],'defaultValue':_0x3b7d('0x1e')},'allow':{'type':Sequelize[_0x3b7d('0x2')],'allowNull':![],'defaultValue':_0x3b7d('0x1f'),'set':function(_0x28e815){this[_0x3b7d('0xf')]('allow',_0x28e815?_0x28e815[_0x3b7d('0x1d')](';'):_0x3b7d('0x1f'));},'get':function(){return this[_0x3b7d('0x10')]('allow')?this[_0x3b7d('0x10')]('allow')['split'](';'):null;},'comment':_0x3b7d('0x20')},'autoframing':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x3f0480){this[_0x3b7d('0xf')](_0x3b7d('0x21'),_0x3f0480?_0x3f0480[_0x3b7d('0x1d')](','):null);},'get':function(){return this[_0x3b7d('0x10')](_0x3b7d('0x21'))?this[_0x3b7d('0x10')](_0x3b7d('0x21'))['split'](','):null;},'comment':_0x3b7d('0x22')},'trustrpid':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x3b7d('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no',_0x3b7d('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0x3b7d('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x3b7d('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3b7d('0x2')],'defaultValue':_0x3b7d('0x25')},'amaflags':{'type':Sequelize[_0x3b7d('0x2')]},'callcounter':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no'),'defaultValue':_0x3b7d('0x18')},'busylevel':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x3b7d('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x3b7d('0x2')]},'template':{'type':Sequelize[_0x3b7d('0x2')]},'videosupport':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no',_0x3b7d('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x3b7d('0x18'),'no')},'mailbox':{'type':Sequelize[_0x3b7d('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x3b7d('0x27'),_0x3b7d('0x28'),_0x3b7d('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x3b7d('0x2a'),'uas'),'defaultValue':_0x3b7d('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x3b7d('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x3b7d('0x2')]},'port':{'type':Sequelize[_0x3b7d('0x24')](0x5)},'qualify':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x3b7d('0x2')]},'defaultuser':{'type':Sequelize[_0x3b7d('0x2')]},'rtptimeout':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x3b7d('0x4')]('yes','no',_0x3b7d('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3b7d('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x3b7d('0x2')]},'contactdeny':{'type':Sequelize[_0x3b7d('0x2')]},'contactacl':{'type':Sequelize[_0x3b7d('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3b7d('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3b7d('0x2')]},'maxforwards':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3b7d('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x3b7d('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x3b7d('0x18'),'no',_0x3b7d('0x2d'),_0x3b7d('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x3b7d('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x3b7d('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x3b7d('0x2')]},'dtlssetup':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x2f'),_0x3b7d('0x30'),_0x3b7d('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x3b7d('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3b7d('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x3b7d('0x4')](_0x3b7d('0x18'),'no')},'vmexten':{'type':Sequelize[_0x3b7d('0x2')]},'mohinterpret':{'type':Sequelize[_0x3b7d('0x2')]},'mohsuggest':{'type':Sequelize[_0x3b7d('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3b7d('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x3b7d('0x18'),'no',_0x3b7d('0x19'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3b7d('0x2')]},'otherFields':{'type':Sequelize[_0x3b7d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3b7d('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3662=['insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite'];(function(_0x49c3ac,_0x79a027){var _0x1a8956=function(_0x3c6c05){while(--_0x3c6c05){_0x49c3ac['push'](_0x49c3ac['shift']());}};_0x1a8956(++_0x79a027);}(_0x3662,0x185));var _0x2366=function(_0x47b7c4,_0x26314a){_0x47b7c4=_0x47b7c4-0x0;var _0x19220c=_0x3662[_0x47b7c4];return _0x19220c;};'use strict';var Sequelize=require(_0x2366('0x0'));module[_0x2366('0x1')]={'name':{'type':Sequelize[_0x2366('0x2')],'allowNull':![],'unique':_0x2366('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x5'),_0x2366('0x6'),'peer'),'allowNull':![],'defaultValue':_0x2366('0x5')},'context':{'type':Sequelize[_0x2366('0x2')],'allowNull':![],'defaultValue':_0x2366('0x7')},'callingpres':{'type':Sequelize[_0x2366('0x4')]('ALLOWED_NOT_SCREENED',_0x2366('0x8'),_0x2366('0x9'),_0x2366('0xa'),_0x2366('0xb'),_0x2366('0xc'),_0x2366('0xd'),_0x2366('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2366('0x2')]},'secret':{'type':Sequelize[_0x2366('0x2')]},'md5secret':{'type':Sequelize[_0x2366('0x2')]},'remotesecret':{'type':Sequelize[_0x2366('0x2')]},'transport':{'type':Sequelize[_0x2366('0x2')],'defaultValue':_0x2366('0xf'),'set':function(_0xbe44b3){this['setDataValue'](_0x2366('0x10'),_0xbe44b3?_0xbe44b3['join'](','):null);},'get':function(){return this[_0x2366('0x11')](_0x2366('0x10'))?this[_0x2366('0x11')](_0x2366('0x10'))[_0x2366('0x12')](','):null;},'comment':_0x2366('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x2366('0x14'),_0x2366('0x15'),'shortinfo',_0x2366('0x16'),_0x2366('0x17')),'defaultValue':_0x2366('0x14')},'directmedia':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no',_0x2366('0x19'),_0x2366('0x1a'),_0x2366('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2366('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2366('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x2366('0x1c'),'set':function(_0x3faee2){this[_0x2366('0x1d')]('nat',_0x3faee2?_0x3faee2[_0x2366('0x1e')](','):null);},'get':function(){return this[_0x2366('0x11')]('nat')?this['getDataValue']('nat')['split'](','):null;},'comment':_0x2366('0x1f')},'callgroup':{'type':Sequelize[_0x2366('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2366('0x2')]},'pickupgroup':{'type':Sequelize[_0x2366('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2366('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2366('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2366('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2366('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1e7d93){this['setDataValue'](_0x2366('0x20'),_0x1e7d93?_0x1e7d93[_0x2366('0x1e')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x2366('0x11')](_0x2366('0x20'))?this[_0x2366('0x11')](_0x2366('0x20'))[_0x2366('0x12')](';'):null;},'comment':_0x2366('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0x2366('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x2366('0x22'),'set':function(_0x4163de){this['setDataValue'](_0x2366('0x23'),_0x4163de?_0x4163de[_0x2366('0x1e')](','):null);},'get':function(){return this[_0x2366('0x11')]('insecure')?this[_0x2366('0x11')](_0x2366('0x23'))[_0x2366('0x12')](','):null;},'comment':_0x2366('0x24')},'trustrpid':{'type':Sequelize[_0x2366('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2366('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no',_0x2366('0x25'))},'promiscredir':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x2366('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x2366('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2366('0x2')],'defaultValue':_0x2366('0x27')},'amaflags':{'type':Sequelize[_0x2366('0x2')]},'callcounter':{'type':Sequelize[_0x2366('0x4')]('yes','no'),'defaultValue':_0x2366('0x18')},'busylevel':{'type':Sequelize[_0x2366('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2366('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x2366('0x2')]},'template':{'type':Sequelize[_0x2366('0x2')]},'videosupport':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2366('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no')},'mailbox':{'type':Sequelize[_0x2366('0x2')]},'session_timers':{'type':Sequelize[_0x2366('0x4')]('accept',_0x2366('0x28'),_0x2366('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2366('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x2a'),_0x2366('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2366('0x2')]},'regexten':{'type':Sequelize[_0x2366('0x2')]},'fromdomain':{'type':Sequelize[_0x2366('0x2')]},'fromuser':{'type':Sequelize[_0x2366('0x2')]},'port':{'type':Sequelize[_0x2366('0x26')](0x5)},'qualify':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no'),'defaultValue':_0x2366('0x18')},'keepalive':{'type':Sequelize[_0x2366('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x2366('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x2366('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2366('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2366('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x2366('0x4')]('yes','no',_0x2366('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x2366('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x2366('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x2366('0x2')]},'contactdeny':{'type':Sequelize[_0x2366('0x2')]},'contactacl':{'type':Sequelize[_0x2366('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2366('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2366('0x2')]},'maxforwards':{'type':Sequelize[_0x2366('0x26')](0xb)},'encryption':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2366('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x2366('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x2366('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no',_0x2366('0x2d'),_0x2366('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x2366('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2366('0x2')]},'dtlscipher':{'type':Sequelize[_0x2366('0x2')]},'dtlscafile':{'type':Sequelize[_0x2366('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x2f'),_0x2366('0x30'),_0x2366('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2366('0x2')]},'usereqphone':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2366('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x2366('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2366('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no')},'vmexten':{'type':Sequelize[_0x2366('0x2')]},'mohinterpret':{'type':Sequelize[_0x2366('0x2')]},'mohsuggest':{'type':Sequelize[_0x2366('0x2')]},'parkinglot':{'type':Sequelize[_0x2366('0x2')]},'description':{'type':Sequelize[_0x2366('0x2')]},'host':{'type':Sequelize[_0x2366('0x2')],'defaultValue':_0x2366('0x32')},'canreinvite':{'type':Sequelize[_0x2366('0x4')](_0x2366('0x18'),'no',_0x2366('0x19'),_0x2366('0x1a'),_0x2366('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2366('0x2')]},'otherFields':{'type':Sequelize[_0x2366('0x2')]},'active':{'type':Sequelize[_0x2366('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2366('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 32de7a8..616e487 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 _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x381dbb,_0x4a1419){var _0x301378=function(_0xd1993c){while(--_0xd1993c){_0x381dbb['push'](_0x381dbb['shift']());}};_0x301378(++_0x4a1419);}(_0x34e8,0x12c));var _0x834e=function(_0x17eaea,_0x4496de){_0x17eaea=_0x17eaea-0x0;var _0x11bb68=_0x34e8[_0x17eaea];return _0x11bb68;};'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'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file +var _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','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','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x167e7d,_0x110330){var _0x15da13=function(_0x3accfb){while(--_0x3accfb){_0x167e7d['push'](_0x167e7d['shift']());}};_0x15da13(++_0x110330);}(_0xa41a,0x6b));var _0xaa41=function(_0x5cfc68,_0x5049f7){_0x5cfc68=_0x5cfc68-0x0;var _0x53ea9b=_0xa41a[_0x5cfc68];return _0x53ea9b;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index afd92f6..ac5af8e 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 _0xc8a6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xc8a6,0x108));var _0x6c8a=function(_0x31b99d,_0x14dbe5){_0x31b99d=_0x31b99d-0x0;var _0x4c028a=_0xc8a6[_0x31b99d];return _0x4c028a;};'use strict';var _=require(_0x6c8a('0x0'));var util=require(_0x6c8a('0x1'));var logger=require(_0x6c8a('0x2'))(_0x6c8a('0x3'));var moment=require(_0x6c8a('0x4'));var BPromise=require(_0x6c8a('0x5'));var rp=require(_0x6c8a('0x6'));var fs=require('fs');var path=require(_0x6c8a('0x7'));var rimraf=require(_0x6c8a('0x8'));var config=require(_0x6c8a('0x9'));var attributes=require(_0x6c8a('0xa'));module[_0x6c8a('0xb')]=function(_0x3926fd,_0x2ddedf){return _0x3926fd['define'](_0x6c8a('0xc'),attributes,{'tableName':_0x6c8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5da1=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5da1,0x192));var _0x15da=function(_0x481df9,_0xf72f26){_0x481df9=_0x481df9-0x0;var _0x208f49=_0x5da1[_0x481df9];return _0x208f49;};'use strict';var _=require(_0x15da('0x0'));var util=require(_0x15da('0x1'));var logger=require(_0x15da('0x2'))(_0x15da('0x3'));var moment=require(_0x15da('0x4'));var BPromise=require(_0x15da('0x5'));var rp=require(_0x15da('0x6'));var fs=require('fs');var path=require(_0x15da('0x7'));var rimraf=require('rimraf');var config=require(_0x15da('0x8'));var attributes=require(_0x15da('0x9'));module['exports']=function(_0x4b8c32,_0x82a64e){return _0x4b8c32[_0x15da('0xa')](_0x15da('0xb'),attributes,{'tableName':_0x15da('0xc'),'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 bb1e4c9..b6b7387 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 _0x8285=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','map','model','attributes','ShowTrunk','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8285,0xfa));var _0x5828=function(_0x5e1a3e,_0xaf5f51){_0x5e1a3e=_0x5e1a3e-0x0;var _0x3a04b4=_0x8285[_0x5e1a3e];return _0x3a04b4;};'use strict';var _=require(_0x5828('0x0'));var util=require(_0x5828('0x1'));var moment=require('moment');var BPromise=require(_0x5828('0x2'));var rs=require(_0x5828('0x3'));var fs=require('fs');var Redis=require(_0x5828('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5828('0x5'))(_0x5828('0x6'));var config=require('../../config/environment');var jayson=require(_0x5828('0x7'));var client=jayson[_0x5828('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x501fb4,_0x265f67,_0x40cfd6){return new BPromise(function(_0x33ceb2,_0x12d257){return client['request'](_0x501fb4,_0x40cfd6)[_0x5828('0x9')](function(_0x160791){logger[_0x5828('0xa')](_0x5828('0xb'),_0x265f67,_0x5828('0xc'));logger[_0x5828('0xd')](_0x5828('0xe'),_0x265f67,_0x5828('0xc'),JSON[_0x5828('0xf')](_0x160791));if(_0x160791[_0x5828('0x10')]){if(_0x160791['error']['code']===0x1f4){logger[_0x5828('0x10')]('Trunk,\x20%s,\x20%s',_0x265f67,_0x160791['error'][_0x5828('0x11')]);return _0x12d257(_0x160791[_0x5828('0x10')][_0x5828('0x11')]);}logger[_0x5828('0x10')]('Trunk,\x20%s,\x20%s',_0x265f67,_0x160791[_0x5828('0x10')][_0x5828('0x11')]);return _0x33ceb2(_0x160791[_0x5828('0x10')][_0x5828('0x11')]);}else{logger[_0x5828('0xa')](_0x5828('0xb'),_0x265f67,'request\x20sent');_0x33ceb2(_0x160791[_0x5828('0x12')][_0x5828('0x11')]);}})[_0x5828('0x13')](function(_0x430c81){logger[_0x5828('0x10')](_0x5828('0xb'),_0x265f67,_0x430c81);_0x12d257(_0x430c81);});});}exports[_0x5828('0x14')]=function(_0x579edf){var _0x627c6c=this;return new Promise(function(_0xfe8458,_0xaefd4a){return db[_0x5828('0x15')][_0x5828('0x16')]({'raw':_0x579edf[_0x5828('0x17')]?_0x579edf[_0x5828('0x17')][_0x5828('0x18')]===undefined?!![]:![]:!![],'where':_0x579edf[_0x5828('0x17')]?_0x579edf[_0x5828('0x17')][_0x5828('0x19')]||null:null,'attributes':_0x579edf[_0x5828('0x17')]?_0x579edf['options']['attributes']||null:null,'limit':_0x579edf['options']?_0x579edf[_0x5828('0x17')][_0x5828('0x1a')]||null:null,'include':_0x579edf['options']?_0x579edf['options'][_0x5828('0x1b')]?_[_0x5828('0x1c')](_0x579edf['options'][_0x5828('0x1b')],function(_0x5f2ccd){return{'model':db[_0x5f2ccd[_0x5828('0x1d')]],'as':_0x5f2ccd['as'],'attributes':_0x5f2ccd[_0x5828('0x1e')],'include':_0x5f2ccd[_0x5828('0x1b')]?_['map'](_0x5f2ccd[_0x5828('0x1b')],function(_0x4dc071){return{'model':db[_0x4dc071[_0x5828('0x1d')]],'as':_0x4dc071['as'],'attributes':_0x4dc071[_0x5828('0x1e')],'include':_0x4dc071[_0x5828('0x1b')]?_[_0x5828('0x1c')](_0x4dc071[_0x5828('0x1b')],function(_0x4c8f38){return{'model':db[_0x4c8f38[_0x5828('0x1d')]],'as':_0x4c8f38['as'],'attributes':_0x4c8f38[_0x5828('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5828('0x9')](function(_0x370c6e){logger[_0x5828('0xa')](_0x5828('0x14'),_0x579edf);logger[_0x5828('0xd')]('GetTrunk',_0x579edf,JSON['stringify'](_0x370c6e));_0xfe8458(_0x370c6e);})['catch'](function(_0x27242d){logger[_0x5828('0x10')](_0x5828('0x14'),_0x27242d[_0x5828('0x11')],_0x579edf);_0xaefd4a(_0x627c6c[_0x5828('0x10')](0x1f4,_0x27242d['message']));});});};exports[_0x5828('0x1f')]=function(_0x276b3c){var _0x442f29=this;return new Promise(function(_0x30c06b,_0x4c6cf4){return db[_0x5828('0x15')][_0x5828('0x20')]({'raw':_0x276b3c[_0x5828('0x17')]?_0x276b3c[_0x5828('0x17')][_0x5828('0x18')]===undefined?!![]:![]:!![],'where':_0x276b3c[_0x5828('0x17')]?_0x276b3c[_0x5828('0x17')][_0x5828('0x19')]||null:null,'attributes':_0x276b3c[_0x5828('0x17')]?_0x276b3c[_0x5828('0x17')][_0x5828('0x1e')]||null:null,'include':_0x276b3c[_0x5828('0x17')]?_0x276b3c[_0x5828('0x17')][_0x5828('0x1b')]?_['map'](_0x276b3c[_0x5828('0x17')][_0x5828('0x1b')],function(_0x3663e7){return{'model':db[_0x3663e7[_0x5828('0x1d')]],'as':_0x3663e7['as'],'attributes':_0x3663e7['attributes'],'include':_0x3663e7['include']?_['map'](_0x3663e7['include'],function(_0x1393dd){return{'model':db[_0x1393dd[_0x5828('0x1d')]],'as':_0x1393dd['as'],'attributes':_0x1393dd[_0x5828('0x1e')],'include':_0x1393dd['include']?_[_0x5828('0x1c')](_0x1393dd[_0x5828('0x1b')],function(_0x29ea3f){return{'model':db[_0x29ea3f[_0x5828('0x1d')]],'as':_0x29ea3f['as'],'attributes':_0x29ea3f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x29c8d9){logger['info'](_0x5828('0x1f'),_0x276b3c);logger['debug'](_0x5828('0x1f'),_0x276b3c,JSON[_0x5828('0xf')](_0x29c8d9));_0x30c06b(_0x29c8d9);})[_0x5828('0x13')](function(_0x24347f){logger[_0x5828('0x10')](_0x5828('0x1f'),_0x24347f[_0x5828('0x11')],_0x276b3c);_0x4c6cf4(_0x442f29[_0x5828('0x10')](0x1f4,_0x24347f[_0x5828('0x11')]));});});}; \ No newline at end of file +var _0x2034=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','findAll','options','attributes','include','map','model','ShowTrunk','Trunk','raw','where','util','moment','bluebird','randomstring','ioredis'];(function(_0x34bcb6,_0x321919){var _0x1e83d9=function(_0x2d5255){while(--_0x2d5255){_0x34bcb6['push'](_0x34bcb6['shift']());}};_0x1e83d9(++_0x321919);}(_0x2034,0x19f));var _0x4203=function(_0x9bbd4c,_0x26e75e){_0x9bbd4c=_0x9bbd4c-0x0;var _0x19b295=_0x2034[_0x9bbd4c];return _0x19b295;};'use strict';var _=require('lodash');var util=require(_0x4203('0x0'));var moment=require(_0x4203('0x1'));var BPromise=require(_0x4203('0x2'));var rs=require(_0x4203('0x3'));var fs=require('fs');var Redis=require(_0x4203('0x4'));var db=require(_0x4203('0x5'))['db'];var utils=require(_0x4203('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4203('0x7'));var jayson=require(_0x4203('0x8'));var client=jayson[_0x4203('0x9')][_0x4203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22c3f8,_0x2a998e,_0x3b1513){return new BPromise(function(_0x2b8d1b,_0x553224){return client[_0x4203('0xb')](_0x22c3f8,_0x3b1513)[_0x4203('0xc')](function(_0x3e3c70){logger[_0x4203('0xd')](_0x4203('0xe'),_0x2a998e,_0x4203('0xf'));logger[_0x4203('0x10')](_0x4203('0x11'),_0x2a998e,_0x4203('0xf'),JSON[_0x4203('0x12')](_0x3e3c70));if(_0x3e3c70[_0x4203('0x13')]){if(_0x3e3c70[_0x4203('0x13')][_0x4203('0x14')]===0x1f4){logger[_0x4203('0x13')]('Trunk,\x20%s,\x20%s',_0x2a998e,_0x3e3c70[_0x4203('0x13')][_0x4203('0x15')]);return _0x553224(_0x3e3c70[_0x4203('0x13')][_0x4203('0x15')]);}logger[_0x4203('0x13')](_0x4203('0xe'),_0x2a998e,_0x3e3c70[_0x4203('0x13')][_0x4203('0x15')]);return _0x2b8d1b(_0x3e3c70[_0x4203('0x13')]['message']);}else{logger['info'](_0x4203('0xe'),_0x2a998e,_0x4203('0xf'));_0x2b8d1b(_0x3e3c70[_0x4203('0x16')][_0x4203('0x15')]);}})[_0x4203('0x17')](function(_0x3489d4){logger[_0x4203('0x13')]('Trunk,\x20%s,\x20%s',_0x2a998e,_0x3489d4);_0x553224(_0x3489d4);});});}exports[_0x4203('0x18')]=function(_0xa15a3a){var _0x377da2=this;return new Promise(function(_0x58563b,_0x11283c){return db['Trunk'][_0x4203('0x19')]({'raw':_0xa15a3a[_0x4203('0x1a')]?_0xa15a3a[_0x4203('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xa15a3a[_0x4203('0x1a')]?_0xa15a3a[_0x4203('0x1a')]['where']||null:null,'attributes':_0xa15a3a['options']?_0xa15a3a[_0x4203('0x1a')][_0x4203('0x1b')]||null:null,'limit':_0xa15a3a[_0x4203('0x1a')]?_0xa15a3a[_0x4203('0x1a')]['limit']||null:null,'include':_0xa15a3a[_0x4203('0x1a')]?_0xa15a3a[_0x4203('0x1a')][_0x4203('0x1c')]?_[_0x4203('0x1d')](_0xa15a3a[_0x4203('0x1a')][_0x4203('0x1c')],function(_0x395ed6){return{'model':db[_0x395ed6['model']],'as':_0x395ed6['as'],'attributes':_0x395ed6[_0x4203('0x1b')],'include':_0x395ed6[_0x4203('0x1c')]?_[_0x4203('0x1d')](_0x395ed6[_0x4203('0x1c')],function(_0xe17833){return{'model':db[_0xe17833[_0x4203('0x1e')]],'as':_0xe17833['as'],'attributes':_0xe17833[_0x4203('0x1b')],'include':_0xe17833[_0x4203('0x1c')]?_['map'](_0xe17833[_0x4203('0x1c')],function(_0x1b03b8){return{'model':db[_0x1b03b8[_0x4203('0x1e')]],'as':_0x1b03b8['as'],'attributes':_0x1b03b8[_0x4203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x73654d){logger[_0x4203('0xd')](_0x4203('0x18'),_0xa15a3a);logger[_0x4203('0x10')]('GetTrunk',_0xa15a3a,JSON['stringify'](_0x73654d));_0x58563b(_0x73654d);})['catch'](function(_0x576c88){logger[_0x4203('0x13')]('GetTrunk',_0x576c88['message'],_0xa15a3a);_0x11283c(_0x377da2[_0x4203('0x13')](0x1f4,_0x576c88[_0x4203('0x15')]));});});};exports[_0x4203('0x1f')]=function(_0x400a5e){var _0x2bd529=this;return new Promise(function(_0x417d63,_0x5ec5c8){return db[_0x4203('0x20')]['find']({'raw':_0x400a5e[_0x4203('0x1a')]?_0x400a5e[_0x4203('0x1a')][_0x4203('0x21')]===undefined?!![]:![]:!![],'where':_0x400a5e['options']?_0x400a5e['options'][_0x4203('0x22')]||null:null,'attributes':_0x400a5e[_0x4203('0x1a')]?_0x400a5e[_0x4203('0x1a')][_0x4203('0x1b')]||null:null,'include':_0x400a5e['options']?_0x400a5e[_0x4203('0x1a')][_0x4203('0x1c')]?_[_0x4203('0x1d')](_0x400a5e[_0x4203('0x1a')][_0x4203('0x1c')],function(_0x4ee183){return{'model':db[_0x4ee183[_0x4203('0x1e')]],'as':_0x4ee183['as'],'attributes':_0x4ee183[_0x4203('0x1b')],'include':_0x4ee183[_0x4203('0x1c')]?_[_0x4203('0x1d')](_0x4ee183['include'],function(_0x2660fe){return{'model':db[_0x2660fe[_0x4203('0x1e')]],'as':_0x2660fe['as'],'attributes':_0x2660fe[_0x4203('0x1b')],'include':_0x2660fe['include']?_[_0x4203('0x1d')](_0x2660fe[_0x4203('0x1c')],function(_0x4398a2){return{'model':db[_0x4398a2[_0x4203('0x1e')]],'as':_0x4398a2['as'],'attributes':_0x4398a2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4203('0xc')](function(_0x3387bb){logger[_0x4203('0xd')]('ShowTrunk',_0x400a5e);logger[_0x4203('0x10')](_0x4203('0x1f'),_0x400a5e,JSON[_0x4203('0x12')](_0x3387bb));_0x417d63(_0x3387bb);})[_0x4203('0x17')](function(_0xf79aff){logger['error']('ShowTrunk',_0xf79aff[_0x4203('0x15')],_0x400a5e);_0x5ec5c8(_0x2bd529[_0x4203('0x13')](0x1f4,_0xf79aff[_0x4203('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index a8d9c92..0a6f18d 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 _0xc5b8=['isAuthenticated','update','exports','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xc5b8,0x14c));var _0x8c5b=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xc5b8[_0x5c9307];return _0x373e29;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8c5b('0x0'));var controller=require(_0x8c5b('0x1'));router[_0x8c5b('0x2')](_0x8c5b('0x3'),auth[_0x8c5b('0x4')](),controller[_0x8c5b('0x5')]);module[_0x8c5b('0x6')]=router; \ No newline at end of file +var _0x40fa=['isAuthenticated','update','express','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x2587cb,_0x1ee1f7){var _0x44cf58=function(_0x37009f){while(--_0x37009f){_0x2587cb['push'](_0x2587cb['shift']());}};_0x44cf58(++_0x1ee1f7);}(_0x40fa,0xaa));var _0xa40f=function(_0x47e1e6,_0x522944){_0x47e1e6=_0x47e1e6-0x0;var _0x1bed01=_0x40fa[_0x47e1e6];return _0x1bed01;};'use strict';var express=require(_0xa40f('0x0'));var router=express['Router']();var auth=require(_0xa40f('0x1'));var controller=require(_0xa40f('0x2'));router[_0xa40f('0x3')](_0xa40f('0x4'),auth[_0xa40f('0x5')](),controller[_0xa40f('0x6')]);module['exports']=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 786bfaa..6009653 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 _0xfa5d=['INTEGER','UserId','warning','info','debug','ENUM','error','BOOLEAN','TEXT','DATE'];(function(_0x554c1a,_0x1863d9){var _0x1a83c4=function(_0xa03f71){while(--_0xa03f71){_0x554c1a['push'](_0x554c1a['shift']());}};_0x1a83c4(++_0x1863d9);}(_0xfa5d,0x19c));var _0xdfa5=function(_0x1fc855,_0x3f7036){_0x1fc855=_0x1fc855-0x0;var _0x4756c6=_0xfa5d[_0x1fc855];return _0x4756c6;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0xdfa5('0x0'),_0xdfa5('0x1'),_0xdfa5('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xdfa5('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xdfa5('0x4'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xdfa5('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xdfa5('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xdfa5('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xdfa5('0x8')],'unique':_0xdfa5('0x9')}}; \ No newline at end of file +var _0x0c1e=['info','exports','TEXT','DATE','INTEGER','UserId','sequelize','error','warning'];(function(_0x57b2ca,_0x3d609c){var _0x354971=function(_0x121bc3){while(--_0x121bc3){_0x57b2ca['push'](_0x57b2ca['shift']());}};_0x354971(++_0x3d609c);}(_0x0c1e,0x96));var _0xe0c1=function(_0x430351,_0x589dfd){_0x430351=_0x430351-0x0;var _0x2ac84f=_0x0c1e[_0x430351];return _0x2ac84f;};'use strict';var Sequelize=require(_0xe0c1('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xe0c1('0x1'),_0xe0c1('0x2'),_0xe0c1('0x3'),'debug'];module[_0xe0c1('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xe0c1('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xe0c1('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xe0c1('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xe0c1('0x7')],'unique':_0xe0c1('0x8')}}; \ 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 3861949..d722ef0 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 _0xa1a5=['api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','update','then','sendStatus','error','send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','../../config/logger'];(function(_0xdb2727,_0xce46aa){var _0x36d766=function(_0x62a5a7){while(--_0x62a5a7){_0xdb2727['push'](_0xdb2727['shift']());}};_0x36d766(++_0xce46aa);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x308b45,_0x49daf5){_0x308b45=_0x308b45-0x0;var _0x2e9357=_0xa1a5[_0x308b45];return _0x2e9357;};'use strict';var _=require(_0x5a1a('0x0'));var Redis=require('ioredis');var logger=require(_0x5a1a('0x1'))(_0x5a1a('0x2'));var config=require(_0x5a1a('0x3'));var db=require(_0x5a1a('0x4'))['db'];var socket=require(_0x5a1a('0x5'))(new Redis(config['redis']));require(_0x5a1a('0x6'))[_0x5a1a('0x7')](socket);config[_0x5a1a('0x8')]=_[_0x5a1a('0x9')](config[_0x5a1a('0x8')],{'host':_0x5a1a('0xa'),'port':0x18eb});function respondWithResult(_0x1062b9,_0x59e0f6){_0x59e0f6=_0x59e0f6||0xc8;return function(_0x1ec37f){if(_0x1ec37f){return _0x1062b9[_0x5a1a('0xb')](_0x59e0f6)[_0x5a1a('0xc')](_0x1ec37f);}};}function saveUpdates(_0x34dc28){return function(_0x24ac2d){if(_0x24ac2d){return _0x24ac2d[_0x5a1a('0xd')](_0x34dc28)[_0x5a1a('0xe')](function(_0x45cf06){return _0x45cf06;});}return null;};}function handleEntityNotFound(_0x761a91){return function(_0x57c5ca){if(!_0x57c5ca){_0x761a91[_0x5a1a('0xf')](0x194);}return _0x57c5ca;};}function handleError(_0x27baef,_0x1474c2){_0x1474c2=_0x1474c2||0x1f4;return function(_0x4c9226){logger[_0x5a1a('0x10')](_0x4c9226['stack']);if(_0x4c9226['name']){delete _0x4c9226['name'];}_0x27baef[_0x5a1a('0xb')](_0x1474c2)[_0x5a1a('0x11')](_0x4c9226);};}exports[_0x5a1a('0xd')]=function(_0x1406bd,_0x567c65){if(_0x1406bd[_0x5a1a('0x12')][_0x5a1a('0x13')]!=='admin')throw new Error(_0x5a1a('0x14'));if(isNaN(Number(_0x1406bd[_0x5a1a('0x15')]['id'])))throw new Error(_0x5a1a('0x16'));return db['UserSetting'][_0x5a1a('0x17')]({'where':{'id':_0x1406bd[_0x5a1a('0x15')]['id']}})[_0x5a1a('0xe')](handleEntityNotFound(_0x567c65,null))[_0x5a1a('0xe')](saveUpdates(_0x1406bd[_0x5a1a('0x18')],null))[_0x5a1a('0xe')](respondWithResult(_0x567c65,null))[_0x5a1a('0x19')](handleError(_0x567c65,null));}; \ No newline at end of file +var _0xb7fc=['admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','api','../../config/environment','../../mysqldb','./user-setting.socket','register','redis','defaults','localhost','status','then','sendStatus','name','send','update','user','role'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x2c9f51,_0x2eec01){_0x2c9f51=_0x2c9f51-0x0;var _0x12abf9=_0xb7fc[_0x2c9f51];return _0x12abf9;};'use strict';var _=require(_0xcb7f('0x0'));var Redis=require('ioredis');var logger=require('../../config/logger')(_0xcb7f('0x1'));var config=require(_0xcb7f('0x2'));var db=require(_0xcb7f('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcb7f('0x4'))[_0xcb7f('0x5')](socket);config[_0xcb7f('0x6')]=_[_0xcb7f('0x7')](config[_0xcb7f('0x6')],{'host':_0xcb7f('0x8'),'port':0x18eb});function respondWithResult(_0x5059ca,_0x226ba8){_0x226ba8=_0x226ba8||0xc8;return function(_0x31de8e){if(_0x31de8e){return _0x5059ca[_0xcb7f('0x9')](_0x226ba8)['json'](_0x31de8e);}};}function saveUpdates(_0x160c70){return function(_0xd77d52){if(_0xd77d52){return _0xd77d52['update'](_0x160c70)[_0xcb7f('0xa')](function(_0x2fe64b){return _0x2fe64b;});}return null;};}function handleEntityNotFound(_0x5159fe){return function(_0x90a14b){if(!_0x90a14b){_0x5159fe[_0xcb7f('0xb')](0x194);}return _0x90a14b;};}function handleError(_0x3853c9,_0x1eac78){_0x1eac78=_0x1eac78||0x1f4;return function(_0x28de2a){logger['error'](_0x28de2a['stack']);if(_0x28de2a[_0xcb7f('0xc')]){delete _0x28de2a[_0xcb7f('0xc')];}_0x3853c9[_0xcb7f('0x9')](_0x1eac78)[_0xcb7f('0xd')](_0x28de2a);};}exports[_0xcb7f('0xe')]=function(_0x1786b2,_0xebcf14){if(_0x1786b2[_0xcb7f('0xf')][_0xcb7f('0x10')]!==_0xcb7f('0x11'))throw new Error(_0xcb7f('0x12'));if(isNaN(Number(_0x1786b2[_0xcb7f('0x13')]['id'])))throw new Error(_0xcb7f('0x14'));return db[_0xcb7f('0x15')][_0xcb7f('0x16')]({'where':{'id':_0x1786b2[_0xcb7f('0x13')]['id']}})[_0xcb7f('0xa')](handleEntityNotFound(_0xebcf14,null))[_0xcb7f('0xa')](saveUpdates(_0x1786b2[_0xcb7f('0x17')],null))[_0xcb7f('0xa')](respondWithResult(_0xebcf14,null))[_0xcb7f('0x18')](handleError(_0xebcf14,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 1a379a6..388551f 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 _0x387d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x22800d,_0x39625e){var _0x190e00=function(_0x1242d4){while(--_0x1242d4){_0x22800d['push'](_0x22800d['shift']());}};_0x190e00(++_0x39625e);}(_0x387d,0x19e));var _0xd387=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x387d[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0xd387('0x0'));var UserSetting=require(_0xd387('0x1'))['db'][_0xd387('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xd387('0x3')](0x0);var events={'afterCreate':_0xd387('0x4'),'afterUpdate':_0xd387('0x5'),'afterDestroy':_0xd387('0x6')};function emitEvent(_0x5b7a4f){return function(_0x1534d1,_0x237edf,_0x198ce6){UserSettingEvents[_0xd387('0x7')](_0x5b7a4f+':'+_0x1534d1['id'],_0x1534d1);UserSettingEvents[_0xd387('0x7')](_0x5b7a4f,_0x1534d1);_0x198ce6(null);};}for(var e in events){if(events[_0xd387('0x8')](e)){var event=events[e];UserSetting[_0xd387('0x9')](e,emitEvent(event));}}module[_0xd387('0xa')]=UserSettingEvents; \ No newline at end of file +var _0xd4ce=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd4ce,0x133));var _0xed4c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xd4ce[_0x32d457];return _0x338386;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xed4c('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed4c('0x1'),'afterUpdate':_0xed4c('0x2'),'afterDestroy':_0xed4c('0x3')};function emitEvent(_0x366b24){return function(_0xd930b9,_0xd24d52,_0x54b9b0){UserSettingEvents[_0xed4c('0x4')](_0x366b24+':'+_0xd930b9['id'],_0xd930b9);UserSettingEvents['emit'](_0x366b24,_0xd930b9);_0x54b9b0(null);};}for(var e in events){if(events[_0xed4c('0x5')](e)){var event=events[e];UserSetting[_0xed4c('0x6')](e,emitEvent(event));}}module['exports']=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 731a13c..11e121a 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 _0x261b=['clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x4914de,_0x28f254){var _0x2ee264=function(_0x19b9e1){while(--_0x19b9e1){_0x4914de['push'](_0x4914de['shift']());}};_0x2ee264(++_0x28f254);}(_0x261b,0x15a));var _0xb261=function(_0x33ac88,_0xa99365){_0x33ac88=_0x33ac88-0x0;var _0x84a5b4=_0x261b[_0x33ac88];return _0x84a5b4;};'use strict';var attributes=require(_0xb261('0x0'));module[_0xb261('0x1')]=function(_0x53bded){return _0x53bded['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x392d5c){if(!_0x392d5c['clientSideLoggingEnabled'])_0x392d5c[_0xb261('0x2')]=null;else if(_0x392d5c['clientSideLoggingEnabledSince']===null)_0x392d5c[_0xb261('0x2')]=new Date();}}});}; \ No newline at end of file +var _0x7d13=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','define'];(function(_0x5d0a7a,_0x5a3091){var _0x725a74=function(_0x43d376){while(--_0x43d376){_0x5d0a7a['push'](_0x5d0a7a['shift']());}};_0x725a74(++_0x5a3091);}(_0x7d13,0x6c));var _0x37d1=function(_0x5dce88,_0x3d6a44){_0x5dce88=_0x5dce88-0x0;var _0x14e9ad=_0x7d13[_0x5dce88];return _0x14e9ad;};'use strict';var attributes=require('./user-setting.attributes');module[_0x37d1('0x0')]=function(_0x59c6ac){return _0x59c6ac[_0x37d1('0x1')]('UserSetting',attributes,{'tableName':_0x37d1('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x317366){if(!_0x317366[_0x37d1('0x3')])_0x317366[_0x37d1('0x4')]=null;else if(_0x317366[_0x37d1('0x4')]===null)_0x317366['clientSideLoggingEnabledSince']=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 a7ab489..d10e4fc 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 _0x8643=['save','remove','emit','register','user-setting:','./user-setting.events'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x8643,0xdd));var _0x3864=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x8643[_0x50007c];return _0x5c1ec7;};'use strict';var UserSettingEvents=require(_0x3864('0x0'));var events=[_0x3864('0x1'),_0x3864('0x2'),'update'];function createListener(_0x2027ff,_0x161aae){return function(_0x123fea){_0x161aae['emit'](_0x2027ff,_0x123fea);if(_0x2027ff==='user-setting:update'){_0x161aae[_0x3864('0x3')]('user-setting:update:user-'+_0x123fea['UserId'],_0x123fea);}};}exports[_0x3864('0x4')]=function(_0x47b53d){for(var _0x4eb3e3=0x0,_0x1af9c9=events['length'];_0x4eb3e3<_0x1af9c9;_0x4eb3e3++){var _0x15ffa6=events[_0x4eb3e3];var _0x324cf7=createListener(_0x3864('0x5')+_0x15ffa6,_0x47b53d);UserSettingEvents['on'](_0x15ffa6,_0x324cf7);}}; \ No newline at end of file +var _0xd4c9=['length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xd4c9,0x124));var _0x9d4c=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0xd4c9[_0x4c260a];return _0x17bbdd;};'use strict';var UserSettingEvents=require(_0x9d4c('0x0'));var events=['save',_0x9d4c('0x1'),_0x9d4c('0x2')];function createListener(_0x3d723e,_0x5825b2){return function(_0x692ff9){_0x5825b2[_0x9d4c('0x3')](_0x3d723e,_0x692ff9);if(_0x3d723e===_0x9d4c('0x4')){_0x5825b2[_0x9d4c('0x3')](_0x9d4c('0x5')+_0x692ff9[_0x9d4c('0x6')],_0x692ff9);}};}exports[_0x9d4c('0x7')]=function(_0x111fef){for(var _0x3dc0d8=0x0,_0x36368f=events[_0x9d4c('0x8')];_0x3dc0d8<_0x36368f;_0x3dc0d8++){var _0x4d563d=events[_0x3dc0d8];var _0x1e42ae=createListener(_0x9d4c('0x9')+_0x4d563d,_0x111fef);UserSettingEvents['on'](_0x4d563d,_0x1e42ae);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7f82bb1..8415910 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 _0xb09d=['removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','now','originalname','/:id/avatar','single','/:id/login','login','/:id/logout','/:id/pause','pause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x17c273,_0x4d6ed7){var _0x1e2674=function(_0x8c338d){while(--_0x8c338d){_0x17c273['push'](_0x17c273['shift']());}};_0x1e2674(++_0x4d6ed7);}(_0xb09d,0xed));var _0xdb09=function(_0x353a4f,_0x319a15){_0x353a4f=_0x353a4f-0x0;var _0x5f1f64=_0xb09d[_0x353a4f];return _0x5f1f64;};'use strict';var multer=require(_0xdb09('0x0'));var util=require(_0xdb09('0x1'));var path=require(_0xdb09('0x2'));var timeout=require(_0xdb09('0x3'));var express=require(_0xdb09('0x4'));var router=express[_0xdb09('0x5')]();var fs_extra=require(_0xdb09('0x6'));var auth=require(_0xdb09('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdb09('0x8'));var controller=require(_0xdb09('0x9'));router[_0xdb09('0xa')]('/',auth[_0xdb09('0xb')](),controller[_0xdb09('0xc')]);router[_0xdb09('0xa')](_0xdb09('0xd'),auth[_0xdb09('0xb')](),controller[_0xdb09('0xe')]);router[_0xdb09('0xa')](_0xdb09('0xf'),auth['isAuthenticated'](),controller['whoami']);router[_0xdb09('0xa')](_0xdb09('0x10'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x11')]);router[_0xdb09('0xa')](_0xdb09('0x12'),auth['isAuthenticated'](),controller['show']);router[_0xdb09('0xa')]('/:id/avatar',controller[_0xdb09('0x13')]);router[_0xdb09('0xa')](_0xdb09('0x14'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x15')]);router[_0xdb09('0xa')]('/:id/contacts',auth[_0xdb09('0xb')](),controller[_0xdb09('0x16')]);router[_0xdb09('0xa')](_0xdb09('0x17'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x18')]);router['get'](_0xdb09('0x19'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router['get'](_0xdb09('0x1a'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x1b')]);router[_0xdb09('0xa')](_0xdb09('0x1c'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x1d')]);router[_0xdb09('0xa')](_0xdb09('0x1e'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x1f')]);router[_0xdb09('0xa')]('/:id/chat/interactions',auth[_0xdb09('0xb')](),controller[_0xdb09('0x20')]);router[_0xdb09('0xa')](_0xdb09('0x21'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x22')]);router['get'](_0xdb09('0x23'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x24')]);router[_0xdb09('0xa')](_0xdb09('0x25'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x26')]);router[_0xdb09('0xa')](_0xdb09('0x27'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x28')]);router[_0xdb09('0xa')](_0xdb09('0x29'),auth[_0xdb09('0xb')](),controller['getWhatsappInteractions']);router['get'](_0xdb09('0x2a'),auth['isAuthenticated'](),controller[_0xdb09('0x2b')]);router[_0xdb09('0xa')](_0xdb09('0x2c'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x2d')]);router[_0xdb09('0xa')]('/:id/agents',auth['isAuthenticated'](),controller[_0xdb09('0x2e')]);router[_0xdb09('0xa')]('/:id/prefixes',auth[_0xdb09('0xb')](),controller['getVoicePrefixes']);router['get'](_0xdb09('0x2f'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x30')]);router[_0xdb09('0xa')]('/:id/mail_accounts',auth[_0xdb09('0xb')](),controller[_0xdb09('0x31')]);router['get'](_0xdb09('0x32'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x33')]);router[_0xdb09('0xa')]('/:id/sms_accounts',auth[_0xdb09('0xb')](),controller['getSmsAccounts']);router[_0xdb09('0xa')]('/:id/chat_websites',auth[_0xdb09('0xb')](),controller[_0xdb09('0x34')]);router['get'](_0xdb09('0x35'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x36')]);router[_0xdb09('0xa')](_0xdb09('0x37'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x38')]);router[_0xdb09('0xa')](_0xdb09('0x39'),auth[_0xdb09('0xb')](),controller['getApiKey']);router[_0xdb09('0x3a')]('/:id/contacts',auth[_0xdb09('0xb')](),controller[_0xdb09('0x3b')]);router[_0xdb09('0x3a')]('/',auth[_0xdb09('0xb')](),controller[_0xdb09('0x3c')]);router[_0xdb09('0x3a')](_0xdb09('0x3d'),auth['isAuthenticated'](),controller[_0xdb09('0x3e')]);router[_0xdb09('0x3a')](_0xdb09('0x17'),auth['isAuthenticated'](),controller[_0xdb09('0x3f')]);var upload=multer({'storage':multer[_0xdb09('0x40')]({'destination':function(_0xd00b4f,_0x4a4f76,_0x49c73e){_0x49c73e(null,path[_0xdb09('0x41')](config[_0xdb09('0x42')],_0xdb09('0x43')));},'filename':function(_0x34776c,_0x17d317,_0x32131d){_0x32131d(null,util['format']('%s-%s',Date[_0xdb09('0x44')](),_0x17d317[_0xdb09('0x45')]));}})});router[_0xdb09('0x3a')](_0xdb09('0x46'),upload[_0xdb09('0x47')]('file'),controller['addAvatar']);router[_0xdb09('0x3a')](_0xdb09('0x48'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x49')]);router[_0xdb09('0x3a')](_0xdb09('0x4a'),auth['isAuthenticated'](),controller['logout']);router['post'](_0xdb09('0x4b'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x4c')]);router['post']('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router[_0xdb09('0x3a')](_0xdb09('0x2a'),auth['isAuthenticated'](),controller[_0xdb09('0x4d')]);router[_0xdb09('0x3a')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xdb09('0x4e')]);router[_0xdb09('0x3a')](_0xdb09('0x4f'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x50')]);router[_0xdb09('0x3a')](_0xdb09('0x51'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x52')]);router['post'](_0xdb09('0x53'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x54')]);router[_0xdb09('0x3a')](_0xdb09('0x55'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x56')]);router[_0xdb09('0x3a')](_0xdb09('0x57'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x58')]);router[_0xdb09('0x3a')]('/:id/fax_accounts',auth[_0xdb09('0xb')](),controller[_0xdb09('0x59')]);router['post'](_0xdb09('0x5a'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x5b')]);router[_0xdb09('0x3a')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xdb09('0x5c')]);router[_0xdb09('0x3a')](_0xdb09('0x5d'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x5e')]);router[_0xdb09('0x3a')](_0xdb09('0x5f'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x60')]);router[_0xdb09('0x3a')](_0xdb09('0x35'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x61')]);router[_0xdb09('0x3a')]('/:id/api_key',auth[_0xdb09('0xb')](),controller['createApiKey']);router[_0xdb09('0x62')](_0xdb09('0x12'),auth['isAuthenticated'](),controller[_0xdb09('0x63')]);router[_0xdb09('0x62')](_0xdb09('0x64'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x65')]);router[_0xdb09('0x66')]('/:id/queues',auth['isAuthenticated'](),controller[_0xdb09('0x67')]);router[_0xdb09('0x66')](_0xdb09('0x2a'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x68')]);router[_0xdb09('0x66')](_0xdb09('0x12'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x69')]);router[_0xdb09('0x66')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xdb09('0x6a')]);router[_0xdb09('0x66')](_0xdb09('0x4f'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x6b')]);router[_0xdb09('0x66')](_0xdb09('0x51'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x6c')]);router[_0xdb09('0x66')]('/:id/sms_interactions',auth[_0xdb09('0xb')](),controller['removeSmsInteractions']);router['delete'](_0xdb09('0x55'),auth['isAuthenticated'](),controller[_0xdb09('0x6d')]);router[_0xdb09('0x66')](_0xdb09('0x57'),auth[_0xdb09('0xb')](),controller['removeWhatsappInteractions']);router['delete'](_0xdb09('0x2f'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x6e')]);router['delete'](_0xdb09('0x5a'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x6f')]);router['delete'](_0xdb09('0x32'),auth[_0xdb09('0xb')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xdb09('0xb')](),controller[_0xdb09('0x70')]);router[_0xdb09('0x66')](_0xdb09('0x5f'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x71')]);router[_0xdb09('0x66')](_0xdb09('0x35'),auth['isAuthenticated'](),controller[_0xdb09('0x72')]);router[_0xdb09('0x66')](_0xdb09('0x39'),auth[_0xdb09('0xb')](),controller[_0xdb09('0x73')]);module[_0xdb09('0x74')]=router; \ No newline at end of file +var _0xa699=['../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','addContacts','post','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','single','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','/:id/api_key','createApiKey','put','/:id','update','/:id/password','delete','removeQueues','destroy','removeChatInteractions','/:id/mail_interactions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x25971b,_0x57af37){var _0x2d0c04=function(_0x3a8797){while(--_0x3a8797){_0x25971b['push'](_0x25971b['shift']());}};_0x2d0c04(++_0x57af37);}(_0xa699,0x6b));var _0x9a69=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0xa699[_0x4df6f9];return _0x4b1a73;};'use strict';var multer=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var path=require(_0x9a69('0x2'));var timeout=require(_0x9a69('0x3'));var express=require(_0x9a69('0x4'));var router=express[_0x9a69('0x5')]();var fs_extra=require(_0x9a69('0x6'));var auth=require(_0x9a69('0x7'));var interaction=require(_0x9a69('0x8'));var config=require(_0x9a69('0x9'));var controller=require(_0x9a69('0xa'));router[_0x9a69('0xb')]('/',auth[_0x9a69('0xc')](),controller['index']);router[_0x9a69('0xb')](_0x9a69('0xd'),auth[_0x9a69('0xc')](),controller[_0x9a69('0xe')]);router['get'](_0x9a69('0xf'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x10')]);router[_0x9a69('0xb')](_0x9a69('0x11'),auth['isAuthenticated'](),controller['getPresence']);router[_0x9a69('0xb')]('/:id',auth[_0x9a69('0xc')](),controller[_0x9a69('0x12')]);router['get'](_0x9a69('0x13'),controller[_0x9a69('0x14')]);router['get'](_0x9a69('0x15'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x16')]);router[_0x9a69('0xb')](_0x9a69('0x17'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x18')]);router[_0x9a69('0xb')](_0x9a69('0x19'),auth['isAuthenticated'](),controller[_0x9a69('0x1a')]);router[_0x9a69('0xb')](_0x9a69('0x1b'),auth['isAuthenticated'](),controller[_0x9a69('0x1c')]);router[_0x9a69('0xb')](_0x9a69('0x1d'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x1e')]);router['get'](_0x9a69('0x1f'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x20')]);router[_0x9a69('0xb')](_0x9a69('0x21'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x22')]);router[_0x9a69('0xb')](_0x9a69('0x23'),auth[_0x9a69('0xc')](),controller['getChatInteractions']);router['get'](_0x9a69('0x24'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x25')]);router['get'](_0x9a69('0x26'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x27')]);router['get']('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x9a69('0x28')]);router['get'](_0x9a69('0x29'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x2a')]);router[_0x9a69('0xb')]('/:id/whatsapp/interactions',auth[_0x9a69('0xc')](),controller['getWhatsappInteractions']);router[_0x9a69('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9a69('0x2b')]);router[_0x9a69('0xb')](_0x9a69('0x2c'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x2d')]);router[_0x9a69('0xb')](_0x9a69('0x2e'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x2f')]);router[_0x9a69('0xb')]('/:id/prefixes',auth[_0x9a69('0xc')](),controller[_0x9a69('0x30')]);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x9a69('0x31')]);router['get'](_0x9a69('0x32'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x33')]);router[_0x9a69('0xb')](_0x9a69('0x34'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x35')]);router[_0x9a69('0xb')](_0x9a69('0x36'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x37')]);router[_0x9a69('0xb')](_0x9a69('0x38'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x39')]);router[_0x9a69('0xb')](_0x9a69('0x3a'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x9a69('0xb')](_0x9a69('0x3b'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x3c')]);router[_0x9a69('0xb')]('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router['post'](_0x9a69('0x17'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x3d')]);router[_0x9a69('0x3e')]('/',auth[_0x9a69('0xc')](),controller[_0x9a69('0x3f')]);router['post']('/create_many',auth[_0x9a69('0xc')](),controller[_0x9a69('0x40')]);router[_0x9a69('0x3e')]('/:id/queues',auth[_0x9a69('0xc')](),controller[_0x9a69('0x41')]);var upload=multer({'storage':multer[_0x9a69('0x42')]({'destination':function(_0xd04375,_0x2251da,_0x29d190){_0x29d190(null,path[_0x9a69('0x43')](config[_0x9a69('0x44')],_0x9a69('0x45')));},'filename':function(_0x36684a,_0x178e4e,_0x4be864){_0x4be864(null,util[_0x9a69('0x46')]('%s-%s',Date['now'](),_0x178e4e['originalname']));}})});router['post'](_0x9a69('0x13'),upload[_0x9a69('0x47')]('file'),controller['addAvatar']);router['post'](_0x9a69('0x48'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x49')]);router['post'](_0x9a69('0x4a'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x4b')]);router[_0x9a69('0x3e')](_0x9a69('0x4c'),auth[_0x9a69('0xc')](),controller['pause']);router[_0x9a69('0x3e')](_0x9a69('0x4d'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x4e')]);router['post'](_0x9a69('0x4f'),auth[_0x9a69('0xc')](),controller['addTeams']);router[_0x9a69('0x3e')](_0x9a69('0x50'),auth[_0x9a69('0xc')](),controller['addChatInteractions']);router['post']('/:id/mail_interactions',auth[_0x9a69('0xc')](),controller[_0x9a69('0x51')]);router[_0x9a69('0x3e')](_0x9a69('0x52'),auth['isAuthenticated'](),controller[_0x9a69('0x53')]);router[_0x9a69('0x3e')](_0x9a69('0x54'),auth[_0x9a69('0xc')](),controller['addSmsInteractions']);router[_0x9a69('0x3e')](_0x9a69('0x55'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x56')]);router['post'](_0x9a69('0x57'),auth['isAuthenticated'](),controller[_0x9a69('0x58')]);router['post'](_0x9a69('0x59'),auth['isAuthenticated'](),controller[_0x9a69('0x5a')]);router['post'](_0x9a69('0x32'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x5b')]);router[_0x9a69('0x3e')]('/:id/openchannel_accounts',auth[_0x9a69('0xc')](),controller[_0x9a69('0x5c')]);router[_0x9a69('0x3e')](_0x9a69('0x36'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x5d')]);router[_0x9a69('0x3e')](_0x9a69('0x38'),auth[_0x9a69('0xc')](),controller['addChatWebsites']);router[_0x9a69('0x3e')](_0x9a69('0x3a'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x5e')]);router[_0x9a69('0x3e')](_0x9a69('0x5f'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x60')]);router[_0x9a69('0x61')](_0x9a69('0x62'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x63')]);router[_0x9a69('0x61')](_0x9a69('0x64'),auth[_0x9a69('0xc')](),controller['changePassword']);router[_0x9a69('0x65')](_0x9a69('0x19'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x66')]);router[_0x9a69('0x65')](_0x9a69('0x4f'),auth[_0x9a69('0xc')](),controller['removeTeams']);router[_0x9a69('0x65')](_0x9a69('0x62'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x67')]);router[_0x9a69('0x65')](_0x9a69('0x50'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x68')]);router[_0x9a69('0x65')](_0x9a69('0x69'),auth[_0x9a69('0xc')](),controller['removeMailInteractions']);router[_0x9a69('0x65')](_0x9a69('0x52'),auth[_0x9a69('0xc')](),controller['removeFaxInteractions']);router[_0x9a69('0x65')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x9a69('0x6a')]);router[_0x9a69('0x65')](_0x9a69('0x55'),auth[_0x9a69('0xc')](),controller['removeOpenchannelInteractions']);router['delete'](_0x9a69('0x57'),auth['isAuthenticated'](),controller[_0x9a69('0x6b')]);router['delete']('/:id/fax_accounts',auth[_0x9a69('0xc')](),controller[_0x9a69('0x6c')]);router[_0x9a69('0x65')](_0x9a69('0x32'),auth[_0x9a69('0xc')](),controller[_0x9a69('0x6d')]);router[_0x9a69('0x65')]('/:id/openchannel_accounts',auth[_0x9a69('0xc')](),controller[_0x9a69('0x6e')]);router[_0x9a69('0x65')](_0x9a69('0x36'),auth['isAuthenticated'](),controller[_0x9a69('0x6f')]);router[_0x9a69('0x65')](_0x9a69('0x38'),auth['isAuthenticated'](),controller[_0x9a69('0x70')]);router[_0x9a69('0x65')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x9a69('0x71')]);router[_0x9a69('0x65')](_0x9a69('0x5f'),auth[_0x9a69('0xc')](),controller['removeApiKey']);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 3c14b92..cad8020 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 _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(_0x573cdf,_0x1009d0){var _0x394fd6=function(_0x332a2b){while(--_0x332a2b){_0x573cdf['push'](_0x573cdf['shift']());}};_0x394fd6(++_0x1009d0);}(_0x34e8,0x12c));var _0x834e=function(_0x4e19b3,_0x4e3a10){_0x4e19b3=_0x4e19b3-0x0;var _0x33433c=_0x34e8[_0x4e19b3];return _0x33433c;};'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 +var _0xedd9=['rfc2833','info','shortinfo','inband','auto','yes','update','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','rtcp_mux','dtlsenable','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','getDataValue','fullname','BOOLEAN','INTEGER','dynamic','friend','peer','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]'];(function(_0x32da0d,_0x573397){var _0x34a0c7=function(_0x57577a){while(--_0x57577a){_0x32da0d['push'](_0x32da0d['shift']());}};_0x34a0c7(++_0x573397);}(_0xedd9,0xfc));var _0x9edd=function(_0x47c14f,_0x562215){_0x47c14f=_0x47c14f-0x0;var _0x25dcf5=_0xedd9[_0x47c14f];return _0x25dcf5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var _=require(_0x9edd('0x2'));module[_0x9edd('0x3')]={'name':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e6d3a){this[_0x9edd('0x6')]('name',_0x3e6d3a);this[_0x9edd('0x6')](_0x9edd('0x7'),_0x3e6d3a);},'comment':_0x9edd('0x8')},'fullname':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'set':function(_0x5319f7){this[_0x9edd('0x6')]('fullname',_0x5319f7);this[_0x9edd('0x6')](_0x9edd('0x9'),util[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,this['getDataValue'](_0x9edd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x523026){if(_0x523026){this[_0x9edd('0x6')](_0x9edd('0xd'),_0x523026['toLowerCase']());}}},'role':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0xf'),_0x9edd('0x10'),_0x9edd('0x11'),_0x9edd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':_0x9edd('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9edd('0xc'),'set':function(_0x44fc7c){this[_0x9edd('0x6')](_0x9edd('0xc'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x14'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x9'),util['format'](_0x9edd('0xb'),this[_0x9edd('0x15')](_0x9edd('0x16')),_0x44fc7c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9edd('0x4')]},'mobile':{'type':Sequelize[_0x9edd('0x4')]},'address':{'type':Sequelize[_0x9edd('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9edd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9edd('0x4')]},'online':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9edd('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9edd('0x19')},'ipaddr':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9edd('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x1a'),'user',_0x9edd('0x1b')),'allowNull':!![],'defaultValue':_0x9edd('0x1a')},'context':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9edd('0x1d'),_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x25'),'set':function(_0x5af178){this[_0x9edd('0x6')](_0x9edd('0x26'),_0x5af178?_0x5af178[_0x9edd('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9edd('0x26'))?this[_0x9edd('0x15')](_0x9edd('0x26'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x29')},'dtmfmode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x9edd('0x2c'),_0x9edd('0x2d'),_0x9edd('0x2e')),'allowNull':!![],'defaultValue':_0x9edd('0x2a')},'directmedia':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no','nonat',_0x9edd('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x6de835){this[_0x9edd('0x6')](_0x9edd('0x31'),_0x6de835?_0x6de835[_0x9edd('0x27')](','):null);},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x31'))?this[_0x9edd('0x15')](_0x9edd('0x31'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9edd('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9edd('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9edd('0x4')]},'disallow':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':_0x9edd('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x34'),'set':function(_0xcbd0ef){this[_0x9edd('0x6')]('allow',_0xcbd0ef?_0xcbd0ef[_0x9edd('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x35'))?this['getDataValue'](_0x9edd('0x35'))[_0x9edd('0x28')](';'):null;},'comment':_0x9edd('0x36')},'autoframing':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'set':function(_0x5bbdf8){this[_0x9edd('0x6')](_0x9edd('0x37'),_0x5bbdf8?_0x5bbdf8['join'](','):null);},'get':function(){return this[_0x9edd('0x15')]('insecure')?this['getDataValue'](_0x9edd('0x37'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x38')},'trustrpid':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x3a')},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'busylevel':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no',_0x9edd('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9edd('0xe')]('uac',_0x9edd('0x3f')),'allowNull':!![],'defaultValue':_0x9edd('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'keepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x9edd('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x41'),_0x9edd('0x42'),_0x9edd('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x44'),_0x9edd('0x30'),_0x9edd('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0,'set':function(_0x3e9a3e){this[_0x9edd('0x6')](_0x9edd('0x47'),_0x3e9a3e);var _0x5df1d7=this[_0x9edd('0x48')]({'plain':!![]});switch(_0x3e9a3e){case 0x0:case 0x1:var _0x507cce=_0x5df1d7[_0x9edd('0x26')]?_[_0x9edd('0x49')](_0x5df1d7[_0x9edd('0x26')])?_0x5df1d7['transport'][_0x9edd('0x27')]():_0x5df1d7['transport']:_0x9edd('0x25');if(_0x507cce===_0x9edd('0x4a')){_0x507cce='udp';}this[_0x9edd('0x6')]('transport',_0x507cce);this[_0x9edd('0x6')](_0x9edd('0x4b'),'no');this[_0x9edd('0x6')]('avpf',null);this[_0x9edd('0x6')](_0x9edd('0x4c'),null);this[_0x9edd('0x6')](_0x9edd('0x4d'),null);this[_0x9edd('0x6')]('dtlsenable',null);this['setDataValue'](_0x9edd('0x4e'),null);this[_0x9edd('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x9edd('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x9edd('0x4f'),'no');break;case 0x2:this[_0x9edd('0x6')]('transport',_0x9edd('0x4a'));this[_0x9edd('0x6')](_0x9edd('0x4b'),'yes');this[_0x9edd('0x6')]('avpf',_0x9edd('0x2f'));this[_0x9edd('0x6')]('force_avp',_0x9edd('0x2f'));this[_0x9edd('0x6')]('icesupport',_0x9edd('0x2f'));this[_0x9edd('0x6')](_0x9edd('0x50'),_0x9edd('0x2f'));this['setDataValue'](_0x9edd('0x4e'),'no');this['setDataValue'](_0x9edd('0x51'),_0x9edd('0x43'));this[_0x9edd('0x6')]('dtlscertfile',_0x5df1d7[_0x9edd('0x52')]||_0x9edd('0x53'));this[_0x9edd('0x6')](_0x9edd('0x54'),_0x5df1d7[_0x9edd('0x54')]||_0x9edd('0x55'));this[_0x9edd('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x9edd('0x56')],'set':function(_0x3c7874){this[_0x9edd('0x6')](_0x9edd('0x57'),_0x3c7874?_0x3c7874[_0x9edd('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9edd('0x57'))?_[_0x9edd('0x58')](this[_0x9edd('0x15')]('permissions')[_0x9edd('0x28')](','),function(_0x29d70d){return parseInt(_0x29d70d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9edd('0x59')],'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x5a'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x1eabcd){if(typeof _0x1eabcd===_0x9edd('0x5b')){var _0xef1397=_0x1eabcd==='1'?!![]:_0x1eabcd==='0'?![]:_0x1eabcd==='true'?!![]:_0x1eabcd===_0x9edd('0x5c')?![]:![];this[_0x9edd('0x6')](_0x9edd('0x5d'),_0xef1397);}else{this[_0x9edd('0x6')](_0x9edd('0x5d'),_0x1eabcd);}}},'blocked':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x14fa8a){this['setDataValue'](_0x9edd('0x5e'),_0x14fa8a);if(_0x14fa8a===!![]){this[_0x9edd('0x6')]('blockedAt',moment());this[_0x9edd('0x6')](_0x9edd('0x5f'),0x0);}else{this['setDataValue'](_0x9edd('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9edd('0x18')](0x5)[_0x9edd('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'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 25029f6..3fde8b9 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 _0xe46a=['unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','VoicePrefixId','getLists','CmList','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','concat','$or','$gt','$lt','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','getAgents','flatten','lower','col','toString','asc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','ringing','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','user_has_','ui.UserId\x20=\x20?','OpenTabs','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/contacts','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','./user.socket','register','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','role','agent','emit','userNotification:recalc:','destroy','admin','user','Agents','Telephones','telephone','ignore','map','value','name','UserProfileResource','end','stack','send','index','rawAttributes','fieldName','type','key','includes','password','salt','getOptions','where','User','query','includeAll','true','include','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','whatsapp','all','show','params','model','differenceBy','keys','filters','intersection','options','find','openchannel','body','describe','addContacts','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','email','permissions','101','102','110','106','107','109','100','114','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','create','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','ids','toLowerCase','QueueId','Queue:save','get','voice','format','SIP/%s','UserVoiceQueueRt','removeQueues','isArray','Queue:remove','addAvatar','filename','getAvatar','join','root','userpic','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','List','Tag','Tags','color','tag','getQueues','Queue','fields','order','sort','filter','merge','nolimit','ChatGroup','pick','getGroups','VoiceRecording','UserId','ScreenRecording','ChatInteraction','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE'];(function(_0xabd9f,_0x47bd2b){var _0x276664=function(_0x2f745e){while(--_0x2f745e){_0xabd9f['push'](_0xabd9f['shift']());}};_0x276664(++_0x47bd2b);}(_0xe46a,0x8a));var _0xae46=function(_0x371f25,_0x1aca37){_0x371f25=_0x371f25-0x0;var _0x95ced9=_0xe46a[_0x371f25];return _0x95ced9;};'use strict';var moment=require('moment');var util=require('util');var path=require(_0xae46('0x0'));var fs=require('fs');var _=require(_0xae46('0x1'));var squel=require(_0xae46('0x2'));var jayson=require(_0xae46('0x3'));var Redis=require(_0xae46('0x4'));var authService=require(_0xae46('0x5'));var contacts=require(_0xae46('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xae46('0x7'));var config=require(_0xae46('0x8'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xae46('0x9'))[_0xae46('0xa')];var APINotFoundError=require(_0xae46('0x9'))['APINotFoundError'];var APIHandleError=require('../../errors/api')['handleError'];var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xae46('0xb'))[_0xae46('0xc')](socket);config['redis']=_[_0xae46('0xd')](config['redis'],{'host':_0xae46('0xe'),'port':0x18eb});var amiClient=jayson[_0xae46('0xf')][_0xae46('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4694f2,_0x2d2de8,_0x46dcf0,_0x10a2c6){return new Promise(function(_0x386abe,_0x3bba26){var _0x89c895=_0x10a2c6||amiClient;return _0x89c895[_0xae46('0x11')](_0x4694f2,_0x46dcf0)[_0xae46('0x12')](function(_0x2bd816){logger[_0xae46('0x13')](_0xae46('0x14'),_0x2d2de8,_0xae46('0x15'));logger[_0xae46('0x16')](_0xae46('0x17'),_0x2d2de8,_0xae46('0x15'),JSON[_0xae46('0x18')](_0x2bd816));if(_0x2bd816[_0xae46('0x19')]){if(_0x2bd816[_0xae46('0x19')][_0xae46('0x1a')]===0x1f4){logger[_0xae46('0x19')](_0xae46('0x14'),_0x2d2de8,_0x2bd816['error'][_0xae46('0x1b')]);return _0x3bba26(_0x2bd816[_0xae46('0x19')][_0xae46('0x1b')]);}logger['error']('User,\x20%s,\x20%s',_0x2d2de8,_0x2bd816[_0xae46('0x19')][_0xae46('0x1b')]);return _0x386abe(_0x2bd816['error']['message']);}else{logger[_0xae46('0x13')](_0xae46('0x14'),_0x2d2de8,_0xae46('0x15'));_0x386abe(_0x2bd816['result']['message']);}})[_0xae46('0x1c')](function(_0x3e5233){logger[_0xae46('0x19')](_0xae46('0x14'),_0x2d2de8,_0x3e5233);_0x3bba26(_0x3e5233);});});}function respondWithStatusCode(_0x3c2d57,_0x13cbc2){_0x13cbc2=_0x13cbc2||0xcc;return function(_0x4c8084){if(_0x4c8084){return _0x3c2d57[_0xae46('0x1d')](_0x13cbc2);}return _0x3c2d57[_0xae46('0x1e')](_0x13cbc2)['end']();};}function respondWithResult(_0x3279b0,_0x455e4e){_0x455e4e=_0x455e4e||0xc8;return function(_0x3c5227){if(_0x3c5227){return _0x3279b0[_0xae46('0x1e')](_0x455e4e)[_0xae46('0x1f')](_0x3c5227);}};}function respondWithFilteredResult(_0x375ed4,_0x1c5eed){return function(_0x5645e5){if(_0x5645e5){var _0x32e305=typeof _0x1c5eed['offset']===_0xae46('0x20')&&typeof _0x1c5eed[_0xae46('0x21')]==='undefined';var _0x1d8c18=_0x5645e5[_0xae46('0x22')];var _0x6ca7a7=_0x32e305?0x0:_0x1c5eed[_0xae46('0x23')];var _0x1b0895=_0x32e305?_0x5645e5['count']:_0x1c5eed[_0xae46('0x23')]+_0x1c5eed[_0xae46('0x21')];var _0x4891e;if(_0x1b0895>=_0x1d8c18){_0x1b0895=_0x1d8c18;_0x4891e=0xc8;}else{_0x4891e=0xce;}_0x375ed4[_0xae46('0x1e')](_0x4891e);return _0x375ed4[_0xae46('0x24')](_0xae46('0x25'),_0x6ca7a7+'-'+_0x1b0895+'/'+_0x1d8c18)[_0xae46('0x1f')](_0x5645e5);}return null;};}function saveUpdates(_0x4e5c62){return function(_0x79d6e4){if(_0x79d6e4){return _0x79d6e4[_0xae46('0x26')](_0x4e5c62)[_0xae46('0x12')](function(_0x571d7f){if(_0x571d7f[_0xae46('0x27')]===_0xae46('0x28')){socket[_0xae46('0x29')](_0xae46('0x2a')+_0x571d7f['id'],_0x571d7f);}return _0x571d7f;});}return null;};}function removeEntity(_0x47061a){return function(_0x358734){if(_0x358734){return _0x358734[_0xae46('0x2b')]()['then'](function(){var _0x50c959=_0x358734['get']({'plain':!![]});if(_0x50c959[_0xae46('0x27')]===_0xae46('0x2c'))return;var _0xb70804=[{'name':'Users','value':_0xae46('0x2d'),'ignore':!![]},{'name':_0xae46('0x2e'),'value':_0xae46('0x28'),'ignore':![]},{'name':_0xae46('0x2f'),'value':_0xae46('0x30'),'ignore':![]}];var _0x19da93=_(_0xb70804)['filter'](_0xae46('0x31'))[_0xae46('0x32')](_0xae46('0x33'))['value']();if(_['includes'](_0x19da93,_0x50c959[_0xae46('0x27')])){return;}var _0x36f72a=_['find'](_0xb70804,[_0xae46('0x33'),_0x50c959[_0xae46('0x27')]])[_0xae46('0x34')];return db[_0xae46('0x35')][_0xae46('0x2b')]({'where':{'type':_0x36f72a,'resourceId':_0x50c959['id']}})[_0xae46('0x12')](function(){return _0x358734;});})[_0xae46('0x12')](function(){_0x47061a[_0xae46('0x1e')](0xcc)[_0xae46('0x36')]();});}};}function handleEntityNotFound(_0x2e9c79){return function(_0xdfd539){if(!_0xdfd539){_0x2e9c79['sendStatus'](0x194);}return _0xdfd539;};}function handleError(_0x17f29d,_0x55a360){_0x55a360=_0x55a360||0x1f4;return function(_0x516ab7){logger['error'](_0x516ab7[_0xae46('0x37')]);if(_0x516ab7[_0xae46('0x34')]){delete _0x516ab7[_0xae46('0x34')];}_0x17f29d[_0xae46('0x1e')](_0x55a360)[_0xae46('0x38')](_0x516ab7);};}exports[_0xae46('0x39')]=function(_0xe3a84,_0x364aa1){var _0x1e7d8d={},_0x4eaa56={'count':0x0,'rows':[]};var _0x354661=_(db['User'][_0xae46('0x3a')])['map'](function(_0xe7a063){return{'name':_0xe7a063[_0xae46('0x3b')],'type':_0xe7a063[_0xae46('0x3c')][_0xae46('0x3d')]};})['filter'](function(_0x318bb9){return!_[_0xae46('0x3e')]([_0xae46('0x3f'),_0xae46('0x40')],_0x318bb9['name']);})['value']();_0x1e7d8d=qs[_0xae46('0x41')](_0x354661,_0xe3a84);var _0x7400e0={'where':_0x1e7d8d[_0xae46('0x42')]};return db[_0xae46('0x43')][_0xae46('0x22')](_0x7400e0)['then'](function(_0x37fa78){_0x4eaa56[_0xae46('0x22')]=_0x37fa78;if(_0xe3a84[_0xae46('0x44')][_0xae46('0x45')]){_0x1e7d8d['include']=[{'all':!![]}];}if(_0xe3a84['query']['userSetting']===_0xae46('0x46')){_0x1e7d8d[_0xae46('0x47')]=[{'model':db[_0xae46('0x48')],'as':_0xae46('0x49')}];}if(!_[_0xae46('0x3e')](_0x1e7d8d[_0xae46('0x4a')],'id')){_0x1e7d8d['attributes'][_0xae46('0x4b')]('id');}return db['User'][_0xae46('0x4c')](_0x1e7d8d);})[_0xae46('0x12')](function(_0x25d934){_0x4eaa56[_0xae46('0x4d')]=_0x25d934;if(_0xe3a84['query'][_0xae46('0x4e')]===_0xae46('0x46')){var _0xcad11f=[];for(var _0x45b9c8=0x0;_0x45b9c8<_0x4eaa56['rows'][_0xae46('0x4f')];_0x45b9c8++){_0xcad11f[_0xae46('0x4b')](get_open_tabs(_0xae46('0x50'),_0x4eaa56['rows'][_0x45b9c8][_0xae46('0x51')]));_0xcad11f[_0xae46('0x4b')](get_open_tabs(_0xae46('0x52'),_0x4eaa56['rows'][_0x45b9c8][_0xae46('0x51')]));_0xcad11f[_0xae46('0x4b')](get_open_tabs(_0xae46('0x53'),_0x4eaa56[_0xae46('0x4d')][_0x45b9c8][_0xae46('0x51')]));_0xcad11f['push'](get_open_tabs(_0xae46('0x54'),_0x4eaa56[_0xae46('0x4d')][_0x45b9c8][_0xae46('0x51')]));_0xcad11f[_0xae46('0x4b')](get_open_tabs('openchannel',_0x4eaa56[_0xae46('0x4d')][_0x45b9c8]['dataValues']));_0xcad11f[_0xae46('0x4b')](get_open_tabs(_0xae46('0x55'),_0x4eaa56[_0xae46('0x4d')][_0x45b9c8][_0xae46('0x51')]));}return Promise[_0xae46('0x56')](_0xcad11f)['then'](function(){return _0x4eaa56;});}else{return _0x4eaa56;}})[_0xae46('0x12')](respondWithFilteredResult(_0x364aa1,_0x1e7d8d))[_0xae46('0x1c')](handleError(_0x364aa1,null));};exports[_0xae46('0x57')]=function(_0x343e22,_0x49579b){var _0x59157f={'raw':![],'where':{'id':_0x343e22[_0xae46('0x58')]['id']}},_0xda6104={};_0xda6104[_0xae46('0x59')]=_[_0xae46('0x5a')](_[_0xae46('0x5b')](db[_0xae46('0x43')][_0xae46('0x3a')]),[_0xae46('0x3f'),_0xae46('0x40')]);_0xda6104[_0xae46('0x44')]=_[_0xae46('0x5b')](_0x343e22[_0xae46('0x44')]);_0xda6104[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0xda6104[_0xae46('0x59')],_0xda6104['query']);_0x59157f['attributes']=_[_0xae46('0x5d')](_0xda6104[_0xae46('0x59')],qs['fields'](_0x343e22[_0xae46('0x44')]['fields']));_0x59157f['attributes']=_0x59157f[_0xae46('0x4a')][_0xae46('0x4f')]?_0x59157f['attributes']:_0xda6104['model'];if(_0x343e22[_0xae46('0x44')][_0xae46('0x45')]){_0x59157f[_0xae46('0x47')]=[{'all':!![]}];}if(_0x343e22['query'][_0xae46('0x49')]===_0xae46('0x46')){_0x59157f[_0xae46('0x47')]=[{'model':db[_0xae46('0x48')],'as':_0xae46('0x49')}];}_0x59157f=_['merge']({},_0x59157f,_0x343e22[_0xae46('0x5e')]);if(!_[_0xae46('0x3e')](_0x59157f[_0xae46('0x4a')],'id')){_0x59157f['attributes'][_0xae46('0x4b')]('id');}return db[_0xae46('0x43')][_0xae46('0x5f')](_0x59157f)[_0xae46('0x12')](handleEntityNotFound(_0x49579b,null))['then'](function(_0x95ff1f){var _0x452bed=[];values=_0x95ff1f;if(_0x343e22[_0xae46('0x44')][_0xae46('0x4e')]===_0xae46('0x46')){_0x452bed['push'](get_open_tabs(_0xae46('0x50'),_0x95ff1f[_0xae46('0x51')]));_0x452bed['push'](get_open_tabs(_0xae46('0x52'),_0x95ff1f['dataValues']));_0x452bed[_0xae46('0x4b')](get_open_tabs(_0xae46('0x60'),_0x95ff1f[_0xae46('0x51')]));_0x452bed[_0xae46('0x4b')](get_open_tabs(_0xae46('0x55'),_0x95ff1f[_0xae46('0x51')]));_0x452bed[_0xae46('0x4b')](get_open_tabs(_0xae46('0x53'),_0x95ff1f[_0xae46('0x51')]));_0x452bed['push'](get_open_tabs('mail',_0x95ff1f[_0xae46('0x51')]));return Promise['all'](_0x452bed);}else{return values;}})[_0xae46('0x12')](function(){return values;})[_0xae46('0x12')](respondWithResult(_0x49579b,null))[_0xae46('0x1c')](handleError(_0x49579b,null));};exports[_0xae46('0x26')]=function(_0x5e1751,_0x1e0089){if(_0x5e1751[_0xae46('0x61')]['id']){delete _0x5e1751['body']['id'];}delete _0x5e1751[_0xae46('0x61')][_0xae46('0x27')];return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x5e1751[_0xae46('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e0089,null))[_0xae46('0x12')](saveUpdates(_0x5e1751[_0xae46('0x61')],null))[_0xae46('0x12')](respondWithResult(_0x1e0089,null))[_0xae46('0x1c')](handleError(_0x1e0089,null));};exports['describe']=function(_0x1c40ec,_0x4f1044){return db[_0xae46('0x43')][_0xae46('0x62')]()[_0xae46('0x12')](respondWithResult(_0x4f1044,null))[_0xae46('0x1c')](handleError(_0x4f1044,null));};exports[_0xae46('0x63')]=function(_0x330543,_0x642963){return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x330543[_0xae46('0x58')]['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x642963,null))[_0xae46('0x12')](function(_0x14bce0){if(_0x14bce0){return _0x14bce0[_0xae46('0x63')](_0x330543[_0xae46('0x61')]['ids'],_[_0xae46('0x64')](_0x330543['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x642963,null))['catch'](handleError(_0x642963,null));};function validateUser(_0x5586a3){return new Promise(function(_0x3350f6,_0x25ed79){if(_0x5586a3[_0xae46('0x65')])return _0x3350f6(_0x5586a3);return db[_0xae46('0x66')][_0xae46('0x67')](0x1)[_0xae46('0x12')](function(_0x12ef77){if(_0x12ef77[_0xae46('0x68')])authService[_0xae46('0x69')](_0x5586a3[_0xae46('0x3f')]);db[_0xae46('0x43')][_0xae46('0x6a')](_0xae46('0x65'))[_0xae46('0x12')](function(_0x3e2592){if(_[_0xae46('0x6b')](_0x3e2592)){_0x5586a3['internal']=_0x12ef77[_0xae46('0x6c')]||0x1;return;}if(_[_0xae46('0x6b')](_0x12ef77[_0xae46('0x6c')])||_0x12ef77[_0xae46('0x6c')]===_0x3e2592){_0x5586a3[_0xae46('0x65')]=_0x3e2592+0x1;return;}if(_0x12ef77[_0xae46('0x6c')]>_0x3e2592){_0x5586a3['internal']=_0x12ef77[_0xae46('0x6c')];return;}return db[_0xae46('0x6d')][_0xae46('0x44')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xae46('0x6d')][_0xae46('0x6e')][_0xae46('0x6f')]})['then'](function(_0x4f6aa0){if(_0x4f6aa0&&_0x4f6aa0[_0xae46('0x4f')]){for(var _0x431a70=0x0,_0x46501d=_0x4f6aa0[_0xae46('0x4f')];_0x431a70<_0x46501d&&_[_0xae46('0x6b')](_0x5586a3['internal']);_0x431a70++){if(_0x12ef77[_0xae46('0x6c')]<=_0x4f6aa0[_0x431a70][_0xae46('0x70')]){_0x5586a3[_0xae46('0x65')]=_0x4f6aa0[_0x431a70][_0xae46('0x70')];}else if(_0x12ef77[_0xae46('0x6c')]>_0x4f6aa0[_0x431a70][_0xae46('0x70')]&&_0x12ef77[_0xae46('0x6c')]<=_0x4f6aa0[_0x431a70]['to']){_0x5586a3[_0xae46('0x65')]=_0x12ef77[_0xae46('0x6c')];}}}if(_[_0xae46('0x6b')](_0x5586a3['internal'])){_0x5586a3['internal']=_0x3e2592+0x1;}return _0x3350f6(_0x5586a3);});});})['catch'](function(_0x30a3f8){_0x25ed79(_0x30a3f8);});});}function updateUser(_0x28d656){return new Promise(function(_0x359c2f,_0x446d13){try{if(_0x28d656[_0xae46('0x71')]){_0x28d656['mailbox']=_0x28d656[_0xae46('0x65')];_0x28d656[_0xae46('0x72')]={'mailbox':_0x28d656[_0xae46('0x65')],'password':_0x28d656['password'],'fullname':_0x28d656[_0xae46('0x73')],'email':_0x28d656[_0xae46('0x74')]};}if(_0x28d656[_0xae46('0x27')]===_0xae46('0x28')){if(!_0x28d656[_0xae46('0x75')])_0x28d656[_0xae46('0x75')]=[_0xae46('0x76'),_0xae46('0x77'),'103','113',_0xae46('0x78'),'104','105',_0xae46('0x79'),_0xae46('0x7a'),'108',_0xae46('0x7b'),_0xae46('0x7c'),'111',_0xae46('0x7d'),_0xae46('0x7e')];}_0x359c2f(_0x28d656);}catch(_0x55d71e){_0x446d13(_0x55d71e);}});}exports['create']=function(_0x2ed18d,_0x2024c1){if(_0x2ed18d[_0xae46('0x2d')][_0xae46('0x27')]===_0xae46('0x28'))throw new Error(_0xae46('0x7f'));if(_0x2ed18d[_0xae46('0x61')][_0xae46('0x27')]===_0xae46('0x2d')&&_0x2ed18d[_0xae46('0x2d')][_0xae46('0x27')]!=='admin'){throw new Error(_0xae46('0x80'));}if(_0x2ed18d[_0xae46('0x61')][_0xae46('0x27')]===_0xae46('0x2c')&&_0x2ed18d[_0xae46('0x2d')][_0xae46('0x27')]!=='admin'){throw new Error(_0xae46('0x81'));}return licenseUtil[_0xae46('0x82')]([_0x2ed18d[_0xae46('0x61')]])[_0xae46('0x12')](function(){return validateUser(_0x2ed18d['body']);})[_0xae46('0x12')](function(_0x47fe6c){return updateUser(_0x47fe6c)[_0xae46('0x12')](function(_0x563971){if(_0x563971[_0xae46('0x27')]===_0xae46('0x2c')){_0x563971[_0xae46('0x83')]=_0x2ed18d['user'][_0xae46('0x83')];delete _0x563971['userProfileId'];}return _0x563971;});})[_0xae46('0x12')](function(_0x563acf){return db[_0xae46('0x43')][_0xae46('0x84')](_0x563acf,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xae46('0x12')](function(_0x32f803){if(_0x2ed18d[_0xae46('0x61')][_0xae46('0x27')]===_0xae46('0x2d'))return _0x32f803;if(_0x2ed18d[_0xae46('0x2d')]['role']!==_0xae46('0x2d'))return _0x32f803;return db[_0xae46('0x85')][_0xae46('0x5f')]({'where':{'name':_0x32f803['role']===_0xae46('0x28')?_0xae46('0x2e'):_0xae46('0x2f'),'userProfileId':_0x2ed18d[_0xae46('0x2d')][_0xae46('0x86')]},'raw':!![]})[_0xae46('0x12')](function(_0x28621d){if(!_0x28621d||_0x28621d[_0xae46('0x87')]!=0x0)return _0x32f803;return db[_0xae46('0x35')]['create']({'name':_0x32f803[_0xae46('0x34')],'resourceId':_0x32f803['id'],'type':_0x28621d['name'],'sectionId':_0x28621d['id']},{})[_0xae46('0x12')](function(){return _0x32f803;});})[_0xae46('0x1c')](function(_0x4f67e7){logger[_0xae46('0x19')](_0xae46('0x88'),_0x4f67e7);throw _0x4f67e7;});})[_0xae46('0x12')](respondWithResult(_0x2024c1,0xc9))[_0xae46('0x1c')](handleError(_0x2024c1,null));};exports[_0xae46('0x89')]=function(_0xbee702,_0x2d6a62){var _0x382576=_0xbee702[_0xae46('0x61')];var _0x1cb783=[];if(_0xbee702[_0xae46('0x2d')][_0xae46('0x27')]===_0xae46('0x28'))throw new Error('Unauthorized');if(_[_0xae46('0x8a')](_0x382576,['role','user'])&&_0xbee702[_0xae46('0x2d')][_0xae46('0x27')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x382576,[_0xae46('0x27'),_0xae46('0x2c')])&&_0xbee702[_0xae46('0x2d')][_0xae46('0x27')]!==_0xae46('0x2c')){throw new Error(_0xae46('0x8b'));}return licenseUtil[_0xae46('0x82')](_0x382576)['then'](function(){return validateUser(_0x382576[0x0]);})[_0xae46('0x12')](function(){for(var _0x42252b=0x1;_0x42252b<_0x382576['length'];_0x42252b++){var _0x1b1f8e=_0x382576[_0x42252b-0x1][_0xae46('0x65')];if(!_0x382576[_0x42252b][_0xae46('0x65')])_0x382576[_0x42252b][_0xae46('0x65')]=_0x1b1f8e+0x1;_0x1cb783['push'](validateUser(_0x382576[_0x42252b]));}return Promise[_0xae46('0x56')](_0x1cb783);})[_0xae46('0x12')](function(){_0x1cb783=[];for(var _0x5d258b=0x0;_0x5d258b<_0x382576['length'];_0x5d258b++){_0x1cb783['push'](updateUser(_0x382576[_0x5d258b]));}return Promise['all'](_0x1cb783);})[_0xae46('0x12')](function(){_0x1cb783=_0x382576['map'](function(_0x325bdc){return db['User'][_0xae46('0x84')](_0x325bdc,{'include':[{'model':db[_0xae46('0x72')],'as':_0xae46('0x72')}]})[_0xae46('0x12')](function(_0x1b7fac){_0x325bdc['id']=_0x1b7fac['id'];return _0x325bdc;});});return Promise[_0xae46('0x56')](_0x1cb783);})['then'](function(_0x13d786){if(_0xbee702[_0xae46('0x61')]['role']===_0xae46('0x2d'))return _0x13d786;if(_0xbee702['user'][_0xae46('0x27')]!==_0xae46('0x2d'))return _0x13d786;var _0x2a7c06=_[_0xae46('0x8a')](_0x13d786,function(_0x4762fb){return _0x4762fb['role']===_0xae46('0x28')||_0x4762fb[_0xae46('0x27')]==='telephone';});if(!_0x2a7c06)return _0x13d786;return db[_0xae46('0x85')][_0xae46('0x4c')]({'where':{'name':{'$or':[_0xae46('0x2e'),_0xae46('0x2f')]},'userProfileId':_0xbee702[_0xae46('0x2d')]['userProfileId']},'raw':!![]})[_0xae46('0x12')](function(_0xadba44){if(_[_0xae46('0x8c')](_0xadba44)||!_['some'](_0xadba44,[_0xae46('0x87'),0x0]))return _0x13d786;_0x1cb783=[];var _0x2e2382=_(_0xadba44)[_0xae46('0x32')](function(_0xd24066){if(_0xd24066['autoAssociation']===0x1)return;return _0xd24066[_0xae46('0x34')]===_0xae46('0x2e')?_0xae46('0x28'):_0xae46('0x30');})[_0xae46('0x8d')]()['value']();for(var _0x3e05c8=0x0;_0x3e05c8<_0x13d786[_0xae46('0x4f')];_0x3e05c8++){if(!_[_0xae46('0x3e')](_0x2e2382,_0x13d786[_0x3e05c8]['role']))return;var _0xe93156=_0x13d786[_0x3e05c8][_0xae46('0x27')]===_0xae46('0x28')?_0xae46('0x2e'):_0xae46('0x2f');_0x1cb783[_0xae46('0x4b')](db['UserProfileResource'][_0xae46('0x84')]({'name':_0x13d786[_0x3e05c8]['name'],'resourceId':_0x13d786[_0x3e05c8]['id'],'type':_0xe93156,'sectionId':_[_0xae46('0x5f')](_0xadba44,['name',_0xe93156])['id']},{}));}return Promise[_0xae46('0x56')](_0x1cb783);});})[_0xae46('0x12')](respondWithResult(_0x2d6a62,0xc9))['catch'](handleError(_0x2d6a62,null));};exports[_0xae46('0x8e')]=function(_0x2795c7,_0x4c145e){if(_0x2795c7['body']['id']){delete _0x2795c7['body']['id'];}return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x2795c7[_0xae46('0x58')]['id']}})[_0xae46('0x12')](function(_0x5b7bed){if(!_0x5b7bed)return null;if(_0x5b7bed['id']===_0x2795c7['user']['id']){if(!_0x2795c7[_0xae46('0x61')][_0xae46('0x8f')]||!_0x2795c7[_0xae46('0x61')][_0xae46('0x90')]){throw new db['Sequelize']['ValidationError'](_0xae46('0x91'));}if(!_0x5b7bed[_0xae46('0x92')](_0x2795c7[_0xae46('0x61')][_0xae46('0x8f')])){throw new db[(_0xae46('0x93'))][(_0xae46('0x94'))]('Wrong\x20credentials');}if(_0x2795c7[_0xae46('0x61')][_0xae46('0x8f')]===_0x2795c7[_0xae46('0x61')]['newPassword']){throw new db[(_0xae46('0x93'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x2795c7[_0xae46('0x2d')][_0xae46('0x27')]===_0xae46('0x2c')){if(!_0x2795c7[_0xae46('0x61')][_0xae46('0x90')]){throw new db[(_0xae46('0x93'))][(_0xae46('0x94'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x2795c7[_0xae46('0x2d')]['role']===_0xae46('0x2d')){if(!_0x2795c7[_0xae46('0x61')]['newPassword']){throw new db[(_0xae46('0x93'))][(_0xae46('0x94'))](_0xae46('0x95'));}if(_0x5b7bed[_0xae46('0x27')]!==_0xae46('0x28')){throw new db[(_0xae46('0x93'))][(_0xae46('0x94'))](_0xae46('0x7f'));}}else{throw new db['Sequelize'][(_0xae46('0x94'))](_0xae46('0x7f'));}return _0x5b7bed;})[_0xae46('0x12')](handleEntityNotFound(_0x4c145e,null))[_0xae46('0x12')](function(_0x2070f){return db[_0xae46('0x66')][_0xae46('0x96')]({'attributes':['id',_0xae46('0x68'),_0xae46('0x97'),_0xae46('0x98')]})[_0xae46('0x12')](function(_0x56cb16){if(_0x56cb16[_0xae46('0x68')])authService[_0xae46('0x69')](_0x2795c7['body'][_0xae46('0x90')]);if(!_0x56cb16['enforcePasswordHistory']||!_0x2070f[_0xae46('0x99')])return _0x2070f;authService[_0xae46('0x9a')](_0x2795c7['body'][_0xae46('0x90')],_0x2070f[_0xae46('0x99')],_0x56cb16['passwordHistoryLimit']);return _0x2070f;})[_0xae46('0x12')](saveUpdates({'password':_0x2795c7[_0xae46('0x61')][_0xae46('0x90')],'passwordResetAt':_0x2795c7[_0xae46('0x2d')]['id']==_0x2795c7[_0xae46('0x58')]['id']?moment():null,'previousPasswords':authService[_0xae46('0x9b')](_0x2795c7[_0xae46('0x61')]['newPassword'],_0x2070f['previousPasswords'])},null));})['then'](respondWithResult(_0x4c145e,null))[_0xae46('0x1c')](handleError(_0x4c145e,null));};exports[_0xae46('0x9c')]=function(_0x454312,_0x2db394){var _0x6c58cc=_0x454312[_0xae46('0x61')][_0xae46('0x9d')];return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x454312[_0xae46('0x58')]['id']},'attributes':['id','name',_0xae46('0x27'),_0xae46('0x9e'),_0xae46('0x9f'),_0xae46('0xa0'),_0xae46('0xa1')]})[_0xae46('0x12')](handleEntityNotFound(_0x2db394,null))[_0xae46('0x12')](function(_0x1513ba){if(_0x1513ba){if(!utils[_0xae46('0xa2')](_0x6c58cc)){throw new db['Sequelize'][(_0xae46('0x94'))](_0xae46('0xa3'));}return _0x1513ba[_0xae46('0xa4')+_[_0xae46('0xa5')](_0x6c58cc['toLowerCase']())+_0xae46('0xa6')](_0x454312['body']['ids'],{'penalty':_0x454312[_0xae46('0x61')][_0xae46('0xa7')]||0x0})[_0xae46('0xa8')](function(_0x4c0b1c){for(var _0x5e8c07=0x0;_0x5e8c07<_0x454312[_0xae46('0x61')][_0xae46('0xa9')][_0xae46('0x4f')];_0x5e8c07+=0x1){var _0x1466ae={'UserId':Number(_0x454312[_0xae46('0x58')]['id'])};_0x1466ae[_[_0xae46('0xa5')](_0x6c58cc[_0xae46('0xaa')]())+_0xae46('0xab')]=Number(_0x454312[_0xae46('0x61')]['ids'][_0x5e8c07]);socket[_0xae46('0x29')](_0xae46('0x2d')+_[_0xae46('0xa5')](_0x6c58cc[_0xae46('0xaa')]())+_0xae46('0xac'),_0x1466ae);}return _0x4c0b1c;})['then'](function(){if(_0x6c58cc==='voice'){return db['VoiceQueue'][_0xae46('0x4c')]({'where':{'id':_0x454312[_0xae46('0x61')]['ids']||[]},'raw':!![],'attributes':['id',_0xae46('0x34')]});}})['then'](function(_0x357ff1){var _0x35be5a=_0x1513ba[_0xae46('0xad')]({'plain':!![]});var _0x45f738=[];if(_0x6c58cc===_0xae46('0xae')&&_0x35be5a['role']==='agent'&&_0x35be5a[_0xae46('0x9e')]){for(let _0x247b6e=0x0;_0x247b6e<_0x357ff1[_0xae46('0x4f')];_0x247b6e+=0x1){_0x45f738[_0xae46('0x4b')]({'membername':_0x35be5a[_0xae46('0x34')],'UserId':_0x35be5a['id'],'queue_name':_0x357ff1[_0x247b6e]['name'],'VoiceQueueId':_0x357ff1[_0x247b6e]['id'],'interface':_['isNil'](_0x35be5a[_0xae46('0xa1')])?util[_0xae46('0xaf')](_0xae46('0xb0'),_0x35be5a[_0xae46('0x34')]):_0x35be5a[_0xae46('0xa1')],'paused':_0x35be5a[_0xae46('0xa0')]||![],'penalty':_0x454312['body']['penalty']||0x0});}return Promise['all'](_0x45f738['map'](function(_0x7f9eb){return db[_0xae46('0xb1')]['upsert'](_0x7f9eb);}));}return _0x1513ba;});}})['then'](respondWithStatusCode(_0x2db394,null))[_0xae46('0x1c')](handleError(_0x2db394,null));};exports[_0xae46('0xb2')]=function(_0x4b814c,_0x2d8b2b){var _0x55cd7e,_0x54b42a;return db[_0xae46('0x43')]['find']({'where':{'id':_0x4b814c[_0xae46('0x58')]['id']},'attributes':['id','name','role']})[_0xae46('0x12')](handleEntityNotFound(_0x2d8b2b,null))['then'](function(_0x46a1dd){if(_0x46a1dd){_0x55cd7e=_0x46a1dd;if(!_0x4b814c[_0xae46('0x44')][_0xae46('0x9d')]||!utils['isValidChannel'](_0x4b814c[_0xae46('0x44')][_0xae46('0x9d')])){throw new db[(_0xae46('0x93'))][(_0xae46('0x94'))]('Unknown\x20channel');}return _0x46a1dd['remove'+_[_0xae46('0xa5')](_0x4b814c[_0xae46('0x44')][_0xae46('0x9d')][_0xae46('0xaa')]())+'Queues'](_0x4b814c['query'][_0xae46('0xa9')]);}})[_0xae46('0x12')](function(_0x51b4f6){if(_[_0xae46('0xb3')](_0x4b814c[_0xae46('0x44')][_0xae46('0xa9')])){for(var _0x53761f=0x0;_0x53761f<_0x4b814c['query'][_0xae46('0xa9')][_0xae46('0x4f')];_0x53761f+=0x1){_0x54b42a={'UserId':Number(_0x4b814c[_0xae46('0x58')]['id'])};_0x54b42a[_[_0xae46('0xa5')](_0x4b814c['query']['channel'][_0xae46('0xaa')]())+_0xae46('0xab')]=Number(_0x4b814c[_0xae46('0x44')][_0xae46('0xa9')][_0x53761f]);socket['emit'](_0xae46('0x2d')+_[_0xae46('0xa5')](_0x4b814c[_0xae46('0x44')]['channel']['toLowerCase']())+_0xae46('0xb4'),_0x54b42a);}}else{_0x54b42a={'UserId':Number(_0x4b814c['params']['id'])};_0x54b42a[_[_0xae46('0xa5')](_0x4b814c[_0xae46('0x44')][_0xae46('0x9d')][_0xae46('0xaa')]())+_0xae46('0xab')]=Number(_0x4b814c[_0xae46('0x44')][_0xae46('0xa9')]);socket[_0xae46('0x29')](_0xae46('0x2d')+_[_0xae46('0xa5')](_0x4b814c[_0xae46('0x44')][_0xae46('0x9d')][_0xae46('0xaa')]())+'Queue:remove',_0x54b42a);}return _0x51b4f6;})[_0xae46('0x12')](function(){if(_0x4b814c[_0xae46('0x44')][_0xae46('0x9d')]==='voice'){return db[_0xae46('0xb1')][_0xae46('0x2b')]({'where':{'UserId':_0x4b814c['params']['id'],'VoiceQueueId':_0x4b814c['query'][_0xae46('0xa9')]},'individualHooks':!![]})[_0xae46('0x12')](function(){return _0x55cd7e;});}return _0x55cd7e;})['then'](respondWithStatusCode(_0x2d8b2b,null))[_0xae46('0x1c')](handleError(_0x2d8b2b,null));};exports[_0xae46('0xb5')]=function(_0x545dc1,_0x3e4531){_0x545dc1[_0xae46('0x61')]['userpic']=_0x545dc1['file'][_0xae46('0xb6')];return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x545dc1[_0xae46('0x58')]['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x3e4531,null))['then'](saveUpdates(_0x545dc1[_0xae46('0x61')],null))[_0xae46('0x12')](respondWithResult(_0x3e4531,null))['catch'](handleError(_0x3e4531,null));};exports[_0xae46('0xb7')]=function(_0x5719fd,_0x58a947){var _0xe7e307=path[_0xae46('0xb8')](config[_0xae46('0xb9')],'server/files/images/logos/default_profile.png');return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x5719fd[_0xae46('0x58')]['id']},'attributes':['id',_0xae46('0xba')],'raw':!![]})[_0xae46('0x12')](handleEntityNotFound(_0x58a947,null))[_0xae46('0x12')](function(_0xc6431a){if(_0xc6431a){if(_[_0xae46('0x6b')](_0xc6431a[_0xae46('0xba')])){return _0x58a947[_0xae46('0xbb')](_0xe7e307);}else{if(!fs[_0xae46('0xbc')](path[_0xae46('0xb8')](config[_0xae46('0xb9')],_0xae46('0xbd'),_0xc6431a[_0xae46('0xba')]))){return _0x58a947['download'](_0xe7e307);}return _0x58a947[_0xae46('0xbb')](path[_0xae46('0xb8')](config[_0xae46('0xb9')],'server/files/images/',_0xc6431a[_0xae46('0xba')]));}}})['catch'](handleError(_0x58a947,null));};exports[_0xae46('0xbe')]=function(_0x306570,_0x56e148){return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x306570[_0xae46('0x58')]['id']},'attributes':['id']})[_0xae46('0x12')](handleEntityNotFound(_0x56e148,null))[_0xae46('0x12')](function(_0x46d8aa){var _0x1049c8=[];values=_0x46d8aa[_0xae46('0x51')];_0x1049c8[_0xae46('0x4b')](get_open_tabs(_0xae46('0x50'),_0x46d8aa['dataValues']));_0x1049c8[_0xae46('0x4b')](get_open_tabs(_0xae46('0x52'),_0x46d8aa['dataValues']));_0x1049c8[_0xae46('0x4b')](get_open_tabs('openchannel',_0x46d8aa[_0xae46('0x51')]));_0x1049c8[_0xae46('0x4b')](get_open_tabs(_0xae46('0x55'),_0x46d8aa[_0xae46('0x51')]));_0x1049c8[_0xae46('0x4b')](get_open_tabs('fax',_0x46d8aa[_0xae46('0x51')]));_0x1049c8[_0xae46('0x4b')](get_open_tabs('mail',_0x46d8aa[_0xae46('0x51')]));return Promise['all'](_0x1049c8);})[_0xae46('0x12')](function(_0x2a1045){if(_0x2a1045){var _0xf9dbab=_[_0xae46('0x32')](values[_0xae46('0xbf')],function(_0x29b35e){return{'channel':_0xae46('0xc0'),'id':_0x29b35e['id'],'createdAt':_0x29b35e[_0xae46('0xc1')]};});var _0x1ec216=_[_0xae46('0x32')](values[_0xae46('0xc2')],function(_0x4a9d4c){return{'channel':_0xae46('0xc3'),'id':_0x4a9d4c['id'],'createdAt':_0x4a9d4c[_0xae46('0xc1')]};});var _0x4de36b=_[_0xae46('0x32')](values[_0xae46('0xc4')],function(_0x2baafc){return{'channel':_0xae46('0xc5'),'id':_0x2baafc['id'],'createdAt':_0x2baafc['createdAt']};});var _0x228328=_['map'](values['MailOpenTabs'],function(_0x4803ab){return{'channel':_0xae46('0xc6'),'id':_0x4803ab['id'],'createdAt':_0x4803ab[_0xae46('0xc1')]};});var _0x39092a=_['map'](values['SmsOpenTabs'],function(_0x2d6e3c){return{'channel':_0xae46('0xc7'),'id':_0x2d6e3c['id'],'createdAt':_0x2d6e3c[_0xae46('0xc1')]};});var _0x17220d=_[_0xae46('0x32')](values[_0xae46('0xc8')],function(_0x44e3f7){return{'channel':_0xae46('0xc9'),'id':_0x44e3f7['id'],'createdAt':_0x44e3f7['createdAt']};});var _0x29346e=_['concat'](_0xf9dbab,_0x1ec216,_0x4de36b,_0x228328,_0x39092a,_0x17220d);var _0x532044={'count':_0x29346e[_0xae46('0x4f')],'rows':_0x29346e};return _0x532044;}else return null;})['then'](respondWithResult(_0x56e148,null))[_0xae46('0x1c')](handleError(_0x56e148,null));};exports[_0xae46('0xca')]=function(_0x50d641,_0xe6f2d6){var _0x3d0316={};return db[_0xae46('0x43')]['findOne']({'where':{'id':_0x50d641[_0xae46('0x58')]['id']}})[_0xae46('0x12')](function(_0x406c58){if(!_0x406c58){throw new APINotFoundError(util[_0xae46('0xaf')](_0xae46('0xcb'),_0x50d641[_0xae46('0x58')]['id']));}return contacts[_0xae46('0x62')]();})[_0xae46('0x12')](function(_0x5e7ef3){_0x50d641['query'][_0xae46('0x43')]=_0x50d641['params']['id'];_0x3d0316=qs[_0xae46('0x41')](_0x5e7ef3,_0x50d641);if(_0x50d641[_0xae46('0x44')][_0xae46('0xcc')](_0xae46('0x45'))){_0x3d0316[_0xae46('0x47')]=[{'model':db['CmList'],'as':_0xae46('0xcd'),'required':![]},{'model':db[_0xae46('0xce')],'as':_0xae46('0xcf'),'attributes':['id','name',_0xae46('0xd0')],'where':_0x50d641[_0xae46('0x44')][_0xae46('0xd1')]?{'id':_0x50d641[_0xae46('0x44')]['tag']}:undefined,'required':_0x50d641[_0xae46('0x44')][_0xae46('0xd1')]?!![]:![]}];}return contacts[_0xae46('0x4c')](_0x50d641['query'],_0x50d641[_0xae46('0x2d')],_0x3d0316,_0x5e7ef3);})['then'](respondWithFilteredResult(_0xe6f2d6,_0x3d0316))[_0xae46('0x1c')](APIHandleError(_0xe6f2d6));};exports[_0xae46('0xd2')]=function(_0x414234,_0x7e60b5){var _0x206251;var _0x35ea6b={};var _0xec3db;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x414234[_0xae46('0x58')]['id']},'attributes':['id',_0xae46('0x34'),_0xae46('0x27')]})[_0xae46('0x12')](handleEntityNotFound(_0x7e60b5,null))[_0xae46('0x12')](function(_0x361403){if(!utils[_0xae46('0xa2')](_0x414234[_0xae46('0x44')][_0xae46('0x9d')])){throw new db[(_0xae46('0x93'))][(_0xae46('0x94'))]('Unknown\x20channel');}_0x206251=_0x361403;var _0x4c1d45={};_0x4c1d45[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_[_0xae46('0xa5')](_0x414234[_0xae46('0x44')][_0xae46('0x9d')])+_0xae46('0xd3')][_0xae46('0x3a')]);_0x4c1d45[_0xae46('0x44')]=_[_0xae46('0x5b')](_0x414234[_0xae46('0x44')]);_0x4c1d45[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0x4c1d45[_0xae46('0x59')],_0x4c1d45['query']);_0x35ea6b[_0xae46('0x4a')]=_['intersection'](_0x4c1d45[_0xae46('0x59')],qs['fields'](_0x414234['query'][_0xae46('0xd4')]));_0x35ea6b[_0xae46('0x4a')]=_0x35ea6b[_0xae46('0x4a')]['length']?_0x35ea6b['attributes']:_0x4c1d45[_0xae46('0x59')];_0x35ea6b[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0x414234[_0xae46('0x44')]['sort']);_0x35ea6b['where']=qs[_0xae46('0x5c')](_['pick'](_0x414234[_0xae46('0x44')],_0x4c1d45[_0xae46('0x5c')]));if(_0x414234[_0xae46('0x44')][_0xae46('0xd7')]){_0x35ea6b['where']=_[_0xae46('0xd8')](_0x35ea6b['where'],{'$or':_[_0xae46('0x32')](_0x35ea6b['attributes'],function(_0xa91848){var _0x24e245={};_0x24e245[_0xa91848]={'$like':'%'+_0x414234[_0xae46('0x44')][_0xae46('0xd7')]+'%'};return _0x24e245;})});}_0x35ea6b=_[_0xae46('0xd8')]({},_0x35ea6b,_0x414234['options']);switch(_0x206251[_0xae46('0x27')]){case _0xae46('0x2c'):return db[_[_0xae46('0xa5')](_0x414234[_0xae46('0x44')][_0xae46('0x9d')])+_0xae46('0xd3')][_0xae46('0x4c')](_0x35ea6b);case _0xae46('0x2d'):case _0xae46('0x28'):return _0x206251['get'+_[_0xae46('0xa5')](_0x414234[_0xae46('0x44')][_0xae46('0x9d')])+_0xae46('0xa6')](_0x35ea6b);default:throw new db['Sequelize'][(_0xae46('0x94'))]('Unknown\x20role');}})[_0xae46('0x12')](function(_0x4b76bf){_0xec3db=_0x4b76bf[_0xae46('0x4f')];if(!_0x414234[_0xae46('0x44')][_0xae46('0xcc')](_0xae46('0xd9'))){_0x35ea6b[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x414234[_0xae46('0x44')][_0xae46('0x21')]);_0x35ea6b[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x414234[_0xae46('0x44')]['offset']);}switch(_0x206251['role']){case _0xae46('0x2c'):return db[_[_0xae46('0xa5')](_0x414234[_0xae46('0x44')]['channel'])+_0xae46('0xd3')]['findAll'](_0x35ea6b);case'user':case _0xae46('0x28'):return _0x206251[_0xae46('0xad')+_[_0xae46('0xa5')](_0x414234[_0xae46('0x44')][_0xae46('0x9d')])+_0xae46('0xa6')](_0x35ea6b);}})['then'](function(_0x105cab){return{'count':_0xec3db,'rows':_0x105cab};})[_0xae46('0x12')](respondWithResult(_0x7e60b5,null))['catch'](handleError(_0x7e60b5,null));};exports['getVoiceQueuesRt']=function(_0xf90c22,_0x3b07cf){var _0x30ba0c={};var _0x3008dd={};var _0xd218b2;var _0x51800e;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0xf90c22['params']['id']}})['then'](handleEntityNotFound(_0x3b07cf,null))[_0xae46('0x12')](function(_0x521c61){if(_0x521c61){_0xd218b2=_0x521c61;_0x3008dd[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0xb1')][_0xae46('0x3a')]);_0x3008dd[_0xae46('0x44')]=_[_0xae46('0x5b')](_0xf90c22['query']);_0x3008dd[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0x3008dd['model'],_0x3008dd['query']);_0x30ba0c[_0xae46('0x4a')]=_['intersection'](_0x3008dd[_0xae46('0x59')],qs[_0xae46('0xd4')](_0xf90c22[_0xae46('0x44')][_0xae46('0xd4')]));_0x30ba0c[_0xae46('0x4a')]=_0x30ba0c[_0xae46('0x4a')][_0xae46('0x4f')]?_0x30ba0c[_0xae46('0x4a')]:_0x3008dd[_0xae46('0x59')];_0x30ba0c[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0xf90c22[_0xae46('0x44')]['sort']);_0x30ba0c[_0xae46('0x42')]=qs['filters'](_['pick'](_0xf90c22[_0xae46('0x44')],_0x3008dd[_0xae46('0x5c')]));if(_0xf90c22[_0xae46('0x44')][_0xae46('0xd7')]){_0x30ba0c[_0xae46('0x42')]=_[_0xae46('0xd8')](_0x30ba0c['where'],{'$or':_[_0xae46('0x32')](_0x30ba0c[_0xae46('0x4a')],function(_0x456687){var _0x3bdfc5={};_0x3bdfc5[_0x456687]={'$like':'%'+_0xf90c22['query']['filter']+'%'};return _0x3bdfc5;})});}_0x30ba0c=_[_0xae46('0xd8')]({},_0x30ba0c,_0xf90c22['options']);return _0xd218b2['getVoiceQueuesRt'](_0x30ba0c);}})[_0xae46('0x12')](function(_0x220b6e){if(_0x220b6e){_0x51800e=_0x220b6e['length'];if(!_0xf90c22[_0xae46('0x44')][_0xae46('0xcc')](_0xae46('0xd9'))){_0x30ba0c[_0xae46('0x21')]=qs[_0xae46('0x21')](_0xf90c22[_0xae46('0x44')][_0xae46('0x21')]);_0x30ba0c[_0xae46('0x23')]=qs[_0xae46('0x23')](_0xf90c22['query'][_0xae46('0x23')]);}return _0xd218b2['getVoiceQueuesRt'](_0x30ba0c);}})['then'](function(_0x303938){if(_0x303938){return _0x303938?{'count':_0x51800e,'rows':_0x303938}:null;}})['then'](respondWithResult(_0x3b07cf,null))[_0xae46('0x1c')](handleError(_0x3b07cf,null));};exports['getGroups']=function(_0x2c3c01,_0x66e418){var _0x49dc54={};var _0x4b6d13={};var _0x32133c;var _0x3e2eb4;return db['User'][_0xae46('0x96')]({'where':{'id':_0x2c3c01[_0xae46('0x58')]['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x66e418,null))[_0xae46('0x12')](function(_0x2a073a){if(_0x2a073a){_0x32133c=_0x2a073a;_0x4b6d13[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0xda')][_0xae46('0x3a')]);_0x4b6d13[_0xae46('0x44')]=_[_0xae46('0x5b')](_0x2c3c01['query']);_0x4b6d13['filters']=_[_0xae46('0x5d')](_0x4b6d13['model'],_0x4b6d13[_0xae46('0x44')]);_0x49dc54[_0xae46('0x4a')]=_['intersection'](_0x4b6d13['model'],qs[_0xae46('0xd4')](_0x2c3c01['query']['fields']));_0x49dc54['attributes']=_0x49dc54['attributes'][_0xae46('0x4f')]?_0x49dc54['attributes']:_0x4b6d13[_0xae46('0x59')];_0x49dc54[_0xae46('0xd5')]=qs['sort'](_0x2c3c01[_0xae46('0x44')]['sort']);_0x49dc54[_0xae46('0x42')]=qs[_0xae46('0x5c')](_[_0xae46('0xdb')](_0x2c3c01[_0xae46('0x44')],_0x4b6d13[_0xae46('0x5c')]));if(_0x2c3c01[_0xae46('0x44')][_0xae46('0xd7')]){_0x49dc54[_0xae46('0x42')]=_['merge'](_0x49dc54[_0xae46('0x42')],{'$or':_[_0xae46('0x32')](_0x49dc54[_0xae46('0x4a')],function(_0x460665){var _0x4e631f={};_0x4e631f[_0x460665]={'$like':'%'+_0x2c3c01[_0xae46('0x44')][_0xae46('0xd7')]+'%'};return _0x4e631f;})});}_0x49dc54=_[_0xae46('0xd8')]({},_0x49dc54,_0x2c3c01['options']);return _0x32133c['getGroups'](_0x49dc54);}})[_0xae46('0x12')](function(_0x5dec56){if(_0x5dec56){_0x3e2eb4=_0x5dec56[_0xae46('0x4f')];if(!_0x2c3c01['query'][_0xae46('0xcc')](_0xae46('0xd9'))){_0x49dc54['limit']=qs[_0xae46('0x21')](_0x2c3c01[_0xae46('0x44')][_0xae46('0x21')]);_0x49dc54[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x2c3c01[_0xae46('0x44')][_0xae46('0x23')]);}return _0x32133c[_0xae46('0xdc')](_0x49dc54);}})[_0xae46('0x12')](function(_0x4e5e26){if(_0x4e5e26){return _0x4e5e26?{'count':_0x3e2eb4,'rows':_0x4e5e26}:null;}})[_0xae46('0x12')](respondWithResult(_0x66e418,null))[_0xae46('0x1c')](handleError(_0x66e418,null));};exports['getRecordings']=function(_0x1f6a59,_0x1fd2ca){var _0x322560={'raw':!![],'where':{}};var _0x5a06df={};var _0x1d1dea={'count':0x0,'rows':[]};return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x1f6a59['params']['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x1fd2ca,null))[_0xae46('0x12')](function(_0x52f518){if(_0x52f518){_0x5a06df['model']=_[_0xae46('0x5b')](db[_0xae46('0xdd')]['rawAttributes']);_0x5a06df[_0xae46('0x44')]=_[_0xae46('0x5b')](_0x1f6a59[_0xae46('0x44')]);_0x5a06df[_0xae46('0x5c')]=_['intersection'](_0x5a06df[_0xae46('0x59')],_0x5a06df['query']);_0x322560['attributes']=_['intersection'](_0x5a06df[_0xae46('0x59')],qs['fields'](_0x1f6a59[_0xae46('0x44')][_0xae46('0xd4')]));_0x322560[_0xae46('0x4a')]=_0x322560['attributes'][_0xae46('0x4f')]?_0x322560[_0xae46('0x4a')]:_0x5a06df[_0xae46('0x59')];if(!_0x1f6a59[_0xae46('0x44')][_0xae46('0xcc')]('nolimit')){_0x322560[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x1f6a59[_0xae46('0x44')][_0xae46('0x21')]);_0x322560[_0xae46('0x23')]=qs['offset'](_0x1f6a59[_0xae46('0x44')][_0xae46('0x23')]);}_0x322560[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0x1f6a59['query']['sort']);_0x322560[_0xae46('0x42')]=qs[_0xae46('0x5c')](_[_0xae46('0xdb')](_0x1f6a59[_0xae46('0x44')],_0x5a06df[_0xae46('0x5c')]));_0x322560[_0xae46('0x42')][_0xae46('0xde')]=_0x52f518['id'];if(_0x1f6a59['query'][_0xae46('0xd7')]){_0x322560[_0xae46('0x42')]=_[_0xae46('0xd8')](_0x322560[_0xae46('0x42')],{'$or':_[_0xae46('0x32')](_0x322560[_0xae46('0x4a')],function(_0x4d06ff){var _0x1a99c5={};_0x1a99c5[_0x4d06ff]={'$like':'%'+_0x1f6a59['query'][_0xae46('0xd7')]+'%'};return _0x1a99c5;})});}_0x322560=_['merge']({},_0x322560,_0x1f6a59['options']);return db['VoiceRecording']['count']({'where':_0x322560['where']})[_0xae46('0x12')](function(_0x5cf956){_0x1d1dea['count']=_0x5cf956;if(_0x1f6a59['query'][_0xae46('0x45')]){_0x322560[_0xae46('0x47')]=[{'all':!![]}];}return db[_0xae46('0xdd')][_0xae46('0x4c')](_0x322560);})['then'](function(_0x4fe6eb){_0x1d1dea[_0xae46('0x4d')]=_0x4fe6eb;return _0x1d1dea;});}})['then'](respondWithFilteredResult(_0x1fd2ca,_0x322560))[_0xae46('0x1c')](handleError(_0x1fd2ca,null));};exports['getScreenRecordings']=function(_0x18a8dc,_0x3de074){var _0x1032d7={'raw':!![],'where':{}};var _0x41702e={};var _0x38d152={'count':0x0,'rows':[]};return db['User'][_0xae46('0x96')]({'where':{'id':_0x18a8dc['params']['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x3de074,null))[_0xae46('0x12')](function(_0x30bf69){if(_0x30bf69){_0x41702e[_0xae46('0x59')]=_[_0xae46('0x5b')](db['ScreenRecording'][_0xae46('0x3a')]);_0x41702e[_0xae46('0x44')]=_['keys'](_0x18a8dc[_0xae46('0x44')]);_0x41702e[_0xae46('0x5c')]=_['intersection'](_0x41702e[_0xae46('0x59')],_0x41702e[_0xae46('0x44')]);_0x1032d7['attributes']=_[_0xae46('0x5d')](_0x41702e[_0xae46('0x59')],qs[_0xae46('0xd4')](_0x18a8dc[_0xae46('0x44')]['fields']));_0x1032d7['attributes']=_0x1032d7[_0xae46('0x4a')]['length']?_0x1032d7['attributes']:_0x41702e[_0xae46('0x59')];if(!_0x18a8dc[_0xae46('0x44')][_0xae46('0xcc')]('nolimit')){_0x1032d7[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x18a8dc[_0xae46('0x44')][_0xae46('0x21')]);_0x1032d7[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x18a8dc[_0xae46('0x44')][_0xae46('0x23')]);}_0x1032d7['order']=qs[_0xae46('0xd6')](_0x18a8dc[_0xae46('0x44')][_0xae46('0xd6')]);_0x1032d7[_0xae46('0x42')]=qs[_0xae46('0x5c')](_[_0xae46('0xdb')](_0x18a8dc['query'],_0x41702e[_0xae46('0x5c')]));_0x1032d7[_0xae46('0x42')][_0xae46('0xde')]=_0x30bf69['id'];if(_0x18a8dc['query']['filter']){_0x1032d7[_0xae46('0x42')]=_['merge'](_0x1032d7[_0xae46('0x42')],{'$or':_[_0xae46('0x32')](_0x1032d7[_0xae46('0x4a')],function(_0x126bc3){var _0x44be2f={};_0x44be2f[_0x126bc3]={'$like':'%'+_0x18a8dc[_0xae46('0x44')][_0xae46('0xd7')]+'%'};return _0x44be2f;})});}_0x1032d7=_[_0xae46('0xd8')]({},_0x1032d7,_0x18a8dc[_0xae46('0x5e')]);return db['ScreenRecording'][_0xae46('0x22')]({'where':_0x1032d7[_0xae46('0x42')]})[_0xae46('0x12')](function(_0x2d6161){_0x38d152['count']=_0x2d6161;if(_0x18a8dc['query'][_0xae46('0x45')]){_0x1032d7[_0xae46('0x47')]=[{'all':!![]}];}return db[_0xae46('0xdf')][_0xae46('0x4c')](_0x1032d7);})[_0xae46('0x12')](function(_0x4def58){_0x38d152[_0xae46('0x4d')]=_0x4def58;return _0x38d152;});}})['then'](respondWithFilteredResult(_0x3de074,_0x1032d7))[_0xae46('0x1c')](handleError(_0x3de074,null));};exports['getChatInteractions']=function(_0x15428f,_0x28dbd9){var _0x9129bc={};var _0x426222={};var _0x576fca;var _0x24e5ba;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x15428f[_0xae46('0x58')]['id']}})['then'](handleEntityNotFound(_0x28dbd9,null))['then'](function(_0x24105a){if(_0x24105a){_0x576fca=_0x24105a;_0x426222[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0xe0')][_0xae46('0x3a')]);_0x426222[_0xae46('0x44')]=_['keys'](_0x15428f[_0xae46('0x44')]);_0x426222[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0x426222[_0xae46('0x59')],_0x426222[_0xae46('0x44')]);_0x9129bc[_0xae46('0x4a')]=_['intersection'](_0x426222[_0xae46('0x59')],qs[_0xae46('0xd4')](_0x15428f['query'][_0xae46('0xd4')]));_0x9129bc[_0xae46('0x4a')]=_0x9129bc['attributes'][_0xae46('0x4f')]?_0x9129bc[_0xae46('0x4a')]:_0x426222['model'];_0x9129bc[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0x15428f['query']['sort']);_0x9129bc[_0xae46('0x42')]=qs['filters'](_[_0xae46('0xdb')](_0x15428f[_0xae46('0x44')],_0x426222[_0xae46('0x5c')]));if(_0x15428f['query'][_0xae46('0xd7')]){_0x9129bc['where']=_[_0xae46('0xd8')](_0x9129bc[_0xae46('0x42')],{'$or':_[_0xae46('0x32')](_0x9129bc['attributes'],function(_0x304d36){var _0x372ee2={};_0x372ee2[_0x304d36]={'$like':'%'+_0x15428f['query'][_0xae46('0xd7')]+'%'};return _0x372ee2;})});}_0x9129bc=_[_0xae46('0xd8')]({},_0x9129bc,_0x15428f[_0xae46('0x5e')]);return _0x576fca[_0xae46('0xe1')](_0x9129bc);}})[_0xae46('0x12')](function(_0x3fd35a){if(_0x3fd35a){_0x24e5ba=_0x3fd35a[_0xae46('0x4f')];if(!_0x15428f[_0xae46('0x44')]['hasOwnProperty']('nolimit')){_0x9129bc[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x15428f['query'][_0xae46('0x21')]);_0x9129bc[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x15428f[_0xae46('0x44')]['offset']);}return _0x576fca[_0xae46('0xe1')](_0x9129bc);}})['then'](function(_0x49ab27){if(_0x49ab27){return _0x49ab27?{'count':_0x24e5ba,'rows':_0x49ab27}:null;}})[_0xae46('0x12')](respondWithResult(_0x28dbd9,null))['catch'](handleError(_0x28dbd9,null));};exports['getOpenchannelInteractions']=function(_0x5f078d,_0x5978d1){var _0x3c0446={};var _0x6c88a3={};var _0x480c4a;var _0x58f4b2;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x5f078d['params']['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x5978d1,null))['then'](function(_0x34f17d){if(_0x34f17d){_0x480c4a=_0x34f17d;_0x6c88a3[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0xe2')][_0xae46('0x3a')]);_0x6c88a3['query']=_[_0xae46('0x5b')](_0x5f078d[_0xae46('0x44')]);_0x6c88a3[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0x6c88a3['model'],_0x6c88a3[_0xae46('0x44')]);_0x3c0446[_0xae46('0x4a')]=_[_0xae46('0x5d')](_0x6c88a3[_0xae46('0x59')],qs[_0xae46('0xd4')](_0x5f078d['query'][_0xae46('0xd4')]));_0x3c0446[_0xae46('0x4a')]=_0x3c0446[_0xae46('0x4a')][_0xae46('0x4f')]?_0x3c0446[_0xae46('0x4a')]:_0x6c88a3[_0xae46('0x59')];_0x3c0446[_0xae46('0xd5')]=qs['sort'](_0x5f078d[_0xae46('0x44')][_0xae46('0xd6')]);_0x3c0446[_0xae46('0x42')]=qs['filters'](_[_0xae46('0xdb')](_0x5f078d[_0xae46('0x44')],_0x6c88a3['filters']));if(_0x5f078d[_0xae46('0x44')][_0xae46('0xd7')]){_0x3c0446[_0xae46('0x42')]=_[_0xae46('0xd8')](_0x3c0446['where'],{'$or':_[_0xae46('0x32')](_0x3c0446['attributes'],function(_0x1202a0){var _0x319f6={};_0x319f6[_0x1202a0]={'$like':'%'+_0x5f078d['query'][_0xae46('0xd7')]+'%'};return _0x319f6;})});}_0x3c0446=_[_0xae46('0xd8')]({},_0x3c0446,_0x5f078d[_0xae46('0x5e')]);return _0x480c4a[_0xae46('0xe3')](_0x3c0446);}})[_0xae46('0x12')](function(_0x46ca3d){if(_0x46ca3d){_0x58f4b2=_0x46ca3d[_0xae46('0x4f')];if(!_0x5f078d[_0xae46('0x44')][_0xae46('0xcc')]('nolimit')){_0x3c0446[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x5f078d[_0xae46('0x44')][_0xae46('0x21')]);_0x3c0446[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x5f078d[_0xae46('0x44')][_0xae46('0x23')]);}return _0x480c4a['getOpenchannelInteractions'](_0x3c0446);}})[_0xae46('0x12')](function(_0x490361){if(_0x490361){return _0x490361?{'count':_0x58f4b2,'rows':_0x490361}:null;}})[_0xae46('0x12')](respondWithResult(_0x5978d1,null))['catch'](handleError(_0x5978d1,null));};exports[_0xae46('0xe4')]=function(_0x19affe,_0x287581){var _0x5d8baa={'raw':!![],'where':{}};var _0x550fd1={};var _0x1a9c66={'count':0x0,'rows':[]};return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x19affe['params']['id']}})['then'](handleEntityNotFound(_0x287581,null))[_0xae46('0x12')](function(_0x116783){if(_0x116783){_0x550fd1[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0xe5')][_0xae46('0x3a')]);_0x550fd1['query']=_['keys'](_0x19affe['query']);_0x550fd1[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0x550fd1[_0xae46('0x59')],_0x550fd1[_0xae46('0x44')]);_0x5d8baa[_0xae46('0x4a')]=_[_0xae46('0x5d')](_0x550fd1[_0xae46('0x59')],qs[_0xae46('0xd4')](_0x19affe[_0xae46('0x44')][_0xae46('0xd4')]));_0x5d8baa[_0xae46('0x4a')]=_0x5d8baa['attributes']['length']?_0x5d8baa[_0xae46('0x4a')]:_0x550fd1[_0xae46('0x59')];if(!_0x19affe[_0xae46('0x44')][_0xae46('0xcc')]('nolimit')){_0x5d8baa['limit']=qs['limit'](_0x19affe[_0xae46('0x44')][_0xae46('0x21')]);_0x5d8baa[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x19affe['query'][_0xae46('0x23')]);}_0x5d8baa[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0x19affe[_0xae46('0x44')][_0xae46('0xd6')]);_0x5d8baa[_0xae46('0x42')]=qs[_0xae46('0x5c')](_[_0xae46('0xdb')](_0x19affe[_0xae46('0x44')],_0x550fd1[_0xae46('0x5c')]));_0x5d8baa['where'][_0xae46('0xde')]=_0x116783['id'];if(_0x19affe[_0xae46('0x44')]['filter']){_0x5d8baa[_0xae46('0x42')]=_['merge'](_0x5d8baa[_0xae46('0x42')],{'$or':_[_0xae46('0x32')](_0x5d8baa['attributes'],function(_0x3d97fd){var _0x4ec5b8={};_0x4ec5b8[_0x3d97fd]={'$like':'%'+_0x19affe[_0xae46('0x44')]['filter']+'%'};return _0x4ec5b8;})});}_0x5d8baa=_[_0xae46('0xd8')]({},_0x5d8baa,_0x19affe[_0xae46('0x5e')]);return db[_0xae46('0xe5')][_0xae46('0x22')]({'where':_0x5d8baa['where']})['then'](function(_0x59cf29){_0x1a9c66[_0xae46('0x22')]=_0x59cf29;if(_0x19affe[_0xae46('0x44')][_0xae46('0x45')]){_0x5d8baa[_0xae46('0x47')]=[{'all':!![]}];}return db[_0xae46('0xe5')][_0xae46('0x4c')](_0x5d8baa);})[_0xae46('0x12')](function(_0x1e1ebd){_0x1a9c66[_0xae46('0x4d')]=_0x1e1ebd;return _0x1a9c66;});}})[_0xae46('0x12')](respondWithFilteredResult(_0x287581,_0x5d8baa))[_0xae46('0x1c')](handleError(_0x287581,null));};exports[_0xae46('0xe6')]=function(_0x3944a5,_0x20b05e){var _0x3759b0={};var _0x35aad4={};var _0x2fc0d8;var _0x2cedfc;return db['User'][_0xae46('0x96')]({'where':{'id':_0x3944a5[_0xae46('0x58')]['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x20b05e,null))[_0xae46('0x12')](function(_0xd953a6){if(_0xd953a6){_0x2fc0d8=_0xd953a6;_0x35aad4[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0xe7')][_0xae46('0x3a')]);_0x35aad4[_0xae46('0x44')]=_['keys'](_0x3944a5[_0xae46('0x44')]);_0x35aad4[_0xae46('0x5c')]=_['intersection'](_0x35aad4[_0xae46('0x59')],_0x35aad4[_0xae46('0x44')]);_0x3759b0[_0xae46('0x4a')]=_['intersection'](_0x35aad4[_0xae46('0x59')],qs[_0xae46('0xd4')](_0x3944a5[_0xae46('0x44')]['fields']));_0x3759b0[_0xae46('0x4a')]=_0x3759b0[_0xae46('0x4a')][_0xae46('0x4f')]?_0x3759b0[_0xae46('0x4a')]:_0x35aad4[_0xae46('0x59')];_0x3759b0['order']=qs['sort'](_0x3944a5[_0xae46('0x44')][_0xae46('0xd6')]);_0x3759b0[_0xae46('0x42')]=qs['filters'](_['pick'](_0x3944a5['query'],_0x35aad4[_0xae46('0x5c')]));if(_0x3944a5[_0xae46('0x44')][_0xae46('0xd7')]){_0x3759b0[_0xae46('0x42')]=_[_0xae46('0xd8')](_0x3759b0[_0xae46('0x42')],{'$or':_[_0xae46('0x32')](_0x3759b0['attributes'],function(_0x400847){var _0x3f5744={};_0x3f5744[_0x400847]={'$like':'%'+_0x3944a5[_0xae46('0x44')][_0xae46('0xd7')]+'%'};return _0x3f5744;})});}_0x3759b0=_[_0xae46('0xd8')]({},_0x3759b0,_0x3944a5[_0xae46('0x5e')]);return _0x2fc0d8[_0xae46('0xe6')](_0x3759b0);}})[_0xae46('0x12')](function(_0x3a2ce0){if(_0x3a2ce0){_0x2cedfc=_0x3a2ce0['length'];if(!_0x3944a5[_0xae46('0x44')]['hasOwnProperty'](_0xae46('0xd9'))){_0x3759b0[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x3944a5[_0xae46('0x44')]['limit']);_0x3759b0[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x3944a5[_0xae46('0x44')]['offset']);}return _0x2fc0d8[_0xae46('0xe6')](_0x3759b0);}})[_0xae46('0x12')](function(_0x842d6a){if(_0x842d6a){return _0x842d6a?{'count':_0x2cedfc,'rows':_0x842d6a}:null;}})['then'](respondWithResult(_0x20b05e,null))[_0xae46('0x1c')](handleError(_0x20b05e,null));};exports['getFaxInteractions']=function(_0x5e2802,_0x261b51){var _0x4ae7da={};var _0x8207d6={};var _0x1bcdd3;var _0x168d4e;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x5e2802['params']['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x261b51,null))[_0xae46('0x12')](function(_0x25ad6b){if(_0x25ad6b){_0x1bcdd3=_0x25ad6b;_0x8207d6[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0xe8')]['rawAttributes']);_0x8207d6[_0xae46('0x44')]=_['keys'](_0x5e2802[_0xae46('0x44')]);_0x8207d6['filters']=_[_0xae46('0x5d')](_0x8207d6['model'],_0x8207d6[_0xae46('0x44')]);_0x4ae7da[_0xae46('0x4a')]=_[_0xae46('0x5d')](_0x8207d6[_0xae46('0x59')],qs[_0xae46('0xd4')](_0x5e2802['query'][_0xae46('0xd4')]));_0x4ae7da['attributes']=_0x4ae7da[_0xae46('0x4a')][_0xae46('0x4f')]?_0x4ae7da[_0xae46('0x4a')]:_0x8207d6[_0xae46('0x59')];_0x4ae7da[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0x5e2802[_0xae46('0x44')][_0xae46('0xd6')]);_0x4ae7da['where']=qs[_0xae46('0x5c')](_[_0xae46('0xdb')](_0x5e2802[_0xae46('0x44')],_0x8207d6[_0xae46('0x5c')]));if(_0x5e2802[_0xae46('0x44')][_0xae46('0xd7')]){_0x4ae7da['where']=_['merge'](_0x4ae7da['where'],{'$or':_[_0xae46('0x32')](_0x4ae7da[_0xae46('0x4a')],function(_0x1d48cf){var _0xb3876d={};_0xb3876d[_0x1d48cf]={'$like':'%'+_0x5e2802[_0xae46('0x44')]['filter']+'%'};return _0xb3876d;})});}_0x4ae7da=_[_0xae46('0xd8')]({},_0x4ae7da,_0x5e2802[_0xae46('0x5e')]);return _0x1bcdd3[_0xae46('0xe9')](_0x4ae7da);}})[_0xae46('0x12')](function(_0x499b2b){if(_0x499b2b){_0x168d4e=_0x499b2b[_0xae46('0x4f')];if(!_0x5e2802[_0xae46('0x44')][_0xae46('0xcc')](_0xae46('0xd9'))){_0x4ae7da[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x5e2802[_0xae46('0x44')][_0xae46('0x21')]);_0x4ae7da[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x5e2802[_0xae46('0x44')]['offset']);}return _0x1bcdd3['getFaxInteractions'](_0x4ae7da);}})[_0xae46('0x12')](function(_0x2af3e8){if(_0x2af3e8){return _0x2af3e8?{'count':_0x168d4e,'rows':_0x2af3e8}:null;}})[_0xae46('0x12')](respondWithResult(_0x261b51,null))[_0xae46('0x1c')](handleError(_0x261b51,null));};exports[_0xae46('0xea')]=function(_0x278af6,_0x362e4d){var _0x56ef90={};var _0x5b8714={};var _0x52032d;var _0x5c9b2c;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x278af6[_0xae46('0x58')]['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x362e4d,null))[_0xae46('0x12')](function(_0x4b308c){if(_0x4b308c){_0x52032d=_0x4b308c;_0x5b8714[_0xae46('0x59')]=_[_0xae46('0x5b')](db['WhatsappInteraction'][_0xae46('0x3a')]);_0x5b8714[_0xae46('0x44')]=_['keys'](_0x278af6[_0xae46('0x44')]);_0x5b8714[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0x5b8714[_0xae46('0x59')],_0x5b8714[_0xae46('0x44')]);_0x56ef90[_0xae46('0x4a')]=_['intersection'](_0x5b8714[_0xae46('0x59')],qs[_0xae46('0xd4')](_0x278af6[_0xae46('0x44')][_0xae46('0xd4')]));_0x56ef90[_0xae46('0x4a')]=_0x56ef90['attributes'][_0xae46('0x4f')]?_0x56ef90[_0xae46('0x4a')]:_0x5b8714[_0xae46('0x59')];_0x56ef90[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0x278af6[_0xae46('0x44')][_0xae46('0xd6')]);_0x56ef90[_0xae46('0x42')]=qs[_0xae46('0x5c')](_[_0xae46('0xdb')](_0x278af6[_0xae46('0x44')],_0x5b8714[_0xae46('0x5c')]));if(_0x278af6[_0xae46('0x44')][_0xae46('0xd7')]){_0x56ef90[_0xae46('0x42')]=_['merge'](_0x56ef90[_0xae46('0x42')],{'$or':_['map'](_0x56ef90[_0xae46('0x4a')],function(_0x46ace4){var _0x1b32d4={};_0x1b32d4[_0x46ace4]={'$like':'%'+_0x278af6[_0xae46('0x44')]['filter']+'%'};return _0x1b32d4;})});}_0x56ef90=_[_0xae46('0xd8')]({},_0x56ef90,_0x278af6[_0xae46('0x5e')]);return _0x52032d[_0xae46('0xea')](_0x56ef90);}})[_0xae46('0x12')](function(_0x48746a){if(_0x48746a){_0x5c9b2c=_0x48746a[_0xae46('0x4f')];if(!_0x278af6[_0xae46('0x44')]['hasOwnProperty'](_0xae46('0xd9'))){_0x56ef90['limit']=qs[_0xae46('0x21')](_0x278af6[_0xae46('0x44')][_0xae46('0x21')]);_0x56ef90[_0xae46('0x23')]=qs['offset'](_0x278af6[_0xae46('0x44')][_0xae46('0x23')]);}return _0x52032d['getWhatsappInteractions'](_0x56ef90);}})[_0xae46('0x12')](function(_0x5c49b0){if(_0x5c49b0){return _0x5c49b0?{'count':_0x5c9b2c,'rows':_0x5c49b0}:null;}})[_0xae46('0x12')](respondWithResult(_0x362e4d,null))['catch'](handleError(_0x362e4d,null));};exports['login']=function(_0x170730,_0x461cf1,_0x51b599){var _0x437626;var _0x130d83;var _0x1d9ba1;var _0x13ecae=!_[_0xae46('0x6b')](_0x170730[_0xae46('0x58')]['id'])?_0x170730[_0xae46('0x58')]['id']:!_[_0xae46('0x6b')](_0x170730[_0xae46('0x2d')]['id'])?_0x170730['user']['id']:null;return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x13ecae,'role':{'$or':['admin',_0xae46('0x2d'),_0xae46('0x28')]}},'attributes':['id',_0xae46('0x34'),_0xae46('0xeb'),_0xae46('0xec'),_0xae46('0x27'),_0xae46('0x65'),_0xae46('0x9f')]})[_0xae46('0x12')](function(_0x451c8e){if(_0x451c8e){if(_0x451c8e[_0xae46('0x27')]==='agent'){_0x437626=_0x451c8e;if(_0x170730[_0xae46('0x61')][_0xae46('0xa1')]){_0x1d9ba1=util[_0xae46('0xaf')](_0xae46('0xed'),_0x437626[_0x170730[_0xae46('0x61')][_0xae46('0xa1')]]);}else if(_0x170730['body'][_0xae46('0xee')]){_0x1d9ba1=util[_0xae46('0xaf')](_0xae46('0xb0'),_0x170730[_0xae46('0x61')][_0xae46('0xee')]);}else{_0x1d9ba1=util['format'](_0xae46('0xb0'),_0x437626[_0xae46('0x34')]);}socket['to'](util[_0xae46('0xaf')](_0xae46('0xef'),_0x437626[_0xae46('0x34')]))[_0xae46('0x29')](_0xae46('0xf0'),{'user':{'id':_0x437626['id'],'name':_0x437626[_0xae46('0x34')]},'ip':_0x170730[_0xae46('0xf1')][_0xae46('0xf2')]||_0x170730[_0xae46('0xf3')][_0xae46('0xf4')]||_0x170730['socket'][_0xae46('0xf4')]||_0x170730[_0xae46('0xf3')][_0xae46('0xf5')][_0xae46('0xf4')]});return db[_0xae46('0xb1')]['destroy']({'where':{'membername':_0x437626[_0xae46('0x34')]},'individualHooks':!![]});}}else{throw new db[(_0xae46('0x93'))][(_0xae46('0x94'))](_0xae46('0xf6'));}})[_0xae46('0x12')](function(){if(_0x437626){return _0x437626[_0xae46('0xf7')]({'raw':!![]});}})[_0xae46('0x12')](function(_0x245fed){if(_0x437626){if(_0x245fed){_0x130d83=_0x245fed;if(_0x130d83[_0xae46('0x4f')]){var _0x1fd400=_0x130d83[_0xae46('0x32')](function(_0x3b2a08){var _0x2eff95={'membername':_0x437626[_0xae46('0x34')],'UserId':_0x437626['id'],'queue_name':_0x3b2a08[_0xae46('0x34')],'VoiceQueueId':_0x3b2a08['id'],'interface':_0x1d9ba1,'paused':_0x437626[_0xae46('0x9f')]||![],'penalty':_0x3b2a08[_0xae46('0xf8')]||0x0};return db[_0xae46('0xb1')][_0xae46('0xf9')](_0x2eff95);});return Promise['all'](_0x1fd400);}}}})['then'](function(){if(_0x437626){return db[_0xae46('0xfa')][_0xae46('0x4c')]({'where':{'membername':_0x437626[_0xae46('0x34')],'exitAt':null}});}})['then'](function(_0x2cd7c8){if(_0x437626){var _0x5e86dd=[];_0x2cd7c8[_0xae46('0xfb')](function(_0x5e10d6){_0x5e86dd['push'](_0x5e10d6['update']({'exitAt':moment()['format'](_0xae46('0xfc'))}));});return Promise[_0xae46('0x56')](_0x5e86dd);}})[_0xae46('0x12')](function(){if(_0x437626){var _0x2e69de=[];var _0x47dfa9=[];var _0x3651df=utils[_0xae46('0xfd')]();var _0x6a273f={'membername':_0x437626[_0xae46('0x34')],'interface':_0x1d9ba1,'enterAt':moment()[_0xae46('0xaf')](_0xae46('0xfc')),'role':_0x437626['role'],'internal':_0x437626[_0xae46('0x65')]};_0x3651df[_0xae46('0xfb')](function(_0x17901b){_0x2e69de['push'](_[_0xae46('0xd8')]({'channel':_0x17901b,'type':_0xae46('0xfe'),'data1':_0x170730[_0xae46('0x61')][_0xae46('0xff')],'data2':_0x1d9ba1},_0x6a273f));if(_0x437626[_0xae46('0x9f')]){_0x47dfa9[_0xae46('0x4b')](_[_0xae46('0xd8')]({'channel':_0x17901b,'type':_0xae46('0x100'),'data1':_0xae46('0x101')},_0x6a273f));}});return db[_0xae46('0xfa')][_0xae46('0x89')](_0x2e69de['concat'](_0x47dfa9),{'individualHooks':!![]});}})[_0xae46('0x12')](function(){if(_0x437626){return _0x437626['update']({'online':!![],'lastLoginAt':moment()['format'](_0xae46('0xfc')),'voicePause':_0x437626[_0xae46('0x9f')]||![],'mailPause':_0x437626[_0xae46('0x9f')]||![],'chatPause':_0x437626[_0xae46('0x9f')]||![],'faxPause':_0x437626[_0xae46('0x9f')]||![],'smsPause':_0x437626['loginInPause']||![],'openchannelPause':_0x437626[_0xae46('0x9f')]||![],'whatsappPause':_0x437626[_0xae46('0x9f')]||![],'pauseType':_0x437626[_0xae46('0x9f')]?_0xae46('0x101'):null,'interface':_0x1d9ba1,'lastPauseAt':moment()[_0xae46('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xae46('0x12')](function(_0xe7edd7){if(_0x170730[_0xae46('0x102')]){return _0x51b599();}else{return Promise[_0xae46('0x103')](_0xe7edd7)[_0xae46('0x12')](respondWithResult(_0x461cf1,null));}})['catch'](handleError(_0x461cf1,null));};exports[_0xae46('0x104')]=function(_0x1dc3fc,_0x2919d6){var _0x895c79;return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x1dc3fc[_0xae46('0x58')]['id'],'role':_0xae46('0x28')},'attributes':['id',_0xae46('0x34'),_0xae46('0x27')]})[_0xae46('0x12')](handleEntityNotFound(_0x2919d6,null))[_0xae46('0x12')](function(_0x586d5f){if(_0x586d5f){_0x895c79=_0x586d5f;return db[_0xae46('0xb1')][_0xae46('0x2b')]({'where':{'membername':_0x895c79[_0xae46('0x34')]},'individualHooks':!![]});}})[_0xae46('0x12')](function(){return db[_0xae46('0xfa')][_0xae46('0x4c')]({'where':{'membername':_0x895c79[_0xae46('0x34')],'exitAt':null}});})[_0xae46('0x12')](function(_0x5f1fc8){var _0x13b2d7=[];_0x5f1fc8['forEach'](function(_0x767b18){_0x13b2d7['push'](_0x767b18['update']({'exitAt':moment()['format'](_0xae46('0xfc'))}));});return Promise[_0xae46('0x56')](_0x13b2d7);})[_0xae46('0x12')](function(){return _0x895c79[_0xae46('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2919d6,null))[_0xae46('0x1c')](handleError(_0x2919d6,null));};exports[_0xae46('0x105')]=function(_0x4f3e6e,_0x93f259){var _0x15b1fd;return db[_0xae46('0xb1')][_0xae46('0x26')]({'paused':0x1},{'where':{'UserId':_0x4f3e6e[_0xae46('0x58')]['id']},'individualHooks':!![]})[_0xae46('0x12')](function(){return db[_0xae46('0x43')][_0xae46('0x5f')]({'where':{'id':_0x4f3e6e[_0xae46('0x58')]['id'],'role':'agent'},'attributes':['id',_0xae46('0x34'),_0xae46('0x27'),_0xae46('0x65'),_0xae46('0xa1'),_0xae46('0x9e')]});})[_0xae46('0x12')](handleEntityNotFound(_0x93f259,null))[_0xae46('0x12')](function(_0x1d8fe8){if(_0x1d8fe8){_0x15b1fd=_0x1d8fe8;return respondWithRpcPromise(_0xae46('0x106'),_0xae46('0x105'),{'id':_0x15b1fd['id'],'name':_0x15b1fd[_0xae46('0x34')],'pause':!![]});}})[_0xae46('0x12')](function(){if(_0x15b1fd){return db[_0xae46('0xfa')][_0xae46('0x4c')]({'where':{'membername':_0x15b1fd[_0xae46('0x34')],'type':_0xae46('0x100'),'exitAt':null}});}})['then'](function(_0x1d7d86){if(_0x1d7d86['length']){var _0x287c65=moment()[_0xae46('0xaf')](_0xae46('0xfc'));for(var _0x2197bb=0x0,_0x594927=_0x1d7d86[_0xae46('0x4f')];_0x2197bb<_0x594927;_0x2197bb++){_0x1d7d86[_0x2197bb][_0xae46('0x107')]({'exitAt':_0x287c65});}}})[_0xae46('0x12')](function(){var _0x5b2f96=[];var _0x130610=utils['getChannels']();_0x130610[_0xae46('0xfb')](function(_0x530f85){_0x5b2f96[_0xae46('0x4b')]({'channel':_0x530f85,'membername':_0x15b1fd[_0xae46('0x34')],'interface':_['isNil'](_0x15b1fd[_0xae46('0xa1')])?util[_0xae46('0xaf')](_0xae46('0xb0'),_0x15b1fd[_0xae46('0x34')]):_0x15b1fd[_0xae46('0xa1')],'type':_0xae46('0x100'),'enterAt':moment()[_0xae46('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4f3e6e['body'][_0xae46('0x3c')]||_0xae46('0x108'),'role':_0x15b1fd['role'],'internal':_0x15b1fd[_0xae46('0x65')]});});return db[_0xae46('0xfa')][_0xae46('0x89')](_0x5b2f96,{'individualHooks':!![]});})[_0xae46('0x12')](function(){return _0x15b1fd[_0xae46('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4f3e6e[_0xae46('0x61')][_0xae46('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xae46('0xaf')](_0xae46('0xfc'))});})[_0xae46('0x12')](respondWithResult(_0x93f259,null))[_0xae46('0x1c')](handleError(_0x93f259,null));};exports[_0xae46('0x109')]=function(_0x3142ac,_0x579dfd){if(_0x3142ac[_0xae46('0x61')]['channel']&&!utils['isValidChannel'](_0x3142ac['body']['channel'])){throw new APIBadRequestError(util['format'](_0xae46('0x10a'),_0x3142ac[_0xae46('0x61')][_0xae46('0x9d')]));}return db[_0xae46('0x43')]['find']({'where':{'id':_0x3142ac[_0xae46('0x58')]['id']},'attributes':['id',_0xae46('0x34'),_0xae46('0x27'),_0xae46('0x65'),_0xae46('0xa1'),_0xae46('0x9e'),'voicePause',_0xae46('0x10b'),_0xae46('0x10c'),_0xae46('0x10d'),_0xae46('0x10e'),_0xae46('0x10f'),_0xae46('0x110'),'pauseType','lastPauseAt']})[_0xae46('0x12')](function(_0x4f748e){if(!_0x4f748e){throw new APINotFoundError(util[_0xae46('0xaf')](_0xae46('0xcb'),_0x3142ac['params']['id']));}return _0x4f748e[_0xae46('0x109')](_0x3142ac['body'][_0xae46('0x9d')]);})[_0xae46('0x12')](respondWithResult(_0x579dfd,null))[_0xae46('0x1c')](APIHandleError(_0x579dfd));};exports[_0xae46('0x111')]=function(_0x9bc6be,_0x4ca5cf){var _0x3b71df={};var _0x14d592={};var _0x37317a;var _0x14b2dc;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x9bc6be['params']['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x4ca5cf,null))[_0xae46('0x12')](function(_0xe6c475){if(_0xe6c475){_0x37317a=_0xe6c475;_0x14d592[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0x112')][_0xae46('0x3a')]);_0x14d592[_0xae46('0x44')]=_[_0xae46('0x5b')](_0x9bc6be[_0xae46('0x44')]);_0x14d592[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0x14d592['model'],_0x14d592[_0xae46('0x44')]);_0x3b71df[_0xae46('0x4a')]=_[_0xae46('0x5d')](_0x14d592[_0xae46('0x59')],qs['fields'](_0x9bc6be[_0xae46('0x44')][_0xae46('0xd4')]));_0x3b71df[_0xae46('0x4a')]=_0x3b71df[_0xae46('0x4a')][_0xae46('0x4f')]?_0x3b71df['attributes']:_0x14d592[_0xae46('0x59')];_0x3b71df[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0x9bc6be[_0xae46('0x44')][_0xae46('0xd6')]);_0x3b71df[_0xae46('0x42')]=qs[_0xae46('0x5c')](_[_0xae46('0xdb')](_0x9bc6be['query'],_0x14d592[_0xae46('0x5c')]));if(_0x9bc6be['query'][_0xae46('0xd7')]){_0x3b71df[_0xae46('0x42')]=_[_0xae46('0xd8')](_0x3b71df['where'],{'$or':_['map'](_0x3b71df[_0xae46('0x4a')],function(_0x48d95c){var _0x13763d={};_0x13763d[_0x48d95c]={'$like':'%'+_0x9bc6be['query'][_0xae46('0xd7')]+'%'};return _0x13763d;})});}_0x3b71df=_[_0xae46('0xd8')]({},_0x3b71df,_0x9bc6be[_0xae46('0x5e')]);return _0x37317a[_0xae46('0x111')](_0x3b71df);}})[_0xae46('0x12')](function(_0x580c85){if(_0x580c85){_0x14b2dc=_0x580c85['length'];if(!_0x9bc6be[_0xae46('0x44')][_0xae46('0xcc')](_0xae46('0xd9'))){_0x3b71df[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x9bc6be['query'][_0xae46('0x21')]);_0x3b71df[_0xae46('0x23')]=qs['offset'](_0x9bc6be[_0xae46('0x44')][_0xae46('0x23')]);}return _0x37317a[_0xae46('0x111')](_0x3b71df);}})['then'](function(_0x4e5460){if(_0x4e5460){return _0x4e5460?{'count':_0x14b2dc,'rows':_0x4e5460}:null;}})[_0xae46('0x12')](respondWithResult(_0x4ca5cf,null))['catch'](handleError(_0x4ca5cf,null));};exports[_0xae46('0x113')]=function(_0x31faba,_0x9dd613){var _0x2716ca=_0x31faba[_0xae46('0x58')]['id'];var _0x2269cd=_0x31faba[_0xae46('0x61')]?_0x31faba[_0xae46('0x61')][_0xae46('0xa9')]:null;var _0x1e9b36=[];return Promise[_0xae46('0x103')]()[_0xae46('0x12')](function(){if(!_0x2269cd)throw new APIBadRequestError(_0xae46('0x114'));})[_0xae46('0x12')](function(){return db['User'][_0xae46('0x96')]({'where':{'id':_0x2716ca}});})[_0xae46('0x12')](function(_0x48f9dd){if(!_0x48f9dd)throw new APINotFoundError(util[_0xae46('0xaf')]('User\x20with\x20id\x20%s\x20not\x20found',_0x31faba[_0xae46('0x58')]['id']));return db[_0xae46('0x6d')][_0xae46('0x115')](function(_0x438101){return _0x48f9dd[_0xae46('0x113')](_0x2269cd,{'transaction':_0x438101})[_0xae46('0x12')](function(){return db[_0xae46('0x112')]['findAll']({'where':{'id':{'$in':_0x2269cd}}});})['then'](function(_0x440ce2){var _0x5d4e19=_[_0xae46('0x32')](_0x440ce2,function(_0x1dbbb1){return _0x1dbbb1[_0xae46('0x116')]();});return Promise[_0xae46('0x56')](_0x5d4e19);})['then'](function(_0x264d94){_0x1e9b36=_[_0xae46('0x117')](_0x264d94);var _0x1743dc=_[_0xae46('0x32')](_0x1e9b36,function(_0x3b7df7){return _0x3b7df7[_0xae46('0x118')](_0x48f9dd['id'],{'transaction':_0x438101});});return Promise[_0xae46('0x56')](_0x1743dc);})[_0xae46('0x12')](function(){if(!_0x48f9dd[_0xae46('0x9e')])return;var _0x5e686b=_[_0xae46('0xd7')](_0x1e9b36,function(_0x1eec19){return _0x1eec19[_0xae46('0x119')](_0xae46('0x9d'))===_0xae46('0x11a');});var _0x1e53ab=_[_0xae46('0x32')](_0x5e686b,function(_0x57d7f5){return db[_0xae46('0xb1')][_0xae46('0xf9')]({'membername':_0x48f9dd[_0xae46('0x34')],'UserId':_0x48f9dd['id'],'queue_name':_0x57d7f5[_0xae46('0x34')],'VoiceQueueId':_0x57d7f5['id'],'interface':_['isNil'](_0x48f9dd['interface'])?util[_0xae46('0xaf')](_0xae46('0xb0'),_0x48f9dd[_0xae46('0x34')]):_0x48f9dd[_0xae46('0xa1')],'paused':_0x48f9dd['voicePause']||![],'penalty':_0x48f9dd[_0xae46('0xa7')]},{'transaction':_0x438101});});return Promise[_0xae46('0x56')](_0x1e53ab);})[_0xae46('0x12')](function(){return db[_0xae46('0x11b')][_0xae46('0x4c')]({'where':{'teamId':{'$in':_0x2269cd}}});})[_0xae46('0x12')](function(_0x4e732a){var _0x2e86a5=_[_0xae46('0x32')](_0x4e732a,function(_0x22570a){return db['UserVoicePrefix'][_0xae46('0x84')]({'UserId':_0x48f9dd['id'],'VoicePrefixId':_0x22570a['VoicePrefixId']},{'transaction':_0x438101});});return Promise[_0xae46('0x56')](_0x2e86a5);});});})[_0xae46('0x12')](function(){for(var _0x29cbff=0x0;_0x29cbff<_0x1e9b36[_0xae46('0x4f')];_0x29cbff++){var _0xd5da0e=_0x1e9b36[_0x29cbff][_0xae46('0x119')](_0xae46('0x9d'));var _0x509292=_0xd5da0e+_0xae46('0xab');socket[_0xae46('0x29')](_0xae46('0x2d')+_0xd5da0e+'Queue:save',{'UserId':_0x2716ca,['queueField']:_0x1e9b36[_0x29cbff]['id']});}})['then'](respondWithStatusCode(_0x9dd613,null))['catch'](APIHandleError(_0x9dd613));};exports[_0xae46('0x11c')]=function(_0x28fb8a,_0x4b063c){var _0x4d078b=_0x28fb8a[_0xae46('0x58')]['id'];var _0x40a696=null;if(_0x28fb8a['query']['ids']){_0x40a696=_[_0xae46('0xb3')](_0x28fb8a[_0xae46('0x44')][_0xae46('0xa9')])?_0x28fb8a[_0xae46('0x44')]['ids']:[_0x28fb8a[_0xae46('0x44')][_0xae46('0xa9')]];}var _0x287b8e=[];return Promise['resolve']()[_0xae46('0x12')](function(){if(!_0x40a696)throw new APIBadRequestError(_0xae46('0x11d'));})[_0xae46('0x12')](function(){return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x4d078b}});})[_0xae46('0x12')](function(_0x48cd96){if(!_0x48cd96)throw new APINotFoundError(util[_0xae46('0xaf')](_0xae46('0xcb'),_0x28fb8a[_0xae46('0x58')]['id']));return db[_0xae46('0x6d')][_0xae46('0x115')](function(_0x2974cc){return _0x48cd96[_0xae46('0x11c')](_0x40a696,{'transaction':_0x2974cc})[_0xae46('0x12')](function(){return db[_0xae46('0x112')]['findAll']({'where':{'id':{'$in':_0x40a696}}});})[_0xae46('0x12')](function(_0x2be418){var _0x39c542=_['map'](_0x2be418,function(_0x551bd2){return _0x551bd2['getAssociatedQueues']();});return Promise[_0xae46('0x56')](_0x39c542);})[_0xae46('0x12')](function(_0xca9c83){_0x287b8e=_[_0xae46('0x117')](_0xca9c83);var _0x1486a8=_['map'](_0x287b8e,function(_0x144df2){return _0x144df2[_0xae46('0x11e')](_0x48cd96['id'],{'transaction':_0x2974cc});});return Promise[_0xae46('0x56')](_0x1486a8);})[_0xae46('0x12')](function(){if(!_0x48cd96[_0xae46('0x9e')])return;var _0x3d5f00=_[_0xae46('0xd7')](_0x287b8e,function(_0x1fe8ee){return _0x1fe8ee[_0xae46('0x119')](_0xae46('0x9d'))==='Voice';});var _0x2503bf=_[_0xae46('0x32')](_0x3d5f00,function(_0x26584c){return db['UserVoiceQueueRt'][_0xae46('0x2b')]({'where':{'VoiceQueueId':_0x26584c['id'],'UserId':_0x48cd96['id']},'transaction':_0x2974cc});});return Promise[_0xae46('0x56')](_0x2503bf);})[_0xae46('0x12')](function(){return db[_0xae46('0x11b')]['findAll']({'where':{'teamId':{'$in':_0x40a696}}});})[_0xae46('0x12')](function(_0x1e7518){var _0x1b8b14=_[_0xae46('0x32')](_0x1e7518,function(_0xb885cc){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x48cd96['id'],'VoicePrefixId':_0xb885cc[_0xae46('0x11f')]}},{'transaction':_0x2974cc});});return Promise[_0xae46('0x56')](_0x1b8b14);});});})[_0xae46('0x12')](function(){for(var _0x45c042=0x0;_0x45c042<_0x287b8e['length'];_0x45c042++){var _0x809801=_0x287b8e[_0x45c042][_0xae46('0x119')]('channel');var _0x183ed1=_0x809801+_0xae46('0xab');socket['emit']('user'+_0x809801+_0xae46('0xb4'),{'UserId':_0x4d078b,['queueField']:_0x287b8e[_0x45c042]['id']});}})[_0xae46('0x12')](respondWithStatusCode(_0x4b063c,null))[_0xae46('0x1c')](APIHandleError(_0x4b063c));};exports[_0xae46('0x120')]=function(_0x5db059,_0x4cb130){var _0x24ad40={};var _0x210295={};var _0x125367;var _0x4b2f60;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x5db059[_0xae46('0x58')]['id']}})['then'](handleEntityNotFound(_0x4cb130,null))[_0xae46('0x12')](function(_0xb576da){if(_0xb576da){_0x125367=_0xb576da;_0x210295[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0x121')]['rawAttributes']);_0x210295[_0xae46('0x44')]=_[_0xae46('0x5b')](_0x5db059[_0xae46('0x44')]);_0x210295['filters']=_[_0xae46('0x5d')](_0x210295[_0xae46('0x59')],_0x210295[_0xae46('0x44')]);_0x24ad40[_0xae46('0x4a')]=_['intersection'](_0x210295[_0xae46('0x59')],qs[_0xae46('0xd4')](_0x5db059['query'][_0xae46('0xd4')]));_0x24ad40[_0xae46('0x4a')]=_0x24ad40['attributes']['length']?_0x24ad40[_0xae46('0x4a')]:_0x210295[_0xae46('0x59')];_0x24ad40[_0xae46('0xd5')]=qs[_0xae46('0xd6')](_0x5db059['query']['sort']);_0x24ad40[_0xae46('0x42')]=qs[_0xae46('0x5c')](_['pick'](_0x5db059[_0xae46('0x44')],_0x210295['filters']));if(_0x5db059['query'][_0xae46('0xd7')]){_0x24ad40[_0xae46('0x42')]=_[_0xae46('0xd8')](_0x24ad40[_0xae46('0x42')],{'$or':_['map'](_0x24ad40[_0xae46('0x4a')],function(_0x589ed9){var _0x584d07={};_0x584d07[_0x589ed9]={'$like':'%'+_0x5db059[_0xae46('0x44')][_0xae46('0xd7')]+'%'};return _0x584d07;})});}_0x24ad40=_['merge']({},_0x24ad40,_0x5db059[_0xae46('0x5e')]);return _0x125367[_0xae46('0x120')](_0x24ad40);}})['then'](function(_0x5a9e0c){if(_0x5a9e0c){_0x4b2f60=_0x5a9e0c['length'];if(!_0x5db059[_0xae46('0x44')][_0xae46('0xcc')](_0xae46('0xd9'))){_0x24ad40[_0xae46('0x21')]=qs[_0xae46('0x21')](_0x5db059[_0xae46('0x44')][_0xae46('0x21')]);_0x24ad40[_0xae46('0x23')]=qs[_0xae46('0x23')](_0x5db059[_0xae46('0x44')]['offset']);}return _0x125367[_0xae46('0x120')](_0x24ad40);}})[_0xae46('0x12')](function(_0xcf42d1){if(_0xcf42d1){return _0xcf42d1?{'count':_0x4b2f60,'rows':_0xcf42d1}:null;}})[_0xae46('0x12')](respondWithResult(_0x4cb130,null))['catch'](handleError(_0x4cb130,null));};exports['getAgents']=function(_0x133049,_0x529b81){var _0x167185={};var _0x15c9d3={};var _0x12234c;return db[_0xae46('0x43')][_0xae46('0x96')]({'where':{'id':_0x133049[_0xae46('0x58')]['id']}})[_0xae46('0x12')](handleEntityNotFound(_0x529b81,null))[_0xae46('0x12')](function(_0xd14e8e){if(_0xd14e8e){_0x12234c=_0xd14e8e;_0x15c9d3[_0xae46('0x59')]=_[_0xae46('0x5b')](db[_0xae46('0x43')][_0xae46('0x3a')]);_0x15c9d3[_0xae46('0x44')]=_[_0xae46('0x5b')](_0x133049['query']);_0x15c9d3[_0xae46('0x5c')]=_[_0xae46('0x5d')](_0x15c9d3[_0xae46('0x59')],_0x15c9d3[_0xae46('0x44')]);_0x167185[_0xae46('0x4a')]=_['intersection'](_0x15c9d3[_0xae46('0x59')],qs['fields'](_0x133049['query'][_0xae46('0xd4')]));_0x167185[_0xae46('0x4a')]=_0x167185[_0xae46('0x4a')][_0xae46('0x4f')]?_0x167185[_0xae46('0x4a')]:_0x15c9d3[_0xae46('0x59')];_0x167185['order']=qs[_0xae46('0xd6')](_0x133049['query'][_0xae46('0xd6')]);_0x167185[_0xae46('0x42')]=qs[_0xae46('0x5c')](_[_0xae46('0xdb')](_0x133049[_0xae46('0x44')],_0x15c9d3[_0xae46('0x5c')]));if(_0x133049[_0xae46('0x44')][_0xae46('0xd7')]){_0x167185[_0xae46('0x42')]=_[_0xae46('0xd8')](_0x167185[_0xae46('0x42')],{'$or':_['map'](_0x167185[_0xae46('0x4a')],function(_0x53f752){var _0x57db7a={};_0x57db7a[_0x53f752]={'$like':'%'+_0x133049['query'][_0xae46('0xd7')]+'%'};return _0x57db7a;})});}_0x167185['model']=db[_0xae46('0x43')];_0x167185['as']=_0xae46('0x2e');_0x167185=_['merge']({},_0x167185,_0x133049[_0xae46('0x5e')]);return _0x12234c[_0xae46('0xf7')]({'include':[_0x167185]});}})[_0xae46('0x12')](function(_0xa0d834){if(_0xa0d834){var _0x196b4a={},_0x142faa=[];for(var _0x5f49c9=0x0;_0x5f49c9<_0xa0d834[_0xae46('0x4f')];_0x5f49c9+=0x1){for(var _0x3f7440=0x0,_0xa1ffd0;_0x3f7440<_0xa0d834[_0x5f49c9]['Agents'][_0xae46('0x4f')];_0x3f7440+=0x1){_0xa1ffd0=_0xa0d834[_0x5f49c9][_0xae46('0x2e')][_0x3f7440][_0xae46('0xad')]({'plain':!![]});_0x196b4a[_0xa1ffd0['id']]=_0xa1ffd0;}}_0x196b4a=_[_0xae46('0x122')](_0x196b4a);for(var _0x512bac=qs[_0xae46('0x23')](_0x133049['query']['offset']);_0x512bac<_0x196b4a[_0xae46('0x4f')]&&_0x142faa[_0xae46('0x4f')]=_0xfd0ccf){_0x18367b=_0xfd0ccf;_0x553a7e=0xc8;}else{_0x553a7e=0xce;}_0xa44d12[_0x5615('0x1d')](_0x553a7e);return _0xa44d12['set'](_0x5615('0x24'),_0x2627a3+'-'+_0x18367b+'/'+_0xfd0ccf)[_0x5615('0x1f')](_0x20903a);}return null;};}function saveUpdates(_0x360eef){return function(_0xc26475){if(_0xc26475){return _0xc26475[_0x5615('0x25')](_0x360eef)[_0x5615('0x26')](function(_0x7a87d8){if(_0x7a87d8[_0x5615('0x27')]===_0x5615('0x28')){socket[_0x5615('0x29')]('userNotification:recalc:'+_0x7a87d8['id'],_0x7a87d8);}return _0x7a87d8;});}return null;};}function removeEntity(_0x221dc4){return function(_0x4b503f){if(_0x4b503f){return _0x4b503f[_0x5615('0x2a')]()[_0x5615('0x26')](function(){var _0x4e4765=_0x4b503f[_0x5615('0x2b')]({'plain':!![]});if(_0x4e4765[_0x5615('0x27')]===_0x5615('0x2c'))return;var _0x35748e=[{'name':_0x5615('0x2d'),'value':_0x5615('0x2e'),'ignore':!![]},{'name':_0x5615('0x2f'),'value':_0x5615('0x28'),'ignore':![]},{'name':_0x5615('0x30'),'value':_0x5615('0x31'),'ignore':![]}];var _0x5f258c=_(_0x35748e)[_0x5615('0x32')](_0x5615('0x33'))['map']('value')['value']();if(_[_0x5615('0x34')](_0x5f258c,_0x4e4765[_0x5615('0x27')])){return;}var _0x20e5ff=_[_0x5615('0x35')](_0x35748e,['value',_0x4e4765[_0x5615('0x27')]])['name'];return db[_0x5615('0x36')][_0x5615('0x2a')]({'where':{'type':_0x20e5ff,'resourceId':_0x4e4765['id']}})[_0x5615('0x26')](function(){return _0x4b503f;});})[_0x5615('0x26')](function(){_0x221dc4[_0x5615('0x1d')](0xcc)[_0x5615('0x1e')]();});}};}function handleEntityNotFound(_0x1c50f3){return function(_0x7751c1){if(!_0x7751c1){_0x1c50f3[_0x5615('0x37')](0x194);}return _0x7751c1;};}function handleError(_0x3e9a1e,_0x317517){_0x317517=_0x317517||0x1f4;return function(_0x3dbff2){logger['error'](_0x3dbff2[_0x5615('0x38')]);if(_0x3dbff2['name']){delete _0x3dbff2[_0x5615('0x39')];}_0x3e9a1e[_0x5615('0x1d')](_0x317517)[_0x5615('0x3a')](_0x3dbff2);};}exports[_0x5615('0x3b')]=function(_0x36eede,_0x211e3b){var _0x1dc3dd={},_0x134422={'count':0x0,'rows':[]};var _0x27eef8=_(db[_0x5615('0x3c')][_0x5615('0x3d')])['map'](function(_0xd67058){return{'name':_0xd67058[_0x5615('0x3e')],'type':_0xd67058[_0x5615('0x3f')][_0x5615('0x40')]};})['filter'](function(_0x3e3614){return!_[_0x5615('0x34')]([_0x5615('0x41'),_0x5615('0x42')],_0x3e3614['name']);})[_0x5615('0x43')]();_0x1dc3dd=qs[_0x5615('0x44')](_0x27eef8,_0x36eede);var _0x1be6e1={'where':_0x1dc3dd[_0x5615('0x45')]};return db[_0x5615('0x3c')][_0x5615('0x22')](_0x1be6e1)[_0x5615('0x26')](function(_0x4aa717){_0x134422[_0x5615('0x22')]=_0x4aa717;if(_0x36eede[_0x5615('0x46')][_0x5615('0x47')]){_0x1dc3dd['include']=[{'all':!![]}];}if(_0x36eede[_0x5615('0x46')][_0x5615('0x48')]===_0x5615('0x49')){_0x1dc3dd[_0x5615('0x4a')]=[{'model':db[_0x5615('0x4b')],'as':_0x5615('0x48')}];}if(!_['includes'](_0x1dc3dd[_0x5615('0x4c')],'id')){_0x1dc3dd['attributes'][_0x5615('0x4d')]('id');}return db['User'][_0x5615('0x4e')](_0x1dc3dd);})[_0x5615('0x26')](function(_0xaf9d67){_0x134422['rows']=_0xaf9d67;if(_0x36eede['query']['openTabs']===_0x5615('0x49')){var _0x6d7a8d=[];for(var _0x41adc3=0x0;_0x41adc3<_0x134422[_0x5615('0x4f')]['length'];_0x41adc3++){_0x6d7a8d[_0x5615('0x4d')](get_open_tabs(_0x5615('0x50'),_0x134422[_0x5615('0x4f')][_0x41adc3]['dataValues']));_0x6d7a8d[_0x5615('0x4d')](get_open_tabs(_0x5615('0x51'),_0x134422[_0x5615('0x4f')][_0x41adc3][_0x5615('0x52')]));_0x6d7a8d[_0x5615('0x4d')](get_open_tabs('fax',_0x134422[_0x5615('0x4f')][_0x41adc3][_0x5615('0x52')]));_0x6d7a8d['push'](get_open_tabs(_0x5615('0x53'),_0x134422[_0x5615('0x4f')][_0x41adc3][_0x5615('0x52')]));_0x6d7a8d[_0x5615('0x4d')](get_open_tabs(_0x5615('0x54'),_0x134422[_0x5615('0x4f')][_0x41adc3]['dataValues']));_0x6d7a8d[_0x5615('0x4d')](get_open_tabs('whatsapp',_0x134422[_0x5615('0x4f')][_0x41adc3]['dataValues']));}return Promise[_0x5615('0x55')](_0x6d7a8d)[_0x5615('0x26')](function(){return _0x134422;});}else{return _0x134422;}})[_0x5615('0x26')](respondWithFilteredResult(_0x211e3b,_0x1dc3dd))[_0x5615('0x56')](handleError(_0x211e3b,null));};exports[_0x5615('0x57')]=function(_0x9dafe5,_0x26fba7){var _0x224f79={'raw':![],'where':{'id':_0x9dafe5[_0x5615('0x58')]['id']}},_0x261ac4={};_0x261ac4[_0x5615('0x59')]=_[_0x5615('0x5a')](_[_0x5615('0x5b')](db['User'][_0x5615('0x3d')]),[_0x5615('0x41'),_0x5615('0x42')]);_0x261ac4[_0x5615('0x46')]=_['keys'](_0x9dafe5[_0x5615('0x46')]);_0x261ac4[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x261ac4[_0x5615('0x59')],_0x261ac4[_0x5615('0x46')]);_0x224f79[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0x261ac4[_0x5615('0x59')],qs['fields'](_0x9dafe5[_0x5615('0x46')][_0x5615('0x5e')]));_0x224f79['attributes']=_0x224f79[_0x5615('0x4c')][_0x5615('0x5f')]?_0x224f79['attributes']:_0x261ac4[_0x5615('0x59')];if(_0x9dafe5[_0x5615('0x46')][_0x5615('0x47')]){_0x224f79[_0x5615('0x4a')]=[{'all':!![]}];}if(_0x9dafe5[_0x5615('0x46')]['userSetting']===_0x5615('0x49')){_0x224f79[_0x5615('0x4a')]=[{'model':db['UserSetting'],'as':_0x5615('0x48')}];}_0x224f79=_[_0x5615('0x60')]({},_0x224f79,_0x9dafe5[_0x5615('0x61')]);if(!_[_0x5615('0x34')](_0x224f79['attributes'],'id')){_0x224f79[_0x5615('0x4c')][_0x5615('0x4d')]('id');}return db[_0x5615('0x3c')][_0x5615('0x35')](_0x224f79)[_0x5615('0x26')](handleEntityNotFound(_0x26fba7,null))[_0x5615('0x26')](function(_0x56dc3e){var _0x478173=[];values=_0x56dc3e;if(_0x9dafe5[_0x5615('0x46')][_0x5615('0x62')]==='true'){_0x478173['push'](get_open_tabs(_0x5615('0x50'),_0x56dc3e[_0x5615('0x52')]));_0x478173[_0x5615('0x4d')](get_open_tabs(_0x5615('0x51'),_0x56dc3e[_0x5615('0x52')]));_0x478173[_0x5615('0x4d')](get_open_tabs('openchannel',_0x56dc3e[_0x5615('0x52')]));_0x478173[_0x5615('0x4d')](get_open_tabs('whatsapp',_0x56dc3e['dataValues']));_0x478173[_0x5615('0x4d')](get_open_tabs('fax',_0x56dc3e[_0x5615('0x52')]));_0x478173[_0x5615('0x4d')](get_open_tabs('mail',_0x56dc3e['dataValues']));return Promise['all'](_0x478173);}else{return values;}})[_0x5615('0x26')](function(){return values;})[_0x5615('0x26')](respondWithResult(_0x26fba7,null))['catch'](handleError(_0x26fba7,null));};exports['update']=function(_0x36594b,_0x1172ee){if(_0x36594b[_0x5615('0x63')]['id']){delete _0x36594b[_0x5615('0x63')]['id'];}delete _0x36594b[_0x5615('0x63')][_0x5615('0x27')];return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x36594b[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x1172ee,null))[_0x5615('0x26')](saveUpdates(_0x36594b[_0x5615('0x63')],null))[_0x5615('0x26')](respondWithResult(_0x1172ee,null))[_0x5615('0x56')](handleError(_0x1172ee,null));};exports[_0x5615('0x64')]=function(_0x2a547e,_0x9dd01a){return db[_0x5615('0x3c')][_0x5615('0x64')]()[_0x5615('0x26')](respondWithResult(_0x9dd01a,null))[_0x5615('0x56')](handleError(_0x9dd01a,null));};exports['addContacts']=function(_0x427211,_0x3bb165){return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x427211['params']['id']}})['then'](handleEntityNotFound(_0x3bb165,null))[_0x5615('0x26')](function(_0x1b7d3f){if(_0x1b7d3f){return _0x1b7d3f[_0x5615('0x65')](_0x427211[_0x5615('0x63')][_0x5615('0x66')],_['omit'](_0x427211[_0x5615('0x63')],[_0x5615('0x66'),'id'])||{});}})[_0x5615('0x26')](respondWithResult(_0x3bb165,null))['catch'](handleError(_0x3bb165,null));};function validateUser(_0x3a810b){return new Promise(function(_0xf546a,_0x131737){if(_0x3a810b['internal'])return _0xf546a(_0x3a810b);return db[_0x5615('0x67')][_0x5615('0x68')](0x1)['then'](function(_0x56984b){if(_0x56984b['securePassword'])authService[_0x5615('0x69')](_0x3a810b[_0x5615('0x41')]);db['User'][_0x5615('0x6a')](_0x5615('0x6b'))[_0x5615('0x26')](function(_0x4d5ac1){if(_[_0x5615('0x6c')](_0x4d5ac1)){_0x3a810b[_0x5615('0x6b')]=_0x56984b[_0x5615('0x6d')]||0x1;return;}if(_[_0x5615('0x6c')](_0x56984b[_0x5615('0x6d')])||_0x56984b[_0x5615('0x6d')]===_0x4d5ac1){_0x3a810b['internal']=_0x4d5ac1+0x1;return;}if(_0x56984b[_0x5615('0x6d')]>_0x4d5ac1){_0x3a810b[_0x5615('0x6b')]=_0x56984b[_0x5615('0x6d')];return;}return db[_0x5615('0x6e')][_0x5615('0x46')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x5615('0x6f')]})[_0x5615('0x26')](function(_0x46bbb8){if(_0x46bbb8&&_0x46bbb8['length']){for(var _0x105a81=0x0,_0x192d3a=_0x46bbb8[_0x5615('0x5f')];_0x105a81<_0x192d3a&&_[_0x5615('0x6c')](_0x3a810b[_0x5615('0x6b')]);_0x105a81++){if(_0x56984b[_0x5615('0x6d')]<=_0x46bbb8[_0x105a81][_0x5615('0x70')]){_0x3a810b[_0x5615('0x6b')]=_0x46bbb8[_0x105a81][_0x5615('0x70')];}else if(_0x56984b[_0x5615('0x6d')]>_0x46bbb8[_0x105a81]['from']&&_0x56984b['min_internal']<=_0x46bbb8[_0x105a81]['to']){_0x3a810b[_0x5615('0x6b')]=_0x56984b['min_internal'];}}}if(_['isNil'](_0x3a810b[_0x5615('0x6b')])){_0x3a810b['internal']=_0x4d5ac1+0x1;}return _0xf546a(_0x3a810b);});});})[_0x5615('0x56')](function(_0x53bea3){_0x131737(_0x53bea3);});});}function updateUser(_0x209015){return new Promise(function(_0x2296a9,_0x529456){try{if(_0x209015['voicemail']){_0x209015[_0x5615('0x71')]=_0x209015[_0x5615('0x6b')];_0x209015['VoiceMail']={'mailbox':_0x209015['internal'],'password':_0x209015[_0x5615('0x41')],'fullname':_0x209015['fullname'],'email':_0x209015['email']};}if(_0x209015[_0x5615('0x27')]===_0x5615('0x28')){if(!_0x209015[_0x5615('0x72')])_0x209015[_0x5615('0x72')]=[_0x5615('0x73'),_0x5615('0x74'),_0x5615('0x75'),'113',_0x5615('0x76'),'104',_0x5615('0x77'),_0x5615('0x78'),'107',_0x5615('0x79'),'109',_0x5615('0x7a'),_0x5615('0x7b'),'114',_0x5615('0x7c')];}_0x2296a9(_0x209015);}catch(_0x1be62c){_0x529456(_0x1be62c);}});}exports[_0x5615('0x7d')]=function(_0xbba81f,_0x516803){if(_0xbba81f[_0x5615('0x2e')][_0x5615('0x27')]===_0x5615('0x28'))throw new Error(_0x5615('0x7e'));if(_0xbba81f[_0x5615('0x63')][_0x5615('0x27')]===_0x5615('0x2e')&&_0xbba81f[_0x5615('0x2e')][_0x5615('0x27')]!==_0x5615('0x2c')){throw new Error(_0x5615('0x7f'));}if(_0xbba81f[_0x5615('0x63')][_0x5615('0x27')]==='admin'&&_0xbba81f[_0x5615('0x2e')]['role']!=='admin'){throw new Error(_0x5615('0x80'));}return licenseUtil['checkUserLimits']([_0xbba81f[_0x5615('0x63')]])['then'](function(){return validateUser(_0xbba81f[_0x5615('0x63')]);})[_0x5615('0x26')](function(_0x581386){return updateUser(_0x581386)[_0x5615('0x26')](function(_0x3d6c41){if(_0x3d6c41['role']==='admin'){_0x3d6c41['settingsEnabled']=_0xbba81f[_0x5615('0x2e')]['settingsEnabled'];delete _0x3d6c41[_0x5615('0x81')];}return _0x3d6c41;});})[_0x5615('0x26')](function(_0x5f0336){return db[_0x5615('0x3c')][_0x5615('0x7d')](_0x5f0336,{'include':[{'model':db['VoiceMail'],'as':_0x5615('0x82')}]});})[_0x5615('0x26')](function(_0x585c91){if(_0xbba81f[_0x5615('0x63')][_0x5615('0x27')]===_0x5615('0x2e'))return _0x585c91;if(_0xbba81f[_0x5615('0x2e')][_0x5615('0x27')]!==_0x5615('0x2e'))return _0x585c91;return db[_0x5615('0x83')][_0x5615('0x35')]({'where':{'name':_0x585c91[_0x5615('0x27')]===_0x5615('0x28')?_0x5615('0x2f'):'Telephones','userProfileId':_0xbba81f[_0x5615('0x2e')][_0x5615('0x81')]},'raw':!![]})[_0x5615('0x26')](function(_0x41e490){if(!_0x41e490||_0x41e490[_0x5615('0x84')]!=0x0)return _0x585c91;return db['UserProfileResource'][_0x5615('0x7d')]({'name':_0x585c91[_0x5615('0x39')],'resourceId':_0x585c91['id'],'type':_0x41e490[_0x5615('0x39')],'sectionId':_0x41e490['id']},{})['then'](function(){return _0x585c91;});})[_0x5615('0x56')](function(_0x457499){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x457499);throw _0x457499;});})['then'](respondWithResult(_0x516803,0xc9))[_0x5615('0x56')](handleError(_0x516803,null));};exports['bulkCreate']=function(_0x327139,_0x24d420){var _0x4e4b34=_0x327139[_0x5615('0x63')];var _0x40a6a0=[];if(_0x327139[_0x5615('0x2e')]['role']===_0x5615('0x28'))throw new Error('Unauthorized');if(_[_0x5615('0x85')](_0x4e4b34,[_0x5615('0x27'),_0x5615('0x2e')])&&_0x327139[_0x5615('0x2e')][_0x5615('0x27')]!==_0x5615('0x2c')){throw new Error(_0x5615('0x7f'));}if(_[_0x5615('0x85')](_0x4e4b34,[_0x5615('0x27'),_0x5615('0x2c')])&&_0x327139['user'][_0x5615('0x27')]!==_0x5615('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x5615('0x86')](_0x4e4b34)[_0x5615('0x26')](function(){return validateUser(_0x4e4b34[0x0]);})[_0x5615('0x26')](function(){for(var _0x3d6bbc=0x1;_0x3d6bbc<_0x4e4b34['length'];_0x3d6bbc++){var _0x215ce5=_0x4e4b34[_0x3d6bbc-0x1][_0x5615('0x6b')];if(!_0x4e4b34[_0x3d6bbc][_0x5615('0x6b')])_0x4e4b34[_0x3d6bbc][_0x5615('0x6b')]=_0x215ce5+0x1;_0x40a6a0[_0x5615('0x4d')](validateUser(_0x4e4b34[_0x3d6bbc]));}return Promise[_0x5615('0x55')](_0x40a6a0);})['then'](function(){_0x40a6a0=[];for(var _0x52147b=0x0;_0x52147b<_0x4e4b34[_0x5615('0x5f')];_0x52147b++){_0x40a6a0[_0x5615('0x4d')](updateUser(_0x4e4b34[_0x52147b]));}return Promise[_0x5615('0x55')](_0x40a6a0);})[_0x5615('0x26')](function(){_0x40a6a0=_0x4e4b34[_0x5615('0x87')](function(_0x28cebd){return db['User'][_0x5615('0x7d')](_0x28cebd,{'include':[{'model':db[_0x5615('0x82')],'as':_0x5615('0x82')}]})[_0x5615('0x26')](function(_0x1f4941){_0x28cebd['id']=_0x1f4941['id'];return _0x28cebd;});});return Promise[_0x5615('0x55')](_0x40a6a0);})[_0x5615('0x26')](function(_0xc5055e){if(_0x327139[_0x5615('0x63')]['role']===_0x5615('0x2e'))return _0xc5055e;if(_0x327139[_0x5615('0x2e')][_0x5615('0x27')]!=='user')return _0xc5055e;var _0x2235d4=_[_0x5615('0x85')](_0xc5055e,function(_0x3a75fe){return _0x3a75fe[_0x5615('0x27')]===_0x5615('0x28')||_0x3a75fe['role']===_0x5615('0x31');});if(!_0x2235d4)return _0xc5055e;return db[_0x5615('0x83')][_0x5615('0x4e')]({'where':{'name':{'$or':[_0x5615('0x2f'),_0x5615('0x30')]},'userProfileId':_0x327139[_0x5615('0x2e')][_0x5615('0x81')]},'raw':!![]})[_0x5615('0x26')](function(_0x718f36){if(_[_0x5615('0x88')](_0x718f36)||!_[_0x5615('0x85')](_0x718f36,[_0x5615('0x84'),0x0]))return _0xc5055e;_0x40a6a0=[];var _0x3eee79=_(_0x718f36)[_0x5615('0x87')](function(_0x179917){if(_0x179917[_0x5615('0x84')]===0x1)return;return _0x179917[_0x5615('0x39')]===_0x5615('0x2f')?_0x5615('0x28'):_0x5615('0x31');})['compact']()[_0x5615('0x43')]();for(var _0x4a4e63=0x0;_0x4a4e63<_0xc5055e[_0x5615('0x5f')];_0x4a4e63++){if(!_[_0x5615('0x34')](_0x3eee79,_0xc5055e[_0x4a4e63][_0x5615('0x27')]))return;var _0x531360=_0xc5055e[_0x4a4e63][_0x5615('0x27')]==='agent'?_0x5615('0x2f'):'Telephones';_0x40a6a0[_0x5615('0x4d')](db[_0x5615('0x36')][_0x5615('0x7d')]({'name':_0xc5055e[_0x4a4e63]['name'],'resourceId':_0xc5055e[_0x4a4e63]['id'],'type':_0x531360,'sectionId':_['find'](_0x718f36,[_0x5615('0x39'),_0x531360])['id']},{}));}return Promise[_0x5615('0x55')](_0x40a6a0);});})[_0x5615('0x26')](respondWithResult(_0x24d420,0xc9))['catch'](handleError(_0x24d420,null));};exports[_0x5615('0x89')]=function(_0x4ca41e,_0x3cd13f){if(_0x4ca41e['body']['id']){delete _0x4ca41e['body']['id'];}return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x4ca41e['params']['id']}})[_0x5615('0x26')](function(_0x56f2a0){if(!_0x56f2a0)return null;if(_0x56f2a0['id']===_0x4ca41e[_0x5615('0x2e')]['id']){if(!_0x4ca41e['body'][_0x5615('0x8a')]||!_0x4ca41e[_0x5615('0x63')][_0x5615('0x8b')]){throw new db[(_0x5615('0x8c'))][(_0x5615('0x8d'))](_0x5615('0x8e'));}if(!_0x56f2a0[_0x5615('0x8f')](_0x4ca41e[_0x5615('0x63')]['oldPassword'])){throw new db[(_0x5615('0x8c'))]['ValidationError'](_0x5615('0x90'));}if(_0x4ca41e[_0x5615('0x63')][_0x5615('0x8a')]===_0x4ca41e[_0x5615('0x63')][_0x5615('0x8b')]){throw new db[(_0x5615('0x8c'))][(_0x5615('0x8d'))](_0x5615('0x91'));}}else if(_0x4ca41e[_0x5615('0x2e')]['role']==='admin'){if(!_0x4ca41e[_0x5615('0x63')][_0x5615('0x8b')]){throw new db['Sequelize'][(_0x5615('0x8d'))](_0x5615('0x92'));}}else if(_0x4ca41e['user'][_0x5615('0x27')]==='user'){if(!_0x4ca41e[_0x5615('0x63')][_0x5615('0x8b')]){throw new db[(_0x5615('0x8c'))][(_0x5615('0x8d'))](_0x5615('0x92'));}if(_0x56f2a0[_0x5615('0x27')]!==_0x5615('0x28')){throw new db['Sequelize'][(_0x5615('0x8d'))](_0x5615('0x7e'));}}else{throw new db['Sequelize'][(_0x5615('0x8d'))]('Unauthorized');}return _0x56f2a0;})[_0x5615('0x26')](handleEntityNotFound(_0x3cd13f,null))[_0x5615('0x26')](function(_0x50b2ce){return db['Setting'][_0x5615('0x93')]({'attributes':['id',_0x5615('0x94'),_0x5615('0x95'),_0x5615('0x96')]})[_0x5615('0x26')](function(_0x7e04cd){if(_0x7e04cd['securePassword'])authService[_0x5615('0x69')](_0x4ca41e['body']['newPassword']);if(!_0x7e04cd[_0x5615('0x95')]||!_0x50b2ce[_0x5615('0x97')])return _0x50b2ce;authService['validatePasswordHistory'](_0x4ca41e[_0x5615('0x63')]['newPassword'],_0x50b2ce['previousPasswords'],_0x7e04cd[_0x5615('0x96')]);return _0x50b2ce;})[_0x5615('0x26')](saveUpdates({'password':_0x4ca41e['body']['newPassword'],'passwordResetAt':_0x4ca41e[_0x5615('0x2e')]['id']==_0x4ca41e[_0x5615('0x58')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4ca41e[_0x5615('0x63')][_0x5615('0x8b')],_0x50b2ce['previousPasswords'])},null));})[_0x5615('0x26')](respondWithResult(_0x3cd13f,null))[_0x5615('0x56')](handleError(_0x3cd13f,null));};exports[_0x5615('0x98')]=function(_0x29600e,_0x5080c5){var _0xaf5290=_0x29600e['body'][_0x5615('0x99')];return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x29600e['params']['id']},'attributes':['id',_0x5615('0x39'),_0x5615('0x27'),_0x5615('0x9a'),_0x5615('0x9b'),_0x5615('0x9c'),'interface']})['then'](handleEntityNotFound(_0x5080c5,null))['then'](function(_0x39b4b8){if(_0x39b4b8){if(!utils['isValidChannel'](_0xaf5290)){throw new db[(_0x5615('0x8c'))]['ValidationError']('Unknown\x20channel');}return _0x39b4b8[_0x5615('0x9d')+_[_0x5615('0x9e')](_0xaf5290['toLowerCase']())+_0x5615('0x9f')](_0x29600e['body'][_0x5615('0x66')],{'penalty':_0x29600e[_0x5615('0x63')]['penalty']||0x0})[_0x5615('0xa0')](function(_0x449df7){for(var _0xfdae36=0x0;_0xfdae36<_0x29600e[_0x5615('0x63')][_0x5615('0x66')]['length'];_0xfdae36+=0x1){var _0x5cfea9={'UserId':Number(_0x29600e[_0x5615('0x58')]['id'])};_0x5cfea9[_[_0x5615('0x9e')](_0xaf5290[_0x5615('0xa1')]())+_0x5615('0xa2')]=Number(_0x29600e[_0x5615('0x63')][_0x5615('0x66')][_0xfdae36]);socket[_0x5615('0x29')](_0x5615('0x2e')+_[_0x5615('0x9e')](_0xaf5290[_0x5615('0xa1')]())+_0x5615('0xa3'),_0x5cfea9);}return _0x449df7;})[_0x5615('0x26')](function(){if(_0xaf5290==='voice'){return db[_0x5615('0xa4')]['findAll']({'where':{'id':_0x29600e['body'][_0x5615('0x66')]||[]},'raw':!![],'attributes':['id',_0x5615('0x39')]});}})[_0x5615('0x26')](function(_0x24742c){var _0x308611=_0x39b4b8[_0x5615('0x2b')]({'plain':!![]});var _0x299c09=[];if(_0xaf5290===_0x5615('0xa5')&&_0x308611[_0x5615('0x27')]===_0x5615('0x28')&&_0x308611[_0x5615('0x9a')]){for(let _0x4f9049=0x0;_0x4f9049<_0x24742c[_0x5615('0x5f')];_0x4f9049+=0x1){_0x299c09[_0x5615('0x4d')]({'membername':_0x308611[_0x5615('0x39')],'UserId':_0x308611['id'],'queue_name':_0x24742c[_0x4f9049]['name'],'VoiceQueueId':_0x24742c[_0x4f9049]['id'],'interface':_[_0x5615('0x6c')](_0x308611['interface'])?util[_0x5615('0xa6')](_0x5615('0xa7'),_0x308611[_0x5615('0x39')]):_0x308611['interface'],'paused':_0x308611[_0x5615('0x9c')]||![],'penalty':_0x29600e[_0x5615('0x63')][_0x5615('0xa8')]||0x0});}return Promise[_0x5615('0x55')](_0x299c09[_0x5615('0x87')](function(_0x194b6d){return db[_0x5615('0xa9')][_0x5615('0xaa')](_0x194b6d);}));}return _0x39b4b8;});}})['then'](respondWithStatusCode(_0x5080c5,null))[_0x5615('0x56')](handleError(_0x5080c5,null));};exports[_0x5615('0xab')]=function(_0x4bf0dc,_0x143816){var _0x21f82b,_0x354497;return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x4bf0dc[_0x5615('0x58')]['id']},'attributes':['id','name','role']})[_0x5615('0x26')](handleEntityNotFound(_0x143816,null))[_0x5615('0x26')](function(_0x3878ae){if(_0x3878ae){_0x21f82b=_0x3878ae;if(!_0x4bf0dc[_0x5615('0x46')][_0x5615('0x99')]||!utils[_0x5615('0xac')](_0x4bf0dc[_0x5615('0x46')][_0x5615('0x99')])){throw new db[(_0x5615('0x8c'))]['ValidationError'](_0x5615('0xad'));}return _0x3878ae[_0x5615('0xae')+_[_0x5615('0x9e')](_0x4bf0dc[_0x5615('0x46')][_0x5615('0x99')][_0x5615('0xa1')]())+_0x5615('0x9f')](_0x4bf0dc[_0x5615('0x46')][_0x5615('0x66')]);}})[_0x5615('0x26')](function(_0x237943){if(_['isArray'](_0x4bf0dc[_0x5615('0x46')][_0x5615('0x66')])){for(var _0x3e3cbf=0x0;_0x3e3cbf<_0x4bf0dc[_0x5615('0x46')][_0x5615('0x66')]['length'];_0x3e3cbf+=0x1){_0x354497={'UserId':Number(_0x4bf0dc['params']['id'])};_0x354497[_[_0x5615('0x9e')](_0x4bf0dc[_0x5615('0x46')][_0x5615('0x99')][_0x5615('0xa1')]())+_0x5615('0xa2')]=Number(_0x4bf0dc[_0x5615('0x46')]['ids'][_0x3e3cbf]);socket[_0x5615('0x29')](_0x5615('0x2e')+_[_0x5615('0x9e')](_0x4bf0dc[_0x5615('0x46')][_0x5615('0x99')][_0x5615('0xa1')]())+_0x5615('0xaf'),_0x354497);}}else{_0x354497={'UserId':Number(_0x4bf0dc[_0x5615('0x58')]['id'])};_0x354497[_[_0x5615('0x9e')](_0x4bf0dc[_0x5615('0x46')][_0x5615('0x99')][_0x5615('0xa1')]())+_0x5615('0xa2')]=Number(_0x4bf0dc['query']['ids']);socket['emit']('user'+_[_0x5615('0x9e')](_0x4bf0dc['query'][_0x5615('0x99')][_0x5615('0xa1')]())+'Queue:remove',_0x354497);}return _0x237943;})[_0x5615('0x26')](function(){if(_0x4bf0dc[_0x5615('0x46')]['channel']==='voice'){return db[_0x5615('0xa9')][_0x5615('0x2a')]({'where':{'UserId':_0x4bf0dc['params']['id'],'VoiceQueueId':_0x4bf0dc[_0x5615('0x46')][_0x5615('0x66')]},'individualHooks':!![]})[_0x5615('0x26')](function(){return _0x21f82b;});}return _0x21f82b;})['then'](respondWithStatusCode(_0x143816,null))[_0x5615('0x56')](handleError(_0x143816,null));};exports[_0x5615('0xb0')]=function(_0x4b9c36,_0x506b97){_0x4b9c36[_0x5615('0x63')][_0x5615('0xb1')]=_0x4b9c36[_0x5615('0xb2')]['filename'];return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x4b9c36['params']['id']}})['then'](handleEntityNotFound(_0x506b97,null))[_0x5615('0x26')](saveUpdates(_0x4b9c36[_0x5615('0x63')],null))[_0x5615('0x26')](respondWithResult(_0x506b97,null))[_0x5615('0x56')](handleError(_0x506b97,null));};exports[_0x5615('0xb3')]=function(_0x362237,_0x3af8c9){var _0x363007=path[_0x5615('0xb4')](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0x5615('0x35')]({'where':{'id':_0x362237['params']['id']},'attributes':['id',_0x5615('0xb1')],'raw':!![]})[_0x5615('0x26')](handleEntityNotFound(_0x3af8c9,null))[_0x5615('0x26')](function(_0x17414c){if(_0x17414c){if(_['isNil'](_0x17414c['userpic'])){return _0x3af8c9['download'](_0x363007);}else{if(!fs[_0x5615('0xb5')](path[_0x5615('0xb4')](config[_0x5615('0xb6')],_0x5615('0xb7'),_0x17414c['userpic']))){return _0x3af8c9[_0x5615('0xb8')](_0x363007);}return _0x3af8c9['download'](path['join'](config[_0x5615('0xb6')],_0x5615('0xb7'),_0x17414c[_0x5615('0xb1')]));}}})[_0x5615('0x56')](handleError(_0x3af8c9,null));};exports[_0x5615('0xb9')]=function(_0x4db55a,_0x25edad){return db['User'][_0x5615('0x35')]({'where':{'id':_0x4db55a[_0x5615('0x58')]['id']},'attributes':['id']})[_0x5615('0x26')](handleEntityNotFound(_0x25edad,null))['then'](function(_0x546e2e){var _0x2e7b3c=[];values=_0x546e2e[_0x5615('0x52')];_0x2e7b3c[_0x5615('0x4d')](get_open_tabs(_0x5615('0x50'),_0x546e2e[_0x5615('0x52')]));_0x2e7b3c[_0x5615('0x4d')](get_open_tabs(_0x5615('0x51'),_0x546e2e[_0x5615('0x52')]));_0x2e7b3c[_0x5615('0x4d')](get_open_tabs(_0x5615('0x54'),_0x546e2e['dataValues']));_0x2e7b3c[_0x5615('0x4d')](get_open_tabs(_0x5615('0xba'),_0x546e2e[_0x5615('0x52')]));_0x2e7b3c['push'](get_open_tabs('fax',_0x546e2e[_0x5615('0x52')]));_0x2e7b3c[_0x5615('0x4d')](get_open_tabs('mail',_0x546e2e['dataValues']));return Promise[_0x5615('0x55')](_0x2e7b3c);})['then'](function(_0x33451a){if(_0x33451a){var _0xb054b3=_[_0x5615('0x87')](values[_0x5615('0xbb')],function(_0x4633f9){return{'channel':_0x5615('0xbc'),'id':_0x4633f9['id'],'createdAt':_0x4633f9[_0x5615('0xbd')]};});var _0x317b19=_[_0x5615('0x87')](values['FaxOpenTabs'],function(_0x3e7c42){return{'channel':_0x5615('0xbe'),'id':_0x3e7c42['id'],'createdAt':_0x3e7c42[_0x5615('0xbd')]};});var _0x46190f=_[_0x5615('0x87')](values[_0x5615('0xbf')],function(_0x5eb1df){return{'channel':_0x5615('0xc0'),'id':_0x5eb1df['id'],'createdAt':_0x5eb1df[_0x5615('0xbd')]};});var _0x89486f=_[_0x5615('0x87')](values[_0x5615('0xc1')],function(_0x5c032e){return{'channel':_0x5615('0xc2'),'id':_0x5c032e['id'],'createdAt':_0x5c032e['createdAt']};});var _0x3cebd5=_[_0x5615('0x87')](values[_0x5615('0xc3')],function(_0x4b403c){return{'channel':_0x5615('0xc4'),'id':_0x4b403c['id'],'createdAt':_0x4b403c[_0x5615('0xbd')]};});var _0x490978=_['map'](values[_0x5615('0xc5')],function(_0x2c182b){return{'channel':_0x5615('0xc6'),'id':_0x2c182b['id'],'createdAt':_0x2c182b[_0x5615('0xbd')]};});var _0x49e9dd=_['concat'](_0xb054b3,_0x317b19,_0x46190f,_0x89486f,_0x3cebd5,_0x490978);var _0x25fa10={'count':_0x49e9dd['length'],'rows':_0x49e9dd};return _0x25fa10;}else return null;})[_0x5615('0x26')](respondWithResult(_0x25edad,null))['catch'](handleError(_0x25edad,null));};exports[_0x5615('0xc7')]=function(_0x3b3e68,_0x22ceb2){var _0x501276={};return db['User']['findOne']({'where':{'id':_0x3b3e68[_0x5615('0x58')]['id']}})[_0x5615('0x26')](function(_0x416571){if(!_0x416571){throw new APINotFoundError(util[_0x5615('0xa6')](_0x5615('0xc8'),_0x3b3e68[_0x5615('0x58')]['id']));}return contacts[_0x5615('0x64')]();})[_0x5615('0x26')](function(_0x23c96a){_0x3b3e68[_0x5615('0x46')][_0x5615('0x3c')]=_0x3b3e68[_0x5615('0x58')]['id'];_0x501276=qs[_0x5615('0x44')](_0x23c96a,_0x3b3e68);if(_0x3b3e68[_0x5615('0x46')][_0x5615('0xc9')](_0x5615('0x47'))){_0x501276['include']=[{'model':db[_0x5615('0xca')],'as':_0x5615('0xcb'),'required':![]},{'model':db['Tag'],'as':_0x5615('0xcc'),'attributes':['id',_0x5615('0x39'),_0x5615('0xcd')],'where':_0x3b3e68[_0x5615('0x46')][_0x5615('0xce')]?{'id':_0x3b3e68[_0x5615('0x46')]['tag']}:undefined,'required':_0x3b3e68['query']['tag']?!![]:![]}];}return contacts['findAll'](_0x3b3e68[_0x5615('0x46')],_0x3b3e68[_0x5615('0x2e')],_0x501276,_0x23c96a);})[_0x5615('0x26')](respondWithFilteredResult(_0x22ceb2,_0x501276))[_0x5615('0x56')](APIHandleError(_0x22ceb2));};exports[_0x5615('0xcf')]=function(_0x628483,_0x200c2f){var _0x1d183b;var _0x24391f={};var _0x5a54c1;return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x628483['params']['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x200c2f,null))[_0x5615('0x26')](function(_0x30983f){if(!utils[_0x5615('0xac')](_0x628483[_0x5615('0x46')]['channel'])){throw new db[(_0x5615('0x8c'))]['ValidationError'](_0x5615('0xad'));}_0x1d183b=_0x30983f;var _0x6ddaea={};_0x6ddaea[_0x5615('0x59')]=_[_0x5615('0x5b')](db[_[_0x5615('0x9e')](_0x628483['query'][_0x5615('0x99')])+_0x5615('0xd0')][_0x5615('0x3d')]);_0x6ddaea[_0x5615('0x46')]=_[_0x5615('0x5b')](_0x628483[_0x5615('0x46')]);_0x6ddaea[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x6ddaea['model'],_0x6ddaea[_0x5615('0x46')]);_0x24391f['attributes']=_[_0x5615('0x5d')](_0x6ddaea[_0x5615('0x59')],qs[_0x5615('0x5e')](_0x628483['query'][_0x5615('0x5e')]));_0x24391f[_0x5615('0x4c')]=_0x24391f[_0x5615('0x4c')][_0x5615('0x5f')]?_0x24391f['attributes']:_0x6ddaea['model'];_0x24391f['order']=qs[_0x5615('0xd1')](_0x628483[_0x5615('0x46')][_0x5615('0xd1')]);_0x24391f[_0x5615('0x45')]=qs[_0x5615('0x5c')](_[_0x5615('0xd2')](_0x628483[_0x5615('0x46')],_0x6ddaea[_0x5615('0x5c')]));if(_0x628483[_0x5615('0x46')][_0x5615('0x32')]){_0x24391f[_0x5615('0x45')]=_[_0x5615('0x60')](_0x24391f['where'],{'$or':_[_0x5615('0x87')](_0x24391f[_0x5615('0x4c')],function(_0xb43ab5){var _0x2c31dc={};_0x2c31dc[_0xb43ab5]={'$like':'%'+_0x628483[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x2c31dc;})});}_0x24391f=_[_0x5615('0x60')]({},_0x24391f,_0x628483[_0x5615('0x61')]);switch(_0x1d183b[_0x5615('0x27')]){case'admin':return db[_['capitalize'](_0x628483[_0x5615('0x46')][_0x5615('0x99')])+_0x5615('0xd0')]['findAll'](_0x24391f);case _0x5615('0x2e'):case _0x5615('0x28'):return _0x1d183b[_0x5615('0x2b')+_['capitalize'](_0x628483['query']['channel'])+_0x5615('0x9f')](_0x24391f);default:throw new db['Sequelize'][(_0x5615('0x8d'))](_0x5615('0xd3'));}})[_0x5615('0x26')](function(_0xc2feea){_0x5a54c1=_0xc2feea[_0x5615('0x5f')];if(!_0x628483[_0x5615('0x46')][_0x5615('0xc9')](_0x5615('0xd4'))){_0x24391f[_0x5615('0x21')]=qs[_0x5615('0x21')](_0x628483[_0x5615('0x46')][_0x5615('0x21')]);_0x24391f['offset']=qs['offset'](_0x628483[_0x5615('0x46')][_0x5615('0x23')]);}switch(_0x1d183b[_0x5615('0x27')]){case _0x5615('0x2c'):return db[_[_0x5615('0x9e')](_0x628483['query']['channel'])+_0x5615('0xd0')][_0x5615('0x4e')](_0x24391f);case _0x5615('0x2e'):case'agent':return _0x1d183b[_0x5615('0x2b')+_['capitalize'](_0x628483[_0x5615('0x46')][_0x5615('0x99')])+_0x5615('0x9f')](_0x24391f);}})[_0x5615('0x26')](function(_0x3a82a3){return{'count':_0x5a54c1,'rows':_0x3a82a3};})['then'](respondWithResult(_0x200c2f,null))[_0x5615('0x56')](handleError(_0x200c2f,null));};exports[_0x5615('0xd5')]=function(_0x2d709b,_0x3e1a3e){var _0x460435={};var _0x2d2d74={};var _0x2b8fed;var _0x1be6b7;return db[_0x5615('0x3c')]['findOne']({'where':{'id':_0x2d709b[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x3e1a3e,null))[_0x5615('0x26')](function(_0x4eb983){if(_0x4eb983){_0x2b8fed=_0x4eb983;_0x2d2d74[_0x5615('0x59')]=_['keys'](db[_0x5615('0xa9')]['rawAttributes']);_0x2d2d74[_0x5615('0x46')]=_[_0x5615('0x5b')](_0x2d709b[_0x5615('0x46')]);_0x2d2d74[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x2d2d74[_0x5615('0x59')],_0x2d2d74[_0x5615('0x46')]);_0x460435[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0x2d2d74[_0x5615('0x59')],qs[_0x5615('0x5e')](_0x2d709b[_0x5615('0x46')][_0x5615('0x5e')]));_0x460435[_0x5615('0x4c')]=_0x460435[_0x5615('0x4c')]['length']?_0x460435[_0x5615('0x4c')]:_0x2d2d74[_0x5615('0x59')];_0x460435['order']=qs[_0x5615('0xd1')](_0x2d709b['query'][_0x5615('0xd1')]);_0x460435[_0x5615('0x45')]=qs[_0x5615('0x5c')](_['pick'](_0x2d709b[_0x5615('0x46')],_0x2d2d74['filters']));if(_0x2d709b[_0x5615('0x46')][_0x5615('0x32')]){_0x460435[_0x5615('0x45')]=_['merge'](_0x460435['where'],{'$or':_[_0x5615('0x87')](_0x460435[_0x5615('0x4c')],function(_0x3ae682){var _0x411aa7={};_0x411aa7[_0x3ae682]={'$like':'%'+_0x2d709b[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x411aa7;})});}_0x460435=_[_0x5615('0x60')]({},_0x460435,_0x2d709b[_0x5615('0x61')]);return _0x2b8fed[_0x5615('0xd5')](_0x460435);}})[_0x5615('0x26')](function(_0x2fc966){if(_0x2fc966){_0x1be6b7=_0x2fc966[_0x5615('0x5f')];if(!_0x2d709b['query'][_0x5615('0xc9')](_0x5615('0xd4'))){_0x460435[_0x5615('0x21')]=qs[_0x5615('0x21')](_0x2d709b[_0x5615('0x46')][_0x5615('0x21')]);_0x460435[_0x5615('0x23')]=qs['offset'](_0x2d709b[_0x5615('0x46')]['offset']);}return _0x2b8fed[_0x5615('0xd5')](_0x460435);}})['then'](function(_0xfcdad1){if(_0xfcdad1){return _0xfcdad1?{'count':_0x1be6b7,'rows':_0xfcdad1}:null;}})['then'](respondWithResult(_0x3e1a3e,null))[_0x5615('0x56')](handleError(_0x3e1a3e,null));};exports['getGroups']=function(_0x462f4a,_0x147c99){var _0x2debcb={};var _0xfadc24={};var _0x19814b;var _0x561c6d;return db['User'][_0x5615('0x93')]({'where':{'id':_0x462f4a[_0x5615('0x58')]['id']}})['then'](handleEntityNotFound(_0x147c99,null))[_0x5615('0x26')](function(_0x1a9438){if(_0x1a9438){_0x19814b=_0x1a9438;_0xfadc24[_0x5615('0x59')]=_['keys'](db[_0x5615('0xd6')]['rawAttributes']);_0xfadc24[_0x5615('0x46')]=_[_0x5615('0x5b')](_0x462f4a[_0x5615('0x46')]);_0xfadc24[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0xfadc24[_0x5615('0x59')],_0xfadc24['query']);_0x2debcb[_0x5615('0x4c')]=_['intersection'](_0xfadc24['model'],qs[_0x5615('0x5e')](_0x462f4a[_0x5615('0x46')]['fields']));_0x2debcb[_0x5615('0x4c')]=_0x2debcb[_0x5615('0x4c')][_0x5615('0x5f')]?_0x2debcb[_0x5615('0x4c')]:_0xfadc24['model'];_0x2debcb['order']=qs[_0x5615('0xd1')](_0x462f4a['query'][_0x5615('0xd1')]);_0x2debcb[_0x5615('0x45')]=qs[_0x5615('0x5c')](_[_0x5615('0xd2')](_0x462f4a[_0x5615('0x46')],_0xfadc24[_0x5615('0x5c')]));if(_0x462f4a[_0x5615('0x46')][_0x5615('0x32')]){_0x2debcb[_0x5615('0x45')]=_[_0x5615('0x60')](_0x2debcb[_0x5615('0x45')],{'$or':_['map'](_0x2debcb[_0x5615('0x4c')],function(_0xdfc882){var _0x45d357={};_0x45d357[_0xdfc882]={'$like':'%'+_0x462f4a['query'][_0x5615('0x32')]+'%'};return _0x45d357;})});}_0x2debcb=_['merge']({},_0x2debcb,_0x462f4a[_0x5615('0x61')]);return _0x19814b['getGroups'](_0x2debcb);}})[_0x5615('0x26')](function(_0x427d05){if(_0x427d05){_0x561c6d=_0x427d05[_0x5615('0x5f')];if(!_0x462f4a[_0x5615('0x46')][_0x5615('0xc9')](_0x5615('0xd4'))){_0x2debcb['limit']=qs['limit'](_0x462f4a['query'][_0x5615('0x21')]);_0x2debcb['offset']=qs['offset'](_0x462f4a['query'][_0x5615('0x23')]);}return _0x19814b['getGroups'](_0x2debcb);}})[_0x5615('0x26')](function(_0x403efc){if(_0x403efc){return _0x403efc?{'count':_0x561c6d,'rows':_0x403efc}:null;}})['then'](respondWithResult(_0x147c99,null))[_0x5615('0x56')](handleError(_0x147c99,null));};exports['getRecordings']=function(_0x40159b,_0x37c852){var _0x349525={'raw':!![],'where':{}};var _0xce8584={};var _0x2d988e={'count':0x0,'rows':[]};return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x40159b['params']['id']}})['then'](handleEntityNotFound(_0x37c852,null))['then'](function(_0x3fc8ef){if(_0x3fc8ef){_0xce8584[_0x5615('0x59')]=_[_0x5615('0x5b')](db[_0x5615('0xd7')][_0x5615('0x3d')]);_0xce8584[_0x5615('0x46')]=_['keys'](_0x40159b[_0x5615('0x46')]);_0xce8584[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0xce8584['model'],_0xce8584['query']);_0x349525[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0xce8584[_0x5615('0x59')],qs[_0x5615('0x5e')](_0x40159b[_0x5615('0x46')][_0x5615('0x5e')]));_0x349525[_0x5615('0x4c')]=_0x349525[_0x5615('0x4c')][_0x5615('0x5f')]?_0x349525[_0x5615('0x4c')]:_0xce8584['model'];if(!_0x40159b[_0x5615('0x46')][_0x5615('0xc9')](_0x5615('0xd4'))){_0x349525[_0x5615('0x21')]=qs[_0x5615('0x21')](_0x40159b[_0x5615('0x46')][_0x5615('0x21')]);_0x349525[_0x5615('0x23')]=qs[_0x5615('0x23')](_0x40159b['query'][_0x5615('0x23')]);}_0x349525[_0x5615('0xd8')]=qs[_0x5615('0xd1')](_0x40159b[_0x5615('0x46')][_0x5615('0xd1')]);_0x349525[_0x5615('0x45')]=qs[_0x5615('0x5c')](_['pick'](_0x40159b[_0x5615('0x46')],_0xce8584[_0x5615('0x5c')]));_0x349525[_0x5615('0x45')][_0x5615('0xd9')]=_0x3fc8ef['id'];if(_0x40159b[_0x5615('0x46')][_0x5615('0x32')]){_0x349525[_0x5615('0x45')]=_['merge'](_0x349525[_0x5615('0x45')],{'$or':_[_0x5615('0x87')](_0x349525[_0x5615('0x4c')],function(_0x427ba1){var _0xce81e4={};_0xce81e4[_0x427ba1]={'$like':'%'+_0x40159b[_0x5615('0x46')]['filter']+'%'};return _0xce81e4;})});}_0x349525=_[_0x5615('0x60')]({},_0x349525,_0x40159b[_0x5615('0x61')]);return db[_0x5615('0xd7')][_0x5615('0x22')]({'where':_0x349525[_0x5615('0x45')]})[_0x5615('0x26')](function(_0x337986){_0x2d988e[_0x5615('0x22')]=_0x337986;if(_0x40159b[_0x5615('0x46')][_0x5615('0x47')]){_0x349525[_0x5615('0x4a')]=[{'all':!![]}];}return db[_0x5615('0xd7')]['findAll'](_0x349525);})[_0x5615('0x26')](function(_0x5ad53c){_0x2d988e[_0x5615('0x4f')]=_0x5ad53c;return _0x2d988e;});}})[_0x5615('0x26')](respondWithFilteredResult(_0x37c852,_0x349525))['catch'](handleError(_0x37c852,null));};exports[_0x5615('0xda')]=function(_0x222781,_0x2739fe){var _0x476cef={'raw':!![],'where':{}};var _0x44f28b={};var _0x2778c6={'count':0x0,'rows':[]};return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x222781['params']['id']}})['then'](handleEntityNotFound(_0x2739fe,null))[_0x5615('0x26')](function(_0x4d4634){if(_0x4d4634){_0x44f28b['model']=_[_0x5615('0x5b')](db['ScreenRecording'][_0x5615('0x3d')]);_0x44f28b[_0x5615('0x46')]=_['keys'](_0x222781[_0x5615('0x46')]);_0x44f28b[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x44f28b[_0x5615('0x59')],_0x44f28b['query']);_0x476cef[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0x44f28b[_0x5615('0x59')],qs[_0x5615('0x5e')](_0x222781[_0x5615('0x46')][_0x5615('0x5e')]));_0x476cef['attributes']=_0x476cef[_0x5615('0x4c')][_0x5615('0x5f')]?_0x476cef[_0x5615('0x4c')]:_0x44f28b['model'];if(!_0x222781[_0x5615('0x46')][_0x5615('0xc9')](_0x5615('0xd4'))){_0x476cef[_0x5615('0x21')]=qs['limit'](_0x222781[_0x5615('0x46')]['limit']);_0x476cef['offset']=qs['offset'](_0x222781[_0x5615('0x46')][_0x5615('0x23')]);}_0x476cef[_0x5615('0xd8')]=qs[_0x5615('0xd1')](_0x222781['query'][_0x5615('0xd1')]);_0x476cef[_0x5615('0x45')]=qs[_0x5615('0x5c')](_[_0x5615('0xd2')](_0x222781['query'],_0x44f28b[_0x5615('0x5c')]));_0x476cef[_0x5615('0x45')][_0x5615('0xd9')]=_0x4d4634['id'];if(_0x222781['query'][_0x5615('0x32')]){_0x476cef[_0x5615('0x45')]=_[_0x5615('0x60')](_0x476cef[_0x5615('0x45')],{'$or':_[_0x5615('0x87')](_0x476cef[_0x5615('0x4c')],function(_0xc80b3f){var _0x303bf9={};_0x303bf9[_0xc80b3f]={'$like':'%'+_0x222781[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x303bf9;})});}_0x476cef=_[_0x5615('0x60')]({},_0x476cef,_0x222781[_0x5615('0x61')]);return db['ScreenRecording'][_0x5615('0x22')]({'where':_0x476cef[_0x5615('0x45')]})[_0x5615('0x26')](function(_0x7eb804){_0x2778c6[_0x5615('0x22')]=_0x7eb804;if(_0x222781[_0x5615('0x46')][_0x5615('0x47')]){_0x476cef[_0x5615('0x4a')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5615('0x4e')](_0x476cef);})[_0x5615('0x26')](function(_0x513ef6){_0x2778c6[_0x5615('0x4f')]=_0x513ef6;return _0x2778c6;});}})[_0x5615('0x26')](respondWithFilteredResult(_0x2739fe,_0x476cef))[_0x5615('0x56')](handleError(_0x2739fe,null));};exports[_0x5615('0xdb')]=function(_0x480383,_0x4ce0d0){var _0xbdec3={};var _0x5c3f19={};var _0x1920b5;var _0x8beffc;return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x480383[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x4ce0d0,null))[_0x5615('0x26')](function(_0x561990){if(_0x561990){_0x1920b5=_0x561990;_0x5c3f19['model']=_[_0x5615('0x5b')](db[_0x5615('0xdc')][_0x5615('0x3d')]);_0x5c3f19['query']=_[_0x5615('0x5b')](_0x480383[_0x5615('0x46')]);_0x5c3f19['filters']=_['intersection'](_0x5c3f19[_0x5615('0x59')],_0x5c3f19[_0x5615('0x46')]);_0xbdec3[_0x5615('0x4c')]=_['intersection'](_0x5c3f19[_0x5615('0x59')],qs[_0x5615('0x5e')](_0x480383[_0x5615('0x46')]['fields']));_0xbdec3[_0x5615('0x4c')]=_0xbdec3[_0x5615('0x4c')][_0x5615('0x5f')]?_0xbdec3[_0x5615('0x4c')]:_0x5c3f19[_0x5615('0x59')];_0xbdec3[_0x5615('0xd8')]=qs['sort'](_0x480383[_0x5615('0x46')]['sort']);_0xbdec3['where']=qs['filters'](_[_0x5615('0xd2')](_0x480383['query'],_0x5c3f19[_0x5615('0x5c')]));if(_0x480383[_0x5615('0x46')]['filter']){_0xbdec3['where']=_[_0x5615('0x60')](_0xbdec3['where'],{'$or':_[_0x5615('0x87')](_0xbdec3['attributes'],function(_0x5615ba){var _0x429e1c={};_0x429e1c[_0x5615ba]={'$like':'%'+_0x480383[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x429e1c;})});}_0xbdec3=_[_0x5615('0x60')]({},_0xbdec3,_0x480383['options']);return _0x1920b5[_0x5615('0xdb')](_0xbdec3);}})[_0x5615('0x26')](function(_0x574599){if(_0x574599){_0x8beffc=_0x574599[_0x5615('0x5f')];if(!_0x480383[_0x5615('0x46')]['hasOwnProperty'](_0x5615('0xd4'))){_0xbdec3['limit']=qs[_0x5615('0x21')](_0x480383[_0x5615('0x46')][_0x5615('0x21')]);_0xbdec3[_0x5615('0x23')]=qs[_0x5615('0x23')](_0x480383[_0x5615('0x46')][_0x5615('0x23')]);}return _0x1920b5[_0x5615('0xdb')](_0xbdec3);}})[_0x5615('0x26')](function(_0x345af0){if(_0x345af0){return _0x345af0?{'count':_0x8beffc,'rows':_0x345af0}:null;}})[_0x5615('0x26')](respondWithResult(_0x4ce0d0,null))[_0x5615('0x56')](handleError(_0x4ce0d0,null));};exports[_0x5615('0xdd')]=function(_0x483c82,_0x495579){var _0x43a2f6={};var _0x597270={};var _0x5b31c3;var _0x17c6a6;return db['User'][_0x5615('0x93')]({'where':{'id':_0x483c82[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x495579,null))[_0x5615('0x26')](function(_0x1f10be){if(_0x1f10be){_0x5b31c3=_0x1f10be;_0x597270[_0x5615('0x59')]=_[_0x5615('0x5b')](db[_0x5615('0xde')]['rawAttributes']);_0x597270[_0x5615('0x46')]=_['keys'](_0x483c82[_0x5615('0x46')]);_0x597270[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x597270[_0x5615('0x59')],_0x597270['query']);_0x43a2f6['attributes']=_[_0x5615('0x5d')](_0x597270[_0x5615('0x59')],qs[_0x5615('0x5e')](_0x483c82[_0x5615('0x46')][_0x5615('0x5e')]));_0x43a2f6['attributes']=_0x43a2f6['attributes'][_0x5615('0x5f')]?_0x43a2f6[_0x5615('0x4c')]:_0x597270[_0x5615('0x59')];_0x43a2f6[_0x5615('0xd8')]=qs[_0x5615('0xd1')](_0x483c82[_0x5615('0x46')]['sort']);_0x43a2f6[_0x5615('0x45')]=qs['filters'](_[_0x5615('0xd2')](_0x483c82['query'],_0x597270['filters']));if(_0x483c82[_0x5615('0x46')][_0x5615('0x32')]){_0x43a2f6['where']=_[_0x5615('0x60')](_0x43a2f6[_0x5615('0x45')],{'$or':_[_0x5615('0x87')](_0x43a2f6[_0x5615('0x4c')],function(_0x2ddb08){var _0xb04dc1={};_0xb04dc1[_0x2ddb08]={'$like':'%'+_0x483c82['query']['filter']+'%'};return _0xb04dc1;})});}_0x43a2f6=_['merge']({},_0x43a2f6,_0x483c82[_0x5615('0x61')]);return _0x5b31c3[_0x5615('0xdd')](_0x43a2f6);}})[_0x5615('0x26')](function(_0x48c8dc){if(_0x48c8dc){_0x17c6a6=_0x48c8dc[_0x5615('0x5f')];if(!_0x483c82['query']['hasOwnProperty'](_0x5615('0xd4'))){_0x43a2f6[_0x5615('0x21')]=qs[_0x5615('0x21')](_0x483c82[_0x5615('0x46')][_0x5615('0x21')]);_0x43a2f6[_0x5615('0x23')]=qs[_0x5615('0x23')](_0x483c82[_0x5615('0x46')][_0x5615('0x23')]);}return _0x5b31c3[_0x5615('0xdd')](_0x43a2f6);}})[_0x5615('0x26')](function(_0x3c3f7b){if(_0x3c3f7b){return _0x3c3f7b?{'count':_0x17c6a6,'rows':_0x3c3f7b}:null;}})[_0x5615('0x26')](respondWithResult(_0x495579,null))[_0x5615('0x56')](handleError(_0x495579,null));};exports['getMailInteractions']=function(_0x432890,_0x435dcc){var _0x4e9558={'raw':!![],'where':{}};var _0x226b88={};var _0x2b473c={'count':0x0,'rows':[]};return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x432890[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x435dcc,null))[_0x5615('0x26')](function(_0x47725a){if(_0x47725a){_0x226b88[_0x5615('0x59')]=_[_0x5615('0x5b')](db['MailInteraction'][_0x5615('0x3d')]);_0x226b88[_0x5615('0x46')]=_[_0x5615('0x5b')](_0x432890[_0x5615('0x46')]);_0x226b88[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x226b88[_0x5615('0x59')],_0x226b88[_0x5615('0x46')]);_0x4e9558[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0x226b88[_0x5615('0x59')],qs['fields'](_0x432890['query']['fields']));_0x4e9558['attributes']=_0x4e9558[_0x5615('0x4c')][_0x5615('0x5f')]?_0x4e9558['attributes']:_0x226b88[_0x5615('0x59')];if(!_0x432890[_0x5615('0x46')][_0x5615('0xc9')]('nolimit')){_0x4e9558[_0x5615('0x21')]=qs[_0x5615('0x21')](_0x432890[_0x5615('0x46')][_0x5615('0x21')]);_0x4e9558[_0x5615('0x23')]=qs[_0x5615('0x23')](_0x432890['query'][_0x5615('0x23')]);}_0x4e9558[_0x5615('0xd8')]=qs[_0x5615('0xd1')](_0x432890[_0x5615('0x46')][_0x5615('0xd1')]);_0x4e9558['where']=qs[_0x5615('0x5c')](_[_0x5615('0xd2')](_0x432890['query'],_0x226b88['filters']));_0x4e9558[_0x5615('0x45')][_0x5615('0xd9')]=_0x47725a['id'];if(_0x432890['query']['filter']){_0x4e9558[_0x5615('0x45')]=_['merge'](_0x4e9558[_0x5615('0x45')],{'$or':_[_0x5615('0x87')](_0x4e9558[_0x5615('0x4c')],function(_0x3f904c){var _0x3f479={};_0x3f479[_0x3f904c]={'$like':'%'+_0x432890[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x3f479;})});}_0x4e9558=_[_0x5615('0x60')]({},_0x4e9558,_0x432890['options']);return db[_0x5615('0xdf')]['count']({'where':_0x4e9558[_0x5615('0x45')]})['then'](function(_0x4b1350){_0x2b473c[_0x5615('0x22')]=_0x4b1350;if(_0x432890[_0x5615('0x46')][_0x5615('0x47')]){_0x4e9558[_0x5615('0x4a')]=[{'all':!![]}];}return db[_0x5615('0xdf')]['findAll'](_0x4e9558);})['then'](function(_0x14a7ca){_0x2b473c['rows']=_0x14a7ca;return _0x2b473c;});}})['then'](respondWithFilteredResult(_0x435dcc,_0x4e9558))[_0x5615('0x56')](handleError(_0x435dcc,null));};exports[_0x5615('0xe0')]=function(_0xd4618e,_0x4ec343){var _0xf10952={};var _0x3954c4={};var _0x34b351;var _0x41500d;return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0xd4618e['params']['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x4ec343,null))['then'](function(_0x34cc73){if(_0x34cc73){_0x34b351=_0x34cc73;_0x3954c4[_0x5615('0x59')]=_['keys'](db[_0x5615('0xe1')][_0x5615('0x3d')]);_0x3954c4[_0x5615('0x46')]=_['keys'](_0xd4618e[_0x5615('0x46')]);_0x3954c4[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x3954c4['model'],_0x3954c4[_0x5615('0x46')]);_0xf10952[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0x3954c4[_0x5615('0x59')],qs[_0x5615('0x5e')](_0xd4618e[_0x5615('0x46')][_0x5615('0x5e')]));_0xf10952['attributes']=_0xf10952[_0x5615('0x4c')]['length']?_0xf10952['attributes']:_0x3954c4[_0x5615('0x59')];_0xf10952['order']=qs['sort'](_0xd4618e[_0x5615('0x46')][_0x5615('0xd1')]);_0xf10952[_0x5615('0x45')]=qs['filters'](_[_0x5615('0xd2')](_0xd4618e[_0x5615('0x46')],_0x3954c4[_0x5615('0x5c')]));if(_0xd4618e['query'][_0x5615('0x32')]){_0xf10952[_0x5615('0x45')]=_[_0x5615('0x60')](_0xf10952[_0x5615('0x45')],{'$or':_[_0x5615('0x87')](_0xf10952[_0x5615('0x4c')],function(_0xa298db){var _0x5e0f21={};_0x5e0f21[_0xa298db]={'$like':'%'+_0xd4618e[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x5e0f21;})});}_0xf10952=_[_0x5615('0x60')]({},_0xf10952,_0xd4618e[_0x5615('0x61')]);return _0x34b351[_0x5615('0xe0')](_0xf10952);}})[_0x5615('0x26')](function(_0xbe3b9a){if(_0xbe3b9a){_0x41500d=_0xbe3b9a['length'];if(!_0xd4618e[_0x5615('0x46')][_0x5615('0xc9')](_0x5615('0xd4'))){_0xf10952['limit']=qs[_0x5615('0x21')](_0xd4618e[_0x5615('0x46')][_0x5615('0x21')]);_0xf10952[_0x5615('0x23')]=qs['offset'](_0xd4618e[_0x5615('0x46')][_0x5615('0x23')]);}return _0x34b351[_0x5615('0xe0')](_0xf10952);}})[_0x5615('0x26')](function(_0x2f622d){if(_0x2f622d){return _0x2f622d?{'count':_0x41500d,'rows':_0x2f622d}:null;}})['then'](respondWithResult(_0x4ec343,null))['catch'](handleError(_0x4ec343,null));};exports[_0x5615('0xe2')]=function(_0x22e003,_0x518654){var _0x62fd00={};var _0x2ab899={};var _0x1a8030;var _0x27c368;return db[_0x5615('0x3c')]['findOne']({'where':{'id':_0x22e003[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x518654,null))['then'](function(_0x4e194f){if(_0x4e194f){_0x1a8030=_0x4e194f;_0x2ab899[_0x5615('0x59')]=_[_0x5615('0x5b')](db['FaxInteraction'][_0x5615('0x3d')]);_0x2ab899[_0x5615('0x46')]=_[_0x5615('0x5b')](_0x22e003[_0x5615('0x46')]);_0x2ab899[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x2ab899[_0x5615('0x59')],_0x2ab899[_0x5615('0x46')]);_0x62fd00[_0x5615('0x4c')]=_['intersection'](_0x2ab899['model'],qs[_0x5615('0x5e')](_0x22e003['query'][_0x5615('0x5e')]));_0x62fd00['attributes']=_0x62fd00[_0x5615('0x4c')][_0x5615('0x5f')]?_0x62fd00[_0x5615('0x4c')]:_0x2ab899[_0x5615('0x59')];_0x62fd00[_0x5615('0xd8')]=qs['sort'](_0x22e003[_0x5615('0x46')][_0x5615('0xd1')]);_0x62fd00[_0x5615('0x45')]=qs[_0x5615('0x5c')](_['pick'](_0x22e003[_0x5615('0x46')],_0x2ab899[_0x5615('0x5c')]));if(_0x22e003[_0x5615('0x46')]['filter']){_0x62fd00['where']=_[_0x5615('0x60')](_0x62fd00[_0x5615('0x45')],{'$or':_[_0x5615('0x87')](_0x62fd00['attributes'],function(_0x53400e){var _0x59a734={};_0x59a734[_0x53400e]={'$like':'%'+_0x22e003[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x59a734;})});}_0x62fd00=_[_0x5615('0x60')]({},_0x62fd00,_0x22e003[_0x5615('0x61')]);return _0x1a8030[_0x5615('0xe2')](_0x62fd00);}})[_0x5615('0x26')](function(_0x3104c5){if(_0x3104c5){_0x27c368=_0x3104c5[_0x5615('0x5f')];if(!_0x22e003['query'][_0x5615('0xc9')](_0x5615('0xd4'))){_0x62fd00[_0x5615('0x21')]=qs['limit'](_0x22e003[_0x5615('0x46')][_0x5615('0x21')]);_0x62fd00['offset']=qs[_0x5615('0x23')](_0x22e003['query'][_0x5615('0x23')]);}return _0x1a8030[_0x5615('0xe2')](_0x62fd00);}})[_0x5615('0x26')](function(_0x50aad5){if(_0x50aad5){return _0x50aad5?{'count':_0x27c368,'rows':_0x50aad5}:null;}})[_0x5615('0x26')](respondWithResult(_0x518654,null))[_0x5615('0x56')](handleError(_0x518654,null));};exports[_0x5615('0xe3')]=function(_0x19a733,_0x249574){var _0x426b70={};var _0x58ea09={};var _0x549442;var _0x1d3298;return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x19a733[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x249574,null))[_0x5615('0x26')](function(_0x4c61da){if(_0x4c61da){_0x549442=_0x4c61da;_0x58ea09['model']=_['keys'](db[_0x5615('0xe4')][_0x5615('0x3d')]);_0x58ea09['query']=_['keys'](_0x19a733[_0x5615('0x46')]);_0x58ea09['filters']=_['intersection'](_0x58ea09[_0x5615('0x59')],_0x58ea09[_0x5615('0x46')]);_0x426b70[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0x58ea09[_0x5615('0x59')],qs['fields'](_0x19a733[_0x5615('0x46')][_0x5615('0x5e')]));_0x426b70['attributes']=_0x426b70[_0x5615('0x4c')][_0x5615('0x5f')]?_0x426b70[_0x5615('0x4c')]:_0x58ea09[_0x5615('0x59')];_0x426b70[_0x5615('0xd8')]=qs[_0x5615('0xd1')](_0x19a733['query'][_0x5615('0xd1')]);_0x426b70[_0x5615('0x45')]=qs[_0x5615('0x5c')](_[_0x5615('0xd2')](_0x19a733['query'],_0x58ea09['filters']));if(_0x19a733[_0x5615('0x46')]['filter']){_0x426b70[_0x5615('0x45')]=_[_0x5615('0x60')](_0x426b70[_0x5615('0x45')],{'$or':_[_0x5615('0x87')](_0x426b70[_0x5615('0x4c')],function(_0x16def9){var _0x434d82={};_0x434d82[_0x16def9]={'$like':'%'+_0x19a733[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x434d82;})});}_0x426b70=_[_0x5615('0x60')]({},_0x426b70,_0x19a733[_0x5615('0x61')]);return _0x549442[_0x5615('0xe3')](_0x426b70);}})[_0x5615('0x26')](function(_0x4ade72){if(_0x4ade72){_0x1d3298=_0x4ade72[_0x5615('0x5f')];if(!_0x19a733[_0x5615('0x46')][_0x5615('0xc9')](_0x5615('0xd4'))){_0x426b70[_0x5615('0x21')]=qs['limit'](_0x19a733[_0x5615('0x46')][_0x5615('0x21')]);_0x426b70[_0x5615('0x23')]=qs['offset'](_0x19a733[_0x5615('0x46')][_0x5615('0x23')]);}return _0x549442[_0x5615('0xe3')](_0x426b70);}})[_0x5615('0x26')](function(_0x2fdbc1){if(_0x2fdbc1){return _0x2fdbc1?{'count':_0x1d3298,'rows':_0x2fdbc1}:null;}})[_0x5615('0x26')](respondWithResult(_0x249574,null))[_0x5615('0x56')](handleError(_0x249574,null));};exports['login']=function(_0xf28c94,_0x13ca9a,_0x33e694){var _0x50e4c6;var _0x529038;var _0x33487a;var _0x4679cd=!_[_0x5615('0x6c')](_0xf28c94[_0x5615('0x58')]['id'])?_0xf28c94[_0x5615('0x58')]['id']:!_[_0x5615('0x6c')](_0xf28c94['user']['id'])?_0xf28c94['user']['id']:null;return db[_0x5615('0x3c')]['find']({'where':{'id':_0x4679cd,'role':{'$or':[_0x5615('0x2c'),'user',_0x5615('0x28')]}},'attributes':['id',_0x5615('0x39'),_0x5615('0xe5'),'mobile',_0x5615('0x27'),'internal','loginInPause']})[_0x5615('0x26')](function(_0x277a9b){if(_0x277a9b){if(_0x277a9b[_0x5615('0x27')]===_0x5615('0x28')){_0x50e4c6=_0x277a9b;if(_0xf28c94['body'][_0x5615('0xe6')]){_0x33487a=util[_0x5615('0xa6')](_0x5615('0xe7'),_0x50e4c6[_0xf28c94[_0x5615('0x63')][_0x5615('0xe6')]]);}else if(_0xf28c94[_0x5615('0x63')][_0x5615('0xe8')]){_0x33487a=util[_0x5615('0xa6')]('SIP/%s',_0xf28c94[_0x5615('0x63')][_0x5615('0xe8')]);}else{_0x33487a=util[_0x5615('0xa6')]('SIP/%s',_0x50e4c6[_0x5615('0x39')]);}socket['to'](util[_0x5615('0xa6')](_0x5615('0xe9'),_0x50e4c6[_0x5615('0x39')]))[_0x5615('0x29')](_0x5615('0xea'),{'user':{'id':_0x50e4c6['id'],'name':_0x50e4c6[_0x5615('0x39')]},'ip':_0xf28c94[_0x5615('0xeb')][_0x5615('0xec')]||_0xf28c94['connection'][_0x5615('0xed')]||_0xf28c94['socket'][_0x5615('0xed')]||_0xf28c94[_0x5615('0xee')][_0x5615('0xef')][_0x5615('0xed')]});return db[_0x5615('0xa9')]['destroy']({'where':{'membername':_0x50e4c6['name']},'individualHooks':!![]});}}else{throw new db[(_0x5615('0x8c'))][(_0x5615('0x8d'))](_0x5615('0xf0'));}})[_0x5615('0x26')](function(){if(_0x50e4c6){return _0x50e4c6[_0x5615('0xf1')]({'raw':!![]});}})[_0x5615('0x26')](function(_0x3572e8){if(_0x50e4c6){if(_0x3572e8){_0x529038=_0x3572e8;if(_0x529038[_0x5615('0x5f')]){var _0x227a6a=_0x529038[_0x5615('0x87')](function(_0x26196a){var _0x108a4f={'membername':_0x50e4c6[_0x5615('0x39')],'UserId':_0x50e4c6['id'],'queue_name':_0x26196a[_0x5615('0x39')],'VoiceQueueId':_0x26196a['id'],'interface':_0x33487a,'paused':_0x50e4c6['loginInPause']||![],'penalty':_0x26196a['UserVoiceQueue.penalty']||0x0};return db[_0x5615('0xa9')][_0x5615('0xaa')](_0x108a4f);});return Promise[_0x5615('0x55')](_0x227a6a);}}}})[_0x5615('0x26')](function(){if(_0x50e4c6){return db['MemberReport'][_0x5615('0x4e')]({'where':{'membername':_0x50e4c6['name'],'exitAt':null}});}})['then'](function(_0x3335fd){if(_0x50e4c6){var _0x5184d4=[];_0x3335fd[_0x5615('0xf2')](function(_0x4f97b4){_0x5184d4[_0x5615('0x4d')](_0x4f97b4[_0x5615('0x25')]({'exitAt':moment()[_0x5615('0xa6')](_0x5615('0xf3'))}));});return Promise['all'](_0x5184d4);}})['then'](function(){if(_0x50e4c6){var _0x3522cf=[];var _0x59c273=[];var _0x565659=utils['getChannels']();var _0x423573={'membername':_0x50e4c6['name'],'interface':_0x33487a,'enterAt':moment()[_0x5615('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x50e4c6[_0x5615('0x27')],'internal':_0x50e4c6[_0x5615('0x6b')]};_0x565659[_0x5615('0xf2')](function(_0xfa8099){_0x3522cf[_0x5615('0x4d')](_[_0x5615('0x60')]({'channel':_0xfa8099,'type':_0x5615('0xf4'),'data1':_0xf28c94[_0x5615('0x63')][_0x5615('0xf5')],'data2':_0x33487a},_0x423573));if(_0x50e4c6[_0x5615('0x9b')]){_0x59c273[_0x5615('0x4d')](_[_0x5615('0x60')]({'channel':_0xfa8099,'type':'PAUSE','data1':_0x5615('0xf6')},_0x423573));}});return db['MemberReport']['bulkCreate'](_0x3522cf[_0x5615('0xf7')](_0x59c273),{'individualHooks':!![]});}})[_0x5615('0x26')](function(){if(_0x50e4c6){return _0x50e4c6[_0x5615('0x25')]({'online':!![],'lastLoginAt':moment()[_0x5615('0xa6')](_0x5615('0xf3')),'voicePause':_0x50e4c6[_0x5615('0x9b')]||![],'mailPause':_0x50e4c6[_0x5615('0x9b')]||![],'chatPause':_0x50e4c6['loginInPause']||![],'faxPause':_0x50e4c6[_0x5615('0x9b')]||![],'smsPause':_0x50e4c6[_0x5615('0x9b')]||![],'openchannelPause':_0x50e4c6[_0x5615('0x9b')]||![],'whatsappPause':_0x50e4c6[_0x5615('0x9b')]||![],'pauseType':_0x50e4c6['loginInPause']?'LOGININPAUSE':null,'interface':_0x33487a,'lastPauseAt':moment()[_0x5615('0xa6')](_0x5615('0xf3'))});}})[_0x5615('0x26')](function(_0x14e1fa){if(_0xf28c94[_0x5615('0xf8')]){return _0x33e694();}else{return Promise[_0x5615('0xf9')](_0x14e1fa)['then'](respondWithResult(_0x13ca9a,null));}})[_0x5615('0x56')](handleError(_0x13ca9a,null));};exports['logout']=function(_0x125016,_0x25d2e7){var _0x20a9e0;return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x125016[_0x5615('0x58')]['id'],'role':_0x5615('0x28')},'attributes':['id',_0x5615('0x39'),_0x5615('0x27')]})[_0x5615('0x26')](handleEntityNotFound(_0x25d2e7,null))['then'](function(_0x61967c){if(_0x61967c){_0x20a9e0=_0x61967c;return db[_0x5615('0xa9')]['destroy']({'where':{'membername':_0x20a9e0[_0x5615('0x39')]},'individualHooks':!![]});}})[_0x5615('0x26')](function(){return db['MemberReport'][_0x5615('0x4e')]({'where':{'membername':_0x20a9e0[_0x5615('0x39')],'exitAt':null}});})[_0x5615('0x26')](function(_0x582306){var _0x201566=[];_0x582306['forEach'](function(_0x535a2a){_0x201566[_0x5615('0x4d')](_0x535a2a['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x5615('0x55')](_0x201566);})[_0x5615('0x26')](function(){return _0x20a9e0['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x25d2e7,null))['catch'](handleError(_0x25d2e7,null));};exports[_0x5615('0xfa')]=function(_0x40b4c1,_0x2c7929){var _0x21b501;return db[_0x5615('0xa9')]['update']({'paused':0x1},{'where':{'UserId':_0x40b4c1[_0x5615('0x58')]['id']},'individualHooks':!![]})[_0x5615('0x26')](function(){return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x40b4c1[_0x5615('0x58')]['id'],'role':_0x5615('0x28')},'attributes':['id',_0x5615('0x39'),_0x5615('0x27'),_0x5615('0x6b'),_0x5615('0xe6'),'online']});})[_0x5615('0x26')](handleEntityNotFound(_0x2c7929,null))[_0x5615('0x26')](function(_0x3b8714){if(_0x3b8714){_0x21b501=_0x3b8714;return respondWithRpcPromise(_0x5615('0xfb'),_0x5615('0xfa'),{'id':_0x21b501['id'],'name':_0x21b501['name'],'pause':!![]});}})[_0x5615('0x26')](function(){if(_0x21b501){return db[_0x5615('0xfc')]['findAll']({'where':{'membername':_0x21b501[_0x5615('0x39')],'type':_0x5615('0xfd'),'exitAt':null}});}})['then'](function(_0x5ca5af){if(_0x5ca5af[_0x5615('0x5f')]){var _0x45355d=moment()[_0x5615('0xa6')](_0x5615('0xf3'));for(var _0x3b93fd=0x0,_0x4dd9cc=_0x5ca5af[_0x5615('0x5f')];_0x3b93fd<_0x4dd9cc;_0x3b93fd++){_0x5ca5af[_0x3b93fd][_0x5615('0xfe')]({'exitAt':_0x45355d});}}})[_0x5615('0x26')](function(){var _0x2aaf80=[];var _0x4cc95d=utils[_0x5615('0xff')]();_0x4cc95d['forEach'](function(_0x2e6b28){_0x2aaf80[_0x5615('0x4d')]({'channel':_0x2e6b28,'membername':_0x21b501[_0x5615('0x39')],'interface':_[_0x5615('0x6c')](_0x21b501['interface'])?util[_0x5615('0xa6')]('SIP/%s',_0x21b501[_0x5615('0x39')]):_0x21b501['interface'],'type':_0x5615('0xfd'),'enterAt':moment()[_0x5615('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x40b4c1[_0x5615('0x63')][_0x5615('0x3f')]||'DEFAULT\x20PAUSE','role':_0x21b501[_0x5615('0x27')],'internal':_0x21b501[_0x5615('0x6b')]});});return db[_0x5615('0xfc')][_0x5615('0x100')](_0x2aaf80,{'individualHooks':!![]});})[_0x5615('0x26')](function(){return _0x21b501[_0x5615('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x40b4c1[_0x5615('0x63')][_0x5615('0x3f')]||_0x5615('0x101'),'lastPauseAt':moment()[_0x5615('0xa6')](_0x5615('0xf3'))});})[_0x5615('0x26')](respondWithResult(_0x2c7929,null))[_0x5615('0x56')](handleError(_0x2c7929,null));};exports[_0x5615('0x102')]=function(_0x1a40aa,_0x3548a7){if(_0x1a40aa[_0x5615('0x63')]['channel']&&!utils['isValidChannel'](_0x1a40aa[_0x5615('0x63')][_0x5615('0x99')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1a40aa[_0x5615('0x63')][_0x5615('0x99')]));}return db[_0x5615('0x3c')][_0x5615('0x35')]({'where':{'id':_0x1a40aa[_0x5615('0x58')]['id']},'attributes':['id',_0x5615('0x39'),_0x5615('0x27'),_0x5615('0x6b'),_0x5615('0xe6'),_0x5615('0x9a'),_0x5615('0x9c'),_0x5615('0x103'),_0x5615('0x104'),_0x5615('0x105'),_0x5615('0x106'),_0x5615('0x107'),_0x5615('0x108'),_0x5615('0x109'),_0x5615('0x10a')]})[_0x5615('0x26')](function(_0x427365){if(!_0x427365){throw new APINotFoundError(util[_0x5615('0xa6')](_0x5615('0xc8'),_0x1a40aa[_0x5615('0x58')]['id']));}return _0x427365[_0x5615('0x102')](_0x1a40aa['body']['channel']);})[_0x5615('0x26')](respondWithResult(_0x3548a7,null))[_0x5615('0x56')](APIHandleError(_0x3548a7));};exports[_0x5615('0x10b')]=function(_0x5efc7d,_0x465e05){var _0x2f90df={};var _0x354d1e={};var _0xc92af9;var _0x47bf9c;return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x5efc7d[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x465e05,null))[_0x5615('0x26')](function(_0xa0f051){if(_0xa0f051){_0xc92af9=_0xa0f051;_0x354d1e['model']=_[_0x5615('0x5b')](db['Team'][_0x5615('0x3d')]);_0x354d1e[_0x5615('0x46')]=_[_0x5615('0x5b')](_0x5efc7d[_0x5615('0x46')]);_0x354d1e[_0x5615('0x5c')]=_[_0x5615('0x5d')](_0x354d1e['model'],_0x354d1e['query']);_0x2f90df[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0x354d1e[_0x5615('0x59')],qs['fields'](_0x5efc7d[_0x5615('0x46')][_0x5615('0x5e')]));_0x2f90df[_0x5615('0x4c')]=_0x2f90df[_0x5615('0x4c')][_0x5615('0x5f')]?_0x2f90df[_0x5615('0x4c')]:_0x354d1e[_0x5615('0x59')];_0x2f90df[_0x5615('0xd8')]=qs[_0x5615('0xd1')](_0x5efc7d[_0x5615('0x46')]['sort']);_0x2f90df[_0x5615('0x45')]=qs[_0x5615('0x5c')](_[_0x5615('0xd2')](_0x5efc7d['query'],_0x354d1e[_0x5615('0x5c')]));if(_0x5efc7d[_0x5615('0x46')][_0x5615('0x32')]){_0x2f90df[_0x5615('0x45')]=_[_0x5615('0x60')](_0x2f90df[_0x5615('0x45')],{'$or':_[_0x5615('0x87')](_0x2f90df['attributes'],function(_0x43f179){var _0x526efb={};_0x526efb[_0x43f179]={'$like':'%'+_0x5efc7d[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x526efb;})});}_0x2f90df=_[_0x5615('0x60')]({},_0x2f90df,_0x5efc7d[_0x5615('0x61')]);return _0xc92af9[_0x5615('0x10b')](_0x2f90df);}})[_0x5615('0x26')](function(_0x2cbbb2){if(_0x2cbbb2){_0x47bf9c=_0x2cbbb2[_0x5615('0x5f')];if(!_0x5efc7d[_0x5615('0x46')][_0x5615('0xc9')](_0x5615('0xd4'))){_0x2f90df[_0x5615('0x21')]=qs[_0x5615('0x21')](_0x5efc7d[_0x5615('0x46')][_0x5615('0x21')]);_0x2f90df[_0x5615('0x23')]=qs['offset'](_0x5efc7d[_0x5615('0x46')][_0x5615('0x23')]);}return _0xc92af9[_0x5615('0x10b')](_0x2f90df);}})[_0x5615('0x26')](function(_0x49c53f){if(_0x49c53f){return _0x49c53f?{'count':_0x47bf9c,'rows':_0x49c53f}:null;}})[_0x5615('0x26')](respondWithResult(_0x465e05,null))['catch'](handleError(_0x465e05,null));};exports[_0x5615('0x10c')]=function(_0x45f1f8,_0x1f97f){var _0x3bff7f=_0x45f1f8['params']['id'];var _0x468d35=_0x45f1f8[_0x5615('0x63')]?_0x45f1f8[_0x5615('0x63')][_0x5615('0x66')]:null;var _0x3a1c53=[];return Promise[_0x5615('0xf9')]()[_0x5615('0x26')](function(){if(!_0x468d35)throw new APIBadRequestError(_0x5615('0x10d'));})[_0x5615('0x26')](function(){return db['User'][_0x5615('0x93')]({'where':{'id':_0x3bff7f}});})[_0x5615('0x26')](function(_0x1db451){if(!_0x1db451)throw new APINotFoundError(util['format'](_0x5615('0xc8'),_0x45f1f8[_0x5615('0x58')]['id']));return db[_0x5615('0x6e')][_0x5615('0x10e')](function(_0x3c2dfd){return _0x1db451['addTeams'](_0x468d35,{'transaction':_0x3c2dfd})[_0x5615('0x26')](function(){return db[_0x5615('0x10f')][_0x5615('0x4e')]({'where':{'id':{'$in':_0x468d35}}});})[_0x5615('0x26')](function(_0x471363){var _0xd5c4ce=_[_0x5615('0x87')](_0x471363,function(_0x362cd0){return _0x362cd0[_0x5615('0x110')]();});return Promise['all'](_0xd5c4ce);})['then'](function(_0x266e18){_0x3a1c53=_[_0x5615('0x111')](_0x266e18);var _0x213446=_[_0x5615('0x87')](_0x3a1c53,function(_0x31e9b2){return _0x31e9b2[_0x5615('0x112')](_0x1db451['id'],{'transaction':_0x3c2dfd});});return Promise[_0x5615('0x55')](_0x213446);})[_0x5615('0x26')](function(){if(!_0x1db451[_0x5615('0x9a')])return;var _0x279311=_[_0x5615('0x32')](_0x3a1c53,function(_0x3601db){return _0x3601db[_0x5615('0x113')]('channel')===_0x5615('0x114');});var _0x459a62=_[_0x5615('0x87')](_0x279311,function(_0x5e80e3){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1db451[_0x5615('0x39')],'UserId':_0x1db451['id'],'queue_name':_0x5e80e3[_0x5615('0x39')],'VoiceQueueId':_0x5e80e3['id'],'interface':_[_0x5615('0x6c')](_0x1db451[_0x5615('0xe6')])?util['format'](_0x5615('0xa7'),_0x1db451['name']):_0x1db451[_0x5615('0xe6')],'paused':_0x1db451[_0x5615('0x9c')]||![],'penalty':_0x1db451[_0x5615('0xa8')]},{'transaction':_0x3c2dfd});});return Promise[_0x5615('0x55')](_0x459a62);})[_0x5615('0x26')](function(){return db[_0x5615('0x115')]['findAll']({'where':{'teamId':{'$in':_0x468d35}}});})[_0x5615('0x26')](function(_0x43d8c3){var _0x299733=_[_0x5615('0x87')](_0x43d8c3,function(_0x5b5af8){return db[_0x5615('0x116')]['create']({'UserId':_0x1db451['id'],'VoicePrefixId':_0x5b5af8['VoicePrefixId']},{'transaction':_0x3c2dfd});});return Promise[_0x5615('0x55')](_0x299733);});});})[_0x5615('0x26')](function(){for(var _0x249bca=0x0;_0x249bca<_0x3a1c53[_0x5615('0x5f')];_0x249bca++){var _0x1f571d=_0x3a1c53[_0x249bca][_0x5615('0x113')](_0x5615('0x99'));var _0x12a65b=_0x1f571d+'QueueId';socket[_0x5615('0x29')]('user'+_0x1f571d+'Queue:save',{'UserId':_0x3bff7f,['queueField']:_0x3a1c53[_0x249bca]['id']});}})[_0x5615('0x26')](respondWithStatusCode(_0x1f97f,null))['catch'](APIHandleError(_0x1f97f));};exports[_0x5615('0x117')]=function(_0x53af7c,_0x24f008){var _0x5c3e44=_0x53af7c[_0x5615('0x58')]['id'];var _0x14fa1e=null;if(_0x53af7c[_0x5615('0x46')]['ids']){_0x14fa1e=_['isArray'](_0x53af7c[_0x5615('0x46')][_0x5615('0x66')])?_0x53af7c[_0x5615('0x46')][_0x5615('0x66')]:[_0x53af7c[_0x5615('0x46')][_0x5615('0x66')]];}var _0x4c06b6=[];return Promise[_0x5615('0xf9')]()[_0x5615('0x26')](function(){if(!_0x14fa1e)throw new APIBadRequestError(_0x5615('0x118'));})[_0x5615('0x26')](function(){return db[_0x5615('0x3c')]['findOne']({'where':{'id':_0x5c3e44}});})['then'](function(_0xca7875){if(!_0xca7875)throw new APINotFoundError(util[_0x5615('0xa6')](_0x5615('0xc8'),_0x53af7c[_0x5615('0x58')]['id']));return db[_0x5615('0x6e')][_0x5615('0x10e')](function(_0x2f6151){return _0xca7875[_0x5615('0x117')](_0x14fa1e,{'transaction':_0x2f6151})[_0x5615('0x26')](function(){return db['Team'][_0x5615('0x4e')]({'where':{'id':{'$in':_0x14fa1e}}});})[_0x5615('0x26')](function(_0x42da54){var _0x3c6192=_[_0x5615('0x87')](_0x42da54,function(_0x23dc4d){return _0x23dc4d['getAssociatedQueues']();});return Promise[_0x5615('0x55')](_0x3c6192);})[_0x5615('0x26')](function(_0x295b53){_0x4c06b6=_[_0x5615('0x111')](_0x295b53);var _0x4f3416=_[_0x5615('0x87')](_0x4c06b6,function(_0x391343){return _0x391343[_0x5615('0x119')](_0xca7875['id'],{'transaction':_0x2f6151});});return Promise['all'](_0x4f3416);})[_0x5615('0x26')](function(){if(!_0xca7875[_0x5615('0x9a')])return;var _0x5c3b16=_['filter'](_0x4c06b6,function(_0x50af8b){return _0x50af8b[_0x5615('0x113')]('channel')===_0x5615('0x114');});var _0x1c4699=_[_0x5615('0x87')](_0x5c3b16,function(_0x13309b){return db[_0x5615('0xa9')][_0x5615('0x2a')]({'where':{'VoiceQueueId':_0x13309b['id'],'UserId':_0xca7875['id']},'transaction':_0x2f6151});});return Promise['all'](_0x1c4699);})[_0x5615('0x26')](function(){return db[_0x5615('0x115')]['findAll']({'where':{'teamId':{'$in':_0x14fa1e}}});})[_0x5615('0x26')](function(_0x32ade3){var _0x579ac3=_[_0x5615('0x87')](_0x32ade3,function(_0x59cabd){return db[_0x5615('0x116')][_0x5615('0x2a')]({'where':{'UserId':_0xca7875['id'],'VoicePrefixId':_0x59cabd[_0x5615('0x11a')]}},{'transaction':_0x2f6151});});return Promise[_0x5615('0x55')](_0x579ac3);});});})[_0x5615('0x26')](function(){for(var _0x5f5255=0x0;_0x5f5255<_0x4c06b6[_0x5615('0x5f')];_0x5f5255++){var _0xf0f926=_0x4c06b6[_0x5f5255][_0x5615('0x113')](_0x5615('0x99'));var _0x31c632=_0xf0f926+_0x5615('0xa2');socket[_0x5615('0x29')](_0x5615('0x2e')+_0xf0f926+'Queue:remove',{'UserId':_0x5c3e44,['queueField']:_0x4c06b6[_0x5f5255]['id']});}})[_0x5615('0x26')](respondWithStatusCode(_0x24f008,null))[_0x5615('0x56')](APIHandleError(_0x24f008));};exports[_0x5615('0x11b')]=function(_0x3fdce1,_0x4cacde){var _0x1abd29={};var _0x4376ed={};var _0x10d375;var _0x5a8488;return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x3fdce1['params']['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x4cacde,null))[_0x5615('0x26')](function(_0x3b5120){if(_0x3b5120){_0x10d375=_0x3b5120;_0x4376ed[_0x5615('0x59')]=_[_0x5615('0x5b')](db[_0x5615('0xca')][_0x5615('0x3d')]);_0x4376ed[_0x5615('0x46')]=_[_0x5615('0x5b')](_0x3fdce1[_0x5615('0x46')]);_0x4376ed['filters']=_[_0x5615('0x5d')](_0x4376ed[_0x5615('0x59')],_0x4376ed[_0x5615('0x46')]);_0x1abd29[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0x4376ed[_0x5615('0x59')],qs[_0x5615('0x5e')](_0x3fdce1[_0x5615('0x46')][_0x5615('0x5e')]));_0x1abd29['attributes']=_0x1abd29[_0x5615('0x4c')][_0x5615('0x5f')]?_0x1abd29[_0x5615('0x4c')]:_0x4376ed[_0x5615('0x59')];_0x1abd29['order']=qs[_0x5615('0xd1')](_0x3fdce1[_0x5615('0x46')][_0x5615('0xd1')]);_0x1abd29[_0x5615('0x45')]=qs[_0x5615('0x5c')](_['pick'](_0x3fdce1[_0x5615('0x46')],_0x4376ed[_0x5615('0x5c')]));if(_0x3fdce1[_0x5615('0x46')][_0x5615('0x32')]){_0x1abd29[_0x5615('0x45')]=_[_0x5615('0x60')](_0x1abd29['where'],{'$or':_[_0x5615('0x87')](_0x1abd29[_0x5615('0x4c')],function(_0x2c7d8d){var _0x3b0ab2={};_0x3b0ab2[_0x2c7d8d]={'$like':'%'+_0x3fdce1[_0x5615('0x46')][_0x5615('0x32')]+'%'};return _0x3b0ab2;})});}_0x1abd29=_[_0x5615('0x60')]({},_0x1abd29,_0x3fdce1[_0x5615('0x61')]);return _0x10d375['getLists'](_0x1abd29);}})['then'](function(_0x26806b){if(_0x26806b){_0x5a8488=_0x26806b[_0x5615('0x5f')];if(!_0x3fdce1['query'][_0x5615('0xc9')]('nolimit')){_0x1abd29[_0x5615('0x21')]=qs[_0x5615('0x21')](_0x3fdce1[_0x5615('0x46')][_0x5615('0x21')]);_0x1abd29[_0x5615('0x23')]=qs[_0x5615('0x23')](_0x3fdce1[_0x5615('0x46')][_0x5615('0x23')]);}return _0x10d375[_0x5615('0x11b')](_0x1abd29);}})[_0x5615('0x26')](function(_0x5bd0fb){if(_0x5bd0fb){return _0x5bd0fb?{'count':_0x5a8488,'rows':_0x5bd0fb}:null;}})['then'](respondWithResult(_0x4cacde,null))[_0x5615('0x56')](handleError(_0x4cacde,null));};exports[_0x5615('0x11c')]=function(_0x29e505,_0x2ff4b5){var _0x33b529={};var _0xf8e704={};var _0x56a025;return db[_0x5615('0x3c')][_0x5615('0x93')]({'where':{'id':_0x29e505[_0x5615('0x58')]['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x2ff4b5,null))[_0x5615('0x26')](function(_0x1c4f38){if(_0x1c4f38){_0x56a025=_0x1c4f38;_0xf8e704[_0x5615('0x59')]=_['keys'](db[_0x5615('0x3c')]['rawAttributes']);_0xf8e704[_0x5615('0x46')]=_['keys'](_0x29e505[_0x5615('0x46')]);_0xf8e704['filters']=_['intersection'](_0xf8e704['model'],_0xf8e704['query']);_0x33b529[_0x5615('0x4c')]=_[_0x5615('0x5d')](_0xf8e704[_0x5615('0x59')],qs['fields'](_0x29e505['query'][_0x5615('0x5e')]));_0x33b529['attributes']=_0x33b529[_0x5615('0x4c')][_0x5615('0x5f')]?_0x33b529[_0x5615('0x4c')]:_0xf8e704['model'];_0x33b529[_0x5615('0xd8')]=qs[_0x5615('0xd1')](_0x29e505[_0x5615('0x46')][_0x5615('0xd1')]);_0x33b529[_0x5615('0x45')]=qs[_0x5615('0x5c')](_[_0x5615('0xd2')](_0x29e505[_0x5615('0x46')],_0xf8e704[_0x5615('0x5c')]));if(_0x29e505[_0x5615('0x46')][_0x5615('0x32')]){_0x33b529[_0x5615('0x45')]=_[_0x5615('0x60')](_0x33b529[_0x5615('0x45')],{'$or':_['map'](_0x33b529[_0x5615('0x4c')],function(_0x79874a){var _0x556ab3={};_0x556ab3[_0x79874a]={'$like':'%'+_0x29e505['query'][_0x5615('0x32')]+'%'};return _0x556ab3;})});}_0x33b529[_0x5615('0x59')]=db[_0x5615('0x3c')];_0x33b529['as']='Agents';_0x33b529=_[_0x5615('0x60')]({},_0x33b529,_0x29e505[_0x5615('0x61')]);return _0x56a025['getVoiceQueues']({'include':[_0x33b529]});}})[_0x5615('0x26')](function(_0x4cf756){if(_0x4cf756){var _0x36cd9={},_0x26c960=[];for(var _0x20fc79=0x0;_0x20fc79<_0x4cf756['length'];_0x20fc79+=0x1){for(var _0x40ef36=0x0,_0x125b34;_0x40ef36<_0x4cf756[_0x20fc79][_0x5615('0x2f')][_0x5615('0x5f')];_0x40ef36+=0x1){_0x125b34=_0x4cf756[_0x20fc79]['Agents'][_0x40ef36][_0x5615('0x2b')]({'plain':!![]});_0x36cd9[_0x125b34['id']]=_0x125b34;}}_0x36cd9=_[_0x5615('0x11d')](_0x36cd9);for(var _0x36eb47=qs[_0x5615('0x23')](_0x29e505[_0x5615('0x46')]['offset']);_0x36eb47<_0x36cd9[_0x5615('0x5f')]&&_0x26c960[_0x5615('0x5f')]=_0x308d40['agents']){throw new Error(_0x61d4('0x51'));}})[_0x61d4('0x16')](function(){if(_0x4b0dfe){return db[_0x61d4('0x23')][_0x61d4('0x48')]({'where':{'membername':_0x4b0dfe[_0x61d4('0x21')]},'individualHooks':!![]});}})[_0x61d4('0x16')](function(){if(_0x4b0dfe){return _0x4b0dfe[_0x61d4('0x52')]({'raw':!![]});}})['then'](function(_0x4010ec){if(_0x4b0dfe){if(_0x4010ec){var _0x3d58b8=[];_0x42187b=_0x4010ec;if(_0x42187b[_0x61d4('0x27')]){for(var _0xd7adf2=0x0;_0xd7adf2<_0x42187b[_0x61d4('0x27')];_0xd7adf2++){_0x3d58b8[_0x61d4('0x2d')](db['UserVoiceQueueRt'][_0x61d4('0x53')]({'membername':_0x4b0dfe[_0x61d4('0x21')],'UserId':_0x4b0dfe['id'],'queue_name':_0x42187b[_0xd7adf2]['name'],'VoiceQueueId':_0x42187b[_0xd7adf2]['id'],'interface':_0x3d9f15,'paused':_0x4b0dfe[_0x61d4('0x54')]||![],'penalty':_0x42187b[_0xd7adf2]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x61d4('0x49')](_0x3d58b8);}}}})[_0x61d4('0x16')](function(){if(_0x4b0dfe){return db[_0x61d4('0x25')][_0x61d4('0xf')]({'where':{'membername':_0x4b0dfe['name'],'exitAt':null}});}})[_0x61d4('0x16')](function(_0x57241b){if(_0x4b0dfe){if(_0x57241b&&_0x57241b[_0x61d4('0x27')]){var _0x479a85=[];_0x57241b[_0x61d4('0x2c')](function(_0x4f6519){_0x479a85[_0x61d4('0x2d')](_0x4f6519[_0x61d4('0x24')]({'exitAt':moment()[_0x61d4('0x28')](_0x61d4('0x29'))}));});return BPromise[_0x61d4('0x49')](_0x479a85);}}})[_0x61d4('0x16')](function(){if(_0x4b0dfe){var _0x1657d1=[];var _0x58b8af=[];var _0x364fce=utils[_0x61d4('0x2b')]();var _0x42eb8f={'membername':_0x4b0dfe[_0x61d4('0x21')],'interface':_0x3d9f15,'enterAt':moment()[_0x61d4('0x28')](_0x61d4('0x29')),'role':_0x4b0dfe['role'],'internal':_0x4b0dfe[_0x61d4('0x33')]};_0x364fce['forEach'](function(_0x1520eb){_0x1657d1[_0x61d4('0x2d')](_['merge']({'channel':_0x1520eb,'type':_0x61d4('0x55'),'data1':_0x61d4('0x56'),'data2':_0x3d9f15},_0x42eb8f));if(_0x4b0dfe[_0x61d4('0x54')]){_0x58b8af[_0x61d4('0x2d')](_[_0x61d4('0x57')]({'channel':_0x1520eb,'type':_0x61d4('0x26'),'data1':_0x61d4('0x58')},_0x42eb8f));}});return db['MemberReport'][_0x61d4('0x35')](_0x1657d1[_0x61d4('0x59')](_0x58b8af),{'individualHooks':!![]});}})[_0x61d4('0x16')](function(){if(_0x4b0dfe){return _0x4b0dfe[_0x61d4('0x24')]({'online':!![],'lastLoginAt':moment()[_0x61d4('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4b0dfe[_0x61d4('0x54')]||![],'mailPause':_0x4b0dfe['loginInPause']||![],'chatPause':_0x4b0dfe[_0x61d4('0x54')]||![],'faxPause':_0x4b0dfe['loginInPause']||![],'smsPause':_0x4b0dfe[_0x61d4('0x54')]||![],'openchannelPause':_0x4b0dfe[_0x61d4('0x54')]||![],'pauseType':_0x4b0dfe['loginInPause']?_0x61d4('0x58'):null,'lastPauseAt':moment()[_0x61d4('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3d9f15});}})[_0x61d4('0x16')](function(_0x430a9a){_0x36432b(_0x430a9a);})['catch'](function(_0x55b7b6){_0xa36d3d(_0x4ca92f['error'](0x1f4,_0x55b7b6[_0x61d4('0x1c')]));});});}; \ No newline at end of file +var _0x8cfe=['catch','error','message','ShowUser','find','then','stringify','PauseUser','name','role','internal','format','User\x20with\x20id\x20%s\x20not\x20found','update','MemberReport','findAll','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','isValidChannel','channel','findOne','online','mailPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','params','unpause','LogoutUser','UserVoiceQueueRt','destroy','all','LoginUser','phone','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','concat','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','GetUser','User','options','raw','where','attributes','limit','map','include','model','info','debug'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x8cfe,0xe7));var _0xe8cf=function(_0x5b2e4e,_0x5d563a){_0x5b2e4e=_0x5b2e4e-0x0;var _0x61ea4c=_0x8cfe[_0x5b2e4e];return _0x61ea4c;};'use strict';var _=require(_0xe8cf('0x0'));var util=require(_0xe8cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Redis=require(_0xe8cf('0x2'));var db=require(_0xe8cf('0x3'))['db'];var utils=require(_0xe8cf('0x4'));var logger=require(_0xe8cf('0x5'))('rpc');var config=require(_0xe8cf('0x6'));config['redis']=_[_0xe8cf('0x7')](config[_0xe8cf('0x8')],{'host':_0xe8cf('0x9'),'port':0x18eb});var socket=require(_0xe8cf('0xa'))(new Redis(config[_0xe8cf('0x8')]));require('./user.socket')[_0xe8cf('0xb')](socket);exports[_0xe8cf('0xc')]=function(_0x127241){var _0x230ffb=this;return new Promise(function(_0x4c3e33,_0x26f7dd){return db[_0xe8cf('0xd')]['findAll']({'raw':_0x127241[_0xe8cf('0xe')]?_0x127241[_0xe8cf('0xe')][_0xe8cf('0xf')]===undefined?!![]:![]:!![],'where':_0x127241[_0xe8cf('0xe')]?_0x127241[_0xe8cf('0xe')][_0xe8cf('0x10')]||null:null,'attributes':_0x127241[_0xe8cf('0xe')]?_0x127241[_0xe8cf('0xe')][_0xe8cf('0x11')]||null:null,'limit':_0x127241[_0xe8cf('0xe')]?_0x127241['options'][_0xe8cf('0x12')]||null:null,'include':_0x127241['options']?_0x127241[_0xe8cf('0xe')]['include']?_[_0xe8cf('0x13')](_0x127241[_0xe8cf('0xe')][_0xe8cf('0x14')],function(_0x30947c){return{'model':db[_0x30947c[_0xe8cf('0x15')]],'as':_0x30947c['as'],'attributes':_0x30947c[_0xe8cf('0x11')],'include':_0x30947c[_0xe8cf('0x14')]?_[_0xe8cf('0x13')](_0x30947c['include'],function(_0x1c9c5a){return{'model':db[_0x1c9c5a[_0xe8cf('0x15')]],'as':_0x1c9c5a['as'],'attributes':_0x1c9c5a[_0xe8cf('0x11')],'include':_0x1c9c5a[_0xe8cf('0x14')]?_[_0xe8cf('0x13')](_0x1c9c5a['include'],function(_0x53be4f){return{'model':db[_0x53be4f[_0xe8cf('0x15')]],'as':_0x53be4f['as'],'attributes':_0x53be4f[_0xe8cf('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe7f2e1){logger[_0xe8cf('0x16')](_0xe8cf('0xc'),_0x127241);logger[_0xe8cf('0x17')](_0xe8cf('0xc'),_0x127241,JSON['stringify'](_0xe7f2e1));_0x4c3e33(_0xe7f2e1);})[_0xe8cf('0x18')](function(_0x36b4fe){logger[_0xe8cf('0x19')](_0xe8cf('0xc'),_0x36b4fe[_0xe8cf('0x1a')],_0x127241);_0x26f7dd(_0x230ffb['error'](0x1f4,_0x36b4fe['message']));});});};exports[_0xe8cf('0x1b')]=function(_0x59d885){var _0x272176=this;return new Promise(function(_0x40df46,_0x2bd736){return db[_0xe8cf('0xd')][_0xe8cf('0x1c')]({'raw':_0x59d885[_0xe8cf('0xe')]?_0x59d885['options'][_0xe8cf('0xf')]===undefined?!![]:![]:!![],'where':_0x59d885[_0xe8cf('0xe')]?_0x59d885[_0xe8cf('0xe')]['where']||null:null,'attributes':_0x59d885[_0xe8cf('0xe')]?_0x59d885[_0xe8cf('0xe')][_0xe8cf('0x11')]||null:null,'include':_0x59d885['options']?_0x59d885['options']['include']?_[_0xe8cf('0x13')](_0x59d885[_0xe8cf('0xe')][_0xe8cf('0x14')],function(_0x522129){return{'model':db[_0x522129[_0xe8cf('0x15')]],'as':_0x522129['as'],'attributes':_0x522129[_0xe8cf('0x11')],'include':_0x522129['include']?_[_0xe8cf('0x13')](_0x522129['include'],function(_0x3b5ba8){return{'model':db[_0x3b5ba8[_0xe8cf('0x15')]],'as':_0x3b5ba8['as'],'attributes':_0x3b5ba8[_0xe8cf('0x11')],'include':_0x3b5ba8[_0xe8cf('0x14')]?_['map'](_0x3b5ba8[_0xe8cf('0x14')],function(_0x3110e2){return{'model':db[_0x3110e2[_0xe8cf('0x15')]],'as':_0x3110e2['as'],'attributes':_0x3110e2[_0xe8cf('0x11')]};}):[]};}):[]};}):[]:[]})[_0xe8cf('0x1d')](function(_0x13c875){logger[_0xe8cf('0x16')](_0xe8cf('0x1b'),_0x59d885);logger[_0xe8cf('0x17')](_0xe8cf('0x1b'),_0x59d885,JSON[_0xe8cf('0x1e')](_0x13c875));_0x40df46(_0x13c875);})[_0xe8cf('0x18')](function(_0x55d65d){logger[_0xe8cf('0x19')](_0xe8cf('0x1b'),_0x55d65d['message'],_0x59d885);_0x2bd736(_0x272176[_0xe8cf('0x19')](0x1f4,_0x55d65d[_0xe8cf('0x1a')]));});});};exports[_0xe8cf('0x1f')]=function(_0x1dfee0){var _0x585f26;return db[_0xe8cf('0xd')][_0xe8cf('0x1c')]({'where':_0x1dfee0[_0xe8cf('0xe')][_0xe8cf('0x10')]||{},'attributes':['id',_0xe8cf('0x20'),_0xe8cf('0x21'),_0xe8cf('0x22'),'interface']})[_0xe8cf('0x1d')](function(_0x288157){if(!_0x288157){throw new Error(util[_0xe8cf('0x23')](_0xe8cf('0x24'),_0x1dfee0['params']['id']));}_0x585f26=_0x288157;return db['UserVoiceQueueRt'][_0xe8cf('0x25')]({'paused':0x1},{'where':{'UserId':_0x585f26['id']},'individualHooks':!![]});})[_0xe8cf('0x1d')](function(){return db[_0xe8cf('0x26')][_0xe8cf('0x27')]({'where':{'membername':_0x585f26[_0xe8cf('0x20')],'type':_0xe8cf('0x28'),'exitAt':null}});})[_0xe8cf('0x1d')](function(_0x2dcecd){if(_0x2dcecd&&_0x2dcecd[_0xe8cf('0x29')]){var _0x590cf9=moment()[_0xe8cf('0x23')](_0xe8cf('0x2a'));for(var _0x338825=0x0,_0x123e6a=_0x2dcecd['length'];_0x338825<_0x123e6a;_0x338825++){_0x2dcecd[_0x338825][_0xe8cf('0x2b')]({'exitAt':_0x590cf9});}}})[_0xe8cf('0x1d')](function(){var _0x5851e8=[];var _0x17c520=utils[_0xe8cf('0x2c')]();_0x17c520[_0xe8cf('0x2d')](function(_0x46e114){_0x5851e8[_0xe8cf('0x2e')]({'channel':_0x46e114,'membername':_0x585f26[_0xe8cf('0x20')],'interface':_[_0xe8cf('0x2f')](_0x585f26[_0xe8cf('0x30')])?util['format'](_0xe8cf('0x31'),_0x585f26[_0xe8cf('0x20')]):_0x585f26[_0xe8cf('0x30')],'type':_0xe8cf('0x28'),'enterAt':moment()[_0xe8cf('0x23')](_0xe8cf('0x2a')),'data1':_0x1dfee0[_0xe8cf('0x32')][_0xe8cf('0x33')]||_0xe8cf('0x34'),'role':_0x585f26[_0xe8cf('0x21')],'internal':_0x585f26['internal'],'uniqueid':_0x1dfee0[_0xe8cf('0x32')][_0xe8cf('0x35')]||null});});return db[_0xe8cf('0x26')][_0xe8cf('0x36')](_0x5851e8,{'individualHooks':!![]});})[_0xe8cf('0x1d')](function(){return _0x585f26['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1dfee0[_0xe8cf('0x32')]['type']||_0xe8cf('0x34'),'lastPauseAt':moment()[_0xe8cf('0x23')](_0xe8cf('0x2a'))});})[_0xe8cf('0x18')](function(_0x4be1ef){throw _0x4be1ef;});};exports['UnpauseUser']=function(_0x591255){return Promise['resolve']()[_0xe8cf('0x1d')](function(){if(_0x591255['body']['channel']&&!utils[_0xe8cf('0x37')](_0x591255[_0xe8cf('0x32')][_0xe8cf('0x38')])){throw new Error(util[_0xe8cf('0x23')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x591255[_0xe8cf('0x32')]['channel']));}return db[_0xe8cf('0xd')][_0xe8cf('0x39')]({'where':_0x591255[_0xe8cf('0xe')]['where']||{},'attributes':['id',_0xe8cf('0x20'),_0xe8cf('0x21'),_0xe8cf('0x22'),_0xe8cf('0x30'),_0xe8cf('0x3a'),'voicePause',_0xe8cf('0x3b'),'chatPause',_0xe8cf('0x3c'),_0xe8cf('0x3d'),'smsPause',_0xe8cf('0x3e'),_0xe8cf('0x3f'),_0xe8cf('0x40')]});})[_0xe8cf('0x1d')](function(_0x3a7fe5){if(!_0x3a7fe5){throw new Error(util[_0xe8cf('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x591255[_0xe8cf('0x41')]['id']));}return _0x3a7fe5[_0xe8cf('0x42')](_0x591255['body'][_0xe8cf('0x38')],'system');})['catch'](function(_0xc95162){throw _0xc95162;});};exports[_0xe8cf('0x43')]=function(_0x53ff5b){var _0x1b1428=this;return new Promise(function(_0x39ca97,_0x3e5c73){var _0x427268;return db[_0xe8cf('0xd')]['findOne']({'where':_0x53ff5b['options']['where']||{},'attributes':['id',_0xe8cf('0x20')]})[_0xe8cf('0x1d')](function(_0x1369d1){if(_0x1369d1){_0x427268=_0x1369d1;return db[_0xe8cf('0x44')][_0xe8cf('0x45')]({'where':{'membername':_0x427268[_0xe8cf('0x20')]},'individualHooks':!![]});}})[_0xe8cf('0x1d')](function(){if(_0x427268){return db[_0xe8cf('0x26')][_0xe8cf('0x27')]({'where':{'membername':_0x427268[_0xe8cf('0x20')],'exitAt':null}});}})[_0xe8cf('0x1d')](function(_0x5b1aef){if(_0x427268){if(_0x5b1aef&&_0x5b1aef[_0xe8cf('0x29')]){var _0xcfd687=[];_0x5b1aef['forEach'](function(_0x4971ef){_0xcfd687[_0xe8cf('0x2e')](_0x4971ef[_0xe8cf('0x25')]({'exitAt':moment()['format'](_0xe8cf('0x2a'))}));});return BPromise[_0xe8cf('0x46')](_0xcfd687);}}})[_0xe8cf('0x1d')](function(){if(_0x427268){return _0x427268[_0xe8cf('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x19ea0a){_0x39ca97(_0x19ea0a);})['catch'](function(_0x9199b8){_0x3e5c73(_0x1b1428['error'](0x1f4,_0x9199b8['message']));});});};exports[_0xe8cf('0x47')]=function(_0x3e735c){var _0xec6093=this;return new Promise(function(_0x394c20,_0x173ed2){var _0x82811c;var _0x432466;var _0x5a4e3d;var _0xf16aa9;return db[_0xe8cf('0xd')][_0xe8cf('0x39')]({'where':_0x3e735c[_0xe8cf('0xe')][_0xe8cf('0x10')]||{},'attributes':['id',_0xe8cf('0x20'),_0xe8cf('0x21'),'mobile',_0xe8cf('0x48'),_0xe8cf('0x22'),'loginInPause',_0xe8cf('0x30')]})[_0xe8cf('0x1d')](function(_0x1296c4){if(_0x1296c4){_0x82811c=_0x1296c4;_0xf16aa9=_0x3e735c[_0xe8cf('0x32')][_0xe8cf('0x30')]?_0x3e735c['body'][_0xe8cf('0x30')]:util[_0xe8cf('0x23')](_0xe8cf('0x31'),_0x82811c[_0xe8cf('0x20')]);return db[_0xe8cf('0xd')]['count']({'where':{'role':_0xe8cf('0x49'),'online':!![],'id':{'$ne':_0x82811c['id']}}});}})[_0xe8cf('0x1d')](function(_0x4a70ea){if(_0x4a70ea){_0x5a4e3d=_0x4a70ea;return require('../../config/license/util')[_0xe8cf('0x4a')]();}})[_0xe8cf('0x1d')](function(_0x31d268){if(_0x31d268&&_0x31d268[_0xe8cf('0x4b')]&&_0x5a4e3d>=_0x31d268[_0xe8cf('0x4b')]){throw new Error(_0xe8cf('0x4c'));}})['then'](function(){if(_0x82811c){return db[_0xe8cf('0x44')][_0xe8cf('0x45')]({'where':{'membername':_0x82811c['name']},'individualHooks':!![]});}})[_0xe8cf('0x1d')](function(){if(_0x82811c){return _0x82811c[_0xe8cf('0x4d')]({'raw':!![]});}})[_0xe8cf('0x1d')](function(_0x44fd0e){if(_0x82811c){if(_0x44fd0e){var _0x41bb41=[];_0x432466=_0x44fd0e;if(_0x432466[_0xe8cf('0x29')]){for(var _0x22718c=0x0;_0x22718c<_0x432466[_0xe8cf('0x29')];_0x22718c++){_0x41bb41[_0xe8cf('0x2e')](db['UserVoiceQueueRt'][_0xe8cf('0x4e')]({'membername':_0x82811c[_0xe8cf('0x20')],'UserId':_0x82811c['id'],'queue_name':_0x432466[_0x22718c][_0xe8cf('0x20')],'VoiceQueueId':_0x432466[_0x22718c]['id'],'interface':_0xf16aa9,'paused':_0x82811c[_0xe8cf('0x4f')]||![],'penalty':_0x432466[_0x22718c][_0xe8cf('0x50')]||0x0}));}return BPromise[_0xe8cf('0x46')](_0x41bb41);}}}})['then'](function(){if(_0x82811c){return db[_0xe8cf('0x26')][_0xe8cf('0x27')]({'where':{'membername':_0x82811c['name'],'exitAt':null}});}})[_0xe8cf('0x1d')](function(_0xb94858){if(_0x82811c){if(_0xb94858&&_0xb94858[_0xe8cf('0x29')]){var _0x452e7c=[];_0xb94858[_0xe8cf('0x2d')](function(_0x439e40){_0x452e7c[_0xe8cf('0x2e')](_0x439e40[_0xe8cf('0x25')]({'exitAt':moment()[_0xe8cf('0x23')](_0xe8cf('0x2a'))}));});return BPromise[_0xe8cf('0x46')](_0x452e7c);}}})[_0xe8cf('0x1d')](function(){if(_0x82811c){var _0x2516da=[];var _0x282ba9=[];var _0x5ec7cd=utils[_0xe8cf('0x2c')]();var _0x3a0dab={'membername':_0x82811c[_0xe8cf('0x20')],'interface':_0xf16aa9,'enterAt':moment()[_0xe8cf('0x23')](_0xe8cf('0x2a')),'role':_0x82811c['role'],'internal':_0x82811c[_0xe8cf('0x22')]};_0x5ec7cd['forEach'](function(_0x42da87){_0x2516da[_0xe8cf('0x2e')](_[_0xe8cf('0x51')]({'channel':_0x42da87,'type':'LOGIN','data1':_0xe8cf('0x52'),'data2':_0xf16aa9},_0x3a0dab));if(_0x82811c['loginInPause']){_0x282ba9[_0xe8cf('0x2e')](_['merge']({'channel':_0x42da87,'type':_0xe8cf('0x28'),'data1':_0xe8cf('0x53')},_0x3a0dab));}});return db[_0xe8cf('0x26')][_0xe8cf('0x36')](_0x2516da[_0xe8cf('0x54')](_0x282ba9),{'individualHooks':!![]});}})['then'](function(){if(_0x82811c){return _0x82811c['update']({'online':!![],'lastLoginAt':moment()[_0xe8cf('0x23')](_0xe8cf('0x2a')),'voicePause':_0x82811c[_0xe8cf('0x4f')]||![],'mailPause':_0x82811c['loginInPause']||![],'chatPause':_0x82811c['loginInPause']||![],'faxPause':_0x82811c[_0xe8cf('0x4f')]||![],'smsPause':_0x82811c[_0xe8cf('0x4f')]||![],'openchannelPause':_0x82811c['loginInPause']||![],'pauseType':_0x82811c[_0xe8cf('0x4f')]?_0xe8cf('0x53'):null,'lastPauseAt':moment()[_0xe8cf('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xf16aa9});}})[_0xe8cf('0x1d')](function(_0x441542){_0x394c20(_0x441542);})[_0xe8cf('0x18')](function(_0x6d7a4c){_0x173ed2(_0xec6093[_0xe8cf('0x19')](0x1f4,_0x6d7a4c[_0xe8cf('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 6074dca..2fdec2d 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 _0xbf2f=['emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbf2f,0xc5));var _0xfbf2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbf2f[_0x2641f9];return _0x585741;};'use strict';var UserEvents=require(_0xfbf2('0x0'));var events=[_0xfbf2('0x1'),_0xfbf2('0x2'),'update'];function createListener(_0x59425e,_0x1bbaf5){return function(_0x4a7a6f){_0x1bbaf5[_0xfbf2('0x3')](_0x59425e,_0x4a7a6f);};}function removeListener(_0x2d17dc,_0x13f12a){return function(){UserEvents[_0xfbf2('0x4')](_0x2d17dc,_0x13f12a);};}exports[_0xfbf2('0x5')]=function(_0x822c3a){for(var _0x29ad66=0x0,_0x94dad7=events[_0xfbf2('0x6')];_0x29ad66<_0x94dad7;_0x29ad66++){var _0x449370=events[_0x29ad66];var _0x2c70e4=createListener(_0xfbf2('0x7')+_0x449370,_0x822c3a);UserEvents['on'](_0x449370,_0x2c70e4);}}; \ No newline at end of file +var _0x5793=['./user.events','remove','update','register','length','user:'];(function(_0x54dae9,_0x244c83){var _0x405e4d=function(_0x3479fe){while(--_0x3479fe){_0x54dae9['push'](_0x54dae9['shift']());}};_0x405e4d(++_0x244c83);}(_0x5793,0x14a));var _0x3579=function(_0x1c7e26,_0x57538f){_0x1c7e26=_0x1c7e26-0x0;var _0x313acf=_0x5793[_0x1c7e26];return _0x313acf;};'use strict';var UserEvents=require(_0x3579('0x0'));var events=['save',_0x3579('0x1'),_0x3579('0x2')];function createListener(_0x57fc47,_0x10afc8){return function(_0x4c7b72){_0x10afc8['emit'](_0x57fc47,_0x4c7b72);};}function removeListener(_0x43f9ce,_0x14cb9a){return function(){UserEvents['removeListener'](_0x43f9ce,_0x14cb9a);};}exports[_0x3579('0x3')]=function(_0x36befe){for(var _0x31748c=0x0,_0x3e91e6=events[_0x3579('0x4')];_0x31748c<_0x3e91e6;_0x31748c++){var _0x165eeb=events[_0x31748c];var _0x3f8d15=createListener(_0x3579('0x5')+_0x165eeb,_0x36befe);UserEvents['on'](_0x165eeb,_0x3f8d15);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 60985f2..dea0591 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3ed9ce,_0x5b1529){var _0x576fa8=function(_0x428556){while(--_0x428556){_0x3ed9ce['push'](_0x3ed9ce['shift']());}};_0x576fa8(++_0x5b1529);}(_0x70e0,0x17b));var _0x070e=function(_0x51dcf7,_0x43c2b9){_0x51dcf7=_0x51dcf7-0x0;var _0xb8d8c3=_0x70e0[_0x51dcf7];return _0xb8d8c3;};'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(_0xb411be,_0x5cf7ae){var _0x1671ba=function(_0x594d60){while(--_0x594d60){_0xb411be['push'](_0xb411be['shift']());}};_0x1671ba(++_0x5cf7ae);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xcb91[_0x251e8c];return _0x1e0c1d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index fc85f99..3a3f677 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 _0xefa0=['sequelize','exports'];(function(_0x1dc033,_0xe55128){var _0x365038=function(_0x1c4b92){while(--_0x1c4b92){_0x1dc033['push'](_0x1dc033['shift']());}};_0x365038(++_0xe55128);}(_0xefa0,0xbc));var _0x0efa=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xefa0[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x0efa('0x0'));module[_0x0efa('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d78=['sequelize'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x5d78,0x1bc));var _0x85d7=function(_0x5c120a,_0x564426){_0x5c120a=_0x5c120a-0x0;var _0x339c28=_0x5d78[_0x5c120a];return _0x339c28;};'use strict';var Sequelize=require(_0x85d7('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 82a6a5c..c51d048 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 _0x6960=['define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6960,0x153));var _0x0696=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6960[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x0696('0x0'));var util=require(_0x0696('0x1'));var logger=require(_0x0696('0x2'))(_0x0696('0x3'));var moment=require(_0x0696('0x4'));var BPromise=require(_0x0696('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0696('0x6'));var rimraf=require(_0x0696('0x7'));var config=require(_0x0696('0x8'));var attributes=require(_0x0696('0x9'));module[_0x0696('0xa')]=function(_0x567476,_0x36e734){return _0x567476[_0x0696('0xb')](_0x0696('0xc'),attributes,{'tableName':_0x0696('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f47=['path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x2f5dee,_0x47d453){var _0x54a09f=function(_0x478e36){while(--_0x478e36){_0x2f5dee['push'](_0x2f5dee['shift']());}};_0x54a09f(++_0x47d453);}(_0x4f47,0x150));var _0x74f4=function(_0x56b9ee,_0x25a747){_0x56b9ee=_0x56b9ee-0x0;var _0x371286=_0x4f47[_0x56b9ee];return _0x371286;};'use strict';var _=require(_0x74f4('0x0'));var util=require(_0x74f4('0x1'));var logger=require(_0x74f4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x74f4('0x3'));var rp=require(_0x74f4('0x4'));var fs=require('fs');var path=require(_0x74f4('0x5'));var rimraf=require('rimraf');var config=require(_0x74f4('0x6'));var attributes=require(_0x74f4('0x7'));module[_0x74f4('0x8')]=function(_0x4ad81c,_0x361178){return _0x4ad81c[_0x74f4('0x9')](_0x74f4('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index ce16677..553473e 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 _0xc408=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x446201,_0x4689d7){var _0x4059b8=function(_0xd2bd56){while(--_0xd2bd56){_0x446201['push'](_0x446201['shift']());}};_0x4059b8(++_0x4689d7);}(_0xc408,0xae));var _0x8c40=function(_0x3c3836,_0x25d703){_0x3c3836=_0x3c3836-0x0;var _0xa72786=_0xc408[_0x3c3836];return _0xa72786;};'use strict';var _=require(_0x8c40('0x0'));var util=require(_0x8c40('0x1'));var moment=require(_0x8c40('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c40('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c40('0x4'));var logger=require(_0x8c40('0x5'))(_0x8c40('0x6'));var config=require(_0x8c40('0x7'));var jayson=require(_0x8c40('0x8'));var client=jayson['client'][_0x8c40('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110593,_0x2927ea,_0x5205ad){return new BPromise(function(_0x4b2402,_0x1a2a9b){return client[_0x8c40('0xa')](_0x110593,_0x5205ad)[_0x8c40('0xb')](function(_0xc2cdd1){logger[_0x8c40('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x2927ea,_0x8c40('0xd'));logger[_0x8c40('0xe')](_0x8c40('0xf'),_0x2927ea,_0x8c40('0xd'),JSON[_0x8c40('0x10')](_0xc2cdd1));if(_0xc2cdd1[_0x8c40('0x11')]){if(_0xc2cdd1[_0x8c40('0x11')][_0x8c40('0x12')]===0x1f4){logger[_0x8c40('0x11')](_0x8c40('0x13'),_0x2927ea,_0xc2cdd1['error'][_0x8c40('0x14')]);return _0x1a2a9b(_0xc2cdd1[_0x8c40('0x11')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2927ea,_0xc2cdd1[_0x8c40('0x11')]['message']);return _0x4b2402(_0xc2cdd1[_0x8c40('0x11')][_0x8c40('0x14')]);}else{logger[_0x8c40('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x2927ea,'request\x20sent');_0x4b2402(_0xc2cdd1['result']['message']);}})[_0x8c40('0x15')](function(_0x192dd0){logger[_0x8c40('0x11')](_0x8c40('0x13'),_0x2927ea,_0x192dd0);_0x1a2a9b(_0x192dd0);});});} \ No newline at end of file +var _0xce60=['error','message','UserChatQueue,\x20%s,\x20%s','info','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','code'];(function(_0x58ba06,_0x16e2a2){var _0xab52f1=function(_0x467105){while(--_0x467105){_0x58ba06['push'](_0x58ba06['shift']());}};_0xab52f1(++_0x16e2a2);}(_0xce60,0x1e1));var _0x0ce6=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0xce60[_0x13e724];return _0x334a44;};'use strict';var _=require('lodash');var util=require(_0x0ce6('0x0'));var moment=require('moment');var BPromise=require(_0x0ce6('0x1'));var rs=require(_0x0ce6('0x2'));var fs=require('fs');var Redis=require(_0x0ce6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ce6('0x4'));var logger=require(_0x0ce6('0x5'))(_0x0ce6('0x6'));var config=require(_0x0ce6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ce6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa510f7,_0x2f1969,_0x4487cc){return new BPromise(function(_0x1b7935,_0x3cce36){return client['request'](_0xa510f7,_0x4487cc)[_0x0ce6('0x9')](function(_0x8f7ddc){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x2f1969,_0x0ce6('0xa'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2f1969,'request\x20sent',JSON['stringify'](_0x8f7ddc));if(_0x8f7ddc['error']){if(_0x8f7ddc['error'][_0x0ce6('0xb')]===0x1f4){logger[_0x0ce6('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x2f1969,_0x8f7ddc[_0x0ce6('0xc')][_0x0ce6('0xd')]);return _0x3cce36(_0x8f7ddc[_0x0ce6('0xc')][_0x0ce6('0xd')]);}logger[_0x0ce6('0xc')](_0x0ce6('0xe'),_0x2f1969,_0x8f7ddc['error'][_0x0ce6('0xd')]);return _0x1b7935(_0x8f7ddc[_0x0ce6('0xc')][_0x0ce6('0xd')]);}else{logger[_0x0ce6('0xf')](_0x0ce6('0xe'),_0x2f1969,_0x0ce6('0xa'));_0x1b7935(_0x8f7ddc['result'][_0x0ce6('0xd')]);}})[_0x0ce6('0x10')](function(_0x130940){logger[_0x0ce6('0xc')](_0x0ce6('0xe'),_0x2f1969,_0x130940);_0x3cce36(_0x130940);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 438774d..250b617 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x341850,_0x227d13){var _0x550b31=function(_0x2c78f9){while(--_0x2c78f9){_0x341850['push'](_0x341850['shift']());}};_0x550b31(++_0x227d13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x13957c,_0x3c0b80){var _0x46ec28=function(_0x44e31e){while(--_0x44e31e){_0x13957c['push'](_0x13957c['shift']());}};_0x46ec28(++_0x3c0b80);}(_0x70e0,0x17b));var _0x070e=function(_0x387611,_0x2cf6bc){_0x387611=_0x387611-0x0;var _0xadbd0a=_0x70e0[_0x387611];return _0xadbd0a;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 369c631..ff12835 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 _0x4b53=['INTEGER','STRING','sequelize'];(function(_0x279e6f,_0x566574){var _0x489a5f=function(_0x57e285){while(--_0x57e285){_0x279e6f['push'](_0x279e6f['shift']());}};_0x489a5f(++_0x566574);}(_0x4b53,0x119));var _0x34b5=function(_0x20fccd,_0x67485c){_0x20fccd=_0x20fccd-0x0;var _0x1fd97c=_0x4b53[_0x20fccd];return _0x1fd97c;};'use strict';var Sequelize=require(_0x34b5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x34b5('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x34b5('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x34b5('0x2')]}}; \ No newline at end of file +var _0xb4cc=['INTEGER','sequelize'];(function(_0xc47ec1,_0x5102aa){var _0x27b9ae=function(_0x3d61cb){while(--_0x3d61cb){_0xc47ec1['push'](_0xc47ec1['shift']());}};_0x27b9ae(++_0x5102aa);}(_0xb4cc,0x1d3));var _0xcb4c=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xb4cc[_0x3f0b30];return _0x2748a5;};'use strict';var Sequelize=require(_0xcb4c('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcb4c('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 03b0ce6..ab22ff0 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 _0xa055=['bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa055,0x190));var _0x5a05=function(_0x4dda69,_0x2a0fe4){_0x4dda69=_0x4dda69-0x0;var _0x9014a9=_0xa055[_0x4dda69];return _0x9014a9;};'use strict';var _=require(_0x5a05('0x0'));var util=require(_0x5a05('0x1'));var logger=require('../../config/logger')(_0x5a05('0x2'));var moment=require('moment');var BPromise=require(_0x5a05('0x3'));var rp=require(_0x5a05('0x4'));var fs=require('fs');var path=require(_0x5a05('0x5'));var rimraf=require(_0x5a05('0x6'));var config=require(_0x5a05('0x7'));var attributes=require(_0x5a05('0x8'));module[_0x5a05('0x9')]=function(_0x203347,_0x339c1b){return _0x203347[_0x5a05('0xa')](_0x5a05('0xb'),attributes,{'tableName':_0x5a05('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe72b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x33595c,_0x2a40d1){var _0x5e3b27=function(_0x11d701){while(--_0x11d701){_0x33595c['push'](_0x33595c['shift']());}};_0x5e3b27(++_0x2a40d1);}(_0xe72b,0x111));var _0xbe72=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0xe72b[_0x2af29a];return _0x5ef02f;};'use strict';var _=require(_0xbe72('0x0'));var util=require(_0xbe72('0x1'));var logger=require(_0xbe72('0x2'))('api');var moment=require(_0xbe72('0x3'));var BPromise=require(_0xbe72('0x4'));var rp=require(_0xbe72('0x5'));var fs=require('fs');var path=require(_0xbe72('0x6'));var rimraf=require(_0xbe72('0x7'));var config=require(_0xbe72('0x8'));var attributes=require(_0xbe72('0x9'));module[_0xbe72('0xa')]=function(_0x55a378,_0x4d75e4){return _0x55a378[_0xbe72('0xb')]('UserFaxQueue',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 f741a94..fa37db6 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 _0x03bf=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03bf,0x7e));var _0xf03b=function(_0x1db14e,_0x223393){_0x1db14e=_0x1db14e-0x0;var _0xa60d5e=_0x03bf[_0x1db14e];return _0xa60d5e;};'use strict';var _=require(_0xf03b('0x0'));var util=require(_0xf03b('0x1'));var moment=require(_0xf03b('0x2'));var BPromise=require(_0xf03b('0x3'));var rs=require(_0xf03b('0x4'));var fs=require('fs');var Redis=require(_0xf03b('0x5'));var db=require(_0xf03b('0x6'))['db'];var utils=require(_0xf03b('0x7'));var logger=require(_0xf03b('0x8'))(_0xf03b('0x9'));var config=require(_0xf03b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf03b('0xb')][_0xf03b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18f9fd,_0x456cb7,_0x5bad24){return new BPromise(function(_0x3ad4d5,_0x4b5fa8){return client['request'](_0x18f9fd,_0x5bad24)['then'](function(_0x438319){logger[_0xf03b('0xd')](_0xf03b('0xe'),_0x456cb7,_0xf03b('0xf'));logger[_0xf03b('0x10')](_0xf03b('0x11'),_0x456cb7,_0xf03b('0xf'),JSON[_0xf03b('0x12')](_0x438319));if(_0x438319[_0xf03b('0x13')]){if(_0x438319['error']['code']===0x1f4){logger[_0xf03b('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x456cb7,_0x438319['error'][_0xf03b('0x14')]);return _0x4b5fa8(_0x438319[_0xf03b('0x13')][_0xf03b('0x14')]);}logger[_0xf03b('0x13')](_0xf03b('0xe'),_0x456cb7,_0x438319['error'][_0xf03b('0x14')]);return _0x3ad4d5(_0x438319['error'][_0xf03b('0x14')]);}else{logger[_0xf03b('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x456cb7,_0xf03b('0xf'));_0x3ad4d5(_0x438319[_0xf03b('0x15')][_0xf03b('0x14')]);}})['catch'](function(_0x49538a){logger['error'](_0xf03b('0xe'),_0x456cb7,_0x49538a);_0x4b5fa8(_0x49538a);});});} \ No newline at end of file +var _0x1bb4=['request','then','info','request\x20sent','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x3ba216,_0x2285a9){var _0x45d2e2=function(_0x49dbb1){while(--_0x49dbb1){_0x3ba216['push'](_0x3ba216['shift']());}};_0x45d2e2(++_0x2285a9);}(_0x1bb4,0x1c3));var _0x41bb=function(_0x419130,_0x5149db){_0x419130=_0x419130-0x0;var _0x215b84=_0x1bb4[_0x419130];return _0x215b84;};'use strict';var _=require('lodash');var util=require(_0x41bb('0x0'));var moment=require('moment');var BPromise=require(_0x41bb('0x1'));var rs=require(_0x41bb('0x2'));var fs=require('fs');var Redis=require(_0x41bb('0x3'));var db=require(_0x41bb('0x4'))['db'];var utils=require(_0x41bb('0x5'));var logger=require('../../config/logger')(_0x41bb('0x6'));var config=require(_0x41bb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x41bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16f9d5,_0x4d6443,_0x5810c1){return new BPromise(function(_0x3b2eea,_0x232463){return client[_0x41bb('0x9')](_0x16f9d5,_0x5810c1)[_0x41bb('0xa')](function(_0x48368a){logger[_0x41bb('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x4d6443,'request\x20sent');logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4d6443,_0x41bb('0xc'),JSON[_0x41bb('0xd')](_0x48368a));if(_0x48368a[_0x41bb('0xe')]){if(_0x48368a['error'][_0x41bb('0xf')]===0x1f4){logger[_0x41bb('0xe')](_0x41bb('0x10'),_0x4d6443,_0x48368a['error'][_0x41bb('0x11')]);return _0x232463(_0x48368a['error'][_0x41bb('0x11')]);}logger[_0x41bb('0xe')](_0x41bb('0x10'),_0x4d6443,_0x48368a[_0x41bb('0xe')][_0x41bb('0x11')]);return _0x3b2eea(_0x48368a[_0x41bb('0xe')][_0x41bb('0x11')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x4d6443,_0x41bb('0xc'));_0x3b2eea(_0x48368a[_0x41bb('0x12')][_0x41bb('0x11')]);}})[_0x41bb('0x13')](function(_0x26e6ea){logger['error'](_0x41bb('0x10'),_0x4d6443,_0x26e6ea);_0x232463(_0x26e6ea);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 377beb1..9becc48 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x478074,_0x1591c0){var _0x2cb839=function(_0x12302b){while(--_0x12302b){_0x478074['push'](_0x478074['shift']());}};_0x2cb839(++_0x1591c0);}(_0x70e0,0x17b));var _0x070e=function(_0x3c0d12,_0x343732){_0x3c0d12=_0x3c0d12-0x0;var _0x3dd040=_0x70e0[_0x3c0d12];return _0x3dd040;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index fed9aad..37393c6 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 _0xa87e=['exports','INTEGER','sequelize'];(function(_0x17090e,_0x3e5de0){var _0x56f538=function(_0x17d453){while(--_0x17d453){_0x17090e['push'](_0x17090e['shift']());}};_0x56f538(++_0x3e5de0);}(_0xa87e,0x185));var _0xea87=function(_0x44e04f,_0x31968c){_0x44e04f=_0x44e04f-0x0;var _0x479aca=_0xa87e[_0x44e04f];return _0x479aca;};'use strict';var Sequelize=require(_0xea87('0x0'));module[_0xea87('0x1')]={'penalty':{'type':Sequelize[_0xea87('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2c9b=['sequelize','exports','INTEGER'];(function(_0x536624,_0x3ffaaa){var _0x39970b=function(_0x33d0a5){while(--_0x33d0a5){_0x536624['push'](_0x536624['shift']());}};_0x39970b(++_0x3ffaaa);}(_0x2c9b,0x12c));var _0xb2c9=function(_0x3f6a61,_0x20b159){_0x3f6a61=_0x3f6a61-0x0;var _0x2c8511=_0x2c9b[_0x3f6a61];return _0x2c8511;};'use strict';var Sequelize=require(_0xb2c9('0x0'));module[_0xb2c9('0x1')]={'penalty':{'type':Sequelize[_0xb2c9('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 8308451..f744d77 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 _0x00f4=['bluebird','request-promise','path','rimraf','define','UserMailQueue','user_has_mail_queues','lodash','util','moment'];(function(_0x26635d,_0x30913c){var _0xec5b1=function(_0x10775b){while(--_0x10775b){_0x26635d['push'](_0x26635d['shift']());}};_0xec5b1(++_0x30913c);}(_0x00f4,0x179));var _0x400f=function(_0x11bec8,_0x3401aa){_0x11bec8=_0x11bec8-0x0;var _0x4f2c80=_0x00f4[_0x11bec8];return _0x4f2c80;};'use strict';var _=require(_0x400f('0x0'));var util=require(_0x400f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x400f('0x2'));var BPromise=require(_0x400f('0x3'));var rp=require(_0x400f('0x4'));var fs=require('fs');var path=require(_0x400f('0x5'));var rimraf=require(_0x400f('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x19938b,_0x4cc7e7){return _0x19938b[_0x400f('0x7')](_0x400f('0x8'),attributes,{'tableName':_0x400f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba86=['define','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xba86,0x91));var _0x6ba8=function(_0x961a0b,_0x5cf304){_0x961a0b=_0x961a0b-0x0;var _0x2d5d9c=_0xba86[_0x961a0b];return _0x2d5d9c;};'use strict';var _=require('lodash');var util=require(_0x6ba8('0x0'));var logger=require(_0x6ba8('0x1'))(_0x6ba8('0x2'));var moment=require(_0x6ba8('0x3'));var BPromise=require(_0x6ba8('0x4'));var rp=require(_0x6ba8('0x5'));var fs=require('fs');var path=require(_0x6ba8('0x6'));var rimraf=require(_0x6ba8('0x7'));var config=require(_0x6ba8('0x8'));var attributes=require(_0x6ba8('0x9'));module[_0x6ba8('0xa')]=function(_0x4eff48,_0x40c25b){return _0x4eff48[_0x6ba8('0xb')]('UserMailQueue',attributes,{'tableName':_0x6ba8('0xc'),'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 0d94f1e..13e7a23 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x225395,_0x392a7c){var _0x4ea7f0=function(_0x2dc880){while(--_0x2dc880){_0x225395['push'](_0x225395['shift']());}};_0x4ea7f0(++_0x392a7c);}(_0xa41a,0x6b));var _0xaa41=function(_0x3f6fbf,_0x7a2cbd){_0x3f6fbf=_0x3f6fbf-0x0;var _0x271e91=_0xa41a[_0x3f6fbf];return _0x271e91;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ 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','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b9c16,_0x423334){var _0x2ea719=function(_0x5345ba){while(--_0x5345ba){_0x5b9c16['push'](_0x5b9c16['shift']());}};_0x2ea719(++_0x423334);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\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/userNotification/index.js b/server/api/userNotification/index.js index a0096b9..4105c2c 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 _0x790c=['../../components/auth/service','../../config/environment','./userNotification.controller','exports','multer','util','express','Router','fs-extra'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0x790c,0x1d8));var _0xc790=function(_0x376986,_0x5ce3e4){_0x376986=_0x376986-0x0;var _0x2bc214=_0x790c[_0x376986];return _0x2bc214;};'use strict';var multer=require(_0xc790('0x0'));var util=require(_0xc790('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc790('0x2'));var router=express[_0xc790('0x3')]();var fs_extra=require(_0xc790('0x4'));var auth=require(_0xc790('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc790('0x6'));var controller=require(_0xc790('0x7'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xc790('0x8')]=router; \ No newline at end of file +var _0xe88b=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','sendUserNotification'];(function(_0x2f23dc,_0x282231){var _0x5dd3d0=function(_0x782f86){while(--_0x782f86){_0x2f23dc['push'](_0x2f23dc['shift']());}};_0x5dd3d0(++_0x282231);}(_0xe88b,0x137));var _0xbe88=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xe88b[_0x16539a];return _0x200796;};'use strict';var multer=require(_0xbe88('0x0'));var util=require(_0xbe88('0x1'));var path=require('path');var timeout=require(_0xbe88('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe88('0x3'));var auth=require(_0xbe88('0x4'));var interaction=require(_0xbe88('0x5'));var config=require('../../config/environment');var controller=require(_0xbe88('0x6'));router[_0xbe88('0x7')]('/',auth['isAuthenticated'](),controller[_0xbe88('0x8')]);module[_0xbe88('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7ee37c0..45fd53a 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 _0xda37=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x4c3729,_0x389e36){var _0x1f1d1a=function(_0x3376f5){while(--_0x3376f5){_0x4c3729['push'](_0x4c3729['shift']());}};_0x1f1d1a(++_0x389e36);}(_0xda37,0x12f));var _0x7da3=function(_0x69df31,_0x19a0f0){_0x69df31=_0x69df31-0x0;var _0x56b6c0=_0xda37[_0x69df31];return _0x56b6c0;};'use strict';var Sequelize=require(_0x7da3('0x0'));module[_0x7da3('0x1')]={'body':{'type':Sequelize[_0x7da3('0x2')]},'senderName':{'type':Sequelize[_0x7da3('0x3')]},'recipientsId':{'type':Sequelize[_0x7da3('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x7da3('0x4')]}}; \ No newline at end of file +var _0xe28f=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x4648d0,_0x111f70){var _0x43e744=function(_0x45bae5){while(--_0x45bae5){_0x4648d0['push'](_0x4648d0['shift']());}};_0x43e744(++_0x111f70);}(_0xe28f,0x188));var _0xfe28=function(_0x1c9379,_0x457f4b){_0x1c9379=_0x1c9379-0x0;var _0xef4b41=_0xe28f[_0x1c9379];return _0xef4b41;};'use strict';var Sequelize=require(_0xfe28('0x0'));module['exports']={'body':{'type':Sequelize[_0xfe28('0x1')]},'senderName':{'type':Sequelize[_0xfe28('0x2')]},'recipientsId':{'type':Sequelize[_0xfe28('0x1')]},'recipientsDescription':{'type':Sequelize[_0xfe28('0x2')]},'beep':{'type':Sequelize[_0xfe28('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5ca3e49..1425adf 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 _0x9b9a=['set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipientsDescription','forEach','recipient','catch','Template','findOne','html','render','toLowerCase','User','union','queue','Queue','ids','push','all','flatten','getAgents','map','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x9b9a,0x170));var _0xa9b9=function(_0x31fd4a,_0x29456e){_0x31fd4a=_0x31fd4a-0x0;var _0x5038c7=_0x9b9a[_0x31fd4a];return _0x5038c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9b9('0x0'));var zipdir=require(_0xa9b9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa9b9('0x2'));var Mustache=require('mustache');var util=require(_0xa9b9('0x3'));var path=require(_0xa9b9('0x4'));var sox=require(_0xa9b9('0x5'));var csv=require(_0xa9b9('0x6'));var ejs=require(_0xa9b9('0x7'));var fs=require('fs');var fs_extra=require(_0xa9b9('0x8'));var _=require(_0xa9b9('0x9'));var squel=require(_0xa9b9('0xa'));var crypto=require(_0xa9b9('0xb'));var jsforce=require(_0xa9b9('0xc'));var deskjs=require(_0xa9b9('0xd'));var toCsv=require(_0xa9b9('0x6'));var querystring=require(_0xa9b9('0xe'));var Papa=require(_0xa9b9('0xf'));var Redis=require('ioredis');var authService=require(_0xa9b9('0x10'));var qs=require(_0xa9b9('0x11'));var as=require(_0xa9b9('0x12'));var hardwareService=require(_0xa9b9('0x13'));var logger=require('../../config/logger')(_0xa9b9('0x14'));var utils=require(_0xa9b9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa9b9('0x16'));var db=require(_0xa9b9('0x17'))['db'];config[_0xa9b9('0x18')]=_[_0xa9b9('0x19')](config[_0xa9b9('0x18')],{'host':_0xa9b9('0x1a'),'port':0x18eb});var socket=require(_0xa9b9('0x1b'))(new Redis(config[_0xa9b9('0x18')]));require(_0xa9b9('0x1c'))[_0xa9b9('0x1d')](socket);function respondWithStatusCode(_0x9962fc,_0x49e1fd){_0x49e1fd=_0x49e1fd||0xcc;return function(_0x15febf){if(_0x15febf){return _0x9962fc['sendStatus'](_0x49e1fd);}return _0x9962fc[_0xa9b9('0x1e')](_0x49e1fd)[_0xa9b9('0x1f')]();};}function respondWithResult(_0x3e7477,_0x14ee30){_0x14ee30=_0x14ee30||0xc8;return function(_0x744ab8){if(_0x744ab8){return _0x3e7477['status'](_0x14ee30)[_0xa9b9('0x20')](_0x744ab8);}};}function respondWithFilteredResult(_0x2d5a48,_0x2b3245){return function(_0xef6810){if(_0xef6810){var _0x1e9d77=typeof _0x2b3245[_0xa9b9('0x21')]===_0xa9b9('0x22')&&typeof _0x2b3245[_0xa9b9('0x23')]==='undefined';var _0x5da2ef=_0xef6810['count'];var _0x56caf2=_0x1e9d77?0x0:_0x2b3245[_0xa9b9('0x21')];var _0x4e7820=_0x1e9d77?_0xef6810['count']:_0x2b3245[_0xa9b9('0x21')]+_0x2b3245[_0xa9b9('0x23')];var _0x43c809;if(_0x4e7820>=_0x5da2ef){_0x4e7820=_0x5da2ef;_0x43c809=0xc8;}else{_0x43c809=0xce;}_0x2d5a48[_0xa9b9('0x1e')](_0x43c809);return _0x2d5a48[_0xa9b9('0x24')](_0xa9b9('0x25'),_0x56caf2+'-'+_0x4e7820+'/'+_0x5da2ef)['json'](_0xef6810);}return null;};}function patchUpdates(_0x4c9d26){return function(_0x4c13ae){try{jsonpatch[_0xa9b9('0x26')](_0x4c13ae,_0x4c9d26,!![]);}catch(_0x5d6402){return BPromise[_0xa9b9('0x27')](_0x5d6402);}return _0x4c13ae['save']();};}function saveUpdates(_0x397e24,_0x319b2a){return function(_0x3ca254){if(_0x3ca254){return _0x3ca254[_0xa9b9('0x28')](_0x397e24)['then'](function(_0x1b89a5){return _0x1b89a5;});}return null;};}function removeEntity(_0x133971,_0x15aa1e){return function(_0x32693a){if(_0x32693a){return _0x32693a[_0xa9b9('0x29')]()[_0xa9b9('0x2a')](function(){_0x133971[_0xa9b9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1b37,_0x2be11a){return function(_0x361e6c){if(!_0x361e6c){_0x3b1b37['sendStatus'](0x194);}return _0x361e6c;};}function handleError(_0x39b8a8,_0x3a6ee7){_0x3a6ee7=_0x3a6ee7||0x1f4;return function(_0x15fd84){logger[_0xa9b9('0x2b')](_0x15fd84[_0xa9b9('0x2c')]);if(_0x15fd84[_0xa9b9('0x2d')]){delete _0x15fd84['name'];}_0x39b8a8[_0xa9b9('0x1e')](_0x3a6ee7)[_0xa9b9('0x2e')](_0x15fd84);};}exports[_0xa9b9('0x2f')]=function(_0x300ebb,_0x4d7d28,_0x3cf289){if(!_0x300ebb[_0xa9b9('0x30')][_0xa9b9('0x31')](_0xa9b9('0x32'))&&!_0x300ebb[_0xa9b9('0x30')][_0xa9b9('0x31')](_0xa9b9('0x33'))){throw new db[(_0xa9b9('0x34'))][(_0xa9b9('0x35'))](_0xa9b9('0x36'));}else{if(_0x300ebb[_0xa9b9('0x30')][_0xa9b9('0x31')](_0xa9b9('0x33'))&&!_0x300ebb[_0xa9b9('0x30')][_0xa9b9('0x31')](_0xa9b9('0x37'))){throw new db[(_0xa9b9('0x34'))][(_0xa9b9('0x35'))](_0xa9b9('0x38'));}if(!_0x300ebb[_0xa9b9('0x30')][_0xa9b9('0x31')](_0xa9b9('0x39'))){throw new db[(_0xa9b9('0x34'))]['ValidationError'](_0xa9b9('0x3a'));}else{try{var _0x26a723=JSON[_0xa9b9('0x3b')](_0x300ebb[_0xa9b9('0x30')][_0xa9b9('0x39')]);}catch(_0x3b504f){logger[_0xa9b9('0x2b')](_0x3b504f);throw new db[(_0xa9b9('0x34'))][(_0xa9b9('0x35'))](_0xa9b9('0x3c'));}var _0x5ee594=[_0xa9b9('0x3d'),_0xa9b9('0x3e'),_0xa9b9('0x3f'),'openchannelqueue',_0xa9b9('0x40'),_0xa9b9('0x41'),_0xa9b9('0x42'),_0xa9b9('0x43'),_0xa9b9('0x44')];if(_[_0xa9b9('0x45')](_0x26a723,function(_0x1bed3b){return!_[_0xa9b9('0x46')](_0x5ee594,_0x1bed3b[_0xa9b9('0x47')]['toLowerCase']());})){throw new db[(_0xa9b9('0x34'))][(_0xa9b9('0x35'))](_0xa9b9('0x48'));}}}var _0xdb9a3={};_0xdb9a3[_0xa9b9('0x49')]=_0x300ebb['body'][_0xa9b9('0x31')](_0xa9b9('0x49'))?_0x300ebb[_0xa9b9('0x30')][_0xa9b9('0x49')]:_0x300ebb[_0xa9b9('0x44')]['fullname'];_0xdb9a3['recipientsDescription']=_['isEmpty'](_0x300ebb[_0xa9b9('0x30')]['recipientsDescription'])?null:_0x300ebb[_0xa9b9('0x30')]['recipientsDescription'];_0xdb9a3[_0xa9b9('0x4a')]=_0x300ebb['body'][_0xa9b9('0x4a')]||![];_0xdb9a3['SenderId']=_0x300ebb[_0xa9b9('0x44')]['id'];return getContent(_0x300ebb['body'])[_0xa9b9('0x2a')](function(_0x215a92){_0xdb9a3[_0xa9b9('0x30')]=_0x215a92;return getRecipients(_0x26a723);})[_0xa9b9('0x2a')](function(_0x4e95bc){_0xdb9a3[_0xa9b9('0x4b')]=_[_0xa9b9('0x4c')](_0x4e95bc)[_0xa9b9('0x4d')](',');return db[_0xa9b9('0x4e')][_0xa9b9('0x4f')](function(_0x3ff511){return db[_0xa9b9('0x50')][_0xa9b9('0x51')](_0xdb9a3,{'raw':!![],'transaction':_0x3ff511})[_0xa9b9('0x2a')](function(_0x578f74){var _0x19231d={'sender':_0xdb9a3[_0xa9b9('0x49')],'description':_0xdb9a3[_0xa9b9('0x52')],'content':_0xdb9a3[_0xa9b9('0x30')],'beep':_0xdb9a3[_0xa9b9('0x4a')]};_0x4e95bc[_0xa9b9('0x53')](function(_0x588d3e){_0x19231d[_0xa9b9('0x54')]=_0x588d3e;socket['emit']('userNotification:send',_0x19231d);});return _0x578f74;});});})[_0xa9b9('0x2a')](respondWithResult(_0x4d7d28,0xc9))[_0xa9b9('0x55')](handleError(_0x4d7d28,null));};function getContent(_0x25431f){return new BPromise(function(_0x4a1760,_0x2aeb5d){if(_0x25431f[_0xa9b9('0x32')]){_0x4a1760(_0x25431f[_0xa9b9('0x32')]);return;}return db[_0xa9b9('0x56')][_0xa9b9('0x57')]({'attributes':[_0xa9b9('0x58')],'where':{'id':_0x25431f[_0xa9b9('0x33')]},'raw':!![]})[_0xa9b9('0x2a')](function(_0x4825bd){if(!_0x4825bd)throw new db[(_0xa9b9('0x34'))][(_0xa9b9('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x238d8c=Mustache[_0xa9b9('0x59')](_0x4825bd[_0xa9b9('0x58')],_0x25431f['view']);_0x4a1760(_0x238d8c);})[_0xa9b9('0x55')](function(_0x18bc32){_0x2aeb5d(_0x18bc32);});});}function getRecipients(_0x29abb3){return new BPromise(function(_0x551265,_0x40e6f6){var _0x42bddf=[];var _0xcec649=[];_0x29abb3['forEach'](function(_0x2a4f8a){var _0x4def67=_['startCase'](_0x2a4f8a[_0xa9b9('0x47')][_0xa9b9('0x5a')]());if(_0x4def67===_0xa9b9('0x5b')){_0x42bddf=_[_0xa9b9('0x5c')](_0x42bddf,_0x2a4f8a['ids']);}else{if(_[_0xa9b9('0x46')](_0x4def67,_0xa9b9('0x5d')))_0x4def67=_0x4def67['replace'](_0xa9b9('0x5d'),_0xa9b9('0x5e'));_0x2a4f8a[_0xa9b9('0x5f')]['forEach'](function(_0x378dbb){_0xcec649[_0xa9b9('0x60')](getAgents(_0x4def67,_0x378dbb));});}});return BPromise[_0xa9b9('0x61')](_0xcec649)[_0xa9b9('0x2a')](function(_0x10a5e1){_0x42bddf=_[_0xa9b9('0x5c')](_0x42bddf,_[_0xa9b9('0x62')](_0x10a5e1));_0x551265(_0x42bddf);})[_0xa9b9('0x55')](function(_0x218d2e){_0x40e6f6(_0x218d2e);});});}function getAgents(_0x1539ce,_0x2916e7){return new BPromise(function(_0x5e9917,_0x2a2935){return db[_0x1539ce][_0xa9b9('0x57')]({'where':{'id':_0x2916e7}})[_0xa9b9('0x2a')](function(_0x616555){return _0x616555[_0xa9b9('0x63')]({'attributes':['id'],'raw':!![]})[_0xa9b9('0x2a')](function(_0xbbbe33){var _0x44f866=_[_0xa9b9('0x64')](_0xbbbe33,'id');_0x5e9917(_0x44f866);});})['catch'](function(_0x49cbc0){_0x2a2935(_0x49cbc0);});});} \ No newline at end of file +var _0x005a=['SenderId','user','recipientsId','sequelize','transaction','UserNotification','forEach','recipient','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','model','User','union','ids','queue','replace','Queue','all','flatten','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','view','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep'];(function(_0x5e572e,_0x3a6a6f){var _0x262395=function(_0x22a482){while(--_0x22a482){_0x5e572e['push'](_0x5e572e['shift']());}};_0x262395(++_0x3a6a6f);}(_0x005a,0x192));var _0xa005=function(_0x86c6fb,_0x308ef0){_0x86c6fb=_0x86c6fb-0x0;var _0x5df6ff=_0x005a[_0x86c6fb];return _0x5df6ff;};'use strict';var emlformat=require(_0xa005('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa005('0x1'));var jsonpatch=require(_0xa005('0x2'));var rp=require(_0xa005('0x3'));var moment=require(_0xa005('0x4'));var BPromise=require(_0xa005('0x5'));var Mustache=require(_0xa005('0x6'));var util=require(_0xa005('0x7'));var path=require(_0xa005('0x8'));var sox=require(_0xa005('0x9'));var csv=require(_0xa005('0xa'));var ejs=require(_0xa005('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa005('0xc'));var squel=require(_0xa005('0xd'));var crypto=require(_0xa005('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa005('0xf'));var toCsv=require(_0xa005('0xa'));var querystring=require(_0xa005('0x10'));var Papa=require(_0xa005('0x11'));var Redis=require(_0xa005('0x12'));var authService=require(_0xa005('0x13'));var qs=require(_0xa005('0x14'));var as=require(_0xa005('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa005('0x16'))(_0xa005('0x17'));var utils=require(_0xa005('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa005('0x19'));var db=require('../../mysqldb')['db'];config[_0xa005('0x1a')]=_['defaults'](config[_0xa005('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xa005('0x1b'))(new Redis(config['redis']));require('./userNotification.socket')[_0xa005('0x1c')](socket);function respondWithStatusCode(_0x4ce9d3,_0x4e348b){_0x4e348b=_0x4e348b||0xcc;return function(_0x2706ce){if(_0x2706ce){return _0x4ce9d3[_0xa005('0x1d')](_0x4e348b);}return _0x4ce9d3[_0xa005('0x1e')](_0x4e348b)['end']();};}function respondWithResult(_0x4a684b,_0x294c31){_0x294c31=_0x294c31||0xc8;return function(_0x5c9162){if(_0x5c9162){return _0x4a684b[_0xa005('0x1e')](_0x294c31)[_0xa005('0x1f')](_0x5c9162);}};}function respondWithFilteredResult(_0x165dd3,_0x1fd87b){return function(_0x1b7734){if(_0x1b7734){var _0x1551ff=typeof _0x1fd87b[_0xa005('0x20')]==='undefined'&&typeof _0x1fd87b[_0xa005('0x21')]===_0xa005('0x22');var _0x30a455=_0x1b7734['count'];var _0x5d53a4=_0x1551ff?0x0:_0x1fd87b[_0xa005('0x20')];var _0x5144d2=_0x1551ff?_0x1b7734['count']:_0x1fd87b[_0xa005('0x20')]+_0x1fd87b['limit'];var _0x2bba74;if(_0x5144d2>=_0x30a455){_0x5144d2=_0x30a455;_0x2bba74=0xc8;}else{_0x2bba74=0xce;}_0x165dd3['status'](_0x2bba74);return _0x165dd3[_0xa005('0x23')](_0xa005('0x24'),_0x5d53a4+'-'+_0x5144d2+'/'+_0x30a455)[_0xa005('0x1f')](_0x1b7734);}return null;};}function patchUpdates(_0x24ea6e){return function(_0x436bae){try{jsonpatch[_0xa005('0x25')](_0x436bae,_0x24ea6e,!![]);}catch(_0x272d53){return BPromise[_0xa005('0x26')](_0x272d53);}return _0x436bae[_0xa005('0x27')]();};}function saveUpdates(_0x419c4f,_0x24bdb6){return function(_0x2a278a){if(_0x2a278a){return _0x2a278a['update'](_0x419c4f)[_0xa005('0x28')](function(_0x114c17){return _0x114c17;});}return null;};}function removeEntity(_0x3cd6c3,_0xefe3e){return function(_0x3db9ff){if(_0x3db9ff){return _0x3db9ff['destroy']()[_0xa005('0x28')](function(){_0x3cd6c3[_0xa005('0x1e')](0xcc)[_0xa005('0x29')]();});}};}function handleEntityNotFound(_0x52aefb,_0x123285){return function(_0x57e953){if(!_0x57e953){_0x52aefb['sendStatus'](0x194);}return _0x57e953;};}function handleError(_0x29f700,_0x46e3ec){_0x46e3ec=_0x46e3ec||0x1f4;return function(_0x20231d){logger[_0xa005('0x2a')](_0x20231d[_0xa005('0x2b')]);if(_0x20231d[_0xa005('0x2c')]){delete _0x20231d['name'];}_0x29f700[_0xa005('0x1e')](_0x46e3ec)[_0xa005('0x2d')](_0x20231d);};}exports['sendUserNotification']=function(_0x5838e0,_0x28bcaa,_0x2da52f){if(!_0x5838e0['body'][_0xa005('0x2e')](_0xa005('0x2f'))&&!_0x5838e0[_0xa005('0x30')]['hasOwnProperty'](_0xa005('0x31'))){throw new db[(_0xa005('0x32'))][(_0xa005('0x33'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5838e0['body']['hasOwnProperty']('TemplateId')&&!_0x5838e0[_0xa005('0x30')][_0xa005('0x2e')](_0xa005('0x34'))){throw new db[(_0xa005('0x32'))][(_0xa005('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5838e0[_0xa005('0x30')]['hasOwnProperty']('recipients')){throw new db[(_0xa005('0x32'))][(_0xa005('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x220dff=JSON['parse'](_0x5838e0[_0xa005('0x30')][_0xa005('0x35')]);}catch(_0x10a898){logger['error'](_0x10a898);throw new db[(_0xa005('0x32'))][(_0xa005('0x33'))](_0xa005('0x36'));}var _0x39bb9f=[_0xa005('0x37'),_0xa005('0x38'),_0xa005('0x39'),_0xa005('0x3a'),'smsqueue',_0xa005('0x3b'),'whatsappqueue','team','user'];if(_[_0xa005('0x3c')](_0x220dff,function(_0x30e8ed){return!_[_0xa005('0x3d')](_0x39bb9f,_0x30e8ed['model'][_0xa005('0x3e')]());})){throw new db[(_0xa005('0x32'))][(_0xa005('0x33'))](_0xa005('0x3f'));}}}var _0x1c4d56={};_0x1c4d56[_0xa005('0x40')]=_0x5838e0[_0xa005('0x30')]['hasOwnProperty'](_0xa005('0x40'))?_0x5838e0[_0xa005('0x30')][_0xa005('0x40')]:_0x5838e0['user'][_0xa005('0x41')];_0x1c4d56['recipientsDescription']=_['isEmpty'](_0x5838e0['body'][_0xa005('0x42')])?null:_0x5838e0[_0xa005('0x30')][_0xa005('0x42')];_0x1c4d56[_0xa005('0x43')]=_0x5838e0['body'][_0xa005('0x43')]||![];_0x1c4d56[_0xa005('0x44')]=_0x5838e0[_0xa005('0x45')]['id'];return getContent(_0x5838e0[_0xa005('0x30')])['then'](function(_0x11cd2d){_0x1c4d56[_0xa005('0x30')]=_0x11cd2d;return getRecipients(_0x220dff);})[_0xa005('0x28')](function(_0x1db75e){_0x1c4d56[_0xa005('0x46')]=_['sortBy'](_0x1db75e)['join'](',');return db[_0xa005('0x47')][_0xa005('0x48')](function(_0x13455c){return db[_0xa005('0x49')]['create'](_0x1c4d56,{'raw':!![],'transaction':_0x13455c})[_0xa005('0x28')](function(_0x53d9c6){var _0x345588={'sender':_0x1c4d56[_0xa005('0x40')],'description':_0x1c4d56['recipientsDescription'],'content':_0x1c4d56[_0xa005('0x30')],'beep':_0x1c4d56['beep']};_0x1db75e[_0xa005('0x4a')](function(_0x3113ca){_0x345588[_0xa005('0x4b')]=_0x3113ca;socket['emit'](_0xa005('0x4c'),_0x345588);});return _0x53d9c6;});});})[_0xa005('0x28')](respondWithResult(_0x28bcaa,0xc9))[_0xa005('0x4d')](handleError(_0x28bcaa,null));};function getContent(_0x59ce73){return new BPromise(function(_0x47635a,_0x18e5e4){if(_0x59ce73[_0xa005('0x2f')]){_0x47635a(_0x59ce73['text']);return;}return db[_0xa005('0x4e')][_0xa005('0x4f')]({'attributes':['html'],'where':{'id':_0x59ce73[_0xa005('0x31')]},'raw':!![]})[_0xa005('0x28')](function(_0x415a8d){if(!_0x415a8d)throw new db[(_0xa005('0x32'))][(_0xa005('0x33'))](_0xa005('0x50'));var _0x15ae1b=Mustache[_0xa005('0x51')](_0x415a8d[_0xa005('0x52')],_0x59ce73[_0xa005('0x34')]);_0x47635a(_0x15ae1b);})[_0xa005('0x4d')](function(_0x5551f1){_0x18e5e4(_0x5551f1);});});}function getRecipients(_0x31dab3){return new BPromise(function(_0x2b4abd,_0x4cfe8b){var _0x1f8d6f=[];var _0x557346=[];_0x31dab3['forEach'](function(_0x2eaf0f){var _0x4c5f1e=_['startCase'](_0x2eaf0f[_0xa005('0x53')][_0xa005('0x3e')]());if(_0x4c5f1e===_0xa005('0x54')){_0x1f8d6f=_[_0xa005('0x55')](_0x1f8d6f,_0x2eaf0f[_0xa005('0x56')]);}else{if(_['includes'](_0x4c5f1e,_0xa005('0x57')))_0x4c5f1e=_0x4c5f1e[_0xa005('0x58')](_0xa005('0x57'),_0xa005('0x59'));_0x2eaf0f['ids'][_0xa005('0x4a')](function(_0xaed027){_0x557346['push'](getAgents(_0x4c5f1e,_0xaed027));});}});return BPromise[_0xa005('0x5a')](_0x557346)[_0xa005('0x28')](function(_0x5c97bb){_0x1f8d6f=_['union'](_0x1f8d6f,_[_0xa005('0x5b')](_0x5c97bb));_0x2b4abd(_0x1f8d6f);})[_0xa005('0x4d')](function(_0x5adb39){_0x4cfe8b(_0x5adb39);});});}function getAgents(_0x3cf2b5,_0x280b76){return new BPromise(function(_0x1804aa,_0x5f564b){return db[_0x3cf2b5]['findOne']({'where':{'id':_0x280b76}})[_0xa005('0x28')](function(_0x14084e){return _0x14084e[_0xa005('0x5c')]({'attributes':['id'],'raw':!![]})[_0xa005('0x28')](function(_0x329d1d){var _0x198eb0=_[_0xa005('0x5d')](_0x329d1d,'id');_0x1804aa(_0x198eb0);});})['catch'](function(_0x5cdf54){_0x5f564b(_0x5cdf54);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 490cca0..a4fd100 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 _0x9094=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x323fca,_0x369c53){var _0x2f4122=function(_0x8d8818){while(--_0x8d8818){_0x323fca['push'](_0x323fca['shift']());}};_0x2f4122(++_0x369c53);}(_0x9094,0xa0));var _0x4909=function(_0x47240f,_0x2bfc28){_0x47240f=_0x47240f-0x0;var _0x39193b=_0x9094[_0x47240f];return _0x39193b;};'use strict';var EventEmitter=require(_0x4909('0x0'));var UserNotification=require(_0x4909('0x1'))['db'][_0x4909('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x4909('0x3')](0x0);var events={'afterCreate':_0x4909('0x4'),'afterUpdate':_0x4909('0x5'),'afterDestroy':_0x4909('0x6')};function emitEvent(_0x490d04){return function(_0x3fed13,_0x2bde2a,_0x5c0253){UserNotificationEvents[_0x4909('0x7')](_0x490d04+':'+_0x3fed13['id'],_0x3fed13);UserNotificationEvents['emit'](_0x490d04,_0x3fed13);_0x5c0253(null);};}for(var e in events){if(events[_0x4909('0x8')](e)){var event=events[e];UserNotification[_0x4909('0x9')](e,emitEvent(event));}}module[_0x4909('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x094d=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x094d,0x1d1));var _0xd094=function(_0x20d39b,_0xa1e8c2){_0x20d39b=_0x20d39b-0x0;var _0x422960=_0x094d[_0x20d39b];return _0x422960;};'use strict';var EventEmitter=require(_0xd094('0x0'));var UserNotification=require(_0xd094('0x1'))['db'][_0xd094('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd094('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd094('0x4'),'afterDestroy':_0xd094('0x5')};function emitEvent(_0x2a6885){return function(_0x1d185e,_0x22682a,_0x3e68b9){UserNotificationEvents[_0xd094('0x6')](_0x2a6885+':'+_0x1d185e['id'],_0x1d185e);UserNotificationEvents['emit'](_0x2a6885,_0x1d185e);_0x3e68b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xd094('0x7')](e,emitEvent(event));}}module[_0xd094('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 0cf24a5..e3b3674 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 _0x31a7=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x31a7,0x184));var _0x731a=function(_0x11cb7,_0x533aec){_0x11cb7=_0x11cb7-0x0;var _0x526eb9=_0x31a7[_0x11cb7];return _0x526eb9;};'use strict';var _=require(_0x731a('0x0'));var util=require(_0x731a('0x1'));var logger=require(_0x731a('0x2'))(_0x731a('0x3'));var moment=require('moment');var BPromise=require(_0x731a('0x4'));var rp=require(_0x731a('0x5'));var fs=require('fs');var path=require(_0x731a('0x6'));var rimraf=require(_0x731a('0x7'));var config=require(_0x731a('0x8'));var attributes=require('./userNotification.attributes');module[_0x731a('0x9')]=function(_0x4ac01f,_0x2b997d){return _0x4ac01f[_0x731a('0xa')](_0x731a('0xb'),attributes,{'tableName':_0x731a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x731a('0xd'),'collate':_0x731a('0xe')});}; \ No newline at end of file +var _0x72f1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','util','api'];(function(_0x2d7aa7,_0x1f313c){var _0x45e2ea=function(_0x2cd13b){while(--_0x2cd13b){_0x2d7aa7['push'](_0x2d7aa7['shift']());}};_0x45e2ea(++_0x1f313c);}(_0x72f1,0x17e));var _0x172f=function(_0x7fc6ca,_0x4283a4){_0x7fc6ca=_0x7fc6ca-0x0;var _0x2d9baf=_0x72f1[_0x7fc6ca];return _0x2d9baf;};'use strict';var _=require('lodash');var util=require(_0x172f('0x0'));var logger=require('../../config/logger')(_0x172f('0x1'));var moment=require(_0x172f('0x2'));var BPromise=require(_0x172f('0x3'));var rp=require(_0x172f('0x4'));var fs=require('fs');var path=require(_0x172f('0x5'));var rimraf=require(_0x172f('0x6'));var config=require(_0x172f('0x7'));var attributes=require('./userNotification.attributes');module[_0x172f('0x8')]=function(_0x2a7a1d,_0xf709b0){return _0x2a7a1d[_0x172f('0x9')](_0x172f('0xa'),attributes,{'tableName':_0x172f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 3bce5a0..7928611 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 _0x1e64=['register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','UserNotification,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e64,0x1ae));var _0x41e6=function(_0x443418,_0x972308){_0x443418=_0x443418-0x0;var _0x56ca4a=_0x1e64[_0x443418];return _0x56ca4a;};'use strict';var _=require('lodash');var util=require(_0x41e6('0x0'));var moment=require(_0x41e6('0x1'));var BPromise=require(_0x41e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41e6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x41e6('0x4'));var logger=require(_0x41e6('0x5'))(_0x41e6('0x6'));var config=require(_0x41e6('0x7'));var jayson=require(_0x41e6('0x8'));var client=jayson['client'][_0x41e6('0x9')]({'port':0x232a});config[_0x41e6('0xa')]=_['defaults'](config[_0x41e6('0xa')],{'host':_0x41e6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x41e6('0xc')](socket);function respondWithRpcPromise(_0x10b076,_0x26af40,_0x16fe45){return new BPromise(function(_0x338c35,_0xcebd56){return client[_0x41e6('0xd')](_0x10b076,_0x16fe45)[_0x41e6('0xe')](function(_0x198d59){logger[_0x41e6('0xf')]('UserNotification,\x20%s,\x20%s',_0x26af40,_0x41e6('0x10'));logger[_0x41e6('0x11')](_0x41e6('0x12'),_0x26af40,_0x41e6('0x10'),JSON[_0x41e6('0x13')](_0x198d59));if(_0x198d59['error']){if(_0x198d59['error'][_0x41e6('0x14')]===0x1f4){logger[_0x41e6('0x15')](_0x41e6('0x16'),_0x26af40,_0x198d59[_0x41e6('0x15')][_0x41e6('0x17')]);return _0xcebd56(_0x198d59[_0x41e6('0x15')][_0x41e6('0x17')]);}logger[_0x41e6('0x15')]('UserNotification,\x20%s,\x20%s',_0x26af40,_0x198d59[_0x41e6('0x15')]['message']);return _0x338c35(_0x198d59[_0x41e6('0x15')][_0x41e6('0x17')]);}else{logger[_0x41e6('0xf')](_0x41e6('0x16'),_0x26af40,_0x41e6('0x10'));_0x338c35(_0x198d59[_0x41e6('0x18')]['message']);}})[_0x41e6('0x19')](function(_0x5aa702){logger['error'](_0x41e6('0x16'),_0x26af40,_0x5aa702);_0xcebd56(_0x5aa702);});});} \ No newline at end of file +var _0x2311=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x582896,_0x37720d){var _0xa952bb=function(_0x3fc05f){while(--_0x3fc05f){_0x582896['push'](_0x582896['shift']());}};_0xa952bb(++_0x37720d);}(_0x2311,0x149));var _0x1231=function(_0x5a4fc0,_0x54da92){_0x5a4fc0=_0x5a4fc0-0x0;var _0x3c49d8=_0x2311[_0x5a4fc0];return _0x3c49d8;};'use strict';var _=require(_0x1231('0x0'));var util=require('util');var moment=require(_0x1231('0x1'));var BPromise=require('bluebird');var rs=require(_0x1231('0x2'));var fs=require('fs');var Redis=require(_0x1231('0x3'));var db=require(_0x1231('0x4'))['db'];var utils=require(_0x1231('0x5'));var logger=require('../../config/logger')(_0x1231('0x6'));var config=require(_0x1231('0x7'));var jayson=require(_0x1231('0x8'));var client=jayson[_0x1231('0x9')]['http']({'port':0x232a});config[_0x1231('0xa')]=_[_0x1231('0xb')](config[_0x1231('0xa')],{'host':_0x1231('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1231('0xa')]));require(_0x1231('0xd'))[_0x1231('0xe')](socket);function respondWithRpcPromise(_0x1cfc00,_0x211abf,_0x866dec){return new BPromise(function(_0x5cc239,_0x531c5f){return client[_0x1231('0xf')](_0x1cfc00,_0x866dec)['then'](function(_0x2293ff){logger[_0x1231('0x10')](_0x1231('0x11'),_0x211abf,_0x1231('0x12'));logger[_0x1231('0x13')](_0x1231('0x14'),_0x211abf,_0x1231('0x12'),JSON[_0x1231('0x15')](_0x2293ff));if(_0x2293ff[_0x1231('0x16')]){if(_0x2293ff[_0x1231('0x16')][_0x1231('0x17')]===0x1f4){logger[_0x1231('0x16')](_0x1231('0x11'),_0x211abf,_0x2293ff[_0x1231('0x16')][_0x1231('0x18')]);return _0x531c5f(_0x2293ff[_0x1231('0x16')][_0x1231('0x18')]);}logger[_0x1231('0x16')](_0x1231('0x11'),_0x211abf,_0x2293ff[_0x1231('0x16')]['message']);return _0x5cc239(_0x2293ff[_0x1231('0x16')][_0x1231('0x18')]);}else{logger[_0x1231('0x10')](_0x1231('0x11'),_0x211abf,_0x1231('0x12'));_0x5cc239(_0x2293ff[_0x1231('0x19')][_0x1231('0x18')]);}})[_0x1231('0x1a')](function(_0x7b8152){logger[_0x1231('0x16')]('UserNotification,\x20%s,\x20%s',_0x211abf,_0x7b8152);_0x531c5f(_0x7b8152);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index b6ab640..eebdfac 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 _0xd7e8=['save','remove','emit','removeListener','./userNotification.events'];(function(_0xb49db5,_0x11332d){var _0x2e3f26=function(_0x1e7bd5){while(--_0x1e7bd5){_0xb49db5['push'](_0xb49db5['shift']());}};_0x2e3f26(++_0x11332d);}(_0xd7e8,0x14e));var _0x8d7e=function(_0x1b5e49,_0x548685){_0x1b5e49=_0x1b5e49-0x0;var _0x4a4953=_0xd7e8[_0x1b5e49];return _0x4a4953;};'use strict';var UserNotificationEvents=require(_0x8d7e('0x0'));var events=[_0x8d7e('0x1'),_0x8d7e('0x2'),'update'];function createListener(_0x191e2c,_0x38244c){return function(_0x2da708){_0x38244c[_0x8d7e('0x3')](_0x191e2c,_0x2da708);};}function removeListener(_0xba0435,_0x1cc248){return function(){UserNotificationEvents[_0x8d7e('0x4')](_0xba0435,_0x1cc248);};}exports['register']=function(_0xb65a00){for(var _0x70da30=0x0,_0x21c279=events['length'];_0x70da30<_0x21c279;_0x70da30++){var _0x1ce874=events[_0x70da30];var _0x4e4a6a=createListener('userNotification:'+_0x1ce874,_0xb65a00);UserNotificationEvents['on'](_0x1ce874,_0x4e4a6a);}}; \ No newline at end of file +var _0x4619=['save','remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x2d69e9,_0xc07bca){var _0x314f39=function(_0x4ea0f2){while(--_0x4ea0f2){_0x2d69e9['push'](_0x2d69e9['shift']());}};_0x314f39(++_0xc07bca);}(_0x4619,0x10d));var _0x9461=function(_0x21185d,_0x16fc02){_0x21185d=_0x21185d-0x0;var _0x164647=_0x4619[_0x21185d];return _0x164647;};'use strict';var UserNotificationEvents=require(_0x9461('0x0'));var events=[_0x9461('0x1'),_0x9461('0x2'),_0x9461('0x3')];function createListener(_0x18d3bd,_0x38835c){return function(_0x404521){_0x38835c[_0x9461('0x4')](_0x18d3bd,_0x404521);};}function removeListener(_0xeb4333,_0x2732e2){return function(){UserNotificationEvents[_0x9461('0x5')](_0xeb4333,_0x2732e2);};}exports[_0x9461('0x6')]=function(_0x507357){for(var _0x4c26c2=0x0,_0x5a2b3b=events[_0x9461('0x7')];_0x4c26c2<_0x5a2b3b;_0x4c26c2++){var _0x52603d=events[_0x4c26c2];var _0x8a577a=createListener(_0x9461('0x8')+_0x52603d,_0x507357);UserNotificationEvents['on'](_0x52603d,_0x8a577a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 8d4a210..68cce4f 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5e6cca,_0x1fc874){var _0x50b54a=function(_0x187f8e){while(--_0x187f8e){_0x5e6cca['push'](_0x5e6cca['shift']());}};_0x50b54a(++_0x1fc874);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xcb91[_0x251e8c];return _0x1e0c1d;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 7cf9b21..eef2722 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 _0xc284=['exports','INTEGER'];(function(_0xddb860,_0x344918){var _0x255df9=function(_0x102c1c){while(--_0x102c1c){_0xddb860['push'](_0xddb860['shift']());}};_0x255df9(++_0x344918);}(_0xc284,0x70));var _0x4c28=function(_0x333d2a,_0x44f39c){_0x333d2a=_0x333d2a-0x0;var _0x5bacbe=_0xc284[_0x333d2a];return _0x5bacbe;};'use strict';var Sequelize=require('sequelize');module[_0x4c28('0x0')]={'penalty':{'type':Sequelize[_0x4c28('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa997=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa997,0x1c4));var _0x7a99=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xa997[_0x7791d5];return _0x5ce288;};'use strict';var Sequelize=require(_0x7a99('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7a99('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 43534c9..9008883 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 _0xf93b=['moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf93b,0x195));var _0xbf93=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0xf93b[_0x2389bc];return _0x170548;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf93('0x0'))(_0xbf93('0x1'));var moment=require(_0xbf93('0x2'));var BPromise=require(_0xbf93('0x3'));var rp=require(_0xbf93('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf93('0x5'));var config=require(_0xbf93('0x6'));var attributes=require(_0xbf93('0x7'));module['exports']=function(_0x30a09d,_0x39941c){return _0x30a09d[_0xbf93('0x8')](_0xbf93('0x9'),attributes,{'tableName':_0xbf93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0082=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x5187ce,_0x5e949c){var _0x235afa=function(_0xee2b4c){while(--_0xee2b4c){_0x5187ce['push'](_0x5187ce['shift']());}};_0x235afa(++_0x5e949c);}(_0x0082,0x79));var _0x2008=function(_0x12641f,_0x1a1821){_0x12641f=_0x12641f-0x0;var _0x12865e=_0x0082[_0x12641f];return _0x12865e;};'use strict';var _=require(_0x2008('0x0'));var util=require(_0x2008('0x1'));var logger=require(_0x2008('0x2'))(_0x2008('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2008('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2008('0x5'));var config=require(_0x2008('0x6'));var attributes=require(_0x2008('0x7'));module['exports']=function(_0x4cfe87,_0x4f5872){return _0x4cfe87[_0x2008('0x8')](_0x2008('0x9'),attributes,{'tableName':_0x2008('0xa'),'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 97ad32b..fd7c6c2 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 _0xf234=['then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x144dbb,_0x3c45de){var _0xac04ed=function(_0x18eb20){while(--_0x18eb20){_0x144dbb['push'](_0x144dbb['shift']());}};_0xac04ed(++_0x3c45de);}(_0xf234,0xeb));var _0x4f23=function(_0x42f844,_0x87db96){_0x42f844=_0x42f844-0x0;var _0x3b0376=_0xf234[_0x42f844];return _0x3b0376;};'use strict';var _=require(_0x4f23('0x0'));var util=require(_0x4f23('0x1'));var moment=require(_0x4f23('0x2'));var BPromise=require(_0x4f23('0x3'));var rs=require(_0x4f23('0x4'));var fs=require('fs');var Redis=require(_0x4f23('0x5'));var db=require(_0x4f23('0x6'))['db'];var utils=require(_0x4f23('0x7'));var logger=require(_0x4f23('0x8'))(_0x4f23('0x9'));var config=require(_0x4f23('0xa'));var jayson=require(_0x4f23('0xb'));var client=jayson[_0x4f23('0xc')][_0x4f23('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5381c2,_0x33ecd2,_0x4b411d){return new BPromise(function(_0x14ad4b,_0x5ee830){return client[_0x4f23('0xe')](_0x5381c2,_0x4b411d)[_0x4f23('0xf')](function(_0x4a3054){logger['info'](_0x4f23('0x10'),_0x33ecd2,_0x4f23('0x11'));logger[_0x4f23('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x33ecd2,_0x4f23('0x11'),JSON[_0x4f23('0x13')](_0x4a3054));if(_0x4a3054['error']){if(_0x4a3054[_0x4f23('0x14')][_0x4f23('0x15')]===0x1f4){logger[_0x4f23('0x14')](_0x4f23('0x10'),_0x33ecd2,_0x4a3054[_0x4f23('0x14')]['message']);return _0x5ee830(_0x4a3054[_0x4f23('0x14')][_0x4f23('0x16')]);}logger[_0x4f23('0x14')](_0x4f23('0x10'),_0x33ecd2,_0x4a3054[_0x4f23('0x14')][_0x4f23('0x16')]);return _0x14ad4b(_0x4a3054[_0x4f23('0x14')][_0x4f23('0x16')]);}else{logger['info'](_0x4f23('0x10'),_0x33ecd2,_0x4f23('0x11'));_0x14ad4b(_0x4a3054[_0x4f23('0x17')]['message']);}})[_0x4f23('0x18')](function(_0x24ccff){logger[_0x4f23('0x14')](_0x4f23('0x10'),_0x33ecd2,_0x24ccff);_0x5ee830(_0x24ccff);});});} \ No newline at end of file +var _0x27a3=['code','error','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x27a3,0x1bd));var _0x327a=function(_0x4d2d28,_0x46cfa0){_0x4d2d28=_0x4d2d28-0x0;var _0x46d989=_0x27a3[_0x4d2d28];return _0x46d989;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x327a('0x0'));var BPromise=require(_0x327a('0x1'));var rs=require(_0x327a('0x2'));var fs=require('fs');var Redis=require(_0x327a('0x3'));var db=require(_0x327a('0x4'))['db'];var utils=require(_0x327a('0x5'));var logger=require(_0x327a('0x6'))(_0x327a('0x7'));var config=require(_0x327a('0x8'));var jayson=require(_0x327a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27c9d0,_0x4a6b8b,_0x5e70b0){return new BPromise(function(_0x13a0ec,_0x2f4ec0){return client['request'](_0x27c9d0,_0x5e70b0)[_0x327a('0xa')](function(_0x49960f){logger['info'](_0x327a('0xb'),_0x4a6b8b,_0x327a('0xc'));logger['debug'](_0x327a('0xd'),_0x4a6b8b,_0x327a('0xc'),JSON[_0x327a('0xe')](_0x49960f));if(_0x49960f['error']){if(_0x49960f['error'][_0x327a('0xf')]===0x1f4){logger[_0x327a('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4a6b8b,_0x49960f[_0x327a('0x10')][_0x327a('0x11')]);return _0x2f4ec0(_0x49960f[_0x327a('0x10')][_0x327a('0x11')]);}logger['error'](_0x327a('0xb'),_0x4a6b8b,_0x49960f[_0x327a('0x10')][_0x327a('0x11')]);return _0x13a0ec(_0x49960f[_0x327a('0x10')][_0x327a('0x11')]);}else{logger[_0x327a('0x12')](_0x327a('0xb'),_0x4a6b8b,_0x327a('0xc'));_0x13a0ec(_0x49960f[_0x327a('0x13')][_0x327a('0x11')]);}})['catch'](function(_0x3ee587){logger[_0x327a('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4a6b8b,_0x3ee587);_0x2f4ec0(_0x3ee587);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 62527b9..4c0d6dc 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 _0x083c=['show','/:id/sections','getSections','/:id/resources','create','post','clone','addSections','addResources','put','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','describe','/:id','isAuthenticated'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x083c,0xf6));var _0xc083=function(_0x4014c8,_0x38efb6){_0x4014c8=_0x4014c8-0x0;var _0x194847=_0x083c[_0x4014c8];return _0x194847;};'use strict';var multer=require(_0xc083('0x0'));var util=require(_0xc083('0x1'));var path=require(_0xc083('0x2'));var timeout=require(_0xc083('0x3'));var express=require('express');var router=express[_0xc083('0x4')]();var fs_extra=require(_0xc083('0x5'));var auth=require(_0xc083('0x6'));var interaction=require(_0xc083('0x7'));var config=require(_0xc083('0x8'));var controller=require(_0xc083('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc083('0xa')](_0xc083('0xb'),auth['isAuthenticated'](),controller[_0xc083('0xc')]);router[_0xc083('0xa')](_0xc083('0xd'),auth[_0xc083('0xe')](),controller[_0xc083('0xf')]);router[_0xc083('0xa')](_0xc083('0x10'),auth['isAuthenticated'](),controller[_0xc083('0x11')]);router['get'](_0xc083('0x12'),auth[_0xc083('0xe')](),controller['getResources']);router['post']('/',auth['isAuthenticated'](),controller[_0xc083('0x13')]);router[_0xc083('0x14')]('/:id/clone',auth[_0xc083('0xe')](),controller[_0xc083('0x15')]);router[_0xc083('0x14')](_0xc083('0x10'),auth['isAuthenticated'](),controller[_0xc083('0x16')]);router['post']('/:id/resources',auth[_0xc083('0xe')](),controller[_0xc083('0x17')]);router[_0xc083('0x18')](_0xc083('0xd'),auth[_0xc083('0xe')](),controller['update']);router['delete'](_0xc083('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc083('0x19')]('/:id/sections',auth[_0xc083('0xe')](),controller[_0xc083('0x1a')]);router[_0xc083('0x19')](_0xc083('0x12'),auth[_0xc083('0xe')](),controller[_0xc083('0x1b')]);module[_0xc083('0x1c')]=router; \ No newline at end of file +var _0x6e7c=['getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeResources','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/sections','/:id/resources'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6e7c,0x9e));var _0xc6e7=function(_0x432723,_0x31e971){_0x432723=_0x432723-0x0;var _0x4f4991=_0x6e7c[_0x432723];return _0x4f4991;};'use strict';var multer=require(_0xc6e7('0x0'));var util=require(_0xc6e7('0x1'));var path=require(_0xc6e7('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6e7('0x3'));var router=express[_0xc6e7('0x4')]();var fs_extra=require(_0xc6e7('0x5'));var auth=require(_0xc6e7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc6e7('0x7'));router['get']('/',auth[_0xc6e7('0x8')](),controller[_0xc6e7('0x9')]);router[_0xc6e7('0xa')](_0xc6e7('0xb'),auth[_0xc6e7('0x8')](),controller[_0xc6e7('0xc')]);router[_0xc6e7('0xa')](_0xc6e7('0xd'),auth[_0xc6e7('0x8')](),controller['show']);router[_0xc6e7('0xa')](_0xc6e7('0xe'),auth[_0xc6e7('0x8')](),controller['getSections']);router['get'](_0xc6e7('0xf'),auth['isAuthenticated'](),controller[_0xc6e7('0x10')]);router[_0xc6e7('0x11')]('/',auth[_0xc6e7('0x8')](),controller[_0xc6e7('0x12')]);router['post'](_0xc6e7('0x13'),auth[_0xc6e7('0x8')](),controller[_0xc6e7('0x14')]);router[_0xc6e7('0x11')](_0xc6e7('0xe'),auth[_0xc6e7('0x8')](),controller[_0xc6e7('0x15')]);router[_0xc6e7('0x11')](_0xc6e7('0xf'),auth[_0xc6e7('0x8')](),controller[_0xc6e7('0x16')]);router[_0xc6e7('0x17')](_0xc6e7('0xd'),auth['isAuthenticated'](),controller[_0xc6e7('0x18')]);router[_0xc6e7('0x19')](_0xc6e7('0xd'),auth[_0xc6e7('0x8')](),controller[_0xc6e7('0x1a')]);router['delete'](_0xc6e7('0xe'),auth[_0xc6e7('0x8')](),controller['removeSections']);router[_0xc6e7('0x19')]('/:id/resources',auth[_0xc6e7('0x8')](),controller[_0xc6e7('0x1b')]);module[_0xc6e7('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 d019301..65444b3 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 _0x9c8f=['BOOLEAN','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x46aa92,_0x1842db){var _0x304426=function(_0x19a85e){while(--_0x19a85e){_0x46aa92['push'](_0x46aa92['shift']());}};_0x304426(++_0x1842db);}(_0x9c8f,0xa3));var _0xf9c8=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x9c8f[_0x438fe1];return _0x3c8e1b;};'use strict';var Sequelize=require('sequelize');module[_0xf9c8('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf9c8('0x1')},'crudPermissions':{'type':Sequelize[_0xf9c8('0x2')],'set':function(_0xf83343){this[_0xf9c8('0x3')](_0xf9c8('0x4'),_0xf83343?_0xf83343[_0xf9c8('0x5')](''):[]);},'get':function(){return this[_0xf9c8('0x6')](_0xf9c8('0x4'))?this[_0xf9c8('0x6')](_0xf9c8('0x4'))[_0xf9c8('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf9c8('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf9c8('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf9c8('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf9c8('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf9c8('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf9c8('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf9c8('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf9c8('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4649=['crudPermissions','join','getDataValue','BOOLEAN','exports','STRING','setDataValue'];(function(_0x3c9d0b,_0x27d5c9){var _0x3a6b71=function(_0x2ae3f2){while(--_0x2ae3f2){_0x3c9d0b['push'](_0x3c9d0b['shift']());}};_0x3a6b71(++_0x27d5c9);}(_0x4649,0x169));var _0x9464=function(_0x1d53d9,_0x13de9f){_0x1d53d9=_0x1d53d9-0x0;var _0x42455d=_0x4649[_0x1d53d9];return _0x42455d;};'use strict';var Sequelize=require('sequelize');module[_0x9464('0x0')]={'name':{'type':Sequelize[_0x9464('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x29af4b){this[_0x9464('0x2')](_0x9464('0x3'),_0x29af4b?_0x29af4b[_0x9464('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x9464('0x3'))?this[_0x9464('0x5')](_0x9464('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9464('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9464('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9464('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9464('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9464('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9464('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9464('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9464('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 6b6edeb..51eedd2 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 _0xd451=['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','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','UserProfile','include','findAll','rows','show','params','includeAll','find','catch','create','clone','updatedAt','crudPermissions','omit','createdAt','sequelize','transaction','body','get','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','destroy','push','removeSections','ids','getSections','enabled','includes','sectionId','subsections','concat','findOne','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','bluebird','util','to-csv','fs-extra','lodash','squel'];(function(_0x39a530,_0x5b8b2e){var _0x485d86=function(_0x1be434){while(--_0x1be434){_0x39a530['push'](_0x39a530['shift']());}};_0x485d86(++_0x5b8b2e);}(_0xd451,0xde));var _0x1d45=function(_0x485b8f,_0x16285c){_0x485b8f=_0x485b8f-0x0;var _0x59d0bb=_0xd451[_0x485b8f];return _0x59d0bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d45('0x0'));var zipdir=require(_0x1d45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1d45('0x2'));var Mustache=require('mustache');var util=require(_0x1d45('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x1d45('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d45('0x5'));var _=require(_0x1d45('0x6'));var squel=require(_0x1d45('0x7'));var crypto=require(_0x1d45('0x8'));var jsforce=require(_0x1d45('0x9'));var deskjs=require(_0x1d45('0xa'));var toCsv=require(_0x1d45('0x4'));var querystring=require(_0x1d45('0xb'));var Papa=require(_0x1d45('0xc'));var Redis=require(_0x1d45('0xd'));var authService=require(_0x1d45('0xe'));var qs=require(_0x1d45('0xf'));var as=require(_0x1d45('0x10'));var hardwareService=require(_0x1d45('0x11'));var logger=require(_0x1d45('0x12'))(_0x1d45('0x13'));var utils=require(_0x1d45('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1d45('0x15'));var db=require(_0x1d45('0x16'))['db'];config[_0x1d45('0x17')]=_[_0x1d45('0x18')](config[_0x1d45('0x17')],{'host':_0x1d45('0x19'),'port':0x18eb});var socket=require(_0x1d45('0x1a'))(new Redis(config[_0x1d45('0x17')]));require(_0x1d45('0x1b'))[_0x1d45('0x1c')](socket);function respondWithStatusCode(_0x505146,_0x20de80){_0x20de80=_0x20de80||0xcc;return function(_0x24b9dc){if(_0x24b9dc){return _0x505146[_0x1d45('0x1d')](_0x20de80);}return _0x505146[_0x1d45('0x1e')](_0x20de80)['end']();};}function respondWithResult(_0x130f2d,_0x36695d){_0x36695d=_0x36695d||0xc8;return function(_0x42407d){if(_0x42407d){return _0x130f2d[_0x1d45('0x1e')](_0x36695d)[_0x1d45('0x1f')](_0x42407d);}};}function respondWithFilteredResult(_0x4112e6,_0xec2a84){return function(_0x5595d6){if(_0x5595d6){var _0x54f9bb=typeof _0xec2a84[_0x1d45('0x20')]===_0x1d45('0x21')&&typeof _0xec2a84['limit']===_0x1d45('0x21');var _0x1f0461=_0x5595d6[_0x1d45('0x22')];var _0x302f80=_0x54f9bb?0x0:_0xec2a84[_0x1d45('0x20')];var _0x16be40=_0x54f9bb?_0x5595d6[_0x1d45('0x22')]:_0xec2a84[_0x1d45('0x20')]+_0xec2a84[_0x1d45('0x23')];var _0x17cded;if(_0x16be40>=_0x1f0461){_0x16be40=_0x1f0461;_0x17cded=0xc8;}else{_0x17cded=0xce;}_0x4112e6['status'](_0x17cded);return _0x4112e6[_0x1d45('0x24')](_0x1d45('0x25'),_0x302f80+'-'+_0x16be40+'/'+_0x1f0461)['json'](_0x5595d6);}return null;};}function patchUpdates(_0x37f867){return function(_0x1a058d){try{jsonpatch[_0x1d45('0x26')](_0x1a058d,_0x37f867,!![]);}catch(_0x1d6db9){return BPromise[_0x1d45('0x27')](_0x1d6db9);}return _0x1a058d[_0x1d45('0x28')]();};}function saveUpdates(_0x20f080,_0x4b1484){return function(_0x3d3a70){if(_0x3d3a70){return _0x3d3a70[_0x1d45('0x29')](_0x20f080)[_0x1d45('0x2a')](function(_0x4da4e1){return _0x4da4e1;});}return null;};}function removeEntity(_0x8b1e1c,_0x31be4c){return function(_0x3150d6){if(_0x3150d6){return _0x3150d6['destroy']()[_0x1d45('0x2a')](function(){_0x8b1e1c[_0x1d45('0x1e')](0xcc)[_0x1d45('0x2b')]();});}};}function handleEntityNotFound(_0x1be10a,_0x5228e3){return function(_0x610f7){if(!_0x610f7){_0x1be10a[_0x1d45('0x1d')](0x194);}return _0x610f7;};}function handleError(_0x5718aa,_0x7ab559){_0x7ab559=_0x7ab559||0x1f4;return function(_0x750966){logger['error'](_0x750966[_0x1d45('0x2c')]);if(_0x750966[_0x1d45('0x2d')]){delete _0x750966[_0x1d45('0x2d')];}_0x5718aa['status'](_0x7ab559)[_0x1d45('0x2e')](_0x750966);};}exports[_0x1d45('0x2f')]=function(_0x3a08bb,_0x17ca34){var _0xd3e29f={},_0x5eb11c={},_0x5c2724={'count':0x0,'rows':[]};var _0x16a82c=_[_0x1d45('0x30')](db['UserProfile'][_0x1d45('0x31')],function(_0x1e187b){return{'name':_0x1e187b[_0x1d45('0x32')],'type':_0x1e187b[_0x1d45('0x33')][_0x1d45('0x34')]};});_0x5eb11c[_0x1d45('0x35')]=_[_0x1d45('0x30')](_0x16a82c,_0x1d45('0x2d'));_0x5eb11c[_0x1d45('0x36')]=_[_0x1d45('0x37')](_0x3a08bb['query']);_0x5eb11c['filters']=_['intersection'](_0x5eb11c[_0x1d45('0x35')],_0x5eb11c[_0x1d45('0x36')]);_0xd3e29f[_0x1d45('0x38')]=_[_0x1d45('0x39')](_0x5eb11c[_0x1d45('0x35')],qs['fields'](_0x3a08bb[_0x1d45('0x36')][_0x1d45('0x3a')]));_0xd3e29f[_0x1d45('0x38')]=_0xd3e29f[_0x1d45('0x38')][_0x1d45('0x3b')]?_0xd3e29f[_0x1d45('0x38')]:_0x5eb11c[_0x1d45('0x35')];if(!_0x3a08bb[_0x1d45('0x36')][_0x1d45('0x3c')]('nolimit')){_0xd3e29f['limit']=qs[_0x1d45('0x23')](_0x3a08bb[_0x1d45('0x36')][_0x1d45('0x23')]);_0xd3e29f[_0x1d45('0x20')]=qs['offset'](_0x3a08bb[_0x1d45('0x36')]['offset']);}_0xd3e29f[_0x1d45('0x3d')]=qs[_0x1d45('0x3e')](_0x3a08bb[_0x1d45('0x36')]['sort']);_0xd3e29f['where']=qs[_0x1d45('0x3f')](_['pick'](_0x3a08bb['query'],_0x5eb11c[_0x1d45('0x3f')]),_0x16a82c);if(_0x3a08bb[_0x1d45('0x36')][_0x1d45('0x40')]){_0xd3e29f[_0x1d45('0x41')]=_[_0x1d45('0x42')](_0xd3e29f[_0x1d45('0x41')],{'$or':_[_0x1d45('0x30')](_0x16a82c,function(_0x4326c9){if(_0x4326c9['type']!==_0x1d45('0x43')){var _0x824ae8={};_0x824ae8[_0x4326c9[_0x1d45('0x2d')]]={'$like':'%'+_0x3a08bb[_0x1d45('0x36')][_0x1d45('0x40')]+'%'};return _0x824ae8;}})});}_0xd3e29f=_[_0x1d45('0x42')]({},_0xd3e29f,_0x3a08bb[_0x1d45('0x44')]);var _0x1900d9={'where':_0xd3e29f[_0x1d45('0x41')]};return db[_0x1d45('0x45')][_0x1d45('0x22')](_0x1900d9)[_0x1d45('0x2a')](function(_0x32ffdc){_0x5c2724[_0x1d45('0x22')]=_0x32ffdc;if(_0x3a08bb['query']['includeAll']){_0xd3e29f[_0x1d45('0x46')]=[{'all':!![]}];}return db[_0x1d45('0x45')][_0x1d45('0x47')](_0xd3e29f);})[_0x1d45('0x2a')](function(_0x53ee4d){_0x5c2724[_0x1d45('0x48')]=_0x53ee4d;return _0x5c2724;})[_0x1d45('0x2a')](respondWithFilteredResult(_0x17ca34,_0xd3e29f))['catch'](handleError(_0x17ca34,null));};exports[_0x1d45('0x49')]=function(_0x44cc79,_0x150d30){var _0x53db0c={'raw':![],'where':{'id':_0x44cc79[_0x1d45('0x4a')]['id']}},_0x19489d={};_0x19489d['model']=_['keys'](db[_0x1d45('0x45')][_0x1d45('0x31')]);_0x19489d[_0x1d45('0x36')]=_['keys'](_0x44cc79[_0x1d45('0x36')]);_0x19489d[_0x1d45('0x3f')]=_[_0x1d45('0x39')](_0x19489d[_0x1d45('0x35')],_0x19489d[_0x1d45('0x36')]);_0x53db0c[_0x1d45('0x38')]=_[_0x1d45('0x39')](_0x19489d[_0x1d45('0x35')],qs[_0x1d45('0x3a')](_0x44cc79[_0x1d45('0x36')][_0x1d45('0x3a')]));_0x53db0c[_0x1d45('0x38')]=_0x53db0c[_0x1d45('0x38')][_0x1d45('0x3b')]?_0x53db0c['attributes']:_0x19489d[_0x1d45('0x35')];if(_0x44cc79['query'][_0x1d45('0x4b')]){_0x53db0c[_0x1d45('0x46')]=[{'all':!![]}];}_0x53db0c=_[_0x1d45('0x42')]({},_0x53db0c,_0x44cc79[_0x1d45('0x44')]);return db[_0x1d45('0x45')][_0x1d45('0x4c')](_0x53db0c)[_0x1d45('0x2a')](handleEntityNotFound(_0x150d30,null))[_0x1d45('0x2a')](respondWithResult(_0x150d30,null))[_0x1d45('0x4d')](handleError(_0x150d30,null));};exports[_0x1d45('0x4e')]=function(_0x2e225d,_0x1f0ef6){return db[_0x1d45('0x45')][_0x1d45('0x4e')](_0x2e225d['body'],{})['then'](respondWithResult(_0x1f0ef6,0xc9))[_0x1d45('0x4d')](handleError(_0x1f0ef6,null));};exports[_0x1d45('0x4f')]=function(_0x470646,_0x18b70a){var _0x263224={'where':{'id':_0x470646[_0x1d45('0x4a')]['id']}},_0x3e7c7f={};_0x3e7c7f[_0x1d45('0x35')]=_['keys'](db['UserProfile'][_0x1d45('0x31')]);_0x263224[_0x1d45('0x38')]=_[_0x1d45('0x39')](_0x3e7c7f[_0x1d45('0x35')],qs[_0x1d45('0x3a')](_0x470646['query']['fields']));_0x263224['attributes']=_0x263224[_0x1d45('0x38')][_0x1d45('0x3b')]?_0x263224[_0x1d45('0x38')]:_0x3e7c7f[_0x1d45('0x35')];if(_0x470646[_0x1d45('0x36')][_0x1d45('0x4b')]){_0x263224[_0x1d45('0x46')]=[{'all':!![]}];}_0x263224=_[_0x1d45('0x42')]({},_0x263224,_0x470646[_0x1d45('0x44')]);return db[_0x1d45('0x45')][_0x1d45('0x4c')](_0x263224)[_0x1d45('0x2a')](handleEntityNotFound(_0x18b70a,null))[_0x1d45('0x2a')](function(_0x1fd7ff){if(_0x1fd7ff){var _0x36f0e1=_0x1fd7ff['get']({'plain':!![]});_0x36f0e1=qs['omit'](_0x36f0e1,['id','createdAt',_0x1d45('0x50'),_0x1d45('0x51')]);_0x470646['body']=_[_0x1d45('0x52')](_0x470646['body'],['id',_0x1d45('0x53'),'updatedAt']);return db[_0x1d45('0x54')][_0x1d45('0x55')](function(_0x12d36f){return db[_0x1d45('0x45')][_0x1d45('0x4e')](_[_0x1d45('0x42')](_0x36f0e1,_0x470646[_0x1d45('0x56')]),{'include':_0x470646[_0x1d45('0x36')][_0x1d45('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x12d36f})['then'](function(_0x2bfd01){var _0x77497d=_0x2bfd01[_0x1d45('0x57')]({'plain':!![]});return db[_0x1d45('0x58')][_0x1d45('0x47')]({'where':{'userProfileId':_0x470646[_0x1d45('0x4a')]['id']},'raw':!![]})[_0x1d45('0x2a')](function(_0xd32239){if(_0xd32239){return BPromise[_0x1d45('0x59')](_0xd32239,function(_0x28cae9){return new BPromise(function(_0xc073c4,_0x95b76){if(_0x28cae9[_0x1d45('0x5a')]===null||_0x28cae9['autoAssociation']===0x1)_0xc073c4(null);return db[_0x1d45('0x5b')]['findAll']({'where':{'sectionId':_0x28cae9['id']},'raw':!![]})[_0x1d45('0x2a')](function(_0x33c6c8){var _0x3f64c4=_['map'](_0x33c6c8,function(_0x14e832){return qs['omit'](_0x14e832,['id',_0x1d45('0x53'),_0x1d45('0x50'),'sectionId']);});_0xc073c4(_0x3f64c4);})[_0x1d45('0x4d')](function(_0x1ae9e9){_0x95b76(_0x1ae9e9);});})[_0x1d45('0x2a')](function(_0x43c878){var _0x209fb8=qs['omit'](_0x28cae9,['id',_0x1d45('0x53'),_0x1d45('0x50')]);_0x209fb8[_0x1d45('0x5c')]=_0x77497d['id'];if(_0x43c878)_0x209fb8['Resources']=_0x43c878;return _0x209fb8;})[_0x1d45('0x2a')](function(_0x4578d5){return db[_0x1d45('0x58')][_0x1d45('0x4e')](_0x4578d5,{'include':[{'model':db[_0x1d45('0x5b')],'as':_0x1d45('0x5d')}],'raw':!![],'transaction':_0x12d36f});});})[_0x1d45('0x2a')](function(){return _0x77497d;});}});});});}})[_0x1d45('0x2a')](respondWithResult(_0x18b70a,0xc9))[_0x1d45('0x4d')](handleError(_0x18b70a,null));};exports[_0x1d45('0x29')]=function(_0x219604,_0x44bf23){if(_0x219604['body']['id']){delete _0x219604[_0x1d45('0x56')]['id'];}return db[_0x1d45('0x45')][_0x1d45('0x4c')]({'where':{'id':_0x219604[_0x1d45('0x4a')]['id']}})[_0x1d45('0x2a')](handleEntityNotFound(_0x44bf23,null))['then'](saveUpdates(_0x219604[_0x1d45('0x56')],null))['then'](respondWithResult(_0x44bf23,null))[_0x1d45('0x4d')](handleError(_0x44bf23,null));};exports['destroy']=function(_0x64950e,_0x353ef4){return db[_0x1d45('0x45')]['find']({'where':{'id':_0x64950e[_0x1d45('0x4a')]['id']}})[_0x1d45('0x2a')](handleEntityNotFound(_0x353ef4,null))[_0x1d45('0x2a')](removeEntity(_0x353ef4,null))[_0x1d45('0x4d')](handleError(_0x353ef4,null));};exports[_0x1d45('0x5e')]=function(_0x1d48cc,_0x2a6362){return db['UserProfile']['describe']()[_0x1d45('0x2a')](respondWithResult(_0x2a6362,null))[_0x1d45('0x4d')](handleError(_0x2a6362,null));};exports[_0x1d45('0x5f')]=function(_0x162b37,_0x2a1e22){var _0x535d07=_0x162b37[_0x1d45('0x56')];return db['UserProfile'][_0x1d45('0x4c')]({'where':{'id':_0x162b37[_0x1d45('0x4a')]['id']}})[_0x1d45('0x2a')](handleEntityNotFound(_0x2a1e22,null))['then'](function(_0x4313b2){if(_0x4313b2){return db[_0x1d45('0x54')][_0x1d45('0x55')](function(_0x3e7b82){return db[_0x1d45('0x58')][_0x1d45('0x60')]({'where':{'userProfileId':_0x162b37['params']['id'],'sectionId':_['map'](_0x535d07,function(_0x44139c){return _0x44139c['sectionId'];})},'transaction':_0x3e7b82})[_0x1d45('0x2a')](function(){var _0x41ef08=_[_0x1d45('0x30')](_0x535d07,function(_0x5087bc){_0x5087bc[_0x1d45('0x5c')]=_0x162b37[_0x1d45('0x4a')]['id'];return _0x5087bc;});var _0x5d138b=[];return BPromise[_0x1d45('0x59')](_0x41ef08,function(_0x44e8c5){return db[_0x1d45('0x58')][_0x1d45('0x4e')](_0x44e8c5,{'include':[{'model':db[_0x1d45('0x5b')],'as':_0x1d45('0x5d')}],'raw':!![],'transaction':_0x3e7b82})[_0x1d45('0x2a')](function(_0xb4e940){_0x5d138b[_0x1d45('0x61')](_0xb4e940[_0x1d45('0x57')]({'plain':!![]}));});})['then'](function(){return _0x5d138b;});});});}})[_0x1d45('0x2a')](function(_0x595cbb){return _0x595cbb;})[_0x1d45('0x2a')](respondWithResult(_0x2a1e22,null))[_0x1d45('0x4d')](handleError(_0x2a1e22,null));};exports[_0x1d45('0x62')]=function(_0x5232dd,_0x374aae){var _0x4956ac;return db[_0x1d45('0x45')]['find']({'where':{'id':_0x5232dd[_0x1d45('0x4a')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x374aae,null))['then'](function(_0x2400f3){if(_0x2400f3){_0x4956ac=_0x2400f3;return db[_0x1d45('0x58')][_0x1d45('0x60')]({'where':{'userProfileId':_0x5232dd[_0x1d45('0x4a')]['id'],'sectionId':_0x5232dd[_0x1d45('0x36')][_0x1d45('0x63')]}});}})[_0x1d45('0x2a')](function(){return _0x4956ac;})[_0x1d45('0x2a')](respondWithStatusCode(_0x374aae,null))[_0x1d45('0x4d')](handleError(_0x374aae,null));};exports[_0x1d45('0x64')]=function(_0x292bdf,_0x478bbc){var _0x508252=[];var _0x100980=[];return db[_0x1d45('0x58')][_0x1d45('0x47')]({'where':{'userProfileId':_0x292bdf[_0x1d45('0x4a')]['id']},'raw':!![]})[_0x1d45('0x2a')](function(_0x1779ea){_0x508252=_[_0x1d45('0x40')](_0x1779ea,function(_0x2027f8){return _0x2027f8[_0x1d45('0x65')]===0x1||_[_0x1d45('0x66')]([0x3eb,0x709],_0x2027f8[_0x1d45('0x67')]);});if(!_['isEmpty'](_0x508252)){return _['map'](_0x508252,function(_0x4d2ecf){return _0x4d2ecf['sectionId'];});}else{return;}})[_0x1d45('0x2a')](function(_0x21b7fc){if(_0x21b7fc)_0x100980=_0x21b7fc;if(_['includes'](_0x100980,0x64)){var _0x44408e=_[_0x1d45('0x4c')](_0x508252,{'sectionId':0x64});return hasDefaultDashboard(_0x44408e)['then'](function(_0x55c97f){return _[_0x1d45('0x30')](_0x508252,function(_0x13c0ad){if(_0x13c0ad['sectionId']===0x64){_0x13c0ad[_0x1d45('0x68')]=_0x55c97f;}return _0x13c0ad;});});}else{return;}})['then'](function(_0x2a9eb0){if(_0x2a9eb0)_0x508252=_0x2a9eb0;if(_[_0x1d45('0x66')](_0x100980,0x3eb)){var _0x15ca5d=_['find'](_0x508252,{'sectionId':0x3eb});return getCustomDashboards(_0x15ca5d)[_0x1d45('0x2a')](function(_0x1e3ff4){return _['map'](_0x508252,function(_0x22a180){if(_0x15ca5d[_0x1d45('0x65')]){if(_0x22a180[_0x1d45('0x67')]===0x3eb){_0x22a180['subsections']=_0x1e3ff4;}}else{if(_0x22a180['sectionId']===0x64){if(!_0x22a180[_0x1d45('0x68')]){_0x22a180[_0x1d45('0x68')]=[];}_0x22a180[_0x1d45('0x68')]=_0x22a180['subsections'][_0x1d45('0x69')](_0x1e3ff4);}}return _0x22a180;});});}else{return;}})[_0x1d45('0x2a')](function(_0x448690){if(_0x448690)_0x508252=_0x448690;if(_[_0x1d45('0x66')](_0x100980,0x709)){var _0x3369b0=_['find'](_0x508252,{'sectionId':0x709});return getPlugins(_0x3369b0)[_0x1d45('0x2a')](function(_0x5ab078){if(_0x3369b0[_0x1d45('0x65')]){return _[_0x1d45('0x30')](_0x508252,function(_0x34ce7c){if(_0x34ce7c[_0x1d45('0x67')]===0x709){_0x34ce7c[_0x1d45('0x68')]=_0x5ab078;}return _0x34ce7c;});}else{var _0x55e765={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5ab078};var _0x21aaac=_[_0x1d45('0x30')](_0x508252);_0x21aaac[_0x1d45('0x61')](_0x55e765);return _0x21aaac;}});}else{return;}})[_0x1d45('0x2a')](function(_0x1acf3b){if(_0x1acf3b)_0x508252=_0x1acf3b;return _['filter'](_0x508252,['enabled',0x1]);})['then'](respondWithResult(_0x478bbc,null))[_0x1d45('0x4d')](handleError(_0x478bbc,null));};function hasDefaultDashboard(_0x40981f){var _0x5cf217=[0x65];return new BPromise(function(_0x604876,_0x550242){try{if(_0x40981f[_0x1d45('0x5a')]){_0x604876(_0x5cf217);}else{return db[_0x1d45('0x5b')][_0x1d45('0x6a')]({'where':{'sectionId':_0x40981f['id']},'raw':!![]})[_0x1d45('0x2a')](function(_0x4f1c5e){_0x4f1c5e?_0x604876(_0x5cf217):_0x604876();});}}catch(_0x1d80ad){_0x550242(_0x1d80ad);}});}function getCustomDashboards(_0x538714){var _0x59fbe2=[];return new BPromise(function(_0x5eee32,_0x47a46f){try{if(_0x538714[_0x1d45('0x5a')]){return db['Dashboard'][_0x1d45('0x47')]({'raw':!![]})[_0x1d45('0x2a')](function(_0x14e7f7){_0x14e7f7[_0x1d45('0x6b')](function(_0x2f0ff5){_0x59fbe2[_0x1d45('0x61')](_0x2f0ff5['id']+0x1869f);});_0x5eee32(_0x59fbe2);});}else{return db[_0x1d45('0x5b')]['findAll']({'where':{'sectionId':_0x538714['id']},'raw':!![]})[_0x1d45('0x2a')](function(_0x13d364){_0x13d364[_0x1d45('0x6b')](function(_0x128bf0){_0x59fbe2[_0x1d45('0x61')](_0x128bf0['resourceId']+0x1869f);});_0x5eee32(_0x59fbe2);});}}catch(_0x56c4c5){_0x47a46f(_0x56c4c5);}});}function getPlugins(_0x3217cb){var _0x467753=[];return new BPromise(function(_0x3345e5,_0x130780){try{if(_0x3217cb[_0x1d45('0x5a')]){return db[_0x1d45('0x6c')][_0x1d45('0x47')]({'raw':!![]})[_0x1d45('0x2a')](function(_0x7d030a){_0x7d030a[_0x1d45('0x6b')](function(_0x1b2d5a){_0x467753[_0x1d45('0x61')](_0x1b2d5a['id']+0x15b38);});_0x3345e5(_0x467753);});}else{return db[_0x1d45('0x5b')][_0x1d45('0x47')]({'where':{'sectionId':_0x3217cb['id']},'raw':!![]})[_0x1d45('0x2a')](function(_0x4b44b6){_0x4b44b6[_0x1d45('0x6b')](function(_0x592b28){_0x467753[_0x1d45('0x61')](_0x592b28[_0x1d45('0x6d')]+0x15b38);});_0x3345e5(_0x467753);});}}catch(_0x7a938b){_0x130780(_0x7a938b);}});}exports[_0x1d45('0x6e')]=function(_0x5c48b8,_0x528017){return db['UserProfile']['find']({'where':{'id':_0x5c48b8[_0x1d45('0x4a')]['id']}})['then'](handleEntityNotFound(_0x528017,null))[_0x1d45('0x2a')](function(_0x3165a3){if(_0x3165a3){return db[_0x1d45('0x54')][_0x1d45('0x55')](function(_0x5ae078){return db['UserProfileSection'][_0x1d45('0x47')]({'where':{'userProfileId':_0x5c48b8[_0x1d45('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x1d45('0x2a')](function(_0x35a334){if(_0x35a334){return db[_0x1d45('0x58')][_0x1d45('0x60')]({'where':{'userProfileId':_0x5c48b8[_0x1d45('0x4a')]['id'],'id':_[_0x1d45('0x30')](_0x35a334,function(_0x48abed){return _0x48abed['id'];})},'transaction':_0x5ae078});}})[_0x1d45('0x2a')](function(_0x303c70){var _0x59ca03=_[_0x1d45('0x30')](_0x5c48b8[_0x1d45('0x56')],function(_0x50f548){_0x50f548[_0x1d45('0x5c')]=_0x5c48b8['params']['id'];return _0x50f548;});return db[_0x1d45('0x58')][_0x1d45('0x6f')](_0x59ca03,{'raw':!![],'transaction':_0x5ae078});})['then'](function(_0x3bbae5){var _0x309bce=_['filter'](_[_0x1d45('0x30')](_0x3bbae5,function(_0x24a03a){return _0x24a03a[_0x1d45('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x309bce){return db[_0x1d45('0x58')]['findAll']({'where':{'userProfileId':_0x5c48b8[_0x1d45('0x4a')]['id'],'sectionId':_[_0x1d45('0x30')](_0x309bce,function(_0x5442f5){return _0x5442f5[_0x1d45('0x67')];})},'attributes':['id',_0x1d45('0x67')],'raw':!![]})[_0x1d45('0x2a')](function(_0x188b43){var _0x1276a3=_['map'](_0x5c48b8[_0x1d45('0x56')],function(_0x21d736){_0x21d736['userProfileId']=_0x5c48b8[_0x1d45('0x4a')]['id'];return _0x21d736;});return db['UserProfileResource'][_0x1d45('0x6f')](_0x1276a3,{'raw':!![],'transaction':_0x5ae078});});}})[_0x1d45('0x4d')](handleError(_0x528017,null));});}})[_0x1d45('0x2a')](function(_0x309e16){var _0x506e43=_[_0x1d45('0x30')](_0x309e16,function(_0x3f6296){return _0x3f6296['get']({'plain':!![]});});})['then'](respondWithResult(_0x528017,null))['catch'](handleError(_0x528017,null));};exports[_0x1d45('0x70')]=function(_0x2102b1,_0x326dfd,_0x386d31){return db[_0x1d45('0x45')][_0x1d45('0x4c')]({'where':{'id':_0x2102b1['params']['id']}})[_0x1d45('0x2a')](handleEntityNotFound(_0x326dfd,null))[_0x1d45('0x2a')](function(_0x2b229e){if(_0x2b229e){return _0x2b229e[_0x1d45('0x70')](_0x2102b1[_0x1d45('0x36')][_0x1d45('0x63')]);}})['then'](respondWithStatusCode(_0x326dfd,null))[_0x1d45('0x4d')](handleError(_0x326dfd,null));};exports['getResources']=function(_0x18579b,_0x59d941){var _0x14308b={};if(!_0x18579b[_0x1d45('0x36')]['section'])throw new Error(_0x1d45('0x71'));if(!_0x18579b[_0x1d45('0x36')]['hasOwnProperty']('nolimit')){_0x14308b[_0x1d45('0x23')]=qs[_0x1d45('0x23')](_0x18579b[_0x1d45('0x36')][_0x1d45('0x23')]);_0x14308b['offset']=qs['offset'](_0x18579b['query'][_0x1d45('0x20')]);}return db[_0x1d45('0x45')][_0x1d45('0x4c')]({'where':{'id':_0x18579b[_0x1d45('0x4a')]['id']}})[_0x1d45('0x2a')](function(_0x5bd876){if(!_0x5bd876)throw new Error(_0x1d45('0x72')+_0x18579b[_0x1d45('0x4a')]['id']);return db['UserProfile']['getResources'](_0x18579b);})['then'](respondWithFilteredResult(_0x59d941,_0x14308b))[_0x1d45('0x4d')](handleError(_0x59d941,null));}; \ No newline at end of file +var _0x1cfa=['get','omit','createdAt','crudPermissions','transaction','UserProfileSection','findAll','UserProfileResource','updatedAt','userProfileId','Resources','update','describe','addSections','sectionId','each','ids','getSections','enabled','includes','subsections','concat','push','autoAssociation','findOne','Dashboard','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfile','includeAll','rows','catch','params','rawAttributes','find','create','body','clone'];(function(_0x1bfc4c,_0x13383e){var _0x141d23=function(_0x15a68c){while(--_0x15a68c){_0x1bfc4c['push'](_0x1bfc4c['shift']());}};_0x141d23(++_0x13383e);}(_0x1cfa,0x172));var _0xa1cf=function(_0x267465,_0x63a59){_0x267465=_0x267465-0x0;var _0x1a3d64=_0x1cfa[_0x267465];return _0x1a3d64;};'use strict';var emlformat=require(_0xa1cf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa1cf('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa1cf('0x2'));var util=require(_0xa1cf('0x3'));var path=require(_0xa1cf('0x4'));var sox=require(_0xa1cf('0x5'));var csv=require(_0xa1cf('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1cf('0x7'));var _=require(_0xa1cf('0x8'));var squel=require('squel');var crypto=require(_0xa1cf('0x9'));var jsforce=require(_0xa1cf('0xa'));var deskjs=require(_0xa1cf('0xb'));var toCsv=require(_0xa1cf('0x6'));var querystring=require(_0xa1cf('0xc'));var Papa=require(_0xa1cf('0xd'));var Redis=require(_0xa1cf('0xe'));var authService=require(_0xa1cf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa1cf('0x10'));var hardwareService=require(_0xa1cf('0x11'));var logger=require(_0xa1cf('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa1cf('0x13'));var licenseUtil=require(_0xa1cf('0x14'));var db=require(_0xa1cf('0x15'))['db'];config['redis']=_[_0xa1cf('0x16')](config[_0xa1cf('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1cf('0x18'))(new Redis(config[_0xa1cf('0x17')]));require(_0xa1cf('0x19'))['register'](socket);function respondWithStatusCode(_0x305a34,_0x1e1eec){_0x1e1eec=_0x1e1eec||0xcc;return function(_0xa351cb){if(_0xa351cb){return _0x305a34[_0xa1cf('0x1a')](_0x1e1eec);}return _0x305a34[_0xa1cf('0x1b')](_0x1e1eec)[_0xa1cf('0x1c')]();};}function respondWithResult(_0x5c5230,_0x5ebd98){_0x5ebd98=_0x5ebd98||0xc8;return function(_0xac8b71){if(_0xac8b71){return _0x5c5230['status'](_0x5ebd98)[_0xa1cf('0x1d')](_0xac8b71);}};}function respondWithFilteredResult(_0x58e17a,_0x27341b){return function(_0x55eea1){if(_0x55eea1){var _0x5eb5dc=typeof _0x27341b[_0xa1cf('0x1e')]===_0xa1cf('0x1f')&&typeof _0x27341b['limit']===_0xa1cf('0x1f');var _0x394a33=_0x55eea1[_0xa1cf('0x20')];var _0x5bc26a=_0x5eb5dc?0x0:_0x27341b[_0xa1cf('0x1e')];var _0x666358=_0x5eb5dc?_0x55eea1['count']:_0x27341b[_0xa1cf('0x1e')]+_0x27341b[_0xa1cf('0x21')];var _0x156f81;if(_0x666358>=_0x394a33){_0x666358=_0x394a33;_0x156f81=0xc8;}else{_0x156f81=0xce;}_0x58e17a['status'](_0x156f81);return _0x58e17a['set'](_0xa1cf('0x22'),_0x5bc26a+'-'+_0x666358+'/'+_0x394a33)[_0xa1cf('0x1d')](_0x55eea1);}return null;};}function patchUpdates(_0x54cb0c){return function(_0x2b5e20){try{jsonpatch['apply'](_0x2b5e20,_0x54cb0c,!![]);}catch(_0x43d824){return BPromise[_0xa1cf('0x23')](_0x43d824);}return _0x2b5e20[_0xa1cf('0x24')]();};}function saveUpdates(_0x49eb78,_0x569e53){return function(_0x250b41){if(_0x250b41){return _0x250b41['update'](_0x49eb78)[_0xa1cf('0x25')](function(_0x2e764b){return _0x2e764b;});}return null;};}function removeEntity(_0x10516c,_0x1ce750){return function(_0x416458){if(_0x416458){return _0x416458[_0xa1cf('0x26')]()['then'](function(){_0x10516c['status'](0xcc)[_0xa1cf('0x1c')]();});}};}function handleEntityNotFound(_0x4d79cc,_0x433bf8){return function(_0x437e23){if(!_0x437e23){_0x4d79cc[_0xa1cf('0x1a')](0x194);}return _0x437e23;};}function handleError(_0xdded16,_0x3bfd4b){_0x3bfd4b=_0x3bfd4b||0x1f4;return function(_0x3ff3ef){logger[_0xa1cf('0x27')](_0x3ff3ef[_0xa1cf('0x28')]);if(_0x3ff3ef[_0xa1cf('0x29')]){delete _0x3ff3ef['name'];}_0xdded16[_0xa1cf('0x1b')](_0x3bfd4b)[_0xa1cf('0x2a')](_0x3ff3ef);};}exports[_0xa1cf('0x2b')]=function(_0x40552b,_0x264496){var _0x39fa69={},_0x5d24f0={},_0x3bddce={'count':0x0,'rows':[]};var _0x56b3ee=_[_0xa1cf('0x2c')](db['UserProfile']['rawAttributes'],function(_0x3b0d96){return{'name':_0x3b0d96['fieldName'],'type':_0x3b0d96[_0xa1cf('0x2d')][_0xa1cf('0x2e')]};});_0x5d24f0[_0xa1cf('0x2f')]=_[_0xa1cf('0x2c')](_0x56b3ee,'name');_0x5d24f0[_0xa1cf('0x30')]=_[_0xa1cf('0x31')](_0x40552b[_0xa1cf('0x30')]);_0x5d24f0[_0xa1cf('0x32')]=_[_0xa1cf('0x33')](_0x5d24f0['model'],_0x5d24f0[_0xa1cf('0x30')]);_0x39fa69[_0xa1cf('0x34')]=_[_0xa1cf('0x33')](_0x5d24f0[_0xa1cf('0x2f')],qs['fields'](_0x40552b['query'][_0xa1cf('0x35')]));_0x39fa69[_0xa1cf('0x34')]=_0x39fa69[_0xa1cf('0x34')][_0xa1cf('0x36')]?_0x39fa69[_0xa1cf('0x34')]:_0x5d24f0[_0xa1cf('0x2f')];if(!_0x40552b[_0xa1cf('0x30')]['hasOwnProperty'](_0xa1cf('0x37'))){_0x39fa69[_0xa1cf('0x21')]=qs[_0xa1cf('0x21')](_0x40552b[_0xa1cf('0x30')]['limit']);_0x39fa69[_0xa1cf('0x1e')]=qs[_0xa1cf('0x1e')](_0x40552b['query'][_0xa1cf('0x1e')]);}_0x39fa69[_0xa1cf('0x38')]=qs[_0xa1cf('0x39')](_0x40552b[_0xa1cf('0x30')][_0xa1cf('0x39')]);_0x39fa69[_0xa1cf('0x3a')]=qs[_0xa1cf('0x32')](_[_0xa1cf('0x3b')](_0x40552b[_0xa1cf('0x30')],_0x5d24f0[_0xa1cf('0x32')]),_0x56b3ee);if(_0x40552b[_0xa1cf('0x30')][_0xa1cf('0x3c')]){_0x39fa69[_0xa1cf('0x3a')]=_[_0xa1cf('0x3d')](_0x39fa69[_0xa1cf('0x3a')],{'$or':_[_0xa1cf('0x2c')](_0x56b3ee,function(_0x4f708a){if(_0x4f708a[_0xa1cf('0x2d')]!==_0xa1cf('0x3e')){var _0x2890fa={};_0x2890fa[_0x4f708a[_0xa1cf('0x29')]]={'$like':'%'+_0x40552b[_0xa1cf('0x30')]['filter']+'%'};return _0x2890fa;}})});}_0x39fa69=_[_0xa1cf('0x3d')]({},_0x39fa69,_0x40552b[_0xa1cf('0x3f')]);var _0x1c668c={'where':_0x39fa69['where']};return db[_0xa1cf('0x40')][_0xa1cf('0x20')](_0x1c668c)['then'](function(_0xcfafd0){_0x3bddce[_0xa1cf('0x20')]=_0xcfafd0;if(_0x40552b['query'][_0xa1cf('0x41')]){_0x39fa69['include']=[{'all':!![]}];}return db[_0xa1cf('0x40')]['findAll'](_0x39fa69);})[_0xa1cf('0x25')](function(_0x1387b2){_0x3bddce[_0xa1cf('0x42')]=_0x1387b2;return _0x3bddce;})['then'](respondWithFilteredResult(_0x264496,_0x39fa69))[_0xa1cf('0x43')](handleError(_0x264496,null));};exports['show']=function(_0x590106,_0x5eba26){var _0x4df8da={'raw':![],'where':{'id':_0x590106[_0xa1cf('0x44')]['id']}},_0x3d1126={};_0x3d1126[_0xa1cf('0x2f')]=_[_0xa1cf('0x31')](db[_0xa1cf('0x40')][_0xa1cf('0x45')]);_0x3d1126['query']=_[_0xa1cf('0x31')](_0x590106[_0xa1cf('0x30')]);_0x3d1126[_0xa1cf('0x32')]=_[_0xa1cf('0x33')](_0x3d1126[_0xa1cf('0x2f')],_0x3d1126[_0xa1cf('0x30')]);_0x4df8da['attributes']=_[_0xa1cf('0x33')](_0x3d1126[_0xa1cf('0x2f')],qs[_0xa1cf('0x35')](_0x590106['query'][_0xa1cf('0x35')]));_0x4df8da['attributes']=_0x4df8da[_0xa1cf('0x34')][_0xa1cf('0x36')]?_0x4df8da[_0xa1cf('0x34')]:_0x3d1126[_0xa1cf('0x2f')];if(_0x590106[_0xa1cf('0x30')][_0xa1cf('0x41')]){_0x4df8da['include']=[{'all':!![]}];}_0x4df8da=_[_0xa1cf('0x3d')]({},_0x4df8da,_0x590106[_0xa1cf('0x3f')]);return db[_0xa1cf('0x40')][_0xa1cf('0x46')](_0x4df8da)['then'](handleEntityNotFound(_0x5eba26,null))[_0xa1cf('0x25')](respondWithResult(_0x5eba26,null))[_0xa1cf('0x43')](handleError(_0x5eba26,null));};exports['create']=function(_0x475100,_0x3c0250){return db[_0xa1cf('0x40')][_0xa1cf('0x47')](_0x475100[_0xa1cf('0x48')],{})[_0xa1cf('0x25')](respondWithResult(_0x3c0250,0xc9))[_0xa1cf('0x43')](handleError(_0x3c0250,null));};exports[_0xa1cf('0x49')]=function(_0x1a7b68,_0x4f9d7a){var _0x4b4622={'where':{'id':_0x1a7b68[_0xa1cf('0x44')]['id']}},_0x5650e4={};_0x5650e4[_0xa1cf('0x2f')]=_[_0xa1cf('0x31')](db['UserProfile'][_0xa1cf('0x45')]);_0x4b4622['attributes']=_['intersection'](_0x5650e4[_0xa1cf('0x2f')],qs[_0xa1cf('0x35')](_0x1a7b68[_0xa1cf('0x30')]['fields']));_0x4b4622['attributes']=_0x4b4622[_0xa1cf('0x34')][_0xa1cf('0x36')]?_0x4b4622[_0xa1cf('0x34')]:_0x5650e4[_0xa1cf('0x2f')];if(_0x1a7b68[_0xa1cf('0x30')]['includeAll']){_0x4b4622['include']=[{'all':!![]}];}_0x4b4622=_[_0xa1cf('0x3d')]({},_0x4b4622,_0x1a7b68[_0xa1cf('0x3f')]);return db[_0xa1cf('0x40')][_0xa1cf('0x46')](_0x4b4622)[_0xa1cf('0x25')](handleEntityNotFound(_0x4f9d7a,null))[_0xa1cf('0x25')](function(_0xe17c49){if(_0xe17c49){var _0x5a44f0=_0xe17c49[_0xa1cf('0x4a')]({'plain':!![]});_0x5a44f0=qs[_0xa1cf('0x4b')](_0x5a44f0,['id',_0xa1cf('0x4c'),'updatedAt',_0xa1cf('0x4d')]);_0x1a7b68['body']=_[_0xa1cf('0x4b')](_0x1a7b68[_0xa1cf('0x48')],['id',_0xa1cf('0x4c'),'updatedAt']);return db['sequelize'][_0xa1cf('0x4e')](function(_0x3d5833){return db[_0xa1cf('0x40')][_0xa1cf('0x47')](_[_0xa1cf('0x3d')](_0x5a44f0,_0x1a7b68[_0xa1cf('0x48')]),{'include':_0x1a7b68['query'][_0xa1cf('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x3d5833})[_0xa1cf('0x25')](function(_0x4d0cef){var _0x2c2663=_0x4d0cef[_0xa1cf('0x4a')]({'plain':!![]});return db[_0xa1cf('0x4f')][_0xa1cf('0x50')]({'where':{'userProfileId':_0x1a7b68[_0xa1cf('0x44')]['id']},'raw':!![]})[_0xa1cf('0x25')](function(_0xe2f19d){if(_0xe2f19d){return BPromise['each'](_0xe2f19d,function(_0x56297d){return new BPromise(function(_0x290c09,_0x1c9757){if(_0x56297d['autoAssociation']===null||_0x56297d['autoAssociation']===0x1)_0x290c09(null);return db[_0xa1cf('0x51')][_0xa1cf('0x50')]({'where':{'sectionId':_0x56297d['id']},'raw':!![]})[_0xa1cf('0x25')](function(_0x556216){var _0xad5f99=_[_0xa1cf('0x2c')](_0x556216,function(_0x3e6092){return qs[_0xa1cf('0x4b')](_0x3e6092,['id','createdAt','updatedAt','sectionId']);});_0x290c09(_0xad5f99);})[_0xa1cf('0x43')](function(_0x5bd322){_0x1c9757(_0x5bd322);});})[_0xa1cf('0x25')](function(_0x3af345){var _0x579d1d=qs[_0xa1cf('0x4b')](_0x56297d,['id',_0xa1cf('0x4c'),_0xa1cf('0x52')]);_0x579d1d[_0xa1cf('0x53')]=_0x2c2663['id'];if(_0x3af345)_0x579d1d[_0xa1cf('0x54')]=_0x3af345;return _0x579d1d;})[_0xa1cf('0x25')](function(_0x3656a5){return db[_0xa1cf('0x4f')][_0xa1cf('0x47')](_0x3656a5,{'include':[{'model':db[_0xa1cf('0x51')],'as':'Resources'}],'raw':!![],'transaction':_0x3d5833});});})[_0xa1cf('0x25')](function(){return _0x2c2663;});}});});});}})[_0xa1cf('0x25')](respondWithResult(_0x4f9d7a,0xc9))['catch'](handleError(_0x4f9d7a,null));};exports[_0xa1cf('0x55')]=function(_0x4b5775,_0x39c6cb){if(_0x4b5775['body']['id']){delete _0x4b5775[_0xa1cf('0x48')]['id'];}return db[_0xa1cf('0x40')][_0xa1cf('0x46')]({'where':{'id':_0x4b5775[_0xa1cf('0x44')]['id']}})[_0xa1cf('0x25')](handleEntityNotFound(_0x39c6cb,null))[_0xa1cf('0x25')](saveUpdates(_0x4b5775[_0xa1cf('0x48')],null))[_0xa1cf('0x25')](respondWithResult(_0x39c6cb,null))[_0xa1cf('0x43')](handleError(_0x39c6cb,null));};exports[_0xa1cf('0x26')]=function(_0x432905,_0x274d84){return db[_0xa1cf('0x40')]['find']({'where':{'id':_0x432905[_0xa1cf('0x44')]['id']}})[_0xa1cf('0x25')](handleEntityNotFound(_0x274d84,null))[_0xa1cf('0x25')](removeEntity(_0x274d84,null))[_0xa1cf('0x43')](handleError(_0x274d84,null));};exports[_0xa1cf('0x56')]=function(_0x4ce5d5,_0x47fbb0){return db[_0xa1cf('0x40')][_0xa1cf('0x56')]()[_0xa1cf('0x25')](respondWithResult(_0x47fbb0,null))[_0xa1cf('0x43')](handleError(_0x47fbb0,null));};exports[_0xa1cf('0x57')]=function(_0x36dc4c,_0x3d7cb7){var _0x4b6295=_0x36dc4c[_0xa1cf('0x48')];return db['UserProfile'][_0xa1cf('0x46')]({'where':{'id':_0x36dc4c[_0xa1cf('0x44')]['id']}})[_0xa1cf('0x25')](handleEntityNotFound(_0x3d7cb7,null))['then'](function(_0x206796){if(_0x206796){return db['sequelize']['transaction'](function(_0x7d5acf){return db[_0xa1cf('0x4f')][_0xa1cf('0x26')]({'where':{'userProfileId':_0x36dc4c[_0xa1cf('0x44')]['id'],'sectionId':_[_0xa1cf('0x2c')](_0x4b6295,function(_0x452d94){return _0x452d94[_0xa1cf('0x58')];})},'transaction':_0x7d5acf})[_0xa1cf('0x25')](function(){var _0x3e0d49=_[_0xa1cf('0x2c')](_0x4b6295,function(_0x59016a){_0x59016a[_0xa1cf('0x53')]=_0x36dc4c['params']['id'];return _0x59016a;});var _0x1396f9=[];return BPromise[_0xa1cf('0x59')](_0x3e0d49,function(_0xf3f975){return db[_0xa1cf('0x4f')][_0xa1cf('0x47')](_0xf3f975,{'include':[{'model':db[_0xa1cf('0x51')],'as':_0xa1cf('0x54')}],'raw':!![],'transaction':_0x7d5acf})[_0xa1cf('0x25')](function(_0x22879f){_0x1396f9['push'](_0x22879f[_0xa1cf('0x4a')]({'plain':!![]}));});})['then'](function(){return _0x1396f9;});});});}})[_0xa1cf('0x25')](function(_0x191b5a){return _0x191b5a;})['then'](respondWithResult(_0x3d7cb7,null))[_0xa1cf('0x43')](handleError(_0x3d7cb7,null));};exports['removeSections']=function(_0x596789,_0x4a31e2){var _0x47e685;return db[_0xa1cf('0x40')][_0xa1cf('0x46')]({'where':{'id':_0x596789[_0xa1cf('0x44')]['id']},'attributes':['id',_0xa1cf('0x29')]})[_0xa1cf('0x25')](handleEntityNotFound(_0x4a31e2,null))[_0xa1cf('0x25')](function(_0x1f7185){if(_0x1f7185){_0x47e685=_0x1f7185;return db[_0xa1cf('0x4f')][_0xa1cf('0x26')]({'where':{'userProfileId':_0x596789[_0xa1cf('0x44')]['id'],'sectionId':_0x596789[_0xa1cf('0x30')][_0xa1cf('0x5a')]}});}})[_0xa1cf('0x25')](function(){return _0x47e685;})[_0xa1cf('0x25')](respondWithStatusCode(_0x4a31e2,null))[_0xa1cf('0x43')](handleError(_0x4a31e2,null));};exports[_0xa1cf('0x5b')]=function(_0x153ba9,_0x42e9b6){var _0x5b6ed2=[];var _0x6167d1=[];return db[_0xa1cf('0x4f')][_0xa1cf('0x50')]({'where':{'userProfileId':_0x153ba9[_0xa1cf('0x44')]['id']},'raw':!![]})[_0xa1cf('0x25')](function(_0x226636){_0x5b6ed2=_[_0xa1cf('0x3c')](_0x226636,function(_0x2a86d5){return _0x2a86d5[_0xa1cf('0x5c')]===0x1||_[_0xa1cf('0x5d')]([0x3eb,0x709],_0x2a86d5[_0xa1cf('0x58')]);});if(!_['isEmpty'](_0x5b6ed2)){return _[_0xa1cf('0x2c')](_0x5b6ed2,function(_0x3bd404){return _0x3bd404[_0xa1cf('0x58')];});}else{return;}})['then'](function(_0x3c767a){if(_0x3c767a)_0x6167d1=_0x3c767a;if(_['includes'](_0x6167d1,0x64)){var _0x4d52d4=_[_0xa1cf('0x46')](_0x5b6ed2,{'sectionId':0x64});return hasDefaultDashboard(_0x4d52d4)[_0xa1cf('0x25')](function(_0x42dceb){return _[_0xa1cf('0x2c')](_0x5b6ed2,function(_0x5d3138){if(_0x5d3138[_0xa1cf('0x58')]===0x64){_0x5d3138[_0xa1cf('0x5e')]=_0x42dceb;}return _0x5d3138;});});}else{return;}})[_0xa1cf('0x25')](function(_0x534a3a){if(_0x534a3a)_0x5b6ed2=_0x534a3a;if(_[_0xa1cf('0x5d')](_0x6167d1,0x3eb)){var _0xd33f47=_[_0xa1cf('0x46')](_0x5b6ed2,{'sectionId':0x3eb});return getCustomDashboards(_0xd33f47)[_0xa1cf('0x25')](function(_0xda53a3){return _[_0xa1cf('0x2c')](_0x5b6ed2,function(_0x180ebe){if(_0xd33f47['enabled']){if(_0x180ebe[_0xa1cf('0x58')]===0x3eb){_0x180ebe['subsections']=_0xda53a3;}}else{if(_0x180ebe[_0xa1cf('0x58')]===0x64){if(!_0x180ebe[_0xa1cf('0x5e')]){_0x180ebe[_0xa1cf('0x5e')]=[];}_0x180ebe['subsections']=_0x180ebe['subsections'][_0xa1cf('0x5f')](_0xda53a3);}}return _0x180ebe;});});}else{return;}})[_0xa1cf('0x25')](function(_0x22348b){if(_0x22348b)_0x5b6ed2=_0x22348b;if(_[_0xa1cf('0x5d')](_0x6167d1,0x709)){var _0x2ce78b=_['find'](_0x5b6ed2,{'sectionId':0x709});return getPlugins(_0x2ce78b)[_0xa1cf('0x25')](function(_0xcb8884){if(_0x2ce78b[_0xa1cf('0x5c')]){return _[_0xa1cf('0x2c')](_0x5b6ed2,function(_0x3df5d2){if(_0x3df5d2['sectionId']===0x709){_0x3df5d2[_0xa1cf('0x5e')]=_0xcb8884;}return _0x3df5d2;});}else{var _0x4ba473={'sectionId':0x76c,'enabled':0x1,'subsections':_0xcb8884};var _0x5e6b30=_[_0xa1cf('0x2c')](_0x5b6ed2);_0x5e6b30[_0xa1cf('0x60')](_0x4ba473);return _0x5e6b30;}});}else{return;}})['then'](function(_0x2b1128){if(_0x2b1128)_0x5b6ed2=_0x2b1128;return _[_0xa1cf('0x3c')](_0x5b6ed2,['enabled',0x1]);})[_0xa1cf('0x25')](respondWithResult(_0x42e9b6,null))[_0xa1cf('0x43')](handleError(_0x42e9b6,null));};function hasDefaultDashboard(_0xc42bab){var _0x3e1d03=[0x65];return new BPromise(function(_0x35c2f2,_0x341411){try{if(_0xc42bab[_0xa1cf('0x61')]){_0x35c2f2(_0x3e1d03);}else{return db[_0xa1cf('0x51')][_0xa1cf('0x62')]({'where':{'sectionId':_0xc42bab['id']},'raw':!![]})[_0xa1cf('0x25')](function(_0x15c83e){_0x15c83e?_0x35c2f2(_0x3e1d03):_0x35c2f2();});}}catch(_0x1a2c47){_0x341411(_0x1a2c47);}});}function getCustomDashboards(_0x13c366){var _0x503ea4=[];return new BPromise(function(_0x5039f7,_0x127032){try{if(_0x13c366[_0xa1cf('0x61')]){return db[_0xa1cf('0x63')][_0xa1cf('0x50')]({'raw':!![]})[_0xa1cf('0x25')](function(_0x45d47d){_0x45d47d['forEach'](function(_0x22180e){_0x503ea4['push'](_0x22180e['id']+0x1869f);});_0x5039f7(_0x503ea4);});}else{return db[_0xa1cf('0x51')][_0xa1cf('0x50')]({'where':{'sectionId':_0x13c366['id']},'raw':!![]})[_0xa1cf('0x25')](function(_0x498a93){_0x498a93['forEach'](function(_0x20bd81){_0x503ea4[_0xa1cf('0x60')](_0x20bd81[_0xa1cf('0x64')]+0x1869f);});_0x5039f7(_0x503ea4);});}}catch(_0x4bc8f2){_0x127032(_0x4bc8f2);}});}function getPlugins(_0x5b7402){var _0xf362aa=[];return new BPromise(function(_0xe22db1,_0x1aee09){try{if(_0x5b7402[_0xa1cf('0x61')]){return db[_0xa1cf('0x65')]['findAll']({'raw':!![]})[_0xa1cf('0x25')](function(_0x3588ac){_0x3588ac[_0xa1cf('0x66')](function(_0x1e0cbe){_0xf362aa[_0xa1cf('0x60')](_0x1e0cbe['id']+0x15b38);});_0xe22db1(_0xf362aa);});}else{return db['UserProfileResource'][_0xa1cf('0x50')]({'where':{'sectionId':_0x5b7402['id']},'raw':!![]})[_0xa1cf('0x25')](function(_0x58a468){_0x58a468[_0xa1cf('0x66')](function(_0x2702c7){_0xf362aa[_0xa1cf('0x60')](_0x2702c7[_0xa1cf('0x64')]+0x15b38);});_0xe22db1(_0xf362aa);});}}catch(_0x52f1eb){_0x1aee09(_0x52f1eb);}});}exports[_0xa1cf('0x67')]=function(_0x36267d,_0x5020e9){return db['UserProfile'][_0xa1cf('0x46')]({'where':{'id':_0x36267d[_0xa1cf('0x44')]['id']}})['then'](handleEntityNotFound(_0x5020e9,null))[_0xa1cf('0x25')](function(_0x5c9ebf){if(_0x5c9ebf){return db['sequelize'][_0xa1cf('0x4e')](function(_0x30ee92){return db[_0xa1cf('0x4f')]['findAll']({'where':{'userProfileId':_0x36267d['params']['id']},'attributes':['id'],'raw':!![]})[_0xa1cf('0x25')](function(_0xf6e7fd){if(_0xf6e7fd){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x36267d['params']['id'],'id':_[_0xa1cf('0x2c')](_0xf6e7fd,function(_0xb1dbfe){return _0xb1dbfe['id'];})},'transaction':_0x30ee92});}})[_0xa1cf('0x25')](function(_0x6d1ab9){var _0x5e076f=_[_0xa1cf('0x2c')](_0x36267d[_0xa1cf('0x48')],function(_0x5d5203){_0x5d5203[_0xa1cf('0x53')]=_0x36267d['params']['id'];return _0x5d5203;});return db[_0xa1cf('0x4f')]['bulkCreate'](_0x5e076f,{'raw':!![],'transaction':_0x30ee92});})[_0xa1cf('0x25')](function(_0x49afb0){var _0x126b92=_[_0xa1cf('0x3c')](_[_0xa1cf('0x2c')](_0x49afb0,function(_0xd21be4){return _0xd21be4[_0xa1cf('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x126b92){return db[_0xa1cf('0x4f')][_0xa1cf('0x50')]({'where':{'userProfileId':_0x36267d[_0xa1cf('0x44')]['id'],'sectionId':_[_0xa1cf('0x2c')](_0x126b92,function(_0x4ecafb){return _0x4ecafb[_0xa1cf('0x58')];})},'attributes':['id',_0xa1cf('0x58')],'raw':!![]})[_0xa1cf('0x25')](function(_0x10f396){var _0x32ff89=_['map'](_0x36267d['body'],function(_0x14b5d6){_0x14b5d6[_0xa1cf('0x53')]=_0x36267d['params']['id'];return _0x14b5d6;});return db[_0xa1cf('0x51')][_0xa1cf('0x68')](_0x32ff89,{'raw':!![],'transaction':_0x30ee92});});}})['catch'](handleError(_0x5020e9,null));});}})['then'](function(_0x5c84ac){var _0x5e89ce=_[_0xa1cf('0x2c')](_0x5c84ac,function(_0xd533df){return _0xd533df['get']({'plain':!![]});});})[_0xa1cf('0x25')](respondWithResult(_0x5020e9,null))[_0xa1cf('0x43')](handleError(_0x5020e9,null));};exports[_0xa1cf('0x69')]=function(_0x592274,_0x532831,_0x1c71fd){return db['UserProfile'][_0xa1cf('0x46')]({'where':{'id':_0x592274[_0xa1cf('0x44')]['id']}})[_0xa1cf('0x25')](handleEntityNotFound(_0x532831,null))[_0xa1cf('0x25')](function(_0xfe99f1){if(_0xfe99f1){return _0xfe99f1['removeResources'](_0x592274[_0xa1cf('0x30')]['ids']);}})[_0xa1cf('0x25')](respondWithStatusCode(_0x532831,null))[_0xa1cf('0x43')](handleError(_0x532831,null));};exports[_0xa1cf('0x6a')]=function(_0x416282,_0x4a850a){var _0x1192bf={};if(!_0x416282[_0xa1cf('0x30')][_0xa1cf('0x6b')])throw new Error(_0xa1cf('0x6c'));if(!_0x416282[_0xa1cf('0x30')][_0xa1cf('0x6d')](_0xa1cf('0x37'))){_0x1192bf[_0xa1cf('0x21')]=qs[_0xa1cf('0x21')](_0x416282[_0xa1cf('0x30')][_0xa1cf('0x21')]);_0x1192bf[_0xa1cf('0x1e')]=qs[_0xa1cf('0x1e')](_0x416282['query'][_0xa1cf('0x1e')]);}return db[_0xa1cf('0x40')][_0xa1cf('0x46')]({'where':{'id':_0x416282[_0xa1cf('0x44')]['id']}})[_0xa1cf('0x25')](function(_0x3b07af){if(!_0x3b07af)throw new Error(_0xa1cf('0x6e')+_0x416282[_0xa1cf('0x44')]['id']);return db['UserProfile']['getResources'](_0x416282);})[_0xa1cf('0x25')](respondWithFilteredResult(_0x4a850a,_0x1192bf))[_0xa1cf('0x43')](handleError(_0x4a850a,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 875debf..54bd3bd 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 _0x627e=['events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x627e,0x14a));var _0xe627=function(_0x29513e,_0x1bd246){_0x29513e=_0x29513e-0x0;var _0x5d7aef=_0x627e[_0x29513e];return _0x5d7aef;};'use strict';var EventEmitter=require(_0xe627('0x0'));var UserProfile=require(_0xe627('0x1'))['db'][_0xe627('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe627('0x3')](0x0);var events={'afterCreate':_0xe627('0x4'),'afterUpdate':'update','afterDestroy':_0xe627('0x5')};function emitEvent(_0x328881){return function(_0x2abdc7,_0x59a2c8,_0x52923f){UserProfileEvents['emit'](_0x328881+':'+_0x2abdc7['id'],_0x2abdc7);UserProfileEvents[_0xe627('0x6')](_0x328881,_0x2abdc7);_0x52923f(null);};}for(var e in events){if(events[_0xe627('0x7')](e)){var event=events[e];UserProfile[_0xe627('0x8')](e,emitEvent(event));}}module[_0xe627('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x307e=['emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','remove'];(function(_0x21c928,_0x13fdfa){var _0x3da257=function(_0x361d91){while(--_0x361d91){_0x21c928['push'](_0x21c928['shift']());}};_0x3da257(++_0x13fdfa);}(_0x307e,0xc9));var _0xe307=function(_0x483eb2,_0x3db750){_0x483eb2=_0x483eb2-0x0;var _0x323b52=_0x307e[_0x483eb2];return _0x323b52;};'use strict';var EventEmitter=require(_0xe307('0x0'));var UserProfile=require(_0xe307('0x1'))['db'][_0xe307('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe307('0x3')](0x0);var events={'afterCreate':_0xe307('0x4'),'afterUpdate':'update','afterDestroy':_0xe307('0x5')};function emitEvent(_0xcb2f6e){return function(_0x516a1d,_0x1eee4d,_0x532403){UserProfileEvents[_0xe307('0x6')](_0xcb2f6e+':'+_0x516a1d['id'],_0x516a1d);UserProfileEvents[_0xe307('0x6')](_0xcb2f6e,_0x516a1d);_0x532403(null);};}for(var e in events){if(events[_0xe307('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xe307('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 0220055..0f8009b 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 _0x95b6=['push','model','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','merge','key','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','openTabs','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','parentSections','Lists','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','ui.createdAt','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','params','all','ignore','union','find','autoAssociation'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x95b6,0xeb));var _0x695b=function(_0x1607aa,_0x11cbb4){_0x1607aa=_0x1607aa-0x0;var _0x386193=_0x95b6[_0x1607aa];return _0x386193;};'use strict';var _=require(_0x695b('0x0'));var attributes=require(_0x695b('0x1'));var qs=require(_0x695b('0x2'));var squel=require(_0x695b('0x3'));module[_0x695b('0x4')]=function(_0x4163fd){var _0x2c40f3=_0x4163fd[_0x695b('0x5')];function _0x4f3562(_0x20dd2a,_0x3b579f){return new Promise(function(_0x27fed8,_0x4a7889){if(!_0x3b579f)return _0x27fed8(null);var _0x387bc0=_0x3b579f[_0x695b('0x6')]?{[_0x3b579f['filter'][_0x695b('0x7')]]:_0x3b579f['filter'][_0x695b('0x8')]}:undefined;return _0x2c40f3[_0x20dd2a][_0x695b('0x9')]({'where':_0x387bc0,'raw':!![]})[_0x695b('0xa')](function(_0x57f47e){_0x3b579f[_0x695b('0xb')]=_[_0x695b('0xc')](_0x57f47e,'id');_0x27fed8(_0x3b579f);})['catch'](function(_0x9368f9){_0x4a7889(_0x9368f9);});});}function _0x21183e(_0x2024c6,_0xf8431b){return new Promise(function(_0xbc9c8f,_0x371998){var _0x58c097=_0x2024c6[_0x695b('0x6')]?{[_0x2024c6[_0x695b('0x6')][_0x695b('0x7')]]:_0x2024c6[_0x695b('0x6')]['value']}:undefined;return _0x2c40f3[_0x2024c6['model']][_0x695b('0x9')]({'where':_0x58c097,'raw':!![]})[_0x695b('0xa')](function(_0x50edcf){_0xf8431b['associatedResources']=_['map'](_0x50edcf,function(_0x4ef7b0){return _0x4ef7b0[_0x695b('0xd')];});_0xbc9c8f(_0xf8431b);})[_0x695b('0xe')](function(_0x57b5a0){_0x371998(_0x57b5a0);});});}function _0xc258f3(_0x294aba,_0x317682,_0x27c28c){if(!_0x317682)return Promise[_0x695b('0xf')](null);return new Promise(function(_0x130d23,_0x5d0077){return _0x2c40f3[_0x695b('0x10')][_0x695b('0x9')]({'where':{'sectionId':_0x317682['id']},'raw':!![]})[_0x695b('0xa')](function(_0x526076){if(_0x294aba[_0x695b('0x7')]&&_0x294aba['field']!=='id'){_0x317682[_0x695b('0xb')]=_[_0x695b('0xc')](_0x526076,function(_0xb13249){return _0xb13249[_0x294aba['field']];});}else{if(_0x27c28c===_0x695b('0x11')){_0x317682['associatedResources']=_['map'](_0x526076,function(_0x536819){return{'id':_0x536819[_0x695b('0x12')],'type':_0x536819[_0x695b('0x13')]};});}else{_0x317682[_0x695b('0xb')]=_[_0x695b('0xc')](_0x526076,function(_0x21b46d){return _0x21b46d['resourceId'];});}}_0x130d23(_0x317682);})[_0x695b('0xe')](function(_0x4f404d){_0x5d0077(_0x4f404d);});});}function _0x51a444(_0x508804,_0x31094e){var _0x37485a={'parentSections':[]};switch(_0x508804[_0x695b('0x14')]()){case _0x695b('0x15'):_0x37485a[_0x695b('0x16')]=_0x695b('0x17');break;case _0x695b('0x18'):_0x37485a[_0x695b('0x16')]=_0x695b('0x19');break;case _0x695b('0x1a'):_0x37485a[_0x695b('0x16')]=_0x695b('0x1b');_0x37485a['parentSections']=[{'name':_0x695b('0x1c'),'field':_0x695b('0xd'),'foreignKey':_0x695b('0x1d')}];break;case _0x695b('0x1e'):_0x37485a[_0x695b('0x16')]=_0x695b('0x1f');break;case _0x695b('0x20'):_0x37485a[_0x695b('0x16')]='CmContact';_0x37485a[_0x695b('0x21')]=[{'name':_0x695b('0x22'),'field':'id','foreignKey':'ListId'}];break;case _0x695b('0x23'):_0x37485a[_0x695b('0x16')]=_0x695b('0x24');break;case _0x695b('0x25'):_0x37485a[_0x695b('0x16')]='CmCompany';break;case _0x695b('0x26'):_0x37485a[_0x695b('0x16')]=_0x695b('0x27');break;case _0x695b('0x28'):_0x37485a[_0x695b('0x16')]='ChatQueue';break;case _0x695b('0x29'):_0x37485a[_0x695b('0x16')]='ChatWebsite';break;case _0x695b('0x2a'):_0x37485a['childModel']=_0x695b('0x2b');break;case _0x695b('0x2c'):_0x37485a[_0x695b('0x16')]='FaxAccount';break;case _0x695b('0x2d'):case'internalroutes':case _0x695b('0x2e'):_0x37485a[_0x695b('0x16')]=_0x695b('0x2f');break;case _0x695b('0x30'):_0x37485a[_0x695b('0x16')]=_0x695b('0x31');break;case'voicemails':_0x37485a['childModel']=_0x695b('0x32');break;case _0x695b('0x33'):_0x37485a[_0x695b('0x16')]=_0x695b('0x34');_0x37485a[_0x695b('0x21')]=[{'name':_0x695b('0x35'),'field':_0x695b('0xd'),'foreignKey':'membername','model':_0x695b('0x36'),'filter':{'field':_0x695b('0x37'),'value':[_0x695b('0x38')]}},{'name':_0x695b('0x39'),'field':_0x695b('0xd'),'foreignKey':_0x695b('0x3a'),'model':_0x695b('0x36'),'filter':{'field':_0x695b('0x37'),'value':[_0x695b('0x3b')]}},{'name':_0x695b('0x3c'),'field':_0x695b('0xd'),'foreignKey':_0x695b('0x3d'),'model':_0x695b('0x3e'),'filter':{'field':_0x695b('0x13'),'value':['inbound']}},{'name':_0x695b('0x3f'),'field':_0x695b('0xd'),'foreignKey':_0x695b('0x3d'),'model':_0x695b('0x3e'),'filter':{'field':_0x695b('0x13'),'value':[_0x695b('0x40')]}}];break;case _0x695b('0x41'):_0x37485a['childModel']='VoiceMusicOnHold';break;case'chanspies':_0x37485a[_0x695b('0x16')]=_0x695b('0x42');break;case _0x695b('0x43'):_0x37485a['childModel']=_0x695b('0x44');break;case'ivrcampaigns':_0x37485a['childModel']='Campaign';break;case'mailqueues':_0x37485a[_0x695b('0x16')]='MailQueue';break;case _0x695b('0x45'):_0x37485a['childModel']='MailAccount';break;case _0x695b('0x46'):_0x37485a[_0x695b('0x16')]=_0x695b('0x47');break;case'openchannelqueues':_0x37485a['childModel']=_0x695b('0x48');break;case'openchannelaccounts':_0x37485a[_0x695b('0x16')]=_0x695b('0x49');break;case _0x695b('0x4a'):_0x37485a[_0x695b('0x16')]=_0x695b('0x4b');break;case _0x695b('0x4c'):_0x37485a[_0x695b('0x16')]='SmsAccount';break;case _0x695b('0x4d'):_0x37485a['childModel']=_0x695b('0x4e');break;case _0x695b('0x4f'):_0x37485a['childModel']=_0x695b('0x50');break;case _0x695b('0x51'):_0x37485a[_0x695b('0x16')]=_0x695b('0x52');break;case _0x695b('0x53'):case _0x695b('0x54'):_0x37485a[_0x695b('0x16')]=_0x695b('0x3e');if(_0x31094e){_0x37485a['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x695b('0x55'):case _0x695b('0x56'):case _0x695b('0x57'):_0x37485a[_0x695b('0x16')]=_0x695b('0x36');if(_0x31094e){_0x37485a[_0x695b('0x21')]=[{'name':'Users','filter':{'field':_0x695b('0x37'),'value':[_0x695b('0x58'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x695b('0x39')}];}break;case'zendeskaccounts':_0x37485a[_0x695b('0x16')]=_0x695b('0x59');break;case _0x695b('0x5a'):_0x37485a['childModel']=_0x695b('0x5b');break;case'freshdeskaccounts':_0x37485a[_0x695b('0x16')]='FreshdeskAccount';break;case _0x695b('0x5c'):_0x37485a[_0x695b('0x16')]=_0x695b('0x5d');break;case _0x695b('0x5e'):_0x37485a[_0x695b('0x16')]=_0x695b('0x5f');break;case'zohoaccounts':_0x37485a[_0x695b('0x16')]='ZohoAccount';break;case _0x695b('0x60'):_0x37485a[_0x695b('0x16')]='User';break;case _0x695b('0x61'):_0x37485a[_0x695b('0x16')]=_0x695b('0x62');break;case _0x695b('0x63'):_0x37485a[_0x695b('0x16')]=_0x695b('0x64');break;case _0x695b('0x65'):_0x37485a[_0x695b('0x16')]=_0x695b('0x66');break;case _0x695b('0x67'):_0x37485a['childModel']=_0x695b('0x68');break;case _0x695b('0x69'):_0x37485a[_0x695b('0x16')]=_0x695b('0x6a');break;case _0x695b('0x6b'):_0x37485a[_0x695b('0x16')]='Schedule';break;case _0x695b('0x6c'):_0x37485a[_0x695b('0x16')]=_0x695b('0x6d');break;case _0x695b('0x6e'):_0x37485a[_0x695b('0x16')]=_0x695b('0x6f');break;case _0x695b('0x70'):_0x37485a[_0x695b('0x16')]=_0x695b('0x71');break;case _0x695b('0x72'):_0x37485a[_0x695b('0x16')]=_0x695b('0x73');break;case _0x695b('0x74'):_0x37485a[_0x695b('0x16')]=_0x695b('0x75');break;case _0x695b('0x76'):_0x37485a[_0x695b('0x16')]=_0x695b('0x77');break;case'plugins':_0x37485a[_0x695b('0x16')]=_0x695b('0x78');break;case _0x695b('0x79'):_0x37485a['childModel']=_0x695b('0x11');_0x37485a['parentSections']=[{'name':_0x695b('0x7a'),'field':'id','foreignKey':_0x695b('0x7b')}];break;case'metrics':_0x37485a[_0x695b('0x16')]=_0x695b('0x7c');break;}return _0x37485a;}function _0x4a0044(_0x403776,_0x34c18e){var _0x5970c=_0x403776[_0x695b('0x7d')](0x0)[_0x695b('0x7e')]()+_0x403776[_0x695b('0x7f')](0x1);var _0x48c285={'type':_0x2c40f3[_0x695b('0x80')][_0x695b('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x396001,_0x4bf38d){var _0x1e8e67=squel[_0x695b('0x82')]()[_0x695b('0x7')](_0x695b('0x83')+_0x5970c+'InteractionId','id')[_0x695b('0x7')](_0x695b('0x84'))['from'](_0x695b('0x85')+_0x403776+'_interactions','ui')[_0x695b('0x86')](_0x695b('0x87'),_0x34c18e['id']);return _0x2c40f3[_0x695b('0x88')][_0x695b('0x89')](_0x1e8e67[_0x695b('0x8a')](),_0x48c285)[_0x695b('0xa')](function(_0x2609f2){_0x34c18e[_0x5970c+_0x695b('0x8b')]=_0x2609f2;_0x396001(_0x2609f2);})[_0x695b('0xe')](function(_0x38336b){_0x4bf38d(_0x38336b);});});}return _0x4163fd[_0x695b('0x8c')]('UserProfile',attributes,{'tableName':_0x695b('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x52a609){var _0x463d34={'raw':_0x52a609[_0x695b('0x89')][_0x695b('0x8e')],'where':{}};var _0x1c1056={};var _0xc75ff5={'count':0x0,'rows':[]};var _0x4973e5=_0x52a609[_0x695b('0x89')]['section'];var _0x929984=_0x52a609[_0x695b('0x89')]['mergeResources']||![];var _0x2843f9=_0x51a444(_0x4973e5,_0x929984);if(!_0x2843f9[_0x695b('0x16')])throw new Error(_0x695b('0x8f')+_0x4973e5+'\x27');var _0x597393=[{'name':_0x4973e5}];if(!_[_0x695b('0x90')](_0x2843f9['parentSections']))_0x597393=_0x2843f9[_0x695b('0x21')];var _0x5225db=[];for(var _0x17a9a4=0x0;_0x17a9a4<_0x597393[_0x695b('0x91')];_0x17a9a4++){_0x5225db['push'](_0x2c40f3[_0x695b('0x92')]['find']({'where':{'userProfileId':_0x52a609[_0x695b('0x93')]['id'],'name':_0x597393[_0x17a9a4][_0x695b('0xd')]},'raw':!![]}));}return Promise[_0x695b('0x94')](_0x5225db)[_0x695b('0xa')](function(_0x2b04c9){var _0x4e1749=_[_0x695b('0x6')](_0x2b04c9,function(_0x3d6fd9){return _0x3d6fd9?_0x3d6fd9:undefined;});var _0x4c0967=_['filter'](_0x597393,[_0x695b('0x95'),!![]]);var _0x5048cb=_[_0x695b('0x90')](_0x4e1749)&&_[_0x695b('0x90')](_0x4c0967)?null:_[_0x695b('0x96')](_0x4c0967,_0x4e1749);if(!_0x5048cb)return null;var _0x3f6ad7=[];for(var _0x295050=0x0;_0x295050<_0x5048cb[_0x695b('0x91')];_0x295050++){var _0x2d0cdc=_[_0x695b('0x97')](_0x597393,function(_0x33ba28){return _0x5048cb[_0x295050]?_0x33ba28['name']===_0x5048cb[_0x295050][_0x695b('0xd')]:null;});if(_0x2d0cdc){if(_0x5048cb[_0x295050][_0x695b('0x95')]){_0x3f6ad7['push'](_0x4f3562(_0x2843f9['childModel'],_0x5048cb[_0x295050]));}else{if(!_0x5048cb[_0x295050][_0x695b('0x98')]){_0x3f6ad7[_0x695b('0x99')](_0xc258f3(_0x2d0cdc,_0x5048cb[_0x295050],_0x2843f9[_0x695b('0x16')]));}else{if(_0x2d0cdc[_0x695b('0x9a')]){_0x3f6ad7['push'](_0x21183e(_0x2d0cdc,_0x5048cb[_0x295050]));}}}}}return Promise[_0x695b('0x94')](_0x3f6ad7);})[_0x695b('0xa')](function(_0x31ff7d){var _0x2fa9a8=_0x31ff7d;var _0x594a95=null;if(_0x2fa9a8){_0x594a95=_0x2fa9a8[_0x695b('0x91')]===0x1?_0x2fa9a8[0x0]:null;}if(!_0x594a95&&!_0x2fa9a8)return _0xc75ff5;var _0x48a0be=_0x2c40f3[_0x2843f9[_0x695b('0x16')]][_0x695b('0x9b')];_0x1c1056[_0x695b('0x9a')]=_[_0x695b('0x9c')](_0x48a0be);_0x1c1056[_0x695b('0x89')]=_['keys'](_0x52a609[_0x695b('0x89')]);_0x1c1056['filters']=_[_0x695b('0x9d')](_0x1c1056[_0x695b('0x9a')],_0x1c1056[_0x695b('0x89')]);_0x463d34[_0x695b('0x9e')]=_[_0x695b('0x9d')](_0x1c1056['model'],qs[_0x695b('0x9f')](_0x52a609['query'][_0x695b('0x9f')]));_0x463d34['attributes']=_0x463d34[_0x695b('0x9e')][_0x695b('0x91')]?_0x463d34[_0x695b('0x9e')]:_0x1c1056[_0x695b('0x9a')];if(!_0x52a609[_0x695b('0x89')][_0x695b('0xa0')]('nolimit')){_0x463d34['limit']=qs[_0x695b('0xa1')](_0x52a609[_0x695b('0x89')][_0x695b('0xa1')]);_0x463d34[_0x695b('0xa2')]=qs[_0x695b('0xa2')](_0x52a609[_0x695b('0x89')][_0x695b('0xa2')]);}_0x463d34[_0x695b('0xa3')]=qs[_0x695b('0xa4')](_0x52a609[_0x695b('0x89')]['sort']);_0x463d34[_0x695b('0x86')]=qs[_0x695b('0xa5')](_[_0x695b('0xa6')](_0x52a609[_0x695b('0x89')],_0x1c1056[_0x695b('0xa5')]));if(_0x52a609[_0x695b('0x89')][_0x695b('0x6')]){_0x463d34['where']=_[_0x695b('0xa7')](_0x463d34[_0x695b('0x86')],{'$or':_[_0x695b('0xc')](_0x48a0be,function(_0x10b3af){if(_0x10b3af[_0x695b('0x13')][_0x695b('0xa8')]!=='VIRTUAL'){var _0x411ca5={};_0x411ca5[_0x10b3af[_0x695b('0x7')]]={'$like':'%'+_0x52a609['query'][_0x695b('0x6')]+'%'};return _0x411ca5;}})});}var _0x758223=[];var _0x30b5d5=null;var _0x4f195c={};if(_0x594a95){_0x30b5d5=_['find'](_0x597393,['name',_0x594a95[_0x695b('0xd')]]);if(_0x30b5d5[_0x695b('0x7')]){_0x4f195c={};if(_0x2843f9[_0x695b('0x16')]===_0x695b('0x11')){_0x4f195c[_0x30b5d5[_0x695b('0xa9')]]=_[_0x695b('0xc')](_0x594a95[_0x695b('0xb')],'id');}else{_0x4f195c[_0x30b5d5[_0x695b('0xa9')]]=_0x594a95[_0x695b('0xb')];}_0x758223[_0x695b('0x99')](_0x4f195c);}else{_0x463d34[_0x695b('0x86')]['id']=_0x594a95['associatedResources'];}}else{for(var _0x241983=0x0;_0x241983<_0x2fa9a8['length'];_0x241983++){_0x30b5d5=_[_0x695b('0x97')](_0x597393,[_0x695b('0xd'),_0x2fa9a8[_0x241983][_0x695b('0xd')]]);if(_0x30b5d5['field']){_0x4f195c={};_0x4f195c[_0x30b5d5[_0x695b('0xa9')]]=_0x2fa9a8[_0x241983][_0x695b('0xb')];_0x758223[_0x695b('0x99')](_0x4f195c);}else{if(!_0x463d34[_0x695b('0x86')]['id'])_0x463d34[_0x695b('0x86')]['id']=[];_0x2fa9a8[_0x241983]['associatedResources']['forEach'](function(_0x2ea0de){_0x463d34['where']['id'][_0x695b('0x99')](_0x2ea0de);});}}}if(!_[_0x695b('0x90')](_0x758223)){_0x463d34['where']=_[_0x695b('0xa7')](_0x463d34[_0x695b('0x86')],{'$and':{'$or':_0x758223}});}_0x463d34=_[_0x695b('0xa7')]({},_0x463d34,_0x52a609[_0x695b('0xaa')]);if(_0x594a95&&!_0x594a95[_0x695b('0x98')]&&_0x2843f9[_0x695b('0x16')]==='AnalyticExtractedReport'){if(_0x52a609[_0x695b('0x89')][_0x695b('0xab')]){_0x463d34[_0x695b('0xac')]=[{'all':!![]}];}return _0x2c40f3[_0x2843f9[_0x695b('0x16')]][_0x695b('0x9')](_0x463d34)[_0x695b('0xa')](function(_0x1e4bed){var _0x8b0680=[];_0x1e4bed[_0x695b('0xad')](function(_0x49c8b9){var _0x3a3344;switch(_0x49c8b9[_0x695b('0xae')]){case _0x695b('0xaf'):_0x3a3344=_[_0x695b('0x97')](_0x594a95[_0x695b('0xb')],function(_0x4e3e4b){return _0x4e3e4b['id']===_0x49c8b9['reportId']&&_0x4e3e4b[_0x695b('0x13')]===_0x695b('0xb0');});break;case'custom':_0x3a3344=_[_0x695b('0x97')](_0x594a95['associatedResources'],function(_0x31390a){return _0x31390a['id']===_0x49c8b9['reportId']&&_0x31390a[_0x695b('0x13')]==='CustomReports';});break;}if(_0x3a3344)_0x8b0680['push'](_0x49c8b9);});_0xc75ff5[_0x695b('0xb1')]=_0x8b0680[_0x695b('0x91')];_0xc75ff5[_0x695b('0xb2')]=_0x8b0680;return _0xc75ff5;});}else{if(!_[_0x695b('0x90')](_0x52a609[_0x695b('0x89')]['ids'])){_0x463d34[_0x695b('0x86')]['id']=_0x463d34[_0x695b('0x86')]['id']?_['intersection'](_0x463d34[_0x695b('0x86')]['id'],_0x52a609[_0x695b('0x89')][_0x695b('0xb3')]):_0x52a609['query'][_0x695b('0xb3')];if(_0x52a609[_0x695b('0x89')][_0x695b('0xb4')]){_0x463d34['order']=_0x52a609[_0x695b('0x89')]['customSorting'];}}if(_0x52a609[_0x695b('0x89')][_0x695b('0xb5')]){_0x463d34[_0x695b('0x86')]=_[_0x695b('0xa7')](_0x463d34['where'],{'$and':_0x52a609['query'][_0x695b('0xb5')]});}return _0x2c40f3[_0x2843f9[_0x695b('0x16')]]['count']({'where':_0x463d34['where']})[_0x695b('0xa')](function(_0x33c328){_0xc75ff5[_0x695b('0xb1')]=_0x33c328;if(_0x52a609[_0x695b('0x89')][_0x695b('0xab')]){if(_0x2843f9[_0x695b('0x16')]===_0x695b('0xb6')){_0x463d34[_0x695b('0xac')]=[{'model':_0x2c40f3[_0x695b('0x6f')],'as':_0x695b('0xb7'),'attributes':['id','name',_0x695b('0xb8')],'required':_0x52a609[_0x695b('0x89')][_0x695b('0xb9')]?!![]:![]},{'model':_0x2c40f3['Tag'],'as':_0x695b('0xba'),'attributes':['id','name',_0x695b('0xb8')],'through':_0x52a609['query'][_0x695b('0xb9')]?{'attributes':[],'where':{'TagId':_0x52a609['query'][_0x695b('0xb9')]||undefined}}:{},'required':_0x52a609[_0x695b('0x89')][_0x695b('0xb9')]?!![]:![]}];}else{_0x463d34[_0x695b('0xac')]=[{'all':!![]}];}}return _0x2c40f3[_0x2843f9['childModel']][_0x695b('0x9')](_0x463d34);})[_0x695b('0xa')](function(_0x4d1188){_0xc75ff5[_0x695b('0xb2')]=_0x4d1188;if(_0x4973e5==='Agents'&&_0x52a609[_0x695b('0x89')][_0x695b('0xbb')]==='true'){var _0x45ce05=[];for(var _0x1add55=0x0;_0x1add55<_0xc75ff5[_0x695b('0xb2')][_0x695b('0x91')];_0x1add55++){_0x45ce05['push'](_0x4a0044(_0x695b('0xbc'),_0xc75ff5[_0x695b('0xb2')][_0x1add55][_0x695b('0xbd')]));_0x45ce05[_0x695b('0x99')](_0x4a0044(_0x695b('0xbe'),_0xc75ff5[_0x695b('0xb2')][_0x1add55][_0x695b('0xbd')]));_0x45ce05[_0x695b('0x99')](_0x4a0044(_0x695b('0xbf'),_0xc75ff5[_0x695b('0xb2')][_0x1add55][_0x695b('0xbd')]));_0x45ce05[_0x695b('0x99')](_0x4a0044(_0x695b('0xc0'),_0xc75ff5[_0x695b('0xb2')][_0x1add55][_0x695b('0xbd')]));_0x45ce05['push'](_0x4a0044('openchannel',_0xc75ff5[_0x695b('0xb2')][_0x1add55]['dataValues']));_0x45ce05[_0x695b('0x99')](_0x4a0044(_0x695b('0xc1'),_0xc75ff5[_0x695b('0xb2')][_0x1add55]['dataValues']));}return Promise[_0x695b('0x94')](_0x45ce05)['then'](function(){return _0xc75ff5;});}return _0xc75ff5;});}});}}});}; \ No newline at end of file +var _0x34ed=['faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueue','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','slice','QueryTypes','SELECT','InteractionId','ui.createdAt','from','user_has_','_interactions','where','define','UserProfile','user_profiles','query','raw','isEmpty','length','push','UserProfileSection','find','all','ignore','autoAssociation','model','rawAttributes','keys','intersection','attributes','fields','nolimit','limit','offset','order','sort','filters','merge','key','VIRTUAL','foreignKey','includeAll','include','forEach','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','tag','ThroughTags','color','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','associatedResources','map','catch','field','name','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','contacts','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue'];(function(_0xa09d69,_0x108d32){var _0x1111e9=function(_0x200a5f){while(--_0x200a5f){_0xa09d69['push'](_0xa09d69['shift']());}};_0x1111e9(++_0x108d32);}(_0x34ed,0x91));var _0xd34e=function(_0x1b8a6c,_0x4c2a5f){_0x1b8a6c=_0x1b8a6c-0x0;var _0x13ec3b=_0x34ed[_0x1b8a6c];return _0x13ec3b;};'use strict';var _=require(_0xd34e('0x0'));var attributes=require(_0xd34e('0x1'));var qs=require(_0xd34e('0x2'));var squel=require(_0xd34e('0x3'));module[_0xd34e('0x4')]=function(_0x3f4b9b){var _0x86f452=_0x3f4b9b[_0xd34e('0x5')];function _0x4ed4f1(_0x16e744,_0x48a5f9){return new Promise(function(_0x1dc2a7,_0x30264b){if(!_0x48a5f9)return _0x1dc2a7(null);var _0x59b1a1=_0x48a5f9[_0xd34e('0x6')]?{[_0x48a5f9[_0xd34e('0x6')]['field']]:_0x48a5f9[_0xd34e('0x6')][_0xd34e('0x7')]}:undefined;return _0x86f452[_0x16e744][_0xd34e('0x8')]({'where':_0x59b1a1,'raw':!![]})[_0xd34e('0x9')](function(_0x258d20){_0x48a5f9[_0xd34e('0xa')]=_[_0xd34e('0xb')](_0x258d20,'id');_0x1dc2a7(_0x48a5f9);})[_0xd34e('0xc')](function(_0x4b1d10){_0x30264b(_0x4b1d10);});});}function _0x3f3725(_0x5f5472,_0x3833d7){return new Promise(function(_0x35f508,_0xc214c7){var _0x297890=_0x5f5472[_0xd34e('0x6')]?{[_0x5f5472[_0xd34e('0x6')][_0xd34e('0xd')]]:_0x5f5472['filter']['value']}:undefined;return _0x86f452[_0x5f5472['model']][_0xd34e('0x8')]({'where':_0x297890,'raw':!![]})['then'](function(_0x2ce621){_0x3833d7[_0xd34e('0xa')]=_[_0xd34e('0xb')](_0x2ce621,function(_0x25626b){return _0x25626b[_0xd34e('0xe')];});_0x35f508(_0x3833d7);})[_0xd34e('0xc')](function(_0x3c4a21){_0xc214c7(_0x3c4a21);});});}function _0x5a4224(_0x43b08a,_0x2c3ac5,_0x464dd4){if(!_0x2c3ac5)return Promise[_0xd34e('0xf')](null);return new Promise(function(_0x87dff0,_0x33ada2){return _0x86f452[_0xd34e('0x10')][_0xd34e('0x8')]({'where':{'sectionId':_0x2c3ac5['id']},'raw':!![]})[_0xd34e('0x9')](function(_0x34817c){if(_0x43b08a[_0xd34e('0xd')]&&_0x43b08a['field']!=='id'){_0x2c3ac5[_0xd34e('0xa')]=_[_0xd34e('0xb')](_0x34817c,function(_0x19a257){return _0x19a257[_0x43b08a[_0xd34e('0xd')]];});}else{if(_0x464dd4===_0xd34e('0x11')){_0x2c3ac5[_0xd34e('0xa')]=_[_0xd34e('0xb')](_0x34817c,function(_0x4d7995){return{'id':_0x4d7995['resourceId'],'type':_0x4d7995[_0xd34e('0x12')]};});}else{_0x2c3ac5[_0xd34e('0xa')]=_[_0xd34e('0xb')](_0x34817c,function(_0x48d086){return _0x48d086[_0xd34e('0x13')];});}}_0x87dff0(_0x2c3ac5);})[_0xd34e('0xc')](function(_0x5afbf1){_0x33ada2(_0x5afbf1);});});}function _0x384d0b(_0x5c9f90,_0x5e7739){var _0x2a6a99={'parentSections':[]};switch(_0x5c9f90[_0xd34e('0x14')]()){case _0xd34e('0x15'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x17');break;case _0xd34e('0x18'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x19');break;case _0xd34e('0x1a'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x1b');_0x2a6a99[_0xd34e('0x1c')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xd34e('0x1d')}];break;case _0xd34e('0x1e'):_0x2a6a99[_0xd34e('0x16')]='JscriptyProject';break;case _0xd34e('0x1f'):_0x2a6a99[_0xd34e('0x16')]='CmContact';_0x2a6a99['parentSections']=[{'name':_0xd34e('0x20'),'field':'id','foreignKey':_0xd34e('0x21')}];break;case _0xd34e('0x22'):_0x2a6a99['childModel']=_0xd34e('0x23');break;case _0xd34e('0x24'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x25');break;case'globalcustomfields':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x26');break;case _0xd34e('0x27'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x28');break;case _0xd34e('0x29'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x2a');break;case _0xd34e('0x2b'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x2c');break;case _0xd34e('0x2d'):_0x2a6a99['childModel']=_0xd34e('0x2e');break;case _0xd34e('0x2f'):case _0xd34e('0x30'):case _0xd34e('0x31'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x32');break;case _0xd34e('0x33'):_0x2a6a99['childModel']=_0xd34e('0x34');break;case'voicemails':_0x2a6a99[_0xd34e('0x16')]='VoiceMail';break;case _0xd34e('0x35'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x36');_0x2a6a99[_0xd34e('0x1c')]=[{'name':_0xd34e('0x37'),'field':_0xd34e('0xe'),'foreignKey':_0xd34e('0x38'),'model':_0xd34e('0x39'),'filter':{'field':_0xd34e('0x3a'),'value':[_0xd34e('0x3b')]}},{'name':_0xd34e('0x3c'),'field':'name','foreignKey':_0xd34e('0x38'),'model':_0xd34e('0x39'),'filter':{'field':'role','value':[_0xd34e('0x3d')]}},{'name':'VoiceQueues','field':_0xd34e('0xe'),'foreignKey':'queue','model':_0xd34e('0x3e'),'filter':{'field':_0xd34e('0x12'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xd34e('0xe'),'foreignKey':_0xd34e('0x3f'),'model':_0xd34e('0x3e'),'filter':{'field':_0xd34e('0x12'),'value':[_0xd34e('0x40')]}}];break;case _0xd34e('0x41'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x42');break;case _0xd34e('0x43'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x44');break;case'voiceprefixes':_0x2a6a99[_0xd34e('0x16')]='VoicePrefix';break;case _0xd34e('0x45'):_0x2a6a99[_0xd34e('0x16')]='Campaign';break;case'mailqueues':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x46');break;case _0xd34e('0x47'):_0x2a6a99['childModel']=_0xd34e('0x48');break;case _0xd34e('0x49'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x4a');break;case'openchannelqueues':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x4b');break;case'openchannelaccounts':_0x2a6a99['childModel']=_0xd34e('0x4c');break;case'smsqueues':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x4d');break;case _0xd34e('0x4e'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x4f');break;case _0xd34e('0x50'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x51');break;case'whatsappaccounts':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x52');break;case _0xd34e('0x53'):_0x2a6a99['childModel']=_0xd34e('0x54');break;case _0xd34e('0x55'):case _0xd34e('0x56'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x3e');if(_0x5e7739){_0x2a6a99[_0xd34e('0x1c')]=[{'name':_0xd34e('0x57')},{'name':'QueueCampaigns'}];}break;case _0xd34e('0x58'):case'agents':case _0xd34e('0x59'):_0x2a6a99['childModel']='User';if(_0x5e7739){_0x2a6a99['parentSections']=[{'name':_0xd34e('0x5a'),'filter':{'field':_0xd34e('0x3a'),'value':[_0xd34e('0x5b'),_0xd34e('0x5c')]},'ignore':!![]},{'name':'Agents'},{'name':_0xd34e('0x3c')}];}break;case _0xd34e('0x5d'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x5e');break;case'salesforceaccounts':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x5f');break;case'freshdeskaccounts':_0x2a6a99['childModel']=_0xd34e('0x60');break;case _0xd34e('0x61'):_0x2a6a99[_0xd34e('0x16')]='SugarcrmAccount';break;case'deskaccounts':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x62');break;case _0xd34e('0x63'):_0x2a6a99[_0xd34e('0x16')]='ZohoAccount';break;case _0xd34e('0x64'):_0x2a6a99['childModel']='User';break;case _0xd34e('0x65'):_0x2a6a99[_0xd34e('0x16')]='CannedAnswer';break;case _0xd34e('0x66'):_0x2a6a99['childModel']=_0xd34e('0x67');break;case _0xd34e('0x68'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x69');break;case _0xd34e('0x6a'):_0x2a6a99['childModel']=_0xd34e('0x6b');break;case _0xd34e('0x6c'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x6d');break;case _0xd34e('0x6e'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x6f');break;case _0xd34e('0x70'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x71');break;case _0xd34e('0x72'):_0x2a6a99['childModel']=_0xd34e('0x73');break;case'templates':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x74');break;case _0xd34e('0x75'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x76');break;case _0xd34e('0x77'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x78');break;case'variables':_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x79');break;case _0xd34e('0x7a'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x7b');break;case _0xd34e('0x7c'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x11');_0x2a6a99[_0xd34e('0x1c')]=[{'name':'Reports','field':'id','foreignKey':_0xd34e('0x7d')}];break;case _0xd34e('0x7e'):_0x2a6a99[_0xd34e('0x16')]=_0xd34e('0x7f');break;}return _0x2a6a99;}function _0xea2fc7(_0x19c5b5,_0x2c150d){var _0x1691b5=_0x19c5b5[_0xd34e('0x80')](0x0)['toUpperCase']()+_0x19c5b5[_0xd34e('0x81')](0x1);var _0x303e28={'type':_0x86f452['Sequelize'][_0xd34e('0x82')][_0xd34e('0x83')],'raw':!![]};return new Promise(function(_0x492220,_0x5e9193){var _0x3a733d=squel['select']()[_0xd34e('0xd')]('ui.'+_0x1691b5+_0xd34e('0x84'),'id')[_0xd34e('0xd')](_0xd34e('0x85'))[_0xd34e('0x86')](_0xd34e('0x87')+_0x19c5b5+_0xd34e('0x88'),'ui')[_0xd34e('0x89')]('ui.UserId\x20=\x20?',_0x2c150d['id']);return _0x86f452['sequelize']['query'](_0x3a733d['toString'](),_0x303e28)[_0xd34e('0x9')](function(_0x29fbf9){_0x2c150d[_0x1691b5+'OpenTabs']=_0x29fbf9;_0x492220(_0x29fbf9);})['catch'](function(_0x395448){_0x5e9193(_0x395448);});});}return _0x3f4b9b[_0xd34e('0x8a')](_0xd34e('0x8b'),attributes,{'tableName':_0xd34e('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x255b4d){var _0x54ee18={'raw':_0x255b4d[_0xd34e('0x8d')][_0xd34e('0x8e')],'where':{}};var _0x3f4fc8={};var _0x146be9={'count':0x0,'rows':[]};var _0x123e28=_0x255b4d[_0xd34e('0x8d')]['section'];var _0x38826b=_0x255b4d['query']['mergeResources']||![];var _0x470ea4=_0x384d0b(_0x123e28,_0x38826b);if(!_0x470ea4[_0xd34e('0x16')])throw new Error('Invalid\x20section\x20\x27'+_0x123e28+'\x27');var _0x50a754=[{'name':_0x123e28}];if(!_[_0xd34e('0x8f')](_0x470ea4[_0xd34e('0x1c')]))_0x50a754=_0x470ea4[_0xd34e('0x1c')];var _0x54013a=[];for(var _0x2b5340=0x0;_0x2b5340<_0x50a754[_0xd34e('0x90')];_0x2b5340++){_0x54013a[_0xd34e('0x91')](_0x86f452[_0xd34e('0x92')][_0xd34e('0x93')]({'where':{'userProfileId':_0x255b4d['params']['id'],'name':_0x50a754[_0x2b5340][_0xd34e('0xe')]},'raw':!![]}));}return Promise[_0xd34e('0x94')](_0x54013a)[_0xd34e('0x9')](function(_0x35085a){var _0x4bfb9c=_[_0xd34e('0x6')](_0x35085a,function(_0x459e86){return _0x459e86?_0x459e86:undefined;});var _0x1dd147=_[_0xd34e('0x6')](_0x50a754,[_0xd34e('0x95'),!![]]);var _0x4bbddb=_[_0xd34e('0x8f')](_0x4bfb9c)&&_[_0xd34e('0x8f')](_0x1dd147)?null:_['union'](_0x1dd147,_0x4bfb9c);if(!_0x4bbddb)return null;var _0x120459=[];for(var _0x5aa776=0x0;_0x5aa776<_0x4bbddb[_0xd34e('0x90')];_0x5aa776++){var _0x2faba5=_[_0xd34e('0x93')](_0x50a754,function(_0x51f638){return _0x4bbddb[_0x5aa776]?_0x51f638[_0xd34e('0xe')]===_0x4bbddb[_0x5aa776][_0xd34e('0xe')]:null;});if(_0x2faba5){if(_0x4bbddb[_0x5aa776][_0xd34e('0x95')]){_0x120459[_0xd34e('0x91')](_0x4ed4f1(_0x470ea4[_0xd34e('0x16')],_0x4bbddb[_0x5aa776]));}else{if(!_0x4bbddb[_0x5aa776][_0xd34e('0x96')]){_0x120459[_0xd34e('0x91')](_0x5a4224(_0x2faba5,_0x4bbddb[_0x5aa776],_0x470ea4['childModel']));}else{if(_0x2faba5[_0xd34e('0x97')]){_0x120459[_0xd34e('0x91')](_0x3f3725(_0x2faba5,_0x4bbddb[_0x5aa776]));}}}}}return Promise[_0xd34e('0x94')](_0x120459);})[_0xd34e('0x9')](function(_0x1277a9){var _0xb12979=_0x1277a9;var _0x1d11c9=null;if(_0xb12979){_0x1d11c9=_0xb12979['length']===0x1?_0xb12979[0x0]:null;}if(!_0x1d11c9&&!_0xb12979)return _0x146be9;var _0x2de1b5=_0x86f452[_0x470ea4[_0xd34e('0x16')]][_0xd34e('0x98')];_0x3f4fc8['model']=_['keys'](_0x2de1b5);_0x3f4fc8[_0xd34e('0x8d')]=_[_0xd34e('0x99')](_0x255b4d[_0xd34e('0x8d')]);_0x3f4fc8['filters']=_[_0xd34e('0x9a')](_0x3f4fc8[_0xd34e('0x97')],_0x3f4fc8[_0xd34e('0x8d')]);_0x54ee18[_0xd34e('0x9b')]=_[_0xd34e('0x9a')](_0x3f4fc8['model'],qs[_0xd34e('0x9c')](_0x255b4d[_0xd34e('0x8d')]['fields']));_0x54ee18[_0xd34e('0x9b')]=_0x54ee18[_0xd34e('0x9b')][_0xd34e('0x90')]?_0x54ee18['attributes']:_0x3f4fc8[_0xd34e('0x97')];if(!_0x255b4d[_0xd34e('0x8d')]['hasOwnProperty'](_0xd34e('0x9d'))){_0x54ee18[_0xd34e('0x9e')]=qs['limit'](_0x255b4d['query']['limit']);_0x54ee18[_0xd34e('0x9f')]=qs['offset'](_0x255b4d[_0xd34e('0x8d')]['offset']);}_0x54ee18[_0xd34e('0xa0')]=qs[_0xd34e('0xa1')](_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xa1')]);_0x54ee18[_0xd34e('0x89')]=qs['filters'](_['pick'](_0x255b4d[_0xd34e('0x8d')],_0x3f4fc8[_0xd34e('0xa2')]));if(_0x255b4d[_0xd34e('0x8d')][_0xd34e('0x6')]){_0x54ee18[_0xd34e('0x89')]=_[_0xd34e('0xa3')](_0x54ee18[_0xd34e('0x89')],{'$or':_['map'](_0x2de1b5,function(_0x3ffb5e){if(_0x3ffb5e[_0xd34e('0x12')][_0xd34e('0xa4')]!==_0xd34e('0xa5')){var _0x29cac8={};_0x29cac8[_0x3ffb5e[_0xd34e('0xd')]]={'$like':'%'+_0x255b4d[_0xd34e('0x8d')]['filter']+'%'};return _0x29cac8;}})});}var _0x5303af=[];var _0x3d795a=null;var _0x2750be={};if(_0x1d11c9){_0x3d795a=_[_0xd34e('0x93')](_0x50a754,[_0xd34e('0xe'),_0x1d11c9[_0xd34e('0xe')]]);if(_0x3d795a[_0xd34e('0xd')]){_0x2750be={};if(_0x470ea4[_0xd34e('0x16')]==='AnalyticExtractedReport'){_0x2750be[_0x3d795a[_0xd34e('0xa6')]]=_['map'](_0x1d11c9['associatedResources'],'id');}else{_0x2750be[_0x3d795a['foreignKey']]=_0x1d11c9[_0xd34e('0xa')];}_0x5303af[_0xd34e('0x91')](_0x2750be);}else{_0x54ee18['where']['id']=_0x1d11c9[_0xd34e('0xa')];}}else{for(var _0xf4dfe6=0x0;_0xf4dfe6<_0xb12979[_0xd34e('0x90')];_0xf4dfe6++){_0x3d795a=_[_0xd34e('0x93')](_0x50a754,['name',_0xb12979[_0xf4dfe6][_0xd34e('0xe')]]);if(_0x3d795a[_0xd34e('0xd')]){_0x2750be={};_0x2750be[_0x3d795a[_0xd34e('0xa6')]]=_0xb12979[_0xf4dfe6][_0xd34e('0xa')];_0x5303af['push'](_0x2750be);}else{if(!_0x54ee18[_0xd34e('0x89')]['id'])_0x54ee18[_0xd34e('0x89')]['id']=[];_0xb12979[_0xf4dfe6][_0xd34e('0xa')]['forEach'](function(_0x3ec01f){_0x54ee18[_0xd34e('0x89')]['id'][_0xd34e('0x91')](_0x3ec01f);});}}}if(!_[_0xd34e('0x8f')](_0x5303af)){_0x54ee18[_0xd34e('0x89')]=_[_0xd34e('0xa3')](_0x54ee18['where'],{'$and':{'$or':_0x5303af}});}_0x54ee18=_[_0xd34e('0xa3')]({},_0x54ee18,_0x255b4d['options']);if(_0x1d11c9&&!_0x1d11c9[_0xd34e('0x96')]&&_0x470ea4['childModel']===_0xd34e('0x11')){if(_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xa7')]){_0x54ee18[_0xd34e('0xa8')]=[{'all':!![]}];}return _0x86f452[_0x470ea4[_0xd34e('0x16')]]['findAll'](_0x54ee18)[_0xd34e('0x9')](function(_0xb96aa2){var _0xf22560=[];_0xb96aa2[_0xd34e('0xa9')](function(_0x325fd7){var _0x3761ce;switch(_0x325fd7['reportType']){case _0xd34e('0xaa'):_0x3761ce=_[_0xd34e('0x93')](_0x1d11c9['associatedResources'],function(_0x47eb04){return _0x47eb04['id']===_0x325fd7[_0xd34e('0x7d')]&&_0x47eb04[_0xd34e('0x12')]===_0xd34e('0xab');});break;case _0xd34e('0xac'):_0x3761ce=_[_0xd34e('0x93')](_0x1d11c9[_0xd34e('0xa')],function(_0x13ac04){return _0x13ac04['id']===_0x325fd7['reportId']&&_0x13ac04[_0xd34e('0x12')]==='CustomReports';});break;}if(_0x3761ce)_0xf22560[_0xd34e('0x91')](_0x325fd7);});_0x146be9[_0xd34e('0xad')]=_0xf22560[_0xd34e('0x90')];_0x146be9[_0xd34e('0xae')]=_0xf22560;return _0x146be9;});}else{if(!_[_0xd34e('0x8f')](_0x255b4d['query'][_0xd34e('0xaf')])){_0x54ee18[_0xd34e('0x89')]['id']=_0x54ee18[_0xd34e('0x89')]['id']?_[_0xd34e('0x9a')](_0x54ee18['where']['id'],_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xaf')]):_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xaf')];if(_0x255b4d['query'][_0xd34e('0xb0')]){_0x54ee18[_0xd34e('0xa0')]=_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xb0')];}}if(_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xb1')]){_0x54ee18[_0xd34e('0x89')]=_[_0xd34e('0xa3')](_0x54ee18['where'],{'$and':_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xb1')]});}return _0x86f452[_0x470ea4[_0xd34e('0x16')]][_0xd34e('0xad')]({'where':_0x54ee18['where']})[_0xd34e('0x9')](function(_0x8af75d){_0x146be9[_0xd34e('0xad')]=_0x8af75d;if(_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xa7')]){if(_0x470ea4[_0xd34e('0x16')]===_0xd34e('0xb2')){_0x54ee18[_0xd34e('0xa8')]=[{'model':_0x86f452[_0xd34e('0x73')],'as':_0xd34e('0xb3'),'attributes':['id',_0xd34e('0xe'),'color'],'required':_0x255b4d['query'][_0xd34e('0xb4')]?!![]:![]},{'model':_0x86f452[_0xd34e('0x73')],'as':_0xd34e('0xb5'),'attributes':['id',_0xd34e('0xe'),_0xd34e('0xb6')],'through':_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xb4')]?{'attributes':[],'where':{'TagId':_0x255b4d[_0xd34e('0x8d')]['tag']||undefined}}:{},'required':_0x255b4d[_0xd34e('0x8d')][_0xd34e('0xb4')]?!![]:![]}];}else{_0x54ee18['include']=[{'all':!![]}];}}return _0x86f452[_0x470ea4[_0xd34e('0x16')]][_0xd34e('0x8')](_0x54ee18);})[_0xd34e('0x9')](function(_0x2c784d){_0x146be9[_0xd34e('0xae')]=_0x2c784d;if(_0x123e28===_0xd34e('0x37')&&_0x255b4d[_0xd34e('0x8d')]['openTabs']===_0xd34e('0xb7')){var _0x34be9e=[];for(var _0x1d8cb8=0x0;_0x1d8cb8<_0x146be9[_0xd34e('0xae')][_0xd34e('0x90')];_0x1d8cb8++){_0x34be9e[_0xd34e('0x91')](_0xea2fc7('chat',_0x146be9['rows'][_0x1d8cb8][_0xd34e('0xb8')]));_0x34be9e[_0xd34e('0x91')](_0xea2fc7(_0xd34e('0xb9'),_0x146be9[_0xd34e('0xae')][_0x1d8cb8]['dataValues']));_0x34be9e[_0xd34e('0x91')](_0xea2fc7(_0xd34e('0xba'),_0x146be9[_0xd34e('0xae')][_0x1d8cb8][_0xd34e('0xb8')]));_0x34be9e['push'](_0xea2fc7(_0xd34e('0xbb'),_0x146be9[_0xd34e('0xae')][_0x1d8cb8][_0xd34e('0xb8')]));_0x34be9e[_0xd34e('0x91')](_0xea2fc7(_0xd34e('0xbc'),_0x146be9[_0xd34e('0xae')][_0x1d8cb8][_0xd34e('0xb8')]));_0x34be9e[_0xd34e('0x91')](_0xea2fc7(_0xd34e('0xbd'),_0x146be9[_0xd34e('0xae')][_0x1d8cb8][_0xd34e('0xb8')]));}return Promise[_0xd34e('0x94')](_0x34be9e)[_0xd34e('0x9')](function(){return _0x146be9;});}return _0x146be9;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 640d7b1..bd152a2 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 _0x323f=['register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x5f2a30,_0x26049b){var _0x3f205b=function(_0x549b09){while(--_0x549b09){_0x5f2a30['push'](_0x5f2a30['shift']());}};_0x3f205b(++_0x26049b);}(_0x323f,0x1ee));var _0xf323=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x323f[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});config[_0xf323('0xb')]=_[_0xf323('0xc')](config[_0xf323('0xb')],{'host':_0xf323('0xd'),'port':0x18eb});var socket=require(_0xf323('0xe'))(new Redis(config[_0xf323('0xb')]));require(_0xf323('0xf'))[_0xf323('0x10')](socket);function respondWithRpcPromise(_0x10d1ff,_0x21e82e,_0x22fd48){return new BPromise(function(_0x4196b5,_0x8825ef){return client[_0xf323('0x11')](_0x10d1ff,_0x22fd48)[_0xf323('0x12')](function(_0xb6ec37){logger[_0xf323('0x13')]('UserProfile,\x20%s,\x20%s',_0x21e82e,_0xf323('0x14'));logger[_0xf323('0x15')](_0xf323('0x16'),_0x21e82e,'request\x20sent',JSON[_0xf323('0x17')](_0xb6ec37));if(_0xb6ec37[_0xf323('0x18')]){if(_0xb6ec37[_0xf323('0x18')][_0xf323('0x19')]===0x1f4){logger[_0xf323('0x18')](_0xf323('0x1a'),_0x21e82e,_0xb6ec37['error']['message']);return _0x8825ef(_0xb6ec37[_0xf323('0x18')][_0xf323('0x1b')]);}logger[_0xf323('0x18')](_0xf323('0x1a'),_0x21e82e,_0xb6ec37[_0xf323('0x18')]['message']);return _0x4196b5(_0xb6ec37[_0xf323('0x18')][_0xf323('0x1b')]);}else{logger[_0xf323('0x13')](_0xf323('0x1a'),_0x21e82e,'request\x20sent');_0x4196b5(_0xb6ec37[_0xf323('0x1c')][_0xf323('0x1b')]);}})[_0xf323('0x1d')](function(_0x41b2cb){logger['error'](_0xf323('0x1a'),_0x21e82e,_0x41b2cb);_0x8825ef(_0x41b2cb);});});} \ No newline at end of file +var _0x7031=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./userProfile.socket','request','then'];(function(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0x7031,0x19a));var _0x1703=function(_0x1828ee,_0x5db35c){_0x1828ee=_0x1828ee-0x0;var _0x26b4b8=_0x7031[_0x1828ee];return _0x26b4b8;};'use strict';var _=require(_0x1703('0x0'));var util=require(_0x1703('0x1'));var moment=require('moment');var BPromise=require(_0x1703('0x2'));var rs=require(_0x1703('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1703('0x4'))['db'];var utils=require(_0x1703('0x5'));var logger=require('../../config/logger')(_0x1703('0x6'));var config=require(_0x1703('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1703('0x8')]['http']({'port':0x232a});config[_0x1703('0x9')]=_[_0x1703('0xa')](config[_0x1703('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1703('0xb'))(new Redis(config[_0x1703('0x9')]));require(_0x1703('0xc'))['register'](socket);function respondWithRpcPromise(_0x1ace70,_0x3feed6,_0x3b1913){return new BPromise(function(_0x228fae,_0x3a5276){return client[_0x1703('0xd')](_0x1ace70,_0x3b1913)[_0x1703('0xe')](function(_0xf7acd4){logger[_0x1703('0xf')](_0x1703('0x10'),_0x3feed6,_0x1703('0x11'));logger[_0x1703('0x12')](_0x1703('0x13'),_0x3feed6,_0x1703('0x11'),JSON[_0x1703('0x14')](_0xf7acd4));if(_0xf7acd4[_0x1703('0x15')]){if(_0xf7acd4[_0x1703('0x15')]['code']===0x1f4){logger['error'](_0x1703('0x10'),_0x3feed6,_0xf7acd4[_0x1703('0x15')]['message']);return _0x3a5276(_0xf7acd4[_0x1703('0x15')][_0x1703('0x16')]);}logger[_0x1703('0x15')]('UserProfile,\x20%s,\x20%s',_0x3feed6,_0xf7acd4[_0x1703('0x15')][_0x1703('0x16')]);return _0x228fae(_0xf7acd4['error'][_0x1703('0x16')]);}else{logger[_0x1703('0xf')](_0x1703('0x10'),_0x3feed6,_0x1703('0x11'));_0x228fae(_0xf7acd4[_0x1703('0x17')][_0x1703('0x16')]);}})[_0x1703('0x18')](function(_0x5d339a){logger['error']('UserProfile,\x20%s,\x20%s',_0x3feed6,_0x5d339a);_0x3a5276(_0x5d339a);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fb2898e..1ec0226 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 _0xb26a=['./userProfile.events','remove','update','emit','removeListener','register','length','userProfile:'];(function(_0x454d94,_0x2d5642){var _0x1389b0=function(_0x1202ad){while(--_0x1202ad){_0x454d94['push'](_0x454d94['shift']());}};_0x1389b0(++_0x2d5642);}(_0xb26a,0x1b0));var _0xab26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb26a[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0xab26('0x0'));var events=['save',_0xab26('0x1'),_0xab26('0x2')];function createListener(_0x386dfa,_0x2d122d){return function(_0x4c2a89){_0x2d122d[_0xab26('0x3')](_0x386dfa,_0x4c2a89);};}function removeListener(_0x3ad417,_0x48fea7){return function(){UserProfileEvents[_0xab26('0x4')](_0x3ad417,_0x48fea7);};}exports[_0xab26('0x5')]=function(_0x234119){for(var _0x3f61a0=0x0,_0x182810=events[_0xab26('0x6')];_0x3f61a0<_0x182810;_0x3f61a0++){var _0x31d95d=events[_0x3f61a0];var _0x4d6380=createListener(_0xab26('0x7')+_0x31d95d,_0x234119);UserProfileEvents['on'](_0x31d95d,_0x4d6380);}}; \ No newline at end of file +var _0x89a4=['userProfile:','./userProfile.events','remove','update','emit','register','length'];(function(_0x1b04c9,_0x3bf99b){var _0x6db647=function(_0x4b9c2b){while(--_0x4b9c2b){_0x1b04c9['push'](_0x1b04c9['shift']());}};_0x6db647(++_0x3bf99b);}(_0x89a4,0x10b));var _0x489a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89a4[_0x321bb2];return _0x9c12ed;};'use strict';var UserProfileEvents=require(_0x489a('0x0'));var events=['save',_0x489a('0x1'),_0x489a('0x2')];function createListener(_0x30c25b,_0x5a34ce){return function(_0x42e0c9){_0x5a34ce[_0x489a('0x3')](_0x30c25b,_0x42e0c9);};}function removeListener(_0x98358f,_0x2f5244){return function(){UserProfileEvents['removeListener'](_0x98358f,_0x2f5244);};}exports[_0x489a('0x4')]=function(_0x8d4cc6){for(var _0x4fafbe=0x0,_0x341d93=events[_0x489a('0x5')];_0x4fafbe<_0x341d93;_0x4fafbe++){var _0x5eb0be=events[_0x4fafbe];var _0x19a09f=createListener(_0x489a('0x6')+_0x5eb0be,_0x8d4cc6);UserProfileEvents['on'](_0x5eb0be,_0x19a09f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a2757ec..5e20966 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 _0x33cd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','multer','util'];(function(_0x1f7026,_0x32dc7f){var _0x586005=function(_0x232016){while(--_0x232016){_0x1f7026['push'](_0x1f7026['shift']());}};_0x586005(++_0x32dc7f);}(_0x33cd,0x166));var _0xd33c=function(_0x32cd96,_0x7b8f5f){_0x32cd96=_0x32cd96-0x0;var _0x301473=_0x33cd[_0x32cd96];return _0x301473;};'use strict';var multer=require(_0xd33c('0x0'));var util=require(_0xd33c('0x1'));var path=require(_0xd33c('0x2'));var timeout=require(_0xd33c('0x3'));var express=require(_0xd33c('0x4'));var router=express[_0xd33c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd33c('0x6'));var interaction=require(_0xd33c('0x7'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xd33c('0x8')](),controller[_0xd33c('0x9')]);router[_0xd33c('0xa')]('/describe',auth[_0xd33c('0x8')](),controller['describe']);router['get']('/:id',auth[_0xd33c('0x8')](),controller[_0xd33c('0xb')]);router[_0xd33c('0xc')]('/',auth[_0xd33c('0x8')](),controller[_0xd33c('0xd')]);router[_0xd33c('0xe')](_0xd33c('0xf'),auth[_0xd33c('0x8')](),controller[_0xd33c('0x10')]);router[_0xd33c('0x11')](_0xd33c('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x75bd=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','post','create','put','update','delete','exports','multer'];(function(_0x155488,_0x5dd87b){var _0xbe08ab=function(_0x378ac6){while(--_0x378ac6){_0x155488['push'](_0x155488['shift']());}};_0xbe08ab(++_0x5dd87b);}(_0x75bd,0xc5));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xd75b('0x0'));var util=require(_0xd75b('0x1'));var path=require(_0xd75b('0x2'));var timeout=require(_0xd75b('0x3'));var express=require(_0xd75b('0x4'));var router=express[_0xd75b('0x5')]();var fs_extra=require(_0xd75b('0x6'));var auth=require(_0xd75b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd75b('0x8'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xd75b('0x9')](),controller['index']);router[_0xd75b('0xa')]('/describe',auth[_0xd75b('0x9')](),controller['describe']);router[_0xd75b('0xa')](_0xd75b('0xb'),auth[_0xd75b('0x9')](),controller['show']);router[_0xd75b('0xc')]('/',auth['isAuthenticated'](),controller[_0xd75b('0xd')]);router[_0xd75b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd75b('0xf')]);router[_0xd75b('0x10')](_0xd75b('0xb'),auth[_0xd75b('0x9')](),controller['destroy']);module[_0xd75b('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 2ca8d2a..6601798 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 _0x97fe=['sequelize','exports','STRING','INTEGER'];(function(_0x2e6d91,_0x495bf3){var _0x157408=function(_0x53e7af){while(--_0x53e7af){_0x2e6d91['push'](_0x2e6d91['shift']());}};_0x157408(++_0x495bf3);}(_0x97fe,0x1cc));var _0xe97f=function(_0x5d1ee3,_0x179757){_0x5d1ee3=_0x5d1ee3-0x0;var _0x47d661=_0x97fe[_0x5d1ee3];return _0x47d661;};'use strict';var Sequelize=require(_0xe97f('0x0'));module[_0xe97f('0x1')]={'name':{'type':Sequelize[_0xe97f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe97f('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6b49=['exports','STRING','INTEGER','sequelize'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x6b49,0xa7));var _0x96b4=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x6b49[_0x237da8];return _0x558825;};'use strict';var Sequelize=require(_0x96b4('0x0'));module[_0x96b4('0x1')]={'name':{'type':Sequelize[_0x96b4('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x96b4('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x96b4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 6bfa5d8..e6e7aef 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 _0x5c3c=['findAll','rows','params','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','UserProfileResource','includeAll','include'];(function(_0x3482a8,_0x1472e7){var _0x5c0db6=function(_0x1f05c5){while(--_0x1f05c5){_0x3482a8['push'](_0x3482a8['shift']());}};_0x5c0db6(++_0x1472e7);}(_0x5c3c,0x132));var _0xc5c3=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x5c3c[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){_0x52d638[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x19')]();});}};}function handleEntityNotFound(_0x38a3df,_0x52e54a){return function(_0x4af067){if(!_0x4af067){_0x38a3df[_0xc5c3('0x24')](0x194);}return _0x4af067;};}function handleError(_0x22f607,_0x20c506){_0x20c506=_0x20c506||0x1f4;return function(_0x29791c){logger['error'](_0x29791c[_0xc5c3('0x25')]);if(_0x29791c['name']){delete _0x29791c[_0xc5c3('0x26')];}_0x22f607['status'](_0x20c506)[_0xc5c3('0x27')](_0x29791c);};}exports[_0xc5c3('0x28')]=function(_0x4269eb,_0x4773c5){var _0x15361c={},_0x2d07e1={},_0x35a397={'count':0x0,'rows':[]};var _0x4b5a0c=_[_0xc5c3('0x29')](db['UserProfileResource'][_0xc5c3('0x2a')],function(_0x43ebfc){return{'name':_0x43ebfc['fieldName'],'type':_0x43ebfc['type'][_0xc5c3('0x2b')]};});_0x2d07e1[_0xc5c3('0x2c')]=_[_0xc5c3('0x29')](_0x4b5a0c,_0xc5c3('0x26'));_0x2d07e1['query']=_[_0xc5c3('0x2d')](_0x4269eb[_0xc5c3('0x2e')]);_0x2d07e1[_0xc5c3('0x2f')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],_0x2d07e1[_0xc5c3('0x2e')]);_0x15361c[_0xc5c3('0x31')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],qs['fields'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x32')]));_0x15361c[_0xc5c3('0x31')]=_0x15361c[_0xc5c3('0x31')][_0xc5c3('0x33')]?_0x15361c[_0xc5c3('0x31')]:_0x2d07e1[_0xc5c3('0x2c')];if(!_0x4269eb['query']['hasOwnProperty'](_0xc5c3('0x34'))){_0x15361c['limit']=qs[_0xc5c3('0x1a')](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);_0x15361c[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0x4269eb['query'][_0xc5c3('0x1c')]);}_0x15361c[_0xc5c3('0x35')]=qs['sort'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x36')]);_0x15361c[_0xc5c3('0x37')]=qs[_0xc5c3('0x2f')](_[_0xc5c3('0x38')](_0x4269eb[_0xc5c3('0x2e')],_0x2d07e1[_0xc5c3('0x2f')]),_0x4b5a0c);if(_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x39')]){_0x15361c[_0xc5c3('0x37')]=_['merge'](_0x15361c[_0xc5c3('0x37')],{'$or':_['map'](_0x4b5a0c,function(_0x4fdbe6){if(_0x4fdbe6[_0xc5c3('0x3a')]!==_0xc5c3('0x3b')){var _0x1b546e={};_0x1b546e[_0x4fdbe6[_0xc5c3('0x26')]]={'$like':'%'+_0x4269eb[_0xc5c3('0x2e')]['filter']+'%'};return _0x1b546e;}})});}_0x15361c=_['merge']({},_0x15361c,_0x4269eb[_0xc5c3('0x3c')]);var _0xa7cb91={'where':_0x15361c['where']};return db[_0xc5c3('0x3d')]['count'](_0xa7cb91)[_0xc5c3('0x23')](function(_0x2dfd19){_0x35a397[_0xc5c3('0x1b')]=_0x2dfd19;if(_0x4269eb['query'][_0xc5c3('0x3e')]){_0x15361c[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['UserProfileResource'][_0xc5c3('0x40')](_0x15361c);})['then'](function(_0x33936c){_0x35a397[_0xc5c3('0x41')]=_0x33936c;return _0x35a397;})['then'](respondWithFilteredResult(_0x4773c5,_0x15361c))['catch'](handleError(_0x4773c5,null));};exports['show']=function(_0xfb64bb,_0x2f02ab){var _0x49b1fc={'raw':![],'where':{'id':_0xfb64bb[_0xc5c3('0x42')]['id']}},_0x1a8490={};_0x1a8490[_0xc5c3('0x2c')]=_[_0xc5c3('0x2d')](db['UserProfileResource'][_0xc5c3('0x2a')]);_0x1a8490['query']=_['keys'](_0xfb64bb[_0xc5c3('0x2e')]);_0x1a8490[_0xc5c3('0x2f')]=_['intersection'](_0x1a8490[_0xc5c3('0x2c')],_0x1a8490[_0xc5c3('0x2e')]);_0x49b1fc['attributes']=_[_0xc5c3('0x30')](_0x1a8490['model'],qs[_0xc5c3('0x32')](_0xfb64bb[_0xc5c3('0x2e')]['fields']));_0x49b1fc[_0xc5c3('0x31')]=_0x49b1fc['attributes'][_0xc5c3('0x33')]?_0x49b1fc[_0xc5c3('0x31')]:_0x1a8490['model'];if(_0xfb64bb[_0xc5c3('0x2e')][_0xc5c3('0x3e')]){_0x49b1fc[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x49b1fc=_[_0xc5c3('0x43')]({},_0x49b1fc,_0xfb64bb[_0xc5c3('0x3c')]);return db[_0xc5c3('0x3d')]['find'](_0x49b1fc)[_0xc5c3('0x23')](handleEntityNotFound(_0x2f02ab,null))[_0xc5c3('0x23')](respondWithResult(_0x2f02ab,null))[_0xc5c3('0x44')](handleError(_0x2f02ab,null));};exports[_0xc5c3('0x45')]=function(_0x23002b,_0x4a7330){return db['UserProfileResource'][_0xc5c3('0x45')](_0x23002b[_0xc5c3('0x46')],{})[_0xc5c3('0x23')](respondWithResult(_0x4a7330,0xc9))['catch'](handleError(_0x4a7330,null));};exports[_0xc5c3('0x22')]=function(_0x65f720,_0x3a901f){if(_0x65f720[_0xc5c3('0x46')]['id']){delete _0x65f720[_0xc5c3('0x46')]['id'];}return db[_0xc5c3('0x3d')][_0xc5c3('0x47')]({'where':{'id':_0x65f720['params']['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x3a901f,null))[_0xc5c3('0x23')](saveUpdates(_0x65f720[_0xc5c3('0x46')],null))['then'](respondWithResult(_0x3a901f,null))[_0xc5c3('0x44')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x48')]=function(_0x3b1bc2,_0x103bde){return db[_0xc5c3('0x3d')]['find']({'where':{'id':_0x3b1bc2[_0xc5c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x103bde,null))[_0xc5c3('0x23')](removeEntity(_0x103bde,null))['catch'](handleError(_0x103bde,null));};exports[_0xc5c3('0x49')]=function(_0x34a2c3,_0x4add6b){return db[_0xc5c3('0x3d')][_0xc5c3('0x49')]()['then'](respondWithResult(_0x4add6b,null))[_0xc5c3('0x44')](handleError(_0x4add6b,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','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','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x6343,0x168));var _0x3634=function(_0x1614ff,_0x246974){_0x1614ff=_0x1614ff-0x0;var _0x207355=_0x6343[_0x1614ff];return _0x207355;};'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(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3e4a770..fed2195 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 _0x504f=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','api'];(function(_0x1e5cc0,_0x5260ec){var _0x3b6f1b=function(_0x1da192){while(--_0x1da192){_0x1e5cc0['push'](_0x1e5cc0['shift']());}};_0x3b6f1b(++_0x5260ec);}(_0x504f,0x115));var _0xf504=function(_0x2731a4,_0x51c5db){_0x2731a4=_0x2731a4-0x0;var _0x5be8e9=_0x504f[_0x2731a4];return _0x5be8e9;};'use strict';var _=require(_0xf504('0x0'));var util=require(_0xf504('0x1'));var logger=require('../../config/logger')(_0xf504('0x2'));var moment=require('moment');var BPromise=require(_0xf504('0x3'));var rp=require(_0xf504('0x4'));var fs=require('fs');var path=require(_0xf504('0x5'));var rimraf=require(_0xf504('0x6'));var config=require(_0xf504('0x7'));var attributes=require(_0xf504('0x8'));module[_0xf504('0x9')]=function(_0x5bf27a,_0x5e3942){return _0x5bf27a['define'](_0xf504('0xa'),attributes,{'tableName':_0xf504('0xb'),'paranoid':![],'indexes':[{'name':_0xf504('0xc'),'fields':['resourceId',_0xf504('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cd9=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cd9,0x134));var _0x95cd=function(_0x24a389,_0x1278d4){_0x24a389=_0x24a389-0x0;var _0x14c91f=_0x5cd9[_0x24a389];return _0x14c91f;};'use strict';var _=require(_0x95cd('0x0'));var util=require(_0x95cd('0x1'));var logger=require(_0x95cd('0x2'))(_0x95cd('0x3'));var moment=require(_0x95cd('0x4'));var BPromise=require('bluebird');var rp=require(_0x95cd('0x5'));var fs=require('fs');var path=require(_0x95cd('0x6'));var rimraf=require('rimraf');var config=require(_0x95cd('0x7'));var attributes=require(_0x95cd('0x8'));module[_0x95cd('0x9')]=function(_0x52611f,_0x73546d){return _0x52611f['define'](_0x95cd('0xa'),attributes,{'tableName':_0x95cd('0xb'),'paranoid':![],'indexes':[{'name':_0x95cd('0xc'),'fields':['resourceId',_0x95cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 15429ba..f3fc9e3 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 _0x0f31=['result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4c6ff1,_0x39ada3){var _0x4f1df0=function(_0x59cc08){while(--_0x59cc08){_0x4c6ff1['push'](_0x4c6ff1['shift']());}};_0x4f1df0(++_0x39ada3);}(_0x0f31,0x1e2));var _0x10f3=function(_0x42dc8b,_0x24f41a){_0x42dc8b=_0x42dc8b-0x0;var _0x42764b=_0x0f31[_0x42dc8b];return _0x42764b;};'use strict';var _=require(_0x10f3('0x0'));var util=require(_0x10f3('0x1'));var moment=require('moment');var BPromise=require(_0x10f3('0x2'));var rs=require(_0x10f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x10f3('0x4'));var logger=require(_0x10f3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x10f3('0x6')][_0x10f3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x122faf,_0x14c9f7,_0x492e29){return new BPromise(function(_0x208cc7,_0x3460c9){return client['request'](_0x122faf,_0x492e29)[_0x10f3('0x8')](function(_0xbc2c61){logger[_0x10f3('0x9')](_0x10f3('0xa'),_0x14c9f7,_0x10f3('0xb'));logger[_0x10f3('0xc')](_0x10f3('0xd'),_0x14c9f7,_0x10f3('0xb'),JSON[_0x10f3('0xe')](_0xbc2c61));if(_0xbc2c61['error']){if(_0xbc2c61[_0x10f3('0xf')][_0x10f3('0x10')]===0x1f4){logger[_0x10f3('0xf')](_0x10f3('0xa'),_0x14c9f7,_0xbc2c61['error']['message']);return _0x3460c9(_0xbc2c61[_0x10f3('0xf')][_0x10f3('0x11')]);}logger[_0x10f3('0xf')](_0x10f3('0xa'),_0x14c9f7,_0xbc2c61['error']['message']);return _0x208cc7(_0xbc2c61[_0x10f3('0xf')][_0x10f3('0x11')]);}else{logger[_0x10f3('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x14c9f7,_0x10f3('0xb'));_0x208cc7(_0xbc2c61[_0x10f3('0x12')][_0x10f3('0x11')]);}})[_0x10f3('0x13')](function(_0x25ad09){logger[_0x10f3('0xf')](_0x10f3('0xa'),_0x14c9f7,_0x25ad09);_0x3460c9(_0x25ad09);});});} \ No newline at end of file +var _0xba30=['stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0xba30,0x156));var _0x0ba3=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xba30[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x0ba3('0x0'));var util=require(_0x0ba3('0x1'));var moment=require(_0x0ba3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ba3('0x3'));var db=require(_0x0ba3('0x4'))['db'];var utils=require(_0x0ba3('0x5'));var logger=require(_0x0ba3('0x6'))('rpc');var config=require(_0x0ba3('0x7'));var jayson=require(_0x0ba3('0x8'));var client=jayson[_0x0ba3('0x9')][_0x0ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359ae7,_0x283c86,_0x3429e4){return new BPromise(function(_0x3f3958,_0x4fec6d){return client['request'](_0x359ae7,_0x3429e4)['then'](function(_0x5855e0){logger[_0x0ba3('0xb')](_0x0ba3('0xc'),_0x283c86,_0x0ba3('0xd'));logger['debug'](_0x0ba3('0xe'),_0x283c86,'request\x20sent',JSON[_0x0ba3('0xf')](_0x5855e0));if(_0x5855e0['error']){if(_0x5855e0[_0x0ba3('0x10')][_0x0ba3('0x11')]===0x1f4){logger[_0x0ba3('0x10')](_0x0ba3('0xc'),_0x283c86,_0x5855e0[_0x0ba3('0x10')]['message']);return _0x4fec6d(_0x5855e0[_0x0ba3('0x10')]['message']);}logger[_0x0ba3('0x10')](_0x0ba3('0xc'),_0x283c86,_0x5855e0[_0x0ba3('0x10')]['message']);return _0x3f3958(_0x5855e0[_0x0ba3('0x10')][_0x0ba3('0x12')]);}else{logger[_0x0ba3('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x283c86,_0x0ba3('0xd'));_0x3f3958(_0x5855e0[_0x0ba3('0x13')][_0x0ba3('0x12')]);}})[_0x0ba3('0x14')](function(_0x32847a){logger[_0x0ba3('0x10')](_0x0ba3('0xc'),_0x283c86,_0x32847a);_0x4fec6d(_0x32847a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 5e702b2..dfec31a 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 _0xa693=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','/:id','show','post','create'];(function(_0x37dfc3,_0x44f556){var _0x45281d=function(_0x12d603){while(--_0x12d603){_0x37dfc3['push'](_0x37dfc3['shift']());}};_0x45281d(++_0x44f556);}(_0xa693,0x1e4));var _0x3a69=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0xa693[_0x3a3b9e];return _0x148103;};'use strict';var multer=require(_0x3a69('0x0'));var util=require(_0x3a69('0x1'));var path=require(_0x3a69('0x2'));var timeout=require(_0x3a69('0x3'));var express=require(_0x3a69('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3a69('0x5'));var interaction=require(_0x3a69('0x6'));var config=require('../../config/environment');var controller=require(_0x3a69('0x7'));router['get']('/',auth[_0x3a69('0x8')](),controller[_0x3a69('0x9')]);router[_0x3a69('0xa')](_0x3a69('0xb'),auth[_0x3a69('0x8')](),controller['describe']);router[_0x3a69('0xa')](_0x3a69('0xc'),auth[_0x3a69('0x8')](),controller[_0x3a69('0xd')]);router[_0x3a69('0xe')]('/',auth[_0x3a69('0x8')](),controller[_0x3a69('0xf')]);router[_0x3a69('0x10')](_0x3a69('0xc'),auth[_0x3a69('0x8')](),controller['update']);router[_0x3a69('0x11')](_0x3a69('0xc'),auth[_0x3a69('0x8')](),controller[_0x3a69('0x12')]);module[_0x3a69('0x13')]=router; \ No newline at end of file +var _0x0c98=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','create','put'];(function(_0x600042,_0x18165b){var _0x4e71f0=function(_0x4ad8cd){while(--_0x4ad8cd){_0x600042['push'](_0x600042['shift']());}};_0x4e71f0(++_0x18165b);}(_0x0c98,0x13e));var _0x80c9=function(_0x51dc99,_0x11ab67){_0x51dc99=_0x51dc99-0x0;var _0x3994a9=_0x0c98[_0x51dc99];return _0x3994a9;};'use strict';var multer=require('multer');var util=require(_0x80c9('0x0'));var path=require(_0x80c9('0x1'));var timeout=require(_0x80c9('0x2'));var express=require(_0x80c9('0x3'));var router=express[_0x80c9('0x4')]();var fs_extra=require(_0x80c9('0x5'));var auth=require(_0x80c9('0x6'));var interaction=require(_0x80c9('0x7'));var config=require(_0x80c9('0x8'));var controller=require(_0x80c9('0x9'));router[_0x80c9('0xa')]('/',auth[_0x80c9('0xb')](),controller[_0x80c9('0xc')]);router[_0x80c9('0xa')](_0x80c9('0xd'),auth[_0x80c9('0xb')](),controller['describe']);router[_0x80c9('0xa')](_0x80c9('0xe'),auth[_0x80c9('0xb')](),controller[_0x80c9('0xf')]);router['post']('/',auth[_0x80c9('0xb')](),controller[_0x80c9('0x10')]);router[_0x80c9('0x11')](_0x80c9('0xe'),auth[_0x80c9('0xb')](),controller[_0x80c9('0x12')]);router[_0x80c9('0x13')](_0x80c9('0xe'),auth[_0x80c9('0xb')](),controller['destroy']);module[_0x80c9('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e1e9752..a8ea7fe 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 _0x065e=['crudPermissions','getDataValue','split','sequelize','INTEGER','BOOLEAN','setDataValue'];(function(_0x5d3b34,_0x253f4a){var _0x1184aa=function(_0x2a2dcf){while(--_0x2a2dcf){_0x5d3b34['push'](_0x5d3b34['shift']());}};_0x1184aa(++_0x253f4a);}(_0x065e,0x1a7));var _0xe065=function(_0x22fadf,_0x5dc146){_0x22fadf=_0x22fadf-0x0;var _0x114c05=_0x065e[_0x22fadf];return _0x114c05;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xe065('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe065('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4964fa){this[_0xe065('0x3')](_0xe065('0x4'),_0x4964fa?_0x4964fa['join'](''):[]);},'get':function(){return this[_0xe065('0x5')](_0xe065('0x4'))?this[_0xe065('0x5')]('crudPermissions')[_0xe065('0x6')](''):[];}}}; \ No newline at end of file +var _0xda3f=['join','getDataValue','crudPermissions','split','exports','STRING','BOOLEAN','setDataValue'];(function(_0x4d8f8b,_0x37b963){var _0x4b9ecf=function(_0x329b2a){while(--_0x329b2a){_0x4d8f8b['push'](_0x4d8f8b['shift']());}};_0x4b9ecf(++_0x37b963);}(_0xda3f,0xec));var _0xfda3=function(_0x55b022,_0x4b0ff6){_0x55b022=_0x55b022-0x0;var _0x246d64=_0xda3f[_0x55b022];return _0x246d64;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xfda3('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x36dc71){this[_0xfda3('0x3')]('crudPermissions',_0x36dc71?_0x36dc71[_0xfda3('0x4')](''):[]);},'get':function(){return this[_0xfda3('0x5')]('crudPermissions')?this['getDataValue'](_0xfda3('0x6'))[_0xfda3('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 58f47a9..0bf630a 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 _0x7a0a=['offset','limit','reject','save','update','then','destroy','end','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','options','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count'];(function(_0x539849,_0x4030df){var _0x5f6894=function(_0x280d32){while(--_0x280d32){_0x539849['push'](_0x539849['shift']());}};_0x5f6894(++_0x4030df);}(_0x7a0a,0x13b));var _0xa7a0=function(_0x214ec5,_0x19c62b){_0x214ec5=_0x214ec5-0x0;var _0x1b794c=_0x7a0a[_0x214ec5];return _0x1b794c;};'use strict';var emlformat=require(_0xa7a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa7a0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7a0('0x2'));var moment=require(_0xa7a0('0x3'));var BPromise=require(_0xa7a0('0x4'));var Mustache=require('mustache');var util=require(_0xa7a0('0x5'));var path=require('path');var sox=require(_0xa7a0('0x6'));var csv=require(_0xa7a0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7a0('0x8'));var _=require('lodash');var squel=require(_0xa7a0('0x9'));var crypto=require('crypto');var jsforce=require(_0xa7a0('0xa'));var deskjs=require(_0xa7a0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa7a0('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa7a0('0xd'));var qs=require(_0xa7a0('0xe'));var as=require(_0xa7a0('0xf'));var hardwareService=require(_0xa7a0('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xa7a0('0x11'));var config=require(_0xa7a0('0x12'));var licenseUtil=require(_0xa7a0('0x13'));var db=require(_0xa7a0('0x14'))['db'];function respondWithStatusCode(_0x29ff9e,_0x677e87){_0x677e87=_0x677e87||0xcc;return function(_0x171d1f){if(_0x171d1f){return _0x29ff9e[_0xa7a0('0x15')](_0x677e87);}return _0x29ff9e['status'](_0x677e87)['end']();};}function respondWithResult(_0x552495,_0x37e0cd){_0x37e0cd=_0x37e0cd||0xc8;return function(_0x5b0182){if(_0x5b0182){return _0x552495[_0xa7a0('0x16')](_0x37e0cd)['json'](_0x5b0182);}};}function respondWithFilteredResult(_0x359d49,_0x159797){return function(_0x42e506){if(_0x42e506){var _0x214b4d=typeof _0x159797['offset']===_0xa7a0('0x17')&&typeof _0x159797['limit']===_0xa7a0('0x17');var _0x14d426=_0x42e506[_0xa7a0('0x18')];var _0x201118=_0x214b4d?0x0:_0x159797[_0xa7a0('0x19')];var _0xfb9f4e=_0x214b4d?_0x42e506[_0xa7a0('0x18')]:_0x159797[_0xa7a0('0x19')]+_0x159797[_0xa7a0('0x1a')];var _0x1aa3d6;if(_0xfb9f4e>=_0x14d426){_0xfb9f4e=_0x14d426;_0x1aa3d6=0xc8;}else{_0x1aa3d6=0xce;}_0x359d49[_0xa7a0('0x16')](_0x1aa3d6);return _0x359d49['set']('Content-Range',_0x201118+'-'+_0xfb9f4e+'/'+_0x14d426)['json'](_0x42e506);}return null;};}function patchUpdates(_0x518b4d){return function(_0x2f0ecd){try{jsonpatch['apply'](_0x2f0ecd,_0x518b4d,!![]);}catch(_0x84cd11){return BPromise[_0xa7a0('0x1b')](_0x84cd11);}return _0x2f0ecd[_0xa7a0('0x1c')]();};}function saveUpdates(_0x241c86,_0x202202){return function(_0x4efa1b){if(_0x4efa1b){return _0x4efa1b[_0xa7a0('0x1d')](_0x241c86)[_0xa7a0('0x1e')](function(_0x292a31){return _0x292a31;});}return null;};}function removeEntity(_0x3f5450,_0x5566ae){return function(_0x4319e4){if(_0x4319e4){return _0x4319e4[_0xa7a0('0x1f')]()[_0xa7a0('0x1e')](function(){_0x3f5450[_0xa7a0('0x16')](0xcc)[_0xa7a0('0x20')]();});}};}function handleEntityNotFound(_0x1f2670,_0x20c23c){return function(_0x197fb2){if(!_0x197fb2){_0x1f2670[_0xa7a0('0x15')](0x194);}return _0x197fb2;};}function handleError(_0x37f17e,_0x254a06){_0x254a06=_0x254a06||0x1f4;return function(_0x1db36f){logger['error'](_0x1db36f[_0xa7a0('0x21')]);if(_0x1db36f[_0xa7a0('0x22')]){delete _0x1db36f[_0xa7a0('0x22')];}_0x37f17e['status'](_0x254a06)[_0xa7a0('0x23')](_0x1db36f);};}exports[_0xa7a0('0x24')]=function(_0x4250f8,_0x59502c){var _0x222d04={},_0x1e7781={},_0x253abe={'count':0x0,'rows':[]};var _0x246eec=_['map'](db[_0xa7a0('0x25')][_0xa7a0('0x26')],function(_0x4d563b){return{'name':_0x4d563b[_0xa7a0('0x27')],'type':_0x4d563b[_0xa7a0('0x28')][_0xa7a0('0x29')]};});_0x1e7781['model']=_['map'](_0x246eec,_0xa7a0('0x22'));_0x1e7781[_0xa7a0('0x2a')]=_[_0xa7a0('0x2b')](_0x4250f8['query']);_0x1e7781['filters']=_[_0xa7a0('0x2c')](_0x1e7781[_0xa7a0('0x2d')],_0x1e7781[_0xa7a0('0x2a')]);_0x222d04[_0xa7a0('0x2e')]=_[_0xa7a0('0x2c')](_0x1e7781[_0xa7a0('0x2d')],qs[_0xa7a0('0x2f')](_0x4250f8['query'][_0xa7a0('0x2f')]));_0x222d04[_0xa7a0('0x2e')]=_0x222d04[_0xa7a0('0x2e')][_0xa7a0('0x30')]?_0x222d04[_0xa7a0('0x2e')]:_0x1e7781[_0xa7a0('0x2d')];if(!_0x4250f8[_0xa7a0('0x2a')]['hasOwnProperty'](_0xa7a0('0x31'))){_0x222d04['limit']=qs['limit'](_0x4250f8[_0xa7a0('0x2a')][_0xa7a0('0x1a')]);_0x222d04[_0xa7a0('0x19')]=qs['offset'](_0x4250f8[_0xa7a0('0x2a')][_0xa7a0('0x19')]);}_0x222d04[_0xa7a0('0x32')]=qs[_0xa7a0('0x33')](_0x4250f8[_0xa7a0('0x2a')]['sort']);_0x222d04[_0xa7a0('0x34')]=qs['filters'](_[_0xa7a0('0x35')](_0x4250f8[_0xa7a0('0x2a')],_0x1e7781[_0xa7a0('0x36')]),_0x246eec);if(_0x4250f8[_0xa7a0('0x2a')][_0xa7a0('0x37')]){_0x222d04[_0xa7a0('0x34')]=_[_0xa7a0('0x38')](_0x222d04['where'],{'$or':_['map'](_0x246eec,function(_0x52890c){if(_0x52890c[_0xa7a0('0x28')]!==_0xa7a0('0x39')){var _0x126000={};_0x126000[_0x52890c[_0xa7a0('0x22')]]={'$like':'%'+_0x4250f8['query'][_0xa7a0('0x37')]+'%'};return _0x126000;}})});}_0x222d04=_['merge']({},_0x222d04,_0x4250f8['options']);var _0x53974c={'where':_0x222d04[_0xa7a0('0x34')]};return db[_0xa7a0('0x25')][_0xa7a0('0x18')](_0x53974c)['then'](function(_0x524291){_0x253abe[_0xa7a0('0x18')]=_0x524291;if(_0x4250f8['query'][_0xa7a0('0x3a')]){_0x222d04['include']=[{'all':!![]}];}return db[_0xa7a0('0x25')][_0xa7a0('0x3b')](_0x222d04);})[_0xa7a0('0x1e')](function(_0x46c5fd){_0x253abe['rows']=_0x46c5fd;return _0x253abe;})[_0xa7a0('0x1e')](respondWithFilteredResult(_0x59502c,_0x222d04))[_0xa7a0('0x3c')](handleError(_0x59502c,null));};exports[_0xa7a0('0x3d')]=function(_0x254d53,_0x464f18){var _0x2feedb={'raw':![],'where':{'id':_0x254d53[_0xa7a0('0x3e')]['id']}},_0x4defb5={};_0x4defb5['model']=_[_0xa7a0('0x2b')](db[_0xa7a0('0x25')][_0xa7a0('0x26')]);_0x4defb5[_0xa7a0('0x2a')]=_[_0xa7a0('0x2b')](_0x254d53['query']);_0x4defb5[_0xa7a0('0x36')]=_[_0xa7a0('0x2c')](_0x4defb5[_0xa7a0('0x2d')],_0x4defb5[_0xa7a0('0x2a')]);_0x2feedb[_0xa7a0('0x2e')]=_[_0xa7a0('0x2c')](_0x4defb5[_0xa7a0('0x2d')],qs[_0xa7a0('0x2f')](_0x254d53[_0xa7a0('0x2a')]['fields']));_0x2feedb['attributes']=_0x2feedb[_0xa7a0('0x2e')][_0xa7a0('0x30')]?_0x2feedb[_0xa7a0('0x2e')]:_0x4defb5[_0xa7a0('0x2d')];if(_0x254d53[_0xa7a0('0x2a')][_0xa7a0('0x3a')]){_0x2feedb['include']=[{'all':!![]}];}_0x2feedb=_[_0xa7a0('0x38')]({},_0x2feedb,_0x254d53[_0xa7a0('0x3f')]);return db['UserProfileSection'][_0xa7a0('0x40')](_0x2feedb)[_0xa7a0('0x1e')](handleEntityNotFound(_0x464f18,null))[_0xa7a0('0x1e')](respondWithResult(_0x464f18,null))[_0xa7a0('0x3c')](handleError(_0x464f18,null));};exports[_0xa7a0('0x41')]=function(_0x3ba0bd,_0x100806){return db[_0xa7a0('0x25')][_0xa7a0('0x41')](_0x3ba0bd[_0xa7a0('0x42')],{})[_0xa7a0('0x1e')](respondWithResult(_0x100806,0xc9))[_0xa7a0('0x3c')](handleError(_0x100806,null));};exports[_0xa7a0('0x1d')]=function(_0x3f4d0b,_0x2100ac){if(_0x3f4d0b[_0xa7a0('0x42')]['id']){delete _0x3f4d0b[_0xa7a0('0x42')]['id'];}return db[_0xa7a0('0x25')]['find']({'where':{'id':_0x3f4d0b[_0xa7a0('0x3e')]['id']}})[_0xa7a0('0x1e')](handleEntityNotFound(_0x2100ac,null))[_0xa7a0('0x1e')](saveUpdates(_0x3f4d0b['body'],null))['then'](respondWithResult(_0x2100ac,null))['catch'](handleError(_0x2100ac,null));};exports[_0xa7a0('0x1f')]=function(_0x3d73d2,_0x1c3f16){return db[_0xa7a0('0x25')][_0xa7a0('0x40')]({'where':{'id':_0x3d73d2[_0xa7a0('0x3e')]['id']}})[_0xa7a0('0x1e')](handleEntityNotFound(_0x1c3f16,null))[_0xa7a0('0x1e')](removeEntity(_0x1c3f16,null))[_0xa7a0('0x3c')](handleError(_0x1c3f16,null));};exports[_0xa7a0('0x43')]=function(_0x51cec7,_0x1a126b){return db[_0xa7a0('0x25')][_0xa7a0('0x43')]()[_0xa7a0('0x1e')](respondWithResult(_0x1a126b,null))[_0xa7a0('0x3c')](handleError(_0x1a126b,null));}; \ No newline at end of file +var _0x2a7d=['map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','options','includeAll','catch','show','params','keys','length','merge','create','body','update','find','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a7d,0xf9));var _0xd2a7=function(_0x9ab209,_0x1deafe){_0x9ab209=_0x9ab209-0x0;var _0x38a53f=_0x2a7d[_0x9ab209];return _0x38a53f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2a7('0x0'));var zipdir=require(_0xd2a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2a7('0x2'));var moment=require('moment');var BPromise=require(_0xd2a7('0x3'));var Mustache=require('mustache');var util=require(_0xd2a7('0x4'));var path=require(_0xd2a7('0x5'));var sox=require(_0xd2a7('0x6'));var csv=require('to-csv');var ejs=require(_0xd2a7('0x7'));var fs=require('fs');var fs_extra=require(_0xd2a7('0x8'));var _=require(_0xd2a7('0x9'));var squel=require(_0xd2a7('0xa'));var crypto=require(_0xd2a7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd2a7('0xc'));var querystring=require(_0xd2a7('0xd'));var Papa=require('papaparse');var Redis=require(_0xd2a7('0xe'));var authService=require(_0xd2a7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd2a7('0x10'));var hardwareService=require(_0xd2a7('0x11'));var logger=require(_0xd2a7('0x12'))(_0xd2a7('0x13'));var utils=require(_0xd2a7('0x14'));var config=require(_0xd2a7('0x15'));var licenseUtil=require(_0xd2a7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41e7dc,_0x444d9a){_0x444d9a=_0x444d9a||0xcc;return function(_0xc58228){if(_0xc58228){return _0x41e7dc[_0xd2a7('0x17')](_0x444d9a);}return _0x41e7dc[_0xd2a7('0x18')](_0x444d9a)[_0xd2a7('0x19')]();};}function respondWithResult(_0x1c55c4,_0x20505f){_0x20505f=_0x20505f||0xc8;return function(_0x31fcfc){if(_0x31fcfc){return _0x1c55c4[_0xd2a7('0x18')](_0x20505f)[_0xd2a7('0x1a')](_0x31fcfc);}};}function respondWithFilteredResult(_0x50fddb,_0x26f9ca){return function(_0x2c1ab9){if(_0x2c1ab9){var _0x4c5b1c=typeof _0x26f9ca[_0xd2a7('0x1b')]===_0xd2a7('0x1c')&&typeof _0x26f9ca[_0xd2a7('0x1d')]===_0xd2a7('0x1c');var _0x166dae=_0x2c1ab9[_0xd2a7('0x1e')];var _0x556912=_0x4c5b1c?0x0:_0x26f9ca[_0xd2a7('0x1b')];var _0x22f586=_0x4c5b1c?_0x2c1ab9[_0xd2a7('0x1e')]:_0x26f9ca[_0xd2a7('0x1b')]+_0x26f9ca['limit'];var _0x11efe0;if(_0x22f586>=_0x166dae){_0x22f586=_0x166dae;_0x11efe0=0xc8;}else{_0x11efe0=0xce;}_0x50fddb[_0xd2a7('0x18')](_0x11efe0);return _0x50fddb[_0xd2a7('0x1f')](_0xd2a7('0x20'),_0x556912+'-'+_0x22f586+'/'+_0x166dae)[_0xd2a7('0x1a')](_0x2c1ab9);}return null;};}function patchUpdates(_0x46afc1){return function(_0x167a52){try{jsonpatch[_0xd2a7('0x21')](_0x167a52,_0x46afc1,!![]);}catch(_0x41a6a6){return BPromise[_0xd2a7('0x22')](_0x41a6a6);}return _0x167a52[_0xd2a7('0x23')]();};}function saveUpdates(_0x459ec3,_0x4a3735){return function(_0x48f48f){if(_0x48f48f){return _0x48f48f['update'](_0x459ec3)[_0xd2a7('0x24')](function(_0x3738b4){return _0x3738b4;});}return null;};}function removeEntity(_0x1e5ea2,_0x121a24){return function(_0x9ee604){if(_0x9ee604){return _0x9ee604[_0xd2a7('0x25')]()[_0xd2a7('0x24')](function(){_0x1e5ea2[_0xd2a7('0x18')](0xcc)[_0xd2a7('0x19')]();});}};}function handleEntityNotFound(_0x474a89,_0x9fb8df){return function(_0x16f131){if(!_0x16f131){_0x474a89['sendStatus'](0x194);}return _0x16f131;};}function handleError(_0x307d38,_0x25afd7){_0x25afd7=_0x25afd7||0x1f4;return function(_0x3323f2){logger[_0xd2a7('0x26')](_0x3323f2[_0xd2a7('0x27')]);if(_0x3323f2[_0xd2a7('0x28')]){delete _0x3323f2[_0xd2a7('0x28')];}_0x307d38['status'](_0x25afd7)[_0xd2a7('0x29')](_0x3323f2);};}exports[_0xd2a7('0x2a')]=function(_0x24f96a,_0x535384){var _0x4c907d={},_0x4676fe={},_0xfa02da={'count':0x0,'rows':[]};var _0x398a86=_[_0xd2a7('0x2b')](db[_0xd2a7('0x2c')][_0xd2a7('0x2d')],function(_0x477d03){return{'name':_0x477d03[_0xd2a7('0x2e')],'type':_0x477d03[_0xd2a7('0x2f')][_0xd2a7('0x30')]};});_0x4676fe[_0xd2a7('0x31')]=_[_0xd2a7('0x2b')](_0x398a86,_0xd2a7('0x28'));_0x4676fe[_0xd2a7('0x32')]=_['keys'](_0x24f96a[_0xd2a7('0x32')]);_0x4676fe[_0xd2a7('0x33')]=_[_0xd2a7('0x34')](_0x4676fe[_0xd2a7('0x31')],_0x4676fe[_0xd2a7('0x32')]);_0x4c907d[_0xd2a7('0x35')]=_['intersection'](_0x4676fe[_0xd2a7('0x31')],qs[_0xd2a7('0x36')](_0x24f96a[_0xd2a7('0x32')][_0xd2a7('0x36')]));_0x4c907d['attributes']=_0x4c907d[_0xd2a7('0x35')]['length']?_0x4c907d[_0xd2a7('0x35')]:_0x4676fe[_0xd2a7('0x31')];if(!_0x24f96a['query']['hasOwnProperty']('nolimit')){_0x4c907d[_0xd2a7('0x1d')]=qs[_0xd2a7('0x1d')](_0x24f96a[_0xd2a7('0x32')][_0xd2a7('0x1d')]);_0x4c907d[_0xd2a7('0x1b')]=qs[_0xd2a7('0x1b')](_0x24f96a['query'][_0xd2a7('0x1b')]);}_0x4c907d[_0xd2a7('0x37')]=qs['sort'](_0x24f96a['query'][_0xd2a7('0x38')]);_0x4c907d[_0xd2a7('0x39')]=qs[_0xd2a7('0x33')](_[_0xd2a7('0x3a')](_0x24f96a[_0xd2a7('0x32')],_0x4676fe[_0xd2a7('0x33')]),_0x398a86);if(_0x24f96a[_0xd2a7('0x32')][_0xd2a7('0x3b')]){_0x4c907d[_0xd2a7('0x39')]=_['merge'](_0x4c907d[_0xd2a7('0x39')],{'$or':_[_0xd2a7('0x2b')](_0x398a86,function(_0x29f121){if(_0x29f121[_0xd2a7('0x2f')]!=='VIRTUAL'){var _0x3a6ad1={};_0x3a6ad1[_0x29f121[_0xd2a7('0x28')]]={'$like':'%'+_0x24f96a[_0xd2a7('0x32')]['filter']+'%'};return _0x3a6ad1;}})});}_0x4c907d=_['merge']({},_0x4c907d,_0x24f96a[_0xd2a7('0x3c')]);var _0x1fbca={'where':_0x4c907d[_0xd2a7('0x39')]};return db[_0xd2a7('0x2c')][_0xd2a7('0x1e')](_0x1fbca)[_0xd2a7('0x24')](function(_0x325b14){_0xfa02da[_0xd2a7('0x1e')]=_0x325b14;if(_0x24f96a[_0xd2a7('0x32')][_0xd2a7('0x3d')]){_0x4c907d['include']=[{'all':!![]}];}return db[_0xd2a7('0x2c')]['findAll'](_0x4c907d);})[_0xd2a7('0x24')](function(_0x1d4274){_0xfa02da['rows']=_0x1d4274;return _0xfa02da;})['then'](respondWithFilteredResult(_0x535384,_0x4c907d))[_0xd2a7('0x3e')](handleError(_0x535384,null));};exports[_0xd2a7('0x3f')]=function(_0x6d83da,_0x581793){var _0x2349d3={'raw':![],'where':{'id':_0x6d83da[_0xd2a7('0x40')]['id']}},_0x587f0d={};_0x587f0d[_0xd2a7('0x31')]=_[_0xd2a7('0x41')](db['UserProfileSection']['rawAttributes']);_0x587f0d[_0xd2a7('0x32')]=_[_0xd2a7('0x41')](_0x6d83da[_0xd2a7('0x32')]);_0x587f0d[_0xd2a7('0x33')]=_['intersection'](_0x587f0d[_0xd2a7('0x31')],_0x587f0d[_0xd2a7('0x32')]);_0x2349d3[_0xd2a7('0x35')]=_['intersection'](_0x587f0d[_0xd2a7('0x31')],qs[_0xd2a7('0x36')](_0x6d83da['query'][_0xd2a7('0x36')]));_0x2349d3['attributes']=_0x2349d3[_0xd2a7('0x35')][_0xd2a7('0x42')]?_0x2349d3[_0xd2a7('0x35')]:_0x587f0d['model'];if(_0x6d83da[_0xd2a7('0x32')][_0xd2a7('0x3d')]){_0x2349d3['include']=[{'all':!![]}];}_0x2349d3=_[_0xd2a7('0x43')]({},_0x2349d3,_0x6d83da['options']);return db['UserProfileSection']['find'](_0x2349d3)[_0xd2a7('0x24')](handleEntityNotFound(_0x581793,null))[_0xd2a7('0x24')](respondWithResult(_0x581793,null))[_0xd2a7('0x3e')](handleError(_0x581793,null));};exports[_0xd2a7('0x44')]=function(_0x5e19ab,_0x33eeae){return db[_0xd2a7('0x2c')]['create'](_0x5e19ab[_0xd2a7('0x45')],{})['then'](respondWithResult(_0x33eeae,0xc9))[_0xd2a7('0x3e')](handleError(_0x33eeae,null));};exports[_0xd2a7('0x46')]=function(_0x10fbe5,_0x1cc591){if(_0x10fbe5[_0xd2a7('0x45')]['id']){delete _0x10fbe5[_0xd2a7('0x45')]['id'];}return db[_0xd2a7('0x2c')][_0xd2a7('0x47')]({'where':{'id':_0x10fbe5[_0xd2a7('0x40')]['id']}})['then'](handleEntityNotFound(_0x1cc591,null))[_0xd2a7('0x24')](saveUpdates(_0x10fbe5['body'],null))['then'](respondWithResult(_0x1cc591,null))['catch'](handleError(_0x1cc591,null));};exports['destroy']=function(_0x2df114,_0xae358c){return db[_0xd2a7('0x2c')][_0xd2a7('0x47')]({'where':{'id':_0x2df114[_0xd2a7('0x40')]['id']}})[_0xd2a7('0x24')](handleEntityNotFound(_0xae358c,null))['then'](removeEntity(_0xae358c,null))['catch'](handleError(_0xae358c,null));};exports['describe']=function(_0xce2666,_0x3ee72c){return db[_0xd2a7('0x2c')][_0xd2a7('0x48')]()[_0xd2a7('0x24')](respondWithResult(_0x3ee72c,null))[_0xd2a7('0x3e')](handleError(_0x3ee72c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 61d24e7..5842c2a 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 _0x29b1=['sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex'];(function(_0x237d8a,_0x494c81){var _0x34d9c4=function(_0xa93701){while(--_0xa93701){_0x237d8a['push'](_0x237d8a['shift']());}};_0x34d9c4(++_0x494c81);}(_0x29b1,0x16d));var _0x129b=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x29b1[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x129b('0x0'));var util=require(_0x129b('0x1'));var logger=require(_0x129b('0x2'))(_0x129b('0x3'));var moment=require(_0x129b('0x4'));var BPromise=require('bluebird');var rp=require(_0x129b('0x5'));var fs=require('fs');var path=require(_0x129b('0x6'));var rimraf=require(_0x129b('0x7'));var config=require(_0x129b('0x8'));var attributes=require(_0x129b('0x9'));module[_0x129b('0xa')]=function(_0x31e428,_0xe27ed4){return _0x31e428['define'](_0x129b('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x129b('0xc'),'fields':[_0x129b('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb19f=['rimraf','../../config/environment','define','UserProfileSection','sectionId','userProfileId','lodash','../../config/logger','moment','path'];(function(_0x57267d,_0x44976d){var _0x2cab22=function(_0x2dac5e){while(--_0x2dac5e){_0x57267d['push'](_0x57267d['shift']());}};_0x2cab22(++_0x44976d);}(_0xb19f,0x1f0));var _0xfb19=function(_0x40e8e7,_0x5892a0){_0x40e8e7=_0x40e8e7-0x0;var _0x3adfe4=_0xb19f[_0x40e8e7];return _0x3adfe4;};'use strict';var _=require(_0xfb19('0x0'));var util=require('util');var logger=require(_0xfb19('0x1'))('api');var moment=require(_0xfb19('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb19('0x3'));var rimraf=require(_0xfb19('0x4'));var config=require(_0xfb19('0x5'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x3ccc7b,_0x59479a){return _0x3ccc7b[_0xfb19('0x6')](_0xfb19('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xfb19('0x8'),_0xfb19('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 9dc9301..38c1cd3 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 _0x87fa=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserProfileSection,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x213b1a,_0x2d2ea9){var _0x3885d9=function(_0x831e94){while(--_0x831e94){_0x213b1a['push'](_0x213b1a['shift']());}};_0x3885d9(++_0x2d2ea9);}(_0x87fa,0xf6));var _0xa87f=function(_0x42f6cf,_0x20aae8){_0x42f6cf=_0x42f6cf-0x0;var _0x129bc2=_0x87fa[_0x42f6cf];return _0x129bc2;};'use strict';var _=require(_0xa87f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa87f('0x1'));var rs=require(_0xa87f('0x2'));var fs=require('fs');var Redis=require(_0xa87f('0x3'));var db=require(_0xa87f('0x4'))['db'];var utils=require(_0xa87f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa87f('0x6')][_0xa87f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x186046,_0x1d80d8,_0x50d4ba){return new BPromise(function(_0x2e391c,_0x1f68e6){return client[_0xa87f('0x8')](_0x186046,_0x50d4ba)[_0xa87f('0x9')](function(_0x3ba614){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1d80d8,'request\x20sent');logger[_0xa87f('0xa')](_0xa87f('0xb'),_0x1d80d8,_0xa87f('0xc'),JSON[_0xa87f('0xd')](_0x3ba614));if(_0x3ba614[_0xa87f('0xe')]){if(_0x3ba614[_0xa87f('0xe')]['code']===0x1f4){logger['error'](_0xa87f('0xf'),_0x1d80d8,_0x3ba614[_0xa87f('0xe')][_0xa87f('0x10')]);return _0x1f68e6(_0x3ba614[_0xa87f('0xe')][_0xa87f('0x10')]);}logger[_0xa87f('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x1d80d8,_0x3ba614[_0xa87f('0xe')][_0xa87f('0x10')]);return _0x2e391c(_0x3ba614[_0xa87f('0xe')]['message']);}else{logger[_0xa87f('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x1d80d8,_0xa87f('0xc'));_0x2e391c(_0x3ba614[_0xa87f('0x12')][_0xa87f('0x10')]);}})['catch'](function(_0x47de71){logger['error'](_0xa87f('0xf'),_0x1d80d8,_0x47de71);_0x1f68e6(_0x47de71);});});} \ No newline at end of file +var _0x8075=['info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','request'];(function(_0x584247,_0x4cbfe5){var _0x2885c2=function(_0x20a0f6){while(--_0x20a0f6){_0x584247['push'](_0x584247['shift']());}};_0x2885c2(++_0x4cbfe5);}(_0x8075,0xab));var _0x5807=function(_0x11c9c3,_0x9b1b67){_0x11c9c3=_0x11c9c3-0x0;var _0x60202b=_0x8075[_0x11c9c3];return _0x60202b;};'use strict';var _=require(_0x5807('0x0'));var util=require(_0x5807('0x1'));var moment=require('moment');var BPromise=require(_0x5807('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5807('0x3'));var db=require(_0x5807('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5807('0x5'))(_0x5807('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5807('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x308e83,_0x1f2ddc,_0x2b84d0){return new BPromise(function(_0x1e98cf,_0x29e888){return client[_0x5807('0x8')](_0x308e83,_0x2b84d0)['then'](function(_0x47f3dc){logger[_0x5807('0x9')](_0x5807('0xa'),_0x1f2ddc,_0x5807('0xb'));logger[_0x5807('0xc')](_0x5807('0xd'),_0x1f2ddc,_0x5807('0xb'),JSON[_0x5807('0xe')](_0x47f3dc));if(_0x47f3dc[_0x5807('0xf')]){if(_0x47f3dc[_0x5807('0xf')][_0x5807('0x10')]===0x1f4){logger[_0x5807('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x1f2ddc,_0x47f3dc[_0x5807('0xf')][_0x5807('0x11')]);return _0x29e888(_0x47f3dc[_0x5807('0xf')][_0x5807('0x11')]);}logger[_0x5807('0xf')](_0x5807('0xa'),_0x1f2ddc,_0x47f3dc[_0x5807('0xf')][_0x5807('0x11')]);return _0x1e98cf(_0x47f3dc[_0x5807('0xf')][_0x5807('0x11')]);}else{logger[_0x5807('0x9')](_0x5807('0xa'),_0x1f2ddc,_0x5807('0xb'));_0x1e98cf(_0x47f3dc[_0x5807('0x12')][_0x5807('0x11')]);}})[_0x5807('0x13')](function(_0x3db6ea){logger[_0x5807('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x1f2ddc,_0x3db6ea);_0x29e888(_0x3db6ea);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ceee44e..a78bb82 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xec9bd6,_0x32fa4c){var _0x551416=function(_0x26e978){while(--_0x26e978){_0xec9bd6['push'](_0xec9bd6['shift']());}};_0x551416(++_0x32fa4c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xcb91[_0x1ebce2];return _0x4a330c;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x114123,_0x265960){var _0x160468=function(_0x1fefb8){while(--_0x1fefb8){_0x114123['push'](_0x114123['shift']());}};_0x160468(++_0x265960);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e7a2d,_0x3556c7){_0x3e7a2d=_0x3e7a2d-0x0;var _0x1e5a40=_0xedd9[_0x3e7a2d];return _0x1e5a40;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 953f4ab..5034b87 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 _0x2c42=['INTEGER','sequelize'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0x2c42,0x18b));var _0x22c4=function(_0x250cc1,_0x5f2b96){_0x250cc1=_0x250cc1-0x0;var _0x2684d3=_0x2c42[_0x250cc1];return _0x2684d3;};'use strict';var Sequelize=require(_0x22c4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x22c4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x22c4=['INTEGER','sequelize'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x22c4,0x81));var _0x422c=function(_0x2023e1,_0xeca985){_0x2023e1=_0x2023e1-0x0;var _0x1fe133=_0x22c4[_0x2023e1];return _0x1fe133;};'use strict';var Sequelize=require(_0x422c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x422c('0x1')],'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 9253b8a..7f9e39b 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 _0xe714=['path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x31a8b1,_0x37fc1e){var _0x233492=function(_0x509fde){while(--_0x509fde){_0x31a8b1['push'](_0x31a8b1['shift']());}};_0x233492(++_0x37fc1e);}(_0xe714,0xe2));var _0x4e71=function(_0x366d65,_0x3bcbf1){_0x366d65=_0x366d65-0x0;var _0x374760=_0xe714[_0x366d65];return _0x374760;};'use strict';var _=require(_0x4e71('0x0'));var util=require('util');var logger=require(_0x4e71('0x1'))(_0x4e71('0x2'));var moment=require(_0x4e71('0x3'));var BPromise=require(_0x4e71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e71('0x5'));var rimraf=require('rimraf');var config=require(_0x4e71('0x6'));var attributes=require(_0x4e71('0x7'));module[_0x4e71('0x8')]=function(_0x204a19,_0xfe1559){return _0x204a19[_0x4e71('0x9')]('UserSmsQueue',attributes,{'tableName':_0x4e71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe61c=['api','moment','path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','../../config/logger'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe61c,0xee));var _0xce61=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0xe61c[_0x1ebeea];return _0x576465;};'use strict';var _=require(_0xce61('0x0'));var util=require('util');var logger=require(_0xce61('0x1'))(_0xce61('0x2'));var moment=require(_0xce61('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce61('0x4'));var rimraf=require('rimraf');var config=require(_0xce61('0x5'));var attributes=require(_0xce61('0x6'));module[_0xce61('0x7')]=function(_0x200b9a,_0x239319){return _0x200b9a[_0xce61('0x8')](_0xce61('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 693361a..7bfa38a 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 _0x4acb=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','UserSmsQueue,\x20%s,\x20%s','message','catch'];(function(_0x2ba60f,_0x2d8111){var _0x3b41ee=function(_0x3ec1c6){while(--_0x3ec1c6){_0x2ba60f['push'](_0x2ba60f['shift']());}};_0x3b41ee(++_0x2d8111);}(_0x4acb,0xdc));var _0xb4ac=function(_0x2be429,_0xc31a74){_0x2be429=_0x2be429-0x0;var _0x4b4622=_0x4acb[_0x2be429];return _0x4b4622;};'use strict';var _=require(_0xb4ac('0x0'));var util=require(_0xb4ac('0x1'));var moment=require(_0xb4ac('0x2'));var BPromise=require(_0xb4ac('0x3'));var rs=require(_0xb4ac('0x4'));var fs=require('fs');var Redis=require(_0xb4ac('0x5'));var db=require(_0xb4ac('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4ac('0x7'))(_0xb4ac('0x8'));var config=require(_0xb4ac('0x9'));var jayson=require(_0xb4ac('0xa'));var client=jayson[_0xb4ac('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0e89,_0x57e88b,_0x43afd2){return new BPromise(function(_0x5a61ad,_0x1c7765){return client[_0xb4ac('0xc')](_0x3d0e89,_0x43afd2)[_0xb4ac('0xd')](function(_0x49a5ee){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x57e88b,_0xb4ac('0xe'));logger['debug'](_0xb4ac('0xf'),_0x57e88b,_0xb4ac('0xe'),JSON['stringify'](_0x49a5ee));if(_0x49a5ee[_0xb4ac('0x10')]){if(_0x49a5ee['error']['code']===0x1f4){logger[_0xb4ac('0x10')](_0xb4ac('0x11'),_0x57e88b,_0x49a5ee[_0xb4ac('0x10')][_0xb4ac('0x12')]);return _0x1c7765(_0x49a5ee[_0xb4ac('0x10')][_0xb4ac('0x12')]);}logger[_0xb4ac('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x57e88b,_0x49a5ee['error'][_0xb4ac('0x12')]);return _0x5a61ad(_0x49a5ee[_0xb4ac('0x10')][_0xb4ac('0x12')]);}else{logger['info'](_0xb4ac('0x11'),_0x57e88b,'request\x20sent');_0x5a61ad(_0x49a5ee['result'][_0xb4ac('0x12')]);}})[_0xb4ac('0x13')](function(_0x528918){logger['error'](_0xb4ac('0x11'),_0x57e88b,_0x528918);_0x1c7765(_0x528918);});});} \ No newline at end of file +var _0x24b5=['../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','rpc'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x24b5,0x162));var _0x524b=function(_0x4064b3,_0x2675ac){_0x4064b3=_0x4064b3-0x0;var _0x2b4636=_0x24b5[_0x4064b3];return _0x2b4636;};'use strict';var _=require(_0x524b('0x0'));var util=require(_0x524b('0x1'));var moment=require(_0x524b('0x2'));var BPromise=require(_0x524b('0x3'));var rs=require(_0x524b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x524b('0x5'));var config=require(_0x524b('0x6'));var jayson=require(_0x524b('0x7'));var client=jayson[_0x524b('0x8')][_0x524b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cf336,_0x30da22,_0x270bb5){return new BPromise(function(_0x2425d5,_0xfcdce6){return client[_0x524b('0xa')](_0x4cf336,_0x270bb5)['then'](function(_0xc49ddb){logger[_0x524b('0xb')](_0x524b('0xc'),_0x30da22,_0x524b('0xd'));logger[_0x524b('0xe')](_0x524b('0xf'),_0x30da22,_0x524b('0xd'),JSON[_0x524b('0x10')](_0xc49ddb));if(_0xc49ddb[_0x524b('0x11')]){if(_0xc49ddb[_0x524b('0x11')][_0x524b('0x12')]===0x1f4){logger[_0x524b('0x11')](_0x524b('0xc'),_0x30da22,_0xc49ddb[_0x524b('0x11')][_0x524b('0x13')]);return _0xfcdce6(_0xc49ddb[_0x524b('0x11')]['message']);}logger[_0x524b('0x11')](_0x524b('0xc'),_0x30da22,_0xc49ddb[_0x524b('0x11')][_0x524b('0x13')]);return _0x2425d5(_0xc49ddb['error'][_0x524b('0x13')]);}else{logger['info'](_0x524b('0xc'),_0x30da22,_0x524b('0xd'));_0x2425d5(_0xc49ddb['result'][_0x524b('0x13')]);}})['catch'](function(_0x27305c){logger['error'](_0x524b('0xc'),_0x30da22,_0x27305c);_0xfcdce6(_0x27305c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e43fd1f..41da00c 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 _0xad52=['sequelize','INTEGER'];(function(_0x3ba867,_0x4c24ee){var _0x2b61da=function(_0x17d8b2){while(--_0x17d8b2){_0x3ba867['push'](_0x3ba867['shift']());}};_0x2b61da(++_0x4c24ee);}(_0xad52,0x1ec));var _0x2ad5=function(_0x33fe42,_0x720c3){_0x33fe42=_0x33fe42-0x0;var _0x5ebf01=_0xad52[_0x33fe42];return _0x5ebf01;};'use strict';var Sequelize=require(_0x2ad5('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x2ad5('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x2ad5('0x1')]}}; \ No newline at end of file +var _0xe386=['INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe386,0xab));var _0x6e38=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe386[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x6e38('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x6e38('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x6e38('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 5deadba..397fe8f 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(_0xc4cd98,_0x117ecb){var _0x1840fc=function(_0x291d24){while(--_0x291d24){_0xc4cd98['push'](_0xc4cd98['shift']());}};_0x1840fc(++_0x117ecb);}(_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 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(_0xbaea0d,_0x93e255){var _0x180c46=function(_0x4eaad5){while(--_0x4eaad5){_0xbaea0d['push'](_0xbaea0d['shift']());}};_0x180c46(++_0x93e255);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 62d885e..787142a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3c2407,_0x3c9a47){var _0x5d2eac=function(_0xb33bf8){while(--_0xb33bf8){_0x3c2407['push'](_0x3c2407['shift']());}};_0x5d2eac(++_0x3c9a47);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3154fd,_0x2b011e){var _0x1f45e9=function(_0x592433){while(--_0x592433){_0x3154fd['push'](_0x3154fd['shift']());}};_0x1f45e9(++_0x2b011e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 39c4194..a873f1f 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 _0xda72=['exports','INTEGER'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xda72,0x7e));var _0x2da7=function(_0x36ba4e,_0x251d6b){_0x36ba4e=_0x36ba4e-0x0;var _0x35f1b7=_0xda72[_0x36ba4e];return _0x35f1b7;};'use strict';var Sequelize=require('sequelize');module[_0x2da7('0x0')]={'penalty':{'type':Sequelize[_0x2da7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1376=['INTEGER','exports'];(function(_0x2013a2,_0x52a892){var _0x1445d1=function(_0x203650){while(--_0x203650){_0x2013a2['push'](_0x2013a2['shift']());}};_0x1445d1(++_0x52a892);}(_0x1376,0x6f));var _0x6137=function(_0x2d3821,_0x197825){_0x2d3821=_0x2d3821-0x0;var _0x124545=_0x1376[_0x2d3821];return _0x124545;};'use strict';var Sequelize=require('sequelize');module[_0x6137('0x0')]={'penalty':{'type':Sequelize[_0x6137('0x1')],'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 0cf2623..3e6ab60 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 _0x94df=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util'];(function(_0xc42ffd,_0x5da648){var _0x19dc3=function(_0x8eff48){while(--_0x8eff48){_0xc42ffd['push'](_0xc42ffd['shift']());}};_0x19dc3(++_0x5da648);}(_0x94df,0x8a));var _0xf94d=function(_0xf8e9d8,_0x4c222b){_0xf8e9d8=_0xf8e9d8-0x0;var _0x1a283e=_0x94df[_0xf8e9d8];return _0x1a283e;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var logger=require(_0xf94d('0x2'))(_0xf94d('0x3'));var moment=require(_0xf94d('0x4'));var BPromise=require(_0xf94d('0x5'));var rp=require(_0xf94d('0x6'));var fs=require('fs');var path=require(_0xf94d('0x7'));var rimraf=require(_0xf94d('0x8'));var config=require('../../config/environment');var attributes=require(_0xf94d('0x9'));module[_0xf94d('0xa')]=function(_0xe7527,_0x44db74){return _0xe7527[_0xf94d('0xb')](_0xf94d('0xc'),attributes,{'tableName':_0xf94d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4106=['request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x4106,0x1b4));var _0x6410=function(_0x36b357,_0x2f8026){_0x36b357=_0x36b357-0x0;var _0x2d7a4d=_0x4106[_0x36b357];return _0x2d7a4d;};'use strict';var _=require(_0x6410('0x0'));var util=require(_0x6410('0x1'));var logger=require(_0x6410('0x2'))(_0x6410('0x3'));var moment=require(_0x6410('0x4'));var BPromise=require(_0x6410('0x5'));var rp=require(_0x6410('0x6'));var fs=require('fs');var path=require(_0x6410('0x7'));var rimraf=require(_0x6410('0x8'));var config=require(_0x6410('0x9'));var attributes=require('./userVoiceQueue.attributes');module[_0x6410('0xa')]=function(_0x301b9c,_0x1f0721){return _0x301b9c[_0x6410('0xb')](_0x6410('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index ec0147f..6709e1a 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 _0x0c2d=['randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment'];(function(_0x188083,_0x37f9be){var _0x27bcbf=function(_0xad333b){while(--_0xad333b){_0x188083['push'](_0x188083['shift']());}};_0x27bcbf(++_0x37f9be);}(_0x0c2d,0x19b));var _0xd0c2=function(_0x462c1e,_0x55425d){_0x462c1e=_0x462c1e-0x0;var _0x447df9=_0x0c2d[_0x462c1e];return _0x447df9;};'use strict';var _=require(_0xd0c2('0x0'));var util=require(_0xd0c2('0x1'));var moment=require(_0xd0c2('0x2'));var BPromise=require('bluebird');var rs=require(_0xd0c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0c2('0x4'))['db'];var utils=require(_0xd0c2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd0c2('0x6'));var client=jayson[_0xd0c2('0x7')][_0xd0c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x280313,_0x44fab9,_0x29cc96){return new BPromise(function(_0x2da32c,_0x4842b2){return client['request'](_0x280313,_0x29cc96)['then'](function(_0x243b61){logger['info'](_0xd0c2('0x9'),_0x44fab9,_0xd0c2('0xa'));logger[_0xd0c2('0xb')](_0xd0c2('0xc'),_0x44fab9,'request\x20sent',JSON['stringify'](_0x243b61));if(_0x243b61['error']){if(_0x243b61[_0xd0c2('0xd')][_0xd0c2('0xe')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x44fab9,_0x243b61[_0xd0c2('0xd')][_0xd0c2('0xf')]);return _0x4842b2(_0x243b61[_0xd0c2('0xd')][_0xd0c2('0xf')]);}logger[_0xd0c2('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x44fab9,_0x243b61[_0xd0c2('0xd')][_0xd0c2('0xf')]);return _0x2da32c(_0x243b61[_0xd0c2('0xd')][_0xd0c2('0xf')]);}else{logger[_0xd0c2('0x10')](_0xd0c2('0x9'),_0x44fab9,_0xd0c2('0xa'));_0x2da32c(_0x243b61[_0xd0c2('0x11')]['message']);}})['catch'](function(_0x5a49fd){logger[_0xd0c2('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x44fab9,_0x5a49fd);_0x4842b2(_0x5a49fd);});});} \ No newline at end of file +var _0xe15a=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0xe15a,0x191));var _0xae15=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xe15a[_0x286bfb];return _0x52b683;};'use strict';var _=require('lodash');var util=require(_0xae15('0x0'));var moment=require(_0xae15('0x1'));var BPromise=require(_0xae15('0x2'));var rs=require(_0xae15('0x3'));var fs=require('fs');var Redis=require(_0xae15('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae15('0x5'));var logger=require(_0xae15('0x6'))(_0xae15('0x7'));var config=require(_0xae15('0x8'));var jayson=require(_0xae15('0x9'));var client=jayson[_0xae15('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x191c55,_0x663e02,_0x4a9ae2){return new BPromise(function(_0x5cca5c,_0x3abe91){return client['request'](_0x191c55,_0x4a9ae2)[_0xae15('0xb')](function(_0x5ea7aa){logger['info'](_0xae15('0xc'),_0x663e02,_0xae15('0xd'));logger[_0xae15('0xe')](_0xae15('0xf'),_0x663e02,_0xae15('0xd'),JSON[_0xae15('0x10')](_0x5ea7aa));if(_0x5ea7aa[_0xae15('0x11')]){if(_0x5ea7aa[_0xae15('0x11')][_0xae15('0x12')]===0x1f4){logger['error'](_0xae15('0xc'),_0x663e02,_0x5ea7aa[_0xae15('0x11')][_0xae15('0x13')]);return _0x3abe91(_0x5ea7aa['error'][_0xae15('0x13')]);}logger[_0xae15('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x663e02,_0x5ea7aa[_0xae15('0x11')][_0xae15('0x13')]);return _0x5cca5c(_0x5ea7aa[_0xae15('0x11')]['message']);}else{logger[_0xae15('0x14')](_0xae15('0xc'),_0x663e02,_0xae15('0xd'));_0x5cca5c(_0x5ea7aa[_0xae15('0x15')]['message']);}})[_0xae15('0x16')](function(_0x584d47){logger[_0xae15('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x663e02,_0x584d47);_0x3abe91(_0x584d47);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3512eb9..12b5518 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x53e66f,_0x5e1f55){var _0x3741f4=function(_0x128533){while(--_0x128533){_0x53e66f['push'](_0x53e66f['shift']());}};_0x3741f4(++_0x5e1f55);}(_0x70e0,0x17b));var _0x070e=function(_0x2e6894,_0xb63a03){_0x2e6894=_0x2e6894-0x0;var _0x1ac694=_0x70e0[_0x2e6894];return _0x1ac694;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4481a1,_0x356b0e){var _0x175371=function(_0x2c9e15){while(--_0x2c9e15){_0x4481a1['push'](_0x4481a1['shift']());}};_0x175371(++_0x356b0e);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index df22b09..ef528fe 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 _0x2318=['exports','STRING','Required\x20by\x20Asterisk','INTEGER','queue_interface','sequelize'];(function(_0x3f5dd3,_0x171037){var _0x3cb003=function(_0x3115e4){while(--_0x3115e4){_0x3f5dd3['push'](_0x3f5dd3['shift']());}};_0x3cb003(++_0x171037);}(_0x2318,0x149));var _0x8231=function(_0xf8a84f,_0x245fe7){_0xf8a84f=_0xf8a84f-0x0;var _0x20cb8d=_0x2318[_0xf8a84f];return _0x20cb8d;};'use strict';var Sequelize=require(_0x8231('0x0'));module[_0x8231('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x8231('0x2')],'allowNull':![],'comment':_0x8231('0x3')},'UserId':{'type':Sequelize[_0x8231('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x8231('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8231('0x5'),'comment':_0x8231('0x3')},'penalty':{'type':Sequelize[_0x8231('0x4')](0xb),'defaultValue':0x0,'comment':_0x8231('0x3')},'paused':{'type':Sequelize[_0x8231('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x2b55=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0x2b55,0x180));var _0x52b5=function(_0x47172e,_0x387809){_0x47172e=_0x47172e-0x0;var _0x35c193=_0x2b55[_0x47172e];return _0x35c193;};'use strict';var Sequelize=require(_0x52b5('0x0'));module[_0x52b5('0x1')]={'uniqueid':{'type':Sequelize[_0x52b5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x52b5('0x3')},'membername':{'type':Sequelize[_0x52b5('0x4')],'allowNull':![],'comment':_0x52b5('0x3')},'UserId':{'type':Sequelize[_0x52b5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x52b5('0x3')},'VoiceQueueId':{'type':Sequelize[_0x52b5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x52b5('0x4')],'allowNull':![],'unique':_0x52b5('0x5'),'comment':_0x52b5('0x3')},'penalty':{'type':Sequelize[_0x52b5('0x2')](0xb),'defaultValue':0x0,'comment':_0x52b5('0x3')},'paused':{'type':Sequelize[_0x52b5('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5d7fdcc..e7da820 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 _0xf732=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt'];(function(_0x151b2a,_0x2b88b8){var _0x5c2c04=function(_0x1786d0){while(--_0x1786d0){_0x151b2a['push'](_0x151b2a['shift']());}};_0x5c2c04(++_0x2b88b8);}(_0xf732,0x126));var _0x2f73=function(_0x6bb9,_0x10f2b6){_0x6bb9=_0x6bb9-0x0;var _0xe3b3bc=_0xf732[_0x6bb9];return _0xe3b3bc;};'use strict';var EventEmitter=require(_0x2f73('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x2f73('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2f73('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f73('0x3'),'afterDestroy':'remove'};function emitEvent(_0x428018){return function(_0x28e7eb,_0x5a228b,_0x2dc3d6){UserVoiceQueueRtEvents[_0x2f73('0x4')](_0x428018+':'+_0x28e7eb['id'],_0x28e7eb);UserVoiceQueueRtEvents['emit'](_0x428018,_0x28e7eb);_0x2dc3d6(null);};}for(var e in events){if(events[_0x2f73('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x2f73('0x6')](e,emitEvent(event));}}module[_0x2f73('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4b39=['UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4b39,0x181));var _0x94b3=function(_0x29dd49,_0x4f1a04){_0x29dd49=_0x29dd49-0x0;var _0x512435=_0x4b39[_0x29dd49];return _0x512435;};'use strict';var EventEmitter=require(_0x94b3('0x0'));var UserVoiceQueueRt=require(_0x94b3('0x1'))['db'][_0x94b3('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x94b3('0x3'),'afterUpdate':_0x94b3('0x4'),'afterDestroy':_0x94b3('0x5')};function emitEvent(_0x2e3f83){return function(_0x5f0cf9,_0x45f8fc,_0x1454f5){UserVoiceQueueRtEvents[_0x94b3('0x6')](_0x2e3f83+':'+_0x5f0cf9['id'],_0x5f0cf9);UserVoiceQueueRtEvents[_0x94b3('0x6')](_0x2e3f83,_0x5f0cf9);_0x1454f5(null);};}for(var e in events){if(events[_0x94b3('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x94b3('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7c886e7..aefb0cb 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 _0x59c2=['user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x5ce363,_0x45e864){var _0x486070=function(_0x58a7ec){while(--_0x58a7ec){_0x5ce363['push'](_0x5ce363['shift']());}};_0x486070(++_0x45e864);}(_0x59c2,0x12c));var _0x259c=function(_0x49b14d,_0x578d07){_0x49b14d=_0x49b14d-0x0;var _0x3d2488=_0x59c2[_0x49b14d];return _0x3d2488;};'use strict';var _=require(_0x259c('0x0'));var util=require(_0x259c('0x1'));var logger=require(_0x259c('0x2'))('api');var moment=require(_0x259c('0x3'));var BPromise=require(_0x259c('0x4'));var rp=require(_0x259c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x259c('0x6'));var config=require(_0x259c('0x7'));var attributes=require(_0x259c('0x8'));module[_0x259c('0x9')]=function(_0x47017c,_0x490faf){return _0x47017c[_0x259c('0xa')](_0x259c('0xb'),attributes,{'tableName':_0x259c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x555c=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x20d4fa,_0x3c3e50){var _0x20191c=function(_0x15db95){while(--_0x15db95){_0x20d4fa['push'](_0x20d4fa['shift']());}};_0x20191c(++_0x3c3e50);}(_0x555c,0xfa));var _0xc555=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x555c[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xc555('0x0'));var util=require(_0xc555('0x1'));var logger=require(_0xc555('0x2'))(_0xc555('0x3'));var moment=require(_0xc555('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc555('0x5'));var rimraf=require(_0xc555('0x6'));var config=require(_0xc555('0x7'));var attributes=require(_0xc555('0x8'));module[_0xc555('0x9')]=function(_0x1bf383,_0x385033){return _0x1bf383[_0xc555('0xa')](_0xc555('0xb'),attributes,{'tableName':_0xc555('0xc'),'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 16c76ce..8ad18be 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 _0xd8d1=['then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','literal','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','request'];(function(_0x569e2d,_0x1e91ae){var _0x261dec=function(_0x46bfa9){while(--_0x46bfa9){_0x569e2d['push'](_0x569e2d['shift']());}};_0x261dec(++_0x1e91ae);}(_0xd8d1,0x186));var _0x1d8d=function(_0xaa58a1,_0x306448){_0xaa58a1=_0xaa58a1-0x0;var _0x2641a1=_0xd8d1[_0xaa58a1];return _0x2641a1;};'use strict';var _=require(_0x1d8d('0x0'));var util=require(_0x1d8d('0x1'));var moment=require(_0x1d8d('0x2'));var BPromise=require(_0x1d8d('0x3'));var rs=require(_0x1d8d('0x4'));var fs=require('fs');var Redis=require(_0x1d8d('0x5'));var db=require(_0x1d8d('0x6'))['db'];var utils=require(_0x1d8d('0x7'));var logger=require(_0x1d8d('0x8'))(_0x1d8d('0x9'));var config=require('../../config/environment');var jayson=require(_0x1d8d('0xa'));var client=jayson[_0x1d8d('0xb')][_0x1d8d('0xc')]({'port':0x232a});config[_0x1d8d('0xd')]=_[_0x1d8d('0xe')](config['redis'],{'host':_0x1d8d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d8d('0xd')]));require(_0x1d8d('0x10'))['register'](socket);function respondWithRpcPromise(_0x5345f7,_0x5834f1,_0x41881a){return new BPromise(function(_0x3f108e,_0x3f3e04){return client[_0x1d8d('0x11')](_0x5345f7,_0x41881a)[_0x1d8d('0x12')](function(_0x1fc6d9){logger[_0x1d8d('0x13')](_0x1d8d('0x14'),_0x5834f1,_0x1d8d('0x15'));logger[_0x1d8d('0x16')](_0x1d8d('0x17'),_0x5834f1,'request\x20sent',JSON['stringify'](_0x1fc6d9));if(_0x1fc6d9['error']){if(_0x1fc6d9[_0x1d8d('0x18')]['code']===0x1f4){logger[_0x1d8d('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5834f1,_0x1fc6d9['error'][_0x1d8d('0x19')]);return _0x3f3e04(_0x1fc6d9[_0x1d8d('0x18')][_0x1d8d('0x19')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5834f1,_0x1fc6d9['error'][_0x1d8d('0x19')]);return _0x3f108e(_0x1fc6d9[_0x1d8d('0x18')][_0x1d8d('0x19')]);}else{logger['info'](_0x1d8d('0x14'),_0x5834f1,_0x1d8d('0x15'));_0x3f108e(_0x1fc6d9['result'][_0x1d8d('0x19')]);}})[_0x1d8d('0x1a')](function(_0x1d0edd){logger[_0x1d8d('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5834f1,_0x1d0edd);_0x3f3e04(_0x1d0edd);});});}exports[_0x1d8d('0x1b')]=function(_0x5867d9){var _0x382c0a=this;return new Promise(function(_0x40d317,_0x293330){return db['UserVoiceQueueRt'][_0x1d8d('0x1c')]({'raw':_0x5867d9['options']?_0x5867d9[_0x1d8d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5867d9[_0x1d8d('0x1d')]?_0x5867d9[_0x1d8d('0x1d')][_0x1d8d('0x1e')]||null:null,'attributes':[[db[_0x1d8d('0x1f')]['fn'](_0x1d8d('0x20'),db[_0x1d8d('0x1f')]['fn']('IF',db[_0x1d8d('0x1f')][_0x1d8d('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x1d8d('0x12')](function(_0x4ccf67){logger[_0x1d8d('0x13')](_0x1d8d('0x1b'),_0x5867d9);logger[_0x1d8d('0x16')](_0x1d8d('0x1b'),_0x5867d9,JSON['stringify'](_0x4ccf67));_0x40d317(_0x4ccf67);})['catch'](function(_0x4b0733){logger[_0x1d8d('0x18')](_0x1d8d('0x1b'),_0x4b0733[_0x1d8d('0x19')],_0x5867d9);_0x293330(_0x382c0a['error'](0x1f4,_0x4b0733[_0x1d8d('0x19')]));});});}; \ No newline at end of file +var _0x3ebf=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','then','stringify'];(function(_0x39782f,_0x4aa931){var _0x47768c=function(_0x2672e4){while(--_0x2672e4){_0x39782f['push'](_0x39782f['shift']());}};_0x47768c(++_0x4aa931);}(_0x3ebf,0xe4));var _0xf3eb=function(_0x1308e8,_0x180f97){_0x1308e8=_0x1308e8-0x0;var _0x2f9253=_0x3ebf[_0x1308e8];return _0x2f9253;};'use strict';var _=require(_0xf3eb('0x0'));var util=require(_0xf3eb('0x1'));var moment=require(_0xf3eb('0x2'));var BPromise=require(_0xf3eb('0x3'));var rs=require(_0xf3eb('0x4'));var fs=require('fs');var Redis=require(_0xf3eb('0x5'));var db=require(_0xf3eb('0x6'))['db'];var utils=require(_0xf3eb('0x7'));var logger=require(_0xf3eb('0x8'))(_0xf3eb('0x9'));var config=require(_0xf3eb('0xa'));var jayson=require(_0xf3eb('0xb'));var client=jayson[_0xf3eb('0xc')][_0xf3eb('0xd')]({'port':0x232a});config[_0xf3eb('0xe')]=_[_0xf3eb('0xf')](config[_0xf3eb('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3eb('0xe')]));require(_0xf3eb('0x10'))[_0xf3eb('0x11')](socket);function respondWithRpcPromise(_0x41669d,_0x1de2c7,_0xefbef5){return new BPromise(function(_0x52e242,_0x11e755){return client[_0xf3eb('0x12')](_0x41669d,_0xefbef5)['then'](function(_0x3e05ca){logger[_0xf3eb('0x13')](_0xf3eb('0x14'),_0x1de2c7,_0xf3eb('0x15'));logger[_0xf3eb('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1de2c7,_0xf3eb('0x15'),JSON['stringify'](_0x3e05ca));if(_0x3e05ca[_0xf3eb('0x17')]){if(_0x3e05ca[_0xf3eb('0x17')][_0xf3eb('0x18')]===0x1f4){logger[_0xf3eb('0x17')](_0xf3eb('0x14'),_0x1de2c7,_0x3e05ca[_0xf3eb('0x17')][_0xf3eb('0x19')]);return _0x11e755(_0x3e05ca['error'][_0xf3eb('0x19')]);}logger[_0xf3eb('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1de2c7,_0x3e05ca['error'][_0xf3eb('0x19')]);return _0x52e242(_0x3e05ca[_0xf3eb('0x17')][_0xf3eb('0x19')]);}else{logger[_0xf3eb('0x13')](_0xf3eb('0x14'),_0x1de2c7,_0xf3eb('0x15'));_0x52e242(_0x3e05ca['result'][_0xf3eb('0x19')]);}})[_0xf3eb('0x1a')](function(_0x15c72d){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1de2c7,_0x15c72d);_0x11e755(_0x15c72d);});});}exports[_0xf3eb('0x1b')]=function(_0x1b580c){var _0x107d31=this;return new Promise(function(_0x38c0af,_0x450465){return db[_0xf3eb('0x1c')][_0xf3eb('0x1d')]({'raw':_0x1b580c[_0xf3eb('0x1e')]?_0x1b580c[_0xf3eb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1b580c[_0xf3eb('0x1e')]?_0x1b580c[_0xf3eb('0x1e')][_0xf3eb('0x1f')]||null:null,'attributes':[[db[_0xf3eb('0x20')]['fn'](_0xf3eb('0x21'),db[_0xf3eb('0x20')]['fn']('IF',db[_0xf3eb('0x20')][_0xf3eb('0x22')](_0xf3eb('0x23')))),'outboundQueuePauses']]})[_0xf3eb('0x24')](function(_0x14b888){logger[_0xf3eb('0x13')](_0xf3eb('0x1b'),_0x1b580c);logger[_0xf3eb('0x16')](_0xf3eb('0x1b'),_0x1b580c,JSON[_0xf3eb('0x25')](_0x14b888));_0x38c0af(_0x14b888);})[_0xf3eb('0x1a')](function(_0x2de28d){logger['error']('GetVoiceQueueRtPauses',_0x2de28d[_0xf3eb('0x19')],_0x1b580c);_0x450465(_0x107d31[_0xf3eb('0x17')](0x1f4,_0x2de28d[_0xf3eb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 4230895..82380d5 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 _0x94ba=['remove','update','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x532e94,_0x1d6faa){var _0xa382ff=function(_0x2ba688){while(--_0x2ba688){_0x532e94['push'](_0x532e94['shift']());}};_0xa382ff(++_0x1d6faa);}(_0x94ba,0xbe));var _0xa94b=function(_0x27f7b6,_0x2dde24){_0x27f7b6=_0x27f7b6-0x0;var _0x22fd91=_0x94ba[_0x27f7b6];return _0x22fd91;};'use strict';var UserVoiceQueueRtEvents=require(_0xa94b('0x0'));var events=[_0xa94b('0x1'),_0xa94b('0x2'),_0xa94b('0x3')];function createListener(_0x2275a0,_0x552bca){return function(_0xf515c0){_0x552bca['emit'](_0x2275a0,_0xf515c0);};}function removeListener(_0x3041fd,_0xd72e72){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3041fd,_0xd72e72);};}exports['register']=function(_0x76f30f){for(var _0x2daeef=0x0,_0x363129=events[_0xa94b('0x4')];_0x2daeef<_0x363129;_0x2daeef++){var _0x54c158=events[_0x2daeef];var _0x41aca1=createListener(_0xa94b('0x5')+_0x54c158,_0x76f30f);UserVoiceQueueRtEvents['on'](_0x54c158,_0x41aca1);}}; \ No newline at end of file +var _0x4279=['register','length','userVoiceQueueRt:','save','remove','emit'];(function(_0x42e2a0,_0xd2a7e1){var _0x3dbf06=function(_0x1a8ed6){while(--_0x1a8ed6){_0x42e2a0['push'](_0x42e2a0['shift']());}};_0x3dbf06(++_0xd2a7e1);}(_0x4279,0x8d));var _0x9427=function(_0x3a0141,_0x5beca3){_0x3a0141=_0x3a0141-0x0;var _0x5c8647=_0x4279[_0x3a0141];return _0x5c8647;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x9427('0x0'),_0x9427('0x1'),'update'];function createListener(_0x24fd0c,_0xd87b13){return function(_0x1e93f9){_0xd87b13[_0x9427('0x2')](_0x24fd0c,_0x1e93f9);};}function removeListener(_0x54cdfb,_0x426911){return function(){UserVoiceQueueRtEvents['removeListener'](_0x54cdfb,_0x426911);};}exports[_0x9427('0x3')]=function(_0x2a0b3e){for(var _0x5e9d1e=0x0,_0x7fa417=events[_0x9427('0x4')];_0x5e9d1e<_0x7fa417;_0x5e9d1e++){var _0x25ba0b=events[_0x5e9d1e];var _0x4d24f2=createListener(_0x9427('0x5')+_0x25ba0b,_0x2a0b3e);UserVoiceQueueRtEvents['on'](_0x25ba0b,_0x4d24f2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 131effc..51e271d 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x35ec99,_0x248b12){var _0x530419=function(_0x16e190){while(--_0x16e190){_0x35ec99['push'](_0x35ec99['shift']());}};_0x530419(++_0x248b12);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0xcb91[_0x5a6961];return _0x4af0a6;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3b6c2e,_0xb4d3ce){var _0x4e4e3f=function(_0x18a08c){while(--_0x18a08c){_0x3b6c2e['push'](_0x3b6c2e['shift']());}};_0x4e4e3f(++_0xb4d3ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index df50e39..fef946f 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 _0xd8ee=['sequelize','INTEGER'];(function(_0x4305ea,_0x5e6be0){var _0x50e742=function(_0x2e5e49){while(--_0x2e5e49){_0x4305ea['push'](_0x4305ea['shift']());}};_0x50e742(++_0x5e6be0);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x382433,_0x5c0fc4){_0x382433=_0x382433-0x0;var _0x24af1b=_0xd8ee[_0x382433];return _0x24af1b;};'use strict';var Sequelize=require(_0xed8e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xed8e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x133b=['exports','INTEGER'];(function(_0x4cf7fa,_0x1d5989){var _0xfab730=function(_0x47e896){while(--_0x47e896){_0x4cf7fa['push'](_0x4cf7fa['shift']());}};_0xfab730(++_0x1d5989);}(_0x133b,0x7c));var _0xb133=function(_0x222cfe,_0x1138b5){_0x222cfe=_0x222cfe-0x0;var _0x3d64aa=_0x133b[_0x222cfe];return _0x3d64aa;};'use strict';var Sequelize=require('sequelize');module[_0xb133('0x0')]={'penalty':{'type':Sequelize[_0xb133('0x1')],'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 c112bd6..889a75e 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 _0x3bc1=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x38b02a,_0x417927){var _0x215b85=function(_0x1ac384){while(--_0x1ac384){_0x38b02a['push'](_0x38b02a['shift']());}};_0x215b85(++_0x417927);}(_0x3bc1,0xca));var _0x13bc=function(_0x2f113f,_0x1c0f3d){_0x2f113f=_0x2f113f-0x0;var _0x3f95e0=_0x3bc1[_0x2f113f];return _0x3f95e0;};'use strict';var _=require(_0x13bc('0x0'));var util=require('util');var logger=require(_0x13bc('0x1'))('api');var moment=require(_0x13bc('0x2'));var BPromise=require('bluebird');var rp=require(_0x13bc('0x3'));var fs=require('fs');var path=require(_0x13bc('0x4'));var rimraf=require(_0x13bc('0x5'));var config=require(_0x13bc('0x6'));var attributes=require(_0x13bc('0x7'));module[_0x13bc('0x8')]=function(_0x3274a0,_0x969edb){return _0x3274a0[_0x13bc('0x9')](_0x13bc('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f88=['api','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f88,0x17d));var _0x84f8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4f88[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var logger=require(_0x84f8('0x2'))(_0x84f8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x84f8('0x4'));var fs=require('fs');var path=require(_0x84f8('0x5'));var rimraf=require(_0x84f8('0x6'));var config=require(_0x84f8('0x7'));var attributes=require(_0x84f8('0x8'));module[_0x84f8('0x9')]=function(_0x454ada,_0xcdf771){return _0x454ada[_0x84f8('0xa')](_0x84f8('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','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 3239e51..79fa1c8 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 _0xbf3c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x5f36f7,_0x583e31){var _0x1d1c7d=function(_0x3ffe3a){while(--_0x3ffe3a){_0x5f36f7['push'](_0x5f36f7['shift']());}};_0x1d1c7d(++_0x583e31);}(_0xbf3c,0x15c));var _0xcbf3=function(_0x2c8bfc,_0xc03cfc){_0x2c8bfc=_0x2c8bfc-0x0;var _0x13e23f=_0xbf3c[_0x2c8bfc];return _0x13e23f;};'use strict';var _=require(_0xcbf3('0x0'));var util=require(_0xcbf3('0x1'));var moment=require(_0xcbf3('0x2'));var BPromise=require(_0xcbf3('0x3'));var rs=require(_0xcbf3('0x4'));var fs=require('fs');var Redis=require(_0xcbf3('0x5'));var db=require(_0xcbf3('0x6'))['db'];var utils=require(_0xcbf3('0x7'));var logger=require(_0xcbf3('0x8'))(_0xcbf3('0x9'));var config=require(_0xcbf3('0xa'));var jayson=require(_0xcbf3('0xb'));var client=jayson[_0xcbf3('0xc')][_0xcbf3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x579dde,_0x52aee9,_0x2010be){return new BPromise(function(_0x53e79b,_0x417aea){return client[_0xcbf3('0xe')](_0x579dde,_0x2010be)[_0xcbf3('0xf')](function(_0x6a9a2c){logger[_0xcbf3('0x10')](_0xcbf3('0x11'),_0x52aee9,_0xcbf3('0x12'));logger[_0xcbf3('0x13')](_0xcbf3('0x14'),_0x52aee9,_0xcbf3('0x12'),JSON[_0xcbf3('0x15')](_0x6a9a2c));if(_0x6a9a2c['error']){if(_0x6a9a2c[_0xcbf3('0x16')][_0xcbf3('0x17')]===0x1f4){logger['error'](_0xcbf3('0x11'),_0x52aee9,_0x6a9a2c[_0xcbf3('0x16')][_0xcbf3('0x18')]);return _0x417aea(_0x6a9a2c['error']['message']);}logger[_0xcbf3('0x16')](_0xcbf3('0x11'),_0x52aee9,_0x6a9a2c['error'][_0xcbf3('0x18')]);return _0x53e79b(_0x6a9a2c['error']['message']);}else{logger[_0xcbf3('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x52aee9,_0xcbf3('0x12'));_0x53e79b(_0x6a9a2c[_0xcbf3('0x19')][_0xcbf3('0x18')]);}})[_0xcbf3('0x1a')](function(_0x3b8fb9){logger[_0xcbf3('0x16')](_0xcbf3('0x11'),_0x52aee9,_0x3b8fb9);_0x417aea(_0x3b8fb9);});});} \ No newline at end of file +var _0x9701=['rpc','../../config/environment','jayson/promise','client','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x5a66f1,_0x371057){var _0xcc0643=function(_0xbab9e6){while(--_0xbab9e6){_0x5a66f1['push'](_0x5a66f1['shift']());}};_0xcc0643(++_0x371057);}(_0x9701,0x1c8));var _0x1970=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9701[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x1970('0x0'));var util=require('util');var moment=require(_0x1970('0x1'));var BPromise=require(_0x1970('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1970('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1970('0x4'));var config=require(_0x1970('0x5'));var jayson=require(_0x1970('0x6'));var client=jayson[_0x1970('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2159f9,_0x23032a,_0x2e96ee){return new BPromise(function(_0x158939,_0xb8a60a){return client[_0x1970('0x8')](_0x2159f9,_0x2e96ee)['then'](function(_0x1a7646){logger[_0x1970('0x9')](_0x1970('0xa'),_0x23032a,_0x1970('0xb'));logger[_0x1970('0xc')](_0x1970('0xd'),_0x23032a,'request\x20sent',JSON[_0x1970('0xe')](_0x1a7646));if(_0x1a7646[_0x1970('0xf')]){if(_0x1a7646[_0x1970('0xf')][_0x1970('0x10')]===0x1f4){logger[_0x1970('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x23032a,_0x1a7646[_0x1970('0xf')][_0x1970('0x11')]);return _0xb8a60a(_0x1a7646['error'][_0x1970('0x11')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x23032a,_0x1a7646[_0x1970('0xf')][_0x1970('0x11')]);return _0x158939(_0x1a7646[_0x1970('0xf')][_0x1970('0x11')]);}else{logger[_0x1970('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x23032a,'request\x20sent');_0x158939(_0x1a7646[_0x1970('0x12')][_0x1970('0x11')]);}})[_0x1970('0x13')](function(_0x1a32ee){logger[_0x1970('0xf')](_0x1970('0xa'),_0x23032a,_0x1a32ee);_0xb8a60a(_0x1a32ee);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 5d35889..adf4f03 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 _0x0eaa=['update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','show','create','put','/:id'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x58d3b7,_0x1dc98a){_0x58d3b7=_0x58d3b7-0x0;var _0x1603b1=_0x0eaa[_0x58d3b7];return _0x1603b1;};'use strict';var multer=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa0ea('0x2'));var router=express[_0xa0ea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa0ea('0x4'));var interaction=require(_0xa0ea('0x5'));var config=require(_0xa0ea('0x6'));var controller=require(_0xa0ea('0x7'));router[_0xa0ea('0x8')]('/',auth['isAuthenticated'](),controller[_0xa0ea('0x9')]);router['get']('/:id',auth[_0xa0ea('0xa')](),controller[_0xa0ea('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa0ea('0xc')]);router[_0xa0ea('0xd')](_0xa0ea('0xe'),auth[_0xa0ea('0xa')](),controller[_0xa0ea('0xf')]);router['delete'](_0xa0ea('0xe'),auth[_0xa0ea('0xa')](),controller[_0xa0ea('0x10')]);module[_0xa0ea('0x11')]=router; \ No newline at end of file +var _0xa4fb=['../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x372301,_0x118980){var _0x1d448d=function(_0x1b5db7){while(--_0x1b5db7){_0x372301['push'](_0x372301['shift']());}};_0x1d448d(++_0x118980);}(_0xa4fb,0x150));var _0xba4f=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xa4fb[_0x5c9307];return _0x373e29;};'use strict';var multer=require(_0xba4f('0x0'));var util=require(_0xba4f('0x1'));var path=require(_0xba4f('0x2'));var timeout=require(_0xba4f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xba4f('0x4'));var auth=require(_0xba4f('0x5'));var interaction=require(_0xba4f('0x6'));var config=require('../../config/environment');var controller=require(_0xba4f('0x7'));router[_0xba4f('0x8')]('/',auth[_0xba4f('0x9')](),controller[_0xba4f('0xa')]);router[_0xba4f('0x8')](_0xba4f('0xb'),auth[_0xba4f('0x9')](),controller[_0xba4f('0xc')]);router[_0xba4f('0xd')]('/',auth[_0xba4f('0x9')](),controller['create']);router[_0xba4f('0xe')]('/:id',auth[_0xba4f('0x9')](),controller[_0xba4f('0xf')]);router[_0xba4f('0x10')](_0xba4f('0xb'),auth[_0xba4f('0x9')](),controller[_0xba4f('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 7ecd41b..00b8e49 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 _0x64fd=['sequelize','STRING','name'];(function(_0x350f9c,_0x3bb767){var _0x81f2cf=function(_0x541407){while(--_0x541407){_0x350f9c['push'](_0x350f9c['shift']());}};_0x81f2cf(++_0x3bb767);}(_0x64fd,0x9f));var _0xd64f=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x64fd[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0xd64f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd64f('0x1')],'unique':_0xd64f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd64f('0x1')]}}; \ No newline at end of file +var _0xab29=['name','sequelize','exports','STRING'];(function(_0x39a7ff,_0x547067){var _0x502470=function(_0x5e5af0){while(--_0x5e5af0){_0x39a7ff['push'](_0x39a7ff['shift']());}};_0x502470(++_0x547067);}(_0xab29,0x145));var _0x9ab2=function(_0x11cbed,_0x4ac238){_0x11cbed=_0x11cbed-0x0;var _0x215e1f=_0xab29[_0x11cbed];return _0x215e1f;};'use strict';var Sequelize=require(_0x9ab2('0x0'));module[_0x9ab2('0x1')]={'name':{'type':Sequelize[_0x9ab2('0x2')],'unique':_0x9ab2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 450b68f..a05e767 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 _0x9b71=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','params','keys','includeAll','find','catch','create','body','role','user','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','json','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','Variable','rawAttributes','type','key','model','query','filters','intersection'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x9b71,0x68));var _0x19b7=function(_0x176b1c,_0x427b98){_0x176b1c=_0x176b1c-0x0;var _0x1a06ee=_0x9b71[_0x176b1c];return _0x1a06ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19b7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19b7('0x1'));var rp=require('request-promise');var moment=require(_0x19b7('0x2'));var BPromise=require(_0x19b7('0x3'));var Mustache=require(_0x19b7('0x4'));var util=require(_0x19b7('0x5'));var path=require(_0x19b7('0x6'));var sox=require('sox');var csv=require(_0x19b7('0x7'));var ejs=require(_0x19b7('0x8'));var fs=require('fs');var fs_extra=require(_0x19b7('0x9'));var _=require(_0x19b7('0xa'));var squel=require(_0x19b7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x19b7('0x7'));var querystring=require('querystring');var Papa=require(_0x19b7('0xc'));var Redis=require(_0x19b7('0xd'));var authService=require(_0x19b7('0xe'));var qs=require(_0x19b7('0xf'));var as=require(_0x19b7('0x10'));var hardwareService=require(_0x19b7('0x11'));var logger=require(_0x19b7('0x12'))(_0x19b7('0x13'));var utils=require(_0x19b7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x19b7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x380d0c,_0x3cdc9b){_0x3cdc9b=_0x3cdc9b||0xcc;return function(_0x3edca5){if(_0x3edca5){return _0x380d0c[_0x19b7('0x16')](_0x3cdc9b);}return _0x380d0c['status'](_0x3cdc9b)[_0x19b7('0x17')]();};}function respondWithResult(_0x3bc05d,_0x3fa0d7){_0x3fa0d7=_0x3fa0d7||0xc8;return function(_0x357128){if(_0x357128){return _0x3bc05d[_0x19b7('0x18')](_0x3fa0d7)['json'](_0x357128);}};}function respondWithFilteredResult(_0x37ec8c,_0x9b6bc5){return function(_0x208198){if(_0x208198){var _0x576c1d=typeof _0x9b6bc5[_0x19b7('0x19')]===_0x19b7('0x1a')&&typeof _0x9b6bc5['limit']===_0x19b7('0x1a');var _0x25a138=_0x208198[_0x19b7('0x1b')];var _0x521cd0=_0x576c1d?0x0:_0x9b6bc5['offset'];var _0x49ae6c=_0x576c1d?_0x208198[_0x19b7('0x1b')]:_0x9b6bc5['offset']+_0x9b6bc5[_0x19b7('0x1c')];var _0x42a90c;if(_0x49ae6c>=_0x25a138){_0x49ae6c=_0x25a138;_0x42a90c=0xc8;}else{_0x42a90c=0xce;}_0x37ec8c[_0x19b7('0x18')](_0x42a90c);return _0x37ec8c['set']('Content-Range',_0x521cd0+'-'+_0x49ae6c+'/'+_0x25a138)[_0x19b7('0x1d')](_0x208198);}return null;};}function patchUpdates(_0x16f6f8){return function(_0x1119c6){try{jsonpatch['apply'](_0x1119c6,_0x16f6f8,!![]);}catch(_0x5e32e3){return BPromise[_0x19b7('0x1e')](_0x5e32e3);}return _0x1119c6[_0x19b7('0x1f')]();};}function saveUpdates(_0x36d8d6,_0x1734b0){return function(_0x3e3929){if(_0x3e3929){return _0x3e3929[_0x19b7('0x20')](_0x36d8d6)[_0x19b7('0x21')](function(_0x1771b9){return _0x1771b9;});}return null;};}function removeEntity(_0x32bf13,_0x260537){return function(_0x520d9e){if(_0x520d9e){return _0x520d9e['destroy']()['then'](function(){var _0x111338=_0x520d9e[_0x19b7('0x22')]({'plain':!![]});var _0x13665a='Variables';return db[_0x19b7('0x23')][_0x19b7('0x24')]({'where':{'type':_0x13665a,'resourceId':_0x111338['id']}})[_0x19b7('0x21')](function(){return _0x520d9e;});})[_0x19b7('0x21')](function(){_0x32bf13[_0x19b7('0x18')](0xcc)[_0x19b7('0x17')]();});}};}function handleEntityNotFound(_0x35958a,_0x1820b5){return function(_0x1caacd){if(!_0x1caacd){_0x35958a['sendStatus'](0x194);}return _0x1caacd;};}function handleError(_0x1e42af,_0x57e3e4){_0x57e3e4=_0x57e3e4||0x1f4;return function(_0x61636a){logger[_0x19b7('0x25')](_0x61636a[_0x19b7('0x26')]);if(_0x61636a[_0x19b7('0x27')]){delete _0x61636a[_0x19b7('0x27')];}_0x1e42af[_0x19b7('0x18')](_0x57e3e4)['send'](_0x61636a);};}exports[_0x19b7('0x28')]=function(_0x4da5e1,_0xbd60a9){var _0x4bead9={},_0x599b42={},_0x19e97f={'count':0x0,'rows':[]};var _0x3c9700=_[_0x19b7('0x29')](db[_0x19b7('0x2a')][_0x19b7('0x2b')],function(_0x3b150e){return{'name':_0x3b150e['fieldName'],'type':_0x3b150e[_0x19b7('0x2c')][_0x19b7('0x2d')]};});_0x599b42[_0x19b7('0x2e')]=_[_0x19b7('0x29')](_0x3c9700,_0x19b7('0x27'));_0x599b42[_0x19b7('0x2f')]=_['keys'](_0x4da5e1[_0x19b7('0x2f')]);_0x599b42[_0x19b7('0x30')]=_[_0x19b7('0x31')](_0x599b42[_0x19b7('0x2e')],_0x599b42[_0x19b7('0x2f')]);_0x4bead9[_0x19b7('0x32')]=_[_0x19b7('0x31')](_0x599b42['model'],qs[_0x19b7('0x33')](_0x4da5e1[_0x19b7('0x2f')][_0x19b7('0x33')]));_0x4bead9['attributes']=_0x4bead9[_0x19b7('0x32')][_0x19b7('0x34')]?_0x4bead9[_0x19b7('0x32')]:_0x599b42[_0x19b7('0x2e')];if(!_0x4da5e1['query'][_0x19b7('0x35')](_0x19b7('0x36'))){_0x4bead9['limit']=qs[_0x19b7('0x1c')](_0x4da5e1[_0x19b7('0x2f')]['limit']);_0x4bead9[_0x19b7('0x19')]=qs[_0x19b7('0x19')](_0x4da5e1[_0x19b7('0x2f')][_0x19b7('0x19')]);}_0x4bead9[_0x19b7('0x37')]=qs[_0x19b7('0x38')](_0x4da5e1[_0x19b7('0x2f')]['sort']);_0x4bead9[_0x19b7('0x39')]=qs[_0x19b7('0x30')](_['pick'](_0x4da5e1[_0x19b7('0x2f')],_0x599b42[_0x19b7('0x30')]),_0x3c9700);if(_0x4da5e1[_0x19b7('0x2f')]['filter']){_0x4bead9['where']=_['merge'](_0x4bead9[_0x19b7('0x39')],{'$or':_[_0x19b7('0x29')](_0x3c9700,function(_0x418c9d){if(_0x418c9d['type']!=='VIRTUAL'){var _0x1fac0f={};_0x1fac0f[_0x418c9d[_0x19b7('0x27')]]={'$like':'%'+_0x4da5e1['query'][_0x19b7('0x3a')]+'%'};return _0x1fac0f;}})});}_0x4bead9=_[_0x19b7('0x3b')]({},_0x4bead9,_0x4da5e1[_0x19b7('0x3c')]);var _0x40f507={'where':_0x4bead9[_0x19b7('0x39')]};return db['Variable'][_0x19b7('0x1b')](_0x40f507)['then'](function(_0x25dd6b){_0x19e97f['count']=_0x25dd6b;if(_0x4da5e1[_0x19b7('0x2f')]['includeAll']){_0x4bead9[_0x19b7('0x3d')]=[{'all':!![]}];}return db[_0x19b7('0x2a')][_0x19b7('0x3e')](_0x4bead9);})[_0x19b7('0x21')](function(_0x3643bc){_0x19e97f['rows']=_0x3643bc;return _0x19e97f;})['then'](respondWithFilteredResult(_0xbd60a9,_0x4bead9))['catch'](handleError(_0xbd60a9,null));};exports['show']=function(_0x4a7b7d,_0x3d0873){var _0x5a751d={'raw':!![],'where':{'id':_0x4a7b7d[_0x19b7('0x3f')]['id']}},_0x2633fa={};_0x2633fa['model']=_[_0x19b7('0x40')](db['Variable']['rawAttributes']);_0x2633fa[_0x19b7('0x2f')]=_['keys'](_0x4a7b7d[_0x19b7('0x2f')]);_0x2633fa[_0x19b7('0x30')]=_['intersection'](_0x2633fa['model'],_0x2633fa[_0x19b7('0x2f')]);_0x5a751d[_0x19b7('0x32')]=_['intersection'](_0x2633fa[_0x19b7('0x2e')],qs[_0x19b7('0x33')](_0x4a7b7d[_0x19b7('0x2f')][_0x19b7('0x33')]));_0x5a751d[_0x19b7('0x32')]=_0x5a751d[_0x19b7('0x32')][_0x19b7('0x34')]?_0x5a751d['attributes']:_0x2633fa[_0x19b7('0x2e')];if(_0x4a7b7d[_0x19b7('0x2f')][_0x19b7('0x41')]){_0x5a751d[_0x19b7('0x3d')]=[{'all':!![]}];}_0x5a751d=_[_0x19b7('0x3b')]({},_0x5a751d,_0x4a7b7d[_0x19b7('0x3c')]);return db['Variable'][_0x19b7('0x42')](_0x5a751d)[_0x19b7('0x21')](handleEntityNotFound(_0x3d0873,null))[_0x19b7('0x21')](respondWithResult(_0x3d0873,null))[_0x19b7('0x43')](handleError(_0x3d0873,null));};exports['create']=function(_0x33581e,_0x4679ca){return db['Variable'][_0x19b7('0x44')](_0x33581e[_0x19b7('0x45')],{})[_0x19b7('0x21')](function(_0x33de02){var _0x575c6e=_0x33581e['user'][_0x19b7('0x22')]({'plain':!![]});if(!_0x575c6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x575c6e[_0x19b7('0x46')]===_0x19b7('0x47')){var _0x5bcddd=_0x33de02[_0x19b7('0x22')]({'plain':!![]});var _0x421c25=_0x19b7('0x48');return db[_0x19b7('0x49')][_0x19b7('0x42')]({'where':{'name':_0x421c25,'userProfileId':_0x575c6e[_0x19b7('0x4a')]},'raw':!![]})[_0x19b7('0x21')](function(_0x118da4){if(_0x118da4&&_0x118da4[_0x19b7('0x4b')]===0x0){return db['UserProfileResource'][_0x19b7('0x44')]({'name':_0x5bcddd[_0x19b7('0x27')],'resourceId':_0x5bcddd['id'],'type':_0x118da4[_0x19b7('0x27')],'sectionId':_0x118da4['id']},{})['then'](function(){return _0x33de02;});}else{return _0x33de02;}})[_0x19b7('0x43')](function(_0x3c4d3f){logger[_0x19b7('0x25')](_0x19b7('0x4c'),_0x3c4d3f);throw _0x3c4d3f;});}return _0x33de02;})['then'](respondWithResult(_0x4679ca,0xc9))['catch'](handleError(_0x4679ca,null));};exports[_0x19b7('0x20')]=function(_0x74a69f,_0x35404e){if(_0x74a69f[_0x19b7('0x45')]['id']){delete _0x74a69f[_0x19b7('0x45')]['id'];}return db[_0x19b7('0x2a')][_0x19b7('0x42')]({'where':{'id':_0x74a69f[_0x19b7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x35404e,null))[_0x19b7('0x21')](saveUpdates(_0x74a69f[_0x19b7('0x45')],null))[_0x19b7('0x21')](respondWithResult(_0x35404e,null))[_0x19b7('0x43')](handleError(_0x35404e,null));};exports['destroy']=function(_0x43b69b,_0x34c707){return db[_0x19b7('0x2a')][_0x19b7('0x42')]({'where':{'id':_0x43b69b[_0x19b7('0x3f')]['id']}})[_0x19b7('0x21')](handleEntityNotFound(_0x34c707,null))[_0x19b7('0x21')](removeEntity(_0x34c707,null))[_0x19b7('0x43')](handleError(_0x34c707,null));}; \ No newline at end of file +var _0xe453=['moment','bluebird','mustache','util','path','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','count','Content-Range','apply','save','update','then','get','Variables','destroy','name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','request-promise'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0xe453,0xa3));var _0x3e45=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe453[_0x46e363];return _0x3fb059;};'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(_0x3e45('0x0'));var moment=require(_0x3e45('0x1'));var BPromise=require(_0x3e45('0x2'));var Mustache=require(_0x3e45('0x3'));var util=require(_0x3e45('0x4'));var path=require(_0x3e45('0x5'));var sox=require(_0x3e45('0x6'));var csv=require(_0x3e45('0x7'));var ejs=require(_0x3e45('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e45('0x9'));var squel=require('squel');var crypto=require(_0x3e45('0xa'));var jsforce=require(_0x3e45('0xb'));var deskjs=require(_0x3e45('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3e45('0xd'));var Redis=require(_0x3e45('0xe'));var authService=require(_0x3e45('0xf'));var qs=require(_0x3e45('0x10'));var as=require(_0x3e45('0x11'));var hardwareService=require(_0x3e45('0x12'));var logger=require(_0x3e45('0x13'))(_0x3e45('0x14'));var utils=require(_0x3e45('0x15'));var config=require(_0x3e45('0x16'));var licenseUtil=require(_0x3e45('0x17'));var db=require(_0x3e45('0x18'))['db'];function respondWithStatusCode(_0x4dd23b,_0x2f6a20){_0x2f6a20=_0x2f6a20||0xcc;return function(_0x45bcf5){if(_0x45bcf5){return _0x4dd23b[_0x3e45('0x19')](_0x2f6a20);}return _0x4dd23b[_0x3e45('0x1a')](_0x2f6a20)[_0x3e45('0x1b')]();};}function respondWithResult(_0x403b16,_0x320f00){_0x320f00=_0x320f00||0xc8;return function(_0x5ea060){if(_0x5ea060){return _0x403b16[_0x3e45('0x1a')](_0x320f00)[_0x3e45('0x1c')](_0x5ea060);}};}function respondWithFilteredResult(_0x4d394e,_0x2b2cec){return function(_0x6d27a4){if(_0x6d27a4){var _0x4aef45=typeof _0x2b2cec[_0x3e45('0x1d')]===_0x3e45('0x1e')&&typeof _0x2b2cec[_0x3e45('0x1f')]===_0x3e45('0x1e');var _0x388415=_0x6d27a4[_0x3e45('0x20')];var _0x4e98a7=_0x4aef45?0x0:_0x2b2cec['offset'];var _0x4a4ffb=_0x4aef45?_0x6d27a4[_0x3e45('0x20')]:_0x2b2cec[_0x3e45('0x1d')]+_0x2b2cec[_0x3e45('0x1f')];var _0x1d6153;if(_0x4a4ffb>=_0x388415){_0x4a4ffb=_0x388415;_0x1d6153=0xc8;}else{_0x1d6153=0xce;}_0x4d394e[_0x3e45('0x1a')](_0x1d6153);return _0x4d394e['set'](_0x3e45('0x21'),_0x4e98a7+'-'+_0x4a4ffb+'/'+_0x388415)[_0x3e45('0x1c')](_0x6d27a4);}return null;};}function patchUpdates(_0x2f201b){return function(_0x40d5f2){try{jsonpatch[_0x3e45('0x22')](_0x40d5f2,_0x2f201b,!![]);}catch(_0x2c11ea){return BPromise['reject'](_0x2c11ea);}return _0x40d5f2[_0x3e45('0x23')]();};}function saveUpdates(_0x42fdad,_0x45df7e){return function(_0x2f2cf9){if(_0x2f2cf9){return _0x2f2cf9[_0x3e45('0x24')](_0x42fdad)[_0x3e45('0x25')](function(_0x3654b7){return _0x3654b7;});}return null;};}function removeEntity(_0x2d5259,_0x39a1ad){return function(_0x3c3359){if(_0x3c3359){return _0x3c3359['destroy']()[_0x3e45('0x25')](function(){var _0x4fcf2c=_0x3c3359[_0x3e45('0x26')]({'plain':!![]});var _0x1fc6b3=_0x3e45('0x27');return db['UserProfileResource'][_0x3e45('0x28')]({'where':{'type':_0x1fc6b3,'resourceId':_0x4fcf2c['id']}})[_0x3e45('0x25')](function(){return _0x3c3359;});})[_0x3e45('0x25')](function(){_0x2d5259[_0x3e45('0x1a')](0xcc)[_0x3e45('0x1b')]();});}};}function handleEntityNotFound(_0x168c95,_0x273ee3){return function(_0x3f4a2d){if(!_0x3f4a2d){_0x168c95['sendStatus'](0x194);}return _0x3f4a2d;};}function handleError(_0x45855e,_0x371bd1){_0x371bd1=_0x371bd1||0x1f4;return function(_0x405b76){logger['error'](_0x405b76['stack']);if(_0x405b76[_0x3e45('0x29')]){delete _0x405b76['name'];}_0x45855e[_0x3e45('0x1a')](_0x371bd1)[_0x3e45('0x2a')](_0x405b76);};}exports[_0x3e45('0x2b')]=function(_0x360e54,_0xc10932){var _0x5dbae3={},_0x5d6234={},_0x1bde9e={'count':0x0,'rows':[]};var _0x2bb300=_[_0x3e45('0x2c')](db[_0x3e45('0x2d')][_0x3e45('0x2e')],function(_0x3a5c1a){return{'name':_0x3a5c1a[_0x3e45('0x2f')],'type':_0x3a5c1a['type'][_0x3e45('0x30')]};});_0x5d6234[_0x3e45('0x31')]=_[_0x3e45('0x2c')](_0x2bb300,_0x3e45('0x29'));_0x5d6234[_0x3e45('0x32')]=_[_0x3e45('0x33')](_0x360e54[_0x3e45('0x32')]);_0x5d6234['filters']=_['intersection'](_0x5d6234[_0x3e45('0x31')],_0x5d6234[_0x3e45('0x32')]);_0x5dbae3[_0x3e45('0x34')]=_[_0x3e45('0x35')](_0x5d6234[_0x3e45('0x31')],qs[_0x3e45('0x36')](_0x360e54['query'][_0x3e45('0x36')]));_0x5dbae3[_0x3e45('0x34')]=_0x5dbae3['attributes'][_0x3e45('0x37')]?_0x5dbae3['attributes']:_0x5d6234['model'];if(!_0x360e54['query'][_0x3e45('0x38')](_0x3e45('0x39'))){_0x5dbae3['limit']=qs[_0x3e45('0x1f')](_0x360e54[_0x3e45('0x32')]['limit']);_0x5dbae3[_0x3e45('0x1d')]=qs['offset'](_0x360e54['query'][_0x3e45('0x1d')]);}_0x5dbae3[_0x3e45('0x3a')]=qs[_0x3e45('0x3b')](_0x360e54[_0x3e45('0x32')][_0x3e45('0x3b')]);_0x5dbae3[_0x3e45('0x3c')]=qs['filters'](_['pick'](_0x360e54[_0x3e45('0x32')],_0x5d6234[_0x3e45('0x3d')]),_0x2bb300);if(_0x360e54[_0x3e45('0x32')][_0x3e45('0x3e')]){_0x5dbae3[_0x3e45('0x3c')]=_[_0x3e45('0x3f')](_0x5dbae3[_0x3e45('0x3c')],{'$or':_[_0x3e45('0x2c')](_0x2bb300,function(_0x2e64f4){if(_0x2e64f4[_0x3e45('0x40')]!==_0x3e45('0x41')){var _0x2aefec={};_0x2aefec[_0x2e64f4[_0x3e45('0x29')]]={'$like':'%'+_0x360e54[_0x3e45('0x32')][_0x3e45('0x3e')]+'%'};return _0x2aefec;}})});}_0x5dbae3=_[_0x3e45('0x3f')]({},_0x5dbae3,_0x360e54[_0x3e45('0x42')]);var _0x2399ab={'where':_0x5dbae3[_0x3e45('0x3c')]};return db['Variable']['count'](_0x2399ab)[_0x3e45('0x25')](function(_0x2c3a15){_0x1bde9e[_0x3e45('0x20')]=_0x2c3a15;if(_0x360e54[_0x3e45('0x32')]['includeAll']){_0x5dbae3[_0x3e45('0x43')]=[{'all':!![]}];}return db[_0x3e45('0x2d')][_0x3e45('0x44')](_0x5dbae3);})[_0x3e45('0x25')](function(_0x5c7d5f){_0x1bde9e[_0x3e45('0x45')]=_0x5c7d5f;return _0x1bde9e;})[_0x3e45('0x25')](respondWithFilteredResult(_0xc10932,_0x5dbae3))[_0x3e45('0x46')](handleError(_0xc10932,null));};exports['show']=function(_0x3b678e,_0x56a04c){var _0x3a57b9={'raw':!![],'where':{'id':_0x3b678e[_0x3e45('0x47')]['id']}},_0xd9c65c={};_0xd9c65c[_0x3e45('0x31')]=_['keys'](db[_0x3e45('0x2d')]['rawAttributes']);_0xd9c65c['query']=_[_0x3e45('0x33')](_0x3b678e[_0x3e45('0x32')]);_0xd9c65c[_0x3e45('0x3d')]=_[_0x3e45('0x35')](_0xd9c65c[_0x3e45('0x31')],_0xd9c65c[_0x3e45('0x32')]);_0x3a57b9[_0x3e45('0x34')]=_['intersection'](_0xd9c65c[_0x3e45('0x31')],qs[_0x3e45('0x36')](_0x3b678e[_0x3e45('0x32')][_0x3e45('0x36')]));_0x3a57b9[_0x3e45('0x34')]=_0x3a57b9['attributes'][_0x3e45('0x37')]?_0x3a57b9[_0x3e45('0x34')]:_0xd9c65c['model'];if(_0x3b678e[_0x3e45('0x32')][_0x3e45('0x48')]){_0x3a57b9['include']=[{'all':!![]}];}_0x3a57b9=_['merge']({},_0x3a57b9,_0x3b678e[_0x3e45('0x42')]);return db[_0x3e45('0x2d')]['find'](_0x3a57b9)['then'](handleEntityNotFound(_0x56a04c,null))['then'](respondWithResult(_0x56a04c,null))[_0x3e45('0x46')](handleError(_0x56a04c,null));};exports[_0x3e45('0x49')]=function(_0x12c206,_0x3c05bb){return db[_0x3e45('0x2d')][_0x3e45('0x49')](_0x12c206[_0x3e45('0x4a')],{})[_0x3e45('0x25')](function(_0x5c4a7b){var _0x357ad4=_0x12c206[_0x3e45('0x4b')][_0x3e45('0x26')]({'plain':!![]});if(!_0x357ad4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x357ad4[_0x3e45('0x4c')]===_0x3e45('0x4b')){var _0x386d18=_0x5c4a7b[_0x3e45('0x26')]({'plain':!![]});var _0x36031d=_0x3e45('0x27');return db['UserProfileSection'][_0x3e45('0x4d')]({'where':{'name':_0x36031d,'userProfileId':_0x357ad4[_0x3e45('0x4e')]},'raw':!![]})[_0x3e45('0x25')](function(_0x2d825d){if(_0x2d825d&&_0x2d825d[_0x3e45('0x4f')]===0x0){return db[_0x3e45('0x50')][_0x3e45('0x49')]({'name':_0x386d18[_0x3e45('0x29')],'resourceId':_0x386d18['id'],'type':_0x2d825d[_0x3e45('0x29')],'sectionId':_0x2d825d['id']},{})['then'](function(){return _0x5c4a7b;});}else{return _0x5c4a7b;}})['catch'](function(_0x347e82){logger['error'](_0x3e45('0x51'),_0x347e82);throw _0x347e82;});}return _0x5c4a7b;})[_0x3e45('0x25')](respondWithResult(_0x3c05bb,0xc9))[_0x3e45('0x46')](handleError(_0x3c05bb,null));};exports['update']=function(_0x496894,_0x1e398a){if(_0x496894['body']['id']){delete _0x496894[_0x3e45('0x4a')]['id'];}return db[_0x3e45('0x2d')]['find']({'where':{'id':_0x496894[_0x3e45('0x47')]['id']}})[_0x3e45('0x25')](handleEntityNotFound(_0x1e398a,null))[_0x3e45('0x25')](saveUpdates(_0x496894[_0x3e45('0x4a')],null))[_0x3e45('0x25')](respondWithResult(_0x1e398a,null))[_0x3e45('0x46')](handleError(_0x1e398a,null));};exports[_0x3e45('0x28')]=function(_0x42ab61,_0x1bf50b){return db[_0x3e45('0x2d')][_0x3e45('0x4d')]({'where':{'id':_0x42ab61[_0x3e45('0x47')]['id']}})[_0x3e45('0x25')](handleEntityNotFound(_0x1bf50b,null))[_0x3e45('0x25')](removeEntity(_0x1bf50b,null))[_0x3e45('0x46')](handleError(_0x1bf50b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8534cf7..ec674fe 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 _0x897f=['path','../../config/environment','./variable.attributes','exports','lodash','util','moment','bluebird','request-promise'];(function(_0x2dc39c,_0x1cc086){var _0x25d80d=function(_0xde870c){while(--_0xde870c){_0x2dc39c['push'](_0x2dc39c['shift']());}};_0x25d80d(++_0x1cc086);}(_0x897f,0x12d));var _0xf897=function(_0x3fec22,_0x2b4645){_0x3fec22=_0x3fec22-0x0;var _0x402df5=_0x897f[_0x3fec22];return _0x402df5;};'use strict';var _=require(_0xf897('0x0'));var util=require(_0xf897('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf897('0x2'));var BPromise=require(_0xf897('0x3'));var rp=require(_0xf897('0x4'));var fs=require('fs');var path=require(_0xf897('0x5'));var rimraf=require('rimraf');var config=require(_0xf897('0x6'));var attributes=require(_0xf897('0x7'));module[_0xf897('0x8')]=function(_0x598aa5,_0x55db76){return _0x598aa5['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x289f=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger','api','moment'];(function(_0xb58170,_0x513bc2){var _0x563ff7=function(_0xd1dce5){while(--_0xd1dce5){_0xb58170['push'](_0xb58170['shift']());}};_0x563ff7(++_0x513bc2);}(_0x289f,0x1c2));var _0xf289=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x289f[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xf289('0x0'));var util=require(_0xf289('0x1'));var logger=require(_0xf289('0x2'))(_0xf289('0x3'));var moment=require(_0xf289('0x4'));var BPromise=require('bluebird');var rp=require(_0xf289('0x5'));var fs=require('fs');var path=require(_0xf289('0x6'));var rimraf=require(_0xf289('0x7'));var config=require(_0xf289('0x8'));var attributes=require(_0xf289('0x9'));module[_0xf289('0xa')]=function(_0x4bc2c8,_0x38ddcb){return _0x4bc2c8[_0xf289('0xb')]('Variable',attributes,{'tableName':_0xf289('0xc'),'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 b9e6779..722be96 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 _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(_0x446225,_0x132919){var _0x3c7e37=function(_0x4c2492){while(--_0x4c2492){_0x446225['push'](_0x446225['shift']());}};_0x3c7e37(++_0x132919);}(_0x6aa7,0x178));var _0x76aa=function(_0x41203c,_0x1feea8){_0x41203c=_0x41203c-0x0;var _0x203892=_0x6aa7[_0x41203c];return _0x203892;};'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 +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x13f3af,_0x2ac326){var _0xda3c9f=function(_0x5d96e9){while(--_0x5d96e9){_0x13f3af['push'](_0x13f3af['shift']());}};_0xda3c9f(++_0x2ac326);}(_0x3e74,0x175));var _0x43e7=function(_0x2953fa,_0x4c4dc1){_0x2953fa=_0x2953fa-0x0;var _0x106faf=_0x3e74[_0x2953fa];return _0x106faf;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ba0f2bc..a669904 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 _0xb41c=['/pull','isAuthenticated','pull','/restart','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','/fetch','get','canUpdate','reset'];(function(_0x5d6d03,_0x553033){var _0x1635a5=function(_0x365e9e){while(--_0x365e9e){_0x5d6d03['push'](_0x5d6d03['shift']());}};_0x1635a5(++_0x553033);}(_0xb41c,0x7f));var _0xcb41=function(_0x11a448,_0x5b42e7){_0x11a448=_0x11a448-0x0;var _0x388c06=_0xb41c[_0x11a448];return _0x388c06;};'use strict';var express=require(_0xcb41('0x0'));var router=express[_0xcb41('0x1')]();var auth=require(_0xcb41('0x2'));var controller=require(_0xcb41('0x3'));router['get']('/',controller['index']);router['get'](_0xcb41('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller['fetch']);router[_0xcb41('0x5')]('/reset',auth['isAuthenticated'](),auth[_0xcb41('0x6')](),controller[_0xcb41('0x7')]);router['get'](_0xcb41('0x8'),auth[_0xcb41('0x9')](),auth[_0xcb41('0x6')](),controller[_0xcb41('0xa')]);router[_0xcb41('0x5')](_0xcb41('0xb'),auth[_0xcb41('0x9')](),controller[_0xcb41('0xc')]);router['get'](_0xcb41('0xd'),controller[_0xcb41('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf1bd=['get','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','pull','/restart','restart','migrations','exports','Router','./version.controller'];(function(_0xb03acb,_0x2e9075){var _0x2e3fff=function(_0x14a82e){while(--_0x14a82e){_0xb03acb['push'](_0xb03acb['shift']());}};_0x2e3fff(++_0x2e9075);}(_0xf1bd,0x116));var _0xdf1b=function(_0x3579d9,_0x3577ac){_0x3579d9=_0x3579d9-0x0;var _0x37fcca=_0xf1bd[_0x3579d9];return _0x37fcca;};'use strict';var express=require('express');var router=express[_0xdf1b('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xdf1b('0x1'));router[_0xdf1b('0x2')]('/',controller['index']);router[_0xdf1b('0x2')]('/fetch',auth['isAuthenticated'](),auth[_0xdf1b('0x3')](),controller[_0xdf1b('0x4')]);router[_0xdf1b('0x2')](_0xdf1b('0x5'),auth[_0xdf1b('0x6')](),auth[_0xdf1b('0x3')](),controller[_0xdf1b('0x7')]);router[_0xdf1b('0x2')](_0xdf1b('0x8'),auth[_0xdf1b('0x6')](),auth[_0xdf1b('0x3')](),controller[_0xdf1b('0x9')]);router[_0xdf1b('0x2')](_0xdf1b('0xa'),auth[_0xdf1b('0x6')](),controller[_0xdf1b('0xb')]);router[_0xdf1b('0x2')]('/migrations',controller[_0xdf1b('0xc')]);module[_0xdf1b('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 2410331..514f03a 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 _0x1427=['FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','migrations','server','length','replace','.js','push','sequelize','Migration','constructor','join','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard'];(function(_0x294b54,_0x10f3d7){var _0x53d4be=function(_0x5a144f){while(--_0x5a144f){_0x294b54['push'](_0x294b54['shift']());}};_0x53d4be(++_0x10f3d7);}(_0x1427,0xe6));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var Umzug=require(_0x7142('0x0'));var path=require(_0x7142('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x7142('0x2'));var compareVersions=require(_0x7142('0x3'));var exec=require(_0x7142('0x4'))[_0x7142('0x5')];var db=require(_0x7142('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x7142('0x7'));var logger=require(_0x7142('0x8'))(_0x7142('0x9'));var git=require('simple-git')(config[_0x7142('0xa')]);exports[_0x7142('0xb')]=function(_0x513c71,_0x48d1fc){var _0x5f0a67={'current':module[_0x7142('0xc')][_0x7142('0x2')],'phonebar':0x2};if(_0x513c71[_0x7142('0xd')]&&_0x513c71[_0x7142('0xd')][_0x7142('0xe')]){return git[_0x7142('0xf')]()['tags'](function(_0x1c4bf0,_0x175ecf){_0x5f0a67[_0x7142('0xe')]=(_0x1c4bf0?module[_0x7142('0xc')]['version']:_0x175ecf[_0x7142('0xe')])||_0x7142('0x10');return _0x48d1fc[_0x7142('0x11')](0xc8)['json'](_0x5f0a67);});}else{return _0x48d1fc[_0x7142('0x11')](0xc8)[_0x7142('0x12')](_0x5f0a67);}};exports[_0x7142('0xf')]=function(_0x321791,_0x1d77e1){return git[_0x7142('0xf')]([_0x7142('0x13'),_0x7142('0x14')],function(_0x3ea72c){if(_0x3ea72c){logger[_0x7142('0x15')](_0x3ea72c);return _0x1d77e1[_0x7142('0x11')](0x1f4)[_0x7142('0x12')](_0x3ea72c);}logger['info']('git\x20fetch');return _0x1d77e1['status'](0xc8)[_0x7142('0x12')]({'output':_0x7142('0x16')});});};exports[_0x7142('0x17')]=function(_0x14da88,_0x3f83fb){return git['reset']([_0x7142('0x18'),_0x7142('0x19')],function(_0x3c0ed3){if(_0x3c0ed3){logger[_0x7142('0x15')](_0x3c0ed3);return _0x3f83fb[_0x7142('0x11')](0x1f4)['json'](_0x3c0ed3);}logger[_0x7142('0x1a')](_0x7142('0x1b'));return _0x3f83fb[_0x7142('0x11')](0xc8)['json']({'output':_0x7142('0x1c')});});};exports[_0x7142('0x1d')]=function(_0x2ae6c,_0x5c58ce){exec(_0x7142('0x1e'),function(_0x348ecf,_0x466513,_0x561e79){logger[_0x7142('0x1a')](_0x466513);logger[_0x7142('0x1a')](_0x561e79);if(_0x348ecf){logger['error'](_0x348ecf);return _0x5c58ce[_0x7142('0x11')](0x1f4)[_0x7142('0x12')](_0x348ecf);}return _0x5c58ce[_0x7142('0x11')](0xc8)['json']({'output':_0x466513});});};exports[_0x7142('0x1f')]=function(_0x30b28f,_0x536361){return pm2[_0x7142('0x1f')](_0x7142('0x20'))['then'](function(_0x164a03){logger[_0x7142('0x1a')](_0x7142('0x21'),_0x164a03);return _0x536361[_0x7142('0x11')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0xe4edd3){logger[_0x7142('0x15')](_0xe4edd3);return _0x536361['status'](0x1f4)[_0x7142('0x12')](_0xe4edd3);});};exports[_0x7142('0x22')]=function(_0x4c674d,_0x3207ac){var _0x50fd4a=fs['readdirSync'](path['join'](config[_0x7142('0xa')],_0x7142('0x23'),_0x7142('0x22')));var _0x5c25f7=[];for(var _0xbc5d9d=0x0;_0xbc5d9d<_0x50fd4a[_0x7142('0x24')];_0xbc5d9d++){var _0xb5efd3=_0x50fd4a[_0xbc5d9d][_0x7142('0x25')](_0x7142('0x26'),'');if(compareVersions(module['exports'][_0x7142('0x2')],_0xb5efd3)===-0x1){_0x5c25f7[_0x7142('0x27')](_0xb5efd3);}}if(_0x5c25f7['length']){var _0x411523=_0x5c25f7['sort'](compareVersions);var _0x4d3a9a=new Umzug({'storage':_0x7142('0x28'),'storageOptions':{'model':db['Migration'],'modelName':_0x7142('0x29'),'columnName':_0x7142('0x2')},'migrations':{'params':[db[_0x7142('0x28')]['getQueryInterface'](),db[_0x7142('0x28')][_0x7142('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[_0x7142('0x2b')](config[_0x7142('0xa')],_0x7142('0x23'),'migrations'),'pattern':/\.js$/}});_0x4d3a9a['up']({'migrations':_[_0x7142('0x2c')](_0x411523,function(_0x5817b6){return _0x5817b6+_0x7142('0x26');})})[_0x7142('0x2d')](function(){return _0x3207ac['status'](0xc8)[_0x7142('0x12')]({'output':_0x7142('0x2e')+module['exports'][_0x7142('0x2')]+_0x7142('0x2f')+_[_0x7142('0x30')](_0x411523),'migrations':_['join'](_0x411523)});})['catch'](function(_0x576bc0){if(_0x576bc0 instanceof db['sequelize'][_0x7142('0x31')]){return _0x3207ac[_0x7142('0x11')](0xc8)[_0x7142('0x12')]({'output':_0x7142('0x32')});}else{return _0x3207ac[_0x7142('0x11')](0x1f4)['json'](_0x576bc0);}});}else{return _0x3207ac['status'](0xc8)['json']({'output':_0x7142('0x32')});}}; \ No newline at end of file +var _0xa939=['sequelize','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','length','replace','.js','push','sort','Migration'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0xa939,0x189));var _0x9a93=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xa939[_0x424a9a];return _0xa7831c;};'use strict';var Umzug=require(_0x9a93('0x0'));var path=require(_0x9a93('0x1'));var fs=require('fs');var _=require(_0x9a93('0x2'));var pkginfo=require(_0x9a93('0x3'))(module,_0x9a93('0x4'));var compareVersions=require(_0x9a93('0x5'));var exec=require('child_process')[_0x9a93('0x6')];var db=require(_0x9a93('0x7'))['db'];var config=require(_0x9a93('0x8'));var pm2=require(_0x9a93('0x9'));var logger=require(_0x9a93('0xa'))(_0x9a93('0xb'));var git=require(_0x9a93('0xc'))(config[_0x9a93('0xd')]);exports['index']=function(_0x31991c,_0x3986d4){var _0x4d64a7={'current':module[_0x9a93('0xe')][_0x9a93('0x4')],'phonebar':0x2};if(_0x31991c[_0x9a93('0xf')]&&_0x31991c['query']['latest']){return git[_0x9a93('0x10')]()[_0x9a93('0x11')](function(_0x5ee371,_0x31ac70){_0x4d64a7[_0x9a93('0x12')]=(_0x5ee371?module[_0x9a93('0xe')][_0x9a93('0x4')]:_0x31ac70['latest'])||_0x9a93('0x13');return _0x3986d4[_0x9a93('0x14')](0xc8)[_0x9a93('0x15')](_0x4d64a7);});}else{return _0x3986d4['status'](0xc8)[_0x9a93('0x15')](_0x4d64a7);}};exports[_0x9a93('0x10')]=function(_0x507dfd,_0x50bf25){return git['fetch']([_0x9a93('0x16'),_0x9a93('0x17')],function(_0x71560c){if(_0x71560c){logger[_0x9a93('0x18')](_0x71560c);return _0x50bf25[_0x9a93('0x14')](0x1f4)[_0x9a93('0x15')](_0x71560c);}logger[_0x9a93('0x19')](_0x9a93('0x1a'));return _0x50bf25[_0x9a93('0x14')](0xc8)[_0x9a93('0x15')]({'output':_0x9a93('0x1b')});});};exports['reset']=function(_0x535f9f,_0x8e7ca6){return git[_0x9a93('0x1c')]([_0x9a93('0x1d'),'FETCH_HEAD'],function(_0x171b4d){if(_0x171b4d){logger[_0x9a93('0x18')](_0x171b4d);return _0x8e7ca6[_0x9a93('0x14')](0x1f4)[_0x9a93('0x15')](_0x171b4d);}logger['info'](_0x9a93('0x1e'));return _0x8e7ca6['status'](0xc8)[_0x9a93('0x15')]({'output':_0x9a93('0x1f')});});};exports['pull']=function(_0x207961,_0x4d241e){exec(_0x9a93('0x20'),function(_0x10702f,_0x1984f1,_0x240c25){logger[_0x9a93('0x19')](_0x1984f1);logger['info'](_0x240c25);if(_0x10702f){logger[_0x9a93('0x18')](_0x10702f);return _0x4d241e['status'](0x1f4)[_0x9a93('0x15')](_0x10702f);}return _0x4d241e[_0x9a93('0x14')](0xc8)[_0x9a93('0x15')]({'output':_0x1984f1});});};exports[_0x9a93('0x21')]=function(_0x359d19,_0x36e2b4){return pm2['restart'](_0x9a93('0x22'))[_0x9a93('0x23')](function(_0x20691e){logger[_0x9a93('0x19')](_0x9a93('0x24'),_0x20691e);return _0x36e2b4[_0x9a93('0x14')](0xc8)[_0x9a93('0x15')]({'output':_0x9a93('0x25')});})['catch'](function(_0x4acd05){logger['error'](_0x4acd05);return _0x36e2b4[_0x9a93('0x14')](0x1f4)[_0x9a93('0x15')](_0x4acd05);});};exports[_0x9a93('0x26')]=function(_0x22ec6d,_0xfbde4c){var _0x1d2b16=fs['readdirSync'](path[_0x9a93('0x27')](config['root'],_0x9a93('0x28'),_0x9a93('0x26')));var _0xf71081=[];for(var _0x539891=0x0;_0x539891<_0x1d2b16[_0x9a93('0x29')];_0x539891++){var _0x502d0d=_0x1d2b16[_0x539891][_0x9a93('0x2a')](_0x9a93('0x2b'),'');if(compareVersions(module['exports'][_0x9a93('0x4')],_0x502d0d)===-0x1){_0xf71081[_0x9a93('0x2c')](_0x502d0d);}}if(_0xf71081[_0x9a93('0x29')]){var _0x3c428a=_0xf71081[_0x9a93('0x2d')](compareVersions);var _0xa1800f=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x9a93('0x2e'),'columnName':_0x9a93('0x4')},'migrations':{'params':[db[_0x9a93('0x2f')][_0x9a93('0x30')](),db[_0x9a93('0x2f')][_0x9a93('0x31')],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[_0x9a93('0x27')](config[_0x9a93('0xd')],_0x9a93('0x28'),'migrations'),'pattern':/\.js$/}});_0xa1800f['up']({'migrations':_[_0x9a93('0x32')](_0x3c428a,function(_0x11ca57){return _0x11ca57+_0x9a93('0x2b');})})['then'](function(){return _0xfbde4c[_0x9a93('0x14')](0xc8)['json']({'output':_0x9a93('0x33')+module['exports'][_0x9a93('0x4')]+'\x20to\x20'+_['last'](_0x3c428a),'migrations':_[_0x9a93('0x27')](_0x3c428a)});})[_0x9a93('0x34')](function(_0x590d55){if(_0x590d55 instanceof db[_0x9a93('0x2f')][_0x9a93('0x35')]){return _0xfbde4c['status'](0xc8)[_0x9a93('0x15')]({'output':_0x9a93('0x36')});}else{return _0xfbde4c[_0x9a93('0x14')](0x1f4)[_0x9a93('0x15')](_0x590d55);}});}else{return _0xfbde4c[_0x9a93('0x14')](0xc8)[_0x9a93('0x15')]({'output':_0x9a93('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index fd27397..a1f4175 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 _0x5ded=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceAgentReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','put','update'];(function(_0x3e8a9a,_0x30c6f9){var _0x24fa95=function(_0x2a28f6){while(--_0x2a28f6){_0x3e8a9a['push'](_0x3e8a9a['shift']());}};_0x24fa95(++_0x30c6f9);}(_0x5ded,0x67));var _0xd5de=function(_0x1ea403,_0x2d3711){_0x1ea403=_0x1ea403-0x0;var _0x1ade2e=_0x5ded[_0x1ea403];return _0x1ade2e;};'use strict';var multer=require(_0xd5de('0x0'));var util=require(_0xd5de('0x1'));var path=require(_0xd5de('0x2'));var timeout=require(_0xd5de('0x3'));var express=require(_0xd5de('0x4'));var router=express[_0xd5de('0x5')]();var fs_extra=require(_0xd5de('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd5de('0x7'));router[_0xd5de('0x8')]('/',auth['isAuthenticated'](),controller[_0xd5de('0x9')]);router['get'](_0xd5de('0xa'),auth['isAuthenticated'](),controller[_0xd5de('0xb')]);router['get'](_0xd5de('0xc'),auth[_0xd5de('0xd')](),controller[_0xd5de('0xe')]);router['post']('/',auth[_0xd5de('0xd')](),controller['create']);router[_0xd5de('0xf')]('/:id',auth[_0xd5de('0xd')](),controller[_0xd5de('0x10')]);router[_0xd5de('0x11')](_0xd5de('0xc'),auth[_0xd5de('0xd')](),controller[_0xd5de('0x12')]);module[_0xd5de('0x13')]=router; \ No newline at end of file +var _0x38f4=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x38f4,0x14a));var _0x438f=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0x38f4[_0x269c42];return _0x4dad76;};'use strict';var multer=require(_0x438f('0x0'));var util=require(_0x438f('0x1'));var path=require('path');var timeout=require(_0x438f('0x2'));var express=require(_0x438f('0x3'));var router=express[_0x438f('0x4')]();var fs_extra=require(_0x438f('0x5'));var auth=require(_0x438f('0x6'));var interaction=require(_0x438f('0x7'));var config=require(_0x438f('0x8'));var controller=require(_0x438f('0x9'));router[_0x438f('0xa')]('/',auth[_0x438f('0xb')](),controller[_0x438f('0xc')]);router[_0x438f('0xa')](_0x438f('0xd'),auth[_0x438f('0xb')](),controller['describe']);router[_0x438f('0xa')](_0x438f('0xe'),auth[_0x438f('0xb')](),controller[_0x438f('0xf')]);router[_0x438f('0x10')]('/',auth['isAuthenticated'](),controller[_0x438f('0x11')]);router[_0x438f('0x12')](_0x438f('0xe'),auth['isAuthenticated'](),controller[_0x438f('0x13')]);router[_0x438f('0x14')]('/:id',auth[_0x438f('0xb')](),controller[_0x438f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 36059ff..7a797ea 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 _0x531a=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x34e300,_0x392cfd){var _0x14cc09=function(_0x40f9d9){while(--_0x40f9d9){_0x34e300['push'](_0x34e300['shift']());}};_0x14cc09(++_0x392cfd);}(_0x531a,0x100));var _0xa531=function(_0x1c6476,_0x438e0e){_0x1c6476=_0x1c6476-0x0;var _0x9b7648=_0x531a[_0x1c6476];return _0x9b7648;};'use strict';var Sequelize=require(_0xa531('0x0'));module[_0xa531('0x1')]={'type':{'type':Sequelize[_0xa531('0x2')]},'uniqueid':{'type':Sequelize[_0xa531('0x2')]},'calleridnum':{'type':Sequelize[_0xa531('0x2')]},'calleridname':{'type':Sequelize[_0xa531('0x2')]},'queue':{'type':Sequelize[_0xa531('0x2')]},'interface':{'type':Sequelize[_0xa531('0x2')]},'membername':{'type':Sequelize[_0xa531('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa531('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xa531('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xa531('0x3')]},'holdtime':{'type':Sequelize[_0xa531('0x4')]},'agentcomplete':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa531('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xa531('0x2')]},'channel':{'type':Sequelize[_0xa531('0x2')]},'channelstate':{'type':Sequelize[_0xa531('0x4')]},'channelstatedesc':{'type':Sequelize[_0xa531('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa531('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa531('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa531('0x2')]},'exten':{'type':Sequelize[_0xa531('0x2')]},'priority':{'type':Sequelize[_0xa531('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa531('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xa531('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa531('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa531('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xa531('0x2')]},'destaccountcode':{'type':Sequelize[_0xa531('0x2')]},'destcontext':{'type':Sequelize[_0xa531('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa531('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa531('0x2')]},'transfer':{'type':Sequelize[_0xa531('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa531('0x2')],'comment':_0xa531('0x6')},'transferexten':{'type':Sequelize[_0xa531('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa531('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x937d=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','BOOLEAN'];(function(_0x114df6,_0x1c3a32){var _0x2263af=function(_0x22907a){while(--_0x22907a){_0x114df6['push'](_0x114df6['shift']());}};_0x2263af(++_0x1c3a32);}(_0x937d,0x1f4));var _0xd937=function(_0x307fee,_0x297642){_0x307fee=_0x307fee-0x0;var _0x3c7ced=_0x937d[_0x307fee];return _0x3c7ced;};'use strict';var Sequelize=require(_0xd937('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd937('0x1')]},'calleridname':{'type':Sequelize[_0xd937('0x1')]},'queue':{'type':Sequelize[_0xd937('0x1')]},'interface':{'type':Sequelize[_0xd937('0x1')]},'membername':{'type':Sequelize[_0xd937('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd937('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xd937('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd937('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd937('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd937('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd937('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd937('0x4')]},'agentacw':{'type':Sequelize[_0xd937('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd937('0x4')]},'reason':{'type':Sequelize[_0xd937('0x1')]},'lastevent':{'type':Sequelize[_0xd937('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd937('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd937('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd937('0x1')]},'accountcode':{'type':Sequelize[_0xd937('0x1')]},'context':{'type':Sequelize[_0xd937('0x1')]},'exten':{'type':Sequelize[_0xd937('0x1')]},'priority':{'type':Sequelize[_0xd937('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd937('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd937('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd937('0x1')]},'destcalleridname':{'type':Sequelize[_0xd937('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd937('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd937('0x1')]},'destlanguage':{'type':Sequelize[_0xd937('0x1')]},'destaccountcode':{'type':Sequelize[_0xd937('0x1')]},'destcontext':{'type':Sequelize[_0xd937('0x1')]},'destexten':{'type':Sequelize[_0xd937('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd937('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd937('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd937('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd937('0x1')],'comment':_0xd937('0x5')},'transferexten':{'type':Sequelize[_0xd937('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xd937('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 281a04a..c85244c 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(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 f2b9de1..04e4446 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 _0x1a61=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a61,0x1e6));var _0x11a6=function(_0x3c84d1,_0x4b899a){_0x3c84d1=_0x3c84d1-0x0;var _0x245543=_0x1a61[_0x3c84d1];return _0x245543;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var logger=require(_0x11a6('0x1'))('api');var moment=require(_0x11a6('0x2'));var BPromise=require(_0x11a6('0x3'));var rp=require(_0x11a6('0x4'));var fs=require('fs');var path=require(_0x11a6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x11a6('0x6'));module[_0x11a6('0x7')]=function(_0x5b72a1,_0x41e03d){return _0x5b72a1[_0x11a6('0x8')](_0x11a6('0x9'),attributes,{'tableName':_0x11a6('0xa'),'paranoid':![],'indexes':[{'fields':[_0x11a6('0xb'),_0x11a6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f4d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid'];(function(_0x281a8a,_0x16bcba){var _0x43539c=function(_0x41cc4b){while(--_0x41cc4b){_0x281a8a['push'](_0x281a8a['shift']());}};_0x43539c(++_0x16bcba);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x11b42b,_0x17854d){_0x11b42b=_0x11b42b-0x0;var _0x2868a2=_0x0f4d[_0x11b42b];return _0x2868a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xd0f4('0xa'),_0xd0f4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 81a89d6..e6ef48e 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 _0x0120=['create','body','options','raw','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message'];(function(_0x5728e5,_0x20bd30){var _0x4062b6=function(_0x3b69f1){while(--_0x3b69f1){_0x5728e5['push'](_0x5728e5['shift']());}};_0x4062b6(++_0x20bd30);}(_0x0120,0x75));var _0x0012=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0120[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0012('0x0'));var moment=require(_0x0012('0x1'));var BPromise=require(_0x0012('0x2'));var rs=require(_0x0012('0x3'));var fs=require('fs');var Redis=require(_0x0012('0x4'));var db=require(_0x0012('0x5'))['db'];var utils=require(_0x0012('0x6'));var logger=require(_0x0012('0x7'))(_0x0012('0x8'));var config=require(_0x0012('0x9'));var jayson=require(_0x0012('0xa'));var client=jayson['client'][_0x0012('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d87a,_0x34f9f2,_0x453bcf){return new BPromise(function(_0x222742,_0xda89f1){return client[_0x0012('0xc')](_0x32d87a,_0x453bcf)[_0x0012('0xd')](function(_0x30523b){logger[_0x0012('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x34f9f2,_0x0012('0xf'));logger[_0x0012('0x10')](_0x0012('0x11'),_0x34f9f2,_0x0012('0xf'),JSON[_0x0012('0x12')](_0x30523b));if(_0x30523b[_0x0012('0x13')]){if(_0x30523b[_0x0012('0x13')][_0x0012('0x14')]===0x1f4){logger['error'](_0x0012('0x15'),_0x34f9f2,_0x30523b[_0x0012('0x13')][_0x0012('0x16')]);return _0xda89f1(_0x30523b[_0x0012('0x13')][_0x0012('0x16')]);}logger[_0x0012('0x13')](_0x0012('0x15'),_0x34f9f2,_0x30523b[_0x0012('0x13')]['message']);return _0x222742(_0x30523b['error'][_0x0012('0x16')]);}else{logger[_0x0012('0xe')](_0x0012('0x15'),_0x34f9f2,_0x0012('0xf'));_0x222742(_0x30523b['result'][_0x0012('0x16')]);}})['catch'](function(_0x573e3d){logger[_0x0012('0x13')](_0x0012('0x15'),_0x34f9f2,_0x573e3d);_0xda89f1(_0x573e3d);});});}exports['CreateVoiceAgentReport']=function(_0x6b9313){var _0xafbaac=this;return new Promise(function(_0x50d750,_0x57834c){return db['VoiceAgentReport'][_0x0012('0x17')](_0x6b9313[_0x0012('0x18')],{'raw':_0x6b9313[_0x0012('0x19')]?_0x6b9313[_0x0012('0x19')][_0x0012('0x1a')]===undefined?!![]:![]:!![]})[_0x0012('0xd')](function(_0x30fad9){logger[_0x0012('0xe')](_0x0012('0x1b'),_0x6b9313);logger[_0x0012('0x10')]('CreateVoiceAgentReport',_0x6b9313,JSON[_0x0012('0x12')](_0x30fad9));_0x50d750(_0x30fad9);})[_0x0012('0x1c')](function(_0x5585df){logger[_0x0012('0x13')](_0x0012('0x1b'),_0x5585df[_0x0012('0x16')],_0x6b9313);_0x57834c(_0xafbaac['error'](0x1f4,_0x5585df[_0x0012('0x16')]));});});};exports[_0x0012('0x1d')]=function(_0x5950a3){var _0xb5c29d=this;return new Promise(function(_0x293770,_0x413bc4){return db[_0x0012('0x1e')][_0x0012('0x1f')](_0x5950a3[_0x0012('0x18')],{'raw':_0x5950a3[_0x0012('0x19')]?_0x5950a3[_0x0012('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5950a3['options']?_0x5950a3[_0x0012('0x19')][_0x0012('0x20')]||null:null,'attributes':_0x5950a3[_0x0012('0x19')]?_0x5950a3[_0x0012('0x19')][_0x0012('0x21')]||null:null,'limit':_0x5950a3[_0x0012('0x19')]?_0x5950a3[_0x0012('0x19')][_0x0012('0x22')]||null:null})[_0x0012('0xd')](function(_0x277931){logger[_0x0012('0xe')](_0x0012('0x1d'),_0x5950a3);logger[_0x0012('0x10')](_0x0012('0x1d'),_0x5950a3,JSON['stringify'](_0x277931));_0x293770(_0x277931);})[_0x0012('0x1c')](function(_0x171bc3){logger[_0x0012('0x13')](_0x0012('0x1d'),_0x171bc3[_0x0012('0x16')],_0x5950a3);_0x413bc4(_0xb5c29d[_0x0012('0x13')](0x1f4,_0x171bc3[_0x0012('0x16')]));});});}; \ No newline at end of file +var _0x7924=['request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','create','body','options','raw','then','CreateVoiceAgentReport','catch','message','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7924,0x1e2));var _0x4792=function(_0x14c00f,_0x11b192){_0x14c00f=_0x14c00f-0x0;var _0x19fbda=_0x7924[_0x14c00f];return _0x19fbda;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4792('0x0'));var BPromise=require('bluebird');var rs=require(_0x4792('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4792('0x2'))['db'];var utils=require(_0x4792('0x3'));var logger=require(_0x4792('0x4'))('rpc');var config=require(_0x4792('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4792('0x6')][_0x4792('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2be080,_0x11d942,_0x32b9a1){return new BPromise(function(_0x424a83,_0x3d8c4b){return client[_0x4792('0x8')](_0x2be080,_0x32b9a1)['then'](function(_0xf3d185){logger[_0x4792('0x9')](_0x4792('0xa'),_0x11d942,_0x4792('0xb'));logger[_0x4792('0xc')](_0x4792('0xd'),_0x11d942,'request\x20sent',JSON[_0x4792('0xe')](_0xf3d185));if(_0xf3d185[_0x4792('0xf')]){if(_0xf3d185['error']['code']===0x1f4){logger['error'](_0x4792('0xa'),_0x11d942,_0xf3d185[_0x4792('0xf')]['message']);return _0x3d8c4b(_0xf3d185[_0x4792('0xf')]['message']);}logger['error'](_0x4792('0xa'),_0x11d942,_0xf3d185[_0x4792('0xf')]['message']);return _0x424a83(_0xf3d185[_0x4792('0xf')]['message']);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x11d942,_0x4792('0xb'));_0x424a83(_0xf3d185['result']['message']);}})['catch'](function(_0x16c9b2){logger[_0x4792('0xf')](_0x4792('0xa'),_0x11d942,_0x16c9b2);_0x3d8c4b(_0x16c9b2);});});}exports['CreateVoiceAgentReport']=function(_0x310af2){var _0x2bd577=this;return new Promise(function(_0x3d343d,_0x2b7d49){return db['VoiceAgentReport'][_0x4792('0x10')](_0x310af2[_0x4792('0x11')],{'raw':_0x310af2[_0x4792('0x12')]?_0x310af2[_0x4792('0x12')][_0x4792('0x13')]===undefined?!![]:![]:!![]})[_0x4792('0x14')](function(_0x3fc8f8){logger['info'](_0x4792('0x15'),_0x310af2);logger['debug']('CreateVoiceAgentReport',_0x310af2,JSON[_0x4792('0xe')](_0x3fc8f8));_0x3d343d(_0x3fc8f8);})[_0x4792('0x16')](function(_0x36868d){logger[_0x4792('0xf')]('CreateVoiceAgentReport',_0x36868d[_0x4792('0x17')],_0x310af2);_0x2b7d49(_0x2bd577[_0x4792('0xf')](0x1f4,_0x36868d[_0x4792('0x17')]));});});};exports[_0x4792('0x18')]=function(_0x17b43d){var _0x553579=this;return new Promise(function(_0x18340b,_0x128cca){return db[_0x4792('0x19')][_0x4792('0x1a')](_0x17b43d[_0x4792('0x11')],{'raw':_0x17b43d[_0x4792('0x12')]?_0x17b43d[_0x4792('0x12')][_0x4792('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17b43d['options']?_0x17b43d[_0x4792('0x12')][_0x4792('0x1b')]||null:null,'attributes':_0x17b43d[_0x4792('0x12')]?_0x17b43d[_0x4792('0x12')][_0x4792('0x1c')]||null:null,'limit':_0x17b43d[_0x4792('0x12')]?_0x17b43d['options']['limit']||null:null})[_0x4792('0x14')](function(_0x140422){logger[_0x4792('0x9')](_0x4792('0x18'),_0x17b43d);logger[_0x4792('0xc')](_0x4792('0x18'),_0x17b43d,JSON[_0x4792('0xe')](_0x140422));_0x18340b(_0x140422);})[_0x4792('0x16')](function(_0x4e0d2a){logger[_0x4792('0xf')]('UpdateVoiceAgentReport',_0x4e0d2a[_0x4792('0x17')],_0x17b43d);_0x128cca(_0x553579[_0x4792('0xf')](0x1f4,_0x4e0d2a[_0x4792('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 52b8042..44a0b09 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 _0x5075=['get','isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index'];(function(_0x107f06,_0x133fc4){var _0x235fea=function(_0x466821){while(--_0x466821){_0x107f06['push'](_0x107f06['shift']());}};_0x235fea(++_0x133fc4);}(_0x5075,0x73));var _0x5507=function(_0x57111f,_0x2a7bde){_0x57111f=_0x57111f-0x0;var _0xe10f6f=_0x5075[_0x57111f];return _0xe10f6f;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5507('0xa')]);router[_0x5507('0xb')]('/describe',auth[_0x5507('0xc')](),controller[_0x5507('0xd')]);router[_0x5507('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')]('/',auth[_0x5507('0xc')](),controller[_0x5507('0x10')]);router['put'](_0x5507('0x11'),auth[_0x5507('0xc')](),controller['update']);router[_0x5507('0x12')](_0x5507('0x11'),auth['isAuthenticated'](),controller[_0x5507('0x13')]);module[_0x5507('0x14')]=router; \ No newline at end of file +var _0x57d4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x57d4,0x78));var _0x457d=function(_0x3a5ddf,_0x30f796){_0x3a5ddf=_0x3a5ddf-0x0;var _0x319dac=_0x57d4[_0x3a5ddf];return _0x319dac;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var fs_extra=require(_0x457d('0x5'));var auth=require(_0x457d('0x6'));var interaction=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var controller=require(_0x457d('0x9'));router[_0x457d('0xa')]('/',auth[_0x457d('0xb')](),controller[_0x457d('0xc')]);router['get'](_0x457d('0xd'),auth[_0x457d('0xb')](),controller['describe']);router['get'](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x457d('0x10')](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0x11')]);router[_0x457d('0x12')](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0x13')]);module[_0x457d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 10819d5..052950a 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 _0x2deb=['exports','STRING','ENUM','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x5442a5,_0x4110f1){var _0x130af0=function(_0x457ec2){while(--_0x457ec2){_0x5442a5['push'](_0x5442a5['shift']());}};_0x130af0(++_0x4110f1);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb2de('0x0'));module[_0xb2de('0x1')]={'uniqueid':{'type':Sequelize[_0xb2de('0x2')]},'type':{'type':Sequelize[_0xb2de('0x3')]('inbound','internal',_0xb2de('0x4'),_0xb2de('0x5'),_0xb2de('0x6'),_0xb2de('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xb2de('0x2')]},'destination':{'type':Sequelize[_0xb2de('0x2')]},'destinationcontext':{'type':Sequelize[_0xb2de('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb2de('0x2')]},'destinationchannel':{'type':Sequelize[_0xb2de('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb2de('0x8')]},'starttime':{'type':Sequelize[_0xb2de('0x9')]},'systemanswertime':{'type':Sequelize[_0xb2de('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb2de('0x9')]},'duration':{'type':Sequelize[_0xb2de('0xa')]},'billableseconds':{'type':Sequelize[_0xb2de('0xa')]},'mohtime':{'type':Sequelize[_0xb2de('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xb2de('0x2')]},'userDisposition':{'type':Sequelize[_0xb2de('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xb2de('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb2de('0x2')]},'prefix':{'type':Sequelize[_0xb2de('0x2')]},'routeid':{'type':Sequelize[_0xb2de('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd56e=['DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer','TEXT'];(function(_0x46d057,_0xf0002f){var _0x52b4c3=function(_0x80d1b6){while(--_0x80d1b6){_0x46d057['push'](_0x46d057['shift']());}};_0x52b4c3(++_0xf0002f);}(_0xd56e,0xa7));var _0xed56=function(_0x580146,_0x423a66){_0x580146=_0x580146-0x0;var _0x4c9fd3=_0xd56e[_0x580146];return _0x4c9fd3;};'use strict';var Sequelize=require('sequelize');module[_0xed56('0x0')]={'uniqueid':{'type':Sequelize[_0xed56('0x1')]},'type':{'type':Sequelize[_0xed56('0x2')](_0xed56('0x3'),_0xed56('0x4'),_0xed56('0x5'),_0xed56('0x6'),'outbound-fax',_0xed56('0x7'))},'tag':{'type':Sequelize[_0xed56('0x1')]},'accountcode':{'type':Sequelize[_0xed56('0x1')]},'source':{'type':Sequelize[_0xed56('0x1')]},'destination':{'type':Sequelize[_0xed56('0x1')]},'destinationcontext':{'type':Sequelize[_0xed56('0x1')]},'callerid':{'type':Sequelize[_0xed56('0x1')]},'channel':{'type':Sequelize[_0xed56('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xed56('0x1')]},'lastdata':{'type':Sequelize[_0xed56('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xed56('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xed56('0xa')]},'mohtime':{'type':Sequelize[_0xed56('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xed56('0x1')]},'amaflags':{'type':Sequelize[_0xed56('0x1')]},'userfield':{'type':Sequelize[_0xed56('0x1')]},'userDisposition':{'type':Sequelize[_0xed56('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xed56('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xed56('0x1')]},'note':{'type':Sequelize[_0xed56('0x1')]},'prefix':{'type':Sequelize[_0xed56('0x1')]},'routeid':{'type':Sequelize[_0xed56('0xa')]},'sipcallid':{'type':Sequelize[_0xed56('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index cfe6722..6970535 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x1d0fc6,_0x58fda7){_0x1d0fc6=_0x1d0fc6-0x0;var _0x5c8f93=_0x2032[_0x1d0fc6];return _0x5c8f93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x58084d,_0x958443){_0x58084d=_0x58084d-0x0;var _0x3fc00e=_0x2032[_0x58084d];return _0x3fc00e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 52fcd6c..5a5bd1b 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 _0x4934=['define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports'];(function(_0x556bc0,_0x5825e7){var _0x365e37=function(_0x429a4c){while(--_0x429a4c){_0x556bc0['push'](_0x556bc0['shift']());}};_0x365e37(++_0x5825e7);}(_0x4934,0x162));var _0x4493=function(_0x30e30a,_0xbf0a9b){_0x30e30a=_0x30e30a-0x0;var _0x18c9d9=_0x4934[_0x30e30a];return _0x18c9d9;};'use strict';var _=require(_0x4493('0x0'));var util=require(_0x4493('0x1'));var logger=require(_0x4493('0x2'))(_0x4493('0x3'));var moment=require('moment');var BPromise=require(_0x4493('0x4'));var rp=require(_0x4493('0x5'));var fs=require('fs');var path=require(_0x4493('0x6'));var rimraf=require(_0x4493('0x7'));var config=require('../../config/environment');var attributes=require(_0x4493('0x8'));module[_0x4493('0x9')]=function(_0x3281cd,_0x4371b5){return _0x3281cd[_0x4493('0xa')](_0x4493('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4493('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8954=['api','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger'];(function(_0x5b86f2,_0x133550){var _0x3413ee=function(_0x28c39a){while(--_0x28c39a){_0x5b86f2['push'](_0x5b86f2['shift']());}};_0x3413ee(++_0x133550);}(_0x8954,0x136));var _0x4895=function(_0x4fc228,_0x3c0424){_0x4fc228=_0x4fc228-0x0;var _0x3f1dd6=_0x8954[_0x4fc228];return _0x3f1dd6;};'use strict';var _=require(_0x4895('0x0'));var util=require('util');var logger=require(_0x4895('0x1'))(_0x4895('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4895('0x3'));var rimraf=require(_0x4895('0x4'));var config=require(_0x4895('0x5'));var attributes=require(_0x4895('0x6'));module[_0x4895('0x7')]=function(_0x48cbde,_0x179f79){return _0x48cbde[_0x4895('0x8')](_0x4895('0x9'),attributes,{'tableName':_0x4895('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4895('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 1efae33..29214dd 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 _0x1d2e=['request\x20sent','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceCallReport','CreateVoiceCallReport','create','then','UpdateVoiceCallReport','update','body','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x443bdf,_0x2dea9c){var _0x2d1684=function(_0x3b361c){while(--_0x3b361c){_0x443bdf['push'](_0x443bdf['shift']());}};_0x2d1684(++_0x2dea9c);}(_0x1d2e,0xdd));var _0xe1d2=function(_0x53166a,_0x43b2d3){_0x53166a=_0x53166a-0x0;var _0x2676c5=_0x1d2e[_0x53166a];return _0x2676c5;};'use strict';var _=require('lodash');var util=require(_0xe1d2('0x0'));var moment=require(_0xe1d2('0x1'));var BPromise=require(_0xe1d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1d2('0x3'));var db=require(_0xe1d2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1d2('0x5'))(_0xe1d2('0x6'));var config=require(_0xe1d2('0x7'));var jayson=require(_0xe1d2('0x8'));var client=jayson[_0xe1d2('0x9')][_0xe1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x545401,_0x23c611,_0x309cc5){return new BPromise(function(_0x3afc36,_0x5b7174){return client[_0xe1d2('0xb')](_0x545401,_0x309cc5)['then'](function(_0x562bb2){logger[_0xe1d2('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x23c611,_0xe1d2('0xd'));logger[_0xe1d2('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x23c611,_0xe1d2('0xd'),JSON[_0xe1d2('0xf')](_0x562bb2));if(_0x562bb2['error']){if(_0x562bb2[_0xe1d2('0x10')][_0xe1d2('0x11')]===0x1f4){logger['error'](_0xe1d2('0x12'),_0x23c611,_0x562bb2[_0xe1d2('0x10')][_0xe1d2('0x13')]);return _0x5b7174(_0x562bb2[_0xe1d2('0x10')][_0xe1d2('0x13')]);}logger[_0xe1d2('0x10')](_0xe1d2('0x12'),_0x23c611,_0x562bb2[_0xe1d2('0x10')][_0xe1d2('0x13')]);return _0x3afc36(_0x562bb2[_0xe1d2('0x10')][_0xe1d2('0x13')]);}else{logger[_0xe1d2('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x23c611,_0xe1d2('0xd'));_0x3afc36(_0x562bb2[_0xe1d2('0x14')]['message']);}})[_0xe1d2('0x15')](function(_0x83137a){logger[_0xe1d2('0x10')](_0xe1d2('0x12'),_0x23c611,_0x83137a);_0x5b7174(_0x83137a);});});}exports['GetVoiceCallReport']=function(_0x146804){var _0x8fd042=this;return new Promise(function(_0x1117c5,_0x5110f5){return db[_0xe1d2('0x16')][_0xe1d2('0x17')]({'raw':_0x146804[_0xe1d2('0x18')]?_0x146804[_0xe1d2('0x18')][_0xe1d2('0x19')]===undefined?!![]:![]:!![],'where':_0x146804[_0xe1d2('0x18')]?_0x146804[_0xe1d2('0x18')][_0xe1d2('0x1a')]||null:null,'attributes':_0x146804[_0xe1d2('0x18')]?_0x146804[_0xe1d2('0x18')]['attributes']||null:null,'limit':_0x146804[_0xe1d2('0x18')]?_0x146804[_0xe1d2('0x18')][_0xe1d2('0x1b')]||null:null,'include':_0x146804[_0xe1d2('0x18')]?_0x146804[_0xe1d2('0x18')][_0xe1d2('0x1c')]?_[_0xe1d2('0x1d')](_0x146804['options'][_0xe1d2('0x1c')],function(_0x4db1aa){return{'model':db[_0x4db1aa[_0xe1d2('0x1e')]],'as':_0x4db1aa['as'],'attributes':_0x4db1aa['attributes'],'include':_0x4db1aa[_0xe1d2('0x1c')]?_['map'](_0x4db1aa['include'],function(_0x2793d6){return{'model':db[_0x2793d6[_0xe1d2('0x1e')]],'as':_0x2793d6['as'],'attributes':_0x2793d6['attributes'],'include':_0x2793d6[_0xe1d2('0x1c')]?_[_0xe1d2('0x1d')](_0x2793d6[_0xe1d2('0x1c')],function(_0x1ec347){return{'model':db[_0x1ec347[_0xe1d2('0x1e')]],'as':_0x1ec347['as'],'attributes':_0x1ec347[_0xe1d2('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d96e2){logger[_0xe1d2('0xc')]('GetVoiceCallReport',_0x146804);logger[_0xe1d2('0xe')](_0xe1d2('0x20'),_0x146804,JSON[_0xe1d2('0xf')](_0x3d96e2));_0x1117c5(_0x3d96e2);})[_0xe1d2('0x15')](function(_0x6d5ad6){logger[_0xe1d2('0x10')](_0xe1d2('0x20'),_0x6d5ad6[_0xe1d2('0x13')],_0x146804);_0x5110f5(_0x8fd042[_0xe1d2('0x10')](0x1f4,_0x6d5ad6[_0xe1d2('0x13')]));});});};exports[_0xe1d2('0x21')]=function(_0x416cf8){var _0x30488c=this;return new Promise(function(_0x45db91,_0xd48e07){return db['VoiceCallReport'][_0xe1d2('0x22')](_0x416cf8['body'],{'raw':_0x416cf8[_0xe1d2('0x18')]?_0x416cf8['options']['raw']===undefined?!![]:![]:!![]})[_0xe1d2('0x23')](function(_0x33d435){logger[_0xe1d2('0xc')](_0xe1d2('0x21'),_0x416cf8);logger['debug'](_0xe1d2('0x21'),_0x416cf8,JSON[_0xe1d2('0xf')](_0x33d435));_0x45db91(_0x33d435);})[_0xe1d2('0x15')](function(_0x52d819){logger[_0xe1d2('0x10')]('CreateVoiceCallReport',_0x52d819[_0xe1d2('0x13')],_0x416cf8);_0xd48e07(_0x30488c['error'](0x1f4,_0x52d819['message']));});});};exports[_0xe1d2('0x24')]=function(_0x37eceb){var _0x13c9f0=this;return new Promise(function(_0x217fda,_0x574a21){return db[_0xe1d2('0x16')][_0xe1d2('0x25')](_0x37eceb[_0xe1d2('0x26')],{'raw':_0x37eceb[_0xe1d2('0x18')]?_0x37eceb[_0xe1d2('0x18')][_0xe1d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37eceb[_0xe1d2('0x18')]?_0x37eceb[_0xe1d2('0x18')][_0xe1d2('0x1a')]||null:null,'attributes':_0x37eceb[_0xe1d2('0x18')]?_0x37eceb[_0xe1d2('0x18')][_0xe1d2('0x1f')]||null:null,'limit':_0x37eceb[_0xe1d2('0x18')]?_0x37eceb[_0xe1d2('0x18')]['limit']||null:null})[_0xe1d2('0x23')](function(_0x5a6ee2){logger[_0xe1d2('0xc')](_0xe1d2('0x24'),_0x37eceb);logger[_0xe1d2('0xe')](_0xe1d2('0x24'),_0x37eceb,JSON[_0xe1d2('0xf')](_0x5a6ee2));_0x217fda(_0x5a6ee2);})[_0xe1d2('0x15')](function(_0x5ecc95){logger['error'](_0xe1d2('0x24'),_0x5ecc95[_0xe1d2('0x13')],_0x37eceb);_0x574a21(_0x13c9f0[_0xe1d2('0x10')](0x1f4,_0x5ecc95[_0xe1d2('0x13')]));});});}; \ No newline at end of file +var _0xbeb9=['rpc','jayson/promise','client','http','then','info','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','attributes','limit','include','map','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x3d18af,_0x5b4fa0){var _0x2ef919=function(_0x3c26d6){while(--_0x3c26d6){_0x3d18af['push'](_0x3d18af['shift']());}};_0x2ef919(++_0x5b4fa0);}(_0xbeb9,0x83));var _0x9beb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbeb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9beb('0x0'));var util=require(_0x9beb('0x1'));var moment=require('moment');var BPromise=require(_0x9beb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9beb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9beb('0x4'))(_0x9beb('0x5'));var config=require('../../config/environment');var jayson=require(_0x9beb('0x6'));var client=jayson[_0x9beb('0x7')][_0x9beb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ed8ac,_0x449a01,_0xbd59e7){return new BPromise(function(_0x3f0eb3,_0x526c34){return client['request'](_0x2ed8ac,_0xbd59e7)[_0x9beb('0x9')](function(_0x4dfad6){logger[_0x9beb('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x449a01,'request\x20sent');logger[_0x9beb('0xb')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x449a01,'request\x20sent',JSON[_0x9beb('0xc')](_0x4dfad6));if(_0x4dfad6[_0x9beb('0xd')]){if(_0x4dfad6[_0x9beb('0xd')][_0x9beb('0xe')]===0x1f4){logger[_0x9beb('0xd')](_0x9beb('0xf'),_0x449a01,_0x4dfad6[_0x9beb('0xd')]['message']);return _0x526c34(_0x4dfad6[_0x9beb('0xd')]['message']);}logger[_0x9beb('0xd')](_0x9beb('0xf'),_0x449a01,_0x4dfad6[_0x9beb('0xd')][_0x9beb('0x10')]);return _0x3f0eb3(_0x4dfad6['error']['message']);}else{logger['info'](_0x9beb('0xf'),_0x449a01,_0x9beb('0x11'));_0x3f0eb3(_0x4dfad6[_0x9beb('0x12')]['message']);}})[_0x9beb('0x13')](function(_0x390418){logger[_0x9beb('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x449a01,_0x390418);_0x526c34(_0x390418);});});}exports[_0x9beb('0x14')]=function(_0x4de383){var _0x183876=this;return new Promise(function(_0x5a8cd2,_0x1c98a1){return db[_0x9beb('0x15')]['findAll']({'raw':_0x4de383[_0x9beb('0x16')]?_0x4de383[_0x9beb('0x16')][_0x9beb('0x17')]===undefined?!![]:![]:!![],'where':_0x4de383[_0x9beb('0x16')]?_0x4de383[_0x9beb('0x16')]['where']||null:null,'attributes':_0x4de383['options']?_0x4de383[_0x9beb('0x16')][_0x9beb('0x18')]||null:null,'limit':_0x4de383[_0x9beb('0x16')]?_0x4de383[_0x9beb('0x16')][_0x9beb('0x19')]||null:null,'include':_0x4de383[_0x9beb('0x16')]?_0x4de383[_0x9beb('0x16')][_0x9beb('0x1a')]?_[_0x9beb('0x1b')](_0x4de383[_0x9beb('0x16')][_0x9beb('0x1a')],function(_0x10d33f){return{'model':db[_0x10d33f['model']],'as':_0x10d33f['as'],'attributes':_0x10d33f[_0x9beb('0x18')],'include':_0x10d33f[_0x9beb('0x1a')]?_[_0x9beb('0x1b')](_0x10d33f['include'],function(_0x5123ce){return{'model':db[_0x5123ce['model']],'as':_0x5123ce['as'],'attributes':_0x5123ce[_0x9beb('0x18')],'include':_0x5123ce[_0x9beb('0x1a')]?_[_0x9beb('0x1b')](_0x5123ce[_0x9beb('0x1a')],function(_0x45b422){return{'model':db[_0x45b422['model']],'as':_0x45b422['as'],'attributes':_0x45b422[_0x9beb('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12c834){logger['info'](_0x9beb('0x14'),_0x4de383);logger['debug'](_0x9beb('0x14'),_0x4de383,JSON[_0x9beb('0xc')](_0x12c834));_0x5a8cd2(_0x12c834);})['catch'](function(_0x3bfbbc){logger[_0x9beb('0xd')](_0x9beb('0x14'),_0x3bfbbc[_0x9beb('0x10')],_0x4de383);_0x1c98a1(_0x183876[_0x9beb('0xd')](0x1f4,_0x3bfbbc['message']));});});};exports[_0x9beb('0x1c')]=function(_0x380906){var _0x527d84=this;return new Promise(function(_0x5896cc,_0x2b6e22){return db['VoiceCallReport'][_0x9beb('0x1d')](_0x380906[_0x9beb('0x1e')],{'raw':_0x380906[_0x9beb('0x16')]?_0x380906['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53c7f0){logger[_0x9beb('0xa')](_0x9beb('0x1c'),_0x380906);logger[_0x9beb('0xb')]('CreateVoiceCallReport',_0x380906,JSON[_0x9beb('0xc')](_0x53c7f0));_0x5896cc(_0x53c7f0);})['catch'](function(_0x2cdd33){logger[_0x9beb('0xd')](_0x9beb('0x1c'),_0x2cdd33[_0x9beb('0x10')],_0x380906);_0x2b6e22(_0x527d84['error'](0x1f4,_0x2cdd33[_0x9beb('0x10')]));});});};exports[_0x9beb('0x1f')]=function(_0xc9b7f){var _0x5983de=this;return new Promise(function(_0x1d9120,_0x4daf1b){return db[_0x9beb('0x15')][_0x9beb('0x20')](_0xc9b7f[_0x9beb('0x1e')],{'raw':_0xc9b7f[_0x9beb('0x16')]?_0xc9b7f[_0x9beb('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc9b7f[_0x9beb('0x16')]?_0xc9b7f[_0x9beb('0x16')][_0x9beb('0x21')]||null:null,'attributes':_0xc9b7f[_0x9beb('0x16')]?_0xc9b7f['options'][_0x9beb('0x18')]||null:null,'limit':_0xc9b7f[_0x9beb('0x16')]?_0xc9b7f[_0x9beb('0x16')]['limit']||null:null})[_0x9beb('0x9')](function(_0x59e5ca){logger[_0x9beb('0xa')](_0x9beb('0x1f'),_0xc9b7f);logger[_0x9beb('0xb')]('UpdateVoiceCallReport',_0xc9b7f,JSON[_0x9beb('0xc')](_0x59e5ca));_0x1d9120(_0x59e5ca);})[_0x9beb('0x13')](function(_0x1fd088){logger['error']('UpdateVoiceCallReport',_0x1fd088[_0x9beb('0x10')],_0xc9b7f);_0x4daf1b(_0x5983de[_0x9beb('0xd')](0x1f4,_0x1fd088[_0x9beb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5c2ec67..65e3045 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 _0x5d80=['show','post','create','put','update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x1b7412,_0x9185bc){var _0x1a026a=function(_0x5d597b){while(--_0x5d597b){_0x1b7412['push'](_0x1b7412['shift']());}};_0x1a026a(++_0x9185bc);}(_0x5d80,0x73));var _0x05d8=function(_0x5b5729,_0x6c8c47){_0x5b5729=_0x5b5729-0x0;var _0x273c15=_0x5d80[_0x5b5729];return _0x273c15;};'use strict';var multer=require('multer');var util=require(_0x05d8('0x0'));var path=require(_0x05d8('0x1'));var timeout=require('connect-timeout');var express=require(_0x05d8('0x2'));var router=express['Router']();var fs_extra=require(_0x05d8('0x3'));var auth=require(_0x05d8('0x4'));var interaction=require(_0x05d8('0x5'));var config=require(_0x05d8('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x05d8('0x7')]('/',auth['isAuthenticated'](),controller[_0x05d8('0x8')]);router[_0x05d8('0x7')](_0x05d8('0x9'),auth[_0x05d8('0xa')](),controller[_0x05d8('0xb')]);router[_0x05d8('0xc')]('/',auth['isAuthenticated'](),controller[_0x05d8('0xd')]);router[_0x05d8('0xe')](_0x05d8('0x9'),auth[_0x05d8('0xa')](),controller[_0x05d8('0xf')]);router[_0x05d8('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x05d8('0x11')]=router; \ No newline at end of file +var _0x6f6f=['isAuthenticated','index','get','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x5dca1b,_0x42ab9e){var _0x335b42=function(_0x303b94){while(--_0x303b94){_0x5dca1b['push'](_0x5dca1b['shift']());}};_0x335b42(++_0x42ab9e);}(_0x6f6f,0x1b3));var _0xf6f6=function(_0x120eb3,_0x49dd53){_0x120eb3=_0x120eb3-0x0;var _0x8e0c04=_0x6f6f[_0x120eb3];return _0x8e0c04;};'use strict';var multer=require(_0xf6f6('0x0'));var util=require(_0xf6f6('0x1'));var path=require(_0xf6f6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf6f6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf6f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf6f6('0x5'));var controller=require(_0xf6f6('0x6'));router['get']('/',auth[_0xf6f6('0x7')](),controller[_0xf6f6('0x8')]);router[_0xf6f6('0x9')]('/:id',auth[_0xf6f6('0x7')](),controller['show']);router['post']('/',auth[_0xf6f6('0x7')](),controller[_0xf6f6('0xa')]);router[_0xf6f6('0xb')](_0xf6f6('0xc'),auth[_0xf6f6('0x7')](),controller[_0xf6f6('0xd')]);router[_0xf6f6('0xe')](_0xf6f6('0xc'),auth[_0xf6f6('0x7')](),controller[_0xf6f6('0xf')]);module[_0xf6f6('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 8dbb9ee..1f24d4c 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 _0x20b7=['getDataValue','split','exports','STRING','name','setDataValue','options'];(function(_0x1f7250,_0x137727){var _0x4a6a68=function(_0x5543c4){while(--_0x5543c4){_0x1f7250['push'](_0x1f7250['shift']());}};_0x4a6a68(++_0x137727);}(_0x20b7,0xfe));var _0x720b=function(_0x2f2b46,_0x252373){_0x2f2b46=_0x2f2b46-0x0;var _0x1f934d=_0x20b7[_0x2f2b46];return _0x1f934d;};'use strict';var Sequelize=require('sequelize');module[_0x720b('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x720b('0x1')],'unique':_0x720b('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x720b('0x1')],'set':function(_0x41bcb8){this[_0x720b('0x3')](_0x720b('0x4'),_0x41bcb8?_0x41bcb8['join'](''):[]);},'get':function(){return this[_0x720b('0x5')]('options')?this['getDataValue'](_0x720b('0x4'))[_0x720b('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x720b('0x1')]},'description':{'type':Sequelize[_0x720b('0x1')]}}; \ No newline at end of file +var _0x79ed=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','join','getDataValue','options'];(function(_0x4b1682,_0xb77b20){var _0x2c68f6=function(_0x54a86e){while(--_0x54a86e){_0x4b1682['push'](_0x4b1682['shift']());}};_0x2c68f6(++_0xb77b20);}(_0x79ed,0xfc));var _0xd79e=function(_0x952dc6,_0x29b231){_0x952dc6=_0x952dc6-0x0;var _0x3d66cc=_0x79ed[_0x952dc6];return _0x3d66cc;};'use strict';var Sequelize=require(_0xd79e('0x0'));module[_0xd79e('0x1')]={'name':{'type':Sequelize[_0xd79e('0x2')]},'prefix':{'type':Sequelize[_0xd79e('0x2')],'unique':_0xd79e('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xd79e('0x2')],'set':function(_0x16f93f){this[_0xd79e('0x4')]('options',_0x16f93f?_0x16f93f[_0xd79e('0x5')](''):[]);},'get':function(){return this[_0xd79e('0x6')]('options')?this[_0xd79e('0x6')](_0xd79e('0x7'))[_0xd79e('0x8')](''):[];}},'auth':{'type':Sequelize[_0xd79e('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd79e('0x2')]},'description':{'type':Sequelize[_0xd79e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 26b0dc7..67e93c1 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 _0x8ff9=['end','sendStatus','error','stack','name','send','index','VoiceChanSpy','fieldName','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x8ff9,0x188));var _0x98ff=function(_0x5ee3c2,_0x58fb79){_0x5ee3c2=_0x5ee3c2-0x0;var _0x52df0e=_0x8ff9[_0x5ee3c2];return _0x52df0e;};'use strict';var emlformat=require(_0x98ff('0x0'));var rimraf=require(_0x98ff('0x1'));var zipdir=require(_0x98ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98ff('0x3'));var moment=require(_0x98ff('0x4'));var BPromise=require(_0x98ff('0x5'));var Mustache=require(_0x98ff('0x6'));var util=require(_0x98ff('0x7'));var path=require(_0x98ff('0x8'));var sox=require(_0x98ff('0x9'));var csv=require('to-csv');var ejs=require(_0x98ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98ff('0xb'));var squel=require(_0x98ff('0xc'));var crypto=require('crypto');var jsforce=require(_0x98ff('0xd'));var deskjs=require(_0x98ff('0xe'));var toCsv=require(_0x98ff('0xf'));var querystring=require(_0x98ff('0x10'));var Papa=require(_0x98ff('0x11'));var Redis=require(_0x98ff('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98ff('0x13'));var as=require(_0x98ff('0x14'));var hardwareService=require(_0x98ff('0x15'));var logger=require(_0x98ff('0x16'))('api');var utils=require(_0x98ff('0x17'));var config=require(_0x98ff('0x18'));var licenseUtil=require(_0x98ff('0x19'));var db=require(_0x98ff('0x1a'))['db'];function respondWithStatusCode(_0x9ec5f1,_0x3276a7){_0x3276a7=_0x3276a7||0xcc;return function(_0x5885c8){if(_0x5885c8){return _0x9ec5f1['sendStatus'](_0x3276a7);}return _0x9ec5f1[_0x98ff('0x1b')](_0x3276a7)['end']();};}function respondWithResult(_0x3f288b,_0x1c2b68){_0x1c2b68=_0x1c2b68||0xc8;return function(_0x5b092f){if(_0x5b092f){return _0x3f288b[_0x98ff('0x1b')](_0x1c2b68)['json'](_0x5b092f);}};}function respondWithFilteredResult(_0x18132e,_0x1d85a7){return function(_0x4a2e6e){if(_0x4a2e6e){var _0x2e490a=typeof _0x1d85a7['offset']===_0x98ff('0x1c')&&typeof _0x1d85a7[_0x98ff('0x1d')]===_0x98ff('0x1c');var _0x4cbb53=_0x4a2e6e['count'];var _0x19e1db=_0x2e490a?0x0:_0x1d85a7[_0x98ff('0x1e')];var _0x48ca02=_0x2e490a?_0x4a2e6e[_0x98ff('0x1f')]:_0x1d85a7[_0x98ff('0x1e')]+_0x1d85a7[_0x98ff('0x1d')];var _0x1ab7eb;if(_0x48ca02>=_0x4cbb53){_0x48ca02=_0x4cbb53;_0x1ab7eb=0xc8;}else{_0x1ab7eb=0xce;}_0x18132e[_0x98ff('0x1b')](_0x1ab7eb);return _0x18132e[_0x98ff('0x20')](_0x98ff('0x21'),_0x19e1db+'-'+_0x48ca02+'/'+_0x4cbb53)[_0x98ff('0x22')](_0x4a2e6e);}return null;};}function patchUpdates(_0x3b79db){return function(_0x5c4e5c){try{jsonpatch[_0x98ff('0x23')](_0x5c4e5c,_0x3b79db,!![]);}catch(_0x481a72){return BPromise[_0x98ff('0x24')](_0x481a72);}return _0x5c4e5c[_0x98ff('0x25')]();};}function saveUpdates(_0x3e9f9b,_0x22f8fe){return function(_0x5a1563){if(_0x5a1563){return _0x5a1563['update'](_0x3e9f9b)[_0x98ff('0x26')](function(_0x43f67f){return _0x43f67f;});}return null;};}function removeEntity(_0x766b31,_0x5e18e6){return function(_0x10826e){if(_0x10826e){return _0x10826e[_0x98ff('0x27')]()[_0x98ff('0x26')](function(){var _0x107cd9=_0x10826e[_0x98ff('0x28')]({'plain':!![]});var _0x2d346d=_0x98ff('0x29');return db[_0x98ff('0x2a')]['destroy']({'where':{'type':_0x2d346d,'resourceId':_0x107cd9['id']}})[_0x98ff('0x26')](function(){return _0x10826e;});})['then'](function(){_0x766b31[_0x98ff('0x1b')](0xcc)[_0x98ff('0x2b')]();});}};}function handleEntityNotFound(_0x29e5da,_0x285f72){return function(_0x3311c1){if(!_0x3311c1){_0x29e5da[_0x98ff('0x2c')](0x194);}return _0x3311c1;};}function handleError(_0x3dc5ea,_0x1c4c64){_0x1c4c64=_0x1c4c64||0x1f4;return function(_0xa9787c){logger[_0x98ff('0x2d')](_0xa9787c[_0x98ff('0x2e')]);if(_0xa9787c[_0x98ff('0x2f')]){delete _0xa9787c[_0x98ff('0x2f')];}_0x3dc5ea[_0x98ff('0x1b')](_0x1c4c64)[_0x98ff('0x30')](_0xa9787c);};}exports[_0x98ff('0x31')]=function(_0x2b686b,_0x5af0dc){var _0x346dee={},_0x371096={},_0x9667e4={'count':0x0,'rows':[]};var _0x3b4923=_['map'](db[_0x98ff('0x32')]['rawAttributes'],function(_0x1d8ddd){return{'name':_0x1d8ddd[_0x98ff('0x33')],'type':_0x1d8ddd[_0x98ff('0x34')][_0x98ff('0x35')]};});_0x371096['model']=_[_0x98ff('0x36')](_0x3b4923,_0x98ff('0x2f'));_0x371096['query']=_[_0x98ff('0x37')](_0x2b686b[_0x98ff('0x38')]);_0x371096['filters']=_[_0x98ff('0x39')](_0x371096[_0x98ff('0x3a')],_0x371096['query']);_0x346dee[_0x98ff('0x3b')]=_[_0x98ff('0x39')](_0x371096[_0x98ff('0x3a')],qs[_0x98ff('0x3c')](_0x2b686b['query'][_0x98ff('0x3c')]));_0x346dee['attributes']=_0x346dee[_0x98ff('0x3b')][_0x98ff('0x3d')]?_0x346dee[_0x98ff('0x3b')]:_0x371096['model'];if(!_0x2b686b[_0x98ff('0x38')][_0x98ff('0x3e')](_0x98ff('0x3f'))){_0x346dee[_0x98ff('0x1d')]=qs[_0x98ff('0x1d')](_0x2b686b[_0x98ff('0x38')][_0x98ff('0x1d')]);_0x346dee[_0x98ff('0x1e')]=qs[_0x98ff('0x1e')](_0x2b686b[_0x98ff('0x38')][_0x98ff('0x1e')]);}_0x346dee[_0x98ff('0x40')]=qs['sort'](_0x2b686b[_0x98ff('0x38')][_0x98ff('0x41')]);_0x346dee['where']=qs['filters'](_[_0x98ff('0x42')](_0x2b686b[_0x98ff('0x38')],_0x371096[_0x98ff('0x43')]),_0x3b4923);if(_0x2b686b['query'][_0x98ff('0x44')]){_0x346dee[_0x98ff('0x45')]=_['merge'](_0x346dee[_0x98ff('0x45')],{'$or':_[_0x98ff('0x36')](_0x3b4923,function(_0xfeb667){if(_0xfeb667[_0x98ff('0x34')]!==_0x98ff('0x46')){var _0x5e3654={};_0x5e3654[_0xfeb667[_0x98ff('0x2f')]]={'$like':'%'+_0x2b686b['query'][_0x98ff('0x44')]+'%'};return _0x5e3654;}})});}_0x346dee=_[_0x98ff('0x47')]({},_0x346dee,_0x2b686b[_0x98ff('0x48')]);var _0x32bf28={'where':_0x346dee[_0x98ff('0x45')]};return db['VoiceChanSpy'][_0x98ff('0x1f')](_0x32bf28)['then'](function(_0x14aeca){_0x9667e4[_0x98ff('0x1f')]=_0x14aeca;if(_0x2b686b['query'][_0x98ff('0x49')]){_0x346dee[_0x98ff('0x4a')]=[{'all':!![]}];}return db[_0x98ff('0x32')]['findAll'](_0x346dee);})[_0x98ff('0x26')](function(_0x861b54){_0x9667e4['rows']=_0x861b54;return _0x9667e4;})['then'](respondWithFilteredResult(_0x5af0dc,_0x346dee))['catch'](handleError(_0x5af0dc,null));};exports[_0x98ff('0x4b')]=function(_0x1ee741,_0x4c2191){var _0x47a32a={'raw':![],'where':{'id':_0x1ee741[_0x98ff('0x4c')]['id']}},_0x2eb351={};_0x2eb351[_0x98ff('0x3a')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x2eb351[_0x98ff('0x38')]=_[_0x98ff('0x37')](_0x1ee741[_0x98ff('0x38')]);_0x2eb351['filters']=_[_0x98ff('0x39')](_0x2eb351['model'],_0x2eb351[_0x98ff('0x38')]);_0x47a32a[_0x98ff('0x3b')]=_['intersection'](_0x2eb351[_0x98ff('0x3a')],qs[_0x98ff('0x3c')](_0x1ee741['query'][_0x98ff('0x3c')]));_0x47a32a[_0x98ff('0x3b')]=_0x47a32a[_0x98ff('0x3b')]['length']?_0x47a32a['attributes']:_0x2eb351[_0x98ff('0x3a')];if(_0x1ee741[_0x98ff('0x38')][_0x98ff('0x49')]){_0x47a32a[_0x98ff('0x4a')]=[{'all':!![]}];}_0x47a32a=_[_0x98ff('0x47')]({},_0x47a32a,_0x1ee741[_0x98ff('0x48')]);return db[_0x98ff('0x32')][_0x98ff('0x4d')](_0x47a32a)[_0x98ff('0x26')](handleEntityNotFound(_0x4c2191,null))[_0x98ff('0x26')](respondWithResult(_0x4c2191,null))[_0x98ff('0x4e')](handleError(_0x4c2191,null));};exports[_0x98ff('0x4f')]=function(_0x35607f,_0x582e6f){return db[_0x98ff('0x32')][_0x98ff('0x4f')](_0x35607f[_0x98ff('0x50')],{})[_0x98ff('0x26')](function(_0x13dec0){var _0x16909f=_0x35607f[_0x98ff('0x51')]['get']({'plain':!![]});if(!_0x16909f)throw new Error(_0x98ff('0x52'));if(_0x16909f[_0x98ff('0x53')]==='user'){var _0x3c5faa=_0x13dec0[_0x98ff('0x28')]({'plain':!![]});var _0x3a1eea=_0x98ff('0x29');return db[_0x98ff('0x54')][_0x98ff('0x4d')]({'where':{'name':_0x3a1eea,'userProfileId':_0x16909f[_0x98ff('0x55')]},'raw':!![]})[_0x98ff('0x26')](function(_0x4c4083){if(_0x4c4083&&_0x4c4083['autoAssociation']===0x0){return db[_0x98ff('0x2a')][_0x98ff('0x4f')]({'name':_0x3c5faa[_0x98ff('0x2f')],'resourceId':_0x3c5faa['id'],'type':_0x4c4083[_0x98ff('0x2f')],'sectionId':_0x4c4083['id']},{})['then'](function(){return _0x13dec0;});}else{return _0x13dec0;}})[_0x98ff('0x4e')](function(_0x23aa34){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23aa34);throw _0x23aa34;});}return _0x13dec0;})['then'](respondWithResult(_0x582e6f,0xc9))['catch'](handleError(_0x582e6f,null));};exports[_0x98ff('0x56')]=function(_0x2bd95b,_0x1ef022){if(_0x2bd95b[_0x98ff('0x50')]['id']){delete _0x2bd95b[_0x98ff('0x50')]['id'];}return db[_0x98ff('0x32')][_0x98ff('0x4d')]({'where':{'id':_0x2bd95b['params']['id']}})[_0x98ff('0x26')](handleEntityNotFound(_0x1ef022,null))['then'](saveUpdates(_0x2bd95b[_0x98ff('0x50')],null))[_0x98ff('0x26')](respondWithResult(_0x1ef022,null))[_0x98ff('0x4e')](handleError(_0x1ef022,null));};exports[_0x98ff('0x27')]=function(_0x7df759,_0x4aa355){return db[_0x98ff('0x32')][_0x98ff('0x4d')]({'where':{'id':_0x7df759[_0x98ff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4aa355,null))['then'](removeEntity(_0x4aa355,null))[_0x98ff('0x4e')](handleError(_0x4aa355,null));}; \ No newline at end of file +var _0x2c54=['then','destroy','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','user','get','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','limit','count','offset','status','set','Content-Range','reject','save'];(function(_0x71cb0d,_0x57582b){var _0x1c25f5=function(_0x1ed4de){while(--_0x1ed4de){_0x71cb0d['push'](_0x71cb0d['shift']());}};_0x1c25f5(++_0x57582b);}(_0x2c54,0x136));var _0x42c5=function(_0x495bf9,_0x35e222){_0x495bf9=_0x495bf9-0x0;var _0x82c3b4=_0x2c54[_0x495bf9];return _0x82c3b4;};'use strict';var emlformat=require(_0x42c5('0x0'));var rimraf=require(_0x42c5('0x1'));var zipdir=require(_0x42c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42c5('0x3'));var moment=require(_0x42c5('0x4'));var BPromise=require(_0x42c5('0x5'));var Mustache=require(_0x42c5('0x6'));var util=require(_0x42c5('0x7'));var path=require(_0x42c5('0x8'));var sox=require('sox');var csv=require(_0x42c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42c5('0xa'));var squel=require(_0x42c5('0xb'));var crypto=require(_0x42c5('0xc'));var jsforce=require(_0x42c5('0xd'));var deskjs=require(_0x42c5('0xe'));var toCsv=require(_0x42c5('0x9'));var querystring=require(_0x42c5('0xf'));var Papa=require(_0x42c5('0x10'));var Redis=require(_0x42c5('0x11'));var authService=require(_0x42c5('0x12'));var qs=require(_0x42c5('0x13'));var as=require(_0x42c5('0x14'));var hardwareService=require(_0x42c5('0x15'));var logger=require(_0x42c5('0x16'))(_0x42c5('0x17'));var utils=require(_0x42c5('0x18'));var config=require(_0x42c5('0x19'));var licenseUtil=require(_0x42c5('0x1a'));var db=require(_0x42c5('0x1b'))['db'];function respondWithStatusCode(_0x43793e,_0x18faec){_0x18faec=_0x18faec||0xcc;return function(_0x391716){if(_0x391716){return _0x43793e['sendStatus'](_0x18faec);}return _0x43793e['status'](_0x18faec)[_0x42c5('0x1c')]();};}function respondWithResult(_0xc17623,_0x337f2d){_0x337f2d=_0x337f2d||0xc8;return function(_0x1056de){if(_0x1056de){return _0xc17623['status'](_0x337f2d)[_0x42c5('0x1d')](_0x1056de);}};}function respondWithFilteredResult(_0x22d052,_0x5c9ac2){return function(_0x4efb1a){if(_0x4efb1a){var _0x323705=typeof _0x5c9ac2['offset']==='undefined'&&typeof _0x5c9ac2[_0x42c5('0x1e')]==='undefined';var _0x4eda79=_0x4efb1a[_0x42c5('0x1f')];var _0x3a2115=_0x323705?0x0:_0x5c9ac2[_0x42c5('0x20')];var _0x3f4172=_0x323705?_0x4efb1a[_0x42c5('0x1f')]:_0x5c9ac2[_0x42c5('0x20')]+_0x5c9ac2[_0x42c5('0x1e')];var _0x34f31b;if(_0x3f4172>=_0x4eda79){_0x3f4172=_0x4eda79;_0x34f31b=0xc8;}else{_0x34f31b=0xce;}_0x22d052[_0x42c5('0x21')](_0x34f31b);return _0x22d052[_0x42c5('0x22')](_0x42c5('0x23'),_0x3a2115+'-'+_0x3f4172+'/'+_0x4eda79)[_0x42c5('0x1d')](_0x4efb1a);}return null;};}function patchUpdates(_0x11c6e8){return function(_0x15035e){try{jsonpatch['apply'](_0x15035e,_0x11c6e8,!![]);}catch(_0x102294){return BPromise[_0x42c5('0x24')](_0x102294);}return _0x15035e[_0x42c5('0x25')]();};}function saveUpdates(_0x56fc64,_0x245e72){return function(_0x2533ff){if(_0x2533ff){return _0x2533ff['update'](_0x56fc64)[_0x42c5('0x26')](function(_0xd577c8){return _0xd577c8;});}return null;};}function removeEntity(_0x2d8143,_0x3166b5){return function(_0x119580){if(_0x119580){return _0x119580[_0x42c5('0x27')]()['then'](function(){var _0x2d319d=_0x119580['get']({'plain':!![]});var _0x325184=_0x42c5('0x28');return db['UserProfileResource'][_0x42c5('0x27')]({'where':{'type':_0x325184,'resourceId':_0x2d319d['id']}})['then'](function(){return _0x119580;});})[_0x42c5('0x26')](function(){_0x2d8143[_0x42c5('0x21')](0xcc)[_0x42c5('0x1c')]();});}};}function handleEntityNotFound(_0x4096c0,_0x2cb126){return function(_0x4431ff){if(!_0x4431ff){_0x4096c0['sendStatus'](0x194);}return _0x4431ff;};}function handleError(_0x2766e3,_0x586cc1){_0x586cc1=_0x586cc1||0x1f4;return function(_0x16e198){logger[_0x42c5('0x29')](_0x16e198[_0x42c5('0x2a')]);if(_0x16e198[_0x42c5('0x2b')]){delete _0x16e198['name'];}_0x2766e3['status'](_0x586cc1)[_0x42c5('0x2c')](_0x16e198);};}exports[_0x42c5('0x2d')]=function(_0x55e7dd,_0x13daf0){var _0x5bbbd4={},_0x3a2cc8={},_0x4dbd89={'count':0x0,'rows':[]};var _0x246575=_[_0x42c5('0x2e')](db[_0x42c5('0x2f')]['rawAttributes'],function(_0x4cb532){return{'name':_0x4cb532[_0x42c5('0x30')],'type':_0x4cb532[_0x42c5('0x31')][_0x42c5('0x32')]};});_0x3a2cc8[_0x42c5('0x33')]=_['map'](_0x246575,'name');_0x3a2cc8[_0x42c5('0x34')]=_[_0x42c5('0x35')](_0x55e7dd[_0x42c5('0x34')]);_0x3a2cc8[_0x42c5('0x36')]=_[_0x42c5('0x37')](_0x3a2cc8['model'],_0x3a2cc8[_0x42c5('0x34')]);_0x5bbbd4[_0x42c5('0x38')]=_['intersection'](_0x3a2cc8[_0x42c5('0x33')],qs['fields'](_0x55e7dd[_0x42c5('0x34')][_0x42c5('0x39')]));_0x5bbbd4['attributes']=_0x5bbbd4['attributes']['length']?_0x5bbbd4['attributes']:_0x3a2cc8[_0x42c5('0x33')];if(!_0x55e7dd[_0x42c5('0x34')][_0x42c5('0x3a')](_0x42c5('0x3b'))){_0x5bbbd4['limit']=qs[_0x42c5('0x1e')](_0x55e7dd[_0x42c5('0x34')][_0x42c5('0x1e')]);_0x5bbbd4[_0x42c5('0x20')]=qs['offset'](_0x55e7dd['query'][_0x42c5('0x20')]);}_0x5bbbd4['order']=qs['sort'](_0x55e7dd['query'][_0x42c5('0x3c')]);_0x5bbbd4[_0x42c5('0x3d')]=qs[_0x42c5('0x36')](_[_0x42c5('0x3e')](_0x55e7dd[_0x42c5('0x34')],_0x3a2cc8[_0x42c5('0x36')]),_0x246575);if(_0x55e7dd[_0x42c5('0x34')][_0x42c5('0x3f')]){_0x5bbbd4[_0x42c5('0x3d')]=_[_0x42c5('0x40')](_0x5bbbd4['where'],{'$or':_[_0x42c5('0x2e')](_0x246575,function(_0x1f04e4){if(_0x1f04e4[_0x42c5('0x31')]!==_0x42c5('0x41')){var _0x355e4a={};_0x355e4a[_0x1f04e4['name']]={'$like':'%'+_0x55e7dd[_0x42c5('0x34')]['filter']+'%'};return _0x355e4a;}})});}_0x5bbbd4=_[_0x42c5('0x40')]({},_0x5bbbd4,_0x55e7dd[_0x42c5('0x42')]);var _0x116cbf={'where':_0x5bbbd4[_0x42c5('0x3d')]};return db[_0x42c5('0x2f')][_0x42c5('0x1f')](_0x116cbf)[_0x42c5('0x26')](function(_0x2e2e56){_0x4dbd89[_0x42c5('0x1f')]=_0x2e2e56;if(_0x55e7dd[_0x42c5('0x34')][_0x42c5('0x43')]){_0x5bbbd4[_0x42c5('0x44')]=[{'all':!![]}];}return db[_0x42c5('0x2f')][_0x42c5('0x45')](_0x5bbbd4);})[_0x42c5('0x26')](function(_0x341aee){_0x4dbd89[_0x42c5('0x46')]=_0x341aee;return _0x4dbd89;})[_0x42c5('0x26')](respondWithFilteredResult(_0x13daf0,_0x5bbbd4))[_0x42c5('0x47')](handleError(_0x13daf0,null));};exports[_0x42c5('0x48')]=function(_0x2bb3ed,_0x552e9f){var _0x1475f3={'raw':![],'where':{'id':_0x2bb3ed['params']['id']}},_0x4030ab={};_0x4030ab[_0x42c5('0x33')]=_[_0x42c5('0x35')](db['VoiceChanSpy'][_0x42c5('0x49')]);_0x4030ab[_0x42c5('0x34')]=_[_0x42c5('0x35')](_0x2bb3ed[_0x42c5('0x34')]);_0x4030ab[_0x42c5('0x36')]=_[_0x42c5('0x37')](_0x4030ab[_0x42c5('0x33')],_0x4030ab['query']);_0x1475f3['attributes']=_[_0x42c5('0x37')](_0x4030ab[_0x42c5('0x33')],qs[_0x42c5('0x39')](_0x2bb3ed[_0x42c5('0x34')]['fields']));_0x1475f3['attributes']=_0x1475f3[_0x42c5('0x38')][_0x42c5('0x4a')]?_0x1475f3[_0x42c5('0x38')]:_0x4030ab[_0x42c5('0x33')];if(_0x2bb3ed[_0x42c5('0x34')]['includeAll']){_0x1475f3[_0x42c5('0x44')]=[{'all':!![]}];}_0x1475f3=_[_0x42c5('0x40')]({},_0x1475f3,_0x2bb3ed[_0x42c5('0x42')]);return db[_0x42c5('0x2f')]['find'](_0x1475f3)[_0x42c5('0x26')](handleEntityNotFound(_0x552e9f,null))[_0x42c5('0x26')](respondWithResult(_0x552e9f,null))[_0x42c5('0x47')](handleError(_0x552e9f,null));};exports[_0x42c5('0x4b')]=function(_0x20cac2,_0x11f594){return db[_0x42c5('0x2f')][_0x42c5('0x4b')](_0x20cac2[_0x42c5('0x4c')],{})[_0x42c5('0x26')](function(_0x557016){var _0x1b9e51=_0x20cac2[_0x42c5('0x4d')][_0x42c5('0x4e')]({'plain':!![]});if(!_0x1b9e51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b9e51[_0x42c5('0x4f')]===_0x42c5('0x4d')){var _0x489080=_0x557016[_0x42c5('0x4e')]({'plain':!![]});var _0x81e75f=_0x42c5('0x28');return db[_0x42c5('0x50')]['find']({'where':{'name':_0x81e75f,'userProfileId':_0x1b9e51[_0x42c5('0x51')]},'raw':!![]})[_0x42c5('0x26')](function(_0x596775){if(_0x596775&&_0x596775['autoAssociation']===0x0){return db[_0x42c5('0x52')][_0x42c5('0x4b')]({'name':_0x489080['name'],'resourceId':_0x489080['id'],'type':_0x596775['name'],'sectionId':_0x596775['id']},{})['then'](function(){return _0x557016;});}else{return _0x557016;}})[_0x42c5('0x47')](function(_0x4d3a08){logger[_0x42c5('0x29')](_0x42c5('0x53'),_0x4d3a08);throw _0x4d3a08;});}return _0x557016;})[_0x42c5('0x26')](respondWithResult(_0x11f594,0xc9))[_0x42c5('0x47')](handleError(_0x11f594,null));};exports[_0x42c5('0x54')]=function(_0x459ba,_0x24265c){if(_0x459ba[_0x42c5('0x4c')]['id']){delete _0x459ba[_0x42c5('0x4c')]['id'];}return db[_0x42c5('0x2f')][_0x42c5('0x55')]({'where':{'id':_0x459ba[_0x42c5('0x56')]['id']}})[_0x42c5('0x26')](handleEntityNotFound(_0x24265c,null))[_0x42c5('0x26')](saveUpdates(_0x459ba['body'],null))[_0x42c5('0x26')](respondWithResult(_0x24265c,null))[_0x42c5('0x47')](handleError(_0x24265c,null));};exports[_0x42c5('0x27')]=function(_0x24e43b,_0x21f4e1){return db[_0x42c5('0x2f')][_0x42c5('0x55')]({'where':{'id':_0x24e43b[_0x42c5('0x56')]['id']}})[_0x42c5('0x26')](handleEntityNotFound(_0x21f4e1,null))['then'](removeEntity(_0x21f4e1,null))[_0x42c5('0x47')](handleError(_0x21f4e1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 73c02d4..9ce2020 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 _0x5f37=['destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','Set','CDR(type)=%s','chanspy','merge','MixMonitor','recordingFormat','password','SIP/%s,%s','options','join','record','StopMixMonitor','length','concat','internal','name','User','findAll','catch','exports','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5f37,0x119));var _0x75f3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f37[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x75f3('0x0'));var util=require(_0x75f3('0x1'));var BPromise=require('bluebird');var attributes=require(_0x75f3('0x2'));var getUserApplications=function(_0x4498b3,_0x149af6,_0x308809){var _0x40fa3f=0x1;var _0x3d573f=[];var _0x282d14={'context':_0x149af6[_0x75f3('0x3')]||_0x75f3('0x4'),'exten':util[_0x75f3('0x5')](_0x75f3('0x6'),_0x4498b3[_0x75f3('0x7')],_0x308809),'type':'system','isApp':![],'ChanSpyId':_0x4498b3['id'],'UserId':_0x149af6['id']};_0x3d573f[_0x75f3('0x8')](_['merge']({'app':_0x75f3('0x9'),'appdata':util[_0x75f3('0x5')](_0x75f3('0xa'),_0x75f3('0xb')),'priority':_0x40fa3f++},_0x282d14));if(_0x4498b3['record']){_0x3d573f[_0x75f3('0x8')](_[_0x75f3('0xc')]({'app':_0x75f3('0xd'),'appdata':util[_0x75f3('0x5')]('${UNIQUEID}.%s,a',_0x4498b3[_0x75f3('0xe')]),'priority':_0x40fa3f++},_0x282d14));}if(_0x4498b3['auth']){_0x3d573f[_0x75f3('0x8')](_[_0x75f3('0xc')]({'app':'Authenticate','appdata':_0x4498b3[_0x75f3('0xf')],'priority':_0x40fa3f++},_0x282d14));}_0x3d573f[_0x75f3('0x8')](_['merge']({'app':'ChanSpy','appdata':util[_0x75f3('0x5')](_0x75f3('0x10'),_0x149af6['name'],_0x4498b3[_0x75f3('0x11')]?_0x4498b3['options'][_0x75f3('0x12')](''):''),'priority':_0x40fa3f++},_0x282d14));if(_0x4498b3[_0x75f3('0x13')]){_0x3d573f['push'](_[_0x75f3('0xc')]({'app':_0x75f3('0x14'),'priority':_0x40fa3f++},_0x282d14));}return _0x3d573f;};var getChanSpyApplications=function(_0x2f3f21,_0x4ac466){var _0x4013ca=[];for(var _0x518e19=0x0,_0xc7ed67=0x1;_0x518e19<_0x4ac466[_0x75f3('0x15')];_0x518e19++,_0xc7ed67=0x1){_0x4013ca=_0x4013ca[_0x75f3('0x16')](getUserApplications(_0x2f3f21,_0x4ac466[_0x518e19],_0x4ac466[_0x518e19][_0x75f3('0x17')]));if(_0x4ac466[_0x518e19][_0x75f3('0x17')]!=_0x4ac466[_0x518e19][_0x75f3('0x18')]){_0x4013ca=_0x4013ca['concat'](getUserApplications(_0x2f3f21,_0x4ac466[_0x518e19],_0x4ac466[_0x518e19][_0x75f3('0x18')]));}}return _0x4013ca;};var getChanSpyPromise=function(_0x430a24,_0x1c71a0){return new BPromise(function(_0x1d04cc,_0x58242b){return _0x430a24[_0x75f3('0x19')][_0x75f3('0x1a')]({'attributes':['id',_0x75f3('0x18'),_0x75f3('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x15ad8f){if(_0x15ad8f){return _0x1d04cc(getChanSpyApplications(_0x1c71a0,_0x15ad8f));}return _0x1d04cc([]);})[_0x75f3('0x1b')](function(_0x211630){_0x58242b(_0x211630);});});};module[_0x75f3('0x1c')]=function(_0x2de094,_0x41307f){var _0x45403b=_0x2de094['models'];return _0x2de094['define'](_0x75f3('0x1d'),attributes,{'tableName':_0x75f3('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x171034,_0x8a1b4a,_0x457d8f){return getChanSpyPromise(_0x45403b,_0x171034)[_0x75f3('0x1f')](function(_0x2910b5){if(_0x2910b5&&_0x2910b5[_0x75f3('0x15')]){return _0x45403b['VoiceExtension'][_0x75f3('0x20')](_0x2910b5);}})['then'](function(){_0x457d8f();})[_0x75f3('0x1b')](function(_0x4b6494){_0x457d8f(_0x4b6494);});},'afterUpdate':function(_0x1fc1b1,_0x1fec60,_0x2ec4d0){return _0x45403b['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x1fc1b1['id']}})[_0x75f3('0x1f')](function(){return getChanSpyPromise(_0x45403b,_0x1fc1b1);})['then'](function(_0xa73c5){if(_0xa73c5&&_0xa73c5[_0x75f3('0x15')]){return _0x45403b[_0x75f3('0x21')][_0x75f3('0x20')](_0xa73c5);}})[_0x75f3('0x1f')](function(){_0x2ec4d0();})[_0x75f3('0x1b')](function(_0x14f638){_0x2ec4d0(_0x14f638);});},'afterDestroy':function(_0x5d1823,_0x28e27a,_0x281f9e){return _0x45403b['VoiceExtension'][_0x75f3('0x22')]({'where':{'ChanSpyId':_0x5d1823['id']}})[_0x75f3('0x1f')](function(){_0x281f9e();})[_0x75f3('0x1b')](function(_0x25dece){_0x281f9e(_0x25dece);});}}});}; \ No newline at end of file +var _0xe88e=['push','merge','format','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','context','from-sip','%s%s','prefix','system'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0xe88e,0x109));var _0xee88=function(_0x21a7aa,_0x2248dc){_0x21a7aa=_0x21a7aa-0x0;var _0x20c622=_0xe88e[_0x21a7aa];return _0x20c622;};'use strict';var _=require(_0xee88('0x0'));var util=require(_0xee88('0x1'));var BPromise=require(_0xee88('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x1add09,_0x4b6614,_0x3d074a){var _0x575d27=0x1;var _0x281d7a=[];var _0x389689={'context':_0x4b6614[_0xee88('0x3')]||_0xee88('0x4'),'exten':util['format'](_0xee88('0x5'),_0x1add09[_0xee88('0x6')],_0x3d074a),'type':_0xee88('0x7'),'isApp':![],'ChanSpyId':_0x1add09['id'],'UserId':_0x4b6614['id']};_0x281d7a[_0xee88('0x8')](_[_0xee88('0x9')]({'app':'Set','appdata':util[_0xee88('0xa')]('CDR(type)=%s',_0xee88('0xb')),'priority':_0x575d27++},_0x389689));if(_0x1add09[_0xee88('0xc')]){_0x281d7a[_0xee88('0x8')](_['merge']({'app':_0xee88('0xd'),'appdata':util[_0xee88('0xa')](_0xee88('0xe'),_0x1add09[_0xee88('0xf')]),'priority':_0x575d27++},_0x389689));}if(_0x1add09[_0xee88('0x10')]){_0x281d7a[_0xee88('0x8')](_[_0xee88('0x9')]({'app':_0xee88('0x11'),'appdata':_0x1add09[_0xee88('0x12')],'priority':_0x575d27++},_0x389689));}_0x281d7a[_0xee88('0x8')](_[_0xee88('0x9')]({'app':'ChanSpy','appdata':util[_0xee88('0xa')](_0xee88('0x13'),_0x4b6614[_0xee88('0x14')],_0x1add09[_0xee88('0x15')]?_0x1add09['options'][_0xee88('0x16')](''):''),'priority':_0x575d27++},_0x389689));if(_0x1add09[_0xee88('0xc')]){_0x281d7a[_0xee88('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x575d27++},_0x389689));}return _0x281d7a;};var getChanSpyApplications=function(_0x5c6242,_0xdc9b91){var _0x5b09f7=[];for(var _0x5d3c7e=0x0,_0x59a98f=0x1;_0x5d3c7e<_0xdc9b91['length'];_0x5d3c7e++,_0x59a98f=0x1){_0x5b09f7=_0x5b09f7[_0xee88('0x17')](getUserApplications(_0x5c6242,_0xdc9b91[_0x5d3c7e],_0xdc9b91[_0x5d3c7e][_0xee88('0x18')]));if(_0xdc9b91[_0x5d3c7e][_0xee88('0x18')]!=_0xdc9b91[_0x5d3c7e][_0xee88('0x14')]){_0x5b09f7=_0x5b09f7[_0xee88('0x17')](getUserApplications(_0x5c6242,_0xdc9b91[_0x5d3c7e],_0xdc9b91[_0x5d3c7e][_0xee88('0x14')]));}}return _0x5b09f7;};var getChanSpyPromise=function(_0x3fe389,_0x33300d){return new BPromise(function(_0x3be648,_0x4d890a){return _0x3fe389[_0xee88('0x19')][_0xee88('0x1a')]({'attributes':['id',_0xee88('0x14'),_0xee88('0x18')],'where':{'role':_0xee88('0x1b'),'chanspy':!![]},'raw':!![]})[_0xee88('0x1c')](function(_0x2970b2){if(_0x2970b2){return _0x3be648(getChanSpyApplications(_0x33300d,_0x2970b2));}return _0x3be648([]);})[_0xee88('0x1d')](function(_0x48a5e5){_0x4d890a(_0x48a5e5);});});};module[_0xee88('0x1e')]=function(_0x379cba,_0x6ca0d9){var _0x90c74b=_0x379cba[_0xee88('0x1f')];return _0x379cba[_0xee88('0x20')](_0xee88('0x21'),attributes,{'tableName':_0xee88('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x42aa02,_0x4b22c5,_0x54db84){return getChanSpyPromise(_0x90c74b,_0x42aa02)[_0xee88('0x1c')](function(_0x39bf73){if(_0x39bf73&&_0x39bf73[_0xee88('0x23')]){return _0x90c74b[_0xee88('0x24')]['bulkCreate'](_0x39bf73);}})['then'](function(){_0x54db84();})['catch'](function(_0x5c16a2){_0x54db84(_0x5c16a2);});},'afterUpdate':function(_0x26acbd,_0x1c7668,_0x58bb90){return _0x90c74b[_0xee88('0x24')][_0xee88('0x25')]({'where':{'ChanSpyId':_0x26acbd['id']}})[_0xee88('0x1c')](function(){return getChanSpyPromise(_0x90c74b,_0x26acbd);})[_0xee88('0x1c')](function(_0x10db74){if(_0x10db74&&_0x10db74[_0xee88('0x23')]){return _0x90c74b[_0xee88('0x24')][_0xee88('0x26')](_0x10db74);}})[_0xee88('0x1c')](function(){_0x58bb90();})[_0xee88('0x1d')](function(_0x5ccca5){_0x58bb90(_0x5ccca5);});},'afterDestroy':function(_0x124ec9,_0x4f3489,_0x5464a1){return _0x90c74b[_0xee88('0x24')][_0xee88('0x25')]({'where':{'ChanSpyId':_0x124ec9['id']}})[_0xee88('0x1c')](function(){_0x5464a1();})[_0xee88('0x1d')](function(_0x53d67c){_0x5464a1(_0x53d67c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index eedf55b..a1f6d16 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 _0x765e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x765e,0x131));var _0xe765=function(_0x445b85,_0x508f02){_0x445b85=_0x445b85-0x0;var _0x18fd55=_0x765e[_0x445b85];return _0x18fd55;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdd89e7,_0x504542,_0x35d891){return new BPromise(function(_0x28e955,_0x27b0f4){return client[_0xe765('0xe')](_0xdd89e7,_0x35d891)[_0xe765('0xf')](function(_0x41801f){logger[_0xe765('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x504542,_0xe765('0x11'));logger[_0xe765('0x12')](_0xe765('0x13'),_0x504542,'request\x20sent',JSON[_0xe765('0x14')](_0x41801f));if(_0x41801f['error']){if(_0x41801f['error']['code']===0x1f4){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x27b0f4(_0x41801f[_0xe765('0x15')]['message']);}logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x28e955(_0x41801f[_0xe765('0x15')]['message']);}else{logger['info'](_0xe765('0x16'),_0x504542,_0xe765('0x11'));_0x28e955(_0x41801f[_0xe765('0x18')]['message']);}})[_0xe765('0x19')](function(_0x36aca3){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x36aca3);_0x27b0f4(_0x36aca3);});});} \ No newline at end of file +var _0xe600=['rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x610684,_0x4d747b){var _0x3f13e0=function(_0x394e1){while(--_0x394e1){_0x610684['push'](_0x610684['shift']());}};_0x3f13e0(++_0x4d747b);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x0e60('0x0'));var moment=require('moment');var BPromise=require(_0x0e60('0x1'));var rs=require(_0x0e60('0x2'));var fs=require('fs');var Redis=require(_0x0e60('0x3'));var db=require(_0x0e60('0x4'))['db'];var utils=require(_0x0e60('0x5'));var logger=require(_0x0e60('0x6'))(_0x0e60('0x7'));var config=require(_0x0e60('0x8'));var jayson=require(_0x0e60('0x9'));var client=jayson[_0x0e60('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7563,_0x497a61,_0x6727dd){return new BPromise(function(_0x30eaed,_0x5ba123){return client[_0x0e60('0xb')](_0x1d7563,_0x6727dd)[_0x0e60('0xc')](function(_0x238537){logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));logger['debug'](_0x0e60('0x10'),_0x497a61,_0x0e60('0xf'),JSON[_0x0e60('0x11')](_0x238537));if(_0x238537[_0x0e60('0x12')]){if(_0x238537[_0x0e60('0x12')][_0x0e60('0x13')]===0x1f4){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537['error'][_0x0e60('0x14')]);return _0x5ba123(_0x238537[_0x0e60('0x12')][_0x0e60('0x14')]);}logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537[_0x0e60('0x12')]['message']);return _0x30eaed(_0x238537[_0x0e60('0x12')]['message']);}else{logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));_0x30eaed(_0x238537['result'][_0x0e60('0x14')]);}})[_0x0e60('0x15')](function(_0xdb7760){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0xdb7760);_0x5ba123(_0xdb7760);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 0fd1ca3..2a185cb 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 _0xf85a=['post','create','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id'];(function(_0x406b98,_0x3dea6d){var _0x10545f=function(_0xecba84){while(--_0xecba84){_0x406b98['push'](_0x406b98['shift']());}};_0x10545f(++_0x3dea6d);}(_0xf85a,0xe2));var _0xaf85=function(_0x4798a6,_0x3109b9){_0x4798a6=_0x4798a6-0x0;var _0x1cf432=_0xf85a[_0x4798a6];return _0x1cf432;};'use strict';var multer=require(_0xaf85('0x0'));var util=require('util');var path=require(_0xaf85('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf85('0x2'));var router=express[_0xaf85('0x3')]();var fs_extra=require(_0xaf85('0x4'));var auth=require(_0xaf85('0x5'));var interaction=require(_0xaf85('0x6'));var config=require(_0xaf85('0x7'));var controller=require(_0xaf85('0x8'));router[_0xaf85('0x9')]('/',auth[_0xaf85('0xa')](),controller['index']);router[_0xaf85('0x9')](_0xaf85('0xb'),auth[_0xaf85('0xa')](),controller['show']);router[_0xaf85('0xc')]('/',auth[_0xaf85('0xa')](),controller[_0xaf85('0xd')]);router['put'](_0xaf85('0xb'),auth[_0xaf85('0xa')](),controller[_0xaf85('0xe')]);router['delete'](_0xaf85('0xb'),auth[_0xaf85('0xa')](),controller[_0xaf85('0xf')]);module[_0xaf85('0x10')]=router; \ No newline at end of file +var _0x5492=['/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x28c79b,_0x3c2ae1){var _0x115176=function(_0x1eca6c){while(--_0x1eca6c){_0x28c79b['push'](_0x28c79b['shift']());}};_0x115176(++_0x3c2ae1);}(_0x5492,0x8c));var _0x2549=function(_0x1323fa,_0x351b8b){_0x1323fa=_0x1323fa-0x0;var _0x79ab1c=_0x5492[_0x1323fa];return _0x79ab1c;};'use strict';var multer=require(_0x2549('0x0'));var util=require(_0x2549('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2549('0x2')]();var fs_extra=require(_0x2549('0x3'));var auth=require(_0x2549('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2549('0x5'));router[_0x2549('0x6')]('/',auth[_0x2549('0x7')](),controller[_0x2549('0x8')]);router[_0x2549('0x6')]('/:id',auth[_0x2549('0x7')](),controller[_0x2549('0x9')]);router[_0x2549('0xa')]('/',auth[_0x2549('0x7')](),controller[_0x2549('0xb')]);router[_0x2549('0xc')](_0x2549('0xd'),auth[_0x2549('0x7')](),controller[_0x2549('0xe')]);router['delete'](_0x2549('0xd'),auth[_0x2549('0x7')](),controller[_0x2549('0xf')]);module[_0x2549('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6b1c8a8..ce5f06c 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 _0xbd48=['name','BOOLEAN','sequelize','STRING'];(function(_0x2a3c0a,_0x163f5c){var _0x1703a2=function(_0x471dfe){while(--_0x471dfe){_0x2a3c0a['push'](_0x2a3c0a['shift']());}};_0x1703a2(++_0x163f5c);}(_0xbd48,0x16e));var _0x8bd4=function(_0x1138ab,_0xd385b3){_0x1138ab=_0x1138ab-0x0;var _0xa77686=_0xbd48[_0x1138ab];return _0xa77686;};'use strict';var Sequelize=require(_0x8bd4('0x0'));module['exports']={'name':{'type':Sequelize[_0x8bd4('0x1')],'unique':_0x8bd4('0x2')},'description':{'type':Sequelize[_0x8bd4('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8bd4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ad7=['exports','STRING','sequelize'];(function(_0x2e3575,_0x53ae8e){var _0x5cb715=function(_0x39180a){while(--_0x39180a){_0x2e3575['push'](_0x2e3575['shift']());}};_0x5cb715(++_0x53ae8e);}(_0x6ad7,0x107));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x76ad('0x0'));module[_0x76ad('0x1')]={'name':{'type':Sequelize[_0x76ad('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x76ad('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d03819c..c31e270 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 _0x9eec=['findAll','rows','show','params','fields','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','/etc/asterisk/extensions_xcally_contexts.conf','Reload','root','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','then','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','VoiceContext','includeAll','include'];(function(_0x377ddf,_0x102e9a){var _0x5b8465=function(_0x3e0ed3){while(--_0x3e0ed3){_0x377ddf['push'](_0x377ddf['shift']());}};_0x5b8465(++_0x102e9a);}(_0x9eec,0x1c1));var _0xc9ee=function(_0xebce60,_0x3ea4ef){_0xebce60=_0xebce60-0x0;var _0x3ed112=_0x9eec[_0xebce60];return _0x3ed112;};'use strict';var emlformat=require(_0xc9ee('0x0'));var rimraf=require(_0xc9ee('0x1'));var zipdir=require(_0xc9ee('0x2'));var jsonpatch=require(_0xc9ee('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc9ee('0x4'));var util=require(_0xc9ee('0x5'));var path=require(_0xc9ee('0x6'));var sox=require(_0xc9ee('0x7'));var csv=require('to-csv');var ejs=require(_0xc9ee('0x8'));var fs=require('fs');var fs_extra=require(_0xc9ee('0x9'));var _=require(_0xc9ee('0xa'));var squel=require('squel');var crypto=require(_0xc9ee('0xb'));var jsforce=require(_0xc9ee('0xc'));var deskjs=require(_0xc9ee('0xd'));var toCsv=require(_0xc9ee('0xe'));var querystring=require(_0xc9ee('0xf'));var Papa=require(_0xc9ee('0x10'));var Redis=require(_0xc9ee('0x11'));var authService=require(_0xc9ee('0x12'));var qs=require(_0xc9ee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9ee('0x14'));var logger=require(_0xc9ee('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc9ee('0x16'));var licenseUtil=require(_0xc9ee('0x17'));var db=require(_0xc9ee('0x18'))['db'];var jayson=require(_0xc9ee('0x19'));var client=jayson['client'][_0xc9ee('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x404bfe,_0x703ef3,_0x29b3d4,_0xb29eae){return new BPromise(function(_0x50e6e5,_0xdbefbf){var _0x4b1b38=_0xb29eae||client;return _0x4b1b38[_0xc9ee('0x1b')](_0x404bfe,_0x29b3d4)['then'](function(_0x2a5365){logger[_0xc9ee('0x1c')](_0xc9ee('0x1d'),_0x703ef3,_0xc9ee('0x1e'));logger['debug'](_0xc9ee('0x1f'),_0x703ef3,'request\x20sent',JSON[_0xc9ee('0x20')](_0x2a5365));if(_0x2a5365[_0xc9ee('0x21')]){if(_0x2a5365[_0xc9ee('0x21')][_0xc9ee('0x22')]===0x1f4){logger[_0xc9ee('0x21')](_0xc9ee('0x1d'),_0x703ef3,_0x2a5365[_0xc9ee('0x21')][_0xc9ee('0x23')]);return _0xdbefbf(_0x2a5365[_0xc9ee('0x21')][_0xc9ee('0x23')]);}logger['error'](_0xc9ee('0x1d'),_0x703ef3,_0x2a5365['error'][_0xc9ee('0x23')]);return _0x50e6e5(_0x2a5365[_0xc9ee('0x21')][_0xc9ee('0x23')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x703ef3,_0xc9ee('0x1e'));_0x50e6e5(_0x2a5365[_0xc9ee('0x24')][_0xc9ee('0x23')]);}})[_0xc9ee('0x25')](function(_0x7018b1){logger[_0xc9ee('0x21')]('VoiceContext,\x20%s,\x20%s',_0x703ef3,_0x7018b1);_0xdbefbf(_0x7018b1);});});}function respondWithStatusCode(_0x57ce82,_0x4da9f1){_0x4da9f1=_0x4da9f1||0xcc;return function(_0x3eddb8){if(_0x3eddb8){return _0x57ce82[_0xc9ee('0x26')](_0x4da9f1);}return _0x57ce82[_0xc9ee('0x27')](_0x4da9f1)[_0xc9ee('0x28')]();};}function respondWithResult(_0x36639c,_0x2c5203){_0x2c5203=_0x2c5203||0xc8;return function(_0x2410ee){if(_0x2410ee){return _0x36639c[_0xc9ee('0x27')](_0x2c5203)['json'](_0x2410ee);}};}function respondWithFilteredResult(_0x4adf99,_0x4ec1d4){return function(_0x1a5f47){if(_0x1a5f47){var _0x32a1f7=typeof _0x4ec1d4['offset']===_0xc9ee('0x29')&&typeof _0x4ec1d4['limit']==='undefined';var _0x422577=_0x1a5f47[_0xc9ee('0x2a')];var _0x39ed62=_0x32a1f7?0x0:_0x4ec1d4[_0xc9ee('0x2b')];var _0x10c6c9=_0x32a1f7?_0x1a5f47['count']:_0x4ec1d4[_0xc9ee('0x2b')]+_0x4ec1d4[_0xc9ee('0x2c')];var _0x1f3276;if(_0x10c6c9>=_0x422577){_0x10c6c9=_0x422577;_0x1f3276=0xc8;}else{_0x1f3276=0xce;}_0x4adf99[_0xc9ee('0x27')](_0x1f3276);return _0x4adf99[_0xc9ee('0x2d')](_0xc9ee('0x2e'),_0x39ed62+'-'+_0x10c6c9+'/'+_0x422577)['json'](_0x1a5f47);}return null;};}function patchUpdates(_0xd0a104){return function(_0x392449){try{jsonpatch[_0xc9ee('0x2f')](_0x392449,_0xd0a104,!![]);}catch(_0x21d6cf){return BPromise[_0xc9ee('0x30')](_0x21d6cf);}return _0x392449[_0xc9ee('0x31')]();};}function saveUpdates(_0x18079a,_0x3b660a){return function(_0x217145){if(_0x217145){return _0x217145['update'](_0x18079a)['then'](function(_0x3e1779){return _0x3e1779;});}return null;};}function removeEntity(_0x1c01c8,_0x2b11e5){return function(_0x10f230){if(_0x10f230){return _0x10f230[_0xc9ee('0x32')]()['then'](function(){var _0x14c277=_0x10f230[_0xc9ee('0x33')]({'plain':!![]});var _0x10eb43=_0xc9ee('0x34');return db[_0xc9ee('0x35')][_0xc9ee('0x32')]({'where':{'type':_0x10eb43,'resourceId':_0x14c277['id']}})[_0xc9ee('0x36')](function(){return _0x10f230;});})['then'](function(){_0x1c01c8[_0xc9ee('0x27')](0xcc)[_0xc9ee('0x28')]();});}};}function handleEntityNotFound(_0x4cbbd1,_0x979319){return function(_0x3fed5e){if(!_0x3fed5e){_0x4cbbd1['sendStatus'](0x194);}return _0x3fed5e;};}function handleError(_0x39711a,_0x51e46b){_0x51e46b=_0x51e46b||0x1f4;return function(_0x31ba78){logger[_0xc9ee('0x21')](_0x31ba78[_0xc9ee('0x37')]);if(_0x31ba78[_0xc9ee('0x38')]){delete _0x31ba78[_0xc9ee('0x38')];}_0x39711a[_0xc9ee('0x27')](_0x51e46b)[_0xc9ee('0x39')](_0x31ba78);};}exports['index']=function(_0x5429dc,_0x547f0e){var _0x4c37d0={},_0x19952d={},_0xdc0e24={'count':0x0,'rows':[]};var _0x4f6c6b=_['map'](db['VoiceContext'][_0xc9ee('0x3a')],function(_0x4edeb3){return{'name':_0x4edeb3[_0xc9ee('0x3b')],'type':_0x4edeb3['type'][_0xc9ee('0x3c')]};});_0x19952d[_0xc9ee('0x3d')]=_[_0xc9ee('0x3e')](_0x4f6c6b,_0xc9ee('0x38'));_0x19952d[_0xc9ee('0x3f')]=_[_0xc9ee('0x40')](_0x5429dc['query']);_0x19952d['filters']=_['intersection'](_0x19952d[_0xc9ee('0x3d')],_0x19952d['query']);_0x4c37d0['attributes']=_[_0xc9ee('0x41')](_0x19952d[_0xc9ee('0x3d')],qs['fields'](_0x5429dc[_0xc9ee('0x3f')]['fields']));_0x4c37d0[_0xc9ee('0x42')]=_0x4c37d0['attributes'][_0xc9ee('0x43')]?_0x4c37d0[_0xc9ee('0x42')]:_0x19952d['model'];if(!_0x5429dc[_0xc9ee('0x3f')][_0xc9ee('0x44')]('nolimit')){_0x4c37d0['limit']=qs[_0xc9ee('0x2c')](_0x5429dc[_0xc9ee('0x3f')][_0xc9ee('0x2c')]);_0x4c37d0[_0xc9ee('0x2b')]=qs[_0xc9ee('0x2b')](_0x5429dc['query'][_0xc9ee('0x2b')]);}_0x4c37d0[_0xc9ee('0x45')]=qs[_0xc9ee('0x46')](_0x5429dc['query'][_0xc9ee('0x46')]);_0x4c37d0[_0xc9ee('0x47')]=qs['filters'](_['pick'](_0x5429dc[_0xc9ee('0x3f')],_0x19952d[_0xc9ee('0x48')]),_0x4f6c6b);if(_0x5429dc['query'][_0xc9ee('0x49')]){_0x4c37d0[_0xc9ee('0x47')]=_[_0xc9ee('0x4a')](_0x4c37d0[_0xc9ee('0x47')],{'$or':_[_0xc9ee('0x3e')](_0x4f6c6b,function(_0x21cb89){if(_0x21cb89[_0xc9ee('0x4b')]!==_0xc9ee('0x4c')){var _0x20ed23={};_0x20ed23[_0x21cb89[_0xc9ee('0x38')]]={'$like':'%'+_0x5429dc[_0xc9ee('0x3f')]['filter']+'%'};return _0x20ed23;}})});}_0x4c37d0=_[_0xc9ee('0x4a')]({},_0x4c37d0,_0x5429dc[_0xc9ee('0x4d')]);var _0x578dba={'where':_0x4c37d0[_0xc9ee('0x47')]};return db[_0xc9ee('0x4e')][_0xc9ee('0x2a')](_0x578dba)[_0xc9ee('0x36')](function(_0x451cc8){_0xdc0e24[_0xc9ee('0x2a')]=_0x451cc8;if(_0x5429dc[_0xc9ee('0x3f')][_0xc9ee('0x4f')]){_0x4c37d0[_0xc9ee('0x50')]=[{'all':!![]}];}return db[_0xc9ee('0x4e')][_0xc9ee('0x51')](_0x4c37d0);})[_0xc9ee('0x36')](function(_0x5dbe4d){_0xdc0e24[_0xc9ee('0x52')]=_0x5dbe4d;return _0xdc0e24;})[_0xc9ee('0x36')](respondWithFilteredResult(_0x547f0e,_0x4c37d0))[_0xc9ee('0x25')](handleError(_0x547f0e,null));};exports[_0xc9ee('0x53')]=function(_0xb41eb8,_0x3ffeec){var _0x3b0385={'raw':![],'where':{'id':_0xb41eb8[_0xc9ee('0x54')]['id']}},_0xa1281a={};_0xa1281a[_0xc9ee('0x3d')]=_[_0xc9ee('0x40')](db[_0xc9ee('0x4e')][_0xc9ee('0x3a')]);_0xa1281a['query']=_[_0xc9ee('0x40')](_0xb41eb8[_0xc9ee('0x3f')]);_0xa1281a[_0xc9ee('0x48')]=_[_0xc9ee('0x41')](_0xa1281a[_0xc9ee('0x3d')],_0xa1281a['query']);_0x3b0385['attributes']=_['intersection'](_0xa1281a['model'],qs[_0xc9ee('0x55')](_0xb41eb8[_0xc9ee('0x3f')][_0xc9ee('0x55')]));_0x3b0385[_0xc9ee('0x42')]=_0x3b0385[_0xc9ee('0x42')][_0xc9ee('0x43')]?_0x3b0385[_0xc9ee('0x42')]:_0xa1281a[_0xc9ee('0x3d')];if(_0xb41eb8[_0xc9ee('0x3f')][_0xc9ee('0x4f')]){_0x3b0385['include']=[{'all':!![]}];}_0x3b0385=_[_0xc9ee('0x4a')]({},_0x3b0385,_0xb41eb8[_0xc9ee('0x4d')]);return db[_0xc9ee('0x4e')]['find'](_0x3b0385)[_0xc9ee('0x36')](handleEntityNotFound(_0x3ffeec,null))[_0xc9ee('0x36')](respondWithResult(_0x3ffeec,null))[_0xc9ee('0x25')](handleError(_0x3ffeec,null));};exports[_0xc9ee('0x56')]=function(_0x29ec4d,_0x18cb9c,_0x43d453){var _0xfc3e14;return db['VoiceContext'][_0xc9ee('0x56')](_0x29ec4d[_0xc9ee('0x57')],{'raw':!![]})[_0xc9ee('0x36')](function(_0x44e099){_0xfc3e14=_0x44e099;return db[_0xc9ee('0x4e')]['findAll']({'raw':!![]});})['then'](function(_0x5033ee){var _0xaf8a46=fs[_0xc9ee('0x58')](path[_0xc9ee('0x59')](config['root'],_0xc9ee('0x5a')),_0xc9ee('0x5b'));var _0x1a1770=ejs[_0xc9ee('0x5c')](_0xaf8a46,{'contexts':_0x5033ee||[]});fs[_0xc9ee('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1a1770);})[_0xc9ee('0x36')](function(){return respondWithRpcPromise('Reload','create',{'module':_0xc9ee('0x5e')});})[_0xc9ee('0x36')](function(){var _0x391c56=_0x29ec4d['user']['get']({'plain':!![]});if(!_0x391c56)throw new Error(_0xc9ee('0x5f'));if(_0x391c56[_0xc9ee('0x60')]==='user'){var _0x13cfd2=_0xfc3e14[_0xc9ee('0x33')]({'plain':!![]});return db[_0xc9ee('0x61')][_0xc9ee('0x62')]({'where':{'name':'Contexts','userProfileId':_0x391c56[_0xc9ee('0x63')]},'raw':!![]})[_0xc9ee('0x36')](function(_0x139588){if(_0x139588&&_0x139588[_0xc9ee('0x64')]===0x0){return db[_0xc9ee('0x35')][_0xc9ee('0x56')]({'name':_0x13cfd2[_0xc9ee('0x38')],'resourceId':_0x13cfd2['id'],'type':_0x139588[_0xc9ee('0x38')],'sectionId':_0x139588['id']},{})[_0xc9ee('0x36')](function(){return _0xfc3e14;});}else{return _0xfc3e14;}})['catch'](function(_0x17ada3){logger['error'](_0xc9ee('0x65'),_0x17ada3);throw _0x17ada3;});}return _0xfc3e14;})['then'](respondWithResult(_0x18cb9c,0xc9))[_0xc9ee('0x25')](handleError(_0x18cb9c,null));};exports[_0xc9ee('0x66')]=function(_0x29721d,_0x28124c,_0x11f1c2){var _0x94ff93;return db[_0xc9ee('0x4e')]['find']({'where':{'id':_0x29721d[_0xc9ee('0x54')]['id']}})[_0xc9ee('0x36')](handleEntityNotFound(_0x28124c,null))[_0xc9ee('0x36')](saveUpdates(_0x29721d[_0xc9ee('0x57')],null))['then'](function(_0x539b46){if(_0x539b46){_0x94ff93=_0x539b46;return db[_0xc9ee('0x4e')]['findAll']({'raw':!![]});}})['then'](function(_0x5489b9){var _0x1f42e0=fs[_0xc9ee('0x58')](path[_0xc9ee('0x59')](config['root'],_0xc9ee('0x5a')),_0xc9ee('0x5b'));var _0x315909=ejs['render'](_0x1f42e0,{'contexts':_0x5489b9||[]});fs[_0xc9ee('0x5d')](_0xc9ee('0x67'),_0x315909);})[_0xc9ee('0x36')](function(){return respondWithRpcPromise(_0xc9ee('0x68'),_0xc9ee('0x66'),{'module':'chan_sip.so'});})['then'](function(){return _0x94ff93;})[_0xc9ee('0x36')](respondWithResult(_0x28124c,null))[_0xc9ee('0x25')](handleError(_0x28124c,null));};exports[_0xc9ee('0x32')]=function(_0x51f375,_0x565417,_0x3c7f86){var _0x39e423;return db[_0xc9ee('0x4e')]['find']({'where':{'id':_0x51f375[_0xc9ee('0x54')]['id']}})['then'](handleEntityNotFound(_0x565417,null))['then'](removeEntity(_0x565417,null))[_0xc9ee('0x36')](function(){return db[_0xc9ee('0x4e')][_0xc9ee('0x51')]({'raw':!![]});})[_0xc9ee('0x36')](function(_0x2979ed){var _0x5b86bc=fs[_0xc9ee('0x58')](path[_0xc9ee('0x59')](config[_0xc9ee('0x69')],_0xc9ee('0x5a')),_0xc9ee('0x5b'));var _0x1ca8f8=ejs[_0xc9ee('0x5c')](_0x5b86bc,{'contexts':_0x2979ed});fs['writeFileSync'](_0xc9ee('0x67'),_0x1ca8f8);return respondWithRpcPromise('Reload',_0xc9ee('0x32'),{'module':_0xc9ee('0x5e')});})[_0xc9ee('0x25')](handleError(_0x565417,null));}; \ No newline at end of file +var _0x0aa7=['options','find','create','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','root','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','destroy','get','Contexts','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','VoiceContext','findAll','rows','show','params'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0aa7,0x150));var _0x70aa=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x0aa7[_0xaf29da];return _0x295c51;};'use strict';var emlformat=require(_0x70aa('0x0'));var rimraf=require(_0x70aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x70aa('0x2'));var moment=require(_0x70aa('0x3'));var BPromise=require(_0x70aa('0x4'));var Mustache=require(_0x70aa('0x5'));var util=require(_0x70aa('0x6'));var path=require(_0x70aa('0x7'));var sox=require(_0x70aa('0x8'));var csv=require(_0x70aa('0x9'));var ejs=require(_0x70aa('0xa'));var fs=require('fs');var fs_extra=require(_0x70aa('0xb'));var _=require(_0x70aa('0xc'));var squel=require(_0x70aa('0xd'));var crypto=require(_0x70aa('0xe'));var jsforce=require(_0x70aa('0xf'));var deskjs=require(_0x70aa('0x10'));var toCsv=require('to-csv');var querystring=require(_0x70aa('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x70aa('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70aa('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x70aa('0x14'));var config=require(_0x70aa('0x15'));var licenseUtil=require(_0x70aa('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x70aa('0x17'));var client=jayson[_0x70aa('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15fd4d,_0xf81fe4,_0x1e5ef5,_0x364b95){return new BPromise(function(_0x58de66,_0x407215){var _0x275a74=_0x364b95||client;return _0x275a74[_0x70aa('0x19')](_0x15fd4d,_0x1e5ef5)[_0x70aa('0x1a')](function(_0x3ea076){logger[_0x70aa('0x1b')](_0x70aa('0x1c'),_0xf81fe4,_0x70aa('0x1d'));logger[_0x70aa('0x1e')](_0x70aa('0x1f'),_0xf81fe4,_0x70aa('0x1d'),JSON[_0x70aa('0x20')](_0x3ea076));if(_0x3ea076[_0x70aa('0x21')]){if(_0x3ea076['error'][_0x70aa('0x22')]===0x1f4){logger[_0x70aa('0x21')]('VoiceContext,\x20%s,\x20%s',_0xf81fe4,_0x3ea076[_0x70aa('0x21')]['message']);return _0x407215(_0x3ea076['error'][_0x70aa('0x23')]);}logger[_0x70aa('0x21')](_0x70aa('0x1c'),_0xf81fe4,_0x3ea076[_0x70aa('0x21')][_0x70aa('0x23')]);return _0x58de66(_0x3ea076[_0x70aa('0x21')][_0x70aa('0x23')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0xf81fe4,_0x70aa('0x1d'));_0x58de66(_0x3ea076[_0x70aa('0x24')]['message']);}})[_0x70aa('0x25')](function(_0x5a71eb){logger[_0x70aa('0x21')]('VoiceContext,\x20%s,\x20%s',_0xf81fe4,_0x5a71eb);_0x407215(_0x5a71eb);});});}function respondWithStatusCode(_0xc6b8fb,_0x33cb3e){_0x33cb3e=_0x33cb3e||0xcc;return function(_0x5b3d58){if(_0x5b3d58){return _0xc6b8fb[_0x70aa('0x26')](_0x33cb3e);}return _0xc6b8fb['status'](_0x33cb3e)[_0x70aa('0x27')]();};}function respondWithResult(_0x78cda7,_0x3207cc){_0x3207cc=_0x3207cc||0xc8;return function(_0xe39700){if(_0xe39700){return _0x78cda7['status'](_0x3207cc)[_0x70aa('0x28')](_0xe39700);}};}function respondWithFilteredResult(_0x5942fd,_0x132df4){return function(_0x5b447f){if(_0x5b447f){var _0x3979d1=typeof _0x132df4[_0x70aa('0x29')]===_0x70aa('0x2a')&&typeof _0x132df4[_0x70aa('0x2b')]===_0x70aa('0x2a');var _0xba8282=_0x5b447f['count'];var _0x5f5a75=_0x3979d1?0x0:_0x132df4['offset'];var _0x536fe9=_0x3979d1?_0x5b447f[_0x70aa('0x2c')]:_0x132df4[_0x70aa('0x29')]+_0x132df4[_0x70aa('0x2b')];var _0x37f3a9;if(_0x536fe9>=_0xba8282){_0x536fe9=_0xba8282;_0x37f3a9=0xc8;}else{_0x37f3a9=0xce;}_0x5942fd[_0x70aa('0x2d')](_0x37f3a9);return _0x5942fd['set'](_0x70aa('0x2e'),_0x5f5a75+'-'+_0x536fe9+'/'+_0xba8282)['json'](_0x5b447f);}return null;};}function patchUpdates(_0x4edb2c){return function(_0x5b91a5){try{jsonpatch[_0x70aa('0x2f')](_0x5b91a5,_0x4edb2c,!![]);}catch(_0x26496f){return BPromise[_0x70aa('0x30')](_0x26496f);}return _0x5b91a5[_0x70aa('0x31')]();};}function saveUpdates(_0x1b56b5,_0x27af66){return function(_0x61fa94){if(_0x61fa94){return _0x61fa94['update'](_0x1b56b5)['then'](function(_0x1b3af3){return _0x1b3af3;});}return null;};}function removeEntity(_0x55dc6a,_0x545d4d){return function(_0x167948){if(_0x167948){return _0x167948[_0x70aa('0x32')]()['then'](function(){var _0x591127=_0x167948[_0x70aa('0x33')]({'plain':!![]});var _0x3d1bb0=_0x70aa('0x34');return db['UserProfileResource'][_0x70aa('0x32')]({'where':{'type':_0x3d1bb0,'resourceId':_0x591127['id']}})[_0x70aa('0x1a')](function(){return _0x167948;});})[_0x70aa('0x1a')](function(){_0x55dc6a[_0x70aa('0x2d')](0xcc)[_0x70aa('0x27')]();});}};}function handleEntityNotFound(_0x2e79d5,_0x54ff47){return function(_0x214348){if(!_0x214348){_0x2e79d5[_0x70aa('0x26')](0x194);}return _0x214348;};}function handleError(_0x131858,_0x1e0353){_0x1e0353=_0x1e0353||0x1f4;return function(_0x163a87){logger[_0x70aa('0x21')](_0x163a87[_0x70aa('0x35')]);if(_0x163a87[_0x70aa('0x36')]){delete _0x163a87[_0x70aa('0x36')];}_0x131858['status'](_0x1e0353)[_0x70aa('0x37')](_0x163a87);};}exports[_0x70aa('0x38')]=function(_0x1aaae5,_0x39a993){var _0x1cc2d1={},_0x3a0015={},_0x562668={'count':0x0,'rows':[]};var _0x1d3811=_[_0x70aa('0x39')](db['VoiceContext'][_0x70aa('0x3a')],function(_0x45b4d9){return{'name':_0x45b4d9[_0x70aa('0x3b')],'type':_0x45b4d9[_0x70aa('0x3c')]['key']};});_0x3a0015[_0x70aa('0x3d')]=_[_0x70aa('0x39')](_0x1d3811,_0x70aa('0x36'));_0x3a0015['query']=_[_0x70aa('0x3e')](_0x1aaae5['query']);_0x3a0015[_0x70aa('0x3f')]=_[_0x70aa('0x40')](_0x3a0015[_0x70aa('0x3d')],_0x3a0015['query']);_0x1cc2d1[_0x70aa('0x41')]=_[_0x70aa('0x40')](_0x3a0015[_0x70aa('0x3d')],qs['fields'](_0x1aaae5[_0x70aa('0x42')][_0x70aa('0x43')]));_0x1cc2d1['attributes']=_0x1cc2d1[_0x70aa('0x41')][_0x70aa('0x44')]?_0x1cc2d1[_0x70aa('0x41')]:_0x3a0015['model'];if(!_0x1aaae5[_0x70aa('0x42')][_0x70aa('0x45')](_0x70aa('0x46'))){_0x1cc2d1[_0x70aa('0x2b')]=qs['limit'](_0x1aaae5[_0x70aa('0x42')][_0x70aa('0x2b')]);_0x1cc2d1[_0x70aa('0x29')]=qs[_0x70aa('0x29')](_0x1aaae5[_0x70aa('0x42')][_0x70aa('0x29')]);}_0x1cc2d1[_0x70aa('0x47')]=qs[_0x70aa('0x48')](_0x1aaae5[_0x70aa('0x42')][_0x70aa('0x48')]);_0x1cc2d1[_0x70aa('0x49')]=qs[_0x70aa('0x3f')](_['pick'](_0x1aaae5[_0x70aa('0x42')],_0x3a0015[_0x70aa('0x3f')]),_0x1d3811);if(_0x1aaae5[_0x70aa('0x42')][_0x70aa('0x4a')]){_0x1cc2d1['where']=_['merge'](_0x1cc2d1['where'],{'$or':_[_0x70aa('0x39')](_0x1d3811,function(_0x1e1008){if(_0x1e1008['type']!==_0x70aa('0x4b')){var _0x213d0c={};_0x213d0c[_0x1e1008[_0x70aa('0x36')]]={'$like':'%'+_0x1aaae5['query']['filter']+'%'};return _0x213d0c;}})});}_0x1cc2d1=_[_0x70aa('0x4c')]({},_0x1cc2d1,_0x1aaae5['options']);var _0xdbb0={'where':_0x1cc2d1['where']};return db['VoiceContext'][_0x70aa('0x2c')](_0xdbb0)['then'](function(_0x2d3ae5){_0x562668[_0x70aa('0x2c')]=_0x2d3ae5;if(_0x1aaae5[_0x70aa('0x42')][_0x70aa('0x4d')]){_0x1cc2d1[_0x70aa('0x4e')]=[{'all':!![]}];}return db[_0x70aa('0x4f')][_0x70aa('0x50')](_0x1cc2d1);})['then'](function(_0x2b3a79){_0x562668[_0x70aa('0x51')]=_0x2b3a79;return _0x562668;})[_0x70aa('0x1a')](respondWithFilteredResult(_0x39a993,_0x1cc2d1))[_0x70aa('0x25')](handleError(_0x39a993,null));};exports[_0x70aa('0x52')]=function(_0x3453dd,_0x2fa44d){var _0x7e5c3b={'raw':![],'where':{'id':_0x3453dd[_0x70aa('0x53')]['id']}},_0x367417={};_0x367417[_0x70aa('0x3d')]=_['keys'](db['VoiceContext'][_0x70aa('0x3a')]);_0x367417[_0x70aa('0x42')]=_[_0x70aa('0x3e')](_0x3453dd[_0x70aa('0x42')]);_0x367417['filters']=_['intersection'](_0x367417[_0x70aa('0x3d')],_0x367417[_0x70aa('0x42')]);_0x7e5c3b[_0x70aa('0x41')]=_[_0x70aa('0x40')](_0x367417[_0x70aa('0x3d')],qs['fields'](_0x3453dd[_0x70aa('0x42')][_0x70aa('0x43')]));_0x7e5c3b[_0x70aa('0x41')]=_0x7e5c3b[_0x70aa('0x41')]['length']?_0x7e5c3b[_0x70aa('0x41')]:_0x367417[_0x70aa('0x3d')];if(_0x3453dd[_0x70aa('0x42')][_0x70aa('0x4d')]){_0x7e5c3b[_0x70aa('0x4e')]=[{'all':!![]}];}_0x7e5c3b=_['merge']({},_0x7e5c3b,_0x3453dd[_0x70aa('0x54')]);return db[_0x70aa('0x4f')][_0x70aa('0x55')](_0x7e5c3b)[_0x70aa('0x1a')](handleEntityNotFound(_0x2fa44d,null))[_0x70aa('0x1a')](respondWithResult(_0x2fa44d,null))[_0x70aa('0x25')](handleError(_0x2fa44d,null));};exports[_0x70aa('0x56')]=function(_0x4e154a,_0xcaf319,_0x5e80e4){var _0x1b829d;return db['VoiceContext'][_0x70aa('0x56')](_0x4e154a['body'],{'raw':!![]})[_0x70aa('0x1a')](function(_0x36bdcf){_0x1b829d=_0x36bdcf;return db['VoiceContext'][_0x70aa('0x50')]({'raw':!![]});})[_0x70aa('0x1a')](function(_0x46935c){var _0x46c6ce=fs[_0x70aa('0x57')](path[_0x70aa('0x58')](config['root'],_0x70aa('0x59')),_0x70aa('0x5a'));var _0xf4ea52=ejs[_0x70aa('0x5b')](_0x46c6ce,{'contexts':_0x46935c||[]});fs[_0x70aa('0x5c')](_0x70aa('0x5d'),_0xf4ea52);})['then'](function(){return respondWithRpcPromise(_0x70aa('0x5e'),_0x70aa('0x56'),{'module':_0x70aa('0x5f')});})[_0x70aa('0x1a')](function(){var _0x15bea7=_0x4e154a[_0x70aa('0x60')][_0x70aa('0x33')]({'plain':!![]});if(!_0x15bea7)throw new Error(_0x70aa('0x61'));if(_0x15bea7['role']==='user'){var _0xc3579=_0x1b829d[_0x70aa('0x33')]({'plain':!![]});return db[_0x70aa('0x62')][_0x70aa('0x55')]({'where':{'name':'Contexts','userProfileId':_0x15bea7[_0x70aa('0x63')]},'raw':!![]})['then'](function(_0x3358e4){if(_0x3358e4&&_0x3358e4[_0x70aa('0x64')]===0x0){return db['UserProfileResource'][_0x70aa('0x56')]({'name':_0xc3579[_0x70aa('0x36')],'resourceId':_0xc3579['id'],'type':_0x3358e4[_0x70aa('0x36')],'sectionId':_0x3358e4['id']},{})[_0x70aa('0x1a')](function(){return _0x1b829d;});}else{return _0x1b829d;}})['catch'](function(_0x2c5952){logger[_0x70aa('0x21')](_0x70aa('0x65'),_0x2c5952);throw _0x2c5952;});}return _0x1b829d;})[_0x70aa('0x1a')](respondWithResult(_0xcaf319,0xc9))[_0x70aa('0x25')](handleError(_0xcaf319,null));};exports[_0x70aa('0x66')]=function(_0x324d62,_0x185585,_0x29188d){var _0xa26e1;return db[_0x70aa('0x4f')][_0x70aa('0x55')]({'where':{'id':_0x324d62[_0x70aa('0x53')]['id']}})[_0x70aa('0x1a')](handleEntityNotFound(_0x185585,null))[_0x70aa('0x1a')](saveUpdates(_0x324d62[_0x70aa('0x67')],null))[_0x70aa('0x1a')](function(_0x58b7be){if(_0x58b7be){_0xa26e1=_0x58b7be;return db[_0x70aa('0x4f')][_0x70aa('0x50')]({'raw':!![]});}})['then'](function(_0x57c59d){var _0x547832=fs[_0x70aa('0x57')](path[_0x70aa('0x58')](config[_0x70aa('0x68')],'server/files/templates/context.ejs'),_0x70aa('0x5a'));var _0x56261a=ejs[_0x70aa('0x5b')](_0x547832,{'contexts':_0x57c59d||[]});fs[_0x70aa('0x5c')](_0x70aa('0x5d'),_0x56261a);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});})['then'](function(){return _0xa26e1;})[_0x70aa('0x1a')](respondWithResult(_0x185585,null))[_0x70aa('0x25')](handleError(_0x185585,null));};exports[_0x70aa('0x32')]=function(_0x131bd2,_0x286c67,_0x36953a){var _0xf73e69;return db['VoiceContext'][_0x70aa('0x55')]({'where':{'id':_0x131bd2['params']['id']}})[_0x70aa('0x1a')](handleEntityNotFound(_0x286c67,null))[_0x70aa('0x1a')](removeEntity(_0x286c67,null))[_0x70aa('0x1a')](function(){return db[_0x70aa('0x4f')]['findAll']({'raw':!![]});})[_0x70aa('0x1a')](function(_0x142deb){var _0x2d6104=fs[_0x70aa('0x57')](path['join'](config[_0x70aa('0x68')],_0x70aa('0x59')),_0x70aa('0x5a'));var _0x40e37b=ejs[_0x70aa('0x5b')](_0x2d6104,{'contexts':_0x142deb});fs[_0x70aa('0x5c')](_0x70aa('0x5d'),_0x40e37b);return respondWithRpcPromise('Reload',_0x70aa('0x32'),{'module':'chan_sip.so'});})['catch'](handleError(_0x286c67,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f2506e6..4d637ab 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 _0x1d73=['../../config/environment','VoiceContext','voice_contexts','util','api','moment','path','rimraf'];(function(_0x20161f,_0x5cf8fe){var _0x2ccb76=function(_0x36a438){while(--_0x36a438){_0x20161f['push'](_0x20161f['shift']());}};_0x2ccb76(++_0x5cf8fe);}(_0x1d73,0xeb));var _0x31d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1d73[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x31d7('0x0'));var logger=require('../../config/logger')(_0x31d7('0x1'));var moment=require(_0x31d7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x31d7('0x3'));var rimraf=require(_0x31d7('0x4'));var config=require(_0x31d7('0x5'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x3b9d26,_0x1c6175){return _0x3b9d26['define'](_0x31d7('0x6'),attributes,{'tableName':_0x31d7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aed=['rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x28a9ed,_0x3146fb){var _0x235119=function(_0x1318be){while(--_0x1318be){_0x28a9ed['push'](_0x28a9ed['shift']());}};_0x235119(++_0x3146fb);}(_0x3aed,0x1c6));var _0xd3ae=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x3aed[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0xd3ae('0x0'));var util=require(_0xd3ae('0x1'));var logger=require(_0xd3ae('0x2'))(_0xd3ae('0x3'));var moment=require(_0xd3ae('0x4'));var BPromise=require(_0xd3ae('0x5'));var rp=require(_0xd3ae('0x6'));var fs=require('fs');var path=require(_0xd3ae('0x7'));var rimraf=require(_0xd3ae('0x8'));var config=require('../../config/environment');var attributes=require(_0xd3ae('0x9'));module[_0xd3ae('0xa')]=function(_0x1aa501,_0x2311c8){return _0x1aa501[_0xd3ae('0xb')](_0xd3ae('0xc'),attributes,{'tableName':_0xd3ae('0xd'),'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 257dc81..5baa1a8 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 _0x3946=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x275c59,_0x43c564){var _0x3d737a=function(_0x3b0695){while(--_0x3b0695){_0x275c59['push'](_0x275c59['shift']());}};_0x3d737a(++_0x43c564);}(_0x3946,0x1d0));var _0x6394=function(_0x2850de,_0x1121b8){_0x2850de=_0x2850de-0x0;var _0x487dfd=_0x3946[_0x2850de];return _0x487dfd;};'use strict';var _=require('lodash');var util=require(_0x6394('0x0'));var moment=require(_0x6394('0x1'));var BPromise=require(_0x6394('0x2'));var rs=require(_0x6394('0x3'));var fs=require('fs');var Redis=require(_0x6394('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6394('0x5'));var logger=require(_0x6394('0x6'))(_0x6394('0x7'));var config=require(_0x6394('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6394('0x9')][_0x6394('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5163,_0x4b2e43,_0x244ca1){return new BPromise(function(_0x10d154,_0x34c972){return client[_0x6394('0xb')](_0x3f5163,_0x244ca1)['then'](function(_0x3f60c9){logger[_0x6394('0xc')](_0x6394('0xd'),_0x4b2e43,_0x6394('0xe'));logger[_0x6394('0xf')](_0x6394('0x10'),_0x4b2e43,_0x6394('0xe'),JSON[_0x6394('0x11')](_0x3f60c9));if(_0x3f60c9[_0x6394('0x12')]){if(_0x3f60c9['error'][_0x6394('0x13')]===0x1f4){logger['error'](_0x6394('0xd'),_0x4b2e43,_0x3f60c9[_0x6394('0x12')]['message']);return _0x34c972(_0x3f60c9['error'][_0x6394('0x14')]);}logger[_0x6394('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4b2e43,_0x3f60c9['error'][_0x6394('0x14')]);return _0x10d154(_0x3f60c9[_0x6394('0x12')][_0x6394('0x14')]);}else{logger['info'](_0x6394('0xd'),_0x4b2e43,_0x6394('0xe'));_0x10d154(_0x3f60c9[_0x6394('0x15')]['message']);}})[_0x6394('0x16')](function(_0x4562fc){logger[_0x6394('0x12')](_0x6394('0xd'),_0x4b2e43,_0x4562fc);_0x34c972(_0x4562fc);});});} \ No newline at end of file +var _0xa908=['http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa908,0x1c3));var _0x8a90=function(_0x46cd97,_0x1d7f12){_0x46cd97=_0x46cd97-0x0;var _0x4eeb8a=_0xa908[_0x46cd97];return _0x4eeb8a;};'use strict';var _=require(_0x8a90('0x0'));var util=require('util');var moment=require(_0x8a90('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a90('0x2'));var fs=require('fs');var Redis=require(_0x8a90('0x3'));var db=require(_0x8a90('0x4'))['db'];var utils=require(_0x8a90('0x5'));var logger=require(_0x8a90('0x6'))('rpc');var config=require(_0x8a90('0x7'));var jayson=require(_0x8a90('0x8'));var client=jayson['client'][_0x8a90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dc8f9,_0x12d376,_0x3faf88){return new BPromise(function(_0x20f8bf,_0x200f95){return client['request'](_0x1dc8f9,_0x3faf88)[_0x8a90('0xa')](function(_0x485401){logger[_0x8a90('0xb')]('VoiceContext,\x20%s,\x20%s',_0x12d376,_0x8a90('0xc'));logger[_0x8a90('0xd')](_0x8a90('0xe'),_0x12d376,_0x8a90('0xc'),JSON[_0x8a90('0xf')](_0x485401));if(_0x485401[_0x8a90('0x10')]){if(_0x485401[_0x8a90('0x10')]['code']===0x1f4){logger['error'](_0x8a90('0x11'),_0x12d376,_0x485401[_0x8a90('0x10')][_0x8a90('0x12')]);return _0x200f95(_0x485401['error'][_0x8a90('0x12')]);}logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x485401['error'][_0x8a90('0x12')]);return _0x20f8bf(_0x485401[_0x8a90('0x10')]['message']);}else{logger[_0x8a90('0xb')](_0x8a90('0x11'),_0x12d376,_0x8a90('0xc'));_0x20f8bf(_0x485401[_0x8a90('0x13')]['message']);}})['catch'](function(_0x14db82){logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x14db82);_0x200f95(_0x14db82);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f490442..0a24c3e 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 _0x1a4b=['show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x1e28be,_0xb487a5){var _0x30ca16=function(_0x2804f3){while(--_0x2804f3){_0x1e28be['push'](_0x1e28be['shift']());}};_0x30ca16(++_0xb487a5);}(_0x1a4b,0x86));var _0xb1a4=function(_0x3283ed,_0x455b32){_0x3283ed=_0x3283ed-0x0;var _0x53b859=_0x1a4b[_0x3283ed];return _0x53b859;};'use strict';var multer=require('multer');var util=require(_0xb1a4('0x0'));var path=require(_0xb1a4('0x1'));var timeout=require(_0xb1a4('0x2'));var express=require(_0xb1a4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb1a4('0x4'));var interaction=require(_0xb1a4('0x5'));var config=require('../../config/environment');var controller=require(_0xb1a4('0x6'));router[_0xb1a4('0x7')]('/',auth[_0xb1a4('0x8')](),controller[_0xb1a4('0x9')]);router[_0xb1a4('0x7')]('/describe',auth[_0xb1a4('0x8')](),controller['describe']);router[_0xb1a4('0x7')]('/:id',auth[_0xb1a4('0x8')](),controller[_0xb1a4('0xa')]);router['post']('/',auth[_0xb1a4('0x8')](),controller[_0xb1a4('0xb')]);router[_0xb1a4('0xc')](_0xb1a4('0xd'),auth[_0xb1a4('0x8')](),controller[_0xb1a4('0xe')]);router[_0xb1a4('0xf')](_0xb1a4('0xd'),auth[_0xb1a4('0x8')](),controller[_0xb1a4('0x10')]);module[_0xb1a4('0x11')]=router; \ No newline at end of file +var _0x6e82=['post','create','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','/describe','describe','show'];(function(_0x3460a3,_0x151a2f){var _0x5647f6=function(_0x2a1896){while(--_0x2a1896){_0x3460a3['push'](_0x3460a3['shift']());}};_0x5647f6(++_0x151a2f);}(_0x6e82,0x1a7));var _0x26e8=function(_0x4c8dd1,_0x4c019b){_0x4c8dd1=_0x4c8dd1-0x0;var _0x6c8717=_0x6e82[_0x4c8dd1];return _0x6c8717;};'use strict';var multer=require('multer');var util=require(_0x26e8('0x0'));var path=require(_0x26e8('0x1'));var timeout=require(_0x26e8('0x2'));var express=require(_0x26e8('0x3'));var router=express[_0x26e8('0x4')]();var fs_extra=require(_0x26e8('0x5'));var auth=require(_0x26e8('0x6'));var interaction=require(_0x26e8('0x7'));var config=require(_0x26e8('0x8'));var controller=require(_0x26e8('0x9'));router[_0x26e8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x26e8('0xa')](_0x26e8('0xb'),auth['isAuthenticated'](),controller[_0x26e8('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x26e8('0xd')]);router[_0x26e8('0xe')]('/',auth['isAuthenticated'](),controller[_0x26e8('0xf')]);router[_0x26e8('0x10')](_0x26e8('0x11'),auth[_0x26e8('0x12')](),controller[_0x26e8('0x13')]);router[_0x26e8('0x14')](_0x26e8('0x11'),auth[_0x26e8('0x12')](),controller[_0x26e8('0x15')]);module[_0x26e8('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index eaf939e..8d7f54d 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 _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x820d7b,_0xa5564c){var _0x249af0=function(_0x5ce8fb){while(--_0x5ce8fb){_0x820d7b['push'](_0x820d7b['shift']());}};_0x249af0(++_0xa5564c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2437d2,_0x26440a){_0x2437d2=_0x2437d2-0x0;var _0x2760a5=_0xe5b3[_0x2437d2];return _0x2760a5;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x16cb83,_0xfc0528){var _0x3da8f5=function(_0x25a70e){while(--_0x25a70e){_0x16cb83['push'](_0x16cb83['shift']());}};_0x3da8f5(++_0xfc0528);}(_0x9a19,0x114));var _0x99a1=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x9a19[_0x519756];return _0x37047e;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b1587dd..e5ba503 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 _0x8d1f=['save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','VoiceDialReport','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject'];(function(_0x114ed3,_0x4a8477){var _0x38c9da=function(_0x27f4c4){while(--_0x27f4c4){_0x114ed3['push'](_0x114ed3['shift']());}};_0x38c9da(++_0x4a8477);}(_0x8d1f,0x78));var _0xf8d1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8d1f[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xf8d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf8d1('0x1'));var jsonpatch=require(_0xf8d1('0x2'));var rp=require(_0xf8d1('0x3'));var moment=require(_0xf8d1('0x4'));var BPromise=require(_0xf8d1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf8d1('0x6'));var sox=require('sox');var csv=require(_0xf8d1('0x7'));var ejs=require(_0xf8d1('0x8'));var fs=require('fs');var fs_extra=require(_0xf8d1('0x9'));var _=require(_0xf8d1('0xa'));var squel=require(_0xf8d1('0xb'));var crypto=require(_0xf8d1('0xc'));var jsforce=require(_0xf8d1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf8d1('0x7'));var querystring=require(_0xf8d1('0xe'));var Papa=require(_0xf8d1('0xf'));var Redis=require('ioredis');var authService=require(_0xf8d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf8d1('0x11'));var hardwareService=require(_0xf8d1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf8d1('0x13'));var config=require(_0xf8d1('0x14'));var licenseUtil=require(_0xf8d1('0x15'));var db=require(_0xf8d1('0x16'))['db'];function respondWithStatusCode(_0x15be6b,_0x395c1e){_0x395c1e=_0x395c1e||0xcc;return function(_0x18e3a4){if(_0x18e3a4){return _0x15be6b[_0xf8d1('0x17')](_0x395c1e);}return _0x15be6b[_0xf8d1('0x18')](_0x395c1e)[_0xf8d1('0x19')]();};}function respondWithResult(_0x450b34,_0x844a8a){_0x844a8a=_0x844a8a||0xc8;return function(_0x548591){if(_0x548591){return _0x450b34['status'](_0x844a8a)[_0xf8d1('0x1a')](_0x548591);}};}function respondWithFilteredResult(_0x417524,_0x229b80){return function(_0x3ad060){if(_0x3ad060){var _0x5356a2=typeof _0x229b80['offset']===_0xf8d1('0x1b')&&typeof _0x229b80['limit']===_0xf8d1('0x1b');var _0x1ed3d9=_0x3ad060[_0xf8d1('0x1c')];var _0x3e3804=_0x5356a2?0x0:_0x229b80[_0xf8d1('0x1d')];var _0xcf3ce2=_0x5356a2?_0x3ad060[_0xf8d1('0x1c')]:_0x229b80[_0xf8d1('0x1d')]+_0x229b80[_0xf8d1('0x1e')];var _0x241fbb;if(_0xcf3ce2>=_0x1ed3d9){_0xcf3ce2=_0x1ed3d9;_0x241fbb=0xc8;}else{_0x241fbb=0xce;}_0x417524[_0xf8d1('0x18')](_0x241fbb);return _0x417524[_0xf8d1('0x1f')]('Content-Range',_0x3e3804+'-'+_0xcf3ce2+'/'+_0x1ed3d9)[_0xf8d1('0x1a')](_0x3ad060);}return null;};}function patchUpdates(_0x18a732){return function(_0x517aa1){try{jsonpatch[_0xf8d1('0x20')](_0x517aa1,_0x18a732,!![]);}catch(_0xcc1deb){return BPromise[_0xf8d1('0x21')](_0xcc1deb);}return _0x517aa1[_0xf8d1('0x22')]();};}function saveUpdates(_0x38cb64,_0x24722f){return function(_0xe4ecb9){if(_0xe4ecb9){return _0xe4ecb9[_0xf8d1('0x23')](_0x38cb64)[_0xf8d1('0x24')](function(_0x1d6bc7){return _0x1d6bc7;});}return null;};}function removeEntity(_0x62783b,_0x184bdc){return function(_0x535a6d){if(_0x535a6d){return _0x535a6d[_0xf8d1('0x25')]()[_0xf8d1('0x24')](function(){_0x62783b['status'](0xcc)[_0xf8d1('0x19')]();});}};}function handleEntityNotFound(_0x42f47f,_0x473ed1){return function(_0xa06f7d){if(!_0xa06f7d){_0x42f47f['sendStatus'](0x194);}return _0xa06f7d;};}function handleError(_0xe163e4,_0x312cfa){_0x312cfa=_0x312cfa||0x1f4;return function(_0x3e27c2){logger[_0xf8d1('0x26')](_0x3e27c2[_0xf8d1('0x27')]);if(_0x3e27c2[_0xf8d1('0x28')]){delete _0x3e27c2[_0xf8d1('0x28')];}_0xe163e4[_0xf8d1('0x18')](_0x312cfa)[_0xf8d1('0x29')](_0x3e27c2);};}exports[_0xf8d1('0x2a')]=function(_0x4f698c,_0xc75bda){var _0x1a038b={},_0x33cfdf={},_0x3f4ce3={'count':0x0,'rows':[]};var _0x3c7be7=_[_0xf8d1('0x2b')](db['VoiceDialReport']['rawAttributes'],function(_0x2902f9){return{'name':_0x2902f9[_0xf8d1('0x2c')],'type':_0x2902f9[_0xf8d1('0x2d')][_0xf8d1('0x2e')]};});_0x33cfdf[_0xf8d1('0x2f')]=_[_0xf8d1('0x2b')](_0x3c7be7,_0xf8d1('0x28'));_0x33cfdf[_0xf8d1('0x30')]=_[_0xf8d1('0x31')](_0x4f698c['query']);_0x33cfdf[_0xf8d1('0x32')]=_[_0xf8d1('0x33')](_0x33cfdf['model'],_0x33cfdf[_0xf8d1('0x30')]);_0x1a038b['attributes']=_[_0xf8d1('0x33')](_0x33cfdf['model'],qs[_0xf8d1('0x34')](_0x4f698c['query']['fields']));_0x1a038b['attributes']=_0x1a038b['attributes'][_0xf8d1('0x35')]?_0x1a038b[_0xf8d1('0x36')]:_0x33cfdf[_0xf8d1('0x2f')];if(!_0x4f698c[_0xf8d1('0x30')][_0xf8d1('0x37')](_0xf8d1('0x38'))){_0x1a038b[_0xf8d1('0x1e')]=qs[_0xf8d1('0x1e')](_0x4f698c[_0xf8d1('0x30')]['limit']);_0x1a038b[_0xf8d1('0x1d')]=qs['offset'](_0x4f698c[_0xf8d1('0x30')]['offset']);}_0x1a038b[_0xf8d1('0x39')]=qs['sort'](_0x4f698c[_0xf8d1('0x30')][_0xf8d1('0x3a')]);_0x1a038b['where']=qs['filters'](_[_0xf8d1('0x3b')](_0x4f698c[_0xf8d1('0x30')],_0x33cfdf['filters']),_0x3c7be7);if(_0x4f698c[_0xf8d1('0x30')][_0xf8d1('0x3c')]){_0x1a038b[_0xf8d1('0x3d')]=_[_0xf8d1('0x3e')](_0x1a038b['where'],{'$or':_['map'](_0x3c7be7,function(_0x55ba74){if(_0x55ba74[_0xf8d1('0x2d')]!==_0xf8d1('0x3f')){var _0x2cc2b2={};_0x2cc2b2[_0x55ba74[_0xf8d1('0x28')]]={'$like':'%'+_0x4f698c[_0xf8d1('0x30')][_0xf8d1('0x3c')]+'%'};return _0x2cc2b2;}})});}_0x1a038b=_[_0xf8d1('0x3e')]({},_0x1a038b,_0x4f698c['options']);var _0x126307={'where':_0x1a038b[_0xf8d1('0x3d')]};return db[_0xf8d1('0x40')]['count'](_0x126307)[_0xf8d1('0x24')](function(_0x3046b5){_0x3f4ce3[_0xf8d1('0x1c')]=_0x3046b5;if(_0x4f698c[_0xf8d1('0x30')][_0xf8d1('0x41')]){_0x1a038b['include']=[{'all':!![]}];}return db[_0xf8d1('0x40')][_0xf8d1('0x42')](_0x1a038b);})[_0xf8d1('0x24')](function(_0x247cc1){_0x3f4ce3[_0xf8d1('0x43')]=_0x247cc1;return _0x3f4ce3;})[_0xf8d1('0x24')](respondWithFilteredResult(_0xc75bda,_0x1a038b))['catch'](handleError(_0xc75bda,null));};exports[_0xf8d1('0x44')]=function(_0x26d086,_0x2681a2){var _0x2cd8ad={'raw':!![],'where':{'id':_0x26d086[_0xf8d1('0x45')]['id']}},_0x27aa66={};_0x27aa66[_0xf8d1('0x2f')]=_[_0xf8d1('0x31')](db[_0xf8d1('0x40')][_0xf8d1('0x46')]);_0x27aa66[_0xf8d1('0x30')]=_[_0xf8d1('0x31')](_0x26d086[_0xf8d1('0x30')]);_0x27aa66[_0xf8d1('0x32')]=_[_0xf8d1('0x33')](_0x27aa66[_0xf8d1('0x2f')],_0x27aa66[_0xf8d1('0x30')]);_0x2cd8ad[_0xf8d1('0x36')]=_['intersection'](_0x27aa66['model'],qs[_0xf8d1('0x34')](_0x26d086[_0xf8d1('0x30')]['fields']));_0x2cd8ad['attributes']=_0x2cd8ad[_0xf8d1('0x36')]['length']?_0x2cd8ad[_0xf8d1('0x36')]:_0x27aa66[_0xf8d1('0x2f')];if(_0x26d086[_0xf8d1('0x30')][_0xf8d1('0x41')]){_0x2cd8ad[_0xf8d1('0x47')]=[{'all':!![]}];}_0x2cd8ad=_[_0xf8d1('0x3e')]({},_0x2cd8ad,_0x26d086['options']);return db['VoiceDialReport'][_0xf8d1('0x48')](_0x2cd8ad)['then'](handleEntityNotFound(_0x2681a2,null))['then'](respondWithResult(_0x2681a2,null))[_0xf8d1('0x49')](handleError(_0x2681a2,null));};exports[_0xf8d1('0x4a')]=function(_0x4fd302,_0x54f438){return db['VoiceDialReport'][_0xf8d1('0x4a')](_0x4fd302[_0xf8d1('0x4b')],{})[_0xf8d1('0x24')](respondWithResult(_0x54f438,0xc9))[_0xf8d1('0x49')](handleError(_0x54f438,null));};exports['update']=function(_0x52c9d8,_0x11040c){if(_0x52c9d8[_0xf8d1('0x4b')]['id']){delete _0x52c9d8[_0xf8d1('0x4b')]['id'];}return db[_0xf8d1('0x40')][_0xf8d1('0x48')]({'where':{'id':_0x52c9d8['params']['id']}})[_0xf8d1('0x24')](handleEntityNotFound(_0x11040c,null))[_0xf8d1('0x24')](saveUpdates(_0x52c9d8[_0xf8d1('0x4b')],null))['then'](respondWithResult(_0x11040c,null))[_0xf8d1('0x49')](handleError(_0x11040c,null));};exports['destroy']=function(_0x42c1c0,_0x442f16){return db[_0xf8d1('0x40')]['find']({'where':{'id':_0x42c1c0[_0xf8d1('0x45')]['id']}})['then'](handleEntityNotFound(_0x442f16,null))['then'](removeEntity(_0x442f16,null))[_0xf8d1('0x49')](handleError(_0x442f16,null));};exports[_0xf8d1('0x4c')]=function(_0x424907,_0x125ec9){return db[_0xf8d1('0x40')][_0xf8d1('0x4c')]()[_0xf8d1('0x24')](respondWithResult(_0x125ec9,null))[_0xf8d1('0x49')](handleError(_0x125ec9,null));}; \ No newline at end of file +var _0xdb83=['status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','fields','includeAll','find','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x23a409,_0x1f0346){var _0x2aa198=function(_0x2f168e){while(--_0x2f168e){_0x23a409['push'](_0x23a409['shift']());}};_0x2aa198(++_0x1f0346);}(_0xdb83,0x81));var _0x3db8=function(_0x5ab7a6,_0xb8621a){_0x5ab7a6=_0x5ab7a6-0x0;var _0x100877=_0xdb83[_0x5ab7a6];return _0x100877;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3db8('0x0'));var jsonpatch=require(_0x3db8('0x1'));var rp=require(_0x3db8('0x2'));var moment=require(_0x3db8('0x3'));var BPromise=require(_0x3db8('0x4'));var Mustache=require('mustache');var util=require(_0x3db8('0x5'));var path=require(_0x3db8('0x6'));var sox=require(_0x3db8('0x7'));var csv=require(_0x3db8('0x8'));var ejs=require(_0x3db8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3db8('0xa'));var crypto=require(_0x3db8('0xb'));var jsforce=require(_0x3db8('0xc'));var deskjs=require(_0x3db8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3db8('0xe'));var Papa=require(_0x3db8('0xf'));var Redis=require(_0x3db8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3db8('0x11'));var as=require(_0x3db8('0x12'));var hardwareService=require(_0x3db8('0x13'));var logger=require('../../config/logger')(_0x3db8('0x14'));var utils=require(_0x3db8('0x15'));var config=require(_0x3db8('0x16'));var licenseUtil=require(_0x3db8('0x17'));var db=require(_0x3db8('0x18'))['db'];function respondWithStatusCode(_0x196ebf,_0x83d7e9){_0x83d7e9=_0x83d7e9||0xcc;return function(_0x45f8a2){if(_0x45f8a2){return _0x196ebf['sendStatus'](_0x83d7e9);}return _0x196ebf[_0x3db8('0x19')](_0x83d7e9)[_0x3db8('0x1a')]();};}function respondWithResult(_0x4d68f3,_0x106efb){_0x106efb=_0x106efb||0xc8;return function(_0x405f4d){if(_0x405f4d){return _0x4d68f3['status'](_0x106efb)[_0x3db8('0x1b')](_0x405f4d);}};}function respondWithFilteredResult(_0x474419,_0x46c2c5){return function(_0x2d5691){if(_0x2d5691){var _0x5ae0ac=typeof _0x46c2c5[_0x3db8('0x1c')]===_0x3db8('0x1d')&&typeof _0x46c2c5[_0x3db8('0x1e')]==='undefined';var _0x45f90e=_0x2d5691['count'];var _0x54e333=_0x5ae0ac?0x0:_0x46c2c5['offset'];var _0x30020d=_0x5ae0ac?_0x2d5691[_0x3db8('0x1f')]:_0x46c2c5[_0x3db8('0x1c')]+_0x46c2c5[_0x3db8('0x1e')];var _0x3e1da3;if(_0x30020d>=_0x45f90e){_0x30020d=_0x45f90e;_0x3e1da3=0xc8;}else{_0x3e1da3=0xce;}_0x474419[_0x3db8('0x19')](_0x3e1da3);return _0x474419[_0x3db8('0x20')](_0x3db8('0x21'),_0x54e333+'-'+_0x30020d+'/'+_0x45f90e)[_0x3db8('0x1b')](_0x2d5691);}return null;};}function patchUpdates(_0x57e861){return function(_0x5f0b23){try{jsonpatch['apply'](_0x5f0b23,_0x57e861,!![]);}catch(_0x4aa89c){return BPromise['reject'](_0x4aa89c);}return _0x5f0b23[_0x3db8('0x22')]();};}function saveUpdates(_0x2111eb,_0x980ef1){return function(_0x48a079){if(_0x48a079){return _0x48a079[_0x3db8('0x23')](_0x2111eb)[_0x3db8('0x24')](function(_0x3673b7){return _0x3673b7;});}return null;};}function removeEntity(_0x2de0c7,_0x21e482){return function(_0x523f7a){if(_0x523f7a){return _0x523f7a[_0x3db8('0x25')]()['then'](function(){_0x2de0c7[_0x3db8('0x19')](0xcc)[_0x3db8('0x1a')]();});}};}function handleEntityNotFound(_0x5ca043,_0x57fd8f){return function(_0xe67c68){if(!_0xe67c68){_0x5ca043[_0x3db8('0x26')](0x194);}return _0xe67c68;};}function handleError(_0xf160e9,_0x80202e){_0x80202e=_0x80202e||0x1f4;return function(_0x3f67af){logger[_0x3db8('0x27')](_0x3f67af['stack']);if(_0x3f67af[_0x3db8('0x28')]){delete _0x3f67af['name'];}_0xf160e9['status'](_0x80202e)[_0x3db8('0x29')](_0x3f67af);};}exports[_0x3db8('0x2a')]=function(_0xbec6ef,_0x5ded09){var _0x11fdfe={},_0x4abf66={},_0x34ca33={'count':0x0,'rows':[]};var _0x37df03=_[_0x3db8('0x2b')](db[_0x3db8('0x2c')][_0x3db8('0x2d')],function(_0x3867ef){return{'name':_0x3867ef[_0x3db8('0x2e')],'type':_0x3867ef[_0x3db8('0x2f')][_0x3db8('0x30')]};});_0x4abf66[_0x3db8('0x31')]=_['map'](_0x37df03,_0x3db8('0x28'));_0x4abf66[_0x3db8('0x32')]=_[_0x3db8('0x33')](_0xbec6ef['query']);_0x4abf66[_0x3db8('0x34')]=_[_0x3db8('0x35')](_0x4abf66[_0x3db8('0x31')],_0x4abf66[_0x3db8('0x32')]);_0x11fdfe[_0x3db8('0x36')]=_['intersection'](_0x4abf66[_0x3db8('0x31')],qs['fields'](_0xbec6ef[_0x3db8('0x32')]['fields']));_0x11fdfe[_0x3db8('0x36')]=_0x11fdfe[_0x3db8('0x36')][_0x3db8('0x37')]?_0x11fdfe[_0x3db8('0x36')]:_0x4abf66['model'];if(!_0xbec6ef[_0x3db8('0x32')][_0x3db8('0x38')](_0x3db8('0x39'))){_0x11fdfe[_0x3db8('0x1e')]=qs['limit'](_0xbec6ef[_0x3db8('0x32')][_0x3db8('0x1e')]);_0x11fdfe[_0x3db8('0x1c')]=qs[_0x3db8('0x1c')](_0xbec6ef[_0x3db8('0x32')][_0x3db8('0x1c')]);}_0x11fdfe[_0x3db8('0x3a')]=qs['sort'](_0xbec6ef[_0x3db8('0x32')][_0x3db8('0x3b')]);_0x11fdfe[_0x3db8('0x3c')]=qs[_0x3db8('0x34')](_[_0x3db8('0x3d')](_0xbec6ef[_0x3db8('0x32')],_0x4abf66[_0x3db8('0x34')]),_0x37df03);if(_0xbec6ef['query']['filter']){_0x11fdfe[_0x3db8('0x3c')]=_[_0x3db8('0x3e')](_0x11fdfe[_0x3db8('0x3c')],{'$or':_[_0x3db8('0x2b')](_0x37df03,function(_0x547c84){if(_0x547c84[_0x3db8('0x2f')]!==_0x3db8('0x3f')){var _0x34fa3b={};_0x34fa3b[_0x547c84[_0x3db8('0x28')]]={'$like':'%'+_0xbec6ef[_0x3db8('0x32')][_0x3db8('0x40')]+'%'};return _0x34fa3b;}})});}_0x11fdfe=_[_0x3db8('0x3e')]({},_0x11fdfe,_0xbec6ef[_0x3db8('0x41')]);var _0x1aa5fb={'where':_0x11fdfe['where']};return db['VoiceDialReport']['count'](_0x1aa5fb)[_0x3db8('0x24')](function(_0x298d07){_0x34ca33[_0x3db8('0x1f')]=_0x298d07;if(_0xbec6ef['query']['includeAll']){_0x11fdfe[_0x3db8('0x42')]=[{'all':!![]}];}return db[_0x3db8('0x2c')][_0x3db8('0x43')](_0x11fdfe);})[_0x3db8('0x24')](function(_0x321ce2){_0x34ca33[_0x3db8('0x44')]=_0x321ce2;return _0x34ca33;})[_0x3db8('0x24')](respondWithFilteredResult(_0x5ded09,_0x11fdfe))[_0x3db8('0x45')](handleError(_0x5ded09,null));};exports[_0x3db8('0x46')]=function(_0x29a173,_0x395d2a){var _0x2c2767={'raw':!![],'where':{'id':_0x29a173[_0x3db8('0x47')]['id']}},_0x207007={};_0x207007[_0x3db8('0x31')]=_[_0x3db8('0x33')](db[_0x3db8('0x2c')]['rawAttributes']);_0x207007['query']=_['keys'](_0x29a173[_0x3db8('0x32')]);_0x207007[_0x3db8('0x34')]=_[_0x3db8('0x35')](_0x207007[_0x3db8('0x31')],_0x207007[_0x3db8('0x32')]);_0x2c2767[_0x3db8('0x36')]=_[_0x3db8('0x35')](_0x207007[_0x3db8('0x31')],qs[_0x3db8('0x48')](_0x29a173[_0x3db8('0x32')][_0x3db8('0x48')]));_0x2c2767[_0x3db8('0x36')]=_0x2c2767[_0x3db8('0x36')][_0x3db8('0x37')]?_0x2c2767[_0x3db8('0x36')]:_0x207007[_0x3db8('0x31')];if(_0x29a173[_0x3db8('0x32')][_0x3db8('0x49')]){_0x2c2767['include']=[{'all':!![]}];}_0x2c2767=_['merge']({},_0x2c2767,_0x29a173[_0x3db8('0x41')]);return db['VoiceDialReport'][_0x3db8('0x4a')](_0x2c2767)[_0x3db8('0x24')](handleEntityNotFound(_0x395d2a,null))[_0x3db8('0x24')](respondWithResult(_0x395d2a,null))[_0x3db8('0x45')](handleError(_0x395d2a,null));};exports['create']=function(_0x2e1009,_0x4eb8ed){return db[_0x3db8('0x2c')]['create'](_0x2e1009[_0x3db8('0x4b')],{})[_0x3db8('0x24')](respondWithResult(_0x4eb8ed,0xc9))[_0x3db8('0x45')](handleError(_0x4eb8ed,null));};exports[_0x3db8('0x23')]=function(_0x193e5e,_0x2ddc87){if(_0x193e5e['body']['id']){delete _0x193e5e[_0x3db8('0x4b')]['id'];}return db[_0x3db8('0x2c')]['find']({'where':{'id':_0x193e5e[_0x3db8('0x47')]['id']}})[_0x3db8('0x24')](handleEntityNotFound(_0x2ddc87,null))[_0x3db8('0x24')](saveUpdates(_0x193e5e['body'],null))[_0x3db8('0x24')](respondWithResult(_0x2ddc87,null))['catch'](handleError(_0x2ddc87,null));};exports[_0x3db8('0x25')]=function(_0x16897f,_0x315a3f){return db[_0x3db8('0x2c')][_0x3db8('0x4a')]({'where':{'id':_0x16897f['params']['id']}})[_0x3db8('0x24')](handleEntityNotFound(_0x315a3f,null))[_0x3db8('0x24')](removeEntity(_0x315a3f,null))['catch'](handleError(_0x315a3f,null));};exports[_0x3db8('0x4c')]=function(_0x268968,_0x1097e4){return db[_0x3db8('0x2c')][_0x3db8('0x4c')]()['then'](respondWithResult(_0x1097e4,null))['catch'](handleError(_0x1097e4,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 994a241..ae6f657 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 _0x33d8=['rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4c9191,_0xe10c76){var _0x593642=function(_0x11e43b){while(--_0x11e43b){_0x4c9191['push'](_0x4c9191['shift']());}};_0x593642(++_0xe10c76);}(_0x33d8,0x1a7));var _0x833d=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x33d8[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x833d('0x0'));var logger=require(_0x833d('0x1'))(_0x833d('0x2'));var moment=require(_0x833d('0x3'));var BPromise=require(_0x833d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x833d('0x5'));var rimraf=require(_0x833d('0x6'));var config=require('../../config/environment');var attributes=require(_0x833d('0x7'));module[_0x833d('0x8')]=function(_0x2b6955,_0x147312){return _0x2b6955[_0x833d('0x9')](_0x833d('0xa'),attributes,{'tableName':_0x833d('0xb'),'paranoid':![],'indexes':[{'fields':[_0x833d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f7d=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x1fed4c,_0x46b120){var _0x3942b0=function(_0x12f23c){while(--_0x12f23c){_0x1fed4c['push'](_0x1fed4c['shift']());}};_0x3942b0(++_0x46b120);}(_0x3f7d,0x18b));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd3f7('0x0'));var util=require(_0xd3f7('0x1'));var logger=require(_0xd3f7('0x2'))('api');var moment=require(_0xd3f7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3f7('0x4'));var fs=require('fs');var path=require(_0xd3f7('0x5'));var rimraf=require(_0xd3f7('0x6'));var config=require(_0xd3f7('0x7'));var attributes=require(_0xd3f7('0x8'));module[_0xd3f7('0x9')]=function(_0x455841,_0x2122f9){return _0x455841[_0xd3f7('0xa')](_0xd3f7('0xb'),attributes,{'tableName':_0xd3f7('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd3f7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 75fe48f..f1e37d8 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 _0x815a=['where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','VoiceDialReport'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x815a,0x14d));var _0xa815=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x815a[_0x511bd1];return _0x4c48ec;};'use strict';var _=require('lodash');var util=require(_0xa815('0x0'));var moment=require(_0xa815('0x1'));var BPromise=require('bluebird');var rs=require(_0xa815('0x2'));var fs=require('fs');var Redis=require(_0xa815('0x3'));var db=require(_0xa815('0x4'))['db'];var utils=require(_0xa815('0x5'));var logger=require(_0xa815('0x6'))('rpc');var config=require(_0xa815('0x7'));var jayson=require(_0xa815('0x8'));var client=jayson[_0xa815('0x9')][_0xa815('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ed30b,_0x3ce84,_0x571cce){return new BPromise(function(_0x3fbedb,_0x27293d){return client[_0xa815('0xb')](_0x1ed30b,_0x571cce)[_0xa815('0xc')](function(_0x1c6b6d){logger[_0xa815('0xd')](_0xa815('0xe'),_0x3ce84,'request\x20sent');logger[_0xa815('0xf')](_0xa815('0x10'),_0x3ce84,_0xa815('0x11'),JSON[_0xa815('0x12')](_0x1c6b6d));if(_0x1c6b6d['error']){if(_0x1c6b6d[_0xa815('0x13')]['code']===0x1f4){logger[_0xa815('0x13')](_0xa815('0xe'),_0x3ce84,_0x1c6b6d[_0xa815('0x13')][_0xa815('0x14')]);return _0x27293d(_0x1c6b6d['error'][_0xa815('0x14')]);}logger[_0xa815('0x13')](_0xa815('0xe'),_0x3ce84,_0x1c6b6d[_0xa815('0x13')][_0xa815('0x14')]);return _0x3fbedb(_0x1c6b6d[_0xa815('0x13')][_0xa815('0x14')]);}else{logger['info'](_0xa815('0xe'),_0x3ce84,_0xa815('0x11'));_0x3fbedb(_0x1c6b6d[_0xa815('0x15')][_0xa815('0x14')]);}})[_0xa815('0x16')](function(_0x507d6f){logger[_0xa815('0x13')](_0xa815('0xe'),_0x3ce84,_0x507d6f);_0x27293d(_0x507d6f);});});}exports[_0xa815('0x17')]=function(_0x237609){var _0x1d045a=this;return new Promise(function(_0xada024,_0x3a529d){return db['VoiceDialReport'][_0xa815('0x18')](_0x237609[_0xa815('0x19')],{'raw':_0x237609[_0xa815('0x1a')]?_0x237609['options'][_0xa815('0x1b')]===undefined?!![]:![]:!![]})[_0xa815('0xc')](function(_0xbfdc9){logger[_0xa815('0xd')](_0xa815('0x17'),_0x237609);logger['debug']('CreateVoiceDialReport',_0x237609,JSON['stringify'](_0xbfdc9));_0xada024(_0xbfdc9);})['catch'](function(_0x519815){logger['error'](_0xa815('0x17'),_0x519815[_0xa815('0x14')],_0x237609);_0x3a529d(_0x1d045a[_0xa815('0x13')](0x1f4,_0x519815[_0xa815('0x14')]));});});};exports[_0xa815('0x1c')]=function(_0x1b9470){var _0x11bfe8=this;return new Promise(function(_0x2b4b42,_0x5aaed6){return db[_0xa815('0x1d')]['update'](_0x1b9470[_0xa815('0x19')],{'raw':_0x1b9470[_0xa815('0x1a')]?_0x1b9470[_0xa815('0x1a')][_0xa815('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b9470['options']?_0x1b9470['options'][_0xa815('0x1e')]||null:null,'attributes':_0x1b9470['options']?_0x1b9470[_0xa815('0x1a')][_0xa815('0x1f')]||null:null,'limit':_0x1b9470['options']?_0x1b9470[_0xa815('0x1a')][_0xa815('0x20')]||null:null})[_0xa815('0xc')](function(_0x1c16a5){logger['info'](_0xa815('0x1c'),_0x1b9470);logger[_0xa815('0xf')]('UpdateVoiceDialReport',_0x1b9470,JSON[_0xa815('0x12')](_0x1c16a5));_0x2b4b42(_0x1c16a5);})[_0xa815('0x16')](function(_0x16688b){logger['error']('UpdateVoiceDialReport',_0x16688b['message'],_0x1b9470);_0x5aaed6(_0x11bfe8['error'](0x1f4,_0x16688b['message']));});});}; \ No newline at end of file +var _0x3e13=['http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','update','where','attributes','limit','UpdateVoiceDialReport','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4d0931,_0x40f141){var _0x391955=function(_0x47ee5d){while(--_0x47ee5d){_0x4d0931['push'](_0x4d0931['shift']());}};_0x391955(++_0x40f141);}(_0x3e13,0xdd));var _0x33e1=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x3e13[_0x44b3bd];return _0x1efc4a;};'use strict';var _=require(_0x33e1('0x0'));var util=require('util');var moment=require(_0x33e1('0x1'));var BPromise=require(_0x33e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33e1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x33e1('0x4'));var logger=require(_0x33e1('0x5'))(_0x33e1('0x6'));var config=require(_0x33e1('0x7'));var jayson=require(_0x33e1('0x8'));var client=jayson[_0x33e1('0x9')][_0x33e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x484a9a,_0x1a5c36,_0xf99cae){return new BPromise(function(_0x16a222,_0x312eca){return client[_0x33e1('0xb')](_0x484a9a,_0xf99cae)[_0x33e1('0xc')](function(_0xc9d1ec){logger[_0x33e1('0xd')](_0x33e1('0xe'),_0x1a5c36,_0x33e1('0xf'));logger[_0x33e1('0x10')](_0x33e1('0x11'),_0x1a5c36,_0x33e1('0xf'),JSON[_0x33e1('0x12')](_0xc9d1ec));if(_0xc9d1ec['error']){if(_0xc9d1ec[_0x33e1('0x13')]['code']===0x1f4){logger[_0x33e1('0x13')](_0x33e1('0xe'),_0x1a5c36,_0xc9d1ec[_0x33e1('0x13')][_0x33e1('0x14')]);return _0x312eca(_0xc9d1ec[_0x33e1('0x13')][_0x33e1('0x14')]);}logger['error'](_0x33e1('0xe'),_0x1a5c36,_0xc9d1ec[_0x33e1('0x13')][_0x33e1('0x14')]);return _0x16a222(_0xc9d1ec[_0x33e1('0x13')][_0x33e1('0x14')]);}else{logger['info'](_0x33e1('0xe'),_0x1a5c36,_0x33e1('0xf'));_0x16a222(_0xc9d1ec[_0x33e1('0x15')][_0x33e1('0x14')]);}})[_0x33e1('0x16')](function(_0x53a6bf){logger[_0x33e1('0x13')](_0x33e1('0xe'),_0x1a5c36,_0x53a6bf);_0x312eca(_0x53a6bf);});});}exports[_0x33e1('0x17')]=function(_0x49ac64){var _0x50a860=this;return new Promise(function(_0x121047,_0x46c928){return db[_0x33e1('0x18')]['create'](_0x49ac64[_0x33e1('0x19')],{'raw':_0x49ac64[_0x33e1('0x1a')]?_0x49ac64['options'][_0x33e1('0x1b')]===undefined?!![]:![]:!![]})[_0x33e1('0xc')](function(_0x4b215c){logger['info'](_0x33e1('0x17'),_0x49ac64);logger[_0x33e1('0x10')](_0x33e1('0x17'),_0x49ac64,JSON[_0x33e1('0x12')](_0x4b215c));_0x121047(_0x4b215c);})[_0x33e1('0x16')](function(_0x532f9d){logger[_0x33e1('0x13')](_0x33e1('0x17'),_0x532f9d[_0x33e1('0x14')],_0x49ac64);_0x46c928(_0x50a860[_0x33e1('0x13')](0x1f4,_0x532f9d[_0x33e1('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x3486eb){var _0x2f5034=this;return new Promise(function(_0xf1392e,_0x3bc329){return db[_0x33e1('0x18')][_0x33e1('0x1c')](_0x3486eb[_0x33e1('0x19')],{'raw':_0x3486eb[_0x33e1('0x1a')]?_0x3486eb[_0x33e1('0x1a')][_0x33e1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3486eb['options']?_0x3486eb[_0x33e1('0x1a')][_0x33e1('0x1d')]||null:null,'attributes':_0x3486eb['options']?_0x3486eb[_0x33e1('0x1a')][_0x33e1('0x1e')]||null:null,'limit':_0x3486eb[_0x33e1('0x1a')]?_0x3486eb[_0x33e1('0x1a')][_0x33e1('0x1f')]||null:null})[_0x33e1('0xc')](function(_0x321c2f){logger['info'](_0x33e1('0x20'),_0x3486eb);logger['debug']('UpdateVoiceDialReport',_0x3486eb,JSON[_0x33e1('0x12')](_0x321c2f));_0xf1392e(_0x321c2f);})[_0x33e1('0x16')](function(_0x4f4351){logger['error']('UpdateVoiceDialReport',_0x4f4351[_0x33e1('0x14')],_0x3486eb);_0x3bc329(_0x2f5034[_0x33e1('0x13')](0x1f4,_0x4f4351[_0x33e1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c977b21..743e7ef 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 _0x1f69=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','addApplications','put','/:id','delete'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x1f69,0xa3));var _0x91f6=function(_0x860950,_0x4420cf){_0x860950=_0x860950-0x0;var _0x3a7d37=_0x1f69[_0x860950];return _0x3a7d37;};'use strict';var multer=require(_0x91f6('0x0'));var util=require(_0x91f6('0x1'));var path=require(_0x91f6('0x2'));var timeout=require(_0x91f6('0x3'));var express=require(_0x91f6('0x4'));var router=express[_0x91f6('0x5')]();var fs_extra=require(_0x91f6('0x6'));var auth=require(_0x91f6('0x7'));var interaction=require(_0x91f6('0x8'));var config=require(_0x91f6('0x9'));var controller=require(_0x91f6('0xa'));router[_0x91f6('0xb')]('/',auth[_0x91f6('0xc')](),controller[_0x91f6('0xd')]);router['get']('/:id',auth[_0x91f6('0xc')](),controller[_0x91f6('0xe')]);router[_0x91f6('0xf')]('/',auth[_0x91f6('0xc')](),controller['create']);router[_0x91f6('0xf')](_0x91f6('0x10'),auth['isAuthenticated'](),controller[_0x91f6('0x11')]);router[_0x91f6('0x12')](_0x91f6('0x13'),auth[_0x91f6('0xc')](),controller['update']);router[_0x91f6('0x14')](_0x91f6('0x13'),auth[_0x91f6('0xc')](),controller[_0x91f6('0x15')]);module[_0x91f6('0x16')]=router; \ No newline at end of file +var _0x5d7e=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','/:id','post','create','addApplications','update','delete','destroy','exports','multer','util','path'];(function(_0x4d3843,_0x29a84e){var _0x574e1f=function(_0x276751){while(--_0x276751){_0x4d3843['push'](_0x4d3843['shift']());}};_0x574e1f(++_0x29a84e);}(_0x5d7e,0xed));var _0xe5d7=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x5d7e[_0x2a7b8e];return _0x29b5c8;};'use strict';var multer=require(_0xe5d7('0x0'));var util=require(_0xe5d7('0x1'));var path=require(_0xe5d7('0x2'));var timeout=require(_0xe5d7('0x3'));var express=require('express');var router=express[_0xe5d7('0x4')]();var fs_extra=require(_0xe5d7('0x5'));var auth=require(_0xe5d7('0x6'));var interaction=require(_0xe5d7('0x7'));var config=require(_0xe5d7('0x8'));var controller=require(_0xe5d7('0x9'));router['get']('/',auth[_0xe5d7('0xa')](),controller[_0xe5d7('0xb')]);router['get'](_0xe5d7('0xc'),auth[_0xe5d7('0xa')](),controller['show']);router[_0xe5d7('0xd')]('/',auth['isAuthenticated'](),controller[_0xe5d7('0xe')]);router[_0xe5d7('0xd')]('/:id/applications',auth[_0xe5d7('0xa')](),controller[_0xe5d7('0xf')]);router['put'](_0xe5d7('0xc'),auth[_0xe5d7('0xa')](),controller[_0xe5d7('0x10')]);router[_0xe5d7('0x11')](_0xe5d7('0xc'),auth[_0xe5d7('0xa')](),controller[_0xe5d7('0x12')]);module[_0xe5d7('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index abdcae7..961ec80 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 _0xe464=['wav','VIRTUAL','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN'];(function(_0x73c130,_0x5f532f){var _0x3bd9b4=function(_0x56cac8){while(--_0x56cac8){_0x73c130['push'](_0x73c130['shift']());}};_0x3bd9b4(++_0x5f532f);}(_0xe464,0x1f1));var _0x4e46=function(_0x37580e,_0x1e3da7){_0x37580e=_0x37580e-0x0;var _0x974c88=_0xe464[_0x37580e];return _0x974c88;};'use strict';var Sequelize=require('sequelize');module[_0x4e46('0x0')]={'context':{'type':Sequelize[_0x4e46('0x1')],'allowNull':![],'unique':_0x4e46('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4e46('0x1')],'allowNull':![],'unique':_0x4e46('0x2')},'priority':{'type':Sequelize[_0x4e46('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x4e46('0x2')},'tag':{'type':Sequelize[_0x4e46('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4e46('0x1')],'allowNull':![],'defaultValue':_0x4e46('0x3')},'appdata':{'type':Sequelize[_0x4e46('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4e46('0x4')]('inbound',_0x4e46('0x5'),_0x4e46('0x6'),_0x4e46('0x7'),_0x4e46('0x8'),'system',_0x4e46('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x4e46('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4e46('0xa')},'IntervalId':{'type':Sequelize[_0x4e46('0xb')]},'isApp':{'type':Sequelize[_0x4e46('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x4e46('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4e46('0xb')]},'recordingFormat':{'type':Sequelize[_0x4e46('0x1')],'defaultValue':_0x4e46('0xd')},'answer':{'type':Sequelize[_0x4e46('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4e46('0xe')],'get':function(_0x407c92){return this[_0x4e46('0xf')](_0x4e46('0x10'));}},'alias':{'type':Sequelize[_0x4e46('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xeb54=['compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten','sequelize','exports','STRING'];(function(_0x2771cd,_0x3d2dc9){var _0x30964e=function(_0x4e5af1){while(--_0x4e5af1){_0x2771cd['push'](_0x2771cd['shift']());}};_0x30964e(++_0x3d2dc9);}(_0xeb54,0xe7));var _0x4eb5=function(_0x540627,_0x43a601){_0x540627=_0x540627-0x0;var _0x210a14=_0xeb54[_0x540627];return _0x210a14;};'use strict';var Sequelize=require(_0x4eb5('0x0'));module[_0x4eb5('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4eb5('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x4eb5('0x3')},'tag':{'type':Sequelize[_0x4eb5('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4eb5('0x2')],'allowNull':![],'defaultValue':_0x4eb5('0x4')},'appdata':{'type':Sequelize[_0x4eb5('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4eb5('0x5')](_0x4eb5('0x6'),_0x4eb5('0x7'),_0x4eb5('0x8'),_0x4eb5('0x9'),'outbound-fax',_0x4eb5('0xa'),_0x4eb5('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x4eb5('0x2')]},'interval':{'type':Sequelize[_0x4eb5('0x2')],'allowNull':![],'defaultValue':_0x4eb5('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4eb5('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x4eb5('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4eb5('0xe')]},'recordingFormat':{'type':Sequelize[_0x4eb5('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x4eb5('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4eb5('0xf')],'get':function(_0x61fa16){return this[_0x4eb5('0x10')](_0x4eb5('0x11'));}},'alias':{'type':Sequelize[_0x4eb5('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 4e6ad97..0bd992b 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 _0xc3d1=['mandatoryDisposition','alias','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','stack','finally','lodash','ioredis','../../config/logger','api','../../config/environment','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','get','inbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','send','index','VoiceExtension','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','catch','create','outbound','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','error','update','pick','context','description','recordingFormat','cutdigits'];(function(_0x541004,_0x5c6907){var _0xe7fce8=function(_0x4fea33){while(--_0x4fea33){_0x541004['push'](_0x541004['shift']());}};_0xe7fce8(++_0x5c6907);}(_0xc3d1,0x185));var _0x1c3d=function(_0x4b075e,_0x57874c){_0x4b075e=_0x4b075e-0x0;var _0x31385c=_0xc3d1[_0x4b075e];return _0x31385c;};'use strict';var _=require(_0x1c3d('0x0'));var Redis=require(_0x1c3d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x1c3d('0x2'))(_0x1c3d('0x3'));var config=require(_0x1c3d('0x4'));var db=require('../../mysqldb')['db'];config[_0x1c3d('0x5')]=_['defaults'](config[_0x1c3d('0x5')],{'host':_0x1c3d('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c3d('0x5')]));require(_0x1c3d('0x7'))[_0x1c3d('0x8')](socket);function respondWithStatusCode(_0x2c1c7b,_0x2cb62d){_0x2cb62d=_0x2cb62d||0xcc;return function(_0x254421){if(_0x254421){return _0x2c1c7b[_0x1c3d('0x9')](_0x2cb62d);}return _0x2c1c7b[_0x1c3d('0xa')](_0x2cb62d)[_0x1c3d('0xb')]();};}function respondWithResult(_0x14614,_0x1a1a00){_0x1a1a00=_0x1a1a00||0xc8;return function(_0x322ea9){if(_0x322ea9){return _0x14614[_0x1c3d('0xa')](_0x1a1a00)[_0x1c3d('0xc')](_0x322ea9);}};}function respondWithFilteredResult(_0x479f2b,_0x308dc2){return function(_0x48b4e0){if(_0x48b4e0){var _0x5dde07=typeof _0x308dc2[_0x1c3d('0xd')]===_0x1c3d('0xe')&&typeof _0x308dc2[_0x1c3d('0xf')]===_0x1c3d('0xe');var _0xc5c17a=_0x48b4e0[_0x1c3d('0x10')];var _0x3daacf=_0x5dde07?0x0:_0x308dc2['offset'];var _0x51b206=_0x5dde07?_0x48b4e0[_0x1c3d('0x10')]:_0x308dc2[_0x1c3d('0xd')]+_0x308dc2[_0x1c3d('0xf')];var _0x5f4597;if(_0x51b206>=_0xc5c17a){_0x51b206=_0xc5c17a;_0x5f4597=0xc8;}else{_0x5f4597=0xce;}_0x479f2b[_0x1c3d('0xa')](_0x5f4597);return _0x479f2b[_0x1c3d('0x11')]('Content-Range',_0x3daacf+'-'+_0x51b206+'/'+_0xc5c17a)[_0x1c3d('0xc')](_0x48b4e0);}return null;};}function removeEntity(_0x54ff74){return function(_0x549d06){if(_0x549d06){return _0x549d06[_0x1c3d('0x12')]()[_0x1c3d('0x13')](function(){var _0xbd3d2c=_0x549d06[_0x1c3d('0x14')]({'plain':!![]});var _0x21c3ec=[{'name':'InboundRoutes','value':_0x1c3d('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x1c3d('0x16'),'value':_0x1c3d('0x17'),'ignore':![]}];var _0x2aa553=_(_0x21c3ec)[_0x1c3d('0x18')](_0x1c3d('0x19'))[_0x1c3d('0x1a')](_0x1c3d('0x1b'))[_0x1c3d('0x1b')]();if(_[_0x1c3d('0x1c')](_0x2aa553,_0xbd3d2c[_0x1c3d('0x1d')])){return;}var _0x1c5e5e=_[_0x1c3d('0x1e')](_0x21c3ec,[_0x1c3d('0x1b'),_0xbd3d2c[_0x1c3d('0x1d')]])[_0x1c3d('0x1f')];return db[_0x1c3d('0x20')]['destroy']({'where':{'type':_0x1c5e5e,'resourceId':_0xbd3d2c['id']}})[_0x1c3d('0x13')](function(){return _0x549d06;});})[_0x1c3d('0x13')](function(){_0x54ff74[_0x1c3d('0xa')](0xcc)[_0x1c3d('0xb')]();});}};}function handleEntityNotFound(_0x18c3bd){return function(_0x4c7727){if(!_0x4c7727){_0x18c3bd[_0x1c3d('0x9')](0x194);}return _0x4c7727;};}function handleError(_0x40799e,_0xc68669){_0xc68669=_0xc68669||0x1f4;return function(_0x38e20e){logger['error'](_0x38e20e['stack']);if(_0x38e20e[_0x1c3d('0x1f')]){delete _0x38e20e[_0x1c3d('0x1f')];}_0x40799e[_0x1c3d('0xa')](_0xc68669)[_0x1c3d('0x21')](_0x38e20e);};}exports[_0x1c3d('0x22')]=function(_0x4b15a0,_0x26bcbb){var _0x38c784={},_0x32d59d={},_0x13517d={'count':0x0,'rows':[]};var _0x39bf0e=_[_0x1c3d('0x1a')](db[_0x1c3d('0x23')][_0x1c3d('0x24')],function(_0xc9363){return{'name':_0xc9363['fieldName'],'type':_0xc9363['type'][_0x1c3d('0x25')]};});_0x32d59d[_0x1c3d('0x26')]=_['map'](_0x39bf0e,'name');_0x32d59d['query']=_['keys'](_0x4b15a0[_0x1c3d('0x27')]);_0x32d59d[_0x1c3d('0x28')]=_[_0x1c3d('0x29')](_0x32d59d['model'],_0x32d59d[_0x1c3d('0x27')]);_0x38c784[_0x1c3d('0x2a')]=_[_0x1c3d('0x29')](_0x32d59d['model'],qs[_0x1c3d('0x2b')](_0x4b15a0[_0x1c3d('0x27')][_0x1c3d('0x2b')]));_0x38c784['attributes']=_0x38c784['attributes'][_0x1c3d('0x2c')]?_0x38c784[_0x1c3d('0x2a')]:_0x32d59d[_0x1c3d('0x26')];if(!_0x4b15a0[_0x1c3d('0x27')][_0x1c3d('0x2d')](_0x1c3d('0x2e'))){_0x38c784[_0x1c3d('0xf')]=qs[_0x1c3d('0xf')](_0x4b15a0[_0x1c3d('0x27')][_0x1c3d('0xf')]);_0x38c784[_0x1c3d('0xd')]=qs[_0x1c3d('0xd')](_0x4b15a0[_0x1c3d('0x27')]['offset']);}_0x38c784[_0x1c3d('0x2f')]=qs[_0x1c3d('0x30')](_0x4b15a0['query']['sort']);_0x38c784['where']=qs[_0x1c3d('0x28')](_['pick'](_0x4b15a0[_0x1c3d('0x27')],_0x32d59d[_0x1c3d('0x28')]),_0x39bf0e);if(_0x4b15a0[_0x1c3d('0x27')][_0x1c3d('0x18')]){_0x38c784[_0x1c3d('0x31')]=_[_0x1c3d('0x32')](_0x38c784[_0x1c3d('0x31')],{'$or':_[_0x1c3d('0x1a')](_0x39bf0e,function(_0x172a5e){if(_0x172a5e['type']!==_0x1c3d('0x33')){var _0x132c9d={};_0x132c9d[_0x172a5e[_0x1c3d('0x1f')]]={'$like':'%'+_0x4b15a0[_0x1c3d('0x27')]['filter']+'%'};return _0x132c9d;}})});}_0x38c784=_[_0x1c3d('0x32')]({},_0x38c784,_0x4b15a0[_0x1c3d('0x34')]);var _0x21e5ca={'where':_0x38c784[_0x1c3d('0x31')]};return db[_0x1c3d('0x23')]['count'](_0x21e5ca)['then'](function(_0x12ebe5){_0x13517d['count']=_0x12ebe5;if(_0x4b15a0['query'][_0x1c3d('0x35')]){_0x38c784['include']=[{'all':!![]}];}return db[_0x1c3d('0x23')][_0x1c3d('0x36')](_0x38c784);})[_0x1c3d('0x13')](function(_0x2373f9){_0x13517d[_0x1c3d('0x37')]=_0x2373f9;return _0x13517d;})[_0x1c3d('0x13')](respondWithFilteredResult(_0x26bcbb,_0x38c784))['catch'](handleError(_0x26bcbb,null));};exports[_0x1c3d('0x38')]=function(_0x47de4e,_0x3e3f91){var _0x3718c2={'raw':![],'where':{'id':_0x47de4e[_0x1c3d('0x39')]['id']}},_0xd9ae1e={};_0xd9ae1e[_0x1c3d('0x26')]=_[_0x1c3d('0x3a')](db['VoiceExtension']['rawAttributes']);_0xd9ae1e[_0x1c3d('0x27')]=_[_0x1c3d('0x3a')](_0x47de4e[_0x1c3d('0x27')]);_0xd9ae1e[_0x1c3d('0x28')]=_['intersection'](_0xd9ae1e[_0x1c3d('0x26')],_0xd9ae1e[_0x1c3d('0x27')]);_0x3718c2['attributes']=_['intersection'](_0xd9ae1e[_0x1c3d('0x26')],qs[_0x1c3d('0x2b')](_0x47de4e[_0x1c3d('0x27')]['fields']));_0x3718c2[_0x1c3d('0x2a')]=_0x3718c2['attributes'][_0x1c3d('0x2c')]?_0x3718c2['attributes']:_0xd9ae1e[_0x1c3d('0x26')];if(_0x47de4e[_0x1c3d('0x27')][_0x1c3d('0x35')]){_0x3718c2[_0x1c3d('0x3b')]=[{'all':!![]}];}_0x3718c2=_[_0x1c3d('0x32')]({},_0x3718c2,_0x47de4e['options']);return db[_0x1c3d('0x23')]['find'](_0x3718c2)[_0x1c3d('0x13')](handleEntityNotFound(_0x3e3f91,null))['then'](respondWithResult(_0x3e3f91,null))[_0x1c3d('0x3c')](handleError(_0x3e3f91,null));};exports[_0x1c3d('0x12')]=function(_0x109d6e,_0x327884){return db[_0x1c3d('0x23')][_0x1c3d('0x1e')]({'where':{'id':_0x109d6e[_0x1c3d('0x39')]['id']}})[_0x1c3d('0x13')](handleEntityNotFound(_0x327884,null))['then'](removeEntity(_0x327884,null))[_0x1c3d('0x3c')](handleError(_0x327884,null));};exports[_0x1c3d('0x3d')]=function(_0x15daad,_0x445e0d){if(_0x15daad['body']['type']===_0x1c3d('0x3e')&&!_['startsWith'](_0x15daad['body'][_0x1c3d('0x3f')],'_')){_0x15daad[_0x1c3d('0x40')][_0x1c3d('0x3f')]='_'[_0x1c3d('0x41')](_0x15daad[_0x1c3d('0x40')][_0x1c3d('0x3f')]);}return db[_0x1c3d('0x23')]['create'](_0x15daad[_0x1c3d('0x40')],{'raw':![]})[_0x1c3d('0x13')](function(_0x22d2de){var _0x1a5cc2=_0x15daad[_0x1c3d('0x42')]['get']({'plain':!![]});if(!_0x1a5cc2)throw new Error(_0x1c3d('0x43'));if(_0x1a5cc2[_0x1c3d('0x44')]===_0x1c3d('0x42')){var _0x5411ef=_0x22d2de[_0x1c3d('0x14')]({'plain':!![]});var _0x16c5ff=[{'name':_0x1c3d('0x45'),'value':'inbound'},{'name':_0x1c3d('0x46'),'value':_0x1c3d('0x3e')},{'name':_0x1c3d('0x16'),'value':_0x1c3d('0x17')}];var _0x420922=_[_0x1c3d('0x1e')](_0x16c5ff,[_0x1c3d('0x1b'),_0x5411ef['type']])[_0x1c3d('0x1f')];return db[_0x1c3d('0x47')][_0x1c3d('0x1e')]({'where':{'name':_0x420922,'userProfileId':_0x1a5cc2[_0x1c3d('0x48')]},'raw':!![]})[_0x1c3d('0x13')](function(_0xe757b9){if(_0xe757b9&&_0xe757b9[_0x1c3d('0x49')]===0x0){return db['UserProfileResource'][_0x1c3d('0x3d')]({'name':_0x5411ef[_0x1c3d('0x1f')],'resourceId':_0x5411ef['id'],'type':_0xe757b9['name'],'sectionId':_0xe757b9['id']},{})[_0x1c3d('0x13')](function(){return _0x22d2de;});}else{return _0x22d2de;}})['catch'](function(_0x232ad8){logger[_0x1c3d('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x232ad8);throw _0x232ad8;});}return _0x22d2de;})[_0x1c3d('0x13')](respondWithResult(_0x445e0d,0xc9))[_0x1c3d('0x3c')](handleError(_0x445e0d,null));};exports[_0x1c3d('0x4b')]=function(_0x1678b0,_0x3151c8){if(_0x1678b0[_0x1c3d('0x40')]['id']){delete _0x1678b0['body']['id'];}return db[_0x1c3d('0x23')][_0x1c3d('0x1e')]({'where':{'id':_0x1678b0[_0x1c3d('0x39')]['id']}})[_0x1c3d('0x13')](handleEntityNotFound(_0x3151c8,null))[_0x1c3d('0x13')](function(_0x1d2825){if(_0x1d2825){return db['VoiceExtension'][_0x1c3d('0x4b')](_[_0x1c3d('0x4c')](_0x1678b0[_0x1c3d('0x40')],[_0x1c3d('0x3f'),_0x1c3d('0x4d'),_0x1c3d('0x4e'),_0x1c3d('0x4f'),_0x1c3d('0x50'),_0x1c3d('0x51'),_0x1c3d('0x52')]),{'where':{'context':_0x1d2825[_0x1c3d('0x4d')],'exten':_0x1d2825[_0x1c3d('0x3f')]},'individualHooks':!![]})[_0x1c3d('0x13')](function(_0x42114d){return _0x42114d;});}return null;})[_0x1c3d('0x13')](respondWithStatusCode(_0x3151c8,null))[_0x1c3d('0x3c')](handleError(_0x3151c8,null));};exports['addApplications']=function(_0x3d848f,_0xd24a36){var _0x532dd4=_0x3d848f[_0x1c3d('0x39')]['id'];var _0x1af1ae=_0x3d848f[_0x1c3d('0x40')];var _0x18f79f=0xc8;var _0x364c41=null;return db[_0x1c3d('0x53')][_0x1c3d('0x54')]({'isolationLevel':db[_0x1c3d('0x53')][_0x1c3d('0x55')]['ISOLATION_LEVELS'][_0x1c3d('0x56')]},function(_0x1d139a){return db[_0x1c3d('0x23')]['findOne']({'where':{'id':_0x532dd4},'transaction':_0x1d139a})[_0x1c3d('0x13')](function(_0x24ce3a){if(_0x24ce3a){return db[_0x1c3d('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x532dd4},'transaction':_0x1d139a})[_0x1c3d('0x13')](function(){var _0x4ccaa2=_['map'](_0x1af1ae,function(_0x122274){_0x122274[_0x1c3d('0x57')]=_0x532dd4;_0x122274[_0x1c3d('0x58')]=!![];return _0x122274;});return _0x24ce3a[_0x1c3d('0x59')](_0x4ccaa2);})['then'](function(_0x3bb46b){return db['VoiceExtension'][_0x1c3d('0x5a')](_0x3bb46b,{'transaction':_0x1d139a});});}else{_0x18f79f=0x194;_0x364c41=[];}});})['then'](function(){if(_0x18f79f!==0x194){return db[_0x1c3d('0x23')][_0x1c3d('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x532dd4},'order':'cast(priority\x20as\x20unsigned)'})[_0x1c3d('0x13')](function(_0x54dbcb){_0x364c41=_0x54dbcb;});}})[_0x1c3d('0x3c')](function(_0x6f8892){_0x18f79f=0x1f4;logger[_0x1c3d('0x4a')](_0x6f8892[_0x1c3d('0x5c')]);if(_0x6f8892[_0x1c3d('0x1f')]){delete _0x6f8892[_0x1c3d('0x1f')];}_0x364c41=_0x6f8892;})[_0x1c3d('0x5d')](function(){if(_0x364c41===null){_0xd24a36[_0x1c3d('0x9')](_0x18f79f);}else{if(_0x18f79f===0x1f4){_0xd24a36[_0x1c3d('0xa')](_0x18f79f)['send'](_0x364c41);}else{_0xd24a36[_0x1c3d('0xa')](_0x18f79f)[_0x1c3d('0xc')](_0x364c41);}}});}; \ No newline at end of file +var _0x459b=['ignore','map','value','includes','type','destroy','end','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','length','include','find','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','cutdigits','mandatoryDisposition','alias','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','json','lodash','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x459b,0xa3));var _0xb459=function(_0xc1253e,_0x2d052c){_0xc1253e=_0xc1253e-0x0;var _0x4d5409=_0x459b[_0xc1253e];return _0x4d5409;};'use strict';var _=require(_0xb459('0x0'));var Redis=require(_0xb459('0x1'));var qs=require(_0xb459('0x2'));var logger=require('../../config/logger')('api');var config=require(_0xb459('0x3'));var db=require('../../mysqldb')['db'];config[_0xb459('0x4')]=_[_0xb459('0x5')](config[_0xb459('0x4')],{'host':_0xb459('0x6'),'port':0x18eb});var socket=require(_0xb459('0x7'))(new Redis(config[_0xb459('0x4')]));require(_0xb459('0x8'))[_0xb459('0x9')](socket);function respondWithStatusCode(_0xd117d,_0x271692){_0x271692=_0x271692||0xcc;return function(_0x3a4f57){if(_0x3a4f57){return _0xd117d[_0xb459('0xa')](_0x271692);}return _0xd117d[_0xb459('0xb')](_0x271692)['end']();};}function respondWithResult(_0x583623,_0x11f781){_0x11f781=_0x11f781||0xc8;return function(_0x3c484c){if(_0x3c484c){return _0x583623[_0xb459('0xb')](_0x11f781)['json'](_0x3c484c);}};}function respondWithFilteredResult(_0x5e6ea5,_0x127e6c){return function(_0x11d1f2){if(_0x11d1f2){var _0x314972=typeof _0x127e6c[_0xb459('0xc')]===_0xb459('0xd')&&typeof _0x127e6c[_0xb459('0xe')]==='undefined';var _0x4afe50=_0x11d1f2[_0xb459('0xf')];var _0x122127=_0x314972?0x0:_0x127e6c[_0xb459('0xc')];var _0x24ef51=_0x314972?_0x11d1f2[_0xb459('0xf')]:_0x127e6c['offset']+_0x127e6c[_0xb459('0xe')];var _0x396eff;if(_0x24ef51>=_0x4afe50){_0x24ef51=_0x4afe50;_0x396eff=0xc8;}else{_0x396eff=0xce;}_0x5e6ea5[_0xb459('0xb')](_0x396eff);return _0x5e6ea5['set'](_0xb459('0x10'),_0x122127+'-'+_0x24ef51+'/'+_0x4afe50)['json'](_0x11d1f2);}return null;};}function removeEntity(_0x486ae0){return function(_0x2b2ffa){if(_0x2b2ffa){return _0x2b2ffa['destroy']()[_0xb459('0x11')](function(){var _0x4c8324=_0x2b2ffa[_0xb459('0x12')]({'plain':!![]});var _0x6f92cc=[{'name':_0xb459('0x13'),'value':_0xb459('0x14'),'ignore':![]},{'name':_0xb459('0x15'),'value':_0xb459('0x16'),'ignore':![]},{'name':_0xb459('0x17'),'value':'internal','ignore':![]}];var _0x25ff01=_(_0x6f92cc)[_0xb459('0x18')](_0xb459('0x19'))[_0xb459('0x1a')](_0xb459('0x1b'))[_0xb459('0x1b')]();if(_[_0xb459('0x1c')](_0x25ff01,_0x4c8324[_0xb459('0x1d')])){return;}var _0x387eb3=_['find'](_0x6f92cc,[_0xb459('0x1b'),_0x4c8324['type']])['name'];return db['UserProfileResource'][_0xb459('0x1e')]({'where':{'type':_0x387eb3,'resourceId':_0x4c8324['id']}})['then'](function(){return _0x2b2ffa;});})['then'](function(){_0x486ae0[_0xb459('0xb')](0xcc)[_0xb459('0x1f')]();});}};}function handleEntityNotFound(_0x49afc5){return function(_0x383ca0){if(!_0x383ca0){_0x49afc5[_0xb459('0xa')](0x194);}return _0x383ca0;};}function handleError(_0x176c9b,_0x5c431a){_0x5c431a=_0x5c431a||0x1f4;return function(_0x41c496){logger[_0xb459('0x20')](_0x41c496[_0xb459('0x21')]);if(_0x41c496[_0xb459('0x22')]){delete _0x41c496[_0xb459('0x22')];}_0x176c9b[_0xb459('0xb')](_0x5c431a)[_0xb459('0x23')](_0x41c496);};}exports[_0xb459('0x24')]=function(_0x494d0a,_0x2b5c16){var _0x572e6a={},_0x434e3d={},_0x58d340={'count':0x0,'rows':[]};var _0x4f2c33=_[_0xb459('0x1a')](db[_0xb459('0x25')][_0xb459('0x26')],function(_0x45907f){return{'name':_0x45907f[_0xb459('0x27')],'type':_0x45907f[_0xb459('0x1d')][_0xb459('0x28')]};});_0x434e3d[_0xb459('0x29')]=_['map'](_0x4f2c33,_0xb459('0x22'));_0x434e3d[_0xb459('0x2a')]=_[_0xb459('0x2b')](_0x494d0a[_0xb459('0x2a')]);_0x434e3d[_0xb459('0x2c')]=_['intersection'](_0x434e3d[_0xb459('0x29')],_0x434e3d[_0xb459('0x2a')]);_0x572e6a['attributes']=_[_0xb459('0x2d')](_0x434e3d[_0xb459('0x29')],qs[_0xb459('0x2e')](_0x494d0a[_0xb459('0x2a')][_0xb459('0x2e')]));_0x572e6a[_0xb459('0x2f')]=_0x572e6a[_0xb459('0x2f')]['length']?_0x572e6a[_0xb459('0x2f')]:_0x434e3d[_0xb459('0x29')];if(!_0x494d0a[_0xb459('0x2a')]['hasOwnProperty'](_0xb459('0x30'))){_0x572e6a[_0xb459('0xe')]=qs[_0xb459('0xe')](_0x494d0a['query']['limit']);_0x572e6a['offset']=qs[_0xb459('0xc')](_0x494d0a[_0xb459('0x2a')][_0xb459('0xc')]);}_0x572e6a[_0xb459('0x31')]=qs[_0xb459('0x32')](_0x494d0a[_0xb459('0x2a')]['sort']);_0x572e6a[_0xb459('0x33')]=qs['filters'](_['pick'](_0x494d0a[_0xb459('0x2a')],_0x434e3d[_0xb459('0x2c')]),_0x4f2c33);if(_0x494d0a[_0xb459('0x2a')][_0xb459('0x18')]){_0x572e6a[_0xb459('0x33')]=_['merge'](_0x572e6a[_0xb459('0x33')],{'$or':_['map'](_0x4f2c33,function(_0x4f99ea){if(_0x4f99ea[_0xb459('0x1d')]!==_0xb459('0x34')){var _0x2789be={};_0x2789be[_0x4f99ea[_0xb459('0x22')]]={'$like':'%'+_0x494d0a[_0xb459('0x2a')]['filter']+'%'};return _0x2789be;}})});}_0x572e6a=_[_0xb459('0x35')]({},_0x572e6a,_0x494d0a[_0xb459('0x36')]);var _0x16e749={'where':_0x572e6a[_0xb459('0x33')]};return db['VoiceExtension'][_0xb459('0xf')](_0x16e749)[_0xb459('0x11')](function(_0x1226da){_0x58d340[_0xb459('0xf')]=_0x1226da;if(_0x494d0a['query'][_0xb459('0x37')]){_0x572e6a['include']=[{'all':!![]}];}return db[_0xb459('0x25')][_0xb459('0x38')](_0x572e6a);})[_0xb459('0x11')](function(_0x31224d){_0x58d340[_0xb459('0x39')]=_0x31224d;return _0x58d340;})[_0xb459('0x11')](respondWithFilteredResult(_0x2b5c16,_0x572e6a))[_0xb459('0x3a')](handleError(_0x2b5c16,null));};exports['show']=function(_0x39fd08,_0x23aea3){var _0xe26b3a={'raw':![],'where':{'id':_0x39fd08['params']['id']}},_0x4b67b5={};_0x4b67b5[_0xb459('0x29')]=_[_0xb459('0x2b')](db['VoiceExtension'][_0xb459('0x26')]);_0x4b67b5[_0xb459('0x2a')]=_['keys'](_0x39fd08[_0xb459('0x2a')]);_0x4b67b5[_0xb459('0x2c')]=_[_0xb459('0x2d')](_0x4b67b5[_0xb459('0x29')],_0x4b67b5['query']);_0xe26b3a[_0xb459('0x2f')]=_[_0xb459('0x2d')](_0x4b67b5['model'],qs[_0xb459('0x2e')](_0x39fd08[_0xb459('0x2a')]['fields']));_0xe26b3a[_0xb459('0x2f')]=_0xe26b3a[_0xb459('0x2f')][_0xb459('0x3b')]?_0xe26b3a[_0xb459('0x2f')]:_0x4b67b5[_0xb459('0x29')];if(_0x39fd08[_0xb459('0x2a')][_0xb459('0x37')]){_0xe26b3a[_0xb459('0x3c')]=[{'all':!![]}];}_0xe26b3a=_[_0xb459('0x35')]({},_0xe26b3a,_0x39fd08[_0xb459('0x36')]);return db[_0xb459('0x25')]['find'](_0xe26b3a)[_0xb459('0x11')](handleEntityNotFound(_0x23aea3,null))[_0xb459('0x11')](respondWithResult(_0x23aea3,null))['catch'](handleError(_0x23aea3,null));};exports[_0xb459('0x1e')]=function(_0x205770,_0x2ce96b){return db[_0xb459('0x25')][_0xb459('0x3d')]({'where':{'id':_0x205770[_0xb459('0x3e')]['id']}})[_0xb459('0x11')](handleEntityNotFound(_0x2ce96b,null))['then'](removeEntity(_0x2ce96b,null))['catch'](handleError(_0x2ce96b,null));};exports[_0xb459('0x3f')]=function(_0x3ae915,_0x50df26){if(_0x3ae915[_0xb459('0x40')]['type']===_0xb459('0x16')&&!_[_0xb459('0x41')](_0x3ae915[_0xb459('0x40')][_0xb459('0x42')],'_')){_0x3ae915[_0xb459('0x40')][_0xb459('0x42')]='_'[_0xb459('0x43')](_0x3ae915[_0xb459('0x40')][_0xb459('0x42')]);}return db[_0xb459('0x25')][_0xb459('0x3f')](_0x3ae915[_0xb459('0x40')],{'raw':![]})[_0xb459('0x11')](function(_0x25f29c){var _0x462821=_0x3ae915[_0xb459('0x44')]['get']({'plain':!![]});if(!_0x462821)throw new Error(_0xb459('0x45'));if(_0x462821[_0xb459('0x46')]==='user'){var _0x3987f2=_0x25f29c[_0xb459('0x12')]({'plain':!![]});var _0x255a22=[{'name':'InboundRoutes','value':_0xb459('0x14')},{'name':'OutboundRoutes','value':_0xb459('0x16')},{'name':_0xb459('0x17'),'value':_0xb459('0x47')}];var _0x3a1501=_[_0xb459('0x3d')](_0x255a22,[_0xb459('0x1b'),_0x3987f2[_0xb459('0x1d')]])[_0xb459('0x22')];return db[_0xb459('0x48')][_0xb459('0x3d')]({'where':{'name':_0x3a1501,'userProfileId':_0x462821[_0xb459('0x49')]},'raw':!![]})[_0xb459('0x11')](function(_0x1b169d){if(_0x1b169d&&_0x1b169d[_0xb459('0x4a')]===0x0){return db[_0xb459('0x4b')][_0xb459('0x3f')]({'name':_0x3987f2['name'],'resourceId':_0x3987f2['id'],'type':_0x1b169d[_0xb459('0x22')],'sectionId':_0x1b169d['id']},{})[_0xb459('0x11')](function(){return _0x25f29c;});}else{return _0x25f29c;}})['catch'](function(_0x424d65){logger[_0xb459('0x20')](_0xb459('0x4c'),_0x424d65);throw _0x424d65;});}return _0x25f29c;})[_0xb459('0x11')](respondWithResult(_0x50df26,0xc9))['catch'](handleError(_0x50df26,null));};exports[_0xb459('0x4d')]=function(_0x1fced4,_0x5610cc){if(_0x1fced4[_0xb459('0x40')]['id']){delete _0x1fced4[_0xb459('0x40')]['id'];}return db['VoiceExtension'][_0xb459('0x3d')]({'where':{'id':_0x1fced4[_0xb459('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5610cc,null))[_0xb459('0x11')](function(_0x3a1dfa){if(_0x3a1dfa){return db['VoiceExtension'][_0xb459('0x4d')](_[_0xb459('0x4e')](_0x1fced4['body'],[_0xb459('0x42'),_0xb459('0x4f'),_0xb459('0x50'),'recordingFormat',_0xb459('0x51'),_0xb459('0x52'),_0xb459('0x53')]),{'where':{'context':_0x3a1dfa[_0xb459('0x4f')],'exten':_0x3a1dfa[_0xb459('0x42')]},'individualHooks':!![]})[_0xb459('0x11')](function(_0x3a0958){return _0x3a0958;});}return null;})[_0xb459('0x11')](respondWithStatusCode(_0x5610cc,null))['catch'](handleError(_0x5610cc,null));};exports['addApplications']=function(_0x32404c,_0x238aee){var _0x505991=_0x32404c[_0xb459('0x3e')]['id'];var _0x19110d=_0x32404c['body'];var _0x4a5e08=0xc8;var _0x40d820=null;return db[_0xb459('0x54')][_0xb459('0x55')]({'isolationLevel':db['sequelize']['Transaction'][_0xb459('0x56')][_0xb459('0x57')]},function(_0x4a251f){return db[_0xb459('0x25')]['findOne']({'where':{'id':_0x505991},'transaction':_0x4a251f})['then'](function(_0x20e706){if(_0x20e706){return db[_0xb459('0x25')][_0xb459('0x1e')]({'where':{'VoiceExtensionId':_0x505991},'transaction':_0x4a251f})['then'](function(){var _0xad6288=_['map'](_0x19110d,function(_0x3a57b0){_0x3a57b0['VoiceExtensionId']=_0x505991;_0x3a57b0[_0xb459('0x58')]=!![];return _0x3a57b0;});return _0x20e706[_0xb459('0x59')](_0xad6288);})[_0xb459('0x11')](function(_0x1dd6be){return db[_0xb459('0x25')]['bulkCreate'](_0x1dd6be,{'transaction':_0x4a251f});});}else{_0x4a5e08=0x194;_0x40d820=[];}});})[_0xb459('0x11')](function(){if(_0x4a5e08!==0x194){return db[_0xb459('0x25')][_0xb459('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x505991},'order':_0xb459('0x5b')})['then'](function(_0x26389c){_0x40d820=_0x26389c;});}})['catch'](function(_0x2f168a){_0x4a5e08=0x1f4;logger[_0xb459('0x20')](_0x2f168a[_0xb459('0x21')]);if(_0x2f168a[_0xb459('0x22')]){delete _0x2f168a['name'];}_0x40d820=_0x2f168a;})[_0xb459('0x5c')](function(){if(_0x40d820===null){_0x238aee[_0xb459('0xa')](_0x4a5e08);}else{if(_0x4a5e08===0x1f4){_0x238aee[_0xb459('0xb')](_0x4a5e08)[_0xb459('0x23')](_0x40d820);}else{_0x238aee[_0xb459('0xb')](_0x4a5e08)[_0xb459('0x5d')](_0x40d820);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9be82a1..b7b2e15 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 _0xd94f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd94f,0x1bf));var _0xfd94=function(_0x5c4d15,_0x32fe23){_0x5c4d15=_0x5c4d15-0x0;var _0x1f974a=_0xd94f[_0x5c4d15];return _0x1f974a;};'use strict';var EventEmitter=require(_0xfd94('0x0'));var VoiceExtension=require(_0xfd94('0x1'))['db'][_0xfd94('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfd94('0x3')](0x0);var events={'afterCreate':_0xfd94('0x4'),'afterUpdate':_0xfd94('0x5'),'afterDestroy':_0xfd94('0x6')};function emitEvent(_0x3d5cdf){return function(_0x5ebf31,_0x2a15fd,_0x11a737){VoiceExtensionEvents[_0xfd94('0x7')](_0x3d5cdf+':'+_0x5ebf31['id'],_0x5ebf31);VoiceExtensionEvents['emit'](_0x3d5cdf,_0x5ebf31);_0x11a737(null);};}for(var e in events){if(events[_0xfd94('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xfd94('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6088=['emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x6088,0x1aa));var _0x8608=function(_0x216784,_0x105192){_0x216784=_0x216784-0x0;var _0x43f784=_0x6088[_0x216784];return _0x43f784;};'use strict';var EventEmitter=require(_0x8608('0x0'));var VoiceExtension=require(_0x8608('0x1'))['db'][_0x8608('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8608('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8608('0x4'),'afterDestroy':_0x8608('0x5')};function emitEvent(_0x4467b3){return function(_0x10695d,_0x2f767a,_0x2599ee){VoiceExtensionEvents[_0x8608('0x6')](_0x4467b3+':'+_0x10695d['id'],_0x10695d);VoiceExtensionEvents[_0x8608('0x6')](_0x4467b3,_0x10695d);_0x2599ee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x8608('0x7')](e,emitEvent(event));}}module[_0x8608('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e4dee2d..40c0ef4 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 _0x2f7e=['isEmpty','Interval','findAll','interval','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','hasOwnProperty','answer','queue','playback','includes','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','split','trunk','param','prefix','phone','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace'];(function(_0x42879f,_0x3b68ed){var _0x328d93=function(_0x20e0ed){while(--_0x20e0ed){_0x42879f['push'](_0x42879f['shift']());}};_0x328d93(++_0x3b68ed);}(_0x2f7e,0x122));var _0xe2f7=function(_0x220215,_0x5f363b){_0x220215=_0x220215-0x0;var _0x5b421a=_0x2f7e[_0x220215];return _0x5b421a;};'use strict';var _=require(_0xe2f7('0x0'));var attributes=require(_0xe2f7('0x1'));module['exports']=function(_0x1b0c7f){var _0x3292df=_0x1b0c7f[_0xe2f7('0x2')];function _0x2df04d(_0x75fdb5){var _0x3f7b0f=0x2;var _0x2adc0d=[{'type':_0x75fdb5[_0xe2f7('0x3')],'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x5')+_0x75fdb5['type'],'context':_0x75fdb5[_0xe2f7('0x6')],'exten':_0x75fdb5[_0xe2f7('0x7')],'priority':_0x3f7b0f++,'VoiceExtensionId':_0x75fdb5['id']},{'type':_0x75fdb5[_0xe2f7('0x3')],'app':_0x75fdb5[_0xe2f7('0x8')]?_0xe2f7('0x4'):_0xe2f7('0x9'),'appdata':_0x75fdb5['alias']?'CDR(routeAlias)='+_0x75fdb5[_0xe2f7('0x8')]:_0xe2f7('0xa'),'context':_0x75fdb5['context'],'exten':_0x75fdb5[_0xe2f7('0x7')],'priority':_0x3f7b0f++,'VoiceExtensionId':_0x75fdb5['id']}];if(_0x75fdb5[_0xe2f7('0x3')]===_0xe2f7('0xb')){_0x2adc0d[_0xe2f7('0xc')]({'type':_0xe2f7('0xb'),'app':'Set','appdata':'CDR(routeid)='+_0x75fdb5['id'],'context':_0x75fdb5[_0xe2f7('0x6')],'exten':_0x75fdb5[_0xe2f7('0x7')],'priority':_0x3f7b0f++,'VoiceExtensionId':_0x75fdb5['id']});}_0x2adc0d['push']({'type':_0x75fdb5[_0xe2f7('0x3')],'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0xd'),'context':_0x75fdb5['context'],'exten':_0x75fdb5['exten'],'priority':_0x3f7b0f++,'VoiceExtensionId':_0x75fdb5['id']},{'type':_0x75fdb5[_0xe2f7('0x3')],'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0xe'),'context':_0x75fdb5[_0xe2f7('0x6')],'exten':_0x75fdb5[_0xe2f7('0x7')],'priority':_0x3f7b0f++,'VoiceExtensionId':_0x75fdb5['id']},{'type':_0x75fdb5['type'],'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0xf'),'context':_0x75fdb5[_0xe2f7('0x6')],'exten':_0x75fdb5[_0xe2f7('0x7')],'priority':_0x3f7b0f++,'VoiceExtensionId':_0x75fdb5['id']});return _0x2adc0d;}function _0x28f85(_0x242b6e){var _0x3e226f=0x2;var _0x5a6e28=[{'type':_0xe2f7('0x10'),'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x11'),'context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e['exten'],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':_0xe2f7('0x10'),'app':_0x242b6e[_0xe2f7('0x8')]?_0xe2f7('0x4'):_0xe2f7('0x9'),'appdata':_0x242b6e['alias']?_0xe2f7('0x12')+_0x242b6e[_0xe2f7('0x8')]:_0xe2f7('0xa'),'context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':_0xe2f7('0x10'),'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x13')+(_0x242b6e[_0xe2f7('0x14')]?_0xe2f7('0x15')+_0x242b6e['cutdigits']+'}':_0xe2f7('0x16')),'context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':'outbound','app':_0xe2f7('0x4'),'appdata':'CDR(routeid)='+_0x242b6e['id'],'context':_0x242b6e['context'],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':'outbound','app':_0xe2f7('0x17'),'appdata':_0xe2f7('0x18')+(_0x3e226f+0x2)+_0xe2f7('0x19')+(_0x3e226f+0x1)+')','context':_0x242b6e['context'],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':'outbound','app':_0xe2f7('0x4'),'appdata':_0x242b6e[_0xe2f7('0x14')]?_0xe2f7('0x1a')+_0x242b6e[_0xe2f7('0x14')]+'}':_0xe2f7('0x1b'),'context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':'outbound','app':_0xe2f7('0x4'),'appdata':_0xe2f7('0xd'),'context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':'outbound','app':_0xe2f7('0x4'),'appdata':_0xe2f7('0xe'),'context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':'outbound','app':_0xe2f7('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e['exten'],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':_0xe2f7('0x10'),'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x1c')+_0x242b6e['id'],'context':_0x242b6e['context'],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']}];if(_0x242b6e['hasOwnProperty']('recordingFormat')&&_0x242b6e[_0xe2f7('0x1d')]!=='none'){_0x5a6e28[_0xe2f7('0xc')]({'type':_0xe2f7('0x10'),'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x1e'),'context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e['exten'],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']},{'type':_0xe2f7('0x10'),'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x1f')+_0x242b6e[_0xe2f7('0x1d')]||'wav','context':_0x242b6e[_0xe2f7('0x6')],'exten':_0x242b6e[_0xe2f7('0x7')],'priority':_0x3e226f++,'VoiceExtensionId':_0x242b6e['id']});}return _0x5a6e28;}function _0x2e102c(_0x48c361,_0x323a30){var _0x4b8bac=[{'name':'trunk','param':0x0},{'name':_0xe2f7('0x20'),'param':0x1},{'name':_0xe2f7('0x21'),'param':0x2},{'name':_0xe2f7('0x22'),'param':0x3}];var _0x440abd={};var _0x3bce01=_0x323a30[_0xe2f7('0x23')](',');var _0x42cacd=[];for(var _0x2af9aa=0x0;_0x2af9aa<_0x4b8bac['length'];_0x2af9aa++){switch(_0x4b8bac[_0x2af9aa]['name']){case _0xe2f7('0x24'):_0x440abd[_0xe2f7('0x24')]=_0x3bce01[_0x4b8bac[_0x2af9aa][_0xe2f7('0x25')]][_0xe2f7('0x23')]('/')[0x1];_0x440abd['phone']=_0x3bce01[_0x4b8bac[_0x2af9aa][_0xe2f7('0x25')]]['split']('/')[0x2];_0x440abd[_0xe2f7('0x26')]=_0x440abd['phone']?_0x440abd[_0xe2f7('0x27')]['split']('$')[0x0]:undefined;_0x440abd[_0xe2f7('0x27')]=_0x48c361['cutdigits']?(_0x440abd[_0xe2f7('0x26')]||'')+_0xe2f7('0x15')+_0x48c361[_0xe2f7('0x14')]+'}':(_0x440abd[_0xe2f7('0x26')]||'')+_0xe2f7('0x16');_0x42cacd[_0x4b8bac[_0x2af9aa][_0xe2f7('0x25')]]=[_0xe2f7('0x28'),_0x440abd[_0xe2f7('0x24')],_0x440abd['phone']][_0xe2f7('0x29')]('/');break;case'options':_0x440abd[_0xe2f7('0x21')]=_0x3bce01[_0x4b8bac[_0x2af9aa][_0xe2f7('0x25')]];if(_0x48c361[_0xe2f7('0x1d')]!==_0xe2f7('0x2a')){if(_0x440abd[_0xe2f7('0x21')][_0xe2f7('0x2b')](_0xe2f7('0x2c'))<0x0){_0x440abd[_0xe2f7('0x21')]+=_0xe2f7('0x2c');}}else{_0x440abd[_0xe2f7('0x21')]=_0x440abd[_0xe2f7('0x21')][_0xe2f7('0x2d')](_0xe2f7('0x2c'),'');}_0x42cacd[_0x4b8bac[_0x2af9aa][_0xe2f7('0x25')]]=_0x440abd[_0xe2f7('0x21')];break;default:_0x42cacd[_0x4b8bac[_0x2af9aa][_0xe2f7('0x25')]]=_0x3bce01[_0x4b8bac[_0x2af9aa][_0xe2f7('0x25')]];}}return _0x42cacd[_0xe2f7('0x29')](',');}function _0x5d467e(_0x430295,_0x299c6d,_0x556980){return new Promise(function(_0x28ee6d,_0x42e74c){var _0x5e91f1=[];if(_[_0xe2f7('0x2e')](_0x299c6d))return _0x28ee6d(_0x5e91f1);_0x3292df[_0xe2f7('0x2f')][_0xe2f7('0x30')]({'attributes':['id',_0xe2f7('0x31'),'IntervalId'],'raw':!![]})[_0xe2f7('0x32')](function(_0x53c445){for(var _0x251007=0x0,_0xe079ba=0x0;_0x251007<_0x299c6d[_0xe2f7('0x33')];_0x251007++,_0xe079ba=0x0){var _0x1a24a6=_0x299c6d[_0x251007];var _0x5cf6b0=[];var _0x40b043=[];delete _0x1a24a6['id'];if(_0x1a24a6[_0xe2f7('0x31')]!==_0xe2f7('0x34')){_0x1a24a6[_0xe2f7('0x35')]=[_0x1a24a6[_0xe2f7('0x31')]];}else{_0x1a24a6['intervals']=_0x1a24a6['IntervalId']?_[_0xe2f7('0x36')](_[_0xe2f7('0x37')](_0x53c445,{'IntervalId':_0x1a24a6['IntervalId']}),_0xe2f7('0x31')):[];}_0x1a24a6[_0xe2f7('0x6')]=_0x430295[_0xe2f7('0x6')];_0x1a24a6[_0xe2f7('0x7')]=_0x430295[_0xe2f7('0x7')];if(_0x1a24a6['type'])_0x1a24a6[_0xe2f7('0x3')]=_0x1a24a6['type'][_0xe2f7('0x38')]();if(_0x430295[_0xe2f7('0x3')]==='outbound'){if(_0x1a24a6['hasOwnProperty'](_0xe2f7('0x39'))&&_0x1a24a6[_0xe2f7('0x39')]&&_0x1a24a6[_0xe2f7('0x39')]!=='--'){_0x5cf6b0[_0xe2f7('0xc')]({'type':_0x1a24a6[_0xe2f7('0x3')][_0xe2f7('0x38')](),'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x3a')+_0x1a24a6[_0xe2f7('0x39')],'context':_0x430295[_0xe2f7('0x6')],'exten':_0x430295[_0xe2f7('0x7')],'priority':_0x1a24a6[_0xe2f7('0x35')][_0xe2f7('0x33')]+_0x556980+_0xe079ba++,'VoiceExtensionId':_0x430295['id']});}_0x5cf6b0[_0xe2f7('0xc')]({'type':_0x1a24a6[_0xe2f7('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0xe2f7('0x3b')+(_0x1a24a6['callerID']?'Set(CALLERID(all)='+_0x1a24a6[_0xe2f7('0x3c')]+')':'NoOp(No\x20number\x20available)'),'context':_0x430295['context'],'exten':_0x430295[_0xe2f7('0x7')],'priority':_0x1a24a6[_0xe2f7('0x35')]['length']+_0x556980+_0xe079ba++,'VoiceExtensionId':_0x430295['id']});}else{if(_0x1a24a6[_0xe2f7('0x3d')](_0xe2f7('0x3e'))){if([_0xe2f7('0x3f'),_0xe2f7('0x40')][_0xe2f7('0x41')](_0x1a24a6['app'][_0xe2f7('0x38')]())&&_0x1a24a6['appType']!==_0xe2f7('0x42')){if(_0x1a24a6[_0xe2f7('0x3e')]){_0x5cf6b0['push']({'type':_0x1a24a6[_0xe2f7('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0xe2f7('0x43'),'context':_0x430295[_0xe2f7('0x6')],'exten':_0x430295['exten'],'priority':_0x1a24a6[_0xe2f7('0x35')][_0xe2f7('0x33')]+_0x556980+_0xe079ba++,'VoiceExtensionId':_0x430295['id']});_0x5cf6b0[_0xe2f7('0xc')]({'type':_0x1a24a6[_0xe2f7('0x3')][_0xe2f7('0x38')](),'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x44'),'context':_0x430295[_0xe2f7('0x6')],'exten':_0x430295['exten'],'priority':_0x1a24a6[_0xe2f7('0x35')][_0xe2f7('0x33')]+_0x556980+_0xe079ba++,'VoiceExtensionId':_0x430295['id']});}else{_0x5cf6b0['push']({'type':_0x1a24a6['type'][_0xe2f7('0x38')](),'app':_0xe2f7('0x17'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x430295[_0xe2f7('0x6')],'exten':_0x430295[_0xe2f7('0x7')],'priority':_0x1a24a6[_0xe2f7('0x35')][_0xe2f7('0x33')]+_0x556980+_0xe079ba++,'VoiceExtensionId':_0x430295['id']});_0x5cf6b0[_0xe2f7('0xc')]({'type':_0x1a24a6[_0xe2f7('0x3')][_0xe2f7('0x38')](),'app':_0xe2f7('0x4'),'appdata':_0xe2f7('0x45'),'context':_0x430295[_0xe2f7('0x6')],'exten':_0x430295[_0xe2f7('0x7')],'priority':_0x1a24a6[_0xe2f7('0x35')][_0xe2f7('0x33')]+_0x556980+_0xe079ba++,'VoiceExtensionId':_0x430295['id']});}}}}for(var _0x48ae08=0x0;_0x48ae08<_0x1a24a6[_0xe2f7('0x35')][_0xe2f7('0x33')];_0x48ae08++){var _0x3f58fc=_0x556980+_0x1a24a6[_0xe2f7('0x35')]['length'];var _0x23abbb=_0x48ae08===_0x1a24a6[_0xe2f7('0x35')][_0xe2f7('0x33')]-0x1?_0x556980+_0x5cf6b0['length']+_0x40b043[_0xe2f7('0x33')]+0x2:_0x556980+_0x48ae08+0x1;_0x5cf6b0['splice'](_0x48ae08,0x0,{'type':_0x430295[_0xe2f7('0x3')],'app':_0xe2f7('0x46'),'appdata':_0x1a24a6[_0xe2f7('0x35')][_0x48ae08]+'?'+_0x430295[_0xe2f7('0x6')]+_0xe2f7('0x47')+_0x3f58fc+':'+_0x430295[_0xe2f7('0x6')]+_0xe2f7('0x47')+_0x23abbb,'exten':_0x430295['exten'],'context':_0x430295[_0xe2f7('0x6')],'priority':_0x556980+_0x48ae08,'VoiceExtensionId':_0x430295['id']});}if(_0x1a24a6[_0xe2f7('0x48')]===_0xe2f7('0x49'))_0x1a24a6[_0xe2f7('0x4a')]=_0x2e102c(_0x430295,_0x1a24a6[_0xe2f7('0x4a')]);_0x1a24a6[_0xe2f7('0x4b')]=_0x5cf6b0[_0xe2f7('0x33')]?_['last'](_0x5cf6b0)['priority']+0x1:_0x556980;_0x5e91f1=_[_0xe2f7('0x4c')](_0x5e91f1,_0x5cf6b0,[_0x1a24a6],_0x40b043);_0x556980=_[_0xe2f7('0x4d')](_0x5e91f1)['priority']+0x1;}return _0x28ee6d(_0x5e91f1);})[_0xe2f7('0x4e')](function(_0xd1f24a){_0x42e74c(_0xd1f24a);});});}return _0x1b0c7f[_0xe2f7('0x4f')](_0xe2f7('0x50'),attributes,{'tableName':_0xe2f7('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4d1ffe){var _0x3860ba=this[_0xe2f7('0x52')]({'plain':!![]});var _0x30ec55=_0x3860ba['type']===_0xe2f7('0x10')?_0x28f85(_0x3860ba):_0x2df04d(_0x3860ba);return _0x5d467e(_0x3860ba,_0x4d1ffe,_['last'](_0x30ec55)['priority']+0x1)[_0xe2f7('0x32')](function(_0x39502a){var _0x283776=_[_0xe2f7('0x4c')](_0x30ec55,_0x39502a);_0x283776[_0xe2f7('0xc')]({'type':_0x3860ba[_0xe2f7('0x3')],'app':_0xe2f7('0x53'),'exten':_0x3860ba[_0xe2f7('0x7')],'context':_0x3860ba[_0xe2f7('0x6')],'priority':_[_0xe2f7('0x4d')](_0x283776)[_0xe2f7('0x4b')]+0x1,'VoiceExtensionId':_0x3860ba['id']});return _0x283776;});}}});}; \ No newline at end of file +var _0xdedc=['toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','voice_extensions','lodash','./voiceExtension.attributes','exports','type','Set','context','NoOp','alias','No\x20alias\x20set','inbound','push','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','CDR(routeAlias)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name','param','prefix','phone','${EXTEN}','SIP','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','IntervalId','then','interval','intervals','map','filter'];(function(_0x2f259c,_0x2f850b){var _0x2827af=function(_0x13e43e){while(--_0x13e43e){_0x2f259c['push'](_0x2f259c['shift']());}};_0x2827af(++_0x2f850b);}(_0xdedc,0xb8));var _0xcded=function(_0x49f8c4,_0xfaa8d4){_0x49f8c4=_0x49f8c4-0x0;var _0x1c60b3=_0xdedc[_0x49f8c4];return _0x1c60b3;};'use strict';var _=require(_0xcded('0x0'));var attributes=require(_0xcded('0x1'));module[_0xcded('0x2')]=function(_0x42d109){var _0x31919f=_0x42d109['models'];function _0x9f649a(_0x4acaf8){var _0x46ff39=0x2;var _0x438e1d=[{'type':_0x4acaf8[_0xcded('0x3')],'app':_0xcded('0x4'),'appdata':'CDR(type)='+_0x4acaf8[_0xcded('0x3')],'context':_0x4acaf8[_0xcded('0x5')],'exten':_0x4acaf8['exten'],'priority':_0x46ff39++,'VoiceExtensionId':_0x4acaf8['id']},{'type':_0x4acaf8[_0xcded('0x3')],'app':_0x4acaf8['alias']?'Set':_0xcded('0x6'),'appdata':_0x4acaf8['alias']?'CDR(routeAlias)='+_0x4acaf8[_0xcded('0x7')]:_0xcded('0x8'),'context':_0x4acaf8[_0xcded('0x5')],'exten':_0x4acaf8['exten'],'priority':_0x46ff39++,'VoiceExtensionId':_0x4acaf8['id']}];if(_0x4acaf8[_0xcded('0x3')]===_0xcded('0x9')){_0x438e1d[_0xcded('0xa')]({'type':_0xcded('0x9'),'app':_0xcded('0x4'),'appdata':'CDR(routeid)='+_0x4acaf8['id'],'context':_0x4acaf8[_0xcded('0x5')],'exten':_0x4acaf8[_0xcded('0xb')],'priority':_0x46ff39++,'VoiceExtensionId':_0x4acaf8['id']});}_0x438e1d[_0xcded('0xa')]({'type':_0x4acaf8[_0xcded('0x3')],'app':'Set','appdata':_0xcded('0xc'),'context':_0x4acaf8[_0xcded('0x5')],'exten':_0x4acaf8[_0xcded('0xb')],'priority':_0x46ff39++,'VoiceExtensionId':_0x4acaf8['id']},{'type':_0x4acaf8['type'],'app':_0xcded('0x4'),'appdata':_0xcded('0xd'),'context':_0x4acaf8[_0xcded('0x5')],'exten':_0x4acaf8['exten'],'priority':_0x46ff39++,'VoiceExtensionId':_0x4acaf8['id']},{'type':_0x4acaf8[_0xcded('0x3')],'app':'Set','appdata':_0xcded('0xe'),'context':_0x4acaf8[_0xcded('0x5')],'exten':_0x4acaf8[_0xcded('0xb')],'priority':_0x46ff39++,'VoiceExtensionId':_0x4acaf8['id']});return _0x438e1d;}function _0x59b28d(_0x9dac1c){var _0x19e45d=0x2;var _0x540097=[{'type':'outbound','app':_0xcded('0x4'),'appdata':_0xcded('0xf'),'context':_0x9dac1c['context'],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':'outbound','app':_0x9dac1c[_0xcded('0x7')]?_0xcded('0x4'):_0xcded('0x6'),'appdata':_0x9dac1c[_0xcded('0x7')]?_0xcded('0x10')+_0x9dac1c[_0xcded('0x7')]:_0xcded('0x8'),'context':_0x9dac1c['context'],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':_0xcded('0x11'),'app':_0xcded('0x4'),'appdata':_0xcded('0x12')+(_0x9dac1c[_0xcded('0x13')]?_0xcded('0x14')+_0x9dac1c[_0xcded('0x13')]+'}':'${EXTEN}'),'context':_0x9dac1c[_0xcded('0x5')],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':_0xcded('0x11'),'app':_0xcded('0x4'),'appdata':'CDR(routeid)='+_0x9dac1c['id'],'context':_0x9dac1c[_0xcded('0x5')],'exten':_0x9dac1c['exten'],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':_0xcded('0x11'),'app':_0xcded('0x15'),'appdata':_0xcded('0x16')+(_0x19e45d+0x2)+_0xcded('0x17')+(_0x19e45d+0x1)+')','context':_0x9dac1c['context'],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':'outbound','app':_0xcded('0x4'),'appdata':_0x9dac1c['cutdigits']?_0xcded('0x18')+_0x9dac1c['cutdigits']+'}':_0xcded('0x19'),'context':_0x9dac1c['context'],'exten':_0x9dac1c['exten'],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':'outbound','app':_0xcded('0x4'),'appdata':_0xcded('0xc'),'context':_0x9dac1c[_0xcded('0x5')],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':_0xcded('0x11'),'app':_0xcded('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x9dac1c[_0xcded('0x5')],'exten':_0x9dac1c['exten'],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':_0xcded('0x11'),'app':_0xcded('0x4'),'appdata':_0xcded('0xe'),'context':_0x9dac1c[_0xcded('0x5')],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':'outbound','app':_0xcded('0x4'),'appdata':_0xcded('0x1a')+_0x9dac1c['id'],'context':_0x9dac1c[_0xcded('0x5')],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']}];if(_0x9dac1c[_0xcded('0x1b')]('recordingFormat')&&_0x9dac1c[_0xcded('0x1c')]!==_0xcded('0x1d')){_0x540097[_0xcded('0xa')]({'type':_0xcded('0x11'),'app':_0xcded('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x9dac1c[_0xcded('0x5')],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']},{'type':'outbound','app':_0xcded('0x4'),'appdata':_0xcded('0x1e')+_0x9dac1c[_0xcded('0x1c')]||_0xcded('0x1f'),'context':_0x9dac1c[_0xcded('0x5')],'exten':_0x9dac1c[_0xcded('0xb')],'priority':_0x19e45d++,'VoiceExtensionId':_0x9dac1c['id']});}return _0x540097;}function _0x2acbbb(_0x5dfc8d,_0x33c306){var _0x144e6b=[{'name':_0xcded('0x20'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xcded('0x21'),'param':0x2},{'name':_0xcded('0x22'),'param':0x3}];var _0x8747ea={};var _0x30d647=_0x33c306[_0xcded('0x23')](',');var _0x6d6ae5=[];for(var _0x1e9eb9=0x0;_0x1e9eb9<_0x144e6b[_0xcded('0x24')];_0x1e9eb9++){switch(_0x144e6b[_0x1e9eb9][_0xcded('0x25')]){case _0xcded('0x20'):_0x8747ea['trunk']=_0x30d647[_0x144e6b[_0x1e9eb9][_0xcded('0x26')]][_0xcded('0x23')]('/')[0x1];_0x8747ea['phone']=_0x30d647[_0x144e6b[_0x1e9eb9]['param']][_0xcded('0x23')]('/')[0x2];_0x8747ea[_0xcded('0x27')]=_0x8747ea[_0xcded('0x28')]?_0x8747ea[_0xcded('0x28')][_0xcded('0x23')]('$')[0x0]:undefined;_0x8747ea[_0xcded('0x28')]=_0x5dfc8d['cutdigits']?(_0x8747ea[_0xcded('0x27')]||'')+_0xcded('0x14')+_0x5dfc8d[_0xcded('0x13')]+'}':(_0x8747ea[_0xcded('0x27')]||'')+_0xcded('0x29');_0x6d6ae5[_0x144e6b[_0x1e9eb9][_0xcded('0x26')]]=[_0xcded('0x2a'),_0x8747ea[_0xcded('0x20')],_0x8747ea[_0xcded('0x28')]]['join']('/');break;case'options':_0x8747ea['options']=_0x30d647[_0x144e6b[_0x1e9eb9][_0xcded('0x26')]];if(_0x5dfc8d[_0xcded('0x1c')]!=='none'){if(_0x8747ea[_0xcded('0x21')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x8747ea[_0xcded('0x21')]+=_0xcded('0x2b');}}else{_0x8747ea[_0xcded('0x21')]=_0x8747ea[_0xcded('0x21')][_0xcded('0x2c')]('U(xcally-mixmonitor-context)','');}_0x6d6ae5[_0x144e6b[_0x1e9eb9]['param']]=_0x8747ea[_0xcded('0x21')];break;default:_0x6d6ae5[_0x144e6b[_0x1e9eb9][_0xcded('0x26')]]=_0x30d647[_0x144e6b[_0x1e9eb9][_0xcded('0x26')]];}}return _0x6d6ae5['join'](',');}function _0xe641a8(_0x450e83,_0x331105,_0x82f2ce){return new Promise(function(_0x3f760a,_0x3acdee){var _0x5dfabd=[];if(_[_0xcded('0x2d')](_0x331105))return _0x3f760a(_0x5dfabd);_0x31919f['Interval'][_0xcded('0x2e')]({'attributes':['id','interval',_0xcded('0x2f')],'raw':!![]})[_0xcded('0x30')](function(_0x3d1528){for(var _0x4b6907=0x0,_0x15e90b=0x0;_0x4b6907<_0x331105[_0xcded('0x24')];_0x4b6907++,_0x15e90b=0x0){var _0x43c728=_0x331105[_0x4b6907];var _0x53631e=[];var _0x2bf51e=[];delete _0x43c728['id'];if(_0x43c728[_0xcded('0x31')]!=='*,*,*,*'){_0x43c728[_0xcded('0x32')]=[_0x43c728[_0xcded('0x31')]];}else{_0x43c728['intervals']=_0x43c728[_0xcded('0x2f')]?_[_0xcded('0x33')](_[_0xcded('0x34')](_0x3d1528,{'IntervalId':_0x43c728[_0xcded('0x2f')]}),_0xcded('0x31')):[];}_0x43c728[_0xcded('0x5')]=_0x450e83[_0xcded('0x5')];_0x43c728[_0xcded('0xb')]=_0x450e83['exten'];if(_0x43c728[_0xcded('0x3')])_0x43c728['type']=_0x43c728[_0xcded('0x3')][_0xcded('0x35')]();if(_0x450e83[_0xcded('0x3')]==='outbound'){if(_0x43c728[_0xcded('0x1b')](_0xcded('0x36'))&&_0x43c728[_0xcded('0x36')]&&_0x43c728[_0xcded('0x36')]!=='--'){_0x53631e[_0xcded('0xa')]({'type':_0x43c728[_0xcded('0x3')][_0xcded('0x35')](),'app':_0xcded('0x4'),'appdata':_0xcded('0x37')+_0x43c728[_0xcded('0x36')],'context':_0x450e83[_0xcded('0x5')],'exten':_0x450e83[_0xcded('0xb')],'priority':_0x43c728[_0xcded('0x32')][_0xcded('0x24')]+_0x82f2ce+_0x15e90b++,'VoiceExtensionId':_0x450e83['id']});}_0x53631e['push']({'type':_0x43c728['type']['toLowerCase'](),'app':_0xcded('0x15'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x43c728[_0xcded('0x38')]?_0xcded('0x39')+_0x43c728[_0xcded('0x38')]+')':_0xcded('0x3a')),'context':_0x450e83['context'],'exten':_0x450e83['exten'],'priority':_0x43c728[_0xcded('0x32')][_0xcded('0x24')]+_0x82f2ce+_0x15e90b++,'VoiceExtensionId':_0x450e83['id']});}else{if(_0x43c728[_0xcded('0x1b')]('answer')){if(['queue',_0xcded('0x3b')][_0xcded('0x3c')](_0x43c728[_0xcded('0x3d')][_0xcded('0x35')]())&&_0x43c728[_0xcded('0x3e')]!==_0xcded('0x3f')){if(_0x43c728[_0xcded('0x40')]){_0x53631e['push']({'type':_0x43c728[_0xcded('0x3')]['toLowerCase'](),'app':_0xcded('0x15'),'appdata':_0xcded('0x41'),'context':_0x450e83[_0xcded('0x5')],'exten':_0x450e83['exten'],'priority':_0x43c728[_0xcded('0x32')][_0xcded('0x24')]+_0x82f2ce+_0x15e90b++,'VoiceExtensionId':_0x450e83['id']});_0x53631e['push']({'type':_0x43c728[_0xcded('0x3')][_0xcded('0x35')](),'app':_0xcded('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x450e83[_0xcded('0x5')],'exten':_0x450e83[_0xcded('0xb')],'priority':_0x43c728[_0xcded('0x32')]['length']+_0x82f2ce+_0x15e90b++,'VoiceExtensionId':_0x450e83['id']});}else{_0x53631e[_0xcded('0xa')]({'type':_0x43c728['type'][_0xcded('0x35')](),'app':_0xcded('0x15'),'appdata':_0xcded('0x42'),'context':_0x450e83['context'],'exten':_0x450e83['exten'],'priority':_0x43c728[_0xcded('0x32')]['length']+_0x82f2ce+_0x15e90b++,'VoiceExtensionId':_0x450e83['id']});_0x53631e[_0xcded('0xa')]({'type':_0x43c728['type'][_0xcded('0x35')](),'app':_0xcded('0x4'),'appdata':_0xcded('0x43'),'context':_0x450e83[_0xcded('0x5')],'exten':_0x450e83['exten'],'priority':_0x43c728['intervals']['length']+_0x82f2ce+_0x15e90b++,'VoiceExtensionId':_0x450e83['id']});}}}}for(var _0x4f54bc=0x0;_0x4f54bc<_0x43c728[_0xcded('0x32')][_0xcded('0x24')];_0x4f54bc++){var _0x19eaac=_0x82f2ce+_0x43c728[_0xcded('0x32')]['length'];var _0x594acd=_0x4f54bc===_0x43c728[_0xcded('0x32')][_0xcded('0x24')]-0x1?_0x82f2ce+_0x53631e[_0xcded('0x24')]+_0x2bf51e[_0xcded('0x24')]+0x2:_0x82f2ce+_0x4f54bc+0x1;_0x53631e[_0xcded('0x44')](_0x4f54bc,0x0,{'type':_0x450e83['type'],'app':'GotoIfTime','appdata':_0x43c728[_0xcded('0x32')][_0x4f54bc]+'?'+_0x450e83[_0xcded('0x5')]+_0xcded('0x45')+_0x19eaac+':'+_0x450e83[_0xcded('0x5')]+_0xcded('0x45')+_0x594acd,'exten':_0x450e83[_0xcded('0xb')],'context':_0x450e83['context'],'priority':_0x82f2ce+_0x4f54bc,'VoiceExtensionId':_0x450e83['id']});}if(_0x43c728[_0xcded('0x3e')]===_0xcded('0x46'))_0x43c728[_0xcded('0x47')]=_0x2acbbb(_0x450e83,_0x43c728['appdata']);_0x43c728[_0xcded('0x48')]=_0x53631e[_0xcded('0x24')]?_['last'](_0x53631e)[_0xcded('0x48')]+0x1:_0x82f2ce;_0x5dfabd=_[_0xcded('0x49')](_0x5dfabd,_0x53631e,[_0x43c728],_0x2bf51e);_0x82f2ce=_[_0xcded('0x4a')](_0x5dfabd)[_0xcded('0x48')]+0x1;}return _0x3f760a(_0x5dfabd);})[_0xcded('0x4b')](function(_0x214f72){_0x3acdee(_0x214f72);});});}return _0x42d109[_0xcded('0x4c')](_0xcded('0x4d'),attributes,{'tableName':_0xcded('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x53a97f){var _0x5bddc2=this['get']({'plain':!![]});var _0x36cef3=_0x5bddc2['type']===_0xcded('0x11')?_0x59b28d(_0x5bddc2):_0x9f649a(_0x5bddc2);return _0xe641a8(_0x5bddc2,_0x53a97f,_[_0xcded('0x4a')](_0x36cef3)[_0xcded('0x48')]+0x1)[_0xcded('0x30')](function(_0x118490){var _0x3c1861=_[_0xcded('0x49')](_0x36cef3,_0x118490);_0x3c1861[_0xcded('0xa')]({'type':_0x5bddc2[_0xcded('0x3')],'app':'Hangup','exten':_0x5bddc2[_0xcded('0xb')],'context':_0x5bddc2[_0xcded('0x5')],'priority':_[_0xcded('0x4a')](_0x3c1861)[_0xcded('0x48')]+0x1,'VoiceExtensionId':_0x5bddc2['id']});return _0x3c1861;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d075959..d830dca 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 _0xb1a3=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetVoiceExtension','VoiceExtension','options','raw','attributes','limit','map','include','model','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xa5d9f9,_0x17c6bf){var _0x40e9f6=function(_0x1c2585){while(--_0x1c2585){_0xa5d9f9['push'](_0xa5d9f9['shift']());}};_0x40e9f6(++_0x17c6bf);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb1a3[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var moment=require(_0x3b1a('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b1a('0x4'));var logger=require(_0x3b1a('0x5'))(_0x3b1a('0x6'));var config=require(_0x3b1a('0x7'));var jayson=require(_0x3b1a('0x8'));var client=jayson[_0x3b1a('0x9')][_0x3b1a('0xa')]({'port':0x232a});config['redis']=_[_0x3b1a('0xb')](config[_0x3b1a('0xc')],{'host':_0x3b1a('0xd'),'port':0x18eb});var socket=require(_0x3b1a('0xe'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x3b1a('0xf')](socket);function respondWithRpcPromise(_0x1e6925,_0x4cd175,_0x260128){return new BPromise(function(_0x553d63,_0xc6d255){return client['request'](_0x1e6925,_0x260128)[_0x3b1a('0x10')](function(_0x261800){logger[_0x3b1a('0x11')](_0x3b1a('0x12'),_0x4cd175,_0x3b1a('0x13'));logger[_0x3b1a('0x14')](_0x3b1a('0x15'),_0x4cd175,_0x3b1a('0x13'),JSON[_0x3b1a('0x16')](_0x261800));if(_0x261800['error']){if(_0x261800['error'][_0x3b1a('0x17')]===0x1f4){logger[_0x3b1a('0x18')](_0x3b1a('0x12'),_0x4cd175,_0x261800[_0x3b1a('0x18')]['message']);return _0xc6d255(_0x261800[_0x3b1a('0x18')][_0x3b1a('0x19')]);}logger['error'](_0x3b1a('0x12'),_0x4cd175,_0x261800[_0x3b1a('0x18')][_0x3b1a('0x19')]);return _0x553d63(_0x261800[_0x3b1a('0x18')][_0x3b1a('0x19')]);}else{logger[_0x3b1a('0x11')](_0x3b1a('0x12'),_0x4cd175,_0x3b1a('0x13'));_0x553d63(_0x261800['result'][_0x3b1a('0x19')]);}})[_0x3b1a('0x1a')](function(_0x569bc4){logger[_0x3b1a('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x4cd175,_0x569bc4);_0xc6d255(_0x569bc4);});});}exports[_0x3b1a('0x1b')]=function(_0x204deb){var _0x189e6c=this;return new Promise(function(_0x3cb500,_0xe1113d){return db[_0x3b1a('0x1c')]['findAll']({'raw':_0x204deb[_0x3b1a('0x1d')]?_0x204deb[_0x3b1a('0x1d')][_0x3b1a('0x1e')]===undefined?!![]:![]:!![],'where':_0x204deb[_0x3b1a('0x1d')]?_0x204deb[_0x3b1a('0x1d')]['where']||null:null,'attributes':_0x204deb['options']?_0x204deb[_0x3b1a('0x1d')][_0x3b1a('0x1f')]||null:null,'limit':_0x204deb[_0x3b1a('0x1d')]?_0x204deb[_0x3b1a('0x1d')][_0x3b1a('0x20')]||null:null,'include':_0x204deb[_0x3b1a('0x1d')]?_0x204deb[_0x3b1a('0x1d')]['include']?_[_0x3b1a('0x21')](_0x204deb[_0x3b1a('0x1d')][_0x3b1a('0x22')],function(_0x482484){return{'model':db[_0x482484[_0x3b1a('0x23')]],'as':_0x482484['as'],'attributes':_0x482484[_0x3b1a('0x1f')],'include':_0x482484[_0x3b1a('0x22')]?_[_0x3b1a('0x21')](_0x482484[_0x3b1a('0x22')],function(_0x13c2e8){return{'model':db[_0x13c2e8['model']],'as':_0x13c2e8['as'],'attributes':_0x13c2e8[_0x3b1a('0x1f')],'include':_0x13c2e8[_0x3b1a('0x22')]?_[_0x3b1a('0x21')](_0x13c2e8[_0x3b1a('0x22')],function(_0x2ff415){return{'model':db[_0x2ff415[_0x3b1a('0x23')]],'as':_0x2ff415['as'],'attributes':_0x2ff415['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44c0eb){logger[_0x3b1a('0x11')](_0x3b1a('0x1b'),_0x204deb);logger[_0x3b1a('0x14')](_0x3b1a('0x1b'),_0x204deb,JSON[_0x3b1a('0x16')](_0x44c0eb));_0x3cb500(_0x44c0eb);})[_0x3b1a('0x1a')](function(_0x3abd0a){logger[_0x3b1a('0x18')]('GetVoiceExtension',_0x3abd0a[_0x3b1a('0x19')],_0x204deb);_0xe1113d(_0x189e6c[_0x3b1a('0x18')](0x1f4,_0x3abd0a[_0x3b1a('0x19')]));});});}; \ No newline at end of file +var _0x86b8=['message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','model','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x124c60,_0x3303fe){var _0x15f0af=function(_0x2e84c5){while(--_0x2e84c5){_0x124c60['push'](_0x124c60['shift']());}};_0x15f0af(++_0x3303fe);}(_0x86b8,0x15d));var _0x886b=function(_0x17a2e8,_0x5b37a7){_0x17a2e8=_0x17a2e8-0x0;var _0x4f48bd=_0x86b8[_0x17a2e8];return _0x4f48bd;};'use strict';var _=require(_0x886b('0x0'));var util=require(_0x886b('0x1'));var moment=require(_0x886b('0x2'));var BPromise=require('bluebird');var rs=require(_0x886b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x886b('0x4'))['db'];var utils=require(_0x886b('0x5'));var logger=require(_0x886b('0x6'))('rpc');var config=require(_0x886b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x886b('0x8')]({'port':0x232a});config[_0x886b('0x9')]=_[_0x886b('0xa')](config[_0x886b('0x9')],{'host':_0x886b('0xb'),'port':0x18eb});var socket=require(_0x886b('0xc'))(new Redis(config[_0x886b('0x9')]));require(_0x886b('0xd'))['register'](socket);function respondWithRpcPromise(_0x2b2df9,_0x3b62c2,_0x1ce588){return new BPromise(function(_0x419e26,_0x25d98a){return client[_0x886b('0xe')](_0x2b2df9,_0x1ce588)[_0x886b('0xf')](function(_0x1c954f){logger['info'](_0x886b('0x10'),_0x3b62c2,_0x886b('0x11'));logger['debug'](_0x886b('0x12'),_0x3b62c2,_0x886b('0x11'),JSON[_0x886b('0x13')](_0x1c954f));if(_0x1c954f[_0x886b('0x14')]){if(_0x1c954f['error']['code']===0x1f4){logger[_0x886b('0x14')](_0x886b('0x10'),_0x3b62c2,_0x1c954f[_0x886b('0x14')][_0x886b('0x15')]);return _0x25d98a(_0x1c954f[_0x886b('0x14')][_0x886b('0x15')]);}logger[_0x886b('0x14')](_0x886b('0x10'),_0x3b62c2,_0x1c954f['error'][_0x886b('0x15')]);return _0x419e26(_0x1c954f[_0x886b('0x14')]['message']);}else{logger[_0x886b('0x16')](_0x886b('0x10'),_0x3b62c2,_0x886b('0x11'));_0x419e26(_0x1c954f[_0x886b('0x17')][_0x886b('0x15')]);}})[_0x886b('0x18')](function(_0x5a6696){logger['error'](_0x886b('0x10'),_0x3b62c2,_0x5a6696);_0x25d98a(_0x5a6696);});});}exports[_0x886b('0x19')]=function(_0x325899){var _0x4fea00=this;return new Promise(function(_0x59e59f,_0x17c81b){return db[_0x886b('0x1a')][_0x886b('0x1b')]({'raw':_0x325899[_0x886b('0x1c')]?_0x325899[_0x886b('0x1c')][_0x886b('0x1d')]===undefined?!![]:![]:!![],'where':_0x325899[_0x886b('0x1c')]?_0x325899['options'][_0x886b('0x1e')]||null:null,'attributes':_0x325899[_0x886b('0x1c')]?_0x325899[_0x886b('0x1c')]['attributes']||null:null,'limit':_0x325899[_0x886b('0x1c')]?_0x325899[_0x886b('0x1c')][_0x886b('0x1f')]||null:null,'include':_0x325899[_0x886b('0x1c')]?_0x325899['options'][_0x886b('0x20')]?_[_0x886b('0x21')](_0x325899[_0x886b('0x1c')][_0x886b('0x20')],function(_0x3279e2){return{'model':db[_0x3279e2['model']],'as':_0x3279e2['as'],'attributes':_0x3279e2[_0x886b('0x22')],'include':_0x3279e2[_0x886b('0x20')]?_[_0x886b('0x21')](_0x3279e2[_0x886b('0x20')],function(_0x579350){return{'model':db[_0x579350['model']],'as':_0x579350['as'],'attributes':_0x579350[_0x886b('0x22')],'include':_0x579350[_0x886b('0x20')]?_['map'](_0x579350[_0x886b('0x20')],function(_0x434c1f){return{'model':db[_0x434c1f[_0x886b('0x23')]],'as':_0x434c1f['as'],'attributes':_0x434c1f[_0x886b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x886b('0xf')](function(_0xbfd773){logger['info']('GetVoiceExtension',_0x325899);logger[_0x886b('0x24')](_0x886b('0x19'),_0x325899,JSON[_0x886b('0x13')](_0xbfd773));_0x59e59f(_0xbfd773);})[_0x886b('0x18')](function(_0x2a6ecf){logger[_0x886b('0x14')]('GetVoiceExtension',_0x2a6ecf['message'],_0x325899);_0x17c81b(_0x4fea00['error'](0x1f4,_0x2a6ecf['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a486bd1..56987af 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 _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x56e02d,_0x14e89c){var _0x5ba0a5=function(_0x569fb4){while(--_0x569fb4){_0x56e02d['push'](_0x56e02d['shift']());}};_0x5ba0a5(++_0x14e89c);}(_0xabce,0x103));var _0xeabc=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xabce[_0x5c3c0b];return _0x52ecd2;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0xa7572b,_0x3175fb){var _0x2a4950=function(_0x4df6f5){while(--_0x4df6f5){_0xa7572b['push'](_0xa7572b['shift']());}};_0x2a4950(++_0x3175fb);}(_0x0295,0x1f0));var _0x5029=function(_0x9e3edc,_0x594d61){_0x9e3edc=_0x9e3edc-0x0;var _0x44a387=_0x0295[_0x9e3edc];return _0x44a387;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 59b3219..7af31ee 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 _0xfcf0=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put'];(function(_0x77b868,_0x45ea4b){var _0x1f54ea=function(_0x3cb8a6){while(--_0x3cb8a6){_0x77b868['push'](_0x77b868['shift']());}};_0x1f54ea(++_0x45ea4b);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0xfcf0[_0x2142c8];return _0x4286e9;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x10')]('/',auth[_0x0fcf('0xa')](),controller['create']);router[_0x0fcf('0x11')]('/:id',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x12')]);router[_0x0fcf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0fcf('0x14')]);module[_0x0fcf('0x15')]=router; \ No newline at end of file +var _0xed1c=['get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller'];(function(_0x3da148,_0x549dda){var _0x3c37cf=function(_0x11d7b8){while(--_0x11d7b8){_0x3da148['push'](_0x3da148['shift']());}};_0x3c37cf(++_0x549dda);}(_0xed1c,0xe4));var _0xced1=function(_0x10ef46,_0x397763){_0x10ef46=_0x10ef46-0x0;var _0x2d1c8e=_0xed1c[_0x10ef46];return _0x2d1c8e;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/',auth['isAuthenticated'](),controller[_0xced1('0xe')]);router['put'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);router[_0xced1('0x10')](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 6ac2f52..4271d99 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 _0x821f=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','yes','ENUM','TINYINT(4)'];(function(_0x5708e9,_0x11c1e6){var _0x2dc4a4=function(_0x26794d){while(--_0x26794d){_0x5708e9['push'](_0x5708e9['shift']());}};_0x2dc4a4(++_0x11c1e6);}(_0x821f,0xb5));var _0xf821=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x821f[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0xf821('0x0'));module[_0xf821('0x1')]={'customer_id':{'type':Sequelize[_0xf821('0x2')]},'context':{'type':Sequelize[_0xf821('0x2')],'defaultValue':_0xf821('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xf821('0x4')},'password':{'type':Sequelize[_0xf821('0x2')]},'fullname':{'type':Sequelize[_0xf821('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x508e0b){this[_0xf821('0x5')](_0xf821('0x6'),typeof _0x508e0b==='string'&&_0x508e0b[_0xf821('0x7')]()?_0x508e0b['trim']():null);}},'pager':{'type':Sequelize[_0xf821('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf821('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xf821('0x8'),'no'),'defaultValue':_0xf821('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf821('0x2')]},'callback':{'type':Sequelize[_0xf821('0x2')]},'review':{'type':Sequelize[_0xf821('0x9')](_0xf821('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf821('0x9')](_0xf821('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf821('0x9')](_0xf821('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf821('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xf821('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf821('0x9')](_0xf821('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf821('0x9')](_0xf821('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xf821('0x9')](_0xf821('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf821('0x9')](_0xf821('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xf821('0x8'),'no'),'defaultValue':_0xf821('0x8'),'allowNull':![]},'stamp':{'type':_0xf821('0xb')},'emailsubject':{'type':Sequelize[_0xf821('0x2')]},'emailbody':{'type':Sequelize[_0xf821('0x2')]},'maxsecs':{'type':Sequelize[_0xf821('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf821('0xd')],'get':function(){return this['getDataValue'](_0xf821('0xe'))+_0xf821('0xf')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x38e5=['mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0x168794,_0x2abf4a){var _0x5451d7=function(_0x346be9){while(--_0x346be9){_0x168794['push'](_0x168794['shift']());}};_0x5451d7(++_0x2abf4a);}(_0x38e5,0x145));var _0x538e=function(_0x2c37d4,_0x52f640){_0x2c37d4=_0x2c37d4-0x0;var _0x2091a4=_0x38e5[_0x2c37d4];return _0x2091a4;};'use strict';var Sequelize=require('sequelize');module[_0x538e('0x0')]={'customer_id':{'type':Sequelize[_0x538e('0x1')]},'context':{'type':Sequelize[_0x538e('0x1')],'defaultValue':_0x538e('0x2'),'unique':_0x538e('0x3')},'mailbox':{'type':Sequelize[_0x538e('0x1')],'defaultValue':'','allowNull':![],'unique':_0x538e('0x3')},'password':{'type':Sequelize[_0x538e('0x1')]},'fullname':{'type':Sequelize[_0x538e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4c0143){this[_0x538e('0x4')](_0x538e('0x5'),typeof _0x4c0143===_0x538e('0x6')&&_0x4c0143['trim']()?_0x4c0143[_0x538e('0x7')]():null);}},'pager':{'type':Sequelize[_0x538e('0x1')]},'tz':{'type':Sequelize[_0x538e('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x538e('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x538e('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x538e('0x1')]},'review':{'type':Sequelize[_0x538e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x538e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x538e('0x9')](_0x538e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x538e('0x9')](_0x538e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x538e('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x538e('0x9')](_0x538e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x538e('0x9')](_0x538e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x538e('0x9')](_0x538e('0x8'),'no'),'defaultValue':_0x538e('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x538e('0x9')](_0x538e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x538e('0x9')](_0x538e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x538e('0x9')](_0x538e('0x8'),'no'),'defaultValue':_0x538e('0x8'),'allowNull':![]},'stamp':{'type':_0x538e('0xb')},'emailsubject':{'type':Sequelize[_0x538e('0x1')]},'emailbody':{'type':Sequelize[_0x538e('0x1')]},'maxsecs':{'type':Sequelize[_0x538e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x538e('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x538e('0xd')],'get':function(){return this[_0x538e('0xe')](_0x538e('0xf'))+_0x538e('0x10')+this[_0x538e('0xe')](_0x538e('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index bba3ccb..9c06881 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 _0x39cb=['filter','merge','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','then','Voicemails','UserProfileResource','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb39c('0x0'));var zipdir=require(_0xb39c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb39c('0x2'));var moment=require(_0xb39c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb39c('0x4'));var util=require(_0xb39c('0x5'));var path=require(_0xb39c('0x6'));var sox=require(_0xb39c('0x7'));var csv=require(_0xb39c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb39c('0x9'));var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0x8'));var querystring=require(_0xb39c('0xd'));var Papa=require(_0xb39c('0xe'));var Redis=require(_0xb39c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x10'));var logger=require(_0xb39c('0x11'))(_0xb39c('0x12'));var utils=require(_0xb39c('0x13'));var config=require(_0xb39c('0x14'));var licenseUtil=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];function respondWithStatusCode(_0x18d12e,_0x51ff24){_0x51ff24=_0x51ff24||0xcc;return function(_0x31e07e){if(_0x31e07e){return _0x18d12e[_0xb39c('0x17')](_0x51ff24);}return _0x18d12e[_0xb39c('0x18')](_0x51ff24)['end']();};}function respondWithResult(_0xf4662a,_0x40a6d3){_0x40a6d3=_0x40a6d3||0xc8;return function(_0x42a203){if(_0x42a203){return _0xf4662a[_0xb39c('0x18')](_0x40a6d3)[_0xb39c('0x19')](_0x42a203);}};}function respondWithFilteredResult(_0x27c22a,_0x8e9181){return function(_0x5277ce){if(_0x5277ce){var _0x316c9b=typeof _0x8e9181[_0xb39c('0x1a')]===_0xb39c('0x1b')&&typeof _0x8e9181[_0xb39c('0x1c')]===_0xb39c('0x1b');var _0x3b7fad=_0x5277ce[_0xb39c('0x1d')];var _0x4e02cf=_0x316c9b?0x0:_0x8e9181[_0xb39c('0x1a')];var _0x2eeae6=_0x316c9b?_0x5277ce['count']:_0x8e9181[_0xb39c('0x1a')]+_0x8e9181[_0xb39c('0x1c')];var _0x28bbe1;if(_0x2eeae6>=_0x3b7fad){_0x2eeae6=_0x3b7fad;_0x28bbe1=0xc8;}else{_0x28bbe1=0xce;}_0x27c22a[_0xb39c('0x18')](_0x28bbe1);return _0x27c22a['set'](_0xb39c('0x1e'),_0x4e02cf+'-'+_0x2eeae6+'/'+_0x3b7fad)[_0xb39c('0x19')](_0x5277ce);}return null;};}function patchUpdates(_0x5e4a0b){return function(_0x2d8e93){try{jsonpatch[_0xb39c('0x1f')](_0x2d8e93,_0x5e4a0b,!![]);}catch(_0x1d3e2d){return BPromise['reject'](_0x1d3e2d);}return _0x2d8e93['save']();};}function saveUpdates(_0x2789fd,_0x1a5b9d){return function(_0x3c8dfd){if(_0x3c8dfd){return _0x3c8dfd['update'](_0x2789fd)[_0xb39c('0x20')](function(_0x438207){return _0x438207;});}return null;};}function removeEntity(_0x1bb895,_0x16f3b0){return function(_0x3b03ed){if(_0x3b03ed){return _0x3b03ed['destroy']()[_0xb39c('0x20')](function(){var _0xbeab7e=_0x3b03ed['get']({'plain':!![]});var _0x1fd145=_0xb39c('0x21');return db[_0xb39c('0x22')][_0xb39c('0x23')]({'where':{'type':_0x1fd145,'resourceId':_0xbeab7e['id']}})[_0xb39c('0x20')](function(){return _0x3b03ed;});})['then'](function(){_0x1bb895[_0xb39c('0x18')](0xcc)[_0xb39c('0x24')]();});}};}function handleEntityNotFound(_0x132769,_0x4c06fa){return function(_0x41fff2){if(!_0x41fff2){_0x132769[_0xb39c('0x17')](0x194);}return _0x41fff2;};}function handleError(_0x52eb5e,_0x3d08e1){_0x3d08e1=_0x3d08e1||0x1f4;return function(_0x4b4458){logger[_0xb39c('0x25')](_0x4b4458['stack']);if(_0x4b4458[_0xb39c('0x26')]){delete _0x4b4458[_0xb39c('0x26')];}_0x52eb5e['status'](_0x3d08e1)[_0xb39c('0x27')](_0x4b4458);};}exports['index']=function(_0x8e2d7,_0x2d2743){var _0x309697={},_0x7339b4={},_0x17eb7b={'count':0x0,'rows':[]};var _0x52e642=_[_0xb39c('0x28')](db['VoiceMail'][_0xb39c('0x29')],function(_0x48a888){return{'name':_0x48a888[_0xb39c('0x2a')],'type':_0x48a888[_0xb39c('0x2b')][_0xb39c('0x2c')]};});_0x7339b4[_0xb39c('0x2d')]=_['map'](_0x52e642,'name');_0x7339b4[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x8e2d7['query']);_0x7339b4[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x7339b4[_0xb39c('0x2d')],_0x7339b4[_0xb39c('0x2e')]);_0x309697[_0xb39c('0x32')]=_[_0xb39c('0x31')](_0x7339b4[_0xb39c('0x2d')],qs[_0xb39c('0x33')](_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x309697[_0xb39c('0x32')]=_0x309697[_0xb39c('0x32')][_0xb39c('0x34')]?_0x309697[_0xb39c('0x32')]:_0x7339b4[_0xb39c('0x2d')];if(!_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x35')](_0xb39c('0x36'))){_0x309697[_0xb39c('0x1c')]=qs['limit'](_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x1c')]);_0x309697['offset']=qs['offset'](_0x8e2d7['query'][_0xb39c('0x1a')]);}_0x309697[_0xb39c('0x37')]=qs[_0xb39c('0x38')](_0x8e2d7['query'][_0xb39c('0x38')]);_0x309697[_0xb39c('0x39')]=qs[_0xb39c('0x30')](_[_0xb39c('0x3a')](_0x8e2d7[_0xb39c('0x2e')],_0x7339b4['filters']),_0x52e642);if(_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3b')]){_0x309697['where']=_[_0xb39c('0x3c')](_0x309697['where'],{'$or':_[_0xb39c('0x28')](_0x52e642,function(_0xc6e494){if(_0xc6e494[_0xb39c('0x2b')]!=='VIRTUAL'){var _0x406fc6={};_0x406fc6[_0xc6e494[_0xb39c('0x26')]]={'$like':'%'+_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3b')]+'%'};return _0x406fc6;}})});}_0x309697=_[_0xb39c('0x3c')]({},_0x309697,_0x8e2d7[_0xb39c('0x3d')]);var _0x17ed52={'where':_0x309697[_0xb39c('0x39')]};return db[_0xb39c('0x3e')][_0xb39c('0x1d')](_0x17ed52)[_0xb39c('0x20')](function(_0xd1136f){_0x17eb7b['count']=_0xd1136f;if(_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3f')]){_0x309697[_0xb39c('0x40')]=[{'all':!![]}];}return db[_0xb39c('0x3e')][_0xb39c('0x41')](_0x309697);})[_0xb39c('0x20')](function(_0x1db549){_0x17eb7b[_0xb39c('0x42')]=_0x1db549;return _0x17eb7b;})[_0xb39c('0x20')](respondWithFilteredResult(_0x2d2743,_0x309697))['catch'](handleError(_0x2d2743,null));};exports['show']=function(_0x2f88c9,_0x36d948){var _0x496da9={'raw':!![],'where':{'id':_0x2f88c9[_0xb39c('0x43')]['id']}},_0x4bc2be={};_0x4bc2be['model']=_[_0xb39c('0x2f')](db[_0xb39c('0x3e')][_0xb39c('0x29')]);_0x4bc2be[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x2f88c9['query']);_0x4bc2be[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x4bc2be['model'],_0x4bc2be['query']);_0x496da9[_0xb39c('0x32')]=_['intersection'](_0x4bc2be['model'],qs[_0xb39c('0x33')](_0x2f88c9[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x496da9[_0xb39c('0x32')]=_0x496da9[_0xb39c('0x32')][_0xb39c('0x34')]?_0x496da9[_0xb39c('0x32')]:_0x4bc2be[_0xb39c('0x2d')];if(_0x2f88c9[_0xb39c('0x2e')][_0xb39c('0x3f')]){_0x496da9['include']=[{'all':!![]}];}_0x496da9=_[_0xb39c('0x3c')]({},_0x496da9,_0x2f88c9[_0xb39c('0x3d')]);return db[_0xb39c('0x3e')][_0xb39c('0x44')](_0x496da9)[_0xb39c('0x20')](handleEntityNotFound(_0x36d948,null))[_0xb39c('0x20')](respondWithResult(_0x36d948,null))[_0xb39c('0x45')](handleError(_0x36d948,null));};exports[_0xb39c('0x46')]=function(_0x38bc36,_0x1ae2cb){return db[_0xb39c('0x3e')][_0xb39c('0x46')](_0x38bc36[_0xb39c('0x47')],{})[_0xb39c('0x20')](function(_0x17ad13){var _0x44b825=_0x38bc36['user'][_0xb39c('0x48')]({'plain':!![]});if(!_0x44b825)throw new Error(_0xb39c('0x49'));if(_0x44b825[_0xb39c('0x4a')]===_0xb39c('0x4b')){var _0xa50077=_0x17ad13[_0xb39c('0x48')]({'plain':!![]});var _0xd4f368=_0xb39c('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xd4f368,'userProfileId':_0x44b825[_0xb39c('0x4c')]},'raw':!![]})[_0xb39c('0x20')](function(_0x5a7e75){if(_0x5a7e75&&_0x5a7e75['autoAssociation']===0x0){return db[_0xb39c('0x22')][_0xb39c('0x46')]({'name':_0xa50077['name'],'resourceId':_0xa50077['id'],'type':_0x5a7e75[_0xb39c('0x26')],'sectionId':_0x5a7e75['id']},{})['then'](function(){return _0x17ad13;});}else{return _0x17ad13;}})['catch'](function(_0x2d88dd){logger['error'](_0xb39c('0x4d'),_0x2d88dd);throw _0x2d88dd;});}return _0x17ad13;})[_0xb39c('0x20')](respondWithResult(_0x1ae2cb,0xc9))[_0xb39c('0x45')](handleError(_0x1ae2cb,null));};exports[_0xb39c('0x4e')]=function(_0x2f2944,_0x97f170){if(_0x2f2944['body']['id']){delete _0x2f2944[_0xb39c('0x47')]['id'];}return db[_0xb39c('0x3e')][_0xb39c('0x44')]({'where':{'id':_0x2f2944[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x97f170,null))['then'](saveUpdates(_0x2f2944[_0xb39c('0x47')],null))['then'](respondWithResult(_0x97f170,null))[_0xb39c('0x45')](handleError(_0x97f170,null));};exports[_0xb39c('0x23')]=function(_0x131cb2,_0x9e4e89){return db[_0xb39c('0x3e')][_0xb39c('0x44')]({'where':{'id':_0x131cb2[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x9e4e89,null))[_0xb39c('0x20')](removeEntity(_0x9e4e89,null))[_0xb39c('0x45')](handleError(_0x9e4e89,null));};exports[_0xb39c('0x4f')]=function(_0x260fbf,_0x2620ee,_0x33c0c6){return db[_0xb39c('0x3e')][_0xb39c('0x50')]({'where':{'id':_0x260fbf[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x2620ee,null))[_0xb39c('0x20')](function(_0x49f118){var _0x57f2f4;var _0x1e9893={},_0x15534c={};_0x15534c['model']=_[_0xb39c('0x2f')](db[_0xb39c('0x51')]['rawAttributes']);_0x15534c[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x260fbf[_0xb39c('0x2e')]);_0x15534c[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x15534c[_0xb39c('0x2d')],_0x15534c['query']);_0x1e9893[_0xb39c('0x32')]=_[_0xb39c('0x31')](_0x15534c[_0xb39c('0x2d')],qs[_0xb39c('0x33')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x1e9893[_0xb39c('0x32')]=_0x1e9893['attributes'][_0xb39c('0x34')]?_0x1e9893[_0xb39c('0x32')]:_0x15534c[_0xb39c('0x2d')];if(!_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x35')]('nolimit')){_0x1e9893['limit']=qs[_0xb39c('0x1c')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x1c')]);_0x1e9893['offset']=qs[_0xb39c('0x1a')](_0x260fbf['query'][_0xb39c('0x1a')]);}_0x1e9893['order']=qs[_0xb39c('0x38')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x38')]);_0x1e9893['where']=qs[_0xb39c('0x30')](_[_0xb39c('0x3a')](_0x260fbf[_0xb39c('0x2e')],_0x15534c[_0xb39c('0x30')]));if(_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x3b')]){_0x1e9893[_0xb39c('0x39')]=_[_0xb39c('0x3c')](_0x1e9893[_0xb39c('0x39')],{'$or':_[_0xb39c('0x28')](_0x1e9893[_0xb39c('0x32')],function(_0x227152){var _0x3fb267={};_0x3fb267[_0x227152]={'$like':'%'+_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x3b')]+'%'};return _0x3fb267;})});}_0x1e9893[_0xb39c('0x39')]=_[_0xb39c('0x3c')](_0x1e9893['where'],{'mailboxuser':_0x49f118[_0xb39c('0x52')]});_0x1e9893=_[_0xb39c('0x3c')]({},_0x1e9893,_0x260fbf[_0xb39c('0x3d')]);return db['VoiceMailMessage'][_0xb39c('0x53')](_0x1e9893)['then'](respondWithFilteredResult(_0x2620ee,_0x1e9893));})['catch'](handleError(_0x2620ee,null));}; \ No newline at end of file +var _0xbdb7=['map','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','fields','include','find','create','body','role','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','destroy','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','UserProfileResource','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName'];(function(_0x1ab8c3,_0x3edfea){var _0x40eedf=function(_0x18ac06){while(--_0x18ac06){_0x1ab8c3['push'](_0x1ab8c3['shift']());}};_0x40eedf(++_0x3edfea);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x262a2a,_0x33aaca){_0x262a2a=_0x262a2a-0x0;var _0x4cc510=_0xbdb7[_0x262a2a];return _0x4cc510;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){var _0x3c423f=_0x3a456f['get']({'plain':!![]});var _0x47abaf='Voicemails';return db[_0x7bdb('0x23')]['destroy']({'where':{'type':_0x47abaf,'resourceId':_0x3c423f['id']}})[_0x7bdb('0x24')](function(){return _0x3a456f;});})[_0x7bdb('0x24')](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)[_0x7bdb('0x17')]();});}};}function handleEntityNotFound(_0x2a494e,_0x523869){return function(_0x10e818){if(!_0x10e818){_0x2a494e[_0x7bdb('0x25')](0x194);}return _0x10e818;};}function handleError(_0x399b62,_0xe1141d){_0xe1141d=_0xe1141d||0x1f4;return function(_0x371e8a){logger[_0x7bdb('0x26')](_0x371e8a[_0x7bdb('0x27')]);if(_0x371e8a[_0x7bdb('0x28')]){delete _0x371e8a[_0x7bdb('0x28')];}_0x399b62[_0x7bdb('0x1d')](_0xe1141d)[_0x7bdb('0x29')](_0x371e8a);};}exports[_0x7bdb('0x2a')]=function(_0x5b386d,_0x388a45){var _0x23fc3a={},_0x8f7672={},_0x9f5c1={'count':0x0,'rows':[]};var _0x29eac5=_['map'](db[_0x7bdb('0x2b')][_0x7bdb('0x2c')],function(_0x9ac56){return{'name':_0x9ac56[_0x7bdb('0x2d')],'type':_0x9ac56['type']['key']};});_0x8f7672['model']=_[_0x7bdb('0x2e')](_0x29eac5,'name');_0x8f7672[_0x7bdb('0x2f')]=_['keys'](_0x5b386d[_0x7bdb('0x2f')]);_0x8f7672[_0x7bdb('0x30')]=_[_0x7bdb('0x31')](_0x8f7672['model'],_0x8f7672[_0x7bdb('0x2f')]);_0x23fc3a['attributes']=_['intersection'](_0x8f7672[_0x7bdb('0x32')],qs['fields'](_0x5b386d[_0x7bdb('0x2f')]['fields']));_0x23fc3a['attributes']=_0x23fc3a[_0x7bdb('0x33')][_0x7bdb('0x34')]?_0x23fc3a[_0x7bdb('0x33')]:_0x8f7672[_0x7bdb('0x32')];if(!_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x35')]('nolimit')){_0x23fc3a[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x1b')]);_0x23fc3a[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x19')]);}_0x23fc3a[_0x7bdb('0x36')]=qs['sort'](_0x5b386d['query'][_0x7bdb('0x37')]);_0x23fc3a[_0x7bdb('0x38')]=qs[_0x7bdb('0x30')](_[_0x7bdb('0x39')](_0x5b386d[_0x7bdb('0x2f')],_0x8f7672['filters']),_0x29eac5);if(_0x5b386d['query'][_0x7bdb('0x3a')]){_0x23fc3a['where']=_[_0x7bdb('0x3b')](_0x23fc3a['where'],{'$or':_[_0x7bdb('0x2e')](_0x29eac5,function(_0x5d1826){if(_0x5d1826['type']!==_0x7bdb('0x3c')){var _0x2d578e={};_0x2d578e[_0x5d1826[_0x7bdb('0x28')]]={'$like':'%'+_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x3a')]+'%'};return _0x2d578e;}})});}_0x23fc3a=_[_0x7bdb('0x3b')]({},_0x23fc3a,_0x5b386d[_0x7bdb('0x3d')]);var _0x501aff={'where':_0x23fc3a['where']};return db[_0x7bdb('0x2b')][_0x7bdb('0x1c')](_0x501aff)[_0x7bdb('0x24')](function(_0x3509e4){_0x9f5c1[_0x7bdb('0x1c')]=_0x3509e4;if(_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x3e')]){_0x23fc3a['include']=[{'all':!![]}];}return db['VoiceMail'][_0x7bdb('0x3f')](_0x23fc3a);})[_0x7bdb('0x24')](function(_0x4636f8){_0x9f5c1[_0x7bdb('0x40')]=_0x4636f8;return _0x9f5c1;})['then'](respondWithFilteredResult(_0x388a45,_0x23fc3a))[_0x7bdb('0x41')](handleError(_0x388a45,null));};exports['show']=function(_0x37029b,_0x27de25){var _0x218361={'raw':!![],'where':{'id':_0x37029b[_0x7bdb('0x42')]['id']}},_0x264f3a={};_0x264f3a[_0x7bdb('0x32')]=_[_0x7bdb('0x43')](db[_0x7bdb('0x2b')][_0x7bdb('0x2c')]);_0x264f3a['query']=_[_0x7bdb('0x43')](_0x37029b[_0x7bdb('0x2f')]);_0x264f3a['filters']=_[_0x7bdb('0x31')](_0x264f3a['model'],_0x264f3a[_0x7bdb('0x2f')]);_0x218361[_0x7bdb('0x33')]=_[_0x7bdb('0x31')](_0x264f3a[_0x7bdb('0x32')],qs[_0x7bdb('0x44')](_0x37029b['query'][_0x7bdb('0x44')]));_0x218361[_0x7bdb('0x33')]=_0x218361[_0x7bdb('0x33')][_0x7bdb('0x34')]?_0x218361[_0x7bdb('0x33')]:_0x264f3a['model'];if(_0x37029b[_0x7bdb('0x2f')][_0x7bdb('0x3e')]){_0x218361[_0x7bdb('0x45')]=[{'all':!![]}];}_0x218361=_[_0x7bdb('0x3b')]({},_0x218361,_0x37029b[_0x7bdb('0x3d')]);return db[_0x7bdb('0x2b')][_0x7bdb('0x46')](_0x218361)[_0x7bdb('0x24')](handleEntityNotFound(_0x27de25,null))[_0x7bdb('0x24')](respondWithResult(_0x27de25,null))[_0x7bdb('0x41')](handleError(_0x27de25,null));};exports['create']=function(_0x189cf8,_0x58c4bc){return db['VoiceMail'][_0x7bdb('0x47')](_0x189cf8[_0x7bdb('0x48')],{})['then'](function(_0x37780a){var _0x186809=_0x189cf8['user']['get']({'plain':!![]});if(!_0x186809)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x186809[_0x7bdb('0x49')]===_0x7bdb('0x4a')){var _0x2fab74=_0x37780a[_0x7bdb('0x4b')]({'plain':!![]});var _0x33687b=_0x7bdb('0x4c');return db[_0x7bdb('0x4d')][_0x7bdb('0x46')]({'where':{'name':_0x33687b,'userProfileId':_0x186809[_0x7bdb('0x4e')]},'raw':!![]})[_0x7bdb('0x24')](function(_0x5a8d4a){if(_0x5a8d4a&&_0x5a8d4a[_0x7bdb('0x4f')]===0x0){return db['UserProfileResource'][_0x7bdb('0x47')]({'name':_0x2fab74[_0x7bdb('0x28')],'resourceId':_0x2fab74['id'],'type':_0x5a8d4a[_0x7bdb('0x28')],'sectionId':_0x5a8d4a['id']},{})[_0x7bdb('0x24')](function(){return _0x37780a;});}else{return _0x37780a;}})['catch'](function(_0x258f29){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x258f29);throw _0x258f29;});}return _0x37780a;})[_0x7bdb('0x24')](respondWithResult(_0x58c4bc,0xc9))[_0x7bdb('0x41')](handleError(_0x58c4bc,null));};exports['update']=function(_0x4e17f3,_0x49bb3f){if(_0x4e17f3[_0x7bdb('0x48')]['id']){delete _0x4e17f3['body']['id'];}return db['VoiceMail'][_0x7bdb('0x46')]({'where':{'id':_0x4e17f3[_0x7bdb('0x42')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x49bb3f,null))[_0x7bdb('0x24')](saveUpdates(_0x4e17f3['body'],null))[_0x7bdb('0x24')](respondWithResult(_0x49bb3f,null))['catch'](handleError(_0x49bb3f,null));};exports[_0x7bdb('0x50')]=function(_0x7f2d89,_0x82f990){return db[_0x7bdb('0x2b')][_0x7bdb('0x46')]({'where':{'id':_0x7f2d89[_0x7bdb('0x42')]['id']}})['then'](handleEntityNotFound(_0x82f990,null))[_0x7bdb('0x24')](removeEntity(_0x82f990,null))[_0x7bdb('0x41')](handleError(_0x82f990,null));};exports[_0x7bdb('0x51')]=function(_0x58658e,_0x2b5493,_0x1d9927){return db['VoiceMail'][_0x7bdb('0x52')]({'where':{'id':_0x58658e['params']['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x2b5493,null))[_0x7bdb('0x24')](function(_0x4f3f8c){var _0x478bbd;var _0x21a54f={},_0x2a6c5b={};_0x2a6c5b['model']=_[_0x7bdb('0x43')](db['VoiceMailMessage'][_0x7bdb('0x2c')]);_0x2a6c5b['query']=_['keys'](_0x58658e[_0x7bdb('0x2f')]);_0x2a6c5b[_0x7bdb('0x30')]=_[_0x7bdb('0x31')](_0x2a6c5b[_0x7bdb('0x32')],_0x2a6c5b[_0x7bdb('0x2f')]);_0x21a54f[_0x7bdb('0x33')]=_[_0x7bdb('0x31')](_0x2a6c5b[_0x7bdb('0x32')],qs[_0x7bdb('0x44')](_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x44')]));_0x21a54f[_0x7bdb('0x33')]=_0x21a54f['attributes'][_0x7bdb('0x34')]?_0x21a54f[_0x7bdb('0x33')]:_0x2a6c5b['model'];if(!_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x35')](_0x7bdb('0x53'))){_0x21a54f[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x58658e['query'][_0x7bdb('0x1b')]);_0x21a54f[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x58658e['query'][_0x7bdb('0x19')]);}_0x21a54f[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x37')]);_0x21a54f[_0x7bdb('0x38')]=qs[_0x7bdb('0x30')](_[_0x7bdb('0x39')](_0x58658e[_0x7bdb('0x2f')],_0x2a6c5b['filters']));if(_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x3a')]){_0x21a54f[_0x7bdb('0x38')]=_[_0x7bdb('0x3b')](_0x21a54f[_0x7bdb('0x38')],{'$or':_[_0x7bdb('0x2e')](_0x21a54f[_0x7bdb('0x33')],function(_0x86c6ed){var _0x4565c2={};_0x4565c2[_0x86c6ed]={'$like':'%'+_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x3a')]+'%'};return _0x4565c2;})});}_0x21a54f[_0x7bdb('0x38')]=_[_0x7bdb('0x3b')](_0x21a54f['where'],{'mailboxuser':_0x4f3f8c[_0x7bdb('0x54')]});_0x21a54f=_['merge']({},_0x21a54f,_0x58658e[_0x7bdb('0x3d')]);return db[_0x7bdb('0x55')][_0x7bdb('0x56')](_0x21a54f)['then'](respondWithFilteredResult(_0x2b5493,_0x21a54f));})[_0x7bdb('0x41')](handleError(_0x2b5493,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e0834a5..d2c9547 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 _0x156b=['../../config/logger','api','moment','bluebird','request-promise','path','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','lodash','util'];(function(_0x493747,_0x196ce4){var _0x57cfd8=function(_0x42e291){while(--_0x42e291){_0x493747['push'](_0x493747['shift']());}};_0x57cfd8(++_0x196ce4);}(_0x156b,0xde));var _0xb156=function(_0x1b1516,_0x17a510){_0x1b1516=_0x1b1516-0x0;var _0x14902e=_0x156b[_0x1b1516];return _0x14902e;};'use strict';var _=require(_0xb156('0x0'));var util=require(_0xb156('0x1'));var logger=require(_0xb156('0x2'))(_0xb156('0x3'));var moment=require(_0xb156('0x4'));var BPromise=require(_0xb156('0x5'));var rp=require(_0xb156('0x6'));var fs=require('fs');var path=require(_0xb156('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb156('0x8'));module[_0xb156('0x9')]=function(_0xbea47b,_0x510eef){return _0xbea47b[_0xb156('0xa')](_0xb156('0xb'),attributes,{'tableName':_0xb156('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xb156('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf021=['util','../../config/logger','api','moment','bluebird','path','rimraf','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash'];(function(_0x403732,_0x436c94){var _0x20a1cd=function(_0x52ed30){while(--_0x52ed30){_0x403732['push'](_0x403732['shift']());}};_0x20a1cd(++_0x436c94);}(_0xf021,0x19f));var _0x1f02=function(_0x2c366f,_0x1bd4f8){_0x2c366f=_0x2c366f-0x0;var _0x180634=_0xf021[_0x2c366f];return _0x180634;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var logger=require(_0x1f02('0x2'))(_0x1f02('0x3'));var moment=require(_0x1f02('0x4'));var BPromise=require(_0x1f02('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f02('0x6'));var rimraf=require(_0x1f02('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x1f02('0x8')]=function(_0x238210,_0x4af8e4){return _0x238210['define'](_0x1f02('0x9'),attributes,{'tableName':_0x1f02('0xa'),'paranoid':![],'indexes':[{'name':_0x1f02('0xb'),'fields':[_0x1f02('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 93f5838..5ad740f 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 _0x249c=['../../config/environment','jayson/promise','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5978fc,_0x7492ff){var _0x483495=function(_0x33329c){while(--_0x33329c){_0x5978fc['push'](_0x5978fc['shift']());}};_0x483495(++_0x7492ff);}(_0x249c,0x66));var _0xc249=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x249c[_0x4d35f3];return _0x382fea;};'use strict';var _=require(_0xc249('0x0'));var util=require(_0xc249('0x1'));var moment=require('moment');var BPromise=require(_0xc249('0x2'));var rs=require(_0xc249('0x3'));var fs=require('fs');var Redis=require(_0xc249('0x4'));var db=require(_0xc249('0x5'))['db'];var utils=require(_0xc249('0x6'));var logger=require('../../config/logger')(_0xc249('0x7'));var config=require(_0xc249('0x8'));var jayson=require(_0xc249('0x9'));var client=jayson['client'][_0xc249('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x306188,_0x5dcbcc,_0x580549){return new BPromise(function(_0xa82aea,_0x27e15d){return client[_0xc249('0xb')](_0x306188,_0x580549)[_0xc249('0xc')](function(_0x69eaa5){logger['info'](_0xc249('0xd'),_0x5dcbcc,_0xc249('0xe'));logger[_0xc249('0xf')](_0xc249('0x10'),_0x5dcbcc,_0xc249('0xe'),JSON[_0xc249('0x11')](_0x69eaa5));if(_0x69eaa5[_0xc249('0x12')]){if(_0x69eaa5[_0xc249('0x12')]['code']===0x1f4){logger[_0xc249('0x12')](_0xc249('0xd'),_0x5dcbcc,_0x69eaa5['error']['message']);return _0x27e15d(_0x69eaa5[_0xc249('0x12')][_0xc249('0x13')]);}logger[_0xc249('0x12')]('VoiceMail,\x20%s,\x20%s',_0x5dcbcc,_0x69eaa5[_0xc249('0x12')][_0xc249('0x13')]);return _0xa82aea(_0x69eaa5[_0xc249('0x12')]['message']);}else{logger[_0xc249('0x14')]('VoiceMail,\x20%s,\x20%s',_0x5dcbcc,_0xc249('0xe'));_0xa82aea(_0x69eaa5['result']['message']);}})[_0xc249('0x15')](function(_0x2d0a77){logger[_0xc249('0x12')](_0xc249('0xd'),_0x5dcbcc,_0x2d0a77);_0x27e15d(_0x2d0a77);});});} \ No newline at end of file +var _0xec9b=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xec9b,0x125));var _0xbec9=function(_0x17541e,_0x46df72){_0x17541e=_0x17541e-0x0;var _0x1c17eb=_0xec9b[_0x17541e];return _0x1c17eb;};'use strict';var _=require(_0xbec9('0x0'));var util=require(_0xbec9('0x1'));var moment=require('moment');var BPromise=require(_0xbec9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbec9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbec9('0x4'))(_0xbec9('0x5'));var config=require(_0xbec9('0x6'));var jayson=require(_0xbec9('0x7'));var client=jayson[_0xbec9('0x8')][_0xbec9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x588902,_0x2b08dd,_0x32b450){return new BPromise(function(_0x59cd10,_0x2e577d){return client['request'](_0x588902,_0x32b450)[_0xbec9('0xa')](function(_0x4cf357){logger[_0xbec9('0xb')](_0xbec9('0xc'),_0x2b08dd,_0xbec9('0xd'));logger['debug'](_0xbec9('0xe'),_0x2b08dd,_0xbec9('0xd'),JSON[_0xbec9('0xf')](_0x4cf357));if(_0x4cf357[_0xbec9('0x10')]){if(_0x4cf357['error'][_0xbec9('0x11')]===0x1f4){logger[_0xbec9('0x10')](_0xbec9('0xc'),_0x2b08dd,_0x4cf357[_0xbec9('0x10')][_0xbec9('0x12')]);return _0x2e577d(_0x4cf357[_0xbec9('0x10')][_0xbec9('0x12')]);}logger['error'](_0xbec9('0xc'),_0x2b08dd,_0x4cf357[_0xbec9('0x10')][_0xbec9('0x12')]);return _0x59cd10(_0x4cf357[_0xbec9('0x10')][_0xbec9('0x12')]);}else{logger[_0xbec9('0xb')](_0xbec9('0xc'),_0x2b08dd,'request\x20sent');_0x59cd10(_0x4cf357[_0xbec9('0x13')][_0xbec9('0x12')]);}})[_0xbec9('0x14')](function(_0x1a7b47){logger[_0xbec9('0x10')](_0xbec9('0xc'),_0x2b08dd,_0x1a7b47);_0x2e577d(_0x1a7b47);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 57ccb4b..425a976 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 _0x495a=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service'];(function(_0x1bbf37,_0x124768){var _0x2b2c34=function(_0x12bcaf){while(--_0x12bcaf){_0x1bbf37['push'](_0x1bbf37['shift']());}};_0x2b2c34(++_0x124768);}(_0x495a,0x199));var _0xa495=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x495a[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xa495('0x0'));var util=require(_0xa495('0x1'));var path=require('path');var timeout=require(_0xa495('0x2'));var express=require(_0xa495('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa495('0x4'));var config=require('../../config/environment');var controller=require(_0xa495('0x5'));router[_0xa495('0x6')]('/',auth[_0xa495('0x7')](),controller[_0xa495('0x8')]);router[_0xa495('0x6')](_0xa495('0x9'),auth[_0xa495('0x7')](),controller['show']);router[_0xa495('0x6')](_0xa495('0xa'),auth['isAuthenticated'](),controller[_0xa495('0xb')]);router[_0xa495('0xc')]('/',auth[_0xa495('0x7')](),controller[_0xa495('0xd')]);router[_0xa495('0xe')](_0xa495('0x9'),auth[_0xa495('0x7')](),controller[_0xa495('0xf')]);router['delete']('/:id',auth[_0xa495('0x7')](),controller[_0xa495('0x10')]);module[_0xa495('0x11')]=router; \ No newline at end of file +var _0xc60a=['destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','create','update','delete'];(function(_0x28c4cf,_0x137caa){var _0xd408c8=function(_0x3c5b8d){while(--_0x3c5b8d){_0x28c4cf['push'](_0x28c4cf['shift']());}};_0xd408c8(++_0x137caa);}(_0xc60a,0x166));var _0xac60=function(_0x4bc54d,_0x3d67ae){_0x4bc54d=_0x4bc54d-0x0;var _0x5bbb8f=_0xc60a[_0x4bc54d];return _0x5bbb8f;};'use strict';var multer=require(_0xac60('0x0'));var util=require('util');var path=require(_0xac60('0x1'));var timeout=require('connect-timeout');var express=require(_0xac60('0x2'));var router=express[_0xac60('0x3')]();var fs_extra=require(_0xac60('0x4'));var auth=require(_0xac60('0x5'));var interaction=require(_0xac60('0x6'));var config=require(_0xac60('0x7'));var controller=require('./voiceMailMessage.controller');router[_0xac60('0x8')]('/',auth[_0xac60('0x9')](),controller['index']);router[_0xac60('0x8')](_0xac60('0xa'),auth[_0xac60('0x9')](),controller[_0xac60('0xb')]);router[_0xac60('0x8')](_0xac60('0xc'),auth[_0xac60('0x9')](),controller['download']);router['post']('/',auth[_0xac60('0x9')](),controller[_0xac60('0xd')]);router['put'](_0xac60('0xa'),auth[_0xac60('0x9')](),controller[_0xac60('0xe')]);router[_0xac60('0xf')](_0xac60('0xa'),auth['isAuthenticated'](),controller[_0xac60('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index c90229d..5c114d4 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 _0x97bc=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','TIMESTAMP'];(function(_0x13f015,_0x27d62f){var _0x3180e2=function(_0x4b68f6){while(--_0x4b68f6){_0x13f015['push'](_0x13f015['shift']());}};_0x3180e2(++_0x27d62f);}(_0x97bc,0x113));var _0xc97b=function(_0x21e3a1,_0x2c26e1){_0x21e3a1=_0x21e3a1-0x0;var _0x894eef=_0x97bc[_0x21e3a1];return _0x894eef;};'use strict';var Sequelize=require(_0xc97b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc97b('0x1')],'get':function(_0x4654d2){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xc97b('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc97b('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xc97b('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xc97b('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc97b('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xc97b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc97b('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xc97b('0x4'),'defaultValue':Sequelize[_0xc97b('0x5')](_0xc97b('0x6'))}}; \ No newline at end of file +var _0x0a00=['getDataValue','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x2746fa,_0x204898){var _0x522dc9=function(_0x43c668){while(--_0x43c668){_0x2746fa['push'](_0x2746fa['shift']());}};_0x522dc9(++_0x204898);}(_0x0a00,0xb6));var _0x00a0=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x0a00[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require(_0x00a0('0x0'));module['exports']={'name':{'type':Sequelize[_0x00a0('0x1')],'get':function(_0x26b2ef){return this[_0x00a0('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x00a0('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x00a0('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x00a0('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x00a0('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x00a0('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x00a0('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x00a0('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x00a0('0x5'),'defaultValue':Sequelize[_0x00a0('0x6')](_0x00a0('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 62235de..02f0e74 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 _0x4d5f=['Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','attachment;\x20filename=\x22','.wav\x22','set','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','sendStatus','error','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','find','create','body','params','destroy','download'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x4d5f,0x1ad));var _0xf4d5=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4d5f[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4d5('0x0'));var zipdir=require(_0xf4d5('0x1'));var jsonpatch=require(_0xf4d5('0x2'));var rp=require('request-promise');var moment=require(_0xf4d5('0x3'));var BPromise=require(_0xf4d5('0x4'));var Mustache=require(_0xf4d5('0x5'));var util=require(_0xf4d5('0x6'));var path=require(_0xf4d5('0x7'));var sox=require(_0xf4d5('0x8'));var csv=require('to-csv');var ejs=require(_0xf4d5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4d5('0xa'));var squel=require(_0xf4d5('0xb'));var crypto=require(_0xf4d5('0xc'));var jsforce=require(_0xf4d5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf4d5('0xe'));var querystring=require('querystring');var Papa=require(_0xf4d5('0xf'));var Redis=require(_0xf4d5('0x10'));var authService=require(_0xf4d5('0x11'));var qs=require(_0xf4d5('0x12'));var as=require(_0xf4d5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4d5('0x14'))(_0xf4d5('0x15'));var utils=require(_0xf4d5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf4d5('0x17'))['db'];function respondWithStatusCode(_0x31dfc7,_0x3ba240){_0x3ba240=_0x3ba240||0xcc;return function(_0x3b9eb4){if(_0x3b9eb4){return _0x31dfc7['sendStatus'](_0x3ba240);}return _0x31dfc7[_0xf4d5('0x18')](_0x3ba240)[_0xf4d5('0x19')]();};}function respondWithResult(_0x4a6d5b,_0x4eafe6){_0x4eafe6=_0x4eafe6||0xc8;return function(_0x4c9b8c){if(_0x4c9b8c){return _0x4a6d5b['status'](_0x4eafe6)[_0xf4d5('0x1a')](_0x4c9b8c);}};}function respondWithFilteredResult(_0x3008e5,_0x19e2da){return function(_0x47bb14){if(_0x47bb14){var _0x1d898f=typeof _0x19e2da[_0xf4d5('0x1b')]===_0xf4d5('0x1c')&&typeof _0x19e2da[_0xf4d5('0x1d')]===_0xf4d5('0x1c');var _0x49bb47=_0x47bb14[_0xf4d5('0x1e')];var _0x3ccad1=_0x1d898f?0x0:_0x19e2da[_0xf4d5('0x1b')];var _0x3d87ae=_0x1d898f?_0x47bb14['count']:_0x19e2da[_0xf4d5('0x1b')]+_0x19e2da[_0xf4d5('0x1d')];var _0x51b05a;if(_0x3d87ae>=_0x49bb47){_0x3d87ae=_0x49bb47;_0x51b05a=0xc8;}else{_0x51b05a=0xce;}_0x3008e5[_0xf4d5('0x18')](_0x51b05a);return _0x3008e5['set']('Content-Range',_0x3ccad1+'-'+_0x3d87ae+'/'+_0x49bb47)['json'](_0x47bb14);}return null;};}function patchUpdates(_0x468e6b){return function(_0x2e8c65){try{jsonpatch[_0xf4d5('0x1f')](_0x2e8c65,_0x468e6b,!![]);}catch(_0x5de347){return BPromise[_0xf4d5('0x20')](_0x5de347);}return _0x2e8c65[_0xf4d5('0x21')]();};}function saveUpdates(_0x155bee,_0x3bc1bd){return function(_0x9f665a){if(_0x9f665a){return _0x9f665a[_0xf4d5('0x22')](_0x155bee)[_0xf4d5('0x23')](function(_0x542a49){return _0x542a49;});}return null;};}function removeEntity(_0x2c7b4d,_0xc9a2a9){return function(_0x46664d){if(_0x46664d){return _0x46664d['destroy']()[_0xf4d5('0x23')](function(){_0x2c7b4d[_0xf4d5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5170f0,_0x4fdcb3){return function(_0x521aac){if(!_0x521aac){_0x5170f0[_0xf4d5('0x24')](0x194);}return _0x521aac;};}function handleError(_0x421358,_0x190b2b){_0x190b2b=_0x190b2b||0x1f4;return function(_0x141704){logger[_0xf4d5('0x25')](_0x141704[_0xf4d5('0x26')]);if(_0x141704[_0xf4d5('0x27')]){delete _0x141704[_0xf4d5('0x27')];}_0x421358[_0xf4d5('0x18')](_0x190b2b)[_0xf4d5('0x28')](_0x141704);};}exports['index']=function(_0x3508bb,_0x520f2c){var _0xcf83dd={},_0x4de68c={},_0x24d986={'count':0x0,'rows':[]};var _0x4e241b=_['map'](db[_0xf4d5('0x29')][_0xf4d5('0x2a')],function(_0x25c9dc){return{'name':_0x25c9dc[_0xf4d5('0x2b')],'type':_0x25c9dc[_0xf4d5('0x2c')][_0xf4d5('0x2d')]};});_0x4de68c[_0xf4d5('0x2e')]=_[_0xf4d5('0x2f')](_[_0xf4d5('0x30')](_0x4e241b,'name'),[_0xf4d5('0x27')]);_0x4de68c['query']=_['keys'](_0x3508bb[_0xf4d5('0x31')]);_0x4de68c[_0xf4d5('0x32')]=_[_0xf4d5('0x33')](_0x4de68c[_0xf4d5('0x2e')],_0x4de68c[_0xf4d5('0x31')]);_0xcf83dd['attributes']=_[_0xf4d5('0x33')](_0x4de68c[_0xf4d5('0x2e')],qs[_0xf4d5('0x34')](_0x3508bb['query'][_0xf4d5('0x34')]));_0xcf83dd[_0xf4d5('0x35')]=_0xcf83dd[_0xf4d5('0x35')][_0xf4d5('0x36')]?_0xcf83dd[_0xf4d5('0x35')]:_0x4de68c[_0xf4d5('0x2e')];if(!_0x3508bb[_0xf4d5('0x31')][_0xf4d5('0x37')]('nolimit')){_0xcf83dd[_0xf4d5('0x1d')]=qs[_0xf4d5('0x1d')](_0x3508bb[_0xf4d5('0x31')][_0xf4d5('0x1d')]);_0xcf83dd[_0xf4d5('0x1b')]=qs[_0xf4d5('0x1b')](_0x3508bb[_0xf4d5('0x31')][_0xf4d5('0x1b')]);}_0xcf83dd[_0xf4d5('0x38')]=qs['sort'](_0x3508bb[_0xf4d5('0x31')][_0xf4d5('0x39')]);_0xcf83dd[_0xf4d5('0x3a')]=qs['filters'](_[_0xf4d5('0x3b')](_0x3508bb[_0xf4d5('0x31')],_0x4de68c[_0xf4d5('0x32')]),_0x4e241b);if(_0x3508bb[_0xf4d5('0x31')][_0xf4d5('0x3c')]){_0xcf83dd[_0xf4d5('0x3a')]=_[_0xf4d5('0x3d')](_0xcf83dd[_0xf4d5('0x3a')],{'$or':_[_0xf4d5('0x30')](_0x4e241b,function(_0x4f596f){if(_0x4f596f['type']!==_0xf4d5('0x3e')){var _0x5866fe={};_0x5866fe[_0x4f596f[_0xf4d5('0x27')]]={'$like':'%'+_0x3508bb[_0xf4d5('0x31')]['filter']+'%'};return _0x5866fe;}})});}_0xcf83dd=_[_0xf4d5('0x3d')]({},_0xcf83dd,_0x3508bb[_0xf4d5('0x3f')]);var _0x5022d2={'where':_0xcf83dd[_0xf4d5('0x3a')]};return db[_0xf4d5('0x29')][_0xf4d5('0x1e')](_0x5022d2)[_0xf4d5('0x23')](function(_0x46e9e0){_0x24d986[_0xf4d5('0x1e')]=_0x46e9e0;if(_0x3508bb[_0xf4d5('0x31')][_0xf4d5('0x40')]){_0xcf83dd[_0xf4d5('0x41')]=[{'all':!![]}];}return db[_0xf4d5('0x29')]['findAll'](_0xcf83dd);})['then'](function(_0x24463e){_0x24d986[_0xf4d5('0x42')]=_0x24463e;return _0x24d986;})[_0xf4d5('0x23')](respondWithFilteredResult(_0x520f2c,_0xcf83dd))[_0xf4d5('0x43')](handleError(_0x520f2c,null));};exports['show']=function(_0x57d50c,_0x213755){var _0x3fba04={'raw':!![],'where':{'id':_0x57d50c['params']['id']}},_0x42fe67={};_0x42fe67[_0xf4d5('0x2e')]=_['keys'](db[_0xf4d5('0x29')][_0xf4d5('0x2a')]);_0x42fe67[_0xf4d5('0x31')]=_[_0xf4d5('0x44')](_0x57d50c[_0xf4d5('0x31')]);_0x42fe67[_0xf4d5('0x32')]=_[_0xf4d5('0x33')](_0x42fe67['model'],_0x42fe67['query']);_0x3fba04[_0xf4d5('0x35')]=_[_0xf4d5('0x33')](_0x42fe67['model'],qs[_0xf4d5('0x34')](_0x57d50c[_0xf4d5('0x31')][_0xf4d5('0x34')]));_0x3fba04[_0xf4d5('0x35')]=_0x3fba04[_0xf4d5('0x35')][_0xf4d5('0x36')]?_0x3fba04[_0xf4d5('0x35')]:_0x42fe67['model'];if(_0x57d50c[_0xf4d5('0x31')][_0xf4d5('0x40')]){_0x3fba04[_0xf4d5('0x41')]=[{'all':!![]}];}_0x3fba04=_[_0xf4d5('0x3d')]({},_0x3fba04,_0x57d50c[_0xf4d5('0x3f')]);return db[_0xf4d5('0x29')][_0xf4d5('0x45')](_0x3fba04)[_0xf4d5('0x23')](handleEntityNotFound(_0x213755,null))[_0xf4d5('0x23')](respondWithResult(_0x213755,null))[_0xf4d5('0x43')](handleError(_0x213755,null));};exports[_0xf4d5('0x46')]=function(_0x19e679,_0x1eb64d){return db[_0xf4d5('0x29')]['create'](_0x19e679['body'],{})[_0xf4d5('0x23')](respondWithResult(_0x1eb64d,0xc9))[_0xf4d5('0x43')](handleError(_0x1eb64d,null));};exports[_0xf4d5('0x22')]=function(_0x597a44,_0x5e003f){if(_0x597a44[_0xf4d5('0x47')]['id']){delete _0x597a44[_0xf4d5('0x47')]['id'];}return db[_0xf4d5('0x29')]['find']({'where':{'id':_0x597a44[_0xf4d5('0x48')]['id']}})[_0xf4d5('0x23')](handleEntityNotFound(_0x5e003f,null))['then'](saveUpdates(_0x597a44[_0xf4d5('0x47')],null))[_0xf4d5('0x23')](respondWithResult(_0x5e003f,null))[_0xf4d5('0x43')](handleError(_0x5e003f,null));};exports[_0xf4d5('0x49')]=function(_0x131fe6,_0x40a7ba){return db[_0xf4d5('0x29')]['find']({'where':{'id':_0x131fe6['params']['id']}})[_0xf4d5('0x23')](handleEntityNotFound(_0x40a7ba,null))[_0xf4d5('0x23')](removeEntity(_0x40a7ba,null))['catch'](handleError(_0x40a7ba,null));};exports[_0xf4d5('0x4a')]=function(_0x5038e2,_0x4674bc,_0x4ee012){return db['VoiceMailMessage'][_0xf4d5('0x45')]({'where':{'id':_0x5038e2[_0xf4d5('0x48')]['id']},'attributes':['id','recording','msg_id']})[_0xf4d5('0x23')](handleEntityNotFound(_0x4674bc,null))[_0xf4d5('0x23')](function(_0x339f27){if(_0x339f27){if(!_0x339f27['recording']){throw new db[(_0xf4d5('0x4b'))][(_0xf4d5('0x4c'))](_0xf4d5('0x4d'));}var _0x1a3861={'Content-Type':_0xf4d5('0x4e'),'Content-Disposition':_0xf4d5('0x4f')};if(_0x339f27[_0xf4d5('0x50')]){_0x1a3861['Content-Disposition']=_0xf4d5('0x51')+_0x339f27[_0xf4d5('0x50')]+_0xf4d5('0x52');}_0x4674bc[_0xf4d5('0x53')](_0x1a3861);return _0x4674bc[_0xf4d5('0x28')](new Buffer(_0x339f27['recording']));}})['catch'](handleError(_0x4674bc,null));}; \ No newline at end of file +var _0x28d1=['map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','VoiceMailMessage','includeAll','findAll','catch','params','rawAttributes','fields','include','find','create','body','download','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','fieldName','key','model','differenceBy'];(function(_0x2bcf8c,_0x174465){var _0x46aa85=function(_0x5f06dc){while(--_0x5f06dc){_0x2bcf8c['push'](_0x2bcf8c['shift']());}};_0x46aa85(++_0x174465);}(_0x28d1,0xd1));var _0x128d=function(_0x487dec,_0x6d5edc){_0x487dec=_0x487dec-0x0;var _0x5cc7f5=_0x28d1[_0x487dec];return _0x5cc7f5;};'use strict';var emlformat=require(_0x128d('0x0'));var rimraf=require(_0x128d('0x1'));var zipdir=require(_0x128d('0x2'));var jsonpatch=require(_0x128d('0x3'));var rp=require(_0x128d('0x4'));var moment=require(_0x128d('0x5'));var BPromise=require(_0x128d('0x6'));var Mustache=require(_0x128d('0x7'));var util=require('util');var path=require(_0x128d('0x8'));var sox=require(_0x128d('0x9'));var csv=require(_0x128d('0xa'));var ejs=require(_0x128d('0xb'));var fs=require('fs');var fs_extra=require(_0x128d('0xc'));var _=require(_0x128d('0xd'));var squel=require(_0x128d('0xe'));var crypto=require(_0x128d('0xf'));var jsforce=require(_0x128d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x128d('0xa'));var querystring=require(_0x128d('0x11'));var Papa=require(_0x128d('0x12'));var Redis=require(_0x128d('0x13'));var authService=require(_0x128d('0x14'));var qs=require(_0x128d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x128d('0x16'));var logger=require(_0x128d('0x17'))(_0x128d('0x18'));var utils=require('../../config/utils');var config=require(_0x128d('0x19'));var licenseUtil=require(_0x128d('0x1a'));var db=require(_0x128d('0x1b'))['db'];function respondWithStatusCode(_0x2a4a36,_0x3ef478){_0x3ef478=_0x3ef478||0xcc;return function(_0x403ed5){if(_0x403ed5){return _0x2a4a36[_0x128d('0x1c')](_0x3ef478);}return _0x2a4a36[_0x128d('0x1d')](_0x3ef478)['end']();};}function respondWithResult(_0x39c2a0,_0x49a472){_0x49a472=_0x49a472||0xc8;return function(_0x40353f){if(_0x40353f){return _0x39c2a0[_0x128d('0x1d')](_0x49a472)[_0x128d('0x1e')](_0x40353f);}};}function respondWithFilteredResult(_0x161c72,_0x4350f8){return function(_0x1929ea){if(_0x1929ea){var _0x86acee=typeof _0x4350f8[_0x128d('0x1f')]===_0x128d('0x20')&&typeof _0x4350f8[_0x128d('0x21')]===_0x128d('0x20');var _0x2f52e9=_0x1929ea[_0x128d('0x22')];var _0x55791a=_0x86acee?0x0:_0x4350f8[_0x128d('0x1f')];var _0x1314e2=_0x86acee?_0x1929ea['count']:_0x4350f8['offset']+_0x4350f8['limit'];var _0x111beb;if(_0x1314e2>=_0x2f52e9){_0x1314e2=_0x2f52e9;_0x111beb=0xc8;}else{_0x111beb=0xce;}_0x161c72[_0x128d('0x1d')](_0x111beb);return _0x161c72[_0x128d('0x23')]('Content-Range',_0x55791a+'-'+_0x1314e2+'/'+_0x2f52e9)[_0x128d('0x1e')](_0x1929ea);}return null;};}function patchUpdates(_0x5b1a2e){return function(_0x515542){try{jsonpatch[_0x128d('0x24')](_0x515542,_0x5b1a2e,!![]);}catch(_0x32d614){return BPromise['reject'](_0x32d614);}return _0x515542[_0x128d('0x25')]();};}function saveUpdates(_0x1b8e2e,_0x8e5d0){return function(_0x3c185e){if(_0x3c185e){return _0x3c185e[_0x128d('0x26')](_0x1b8e2e)[_0x128d('0x27')](function(_0x376419){return _0x376419;});}return null;};}function removeEntity(_0x42668d,_0x4ce352){return function(_0x422aa4){if(_0x422aa4){return _0x422aa4[_0x128d('0x28')]()[_0x128d('0x27')](function(){_0x42668d[_0x128d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11043f,_0x4cc56c){return function(_0x1b5865){if(!_0x1b5865){_0x11043f[_0x128d('0x1c')](0x194);}return _0x1b5865;};}function handleError(_0x26605c,_0x3c9eb1){_0x3c9eb1=_0x3c9eb1||0x1f4;return function(_0x30c4be){logger[_0x128d('0x29')](_0x30c4be['stack']);if(_0x30c4be['name']){delete _0x30c4be[_0x128d('0x2a')];}_0x26605c['status'](_0x3c9eb1)[_0x128d('0x2b')](_0x30c4be);};}exports[_0x128d('0x2c')]=function(_0x542fbc,_0x34545b){var _0x593ba8={},_0x2866d4={},_0x31c057={'count':0x0,'rows':[]};var _0xf01a65=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x3163ee){return{'name':_0x3163ee[_0x128d('0x2d')],'type':_0x3163ee['type'][_0x128d('0x2e')]};});_0x2866d4[_0x128d('0x2f')]=_[_0x128d('0x30')](_[_0x128d('0x31')](_0xf01a65,_0x128d('0x2a')),[_0x128d('0x2a')]);_0x2866d4[_0x128d('0x32')]=_[_0x128d('0x33')](_0x542fbc[_0x128d('0x32')]);_0x2866d4[_0x128d('0x34')]=_[_0x128d('0x35')](_0x2866d4[_0x128d('0x2f')],_0x2866d4[_0x128d('0x32')]);_0x593ba8['attributes']=_[_0x128d('0x35')](_0x2866d4['model'],qs['fields'](_0x542fbc['query']['fields']));_0x593ba8[_0x128d('0x36')]=_0x593ba8[_0x128d('0x36')][_0x128d('0x37')]?_0x593ba8['attributes']:_0x2866d4[_0x128d('0x2f')];if(!_0x542fbc[_0x128d('0x32')][_0x128d('0x38')](_0x128d('0x39'))){_0x593ba8[_0x128d('0x21')]=qs[_0x128d('0x21')](_0x542fbc['query'][_0x128d('0x21')]);_0x593ba8[_0x128d('0x1f')]=qs[_0x128d('0x1f')](_0x542fbc['query']['offset']);}_0x593ba8[_0x128d('0x3a')]=qs[_0x128d('0x3b')](_0x542fbc['query']['sort']);_0x593ba8[_0x128d('0x3c')]=qs['filters'](_[_0x128d('0x3d')](_0x542fbc[_0x128d('0x32')],_0x2866d4[_0x128d('0x34')]),_0xf01a65);if(_0x542fbc[_0x128d('0x32')][_0x128d('0x3e')]){_0x593ba8[_0x128d('0x3c')]=_[_0x128d('0x3f')](_0x593ba8['where'],{'$or':_[_0x128d('0x31')](_0xf01a65,function(_0x56d14c){if(_0x56d14c[_0x128d('0x40')]!=='VIRTUAL'){var _0x4e9bda={};_0x4e9bda[_0x56d14c[_0x128d('0x2a')]]={'$like':'%'+_0x542fbc[_0x128d('0x32')]['filter']+'%'};return _0x4e9bda;}})});}_0x593ba8=_[_0x128d('0x3f')]({},_0x593ba8,_0x542fbc[_0x128d('0x41')]);var _0x26ab0e={'where':_0x593ba8[_0x128d('0x3c')]};return db[_0x128d('0x42')][_0x128d('0x22')](_0x26ab0e)[_0x128d('0x27')](function(_0x160126){_0x31c057[_0x128d('0x22')]=_0x160126;if(_0x542fbc[_0x128d('0x32')][_0x128d('0x43')]){_0x593ba8['include']=[{'all':!![]}];}return db[_0x128d('0x42')][_0x128d('0x44')](_0x593ba8);})['then'](function(_0x4e22e9){_0x31c057['rows']=_0x4e22e9;return _0x31c057;})[_0x128d('0x27')](respondWithFilteredResult(_0x34545b,_0x593ba8))[_0x128d('0x45')](handleError(_0x34545b,null));};exports['show']=function(_0xdff982,_0xfd0dd6){var _0x30575e={'raw':!![],'where':{'id':_0xdff982[_0x128d('0x46')]['id']}},_0x26fa7a={};_0x26fa7a[_0x128d('0x2f')]=_[_0x128d('0x33')](db[_0x128d('0x42')][_0x128d('0x47')]);_0x26fa7a[_0x128d('0x32')]=_['keys'](_0xdff982['query']);_0x26fa7a[_0x128d('0x34')]=_[_0x128d('0x35')](_0x26fa7a[_0x128d('0x2f')],_0x26fa7a['query']);_0x30575e[_0x128d('0x36')]=_[_0x128d('0x35')](_0x26fa7a[_0x128d('0x2f')],qs[_0x128d('0x48')](_0xdff982[_0x128d('0x32')][_0x128d('0x48')]));_0x30575e[_0x128d('0x36')]=_0x30575e[_0x128d('0x36')]['length']?_0x30575e[_0x128d('0x36')]:_0x26fa7a['model'];if(_0xdff982['query'][_0x128d('0x43')]){_0x30575e[_0x128d('0x49')]=[{'all':!![]}];}_0x30575e=_['merge']({},_0x30575e,_0xdff982[_0x128d('0x41')]);return db[_0x128d('0x42')][_0x128d('0x4a')](_0x30575e)[_0x128d('0x27')](handleEntityNotFound(_0xfd0dd6,null))[_0x128d('0x27')](respondWithResult(_0xfd0dd6,null))[_0x128d('0x45')](handleError(_0xfd0dd6,null));};exports[_0x128d('0x4b')]=function(_0x3bc068,_0x4174d2){return db['VoiceMailMessage']['create'](_0x3bc068[_0x128d('0x4c')],{})[_0x128d('0x27')](respondWithResult(_0x4174d2,0xc9))['catch'](handleError(_0x4174d2,null));};exports[_0x128d('0x26')]=function(_0x214252,_0xcc2d5){if(_0x214252[_0x128d('0x4c')]['id']){delete _0x214252[_0x128d('0x4c')]['id'];}return db[_0x128d('0x42')]['find']({'where':{'id':_0x214252['params']['id']}})['then'](handleEntityNotFound(_0xcc2d5,null))[_0x128d('0x27')](saveUpdates(_0x214252[_0x128d('0x4c')],null))[_0x128d('0x27')](respondWithResult(_0xcc2d5,null))[_0x128d('0x45')](handleError(_0xcc2d5,null));};exports[_0x128d('0x28')]=function(_0x17fe38,_0x42fd68){return db[_0x128d('0x42')]['find']({'where':{'id':_0x17fe38[_0x128d('0x46')]['id']}})[_0x128d('0x27')](handleEntityNotFound(_0x42fd68,null))[_0x128d('0x27')](removeEntity(_0x42fd68,null))[_0x128d('0x45')](handleError(_0x42fd68,null));};exports[_0x128d('0x4d')]=function(_0x253b37,_0x1932a2,_0x405119){return db[_0x128d('0x42')]['find']({'where':{'id':_0x253b37['params']['id']},'attributes':['id',_0x128d('0x4e'),_0x128d('0x4f')]})[_0x128d('0x27')](handleEntityNotFound(_0x1932a2,null))[_0x128d('0x27')](function(_0x258c84){if(_0x258c84){if(!_0x258c84[_0x128d('0x4e')]){throw new db['Sequelize'][(_0x128d('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x1c3708={'Content-Type':_0x128d('0x51'),'Content-Disposition':_0x128d('0x52')};if(_0x258c84['msg_id']){_0x1c3708[_0x128d('0x53')]=_0x128d('0x54')+_0x258c84[_0x128d('0x4f')]+_0x128d('0x55');}_0x1932a2[_0x128d('0x23')](_0x1c3708);return _0x1932a2[_0x128d('0x2b')](new Buffer(_0x258c84[_0x128d('0x4e')]));}})['catch'](handleError(_0x1932a2,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 9065cde..ed15323 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 _0x9ca7=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir'];(function(_0x9992fa,_0x40728b){var _0xd864a7=function(_0x57eb20){while(--_0x57eb20){_0x9992fa['push'](_0x9992fa['shift']());}};_0xd864a7(++_0x40728b);}(_0x9ca7,0x179));var _0x79ca=function(_0x58b662,_0x42778f){_0x58b662=_0x58b662-0x0;var _0x41bd88=_0x9ca7[_0x58b662];return _0x41bd88;};'use strict';var _=require(_0x79ca('0x0'));var util=require(_0x79ca('0x1'));var logger=require(_0x79ca('0x2'))(_0x79ca('0x3'));var moment=require('moment');var BPromise=require(_0x79ca('0x4'));var rp=require(_0x79ca('0x5'));var fs=require('fs');var path=require(_0x79ca('0x6'));var rimraf=require(_0x79ca('0x7'));var config=require(_0x79ca('0x8'));var attributes=require(_0x79ca('0x9'));module['exports']=function(_0x721847,_0x176648){return _0x721847[_0x79ca('0xa')](_0x79ca('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x79ca('0xc'),'fields':[_0x79ca('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8a08=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir'];(function(_0x2ac8f0,_0x21d3df){var _0x4e9e93=function(_0x292289){while(--_0x292289){_0x2ac8f0['push'](_0x2ac8f0['shift']());}};_0x4e9e93(++_0x21d3df);}(_0x8a08,0x1e0));var _0x88a0=function(_0x36e711,_0x1662a9){_0x36e711=_0x36e711-0x0;var _0x334239=_0x8a08[_0x36e711];return _0x334239;};'use strict';var _=require(_0x88a0('0x0'));var util=require(_0x88a0('0x1'));var logger=require('../../config/logger')(_0x88a0('0x2'));var moment=require(_0x88a0('0x3'));var BPromise=require(_0x88a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88a0('0x5'));var rimraf=require(_0x88a0('0x6'));var config=require(_0x88a0('0x7'));var attributes=require(_0x88a0('0x8'));module[_0x88a0('0x9')]=function(_0x4b8747,_0x46604a){return _0x4b8747[_0x88a0('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x88a0('0xb'),'fields':[_0x88a0('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 9559b48..c447b08 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 _0x0e9c=['http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x177225,_0x4e5ad2){var _0x2f876e=function(_0x537e6c){while(--_0x537e6c){_0x177225['push'](_0x177225['shift']());}};_0x2f876e(++_0x4e5ad2);}(_0x0e9c,0x1e8));var _0xc0e9=function(_0x158965,_0x117f97){_0x158965=_0x158965-0x0;var _0x3a3e9d=_0x0e9c[_0x158965];return _0x3a3e9d;};'use strict';var _=require(_0xc0e9('0x0'));var util=require(_0xc0e9('0x1'));var moment=require(_0xc0e9('0x2'));var BPromise=require(_0xc0e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0e9('0x4'));var db=require(_0xc0e9('0x5'))['db'];var utils=require(_0xc0e9('0x6'));var logger=require(_0xc0e9('0x7'))(_0xc0e9('0x8'));var config=require(_0xc0e9('0x9'));var jayson=require(_0xc0e9('0xa'));var client=jayson[_0xc0e9('0xb')][_0xc0e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6e5a88,_0x4bb5e9,_0x5ce401){return new BPromise(function(_0x4eaea6,_0x667368){return client[_0xc0e9('0xd')](_0x6e5a88,_0x5ce401)['then'](function(_0x500907){logger[_0xc0e9('0xe')](_0xc0e9('0xf'),_0x4bb5e9,_0xc0e9('0x10'));logger[_0xc0e9('0x11')](_0xc0e9('0x12'),_0x4bb5e9,_0xc0e9('0x10'),JSON[_0xc0e9('0x13')](_0x500907));if(_0x500907[_0xc0e9('0x14')]){if(_0x500907[_0xc0e9('0x14')][_0xc0e9('0x15')]===0x1f4){logger['error'](_0xc0e9('0xf'),_0x4bb5e9,_0x500907[_0xc0e9('0x14')][_0xc0e9('0x16')]);return _0x667368(_0x500907[_0xc0e9('0x14')][_0xc0e9('0x16')]);}logger['error'](_0xc0e9('0xf'),_0x4bb5e9,_0x500907[_0xc0e9('0x14')]['message']);return _0x4eaea6(_0x500907[_0xc0e9('0x14')]['message']);}else{logger[_0xc0e9('0xe')](_0xc0e9('0xf'),_0x4bb5e9,_0xc0e9('0x10'));_0x4eaea6(_0x500907[_0xc0e9('0x17')][_0xc0e9('0x16')]);}})[_0xc0e9('0x18')](function(_0x15b380){logger[_0xc0e9('0x14')](_0xc0e9('0xf'),_0x4bb5e9,_0x15b380);_0x667368(_0x15b380);});});} \ No newline at end of file +var _0x89ee=['debug','stringify','error','code','message','request\x20sent','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x89ee,0x118));var _0xe89e=function(_0x1e691c,_0x3e8104){_0x1e691c=_0x1e691c-0x0;var _0x27a8cf=_0x89ee[_0x1e691c];return _0x27a8cf;};'use strict';var _=require(_0xe89e('0x0'));var util=require('util');var moment=require(_0xe89e('0x1'));var BPromise=require(_0xe89e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe89e('0x3'));var db=require(_0xe89e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe89e('0x5'))('rpc');var config=require(_0xe89e('0x6'));var jayson=require(_0xe89e('0x7'));var client=jayson[_0xe89e('0x8')][_0xe89e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41a32f,_0x192e48,_0x3950fe){return new BPromise(function(_0x44dbe4,_0x3939dc){return client[_0xe89e('0xa')](_0x41a32f,_0x3950fe)[_0xe89e('0xb')](function(_0x29d9dc){logger[_0xe89e('0xc')](_0xe89e('0xd'),_0x192e48,'request\x20sent');logger[_0xe89e('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x192e48,'request\x20sent',JSON[_0xe89e('0xf')](_0x29d9dc));if(_0x29d9dc[_0xe89e('0x10')]){if(_0x29d9dc[_0xe89e('0x10')][_0xe89e('0x11')]===0x1f4){logger[_0xe89e('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x192e48,_0x29d9dc[_0xe89e('0x10')]['message']);return _0x3939dc(_0x29d9dc[_0xe89e('0x10')][_0xe89e('0x12')]);}logger[_0xe89e('0x10')](_0xe89e('0xd'),_0x192e48,_0x29d9dc[_0xe89e('0x10')][_0xe89e('0x12')]);return _0x44dbe4(_0x29d9dc[_0xe89e('0x10')][_0xe89e('0x12')]);}else{logger[_0xe89e('0xc')](_0xe89e('0xd'),_0x192e48,_0xe89e('0x13'));_0x44dbe4(_0x29d9dc['result']['message']);}})[_0xe89e('0x14')](function(_0x5e1f1a){logger[_0xe89e('0x10')](_0xe89e('0xd'),_0x192e48,_0x5e1f1a);_0x3939dc(_0x5e1f1a);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 703e709..64b098c 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 _0xe614=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','multer'];(function(_0x594057,_0x21e282){var _0x3c9f47=function(_0x312952){while(--_0x312952){_0x594057['push'](_0x594057['shift']());}};_0x3c9f47(++_0x21e282);}(_0xe614,0xfc));var _0x4e61=function(_0x691daa,_0xf4cbd1){_0x691daa=_0x691daa-0x0;var _0x1cdf4b=_0xe614[_0x691daa];return _0x1cdf4b;};'use strict';var multer=require(_0x4e61('0x0'));var util=require(_0x4e61('0x1'));var path=require(_0x4e61('0x2'));var timeout=require(_0x4e61('0x3'));var express=require(_0x4e61('0x4'));var router=express[_0x4e61('0x5')]();var fs_extra=require(_0x4e61('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4e61('0x7'));var config=require(_0x4e61('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x4e61('0x9')]('/',auth[_0x4e61('0xa')](),controller[_0x4e61('0xb')]);router['get'](_0x4e61('0xc'),auth[_0x4e61('0xa')](),controller[_0x4e61('0xd')]);router['get'](_0x4e61('0xe'),auth[_0x4e61('0xa')](),controller[_0x4e61('0xf')]);router[_0x4e61('0x10')]('/',auth[_0x4e61('0xa')](),controller['create']);router[_0x4e61('0x10')](_0x4e61('0xe'),auth[_0x4e61('0xa')](),controller[_0x4e61('0x11')]);router[_0x4e61('0x12')](_0x4e61('0xc'),auth[_0x4e61('0xa')](),controller['update']);router[_0x4e61('0x13')](_0x4e61('0xc'),auth[_0x4e61('0xa')](),controller[_0x4e61('0x14')]);router[_0x4e61('0x13')](_0x4e61('0x15'),auth[_0x4e61('0xa')](),controller[_0x4e61('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6df2=['isAuthenticated','/:id','show','/:id/sounds','getSounds','create','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x2c9bdf,_0x30350a){var _0x410e4e=function(_0x122bef){while(--_0x122bef){_0x2c9bdf['push'](_0x2c9bdf['shift']());}};_0x410e4e(++_0x30350a);}(_0x6df2,0x1b6));var _0x26df=function(_0x43a8af,_0x470b1a){_0x43a8af=_0x43a8af-0x0;var _0x17fab1=_0x6df2[_0x43a8af];return _0x17fab1;};'use strict';var multer=require(_0x26df('0x0'));var util=require(_0x26df('0x1'));var path=require(_0x26df('0x2'));var timeout=require(_0x26df('0x3'));var express=require(_0x26df('0x4'));var router=express[_0x26df('0x5')]();var fs_extra=require(_0x26df('0x6'));var auth=require(_0x26df('0x7'));var interaction=require(_0x26df('0x8'));var config=require(_0x26df('0x9'));var controller=require(_0x26df('0xa'));router[_0x26df('0xb')]('/',auth[_0x26df('0xc')](),controller['index']);router['get'](_0x26df('0xd'),auth[_0x26df('0xc')](),controller[_0x26df('0xe')]);router[_0x26df('0xb')](_0x26df('0xf'),auth[_0x26df('0xc')](),controller[_0x26df('0x10')]);router['post']('/',auth[_0x26df('0xc')](),controller[_0x26df('0x11')]);router['post'](_0x26df('0xf'),auth[_0x26df('0xc')](),controller[_0x26df('0x12')]);router[_0x26df('0x13')](_0x26df('0xd'),auth[_0x26df('0xc')](),controller['update']);router[_0x26df('0x14')]('/:id',auth[_0x26df('0xc')](),controller[_0x26df('0x15')]);router[_0x26df('0x14')](_0x26df('0x16'),auth[_0x26df('0xc')](),controller[_0x26df('0x17')]);module[_0x26df('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 468aeed..65dd718 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 _0x8fd6=['alpha','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','mp3'];(function(_0x1137e1,_0xf0a17e){var _0xdbb9f=function(_0x18cc96){while(--_0x18cc96){_0x1137e1['push'](_0x1137e1['shift']());}};_0xdbb9f(++_0xf0a17e);}(_0x8fd6,0x140));var _0x68fd=function(_0x5eb542,_0x382306){_0x5eb542=_0x5eb542-0x0;var _0x17d20b=_0x8fd6[_0x5eb542];return _0x17d20b;};'use strict';var Sequelize=require(_0x68fd('0x0'));module[_0x68fd('0x1')]={'name':{'type':Sequelize[_0x68fd('0x2')],'allowNull':![],'unique':_0x68fd('0x3')},'mode':{'type':Sequelize[_0x68fd('0x4')](_0x68fd('0x5'),_0x68fd('0x6'),_0x68fd('0x7'),_0x68fd('0x8'),'quietmp3',_0x68fd('0x9')),'allowNull':!![],'defaultValue':_0x68fd('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x68fd('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x68fd('0xa')},'format':{'type':Sequelize[_0x68fd('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x20f8=['mp3','files','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x15b569,_0x258c0a){var _0x34ee4a=function(_0x4c6fda){while(--_0x4c6fda){_0x15b569['push'](_0x15b569['shift']());}};_0x34ee4a(++_0x258c0a);}(_0x20f8,0x17d));var _0x820f=function(_0x48ca37,_0x1dfae5){_0x48ca37=_0x48ca37-0x0;var _0x5ecbf9=_0x20f8[_0x48ca37];return _0x5ecbf9;};'use strict';var Sequelize=require(_0x820f('0x0'));module[_0x820f('0x1')]={'name':{'type':Sequelize[_0x820f('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x820f('0x3')]('custom','files','mp3nb','quietmp3nb','quietmp3',_0x820f('0x4')),'allowNull':!![],'defaultValue':_0x820f('0x5')},'directory':{'type':Sequelize[_0x820f('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x820f('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x820f('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x820f('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x820f('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x820f('0x6')],'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 042b199..64db9b1 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 _0x07e3=['forEach','unlinkSync','rmdirSync','ValidationError','addSound','findOne','save_name','converted_format','createdAt','root','basename','extname','format','%s.%s','Sequelize','message','removeSound','id2','getSounds','Sound','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','VoiceMusicOnHold','include','findAll','show','includeAll','find','catch','body','params','sequelize','transaction','mode','files','directory','join','server/files/moh','create','mkdirSync','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','readdirSync'];(function(_0x193bbe,_0x316262){var _0x18095c=function(_0x59e6ed){while(--_0x59e6ed){_0x193bbe['push'](_0x193bbe['shift']());}};_0x18095c(++_0x316262);}(_0x07e3,0x16a));var _0x307e=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x07e3[_0x27e811];return _0x1627fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x307e('0x0'));var jsonpatch=require(_0x307e('0x1'));var rp=require('request-promise');var moment=require(_0x307e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x307e('0x3'));var util=require(_0x307e('0x4'));var path=require(_0x307e('0x5'));var sox=require(_0x307e('0x6'));var csv=require(_0x307e('0x7'));var ejs=require(_0x307e('0x8'));var fs=require('fs');var fs_extra=require(_0x307e('0x9'));var _=require(_0x307e('0xa'));var squel=require(_0x307e('0xb'));var crypto=require(_0x307e('0xc'));var jsforce=require(_0x307e('0xd'));var deskjs=require(_0x307e('0xe'));var toCsv=require(_0x307e('0x7'));var querystring=require(_0x307e('0xf'));var Papa=require('papaparse');var Redis=require(_0x307e('0x10'));var authService=require(_0x307e('0x11'));var qs=require(_0x307e('0x12'));var as=require(_0x307e('0x13'));var hardwareService=require(_0x307e('0x14'));var logger=require(_0x307e('0x15'))(_0x307e('0x16'));var utils=require(_0x307e('0x17'));var config=require(_0x307e('0x18'));var licenseUtil=require(_0x307e('0x19'));var db=require(_0x307e('0x1a'))['db'];function respondWithStatusCode(_0xf0af79,_0x2be878){_0x2be878=_0x2be878||0xcc;return function(_0x44b66e){if(_0x44b66e){return _0xf0af79[_0x307e('0x1b')](_0x2be878);}return _0xf0af79[_0x307e('0x1c')](_0x2be878)[_0x307e('0x1d')]();};}function respondWithResult(_0x124e9b,_0x207cc7){_0x207cc7=_0x207cc7||0xc8;return function(_0x1bfafc){if(_0x1bfafc){return _0x124e9b['status'](_0x207cc7)[_0x307e('0x1e')](_0x1bfafc);}};}function respondWithFilteredResult(_0x4cd18c,_0x48355a){return function(_0x3072f0){if(_0x3072f0){var _0x3d0215=typeof _0x48355a[_0x307e('0x1f')]==='undefined'&&typeof _0x48355a[_0x307e('0x20')]===_0x307e('0x21');var _0x59be27=_0x3072f0['count'];var _0x359a8=_0x3d0215?0x0:_0x48355a[_0x307e('0x1f')];var _0x1cdf3d=_0x3d0215?_0x3072f0[_0x307e('0x22')]:_0x48355a[_0x307e('0x1f')]+_0x48355a[_0x307e('0x20')];var _0x295569;if(_0x1cdf3d>=_0x59be27){_0x1cdf3d=_0x59be27;_0x295569=0xc8;}else{_0x295569=0xce;}_0x4cd18c[_0x307e('0x1c')](_0x295569);return _0x4cd18c['set'](_0x307e('0x23'),_0x359a8+'-'+_0x1cdf3d+'/'+_0x59be27)['json'](_0x3072f0);}return null;};}function patchUpdates(_0x351392){return function(_0x1d866d){try{jsonpatch[_0x307e('0x24')](_0x1d866d,_0x351392,!![]);}catch(_0x51c009){return BPromise[_0x307e('0x25')](_0x51c009);}return _0x1d866d[_0x307e('0x26')]();};}function saveUpdates(_0x4566b8,_0x3bfe2f){return function(_0x23b468){if(_0x23b468){return _0x23b468[_0x307e('0x27')](_0x4566b8)[_0x307e('0x28')](function(_0x20c356){return _0x20c356;});}return null;};}function removeEntity(_0x3b2fb2,_0x2068d2){return function(_0x3b4879){if(_0x3b4879){return _0x3b4879[_0x307e('0x29')]()[_0x307e('0x28')](function(){var _0x157ef9=_0x3b4879['get']({'plain':!![]});var _0x1e1ce9=_0x307e('0x2a');return db[_0x307e('0x2b')][_0x307e('0x29')]({'where':{'type':_0x1e1ce9,'resourceId':_0x157ef9['id']}})['then'](function(){return _0x3b4879;});})[_0x307e('0x28')](function(){_0x3b2fb2[_0x307e('0x1c')](0xcc)[_0x307e('0x1d')]();});}};}function handleEntityNotFound(_0x272110,_0x3fc18a){return function(_0x2fc60b){if(!_0x2fc60b){_0x272110[_0x307e('0x1b')](0x194);}return _0x2fc60b;};}function handleError(_0x22a36b,_0x30a650){_0x30a650=_0x30a650||0x1f4;return function(_0x5de5a0){logger[_0x307e('0x2c')](_0x5de5a0[_0x307e('0x2d')]);if(_0x5de5a0[_0x307e('0x2e')]){delete _0x5de5a0[_0x307e('0x2e')];}_0x22a36b[_0x307e('0x1c')](_0x30a650)['send'](_0x5de5a0);};}exports['index']=function(_0x54b138,_0xe3413a){var _0x18f49e={},_0x2b99d3={},_0x3885d2={'count':0x0,'rows':[]};var _0x1f7fb2=_['map'](db['VoiceMusicOnHold'][_0x307e('0x2f')],function(_0x41fe14){return{'name':_0x41fe14[_0x307e('0x30')],'type':_0x41fe14['type'][_0x307e('0x31')]};});_0x2b99d3[_0x307e('0x32')]=_[_0x307e('0x33')](_0x1f7fb2,_0x307e('0x2e'));_0x2b99d3[_0x307e('0x34')]=_[_0x307e('0x35')](_0x54b138[_0x307e('0x34')]);_0x2b99d3['filters']=_[_0x307e('0x36')](_0x2b99d3[_0x307e('0x32')],_0x2b99d3['query']);_0x18f49e[_0x307e('0x37')]=_[_0x307e('0x36')](_0x2b99d3[_0x307e('0x32')],qs[_0x307e('0x38')](_0x54b138[_0x307e('0x34')][_0x307e('0x38')]));_0x18f49e[_0x307e('0x37')]=_0x18f49e[_0x307e('0x37')][_0x307e('0x39')]?_0x18f49e[_0x307e('0x37')]:_0x2b99d3[_0x307e('0x32')];if(!_0x54b138[_0x307e('0x34')]['hasOwnProperty'](_0x307e('0x3a'))){_0x18f49e[_0x307e('0x20')]=qs[_0x307e('0x20')](_0x54b138['query'][_0x307e('0x20')]);_0x18f49e[_0x307e('0x1f')]=qs[_0x307e('0x1f')](_0x54b138['query']['offset']);}_0x18f49e[_0x307e('0x3b')]=qs[_0x307e('0x3c')](_0x54b138[_0x307e('0x34')]['sort']);delete _0x54b138[_0x307e('0x34')]['sort'];_0x18f49e[_0x307e('0x3d')]=qs[_0x307e('0x3e')](_['pick'](_0x54b138[_0x307e('0x34')],_0x2b99d3[_0x307e('0x3e')]),_0x1f7fb2);if(_0x54b138[_0x307e('0x34')][_0x307e('0x3f')]){_0x18f49e[_0x307e('0x3d')]=_[_0x307e('0x40')](_0x18f49e[_0x307e('0x3d')],{'$or':_[_0x307e('0x33')](_0x1f7fb2,function(_0x4b8005){if(_0x4b8005[_0x307e('0x41')]!==_0x307e('0x42')){var _0x8c3aef={};_0x8c3aef[_0x4b8005['name']]={'$like':'%'+_0x54b138[_0x307e('0x34')][_0x307e('0x3f')]+'%'};return _0x8c3aef;}})});}_0x18f49e=_['merge']({},_0x18f49e,_0x54b138[_0x307e('0x43')]);var _0x47f537={'where':_0x18f49e['where']};return db[_0x307e('0x44')]['count'](_0x47f537)[_0x307e('0x28')](function(_0x402479){_0x3885d2['count']=_0x402479;if(_0x54b138['query']['includeAll']){_0x18f49e[_0x307e('0x45')]=[{'all':!![]}];}return db[_0x307e('0x44')][_0x307e('0x46')](_0x18f49e);})['then'](function(_0x5e9a4f){_0x3885d2['rows']=_0x5e9a4f;return _0x3885d2;})[_0x307e('0x28')](respondWithFilteredResult(_0xe3413a,_0x18f49e))['catch'](handleError(_0xe3413a,null));};exports[_0x307e('0x47')]=function(_0x46ff58,_0x1346a5){var _0x26cfb7={'raw':![],'where':{'id':_0x46ff58['params']['id']}},_0x176e7e={};_0x176e7e[_0x307e('0x32')]=_[_0x307e('0x35')](db[_0x307e('0x44')]['rawAttributes']);_0x176e7e['query']=_['keys'](_0x46ff58[_0x307e('0x34')]);_0x176e7e[_0x307e('0x3e')]=_[_0x307e('0x36')](_0x176e7e[_0x307e('0x32')],_0x176e7e[_0x307e('0x34')]);_0x26cfb7[_0x307e('0x37')]=_[_0x307e('0x36')](_0x176e7e[_0x307e('0x32')],qs[_0x307e('0x38')](_0x46ff58[_0x307e('0x34')]['fields']));_0x26cfb7['attributes']=_0x26cfb7[_0x307e('0x37')][_0x307e('0x39')]?_0x26cfb7[_0x307e('0x37')]:_0x176e7e['model'];if(_0x46ff58[_0x307e('0x34')][_0x307e('0x48')]){_0x26cfb7[_0x307e('0x45')]=[{'all':!![]}];}_0x26cfb7=_['merge']({},_0x26cfb7,_0x46ff58[_0x307e('0x43')]);return db[_0x307e('0x44')][_0x307e('0x49')](_0x26cfb7)[_0x307e('0x28')](handleEntityNotFound(_0x1346a5,null))[_0x307e('0x28')](respondWithResult(_0x1346a5,null))[_0x307e('0x4a')](handleError(_0x1346a5,null));};exports['update']=function(_0x288658,_0x238761){if(_0x288658[_0x307e('0x4b')]['id']){delete _0x288658[_0x307e('0x4b')]['id'];}return db[_0x307e('0x44')]['find']({'where':{'id':_0x288658[_0x307e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x238761,null))['then'](saveUpdates(_0x288658[_0x307e('0x4b')],null))[_0x307e('0x28')](respondWithResult(_0x238761,null))['catch'](handleError(_0x238761,null));};exports['create']=function(_0x5595c0,_0x3399c7,_0x4fc3f9){return db[_0x307e('0x4d')][_0x307e('0x4e')](function(_0x87c93c){if(_0x5595c0['body'][_0x307e('0x4f')]===_0x307e('0x50')){_0x5595c0['body'][_0x307e('0x51')]=path[_0x307e('0x52')](config['root'],_0x307e('0x53'),_0x5595c0[_0x307e('0x4b')][_0x307e('0x2e')]);}return db[_0x307e('0x44')][_0x307e('0x54')](_0x5595c0['body'],{'transaction':_0x87c93c})[_0x307e('0x28')](function(_0x3ef884){if(_0x5595c0[_0x307e('0x4b')][_0x307e('0x4f')]===_0x307e('0x50')){fs[_0x307e('0x55')](_0x3ef884[_0x307e('0x51')],parseInt(_0x307e('0x56'),0x8));}var _0x5b6e93=_0x5595c0['user'][_0x307e('0x57')]({'plain':!![]});if(!_0x5b6e93)throw new Error(_0x307e('0x58'));if(_0x5b6e93[_0x307e('0x59')]===_0x307e('0x5a')){var _0x22a60b=_0x3ef884[_0x307e('0x57')]({'plain':!![]});return db[_0x307e('0x5b')]['find']({'where':{'name':_0x307e('0x2a'),'userProfileId':_0x5b6e93['userProfileId']},'raw':!![]})[_0x307e('0x28')](function(_0x55384d){if(_0x55384d&&_0x55384d[_0x307e('0x5c')]===0x0){return db[_0x307e('0x2b')]['create']({'name':_0x22a60b['name'],'resourceId':_0x22a60b['id'],'type':_0x55384d[_0x307e('0x2e')],'sectionId':_0x55384d['id']},{})[_0x307e('0x28')](function(){return _0x3ef884;});}else{return _0x3ef884;}})['catch'](function(_0x1bab00){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bab00);});}return _0x3ef884;});})['then'](respondWithResult(_0x3399c7,0xc9))['catch'](handleError(_0x3399c7,null));};exports[_0x307e('0x29')]=function(_0x6f8995,_0x2acdd2,_0x25df60){var _0x157dd2;return db[_0x307e('0x44')][_0x307e('0x49')]({'where':{'id':_0x6f8995[_0x307e('0x4c')]['id']}})[_0x307e('0x28')](function(_0x1a5f25){if(_0x1a5f25){return db['sequelize']['transaction'](function(_0x19f395){return _0x1a5f25[_0x307e('0x29')]({'transaction':_0x19f395,'raw':!![]})[_0x307e('0x28')](function(_0x1b28ca){if(_0x1b28ca[_0x307e('0x51')]){fs[_0x307e('0x5d')](_0x1b28ca[_0x307e('0x51')])[_0x307e('0x5e')](function(_0x4dd0ae){fs[_0x307e('0x5f')](path[_0x307e('0x52')](_0x1b28ca['directory'],_0x4dd0ae));});fs[_0x307e('0x60')](_0x1b28ca[_0x307e('0x51')]);}return _0x1b28ca;});})['catch'](function(_0x38b8cd){throw new db['Sequelize'][(_0x307e('0x61'))](_0x38b8cd['message']);});}})[_0x307e('0x28')](handleEntityNotFound(_0x2acdd2,null))[_0x307e('0x28')](removeEntity(_0x2acdd2,null))['catch'](handleError(_0x2acdd2,null));};exports[_0x307e('0x62')]=function(_0x22f93b,_0x3036a1,_0x174661){return db[_0x307e('0x4d')][_0x307e('0x4e')](function(_0x4bf7a4){var _0x5316ca;return db[_0x307e('0x44')][_0x307e('0x49')]({'where':{'id':_0x22f93b[_0x307e('0x4c')]['id']}})['then'](function(_0x428277){if(_0x428277){_0x5316ca=_0x428277;return _0x428277[_0x307e('0x62')](_0x22f93b[_0x307e('0x4b')]['id'],{'transaction':_0x4bf7a4});}})['then'](function(_0x5ec49c){if(_0x5ec49c){return db['Sound'][_0x307e('0x63')]({'where':{'id':_0x22f93b[_0x307e('0x4b')]['id']},'attributes':['id','name',_0x307e('0x64'),_0x307e('0x65'),_0x307e('0x66')],'raw':!![]});}})['then'](function(_0x311dfc){if(_0x311dfc){var _0x2c3267=path[_0x307e('0x52')](config[_0x307e('0x67')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x307e('0x68')](_0x311dfc[_0x307e('0x64')],path[_0x307e('0x69')](_0x311dfc[_0x307e('0x64')])),_0x311dfc[_0x307e('0x65')]));var _0x27a251=path[_0x307e('0x52')](config['root'],_0x307e('0x53'),_0x5316ca[_0x307e('0x2e')],util[_0x307e('0x6a')](_0x307e('0x6b'),_0x311dfc[_0x307e('0x2e')],_0x311dfc[_0x307e('0x65')]));fs['symlinkSync'](_0x2c3267,_0x27a251);return _0x311dfc;}})[_0x307e('0x4a')](function(_0x35f036){throw new db[(_0x307e('0x6c'))][(_0x307e('0x61'))](_0x35f036[_0x307e('0x6d')]);});})[_0x307e('0x28')](handleEntityNotFound(_0x3036a1,null))[_0x307e('0x28')](respondWithResult(_0x3036a1,0xc9))['catch'](handleError(_0x3036a1,null));};exports[_0x307e('0x6e')]=function(_0x178ae0,_0x53268a,_0x27ae96){return db[_0x307e('0x4d')][_0x307e('0x4e')](function(_0x396a15){var _0x5378c6;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x178ae0['params']['id']}})[_0x307e('0x28')](handleEntityNotFound(_0x53268a,null))['then'](function(_0x124a5c){if(_0x124a5c){_0x5378c6=_0x124a5c;return _0x124a5c[_0x307e('0x6e')](_0x178ae0[_0x307e('0x4c')][_0x307e('0x6f')]);}})[_0x307e('0x28')](function(_0x1be257){if(_0x1be257){return db['Sound']['findOne']({'where':{'id':_0x178ae0[_0x307e('0x4c')][_0x307e('0x6f')]},'attributes':['id',_0x307e('0x2e'),_0x307e('0x64'),'converted_format',_0x307e('0x66')],'raw':!![]});}})[_0x307e('0x28')](function(_0x57ce0c){if(_0x57ce0c){fs['unlinkSync'](path[_0x307e('0x52')](_0x5378c6[_0x307e('0x51')],util['format']('%s.%s',_0x57ce0c[_0x307e('0x2e')],_0x57ce0c[_0x307e('0x65')])));return _0x57ce0c;}})['catch'](function(_0x125640){throw new db[(_0x307e('0x6c'))][(_0x307e('0x61'))](_0x125640['message']);});})[_0x307e('0x28')](handleEntityNotFound(_0x53268a,null))[_0x307e('0x28')](respondWithStatusCode(_0x53268a,0xcc))[_0x307e('0x4a')](handleError(_0x53268a,null));};exports[_0x307e('0x70')]=function(_0x5f075c,_0x25e16d,_0x534fd8){var _0x416a52={};var _0x1c1167={};var _0x2d7be6;var _0x1b41a6;return db['VoiceMusicOnHold'][_0x307e('0x63')]({'where':{'id':_0x5f075c[_0x307e('0x4c')]['id']}})[_0x307e('0x28')](handleEntityNotFound(_0x25e16d,null))['then'](function(_0x528ed5){if(_0x528ed5){_0x2d7be6=_0x528ed5;_0x1c1167[_0x307e('0x32')]=_['keys'](db[_0x307e('0x71')][_0x307e('0x2f')]);_0x1c1167['query']=_[_0x307e('0x35')](_0x5f075c['query']);_0x1c1167[_0x307e('0x3e')]=_[_0x307e('0x36')](_0x1c1167[_0x307e('0x32')],_0x1c1167[_0x307e('0x34')]);_0x416a52[_0x307e('0x37')]=_[_0x307e('0x36')](_0x1c1167[_0x307e('0x32')],qs[_0x307e('0x38')](_0x5f075c[_0x307e('0x34')][_0x307e('0x38')]));_0x416a52['attributes']=_0x416a52[_0x307e('0x37')][_0x307e('0x39')]?_0x416a52[_0x307e('0x37')]:_0x1c1167[_0x307e('0x32')];_0x416a52[_0x307e('0x3b')]=qs[_0x307e('0x3c')](_0x5f075c['query'][_0x307e('0x3c')]);_0x416a52['where']=qs[_0x307e('0x3e')](_['pick'](_0x5f075c[_0x307e('0x34')],_0x1c1167['filters']));if(_0x5f075c[_0x307e('0x34')][_0x307e('0x3f')]){_0x416a52[_0x307e('0x3d')]=_['merge'](_0x416a52[_0x307e('0x3d')],{'$or':_[_0x307e('0x33')](_0x416a52[_0x307e('0x37')],function(_0x27e0e8){var _0x58f090={};_0x58f090[_0x27e0e8]={'$like':'%'+_0x5f075c['query'][_0x307e('0x3f')]+'%'};return _0x58f090;})});}_0x416a52=_[_0x307e('0x40')]({},_0x416a52,_0x5f075c[_0x307e('0x43')]);return _0x2d7be6[_0x307e('0x70')](_0x416a52);}})[_0x307e('0x28')](function(_0x48f6a8){if(_0x48f6a8){_0x1b41a6=_0x48f6a8['length'];if(!_0x5f075c['query']['hasOwnProperty'](_0x307e('0x3a'))){_0x416a52[_0x307e('0x20')]=qs[_0x307e('0x20')](_0x5f075c[_0x307e('0x34')][_0x307e('0x20')]);_0x416a52[_0x307e('0x1f')]=qs['offset'](_0x5f075c[_0x307e('0x34')][_0x307e('0x1f')]);}return _0x2d7be6['getSounds'](_0x416a52);}})[_0x307e('0x28')](function(_0x2e55ac){if(_0x2e55ac){return _0x2e55ac?{'count':_0x1b41a6,'rows':_0x2e55ac}:null;}})['then'](respondWithResult(_0x25e16d,null))[_0x307e('0x4a')](handleError(_0x25e16d,null));}; \ No newline at end of file +var _0x3b8b=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','Sequelize','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','removeSound','transaction','findOne','id2','unlinkSync','getSounds','order','merge','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','body','create','sequelize','root','server/files/moh','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x3b8b,0xff));var _0xb3b8=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x3b8b[_0x35007a];return _0x574f68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3b8('0x0'));var zipdir=require(_0xb3b8('0x1'));var jsonpatch=require(_0xb3b8('0x2'));var rp=require(_0xb3b8('0x3'));var moment=require(_0xb3b8('0x4'));var BPromise=require(_0xb3b8('0x5'));var Mustache=require(_0xb3b8('0x6'));var util=require(_0xb3b8('0x7'));var path=require(_0xb3b8('0x8'));var sox=require(_0xb3b8('0x9'));var csv=require(_0xb3b8('0xa'));var ejs=require(_0xb3b8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3b8('0xc'));var squel=require(_0xb3b8('0xd'));var crypto=require(_0xb3b8('0xe'));var jsforce=require(_0xb3b8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb3b8('0xa'));var querystring=require(_0xb3b8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb3b8('0x11'));var qs=require(_0xb3b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3b8('0x13'));var logger=require(_0xb3b8('0x14'))('api');var utils=require(_0xb3b8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb3b8('0x16'));var db=require(_0xb3b8('0x17'))['db'];function respondWithStatusCode(_0x172262,_0x18c0ea){_0x18c0ea=_0x18c0ea||0xcc;return function(_0x3ab417){if(_0x3ab417){return _0x172262[_0xb3b8('0x18')](_0x18c0ea);}return _0x172262['status'](_0x18c0ea)[_0xb3b8('0x19')]();};}function respondWithResult(_0x4c49cf,_0x20cd87){_0x20cd87=_0x20cd87||0xc8;return function(_0x3d256e){if(_0x3d256e){return _0x4c49cf[_0xb3b8('0x1a')](_0x20cd87)[_0xb3b8('0x1b')](_0x3d256e);}};}function respondWithFilteredResult(_0x383c2d,_0x391443){return function(_0xd5a326){if(_0xd5a326){var _0x2e19ec=typeof _0x391443[_0xb3b8('0x1c')]===_0xb3b8('0x1d')&&typeof _0x391443[_0xb3b8('0x1e')]===_0xb3b8('0x1d');var _0x1e7c2d=_0xd5a326[_0xb3b8('0x1f')];var _0x2cee6c=_0x2e19ec?0x0:_0x391443[_0xb3b8('0x1c')];var _0x55da1d=_0x2e19ec?_0xd5a326['count']:_0x391443['offset']+_0x391443['limit'];var _0x19539d;if(_0x55da1d>=_0x1e7c2d){_0x55da1d=_0x1e7c2d;_0x19539d=0xc8;}else{_0x19539d=0xce;}_0x383c2d[_0xb3b8('0x1a')](_0x19539d);return _0x383c2d[_0xb3b8('0x20')](_0xb3b8('0x21'),_0x2cee6c+'-'+_0x55da1d+'/'+_0x1e7c2d)[_0xb3b8('0x1b')](_0xd5a326);}return null;};}function patchUpdates(_0xf456c1){return function(_0x4f18b8){try{jsonpatch['apply'](_0x4f18b8,_0xf456c1,!![]);}catch(_0x407242){return BPromise[_0xb3b8('0x22')](_0x407242);}return _0x4f18b8[_0xb3b8('0x23')]();};}function saveUpdates(_0x2ec4aa,_0x18110d){return function(_0x475783){if(_0x475783){return _0x475783[_0xb3b8('0x24')](_0x2ec4aa)[_0xb3b8('0x25')](function(_0x9e0e17){return _0x9e0e17;});}return null;};}function removeEntity(_0x20e606,_0x288149){return function(_0x17acf3){if(_0x17acf3){return _0x17acf3[_0xb3b8('0x26')]()[_0xb3b8('0x25')](function(){var _0x34e854=_0x17acf3['get']({'plain':!![]});var _0x9a747d='MusicOnHolds';return db[_0xb3b8('0x27')]['destroy']({'where':{'type':_0x9a747d,'resourceId':_0x34e854['id']}})[_0xb3b8('0x25')](function(){return _0x17acf3;});})[_0xb3b8('0x25')](function(){_0x20e606[_0xb3b8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40381a,_0x50e327){return function(_0x20e70d){if(!_0x20e70d){_0x40381a[_0xb3b8('0x18')](0x194);}return _0x20e70d;};}function handleError(_0x2833a8,_0x22e6e5){_0x22e6e5=_0x22e6e5||0x1f4;return function(_0x54ad1e){logger[_0xb3b8('0x28')](_0x54ad1e[_0xb3b8('0x29')]);if(_0x54ad1e[_0xb3b8('0x2a')]){delete _0x54ad1e[_0xb3b8('0x2a')];}_0x2833a8[_0xb3b8('0x1a')](_0x22e6e5)[_0xb3b8('0x2b')](_0x54ad1e);};}exports['index']=function(_0x57248c,_0x3bd9c2){var _0x1e3ed9={},_0x10532e={},_0x34cf2a={'count':0x0,'rows':[]};var _0x175418=_[_0xb3b8('0x2c')](db[_0xb3b8('0x2d')][_0xb3b8('0x2e')],function(_0x5ca126){return{'name':_0x5ca126[_0xb3b8('0x2f')],'type':_0x5ca126[_0xb3b8('0x30')][_0xb3b8('0x31')]};});_0x10532e['model']=_[_0xb3b8('0x2c')](_0x175418,'name');_0x10532e[_0xb3b8('0x32')]=_['keys'](_0x57248c[_0xb3b8('0x32')]);_0x10532e[_0xb3b8('0x33')]=_[_0xb3b8('0x34')](_0x10532e['model'],_0x10532e[_0xb3b8('0x32')]);_0x1e3ed9['attributes']=_[_0xb3b8('0x34')](_0x10532e[_0xb3b8('0x35')],qs[_0xb3b8('0x36')](_0x57248c['query'][_0xb3b8('0x36')]));_0x1e3ed9[_0xb3b8('0x37')]=_0x1e3ed9[_0xb3b8('0x37')][_0xb3b8('0x38')]?_0x1e3ed9[_0xb3b8('0x37')]:_0x10532e[_0xb3b8('0x35')];if(!_0x57248c[_0xb3b8('0x32')][_0xb3b8('0x39')]('nolimit')){_0x1e3ed9['limit']=qs[_0xb3b8('0x1e')](_0x57248c[_0xb3b8('0x32')][_0xb3b8('0x1e')]);_0x1e3ed9['offset']=qs[_0xb3b8('0x1c')](_0x57248c[_0xb3b8('0x32')][_0xb3b8('0x1c')]);}_0x1e3ed9['order']=qs[_0xb3b8('0x3a')](_0x57248c[_0xb3b8('0x32')][_0xb3b8('0x3a')]);delete _0x57248c['query'][_0xb3b8('0x3a')];_0x1e3ed9[_0xb3b8('0x3b')]=qs[_0xb3b8('0x33')](_[_0xb3b8('0x3c')](_0x57248c[_0xb3b8('0x32')],_0x10532e[_0xb3b8('0x33')]),_0x175418);if(_0x57248c['query'][_0xb3b8('0x3d')]){_0x1e3ed9[_0xb3b8('0x3b')]=_['merge'](_0x1e3ed9[_0xb3b8('0x3b')],{'$or':_[_0xb3b8('0x2c')](_0x175418,function(_0xce6dd2){if(_0xce6dd2[_0xb3b8('0x30')]!==_0xb3b8('0x3e')){var _0x5aeed3={};_0x5aeed3[_0xce6dd2[_0xb3b8('0x2a')]]={'$like':'%'+_0x57248c['query'][_0xb3b8('0x3d')]+'%'};return _0x5aeed3;}})});}_0x1e3ed9=_['merge']({},_0x1e3ed9,_0x57248c[_0xb3b8('0x3f')]);var _0x2d16c7={'where':_0x1e3ed9[_0xb3b8('0x3b')]};return db[_0xb3b8('0x2d')]['count'](_0x2d16c7)[_0xb3b8('0x25')](function(_0x493f98){_0x34cf2a[_0xb3b8('0x1f')]=_0x493f98;if(_0x57248c[_0xb3b8('0x32')][_0xb3b8('0x40')]){_0x1e3ed9['include']=[{'all':!![]}];}return db[_0xb3b8('0x2d')][_0xb3b8('0x41')](_0x1e3ed9);})[_0xb3b8('0x25')](function(_0x1a2d7f){_0x34cf2a[_0xb3b8('0x42')]=_0x1a2d7f;return _0x34cf2a;})[_0xb3b8('0x25')](respondWithFilteredResult(_0x3bd9c2,_0x1e3ed9))['catch'](handleError(_0x3bd9c2,null));};exports[_0xb3b8('0x43')]=function(_0x46a0ee,_0x1e506f){var _0x2c5043={'raw':![],'where':{'id':_0x46a0ee[_0xb3b8('0x44')]['id']}},_0x311a2b={};_0x311a2b[_0xb3b8('0x35')]=_[_0xb3b8('0x45')](db[_0xb3b8('0x2d')][_0xb3b8('0x2e')]);_0x311a2b[_0xb3b8('0x32')]=_[_0xb3b8('0x45')](_0x46a0ee[_0xb3b8('0x32')]);_0x311a2b[_0xb3b8('0x33')]=_['intersection'](_0x311a2b[_0xb3b8('0x35')],_0x311a2b[_0xb3b8('0x32')]);_0x2c5043[_0xb3b8('0x37')]=_['intersection'](_0x311a2b['model'],qs[_0xb3b8('0x36')](_0x46a0ee[_0xb3b8('0x32')][_0xb3b8('0x36')]));_0x2c5043[_0xb3b8('0x37')]=_0x2c5043[_0xb3b8('0x37')]['length']?_0x2c5043[_0xb3b8('0x37')]:_0x311a2b[_0xb3b8('0x35')];if(_0x46a0ee[_0xb3b8('0x32')]['includeAll']){_0x2c5043[_0xb3b8('0x46')]=[{'all':!![]}];}_0x2c5043=_['merge']({},_0x2c5043,_0x46a0ee[_0xb3b8('0x3f')]);return db[_0xb3b8('0x2d')][_0xb3b8('0x47')](_0x2c5043)['then'](handleEntityNotFound(_0x1e506f,null))[_0xb3b8('0x25')](respondWithResult(_0x1e506f,null))[_0xb3b8('0x48')](handleError(_0x1e506f,null));};exports[_0xb3b8('0x24')]=function(_0x164d68,_0x452243){if(_0x164d68[_0xb3b8('0x49')]['id']){delete _0x164d68[_0xb3b8('0x49')]['id'];}return db[_0xb3b8('0x2d')][_0xb3b8('0x47')]({'where':{'id':_0x164d68[_0xb3b8('0x44')]['id']}})[_0xb3b8('0x25')](handleEntityNotFound(_0x452243,null))[_0xb3b8('0x25')](saveUpdates(_0x164d68[_0xb3b8('0x49')],null))['then'](respondWithResult(_0x452243,null))[_0xb3b8('0x48')](handleError(_0x452243,null));};exports[_0xb3b8('0x4a')]=function(_0x19b1cd,_0x5a85c0,_0x202a5d){return db[_0xb3b8('0x4b')]['transaction'](function(_0x264a42){if(_0x19b1cd[_0xb3b8('0x49')]['mode']==='files'){_0x19b1cd['body']['directory']=path['join'](config[_0xb3b8('0x4c')],_0xb3b8('0x4d'),_0x19b1cd[_0xb3b8('0x49')][_0xb3b8('0x2a')]);}return db['VoiceMusicOnHold'][_0xb3b8('0x4a')](_0x19b1cd[_0xb3b8('0x49')],{'transaction':_0x264a42})['then'](function(_0x85b6eb){if(_0x19b1cd[_0xb3b8('0x49')]['mode']==='files'){fs[_0xb3b8('0x4e')](_0x85b6eb[_0xb3b8('0x4f')],parseInt(_0xb3b8('0x50'),0x8));}var _0x1505e7=_0x19b1cd[_0xb3b8('0x51')][_0xb3b8('0x52')]({'plain':!![]});if(!_0x1505e7)throw new Error(_0xb3b8('0x53'));if(_0x1505e7[_0xb3b8('0x54')]==='user'){var _0x264368=_0x85b6eb[_0xb3b8('0x52')]({'plain':!![]});return db[_0xb3b8('0x55')][_0xb3b8('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1505e7[_0xb3b8('0x56')]},'raw':!![]})[_0xb3b8('0x25')](function(_0x302e1e){if(_0x302e1e&&_0x302e1e[_0xb3b8('0x57')]===0x0){return db[_0xb3b8('0x27')]['create']({'name':_0x264368[_0xb3b8('0x2a')],'resourceId':_0x264368['id'],'type':_0x302e1e['name'],'sectionId':_0x302e1e['id']},{})[_0xb3b8('0x25')](function(){return _0x85b6eb;});}else{return _0x85b6eb;}})['catch'](function(_0x623389){logger[_0xb3b8('0x28')](_0xb3b8('0x58'),_0x623389);});}return _0x85b6eb;});})[_0xb3b8('0x25')](respondWithResult(_0x5a85c0,0xc9))['catch'](handleError(_0x5a85c0,null));};exports[_0xb3b8('0x26')]=function(_0xacd6e,_0x38bbc7,_0x56fe0d){var _0x2b22bc;return db[_0xb3b8('0x2d')][_0xb3b8('0x47')]({'where':{'id':_0xacd6e[_0xb3b8('0x44')]['id']}})[_0xb3b8('0x25')](function(_0x507455){if(_0x507455){return db[_0xb3b8('0x4b')]['transaction'](function(_0x6820fc){return _0x507455[_0xb3b8('0x26')]({'transaction':_0x6820fc,'raw':!![]})[_0xb3b8('0x25')](function(_0x4a2841){if(_0x4a2841[_0xb3b8('0x4f')]){fs[_0xb3b8('0x59')](_0x4a2841[_0xb3b8('0x4f')])[_0xb3b8('0x5a')](function(_0x540861){fs['unlinkSync'](path[_0xb3b8('0x5b')](_0x4a2841['directory'],_0x540861));});fs['rmdirSync'](_0x4a2841['directory']);}return _0x4a2841;});})['catch'](function(_0xd01de){throw new db[(_0xb3b8('0x5c'))][(_0xb3b8('0x5d'))](_0xd01de[_0xb3b8('0x5e')]);});}})[_0xb3b8('0x25')](handleEntityNotFound(_0x38bbc7,null))[_0xb3b8('0x25')](removeEntity(_0x38bbc7,null))[_0xb3b8('0x48')](handleError(_0x38bbc7,null));};exports[_0xb3b8('0x5f')]=function(_0x468fa8,_0x3cd648,_0xafc929){return db['sequelize']['transaction'](function(_0x3cba8d){var _0x592d70;return db[_0xb3b8('0x2d')][_0xb3b8('0x47')]({'where':{'id':_0x468fa8['params']['id']}})[_0xb3b8('0x25')](function(_0x5568cf){if(_0x5568cf){_0x592d70=_0x5568cf;return _0x5568cf['addSound'](_0x468fa8[_0xb3b8('0x49')]['id'],{'transaction':_0x3cba8d});}})[_0xb3b8('0x25')](function(_0x51b947){if(_0x51b947){return db[_0xb3b8('0x60')]['findOne']({'where':{'id':_0x468fa8[_0xb3b8('0x49')]['id']},'attributes':['id',_0xb3b8('0x2a'),_0xb3b8('0x61'),_0xb3b8('0x62'),_0xb3b8('0x63')],'raw':!![]});}})[_0xb3b8('0x25')](function(_0x1c6385){if(_0x1c6385){var _0x522417=path['join'](config[_0xb3b8('0x4c')],_0xb3b8('0x64'),util[_0xb3b8('0x65')](_0xb3b8('0x66'),path['basename'](_0x1c6385['save_name'],path[_0xb3b8('0x67')](_0x1c6385['save_name'])),_0x1c6385[_0xb3b8('0x62')]));var _0x398878=path[_0xb3b8('0x5b')](config[_0xb3b8('0x4c')],'server/files/moh',_0x592d70[_0xb3b8('0x2a')],util[_0xb3b8('0x65')]('%s.%s',_0x1c6385[_0xb3b8('0x2a')],_0x1c6385[_0xb3b8('0x62')]));fs[_0xb3b8('0x68')](_0x522417,_0x398878);return _0x1c6385;}})[_0xb3b8('0x48')](function(_0x2dea1f){throw new db[(_0xb3b8('0x5c'))][(_0xb3b8('0x5d'))](_0x2dea1f['message']);});})[_0xb3b8('0x25')](handleEntityNotFound(_0x3cd648,null))[_0xb3b8('0x25')](respondWithResult(_0x3cd648,0xc9))[_0xb3b8('0x48')](handleError(_0x3cd648,null));};exports[_0xb3b8('0x69')]=function(_0x14a834,_0x20a804,_0x3f1f9b){return db[_0xb3b8('0x4b')][_0xb3b8('0x6a')](function(_0xf5cadf){var _0x4fe6a4;return db[_0xb3b8('0x2d')][_0xb3b8('0x6b')]({'where':{'id':_0x14a834[_0xb3b8('0x44')]['id']}})[_0xb3b8('0x25')](handleEntityNotFound(_0x20a804,null))[_0xb3b8('0x25')](function(_0xdba586){if(_0xdba586){_0x4fe6a4=_0xdba586;return _0xdba586[_0xb3b8('0x69')](_0x14a834[_0xb3b8('0x44')][_0xb3b8('0x6c')]);}})[_0xb3b8('0x25')](function(_0x29158b){if(_0x29158b){return db['Sound']['findOne']({'where':{'id':_0x14a834['params'][_0xb3b8('0x6c')]},'attributes':['id',_0xb3b8('0x2a'),'save_name',_0xb3b8('0x62'),_0xb3b8('0x63')],'raw':!![]});}})[_0xb3b8('0x25')](function(_0x507c0a){if(_0x507c0a){fs[_0xb3b8('0x6d')](path[_0xb3b8('0x5b')](_0x4fe6a4[_0xb3b8('0x4f')],util[_0xb3b8('0x65')]('%s.%s',_0x507c0a['name'],_0x507c0a['converted_format'])));return _0x507c0a;}})[_0xb3b8('0x48')](function(_0x3fd484){throw new db['Sequelize'][(_0xb3b8('0x5d'))](_0x3fd484[_0xb3b8('0x5e')]);});})[_0xb3b8('0x25')](handleEntityNotFound(_0x20a804,null))[_0xb3b8('0x25')](respondWithStatusCode(_0x20a804,0xcc))[_0xb3b8('0x48')](handleError(_0x20a804,null));};exports[_0xb3b8('0x6e')]=function(_0x15abae,_0x1558b5,_0x4e987){var _0x12e1b2={};var _0x8c776b={};var _0x7dd97;var _0x4484c4;return db['VoiceMusicOnHold'][_0xb3b8('0x6b')]({'where':{'id':_0x15abae[_0xb3b8('0x44')]['id']}})[_0xb3b8('0x25')](handleEntityNotFound(_0x1558b5,null))[_0xb3b8('0x25')](function(_0x43647b){if(_0x43647b){_0x7dd97=_0x43647b;_0x8c776b[_0xb3b8('0x35')]=_['keys'](db[_0xb3b8('0x60')][_0xb3b8('0x2e')]);_0x8c776b[_0xb3b8('0x32')]=_['keys'](_0x15abae[_0xb3b8('0x32')]);_0x8c776b[_0xb3b8('0x33')]=_['intersection'](_0x8c776b[_0xb3b8('0x35')],_0x8c776b[_0xb3b8('0x32')]);_0x12e1b2[_0xb3b8('0x37')]=_[_0xb3b8('0x34')](_0x8c776b[_0xb3b8('0x35')],qs['fields'](_0x15abae[_0xb3b8('0x32')][_0xb3b8('0x36')]));_0x12e1b2[_0xb3b8('0x37')]=_0x12e1b2['attributes'][_0xb3b8('0x38')]?_0x12e1b2[_0xb3b8('0x37')]:_0x8c776b[_0xb3b8('0x35')];_0x12e1b2[_0xb3b8('0x6f')]=qs[_0xb3b8('0x3a')](_0x15abae[_0xb3b8('0x32')]['sort']);_0x12e1b2['where']=qs[_0xb3b8('0x33')](_[_0xb3b8('0x3c')](_0x15abae[_0xb3b8('0x32')],_0x8c776b[_0xb3b8('0x33')]));if(_0x15abae['query']['filter']){_0x12e1b2[_0xb3b8('0x3b')]=_[_0xb3b8('0x70')](_0x12e1b2['where'],{'$or':_[_0xb3b8('0x2c')](_0x12e1b2[_0xb3b8('0x37')],function(_0x1372db){var _0x369c24={};_0x369c24[_0x1372db]={'$like':'%'+_0x15abae[_0xb3b8('0x32')][_0xb3b8('0x3d')]+'%'};return _0x369c24;})});}_0x12e1b2=_[_0xb3b8('0x70')]({},_0x12e1b2,_0x15abae[_0xb3b8('0x3f')]);return _0x7dd97[_0xb3b8('0x6e')](_0x12e1b2);}})[_0xb3b8('0x25')](function(_0x24fee1){if(_0x24fee1){_0x4484c4=_0x24fee1[_0xb3b8('0x38')];if(!_0x15abae[_0xb3b8('0x32')][_0xb3b8('0x39')]('nolimit')){_0x12e1b2[_0xb3b8('0x1e')]=qs[_0xb3b8('0x1e')](_0x15abae[_0xb3b8('0x32')]['limit']);_0x12e1b2[_0xb3b8('0x1c')]=qs[_0xb3b8('0x1c')](_0x15abae['query'][_0xb3b8('0x1c')]);}return _0x7dd97[_0xb3b8('0x6e')](_0x12e1b2);}})[_0xb3b8('0x25')](function(_0xd05e8){if(_0xd05e8){return _0xd05e8?{'count':_0x4484c4,'rows':_0xd05e8}:null;}})[_0xb3b8('0x25')](respondWithResult(_0x1558b5,null))[_0xb3b8('0x48')](handleError(_0x1558b5,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 9a54946..c200cc0 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 _0x452c=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x452c,0x72));var _0xc452=function(_0x27ef8f,_0x4686bb){_0x27ef8f=_0x27ef8f-0x0;var _0x5242b8=_0x452c[_0x27ef8f];return _0x5242b8;};'use strict';var _=require(_0xc452('0x0'));var util=require('util');var logger=require(_0xc452('0x1'))(_0xc452('0x2'));var moment=require(_0xc452('0x3'));var BPromise=require('bluebird');var rp=require(_0xc452('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc452('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xc452('0x6')]=function(_0x5cfbd9,_0x4e3207){return _0x5cfbd9[_0xc452('0x7')](_0xc452('0x8'),attributes,{'tableName':_0xc452('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23cc=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0x23cc,0xfb));var _0xc23c=function(_0x21a4d1,_0x18a0da){_0x21a4d1=_0x21a4d1-0x0;var _0x4b11a9=_0x23cc[_0x21a4d1];return _0x4b11a9;};'use strict';var _=require(_0xc23c('0x0'));var util=require(_0xc23c('0x1'));var logger=require(_0xc23c('0x2'))(_0xc23c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc23c('0x4'));var fs=require('fs');var path=require(_0xc23c('0x5'));var rimraf=require(_0xc23c('0x6'));var config=require(_0xc23c('0x7'));var attributes=require(_0xc23c('0x8'));module[_0xc23c('0x9')]=function(_0x375aab,_0x10aa65){return _0x375aab['define'](_0xc23c('0xa'),attributes,{'tableName':_0xc23c('0xb'),'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 b21dd1e..212f229 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x57c4d0,_0x457f88){var _0x556bf6=function(_0x2731b3){while(--_0x2731b3){_0x57c4d0['push'](_0x57c4d0['shift']());}};_0x556bf6(++_0x457f88);}(_0xedd9,0xfc));var _0x9edd=function(_0x195b37,_0x374721){_0x195b37=_0x195b37-0x0;var _0x27c4f7=_0xedd9[_0x195b37];return _0x27c4f7;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +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(_0x2d5df5,_0x282cba){var _0x48d803=function(_0x44d750){while(--_0x44d750){_0x2d5df5['push'](_0x2d5df5['shift']());}};_0x48d803(++_0x282cba);}(_0xe706,0xa3));var _0x6e70=function(_0x13c2cf,_0x568ba5){_0x13c2cf=_0x13c2cf-0x0;var _0x237785=_0xe706[_0x13c2cf];return _0x237785;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index d7a7563..99b6147 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 _0xb42c=['express','Router','fs-extra','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show','getTeams','post','/:id/users','addAgents','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','multer','util','connect-timeout'];(function(_0x370526,_0x5d0988){var _0x8eb1a5=function(_0x219263){while(--_0x219263){_0x370526['push'](_0x370526['shift']());}};_0x8eb1a5(++_0x5d0988);}(_0xb42c,0x165));var _0xcb42=function(_0x33c24a,_0x49674e){_0x33c24a=_0x33c24a-0x0;var _0x38d67e=_0xb42c[_0x33c24a];return _0x38d67e;};'use strict';var multer=require(_0xcb42('0x0'));var util=require(_0xcb42('0x1'));var path=require('path');var timeout=require(_0xcb42('0x2'));var express=require(_0xcb42('0x3'));var router=express[_0xcb42('0x4')]();var fs_extra=require(_0xcb42('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb42('0x6'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0xcb42('0x7')]('/',auth['isAuthenticated'](),controller[_0xcb42('0x8')]);router[_0xcb42('0x7')]('/describe',auth[_0xcb42('0x9')](),controller[_0xcb42('0xa')]);router[_0xcb42('0x7')](_0xcb42('0xb'),auth[_0xcb42('0x9')](),controller[_0xcb42('0xc')]);router[_0xcb42('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xcb42('0x7')]('/:id/teams',auth[_0xcb42('0x9')](),controller[_0xcb42('0xd')]);router[_0xcb42('0xe')]('/',auth[_0xcb42('0x9')](),controller['create']);router['post'](_0xcb42('0xf'),auth[_0xcb42('0x9')](),controller[_0xcb42('0x10')]);router[_0xcb42('0xe')](_0xcb42('0x11'),auth[_0xcb42('0x9')](),controller[_0xcb42('0x12')]);router[_0xcb42('0x13')](_0xcb42('0xb'),auth['isAuthenticated'](),controller[_0xcb42('0x14')]);router[_0xcb42('0x15')](_0xcb42('0xb'),auth[_0xcb42('0x9')](),controller[_0xcb42('0x16')]);router['delete'](_0xcb42('0xf'),auth[_0xcb42('0x9')](),controller[_0xcb42('0x17')]);router[_0xcb42('0x15')](_0xcb42('0x11'),auth[_0xcb42('0x9')](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0xaa5c=['path','connect-timeout','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','getAgents','post','create','/:id/users','addAgents','/:id/teams','addTeams','put','/:id','update','delete','destroy','removeTeams','exports','multer','util'];(function(_0x132ed8,_0x433820){var _0xfcce8=function(_0x4f2062){while(--_0x4f2062){_0x132ed8['push'](_0x132ed8['shift']());}};_0xfcce8(++_0x433820);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x2f408e,_0x4b02ab){_0x2f408e=_0x2f408e-0x0;var _0x270b3d=_0xaa5c[_0x2f408e];return _0x270b3d;};'use strict';var multer=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var path=require(_0xcaa5('0x2'));var timeout=require(_0xcaa5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcaa5('0x4'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0xcaa5('0x5')]('/',auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x7')]);router['get'](_0xcaa5('0x8'),auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x9')]);router[_0xcaa5('0x5')]('/:id',auth[_0xcaa5('0x6')](),controller[_0xcaa5('0xa')]);router['get']('/:id/users',auth[_0xcaa5('0x6')](),controller[_0xcaa5('0xb')]);router[_0xcaa5('0x5')]('/:id/teams',auth[_0xcaa5('0x6')](),controller['getTeams']);router[_0xcaa5('0xc')]('/',auth[_0xcaa5('0x6')](),controller[_0xcaa5('0xd')]);router[_0xcaa5('0xc')](_0xcaa5('0xe'),auth[_0xcaa5('0x6')](),controller[_0xcaa5('0xf')]);router['post'](_0xcaa5('0x10'),auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x11')]);router[_0xcaa5('0x12')](_0xcaa5('0x13'),auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x14')]);router[_0xcaa5('0x15')](_0xcaa5('0x13'),auth['isAuthenticated'](),controller[_0xcaa5('0x16')]);router['delete'](_0xcaa5('0xe'),auth[_0xcaa5('0x6')](),controller['removeAgents']);router[_0xcaa5('0x15')](_0xcaa5('0x10'),auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x17')]);module[_0xcaa5('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index c017e6a..b38c6f0 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 _0x9305=['exports','STRING','name','VIRTUAL','INTEGER','sequelize'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x9305,0x89));var _0x5930=function(_0x207ef0,_0x498e28){_0x207ef0=_0x207ef0-0x0;var _0x5db233=_0x9305[_0x207ef0];return _0x5db233;};'use strict';var Sequelize=require(_0x5930('0x0'));module[_0x5930('0x1')]={'name':{'type':Sequelize[_0x5930('0x2')],'allowNull':![],'unique':_0x5930('0x3')},'prefix':{'type':Sequelize[_0x5930('0x4')],'get':function(_0x11b74c){return'system-'+this['getDataValue'](_0x5930('0x3'))+'-';}},'description':{'type':Sequelize[_0x5930('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x5930('0x5')]}}; \ No newline at end of file +var _0x9050=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x33fc63,_0x543dbc){var _0x5ed64e=function(_0x35a1d0){while(--_0x35a1d0){_0x33fc63['push'](_0x33fc63['shift']());}};_0x5ed64e(++_0x543dbc);}(_0x9050,0x1ec));var _0x0905=function(_0x2d625f,_0x1f29ba){_0x2d625f=_0x2d625f-0x0;var _0x336b8=_0x9050[_0x2d625f];return _0x336b8;};'use strict';var Sequelize=require(_0x0905('0x0'));module['exports']={'name':{'type':Sequelize[_0x0905('0x1')],'allowNull':![],'unique':_0x0905('0x2')},'prefix':{'type':Sequelize[_0x0905('0x3')],'get':function(_0x16c373){return _0x0905('0x4')+this[_0x0905('0x5')](_0x0905('0x2'))+'-';}},'description':{'type':Sequelize[_0x0905('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x0905('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index b5dcde2..9e68fea 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 _0xc900=['voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VoicePrefix','includeAll','include','findAll','show','params','options','catch','destroy','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','goto','${EXTEN:','update','system-','sequelize','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','Team','getTeams','addTeams','Agents'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xc900,0xb3));var _0x0c90=function(_0x324e58,_0x49efd7){_0x324e58=_0x324e58-0x0;var _0x404333=_0xc900[_0x324e58];return _0x404333;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];config['redis']=_[_0x0c90('0x19')](config[_0x0c90('0x1a')],{'host':_0x0c90('0x1b'),'port':0x18eb});var socket=require(_0x0c90('0x1c'))(new Redis(config[_0x0c90('0x1a')]));require('./voicePrefix.socket')[_0x0c90('0x1d')](socket);function respondWithStatusCode(_0x4451e0,_0x4f35f4){_0x4f35f4=_0x4f35f4||0xcc;return function(_0x2c82a4){if(_0x2c82a4){return _0x4451e0[_0x0c90('0x1e')](_0x4f35f4);}return _0x4451e0[_0x0c90('0x1f')](_0x4f35f4)['end']();};}function respondWithResult(_0x5daeb7,_0x412635){_0x412635=_0x412635||0xc8;return function(_0x15ca42){if(_0x15ca42){return _0x5daeb7[_0x0c90('0x1f')](_0x412635)[_0x0c90('0x20')](_0x15ca42);}};}function respondWithFilteredResult(_0x276b92,_0x2cab22){return function(_0x42321a){if(_0x42321a){var _0x57b9a6=typeof _0x2cab22[_0x0c90('0x21')]===_0x0c90('0x22')&&typeof _0x2cab22[_0x0c90('0x23')]===_0x0c90('0x22');var _0x594267=_0x42321a[_0x0c90('0x24')];var _0xd129ca=_0x57b9a6?0x0:_0x2cab22[_0x0c90('0x21')];var _0x1241a9=_0x57b9a6?_0x42321a[_0x0c90('0x24')]:_0x2cab22[_0x0c90('0x21')]+_0x2cab22['limit'];var _0x365a42;if(_0x1241a9>=_0x594267){_0x1241a9=_0x594267;_0x365a42=0xc8;}else{_0x365a42=0xce;}_0x276b92['status'](_0x365a42);return _0x276b92[_0x0c90('0x25')](_0x0c90('0x26'),_0xd129ca+'-'+_0x1241a9+'/'+_0x594267)['json'](_0x42321a);}return null;};}function patchUpdates(_0x2a053a){return function(_0x43ddc3){try{jsonpatch[_0x0c90('0x27')](_0x43ddc3,_0x2a053a,!![]);}catch(_0x86dee){return BPromise[_0x0c90('0x28')](_0x86dee);}return _0x43ddc3[_0x0c90('0x29')]();};}function saveUpdates(_0x4dfbc3,_0x26f0a3){return function(_0x12f22c){if(_0x12f22c){return _0x12f22c['update'](_0x4dfbc3)['then'](function(_0x28d005){return _0x28d005;});}return null;};}function removeEntity(_0x3ea861,_0x35c243){return function(_0x109a5f){if(_0x109a5f){return _0x109a5f['destroy']()[_0x0c90('0x2a')](function(){var _0x438652=_0x109a5f[_0x0c90('0x2b')]({'plain':!![]});var _0x277d4a=_0x0c90('0x2c');return db[_0x0c90('0x2d')]['destroy']({'where':{'type':_0x277d4a,'resourceId':_0x438652['id']}})[_0x0c90('0x2a')](function(){return _0x109a5f;});})[_0x0c90('0x2a')](function(){_0x3ea861[_0x0c90('0x1f')](0xcc)[_0x0c90('0x2e')]();});}};}function handleEntityNotFound(_0x52d28d,_0x4c8603){return function(_0x1f27f1){if(!_0x1f27f1){_0x52d28d[_0x0c90('0x1e')](0x194);}return _0x1f27f1;};}function handleError(_0x3bff04,_0x122a4f){_0x122a4f=_0x122a4f||0x1f4;return function(_0x119e09){logger['error'](_0x119e09[_0x0c90('0x2f')]);if(_0x119e09[_0x0c90('0x30')]){delete _0x119e09[_0x0c90('0x30')];}_0x3bff04['status'](_0x122a4f)[_0x0c90('0x31')](_0x119e09);};}exports['index']=function(_0x54a3f5,_0x886634){var _0x5071b={},_0x2f0835={},_0x41189f={'count':0x0,'rows':[]};var _0x58c01a=_[_0x0c90('0x32')](db['VoicePrefix'][_0x0c90('0x33')],function(_0x5a0e75){return{'name':_0x5a0e75[_0x0c90('0x34')],'type':_0x5a0e75[_0x0c90('0x35')]['key']};});_0x2f0835[_0x0c90('0x36')]=_[_0x0c90('0x32')](_0x58c01a,_0x0c90('0x30'));_0x2f0835[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x54a3f5[_0x0c90('0x37')]);_0x2f0835[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x2f0835['model'],_0x2f0835[_0x0c90('0x37')]);_0x5071b[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x2f0835[_0x0c90('0x36')],qs['fields'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x5071b[_0x0c90('0x3b')]=_0x5071b[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x5071b[_0x0c90('0x3b')]:_0x2f0835[_0x0c90('0x36')];if(!_0x54a3f5[_0x0c90('0x37')]['hasOwnProperty'](_0x0c90('0x3e'))){_0x5071b[_0x0c90('0x23')]=qs['limit'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x23')]);_0x5071b[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x54a3f5[_0x0c90('0x37')]['offset']);}_0x5071b[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x40')]);_0x5071b[_0x0c90('0x41')]=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x54a3f5[_0x0c90('0x37')],_0x2f0835[_0x0c90('0x39')]),_0x58c01a);if(_0x54a3f5['query'][_0x0c90('0x43')]){_0x5071b['where']=_[_0x0c90('0x44')](_0x5071b['where'],{'$or':_[_0x0c90('0x32')](_0x58c01a,function(_0x62e316){if(_0x62e316['type']!=='VIRTUAL'){var _0x27ef6f={};_0x27ef6f[_0x62e316['name']]={'$like':'%'+_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x27ef6f;}})});}_0x5071b=_[_0x0c90('0x44')]({},_0x5071b,_0x54a3f5['options']);var _0x2ad8eb={'where':_0x5071b[_0x0c90('0x41')]};return db[_0x0c90('0x45')][_0x0c90('0x24')](_0x2ad8eb)[_0x0c90('0x2a')](function(_0x1184c4){_0x41189f['count']=_0x1184c4;if(_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x46')]){_0x5071b[_0x0c90('0x47')]=[{'all':!![]}];}return db[_0x0c90('0x45')][_0x0c90('0x48')](_0x5071b);})[_0x0c90('0x2a')](function(_0x30b9df){_0x41189f['rows']=_0x30b9df;return _0x41189f;})[_0x0c90('0x2a')](respondWithFilteredResult(_0x886634,_0x5071b))['catch'](handleError(_0x886634,null));};exports[_0x0c90('0x49')]=function(_0x2470ce,_0x1a7a36){var _0x1179b0={'raw':![],'where':{'id':_0x2470ce[_0x0c90('0x4a')]['id']}},_0x38842c={};_0x38842c[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x45')][_0x0c90('0x33')]);_0x38842c[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2470ce[_0x0c90('0x37')]);_0x38842c[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x38842c['model'],_0x38842c[_0x0c90('0x37')]);_0x1179b0[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x38842c[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x2470ce[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x1179b0[_0x0c90('0x3b')]=_0x1179b0[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x1179b0[_0x0c90('0x3b')]:_0x38842c[_0x0c90('0x36')];if(_0x2470ce[_0x0c90('0x37')][_0x0c90('0x46')]){_0x1179b0['include']=[{'all':!![]}];}_0x1179b0=_[_0x0c90('0x44')]({},_0x1179b0,_0x2470ce[_0x0c90('0x4b')]);return db['VoicePrefix']['find'](_0x1179b0)['then'](handleEntityNotFound(_0x1a7a36,null))[_0x0c90('0x2a')](respondWithResult(_0x1a7a36,null))[_0x0c90('0x4c')](handleError(_0x1a7a36,null));};exports[_0x0c90('0x4d')]=function(_0x3fbdfc,_0x11d2de){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x3fbdfc[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x11d2de,null))['then'](removeEntity(_0x11d2de,null))[_0x0c90('0x4c')](handleError(_0x11d2de,null));};exports[_0x0c90('0x4f')]=function(_0xd639a1,_0xb483e7){return db[_0x0c90('0x45')][_0x0c90('0x4f')]()[_0x0c90('0x2a')](respondWithResult(_0xb483e7,null))[_0x0c90('0x4c')](handleError(_0xb483e7,null));};exports[_0x0c90('0x50')]=function(_0xeeee3b,_0x5e288e){var _0xac80b2;return db['sequelize'][_0x0c90('0x51')](function(_0x67539d){return db[_0x0c90('0x45')][_0x0c90('0x50')](_0xeeee3b[_0x0c90('0x52')],{'transaction':_0x67539d})[_0x0c90('0x2a')](function(_0x58dcfc){_0xac80b2=_0x58dcfc['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0xac80b2[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x3bf5de){return createVoicePrefixExtensions(_0xac80b2,_0x3bf5de,_0x67539d);});});})['then'](function(){var _0x202666=_0xeeee3b[_0x0c90('0x54')]['get']({'plain':!![]});if(!_0x202666)throw new Error(_0x0c90('0x55'));if(_0x202666['role']===_0x0c90('0x54')){var _0x8951f2=_0xac80b2;return db[_0x0c90('0x56')][_0x0c90('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x202666[_0x0c90('0x57')]},'raw':!![]})['then'](function(_0x344613){if(_0x344613&&_0x344613[_0x0c90('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x8951f2['name'],'resourceId':_0x8951f2['id'],'type':_0x344613[_0x0c90('0x30')],'sectionId':_0x344613['id']},{})[_0x0c90('0x2a')](function(){return _0xac80b2;});}else{return _0xac80b2;}})[_0x0c90('0x4c')](function(_0x2f61cb){logger[_0x0c90('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f61cb);throw _0x2f61cb;});}return _0xac80b2;})[_0x0c90('0x2a')](respondWithResult(_0x5e288e,null))[_0x0c90('0x4c')](handleError(_0x5e288e,null));};function Extension(_0x5ee971,_0x3eb725,_0x5a11e5,_0x24326b){this[_0x0c90('0x5a')]='from-sip';this[_0x0c90('0x5b')]=_0x5ee971;this['app']=_0x5a11e5;this['type']='system';this[_0x0c90('0x5c')]=_0x0c90('0x5d');this[_0x0c90('0x5e')]=_0x3eb725;this[_0x0c90('0x5f')]=_0x24326b;}function createVoicePrefixExtensions(_0x536a26,_0x5b385b,_0x426f65){return new BPromise(function(_0xd982c5,_0x120b88){var _0x4c4e5a=new Extension(formatPrefixName(_0x536a26[_0x0c90('0x60')]),0x1,_0x0c90('0x61'),_0x0c90('0x62'));_0x4c4e5a['VoicePrefixId']=_0x536a26['id'];return db[_0x0c90('0x63')][_0x0c90('0x50')](_0x4c4e5a,{'transaction':_0x426f65})[_0x0c90('0x2a')](function(_0x521436){var _0x31343b=_0x521436[_0x0c90('0x2b')]({'plain':!![]});var _0x1a198b=_[_0x0c90('0x32')](addVoicePrefixExtensions(_0x536a26,_0x5b385b),function(_0xf58a25){_0xf58a25[_0x0c90('0x53')]=_0x31343b['id'];_0xf58a25[_0x0c90('0x64')]=_0x536a26['id'];return _0xf58a25;});return db[_0x0c90('0x63')][_0x0c90('0x65')](_0x1a198b,{'transaction':_0x426f65})['then'](function(_0x530bbe){if(!_0x530bbe){return _0x120b88(_0x0c90('0x66'));}else{return _0xd982c5(_0x530bbe);}})[_0x0c90('0x4c')](function(_0x3a44df){return _0x120b88(_0x3a44df);});});;});};function addVoicePrefixExtensions(_0x2faf14,_0x19dae5){var _0x2dad30=[];var _0x2f1459=formatPrefixName(_0x2faf14[_0x0c90('0x60')]);_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x2,_0x0c90('0x68'),_0x0c90('0x69')+_0x2faf14[_0x0c90('0x30')]));if(_0x2faf14[_0x0c90('0x6a')]){_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x68'),'PREFIX-CALLERIDALL='+_0x2faf14[_0x0c90('0x6a')]));}else{_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x61'),'No\x20callerid\x20available'));}_0x2dad30['push'](new Extension(_0x2f1459,0x4,_0x0c90('0x6b'),_0x19dae5['context']+','+_0x0c90('0x6c')+(0x8+_0x2faf14[_0x0c90('0x30')]['length'])+'}'+','+0x1));return _0x2dad30;}function formatPrefixName(_0x2c64e0){var _0x3f4819='_';for(var _0x25ef97=0x0;_0x25ef97<_0x2c64e0[_0x0c90('0x3d')];_0x25ef97++){if(_0x2c64e0['charAt'](_0x25ef97)=='-'){_0x3f4819+=_0x2c64e0['charAt'](_0x25ef97);}else{_0x3f4819+='['+_0x2c64e0['charAt'](_0x25ef97)+']';}}_0x3f4819+='.';return _0x3f4819;}exports[_0x0c90('0x6d')]=function(_0x2d3287,_0x3bc90d,_0x2d5fe3){var _0x4a801f=_0x2d3287[_0x0c90('0x52')];_0x4a801f['prefix']=_0x0c90('0x6e')+_0x4a801f[_0x0c90('0x30')]+'-';return db[_0x0c90('0x6f')]['transaction'](function(_0x10f686){return db[_0x0c90('0x45')][_0x0c90('0x6d')](_0x4a801f,{'where':{'id':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension'][_0x0c90('0x4e')]({'where':{'id':_0x4a801f[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x4a59b5){return createVoicePrefixExtensions(_0x4a801f,_0x4a59b5,_0x10f686);});});});})[_0x0c90('0x2a')](function(){return db[_0x0c90('0x45')][_0x0c90('0x70')](_0x4a801f['id']);})[_0x0c90('0x2a')](respondWithResult(_0x3bc90d,null))[_0x0c90('0x4c')](handleError(_0x3bc90d,null));};exports[_0x0c90('0x71')]=function(_0x53779b,_0x28a2f0,_0x431828){return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x53779b[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x28a2f0,null))[_0x0c90('0x2a')](function(_0x1777ac){if(_0x1777ac){return _0x1777ac[_0x0c90('0x71')](_0x53779b[_0x0c90('0x52')]['ids'],_[_0x0c90('0x72')](_0x53779b[_0x0c90('0x52')],[_0x0c90('0x73'),'id'])||{})[_0x0c90('0x74')](function(_0x4e8330){for(var _0x2e68ea=0x0;_0x2e68ea<_0x53779b[_0x0c90('0x52')][_0x0c90('0x73')]['length'];_0x2e68ea+=0x1){socket[_0x0c90('0x75')](_0x0c90('0x76'),{'UserId':Number(_0x53779b['body'][_0x0c90('0x73')][_0x2e68ea]),'VoicePrefixId':Number(_0x53779b['params']['id'])});}return _0x4e8330;});}})[_0x0c90('0x2a')](respondWithResult(_0x28a2f0,null))['catch'](handleError(_0x28a2f0,null));};exports['removeAgents']=function(_0x42e76a,_0x137c30,_0x56a38b){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x42e76a[_0x0c90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x137c30,null))['then'](function(_0x250d41){if(_0x250d41){return _0x250d41['removeAgents'](_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')])[_0x0c90('0x2a')](function(){if(_[_0x0c90('0x77')](_0x42e76a[_0x0c90('0x37')]['ids'])){for(var _0x471caa=0x0;_0x471caa<_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')]['length'];_0x471caa+=0x1){socket['emit'](_0x0c90('0x78'),{'UserId':Number(_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')][_0x471caa]),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x42e76a[_0x0c90('0x37')]['ids']),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x137c30,null))['catch'](handleError(_0x137c30,null));};exports[_0x0c90('0x79')]=function(_0x2ca017,_0x1bf6e0,_0x29ede1){var _0x16c383={};var _0x56a3bc={};var _0x5562cc;var _0x57eab8;return db[_0x0c90('0x45')][_0x0c90('0x7a')]({'where':{'id':_0x2ca017[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x1bf6e0,null))[_0x0c90('0x2a')](function(_0x3d5521){if(_0x3d5521){_0x5562cc=_0x3d5521;_0x56a3bc['model']=_[_0x0c90('0x38')](db[_0x0c90('0x7b')][_0x0c90('0x33')]);_0x56a3bc[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2ca017[_0x0c90('0x37')]);_0x56a3bc[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x56a3bc[_0x0c90('0x36')],_0x56a3bc[_0x0c90('0x37')]);_0x16c383[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x56a3bc['model'],qs[_0x0c90('0x3c')](_0x2ca017['query'][_0x0c90('0x3c')]));_0x16c383['attributes']=_0x16c383[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x16c383[_0x0c90('0x3b')]:_0x56a3bc[_0x0c90('0x36')];_0x16c383['order']=qs['sort'](_0x2ca017[_0x0c90('0x37')][_0x0c90('0x40')]);_0x16c383['where']=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x2ca017['query'],_0x56a3bc[_0x0c90('0x39')]));if(_0x2ca017[_0x0c90('0x37')]['filter']){_0x16c383[_0x0c90('0x41')]=_['merge'](_0x16c383[_0x0c90('0x41')],{'$or':_[_0x0c90('0x32')](_0x16c383[_0x0c90('0x3b')],function(_0x1b95db){var _0x519f74={};_0x519f74[_0x1b95db]={'$like':'%'+_0x2ca017[_0x0c90('0x37')]['filter']+'%'};return _0x519f74;})});}_0x16c383=_[_0x0c90('0x44')]({},_0x16c383,_0x2ca017[_0x0c90('0x4b')]);return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})[_0x0c90('0x2a')](function(_0x1306bb){if(_0x1306bb){_0x57eab8=_0x1306bb['length'];if(!_0x2ca017[_0x0c90('0x37')][_0x0c90('0x7c')](_0x0c90('0x3e'))){_0x16c383[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x2ca017[_0x0c90('0x37')]['limit']);_0x16c383[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x2ca017['query'][_0x0c90('0x21')]);}return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})['then'](function(_0x199d05){if(_0x199d05){return _0x199d05?{'count':_0x57eab8,'rows':_0x199d05}:null;}})[_0x0c90('0x2a')](respondWithResult(_0x1bf6e0,null))['catch'](handleError(_0x1bf6e0,null));};exports['getTeams']=function(_0x13c69c,_0x407c6e,_0x4859e9){var _0x391e3f={};var _0x4fee0e={};var _0x37d1d5;var _0x4c142b;return db['VoicePrefix'][_0x0c90('0x7a')]({'where':{'id':_0x13c69c[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x407c6e,null))['then'](function(_0x54846c){if(_0x54846c){_0x37d1d5=_0x54846c;_0x4fee0e[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x7d')][_0x0c90('0x33')]);_0x4fee0e[_0x0c90('0x37')]=_['keys'](_0x13c69c[_0x0c90('0x37')]);_0x4fee0e['filters']=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],_0x4fee0e[_0x0c90('0x37')]);_0x391e3f[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x13c69c['query']['fields']));_0x391e3f[_0x0c90('0x3b')]=_0x391e3f[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x391e3f[_0x0c90('0x3b')]:_0x4fee0e[_0x0c90('0x36')];_0x391e3f[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x13c69c[_0x0c90('0x37')]['sort']);_0x391e3f[_0x0c90('0x41')]=qs['filters'](_[_0x0c90('0x42')](_0x13c69c[_0x0c90('0x37')],_0x4fee0e[_0x0c90('0x39')]));if(_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]){_0x391e3f[_0x0c90('0x41')]=_[_0x0c90('0x44')](_0x391e3f['where'],{'$or':_['map'](_0x391e3f[_0x0c90('0x3b')],function(_0x4a001d){var _0x2204fe={};_0x2204fe[_0x4a001d]={'$like':'%'+_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x2204fe;})});}_0x391e3f=_['merge']({},_0x391e3f,_0x13c69c[_0x0c90('0x4b')]);return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x30be13){if(_0x30be13){_0x4c142b=_0x30be13[_0x0c90('0x3d')];if(!_0x13c69c['query']['hasOwnProperty'](_0x0c90('0x3e'))){_0x391e3f[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x23')]);_0x391e3f[_0x0c90('0x21')]=qs['offset'](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x21')]);}return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x5103ae){if(_0x5103ae){return _0x5103ae?{'count':_0x4c142b,'rows':_0x5103ae}:null;}})['then'](respondWithResult(_0x407c6e,null))[_0x0c90('0x4c')](handleError(_0x407c6e,null));};exports[_0x0c90('0x7f')]=function(_0x59e8d9,_0x9bed36,_0x379a0e){var _0x19a144=_0x59e8d9[_0x0c90('0x52')][_0x0c90('0x73')];var _0x5379bc;return db[_0x0c90('0x7d')]['findAll']({'where':{'id':_0x19a144},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id',_0x0c90('0x30'),'online',_0x0c90('0x81'),_0x0c90('0x82')],'raw':!![]}]})[_0x0c90('0x2a')](function(_0x5f295e){if(_0x5f295e){_0x5379bc=_0x5f295e;var _0x5a2961=_['flatMap'](_0x5f295e,function(_0x4930cd){var _0x2858a9=_0x4930cd[_0x0c90('0x2b')]({'plain':!![]});return _0x2858a9['Agents'];});return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x59e8d9['params']['id']}})[_0x0c90('0x2a')](function(_0x13c0f2){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x1091fb){return _0x13c0f2['addTeams'](_0x19a144,{'transaction':_0x1091fb})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5379bc,function(_0x35ee25){return db[_0x0c90('0x84')][_0x0c90('0x85')]({'TeamId':_0x35ee25['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},{'transaction':_0x1091fb});});})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5a2961,function(_0x3614d1){return db[_0x0c90('0x86')]['findOrCreate']({'where':{'UserId':_0x3614d1['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},'transaction':_0x1091fb});});})['then'](function(){_0x5a2961[_0x0c90('0x87')](function(_0x40dd25){socket[_0x0c90('0x75')]('userVoicePrefix:save',{'UserId':_0x40dd25['id'],'VoicePrefixId':_0x13c0f2['id']});});});});});}})[_0x0c90('0x2a')](respondWithStatusCode(_0x9bed36,null))['catch'](handleError(_0x9bed36,null));};exports[_0x0c90('0x88')]=function(_0x1c2814,_0x2f542b,_0x3f3787){return db[_0x0c90('0x7d')][_0x0c90('0x48')]({'where':{'id':_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')]},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f542b,null))[_0x0c90('0x2a')](function(_0x31dde9){var _0x37acdc=_['map'](_0x31dde9,'id');var _0x5f431d=[];var _0x2dabe6=[];var _0x28736e=squel['select']();_0x28736e['field'](_0x0c90('0x89'))[_0x0c90('0x8a')]('team_has_voice_prefixes','tq')[_0x0c90('0x8b')](_0x0c90('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c90('0x41')](_0x0c90('0x8d'),_0x1c2814['params']['id']);for(var _0x1fb55a=0x0;_0x1fb55a<_0x31dde9['length'];_0x1fb55a+=0x1){let _0x5aa532=_0x31dde9[_0x1fb55a];for(var _0x8e8e30=0x0;_0x8e8e30<_0x5aa532[_0x0c90('0x80')]['length'];_0x8e8e30+=0x1){let _0x5c942d=_0x5aa532[_0x0c90('0x80')][_0x8e8e30];var _0x155915=_0x28736e[_0x0c90('0x8e')]();_0x155915[_0x0c90('0x41')](_0x0c90('0x8f'),_0x5c942d['id']);_0x2dabe6['push'](db[_0x0c90('0x6f')][_0x0c90('0x37')](_0x155915[_0x0c90('0x90')](),{'type':db[_0x0c90('0x6f')][_0x0c90('0x91')][_0x0c90('0x92')]})['then'](function(_0x18cc89){if(_0x18cc89['length']===0x1){return _0x5c942d['id'];}else{var _0x5e6e8f=_['every'](_[_0x0c90('0x32')](_0x18cc89,_0x0c90('0x93')),function(_0x53c760){return _[_0x0c90('0x94')](_0x37acdc,_0x53c760);});if(_0x5e6e8f){return _0x5c942d['id'];}}}));}}return BPromise['all'](_0x2dabe6)['then'](function(_0x22b3df){_0x5f431d=_(_0x5f431d)[_0x0c90('0x95')](_0x22b3df)[_0x0c90('0x96')]()[_0x0c90('0x97')]();return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x1c2814[_0x0c90('0x4a')]['id']}})['then'](function(_0x2eece9){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x3817a4){return _0x2eece9[_0x0c90('0x88')](_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')],{'transaction':_0x3817a4})[_0x0c90('0x2a')](function(){if(!_[_0x0c90('0x98')](_0x5f431d)){return _0x2eece9[_0x0c90('0x99')](_0x5f431d,{'transaction':_0x3817a4});}})[_0x0c90('0x2a')](function(){_0x5f431d[_0x0c90('0x87')](function(_0x9187af){socket[_0x0c90('0x75')]('userVoicePrefix:remove',{'UserId':_0x9187af,'VoicePrefixId':_0x2eece9['id']});});});});});});})[_0x0c90('0x2a')](respondWithStatusCode(_0x2f542b,null))[_0x0c90('0x4c')](handleError(_0x2f542b,null));}; \ No newline at end of file +var _0x282b=['find','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','context','from-sip','exten','app','system','description','priority','appdata','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','prefix','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','nolimit','getTeams','Team','addTeams','Agents','flatMap','TeamVoicePrefix','upsert','each','UserVoicePrefix','findOrCreate','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','end','status','offset','undefined','count','set','json','apply','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x282b,0xec));var _0xb282=function(_0x49a297,_0xc2903d){_0x49a297=_0x49a297-0x0;var _0xecbe2=_0x282b[_0x49a297];return _0xecbe2;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb282('0x17')]=_[_0xb282('0x18')](config[_0xb282('0x17')],{'host':_0xb282('0x19'),'port':0x18eb});var socket=require(_0xb282('0x1a'))(new Redis(config['redis']));require(_0xb282('0x1b'))['register'](socket);function respondWithStatusCode(_0xe1d53,_0x211862){_0x211862=_0x211862||0xcc;return function(_0x4af892){if(_0x4af892){return _0xe1d53['sendStatus'](_0x211862);}return _0xe1d53['status'](_0x211862)[_0xb282('0x1c')]();};}function respondWithResult(_0x350676,_0x7c20df){_0x7c20df=_0x7c20df||0xc8;return function(_0xbb182){if(_0xbb182){return _0x350676[_0xb282('0x1d')](_0x7c20df)['json'](_0xbb182);}};}function respondWithFilteredResult(_0x191a31,_0x5519bf){return function(_0xca5f12){if(_0xca5f12){var _0x45b070=typeof _0x5519bf[_0xb282('0x1e')]==='undefined'&&typeof _0x5519bf['limit']===_0xb282('0x1f');var _0x2cdeb1=_0xca5f12['count'];var _0x89543a=_0x45b070?0x0:_0x5519bf[_0xb282('0x1e')];var _0x2e3928=_0x45b070?_0xca5f12[_0xb282('0x20')]:_0x5519bf[_0xb282('0x1e')]+_0x5519bf['limit'];var _0x1de407;if(_0x2e3928>=_0x2cdeb1){_0x2e3928=_0x2cdeb1;_0x1de407=0xc8;}else{_0x1de407=0xce;}_0x191a31[_0xb282('0x1d')](_0x1de407);return _0x191a31[_0xb282('0x21')]('Content-Range',_0x89543a+'-'+_0x2e3928+'/'+_0x2cdeb1)[_0xb282('0x22')](_0xca5f12);}return null;};}function patchUpdates(_0x2a7ef8){return function(_0x3c55ad){try{jsonpatch[_0xb282('0x23')](_0x3c55ad,_0x2a7ef8,!![]);}catch(_0x680095){return BPromise['reject'](_0x680095);}return _0x3c55ad['save']();};}function saveUpdates(_0x360f15,_0x3c7f1f){return function(_0x4934f0){if(_0x4934f0){return _0x4934f0['update'](_0x360f15)[_0xb282('0x24')](function(_0x114f77){return _0x114f77;});}return null;};}function removeEntity(_0x3451e5,_0x3c4018){return function(_0x211cc1){if(_0x211cc1){return _0x211cc1[_0xb282('0x25')]()['then'](function(){var _0xa0d7fb=_0x211cc1[_0xb282('0x26')]({'plain':!![]});var _0x50bd73=_0xb282('0x27');return db[_0xb282('0x28')][_0xb282('0x25')]({'where':{'type':_0x50bd73,'resourceId':_0xa0d7fb['id']}})[_0xb282('0x24')](function(){return _0x211cc1;});})['then'](function(){_0x3451e5[_0xb282('0x1d')](0xcc)[_0xb282('0x1c')]();});}};}function handleEntityNotFound(_0xe337b8,_0x433ad5){return function(_0x4cee93){if(!_0x4cee93){_0xe337b8[_0xb282('0x29')](0x194);}return _0x4cee93;};}function handleError(_0x22f657,_0x499e3d){_0x499e3d=_0x499e3d||0x1f4;return function(_0x1b15b5){logger[_0xb282('0x2a')](_0x1b15b5[_0xb282('0x2b')]);if(_0x1b15b5[_0xb282('0x2c')]){delete _0x1b15b5[_0xb282('0x2c')];}_0x22f657['status'](_0x499e3d)[_0xb282('0x2d')](_0x1b15b5);};}exports['index']=function(_0x4b7660,_0x1bf721){var _0x687829={},_0x5e0b7a={},_0x22fefc={'count':0x0,'rows':[]};var _0x548bca=_[_0xb282('0x2e')](db[_0xb282('0x2f')][_0xb282('0x30')],function(_0x41e0eb){return{'name':_0x41e0eb[_0xb282('0x31')],'type':_0x41e0eb[_0xb282('0x32')]['key']};});_0x5e0b7a[_0xb282('0x33')]=_[_0xb282('0x2e')](_0x548bca,'name');_0x5e0b7a['query']=_[_0xb282('0x34')](_0x4b7660[_0xb282('0x35')]);_0x5e0b7a[_0xb282('0x36')]=_['intersection'](_0x5e0b7a['model'],_0x5e0b7a['query']);_0x687829[_0xb282('0x37')]=_[_0xb282('0x38')](_0x5e0b7a[_0xb282('0x33')],qs[_0xb282('0x39')](_0x4b7660[_0xb282('0x35')][_0xb282('0x39')]));_0x687829[_0xb282('0x37')]=_0x687829['attributes'][_0xb282('0x3a')]?_0x687829['attributes']:_0x5e0b7a[_0xb282('0x33')];if(!_0x4b7660[_0xb282('0x35')][_0xb282('0x3b')]('nolimit')){_0x687829[_0xb282('0x3c')]=qs['limit'](_0x4b7660[_0xb282('0x35')][_0xb282('0x3c')]);_0x687829[_0xb282('0x1e')]=qs[_0xb282('0x1e')](_0x4b7660['query']['offset']);}_0x687829[_0xb282('0x3d')]=qs[_0xb282('0x3e')](_0x4b7660[_0xb282('0x35')][_0xb282('0x3e')]);_0x687829['where']=qs[_0xb282('0x36')](_['pick'](_0x4b7660[_0xb282('0x35')],_0x5e0b7a[_0xb282('0x36')]),_0x548bca);if(_0x4b7660['query'][_0xb282('0x3f')]){_0x687829[_0xb282('0x40')]=_[_0xb282('0x41')](_0x687829[_0xb282('0x40')],{'$or':_[_0xb282('0x2e')](_0x548bca,function(_0x23c6b8){if(_0x23c6b8[_0xb282('0x32')]!==_0xb282('0x42')){var _0x44aed6={};_0x44aed6[_0x23c6b8[_0xb282('0x2c')]]={'$like':'%'+_0x4b7660[_0xb282('0x35')][_0xb282('0x3f')]+'%'};return _0x44aed6;}})});}_0x687829=_[_0xb282('0x41')]({},_0x687829,_0x4b7660[_0xb282('0x43')]);var _0x309441={'where':_0x687829[_0xb282('0x40')]};return db[_0xb282('0x2f')][_0xb282('0x20')](_0x309441)['then'](function(_0x310ad1){_0x22fefc['count']=_0x310ad1;if(_0x4b7660[_0xb282('0x35')][_0xb282('0x44')]){_0x687829[_0xb282('0x45')]=[{'all':!![]}];}return db[_0xb282('0x2f')][_0xb282('0x46')](_0x687829);})[_0xb282('0x24')](function(_0x5a6c0d){_0x22fefc['rows']=_0x5a6c0d;return _0x22fefc;})[_0xb282('0x24')](respondWithFilteredResult(_0x1bf721,_0x687829))['catch'](handleError(_0x1bf721,null));};exports[_0xb282('0x47')]=function(_0x273c3e,_0x4f9a98){var _0x229868={'raw':![],'where':{'id':_0x273c3e[_0xb282('0x48')]['id']}},_0x2d5ec7={};_0x2d5ec7['model']=_['keys'](db[_0xb282('0x2f')]['rawAttributes']);_0x2d5ec7[_0xb282('0x35')]=_[_0xb282('0x34')](_0x273c3e[_0xb282('0x35')]);_0x2d5ec7[_0xb282('0x36')]=_[_0xb282('0x38')](_0x2d5ec7[_0xb282('0x33')],_0x2d5ec7['query']);_0x229868[_0xb282('0x37')]=_[_0xb282('0x38')](_0x2d5ec7[_0xb282('0x33')],qs['fields'](_0x273c3e[_0xb282('0x35')]['fields']));_0x229868[_0xb282('0x37')]=_0x229868['attributes'][_0xb282('0x3a')]?_0x229868['attributes']:_0x2d5ec7['model'];if(_0x273c3e['query'][_0xb282('0x44')]){_0x229868[_0xb282('0x45')]=[{'all':!![]}];}_0x229868=_[_0xb282('0x41')]({},_0x229868,_0x273c3e[_0xb282('0x43')]);return db['VoicePrefix']['find'](_0x229868)['then'](handleEntityNotFound(_0x4f9a98,null))[_0xb282('0x24')](respondWithResult(_0x4f9a98,null))[_0xb282('0x49')](handleError(_0x4f9a98,null));};exports[_0xb282('0x25')]=function(_0x1ab323,_0x4e5b3d){return db[_0xb282('0x2f')][_0xb282('0x4a')]({'where':{'id':_0x1ab323['params']['id']}})[_0xb282('0x24')](handleEntityNotFound(_0x4e5b3d,null))[_0xb282('0x24')](removeEntity(_0x4e5b3d,null))[_0xb282('0x49')](handleError(_0x4e5b3d,null));};exports[_0xb282('0x4b')]=function(_0x1d356e,_0x5522be){return db[_0xb282('0x2f')][_0xb282('0x4b')]()[_0xb282('0x24')](respondWithResult(_0x5522be,null))[_0xb282('0x49')](handleError(_0x5522be,null));};exports[_0xb282('0x4c')]=function(_0x112d4d,_0x4cde65){var _0x87d777;return db['sequelize'][_0xb282('0x4d')](function(_0x1e6ade){return db['VoicePrefix'][_0xb282('0x4c')](_0x112d4d[_0xb282('0x4e')],{'transaction':_0x1e6ade})[_0xb282('0x24')](function(_0x49fc44){_0x87d777=_0x49fc44['get']({'plain':!![]});return db[_0xb282('0x4f')][_0xb282('0x4a')]({'where':{'id':_0x87d777[_0xb282('0x50')]},'raw':!![]})['then'](function(_0x2d3839){return createVoicePrefixExtensions(_0x87d777,_0x2d3839,_0x1e6ade);});});})['then'](function(){var _0x46db52=_0x112d4d[_0xb282('0x51')]['get']({'plain':!![]});if(!_0x46db52)throw new Error(_0xb282('0x52'));if(_0x46db52['role']===_0xb282('0x51')){var _0x34b31a=_0x87d777;return db[_0xb282('0x53')][_0xb282('0x4a')]({'where':{'name':_0xb282('0x27'),'userProfileId':_0x46db52[_0xb282('0x54')]},'raw':!![]})['then'](function(_0x46cef8){if(_0x46cef8&&_0x46cef8['autoAssociation']===0x0){return db[_0xb282('0x28')][_0xb282('0x4c')]({'name':_0x34b31a['name'],'resourceId':_0x34b31a['id'],'type':_0x46cef8['name'],'sectionId':_0x46cef8['id']},{})[_0xb282('0x24')](function(){return _0x87d777;});}else{return _0x87d777;}})[_0xb282('0x49')](function(_0x14b501){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14b501);throw _0x14b501;});}return _0x87d777;})[_0xb282('0x24')](respondWithResult(_0x4cde65,null))[_0xb282('0x49')](handleError(_0x4cde65,null));};function Extension(_0x3716b0,_0x5d6a78,_0x3a1414,_0x5d5318){this[_0xb282('0x55')]=_0xb282('0x56');this[_0xb282('0x57')]=_0x3716b0;this[_0xb282('0x58')]=_0x3a1414;this[_0xb282('0x32')]=_0xb282('0x59');this[_0xb282('0x5a')]='Voice\x20Prefix\x20Extension';this[_0xb282('0x5b')]=_0x5d6a78;this[_0xb282('0x5c')]=_0x5d5318;}function createVoicePrefixExtensions(_0x3ed2cc,_0x58116b,_0x545ca7){return new BPromise(function(_0x37d1a8,_0x137154){var _0x1d2d00=new Extension(formatPrefixName(_0x3ed2cc['prefix']),0x1,'NoOp',_0xb282('0x5d'));_0x1d2d00[_0xb282('0x5e')]=_0x3ed2cc['id'];return db['VoiceExtension'][_0xb282('0x4c')](_0x1d2d00,{'transaction':_0x545ca7})[_0xb282('0x24')](function(_0x15c7b7){var _0x5bbc70=_0x15c7b7[_0xb282('0x26')]({'plain':!![]});var _0x2fb4e4=_['map'](addVoicePrefixExtensions(_0x3ed2cc,_0x58116b),function(_0x214052){_0x214052[_0xb282('0x50')]=_0x5bbc70['id'];_0x214052[_0xb282('0x5e')]=_0x3ed2cc['id'];return _0x214052;});return db[_0xb282('0x4f')]['bulkCreate'](_0x2fb4e4,{'transaction':_0x545ca7})['then'](function(_0xfdf710){if(!_0xfdf710){return _0x137154(_0xb282('0x5f'));}else{return _0x37d1a8(_0xfdf710);}})['catch'](function(_0x3cdcf5){return _0x137154(_0x3cdcf5);});});;});};function addVoicePrefixExtensions(_0x1b0e1f,_0x10b6c4){var _0x364b77=[];var _0x568e6d=formatPrefixName(_0x1b0e1f[_0xb282('0x60')]);_0x364b77[_0xb282('0x61')](new Extension(_0x568e6d,0x2,_0xb282('0x62'),'CDR(prefix)='+_0x1b0e1f[_0xb282('0x2c')]));if(_0x1b0e1f[_0xb282('0x63')]){_0x364b77[_0xb282('0x61')](new Extension(_0x568e6d,0x3,'Set',_0xb282('0x64')+_0x1b0e1f[_0xb282('0x63')]));}else{_0x364b77['push'](new Extension(_0x568e6d,0x3,'NoOp',_0xb282('0x65')));}_0x364b77[_0xb282('0x61')](new Extension(_0x568e6d,0x4,_0xb282('0x66'),_0x10b6c4[_0xb282('0x55')]+','+_0xb282('0x67')+(0x8+_0x1b0e1f[_0xb282('0x2c')][_0xb282('0x3a')])+'}'+','+0x1));return _0x364b77;}function formatPrefixName(_0xbb4060){var _0x1d8e6a='_';for(var _0x1805f6=0x0;_0x1805f6<_0xbb4060[_0xb282('0x3a')];_0x1805f6++){if(_0xbb4060[_0xb282('0x68')](_0x1805f6)=='-'){_0x1d8e6a+=_0xbb4060[_0xb282('0x68')](_0x1805f6);}else{_0x1d8e6a+='['+_0xbb4060[_0xb282('0x68')](_0x1805f6)+']';}}_0x1d8e6a+='.';return _0x1d8e6a;}exports[_0xb282('0x69')]=function(_0x3a87ce,_0x4ccef5,_0x2cffa2){var _0x2c7986=_0x3a87ce[_0xb282('0x4e')];_0x2c7986[_0xb282('0x60')]=_0xb282('0x6a')+_0x2c7986[_0xb282('0x2c')]+'-';return db[_0xb282('0x6b')][_0xb282('0x4d')](function(_0x2203e7){return db[_0xb282('0x2f')][_0xb282('0x69')](_0x2c7986,{'where':{'id':_0x2c7986['id']},'transaction':_0x2203e7})['then'](function(){return db[_0xb282('0x4f')][_0xb282('0x25')]({'where':{'VoicePrefixId':_0x2c7986['id']},'transaction':_0x2203e7})[_0xb282('0x24')](function(){return db[_0xb282('0x4f')][_0xb282('0x4a')]({'where':{'id':_0x2c7986['VoiceExtensionId']},'raw':!![]})['then'](function(_0x37432b){return createVoicePrefixExtensions(_0x2c7986,_0x37432b,_0x2203e7);});});});})[_0xb282('0x24')](function(){return db[_0xb282('0x2f')][_0xb282('0x6c')](_0x2c7986['id']);})[_0xb282('0x24')](respondWithResult(_0x4ccef5,null))[_0xb282('0x49')](handleError(_0x4ccef5,null));};exports[_0xb282('0x6d')]=function(_0x4df661,_0x4feef4,_0x1ae253){return db[_0xb282('0x2f')]['find']({'where':{'id':_0x4df661['params']['id']}})[_0xb282('0x24')](handleEntityNotFound(_0x4feef4,null))[_0xb282('0x24')](function(_0x2ff720){if(_0x2ff720){return _0x2ff720[_0xb282('0x6d')](_0x4df661[_0xb282('0x4e')][_0xb282('0x6e')],_[_0xb282('0x6f')](_0x4df661['body'],[_0xb282('0x6e'),'id'])||{})[_0xb282('0x70')](function(_0x2d7518){for(var _0xc9f89a=0x0;_0xc9f89a<_0x4df661[_0xb282('0x4e')][_0xb282('0x6e')][_0xb282('0x3a')];_0xc9f89a+=0x1){socket[_0xb282('0x71')](_0xb282('0x72'),{'UserId':Number(_0x4df661[_0xb282('0x4e')]['ids'][_0xc9f89a]),'VoicePrefixId':Number(_0x4df661[_0xb282('0x48')]['id'])});}return _0x2d7518;});}})[_0xb282('0x24')](respondWithResult(_0x4feef4,null))[_0xb282('0x49')](handleError(_0x4feef4,null));};exports[_0xb282('0x73')]=function(_0xc5ed41,_0xb1394f,_0xa0f193){return db[_0xb282('0x2f')]['find']({'where':{'id':_0xc5ed41[_0xb282('0x48')]['id']}})[_0xb282('0x24')](handleEntityNotFound(_0xb1394f,null))[_0xb282('0x24')](function(_0x313018){if(_0x313018){return _0x313018[_0xb282('0x73')](_0xc5ed41[_0xb282('0x35')]['ids'])[_0xb282('0x24')](function(){if(_[_0xb282('0x74')](_0xc5ed41[_0xb282('0x35')]['ids'])){for(var _0xbe0ab4=0x0;_0xbe0ab4<_0xc5ed41[_0xb282('0x35')]['ids'][_0xb282('0x3a')];_0xbe0ab4+=0x1){socket[_0xb282('0x71')](_0xb282('0x75'),{'UserId':Number(_0xc5ed41[_0xb282('0x35')][_0xb282('0x6e')][_0xbe0ab4]),'VoicePrefixId':Number(_0xc5ed41[_0xb282('0x48')]['id'])});}}else{socket[_0xb282('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0xc5ed41['query'][_0xb282('0x6e')]),'VoicePrefixId':Number(_0xc5ed41['params']['id'])});}});}})[_0xb282('0x24')](respondWithStatusCode(_0xb1394f,null))[_0xb282('0x49')](handleError(_0xb1394f,null));};exports[_0xb282('0x76')]=function(_0x47331b,_0x178c0d,_0x58f088){var _0xa1f33c={};var _0x1fb9c2={};var _0x23151f;var _0x5d7eb3;return db[_0xb282('0x2f')][_0xb282('0x77')]({'where':{'id':_0x47331b[_0xb282('0x48')]['id']}})[_0xb282('0x24')](handleEntityNotFound(_0x178c0d,null))[_0xb282('0x24')](function(_0x29110d){if(_0x29110d){_0x23151f=_0x29110d;_0x1fb9c2['model']=_[_0xb282('0x34')](db[_0xb282('0x78')][_0xb282('0x30')]);_0x1fb9c2[_0xb282('0x35')]=_['keys'](_0x47331b[_0xb282('0x35')]);_0x1fb9c2[_0xb282('0x36')]=_[_0xb282('0x38')](_0x1fb9c2[_0xb282('0x33')],_0x1fb9c2[_0xb282('0x35')]);_0xa1f33c[_0xb282('0x37')]=_[_0xb282('0x38')](_0x1fb9c2[_0xb282('0x33')],qs[_0xb282('0x39')](_0x47331b[_0xb282('0x35')][_0xb282('0x39')]));_0xa1f33c['attributes']=_0xa1f33c[_0xb282('0x37')][_0xb282('0x3a')]?_0xa1f33c['attributes']:_0x1fb9c2[_0xb282('0x33')];_0xa1f33c[_0xb282('0x3d')]=qs[_0xb282('0x3e')](_0x47331b[_0xb282('0x35')][_0xb282('0x3e')]);_0xa1f33c[_0xb282('0x40')]=qs[_0xb282('0x36')](_[_0xb282('0x79')](_0x47331b[_0xb282('0x35')],_0x1fb9c2[_0xb282('0x36')]));if(_0x47331b['query'][_0xb282('0x3f')]){_0xa1f33c[_0xb282('0x40')]=_[_0xb282('0x41')](_0xa1f33c[_0xb282('0x40')],{'$or':_[_0xb282('0x2e')](_0xa1f33c[_0xb282('0x37')],function(_0x3b703d){var _0x442c4d={};_0x442c4d[_0x3b703d]={'$like':'%'+_0x47331b[_0xb282('0x35')][_0xb282('0x3f')]+'%'};return _0x442c4d;})});}_0xa1f33c=_[_0xb282('0x41')]({},_0xa1f33c,_0x47331b['options']);return _0x23151f['getAgents'](_0xa1f33c);}})[_0xb282('0x24')](function(_0x317cd7){if(_0x317cd7){_0x5d7eb3=_0x317cd7[_0xb282('0x3a')];if(!_0x47331b[_0xb282('0x35')][_0xb282('0x3b')](_0xb282('0x7a'))){_0xa1f33c[_0xb282('0x3c')]=qs[_0xb282('0x3c')](_0x47331b[_0xb282('0x35')][_0xb282('0x3c')]);_0xa1f33c[_0xb282('0x1e')]=qs['offset'](_0x47331b['query']['offset']);}return _0x23151f['getAgents'](_0xa1f33c);}})[_0xb282('0x24')](function(_0x213131){if(_0x213131){return _0x213131?{'count':_0x5d7eb3,'rows':_0x213131}:null;}})[_0xb282('0x24')](respondWithResult(_0x178c0d,null))['catch'](handleError(_0x178c0d,null));};exports[_0xb282('0x7b')]=function(_0x358073,_0x69b0fd,_0x43068c){var _0x522c5b={};var _0x3e391b={};var _0x112c88;var _0x1c95c2;return db[_0xb282('0x2f')][_0xb282('0x77')]({'where':{'id':_0x358073[_0xb282('0x48')]['id']}})[_0xb282('0x24')](handleEntityNotFound(_0x69b0fd,null))[_0xb282('0x24')](function(_0x4116dd){if(_0x4116dd){_0x112c88=_0x4116dd;_0x3e391b[_0xb282('0x33')]=_[_0xb282('0x34')](db[_0xb282('0x7c')][_0xb282('0x30')]);_0x3e391b[_0xb282('0x35')]=_[_0xb282('0x34')](_0x358073[_0xb282('0x35')]);_0x3e391b[_0xb282('0x36')]=_[_0xb282('0x38')](_0x3e391b[_0xb282('0x33')],_0x3e391b[_0xb282('0x35')]);_0x522c5b[_0xb282('0x37')]=_[_0xb282('0x38')](_0x3e391b['model'],qs[_0xb282('0x39')](_0x358073['query']['fields']));_0x522c5b['attributes']=_0x522c5b[_0xb282('0x37')][_0xb282('0x3a')]?_0x522c5b[_0xb282('0x37')]:_0x3e391b[_0xb282('0x33')];_0x522c5b[_0xb282('0x3d')]=qs[_0xb282('0x3e')](_0x358073['query'][_0xb282('0x3e')]);_0x522c5b[_0xb282('0x40')]=qs[_0xb282('0x36')](_['pick'](_0x358073['query'],_0x3e391b[_0xb282('0x36')]));if(_0x358073[_0xb282('0x35')][_0xb282('0x3f')]){_0x522c5b[_0xb282('0x40')]=_['merge'](_0x522c5b[_0xb282('0x40')],{'$or':_[_0xb282('0x2e')](_0x522c5b[_0xb282('0x37')],function(_0x1070cc){var _0x38c052={};_0x38c052[_0x1070cc]={'$like':'%'+_0x358073[_0xb282('0x35')][_0xb282('0x3f')]+'%'};return _0x38c052;})});}_0x522c5b=_[_0xb282('0x41')]({},_0x522c5b,_0x358073[_0xb282('0x43')]);return _0x112c88[_0xb282('0x7b')](_0x522c5b);}})[_0xb282('0x24')](function(_0x167c68){if(_0x167c68){_0x1c95c2=_0x167c68[_0xb282('0x3a')];if(!_0x358073[_0xb282('0x35')][_0xb282('0x3b')](_0xb282('0x7a'))){_0x522c5b[_0xb282('0x3c')]=qs[_0xb282('0x3c')](_0x358073[_0xb282('0x35')]['limit']);_0x522c5b[_0xb282('0x1e')]=qs[_0xb282('0x1e')](_0x358073['query']['offset']);}return _0x112c88[_0xb282('0x7b')](_0x522c5b);}})[_0xb282('0x24')](function(_0x5172cd){if(_0x5172cd){return _0x5172cd?{'count':_0x1c95c2,'rows':_0x5172cd}:null;}})['then'](respondWithResult(_0x69b0fd,null))[_0xb282('0x49')](handleError(_0x69b0fd,null));};exports[_0xb282('0x7d')]=function(_0x1419f6,_0x408c76,_0x4ea491){var _0x44b80c=_0x1419f6[_0xb282('0x4e')][_0xb282('0x6e')];var _0x3e2abb;return db[_0xb282('0x7c')]['findAll']({'where':{'id':_0x44b80c},'attributes':['id'],'include':[{'model':db[_0xb282('0x78')],'as':_0xb282('0x7e'),'attributes':['id',_0xb282('0x2c'),'online','voicePause','interface'],'raw':!![]}]})[_0xb282('0x24')](function(_0x459239){if(_0x459239){_0x3e2abb=_0x459239;var _0x32976b=_[_0xb282('0x7f')](_0x459239,function(_0x147637){var _0x4dbee6=_0x147637['get']({'plain':!![]});return _0x4dbee6[_0xb282('0x7e')];});return db[_0xb282('0x2f')][_0xb282('0x4a')]({'where':{'id':_0x1419f6[_0xb282('0x48')]['id']}})['then'](function(_0x3b22a2){return db[_0xb282('0x6b')][_0xb282('0x4d')](function(_0x449d3d){return _0x3b22a2[_0xb282('0x7d')](_0x44b80c,{'transaction':_0x449d3d})['then'](function(){return BPromise['each'](_0x3e2abb,function(_0x13860e){return db[_0xb282('0x80')][_0xb282('0x81')]({'TeamId':_0x13860e['id'],'VoicePrefixId':_0x1419f6[_0xb282('0x48')]['id']},{'transaction':_0x449d3d});});})[_0xb282('0x24')](function(){return BPromise[_0xb282('0x82')](_0x32976b,function(_0x139c9b){return db[_0xb282('0x83')][_0xb282('0x84')]({'where':{'UserId':_0x139c9b['id'],'VoicePrefixId':_0x1419f6[_0xb282('0x48')]['id']},'transaction':_0x449d3d});});})[_0xb282('0x24')](function(){_0x32976b['forEach'](function(_0x5a3f34){socket[_0xb282('0x71')](_0xb282('0x72'),{'UserId':_0x5a3f34['id'],'VoicePrefixId':_0x3b22a2['id']});});});});});}})[_0xb282('0x24')](respondWithStatusCode(_0x408c76,null))[_0xb282('0x49')](handleError(_0x408c76,null));};exports[_0xb282('0x85')]=function(_0x45980d,_0xfaf15c,_0x287895){return db[_0xb282('0x7c')]['findAll']({'where':{'id':_0x45980d[_0xb282('0x35')][_0xb282('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xb282('0x78')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb282('0x24')](handleEntityNotFound(_0xfaf15c,null))[_0xb282('0x24')](function(_0x5d1f5f){var _0x47cbdf=_[_0xb282('0x2e')](_0x5d1f5f,'id');var _0x4ca7d3=[];var _0x1de459=[];var _0x3f75b4=squel[_0xb282('0x86')]();_0x3f75b4[_0xb282('0x87')](_0xb282('0x88'))[_0xb282('0x89')]('team_has_voice_prefixes','tq')[_0xb282('0x8a')](_0xb282('0x8b'),'ut',_0xb282('0x8c'))[_0xb282('0x40')](_0xb282('0x8d'),_0x45980d[_0xb282('0x48')]['id']);for(var _0x202925=0x0;_0x202925<_0x5d1f5f['length'];_0x202925+=0x1){let _0x14fb81=_0x5d1f5f[_0x202925];for(var _0x3f8919=0x0;_0x3f8919<_0x14fb81[_0xb282('0x7e')][_0xb282('0x3a')];_0x3f8919+=0x1){let _0x59add4=_0x14fb81[_0xb282('0x7e')][_0x3f8919];var _0x1a017a=_0x3f75b4[_0xb282('0x8e')]();_0x1a017a['where'](_0xb282('0x8f'),_0x59add4['id']);_0x1de459[_0xb282('0x61')](db[_0xb282('0x6b')][_0xb282('0x35')](_0x1a017a[_0xb282('0x90')](),{'type':db[_0xb282('0x6b')][_0xb282('0x91')][_0xb282('0x92')]})['then'](function(_0x57514b){if(_0x57514b[_0xb282('0x3a')]===0x1){return _0x59add4['id'];}else{var _0x25c4b4=_[_0xb282('0x93')](_[_0xb282('0x2e')](_0x57514b,_0xb282('0x94')),function(_0x1b33ba){return _['includes'](_0x47cbdf,_0x1b33ba);});if(_0x25c4b4){return _0x59add4['id'];}}}));}}return BPromise[_0xb282('0x95')](_0x1de459)[_0xb282('0x24')](function(_0x23ce2d){_0x4ca7d3=_(_0x4ca7d3)[_0xb282('0x96')](_0x23ce2d)[_0xb282('0x97')]()[_0xb282('0x98')]();return db[_0xb282('0x2f')][_0xb282('0x4a')]({'where':{'id':_0x45980d[_0xb282('0x48')]['id']}})[_0xb282('0x24')](function(_0x120cb4){return db['sequelize']['transaction'](function(_0x580acc){return _0x120cb4[_0xb282('0x85')](_0x45980d[_0xb282('0x35')][_0xb282('0x6e')],{'transaction':_0x580acc})[_0xb282('0x24')](function(){if(!_[_0xb282('0x99')](_0x4ca7d3)){return _0x120cb4[_0xb282('0x73')](_0x4ca7d3,{'transaction':_0x580acc});}})[_0xb282('0x24')](function(){_0x4ca7d3[_0xb282('0x9a')](function(_0x28f31e){socket[_0xb282('0x71')]('userVoicePrefix:remove',{'UserId':_0x28f31e,'VoicePrefixId':_0x120cb4['id']});});});});});});})[_0xb282('0x24')](respondWithStatusCode(_0xfaf15c,null))[_0xb282('0x49')](handleError(_0xfaf15c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 68d4898..415c0b2 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 _0x3bed=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0x496e52,_0x44ff44){var _0x1df0d8=function(_0x152b72){while(--_0x152b72){_0x496e52['push'](_0x496e52['shift']());}};_0x1df0d8(++_0x44ff44);}(_0x3bed,0xaa));var _0xd3be=function(_0x920ae9,_0x20e12a){_0x920ae9=_0x920ae9-0x0;var _0xd6ad4e=_0x3bed[_0x920ae9];return _0xd6ad4e;};'use strict';var EventEmitter=require(_0xd3be('0x0'));var VoicePrefix=require(_0xd3be('0x1'))['db'][_0xd3be('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd3be('0x3')](0x0);var events={'afterCreate':_0xd3be('0x4'),'afterUpdate':_0xd3be('0x5'),'afterDestroy':_0xd3be('0x6')};function emitEvent(_0x2b4a74){return function(_0x405e35,_0xe0b7fb,_0x3b6777){VoicePrefixEvents[_0xd3be('0x7')](_0x2b4a74+':'+_0x405e35['id'],_0x405e35);VoicePrefixEvents[_0xd3be('0x7')](_0x2b4a74,_0x405e35);_0x3b6777(null);};}for(var e in events){if(events[_0xd3be('0x8')](e)){var event=events[e];VoicePrefix[_0xd3be('0x9')](e,emitEvent(event));}}module[_0xd3be('0xa')]=VoicePrefixEvents; \ No newline at end of file +var _0x1ca6=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit'];(function(_0x3a852a,_0xf3f1d3){var _0x48c902=function(_0x22cdd1){while(--_0x22cdd1){_0x3a852a['push'](_0x3a852a['shift']());}};_0x48c902(++_0xf3f1d3);}(_0x1ca6,0x9d));var _0x61ca=function(_0x13d2e8,_0x193847){_0x13d2e8=_0x13d2e8-0x0;var _0x230601=_0x1ca6[_0x13d2e8];return _0x230601;};'use strict';var EventEmitter=require(_0x61ca('0x0'));var VoicePrefix=require(_0x61ca('0x1'))['db'][_0x61ca('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x61ca('0x3')](0x0);var events={'afterCreate':_0x61ca('0x4'),'afterUpdate':_0x61ca('0x5'),'afterDestroy':_0x61ca('0x6')};function emitEvent(_0x45016d){return function(_0x18cd1f,_0x2ca34a,_0x38c57b){VoicePrefixEvents[_0x61ca('0x7')](_0x45016d+':'+_0x18cd1f['id'],_0x18cd1f);VoicePrefixEvents[_0x61ca('0x7')](_0x45016d,_0x18cd1f);_0x38c57b(null);};}for(var e in events){if(events[_0x61ca('0x8')](e)){var event=events[e];VoicePrefix[_0x61ca('0x9')](e,emitEvent(event));}}module[_0x61ca('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 92e62c3..6809f26 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 _0x880d=['rimraf','exports','define','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe05051,_0x1e3b67){var _0x25d9f2=function(_0x24bee1){while(--_0x24bee1){_0xe05051['push'](_0xe05051['shift']());}};_0x25d9f2(++_0x1e3b67);}(_0x880d,0x17a));var _0xd880=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x880d[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0xd880('0x0'));var util=require(_0xd880('0x1'));var logger=require(_0xd880('0x2'))(_0xd880('0x3'));var moment=require(_0xd880('0x4'));var BPromise=require(_0xd880('0x5'));var rp=require(_0xd880('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd880('0x7'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0xd880('0x8')]=function(_0xb20a14,_0x3f7c52){return _0xb20a14[_0xd880('0x9')](_0xd880('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e5e=['moment','path','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x3a42fa,_0x55e471){var _0x30dcba=function(_0x3cc64b){while(--_0x3cc64b){_0x3a42fa['push'](_0x3a42fa['shift']());}};_0x30dcba(++_0x55e471);}(_0x1e5e,0x1ec));var _0xe1e5=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x1e5e[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0xe1e5('0x0'));var util=require(_0xe1e5('0x1'));var logger=require(_0xe1e5('0x2'))('api');var moment=require(_0xe1e5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1e5('0x4'));var rimraf=require('rimraf');var config=require(_0xe1e5('0x5'));var attributes=require(_0xe1e5('0x6'));module[_0xe1e5('0x7')]=function(_0x2beb60,_0x62b435){return _0x2beb60[_0xe1e5('0x8')](_0xe1e5('0x9'),attributes,{'tableName':_0xe1e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 688ae40..e9320e4 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 _0x6a58=['http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5e3ac2,_0x225614){var _0x29a007=function(_0x14545e){while(--_0x14545e){_0x5e3ac2['push'](_0x5e3ac2['shift']());}};_0x29a007(++_0x225614);}(_0x6a58,0x120));var _0x86a5=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x6a58[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0x86a5('0x0'));var util=require(_0x86a5('0x1'));var moment=require('moment');var BPromise=require(_0x86a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86a5('0x4'));var logger=require(_0x86a5('0x5'))(_0x86a5('0x6'));var config=require(_0x86a5('0x7'));var jayson=require(_0x86a5('0x8'));var client=jayson['client'][_0x86a5('0x9')]({'port':0x232a});config[_0x86a5('0xa')]=_['defaults'](config[_0x86a5('0xa')],{'host':_0x86a5('0xb'),'port':0x18eb});var socket=require(_0x86a5('0xc'))(new Redis(config[_0x86a5('0xa')]));require(_0x86a5('0xd'))[_0x86a5('0xe')](socket);function respondWithRpcPromise(_0x36e998,_0x44c8de,_0x14cd2c){return new BPromise(function(_0x3a4b96,_0x4ab550){return client['request'](_0x36e998,_0x14cd2c)[_0x86a5('0xf')](function(_0x52dc46){logger[_0x86a5('0x10')](_0x86a5('0x11'),_0x44c8de,'request\x20sent');logger[_0x86a5('0x12')](_0x86a5('0x13'),_0x44c8de,'request\x20sent',JSON[_0x86a5('0x14')](_0x52dc46));if(_0x52dc46[_0x86a5('0x15')]){if(_0x52dc46['error'][_0x86a5('0x16')]===0x1f4){logger[_0x86a5('0x15')](_0x86a5('0x11'),_0x44c8de,_0x52dc46[_0x86a5('0x15')][_0x86a5('0x17')]);return _0x4ab550(_0x52dc46['error']['message']);}logger[_0x86a5('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x44c8de,_0x52dc46[_0x86a5('0x15')][_0x86a5('0x17')]);return _0x3a4b96(_0x52dc46[_0x86a5('0x15')]['message']);}else{logger['info'](_0x86a5('0x11'),_0x44c8de,_0x86a5('0x18'));_0x3a4b96(_0x52dc46[_0x86a5('0x19')][_0x86a5('0x17')]);}})[_0x86a5('0x1a')](function(_0x5dc885){logger[_0x86a5('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x44c8de,_0x5dc885);_0x4ab550(_0x5dc885);});});} \ No newline at end of file +var _0x96f2=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request'];(function(_0x1b834c,_0x14880a){var _0x548fa7=function(_0x505a32){while(--_0x505a32){_0x1b834c['push'](_0x1b834c['shift']());}};_0x548fa7(++_0x14880a);}(_0x96f2,0xb0));var _0x296f=function(_0x27954a,_0x1d01d6){_0x27954a=_0x27954a-0x0;var _0x56f570=_0x96f2[_0x27954a];return _0x56f570;};'use strict';var _=require(_0x296f('0x0'));var util=require('util');var moment=require(_0x296f('0x1'));var BPromise=require(_0x296f('0x2'));var rs=require(_0x296f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x296f('0x4'))['db'];var utils=require(_0x296f('0x5'));var logger=require(_0x296f('0x6'))('rpc');var config=require(_0x296f('0x7'));var jayson=require(_0x296f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x296f('0x9')]=_[_0x296f('0xa')](config[_0x296f('0x9')],{'host':_0x296f('0xb'),'port':0x18eb});var socket=require(_0x296f('0xc'))(new Redis(config[_0x296f('0x9')]));require(_0x296f('0xd'))[_0x296f('0xe')](socket);function respondWithRpcPromise(_0x2f81ac,_0x3729ab,_0x593fd9){return new BPromise(function(_0xea97f0,_0x1a2a02){return client[_0x296f('0xf')](_0x2f81ac,_0x593fd9)['then'](function(_0x2e2307){logger[_0x296f('0x10')](_0x296f('0x11'),_0x3729ab,_0x296f('0x12'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3729ab,'request\x20sent',JSON[_0x296f('0x13')](_0x2e2307));if(_0x2e2307[_0x296f('0x14')]){if(_0x2e2307[_0x296f('0x14')][_0x296f('0x15')]===0x1f4){logger['error'](_0x296f('0x11'),_0x3729ab,_0x2e2307['error']['message']);return _0x1a2a02(_0x2e2307[_0x296f('0x14')][_0x296f('0x16')]);}logger[_0x296f('0x14')](_0x296f('0x11'),_0x3729ab,_0x2e2307['error']['message']);return _0xea97f0(_0x2e2307[_0x296f('0x14')]['message']);}else{logger[_0x296f('0x10')](_0x296f('0x11'),_0x3729ab,_0x296f('0x12'));_0xea97f0(_0x2e2307['result'][_0x296f('0x16')]);}})[_0x296f('0x17')](function(_0x57f19d){logger[_0x296f('0x14')](_0x296f('0x11'),_0x3729ab,_0x57f19d);_0x1a2a02(_0x57f19d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 12125b3..029fa46 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 _0x86f5=['update','emit','register','length','./voicePrefix.events','remove'];(function(_0x384b76,_0x496cf3){var _0x4dbfac=function(_0x5760e7){while(--_0x5760e7){_0x384b76['push'](_0x384b76['shift']());}};_0x4dbfac(++_0x496cf3);}(_0x86f5,0x178));var _0x586f=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x86f5[_0x2797c6];return _0x54809f;};'use strict';var VoicePrefixEvents=require(_0x586f('0x0'));var events=['save',_0x586f('0x1'),_0x586f('0x2')];function createListener(_0x49a4fd,_0x9bb313){return function(_0x2ce1db){_0x9bb313[_0x586f('0x3')](_0x49a4fd,_0x2ce1db);};}function removeListener(_0x160aa1,_0x52eeff){return function(){VoicePrefixEvents['removeListener'](_0x160aa1,_0x52eeff);};}exports[_0x586f('0x4')]=function(_0x2155f1){for(var _0x18f144=0x0,_0x5d8d74=events[_0x586f('0x5')];_0x18f144<_0x5d8d74;_0x18f144++){var _0x15b372=events[_0x18f144];var _0x315fd9=createListener('voicePrefix:'+_0x15b372,_0x2155f1);VoicePrefixEvents['on'](_0x15b372,_0x315fd9);}}; \ No newline at end of file +var _0x4157=['removeListener','register','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x222d60,_0x1b0f5b){var _0x5bc3bc=function(_0x580ca8){while(--_0x580ca8){_0x222d60['push'](_0x222d60['shift']());}};_0x5bc3bc(++_0x1b0f5b);}(_0x4157,0xf3));var _0x7415=function(_0x5a1459,_0x4fa336){_0x5a1459=_0x5a1459-0x0;var _0x3c9338=_0x4157[_0x5a1459];return _0x3c9338;};'use strict';var VoicePrefixEvents=require(_0x7415('0x0'));var events=[_0x7415('0x1'),_0x7415('0x2'),_0x7415('0x3')];function createListener(_0x4509ca,_0x4c49e7){return function(_0x3efb60){_0x4c49e7[_0x7415('0x4')](_0x4509ca,_0x3efb60);};}function removeListener(_0x311038,_0x341b12){return function(){VoicePrefixEvents[_0x7415('0x5')](_0x311038,_0x341b12);};}exports[_0x7415('0x6')]=function(_0x23038f){for(var _0x2f43eb=0x0,_0x3c7980=events['length'];_0x2f43eb<_0x3c7980;_0x2f43eb++){var _0x26fe93=events[_0x2f43eb];var _0x588c5a=createListener(_0x7415('0x7')+_0x26fe93,_0x23038f);VoicePrefixEvents['on'](_0x26fe93,_0x588c5a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index fdbdb8f..0cdac5e 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 _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(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0xb10b[_0x4d337e];return _0x247963;};'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 +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(_0x5a16f7,_0x15e545){var _0x5cb364=function(_0xfa7198){while(--_0xfa7198){_0x5a16f7['push'](_0x5a16f7['shift']());}};_0x5cb364(++_0x15e545);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a8b5c,_0x429c22){_0x2a8b5c=_0x2a8b5c-0x0;var _0x3bbefe=_0xb10b[_0x2a8b5c];return _0x3bbefe;};'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 97b3a59..20fbe97 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 _0xc5de=['strategy','preview','includes','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','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)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','inbound','ringall','leastrecent','random','rrmemory','wrandom','rrordered','setDataValue','getDataValue','type'];(function(_0x561b30,_0x473855){var _0x3bc2aa=function(_0x350b0){while(--_0x350b0){_0x561b30['push'](_0x561b30['shift']());}};_0x3bc2aa(++_0x473855);}(_0xc5de,0xe3));var _0xec5d=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0xc5de[_0x21c2c8];return _0x4dd745;};'use strict';var Sequelize=require(_0xec5d('0x0'));module[_0xec5d('0x1')]={'name':{'type':Sequelize[_0xec5d('0x2')],'allowNull':![],'unique':_0xec5d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xec5d('0x4')]('inbound',_0xec5d('0x5')),'allowNull':![],'defaultValue':_0xec5d('0x6')},'musiconhold':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xec5d('0x4')]('rr',_0xec5d('0x7'),_0xec5d('0x8'),'fewestcalls',_0xec5d('0x9'),_0xec5d('0xa'),'linear',_0xec5d('0xb'),_0xec5d('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x105bfb){this[_0xec5d('0xd')]('strategy',_0x105bfb?_0x105bfb:_0xec5d('0xa'));},'get':function(){var _0x5d17b9=this[_0xec5d('0xe')](_0xec5d('0xf'));var _0x553235=this[_0xec5d('0xe')]('dialMethod');var _0x2e87e6=this['getDataValue'](_0xec5d('0x10'));if(_0x5d17b9===_0xec5d('0x5')){if(_0x553235===_0xec5d('0x11')){return null;}if(_0x553235==='booked'&&![_0xec5d('0xa'),'roundrobin'][_0xec5d('0x12')](_0x2e87e6)){this[_0xec5d('0xd')](_0xec5d('0x10'),_0xec5d('0xa'));}}return _0x2e87e6;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xec5d('0x13')](0xb)},'timeout':{'type':Sequelize[_0xec5d('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xec5d('0x2')]},'weight':{'type':Sequelize[_0xec5d('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xec5d('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no'),'defaultValue':_0xec5d('0x14')},'autopause':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xec5d('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xec5d('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xec5d('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xec5d('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xec5d('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xec5d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xec5d('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xec5d('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xec5d('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no'),'defaultValue':_0xec5d('0x14')},'announce_holdtime':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no',_0xec5d('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0xec5d('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xec5d('0x2')]},'queue_youarenext':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xec5d('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xec5d('0x2')]},'queue_quantity2':{'type':Sequelize[_0xec5d('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xec5d('0x2')]},'queue_less_than':{'type':Sequelize[_0xec5d('0x2')]},'periodic_announce':{'type':Sequelize[_0xec5d('0x16')],'set':function(_0x227b47){this['setDataValue'](_0xec5d('0x17'),_0x227b47?_0x227b47[_0xec5d('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0xec5d('0x17'))?this['getDataValue'](_0xec5d('0x17'))[_0xec5d('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':_0xec5d('0x14'),'set':function(_0xc9aa47){this[_0xec5d('0xd')](_0xec5d('0x1a'),_0xc9aa47?_0xc9aa47[_0xec5d('0x18')](','):undefined);},'get':function(){return this['getDataValue'](_0xec5d('0x1a'))?this[_0xec5d('0xe')]('joinempty')[_0xec5d('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1e018f){this[_0xec5d('0xd')](_0xec5d('0x1b'),_0x1e018f?_0x1e018f['join'](','):undefined);},'get':function(){return this[_0xec5d('0xe')](_0xec5d('0x1b'))?this[_0xec5d('0xe')]('leavewhenempty')[_0xec5d('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xec5d('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xec5d('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xec5d('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xec5d('0x1c')],'defaultValue':0x0,'set':function(_0x16b2f9){this['setDataValue'](_0xec5d('0x1d'),_0x16b2f9);if(_0x16b2f9){if(this[_0xec5d('0xe')](_0xec5d('0x1e'))<0x2){this[_0xec5d('0xd')](_0xec5d('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xec5d('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xec5d('0x1f')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xec5d('0x20'),'power','predictive',_0xec5d('0x21')),'defaultValue':_0xec5d('0x20'),'comment':_0xec5d('0x22')},'dialLimitChannel':{'type':Sequelize[_0xec5d('0x13')](0x4)[_0xec5d('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xec5d('0x24')},'dialLimitQueue':{'type':Sequelize[_0xec5d('0x13')](0x4)[_0xec5d('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xec5d('0x25')},'dialPowerLevel':{'type':Sequelize[_0xec5d('0x26')](0x2)[_0xec5d('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xec5d('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xec5d('0x28'),_0xec5d('0x29')),'defaultValue':_0xec5d('0x29'),'comment':_0xec5d('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xec5d('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xec5d('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xec5d('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0xec5d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xec5d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':_0xec5d('0x2d'),'comment':_0xec5d('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x2f')},'dialQueueProject':{'type':Sequelize[_0xec5d('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xec5d('0x13')](0x5)[_0xec5d('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec5d('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xec5d('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec5d('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x3,'comment':_0xec5d('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xec5d('0x13')](0x5)[_0xec5d('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec5d('0x35')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec5d('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':_0xec5d('0x36')},'dialPrefix':{'type':Sequelize[_0xec5d('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x37'),_0xec5d('0x38'),_0xec5d('0x39')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xec5d('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xec5d('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xec5d('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xec5d('0x13')](0x9)[_0xec5d('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xec5d('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xec5d('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xec5d('0x13')](0x9)[_0xec5d('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xec5d('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xec5d('0x13')](0x9)[_0xec5d('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xec5d('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xec5d('0x13')](0x9)[_0xec5d('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xec5d('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xec5d('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xec5d('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xec5d('0x13')](0x5)[_0xec5d('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xec5d('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xec5d('0x13')](0x9)[_0xec5d('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xec5d('0x13')](0x5)[_0xec5d('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xec5d('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xec5d('0x1c')],'defaultValue':0x0,'comment':_0xec5d('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0xec5d('0x4')](_0xec5d('0x43'),_0xec5d('0x44')),'defaultValue':_0xec5d('0x43')},'dialQueueProject2':{'type':Sequelize[_0xec5d('0x2')],'comment':_0xec5d('0x45')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xec5d('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xec5d('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xec5d('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec5d('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xec5d('0x13')](0x5)[_0xec5d('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xec5d('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0xec5d('0x13')](0x5)[_0xec5d('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec5d('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xec5d('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec5d('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0xec5d('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec5d('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xec5d('0x13')](0x5)[_0xec5d('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xec5d('0x13')],'allowNull':!![],'comment':_0xec5d('0x4e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3d0663){if(!_0x3d0663)this[_0xec5d('0xd')](_0xec5d('0x4f'),null);this[_0xec5d('0xd')](_0xec5d('0x50'),_0x3d0663);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xec5d('0x13')](0x3)[_0xec5d('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xec5d('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0xd5ad=['onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#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','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','inbound','outbound','STRING','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','includes','INTEGER','yes','all','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\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'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd5ad,0xb5));var _0xdd5a=function(_0x35ad92,_0x43a820){_0x35ad92=_0x35ad92-0x0;var _0x2cc32a=_0xd5ad[_0x35ad92];return _0x2cc32a;};'use strict';var Sequelize=require('sequelize');module[_0xdd5a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xdd5a('0x1'),_0xdd5a('0x2')),'allowNull':![],'defaultValue':_0xdd5a('0x1')},'musiconhold':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':_0xdd5a('0x4')},'announce':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':''},'strategy':{'type':Sequelize[_0xdd5a('0x5')]('rr',_0xdd5a('0x6'),_0xdd5a('0x7'),_0xdd5a('0x8'),_0xdd5a('0x9'),_0xdd5a('0xa'),_0xdd5a('0xb'),_0xdd5a('0xc'),_0xdd5a('0xd')),'allowNull':![],'defaultValue':_0xdd5a('0x6'),'set':function(_0x359cce){this[_0xdd5a('0xe')](_0xdd5a('0xf'),_0x359cce?_0x359cce:_0xdd5a('0xa'));},'get':function(){var _0x5602ae=this[_0xdd5a('0x10')]('type');var _0x4597bc=this['getDataValue'](_0xdd5a('0x11'));var _0x555c9e=this[_0xdd5a('0x10')](_0xdd5a('0xf'));if(_0x5602ae==='outbound'){if(_0x4597bc===_0xdd5a('0x12')){return null;}if(_0x4597bc===_0xdd5a('0x13')&&![_0xdd5a('0xa'),'roundrobin'][_0xdd5a('0x14')](_0x555c9e)){this[_0xdd5a('0xe')](_0xdd5a('0xf'),_0xdd5a('0xa'));}}return _0x555c9e;}},'servicelevel':{'type':Sequelize[_0xdd5a('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xdd5a('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xdd5a('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xdd5a('0x3')]},'weight':{'type':Sequelize[_0xdd5a('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xdd5a('0x5')]('yes','no'),'defaultValue':_0xdd5a('0x16')},'autopause':{'type':Sequelize['ENUM'](_0xdd5a('0x16'),'no',_0xdd5a('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xdd5a('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xdd5a('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xdd5a('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdd5a('0x3')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdd5a('0x3')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xdd5a('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xdd5a('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xdd5a('0x16'),'no'),'defaultValue':_0xdd5a('0x16')},'announce_holdtime':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xdd5a('0x3')]},'queue_youarenext':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xdd5a('0x3')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdd5a('0x3')]},'queue_quantity1':{'type':Sequelize[_0xdd5a('0x3')]},'queue_quantity2':{'type':Sequelize[_0xdd5a('0x3')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xdd5a('0x3')]},'periodic_announce':{'type':Sequelize[_0xdd5a('0x18')],'set':function(_0x1a6245){this[_0xdd5a('0xe')]('periodic_announce',_0x1a6245?_0x1a6245[_0xdd5a('0x19')](','):[]);},'get':function(){return this[_0xdd5a('0x10')](_0xdd5a('0x1a'))?this[_0xdd5a('0x10')](_0xdd5a('0x1a'))[_0xdd5a('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xdd5a('0x16'),'set':function(_0x27a296){this[_0xdd5a('0xe')]('joinempty',_0x27a296?_0x27a296['join'](','):undefined);},'get':function(){return this[_0xdd5a('0x10')](_0xdd5a('0x1c'))?this[_0xdd5a('0x10')]('joinempty')[_0xdd5a('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x3861b6){this['setDataValue']('leavewhenempty',_0x3861b6?_0x3861b6['join'](','):undefined);},'get':function(){return this[_0xdd5a('0x10')](_0xdd5a('0x1d'))?this[_0xdd5a('0x10')](_0xdd5a('0x1d'))[_0xdd5a('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xdd5a('0x5')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdd5a('0x3')]},'acw':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':0x0,'set':function(_0x3807ed){this[_0xdd5a('0xe')](_0xdd5a('0x1f'),_0x3807ed);if(_0x3807ed){if(this['getDataValue'](_0xdd5a('0x20'))<0x2){this[_0xdd5a('0xe')](_0xdd5a('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xdd5a('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':0x0,'comment':_0xdd5a('0x21')},'dialMethod':{'type':Sequelize['ENUM'](_0xdd5a('0x12'),_0xdd5a('0x22'),_0xdd5a('0x23'),'predictive',_0xdd5a('0x13')),'defaultValue':_0xdd5a('0x22'),'comment':_0xdd5a('0x24')},'dialLimitChannel':{'type':Sequelize[_0xdd5a('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdd5a('0x25')},'dialLimitQueue':{'type':Sequelize[_0xdd5a('0x15')](0x4)[_0xdd5a('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x27'),_0xdd5a('0x28')),'defaultValue':_0xdd5a('0x28'),'comment':_0xdd5a('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdd5a('0x2a')](0x2)[_0xdd5a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xdd5a('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xdd5a('0x15')](0x3)[_0xdd5a('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xdd5a('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdd5a('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0xdd5a('0x15')](0x3)[_0xdd5a('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xdd5a('0x2c'),'comment':_0xdd5a('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xdd5a('0x15')](0x3)[_0xdd5a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd5a('0x2e')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xdd5a('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd5a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd5a('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdd5a('0x15')](0x5)[_0xdd5a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd5a('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xdd5a('0x15')](0x3)[_0xdd5a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd5a('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdd5a('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdd5a('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdd5a('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd5a('0x33')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd5a('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdd5a('0x34')},'dialTimezone':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':_0xdd5a('0x35')},'dialPrefix':{'type':Sequelize[_0xdd5a('0x3')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xdd5a('0x5')](_0xdd5a('0x36'),_0xdd5a('0x37'),_0xdd5a('0x38')),'defaultValue':_0xdd5a('0x36')},'dialAMDActive':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':0x0,'comment':_0xdd5a('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdd5a('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xdd5a('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdd5a('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdd5a('0x15')](0x9)[_0xdd5a('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdd5a('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd5a('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0xdd5a('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdd5a('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdd5a('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdd5a('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdd5a('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdd5a('0x15')](0x5)[_0xdd5a('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdd5a('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xdd5a('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd5a('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0xdd5a('0x15')](0x5)[_0xdd5a('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xdd5a('0x41'),_0xdd5a('0x42')),'defaultValue':_0xdd5a('0x41')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xdd5a('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xdd5a('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdd5a('0x43')},'dialCutDigit':{'type':Sequelize[_0xdd5a('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdd5a('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdd5a('0x15')](0x5)[_0xdd5a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd5a('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xdd5a('0x15')](0x3)[_0xdd5a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd5a('0x46')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdd5a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd5a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd5a('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdd5a('0x15')](0x5)[_0xdd5a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd5a('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xdd5a('0x15')](0x3)[_0xdd5a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xdd5a('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd5a('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdd5a('0x15')](0x3)[_0xdd5a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd5a('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdd5a('0x15')](0x5)[_0xdd5a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd5a('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdd5a('0x15')],'allowNull':!![],'comment':_0xdd5a('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':![],'comment':_0xdd5a('0x4d'),'set':function(_0x245b3d){if(!_0x245b3d)this[_0xdd5a('0xe')](_0xdd5a('0x4e'),null);this[_0xdd5a('0xe')]('mandatoryDisposition',_0x245b3d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xdd5a('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xdd5a('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xdd5a('0x15')](0x3)[_0xdd5a('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xdd5a('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 18f5cc9..f9397b8 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 _0xed1c=['cm_hopper','phone','scheduledAt','ListId','ContactId','CmListId','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','find','type','end','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','clone','omit','createdAt','updatedAt','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','UserVoiceQueue','each','UserVoiceQueueRt','format','interface','removeTeams','User','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','every','TeamId','all','union','compact','ids','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isNil','SIP/%s','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into'];(function(_0x3933c9,_0x2a68a9){var _0x396864=function(_0x1125bb){while(--_0x1125bb){_0x3933c9['push'](_0x3933c9['shift']());}};_0x396864(++_0x2a68a9);}(_0xed1c,0xe4));var _0xced1=function(_0x54d6e0,_0x199953){_0x54d6e0=_0x54d6e0-0x0;var _0x37400b=_0xed1c[_0x54d6e0];return _0x37400b;};'use strict';var emlformat=require(_0xced1('0x0'));var rimraf=require(_0xced1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xced1('0x2'));var Mustache=require(_0xced1('0x3'));var util=require(_0xced1('0x4'));var path=require('path');var sox=require(_0xced1('0x5'));var csv=require(_0xced1('0x6'));var ejs=require(_0xced1('0x7'));var fs=require('fs');var fs_extra=require(_0xced1('0x8'));var _=require('lodash');var squel=require(_0xced1('0x9'));var crypto=require(_0xced1('0xa'));var jsforce=require(_0xced1('0xb'));var deskjs=require(_0xced1('0xc'));var toCsv=require(_0xced1('0x6'));var querystring=require(_0xced1('0xd'));var Papa=require(_0xced1('0xe'));var Redis=require(_0xced1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xced1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xced1('0x11'));var logger=require(_0xced1('0x12'))(_0xced1('0x13'));var utils=require(_0xced1('0x14'));var config=require(_0xced1('0x15'));var licenseUtil=require(_0xced1('0x16'));var db=require(_0xced1('0x17'))['db'];config['redis']=_[_0xced1('0x18')](config[_0xced1('0x19')],{'host':_0xced1('0x1a'),'port':0x18eb});var socket=require(_0xced1('0x1b'))(new Redis(config['redis']));require(_0xced1('0x1c'))[_0xced1('0x1d')](socket);function respondWithStatusCode(_0x54cba9,_0x388e21){_0x388e21=_0x388e21||0xcc;return function(_0x26f81){if(_0x26f81){return _0x54cba9[_0xced1('0x1e')](_0x388e21);}return _0x54cba9[_0xced1('0x1f')](_0x388e21)['end']();};}function respondWithResult(_0x5560af,_0x3eb3ac){_0x3eb3ac=_0x3eb3ac||0xc8;return function(_0x4178d8){if(_0x4178d8){return _0x5560af[_0xced1('0x1f')](_0x3eb3ac)[_0xced1('0x20')](_0x4178d8);}};}function respondWithFilteredResult(_0x3e53bd,_0x292997){return function(_0x5a563a){if(_0x5a563a){var _0x56fc50=typeof _0x292997[_0xced1('0x21')]===_0xced1('0x22')&&typeof _0x292997[_0xced1('0x23')]==='undefined';var _0x1eac14=_0x5a563a[_0xced1('0x24')];var _0x3e51e4=_0x56fc50?0x0:_0x292997['offset'];var _0x2f9f6a=_0x56fc50?_0x5a563a[_0xced1('0x24')]:_0x292997[_0xced1('0x21')]+_0x292997['limit'];var _0x138c8b;if(_0x2f9f6a>=_0x1eac14){_0x2f9f6a=_0x1eac14;_0x138c8b=0xc8;}else{_0x138c8b=0xce;}_0x3e53bd[_0xced1('0x1f')](_0x138c8b);return _0x3e53bd[_0xced1('0x25')]('Content-Range',_0x3e51e4+'-'+_0x2f9f6a+'/'+_0x1eac14)['json'](_0x5a563a);}return null;};}function patchUpdates(_0x1d3884){return function(_0x41ee91){try{jsonpatch[_0xced1('0x26')](_0x41ee91,_0x1d3884,!![]);}catch(_0x20dcb4){return BPromise[_0xced1('0x27')](_0x20dcb4);}return _0x41ee91['save']();};}function saveUpdates(_0x14f47e,_0xdd5a47){return function(_0x4ea85e){if(_0x4ea85e){return _0x4ea85e['update'](_0x14f47e)[_0xced1('0x28')](function(_0x258c9a){return _0x258c9a;});}return null;};}function removeEntity(_0x3af9c0,_0x3912fe){return function(_0x1c2ba7){if(_0x1c2ba7){return _0x1c2ba7[_0xced1('0x29')]()['then'](function(){var _0x181f6e=_0x1c2ba7[_0xced1('0x2a')]({'plain':!![]});var _0x43cdec=[{'name':_0xced1('0x2b'),'value':_0xced1('0x2c'),'ignore':![]},{'name':_0xced1('0x2d'),'value':_0xced1('0x2e'),'ignore':![]}];var _0x4e9a37=_(_0x43cdec)[_0xced1('0x2f')]('ignore')[_0xced1('0x30')](_0xced1('0x31'))[_0xced1('0x31')]();if(_[_0xced1('0x32')](_0x4e9a37,_0x181f6e['type'])){return;}var _0x59361e=_[_0xced1('0x33')](_0x43cdec,[_0xced1('0x31'),_0x181f6e[_0xced1('0x34')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x59361e,'resourceId':_0x181f6e['id']}})[_0xced1('0x28')](function(){return _0x1c2ba7;});})[_0xced1('0x28')](function(){_0x3af9c0[_0xced1('0x1f')](0xcc)[_0xced1('0x35')]();});}};}function handleEntityNotFound(_0x5bb1a8,_0x4023e4){return function(_0x4298d2){if(!_0x4298d2){_0x5bb1a8[_0xced1('0x1e')](0x194);}return _0x4298d2;};}function handleError(_0x2109c4,_0x136a74){_0x136a74=_0x136a74||0x1f4;return function(_0x33ac43){logger[_0xced1('0x36')](_0x33ac43['stack']);if(_0x33ac43['name']){delete _0x33ac43[_0xced1('0x37')];}_0x2109c4[_0xced1('0x1f')](_0x136a74)[_0xced1('0x38')](_0x33ac43);};}exports[_0xced1('0x39')]=function(_0x63d21e,_0x3eb109){var _0x512c76={},_0x486562={},_0x5a9af3={'count':0x0,'rows':[]};var _0x4d305c=_[_0xced1('0x30')](db[_0xced1('0x3a')][_0xced1('0x3b')],function(_0x12da46){return{'name':_0x12da46[_0xced1('0x3c')],'type':_0x12da46[_0xced1('0x34')][_0xced1('0x3d')]};});_0x486562[_0xced1('0x3e')]=_[_0xced1('0x30')](_0x4d305c,_0xced1('0x37'));_0x486562[_0xced1('0x3f')]=_[_0xced1('0x40')](_0x63d21e[_0xced1('0x3f')]);_0x486562['filters']=_[_0xced1('0x41')](_0x486562[_0xced1('0x3e')],_0x486562[_0xced1('0x3f')]);_0x512c76[_0xced1('0x42')]=_[_0xced1('0x41')](_0x486562[_0xced1('0x3e')],qs['fields'](_0x63d21e[_0xced1('0x3f')][_0xced1('0x43')]));_0x512c76[_0xced1('0x42')]=_0x512c76[_0xced1('0x42')][_0xced1('0x44')]?_0x512c76[_0xced1('0x42')]:_0x486562[_0xced1('0x3e')];if(!_0x63d21e[_0xced1('0x3f')][_0xced1('0x45')](_0xced1('0x46'))){_0x512c76[_0xced1('0x23')]=qs['limit'](_0x63d21e['query'][_0xced1('0x23')]);_0x512c76[_0xced1('0x21')]=qs[_0xced1('0x21')](_0x63d21e['query'][_0xced1('0x21')]);}_0x512c76[_0xced1('0x47')]=qs[_0xced1('0x48')](_0x63d21e['query'][_0xced1('0x48')]);_0x512c76[_0xced1('0x49')]=qs['filters'](_[_0xced1('0x4a')](_0x63d21e['query'],_0x486562[_0xced1('0x4b')]),_0x4d305c);if(_0x63d21e[_0xced1('0x3f')]['filter']){_0x512c76[_0xced1('0x49')]=_[_0xced1('0x4c')](_0x512c76[_0xced1('0x49')],{'$or':_['map'](_0x4d305c,function(_0x39e46b){if(_0x39e46b[_0xced1('0x34')]!=='VIRTUAL'){var _0x1ac78b={};_0x1ac78b[_0x39e46b['name']]={'$like':'%'+_0x63d21e['query'][_0xced1('0x2f')]+'%'};return _0x1ac78b;}})});}_0x512c76=_['merge']({},_0x512c76,_0x63d21e[_0xced1('0x4d')]);var _0x217399={'where':_0x512c76[_0xced1('0x49')]};return db['VoiceQueue'][_0xced1('0x24')](_0x217399)['then'](function(_0x2b8a19){_0x5a9af3[_0xced1('0x24')]=_0x2b8a19;if(_0x63d21e[_0xced1('0x3f')][_0xced1('0x4e')]){_0x512c76['include']=[{'all':!![]}];}return db[_0xced1('0x3a')][_0xced1('0x4f')](_0x512c76);})['then'](function(_0x4733f0){_0x5a9af3[_0xced1('0x50')]=_0x4733f0;return _0x5a9af3;})['then'](respondWithFilteredResult(_0x3eb109,_0x512c76))[_0xced1('0x51')](handleError(_0x3eb109,null));};exports[_0xced1('0x52')]=function(_0x1646df,_0x59f1ba){var _0xc04f2={'raw':![],'where':{'id':_0x1646df[_0xced1('0x53')]['id']}},_0xcfbed8={};_0xcfbed8[_0xced1('0x3e')]=_[_0xced1('0x40')](db['VoiceQueue'][_0xced1('0x3b')]);_0xcfbed8['query']=_[_0xced1('0x40')](_0x1646df[_0xced1('0x3f')]);_0xcfbed8[_0xced1('0x4b')]=_[_0xced1('0x41')](_0xcfbed8[_0xced1('0x3e')],_0xcfbed8[_0xced1('0x3f')]);_0xc04f2['attributes']=_[_0xced1('0x41')](_0xcfbed8[_0xced1('0x3e')],qs['fields'](_0x1646df[_0xced1('0x3f')]['fields']));_0xc04f2['attributes']=_0xc04f2[_0xced1('0x42')][_0xced1('0x44')]?_0xc04f2[_0xced1('0x42')]:_0xcfbed8[_0xced1('0x3e')];if(_0x1646df['query'][_0xced1('0x4e')]){_0xc04f2[_0xced1('0x54')]=[{'all':!![]}];}_0xc04f2=_[_0xced1('0x4c')]({},_0xc04f2,_0x1646df['options']);return db['VoiceQueue'][_0xced1('0x33')](_0xc04f2)[_0xced1('0x28')](handleEntityNotFound(_0x59f1ba,null))[_0xced1('0x28')](respondWithResult(_0x59f1ba,null))[_0xced1('0x51')](handleError(_0x59f1ba,null));};exports['create']=function(_0x501c85,_0x47cc0a){return db[_0xced1('0x3a')][_0xced1('0x55')](_0x501c85[_0xced1('0x56')],{})[_0xced1('0x28')](function(_0x252160){var _0x3fa017=_0x501c85[_0xced1('0x57')][_0xced1('0x2a')]({'plain':!![]});if(!_0x3fa017)throw new Error(_0xced1('0x58'));if(_0x3fa017['role']===_0xced1('0x57')){var _0x3f44e6=_0x252160[_0xced1('0x2a')]({'plain':!![]});var _0x5e6ab1=[{'name':_0xced1('0x2b'),'value':_0xced1('0x2c')},{'name':_0xced1('0x2d'),'value':_0xced1('0x2e')}];var _0x57a878=_[_0xced1('0x33')](_0x5e6ab1,['value',_0x3f44e6['type']])[_0xced1('0x37')];return db[_0xced1('0x59')]['find']({'where':{'name':_0x57a878,'userProfileId':_0x3fa017['userProfileId']},'raw':!![]})['then'](function(_0x14207d){if(_0x14207d&&_0x14207d['autoAssociation']===0x0){return db[_0xced1('0x5a')][_0xced1('0x55')]({'name':_0x3f44e6[_0xced1('0x37')],'resourceId':_0x3f44e6['id'],'type':_0x14207d[_0xced1('0x37')],'sectionId':_0x14207d['id']},{})[_0xced1('0x28')](function(){return _0x252160;});}else{return _0x252160;}})[_0xced1('0x51')](function(_0x1388e0){logger[_0xced1('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1388e0);throw _0x1388e0;});}return _0x252160;})['then'](respondWithResult(_0x47cc0a,0xc9))[_0xced1('0x51')](handleError(_0x47cc0a,null));};exports[_0xced1('0x5b')]=function(_0x235651,_0x34262e){var _0x5b40ea={'where':{'id':_0x235651[_0xced1('0x53')]['id']}},_0x455134={};_0x455134[_0xced1('0x3e')]=_[_0xced1('0x40')](db['VoiceQueue'][_0xced1('0x3b')]);_0x5b40ea[_0xced1('0x42')]=_[_0xced1('0x41')](_0x455134[_0xced1('0x3e')],qs[_0xced1('0x43')](_0x235651[_0xced1('0x3f')][_0xced1('0x43')]));_0x5b40ea[_0xced1('0x42')]=_0x5b40ea['attributes']['length']?_0x5b40ea['attributes']:_0x455134[_0xced1('0x3e')];if(_0x235651['query'][_0xced1('0x4e')]){_0x5b40ea['include']=[{'all':!![]}];}_0x5b40ea=_['merge']({},_0x5b40ea,_0x235651[_0xced1('0x4d')]);return db[_0xced1('0x3a')][_0xced1('0x33')](_0x5b40ea)[_0xced1('0x28')](handleEntityNotFound(_0x34262e,null))[_0xced1('0x28')](function(_0x466da1){if(_0x466da1){var _0x8b56e7=_0x466da1[_0xced1('0x2a')]({'plain':!![]});_0x8b56e7=qs[_0xced1('0x5c')](_0x8b56e7,['id',_0xced1('0x5d'),_0xced1('0x5e')]);_0x235651['body']=_[_0xced1('0x5c')](_0x235651[_0xced1('0x56')],['id','createdAt',_0xced1('0x5e')]);return db[_0xced1('0x3a')]['create'](_[_0xced1('0x4c')](_0x8b56e7,_0x235651[_0xced1('0x56')]),{'include':_0x235651[_0xced1('0x3f')][_0xced1('0x4e')]?[{'all':!![]}]:undefined})[_0xced1('0x28')](function(_0x5c9a6d){var _0x59806a=_0x235651['user'][_0xced1('0x2a')]({'plain':!![]});if(!_0x59806a)throw new Error(_0xced1('0x58'));if(_0x59806a['role']===_0xced1('0x57')){var _0x10447b=_0x5c9a6d[_0xced1('0x2a')]({'plain':!![]});var _0x59d5dc=[{'name':_0xced1('0x2b'),'value':_0xced1('0x2c')},{'name':'QueueCampaigns','value':_0xced1('0x2e')}];var _0x47e33d=_[_0xced1('0x33')](_0x59d5dc,[_0xced1('0x31'),_0x10447b[_0xced1('0x34')]])[_0xced1('0x37')];return db[_0xced1('0x59')][_0xced1('0x33')]({'where':{'name':_0x47e33d,'userProfileId':_0x59806a[_0xced1('0x5f')]},'raw':!![]})['then'](function(_0x395fe0){if(_0x395fe0&&_0x395fe0[_0xced1('0x60')]===0x0){return db[_0xced1('0x5a')]['create']({'name':_0x10447b['name'],'resourceId':_0x10447b['id'],'type':_0x395fe0[_0xced1('0x37')],'sectionId':_0x395fe0['id']},{})[_0xced1('0x28')](function(){return _0x5c9a6d;});}else{return _0x5c9a6d;}})['catch'](function(_0x33f6c5){logger[_0xced1('0x36')](_0xced1('0x61'),_0x33f6c5);throw _0x33f6c5;});}return _0x5c9a6d;});}})['then'](respondWithResult(_0x34262e,0xc9))['catch'](handleError(_0x34262e,null));};exports[_0xced1('0x62')]=function(_0x4f9981,_0x76f5df){if(_0x4f9981[_0xced1('0x56')]['id']){delete _0x4f9981[_0xced1('0x56')]['id'];}return db[_0xced1('0x3a')]['find']({'where':{'id':_0x4f9981[_0xced1('0x53')]['id']}})['then'](handleEntityNotFound(_0x76f5df,null))['then'](saveUpdates(_0x4f9981['body'],null))['then'](respondWithResult(_0x76f5df,null))[_0xced1('0x51')](handleError(_0x76f5df,null));};exports[_0xced1('0x29')]=function(_0x586699,_0x5e6129){return db[_0xced1('0x3a')][_0xced1('0x33')]({'where':{'id':_0x586699['params']['id']}})['then'](handleEntityNotFound(_0x5e6129,null))[_0xced1('0x28')](removeEntity(_0x5e6129,null))[_0xced1('0x51')](handleError(_0x5e6129,null));};exports['getHoppers']=function(_0x51ac61,_0x54d238,_0x5ca2e7){var _0x45bc94={'raw':![],'where':{}};var _0x135f0f={};var _0x201974={'count':0x0,'rows':[]};return db[_0xced1('0x3a')][_0xced1('0x63')]({'where':{'id':_0x51ac61[_0xced1('0x53')]['id']}})['then'](handleEntityNotFound(_0x54d238,null))[_0xced1('0x28')](function(_0xf047d7){if(_0xf047d7){_0x135f0f[_0xced1('0x3e')]=_[_0xced1('0x40')](db[_0xced1('0x64')][_0xced1('0x3b')]);_0x135f0f[_0xced1('0x3f')]=_[_0xced1('0x40')](_0x51ac61[_0xced1('0x3f')]);_0x135f0f['filters']=_['intersection'](_0x135f0f[_0xced1('0x3e')],_0x135f0f['query']);_0x45bc94[_0xced1('0x42')]=_['intersection'](_0x135f0f[_0xced1('0x3e')],qs[_0xced1('0x43')](_0x51ac61[_0xced1('0x3f')][_0xced1('0x43')]));_0x45bc94[_0xced1('0x42')]=_0x45bc94[_0xced1('0x42')]['length']?_0x45bc94[_0xced1('0x42')]:_0x135f0f[_0xced1('0x3e')];if(!_0x51ac61[_0xced1('0x3f')][_0xced1('0x45')](_0xced1('0x46'))){_0x45bc94[_0xced1('0x23')]=qs['limit'](_0x51ac61['query'][_0xced1('0x23')]);_0x45bc94[_0xced1('0x21')]=qs[_0xced1('0x21')](_0x51ac61[_0xced1('0x3f')][_0xced1('0x21')]);}_0x45bc94['order']=qs[_0xced1('0x48')](_0x51ac61[_0xced1('0x3f')][_0xced1('0x48')]);_0x45bc94[_0xced1('0x49')]=qs['filters'](_[_0xced1('0x4a')](_0x51ac61[_0xced1('0x3f')],_0x135f0f['filters']));_0x45bc94[_0xced1('0x49')]['VoiceQueueId']=_0xf047d7['id'];if(_0x51ac61[_0xced1('0x3f')][_0xced1('0x2f')]){_0x45bc94[_0xced1('0x49')]=_[_0xced1('0x4c')](_0x45bc94[_0xced1('0x49')],{'$or':_[_0xced1('0x30')](_0x45bc94[_0xced1('0x42')],function(_0x17137e){var _0x2846f6={};_0x2846f6[_0x17137e]={'$like':'%'+_0x51ac61[_0xced1('0x3f')]['filter']+'%'};return _0x2846f6;})});}_0x45bc94=_[_0xced1('0x4c')]({},_0x45bc94,_0x51ac61[_0xced1('0x4d')]);return db[_0xced1('0x64')][_0xced1('0x24')]({'where':_0x45bc94['where']})[_0xced1('0x28')](function(_0x238b8d){_0x201974[_0xced1('0x24')]=_0x238b8d;if(_0x51ac61[_0xced1('0x3f')]['includeAll']){_0x45bc94[_0xced1('0x54')]=[{'all':!![]}];}return db[_0xced1('0x64')][_0xced1('0x4f')](_0x45bc94);})[_0xced1('0x28')](function(_0x3beefd){_0x201974['rows']=_0x3beefd;return _0x201974;});}})[_0xced1('0x28')](respondWithFilteredResult(_0x54d238,_0x45bc94))['catch'](handleError(_0x54d238,null));};exports[_0xced1('0x65')]=function(_0x4106df,_0x1abc72,_0x4dde74){var _0x41d724={'raw':!![],'where':{}};var _0x328079={};var _0x5eca32={'count':0x0,'rows':[]};return db[_0xced1('0x3a')]['findOne']({'where':{'id':_0x4106df[_0xced1('0x53')]['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x1abc72,null))[_0xced1('0x28')](function(_0x5aeea4){if(_0x5aeea4){_0x328079['model']=_[_0xced1('0x40')](db[_0xced1('0x66')][_0xced1('0x3b')]);_0x328079[_0xced1('0x3f')]=_[_0xced1('0x40')](_0x4106df['query']);_0x328079['filters']=_[_0xced1('0x41')](_0x328079[_0xced1('0x3e')],_0x328079[_0xced1('0x3f')]);_0x41d724['attributes']=_[_0xced1('0x41')](_0x328079['model'],qs['fields'](_0x4106df[_0xced1('0x3f')]['fields']));_0x41d724[_0xced1('0x42')]=_0x41d724['attributes'][_0xced1('0x44')]?_0x41d724[_0xced1('0x42')]:_0x328079[_0xced1('0x3e')];if(!_0x4106df[_0xced1('0x3f')][_0xced1('0x45')](_0xced1('0x46'))){_0x41d724[_0xced1('0x23')]=qs['limit'](_0x4106df['query'][_0xced1('0x23')]);_0x41d724[_0xced1('0x21')]=qs[_0xced1('0x21')](_0x4106df[_0xced1('0x3f')]['offset']);}_0x41d724['order']=qs[_0xced1('0x48')](_0x4106df['query'][_0xced1('0x48')]);_0x41d724[_0xced1('0x49')]=qs[_0xced1('0x4b')](_['pick'](_0x4106df[_0xced1('0x3f')],_0x328079[_0xced1('0x4b')]));_0x41d724['where'][_0xced1('0x67')]=_0x5aeea4['id'];if(_0x4106df[_0xced1('0x3f')][_0xced1('0x2f')]){_0x41d724['where']=_[_0xced1('0x4c')](_0x41d724[_0xced1('0x49')],{'$or':_[_0xced1('0x30')](_0x41d724[_0xced1('0x42')],function(_0xce8b5){var _0x4725eb={};_0x4725eb[_0xce8b5]={'$like':'%'+_0x4106df['query']['filter']+'%'};return _0x4725eb;})});}_0x41d724=_[_0xced1('0x4c')]({},_0x41d724,_0x4106df[_0xced1('0x4d')]);return db[_0xced1('0x66')][_0xced1('0x24')]({'where':_0x41d724[_0xced1('0x49')]})[_0xced1('0x28')](function(_0x43e453){_0x5eca32[_0xced1('0x24')]=_0x43e453;if(_0x4106df[_0xced1('0x3f')][_0xced1('0x4e')]){_0x41d724[_0xced1('0x54')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x41d724);})[_0xced1('0x28')](function(_0x3a0044){_0x5eca32[_0xced1('0x50')]=_0x3a0044;return _0x5eca32;});}})[_0xced1('0x28')](respondWithFilteredResult(_0x1abc72,_0x41d724))[_0xced1('0x51')](handleError(_0x1abc72,null));};exports[_0xced1('0x68')]=function(_0x41ed6e,_0x14cbf1,_0x2b60aa){var _0x1b5aab={'raw':!![],'where':{}};var _0x21d10a={};var _0xd39989={'count':0x0,'rows':[]};return db[_0xced1('0x3a')][_0xced1('0x63')]({'where':{'id':_0x41ed6e[_0xced1('0x53')]['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x14cbf1,null))[_0xced1('0x28')](function(_0x152884){if(_0x152884){_0x21d10a['model']=_[_0xced1('0x40')](db['CmHopperFinal'][_0xced1('0x3b')]);_0x21d10a['query']=_[_0xced1('0x40')](_0x41ed6e[_0xced1('0x3f')]);_0x21d10a[_0xced1('0x4b')]=_[_0xced1('0x41')](_0x21d10a[_0xced1('0x3e')],_0x21d10a[_0xced1('0x3f')]);_0x1b5aab[_0xced1('0x42')]=_[_0xced1('0x41')](_0x21d10a[_0xced1('0x3e')],qs[_0xced1('0x43')](_0x41ed6e[_0xced1('0x3f')][_0xced1('0x43')]));_0x1b5aab[_0xced1('0x42')]=_0x1b5aab[_0xced1('0x42')][_0xced1('0x44')]?_0x1b5aab[_0xced1('0x42')]:_0x21d10a[_0xced1('0x3e')];if(!_0x41ed6e[_0xced1('0x3f')][_0xced1('0x45')](_0xced1('0x46'))){_0x1b5aab['limit']=qs[_0xced1('0x23')](_0x41ed6e[_0xced1('0x3f')][_0xced1('0x23')]);_0x1b5aab[_0xced1('0x21')]=qs['offset'](_0x41ed6e[_0xced1('0x3f')][_0xced1('0x21')]);}_0x1b5aab[_0xced1('0x47')]=qs[_0xced1('0x48')](_0x41ed6e[_0xced1('0x3f')]['sort']);_0x1b5aab[_0xced1('0x49')]=qs['filters'](_['pick'](_0x41ed6e[_0xced1('0x3f')],_0x21d10a[_0xced1('0x4b')]));_0x1b5aab['where']['VoiceQueueId']=_0x152884['id'];if(_0x41ed6e[_0xced1('0x3f')][_0xced1('0x2f')]){_0x1b5aab[_0xced1('0x49')]=_[_0xced1('0x4c')](_0x1b5aab[_0xced1('0x49')],{'$or':_[_0xced1('0x30')](_0x1b5aab[_0xced1('0x42')],function(_0x502f8d){var _0x153911={};_0x153911[_0x502f8d]={'$like':'%'+_0x41ed6e[_0xced1('0x3f')][_0xced1('0x2f')]+'%'};return _0x153911;})});}_0x1b5aab=_[_0xced1('0x4c')]({},_0x1b5aab,_0x41ed6e[_0xced1('0x4d')]);return db[_0xced1('0x69')]['count']({'where':_0x1b5aab[_0xced1('0x49')]})[_0xced1('0x28')](function(_0x7af31b){_0xd39989[_0xced1('0x24')]=_0x7af31b;if(_0x41ed6e[_0xced1('0x3f')][_0xced1('0x4e')]){_0x1b5aab['include']=[{'all':!![]}];}return db[_0xced1('0x69')]['findAll'](_0x1b5aab);})[_0xced1('0x28')](function(_0x1653e1){_0xd39989[_0xced1('0x50')]=_0x1653e1;return _0xd39989;});}})[_0xced1('0x28')](respondWithFilteredResult(_0x14cbf1,_0x1b5aab))[_0xced1('0x51')](handleError(_0x14cbf1,null));};exports[_0xced1('0x6a')]=function(_0x2a99c6,_0x319d0a,_0x2070e8){var _0x330c9b={'raw':!![],'where':{}};var _0xaa8d53={};var _0x336837={'count':0x0,'rows':[]};return db[_0xced1('0x3a')][_0xced1('0x63')]({'where':{'id':_0x2a99c6['params']['id']}})['then'](handleEntityNotFound(_0x319d0a,null))['then'](function(_0xe54584){if(_0xe54584){_0xaa8d53[_0xced1('0x3e')]=_[_0xced1('0x40')](db[_0xced1('0x6b')][_0xced1('0x3b')]);_0xaa8d53[_0xced1('0x3f')]=_['keys'](_0x2a99c6[_0xced1('0x3f')]);_0xaa8d53['filters']=_['intersection'](_0xaa8d53[_0xced1('0x3e')],_0xaa8d53[_0xced1('0x3f')]);_0x330c9b[_0xced1('0x42')]=_[_0xced1('0x41')](_0xaa8d53[_0xced1('0x3e')],qs['fields'](_0x2a99c6[_0xced1('0x3f')][_0xced1('0x43')]));_0x330c9b[_0xced1('0x42')]=_0x330c9b['attributes'][_0xced1('0x44')]?_0x330c9b['attributes']:_0xaa8d53[_0xced1('0x3e')];if(!_0x2a99c6[_0xced1('0x3f')][_0xced1('0x45')](_0xced1('0x46'))){_0x330c9b[_0xced1('0x23')]=qs[_0xced1('0x23')](_0x2a99c6[_0xced1('0x3f')][_0xced1('0x23')]);_0x330c9b[_0xced1('0x21')]=qs[_0xced1('0x21')](_0x2a99c6[_0xced1('0x3f')][_0xced1('0x21')]);}_0x330c9b[_0xced1('0x47')]=qs['sort'](_0x2a99c6[_0xced1('0x3f')][_0xced1('0x48')]);_0x330c9b[_0xced1('0x49')]=qs['filters'](_['pick'](_0x2a99c6['query'],_0xaa8d53['filters']));_0x330c9b[_0xced1('0x49')]['VoiceQueueId']=_0xe54584['id'];if(_0x2a99c6[_0xced1('0x3f')][_0xced1('0x2f')]){_0x330c9b[_0xced1('0x49')]=_[_0xced1('0x4c')](_0x330c9b['where'],{'$or':_[_0xced1('0x30')](_0x330c9b[_0xced1('0x42')],function(_0x3e822d){var _0x3c6e25={};_0x3c6e25[_0x3e822d]={'$like':'%'+_0x2a99c6[_0xced1('0x3f')][_0xced1('0x2f')]+'%'};return _0x3c6e25;})});}_0x330c9b=_[_0xced1('0x4c')]({},_0x330c9b,_0x2a99c6['options']);return db[_0xced1('0x6b')][_0xced1('0x24')]({'where':_0x330c9b[_0xced1('0x49')]})['then'](function(_0x3b0ed0){_0x336837[_0xced1('0x24')]=_0x3b0ed0;if(_0x2a99c6['query']['includeAll']){_0x330c9b[_0xced1('0x54')]=[{'all':!![]}];}return db[_0xced1('0x6b')]['findAll'](_0x330c9b);})[_0xced1('0x28')](function(_0x34150e){_0x336837[_0xced1('0x50')]=_0x34150e;return _0x336837;});}})[_0xced1('0x28')](respondWithFilteredResult(_0x319d0a,_0x330c9b))[_0xced1('0x51')](handleError(_0x319d0a,null));};exports[_0xced1('0x6c')]=function(_0x130829,_0x33f71b,_0x4f967d){var _0x3d5b67={};var _0x206e5e={};var _0x22bc9b;var _0x4bb3a5;return db[_0xced1('0x3a')]['findOne']({'where':{'id':_0x130829[_0xced1('0x53')]['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x33f71b,null))[_0xced1('0x28')](function(_0x53eb56){if(_0x53eb56){_0x22bc9b=_0x53eb56;_0x206e5e['model']=_[_0xced1('0x40')](db[_0xced1('0x6d')][_0xced1('0x3b')]);_0x206e5e['query']=_[_0xced1('0x40')](_0x130829[_0xced1('0x3f')]);_0x206e5e[_0xced1('0x4b')]=_['intersection'](_0x206e5e[_0xced1('0x3e')],_0x206e5e[_0xced1('0x3f')]);_0x3d5b67['attributes']=_['intersection'](_0x206e5e[_0xced1('0x3e')],qs[_0xced1('0x43')](_0x130829[_0xced1('0x3f')]['fields']));_0x3d5b67[_0xced1('0x42')]=_0x3d5b67[_0xced1('0x42')][_0xced1('0x44')]?_0x3d5b67[_0xced1('0x42')]:_0x206e5e[_0xced1('0x3e')];_0x3d5b67['order']=qs['sort'](_0x130829[_0xced1('0x3f')]['sort']);_0x3d5b67[_0xced1('0x49')]=qs['filters'](_[_0xced1('0x4a')](_0x130829['query'],_0x206e5e[_0xced1('0x4b')]));if(_0x130829['query'][_0xced1('0x2f')]){_0x3d5b67[_0xced1('0x49')]=_[_0xced1('0x4c')](_0x3d5b67['where'],{'$or':_[_0xced1('0x30')](_0x3d5b67[_0xced1('0x42')],function(_0x3051ac){var _0x37dc38={};_0x37dc38[_0x3051ac]={'$like':'%'+_0x130829[_0xced1('0x3f')]['filter']+'%'};return _0x37dc38;})});}_0x3d5b67=_['merge']({},_0x3d5b67,_0x130829[_0xced1('0x4d')]);return _0x22bc9b['getTeams'](_0x3d5b67);}})[_0xced1('0x28')](function(_0x5ac073){if(_0x5ac073){_0x4bb3a5=_0x5ac073['length'];if(!_0x130829[_0xced1('0x3f')][_0xced1('0x45')](_0xced1('0x46'))){_0x3d5b67[_0xced1('0x23')]=qs[_0xced1('0x23')](_0x130829[_0xced1('0x3f')]['limit']);_0x3d5b67[_0xced1('0x21')]=qs[_0xced1('0x21')](_0x130829[_0xced1('0x3f')][_0xced1('0x21')]);}return _0x22bc9b[_0xced1('0x6c')](_0x3d5b67);}})[_0xced1('0x28')](function(_0x30b196){if(_0x30b196){return _0x30b196?{'count':_0x4bb3a5,'rows':_0x30b196}:null;}})[_0xced1('0x28')](respondWithResult(_0x33f71b,null))['catch'](handleError(_0x33f71b,null));};exports[_0xced1('0x6e')]=function(_0xcdd353,_0x2bdeff,_0x518a7f){var _0x2f51a8=_0xcdd353[_0xced1('0x56')][_0xced1('0x6f')];var _0x1331aa=_[_0xced1('0x30')](_0x2f51a8,'id');return db[_0xced1('0x6d')]['findAll']({'where':{'id':_0x1331aa},'attributes':['id'],'include':[{'model':db['User'],'as':_0xced1('0x70'),'attributes':['id',_0xced1('0x37'),_0xced1('0x71'),_0xced1('0x72'),'interface'],'raw':!![]}]})[_0xced1('0x28')](function(_0x34e1d7){if(_0x34e1d7){var _0x39ef32=_[_0xced1('0x73')](_0x34e1d7,function(_0x27d995){var _0x433171=_0x27d995['get']({'plain':!![]});_0x433171[_0xced1('0x70')][_0xced1('0x74')](function(_0x3456f0){_0x3456f0[_0xced1('0x75')]=_['find'](_0x2f51a8,{'id':_0x433171['id']})['penalty'];});return _0x433171[_0xced1('0x70')];});return db[_0xced1('0x3a')]['find']({'where':{'id':_0xcdd353['params']['id']}})[_0xced1('0x28')](function(_0x1f24b5){return db[_0xced1('0x76')][_0xced1('0x77')](function(_0x397a6f){return _0x1f24b5['addTeams'](_0x1331aa,{'transaction':_0x397a6f})['then'](function(){return BPromise['each'](_0x2f51a8,function(_0x4c327f){return db[_0xced1('0x78')][_0xced1('0x79')]({'TeamId':_0x4c327f['id'],'VoiceQueueId':_0xcdd353[_0xced1('0x53')]['id'],'penalty':_0x4c327f['penalty']},{'transaction':_0x397a6f});});})[_0xced1('0x28')](function(){return BPromise['each'](_0x39ef32,function(_0x15e686){return db[_0xced1('0x7a')]['findOrCreate']({'where':{'UserId':_0x15e686['id'],'VoiceQueueId':_0xcdd353[_0xced1('0x53')]['id']},'defaults':{'penalty':_0x15e686[_0xced1('0x75')]},'transaction':_0x397a6f});});})[_0xced1('0x28')](function(){return BPromise[_0xced1('0x7b')](_[_0xced1('0x2f')](_0x39ef32,{'online':!![]}),function(_0x553a21){return db[_0xced1('0x7c')][_0xced1('0x79')]({'membername':_0x553a21[_0xced1('0x37')],'UserId':_0x553a21['id'],'queue_name':_0x1f24b5[_0xced1('0x37')],'VoiceQueueId':_0x1f24b5['id'],'interface':_['isNil'](_0x553a21['interface'])?util[_0xced1('0x7d')]('SIP/%s',_0x553a21[_0xced1('0x37')]):_0x553a21[_0xced1('0x7e')],'paused':_0x553a21[_0xced1('0x72')]||![],'penalty':_0x553a21[_0xced1('0x75')]},{'transaction':_0x397a6f});});})[_0xced1('0x28')](function(){_0x39ef32['forEach'](function(_0x502346){socket['emit']('userVoiceQueue:save',{'UserId':_0x502346['id'],'VoiceQueueId':_0x1f24b5['id']});});});});});}})['then'](respondWithStatusCode(_0x2bdeff,null))[_0xced1('0x51')](handleError(_0x2bdeff,null));};exports[_0xced1('0x7f')]=function(_0x3403b5,_0x2144bb,_0x468294){return db[_0xced1('0x6d')][_0xced1('0x4f')]({'where':{'id':_0x3403b5[_0xced1('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db[_0xced1('0x80')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xced1('0x28')](handleEntityNotFound(_0x2144bb,null))[_0xced1('0x28')](function(_0x1edb54){var _0x422490=_[_0xced1('0x30')](_0x1edb54,'id');var _0x5979f2=[];var _0x251f94=[];var _0x2cadec=squel[_0xced1('0x81')]();_0x2cadec[_0xced1('0x82')]('tq.TeamId')[_0xced1('0x83')](_0xced1('0x84'),'tq')[_0xced1('0x85')](_0xced1('0x86'),'ut',_0xced1('0x87'))[_0xced1('0x49')](_0xced1('0x88'),_0x3403b5[_0xced1('0x53')]['id']);for(var _0xc4e03c=0x0;_0xc4e03c<_0x1edb54['length'];_0xc4e03c+=0x1){let _0x4be9b9=_0x1edb54[_0xc4e03c];for(var _0x335914=0x0;_0x335914<_0x4be9b9[_0xced1('0x70')][_0xced1('0x44')];_0x335914+=0x1){let _0x17e666=_0x4be9b9[_0xced1('0x70')][_0x335914];var _0x12fb9b=_0x2cadec[_0xced1('0x5b')]();_0x12fb9b[_0xced1('0x49')]('ut.UserId\x20=\x20?',_0x17e666['id']);_0x251f94[_0xced1('0x89')](db[_0xced1('0x76')]['query'](_0x12fb9b[_0xced1('0x8a')](),{'type':db[_0xced1('0x76')]['QueryTypes']['SELECT']})[_0xced1('0x28')](function(_0x1d85de){if(_0x1d85de[_0xced1('0x44')]===0x1){return _0x17e666['id'];}else{var _0x17d8db=_[_0xced1('0x8b')](_['map'](_0x1d85de,_0xced1('0x8c')),function(_0x3ea738){return _['includes'](_0x422490,_0x3ea738);});if(_0x17d8db){return _0x17e666['id'];}}}));}}return BPromise[_0xced1('0x8d')](_0x251f94)['then'](function(_0x5b3ec9){_0x5979f2=_(_0x5979f2)[_0xced1('0x8e')](_0x5b3ec9)[_0xced1('0x8f')]()['value']();return db[_0xced1('0x3a')][_0xced1('0x33')]({'where':{'id':_0x3403b5[_0xced1('0x53')]['id']}})['then'](function(_0x149d5d){return db[_0xced1('0x76')][_0xced1('0x77')](function(_0x265bc4){return _0x149d5d[_0xced1('0x7f')](_0x3403b5[_0xced1('0x3f')][_0xced1('0x90')],{'transaction':_0x265bc4})[_0xced1('0x28')](function(){if(!_[_0xced1('0x91')](_0x5979f2)){return _0x149d5d[_0xced1('0x92')](_0x5979f2,{'transaction':_0x265bc4})[_0xced1('0x28')](function(){return db[_0xced1('0x7c')][_0xced1('0x29')]({'where':{'VoiceQueueId':_0x3403b5[_0xced1('0x53')]['id'],'UserId':_0x5979f2},'transaction':_0x265bc4});});}})[_0xced1('0x28')](function(){_0x5979f2[_0xced1('0x74')](function(_0x62a9b9){socket[_0xced1('0x93')](_0xced1('0x94'),{'UserId':_0x62a9b9,'VoiceQueueId':_0x149d5d['id']});});});});});});})[_0xced1('0x28')](respondWithStatusCode(_0x2144bb,null))[_0xced1('0x51')](handleError(_0x2144bb,null));};exports[_0xced1('0x95')]=function(_0x150c21,_0x293dd6,_0xf73114){var _0x47d8b9,_0x4283a1;return db[_0xced1('0x3a')][_0xced1('0x33')]({'where':{'id':_0x150c21[_0xced1('0x53')]['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x293dd6,null))[_0xced1('0x28')](function(_0x417abc){if(_0x417abc){_0x4283a1=_0x417abc;return _0x417abc[_0xced1('0x95')](_0x150c21[_0xced1('0x56')][_0xced1('0x90')],_[_0xced1('0x5c')](_0x150c21['body'],[_0xced1('0x90'),'id'])||{})[_0xced1('0x96')](function(_0x5132d9){for(var _0x50f8a0=0x0;_0x50f8a0<_0x150c21['body']['ids'][_0xced1('0x44')];_0x50f8a0+=0x1){socket[_0xced1('0x93')](_0xced1('0x97'),{'UserId':Number(_0x150c21[_0xced1('0x56')][_0xced1('0x90')][_0x50f8a0]),'VoiceQueueId':Number(_0x150c21[_0xced1('0x53')]['id'])});}return _0x5132d9;});}})['then'](function(_0x6bd1d1){_0x47d8b9=_0x6bd1d1||[];if(_0x4283a1){return db[_0xced1('0x80')]['findAll']({'where':{'id':_0x150c21[_0xced1('0x56')][_0xced1('0x90')]},'attributes':['id',_0xced1('0x37'),'online',_0xced1('0x72'),'interface'],'raw':!![]});}})[_0xced1('0x28')](function(_0x5e6bc0){if(!_[_0xced1('0x91')](_0x5e6bc0)){var _0x2b7f18=[];for(var _0x1adebb=0x0;_0x1adebb<_0x5e6bc0[_0xced1('0x44')];_0x1adebb++){if(_0x5e6bc0[_0x1adebb][_0xced1('0x71')]){_0x2b7f18[_0xced1('0x89')](db[_0xced1('0x7c')][_0xced1('0x79')]({'membername':_0x5e6bc0[_0x1adebb]['name'],'UserId':_0x5e6bc0[_0x1adebb]['id'],'queue_name':_0x4283a1[_0xced1('0x37')],'VoiceQueueId':_0x4283a1['id'],'interface':_[_0xced1('0x98')](_0x5e6bc0[_0x1adebb][_0xced1('0x7e')])?util['format'](_0xced1('0x99'),_0x5e6bc0[_0x1adebb][_0xced1('0x37')]):_0x5e6bc0[_0x1adebb]['interface'],'paused':_0x5e6bc0[_0x1adebb]['voicePause']||![],'penalty':_0x150c21['body']['penalty']||0x0}));}}return BPromise[_0xced1('0x8d')](_0x2b7f18);}})['then'](function(){return _0x47d8b9;})[_0xced1('0x28')](respondWithResult(_0x293dd6,null))['catch'](handleError(_0x293dd6,null));};exports[_0xced1('0x92')]=function(_0x12b79e,_0x41bfad,_0x5e1b05){return db[_0xced1('0x3a')][_0xced1('0x33')]({'where':{'id':_0x12b79e['params']['id']}})['then'](handleEntityNotFound(_0x41bfad,null))[_0xced1('0x28')](function(_0x355600){if(_0x355600){return _0x355600[_0xced1('0x92')](_0x12b79e['query'][_0xced1('0x90')])[_0xced1('0x28')](function(){if(_[_0xced1('0x9a')](_0x12b79e[_0xced1('0x3f')]['ids'])){for(var _0x5a7d1b=0x0;_0x5a7d1b<_0x12b79e[_0xced1('0x3f')][_0xced1('0x90')][_0xced1('0x44')];_0x5a7d1b+=0x1){socket[_0xced1('0x93')](_0xced1('0x94'),{'UserId':Number(_0x12b79e[_0xced1('0x3f')][_0xced1('0x90')][_0x5a7d1b]),'VoiceQueueId':Number(_0x12b79e[_0xced1('0x53')]['id'])});}}else{socket[_0xced1('0x93')](_0xced1('0x94'),{'UserId':Number(_0x12b79e[_0xced1('0x3f')]['ids']),'VoiceQueueId':Number(_0x12b79e['params']['id'])});}});}})['then'](function(_0x169c40){return db[_0xced1('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x12b79e[_0xced1('0x53')]['id'],'UserId':_0x12b79e[_0xced1('0x3f')][_0xced1('0x90')]}})[_0xced1('0x28')](function(){return _0x169c40;});})[_0xced1('0x28')](respondWithStatusCode(_0x41bfad,null))[_0xced1('0x51')](handleError(_0x41bfad,null));};exports[_0xced1('0x9b')]=function(_0x219ed1,_0x2827aa,_0x278a37){var _0x1840cb={};var _0x11a83b={};var _0x15535b;var _0x169fc7;return db[_0xced1('0x3a')][_0xced1('0x63')]({'where':{'id':_0x219ed1['params']['id']}})['then'](handleEntityNotFound(_0x2827aa,null))[_0xced1('0x28')](function(_0x5dd8af){if(_0x5dd8af){_0x15535b=_0x5dd8af;_0x11a83b['model']=_['keys'](db[_0xced1('0x80')][_0xced1('0x3b')]);_0x11a83b['query']=_['keys'](_0x219ed1[_0xced1('0x3f')]);_0x11a83b[_0xced1('0x4b')]=_['intersection'](_0x11a83b['model'],_0x11a83b[_0xced1('0x3f')]);_0x1840cb[_0xced1('0x42')]=_['intersection'](_0x11a83b['model'],qs[_0xced1('0x43')](_0x219ed1[_0xced1('0x3f')]['fields']));_0x1840cb[_0xced1('0x42')]=_0x1840cb[_0xced1('0x42')][_0xced1('0x44')]?_0x1840cb[_0xced1('0x42')]:_0x11a83b[_0xced1('0x3e')];_0x1840cb[_0xced1('0x47')]=qs[_0xced1('0x48')](_0x219ed1[_0xced1('0x3f')]['sort']);_0x1840cb[_0xced1('0x49')]=qs[_0xced1('0x4b')](_['pick'](_0x219ed1[_0xced1('0x3f')],_0x11a83b[_0xced1('0x4b')]));if(_0x219ed1['query'][_0xced1('0x2f')]){_0x1840cb[_0xced1('0x49')]=_['merge'](_0x1840cb['where'],{'$or':_[_0xced1('0x30')](_0x1840cb['attributes'],function(_0x4da39e){var _0x7cf1e1={};_0x7cf1e1[_0x4da39e]={'$like':'%'+_0x219ed1[_0xced1('0x3f')][_0xced1('0x2f')]+'%'};return _0x7cf1e1;})});}_0x1840cb=_[_0xced1('0x4c')]({},_0x1840cb,_0x219ed1['options']);return _0x15535b[_0xced1('0x9b')](_0x1840cb);}})['then'](function(_0x39decb){if(_0x39decb){_0x169fc7=_0x39decb['length'];if(!_0x219ed1['query'][_0xced1('0x45')]('nolimit')){_0x1840cb['limit']=qs[_0xced1('0x23')](_0x219ed1[_0xced1('0x3f')][_0xced1('0x23')]);_0x1840cb[_0xced1('0x21')]=qs[_0xced1('0x21')](_0x219ed1[_0xced1('0x3f')]['offset']);}return _0x15535b[_0xced1('0x9b')](_0x1840cb);}})[_0xced1('0x28')](function(_0x326648){if(_0x326648){return _0x326648?{'count':_0x169fc7,'rows':_0x326648}:null;}})[_0xced1('0x28')](respondWithResult(_0x2827aa,null))[_0xced1('0x51')](handleError(_0x2827aa,null));};exports[_0xced1('0x9c')]=function(_0x415093,_0x1b2c9c,_0x33838b){var _0x1e3e9a={};var _0x2d51af={};var _0x24247a;var _0x48d9b9;return db[_0xced1('0x3a')][_0xced1('0x63')]({'where':{'id':_0x415093['params']['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x1b2c9c,null))[_0xced1('0x28')](function(_0x1878d0){if(_0x1878d0){_0x24247a=_0x1878d0;_0x2d51af['model']=_['keys'](db[_0xced1('0x7c')][_0xced1('0x3b')]);_0x2d51af['query']=_['keys'](_0x415093[_0xced1('0x3f')]);_0x2d51af[_0xced1('0x4b')]=_[_0xced1('0x41')](_0x2d51af['model'],_0x2d51af[_0xced1('0x3f')]);_0x1e3e9a[_0xced1('0x42')]=_[_0xced1('0x41')](_0x2d51af[_0xced1('0x3e')],qs[_0xced1('0x43')](_0x415093[_0xced1('0x3f')]['fields']));_0x1e3e9a[_0xced1('0x42')]=_0x1e3e9a[_0xced1('0x42')][_0xced1('0x44')]?_0x1e3e9a[_0xced1('0x42')]:_0x2d51af[_0xced1('0x3e')];_0x1e3e9a['order']=qs[_0xced1('0x48')](_0x415093['query'][_0xced1('0x48')]);_0x1e3e9a[_0xced1('0x49')]=qs[_0xced1('0x4b')](_['pick'](_0x415093['query'],_0x2d51af[_0xced1('0x4b')]));if(_0x415093[_0xced1('0x3f')][_0xced1('0x2f')]){_0x1e3e9a[_0xced1('0x49')]=_[_0xced1('0x4c')](_0x1e3e9a['where'],{'$or':_['map'](_0x1e3e9a['attributes'],function(_0x11d362){var _0x2e841a={};_0x2e841a[_0x11d362]={'$like':'%'+_0x415093[_0xced1('0x3f')][_0xced1('0x2f')]+'%'};return _0x2e841a;})});}_0x1e3e9a=_['merge']({},_0x1e3e9a,_0x415093['options']);return _0x24247a['getMembers'](_0x1e3e9a);}})[_0xced1('0x28')](function(_0x2a93f9){if(_0x2a93f9){_0x48d9b9=_0x2a93f9[_0xced1('0x44')];if(!_0x415093['query']['hasOwnProperty']('nolimit')){_0x1e3e9a[_0xced1('0x23')]=qs[_0xced1('0x23')](_0x415093['query'][_0xced1('0x23')]);_0x1e3e9a[_0xced1('0x21')]=qs[_0xced1('0x21')](_0x415093['query'][_0xced1('0x21')]);}return _0x24247a[_0xced1('0x9c')](_0x1e3e9a);}})['then'](function(_0x260753){return _0x260753?{'count':_0x48d9b9,'rows':_0x260753}:null;})[_0xced1('0x28')](respondWithResult(_0x1b2c9c,null))[_0xced1('0x51')](handleError(_0x1b2c9c,null));};exports['getLists']=function(_0x5c25fd,_0x1e901d,_0x397a9c){var _0x4cd36a={};var _0x5291c0={};var _0x48190f;var _0x3dee52;return db[_0xced1('0x3a')][_0xced1('0x63')]({'where':{'id':_0x5c25fd[_0xced1('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e901d,null))[_0xced1('0x28')](function(_0x55c0e3){if(_0x55c0e3){_0x48190f=_0x55c0e3;_0x5291c0[_0xced1('0x3e')]=_[_0xced1('0x40')](db[_0xced1('0x9d')][_0xced1('0x3b')]);_0x5291c0[_0xced1('0x3f')]=_[_0xced1('0x40')](_0x5c25fd[_0xced1('0x3f')]);_0x5291c0[_0xced1('0x4b')]=_['intersection'](_0x5291c0[_0xced1('0x3e')],_0x5291c0['query']);_0x4cd36a[_0xced1('0x42')]=_[_0xced1('0x41')](_0x5291c0[_0xced1('0x3e')],qs[_0xced1('0x43')](_0x5c25fd['query'][_0xced1('0x43')]));_0x4cd36a['attributes']=_0x4cd36a['attributes'][_0xced1('0x44')]?_0x4cd36a[_0xced1('0x42')]:_0x5291c0[_0xced1('0x3e')];_0x4cd36a[_0xced1('0x47')]=qs['sort'](_0x5c25fd[_0xced1('0x3f')][_0xced1('0x48')]);_0x4cd36a['where']=qs[_0xced1('0x4b')](_['pick'](_0x5c25fd[_0xced1('0x3f')],_0x5291c0[_0xced1('0x4b')]));if(_0x5c25fd[_0xced1('0x3f')][_0xced1('0x2f')]){_0x4cd36a['where']=_[_0xced1('0x4c')](_0x4cd36a[_0xced1('0x49')],{'$or':_[_0xced1('0x30')](_0x4cd36a[_0xced1('0x42')],function(_0x262102){var _0x21b0d7={};_0x21b0d7[_0x262102]={'$like':'%'+_0x5c25fd[_0xced1('0x3f')][_0xced1('0x2f')]+'%'};return _0x21b0d7;})});}_0x4cd36a=_[_0xced1('0x4c')]({},_0x4cd36a,_0x5c25fd[_0xced1('0x4d')]);return _0x48190f['getLists'](_0x4cd36a);}})[_0xced1('0x28')](function(_0x25a19d){if(_0x25a19d){_0x3dee52=_0x25a19d[_0xced1('0x44')];if(!_0x5c25fd[_0xced1('0x3f')][_0xced1('0x45')](_0xced1('0x46'))){_0x4cd36a['limit']=qs[_0xced1('0x23')](_0x5c25fd['query'][_0xced1('0x23')]);_0x4cd36a[_0xced1('0x21')]=qs[_0xced1('0x21')](_0x5c25fd['query']['offset']);}return _0x48190f[_0xced1('0x9e')](_0x4cd36a);}})[_0xced1('0x28')](function(_0x305867){if(_0x305867){return _0x305867?{'count':_0x3dee52,'rows':_0x305867}:null;}})[_0xced1('0x28')](respondWithResult(_0x1e901d,null))[_0xced1('0x51')](handleError(_0x1e901d,null));};exports[_0xced1('0x9f')]=function(_0xf8667,_0x12fffa,_0x52e976){var _0x2cecfc=moment()[_0xced1('0x7d')](_0xced1('0xa0'));var _0x2992b1,_0x3860bd;return db[_0xced1('0x3a')][_0xced1('0x33')]({'where':{'id':_0xf8667[_0xced1('0x53')]['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x12fffa,null))[_0xced1('0x28')](function(_0x8c6ccb){if(_0x8c6ccb){_0x3860bd=_0x8c6ccb;return _0x8c6ccb[_0xced1('0x9f')](_0xf8667[_0xced1('0x56')][_0xced1('0x90')],_['omit'](_0xf8667[_0xced1('0x56')],[_0xced1('0x90'),'id'])||{});}return null;})[_0xced1('0x96')](function(_0x233103){var _0x14a284;_0x2992b1=_0x233103||[];var _0x36be1e=[];if(_0x233103){for(var _0x285c93=0x0;_0x285c93<_0x233103[_0xced1('0x44')];_0x285c93+=0x1){var _0x1dc6f6=_0x233103[_0x285c93][_0xced1('0x2a')]({'plain':!![]});_0x3860bd[_0xced1('0xa1')]=_0xf8667['body'][_0xced1('0xa1')]?_0xf8667[_0xced1('0x56')]['dialCheckDuplicateType']:_0x3860bd[_0xced1('0xa1')];switch(_0x3860bd['dialCheckDuplicateType']){case _0xced1('0xa2'):_0x14a284=squel['insert']()[_0xced1('0xa3')](_0xced1('0xa4'))['fromQuery']([_0xced1('0xa5'),_0xced1('0xa6'),'ContactId',_0xced1('0xa7'),'VoiceQueueId',_0xced1('0x5d'),'updatedAt'],squel[_0xced1('0x81')]()[_0xced1('0x82')](_0xced1('0xa5'),'phone')[_0xced1('0x82')]('\x27'+_0x2cecfc+'\x27',_0xced1('0xa6'))[_0xced1('0x82')]('id',_0xced1('0xa8'))['field'](_0x1dc6f6[_0xced1('0xa9')][_0xced1('0x8a')](),_0xced1('0xa7'))[_0xced1('0x82')](_0xf8667['params']['id'][_0xced1('0x8a')](),_0xced1('0x67'))[_0xced1('0x82')]('\x27'+_0x2cecfc+'\x27',_0xced1('0x5d'))['field']('\x27'+_0x2cecfc+'\x27',_0xced1('0x5e'))[_0xced1('0x83')]('cm_contacts')[_0xced1('0x49')](_0xced1('0xaa'))['where']('ListId\x20=\x20?',_0x1dc6f6[_0xced1('0xa9')][_0xced1('0x8a')]())[_0xced1('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0xced1('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xced1('0x81')]()['field'](_0xced1('0xab'))[_0xced1('0x83')](_0xced1('0xac'))[_0xced1('0x49')](_0xced1('0x88'),_0xf8667[_0xced1('0x53')]['id'][_0xced1('0x8a')]()))[_0xced1('0x49')](_0xced1('0xad'),squel[_0xced1('0x81')]()[_0xced1('0x82')](_0xced1('0xae'))[_0xced1('0x83')]('cm_hopper')[_0xced1('0x49')](_0xced1('0x88'),_0xf8667['params']['id'][_0xced1('0x8a')]())))[_0xced1('0x8a')]();break;case _0xced1('0xaf'):_0x14a284=squel['insert']()['into'](_0xced1('0xa4'))[_0xced1('0xb0')](['phone',_0xced1('0xa6'),_0xced1('0xa8'),'ListId',_0xced1('0x67'),_0xced1('0x5d'),_0xced1('0x5e')],squel[_0xced1('0x81')]()[_0xced1('0x82')](_0xced1('0xa5'),_0xced1('0xa5'))[_0xced1('0x82')]('\x27'+_0x2cecfc+'\x27',_0xced1('0xa6'))['field']('id',_0xced1('0xa8'))[_0xced1('0x82')](_0x1dc6f6['CmListId']['toString'](),_0xced1('0xa7'))[_0xced1('0x82')](_0xf8667[_0xced1('0x53')]['id'][_0xced1('0x8a')](),_0xced1('0x67'))['field']('\x27'+_0x2cecfc+'\x27',_0xced1('0x5d'))['field']('\x27'+_0x2cecfc+'\x27','updatedAt')[_0xced1('0x83')](_0xced1('0xb1'))['where'](_0xced1('0xaa'))[_0xced1('0x49')]('ListId\x20=\x20?',_0x1dc6f6[_0xced1('0xa9')][_0xced1('0x8a')]())['where'](_0xced1('0xb2'))[_0xced1('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xced1('0x81')]()[_0xced1('0x82')](_0xced1('0xae'))[_0xced1('0x83')](_0xced1('0xa4'))[_0xced1('0x49')](_0xced1('0x88'),_0xf8667[_0xced1('0x53')]['id']['toString']())))[_0xced1('0x8a')]();break;default:_0x14a284=squel['insert']()[_0xced1('0xa3')](_0xced1('0xa4'))[_0xced1('0xb0')]([_0xced1('0xa5'),_0xced1('0xa6'),'ContactId',_0xced1('0xa7'),_0xced1('0x67'),_0xced1('0x5d'),_0xced1('0x5e')],squel[_0xced1('0x81')]()[_0xced1('0x82')](_0xced1('0xa5'),_0xced1('0xa5'))[_0xced1('0x82')]('\x27'+_0x2cecfc+'\x27',_0xced1('0xa6'))[_0xced1('0x82')]('id',_0xced1('0xa8'))['field'](_0x1dc6f6[_0xced1('0xa9')][_0xced1('0x8a')](),_0xced1('0xa7'))[_0xced1('0x82')](_0xf8667['params']['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x2cecfc+'\x27','createdAt')[_0xced1('0x82')]('\x27'+_0x2cecfc+'\x27',_0xced1('0x5e'))[_0xced1('0x83')](_0xced1('0xb1'))[_0xced1('0x49')](_0xced1('0xaa'))[_0xced1('0x49')]('ListId\x20=\x20?',_0x1dc6f6['CmListId'][_0xced1('0x8a')]())[_0xced1('0x49')](_0xced1('0xb2')))[_0xced1('0x8a')]();}_0x36be1e[_0xced1('0x89')](db[_0xced1('0x76')]['query'](_0x14a284));}return BPromise[_0xced1('0x8d')](_0x36be1e);}})[_0xced1('0x28')](function(){var _0x1b0d93=[];var _0x5d1b14=squel[_0xced1('0xb3')]()[_0xced1('0xa3')](_0xced1('0xb4'))['fromQuery']([_0xced1('0xb5'),_0xced1('0xa5'),_0xced1('0xb6'),_0xced1('0x5d'),_0xced1('0x5e')],squel[_0xced1('0x81')]()[_0xced1('0x82')](_0xced1('0xb7'))[_0xced1('0x82')](_0xced1('0xb8'))[_0xced1('0x82')](_0xced1('0xb9'))['field']('\x27'+_0x2cecfc+'\x27','createdAt')[_0xced1('0x82')]('\x27'+_0x2cecfc+'\x27',_0xced1('0x5e'))[_0xced1('0x83')](_0xced1('0xba'),'ci')[_0xced1('0x85')](_0xced1('0xa4'),'h','h.ContactId=ci.CmContactId')[_0xced1('0x49')]('h.scheduledat=?',_0x2cecfc)[_0xced1('0x49')](_0xced1('0xbb'),_0xced1('0xbc')))[_0xced1('0x8a')]();_0x1b0d93[_0xced1('0x89')](db[_0xced1('0x76')][_0xced1('0x3f')](_0x5d1b14));return BPromise[_0xced1('0x8d')](_0x1b0d93);})['then'](function(){return _0x2992b1;})[_0xced1('0x28')](respondWithResult(_0x12fffa,null))[_0xced1('0x51')](handleError(_0x12fffa,null));};exports[_0xced1('0xbd')]=function(_0x204a6d,_0x51b9cc,_0x378b99){return db['VoiceQueue'][_0xced1('0x33')]({'where':{'id':_0x204a6d[_0xced1('0x53')]['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x51b9cc,null))[_0xced1('0x28')](function(_0x559d4d){if(_0x559d4d){return _0x559d4d[_0xced1('0xbd')](_0x204a6d[_0xced1('0x3f')][_0xced1('0x90')]);}})[_0xced1('0x28')](function(_0x421f76){if(_0x421f76){return db[_0xced1('0x64')][_0xced1('0x29')]({'where':{'ListId':_0x204a6d[_0xced1('0x3f')][_0xced1('0x90')],'VoiceQueueId':_0x204a6d[_0xced1('0x53')]['id']}})['then'](function(){return _0x421f76;});}})['then'](respondWithStatusCode(_0x51b9cc,null))[_0xced1('0x51')](handleError(_0x51b9cc,null));};exports[_0xced1('0xbe')]=function(_0x50bd2c,_0x308d35,_0x2ebe9){var _0x42d398={};var _0x30e97e={};var _0x40cbaa;var _0x4eca34;return db[_0xced1('0x3a')][_0xced1('0x63')]({'where':{'id':_0x50bd2c[_0xced1('0x53')]['id']}})['then'](handleEntityNotFound(_0x308d35,null))[_0xced1('0x28')](function(_0x4cb726){if(_0x4cb726){_0x40cbaa=_0x4cb726;_0x30e97e[_0xced1('0x3e')]=_[_0xced1('0x40')](db['CmList'][_0xced1('0x3b')]);_0x30e97e[_0xced1('0x3f')]=_[_0xced1('0x40')](_0x50bd2c[_0xced1('0x3f')]);_0x30e97e[_0xced1('0x4b')]=_[_0xced1('0x41')](_0x30e97e['model'],_0x30e97e[_0xced1('0x3f')]);_0x42d398[_0xced1('0x42')]=_[_0xced1('0x41')](_0x30e97e[_0xced1('0x3e')],qs[_0xced1('0x43')](_0x50bd2c['query'][_0xced1('0x43')]));_0x42d398[_0xced1('0x42')]=_0x42d398['attributes'][_0xced1('0x44')]?_0x42d398['attributes']:_0x30e97e['model'];_0x42d398[_0xced1('0x47')]=qs['sort'](_0x50bd2c[_0xced1('0x3f')][_0xced1('0x48')]);_0x42d398[_0xced1('0x49')]=qs[_0xced1('0x4b')](_[_0xced1('0x4a')](_0x50bd2c['query'],_0x30e97e[_0xced1('0x4b')]));if(_0x50bd2c[_0xced1('0x3f')][_0xced1('0x2f')]){_0x42d398[_0xced1('0x49')]=_[_0xced1('0x4c')](_0x42d398[_0xced1('0x49')],{'$or':_['map'](_0x42d398[_0xced1('0x42')],function(_0x3263cd){var _0x1ccf17={};_0x1ccf17[_0x3263cd]={'$like':'%'+_0x50bd2c[_0xced1('0x3f')]['filter']+'%'};return _0x1ccf17;})});}_0x42d398=_[_0xced1('0x4c')]({},_0x42d398,_0x50bd2c[_0xced1('0x4d')]);return _0x40cbaa[_0xced1('0xbe')](_0x42d398);}})[_0xced1('0x28')](function(_0x6afa2e){if(_0x6afa2e){_0x4eca34=_0x6afa2e[_0xced1('0x44')];if(!_0x50bd2c['query'][_0xced1('0x45')](_0xced1('0x46'))){_0x42d398[_0xced1('0x23')]=qs['limit'](_0x50bd2c[_0xced1('0x3f')][_0xced1('0x23')]);_0x42d398[_0xced1('0x21')]=qs['offset'](_0x50bd2c[_0xced1('0x3f')][_0xced1('0x21')]);}return _0x40cbaa['getBlackLists'](_0x42d398);}})['then'](function(_0x599d26){if(_0x599d26){return _0x599d26?{'count':_0x4eca34,'rows':_0x599d26}:null;}})[_0xced1('0x28')](respondWithResult(_0x308d35,null))[_0xced1('0x51')](handleError(_0x308d35,null));};exports[_0xced1('0xbf')]=function(_0x51e047,_0x460999,_0x50096b){var _0x29e88f,_0x350a2b;return db[_0xced1('0x3a')]['find']({'where':{'id':_0x51e047[_0xced1('0x53')]['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x460999,null))[_0xced1('0x28')](function(_0x112ab0){if(_0x112ab0){_0x350a2b=_0x112ab0;return _0x112ab0['addBlackLists'](_0x51e047[_0xced1('0x56')][_0xced1('0x90')],_[_0xced1('0x5c')](_0x51e047[_0xced1('0x56')],[_0xced1('0x90'),'id'])||{});}return null;})['spread'](function(_0x428355){var _0x1063e7;_0x29e88f=_0x428355||[];var _0x536821=[];if(_0x428355){for(var _0x4ac1b6=0x0;_0x4ac1b6<_0x428355[_0xced1('0x44')];_0x4ac1b6+=0x1){var _0xa46d2a=_0x428355[_0x4ac1b6][_0xced1('0x2a')]({'plain':!![]});_0x1063e7=squel['insert']()[_0xced1('0xa3')](_0xced1('0xc0'))[_0xced1('0xb0')]([_0xced1('0xa5'),'ContactId',_0xced1('0xa7'),_0xced1('0x67'),'createdAt','updatedAt'],squel[_0xced1('0x81')]()['field'](_0xced1('0xa5'),_0xced1('0xa5'))[_0xced1('0x82')]('id',_0xced1('0xa8'))[_0xced1('0x82')](_0xa46d2a[_0xced1('0xa9')][_0xced1('0x8a')](),'ListId')['field'](_0x51e047['params']['id']['toString'](),_0xced1('0x67'))['field'](_0xced1('0xc1'),_0xced1('0x5d'))['field'](_0xced1('0xc1'),_0xced1('0x5e'))[_0xced1('0x83')](_0xced1('0xb1'))[_0xced1('0x49')](_0xced1('0xaa'))[_0xced1('0x49')](_0xced1('0xc2'),_0xa46d2a[_0xced1('0xa9')][_0xced1('0x8a')]())[_0xced1('0x49')](_0xced1('0xb2')))[_0xced1('0x8a')]();_0x536821[_0xced1('0x89')](db['sequelize'][_0xced1('0x3f')](_0x1063e7));}return BPromise[_0xced1('0x8d')](_0x536821);}})[_0xced1('0x28')](function(){return _0x29e88f;})[_0xced1('0x28')](respondWithResult(_0x460999,null))[_0xced1('0x51')](handleError(_0x460999,null));};exports['removeBlackLists']=function(_0x32b4c1,_0x3b438a,_0xa0a6b7){return db[_0xced1('0x3a')][_0xced1('0x33')]({'where':{'id':_0x32b4c1['params']['id']}})[_0xced1('0x28')](handleEntityNotFound(_0x3b438a,null))[_0xced1('0x28')](function(_0x217188){if(_0x217188){return _0x217188[_0xced1('0xc3')](_0x32b4c1['query']['ids']);}})['then'](function(_0x1d41f6){if(_0x1d41f6){return db[_0xced1('0x6b')][_0xced1('0x29')]({'where':{'ListId':_0x32b4c1[_0xced1('0x3f')][_0xced1('0x90')],'VoiceQueueId':_0x32b4c1[_0xced1('0x53')]['id']}})[_0xced1('0x28')](function(){return _0x1d41f6;});}})[_0xced1('0x28')](respondWithStatusCode(_0x3b438a,null))[_0xced1('0x51')](handleError(_0x3b438a,null));}; \ No newline at end of file +var _0x7f59=['body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','rawAttributes','omit','createdAt','updatedAt','inbound','UserProfileSection','update','findOne','CmHopper','pick','map','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','flatMap','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','isNil','format','forEach','emit','userVoiceQueue:save','ids','field','tq.TeamId','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','sequelize','SELECT','every','includes','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','online','SIP/%s','userVoiceQueue:remove','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','phone','ContactId','select','scheduledAt','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','type','find','name','UserProfileResource','error','stack','index','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','keys','create'];(function(_0x46a1ff,_0x4dfa80){var _0x2847b8=function(_0x590199){while(--_0x590199){_0x46a1ff['push'](_0x46a1ff['shift']());}};_0x2847b8(++_0x4dfa80);}(_0x7f59,0x12e));var _0x97f5=function(_0x55ef0c,_0x2c2bfc){_0x55ef0c=_0x55ef0c-0x0;var _0x1cbe60=_0x7f59[_0x55ef0c];return _0x1cbe60;};'use strict';var emlformat=require(_0x97f5('0x0'));var rimraf=require(_0x97f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97f5('0x2'));var rp=require(_0x97f5('0x3'));var moment=require(_0x97f5('0x4'));var BPromise=require(_0x97f5('0x5'));var Mustache=require(_0x97f5('0x6'));var util=require(_0x97f5('0x7'));var path=require(_0x97f5('0x8'));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(_0x97f5('0x9'));var squel=require(_0x97f5('0xa'));var crypto=require(_0x97f5('0xb'));var jsforce=require(_0x97f5('0xc'));var deskjs=require(_0x97f5('0xd'));var toCsv=require(_0x97f5('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x97f5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x97f5('0x10'));var hardwareService=require(_0x97f5('0x11'));var logger=require('../../config/logger')(_0x97f5('0x12'));var utils=require(_0x97f5('0x13'));var config=require(_0x97f5('0x14'));var licenseUtil=require(_0x97f5('0x15'));var db=require('../../mysqldb')['db'];config[_0x97f5('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x97f5('0x17'))(new Redis(config['redis']));require(_0x97f5('0x18'))['register'](socket);function respondWithStatusCode(_0x40d970,_0x11ffb4){_0x11ffb4=_0x11ffb4||0xcc;return function(_0x2e8ac7){if(_0x2e8ac7){return _0x40d970[_0x97f5('0x19')](_0x11ffb4);}return _0x40d970[_0x97f5('0x1a')](_0x11ffb4)[_0x97f5('0x1b')]();};}function respondWithResult(_0x4324e7,_0x2ba6e2){_0x2ba6e2=_0x2ba6e2||0xc8;return function(_0x5d8c2f){if(_0x5d8c2f){return _0x4324e7['status'](_0x2ba6e2)[_0x97f5('0x1c')](_0x5d8c2f);}};}function respondWithFilteredResult(_0xb5cd54,_0x5426cd){return function(_0x197be7){if(_0x197be7){var _0x441231=typeof _0x5426cd[_0x97f5('0x1d')]===_0x97f5('0x1e')&&typeof _0x5426cd[_0x97f5('0x1f')]==='undefined';var _0x2b4735=_0x197be7[_0x97f5('0x20')];var _0x4271e5=_0x441231?0x0:_0x5426cd['offset'];var _0x5cc185=_0x441231?_0x197be7[_0x97f5('0x20')]:_0x5426cd['offset']+_0x5426cd[_0x97f5('0x1f')];var _0x266703;if(_0x5cc185>=_0x2b4735){_0x5cc185=_0x2b4735;_0x266703=0xc8;}else{_0x266703=0xce;}_0xb5cd54[_0x97f5('0x1a')](_0x266703);return _0xb5cd54[_0x97f5('0x21')](_0x97f5('0x22'),_0x4271e5+'-'+_0x5cc185+'/'+_0x2b4735)[_0x97f5('0x1c')](_0x197be7);}return null;};}function patchUpdates(_0xf7e42b){return function(_0x5bfc34){try{jsonpatch[_0x97f5('0x23')](_0x5bfc34,_0xf7e42b,!![]);}catch(_0x55697d){return BPromise[_0x97f5('0x24')](_0x55697d);}return _0x5bfc34['save']();};}function saveUpdates(_0x297627,_0x20a11b){return function(_0x2f85e6){if(_0x2f85e6){return _0x2f85e6['update'](_0x297627)[_0x97f5('0x25')](function(_0xefef9a){return _0xefef9a;});}return null;};}function removeEntity(_0x1943c9,_0x1eafce){return function(_0x34225b){if(_0x34225b){return _0x34225b[_0x97f5('0x26')]()[_0x97f5('0x25')](function(){var _0x284265=_0x34225b['get']({'plain':!![]});var _0x4b54dd=[{'name':_0x97f5('0x27'),'value':'inbound','ignore':![]},{'name':_0x97f5('0x28'),'value':_0x97f5('0x29'),'ignore':![]}];var _0x1ec5be=_(_0x4b54dd)[_0x97f5('0x2a')](_0x97f5('0x2b'))['map']('value')[_0x97f5('0x2c')]();if(_['includes'](_0x1ec5be,_0x284265[_0x97f5('0x2d')])){return;}var _0x121b26=_[_0x97f5('0x2e')](_0x4b54dd,[_0x97f5('0x2c'),_0x284265[_0x97f5('0x2d')]])[_0x97f5('0x2f')];return db[_0x97f5('0x30')][_0x97f5('0x26')]({'where':{'type':_0x121b26,'resourceId':_0x284265['id']}})[_0x97f5('0x25')](function(){return _0x34225b;});})[_0x97f5('0x25')](function(){_0x1943c9[_0x97f5('0x1a')](0xcc)[_0x97f5('0x1b')]();});}};}function handleEntityNotFound(_0x2842f9,_0x425dfc){return function(_0x4e604a){if(!_0x4e604a){_0x2842f9[_0x97f5('0x19')](0x194);}return _0x4e604a;};}function handleError(_0x8034c9,_0x570b46){_0x570b46=_0x570b46||0x1f4;return function(_0x589e3a){logger[_0x97f5('0x31')](_0x589e3a[_0x97f5('0x32')]);if(_0x589e3a[_0x97f5('0x2f')]){delete _0x589e3a[_0x97f5('0x2f')];}_0x8034c9['status'](_0x570b46)['send'](_0x589e3a);};}exports[_0x97f5('0x33')]=function(_0x38be65,_0x4c5f87){var _0x444a2c={},_0x482e3a={},_0xecb036={'count':0x0,'rows':[]};var _0xf4ab6d=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x46775b){return{'name':_0x46775b[_0x97f5('0x34')],'type':_0x46775b[_0x97f5('0x2d')][_0x97f5('0x35')]};});_0x482e3a['model']=_['map'](_0xf4ab6d,_0x97f5('0x2f'));_0x482e3a[_0x97f5('0x36')]=_['keys'](_0x38be65[_0x97f5('0x36')]);_0x482e3a[_0x97f5('0x37')]=_[_0x97f5('0x38')](_0x482e3a[_0x97f5('0x39')],_0x482e3a[_0x97f5('0x36')]);_0x444a2c[_0x97f5('0x3a')]=_[_0x97f5('0x38')](_0x482e3a['model'],qs[_0x97f5('0x3b')](_0x38be65[_0x97f5('0x36')][_0x97f5('0x3b')]));_0x444a2c[_0x97f5('0x3a')]=_0x444a2c[_0x97f5('0x3a')][_0x97f5('0x3c')]?_0x444a2c[_0x97f5('0x3a')]:_0x482e3a[_0x97f5('0x39')];if(!_0x38be65[_0x97f5('0x36')][_0x97f5('0x3d')](_0x97f5('0x3e'))){_0x444a2c[_0x97f5('0x1f')]=qs[_0x97f5('0x1f')](_0x38be65['query']['limit']);_0x444a2c[_0x97f5('0x1d')]=qs[_0x97f5('0x1d')](_0x38be65[_0x97f5('0x36')][_0x97f5('0x1d')]);}_0x444a2c[_0x97f5('0x3f')]=qs[_0x97f5('0x40')](_0x38be65[_0x97f5('0x36')]['sort']);_0x444a2c[_0x97f5('0x41')]=qs[_0x97f5('0x37')](_['pick'](_0x38be65[_0x97f5('0x36')],_0x482e3a['filters']),_0xf4ab6d);if(_0x38be65[_0x97f5('0x36')][_0x97f5('0x2a')]){_0x444a2c[_0x97f5('0x41')]=_[_0x97f5('0x42')](_0x444a2c['where'],{'$or':_['map'](_0xf4ab6d,function(_0x2b63e8){if(_0x2b63e8[_0x97f5('0x2d')]!=='VIRTUAL'){var _0x21ee5e={};_0x21ee5e[_0x2b63e8[_0x97f5('0x2f')]]={'$like':'%'+_0x38be65[_0x97f5('0x36')]['filter']+'%'};return _0x21ee5e;}})});}_0x444a2c=_[_0x97f5('0x42')]({},_0x444a2c,_0x38be65[_0x97f5('0x43')]);var _0x4060bb={'where':_0x444a2c[_0x97f5('0x41')]};return db[_0x97f5('0x44')][_0x97f5('0x20')](_0x4060bb)[_0x97f5('0x25')](function(_0x521c7c){_0xecb036[_0x97f5('0x20')]=_0x521c7c;if(_0x38be65[_0x97f5('0x36')][_0x97f5('0x45')]){_0x444a2c[_0x97f5('0x46')]=[{'all':!![]}];}return db[_0x97f5('0x44')][_0x97f5('0x47')](_0x444a2c);})[_0x97f5('0x25')](function(_0x16cfaf){_0xecb036[_0x97f5('0x48')]=_0x16cfaf;return _0xecb036;})[_0x97f5('0x25')](respondWithFilteredResult(_0x4c5f87,_0x444a2c))[_0x97f5('0x49')](handleError(_0x4c5f87,null));};exports[_0x97f5('0x4a')]=function(_0x388280,_0x20fdc6){var _0x54178c={'raw':![],'where':{'id':_0x388280[_0x97f5('0x4b')]['id']}},_0x652ba8={};_0x652ba8['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0x652ba8[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x388280[_0x97f5('0x36')]);_0x652ba8['filters']=_[_0x97f5('0x38')](_0x652ba8[_0x97f5('0x39')],_0x652ba8[_0x97f5('0x36')]);_0x54178c[_0x97f5('0x3a')]=_[_0x97f5('0x38')](_0x652ba8['model'],qs['fields'](_0x388280[_0x97f5('0x36')][_0x97f5('0x3b')]));_0x54178c[_0x97f5('0x3a')]=_0x54178c['attributes']['length']?_0x54178c[_0x97f5('0x3a')]:_0x652ba8[_0x97f5('0x39')];if(_0x388280[_0x97f5('0x36')]['includeAll']){_0x54178c['include']=[{'all':!![]}];}_0x54178c=_['merge']({},_0x54178c,_0x388280[_0x97f5('0x43')]);return db[_0x97f5('0x44')][_0x97f5('0x2e')](_0x54178c)['then'](handleEntityNotFound(_0x20fdc6,null))[_0x97f5('0x25')](respondWithResult(_0x20fdc6,null))[_0x97f5('0x49')](handleError(_0x20fdc6,null));};exports[_0x97f5('0x4d')]=function(_0x257caa,_0x115d8a){return db[_0x97f5('0x44')][_0x97f5('0x4d')](_0x257caa[_0x97f5('0x4e')],{})[_0x97f5('0x25')](function(_0x36891f){var _0x207186=_0x257caa[_0x97f5('0x4f')][_0x97f5('0x50')]({'plain':!![]});if(!_0x207186)throw new Error(_0x97f5('0x51'));if(_0x207186[_0x97f5('0x52')]===_0x97f5('0x4f')){var _0x5023c4=_0x36891f[_0x97f5('0x50')]({'plain':!![]});var _0x409731=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x97f5('0x28'),'value':'outbound'}];var _0x1d1e9f=_[_0x97f5('0x2e')](_0x409731,['value',_0x5023c4[_0x97f5('0x2d')]])['name'];return db['UserProfileSection'][_0x97f5('0x2e')]({'where':{'name':_0x1d1e9f,'userProfileId':_0x207186[_0x97f5('0x53')]},'raw':!![]})[_0x97f5('0x25')](function(_0x3be428){if(_0x3be428&&_0x3be428[_0x97f5('0x54')]===0x0){return db[_0x97f5('0x30')]['create']({'name':_0x5023c4[_0x97f5('0x2f')],'resourceId':_0x5023c4['id'],'type':_0x3be428[_0x97f5('0x2f')],'sectionId':_0x3be428['id']},{})[_0x97f5('0x25')](function(){return _0x36891f;});}else{return _0x36891f;}})[_0x97f5('0x49')](function(_0x29e647){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29e647);throw _0x29e647;});}return _0x36891f;})[_0x97f5('0x25')](respondWithResult(_0x115d8a,0xc9))['catch'](handleError(_0x115d8a,null));};exports[_0x97f5('0x55')]=function(_0x749669,_0x40b757){var _0x488a9f={'where':{'id':_0x749669[_0x97f5('0x4b')]['id']}},_0x5817d3={};_0x5817d3[_0x97f5('0x39')]=_[_0x97f5('0x4c')](db[_0x97f5('0x44')][_0x97f5('0x56')]);_0x488a9f['attributes']=_[_0x97f5('0x38')](_0x5817d3[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x749669[_0x97f5('0x36')][_0x97f5('0x3b')]));_0x488a9f[_0x97f5('0x3a')]=_0x488a9f[_0x97f5('0x3a')][_0x97f5('0x3c')]?_0x488a9f['attributes']:_0x5817d3['model'];if(_0x749669['query'][_0x97f5('0x45')]){_0x488a9f[_0x97f5('0x46')]=[{'all':!![]}];}_0x488a9f=_[_0x97f5('0x42')]({},_0x488a9f,_0x749669['options']);return db['VoiceQueue'][_0x97f5('0x2e')](_0x488a9f)[_0x97f5('0x25')](handleEntityNotFound(_0x40b757,null))[_0x97f5('0x25')](function(_0x2b78ca){if(_0x2b78ca){var _0x1169a3=_0x2b78ca['get']({'plain':!![]});_0x1169a3=qs[_0x97f5('0x57')](_0x1169a3,['id',_0x97f5('0x58'),_0x97f5('0x59')]);_0x749669[_0x97f5('0x4e')]=_['omit'](_0x749669[_0x97f5('0x4e')],['id',_0x97f5('0x58'),_0x97f5('0x59')]);return db['VoiceQueue'][_0x97f5('0x4d')](_[_0x97f5('0x42')](_0x1169a3,_0x749669[_0x97f5('0x4e')]),{'include':_0x749669[_0x97f5('0x36')][_0x97f5('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x16a77f){var _0x15d4bd=_0x749669[_0x97f5('0x4f')][_0x97f5('0x50')]({'plain':!![]});if(!_0x15d4bd)throw new Error(_0x97f5('0x51'));if(_0x15d4bd[_0x97f5('0x52')]===_0x97f5('0x4f')){var _0x4ecd39=_0x16a77f[_0x97f5('0x50')]({'plain':!![]});var _0x3674f9=[{'name':_0x97f5('0x27'),'value':_0x97f5('0x5a')},{'name':_0x97f5('0x28'),'value':_0x97f5('0x29')}];var _0x4fccb7=_[_0x97f5('0x2e')](_0x3674f9,['value',_0x4ecd39['type']])[_0x97f5('0x2f')];return db[_0x97f5('0x5b')]['find']({'where':{'name':_0x4fccb7,'userProfileId':_0x15d4bd[_0x97f5('0x53')]},'raw':!![]})[_0x97f5('0x25')](function(_0x4c66a9){if(_0x4c66a9&&_0x4c66a9['autoAssociation']===0x0){return db[_0x97f5('0x30')][_0x97f5('0x4d')]({'name':_0x4ecd39[_0x97f5('0x2f')],'resourceId':_0x4ecd39['id'],'type':_0x4c66a9[_0x97f5('0x2f')],'sectionId':_0x4c66a9['id']},{})[_0x97f5('0x25')](function(){return _0x16a77f;});}else{return _0x16a77f;}})[_0x97f5('0x49')](function(_0x29b81c){logger[_0x97f5('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29b81c);throw _0x29b81c;});}return _0x16a77f;});}})[_0x97f5('0x25')](respondWithResult(_0x40b757,0xc9))[_0x97f5('0x49')](handleError(_0x40b757,null));};exports[_0x97f5('0x5c')]=function(_0x5b5d50,_0x372d47){if(_0x5b5d50[_0x97f5('0x4e')]['id']){delete _0x5b5d50[_0x97f5('0x4e')]['id'];}return db[_0x97f5('0x44')][_0x97f5('0x2e')]({'where':{'id':_0x5b5d50['params']['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x372d47,null))[_0x97f5('0x25')](saveUpdates(_0x5b5d50[_0x97f5('0x4e')],null))['then'](respondWithResult(_0x372d47,null))[_0x97f5('0x49')](handleError(_0x372d47,null));};exports[_0x97f5('0x26')]=function(_0x262bbf,_0x2c2b47){return db[_0x97f5('0x44')][_0x97f5('0x2e')]({'where':{'id':_0x262bbf['params']['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x2c2b47,null))[_0x97f5('0x25')](removeEntity(_0x2c2b47,null))[_0x97f5('0x49')](handleError(_0x2c2b47,null));};exports['getHoppers']=function(_0x54c671,_0x2d7658,_0x5a2c2f){var _0x359631={'raw':![],'where':{}};var _0x95e133={};var _0x5c8d7f={'count':0x0,'rows':[]};return db[_0x97f5('0x44')][_0x97f5('0x5d')]({'where':{'id':_0x54c671[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x2d7658,null))[_0x97f5('0x25')](function(_0xb6ba78){if(_0xb6ba78){_0x95e133[_0x97f5('0x39')]=_[_0x97f5('0x4c')](db[_0x97f5('0x5e')][_0x97f5('0x56')]);_0x95e133[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x54c671[_0x97f5('0x36')]);_0x95e133[_0x97f5('0x37')]=_['intersection'](_0x95e133[_0x97f5('0x39')],_0x95e133[_0x97f5('0x36')]);_0x359631[_0x97f5('0x3a')]=_[_0x97f5('0x38')](_0x95e133[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x54c671[_0x97f5('0x36')]['fields']));_0x359631[_0x97f5('0x3a')]=_0x359631[_0x97f5('0x3a')]['length']?_0x359631[_0x97f5('0x3a')]:_0x95e133['model'];if(!_0x54c671[_0x97f5('0x36')][_0x97f5('0x3d')]('nolimit')){_0x359631[_0x97f5('0x1f')]=qs['limit'](_0x54c671[_0x97f5('0x36')][_0x97f5('0x1f')]);_0x359631[_0x97f5('0x1d')]=qs['offset'](_0x54c671[_0x97f5('0x36')][_0x97f5('0x1d')]);}_0x359631[_0x97f5('0x3f')]=qs['sort'](_0x54c671['query'][_0x97f5('0x40')]);_0x359631[_0x97f5('0x41')]=qs['filters'](_[_0x97f5('0x5f')](_0x54c671[_0x97f5('0x36')],_0x95e133[_0x97f5('0x37')]));_0x359631[_0x97f5('0x41')]['VoiceQueueId']=_0xb6ba78['id'];if(_0x54c671[_0x97f5('0x36')][_0x97f5('0x2a')]){_0x359631[_0x97f5('0x41')]=_[_0x97f5('0x42')](_0x359631[_0x97f5('0x41')],{'$or':_[_0x97f5('0x60')](_0x359631['attributes'],function(_0x2ef9cf){var _0x38071a={};_0x38071a[_0x2ef9cf]={'$like':'%'+_0x54c671['query'][_0x97f5('0x2a')]+'%'};return _0x38071a;})});}_0x359631=_[_0x97f5('0x42')]({},_0x359631,_0x54c671[_0x97f5('0x43')]);return db[_0x97f5('0x5e')][_0x97f5('0x20')]({'where':_0x359631[_0x97f5('0x41')]})[_0x97f5('0x25')](function(_0x401f2a){_0x5c8d7f['count']=_0x401f2a;if(_0x54c671[_0x97f5('0x36')]['includeAll']){_0x359631[_0x97f5('0x46')]=[{'all':!![]}];}return db[_0x97f5('0x5e')][_0x97f5('0x47')](_0x359631);})[_0x97f5('0x25')](function(_0x343a9b){_0x5c8d7f[_0x97f5('0x48')]=_0x343a9b;return _0x5c8d7f;});}})[_0x97f5('0x25')](respondWithFilteredResult(_0x2d7658,_0x359631))[_0x97f5('0x49')](handleError(_0x2d7658,null));};exports[_0x97f5('0x61')]=function(_0x54580b,_0x1e0422,_0x37191f){var _0x110949={'raw':!![],'where':{}};var _0x132daf={};var _0x140bce={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x97f5('0x5d')]({'where':{'id':_0x54580b[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x1e0422,null))[_0x97f5('0x25')](function(_0x595366){if(_0x595366){_0x132daf['model']=_[_0x97f5('0x4c')](db[_0x97f5('0x62')][_0x97f5('0x56')]);_0x132daf[_0x97f5('0x36')]=_['keys'](_0x54580b[_0x97f5('0x36')]);_0x132daf['filters']=_[_0x97f5('0x38')](_0x132daf[_0x97f5('0x39')],_0x132daf['query']);_0x110949[_0x97f5('0x3a')]=_[_0x97f5('0x38')](_0x132daf[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x54580b['query'][_0x97f5('0x3b')]));_0x110949[_0x97f5('0x3a')]=_0x110949['attributes']['length']?_0x110949[_0x97f5('0x3a')]:_0x132daf[_0x97f5('0x39')];if(!_0x54580b[_0x97f5('0x36')][_0x97f5('0x3d')](_0x97f5('0x3e'))){_0x110949['limit']=qs[_0x97f5('0x1f')](_0x54580b[_0x97f5('0x36')][_0x97f5('0x1f')]);_0x110949[_0x97f5('0x1d')]=qs['offset'](_0x54580b[_0x97f5('0x36')][_0x97f5('0x1d')]);}_0x110949['order']=qs[_0x97f5('0x40')](_0x54580b[_0x97f5('0x36')][_0x97f5('0x40')]);_0x110949['where']=qs['filters'](_[_0x97f5('0x5f')](_0x54580b['query'],_0x132daf[_0x97f5('0x37')]));_0x110949[_0x97f5('0x41')][_0x97f5('0x63')]=_0x595366['id'];if(_0x54580b[_0x97f5('0x36')][_0x97f5('0x2a')]){_0x110949[_0x97f5('0x41')]=_['merge'](_0x110949[_0x97f5('0x41')],{'$or':_[_0x97f5('0x60')](_0x110949[_0x97f5('0x3a')],function(_0x3eddef){var _0x183b04={};_0x183b04[_0x3eddef]={'$like':'%'+_0x54580b['query'][_0x97f5('0x2a')]+'%'};return _0x183b04;})});}_0x110949=_['merge']({},_0x110949,_0x54580b['options']);return db[_0x97f5('0x62')]['count']({'where':_0x110949['where']})[_0x97f5('0x25')](function(_0x4c28ba){_0x140bce['count']=_0x4c28ba;if(_0x54580b[_0x97f5('0x36')][_0x97f5('0x45')]){_0x110949[_0x97f5('0x46')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x97f5('0x47')](_0x110949);})[_0x97f5('0x25')](function(_0x292bf5){_0x140bce[_0x97f5('0x48')]=_0x292bf5;return _0x140bce;});}})[_0x97f5('0x25')](respondWithFilteredResult(_0x1e0422,_0x110949))[_0x97f5('0x49')](handleError(_0x1e0422,null));};exports[_0x97f5('0x64')]=function(_0x5d2a36,_0x1592d5,_0xff263a){var _0x423b27={'raw':!![],'where':{}};var _0x197784={};var _0x45a69d={'count':0x0,'rows':[]};return db[_0x97f5('0x44')]['findOne']({'where':{'id':_0x5d2a36['params']['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x1592d5,null))[_0x97f5('0x25')](function(_0x2c9166){if(_0x2c9166){_0x197784[_0x97f5('0x39')]=_[_0x97f5('0x4c')](db[_0x97f5('0x65')][_0x97f5('0x56')]);_0x197784[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x5d2a36[_0x97f5('0x36')]);_0x197784[_0x97f5('0x37')]=_[_0x97f5('0x38')](_0x197784['model'],_0x197784['query']);_0x423b27['attributes']=_['intersection'](_0x197784[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x5d2a36[_0x97f5('0x36')][_0x97f5('0x3b')]));_0x423b27[_0x97f5('0x3a')]=_0x423b27['attributes'][_0x97f5('0x3c')]?_0x423b27['attributes']:_0x197784[_0x97f5('0x39')];if(!_0x5d2a36[_0x97f5('0x36')]['hasOwnProperty'](_0x97f5('0x3e'))){_0x423b27[_0x97f5('0x1f')]=qs[_0x97f5('0x1f')](_0x5d2a36[_0x97f5('0x36')][_0x97f5('0x1f')]);_0x423b27[_0x97f5('0x1d')]=qs[_0x97f5('0x1d')](_0x5d2a36[_0x97f5('0x36')][_0x97f5('0x1d')]);}_0x423b27[_0x97f5('0x3f')]=qs['sort'](_0x5d2a36[_0x97f5('0x36')][_0x97f5('0x40')]);_0x423b27[_0x97f5('0x41')]=qs[_0x97f5('0x37')](_['pick'](_0x5d2a36['query'],_0x197784[_0x97f5('0x37')]));_0x423b27['where']['VoiceQueueId']=_0x2c9166['id'];if(_0x5d2a36[_0x97f5('0x36')][_0x97f5('0x2a')]){_0x423b27[_0x97f5('0x41')]=_[_0x97f5('0x42')](_0x423b27['where'],{'$or':_[_0x97f5('0x60')](_0x423b27[_0x97f5('0x3a')],function(_0x9fd584){var _0x1d30b6={};_0x1d30b6[_0x9fd584]={'$like':'%'+_0x5d2a36[_0x97f5('0x36')][_0x97f5('0x2a')]+'%'};return _0x1d30b6;})});}_0x423b27=_[_0x97f5('0x42')]({},_0x423b27,_0x5d2a36['options']);return db[_0x97f5('0x65')][_0x97f5('0x20')]({'where':_0x423b27['where']})[_0x97f5('0x25')](function(_0x4d43c2){_0x45a69d['count']=_0x4d43c2;if(_0x5d2a36[_0x97f5('0x36')][_0x97f5('0x45')]){_0x423b27[_0x97f5('0x46')]=[{'all':!![]}];}return db[_0x97f5('0x65')]['findAll'](_0x423b27);})[_0x97f5('0x25')](function(_0x2376e7){_0x45a69d[_0x97f5('0x48')]=_0x2376e7;return _0x45a69d;});}})[_0x97f5('0x25')](respondWithFilteredResult(_0x1592d5,_0x423b27))[_0x97f5('0x49')](handleError(_0x1592d5,null));};exports['getHopperBlacks']=function(_0x3485dc,_0x59bb02,_0x26b3af){var _0xec197e={'raw':!![],'where':{}};var _0x4ae105={};var _0x59e9cc={'count':0x0,'rows':[]};return db[_0x97f5('0x44')][_0x97f5('0x5d')]({'where':{'id':_0x3485dc[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x59bb02,null))['then'](function(_0x4e521d){if(_0x4e521d){_0x4ae105[_0x97f5('0x39')]=_['keys'](db[_0x97f5('0x66')][_0x97f5('0x56')]);_0x4ae105[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x3485dc[_0x97f5('0x36')]);_0x4ae105['filters']=_['intersection'](_0x4ae105['model'],_0x4ae105[_0x97f5('0x36')]);_0xec197e[_0x97f5('0x3a')]=_[_0x97f5('0x38')](_0x4ae105[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x3485dc[_0x97f5('0x36')][_0x97f5('0x3b')]));_0xec197e[_0x97f5('0x3a')]=_0xec197e[_0x97f5('0x3a')][_0x97f5('0x3c')]?_0xec197e[_0x97f5('0x3a')]:_0x4ae105[_0x97f5('0x39')];if(!_0x3485dc[_0x97f5('0x36')][_0x97f5('0x3d')](_0x97f5('0x3e'))){_0xec197e['limit']=qs[_0x97f5('0x1f')](_0x3485dc[_0x97f5('0x36')][_0x97f5('0x1f')]);_0xec197e[_0x97f5('0x1d')]=qs[_0x97f5('0x1d')](_0x3485dc[_0x97f5('0x36')][_0x97f5('0x1d')]);}_0xec197e[_0x97f5('0x3f')]=qs[_0x97f5('0x40')](_0x3485dc[_0x97f5('0x36')]['sort']);_0xec197e[_0x97f5('0x41')]=qs[_0x97f5('0x37')](_[_0x97f5('0x5f')](_0x3485dc[_0x97f5('0x36')],_0x4ae105['filters']));_0xec197e[_0x97f5('0x41')][_0x97f5('0x63')]=_0x4e521d['id'];if(_0x3485dc[_0x97f5('0x36')][_0x97f5('0x2a')]){_0xec197e[_0x97f5('0x41')]=_[_0x97f5('0x42')](_0xec197e['where'],{'$or':_['map'](_0xec197e[_0x97f5('0x3a')],function(_0x3da429){var _0x103b11={};_0x103b11[_0x3da429]={'$like':'%'+_0x3485dc[_0x97f5('0x36')][_0x97f5('0x2a')]+'%'};return _0x103b11;})});}_0xec197e=_[_0x97f5('0x42')]({},_0xec197e,_0x3485dc[_0x97f5('0x43')]);return db['CmHopperBlack'][_0x97f5('0x20')]({'where':_0xec197e['where']})[_0x97f5('0x25')](function(_0x1a97c3){_0x59e9cc[_0x97f5('0x20')]=_0x1a97c3;if(_0x3485dc['query'][_0x97f5('0x45')]){_0xec197e[_0x97f5('0x46')]=[{'all':!![]}];}return db[_0x97f5('0x66')][_0x97f5('0x47')](_0xec197e);})[_0x97f5('0x25')](function(_0x1c0afc){_0x59e9cc[_0x97f5('0x48')]=_0x1c0afc;return _0x59e9cc;});}})[_0x97f5('0x25')](respondWithFilteredResult(_0x59bb02,_0xec197e))[_0x97f5('0x49')](handleError(_0x59bb02,null));};exports[_0x97f5('0x67')]=function(_0x3cecf9,_0x36d760,_0x44a80b){var _0x57277b={};var _0x350327={};var _0x16ae9b;var _0x42b92b;return db[_0x97f5('0x44')][_0x97f5('0x5d')]({'where':{'id':_0x3cecf9['params']['id']}})['then'](handleEntityNotFound(_0x36d760,null))[_0x97f5('0x25')](function(_0x55e64d){if(_0x55e64d){_0x16ae9b=_0x55e64d;_0x350327[_0x97f5('0x39')]=_[_0x97f5('0x4c')](db[_0x97f5('0x68')][_0x97f5('0x56')]);_0x350327[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x3cecf9['query']);_0x350327[_0x97f5('0x37')]=_['intersection'](_0x350327[_0x97f5('0x39')],_0x350327[_0x97f5('0x36')]);_0x57277b['attributes']=_[_0x97f5('0x38')](_0x350327[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x3cecf9[_0x97f5('0x36')]['fields']));_0x57277b['attributes']=_0x57277b['attributes'][_0x97f5('0x3c')]?_0x57277b[_0x97f5('0x3a')]:_0x350327[_0x97f5('0x39')];_0x57277b[_0x97f5('0x3f')]=qs['sort'](_0x3cecf9[_0x97f5('0x36')][_0x97f5('0x40')]);_0x57277b[_0x97f5('0x41')]=qs[_0x97f5('0x37')](_[_0x97f5('0x5f')](_0x3cecf9[_0x97f5('0x36')],_0x350327['filters']));if(_0x3cecf9[_0x97f5('0x36')][_0x97f5('0x2a')]){_0x57277b[_0x97f5('0x41')]=_['merge'](_0x57277b['where'],{'$or':_[_0x97f5('0x60')](_0x57277b[_0x97f5('0x3a')],function(_0x1d2f99){var _0x3e31ad={};_0x3e31ad[_0x1d2f99]={'$like':'%'+_0x3cecf9[_0x97f5('0x36')][_0x97f5('0x2a')]+'%'};return _0x3e31ad;})});}_0x57277b=_[_0x97f5('0x42')]({},_0x57277b,_0x3cecf9[_0x97f5('0x43')]);return _0x16ae9b[_0x97f5('0x67')](_0x57277b);}})['then'](function(_0x240434){if(_0x240434){_0x42b92b=_0x240434['length'];if(!_0x3cecf9[_0x97f5('0x36')]['hasOwnProperty'](_0x97f5('0x3e'))){_0x57277b[_0x97f5('0x1f')]=qs[_0x97f5('0x1f')](_0x3cecf9[_0x97f5('0x36')]['limit']);_0x57277b[_0x97f5('0x1d')]=qs[_0x97f5('0x1d')](_0x3cecf9[_0x97f5('0x36')][_0x97f5('0x1d')]);}return _0x16ae9b[_0x97f5('0x67')](_0x57277b);}})[_0x97f5('0x25')](function(_0x58e595){if(_0x58e595){return _0x58e595?{'count':_0x42b92b,'rows':_0x58e595}:null;}})[_0x97f5('0x25')](respondWithResult(_0x36d760,null))[_0x97f5('0x49')](handleError(_0x36d760,null));};exports[_0x97f5('0x69')]=function(_0x1f39f3,_0x312f58,_0x2f42ac){var _0x1c6bf2=_0x1f39f3['body'][_0x97f5('0x6a')];var _0x286bcc=_[_0x97f5('0x60')](_0x1c6bf2,'id');return db['Team'][_0x97f5('0x47')]({'where':{'id':_0x286bcc},'attributes':['id'],'include':[{'model':db[_0x97f5('0x6b')],'as':_0x97f5('0x6c'),'attributes':['id','name','online',_0x97f5('0x6d'),_0x97f5('0x6e')],'raw':!![]}]})[_0x97f5('0x25')](function(_0x4444da){if(_0x4444da){var _0x4d108b=_[_0x97f5('0x6f')](_0x4444da,function(_0x4ce523){var _0x2deb5f=_0x4ce523[_0x97f5('0x50')]({'plain':!![]});_0x2deb5f[_0x97f5('0x6c')]['forEach'](function(_0x51be8a){_0x51be8a[_0x97f5('0x70')]=_[_0x97f5('0x2e')](_0x1c6bf2,{'id':_0x2deb5f['id']})[_0x97f5('0x70')];});return _0x2deb5f['Agents'];});return db[_0x97f5('0x44')][_0x97f5('0x2e')]({'where':{'id':_0x1f39f3[_0x97f5('0x4b')]['id']}})['then'](function(_0x27f74b){return db['sequelize'][_0x97f5('0x71')](function(_0x5072ac){return _0x27f74b[_0x97f5('0x69')](_0x286bcc,{'transaction':_0x5072ac})['then'](function(){return BPromise[_0x97f5('0x72')](_0x1c6bf2,function(_0x1ac7a8){return db[_0x97f5('0x73')][_0x97f5('0x74')]({'TeamId':_0x1ac7a8['id'],'VoiceQueueId':_0x1f39f3[_0x97f5('0x4b')]['id'],'penalty':_0x1ac7a8[_0x97f5('0x70')]},{'transaction':_0x5072ac});});})[_0x97f5('0x25')](function(){return BPromise[_0x97f5('0x72')](_0x4d108b,function(_0x39efa5){return db[_0x97f5('0x75')][_0x97f5('0x76')]({'where':{'UserId':_0x39efa5['id'],'VoiceQueueId':_0x1f39f3['params']['id']},'defaults':{'penalty':_0x39efa5[_0x97f5('0x70')]},'transaction':_0x5072ac});});})[_0x97f5('0x25')](function(){return BPromise[_0x97f5('0x72')](_[_0x97f5('0x2a')](_0x4d108b,{'online':!![]}),function(_0x7b8001){return db['UserVoiceQueueRt'][_0x97f5('0x74')]({'membername':_0x7b8001[_0x97f5('0x2f')],'UserId':_0x7b8001['id'],'queue_name':_0x27f74b[_0x97f5('0x2f')],'VoiceQueueId':_0x27f74b['id'],'interface':_[_0x97f5('0x77')](_0x7b8001[_0x97f5('0x6e')])?util[_0x97f5('0x78')]('SIP/%s',_0x7b8001['name']):_0x7b8001[_0x97f5('0x6e')],'paused':_0x7b8001[_0x97f5('0x6d')]||![],'penalty':_0x7b8001['penalty']},{'transaction':_0x5072ac});});})['then'](function(){_0x4d108b[_0x97f5('0x79')](function(_0x4fc4f4){socket[_0x97f5('0x7a')](_0x97f5('0x7b'),{'UserId':_0x4fc4f4['id'],'VoiceQueueId':_0x27f74b['id']});});});});});}})[_0x97f5('0x25')](respondWithStatusCode(_0x312f58,null))[_0x97f5('0x49')](handleError(_0x312f58,null));};exports['removeTeams']=function(_0x2f81b6,_0x19dabe,_0x1d50f3){return db[_0x97f5('0x68')][_0x97f5('0x47')]({'where':{'id':_0x2f81b6[_0x97f5('0x36')][_0x97f5('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x97f5('0x6b')],'as':_0x97f5('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x97f5('0x25')](handleEntityNotFound(_0x19dabe,null))[_0x97f5('0x25')](function(_0x47a92f){var _0x255bde=_[_0x97f5('0x60')](_0x47a92f,'id');var _0x44e23c=[];var _0x3bf345=[];var _0x25f4fd=squel['select']();_0x25f4fd[_0x97f5('0x7d')](_0x97f5('0x7e'))['from'](_0x97f5('0x7f'),'tq')['join']('user_has_teams','ut',_0x97f5('0x80'))['where'](_0x97f5('0x81'),_0x2f81b6[_0x97f5('0x4b')]['id']);for(var _0xefbdb7=0x0;_0xefbdb7<_0x47a92f[_0x97f5('0x3c')];_0xefbdb7+=0x1){let _0x3a120c=_0x47a92f[_0xefbdb7];for(var _0x5d18ed=0x0;_0x5d18ed<_0x3a120c[_0x97f5('0x6c')][_0x97f5('0x3c')];_0x5d18ed+=0x1){let _0x1ceaad=_0x3a120c[_0x97f5('0x6c')][_0x5d18ed];var _0x3cd629=_0x25f4fd[_0x97f5('0x55')]();_0x3cd629[_0x97f5('0x41')]('ut.UserId\x20=\x20?',_0x1ceaad['id']);_0x3bf345[_0x97f5('0x82')](db[_0x97f5('0x83')][_0x97f5('0x36')](_0x3cd629['toString'](),{'type':db[_0x97f5('0x83')]['QueryTypes'][_0x97f5('0x84')]})[_0x97f5('0x25')](function(_0x5b3996){if(_0x5b3996[_0x97f5('0x3c')]===0x1){return _0x1ceaad['id'];}else{var _0x2d849d=_[_0x97f5('0x85')](_[_0x97f5('0x60')](_0x5b3996,'TeamId'),function(_0x322212){return _[_0x97f5('0x86')](_0x255bde,_0x322212);});if(_0x2d849d){return _0x1ceaad['id'];}}}));}}return BPromise['all'](_0x3bf345)['then'](function(_0x5d9082){_0x44e23c=_(_0x44e23c)[_0x97f5('0x87')](_0x5d9082)[_0x97f5('0x88')]()[_0x97f5('0x2c')]();return db[_0x97f5('0x44')]['find']({'where':{'id':_0x2f81b6['params']['id']}})[_0x97f5('0x25')](function(_0x470ab2){return db[_0x97f5('0x83')][_0x97f5('0x71')](function(_0x50b98f){return _0x470ab2[_0x97f5('0x89')](_0x2f81b6[_0x97f5('0x36')][_0x97f5('0x7c')],{'transaction':_0x50b98f})[_0x97f5('0x25')](function(){if(!_[_0x97f5('0x8a')](_0x44e23c)){return _0x470ab2[_0x97f5('0x8b')](_0x44e23c,{'transaction':_0x50b98f})[_0x97f5('0x25')](function(){return db['UserVoiceQueueRt'][_0x97f5('0x26')]({'where':{'VoiceQueueId':_0x2f81b6[_0x97f5('0x4b')]['id'],'UserId':_0x44e23c},'transaction':_0x50b98f});});}})[_0x97f5('0x25')](function(){_0x44e23c['forEach'](function(_0xbaf423){socket[_0x97f5('0x7a')]('userVoiceQueue:remove',{'UserId':_0xbaf423,'VoiceQueueId':_0x470ab2['id']});});});});});});})[_0x97f5('0x25')](respondWithStatusCode(_0x19dabe,null))[_0x97f5('0x49')](handleError(_0x19dabe,null));};exports[_0x97f5('0x8c')]=function(_0x140fc9,_0x185284,_0xfe215b){var _0x51f30b,_0x38fe3d;return db['VoiceQueue'][_0x97f5('0x2e')]({'where':{'id':_0x140fc9[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x185284,null))[_0x97f5('0x25')](function(_0x1afd9a){if(_0x1afd9a){_0x38fe3d=_0x1afd9a;return _0x1afd9a[_0x97f5('0x8c')](_0x140fc9['body'][_0x97f5('0x7c')],_['omit'](_0x140fc9[_0x97f5('0x4e')],[_0x97f5('0x7c'),'id'])||{})[_0x97f5('0x8d')](function(_0x482c41){for(var _0x52f055=0x0;_0x52f055<_0x140fc9[_0x97f5('0x4e')][_0x97f5('0x7c')][_0x97f5('0x3c')];_0x52f055+=0x1){socket[_0x97f5('0x7a')](_0x97f5('0x7b'),{'UserId':Number(_0x140fc9['body'][_0x97f5('0x7c')][_0x52f055]),'VoiceQueueId':Number(_0x140fc9['params']['id'])});}return _0x482c41;});}})[_0x97f5('0x25')](function(_0x32745b){_0x51f30b=_0x32745b||[];if(_0x38fe3d){return db['User'][_0x97f5('0x47')]({'where':{'id':_0x140fc9[_0x97f5('0x4e')][_0x97f5('0x7c')]},'attributes':['id','name','online','voicePause',_0x97f5('0x6e')],'raw':!![]});}})['then'](function(_0x1aaf95){if(!_[_0x97f5('0x8a')](_0x1aaf95)){var _0x52a4eb=[];for(var _0x5401c3=0x0;_0x5401c3<_0x1aaf95[_0x97f5('0x3c')];_0x5401c3++){if(_0x1aaf95[_0x5401c3][_0x97f5('0x8e')]){_0x52a4eb[_0x97f5('0x82')](db['UserVoiceQueueRt'][_0x97f5('0x74')]({'membername':_0x1aaf95[_0x5401c3][_0x97f5('0x2f')],'UserId':_0x1aaf95[_0x5401c3]['id'],'queue_name':_0x38fe3d[_0x97f5('0x2f')],'VoiceQueueId':_0x38fe3d['id'],'interface':_[_0x97f5('0x77')](_0x1aaf95[_0x5401c3]['interface'])?util[_0x97f5('0x78')](_0x97f5('0x8f'),_0x1aaf95[_0x5401c3][_0x97f5('0x2f')]):_0x1aaf95[_0x5401c3][_0x97f5('0x6e')],'paused':_0x1aaf95[_0x5401c3][_0x97f5('0x6d')]||![],'penalty':_0x140fc9[_0x97f5('0x4e')][_0x97f5('0x70')]||0x0}));}}return BPromise['all'](_0x52a4eb);}})['then'](function(){return _0x51f30b;})['then'](respondWithResult(_0x185284,null))[_0x97f5('0x49')](handleError(_0x185284,null));};exports[_0x97f5('0x8b')]=function(_0x1a78ef,_0xc91072,_0x48267c){return db['VoiceQueue'][_0x97f5('0x2e')]({'where':{'id':_0x1a78ef[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0xc91072,null))['then'](function(_0x31ffa5){if(_0x31ffa5){return _0x31ffa5[_0x97f5('0x8b')](_0x1a78ef[_0x97f5('0x36')][_0x97f5('0x7c')])[_0x97f5('0x25')](function(){if(_['isArray'](_0x1a78ef[_0x97f5('0x36')]['ids'])){for(var _0x42ebbf=0x0;_0x42ebbf<_0x1a78ef[_0x97f5('0x36')][_0x97f5('0x7c')][_0x97f5('0x3c')];_0x42ebbf+=0x1){socket[_0x97f5('0x7a')]('userVoiceQueue:remove',{'UserId':Number(_0x1a78ef['query']['ids'][_0x42ebbf]),'VoiceQueueId':Number(_0x1a78ef[_0x97f5('0x4b')]['id'])});}}else{socket['emit'](_0x97f5('0x90'),{'UserId':Number(_0x1a78ef['query'][_0x97f5('0x7c')]),'VoiceQueueId':Number(_0x1a78ef['params']['id'])});}});}})['then'](function(_0x2fd0c5){return db[_0x97f5('0x91')][_0x97f5('0x26')]({'where':{'VoiceQueueId':_0x1a78ef[_0x97f5('0x4b')]['id'],'UserId':_0x1a78ef['query']['ids']}})[_0x97f5('0x25')](function(){return _0x2fd0c5;});})[_0x97f5('0x25')](respondWithStatusCode(_0xc91072,null))[_0x97f5('0x49')](handleError(_0xc91072,null));};exports[_0x97f5('0x92')]=function(_0x95a850,_0x467abb,_0x52318a){var _0x4c17ac={};var _0x23a3f8={};var _0x11c926;var _0x4a6b6b;return db[_0x97f5('0x44')][_0x97f5('0x5d')]({'where':{'id':_0x95a850[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x467abb,null))[_0x97f5('0x25')](function(_0x568077){if(_0x568077){_0x11c926=_0x568077;_0x23a3f8[_0x97f5('0x39')]=_['keys'](db['User'][_0x97f5('0x56')]);_0x23a3f8[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x95a850['query']);_0x23a3f8[_0x97f5('0x37')]=_[_0x97f5('0x38')](_0x23a3f8[_0x97f5('0x39')],_0x23a3f8[_0x97f5('0x36')]);_0x4c17ac[_0x97f5('0x3a')]=_[_0x97f5('0x38')](_0x23a3f8[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x95a850[_0x97f5('0x36')][_0x97f5('0x3b')]));_0x4c17ac['attributes']=_0x4c17ac['attributes'][_0x97f5('0x3c')]?_0x4c17ac[_0x97f5('0x3a')]:_0x23a3f8['model'];_0x4c17ac[_0x97f5('0x3f')]=qs[_0x97f5('0x40')](_0x95a850[_0x97f5('0x36')]['sort']);_0x4c17ac[_0x97f5('0x41')]=qs[_0x97f5('0x37')](_['pick'](_0x95a850[_0x97f5('0x36')],_0x23a3f8[_0x97f5('0x37')]));if(_0x95a850[_0x97f5('0x36')][_0x97f5('0x2a')]){_0x4c17ac['where']=_[_0x97f5('0x42')](_0x4c17ac[_0x97f5('0x41')],{'$or':_['map'](_0x4c17ac[_0x97f5('0x3a')],function(_0x5b0047){var _0x5afba9={};_0x5afba9[_0x5b0047]={'$like':'%'+_0x95a850[_0x97f5('0x36')]['filter']+'%'};return _0x5afba9;})});}_0x4c17ac=_[_0x97f5('0x42')]({},_0x4c17ac,_0x95a850[_0x97f5('0x43')]);return _0x11c926[_0x97f5('0x92')](_0x4c17ac);}})[_0x97f5('0x25')](function(_0x32cd97){if(_0x32cd97){_0x4a6b6b=_0x32cd97[_0x97f5('0x3c')];if(!_0x95a850[_0x97f5('0x36')][_0x97f5('0x3d')](_0x97f5('0x3e'))){_0x4c17ac[_0x97f5('0x1f')]=qs[_0x97f5('0x1f')](_0x95a850[_0x97f5('0x36')][_0x97f5('0x1f')]);_0x4c17ac[_0x97f5('0x1d')]=qs[_0x97f5('0x1d')](_0x95a850[_0x97f5('0x36')][_0x97f5('0x1d')]);}return _0x11c926[_0x97f5('0x92')](_0x4c17ac);}})['then'](function(_0x3e04eb){if(_0x3e04eb){return _0x3e04eb?{'count':_0x4a6b6b,'rows':_0x3e04eb}:null;}})[_0x97f5('0x25')](respondWithResult(_0x467abb,null))[_0x97f5('0x49')](handleError(_0x467abb,null));};exports[_0x97f5('0x93')]=function(_0x34296e,_0x55df32,_0x25a69f){var _0xc13bd2={};var _0x5deece={};var _0x446d81;var _0x513f81;return db['VoiceQueue'][_0x97f5('0x5d')]({'where':{'id':_0x34296e[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x55df32,null))['then'](function(_0x140056){if(_0x140056){_0x446d81=_0x140056;_0x5deece[_0x97f5('0x39')]=_[_0x97f5('0x4c')](db[_0x97f5('0x91')][_0x97f5('0x56')]);_0x5deece[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x34296e[_0x97f5('0x36')]);_0x5deece[_0x97f5('0x37')]=_[_0x97f5('0x38')](_0x5deece[_0x97f5('0x39')],_0x5deece[_0x97f5('0x36')]);_0xc13bd2[_0x97f5('0x3a')]=_[_0x97f5('0x38')](_0x5deece[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x34296e['query'][_0x97f5('0x3b')]));_0xc13bd2['attributes']=_0xc13bd2[_0x97f5('0x3a')][_0x97f5('0x3c')]?_0xc13bd2[_0x97f5('0x3a')]:_0x5deece[_0x97f5('0x39')];_0xc13bd2['order']=qs[_0x97f5('0x40')](_0x34296e[_0x97f5('0x36')]['sort']);_0xc13bd2[_0x97f5('0x41')]=qs['filters'](_['pick'](_0x34296e[_0x97f5('0x36')],_0x5deece['filters']));if(_0x34296e[_0x97f5('0x36')][_0x97f5('0x2a')]){_0xc13bd2['where']=_['merge'](_0xc13bd2['where'],{'$or':_[_0x97f5('0x60')](_0xc13bd2[_0x97f5('0x3a')],function(_0x52c127){var _0x2f2030={};_0x2f2030[_0x52c127]={'$like':'%'+_0x34296e[_0x97f5('0x36')][_0x97f5('0x2a')]+'%'};return _0x2f2030;})});}_0xc13bd2=_[_0x97f5('0x42')]({},_0xc13bd2,_0x34296e[_0x97f5('0x43')]);return _0x446d81['getMembers'](_0xc13bd2);}})[_0x97f5('0x25')](function(_0x217377){if(_0x217377){_0x513f81=_0x217377[_0x97f5('0x3c')];if(!_0x34296e[_0x97f5('0x36')]['hasOwnProperty'](_0x97f5('0x3e'))){_0xc13bd2['limit']=qs['limit'](_0x34296e[_0x97f5('0x36')][_0x97f5('0x1f')]);_0xc13bd2['offset']=qs[_0x97f5('0x1d')](_0x34296e['query']['offset']);}return _0x446d81[_0x97f5('0x93')](_0xc13bd2);}})['then'](function(_0x22b45e){return _0x22b45e?{'count':_0x513f81,'rows':_0x22b45e}:null;})[_0x97f5('0x25')](respondWithResult(_0x55df32,null))[_0x97f5('0x49')](handleError(_0x55df32,null));};exports[_0x97f5('0x94')]=function(_0x56407b,_0x1d98ec,_0x43017d){var _0xd4dfb7={};var _0x4512b5={};var _0x3c4b4d;var _0xf0c6fa;return db[_0x97f5('0x44')][_0x97f5('0x5d')]({'where':{'id':_0x56407b[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x1d98ec,null))[_0x97f5('0x25')](function(_0x27c5ba){if(_0x27c5ba){_0x3c4b4d=_0x27c5ba;_0x4512b5['model']=_[_0x97f5('0x4c')](db[_0x97f5('0x95')][_0x97f5('0x56')]);_0x4512b5[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x56407b[_0x97f5('0x36')]);_0x4512b5[_0x97f5('0x37')]=_[_0x97f5('0x38')](_0x4512b5[_0x97f5('0x39')],_0x4512b5['query']);_0xd4dfb7['attributes']=_[_0x97f5('0x38')](_0x4512b5[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x56407b[_0x97f5('0x36')][_0x97f5('0x3b')]));_0xd4dfb7[_0x97f5('0x3a')]=_0xd4dfb7[_0x97f5('0x3a')][_0x97f5('0x3c')]?_0xd4dfb7[_0x97f5('0x3a')]:_0x4512b5[_0x97f5('0x39')];_0xd4dfb7['order']=qs[_0x97f5('0x40')](_0x56407b[_0x97f5('0x36')]['sort']);_0xd4dfb7['where']=qs[_0x97f5('0x37')](_['pick'](_0x56407b['query'],_0x4512b5['filters']));if(_0x56407b[_0x97f5('0x36')][_0x97f5('0x2a')]){_0xd4dfb7[_0x97f5('0x41')]=_[_0x97f5('0x42')](_0xd4dfb7['where'],{'$or':_[_0x97f5('0x60')](_0xd4dfb7['attributes'],function(_0x1942f4){var _0x581033={};_0x581033[_0x1942f4]={'$like':'%'+_0x56407b[_0x97f5('0x36')][_0x97f5('0x2a')]+'%'};return _0x581033;})});}_0xd4dfb7=_['merge']({},_0xd4dfb7,_0x56407b['options']);return _0x3c4b4d['getLists'](_0xd4dfb7);}})[_0x97f5('0x25')](function(_0x34e508){if(_0x34e508){_0xf0c6fa=_0x34e508[_0x97f5('0x3c')];if(!_0x56407b[_0x97f5('0x36')][_0x97f5('0x3d')](_0x97f5('0x3e'))){_0xd4dfb7[_0x97f5('0x1f')]=qs[_0x97f5('0x1f')](_0x56407b[_0x97f5('0x36')][_0x97f5('0x1f')]);_0xd4dfb7[_0x97f5('0x1d')]=qs[_0x97f5('0x1d')](_0x56407b[_0x97f5('0x36')][_0x97f5('0x1d')]);}return _0x3c4b4d['getLists'](_0xd4dfb7);}})[_0x97f5('0x25')](function(_0x2000f4){if(_0x2000f4){return _0x2000f4?{'count':_0xf0c6fa,'rows':_0x2000f4}:null;}})[_0x97f5('0x25')](respondWithResult(_0x1d98ec,null))[_0x97f5('0x49')](handleError(_0x1d98ec,null));};exports[_0x97f5('0x96')]=function(_0x3c4c09,_0x29f936,_0x42b3d8){var _0x3bb818=moment()[_0x97f5('0x78')]('YYYY-MM-DD\x20HH:mm:ss');var _0x11e20b,_0x511b73;return db['VoiceQueue'][_0x97f5('0x2e')]({'where':{'id':_0x3c4c09['params']['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x29f936,null))[_0x97f5('0x25')](function(_0x1dd174){if(_0x1dd174){_0x511b73=_0x1dd174;return _0x1dd174['addLists'](_0x3c4c09[_0x97f5('0x4e')]['ids'],_['omit'](_0x3c4c09[_0x97f5('0x4e')],[_0x97f5('0x7c'),'id'])||{});}return null;})[_0x97f5('0x8d')](function(_0x29c20a){var _0x23f6a5;_0x11e20b=_0x29c20a||[];var _0x481009=[];if(_0x29c20a){for(var _0x96eecb=0x0;_0x96eecb<_0x29c20a['length'];_0x96eecb+=0x1){var _0xe33084=_0x29c20a[_0x96eecb][_0x97f5('0x50')]({'plain':!![]});_0x511b73[_0x97f5('0x97')]=_0x3c4c09['body'][_0x97f5('0x97')]?_0x3c4c09[_0x97f5('0x4e')]['dialCheckDuplicateType']:_0x511b73[_0x97f5('0x97')];switch(_0x511b73['dialCheckDuplicateType']){case'always':_0x23f6a5=squel[_0x97f5('0x98')]()[_0x97f5('0x99')](_0x97f5('0x9a'))['fromQuery']([_0x97f5('0x9b'),'scheduledAt',_0x97f5('0x9c'),'ListId',_0x97f5('0x63'),_0x97f5('0x58'),_0x97f5('0x59')],squel[_0x97f5('0x9d')]()[_0x97f5('0x7d')](_0x97f5('0x9b'),_0x97f5('0x9b'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27',_0x97f5('0x9e'))[_0x97f5('0x7d')]('id',_0x97f5('0x9c'))[_0x97f5('0x7d')](_0xe33084['CmListId'][_0x97f5('0x9f')](),_0x97f5('0xa0'))[_0x97f5('0x7d')](_0x3c4c09[_0x97f5('0x4b')]['id']['toString'](),_0x97f5('0x63'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27',_0x97f5('0x58'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27',_0x97f5('0x59'))[_0x97f5('0xa1')](_0x97f5('0xa2'))[_0x97f5('0x41')](_0x97f5('0xa3'))[_0x97f5('0x41')](_0x97f5('0xa4'),_0xe33084[_0x97f5('0xa5')]['toString']())[_0x97f5('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0x97f5('0x41')](_0x97f5('0xa6'),squel[_0x97f5('0x9d')]()['field'](_0x97f5('0xa7'))[_0x97f5('0xa1')](_0x97f5('0xa8'))[_0x97f5('0x41')](_0x97f5('0x81'),_0x3c4c09[_0x97f5('0x4b')]['id'][_0x97f5('0x9f')]()))[_0x97f5('0x41')](_0x97f5('0xa6'),squel['select']()[_0x97f5('0x7d')]('COALESCE(phone,\x27\x27)')[_0x97f5('0xa1')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x3c4c09['params']['id'][_0x97f5('0x9f')]())))[_0x97f5('0x9f')]();break;case _0x97f5('0xa9'):_0x23f6a5=squel[_0x97f5('0x98')]()[_0x97f5('0x99')]('cm_hopper')[_0x97f5('0xaa')]([_0x97f5('0x9b'),_0x97f5('0x9e'),'ContactId',_0x97f5('0xa0'),_0x97f5('0x63'),'createdAt',_0x97f5('0x59')],squel['select']()['field'](_0x97f5('0x9b'),'phone')[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27',_0x97f5('0x9e'))[_0x97f5('0x7d')]('id',_0x97f5('0x9c'))[_0x97f5('0x7d')](_0xe33084[_0x97f5('0xa5')]['toString'](),_0x97f5('0xa0'))['field'](_0x3c4c09[_0x97f5('0x4b')]['id'][_0x97f5('0x9f')](),_0x97f5('0x63'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27',_0x97f5('0x58'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27','updatedAt')[_0x97f5('0xa1')](_0x97f5('0xa2'))['where'](_0x97f5('0xa3'))[_0x97f5('0x41')](_0x97f5('0xa4'),_0xe33084['CmListId'][_0x97f5('0x9f')]())[_0x97f5('0x41')](_0x97f5('0xab'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x97f5('0x9d')]()['field'](_0x97f5('0xac'))[_0x97f5('0xa1')](_0x97f5('0x9a'))[_0x97f5('0x41')](_0x97f5('0x81'),_0x3c4c09['params']['id']['toString']())))[_0x97f5('0x9f')]();break;default:_0x23f6a5=squel['insert']()[_0x97f5('0x99')]('cm_hopper')[_0x97f5('0xaa')]([_0x97f5('0x9b'),_0x97f5('0x9e'),_0x97f5('0x9c'),_0x97f5('0xa0'),_0x97f5('0x63'),_0x97f5('0x58'),_0x97f5('0x59')],squel['select']()[_0x97f5('0x7d')](_0x97f5('0x9b'),_0x97f5('0x9b'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27',_0x97f5('0x9e'))[_0x97f5('0x7d')]('id',_0x97f5('0x9c'))['field'](_0xe33084[_0x97f5('0xa5')][_0x97f5('0x9f')](),_0x97f5('0xa0'))['field'](_0x3c4c09[_0x97f5('0x4b')]['id'][_0x97f5('0x9f')](),_0x97f5('0x63'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27',_0x97f5('0x58'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27','updatedAt')['from']('cm_contacts')[_0x97f5('0x41')]('deletedAt\x20IS\x20NULL')[_0x97f5('0x41')](_0x97f5('0xa4'),_0xe33084[_0x97f5('0xa5')]['toString']())[_0x97f5('0x41')](_0x97f5('0xab')))['toString']();}_0x481009[_0x97f5('0x82')](db[_0x97f5('0x83')][_0x97f5('0x36')](_0x23f6a5));}return BPromise['all'](_0x481009);}})['then'](function(){var _0xc1259e=[];var _0x5ba313=squel[_0x97f5('0x98')]()[_0x97f5('0x99')]('cm_hopper_additional_phones')[_0x97f5('0xaa')](['CmHopperId',_0x97f5('0x9b'),_0x97f5('0xad'),_0x97f5('0x58'),_0x97f5('0x59')],squel['select']()[_0x97f5('0x7d')](_0x97f5('0xae'))[_0x97f5('0x7d')](_0x97f5('0xaf'))['field'](_0x97f5('0xb0'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27',_0x97f5('0x58'))[_0x97f5('0x7d')]('\x27'+_0x3bb818+'\x27','updatedAt')[_0x97f5('0xa1')](_0x97f5('0xb1'),'ci')[_0x97f5('0xb2')](_0x97f5('0x9a'),'h',_0x97f5('0xb3'))[_0x97f5('0x41')](_0x97f5('0xb4'),_0x3bb818)[_0x97f5('0x41')](_0x97f5('0xb5'),_0x97f5('0xb6')))[_0x97f5('0x9f')]();_0xc1259e[_0x97f5('0x82')](db[_0x97f5('0x83')]['query'](_0x5ba313));return BPromise[_0x97f5('0xb7')](_0xc1259e);})[_0x97f5('0x25')](function(){return _0x11e20b;})['then'](respondWithResult(_0x29f936,null))[_0x97f5('0x49')](handleError(_0x29f936,null));};exports[_0x97f5('0xb8')]=function(_0x263b84,_0x4bdef5,_0x362f57){return db[_0x97f5('0x44')][_0x97f5('0x2e')]({'where':{'id':_0x263b84['params']['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0x4bdef5,null))[_0x97f5('0x25')](function(_0x522d84){if(_0x522d84){return _0x522d84['removeLists'](_0x263b84['query'][_0x97f5('0x7c')]);}})[_0x97f5('0x25')](function(_0x273bad){if(_0x273bad){return db[_0x97f5('0x5e')][_0x97f5('0x26')]({'where':{'ListId':_0x263b84['query'][_0x97f5('0x7c')],'VoiceQueueId':_0x263b84['params']['id']}})[_0x97f5('0x25')](function(){return _0x273bad;});}})[_0x97f5('0x25')](respondWithStatusCode(_0x4bdef5,null))[_0x97f5('0x49')](handleError(_0x4bdef5,null));};exports[_0x97f5('0xb9')]=function(_0x447c13,_0x4ccda0,_0x34c82f){var _0x7d0985={};var _0x312968={};var _0x4cfa27;var _0x6968e0;return db[_0x97f5('0x44')][_0x97f5('0x5d')]({'where':{'id':_0x447c13[_0x97f5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ccda0,null))[_0x97f5('0x25')](function(_0x568cce){if(_0x568cce){_0x4cfa27=_0x568cce;_0x312968[_0x97f5('0x39')]=_[_0x97f5('0x4c')](db[_0x97f5('0x95')][_0x97f5('0x56')]);_0x312968[_0x97f5('0x36')]=_[_0x97f5('0x4c')](_0x447c13[_0x97f5('0x36')]);_0x312968[_0x97f5('0x37')]=_[_0x97f5('0x38')](_0x312968['model'],_0x312968['query']);_0x7d0985[_0x97f5('0x3a')]=_['intersection'](_0x312968[_0x97f5('0x39')],qs[_0x97f5('0x3b')](_0x447c13['query']['fields']));_0x7d0985[_0x97f5('0x3a')]=_0x7d0985[_0x97f5('0x3a')][_0x97f5('0x3c')]?_0x7d0985[_0x97f5('0x3a')]:_0x312968[_0x97f5('0x39')];_0x7d0985[_0x97f5('0x3f')]=qs[_0x97f5('0x40')](_0x447c13[_0x97f5('0x36')][_0x97f5('0x40')]);_0x7d0985[_0x97f5('0x41')]=qs['filters'](_['pick'](_0x447c13[_0x97f5('0x36')],_0x312968[_0x97f5('0x37')]));if(_0x447c13[_0x97f5('0x36')][_0x97f5('0x2a')]){_0x7d0985[_0x97f5('0x41')]=_[_0x97f5('0x42')](_0x7d0985[_0x97f5('0x41')],{'$or':_[_0x97f5('0x60')](_0x7d0985['attributes'],function(_0x1060a1){var _0x21c64f={};_0x21c64f[_0x1060a1]={'$like':'%'+_0x447c13[_0x97f5('0x36')]['filter']+'%'};return _0x21c64f;})});}_0x7d0985=_[_0x97f5('0x42')]({},_0x7d0985,_0x447c13[_0x97f5('0x43')]);return _0x4cfa27[_0x97f5('0xb9')](_0x7d0985);}})[_0x97f5('0x25')](function(_0x4d0851){if(_0x4d0851){_0x6968e0=_0x4d0851[_0x97f5('0x3c')];if(!_0x447c13[_0x97f5('0x36')][_0x97f5('0x3d')](_0x97f5('0x3e'))){_0x7d0985[_0x97f5('0x1f')]=qs[_0x97f5('0x1f')](_0x447c13[_0x97f5('0x36')][_0x97f5('0x1f')]);_0x7d0985['offset']=qs[_0x97f5('0x1d')](_0x447c13[_0x97f5('0x36')][_0x97f5('0x1d')]);}return _0x4cfa27[_0x97f5('0xb9')](_0x7d0985);}})[_0x97f5('0x25')](function(_0x55c8af){if(_0x55c8af){return _0x55c8af?{'count':_0x6968e0,'rows':_0x55c8af}:null;}})[_0x97f5('0x25')](respondWithResult(_0x4ccda0,null))[_0x97f5('0x49')](handleError(_0x4ccda0,null));};exports[_0x97f5('0xba')]=function(_0x4a8516,_0xd6cc29,_0xc19f45){var _0x457b65,_0x70a5a8;return db[_0x97f5('0x44')][_0x97f5('0x2e')]({'where':{'id':_0x4a8516[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](handleEntityNotFound(_0xd6cc29,null))[_0x97f5('0x25')](function(_0x4351a7){if(_0x4351a7){_0x70a5a8=_0x4351a7;return _0x4351a7[_0x97f5('0xba')](_0x4a8516[_0x97f5('0x4e')][_0x97f5('0x7c')],_[_0x97f5('0x57')](_0x4a8516[_0x97f5('0x4e')],[_0x97f5('0x7c'),'id'])||{});}return null;})[_0x97f5('0x8d')](function(_0x45c0be){var _0x14f34e;_0x457b65=_0x45c0be||[];var _0x269998=[];if(_0x45c0be){for(var _0x2adcd2=0x0;_0x2adcd2<_0x45c0be['length'];_0x2adcd2+=0x1){var _0x5b0cb9=_0x45c0be[_0x2adcd2]['get']({'plain':!![]});_0x14f34e=squel[_0x97f5('0x98')]()['into'](_0x97f5('0xbb'))[_0x97f5('0xaa')]([_0x97f5('0x9b'),_0x97f5('0x9c'),_0x97f5('0xa0'),_0x97f5('0x63'),_0x97f5('0x58'),'updatedAt'],squel[_0x97f5('0x9d')]()[_0x97f5('0x7d')](_0x97f5('0x9b'),_0x97f5('0x9b'))[_0x97f5('0x7d')]('id','ContactId')[_0x97f5('0x7d')](_0x5b0cb9[_0x97f5('0xa5')]['toString'](),_0x97f5('0xa0'))[_0x97f5('0x7d')](_0x4a8516['params']['id'][_0x97f5('0x9f')](),_0x97f5('0x63'))[_0x97f5('0x7d')](_0x97f5('0xbc'),'createdAt')[_0x97f5('0x7d')](_0x97f5('0xbc'),_0x97f5('0x59'))['from'](_0x97f5('0xa2'))[_0x97f5('0x41')](_0x97f5('0xa3'))['where'](_0x97f5('0xa4'),_0x5b0cb9[_0x97f5('0xa5')][_0x97f5('0x9f')]())[_0x97f5('0x41')](_0x97f5('0xab')))[_0x97f5('0x9f')]();_0x269998[_0x97f5('0x82')](db[_0x97f5('0x83')][_0x97f5('0x36')](_0x14f34e));}return BPromise['all'](_0x269998);}})[_0x97f5('0x25')](function(){return _0x457b65;})[_0x97f5('0x25')](respondWithResult(_0xd6cc29,null))['catch'](handleError(_0xd6cc29,null));};exports[_0x97f5('0xbd')]=function(_0x3e4932,_0x52638b,_0x29ca1b){return db[_0x97f5('0x44')]['find']({'where':{'id':_0x3e4932[_0x97f5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x52638b,null))[_0x97f5('0x25')](function(_0x53943f){if(_0x53943f){return _0x53943f[_0x97f5('0xbd')](_0x3e4932[_0x97f5('0x36')][_0x97f5('0x7c')]);}})[_0x97f5('0x25')](function(_0x228691){if(_0x228691){return db[_0x97f5('0x66')][_0x97f5('0x26')]({'where':{'ListId':_0x3e4932[_0x97f5('0x36')][_0x97f5('0x7c')],'VoiceQueueId':_0x3e4932[_0x97f5('0x4b')]['id']}})[_0x97f5('0x25')](function(){return _0x228691;});}})[_0x97f5('0x25')](respondWithStatusCode(_0x52638b,null))[_0x97f5('0x49')](handleError(_0x52638b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index a162cc6..2ebcb72 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 _0x6b86=['VoiceQueue','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x5d723a,_0x2c45eb){var _0x298403=function(_0x3fb6eb){while(--_0x3fb6eb){_0x5d723a['push'](_0x5d723a['shift']());}};_0x298403(++_0x2c45eb);}(_0x6b86,0xc7));var _0x66b8=function(_0x219daf,_0x36b307){_0x219daf=_0x219daf-0x0;var _0x4c2e61=_0x6b86[_0x219daf];return _0x4c2e61;};'use strict';var EventEmitter=require(_0x66b8('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x66b8('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x66b8('0x2')](0x0);var events={'afterCreate':_0x66b8('0x3'),'afterUpdate':_0x66b8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b3c4c){return function(_0x1ec49b,_0x4726c8,_0x28977b){VoiceQueueEvents[_0x66b8('0x5')](_0x3b3c4c+':'+_0x1ec49b['id'],_0x1ec49b);VoiceQueueEvents[_0x66b8('0x5')](_0x3b3c4c,_0x1ec49b);_0x28977b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x66b8('0x6')](e,emitEvent(event));}}module[_0x66b8('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x2ce2=['events','../../mysqldb','VoiceQueue','save','hasOwnProperty','hook','exports'];(function(_0x62a878,_0x25cf28){var _0x3094a0=function(_0x3246e2){while(--_0x3246e2){_0x62a878['push'](_0x62a878['shift']());}};_0x3094a0(++_0x25cf28);}(_0x2ce2,0x15e));var _0x22ce=function(_0xb0975b,_0x93b0d6){_0xb0975b=_0xb0975b-0x0;var _0x320d30=_0x2ce2[_0xb0975b];return _0x320d30;};'use strict';var EventEmitter=require(_0x22ce('0x0'));var VoiceQueue=require(_0x22ce('0x1'))['db'][_0x22ce('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x22ce('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3aa911){return function(_0x666dd9,_0x29367c,_0x592cbb){VoiceQueueEvents['emit'](_0x3aa911+':'+_0x666dd9['id'],_0x666dd9);VoiceQueueEvents['emit'](_0x3aa911,_0x666dd9);_0x592cbb(null);};}for(var e in events){if(events[_0x22ce('0x4')](e)){var event=events[e];VoiceQueue[_0x22ce('0x5')](e,emitEvent(event));}}module[_0x22ce('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 07ab7dd..7139a89 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x399cc3,_0xee5ff7){var _0x1da99c=function(_0xe9c616){while(--_0xe9c616){_0x399cc3['push'](_0x399cc3['shift']());}};_0x1da99c(++_0xee5ff7);}(_0xedd9,0xfc));var _0x9edd=function(_0x577f91,_0x16d3cd){_0x577f91=_0x577f91-0x0;var _0x3a7144=_0xedd9[_0x577f91];return _0x3a7144;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x1e8f9e,_0x148061){var _0x2cec83=function(_0x55d9ee){while(--_0x55d9ee){_0x1e8f9e['push'](_0x1e8f9e['shift']());}};_0x2cec83(++_0x148061);}(_0x008c,0x188));var _0xc008=function(_0x20d9f0,_0x453415){_0x20d9f0=_0x20d9f0-0x0;var _0x195dda=_0x008c[_0x20d9f0];return _0x195dda;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 7cf2bb4..c06cf03 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 _0xaddd=['VoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceQueue','catch','ShowVoiceQueue','find','util','moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1314c7,_0x410cae){var _0x2717b9=function(_0xeec829){while(--_0xeec829){_0x1314c7['push'](_0x1314c7['shift']());}};_0x2717b9(++_0x410cae);}(_0xaddd,0x1d6));var _0xdadd=function(_0x29311d,_0x3f9e23){_0x29311d=_0x29311d-0x0;var _0xa29b8f=_0xaddd[_0x29311d];return _0xa29b8f;};'use strict';var _=require('lodash');var util=require(_0xdadd('0x0'));var moment=require(_0xdadd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdadd('0x2'));var db=require(_0xdadd('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdadd('0x4'));var jayson=require(_0xdadd('0x5'));var client=jayson['client'][_0xdadd('0x6')]({'port':0x232a});config[_0xdadd('0x7')]=_[_0xdadd('0x8')](config[_0xdadd('0x7')],{'host':_0xdadd('0x9'),'port':0x18eb});var socket=require(_0xdadd('0xa'))(new Redis(config[_0xdadd('0x7')]));require(_0xdadd('0xb'))['register'](socket);function respondWithRpcPromise(_0x4dc4c7,_0x210f39,_0x291811){return new BPromise(function(_0xc2b018,_0x56b4c2){return client[_0xdadd('0xc')](_0x4dc4c7,_0x291811)[_0xdadd('0xd')](function(_0x41995b){logger['info'](_0xdadd('0xe'),_0x210f39,_0xdadd('0xf'));logger[_0xdadd('0x10')](_0xdadd('0x11'),_0x210f39,_0xdadd('0xf'),JSON[_0xdadd('0x12')](_0x41995b));if(_0x41995b[_0xdadd('0x13')]){if(_0x41995b['error'][_0xdadd('0x14')]===0x1f4){logger[_0xdadd('0x13')](_0xdadd('0xe'),_0x210f39,_0x41995b[_0xdadd('0x13')]['message']);return _0x56b4c2(_0x41995b[_0xdadd('0x13')][_0xdadd('0x15')]);}logger[_0xdadd('0x13')](_0xdadd('0xe'),_0x210f39,_0x41995b['error'][_0xdadd('0x15')]);return _0xc2b018(_0x41995b[_0xdadd('0x13')][_0xdadd('0x15')]);}else{logger[_0xdadd('0x16')](_0xdadd('0xe'),_0x210f39,'request\x20sent');_0xc2b018(_0x41995b[_0xdadd('0x17')][_0xdadd('0x15')]);}})['catch'](function(_0x1f6a2a){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x210f39,_0x1f6a2a);_0x56b4c2(_0x1f6a2a);});});}exports['GetVoiceQueue']=function(_0x5bf8cc){var _0x46c291=this;return new Promise(function(_0x4eeec0,_0x319317){return db[_0xdadd('0x18')][_0xdadd('0x19')]({'raw':_0x5bf8cc[_0xdadd('0x1a')]?_0x5bf8cc[_0xdadd('0x1a')][_0xdadd('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bf8cc['options']?_0x5bf8cc[_0xdadd('0x1a')][_0xdadd('0x1c')]||null:null,'attributes':_0x5bf8cc[_0xdadd('0x1a')]?_0x5bf8cc['options'][_0xdadd('0x1d')]||null:null,'limit':_0x5bf8cc[_0xdadd('0x1a')]?_0x5bf8cc['options'][_0xdadd('0x1e')]||null:null,'include':_0x5bf8cc[_0xdadd('0x1a')]?_0x5bf8cc[_0xdadd('0x1a')]['include']?_[_0xdadd('0x1f')](_0x5bf8cc[_0xdadd('0x1a')]['include'],function(_0x116fa6){return{'model':db[_0x116fa6['model']],'as':_0x116fa6['as'],'attributes':_0x116fa6[_0xdadd('0x1d')],'include':_0x116fa6[_0xdadd('0x20')]?_[_0xdadd('0x1f')](_0x116fa6[_0xdadd('0x20')],function(_0x4216eb){return{'model':db[_0x4216eb[_0xdadd('0x21')]],'as':_0x4216eb['as'],'attributes':_0x4216eb[_0xdadd('0x1d')],'include':_0x4216eb[_0xdadd('0x20')]?_[_0xdadd('0x1f')](_0x4216eb[_0xdadd('0x20')],function(_0x40c007){return{'model':db[_0x40c007[_0xdadd('0x21')]],'as':_0x40c007['as'],'attributes':_0x40c007['attributes']};}):[]};}):[]};}):[]:[]})[_0xdadd('0xd')](function(_0x4abc2b){logger[_0xdadd('0x16')](_0xdadd('0x22'),_0x5bf8cc);logger[_0xdadd('0x10')]('GetVoiceQueue',_0x5bf8cc,JSON['stringify'](_0x4abc2b));_0x4eeec0(_0x4abc2b);})[_0xdadd('0x23')](function(_0x2990ad){logger[_0xdadd('0x13')](_0xdadd('0x22'),_0x2990ad[_0xdadd('0x15')],_0x5bf8cc);_0x319317(_0x46c291['error'](0x1f4,_0x2990ad[_0xdadd('0x15')]));});});};exports[_0xdadd('0x24')]=function(_0x2ab2b2){var _0x5574c7=this;return new Promise(function(_0x34f238,_0x4b3276){return db[_0xdadd('0x18')][_0xdadd('0x25')]({'raw':_0x2ab2b2[_0xdadd('0x1a')]?_0x2ab2b2[_0xdadd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ab2b2[_0xdadd('0x1a')]?_0x2ab2b2['options'][_0xdadd('0x1c')]||null:null,'attributes':_0x2ab2b2[_0xdadd('0x1a')]?_0x2ab2b2[_0xdadd('0x1a')][_0xdadd('0x1d')]||null:null,'include':_0x2ab2b2['options']?_0x2ab2b2[_0xdadd('0x1a')][_0xdadd('0x20')]?_['map'](_0x2ab2b2[_0xdadd('0x1a')][_0xdadd('0x20')],function(_0x427f84){return{'model':db[_0x427f84['model']],'as':_0x427f84['as'],'attributes':_0x427f84[_0xdadd('0x1d')],'include':_0x427f84['include']?_[_0xdadd('0x1f')](_0x427f84[_0xdadd('0x20')],function(_0x2ce06b){return{'model':db[_0x2ce06b[_0xdadd('0x21')]],'as':_0x2ce06b['as'],'attributes':_0x2ce06b['attributes'],'include':_0x2ce06b[_0xdadd('0x20')]?_[_0xdadd('0x1f')](_0x2ce06b[_0xdadd('0x20')],function(_0x137845){return{'model':db[_0x137845[_0xdadd('0x21')]],'as':_0x137845['as'],'attributes':_0x137845[_0xdadd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdadd('0xd')](function(_0x1fa323){logger[_0xdadd('0x16')](_0xdadd('0x24'),_0x2ab2b2);logger[_0xdadd('0x10')]('ShowVoiceQueue',_0x2ab2b2,JSON[_0xdadd('0x12')](_0x1fa323));_0x34f238(_0x1fa323);})[_0xdadd('0x23')](function(_0x1d3071){logger[_0xdadd('0x13')](_0xdadd('0x24'),_0x1d3071[_0xdadd('0x15')],_0x2ab2b2);_0x4b3276(_0x5574c7[_0xdadd('0x13')](0x1f4,_0x1d3071[_0xdadd('0x15')]));});});}; \ No newline at end of file +var _0x16eb=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','map','model','include','then','ShowVoiceQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16eb,0x141));var _0xb16e=function(_0x3d87fe,_0x552b4a){_0x3d87fe=_0x3d87fe-0x0;var _0x286c5f=_0x16eb[_0x3d87fe];return _0x286c5f;};'use strict';var _=require(_0xb16e('0x0'));var util=require(_0xb16e('0x1'));var moment=require(_0xb16e('0x2'));var BPromise=require(_0xb16e('0x3'));var rs=require(_0xb16e('0x4'));var fs=require('fs');var Redis=require(_0xb16e('0x5'));var db=require(_0xb16e('0x6'))['db'];var utils=require(_0xb16e('0x7'));var logger=require(_0xb16e('0x8'))('rpc');var config=require(_0xb16e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb16e('0xa')][_0xb16e('0xb')]({'port':0x232a});config[_0xb16e('0xc')]=_[_0xb16e('0xd')](config[_0xb16e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb16e('0xe'))(new Redis(config[_0xb16e('0xc')]));require(_0xb16e('0xf'))[_0xb16e('0x10')](socket);function respondWithRpcPromise(_0x11253a,_0x37427a,_0xc2d317){return new BPromise(function(_0x534c08,_0x3eedfa){return client[_0xb16e('0x11')](_0x11253a,_0xc2d317)['then'](function(_0x3822d6){logger['info'](_0xb16e('0x12'),_0x37427a,_0xb16e('0x13'));logger[_0xb16e('0x14')](_0xb16e('0x15'),_0x37427a,_0xb16e('0x13'),JSON[_0xb16e('0x16')](_0x3822d6));if(_0x3822d6[_0xb16e('0x17')]){if(_0x3822d6[_0xb16e('0x17')][_0xb16e('0x18')]===0x1f4){logger[_0xb16e('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x37427a,_0x3822d6[_0xb16e('0x17')][_0xb16e('0x19')]);return _0x3eedfa(_0x3822d6[_0xb16e('0x17')][_0xb16e('0x19')]);}logger[_0xb16e('0x17')](_0xb16e('0x12'),_0x37427a,_0x3822d6[_0xb16e('0x17')]['message']);return _0x534c08(_0x3822d6['error'][_0xb16e('0x19')]);}else{logger[_0xb16e('0x1a')](_0xb16e('0x12'),_0x37427a,'request\x20sent');_0x534c08(_0x3822d6[_0xb16e('0x1b')][_0xb16e('0x19')]);}})[_0xb16e('0x1c')](function(_0x2f930c){logger[_0xb16e('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x37427a,_0x2f930c);_0x3eedfa(_0x2f930c);});});}exports[_0xb16e('0x1d')]=function(_0x5bf175){var _0xd2f6b2=this;return new Promise(function(_0x2f641b,_0x3f859f){return db[_0xb16e('0x1e')]['findAll']({'raw':_0x5bf175[_0xb16e('0x1f')]?_0x5bf175[_0xb16e('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5bf175[_0xb16e('0x1f')]?_0x5bf175[_0xb16e('0x1f')][_0xb16e('0x20')]||null:null,'attributes':_0x5bf175[_0xb16e('0x1f')]?_0x5bf175[_0xb16e('0x1f')][_0xb16e('0x21')]||null:null,'limit':_0x5bf175[_0xb16e('0x1f')]?_0x5bf175[_0xb16e('0x1f')]['limit']||null:null,'include':_0x5bf175[_0xb16e('0x1f')]?_0x5bf175[_0xb16e('0x1f')]['include']?_[_0xb16e('0x22')](_0x5bf175['options']['include'],function(_0x339539){return{'model':db[_0x339539[_0xb16e('0x23')]],'as':_0x339539['as'],'attributes':_0x339539['attributes'],'include':_0x339539[_0xb16e('0x24')]?_[_0xb16e('0x22')](_0x339539['include'],function(_0x449ab7){return{'model':db[_0x449ab7[_0xb16e('0x23')]],'as':_0x449ab7['as'],'attributes':_0x449ab7['attributes'],'include':_0x449ab7[_0xb16e('0x24')]?_[_0xb16e('0x22')](_0x449ab7[_0xb16e('0x24')],function(_0x23cea0){return{'model':db[_0x23cea0['model']],'as':_0x23cea0['as'],'attributes':_0x23cea0[_0xb16e('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb16e('0x25')](function(_0x401d4a){logger[_0xb16e('0x1a')](_0xb16e('0x1d'),_0x5bf175);logger[_0xb16e('0x14')](_0xb16e('0x1d'),_0x5bf175,JSON['stringify'](_0x401d4a));_0x2f641b(_0x401d4a);})['catch'](function(_0x2ac021){logger[_0xb16e('0x17')]('GetVoiceQueue',_0x2ac021[_0xb16e('0x19')],_0x5bf175);_0x3f859f(_0xd2f6b2[_0xb16e('0x17')](0x1f4,_0x2ac021['message']));});});};exports[_0xb16e('0x26')]=function(_0x3d1a71){var _0x56eafc=this;return new Promise(function(_0x321011,_0x20b24f){return db[_0xb16e('0x1e')][_0xb16e('0x27')]({'raw':_0x3d1a71['options']?_0x3d1a71[_0xb16e('0x1f')][_0xb16e('0x28')]===undefined?!![]:![]:!![],'where':_0x3d1a71[_0xb16e('0x1f')]?_0x3d1a71['options'][_0xb16e('0x20')]||null:null,'attributes':_0x3d1a71[_0xb16e('0x1f')]?_0x3d1a71[_0xb16e('0x1f')][_0xb16e('0x21')]||null:null,'include':_0x3d1a71[_0xb16e('0x1f')]?_0x3d1a71['options'][_0xb16e('0x24')]?_[_0xb16e('0x22')](_0x3d1a71['options']['include'],function(_0x520617){return{'model':db[_0x520617[_0xb16e('0x23')]],'as':_0x520617['as'],'attributes':_0x520617['attributes'],'include':_0x520617[_0xb16e('0x24')]?_[_0xb16e('0x22')](_0x520617[_0xb16e('0x24')],function(_0x1e1738){return{'model':db[_0x1e1738[_0xb16e('0x23')]],'as':_0x1e1738['as'],'attributes':_0x1e1738[_0xb16e('0x21')],'include':_0x1e1738['include']?_[_0xb16e('0x22')](_0x1e1738[_0xb16e('0x24')],function(_0x235e2f){return{'model':db[_0x235e2f[_0xb16e('0x23')]],'as':_0x235e2f['as'],'attributes':_0x235e2f[_0xb16e('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb16e('0x25')](function(_0x5ba165){logger[_0xb16e('0x1a')](_0xb16e('0x26'),_0x3d1a71);logger[_0xb16e('0x14')](_0xb16e('0x26'),_0x3d1a71,JSON[_0xb16e('0x16')](_0x5ba165));_0x321011(_0x5ba165);})[_0xb16e('0x1c')](function(_0x26f817){logger[_0xb16e('0x17')](_0xb16e('0x26'),_0x26f817['message'],_0x3d1a71);_0x20b24f(_0x56eafc[_0xb16e('0x17')](0x1f4,_0x26f817['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ed9d167..dae9d6e 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 _0xe023=['update','emit','removeListener','register','length','voiceQueue:','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe023,0x1ce));var _0x3e02=function(_0x1a4812,_0x41cd1d){_0x1a4812=_0x1a4812-0x0;var _0x3ab60d=_0xe023[_0x1a4812];return _0x3ab60d;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x3e02('0x0'),_0x3e02('0x1'),_0x3e02('0x2')];function createListener(_0x2d557d,_0x220c20){return function(_0x5376c7){_0x220c20[_0x3e02('0x3')](_0x2d557d,_0x5376c7);};}function removeListener(_0x223154,_0x33c652){return function(){VoiceQueueEvents[_0x3e02('0x4')](_0x223154,_0x33c652);};}exports[_0x3e02('0x5')]=function(_0x271262){for(var _0x4dd02c=0x0,_0x2229be=events[_0x3e02('0x6')];_0x4dd02c<_0x2229be;_0x4dd02c++){var _0x147f26=events[_0x4dd02c];var _0x174541=createListener(_0x3e02('0x7')+_0x147f26,_0x271262);VoiceQueueEvents['on'](_0x147f26,_0x174541);}}; \ No newline at end of file +var _0x81b2=['length','voiceQueue:','./voiceQueue.events','save','remove','update','removeListener','register'];(function(_0x2eda08,_0x3fde24){var _0x5ddfa6=function(_0x2708c3){while(--_0x2708c3){_0x2eda08['push'](_0x2eda08['shift']());}};_0x5ddfa6(++_0x3fde24);}(_0x81b2,0x8a));var _0x281b=function(_0x331e77,_0x114123){_0x331e77=_0x331e77-0x0;var _0x5b1b95=_0x81b2[_0x331e77];return _0x5b1b95;};'use strict';var VoiceQueueEvents=require(_0x281b('0x0'));var events=[_0x281b('0x1'),_0x281b('0x2'),_0x281b('0x3')];function createListener(_0x4dca69,_0x425c51){return function(_0x1337fb){_0x425c51['emit'](_0x4dca69,_0x1337fb);};}function removeListener(_0x27bdfd,_0x2ba8b5){return function(){VoiceQueueEvents[_0x281b('0x4')](_0x27bdfd,_0x2ba8b5);};}exports[_0x281b('0x5')]=function(_0x4db75b){for(var _0x4e277a=0x0,_0x17d568=events[_0x281b('0x6')];_0x4e277a<_0x17d568;_0x4e277a++){var _0x540d37=events[_0x4e277a];var _0x37f085=createListener(_0x281b('0x7')+_0x540d37,_0x4db75b);VoiceQueueEvents['on'](_0x540d37,_0x37f085);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 019fab8..d330e0d 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 _0xefb0=['/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','describe','/index','getVoiceQueuesReport'];(function(_0x59f0e4,_0x20ec7d){var _0x24ef0f=function(_0x58055a){while(--_0x58055a){_0x59f0e4['push'](_0x59f0e4['shift']());}};_0x24ef0f(++_0x20ec7d);}(_0xefb0,0x143));var _0x0efb=function(_0x412b58,_0x25aef3){_0x412b58=_0x412b58-0x0;var _0x5265b5=_0xefb0[_0x412b58];return _0x5265b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0efb('0x0'));var timeout=require(_0x0efb('0x1'));var express=require(_0x0efb('0x2'));var router=express['Router']();var fs_extra=require(_0x0efb('0x3'));var auth=require(_0x0efb('0x4'));var interaction=require(_0x0efb('0x5'));var config=require(_0x0efb('0x6'));var controller=require(_0x0efb('0x7'));router['get']('/',auth[_0x0efb('0x8')](),controller['index']);router[_0x0efb('0x9')]('/describe',auth[_0x0efb('0x8')](),controller[_0x0efb('0xa')]);router['get'](_0x0efb('0xb'),auth[_0x0efb('0x8')](),controller[_0x0efb('0xc')]);router[_0x0efb('0x9')](_0x0efb('0xd'),auth[_0x0efb('0x8')](),controller[_0x0efb('0xe')]);router[_0x0efb('0xf')]('/',auth[_0x0efb('0x8')](),controller['create']);router[_0x0efb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0efb('0x11')]);router[_0x0efb('0x12')](_0x0efb('0xd'),auth[_0x0efb('0x8')](),controller[_0x0efb('0x13')]);module[_0x0efb('0x14')]=router; \ No newline at end of file +var _0x01bb=['util','connect-timeout','express','Router','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','/describe','/index','getVoiceQueuesReport','show','post','put','/:id','delete','destroy','multer'];(function(_0x125741,_0x4a771d){var _0x421ff0=function(_0x179bd0){while(--_0x179bd0){_0x125741['push'](_0x125741['shift']());}};_0x421ff0(++_0x4a771d);}(_0x01bb,0x19d));var _0xb01b=function(_0x1d6243,_0x236f2a){_0x1d6243=_0x1d6243-0x0;var _0x5a9425=_0x01bb[_0x1d6243];return _0x5a9425;};'use strict';var multer=require(_0xb01b('0x0'));var util=require(_0xb01b('0x1'));var path=require('path');var timeout=require(_0xb01b('0x2'));var express=require(_0xb01b('0x3'));var router=express[_0xb01b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb01b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb01b('0x6'));router[_0xb01b('0x7')]('/',auth[_0xb01b('0x8')](),controller['index']);router[_0xb01b('0x7')](_0xb01b('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xb01b('0x7')](_0xb01b('0xa'),auth['isAuthenticated'](),controller[_0xb01b('0xb')]);router[_0xb01b('0x7')]('/:id',auth[_0xb01b('0x8')](),controller[_0xb01b('0xc')]);router[_0xb01b('0xd')]('/',auth[_0xb01b('0x8')](),controller['create']);router[_0xb01b('0xe')](_0xb01b('0xf'),auth[_0xb01b('0x8')](),controller['update']);router[_0xb01b('0x10')](_0xb01b('0xf'),auth[_0xb01b('0x8')](),controller[_0xb01b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 48c8616..86565ce 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 _0xf287=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','moment','STRING','DATE','getDataValue','format'];(function(_0x3595ba,_0x1ba0b7){var _0x335d51=function(_0x3cb7cc){while(--_0x3cb7cc){_0x3595ba['push'](_0x3595ba['shift']());}};_0x335d51(++_0x1ba0b7);}(_0xf287,0x193));var _0x7f28=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf287[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7f28('0x0'));module['exports']={'type':{'type':Sequelize[_0x7f28('0x1')]},'uniqueid':{'type':Sequelize[_0x7f28('0x1')]},'calleridnum':{'type':Sequelize[_0x7f28('0x1')]},'calleridname':{'type':Sequelize[_0x7f28('0x1')]},'queue':{'type':Sequelize[_0x7f28('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x7f28('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x7f28('0x2')],'set':function(_0x302fe9){var _0x46200e=moment(_0x302fe9);var _0x2bfaca=moment(this[_0x7f28('0x3')]('queuecallerjoinAt'))[_0x7f28('0x4')]('YYYY-MM-DD\x20HH:mm:ss');var _0x31b63f=_0x46200e[_0x7f28('0x5')](_0x2bfaca,_0x7f28('0x6'));this[_0x7f28('0x7')](_0x7f28('0x8'),_0x302fe9);this[_0x7f28('0x7')](_0x7f28('0x9'),_0x31b63f||null);}},'position':{'type':Sequelize[_0x7f28('0xa')]},'count':{'type':Sequelize[_0x7f28('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x7f28('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x7f28('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7f28('0x2')]},'queuecallerexit':{'type':Sequelize[_0x7f28('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7f28('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x7f28('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7f28('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7f28('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7f28('0x1')]},'context':{'type':Sequelize[_0x7f28('0x1')]},'exten':{'type':Sequelize[_0x7f28('0x1')]},'priority':{'type':Sequelize[_0x7f28('0x1')]},'holdtime':{'type':Sequelize[_0x7f28('0xa')]},'mohtime':{'type':Sequelize[_0x7f28('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7f28('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7f28('0x1')]},'transfer':{'type':Sequelize[_0x7f28('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7f28('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x7f28('0x1')]},'secondDisposition':{'type':Sequelize[_0x7f28('0x1')]},'thirdDisposition':{'type':Sequelize[_0x7f28('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x7f28('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x7f28('0x1')]}}; \ No newline at end of file +var _0x67e1=['sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x51f5c5,_0xcc986a){var _0x5d5363=function(_0x107528){while(--_0x107528){_0x51f5c5['push'](_0x51f5c5['shift']());}};_0x5d5363(++_0xcc986a);}(_0x67e1,0x1f0));var _0x167e=function(_0x45aa68,_0x3669d4){_0x45aa68=_0x45aa68-0x0;var _0x4d1665=_0x67e1[_0x45aa68];return _0x4d1665;};'use strict';var Sequelize=require(_0x167e('0x0'));var moment=require(_0x167e('0x1'));module['exports']={'type':{'type':Sequelize[_0x167e('0x2')]},'uniqueid':{'type':Sequelize[_0x167e('0x2')]},'calleridnum':{'type':Sequelize[_0x167e('0x2')]},'calleridname':{'type':Sequelize[_0x167e('0x2')]},'queue':{'type':Sequelize[_0x167e('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x167e('0x3')],'set':function(_0x273f74){var _0xb82f8f=moment(_0x273f74);var _0x35d280=moment(this[_0x167e('0x4')](_0x167e('0x5')))[_0x167e('0x6')](_0x167e('0x7'));var _0x4f5ee2=_0xb82f8f[_0x167e('0x8')](_0x35d280,_0x167e('0x9'));this[_0x167e('0xa')](_0x167e('0xb'),_0x273f74);this[_0x167e('0xa')](_0x167e('0xc'),_0x4f5ee2||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x167e('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x167e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x167e('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x167e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x167e('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x167e('0x2')]},'context':{'type':Sequelize[_0x167e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x167e('0x2')]},'holdtime':{'type':Sequelize[_0x167e('0xd')]},'mohtime':{'type':Sequelize[_0x167e('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x167e('0x2')]},'transfer':{'type':Sequelize[_0x167e('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x167e('0xf')},'transferexten':{'type':Sequelize[_0x167e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x167e('0x2')]},'disposition':{'type':Sequelize[_0x167e('0x2')]},'secondDisposition':{'type':Sequelize[_0x167e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x167e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x167e('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 625f1a2..ab4fbd6 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 _0x896c=['describe','getVoiceQueuesReport','length','rows','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','intersection','find','catch','create','body'];(function(_0x380498,_0x51b6ae){var _0x2e0dfe=function(_0x172e97){while(--_0x172e97){_0x380498['push'](_0x380498['shift']());}};_0x2e0dfe(++_0x51b6ae);}(_0x896c,0xf7));var _0xc896=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0x896c[_0x421c56];return _0x49b244;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc896('0x0'));var zipdir=require(_0xc896('0x1'));var jsonpatch=require(_0xc896('0x2'));var rp=require(_0xc896('0x3'));var moment=require('moment');var BPromise=require(_0xc896('0x4'));var Mustache=require(_0xc896('0x5'));var util=require('util');var path=require(_0xc896('0x6'));var sox=require(_0xc896('0x7'));var csv=require('to-csv');var ejs=require(_0xc896('0x8'));var fs=require('fs');var fs_extra=require(_0xc896('0x9'));var _=require(_0xc896('0xa'));var squel=require(_0xc896('0xb'));var crypto=require(_0xc896('0xc'));var jsforce=require(_0xc896('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc896('0xe'));var querystring=require('querystring');var Papa=require(_0xc896('0xf'));var Redis=require(_0xc896('0x10'));var authService=require(_0xc896('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc896('0x12'));var hardwareService=require(_0xc896('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc896('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc896('0x15'))['db'];config[_0xc896('0x16')]=_[_0xc896('0x17')](config[_0xc896('0x16')],{'host':_0xc896('0x18'),'port':0x18eb});var socket=require(_0xc896('0x19'))(new Redis(config[_0xc896('0x16')]));require(_0xc896('0x1a'))['register'](socket);function respondWithStatusCode(_0x48ae82,_0x55f42f){_0x55f42f=_0x55f42f||0xcc;return function(_0x26b3f7){if(_0x26b3f7){return _0x48ae82[_0xc896('0x1b')](_0x55f42f);}return _0x48ae82['status'](_0x55f42f)[_0xc896('0x1c')]();};}function respondWithResult(_0x3bbe20,_0xb073eb){_0xb073eb=_0xb073eb||0xc8;return function(_0x1e3259){if(_0x1e3259){return _0x3bbe20['status'](_0xb073eb)['json'](_0x1e3259);}};}function respondWithFilteredResult(_0x1dd67f,_0x2e6a4a){return function(_0x42fb6b){if(_0x42fb6b){var _0x277a24=typeof _0x2e6a4a[_0xc896('0x1d')]===_0xc896('0x1e')&&typeof _0x2e6a4a['limit']==='undefined';var _0x1b543b=_0x42fb6b[_0xc896('0x1f')];var _0x54b45d=_0x277a24?0x0:_0x2e6a4a[_0xc896('0x1d')];var _0x1f7477=_0x277a24?_0x42fb6b[_0xc896('0x1f')]:_0x2e6a4a[_0xc896('0x1d')]+_0x2e6a4a[_0xc896('0x20')];var _0x545afe;if(_0x1f7477>=_0x1b543b){_0x1f7477=_0x1b543b;_0x545afe=0xc8;}else{_0x545afe=0xce;}_0x1dd67f[_0xc896('0x21')](_0x545afe);return _0x1dd67f[_0xc896('0x22')](_0xc896('0x23'),_0x54b45d+'-'+_0x1f7477+'/'+_0x1b543b)[_0xc896('0x24')](_0x42fb6b);}return null;};}function patchUpdates(_0x1ad84e){return function(_0x1a7ab2){try{jsonpatch[_0xc896('0x25')](_0x1a7ab2,_0x1ad84e,!![]);}catch(_0x39db2f){return BPromise[_0xc896('0x26')](_0x39db2f);}return _0x1a7ab2[_0xc896('0x27')]();};}function saveUpdates(_0x4f38cd,_0x5e9372){return function(_0x33fcee){if(_0x33fcee){return _0x33fcee[_0xc896('0x28')](_0x4f38cd)[_0xc896('0x29')](function(_0x500b35){return _0x500b35;});}return null;};}function removeEntity(_0x5815d8,_0x5d5aa7){return function(_0x4d37b9){if(_0x4d37b9){return _0x4d37b9[_0xc896('0x2a')]()['then'](function(){_0x5815d8[_0xc896('0x21')](0xcc)[_0xc896('0x1c')]();});}};}function handleEntityNotFound(_0x4d138e,_0x31865b){return function(_0x75cd39){if(!_0x75cd39){_0x4d138e[_0xc896('0x1b')](0x194);}return _0x75cd39;};}function handleError(_0x31fb2b,_0x278987){_0x278987=_0x278987||0x1f4;return function(_0x26f92f){logger['error'](_0x26f92f[_0xc896('0x2b')]);if(_0x26f92f[_0xc896('0x2c')]){delete _0x26f92f[_0xc896('0x2c')];}_0x31fb2b[_0xc896('0x21')](_0x278987)[_0xc896('0x2d')](_0x26f92f);};}exports[_0xc896('0x2e')]=function(_0x32269a,_0x1e43d5){var _0x46c7da={},_0x821de9={},_0xa705b4={'count':0x0,'rows':[]};var _0x530140=_[_0xc896('0x2f')](db[_0xc896('0x30')][_0xc896('0x31')],function(_0x574fd6){return{'name':_0x574fd6[_0xc896('0x32')],'type':_0x574fd6[_0xc896('0x33')][_0xc896('0x34')]};});_0x821de9[_0xc896('0x35')]=_[_0xc896('0x2f')](_0x530140,_0xc896('0x2c'));_0x821de9['query']=_[_0xc896('0x36')](_0x32269a[_0xc896('0x37')]);_0x821de9[_0xc896('0x38')]=_['intersection'](_0x821de9[_0xc896('0x35')],_0x821de9['query']);_0x46c7da['attributes']=_['intersection'](_0x821de9[_0xc896('0x35')],qs[_0xc896('0x39')](_0x32269a[_0xc896('0x37')][_0xc896('0x39')]));_0x46c7da['attributes']=_0x46c7da[_0xc896('0x3a')]['length']?_0x46c7da['attributes']:_0x821de9[_0xc896('0x35')];if(!_0x32269a[_0xc896('0x37')]['hasOwnProperty'](_0xc896('0x3b'))){_0x46c7da[_0xc896('0x20')]=qs[_0xc896('0x20')](_0x32269a[_0xc896('0x37')][_0xc896('0x20')]);_0x46c7da[_0xc896('0x1d')]=qs[_0xc896('0x1d')](_0x32269a[_0xc896('0x37')]['offset']);}_0x46c7da[_0xc896('0x3c')]=qs[_0xc896('0x3d')](_0x32269a['query']['sort']);_0x46c7da['where']=qs[_0xc896('0x38')](_[_0xc896('0x3e')](_0x32269a['query'],_0x821de9['filters']),_0x530140);if(_0x32269a['query'][_0xc896('0x3f')]){_0x46c7da[_0xc896('0x40')]=_[_0xc896('0x41')](_0x46c7da[_0xc896('0x40')],{'$or':_['map'](_0x530140,function(_0x44f7bd){if(_0x44f7bd[_0xc896('0x33')]!=='VIRTUAL'){var _0x534cb7={};_0x534cb7[_0x44f7bd[_0xc896('0x2c')]]={'$like':'%'+_0x32269a[_0xc896('0x37')][_0xc896('0x3f')]+'%'};return _0x534cb7;}})});}_0x46c7da=_[_0xc896('0x41')]({},_0x46c7da,_0x32269a[_0xc896('0x42')]);var _0x5acb6a={'where':_0x46c7da[_0xc896('0x40')]};return db[_0xc896('0x30')][_0xc896('0x1f')](_0x5acb6a)[_0xc896('0x29')](function(_0x29ed04){_0xa705b4[_0xc896('0x1f')]=_0x29ed04;if(_0x32269a['query'][_0xc896('0x43')]){_0x46c7da[_0xc896('0x44')]=[{'all':!![]}];}return db[_0xc896('0x30')][_0xc896('0x45')](_0x46c7da);})[_0xc896('0x29')](function(_0x1f3c6e){_0xa705b4['rows']=_0x1f3c6e;return _0xa705b4;})[_0xc896('0x29')](respondWithFilteredResult(_0x1e43d5,_0x46c7da))['catch'](handleError(_0x1e43d5,null));};exports[_0xc896('0x46')]=function(_0x42636a,_0x63b1ac){var _0x46928e={'raw':![],'where':{'id':_0x42636a[_0xc896('0x47')]['id']}},_0x477db3={};_0x477db3[_0xc896('0x35')]=_[_0xc896('0x36')](db[_0xc896('0x30')][_0xc896('0x31')]);_0x477db3[_0xc896('0x37')]=_['keys'](_0x42636a['query']);_0x477db3[_0xc896('0x38')]=_[_0xc896('0x48')](_0x477db3[_0xc896('0x35')],_0x477db3[_0xc896('0x37')]);_0x46928e[_0xc896('0x3a')]=_['intersection'](_0x477db3[_0xc896('0x35')],qs[_0xc896('0x39')](_0x42636a[_0xc896('0x37')][_0xc896('0x39')]));_0x46928e['attributes']=_0x46928e[_0xc896('0x3a')]['length']?_0x46928e[_0xc896('0x3a')]:_0x477db3['model'];if(_0x42636a[_0xc896('0x37')][_0xc896('0x43')]){_0x46928e[_0xc896('0x44')]=[{'all':!![]}];}_0x46928e=_[_0xc896('0x41')]({},_0x46928e,_0x42636a[_0xc896('0x42')]);return db[_0xc896('0x30')][_0xc896('0x49')](_0x46928e)[_0xc896('0x29')](handleEntityNotFound(_0x63b1ac,null))[_0xc896('0x29')](respondWithResult(_0x63b1ac,null))[_0xc896('0x4a')](handleError(_0x63b1ac,null));};exports[_0xc896('0x4b')]=function(_0x3ba32,_0x71780f){return db[_0xc896('0x30')][_0xc896('0x4b')](_0x3ba32['body'],{})[_0xc896('0x29')](respondWithResult(_0x71780f,0xc9))[_0xc896('0x4a')](handleError(_0x71780f,null));};exports[_0xc896('0x28')]=function(_0x56489a,_0xb03781){if(_0x56489a[_0xc896('0x4c')]['id']){delete _0x56489a[_0xc896('0x4c')]['id'];}return db[_0xc896('0x30')][_0xc896('0x49')]({'where':{'id':_0x56489a[_0xc896('0x47')]['id']}})[_0xc896('0x29')](handleEntityNotFound(_0xb03781,null))[_0xc896('0x29')](saveUpdates(_0x56489a[_0xc896('0x4c')],null))[_0xc896('0x29')](respondWithResult(_0xb03781,null))[_0xc896('0x4a')](handleError(_0xb03781,null));};exports[_0xc896('0x2a')]=function(_0x14da16,_0x2b6871){return db['VoiceQueueReport'][_0xc896('0x49')]({'where':{'id':_0x14da16['params']['id']}})['then'](handleEntityNotFound(_0x2b6871,null))[_0xc896('0x29')](removeEntity(_0x2b6871,null))['catch'](handleError(_0x2b6871,null));};exports[_0xc896('0x4d')]=function(_0x3ebf4f,_0x55e497){return db[_0xc896('0x30')]['describe']()[_0xc896('0x29')](respondWithResult(_0x55e497,null))[_0xc896('0x4a')](handleError(_0x55e497,null));};exports[_0xc896('0x4e')]=function(_0x1597ef,_0x49ec4f){var _0x3db642={},_0x550a15={},_0x4f3b74={'count':0x0,'rows':[]};_0x550a15[_0xc896('0x35')]=_['keys'](db[_0xc896('0x30')][_0xc896('0x31')]);_0x550a15['query']=_[_0xc896('0x36')](_0x1597ef['query']);_0x550a15[_0xc896('0x38')]=_[_0xc896('0x48')](_0x550a15[_0xc896('0x35')],_0x550a15['query']);_0x3db642['attributes']=_[_0xc896('0x48')](_0x550a15[_0xc896('0x35')],qs['fields'](_0x1597ef[_0xc896('0x37')][_0xc896('0x39')]));_0x3db642[_0xc896('0x3a')]=_0x3db642[_0xc896('0x3a')][_0xc896('0x4f')]?_0x3db642[_0xc896('0x3a')]:_0x550a15[_0xc896('0x35')];if(!_0x1597ef[_0xc896('0x37')]['hasOwnProperty']('nolimit')){_0x3db642[_0xc896('0x20')]=qs[_0xc896('0x20')](_0x1597ef[_0xc896('0x37')]['limit']);_0x3db642[_0xc896('0x1d')]=qs[_0xc896('0x1d')](_0x1597ef[_0xc896('0x37')][_0xc896('0x1d')]);}_0x3db642[_0xc896('0x3c')]=qs[_0xc896('0x3d')](_0x1597ef[_0xc896('0x37')][_0xc896('0x3d')]);_0x3db642['where']=qs[_0xc896('0x38')](_[_0xc896('0x3e')](_0x1597ef['query'],_0x550a15[_0xc896('0x38')]));if(_0x1597ef[_0xc896('0x37')][_0xc896('0x3f')]){_0x3db642[_0xc896('0x40')]=_[_0xc896('0x41')](_0x3db642['where'],{'$or':_[_0xc896('0x2f')](_0x3db642[_0xc896('0x3a')],function(_0x14f632){var _0x59f518={};_0x59f518[_0x14f632]={'$like':'%'+_0x1597ef[_0xc896('0x37')][_0xc896('0x3f')]+'%'};return _0x59f518;})});}_0x3db642=_[_0xc896('0x41')]({},_0x3db642,_0x1597ef[_0xc896('0x42')]);var _0x4b9403={'where':_0x3db642[_0xc896('0x40')]};return db[_0xc896('0x30')][_0xc896('0x1f')](_0x4b9403)['then'](function(_0x29d8ba){_0x4f3b74[_0xc896('0x1f')]=_0x29d8ba;if(_0x1597ef['query'][_0xc896('0x43')]){_0x3db642[_0xc896('0x44')]=[{'all':!![]}];}return db[_0xc896('0x30')][_0xc896('0x45')](_0x3db642);})[_0xc896('0x29')](function(_0x16368b){_0x4f3b74[_0xc896('0x50')]=_0x16368b;return _0x4f3b74;})['then'](respondWithFilteredResult(_0x49ec4f,_0x3db642,_0xc896('0x4e')))[_0xc896('0x4a')](handleError(_0x49ec4f,null,_0xc896('0x4e')));}; \ No newline at end of file +var _0x67c7=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','find','create','body','update','describe','getVoiceQueuesReport','pick','eml-format','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','status','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x67c7,0x6a));var _0x767c=function(_0x2af276,_0xb15ec5){_0x2af276=_0x2af276-0x0;var _0x4c586e=_0x67c7[_0x2af276];return _0x4c586e;};'use strict';var emlformat=require(_0x767c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x767c('0x1'));var moment=require(_0x767c('0x2'));var BPromise=require(_0x767c('0x3'));var Mustache=require(_0x767c('0x4'));var util=require('util');var path=require(_0x767c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x767c('0x6'));var fs=require('fs');var fs_extra=require(_0x767c('0x7'));var _=require(_0x767c('0x8'));var squel=require(_0x767c('0x9'));var crypto=require(_0x767c('0xa'));var jsforce=require(_0x767c('0xb'));var deskjs=require(_0x767c('0xc'));var toCsv=require(_0x767c('0xd'));var querystring=require(_0x767c('0xe'));var Papa=require(_0x767c('0xf'));var Redis=require(_0x767c('0x10'));var authService=require(_0x767c('0x11'));var qs=require(_0x767c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x767c('0x13'));var logger=require(_0x767c('0x14'))(_0x767c('0x15'));var utils=require('../../config/utils');var config=require(_0x767c('0x16'));var licenseUtil=require(_0x767c('0x17'));var db=require(_0x767c('0x18'))['db'];config[_0x767c('0x19')]=_['defaults'](config[_0x767c('0x19')],{'host':_0x767c('0x1a'),'port':0x18eb});var socket=require(_0x767c('0x1b'))(new Redis(config[_0x767c('0x19')]));require(_0x767c('0x1c'))[_0x767c('0x1d')](socket);function respondWithStatusCode(_0x22784d,_0x37337f){_0x37337f=_0x37337f||0xcc;return function(_0x35461f){if(_0x35461f){return _0x22784d[_0x767c('0x1e')](_0x37337f);}return _0x22784d['status'](_0x37337f)[_0x767c('0x1f')]();};}function respondWithResult(_0x27f488,_0x381088){_0x381088=_0x381088||0xc8;return function(_0x1b2769){if(_0x1b2769){return _0x27f488['status'](_0x381088)['json'](_0x1b2769);}};}function respondWithFilteredResult(_0x27c19d,_0x3cab5d){return function(_0x5b1bff){if(_0x5b1bff){var _0x141f20=typeof _0x3cab5d[_0x767c('0x20')]===_0x767c('0x21')&&typeof _0x3cab5d[_0x767c('0x22')]==='undefined';var _0x350393=_0x5b1bff[_0x767c('0x23')];var _0x37adcc=_0x141f20?0x0:_0x3cab5d[_0x767c('0x20')];var _0xe6be3d=_0x141f20?_0x5b1bff['count']:_0x3cab5d['offset']+_0x3cab5d[_0x767c('0x22')];var _0x467845;if(_0xe6be3d>=_0x350393){_0xe6be3d=_0x350393;_0x467845=0xc8;}else{_0x467845=0xce;}_0x27c19d['status'](_0x467845);return _0x27c19d[_0x767c('0x24')](_0x767c('0x25'),_0x37adcc+'-'+_0xe6be3d+'/'+_0x350393)[_0x767c('0x26')](_0x5b1bff);}return null;};}function patchUpdates(_0x3a5260){return function(_0x4c9f39){try{jsonpatch['apply'](_0x4c9f39,_0x3a5260,!![]);}catch(_0x4d6ce2){return BPromise[_0x767c('0x27')](_0x4d6ce2);}return _0x4c9f39[_0x767c('0x28')]();};}function saveUpdates(_0x44410b,_0x555104){return function(_0x14c5fa){if(_0x14c5fa){return _0x14c5fa['update'](_0x44410b)[_0x767c('0x29')](function(_0x15b62e){return _0x15b62e;});}return null;};}function removeEntity(_0x15e4cf,_0x1dea15){return function(_0x34a212){if(_0x34a212){return _0x34a212[_0x767c('0x2a')]()[_0x767c('0x29')](function(){_0x15e4cf[_0x767c('0x2b')](0xcc)[_0x767c('0x1f')]();});}};}function handleEntityNotFound(_0xbe026c,_0x5e538e){return function(_0x21431c){if(!_0x21431c){_0xbe026c['sendStatus'](0x194);}return _0x21431c;};}function handleError(_0xc29154,_0x3205eb){_0x3205eb=_0x3205eb||0x1f4;return function(_0x3dc870){logger[_0x767c('0x2c')](_0x3dc870[_0x767c('0x2d')]);if(_0x3dc870[_0x767c('0x2e')]){delete _0x3dc870[_0x767c('0x2e')];}_0xc29154[_0x767c('0x2b')](_0x3205eb)[_0x767c('0x2f')](_0x3dc870);};}exports[_0x767c('0x30')]=function(_0x5a57b8,_0x49b291){var _0x32ee88={},_0x55ea33={},_0x366d40={'count':0x0,'rows':[]};var _0x4abbd3=_['map'](db[_0x767c('0x31')][_0x767c('0x32')],function(_0x2fa5c7){return{'name':_0x2fa5c7[_0x767c('0x33')],'type':_0x2fa5c7[_0x767c('0x34')][_0x767c('0x35')]};});_0x55ea33[_0x767c('0x36')]=_[_0x767c('0x37')](_0x4abbd3,_0x767c('0x2e'));_0x55ea33[_0x767c('0x38')]=_['keys'](_0x5a57b8[_0x767c('0x38')]);_0x55ea33[_0x767c('0x39')]=_[_0x767c('0x3a')](_0x55ea33[_0x767c('0x36')],_0x55ea33[_0x767c('0x38')]);_0x32ee88[_0x767c('0x3b')]=_[_0x767c('0x3a')](_0x55ea33['model'],qs['fields'](_0x5a57b8[_0x767c('0x38')]['fields']));_0x32ee88[_0x767c('0x3b')]=_0x32ee88[_0x767c('0x3b')][_0x767c('0x3c')]?_0x32ee88[_0x767c('0x3b')]:_0x55ea33['model'];if(!_0x5a57b8[_0x767c('0x38')][_0x767c('0x3d')](_0x767c('0x3e'))){_0x32ee88[_0x767c('0x22')]=qs[_0x767c('0x22')](_0x5a57b8[_0x767c('0x38')]['limit']);_0x32ee88[_0x767c('0x20')]=qs[_0x767c('0x20')](_0x5a57b8[_0x767c('0x38')][_0x767c('0x20')]);}_0x32ee88[_0x767c('0x3f')]=qs[_0x767c('0x40')](_0x5a57b8[_0x767c('0x38')][_0x767c('0x40')]);_0x32ee88[_0x767c('0x41')]=qs[_0x767c('0x39')](_['pick'](_0x5a57b8[_0x767c('0x38')],_0x55ea33['filters']),_0x4abbd3);if(_0x5a57b8[_0x767c('0x38')][_0x767c('0x42')]){_0x32ee88[_0x767c('0x41')]=_[_0x767c('0x43')](_0x32ee88[_0x767c('0x41')],{'$or':_['map'](_0x4abbd3,function(_0x1c0cbd){if(_0x1c0cbd[_0x767c('0x34')]!==_0x767c('0x44')){var _0x56e025={};_0x56e025[_0x1c0cbd[_0x767c('0x2e')]]={'$like':'%'+_0x5a57b8[_0x767c('0x38')][_0x767c('0x42')]+'%'};return _0x56e025;}})});}_0x32ee88=_[_0x767c('0x43')]({},_0x32ee88,_0x5a57b8['options']);var _0x388d1f={'where':_0x32ee88[_0x767c('0x41')]};return db[_0x767c('0x31')][_0x767c('0x23')](_0x388d1f)[_0x767c('0x29')](function(_0x7412ba){_0x366d40['count']=_0x7412ba;if(_0x5a57b8['query'][_0x767c('0x45')]){_0x32ee88[_0x767c('0x46')]=[{'all':!![]}];}return db[_0x767c('0x31')][_0x767c('0x47')](_0x32ee88);})['then'](function(_0x51e4f7){_0x366d40[_0x767c('0x48')]=_0x51e4f7;return _0x366d40;})[_0x767c('0x29')](respondWithFilteredResult(_0x49b291,_0x32ee88))[_0x767c('0x49')](handleError(_0x49b291,null));};exports[_0x767c('0x4a')]=function(_0x100507,_0x2736b8){var _0x167152={'raw':![],'where':{'id':_0x100507[_0x767c('0x4b')]['id']}},_0x5ea4f4={};_0x5ea4f4[_0x767c('0x36')]=_['keys'](db[_0x767c('0x31')][_0x767c('0x32')]);_0x5ea4f4[_0x767c('0x38')]=_[_0x767c('0x4c')](_0x100507['query']);_0x5ea4f4['filters']=_['intersection'](_0x5ea4f4[_0x767c('0x36')],_0x5ea4f4[_0x767c('0x38')]);_0x167152[_0x767c('0x3b')]=_[_0x767c('0x3a')](_0x5ea4f4[_0x767c('0x36')],qs[_0x767c('0x4d')](_0x100507['query'][_0x767c('0x4d')]));_0x167152[_0x767c('0x3b')]=_0x167152[_0x767c('0x3b')][_0x767c('0x3c')]?_0x167152[_0x767c('0x3b')]:_0x5ea4f4[_0x767c('0x36')];if(_0x100507[_0x767c('0x38')]['includeAll']){_0x167152[_0x767c('0x46')]=[{'all':!![]}];}_0x167152=_['merge']({},_0x167152,_0x100507[_0x767c('0x4e')]);return db[_0x767c('0x31')][_0x767c('0x4f')](_0x167152)['then'](handleEntityNotFound(_0x2736b8,null))['then'](respondWithResult(_0x2736b8,null))[_0x767c('0x49')](handleError(_0x2736b8,null));};exports[_0x767c('0x50')]=function(_0x52204a,_0x342361){return db['VoiceQueueReport'][_0x767c('0x50')](_0x52204a[_0x767c('0x51')],{})[_0x767c('0x29')](respondWithResult(_0x342361,0xc9))['catch'](handleError(_0x342361,null));};exports[_0x767c('0x52')]=function(_0x49c5b7,_0x378876){if(_0x49c5b7[_0x767c('0x51')]['id']){delete _0x49c5b7[_0x767c('0x51')]['id'];}return db[_0x767c('0x31')][_0x767c('0x4f')]({'where':{'id':_0x49c5b7[_0x767c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x378876,null))[_0x767c('0x29')](saveUpdates(_0x49c5b7[_0x767c('0x51')],null))[_0x767c('0x29')](respondWithResult(_0x378876,null))['catch'](handleError(_0x378876,null));};exports[_0x767c('0x2a')]=function(_0x20924d,_0x19168a){return db[_0x767c('0x31')]['find']({'where':{'id':_0x20924d[_0x767c('0x4b')]['id']}})[_0x767c('0x29')](handleEntityNotFound(_0x19168a,null))['then'](removeEntity(_0x19168a,null))[_0x767c('0x49')](handleError(_0x19168a,null));};exports[_0x767c('0x53')]=function(_0x4ad8cb,_0x3a10ab){return db[_0x767c('0x31')]['describe']()[_0x767c('0x29')](respondWithResult(_0x3a10ab,null))[_0x767c('0x49')](handleError(_0x3a10ab,null));};exports[_0x767c('0x54')]=function(_0x4d8d4c,_0x19e115){var _0x583769={},_0x51a45e={},_0x2dab47={'count':0x0,'rows':[]};_0x51a45e[_0x767c('0x36')]=_[_0x767c('0x4c')](db[_0x767c('0x31')][_0x767c('0x32')]);_0x51a45e[_0x767c('0x38')]=_[_0x767c('0x4c')](_0x4d8d4c['query']);_0x51a45e['filters']=_[_0x767c('0x3a')](_0x51a45e['model'],_0x51a45e[_0x767c('0x38')]);_0x583769[_0x767c('0x3b')]=_[_0x767c('0x3a')](_0x51a45e[_0x767c('0x36')],qs[_0x767c('0x4d')](_0x4d8d4c['query'][_0x767c('0x4d')]));_0x583769[_0x767c('0x3b')]=_0x583769[_0x767c('0x3b')]['length']?_0x583769['attributes']:_0x51a45e[_0x767c('0x36')];if(!_0x4d8d4c['query']['hasOwnProperty'](_0x767c('0x3e'))){_0x583769[_0x767c('0x22')]=qs['limit'](_0x4d8d4c[_0x767c('0x38')][_0x767c('0x22')]);_0x583769[_0x767c('0x20')]=qs[_0x767c('0x20')](_0x4d8d4c[_0x767c('0x38')][_0x767c('0x20')]);}_0x583769[_0x767c('0x3f')]=qs[_0x767c('0x40')](_0x4d8d4c[_0x767c('0x38')]['sort']);_0x583769[_0x767c('0x41')]=qs[_0x767c('0x39')](_[_0x767c('0x55')](_0x4d8d4c['query'],_0x51a45e[_0x767c('0x39')]));if(_0x4d8d4c[_0x767c('0x38')]['filter']){_0x583769['where']=_[_0x767c('0x43')](_0x583769['where'],{'$or':_[_0x767c('0x37')](_0x583769[_0x767c('0x3b')],function(_0x144b50){var _0x344ad8={};_0x344ad8[_0x144b50]={'$like':'%'+_0x4d8d4c[_0x767c('0x38')]['filter']+'%'};return _0x344ad8;})});}_0x583769=_[_0x767c('0x43')]({},_0x583769,_0x4d8d4c[_0x767c('0x4e')]);var _0x9af13b={'where':_0x583769[_0x767c('0x41')]};return db['VoiceQueueReport'][_0x767c('0x23')](_0x9af13b)[_0x767c('0x29')](function(_0x43f8ac){_0x2dab47['count']=_0x43f8ac;if(_0x4d8d4c[_0x767c('0x38')][_0x767c('0x45')]){_0x583769[_0x767c('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x583769);})['then'](function(_0xa09489){_0x2dab47[_0x767c('0x48')]=_0xa09489;return _0x2dab47;})[_0x767c('0x29')](respondWithFilteredResult(_0x19e115,_0x583769,_0x767c('0x54')))[_0x767c('0x49')](handleError(_0x19e115,null,_0x767c('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index bf31a14..6ae7e64 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 _0xcc64=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x3e3221,_0x392851){var _0x190da4=function(_0x13d601){while(--_0x13d601){_0x3e3221['push'](_0x3e3221['shift']());}};_0x190da4(++_0x392851);}(_0xcc64,0x7f));var _0x4cc6=function(_0x5a31a9,_0x29b830){_0x5a31a9=_0x5a31a9-0x0;var _0x1a75ba=_0xcc64[_0x5a31a9];return _0x1a75ba;};'use strict';var EventEmitter=require(_0x4cc6('0x0'));var VoiceQueueReport=require(_0x4cc6('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4cc6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4cc6('0x3'),'afterDestroy':_0x4cc6('0x4')};function emitEvent(_0x5c522e){return function(_0x481d6e,_0x2cfa62,_0x220b46){VoiceQueueReportEvents[_0x4cc6('0x5')](_0x5c522e+':'+_0x481d6e['id'],_0x481d6e);VoiceQueueReportEvents[_0x4cc6('0x5')](_0x5c522e,_0x481d6e);_0x220b46(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x4cc6('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x45e5=['save','remove','emit','hasOwnProperty','hook','events','VoiceQueueReport','setMaxListeners'];(function(_0x364223,_0xad78bd){var _0x416d9b=function(_0x5aebd9){while(--_0x5aebd9){_0x364223['push'](_0x364223['shift']());}};_0x416d9b(++_0xad78bd);}(_0x45e5,0x15d));var _0x545e=function(_0x3f5334,_0x49f71c){_0x3f5334=_0x3f5334-0x0;var _0x495231=_0x45e5[_0x3f5334];return _0x495231;};'use strict';var EventEmitter=require(_0x545e('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x545e('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x545e('0x2')](0x0);var events={'afterCreate':_0x545e('0x3'),'afterUpdate':'update','afterDestroy':_0x545e('0x4')};function emitEvent(_0x3045ae){return function(_0x3c7a7e,_0x9e12ca,_0xed081f){VoiceQueueReportEvents[_0x545e('0x5')](_0x3045ae+':'+_0x3c7a7e['id'],_0x3c7a7e);VoiceQueueReportEvents['emit'](_0x3045ae,_0x3c7a7e);_0xed081f(null);};}for(var e in events){if(events[_0x545e('0x6')](e)){var event=events[e];VoiceQueueReport[_0x545e('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 14d416e..d5bbb16 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 _0x7803=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7803,0xa6));var _0x3780=function(_0x46fe22,_0x637a17){_0x46fe22=_0x46fe22-0x0;var _0x2e90c2=_0x7803[_0x46fe22];return _0x2e90c2;};'use strict';var _=require(_0x3780('0x0'));var util=require(_0x3780('0x1'));var logger=require('../../config/logger')(_0x3780('0x2'));var moment=require(_0x3780('0x3'));var BPromise=require(_0x3780('0x4'));var rp=require(_0x3780('0x5'));var fs=require('fs');var path=require(_0x3780('0x6'));var rimraf=require(_0x3780('0x7'));var config=require(_0x3780('0x8'));var attributes=require(_0x3780('0x9'));module[_0x3780('0xa')]=function(_0x319406,_0x16876b){return _0x319406[_0x3780('0xb')]('VoiceQueueReport',attributes,{'tableName':_0x3780('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ace=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','VoiceQueueReport','report_queue','calleridnum','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ace,0x1d3));var _0xe2ac=function(_0xe323e3,_0x110473){_0xe323e3=_0xe323e3-0x0;var _0x208a43=_0x2ace[_0xe323e3];return _0x208a43;};'use strict';var _=require(_0xe2ac('0x0'));var util=require(_0xe2ac('0x1'));var logger=require(_0xe2ac('0x2'))(_0xe2ac('0x3'));var moment=require(_0xe2ac('0x4'));var BPromise=require('bluebird');var rp=require(_0xe2ac('0x5'));var fs=require('fs');var path=require(_0xe2ac('0x6'));var rimraf=require(_0xe2ac('0x7'));var config=require(_0xe2ac('0x8'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x1ef8b9,_0x6a0fce){return _0x1ef8b9[_0xe2ac('0x9')](_0xe2ac('0xa'),attributes,{'tableName':_0xe2ac('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xe2ac('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 f27343c..895edd5 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 _0x70c2=['defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x18393d,_0x5821fb){var _0x2dbe69=function(_0x2ae8b0){while(--_0x2ae8b0){_0x18393d['push'](_0x18393d['shift']());}};_0x2dbe69(++_0x5821fb);}(_0x70c2,0x107));var _0x270c=function(_0x1b41e9,_0x36ca3e){_0x1b41e9=_0x1b41e9-0x0;var _0x341ae6=_0x70c2[_0x1b41e9];return _0x341ae6;};'use strict';var _=require(_0x270c('0x0'));var util=require('util');var moment=require(_0x270c('0x1'));var BPromise=require(_0x270c('0x2'));var rs=require(_0x270c('0x3'));var fs=require('fs');var Redis=require(_0x270c('0x4'));var db=require(_0x270c('0x5'))['db'];var utils=require(_0x270c('0x6'));var logger=require(_0x270c('0x7'))(_0x270c('0x8'));var config=require(_0x270c('0x9'));var jayson=require(_0x270c('0xa'));var client=jayson['client'][_0x270c('0xb')]({'port':0x232a});config[_0x270c('0xc')]=_[_0x270c('0xd')](config['redis'],{'host':_0x270c('0xe'),'port':0x18eb});var socket=require(_0x270c('0xf'))(new Redis(config[_0x270c('0xc')]));require(_0x270c('0x10'))['register'](socket);function respondWithRpcPromise(_0x3c098d,_0x30b7d6,_0x3d773e){return new BPromise(function(_0x20a032,_0x2aa677){return client[_0x270c('0x11')](_0x3c098d,_0x3d773e)[_0x270c('0x12')](function(_0x570492){logger['info'](_0x270c('0x13'),_0x30b7d6,_0x270c('0x14'));logger[_0x270c('0x15')](_0x270c('0x16'),_0x30b7d6,'request\x20sent',JSON[_0x270c('0x17')](_0x570492));if(_0x570492[_0x270c('0x18')]){if(_0x570492[_0x270c('0x18')][_0x270c('0x19')]===0x1f4){logger['error'](_0x270c('0x13'),_0x30b7d6,_0x570492[_0x270c('0x18')][_0x270c('0x1a')]);return _0x2aa677(_0x570492[_0x270c('0x18')]['message']);}logger['error'](_0x270c('0x13'),_0x30b7d6,_0x570492[_0x270c('0x18')][_0x270c('0x1a')]);return _0x20a032(_0x570492[_0x270c('0x18')]['message']);}else{logger[_0x270c('0x1b')](_0x270c('0x13'),_0x30b7d6,_0x270c('0x14'));_0x20a032(_0x570492[_0x270c('0x1c')][_0x270c('0x1a')]);}})[_0x270c('0x1d')](function(_0x8a5434){logger[_0x270c('0x18')](_0x270c('0x13'),_0x30b7d6,_0x8a5434);_0x2aa677(_0x8a5434);});});}exports['GetVoiceQueueReport']=function(_0x34d29b){var _0x5ed52d=this;return new Promise(function(_0x1084e1,_0x2c2397){return db[_0x270c('0x1e')][_0x270c('0x1f')]({'raw':_0x34d29b[_0x270c('0x20')]?_0x34d29b['options'][_0x270c('0x21')]===undefined?!![]:![]:!![],'where':_0x34d29b[_0x270c('0x20')]?_0x34d29b['options'][_0x270c('0x22')]||null:null,'attributes':_0x34d29b[_0x270c('0x20')]?_0x34d29b[_0x270c('0x20')]['attributes']||null:null,'limit':_0x34d29b[_0x270c('0x20')]?_0x34d29b[_0x270c('0x20')][_0x270c('0x23')]||null:null,'include':_0x34d29b[_0x270c('0x20')]?_0x34d29b[_0x270c('0x20')][_0x270c('0x24')]?_[_0x270c('0x25')](_0x34d29b['options'][_0x270c('0x24')],function(_0x3264a1){return{'model':db[_0x3264a1[_0x270c('0x26')]],'as':_0x3264a1['as'],'attributes':_0x3264a1[_0x270c('0x27')],'include':_0x3264a1[_0x270c('0x24')]?_[_0x270c('0x25')](_0x3264a1[_0x270c('0x24')],function(_0x5b1e6c){return{'model':db[_0x5b1e6c[_0x270c('0x26')]],'as':_0x5b1e6c['as'],'attributes':_0x5b1e6c[_0x270c('0x27')],'include':_0x5b1e6c[_0x270c('0x24')]?_[_0x270c('0x25')](_0x5b1e6c[_0x270c('0x24')],function(_0x470bb9){return{'model':db[_0x470bb9['model']],'as':_0x470bb9['as'],'attributes':_0x470bb9[_0x270c('0x27')]};}):[]};}):[]};}):[]:[]})[_0x270c('0x12')](function(_0xb3e49d){logger[_0x270c('0x1b')](_0x270c('0x28'),_0x34d29b);logger[_0x270c('0x15')](_0x270c('0x28'),_0x34d29b,JSON[_0x270c('0x17')](_0xb3e49d));_0x1084e1(_0xb3e49d);})[_0x270c('0x1d')](function(_0x5df63c){logger[_0x270c('0x18')]('GetVoiceQueueReport',_0x5df63c[_0x270c('0x1a')],_0x34d29b);_0x2c2397(_0x5ed52d[_0x270c('0x18')](0x1f4,_0x5df63c[_0x270c('0x1a')]));});});};exports[_0x270c('0x29')]=function(_0x3c98be){var _0x46f962=this;return new Promise(function(_0x40db75,_0xaaf66e){return db[_0x270c('0x1e')][_0x270c('0x2a')](_0x3c98be[_0x270c('0x2b')],{'raw':_0x3c98be[_0x270c('0x20')]?_0x3c98be['options'][_0x270c('0x21')]===undefined?!![]:![]:!![]})[_0x270c('0x12')](function(_0x3581a8){logger['info'](_0x270c('0x29'),_0x3c98be);logger[_0x270c('0x15')](_0x270c('0x29'),_0x3c98be,JSON[_0x270c('0x17')](_0x3581a8));_0x40db75(_0x3581a8);})[_0x270c('0x1d')](function(_0x5d7144){logger[_0x270c('0x18')]('CreateVoiceQueueReport',_0x5d7144[_0x270c('0x1a')],_0x3c98be);_0xaaf66e(_0x46f962[_0x270c('0x18')](0x1f4,_0x5d7144[_0x270c('0x1a')]));});});};exports[_0x270c('0x2c')]=function(_0x1921e2){var _0x1290c9=this;return new Promise(function(_0x1b351b,_0x283a6d){return db[_0x270c('0x1e')][_0x270c('0x2d')](_0x1921e2[_0x270c('0x2b')],{'raw':_0x1921e2[_0x270c('0x20')]?_0x1921e2['options'][_0x270c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1921e2[_0x270c('0x20')]?_0x1921e2[_0x270c('0x20')]['where']||null:null,'attributes':_0x1921e2[_0x270c('0x20')]?_0x1921e2[_0x270c('0x20')][_0x270c('0x27')]||null:null,'limit':_0x1921e2[_0x270c('0x20')]?_0x1921e2['options'][_0x270c('0x23')]||null:null})[_0x270c('0x12')](function(_0x2c1935){logger['info']('UpdateVoiceQueueReport',_0x1921e2);logger[_0x270c('0x15')](_0x270c('0x2c'),_0x1921e2,JSON['stringify'](_0x2c1935));_0x1b351b(_0x2c1935);})[_0x270c('0x1d')](function(_0x5ed80c){logger[_0x270c('0x18')](_0x270c('0x2c'),_0x5ed80c[_0x270c('0x1a')],_0x1921e2);_0x283a6d(_0x1290c9['error'](0x1f4,_0x5ed80c[_0x270c('0x1a')]));});});}; \ No newline at end of file +var _0x5f3a=['findAll','options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f3a,0x133));var _0xa5f3=function(_0x270fea,_0x1996e9){_0x270fea=_0x270fea-0x0;var _0xc95d37=_0x5f3a[_0x270fea];return _0xc95d37;};'use strict';var _=require(_0xa5f3('0x0'));var util=require(_0xa5f3('0x1'));var moment=require(_0xa5f3('0x2'));var BPromise=require(_0xa5f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5f3('0x4'));var db=require(_0xa5f3('0x5'))['db'];var utils=require(_0xa5f3('0x6'));var logger=require(_0xa5f3('0x7'))(_0xa5f3('0x8'));var config=require(_0xa5f3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa5f3('0xa')]({'port':0x232a});config['redis']=_[_0xa5f3('0xb')](config[_0xa5f3('0xc')],{'host':_0xa5f3('0xd'),'port':0x18eb});var socket=require(_0xa5f3('0xe'))(new Redis(config[_0xa5f3('0xc')]));require(_0xa5f3('0xf'))[_0xa5f3('0x10')](socket);function respondWithRpcPromise(_0x4d3a91,_0x2dfa25,_0x4a4dff){return new BPromise(function(_0x4488ed,_0xacc79){return client['request'](_0x4d3a91,_0x4a4dff)[_0xa5f3('0x11')](function(_0x51580b){logger['info'](_0xa5f3('0x12'),_0x2dfa25,_0xa5f3('0x13'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2dfa25,_0xa5f3('0x13'),JSON[_0xa5f3('0x14')](_0x51580b));if(_0x51580b[_0xa5f3('0x15')]){if(_0x51580b[_0xa5f3('0x15')][_0xa5f3('0x16')]===0x1f4){logger[_0xa5f3('0x15')](_0xa5f3('0x12'),_0x2dfa25,_0x51580b[_0xa5f3('0x15')][_0xa5f3('0x17')]);return _0xacc79(_0x51580b[_0xa5f3('0x15')]['message']);}logger[_0xa5f3('0x15')](_0xa5f3('0x12'),_0x2dfa25,_0x51580b['error'][_0xa5f3('0x17')]);return _0x4488ed(_0x51580b[_0xa5f3('0x15')][_0xa5f3('0x17')]);}else{logger[_0xa5f3('0x18')](_0xa5f3('0x12'),_0x2dfa25,'request\x20sent');_0x4488ed(_0x51580b[_0xa5f3('0x19')][_0xa5f3('0x17')]);}})[_0xa5f3('0x1a')](function(_0x35faf4){logger[_0xa5f3('0x15')](_0xa5f3('0x12'),_0x2dfa25,_0x35faf4);_0xacc79(_0x35faf4);});});}exports[_0xa5f3('0x1b')]=function(_0x502286){var _0x398916=this;return new Promise(function(_0x505628,_0x11425a){return db[_0xa5f3('0x1c')][_0xa5f3('0x1d')]({'raw':_0x502286[_0xa5f3('0x1e')]?_0x502286[_0xa5f3('0x1e')][_0xa5f3('0x1f')]===undefined?!![]:![]:!![],'where':_0x502286[_0xa5f3('0x1e')]?_0x502286[_0xa5f3('0x1e')][_0xa5f3('0x20')]||null:null,'attributes':_0x502286[_0xa5f3('0x1e')]?_0x502286[_0xa5f3('0x1e')]['attributes']||null:null,'limit':_0x502286['options']?_0x502286['options'][_0xa5f3('0x21')]||null:null,'include':_0x502286['options']?_0x502286['options'][_0xa5f3('0x22')]?_[_0xa5f3('0x23')](_0x502286[_0xa5f3('0x1e')]['include'],function(_0x48eb57){return{'model':db[_0x48eb57[_0xa5f3('0x24')]],'as':_0x48eb57['as'],'attributes':_0x48eb57[_0xa5f3('0x25')],'include':_0x48eb57[_0xa5f3('0x22')]?_[_0xa5f3('0x23')](_0x48eb57[_0xa5f3('0x22')],function(_0x13acca){return{'model':db[_0x13acca['model']],'as':_0x13acca['as'],'attributes':_0x13acca[_0xa5f3('0x25')],'include':_0x13acca[_0xa5f3('0x22')]?_[_0xa5f3('0x23')](_0x13acca[_0xa5f3('0x22')],function(_0x2f67bd){return{'model':db[_0x2f67bd[_0xa5f3('0x24')]],'as':_0x2f67bd['as'],'attributes':_0x2f67bd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x155d94){logger[_0xa5f3('0x18')](_0xa5f3('0x1b'),_0x502286);logger['debug'](_0xa5f3('0x1b'),_0x502286,JSON[_0xa5f3('0x14')](_0x155d94));_0x505628(_0x155d94);})[_0xa5f3('0x1a')](function(_0x2d9d88){logger[_0xa5f3('0x15')](_0xa5f3('0x1b'),_0x2d9d88['message'],_0x502286);_0x11425a(_0x398916[_0xa5f3('0x15')](0x1f4,_0x2d9d88[_0xa5f3('0x17')]));});});};exports[_0xa5f3('0x26')]=function(_0x5ce20b){var _0x2a6f71=this;return new Promise(function(_0x2a8eeb,_0x45b2a1){return db[_0xa5f3('0x1c')]['create'](_0x5ce20b['body'],{'raw':_0x5ce20b['options']?_0x5ce20b[_0xa5f3('0x1e')][_0xa5f3('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1a60c9){logger[_0xa5f3('0x18')](_0xa5f3('0x26'),_0x5ce20b);logger['debug'](_0xa5f3('0x26'),_0x5ce20b,JSON[_0xa5f3('0x14')](_0x1a60c9));_0x2a8eeb(_0x1a60c9);})[_0xa5f3('0x1a')](function(_0x47b248){logger[_0xa5f3('0x15')](_0xa5f3('0x26'),_0x47b248[_0xa5f3('0x17')],_0x5ce20b);_0x45b2a1(_0x2a6f71[_0xa5f3('0x15')](0x1f4,_0x47b248['message']));});});};exports[_0xa5f3('0x27')]=function(_0x182ab5){var _0x558e12=this;return new Promise(function(_0x2df735,_0x1ad8f0){return db[_0xa5f3('0x1c')][_0xa5f3('0x28')](_0x182ab5[_0xa5f3('0x29')],{'raw':_0x182ab5[_0xa5f3('0x1e')]?_0x182ab5[_0xa5f3('0x1e')][_0xa5f3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x182ab5[_0xa5f3('0x1e')]?_0x182ab5[_0xa5f3('0x1e')]['where']||null:null,'attributes':_0x182ab5[_0xa5f3('0x1e')]?_0x182ab5[_0xa5f3('0x1e')][_0xa5f3('0x25')]||null:null,'limit':_0x182ab5[_0xa5f3('0x1e')]?_0x182ab5[_0xa5f3('0x1e')][_0xa5f3('0x21')]||null:null})['then'](function(_0x4ea02f){logger[_0xa5f3('0x18')](_0xa5f3('0x27'),_0x182ab5);logger['debug'](_0xa5f3('0x27'),_0x182ab5,JSON[_0xa5f3('0x14')](_0x4ea02f));_0x2df735(_0x4ea02f);})[_0xa5f3('0x1a')](function(_0x49a7a8){logger[_0xa5f3('0x15')](_0xa5f3('0x27'),_0x49a7a8['message'],_0x182ab5);_0x1ad8f0(_0x558e12[_0xa5f3('0x15')](0x1f4,_0x49a7a8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a9cf9f1..a1c755d 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 _0x535f=['emit','removeListener','length','voiceQueueReport:','remove','update'];(function(_0x4835c1,_0x143739){var _0x1fb70a=function(_0x24e8d5){while(--_0x24e8d5){_0x4835c1['push'](_0x4835c1['shift']());}};_0x1fb70a(++_0x143739);}(_0x535f,0x160));var _0xf535=function(_0x15e365,_0x4f31ac){_0x15e365=_0x15e365-0x0;var _0xe68f97=_0x535f[_0x15e365];return _0xe68f97;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xf535('0x0'),_0xf535('0x1')];function createListener(_0x5819f1,_0x1e4e13){return function(_0x45aa76){_0x1e4e13[_0xf535('0x2')](_0x5819f1,_0x45aa76);};}function removeListener(_0x38d474,_0xf7cfeb){return function(){VoiceQueueReportEvents[_0xf535('0x3')](_0x38d474,_0xf7cfeb);};}exports['register']=function(_0x1ff8cc){for(var _0x3303c8=0x0,_0x4fe14d=events[_0xf535('0x4')];_0x3303c8<_0x4fe14d;_0x3303c8++){var _0x22be11=events[_0x3303c8];var _0xeac3e7=createListener(_0xf535('0x5')+_0x22be11,_0x1ff8cc);VoiceQueueReportEvents['on'](_0x22be11,_0xeac3e7);}}; \ No newline at end of file +var _0xc1f1=['save','remove','removeListener','length','voiceQueueReport:'];(function(_0x9b808e,_0x1a5794){var _0x5bd173=function(_0x2884bd){while(--_0x2884bd){_0x9b808e['push'](_0x9b808e['shift']());}};_0x5bd173(++_0x1a5794);}(_0xc1f1,0x122));var _0x1c1f=function(_0x402718,_0x22529c){_0x402718=_0x402718-0x0;var _0x3e6afb=_0xc1f1[_0x402718];return _0x3e6afb;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x1c1f('0x0'),_0x1c1f('0x1'),'update'];function createListener(_0x293182,_0x5c0aec){return function(_0x218bc8){_0x5c0aec['emit'](_0x293182,_0x218bc8);};}function removeListener(_0x223189,_0x5f1d2e){return function(){VoiceQueueReportEvents[_0x1c1f('0x2')](_0x223189,_0x5f1d2e);};}exports['register']=function(_0x1940d7){for(var _0x2d91a5=0x0,_0x3d44be=events[_0x1c1f('0x3')];_0x2d91a5<_0x3d44be;_0x2d91a5++){var _0x2dd1e4=events[_0x2d91a5];var _0x34b9fc=createListener(_0x1c1f('0x4')+_0x2dd1e4,_0x1940d7);VoiceQueueReportEvents['on'](_0x2dd1e4,_0x34b9fc);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 9553ba3..cca7d8d 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 _0x542b=['update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index','get','show','post','create','put','/:id'];(function(_0x514f4e,_0x2dafd5){var _0x10779a=function(_0x372bff){while(--_0x372bff){_0x514f4e['push'](_0x514f4e['shift']());}};_0x10779a(++_0x2dafd5);}(_0x542b,0xec));var _0xb542=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x542b[_0x14fad0];return _0x5c665f;};'use strict';var multer=require(_0xb542('0x0'));var util=require(_0xb542('0x1'));var path=require('path');var timeout=require(_0xb542('0x2'));var express=require(_0xb542('0x3'));var router=express[_0xb542('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb542('0x5'));var interaction=require(_0xb542('0x6'));var config=require('../../config/environment');var controller=require(_0xb542('0x7'));router['get']('/',auth[_0xb542('0x8')](),controller[_0xb542('0x9')]);router[_0xb542('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb542('0xb')]);router[_0xb542('0xc')]('/',auth['isAuthenticated'](),controller[_0xb542('0xd')]);router[_0xb542('0xe')](_0xb542('0xf'),auth[_0xb542('0x8')](),controller[_0xb542('0x10')]);router['delete']('/:id',auth[_0xb542('0x8')](),controller[_0xb542('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe2bb=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1c208e,_0x2a0a5b){var _0x5104ff=function(_0x3ca41f){while(--_0x3ca41f){_0x1c208e['push'](_0x1c208e['shift']());}};_0x5104ff(++_0x2a0a5b);}(_0xe2bb,0x13d));var _0xbe2b=function(_0xa7d678,_0x3dfdff){_0xa7d678=_0xa7d678-0x0;var _0x5cc539=_0xe2bb[_0xa7d678];return _0x5cc539;};'use strict';var multer=require(_0xbe2b('0x0'));var util=require('util');var path=require(_0xbe2b('0x1'));var timeout=require(_0xbe2b('0x2'));var express=require(_0xbe2b('0x3'));var router=express['Router']();var fs_extra=require(_0xbe2b('0x4'));var auth=require(_0xbe2b('0x5'));var interaction=require(_0xbe2b('0x6'));var config=require(_0xbe2b('0x7'));var controller=require(_0xbe2b('0x8'));router[_0xbe2b('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe2b('0xa')]);router[_0xbe2b('0x9')](_0xbe2b('0xb'),auth[_0xbe2b('0xc')](),controller[_0xbe2b('0xd')]);router[_0xbe2b('0xe')]('/',auth['isAuthenticated'](),controller[_0xbe2b('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbe2b('0x10')](_0xbe2b('0xb'),auth[_0xbe2b('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 274e850..9bef3af 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 _0xbce1=['literal','exports','STRING','DATE'];(function(_0x9b678a,_0x2c797e){var _0x28fca4=function(_0x2abfef){while(--_0x2abfef){_0x9b678a['push'](_0x9b678a['shift']());}};_0x28fca4(++_0x2c797e);}(_0xbce1,0x1d5));var _0x1bce=function(_0x2a7c24,_0x47151d){_0x2a7c24=_0x2a7c24-0x0;var _0x14e0c4=_0xbce1[_0x2a7c24];return _0x14e0c4;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1bce('0x0')]={'time':{'type':Sequelize[_0x1bce('0x1')]},'callid':{'type':Sequelize[_0x1bce('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1bce('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1bce('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1bce('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1bce('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1bce('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1bce('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1bce('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x1bce('0x3')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xe98c=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x1d04c6,_0x7bfdc){var _0x53a57e=function(_0x118655){while(--_0x118655){_0x1d04c6['push'](_0x1d04c6['shift']());}};_0x53a57e(++_0x7bfdc);}(_0xe98c,0x186));var _0xce98=function(_0x37dbb1,_0x174761){_0x37dbb1=_0x37dbb1-0x0;var _0x2ab7c6=_0xe98c[_0x37dbb1];return _0x2ab7c6;};'use strict';var Sequelize=require(_0xce98('0x0'));var moment=require(_0xce98('0x1'));module[_0xce98('0x2')]={'time':{'type':Sequelize[_0xce98('0x3')]},'callid':{'type':Sequelize[_0xce98('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xce98('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xce98('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xce98('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xce98('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xce98('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xce98('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xce98('0x5')](_0xce98('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 10c32bc..37714e6 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 _0x83b8=['sox','to-csv','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','options','includeAll','include','findAll','catch','show','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x106bce,_0x3235ff){var _0x353e6f=function(_0x13537b){while(--_0x13537b){_0x106bce['push'](_0x106bce['shift']());}};_0x353e6f(++_0x3235ff);}(_0x83b8,0x88));var _0x883b=function(_0x56d51e,_0x5357e2){_0x56d51e=_0x56d51e-0x0;var _0x110a91=_0x83b8[_0x56d51e];return _0x110a91;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x883b('0x0'));var zipdir=require(_0x883b('0x1'));var jsonpatch=require(_0x883b('0x2'));var rp=require(_0x883b('0x3'));var moment=require(_0x883b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x883b('0x5'));var util=require(_0x883b('0x6'));var path=require(_0x883b('0x7'));var sox=require(_0x883b('0x8'));var csv=require(_0x883b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x883b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x883b('0xb'));var Papa=require(_0x883b('0xc'));var Redis=require(_0x883b('0xd'));var authService=require(_0x883b('0xe'));var qs=require(_0x883b('0xf'));var as=require(_0x883b('0x10'));var hardwareService=require(_0x883b('0x11'));var logger=require(_0x883b('0x12'))(_0x883b('0x13'));var utils=require(_0x883b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x883b('0x15'));var db=require(_0x883b('0x16'))['db'];function respondWithStatusCode(_0x2217d1,_0x5f0c7b){_0x5f0c7b=_0x5f0c7b||0xcc;return function(_0x46d14b){if(_0x46d14b){return _0x2217d1[_0x883b('0x17')](_0x5f0c7b);}return _0x2217d1['status'](_0x5f0c7b)[_0x883b('0x18')]();};}function respondWithResult(_0x1dad78,_0x5c3675){_0x5c3675=_0x5c3675||0xc8;return function(_0x3f2f35){if(_0x3f2f35){return _0x1dad78[_0x883b('0x19')](_0x5c3675)[_0x883b('0x1a')](_0x3f2f35);}};}function respondWithFilteredResult(_0x44f88b,_0x5e0eb8){return function(_0x38951b){if(_0x38951b){var _0x430c69=typeof _0x5e0eb8[_0x883b('0x1b')]===_0x883b('0x1c')&&typeof _0x5e0eb8['limit']===_0x883b('0x1c');var _0xe4175d=_0x38951b[_0x883b('0x1d')];var _0x197e5e=_0x430c69?0x0:_0x5e0eb8[_0x883b('0x1b')];var _0x203294=_0x430c69?_0x38951b[_0x883b('0x1d')]:_0x5e0eb8['offset']+_0x5e0eb8[_0x883b('0x1e')];var _0x5e187e;if(_0x203294>=_0xe4175d){_0x203294=_0xe4175d;_0x5e187e=0xc8;}else{_0x5e187e=0xce;}_0x44f88b['status'](_0x5e187e);return _0x44f88b[_0x883b('0x1f')](_0x883b('0x20'),_0x197e5e+'-'+_0x203294+'/'+_0xe4175d)[_0x883b('0x1a')](_0x38951b);}return null;};}function patchUpdates(_0x25d1c3){return function(_0x48cf08){try{jsonpatch[_0x883b('0x21')](_0x48cf08,_0x25d1c3,!![]);}catch(_0xb8e266){return BPromise[_0x883b('0x22')](_0xb8e266);}return _0x48cf08['save']();};}function saveUpdates(_0x435db4,_0x406c99){return function(_0x5338c1){if(_0x5338c1){return _0x5338c1[_0x883b('0x23')](_0x435db4)[_0x883b('0x24')](function(_0x332cda){return _0x332cda;});}return null;};}function removeEntity(_0x39c344,_0x9a320d){return function(_0x1cae47){if(_0x1cae47){return _0x1cae47['destroy']()[_0x883b('0x24')](function(){_0x39c344[_0x883b('0x19')](0xcc)[_0x883b('0x18')]();});}};}function handleEntityNotFound(_0x13fef7,_0x582e18){return function(_0x3484b5){if(!_0x3484b5){_0x13fef7['sendStatus'](0x194);}return _0x3484b5;};}function handleError(_0x5f4ffa,_0xef1009){_0xef1009=_0xef1009||0x1f4;return function(_0x70563e){logger[_0x883b('0x25')](_0x70563e[_0x883b('0x26')]);if(_0x70563e[_0x883b('0x27')]){delete _0x70563e['name'];}_0x5f4ffa['status'](_0xef1009)[_0x883b('0x28')](_0x70563e);};}exports[_0x883b('0x29')]=function(_0x4da0d4,_0x5e4be5){var _0x131c43={},_0xa2fb65={},_0x324e9c={'count':0x0,'rows':[]};var _0x129dc9=_[_0x883b('0x2a')](db[_0x883b('0x2b')][_0x883b('0x2c')],function(_0x36898a){return{'name':_0x36898a[_0x883b('0x2d')],'type':_0x36898a['type']['key']};});_0xa2fb65['model']=_[_0x883b('0x2a')](_0x129dc9,_0x883b('0x27'));_0xa2fb65[_0x883b('0x2e')]=_[_0x883b('0x2f')](_0x4da0d4[_0x883b('0x2e')]);_0xa2fb65[_0x883b('0x30')]=_['intersection'](_0xa2fb65[_0x883b('0x31')],_0xa2fb65['query']);_0x131c43[_0x883b('0x32')]=_[_0x883b('0x33')](_0xa2fb65[_0x883b('0x31')],qs['fields'](_0x4da0d4['query'][_0x883b('0x34')]));_0x131c43['attributes']=_0x131c43[_0x883b('0x32')][_0x883b('0x35')]?_0x131c43[_0x883b('0x32')]:_0xa2fb65[_0x883b('0x31')];if(!_0x4da0d4[_0x883b('0x2e')][_0x883b('0x36')](_0x883b('0x37'))){_0x131c43[_0x883b('0x1e')]=qs[_0x883b('0x1e')](_0x4da0d4[_0x883b('0x2e')][_0x883b('0x1e')]);_0x131c43[_0x883b('0x1b')]=qs['offset'](_0x4da0d4['query'][_0x883b('0x1b')]);}_0x131c43[_0x883b('0x38')]=qs[_0x883b('0x39')](_0x4da0d4[_0x883b('0x2e')][_0x883b('0x39')]);_0x131c43[_0x883b('0x3a')]=qs[_0x883b('0x30')](_['pick'](_0x4da0d4[_0x883b('0x2e')],_0xa2fb65[_0x883b('0x30')]),_0x129dc9);if(_0x4da0d4[_0x883b('0x2e')][_0x883b('0x3b')]){_0x131c43[_0x883b('0x3a')]=_['merge'](_0x131c43['where'],{'$or':_['map'](_0x129dc9,function(_0x4e8252){if(_0x4e8252[_0x883b('0x3c')]!=='VIRTUAL'){var _0x34df2b={};_0x34df2b[_0x4e8252[_0x883b('0x27')]]={'$like':'%'+_0x4da0d4[_0x883b('0x2e')][_0x883b('0x3b')]+'%'};return _0x34df2b;}})});}_0x131c43=_['merge']({},_0x131c43,_0x4da0d4[_0x883b('0x3d')]);var _0x1b20e6={'where':_0x131c43[_0x883b('0x3a')]};return db['VoiceQueuesLog']['count'](_0x1b20e6)[_0x883b('0x24')](function(_0x24e86c){_0x324e9c[_0x883b('0x1d')]=_0x24e86c;if(_0x4da0d4[_0x883b('0x2e')][_0x883b('0x3e')]){_0x131c43[_0x883b('0x3f')]=[{'all':!![]}];}return db[_0x883b('0x2b')][_0x883b('0x40')](_0x131c43);})[_0x883b('0x24')](function(_0x3034b8){_0x324e9c['rows']=_0x3034b8;return _0x324e9c;})[_0x883b('0x24')](respondWithFilteredResult(_0x5e4be5,_0x131c43))[_0x883b('0x41')](handleError(_0x5e4be5,null));};exports[_0x883b('0x42')]=function(_0x43703f,_0x2e6483){var _0x2b4729={'raw':!![],'where':{'id':_0x43703f['params']['id']}},_0x1d5ea8={};_0x1d5ea8[_0x883b('0x31')]=_[_0x883b('0x2f')](db['VoiceQueuesLog'][_0x883b('0x2c')]);_0x1d5ea8['query']=_[_0x883b('0x2f')](_0x43703f[_0x883b('0x2e')]);_0x1d5ea8[_0x883b('0x30')]=_[_0x883b('0x33')](_0x1d5ea8[_0x883b('0x31')],_0x1d5ea8[_0x883b('0x2e')]);_0x2b4729[_0x883b('0x32')]=_[_0x883b('0x33')](_0x1d5ea8[_0x883b('0x31')],qs[_0x883b('0x34')](_0x43703f[_0x883b('0x2e')]['fields']));_0x2b4729[_0x883b('0x32')]=_0x2b4729[_0x883b('0x32')][_0x883b('0x35')]?_0x2b4729[_0x883b('0x32')]:_0x1d5ea8[_0x883b('0x31')];if(_0x43703f['query'][_0x883b('0x3e')]){_0x2b4729[_0x883b('0x3f')]=[{'all':!![]}];}_0x2b4729=_['merge']({},_0x2b4729,_0x43703f[_0x883b('0x3d')]);return db[_0x883b('0x2b')][_0x883b('0x43')](_0x2b4729)[_0x883b('0x24')](handleEntityNotFound(_0x2e6483,null))[_0x883b('0x24')](respondWithResult(_0x2e6483,null))[_0x883b('0x41')](handleError(_0x2e6483,null));};exports[_0x883b('0x44')]=function(_0x504999,_0xf35b94){return db[_0x883b('0x2b')]['create'](_0x504999['body'],{})[_0x883b('0x24')](respondWithResult(_0xf35b94,0xc9))[_0x883b('0x41')](handleError(_0xf35b94,null));};exports[_0x883b('0x23')]=function(_0x3acae5,_0x5bb643){if(_0x3acae5[_0x883b('0x45')]['id']){delete _0x3acae5[_0x883b('0x45')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x3acae5[_0x883b('0x46')]['id']}})[_0x883b('0x24')](handleEntityNotFound(_0x5bb643,null))[_0x883b('0x24')](saveUpdates(_0x3acae5[_0x883b('0x45')],null))['then'](respondWithResult(_0x5bb643,null))['catch'](handleError(_0x5bb643,null));};exports[_0x883b('0x47')]=function(_0x3d3a8b,_0x228682){return db[_0x883b('0x2b')][_0x883b('0x43')]({'where':{'id':_0x3d3a8b['params']['id']}})['then'](handleEntityNotFound(_0x228682,null))[_0x883b('0x24')](removeEntity(_0x228682,null))[_0x883b('0x41')](handleError(_0x228682,null));}; \ No newline at end of file +var _0xaa4a=['find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','error','stack','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xaa4a,0x1a1));var _0xaaa4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa4a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xaaa4('0x0'));var rimraf=require(_0xaaa4('0x1'));var zipdir=require(_0xaaa4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaaa4('0x3'));var moment=require('moment');var BPromise=require(_0xaaa4('0x4'));var Mustache=require(_0xaaa4('0x5'));var util=require(_0xaaa4('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaaa4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaaa4('0x8'));var crypto=require('crypto');var jsforce=require(_0xaaa4('0x9'));var deskjs=require(_0xaaa4('0xa'));var toCsv=require(_0xaaa4('0xb'));var querystring=require(_0xaaa4('0xc'));var Papa=require('papaparse');var Redis=require(_0xaaa4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xaaa4('0xe'));var as=require(_0xaaa4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaaa4('0x10'))('api');var utils=require(_0xaaa4('0x11'));var config=require(_0xaaa4('0x12'));var licenseUtil=require(_0xaaa4('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ab790,_0x5c88c1){_0x5c88c1=_0x5c88c1||0xcc;return function(_0x2640d5){if(_0x2640d5){return _0x5ab790['sendStatus'](_0x5c88c1);}return _0x5ab790[_0xaaa4('0x14')](_0x5c88c1)[_0xaaa4('0x15')]();};}function respondWithResult(_0x421615,_0x416817){_0x416817=_0x416817||0xc8;return function(_0x415129){if(_0x415129){return _0x421615['status'](_0x416817)[_0xaaa4('0x16')](_0x415129);}};}function respondWithFilteredResult(_0x589b6e,_0x2325ee){return function(_0x53c329){if(_0x53c329){var _0x50739e=typeof _0x2325ee[_0xaaa4('0x17')]==='undefined'&&typeof _0x2325ee[_0xaaa4('0x18')]===_0xaaa4('0x19');var _0x450b80=_0x53c329[_0xaaa4('0x1a')];var _0x2b242a=_0x50739e?0x0:_0x2325ee[_0xaaa4('0x17')];var _0x18030b=_0x50739e?_0x53c329['count']:_0x2325ee['offset']+_0x2325ee[_0xaaa4('0x18')];var _0x4f9137;if(_0x18030b>=_0x450b80){_0x18030b=_0x450b80;_0x4f9137=0xc8;}else{_0x4f9137=0xce;}_0x589b6e[_0xaaa4('0x14')](_0x4f9137);return _0x589b6e['set'](_0xaaa4('0x1b'),_0x2b242a+'-'+_0x18030b+'/'+_0x450b80)[_0xaaa4('0x16')](_0x53c329);}return null;};}function patchUpdates(_0x685c2){return function(_0x1b702f){try{jsonpatch['apply'](_0x1b702f,_0x685c2,!![]);}catch(_0x1b6726){return BPromise['reject'](_0x1b6726);}return _0x1b702f[_0xaaa4('0x1c')]();};}function saveUpdates(_0x9b4386,_0x20ecf7){return function(_0x17141b){if(_0x17141b){return _0x17141b[_0xaaa4('0x1d')](_0x9b4386)[_0xaaa4('0x1e')](function(_0x35ce10){return _0x35ce10;});}return null;};}function removeEntity(_0x473d32,_0x2b1f86){return function(_0x53b1bb){if(_0x53b1bb){return _0x53b1bb[_0xaaa4('0x1f')]()[_0xaaa4('0x1e')](function(){_0x473d32[_0xaaa4('0x14')](0xcc)[_0xaaa4('0x15')]();});}};}function handleEntityNotFound(_0xff6311,_0x28056c){return function(_0x43f76c){if(!_0x43f76c){_0xff6311['sendStatus'](0x194);}return _0x43f76c;};}function handleError(_0x163749,_0xa523a0){_0xa523a0=_0xa523a0||0x1f4;return function(_0x2d2b2f){logger[_0xaaa4('0x20')](_0x2d2b2f[_0xaaa4('0x21')]);if(_0x2d2b2f['name']){delete _0x2d2b2f['name'];}_0x163749[_0xaaa4('0x14')](_0xa523a0)['send'](_0x2d2b2f);};}exports['index']=function(_0x3e0dc7,_0x4b9e5a){var _0xdaa882={},_0x5548cb={},_0x52e454={'count':0x0,'rows':[]};var _0x42fbda=_['map'](db[_0xaaa4('0x22')][_0xaaa4('0x23')],function(_0x266674){return{'name':_0x266674[_0xaaa4('0x24')],'type':_0x266674[_0xaaa4('0x25')][_0xaaa4('0x26')]};});_0x5548cb[_0xaaa4('0x27')]=_[_0xaaa4('0x28')](_0x42fbda,_0xaaa4('0x29'));_0x5548cb[_0xaaa4('0x2a')]=_[_0xaaa4('0x2b')](_0x3e0dc7[_0xaaa4('0x2a')]);_0x5548cb['filters']=_[_0xaaa4('0x2c')](_0x5548cb['model'],_0x5548cb[_0xaaa4('0x2a')]);_0xdaa882[_0xaaa4('0x2d')]=_['intersection'](_0x5548cb[_0xaaa4('0x27')],qs[_0xaaa4('0x2e')](_0x3e0dc7[_0xaaa4('0x2a')][_0xaaa4('0x2e')]));_0xdaa882[_0xaaa4('0x2d')]=_0xdaa882[_0xaaa4('0x2d')][_0xaaa4('0x2f')]?_0xdaa882[_0xaaa4('0x2d')]:_0x5548cb[_0xaaa4('0x27')];if(!_0x3e0dc7[_0xaaa4('0x2a')][_0xaaa4('0x30')](_0xaaa4('0x31'))){_0xdaa882['limit']=qs['limit'](_0x3e0dc7[_0xaaa4('0x2a')]['limit']);_0xdaa882[_0xaaa4('0x17')]=qs[_0xaaa4('0x17')](_0x3e0dc7[_0xaaa4('0x2a')][_0xaaa4('0x17')]);}_0xdaa882[_0xaaa4('0x32')]=qs[_0xaaa4('0x33')](_0x3e0dc7[_0xaaa4('0x2a')][_0xaaa4('0x33')]);_0xdaa882[_0xaaa4('0x34')]=qs[_0xaaa4('0x35')](_[_0xaaa4('0x36')](_0x3e0dc7[_0xaaa4('0x2a')],_0x5548cb[_0xaaa4('0x35')]),_0x42fbda);if(_0x3e0dc7[_0xaaa4('0x2a')][_0xaaa4('0x37')]){_0xdaa882['where']=_[_0xaaa4('0x38')](_0xdaa882[_0xaaa4('0x34')],{'$or':_[_0xaaa4('0x28')](_0x42fbda,function(_0x48f2f2){if(_0x48f2f2[_0xaaa4('0x25')]!==_0xaaa4('0x39')){var _0x576680={};_0x576680[_0x48f2f2[_0xaaa4('0x29')]]={'$like':'%'+_0x3e0dc7[_0xaaa4('0x2a')][_0xaaa4('0x37')]+'%'};return _0x576680;}})});}_0xdaa882=_['merge']({},_0xdaa882,_0x3e0dc7[_0xaaa4('0x3a')]);var _0x379f73={'where':_0xdaa882['where']};return db[_0xaaa4('0x22')]['count'](_0x379f73)[_0xaaa4('0x1e')](function(_0x45d21c){_0x52e454['count']=_0x45d21c;if(_0x3e0dc7['query'][_0xaaa4('0x3b')]){_0xdaa882[_0xaaa4('0x3c')]=[{'all':!![]}];}return db[_0xaaa4('0x22')][_0xaaa4('0x3d')](_0xdaa882);})[_0xaaa4('0x1e')](function(_0x4a7dfc){_0x52e454[_0xaaa4('0x3e')]=_0x4a7dfc;return _0x52e454;})[_0xaaa4('0x1e')](respondWithFilteredResult(_0x4b9e5a,_0xdaa882))[_0xaaa4('0x3f')](handleError(_0x4b9e5a,null));};exports[_0xaaa4('0x40')]=function(_0x491d68,_0x5d6d3f){var _0x1f6ba2={'raw':!![],'where':{'id':_0x491d68[_0xaaa4('0x41')]['id']}},_0x4976cf={};_0x4976cf[_0xaaa4('0x27')]=_[_0xaaa4('0x2b')](db['VoiceQueuesLog']['rawAttributes']);_0x4976cf[_0xaaa4('0x2a')]=_[_0xaaa4('0x2b')](_0x491d68[_0xaaa4('0x2a')]);_0x4976cf['filters']=_[_0xaaa4('0x2c')](_0x4976cf[_0xaaa4('0x27')],_0x4976cf['query']);_0x1f6ba2[_0xaaa4('0x2d')]=_['intersection'](_0x4976cf[_0xaaa4('0x27')],qs['fields'](_0x491d68[_0xaaa4('0x2a')][_0xaaa4('0x2e')]));_0x1f6ba2[_0xaaa4('0x2d')]=_0x1f6ba2[_0xaaa4('0x2d')][_0xaaa4('0x2f')]?_0x1f6ba2[_0xaaa4('0x2d')]:_0x4976cf[_0xaaa4('0x27')];if(_0x491d68[_0xaaa4('0x2a')]['includeAll']){_0x1f6ba2[_0xaaa4('0x3c')]=[{'all':!![]}];}_0x1f6ba2=_[_0xaaa4('0x38')]({},_0x1f6ba2,_0x491d68['options']);return db[_0xaaa4('0x22')][_0xaaa4('0x42')](_0x1f6ba2)[_0xaaa4('0x1e')](handleEntityNotFound(_0x5d6d3f,null))[_0xaaa4('0x1e')](respondWithResult(_0x5d6d3f,null))[_0xaaa4('0x3f')](handleError(_0x5d6d3f,null));};exports[_0xaaa4('0x43')]=function(_0x4ba5d8,_0x2896fe){return db[_0xaaa4('0x22')][_0xaaa4('0x43')](_0x4ba5d8[_0xaaa4('0x44')],{})['then'](respondWithResult(_0x2896fe,0xc9))['catch'](handleError(_0x2896fe,null));};exports[_0xaaa4('0x1d')]=function(_0x4c428c,_0x1799cb){if(_0x4c428c[_0xaaa4('0x44')]['id']){delete _0x4c428c['body']['id'];}return db[_0xaaa4('0x22')][_0xaaa4('0x42')]({'where':{'id':_0x4c428c[_0xaaa4('0x41')]['id']}})[_0xaaa4('0x1e')](handleEntityNotFound(_0x1799cb,null))[_0xaaa4('0x1e')](saveUpdates(_0x4c428c['body'],null))['then'](respondWithResult(_0x1799cb,null))[_0xaaa4('0x3f')](handleError(_0x1799cb,null));};exports[_0xaaa4('0x1f')]=function(_0x4b8ec6,_0x50e767){return db[_0xaaa4('0x22')][_0xaaa4('0x42')]({'where':{'id':_0x4b8ec6['params']['id']}})['then'](handleEntityNotFound(_0x50e767,null))[_0xaaa4('0x1e')](removeEntity(_0x50e767,null))[_0xaaa4('0x3f')](handleError(_0x50e767,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0fb7805..9df7cbc 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 _0xcab6=['VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x5a3a75,_0x30ed89){var _0x30dfdb=function(_0x3b7d88){while(--_0x3b7d88){_0x5a3a75['push'](_0x5a3a75['shift']());}};_0x30dfdb(++_0x30ed89);}(_0xcab6,0xd4));var _0x6cab=function(_0x34ef47,_0x2cd6b5){_0x34ef47=_0x34ef47-0x0;var _0x5d05c0=_0xcab6[_0x34ef47];return _0x5d05c0;};'use strict';var _=require(_0x6cab('0x0'));var util=require('util');var logger=require(_0x6cab('0x1'))(_0x6cab('0x2'));var moment=require(_0x6cab('0x3'));var BPromise=require(_0x6cab('0x4'));var rp=require(_0x6cab('0x5'));var fs=require('fs');var path=require(_0x6cab('0x6'));var rimraf=require('rimraf');var config=require(_0x6cab('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x6cab('0x8')]=function(_0x1953cd,_0x13464a){return _0x1953cd['define'](_0x6cab('0x9'),attributes,{'tableName':_0x6cab('0xa'),'paranoid':![],'indexes':[{'name':_0x6cab('0xb'),'fields':[_0x6cab('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x275d=['event_dtm','dtm','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','define','VoiceQueuesLog'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x275d,0x1a6));var _0xd275=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x275d[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0xd275('0x0'));var util=require(_0xd275('0x1'));var logger=require(_0xd275('0x2'))(_0xd275('0x3'));var moment=require(_0xd275('0x4'));var BPromise=require(_0xd275('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd275('0x6'));var rimraf=require('rimraf');var config=require(_0xd275('0x7'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x43f706,_0x556f47){return _0x43f706[_0xd275('0x8')](_0xd275('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xd275('0xa'),'fields':['event',_0xd275('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a959f07..4ac09e6 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 _0x0849=['client','http','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3a4dc2,_0x4f0c24){var _0x2e15b5=function(_0x43d1f9){while(--_0x43d1f9){_0x3a4dc2['push'](_0x3a4dc2['shift']());}};_0x2e15b5(++_0x4f0c24);}(_0x0849,0xca));var _0x9084=function(_0x25fe20,_0x5c4098){_0x25fe20=_0x25fe20-0x0;var _0x5684d0=_0x0849[_0x25fe20];return _0x5684d0;};'use strict';var _=require(_0x9084('0x0'));var util=require(_0x9084('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9084('0x2'));var fs=require('fs');var Redis=require(_0x9084('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9084('0x4'));var logger=require(_0x9084('0x5'))(_0x9084('0x6'));var config=require(_0x9084('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9084('0x8')][_0x9084('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a98fa,_0x421443,_0x2314e1){return new BPromise(function(_0x5bad5b,_0x139725){return client['request'](_0x2a98fa,_0x2314e1)[_0x9084('0xa')](function(_0x4ef3fd){logger['info'](_0x9084('0xb'),_0x421443,_0x9084('0xc'));logger[_0x9084('0xd')](_0x9084('0xe'),_0x421443,_0x9084('0xc'),JSON[_0x9084('0xf')](_0x4ef3fd));if(_0x4ef3fd[_0x9084('0x10')]){if(_0x4ef3fd[_0x9084('0x10')][_0x9084('0x11')]===0x1f4){logger[_0x9084('0x10')](_0x9084('0xb'),_0x421443,_0x4ef3fd['error'][_0x9084('0x12')]);return _0x139725(_0x4ef3fd[_0x9084('0x10')][_0x9084('0x12')]);}logger['error'](_0x9084('0xb'),_0x421443,_0x4ef3fd['error'][_0x9084('0x12')]);return _0x5bad5b(_0x4ef3fd[_0x9084('0x10')]['message']);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x421443,_0x9084('0xc'));_0x5bad5b(_0x4ef3fd[_0x9084('0x13')]['message']);}})[_0x9084('0x14')](function(_0x17d225){logger[_0x9084('0x10')](_0x9084('0xb'),_0x421443,_0x17d225);_0x139725(_0x17d225);});});} \ No newline at end of file +var _0xe129=['request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe129,0x94));var _0x9e12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9e12('0x0'));var util=require(_0x9e12('0x1'));var moment=require('moment');var BPromise=require(_0x9e12('0x2'));var rs=require(_0x9e12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e12('0x4'))['db'];var utils=require(_0x9e12('0x5'));var logger=require('../../config/logger')(_0x9e12('0x6'));var config=require(_0x9e12('0x7'));var jayson=require(_0x9e12('0x8'));var client=jayson[_0x9e12('0x9')][_0x9e12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242bb7,_0x525e08,_0x185f3c){return new BPromise(function(_0x50227b,_0x458427){return client['request'](_0x242bb7,_0x185f3c)[_0x9e12('0xb')](function(_0xa8941e){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x525e08,_0x9e12('0xc'));logger['debug'](_0x9e12('0xd'),_0x525e08,_0x9e12('0xc'),JSON['stringify'](_0xa8941e));if(_0xa8941e[_0x9e12('0xe')]){if(_0xa8941e[_0x9e12('0xe')][_0x9e12('0xf')]===0x1f4){logger[_0x9e12('0xe')](_0x9e12('0x10'),_0x525e08,_0xa8941e[_0x9e12('0xe')][_0x9e12('0x11')]);return _0x458427(_0xa8941e['error'][_0x9e12('0x11')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x525e08,_0xa8941e['error'][_0x9e12('0x11')]);return _0x50227b(_0xa8941e['error'][_0x9e12('0x11')]);}else{logger[_0x9e12('0x12')](_0x9e12('0x10'),_0x525e08,'request\x20sent');_0x50227b(_0xa8941e[_0x9e12('0x13')]['message']);}})['catch'](function(_0x1e0366){logger[_0x9e12('0xe')](_0x9e12('0x10'),_0x525e08,_0x1e0366);_0x458427(_0x1e0366);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c1b907a..c525198 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 _0xcce8=['../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','describe','get','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xcce8,0xc3));var _0x8cce=function(_0x2b792f,_0x5746f1){_0x2b792f=_0x2b792f-0x0;var _0x17a2cc=_0xcce8[_0x2b792f];return _0x17a2cc;};'use strict';var multer=require(_0x8cce('0x0'));var util=require(_0x8cce('0x1'));var path=require(_0x8cce('0x2'));var timeout=require(_0x8cce('0x3'));var express=require(_0x8cce('0x4'));var router=express[_0x8cce('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8cce('0x6'));var interaction=require(_0x8cce('0x7'));var config=require(_0x8cce('0x8'));var controller=require(_0x8cce('0x9'));router['get']('/',auth[_0x8cce('0xa')](),controller[_0x8cce('0xb')]);router['get'](_0x8cce('0xc'),auth[_0x8cce('0xa')](),controller[_0x8cce('0xd')]);router['get']('/:id',auth[_0x8cce('0xa')](),controller['show']);router[_0x8cce('0xe')](_0x8cce('0xf'),auth[_0x8cce('0xa')](),controller[_0x8cce('0x10')]);router[_0x8cce('0xe')]('/:id/downloads',controller[_0x8cce('0x11')]);router[_0x8cce('0xe')](_0x8cce('0x12'),auth[_0x8cce('0xa')](),controller[_0x8cce('0x13')]);router[_0x8cce('0x14')]('/',auth[_0x8cce('0xa')](),controller[_0x8cce('0x15')]);router['post'](_0x8cce('0x12'),auth['isAuthenticated'](),controller[_0x8cce('0x16')]);router[_0x8cce('0x17')](_0x8cce('0x18'),auth[_0x8cce('0xa')](),controller[_0x8cce('0x19')]);router[_0x8cce('0x1a')](_0x8cce('0x18'),auth['isAuthenticated'](),controller[_0x8cce('0x1b')]);module[_0x8cce('0x1c')]=router; \ No newline at end of file +var _0xdaa0=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download','/:id/downloads','/:id/transcribe','post','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x573b2e,_0x55b08a){var _0x5ab42c=function(_0x35c6c9){while(--_0x35c6c9){_0x573b2e['push'](_0x573b2e['shift']());}};_0x5ab42c(++_0x55b08a);}(_0xdaa0,0x10f));var _0x0daa=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xdaa0[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require(_0x0daa('0x0'));var util=require(_0x0daa('0x1'));var path=require(_0x0daa('0x2'));var timeout=require(_0x0daa('0x3'));var express=require(_0x0daa('0x4'));var router=express[_0x0daa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0daa('0x6'));var interaction=require(_0x0daa('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x0daa('0x8')]('/',auth['isAuthenticated'](),controller[_0x0daa('0x9')]);router[_0x0daa('0x8')](_0x0daa('0xa'),auth[_0x0daa('0xb')](),controller[_0x0daa('0xc')]);router[_0x0daa('0x8')](_0x0daa('0xd'),auth[_0x0daa('0xb')](),controller['show']);router[_0x0daa('0x8')](_0x0daa('0xe'),auth[_0x0daa('0xb')](),controller[_0x0daa('0xf')]);router[_0x0daa('0x8')](_0x0daa('0x10'),controller['downloads']);router[_0x0daa('0x8')](_0x0daa('0x11'),auth[_0x0daa('0xb')](),controller['downloadTranscribe']);router[_0x0daa('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0daa('0x12')](_0x0daa('0x11'),auth[_0x0daa('0xb')](),controller[_0x0daa('0x13')]);router[_0x0daa('0x14')](_0x0daa('0xd'),auth[_0x0daa('0xb')](),controller[_0x0daa('0x15')]);router[_0x0daa('0x16')](_0x0daa('0xd'),auth[_0x0daa('0xb')](),controller[_0x0daa('0x17')]);module[_0x0daa('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a8f95d4..7319f5b 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(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 6321d90..0b6dba1 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 _0xa2ac=['tempSentiment','writeFile','root','.txt','rimraf','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','filename','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','token','$and','push','recording','ValidationError','extname','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','listBuckets','createBucket','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa2ac,0x1ba));var _0xca2a=function(_0x12b688,_0x5123b0){_0x12b688=_0x12b688-0x0;var _0x2f8c95=_0xa2ac[_0x12b688];return _0x2f8c95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca2a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca2a('0x1'));var moment=require(_0xca2a('0x2'));var BPromise=require(_0xca2a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xca2a('0x4'));var ejs=require(_0xca2a('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca2a('0x6'));var squel=require(_0xca2a('0x7'));var crypto=require(_0xca2a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xca2a('0x9'));var toCsv=require(_0xca2a('0x4'));var querystring=require(_0xca2a('0xa'));var Papa=require(_0xca2a('0xb'));var AWS=require(_0xca2a('0xc'));var uuidv4=require(_0xca2a('0xd'));var Redis=require(_0xca2a('0xe'));var authService=require(_0xca2a('0xf'));var qs=require(_0xca2a('0x10'));var as=require(_0xca2a('0x11'));var hardwareService=require(_0xca2a('0x12'));var logger=require(_0xca2a('0x13'))(_0xca2a('0x14'));var utils=require('../../config/utils');var config=require(_0xca2a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xca2a('0x16'))['db'];function respondWithStatusCode(_0x543639,_0x514e68){_0x514e68=_0x514e68||0xcc;return function(_0x12af29){if(_0x12af29){return _0x543639[_0xca2a('0x17')](_0x514e68);}return _0x543639[_0xca2a('0x18')](_0x514e68)['end']();};}function respondWithResult(_0x4b043d,_0x455af6){_0x455af6=_0x455af6||0xc8;return function(_0x2122ca){if(_0x2122ca){return _0x4b043d[_0xca2a('0x18')](_0x455af6)[_0xca2a('0x19')](_0x2122ca);}};}function respondWithFilteredResult(_0x2fe334,_0xf2b62c){return function(_0x1c63e1){if(_0x1c63e1){var _0x5a61ef=typeof _0xf2b62c['offset']===_0xca2a('0x1a')&&typeof _0xf2b62c[_0xca2a('0x1b')]===_0xca2a('0x1a');var _0x58896e=_0x1c63e1[_0xca2a('0x1c')];var _0x342c26=_0x5a61ef?0x0:_0xf2b62c[_0xca2a('0x1d')];var _0x5da707=_0x5a61ef?_0x1c63e1['count']:_0xf2b62c['offset']+_0xf2b62c[_0xca2a('0x1b')];var _0x482289;if(_0x5da707>=_0x58896e){_0x5da707=_0x58896e;_0x482289=0xc8;}else{_0x482289=0xce;}_0x2fe334[_0xca2a('0x18')](_0x482289);return _0x2fe334[_0xca2a('0x1e')](_0xca2a('0x1f'),_0x342c26+'-'+_0x5da707+'/'+_0x58896e)[_0xca2a('0x19')](_0x1c63e1);}return null;};}function patchUpdates(_0x4e157c){return function(_0x1220aa){try{jsonpatch[_0xca2a('0x20')](_0x1220aa,_0x4e157c,!![]);}catch(_0xc85f53){return BPromise[_0xca2a('0x21')](_0xc85f53);}return _0x1220aa['save']();};}function saveUpdates(_0x28c86e,_0x47a5be){return function(_0x1fbbcc){if(_0x1fbbcc){return _0x1fbbcc[_0xca2a('0x22')](_0x28c86e)[_0xca2a('0x23')](function(_0x3bb64e){return _0x3bb64e;});}return null;};}function removeEntity(_0x96be06,_0x271db8){return function(_0x3b1e27){if(_0x3b1e27){return _0x3b1e27['destroy']()[_0xca2a('0x23')](function(){_0x96be06[_0xca2a('0x18')](0xcc)[_0xca2a('0x24')]();});}};}function handleEntityNotFound(_0x581c32,_0x4b6b74){return function(_0x457997){if(!_0x457997){_0x581c32[_0xca2a('0x17')](0x194);}return _0x457997;};}function handleError(_0x185cb9,_0x5713da){_0x5713da=_0x5713da||0x1f4;return function(_0x3a2690){logger['error'](_0x3a2690[_0xca2a('0x25')]);if(_0x3a2690[_0xca2a('0x26')]){delete _0x3a2690[_0xca2a('0x26')];}_0x185cb9[_0xca2a('0x18')](_0x5713da)[_0xca2a('0x27')](_0x3a2690);};}exports['index']=function(_0x19e2be,_0xd2bc70){var _0x34442a={},_0x331b9b={},_0xec289={'count':0x0,'rows':[]};var _0x2a17e0=_[_0xca2a('0x28')](db[_0xca2a('0x29')][_0xca2a('0x2a')],function(_0x2149ed){return{'name':_0x2149ed[_0xca2a('0x2b')],'type':_0x2149ed[_0xca2a('0x2c')][_0xca2a('0x2d')]};});_0x331b9b[_0xca2a('0x2e')]=_['differenceBy'](_[_0xca2a('0x28')](_0x2a17e0,_0xca2a('0x26')),[_0xca2a('0x2f')]);_0x331b9b[_0xca2a('0x30')]=_[_0xca2a('0x31')](_0x19e2be[_0xca2a('0x30')]);_0x331b9b[_0xca2a('0x32')]=_[_0xca2a('0x33')](_0x331b9b[_0xca2a('0x2e')],_0x331b9b[_0xca2a('0x30')]);_0x34442a[_0xca2a('0x34')]=_[_0xca2a('0x33')](_0x331b9b[_0xca2a('0x2e')],qs[_0xca2a('0x35')](_0x19e2be[_0xca2a('0x30')][_0xca2a('0x35')]));_0x34442a[_0xca2a('0x34')]=_0x34442a[_0xca2a('0x34')][_0xca2a('0x36')]?_0x34442a[_0xca2a('0x34')]:_0x331b9b[_0xca2a('0x2e')];if(!_0x19e2be[_0xca2a('0x30')][_0xca2a('0x37')](_0xca2a('0x38'))){_0x34442a[_0xca2a('0x1b')]=qs[_0xca2a('0x1b')](_0x19e2be[_0xca2a('0x30')][_0xca2a('0x1b')]);_0x34442a[_0xca2a('0x1d')]=qs['offset'](_0x19e2be['query'][_0xca2a('0x1d')]);}_0x34442a[_0xca2a('0x39')]=qs[_0xca2a('0x3a')](_0x19e2be[_0xca2a('0x30')][_0xca2a('0x3a')]);_0x34442a['where']=qs[_0xca2a('0x32')](_[_0xca2a('0x3b')](_0x19e2be[_0xca2a('0x30')],_0x331b9b['filters']),_0x2a17e0);if(_0x19e2be[_0xca2a('0x30')]['filter']){_0x34442a[_0xca2a('0x3c')]=_[_0xca2a('0x3d')](_0x34442a[_0xca2a('0x3c')],{'$or':_[_0xca2a('0x28')](_0x2a17e0,function(_0xb030fd){if(_0xb030fd[_0xca2a('0x2c')]!==_0xca2a('0x3e')){var _0x28bade={};_0x28bade[_0xb030fd['name']]={'$like':'%'+_0x19e2be[_0xca2a('0x30')][_0xca2a('0x3f')]+'%'};return _0x28bade;}})});}_0x34442a=_[_0xca2a('0x3d')]({},_0x34442a,_0x19e2be[_0xca2a('0x40')]);var _0x29ddcd={'where':_0x34442a['where']};return db[_0xca2a('0x29')][_0xca2a('0x1c')](_0x29ddcd)[_0xca2a('0x23')](function(_0x36fdf3){_0xec289[_0xca2a('0x1c')]=_0x36fdf3;if(_0x19e2be['query'][_0xca2a('0x41')]){_0x34442a[_0xca2a('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0xca2a('0x43')](_0x34442a);})['then'](function(_0x54e993){_0xec289[_0xca2a('0x44')]=_0x54e993;return _0xec289;})[_0xca2a('0x23')](respondWithFilteredResult(_0xd2bc70,_0x34442a))['catch'](handleError(_0xd2bc70,null));};exports[_0xca2a('0x45')]=function(_0xeeba96,_0x536d4f){var _0x3a3103={'raw':![],'where':{'id':_0xeeba96['params']['id']}},_0x51adb3={};_0x51adb3[_0xca2a('0x2e')]=_[_0xca2a('0x31')](db['VoiceRecording'][_0xca2a('0x2a')]);_0x51adb3[_0xca2a('0x30')]=_[_0xca2a('0x31')](_0xeeba96[_0xca2a('0x30')]);_0x51adb3['filters']=_[_0xca2a('0x33')](_0x51adb3[_0xca2a('0x2e')],_0x51adb3[_0xca2a('0x30')]);_0x3a3103[_0xca2a('0x34')]=_[_0xca2a('0x33')](_0x51adb3[_0xca2a('0x2e')],qs[_0xca2a('0x35')](_0xeeba96['query'][_0xca2a('0x35')]));_0x3a3103[_0xca2a('0x34')]=_0x3a3103[_0xca2a('0x34')][_0xca2a('0x36')]?_0x3a3103['attributes']:_0x51adb3['model'];if(_0xeeba96[_0xca2a('0x30')][_0xca2a('0x41')]){_0x3a3103['include']=[{'all':!![]}];}_0x3a3103=_['merge']({},_0x3a3103,_0xeeba96[_0xca2a('0x40')]);return db[_0xca2a('0x29')][_0xca2a('0x46')](_0x3a3103)[_0xca2a('0x23')](handleEntityNotFound(_0x536d4f,null))[_0xca2a('0x23')](respondWithResult(_0x536d4f,null))[_0xca2a('0x47')](handleError(_0x536d4f,null));};exports[_0xca2a('0x48')]=function(_0x413abc,_0x2d7bcb){return db['VoiceRecording'][_0xca2a('0x48')](_0x413abc['body'],{})[_0xca2a('0x23')](respondWithResult(_0x2d7bcb,0xc9))[_0xca2a('0x47')](handleError(_0x2d7bcb,null));};exports[_0xca2a('0x22')]=function(_0x3546c4,_0x23aa9e){if(_0x3546c4[_0xca2a('0x49')]['id']){delete _0x3546c4[_0xca2a('0x49')]['id'];}return db[_0xca2a('0x29')][_0xca2a('0x46')]({'where':{'id':_0x3546c4[_0xca2a('0x4a')]['id']}})[_0xca2a('0x23')](handleEntityNotFound(_0x23aa9e,null))[_0xca2a('0x23')](saveUpdates(_0x3546c4[_0xca2a('0x49')],null))[_0xca2a('0x23')](respondWithResult(_0x23aa9e,null))[_0xca2a('0x47')](handleError(_0x23aa9e,null));};exports[_0xca2a('0x4b')]=function(_0x38d2d4,_0xafac5c){return db['VoiceRecording'][_0xca2a('0x4b')]()[_0xca2a('0x23')](respondWithResult(_0xafac5c,null))[_0xca2a('0x47')](handleError(_0xafac5c,null));};exports[_0xca2a('0x4c')]=function(_0x1cd004,_0x51b9b9,_0x28c91c){var _0x5922c6=require(_0xca2a('0x4d'));var _0x2acd4f=![];var _0x186ed4={};if(_0x1cd004[_0xca2a('0x30')][_0xca2a('0x2c')]&&_0x1cd004[_0xca2a('0x30')]['type']===_0xca2a('0x4e')){_0x186ed4[_0xca2a('0x4e')]=_0x1cd004['params']['id'];}else{_0x186ed4['id']=_0x1cd004[_0xca2a('0x4a')]['id'];}return db[_0xca2a('0x29')][_0xca2a('0x46')]({'where':_0x186ed4,'attributes':['id','value'],'raw':!![]})[_0xca2a('0x23')](handleEntityNotFound(_0x51b9b9,null))[_0xca2a('0x23')](function(_0x33af22){if(_0x33af22){var _0x29cf00=_0x33af22[_0xca2a('0x4f')];var _0x158f41=util[_0xca2a('0x2f')](_0xca2a('0x50'),_0x29cf00);if(fs[_0xca2a('0x51')](_0x158f41)){_0x2acd4f=!![];return _0x5922c6[_0xca2a('0x52')](_0x158f41,_0x29cf00,config[_0xca2a('0x53')]['recording'])[_0xca2a('0x23')](function(){return _0x33af22;});}return _0x33af22;}})[_0xca2a('0x23')](function(_0x5c7840){if(_0x5c7840){var _0x406a1c=_0x5c7840[_0xca2a('0x4f')];if(!fs[_0xca2a('0x51')](_0x406a1c)){throw new db[(_0xca2a('0x54'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x5c7840['filename']){return _0x51b9b9['download'](_0x406a1c,_0x5c7840[_0xca2a('0x55')]+path['extname'](_0x406a1c),function(){if(_0x2acd4f){fs[_0xca2a('0x56')](_0x406a1c);}});}else{return _0x51b9b9[_0xca2a('0x4c')](_0x406a1c,function(_0xcfa20a){if(_0x2acd4f){fs[_0xca2a('0x56')](_0x406a1c);}});}}})[_0xca2a('0x47')](function(_0x10cb1f){if(_0x10cb1f[_0xca2a('0x57')]===_0xca2a('0x58')){_0x51b9b9[_0xca2a('0x18')](0x194)[_0xca2a('0x27')](_0xca2a('0x59'));}else{return handleError(_0x51b9b9,null);}});};exports[_0xca2a('0x5a')]=function(_0x425ef9,_0x2c48be,_0x529aff){var _0x5464b1=require(_0xca2a('0x4d'));var _0x337f79=![];var _0x15be57={'$and':[db[_0xca2a('0x5b')][_0xca2a('0x3c')](db[_0xca2a('0x5b')]['fn'](_0xca2a('0x5c'),db[_0xca2a('0x5b')]['col'](_0xca2a('0x4e'))),_0x425ef9['query'][_0xca2a('0x5d')])]};if(_0x425ef9[_0xca2a('0x30')][_0xca2a('0x2c')]&&_0x425ef9['query']['type']==='uniqueid'){_0x15be57[_0xca2a('0x5e')][_0xca2a('0x5f')]({'uniqueid':_0x425ef9[_0xca2a('0x4a')]['id']});}else{_0x15be57[_0xca2a('0x5e')][_0xca2a('0x5f')]({'id':_0x425ef9[_0xca2a('0x4a')]['id']});}return db[_0xca2a('0x29')][_0xca2a('0x46')]({'where':_0x15be57,'attributes':['id',_0xca2a('0x4f')],'raw':!![]})[_0xca2a('0x23')](handleEntityNotFound(_0x2c48be,null))[_0xca2a('0x23')](function(_0x414f87){if(_0x414f87){var _0x5e7e04=util[_0xca2a('0x2f')](_0xca2a('0x50'),_0x414f87[_0xca2a('0x4f')]);if(fs[_0xca2a('0x51')](_0x5e7e04)){_0x337f79=!![];return _0x5464b1[_0xca2a('0x52')](_0x5e7e04,_0x414f87['value'],config[_0xca2a('0x53')][_0xca2a('0x60')])[_0xca2a('0x23')](function(){return _0x414f87;});}return _0x414f87;}})[_0xca2a('0x23')](function(_0x1dcdf4){if(_0x1dcdf4){if(!fs[_0xca2a('0x51')](_0x1dcdf4[_0xca2a('0x4f')])){throw new db[(_0xca2a('0x54'))][(_0xca2a('0x61'))](_0xca2a('0x58'));}if(_0x1dcdf4[_0xca2a('0x55')]){return _0x2c48be[_0xca2a('0x4c')](_0x1dcdf4['value'],_0x1dcdf4[_0xca2a('0x55')]+path[_0xca2a('0x62')](_0x1dcdf4[_0xca2a('0x4f')]),function(){if(_0x337f79){fs[_0xca2a('0x56')](_0x1dcdf4[_0xca2a('0x4f')]);}});}else{return _0x2c48be[_0xca2a('0x4c')](_0x1dcdf4[_0xca2a('0x4f')],function(_0x31724b){if(_0x337f79){fs[_0xca2a('0x56')](_0x1dcdf4[_0xca2a('0x4f')]);}});}}})[_0xca2a('0x47')](handleError(_0x2c48be,null));};exports['destroy']=function(_0x3d9288,_0x365b92){return db[_0xca2a('0x29')][_0xca2a('0x46')]({'where':{'id':_0x3d9288[_0xca2a('0x4a')]['id']}})[_0xca2a('0x23')](function(_0x47634f){if(_[_0xca2a('0x63')](_0x47634f)){throw new ReferenceError(_0xca2a('0x64'));}return _0x47634f;})[_0xca2a('0x23')](function(_0x25c9be){var _0x1a1685=_0x25c9be[_0xca2a('0x4f')];logger[_0xca2a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1a1685);if(!_['isNil'](_0x25c9be[_0xca2a('0x4f')])&&fs['existsSync'](_0x1a1685)){logger[_0xca2a('0x65')](_0xca2a('0x66')+_0x1a1685+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xca2a('0x67')](_0x1a1685);}_0x1a1685=_0x1a1685+_0xca2a('0x68');if(!_[_0xca2a('0x63')](_0x25c9be[_0xca2a('0x4f')])&&fs[_0xca2a('0x51')](_0x1a1685)){logger[_0xca2a('0x65')]('File:\x20\x22'+_0x1a1685+_0xca2a('0x69'));fs[_0xca2a('0x67')](_0x1a1685);}return _0x25c9be;})[_0xca2a('0x23')](function(_0x5a3eab){if(!_0x5a3eab)throw new InternalError();return _0x5a3eab[_0xca2a('0x6a')]();})[_0xca2a('0x23')](function(){_0x365b92[_0xca2a('0x18')](0xcc)['end']();})['catch'](handleError(_0x365b92,null));};function getBucketslist(_0x489374,_0x509341,_0x290e5d){return new Promise(function(_0x2ce50a,_0x2e44ad){var _0x34097b=new AWS['S3']({'accessKeyId':_0x509341,'secretAccessKey':_0x489374,'region':_0x290e5d});_0x34097b[_0xca2a('0x6b')]({},function(_0x27cbbb,_0x4d6a7d){if(_0x27cbbb){return _0x2e44ad(_0x27cbbb);}else{return _0x2ce50a(_0x4d6a7d);}});});}function createBucket(_0x4b808c,_0x90e39b,_0xcf4b95,_0x52e156){return new Promise(function(_0xb96d1a,_0x3a5198){var _0x1628e4=new AWS['S3']({'accessKeyId':_0x90e39b,'secretAccessKey':_0x4b808c,'region':_0xcf4b95});_0x1628e4[_0xca2a('0x6c')]({'Bucket':_0x52e156},function(_0x47e0f3,_0x4962bb){if(_0x47e0f3){return _0x3a5198(_0x47e0f3);}else{return _0xb96d1a(_0x4962bb);}});});}function uploadFile(_0x1b3bbf,_0x4dcf32,_0x4129a3,_0x1e0480,_0x4a8b61,_0xc246a1){return new Promise(function(_0x7440a3,_0x311f02){var _0x49ebcf=new AWS['S3']({'accessKeyId':_0x4dcf32,'secretAccessKey':_0x1b3bbf,'region':_0x4129a3});_0x49ebcf['upload']({'Bucket':_0x1e0480,'Key':_0x4a8b61,'Body':_0xc246a1},function(_0x5b7386,_0x238467){if(_0x5b7386){return _0x311f02(_0x5b7386);}else{return _0x7440a3(_0x238467);}});});}function startTranscribe(_0x4727c6,_0x36f625,_0xc36143,_0x3926c0,_0x500003,_0x14d0f3){return new Promise(function(_0x6c6181,_0x9b3f05){var _0xb3fe32=new AWS['TranscribeService']({'accessKeyId':_0x36f625,'secretAccessKey':_0x4727c6,'region':_0xc36143});_0xb3fe32[_0xca2a('0x6d')]({'TranscriptionJobName':_0x3926c0,'LanguageCode':_0x500003,'Media':{'MediaFileUri':_0x14d0f3}},function(_0x31e8c1,_0x219932){if(_0x31e8c1){return _0x9b3f05(_0x31e8c1);}else{return _0x6c6181(_0x219932);}});});}function transcribe(_0x4ff244,_0xce453b,_0x15cf0e,_0x253cd4,_0x3fe2f3,_0x42ce74,_0x31ae90){return new Promise(function(_0x1d6f49,_0x4477ce){var _0x476b78={};logger[_0xca2a('0x65')](util[_0xca2a('0x2f')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4ff244,_0x3fe2f3));return uploadFile(_0xce453b,_0x15cf0e,_0x253cd4,_0x3fe2f3,path[_0xca2a('0x6e')](_0x42ce74),fs[_0xca2a('0x6f')](_0x42ce74))[_0xca2a('0x23')](function(_0x516312){logger[_0xca2a('0x65')](util[_0xca2a('0x2f')](_0xca2a('0x70'),_0x4ff244,_0x3fe2f3,_0x516312[_0xca2a('0x71')]));_0x476b78[_0xca2a('0x72')]=_0x516312['Bucket'];_0x476b78[_0xca2a('0x73')]=_0x516312[_0xca2a('0x71')];logger['info'](util['format'](_0xca2a('0x74'),_0x4ff244));return startTranscribe(_0xce453b,_0x15cf0e,_0x253cd4,uuidv4(),_0x31ae90,_0x516312[_0xca2a('0x71')]);})[_0xca2a('0x23')](function(_0x320378){logger['info'](util[_0xca2a('0x2f')](_0xca2a('0x75'),_0x4ff244,_0x320378[_0xca2a('0x76')]['TranscriptionJobName']));_0x476b78['transcribeName']=_0x320378['TranscriptionJob'][_0xca2a('0x77')];_0x476b78[_0xca2a('0x78')]=_0x320378[_0xca2a('0x76')]['TranscriptionJobStatus'];return _0x1d6f49(_0x476b78);})['catch'](function(_0x3fa70c){return _0x4477ce(_0x3fa70c);});});}exports[_0xca2a('0x79')]=function(_0x5bebe9,_0x5ca3d0,_0x358eb8){var _0x435126;var _0x514578;var _0x26f847;var _0x4ae67a=require(_0xca2a('0x4d'));return db['VoiceRecording'][_0xca2a('0x7a')]({'where':{'id':_0x5bebe9[_0xca2a('0x4a')]['id']}})[_0xca2a('0x23')](function(_0x23cb10){if(_0x23cb10){var _0x30ed99=util[_0xca2a('0x2f')]('%s.cypher',_0x23cb10[_0xca2a('0x4f')]);if(fs[_0xca2a('0x51')](_0x30ed99)){cypher=!![];return _0x4ae67a['decryptFile'](_0x30ed99,_0x23cb10[_0xca2a('0x4f')],config[_0xca2a('0x53')][_0xca2a('0x60')])[_0xca2a('0x23')](function(){return _0x23cb10;});}return _0x23cb10;}})['then'](function(_0x5417cc){if(!_0x5417cc){throw new db[(_0xca2a('0x54'))][(_0xca2a('0x61'))](_0xca2a('0x7b'));}_0x514578=_0x5417cc;return db[_0xca2a('0x7c')][_0xca2a('0x7a')]({'where':{'id':0x1}});})[_0xca2a('0x23')](handleEntityNotFound(_0x5ca3d0,null))[_0xca2a('0x23')](function(_0x5dbbd8){if(_0x5dbbd8){_0x435126=_0x5dbbd8;if(!_0x435126['transcribe']||!_0x435126['transcribeAccountId']||!_0x435126[_0xca2a('0x7d')]||!_0x435126[_0xca2a('0x7e')]||!_0x435126['bucket']){throw new db[(_0xca2a('0x54'))][(_0xca2a('0x61'))]('Transcribe\x20not\x20configured');}if(_0x5bebe9[_0xca2a('0x49')][_0xca2a('0x7f')]&&(!_0x435126[_0xca2a('0x80')]||!_0x435126[_0xca2a('0x81')]||!_0x435126[_0xca2a('0x82')]||!_0x435126[_0xca2a('0x7e')]||!_0x435126[_0xca2a('0x72')])){throw new db[(_0xca2a('0x54'))][(_0xca2a('0x61'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x435126[_0xca2a('0x83')]}});}})[_0xca2a('0x23')](function(_0x198399){if(!_0x198399){throw new db[(_0xca2a('0x54'))]['ValidationError'](_0xca2a('0x84'));}if(!_0x198399[_0xca2a('0x85')]||!_0x198399[_0xca2a('0x86')]){throw new db[(_0xca2a('0x54'))][(_0xca2a('0x61'))](_0xca2a('0x87'));}_0x26f847=_0x198399;return getBucketslist(_0x26f847[_0xca2a('0x85')],_0x26f847[_0xca2a('0x86')],_0x435126[_0xca2a('0x7d')]);})[_0xca2a('0x23')](function(_0x3fc324){if(_0x3fc324&&_0x3fc324[_0xca2a('0x88')]){var _0x4f5f32=_[_0xca2a('0x46')](_0x3fc324[_0xca2a('0x88')],function(_0x46ab0a){return _0x46ab0a[_0xca2a('0x89')]===_0x435126[_0xca2a('0x72')];});if(!_0x4f5f32){logger[_0xca2a('0x65')](util[_0xca2a('0x2f')](_0xca2a('0x8a'),_0x5bebe9[_0xca2a('0x4a')]['id'],_0x435126[_0xca2a('0x72')]));return createBucket(_0x26f847[_0xca2a('0x85')],_0x26f847[_0xca2a('0x86')],_0x435126['transcribeRegion'],_0x435126[_0xca2a('0x72')]);}logger[_0xca2a('0x65')](util[_0xca2a('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5bebe9['params']['id'],_0x435126[_0xca2a('0x72')]));return;}})[_0xca2a('0x23')](function(_0x1cad68){if(_0x514578[_0xca2a('0x78')]===_0xca2a('0x8b')){return transcribe(_0x5bebe9[_0xca2a('0x4a')]['id'],_0x26f847[_0xca2a('0x85')],_0x26f847[_0xca2a('0x86')],_0x435126[_0xca2a('0x7d')],_0x435126[_0xca2a('0x72')],_0x514578[_0xca2a('0x4f')],_0x435126[_0xca2a('0x7e')]);}else{logger[_0xca2a('0x65')](util[_0xca2a('0x2f')](_0xca2a('0x8c'),_0x5bebe9[_0xca2a('0x4a')]['id']));return{'transcribeStatus':_0xca2a('0x8d')};}})['then'](function(_0x10b90c){if(_0x10b90c){_0x10b90c[_0xca2a('0x8e')]=_0x5bebe9[_0xca2a('0x49')][_0xca2a('0x7f')];return _0x514578['updateAttributes'](_0x10b90c);}})['then'](respondWithResult(_0x5ca3d0,null))[_0xca2a('0x47')](handleError(_0x5ca3d0,null));};function writeFile(_0x350f03,_0x191e55){return new Promise(function(_0x55c727,_0x4abb8e){fs[_0xca2a('0x8f')](_0x191e55,_0x350f03,function(_0x1ba39a,_0x466799){if(_0x1ba39a){return _0x4abb8e(_0x1ba39a);}else{return _0x55c727(_0x466799);}});});}exports['downloadTranscribe']=function(_0x122d99,_0x11c6bd,_0x2cd016){return db[_0xca2a('0x29')]['findOne']({'where':{'id':_0x122d99[_0xca2a('0x4a')]['id']}})[_0xca2a('0x23')](handleEntityNotFound(_0x11c6bd))['then'](function(_0x5cf8fe){if(_0x5cf8fe&&_0x5cf8fe['fileText']){var _0x45e614=_0x5cf8fe['fileText'];var _0x304d70=config[_0xca2a('0x90')]+'/server/files/transcribes/transcribe_'+_0x5cf8fe['id']+_0xca2a('0x91');if(fs['existsSync'](_0x304d70)){return _0x304d70;}return writeFile(_0x45e614,_0x304d70)[_0xca2a('0x23')](function(){return _0x304d70;});}else{throw new db[(_0xca2a('0x54'))][(_0xca2a('0x61'))]('Transcript\x20not\x20available');}})[_0xca2a('0x23')](function(_0x5edae6){return _0x11c6bd[_0xca2a('0x4c')](_0x5edae6);})[_0xca2a('0x47')](handleError(_0x11c6bd));}; \ No newline at end of file +var _0x92d5=['downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','json','apply','reject','update','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','format','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','unlink','message','Not\x20found','sequelize','col','token','$and','push','secrets','extname','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','transcribeAccountId','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile'];(function(_0x11c8e3,_0x2b8a22){var _0x401872=function(_0x287f36){while(--_0x287f36){_0x11c8e3['push'](_0x11c8e3['shift']());}};_0x401872(++_0x2b8a22);}(_0x92d5,0x11c));var _0x592d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x92d5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x592d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x592d('0x1'));var moment=require(_0x592d('0x2'));var BPromise=require(_0x592d('0x3'));var Mustache=require(_0x592d('0x4'));var util=require(_0x592d('0x5'));var path=require(_0x592d('0x6'));var sox=require(_0x592d('0x7'));var csv=require(_0x592d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x592d('0x9'));var _=require('lodash');var squel=require(_0x592d('0xa'));var crypto=require(_0x592d('0xb'));var jsforce=require(_0x592d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x592d('0xd'));var AWS=require(_0x592d('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0x592d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x592d('0x10'));var as=require(_0x592d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x592d('0x12'));var db=require(_0x592d('0x13'))['db'];function respondWithStatusCode(_0x2010e2,_0x3f14a2){_0x3f14a2=_0x3f14a2||0xcc;return function(_0x82939d){if(_0x82939d){return _0x2010e2['sendStatus'](_0x3f14a2);}return _0x2010e2['status'](_0x3f14a2)[_0x592d('0x14')]();};}function respondWithResult(_0x1c404e,_0x243ff7){_0x243ff7=_0x243ff7||0xc8;return function(_0x28b424){if(_0x28b424){return _0x1c404e[_0x592d('0x15')](_0x243ff7)['json'](_0x28b424);}};}function respondWithFilteredResult(_0x134ed5,_0x1cc311){return function(_0x2a6d43){if(_0x2a6d43){var _0x36a734=typeof _0x1cc311[_0x592d('0x16')]==='undefined'&&typeof _0x1cc311[_0x592d('0x17')]===_0x592d('0x18');var _0x484d9c=_0x2a6d43[_0x592d('0x19')];var _0x203184=_0x36a734?0x0:_0x1cc311[_0x592d('0x16')];var _0x42a0e5=_0x36a734?_0x2a6d43[_0x592d('0x19')]:_0x1cc311[_0x592d('0x16')]+_0x1cc311['limit'];var _0x47bab5;if(_0x42a0e5>=_0x484d9c){_0x42a0e5=_0x484d9c;_0x47bab5=0xc8;}else{_0x47bab5=0xce;}_0x134ed5[_0x592d('0x15')](_0x47bab5);return _0x134ed5[_0x592d('0x1a')]('Content-Range',_0x203184+'-'+_0x42a0e5+'/'+_0x484d9c)[_0x592d('0x1b')](_0x2a6d43);}return null;};}function patchUpdates(_0x160218){return function(_0x380a17){try{jsonpatch[_0x592d('0x1c')](_0x380a17,_0x160218,!![]);}catch(_0x22b0e3){return BPromise[_0x592d('0x1d')](_0x22b0e3);}return _0x380a17['save']();};}function saveUpdates(_0xb91231,_0x5c9628){return function(_0x43a1fd){if(_0x43a1fd){return _0x43a1fd[_0x592d('0x1e')](_0xb91231)[_0x592d('0x1f')](function(_0x56df28){return _0x56df28;});}return null;};}function removeEntity(_0x174942,_0x30180b){return function(_0x4301f3){if(_0x4301f3){return _0x4301f3['destroy']()['then'](function(){_0x174942[_0x592d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff2a7,_0x2526fa){return function(_0x444516){if(!_0x444516){_0x1ff2a7[_0x592d('0x20')](0x194);}return _0x444516;};}function handleError(_0x28753f,_0x579547){_0x579547=_0x579547||0x1f4;return function(_0x16498d){logger['error'](_0x16498d['stack']);if(_0x16498d[_0x592d('0x21')]){delete _0x16498d[_0x592d('0x21')];}_0x28753f[_0x592d('0x15')](_0x579547)[_0x592d('0x22')](_0x16498d);};}exports[_0x592d('0x23')]=function(_0x4a087c,_0x1d02b0){var _0x1739f2={},_0x5c7577={},_0x20803b={'count':0x0,'rows':[]};var _0x9a81e7=_[_0x592d('0x24')](db['VoiceRecording'][_0x592d('0x25')],function(_0x347a74){return{'name':_0x347a74[_0x592d('0x26')],'type':_0x347a74[_0x592d('0x27')][_0x592d('0x28')]};});_0x5c7577['model']=_['differenceBy'](_[_0x592d('0x24')](_0x9a81e7,_0x592d('0x21')),[_0x592d('0x29')]);_0x5c7577[_0x592d('0x2a')]=_[_0x592d('0x2b')](_0x4a087c['query']);_0x5c7577[_0x592d('0x2c')]=_[_0x592d('0x2d')](_0x5c7577['model'],_0x5c7577[_0x592d('0x2a')]);_0x1739f2[_0x592d('0x2e')]=_[_0x592d('0x2d')](_0x5c7577[_0x592d('0x2f')],qs['fields'](_0x4a087c[_0x592d('0x2a')][_0x592d('0x30')]));_0x1739f2[_0x592d('0x2e')]=_0x1739f2[_0x592d('0x2e')]['length']?_0x1739f2[_0x592d('0x2e')]:_0x5c7577[_0x592d('0x2f')];if(!_0x4a087c[_0x592d('0x2a')][_0x592d('0x31')]('nolimit')){_0x1739f2[_0x592d('0x17')]=qs[_0x592d('0x17')](_0x4a087c['query'][_0x592d('0x17')]);_0x1739f2[_0x592d('0x16')]=qs[_0x592d('0x16')](_0x4a087c[_0x592d('0x2a')][_0x592d('0x16')]);}_0x1739f2[_0x592d('0x32')]=qs['sort'](_0x4a087c[_0x592d('0x2a')][_0x592d('0x33')]);_0x1739f2[_0x592d('0x34')]=qs[_0x592d('0x2c')](_[_0x592d('0x35')](_0x4a087c[_0x592d('0x2a')],_0x5c7577[_0x592d('0x2c')]),_0x9a81e7);if(_0x4a087c[_0x592d('0x2a')][_0x592d('0x36')]){_0x1739f2[_0x592d('0x34')]=_['merge'](_0x1739f2['where'],{'$or':_[_0x592d('0x24')](_0x9a81e7,function(_0x1df782){if(_0x1df782[_0x592d('0x27')]!==_0x592d('0x37')){var _0x3f09fb={};_0x3f09fb[_0x1df782['name']]={'$like':'%'+_0x4a087c[_0x592d('0x2a')][_0x592d('0x36')]+'%'};return _0x3f09fb;}})});}_0x1739f2=_[_0x592d('0x38')]({},_0x1739f2,_0x4a087c[_0x592d('0x39')]);var _0x38f4bb={'where':_0x1739f2[_0x592d('0x34')]};return db[_0x592d('0x3a')][_0x592d('0x19')](_0x38f4bb)[_0x592d('0x1f')](function(_0x28beaa){_0x20803b[_0x592d('0x19')]=_0x28beaa;if(_0x4a087c[_0x592d('0x2a')][_0x592d('0x3b')]){_0x1739f2[_0x592d('0x3c')]=[{'all':!![]}];}return db[_0x592d('0x3a')][_0x592d('0x3d')](_0x1739f2);})['then'](function(_0x5130d8){_0x20803b[_0x592d('0x3e')]=_0x5130d8;return _0x20803b;})[_0x592d('0x1f')](respondWithFilteredResult(_0x1d02b0,_0x1739f2))['catch'](handleError(_0x1d02b0,null));};exports[_0x592d('0x3f')]=function(_0xf420a1,_0x57246d){var _0x486bda={'raw':![],'where':{'id':_0xf420a1[_0x592d('0x40')]['id']}},_0x5b653c={};_0x5b653c[_0x592d('0x2f')]=_[_0x592d('0x2b')](db[_0x592d('0x3a')]['rawAttributes']);_0x5b653c[_0x592d('0x2a')]=_[_0x592d('0x2b')](_0xf420a1[_0x592d('0x2a')]);_0x5b653c['filters']=_[_0x592d('0x2d')](_0x5b653c[_0x592d('0x2f')],_0x5b653c[_0x592d('0x2a')]);_0x486bda['attributes']=_[_0x592d('0x2d')](_0x5b653c[_0x592d('0x2f')],qs[_0x592d('0x30')](_0xf420a1[_0x592d('0x2a')][_0x592d('0x30')]));_0x486bda[_0x592d('0x2e')]=_0x486bda[_0x592d('0x2e')]['length']?_0x486bda['attributes']:_0x5b653c[_0x592d('0x2f')];if(_0xf420a1[_0x592d('0x2a')][_0x592d('0x3b')]){_0x486bda['include']=[{'all':!![]}];}_0x486bda=_[_0x592d('0x38')]({},_0x486bda,_0xf420a1['options']);return db['VoiceRecording'][_0x592d('0x41')](_0x486bda)[_0x592d('0x1f')](handleEntityNotFound(_0x57246d,null))[_0x592d('0x1f')](respondWithResult(_0x57246d,null))[_0x592d('0x42')](handleError(_0x57246d,null));};exports[_0x592d('0x43')]=function(_0x2d8fbc,_0x3be507){return db[_0x592d('0x3a')]['create'](_0x2d8fbc['body'],{})['then'](respondWithResult(_0x3be507,0xc9))[_0x592d('0x42')](handleError(_0x3be507,null));};exports[_0x592d('0x1e')]=function(_0xb454a8,_0x278017){if(_0xb454a8['body']['id']){delete _0xb454a8['body']['id'];}return db['VoiceRecording'][_0x592d('0x41')]({'where':{'id':_0xb454a8[_0x592d('0x40')]['id']}})[_0x592d('0x1f')](handleEntityNotFound(_0x278017,null))[_0x592d('0x1f')](saveUpdates(_0xb454a8[_0x592d('0x44')],null))['then'](respondWithResult(_0x278017,null))['catch'](handleError(_0x278017,null));};exports['describe']=function(_0x2a4ce2,_0x1fcdaf){return db[_0x592d('0x3a')][_0x592d('0x45')]()[_0x592d('0x1f')](respondWithResult(_0x1fcdaf,null))[_0x592d('0x42')](handleError(_0x1fcdaf,null));};exports[_0x592d('0x46')]=function(_0x3055ba,_0x7bf95d,_0x2204ff){var _0x4b8aae=require(_0x592d('0x47'));var _0x57af5b=![];var _0x434aca={};if(_0x3055ba[_0x592d('0x2a')][_0x592d('0x27')]&&_0x3055ba[_0x592d('0x2a')][_0x592d('0x27')]===_0x592d('0x48')){_0x434aca[_0x592d('0x48')]=_0x3055ba['params']['id'];}else{_0x434aca['id']=_0x3055ba['params']['id'];}return db[_0x592d('0x3a')]['find']({'where':_0x434aca,'attributes':['id',_0x592d('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x7bf95d,null))['then'](function(_0x99f95e){if(_0x99f95e){var _0x4c8b1a=_0x99f95e[_0x592d('0x49')];var _0x2ef545=util['format']('%s.cypher',_0x4c8b1a);if(fs[_0x592d('0x4a')](_0x2ef545)){_0x57af5b=!![];return _0x4b8aae[_0x592d('0x4b')](_0x2ef545,_0x4c8b1a,config['secrets'][_0x592d('0x4c')])['then'](function(){return _0x99f95e;});}return _0x99f95e;}})[_0x592d('0x1f')](function(_0x49baa5){if(_0x49baa5){var _0x10d7c9=_0x49baa5[_0x592d('0x49')];if(!fs['existsSync'](_0x10d7c9)){throw new db[(_0x592d('0x4d'))][(_0x592d('0x4e'))](_0x592d('0x4f'));}if(_0x49baa5['filename']){return _0x7bf95d[_0x592d('0x46')](_0x10d7c9,_0x49baa5['filename']+path['extname'](_0x10d7c9),function(){if(_0x57af5b){fs[_0x592d('0x50')](_0x10d7c9);}});}else{return _0x7bf95d[_0x592d('0x46')](_0x10d7c9,function(_0x51e285){if(_0x57af5b){fs[_0x592d('0x50')](_0x10d7c9);}});}}})[_0x592d('0x42')](function(_0x44b816){if(_0x44b816[_0x592d('0x51')]===_0x592d('0x4f')){_0x7bf95d[_0x592d('0x15')](0x194)['send'](_0x592d('0x52'));}else{return handleError(_0x7bf95d,null);}});};exports['downloads']=function(_0x252027,_0x5e292d,_0xb28283){var _0xfbb32e=require('../../components/encryptor');var _0x2bff37=![];var _0x196296={'$and':[db[_0x592d('0x53')][_0x592d('0x34')](db[_0x592d('0x53')]['fn']('MD5',db[_0x592d('0x53')][_0x592d('0x54')](_0x592d('0x48'))),_0x252027[_0x592d('0x2a')][_0x592d('0x55')])]};if(_0x252027[_0x592d('0x2a')][_0x592d('0x27')]&&_0x252027['query']['type']===_0x592d('0x48')){_0x196296[_0x592d('0x56')][_0x592d('0x57')]({'uniqueid':_0x252027[_0x592d('0x40')]['id']});}else{_0x196296['$and'][_0x592d('0x57')]({'id':_0x252027[_0x592d('0x40')]['id']});}return db['VoiceRecording']['find']({'where':_0x196296,'attributes':['id',_0x592d('0x49')],'raw':!![]})[_0x592d('0x1f')](handleEntityNotFound(_0x5e292d,null))[_0x592d('0x1f')](function(_0x15efb1){if(_0x15efb1){var _0x5ad4d5=util[_0x592d('0x29')]('%s.cypher',_0x15efb1[_0x592d('0x49')]);if(fs[_0x592d('0x4a')](_0x5ad4d5)){_0x2bff37=!![];return _0xfbb32e[_0x592d('0x4b')](_0x5ad4d5,_0x15efb1[_0x592d('0x49')],config[_0x592d('0x58')][_0x592d('0x4c')])[_0x592d('0x1f')](function(){return _0x15efb1;});}return _0x15efb1;}})[_0x592d('0x1f')](function(_0x513f34){if(_0x513f34){if(!fs[_0x592d('0x4a')](_0x513f34[_0x592d('0x49')])){throw new db[(_0x592d('0x4d'))][(_0x592d('0x4e'))](_0x592d('0x4f'));}if(_0x513f34['filename']){return _0x5e292d['download'](_0x513f34[_0x592d('0x49')],_0x513f34['filename']+path[_0x592d('0x59')](_0x513f34[_0x592d('0x49')]),function(){if(_0x2bff37){fs[_0x592d('0x50')](_0x513f34[_0x592d('0x49')]);}});}else{return _0x5e292d['download'](_0x513f34[_0x592d('0x49')],function(_0xc7ba81){if(_0x2bff37){fs['unlink'](_0x513f34[_0x592d('0x49')]);}});}}})[_0x592d('0x42')](handleError(_0x5e292d,null));};exports[_0x592d('0x5a')]=function(_0x57e984,_0x3eaca7){return db[_0x592d('0x3a')][_0x592d('0x41')]({'where':{'id':_0x57e984[_0x592d('0x40')]['id']}})[_0x592d('0x1f')](function(_0x510dce){if(_[_0x592d('0x5b')](_0x510dce)){throw new ReferenceError(_0x592d('0x5c'));}return _0x510dce;})[_0x592d('0x1f')](function(_0x35494c){var _0x6d0f2c=_0x35494c['value'];logger[_0x592d('0x5d')](_0x592d('0x5e'),_0x6d0f2c);if(!_[_0x592d('0x5b')](_0x35494c[_0x592d('0x49')])&&fs[_0x592d('0x4a')](_0x6d0f2c)){logger[_0x592d('0x5d')](_0x592d('0x5f')+_0x6d0f2c+_0x592d('0x60'));fs['unlinkSync'](_0x6d0f2c);}_0x6d0f2c=_0x6d0f2c+_0x592d('0x61');if(!_[_0x592d('0x5b')](_0x35494c[_0x592d('0x49')])&&fs[_0x592d('0x4a')](_0x6d0f2c)){logger[_0x592d('0x5d')]('File:\x20\x22'+_0x6d0f2c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x592d('0x62')](_0x6d0f2c);}return _0x35494c;})['then'](function(_0x5529f0){if(!_0x5529f0)throw new InternalError();return _0x5529f0[_0x592d('0x5a')]();})[_0x592d('0x1f')](function(){_0x3eaca7['status'](0xcc)['end']();})[_0x592d('0x42')](handleError(_0x3eaca7,null));};function getBucketslist(_0xfb0135,_0x20f38,_0x2d5e19){return new Promise(function(_0x8035e2,_0x145bd1){var _0x751d5d=new AWS['S3']({'accessKeyId':_0x20f38,'secretAccessKey':_0xfb0135,'region':_0x2d5e19});_0x751d5d['listBuckets']({},function(_0x432152,_0x3f2b89){if(_0x432152){return _0x145bd1(_0x432152);}else{return _0x8035e2(_0x3f2b89);}});});}function createBucket(_0x5cecef,_0x21a6d3,_0x178a45,_0x416036){return new Promise(function(_0x13b75c,_0x5cd650){var _0x3734ba=new AWS['S3']({'accessKeyId':_0x21a6d3,'secretAccessKey':_0x5cecef,'region':_0x178a45});_0x3734ba[_0x592d('0x63')]({'Bucket':_0x416036},function(_0x4dc86c,_0x19c6b4){if(_0x4dc86c){return _0x5cd650(_0x4dc86c);}else{return _0x13b75c(_0x19c6b4);}});});}function uploadFile(_0x2746dd,_0x1c0bc0,_0x18070f,_0x344377,_0x14aa0c,_0x13ca89){return new Promise(function(_0x4ebe05,_0x447d73){var _0xdeee48=new AWS['S3']({'accessKeyId':_0x1c0bc0,'secretAccessKey':_0x2746dd,'region':_0x18070f});_0xdeee48[_0x592d('0x64')]({'Bucket':_0x344377,'Key':_0x14aa0c,'Body':_0x13ca89},function(_0x8600b8,_0x295dde){if(_0x8600b8){return _0x447d73(_0x8600b8);}else{return _0x4ebe05(_0x295dde);}});});}function startTranscribe(_0x5c91a4,_0x17c27c,_0xd181de,_0x37dc51,_0x14e865,_0x3c24e4){return new Promise(function(_0xcbf5e3,_0x20e9d4){var _0xee12e4=new AWS['TranscribeService']({'accessKeyId':_0x17c27c,'secretAccessKey':_0x5c91a4,'region':_0xd181de});_0xee12e4[_0x592d('0x65')]({'TranscriptionJobName':_0x37dc51,'LanguageCode':_0x14e865,'Media':{'MediaFileUri':_0x3c24e4}},function(_0x4ca714,_0x3b7847){if(_0x4ca714){return _0x20e9d4(_0x4ca714);}else{return _0xcbf5e3(_0x3b7847);}});});}function transcribe(_0xfe1aba,_0x3bc0fa,_0xddb4be,_0x3885a3,_0x2328ad,_0x1344cd,_0x52f769){return new Promise(function(_0x3c4e8d,_0x42e065){var _0x2b58b4={};logger[_0x592d('0x5d')](util[_0x592d('0x29')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xfe1aba,_0x2328ad));return uploadFile(_0x3bc0fa,_0xddb4be,_0x3885a3,_0x2328ad,path[_0x592d('0x66')](_0x1344cd),fs[_0x592d('0x67')](_0x1344cd))['then'](function(_0x35c3fe){logger[_0x592d('0x5d')](util[_0x592d('0x29')](_0x592d('0x68'),_0xfe1aba,_0x2328ad,_0x35c3fe[_0x592d('0x69')]));_0x2b58b4[_0x592d('0x6a')]=_0x35c3fe['Bucket'];_0x2b58b4[_0x592d('0x6b')]=_0x35c3fe['Location'];logger[_0x592d('0x5d')](util[_0x592d('0x29')](_0x592d('0x6c'),_0xfe1aba));return startTranscribe(_0x3bc0fa,_0xddb4be,_0x3885a3,uuidv4(),_0x52f769,_0x35c3fe[_0x592d('0x69')]);})[_0x592d('0x1f')](function(_0x3d0ad1){logger[_0x592d('0x5d')](util[_0x592d('0x29')](_0x592d('0x6d'),_0xfe1aba,_0x3d0ad1[_0x592d('0x6e')]['TranscriptionJobName']));_0x2b58b4[_0x592d('0x6f')]=_0x3d0ad1[_0x592d('0x6e')]['TranscriptionJobName'];_0x2b58b4[_0x592d('0x70')]=_0x3d0ad1[_0x592d('0x6e')][_0x592d('0x71')];return _0x3c4e8d(_0x2b58b4);})['catch'](function(_0x359a03){return _0x42e065(_0x359a03);});});}exports['runTranscribe']=function(_0x12e244,_0x12aa1c,_0x277ecc){var _0x1a50f8;var _0x4ec3bc;var _0x55e20c;var _0x3b1ba0=require(_0x592d('0x47'));return db[_0x592d('0x3a')][_0x592d('0x72')]({'where':{'id':_0x12e244[_0x592d('0x40')]['id']}})[_0x592d('0x1f')](function(_0x10b0f6){if(_0x10b0f6){var _0x5bc00c=util['format'](_0x592d('0x73'),_0x10b0f6['value']);if(fs[_0x592d('0x4a')](_0x5bc00c)){cypher=!![];return _0x3b1ba0['decryptFile'](_0x5bc00c,_0x10b0f6['value'],config[_0x592d('0x58')][_0x592d('0x4c')])[_0x592d('0x1f')](function(){return _0x10b0f6;});}return _0x10b0f6;}})[_0x592d('0x1f')](function(_0x1d8fe6){if(!_0x1d8fe6){throw new db[(_0x592d('0x4d'))]['ValidationError'](_0x592d('0x74'));}_0x4ec3bc=_0x1d8fe6;return db['Setting'][_0x592d('0x72')]({'where':{'id':0x1}});})[_0x592d('0x1f')](handleEntityNotFound(_0x12aa1c,null))[_0x592d('0x1f')](function(_0x4101fa){if(_0x4101fa){_0x1a50f8=_0x4101fa;if(!_0x1a50f8['transcribe']||!_0x1a50f8[_0x592d('0x75')]||!_0x1a50f8['transcribeRegion']||!_0x1a50f8['language']||!_0x1a50f8[_0x592d('0x6a')]){throw new db['Sequelize'][(_0x592d('0x4e'))](_0x592d('0x76'));}if(_0x12e244[_0x592d('0x44')]['runSentiment']&&(!_0x1a50f8['sentiment']||!_0x1a50f8[_0x592d('0x77')]||!_0x1a50f8[_0x592d('0x78')]||!_0x1a50f8[_0x592d('0x79')]||!_0x1a50f8['bucket'])){throw new db['Sequelize']['ValidationError'](_0x592d('0x7a'));}return db[_0x592d('0x7b')]['findOne']({'where':{'id':_0x1a50f8[_0x592d('0x75')]}});}})[_0x592d('0x1f')](function(_0x198648){if(!_0x198648){throw new db[(_0x592d('0x4d'))]['ValidationError'](_0x592d('0x7c'));}if(!_0x198648[_0x592d('0x7d')]||!_0x198648['data2']){throw new db[(_0x592d('0x4d'))][(_0x592d('0x4e'))](_0x592d('0x7e'));}_0x55e20c=_0x198648;return getBucketslist(_0x55e20c[_0x592d('0x7d')],_0x55e20c[_0x592d('0x7f')],_0x1a50f8[_0x592d('0x80')]);})[_0x592d('0x1f')](function(_0xcce7d){if(_0xcce7d&&_0xcce7d['Buckets']){var _0x1de3c7=_[_0x592d('0x41')](_0xcce7d[_0x592d('0x81')],function(_0x99092b){return _0x99092b['Name']===_0x1a50f8[_0x592d('0x6a')];});if(!_0x1de3c7){logger[_0x592d('0x5d')](util[_0x592d('0x29')](_0x592d('0x82'),_0x12e244[_0x592d('0x40')]['id'],_0x1a50f8[_0x592d('0x6a')]));return createBucket(_0x55e20c[_0x592d('0x7d')],_0x55e20c[_0x592d('0x7f')],_0x1a50f8[_0x592d('0x80')],_0x1a50f8['bucket']);}logger[_0x592d('0x5d')](util[_0x592d('0x29')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x12e244[_0x592d('0x40')]['id'],_0x1a50f8[_0x592d('0x6a')]));return;}})[_0x592d('0x1f')](function(_0x5bf410){if(_0x4ec3bc[_0x592d('0x70')]==='NEW'){return transcribe(_0x12e244[_0x592d('0x40')]['id'],_0x55e20c[_0x592d('0x7d')],_0x55e20c[_0x592d('0x7f')],_0x1a50f8[_0x592d('0x80')],_0x1a50f8[_0x592d('0x6a')],_0x4ec3bc[_0x592d('0x49')],_0x1a50f8[_0x592d('0x79')]);}else{logger[_0x592d('0x5d')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x12e244['params']['id']));return{'transcribeStatus':_0x592d('0x83')};}})['then'](function(_0x4a3bda){if(_0x4a3bda){_0x4a3bda[_0x592d('0x84')]=_0x12e244['body'][_0x592d('0x85')];return _0x4ec3bc[_0x592d('0x86')](_0x4a3bda);}})[_0x592d('0x1f')](respondWithResult(_0x12aa1c,null))[_0x592d('0x42')](handleError(_0x12aa1c,null));};function writeFile(_0x4b5b75,_0x48570a){return new Promise(function(_0x3dfe4b,_0x2487a5){fs[_0x592d('0x87')](_0x48570a,_0x4b5b75,function(_0x245729,_0x127c3e){if(_0x245729){return _0x2487a5(_0x245729);}else{return _0x3dfe4b(_0x127c3e);}});});}exports[_0x592d('0x88')]=function(_0x1cceaf,_0x289c36,_0x463b3c){return db[_0x592d('0x3a')]['findOne']({'where':{'id':_0x1cceaf[_0x592d('0x40')]['id']}})['then'](handleEntityNotFound(_0x289c36))[_0x592d('0x1f')](function(_0x393ccd){if(_0x393ccd&&_0x393ccd[_0x592d('0x89')]){var _0x5f544d=_0x393ccd[_0x592d('0x89')];var _0x26cf05=config['root']+_0x592d('0x8a')+_0x393ccd['id']+'.txt';if(fs[_0x592d('0x4a')](_0x26cf05)){return _0x26cf05;}return writeFile(_0x5f544d,_0x26cf05)['then'](function(){return _0x26cf05;});}else{throw new db[(_0x592d('0x4d'))]['ValidationError'](_0x592d('0x8b'));}})[_0x592d('0x1f')](function(_0x296df7){return _0x289c36[_0x592d('0x46')](_0x296df7);})[_0x592d('0x42')](handleError(_0x289c36));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 73f1ee5..28f7d33 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 _0x1d25=['./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','transcribeStatus'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1d25,0xba));var _0x51d2=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0x1d25[_0x5d8631];return _0x34c15e;};'use strict';var attributes=require(_0x51d2('0x0'));module[_0x51d2('0x1')]=function(_0x153698,_0x3f269b){return _0x153698[_0x51d2('0x2')]('VoiceRecording',attributes,{'tableName':_0x51d2('0x3'),'paranoid':![],'indexes':[{'name':_0x51d2('0x4'),'fields':['uniqueid']},{'name':_0x51d2('0x5'),'fields':[_0x51d2('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc7e9=['./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid'];(function(_0x195a16,_0x1dcc99){var _0x4a5272=function(_0x3280b9){while(--_0x3280b9){_0x195a16['push'](_0x195a16['shift']());}};_0x4a5272(++_0x1dcc99);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xc7e9[_0x47fd36];return _0x21a0fc;};'use strict';var attributes=require(_0x9c7e('0x0'));module[_0x9c7e('0x1')]=function(_0x581e2d,_0x335e22){return _0x581e2d[_0x9c7e('0x2')](_0x9c7e('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x9c7e('0x4'),'fields':[_0x9c7e('0x4')]},{'name':'transcribeStatus','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 5e10ae1..c2ca529 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 _0x8952=['message','result','catch','UpdateVoiceRecording','VoiceRecording','update','raw','options','attributes','debug','../../components/encryptor','Setting','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','VoiceRecording,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8952,0x17e));var _0x2895=function(_0x1e2303,_0x1a15ab){_0x1e2303=_0x1e2303-0x0;var _0x511c63=_0x8952[_0x1e2303];return _0x511c63;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});}exports[_0x2895('0x15')]=function(_0xbf8b63){var _0x2cb505=this;return new Promise(function(_0x155124,_0x184d11){return db[_0x2895('0x16')][_0x2895('0x17')](_0xbf8b63['body'],{'raw':_0xbf8b63['options']?_0xbf8b63['options'][_0x2895('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbf8b63[_0x2895('0x19')]?_0xbf8b63[_0x2895('0x19')]['where']||null:null,'attributes':_0xbf8b63[_0x2895('0x19')]?_0xbf8b63[_0x2895('0x19')][_0x2895('0x1a')]||null:null,'limit':_0xbf8b63[_0x2895('0x19')]?_0xbf8b63[_0x2895('0x19')]['limit']||null:null})[_0x2895('0xc')](function(_0x5e93a4){logger['info'](_0x2895('0x15'),_0xbf8b63);logger[_0x2895('0x1b')](_0x2895('0x15'),_0xbf8b63,JSON['stringify'](_0x5e93a4));_0x155124(_0x5e93a4);})['catch'](function(_0x3a72fa){logger[_0x2895('0x10')](_0x2895('0x15'),_0x3a72fa['message'],_0xbf8b63);_0x184d11(_0x2cb505[_0x2895('0x10')](0x1f4,_0x3a72fa[_0x2895('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x293ad3){var _0x127540=this;return new Promise(function(_0x2cd4df,_0x5c6c21){var _0x320661=require(_0x2895('0x1c'));var _0x5eedfc;return db[_0x2895('0x1d')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x2895('0xc')](function(_0x4ee2cc){_0x5eedfc=_0x4ee2cc;return db[_0x2895('0x16')][_0x2895('0x1e')](_0x293ad3['body']);})['then'](function(_0x32db49){if(_0x5eedfc[_0x2895('0x1f')]&&fs[_0x2895('0x20')](_0x32db49[_0x2895('0x21')])){var _0x14d150=util[_0x2895('0x22')](_0x2895('0x23'),_0x32db49['value']);return _0x320661[_0x2895('0x24')](_0x32db49[_0x2895('0x21')],_0x14d150,config[_0x2895('0x25')]['recording'])[_0x2895('0xc')](function(){fs[_0x2895('0x26')](_0x32db49[_0x2895('0x21')]);logger[_0x2895('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x32db49;});}return _0x32db49;})[_0x2895('0xc')](function(_0xe594ff){logger[_0x2895('0xd')](_0x2895('0x27'),_0x293ad3);logger[_0x2895('0x1b')]('CreateVoiceRecording',_0x293ad3,JSON['stringify'](_0xe594ff));_0x2cd4df(_0xe594ff);})[_0x2895('0x14')](function(_0xf3c8f7){logger['error'](_0x2895('0x27'),_0xf3c8f7['message'],_0x293ad3);_0x5c6c21(_0x127540[_0x2895('0x10')](0x1f4,_0xf3c8f7[_0x2895('0x12')]));});});}; \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where','limit','UpdateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x47655f,_0x5ee158){var _0x19719c=function(_0xbdb81a){while(--_0xbdb81a){_0x47655f['push'](_0x47655f['shift']());}};_0x19719c(++_0x5ee158);}(_0x0295,0x1f0));var _0x5029=function(_0x3073c5,_0x426ccc){_0x3073c5=_0x3073c5-0x0;var _0x35f385=_0x0295[_0x3073c5];return _0x35f385;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['UpdateVoiceRecording']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')](_0x1ed567[_0x5029('0x17')],{'raw':_0x1ed567['options']?_0x1ed567[_0x5029('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed567[_0x5029('0x18')]?_0x1ed567[_0x5029('0x18')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options']['attributes']||null:null,'limit':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options'][_0x5029('0x1a')]||null:null})[_0x5029('0xa')](function(_0x1eb228){logger[_0x5029('0xb')](_0x5029('0x1b'),_0x1ed567);logger[_0x5029('0xd')](_0x5029('0x1b'),_0x1ed567,JSON[_0x5029('0xf')](_0x1eb228));_0x35de81(_0x1eb228);})[_0x5029('0x14')](function(_0x4ceaae){logger['error']('UpdateVoiceRecording',_0x4ceaae[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155[_0x5029('0x10')](0x1f4,_0x4ceaae['message']));});});};exports['CreateVoiceRecording']=function(_0x181da0){var _0x1e7e61=this;return new Promise(function(_0x36d810,_0x5527fc){var _0x2c501f=require(_0x5029('0x1c'));var _0x5e45c4;return db[_0x5029('0x1d')][_0x5029('0x1e')]({'attributes':['id',_0x5029('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32da06){_0x5e45c4=_0x32da06;return db[_0x5029('0x15')][_0x5029('0x20')](_0x181da0['body']);})[_0x5029('0xa')](function(_0x2bb398){if(_0x5e45c4['callRecordingEncryption']&&fs[_0x5029('0x21')](_0x2bb398[_0x5029('0x22')])){var _0x4434ff=util[_0x5029('0x23')](_0x5029('0x24'),_0x2bb398[_0x5029('0x22')]);return _0x2c501f[_0x5029('0x25')](_0x2bb398[_0x5029('0x22')],_0x4434ff,config[_0x5029('0x26')][_0x5029('0x27')])[_0x5029('0xa')](function(){fs[_0x5029('0x28')](_0x2bb398['value']);logger[_0x5029('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2bb398;});}return _0x2bb398;})[_0x5029('0xa')](function(_0x4f672e){logger['info'](_0x5029('0x29'),_0x181da0);logger[_0x5029('0xd')](_0x5029('0x29'),_0x181da0,JSON['stringify'](_0x4f672e));_0x36d810(_0x4f672e);})[_0x5029('0x14')](function(_0x15d882){logger[_0x5029('0x10')](_0x5029('0x29'),_0x15d882[_0x5029('0x12')],_0x181da0);_0x5527fc(_0x1e7e61[_0x5029('0x10')](0x1f4,_0x15d882[_0x5029('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index fcd91f9..d42baec 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 _0x57b0=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x33d99f,_0x354620){var _0x56ada3=function(_0x5b6720){while(--_0x5b6720){_0x33d99f['push'](_0x33d99f['shift']());}};_0x56ada3(++_0x354620);}(_0x57b0,0x1a3));var _0x057b=function(_0x260f1e,_0x3d7bca){_0x260f1e=_0x260f1e-0x0;var _0x40a50f=_0x57b0[_0x260f1e];return _0x40a50f;};'use strict';var multer=require(_0x057b('0x0'));var util=require(_0x057b('0x1'));var path=require(_0x057b('0x2'));var timeout=require(_0x057b('0x3'));var express=require(_0x057b('0x4'));var router=express[_0x057b('0x5')]();var fs_extra=require(_0x057b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x057b('0x7'));var config=require(_0x057b('0x8'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x057b('0x9')](),controller[_0x057b('0xa')]);router[_0x057b('0xb')](_0x057b('0xc'),auth[_0x057b('0x9')](),controller[_0x057b('0xd')]);router[_0x057b('0xb')](_0x057b('0xe'),auth[_0x057b('0x9')](),controller[_0x057b('0xf')]);router[_0x057b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x057b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x057b('0x12')]);router[_0x057b('0x13')](_0x057b('0xe'),auth[_0x057b('0x9')](),controller[_0x057b('0x14')]);module[_0x057b('0x15')]=router; \ No newline at end of file +var _0x7ff3=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller'];(function(_0xe3579d,_0x498caa){var _0xbf766e=function(_0x282010){while(--_0x282010){_0xe3579d['push'](_0xe3579d['shift']());}};_0xbf766e(++_0x498caa);}(_0x7ff3,0x16c));var _0x37ff=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x7ff3[_0x4d2993];return _0x427374;};'use strict';var multer=require(_0x37ff('0x0'));var util=require(_0x37ff('0x1'));var path=require(_0x37ff('0x2'));var timeout=require(_0x37ff('0x3'));var express=require(_0x37ff('0x4'));var router=express[_0x37ff('0x5')]();var fs_extra=require(_0x37ff('0x6'));var auth=require(_0x37ff('0x7'));var interaction=require(_0x37ff('0x8'));var config=require('../../config/environment');var controller=require(_0x37ff('0x9'));router[_0x37ff('0xa')]('/',auth[_0x37ff('0xb')](),controller[_0x37ff('0xc')]);router['get'](_0x37ff('0xd'),auth[_0x37ff('0xb')](),controller[_0x37ff('0xe')]);router['get'](_0x37ff('0xf'),auth[_0x37ff('0xb')](),controller['show']);router[_0x37ff('0x10')]('/',auth[_0x37ff('0xb')](),controller[_0x37ff('0x11')]);router[_0x37ff('0x12')](_0x37ff('0xf'),auth['isAuthenticated'](),controller[_0x37ff('0x13')]);router[_0x37ff('0x14')]('/:id',auth[_0x37ff('0xb')](),controller['destroy']);module[_0x37ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index a889813..f3fe7fd 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 _0x3767=['sequelize','moment','exports','blind','attended','STRING','Yes'];(function(_0x2804d7,_0x2d8d6c){var _0x4a84e7=function(_0x3a03e9){while(--_0x3a03e9){_0x2804d7['push'](_0x2804d7['shift']());}};_0x4a84e7(++_0x2d8d6c);}(_0x3767,0x9a));var _0x7376=function(_0x5a6389,_0x3a3f3f){_0x5a6389=_0x5a6389-0x0;var _0x1773ba=_0x3767[_0x5a6389];return _0x1773ba;};'use strict';var Sequelize=require(_0x7376('0x0'));var moment=require(_0x7376('0x1'));module[_0x7376('0x2')]={'type':{'type':Sequelize['ENUM'](_0x7376('0x3'),_0x7376('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x7376('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x7376('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7376('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x7376('0x5')]},'transferercontext':{'type':Sequelize[_0x7376('0x5')]},'transfererexten':{'type':Sequelize[_0x7376('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x7376('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x7376('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x7376('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x7376('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7376('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x7376('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x7376('0x6'),'No')},'context':{'type':Sequelize[_0x7376('0x5')]},'extension':{'type':Sequelize[_0x7376('0x5')]}}; \ No newline at end of file +var _0x5eba=['attended','STRING','Yes','sequelize','exports','ENUM'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x5eba,0x159));var _0xa5eb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5eba[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xa5eb('0x0'));var moment=require('moment');module[_0xa5eb('0x1')]={'type':{'type':Sequelize[_0xa5eb('0x2')]('blind',_0xa5eb('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xa5eb('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xa5eb('0x4')]},'transferercalleridname':{'type':Sequelize[_0xa5eb('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xa5eb('0x4')]},'transfererexten':{'type':Sequelize[_0xa5eb('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xa5eb('0x4')]},'transfereechannel':{'type':Sequelize[_0xa5eb('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xa5eb('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa5eb('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xa5eb('0x4')]},'transfereecontext':{'type':Sequelize[_0xa5eb('0x4')]},'transfereeexten':{'type':Sequelize[_0xa5eb('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xa5eb('0x4')]},'isexternal':{'type':Sequelize[_0xa5eb('0x2')](_0xa5eb('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa5eb('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a44f048..dd4fa97 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 _0xded2=['VIRTUAL','merge','options','where','VoiceTransferReport','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','type'];(function(_0x13fe35,_0x537cee){var _0x4875a8=function(_0x3fb855){while(--_0x3fb855){_0x13fe35['push'](_0x13fe35['shift']());}};_0x4875a8(++_0x537cee);}(_0xded2,0xeb));var _0x2ded=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xded2[_0x3acee8];return _0x5046cc;};'use strict';var emlformat=require(_0x2ded('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ded('0x1'));var rp=require(_0x2ded('0x2'));var moment=require('moment');var BPromise=require(_0x2ded('0x3'));var Mustache=require(_0x2ded('0x4'));var util=require('util');var path=require(_0x2ded('0x5'));var sox=require(_0x2ded('0x6'));var csv=require(_0x2ded('0x7'));var ejs=require(_0x2ded('0x8'));var fs=require('fs');var fs_extra=require(_0x2ded('0x9'));var _=require('lodash');var squel=require(_0x2ded('0xa'));var crypto=require(_0x2ded('0xb'));var jsforce=require(_0x2ded('0xc'));var deskjs=require(_0x2ded('0xd'));var toCsv=require(_0x2ded('0x7'));var querystring=require(_0x2ded('0xe'));var Papa=require('papaparse');var Redis=require(_0x2ded('0xf'));var authService=require(_0x2ded('0x10'));var qs=require(_0x2ded('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ded('0x12'));var logger=require('../../config/logger')(_0x2ded('0x13'));var utils=require('../../config/utils');var config=require(_0x2ded('0x14'));var licenseUtil=require(_0x2ded('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x351c24,_0x57004a){_0x57004a=_0x57004a||0xcc;return function(_0x454ff5){if(_0x454ff5){return _0x351c24[_0x2ded('0x16')](_0x57004a);}return _0x351c24[_0x2ded('0x17')](_0x57004a)['end']();};}function respondWithResult(_0x1f5365,_0x45c3df){_0x45c3df=_0x45c3df||0xc8;return function(_0x31c9dc){if(_0x31c9dc){return _0x1f5365[_0x2ded('0x17')](_0x45c3df)[_0x2ded('0x18')](_0x31c9dc);}};}function respondWithFilteredResult(_0x3e0b7c,_0x259941){return function(_0x36e1ac){if(_0x36e1ac){var _0x445426=typeof _0x259941[_0x2ded('0x19')]===_0x2ded('0x1a')&&typeof _0x259941[_0x2ded('0x1b')]===_0x2ded('0x1a');var _0x5d6428=_0x36e1ac[_0x2ded('0x1c')];var _0x54f66c=_0x445426?0x0:_0x259941[_0x2ded('0x19')];var _0x11c0c6=_0x445426?_0x36e1ac['count']:_0x259941[_0x2ded('0x19')]+_0x259941[_0x2ded('0x1b')];var _0x2c345d;if(_0x11c0c6>=_0x5d6428){_0x11c0c6=_0x5d6428;_0x2c345d=0xc8;}else{_0x2c345d=0xce;}_0x3e0b7c[_0x2ded('0x17')](_0x2c345d);return _0x3e0b7c[_0x2ded('0x1d')](_0x2ded('0x1e'),_0x54f66c+'-'+_0x11c0c6+'/'+_0x5d6428)[_0x2ded('0x18')](_0x36e1ac);}return null;};}function patchUpdates(_0x2954de){return function(_0x19202e){try{jsonpatch[_0x2ded('0x1f')](_0x19202e,_0x2954de,!![]);}catch(_0x163565){return BPromise[_0x2ded('0x20')](_0x163565);}return _0x19202e['save']();};}function saveUpdates(_0x5986f8,_0x7dc721){return function(_0xd7bb18){if(_0xd7bb18){return _0xd7bb18[_0x2ded('0x21')](_0x5986f8)['then'](function(_0x42e3e7){return _0x42e3e7;});}return null;};}function removeEntity(_0x41ea04,_0x26c128){return function(_0x1b2402){if(_0x1b2402){return _0x1b2402[_0x2ded('0x22')]()[_0x2ded('0x23')](function(){_0x41ea04[_0x2ded('0x17')](0xcc)[_0x2ded('0x24')]();});}};}function handleEntityNotFound(_0x118e5a,_0x54d286){return function(_0x1ac370){if(!_0x1ac370){_0x118e5a[_0x2ded('0x16')](0x194);}return _0x1ac370;};}function handleError(_0x497589,_0x46cc25){_0x46cc25=_0x46cc25||0x1f4;return function(_0x425cfb){logger['error'](_0x425cfb[_0x2ded('0x25')]);if(_0x425cfb['name']){delete _0x425cfb[_0x2ded('0x26')];}_0x497589['status'](_0x46cc25)[_0x2ded('0x27')](_0x425cfb);};}exports[_0x2ded('0x28')]=function(_0x1d5256,_0x1cf7db){var _0x43998b={},_0x2d9e3a={},_0x30e593={'count':0x0,'rows':[]};var _0x2ddf3f=_[_0x2ded('0x29')](db['VoiceTransferReport']['rawAttributes'],function(_0x59de93){return{'name':_0x59de93[_0x2ded('0x2a')],'type':_0x59de93['type'][_0x2ded('0x2b')]};});_0x2d9e3a[_0x2ded('0x2c')]=_['map'](_0x2ddf3f,_0x2ded('0x26'));_0x2d9e3a['query']=_[_0x2ded('0x2d')](_0x1d5256[_0x2ded('0x2e')]);_0x2d9e3a[_0x2ded('0x2f')]=_[_0x2ded('0x30')](_0x2d9e3a['model'],_0x2d9e3a['query']);_0x43998b[_0x2ded('0x31')]=_[_0x2ded('0x30')](_0x2d9e3a[_0x2ded('0x2c')],qs[_0x2ded('0x32')](_0x1d5256[_0x2ded('0x2e')]['fields']));_0x43998b[_0x2ded('0x31')]=_0x43998b[_0x2ded('0x31')][_0x2ded('0x33')]?_0x43998b[_0x2ded('0x31')]:_0x2d9e3a[_0x2ded('0x2c')];if(!_0x1d5256['query'][_0x2ded('0x34')]('nolimit')){_0x43998b['limit']=qs['limit'](_0x1d5256[_0x2ded('0x2e')][_0x2ded('0x1b')]);_0x43998b['offset']=qs['offset'](_0x1d5256[_0x2ded('0x2e')][_0x2ded('0x19')]);}_0x43998b[_0x2ded('0x35')]=qs[_0x2ded('0x36')](_0x1d5256['query']['sort']);_0x43998b['where']=qs[_0x2ded('0x2f')](_['pick'](_0x1d5256[_0x2ded('0x2e')],_0x2d9e3a[_0x2ded('0x2f')]),_0x2ddf3f);if(_0x1d5256[_0x2ded('0x2e')][_0x2ded('0x37')]){_0x43998b['where']=_['merge'](_0x43998b['where'],{'$or':_[_0x2ded('0x29')](_0x2ddf3f,function(_0x2a7df9){if(_0x2a7df9[_0x2ded('0x38')]!==_0x2ded('0x39')){var _0x4b9a90={};_0x4b9a90[_0x2a7df9[_0x2ded('0x26')]]={'$like':'%'+_0x1d5256[_0x2ded('0x2e')][_0x2ded('0x37')]+'%'};return _0x4b9a90;}})});}_0x43998b=_[_0x2ded('0x3a')]({},_0x43998b,_0x1d5256[_0x2ded('0x3b')]);var _0x321592={'where':_0x43998b[_0x2ded('0x3c')]};return db[_0x2ded('0x3d')][_0x2ded('0x1c')](_0x321592)['then'](function(_0x226f9d){_0x30e593[_0x2ded('0x1c')]=_0x226f9d;if(_0x1d5256['query'][_0x2ded('0x3e')]){_0x43998b[_0x2ded('0x3f')]=[{'all':!![]}];}return db[_0x2ded('0x3d')][_0x2ded('0x40')](_0x43998b);})[_0x2ded('0x23')](function(_0x5df5ea){_0x30e593['rows']=_0x5df5ea;return _0x30e593;})[_0x2ded('0x23')](respondWithFilteredResult(_0x1cf7db,_0x43998b))[_0x2ded('0x41')](handleError(_0x1cf7db,null));};exports[_0x2ded('0x42')]=function(_0x11ff5c,_0x1d5dd1){var _0x428a4d={'raw':!![],'where':{'id':_0x11ff5c[_0x2ded('0x43')]['id']}},_0x52e7ba={};_0x52e7ba['model']=_['keys'](db[_0x2ded('0x3d')][_0x2ded('0x44')]);_0x52e7ba[_0x2ded('0x2e')]=_[_0x2ded('0x2d')](_0x11ff5c[_0x2ded('0x2e')]);_0x52e7ba[_0x2ded('0x2f')]=_['intersection'](_0x52e7ba['model'],_0x52e7ba['query']);_0x428a4d['attributes']=_['intersection'](_0x52e7ba[_0x2ded('0x2c')],qs[_0x2ded('0x32')](_0x11ff5c['query'][_0x2ded('0x32')]));_0x428a4d[_0x2ded('0x31')]=_0x428a4d[_0x2ded('0x31')][_0x2ded('0x33')]?_0x428a4d['attributes']:_0x52e7ba[_0x2ded('0x2c')];if(_0x11ff5c[_0x2ded('0x2e')][_0x2ded('0x3e')]){_0x428a4d[_0x2ded('0x3f')]=[{'all':!![]}];}_0x428a4d=_[_0x2ded('0x3a')]({},_0x428a4d,_0x11ff5c[_0x2ded('0x3b')]);return db[_0x2ded('0x3d')]['find'](_0x428a4d)[_0x2ded('0x23')](handleEntityNotFound(_0x1d5dd1,null))[_0x2ded('0x23')](respondWithResult(_0x1d5dd1,null))['catch'](handleError(_0x1d5dd1,null));};exports['create']=function(_0x31e4b6,_0x509b62){return db[_0x2ded('0x3d')][_0x2ded('0x45')](_0x31e4b6['body'],{})[_0x2ded('0x23')](respondWithResult(_0x509b62,0xc9))[_0x2ded('0x41')](handleError(_0x509b62,null));};exports['update']=function(_0x3f3f9c,_0x23dfc6){if(_0x3f3f9c[_0x2ded('0x46')]['id']){delete _0x3f3f9c[_0x2ded('0x46')]['id'];}return db[_0x2ded('0x3d')][_0x2ded('0x47')]({'where':{'id':_0x3f3f9c['params']['id']}})[_0x2ded('0x23')](handleEntityNotFound(_0x23dfc6,null))[_0x2ded('0x23')](saveUpdates(_0x3f3f9c['body'],null))[_0x2ded('0x23')](respondWithResult(_0x23dfc6,null))[_0x2ded('0x41')](handleError(_0x23dfc6,null));};exports['destroy']=function(_0x2b1be5,_0x3f931b){return db[_0x2ded('0x3d')]['find']({'where':{'id':_0x2b1be5['params']['id']}})['then'](handleEntityNotFound(_0x3f931b,null))[_0x2ded('0x23')](removeEntity(_0x3f931b,null))[_0x2ded('0x41')](handleError(_0x3f931b,null));};exports['describe']=function(_0x933018,_0x30401b){return db[_0x2ded('0x3d')][_0x2ded('0x48')]()['then'](respondWithResult(_0x30401b,null))[_0x2ded('0x41')](handleError(_0x30401b,null));}; \ No newline at end of file +var _0x7a60=['rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceTransferReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0x7a60,0xe6));var _0x07a6=function(_0x15908e,_0x470fbf){_0x15908e=_0x15908e-0x0;var _0x10bbf1=_0x7a60[_0x15908e];return _0x10bbf1;};'use strict';var emlformat=require(_0x07a6('0x0'));var rimraf=require(_0x07a6('0x1'));var zipdir=require(_0x07a6('0x2'));var jsonpatch=require(_0x07a6('0x3'));var rp=require('request-promise');var moment=require(_0x07a6('0x4'));var BPromise=require(_0x07a6('0x5'));var Mustache=require(_0x07a6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x07a6('0x7'));var csv=require(_0x07a6('0x8'));var ejs=require(_0x07a6('0x9'));var fs=require('fs');var fs_extra=require(_0x07a6('0xa'));var _=require('lodash');var squel=require(_0x07a6('0xb'));var crypto=require(_0x07a6('0xc'));var jsforce=require(_0x07a6('0xd'));var deskjs=require(_0x07a6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x07a6('0xf'));var Papa=require(_0x07a6('0x10'));var Redis=require(_0x07a6('0x11'));var authService=require(_0x07a6('0x12'));var qs=require(_0x07a6('0x13'));var as=require(_0x07a6('0x14'));var hardwareService=require(_0x07a6('0x15'));var logger=require(_0x07a6('0x16'))(_0x07a6('0x17'));var utils=require(_0x07a6('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x07a6('0x19'))['db'];function respondWithStatusCode(_0x929b1f,_0x14507f){_0x14507f=_0x14507f||0xcc;return function(_0x20428b){if(_0x20428b){return _0x929b1f[_0x07a6('0x1a')](_0x14507f);}return _0x929b1f[_0x07a6('0x1b')](_0x14507f)['end']();};}function respondWithResult(_0x2b25a2,_0x572e7b){_0x572e7b=_0x572e7b||0xc8;return function(_0x2bb796){if(_0x2bb796){return _0x2b25a2['status'](_0x572e7b)['json'](_0x2bb796);}};}function respondWithFilteredResult(_0x4bdc8b,_0x2549cb){return function(_0x3a14a7){if(_0x3a14a7){var _0x4b27a2=typeof _0x2549cb[_0x07a6('0x1c')]===_0x07a6('0x1d')&&typeof _0x2549cb['limit']===_0x07a6('0x1d');var _0x232720=_0x3a14a7[_0x07a6('0x1e')];var _0x2e4718=_0x4b27a2?0x0:_0x2549cb[_0x07a6('0x1c')];var _0x2b0bc1=_0x4b27a2?_0x3a14a7[_0x07a6('0x1e')]:_0x2549cb[_0x07a6('0x1c')]+_0x2549cb[_0x07a6('0x1f')];var _0x33a088;if(_0x2b0bc1>=_0x232720){_0x2b0bc1=_0x232720;_0x33a088=0xc8;}else{_0x33a088=0xce;}_0x4bdc8b[_0x07a6('0x1b')](_0x33a088);return _0x4bdc8b[_0x07a6('0x20')](_0x07a6('0x21'),_0x2e4718+'-'+_0x2b0bc1+'/'+_0x232720)['json'](_0x3a14a7);}return null;};}function patchUpdates(_0x17336c){return function(_0x5745a0){try{jsonpatch[_0x07a6('0x22')](_0x5745a0,_0x17336c,!![]);}catch(_0xf9ce55){return BPromise[_0x07a6('0x23')](_0xf9ce55);}return _0x5745a0[_0x07a6('0x24')]();};}function saveUpdates(_0x1f27c4,_0x4bdc67){return function(_0x7a0229){if(_0x7a0229){return _0x7a0229[_0x07a6('0x25')](_0x1f27c4)[_0x07a6('0x26')](function(_0x55c191){return _0x55c191;});}return null;};}function removeEntity(_0x4a3ab7,_0x206f5c){return function(_0x6a1da8){if(_0x6a1da8){return _0x6a1da8[_0x07a6('0x27')]()[_0x07a6('0x26')](function(){_0x4a3ab7[_0x07a6('0x1b')](0xcc)[_0x07a6('0x28')]();});}};}function handleEntityNotFound(_0x339722,_0x40066d){return function(_0x201d58){if(!_0x201d58){_0x339722['sendStatus'](0x194);}return _0x201d58;};}function handleError(_0x3d1942,_0x1e89ee){_0x1e89ee=_0x1e89ee||0x1f4;return function(_0x5511af){logger[_0x07a6('0x29')](_0x5511af['stack']);if(_0x5511af['name']){delete _0x5511af[_0x07a6('0x2a')];}_0x3d1942[_0x07a6('0x1b')](_0x1e89ee)[_0x07a6('0x2b')](_0x5511af);};}exports[_0x07a6('0x2c')]=function(_0x1dee26,_0x1a1a08){var _0x3b9d84={},_0x31a2dc={},_0x4ef665={'count':0x0,'rows':[]};var _0x12c56c=_[_0x07a6('0x2d')](db[_0x07a6('0x2e')]['rawAttributes'],function(_0x653649){return{'name':_0x653649['fieldName'],'type':_0x653649[_0x07a6('0x2f')][_0x07a6('0x30')]};});_0x31a2dc[_0x07a6('0x31')]=_[_0x07a6('0x2d')](_0x12c56c,_0x07a6('0x2a'));_0x31a2dc[_0x07a6('0x32')]=_[_0x07a6('0x33')](_0x1dee26['query']);_0x31a2dc[_0x07a6('0x34')]=_[_0x07a6('0x35')](_0x31a2dc[_0x07a6('0x31')],_0x31a2dc[_0x07a6('0x32')]);_0x3b9d84['attributes']=_[_0x07a6('0x35')](_0x31a2dc[_0x07a6('0x31')],qs[_0x07a6('0x36')](_0x1dee26[_0x07a6('0x32')]['fields']));_0x3b9d84[_0x07a6('0x37')]=_0x3b9d84[_0x07a6('0x37')][_0x07a6('0x38')]?_0x3b9d84[_0x07a6('0x37')]:_0x31a2dc['model'];if(!_0x1dee26[_0x07a6('0x32')][_0x07a6('0x39')](_0x07a6('0x3a'))){_0x3b9d84[_0x07a6('0x1f')]=qs['limit'](_0x1dee26[_0x07a6('0x32')][_0x07a6('0x1f')]);_0x3b9d84['offset']=qs[_0x07a6('0x1c')](_0x1dee26['query'][_0x07a6('0x1c')]);}_0x3b9d84['order']=qs[_0x07a6('0x3b')](_0x1dee26['query']['sort']);_0x3b9d84[_0x07a6('0x3c')]=qs[_0x07a6('0x34')](_['pick'](_0x1dee26['query'],_0x31a2dc[_0x07a6('0x34')]),_0x12c56c);if(_0x1dee26[_0x07a6('0x32')][_0x07a6('0x3d')]){_0x3b9d84[_0x07a6('0x3c')]=_['merge'](_0x3b9d84['where'],{'$or':_[_0x07a6('0x2d')](_0x12c56c,function(_0x19591e){if(_0x19591e[_0x07a6('0x2f')]!==_0x07a6('0x3e')){var _0x37d3f4={};_0x37d3f4[_0x19591e['name']]={'$like':'%'+_0x1dee26[_0x07a6('0x32')][_0x07a6('0x3d')]+'%'};return _0x37d3f4;}})});}_0x3b9d84=_['merge']({},_0x3b9d84,_0x1dee26[_0x07a6('0x3f')]);var _0x2a60f1={'where':_0x3b9d84[_0x07a6('0x3c')]};return db[_0x07a6('0x2e')][_0x07a6('0x1e')](_0x2a60f1)[_0x07a6('0x26')](function(_0x14d4fb){_0x4ef665[_0x07a6('0x1e')]=_0x14d4fb;if(_0x1dee26[_0x07a6('0x32')][_0x07a6('0x40')]){_0x3b9d84[_0x07a6('0x41')]=[{'all':!![]}];}return db[_0x07a6('0x2e')]['findAll'](_0x3b9d84);})[_0x07a6('0x26')](function(_0x4b993e){_0x4ef665[_0x07a6('0x42')]=_0x4b993e;return _0x4ef665;})[_0x07a6('0x26')](respondWithFilteredResult(_0x1a1a08,_0x3b9d84))[_0x07a6('0x43')](handleError(_0x1a1a08,null));};exports[_0x07a6('0x44')]=function(_0x3b3d0b,_0x313cab){var _0x4764e6={'raw':!![],'where':{'id':_0x3b3d0b[_0x07a6('0x45')]['id']}},_0x4a2180={};_0x4a2180[_0x07a6('0x31')]=_['keys'](db[_0x07a6('0x2e')]['rawAttributes']);_0x4a2180[_0x07a6('0x32')]=_['keys'](_0x3b3d0b[_0x07a6('0x32')]);_0x4a2180[_0x07a6('0x34')]=_[_0x07a6('0x35')](_0x4a2180['model'],_0x4a2180['query']);_0x4764e6['attributes']=_[_0x07a6('0x35')](_0x4a2180[_0x07a6('0x31')],qs[_0x07a6('0x36')](_0x3b3d0b[_0x07a6('0x32')][_0x07a6('0x36')]));_0x4764e6[_0x07a6('0x37')]=_0x4764e6['attributes'][_0x07a6('0x38')]?_0x4764e6[_0x07a6('0x37')]:_0x4a2180[_0x07a6('0x31')];if(_0x3b3d0b['query'][_0x07a6('0x40')]){_0x4764e6['include']=[{'all':!![]}];}_0x4764e6=_['merge']({},_0x4764e6,_0x3b3d0b[_0x07a6('0x3f')]);return db[_0x07a6('0x2e')][_0x07a6('0x46')](_0x4764e6)[_0x07a6('0x26')](handleEntityNotFound(_0x313cab,null))[_0x07a6('0x26')](respondWithResult(_0x313cab,null))[_0x07a6('0x43')](handleError(_0x313cab,null));};exports['create']=function(_0x328257,_0x2d5454){return db['VoiceTransferReport'][_0x07a6('0x47')](_0x328257[_0x07a6('0x48')],{})[_0x07a6('0x26')](respondWithResult(_0x2d5454,0xc9))[_0x07a6('0x43')](handleError(_0x2d5454,null));};exports['update']=function(_0x451f3c,_0x287909){if(_0x451f3c[_0x07a6('0x48')]['id']){delete _0x451f3c[_0x07a6('0x48')]['id'];}return db[_0x07a6('0x2e')][_0x07a6('0x46')]({'where':{'id':_0x451f3c['params']['id']}})[_0x07a6('0x26')](handleEntityNotFound(_0x287909,null))[_0x07a6('0x26')](saveUpdates(_0x451f3c[_0x07a6('0x48')],null))['then'](respondWithResult(_0x287909,null))[_0x07a6('0x43')](handleError(_0x287909,null));};exports[_0x07a6('0x27')]=function(_0x3486ff,_0x171b9d){return db['VoiceTransferReport']['find']({'where':{'id':_0x3486ff['params']['id']}})['then'](handleEntityNotFound(_0x171b9d,null))['then'](removeEntity(_0x171b9d,null))[_0x07a6('0x43')](handleError(_0x171b9d,null));};exports[_0x07a6('0x49')]=function(_0x30826b,_0xcc3738){return db[_0x07a6('0x2e')][_0x07a6('0x49')]()[_0x07a6('0x26')](respondWithResult(_0xcc3738,null))[_0x07a6('0x43')](handleError(_0xcc3738,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e7c3a85..3023bdb 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 _0xb079=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer'];(function(_0x206f1d,_0x17223f){var _0x4bcc7c=function(_0x405786){while(--_0x405786){_0x206f1d['push'](_0x206f1d['shift']());}};_0x4bcc7c(++_0x17223f);}(_0xb079,0x1e4));var _0x9b07=function(_0xca2652,_0x1042e3){_0xca2652=_0xca2652-0x0;var _0x4eef3f=_0xb079[_0xca2652];return _0x4eef3f;};'use strict';var _=require('lodash');var util=require(_0x9b07('0x0'));var logger=require(_0x9b07('0x1'))(_0x9b07('0x2'));var moment=require('moment');var BPromise=require(_0x9b07('0x3'));var rp=require(_0x9b07('0x4'));var fs=require('fs');var path=require(_0x9b07('0x5'));var rimraf=require(_0x9b07('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b07('0x7'));module['exports']=function(_0x4520fb,_0x549bb5){return _0x4520fb[_0x9b07('0x8')](_0x9b07('0x9'),attributes,{'tableName':_0x9b07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9955=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x3a0b0d,_0x18e68d){var _0x4f36ef=function(_0x2d10b0){while(--_0x2d10b0){_0x3a0b0d['push'](_0x3a0b0d['shift']());}};_0x4f36ef(++_0x18e68d);}(_0x9955,0xf4));var _0x5995=function(_0x3c7539,_0x468e9b){_0x3c7539=_0x3c7539-0x0;var _0x12cbe5=_0x9955[_0x3c7539];return _0x12cbe5;};'use strict';var _=require(_0x5995('0x0'));var util=require(_0x5995('0x1'));var logger=require(_0x5995('0x2'))(_0x5995('0x3'));var moment=require(_0x5995('0x4'));var BPromise=require(_0x5995('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5995('0x6'));var rimraf=require(_0x5995('0x7'));var config=require(_0x5995('0x8'));var attributes=require(_0x5995('0x9'));module[_0x5995('0xa')]=function(_0x3f1d4a,_0x592998){return _0x3f1d4a['define'](_0x5995('0xb'),attributes,{'tableName':_0x5995('0xc'),'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 42ae69e..081a3e9 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 _0x6d87=['http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','CreateVoiceTransferReport','VoiceTransferReport','create','options','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b2c1c,_0x45eb02){var _0x2a2543=function(_0x366875){while(--_0x366875){_0x4b2c1c['push'](_0x4b2c1c['shift']());}};_0x2a2543(++_0x45eb02);}(_0x6d87,0x1eb));var _0x76d8=function(_0x139916,_0x354200){_0x139916=_0x139916-0x0;var _0x62ad5=_0x6d87[_0x139916];return _0x62ad5;};'use strict';var _=require(_0x76d8('0x0'));var util=require('util');var moment=require(_0x76d8('0x1'));var BPromise=require('bluebird');var rs=require(_0x76d8('0x2'));var fs=require('fs');var Redis=require(_0x76d8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x76d8('0x4'));var logger=require(_0x76d8('0x5'))(_0x76d8('0x6'));var config=require(_0x76d8('0x7'));var jayson=require(_0x76d8('0x8'));var client=jayson['client'][_0x76d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x464178,_0x4d24cb,_0x432918){return new BPromise(function(_0x38c0fa,_0x1ddd4a){return client[_0x76d8('0xa')](_0x464178,_0x432918)[_0x76d8('0xb')](function(_0x3e58df){logger[_0x76d8('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d24cb,_0x76d8('0xd'));logger[_0x76d8('0xe')](_0x76d8('0xf'),_0x4d24cb,_0x76d8('0xd'),JSON[_0x76d8('0x10')](_0x3e58df));if(_0x3e58df[_0x76d8('0x11')]){if(_0x3e58df['error']['code']===0x1f4){logger[_0x76d8('0x11')](_0x76d8('0x12'),_0x4d24cb,_0x3e58df['error'][_0x76d8('0x13')]);return _0x1ddd4a(_0x3e58df[_0x76d8('0x11')]['message']);}logger[_0x76d8('0x11')](_0x76d8('0x12'),_0x4d24cb,_0x3e58df[_0x76d8('0x11')]['message']);return _0x38c0fa(_0x3e58df[_0x76d8('0x11')][_0x76d8('0x13')]);}else{logger[_0x76d8('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d24cb,'request\x20sent');_0x38c0fa(_0x3e58df['result'][_0x76d8('0x13')]);}})['catch'](function(_0x131e37){logger['error'](_0x76d8('0x12'),_0x4d24cb,_0x131e37);_0x1ddd4a(_0x131e37);});});}exports[_0x76d8('0x14')]=function(_0x29fd04){var _0x252bed=this;return new Promise(function(_0x51ace3,_0x1fc427){return db[_0x76d8('0x15')][_0x76d8('0x16')](_0x29fd04['body'],{'raw':_0x29fd04[_0x76d8('0x17')]?_0x29fd04['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb07275){logger[_0x76d8('0xc')](_0x76d8('0x14'),_0x29fd04);logger[_0x76d8('0xe')](_0x76d8('0x14'),_0x29fd04,JSON['stringify'](_0xb07275));_0x51ace3(_0xb07275);})[_0x76d8('0x18')](function(_0xd85e5c){logger['error'](_0x76d8('0x14'),_0xd85e5c['message'],_0x29fd04);_0x1fc427(_0x252bed['error'](0x1f4,_0xd85e5c[_0x76d8('0x13')]));});});}; \ No newline at end of file +var _0xd5de=['debug','stringify','code','error','message','result','catch','VoiceTransferReport','create','options','raw','then','CreateVoiceTransferReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0xd5de,0x125));var _0xed5d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd5de[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xed5d('0x0'));var util=require(_0xed5d('0x1'));var moment=require('moment');var BPromise=require(_0xed5d('0x2'));var rs=require(_0xed5d('0x3'));var fs=require('fs');var Redis=require(_0xed5d('0x4'));var db=require(_0xed5d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed5d('0x6'))('rpc');var config=require(_0xed5d('0x7'));var jayson=require(_0xed5d('0x8'));var client=jayson[_0xed5d('0x9')][_0xed5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21e4e6,_0x181ad7,_0x1bae0b){return new BPromise(function(_0x43512d,_0x140525){return client[_0xed5d('0xb')](_0x21e4e6,_0x1bae0b)['then'](function(_0x49f668){logger[_0xed5d('0xc')](_0xed5d('0xd'),_0x181ad7,_0xed5d('0xe'));logger[_0xed5d('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x181ad7,_0xed5d('0xe'),JSON[_0xed5d('0x10')](_0x49f668));if(_0x49f668['error']){if(_0x49f668['error'][_0xed5d('0x11')]===0x1f4){logger[_0xed5d('0x12')](_0xed5d('0xd'),_0x181ad7,_0x49f668[_0xed5d('0x12')]['message']);return _0x140525(_0x49f668[_0xed5d('0x12')][_0xed5d('0x13')]);}logger[_0xed5d('0x12')](_0xed5d('0xd'),_0x181ad7,_0x49f668[_0xed5d('0x12')][_0xed5d('0x13')]);return _0x43512d(_0x49f668[_0xed5d('0x12')][_0xed5d('0x13')]);}else{logger[_0xed5d('0xc')](_0xed5d('0xd'),_0x181ad7,'request\x20sent');_0x43512d(_0x49f668[_0xed5d('0x14')][_0xed5d('0x13')]);}})[_0xed5d('0x15')](function(_0x21aa4e){logger[_0xed5d('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x181ad7,_0x21aa4e);_0x140525(_0x21aa4e);});});}exports['CreateVoiceTransferReport']=function(_0x4f643c){var _0x30d260=this;return new Promise(function(_0x4a1381,_0x4738e5){return db[_0xed5d('0x16')][_0xed5d('0x17')](_0x4f643c['body'],{'raw':_0x4f643c[_0xed5d('0x18')]?_0x4f643c[_0xed5d('0x18')][_0xed5d('0x19')]===undefined?!![]:![]:!![]})[_0xed5d('0x1a')](function(_0x327b27){logger[_0xed5d('0xc')](_0xed5d('0x1b'),_0x4f643c);logger[_0xed5d('0xf')]('CreateVoiceTransferReport',_0x4f643c,JSON['stringify'](_0x327b27));_0x4a1381(_0x327b27);})[_0xed5d('0x15')](function(_0x3802dc){logger['error'](_0xed5d('0x1b'),_0x3802dc[_0xed5d('0x13')],_0x4f643c);_0x4738e5(_0x30d260['error'](0x1f4,_0x3802dc[_0xed5d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a4ba563..831b0e6 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 _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0xcb91[_0x1f7201];return _0x289fd2;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0x480385,_0x4e2ad1){var _0x3170ae=function(_0x17d531){while(--_0x17d531){_0x480385['push'](_0x480385['shift']());}};_0x3170ae(++_0x4e2ad1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2b675b,_0x16d15c){_0x2b675b=_0x2b675b-0x0;var _0x560ab1=_0x9bde[_0x2b675b];return _0x560ab1;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 48dd027..4b6176d 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 _0xe739=['info','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','entityFound:','webbar:hangup','hangup\x20executed!','catch','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','handleError:','error','stack','name','status','send','request','code','message','result','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!'];(function(_0x805971,_0x292146){var _0x109418=function(_0x240be8){while(--_0x240be8){_0x805971['push'](_0x805971['shift']());}};_0x109418(++_0x292146);}(_0xe739,0x105));var _0x9e73=function(_0x23c58e,_0x2597c4){_0x23c58e=_0x23c58e-0x0;var _0x71935c=_0xe739[_0x23c58e];return _0x71935c;};'use strict';var path=require(_0x9e73('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x9e73('0x1'))['db'];var config=require(_0x9e73('0x2'));var util=require(_0x9e73('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x9e73('0x4')]({'port':0x232a});var logger=require(_0x9e73('0x5'))(_0x9e73('0x6'));var Redis=require(_0x9e73('0x7'));config['redis']=_[_0x9e73('0x8')](config[_0x9e73('0x9')],{'host':_0x9e73('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9e73('0x9')]));var Schema=require(_0x9e73('0xb'));var originateValidation=new Schema({'userId':{'type':_0x9e73('0xc'),'required':[!![],_0x9e73('0xd')]},'callNumber':{'type':_0x9e73('0xe'),'required':[!![],_0x9e73('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x9e73('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9e73('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9e73('0xd')]},'sessionId':{'type':_0x9e73('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9e73('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9e73('0xe'),'required':[!![],_0x9e73('0x10')]},'transferNumber':{'type':_0x9e73('0xe'),'required':[!![],_0x9e73('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9e73('0xd')]},'sessionId':{'type':_0x9e73('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9e73('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9e73('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x9e73('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x9e73('0xc'),'required':[!![],_0x9e73('0xd')]}});function emit(_0x21bd3a,_0x5633e1,_0x16b2a9){logger['info'](_0x21bd3a,_0x5633e1,JSON[_0x9e73('0x12')](_0x16b2a9));io['to'](_0x21bd3a)['emit'](_0x5633e1,_0x16b2a9);}function handleError(_0x194eb9){return function(_0x48b1db){console['log'](_0x9e73('0x13'),_0x48b1db,_0x48b1db instanceof RangeError);logger[_0x9e73('0x14')](_0x48b1db[_0x9e73('0x15')]);if(_0x48b1db instanceof RangeError){if(_0x48b1db[_0x9e73('0x16')]){delete _0x48b1db[_0x9e73('0x16')];}_0x194eb9[_0x9e73('0x17')](0x194)[_0x9e73('0x18')](_0x48b1db);}else{if(_0x48b1db[_0x9e73('0x16')]){delete _0x48b1db[_0x9e73('0x16')];}_0x194eb9[_0x9e73('0x17')](0x1f4)['send'](_0x48b1db);}};}function checkError(){return function(_0x3954c0){if(!_0x3954c0){throw new RangeError('NotFound');}return _0x3954c0;};}function respondWithRpcPromise(_0xd3290d,_0x5875c5){return new BPromise(function(_0x31d354,_0x589a5d){var _0x2c2b32=amiClient;return _0x2c2b32[_0x9e73('0x19')](_0xd3290d,_0x5875c5)['then'](function(_0x55704a){if(_0x55704a[_0x9e73('0x14')]){if(_0x55704a[_0x9e73('0x14')][_0x9e73('0x1a')]===0x1f4){return _0x589a5d(_0x55704a[_0x9e73('0x14')][_0x9e73('0x1b')]);}return _0x31d354(_0x55704a['error'][_0x9e73('0x1b')]);}else{_0x31d354(_0x55704a[_0x9e73('0x1c')]);}})['catch'](function(_0x539560){_0x589a5d(_0x539560);});});}function getAgent(_0x28ff38){return db['User']['findOne']({'where':{'id':_0x28ff38,'role':_0x9e73('0x1d')}})[_0x9e73('0x1e')](checkError());}function getAgentCheckSession(_0x46991c,_0x47dcd2){return new BPromise(function(_0x368a70,_0x5fc1df){var _0x4e77bb=respondWithRpcPromise(_0x9e73('0x1f'));var _0x24532d=getAgent(_0x46991c);Promise[_0x9e73('0x20')]([_0x4e77bb,_0x24532d])[_0x9e73('0x1e')](function(_0x2363f6){var _0x511e35=_0x2363f6[0x0];var _0x312e08=_0x2363f6[0x1];var _0x49ec6b=_[_0x9e73('0x21')](_0x511e35[_0x9e73('0x22')],function(_0xb3ef4f){return _0xb3ef4f[_0x9e73('0x23')]==_0x312e08['id']&&_0xb3ef4f[_0x9e73('0x24')]==_0x47dcd2;});if(_0x49ec6b['length']==0x1){_0x368a70(_0x312e08);}else{_0x5fc1df(new RangeError(_0x9e73('0x25')+_0x47dcd2+_0x9e73('0x26')));}});});}exports['originate']=function(_0x4e5ab0,_0x296b93){logger[_0x9e73('0x27')](_0x9e73('0x28'),_0x4e5ab0[_0x9e73('0x29')]);var _0x38ec16=originateValidation[_0x9e73('0xb')](_0x4e5ab0['body']);if(_0x38ec16[_0x9e73('0x2a')]>0x0){return _0x296b93[_0x9e73('0x17')](0x190)[_0x9e73('0x2b')](_0x38ec16);}var _0xf63a46=_0x4e5ab0[_0x9e73('0x29')][_0x9e73('0x2c')];var _0x1c5dbf=_0x4e5ab0[_0x9e73('0x29')][_0x9e73('0x2d')];var _0x4339d6=_0x4e5ab0['body'][_0x9e73('0x2e')];var _0x2c2ebd=_0x4e5ab0[_0x9e73('0x29')][_0x9e73('0x2f')];return getAgent(_0xf63a46)['then'](function(_0x3d2608){logger[_0x9e73('0x27')]('entityFound:',_0x3d2608['name']);emit(util[_0x9e73('0x30')](_0x9e73('0x31'),_0x3d2608[_0x9e73('0x16')]),_0x9e73('0x32'),{'callNumber':_0x1c5dbf,'callerId':_0x4339d6,'callbackUrl':_0x2c2ebd});return _0x296b93[_0x9e73('0x17')](0xc8)[_0x9e73('0x2b')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x296b93));};exports['hangup']=function(_0xccd103,_0x369ecc){logger[_0x9e73('0x27')]('hangup\x20fired:',_0xccd103['body']);var _0x4b4e1b=hangupValidation[_0x9e73('0xb')](_0xccd103[_0x9e73('0x29')]);if(_0x4b4e1b[_0x9e73('0x2a')]>0x0){return _0x369ecc[_0x9e73('0x17')](0x190)['json'](_0x4b4e1b);}var _0x1992c3=_0xccd103[_0x9e73('0x29')][_0x9e73('0x2c')];var _0x395db3=_0xccd103[_0x9e73('0x29')][_0x9e73('0x24')];return getAgent(_0x1992c3)[_0x9e73('0x1e')](function(_0x3431a8){logger[_0x9e73('0x27')](_0x9e73('0x33'),_0x3431a8['name']);emit(util['format']('user:%s',_0x3431a8['name']),_0x9e73('0x34'),{'sessionId':_0x395db3});return _0x369ecc[_0x9e73('0x17')](0xc8)['json']({'error':![],'message':_0x9e73('0x35')});})[_0x9e73('0x36')](handleError(_0x369ecc));};exports['answer']=function(_0x4d4ed1,_0x5b231f){logger['info']('answer\x20fired:',_0x4d4ed1[_0x9e73('0x29')]);var _0x2a0166=answerValidation[_0x9e73('0xb')](_0x4d4ed1[_0x9e73('0x29')]);if(_0x2a0166['length']>0x0){return _0x5b231f['status'](0x190)[_0x9e73('0x2b')](_0x2a0166);}var _0x2ad38a=_0x4d4ed1[_0x9e73('0x29')][_0x9e73('0x2c')];var _0x3f348f=_0x4d4ed1[_0x9e73('0x29')]['sessionId'];return getAgent(_0x2ad38a)[_0x9e73('0x1e')](function(_0x9882c4){logger['info'](_0x9e73('0x33'),_0x9882c4[_0x9e73('0x16')]);emit(util['format'](_0x9e73('0x31'),_0x9882c4[_0x9e73('0x16')]),'webbar:answer',{'sessionId':_0x3f348f});return _0x5b231f[_0x9e73('0x17')](0xc8)[_0x9e73('0x2b')]({'error':![],'message':_0x9e73('0x37')});})[_0x9e73('0x36')](handleError(_0x5b231f));};exports[_0x9e73('0x38')]=function(_0x3933b5,_0x20c4cd){logger[_0x9e73('0x27')](_0x9e73('0x39'),_0x3933b5[_0x9e73('0x29')]);var _0x134be0=holdValidation[_0x9e73('0xb')](_0x3933b5[_0x9e73('0x29')]);if(_0x134be0[_0x9e73('0x2a')]>0x0){return _0x20c4cd[_0x9e73('0x17')](0x190)[_0x9e73('0x2b')](_0x134be0);}var _0x4e7891=_0x3933b5[_0x9e73('0x29')]['userId'];var _0x4e8c96=_0x3933b5[_0x9e73('0x29')][_0x9e73('0x24')];return getAgent(_0x4e7891)['then'](function(_0x4baaf7){logger[_0x9e73('0x27')](_0x9e73('0x33'),_0x4baaf7[_0x9e73('0x16')]);emit(util[_0x9e73('0x30')](_0x9e73('0x31'),_0x4baaf7[_0x9e73('0x16')]),_0x9e73('0x3a'),{'sessionId':_0x4e8c96});return _0x20c4cd[_0x9e73('0x17')](0xc8)[_0x9e73('0x2b')]({'error':![],'message':_0x9e73('0x3b')});})[_0x9e73('0x36')](handleError(_0x20c4cd));};exports[_0x9e73('0x3c')]=function(_0x230249,_0xe70028){logger['info'](_0x9e73('0x3d'),_0x230249[_0x9e73('0x29')]);var _0x1289f9=unholdValidation[_0x9e73('0xb')](_0x230249[_0x9e73('0x29')]);if(_0x1289f9[_0x9e73('0x2a')]>0x0){return _0xe70028[_0x9e73('0x17')](0x190)[_0x9e73('0x2b')](_0x1289f9);}var _0x4b67d4=_0x230249['body']['userId'];var _0xd78532=_0x230249['body'][_0x9e73('0x24')];return getAgent(_0x4b67d4)['then'](function(_0x3c9dcd){logger['info'](_0x9e73('0x33'),_0x3c9dcd[_0x9e73('0x16')]);emit(util[_0x9e73('0x30')](_0x9e73('0x31'),_0x3c9dcd[_0x9e73('0x16')]),_0x9e73('0x3e'),{'sessionId':_0xd78532});return _0xe70028[_0x9e73('0x17')](0xc8)['json']({'error':![],'message':_0x9e73('0x3f')});})['catch'](handleError(_0xe70028));};exports[_0x9e73('0x40')]=function(_0x39aa72,_0x29b3e1){logger['info'](_0x9e73('0x41'),_0x29b3e1[_0x9e73('0x29')]);var _0x50737d=callsValidation[_0x9e73('0xb')](_0x39aa72[_0x9e73('0x29')]);if(_0x50737d[_0x9e73('0x2a')]>0x0){return _0x29b3e1[_0x9e73('0x17')](0x190)[_0x9e73('0x2b')](_0x50737d);}var _0x5d7422=_0x39aa72[_0x9e73('0x29')][_0x9e73('0x2c')];var _0x5ed176=respondWithRpcPromise(_0x9e73('0x1f'));var _0x3b120d=getAgent(_0x5d7422);return Promise[_0x9e73('0x20')]([_0x5ed176,_0x3b120d])['then'](function(_0x1d1c05){var _0x353674=_0x1d1c05[0x0];var _0x5b2021=_0x1d1c05[0x1];var _0x1155d1=_[_0x9e73('0x21')](_0x353674[_0x9e73('0x22')],function(_0x15292f){return _0x15292f[_0x9e73('0x23')]==_0x5b2021['id'];});return _0x29b3e1[_0x9e73('0x17')](0xc8)[_0x9e73('0x2b')]({'count':_0x1155d1[_0x9e73('0x2a')],'rows':_0x1155d1});})[_0x9e73('0x36')](handleError(_0x29b3e1));};exports[_0x9e73('0x42')]=function(_0x22c2cd,_0x2783f0){logger['info'](_0x9e73('0x43'),_0x22c2cd[_0x9e73('0x29')]);var _0x3474d1=conferenceValidation['validate'](_0x22c2cd['body']);if(_0x3474d1[_0x9e73('0x2a')]>0x0){return _0x2783f0[_0x9e73('0x17')](0x190)[_0x9e73('0x2b')](_0x3474d1);}var _0x158b54=_0x22c2cd[_0x9e73('0x29')][_0x9e73('0x2c')];return getAgent(_0x158b54)[_0x9e73('0x1e')](function(_0x31ff2f){logger[_0x9e73('0x27')](_0x9e73('0x33'),_0x31ff2f[_0x9e73('0x16')]);emit(util[_0x9e73('0x30')]('user:%s',_0x31ff2f[_0x9e73('0x16')]),_0x9e73('0x44'));return _0x2783f0[_0x9e73('0x17')](0xc8)[_0x9e73('0x2b')]({'error':![],'message':_0x9e73('0x45')});})[_0x9e73('0x36')](handleError(_0x2783f0));};exports[_0x9e73('0x46')]=function(_0x2a15f0,_0x592593){logger['info'](_0x9e73('0x47'),_0x2a15f0['body']);var _0x598657=transferValidation[_0x9e73('0xb')](_0x2a15f0['body']);if(_0x598657[_0x9e73('0x2a')]>0x0){return _0x592593[_0x9e73('0x17')](0x190)[_0x9e73('0x2b')](_0x598657);}var _0xbb2b40=_0x2a15f0[_0x9e73('0x29')]['userId'];var _0x50fa6f=_0x2a15f0[_0x9e73('0x29')][_0x9e73('0x24')];var _0xa5a487=_0x2a15f0[_0x9e73('0x29')][_0x9e73('0x48')];return getAgent(_0xbb2b40)[_0x9e73('0x1e')](function(_0x2be436){logger[_0x9e73('0x27')](_0x9e73('0x33'),_0x2be436[_0x9e73('0x16')]);emit(util[_0x9e73('0x30')](_0x9e73('0x31'),_0x2be436['name']),_0x9e73('0x49'),{'sessionId':_0x50fa6f,'transferNumber':_0xa5a487});return _0x592593[_0x9e73('0x17')](0xc8)[_0x9e73('0x2b')]({'error':![],'message':_0x9e73('0x4a')});})[_0x9e73('0x36')](handleError(_0x592593));}; \ No newline at end of file +var _0x6c76=['userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','http','../../config/logger','ioredis','redis','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','name','status','send','NotFound','then','error','message','result','catch','VoiceChannels','all','filter','sessionId','sessionId\x20','\x20not\x20found!','originate','body','length','json'];(function(_0xe7df5d,_0x1c1f7d){var _0xc5a86=function(_0x39c128){while(--_0x39c128){_0xe7df5d['push'](_0xe7df5d['shift']());}};_0xc5a86(++_0x1c1f7d);}(_0x6c76,0x184));var _0x66c7=function(_0x43b4ec,_0x446dba){_0x43b4ec=_0x43b4ec-0x0;var _0x534aa5=_0x6c76[_0x43b4ec];return _0x534aa5;};'use strict';var path=require(_0x66c7('0x0'));var fs=require('fs');var _=require(_0x66c7('0x1'));var db=require(_0x66c7('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x66c7('0x5')]({'port':0x232a});var logger=require(_0x66c7('0x6'))('webbarapi');var Redis=require(_0x66c7('0x7'));config[_0x66c7('0x8')]=_['defaults'](config[_0x66c7('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x66c7('0x8')]));var Schema=require(_0x66c7('0x9'));var originateValidation=new Schema({'userId':{'type':_0x66c7('0xa'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x66c7('0xb'),'required':[!![],_0x66c7('0xc')]},'callerId':{'type':_0x66c7('0xb')},'callbackUrl':{'type':_0x66c7('0xb')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x66c7('0xd')]},'sessionId':{'type':_0x66c7('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x66c7('0xa'),'required':[!![],_0x66c7('0xd')]},'sessionId':{'type':_0x66c7('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x66c7('0xa'),'required':[!![],_0x66c7('0xd')]},'sessionId':{'type':'string','required':[!![],_0x66c7('0xe')]},'transferNumber':{'type':_0x66c7('0xb'),'required':[!![],_0x66c7('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x66c7('0xa'),'required':[!![],_0x66c7('0xd')]},'sessionId':{'type':_0x66c7('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x66c7('0xa'),'required':[!![],_0x66c7('0xd')]},'sessionId':{'type':_0x66c7('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x66c7('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x66c7('0xd')]}});function emit(_0x39f951,_0x3c81c0,_0x42e930){logger[_0x66c7('0x10')](_0x39f951,_0x3c81c0,JSON['stringify'](_0x42e930));io['to'](_0x39f951)['emit'](_0x3c81c0,_0x42e930);}function handleError(_0x53fb36){return function(_0x5129f6){console[_0x66c7('0x11')](_0x66c7('0x12'),_0x5129f6,_0x5129f6 instanceof RangeError);logger['error'](_0x5129f6['stack']);if(_0x5129f6 instanceof RangeError){if(_0x5129f6[_0x66c7('0x13')]){delete _0x5129f6[_0x66c7('0x13')];}_0x53fb36[_0x66c7('0x14')](0x194)[_0x66c7('0x15')](_0x5129f6);}else{if(_0x5129f6['name']){delete _0x5129f6['name'];}_0x53fb36[_0x66c7('0x14')](0x1f4)[_0x66c7('0x15')](_0x5129f6);}};}function checkError(){return function(_0xf30f9){if(!_0xf30f9){throw new RangeError(_0x66c7('0x16'));}return _0xf30f9;};}function respondWithRpcPromise(_0x465457,_0x75f118){return new BPromise(function(_0x4804cf,_0x4ddbd2){var _0x366e9b=amiClient;return _0x366e9b['request'](_0x465457,_0x75f118)[_0x66c7('0x17')](function(_0x8b96b1){if(_0x8b96b1[_0x66c7('0x18')]){if(_0x8b96b1[_0x66c7('0x18')]['code']===0x1f4){return _0x4ddbd2(_0x8b96b1[_0x66c7('0x18')][_0x66c7('0x19')]);}return _0x4804cf(_0x8b96b1['error'][_0x66c7('0x19')]);}else{_0x4804cf(_0x8b96b1[_0x66c7('0x1a')]);}})[_0x66c7('0x1b')](function(_0x2ef6a2){_0x4ddbd2(_0x2ef6a2);});});}function getAgent(_0x2af0a3){return db['User']['findOne']({'where':{'id':_0x2af0a3,'role':'agent'}})[_0x66c7('0x17')](checkError());}function getAgentCheckSession(_0x542ff1,_0x5c5e42){return new BPromise(function(_0x9afd50,_0x3e979d){var _0x205b7e=respondWithRpcPromise(_0x66c7('0x1c'));var _0x36a830=getAgent(_0x542ff1);Promise[_0x66c7('0x1d')]([_0x205b7e,_0x36a830])['then'](function(_0xccefb2){var _0x2e2560=_0xccefb2[0x0];var _0xc4b2bf=_0xccefb2[0x1];var _0x33be23=_[_0x66c7('0x1e')](_0x2e2560['rows'],function(_0x263b48){return _0x263b48['UserId']==_0xc4b2bf['id']&&_0x263b48[_0x66c7('0x1f')]==_0x5c5e42;});if(_0x33be23['length']==0x1){_0x9afd50(_0xc4b2bf);}else{_0x3e979d(new RangeError(_0x66c7('0x20')+_0x5c5e42+_0x66c7('0x21')));}});});}exports[_0x66c7('0x22')]=function(_0x2b492d,_0xb26028){logger[_0x66c7('0x10')]('originate\x20fired:',_0x2b492d['body']);var _0x367e49=originateValidation[_0x66c7('0x9')](_0x2b492d[_0x66c7('0x23')]);if(_0x367e49[_0x66c7('0x24')]>0x0){return _0xb26028[_0x66c7('0x14')](0x190)[_0x66c7('0x25')](_0x367e49);}var _0x44dcde=_0x2b492d[_0x66c7('0x23')][_0x66c7('0x26')];var _0x301495=_0x2b492d[_0x66c7('0x23')][_0x66c7('0x27')];var _0x4eb03f=_0x2b492d['body'][_0x66c7('0x28')];var _0x13e7a2=_0x2b492d[_0x66c7('0x23')][_0x66c7('0x29')];return getAgent(_0x44dcde)[_0x66c7('0x17')](function(_0x2bf7c2){logger[_0x66c7('0x10')]('entityFound:',_0x2bf7c2[_0x66c7('0x13')]);emit(util[_0x66c7('0x2a')](_0x66c7('0x2b'),_0x2bf7c2[_0x66c7('0x13')]),_0x66c7('0x2c'),{'callNumber':_0x301495,'callerId':_0x4eb03f,'callbackUrl':_0x13e7a2});return _0xb26028[_0x66c7('0x14')](0xc8)[_0x66c7('0x25')]({'error':![],'message':_0x66c7('0x2d')});})[_0x66c7('0x1b')](handleError(_0xb26028));};exports[_0x66c7('0x2e')]=function(_0x2598ee,_0x4cd663){logger['info'](_0x66c7('0x2f'),_0x2598ee[_0x66c7('0x23')]);var _0xc63941=hangupValidation['validate'](_0x2598ee['body']);if(_0xc63941[_0x66c7('0x24')]>0x0){return _0x4cd663[_0x66c7('0x14')](0x190)['json'](_0xc63941);}var _0x2d98e4=_0x2598ee[_0x66c7('0x23')][_0x66c7('0x26')];var _0x51c92b=_0x2598ee[_0x66c7('0x23')][_0x66c7('0x1f')];return getAgent(_0x2d98e4)[_0x66c7('0x17')](function(_0x14d59c){logger[_0x66c7('0x10')](_0x66c7('0x30'),_0x14d59c[_0x66c7('0x13')]);emit(util[_0x66c7('0x2a')](_0x66c7('0x2b'),_0x14d59c['name']),_0x66c7('0x31'),{'sessionId':_0x51c92b});return _0x4cd663[_0x66c7('0x14')](0xc8)[_0x66c7('0x25')]({'error':![],'message':_0x66c7('0x32')});})[_0x66c7('0x1b')](handleError(_0x4cd663));};exports[_0x66c7('0x33')]=function(_0x85274,_0x750adc){logger[_0x66c7('0x10')](_0x66c7('0x34'),_0x85274['body']);var _0x5bb5fc=answerValidation['validate'](_0x85274[_0x66c7('0x23')]);if(_0x5bb5fc[_0x66c7('0x24')]>0x0){return _0x750adc['status'](0x190)['json'](_0x5bb5fc);}var _0x34d002=_0x85274[_0x66c7('0x23')][_0x66c7('0x26')];var _0x900ee7=_0x85274[_0x66c7('0x23')]['sessionId'];return getAgent(_0x34d002)[_0x66c7('0x17')](function(_0x4b05d8){logger['info'](_0x66c7('0x30'),_0x4b05d8[_0x66c7('0x13')]);emit(util[_0x66c7('0x2a')](_0x66c7('0x2b'),_0x4b05d8['name']),'webbar:answer',{'sessionId':_0x900ee7});return _0x750adc[_0x66c7('0x14')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x66c7('0x1b')](handleError(_0x750adc));};exports[_0x66c7('0x35')]=function(_0x2b89e1,_0x18408d){logger['info'](_0x66c7('0x36'),_0x2b89e1[_0x66c7('0x23')]);var _0x2c8ffe=holdValidation['validate'](_0x2b89e1[_0x66c7('0x23')]);if(_0x2c8ffe[_0x66c7('0x24')]>0x0){return _0x18408d[_0x66c7('0x14')](0x190)[_0x66c7('0x25')](_0x2c8ffe);}var _0x1b78a6=_0x2b89e1[_0x66c7('0x23')][_0x66c7('0x26')];var _0x465a3d=_0x2b89e1['body'][_0x66c7('0x1f')];return getAgent(_0x1b78a6)[_0x66c7('0x17')](function(_0x23d0eb){logger[_0x66c7('0x10')](_0x66c7('0x30'),_0x23d0eb[_0x66c7('0x13')]);emit(util[_0x66c7('0x2a')](_0x66c7('0x2b'),_0x23d0eb[_0x66c7('0x13')]),_0x66c7('0x37'),{'sessionId':_0x465a3d});return _0x18408d[_0x66c7('0x14')](0xc8)[_0x66c7('0x25')]({'error':![],'message':_0x66c7('0x38')});})[_0x66c7('0x1b')](handleError(_0x18408d));};exports['unhold']=function(_0x43d4db,_0x225fb6){logger[_0x66c7('0x10')](_0x66c7('0x39'),_0x43d4db['body']);var _0x3d3448=unholdValidation[_0x66c7('0x9')](_0x43d4db['body']);if(_0x3d3448[_0x66c7('0x24')]>0x0){return _0x225fb6[_0x66c7('0x14')](0x190)[_0x66c7('0x25')](_0x3d3448);}var _0x3dee16=_0x43d4db[_0x66c7('0x23')][_0x66c7('0x26')];var _0x1ed21e=_0x43d4db['body'][_0x66c7('0x1f')];return getAgent(_0x3dee16)[_0x66c7('0x17')](function(_0x4a619d){logger[_0x66c7('0x10')](_0x66c7('0x30'),_0x4a619d[_0x66c7('0x13')]);emit(util['format'](_0x66c7('0x2b'),_0x4a619d[_0x66c7('0x13')]),_0x66c7('0x3a'),{'sessionId':_0x1ed21e});return _0x225fb6[_0x66c7('0x14')](0xc8)[_0x66c7('0x25')]({'error':![],'message':_0x66c7('0x3b')});})[_0x66c7('0x1b')](handleError(_0x225fb6));};exports[_0x66c7('0x3c')]=function(_0x5acdd3,_0x39320b){logger[_0x66c7('0x10')]('calls\x20fired:',_0x39320b[_0x66c7('0x23')]);var _0x167968=callsValidation[_0x66c7('0x9')](_0x5acdd3['body']);if(_0x167968['length']>0x0){return _0x39320b[_0x66c7('0x14')](0x190)['json'](_0x167968);}var _0x3c8fd9=_0x5acdd3[_0x66c7('0x23')][_0x66c7('0x26')];var _0x106b1e=respondWithRpcPromise(_0x66c7('0x1c'));var _0x1ff8a0=getAgent(_0x3c8fd9);return Promise['all']([_0x106b1e,_0x1ff8a0])['then'](function(_0x477e46){var _0x3c3c63=_0x477e46[0x0];var _0x5e6e32=_0x477e46[0x1];var _0x5a4908=_[_0x66c7('0x1e')](_0x3c3c63['rows'],function(_0x2e41ce){return _0x2e41ce[_0x66c7('0x3d')]==_0x5e6e32['id'];});return _0x39320b[_0x66c7('0x14')](0xc8)[_0x66c7('0x25')]({'count':_0x5a4908['length'],'rows':_0x5a4908});})[_0x66c7('0x1b')](handleError(_0x39320b));};exports[_0x66c7('0x3e')]=function(_0x2443cb,_0x2659f5){logger[_0x66c7('0x10')](_0x66c7('0x3f'),_0x2443cb['body']);var _0x24f22d=conferenceValidation[_0x66c7('0x9')](_0x2443cb[_0x66c7('0x23')]);if(_0x24f22d['length']>0x0){return _0x2659f5[_0x66c7('0x14')](0x190)['json'](_0x24f22d);}var _0x46c9cc=_0x2443cb[_0x66c7('0x23')][_0x66c7('0x26')];return getAgent(_0x46c9cc)[_0x66c7('0x17')](function(_0xa75268){logger[_0x66c7('0x10')]('entityFound:',_0xa75268[_0x66c7('0x13')]);emit(util[_0x66c7('0x2a')](_0x66c7('0x2b'),_0xa75268[_0x66c7('0x13')]),_0x66c7('0x40'));return _0x2659f5['status'](0xc8)[_0x66c7('0x25')]({'error':![],'message':_0x66c7('0x41')});})[_0x66c7('0x1b')](handleError(_0x2659f5));};exports[_0x66c7('0x42')]=function(_0x433fb5,_0x22ab1d){logger[_0x66c7('0x10')](_0x66c7('0x43'),_0x433fb5[_0x66c7('0x23')]);var _0x1a4e2b=transferValidation[_0x66c7('0x9')](_0x433fb5[_0x66c7('0x23')]);if(_0x1a4e2b['length']>0x0){return _0x22ab1d[_0x66c7('0x14')](0x190)[_0x66c7('0x25')](_0x1a4e2b);}var _0x3cde31=_0x433fb5[_0x66c7('0x23')][_0x66c7('0x26')];var _0x419b49=_0x433fb5[_0x66c7('0x23')]['sessionId'];var _0xe3f51=_0x433fb5[_0x66c7('0x23')][_0x66c7('0x44')];return getAgent(_0x3cde31)[_0x66c7('0x17')](function(_0x169efb){logger[_0x66c7('0x10')](_0x66c7('0x30'),_0x169efb[_0x66c7('0x13')]);emit(util[_0x66c7('0x2a')](_0x66c7('0x2b'),_0x169efb[_0x66c7('0x13')]),_0x66c7('0x45'),{'sessionId':_0x419b49,'transferNumber':_0xe3f51});return _0x22ab1d[_0x66c7('0x14')](0xc8)[_0x66c7('0x25')]({'error':![],'message':_0x66c7('0x46')});})[_0x66c7('0x1b')](handleError(_0x22ab1d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index bf7e866..c3b4fa1 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 _0x7a54=['index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','getApplications','post','create','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','/:id','delete','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x2276cd,_0x2fc025){var _0xbfee0=function(_0xe4a1d8){while(--_0xe4a1d8){_0x2276cd['push'](_0x2276cd['shift']());}};_0xbfee0(++_0x2fc025);}(_0x7a54,0x106));var _0x47a5=function(_0x293083,_0x40c31b){_0x293083=_0x293083-0x0;var _0x14767b=_0x7a54[_0x293083];return _0x14767b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/applications',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x13')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x14')]);router[_0x47a5('0x13')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['addDisposition']);router[_0x47a5('0x13')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x16')]);router[_0x47a5('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x47a5('0x17')]);router['post']('/:id/applications',auth[_0x47a5('0xc')](),controller[_0x47a5('0x18')]);router[_0x47a5('0x13')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x13')](_0x47a5('0x1b'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['put'](_0x47a5('0x1d'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0x1e')](_0x47a5('0x1d'),auth[_0x47a5('0xc')](),controller['destroy']);router[_0x47a5('0x1e')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1f')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['removeAnswers']);router[_0x47a5('0x1e')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x20')]);module[_0x47a5('0x21')]=router; \ No newline at end of file +var _0xc2c7=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x18e49a,_0x5bf163){var _0x1397b5=function(_0x28dfb0){while(--_0x28dfb0){_0x18e49a['push'](_0x18e49a['shift']());}};_0x1397b5(++_0x5bf163);}(_0xc2c7,0x134));var _0x7c2c=function(_0x58673b,_0x56dea4){_0x58673b=_0x58673b-0x0;var _0x3bb7c3=_0xc2c7[_0x58673b];return _0x3bb7c3;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x8')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c2c('0x16')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['addDisposition']);router[_0x7c2c('0x16')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['post'](_0x7c2c('0x12'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x16')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x19')]);router[_0x7c2c('0x16')](_0x7c2c('0x1a'),controller[_0x7c2c('0x1b')]);router[_0x7c2c('0x16')](_0x7c2c('0x1c'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1d')]);router['put'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7c2c('0x1e')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1f')]);router[_0x7c2c('0x1e')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['removeDispositions']);router[_0x7c2c('0x1e')]('/:id/canned_answers',auth[_0x7c2c('0x9')](),controller['removeAnswers']);router[_0x7c2c('0x1e')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 484d812..8a470a7 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 _0x8f2d=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x23c0e6,_0x3396b5){var _0x3b1047=function(_0x4e9f5f){while(--_0x4e9f5f){_0x23c0e6['push'](_0x23c0e6['shift']());}};_0x3b1047(++_0x3396b5);}(_0x8f2d,0x15d));var _0xd8f2=function(_0x3f3da3,_0x1915cc){_0x3f3da3=_0x3f3da3-0x0;var _0x195dfb=_0x8f2d[_0x3f3da3];return _0x195dfb;};'use strict';var Sequelize=require(_0xd8f2('0x0'));var rs=require(_0xd8f2('0x1'));module[_0xd8f2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xd8f2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xd8f2('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd8f2('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd8f2('0x4')]},'type':{'type':Sequelize[_0xd8f2('0x5')](_0xd8f2('0x6'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xd8f2('0x4')]},'notificationTemplate':{'type':Sequelize[_0xd8f2('0x7')],'defaultValue':function(){return _0xd8f2('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd8f2('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd8f2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd8f2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd8f2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd8f2('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xd8f2('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x332820){if(!_0x332820){this[_0xd8f2('0xc')](_0xd8f2('0xd'),null);}this[_0xd8f2('0xc')](_0xd8f2('0xe'),_0x332820);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a96=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue'];(function(_0x122751,_0x48aa61){var _0xc1ac24=function(_0x307a3f){while(--_0x307a3f){_0x122751['push'](_0x122751['shift']());}};_0xc1ac24(++_0x48aa61);}(_0x6a96,0x1be));var _0x66a9=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0x6a96[_0x4ef734];return _0x33a7cb;};'use strict';var Sequelize=require(_0x66a9('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x66a9('0x1')],'unique':_0x66a9('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x66a9('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x66a9('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x66a9('0x1')]},'type':{'type':Sequelize[_0x66a9('0x3')](_0x66a9('0x4'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x66a9('0x1')]},'notificationTemplate':{'type':Sequelize[_0x66a9('0x5')],'defaultValue':function(){return _0x66a9('0x6');}},'notificationSound':{'type':Sequelize[_0x66a9('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x66a9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x66a9('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x66a9('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x141c6d){if(!_0x141c6d){this[_0x66a9('0x9')](_0x66a9('0xa'),null);}this[_0x66a9('0x9')](_0x66a9('0xb'),_0x141c6d);}},'description':{'type':Sequelize[_0x66a9('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 5634082..3326aa3 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 _0x028d=['index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','Pause','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','options','removeDispositions','ids','WhatsappAccountId','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','send','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','Applications','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','receiveMessage','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','destroy','get','WhatsappAccounts','UserProfileResource','name'];(function(_0x525690,_0x27c737){var _0x337c50=function(_0xa2d95c){while(--_0xa2d95c){_0x525690['push'](_0x525690['shift']());}};_0x337c50(++_0x27c737);}(_0x028d,0x8e));var _0xd028=function(_0x1b7043,_0x2e35ff){_0x1b7043=_0x1b7043-0x0;var _0x17dd57=_0x028d[_0x1b7043];return _0x17dd57;};'use strict';var emlformat=require(_0xd028('0x0'));var rimraf=require(_0xd028('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd028('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd028('0x3'));var util=require(_0xd028('0x4'));var path=require(_0xd028('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd028('0x6'));var fs=require('fs');var fs_extra=require(_0xd028('0x7'));var _=require('lodash');var squel=require(_0xd028('0x8'));var crypto=require(_0xd028('0x9'));var jsforce=require(_0xd028('0xa'));var deskjs=require(_0xd028('0xb'));var toCsv=require(_0xd028('0xc'));var querystring=require(_0xd028('0xd'));var Papa=require('papaparse');var Redis=require(_0xd028('0xe'));var authService=require(_0xd028('0xf'));var qs=require(_0xd028('0x10'));var as=require(_0xd028('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd028('0x12'))(_0xd028('0x13'));var utils=require('../../config/utils');var config=require(_0xd028('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd028('0x15'))['db'];config[_0xd028('0x16')]=_['defaults'](config[_0xd028('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xd028('0x17'))(new Redis(config[_0xd028('0x16')]));require(_0xd028('0x18'))[_0xd028('0x19')](socket);var jayson=require(_0xd028('0x1a'));var client=jayson[_0xd028('0x1b')][_0xd028('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x1ad5e0,_0x6ad7c2,_0x2575b3,_0x230141){return new BPromise(function(_0x26aedd,_0xbbc6c0){var _0x296928=_0x230141||client;return _0x296928[_0xd028('0x1d')](_0x1ad5e0,_0x2575b3)[_0xd028('0x1e')](function(_0x146ab1){logger['info'](_0xd028('0x1f'),_0x6ad7c2,'request\x20sent');logger[_0xd028('0x20')](_0xd028('0x21'),_0x6ad7c2,'request\x20sent',JSON[_0xd028('0x22')](_0x146ab1));if(_0x146ab1['error']){if(_0x146ab1[_0xd028('0x23')][_0xd028('0x24')]===0x1f4){logger[_0xd028('0x23')](_0xd028('0x1f'),_0x6ad7c2,_0x146ab1['error'][_0xd028('0x25')]);return _0xbbc6c0(_0x146ab1[_0xd028('0x23')][_0xd028('0x25')]);}logger[_0xd028('0x23')](_0xd028('0x1f'),_0x6ad7c2,_0x146ab1[_0xd028('0x23')]['message']);return _0x26aedd(_0x146ab1[_0xd028('0x23')][_0xd028('0x25')]);}else{logger['info'](_0xd028('0x1f'),_0x6ad7c2,_0xd028('0x26'));_0x26aedd(_0x146ab1[_0xd028('0x27')][_0xd028('0x25')]);}})[_0xd028('0x28')](function(_0x59a559){logger['error'](_0xd028('0x1f'),_0x6ad7c2,_0x59a559);_0xbbc6c0(_0x59a559);});});}function respondWithStatusCode(_0x110787,_0x23a928){_0x23a928=_0x23a928||0xcc;return function(_0x5e6a79){if(_0x5e6a79){return _0x110787[_0xd028('0x29')](_0x23a928);}return _0x110787[_0xd028('0x2a')](_0x23a928)[_0xd028('0x2b')]();};}function respondWithResult(_0x745b68,_0x22597a){_0x22597a=_0x22597a||0xc8;return function(_0x53630a){if(_0x53630a){return _0x745b68[_0xd028('0x2a')](_0x22597a)['json'](_0x53630a);}};}function respondWithFilteredResult(_0x4282d3,_0xdf2068){return function(_0x1d2848){if(_0x1d2848){var _0x10ea44=typeof _0xdf2068[_0xd028('0x2c')]==='undefined'&&typeof _0xdf2068[_0xd028('0x2d')]===_0xd028('0x2e');var _0x3397da=_0x1d2848[_0xd028('0x2f')];var _0x47e750=_0x10ea44?0x0:_0xdf2068[_0xd028('0x2c')];var _0x17901e=_0x10ea44?_0x1d2848[_0xd028('0x2f')]:_0xdf2068['offset']+_0xdf2068[_0xd028('0x2d')];var _0x38a836;if(_0x17901e>=_0x3397da){_0x17901e=_0x3397da;_0x38a836=0xc8;}else{_0x38a836=0xce;}_0x4282d3[_0xd028('0x2a')](_0x38a836);return _0x4282d3[_0xd028('0x30')](_0xd028('0x31'),_0x47e750+'-'+_0x17901e+'/'+_0x3397da)[_0xd028('0x32')](_0x1d2848);}return null;};}function patchUpdates(_0x4692f4){return function(_0x5c8a8a){try{jsonpatch[_0xd028('0x33')](_0x5c8a8a,_0x4692f4,!![]);}catch(_0x535122){return BPromise[_0xd028('0x34')](_0x535122);}return _0x5c8a8a['save']();};}function saveUpdates(_0x5e361b,_0x53f214){return function(_0x4506c0){if(_0x4506c0){return _0x4506c0['update'](_0x5e361b)[_0xd028('0x1e')](function(_0x595fad){return _0x595fad;});}return null;};}function removeEntity(_0x548374,_0x5cc7b5){return function(_0x27d3d1){if(_0x27d3d1){return _0x27d3d1[_0xd028('0x35')]()[_0xd028('0x1e')](function(){var _0x352786=_0x27d3d1[_0xd028('0x36')]({'plain':!![]});var _0x1f267f=_0xd028('0x37');return db[_0xd028('0x38')][_0xd028('0x35')]({'where':{'type':_0x1f267f,'resourceId':_0x352786['id']}})['then'](function(){return _0x27d3d1;});})[_0xd028('0x1e')](function(){_0x548374['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cffb0,_0x14085f){return function(_0x151076){if(!_0x151076){_0x2cffb0[_0xd028('0x29')](0x194);}return _0x151076;};}function handleError(_0x4b3564,_0x41dbcb){_0x41dbcb=_0x41dbcb||0x1f4;return function(_0x352f45){logger[_0xd028('0x23')](_0x352f45['stack']);if(_0x352f45['name']){delete _0x352f45[_0xd028('0x39')];}_0x4b3564[_0xd028('0x2a')](_0x41dbcb)['send'](_0x352f45);};}exports[_0xd028('0x3a')]=function(_0x105367,_0x45ab20){var _0x293187={'include':[{'model':db['Pause'],'as':_0xd028('0x3b')}]},_0x23a865={},_0x1f5bac={'count':0x0,'rows':[]};var _0x1d03b1=_['map'](db[_0xd028('0x3c')][_0xd028('0x3d')],function(_0x271f93){return{'name':_0x271f93[_0xd028('0x3e')],'type':_0x271f93[_0xd028('0x3f')][_0xd028('0x40')]};});_0x23a865[_0xd028('0x41')]=_[_0xd028('0x42')](_0x1d03b1,_0xd028('0x39'));_0x23a865[_0xd028('0x43')]=_[_0xd028('0x44')](_0x105367[_0xd028('0x43')]);_0x23a865[_0xd028('0x45')]=_[_0xd028('0x46')](_0x23a865[_0xd028('0x41')],_0x23a865['query']);_0x293187[_0xd028('0x47')]=_[_0xd028('0x46')](_0x23a865[_0xd028('0x41')],qs['fields'](_0x105367[_0xd028('0x43')][_0xd028('0x48')]));_0x293187['attributes']=_0x293187[_0xd028('0x47')][_0xd028('0x49')]?_0x293187[_0xd028('0x47')]:_0x23a865[_0xd028('0x41')];if(!_0x105367[_0xd028('0x43')][_0xd028('0x4a')](_0xd028('0x4b'))){_0x293187['limit']=qs[_0xd028('0x2d')](_0x105367['query'][_0xd028('0x2d')]);_0x293187[_0xd028('0x2c')]=qs[_0xd028('0x2c')](_0x105367[_0xd028('0x43')]['offset']);}_0x293187[_0xd028('0x4c')]=qs[_0xd028('0x4d')](_0x105367['query'][_0xd028('0x4d')]);_0x293187[_0xd028('0x4e')]=qs[_0xd028('0x45')](_[_0xd028('0x4f')](_0x105367['query'],_0x23a865['filters']),_0x1d03b1);if(_0x105367[_0xd028('0x43')][_0xd028('0x50')]){_0x293187[_0xd028('0x4e')]=_[_0xd028('0x51')](_0x293187[_0xd028('0x4e')],{'$or':_['map'](_0x1d03b1,function(_0x47cbe1){if(_0x47cbe1[_0xd028('0x3f')]!==_0xd028('0x52')){var _0x1ce363={};_0x1ce363[_0x47cbe1[_0xd028('0x39')]]={'$like':'%'+_0x105367['query'][_0xd028('0x50')]+'%'};return _0x1ce363;}})});}_0x293187=_[_0xd028('0x51')]({},_0x293187,_0x105367['options']);var _0x3f5d8f={'where':_0x293187[_0xd028('0x4e')]};return db[_0xd028('0x3c')][_0xd028('0x2f')](_0x3f5d8f)[_0xd028('0x1e')](function(_0x2297d7){_0x1f5bac[_0xd028('0x2f')]=_0x2297d7;if(_0x105367[_0xd028('0x43')][_0xd028('0x53')]){_0x293187['include']=[{'all':!![]}];}return db[_0xd028('0x3c')][_0xd028('0x54')](_0x293187);})['then'](function(_0x5ced0d){_0x1f5bac[_0xd028('0x55')]=_0x5ced0d;return _0x1f5bac;})['then'](respondWithFilteredResult(_0x45ab20,_0x293187))['catch'](handleError(_0x45ab20,null));};exports[_0xd028('0x56')]=function(_0x220e00,_0x7b5bd4){var _0x44a0c5={'raw':![],'where':{'id':_0x220e00[_0xd028('0x57')]['id']},'include':[{'model':db[_0xd028('0x58')],'as':_0xd028('0x3b')}]},_0xc22f7a={};_0xc22f7a[_0xd028('0x41')]=_['keys'](db[_0xd028('0x3c')][_0xd028('0x3d')]);_0xc22f7a[_0xd028('0x43')]=_[_0xd028('0x44')](_0x220e00[_0xd028('0x43')]);_0xc22f7a[_0xd028('0x45')]=_[_0xd028('0x46')](_0xc22f7a[_0xd028('0x41')],_0xc22f7a[_0xd028('0x43')]);_0x44a0c5['attributes']=_[_0xd028('0x46')](_0xc22f7a[_0xd028('0x41')],qs[_0xd028('0x48')](_0x220e00[_0xd028('0x43')]['fields']));_0x44a0c5[_0xd028('0x47')]=_0x44a0c5[_0xd028('0x47')][_0xd028('0x49')]?_0x44a0c5[_0xd028('0x47')]:_0xc22f7a[_0xd028('0x41')];if(_0x220e00[_0xd028('0x43')][_0xd028('0x53')]){_0x44a0c5[_0xd028('0x59')]=[{'all':!![]}];}_0x44a0c5=_['merge']({},_0x44a0c5,_0x220e00['options']);return db['WhatsappAccount'][_0xd028('0x5a')](_0x44a0c5)[_0xd028('0x1e')](handleEntityNotFound(_0x7b5bd4,null))['then'](respondWithResult(_0x7b5bd4,null))['catch'](handleError(_0x7b5bd4,null));};exports[_0xd028('0x5b')]=function(_0x856c7c,_0x1a7992){return db[_0xd028('0x3c')][_0xd028('0x5b')](_0x856c7c[_0xd028('0x5c')],{})[_0xd028('0x1e')](function(_0xa02494){var _0x4a55cc=_0x856c7c[_0xd028('0x5d')][_0xd028('0x36')]({'plain':!![]});if(!_0x4a55cc)throw new Error(_0xd028('0x5e'));if(_0x4a55cc[_0xd028('0x5f')]===_0xd028('0x5d')){var _0x1949ef=_0xa02494['get']({'plain':!![]});var _0x51d05d=_0xd028('0x37');return db[_0xd028('0x60')]['find']({'where':{'name':_0x51d05d,'userProfileId':_0x4a55cc[_0xd028('0x61')]},'raw':!![]})['then'](function(_0x3fcc47){if(_0x3fcc47&&_0x3fcc47['autoAssociation']===0x0){return db[_0xd028('0x38')][_0xd028('0x5b')]({'name':_0x1949ef[_0xd028('0x39')],'resourceId':_0x1949ef['id'],'type':_0x3fcc47[_0xd028('0x39')],'sectionId':_0x3fcc47['id']},{})[_0xd028('0x1e')](function(){return _0xa02494;});}else{return _0xa02494;}})[_0xd028('0x28')](function(_0x1079de){logger[_0xd028('0x23')](_0xd028('0x62'),_0x1079de);throw _0x1079de;});}return _0xa02494;})[_0xd028('0x1e')](respondWithResult(_0x1a7992,0xc9))[_0xd028('0x28')](handleError(_0x1a7992,null));};exports['update']=function(_0x2318ef,_0x4c722b){if(_0x2318ef[_0xd028('0x5c')]['id']){delete _0x2318ef[_0xd028('0x5c')]['id'];}return db[_0xd028('0x3c')][_0xd028('0x5a')]({'where':{'id':_0x2318ef['params']['id']},'include':[{'model':db[_0xd028('0x58')],'as':_0xd028('0x3b')}]})[_0xd028('0x1e')](handleEntityNotFound(_0x4c722b,null))[_0xd028('0x1e')](saveUpdates(_0x2318ef[_0xd028('0x5c')],null))['then'](respondWithResult(_0x4c722b,null))[_0xd028('0x28')](handleError(_0x4c722b,null));};exports['destroy']=function(_0x5c6ac2,_0x18f664){return db[_0xd028('0x3c')][_0xd028('0x5a')]({'where':{'id':_0x5c6ac2[_0xd028('0x57')]['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x18f664,null))[_0xd028('0x1e')](removeEntity(_0x18f664,null))[_0xd028('0x28')](handleError(_0x18f664,null));};exports['describe']=function(_0x2142c4,_0x254a15){return db[_0xd028('0x3c')][_0xd028('0x63')]()[_0xd028('0x1e')](respondWithResult(_0x254a15,null))[_0xd028('0x28')](handleError(_0x254a15,null));};exports[_0xd028('0x64')]=function(_0x58b3a4,_0xaf6d7,_0x1cb50e){if(_0x58b3a4[_0xd028('0x5c')]['id']){delete _0x58b3a4[_0xd028('0x5c')]['id'];}return db[_0xd028('0x3c')]['find']({'where':{'id':_0x58b3a4[_0xd028('0x57')]['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0xaf6d7,null))[_0xd028('0x1e')](function(_0x47341f){if(_0x47341f){_0x58b3a4[_0xd028('0x5c')]['WhatsappAccountId']=_0x47341f['id'];return db[_0xd028('0x65')]['create'](_0x58b3a4[_0xd028('0x5c')]);}})[_0xd028('0x1e')](respondWithResult(_0xaf6d7,null))['catch'](handleError(_0xaf6d7,null));};exports[_0xd028('0x66')]=function(_0x100d97,_0x19c9c5,_0xef897c){var _0x8edb1b={'raw':![],'where':{}};var _0x4d05af={};var _0x35838c={'count':0x0,'rows':[]};return db[_0xd028('0x3c')][_0xd028('0x67')]({'where':{'id':_0x100d97['params']['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x19c9c5,null))[_0xd028('0x1e')](function(_0x336558){if(_0x336558){_0x4d05af[_0xd028('0x41')]=_[_0xd028('0x44')](db[_0xd028('0x65')]['rawAttributes']);_0x4d05af['query']=_[_0xd028('0x44')](_0x100d97[_0xd028('0x43')]);_0x4d05af[_0xd028('0x45')]=_['intersection'](_0x4d05af[_0xd028('0x41')],_0x4d05af[_0xd028('0x43')]);_0x8edb1b[_0xd028('0x47')]=_[_0xd028('0x46')](_0x4d05af[_0xd028('0x41')],qs[_0xd028('0x48')](_0x100d97[_0xd028('0x43')]['fields']));_0x8edb1b[_0xd028('0x47')]=_0x8edb1b[_0xd028('0x47')][_0xd028('0x49')]?_0x8edb1b[_0xd028('0x47')]:_0x4d05af['model'];if(!_0x100d97['query'][_0xd028('0x4a')](_0xd028('0x4b'))){_0x8edb1b[_0xd028('0x2d')]=qs['limit'](_0x100d97[_0xd028('0x43')][_0xd028('0x2d')]);_0x8edb1b[_0xd028('0x2c')]=qs['offset'](_0x100d97[_0xd028('0x43')][_0xd028('0x2c')]);}_0x8edb1b[_0xd028('0x4c')]=qs[_0xd028('0x4d')](_0x100d97['query']['sort']);_0x8edb1b[_0xd028('0x4e')]=qs[_0xd028('0x45')](_[_0xd028('0x4f')](_0x100d97['query'],_0x4d05af['filters']));_0x8edb1b[_0xd028('0x4e')]['WhatsappAccountId']=_0x336558['id'];if(_0x100d97[_0xd028('0x43')][_0xd028('0x50')]){_0x8edb1b['where']=_['merge'](_0x8edb1b[_0xd028('0x4e')],{'$or':_['map'](_0x8edb1b[_0xd028('0x47')],function(_0x54f085){var _0x42c5ba={};_0x42c5ba[_0x54f085]={'$like':'%'+_0x100d97[_0xd028('0x43')][_0xd028('0x50')]+'%'};return _0x42c5ba;})});}_0x8edb1b=_[_0xd028('0x51')]({},_0x8edb1b,_0x100d97[_0xd028('0x68')]);return db['Disposition']['count']({'where':_0x8edb1b[_0xd028('0x4e')]})[_0xd028('0x1e')](function(_0x37d891){_0x35838c[_0xd028('0x2f')]=_0x37d891;if(_0x100d97['query'][_0xd028('0x53')]){_0x8edb1b[_0xd028('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xd028('0x54')](_0x8edb1b);})[_0xd028('0x1e')](function(_0x25e519){_0x35838c[_0xd028('0x55')]=_0x25e519;return _0x35838c;});}})[_0xd028('0x1e')](respondWithFilteredResult(_0x19c9c5,_0x8edb1b))['catch'](handleError(_0x19c9c5,null));};exports[_0xd028('0x69')]=function(_0x41bf8a,_0x238acc,_0x4bd7b4){return db[_0xd028('0x3c')][_0xd028('0x5a')]({'where':{'id':_0x41bf8a[_0xd028('0x57')]['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x238acc,null))[_0xd028('0x1e')](function(_0x1092c2){if(_0x1092c2){return _0x1092c2[_0xd028('0x69')](_0x41bf8a['query'][_0xd028('0x6a')]);}})[_0xd028('0x1e')](respondWithStatusCode(_0x238acc,null))[_0xd028('0x28')](handleError(_0x238acc,null));};exports['addAnswer']=function(_0x9540ca,_0x1deef3,_0x2d45de){if(_0x9540ca[_0xd028('0x5c')]['id']){delete _0x9540ca[_0xd028('0x5c')]['id'];}return db[_0xd028('0x3c')]['find']({'where':{'id':_0x9540ca[_0xd028('0x57')]['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x1deef3,null))['then'](function(_0x31a742){if(_0x31a742){_0x9540ca[_0xd028('0x5c')][_0xd028('0x6b')]=_0x31a742['id'];return db['CannedAnswer'][_0xd028('0x5b')](_0x9540ca['body']);}})[_0xd028('0x1e')](respondWithResult(_0x1deef3,null))[_0xd028('0x28')](handleError(_0x1deef3,null));};exports[_0xd028('0x6c')]=function(_0x36954c,_0x1e1621,_0x20cfa0){var _0x485c67={'raw':![],'where':{}};var _0x43b667={};var _0x237401={'count':0x0,'rows':[]};return db[_0xd028('0x3c')][_0xd028('0x67')]({'where':{'id':_0x36954c[_0xd028('0x57')]['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x1e1621,null))[_0xd028('0x1e')](function(_0x88b58f){if(_0x88b58f){_0x43b667[_0xd028('0x41')]=_[_0xd028('0x44')](db[_0xd028('0x6d')][_0xd028('0x3d')]);_0x43b667[_0xd028('0x43')]=_[_0xd028('0x44')](_0x36954c[_0xd028('0x43')]);_0x43b667['filters']=_[_0xd028('0x46')](_0x43b667[_0xd028('0x41')],_0x43b667[_0xd028('0x43')]);_0x485c67[_0xd028('0x47')]=_['intersection'](_0x43b667[_0xd028('0x41')],qs[_0xd028('0x48')](_0x36954c['query']['fields']));_0x485c67[_0xd028('0x47')]=_0x485c67['attributes'][_0xd028('0x49')]?_0x485c67[_0xd028('0x47')]:_0x43b667[_0xd028('0x41')];if(!_0x36954c[_0xd028('0x43')][_0xd028('0x4a')]('nolimit')){_0x485c67[_0xd028('0x2d')]=qs['limit'](_0x36954c[_0xd028('0x43')][_0xd028('0x2d')]);_0x485c67[_0xd028('0x2c')]=qs['offset'](_0x36954c[_0xd028('0x43')][_0xd028('0x2c')]);}_0x485c67[_0xd028('0x4c')]=qs[_0xd028('0x4d')](_0x36954c['query'][_0xd028('0x4d')]);_0x485c67['where']=qs[_0xd028('0x45')](_[_0xd028('0x4f')](_0x36954c[_0xd028('0x43')],_0x43b667[_0xd028('0x45')]));_0x485c67['where'][_0xd028('0x6b')]=_0x88b58f['id'];if(_0x36954c[_0xd028('0x43')][_0xd028('0x50')]){_0x485c67['where']=_[_0xd028('0x51')](_0x485c67['where'],{'$or':_[_0xd028('0x42')](_0x485c67[_0xd028('0x47')],function(_0x3f972d){var _0x5df632={};_0x5df632[_0x3f972d]={'$like':'%'+_0x36954c[_0xd028('0x43')][_0xd028('0x50')]+'%'};return _0x5df632;})});}_0x485c67=_[_0xd028('0x51')]({},_0x485c67,_0x36954c[_0xd028('0x68')]);return db['CannedAnswer'][_0xd028('0x2f')]({'where':_0x485c67[_0xd028('0x4e')]})[_0xd028('0x1e')](function(_0x3bd089){_0x237401[_0xd028('0x2f')]=_0x3bd089;if(_0x36954c[_0xd028('0x43')][_0xd028('0x53')]){_0x485c67[_0xd028('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd028('0x54')](_0x485c67);})[_0xd028('0x1e')](function(_0x4ccb0e){_0x237401['rows']=_0x4ccb0e;return _0x237401;});}})[_0xd028('0x1e')](respondWithFilteredResult(_0x1e1621,_0x485c67))['catch'](handleError(_0x1e1621,null));};exports[_0xd028('0x6e')]=function(_0x3beba9,_0x1aeb78,_0x24d9f7){return db[_0xd028('0x3c')]['find']({'where':{'id':_0x3beba9['params']['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x1aeb78,null))[_0xd028('0x1e')](function(_0x57360f){if(_0x57360f){return _0x57360f[_0xd028('0x6e')](_0x3beba9['query'][_0xd028('0x6a')]);}})[_0xd028('0x1e')](respondWithStatusCode(_0x1aeb78,null))[_0xd028('0x28')](handleError(_0x1aeb78,null));};exports['addAgents']=function(_0x5c3cac,_0x2576ef,_0x5ee4a1){return db['WhatsappAccount'][_0xd028('0x5a')]({'where':{'id':_0x5c3cac['params']['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x2576ef,null))[_0xd028('0x1e')](function(_0x37cb3a){if(_0x37cb3a){return _0x37cb3a[_0xd028('0x6f')](_0x5c3cac[_0xd028('0x5c')][_0xd028('0x6a')],_[_0xd028('0x70')](_0x5c3cac[_0xd028('0x5c')],[_0xd028('0x6a'),'id'])||{})[_0xd028('0x71')](function(_0x596b54){for(var _0x34bf5f=0x0;_0x34bf5f<_0x5c3cac[_0xd028('0x5c')][_0xd028('0x6a')][_0xd028('0x49')];_0x34bf5f+=0x1){socket[_0xd028('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x5c3cac['body'][_0xd028('0x6a')][_0x34bf5f]),'WhatsappAccountId':Number(_0x5c3cac['params']['id'])});}return _0x596b54;});}})[_0xd028('0x1e')](respondWithResult(_0x2576ef,null))[_0xd028('0x28')](handleError(_0x2576ef,null));};exports[_0xd028('0x73')]=function(_0x1eb4a2,_0x308e2d,_0x30a5a1){return db[_0xd028('0x3c')][_0xd028('0x5a')]({'where':{'id':_0x1eb4a2[_0xd028('0x57')]['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x308e2d,null))[_0xd028('0x1e')](function(_0x134301){if(_0x134301){return _0x134301[_0xd028('0x73')](_0x1eb4a2['query'][_0xd028('0x6a')])[_0xd028('0x1e')](function(){if(_[_0xd028('0x74')](_0x1eb4a2[_0xd028('0x43')]['ids'])){for(var _0x2dbcdc=0x0;_0x2dbcdc<_0x1eb4a2[_0xd028('0x43')][_0xd028('0x6a')]['length'];_0x2dbcdc+=0x1){socket[_0xd028('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x1eb4a2['query'][_0xd028('0x6a')][_0x2dbcdc]),'WhatsappAccountId':Number(_0x1eb4a2[_0xd028('0x57')]['id'])});}}else{socket[_0xd028('0x72')](_0xd028('0x75'),{'UserId':Number(_0x1eb4a2[_0xd028('0x43')][_0xd028('0x6a')]),'WhatsappAccountId':Number(_0x1eb4a2[_0xd028('0x57')]['id'])});}});}})[_0xd028('0x1e')](respondWithStatusCode(_0x308e2d,null))[_0xd028('0x28')](handleError(_0x308e2d,null));};exports[_0xd028('0x76')]=function(_0x24808f,_0x307c56,_0x3868e4){var _0x40419c={};var _0x5dfad8={};var _0x1e9183;var _0x35c6ad;return db[_0xd028('0x3c')][_0xd028('0x67')]({'where':{'id':_0x24808f[_0xd028('0x57')]['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x307c56,null))[_0xd028('0x1e')](function(_0x4da939){if(_0x4da939){_0x1e9183=_0x4da939;_0x5dfad8[_0xd028('0x41')]=_[_0xd028('0x44')](db[_0xd028('0x77')][_0xd028('0x3d')]);_0x5dfad8[_0xd028('0x43')]=_[_0xd028('0x44')](_0x24808f[_0xd028('0x43')]);_0x5dfad8[_0xd028('0x45')]=_['intersection'](_0x5dfad8['model'],_0x5dfad8[_0xd028('0x43')]);_0x40419c[_0xd028('0x47')]=_[_0xd028('0x46')](_0x5dfad8['model'],qs['fields'](_0x24808f['query'][_0xd028('0x48')]));_0x40419c[_0xd028('0x47')]=_0x40419c[_0xd028('0x47')][_0xd028('0x49')]?_0x40419c[_0xd028('0x47')]:_0x5dfad8[_0xd028('0x41')];_0x40419c[_0xd028('0x4c')]=qs['sort'](_0x24808f[_0xd028('0x43')][_0xd028('0x4d')]);_0x40419c[_0xd028('0x4e')]=qs[_0xd028('0x45')](_[_0xd028('0x4f')](_0x24808f['query'],_0x5dfad8[_0xd028('0x45')]));if(_0x24808f['query'][_0xd028('0x50')]){_0x40419c[_0xd028('0x4e')]=_['merge'](_0x40419c['where'],{'$or':_[_0xd028('0x42')](_0x40419c[_0xd028('0x47')],function(_0x2e153f){var _0xdeaeda={};_0xdeaeda[_0x2e153f]={'$like':'%'+_0x24808f['query'][_0xd028('0x50')]+'%'};return _0xdeaeda;})});}_0x40419c=_['merge']({},_0x40419c,_0x24808f[_0xd028('0x68')]);return _0x1e9183['getAgents'](_0x40419c);}})['then'](function(_0x4995bc){if(_0x4995bc){_0x35c6ad=_0x4995bc['length'];if(!_0x24808f[_0xd028('0x43')][_0xd028('0x4a')](_0xd028('0x4b'))){_0x40419c[_0xd028('0x2d')]=qs[_0xd028('0x2d')](_0x24808f['query'][_0xd028('0x2d')]);_0x40419c['offset']=qs[_0xd028('0x2c')](_0x24808f['query'][_0xd028('0x2c')]);}return _0x1e9183['getAgents'](_0x40419c);}})[_0xd028('0x1e')](function(_0x31872a){if(_0x31872a){return _0x31872a?{'count':_0x35c6ad,'rows':_0x31872a}:null;}})[_0xd028('0x1e')](respondWithResult(_0x307c56,null))[_0xd028('0x28')](handleError(_0x307c56,null));};exports['addApplications']=function(_0x37365e,_0x1db8ee){var _0x59bd89=_0x37365e[_0xd028('0x57')]['id'];var _0x2e0b61=_0x37365e[_0xd028('0x5c')];var _0x1fe216=0xc8;var _0x383379=null;return db[_0xd028('0x78')][_0xd028('0x79')]({'isolationLevel':db[_0xd028('0x78')][_0xd028('0x7a')][_0xd028('0x7b')][_0xd028('0x7c')]},function(_0x463c06){return db[_0xd028('0x3c')][_0xd028('0x67')]({'where':{'id':_0x59bd89},'transaction':_0x463c06})[_0xd028('0x1e')](function(_0x1d88f6){if(_0x1d88f6){return db[_0xd028('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0x59bd89},'transaction':_0x463c06})['then'](function(){var _0xa9517b=_['map'](_0x2e0b61,function(_0x5e3c32){_0x5e3c32[_0xd028('0x6b')]=_0x59bd89;return _0x5e3c32;});return db[_0xd028('0x7d')][_0xd028('0x7e')](_0xa9517b,{'transaction':_0x463c06});});}else{_0x1fe216=0x194;_0x383379=[];}});})['then'](function(){if(_0x1fe216!==0x194){return db[_0xd028('0x7d')][_0xd028('0x7f')]({'where':{'WhatsappAccountId':_0x59bd89},'order':_0xd028('0x80')})[_0xd028('0x1e')](function(_0xaa79fc){_0x383379=_0xaa79fc;});}})[_0xd028('0x28')](function(_0x5bb3e0){_0x1fe216=0x1f4;logger['error'](_0x5bb3e0[_0xd028('0x81')]);if(_0x5bb3e0[_0xd028('0x39')]){delete _0x5bb3e0['name'];}_0x383379=_0x5bb3e0;})[_0xd028('0x82')](function(){if(_0x383379===null){_0x1db8ee[_0xd028('0x29')](_0x1fe216);}else{if(_0x1fe216===0x1f4){_0x1db8ee[_0xd028('0x2a')](_0x1fe216)[_0xd028('0x83')](_0x383379);}else{_0x1db8ee[_0xd028('0x2a')](_0x1fe216)['json'](_0x383379);}}});};exports['getApplications']=function(_0x451581,_0x6aba32,_0x2e92ed){var _0x321193={};var _0x3a1449={};var _0x2e0ebc;var _0x172b79;return db['WhatsappAccount'][_0xd028('0x67')]({'where':{'id':_0x451581['params']['id']}})[_0xd028('0x1e')](handleEntityNotFound(_0x6aba32,null))['then'](function(_0x565396){if(_0x565396){_0x2e0ebc=_0x565396;_0x3a1449[_0xd028('0x41')]=_['keys'](db[_0xd028('0x7d')][_0xd028('0x3d')]);_0x3a1449[_0xd028('0x43')]=_[_0xd028('0x44')](_0x451581[_0xd028('0x43')]);_0x3a1449[_0xd028('0x45')]=_['intersection'](_0x3a1449['model'],_0x3a1449[_0xd028('0x43')]);_0x321193['attributes']=_[_0xd028('0x46')](_0x3a1449[_0xd028('0x41')],qs[_0xd028('0x48')](_0x451581[_0xd028('0x43')][_0xd028('0x48')]));_0x321193[_0xd028('0x47')]=_0x321193[_0xd028('0x47')][_0xd028('0x49')]?_0x321193['attributes']:_0x3a1449[_0xd028('0x41')];_0x321193[_0xd028('0x4c')]=qs['sort'](_0x451581[_0xd028('0x43')][_0xd028('0x4d')]);_0x321193[_0xd028('0x4e')]=qs[_0xd028('0x45')](_[_0xd028('0x4f')](_0x451581[_0xd028('0x43')],_0x3a1449[_0xd028('0x45')]));if(_0x451581[_0xd028('0x43')][_0xd028('0x50')]){_0x321193[_0xd028('0x4e')]=_[_0xd028('0x51')](_0x321193[_0xd028('0x4e')],{'$or':_[_0xd028('0x42')](_0x321193[_0xd028('0x47')],function(_0x2fe390){var _0x45ad42={};_0x45ad42[_0x2fe390]={'$like':'%'+_0x451581[_0xd028('0x43')][_0xd028('0x50')]+'%'};return _0x45ad42;})});}_0x321193=_[_0xd028('0x51')]({},_0x321193,_0x451581[_0xd028('0x68')]);return _0x2e0ebc[_0xd028('0x84')](_0x321193);}})[_0xd028('0x1e')](function(_0x15e5c5){if(_0x15e5c5){_0x172b79=_0x15e5c5[_0xd028('0x49')];if(!_0x451581['query'][_0xd028('0x4a')](_0xd028('0x4b'))){_0x321193[_0xd028('0x2d')]=qs[_0xd028('0x2d')](_0x451581[_0xd028('0x43')]['limit']);_0x321193[_0xd028('0x2c')]=qs['offset'](_0x451581[_0xd028('0x43')]['offset']);}return _0x2e0ebc[_0xd028('0x84')](_0x321193);}})[_0xd028('0x1e')](function(_0x26985b){if(_0x26985b){return _0x26985b?{'count':_0x172b79,'rows':_0x26985b}:null;}})[_0xd028('0x1e')](respondWithResult(_0x6aba32,null))[_0xd028('0x28')](handleError(_0x6aba32,null));};exports[_0xd028('0x85')]=function(_0x4fe212,_0x2d851f,_0x3d3a64){var _0x158a6a={'channel':_0xd028('0x86')};var _0x30e117=[];var _0x1256f9=[];var _0x3c898e={};return db['WhatsappAccount'][_0xd028('0x5a')]({'where':{'id':_0x4fe212[_0xd028('0x57')]['id']},'include':[{'model':db[_0xd028('0x7d')],'as':'Applications'}]})[_0xd028('0x1e')](handleEntityNotFound(_0x2d851f,null))['then'](function(_0x1b224b){_0x158a6a[_0xd028('0x87')]=_0x1b224b;if(_0x158a6a[_0xd028('0x87')]&&_0x158a6a[_0xd028('0x87')][_0xd028('0x3f')]===_0xd028('0x88')&&_0x4fe212[_0xd028('0x5c')][_0xd028('0x89')]){if(_0x4fe212[_0xd028('0x5c')][_0xd028('0x89')][_0xd028('0x49')]===0x0)return;if(_0x4fe212['body']['statuses'][0x0][_0xd028('0x8a')]!==_0xd028('0x8b'))return;return db[_0xd028('0x8c')]['update']({'read':!![],'readAt':_0x4fe212['body'][_0xd028('0x89')][0x0][_0xd028('0x8d')]},{'where':{'messageId':_0x4fe212[_0xd028('0x5c')][_0xd028('0x89')][0x0][_0xd028('0x8e')]},'individualHooks':!![]})[_0xd028('0x1e')](function(_0x354837){return _0x2d851f[_0xd028('0x2a')](0xc8)[_0xd028('0x32')](_0x354837);});}_0x158a6a[_0xd028('0x8f')]=_[_0xd028('0x90')](_0x1b224b['Applications'],[_0xd028('0x80')],[_0xd028('0x91')]);if(_0x158a6a[_0xd028('0x87')][_0xd028('0x92')]){delete _0x158a6a['account'][_0xd028('0x92')];}return db[_0xd028('0x93')][_0xd028('0x63')]()['then'](function(_0x18491a){if(!_0x18491a){throw new db[(_0xd028('0x94'))]['ValidationError'](_0xd028('0x95'));}_0x30e117=_['difference'](_[_0xd028('0x44')](_0x18491a),[_0xd028('0x96'),_0xd028('0x97')]);_0x1256f9=_[_0xd028('0x98')](_[_0xd028('0x44')](_0x18491a),[_0xd028('0x96'),_0xd028('0x97'),_0xd028('0x99'),_0xd028('0x9a')]);_0x158a6a[_0xd028('0x5c')]={'mapKey':'mobile'};if(_0x158a6a['account']&&_0x158a6a['account']['type']===_0xd028('0x9b')){_0x158a6a[_0xd028('0x5c')][_0xd028('0x9c')]=_0x4fe212[_0xd028('0x5c')][_0xd028('0x9d')][_0xd028('0x9e')](_0xd028('0x9f'),'');_0x158a6a[_0xd028('0x5c')][_0xd028('0x5c')]=_0x4fe212[_0xd028('0x5c')][_0xd028('0xa0')];_0x158a6a[_0xd028('0x5c')][_0xd028('0xa1')]=_0x4fe212[_0xd028('0x5c')][_0xd028('0xa2')];}if(_0x158a6a[_0xd028('0x87')]&&_0x158a6a['account'][_0xd028('0x3f')]===_0xd028('0x88')){_0x158a6a[_0xd028('0x5c')][_0xd028('0x9c')]=_0x4fe212[_0xd028('0x5c')][_0xd028('0xa3')][0x0][_0xd028('0x9c')];_0x158a6a[_0xd028('0x5c')][_0xd028('0x5c')]=_0x4fe212[_0xd028('0x5c')][_0xd028('0xa3')][0x0][_0xd028('0x25')][_0xd028('0x5c')];_0x158a6a[_0xd028('0x5c')][_0xd028('0xa1')]=_0x4fe212[_0xd028('0x5c')][_0xd028('0xa3')][0x0]['message_id'];}if(_0x158a6a[_0xd028('0x5c')]['id']){delete _0x158a6a[_0xd028('0x5c')]['id'];}if(_[_0xd028('0xa4')](_0x158a6a[_0xd028('0x5c')]['from'])){throw new db[(_0xd028('0x94'))]['ValidationError'](_0xd028('0xa5'));}if(_[_0xd028('0xa4')](_0x158a6a[_0xd028('0x5c')][_0xd028('0x5c')])||_0x158a6a[_0xd028('0x5c')]['body']===''){throw new db[(_0xd028('0x94'))][(_0xd028('0xa6'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd028('0xa4')](_0x158a6a['body']['mapKey'])){throw new db[(_0xd028('0x94'))][(_0xd028('0xa6'))](_0xd028('0xa7')+_0x1256f9);}if(!_['includes'](_0x1256f9,_0x158a6a[_0xd028('0x5c')][_0xd028('0xa8')])){throw new db[(_0xd028('0x94'))][(_0xd028('0xa6'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1256f9);}_0x3c898e[_0x158a6a[_0xd028('0x5c')]['mapKey']]=_0x158a6a[_0xd028('0x5c')][_0xd028('0x9c')];return db[_0xd028('0xa9')][_0xd028('0x5a')]({'where':{'id':_0x158a6a['account'][_0xd028('0x9a')]},'include':[{'model':db[_0xd028('0x93')],'as':_0xd028('0xaa'),'where':_0x3c898e,'limit':0x1,'order':[[_0xd028('0x97'),_0xd028('0xab')]]}]});})['then'](handleEntityNotFound(_0x2d851f,null))[_0xd028('0x1e')](function(_0x19104e){if(_0x19104e){_0x158a6a[_0xd028('0xac')]=_[_0xd028('0x70')](_0x19104e,['Contacts']);if(_0x19104e['Contacts'][_0xd028('0x49')]){return _0x19104e[_0xd028('0xaa')][0x0];}var _0x287266=_[_0xd028('0xad')](_0x158a6a[_0xd028('0x5c')],{'firstName':_0x158a6a[_0xd028('0x5c')]['from'],'ListId':_0x19104e['id']});_0x287266[_0x158a6a[_0xd028('0x5c')]['mapKey']]=_0x158a6a['body'][_0xd028('0x9c')];return db[_0xd028('0x93')][_0xd028('0x5b')](_0x287266,{'fields':_0x30e117,'raw':!![]});}})[_0xd028('0x1e')](handleEntityNotFound(_0x2d851f,null))[_0xd028('0x1e')](function(_0x278fa7){if(_0x278fa7){_0x158a6a[_0xd028('0xae')]=_0x278fa7;var _0x3466ce={'ContactId':_0x278fa7['id'],'phone':_0x158a6a[_0xd028('0x5c')][_0xd028('0x9c')],'WhatsappAccountId':_0x4fe212[_0xd028('0x57')]['id']};var _0x105fb8={'ContactId':_0x278fa7['id'],'WhatsappAccountId':_0x4fe212[_0xd028('0x57')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xd028('0x5a')]({'where':_0x105fb8})[_0xd028('0x1e')](function(_0x3f0c6e){if(_0x3f0c6e){return[_0x3f0c6e,![]];}return db[_0xd028('0xaf')][_0xd028('0x5b')](_0x3466ce)[_0xd028('0x1e')](function(_0x497baf){return[_0x497baf,!![]];});});}})[_0xd028('0x71')](function(_0x9cbd87,_0xf0efe5){_0x158a6a[_0xd028('0xb0')]=_0x9cbd87[_0xd028('0x36')]({'plain':!![]});_0x158a6a[_0xd028('0xb0')]['created']=![];if(_0xf0efe5){if(_0x158a6a[_0xd028('0x87')][_0xd028('0xb1')]){_0x158a6a['applications'][_0xd028('0xb2')]({'id':0x0,'priority':_0x158a6a[_0xd028('0x8f')][_0xd028('0x49')]+0x1,'app':_0xd028('0xb3'),'appdata':_0xd028('0xb4'),'interval':_0xd028('0xb5')});}_0x158a6a['interaction'][_0xd028('0xb6')]=!![];}return db[_0xd028('0x8c')][_0xd028('0x5b')]({'phone':_0x158a6a[_0xd028('0x5c')][_0xd028('0x9c')],'messageId':_0x158a6a[_0xd028('0x5c')][_0xd028('0xa1')],'body':_0x158a6a[_0xd028('0x5c')][_0xd028('0x5c')],'WhatsappAccountId':_0x4fe212['params']['id'],'WhatsappInteractionId':_0x9cbd87['id'],'direction':'in','ContactId':_0x9cbd87[_0xd028('0xb7')],'AttachmentId':_0x158a6a[_0xd028('0x5c')][_0xd028('0xb8')]});})[_0xd028('0x1e')](function(_0x160be2){_0x158a6a[_0xd028('0x25')]=_0x160be2;if(_0x158a6a[_0xd028('0xb0')][_0xd028('0xb9')]){return db[_0xd028('0x77')][_0xd028('0x5a')]({'attributes':['id','name'],'where':{'id':_0x158a6a[_0xd028('0xb0')][_0xd028('0xb9')]}})[_0xd028('0x1e')](function(_0x218e44){if(_0x218e44){_0x158a6a[_0xd028('0x8f')][_0xd028('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x218e44[_0xd028('0x39')]+','+(_0x158a6a[_0xd028('0x87')][_0xd028('0xbb')]||0xa),'interval':_0xd028('0xb5')});}return respondWithRpcPromise(_0xd028('0xbc'),'startRouting',_0x158a6a);});}return respondWithRpcPromise(_0xd028('0xbc'),'startRouting',_0x158a6a);})[_0xd028('0x1e')](function(_0x32c0ef){if(_0x32c0ef){var _0x624a7=0xc8;var _0x129f9e=_0xd028('0xbd');logger[_0xd028('0xbe')](_0xd028('0x21'),_0x129f9e,_0x624a7,_0xd028('0xbf'));logger[_0xd028('0x20')](_0xd028('0xc0'),_0x129f9e,_0x624a7,'entity\x20found',JSON[_0xd028('0x22')](_0x32c0ef));if(_0x158a6a[_0xd028('0x87')]['type']===_0xd028('0x9b')){return _0x2d851f[_0xd028('0x2a')](_0x624a7)[_0xd028('0x30')](_0xd028('0xc1'),_0xd028('0xc2'))['send']('\x0a');}else{return _0x2d851f[_0xd028('0x2a')](_0x624a7)[_0xd028('0x32')](_0x32c0ef);}}});})[_0xd028('0x28')](handleError(_0x2d851f,null));};exports[_0xd028('0x83')]=function(_0x11b869,_0x4385ea,_0x26dea8){var _0x3903b0,_0x1ecbd8,_0x5826b8;if(_[_0xd028('0xa4')](_0x11b869['body'][_0xd028('0x5c')])||_0x11b869[_0xd028('0x5c')][_0xd028('0x5c')]===''){throw new db[(_0xd028('0x94'))][(_0xd028('0xa6'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd028('0xa4')](_0x11b869['body']['to'])){throw new db[(_0xd028('0x94'))][(_0xd028('0xa6'))](_0xd028('0xc3'));}_0x3903b0=_0x11b869[_0xd028('0x5c')]['to'];return db[_0xd028('0x3c')]['find']({'where':{'id':_0x11b869[_0xd028('0x57')]['id']},'include':[{'model':db[_0xd028('0xa9')],'as':_0xd028('0xc4'),'include':[{'model':db[_0xd028('0x93')],'as':_0xd028('0xaa'),'where':{'mobile':_0x3903b0},'limit':0x1,'order':[[_0xd028('0x97'),_0xd028('0xab')]]}]}]})[_0xd028('0x1e')](handleEntityNotFound(_0x4385ea,null))[_0xd028('0x1e')](function(_0x2f3251){if(_0x2f3251&&_0x2f3251['List']){_0x1ecbd8=_0x2f3251[_0xd028('0x36')]({'plain':!![]});if(_0x1ecbd8[_0xd028('0xc4')]&&_0x1ecbd8[_0xd028('0xc4')][_0xd028('0xaa')][_0xd028('0x49')]){return _0x1ecbd8[_0xd028('0xc4')][_0xd028('0xaa')][0x0];}return db['CmContact'][_0xd028('0x5b')](_[_0xd028('0xad')](_0x11b869['body'],{'firstName':_0x3903b0,'mobile':_0x3903b0,'phone':_0x3903b0,'ListId':_0x1ecbd8[_0xd028('0x9a')]}));}})['then'](handleEntityNotFound(_0x4385ea,null))['then'](function(_0x3e362b){if(_0x3e362b){_0x5826b8=_0x3e362b;return db[_0xd028('0xaf')][_0xd028('0x5a')]({'where':{'ContactId':_0x5826b8['id'],'closed':![],'WhatsappAccountId':_0x1ecbd8['id']}})[_0xd028('0x1e')](function(_0x3c5dd4){if(_0x3c5dd4){return[_0x3c5dd4,![]];}return db[_0xd028('0xaf')][_0xd028('0x5b')]({'UserId':_0x11b869[_0xd028('0x5d')]['id'],'ContactId':_0x5826b8['id'],'WhatsappAccountId':_0x1ecbd8['id'],'phone':_0x3903b0,'firstMsgDirection':_0xd028('0xc5'),'Messages':[_[_0xd028('0x51')](_0x11b869[_0xd028('0x5c')],{'read':![],'body':_0x11b869[_0xd028('0x5c')][_0xd028('0x5c')],'phone':_0x3903b0,'WhatsappAccountId':_0x1ecbd8['id'],'UserId':_0x11b869[_0xd028('0x5d')]['id'],'ContactId':_0x5826b8['id']})]},{'include':[{'model':db[_0xd028('0x8c')],'as':_0xd028('0xc6')}]})[_0xd028('0x1e')](function(_0x192bf7){return[_0x192bf7,!![]];});});}})[_0xd028('0x71')](function(_0x42c538,_0x162194){if(_0x162194){return _0x42c538;}return db['WhatsappMessage']['create'](_['merge'](_0x11b869[_0xd028('0x5c')],{'read':![],'body':_0x11b869[_0xd028('0x5c')][_0xd028('0x5c')],'phone':_0x3903b0,'WhatsappAccountId':_0x1ecbd8['id'],'WhatsappInteractionId':_0x42c538['id'],'UserId':_0x11b869[_0xd028('0x5d')]['id'],'ContactId':_0x5826b8['id']}))[_0xd028('0x1e')](function(_0x333b50){_0x42c538['dataValues']['Messages']=[];_0x42c538[_0xd028('0xc7')][_0xd028('0xc6')][_0xd028('0xb2')](_0x333b50[_0xd028('0xc7')]);return _0x42c538;});})[_0xd028('0x1e')](respondWithResult(_0x4385ea,null))['catch'](handleError(_0x4385ea,null));}; \ No newline at end of file +var _0xcf3c=['jsforce','desk.js','querystring','ioredis','../../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','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','apply','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','Pause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','WhatsappMessage','update','message_id','priority','CmContact','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','applications','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf3c,0x176));var _0xccf3=function(_0x2e9c4d,_0x26fb9d){_0x2e9c4d=_0x2e9c4d-0x0;var _0x17e7f3=_0xcf3c[_0x2e9c4d];return _0x17e7f3;};'use strict';var emlformat=require(_0xccf3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccf3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xccf3('0x2'));var Mustache=require(_0xccf3('0x3'));var util=require(_0xccf3('0x4'));var path=require(_0xccf3('0x5'));var sox=require(_0xccf3('0x6'));var csv=require(_0xccf3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccf3('0x8'));var squel=require(_0xccf3('0x9'));var crypto=require('crypto');var jsforce=require(_0xccf3('0xa'));var deskjs=require(_0xccf3('0xb'));var toCsv=require(_0xccf3('0x7'));var querystring=require(_0xccf3('0xc'));var Papa=require('papaparse');var Redis=require(_0xccf3('0xd'));var authService=require(_0xccf3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xccf3('0xf'));var hardwareService=require(_0xccf3('0x10'));var logger=require(_0xccf3('0x11'))(_0xccf3('0x12'));var utils=require(_0xccf3('0x13'));var config=require(_0xccf3('0x14'));var licenseUtil=require(_0xccf3('0x15'));var db=require(_0xccf3('0x16'))['db'];config[_0xccf3('0x17')]=_[_0xccf3('0x18')](config['redis'],{'host':_0xccf3('0x19'),'port':0x18eb});var socket=require(_0xccf3('0x1a'))(new Redis(config[_0xccf3('0x17')]));require(_0xccf3('0x1b'))[_0xccf3('0x1c')](socket);var jayson=require(_0xccf3('0x1d'));var client=jayson[_0xccf3('0x1e')][_0xccf3('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x343fc5,_0x21ac12,_0x30783f,_0x67f6b2){return new BPromise(function(_0x253538,_0x1678ea){var _0xb2c9d2=_0x67f6b2||client;return _0xb2c9d2[_0xccf3('0x20')](_0x343fc5,_0x30783f)[_0xccf3('0x21')](function(_0x59aabd){logger[_0xccf3('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x21ac12,_0xccf3('0x23'));logger['debug'](_0xccf3('0x24'),_0x21ac12,_0xccf3('0x23'),JSON[_0xccf3('0x25')](_0x59aabd));if(_0x59aabd[_0xccf3('0x26')]){if(_0x59aabd['error'][_0xccf3('0x27')]===0x1f4){logger[_0xccf3('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x21ac12,_0x59aabd[_0xccf3('0x26')]['message']);return _0x1678ea(_0x59aabd['error']['message']);}logger[_0xccf3('0x26')](_0xccf3('0x28'),_0x21ac12,_0x59aabd[_0xccf3('0x26')][_0xccf3('0x29')]);return _0x253538(_0x59aabd[_0xccf3('0x26')][_0xccf3('0x29')]);}else{logger[_0xccf3('0x22')](_0xccf3('0x28'),_0x21ac12,_0xccf3('0x23'));_0x253538(_0x59aabd[_0xccf3('0x2a')][_0xccf3('0x29')]);}})[_0xccf3('0x2b')](function(_0x317450){logger[_0xccf3('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x21ac12,_0x317450);_0x1678ea(_0x317450);});});}function respondWithStatusCode(_0x4a5eb8,_0x2fc489){_0x2fc489=_0x2fc489||0xcc;return function(_0x406f6e){if(_0x406f6e){return _0x4a5eb8['sendStatus'](_0x2fc489);}return _0x4a5eb8[_0xccf3('0x2c')](_0x2fc489)[_0xccf3('0x2d')]();};}function respondWithResult(_0x334f4a,_0x43a1a1){_0x43a1a1=_0x43a1a1||0xc8;return function(_0x3b6467){if(_0x3b6467){return _0x334f4a[_0xccf3('0x2c')](_0x43a1a1)[_0xccf3('0x2e')](_0x3b6467);}};}function respondWithFilteredResult(_0x321cea,_0x25819a){return function(_0x5aff4a){if(_0x5aff4a){var _0x223dd0=typeof _0x25819a['offset']===_0xccf3('0x2f')&&typeof _0x25819a[_0xccf3('0x30')]===_0xccf3('0x2f');var _0x38f2ae=_0x5aff4a[_0xccf3('0x31')];var _0x2cfa4f=_0x223dd0?0x0:_0x25819a[_0xccf3('0x32')];var _0x4904af=_0x223dd0?_0x5aff4a['count']:_0x25819a[_0xccf3('0x32')]+_0x25819a['limit'];var _0x4c92f8;if(_0x4904af>=_0x38f2ae){_0x4904af=_0x38f2ae;_0x4c92f8=0xc8;}else{_0x4c92f8=0xce;}_0x321cea[_0xccf3('0x2c')](_0x4c92f8);return _0x321cea[_0xccf3('0x33')]('Content-Range',_0x2cfa4f+'-'+_0x4904af+'/'+_0x38f2ae)[_0xccf3('0x2e')](_0x5aff4a);}return null;};}function patchUpdates(_0x2e9c53){return function(_0x3ffcfe){try{jsonpatch[_0xccf3('0x34')](_0x3ffcfe,_0x2e9c53,!![]);}catch(_0x28c485){return BPromise['reject'](_0x28c485);}return _0x3ffcfe['save']();};}function saveUpdates(_0x1fffe2,_0x51b9da){return function(_0x42694){if(_0x42694){return _0x42694['update'](_0x1fffe2)[_0xccf3('0x21')](function(_0x277521){return _0x277521;});}return null;};}function removeEntity(_0x36fa32,_0x23243a){return function(_0x495922){if(_0x495922){return _0x495922[_0xccf3('0x35')]()[_0xccf3('0x21')](function(){var _0x20bdd2=_0x495922['get']({'plain':!![]});var _0xbe2861=_0xccf3('0x36');return db[_0xccf3('0x37')][_0xccf3('0x35')]({'where':{'type':_0xbe2861,'resourceId':_0x20bdd2['id']}})[_0xccf3('0x21')](function(){return _0x495922;});})[_0xccf3('0x21')](function(){_0x36fa32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59bce6,_0xf2084b){return function(_0x1b812e){if(!_0x1b812e){_0x59bce6[_0xccf3('0x38')](0x194);}return _0x1b812e;};}function handleError(_0x4b210f,_0x53f8c1){_0x53f8c1=_0x53f8c1||0x1f4;return function(_0x2a5f05){logger[_0xccf3('0x26')](_0x2a5f05[_0xccf3('0x39')]);if(_0x2a5f05['name']){delete _0x2a5f05[_0xccf3('0x3a')];}_0x4b210f[_0xccf3('0x2c')](_0x53f8c1)['send'](_0x2a5f05);};}exports['index']=function(_0x53e9d0,_0x388581){var _0x1c65e9={'include':[{'model':db['Pause'],'as':_0xccf3('0x3b')}]},_0x25e04d={},_0x313767={'count':0x0,'rows':[]};var _0x4027bc=_[_0xccf3('0x3c')](db[_0xccf3('0x3d')][_0xccf3('0x3e')],function(_0x45c5e7){return{'name':_0x45c5e7[_0xccf3('0x3f')],'type':_0x45c5e7[_0xccf3('0x40')][_0xccf3('0x41')]};});_0x25e04d[_0xccf3('0x42')]=_[_0xccf3('0x3c')](_0x4027bc,_0xccf3('0x3a'));_0x25e04d[_0xccf3('0x43')]=_[_0xccf3('0x44')](_0x53e9d0[_0xccf3('0x43')]);_0x25e04d[_0xccf3('0x45')]=_[_0xccf3('0x46')](_0x25e04d[_0xccf3('0x42')],_0x25e04d['query']);_0x1c65e9[_0xccf3('0x47')]=_[_0xccf3('0x46')](_0x25e04d[_0xccf3('0x42')],qs['fields'](_0x53e9d0[_0xccf3('0x43')][_0xccf3('0x48')]));_0x1c65e9[_0xccf3('0x47')]=_0x1c65e9[_0xccf3('0x47')][_0xccf3('0x49')]?_0x1c65e9['attributes']:_0x25e04d[_0xccf3('0x42')];if(!_0x53e9d0['query'][_0xccf3('0x4a')](_0xccf3('0x4b'))){_0x1c65e9[_0xccf3('0x30')]=qs[_0xccf3('0x30')](_0x53e9d0[_0xccf3('0x43')]['limit']);_0x1c65e9['offset']=qs[_0xccf3('0x32')](_0x53e9d0[_0xccf3('0x43')][_0xccf3('0x32')]);}_0x1c65e9[_0xccf3('0x4c')]=qs[_0xccf3('0x4d')](_0x53e9d0[_0xccf3('0x43')][_0xccf3('0x4d')]);_0x1c65e9[_0xccf3('0x4e')]=qs[_0xccf3('0x45')](_[_0xccf3('0x4f')](_0x53e9d0[_0xccf3('0x43')],_0x25e04d[_0xccf3('0x45')]),_0x4027bc);if(_0x53e9d0['query'][_0xccf3('0x50')]){_0x1c65e9[_0xccf3('0x4e')]=_[_0xccf3('0x51')](_0x1c65e9['where'],{'$or':_['map'](_0x4027bc,function(_0x36c304){if(_0x36c304[_0xccf3('0x40')]!=='VIRTUAL'){var _0x10b5f2={};_0x10b5f2[_0x36c304[_0xccf3('0x3a')]]={'$like':'%'+_0x53e9d0[_0xccf3('0x43')]['filter']+'%'};return _0x10b5f2;}})});}_0x1c65e9=_[_0xccf3('0x51')]({},_0x1c65e9,_0x53e9d0[_0xccf3('0x52')]);var _0x13ca9f={'where':_0x1c65e9[_0xccf3('0x4e')]};return db[_0xccf3('0x3d')][_0xccf3('0x31')](_0x13ca9f)[_0xccf3('0x21')](function(_0x5b3f39){_0x313767['count']=_0x5b3f39;if(_0x53e9d0[_0xccf3('0x43')][_0xccf3('0x53')]){_0x1c65e9[_0xccf3('0x54')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xccf3('0x55')](_0x1c65e9);})[_0xccf3('0x21')](function(_0x91cf2d){_0x313767[_0xccf3('0x56')]=_0x91cf2d;return _0x313767;})[_0xccf3('0x21')](respondWithFilteredResult(_0x388581,_0x1c65e9))[_0xccf3('0x2b')](handleError(_0x388581,null));};exports[_0xccf3('0x57')]=function(_0x41ab1a,_0x541fea){var _0x299223={'raw':![],'where':{'id':_0x41ab1a[_0xccf3('0x58')]['id']},'include':[{'model':db[_0xccf3('0x59')],'as':_0xccf3('0x3b')}]},_0x4bcf03={};_0x4bcf03[_0xccf3('0x42')]=_[_0xccf3('0x44')](db[_0xccf3('0x3d')][_0xccf3('0x3e')]);_0x4bcf03['query']=_[_0xccf3('0x44')](_0x41ab1a[_0xccf3('0x43')]);_0x4bcf03[_0xccf3('0x45')]=_[_0xccf3('0x46')](_0x4bcf03[_0xccf3('0x42')],_0x4bcf03[_0xccf3('0x43')]);_0x299223[_0xccf3('0x47')]=_['intersection'](_0x4bcf03[_0xccf3('0x42')],qs[_0xccf3('0x48')](_0x41ab1a[_0xccf3('0x43')][_0xccf3('0x48')]));_0x299223[_0xccf3('0x47')]=_0x299223['attributes'][_0xccf3('0x49')]?_0x299223[_0xccf3('0x47')]:_0x4bcf03[_0xccf3('0x42')];if(_0x41ab1a['query'][_0xccf3('0x53')]){_0x299223[_0xccf3('0x54')]=[{'all':!![]}];}_0x299223=_[_0xccf3('0x51')]({},_0x299223,_0x41ab1a[_0xccf3('0x52')]);return db['WhatsappAccount']['find'](_0x299223)[_0xccf3('0x21')](handleEntityNotFound(_0x541fea,null))['then'](respondWithResult(_0x541fea,null))[_0xccf3('0x2b')](handleError(_0x541fea,null));};exports[_0xccf3('0x5a')]=function(_0x142406,_0x33822b){return db['WhatsappAccount'][_0xccf3('0x5a')](_0x142406[_0xccf3('0x5b')],{})[_0xccf3('0x21')](function(_0x48fac2){var _0x53ff20=_0x142406[_0xccf3('0x5c')]['get']({'plain':!![]});if(!_0x53ff20)throw new Error(_0xccf3('0x5d'));if(_0x53ff20['role']===_0xccf3('0x5c')){var _0x1dc9e5=_0x48fac2[_0xccf3('0x5e')]({'plain':!![]});var _0xaf00ae='WhatsappAccounts';return db[_0xccf3('0x5f')][_0xccf3('0x60')]({'where':{'name':_0xaf00ae,'userProfileId':_0x53ff20['userProfileId']},'raw':!![]})['then'](function(_0x251da2){if(_0x251da2&&_0x251da2[_0xccf3('0x61')]===0x0){return db[_0xccf3('0x37')][_0xccf3('0x5a')]({'name':_0x1dc9e5[_0xccf3('0x3a')],'resourceId':_0x1dc9e5['id'],'type':_0x251da2[_0xccf3('0x3a')],'sectionId':_0x251da2['id']},{})[_0xccf3('0x21')](function(){return _0x48fac2;});}else{return _0x48fac2;}})[_0xccf3('0x2b')](function(_0x322a6b){logger['error'](_0xccf3('0x62'),_0x322a6b);throw _0x322a6b;});}return _0x48fac2;})[_0xccf3('0x21')](respondWithResult(_0x33822b,0xc9))[_0xccf3('0x2b')](handleError(_0x33822b,null));};exports['update']=function(_0x1068d1,_0x436780){if(_0x1068d1[_0xccf3('0x5b')]['id']){delete _0x1068d1[_0xccf3('0x5b')]['id'];}return db['WhatsappAccount'][_0xccf3('0x60')]({'where':{'id':_0x1068d1[_0xccf3('0x58')]['id']},'include':[{'model':db[_0xccf3('0x59')],'as':_0xccf3('0x3b')}]})[_0xccf3('0x21')](handleEntityNotFound(_0x436780,null))['then'](saveUpdates(_0x1068d1[_0xccf3('0x5b')],null))[_0xccf3('0x21')](respondWithResult(_0x436780,null))[_0xccf3('0x2b')](handleError(_0x436780,null));};exports['destroy']=function(_0x33828f,_0x5b034c){return db[_0xccf3('0x3d')][_0xccf3('0x60')]({'where':{'id':_0x33828f[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x5b034c,null))[_0xccf3('0x21')](removeEntity(_0x5b034c,null))['catch'](handleError(_0x5b034c,null));};exports[_0xccf3('0x63')]=function(_0x57db78,_0x7fce70){return db[_0xccf3('0x3d')][_0xccf3('0x63')]()[_0xccf3('0x21')](respondWithResult(_0x7fce70,null))[_0xccf3('0x2b')](handleError(_0x7fce70,null));};exports[_0xccf3('0x64')]=function(_0x2cb7d1,_0x406956,_0x2f0a9d){if(_0x2cb7d1[_0xccf3('0x5b')]['id']){delete _0x2cb7d1['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2cb7d1['params']['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x406956,null))[_0xccf3('0x21')](function(_0x335106){if(_0x335106){_0x2cb7d1['body'][_0xccf3('0x65')]=_0x335106['id'];return db['Disposition'][_0xccf3('0x5a')](_0x2cb7d1[_0xccf3('0x5b')]);}})[_0xccf3('0x21')](respondWithResult(_0x406956,null))[_0xccf3('0x2b')](handleError(_0x406956,null));};exports[_0xccf3('0x66')]=function(_0x50a3ef,_0x554bab,_0x33409e){var _0xf0320a={'raw':![],'where':{}};var _0xb8c04f={};var _0x4a7ed7={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xccf3('0x67')]({'where':{'id':_0x50a3ef[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x554bab,null))[_0xccf3('0x21')](function(_0x4d0883){if(_0x4d0883){_0xb8c04f[_0xccf3('0x42')]=_[_0xccf3('0x44')](db[_0xccf3('0x68')][_0xccf3('0x3e')]);_0xb8c04f['query']=_['keys'](_0x50a3ef[_0xccf3('0x43')]);_0xb8c04f['filters']=_[_0xccf3('0x46')](_0xb8c04f[_0xccf3('0x42')],_0xb8c04f[_0xccf3('0x43')]);_0xf0320a[_0xccf3('0x47')]=_[_0xccf3('0x46')](_0xb8c04f[_0xccf3('0x42')],qs[_0xccf3('0x48')](_0x50a3ef[_0xccf3('0x43')][_0xccf3('0x48')]));_0xf0320a[_0xccf3('0x47')]=_0xf0320a['attributes']['length']?_0xf0320a['attributes']:_0xb8c04f[_0xccf3('0x42')];if(!_0x50a3ef[_0xccf3('0x43')][_0xccf3('0x4a')](_0xccf3('0x4b'))){_0xf0320a[_0xccf3('0x30')]=qs['limit'](_0x50a3ef[_0xccf3('0x43')][_0xccf3('0x30')]);_0xf0320a[_0xccf3('0x32')]=qs[_0xccf3('0x32')](_0x50a3ef['query']['offset']);}_0xf0320a[_0xccf3('0x4c')]=qs[_0xccf3('0x4d')](_0x50a3ef[_0xccf3('0x43')][_0xccf3('0x4d')]);_0xf0320a[_0xccf3('0x4e')]=qs[_0xccf3('0x45')](_[_0xccf3('0x4f')](_0x50a3ef['query'],_0xb8c04f[_0xccf3('0x45')]));_0xf0320a[_0xccf3('0x4e')][_0xccf3('0x65')]=_0x4d0883['id'];if(_0x50a3ef[_0xccf3('0x43')][_0xccf3('0x50')]){_0xf0320a[_0xccf3('0x4e')]=_['merge'](_0xf0320a[_0xccf3('0x4e')],{'$or':_[_0xccf3('0x3c')](_0xf0320a[_0xccf3('0x47')],function(_0x191331){var _0x43acf0={};_0x43acf0[_0x191331]={'$like':'%'+_0x50a3ef[_0xccf3('0x43')]['filter']+'%'};return _0x43acf0;})});}_0xf0320a=_['merge']({},_0xf0320a,_0x50a3ef['options']);return db[_0xccf3('0x68')][_0xccf3('0x31')]({'where':_0xf0320a[_0xccf3('0x4e')]})[_0xccf3('0x21')](function(_0x144023){_0x4a7ed7['count']=_0x144023;if(_0x50a3ef[_0xccf3('0x43')][_0xccf3('0x53')]){_0xf0320a['include']=[{'all':!![]}];}return db[_0xccf3('0x68')]['findAll'](_0xf0320a);})['then'](function(_0x88727b){_0x4a7ed7[_0xccf3('0x56')]=_0x88727b;return _0x4a7ed7;});}})['then'](respondWithFilteredResult(_0x554bab,_0xf0320a))[_0xccf3('0x2b')](handleError(_0x554bab,null));};exports[_0xccf3('0x69')]=function(_0x5070eb,_0x2d0fd2,_0x183303){return db[_0xccf3('0x3d')]['find']({'where':{'id':_0x5070eb[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x2d0fd2,null))[_0xccf3('0x21')](function(_0x124a96){if(_0x124a96){return _0x124a96['removeDispositions'](_0x5070eb['query'][_0xccf3('0x6a')]);}})[_0xccf3('0x21')](respondWithStatusCode(_0x2d0fd2,null))[_0xccf3('0x2b')](handleError(_0x2d0fd2,null));};exports[_0xccf3('0x6b')]=function(_0xa2f80c,_0x105d64,_0x45d90d){if(_0xa2f80c['body']['id']){delete _0xa2f80c['body']['id'];}return db[_0xccf3('0x3d')][_0xccf3('0x60')]({'where':{'id':_0xa2f80c[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x105d64,null))[_0xccf3('0x21')](function(_0x1de786){if(_0x1de786){_0xa2f80c[_0xccf3('0x5b')][_0xccf3('0x65')]=_0x1de786['id'];return db[_0xccf3('0x6c')][_0xccf3('0x5a')](_0xa2f80c[_0xccf3('0x5b')]);}})[_0xccf3('0x21')](respondWithResult(_0x105d64,null))['catch'](handleError(_0x105d64,null));};exports[_0xccf3('0x6d')]=function(_0x344ffc,_0x42373e,_0x483542){var _0x1d401f={'raw':![],'where':{}};var _0x47f772={};var _0xcbf338={'count':0x0,'rows':[]};return db[_0xccf3('0x3d')][_0xccf3('0x67')]({'where':{'id':_0x344ffc[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x42373e,null))[_0xccf3('0x21')](function(_0x1f611d){if(_0x1f611d){_0x47f772[_0xccf3('0x42')]=_[_0xccf3('0x44')](db[_0xccf3('0x6c')][_0xccf3('0x3e')]);_0x47f772[_0xccf3('0x43')]=_[_0xccf3('0x44')](_0x344ffc[_0xccf3('0x43')]);_0x47f772['filters']=_[_0xccf3('0x46')](_0x47f772['model'],_0x47f772['query']);_0x1d401f[_0xccf3('0x47')]=_[_0xccf3('0x46')](_0x47f772[_0xccf3('0x42')],qs[_0xccf3('0x48')](_0x344ffc['query'][_0xccf3('0x48')]));_0x1d401f[_0xccf3('0x47')]=_0x1d401f[_0xccf3('0x47')][_0xccf3('0x49')]?_0x1d401f[_0xccf3('0x47')]:_0x47f772['model'];if(!_0x344ffc[_0xccf3('0x43')][_0xccf3('0x4a')](_0xccf3('0x4b'))){_0x1d401f['limit']=qs[_0xccf3('0x30')](_0x344ffc[_0xccf3('0x43')][_0xccf3('0x30')]);_0x1d401f[_0xccf3('0x32')]=qs[_0xccf3('0x32')](_0x344ffc[_0xccf3('0x43')][_0xccf3('0x32')]);}_0x1d401f[_0xccf3('0x4c')]=qs[_0xccf3('0x4d')](_0x344ffc[_0xccf3('0x43')]['sort']);_0x1d401f[_0xccf3('0x4e')]=qs[_0xccf3('0x45')](_[_0xccf3('0x4f')](_0x344ffc[_0xccf3('0x43')],_0x47f772[_0xccf3('0x45')]));_0x1d401f['where'][_0xccf3('0x65')]=_0x1f611d['id'];if(_0x344ffc['query'][_0xccf3('0x50')]){_0x1d401f[_0xccf3('0x4e')]=_[_0xccf3('0x51')](_0x1d401f[_0xccf3('0x4e')],{'$or':_[_0xccf3('0x3c')](_0x1d401f[_0xccf3('0x47')],function(_0x1e6ddb){var _0x4a44fd={};_0x4a44fd[_0x1e6ddb]={'$like':'%'+_0x344ffc[_0xccf3('0x43')][_0xccf3('0x50')]+'%'};return _0x4a44fd;})});}_0x1d401f=_[_0xccf3('0x51')]({},_0x1d401f,_0x344ffc[_0xccf3('0x52')]);return db[_0xccf3('0x6c')][_0xccf3('0x31')]({'where':_0x1d401f[_0xccf3('0x4e')]})[_0xccf3('0x21')](function(_0x3ae65e){_0xcbf338[_0xccf3('0x31')]=_0x3ae65e;if(_0x344ffc[_0xccf3('0x43')][_0xccf3('0x53')]){_0x1d401f['include']=[{'all':!![]}];}return db[_0xccf3('0x6c')]['findAll'](_0x1d401f);})[_0xccf3('0x21')](function(_0x5a6719){_0xcbf338[_0xccf3('0x56')]=_0x5a6719;return _0xcbf338;});}})[_0xccf3('0x21')](respondWithFilteredResult(_0x42373e,_0x1d401f))[_0xccf3('0x2b')](handleError(_0x42373e,null));};exports['removeAnswers']=function(_0x42406a,_0x3bc617,_0x4d5ac9){return db[_0xccf3('0x3d')][_0xccf3('0x60')]({'where':{'id':_0x42406a[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x3bc617,null))[_0xccf3('0x21')](function(_0x9c34e9){if(_0x9c34e9){return _0x9c34e9[_0xccf3('0x6e')](_0x42406a['query'][_0xccf3('0x6a')]);}})[_0xccf3('0x21')](respondWithStatusCode(_0x3bc617,null))[_0xccf3('0x2b')](handleError(_0x3bc617,null));};exports['addAgents']=function(_0x4c4631,_0x536103,_0x1e3404){return db[_0xccf3('0x3d')][_0xccf3('0x60')]({'where':{'id':_0x4c4631[_0xccf3('0x58')]['id']}})['then'](handleEntityNotFound(_0x536103,null))[_0xccf3('0x21')](function(_0x491f1b){if(_0x491f1b){return _0x491f1b['addAgents'](_0x4c4631[_0xccf3('0x5b')][_0xccf3('0x6a')],_[_0xccf3('0x6f')](_0x4c4631[_0xccf3('0x5b')],[_0xccf3('0x6a'),'id'])||{})[_0xccf3('0x70')](function(_0x98bfaf){for(var _0x525588=0x0;_0x525588<_0x4c4631[_0xccf3('0x5b')]['ids'][_0xccf3('0x49')];_0x525588+=0x1){socket[_0xccf3('0x71')](_0xccf3('0x72'),{'UserId':Number(_0x4c4631[_0xccf3('0x5b')]['ids'][_0x525588]),'WhatsappAccountId':Number(_0x4c4631[_0xccf3('0x58')]['id'])});}return _0x98bfaf;});}})[_0xccf3('0x21')](respondWithResult(_0x536103,null))[_0xccf3('0x2b')](handleError(_0x536103,null));};exports[_0xccf3('0x73')]=function(_0x12d545,_0x4c9d,_0x4e5855){return db[_0xccf3('0x3d')][_0xccf3('0x60')]({'where':{'id':_0x12d545[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x4c9d,null))[_0xccf3('0x21')](function(_0x593387){if(_0x593387){return _0x593387[_0xccf3('0x73')](_0x12d545['query'][_0xccf3('0x6a')])[_0xccf3('0x21')](function(){if(_[_0xccf3('0x74')](_0x12d545[_0xccf3('0x43')][_0xccf3('0x6a')])){for(var _0x36900a=0x0;_0x36900a<_0x12d545['query'][_0xccf3('0x6a')][_0xccf3('0x49')];_0x36900a+=0x1){socket[_0xccf3('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x12d545[_0xccf3('0x43')][_0xccf3('0x6a')][_0x36900a]),'WhatsappAccountId':Number(_0x12d545['params']['id'])});}}else{socket[_0xccf3('0x71')](_0xccf3('0x75'),{'UserId':Number(_0x12d545[_0xccf3('0x43')][_0xccf3('0x6a')]),'WhatsappAccountId':Number(_0x12d545[_0xccf3('0x58')]['id'])});}});}})[_0xccf3('0x21')](respondWithStatusCode(_0x4c9d,null))[_0xccf3('0x2b')](handleError(_0x4c9d,null));};exports[_0xccf3('0x76')]=function(_0x2eacbd,_0x411433,_0x336b38){var _0x29b312={};var _0x29f85f={};var _0x11e79c;var _0x37d72b;return db['WhatsappAccount'][_0xccf3('0x67')]({'where':{'id':_0x2eacbd[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x411433,null))[_0xccf3('0x21')](function(_0x2ea96a){if(_0x2ea96a){_0x11e79c=_0x2ea96a;_0x29f85f[_0xccf3('0x42')]=_['keys'](db[_0xccf3('0x77')][_0xccf3('0x3e')]);_0x29f85f[_0xccf3('0x43')]=_[_0xccf3('0x44')](_0x2eacbd[_0xccf3('0x43')]);_0x29f85f[_0xccf3('0x45')]=_[_0xccf3('0x46')](_0x29f85f[_0xccf3('0x42')],_0x29f85f[_0xccf3('0x43')]);_0x29b312[_0xccf3('0x47')]=_[_0xccf3('0x46')](_0x29f85f[_0xccf3('0x42')],qs[_0xccf3('0x48')](_0x2eacbd['query'][_0xccf3('0x48')]));_0x29b312['attributes']=_0x29b312[_0xccf3('0x47')][_0xccf3('0x49')]?_0x29b312[_0xccf3('0x47')]:_0x29f85f['model'];_0x29b312[_0xccf3('0x4c')]=qs['sort'](_0x2eacbd['query'][_0xccf3('0x4d')]);_0x29b312[_0xccf3('0x4e')]=qs[_0xccf3('0x45')](_['pick'](_0x2eacbd[_0xccf3('0x43')],_0x29f85f[_0xccf3('0x45')]));if(_0x2eacbd[_0xccf3('0x43')][_0xccf3('0x50')]){_0x29b312['where']=_['merge'](_0x29b312[_0xccf3('0x4e')],{'$or':_[_0xccf3('0x3c')](_0x29b312['attributes'],function(_0x3c91f0){var _0x4c989d={};_0x4c989d[_0x3c91f0]={'$like':'%'+_0x2eacbd[_0xccf3('0x43')][_0xccf3('0x50')]+'%'};return _0x4c989d;})});}_0x29b312=_[_0xccf3('0x51')]({},_0x29b312,_0x2eacbd[_0xccf3('0x52')]);return _0x11e79c['getAgents'](_0x29b312);}})[_0xccf3('0x21')](function(_0x253736){if(_0x253736){_0x37d72b=_0x253736['length'];if(!_0x2eacbd[_0xccf3('0x43')][_0xccf3('0x4a')](_0xccf3('0x4b'))){_0x29b312[_0xccf3('0x30')]=qs[_0xccf3('0x30')](_0x2eacbd[_0xccf3('0x43')]['limit']);_0x29b312[_0xccf3('0x32')]=qs[_0xccf3('0x32')](_0x2eacbd[_0xccf3('0x43')]['offset']);}return _0x11e79c[_0xccf3('0x76')](_0x29b312);}})[_0xccf3('0x21')](function(_0x493ac5){if(_0x493ac5){return _0x493ac5?{'count':_0x37d72b,'rows':_0x493ac5}:null;}})[_0xccf3('0x21')](respondWithResult(_0x411433,null))['catch'](handleError(_0x411433,null));};exports[_0xccf3('0x78')]=function(_0x8690c4,_0x44b05f){var _0x4b87c5=_0x8690c4[_0xccf3('0x58')]['id'];var _0x4fcb6f=_0x8690c4[_0xccf3('0x5b')];var _0x53002e=0xc8;var _0x30c9b9=null;return db[_0xccf3('0x79')][_0xccf3('0x7a')]({'isolationLevel':db[_0xccf3('0x79')][_0xccf3('0x7b')][_0xccf3('0x7c')][_0xccf3('0x7d')]},function(_0xc6f886){return db['WhatsappAccount']['findOne']({'where':{'id':_0x4b87c5},'transaction':_0xc6f886})[_0xccf3('0x21')](function(_0xf715d6){if(_0xf715d6){return db[_0xccf3('0x7e')][_0xccf3('0x35')]({'where':{'WhatsappAccountId':_0x4b87c5},'transaction':_0xc6f886})[_0xccf3('0x21')](function(){var _0x1df5f7=_[_0xccf3('0x3c')](_0x4fcb6f,function(_0x321db7){_0x321db7[_0xccf3('0x65')]=_0x4b87c5;return _0x321db7;});return db[_0xccf3('0x7e')][_0xccf3('0x7f')](_0x1df5f7,{'transaction':_0xc6f886});});}else{_0x53002e=0x194;_0x30c9b9=[];}});})['then'](function(){if(_0x53002e!==0x194){return db[_0xccf3('0x7e')][_0xccf3('0x80')]({'where':{'WhatsappAccountId':_0x4b87c5},'order':'priority'})['then'](function(_0x24283e){_0x30c9b9=_0x24283e;});}})['catch'](function(_0x3b868d){_0x53002e=0x1f4;logger[_0xccf3('0x26')](_0x3b868d[_0xccf3('0x39')]);if(_0x3b868d[_0xccf3('0x3a')]){delete _0x3b868d[_0xccf3('0x3a')];}_0x30c9b9=_0x3b868d;})[_0xccf3('0x81')](function(){if(_0x30c9b9===null){_0x44b05f[_0xccf3('0x38')](_0x53002e);}else{if(_0x53002e===0x1f4){_0x44b05f[_0xccf3('0x2c')](_0x53002e)[_0xccf3('0x82')](_0x30c9b9);}else{_0x44b05f['status'](_0x53002e)[_0xccf3('0x2e')](_0x30c9b9);}}});};exports['getApplications']=function(_0x53a200,_0x4bd561,_0x4f07fd){var _0x4be0b6={};var _0x533300={};var _0x1c01cc;var _0x1171a5;return db[_0xccf3('0x3d')][_0xccf3('0x67')]({'where':{'id':_0x53a200[_0xccf3('0x58')]['id']}})[_0xccf3('0x21')](handleEntityNotFound(_0x4bd561,null))[_0xccf3('0x21')](function(_0xff6a9d){if(_0xff6a9d){_0x1c01cc=_0xff6a9d;_0x533300[_0xccf3('0x42')]=_[_0xccf3('0x44')](db[_0xccf3('0x7e')][_0xccf3('0x3e')]);_0x533300[_0xccf3('0x43')]=_[_0xccf3('0x44')](_0x53a200[_0xccf3('0x43')]);_0x533300[_0xccf3('0x45')]=_[_0xccf3('0x46')](_0x533300[_0xccf3('0x42')],_0x533300[_0xccf3('0x43')]);_0x4be0b6['attributes']=_[_0xccf3('0x46')](_0x533300[_0xccf3('0x42')],qs[_0xccf3('0x48')](_0x53a200[_0xccf3('0x43')][_0xccf3('0x48')]));_0x4be0b6[_0xccf3('0x47')]=_0x4be0b6[_0xccf3('0x47')][_0xccf3('0x49')]?_0x4be0b6['attributes']:_0x533300[_0xccf3('0x42')];_0x4be0b6[_0xccf3('0x4c')]=qs[_0xccf3('0x4d')](_0x53a200['query']['sort']);_0x4be0b6[_0xccf3('0x4e')]=qs[_0xccf3('0x45')](_['pick'](_0x53a200['query'],_0x533300[_0xccf3('0x45')]));if(_0x53a200[_0xccf3('0x43')]['filter']){_0x4be0b6['where']=_[_0xccf3('0x51')](_0x4be0b6[_0xccf3('0x4e')],{'$or':_['map'](_0x4be0b6[_0xccf3('0x47')],function(_0xf50b16){var _0x399a54={};_0x399a54[_0xf50b16]={'$like':'%'+_0x53a200[_0xccf3('0x43')][_0xccf3('0x50')]+'%'};return _0x399a54;})});}_0x4be0b6=_[_0xccf3('0x51')]({},_0x4be0b6,_0x53a200[_0xccf3('0x52')]);return _0x1c01cc[_0xccf3('0x83')](_0x4be0b6);}})[_0xccf3('0x21')](function(_0x37b866){if(_0x37b866){_0x1171a5=_0x37b866[_0xccf3('0x49')];if(!_0x53a200[_0xccf3('0x43')][_0xccf3('0x4a')](_0xccf3('0x4b'))){_0x4be0b6[_0xccf3('0x30')]=qs[_0xccf3('0x30')](_0x53a200[_0xccf3('0x43')][_0xccf3('0x30')]);_0x4be0b6[_0xccf3('0x32')]=qs[_0xccf3('0x32')](_0x53a200[_0xccf3('0x43')]['offset']);}return _0x1c01cc[_0xccf3('0x83')](_0x4be0b6);}})[_0xccf3('0x21')](function(_0x4e4b5d){if(_0x4e4b5d){return _0x4e4b5d?{'count':_0x1171a5,'rows':_0x4e4b5d}:null;}})[_0xccf3('0x21')](respondWithResult(_0x4bd561,null))[_0xccf3('0x2b')](handleError(_0x4bd561,null));};exports[_0xccf3('0x84')]=function(_0x35c9d2,_0xccc7de,_0x408f7d){var _0x228e97={'channel':_0xccf3('0x85')};var _0x257c70=[];var _0x142dc5=[];var _0x2f4841={};return db[_0xccf3('0x3d')][_0xccf3('0x60')]({'where':{'id':_0x35c9d2[_0xccf3('0x58')]['id']},'include':[{'model':db[_0xccf3('0x7e')],'as':_0xccf3('0x86')}]})[_0xccf3('0x21')](handleEntityNotFound(_0xccc7de,null))['then'](function(_0x3d7cfd){_0x228e97[_0xccf3('0x87')]=_0x3d7cfd;if(_0x228e97[_0xccf3('0x87')]&&_0x228e97[_0xccf3('0x87')][_0xccf3('0x40')]===_0xccf3('0x88')&&_0x35c9d2[_0xccf3('0x5b')][_0xccf3('0x89')]){if(_0x35c9d2['body'][_0xccf3('0x89')][_0xccf3('0x49')]===0x0)return;if(_0x35c9d2['body']['statuses'][0x0]['state']!=='read')return;return db[_0xccf3('0x8a')][_0xccf3('0x8b')]({'read':!![],'readAt':_0x35c9d2['body'][_0xccf3('0x89')][0x0]['timestamp']},{'where':{'messageId':_0x35c9d2[_0xccf3('0x5b')]['statuses'][0x0][_0xccf3('0x8c')]},'individualHooks':!![]})[_0xccf3('0x21')](function(_0x2cf28a){return _0xccc7de[_0xccf3('0x2c')](0xc8)[_0xccf3('0x2e')](_0x2cf28a);});}_0x228e97['applications']=_['orderBy'](_0x3d7cfd[_0xccf3('0x86')],[_0xccf3('0x8d')],['asc']);if(_0x228e97['account']['Applications']){delete _0x228e97[_0xccf3('0x87')][_0xccf3('0x86')];}return db[_0xccf3('0x8e')]['describe']()[_0xccf3('0x21')](function(_0x4d1ac7){if(!_0x4d1ac7){throw new db['Sequelize'][(_0xccf3('0x8f'))]('no\x20available\x20attributes');}_0x257c70=_['difference'](_[_0xccf3('0x44')](_0x4d1ac7),[_0xccf3('0x90'),_0xccf3('0x91')]);_0x142dc5=_[_0xccf3('0x92')](_[_0xccf3('0x44')](_0x4d1ac7),[_0xccf3('0x90'),'updatedAt',_0xccf3('0x93'),_0xccf3('0x94')]);_0x228e97[_0xccf3('0x5b')]={'mapKey':'mobile'};if(_0x228e97[_0xccf3('0x87')]&&_0x228e97['account'][_0xccf3('0x40')]==='twilio'){_0x228e97['body'][_0xccf3('0x95')]=_0x35c9d2[_0xccf3('0x5b')][_0xccf3('0x96')][_0xccf3('0x97')](_0xccf3('0x98'),'');_0x228e97[_0xccf3('0x5b')][_0xccf3('0x5b')]=_0x35c9d2[_0xccf3('0x5b')]['Body'];_0x228e97[_0xccf3('0x5b')][_0xccf3('0x99')]=_0x35c9d2['body'][_0xccf3('0x9a')];}if(_0x228e97[_0xccf3('0x87')]&&_0x228e97[_0xccf3('0x87')]['type']===_0xccf3('0x88')){_0x228e97[_0xccf3('0x5b')][_0xccf3('0x95')]=_0x35c9d2[_0xccf3('0x5b')][_0xccf3('0x9b')][0x0][_0xccf3('0x95')];_0x228e97[_0xccf3('0x5b')]['body']=_0x35c9d2[_0xccf3('0x5b')][_0xccf3('0x9b')][0x0][_0xccf3('0x29')][_0xccf3('0x5b')];_0x228e97[_0xccf3('0x5b')][_0xccf3('0x99')]=_0x35c9d2[_0xccf3('0x5b')]['notifications'][0x0]['message_id'];}if(_0x228e97[_0xccf3('0x5b')]['id']){delete _0x228e97[_0xccf3('0x5b')]['id'];}if(_[_0xccf3('0x9c')](_0x228e97[_0xccf3('0x5b')][_0xccf3('0x95')])){throw new db[(_0xccf3('0x9d'))][(_0xccf3('0x8f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x228e97['body'][_0xccf3('0x5b')])||_0x228e97['body'][_0xccf3('0x5b')]===''){throw new db[(_0xccf3('0x9d'))]['ValidationError'](_0xccf3('0x9e'));}if(_[_0xccf3('0x9c')](_0x228e97[_0xccf3('0x5b')]['mapKey'])){throw new db[(_0xccf3('0x9d'))][(_0xccf3('0x8f'))](_0xccf3('0x9f')+_0x142dc5);}if(!_['includes'](_0x142dc5,_0x228e97[_0xccf3('0x5b')][_0xccf3('0xa0')])){throw new db[(_0xccf3('0x9d'))][(_0xccf3('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x142dc5);}_0x2f4841[_0x228e97[_0xccf3('0x5b')][_0xccf3('0xa0')]]=_0x228e97['body']['from'];return db[_0xccf3('0xa1')][_0xccf3('0x60')]({'where':{'id':_0x228e97[_0xccf3('0x87')]['ListId']},'include':[{'model':db[_0xccf3('0x8e')],'as':_0xccf3('0xa2'),'where':_0x2f4841,'limit':0x1,'order':[[_0xccf3('0x91'),'DESC']]}]});})[_0xccf3('0x21')](handleEntityNotFound(_0xccc7de,null))[_0xccf3('0x21')](function(_0x2435f7){if(_0x2435f7){_0x228e97[_0xccf3('0xa3')]=_[_0xccf3('0x6f')](_0x2435f7,[_0xccf3('0xa2')]);if(_0x2435f7['Contacts'][_0xccf3('0x49')]){return _0x2435f7[_0xccf3('0xa2')][0x0];}var _0x24c849=_['defaults'](_0x228e97[_0xccf3('0x5b')],{'firstName':_0x228e97[_0xccf3('0x5b')][_0xccf3('0x95')],'ListId':_0x2435f7['id']});_0x24c849[_0x228e97[_0xccf3('0x5b')][_0xccf3('0xa0')]]=_0x228e97[_0xccf3('0x5b')][_0xccf3('0x95')];return db[_0xccf3('0x8e')][_0xccf3('0x5a')](_0x24c849,{'fields':_0x257c70,'raw':!![]});}})[_0xccf3('0x21')](handleEntityNotFound(_0xccc7de,null))[_0xccf3('0x21')](function(_0x2c5f4f){if(_0x2c5f4f){_0x228e97[_0xccf3('0xa4')]=_0x2c5f4f;var _0x62845f={'ContactId':_0x2c5f4f['id'],'phone':_0x228e97[_0xccf3('0x5b')][_0xccf3('0x95')],'WhatsappAccountId':_0x35c9d2['params']['id']};var _0x37e6e9={'ContactId':_0x2c5f4f['id'],'WhatsappAccountId':_0x35c9d2['params']['id'],'closed':![]};return db[_0xccf3('0xa5')]['find']({'where':_0x37e6e9})[_0xccf3('0x21')](function(_0x36a33c){if(_0x36a33c){return[_0x36a33c,![]];}return db[_0xccf3('0xa5')][_0xccf3('0x5a')](_0x62845f)[_0xccf3('0x21')](function(_0x33ef0a){return[_0x33ef0a,!![]];});});}})['spread'](function(_0x38b7c9,_0x36b536){_0x228e97['interaction']=_0x38b7c9[_0xccf3('0x5e')]({'plain':!![]});_0x228e97[_0xccf3('0xa6')][_0xccf3('0xa7')]=![];if(_0x36b536){if(_0x228e97['account']['autoclose']){_0x228e97[_0xccf3('0xa8')][_0xccf3('0xa9')]({'id':0x0,'priority':_0x228e97[_0xccf3('0xa8')][_0xccf3('0x49')]+0x1,'app':_0xccf3('0xaa'),'appdata':_0xccf3('0xab'),'interval':'*,*,*,*'});}_0x228e97[_0xccf3('0xa6')][_0xccf3('0xa7')]=!![];}return db[_0xccf3('0x8a')][_0xccf3('0x5a')]({'phone':_0x228e97[_0xccf3('0x5b')][_0xccf3('0x95')],'messageId':_0x228e97[_0xccf3('0x5b')][_0xccf3('0x99')],'body':_0x228e97['body'][_0xccf3('0x5b')],'WhatsappAccountId':_0x35c9d2[_0xccf3('0x58')]['id'],'WhatsappInteractionId':_0x38b7c9['id'],'direction':'in','ContactId':_0x38b7c9[_0xccf3('0xac')],'AttachmentId':_0x228e97['body'][_0xccf3('0xad')]});})['then'](function(_0x5ba020){_0x228e97['message']=_0x5ba020;if(_0x228e97[_0xccf3('0xa6')][_0xccf3('0xae')]){return db[_0xccf3('0x77')][_0xccf3('0x60')]({'attributes':['id','name'],'where':{'id':_0x228e97[_0xccf3('0xa6')]['UserId']}})[_0xccf3('0x21')](function(_0x1d589c){if(_0x1d589c){_0x228e97['applications'][_0xccf3('0xaf')]({'id':0x0,'priority':0x0,'app':_0xccf3('0xb0'),'appdata':_0x1d589c['name']+','+(_0x228e97[_0xccf3('0x87')][_0xccf3('0xb1')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xccf3('0xb2'),_0xccf3('0xb3'),_0x228e97);});}return respondWithRpcPromise(_0xccf3('0xb2'),_0xccf3('0xb3'),_0x228e97);})[_0xccf3('0x21')](function(_0x47a936){if(_0x47a936){var _0x1ee0e5=0xc8;var _0x5ad82d=_0xccf3('0xb4');logger['info'](_0xccf3('0x24'),_0x5ad82d,_0x1ee0e5,'entity\x20found');logger[_0xccf3('0xb5')](_0xccf3('0xb6'),_0x5ad82d,_0x1ee0e5,_0xccf3('0xb7'),JSON[_0xccf3('0x25')](_0x47a936));if(_0x228e97[_0xccf3('0x87')][_0xccf3('0x40')]===_0xccf3('0xb8')){return _0xccc7de['status'](_0x1ee0e5)['set'](_0xccf3('0xb9'),'text/xml')[_0xccf3('0x82')]('\x0a');}else{return _0xccc7de['status'](_0x1ee0e5)[_0xccf3('0x2e')](_0x47a936);}}});})[_0xccf3('0x2b')](handleError(_0xccc7de,null));};exports[_0xccf3('0x82')]=function(_0x6fdeb6,_0x36c23a,_0xfe235a){var _0x5bed77,_0x56ccc3,_0x5d155b;if(_[_0xccf3('0x9c')](_0x6fdeb6[_0xccf3('0x5b')][_0xccf3('0x5b')])||_0x6fdeb6['body']['body']===''){throw new db[(_0xccf3('0x9d'))][(_0xccf3('0x8f'))](_0xccf3('0x9e'));}if(_[_0xccf3('0x9c')](_0x6fdeb6[_0xccf3('0x5b')]['to'])){throw new db[(_0xccf3('0x9d'))][(_0xccf3('0x8f'))](_0xccf3('0xba'));}_0x5bed77=_0x6fdeb6[_0xccf3('0x5b')]['to'];return db['WhatsappAccount'][_0xccf3('0x60')]({'where':{'id':_0x6fdeb6['params']['id']},'include':[{'model':db[_0xccf3('0xa1')],'as':_0xccf3('0xbb'),'include':[{'model':db[_0xccf3('0x8e')],'as':_0xccf3('0xa2'),'where':{'mobile':_0x5bed77},'limit':0x1,'order':[[_0xccf3('0x91'),_0xccf3('0xbc')]]}]}]})[_0xccf3('0x21')](handleEntityNotFound(_0x36c23a,null))[_0xccf3('0x21')](function(_0x3112c3){if(_0x3112c3&&_0x3112c3[_0xccf3('0xbb')]){_0x56ccc3=_0x3112c3['get']({'plain':!![]});if(_0x56ccc3['List']&&_0x56ccc3[_0xccf3('0xbb')][_0xccf3('0xa2')]['length']){return _0x56ccc3['List'][_0xccf3('0xa2')][0x0];}return db[_0xccf3('0x8e')]['create'](_[_0xccf3('0x18')](_0x6fdeb6['body'],{'firstName':_0x5bed77,'mobile':_0x5bed77,'phone':_0x5bed77,'ListId':_0x56ccc3[_0xccf3('0x94')]}));}})[_0xccf3('0x21')](handleEntityNotFound(_0x36c23a,null))['then'](function(_0x1b1846){if(_0x1b1846){_0x5d155b=_0x1b1846;return db[_0xccf3('0xa5')]['find']({'where':{'ContactId':_0x5d155b['id'],'closed':![],'WhatsappAccountId':_0x56ccc3['id']}})[_0xccf3('0x21')](function(_0x50ad9a){if(_0x50ad9a){return[_0x50ad9a,![]];}return db['WhatsappInteraction'][_0xccf3('0x5a')]({'UserId':_0x6fdeb6[_0xccf3('0x5c')]['id'],'ContactId':_0x5d155b['id'],'WhatsappAccountId':_0x56ccc3['id'],'phone':_0x5bed77,'firstMsgDirection':_0xccf3('0xbd'),'Messages':[_[_0xccf3('0x51')](_0x6fdeb6[_0xccf3('0x5b')],{'read':![],'body':_0x6fdeb6[_0xccf3('0x5b')][_0xccf3('0x5b')],'phone':_0x5bed77,'WhatsappAccountId':_0x56ccc3['id'],'UserId':_0x6fdeb6[_0xccf3('0x5c')]['id'],'ContactId':_0x5d155b['id']})]},{'include':[{'model':db[_0xccf3('0x8a')],'as':_0xccf3('0xbe')}]})[_0xccf3('0x21')](function(_0x5c2775){return[_0x5c2775,!![]];});});}})[_0xccf3('0x70')](function(_0x461079,_0x3c574f){if(_0x3c574f){return _0x461079;}return db[_0xccf3('0x8a')]['create'](_[_0xccf3('0x51')](_0x6fdeb6['body'],{'read':![],'body':_0x6fdeb6[_0xccf3('0x5b')]['body'],'phone':_0x5bed77,'WhatsappAccountId':_0x56ccc3['id'],'WhatsappInteractionId':_0x461079['id'],'UserId':_0x6fdeb6['user']['id'],'ContactId':_0x5d155b['id']}))[_0xccf3('0x21')](function(_0xe23193){_0x461079['dataValues']['Messages']=[];_0x461079[_0xccf3('0xbf')][_0xccf3('0xbe')][_0xccf3('0xa9')](_0xe23193['dataValues']);return _0x461079;});})[_0xccf3('0x21')](respondWithResult(_0x36c23a,null))['catch'](handleError(_0x36c23a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b0eaa82..7f9047e 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 _0xd225=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1099f1,_0x2c5f01){var _0x405ca9=function(_0x296a99){while(--_0x296a99){_0x1099f1['push'](_0x1099f1['shift']());}};_0x405ca9(++_0x2c5f01);}(_0xd225,0x1c3));var _0x5d22=function(_0x17e6f3,_0x3a2655){_0x17e6f3=_0x17e6f3-0x0;var _0x39f04a=_0xd225[_0x17e6f3];return _0x39f04a;};'use strict';var EventEmitter=require(_0x5d22('0x0'));var WhatsappAccount=require(_0x5d22('0x1'))['db'][_0x5d22('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5d22('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d22('0x4'),'afterDestroy':_0x5d22('0x5')};function emitEvent(_0x1eefab){return function(_0x3cfcb0,_0x3c848c,_0x51337f){WhatsappAccountEvents['emit'](_0x1eefab+':'+_0x3cfcb0['id'],_0x3cfcb0);WhatsappAccountEvents[_0x5d22('0x6')](_0x1eefab,_0x3cfcb0);_0x51337f(null);};}for(var e in events){if(events[_0x5d22('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x5d22('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x3103=['exports','events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x3103,0x17d));var _0x3310=function(_0x24579a,_0x59612d){_0x24579a=_0x24579a-0x0;var _0x59dff7=_0x3103[_0x24579a];return _0x59dff7;};'use strict';var EventEmitter=require(_0x3310('0x0'));var WhatsappAccount=require(_0x3310('0x1'))['db'][_0x3310('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3310('0x3'),'afterUpdate':_0x3310('0x4'),'afterDestroy':_0x3310('0x5')};function emitEvent(_0x515586){return function(_0x3375ac,_0x439c60,_0x367a55){WhatsappAccountEvents[_0x3310('0x6')](_0x515586+':'+_0x3375ac['id'],_0x3375ac);WhatsappAccountEvents[_0x3310('0x6')](_0x515586,_0x3375ac);_0x367a55(null);};}for(var e in events){if(events[_0x3310('0x7')](e)){var event=events[e];WhatsappAccount[_0x3310('0x8')](e,emitEvent(event));}}module[_0x3310('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1ce3d52..0027a52 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 _0x7340=['rimraf','./whatsappAccount.attributes','define','WhatsappAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x7340,0xa0));var _0x0734=function(_0x3399f4,_0x8979dd){_0x3399f4=_0x3399f4-0x0;var _0x226def=_0x7340[_0x3399f4];return _0x226def;};'use strict';var _=require(_0x0734('0x0'));var util=require(_0x0734('0x1'));var logger=require(_0x0734('0x2'))(_0x0734('0x3'));var moment=require(_0x0734('0x4'));var BPromise=require(_0x0734('0x5'));var rp=require(_0x0734('0x6'));var fs=require('fs');var path=require(_0x0734('0x7'));var rimraf=require(_0x0734('0x8'));var config=require('../../config/environment');var attributes=require(_0x0734('0x9'));module['exports']=function(_0xaf82c3,_0x3960dc){return _0xaf82c3[_0x0734('0xa')](_0x0734('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5e7=['../../config/environment','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1cdaaf,_0x32ba6e){var _0x48f2d4=function(_0x3fac55){while(--_0x3fac55){_0x1cdaaf['push'](_0x1cdaaf['shift']());}};_0x48f2d4(++_0x32ba6e);}(_0xf5e7,0x19b));var _0x7f5e=function(_0x584da3,_0x388a44){_0x584da3=_0x584da3-0x0;var _0x37aeb9=_0xf5e7[_0x584da3];return _0x37aeb9;};'use strict';var _=require(_0x7f5e('0x0'));var util=require(_0x7f5e('0x1'));var logger=require(_0x7f5e('0x2'))(_0x7f5e('0x3'));var moment=require('moment');var BPromise=require(_0x7f5e('0x4'));var rp=require(_0x7f5e('0x5'));var fs=require('fs');var path=require(_0x7f5e('0x6'));var rimraf=require('rimraf');var config=require(_0x7f5e('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x7f5e('0x8')]=function(_0x11f35d,_0x2edb59){return _0x11f35d[_0x7f5e('0x9')]('WhatsappAccount',attributes,{'tableName':_0x7f5e('0xa'),'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 7ee34e1..ab4e1f2 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 _0xaf1c=['./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','defaults','redis','localhost'];(function(_0x1e527f,_0x54a9de){var _0x233cc2=function(_0x271d12){while(--_0x271d12){_0x1e527f['push'](_0x1e527f['shift']());}};_0x233cc2(++_0x54a9de);}(_0xaf1c,0xea));var _0xcaf1=function(_0x12e761,_0x2e9f34){_0x12e761=_0x12e761-0x0;var _0x2fb579=_0xaf1c[_0x12e761];return _0x2fb579;};'use strict';var _=require(_0xcaf1('0x0'));var util=require('util');var moment=require(_0xcaf1('0x1'));var BPromise=require(_0xcaf1('0x2'));var rs=require(_0xcaf1('0x3'));var fs=require('fs');var Redis=require(_0xcaf1('0x4'));var db=require(_0xcaf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaf1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcaf1('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xcaf1('0x8')](config[_0xcaf1('0x9')],{'host':_0xcaf1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcaf1('0xb'))[_0xcaf1('0xc')](socket);function respondWithRpcPromise(_0x3a2fec,_0x1e730a,_0x24e41a){return new BPromise(function(_0x3cf75c,_0x2fb9bb){return client[_0xcaf1('0xd')](_0x3a2fec,_0x24e41a)[_0xcaf1('0xe')](function(_0x4882c7){logger[_0xcaf1('0xf')](_0xcaf1('0x10'),_0x1e730a,'request\x20sent');logger[_0xcaf1('0x11')](_0xcaf1('0x12'),_0x1e730a,'request\x20sent',JSON[_0xcaf1('0x13')](_0x4882c7));if(_0x4882c7['error']){if(_0x4882c7['error'][_0xcaf1('0x14')]===0x1f4){logger[_0xcaf1('0x15')](_0xcaf1('0x10'),_0x1e730a,_0x4882c7[_0xcaf1('0x15')][_0xcaf1('0x16')]);return _0x2fb9bb(_0x4882c7['error'][_0xcaf1('0x16')]);}logger[_0xcaf1('0x15')](_0xcaf1('0x10'),_0x1e730a,_0x4882c7[_0xcaf1('0x15')][_0xcaf1('0x16')]);return _0x3cf75c(_0x4882c7['error'][_0xcaf1('0x16')]);}else{logger[_0xcaf1('0xf')](_0xcaf1('0x10'),_0x1e730a,_0xcaf1('0x17'));_0x3cf75c(_0x4882c7[_0xcaf1('0x18')][_0xcaf1('0x16')]);}})[_0xcaf1('0x19')](function(_0x4dee69){logger['error'](_0xcaf1('0x10'),_0x1e730a,_0x4dee69);_0x2fb9bb(_0x4dee69);});});}exports[_0xcaf1('0x1a')]=function(_0x2d28a5){var _0x44a0b9=this;return new Promise(function(_0x418429,_0x1be459){return db[_0xcaf1('0x1b')][_0xcaf1('0x1c')]({'raw':_0x2d28a5[_0xcaf1('0x1d')]?_0x2d28a5[_0xcaf1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2d28a5['options']?_0x2d28a5[_0xcaf1('0x1d')][_0xcaf1('0x1e')]||null:null,'attributes':_0x2d28a5[_0xcaf1('0x1d')]?_0x2d28a5['options']['attributes']||null:null,'include':_0x2d28a5['options']?_0x2d28a5['options'][_0xcaf1('0x1f')]?_[_0xcaf1('0x20')](_0x2d28a5[_0xcaf1('0x1d')][_0xcaf1('0x1f')],function(_0x5c2fd9){return{'model':db[_0x5c2fd9[_0xcaf1('0x21')]],'as':_0x5c2fd9['as'],'attributes':_0x5c2fd9[_0xcaf1('0x22')],'include':_0x5c2fd9[_0xcaf1('0x1f')]?_[_0xcaf1('0x20')](_0x5c2fd9[_0xcaf1('0x1f')],function(_0x40dc4f){return{'model':db[_0x40dc4f[_0xcaf1('0x21')]],'as':_0x40dc4f['as'],'attributes':_0x40dc4f[_0xcaf1('0x22')],'include':_0x40dc4f['include']?_[_0xcaf1('0x20')](_0x40dc4f['include'],function(_0x5771f8){return{'model':db[_0x5771f8[_0xcaf1('0x21')]],'as':_0x5771f8['as'],'attributes':_0x5771f8[_0xcaf1('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36c414){logger[_0xcaf1('0xf')]('ShowWhatsappAccount',_0x2d28a5);logger[_0xcaf1('0x11')]('ShowWhatsappAccount',_0x2d28a5,JSON[_0xcaf1('0x13')](_0x36c414));_0x418429(_0x36c414);})['catch'](function(_0xa76bfc){logger[_0xcaf1('0x15')]('ShowWhatsappAccount',_0xa76bfc['message'],_0x2d28a5);_0x1be459(_0x44a0b9[_0xcaf1('0x15')](0x1f4,_0xa76bfc[_0xcaf1('0x16')]));});});}; \ No newline at end of file +var _0x9095=['register','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','./whatsappAccount.socket'];(function(_0x3ddd31,_0x2cb6b1){var _0x9e0e59=function(_0x8479c5){while(--_0x8479c5){_0x3ddd31['push'](_0x3ddd31['shift']());}};_0x9e0e59(++_0x2cb6b1);}(_0x9095,0x10b));var _0x5909=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x9095[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x5909('0x0'));var util=require(_0x5909('0x1'));var moment=require('moment');var BPromise=require(_0x5909('0x2'));var rs=require(_0x5909('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5909('0x4'))['db'];var utils=require(_0x5909('0x5'));var logger=require(_0x5909('0x6'))(_0x5909('0x7'));var config=require('../../config/environment');var jayson=require(_0x5909('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5909('0x9')]=_[_0x5909('0xa')](config[_0x5909('0x9')],{'host':_0x5909('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5909('0xc'))[_0x5909('0xd')](socket);function respondWithRpcPromise(_0x694284,_0x5e80da,_0x706090){return new BPromise(function(_0x554b7b,_0x3a8059){return client['request'](_0x694284,_0x706090)[_0x5909('0xe')](function(_0x51a820){logger[_0x5909('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x5e80da,_0x5909('0x10'));logger['debug'](_0x5909('0x11'),_0x5e80da,_0x5909('0x10'),JSON[_0x5909('0x12')](_0x51a820));if(_0x51a820[_0x5909('0x13')]){if(_0x51a820[_0x5909('0x13')][_0x5909('0x14')]===0x1f4){logger[_0x5909('0x13')](_0x5909('0x15'),_0x5e80da,_0x51a820[_0x5909('0x13')]['message']);return _0x3a8059(_0x51a820[_0x5909('0x13')][_0x5909('0x16')]);}logger['error'](_0x5909('0x15'),_0x5e80da,_0x51a820[_0x5909('0x13')][_0x5909('0x16')]);return _0x554b7b(_0x51a820[_0x5909('0x13')][_0x5909('0x16')]);}else{logger[_0x5909('0xf')](_0x5909('0x15'),_0x5e80da,_0x5909('0x10'));_0x554b7b(_0x51a820[_0x5909('0x17')][_0x5909('0x16')]);}})[_0x5909('0x18')](function(_0x5badba){logger[_0x5909('0x13')](_0x5909('0x15'),_0x5e80da,_0x5badba);_0x3a8059(_0x5badba);});});}exports[_0x5909('0x19')]=function(_0x5ec2d6){var _0x1cba80=this;return new Promise(function(_0x409497,_0x4a4fbf){return db[_0x5909('0x1a')][_0x5909('0x1b')]({'raw':_0x5ec2d6[_0x5909('0x1c')]?_0x5ec2d6[_0x5909('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5ec2d6['options']?_0x5ec2d6[_0x5909('0x1c')][_0x5909('0x1d')]||null:null,'attributes':_0x5ec2d6[_0x5909('0x1c')]?_0x5ec2d6[_0x5909('0x1c')][_0x5909('0x1e')]||null:null,'include':_0x5ec2d6[_0x5909('0x1c')]?_0x5ec2d6[_0x5909('0x1c')][_0x5909('0x1f')]?_[_0x5909('0x20')](_0x5ec2d6['options'][_0x5909('0x1f')],function(_0x3c4f20){return{'model':db[_0x3c4f20[_0x5909('0x21')]],'as':_0x3c4f20['as'],'attributes':_0x3c4f20[_0x5909('0x1e')],'include':_0x3c4f20[_0x5909('0x1f')]?_['map'](_0x3c4f20[_0x5909('0x1f')],function(_0x5d5d96){return{'model':db[_0x5d5d96[_0x5909('0x21')]],'as':_0x5d5d96['as'],'attributes':_0x5d5d96['attributes'],'include':_0x5d5d96[_0x5909('0x1f')]?_['map'](_0x5d5d96[_0x5909('0x1f')],function(_0x53b6bf){return{'model':db[_0x53b6bf['model']],'as':_0x53b6bf['as'],'attributes':_0x53b6bf[_0x5909('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ec320){logger[_0x5909('0xf')](_0x5909('0x19'),_0x5ec2d6);logger[_0x5909('0x22')](_0x5909('0x19'),_0x5ec2d6,JSON[_0x5909('0x12')](_0x5ec320));_0x409497(_0x5ec320);})[_0x5909('0x18')](function(_0x56f42e){logger['error'](_0x5909('0x19'),_0x56f42e[_0x5909('0x16')],_0x5ec2d6);_0x4a4fbf(_0x1cba80[_0x5909('0x13')](0x1f4,_0x56f42e[_0x5909('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0a35ec7..96b9c27 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 _0x8f50=['update','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x5be8ab,_0x4000a6){var _0x35914d=function(_0x5c5e05){while(--_0x5c5e05){_0x5be8ab['push'](_0x5be8ab['shift']());}};_0x35914d(++_0x4000a6);}(_0x8f50,0x95));var _0x08f5=function(_0x484dbe,_0x303230){_0x484dbe=_0x484dbe-0x0;var _0x1aef87=_0x8f50[_0x484dbe];return _0x1aef87;};'use strict';var WhatsappAccountEvents=require(_0x08f5('0x0'));var events=['save','remove',_0x08f5('0x1')];function createListener(_0x1bdec1,_0x30e2ce){return function(_0x3b7fa4){_0x30e2ce['emit'](_0x1bdec1,_0x3b7fa4);};}function removeListener(_0x3e494c,_0x67833){return function(){WhatsappAccountEvents[_0x08f5('0x2')](_0x3e494c,_0x67833);};}exports['register']=function(_0xd6ded0){for(var _0x278a9e=0x0,_0x594f2e=events[_0x08f5('0x3')];_0x278a9e<_0x594f2e;_0x278a9e++){var _0x14cabc=events[_0x278a9e];var _0x433291=createListener(_0x08f5('0x4')+_0x14cabc,_0xd6ded0);WhatsappAccountEvents['on'](_0x14cabc,_0x433291);}}; \ No newline at end of file +var _0xaf8e=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove','update'];(function(_0x4674f7,_0x23a007){var _0x203744=function(_0x368466){while(--_0x368466){_0x4674f7['push'](_0x4674f7['shift']());}};_0x203744(++_0x23a007);}(_0xaf8e,0xf2));var _0xeaf8=function(_0x3fbc8f,_0x5be8be){_0x3fbc8f=_0x3fbc8f-0x0;var _0xa55d55=_0xaf8e[_0x3fbc8f];return _0xa55d55;};'use strict';var WhatsappAccountEvents=require(_0xeaf8('0x0'));var events=['save',_0xeaf8('0x1'),_0xeaf8('0x2')];function createListener(_0x203ac6,_0xde9e56){return function(_0x5aa8d0){_0xde9e56['emit'](_0x203ac6,_0x5aa8d0);};}function removeListener(_0x40b14c,_0x3ed130){return function(){WhatsappAccountEvents[_0xeaf8('0x3')](_0x40b14c,_0x3ed130);};}exports[_0xeaf8('0x4')]=function(_0x45e75d){for(var _0x308ad3=0x0,_0x112624=events[_0xeaf8('0x5')];_0x308ad3<_0x112624;_0x308ad3++){var _0x39de44=events[_0x308ad3];var _0x33965d=createListener(_0xeaf8('0x6')+_0x39de44,_0x45e75d);WhatsappAccountEvents['on'](_0x39de44,_0x33965d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 432268c..9ac20ef 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 _0xc27c=['./whatsappApplication.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0xc27c,0x84));var _0xcc27=function(_0x21c7e2,_0x1e9834){_0x21c7e2=_0x21c7e2-0x0;var _0x2ad40d=_0xc27c[_0x21c7e2];return _0x2ad40d;};'use strict';var multer=require(_0xcc27('0x0'));var util=require(_0xcc27('0x1'));var path=require(_0xcc27('0x2'));var timeout=require(_0xcc27('0x3'));var express=require('express');var router=express[_0xcc27('0x4')]();var fs_extra=require(_0xcc27('0x5'));var auth=require(_0xcc27('0x6'));var interaction=require(_0xcc27('0x7'));var config=require('../../config/environment');var controller=require(_0xcc27('0x8'));router[_0xcc27('0x9')]('/',auth['isAuthenticated'](),controller[_0xcc27('0xa')]);router[_0xcc27('0x9')]('/:id',auth[_0xcc27('0xb')](),controller[_0xcc27('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcc27('0xd')]);router[_0xcc27('0xe')](_0xcc27('0xf'),auth[_0xcc27('0xb')](),controller[_0xcc27('0x10')]);router[_0xcc27('0x11')](_0xcc27('0xf'),auth['isAuthenticated'](),controller[_0xcc27('0x12')]);module[_0xcc27('0x13')]=router; \ No newline at end of file +var _0xe5f5=['multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe5f5,0xd8));var _0x5e5f=function(_0x23fbf9,_0x5115e9){_0x23fbf9=_0x23fbf9-0x0;var _0x3e7039=_0xe5f5[_0x23fbf9];return _0x3e7039;};'use strict';var multer=require(_0x5e5f('0x0'));var util=require('util');var path=require(_0x5e5f('0x1'));var timeout=require(_0x5e5f('0x2'));var express=require(_0x5e5f('0x3'));var router=express['Router']();var fs_extra=require(_0x5e5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e5f('0x5'));var config=require(_0x5e5f('0x6'));var controller=require(_0x5e5f('0x7'));router[_0x5e5f('0x8')]('/',auth[_0x5e5f('0x9')](),controller[_0x5e5f('0xa')]);router[_0x5e5f('0x8')](_0x5e5f('0xb'),auth[_0x5e5f('0x9')](),controller[_0x5e5f('0xc')]);router[_0x5e5f('0xd')]('/',auth[_0x5e5f('0x9')](),controller[_0x5e5f('0xe')]);router['put']('/:id',auth[_0x5e5f('0x9')](),controller[_0x5e5f('0xf')]);router[_0x5e5f('0x10')](_0x5e5f('0xb'),auth[_0x5e5f('0x9')](),controller[_0x5e5f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e39a44d..832e4de 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 _0x0cc2=['sequelize','STRING','noop','TEXT'];(function(_0x227783,_0x5a41a2){var _0x528afd=function(_0x55b0b8){while(--_0x55b0b8){_0x227783['push'](_0x227783['shift']());}};_0x528afd(++_0x5a41a2);}(_0x0cc2,0x108));var _0x20cc=function(_0x1537f6,_0x55eab0){_0x1537f6=_0x1537f6-0x0;var _0x56885c=_0x0cc2[_0x1537f6];return _0x56885c;};'use strict';var Sequelize=require(_0x20cc('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x20cc('0x1')],'allowNull':![],'defaultValue':_0x20cc('0x2')},'appdata':{'type':Sequelize[_0x20cc('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x20cc('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe91d=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x535e1e,_0x2b3930){var _0x5161d2=function(_0x4296ba){while(--_0x4296ba){_0x535e1e['push'](_0x535e1e['shift']());}};_0x5161d2(++_0x2b3930);}(_0xe91d,0xcb));var _0xde91=function(_0x3f52d9,_0x1d748c){_0x3f52d9=_0x3f52d9-0x0;var _0x21e01f=_0xe91d[_0x3f52d9];return _0x21e01f;};'use strict';var Sequelize=require(_0xde91('0x0'));module['exports']={'priority':{'type':Sequelize[_0xde91('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xde91('0x2')],'allowNull':![],'defaultValue':_0xde91('0x3')},'appdata':{'type':Sequelize[_0xde91('0x4')]()},'description':{'type':Sequelize[_0xde91('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xde91('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index f303ba7..21700b0 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 _0x4201=['update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','apply','reject','save'];(function(_0x54950a,_0x137bfb){var _0x4b7839=function(_0x13a67e){while(--_0x13a67e){_0x54950a['push'](_0x54950a['shift']());}};_0x4b7839(++_0x137bfb);}(_0x4201,0x71));var _0x1420=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0x4201[_0x56e0e8];return _0x2dab50;};'use strict';var emlformat=require(_0x1420('0x0'));var rimraf=require(_0x1420('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1420('0x2'));var rp=require(_0x1420('0x3'));var moment=require(_0x1420('0x4'));var BPromise=require(_0x1420('0x5'));var Mustache=require(_0x1420('0x6'));var util=require(_0x1420('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1420('0x8'));var ejs=require(_0x1420('0x9'));var fs=require('fs');var fs_extra=require(_0x1420('0xa'));var _=require(_0x1420('0xb'));var squel=require(_0x1420('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1420('0xd'));var toCsv=require(_0x1420('0x8'));var querystring=require('querystring');var Papa=require(_0x1420('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1420('0xf'));var as=require(_0x1420('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1420('0x11'))(_0x1420('0x12'));var utils=require(_0x1420('0x13'));var config=require(_0x1420('0x14'));var licenseUtil=require(_0x1420('0x15'));var db=require(_0x1420('0x16'))['db'];function respondWithStatusCode(_0x2435f4,_0x334a56){_0x334a56=_0x334a56||0xcc;return function(_0x57980a){if(_0x57980a){return _0x2435f4['sendStatus'](_0x334a56);}return _0x2435f4['status'](_0x334a56)['end']();};}function respondWithResult(_0x466d30,_0x239669){_0x239669=_0x239669||0xc8;return function(_0x121f70){if(_0x121f70){return _0x466d30[_0x1420('0x17')](_0x239669)[_0x1420('0x18')](_0x121f70);}};}function respondWithFilteredResult(_0x3d2f72,_0x5a55c3){return function(_0x4c0d87){if(_0x4c0d87){var _0x108394=typeof _0x5a55c3['offset']==='undefined'&&typeof _0x5a55c3[_0x1420('0x19')]===_0x1420('0x1a');var _0x3b4bfd=_0x4c0d87[_0x1420('0x1b')];var _0x47bea3=_0x108394?0x0:_0x5a55c3[_0x1420('0x1c')];var _0x137b75=_0x108394?_0x4c0d87[_0x1420('0x1b')]:_0x5a55c3['offset']+_0x5a55c3[_0x1420('0x19')];var _0x402025;if(_0x137b75>=_0x3b4bfd){_0x137b75=_0x3b4bfd;_0x402025=0xc8;}else{_0x402025=0xce;}_0x3d2f72[_0x1420('0x17')](_0x402025);return _0x3d2f72[_0x1420('0x1d')]('Content-Range',_0x47bea3+'-'+_0x137b75+'/'+_0x3b4bfd)['json'](_0x4c0d87);}return null;};}function patchUpdates(_0x410abb){return function(_0x5c6237){try{jsonpatch[_0x1420('0x1e')](_0x5c6237,_0x410abb,!![]);}catch(_0x3ca369){return BPromise[_0x1420('0x1f')](_0x3ca369);}return _0x5c6237[_0x1420('0x20')]();};}function saveUpdates(_0x29dd25,_0x51a127){return function(_0x3d5da7){if(_0x3d5da7){return _0x3d5da7[_0x1420('0x21')](_0x29dd25)[_0x1420('0x22')](function(_0x17a648){return _0x17a648;});}return null;};}function removeEntity(_0x121e7e,_0xd66521){return function(_0x4ba326){if(_0x4ba326){return _0x4ba326['destroy']()['then'](function(){_0x121e7e[_0x1420('0x17')](0xcc)[_0x1420('0x23')]();});}};}function handleEntityNotFound(_0x8d03e9,_0x32db04){return function(_0x32710e){if(!_0x32710e){_0x8d03e9['sendStatus'](0x194);}return _0x32710e;};}function handleError(_0x5776ef,_0xabedea){_0xabedea=_0xabedea||0x1f4;return function(_0x205d1a){logger[_0x1420('0x24')](_0x205d1a[_0x1420('0x25')]);if(_0x205d1a[_0x1420('0x26')]){delete _0x205d1a[_0x1420('0x26')];}_0x5776ef['status'](_0xabedea)[_0x1420('0x27')](_0x205d1a);};}exports[_0x1420('0x28')]=function(_0x36ff7c,_0x3750ea){var _0x49e037={},_0x26e523={},_0x2a25fd={'count':0x0,'rows':[]};var _0x3dba65=_[_0x1420('0x29')](db['WhatsappApplication'][_0x1420('0x2a')],function(_0xc40952){return{'name':_0xc40952[_0x1420('0x2b')],'type':_0xc40952[_0x1420('0x2c')][_0x1420('0x2d')]};});_0x26e523[_0x1420('0x2e')]=_[_0x1420('0x29')](_0x3dba65,_0x1420('0x26'));_0x26e523[_0x1420('0x2f')]=_[_0x1420('0x30')](_0x36ff7c[_0x1420('0x2f')]);_0x26e523[_0x1420('0x31')]=_['intersection'](_0x26e523[_0x1420('0x2e')],_0x26e523[_0x1420('0x2f')]);_0x49e037[_0x1420('0x32')]=_[_0x1420('0x33')](_0x26e523[_0x1420('0x2e')],qs['fields'](_0x36ff7c[_0x1420('0x2f')][_0x1420('0x34')]));_0x49e037['attributes']=_0x49e037[_0x1420('0x32')]['length']?_0x49e037['attributes']:_0x26e523['model'];if(!_0x36ff7c[_0x1420('0x2f')][_0x1420('0x35')](_0x1420('0x36'))){_0x49e037[_0x1420('0x19')]=qs[_0x1420('0x19')](_0x36ff7c[_0x1420('0x2f')]['limit']);_0x49e037[_0x1420('0x1c')]=qs[_0x1420('0x1c')](_0x36ff7c['query'][_0x1420('0x1c')]);}_0x49e037[_0x1420('0x37')]=qs[_0x1420('0x38')](_0x36ff7c[_0x1420('0x2f')][_0x1420('0x38')]);_0x49e037[_0x1420('0x39')]=qs[_0x1420('0x31')](_[_0x1420('0x3a')](_0x36ff7c['query'],_0x26e523[_0x1420('0x31')]),_0x3dba65);if(_0x36ff7c[_0x1420('0x2f')][_0x1420('0x3b')]){_0x49e037[_0x1420('0x39')]=_[_0x1420('0x3c')](_0x49e037['where'],{'$or':_[_0x1420('0x29')](_0x3dba65,function(_0x4f6be8){if(_0x4f6be8[_0x1420('0x2c')]!==_0x1420('0x3d')){var _0x50f999={};_0x50f999[_0x4f6be8[_0x1420('0x26')]]={'$like':'%'+_0x36ff7c[_0x1420('0x2f')][_0x1420('0x3b')]+'%'};return _0x50f999;}})});}_0x49e037=_[_0x1420('0x3c')]({},_0x49e037,_0x36ff7c[_0x1420('0x3e')]);var _0x5e88f5={'where':_0x49e037['where']};return db[_0x1420('0x3f')][_0x1420('0x1b')](_0x5e88f5)[_0x1420('0x22')](function(_0x29b19f){_0x2a25fd['count']=_0x29b19f;if(_0x36ff7c[_0x1420('0x2f')][_0x1420('0x40')]){_0x49e037[_0x1420('0x41')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x49e037);})[_0x1420('0x22')](function(_0x538a15){_0x2a25fd['rows']=_0x538a15;return _0x2a25fd;})[_0x1420('0x22')](respondWithFilteredResult(_0x3750ea,_0x49e037))[_0x1420('0x42')](handleError(_0x3750ea,null));};exports[_0x1420('0x43')]=function(_0x53be7a,_0x35b658){var _0x4f318b={'raw':!![],'where':{'id':_0x53be7a[_0x1420('0x44')]['id']}},_0x521d2a={};_0x521d2a[_0x1420('0x2e')]=_[_0x1420('0x30')](db['WhatsappApplication']['rawAttributes']);_0x521d2a[_0x1420('0x2f')]=_[_0x1420('0x30')](_0x53be7a['query']);_0x521d2a[_0x1420('0x31')]=_[_0x1420('0x33')](_0x521d2a[_0x1420('0x2e')],_0x521d2a[_0x1420('0x2f')]);_0x4f318b['attributes']=_[_0x1420('0x33')](_0x521d2a[_0x1420('0x2e')],qs[_0x1420('0x34')](_0x53be7a[_0x1420('0x2f')]['fields']));_0x4f318b[_0x1420('0x32')]=_0x4f318b[_0x1420('0x32')][_0x1420('0x45')]?_0x4f318b['attributes']:_0x521d2a['model'];if(_0x53be7a[_0x1420('0x2f')][_0x1420('0x40')]){_0x4f318b['include']=[{'all':!![]}];}_0x4f318b=_['merge']({},_0x4f318b,_0x53be7a[_0x1420('0x3e')]);return db[_0x1420('0x3f')][_0x1420('0x46')](_0x4f318b)[_0x1420('0x22')](handleEntityNotFound(_0x35b658,null))[_0x1420('0x22')](respondWithResult(_0x35b658,null))['catch'](handleError(_0x35b658,null));};exports[_0x1420('0x47')]=function(_0x1122fd,_0x2c7542){return db[_0x1420('0x3f')][_0x1420('0x47')](_0x1122fd['body'],{})[_0x1420('0x22')](respondWithResult(_0x2c7542,0xc9))[_0x1420('0x42')](handleError(_0x2c7542,null));};exports[_0x1420('0x21')]=function(_0x2ee8c5,_0xaae370){if(_0x2ee8c5['body']['id']){delete _0x2ee8c5['body']['id'];}return db[_0x1420('0x3f')][_0x1420('0x46')]({'where':{'id':_0x2ee8c5[_0x1420('0x44')]['id']}})[_0x1420('0x22')](handleEntityNotFound(_0xaae370,null))[_0x1420('0x22')](saveUpdates(_0x2ee8c5[_0x1420('0x48')],null))[_0x1420('0x22')](respondWithResult(_0xaae370,null))[_0x1420('0x42')](handleError(_0xaae370,null));};exports['destroy']=function(_0x54ec70,_0x23a3a7){return db[_0x1420('0x3f')][_0x1420('0x46')]({'where':{'id':_0x54ec70[_0x1420('0x44')]['id']}})[_0x1420('0x22')](handleEntityNotFound(_0x23a3a7,null))[_0x1420('0x22')](removeEntity(_0x23a3a7,null))[_0x1420('0x42')](handleError(_0x23a3a7,null));}; \ No newline at end of file +var _0x27fb=['map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','stack','name','index','WhatsappApplication','rawAttributes','fieldName','key','model'];(function(_0x39944f,_0x33fd8a){var _0x461dc6=function(_0xaf0e3f){while(--_0xaf0e3f){_0x39944f['push'](_0x39944f['shift']());}};_0x461dc6(++_0x33fd8a);}(_0x27fb,0x1de));var _0xb27f=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x27fb[_0x35f7f5];return _0x5567a4;};'use strict';var emlformat=require(_0xb27f('0x0'));var rimraf=require(_0xb27f('0x1'));var zipdir=require(_0xb27f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb27f('0x3'));var moment=require('moment');var BPromise=require(_0xb27f('0x4'));var Mustache=require(_0xb27f('0x5'));var util=require(_0xb27f('0x6'));var path=require('path');var sox=require(_0xb27f('0x7'));var csv=require('to-csv');var ejs=require(_0xb27f('0x8'));var fs=require('fs');var fs_extra=require(_0xb27f('0x9'));var _=require(_0xb27f('0xa'));var squel=require(_0xb27f('0xb'));var crypto=require(_0xb27f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb27f('0xd'));var toCsv=require(_0xb27f('0xe'));var querystring=require('querystring');var Papa=require(_0xb27f('0xf'));var Redis=require(_0xb27f('0x10'));var authService=require(_0xb27f('0x11'));var qs=require(_0xb27f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb27f('0x13'));var logger=require(_0xb27f('0x14'))('api');var utils=require(_0xb27f('0x15'));var config=require(_0xb27f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb27f('0x17'))['db'];function respondWithStatusCode(_0x3c8e49,_0x3df902){_0x3df902=_0x3df902||0xcc;return function(_0x1971bb){if(_0x1971bb){return _0x3c8e49[_0xb27f('0x18')](_0x3df902);}return _0x3c8e49[_0xb27f('0x19')](_0x3df902)['end']();};}function respondWithResult(_0x434e15,_0x4c35a0){_0x4c35a0=_0x4c35a0||0xc8;return function(_0x1bc3b3){if(_0x1bc3b3){return _0x434e15['status'](_0x4c35a0)[_0xb27f('0x1a')](_0x1bc3b3);}};}function respondWithFilteredResult(_0x2c9fb9,_0x24dd7b){return function(_0x11155b){if(_0x11155b){var _0x33520b=typeof _0x24dd7b['offset']===_0xb27f('0x1b')&&typeof _0x24dd7b[_0xb27f('0x1c')]===_0xb27f('0x1b');var _0xfc4bd0=_0x11155b[_0xb27f('0x1d')];var _0xb126c6=_0x33520b?0x0:_0x24dd7b[_0xb27f('0x1e')];var _0x559cf4=_0x33520b?_0x11155b[_0xb27f('0x1d')]:_0x24dd7b[_0xb27f('0x1e')]+_0x24dd7b[_0xb27f('0x1c')];var _0x4b8be9;if(_0x559cf4>=_0xfc4bd0){_0x559cf4=_0xfc4bd0;_0x4b8be9=0xc8;}else{_0x4b8be9=0xce;}_0x2c9fb9[_0xb27f('0x19')](_0x4b8be9);return _0x2c9fb9[_0xb27f('0x1f')]('Content-Range',_0xb126c6+'-'+_0x559cf4+'/'+_0xfc4bd0)[_0xb27f('0x1a')](_0x11155b);}return null;};}function patchUpdates(_0x26090c){return function(_0x34b5ae){try{jsonpatch[_0xb27f('0x20')](_0x34b5ae,_0x26090c,!![]);}catch(_0x88a06d){return BPromise[_0xb27f('0x21')](_0x88a06d);}return _0x34b5ae[_0xb27f('0x22')]();};}function saveUpdates(_0x578c3d,_0x3a70c9){return function(_0x5303ac){if(_0x5303ac){return _0x5303ac[_0xb27f('0x23')](_0x578c3d)[_0xb27f('0x24')](function(_0x1e6abf){return _0x1e6abf;});}return null;};}function removeEntity(_0x56e3cd,_0xb68ac0){return function(_0x59b315){if(_0x59b315){return _0x59b315[_0xb27f('0x25')]()['then'](function(){_0x56e3cd['status'](0xcc)[_0xb27f('0x26')]();});}};}function handleEntityNotFound(_0x5b79c7,_0x41834b){return function(_0x20e85d){if(!_0x20e85d){_0x5b79c7['sendStatus'](0x194);}return _0x20e85d;};}function handleError(_0x915737,_0x3fd1a5){_0x3fd1a5=_0x3fd1a5||0x1f4;return function(_0x2bfae9){logger['error'](_0x2bfae9[_0xb27f('0x27')]);if(_0x2bfae9[_0xb27f('0x28')]){delete _0x2bfae9[_0xb27f('0x28')];}_0x915737[_0xb27f('0x19')](_0x3fd1a5)['send'](_0x2bfae9);};}exports[_0xb27f('0x29')]=function(_0x57cf52,_0xcf8c7a){var _0x443641={},_0x4ce30d={},_0x4caf5a={'count':0x0,'rows':[]};var _0x1adeec=_['map'](db[_0xb27f('0x2a')][_0xb27f('0x2b')],function(_0x13f2cc){return{'name':_0x13f2cc[_0xb27f('0x2c')],'type':_0x13f2cc['type'][_0xb27f('0x2d')]};});_0x4ce30d[_0xb27f('0x2e')]=_[_0xb27f('0x2f')](_0x1adeec,_0xb27f('0x28'));_0x4ce30d[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0x57cf52[_0xb27f('0x30')]);_0x4ce30d[_0xb27f('0x32')]=_[_0xb27f('0x33')](_0x4ce30d[_0xb27f('0x2e')],_0x4ce30d[_0xb27f('0x30')]);_0x443641[_0xb27f('0x34')]=_[_0xb27f('0x33')](_0x4ce30d[_0xb27f('0x2e')],qs[_0xb27f('0x35')](_0x57cf52[_0xb27f('0x30')]['fields']));_0x443641['attributes']=_0x443641[_0xb27f('0x34')]['length']?_0x443641[_0xb27f('0x34')]:_0x4ce30d['model'];if(!_0x57cf52[_0xb27f('0x30')]['hasOwnProperty'](_0xb27f('0x36'))){_0x443641[_0xb27f('0x1c')]=qs[_0xb27f('0x1c')](_0x57cf52['query'][_0xb27f('0x1c')]);_0x443641[_0xb27f('0x1e')]=qs['offset'](_0x57cf52[_0xb27f('0x30')][_0xb27f('0x1e')]);}_0x443641[_0xb27f('0x37')]=qs[_0xb27f('0x38')](_0x57cf52[_0xb27f('0x30')]['sort']);_0x443641[_0xb27f('0x39')]=qs[_0xb27f('0x32')](_[_0xb27f('0x3a')](_0x57cf52[_0xb27f('0x30')],_0x4ce30d[_0xb27f('0x32')]),_0x1adeec);if(_0x57cf52['query'][_0xb27f('0x3b')]){_0x443641['where']=_[_0xb27f('0x3c')](_0x443641[_0xb27f('0x39')],{'$or':_[_0xb27f('0x2f')](_0x1adeec,function(_0x5a606f){if(_0x5a606f[_0xb27f('0x3d')]!==_0xb27f('0x3e')){var _0x4ab5de={};_0x4ab5de[_0x5a606f[_0xb27f('0x28')]]={'$like':'%'+_0x57cf52['query'][_0xb27f('0x3b')]+'%'};return _0x4ab5de;}})});}_0x443641=_['merge']({},_0x443641,_0x57cf52[_0xb27f('0x3f')]);var _0x47bd52={'where':_0x443641['where']};return db[_0xb27f('0x2a')][_0xb27f('0x1d')](_0x47bd52)[_0xb27f('0x24')](function(_0x2892a6){_0x4caf5a[_0xb27f('0x1d')]=_0x2892a6;if(_0x57cf52[_0xb27f('0x30')][_0xb27f('0x40')]){_0x443641[_0xb27f('0x41')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xb27f('0x42')](_0x443641);})[_0xb27f('0x24')](function(_0x3d6a2c){_0x4caf5a[_0xb27f('0x43')]=_0x3d6a2c;return _0x4caf5a;})[_0xb27f('0x24')](respondWithFilteredResult(_0xcf8c7a,_0x443641))[_0xb27f('0x44')](handleError(_0xcf8c7a,null));};exports[_0xb27f('0x45')]=function(_0x4823e8,_0x534826){var _0x31cbc2={'raw':!![],'where':{'id':_0x4823e8['params']['id']}},_0x5cd045={};_0x5cd045[_0xb27f('0x2e')]=_['keys'](db[_0xb27f('0x2a')]['rawAttributes']);_0x5cd045[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0x4823e8[_0xb27f('0x30')]);_0x5cd045[_0xb27f('0x32')]=_[_0xb27f('0x33')](_0x5cd045[_0xb27f('0x2e')],_0x5cd045[_0xb27f('0x30')]);_0x31cbc2[_0xb27f('0x34')]=_[_0xb27f('0x33')](_0x5cd045[_0xb27f('0x2e')],qs[_0xb27f('0x35')](_0x4823e8[_0xb27f('0x30')][_0xb27f('0x35')]));_0x31cbc2[_0xb27f('0x34')]=_0x31cbc2[_0xb27f('0x34')][_0xb27f('0x46')]?_0x31cbc2['attributes']:_0x5cd045[_0xb27f('0x2e')];if(_0x4823e8['query'][_0xb27f('0x40')]){_0x31cbc2['include']=[{'all':!![]}];}_0x31cbc2=_['merge']({},_0x31cbc2,_0x4823e8[_0xb27f('0x3f')]);return db['WhatsappApplication'][_0xb27f('0x47')](_0x31cbc2)[_0xb27f('0x24')](handleEntityNotFound(_0x534826,null))[_0xb27f('0x24')](respondWithResult(_0x534826,null))[_0xb27f('0x44')](handleError(_0x534826,null));};exports['create']=function(_0x33ba5d,_0x56dc81){return db[_0xb27f('0x2a')][_0xb27f('0x48')](_0x33ba5d['body'],{})[_0xb27f('0x24')](respondWithResult(_0x56dc81,0xc9))[_0xb27f('0x44')](handleError(_0x56dc81,null));};exports['update']=function(_0xd9fc18,_0x2b0c77){if(_0xd9fc18[_0xb27f('0x49')]['id']){delete _0xd9fc18[_0xb27f('0x49')]['id'];}return db[_0xb27f('0x2a')][_0xb27f('0x47')]({'where':{'id':_0xd9fc18[_0xb27f('0x4a')]['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x2b0c77,null))['then'](saveUpdates(_0xd9fc18[_0xb27f('0x49')],null))[_0xb27f('0x24')](respondWithResult(_0x2b0c77,null))[_0xb27f('0x44')](handleError(_0x2b0c77,null));};exports[_0xb27f('0x25')]=function(_0x2867ff,_0x33d76f){return db[_0xb27f('0x2a')][_0xb27f('0x47')]({'where':{'id':_0x2867ff[_0xb27f('0x4a')]['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x33d76f,null))[_0xb27f('0x24')](removeEntity(_0x33d76f,null))['catch'](handleError(_0x33d76f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ee01e84..9573874 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 _0x032a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications'];(function(_0x2d1d93,_0x1d59fb){var _0x541973=function(_0xa95b0f){while(--_0xa95b0f){_0x2d1d93['push'](_0x2d1d93['shift']());}};_0x541973(++_0x1d59fb);}(_0x032a,0xf0));var _0xa032=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x032a[_0x5f46e7];return _0x567e95;};'use strict';var _=require('lodash');var util=require(_0xa032('0x0'));var logger=require('../../config/logger')(_0xa032('0x1'));var moment=require(_0xa032('0x2'));var BPromise=require(_0xa032('0x3'));var rp=require(_0xa032('0x4'));var fs=require('fs');var path=require(_0xa032('0x5'));var rimraf=require(_0xa032('0x6'));var config=require(_0xa032('0x7'));var attributes=require(_0xa032('0x8'));module[_0xa032('0x9')]=function(_0x2b1445,_0x43d0f5){return _0x2b1445[_0xa032('0xa')]('WhatsappApplication',attributes,{'tableName':_0xa032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd51f=['lodash','util','api','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x17c938,_0x557096){var _0x2d22b2=function(_0x5efcfd){while(--_0x5efcfd){_0x17c938['push'](_0x17c938['shift']());}};_0x2d22b2(++_0x557096);}(_0xd51f,0xf0));var _0xfd51=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd51f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var logger=require('../../config/logger')(_0xfd51('0x2'));var moment=require(_0xfd51('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd51('0x4'));var fs=require('fs');var path=require(_0xfd51('0x5'));var rimraf=require('rimraf');var config=require(_0xfd51('0x6'));var attributes=require(_0xfd51('0x7'));module['exports']=function(_0x3e3517,_0x3a2cd4){return _0x3e3517['define'](_0xfd51('0x8'),attributes,{'tableName':_0xfd51('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfd51('0xa'),'collate':_0xfd51('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9b9ab9c..3e6c7e1 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e9586,_0x36778e){var _0x4a167f=function(_0x560eb3){while(--_0x560eb3){_0x1e9586['push'](_0x1e9586['shift']());}};_0x4a167f(++_0x36778e);}(_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 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']('WhatsappApplication,\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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3d12cd,_0x3309e1){var _0x2fef91=function(_0x26d8b1){while(--_0x26d8b1){_0x3d12cd['push'](_0x3d12cd['shift']());}};_0x2fef91(++_0x3309e1);}(_0x54ef,0x112));var _0xf54e=function(_0x36e46e,_0x5249d1){_0x36e46e=_0x36e46e-0x0;var _0x417345=_0x54ef[_0x36e46e];return _0x417345;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index fb3cb0c..338cc5d 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 _0x323f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','put','update','delete','whatsappinteraction:destroy','destroy','removeTags','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x323f,0x1ee));var _0xf323=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x323f[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0x9')](_0xf323('0xf'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x9')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x13')]('/',auth['isAuthenticated'](),controller[_0xf323('0x14')]);router[_0xf323('0x13')](_0xf323('0xf'),auth['isAuthenticated'](),controller[_0xf323('0x15')]);router[_0xf323('0x13')](_0xf323('0x16'),auth[_0xf323('0xa')](),interaction[_0xf323('0x17')](_0xf323('0x18'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xf323('0x19')](_0xf323('0xd'),auth[_0xf323('0xa')](),interaction[_0xf323('0x17')](_0xf323('0x18'),'whatsappinteraction:update'),controller[_0xf323('0x1a')]);router[_0xf323('0x1b')](_0xf323('0xd'),auth[_0xf323('0xa')](),interaction['tracked'](_0xf323('0x18'),_0xf323('0x1c')),controller[_0xf323('0x1d')]);router[_0xf323('0x1b')]('/:id/tags',auth[_0xf323('0xa')](),controller[_0xf323('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x7d9f=['isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get'];(function(_0x1fdc54,_0x58e062){var _0x1e2c4f=function(_0x56ad1f){while(--_0x56ad1f){_0x1fdc54['push'](_0x1fdc54['shift']());}};_0x1e2c4f(++_0x58e062);}(_0x7d9f,0x15c));var _0xf7d9=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x7d9f[_0xd816e2];return _0x1f5924;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf7d9('0x10')]);router[_0xf7d9('0xb')](_0xf7d9('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xf7d9('0x12')]('/',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x13')]);router[_0xf7d9('0x12')]('/:id/messages',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x14')]);router[_0xf7d9('0x12')](_0xf7d9('0x15'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),_0xf7d9('0x18')),controller[_0xf7d9('0x19')]);router['put'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),interaction[_0xf7d9('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0xf7d9('0x1a')]);router[_0xf7d9('0x1b')](_0xf7d9('0xe'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),'whatsappinteraction:destroy'),controller[_0xf7d9('0x1c')]);router['delete'](_0xf7d9('0x15'),auth[_0xf7d9('0xc')](),controller['removeTags']);module[_0xf7d9('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 e7e56b3..89fa666 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 _0xf722=['moment','exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x4d121d,_0x3fe733){var _0xffa031=function(_0x1fec1b){while(--_0x1fec1b){_0x4d121d['push'](_0x4d121d['shift']());}};_0xffa031(++_0x3fe733);}(_0xf722,0x18f));var _0x2f72=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf722[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x2f72('0x0'));var moment=require(_0x2f72('0x1'));module[_0x2f72('0x2')]={'closed':{'type':Sequelize[_0x2f72('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2f72('0x4')]},'secondDisposition':{'type':Sequelize[_0x2f72('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2f72('0x4')]},'note':{'type':Sequelize[_0x2f72('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2f72('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x2f72('0x6')]('in',_0x2f72('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2f72('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2f72('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9b6d=['ENUM','out','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x210072,_0x576f21){var _0x5cd169=function(_0x8f2e38){while(--_0x8f2e38){_0x210072['push'](_0x210072['shift']());}};_0x5cd169(++_0x576f21);}(_0x9b6d,0x105));var _0xd9b6=function(_0x6614c2,_0x489984){_0x6614c2=_0x6614c2-0x0;var _0x462ae0=_0x9b6d[_0x6614c2];return _0x462ae0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd9b6('0x0'));module[_0xd9b6('0x1')]={'closed':{'type':Sequelize[_0xd9b6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd9b6('0x3')]},'disposition':{'type':Sequelize[_0xd9b6('0x4')]},'secondDisposition':{'type':Sequelize[_0xd9b6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd9b6('0x4')]},'note':{'type':Sequelize[_0xd9b6('0x4')]},'phone':{'type':Sequelize[_0xd9b6('0x4')]},'read1stAt':{'type':Sequelize[_0xd9b6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd9b6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd9b6('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd9b6('0x5')]('in',_0xd9b6('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd9b6('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index fed6be1..549cb4b 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 _0xabc4=['getOptions','findAll','whatsapp','query','user','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','then','create','body','catch','find','destroy','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','nolimit','where','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','Tag','color','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Account','push','Owner','get','mkdirSync','N.A.','closedAt','basename','createReadStream','pipe','createWriteStream','out','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','status','json','undefined','limit','count','offset','update','sendStatus','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key'];(function(_0x557b0e,_0x4cb914){var _0x437a9f=function(_0x7b93e0){while(--_0x7b93e0){_0x557b0e['push'](_0x557b0e['shift']());}};_0x437a9f(++_0x4cb914);}(_0xabc4,0x146));var _0x4abc=function(_0x45cdf2,_0x48753c){_0x45cdf2=_0x45cdf2-0x0;var _0xf809ce=_0xabc4[_0x45cdf2];return _0xf809ce;};'use strict';var rimraf=require(_0x4abc('0x0'));var zipdir=require(_0x4abc('0x1'));var moment=require('moment');var BPromise=require(_0x4abc('0x2'));var util=require(_0x4abc('0x3'));var path=require(_0x4abc('0x4'));var ejs=require(_0x4abc('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4abc('0x6'));var interaction=require(_0x4abc('0x7'));var qs=require(_0x4abc('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x4abc('0x9'))(_0x4abc('0xa'));var config=require(_0x4abc('0xb'));var db=require(_0x4abc('0xc'))['db'];config[_0x4abc('0xd')]=_[_0x4abc('0xe')](config[_0x4abc('0xd')],{'host':_0x4abc('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4abc('0x10'))[_0x4abc('0x11')](socket);function respondWithStatusCode(_0x1b7752,_0x4dfded){_0x4dfded=_0x4dfded||0xcc;return function(_0x4936f4){if(_0x4936f4){return _0x1b7752['sendStatus'](_0x4dfded);}return _0x1b7752[_0x4abc('0x12')](_0x4dfded)['end']();};}function respondWithResult(_0x3e88c6,_0x2ea6a5){_0x2ea6a5=_0x2ea6a5||0xc8;return function(_0x583ff6){if(_0x583ff6){return _0x3e88c6[_0x4abc('0x12')](_0x2ea6a5)[_0x4abc('0x13')](_0x583ff6);}};}function respondWithFilteredResult(_0x4a5dae,_0x361803){return function(_0x2b2454){if(_0x2b2454){var _0x186e91=typeof _0x361803['offset']===_0x4abc('0x14')&&typeof _0x361803[_0x4abc('0x15')]===_0x4abc('0x14');var _0x52dd0b=_0x2b2454[_0x4abc('0x16')];var _0x4e2c8c=_0x186e91?0x0:_0x361803[_0x4abc('0x17')];var _0x3ce8ea=_0x186e91?_0x2b2454[_0x4abc('0x16')]:_0x361803[_0x4abc('0x17')]+_0x361803[_0x4abc('0x15')];var _0x37a398;if(_0x3ce8ea>=_0x52dd0b){_0x3ce8ea=_0x52dd0b;_0x37a398=0xc8;}else{_0x37a398=0xce;}_0x4a5dae['status'](_0x37a398);return _0x4a5dae['set']('Content-Range',_0x4e2c8c+'-'+_0x3ce8ea+'/'+_0x52dd0b)['json'](_0x2b2454);}return null;};}function saveUpdates(_0x56c92b){return function(_0x5aafd7){if(_0x5aafd7){return _0x5aafd7[_0x4abc('0x18')](_0x56c92b)['then'](function(_0x5db0b4){return _0x5db0b4;});}return null;};}function removeEntity(_0x3bdd49){return function(_0x2ec9c8){if(_0x2ec9c8){return _0x2ec9c8['destroy']()['then'](function(){_0x3bdd49['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ba142){return function(_0x5cfe86){if(!_0x5cfe86){_0x5ba142[_0x4abc('0x19')](0x194);}return _0x5cfe86;};}function handleError(_0x59eeba,_0x50131c){_0x50131c=_0x50131c||0x1f4;return function(_0x3a987f){logger[_0x4abc('0x1a')](_0x3a987f[_0x4abc('0x1b')]);if(_0x3a987f[_0x4abc('0x1c')]){delete _0x3a987f[_0x4abc('0x1c')];}_0x59eeba[_0x4abc('0x12')](_0x50131c)[_0x4abc('0x1d')](_0x3a987f);};}exports[_0x4abc('0x1e')]=function(_0x60e2c9,_0x3b9ae7){var _0x11f221={};var _0x585348=_[_0x4abc('0x1f')](db[_0x4abc('0x20')][_0x4abc('0x21')],function(_0x3626be){return{'name':_0x3626be[_0x4abc('0x22')],'type':_0x3626be[_0x4abc('0x23')][_0x4abc('0x24')]};});_0x11f221=qs[_0x4abc('0x25')](_0x585348,_0x60e2c9);return interaction[_0x4abc('0x26')](_0x4abc('0x27'),_0x60e2c9[_0x4abc('0x28')],_0x60e2c9[_0x4abc('0x29')],_0x11f221,_0x585348)['then'](respondWithFilteredResult(_0x3b9ae7,_0x11f221))['catch'](handleError(_0x3b9ae7,null));};exports[_0x4abc('0x2a')]=function(_0x27178b,_0xa95159){var _0x2bb99e={'raw':![],'where':{'id':_0x27178b[_0x4abc('0x2b')]['id']}},_0x4b40b4={};_0x4b40b4[_0x4abc('0x2c')]=_[_0x4abc('0x2d')](db[_0x4abc('0x20')][_0x4abc('0x21')]);_0x4b40b4['query']=_[_0x4abc('0x2d')](_0x27178b[_0x4abc('0x28')]);_0x4b40b4[_0x4abc('0x2e')]=_['intersection'](_0x4b40b4[_0x4abc('0x2c')],_0x4b40b4[_0x4abc('0x28')]);_0x2bb99e[_0x4abc('0x2f')]=_[_0x4abc('0x30')](_0x4b40b4['model'],qs[_0x4abc('0x31')](_0x27178b[_0x4abc('0x28')]['fields']));_0x2bb99e[_0x4abc('0x2f')]=_0x2bb99e[_0x4abc('0x2f')][_0x4abc('0x32')]?_0x2bb99e[_0x4abc('0x2f')]:_0x4b40b4[_0x4abc('0x2c')];if(_0x27178b['query'][_0x4abc('0x33')]){_0x2bb99e['include']=[{'all':!![]}];}_0x2bb99e=_[_0x4abc('0x34')]({},_0x2bb99e,_0x27178b[_0x4abc('0x35')]);return db['WhatsappInteraction']['find'](_0x2bb99e)[_0x4abc('0x36')](handleEntityNotFound(_0xa95159,null))[_0x4abc('0x36')](respondWithResult(_0xa95159,null))['catch'](handleError(_0xa95159,null));};exports[_0x4abc('0x37')]=function(_0x49e8e4,_0x268338){return db[_0x4abc('0x20')][_0x4abc('0x37')](_0x49e8e4[_0x4abc('0x38')],{})['then'](respondWithResult(_0x268338,0xc9))[_0x4abc('0x39')](handleError(_0x268338,null));};exports[_0x4abc('0x18')]=function(_0x1d5666,_0x216808){if(_0x1d5666[_0x4abc('0x38')]['id']){delete _0x1d5666['body']['id'];}return db['WhatsappInteraction'][_0x4abc('0x3a')]({'where':{'id':_0x1d5666[_0x4abc('0x2b')]['id']}})[_0x4abc('0x36')](handleEntityNotFound(_0x216808,null))[_0x4abc('0x36')](saveUpdates(_0x1d5666[_0x4abc('0x38')],null))[_0x4abc('0x36')](respondWithResult(_0x216808,null))[_0x4abc('0x39')](handleError(_0x216808,null));};exports[_0x4abc('0x3b')]=function(_0x18b9be,_0xd20b99){return db[_0x4abc('0x20')]['find']({'where':{'id':_0x18b9be[_0x4abc('0x2b')]['id']}})[_0x4abc('0x36')](handleEntityNotFound(_0xd20b99,null))['then'](removeEntity(_0xd20b99,null))[_0x4abc('0x39')](handleError(_0xd20b99,null));};exports[_0x4abc('0x3c')]=function(_0x29f0a5,_0x59d2bb){return db[_0x4abc('0x20')][_0x4abc('0x3c')]()[_0x4abc('0x36')](respondWithResult(_0x59d2bb,null))[_0x4abc('0x39')](handleError(_0x59d2bb,null));};exports[_0x4abc('0x3d')]=function(_0x25ab2f,_0x361e8f){return db[_0x4abc('0x3e')][_0x4abc('0x3a')]({'where':{'id':_0x25ab2f[_0x4abc('0x2b')]['id']}})[_0x4abc('0x36')](handleEntityNotFound(_0x361e8f,null))[_0x4abc('0x36')](function(_0x1ea9de){if(_0x1ea9de){return _0x1ea9de[_0x4abc('0x3d')](_0x25ab2f['body'][_0x4abc('0x3f')],_['omit'](_0x25ab2f[_0x4abc('0x38')],['ids','id'])||{});}})[_0x4abc('0x36')](respondWithResult(_0x361e8f,null))[_0x4abc('0x39')](handleError(_0x361e8f,null));};exports[_0x4abc('0x40')]=function(_0x3f3365,_0xf0923c){var _0xc5aac4={'raw':![],'where':{}};var _0x1527d4={};var _0x40ceae={'count':0x0,'rows':[]};return db[_0x4abc('0x20')][_0x4abc('0x41')]({'where':{'id':_0x3f3365['params']['id']}})[_0x4abc('0x36')](handleEntityNotFound(_0xf0923c,null))[_0x4abc('0x36')](function(_0x23d91d){if(_0x23d91d){_0x1527d4[_0x4abc('0x2c')]=_[_0x4abc('0x2d')](db[_0x4abc('0x3e')][_0x4abc('0x21')]);_0x1527d4['query']=_[_0x4abc('0x2d')](_0x3f3365[_0x4abc('0x28')]);_0x1527d4['filters']=_['intersection'](_0x1527d4['model'],_0x1527d4[_0x4abc('0x28')]);_0xc5aac4[_0x4abc('0x2f')]=_[_0x4abc('0x30')](_0x1527d4[_0x4abc('0x2c')],qs[_0x4abc('0x31')](_0x3f3365[_0x4abc('0x28')]['fields']));_0xc5aac4[_0x4abc('0x2f')]=_0xc5aac4[_0x4abc('0x2f')][_0x4abc('0x32')]?_0xc5aac4[_0x4abc('0x2f')]:_0x1527d4[_0x4abc('0x2c')];if(!_0x3f3365[_0x4abc('0x28')]['hasOwnProperty'](_0x4abc('0x42'))){_0xc5aac4[_0x4abc('0x15')]=qs[_0x4abc('0x15')](_0x3f3365[_0x4abc('0x28')][_0x4abc('0x15')]);_0xc5aac4[_0x4abc('0x17')]=qs['offset'](_0x3f3365[_0x4abc('0x28')][_0x4abc('0x17')]);}_0xc5aac4['order']=qs['sort'](_0x3f3365['query']['sort']);_0xc5aac4[_0x4abc('0x43')]=qs[_0x4abc('0x2e')](_['pick'](_0x3f3365['query'],_0x1527d4[_0x4abc('0x2e')]));_0xc5aac4[_0x4abc('0x43')][_0x4abc('0x44')]=_0x23d91d['id'];if(_0x3f3365[_0x4abc('0x28')][_0x4abc('0x45')]){_0xc5aac4[_0x4abc('0x43')]=_[_0x4abc('0x34')](_0xc5aac4[_0x4abc('0x43')],{'$or':_[_0x4abc('0x1f')](_0xc5aac4['attributes'],function(_0x3b4876){var _0x477c48={};_0x477c48[_0x3b4876]={'$like':'%'+_0x3f3365[_0x4abc('0x28')]['filter']+'%'};return _0x477c48;})});}if(_0x3f3365['query'][_0x4abc('0x46')]){var _0x298901=_0x3f3365[_0x4abc('0x28')][_0x4abc('0x46')]['split'](',');var _0xf11424={};_0xf11424[_0x298901[0x0]]={'$gte':moment(_0x298901[0x1])[_0x4abc('0x47')](_0x4abc('0x48'))};_0xc5aac4['where']=_[_0x4abc('0x34')](_0xc5aac4['where'],_0xf11424);}_0xc5aac4=_[_0x4abc('0x34')]({},_0xc5aac4,_0x3f3365[_0x4abc('0x35')]);return db[_0x4abc('0x3e')]['count']({'where':_0xc5aac4['where']})[_0x4abc('0x36')](function(_0x1c8c77){_0x40ceae[_0x4abc('0x16')]=_0x1c8c77;if(_0x3f3365[_0x4abc('0x28')]['includeAll']){_0xc5aac4[_0x4abc('0x49')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x4abc('0x26')](_0xc5aac4);})['then'](function(_0x4ddc10){_0x40ceae['rows']=_0x4ddc10;return _0x40ceae;});}})[_0x4abc('0x36')](respondWithFilteredResult(_0xf0923c,_0xc5aac4))[_0x4abc('0x39')](handleError(_0xf0923c,null));};exports[_0x4abc('0x4a')]=function(_0x3365a0,_0x4b7e16){return db[_0x4abc('0x20')][_0x4abc('0x3a')]({'where':{'id':_0x3365a0[_0x4abc('0x2b')]['id']}})[_0x4abc('0x36')](handleEntityNotFound(_0x4b7e16,null))['then'](function(_0x2148e2){if(_0x2148e2){return _0x2148e2[_0x4abc('0x4b')](_0x3365a0[_0x4abc('0x38')][_0x4abc('0x3f')],_['omit'](_0x3365a0['body'],[_0x4abc('0x3f'),'id'])||{})['spread'](function(){return db[_0x4abc('0x4c')][_0x4abc('0x26')]({'attributes':['id',_0x4abc('0x1c'),_0x4abc('0x4d')],'where':{'id':_0x3365a0[_0x4abc('0x38')][_0x4abc('0x3f')]}});})[_0x4abc('0x36')](function(_0x5ba4f7){socket['emit'](_0x4abc('0x4e'),{'id':Number(_0x3365a0[_0x4abc('0x2b')]['id']),'tags':_0x5ba4f7||[]});return{'id':Number(_0x3365a0[_0x4abc('0x2b')]['id']),'tags':_0x5ba4f7||[]};});}})[_0x4abc('0x36')](respondWithResult(_0x4b7e16,null))['catch'](handleError(_0x4b7e16,null));};exports[_0x4abc('0x4f')]=function(_0x360c7c,_0x18a51d){return db['WhatsappInteraction'][_0x4abc('0x3a')]({'where':{'id':_0x360c7c[_0x4abc('0x2b')]['id']}})['then'](handleEntityNotFound(_0x18a51d,null))['then'](function(_0x3ba7c4){if(_0x3ba7c4){return _0x3ba7c4[_0x4abc('0x4f')](_0x360c7c[_0x4abc('0x28')][_0x4abc('0x3f')]);}})[_0x4abc('0x36')](respondWithStatusCode(_0x18a51d,null))['catch'](handleError(_0x18a51d,null));};exports['download']=function(_0x865018,_0x3354ad){var _0x457c74=moment()[_0x4abc('0x50')]()[_0x4abc('0x51')]();var _0x49b770=path[_0x4abc('0x52')](config[_0x4abc('0x53')],_0x4abc('0x54'),_0x4abc('0x55'),_0x4abc('0x56'));var _0x1c7ebc=path['join'](config['root'],'server','files',_0x4abc('0x57'));var _0x421d66=path[_0x4abc('0x52')](_0x49b770,_0x457c74);var _0x27de2e=util[_0x4abc('0x47')](_0x4abc('0x58'),_0x865018['params']['id'],_0x457c74);var _0x3a4ea5=path['join'](_0x49b770,_0x27de2e);var _0x13e729=[];_0x13e729['push']({'model':db[_0x4abc('0x59')],'as':_0x4abc('0x59'),'attributes':['id',_0x4abc('0x5a')],'raw':!![]});_0x13e729['push']({'model':db[_0x4abc('0x5b')],'as':_0x4abc('0x5c'),'attributes':['id',_0x4abc('0x5d'),_0x4abc('0x5e')],'raw':!![]});if(_0x865018['query']['attachments']){_0x13e729['push']({'model':db['Attachment'],'as':_0x4abc('0x5f'),'raw':!![]});}var _0x59bd2b=[{'model':db['WhatsappMessage'],'as':_0x4abc('0x60'),'attributes':['id',_0x4abc('0x38'),_0x4abc('0x61'),_0x4abc('0x62'),_0x4abc('0x63'),'read'],'include':_0x13e729}];_0x59bd2b['push']({'model':db['WhatsappAccount'],'as':_0x4abc('0x64'),'attributes':['id','name']});_0x59bd2b[_0x4abc('0x65')]({'model':db[_0x4abc('0x59')],'as':_0x4abc('0x66'),'attributes':['id','fullname']});return db[_0x4abc('0x20')]['find']({'where':{'id':_0x865018[_0x4abc('0x2b')]['id']},'include':_0x59bd2b})[_0x4abc('0x36')](handleEntityNotFound(_0x3354ad,null))['then'](function(_0xa9c963){if(_0xa9c963){var _0x3ce3c5=_0xa9c963[_0x4abc('0x67')]({'plain':!![]});fs[_0x4abc('0x68')](_0x421d66);var _0x5c303c={'channel':'Whatsapp','account':_0x3ce3c5[_0x4abc('0x64')][_0x4abc('0x1c')],'agent':_0x3ce3c5['Owner']?_0x3ce3c5[_0x4abc('0x66')][_0x4abc('0x5a')]:_0x4abc('0x69'),'createdAt':moment(_0x3ce3c5['createdAt'])[_0x4abc('0x47')](_0x4abc('0x48'))[_0x4abc('0x51')](),'closedAt':_0x3ce3c5['closed']?moment(_0x3ce3c5[_0x4abc('0x6a')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3ce3c5['disposition'],'messages':_(_0x3ce3c5[_0x4abc('0x60')])['filter']({'secret':![]})[_0x4abc('0x1f')](function(_0x12f7c5){if(_0x12f7c5[_0x4abc('0x5f')]){var _0x148a1b=path[_0x4abc('0x52')](_0x1c7ebc,_0x12f7c5[_0x4abc('0x5f')][_0x4abc('0x6b')]);if(fs['existsSync'](_0x148a1b)){fs[_0x4abc('0x6c')](_0x148a1b)[_0x4abc('0x6d')](fs[_0x4abc('0x6e')](path[_0x4abc('0x52')](_0x421d66,_0x12f7c5['Attachment'][_0x4abc('0x6b')])));}}return{'date':moment(_0x12f7c5[_0x4abc('0x61')])[_0x4abc('0x47')](_0x4abc('0x48'))[_0x4abc('0x51')](),'sender':_0x12f7c5[_0x4abc('0x62')]===_0x4abc('0x6f')?_0x12f7c5[_0x4abc('0x59')]?_0x12f7c5[_0x4abc('0x59')][_0x4abc('0x5a')]:'System':_0x12f7c5['Contact'][_0x4abc('0x5d')]+(_0x12f7c5[_0x4abc('0x5c')][_0x4abc('0x5e')]?'\x20'+_0x12f7c5[_0x4abc('0x5c')][_0x4abc('0x5e')]:''),'body':_0x12f7c5['Attachment']?_0x12f7c5[_0x4abc('0x5f')]['basename']:_0x12f7c5['body'],'direction':_0x12f7c5[_0x4abc('0x62')]===_0x4abc('0x6f')?'A':'C','secret':_0x12f7c5[_0x4abc('0x63')],'read':_0x12f7c5[_0x4abc('0x70')],'attachment':_0x12f7c5[_0x4abc('0x5f')]};})['value']()};return ejs[_0x4abc('0x71')](path[_0x4abc('0x52')](config[_0x4abc('0x53')],_0x4abc('0x54'),_0x4abc('0x72'),_0x4abc('0x73')),{'interaction':_0x5c303c})[_0x4abc('0x36')](function(_0x228d92){var _0x4d12a4=path[_0x4abc('0x52')](_0x421d66,_0x4abc('0x74')+_0x3ce3c5['id']+'-'+_0x457c74+_0x4abc('0x75'));var _0xe9c3ea={'path':_0x4d12a4,'channel':_0x4abc('0x76'),'interactionId':_0x3ce3c5['id']};return pdf['createPdfFromHTML'](_0x228d92,_0xe9c3ea);})[_0x4abc('0x36')](function(){return new BPromise(function(_0x5d9f59,_0x3316a1){zipdir(_0x421d66,{'saveTo':_0x3a4ea5},function(_0x316c53,_0x391d6d){if(_0x316c53)return _0x3316a1(_0x316c53);return _0x5d9f59(_0x391d6d);});})[_0x4abc('0x36')](function(){return new BPromise(function(_0x4aec46,_0x27496e){rimraf(_0x421d66,function(_0x23963a){if(_0x23963a)_0x27496e(_0x23963a);return _0x4aec46();});});})[_0x4abc('0x36')](function(){return _0x3354ad['download'](_0x3a4ea5,_0x27de2e,function(_0x53e555){if(_0x53e555){console['log'](_0x4abc('0x77'),_0x53e555);}else{fs[_0x4abc('0x78')](_0x3a4ea5);}});});});}else{return _0x3354ad['sendStatus'](0xc8);}})['catch'](handleError(_0x3354ad,null));}; \ No newline at end of file +var _0xcbbf=['index','map','WhatsappInteraction','rawAttributes','getOptions','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','create','body','update','find','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','order','where','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','omit','spread','removeTags','download','unix','join','files','tmp','server','attachments','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','push','Messages','createdAt','secret','WhatsappAccount','name','Owner','get','mkdirSync','Whatsapp','Account','N.A.','toString','closed','closedAt','disposition','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','value','root','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','then','destroy','send'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xcbbf,0x14e));var _0xfcbb=function(_0xe8b204,_0x2caf5d){_0xe8b204=_0xe8b204-0x0;var _0x427e87=_0xcbbf[_0xe8b204];return _0x427e87;};'use strict';var rimraf=require(_0xfcbb('0x0'));var zipdir=require(_0xfcbb('0x1'));var moment=require(_0xfcbb('0x2'));var BPromise=require(_0xfcbb('0x3'));var util=require(_0xfcbb('0x4'));var path=require('path');var ejs=require(_0xfcbb('0x5'));var fs=require('fs');var _=require(_0xfcbb('0x6'));var Redis=require(_0xfcbb('0x7'));var interaction=require(_0xfcbb('0x8'));var qs=require(_0xfcbb('0x9'));var pdf=require(_0xfcbb('0xa'));var logger=require(_0xfcbb('0xb'))(_0xfcbb('0xc'));var config=require('../../config/environment');var db=require(_0xfcbb('0xd'))['db'];config[_0xfcbb('0xe')]=_[_0xfcbb('0xf')](config[_0xfcbb('0xe')],{'host':_0xfcbb('0x10'),'port':0x18eb});var socket=require(_0xfcbb('0x11'))(new Redis(config[_0xfcbb('0xe')]));require(_0xfcbb('0x12'))[_0xfcbb('0x13')](socket);function respondWithStatusCode(_0x3d7544,_0x418074){_0x418074=_0x418074||0xcc;return function(_0xee5258){if(_0xee5258){return _0x3d7544[_0xfcbb('0x14')](_0x418074);}return _0x3d7544[_0xfcbb('0x15')](_0x418074)[_0xfcbb('0x16')]();};}function respondWithResult(_0x379f2b,_0x47eb88){_0x47eb88=_0x47eb88||0xc8;return function(_0x69bc7a){if(_0x69bc7a){return _0x379f2b[_0xfcbb('0x15')](_0x47eb88)[_0xfcbb('0x17')](_0x69bc7a);}};}function respondWithFilteredResult(_0x3e9115,_0x442a69){return function(_0x5a48ea){if(_0x5a48ea){var _0x25bf6d=typeof _0x442a69['offset']===_0xfcbb('0x18')&&typeof _0x442a69[_0xfcbb('0x19')]===_0xfcbb('0x18');var _0x1804b0=_0x5a48ea[_0xfcbb('0x1a')];var _0x1d3913=_0x25bf6d?0x0:_0x442a69[_0xfcbb('0x1b')];var _0x48dda3=_0x25bf6d?_0x5a48ea[_0xfcbb('0x1a')]:_0x442a69['offset']+_0x442a69[_0xfcbb('0x19')];var _0x15f569;if(_0x48dda3>=_0x1804b0){_0x48dda3=_0x1804b0;_0x15f569=0xc8;}else{_0x15f569=0xce;}_0x3e9115[_0xfcbb('0x15')](_0x15f569);return _0x3e9115['set'](_0xfcbb('0x1c'),_0x1d3913+'-'+_0x48dda3+'/'+_0x1804b0)[_0xfcbb('0x17')](_0x5a48ea);}return null;};}function saveUpdates(_0x11f0fa){return function(_0x187ab5){if(_0x187ab5){return _0x187ab5['update'](_0x11f0fa)[_0xfcbb('0x1d')](function(_0x22ffaf){return _0x22ffaf;});}return null;};}function removeEntity(_0x2de9cf){return function(_0x5bc595){if(_0x5bc595){return _0x5bc595[_0xfcbb('0x1e')]()[_0xfcbb('0x1d')](function(){_0x2de9cf[_0xfcbb('0x15')](0xcc)[_0xfcbb('0x16')]();});}};}function handleEntityNotFound(_0x1b017e){return function(_0x36b849){if(!_0x36b849){_0x1b017e[_0xfcbb('0x14')](0x194);}return _0x36b849;};}function handleError(_0x291ca6,_0x4e4a1b){_0x4e4a1b=_0x4e4a1b||0x1f4;return function(_0x4b0865){logger['error'](_0x4b0865['stack']);if(_0x4b0865['name']){delete _0x4b0865['name'];}_0x291ca6['status'](_0x4e4a1b)[_0xfcbb('0x1f')](_0x4b0865);};}exports[_0xfcbb('0x20')]=function(_0x211d36,_0xad7721){var _0x35eb2d={};var _0x20175b=_[_0xfcbb('0x21')](db[_0xfcbb('0x22')][_0xfcbb('0x23')],function(_0x4a1e36){return{'name':_0x4a1e36['fieldName'],'type':_0x4a1e36['type']['key']};});_0x35eb2d=qs[_0xfcbb('0x24')](_0x20175b,_0x211d36);return interaction['findAll'](_0xfcbb('0x25'),_0x211d36[_0xfcbb('0x26')],_0x211d36[_0xfcbb('0x27')],_0x35eb2d,_0x20175b)[_0xfcbb('0x1d')](respondWithFilteredResult(_0xad7721,_0x35eb2d))[_0xfcbb('0x28')](handleError(_0xad7721,null));};exports[_0xfcbb('0x29')]=function(_0x56a81b,_0x47a2d9){var _0x353eac={'raw':![],'where':{'id':_0x56a81b[_0xfcbb('0x2a')]['id']}},_0x54d5ce={};_0x54d5ce[_0xfcbb('0x2b')]=_[_0xfcbb('0x2c')](db[_0xfcbb('0x22')]['rawAttributes']);_0x54d5ce[_0xfcbb('0x26')]=_[_0xfcbb('0x2c')](_0x56a81b['query']);_0x54d5ce[_0xfcbb('0x2d')]=_[_0xfcbb('0x2e')](_0x54d5ce[_0xfcbb('0x2b')],_0x54d5ce[_0xfcbb('0x26')]);_0x353eac[_0xfcbb('0x2f')]=_[_0xfcbb('0x2e')](_0x54d5ce[_0xfcbb('0x2b')],qs[_0xfcbb('0x30')](_0x56a81b[_0xfcbb('0x26')][_0xfcbb('0x30')]));_0x353eac[_0xfcbb('0x2f')]=_0x353eac['attributes'][_0xfcbb('0x31')]?_0x353eac[_0xfcbb('0x2f')]:_0x54d5ce[_0xfcbb('0x2b')];if(_0x56a81b[_0xfcbb('0x26')]['includeAll']){_0x353eac[_0xfcbb('0x32')]=[{'all':!![]}];}_0x353eac=_[_0xfcbb('0x33')]({},_0x353eac,_0x56a81b[_0xfcbb('0x34')]);return db[_0xfcbb('0x22')]['find'](_0x353eac)['then'](handleEntityNotFound(_0x47a2d9,null))[_0xfcbb('0x1d')](respondWithResult(_0x47a2d9,null))[_0xfcbb('0x28')](handleError(_0x47a2d9,null));};exports[_0xfcbb('0x35')]=function(_0x58ea64,_0x5556a4){return db[_0xfcbb('0x22')][_0xfcbb('0x35')](_0x58ea64[_0xfcbb('0x36')],{})[_0xfcbb('0x1d')](respondWithResult(_0x5556a4,0xc9))[_0xfcbb('0x28')](handleError(_0x5556a4,null));};exports[_0xfcbb('0x37')]=function(_0x15870d,_0x1704a9){if(_0x15870d['body']['id']){delete _0x15870d[_0xfcbb('0x36')]['id'];}return db['WhatsappInteraction'][_0xfcbb('0x38')]({'where':{'id':_0x15870d[_0xfcbb('0x2a')]['id']}})[_0xfcbb('0x1d')](handleEntityNotFound(_0x1704a9,null))[_0xfcbb('0x1d')](saveUpdates(_0x15870d[_0xfcbb('0x36')],null))[_0xfcbb('0x1d')](respondWithResult(_0x1704a9,null))[_0xfcbb('0x28')](handleError(_0x1704a9,null));};exports[_0xfcbb('0x1e')]=function(_0x46cfac,_0x1781dc){return db[_0xfcbb('0x22')][_0xfcbb('0x38')]({'where':{'id':_0x46cfac[_0xfcbb('0x2a')]['id']}})[_0xfcbb('0x1d')](handleEntityNotFound(_0x1781dc,null))[_0xfcbb('0x1d')](removeEntity(_0x1781dc,null))[_0xfcbb('0x28')](handleError(_0x1781dc,null));};exports[_0xfcbb('0x39')]=function(_0x5d1bcb,_0x2e2f7d){return db[_0xfcbb('0x22')][_0xfcbb('0x39')]()[_0xfcbb('0x1d')](respondWithResult(_0x2e2f7d,null))[_0xfcbb('0x28')](handleError(_0x2e2f7d,null));};exports[_0xfcbb('0x3a')]=function(_0x3d8503,_0x212bd4){return db[_0xfcbb('0x3b')]['find']({'where':{'id':_0x3d8503[_0xfcbb('0x2a')]['id']}})[_0xfcbb('0x1d')](handleEntityNotFound(_0x212bd4,null))[_0xfcbb('0x1d')](function(_0x57b7e4){if(_0x57b7e4){return _0x57b7e4[_0xfcbb('0x3a')](_0x3d8503['body']['ids'],_['omit'](_0x3d8503[_0xfcbb('0x36')],[_0xfcbb('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x212bd4,null))['catch'](handleError(_0x212bd4,null));};exports[_0xfcbb('0x3d')]=function(_0x34bc33,_0x418aa8){var _0x351864={'raw':![],'where':{}};var _0x483d2f={};var _0x3b0246={'count':0x0,'rows':[]};return db[_0xfcbb('0x22')][_0xfcbb('0x3e')]({'where':{'id':_0x34bc33[_0xfcbb('0x2a')]['id']}})[_0xfcbb('0x1d')](handleEntityNotFound(_0x418aa8,null))[_0xfcbb('0x1d')](function(_0x412833){if(_0x412833){_0x483d2f[_0xfcbb('0x2b')]=_['keys'](db[_0xfcbb('0x3b')]['rawAttributes']);_0x483d2f['query']=_['keys'](_0x34bc33[_0xfcbb('0x26')]);_0x483d2f[_0xfcbb('0x2d')]=_[_0xfcbb('0x2e')](_0x483d2f[_0xfcbb('0x2b')],_0x483d2f[_0xfcbb('0x26')]);_0x351864['attributes']=_[_0xfcbb('0x2e')](_0x483d2f[_0xfcbb('0x2b')],qs['fields'](_0x34bc33[_0xfcbb('0x26')]['fields']));_0x351864[_0xfcbb('0x2f')]=_0x351864['attributes']['length']?_0x351864[_0xfcbb('0x2f')]:_0x483d2f[_0xfcbb('0x2b')];if(!_0x34bc33[_0xfcbb('0x26')][_0xfcbb('0x3f')]('nolimit')){_0x351864[_0xfcbb('0x19')]=qs['limit'](_0x34bc33[_0xfcbb('0x26')][_0xfcbb('0x19')]);_0x351864[_0xfcbb('0x1b')]=qs[_0xfcbb('0x1b')](_0x34bc33[_0xfcbb('0x26')][_0xfcbb('0x1b')]);}_0x351864[_0xfcbb('0x40')]=qs['sort'](_0x34bc33[_0xfcbb('0x26')]['sort']);_0x351864[_0xfcbb('0x41')]=qs['filters'](_['pick'](_0x34bc33[_0xfcbb('0x26')],_0x483d2f[_0xfcbb('0x2d')]));_0x351864[_0xfcbb('0x41')][_0xfcbb('0x42')]=_0x412833['id'];if(_0x34bc33['query'][_0xfcbb('0x43')]){_0x351864[_0xfcbb('0x41')]=_['merge'](_0x351864[_0xfcbb('0x41')],{'$or':_['map'](_0x351864[_0xfcbb('0x2f')],function(_0x2d267a){var _0x3fa4da={};_0x3fa4da[_0x2d267a]={'$like':'%'+_0x34bc33[_0xfcbb('0x26')][_0xfcbb('0x43')]+'%'};return _0x3fa4da;})});}if(_0x34bc33[_0xfcbb('0x26')][_0xfcbb('0x44')]){var _0x46111a=_0x34bc33['query'][_0xfcbb('0x44')]['split'](',');var _0x4b36dd={};_0x4b36dd[_0x46111a[0x0]]={'$gte':moment(_0x46111a[0x1])[_0xfcbb('0x45')](_0xfcbb('0x46'))};_0x351864['where']=_[_0xfcbb('0x33')](_0x351864[_0xfcbb('0x41')],_0x4b36dd);}_0x351864=_[_0xfcbb('0x33')]({},_0x351864,_0x34bc33[_0xfcbb('0x34')]);return db[_0xfcbb('0x3b')]['count']({'where':_0x351864[_0xfcbb('0x41')]})[_0xfcbb('0x1d')](function(_0x48a2e7){_0x3b0246['count']=_0x48a2e7;if(_0x34bc33[_0xfcbb('0x26')][_0xfcbb('0x47')]){_0x351864[_0xfcbb('0x32')]=[{'all':!![]}];}return db[_0xfcbb('0x3b')][_0xfcbb('0x48')](_0x351864);})[_0xfcbb('0x1d')](function(_0x4ee60a){_0x3b0246['rows']=_0x4ee60a;return _0x3b0246;});}})['then'](respondWithFilteredResult(_0x418aa8,_0x351864))['catch'](handleError(_0x418aa8,null));};exports['addTags']=function(_0x50fb77,_0x4dcd60){return db['WhatsappInteraction'][_0xfcbb('0x38')]({'where':{'id':_0x50fb77[_0xfcbb('0x2a')]['id']}})[_0xfcbb('0x1d')](handleEntityNotFound(_0x4dcd60,null))[_0xfcbb('0x1d')](function(_0x285c1a){if(_0x285c1a){return _0x285c1a[_0xfcbb('0x49')](_0x50fb77[_0xfcbb('0x36')][_0xfcbb('0x3c')],_[_0xfcbb('0x4a')](_0x50fb77[_0xfcbb('0x36')],[_0xfcbb('0x3c'),'id'])||{})[_0xfcbb('0x4b')](function(){return db['Tag'][_0xfcbb('0x48')]({'attributes':['id','name','color'],'where':{'id':_0x50fb77[_0xfcbb('0x36')]['ids']}});})[_0xfcbb('0x1d')](function(_0x356b70){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x50fb77[_0xfcbb('0x2a')]['id']),'tags':_0x356b70||[]});return{'id':Number(_0x50fb77[_0xfcbb('0x2a')]['id']),'tags':_0x356b70||[]};});}})['then'](respondWithResult(_0x4dcd60,null))['catch'](handleError(_0x4dcd60,null));};exports['removeTags']=function(_0xfbc2d0,_0xa3c42e){return db[_0xfcbb('0x22')][_0xfcbb('0x38')]({'where':{'id':_0xfbc2d0[_0xfcbb('0x2a')]['id']}})['then'](handleEntityNotFound(_0xa3c42e,null))[_0xfcbb('0x1d')](function(_0x1adfba){if(_0x1adfba){return _0x1adfba[_0xfcbb('0x4c')](_0xfbc2d0[_0xfcbb('0x26')][_0xfcbb('0x3c')]);}})[_0xfcbb('0x1d')](respondWithStatusCode(_0xa3c42e,null))[_0xfcbb('0x28')](handleError(_0xa3c42e,null));};exports[_0xfcbb('0x4d')]=function(_0x1cb08e,_0x2f6187){var _0x4e580e=moment()[_0xfcbb('0x4e')]()['toString']();var _0x1e8284=path[_0xfcbb('0x4f')](config['root'],'server',_0xfcbb('0x50'),_0xfcbb('0x51'));var _0x54a2a4=path[_0xfcbb('0x4f')](config['root'],_0xfcbb('0x52'),_0xfcbb('0x50'),_0xfcbb('0x53'));var _0x30b92b=path[_0xfcbb('0x4f')](_0x1e8284,_0x4e580e);var _0x464870=util[_0xfcbb('0x45')](_0xfcbb('0x54'),_0x1cb08e[_0xfcbb('0x2a')]['id'],_0x4e580e);var _0x27fded=path[_0xfcbb('0x4f')](_0x1e8284,_0x464870);var _0x304752=[];_0x304752['push']({'model':db['User'],'as':_0xfcbb('0x55'),'attributes':['id',_0xfcbb('0x56')],'raw':!![]});_0x304752['push']({'model':db[_0xfcbb('0x57')],'as':_0xfcbb('0x58'),'attributes':['id',_0xfcbb('0x59'),_0xfcbb('0x5a')],'raw':!![]});if(_0x1cb08e[_0xfcbb('0x26')][_0xfcbb('0x53')]){_0x304752[_0xfcbb('0x5b')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0xb36efe=[{'model':db[_0xfcbb('0x3b')],'as':_0xfcbb('0x5c'),'attributes':['id','body',_0xfcbb('0x5d'),'direction',_0xfcbb('0x5e'),'read'],'include':_0x304752}];_0xb36efe['push']({'model':db[_0xfcbb('0x5f')],'as':'Account','attributes':['id',_0xfcbb('0x60')]});_0xb36efe['push']({'model':db['User'],'as':_0xfcbb('0x61'),'attributes':['id',_0xfcbb('0x56')]});return db[_0xfcbb('0x22')][_0xfcbb('0x38')]({'where':{'id':_0x1cb08e[_0xfcbb('0x2a')]['id']},'include':_0xb36efe})[_0xfcbb('0x1d')](handleEntityNotFound(_0x2f6187,null))[_0xfcbb('0x1d')](function(_0x39e7f3){if(_0x39e7f3){var _0x358867=_0x39e7f3[_0xfcbb('0x62')]({'plain':!![]});fs[_0xfcbb('0x63')](_0x30b92b);var _0x24c699={'channel':_0xfcbb('0x64'),'account':_0x358867[_0xfcbb('0x65')][_0xfcbb('0x60')],'agent':_0x358867['Owner']?_0x358867[_0xfcbb('0x61')][_0xfcbb('0x56')]:_0xfcbb('0x66'),'createdAt':moment(_0x358867[_0xfcbb('0x5d')])['format'](_0xfcbb('0x46'))[_0xfcbb('0x67')](),'closedAt':_0x358867[_0xfcbb('0x68')]?moment(_0x358867[_0xfcbb('0x69')])[_0xfcbb('0x45')](_0xfcbb('0x46'))[_0xfcbb('0x67')]():'','disposition':_0x358867[_0xfcbb('0x6a')],'messages':_(_0x358867[_0xfcbb('0x5c')])[_0xfcbb('0x43')]({'secret':![]})[_0xfcbb('0x21')](function(_0x2fad60){if(_0x2fad60[_0xfcbb('0x6b')]){var _0x23309e=path['join'](_0x54a2a4,_0x2fad60[_0xfcbb('0x6b')][_0xfcbb('0x6c')]);if(fs[_0xfcbb('0x6d')](_0x23309e)){fs[_0xfcbb('0x6e')](_0x23309e)[_0xfcbb('0x6f')](fs[_0xfcbb('0x70')](path[_0xfcbb('0x4f')](_0x30b92b,_0x2fad60[_0xfcbb('0x6b')][_0xfcbb('0x6c')])));}}return{'date':moment(_0x2fad60[_0xfcbb('0x5d')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xfcbb('0x67')](),'sender':_0x2fad60[_0xfcbb('0x71')]==='out'?_0x2fad60['User']?_0x2fad60['User']['fullname']:'System':_0x2fad60[_0xfcbb('0x58')][_0xfcbb('0x59')]+(_0x2fad60[_0xfcbb('0x58')][_0xfcbb('0x5a')]?'\x20'+_0x2fad60[_0xfcbb('0x58')]['lastName']:''),'body':_0x2fad60['Attachment']?_0x2fad60['Attachment'][_0xfcbb('0x6c')]:_0x2fad60['body'],'direction':_0x2fad60['direction']===_0xfcbb('0x72')?'A':'C','secret':_0x2fad60[_0xfcbb('0x5e')],'read':_0x2fad60['read'],'attachment':_0x2fad60[_0xfcbb('0x6b')]};})[_0xfcbb('0x73')]()};return ejs['renderFile'](path[_0xfcbb('0x4f')](config[_0xfcbb('0x74')],_0xfcbb('0x52'),_0xfcbb('0x75'),_0xfcbb('0x76')),{'interaction':_0x24c699})[_0xfcbb('0x1d')](function(_0x8aca3c){var _0x1cadc6=path[_0xfcbb('0x4f')](_0x30b92b,'transcript-'+_0x358867['id']+'-'+_0x4e580e+_0xfcbb('0x77'));var _0x1db9db={'path':_0x1cadc6,'channel':_0xfcbb('0x64'),'interactionId':_0x358867['id']};return pdf[_0xfcbb('0x78')](_0x8aca3c,_0x1db9db);})[_0xfcbb('0x1d')](function(){return new BPromise(function(_0x2a58b3,_0x3e378e){zipdir(_0x30b92b,{'saveTo':_0x27fded},function(_0x539a52,_0x2fb572){if(_0x539a52)return _0x3e378e(_0x539a52);return _0x2a58b3(_0x2fb572);});})[_0xfcbb('0x1d')](function(){return new BPromise(function(_0x48ef32,_0x27ac49){rimraf(_0x30b92b,function(_0x49dcc9){if(_0x49dcc9)_0x27ac49(_0x49dcc9);return _0x48ef32();});});})[_0xfcbb('0x1d')](function(){return _0x2f6187[_0xfcbb('0x4d')](_0x27fded,_0x464870,function(_0x46e47a){if(_0x46e47a){console[_0xfcbb('0x79')]('err',_0x46e47a);}else{fs['unlinkSync'](_0x27fded);}});});});}else{return _0x2f6187[_0xfcbb('0x14')](0xc8);}})[_0xfcbb('0x28')](handleError(_0x2f6187,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index fdff3bf..e18a853 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 _0xd3b4=['save','remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x58b0c1,_0x2cd06b){_0x58b0c1=_0x58b0c1-0x0;var _0x511933=_0xd3b4[_0x58b0c1];return _0x511933;};'use strict';var EventEmitter=require(_0x4d3b('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4d3b('0x1'))['db'][_0x4d3b('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4d3b('0x3')](0x0);var events={'afterCreate':_0x4d3b('0x4'),'afterUpdate':'update','afterDestroy':_0x4d3b('0x5')};function emitEvent(_0x559663){return function(_0x1f6a62,_0x15a47d,_0x708cac){_0x1f6a62[_0x4d3b('0x6')]({'attributes':['id'],'raw':!![]})[_0x4d3b('0x7')](function(_0x64ad89){_0x1f6a62[_0x4d3b('0x8')](_0x4d3b('0x9'),_0x64ad89[_0x4d3b('0xa')](function(_0x1a5190){return{'id':_0x1a5190['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1f6a62['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d3b('0x7')](function(_0x56922b){_0x1f6a62[_0x4d3b('0x8')]('unreadMessages',_0x56922b[_0x4d3b('0xb')]);WhatsappInteractionEvents[_0x4d3b('0xc')](_0x559663+':'+_0x1f6a62['id'],_0x1f6a62);WhatsappInteractionEvents[_0x4d3b('0xc')](_0x559663,_0x1f6a62);_0x708cac(null);})[_0x4d3b('0xd')](_0x708cac(null));};}for(var e in events){if(events[_0x4d3b('0xe')](e)){var event=events[e];WhatsappInteraction[_0x4d3b('0xf')](e,emitEvent(event));}}module[_0x4d3b('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x0102=['length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','getUsers','Users','map','findAll','then','setDataValue','unreadMessages'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0102,0x186));var _0x2010=function(_0x9a77f0,_0x240fc1){_0x9a77f0=_0x9a77f0-0x0;var _0x1df397=_0x0102[_0x9a77f0];return _0x1df397;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x2010('0x0'))['db'][_0x2010('0x1')];var WhatsappMessage=require(_0x2010('0x0'))['db'][_0x2010('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59082d){return function(_0x22e49f,_0x3e25fb,_0x130725){_0x22e49f[_0x2010('0x3')]({'attributes':['id'],'raw':!![]})['then'](function(_0x453fc0){_0x22e49f['setDataValue'](_0x2010('0x4'),_0x453fc0[_0x2010('0x5')](function(_0x48dd91){return{'id':_0x48dd91['id']};}));return WhatsappMessage[_0x2010('0x6')]({'where':{'WhatsappInteractionId':_0x22e49f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2010('0x7')](function(_0x3d34d4){_0x22e49f[_0x2010('0x8')](_0x2010('0x9'),_0x3d34d4[_0x2010('0xa')]);WhatsappInteractionEvents[_0x2010('0xb')](_0x59082d+':'+_0x22e49f['id'],_0x22e49f);WhatsappInteractionEvents[_0x2010('0xb')](_0x59082d,_0x22e49f);_0x130725(null);})[_0x2010('0xc')](_0x130725(null));};}for(var e in events){if(events[_0x2010('0xd')](e)){var event=events[e];WhatsappInteraction[_0x2010('0xe')](e,emitEvent(event));}}module[_0x2010('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 5a68053..cd97fcd 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 _0xbf77=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x390402,_0x4d8f54){var _0x32b2fb=function(_0x110a69){while(--_0x110a69){_0x390402['push'](_0x390402['shift']());}};_0x32b2fb(++_0x4d8f54);}(_0xbf77,0xec));var _0x7bf7=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xbf77[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x7bf7('0x0'));var util=require(_0x7bf7('0x1'));var logger=require(_0x7bf7('0x2'))(_0x7bf7('0x3'));var moment=require(_0x7bf7('0x4'));var BPromise=require(_0x7bf7('0x5'));var rp=require(_0x7bf7('0x6'));var fs=require('fs');var path=require(_0x7bf7('0x7'));var rimraf=require('rimraf');var config=require(_0x7bf7('0x8'));var attributes=require(_0x7bf7('0x9'));module[_0x7bf7('0xa')]=function(_0x49dc52,_0x2cf3f5){return _0x49dc52[_0x7bf7('0xb')]('WhatsappInteraction',attributes,{'tableName':_0x7bf7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33dc2f,_0x1a9b79,_0x10b522){if(_0x33dc2f['changed'](_0x7bf7('0xd'))){_0x33dc2f[_0x7bf7('0xe')]=moment()[_0x7bf7('0xf')](_0x7bf7('0x10'));}_0x10b522(null,_0x33dc2f);}}});}; \ No newline at end of file +var _0x068d=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','closedAt','format'];(function(_0x272bc6,_0x3ccc05){var _0x16178e=function(_0x13e27c){while(--_0x13e27c){_0x272bc6['push'](_0x272bc6['shift']());}};_0x16178e(++_0x3ccc05);}(_0x068d,0x166));var _0xd068=function(_0x5f1aa4,_0x6292f6){_0x5f1aa4=_0x5f1aa4-0x0;var _0x2ed072=_0x068d[_0x5f1aa4];return _0x2ed072;};'use strict';var _=require('lodash');var util=require(_0xd068('0x0'));var logger=require(_0xd068('0x1'))(_0xd068('0x2'));var moment=require('moment');var BPromise=require(_0xd068('0x3'));var rp=require(_0xd068('0x4'));var fs=require('fs');var path=require(_0xd068('0x5'));var rimraf=require(_0xd068('0x6'));var config=require(_0xd068('0x7'));var attributes=require(_0xd068('0x8'));module[_0xd068('0x9')]=function(_0x2e7182,_0x1632ed){return _0x2e7182[_0xd068('0xa')](_0xd068('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2747a1,_0x2a6d58,_0xb1bdad){if(_0x2747a1[_0xd068('0xc')](_0xd068('0xd'))){_0x2747a1[_0xd068('0xe')]=moment()[_0xd068('0xf')](_0xd068('0x10'));}_0xb1bdad(null,_0x2747a1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 147f067..675cbcc 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 _0xc786=['debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x1bb0b8,_0x24add2){var _0x22fc67=function(_0x2e051d){while(--_0x2e051d){_0x1bb0b8['push'](_0x1bb0b8['shift']());}};_0x22fc67(++_0x24add2);}(_0xc786,0x8d));var _0x6c78=function(_0x538cbe,_0x236a1d){_0x538cbe=_0x538cbe-0x0;var _0x49c295=_0xc786[_0x538cbe];return _0x49c295;};'use strict';var _=require(_0x6c78('0x0'));var util=require(_0x6c78('0x1'));var moment=require(_0x6c78('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c78('0x3'));var fs=require('fs');var Redis=require(_0x6c78('0x4'));var db=require(_0x6c78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c78('0x6'))(_0x6c78('0x7'));var config=require(_0x6c78('0x8'));var jayson=require(_0x6c78('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x6c78('0xa')]=_['defaults'](config['redis'],{'host':_0x6c78('0xb'),'port':0x18eb});var socket=require(_0x6c78('0xc'))(new Redis(config[_0x6c78('0xa')]));require('./whatsappInteraction.socket')[_0x6c78('0xd')](socket);function respondWithRpcPromise(_0x48bfaf,_0x2a898c,_0x531e60){return new BPromise(function(_0x199a94,_0x4bc253){return client[_0x6c78('0xe')](_0x48bfaf,_0x531e60)[_0x6c78('0xf')](function(_0x4aceb1){logger[_0x6c78('0x10')](_0x6c78('0x11'),_0x2a898c,_0x6c78('0x12'));logger[_0x6c78('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x2a898c,_0x6c78('0x12'),JSON[_0x6c78('0x14')](_0x4aceb1));if(_0x4aceb1[_0x6c78('0x15')]){if(_0x4aceb1['error'][_0x6c78('0x16')]===0x1f4){logger[_0x6c78('0x15')](_0x6c78('0x11'),_0x2a898c,_0x4aceb1[_0x6c78('0x15')][_0x6c78('0x17')]);return _0x4bc253(_0x4aceb1[_0x6c78('0x15')]['message']);}logger[_0x6c78('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x2a898c,_0x4aceb1[_0x6c78('0x15')][_0x6c78('0x17')]);return _0x199a94(_0x4aceb1[_0x6c78('0x15')][_0x6c78('0x17')]);}else{logger['info'](_0x6c78('0x11'),_0x2a898c,_0x6c78('0x12'));_0x199a94(_0x4aceb1[_0x6c78('0x18')][_0x6c78('0x17')]);}})[_0x6c78('0x19')](function(_0x2787c1){logger[_0x6c78('0x15')](_0x6c78('0x11'),_0x2a898c,_0x2787c1);_0x4bc253(_0x2787c1);});});}exports[_0x6c78('0x1a')]=function(_0x24091c){var _0x5554e0=this;return new Promise(function(_0x5716b9,_0x5ef2e4){return db['WhatsappInteraction'][_0x6c78('0x1b')](_0x24091c[_0x6c78('0x1c')],{'raw':_0x24091c[_0x6c78('0x1d')]?_0x24091c['options'][_0x6c78('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24091c[_0x6c78('0x1d')]?_0x24091c[_0x6c78('0x1d')]['where']||null:null,'attributes':_0x24091c[_0x6c78('0x1d')]?_0x24091c[_0x6c78('0x1d')][_0x6c78('0x1f')]||null:null,'limit':_0x24091c[_0x6c78('0x1d')]?_0x24091c['options'][_0x6c78('0x20')]||null:null})[_0x6c78('0xf')](function(_0x36150a){logger[_0x6c78('0x10')]('UpdateWhatsappInteraction',_0x24091c);logger[_0x6c78('0x13')](_0x6c78('0x1a'),_0x24091c,JSON[_0x6c78('0x14')](_0x36150a));_0x5716b9(_0x36150a);})[_0x6c78('0x19')](function(_0x3bfaca){logger[_0x6c78('0x15')](_0x6c78('0x1a'),_0x3bfaca[_0x6c78('0x17')],_0x24091c);_0x5ef2e4(_0x5554e0[_0x6c78('0x15')](0x1f4,_0x3bfaca[_0x6c78('0x17')]));});});};exports[_0x6c78('0x21')]=function(_0x1e98d5){return new Promise(function(_0x46c077,_0xf92fb0){return db[_0x6c78('0x22')][_0x6c78('0x23')]({'where':_0x1e98d5['options']?_0x1e98d5[_0x6c78('0x1d')][_0x6c78('0x24')]||null:null})[_0x6c78('0xf')](function(_0x3e6527){if(_0x3e6527){return _0x3e6527['addTags'](_0x1e98d5['body']['ids'],_[_0x6c78('0x25')](_0x1e98d5[_0x6c78('0x1c')],[_0x6c78('0x26'),'id'])||{});}})['spread'](function(_0x247c9f){logger[_0x6c78('0x10')]('AddTags',_0x1e98d5);logger[_0x6c78('0x13')](_0x6c78('0x27'),_0x1e98d5,JSON[_0x6c78('0x14')](_0x247c9f));_0x46c077(_0x247c9f);})[_0x6c78('0x19')](function(_0x54bca7){logger[_0x6c78('0x15')](_0x6c78('0x27'),_0x54bca7[_0x6c78('0x17')],_0x1e98d5);_0xf92fb0(_this[_0x6c78('0x15')](0x1f4,_0x54bca7[_0x6c78('0x17')]));});});}; \ No newline at end of file +var _0xd745=['ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','register','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappInteraction','update','body','options','raw','where','attributes','then','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','debug','lodash','moment','randomstring'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xd745,0x99));var _0x5d74=function(_0x21148e,_0x36d492){_0x21148e=_0x21148e-0x0;var _0x3dcb60=_0xd745[_0x21148e];return _0x3dcb60;};'use strict';var _=require(_0x5d74('0x0'));var util=require('util');var moment=require(_0x5d74('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d74('0x2'));var fs=require('fs');var Redis=require(_0x5d74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d74('0x4'));var logger=require(_0x5d74('0x5'))('rpc');var config=require(_0x5d74('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d74('0x7')]({'port':0x232a});config[_0x5d74('0x8')]=_['defaults'](config[_0x5d74('0x8')],{'host':_0x5d74('0x9'),'port':0x18eb});var socket=require(_0x5d74('0xa'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x5d74('0xb')](socket);function respondWithRpcPromise(_0x252938,_0x3ab3a5,_0x4bf7fb){return new BPromise(function(_0x5e2f0c,_0x32bfbd){return client['request'](_0x252938,_0x4bf7fb)['then'](function(_0xbbe0c){logger['info'](_0x5d74('0xc'),_0x3ab3a5,_0x5d74('0xd'));logger['debug'](_0x5d74('0xe'),_0x3ab3a5,'request\x20sent',JSON[_0x5d74('0xf')](_0xbbe0c));if(_0xbbe0c[_0x5d74('0x10')]){if(_0xbbe0c['error'][_0x5d74('0x11')]===0x1f4){logger[_0x5d74('0x10')](_0x5d74('0xc'),_0x3ab3a5,_0xbbe0c[_0x5d74('0x10')][_0x5d74('0x12')]);return _0x32bfbd(_0xbbe0c[_0x5d74('0x10')][_0x5d74('0x12')]);}logger[_0x5d74('0x10')](_0x5d74('0xc'),_0x3ab3a5,_0xbbe0c[_0x5d74('0x10')][_0x5d74('0x12')]);return _0x5e2f0c(_0xbbe0c['error'][_0x5d74('0x12')]);}else{logger[_0x5d74('0x13')](_0x5d74('0xc'),_0x3ab3a5,'request\x20sent');_0x5e2f0c(_0xbbe0c[_0x5d74('0x14')][_0x5d74('0x12')]);}})[_0x5d74('0x15')](function(_0x3ae54c){logger[_0x5d74('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x3ab3a5,_0x3ae54c);_0x32bfbd(_0x3ae54c);});});}exports['UpdateWhatsappInteraction']=function(_0x1b0cd1){var _0x3b405f=this;return new Promise(function(_0x32099b,_0x3f9f2a){return db[_0x5d74('0x16')][_0x5d74('0x17')](_0x1b0cd1[_0x5d74('0x18')],{'raw':_0x1b0cd1[_0x5d74('0x19')]?_0x1b0cd1[_0x5d74('0x19')][_0x5d74('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b0cd1[_0x5d74('0x19')]?_0x1b0cd1[_0x5d74('0x19')][_0x5d74('0x1b')]||null:null,'attributes':_0x1b0cd1['options']?_0x1b0cd1['options'][_0x5d74('0x1c')]||null:null,'limit':_0x1b0cd1[_0x5d74('0x19')]?_0x1b0cd1[_0x5d74('0x19')]['limit']||null:null})[_0x5d74('0x1d')](function(_0x1e1806){logger[_0x5d74('0x13')](_0x5d74('0x1e'),_0x1b0cd1);logger['debug'](_0x5d74('0x1e'),_0x1b0cd1,JSON[_0x5d74('0xf')](_0x1e1806));_0x32099b(_0x1e1806);})[_0x5d74('0x15')](function(_0x14d84d){logger[_0x5d74('0x10')]('UpdateWhatsappInteraction',_0x14d84d['message'],_0x1b0cd1);_0x3f9f2a(_0x3b405f[_0x5d74('0x10')](0x1f4,_0x14d84d[_0x5d74('0x12')]));});});};exports[_0x5d74('0x1f')]=function(_0x3be98e){return new Promise(function(_0x20da95,_0x2b48d2){return db[_0x5d74('0x16')][_0x5d74('0x20')]({'where':_0x3be98e['options']?_0x3be98e[_0x5d74('0x19')][_0x5d74('0x1b')]||null:null})[_0x5d74('0x1d')](function(_0x27a046){if(_0x27a046){return _0x27a046[_0x5d74('0x21')](_0x3be98e[_0x5d74('0x18')][_0x5d74('0x22')],_[_0x5d74('0x23')](_0x3be98e[_0x5d74('0x18')],[_0x5d74('0x22'),'id'])||{});}})[_0x5d74('0x24')](function(_0x4c4b10){logger[_0x5d74('0x13')](_0x5d74('0x25'),_0x3be98e);logger[_0x5d74('0x26')]('AddTags',_0x3be98e,JSON[_0x5d74('0xf')](_0x4c4b10));_0x20da95(_0x4c4b10);})[_0x5d74('0x15')](function(_0x1bae6a){logger[_0x5d74('0x10')]('AddTags',_0x1bae6a['message'],_0x3be98e);_0x2b48d2(_this[_0x5d74('0x10')](0x1f4,_0x1bae6a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 41b33be..318e3ed 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 _0x1f22=['emit','removeListener','register','length','./whatsappInteraction.events'];(function(_0x3f8282,_0x11b607){var _0x50f918=function(_0x3a37de){while(--_0x3a37de){_0x3f8282['push'](_0x3f8282['shift']());}};_0x50f918(++_0x11b607);}(_0x1f22,0x15d));var _0x21f2=function(_0x20eaff,_0x211f44){_0x20eaff=_0x20eaff-0x0;var _0x3040d3=_0x1f22[_0x20eaff];return _0x3040d3;};'use strict';var WhatsappInteractionEvents=require(_0x21f2('0x0'));var events=['save','remove','update'];function createListener(_0x1da4f6,_0x25ad5a){return function(_0x379647){_0x25ad5a[_0x21f2('0x1')](_0x1da4f6,_0x379647);};}function removeListener(_0x1b1ea4,_0x59bbd1){return function(){WhatsappInteractionEvents[_0x21f2('0x2')](_0x1b1ea4,_0x59bbd1);};}exports[_0x21f2('0x3')]=function(_0x30b5f5){for(var _0x5bf0ac=0x0,_0x1a6ceb=events[_0x21f2('0x4')];_0x5bf0ac<_0x1a6ceb;_0x5bf0ac++){var _0x24ad6f=events[_0x5bf0ac];var _0x2e5e51=createListener('whatsappInteraction:'+_0x24ad6f,_0x30b5f5);WhatsappInteractionEvents['on'](_0x24ad6f,_0x2e5e51);}}; \ No newline at end of file +var _0x1699=['save','remove','update','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x55a68f,_0x5cecc0){var _0x528e1f=function(_0x18a602){while(--_0x18a602){_0x55a68f['push'](_0x55a68f['shift']());}};_0x528e1f(++_0x5cecc0);}(_0x1699,0x77));var _0x9169=function(_0xad921d,_0x4e852b){_0xad921d=_0xad921d-0x0;var _0x50a737=_0x1699[_0xad921d];return _0x50a737;};'use strict';var WhatsappInteractionEvents=require(_0x9169('0x0'));var events=[_0x9169('0x1'),_0x9169('0x2'),_0x9169('0x3')];function createListener(_0x3aedb0,_0x480c28){return function(_0x253b13){_0x480c28['emit'](_0x3aedb0,_0x253b13);};}function removeListener(_0x267fe0,_0x309be3){return function(){WhatsappInteractionEvents[_0x9169('0x4')](_0x267fe0,_0x309be3);};}exports[_0x9169('0x5')]=function(_0x30575e){for(var _0x504dfc=0x0,_0x1a379f=events[_0x9169('0x6')];_0x504dfc<_0x1a379f;_0x504dfc++){var _0x1ba0d0=events[_0x504dfc];var _0x24c4ac=createListener(_0x9169('0x7')+_0x1ba0d0,_0x30575e);WhatsappInteractionEvents['on'](_0x1ba0d0,_0x24c4ac);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 707420c..04fe92e 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 _0x68b6=['multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0x68b6,0x138));var _0x668b=function(_0x18999d,_0x9dddfb){_0x18999d=_0x18999d-0x0;var _0x1d6dd0=_0x68b6[_0x18999d];return _0x1d6dd0;};'use strict';var multer=require(_0x668b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x668b('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x668b('0x2'));var interaction=require(_0x668b('0x3'));var config=require(_0x668b('0x4'));var controller=require(_0x668b('0x5'));router[_0x668b('0x6')]('/',auth[_0x668b('0x7')](),controller[_0x668b('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x668b('0x6')](_0x668b('0x9'),auth[_0x668b('0x7')](),controller[_0x668b('0xa')]);router[_0x668b('0xb')]('/',auth[_0x668b('0x7')](),interaction[_0x668b('0xc')](_0x668b('0xd'),_0x668b('0xe')),controller[_0x668b('0xf')]);router[_0x668b('0xb')]('/:id/status',controller[_0x668b('0x10')]);router[_0x668b('0x11')](_0x668b('0x9'),auth[_0x668b('0x7')](),controller[_0x668b('0x12')]);router[_0x668b('0x11')](_0x668b('0x13'),auth[_0x668b('0x7')](),controller[_0x668b('0x14')]);router[_0x668b('0x11')](_0x668b('0x15'),auth['isAuthenticated'](),controller[_0x668b('0x16')]);router[_0x668b('0x17')](_0x668b('0x9'),auth[_0x668b('0x7')](),controller[_0x668b('0x18')]);module[_0x668b('0x19')]=router; \ No newline at end of file +var _0xc1c8=['accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','update','/:id/accept'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xc1c8,0x165));var _0x8c1c=function(_0x2f4af3,_0x3ffaa7){_0x2f4af3=_0x2f4af3-0x0;var _0x10f871=_0xc1c8[_0x2f4af3];return _0x10f871;};'use strict';var multer=require(_0x8c1c('0x0'));var util=require(_0x8c1c('0x1'));var path=require(_0x8c1c('0x2'));var timeout=require(_0x8c1c('0x3'));var express=require(_0x8c1c('0x4'));var router=express[_0x8c1c('0x5')]();var fs_extra=require(_0x8c1c('0x6'));var auth=require(_0x8c1c('0x7'));var interaction=require(_0x8c1c('0x8'));var config=require(_0x8c1c('0x9'));var controller=require(_0x8c1c('0xa'));router[_0x8c1c('0xb')]('/',auth[_0x8c1c('0xc')](),controller[_0x8c1c('0xd')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8c1c('0xe')]);router[_0x8c1c('0xb')](_0x8c1c('0xf'),auth[_0x8c1c('0xc')](),controller[_0x8c1c('0x10')]);router['post']('/',auth[_0x8c1c('0xc')](),interaction[_0x8c1c('0x11')](_0x8c1c('0x12'),_0x8c1c('0x13')),controller[_0x8c1c('0x14')]);router[_0x8c1c('0x15')](_0x8c1c('0x16'),controller[_0x8c1c('0x17')]);router[_0x8c1c('0x18')](_0x8c1c('0xf'),auth[_0x8c1c('0xc')](),controller[_0x8c1c('0x19')]);router[_0x8c1c('0x18')](_0x8c1c('0x1a'),auth[_0x8c1c('0xc')](),controller[_0x8c1c('0x1b')]);router[_0x8c1c('0x18')](_0x8c1c('0x1c'),auth[_0x8c1c('0xc')](),controller[_0x8c1c('0x1d')]);router[_0x8c1c('0x1e')](_0x8c1c('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x8c1c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 091bc0b..b8ddad5 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 _0x3f11=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','medium'];(function(_0x2935d8,_0x5c90d5){var _0x1acb0a=function(_0x48810){while(--_0x48810){_0x2935d8['push'](_0x2935d8['shift']());}};_0x1acb0a(++_0x5c90d5);}(_0x3f11,0x1a5));var _0x13f1=function(_0x5234f5,_0x10f4e6){_0x5234f5=_0x5234f5-0x0;var _0x1ff955=_0x3f11[_0x5234f5];return _0x1ff955;};'use strict';var Sequelize=require(_0x13f1('0x0'));module[_0x13f1('0x1')]={'body':{'type':Sequelize['TEXT'](_0x13f1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x13f1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x13f1('0x4')]('in',_0x13f1('0x5')),'defaultValue':_0x13f1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x13f1('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x13f1('0x7')]},'secret':{'type':Sequelize[_0x13f1('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9365=['STRING','DATE','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x3d6156,_0x45acbe){var _0xfc6e36=function(_0x12abc9){while(--_0x12abc9){_0x3d6156['push'](_0x3d6156['shift']());}};_0xfc6e36(++_0x45acbe);}(_0x9365,0xe9));var _0x5936=function(_0x5e2074,_0x3dba34){_0x5e2074=_0x5e2074-0x0;var _0x2582f1=_0x9365[_0x5e2074];return _0x2582f1;};'use strict';var Sequelize=require('sequelize');module[_0x5936('0x0')]={'body':{'type':Sequelize[_0x5936('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5936('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5936('0x3')]('in',_0x5936('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5936('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x5936('0x6')]},'secret':{'type':Sequelize[_0x5936('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5936('0x5')]},'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 b1ea40c..98dd8b7 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 _0xf660=['whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','interface','channel','event','EventManager','../../config/logger','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT','internal','motionChannel','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','status','json','offset','undefined','count','limit','apply','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','WhatsappMessage','includeAll','include','findAll','catch','show','params','keys','fields','options','find','create','update','body','destroy','describe'];(function(_0x9ad3ed,_0x13ae3a){var _0x211773=function(_0x4b3f32){while(--_0x4b3f32){_0x9ad3ed['push'](_0x9ad3ed['shift']());}};_0x211773(++_0x13ae3a);}(_0xf660,0x1b7));var _0x0f66=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xf660[_0x13594e];return _0x1a4f42;};'use strict';var emlformat=require(_0x0f66('0x0'));var rimraf=require(_0x0f66('0x1'));var zipdir=require(_0x0f66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f66('0x3'));var moment=require(_0x0f66('0x4'));var BPromise=require(_0x0f66('0x5'));var Mustache=require(_0x0f66('0x6'));var util=require('util');var path=require(_0x0f66('0x7'));var sox=require('sox');var csv=require(_0x0f66('0x8'));var ejs=require(_0x0f66('0x9'));var fs=require('fs');var fs_extra=require(_0x0f66('0xa'));var _=require(_0x0f66('0xb'));var squel=require(_0x0f66('0xc'));var crypto=require(_0x0f66('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0f66('0x8'));var querystring=require(_0x0f66('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f66('0xf'));var authService=require(_0x0f66('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0f66('0x11'));var hardwareService=require(_0x0f66('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0f66('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0f66('0x14'))['db'];config[_0x0f66('0x15')]=_['defaults'](config[_0x0f66('0x15')],{'host':_0x0f66('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f66('0x17'))[_0x0f66('0x18')](socket);var jayson=require(_0x0f66('0x19'));var client=jayson['client'][_0x0f66('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x0f66('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x35b8b8,_0x131ed8,_0x2a1df7,_0xced527){return new BPromise(function(_0x2055ee,_0x5cd75f){var _0x202a1b=_0xced527||client;return _0x202a1b[_0x0f66('0x1b')](_0x35b8b8,_0x2a1df7)[_0x0f66('0x1c')](function(_0x2333b2){logger[_0x0f66('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x131ed8,_0x0f66('0x1e'));logger[_0x0f66('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x131ed8,_0x0f66('0x1e'),JSON[_0x0f66('0x20')](_0x2333b2));if(_0x2333b2[_0x0f66('0x21')]){if(_0x2333b2['error']['code']===0x1f4){logger['error'](_0x0f66('0x22'),_0x131ed8,_0x2333b2[_0x0f66('0x21')][_0x0f66('0x23')]);return _0x5cd75f(_0x2333b2['error'][_0x0f66('0x23')]);}logger['error'](_0x0f66('0x22'),_0x131ed8,_0x2333b2[_0x0f66('0x21')][_0x0f66('0x23')]);return _0x2055ee(_0x2333b2[_0x0f66('0x21')][_0x0f66('0x23')]);}else{logger[_0x0f66('0x1d')](_0x0f66('0x22'),_0x131ed8,_0x0f66('0x1e'));_0x2055ee(_0x2333b2['result'][_0x0f66('0x23')]);}})['catch'](function(_0x165935){logger['error'](_0x0f66('0x22'),_0x131ed8,_0x165935);_0x5cd75f(_0x165935);});});}function respondWithStatusCode(_0x393b27,_0x24724c){_0x24724c=_0x24724c||0xcc;return function(_0x1075db){if(_0x1075db){return _0x393b27['sendStatus'](_0x24724c);}return _0x393b27['status'](_0x24724c)['end']();};}function respondWithResult(_0x29edf0,_0x2b3220){_0x2b3220=_0x2b3220||0xc8;return function(_0x56f64f){if(_0x56f64f){return _0x29edf0[_0x0f66('0x24')](_0x2b3220)[_0x0f66('0x25')](_0x56f64f);}};}function respondWithFilteredResult(_0x4f5263,_0x916e60){return function(_0x13dc0c){if(_0x13dc0c){var _0x1af429=typeof _0x916e60[_0x0f66('0x26')]===_0x0f66('0x27')&&typeof _0x916e60['limit']===_0x0f66('0x27');var _0x581a54=_0x13dc0c[_0x0f66('0x28')];var _0xbc6b7d=_0x1af429?0x0:_0x916e60[_0x0f66('0x26')];var _0x428836=_0x1af429?_0x13dc0c[_0x0f66('0x28')]:_0x916e60[_0x0f66('0x26')]+_0x916e60[_0x0f66('0x29')];var _0x2cf351;if(_0x428836>=_0x581a54){_0x428836=_0x581a54;_0x2cf351=0xc8;}else{_0x2cf351=0xce;}_0x4f5263['status'](_0x2cf351);return _0x4f5263['set']('Content-Range',_0xbc6b7d+'-'+_0x428836+'/'+_0x581a54)[_0x0f66('0x25')](_0x13dc0c);}return null;};}function patchUpdates(_0x1edae2){return function(_0x41fe9e){try{jsonpatch[_0x0f66('0x2a')](_0x41fe9e,_0x1edae2,!![]);}catch(_0x3cad01){return BPromise['reject'](_0x3cad01);}return _0x41fe9e['save']();};}function saveUpdates(_0x4c4327,_0x512951){return function(_0x2b7323){if(_0x2b7323){return _0x2b7323['update'](_0x4c4327)[_0x0f66('0x1c')](function(_0x35beb3){return _0x35beb3;});}return null;};}function removeEntity(_0x1acddf,_0x146ba3){return function(_0x4ca4da){if(_0x4ca4da){return _0x4ca4da['destroy']()['then'](function(){_0x1acddf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa8512,_0x166a84){return function(_0x1377e8){if(!_0x1377e8){_0xfa8512['sendStatus'](0x194);}return _0x1377e8;};}function handleError(_0x59a7ca,_0x377812){_0x377812=_0x377812||0x1f4;return function(_0x5bacbb){logger[_0x0f66('0x21')](_0x5bacbb[_0x0f66('0x2b')]);if(_0x5bacbb[_0x0f66('0x2c')]){delete _0x5bacbb[_0x0f66('0x2c')];}_0x59a7ca[_0x0f66('0x24')](_0x377812)[_0x0f66('0x2d')](_0x5bacbb);};}exports[_0x0f66('0x2e')]=function(_0x56ce08,_0xccdb0b){var _0x687031={},_0x438b46={},_0x228a0e={'count':0x0,'rows':[]};var _0x367356=_[_0x0f66('0x2f')](db['WhatsappMessage'][_0x0f66('0x30')],function(_0x463fa0){return{'name':_0x463fa0[_0x0f66('0x31')],'type':_0x463fa0['type'][_0x0f66('0x32')]};});_0x438b46[_0x0f66('0x33')]=_[_0x0f66('0x2f')](_0x367356,'name');_0x438b46[_0x0f66('0x34')]=_['keys'](_0x56ce08[_0x0f66('0x34')]);_0x438b46[_0x0f66('0x35')]=_['intersection'](_0x438b46[_0x0f66('0x33')],_0x438b46[_0x0f66('0x34')]);_0x687031[_0x0f66('0x36')]=_[_0x0f66('0x37')](_0x438b46[_0x0f66('0x33')],qs['fields'](_0x56ce08[_0x0f66('0x34')]['fields']));_0x687031[_0x0f66('0x36')]=_0x687031[_0x0f66('0x36')][_0x0f66('0x38')]?_0x687031[_0x0f66('0x36')]:_0x438b46['model'];if(!_0x56ce08[_0x0f66('0x34')][_0x0f66('0x39')](_0x0f66('0x3a'))){_0x687031['limit']=qs[_0x0f66('0x29')](_0x56ce08[_0x0f66('0x34')][_0x0f66('0x29')]);_0x687031[_0x0f66('0x26')]=qs[_0x0f66('0x26')](_0x56ce08['query']['offset']);}_0x687031[_0x0f66('0x3b')]=qs['sort'](_0x56ce08[_0x0f66('0x34')][_0x0f66('0x3c')]);_0x687031['where']=qs[_0x0f66('0x35')](_['pick'](_0x56ce08[_0x0f66('0x34')],_0x438b46[_0x0f66('0x35')]),_0x367356);if(_0x56ce08[_0x0f66('0x34')][_0x0f66('0x3d')]){_0x687031[_0x0f66('0x3e')]=_[_0x0f66('0x3f')](_0x687031[_0x0f66('0x3e')],{'$or':_[_0x0f66('0x2f')](_0x367356,function(_0x3e2217){if(_0x3e2217['type']!==_0x0f66('0x40')){var _0x16af30={};_0x16af30[_0x3e2217[_0x0f66('0x2c')]]={'$like':'%'+_0x56ce08[_0x0f66('0x34')][_0x0f66('0x3d')]+'%'};return _0x16af30;}})});}_0x687031=_[_0x0f66('0x3f')]({},_0x687031,_0x56ce08['options']);var _0x5ebed8={'where':_0x687031[_0x0f66('0x3e')]};return db[_0x0f66('0x41')][_0x0f66('0x28')](_0x5ebed8)['then'](function(_0x4c2001){_0x228a0e[_0x0f66('0x28')]=_0x4c2001;if(_0x56ce08['query'][_0x0f66('0x42')]){_0x687031[_0x0f66('0x43')]=[{'all':!![]}];}return db[_0x0f66('0x41')][_0x0f66('0x44')](_0x687031);})[_0x0f66('0x1c')](function(_0x2ba460){_0x228a0e['rows']=_0x2ba460;return _0x228a0e;})[_0x0f66('0x1c')](respondWithFilteredResult(_0xccdb0b,_0x687031))[_0x0f66('0x45')](handleError(_0xccdb0b,null));};exports[_0x0f66('0x46')]=function(_0x21215c,_0x350b89){var _0x530a99={'raw':!![],'where':{'id':_0x21215c[_0x0f66('0x47')]['id']}},_0x107721={};_0x107721[_0x0f66('0x33')]=_['keys'](db[_0x0f66('0x41')][_0x0f66('0x30')]);_0x107721[_0x0f66('0x34')]=_[_0x0f66('0x48')](_0x21215c[_0x0f66('0x34')]);_0x107721['filters']=_[_0x0f66('0x37')](_0x107721['model'],_0x107721['query']);_0x530a99[_0x0f66('0x36')]=_[_0x0f66('0x37')](_0x107721['model'],qs['fields'](_0x21215c[_0x0f66('0x34')][_0x0f66('0x49')]));_0x530a99[_0x0f66('0x36')]=_0x530a99[_0x0f66('0x36')]['length']?_0x530a99[_0x0f66('0x36')]:_0x107721[_0x0f66('0x33')];if(_0x21215c[_0x0f66('0x34')][_0x0f66('0x42')]){_0x530a99[_0x0f66('0x43')]=[{'all':!![]}];}_0x530a99=_['merge']({},_0x530a99,_0x21215c[_0x0f66('0x4a')]);return db[_0x0f66('0x41')][_0x0f66('0x4b')](_0x530a99)[_0x0f66('0x1c')](handleEntityNotFound(_0x350b89,null))[_0x0f66('0x1c')](respondWithResult(_0x350b89,null))[_0x0f66('0x45')](handleError(_0x350b89,null));};exports[_0x0f66('0x4c')]=function(_0x2da458,_0x43bec4){return db[_0x0f66('0x41')][_0x0f66('0x4c')](_0x2da458['body'],{})[_0x0f66('0x1c')](respondWithResult(_0x43bec4,0xc9))['catch'](handleError(_0x43bec4,null));};exports[_0x0f66('0x4d')]=function(_0x4eea3f,_0x1d2198){if(_0x4eea3f[_0x0f66('0x4e')]['id']){delete _0x4eea3f['body']['id'];}return db['WhatsappMessage'][_0x0f66('0x4b')]({'where':{'id':_0x4eea3f[_0x0f66('0x47')]['id']}})[_0x0f66('0x1c')](handleEntityNotFound(_0x1d2198,null))[_0x0f66('0x1c')](saveUpdates(_0x4eea3f[_0x0f66('0x4e')],null))[_0x0f66('0x1c')](respondWithResult(_0x1d2198,null))[_0x0f66('0x45')](handleError(_0x1d2198,null));};exports[_0x0f66('0x4f')]=function(_0x2d8a69,_0x7e55a9){return db[_0x0f66('0x41')]['find']({'where':{'id':_0x2d8a69[_0x0f66('0x47')]['id']}})[_0x0f66('0x1c')](handleEntityNotFound(_0x7e55a9,null))[_0x0f66('0x1c')](removeEntity(_0x7e55a9,null))[_0x0f66('0x45')](handleError(_0x7e55a9,null));};exports[_0x0f66('0x50')]=function(_0x8f3f62,_0x1f950b){return db[_0x0f66('0x41')][_0x0f66('0x50')]()[_0x0f66('0x1c')](respondWithResult(_0x1f950b,null))[_0x0f66('0x45')](handleError(_0x1f950b,null));};var interaction_log=require('../../config/logger')(_0x0f66('0x51'));exports[_0x0f66('0x52')]=function(_0x38c3cc,_0x1047e9,_0x61a13d){var _0x2f0d66={'agent':{},'channel':_0x0f66('0x53')};if(_0x38c3cc[_0x0f66('0x4e')]['id']){delete _0x38c3cc[_0x0f66('0x4e')]['id'];}_0x38c3cc[_0x0f66('0x4e')][_0x0f66('0x54')]=!![];_0x38c3cc[_0x0f66('0x4e')][_0x0f66('0x55')]=moment()[_0x0f66('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x38c3cc['body']['UserId']=_0x38c3cc[_0x0f66('0x4e')][_0x0f66('0x57')]||_0x38c3cc[_0x0f66('0x58')]['id'];_0x2f0d66[_0x0f66('0x59')]['id']=_0x38c3cc['body'][_0x0f66('0x57')];return db['WhatsappMessage'][_0x0f66('0x4b')]({'where':{'id':_0x38c3cc[_0x0f66('0x47')]['id'],'UserId':null}})[_0x0f66('0x1c')](handleEntityNotFound(_0x1047e9,null))['then'](saveUpdates(_0x38c3cc['body'],null))['then'](function(_0x1919de){if(_0x1919de){_0x2f0d66[_0x0f66('0x23')]=_0x1919de[_0x0f66('0x5a')]({'plain':!![]});return db[_0x0f66('0x5b')][_0x0f66('0x4b')]({'where':{'id':_0x1919de['WhatsappInteractionId']}});}return null;})[_0x0f66('0x1c')](handleEntityNotFound(_0x1047e9,null))[_0x0f66('0x1c')](function(_0x706594){if(_0x706594){return _0x706594['update']({'UserId':_0x38c3cc[_0x0f66('0x4e')][_0x0f66('0x57')],'read1stAt':_[_0x0f66('0x5c')](_0x706594['read1stAt'])?moment()[_0x0f66('0x56')](_0x0f66('0x5d')):undefined});}return null;})['then'](function(_0x1f89f7){if(_0x1f89f7){_0x2f0d66['interaction']=_0x1f89f7[_0x0f66('0x5a')]({'plain':!![]});interaction_log['info'](_0x0f66('0x5e'),_0x38c3cc[_0x0f66('0x58')]['id'],_0x38c3cc[_0x0f66('0x58')]['name'],_0x38c3cc[_0x0f66('0x58')]['role'],_0x2f0d66[_0x0f66('0x5f')]['id'],_0x38c3cc[_0x0f66('0x4e')]?JSON['stringify'](_0x38c3cc['body']):_0x0f66('0x60'));return respondWithRpcPromise(_0x0f66('0x61'),_0x0f66('0x62'),_0x2f0d66);}return null;})[_0x0f66('0x1c')](function(_0x397321){var _0x317c87='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x397321['message'][_0x0f66('0x63')];return db[_0x0f66('0x64')]['query'](_0x317c87,{'type':db[_0x0f66('0x65')][_0x0f66('0x66')]['SELECT'],'raw':!![]})[_0x0f66('0x1c')](function(_0xc19687){return _0xc19687;});})[_0x0f66('0x1c')](function(_0x111562){if(_0x111562){_0x2f0d66[_0x0f66('0x23')][_0x0f66('0x67')]=_0x111562[0x0];if(!_0x38c3cc[_0x0f66('0x4e')][_0x0f66('0x57')])return;return db[_0x0f66('0x68')]['find']({'where':{'id':_0x38c3cc['body'][_0x0f66('0x57')],'role':'agent'},'attributes':['id',_0x0f66('0x2c'),_0x0f66('0x69'),_0x0f66('0x6a'),'internal'],'raw':!![]});}return null;})['then'](function(_0xb1ab70){if(!_0xb1ab70)return null;_0x2f0d66['message'][_0x0f66('0x59')]=_0xb1ab70;return _0x2f0d66;})[_0x0f66('0x1c')](function(_0x3d6896){if(_0x3d6896){if(_0x38c3cc['body']['manual']){_0x2f0d66[_0x0f66('0x23')][_0x0f66('0x6b')]=util[_0x0f66('0x56')]('SIP/%s',_0x38c3cc['user']['name']);_0x2f0d66[_0x0f66('0x23')][_0x0f66('0x6c')]=_0x2f0d66[_0x0f66('0x6c')];_0x2f0d66[_0x0f66('0x23')]['motionChannel']=_0x2f0d66['channel'];_0x2f0d66[_0x0f66('0x23')][_0x0f66('0x6d')]=_0x0f66('0x52');return respondWithRpcPromise(_0x0f66('0x6e'),_0x0f66('0x6e'),{'event':'acceptmessage','message':_0x2f0d66[_0x0f66('0x23')]},client9002)[_0x0f66('0x1c')](function(){return _0x2f0d66;});}return _0x2f0d66;}return null;})[_0x0f66('0x1c')](respondWithResult(_0x1047e9,null))['catch'](handleError(_0x1047e9,null));};var interaction_log=require(_0x0f66('0x6f'))(_0x0f66('0x51'));exports['reject']=function(_0x8dda2e,_0x262aed,_0x4544e9){var _0x3caeff={'agent':{},'channel':_0x0f66('0x53')};if(_0x8dda2e[_0x0f66('0x4e')]['id']){delete _0x8dda2e['body']['id'];}_0x8dda2e[_0x0f66('0x4e')]['UserId']=_0x8dda2e[_0x0f66('0x4e')][_0x0f66('0x57')]||_0x8dda2e[_0x0f66('0x58')]['id'];_0x3caeff[_0x0f66('0x59')]['id']=_0x8dda2e[_0x0f66('0x4e')][_0x0f66('0x57')];return db[_0x0f66('0x41')][_0x0f66('0x4b')]({'where':{'id':_0x8dda2e[_0x0f66('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x262aed,null))[_0x0f66('0x1c')](function(_0x235de2){if(_0x235de2){_0x3caeff['message']=_0x235de2[_0x0f66('0x5a')]({'plain':!![]});return db[_0x0f66('0x5b')][_0x0f66('0x4b')]({'where':{'id':_0x235de2[_0x0f66('0x70')]}});}return null;})['then'](handleEntityNotFound(_0x262aed,null))[_0x0f66('0x1c')](function(_0x12d258){if(_0x12d258){_0x3caeff[_0x0f66('0x5f')]=_0x12d258['get']({'plain':!![]});interaction_log[_0x0f66('0x1d')](_0x0f66('0x71'),_0x8dda2e['user']['id'],_0x8dda2e[_0x0f66('0x58')][_0x0f66('0x2c')],_0x8dda2e[_0x0f66('0x58')][_0x0f66('0x72')],_0x3caeff['interaction']['id'],_0x8dda2e['body']?JSON[_0x0f66('0x20')](_0x8dda2e[_0x0f66('0x4e')]):'null');return respondWithRpcPromise(_0x0f66('0x73'),_0x0f66('0x74'),_0x3caeff);}return null;})[_0x0f66('0x1c')](function(_0x122235){var _0xb31a52='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x122235[_0x0f66('0x23')]['ContactId'];return db[_0x0f66('0x64')][_0x0f66('0x34')](_0xb31a52,{'type':db[_0x0f66('0x65')][_0x0f66('0x66')][_0x0f66('0x75')],'raw':!![]})[_0x0f66('0x1c')](function(_0x1c914d){return _0x1c914d;});})[_0x0f66('0x1c')](function(_0x15b37b){if(_0x15b37b){_0x3caeff[_0x0f66('0x23')][_0x0f66('0x67')]=_0x15b37b[0x0];if(!_0x8dda2e[_0x0f66('0x4e')][_0x0f66('0x57')])return;return db[_0x0f66('0x68')][_0x0f66('0x4b')]({'where':{'id':_0x8dda2e[_0x0f66('0x4e')][_0x0f66('0x57')],'role':_0x0f66('0x59')},'attributes':['id',_0x0f66('0x2c'),_0x0f66('0x69'),'email',_0x0f66('0x76')],'raw':!![]});}return null;})[_0x0f66('0x1c')](function(_0x4691d8){if(!_0x4691d8)return null;_0x3caeff[_0x0f66('0x23')]['agent']=_0x4691d8;return _0x3caeff;})[_0x0f66('0x1c')](function(_0x347819){if(_0x347819){_0x347819[_0x0f66('0x23')][_0x0f66('0x6b')]=util[_0x0f66('0x56')]('SIP/%s',_0x8dda2e[_0x0f66('0x58')][_0x0f66('0x2c')]);_0x347819[_0x0f66('0x23')][_0x0f66('0x6c')]=_0x3caeff[_0x0f66('0x6c')];_0x347819[_0x0f66('0x23')][_0x0f66('0x77')]=_0x3caeff[_0x0f66('0x6c')];_0x347819[_0x0f66('0x23')][_0x0f66('0x6d')]='reject';respondWithRpcPromise(_0x0f66('0x6e'),_0x0f66('0x6e'),{'event':'rejectmessage','message':_0x347819[_0x0f66('0x23')]},client9002);return _0x3caeff;}return null;})[_0x0f66('0x1c')](respondWithResult(_0x262aed,null))['catch'](handleError(_0x262aed,null));};exports[_0x0f66('0x24')]=function(_0xec7ba5,_0x5a8347,_0x1ff916){if(_0xec7ba5['body']['id']){delete _0xec7ba5[_0x0f66('0x4e')]['id'];}var _0x168ee1;return db[_0x0f66('0x41')]['find']({'where':{'id':_0xec7ba5['params']['id']}})['then'](handleEntityNotFound(_0x5a8347,null))[_0x0f66('0x1c')](function(_0x4df0c6){if(_0x4df0c6){_0x168ee1=_0x4df0c6;return db[_0x0f66('0x78')]['find']({'where':{'id':_0x4df0c6[_0x0f66('0x79')]}});}})[_0x0f66('0x1c')](handleEntityNotFound(_0x5a8347,null))[_0x0f66('0x1c')](function(_0xc9f40a){if(_0xc9f40a){logger[_0x0f66('0x1f')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x0f66('0x24'),_0x0f66('0x7a'),_0xc9f40a[_0x0f66('0x7b')],util[_0x0f66('0x7c')](_0xec7ba5[_0x0f66('0x4e')],{'showHidden':![],'depth':null}));switch(_0xc9f40a[_0x0f66('0x7b')]){case _0x0f66('0x7d'):if(_0xec7ba5[_0x0f66('0x4e')][_0x0f66('0x7e')]&&_0xec7ba5['body']['MessageSid']===_0x168ee1[_0x0f66('0x7f')]&&_0xec7ba5[_0x0f66('0x4e')][_0x0f66('0x80')]&&_0xec7ba5[_0x0f66('0x4e')][_0x0f66('0x80')]===_0x0f66('0x54')){return _0x168ee1[_0x0f66('0x4d')]({'read':!![]});}else{logger[_0x0f66('0x21')](_0x0f66('0x81'),'status',_0x0f66('0x7d'),util['inspect'](_0xec7ba5['body'],{'showHidden':![],'depth':null}));}break;}return _0x168ee1;}})[_0x0f66('0x1c')](respondWithResult(_0x5a8347,null))['catch'](handleError(_0x5a8347,null));}; \ No newline at end of file +var _0x2cd0=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','keys','create','body','params','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','agent','get','WhatsappInteraction','find','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','type','inspect','twilio','MessageSid','eml-format','rimraf','zip-dir'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x2cd0,0x89));var _0x02cd=function(_0x1f6760,_0x2379fb){_0x1f6760=_0x1f6760-0x0;var _0x3e1c9f=_0x2cd0[_0x1f6760];return _0x3e1c9f;};'use strict';var emlformat=require(_0x02cd('0x0'));var rimraf=require(_0x02cd('0x1'));var zipdir=require(_0x02cd('0x2'));var jsonpatch=require(_0x02cd('0x3'));var rp=require(_0x02cd('0x4'));var moment=require(_0x02cd('0x5'));var BPromise=require(_0x02cd('0x6'));var Mustache=require(_0x02cd('0x7'));var util=require('util');var path=require(_0x02cd('0x8'));var sox=require(_0x02cd('0x9'));var csv=require('to-csv');var ejs=require(_0x02cd('0xa'));var fs=require('fs');var fs_extra=require(_0x02cd('0xb'));var _=require(_0x02cd('0xc'));var squel=require('squel');var crypto=require(_0x02cd('0xd'));var jsforce=require(_0x02cd('0xe'));var deskjs=require(_0x02cd('0xf'));var toCsv=require(_0x02cd('0x10'));var querystring=require(_0x02cd('0x11'));var Papa=require(_0x02cd('0x12'));var Redis=require(_0x02cd('0x13'));var authService=require(_0x02cd('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x02cd('0x15'));var hardwareService=require(_0x02cd('0x16'));var logger=require('../../config/logger')(_0x02cd('0x17'));var utils=require(_0x02cd('0x18'));var config=require(_0x02cd('0x19'));var licenseUtil=require(_0x02cd('0x1a'));var db=require(_0x02cd('0x1b'))['db'];config['redis']=_[_0x02cd('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x02cd('0x1d'))(new Redis(config[_0x02cd('0x1e')]));require('./whatsappMessage.socket')[_0x02cd('0x1f')](socket);var jayson=require(_0x02cd('0x20'));var client=jayson[_0x02cd('0x21')][_0x02cd('0x22')]({'port':0x232c});var client9002=jayson[_0x02cd('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462187,_0x9954e6,_0x1b11f4,_0x429cf5){return new BPromise(function(_0x4f14c4,_0x216188){var _0x5c29e9=_0x429cf5||client;return _0x5c29e9[_0x02cd('0x23')](_0x462187,_0x1b11f4)[_0x02cd('0x24')](function(_0x2acf5c){logger[_0x02cd('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x9954e6,_0x02cd('0x26'));logger[_0x02cd('0x27')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x9954e6,'request\x20sent',JSON[_0x02cd('0x28')](_0x2acf5c));if(_0x2acf5c[_0x02cd('0x29')]){if(_0x2acf5c[_0x02cd('0x29')]['code']===0x1f4){logger['error'](_0x02cd('0x2a'),_0x9954e6,_0x2acf5c[_0x02cd('0x29')][_0x02cd('0x2b')]);return _0x216188(_0x2acf5c[_0x02cd('0x29')][_0x02cd('0x2b')]);}logger[_0x02cd('0x29')](_0x02cd('0x2a'),_0x9954e6,_0x2acf5c[_0x02cd('0x29')][_0x02cd('0x2b')]);return _0x4f14c4(_0x2acf5c[_0x02cd('0x29')][_0x02cd('0x2b')]);}else{logger[_0x02cd('0x25')](_0x02cd('0x2a'),_0x9954e6,_0x02cd('0x26'));_0x4f14c4(_0x2acf5c[_0x02cd('0x2c')][_0x02cd('0x2b')]);}})[_0x02cd('0x2d')](function(_0x25a92d){logger[_0x02cd('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x9954e6,_0x25a92d);_0x216188(_0x25a92d);});});}function respondWithStatusCode(_0x51d57e,_0x59b005){_0x59b005=_0x59b005||0xcc;return function(_0xc90f8f){if(_0xc90f8f){return _0x51d57e[_0x02cd('0x2e')](_0x59b005);}return _0x51d57e[_0x02cd('0x2f')](_0x59b005)[_0x02cd('0x30')]();};}function respondWithResult(_0x247883,_0x43ce28){_0x43ce28=_0x43ce28||0xc8;return function(_0x20baa4){if(_0x20baa4){return _0x247883[_0x02cd('0x2f')](_0x43ce28)[_0x02cd('0x31')](_0x20baa4);}};}function respondWithFilteredResult(_0x11509c,_0x22778f){return function(_0x3b41ce){if(_0x3b41ce){var _0x373890=typeof _0x22778f[_0x02cd('0x32')]===_0x02cd('0x33')&&typeof _0x22778f['limit']===_0x02cd('0x33');var _0x503121=_0x3b41ce[_0x02cd('0x34')];var _0x3f06e7=_0x373890?0x0:_0x22778f['offset'];var _0x3b131d=_0x373890?_0x3b41ce[_0x02cd('0x34')]:_0x22778f[_0x02cd('0x32')]+_0x22778f[_0x02cd('0x35')];var _0x513820;if(_0x3b131d>=_0x503121){_0x3b131d=_0x503121;_0x513820=0xc8;}else{_0x513820=0xce;}_0x11509c['status'](_0x513820);return _0x11509c[_0x02cd('0x36')]('Content-Range',_0x3f06e7+'-'+_0x3b131d+'/'+_0x503121)[_0x02cd('0x31')](_0x3b41ce);}return null;};}function patchUpdates(_0x2c0331){return function(_0x531865){try{jsonpatch['apply'](_0x531865,_0x2c0331,!![]);}catch(_0x1bf2dc){return BPromise[_0x02cd('0x37')](_0x1bf2dc);}return _0x531865['save']();};}function saveUpdates(_0x236617,_0xd61d3a){return function(_0x3061c5){if(_0x3061c5){return _0x3061c5[_0x02cd('0x38')](_0x236617)[_0x02cd('0x24')](function(_0x398518){return _0x398518;});}return null;};}function removeEntity(_0x37ce5b,_0x10e380){return function(_0xb65093){if(_0xb65093){return _0xb65093['destroy']()[_0x02cd('0x24')](function(){_0x37ce5b[_0x02cd('0x2f')](0xcc)[_0x02cd('0x30')]();});}};}function handleEntityNotFound(_0x382471,_0x23e9bd){return function(_0x4d839d){if(!_0x4d839d){_0x382471[_0x02cd('0x2e')](0x194);}return _0x4d839d;};}function handleError(_0x316b96,_0x8bf258){_0x8bf258=_0x8bf258||0x1f4;return function(_0x145cc3){logger[_0x02cd('0x29')](_0x145cc3[_0x02cd('0x39')]);if(_0x145cc3[_0x02cd('0x3a')]){delete _0x145cc3[_0x02cd('0x3a')];}_0x316b96[_0x02cd('0x2f')](_0x8bf258)[_0x02cd('0x3b')](_0x145cc3);};}exports[_0x02cd('0x3c')]=function(_0x10262b,_0x74a22c){var _0x4bcce1={},_0x486a37={},_0x2a2543={'count':0x0,'rows':[]};var _0x24264c=_[_0x02cd('0x3d')](db[_0x02cd('0x3e')][_0x02cd('0x3f')],function(_0x424e4e){return{'name':_0x424e4e[_0x02cd('0x40')],'type':_0x424e4e['type'][_0x02cd('0x41')]};});_0x486a37[_0x02cd('0x42')]=_[_0x02cd('0x3d')](_0x24264c,_0x02cd('0x3a'));_0x486a37[_0x02cd('0x43')]=_['keys'](_0x10262b[_0x02cd('0x43')]);_0x486a37['filters']=_['intersection'](_0x486a37[_0x02cd('0x42')],_0x486a37[_0x02cd('0x43')]);_0x4bcce1[_0x02cd('0x44')]=_[_0x02cd('0x45')](_0x486a37[_0x02cd('0x42')],qs['fields'](_0x10262b['query'][_0x02cd('0x46')]));_0x4bcce1[_0x02cd('0x44')]=_0x4bcce1['attributes'][_0x02cd('0x47')]?_0x4bcce1[_0x02cd('0x44')]:_0x486a37['model'];if(!_0x10262b['query'][_0x02cd('0x48')]('nolimit')){_0x4bcce1[_0x02cd('0x35')]=qs[_0x02cd('0x35')](_0x10262b[_0x02cd('0x43')]['limit']);_0x4bcce1[_0x02cd('0x32')]=qs[_0x02cd('0x32')](_0x10262b['query']['offset']);}_0x4bcce1['order']=qs['sort'](_0x10262b['query'][_0x02cd('0x49')]);_0x4bcce1[_0x02cd('0x4a')]=qs[_0x02cd('0x4b')](_[_0x02cd('0x4c')](_0x10262b[_0x02cd('0x43')],_0x486a37['filters']),_0x24264c);if(_0x10262b['query'][_0x02cd('0x4d')]){_0x4bcce1[_0x02cd('0x4a')]=_[_0x02cd('0x4e')](_0x4bcce1['where'],{'$or':_[_0x02cd('0x3d')](_0x24264c,function(_0x366e3f){if(_0x366e3f['type']!=='VIRTUAL'){var _0x5e167c={};_0x5e167c[_0x366e3f['name']]={'$like':'%'+_0x10262b['query'][_0x02cd('0x4d')]+'%'};return _0x5e167c;}})});}_0x4bcce1=_[_0x02cd('0x4e')]({},_0x4bcce1,_0x10262b[_0x02cd('0x4f')]);var _0x2ddc92={'where':_0x4bcce1[_0x02cd('0x4a')]};return db[_0x02cd('0x3e')][_0x02cd('0x34')](_0x2ddc92)[_0x02cd('0x24')](function(_0xf77f1b){_0x2a2543[_0x02cd('0x34')]=_0xf77f1b;if(_0x10262b[_0x02cd('0x43')][_0x02cd('0x50')]){_0x4bcce1[_0x02cd('0x51')]=[{'all':!![]}];}return db[_0x02cd('0x3e')][_0x02cd('0x52')](_0x4bcce1);})['then'](function(_0x5a6bc4){_0x2a2543[_0x02cd('0x53')]=_0x5a6bc4;return _0x2a2543;})['then'](respondWithFilteredResult(_0x74a22c,_0x4bcce1))[_0x02cd('0x2d')](handleError(_0x74a22c,null));};exports['show']=function(_0x35063b,_0x3532f3){var _0xd12217={'raw':!![],'where':{'id':_0x35063b['params']['id']}},_0x306677={};_0x306677[_0x02cd('0x42')]=_['keys'](db['WhatsappMessage'][_0x02cd('0x3f')]);_0x306677['query']=_[_0x02cd('0x54')](_0x35063b[_0x02cd('0x43')]);_0x306677[_0x02cd('0x4b')]=_[_0x02cd('0x45')](_0x306677[_0x02cd('0x42')],_0x306677[_0x02cd('0x43')]);_0xd12217['attributes']=_[_0x02cd('0x45')](_0x306677[_0x02cd('0x42')],qs[_0x02cd('0x46')](_0x35063b['query']['fields']));_0xd12217['attributes']=_0xd12217[_0x02cd('0x44')][_0x02cd('0x47')]?_0xd12217['attributes']:_0x306677[_0x02cd('0x42')];if(_0x35063b[_0x02cd('0x43')][_0x02cd('0x50')]){_0xd12217[_0x02cd('0x51')]=[{'all':!![]}];}_0xd12217=_['merge']({},_0xd12217,_0x35063b[_0x02cd('0x4f')]);return db[_0x02cd('0x3e')]['find'](_0xd12217)[_0x02cd('0x24')](handleEntityNotFound(_0x3532f3,null))[_0x02cd('0x24')](respondWithResult(_0x3532f3,null))['catch'](handleError(_0x3532f3,null));};exports[_0x02cd('0x55')]=function(_0x23e045,_0x41420c){return db[_0x02cd('0x3e')][_0x02cd('0x55')](_0x23e045[_0x02cd('0x56')],{})[_0x02cd('0x24')](respondWithResult(_0x41420c,0xc9))[_0x02cd('0x2d')](handleError(_0x41420c,null));};exports[_0x02cd('0x38')]=function(_0x502b37,_0x57763b){if(_0x502b37[_0x02cd('0x56')]['id']){delete _0x502b37['body']['id'];}return db[_0x02cd('0x3e')]['find']({'where':{'id':_0x502b37[_0x02cd('0x57')]['id']}})[_0x02cd('0x24')](handleEntityNotFound(_0x57763b,null))[_0x02cd('0x24')](saveUpdates(_0x502b37[_0x02cd('0x56')],null))[_0x02cd('0x24')](respondWithResult(_0x57763b,null))[_0x02cd('0x2d')](handleError(_0x57763b,null));};exports[_0x02cd('0x58')]=function(_0xc4e51c,_0x5350f5){return db[_0x02cd('0x3e')]['find']({'where':{'id':_0xc4e51c['params']['id']}})[_0x02cd('0x24')](handleEntityNotFound(_0x5350f5,null))[_0x02cd('0x24')](removeEntity(_0x5350f5,null))[_0x02cd('0x2d')](handleError(_0x5350f5,null));};exports[_0x02cd('0x59')]=function(_0x29be4f,_0x25b974){return db[_0x02cd('0x3e')]['describe']()[_0x02cd('0x24')](respondWithResult(_0x25b974,null))[_0x02cd('0x2d')](handleError(_0x25b974,null));};var interaction_log=require(_0x02cd('0x5a'))(_0x02cd('0x5b'));exports[_0x02cd('0x5c')]=function(_0x26a41f,_0x32946c,_0x1ae062){var _0x4b764b={'agent':{},'channel':_0x02cd('0x5d')};if(_0x26a41f[_0x02cd('0x56')]['id']){delete _0x26a41f[_0x02cd('0x56')]['id'];}_0x26a41f['body'][_0x02cd('0x5e')]=!![];_0x26a41f[_0x02cd('0x56')]['readAt']=moment()[_0x02cd('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x26a41f[_0x02cd('0x56')][_0x02cd('0x60')]=_0x26a41f[_0x02cd('0x56')]['UserId']||_0x26a41f[_0x02cd('0x61')]['id'];_0x4b764b[_0x02cd('0x62')]['id']=_0x26a41f['body'][_0x02cd('0x60')];return db[_0x02cd('0x3e')]['find']({'where':{'id':_0x26a41f[_0x02cd('0x57')]['id'],'UserId':null}})[_0x02cd('0x24')](handleEntityNotFound(_0x32946c,null))[_0x02cd('0x24')](saveUpdates(_0x26a41f[_0x02cd('0x56')],null))[_0x02cd('0x24')](function(_0x403e8c){if(_0x403e8c){_0x4b764b[_0x02cd('0x2b')]=_0x403e8c[_0x02cd('0x63')]({'plain':!![]});return db[_0x02cd('0x64')][_0x02cd('0x65')]({'where':{'id':_0x403e8c[_0x02cd('0x66')]}});}return null;})[_0x02cd('0x24')](handleEntityNotFound(_0x32946c,null))[_0x02cd('0x24')](function(_0x17b5c9){if(_0x17b5c9){return _0x17b5c9[_0x02cd('0x38')]({'UserId':_0x26a41f[_0x02cd('0x56')][_0x02cd('0x60')],'read1stAt':_[_0x02cd('0x67')](_0x17b5c9[_0x02cd('0x68')])?moment()['format'](_0x02cd('0x69')):undefined});}return null;})[_0x02cd('0x24')](function(_0x328cea){if(_0x328cea){_0x4b764b[_0x02cd('0x6a')]=_0x328cea[_0x02cd('0x63')]({'plain':!![]});interaction_log[_0x02cd('0x25')](_0x02cd('0x6b'),_0x26a41f[_0x02cd('0x61')]['id'],_0x26a41f[_0x02cd('0x61')]['name'],_0x26a41f[_0x02cd('0x61')]['role'],_0x4b764b[_0x02cd('0x6a')]['id'],_0x26a41f[_0x02cd('0x56')]?JSON['stringify'](_0x26a41f[_0x02cd('0x56')]):_0x02cd('0x6c'));return respondWithRpcPromise(_0x02cd('0x6d'),_0x02cd('0x6e'),_0x4b764b);}return null;})['then'](function(_0x593528){var _0xd94235=_0x02cd('0x6f')+_0x593528[_0x02cd('0x2b')]['ContactId'];return db[_0x02cd('0x70')][_0x02cd('0x43')](_0xd94235,{'type':db[_0x02cd('0x71')]['QueryTypes'][_0x02cd('0x72')],'raw':!![]})[_0x02cd('0x24')](function(_0x5d5cf2){return _0x5d5cf2;});})[_0x02cd('0x24')](function(_0x3d3164){if(_0x3d3164){_0x4b764b[_0x02cd('0x2b')]['contact']=_0x3d3164[0x0];if(!_0x26a41f[_0x02cd('0x56')][_0x02cd('0x60')])return;return db[_0x02cd('0x73')][_0x02cd('0x65')]({'where':{'id':_0x26a41f[_0x02cd('0x56')][_0x02cd('0x60')],'role':_0x02cd('0x62')},'attributes':['id','name',_0x02cd('0x74'),_0x02cd('0x75'),_0x02cd('0x76')],'raw':!![]});}return null;})[_0x02cd('0x24')](function(_0x145e12){if(!_0x145e12)return null;_0x4b764b['message'][_0x02cd('0x62')]=_0x145e12;return _0x4b764b;})[_0x02cd('0x24')](function(_0x2f8048){if(_0x2f8048){if(_0x26a41f[_0x02cd('0x56')][_0x02cd('0x77')]){_0x4b764b['message'][_0x02cd('0x78')]=util[_0x02cd('0x5f')](_0x02cd('0x79'),_0x26a41f[_0x02cd('0x61')][_0x02cd('0x3a')]);_0x4b764b[_0x02cd('0x2b')][_0x02cd('0x7a')]=_0x4b764b[_0x02cd('0x7a')];_0x4b764b[_0x02cd('0x2b')][_0x02cd('0x7b')]=_0x4b764b[_0x02cd('0x7a')];_0x4b764b[_0x02cd('0x2b')][_0x02cd('0x7c')]=_0x02cd('0x5c');return respondWithRpcPromise(_0x02cd('0x7d'),_0x02cd('0x7d'),{'event':_0x02cd('0x7e'),'message':_0x4b764b[_0x02cd('0x2b')]},client9002)[_0x02cd('0x24')](function(){return _0x4b764b;});}return _0x4b764b;}return null;})[_0x02cd('0x24')](respondWithResult(_0x32946c,null))[_0x02cd('0x2d')](handleError(_0x32946c,null));};var interaction_log=require(_0x02cd('0x5a'))('whatsapp-interactions');exports[_0x02cd('0x37')]=function(_0x2a49e4,_0x62d6d3,_0x522a54){var _0x53d223={'agent':{},'channel':_0x02cd('0x5d')};if(_0x2a49e4[_0x02cd('0x56')]['id']){delete _0x2a49e4[_0x02cd('0x56')]['id'];}_0x2a49e4[_0x02cd('0x56')][_0x02cd('0x60')]=_0x2a49e4['body']['UserId']||_0x2a49e4[_0x02cd('0x61')]['id'];_0x53d223['agent']['id']=_0x2a49e4[_0x02cd('0x56')][_0x02cd('0x60')];return db[_0x02cd('0x3e')][_0x02cd('0x65')]({'where':{'id':_0x2a49e4[_0x02cd('0x57')]['id'],'UserId':null}})[_0x02cd('0x24')](handleEntityNotFound(_0x62d6d3,null))[_0x02cd('0x24')](function(_0x14452a){if(_0x14452a){_0x53d223['message']=_0x14452a[_0x02cd('0x63')]({'plain':!![]});return db[_0x02cd('0x64')][_0x02cd('0x65')]({'where':{'id':_0x14452a[_0x02cd('0x66')]}});}return null;})[_0x02cd('0x24')](handleEntityNotFound(_0x62d6d3,null))[_0x02cd('0x24')](function(_0x2b8e23){if(_0x2b8e23){_0x53d223[_0x02cd('0x6a')]=_0x2b8e23[_0x02cd('0x63')]({'plain':!![]});interaction_log[_0x02cd('0x25')](_0x02cd('0x7f'),_0x2a49e4['user']['id'],_0x2a49e4[_0x02cd('0x61')][_0x02cd('0x3a')],_0x2a49e4[_0x02cd('0x61')]['role'],_0x53d223[_0x02cd('0x6a')]['id'],_0x2a49e4[_0x02cd('0x56')]?JSON['stringify'](_0x2a49e4[_0x02cd('0x56')]):'null');return respondWithRpcPromise(_0x02cd('0x80'),_0x02cd('0x81'),_0x53d223);}return null;})[_0x02cd('0x24')](function(_0x3e2ca3){var _0x4ad9e5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3e2ca3[_0x02cd('0x2b')][_0x02cd('0x82')];return db[_0x02cd('0x70')][_0x02cd('0x43')](_0x4ad9e5,{'type':db[_0x02cd('0x71')][_0x02cd('0x83')][_0x02cd('0x72')],'raw':!![]})['then'](function(_0x401420){return _0x401420;});})[_0x02cd('0x24')](function(_0x31d50e){if(_0x31d50e){_0x53d223[_0x02cd('0x2b')][_0x02cd('0x84')]=_0x31d50e[0x0];if(!_0x2a49e4[_0x02cd('0x56')][_0x02cd('0x60')])return;return db[_0x02cd('0x73')][_0x02cd('0x65')]({'where':{'id':_0x2a49e4['body'][_0x02cd('0x60')],'role':_0x02cd('0x62')},'attributes':['id',_0x02cd('0x3a'),_0x02cd('0x74'),'email',_0x02cd('0x76')],'raw':!![]});}return null;})['then'](function(_0x1bbd90){if(!_0x1bbd90)return null;_0x53d223[_0x02cd('0x2b')]['agent']=_0x1bbd90;return _0x53d223;})['then'](function(_0x5e239e){if(_0x5e239e){_0x5e239e[_0x02cd('0x2b')][_0x02cd('0x78')]=util[_0x02cd('0x5f')](_0x02cd('0x79'),_0x2a49e4[_0x02cd('0x61')][_0x02cd('0x3a')]);_0x5e239e[_0x02cd('0x2b')][_0x02cd('0x7a')]=_0x53d223[_0x02cd('0x7a')];_0x5e239e[_0x02cd('0x2b')]['motionChannel']=_0x53d223[_0x02cd('0x7a')];_0x5e239e[_0x02cd('0x2b')][_0x02cd('0x7c')]=_0x02cd('0x37');respondWithRpcPromise('EventManager',_0x02cd('0x7d'),{'event':_0x02cd('0x85'),'message':_0x5e239e['message']},client9002);return _0x53d223;}return null;})[_0x02cd('0x24')](respondWithResult(_0x62d6d3,null))[_0x02cd('0x2d')](handleError(_0x62d6d3,null));};exports[_0x02cd('0x2f')]=function(_0x23f416,_0x3a2f83,_0x4d97e0){if(_0x23f416[_0x02cd('0x56')]['id']){delete _0x23f416[_0x02cd('0x56')]['id'];}var _0x53f243;return db[_0x02cd('0x3e')][_0x02cd('0x65')]({'where':{'id':_0x23f416[_0x02cd('0x57')]['id']}})['then'](handleEntityNotFound(_0x3a2f83,null))[_0x02cd('0x24')](function(_0x5b9745){if(_0x5b9745){_0x53f243=_0x5b9745;return db[_0x02cd('0x86')][_0x02cd('0x65')]({'where':{'id':_0x5b9745[_0x02cd('0x87')]}});}})['then'](handleEntityNotFound(_0x3a2f83,null))[_0x02cd('0x24')](function(_0x453324){if(_0x453324){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x453324[_0x02cd('0x88')],util[_0x02cd('0x89')](_0x23f416['body'],{'showHidden':![],'depth':null}));switch(_0x453324[_0x02cd('0x88')]){case _0x02cd('0x8a'):if(_0x23f416[_0x02cd('0x56')]['MessageSid']&&_0x23f416[_0x02cd('0x56')][_0x02cd('0x8b')]===_0x53f243['messageId']&&_0x23f416[_0x02cd('0x56')]['MessageStatus']&&_0x23f416[_0x02cd('0x56')]['MessageStatus']===_0x02cd('0x5e')){return _0x53f243[_0x02cd('0x38')]({'read':!![]});}else{logger[_0x02cd('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x02cd('0x2f'),'twilio',util[_0x02cd('0x89')](_0x23f416[_0x02cd('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x53f243;}})[_0x02cd('0x24')](respondWithResult(_0x3a2f83,null))[_0x02cd('0x2d')](handleError(_0x3a2f83,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 388320c..ab0c992 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 _0x8caf=['remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x4258c7,_0x3fec4c){_0x4258c7=_0x4258c7-0x0;var _0x3c5d58=_0x8caf[_0x4258c7];return _0x3c5d58;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf8ca('0x0'))['db'][_0xf8ca('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf8ca('0x2')](0x0);var events={'afterCreate':_0xf8ca('0x3'),'afterUpdate':_0xf8ca('0x4'),'afterDestroy':_0xf8ca('0x5')};function emitEvent(_0x4e6684){return function(_0x129ca9,_0x23939c,_0x2a9691){WhatsappMessageEvents[_0xf8ca('0x6')](_0x4e6684+':'+_0x129ca9['id'],_0x129ca9);WhatsappMessageEvents[_0xf8ca('0x6')](_0x4e6684,_0x129ca9);_0x2a9691(null);};}for(var e in events){if(events[_0xf8ca('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xf8ca('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xeffd=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xeffd,0x6b));var _0xdeff=function(_0x423d75,_0x456a95){_0x423d75=_0x423d75-0x0;var _0x41085=_0xeffd[_0x423d75];return _0x41085;};'use strict';var EventEmitter=require(_0xdeff('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xdeff('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xdeff('0x2')](0x0);var events={'afterCreate':_0xdeff('0x3'),'afterUpdate':_0xdeff('0x4'),'afterDestroy':_0xdeff('0x5')};function emitEvent(_0x4dac0){return function(_0x298274,_0x2881fd,_0x8315d4){WhatsappMessageEvents[_0xdeff('0x6')](_0x4dac0+':'+_0x298274['id'],_0x298274);WhatsappMessageEvents[_0xdeff('0x6')](_0x4dac0,_0x298274);_0x8315d4(null);};}for(var e in events){if(events[_0xdeff('0x7')](e)){var event=events[e];WhatsappMessage[_0xdeff('0x8')](e,emitEvent(event));}}module[_0xdeff('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a8566bb..22a648f 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 _0x4b84=['WhatsappInteraction','WhatsappInteractionId','update','createdAt','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','error','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/messages/','text','POST','Bearer\x20','application/json','then','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','moment','node-fetch','path','rimraf','define','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId'];(function(_0x5a2d15,_0x2e44cf){var _0xc19c4e=function(_0x4200d2){while(--_0x4200d2){_0x5a2d15['push'](_0x5a2d15['shift']());}};_0xc19c4e(++_0x2e44cf);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x4b84[_0x2aefb6];return _0x202772;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x44b8('0x3'));var fs=require('fs');var path=require(_0x44b8('0x4'));var rimraf=require(_0x44b8('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x996a8b,_0x54274b){return _0x996a8b[_0x44b8('0x6')]('WhatsappMessage',attributes,{'tableName':_0x44b8('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x44b8('0x8'),'fields':[_0x44b8('0x9')],'type':_0x44b8('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48a371,_0xc650ec,_0x2cc74b){var _0x4315f6=_0x996a8b[_0x44b8('0xb')];var _0x24dd10=_0x48a371[_0x44b8('0xc')]({'plain':!![]});if(_0x24dd10[_0x44b8('0xd')]['toLowerCase']()==='in'||_0x24dd10[_0x44b8('0xd')][_0x44b8('0xe')]()==='out'&&!_0x24dd10[_0x44b8('0xf')]&&!_['isNil'](_0x24dd10[_0x44b8('0x10')])){_0x4315f6[_0x44b8('0x11')]['findOne']({'where':{'id':_0x24dd10[_0x44b8('0x12')]}})['then'](function(_0x54fa95){if(_0x54fa95){_0x54fa95[_0x44b8('0x13')]({'lastMsgAt':_0x24dd10[_0x44b8('0x14')],'lastMsgDirection':_0x24dd10[_0x44b8('0xd')][_0x44b8('0xe')]()});}})['catch'](function(_0x495c74){console['error'](_0x495c74);});}if(_0x24dd10[_0x44b8('0xd')]==='out'&&!_0x24dd10[_0x44b8('0xf')]){var _0x31651b;_0x4315f6['WhatsappAccount'][_0x44b8('0x15')]({'where':{'id':_0x24dd10[_0x44b8('0x16')]},'raw':!![]})['then'](function(_0x89bc30){_0x31651b=_0x89bc30;if(_0x31651b&&_0x31651b[_0x44b8('0x17')]){switch(_0x31651b['type']){case _0x44b8('0x18'):var _0x8b4301=require(_0x44b8('0x18'));if(_0x31651b[_0x44b8('0x19')]&&_0x31651b[_0x44b8('0x1a')]&&_0x31651b[_0x44b8('0x1b')]){var _0x452f2f=new _0x8b4301(_0x31651b[_0x44b8('0x19')],_0x31651b[_0x44b8('0x1a')]);_0x452f2f[_0x44b8('0x1c')][_0x44b8('0x1d')]({'body':_0x24dd10[_0x44b8('0x9')],'to':'whatsapp:'+_0x24dd10[_0x44b8('0x1b')],'from':_0x44b8('0x1e')+_0x31651b[_0x44b8('0x1b')],'statusCallback':_0x31651b[_0x44b8('0x1f')]+_0x44b8('0x20')+_0x24dd10['id']+'/status?token='+_0x31651b[_0x44b8('0x21')]})['then'](function(_0x41a922){if(_0x41a922[_0x44b8('0x22')]){return _0x48a371[_0x44b8('0x13')]({'messageId':_0x41a922[_0x44b8('0x22')]});}})[_0x44b8('0x23')](function(_0x59acbc){logger[_0x44b8('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x44b8('0x25'),_0x44b8('0x18'),util['inspect'](_0x59acbc,{'showHidden':![],'depth':null}));});}else{logger[_0x44b8('0x24')](_0x44b8('0x26'),_0x44b8('0x25'),'twilio',_0x44b8('0x27'));}break;case _0x44b8('0x28'):var _0x53d9c7=_0x31651b[_0x44b8('0x19')];var _0x4a182d=_0x31651b[_0x44b8('0x1a')];var _0x5a544c=_0x31651b['baseUrl']+'/whatsapp/v1/'+_0x53d9c7+_0x44b8('0x29');var _0x29b18d={'to':[_0x24dd10[_0x44b8('0x1b')]],'message':{'type':_0x44b8('0x2a'),'text':_0x24dd10[_0x44b8('0x9')]}};var _0xc3f667={'method':_0x44b8('0x2b'),'uri':_0x5a544c,'headers':{'Authorization':_0x44b8('0x2c')+_0x4a182d,'Content-Type':_0x44b8('0x2d')},'body':_0x29b18d,'json':!![]};rp(_0xc3f667)[_0x44b8('0x2e')](function(_0x5e1129){if(_0x5e1129[_0x44b8('0x2f')][0x0][_0x44b8('0x30')]){return _0x48a371['update']({'messageId':_0x5e1129[_0x44b8('0x2f')][0x0]['message_id']});}})[_0x44b8('0x23')](function(_0x1652cb){logger[_0x44b8('0x31')](_0x44b8('0x32'),_0x1652cb);});break;}}})[_0x44b8('0x33')](function(){_0x2cc74b();});}else{_0x2cc74b();}}},'charset':'utf8mb4','collate':_0x44b8('0x34')});}; \ No newline at end of file +var _0xa8fc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','WhatsappInteraction','WhatsappInteractionId','then','createdAt','catch','error','find','type','twilio','phone','accountSid','create','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','authToken','baseUrl','/messages/','body','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally'];(function(_0x12cd5c,_0x193532){var _0x115f09=function(_0x2d34e2){while(--_0x2d34e2){_0x12cd5c['push'](_0x12cd5c['shift']());}};_0x115f09(++_0x193532);}(_0xa8fc,0x144));var _0xca8f=function(_0x7c0141,_0x3e7232){_0x7c0141=_0x7c0141-0x0;var _0x26e19a=_0xa8fc[_0x7c0141];return _0x26e19a;};'use strict';var _=require(_0xca8f('0x0'));var util=require(_0xca8f('0x1'));var logger=require(_0xca8f('0x2'))(_0xca8f('0x3'));var moment=require(_0xca8f('0x4'));var BPromise=require(_0xca8f('0x5'));var rp=require(_0xca8f('0x6'));var fetch=require(_0xca8f('0x7'));var fs=require('fs');var path=require(_0xca8f('0x8'));var rimraf=require(_0xca8f('0x9'));var config=require(_0xca8f('0xa'));var attributes=require('./whatsappMessage.attributes');module[_0xca8f('0xb')]=function(_0x2bef4e,_0x1ac725){return _0x2bef4e[_0xca8f('0xc')](_0xca8f('0xd'),attributes,{'tableName':_0xca8f('0xe'),'paranoid':![],'indexes':[{'name':_0xca8f('0xf'),'fields':['messageId']},{'name':_0xca8f('0x10'),'fields':['body'],'type':_0xca8f('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc5645d,_0xe5c54,_0x5ac313){var _0x281030=_0x2bef4e[_0xca8f('0x12')];var _0x41c9bf=_0xc5645d[_0xca8f('0x13')]({'plain':!![]});if(_0x41c9bf[_0xca8f('0x14')][_0xca8f('0x15')]()==='in'||_0x41c9bf[_0xca8f('0x14')][_0xca8f('0x15')]()==='out'&&!_0x41c9bf[_0xca8f('0x16')]&&!_[_0xca8f('0x17')](_0x41c9bf['UserId'])){_0x281030[_0xca8f('0x18')]['findOne']({'where':{'id':_0x41c9bf[_0xca8f('0x19')]}})[_0xca8f('0x1a')](function(_0x112699){if(_0x112699){_0x112699['update']({'lastMsgAt':_0x41c9bf[_0xca8f('0x1b')],'lastMsgDirection':_0x41c9bf['direction'][_0xca8f('0x15')]()});}})[_0xca8f('0x1c')](function(_0x314135){console[_0xca8f('0x1d')](_0x314135);});}if(_0x41c9bf['direction']==='out'&&!_0x41c9bf[_0xca8f('0x16')]){var _0x50a4f8;_0x281030['WhatsappAccount'][_0xca8f('0x1e')]({'where':{'id':_0x41c9bf['WhatsappAccountId']},'raw':!![]})[_0xca8f('0x1a')](function(_0x28d6e8){_0x50a4f8=_0x28d6e8;if(_0x50a4f8&&_0x50a4f8['type']){switch(_0x50a4f8[_0xca8f('0x1f')]){case'twilio':var _0x2d0498=require(_0xca8f('0x20'));if(_0x50a4f8['accountSid']&&_0x50a4f8['authToken']&&_0x50a4f8[_0xca8f('0x21')]){var _0x2b7257=new _0x2d0498(_0x50a4f8[_0xca8f('0x22')],_0x50a4f8['authToken']);_0x2b7257['messages'][_0xca8f('0x23')]({'body':_0x41c9bf['body'],'to':'whatsapp:'+_0x41c9bf[_0xca8f('0x21')],'from':'whatsapp:'+_0x50a4f8[_0xca8f('0x21')],'statusCallback':_0x50a4f8['remote']+'/api/whatsapp/messages/'+_0x41c9bf['id']+_0xca8f('0x24')+_0x50a4f8[_0xca8f('0x25')]})[_0xca8f('0x1a')](function(_0x5ad490){if(_0x5ad490[_0xca8f('0x26')]){return _0xc5645d[_0xca8f('0x27')]({'messageId':_0x5ad490['sid']});}})[_0xca8f('0x1c')](function(_0x14c1b0){logger[_0xca8f('0x1d')](_0xca8f('0x28'),_0xca8f('0x29'),'twilio',util['inspect'](_0x14c1b0,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xca8f('0x29'),_0xca8f('0x20'),_0xca8f('0x2a'));}break;case'sinch':var _0x5962c7=_0x50a4f8[_0xca8f('0x22')];var _0x2e2662=_0x50a4f8[_0xca8f('0x2b')];var _0xb6f68e=_0x50a4f8[_0xca8f('0x2c')]+'/whatsapp/v1/'+_0x5962c7+_0xca8f('0x2d');var _0x490ce8={'to':[_0x41c9bf[_0xca8f('0x21')]],'message':{'type':'text','text':_0x41c9bf[_0xca8f('0x2e')]}};var _0x2d9479={'method':_0xca8f('0x2f'),'uri':_0xb6f68e,'headers':{'Authorization':_0xca8f('0x30')+_0x2e2662,'Content-Type':_0xca8f('0x31')},'body':_0x490ce8,'json':!![]};rp(_0x2d9479)['then'](function(_0x258a92){if(_0x258a92[_0xca8f('0x32')][0x0][_0xca8f('0x33')]){return _0xc5645d[_0xca8f('0x27')]({'messageId':_0x258a92[_0xca8f('0x32')][0x0][_0xca8f('0x33')]});}})['catch'](function(_0x11873b){logger['err'](_0xca8f('0x34'),_0x11873b);});break;}}})[_0xca8f('0x35')](function(){_0x5ac313();});}else{_0x5ac313();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 9c98cd9..690b6dd 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 _0xd081=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','create','body','options','then','CreateWhatsappMessage','lodash','util'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xd081,0x10c));var _0x1d08=function(_0x3e4e13,_0x2d8dd2){_0x3e4e13=_0x3e4e13-0x0;var _0x47f46a=_0xd081[_0x3e4e13];return _0x47f46a;};'use strict';var _=require(_0x1d08('0x0'));var util=require(_0x1d08('0x1'));var moment=require(_0x1d08('0x2'));var BPromise=require(_0x1d08('0x3'));var rs=require(_0x1d08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d08('0x5'))['db'];var utils=require(_0x1d08('0x6'));var logger=require(_0x1d08('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1d08('0x8')][_0x1d08('0x9')]({'port':0x232a});config[_0x1d08('0xa')]=_[_0x1d08('0xb')](config[_0x1d08('0xa')],{'host':_0x1d08('0xc'),'port':0x18eb});var socket=require(_0x1d08('0xd'))(new Redis(config[_0x1d08('0xa')]));require(_0x1d08('0xe'))['register'](socket);function respondWithRpcPromise(_0x25eae0,_0x20ca3d,_0x6e3db0){return new BPromise(function(_0x24aeaa,_0x4a3df6){return client['request'](_0x25eae0,_0x6e3db0)['then'](function(_0x503191){logger[_0x1d08('0xf')](_0x1d08('0x10'),_0x20ca3d,'request\x20sent');logger[_0x1d08('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x20ca3d,_0x1d08('0x12'),JSON[_0x1d08('0x13')](_0x503191));if(_0x503191[_0x1d08('0x14')]){if(_0x503191[_0x1d08('0x14')][_0x1d08('0x15')]===0x1f4){logger[_0x1d08('0x14')](_0x1d08('0x10'),_0x20ca3d,_0x503191[_0x1d08('0x14')]['message']);return _0x4a3df6(_0x503191[_0x1d08('0x14')]['message']);}logger[_0x1d08('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x20ca3d,_0x503191[_0x1d08('0x14')][_0x1d08('0x16')]);return _0x24aeaa(_0x503191[_0x1d08('0x14')][_0x1d08('0x16')]);}else{logger['info'](_0x1d08('0x10'),_0x20ca3d,_0x1d08('0x12'));_0x24aeaa(_0x503191[_0x1d08('0x17')][_0x1d08('0x16')]);}})[_0x1d08('0x18')](function(_0x8805ab){logger[_0x1d08('0x14')](_0x1d08('0x10'),_0x20ca3d,_0x8805ab);_0x4a3df6(_0x8805ab);});});}exports['CreateWhatsappMessage']=function(_0x4e1dcb){var _0x36c2c2=this;return new Promise(function(_0x3259b1,_0x164479){return db['WhatsappMessage'][_0x1d08('0x19')](_0x4e1dcb[_0x1d08('0x1a')],{'raw':_0x4e1dcb[_0x1d08('0x1b')]?_0x4e1dcb['options']['raw']===undefined?!![]:![]:!![]})[_0x1d08('0x1c')](function(_0x3098aa){logger['info'](_0x1d08('0x1d'),_0x4e1dcb);logger[_0x1d08('0x11')]('CreateWhatsappMessage',_0x4e1dcb,JSON[_0x1d08('0x13')](_0x3098aa));_0x3259b1(_0x3098aa);})[_0x1d08('0x18')](function(_0x58f8d9){logger[_0x1d08('0x14')]('CreateWhatsappMessage',_0x58f8d9['message'],_0x4e1dcb);_0x164479(_0x36c2c2[_0x1d08('0x14')](0x1f4,_0x58f8d9['message']));});});}; \ No newline at end of file +var _0x4b50=['request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x23f454,_0x124d06){var _0x3c681b=function(_0x423c09){while(--_0x423c09){_0x23f454['push'](_0x23f454['shift']());}};_0x3c681b(++_0x124d06);}(_0x4b50,0xea));var _0x04b5=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0x4b50[_0x47e93d];return _0xe86c46;};'use strict';var _=require(_0x04b5('0x0'));var util=require(_0x04b5('0x1'));var moment=require(_0x04b5('0x2'));var BPromise=require(_0x04b5('0x3'));var rs=require(_0x04b5('0x4'));var fs=require('fs');var Redis=require(_0x04b5('0x5'));var db=require(_0x04b5('0x6'))['db'];var utils=require(_0x04b5('0x7'));var logger=require('../../config/logger')(_0x04b5('0x8'));var config=require(_0x04b5('0x9'));var jayson=require(_0x04b5('0xa'));var client=jayson[_0x04b5('0xb')]['http']({'port':0x232a});config[_0x04b5('0xc')]=_[_0x04b5('0xd')](config[_0x04b5('0xc')],{'host':_0x04b5('0xe'),'port':0x18eb});var socket=require(_0x04b5('0xf'))(new Redis(config[_0x04b5('0xc')]));require(_0x04b5('0x10'))[_0x04b5('0x11')](socket);function respondWithRpcPromise(_0x5da141,_0x542bf6,_0x122968){return new BPromise(function(_0x417514,_0x568589){return client[_0x04b5('0x12')](_0x5da141,_0x122968)[_0x04b5('0x13')](function(_0x5a282e){logger[_0x04b5('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x542bf6,_0x04b5('0x15'));logger['debug'](_0x04b5('0x16'),_0x542bf6,_0x04b5('0x15'),JSON[_0x04b5('0x17')](_0x5a282e));if(_0x5a282e[_0x04b5('0x18')]){if(_0x5a282e[_0x04b5('0x18')][_0x04b5('0x19')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x542bf6,_0x5a282e[_0x04b5('0x18')][_0x04b5('0x1a')]);return _0x568589(_0x5a282e[_0x04b5('0x18')][_0x04b5('0x1a')]);}logger[_0x04b5('0x18')](_0x04b5('0x1b'),_0x542bf6,_0x5a282e[_0x04b5('0x18')][_0x04b5('0x1a')]);return _0x417514(_0x5a282e[_0x04b5('0x18')][_0x04b5('0x1a')]);}else{logger[_0x04b5('0x14')](_0x04b5('0x1b'),_0x542bf6,_0x04b5('0x15'));_0x417514(_0x5a282e[_0x04b5('0x1c')][_0x04b5('0x1a')]);}})[_0x04b5('0x1d')](function(_0x1083fa){logger[_0x04b5('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x542bf6,_0x1083fa);_0x568589(_0x1083fa);});});}exports[_0x04b5('0x1e')]=function(_0x1f3064){var _0x4db92f=this;return new Promise(function(_0x2d961f,_0x2c1b8b){return db['WhatsappMessage'][_0x04b5('0x1f')](_0x1f3064[_0x04b5('0x20')],{'raw':_0x1f3064[_0x04b5('0x21')]?_0x1f3064['options'][_0x04b5('0x22')]===undefined?!![]:![]:!![]})[_0x04b5('0x13')](function(_0x2c16d8){logger[_0x04b5('0x14')]('CreateWhatsappMessage',_0x1f3064);logger[_0x04b5('0x23')](_0x04b5('0x1e'),_0x1f3064,JSON[_0x04b5('0x17')](_0x2c16d8));_0x2d961f(_0x2c16d8);})[_0x04b5('0x1d')](function(_0x2c7dc7){logger['error'](_0x04b5('0x1e'),_0x2c7dc7['message'],_0x1f3064);_0x2c1b8b(_0x4db92f[_0x04b5('0x18')](0x1f4,_0x2c7dc7[_0x04b5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6ea6b4a..3809f18 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 _0xdb95=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x2493a8,_0x5a240d){var _0x2b06c9=function(_0x198d3c){while(--_0x198d3c){_0x2493a8['push'](_0x2493a8['shift']());}};_0x2b06c9(++_0x5a240d);}(_0xdb95,0xe5));var _0x5db9=function(_0x3ca6e0,_0x360195){_0x3ca6e0=_0x3ca6e0-0x0;var _0x26f2ba=_0xdb95[_0x3ca6e0];return _0x26f2ba;};'use strict';var WhatsappMessageEvents=require(_0x5db9('0x0'));var events=[_0x5db9('0x1'),_0x5db9('0x2'),_0x5db9('0x3')];function createListener(_0x504bd6,_0x2cff97){return function(_0x47a1f0){_0x2cff97[_0x5db9('0x4')](_0x504bd6,_0x47a1f0);};}function removeListener(_0x36766d,_0x25ccf7){return function(){WhatsappMessageEvents['removeListener'](_0x36766d,_0x25ccf7);};}exports[_0x5db9('0x5')]=function(_0xef068e){for(var _0x3ce381=0x0,_0x12d8c4=events[_0x5db9('0x6')];_0x3ce381<_0x12d8c4;_0x3ce381++){var _0x26d54e=events[_0x3ce381];var _0x8d0ab5=createListener(_0x5db9('0x7')+_0x26d54e,_0xef068e);WhatsappMessageEvents['on'](_0x26d54e,_0x8d0ab5);}}; \ No newline at end of file +var _0xe4f2=['update','emit','removeListener','register','save','remove'];(function(_0x9ff33a,_0x337edb){var _0x5d6bda=function(_0x523361){while(--_0x523361){_0x9ff33a['push'](_0x9ff33a['shift']());}};_0x5d6bda(++_0x337edb);}(_0xe4f2,0x1cc));var _0x2e4f=function(_0x2edbea,_0xed922c){_0x2edbea=_0x2edbea-0x0;var _0x40a98b=_0xe4f2[_0x2edbea];return _0x40a98b;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x2e4f('0x0'),_0x2e4f('0x1'),_0x2e4f('0x2')];function createListener(_0x4d9e5b,_0x583dd0){return function(_0xe9d0df){_0x583dd0[_0x2e4f('0x3')](_0x4d9e5b,_0xe9d0df);};}function removeListener(_0xeb810d,_0x21f6a2){return function(){WhatsappMessageEvents[_0x2e4f('0x4')](_0xeb810d,_0x21f6a2);};}exports[_0x2e4f('0x5')]=function(_0x19fc95){for(var _0x4518f3=0x0,_0x560eea=events['length'];_0x4518f3<_0x560eea;_0x4518f3++){var _0x1f174a=events[_0x4518f3];var _0x362af5=createListener('whatsappMessage:'+_0x1f174a,_0x19fc95);WhatsappMessageEvents['on'](_0x1f174a,_0x362af5);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9668c08..9ab94d7 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 _0x6406=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x4ce52b,_0x4a768e){var _0x5744ab=function(_0x3687d6){while(--_0x3687d6){_0x4ce52b['push'](_0x4ce52b['shift']());}};_0x5744ab(++_0x4a768e);}(_0x6406,0x138));var _0x6640=function(_0x657e67,_0x518f58){_0x657e67=_0x657e67-0x0;var _0x29e86d=_0x6406[_0x657e67];return _0x29e86d;};'use strict';var multer=require(_0x6640('0x0'));var util=require(_0x6640('0x1'));var path=require(_0x6640('0x2'));var timeout=require(_0x6640('0x3'));var express=require(_0x6640('0x4'));var router=express[_0x6640('0x5')]();var fs_extra=require(_0x6640('0x6'));var auth=require(_0x6640('0x7'));var interaction=require(_0x6640('0x8'));var config=require(_0x6640('0x9'));var controller=require(_0x6640('0xa'));router[_0x6640('0xb')]('/',auth['isAuthenticated'](),controller[_0x6640('0xc')]);router['get'](_0x6640('0xd'),auth[_0x6640('0xe')](),controller[_0x6640('0xf')]);router[_0x6640('0xb')](_0x6640('0x10'),auth[_0x6640('0xe')](),controller[_0x6640('0x11')]);router['get'](_0x6640('0x12'),auth[_0x6640('0xe')](),controller[_0x6640('0x13')]);router[_0x6640('0xb')](_0x6640('0x14'),auth[_0x6640('0xe')](),controller[_0x6640('0x15')]);router['get'](_0x6640('0x16'),auth[_0x6640('0xe')](),controller[_0x6640('0x17')]);router['post']('/',auth[_0x6640('0xe')](),controller[_0x6640('0x18')]);router[_0x6640('0x19')](_0x6640('0x14'),auth[_0x6640('0xe')](),controller['addTeams']);router[_0x6640('0x19')](_0x6640('0x16'),auth['isAuthenticated'](),controller[_0x6640('0x1a')]);router[_0x6640('0x1b')](_0x6640('0x10'),auth[_0x6640('0xe')](),controller[_0x6640('0x1c')]);router[_0x6640('0x1d')](_0x6640('0x10'),auth[_0x6640('0xe')](),controller[_0x6640('0x1e')]);router[_0x6640('0x1d')](_0x6640('0x14'),auth['isAuthenticated'](),controller[_0x6640('0x1f')]);router[_0x6640('0x1d')]('/:id/users',auth[_0x6640('0xe')](),controller[_0x6640('0x20')]);module['exports']=router; \ No newline at end of file +var _0xe1f5=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','delete','destroy','removeTeams','removeAgents','multer','util'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xe1f5,0x1ec));var _0x5e1f=function(_0x2c5f1b,_0x4d781f){_0x2c5f1b=_0x2c5f1b-0x0;var _0xb02ee6=_0xe1f5[_0x2c5f1b];return _0xb02ee6;};'use strict';var multer=require(_0x5e1f('0x0'));var util=require(_0x5e1f('0x1'));var path=require('path');var timeout=require(_0x5e1f('0x2'));var express=require('express');var router=express[_0x5e1f('0x3')]();var fs_extra=require(_0x5e1f('0x4'));var auth=require(_0x5e1f('0x5'));var interaction=require(_0x5e1f('0x6'));var config=require('../../config/environment');var controller=require(_0x5e1f('0x7'));router[_0x5e1f('0x8')]('/',auth[_0x5e1f('0x9')](),controller[_0x5e1f('0xa')]);router[_0x5e1f('0x8')](_0x5e1f('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x5e1f('0x8')](_0x5e1f('0xc'),auth[_0x5e1f('0x9')](),controller['show']);router[_0x5e1f('0x8')](_0x5e1f('0xd'),auth[_0x5e1f('0x9')](),controller[_0x5e1f('0xe')]);router['get'](_0x5e1f('0xf'),auth[_0x5e1f('0x9')](),controller[_0x5e1f('0x10')]);router[_0x5e1f('0x8')](_0x5e1f('0x11'),auth['isAuthenticated'](),controller[_0x5e1f('0x12')]);router[_0x5e1f('0x13')]('/',auth[_0x5e1f('0x9')](),controller[_0x5e1f('0x14')]);router[_0x5e1f('0x13')](_0x5e1f('0xf'),auth[_0x5e1f('0x9')](),controller['addTeams']);router[_0x5e1f('0x13')](_0x5e1f('0x11'),auth[_0x5e1f('0x9')](),controller[_0x5e1f('0x15')]);router['put'](_0x5e1f('0xc'),auth[_0x5e1f('0x9')](),controller['update']);router[_0x5e1f('0x16')](_0x5e1f('0xc'),auth[_0x5e1f('0x9')](),controller[_0x5e1f('0x17')]);router['delete'](_0x5e1f('0xf'),auth[_0x5e1f('0x9')](),controller[_0x5e1f('0x18')]);router[_0x5e1f('0x16')]('/:id/users',auth[_0x5e1f('0x9')](),controller[_0x5e1f('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 489f574..69fb451 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 _0xd820=['beepall','roundrobin','STRING','sequelize','exports','name','INTEGER'];(function(_0x57cb43,_0x31f395){var _0x392cef=function(_0x58e5f1){while(--_0x58e5f1){_0x57cb43['push'](_0x57cb43['shift']());}};_0x392cef(++_0x31f395);}(_0xd820,0x16f));var _0x0d82=function(_0x196aef,_0x42a546){_0x196aef=_0x196aef-0x0;var _0x110e25=_0xd820[_0x196aef];return _0x110e25;};'use strict';var Sequelize=require(_0x0d82('0x0'));module[_0x0d82('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0d82('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0d82('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x0d82('0x4'),_0x0d82('0x5'))},'description':{'type':Sequelize[_0x0d82('0x6')]}}; \ No newline at end of file +var _0x36f1=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5945d3,_0x42c4a1){var _0xe3819a=function(_0x41c155){while(--_0x41c155){_0x5945d3['push'](_0x5945d3['shift']());}};_0xe3819a(++_0x42c4a1);}(_0x36f1,0xb0));var _0x136f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x36f1[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x136f('0x0'));module['exports']={'name':{'type':Sequelize[_0x136f('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x136f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x136f('0x3')](_0x136f('0x4'),_0x136f('0x5'),_0x136f('0x6'))},'description':{'type':Sequelize[_0x136f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index cd5a181..9bd99cd 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 _0x90ea=['limit','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','WhatsappQueue','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','params','UserWhatsappQueue','pick','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','SIP','updatedAt','getTeams','Team','ids','voicePause','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count'];(function(_0x4d21c1,_0x1732cb){var _0x152c7f=function(_0x4d521c){while(--_0x4d521c){_0x4d21c1['push'](_0x4d21c1['shift']());}};_0x152c7f(++_0x1732cb);}(_0x90ea,0xf2));var _0xa90e=function(_0x2987ef,_0x21661a){_0x2987ef=_0x2987ef-0x0;var _0x3e4293=_0x90ea[_0x2987ef];return _0x3e4293;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa90e('0x0'));var rp=require(_0xa90e('0x1'));var moment=require(_0xa90e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa90e('0x3'));var util=require(_0xa90e('0x4'));var path=require(_0xa90e('0x5'));var sox=require(_0xa90e('0x6'));var csv=require(_0xa90e('0x7'));var ejs=require(_0xa90e('0x8'));var fs=require('fs');var fs_extra=require(_0xa90e('0x9'));var _=require(_0xa90e('0xa'));var squel=require(_0xa90e('0xb'));var crypto=require(_0xa90e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa90e('0xd'));var toCsv=require(_0xa90e('0x7'));var querystring=require(_0xa90e('0xe'));var Papa=require(_0xa90e('0xf'));var Redis=require(_0xa90e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa90e('0x11'));var as=require(_0xa90e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa90e('0x13'));var utils=require(_0xa90e('0x14'));var config=require(_0xa90e('0x15'));var licenseUtil=require(_0xa90e('0x16'));var db=require(_0xa90e('0x17'))['db'];config['redis']=_['defaults'](config[_0xa90e('0x18')],{'host':_0xa90e('0x19'),'port':0x18eb});var socket=require(_0xa90e('0x1a'))(new Redis(config[_0xa90e('0x18')]));require(_0xa90e('0x1b'))[_0xa90e('0x1c')](socket);function respondWithStatusCode(_0x4e1377,_0x4f5724){_0x4f5724=_0x4f5724||0xcc;return function(_0xd38480){if(_0xd38480){return _0x4e1377[_0xa90e('0x1d')](_0x4f5724);}return _0x4e1377[_0xa90e('0x1e')](_0x4f5724)[_0xa90e('0x1f')]();};}function respondWithResult(_0x1a1bdf,_0x56f5f6){_0x56f5f6=_0x56f5f6||0xc8;return function(_0x29770f){if(_0x29770f){return _0x1a1bdf['status'](_0x56f5f6)[_0xa90e('0x20')](_0x29770f);}};}function respondWithFilteredResult(_0x32bb96,_0x49e34b){return function(_0x4a4837){if(_0x4a4837){var _0x8c9dfa=typeof _0x49e34b[_0xa90e('0x21')]===_0xa90e('0x22')&&typeof _0x49e34b['limit']==='undefined';var _0x44f5ad=_0x4a4837[_0xa90e('0x23')];var _0x5abb90=_0x8c9dfa?0x0:_0x49e34b['offset'];var _0x3b0c24=_0x8c9dfa?_0x4a4837[_0xa90e('0x23')]:_0x49e34b[_0xa90e('0x21')]+_0x49e34b[_0xa90e('0x24')];var _0x46511b;if(_0x3b0c24>=_0x44f5ad){_0x3b0c24=_0x44f5ad;_0x46511b=0xc8;}else{_0x46511b=0xce;}_0x32bb96[_0xa90e('0x1e')](_0x46511b);return _0x32bb96[_0xa90e('0x25')](_0xa90e('0x26'),_0x5abb90+'-'+_0x3b0c24+'/'+_0x44f5ad)['json'](_0x4a4837);}return null;};}function patchUpdates(_0x306bd7){return function(_0x3b74c6){try{jsonpatch[_0xa90e('0x27')](_0x3b74c6,_0x306bd7,!![]);}catch(_0x3e0f5c){return BPromise['reject'](_0x3e0f5c);}return _0x3b74c6[_0xa90e('0x28')]();};}function saveUpdates(_0xefee70,_0x402697){return function(_0x30233e){if(_0x30233e){return _0x30233e[_0xa90e('0x29')](_0xefee70)[_0xa90e('0x2a')](function(_0x1ae0cc){return _0x1ae0cc;});}return null;};}function removeEntity(_0x5d0214,_0x4ad573){return function(_0x77096){if(_0x77096){return _0x77096[_0xa90e('0x2b')]()['then'](function(){var _0x45fc6c=_0x77096[_0xa90e('0x2c')]({'plain':!![]});var _0x1abcb1=_0xa90e('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x1abcb1,'resourceId':_0x45fc6c['id']}})[_0xa90e('0x2a')](function(){return _0x77096;});})[_0xa90e('0x2a')](function(){_0x5d0214[_0xa90e('0x1e')](0xcc)[_0xa90e('0x1f')]();});}};}function handleEntityNotFound(_0x4b4cfb,_0x5398bb){return function(_0x18300b){if(!_0x18300b){_0x4b4cfb['sendStatus'](0x194);}return _0x18300b;};}function handleError(_0x495489,_0x10fd5a){_0x10fd5a=_0x10fd5a||0x1f4;return function(_0x3f705b){logger[_0xa90e('0x2e')](_0x3f705b['stack']);if(_0x3f705b[_0xa90e('0x2f')]){delete _0x3f705b[_0xa90e('0x2f')];}_0x495489[_0xa90e('0x1e')](_0x10fd5a)['send'](_0x3f705b);};}exports[_0xa90e('0x30')]=function(_0x490344,_0x5dfd80){var _0x3657fa={},_0x4ff6a5={},_0x43e6c9={'count':0x0,'rows':[]};var _0x2529db=_[_0xa90e('0x31')](db['WhatsappQueue'][_0xa90e('0x32')],function(_0x2f02f9){return{'name':_0x2f02f9[_0xa90e('0x33')],'type':_0x2f02f9['type'][_0xa90e('0x34')]};});_0x4ff6a5[_0xa90e('0x35')]=_[_0xa90e('0x31')](_0x2529db,'name');_0x4ff6a5[_0xa90e('0x36')]=_['keys'](_0x490344[_0xa90e('0x36')]);_0x4ff6a5[_0xa90e('0x37')]=_[_0xa90e('0x38')](_0x4ff6a5[_0xa90e('0x35')],_0x4ff6a5['query']);_0x3657fa[_0xa90e('0x39')]=_[_0xa90e('0x38')](_0x4ff6a5[_0xa90e('0x35')],qs[_0xa90e('0x3a')](_0x490344[_0xa90e('0x36')][_0xa90e('0x3a')]));_0x3657fa['attributes']=_0x3657fa[_0xa90e('0x39')][_0xa90e('0x3b')]?_0x3657fa['attributes']:_0x4ff6a5[_0xa90e('0x35')];if(!_0x490344[_0xa90e('0x36')][_0xa90e('0x3c')](_0xa90e('0x3d'))){_0x3657fa['limit']=qs[_0xa90e('0x24')](_0x490344['query'][_0xa90e('0x24')]);_0x3657fa[_0xa90e('0x21')]=qs[_0xa90e('0x21')](_0x490344['query'][_0xa90e('0x21')]);}_0x3657fa[_0xa90e('0x3e')]=qs[_0xa90e('0x3f')](_0x490344['query']['sort']);_0x3657fa[_0xa90e('0x40')]=qs[_0xa90e('0x37')](_['pick'](_0x490344[_0xa90e('0x36')],_0x4ff6a5[_0xa90e('0x37')]),_0x2529db);if(_0x490344['query']['filter']){_0x3657fa[_0xa90e('0x40')]=_[_0xa90e('0x41')](_0x3657fa['where'],{'$or':_[_0xa90e('0x31')](_0x2529db,function(_0x273400){if(_0x273400['type']!==_0xa90e('0x42')){var _0x47e4fd={};_0x47e4fd[_0x273400['name']]={'$like':'%'+_0x490344['query'][_0xa90e('0x43')]+'%'};return _0x47e4fd;}})});}_0x3657fa=_[_0xa90e('0x41')]({},_0x3657fa,_0x490344[_0xa90e('0x44')]);var _0x1a1fe9={'where':_0x3657fa[_0xa90e('0x40')]};return db['WhatsappQueue'][_0xa90e('0x23')](_0x1a1fe9)[_0xa90e('0x2a')](function(_0x2ee9e1){_0x43e6c9[_0xa90e('0x23')]=_0x2ee9e1;if(_0x490344[_0xa90e('0x36')][_0xa90e('0x45')]){_0x3657fa[_0xa90e('0x46')]=[{'all':!![]}];}return db[_0xa90e('0x47')][_0xa90e('0x48')](_0x3657fa);})[_0xa90e('0x2a')](function(_0x4af7f0){_0x43e6c9[_0xa90e('0x49')]=_0x4af7f0;return _0x43e6c9;})[_0xa90e('0x2a')](respondWithFilteredResult(_0x5dfd80,_0x3657fa))[_0xa90e('0x4a')](handleError(_0x5dfd80,null));};exports[_0xa90e('0x4b')]=function(_0x2ccc0b,_0x5f3992){var _0x15e845={'raw':!![],'where':{'id':_0x2ccc0b['params']['id']}},_0x144f95={};_0x144f95['model']=_['keys'](db['WhatsappQueue'][_0xa90e('0x32')]);_0x144f95[_0xa90e('0x36')]=_[_0xa90e('0x4c')](_0x2ccc0b['query']);_0x144f95[_0xa90e('0x37')]=_['intersection'](_0x144f95[_0xa90e('0x35')],_0x144f95['query']);_0x15e845[_0xa90e('0x39')]=_[_0xa90e('0x38')](_0x144f95[_0xa90e('0x35')],qs[_0xa90e('0x3a')](_0x2ccc0b[_0xa90e('0x36')][_0xa90e('0x3a')]));_0x15e845[_0xa90e('0x39')]=_0x15e845[_0xa90e('0x39')][_0xa90e('0x3b')]?_0x15e845[_0xa90e('0x39')]:_0x144f95['model'];if(_0x2ccc0b[_0xa90e('0x36')][_0xa90e('0x45')]){_0x15e845[_0xa90e('0x46')]=[{'all':!![]}];}_0x15e845=_['merge']({},_0x15e845,_0x2ccc0b['options']);return db['WhatsappQueue'][_0xa90e('0x4d')](_0x15e845)['then'](handleEntityNotFound(_0x5f3992,null))['then'](respondWithResult(_0x5f3992,null))[_0xa90e('0x4a')](handleError(_0x5f3992,null));};exports[_0xa90e('0x4e')]=function(_0x58b018,_0x1fdb16){return db[_0xa90e('0x47')][_0xa90e('0x4e')](_0x58b018[_0xa90e('0x4f')],{})[_0xa90e('0x2a')](function(_0xfe142a){var _0x451ab5=_0x58b018[_0xa90e('0x50')][_0xa90e('0x2c')]({'plain':!![]});if(!_0x451ab5)throw new Error(_0xa90e('0x51'));if(_0x451ab5[_0xa90e('0x52')]===_0xa90e('0x50')){var _0x19abc0=_0xfe142a[_0xa90e('0x2c')]({'plain':!![]});var _0x4b52f1=_0xa90e('0x2d');return db[_0xa90e('0x53')][_0xa90e('0x4d')]({'where':{'name':_0x4b52f1,'userProfileId':_0x451ab5[_0xa90e('0x54')]},'raw':!![]})[_0xa90e('0x2a')](function(_0x4b37e0){if(_0x4b37e0&&_0x4b37e0[_0xa90e('0x55')]===0x0){return db['UserProfileResource'][_0xa90e('0x4e')]({'name':_0x19abc0[_0xa90e('0x2f')],'resourceId':_0x19abc0['id'],'type':_0x4b37e0['name'],'sectionId':_0x4b37e0['id']},{})[_0xa90e('0x2a')](function(){return _0xfe142a;});}else{return _0xfe142a;}})['catch'](function(_0x2047d9){logger['error'](_0xa90e('0x56'),_0x2047d9);throw _0x2047d9;});}return _0xfe142a;})[_0xa90e('0x2a')](respondWithResult(_0x1fdb16,0xc9))[_0xa90e('0x4a')](handleError(_0x1fdb16,null));};exports[_0xa90e('0x29')]=function(_0x79a477,_0x4a0580){if(_0x79a477[_0xa90e('0x4f')]['id']){delete _0x79a477[_0xa90e('0x4f')]['id'];}return db[_0xa90e('0x47')][_0xa90e('0x4d')]({'where':{'id':_0x79a477['params']['id']}})[_0xa90e('0x2a')](handleEntityNotFound(_0x4a0580,null))[_0xa90e('0x2a')](saveUpdates(_0x79a477['body'],null))[_0xa90e('0x2a')](respondWithResult(_0x4a0580,null))[_0xa90e('0x4a')](handleError(_0x4a0580,null));};exports['destroy']=function(_0x4ea41c,_0x16c71){return db[_0xa90e('0x47')][_0xa90e('0x4d')]({'where':{'id':_0x4ea41c['params']['id']}})[_0xa90e('0x2a')](handleEntityNotFound(_0x16c71,null))['then'](removeEntity(_0x16c71,null))[_0xa90e('0x4a')](handleError(_0x16c71,null));};exports['describe']=function(_0x498510,_0x51bc69){return db[_0xa90e('0x47')]['describe']()['then'](respondWithResult(_0x51bc69,null))[_0xa90e('0x4a')](handleError(_0x51bc69,null));};exports[_0xa90e('0x57')]=function(_0x4ff56f,_0x1d4b6c,_0x2e256a){var _0x210595={'raw':!![],'where':{}},_0x3f27f3={},_0x449ef5;return db[_0xa90e('0x47')][_0xa90e('0x58')]({'where':{'id':_0x4ff56f[_0xa90e('0x59')]['id']}})[_0xa90e('0x2a')](handleEntityNotFound(_0x1d4b6c,null))[_0xa90e('0x2a')](function(_0x2f89be){if(_0x2f89be){_0x449ef5=_0x2f89be[_0xa90e('0x2c')]({'plain':!![]});_0x3f27f3[_0xa90e('0x35')]=_[_0xa90e('0x4c')](db[_0xa90e('0x5a')][_0xa90e('0x32')]);_0x3f27f3[_0xa90e('0x36')]=_[_0xa90e('0x4c')](_0x4ff56f[_0xa90e('0x36')]);_0x3f27f3[_0xa90e('0x37')]=_[_0xa90e('0x38')](_0x3f27f3[_0xa90e('0x35')],_0x3f27f3[_0xa90e('0x36')]);_0x210595[_0xa90e('0x39')]=_[_0xa90e('0x38')](_0x3f27f3[_0xa90e('0x35')],qs[_0xa90e('0x3a')](_0x4ff56f[_0xa90e('0x36')]['fields']));_0x210595[_0xa90e('0x39')]=_0x210595[_0xa90e('0x39')]['length']?_0x210595[_0xa90e('0x39')]:_0x3f27f3[_0xa90e('0x35')];if(!_0x4ff56f[_0xa90e('0x36')][_0xa90e('0x3c')]('nolimit')){_0x210595[_0xa90e('0x24')]=qs[_0xa90e('0x24')](_0x4ff56f['query'][_0xa90e('0x24')]);_0x210595[_0xa90e('0x21')]=qs[_0xa90e('0x21')](_0x4ff56f[_0xa90e('0x36')][_0xa90e('0x21')]);}_0x210595[_0xa90e('0x3e')]=qs[_0xa90e('0x3f')](_0x4ff56f[_0xa90e('0x36')]['sort']);_0x210595[_0xa90e('0x40')]=qs[_0xa90e('0x37')](_[_0xa90e('0x5b')](_0x4ff56f['query'],_0x3f27f3[_0xa90e('0x37')]));_0x210595[_0xa90e('0x40')]['WhatsappQueueId']=_0x2f89be['id'];if(_0x4ff56f[_0xa90e('0x36')][_0xa90e('0x43')]){_0x210595[_0xa90e('0x40')]=_[_0xa90e('0x41')](_0x210595[_0xa90e('0x40')],{'$or':_['map'](_0x210595[_0xa90e('0x39')],function(_0x24b65c){var _0x69d240={};_0x69d240[_0x24b65c]={'$like':'%'+_0x4ff56f[_0xa90e('0x36')][_0xa90e('0x43')]+'%'};return _0x69d240;})});}_0x210595=_['merge']({},_0x210595,_0x4ff56f['options']);return db[_0xa90e('0x5a')][_0xa90e('0x48')](_0x210595);}})[_0xa90e('0x2a')](function(_0x5f4ba8){if(_0x5f4ba8){return db[_0xa90e('0x5c')][_0xa90e('0x5d')]({'where':{'id':_[_0xa90e('0x31')](_0x5f4ba8,_0xa90e('0x5e')),'role':_0xa90e('0x5f')},'attributes':['id',_0xa90e('0x2f'),_0xa90e('0x60'),'updatedAt',_0xa90e('0x61')]});}})[_0xa90e('0x2a')](function(_0x320a30){if(_0x320a30){return{'count':_0x320a30[_0xa90e('0x23')],'rows':_[_0xa90e('0x31')](_0x320a30['rows'],function(_0x5117e7){return{'membername':_0x5117e7[_0xa90e('0x2f')],'UserId':_0x5117e7['id'],'queue_name':_0x449ef5[_0xa90e('0x2f')],'WhatsappQueueId':_0x449ef5['id'],'interface':util[_0xa90e('0x62')]('%s/%s',_0xa90e('0x63'),_0x5117e7[_0xa90e('0x2f')]),'penalty':0x0,'paused':_0x5117e7[_0xa90e('0x60')],'createdAt':_0x5117e7[_0xa90e('0x61')],'updatedAt':_0x5117e7[_0xa90e('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d4b6c,_0x210595))[_0xa90e('0x4a')](handleError(_0x1d4b6c,null));};exports[_0xa90e('0x65')]=function(_0x153c68,_0x9dc7ba,_0x1a6b71){var _0x3bdd84={};var _0x50e67a={};var _0xf43d02;var _0x56d5f1;return db[_0xa90e('0x47')][_0xa90e('0x58')]({'where':{'id':_0x153c68[_0xa90e('0x59')]['id']}})['then'](handleEntityNotFound(_0x9dc7ba,null))[_0xa90e('0x2a')](function(_0x3f81eb){if(_0x3f81eb){_0xf43d02=_0x3f81eb;_0x50e67a[_0xa90e('0x35')]=_['keys'](db[_0xa90e('0x66')][_0xa90e('0x32')]);_0x50e67a[_0xa90e('0x36')]=_[_0xa90e('0x4c')](_0x153c68[_0xa90e('0x36')]);_0x50e67a['filters']=_[_0xa90e('0x38')](_0x50e67a[_0xa90e('0x35')],_0x50e67a[_0xa90e('0x36')]);_0x3bdd84[_0xa90e('0x39')]=_[_0xa90e('0x38')](_0x50e67a['model'],qs[_0xa90e('0x3a')](_0x153c68[_0xa90e('0x36')][_0xa90e('0x3a')]));_0x3bdd84['attributes']=_0x3bdd84[_0xa90e('0x39')]['length']?_0x3bdd84[_0xa90e('0x39')]:_0x50e67a['model'];_0x3bdd84[_0xa90e('0x3e')]=qs['sort'](_0x153c68[_0xa90e('0x36')][_0xa90e('0x3f')]);_0x3bdd84['where']=qs[_0xa90e('0x37')](_[_0xa90e('0x5b')](_0x153c68[_0xa90e('0x36')],_0x50e67a['filters']));if(_0x153c68[_0xa90e('0x36')][_0xa90e('0x43')]){_0x3bdd84['where']=_[_0xa90e('0x41')](_0x3bdd84[_0xa90e('0x40')],{'$or':_['map'](_0x3bdd84['attributes'],function(_0x57681d){var _0x301d58={};_0x301d58[_0x57681d]={'$like':'%'+_0x153c68['query']['filter']+'%'};return _0x301d58;})});}_0x3bdd84=_['merge']({},_0x3bdd84,_0x153c68['options']);return _0xf43d02['getTeams'](_0x3bdd84);}})['then'](function(_0x2c574d){if(_0x2c574d){_0x56d5f1=_0x2c574d['length'];if(!_0x153c68[_0xa90e('0x36')][_0xa90e('0x3c')]('nolimit')){_0x3bdd84[_0xa90e('0x24')]=qs[_0xa90e('0x24')](_0x153c68['query'][_0xa90e('0x24')]);_0x3bdd84['offset']=qs['offset'](_0x153c68[_0xa90e('0x36')][_0xa90e('0x21')]);}return _0xf43d02[_0xa90e('0x65')](_0x3bdd84);}})['then'](function(_0x576cd){if(_0x576cd){return _0x576cd?{'count':_0x56d5f1,'rows':_0x576cd}:null;}})['then'](respondWithResult(_0x9dc7ba,null))[_0xa90e('0x4a')](handleError(_0x9dc7ba,null));};exports['addTeams']=function(_0x4d0c20,_0x548888,_0x491b98){var _0x4c760e=_0x4d0c20[_0xa90e('0x4f')][_0xa90e('0x67')];return db[_0xa90e('0x66')][_0xa90e('0x48')]({'where':{'id':_0x4c760e},'attributes':['id'],'include':[{'model':db[_0xa90e('0x5c')],'as':'Agents','attributes':['id',_0xa90e('0x2f'),'online',_0xa90e('0x68'),'interface'],'raw':!![]}]})[_0xa90e('0x2a')](function(_0x11a091){if(_0x11a091){var _0x2c60f0=_[_0xa90e('0x69')](_0x11a091,function(_0x1c2394){var _0x216474=_0x1c2394[_0xa90e('0x2c')]({'plain':!![]});return _0x216474[_0xa90e('0x6a')];});return db[_0xa90e('0x47')][_0xa90e('0x4d')]({'where':{'id':_0x4d0c20['params']['id']}})[_0xa90e('0x2a')](function(_0x4f7728){return db[_0xa90e('0x6b')][_0xa90e('0x6c')](function(_0x34c998){return _0x4f7728[_0xa90e('0x6d')](_0x4c760e,{'transaction':_0x34c998})[_0xa90e('0x2a')](function(){return BPromise[_0xa90e('0x6e')](_0x2c60f0,function(_0x23bcca){return db[_0xa90e('0x5a')][_0xa90e('0x6f')]({'where':{'UserId':_0x23bcca['id'],'WhatsappQueueId':_0x4d0c20['params']['id']},'transaction':_0x34c998});});})[_0xa90e('0x2a')](function(){_0x2c60f0[_0xa90e('0x70')](function(_0x35eee3){socket[_0xa90e('0x71')](_0xa90e('0x72'),{'UserId':_0x35eee3['id'],'WhatsappQueueId':_0x4f7728['id']});});});});});}})[_0xa90e('0x2a')](respondWithStatusCode(_0x548888,null))[_0xa90e('0x4a')](handleError(_0x548888,null));};exports[_0xa90e('0x73')]=function(_0x4c5212,_0x2ae3fb,_0x17cf7e){return db[_0xa90e('0x66')][_0xa90e('0x48')]({'where':{'id':_0x4c5212[_0xa90e('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ae3fb,null))[_0xa90e('0x2a')](function(_0x87f836){var _0x9f72a=_[_0xa90e('0x31')](_0x87f836,'id');var _0x580a5c=[];var _0x337201=[];var _0x237450=squel[_0xa90e('0x74')]();_0x237450['field'](_0xa90e('0x75'))[_0xa90e('0x76')](_0xa90e('0x77'),'tq')[_0xa90e('0x78')](_0xa90e('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa90e('0x40')]('WhatsappQueueId\x20=\x20?',_0x4c5212[_0xa90e('0x59')]['id']);for(var _0x287af8=0x0;_0x287af8<_0x87f836['length'];_0x287af8+=0x1){let _0x94e4ac=_0x87f836[_0x287af8];for(var _0x4a80c3=0x0;_0x4a80c3<_0x94e4ac[_0xa90e('0x6a')]['length'];_0x4a80c3+=0x1){let _0x4ae33e=_0x94e4ac[_0xa90e('0x6a')][_0x4a80c3];var _0x20606d=_0x237450[_0xa90e('0x7a')]();_0x20606d['where'](_0xa90e('0x7b'),_0x4ae33e['id']);_0x337201[_0xa90e('0x7c')](db[_0xa90e('0x6b')]['query'](_0x20606d[_0xa90e('0x7d')](),{'type':db[_0xa90e('0x6b')][_0xa90e('0x7e')]['SELECT']})[_0xa90e('0x2a')](function(_0xe4e071){if(_0xe4e071[_0xa90e('0x3b')]===0x1){return _0x4ae33e['id'];}else{var _0x42b357=_['every'](_[_0xa90e('0x31')](_0xe4e071,_0xa90e('0x7f')),function(_0x44ea8f){return _['includes'](_0x9f72a,_0x44ea8f);});if(_0x42b357){return _0x4ae33e['id'];}}}));}}return BPromise[_0xa90e('0x80')](_0x337201)[_0xa90e('0x2a')](function(_0xa853a5){_0x580a5c=_(_0x580a5c)[_0xa90e('0x81')](_0xa853a5)[_0xa90e('0x82')]()[_0xa90e('0x83')]();return db[_0xa90e('0x47')][_0xa90e('0x4d')]({'where':{'id':_0x4c5212[_0xa90e('0x59')]['id']}})['then'](function(_0x50865c){return db['sequelize'][_0xa90e('0x6c')](function(_0x275994){return _0x50865c['removeTeams'](_0x4c5212[_0xa90e('0x36')]['ids'],{'transaction':_0x275994})[_0xa90e('0x2a')](function(){if(!_['isEmpty'](_0x580a5c)){return _0x50865c[_0xa90e('0x84')](_0x580a5c,{'transaction':_0x275994});}})[_0xa90e('0x2a')](function(){_0x580a5c['forEach'](function(_0x2a570b){socket[_0xa90e('0x71')](_0xa90e('0x85'),{'UserId':_0x2a570b,'WhatsappQueueId':_0x50865c['id']});});});});});});})[_0xa90e('0x2a')](respondWithStatusCode(_0x2ae3fb,null))['catch'](handleError(_0x2ae3fb,null));};exports[_0xa90e('0x86')]=function(_0xa2ad1f,_0x54e9e1,_0x40d486){return db['WhatsappQueue']['find']({'where':{'id':_0xa2ad1f[_0xa90e('0x59')]['id']}})[_0xa90e('0x2a')](handleEntityNotFound(_0x54e9e1,null))[_0xa90e('0x2a')](function(_0x2a978d){if(_0x2a978d){return _0x2a978d[_0xa90e('0x86')](_0xa2ad1f['body'][_0xa90e('0x67')],_[_0xa90e('0x87')](_0xa2ad1f[_0xa90e('0x4f')],[_0xa90e('0x67'),'id'])||{})[_0xa90e('0x88')](function(_0x4cc58b){for(var _0x110a1f=0x0;_0x110a1f<_0xa2ad1f[_0xa90e('0x4f')][_0xa90e('0x67')][_0xa90e('0x3b')];_0x110a1f+=0x1){socket[_0xa90e('0x71')]('userWhatsappQueue:save',{'UserId':Number(_0xa2ad1f['body'][_0xa90e('0x67')][_0x110a1f]),'WhatsappQueueId':Number(_0xa2ad1f[_0xa90e('0x59')]['id'])});}return _0x4cc58b;});}})[_0xa90e('0x2a')](respondWithResult(_0x54e9e1,null))[_0xa90e('0x4a')](handleError(_0x54e9e1,null));};exports[_0xa90e('0x84')]=function(_0x1b3237,_0x3eeb87,_0x212815){return db[_0xa90e('0x47')][_0xa90e('0x4d')]({'where':{'id':_0x1b3237[_0xa90e('0x59')]['id']}})[_0xa90e('0x2a')](handleEntityNotFound(_0x3eeb87,null))[_0xa90e('0x2a')](function(_0x47d10c){if(_0x47d10c){return _0x47d10c[_0xa90e('0x84')](_0x1b3237[_0xa90e('0x36')]['ids'])[_0xa90e('0x2a')](function(){if(_[_0xa90e('0x89')](_0x1b3237[_0xa90e('0x36')]['ids'])){for(var _0x41d8ed=0x0;_0x41d8ed<_0x1b3237[_0xa90e('0x36')]['ids'][_0xa90e('0x3b')];_0x41d8ed+=0x1){socket[_0xa90e('0x71')](_0xa90e('0x85'),{'UserId':Number(_0x1b3237[_0xa90e('0x36')][_0xa90e('0x67')][_0x41d8ed]),'WhatsappQueueId':Number(_0x1b3237['params']['id'])});}}else{socket[_0xa90e('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x1b3237['query'][_0xa90e('0x67')]),'WhatsappQueueId':Number(_0x1b3237['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3eeb87,null))[_0xa90e('0x4a')](handleError(_0x3eeb87,null));};exports[_0xa90e('0x8a')]=function(_0x3a812a,_0x2a3770,_0x298a50){var _0x547caa={};var _0x4124fd={};var _0x36e606;var _0x3a70fd;return db[_0xa90e('0x47')][_0xa90e('0x58')]({'where':{'id':_0x3a812a[_0xa90e('0x59')]['id']}})[_0xa90e('0x2a')](handleEntityNotFound(_0x2a3770,null))[_0xa90e('0x2a')](function(_0x4810d0){if(_0x4810d0){_0x36e606=_0x4810d0;_0x4124fd[_0xa90e('0x35')]=_[_0xa90e('0x4c')](db['User'][_0xa90e('0x32')]);_0x4124fd[_0xa90e('0x36')]=_['keys'](_0x3a812a[_0xa90e('0x36')]);_0x4124fd[_0xa90e('0x37')]=_[_0xa90e('0x38')](_0x4124fd['model'],_0x4124fd[_0xa90e('0x36')]);_0x547caa[_0xa90e('0x39')]=_['intersection'](_0x4124fd[_0xa90e('0x35')],qs['fields'](_0x3a812a['query'][_0xa90e('0x3a')]));_0x547caa['attributes']=_0x547caa[_0xa90e('0x39')][_0xa90e('0x3b')]?_0x547caa[_0xa90e('0x39')]:_0x4124fd[_0xa90e('0x35')];_0x547caa[_0xa90e('0x3e')]=qs[_0xa90e('0x3f')](_0x3a812a['query']['sort']);_0x547caa[_0xa90e('0x40')]=qs[_0xa90e('0x37')](_[_0xa90e('0x5b')](_0x3a812a[_0xa90e('0x36')],_0x4124fd[_0xa90e('0x37')]));if(_0x3a812a[_0xa90e('0x36')][_0xa90e('0x43')]){_0x547caa['where']=_['merge'](_0x547caa[_0xa90e('0x40')],{'$or':_['map'](_0x547caa[_0xa90e('0x39')],function(_0x2f9298){var _0x5b9b16={};_0x5b9b16[_0x2f9298]={'$like':'%'+_0x3a812a[_0xa90e('0x36')][_0xa90e('0x43')]+'%'};return _0x5b9b16;})});}_0x547caa=_['merge']({},_0x547caa,_0x3a812a[_0xa90e('0x44')]);return _0x36e606[_0xa90e('0x8a')](_0x547caa);}})['then'](function(_0x40180f){if(_0x40180f){_0x3a70fd=_0x40180f[_0xa90e('0x3b')];if(!_0x3a812a[_0xa90e('0x36')][_0xa90e('0x3c')](_0xa90e('0x3d'))){_0x547caa[_0xa90e('0x24')]=qs[_0xa90e('0x24')](_0x3a812a['query'][_0xa90e('0x24')]);_0x547caa[_0xa90e('0x21')]=qs['offset'](_0x3a812a['query']['offset']);}return _0x36e606['getAgents'](_0x547caa);}})[_0xa90e('0x2a')](function(_0x40f22e){if(_0x40f22e){return _0x40f22e?{'count':_0x3a70fd,'rows':_0x40f22e}:null;}})[_0xa90e('0x2a')](respondWithResult(_0x2a3770,null))['catch'](handleError(_0x2a3770,null));}; \ No newline at end of file +var _0x1a4e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','findAll','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','union','compact','value','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','WhatsappQueue','includeAll','include','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','find','autoAssociation'];(function(_0x381725,_0x2c5b41){var _0x234af9=function(_0x39e898){while(--_0x39e898){_0x381725['push'](_0x381725['shift']());}};_0x234af9(++_0x2c5b41);}(_0x1a4e,0x153));var _0xe1a4=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x1a4e[_0x1b5aea];return _0x15cfc6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe1a4('0x0'));var rp=require(_0xe1a4('0x1'));var moment=require(_0xe1a4('0x2'));var BPromise=require(_0xe1a4('0x3'));var Mustache=require(_0xe1a4('0x4'));var util=require(_0xe1a4('0x5'));var path=require('path');var sox=require(_0xe1a4('0x6'));var csv=require(_0xe1a4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1a4('0x8'));var _=require(_0xe1a4('0x9'));var squel=require(_0xe1a4('0xa'));var crypto=require(_0xe1a4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe1a4('0x7'));var querystring=require('querystring');var Papa=require(_0xe1a4('0xc'));var Redis=require(_0xe1a4('0xd'));var authService=require(_0xe1a4('0xe'));var qs=require(_0xe1a4('0xf'));var as=require(_0xe1a4('0x10'));var hardwareService=require(_0xe1a4('0x11'));var logger=require(_0xe1a4('0x12'))(_0xe1a4('0x13'));var utils=require(_0xe1a4('0x14'));var config=require(_0xe1a4('0x15'));var licenseUtil=require(_0xe1a4('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe1a4('0x17')](config['redis'],{'host':_0xe1a4('0x18'),'port':0x18eb});var socket=require(_0xe1a4('0x19'))(new Redis(config[_0xe1a4('0x1a')]));require('./whatsappQueue.socket')[_0xe1a4('0x1b')](socket);function respondWithStatusCode(_0x376f72,_0x3d7f91){_0x3d7f91=_0x3d7f91||0xcc;return function(_0x486336){if(_0x486336){return _0x376f72[_0xe1a4('0x1c')](_0x3d7f91);}return _0x376f72[_0xe1a4('0x1d')](_0x3d7f91)[_0xe1a4('0x1e')]();};}function respondWithResult(_0x4ff508,_0x324fcf){_0x324fcf=_0x324fcf||0xc8;return function(_0x4bda84){if(_0x4bda84){return _0x4ff508['status'](_0x324fcf)[_0xe1a4('0x1f')](_0x4bda84);}};}function respondWithFilteredResult(_0x4057c4,_0x391d99){return function(_0xd6c987){if(_0xd6c987){var _0xf36cd0=typeof _0x391d99[_0xe1a4('0x20')]===_0xe1a4('0x21')&&typeof _0x391d99[_0xe1a4('0x22')]===_0xe1a4('0x21');var _0x3944c5=_0xd6c987['count'];var _0x28c7c1=_0xf36cd0?0x0:_0x391d99['offset'];var _0x2241fb=_0xf36cd0?_0xd6c987[_0xe1a4('0x23')]:_0x391d99[_0xe1a4('0x20')]+_0x391d99[_0xe1a4('0x22')];var _0x1a38b5;if(_0x2241fb>=_0x3944c5){_0x2241fb=_0x3944c5;_0x1a38b5=0xc8;}else{_0x1a38b5=0xce;}_0x4057c4['status'](_0x1a38b5);return _0x4057c4['set'](_0xe1a4('0x24'),_0x28c7c1+'-'+_0x2241fb+'/'+_0x3944c5)[_0xe1a4('0x1f')](_0xd6c987);}return null;};}function patchUpdates(_0x5e5498){return function(_0x2dd48e){try{jsonpatch[_0xe1a4('0x25')](_0x2dd48e,_0x5e5498,!![]);}catch(_0x574aab){return BPromise[_0xe1a4('0x26')](_0x574aab);}return _0x2dd48e['save']();};}function saveUpdates(_0x1f019c,_0x3a2d04){return function(_0x36a8fb){if(_0x36a8fb){return _0x36a8fb['update'](_0x1f019c)[_0xe1a4('0x27')](function(_0x2abd10){return _0x2abd10;});}return null;};}function removeEntity(_0x30744e,_0x5f0cae){return function(_0x4c3b70){if(_0x4c3b70){return _0x4c3b70[_0xe1a4('0x28')]()['then'](function(){var _0x256539=_0x4c3b70[_0xe1a4('0x29')]({'plain':!![]});var _0x2e8171='WhatsappQueues';return db[_0xe1a4('0x2a')][_0xe1a4('0x28')]({'where':{'type':_0x2e8171,'resourceId':_0x256539['id']}})[_0xe1a4('0x27')](function(){return _0x4c3b70;});})[_0xe1a4('0x27')](function(){_0x30744e[_0xe1a4('0x1d')](0xcc)[_0xe1a4('0x1e')]();});}};}function handleEntityNotFound(_0x45b0b0,_0xe5151d){return function(_0x31586d){if(!_0x31586d){_0x45b0b0[_0xe1a4('0x1c')](0x194);}return _0x31586d;};}function handleError(_0x1a1d11,_0x450909){_0x450909=_0x450909||0x1f4;return function(_0x19180d){logger[_0xe1a4('0x2b')](_0x19180d[_0xe1a4('0x2c')]);if(_0x19180d[_0xe1a4('0x2d')]){delete _0x19180d[_0xe1a4('0x2d')];}_0x1a1d11[_0xe1a4('0x1d')](_0x450909)['send'](_0x19180d);};}exports['index']=function(_0x3bfc49,_0x56db09){var _0x124597={},_0x6a92da={},_0x28d3ff={'count':0x0,'rows':[]};var _0x5415bc=_[_0xe1a4('0x2e')](db['WhatsappQueue'][_0xe1a4('0x2f')],function(_0x25580a){return{'name':_0x25580a[_0xe1a4('0x30')],'type':_0x25580a[_0xe1a4('0x31')][_0xe1a4('0x32')]};});_0x6a92da['model']=_[_0xe1a4('0x2e')](_0x5415bc,_0xe1a4('0x2d'));_0x6a92da[_0xe1a4('0x33')]=_[_0xe1a4('0x34')](_0x3bfc49[_0xe1a4('0x33')]);_0x6a92da[_0xe1a4('0x35')]=_[_0xe1a4('0x36')](_0x6a92da[_0xe1a4('0x37')],_0x6a92da['query']);_0x124597[_0xe1a4('0x38')]=_[_0xe1a4('0x36')](_0x6a92da[_0xe1a4('0x37')],qs[_0xe1a4('0x39')](_0x3bfc49[_0xe1a4('0x33')][_0xe1a4('0x39')]));_0x124597[_0xe1a4('0x38')]=_0x124597[_0xe1a4('0x38')][_0xe1a4('0x3a')]?_0x124597[_0xe1a4('0x38')]:_0x6a92da[_0xe1a4('0x37')];if(!_0x3bfc49[_0xe1a4('0x33')][_0xe1a4('0x3b')](_0xe1a4('0x3c'))){_0x124597[_0xe1a4('0x22')]=qs[_0xe1a4('0x22')](_0x3bfc49[_0xe1a4('0x33')][_0xe1a4('0x22')]);_0x124597[_0xe1a4('0x20')]=qs[_0xe1a4('0x20')](_0x3bfc49[_0xe1a4('0x33')][_0xe1a4('0x20')]);}_0x124597['order']=qs[_0xe1a4('0x3d')](_0x3bfc49['query'][_0xe1a4('0x3d')]);_0x124597[_0xe1a4('0x3e')]=qs['filters'](_[_0xe1a4('0x3f')](_0x3bfc49['query'],_0x6a92da['filters']),_0x5415bc);if(_0x3bfc49['query'][_0xe1a4('0x40')]){_0x124597['where']=_[_0xe1a4('0x41')](_0x124597[_0xe1a4('0x3e')],{'$or':_['map'](_0x5415bc,function(_0x1a58af){if(_0x1a58af[_0xe1a4('0x31')]!=='VIRTUAL'){var _0x1f0af2={};_0x1f0af2[_0x1a58af[_0xe1a4('0x2d')]]={'$like':'%'+_0x3bfc49[_0xe1a4('0x33')][_0xe1a4('0x40')]+'%'};return _0x1f0af2;}})});}_0x124597=_[_0xe1a4('0x41')]({},_0x124597,_0x3bfc49[_0xe1a4('0x42')]);var _0x2a1a58={'where':_0x124597[_0xe1a4('0x3e')]};return db[_0xe1a4('0x43')][_0xe1a4('0x23')](_0x2a1a58)[_0xe1a4('0x27')](function(_0xb89cbd){_0x28d3ff['count']=_0xb89cbd;if(_0x3bfc49[_0xe1a4('0x33')][_0xe1a4('0x44')]){_0x124597[_0xe1a4('0x45')]=[{'all':!![]}];}return db[_0xe1a4('0x43')]['findAll'](_0x124597);})[_0xe1a4('0x27')](function(_0xda5c64){_0x28d3ff['rows']=_0xda5c64;return _0x28d3ff;})[_0xe1a4('0x27')](respondWithFilteredResult(_0x56db09,_0x124597))[_0xe1a4('0x46')](handleError(_0x56db09,null));};exports[_0xe1a4('0x47')]=function(_0x5c7f0f,_0x3e2771){var _0x1a0d34={'raw':!![],'where':{'id':_0x5c7f0f[_0xe1a4('0x48')]['id']}},_0x2536ba={};_0x2536ba['model']=_['keys'](db['WhatsappQueue'][_0xe1a4('0x2f')]);_0x2536ba[_0xe1a4('0x33')]=_[_0xe1a4('0x34')](_0x5c7f0f[_0xe1a4('0x33')]);_0x2536ba[_0xe1a4('0x35')]=_[_0xe1a4('0x36')](_0x2536ba[_0xe1a4('0x37')],_0x2536ba[_0xe1a4('0x33')]);_0x1a0d34[_0xe1a4('0x38')]=_[_0xe1a4('0x36')](_0x2536ba[_0xe1a4('0x37')],qs[_0xe1a4('0x39')](_0x5c7f0f[_0xe1a4('0x33')][_0xe1a4('0x39')]));_0x1a0d34[_0xe1a4('0x38')]=_0x1a0d34['attributes'][_0xe1a4('0x3a')]?_0x1a0d34[_0xe1a4('0x38')]:_0x2536ba[_0xe1a4('0x37')];if(_0x5c7f0f[_0xe1a4('0x33')]['includeAll']){_0x1a0d34[_0xe1a4('0x45')]=[{'all':!![]}];}_0x1a0d34=_[_0xe1a4('0x41')]({},_0x1a0d34,_0x5c7f0f[_0xe1a4('0x42')]);return db[_0xe1a4('0x43')]['find'](_0x1a0d34)[_0xe1a4('0x27')](handleEntityNotFound(_0x3e2771,null))[_0xe1a4('0x27')](respondWithResult(_0x3e2771,null))[_0xe1a4('0x46')](handleError(_0x3e2771,null));};exports[_0xe1a4('0x49')]=function(_0xcef7e5,_0x31ef92){return db['WhatsappQueue'][_0xe1a4('0x49')](_0xcef7e5['body'],{})['then'](function(_0x44bdf2){var _0x1308d1=_0xcef7e5[_0xe1a4('0x4a')][_0xe1a4('0x29')]({'plain':!![]});if(!_0x1308d1)throw new Error(_0xe1a4('0x4b'));if(_0x1308d1[_0xe1a4('0x4c')]===_0xe1a4('0x4a')){var _0x3050c9=_0x44bdf2[_0xe1a4('0x29')]({'plain':!![]});var _0x3d0dd4=_0xe1a4('0x4d');return db[_0xe1a4('0x4e')][_0xe1a4('0x4f')]({'where':{'name':_0x3d0dd4,'userProfileId':_0x1308d1['userProfileId']},'raw':!![]})[_0xe1a4('0x27')](function(_0x4dcc1a){if(_0x4dcc1a&&_0x4dcc1a[_0xe1a4('0x50')]===0x0){return db[_0xe1a4('0x2a')][_0xe1a4('0x49')]({'name':_0x3050c9[_0xe1a4('0x2d')],'resourceId':_0x3050c9['id'],'type':_0x4dcc1a[_0xe1a4('0x2d')],'sectionId':_0x4dcc1a['id']},{})[_0xe1a4('0x27')](function(){return _0x44bdf2;});}else{return _0x44bdf2;}})[_0xe1a4('0x46')](function(_0x5c754a){logger[_0xe1a4('0x2b')](_0xe1a4('0x51'),_0x5c754a);throw _0x5c754a;});}return _0x44bdf2;})[_0xe1a4('0x27')](respondWithResult(_0x31ef92,0xc9))[_0xe1a4('0x46')](handleError(_0x31ef92,null));};exports['update']=function(_0x1cc896,_0x4b38b9){if(_0x1cc896[_0xe1a4('0x52')]['id']){delete _0x1cc896[_0xe1a4('0x52')]['id'];}return db[_0xe1a4('0x43')][_0xe1a4('0x4f')]({'where':{'id':_0x1cc896['params']['id']}})[_0xe1a4('0x27')](handleEntityNotFound(_0x4b38b9,null))['then'](saveUpdates(_0x1cc896[_0xe1a4('0x52')],null))[_0xe1a4('0x27')](respondWithResult(_0x4b38b9,null))[_0xe1a4('0x46')](handleError(_0x4b38b9,null));};exports[_0xe1a4('0x28')]=function(_0x7a2b35,_0x501bb3){return db['WhatsappQueue'][_0xe1a4('0x4f')]({'where':{'id':_0x7a2b35['params']['id']}})['then'](handleEntityNotFound(_0x501bb3,null))[_0xe1a4('0x27')](removeEntity(_0x501bb3,null))['catch'](handleError(_0x501bb3,null));};exports[_0xe1a4('0x53')]=function(_0x1829ce,_0x8bc37d){return db[_0xe1a4('0x43')][_0xe1a4('0x53')]()[_0xe1a4('0x27')](respondWithResult(_0x8bc37d,null))[_0xe1a4('0x46')](handleError(_0x8bc37d,null));};exports[_0xe1a4('0x54')]=function(_0x53b119,_0x25aaa6,_0x2706b7){var _0x225828={'raw':!![],'where':{}},_0x4a4253={},_0x25b967;return db[_0xe1a4('0x43')][_0xe1a4('0x55')]({'where':{'id':_0x53b119['params']['id']}})[_0xe1a4('0x27')](handleEntityNotFound(_0x25aaa6,null))['then'](function(_0x4a4b11){if(_0x4a4b11){_0x25b967=_0x4a4b11[_0xe1a4('0x29')]({'plain':!![]});_0x4a4253[_0xe1a4('0x37')]=_[_0xe1a4('0x34')](db[_0xe1a4('0x56')][_0xe1a4('0x2f')]);_0x4a4253['query']=_['keys'](_0x53b119[_0xe1a4('0x33')]);_0x4a4253[_0xe1a4('0x35')]=_[_0xe1a4('0x36')](_0x4a4253[_0xe1a4('0x37')],_0x4a4253[_0xe1a4('0x33')]);_0x225828[_0xe1a4('0x38')]=_['intersection'](_0x4a4253['model'],qs[_0xe1a4('0x39')](_0x53b119[_0xe1a4('0x33')][_0xe1a4('0x39')]));_0x225828[_0xe1a4('0x38')]=_0x225828[_0xe1a4('0x38')]['length']?_0x225828[_0xe1a4('0x38')]:_0x4a4253['model'];if(!_0x53b119['query'][_0xe1a4('0x3b')](_0xe1a4('0x3c'))){_0x225828[_0xe1a4('0x22')]=qs[_0xe1a4('0x22')](_0x53b119[_0xe1a4('0x33')][_0xe1a4('0x22')]);_0x225828[_0xe1a4('0x20')]=qs[_0xe1a4('0x20')](_0x53b119[_0xe1a4('0x33')]['offset']);}_0x225828[_0xe1a4('0x57')]=qs[_0xe1a4('0x3d')](_0x53b119[_0xe1a4('0x33')][_0xe1a4('0x3d')]);_0x225828[_0xe1a4('0x3e')]=qs[_0xe1a4('0x35')](_[_0xe1a4('0x3f')](_0x53b119[_0xe1a4('0x33')],_0x4a4253[_0xe1a4('0x35')]));_0x225828['where'][_0xe1a4('0x58')]=_0x4a4b11['id'];if(_0x53b119['query'][_0xe1a4('0x40')]){_0x225828['where']=_[_0xe1a4('0x41')](_0x225828['where'],{'$or':_[_0xe1a4('0x2e')](_0x225828[_0xe1a4('0x38')],function(_0xbb7159){var _0x136b08={};_0x136b08[_0xbb7159]={'$like':'%'+_0x53b119['query']['filter']+'%'};return _0x136b08;})});}_0x225828=_['merge']({},_0x225828,_0x53b119['options']);return db[_0xe1a4('0x56')][_0xe1a4('0x59')](_0x225828);}})[_0xe1a4('0x27')](function(_0x4a48c5){if(_0x4a48c5){return db['User'][_0xe1a4('0x5a')]({'where':{'id':_[_0xe1a4('0x2e')](_0x4a48c5,_0xe1a4('0x5b')),'role':_0xe1a4('0x5c')},'attributes':['id',_0xe1a4('0x2d'),_0xe1a4('0x5d'),_0xe1a4('0x5e'),'createdAt']});}})[_0xe1a4('0x27')](function(_0x2bbc1b){if(_0x2bbc1b){return{'count':_0x2bbc1b[_0xe1a4('0x23')],'rows':_[_0xe1a4('0x2e')](_0x2bbc1b[_0xe1a4('0x5f')],function(_0x459f80){return{'membername':_0x459f80['name'],'UserId':_0x459f80['id'],'queue_name':_0x25b967[_0xe1a4('0x2d')],'WhatsappQueueId':_0x25b967['id'],'interface':util[_0xe1a4('0x60')](_0xe1a4('0x61'),_0xe1a4('0x62'),_0x459f80['name']),'penalty':0x0,'paused':_0x459f80[_0xe1a4('0x5d')],'createdAt':_0x459f80[_0xe1a4('0x63')],'updatedAt':_0x459f80['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe1a4('0x27')](respondWithFilteredResult(_0x25aaa6,_0x225828))[_0xe1a4('0x46')](handleError(_0x25aaa6,null));};exports[_0xe1a4('0x64')]=function(_0xed0926,_0x3aebe1,_0x1c536b){var _0x8b16e7={};var _0x4c38b0={};var _0x2dfa85;var _0x520355;return db[_0xe1a4('0x43')][_0xe1a4('0x55')]({'where':{'id':_0xed0926['params']['id']}})[_0xe1a4('0x27')](handleEntityNotFound(_0x3aebe1,null))['then'](function(_0x442670){if(_0x442670){_0x2dfa85=_0x442670;_0x4c38b0[_0xe1a4('0x37')]=_[_0xe1a4('0x34')](db[_0xe1a4('0x65')][_0xe1a4('0x2f')]);_0x4c38b0['query']=_['keys'](_0xed0926['query']);_0x4c38b0['filters']=_[_0xe1a4('0x36')](_0x4c38b0['model'],_0x4c38b0[_0xe1a4('0x33')]);_0x8b16e7[_0xe1a4('0x38')]=_[_0xe1a4('0x36')](_0x4c38b0[_0xe1a4('0x37')],qs[_0xe1a4('0x39')](_0xed0926[_0xe1a4('0x33')][_0xe1a4('0x39')]));_0x8b16e7[_0xe1a4('0x38')]=_0x8b16e7['attributes'][_0xe1a4('0x3a')]?_0x8b16e7[_0xe1a4('0x38')]:_0x4c38b0[_0xe1a4('0x37')];_0x8b16e7[_0xe1a4('0x57')]=qs[_0xe1a4('0x3d')](_0xed0926[_0xe1a4('0x33')][_0xe1a4('0x3d')]);_0x8b16e7[_0xe1a4('0x3e')]=qs['filters'](_['pick'](_0xed0926[_0xe1a4('0x33')],_0x4c38b0[_0xe1a4('0x35')]));if(_0xed0926[_0xe1a4('0x33')][_0xe1a4('0x40')]){_0x8b16e7[_0xe1a4('0x3e')]=_['merge'](_0x8b16e7[_0xe1a4('0x3e')],{'$or':_[_0xe1a4('0x2e')](_0x8b16e7[_0xe1a4('0x38')],function(_0x5443a2){var _0x40014f={};_0x40014f[_0x5443a2]={'$like':'%'+_0xed0926[_0xe1a4('0x33')][_0xe1a4('0x40')]+'%'};return _0x40014f;})});}_0x8b16e7=_[_0xe1a4('0x41')]({},_0x8b16e7,_0xed0926[_0xe1a4('0x42')]);return _0x2dfa85[_0xe1a4('0x64')](_0x8b16e7);}})[_0xe1a4('0x27')](function(_0x140340){if(_0x140340){_0x520355=_0x140340[_0xe1a4('0x3a')];if(!_0xed0926[_0xe1a4('0x33')][_0xe1a4('0x3b')](_0xe1a4('0x3c'))){_0x8b16e7[_0xe1a4('0x22')]=qs[_0xe1a4('0x22')](_0xed0926[_0xe1a4('0x33')][_0xe1a4('0x22')]);_0x8b16e7[_0xe1a4('0x20')]=qs['offset'](_0xed0926[_0xe1a4('0x33')][_0xe1a4('0x20')]);}return _0x2dfa85[_0xe1a4('0x64')](_0x8b16e7);}})[_0xe1a4('0x27')](function(_0x208f18){if(_0x208f18){return _0x208f18?{'count':_0x520355,'rows':_0x208f18}:null;}})[_0xe1a4('0x27')](respondWithResult(_0x3aebe1,null))[_0xe1a4('0x46')](handleError(_0x3aebe1,null));};exports[_0xe1a4('0x66')]=function(_0x55e64d,_0x144dca,_0x5d2b7c){var _0x43edea=_0x55e64d['body'][_0xe1a4('0x67')];return db['Team'][_0xe1a4('0x59')]({'where':{'id':_0x43edea},'attributes':['id'],'include':[{'model':db[_0xe1a4('0x68')],'as':_0xe1a4('0x69'),'attributes':['id','name',_0xe1a4('0x6a'),_0xe1a4('0x6b'),_0xe1a4('0x6c')],'raw':!![]}]})[_0xe1a4('0x27')](function(_0x324928){if(_0x324928){var _0x5a4386=_['flatMap'](_0x324928,function(_0x1dc514){var _0x2ef818=_0x1dc514[_0xe1a4('0x29')]({'plain':!![]});return _0x2ef818[_0xe1a4('0x69')];});return db['WhatsappQueue']['find']({'where':{'id':_0x55e64d[_0xe1a4('0x48')]['id']}})[_0xe1a4('0x27')](function(_0x3b9b0e){return db[_0xe1a4('0x6d')][_0xe1a4('0x6e')](function(_0x106111){return _0x3b9b0e[_0xe1a4('0x66')](_0x43edea,{'transaction':_0x106111})['then'](function(){return BPromise[_0xe1a4('0x6f')](_0x5a4386,function(_0x2f7ba8){return db['UserWhatsappQueue'][_0xe1a4('0x70')]({'where':{'UserId':_0x2f7ba8['id'],'WhatsappQueueId':_0x55e64d[_0xe1a4('0x48')]['id']},'transaction':_0x106111});});})[_0xe1a4('0x27')](function(){_0x5a4386[_0xe1a4('0x71')](function(_0x5902b5){socket['emit'](_0xe1a4('0x72'),{'UserId':_0x5902b5['id'],'WhatsappQueueId':_0x3b9b0e['id']});});});});});}})[_0xe1a4('0x27')](respondWithStatusCode(_0x144dca,null))[_0xe1a4('0x46')](handleError(_0x144dca,null));};exports[_0xe1a4('0x73')]=function(_0x248dbd,_0x1ea484,_0x10db12){return db[_0xe1a4('0x65')][_0xe1a4('0x59')]({'where':{'id':_0x248dbd[_0xe1a4('0x33')][_0xe1a4('0x67')]},'attributes':['id'],'include':[{'model':db[_0xe1a4('0x68')],'as':_0xe1a4('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1ea484,null))['then'](function(_0x370660){var _0xfad0c8=_[_0xe1a4('0x2e')](_0x370660,'id');var _0x61702f=[];var _0x361791=[];var _0x12cbee=squel[_0xe1a4('0x74')]();_0x12cbee[_0xe1a4('0x75')](_0xe1a4('0x76'))[_0xe1a4('0x77')](_0xe1a4('0x78'),'tq')['join'](_0xe1a4('0x79'),'ut',_0xe1a4('0x7a'))[_0xe1a4('0x3e')]('WhatsappQueueId\x20=\x20?',_0x248dbd[_0xe1a4('0x48')]['id']);for(var _0x5a4d9d=0x0;_0x5a4d9d<_0x370660[_0xe1a4('0x3a')];_0x5a4d9d+=0x1){let _0x1fe43d=_0x370660[_0x5a4d9d];for(var _0x44b9c8=0x0;_0x44b9c8<_0x1fe43d['Agents'][_0xe1a4('0x3a')];_0x44b9c8+=0x1){let _0x1fa8f7=_0x1fe43d[_0xe1a4('0x69')][_0x44b9c8];var _0x1de7d3=_0x12cbee[_0xe1a4('0x7b')]();_0x1de7d3[_0xe1a4('0x3e')](_0xe1a4('0x7c'),_0x1fa8f7['id']);_0x361791[_0xe1a4('0x7d')](db[_0xe1a4('0x6d')][_0xe1a4('0x33')](_0x1de7d3[_0xe1a4('0x7e')](),{'type':db[_0xe1a4('0x6d')][_0xe1a4('0x7f')]['SELECT']})[_0xe1a4('0x27')](function(_0x383a66){if(_0x383a66['length']===0x1){return _0x1fa8f7['id'];}else{var _0xdc2d79=_['every'](_[_0xe1a4('0x2e')](_0x383a66,_0xe1a4('0x80')),function(_0x2c1f16){return _['includes'](_0xfad0c8,_0x2c1f16);});if(_0xdc2d79){return _0x1fa8f7['id'];}}}));}}return BPromise[_0xe1a4('0x81')](_0x361791)[_0xe1a4('0x27')](function(_0x3c3150){_0x61702f=_(_0x61702f)[_0xe1a4('0x82')](_0x3c3150)[_0xe1a4('0x83')]()[_0xe1a4('0x84')]();return db[_0xe1a4('0x43')][_0xe1a4('0x4f')]({'where':{'id':_0x248dbd[_0xe1a4('0x48')]['id']}})['then'](function(_0x375478){return db[_0xe1a4('0x6d')][_0xe1a4('0x6e')](function(_0x3cfbf0){return _0x375478['removeTeams'](_0x248dbd[_0xe1a4('0x33')][_0xe1a4('0x67')],{'transaction':_0x3cfbf0})[_0xe1a4('0x27')](function(){if(!_['isEmpty'](_0x61702f)){return _0x375478[_0xe1a4('0x85')](_0x61702f,{'transaction':_0x3cfbf0});}})['then'](function(){_0x61702f[_0xe1a4('0x71')](function(_0x24cdb1){socket[_0xe1a4('0x86')](_0xe1a4('0x87'),{'UserId':_0x24cdb1,'WhatsappQueueId':_0x375478['id']});});});});});});})[_0xe1a4('0x27')](respondWithStatusCode(_0x1ea484,null))[_0xe1a4('0x46')](handleError(_0x1ea484,null));};exports['addAgents']=function(_0x4daafc,_0x18d746,_0xe8df){return db[_0xe1a4('0x43')][_0xe1a4('0x4f')]({'where':{'id':_0x4daafc[_0xe1a4('0x48')]['id']}})[_0xe1a4('0x27')](handleEntityNotFound(_0x18d746,null))[_0xe1a4('0x27')](function(_0x3a00a7){if(_0x3a00a7){return _0x3a00a7[_0xe1a4('0x88')](_0x4daafc['body']['ids'],_[_0xe1a4('0x89')](_0x4daafc[_0xe1a4('0x52')],[_0xe1a4('0x67'),'id'])||{})['spread'](function(_0x4c70db){for(var _0x5e86f9=0x0;_0x5e86f9<_0x4daafc[_0xe1a4('0x52')][_0xe1a4('0x67')][_0xe1a4('0x3a')];_0x5e86f9+=0x1){socket['emit'](_0xe1a4('0x72'),{'UserId':Number(_0x4daafc[_0xe1a4('0x52')][_0xe1a4('0x67')][_0x5e86f9]),'WhatsappQueueId':Number(_0x4daafc['params']['id'])});}return _0x4c70db;});}})[_0xe1a4('0x27')](respondWithResult(_0x18d746,null))[_0xe1a4('0x46')](handleError(_0x18d746,null));};exports['removeAgents']=function(_0x4c7e1f,_0x2cf048,_0x555f06){return db['WhatsappQueue'][_0xe1a4('0x4f')]({'where':{'id':_0x4c7e1f[_0xe1a4('0x48')]['id']}})[_0xe1a4('0x27')](handleEntityNotFound(_0x2cf048,null))['then'](function(_0x3002ce){if(_0x3002ce){return _0x3002ce['removeAgents'](_0x4c7e1f[_0xe1a4('0x33')]['ids'])[_0xe1a4('0x27')](function(){if(_[_0xe1a4('0x8a')](_0x4c7e1f[_0xe1a4('0x33')][_0xe1a4('0x67')])){for(var _0x172c72=0x0;_0x172c72<_0x4c7e1f[_0xe1a4('0x33')][_0xe1a4('0x67')]['length'];_0x172c72+=0x1){socket['emit'](_0xe1a4('0x87'),{'UserId':Number(_0x4c7e1f['query'][_0xe1a4('0x67')][_0x172c72]),'WhatsappQueueId':Number(_0x4c7e1f[_0xe1a4('0x48')]['id'])});}}else{socket['emit'](_0xe1a4('0x87'),{'UserId':Number(_0x4c7e1f[_0xe1a4('0x33')][_0xe1a4('0x67')]),'WhatsappQueueId':Number(_0x4c7e1f[_0xe1a4('0x48')]['id'])});}});}})[_0xe1a4('0x27')](respondWithStatusCode(_0x2cf048,null))[_0xe1a4('0x46')](handleError(_0x2cf048,null));};exports['getAgents']=function(_0x3d9a01,_0x1e1e09,_0x900a0e){var _0x4f6eef={};var _0x305c36={};var _0x395b79;var _0x377779;return db['WhatsappQueue'][_0xe1a4('0x55')]({'where':{'id':_0x3d9a01['params']['id']}})[_0xe1a4('0x27')](handleEntityNotFound(_0x1e1e09,null))[_0xe1a4('0x27')](function(_0x522736){if(_0x522736){_0x395b79=_0x522736;_0x305c36['model']=_[_0xe1a4('0x34')](db[_0xe1a4('0x68')][_0xe1a4('0x2f')]);_0x305c36['query']=_['keys'](_0x3d9a01[_0xe1a4('0x33')]);_0x305c36[_0xe1a4('0x35')]=_[_0xe1a4('0x36')](_0x305c36[_0xe1a4('0x37')],_0x305c36[_0xe1a4('0x33')]);_0x4f6eef[_0xe1a4('0x38')]=_[_0xe1a4('0x36')](_0x305c36[_0xe1a4('0x37')],qs[_0xe1a4('0x39')](_0x3d9a01['query']['fields']));_0x4f6eef[_0xe1a4('0x38')]=_0x4f6eef['attributes']['length']?_0x4f6eef[_0xe1a4('0x38')]:_0x305c36[_0xe1a4('0x37')];_0x4f6eef[_0xe1a4('0x57')]=qs['sort'](_0x3d9a01[_0xe1a4('0x33')][_0xe1a4('0x3d')]);_0x4f6eef[_0xe1a4('0x3e')]=qs[_0xe1a4('0x35')](_[_0xe1a4('0x3f')](_0x3d9a01[_0xe1a4('0x33')],_0x305c36[_0xe1a4('0x35')]));if(_0x3d9a01[_0xe1a4('0x33')][_0xe1a4('0x40')]){_0x4f6eef[_0xe1a4('0x3e')]=_[_0xe1a4('0x41')](_0x4f6eef[_0xe1a4('0x3e')],{'$or':_[_0xe1a4('0x2e')](_0x4f6eef[_0xe1a4('0x38')],function(_0x49e41f){var _0xb97d6f={};_0xb97d6f[_0x49e41f]={'$like':'%'+_0x3d9a01[_0xe1a4('0x33')][_0xe1a4('0x40')]+'%'};return _0xb97d6f;})});}_0x4f6eef=_[_0xe1a4('0x41')]({},_0x4f6eef,_0x3d9a01[_0xe1a4('0x42')]);return _0x395b79[_0xe1a4('0x8b')](_0x4f6eef);}})[_0xe1a4('0x27')](function(_0x1ee489){if(_0x1ee489){_0x377779=_0x1ee489[_0xe1a4('0x3a')];if(!_0x3d9a01[_0xe1a4('0x33')][_0xe1a4('0x3b')](_0xe1a4('0x3c'))){_0x4f6eef[_0xe1a4('0x22')]=qs[_0xe1a4('0x22')](_0x3d9a01[_0xe1a4('0x33')][_0xe1a4('0x22')]);_0x4f6eef[_0xe1a4('0x20')]=qs['offset'](_0x3d9a01['query']['offset']);}return _0x395b79[_0xe1a4('0x8b')](_0x4f6eef);}})['then'](function(_0x51d467){if(_0x51d467){return _0x51d467?{'count':_0x377779,'rows':_0x51d467}:null;}})[_0xe1a4('0x27')](respondWithResult(_0x1e1e09,null))[_0xe1a4('0x46')](handleError(_0x1e1e09,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f24086a..0d7ecef 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 _0x5d80=['save','update','emit','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5d80,0xa7));var _0x05d8=function(_0x4bef04,_0x58723f){_0x4bef04=_0x4bef04-0x0;var _0x35e83a=_0x5d80[_0x4bef04];return _0x35e83a;};'use strict';var EventEmitter=require(_0x05d8('0x0'));var WhatsappQueue=require(_0x05d8('0x1'))['db'][_0x05d8('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x05d8('0x3')](0x0);var events={'afterCreate':_0x05d8('0x4'),'afterUpdate':_0x05d8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2c3ec3){return function(_0x30b855,_0x504c17,_0x12492c){WhatsappQueueEvents[_0x05d8('0x6')](_0x2c3ec3+':'+_0x30b855['id'],_0x30b855);WhatsappQueueEvents[_0x05d8('0x6')](_0x2c3ec3,_0x30b855);_0x12492c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x05d8('0x7')](e,emitEvent(event));}}module[_0x05d8('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x5a98=['hook','exports','WhatsappQueue','save','remove','emit','hasOwnProperty'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x5a98,0x1d0));var _0x85a9=function(_0x2716e4,_0x4a1809){_0x2716e4=_0x2716e4-0x0;var _0x247d68=_0x5a98[_0x2716e4];return _0x247d68;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x85a9('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x85a9('0x1'),'afterUpdate':'update','afterDestroy':_0x85a9('0x2')};function emitEvent(_0x2c2d25){return function(_0x1edf7a,_0x35c1cc,_0x477562){WhatsappQueueEvents[_0x85a9('0x3')](_0x2c2d25+':'+_0x1edf7a['id'],_0x1edf7a);WhatsappQueueEvents['emit'](_0x2c2d25,_0x1edf7a);_0x477562(null);};}for(var e in events){if(events[_0x85a9('0x4')](e)){var event=events[e];WhatsappQueue[_0x85a9('0x5')](e,emitEvent(event));}}module[_0x85a9('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index c7d1267..9d7cdc7 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 _0x91bd=['bluebird','rimraf','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3366a1,_0x8fd9b8){var _0xfd6cca=function(_0x32b514){while(--_0x32b514){_0x3366a1['push'](_0x3366a1['shift']());}};_0xfd6cca(++_0x8fd9b8);}(_0x91bd,0x1c9));var _0xd91b=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x91bd[_0x2fbcf6];return _0x3e7265;};'use strict';var _=require(_0xd91b('0x0'));var util=require(_0xd91b('0x1'));var logger=require(_0xd91b('0x2'))(_0xd91b('0x3'));var moment=require(_0xd91b('0x4'));var BPromise=require(_0xd91b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd91b('0x6'));var config=require(_0xd91b('0x7'));var attributes=require(_0xd91b('0x8'));module[_0xd91b('0x9')]=function(_0x566f55,_0x593514){return _0x566f55['define']('WhatsappQueue',attributes,{'tableName':_0xd91b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18c2=['whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueue.attributes','WhatsappQueue'];(function(_0xc82863,_0x5377b1){var _0x1870b8=function(_0x38c94b){while(--_0x38c94b){_0xc82863['push'](_0xc82863['shift']());}};_0x1870b8(++_0x5377b1);}(_0x18c2,0x1e5));var _0x218c=function(_0x3d3c88,_0x1b402c){_0x3d3c88=_0x3d3c88-0x0;var _0x46f94e=_0x18c2[_0x3d3c88];return _0x46f94e;};'use strict';var _=require(_0x218c('0x0'));var util=require(_0x218c('0x1'));var logger=require(_0x218c('0x2'))(_0x218c('0x3'));var moment=require(_0x218c('0x4'));var BPromise=require(_0x218c('0x5'));var rp=require(_0x218c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x218c('0x7'));var config=require('../../config/environment');var attributes=require(_0x218c('0x8'));module['exports']=function(_0x40a55c,_0x17e17b){return _0x40a55c['define'](_0x218c('0x9'),attributes,{'tableName':_0x218c('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 876e2d5..4efb9a3 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 _0x9e91=['defaults','./whatsappQueue.socket','register','request','then','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','raw','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0xd9c91d,_0x4860a3){var _0x4cc1ef=function(_0x445f30){while(--_0x445f30){_0xd9c91d['push'](_0xd9c91d['shift']());}};_0x4cc1ef(++_0x4860a3);}(_0x9e91,0xf9));var _0x19e9=function(_0x450354,_0x588424){_0x450354=_0x450354-0x0;var _0x313cf1=_0x9e91[_0x450354];return _0x313cf1;};'use strict';var _=require('lodash');var util=require(_0x19e9('0x0'));var moment=require(_0x19e9('0x1'));var BPromise=require(_0x19e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19e9('0x3'));var db=require(_0x19e9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x19e9('0x5'))(_0x19e9('0x6'));var config=require(_0x19e9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x19e9('0x8')]({'port':0x232a});config[_0x19e9('0x9')]=_[_0x19e9('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19e9('0x9')]));require(_0x19e9('0xb'))[_0x19e9('0xc')](socket);function respondWithRpcPromise(_0x1afd79,_0x4769d9,_0x1ea716){return new BPromise(function(_0x28a6cc,_0x26b18c){return client[_0x19e9('0xd')](_0x1afd79,_0x1ea716)[_0x19e9('0xe')](function(_0x43b384){logger[_0x19e9('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x4769d9,'request\x20sent');logger[_0x19e9('0x10')](_0x19e9('0x11'),_0x4769d9,_0x19e9('0x12'),JSON['stringify'](_0x43b384));if(_0x43b384['error']){if(_0x43b384[_0x19e9('0x13')][_0x19e9('0x14')]===0x1f4){logger['error'](_0x19e9('0x15'),_0x4769d9,_0x43b384[_0x19e9('0x13')][_0x19e9('0x16')]);return _0x26b18c(_0x43b384[_0x19e9('0x13')][_0x19e9('0x16')]);}logger[_0x19e9('0x13')](_0x19e9('0x15'),_0x4769d9,_0x43b384[_0x19e9('0x13')][_0x19e9('0x16')]);return _0x28a6cc(_0x43b384['error']['message']);}else{logger[_0x19e9('0xf')](_0x19e9('0x15'),_0x4769d9,_0x19e9('0x12'));_0x28a6cc(_0x43b384['result'][_0x19e9('0x16')]);}})[_0x19e9('0x17')](function(_0x49c17f){logger[_0x19e9('0x13')](_0x19e9('0x15'),_0x4769d9,_0x49c17f);_0x26b18c(_0x49c17f);});});}exports[_0x19e9('0x18')]=function(_0x403102){var _0x1a7e37=this;return new Promise(function(_0x476eb0,_0x55a3d9){return db[_0x19e9('0x19')][_0x19e9('0x1a')]({'raw':_0x403102[_0x19e9('0x1b')]?_0x403102['options']['raw']===undefined?!![]:![]:!![],'where':_0x403102[_0x19e9('0x1b')]?_0x403102['options'][_0x19e9('0x1c')]||null:null,'attributes':_0x403102[_0x19e9('0x1b')]?_0x403102[_0x19e9('0x1b')][_0x19e9('0x1d')]||null:null,'limit':_0x403102[_0x19e9('0x1b')]?_0x403102[_0x19e9('0x1b')][_0x19e9('0x1e')]||null:null,'include':_0x403102[_0x19e9('0x1b')]?_0x403102[_0x19e9('0x1b')][_0x19e9('0x1f')]?_[_0x19e9('0x20')](_0x403102[_0x19e9('0x1b')][_0x19e9('0x1f')],function(_0x450431){return{'model':db[_0x450431[_0x19e9('0x21')]],'as':_0x450431['as'],'attributes':_0x450431[_0x19e9('0x1d')],'include':_0x450431[_0x19e9('0x1f')]?_[_0x19e9('0x20')](_0x450431[_0x19e9('0x1f')],function(_0x19a841){return{'model':db[_0x19a841[_0x19e9('0x21')]],'as':_0x19a841['as'],'attributes':_0x19a841[_0x19e9('0x1d')],'include':_0x19a841['include']?_[_0x19e9('0x20')](_0x19a841[_0x19e9('0x1f')],function(_0x2ad7c1){return{'model':db[_0x2ad7c1[_0x19e9('0x21')]],'as':_0x2ad7c1['as'],'attributes':_0x2ad7c1[_0x19e9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x19e9('0xe')](function(_0x38d953){logger['info'](_0x19e9('0x18'),_0x403102);logger[_0x19e9('0x10')](_0x19e9('0x18'),_0x403102,JSON['stringify'](_0x38d953));_0x476eb0(_0x38d953);})['catch'](function(_0x54f64b){logger[_0x19e9('0x13')]('GetWhatsappQueue',_0x54f64b['message'],_0x403102);_0x55a3d9(_0x1a7e37[_0x19e9('0x13')](0x1f4,_0x54f64b[_0x19e9('0x16')]));});});};exports[_0x19e9('0x22')]=function(_0x4babd7){var _0x289fc8=this;return new Promise(function(_0x2ad8ac,_0x1eca8a){return db['WhatsappQueue']['find']({'raw':_0x4babd7[_0x19e9('0x1b')]?_0x4babd7[_0x19e9('0x1b')][_0x19e9('0x23')]===undefined?!![]:![]:!![],'where':_0x4babd7[_0x19e9('0x1b')]?_0x4babd7[_0x19e9('0x1b')][_0x19e9('0x1c')]||null:null,'attributes':_0x4babd7['options']?_0x4babd7[_0x19e9('0x1b')][_0x19e9('0x1d')]||null:null,'include':_0x4babd7[_0x19e9('0x1b')]?_0x4babd7[_0x19e9('0x1b')]['include']?_[_0x19e9('0x20')](_0x4babd7['options'][_0x19e9('0x1f')],function(_0x589505){return{'model':db[_0x589505['model']],'as':_0x589505['as'],'attributes':_0x589505['attributes'],'include':_0x589505[_0x19e9('0x1f')]?_['map'](_0x589505[_0x19e9('0x1f')],function(_0x3e2cab){return{'model':db[_0x3e2cab['model']],'as':_0x3e2cab['as'],'attributes':_0x3e2cab[_0x19e9('0x1d')],'include':_0x3e2cab[_0x19e9('0x1f')]?_['map'](_0x3e2cab[_0x19e9('0x1f')],function(_0x3e23c7){return{'model':db[_0x3e23c7[_0x19e9('0x21')]],'as':_0x3e23c7['as'],'attributes':_0x3e23c7[_0x19e9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x19e9('0xe')](function(_0x202ff5){logger[_0x19e9('0xf')](_0x19e9('0x22'),_0x4babd7);logger['debug']('ShowWhatsappQueue',_0x4babd7,JSON[_0x19e9('0x24')](_0x202ff5));_0x2ad8ac(_0x202ff5);})[_0x19e9('0x17')](function(_0xc4a81a){logger[_0x19e9('0x13')](_0x19e9('0x22'),_0xc4a81a[_0x19e9('0x16')],_0x4babd7);_0x1eca8a(_0x289fc8[_0x19e9('0x13')](0x1f4,_0xc4a81a[_0x19e9('0x16')]));});});}; \ No newline at end of file +var _0xe0c8=['include','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','map'];(function(_0x2a4dc6,_0x2d6a50){var _0x39a416=function(_0x5c5f8d){while(--_0x5c5f8d){_0x2a4dc6['push'](_0x2a4dc6['shift']());}};_0x39a416(++_0x2d6a50);}(_0xe0c8,0x15e));var _0x8e0c=function(_0x214a03,_0x2e4061){_0x214a03=_0x214a03-0x0;var _0xda476a=_0xe0c8[_0x214a03];return _0xda476a;};'use strict';var _=require(_0x8e0c('0x0'));var util=require(_0x8e0c('0x1'));var moment=require(_0x8e0c('0x2'));var BPromise=require(_0x8e0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e0c('0x4'));var db=require(_0x8e0c('0x5'))['db'];var utils=require(_0x8e0c('0x6'));var logger=require(_0x8e0c('0x7'))('rpc');var config=require(_0x8e0c('0x8'));var jayson=require(_0x8e0c('0x9'));var client=jayson[_0x8e0c('0xa')][_0x8e0c('0xb')]({'port':0x232a});config[_0x8e0c('0xc')]=_[_0x8e0c('0xd')](config[_0x8e0c('0xc')],{'host':_0x8e0c('0xe'),'port':0x18eb});var socket=require(_0x8e0c('0xf'))(new Redis(config[_0x8e0c('0xc')]));require(_0x8e0c('0x10'))['register'](socket);function respondWithRpcPromise(_0x3ca2aa,_0xead427,_0x38800a){return new BPromise(function(_0x50e60a,_0x26b54f){return client[_0x8e0c('0x11')](_0x3ca2aa,_0x38800a)[_0x8e0c('0x12')](function(_0x264638){logger[_0x8e0c('0x13')](_0x8e0c('0x14'),_0xead427,_0x8e0c('0x15'));logger[_0x8e0c('0x16')](_0x8e0c('0x17'),_0xead427,'request\x20sent',JSON['stringify'](_0x264638));if(_0x264638[_0x8e0c('0x18')]){if(_0x264638[_0x8e0c('0x18')][_0x8e0c('0x19')]===0x1f4){logger[_0x8e0c('0x18')](_0x8e0c('0x14'),_0xead427,_0x264638[_0x8e0c('0x18')][_0x8e0c('0x1a')]);return _0x26b54f(_0x264638[_0x8e0c('0x18')][_0x8e0c('0x1a')]);}logger[_0x8e0c('0x18')](_0x8e0c('0x14'),_0xead427,_0x264638[_0x8e0c('0x18')][_0x8e0c('0x1a')]);return _0x50e60a(_0x264638['error'][_0x8e0c('0x1a')]);}else{logger[_0x8e0c('0x13')](_0x8e0c('0x14'),_0xead427,_0x8e0c('0x15'));_0x50e60a(_0x264638[_0x8e0c('0x1b')][_0x8e0c('0x1a')]);}})[_0x8e0c('0x1c')](function(_0x509069){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0xead427,_0x509069);_0x26b54f(_0x509069);});});}exports['GetWhatsappQueue']=function(_0x541e5d){var _0x5a4a94=this;return new Promise(function(_0x4b2c7e,_0x26d84d){return db[_0x8e0c('0x1d')][_0x8e0c('0x1e')]({'raw':_0x541e5d[_0x8e0c('0x1f')]?_0x541e5d[_0x8e0c('0x1f')][_0x8e0c('0x20')]===undefined?!![]:![]:!![],'where':_0x541e5d[_0x8e0c('0x1f')]?_0x541e5d[_0x8e0c('0x1f')][_0x8e0c('0x21')]||null:null,'attributes':_0x541e5d['options']?_0x541e5d['options'][_0x8e0c('0x22')]||null:null,'limit':_0x541e5d[_0x8e0c('0x1f')]?_0x541e5d[_0x8e0c('0x1f')][_0x8e0c('0x23')]||null:null,'include':_0x541e5d[_0x8e0c('0x1f')]?_0x541e5d[_0x8e0c('0x1f')]['include']?_[_0x8e0c('0x24')](_0x541e5d['options'][_0x8e0c('0x25')],function(_0xfbc630){return{'model':db[_0xfbc630[_0x8e0c('0x26')]],'as':_0xfbc630['as'],'attributes':_0xfbc630[_0x8e0c('0x22')],'include':_0xfbc630[_0x8e0c('0x25')]?_[_0x8e0c('0x24')](_0xfbc630[_0x8e0c('0x25')],function(_0x28c6a8){return{'model':db[_0x28c6a8[_0x8e0c('0x26')]],'as':_0x28c6a8['as'],'attributes':_0x28c6a8['attributes'],'include':_0x28c6a8[_0x8e0c('0x25')]?_[_0x8e0c('0x24')](_0x28c6a8['include'],function(_0x5e3b9b){return{'model':db[_0x5e3b9b['model']],'as':_0x5e3b9b['as'],'attributes':_0x5e3b9b[_0x8e0c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44e28a){logger['info'](_0x8e0c('0x27'),_0x541e5d);logger[_0x8e0c('0x16')]('GetWhatsappQueue',_0x541e5d,JSON[_0x8e0c('0x28')](_0x44e28a));_0x4b2c7e(_0x44e28a);})['catch'](function(_0xa640b0){logger['error'](_0x8e0c('0x27'),_0xa640b0['message'],_0x541e5d);_0x26d84d(_0x5a4a94[_0x8e0c('0x18')](0x1f4,_0xa640b0[_0x8e0c('0x1a')]));});});};exports[_0x8e0c('0x29')]=function(_0x362cd4){var _0x4b9b1a=this;return new Promise(function(_0x38bdfc,_0x1a8d19){return db[_0x8e0c('0x1d')][_0x8e0c('0x2a')]({'raw':_0x362cd4[_0x8e0c('0x1f')]?_0x362cd4[_0x8e0c('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x362cd4[_0x8e0c('0x1f')]?_0x362cd4[_0x8e0c('0x1f')][_0x8e0c('0x21')]||null:null,'attributes':_0x362cd4[_0x8e0c('0x1f')]?_0x362cd4['options'][_0x8e0c('0x22')]||null:null,'include':_0x362cd4[_0x8e0c('0x1f')]?_0x362cd4[_0x8e0c('0x1f')]['include']?_[_0x8e0c('0x24')](_0x362cd4[_0x8e0c('0x1f')][_0x8e0c('0x25')],function(_0x59d990){return{'model':db[_0x59d990[_0x8e0c('0x26')]],'as':_0x59d990['as'],'attributes':_0x59d990[_0x8e0c('0x22')],'include':_0x59d990[_0x8e0c('0x25')]?_[_0x8e0c('0x24')](_0x59d990[_0x8e0c('0x25')],function(_0x2123a1){return{'model':db[_0x2123a1['model']],'as':_0x2123a1['as'],'attributes':_0x2123a1[_0x8e0c('0x22')],'include':_0x2123a1['include']?_[_0x8e0c('0x24')](_0x2123a1[_0x8e0c('0x25')],function(_0x1b1228){return{'model':db[_0x1b1228[_0x8e0c('0x26')]],'as':_0x1b1228['as'],'attributes':_0x1b1228['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xca3caa){logger[_0x8e0c('0x13')](_0x8e0c('0x29'),_0x362cd4);logger[_0x8e0c('0x16')]('ShowWhatsappQueue',_0x362cd4,JSON[_0x8e0c('0x28')](_0xca3caa));_0x38bdfc(_0xca3caa);})[_0x8e0c('0x1c')](function(_0x117a75){logger[_0x8e0c('0x18')](_0x8e0c('0x29'),_0x117a75[_0x8e0c('0x1a')],_0x362cd4);_0x1a8d19(_0x4b9b1a[_0x8e0c('0x18')](0x1f4,_0x117a75[_0x8e0c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8240a87..3de8acf 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 _0x4b66=['remove','update','whatsappQueue:','./whatsappQueue.events'];(function(_0x395d51,_0x59358c){var _0xdf8077=function(_0x19a1c7){while(--_0x19a1c7){_0x395d51['push'](_0x395d51['shift']());}};_0xdf8077(++_0x59358c);}(_0x4b66,0x14b));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';var WhatsappQueueEvents=require(_0x64b6('0x0'));var events=['save',_0x64b6('0x1'),_0x64b6('0x2')];function createListener(_0x175820,_0x498ef5){return function(_0x45ebb7){_0x498ef5['emit'](_0x175820,_0x45ebb7);};}function removeListener(_0x4f5fb1,_0x5477ca){return function(){WhatsappQueueEvents['removeListener'](_0x4f5fb1,_0x5477ca);};}exports['register']=function(_0x15c422){for(var _0x4af699=0x0,_0x1857f1=events['length'];_0x4af699<_0x1857f1;_0x4af699++){var _0x5296ad=events[_0x4af699];var _0x4ebe01=createListener(_0x64b6('0x3')+_0x5296ad,_0x15c422);WhatsappQueueEvents['on'](_0x5296ad,_0x4ebe01);}}; \ No newline at end of file +var _0x8cb7=['save','remove','update','emit','removeListener','./whatsappQueue.events'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x8cb7,0x6b));var _0x78cb=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x8cb7[_0x47e7cb];return _0x2a8874;};'use strict';var WhatsappQueueEvents=require(_0x78cb('0x0'));var events=[_0x78cb('0x1'),_0x78cb('0x2'),_0x78cb('0x3')];function createListener(_0x19acc9,_0x21a912){return function(_0x3fa5da){_0x21a912[_0x78cb('0x4')](_0x19acc9,_0x3fa5da);};}function removeListener(_0x10472d,_0x59ee56){return function(){WhatsappQueueEvents[_0x78cb('0x5')](_0x10472d,_0x59ee56);};}exports['register']=function(_0x2859d5){for(var _0x2dcbec=0x0,_0x351c9e=events['length'];_0x2dcbec<_0x351c9e;_0x2dcbec++){var _0x268afc=events[_0x2dcbec];var _0x2080ed=createListener('whatsappQueue:'+_0x268afc,_0x2859d5);WhatsappQueueEvents['on'](_0x268afc,_0x2080ed);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 12df9bc..406dc60 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 _0x57a6=['./whatsappQueueReport.controller','isAuthenticated','get','/describe','/:id','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x53839a,_0x4a46bb){var _0x5bc0ab=function(_0x244cca){while(--_0x244cca){_0x53839a['push'](_0x53839a['shift']());}};_0x5bc0ab(++_0x4a46bb);}(_0x57a6,0x1bb));var _0x657a=function(_0x53058f,_0x28b9e8){_0x53058f=_0x53058f-0x0;var _0x14cf21=_0x57a6[_0x53058f];return _0x14cf21;};'use strict';var multer=require('multer');var util=require(_0x657a('0x0'));var path=require('path');var timeout=require(_0x657a('0x1'));var express=require(_0x657a('0x2'));var router=express[_0x657a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x657a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x657a('0x5'));router['get']('/',auth[_0x657a('0x6')](),controller['index']);router[_0x657a('0x7')](_0x657a('0x8'),auth[_0x657a('0x6')](),controller['describe']);router[_0x657a('0x7')](_0x657a('0x9'),auth[_0x657a('0x6')](),controller['show']);router[_0x657a('0xa')]('/',auth[_0x657a('0x6')](),controller[_0x657a('0xb')]);router[_0x657a('0xc')](_0x657a('0x9'),auth[_0x657a('0x6')](),controller['update']);router[_0x657a('0xd')]('/:id',auth[_0x657a('0x6')](),controller[_0x657a('0xe')]);module[_0x657a('0xf')]=router; \ No newline at end of file +var _0x1ea0=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x1683a5,_0x133f86){var _0x1d6cf9=function(_0x1be959){while(--_0x1be959){_0x1683a5['push'](_0x1683a5['shift']());}};_0x1d6cf9(++_0x133f86);}(_0x1ea0,0x14d));var _0x01ea=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1ea0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var path=require(_0x01ea('0x2'));var timeout=require(_0x01ea('0x3'));var express=require(_0x01ea('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x01ea('0x5'));var config=require(_0x01ea('0x6'));var controller=require(_0x01ea('0x7'));router[_0x01ea('0x8')]('/',auth[_0x01ea('0x9')](),controller[_0x01ea('0xa')]);router['get'](_0x01ea('0xb'),auth[_0x01ea('0x9')](),controller[_0x01ea('0xc')]);router['get']('/:id',auth[_0x01ea('0x9')](),controller[_0x01ea('0xd')]);router['post']('/',auth[_0x01ea('0x9')](),controller[_0x01ea('0xe')]);router[_0x01ea('0xf')](_0x01ea('0x10'),auth['isAuthenticated'](),controller[_0x01ea('0x11')]);router['delete'](_0x01ea('0x10'),auth['isAuthenticated'](),controller[_0x01ea('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 8f88f65..f678835 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(_0x59e0fc,_0x3311d5){var _0x35c15a=function(_0x46889d){while(--_0x46889d){_0x59e0fc['push'](_0x59e0fc['shift']());}};_0x35c15a(++_0x3311d5);}(_0x7a54,0x106));var _0x47a5=function(_0x51fb5f,_0x60513d){_0x51fb5f=_0x51fb5f-0x0;var _0x2fa1c7=_0x7a54[_0x51fb5f];return _0x2fa1c7;};'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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x55f701,_0x417af8){var _0x4b44ac=function(_0x3404af){while(--_0x3404af){_0x55f701['push'](_0x55f701['shift']());}};_0x4b44ac(++_0x417af8);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 8cc88fe..ea9fe97 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 _0x97c1=['describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappQueueReport','includeAll','include','rows','catch','params','find','create','body'];(function(_0x133aeb,_0x267120){var _0x2733f5=function(_0x41644d){while(--_0x41644d){_0x133aeb['push'](_0x133aeb['shift']());}};_0x2733f5(++_0x267120);}(_0x97c1,0xdf));var _0x197c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x97c1[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x2911dd,_0x2b6319){return function(_0x499051){if(!_0x499051){_0x2911dd[_0x197c('0x26')](0x194);}return _0x499051;};}function handleError(_0x3331ac,_0x4c3337){_0x4c3337=_0x4c3337||0x1f4;return function(_0x5e7bc9){logger[_0x197c('0x27')](_0x5e7bc9['stack']);if(_0x5e7bc9[_0x197c('0x28')]){delete _0x5e7bc9[_0x197c('0x28')];}_0x3331ac[_0x197c('0x17')](_0x4c3337)[_0x197c('0x29')](_0x5e7bc9);};}exports[_0x197c('0x2a')]=function(_0x3cdcd8,_0x2b6154){var _0x215df1={},_0x4422d1={},_0x5df39e={'count':0x0,'rows':[]};var _0x50dea3=_['map'](db['WhatsappQueueReport'][_0x197c('0x2b')],function(_0x4c9256){return{'name':_0x4c9256[_0x197c('0x2c')],'type':_0x4c9256[_0x197c('0x2d')]['key']};});_0x4422d1[_0x197c('0x2e')]=_['map'](_0x50dea3,_0x197c('0x28'));_0x4422d1[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x3cdcd8[_0x197c('0x2f')]);_0x4422d1[_0x197c('0x31')]=_[_0x197c('0x32')](_0x4422d1[_0x197c('0x2e')],_0x4422d1[_0x197c('0x2f')]);_0x215df1[_0x197c('0x33')]=_['intersection'](_0x4422d1['model'],qs[_0x197c('0x34')](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x34')]));_0x215df1[_0x197c('0x33')]=_0x215df1[_0x197c('0x33')][_0x197c('0x35')]?_0x215df1[_0x197c('0x33')]:_0x4422d1['model'];if(!_0x3cdcd8['query'][_0x197c('0x36')](_0x197c('0x37'))){_0x215df1['limit']=qs['limit'](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x1b')]);_0x215df1[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x19')]);}_0x215df1[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x3cdcd8[_0x197c('0x2f')]['sort']);_0x215df1[_0x197c('0x3a')]=qs[_0x197c('0x31')](_[_0x197c('0x3b')](_0x3cdcd8[_0x197c('0x2f')],_0x4422d1[_0x197c('0x31')]),_0x50dea3);if(_0x3cdcd8[_0x197c('0x2f')]['filter']){_0x215df1[_0x197c('0x3a')]=_[_0x197c('0x3c')](_0x215df1[_0x197c('0x3a')],{'$or':_['map'](_0x50dea3,function(_0x28ce19){if(_0x28ce19[_0x197c('0x2d')]!==_0x197c('0x3d')){var _0xdb64da={};_0xdb64da[_0x28ce19[_0x197c('0x28')]]={'$like':'%'+_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x3e')]+'%'};return _0xdb64da;}})});}_0x215df1=_[_0x197c('0x3c')]({},_0x215df1,_0x3cdcd8[_0x197c('0x3f')]);var _0x1dc01b={'where':_0x215df1['where']};return db[_0x197c('0x40')][_0x197c('0x1c')](_0x1dc01b)['then'](function(_0x4c715a){_0x5df39e[_0x197c('0x1c')]=_0x4c715a;if(_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x41')]){_0x215df1[_0x197c('0x42')]=[{'all':!![]}];}return db[_0x197c('0x40')]['findAll'](_0x215df1);})[_0x197c('0x24')](function(_0x3efae){_0x5df39e[_0x197c('0x43')]=_0x3efae;return _0x5df39e;})[_0x197c('0x24')](respondWithFilteredResult(_0x2b6154,_0x215df1))[_0x197c('0x44')](handleError(_0x2b6154,null));};exports['show']=function(_0x3e21bd,_0x37bb94){var _0x6d7bda={'raw':!![],'where':{'id':_0x3e21bd[_0x197c('0x45')]['id']}},_0x197b27={};_0x197b27['model']=_[_0x197c('0x30')](db[_0x197c('0x40')][_0x197c('0x2b')]);_0x197b27[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x3e21bd[_0x197c('0x2f')]);_0x197b27[_0x197c('0x31')]=_[_0x197c('0x32')](_0x197b27[_0x197c('0x2e')],_0x197b27[_0x197c('0x2f')]);_0x6d7bda[_0x197c('0x33')]=_['intersection'](_0x197b27['model'],qs['fields'](_0x3e21bd['query'][_0x197c('0x34')]));_0x6d7bda[_0x197c('0x33')]=_0x6d7bda['attributes'][_0x197c('0x35')]?_0x6d7bda[_0x197c('0x33')]:_0x197b27['model'];if(_0x3e21bd[_0x197c('0x2f')][_0x197c('0x41')]){_0x6d7bda['include']=[{'all':!![]}];}_0x6d7bda=_[_0x197c('0x3c')]({},_0x6d7bda,_0x3e21bd[_0x197c('0x3f')]);return db['WhatsappQueueReport'][_0x197c('0x46')](_0x6d7bda)[_0x197c('0x24')](handleEntityNotFound(_0x37bb94,null))[_0x197c('0x24')](respondWithResult(_0x37bb94,null))['catch'](handleError(_0x37bb94,null));};exports[_0x197c('0x47')]=function(_0x3f26df,_0x220909){return db[_0x197c('0x40')]['create'](_0x3f26df[_0x197c('0x48')],{})[_0x197c('0x24')](respondWithResult(_0x220909,0xc9))[_0x197c('0x44')](handleError(_0x220909,null));};exports['update']=function(_0x5994bf,_0x3a5089){if(_0x5994bf[_0x197c('0x48')]['id']){delete _0x5994bf[_0x197c('0x48')]['id'];}return db[_0x197c('0x40')][_0x197c('0x46')]({'where':{'id':_0x5994bf[_0x197c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a5089,null))[_0x197c('0x24')](saveUpdates(_0x5994bf['body'],null))[_0x197c('0x24')](respondWithResult(_0x3a5089,null))[_0x197c('0x44')](handleError(_0x3a5089,null));};exports[_0x197c('0x25')]=function(_0x9e8c6a,_0x34a211){return db[_0x197c('0x40')][_0x197c('0x46')]({'where':{'id':_0x9e8c6a[_0x197c('0x45')]['id']}})['then'](handleEntityNotFound(_0x34a211,null))[_0x197c('0x24')](removeEntity(_0x34a211,null))[_0x197c('0x44')](handleError(_0x34a211,null));};exports[_0x197c('0x49')]=function(_0x4b0048,_0x114ef5){return db['WhatsappQueueReport'][_0x197c('0x49')]()[_0x197c('0x24')](respondWithResult(_0x114ef5,null))[_0x197c('0x44')](handleError(_0x114ef5,null));}; \ No newline at end of file +var _0x4213=['limit','count','offset','set','json','reject','save','update','then','error','stack','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','WhatsappQueueReport','findAll','rows','catch','show','params','length','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x4b7dfd,_0x4775e4){var _0x4b2305=function(_0x4b7f93){while(--_0x4b7f93){_0x4b7dfd['push'](_0x4b7dfd['shift']());}};_0x4b2305(++_0x4775e4);}(_0x4213,0x77));var _0x3421=function(_0x4dbbd5,_0x26a209){_0x4dbbd5=_0x4dbbd5-0x0;var _0x538c59=_0x4213[_0x4dbbd5];return _0x538c59;};'use strict';var emlformat=require(_0x3421('0x0'));var rimraf=require(_0x3421('0x1'));var zipdir=require(_0x3421('0x2'));var jsonpatch=require(_0x3421('0x3'));var rp=require(_0x3421('0x4'));var moment=require(_0x3421('0x5'));var BPromise=require(_0x3421('0x6'));var Mustache=require('mustache');var util=require(_0x3421('0x7'));var path=require('path');var sox=require(_0x3421('0x8'));var csv=require(_0x3421('0x9'));var ejs=require(_0x3421('0xa'));var fs=require('fs');var fs_extra=require(_0x3421('0xb'));var _=require('lodash');var squel=require(_0x3421('0xc'));var crypto=require(_0x3421('0xd'));var jsforce=require(_0x3421('0xe'));var deskjs=require(_0x3421('0xf'));var toCsv=require(_0x3421('0x9'));var querystring=require('querystring');var Papa=require(_0x3421('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3421('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3421('0x12'));var logger=require(_0x3421('0x13'))(_0x3421('0x14'));var utils=require(_0x3421('0x15'));var config=require(_0x3421('0x16'));var licenseUtil=require(_0x3421('0x17'));var db=require(_0x3421('0x18'))['db'];function respondWithStatusCode(_0x59eaf1,_0x26d459){_0x26d459=_0x26d459||0xcc;return function(_0x3e2ecd){if(_0x3e2ecd){return _0x59eaf1[_0x3421('0x19')](_0x26d459);}return _0x59eaf1[_0x3421('0x1a')](_0x26d459)[_0x3421('0x1b')]();};}function respondWithResult(_0x3f4672,_0x25ffd4){_0x25ffd4=_0x25ffd4||0xc8;return function(_0x59ea4a){if(_0x59ea4a){return _0x3f4672[_0x3421('0x1a')](_0x25ffd4)['json'](_0x59ea4a);}};}function respondWithFilteredResult(_0x372d21,_0x5257ad){return function(_0x59ae45){if(_0x59ae45){var _0x1e33ab=typeof _0x5257ad['offset']===_0x3421('0x1c')&&typeof _0x5257ad[_0x3421('0x1d')]==='undefined';var _0x3584d6=_0x59ae45[_0x3421('0x1e')];var _0x130d3c=_0x1e33ab?0x0:_0x5257ad[_0x3421('0x1f')];var _0x18acc1=_0x1e33ab?_0x59ae45[_0x3421('0x1e')]:_0x5257ad[_0x3421('0x1f')]+_0x5257ad[_0x3421('0x1d')];var _0x197b83;if(_0x18acc1>=_0x3584d6){_0x18acc1=_0x3584d6;_0x197b83=0xc8;}else{_0x197b83=0xce;}_0x372d21[_0x3421('0x1a')](_0x197b83);return _0x372d21[_0x3421('0x20')]('Content-Range',_0x130d3c+'-'+_0x18acc1+'/'+_0x3584d6)[_0x3421('0x21')](_0x59ae45);}return null;};}function patchUpdates(_0x4b59a5){return function(_0x5820f6){try{jsonpatch['apply'](_0x5820f6,_0x4b59a5,!![]);}catch(_0x33155b){return BPromise[_0x3421('0x22')](_0x33155b);}return _0x5820f6[_0x3421('0x23')]();};}function saveUpdates(_0x256cc5,_0x132e8e){return function(_0x39bed4){if(_0x39bed4){return _0x39bed4[_0x3421('0x24')](_0x256cc5)[_0x3421('0x25')](function(_0xb9af5f){return _0xb9af5f;});}return null;};}function removeEntity(_0x34389e,_0x48fb3d){return function(_0x57a4af){if(_0x57a4af){return _0x57a4af['destroy']()[_0x3421('0x25')](function(){_0x34389e[_0x3421('0x1a')](0xcc)[_0x3421('0x1b')]();});}};}function handleEntityNotFound(_0x5bc28a,_0x506af4){return function(_0x1b65d0){if(!_0x1b65d0){_0x5bc28a['sendStatus'](0x194);}return _0x1b65d0;};}function handleError(_0x2bf001,_0x487944){_0x487944=_0x487944||0x1f4;return function(_0x15e73c){logger[_0x3421('0x26')](_0x15e73c[_0x3421('0x27')]);if(_0x15e73c[_0x3421('0x28')]){delete _0x15e73c[_0x3421('0x28')];}_0x2bf001['status'](_0x487944)[_0x3421('0x29')](_0x15e73c);};}exports['index']=function(_0x5efe73,_0x17f501){var _0x5aa96b={},_0x5074a2={},_0xb4eaf4={'count':0x0,'rows':[]};var _0x4ee4aa=_[_0x3421('0x2a')](db['WhatsappQueueReport'][_0x3421('0x2b')],function(_0xbe9f09){return{'name':_0xbe9f09['fieldName'],'type':_0xbe9f09[_0x3421('0x2c')][_0x3421('0x2d')]};});_0x5074a2[_0x3421('0x2e')]=_['map'](_0x4ee4aa,_0x3421('0x28'));_0x5074a2['query']=_[_0x3421('0x2f')](_0x5efe73[_0x3421('0x30')]);_0x5074a2[_0x3421('0x31')]=_[_0x3421('0x32')](_0x5074a2[_0x3421('0x2e')],_0x5074a2[_0x3421('0x30')]);_0x5aa96b[_0x3421('0x33')]=_[_0x3421('0x32')](_0x5074a2[_0x3421('0x2e')],qs[_0x3421('0x34')](_0x5efe73['query']['fields']));_0x5aa96b[_0x3421('0x33')]=_0x5aa96b[_0x3421('0x33')]['length']?_0x5aa96b[_0x3421('0x33')]:_0x5074a2[_0x3421('0x2e')];if(!_0x5efe73[_0x3421('0x30')][_0x3421('0x35')](_0x3421('0x36'))){_0x5aa96b['limit']=qs[_0x3421('0x1d')](_0x5efe73[_0x3421('0x30')][_0x3421('0x1d')]);_0x5aa96b['offset']=qs[_0x3421('0x1f')](_0x5efe73['query'][_0x3421('0x1f')]);}_0x5aa96b[_0x3421('0x37')]=qs[_0x3421('0x38')](_0x5efe73[_0x3421('0x30')][_0x3421('0x38')]);_0x5aa96b[_0x3421('0x39')]=qs[_0x3421('0x31')](_['pick'](_0x5efe73['query'],_0x5074a2['filters']),_0x4ee4aa);if(_0x5efe73[_0x3421('0x30')]['filter']){_0x5aa96b['where']=_[_0x3421('0x3a')](_0x5aa96b['where'],{'$or':_[_0x3421('0x2a')](_0x4ee4aa,function(_0x9b983f){if(_0x9b983f['type']!==_0x3421('0x3b')){var _0x3121aa={};_0x3121aa[_0x9b983f[_0x3421('0x28')]]={'$like':'%'+_0x5efe73[_0x3421('0x30')]['filter']+'%'};return _0x3121aa;}})});}_0x5aa96b=_[_0x3421('0x3a')]({},_0x5aa96b,_0x5efe73[_0x3421('0x3c')]);var _0x267e0b={'where':_0x5aa96b[_0x3421('0x39')]};return db[_0x3421('0x3d')]['count'](_0x267e0b)[_0x3421('0x25')](function(_0x454859){_0xb4eaf4['count']=_0x454859;if(_0x5efe73[_0x3421('0x30')]['includeAll']){_0x5aa96b['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x3421('0x3e')](_0x5aa96b);})[_0x3421('0x25')](function(_0x41bdb7){_0xb4eaf4[_0x3421('0x3f')]=_0x41bdb7;return _0xb4eaf4;})[_0x3421('0x25')](respondWithFilteredResult(_0x17f501,_0x5aa96b))[_0x3421('0x40')](handleError(_0x17f501,null));};exports[_0x3421('0x41')]=function(_0x4e3f1e,_0x33198f){var _0x14e30c={'raw':!![],'where':{'id':_0x4e3f1e[_0x3421('0x42')]['id']}},_0x3b9d15={};_0x3b9d15[_0x3421('0x2e')]=_[_0x3421('0x2f')](db['WhatsappQueueReport'][_0x3421('0x2b')]);_0x3b9d15[_0x3421('0x30')]=_[_0x3421('0x2f')](_0x4e3f1e[_0x3421('0x30')]);_0x3b9d15['filters']=_[_0x3421('0x32')](_0x3b9d15['model'],_0x3b9d15[_0x3421('0x30')]);_0x14e30c[_0x3421('0x33')]=_[_0x3421('0x32')](_0x3b9d15[_0x3421('0x2e')],qs[_0x3421('0x34')](_0x4e3f1e[_0x3421('0x30')][_0x3421('0x34')]));_0x14e30c[_0x3421('0x33')]=_0x14e30c[_0x3421('0x33')][_0x3421('0x43')]?_0x14e30c[_0x3421('0x33')]:_0x3b9d15[_0x3421('0x2e')];if(_0x4e3f1e[_0x3421('0x30')]['includeAll']){_0x14e30c[_0x3421('0x44')]=[{'all':!![]}];}_0x14e30c=_['merge']({},_0x14e30c,_0x4e3f1e[_0x3421('0x3c')]);return db[_0x3421('0x3d')][_0x3421('0x45')](_0x14e30c)[_0x3421('0x25')](handleEntityNotFound(_0x33198f,null))[_0x3421('0x25')](respondWithResult(_0x33198f,null))[_0x3421('0x40')](handleError(_0x33198f,null));};exports[_0x3421('0x46')]=function(_0x44bf06,_0x406ea9){return db[_0x3421('0x3d')]['create'](_0x44bf06[_0x3421('0x47')],{})[_0x3421('0x25')](respondWithResult(_0x406ea9,0xc9))[_0x3421('0x40')](handleError(_0x406ea9,null));};exports['update']=function(_0x566f95,_0x43a94f){if(_0x566f95[_0x3421('0x47')]['id']){delete _0x566f95[_0x3421('0x47')]['id'];}return db['WhatsappQueueReport'][_0x3421('0x45')]({'where':{'id':_0x566f95[_0x3421('0x42')]['id']}})[_0x3421('0x25')](handleEntityNotFound(_0x43a94f,null))[_0x3421('0x25')](saveUpdates(_0x566f95['body'],null))[_0x3421('0x25')](respondWithResult(_0x43a94f,null))[_0x3421('0x40')](handleError(_0x43a94f,null));};exports[_0x3421('0x48')]=function(_0x51a21f,_0x496000){return db['WhatsappQueueReport'][_0x3421('0x45')]({'where':{'id':_0x51a21f[_0x3421('0x42')]['id']}})['then'](handleEntityNotFound(_0x496000,null))['then'](removeEntity(_0x496000,null))[_0x3421('0x40')](handleError(_0x496000,null));};exports[_0x3421('0x49')]=function(_0x46b7b7,_0x25b0d8){return db[_0x3421('0x3d')]['describe']()[_0x3421('0x25')](respondWithResult(_0x25b0d8,null))[_0x3421('0x40')](handleError(_0x25b0d8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 06d3d42..a7f9ed9 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 _0x3b53=['util','../../config/logger','request-promise','rimraf','../../config/environment','exports','define','WhatsappQueueReport','uniqueid','lodash'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x3b53,0x95));var _0x33b5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3b53[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x33b5('0x0'));var util=require(_0x33b5('0x1'));var logger=require(_0x33b5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x33b5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33b5('0x4'));var config=require(_0x33b5('0x5'));var attributes=require('./whatsappQueueReport.attributes');module[_0x33b5('0x6')]=function(_0xc0d2f2,_0x151b8d){return _0xc0d2f2[_0x33b5('0x7')](_0x33b5('0x8'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x33b5('0x9'),'fields':[_0x33b5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3ef=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','uniqueid'];(function(_0x3aded6,_0x6d9082){var _0x41cf82=function(_0x20a993){while(--_0x20a993){_0x3aded6['push'](_0x3aded6['shift']());}};_0x41cf82(++_0x6d9082);}(_0xd3ef,0xe7));var _0xfd3e=function(_0x360f8f,_0x50967f){_0x360f8f=_0x360f8f-0x0;var _0x22278e=_0xd3ef[_0x360f8f];return _0x22278e;};'use strict';var _=require(_0xfd3e('0x0'));var util=require(_0xfd3e('0x1'));var logger=require(_0xfd3e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfd3e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd3e('0x4'));var rimraf=require(_0xfd3e('0x5'));var config=require(_0xfd3e('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0xfd3e('0x7')]=function(_0x1c7c56,_0x19043a){return _0x1c7c56[_0xfd3e('0x8')](_0xfd3e('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xfd3e('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 60a047a..a38ee68 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 _0xbba0=['options','raw','catch','UpdateWhatsappQueueReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','body'];(function(_0xd72c4c,_0x138e87){var _0x4e33ca=function(_0x2abc3f){while(--_0x2abc3f){_0xd72c4c['push'](_0xd72c4c['shift']());}};_0x4e33ca(++_0x138e87);}(_0xbba0,0x6d));var _0x0bba=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xbba0[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0x0bba('0x0'));var moment=require(_0x0bba('0x1'));var BPromise=require(_0x0bba('0x2'));var rs=require(_0x0bba('0x3'));var fs=require('fs');var Redis=require(_0x0bba('0x4'));var db=require(_0x0bba('0x5'))['db'];var utils=require(_0x0bba('0x6'));var logger=require(_0x0bba('0x7'))(_0x0bba('0x8'));var config=require(_0x0bba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0bba('0xa')][_0x0bba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16d850,_0x1e3d01,_0x470b3f){return new BPromise(function(_0x12198b,_0x2f0192){return client[_0x0bba('0xc')](_0x16d850,_0x470b3f)[_0x0bba('0xd')](function(_0x5efc67){logger[_0x0bba('0xe')](_0x0bba('0xf'),_0x1e3d01,_0x0bba('0x10'));logger[_0x0bba('0x11')](_0x0bba('0x12'),_0x1e3d01,_0x0bba('0x10'),JSON[_0x0bba('0x13')](_0x5efc67));if(_0x5efc67[_0x0bba('0x14')]){if(_0x5efc67[_0x0bba('0x14')][_0x0bba('0x15')]===0x1f4){logger[_0x0bba('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1e3d01,_0x5efc67[_0x0bba('0x14')][_0x0bba('0x16')]);return _0x2f0192(_0x5efc67['error'][_0x0bba('0x16')]);}logger[_0x0bba('0x14')](_0x0bba('0xf'),_0x1e3d01,_0x5efc67[_0x0bba('0x14')][_0x0bba('0x16')]);return _0x12198b(_0x5efc67[_0x0bba('0x14')][_0x0bba('0x16')]);}else{logger[_0x0bba('0xe')](_0x0bba('0xf'),_0x1e3d01,'request\x20sent');_0x12198b(_0x5efc67[_0x0bba('0x17')][_0x0bba('0x16')]);}})['catch'](function(_0x12ca89){logger[_0x0bba('0x14')](_0x0bba('0xf'),_0x1e3d01,_0x12ca89);_0x2f0192(_0x12ca89);});});}exports[_0x0bba('0x18')]=function(_0x19c477){var _0x17263d=this;return new Promise(function(_0x147215,_0x628c54){return db[_0x0bba('0x19')]['create'](_0x19c477[_0x0bba('0x1a')],{'raw':_0x19c477[_0x0bba('0x1b')]?_0x19c477[_0x0bba('0x1b')][_0x0bba('0x1c')]===undefined?!![]:![]:!![]})[_0x0bba('0xd')](function(_0x1d29a2){logger[_0x0bba('0xe')](_0x0bba('0x18'),_0x19c477);logger[_0x0bba('0x11')](_0x0bba('0x18'),_0x19c477,JSON[_0x0bba('0x13')](_0x1d29a2));_0x147215(_0x1d29a2);})[_0x0bba('0x1d')](function(_0x31f80a){logger['error'](_0x0bba('0x18'),_0x31f80a[_0x0bba('0x16')],_0x19c477);_0x628c54(_0x17263d[_0x0bba('0x14')](0x1f4,_0x31f80a[_0x0bba('0x16')]));});});};exports[_0x0bba('0x1e')]=function(_0x562940){var _0x5075e5=this;return new Promise(function(_0x540854,_0x5611e4){return db[_0x0bba('0x19')][_0x0bba('0x1f')](_0x562940[_0x0bba('0x1a')],{'raw':_0x562940[_0x0bba('0x1b')]?_0x562940[_0x0bba('0x1b')][_0x0bba('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562940['options']?_0x562940[_0x0bba('0x1b')][_0x0bba('0x20')]||null:null,'attributes':_0x562940[_0x0bba('0x1b')]?_0x562940[_0x0bba('0x1b')]['attributes']||null:null,'limit':_0x562940[_0x0bba('0x1b')]?_0x562940['options'][_0x0bba('0x21')]||null:null})['then'](function(_0x491afb){logger['info']('UpdateWhatsappQueueReport',_0x562940);logger[_0x0bba('0x11')]('UpdateWhatsappQueueReport',_0x562940,JSON[_0x0bba('0x13')](_0x491afb));_0x540854(_0x491afb);})['catch'](function(_0x17f51e){logger['error'](_0x0bba('0x1e'),_0x17f51e['message'],_0x562940);_0x5611e4(_0x5075e5['error'](0x1f4,_0x17f51e[_0x0bba('0x16')]));});});}; \ No newline at end of file +var _0x12e5=['UpdateWhatsappQueueReport','raw','attributes','limit','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options'];(function(_0x3c6b74,_0x42f534){var _0x35a378=function(_0x42ba31){while(--_0x42ba31){_0x3c6b74['push'](_0x3c6b74['shift']());}};_0x35a378(++_0x42f534);}(_0x12e5,0xf5));var _0x512e=function(_0xf146a7,_0x3a253f){_0xf146a7=_0xf146a7-0x0;var _0x4a0e14=_0x12e5[_0xf146a7];return _0x4a0e14;};'use strict';var _=require('lodash');var util=require(_0x512e('0x0'));var moment=require(_0x512e('0x1'));var BPromise=require(_0x512e('0x2'));var rs=require(_0x512e('0x3'));var fs=require('fs');var Redis=require(_0x512e('0x4'));var db=require(_0x512e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x512e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x512e('0x7'));var client=jayson['client'][_0x512e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38128c,_0x4cc54d,_0x3b8b38){return new BPromise(function(_0xaed733,_0x41ec69){return client[_0x512e('0x9')](_0x38128c,_0x3b8b38)[_0x512e('0xa')](function(_0x3616c5){logger[_0x512e('0xb')](_0x512e('0xc'),_0x4cc54d,_0x512e('0xd'));logger[_0x512e('0xe')](_0x512e('0xf'),_0x4cc54d,_0x512e('0xd'),JSON['stringify'](_0x3616c5));if(_0x3616c5[_0x512e('0x10')]){if(_0x3616c5[_0x512e('0x10')]['code']===0x1f4){logger[_0x512e('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4cc54d,_0x3616c5[_0x512e('0x10')][_0x512e('0x11')]);return _0x41ec69(_0x3616c5[_0x512e('0x10')]['message']);}logger[_0x512e('0x10')](_0x512e('0xc'),_0x4cc54d,_0x3616c5[_0x512e('0x10')][_0x512e('0x11')]);return _0xaed733(_0x3616c5['error'][_0x512e('0x11')]);}else{logger[_0x512e('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4cc54d,'request\x20sent');_0xaed733(_0x3616c5[_0x512e('0x12')][_0x512e('0x11')]);}})[_0x512e('0x13')](function(_0x5da72b){logger[_0x512e('0x10')](_0x512e('0xc'),_0x4cc54d,_0x5da72b);_0x41ec69(_0x5da72b);});});}exports[_0x512e('0x14')]=function(_0x485422){var _0x4a7710=this;return new Promise(function(_0x167b91,_0x4492f0){return db[_0x512e('0x15')][_0x512e('0x16')](_0x485422[_0x512e('0x17')],{'raw':_0x485422[_0x512e('0x18')]?_0x485422[_0x512e('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x22cd7d){logger[_0x512e('0xb')]('CreateWhatsappQueueReport',_0x485422);logger[_0x512e('0xe')](_0x512e('0x14'),_0x485422,JSON['stringify'](_0x22cd7d));_0x167b91(_0x22cd7d);})[_0x512e('0x13')](function(_0x5a0306){logger[_0x512e('0x10')](_0x512e('0x14'),_0x5a0306[_0x512e('0x11')],_0x485422);_0x4492f0(_0x4a7710[_0x512e('0x10')](0x1f4,_0x5a0306['message']));});});};exports[_0x512e('0x19')]=function(_0x115e39){var _0x5b8783=this;return new Promise(function(_0xc5b470,_0x151fab){return db['WhatsappQueueReport']['update'](_0x115e39[_0x512e('0x17')],{'raw':_0x115e39['options']?_0x115e39[_0x512e('0x18')][_0x512e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x115e39['options']?_0x115e39[_0x512e('0x18')]['where']||null:null,'attributes':_0x115e39[_0x512e('0x18')]?_0x115e39[_0x512e('0x18')][_0x512e('0x1b')]||null:null,'limit':_0x115e39[_0x512e('0x18')]?_0x115e39[_0x512e('0x18')][_0x512e('0x1c')]||null:null})[_0x512e('0xa')](function(_0x3fb1ed){logger[_0x512e('0xb')]('UpdateWhatsappQueueReport',_0x115e39);logger[_0x512e('0xe')](_0x512e('0x19'),_0x115e39,JSON[_0x512e('0x1d')](_0x3fb1ed));_0xc5b470(_0x3fb1ed);})[_0x512e('0x13')](function(_0x1d9e2f){logger[_0x512e('0x10')]('UpdateWhatsappQueueReport',_0x1d9e2f['message'],_0x115e39);_0x151fab(_0x5b8783[_0x512e('0x10')](0x1f4,_0x1d9e2f[_0x512e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index df21c3b..33fb1fb 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 _0xe38a=['post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x900b1c,_0xf74d5d){var _0x1a0599=function(_0x8c7b92){while(--_0x8c7b92){_0x900b1c['push'](_0x900b1c['shift']());}};_0x1a0599(++_0xf74d5d);}(_0xe38a,0x1c7));var _0xae38=function(_0x58675f,_0x390355){_0x58675f=_0x58675f-0x0;var _0x1cc7f0=_0xe38a[_0x58675f];return _0x1cc7f0;};'use strict';var multer=require(_0xae38('0x0'));var util=require(_0xae38('0x1'));var path=require(_0xae38('0x2'));var timeout=require(_0xae38('0x3'));var express=require(_0xae38('0x4'));var router=express[_0xae38('0x5')]();var fs_extra=require(_0xae38('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0xae38('0x7')]('/',auth[_0xae38('0x8')](),controller['index']);router[_0xae38('0x7')](_0xae38('0x9'),auth['isAuthenticated'](),controller[_0xae38('0xa')]);router['get'](_0xae38('0xb'),auth[_0xae38('0x8')](),controller[_0xae38('0xc')]);router[_0xae38('0xd')]('/',auth[_0xae38('0x8')](),controller[_0xae38('0xe')]);router[_0xae38('0xf')](_0xae38('0xb'),auth[_0xae38('0x8')](),controller['update']);router[_0xae38('0x10')](_0xae38('0xb'),auth[_0xae38('0x8')](),controller[_0xae38('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1166=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x2b3478,_0x58afd7){var _0x1c106f=function(_0x4f12a1){while(--_0x4f12a1){_0x2b3478['push'](_0x2b3478['shift']());}};_0x1c106f(++_0x58afd7);}(_0x1166,0x112));var _0x6116=function(_0x2a10d7,_0x29db19){_0x2a10d7=_0x2a10d7-0x0;var _0x249341=_0x1166[_0x2a10d7];return _0x249341;};'use strict';var multer=require(_0x6116('0x0'));var util=require(_0x6116('0x1'));var path=require(_0x6116('0x2'));var timeout=require('connect-timeout');var express=require(_0x6116('0x3'));var router=express[_0x6116('0x4')]();var fs_extra=require(_0x6116('0x5'));var auth=require(_0x6116('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6116('0x7'));var controller=require(_0x6116('0x8'));router[_0x6116('0x9')]('/',auth[_0x6116('0xa')](),controller['index']);router[_0x6116('0x9')](_0x6116('0xb'),auth[_0x6116('0xa')](),controller[_0x6116('0xc')]);router[_0x6116('0x9')](_0x6116('0xd'),auth['isAuthenticated'](),controller[_0x6116('0xe')]);router[_0x6116('0xf')]('/',auth[_0x6116('0xa')](),controller['create']);router[_0x6116('0x10')](_0x6116('0xd'),auth['isAuthenticated'](),controller[_0x6116('0x11')]);router[_0x6116('0x12')]('/:id',auth[_0x6116('0xa')](),controller[_0x6116('0x13')]);module[_0x6116('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index cfee582..13228ee 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 _0x0e56=['exports','ENUM','account','queue','DATE','sequelize'];(function(_0x399412,_0x46ac86){var _0x39cf98=function(_0x165c62){while(--_0x165c62){_0x399412['push'](_0x399412['shift']());}};_0x39cf98(++_0x46ac86);}(_0x0e56,0xf5));var _0x60e5=function(_0x19a21c,_0x4e03f8){_0x19a21c=_0x19a21c-0x0;var _0x3e9b9f=_0x0e56[_0x19a21c];return _0x3e9b9f;};'use strict';var Sequelize=require(_0x60e5('0x0'));module[_0x60e5('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x60e5('0x2')](_0x60e5('0x3'),'agent',_0x60e5('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x60e5('0x5')]}}; \ No newline at end of file +var _0x2c91=['ENUM','account','agent','DATE','exports'];(function(_0x4300e4,_0x4abc7d){var _0x194975=function(_0x3335b4){while(--_0x3335b4){_0x4300e4['push'](_0x4300e4['shift']());}};_0x194975(++_0x4abc7d);}(_0x2c91,0xe0));var _0x12c9=function(_0x48131b,_0x388eb8){_0x48131b=_0x48131b-0x0;var _0x352ed1=_0x2c91[_0x48131b];return _0x352ed1;};'use strict';var Sequelize=require('sequelize');module[_0x12c9('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x12c9('0x1')](_0x12c9('0x2'),_0x12c9('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x12c9('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c235310..0408794 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 _0x2431=['end','json','undefined','count','offset','limit','Content-Range','apply','update','then','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xae9d8,_0x436617){var _0x29bbd1=function(_0x28742f){while(--_0x28742f){_0xae9d8['push'](_0xae9d8['shift']());}};_0x29bbd1(++_0x436617);}(_0x2431,0xc9));var _0x1243=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2431[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x1243('0x0'));var rimraf=require(_0x1243('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1243('0x2'));var rp=require(_0x1243('0x3'));var moment=require('moment');var BPromise=require(_0x1243('0x4'));var Mustache=require(_0x1243('0x5'));var util=require(_0x1243('0x6'));var path=require(_0x1243('0x7'));var sox=require(_0x1243('0x8'));var csv=require(_0x1243('0x9'));var ejs=require(_0x1243('0xa'));var fs=require('fs');var fs_extra=require(_0x1243('0xb'));var _=require(_0x1243('0xc'));var squel=require(_0x1243('0xd'));var crypto=require(_0x1243('0xe'));var jsforce=require(_0x1243('0xf'));var deskjs=require(_0x1243('0x10'));var toCsv=require(_0x1243('0x9'));var querystring=require('querystring');var Papa=require(_0x1243('0x11'));var Redis=require(_0x1243('0x12'));var authService=require(_0x1243('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1243('0x14'));var hardwareService=require(_0x1243('0x15'));var logger=require(_0x1243('0x16'))(_0x1243('0x17'));var utils=require(_0x1243('0x18'));var config=require(_0x1243('0x19'));var licenseUtil=require(_0x1243('0x1a'));var db=require(_0x1243('0x1b'))['db'];function respondWithStatusCode(_0x56077c,_0x10b354){_0x10b354=_0x10b354||0xcc;return function(_0x26e3c7){if(_0x26e3c7){return _0x56077c[_0x1243('0x1c')](_0x10b354);}return _0x56077c[_0x1243('0x1d')](_0x10b354)[_0x1243('0x1e')]();};}function respondWithResult(_0x1ccc17,_0x56557c){_0x56557c=_0x56557c||0xc8;return function(_0x159aa0){if(_0x159aa0){return _0x1ccc17[_0x1243('0x1d')](_0x56557c)[_0x1243('0x1f')](_0x159aa0);}};}function respondWithFilteredResult(_0xbae1ab,_0x1aa14e){return function(_0x3d8428){if(_0x3d8428){var _0x376a47=typeof _0x1aa14e['offset']===_0x1243('0x20')&&typeof _0x1aa14e['limit']===_0x1243('0x20');var _0x4dec1e=_0x3d8428[_0x1243('0x21')];var _0x3e346b=_0x376a47?0x0:_0x1aa14e[_0x1243('0x22')];var _0x507a01=_0x376a47?_0x3d8428[_0x1243('0x21')]:_0x1aa14e[_0x1243('0x22')]+_0x1aa14e[_0x1243('0x23')];var _0x301aef;if(_0x507a01>=_0x4dec1e){_0x507a01=_0x4dec1e;_0x301aef=0xc8;}else{_0x301aef=0xce;}_0xbae1ab['status'](_0x301aef);return _0xbae1ab['set'](_0x1243('0x24'),_0x3e346b+'-'+_0x507a01+'/'+_0x4dec1e)[_0x1243('0x1f')](_0x3d8428);}return null;};}function patchUpdates(_0x279556){return function(_0x3ccf8a){try{jsonpatch[_0x1243('0x25')](_0x3ccf8a,_0x279556,!![]);}catch(_0x4a2c34){return BPromise['reject'](_0x4a2c34);}return _0x3ccf8a['save']();};}function saveUpdates(_0x5f0828,_0x54d8cc){return function(_0x3037f7){if(_0x3037f7){return _0x3037f7[_0x1243('0x26')](_0x5f0828)[_0x1243('0x27')](function(_0x431807){return _0x431807;});}return null;};}function removeEntity(_0x46937a,_0x286a70){return function(_0x2094a4){if(_0x2094a4){return _0x2094a4['destroy']()['then'](function(){_0x46937a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf67c,_0x1fafbd){return function(_0x238b32){if(!_0x238b32){_0x1cf67c['sendStatus'](0x194);}return _0x238b32;};}function handleError(_0x4fa15d,_0x390b9c){_0x390b9c=_0x390b9c||0x1f4;return function(_0x4bd0bd){logger[_0x1243('0x28')](_0x4bd0bd[_0x1243('0x29')]);if(_0x4bd0bd[_0x1243('0x2a')]){delete _0x4bd0bd[_0x1243('0x2a')];}_0x4fa15d[_0x1243('0x1d')](_0x390b9c)[_0x1243('0x2b')](_0x4bd0bd);};}exports['index']=function(_0x1499a2,_0x28bb8b){var _0x341d55={},_0x36f424={},_0x25af0b={'count':0x0,'rows':[]};var _0x10bf99=_[_0x1243('0x2c')](db[_0x1243('0x2d')][_0x1243('0x2e')],function(_0x5b8035){return{'name':_0x5b8035[_0x1243('0x2f')],'type':_0x5b8035['type'][_0x1243('0x30')]};});_0x36f424[_0x1243('0x31')]=_[_0x1243('0x2c')](_0x10bf99,_0x1243('0x2a'));_0x36f424[_0x1243('0x32')]=_[_0x1243('0x33')](_0x1499a2[_0x1243('0x32')]);_0x36f424[_0x1243('0x34')]=_[_0x1243('0x35')](_0x36f424['model'],_0x36f424[_0x1243('0x32')]);_0x341d55['attributes']=_[_0x1243('0x35')](_0x36f424[_0x1243('0x31')],qs[_0x1243('0x36')](_0x1499a2[_0x1243('0x32')]['fields']));_0x341d55[_0x1243('0x37')]=_0x341d55[_0x1243('0x37')][_0x1243('0x38')]?_0x341d55[_0x1243('0x37')]:_0x36f424[_0x1243('0x31')];if(!_0x1499a2[_0x1243('0x32')][_0x1243('0x39')](_0x1243('0x3a'))){_0x341d55[_0x1243('0x23')]=qs['limit'](_0x1499a2[_0x1243('0x32')][_0x1243('0x23')]);_0x341d55['offset']=qs[_0x1243('0x22')](_0x1499a2[_0x1243('0x32')][_0x1243('0x22')]);}_0x341d55[_0x1243('0x3b')]=qs['sort'](_0x1499a2['query'][_0x1243('0x3c')]);_0x341d55['where']=qs[_0x1243('0x34')](_['pick'](_0x1499a2[_0x1243('0x32')],_0x36f424['filters']),_0x10bf99);if(_0x1499a2['query'][_0x1243('0x3d')]){_0x341d55['where']=_[_0x1243('0x3e')](_0x341d55[_0x1243('0x3f')],{'$or':_[_0x1243('0x2c')](_0x10bf99,function(_0x568bbd){if(_0x568bbd[_0x1243('0x40')]!==_0x1243('0x41')){var _0x14b6ab={};_0x14b6ab[_0x568bbd['name']]={'$like':'%'+_0x1499a2['query'][_0x1243('0x3d')]+'%'};return _0x14b6ab;}})});}_0x341d55=_[_0x1243('0x3e')]({},_0x341d55,_0x1499a2[_0x1243('0x42')]);var _0x1aad8a={'where':_0x341d55[_0x1243('0x3f')]};return db[_0x1243('0x2d')][_0x1243('0x21')](_0x1aad8a)[_0x1243('0x27')](function(_0x320643){_0x25af0b['count']=_0x320643;if(_0x1499a2[_0x1243('0x32')][_0x1243('0x43')]){_0x341d55[_0x1243('0x44')]=[{'all':!![]}];}return db[_0x1243('0x2d')]['findAll'](_0x341d55);})[_0x1243('0x27')](function(_0x3cdf34){_0x25af0b[_0x1243('0x45')]=_0x3cdf34;return _0x25af0b;})[_0x1243('0x27')](respondWithFilteredResult(_0x28bb8b,_0x341d55))[_0x1243('0x46')](handleError(_0x28bb8b,null));};exports['show']=function(_0x361cd8,_0x5c6c40){var _0x50b14b={'raw':!![],'where':{'id':_0x361cd8[_0x1243('0x47')]['id']}},_0x212fed={};_0x212fed[_0x1243('0x31')]=_[_0x1243('0x33')](db['WhatsappTransferReport'][_0x1243('0x2e')]);_0x212fed[_0x1243('0x32')]=_[_0x1243('0x33')](_0x361cd8[_0x1243('0x32')]);_0x212fed[_0x1243('0x34')]=_['intersection'](_0x212fed[_0x1243('0x31')],_0x212fed['query']);_0x50b14b[_0x1243('0x37')]=_[_0x1243('0x35')](_0x212fed['model'],qs[_0x1243('0x36')](_0x361cd8[_0x1243('0x32')][_0x1243('0x36')]));_0x50b14b['attributes']=_0x50b14b['attributes']['length']?_0x50b14b[_0x1243('0x37')]:_0x212fed[_0x1243('0x31')];if(_0x361cd8[_0x1243('0x32')]['includeAll']){_0x50b14b['include']=[{'all':!![]}];}_0x50b14b=_[_0x1243('0x3e')]({},_0x50b14b,_0x361cd8[_0x1243('0x42')]);return db[_0x1243('0x2d')]['find'](_0x50b14b)[_0x1243('0x27')](handleEntityNotFound(_0x5c6c40,null))[_0x1243('0x27')](respondWithResult(_0x5c6c40,null))[_0x1243('0x46')](handleError(_0x5c6c40,null));};exports[_0x1243('0x48')]=function(_0x5cbbea,_0x3ecea7){return db['WhatsappTransferReport'][_0x1243('0x48')](_0x5cbbea[_0x1243('0x49')],{})['then'](respondWithResult(_0x3ecea7,0xc9))[_0x1243('0x46')](handleError(_0x3ecea7,null));};exports[_0x1243('0x26')]=function(_0x16c282,_0x3aeb83){if(_0x16c282[_0x1243('0x49')]['id']){delete _0x16c282[_0x1243('0x49')]['id'];}return db['WhatsappTransferReport'][_0x1243('0x4a')]({'where':{'id':_0x16c282[_0x1243('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aeb83,null))[_0x1243('0x27')](saveUpdates(_0x16c282[_0x1243('0x49')],null))[_0x1243('0x27')](respondWithResult(_0x3aeb83,null))[_0x1243('0x46')](handleError(_0x3aeb83,null));};exports[_0x1243('0x4b')]=function(_0x5c063b,_0x2724d7){return db[_0x1243('0x2d')][_0x1243('0x4a')]({'where':{'id':_0x5c063b[_0x1243('0x47')]['id']}})[_0x1243('0x27')](handleEntityNotFound(_0x2724d7,null))[_0x1243('0x27')](removeEntity(_0x2724d7,null))[_0x1243('0x46')](handleError(_0x2724d7,null));};exports['describe']=function(_0x17fd23,_0x5a1682){return db[_0x1243('0x2d')][_0x1243('0x4c')]()[_0x1243('0x27')](respondWithResult(_0x5a1682,null))[_0x1243('0x46')](handleError(_0x5a1682,null));}; \ No newline at end of file +var _0x9421=['apply','update','then','destroy','error','stack','name','send','index','WhatsappTransferReport','type','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range'];(function(_0x970780,_0x270d67){var _0x10b4af=function(_0x213e8f){while(--_0x213e8f){_0x970780['push'](_0x970780['shift']());}};_0x10b4af(++_0x270d67);}(_0x9421,0x155));var _0x1942=function(_0x8ca047,_0x33e649){_0x8ca047=_0x8ca047-0x0;var _0x481725=_0x9421[_0x8ca047];return _0x481725;};'use strict';var emlformat=require(_0x1942('0x0'));var rimraf=require(_0x1942('0x1'));var zipdir=require(_0x1942('0x2'));var jsonpatch=require(_0x1942('0x3'));var rp=require(_0x1942('0x4'));var moment=require('moment');var BPromise=require(_0x1942('0x5'));var Mustache=require(_0x1942('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1942('0x7'));var csv=require(_0x1942('0x8'));var ejs=require(_0x1942('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1942('0xa'));var squel=require(_0x1942('0xb'));var crypto=require(_0x1942('0xc'));var jsforce=require(_0x1942('0xd'));var deskjs=require(_0x1942('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1942('0xf'));var Papa=require(_0x1942('0x10'));var Redis=require(_0x1942('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1942('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1942('0x13'))(_0x1942('0x14'));var utils=require(_0x1942('0x15'));var config=require(_0x1942('0x16'));var licenseUtil=require(_0x1942('0x17'));var db=require(_0x1942('0x18'))['db'];function respondWithStatusCode(_0x1c9eb8,_0x42b32b){_0x42b32b=_0x42b32b||0xcc;return function(_0x2ac936){if(_0x2ac936){return _0x1c9eb8[_0x1942('0x19')](_0x42b32b);}return _0x1c9eb8[_0x1942('0x1a')](_0x42b32b)[_0x1942('0x1b')]();};}function respondWithResult(_0x17f57f,_0x51d901){_0x51d901=_0x51d901||0xc8;return function(_0x58de7b){if(_0x58de7b){return _0x17f57f[_0x1942('0x1a')](_0x51d901)[_0x1942('0x1c')](_0x58de7b);}};}function respondWithFilteredResult(_0x16a716,_0x3a10b2){return function(_0x55d651){if(_0x55d651){var _0x37de56=typeof _0x3a10b2['offset']===_0x1942('0x1d')&&typeof _0x3a10b2[_0x1942('0x1e')]===_0x1942('0x1d');var _0x4755e0=_0x55d651['count'];var _0x6822fb=_0x37de56?0x0:_0x3a10b2[_0x1942('0x1f')];var _0x28f6be=_0x37de56?_0x55d651[_0x1942('0x20')]:_0x3a10b2[_0x1942('0x1f')]+_0x3a10b2[_0x1942('0x1e')];var _0x5a8a3e;if(_0x28f6be>=_0x4755e0){_0x28f6be=_0x4755e0;_0x5a8a3e=0xc8;}else{_0x5a8a3e=0xce;}_0x16a716['status'](_0x5a8a3e);return _0x16a716['set'](_0x1942('0x21'),_0x6822fb+'-'+_0x28f6be+'/'+_0x4755e0)['json'](_0x55d651);}return null;};}function patchUpdates(_0x5d0879){return function(_0x325b38){try{jsonpatch[_0x1942('0x22')](_0x325b38,_0x5d0879,!![]);}catch(_0x4be852){return BPromise['reject'](_0x4be852);}return _0x325b38['save']();};}function saveUpdates(_0xe37677,_0x1497d2){return function(_0x284326){if(_0x284326){return _0x284326[_0x1942('0x23')](_0xe37677)[_0x1942('0x24')](function(_0x2b2aaa){return _0x2b2aaa;});}return null;};}function removeEntity(_0x5d473e,_0x4323ad){return function(_0x5927b9){if(_0x5927b9){return _0x5927b9[_0x1942('0x25')]()['then'](function(){_0x5d473e[_0x1942('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f85aa,_0x5dda7e){return function(_0x3c91bd){if(!_0x3c91bd){_0x2f85aa[_0x1942('0x19')](0x194);}return _0x3c91bd;};}function handleError(_0x487405,_0x5a8889){_0x5a8889=_0x5a8889||0x1f4;return function(_0xe6ba2e){logger[_0x1942('0x26')](_0xe6ba2e[_0x1942('0x27')]);if(_0xe6ba2e[_0x1942('0x28')]){delete _0xe6ba2e[_0x1942('0x28')];}_0x487405['status'](_0x5a8889)[_0x1942('0x29')](_0xe6ba2e);};}exports[_0x1942('0x2a')]=function(_0x544c33,_0x934634){var _0x56441e={},_0x5af8ab={},_0x42670e={'count':0x0,'rows':[]};var _0x36032a=_['map'](db[_0x1942('0x2b')]['rawAttributes'],function(_0x959c6f){return{'name':_0x959c6f['fieldName'],'type':_0x959c6f[_0x1942('0x2c')]['key']};});_0x5af8ab['model']=_[_0x1942('0x2d')](_0x36032a,_0x1942('0x28'));_0x5af8ab[_0x1942('0x2e')]=_['keys'](_0x544c33[_0x1942('0x2e')]);_0x5af8ab[_0x1942('0x2f')]=_[_0x1942('0x30')](_0x5af8ab[_0x1942('0x31')],_0x5af8ab['query']);_0x56441e['attributes']=_['intersection'](_0x5af8ab[_0x1942('0x31')],qs[_0x1942('0x32')](_0x544c33[_0x1942('0x2e')][_0x1942('0x32')]));_0x56441e[_0x1942('0x33')]=_0x56441e[_0x1942('0x33')][_0x1942('0x34')]?_0x56441e[_0x1942('0x33')]:_0x5af8ab[_0x1942('0x31')];if(!_0x544c33[_0x1942('0x2e')]['hasOwnProperty'](_0x1942('0x35'))){_0x56441e[_0x1942('0x1e')]=qs['limit'](_0x544c33[_0x1942('0x2e')][_0x1942('0x1e')]);_0x56441e[_0x1942('0x1f')]=qs[_0x1942('0x1f')](_0x544c33[_0x1942('0x2e')][_0x1942('0x1f')]);}_0x56441e[_0x1942('0x36')]=qs[_0x1942('0x37')](_0x544c33[_0x1942('0x2e')][_0x1942('0x37')]);_0x56441e[_0x1942('0x38')]=qs[_0x1942('0x2f')](_[_0x1942('0x39')](_0x544c33[_0x1942('0x2e')],_0x5af8ab['filters']),_0x36032a);if(_0x544c33['query']['filter']){_0x56441e[_0x1942('0x38')]=_[_0x1942('0x3a')](_0x56441e[_0x1942('0x38')],{'$or':_[_0x1942('0x2d')](_0x36032a,function(_0x5eb2bb){if(_0x5eb2bb[_0x1942('0x2c')]!==_0x1942('0x3b')){var _0x272683={};_0x272683[_0x5eb2bb[_0x1942('0x28')]]={'$like':'%'+_0x544c33['query'][_0x1942('0x3c')]+'%'};return _0x272683;}})});}_0x56441e=_['merge']({},_0x56441e,_0x544c33[_0x1942('0x3d')]);var _0x3c229f={'where':_0x56441e[_0x1942('0x38')]};return db[_0x1942('0x2b')][_0x1942('0x20')](_0x3c229f)[_0x1942('0x24')](function(_0x1d6e94){_0x42670e[_0x1942('0x20')]=_0x1d6e94;if(_0x544c33[_0x1942('0x2e')][_0x1942('0x3e')]){_0x56441e[_0x1942('0x3f')]=[{'all':!![]}];}return db[_0x1942('0x2b')][_0x1942('0x40')](_0x56441e);})[_0x1942('0x24')](function(_0x46a49f){_0x42670e[_0x1942('0x41')]=_0x46a49f;return _0x42670e;})['then'](respondWithFilteredResult(_0x934634,_0x56441e))['catch'](handleError(_0x934634,null));};exports[_0x1942('0x42')]=function(_0xc5f625,_0x2d4e6b){var _0x7ba46c={'raw':!![],'where':{'id':_0xc5f625[_0x1942('0x43')]['id']}},_0x1e75c5={};_0x1e75c5[_0x1942('0x31')]=_[_0x1942('0x44')](db[_0x1942('0x2b')][_0x1942('0x45')]);_0x1e75c5['query']=_['keys'](_0xc5f625[_0x1942('0x2e')]);_0x1e75c5[_0x1942('0x2f')]=_[_0x1942('0x30')](_0x1e75c5[_0x1942('0x31')],_0x1e75c5['query']);_0x7ba46c[_0x1942('0x33')]=_[_0x1942('0x30')](_0x1e75c5['model'],qs[_0x1942('0x32')](_0xc5f625[_0x1942('0x2e')]['fields']));_0x7ba46c[_0x1942('0x33')]=_0x7ba46c[_0x1942('0x33')]['length']?_0x7ba46c[_0x1942('0x33')]:_0x1e75c5[_0x1942('0x31')];if(_0xc5f625[_0x1942('0x2e')]['includeAll']){_0x7ba46c[_0x1942('0x3f')]=[{'all':!![]}];}_0x7ba46c=_['merge']({},_0x7ba46c,_0xc5f625[_0x1942('0x3d')]);return db['WhatsappTransferReport']['find'](_0x7ba46c)[_0x1942('0x24')](handleEntityNotFound(_0x2d4e6b,null))[_0x1942('0x24')](respondWithResult(_0x2d4e6b,null))[_0x1942('0x46')](handleError(_0x2d4e6b,null));};exports[_0x1942('0x47')]=function(_0x3a108a,_0x2fe878){return db[_0x1942('0x2b')][_0x1942('0x47')](_0x3a108a['body'],{})[_0x1942('0x24')](respondWithResult(_0x2fe878,0xc9))[_0x1942('0x46')](handleError(_0x2fe878,null));};exports[_0x1942('0x23')]=function(_0x160dd6,_0x4ed385){if(_0x160dd6[_0x1942('0x48')]['id']){delete _0x160dd6[_0x1942('0x48')]['id'];}return db[_0x1942('0x2b')][_0x1942('0x49')]({'where':{'id':_0x160dd6[_0x1942('0x43')]['id']}})[_0x1942('0x24')](handleEntityNotFound(_0x4ed385,null))[_0x1942('0x24')](saveUpdates(_0x160dd6[_0x1942('0x48')],null))[_0x1942('0x24')](respondWithResult(_0x4ed385,null))['catch'](handleError(_0x4ed385,null));};exports[_0x1942('0x25')]=function(_0x705f5d,_0x9abc05){return db['WhatsappTransferReport'][_0x1942('0x49')]({'where':{'id':_0x705f5d[_0x1942('0x43')]['id']}})[_0x1942('0x24')](handleEntityNotFound(_0x9abc05,null))[_0x1942('0x24')](removeEntity(_0x9abc05,null))[_0x1942('0x46')](handleError(_0x9abc05,null));};exports[_0x1942('0x4a')]=function(_0x37a6b0,_0x273438){return db['WhatsappTransferReport'][_0x1942('0x4a')]()[_0x1942('0x24')](respondWithResult(_0x273438,null))[_0x1942('0x46')](handleError(_0x273438,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 1851cb7..1aa7330 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 _0x7623=['uniqueid','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x10fe88,_0x54b4a5){var _0x2f35fa=function(_0x356b49){while(--_0x356b49){_0x10fe88['push'](_0x10fe88['shift']());}};_0x2f35fa(++_0x54b4a5);}(_0x7623,0xc9));var _0x3762=function(_0x2aa733,_0xcde568){_0x2aa733=_0x2aa733-0x0;var _0x2bcf85=_0x7623[_0x2aa733];return _0x2bcf85;};'use strict';var _=require('lodash');var util=require(_0x3762('0x0'));var logger=require(_0x3762('0x1'))(_0x3762('0x2'));var moment=require('moment');var BPromise=require(_0x3762('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3762('0x4'));var rimraf=require(_0x3762('0x5'));var config=require(_0x3762('0x6'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x48e903,_0x1fe67d){return _0x48e903['define'](_0x3762('0x7'),attributes,{'tableName':_0x3762('0x8'),'paranoid':![],'indexes':[{'name':_0x3762('0x9'),'fields':[_0x3762('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2bb=['../../config/environment','./whatsappTransferReport.attributes','exports','define','uniqueid','lodash','api','request-promise','path','rimraf'];(function(_0x2fd3dd,_0x48c498){var _0x4eaa92=function(_0x125697){while(--_0x125697){_0x2fd3dd['push'](_0x2fd3dd['shift']());}};_0x4eaa92(++_0x48c498);}(_0xb2bb,0xc3));var _0xbb2b=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xb2bb[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xbb2b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbb2b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbb2b('0x2'));var fs=require('fs');var path=require(_0xbb2b('0x3'));var rimraf=require(_0xbb2b('0x4'));var config=require(_0xbb2b('0x5'));var attributes=require(_0xbb2b('0x6'));module[_0xbb2b('0x7')]=function(_0x39cdab,_0x4ca644){return _0x39cdab[_0xbb2b('0x8')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbb2b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 5ac837a..95cb13b 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 _0xb7ca=['WhatsappTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x52e7db,_0x4b6076){var _0x19eb31=function(_0x113eb5){while(--_0x113eb5){_0x52e7db['push'](_0x52e7db['shift']());}};_0x19eb31(++_0x4b6076);}(_0xb7ca,0x1d7));var _0xab7c=function(_0x4d5a29,_0x195e44){_0x4d5a29=_0x4d5a29-0x0;var _0x471e54=_0xb7ca[_0x4d5a29];return _0x471e54;};'use strict';var _=require(_0xab7c('0x0'));var util=require(_0xab7c('0x1'));var moment=require('moment');var BPromise=require(_0xab7c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab7c('0x3'));var logger=require(_0xab7c('0x4'))(_0xab7c('0x5'));var config=require(_0xab7c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xab7c('0x7')][_0xab7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ab101,_0x5dba36,_0x5a0737){return new BPromise(function(_0x172497,_0xd01df2){return client[_0xab7c('0x9')](_0x4ab101,_0x5a0737)['then'](function(_0x4fdcdb){logger[_0xab7c('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5dba36,_0xab7c('0xb'));logger['debug'](_0xab7c('0xc'),_0x5dba36,'request\x20sent',JSON['stringify'](_0x4fdcdb));if(_0x4fdcdb[_0xab7c('0xd')]){if(_0x4fdcdb[_0xab7c('0xd')][_0xab7c('0xe')]===0x1f4){logger['error'](_0xab7c('0xf'),_0x5dba36,_0x4fdcdb[_0xab7c('0xd')]['message']);return _0xd01df2(_0x4fdcdb[_0xab7c('0xd')][_0xab7c('0x10')]);}logger[_0xab7c('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5dba36,_0x4fdcdb[_0xab7c('0xd')][_0xab7c('0x10')]);return _0x172497(_0x4fdcdb[_0xab7c('0xd')][_0xab7c('0x10')]);}else{logger[_0xab7c('0xa')](_0xab7c('0xf'),_0x5dba36,_0xab7c('0xb'));_0x172497(_0x4fdcdb['result'][_0xab7c('0x10')]);}})[_0xab7c('0x11')](function(_0x521f65){logger['error'](_0xab7c('0xf'),_0x5dba36,_0x521f65);_0xd01df2(_0x521f65);});});} \ No newline at end of file +var _0x2fd5=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x26ac67,_0x1626d9){var _0x2240af=function(_0x180c62){while(--_0x180c62){_0x26ac67['push'](_0x26ac67['shift']());}};_0x2240af(++_0x1626d9);}(_0x2fd5,0x182));var _0x52fd=function(_0xd9ec58,_0x530ac2){_0xd9ec58=_0xd9ec58-0x0;var _0x418541=_0x2fd5[_0xd9ec58];return _0x418541;};'use strict';var _=require(_0x52fd('0x0'));var util=require(_0x52fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52fd('0x2'));var fs=require('fs');var Redis=require(_0x52fd('0x3'));var db=require(_0x52fd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52fd('0x5'))(_0x52fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x52fd('0x7'));var client=jayson[_0x52fd('0x8')][_0x52fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd11926,_0x513f44,_0x333ac6){return new BPromise(function(_0x36cce7,_0x5f36a2){return client[_0x52fd('0xa')](_0xd11926,_0x333ac6)[_0x52fd('0xb')](function(_0x36fcaa){logger[_0x52fd('0xc')](_0x52fd('0xd'),_0x513f44,_0x52fd('0xe'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x513f44,'request\x20sent',JSON[_0x52fd('0xf')](_0x36fcaa));if(_0x36fcaa[_0x52fd('0x10')]){if(_0x36fcaa[_0x52fd('0x10')][_0x52fd('0x11')]===0x1f4){logger['error'](_0x52fd('0xd'),_0x513f44,_0x36fcaa[_0x52fd('0x10')][_0x52fd('0x12')]);return _0x5f36a2(_0x36fcaa[_0x52fd('0x10')][_0x52fd('0x12')]);}logger[_0x52fd('0x10')](_0x52fd('0xd'),_0x513f44,_0x36fcaa[_0x52fd('0x10')][_0x52fd('0x12')]);return _0x36cce7(_0x36fcaa[_0x52fd('0x10')][_0x52fd('0x12')]);}else{logger['info'](_0x52fd('0xd'),_0x513f44,_0x52fd('0xe'));_0x36cce7(_0x36fcaa['result']['message']);}})['catch'](function(_0x1e5d5d){logger['error'](_0x52fd('0xd'),_0x513f44,_0x1e5d5d);_0x5f36a2(_0x1e5d5d);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6c842d3..4652be9 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0dee=['./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','listen','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/license','./config/environment','./config/logger'];(function(_0x26deb4,_0x1bdfe2){var _0x5c41bf=function(_0x325e2c){while(--_0x325e2c){_0x26deb4['push'](_0x26deb4['shift']());}};_0x5c41bf(++_0x1bdfe2);}(_0x0dee,0xf7));var _0xe0de=function(_0x3a4c4c,_0x374900){_0x3a4c4c=_0x3a4c4c-0x0;var _0x4c934d=_0x0dee[_0x3a4c4c];return _0x4c934d;};'use strict';var _=require(_0xe0de('0x0'));var db=require(_0xe0de('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xe0de('0x2'));var rpc=require('./rpc');var config=require(_0xe0de('0x3'));var logger=require(_0xe0de('0x4'))('app');var pm2=require(_0xe0de('0x5'));var pm2Config=require(_0xe0de('0x6'));var schedule=require(_0xe0de('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xe0de('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xe0de('0x9'));function main(){return db[_0xe0de('0xa')][_0xe0de('0xb')]()['then'](function(){if(config[_0xe0de('0xc')]){return seedDb['default']();}})[_0xe0de('0xd')](function(){return checkLicense['default']();})[_0xe0de('0xd')](function(){return rpc[_0xe0de('0xe')]();})[_0xe0de('0xd')](function(_0x107be5){logger['info'](_0x107be5);return chat[_0xe0de('0xf')]();})[_0xe0de('0xd')](function(){return whatsapp[_0xe0de('0xf')]();})[_0xe0de('0xd')](function(){return schedule['start']();})['then'](function(){return transcribe[_0xe0de('0xf')]();})[_0xe0de('0xd')](function(){return provider['start']();})['then'](function(_0x1ae0cd){logger[_0xe0de('0x10')](_0x1ae0cd);return pm2['start'](pm2Config);})['then'](function(_0x5e1fd9){var _0x4adf3c=_0x5e1fd9[_0xe0de('0x11')](function(_0x3ae86f){return typeof _0x3ae86f[_0xe0de('0x12')]===_0xe0de('0x13')&&_0x3ae86f[_0xe0de('0x12')]>=0x0;});if(_0x4adf3c[_0xe0de('0x14')]>0x0){throw new Error(_0x4adf3c[_0xe0de('0x14')]+_0xe0de('0x15')+_[_0xe0de('0x16')](_0x4adf3c,function(_0x22d047){return'\x22'+_0x22d047['pm2_env'][_0xe0de('0x17')]+'\x22';}));}logger[_0xe0de('0x10')](_0xe0de('0x18'),_[_0xe0de('0x16')](_[_0xe0de('0x11')](_0x5e1fd9,{'status':_0xe0de('0x19')}),_0xe0de('0x17'))[_0xe0de('0x1a')]());logger[_0xe0de('0x10')](_0xe0de('0x1b'),_['map'](_[_0xe0de('0x11')](_0x5e1fd9,function(_0x5dae22){return _0x5dae22[_0xe0de('0x1c')]!==_0xe0de('0x19');}),_0xe0de('0x17'))['join']()||_0xe0de('0x1d'));console[_0xe0de('0x1e')](_0xe0de('0x1f'));})[_0xe0de('0x20')](function(_0x119c4d){console['log'](_0xe0de('0x21'),_0x119c4d);logger[_0xe0de('0x22')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x119c4d);process[_0xe0de('0x23')](0x1);});}main(); \ No newline at end of file +var _0xdcc4=['log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info','start','exitCode','number','length','map','Online\x20apps:','online','name','join','Offline\x20apps:','filter','status','None'];(function(_0x5c3f0b,_0x4d42e1){var _0x517285=function(_0x524a84){while(--_0x524a84){_0x5c3f0b['push'](_0x5c3f0b['shift']());}};_0x517285(++_0x4d42e1);}(_0xdcc4,0xea));var _0x4dcc=function(_0x1a6330,_0x3da1db){_0x1a6330=_0x1a6330-0x0;var _0x3255cf=_0xdcc4[_0x1a6330];return _0x3255cf;};'use strict';var _=require(_0x4dcc('0x0'));var db=require(_0x4dcc('0x1'))['db'];var seedDb=require(_0x4dcc('0x2'));var checkLicense=require(_0x4dcc('0x3'));var rpc=require(_0x4dcc('0x4'));var config=require('./config/environment');var logger=require(_0x4dcc('0x5'))(_0x4dcc('0x6'));var pm2=require(_0x4dcc('0x7'));var pm2Config=require(_0x4dcc('0x8'));var schedule=require(_0x4dcc('0x9'));var chat=require(_0x4dcc('0xa'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x4dcc('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x4dcc('0xc')][_0x4dcc('0xd')]()[_0x4dcc('0xe')](function(){if(config[_0x4dcc('0xf')]){return seedDb['default']();}})[_0x4dcc('0xe')](function(){return checkLicense[_0x4dcc('0x10')]();})[_0x4dcc('0xe')](function(){return rpc[_0x4dcc('0x11')]();})[_0x4dcc('0xe')](function(_0x227f00){logger[_0x4dcc('0x12')](_0x227f00);return chat[_0x4dcc('0x13')]();})['then'](function(){return whatsapp[_0x4dcc('0x13')]();})[_0x4dcc('0xe')](function(){return schedule['start']();})[_0x4dcc('0xe')](function(){return transcribe[_0x4dcc('0x13')]();})['then'](function(){return provider[_0x4dcc('0x13')]();})[_0x4dcc('0xe')](function(_0x7df93c){logger[_0x4dcc('0x12')](_0x7df93c);return pm2[_0x4dcc('0x13')](pm2Config);})[_0x4dcc('0xe')](function(_0x62a437){var _0x45a97b=_0x62a437['filter'](function(_0x4cb7f0){return typeof _0x4cb7f0[_0x4dcc('0x14')]===_0x4dcc('0x15')&&_0x4cb7f0[_0x4dcc('0x14')]>=0x0;});if(_0x45a97b[_0x4dcc('0x16')]>0x0){throw new Error(_0x45a97b[_0x4dcc('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x4dcc('0x17')](_0x45a97b,function(_0x387523){return'\x22'+_0x387523['pm2_env']['name']+'\x22';}));}logger['info'](_0x4dcc('0x18'),_[_0x4dcc('0x17')](_['filter'](_0x62a437,{'status':_0x4dcc('0x19')}),_0x4dcc('0x1a'))[_0x4dcc('0x1b')]());logger['info'](_0x4dcc('0x1c'),_[_0x4dcc('0x17')](_[_0x4dcc('0x1d')](_0x62a437,function(_0x2eb5ec){return _0x2eb5ec[_0x4dcc('0x1e')]!==_0x4dcc('0x19');}),_0x4dcc('0x1a'))[_0x4dcc('0x1b')]()||_0x4dcc('0x1f'));console[_0x4dcc('0x20')](_0x4dcc('0x21'));})[_0x4dcc('0x22')](function(_0x1f771d){console[_0x4dcc('0x20')](_0x4dcc('0x23'),_0x1f771d);logger[_0x4dcc('0x24')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1f771d);process[_0x4dcc('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5fc2cf1..fef9ade 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 _0x6aa7=['smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6aa7,0x178));var _0x76aa=function(_0xf58a87,_0x4bd1f2){_0xf58a87=_0xf58a87-0x0;var _0x584c41=_0x6aa7[_0xf58a87];return _0x584c41;};'use strict';var db=require(_0x76aa('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x76aa('0x1'));var licenseUtil=require(_0x76aa('0x2'));var encryptor=require(_0x76aa('0x3'));var _=require(_0x76aa('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x76aa('0x5'));var compose=require(_0x76aa('0x6'));var basicAuth=require(_0x76aa('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x76aa('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x76aa('0x9')][_0x76aa('0xa')]});var userAttributes=['id',_0x76aa('0xb'),'fullname',_0x76aa('0xc'),_0x76aa('0xd'),_0x76aa('0xe'),'userpic',_0x76aa('0xf'),_0x76aa('0x10'),_0x76aa('0x11'),_0x76aa('0x12'),_0x76aa('0x13'),_0x76aa('0x14'),_0x76aa('0x15'),_0x76aa('0x16'),_0x76aa('0x17'),_0x76aa('0x18'),'lastLoginAt',_0x76aa('0x19'),'crudPermissions',_0x76aa('0x1a'),_0x76aa('0x1b'),_0x76aa('0x1c'),_0x76aa('0x1d'),_0x76aa('0x1e'),'phoneBarDnd','phoneBarEnableRecording',_0x76aa('0x1f'),'phoneBarEnableSettings',_0x76aa('0x20'),_0x76aa('0x21'),'phoneBarRemoteControl',_0x76aa('0x22'),'hotdesk',_0x76aa('0x23'),'userProfileId',_0x76aa('0x24'),_0x76aa('0x25'),_0x76aa('0x26'),_0x76aa('0x27'),_0x76aa('0x28'),_0x76aa('0x29'),'ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x76aa('0x2a'),_0x76aa('0x2b'),_0x76aa('0x2c'),_0x76aa('0x2d'),_0x76aa('0x2e'),_0x76aa('0x2f'),_0x76aa('0x30'),_0x76aa('0x31'),_0x76aa('0x32'),'faxAutoanswerDelay',_0x76aa('0x33'),_0x76aa('0x34')];exports[_0x76aa('0x35')]=function(){return this['isAuthenticated'](!![])[_0x76aa('0x36')](function(_0x189cb6,_0x31252f,_0x2bd2c6){if(_0x189cb6[_0x76aa('0x37')]){_0x2bd2c6();}else{return db[_0x76aa('0x38')][_0x76aa('0x39')]({'where':{'id':_0x189cb6[_0x76aa('0x3a')]['id']},'attributes':['id',_0x76aa('0x3b'),_0x76aa('0x3c')],'raw':!![]})[_0x76aa('0x3d')](function(_0x26b75e){if(_0x26b75e&&_0x26b75e[_0x76aa('0x3b')]){return _0x31252f['status'](_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?0x195:0x193)[_0x76aa('0x3f')]({'message':_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?_0x76aa('0x40'):_0x76aa('0x41')});}else{_0x2bd2c6();}})[_0x76aa('0x42')](function(_0xd12a99){_0x2bd2c6(_0xd12a99);});}});};exports[_0x76aa('0x43')]=function isAuthenticated(_0x545b06){return compose()[_0x76aa('0x36')](function(_0x5a8030,_0x994550,_0x365ff8){var _0x2dec94;if(_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')]){if(_[_0x76aa('0x46')](_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')],_0x76aa('0x47'))){var _0x3ea05a=basicAuth(_0x5a8030);db['User'][_0x76aa('0x48')]({'where':{'name':_0x3ea05a[_0x76aa('0xc')]}})[_0x76aa('0x3d')](function(_0x928ccf){if(!_0x928ccf||!_0x928ccf[_0x76aa('0x49')](_0x3ea05a[_0x76aa('0x4a')])){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x4c')});}_0x5a8030[_0x76aa('0x37')]={'id':_0x928ccf['id']};_0x365ff8();})['catch'](function(_0x2ee338){_0x365ff8(_0x2ee338);});}else if(_['startsWith'](_0x5a8030[_0x76aa('0x44')]['authorization'],_0x76aa('0x4d'))){validateJwt(_0x5a8030,_0x994550,_0x365ff8);}else{if(_0x545b06){_0x365ff8();}else{return _0x994550['status'](0x193)['json']({'message':_0x76aa('0x4e')});}}}else if(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')]){try{var _0x37dfab={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')],_0x37dfab)[_0x76aa('0x3d')](function(_0x23e2fd){return db[_0x76aa('0x51')]['find']({'where':{'id':_0x23e2fd[_0x76aa('0x52')]}})['then'](function(_0x5086f5){_0x2dec94=_0x5086f5;return db[_0x76aa('0x53')][_0x76aa('0x39')]({'where':{'id':0x1},'attributes':[_0x76aa('0x54'),_0x76aa('0x55')],'raw':!![]});})['then'](function(_0x401c07){if(!_0x2dec94||!_[_0x76aa('0x56')](_0x2dec94[_0x76aa('0x57')],_0x23e2fd['nonce'])){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x58')});}if(_0x2dec94[_0x76aa('0x59')]){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}if(_0x2dec94[_0x76aa('0x5b')]){if(_0x401c07[_0x76aa('0x55')]>0x0){if(moment(_0x2dec94['blockedAt'])[_0x76aa('0x5c')](_0x401c07[_0x76aa('0x55')],_0x76aa('0x5d'))>moment()){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}}else{return _0x994550['status'](0x191)['json']({'message':_0x76aa('0x5a')});}}_0x5a8030[_0x76aa('0x37')]={'id':_0x2dec94['id']};_0x365ff8();});})[_0x76aa('0x42')](function(){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x5a')});});}catch(_0x403084){_0x365ff8(_0x403084);}}else if(_0x545b06){_0x365ff8();}else{return _0x994550[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x4e')});}})['use'](function(_0x13dafe,_0x556f59,_0xbb3136){if(_0x13dafe['user']){db['User']['find']({'where':{'id':_0x13dafe[_0x76aa('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5cf314){if(!_0x5cf314){return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5e')});}_0x13dafe[_0x76aa('0x37')]=_0x5cf314;_0xbb3136();})[_0x76aa('0x42')](function(_0x27a52e){_0xbb3136(_0x27a52e);});}else if(_0x545b06){_0xbb3136();}else{return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5f')});}});};exports[_0x76aa('0x60')]=function canUpdate(){return compose()[_0x76aa('0x36')](function(_0x3800a4,_0x47a308,_0x2f695c){return licenseUtil[_0x76aa('0x61')]()['then'](function(_0x2d3441){if(_0x2d3441['update']){_0x2f695c();}else{return _0x47a308[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})[_0x76aa('0x42')](function(_0x2d0bc4){_0x2f695c(_0x2d0bc4);});});};exports[_0x76aa('0x63')]=function isWebrtcLicence(){return compose()[_0x76aa('0x36')](function(_0x165858,_0xb8d052,_0x3946bd){return licenseUtil['getLicense']()[_0x76aa('0x3d')](function(_0x4b8f12){if(_0x4b8f12[_0x76aa('0x64')]){_0x3946bd();}else{return _0xb8d052[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})['catch'](function(_0x5a3d9c){_0x3946bd(_0x5a3d9c);});});};exports[_0x76aa('0x65')]=function(_0x54b673,_0x8660a4,_0x302a0c){_0x54b673[_0x76aa('0x65')]=!![];return _0x302a0c();};exports[_0x76aa('0x66')]=function signToken(_0x30c577){return signJwt(_0x30c577);};exports[_0x76aa('0x67')]=function(_0x5b567b,_0x564546){if(!_0x5b567b[_0x76aa('0x37')]){return _0x564546[_0x76aa('0x4b')](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x68')});}var _0x18c679={'payload':{'id':_0x5b567b[_0x76aa('0x37')]['id'],'role':_0x5b567b['user'][_0x76aa('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18c679)[_0x76aa('0x3d')](function(_0x26db69){_0x564546['cookie'](_0x76aa('0x69'),_0x26db69);_0x564546['redirect'](_0x76aa('0x6a'));})['catch'](function(_0x339b0d){return _0x564546[_0x76aa('0x4b')](0x1f4)[_0x76aa('0x6b')](_0x339b0d);});};exports[_0x76aa('0x6c')]=function(_0x37a4d9){if(_[_0x76aa('0x6d')](_0x37a4d9[_0x76aa('0x57')])||_['isNil'](_0x37a4d9[_0x76aa('0x6e')])){return null;}else{return createJwt(_0x37a4d9);}};exports['generateApiKey']=function(_0x3ee32){_0x3ee32[_0x76aa('0x57')]=generateNonce();_0x3ee32[_0x76aa('0x6e')]=generateIssuedAt();return createJwt(_0x3ee32);};exports[_0x76aa('0x6f')]=function(_0x3fa7ec,_0x28f8aa){var _0x336024=_0x3fa7ec['query'][_0x76aa('0x50')];if(_0x336024){var _0x281f73={'nonce':_0x28f8aa[_0x76aa('0x57')],'iat':_0x28f8aa[_0x76aa('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x76aa('0x70')]()};return verifyJwt(_0x336024,_0x281f73)[_0x76aa('0x3d')](function(){return generateApiKey(_0x28f8aa);});}else{throw{'message':_0x76aa('0x71')};}};exports[_0x76aa('0x72')]=function(_0x2027f8){var _0xf7732=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf7732['test'](_0x2027f8))throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x76aa('0x75'));return;};exports[_0x76aa('0x76')]=function(_0x3967f3,_0x2fdc4f,_0x37babe){var _0x51893b=encryptor['decryptString'](_0x2fdc4f)[_0x76aa('0x77')](',');for(var _0x3b0d8a=0x0;_0x3b0d8a<_0x37babe;_0x3b0d8a++){if(!_0x51893b[_0x3b0d8a])break;if(_0x3967f3['toLowerCase']()===_0x51893b[_0x3b0d8a][_0x76aa('0x78')]()){var _0x1e6f3c=util['format'](_0x76aa('0x79'),_0x37babe);if(_0x37babe===0x1){_0x1e6f3c=_0x76aa('0x7a');}throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x1e6f3c);}}return;};exports[_0x76aa('0x7b')]=function(_0x1f5010,_0x3376ec){var _0x30573a=_0x3376ec?encryptor[_0x76aa('0x7c')](_0x3376ec)['split'](','):[];if(_0x30573a[_0x76aa('0x7d')]===0x5){_0x30573a['splice'](-0x1,0x1);}_0x30573a[_0x76aa('0x7e')](_0x1f5010);return encryptor[_0x76aa('0x7f')](_0x30573a[_0x76aa('0x80')](','));};function signJwt(_0x16cc85){var _0x343cf1=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x82')],{'context':jwt});var _0x431d1c=_0x16cc85[_0x76aa('0x83')]||config['secrets'][_0x76aa('0xa')];return new BPromise(function(_0x3d4025,_0x5c542b){_0x343cf1(_0x16cc85[_0x76aa('0x84')],_0x431d1c,_0x16cc85[_0x76aa('0x85')])[_0x76aa('0x3d')](function(_0x3d6d10){_0x3d4025(_0x3d6d10);})[_0x76aa('0x42')](function(_0x5546b6){_0x5c542b(_0x5546b6);});});}function verifyJwt(_0x364d05,_0x4d3ad0,_0x35bd2b){var _0x35881c=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x86')],{'context':jwt});var _0x3a82fe=_0x35bd2b||config[_0x76aa('0x9')][_0x76aa('0xa')];return new BPromise(function(_0x4a37f1,_0x9ea0af){_0x35881c(_0x364d05,_0x3a82fe,_0x4d3ad0)[_0x76aa('0x3d')](function(_0x543c1d){_0x4a37f1(_0x543c1d);})['catch'](function(_0x40429c){_0x9ea0af(_0x40429c);});});}function generateNonce(){return crypto[_0x76aa('0x87')](0x10)['toString'](_0x76aa('0x88'));}function generateIssuedAt(){return Math[_0x76aa('0x89')](Date[_0x76aa('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x446073){var _0x47f733={'payload':{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')]},'options':{'algorithm':_0x76aa('0x8b'),'subject':_0x446073['id'][_0x76aa('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x47f733)[_0x76aa('0x3d')](function(_0x4dfeb3){return{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')],'token':_0x4dfeb3};});} \ No newline at end of file +var _0x008c=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','session','payload','options','promisify','verify','randomBytes','hex','floor','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','userpic','permissions','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','smsAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','unmanaged','json','headers','startsWith','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x008c,0x188));var _0xc008=function(_0x681ca3,_0x19e409){_0x681ca3=_0x681ca3-0x0;var _0x42435d=_0x008c[_0x681ca3];return _0x42435d;};'use strict';var db=require(_0xc008('0x0'))['db'];var config=require(_0xc008('0x1'));var hardwareConf=require(_0xc008('0x2'));var licenseUtil=require(_0xc008('0x3'));var encryptor=require(_0xc008('0x4'));var _=require('lodash');var jwt=require(_0xc008('0x5'));var expressJwt=require(_0xc008('0x6'));var compose=require(_0xc008('0x7'));var basicAuth=require(_0xc008('0x8'));var crypto=require(_0xc008('0x9'));var BPromise=require(_0xc008('0xa'));var util=require(_0xc008('0xb'));var moment=require(_0xc008('0xc'));var validateJwt=expressJwt({'secret':config[_0xc008('0xd')]['session']});var userAttributes=['id',_0xc008('0xe'),'fullname',_0xc008('0xf'),'internal','email',_0xc008('0x10'),_0xc008('0x11'),'md5secret','voicePause','chatPause',_0xc008('0x12'),_0xc008('0x13'),'smsPause',_0xc008('0x14'),_0xc008('0x15'),_0xc008('0x16'),_0xc008('0x17'),_0xc008('0x18'),_0xc008('0x19'),_0xc008('0x1a'),'passwordResetAt','alias',_0xc008('0x1b'),'phoneBarAutoAnswerDelay',_0xc008('0x1c'),_0xc008('0x1d'),_0xc008('0x1e'),_0xc008('0x1f'),_0xc008('0x20'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0xc008('0x21'),_0xc008('0x22'),_0xc008('0x23'),_0xc008('0x24'),'settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0xc008('0x25'),_0xc008('0x26'),'selectRecallMeCampaign',_0xc008('0x27'),'chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer',_0xc008('0x28'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xc008('0x29')];exports[_0xc008('0x2a')]=function(){return this[_0xc008('0x2b')](!![])[_0xc008('0x2c')](function(_0x11cc75,_0x110128,_0x4f43e2){if(_0x11cc75[_0xc008('0x2d')]){_0x4f43e2();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x11cc75[_0xc008('0x2e')]['id']},'attributes':['id',_0xc008('0x2f'),_0xc008('0x30')],'raw':!![]})[_0xc008('0x31')](function(_0x5410f5){if(_0x5410f5&&_0x5410f5['closed']){return _0x110128['status'](_0x5410f5[_0xc008('0x30')]===_0xc008('0x32')?0x195:0x193)[_0xc008('0x33')]({'message':_0x5410f5[_0xc008('0x30')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x4f43e2();}})['catch'](function(_0x4caaf4){_0x4f43e2(_0x4caaf4);});}});};exports[_0xc008('0x2b')]=function isAuthenticated(_0x29ba43){return compose()[_0xc008('0x2c')](function(_0x529961,_0x24c14c,_0x32390d){var _0x209591;if(_0x529961[_0xc008('0x34')]['authorization']){if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],'Basic')){var _0x539766=basicAuth(_0x529961);db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'name':_0x539766[_0xc008('0xf')]}})[_0xc008('0x31')](function(_0x1de04b){if(!_0x1de04b||!_0x1de04b[_0xc008('0x38')](_0x539766[_0xc008('0x39')])){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x3b')});}_0x529961[_0xc008('0x2d')]={'id':_0x1de04b['id']};_0x32390d();})[_0xc008('0x3c')](function(_0x596ee8){_0x32390d(_0x596ee8);});}else if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],_0xc008('0x3d'))){validateJwt(_0x529961,_0x24c14c,_0x32390d);}else{if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}}}else if(_0x529961[_0xc008('0x3f')][_0xc008('0x40')]){try{var _0x7cfbc5={'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};verifyJwt(_0x529961['query'][_0xc008('0x40')],_0x7cfbc5)[_0xc008('0x31')](function(_0x459df4){return db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x459df4[_0xc008('0x42')]}})[_0xc008('0x31')](function(_0x5d0e06){_0x209591=_0x5d0e06;return db[_0xc008('0x43')][_0xc008('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc008('0x45')],'raw':!![]});})[_0xc008('0x31')](function(_0x5e38d5){if(!_0x209591||!_[_0xc008('0x46')](_0x209591[_0xc008('0x47')],_0x459df4[_0xc008('0x48')])){return _0x24c14c['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x209591[_0xc008('0x49')]){return _0x24c14c['status'](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}if(_0x209591[_0xc008('0x4b')]){if(_0x5e38d5[_0xc008('0x45')]>0x0){if(moment(_0x209591[_0xc008('0x4c')])[_0xc008('0x4d')](_0x5e38d5[_0xc008('0x45')],_0xc008('0x4e'))>moment()){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}else{return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}_0x529961['user']={'id':_0x209591['id']};_0x32390d();});})[_0xc008('0x3c')](function(){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});});}catch(_0x49a16d){_0x32390d(_0x49a16d);}}else if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}})[_0xc008('0x2c')](function(_0x2d142d,_0x5706bb,_0x398cdd){if(_0x2d142d[_0xc008('0x2d')]){db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x2d142d[_0xc008('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0xf4cc4b){if(!_0xf4cc4b){return _0x5706bb[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x4f')});}_0x2d142d['user']=_0xf4cc4b;_0x398cdd();})[_0xc008('0x3c')](function(_0xe37446){_0x398cdd(_0xe37446);});}else if(_0x29ba43){_0x398cdd();}else{return _0x5706bb[_0xc008('0x3a')](0x194)['json']({'message':_0xc008('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc008('0x2c')](function(_0x5d3a72,_0x46fa8f,_0x213014){return licenseUtil['getLicense']()[_0xc008('0x31')](function(_0x24ba0f){if(_0x24ba0f[_0xc008('0x51')]){_0x213014();}else{return _0x46fa8f['status'](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x44fc5d){_0x213014(_0x44fc5d);});});};exports[_0xc008('0x53')]=function isWebrtcLicence(){return compose()[_0xc008('0x2c')](function(_0x59ca2b,_0x47cafa,_0x5283a8){return licenseUtil[_0xc008('0x54')]()[_0xc008('0x31')](function(_0x103a83){if(_0x103a83[_0xc008('0x55')]){_0x5283a8();}else{return _0x47cafa[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x572593){_0x5283a8(_0x572593);});});};exports['isMiddleware']=function(_0x516e43,_0x2d5a49,_0x2651cf){_0x516e43[_0xc008('0x56')]=!![];return _0x2651cf();};exports['signToken']=function signToken(_0x28bc33){return signJwt(_0x28bc33);};exports[_0xc008('0x57')]=function(_0x17ab1a,_0x1c2c50){if(!_0x17ab1a[_0xc008('0x2d')]){return _0x1c2c50[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x58')});}var _0x3fd7d9={'payload':{'id':_0x17ab1a[_0xc008('0x2d')]['id'],'role':_0x17ab1a['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3fd7d9)[_0xc008('0x31')](function(_0x51cb14){_0x1c2c50[_0xc008('0x59')](_0xc008('0x5a'),_0x51cb14);_0x1c2c50[_0xc008('0x5b')]('/dashboards/general');})[_0xc008('0x3c')](function(_0x32b435){return _0x1c2c50[_0xc008('0x3a')](0x1f4)[_0xc008('0x5c')](_0x32b435);});};exports[_0xc008('0x5d')]=function(_0x51105f){if(_[_0xc008('0x5e')](_0x51105f[_0xc008('0x47')])||_['isNil'](_0x51105f[_0xc008('0x5f')])){return null;}else{return createJwt(_0x51105f);}};exports[_0xc008('0x60')]=function(_0x5b5fbf){_0x5b5fbf['apiKeyNonce']=generateNonce();_0x5b5fbf[_0xc008('0x5f')]=generateIssuedAt();return createJwt(_0x5b5fbf);};exports[_0xc008('0x61')]=function(_0x20947b,_0x30d0aa){var _0x14b6a0=_0x20947b['query']['apikey'];if(_0x14b6a0){var _0x34b72a={'nonce':_0x30d0aa['apiKeyNonce'],'iat':_0x30d0aa[_0xc008('0x5f')],'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};return verifyJwt(_0x14b6a0,_0x34b72a)[_0xc008('0x31')](function(){return generateApiKey(_0x30d0aa);});}else{throw{'message':_0xc008('0x62')};}};exports[_0xc008('0x63')]=function(_0x49d8b0){var _0x2ea742=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2ea742[_0xc008('0x64')](_0x49d8b0))throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0xc008('0x67'));return;};exports['validatePasswordHistory']=function(_0x41fae3,_0x4fdab4,_0x535e6e){var _0x5dbfca=encryptor[_0xc008('0x68')](_0x4fdab4)[_0xc008('0x69')](',');for(var _0x5dfb69=0x0;_0x5dfb69<_0x535e6e;_0x5dfb69++){if(!_0x5dbfca[_0x5dfb69])break;if(_0x41fae3['toLowerCase']()===_0x5dbfca[_0x5dfb69][_0xc008('0x6a')]()){var _0x2d8361=util[_0xc008('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x535e6e);if(_0x535e6e===0x1){_0x2d8361=_0xc008('0x6c');}throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0x2d8361);}}return;};exports[_0xc008('0x6d')]=function(_0x5baff1,_0x4022dd){var _0x4eaa6d=_0x4022dd?encryptor[_0xc008('0x68')](_0x4022dd)[_0xc008('0x69')](','):[];if(_0x4eaa6d[_0xc008('0x6e')]===0x5){_0x4eaa6d[_0xc008('0x6f')](-0x1,0x1);}_0x4eaa6d[_0xc008('0x70')](_0x5baff1);return encryptor[_0xc008('0x71')](_0x4eaa6d['join'](','));};function signJwt(_0x375e71){var _0x570001=BPromise['promisify'](jwt[_0xc008('0x72')],{'context':jwt});var _0x30aa1e=_0x375e71['secret']||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x3e373e,_0x4517c0){_0x570001(_0x375e71[_0xc008('0x74')],_0x30aa1e,_0x375e71[_0xc008('0x75')])[_0xc008('0x31')](function(_0x57ce9a){_0x3e373e(_0x57ce9a);})[_0xc008('0x3c')](function(_0x462e1e){_0x4517c0(_0x462e1e);});});}function verifyJwt(_0x3bfb15,_0x2a60e6,_0xb3ca0f){var _0x167425=BPromise[_0xc008('0x76')](jwt[_0xc008('0x77')],{'context':jwt});var _0xbc430a=_0xb3ca0f||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x2b5eb6,_0x131b81){_0x167425(_0x3bfb15,_0xbc430a,_0x2a60e6)[_0xc008('0x31')](function(_0x4e0251){_0x2b5eb6(_0x4e0251);})[_0xc008('0x3c')](function(_0x2e5467){_0x131b81(_0x2e5467);});});}function generateNonce(){return crypto[_0xc008('0x78')](0x10)['toString'](_0xc008('0x79'));}function generateIssuedAt(){return Math[_0xc008('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x1a03fd){var _0x2a4c2b={'payload':{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd[_0xc008('0x47')]},'options':{'algorithm':_0xc008('0x7b'),'subject':_0x1a03fd['id'][_0xc008('0x7c')](),'issuer':hardwareConf[_0xc008('0x41')](),'audience':hardwareConf[_0xc008('0x41')]()}};return signJwt(_0x2a4c2b)[_0xc008('0x31')](function(_0x1b059b){return{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd['apiKeyNonce'],'token':_0x1b059b};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 1c12cd3..67c0ce4 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 _0xfa32=['parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','clause','tags','skip','tag','countFilteredContacts','count','User','buildContactsQuery','fields','getFilteredContacts','rows','catch','keys','startsWith','cf_','map','CmCustomField','findOne','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search'];(function(_0x4ff7d1,_0x3331d1){var _0x16e063=function(_0x18c921){while(--_0x18c921){_0x4ff7d1['push'](_0x4ff7d1['shift']());}};_0x16e063(++_0x3331d1);}(_0xfa32,0x1d8));var _0x2fa3=function(_0x510396,_0x1d25e9){_0x510396=_0x510396-0x0;var _0x3fff5a=_0xfa32[_0x510396];return _0x3fff5a;};'use strict';var _=require(_0x2fa3('0x0'));var sqlUtils=require(_0x2fa3('0x1'));var db=require(_0x2fa3('0x2'))['db'];exports[_0x2fa3('0x3')]=function(_0x32feb9,_0x63795d,_0x53a9dc,_0x77871a){var _0x526c62={'count':0x0,'rows':[]};var _0x29fc86=sqlUtils[_0x2fa3('0x4')](_0x63795d,_0x32feb9);if(_0x29fc86){return Promise[_0x2fa3('0x5')](_0x526c62);}var _0x5df511=sqlUtils[_0x2fa3('0x6')]();var _0x2dc131={};var _0x1f8fd1=![];var _0x26c21d=![];return Promise['resolve']()[_0x2fa3('0x7')](function(){if(_0x32feb9[_0x2fa3('0x8')]){return sqlUtils[_0x2fa3('0x9')](_0x32feb9[_0x2fa3('0x8')],_0x77871a);}else{return sqlUtils[_0x2fa3('0xa')](_0x32feb9,_0x77871a);}})[_0x2fa3('0x7')](function(_0x4f27d0){_0x5df511[_0x2fa3('0xb')](_0x4f27d0[_0x2fa3('0xc')]);_0x5df511[_0x2fa3('0xb')](_0x4f27d0['fields']);_0x5df511[_0x2fa3('0xb')](_0x4f27d0[_0x2fa3('0xd')]);_0x5df511[_0x2fa3('0xb')](_0x4f27d0[_0x2fa3('0xe')][_0x2fa3('0xf')]);_0x2dc131=_0x4f27d0[_0x2fa3('0x10')];_0x26c21d=_0x4f27d0[_0x2fa3('0xe')][_0x2fa3('0x11')];return sqlUtils['checkListsRestrictions'](_0x63795d,_0x32feb9,_0x26c21d);})[_0x2fa3('0x7')](function(_0x30e60d){_0x5df511[_0x2fa3('0xb')](_0x30e60d);var _0x311fc5=_0x32feb9['search']?_0x2dc131['ids']:_0x32feb9[_0x2fa3('0x12')];_0x1f8fd1=_0x311fc5?!![]:![];return sqlUtils[_0x2fa3('0x13')](_0x5df511,_0x311fc5);})['then'](function(_0x49989c){_0x526c62[_0x2fa3('0x14')]=_0x49989c;if(_0x526c62[_0x2fa3('0x14')]===0x0){return;}if(_0x32feb9[_0x2fa3('0x15')]){_0x26c21d=!![];}return sqlUtils[_0x2fa3('0x16')](_0x5df511,_0x32feb9[_0x2fa3('0x17')],_0x53a9dc,_0x1f8fd1,_0x2dc131[_0x2fa3('0xf')],_0x26c21d);})[_0x2fa3('0x7')](function(_0x3aa7ac){if(!_0x3aa7ac){return[];}return sqlUtils[_0x2fa3('0x18')](_0x3aa7ac,_0x32feb9,_0x53a9dc);})[_0x2fa3('0x7')](function(_0x205808){_0x526c62[_0x2fa3('0x19')]=_0x205808;return _0x526c62;})[_0x2fa3('0x1a')](function(_0x59526e){throw _0x59526e;});};exports['describe']=function(){var _0x243f66={};var _0x2d68ca=[];return db['CmContact']['describe']()[_0x2fa3('0x7')](function(_0x1378a9){_0x243f66=_0x1378a9;var _0x28a3e5=Object[_0x2fa3('0x1b')](_0x243f66)[_0x2fa3('0xd')](function(_0x53a52d){return _[_0x2fa3('0x1c')](_0x53a52d,_0x2fa3('0x1d'))?_0x53a52d:undefined;});var _0x340c1b=_0x28a3e5[_0x2fa3('0x1e')](function(_0x53c7bb){return db[_0x2fa3('0x1f')][_0x2fa3('0x20')]({'where':{'id':_0x53c7bb['slice'](0x3)},'raw':!![]});});return Promise[_0x2fa3('0x21')](_0x340c1b);})[_0x2fa3('0x7')](function(_0x5ebdd8){for(var _0x2ac585=0x0;_0x2ac585<_0x5ebdd8[_0x2fa3('0x22')];_0x2ac585++){if(_0x5ebdd8[_0x2ac585]){var _0xd7d61=_0x2fa3('0x1d')+_0x5ebdd8[_0x2ac585]['id'];_0x243f66[_0xd7d61][_0x2fa3('0x23')]=_0x5ebdd8[_0x2ac585]['type'];}}_0x2d68ca=_[_0x2fa3('0x1e')](Object['keys'](_0x243f66),function(_0x18378f){return{'name':_0x18378f,'type':_0x243f66[_0x18378f][_0x2fa3('0x24')]};});return _0x2d68ca;})['catch'](function(_0x82a851){throw _0x82a851;});}; \ No newline at end of file +var _0xa1b9=['rows','catch','describe','filter','startsWith','cf_','CmCustomField','findOne','length','fieldType','type','keys','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','user','tags','skip','checkListsRestrictions','User','buildContactsQuery','clause','getFilteredContacts'];(function(_0x2edcb0,_0x6a7e67){var _0x27b5c4=function(_0x485344){while(--_0x485344){_0x2edcb0['push'](_0x2edcb0['shift']());}};_0x27b5c4(++_0x6a7e67);}(_0xa1b9,0x90));var _0x9a1b=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa1b9[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x9a1b('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x9a1b('0x1'))['db'];exports[_0x9a1b('0x2')]=function(_0x1e3354,_0x58c94a,_0x5cc888,_0x58f5a3){var _0x778f13={'count':0x0,'rows':[]};var _0x317e98=sqlUtils[_0x9a1b('0x3')](_0x58c94a,_0x1e3354);if(_0x317e98){return Promise[_0x9a1b('0x4')](_0x778f13);}var _0x251c0a=sqlUtils[_0x9a1b('0x5')]();var _0xa55760={};var _0x176eed=![];var _0xf3aa77=![];return Promise['resolve']()[_0x9a1b('0x6')](function(){if(_0x1e3354[_0x9a1b('0x7')]){return sqlUtils[_0x9a1b('0x8')](_0x1e3354[_0x9a1b('0x7')],_0x58f5a3);}else{return sqlUtils[_0x9a1b('0x9')](_0x1e3354,_0x58f5a3);}})['then'](function(_0x5aa3a3){_0x251c0a[_0x9a1b('0xa')](_0x5aa3a3[_0x9a1b('0xb')]);_0x251c0a[_0x9a1b('0xa')](_0x5aa3a3[_0x9a1b('0xc')]);_0x251c0a[_0x9a1b('0xa')](_0x5aa3a3['filter']);_0x251c0a['where'](_0x5aa3a3[_0x9a1b('0xd')]['clause']);_0xa55760=_0x5aa3a3[_0x9a1b('0xe')];_0xf3aa77=_0x5aa3a3['user'][_0x9a1b('0xf')];return sqlUtils[_0x9a1b('0x10')](_0x58c94a,_0x1e3354,_0xf3aa77);})[_0x9a1b('0x6')](function(_0x6fa12a){_0x251c0a[_0x9a1b('0xa')](_0x6fa12a);var _0x579a61=_0x1e3354[_0x9a1b('0x7')]?_0xa55760['ids']:_0x1e3354['tag'];_0x176eed=_0x579a61?!![]:![];return sqlUtils['countFilteredContacts'](_0x251c0a,_0x579a61);})[_0x9a1b('0x6')](function(_0x2eced7){_0x778f13['count']=_0x2eced7;if(_0x778f13['count']===0x0){return;}if(_0x1e3354[_0x9a1b('0x11')]){_0xf3aa77=!![];}return sqlUtils[_0x9a1b('0x12')](_0x251c0a,_0x1e3354[_0x9a1b('0xc')],_0x5cc888,_0x176eed,_0xa55760[_0x9a1b('0x13')],_0xf3aa77);})[_0x9a1b('0x6')](function(_0x29fb50){if(!_0x29fb50){return[];}return sqlUtils[_0x9a1b('0x14')](_0x29fb50,_0x1e3354,_0x5cc888);})[_0x9a1b('0x6')](function(_0x3bd663){_0x778f13[_0x9a1b('0x15')]=_0x3bd663;return _0x778f13;})[_0x9a1b('0x16')](function(_0x4b103e){throw _0x4b103e;});};exports[_0x9a1b('0x17')]=function(){var _0x5e19b1={};var _0xd92d34=[];return db['CmContact'][_0x9a1b('0x17')]()[_0x9a1b('0x6')](function(_0x2850ff){_0x5e19b1=_0x2850ff;var _0x59687c=Object['keys'](_0x5e19b1)[_0x9a1b('0x18')](function(_0x4e059d){return _[_0x9a1b('0x19')](_0x4e059d,_0x9a1b('0x1a'))?_0x4e059d:undefined;});var _0x24abdd=_0x59687c['map'](function(_0x4967d4){return db[_0x9a1b('0x1b')][_0x9a1b('0x1c')]({'where':{'id':_0x4967d4['slice'](0x3)},'raw':!![]});});return Promise['all'](_0x24abdd);})[_0x9a1b('0x6')](function(_0xeb759){for(var _0x194849=0x0;_0x194849<_0xeb759[_0x9a1b('0x1d')];_0x194849++){if(_0xeb759[_0x194849]){var _0xda381b=_0x9a1b('0x1a')+_0xeb759[_0x194849]['id'];_0x5e19b1[_0xda381b][_0x9a1b('0x1e')]=_0xeb759[_0x194849][_0x9a1b('0x1f')];}}_0xd92d34=_['map'](Object[_0x9a1b('0x20')](_0x5e19b1),function(_0x602e98){return{'name':_0x602e98,'type':_0x5e19b1[_0x602e98]['type']};});return _0xd92d34;})[_0x9a1b('0x16')](function(_0x4e7f02){throw _0x4e7f02;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 878c43a..c98a6a4 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 _0x076d=['fields','tag','clause','filter','getLists','attributes','group','c.id','limit','offset','having','order','DESC','Tag','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','autocomplete','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','phone','fax','email','CompanyId','createdAt','updatedAt','TagIds','includes','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','conditions','name','dateOfBirth','castTo','DATE','type','default','text','value','tags','and','ids','User','uc.UserId\x20=\x20?','user','skip','keys','map','Contact','push','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then'];(function(_0x4cdb99,_0x2c43fa){var _0x311cfd=function(_0x393e36){while(--_0x393e36){_0x4cdb99['push'](_0x4cdb99['shift']());}};_0x311cfd(++_0x2c43fa);}(_0x076d,0xe1));var _0xd076=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x076d[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xd076('0x0'));var squel=require(_0xd076('0x1'));var as=require(_0xd076('0x2'));var qs=require('../parsers/qs');var utils=require(_0xd076('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x35d8d8,_0x2634c6){var _0x888821=![];if(_0x35d8d8[_0xd076('0x4')]===_0xd076('0x5')&&!_0x2634c6[_0xd076('0x6')]&&!_0x2634c6[_0xd076('0x7')]&&_0x2634c6[_0xd076('0x8')]!=='true'){_0x888821=!![];}return _0x888821;}function getContactsSubquery(){return squel[_0xd076('0x9')]()[_0xd076('0xa')]('cm_contacts','c')[_0xd076('0xb')](_0xd076('0xc'));}function applyJoinClauses(_0x47a8be,_0x584b04){var _0x4647c9=_0x584b04?'c':_0xd076('0xd');_0x47a8be[_0xd076('0xe')](_0xd076('0xf'),'uc',_0xd076('0x10')+_0x4647c9+_0xd076('0x11'))['left_join']('cm_contact_has_tags','ct',_0xd076('0x12')+_0x4647c9+_0xd076('0x11'))['left_join']('tools_tags','t',_0xd076('0x13'));return _0x47a8be;}function addFieldsToQuery(_0x3ae4d9,_0x91e86,_0x400335,_0x552fd5,_0x55fd28){var _0x5d3219=_0x55fd28?'c':_0xd076('0xd');if(!_0x91e86){_0x91e86=['id',_0xd076('0x14'),_0xd076('0x15'),_0xd076('0x16'),'mobile',_0xd076('0x17'),_0xd076('0x18'),'ListId',_0xd076('0x19'),_0xd076('0x1a'),_0xd076('0x1b'),'deletedAt',_0xd076('0x1c')];}else if(!_0x91e86[_0xd076('0x1d')]('id')){_0x91e86['push']('id');}var _0x3dede6=_0x400335&&_0x55fd28||!_0x400335&&!_0x55fd28;if(_0x552fd5){_0x3dede6=_0x552fd5&&_0x55fd28||!_0x552fd5&&!_0x55fd28;}_0x91e86['forEach'](function(_0x507940){if(_0x507940===_0xd076('0x1c')){if(_0x3dede6){_0x3ae4d9[_0xd076('0x1e')](_0xd076('0x1f'),_0x507940);}else if(_0x400335||_0x552fd5){_0x3ae4d9[_0xd076('0x1e')](_0x5d3219+'.'+_0x507940);}}else{_0x3ae4d9[_0xd076('0x1e')](_0x5d3219+'.'+_0x507940);}});return _0x3ae4d9;}function getSqlClauses(){var _0x24bcbf={'default':squel[_0xd076('0x20')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0xd076('0x20')](),'ids':null},'user':{'clause':squel[_0xd076('0x20')](),'skip':![]}};return _0x24bcbf;}function parseTagParameter(_0x55c1f5){var _0x482ab1=squel[_0xd076('0x20')]();if(_0x55c1f5){var _0x3f8237=utils[_0xd076('0x21')](_0x55c1f5);_0x3f8237[_0xd076('0x22')](function(_0xf484fe){_0x482ab1['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf484fe+',%');});}return _0x482ab1;}function parseSearchFilter(_0x1cad28){var _0xf23b8e=squel[_0xd076('0x20')]();if(_0x1cad28){var _0x2ff9b6=_0x1cad28[_0xd076('0x23')]('\x5c','\x5c\x5c')[_0xd076('0x23')](/'/g,'\x27\x27');if(_0x2ff9b6[_0xd076('0x24')]('\x20')[_0xd076('0x25')]>0x1){_0xf23b8e['or'](_0xd076('0x26'),qs[_0xd076('0x27')](_0x2ff9b6,!![]),null);}else{if(qs['isNumeric'](_0x2ff9b6)){_0xf23b8e['or'](_0xd076('0x28'),_0x2ff9b6+'%');_0xf23b8e['or'](_0xd076('0x29'),_0x2ff9b6+'%');_0xf23b8e['or']('c.mobile\x20LIKE\x20?',_0x2ff9b6+'%');_0xf23b8e['or'](_0xd076('0x2a'),_0x2ff9b6+'%');}else if(qs[_0xd076('0x2b')](_0x2ff9b6)){_0xf23b8e['or'](_0xd076('0x2c'),_0x2ff9b6+'%');}else{_0xf23b8e['or'](_0xd076('0x2d'),'%'+_0x2ff9b6+'%');_0xf23b8e['or']('c.lastName\x20LIKE\x20?','%'+_0x2ff9b6+'%');_0xf23b8e['or'](_0xd076('0x2c'),'%'+_0x2ff9b6+'%');}}}return _0xf23b8e;}function parseAdvancedSearchFilter(_0x3dcbab,_0x1bd4d2){var _0x5bc41f=getSqlClauses();var _0x477408=as[_0xd076('0x2e')](_0x3dcbab);var _0x3978d8=_0x477408['sqlOperator'];for(var _0x38ef59=0x0;_0x38ef59<_0x477408[_0xd076('0x2f')][_0xd076('0x25')];_0x38ef59++){var _0x16fce9=_0x477408[_0xd076('0x2f')][_0x38ef59];var _0x243899='c';var _0x550710=_['find'](_0x1bd4d2,[_0xd076('0x30'),_0x16fce9[_0xd076('0x1e')]]);if(_0x550710){if(_0x16fce9['field']===_0xd076('0x31')||_0x550710['fieldType']==='datetime'){_0x16fce9[_0xd076('0x32')]=_0xd076('0x33');}var _0x3ddf1e=as['buildExpression'](_0x243899,_0x550710[_0xd076('0x34')],_0x16fce9);_0x5bc41f[_0xd076('0x35')][_0x3978d8](_0x3ddf1e[_0xd076('0x36')],_0x3ddf1e['value']['start'],_0x3ddf1e[_0xd076('0x37')]['end']);}else{if(_0x16fce9[_0xd076('0x1e')]==='Tag'){var _0x30a721=_0x16fce9[_0xd076('0x37')][_0xd076('0x24')](',')['map'](function(_0x5bff5e){return Number(_0x5bff5e);});var _0x4ae514=parseTagParameter(_0x30a721);_0x5bc41f[_0xd076('0x38')]['clause'][_0xd076('0x39')](_0x4ae514);_0x5bc41f[_0xd076('0x38')][_0xd076('0x3a')]=_0x30a721;}else if(_0x16fce9['field']===_0xd076('0x3b')){_0x5bc41f['user']['clause']['and'](_0xd076('0x3c'),_0x16fce9[_0xd076('0x37')]);_0x5bc41f[_0xd076('0x3d')][_0xd076('0x3e')]=!![];}}}return _0x5bc41f;}function parseModelFields(_0x3f6c8a,_0x415a38){var _0x1cee11=squel[_0xd076('0x20')]();var _0x1ffc3f=_(_0x3f6c8a)[_0xd076('0x3f')]()[_0xd076('0x40')](function(_0x256417){return _['some'](_0x415a38,['name',_0x256417])?_0x256417:undefined;})['compact']()[_0xd076('0x37')]();if(_0x3f6c8a[_0xd076('0x41')]){_0x1ffc3f['push'](_0xd076('0x41'));}if(_0x3f6c8a[_0xd076('0x3b')]){_0x1ffc3f[_0xd076('0x42')](_0xd076('0x3b'));}if(_0x1ffc3f['length']>0x0){_0x1ffc3f[_0xd076('0x22')](function(_0x3a9506){if(_0x3a9506==='ListId'){_0x1cee11[_0xd076('0x39')](_0xd076('0x43'),[][_0xd076('0x44')](_0x3f6c8a[_0x3a9506]));}else if(_0x3a9506==='Contact'){var _0x1097e1='%'+_0x3f6c8a[_0x3a9506]+'%';_0x1cee11[_0xd076('0x39')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x1097e1);}else if(_0x3a9506===_0xd076('0x3b')){_0x1cee11[_0xd076('0x39')](_0xd076('0x3c'),_0x3f6c8a[_0x3a9506]);}else{_0x1cee11['and']('c.'+_0x3a9506+_0xd076('0x45'),_0x3f6c8a[_0x3a9506]);}});}return _0x1cee11;}function parseQueryParameters(_0x582682,_0x575e99){var _0xd6d2ff=getSqlClauses();return Promise[_0xd076('0x46')]()[_0xd076('0x47')](function(){return parseModelFields(_0x582682,_0x575e99);})[_0xd076('0x47')](function(_0xc1440c){_0xd6d2ff[_0xd076('0x48')][_0xd076('0x39')](_0xc1440c);return parseTagParameter(_0x582682[_0xd076('0x49')]);})[_0xd076('0x47')](function(_0x1d7d45){_0xd6d2ff['tags'][_0xd076('0x4a')][_0xd076('0x39')](_0x1d7d45);return parseSearchFilter(_0x582682['filter']);})[_0xd076('0x47')](function(_0x160a6f){_0xd6d2ff[_0xd076('0x4b')]=_0x160a6f;return _0xd6d2ff;});}function checkListsRestrictions(_0x1974b5,_0x5eb887,_0x2fb221){var _0x30746e=squel[_0xd076('0x20')]();return Promise[_0xd076('0x46')]()[_0xd076('0x47')](function(){if(_0x5eb887['search']&&_0x1974b5['role']===_0xd076('0x5')&&!_0x2fb221){return _0x1974b5[_0xd076('0x4c')]({'attributes':['id'],'raw':!![]});}})[_0xd076('0x47')](function(_0x53c11d){if(_0x53c11d){if(_0x53c11d['length']===0x0){_0x30746e[_0xd076('0x39')]('c.ListId\x20IS\x20NULL');}else{_0x30746e[_0xd076('0x39')](_0xd076('0x43'),_[_0xd076('0x40')](_0x53c11d,'id'));}}})['then'](function(){return _0x30746e;});}function buildContactsQuery(_0xdb4004,_0x22b191,_0x34e253,_0x997167,_0x569846,_0x223d45){if(_0x22b191){_0x22b191=_0x34e253[_0xd076('0x4d')];}_0xdb4004=addFieldsToQuery(_0xdb4004,_0x22b191,_0x997167,_0x223d45,!![]);var _0x605082=squel[_0xd076('0x9')]();_0x605082=addFieldsToQuery(_0x605082,_0x22b191,_0x997167,_0x223d45,![]);if(_0x997167||_0x223d45){_0xdb4004=applyJoinClauses(_0xdb4004,!![]);_0xdb4004[_0xd076('0x4e')](_0xd076('0x4f'));if(_0x34e253['limit']){_0x605082[_0xd076('0x50')](_0x34e253[_0xd076('0x50')]);}if(_0x34e253[_0xd076('0x51')]){_0x605082['offset'](_0x34e253[_0xd076('0x51')]);}}else{_0x605082=applyJoinClauses(_0x605082,![]);_0x605082[_0xd076('0x4e')]('subqry.id');if(_0x34e253[_0xd076('0x50')]){_0xdb4004[_0xd076('0x50')](_0x34e253[_0xd076('0x50')]);}if(_0x34e253[_0xd076('0x51')]){_0xdb4004['offset'](_0x34e253[_0xd076('0x51')]);}}_0x605082[_0xd076('0x52')](_0x569846);if(_0x34e253[_0xd076('0x53')]){_0x34e253[_0xd076('0x53')][_0xd076('0x22')](function(_0x3b3c88){_0xdb4004['order']('c.'+_0x3b3c88[0x0],_0x3b3c88[0x1]===_0xd076('0x54')?![]:!![]);_0x605082[_0xd076('0x53')]('subqry.'+_0x3b3c88[0x0],_0x3b3c88[0x1]===_0xd076('0x54')?![]:!![]);});}_0x605082[_0xd076('0xa')](_0xdb4004,_0xd076('0xd'));return _0x605082;}function getFilteredContacts(_0x3d178c){var _0x46c161=[];return db[_0xd076('0x55')][_0xd076('0x56')]({'attributes':['id',_0xd076('0x30'),_0xd076('0x57')],'raw':!![]})[_0xd076('0x47')](function(_0x288ff6){_0x46c161=_[_0xd076('0x58')](_0x288ff6,'id');var _0x39d32f={'type':db[_0xd076('0x59')]['QueryTypes'][_0xd076('0x5a')],'model':db[_0xd076('0x5b')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xd076('0x5c')][_0xd076('0x5d')](_0x3d178c[_0xd076('0x5e')](),_0x39d32f);})[_0xd076('0x47')](function(_0x530677){_0x530677[_0xd076('0x22')](function(_0x398f46){if(_0x398f46[_0xd076('0x1c')]){_0x398f46[_0xd076('0x5f')]=[];_0x398f46[_0xd076('0x1c')]['split'](',')['forEach'](function(_0x4d912d){_0x398f46[_0xd076('0x5f')][_0xd076('0x42')](_0x46c161[_0x4d912d]);});}delete _0x398f46['TagIds'];});return _0x530677;});}function countFilteredContacts(_0x1f3d8f,_0x137eb5){var _0x1b88be=_0x1f3d8f[_0xd076('0x60')]();_0x1b88be['field'](_0xd076('0x61'));_0x1b88be=applyJoinClauses(_0x1b88be,!![]);_0x1f3d8f[_0xd076('0x4e')]('c.id');var _0x2629e7=utils[_0xd076('0x21')](_0x137eb5);if(!_['isEmpty'](_0x2629e7)){_0x1b88be[_0xd076('0xb')](_0xd076('0x62'),_0x2629e7);}var _0x1692a7={'type':db[_0xd076('0x59')]['QueryTypes'][_0xd076('0x5a')],'raw':!![]};return db['sequelize'][_0xd076('0x5d')](_0x1b88be['toString'](),_0x1692a7)[_0xd076('0x47')](function(_0x92439){return _0x92439[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xf07f=['User','uc.UserId\x20=\x20?','user','skip','compact','Contact','forEach','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','limit','offset','group','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','sequelize','query','toString','clone','COUNT(*)','c.id','isEmpty','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','email','createdAt','updatedAt','deletedAt','TagIds','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','default','text','value','end','Tag','map','tags','clause','and','ids'];(function(_0x53b9e2,_0x5e3769){var _0x4cf430=function(_0x1fd66e){while(--_0x1fd66e){_0x53b9e2['push'](_0x53b9e2['shift']());}};_0x4cf430(++_0x5e3769);}(_0xf07f,0x112));var _0xff07=function(_0xc72af8,_0x26f0e5){_0xc72af8=_0xc72af8-0x0;var _0x5cfc41=_0xf07f[_0xc72af8];return _0x5cfc41;};'use strict';var _=require(_0xff07('0x0'));var squel=require(_0xff07('0x1'));var as=require(_0xff07('0x2'));var qs=require(_0xff07('0x3'));var utils=require(_0xff07('0x4'));var db=require(_0xff07('0x5'))['db'];function skipContactsQuery(_0x21fb82,_0x1a535e){var _0x3235e8=![];if(_0x21fb82['role']===_0xff07('0x6')&&!_0x1a535e[_0xff07('0x7')]&&!_0x1a535e[_0xff07('0x8')]&&_0x1a535e[_0xff07('0x9')]!==_0xff07('0xa')){_0x3235e8=!![];}return _0x3235e8;}function getContactsSubquery(){return squel[_0xff07('0xb')]()[_0xff07('0xc')](_0xff07('0xd'),'c')[_0xff07('0xe')](_0xff07('0xf'));}function applyJoinClauses(_0x2e119b,_0x785e7){var _0x354b74=_0x785e7?'c':_0xff07('0x10');_0x2e119b['left_join'](_0xff07('0x11'),'uc',_0xff07('0x12')+_0x354b74+_0xff07('0x13'))[_0xff07('0x14')](_0xff07('0x15'),'ct',_0xff07('0x16')+_0x354b74+_0xff07('0x13'))['left_join'](_0xff07('0x17'),'t',_0xff07('0x18'));return _0x2e119b;}function addFieldsToQuery(_0x3c1667,_0x606943,_0xc382be,_0x2be5f4,_0x752644){var _0x492c78=_0x752644?'c':_0xff07('0x10');if(!_0x606943){_0x606943=['id',_0xff07('0x19'),_0xff07('0x1a'),_0xff07('0x1b'),_0xff07('0x1c'),'fax',_0xff07('0x1d'),_0xff07('0x8'),'CompanyId',_0xff07('0x1e'),_0xff07('0x1f'),_0xff07('0x20'),_0xff07('0x21')];}else if(!_0x606943['includes']('id')){_0x606943[_0xff07('0x22')]('id');}var _0x231de5=_0xc382be&&_0x752644||!_0xc382be&&!_0x752644;if(_0x2be5f4){_0x231de5=_0x2be5f4&&_0x752644||!_0x2be5f4&&!_0x752644;}_0x606943['forEach'](function(_0x17e3c5){if(_0x17e3c5===_0xff07('0x21')){if(_0x231de5){_0x3c1667['field'](_0xff07('0x23'),_0x17e3c5);}else if(_0xc382be||_0x2be5f4){_0x3c1667[_0xff07('0x24')](_0x492c78+'.'+_0x17e3c5);}}else{_0x3c1667[_0xff07('0x24')](_0x492c78+'.'+_0x17e3c5);}});return _0x3c1667;}function getSqlClauses(){var _0xf58ff0={'default':squel[_0xff07('0x25')](),'fields':squel[_0xff07('0x25')](),'filter':squel[_0xff07('0x25')](),'tags':{'clause':squel[_0xff07('0x25')](),'ids':null},'user':{'clause':squel[_0xff07('0x25')](),'skip':![]}};return _0xf58ff0;}function parseTagParameter(_0x512fd1){var _0x2dc8bd=squel[_0xff07('0x25')]();if(_0x512fd1){var _0x324a1b=utils[_0xff07('0x26')](_0x512fd1);_0x324a1b['forEach'](function(_0x4ef5fe){_0x2dc8bd['or'](_0xff07('0x27'),'%,'+_0x4ef5fe+',%');});}return _0x2dc8bd;}function parseSearchFilter(_0x3a1d8a){var _0x4e5105=squel[_0xff07('0x25')]();if(_0x3a1d8a){var _0x29ed8e=_0x3a1d8a['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x29ed8e[_0xff07('0x28')]('\x20')[_0xff07('0x29')]>0x1){_0x4e5105['or'](_0xff07('0x2a'),qs[_0xff07('0x2b')](_0x29ed8e,!![]),null);}else{if(qs[_0xff07('0x2c')](_0x29ed8e)){_0x4e5105['or'](_0xff07('0x2d'),_0x29ed8e+'%');_0x4e5105['or'](_0xff07('0x2e'),_0x29ed8e+'%');_0x4e5105['or'](_0xff07('0x2f'),_0x29ed8e+'%');_0x4e5105['or'](_0xff07('0x30'),_0x29ed8e+'%');}else if(qs[_0xff07('0x31')](_0x29ed8e)){_0x4e5105['or']('c.email\x20LIKE\x20?',_0x29ed8e+'%');}else{_0x4e5105['or'](_0xff07('0x32'),'%'+_0x29ed8e+'%');_0x4e5105['or'](_0xff07('0x33'),'%'+_0x29ed8e+'%');_0x4e5105['or'](_0xff07('0x34'),'%'+_0x29ed8e+'%');}}}return _0x4e5105;}function parseAdvancedSearchFilter(_0x308905,_0x5d1a8a){var _0x47ef85=getSqlClauses();var _0x2ec257=as[_0xff07('0x35')](_0x308905);var _0x4c09c2=_0x2ec257[_0xff07('0x36')];for(var _0x35a688=0x0;_0x35a688<_0x2ec257[_0xff07('0x37')][_0xff07('0x29')];_0x35a688++){var _0x38b806=_0x2ec257['conditions'][_0x35a688];var _0x355b75='c';var _0xf97295=_[_0xff07('0x38')](_0x5d1a8a,[_0xff07('0x39'),_0x38b806[_0xff07('0x24')]]);if(_0xf97295){if(_0x38b806['field']===_0xff07('0x3a')||_0xf97295[_0xff07('0x3b')]===_0xff07('0x3c')){_0x38b806[_0xff07('0x3d')]=_0xff07('0x3e');}var _0xa5da83=as['buildExpression'](_0x355b75,_0xf97295[_0xff07('0x3f')],_0x38b806);_0x47ef85[_0xff07('0x40')][_0x4c09c2](_0xa5da83[_0xff07('0x41')],_0xa5da83[_0xff07('0x42')]['start'],_0xa5da83[_0xff07('0x42')][_0xff07('0x43')]);}else{if(_0x38b806['field']===_0xff07('0x44')){var _0x141062=_0x38b806[_0xff07('0x42')][_0xff07('0x28')](',')[_0xff07('0x45')](function(_0x542874){return Number(_0x542874);});var _0x42805e=parseTagParameter(_0x141062);_0x47ef85[_0xff07('0x46')][_0xff07('0x47')][_0xff07('0x48')](_0x42805e);_0x47ef85[_0xff07('0x46')][_0xff07('0x49')]=_0x141062;}else if(_0x38b806[_0xff07('0x24')]===_0xff07('0x4a')){_0x47ef85['user']['clause'][_0xff07('0x48')](_0xff07('0x4b'),_0x38b806[_0xff07('0x42')]);_0x47ef85[_0xff07('0x4c')][_0xff07('0x4d')]=!![];}}}return _0x47ef85;}function parseModelFields(_0xfa7207,_0xf51ddc){var _0x45e455=squel[_0xff07('0x25')]();var _0x39684a=_(_0xfa7207)['keys']()[_0xff07('0x45')](function(_0x2b0c46){return _['some'](_0xf51ddc,[_0xff07('0x39'),_0x2b0c46])?_0x2b0c46:undefined;})[_0xff07('0x4e')]()[_0xff07('0x42')]();if(_0xfa7207[_0xff07('0x4f')]){_0x39684a[_0xff07('0x22')](_0xff07('0x4f'));}if(_0xfa7207[_0xff07('0x4a')]){_0x39684a[_0xff07('0x22')](_0xff07('0x4a'));}if(_0x39684a['length']>0x0){_0x39684a[_0xff07('0x50')](function(_0x2f53d4){if(_0x2f53d4==='ListId'){_0x45e455['and'](_0xff07('0x51'),[][_0xff07('0x52')](_0xfa7207[_0x2f53d4]));}else if(_0x2f53d4===_0xff07('0x4f')){var _0xc3c827='%'+_0xfa7207[_0x2f53d4]+'%';_0x45e455[_0xff07('0x48')](_0xff07('0x53'),_0xc3c827);}else if(_0x2f53d4===_0xff07('0x4a')){_0x45e455[_0xff07('0x48')](_0xff07('0x4b'),_0xfa7207[_0x2f53d4]);}else{_0x45e455[_0xff07('0x48')]('c.'+_0x2f53d4+_0xff07('0x54'),_0xfa7207[_0x2f53d4]);}});}return _0x45e455;}function parseQueryParameters(_0x432ff0,_0x7733c9){var _0x128337=getSqlClauses();return Promise[_0xff07('0x55')]()['then'](function(){return parseModelFields(_0x432ff0,_0x7733c9);})[_0xff07('0x56')](function(_0x149daf){_0x128337[_0xff07('0x57')]['and'](_0x149daf);return parseTagParameter(_0x432ff0[_0xff07('0x58')]);})[_0xff07('0x56')](function(_0x48764f){_0x128337[_0xff07('0x46')][_0xff07('0x47')]['and'](_0x48764f);return parseSearchFilter(_0x432ff0['filter']);})[_0xff07('0x56')](function(_0x3de89b){_0x128337[_0xff07('0x59')]=_0x3de89b;return _0x128337;});}function checkListsRestrictions(_0x2a92a2,_0x55562a,_0x4ac509){var _0x4a806a=squel[_0xff07('0x25')]();return Promise['resolve']()['then'](function(){if(_0x55562a[_0xff07('0x7')]&&_0x2a92a2[_0xff07('0x5a')]==='agent'&&!_0x4ac509){return _0x2a92a2[_0xff07('0x5b')]({'attributes':['id'],'raw':!![]});}})[_0xff07('0x56')](function(_0x515acf){if(_0x515acf){if(_0x515acf['length']===0x0){_0x4a806a[_0xff07('0x48')](_0xff07('0x5c'));}else{_0x4a806a[_0xff07('0x48')](_0xff07('0x51'),_['map'](_0x515acf,'id'));}}})[_0xff07('0x56')](function(){return _0x4a806a;});}function buildContactsQuery(_0x369bc3,_0x1bec4a,_0x3fed0a,_0x199e60,_0x436488,_0x3b739a){if(_0x1bec4a){_0x1bec4a=_0x3fed0a[_0xff07('0x5d')];}_0x369bc3=addFieldsToQuery(_0x369bc3,_0x1bec4a,_0x199e60,_0x3b739a,!![]);var _0x1e18c2=squel['select']();_0x1e18c2=addFieldsToQuery(_0x1e18c2,_0x1bec4a,_0x199e60,_0x3b739a,![]);if(_0x199e60||_0x3b739a){_0x369bc3=applyJoinClauses(_0x369bc3,!![]);_0x369bc3['group']('c.id');if(_0x3fed0a[_0xff07('0x5e')]){_0x1e18c2[_0xff07('0x5e')](_0x3fed0a[_0xff07('0x5e')]);}if(_0x3fed0a['offset']){_0x1e18c2[_0xff07('0x5f')](_0x3fed0a[_0xff07('0x5f')]);}}else{_0x1e18c2=applyJoinClauses(_0x1e18c2,![]);_0x1e18c2[_0xff07('0x60')](_0xff07('0x61'));if(_0x3fed0a[_0xff07('0x5e')]){_0x369bc3[_0xff07('0x5e')](_0x3fed0a[_0xff07('0x5e')]);}if(_0x3fed0a[_0xff07('0x5f')]){_0x369bc3[_0xff07('0x5f')](_0x3fed0a[_0xff07('0x5f')]);}}_0x1e18c2[_0xff07('0x62')](_0x436488);if(_0x3fed0a[_0xff07('0x63')]){_0x3fed0a[_0xff07('0x63')][_0xff07('0x50')](function(_0x2352dc){_0x369bc3[_0xff07('0x63')]('c.'+_0x2352dc[0x0],_0x2352dc[0x1]===_0xff07('0x64')?![]:!![]);_0x1e18c2['order'](_0xff07('0x65')+_0x2352dc[0x0],_0x2352dc[0x1]===_0xff07('0x64')?![]:!![]);});}_0x1e18c2[_0xff07('0xc')](_0x369bc3,'subqry');return _0x1e18c2;}function getFilteredContacts(_0x47370e){var _0x140e94=[];return db[_0xff07('0x44')][_0xff07('0x66')]({'attributes':['id',_0xff07('0x39'),_0xff07('0x67')],'raw':!![]})[_0xff07('0x56')](function(_0x25019f){_0x140e94=_[_0xff07('0x68')](_0x25019f,'id');var _0x4a272b={'type':db[_0xff07('0x69')][_0xff07('0x6a')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xff07('0x6b')][_0xff07('0x6c')](_0x47370e[_0xff07('0x6d')](),_0x4a272b);})[_0xff07('0x56')](function(_0x159333){_0x159333[_0xff07('0x50')](function(_0x33c39f){if(_0x33c39f[_0xff07('0x21')]){_0x33c39f['Tags']=[];_0x33c39f[_0xff07('0x21')][_0xff07('0x28')](',')['forEach'](function(_0x351586){_0x33c39f['Tags'][_0xff07('0x22')](_0x140e94[_0x351586]);});}delete _0x33c39f[_0xff07('0x21')];});return _0x159333;});}function countFilteredContacts(_0x5aa964,_0x28f9ae){var _0x57245d=_0x5aa964[_0xff07('0x6e')]();_0x57245d['field'](_0xff07('0x6f'));_0x57245d=applyJoinClauses(_0x57245d,!![]);_0x5aa964[_0xff07('0x60')](_0xff07('0x70'));var _0x6bef67=utils[_0xff07('0x26')](_0x28f9ae);if(!_[_0xff07('0x71')](_0x6bef67)){_0x57245d[_0xff07('0xe')]('t.id\x20IN\x20?',_0x6bef67);}var _0x5234a1={'type':db[_0xff07('0x69')][_0xff07('0x6a')][_0xff07('0x72')],'raw':!![]};return db['sequelize'][_0xff07('0x6c')](_0x57245d[_0xff07('0x6d')](),_0x5234a1)[_0xff07('0x56')](function(_0x447083){return _0x447083[0x0]['COUNT(*)'];});}module[_0xff07('0x73')]={'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 4c4f6a7..d4203b0 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 _0x7982=['lodash','../../config/logger','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','update','binary','write','end','final','close','unlink','createWriteStream','createDecipher','data','secret','createCipher','utf8','base64','decryptString','bluebird'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x7982,0xe6));var _0x2798=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x7982[_0x2b7764];return _0x848dcb;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x2798('0x0'));var _=require(_0x2798('0x1'));var config=require('../../config/environment');var logger=require(_0x2798('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x2798('0x3')],'algorithm':_0x2798('0x4')};const fileOptions={'algorithm':_0x2798('0x5')};if(config[_0x2798('0x6')]&&config['encrypt'][_0x2798('0x7')]){var isSupported=isAlgorithmSupported(config[_0x2798('0x6')][_0x2798('0x7')]);if(isSupported){fileOptions[_0x2798('0x7')]=config[_0x2798('0x6')][_0x2798('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2798('0x8')](',\x20');logger[_0x2798('0x9')](config[_0x2798('0x6')][_0x2798('0x7')],_0x2798('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x263b9f){return AES_SUPPORTED_RX[_0x2798('0xb')](_0x263b9f);}function getSupportedCiphers(){return crypto[_0x2798('0xc')]()[_0x2798('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x22ce1e){return getSupportedCiphers()[_0x2798('0xe')](_0x22ce1e)>-0x1;}function combineOptions(_0x5d39ce){var _0x8072ba={};for(var _0x2bfec0 in fileOptions){if(fileOptions[_0x2798('0xf')](_0x2bfec0)){_0x8072ba[_0x2bfec0]=fileOptions[_0x2bfec0];}}if(_0x5d39ce){for(var _0x352c9c in _0x5d39ce){if(_0x5d39ce[_0x2798('0xf')](_0x352c9c)){_0x8072ba[_0x352c9c]=_0x5d39ce[_0x352c9c];}}}return _0x8072ba;}exports[_0x2798('0x10')]=function(_0x54eaf8,_0x19318d,_0x5abda9,_0x575132){return new BPromise(function(_0xdb4e37,_0x17dc0d){_0x575132=combineOptions(_0x575132);var _0x302194=new Buffer(_0x5abda9);var _0x4ee825=fs[_0x2798('0x11')](_0x54eaf8);var _0x5a33c9=fs['createWriteStream'](_0x19318d);var _0x528fe0=crypto['createCipher'](_0x575132[_0x2798('0x7')],_0x302194);_0x4ee825['on']('data',function(_0x2037f2){var _0x8429f=new Buffer(_0x528fe0[_0x2798('0x12')](_0x2037f2),_0x2798('0x13'));_0x5a33c9[_0x2798('0x14')](_0x8429f);});_0x4ee825['on'](_0x2798('0x15'),function(){try{var _0x16d173=new Buffer(_0x528fe0[_0x2798('0x16')](_0x2798('0x13')),_0x2798('0x13'));_0x5a33c9['write'](_0x16d173);_0x5a33c9[_0x2798('0x15')]();_0x5a33c9['on'](_0x2798('0x17'),function(){return _0xdb4e37(_0x19318d);});}catch(_0xaf9b7b){fs[_0x2798('0x18')](_0x19318d);return _0x17dc0d(_0xaf9b7b);}});});};exports['decryptFile']=function(_0x2b63af,_0xbeb919,_0x34b238,_0x59f132){return new BPromise(function(_0x579941,_0x30f55e){_0x59f132=combineOptions(_0x59f132);var _0x26c014=new Buffer(_0x34b238);var _0x324811=fs['createReadStream'](_0x2b63af);var _0x37b8d5=fs[_0x2798('0x19')](_0xbeb919);var _0x270650=crypto[_0x2798('0x1a')](_0x59f132[_0x2798('0x7')],_0x26c014);_0x324811['on'](_0x2798('0x1b'),function(_0x3ba2a9){var _0x358647=new Buffer(_0x270650[_0x2798('0x12')](_0x3ba2a9),_0x2798('0x13'));_0x37b8d5[_0x2798('0x14')](_0x358647);});_0x324811['on']('end',function(){try{var _0x2d64d4=new Buffer(_0x270650[_0x2798('0x16')](_0x2798('0x13')),_0x2798('0x13'));_0x37b8d5[_0x2798('0x14')](_0x2d64d4);_0x37b8d5[_0x2798('0x15')]();_0x37b8d5['on'](_0x2798('0x17'),function(){return _0x579941(_0xbeb919);});}catch(_0x19a5ac){fs['unlink'](_0xbeb919);return _0x30f55e(_0x19a5ac);}});});};exports['encryptString']=function(_0x3c0cba,_0x9e272b,_0xab0c3a){var _0x4f3115=_0xab0c3a||stringOptions[_0x2798('0x7')];var _0x3ea498=_0x9e272b||stringOptions[_0x2798('0x1c')];var _0x33932e=crypto[_0x2798('0x1d')](_0x4f3115,_0x3ea498);var _0x5b3c00=_0x33932e[_0x2798('0x12')](_0x3c0cba,_0x2798('0x1e'),'base64');_0x5b3c00+=_0x33932e[_0x2798('0x16')](_0x2798('0x1f'));return _0x5b3c00;};exports[_0x2798('0x20')]=function(_0x237570,_0x39af44,_0x41ca3d){var _0x1a16f0=_0x41ca3d||stringOptions['algorithm'];var _0x4ea235=_0x39af44||stringOptions[_0x2798('0x1c')];var _0x2e2435=crypto[_0x2798('0x1a')](_0x1a16f0,_0x4ea235);var _0x476d68=_0x2e2435['update'](_0x237570,_0x2798('0x1f'),'utf8');_0x476d68+=_0x2e2435['final'](_0x2798('0x1e'));return _0x476d68;}; \ No newline at end of file +var _0x617a=['createWriteStream','createDecipher','secret','utf8','base64','crypto','bluebird','lodash','../../config/logger','app','secrets','aes-256-ctr','encrypt','algorithm','test','getCiphers','filter','indexOf','encryptFile','createReadStream','createCipher','data','update','binary','write','final','end','unlink','decryptFile'];(function(_0x3af70d,_0x10ad89){var _0x416e09=function(_0x534bd2){while(--_0x534bd2){_0x3af70d['push'](_0x3af70d['shift']());}};_0x416e09(++_0x10ad89);}(_0x617a,0x79));var _0xa617=function(_0x8361c3,_0x1f55de){_0x8361c3=_0x8361c3-0x0;var _0x445fa9=_0x617a[_0x8361c3];return _0x445fa9;};'use strict';var crypto=require(_0xa617('0x0'));var fs=require('fs');var BPromise=require(_0xa617('0x1'));var _=require(_0xa617('0x2'));var config=require('../../config/environment');var logger=require(_0xa617('0x3'))(_0xa617('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa617('0x5')]['session'],'algorithm':_0xa617('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0xa617('0x7')]&&config['encrypt'][_0xa617('0x8')]){var isSupported=isAlgorithmSupported(config[_0xa617('0x7')][_0xa617('0x8')]);if(isSupported){fileOptions[_0xa617('0x8')]=config[_0xa617('0x7')][_0xa617('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0xa617('0x7')][_0xa617('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x3d8ce2){return AES_SUPPORTED_RX[_0xa617('0x9')](_0x3d8ce2);}function getSupportedCiphers(){return crypto[_0xa617('0xa')]()[_0xa617('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0xd9396a){return getSupportedCiphers()[_0xa617('0xc')](_0xd9396a)>-0x1;}function combineOptions(_0xc0a7da){var _0x359ac8={};for(var _0x2d6a8b in fileOptions){if(fileOptions['hasOwnProperty'](_0x2d6a8b)){_0x359ac8[_0x2d6a8b]=fileOptions[_0x2d6a8b];}}if(_0xc0a7da){for(var _0x8eacda in _0xc0a7da){if(_0xc0a7da['hasOwnProperty'](_0x8eacda)){_0x359ac8[_0x8eacda]=_0xc0a7da[_0x8eacda];}}}return _0x359ac8;}exports[_0xa617('0xd')]=function(_0x59bf8e,_0x1b793f,_0x55f81b,_0x42f16a){return new BPromise(function(_0x232c15,_0x2dc4f4){_0x42f16a=combineOptions(_0x42f16a);var _0x1a37e7=new Buffer(_0x55f81b);var _0x1f38fd=fs[_0xa617('0xe')](_0x59bf8e);var _0x3a80b3=fs['createWriteStream'](_0x1b793f);var _0xeb4ee6=crypto[_0xa617('0xf')](_0x42f16a['algorithm'],_0x1a37e7);_0x1f38fd['on'](_0xa617('0x10'),function(_0x2b5643){var _0x18f921=new Buffer(_0xeb4ee6[_0xa617('0x11')](_0x2b5643),_0xa617('0x12'));_0x3a80b3[_0xa617('0x13')](_0x18f921);});_0x1f38fd['on']('end',function(){try{var _0x38e3b7=new Buffer(_0xeb4ee6[_0xa617('0x14')](_0xa617('0x12')),_0xa617('0x12'));_0x3a80b3[_0xa617('0x13')](_0x38e3b7);_0x3a80b3[_0xa617('0x15')]();_0x3a80b3['on']('close',function(){return _0x232c15(_0x1b793f);});}catch(_0x39d927){fs[_0xa617('0x16')](_0x1b793f);return _0x2dc4f4(_0x39d927);}});});};exports[_0xa617('0x17')]=function(_0x33bf93,_0xba4d89,_0x17e3c3,_0x5a7af5){return new BPromise(function(_0x4e9afc,_0x4f05bb){_0x5a7af5=combineOptions(_0x5a7af5);var _0x36a1b0=new Buffer(_0x17e3c3);var _0x4324d0=fs[_0xa617('0xe')](_0x33bf93);var _0x168e28=fs[_0xa617('0x18')](_0xba4d89);var _0x51dafe=crypto[_0xa617('0x19')](_0x5a7af5[_0xa617('0x8')],_0x36a1b0);_0x4324d0['on'](_0xa617('0x10'),function(_0x1fe5fb){var _0x1bd892=new Buffer(_0x51dafe[_0xa617('0x11')](_0x1fe5fb),_0xa617('0x12'));_0x168e28['write'](_0x1bd892);});_0x4324d0['on'](_0xa617('0x15'),function(){try{var _0x546ecd=new Buffer(_0x51dafe[_0xa617('0x14')](_0xa617('0x12')),_0xa617('0x12'));_0x168e28[_0xa617('0x13')](_0x546ecd);_0x168e28['end']();_0x168e28['on']('close',function(){return _0x4e9afc(_0xba4d89);});}catch(_0x410877){fs[_0xa617('0x16')](_0xba4d89);return _0x4f05bb(_0x410877);}});});};exports['encryptString']=function(_0x439eba,_0x85cf3c,_0x5eba60){var _0xa7751a=_0x5eba60||stringOptions[_0xa617('0x8')];var _0x5ec6c2=_0x85cf3c||stringOptions[_0xa617('0x1a')];var _0x47308a=crypto[_0xa617('0xf')](_0xa7751a,_0x5ec6c2);var _0x157d61=_0x47308a[_0xa617('0x11')](_0x439eba,_0xa617('0x1b'),_0xa617('0x1c'));_0x157d61+=_0x47308a[_0xa617('0x14')](_0xa617('0x1c'));return _0x157d61;};exports['decryptString']=function(_0x3ef805,_0xbcb247,_0x40192c){var _0x23cb05=_0x40192c||stringOptions[_0xa617('0x8')];var _0x569567=_0xbcb247||stringOptions[_0xa617('0x1a')];var _0x34053f=crypto['createDecipher'](_0x23cb05,_0x569567);var _0x52ad44=_0x34053f[_0xa617('0x11')](_0x3ef805,_0xa617('0x1c'),_0xa617('0x1b'));_0x52ad44+=_0x34053f[_0xa617('0x14')](_0xa617('0x1b'));return _0x52ad44;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f40fa80..01f9c5d 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 _0x0be8=['join','each','%s.%s','csv','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','find','split','then','splitSizeCsv','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename'];(function(_0x207063,_0x5eefa4){var _0x122488=function(_0x2d417d){while(--_0x2d417d){_0x207063['push'](_0x207063['shift']());}};_0x122488(++_0x5eefa4);}(_0x0be8,0x176));var _0x80be=function(_0x5dec67,_0x1a1e07){_0x5dec67=_0x5dec67-0x0;var _0x192493=_0x0be8[_0x5dec67];return _0x192493;};'use strict';var util=require(_0x80be('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x80be('0x1'));var zipdir=require(_0x80be('0x2'));var rimraf=require('rimraf');var db=require(_0x80be('0x3'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x80be('0x4'))(_0x80be('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x80be('0x6')][0x2]);var QUERY=process[_0x80be('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xfaed82,_0x3dbb28){var _0x24028c={'status':_0xfaed82};var _0x5ad9cb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3dbb28){_0x24028c[_0x80be('0x7')]=_0x3dbb28;}return db[_0x80be('0x8')][_0x80be('0x9')](_0x24028c,_0x5ad9cb);}function main(){var _0x4094ae=0x1388;var _0x579b2c;logger[_0x80be('0xa')](util[_0x80be('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x80be('0xc')));return db[_0x80be('0xd')][_0x80be('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x80be('0xf'),'splitSizeCsv']})[_0x80be('0x10')](function(_0x5da7a8){if(_0x5da7a8){_0x579b2c=_0x5da7a8;_0x4094ae=_0x579b2c[_0x80be('0x11')]||0x1388;}})[_0x80be('0x10')](function(){return dbH['sequelize']['query'](util[_0x80be('0xb')](_0x80be('0x12'),QUERY),{'type':dbH[_0x80be('0x13')][_0x80be('0x14')][_0x80be('0x15')]});})[_0x80be('0x10')](function(_0x25fec4){if(!_0x25fec4[0x0][_0x80be('0x16')]){return analyticExtractedReport(_0x80be('0x17'));}var _0x102c89=[];var _0x38030e=0x0;if(_0x579b2c[_0x80be('0xf')]){if(_0x25fec4&&_0x25fec4[_0x80be('0x18')]){var _0x450298=_['range'](_0x25fec4[0x0]['num']/_0x4094ae);var _0x15e830=Number[_0x80be('0x19')](_0x25fec4[0x0][_0x80be('0x16')]/_0x4094ae)?_0x25fec4[0x0][_0x80be('0x16')]%_0x4094ae:0x0;_0x450298[_0x80be('0x1a')](function(_0x261103){if(_0x261103>0x0){_0x38030e+=_0x4094ae;}_0x102c89['push'](dbH[_0x80be('0x13')][_0x80be('0x1b')](util['format'](_0x80be('0x1c'),QUERY,_0x4094ae,_0x38030e),{'type':dbH[_0x80be('0x13')]['QueryTypes'][_0x80be('0x15')]}));});if(_0x15e830>0x0){_0x38030e+=_0x4094ae;_0x102c89[_0x80be('0x1d')](dbH['sequelize'][_0x80be('0x1b')](util['format'](_0x80be('0x1c'),QUERY,_0x15e830,_0x38030e),{'type':dbH[_0x80be('0x13')][_0x80be('0x14')][_0x80be('0x15')]}));}}}else{_0x102c89[_0x80be('0x1d')](dbH['sequelize'][_0x80be('0x1b')](QUERY,{'type':dbH[_0x80be('0x13')][_0x80be('0x14')]['SELECT']}));}var _0x3b6395=path['dirname'](PATH);var _0x1f07f4=path[_0x80be('0x1e')](PATH,'.csv');var _0x301d6d=_0x579b2c['split']&&_0x102c89[_0x80be('0x18')]>0x1;var _0x2a4594=[];if(!fs['existsSync'](path[_0x80be('0x1f')](_0x3b6395,_0x1f07f4))&&_0x301d6d){fs['mkdirSync'](path[_0x80be('0x1f')](_0x3b6395,_0x1f07f4));}return BPromise[_0x80be('0x20')](_0x102c89,function(_0xc104e1){_0x2a4594[_0x80be('0x1d')](_0xc104e1);})[_0x80be('0x10')](function(){for(var _0x2decb9=0x0;_0x2decb9<_0x2a4594[_0x80be('0x18')];_0x2decb9+=0x1){var _0x39b2c;var _0x3e509e=_0x2a4594[_0x2decb9];if(_0x301d6d){_0x39b2c=path[_0x80be('0x1f')](_0x3b6395,_0x1f07f4,util[_0x80be('0xb')]('%s%d.%s',_0x1f07f4,_0x2decb9,'csv'));}else{_0x39b2c=path[_0x80be('0x1f')](_0x3b6395,util['format'](_0x80be('0x21'),_0x1f07f4,_0x80be('0x22')));}fs[_0x80be('0x23')](_0x39b2c,csv(_0x3e509e));}})[_0x80be('0x10')](function(){if(_0x301d6d){return new Promise(function(_0x1b4f80){zipdir(path['join'](_0x3b6395,_0x1f07f4),{'saveTo':path[_0x80be('0x1f')](_0x3b6395,util[_0x80be('0xb')](_0x80be('0x21'),_0x1f07f4,'zip'))},function(_0x12c5f8,_0x33e67a){rimraf(path['join'](_0x3b6395,_0x1f07f4),function(){});_0x1b4f80('zip\x20finished');});});}})[_0x80be('0x10')](function(){logger['info'](util[_0x80be('0xb')](_0x80be('0x24'),EXTRACTED_REPORT_ID,_0x80be('0xc')));return analyticExtractedReport(_0x80be('0x25'),_0x301d6d?util[_0x80be('0xb')](_0x80be('0x21'),_0x1f07f4,_0x301d6d?_0x80be('0x26'):'csv'):null);});})[_0x80be('0x27')](function(_0x5470e0){logger['info'](util['format'](_0x80be('0x28'),EXTRACTED_REPORT_ID,_0x80be('0xc')),util[_0x80be('0x29')](_0x5470e0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x80be('0x2a'));})[_0x80be('0x2b')](function(){process[_0x80be('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1c76=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV'];(function(_0x53fc50,_0x53e2e5){var _0x2d7cd6=function(_0x37b644){while(--_0x37b644){_0x53fc50['push'](_0x53fc50['shift']());}};_0x2d7cd6(++_0x53e2e5);}(_0x1c76,0x1c7));var _0x61c7=function(_0x32d8a6,_0x11aea1){_0x32d8a6=_0x32d8a6-0x0;var _0xc35119=_0x1c76[_0x32d8a6];return _0xc35119;};'use strict';var util=require(_0x61c7('0x0'));var path=require(_0x61c7('0x1'));var _=require(_0x61c7('0x2'));var csv=require(_0x61c7('0x3'));var fs=require('fs');var BPromise=require(_0x61c7('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x61c7('0x5'));var db=require(_0x61c7('0x6'))['db'];var dbH=require(_0x61c7('0x6'))[_0x61c7('0x7')];var logger=require(_0x61c7('0x8'))(_0x61c7('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x61c7('0xa')][0x2]);var QUERY=process[_0x61c7('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b12ee,_0x15b18c){var _0x1fcbe3={'status':_0x2b12ee};var _0x13fd65={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15b18c){_0x1fcbe3['savename']=_0x15b18c;}return db['AnalyticExtractedReport'][_0x61c7('0xb')](_0x1fcbe3,_0x13fd65);}function main(){var _0x2f1315=0x1388;var _0x12fdeb;logger[_0x61c7('0xc')](util[_0x61c7('0xd')](_0x61c7('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x61c7('0xf')][_0x61c7('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x61c7('0x11'),'splitSizeCsv']})['then'](function(_0x13d805){if(_0x13d805){_0x12fdeb=_0x13d805;_0x2f1315=_0x12fdeb[_0x61c7('0x12')]||0x1388;}})[_0x61c7('0x13')](function(){return dbH['sequelize'][_0x61c7('0x14')](util[_0x61c7('0xd')](_0x61c7('0x15'),QUERY),{'type':dbH['sequelize'][_0x61c7('0x16')][_0x61c7('0x17')]});})[_0x61c7('0x13')](function(_0x5027b1){if(!_0x5027b1[0x0][_0x61c7('0x18')]){return analyticExtractedReport('Empty');}var _0x2f56e5=[];var _0x5867b3=0x0;if(_0x12fdeb[_0x61c7('0x11')]){if(_0x5027b1&&_0x5027b1[_0x61c7('0x19')]){var _0x34b3a3=_[_0x61c7('0x1a')](_0x5027b1[0x0]['num']/_0x2f1315);var _0x2ff27e=Number[_0x61c7('0x1b')](_0x5027b1[0x0][_0x61c7('0x18')]/_0x2f1315)?_0x5027b1[0x0][_0x61c7('0x18')]%_0x2f1315:0x0;_0x34b3a3[_0x61c7('0x1c')](function(_0x220d15){if(_0x220d15>0x0){_0x5867b3+=_0x2f1315;}_0x2f56e5[_0x61c7('0x1d')](dbH[_0x61c7('0x1e')][_0x61c7('0x14')](util[_0x61c7('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2f1315,_0x5867b3),{'type':dbH[_0x61c7('0x1e')][_0x61c7('0x16')][_0x61c7('0x17')]}));});if(_0x2ff27e>0x0){_0x5867b3+=_0x2f1315;_0x2f56e5[_0x61c7('0x1d')](dbH[_0x61c7('0x1e')][_0x61c7('0x14')](util[_0x61c7('0xd')](_0x61c7('0x1f'),QUERY,_0x2ff27e,_0x5867b3),{'type':dbH[_0x61c7('0x1e')][_0x61c7('0x16')]['SELECT']}));}}}else{_0x2f56e5[_0x61c7('0x1d')](dbH[_0x61c7('0x1e')]['query'](QUERY,{'type':dbH[_0x61c7('0x1e')][_0x61c7('0x16')][_0x61c7('0x17')]}));}var _0x2ac838=path[_0x61c7('0x20')](PATH);var _0xb77d84=path['basename'](PATH,_0x61c7('0x21'));var _0x2a950f=_0x12fdeb['split']&&_0x2f56e5[_0x61c7('0x19')]>0x1;var _0x5a47f7=[];if(!fs[_0x61c7('0x22')](path[_0x61c7('0x23')](_0x2ac838,_0xb77d84))&&_0x2a950f){fs[_0x61c7('0x24')](path[_0x61c7('0x23')](_0x2ac838,_0xb77d84));}return BPromise['each'](_0x2f56e5,function(_0x20a09e){_0x5a47f7[_0x61c7('0x1d')](_0x20a09e);})[_0x61c7('0x13')](function(){for(var _0x1bd16a=0x0;_0x1bd16a<_0x5a47f7[_0x61c7('0x19')];_0x1bd16a+=0x1){var _0x2d87a7;var _0x5ac2ca=_0x5a47f7[_0x1bd16a];if(_0x2a950f){_0x2d87a7=path[_0x61c7('0x23')](_0x2ac838,_0xb77d84,util[_0x61c7('0xd')](_0x61c7('0x25'),_0xb77d84,_0x1bd16a,_0x61c7('0x26')));}else{_0x2d87a7=path['join'](_0x2ac838,util[_0x61c7('0xd')](_0x61c7('0x27'),_0xb77d84,_0x61c7('0x26')));}fs[_0x61c7('0x28')](_0x2d87a7,csv(_0x5ac2ca));}})[_0x61c7('0x13')](function(){if(_0x2a950f){return new Promise(function(_0x22f6a8){zipdir(path[_0x61c7('0x23')](_0x2ac838,_0xb77d84),{'saveTo':path[_0x61c7('0x23')](_0x2ac838,util['format'](_0x61c7('0x27'),_0xb77d84,_0x61c7('0x29')))},function(_0x3c35ae,_0x459a58){rimraf(path[_0x61c7('0x23')](_0x2ac838,_0xb77d84),function(){});_0x22f6a8(_0x61c7('0x2a'));});});}})[_0x61c7('0x13')](function(){logger['info'](util[_0x61c7('0xd')](_0x61c7('0x2b'),EXTRACTED_REPORT_ID,_0x61c7('0x2c')));return analyticExtractedReport(_0x61c7('0x2d'),_0x2a950f?util['format'](_0x61c7('0x27'),_0xb77d84,_0x2a950f?_0x61c7('0x29'):_0x61c7('0x26')):null);});})[_0x61c7('0x2e')](function(_0x9864dd){logger[_0x61c7('0xc')](util['format'](_0x61c7('0x2f'),EXTRACTED_REPORT_ID,'CSV'),util[_0x61c7('0x30')](_0x9864dd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x61c7('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d087a92..064a28a 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 _0x84b1=['savename','AnalyticExtractedReport','tableHeader','map','pick','toString','value','fill','body','push','chunk','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','length','header','pageBreak','before','landscape','\x20/\x20','Arial','black','num','Setting','find','split','splitSizePdf','then','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Completed','zip','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','error','end','createPdfFromHTML','lodash','path','moment','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','dbH','../../config/logger','argv'];(function(_0x4b721a,_0x1ea950){var _0x8e8d20=function(_0x5e0f7a){while(--_0x5e0f7a){_0x4b721a['push'](_0x4b721a['shift']());}};_0x8e8d20(++_0x1ea950);}(_0x84b1,0xfc));var _0x184b=function(_0x2f46ca,_0xc3b361){_0x2f46ca=_0x2f46ca-0x0;var _0x909288=_0x84b1[_0x2f46ca];return _0x909288;};'use strict';var _=require(_0x184b('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x184b('0x1'));var moment=require(_0x184b('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x184b('0x3'));var rimraf=require(_0x184b('0x4'));var JSDOM=require(_0x184b('0x5'))[_0x184b('0x6')];var window=new JSDOM('')[_0x184b('0x7')];var BPromise=require(_0x184b('0x8'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x184b('0x9')];var logger=require(_0x184b('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x184b('0xb')][0x2]);var QUERY=process[_0x184b('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x184b('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ce9d9,_0xa45ef6){var _0x293996={'status':_0x5ce9d9};var _0x1213c7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa45ef6){_0x293996[_0x184b('0xc')]=_0xa45ef6;}return db[_0x184b('0xd')]['update'](_0x293996,_0x1213c7);}function getHeaders(_0x97cf8b){return _['map'](_0x97cf8b,function(_0x3bf91b){return{'text':_0x3bf91b,'style':_0x184b('0xe')};});}function getRows(_0x3a5281,_0x58ae5b){return _[_0x184b('0xf')](_0x58ae5b,function(_0x50a7ba){return _(_0x50a7ba)[_0x184b('0x10')](_0x3a5281)['map'](function(_0x66418e){return _0x66418e?_[_0x184b('0x11')](_0x66418e):'';})[_0x184b('0x12')]();});}function createTable(_0x557969,_0x2ac84c){var _0x4b9489={'widths':_[_0x184b('0x13')](Array(_0x557969['length']),0x91),'heights':function(_0x2f072b){return _0x2f072b===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x29e279=getHeaders(_0x557969);_0x4b9489[_0x184b('0x14')][_0x184b('0x15')](_0x29e279);var _0x3d35d2=getRows(_0x557969,_0x2ac84c);_0x4b9489[_0x184b('0x14')]=_0x4b9489[_0x184b('0x14')]['concat'](_0x3d35d2);return _0x4b9489;}function createTables(_0x1b512b){var _0x55f77c=[];var _0x38f411=_[_0x184b('0x16')](Object[_0x184b('0x17')](_0x1b512b[0x0]),0x5);_0x38f411['forEach'](function(_0x9b881c){_0x55f77c[_0x184b('0x15')](createTable(_0x9b881c,_0x1b512b));});return _0x55f77c;}function getPDFDocDefinition(_0x56036c){var _0x17c686=util['format'](_0x184b('0x18'),NAME,EXTRACTED_REPORT[_0x184b('0x19')],moment(EXTRACTED_REPORT[_0x184b('0x1a')])[_0x184b('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x184b('0x1c')])[_0x184b('0x1b')](FORMAT));var _0x6b2e90=[];for(var _0x348f7b=0x0;_0x348f7b<_0x56036c[_0x184b('0x1d')];_0x348f7b++){var _0x272908=[];if(_0x348f7b===0x0){_0x272908[_0x184b('0x15')]({'text':_0x17c686,'style':_0x184b('0x1e')});}var _0x6068b1={'table':_0x56036c[_0x348f7b]};if(_0x348f7b>0x0){_0x6068b1[_0x184b('0x1f')]=_0x184b('0x20');_0x6068b1['margin']=[0x0,0x46,0x0,0x0];}_0x272908['push'](_0x6068b1);_0x6b2e90[_0x184b('0x15')](_0x272908);}return{'pageSize':'A4','pageOrientation':_0x184b('0x21'),'content':_0x6b2e90,'footer':function(_0xa6d8d5,_0x1b45b7){return{'text':_0xa6d8d5[_0x184b('0x11')]()+_0x184b('0x22')+_0x1b45b7,'style':'footer'};},'defaultStyle':{'font':_0x184b('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x184b('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3dbdc8){var _0x37fc4a=0x1388;var _0x4aa3cc;if(!_0x3dbdc8[0x0][_0x184b('0x25')]){return analyticExtractedReport('Empty');}return db[_0x184b('0x26')][_0x184b('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x184b('0x28'),_0x184b('0x29')]})[_0x184b('0x2a')](function(_0x175b8a){if(_0x175b8a){_0x4aa3cc=_0x175b8a;_0x37fc4a=_0x4aa3cc[_0x184b('0x29')]||0x3e8;}})[_0x184b('0x2a')](function(){var _0x522005=[];var _0xb6e16e=0x0;if(_0x4aa3cc[_0x184b('0x28')]){if(_0x3dbdc8&&_0x3dbdc8[_0x184b('0x1d')]){var _0x220092=_['range'](_0x3dbdc8[0x0][_0x184b('0x25')]/_0x37fc4a);var _0x4fdd40=Number[_0x184b('0x2b')](_0x3dbdc8[0x0][_0x184b('0x25')]/_0x37fc4a)?_0x3dbdc8[0x0]['num']%_0x37fc4a:0x0;_0x220092[_0x184b('0x2c')](function(_0x3ebfc0){if(_0x3ebfc0>0x0){_0xb6e16e+=_0x37fc4a;}_0x522005[_0x184b('0x15')](dbH['sequelize']['query'](util[_0x184b('0x1b')](_0x184b('0x2d'),QUERY,_0x37fc4a,_0xb6e16e),{'type':dbH[_0x184b('0x2e')][_0x184b('0x2f')][_0x184b('0x30')]}));});if(_0x4fdd40>0x0){_0xb6e16e+=_0x37fc4a;_0x522005['push'](dbH['sequelize'][_0x184b('0x31')](util['format'](_0x184b('0x2d'),QUERY,_0x4fdd40,_0xb6e16e),{'type':dbH[_0x184b('0x2e')][_0x184b('0x2f')][_0x184b('0x30')]}));}}}else{_0x522005[_0x184b('0x15')](dbH[_0x184b('0x2e')]['query'](QUERY,{'type':dbH[_0x184b('0x2e')]['QueryTypes'][_0x184b('0x30')]}));}var _0x7431b0=path[_0x184b('0x32')](PATH);var _0xf83b9f=path[_0x184b('0x33')](PATH,_0x184b('0x34'));var _0x5ce71d=_0x4aa3cc[_0x184b('0x28')]&&_0x522005['length']>0x1;var _0x573b05=[];if(!fs[_0x184b('0x35')](path[_0x184b('0x36')](_0x7431b0,_0xf83b9f))&&_0x5ce71d){fs['mkdirSync'](path[_0x184b('0x36')](_0x7431b0,_0xf83b9f));}return BPromise[_0x184b('0x37')](_0x522005,function(_0x1456b2){_0x573b05[_0x184b('0x15')](_0x1456b2);})[_0x184b('0x2a')](function(){var _0x540029=[];for(var _0x550d40=0x0;_0x550d40<_0x573b05[_0x184b('0x1d')];_0x550d40+=0x1){var _0x1b60c6=_0x573b05[_0x550d40];var _0x46170d=createTables(_[_0x184b('0x38')](_0x1b60c6));var _0x1eab0c;var _0x481097=getPDFDocDefinition(_0x46170d);var _0x3f65cc=getPDFPrinter();var _0xa71f36=_0x3f65cc[_0x184b('0x39')](_0x481097);if(_0x5ce71d){_0x1eab0c=path[_0x184b('0x36')](_0x7431b0,_0xf83b9f,util[_0x184b('0x1b')](_0x184b('0x3a'),_0xf83b9f,_0x550d40,_0x184b('0x3b')));}else{_0x1eab0c=path[_0x184b('0x36')](_0x7431b0,util[_0x184b('0x1b')](_0x184b('0x3c'),_0xf83b9f,_0x184b('0x3b')));}_0x540029[_0x184b('0x15')](writePDFDocument(_0xa71f36,_0x1eab0c));}return Promise[_0x184b('0x3d')](_0x540029);})['then'](function(){if(_0x5ce71d){return new Promise(function(_0x2ab088){zipdir(path[_0x184b('0x36')](_0x7431b0,_0xf83b9f),{'saveTo':path[_0x184b('0x36')](_0x7431b0,util[_0x184b('0x1b')]('%s.%s',_0xf83b9f,'zip'))},function(){rimraf(path[_0x184b('0x36')](_0x7431b0,_0xf83b9f),function(){});_0x2ab088(_0x184b('0x3e'));});});}})[_0x184b('0x2a')](function(){if(!_0x5ce71d)return;rimraf(path[_0x184b('0x36')](_0x7431b0,_0xf83b9f),function(){});})['then'](function(){logger[_0x184b('0x3f')](util[_0x184b('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x184b('0x40'),_0x5ce71d?util['format']('%s.%s',_0xf83b9f,_0x5ce71d?_0x184b('0x41'):_0x184b('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x184b('0x3f')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x184b('0x42')));return db[_0x184b('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x184b('0x2a')](function(_0x195d4f){EXTRACTED_REPORT=_0x195d4f;return dbH[_0x184b('0x2e')][_0x184b('0x31')](util[_0x184b('0x1b')](_0x184b('0x43'),QUERY),{'type':dbH[_0x184b('0x2e')][_0x184b('0x2f')][_0x184b('0x30')]});})[_0x184b('0x2a')](extractReport)[_0x184b('0x44')](function(_0x5334dd){logger[_0x184b('0x3f')](util[_0x184b('0x1b')](_0x184b('0x45'),EXTRACTED_REPORT_ID,_0x184b('0x42')),util[_0x184b('0x46')](_0x5334dd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x184b('0x47'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3b91cd=new PdfPrinter({'Arial':{'normal':__dirname+_0x184b('0x48'),'bold':__dirname+_0x184b('0x49'),'italics':__dirname+_0x184b('0x4a'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x3b91cd;}function getPDFDocDefinitionFromHTML(_0x3e68ef,_0x38213a){var _0x30614c=util['format'](_0x184b('0x4b'),_0x38213a[_0x184b('0x4c')],_0x38213a[_0x184b('0x4d')]);var _0x518084=moment()[_0x184b('0x1b')](_0x184b('0x4e'))[_0x184b('0x11')]();var _0x4abb8a=htmlToPdfmake(_0x3e68ef,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4abb8a],'defaultStyle':{'font':_0x184b('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x184b('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x184b('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x184b('0x4f')}},'header':function(){return[{'text':_0x184b('0x50'),'style':_0x184b('0x1e')}];},'footer':function(_0x462599,_0x8dd4e8){return[{'text':util[_0x184b('0x1b')](_0x184b('0x51'),_0x30614c,_0x462599,_0x8dd4e8,_0x518084),'style':_0x184b('0x52')}];}};}function writePDFDocument(_0xfa3515,_0x18d68a){return new Promise(function(_0x439f4d,_0x19ca0e){var _0x25fbef=_0xfa3515[_0x184b('0x53')](fs['createWriteStream'](_0x18d68a));_0x25fbef['on'](_0x184b('0x54'),function(){_0x439f4d('finish');});_0x25fbef['on'](_0x184b('0x55'),function(_0x54bddd){_0x19ca0e(_0x54bddd);});_0xfa3515[_0x184b('0x56')]();});}exports[_0x184b('0x57')]=function(_0x120127,_0x5d07c7){var _0x30e394=getPDFPrinter();var _0x3d9cc0=getPDFDocDefinitionFromHTML(_0x120127,_0x5d07c7);var _0x4cb264=_0x30e394[_0x184b('0x39')](_0x3d9cc0);return writePDFDocument(_0x4cb264,_0x5d07c7['path'])['catch'](function(_0x527cac){throw _0x527cac;});}; \ No newline at end of file +var _0x4627=['inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfFromHTML','path','lodash','util','moment','html-to-pdfmake','zip-dir','rimraf','JSDOM','window','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','before','margin','landscape','\x20/\x20','footer','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','zip','zip\x20finished','info','%s.%s','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0xa96d88,_0x58e025){var _0x84bc30=function(_0x144063){while(--_0x144063){_0xa96d88['push'](_0xa96d88['shift']());}};_0x84bc30(++_0x58e025);}(_0x4627,0x6c));var _0x7462=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x4627[_0x548627];return _0x844a84;};'use strict';var _=require(_0x7462('0x0'));var fs=require('fs');var util=require(_0x7462('0x1'));var path=require('path');var moment=require(_0x7462('0x2'));var htmlToPdfmake=require(_0x7462('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x7462('0x4'));var rimraf=require(_0x7462('0x5'));var JSDOM=require('jsdom')[_0x7462('0x6')];var window=new JSDOM('')[_0x7462('0x7')];var BPromise=require('bluebird');var db=require(_0x7462('0x8'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x7462('0x9'))(_0x7462('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x7462('0xb')][0x3];var PATH=process[_0x7462('0xb')][0x4];var NAME=process[_0x7462('0xb')][0x5];var FORMAT=_0x7462('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x7f796b,_0x3f216e){var _0x15f770={'status':_0x7f796b};var _0x15d7db={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f216e){_0x15f770['savename']=_0x3f216e;}return db[_0x7462('0xd')][_0x7462('0xe')](_0x15f770,_0x15d7db);}function getHeaders(_0x442177){return _[_0x7462('0xf')](_0x442177,function(_0x3a9c5e){return{'text':_0x3a9c5e,'style':_0x7462('0x10')};});}function getRows(_0x340376,_0x5b9fe8){return _['map'](_0x5b9fe8,function(_0x5df5f5){return _(_0x5df5f5)[_0x7462('0x11')](_0x340376)[_0x7462('0xf')](function(_0x2941ac){return _0x2941ac?_[_0x7462('0x12')](_0x2941ac):'';})[_0x7462('0x13')]();});}function createTable(_0x191db4,_0x192724){var _0x2a97b8={'widths':_[_0x7462('0x14')](Array(_0x191db4[_0x7462('0x15')]),0x91),'heights':function(_0x2cbe17){return _0x2cbe17===0x0?_0x7462('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5a404c=getHeaders(_0x191db4);_0x2a97b8['body']['push'](_0x5a404c);var _0x3eecf3=getRows(_0x191db4,_0x192724);_0x2a97b8[_0x7462('0x17')]=_0x2a97b8['body'][_0x7462('0x18')](_0x3eecf3);return _0x2a97b8;}function createTables(_0x2363dc){var _0xe3fe7c=[];var _0x4d706e=_[_0x7462('0x19')](Object['keys'](_0x2363dc[0x0]),0x5);_0x4d706e[_0x7462('0x1a')](function(_0x34158e){_0xe3fe7c[_0x7462('0x1b')](createTable(_0x34158e,_0x2363dc));});return _0xe3fe7c;}function getPDFDocDefinition(_0x503ad9){var _0x32c349=util['format'](_0x7462('0x1c'),NAME,EXTRACTED_REPORT[_0x7462('0x1d')],moment(EXTRACTED_REPORT[_0x7462('0x1e')])[_0x7462('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x7462('0x20')])['format'](FORMAT));var _0x3f89d0=[];for(var _0x320dae=0x0;_0x320dae<_0x503ad9[_0x7462('0x15')];_0x320dae++){var _0x2ad223=[];if(_0x320dae===0x0){_0x2ad223[_0x7462('0x1b')]({'text':_0x32c349,'style':'header'});}var _0x17cdac={'table':_0x503ad9[_0x320dae]};if(_0x320dae>0x0){_0x17cdac['pageBreak']=_0x7462('0x21');_0x17cdac[_0x7462('0x22')]=[0x0,0x46,0x0,0x0];}_0x2ad223[_0x7462('0x1b')](_0x17cdac);_0x3f89d0[_0x7462('0x1b')](_0x2ad223);}return{'pageSize':'A4','pageOrientation':_0x7462('0x23'),'content':_0x3f89d0,'footer':function(_0x1b26e4,_0x465eab){return{'text':_0x1b26e4[_0x7462('0x12')]()+_0x7462('0x24')+_0x465eab,'style':_0x7462('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7462('0x26')},'footer':{'alignment':_0x7462('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x132df5){var _0xccb672=0x1388;var _0x3c622a;if(!_0x132df5[0x0][_0x7462('0x28')]){return analyticExtractedReport(_0x7462('0x29'));}return db[_0x7462('0x2a')][_0x7462('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7462('0x2c'),_0x7462('0x2d')]})[_0x7462('0x2e')](function(_0x40cfc7){if(_0x40cfc7){_0x3c622a=_0x40cfc7;_0xccb672=_0x3c622a['splitSizePdf']||0x3e8;}})['then'](function(){var _0x17e7d3=[];var _0x5d2fb6=0x0;if(_0x3c622a['split']){if(_0x132df5&&_0x132df5[_0x7462('0x15')]){var _0x4ca9fd=_[_0x7462('0x2f')](_0x132df5[0x0][_0x7462('0x28')]/_0xccb672);var _0x15fa04=Number['isInteger'](_0x132df5[0x0]['num']/_0xccb672)?_0x132df5[0x0][_0x7462('0x28')]%_0xccb672:0x0;_0x4ca9fd[_0x7462('0x1a')](function(_0x51d740){if(_0x51d740>0x0){_0x5d2fb6+=_0xccb672;}_0x17e7d3[_0x7462('0x1b')](dbH[_0x7462('0x30')]['query'](util[_0x7462('0x1f')](_0x7462('0x31'),QUERY,_0xccb672,_0x5d2fb6),{'type':dbH[_0x7462('0x30')][_0x7462('0x32')]['SELECT']}));});if(_0x15fa04>0x0){_0x5d2fb6+=_0xccb672;_0x17e7d3[_0x7462('0x1b')](dbH[_0x7462('0x30')][_0x7462('0x33')](util['format'](_0x7462('0x31'),QUERY,_0x15fa04,_0x5d2fb6),{'type':dbH[_0x7462('0x30')]['QueryTypes'][_0x7462('0x34')]}));}}}else{_0x17e7d3[_0x7462('0x1b')](dbH[_0x7462('0x30')][_0x7462('0x33')](QUERY,{'type':dbH[_0x7462('0x30')]['QueryTypes']['SELECT']}));}var _0x12d1b8=path[_0x7462('0x35')](PATH);var _0x4cd7cf=path[_0x7462('0x36')](PATH,_0x7462('0x37'));var _0x49f531=_0x3c622a['split']&&_0x17e7d3[_0x7462('0x15')]>0x1;var _0x2b662e=[];if(!fs[_0x7462('0x38')](path[_0x7462('0x39')](_0x12d1b8,_0x4cd7cf))&&_0x49f531){fs[_0x7462('0x3a')](path[_0x7462('0x39')](_0x12d1b8,_0x4cd7cf));}return BPromise[_0x7462('0x3b')](_0x17e7d3,function(_0x12fc8c){_0x2b662e[_0x7462('0x1b')](_0x12fc8c);})[_0x7462('0x2e')](function(){var _0x37597c=[];for(var _0x30e3d1=0x0;_0x30e3d1<_0x2b662e[_0x7462('0x15')];_0x30e3d1+=0x1){var _0x39d866=_0x2b662e[_0x30e3d1];var _0x14a9b6=createTables(_[_0x7462('0x3c')](_0x39d866));var _0x2c36b2;var _0x273a44=getPDFDocDefinition(_0x14a9b6);var _0x340b0d=getPDFPrinter();var _0x182a35=_0x340b0d[_0x7462('0x3d')](_0x273a44);if(_0x49f531){_0x2c36b2=path[_0x7462('0x39')](_0x12d1b8,_0x4cd7cf,util[_0x7462('0x1f')](_0x7462('0x3e'),_0x4cd7cf,_0x30e3d1,_0x7462('0x3f')));}else{_0x2c36b2=path['join'](_0x12d1b8,util[_0x7462('0x1f')]('%s.%s',_0x4cd7cf,'pdf'));}_0x37597c[_0x7462('0x1b')](writePDFDocument(_0x182a35,_0x2c36b2));}return Promise[_0x7462('0x40')](_0x37597c);})[_0x7462('0x2e')](function(){if(_0x49f531){return new Promise(function(_0x5911bf){zipdir(path[_0x7462('0x39')](_0x12d1b8,_0x4cd7cf),{'saveTo':path[_0x7462('0x39')](_0x12d1b8,util[_0x7462('0x1f')]('%s.%s',_0x4cd7cf,_0x7462('0x41')))},function(){rimraf(path[_0x7462('0x39')](_0x12d1b8,_0x4cd7cf),function(){});_0x5911bf(_0x7462('0x42'));});});}})[_0x7462('0x2e')](function(){if(!_0x49f531)return;rimraf(path[_0x7462('0x39')](_0x12d1b8,_0x4cd7cf),function(){});})[_0x7462('0x2e')](function(){logger[_0x7462('0x43')](util[_0x7462('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x49f531?util[_0x7462('0x1f')](_0x7462('0x44'),_0x4cd7cf,_0x49f531?_0x7462('0x41'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7462('0x43')](util[_0x7462('0x1f')](_0x7462('0x45'),EXTRACTED_REPORT_ID,_0x7462('0x46')));return db[_0x7462('0xd')][_0x7462('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7462('0x2e')](function(_0x638acd){EXTRACTED_REPORT=_0x638acd;return dbH['sequelize'][_0x7462('0x33')](util[_0x7462('0x1f')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x7462('0x30')][_0x7462('0x32')]['SELECT']});})[_0x7462('0x2e')](extractReport)[_0x7462('0x48')](function(_0x321abf){logger[_0x7462('0x43')](util[_0x7462('0x1f')](_0x7462('0x49'),EXTRACTED_REPORT_ID,_0x7462('0x46')),util[_0x7462('0x4a')](_0x321abf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x7462('0x4b')](function(){process[_0x7462('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x58c506=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x7462('0x4d'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x7462('0x4e')}});return _0x58c506;}function getPDFDocDefinitionFromHTML(_0x887c8,_0x3e59e9){var _0x4f0269=util[_0x7462('0x1f')](_0x7462('0x4f'),_0x3e59e9['channel'],_0x3e59e9[_0x7462('0x50')]);var _0x520a0a=moment()[_0x7462('0x1f')](_0x7462('0x51'))[_0x7462('0x12')]();var _0x28f083=htmlToPdfmake(_0x887c8,{'window':window,'tableAutoSize':!![]});return{'content':[_0x28f083],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7462('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7462('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x7462('0x53'),'style':_0x7462('0x54')}];},'footer':function(_0x50b142,_0x5bffbd){return[{'text':util[_0x7462('0x1f')](_0x7462('0x55'),_0x4f0269,_0x50b142,_0x5bffbd,_0x520a0a),'style':'footer'}];}};}function writePDFDocument(_0x1a4a5c,_0xd7f4a0){return new Promise(function(_0x22dc3a,_0x2a0cdc){var _0x30e3c1=_0x1a4a5c['pipe'](fs[_0x7462('0x56')](_0xd7f4a0));_0x30e3c1['on'](_0x7462('0x57'),function(){_0x22dc3a(_0x7462('0x57'));});_0x30e3c1['on'](_0x7462('0x58'),function(_0x5c5896){_0x2a0cdc(_0x5c5896);});_0x1a4a5c['end']();});}exports[_0x7462('0x59')]=function(_0x2e1579,_0x3ef0c1){var _0x465e9e=getPDFPrinter();var _0x3acc19=getPDFDocDefinitionFromHTML(_0x2e1579,_0x3ef0c1);var _0x2f05de=_0x465e9e[_0x7462('0x3d')](_0x3acc19);return writePDFDocument(_0x2f05de,_0x3ef0c1[_0x7462('0x5a')])[_0x7462('0x48')](function(_0x477eba){throw _0x477eba;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ff69cd3..1b5e6d2 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 _0x68ee=['%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','mkdirSync','join','each'];(function(_0x56b495,_0x2207e8){var _0x2cb77e=function(_0x30e4a5){while(--_0x30e4a5){_0x56b495['push'](_0x56b495['shift']());}};_0x2cb77e(++_0x2207e8);}(_0x68ee,0xd3));var _0xe68e=function(_0x33e9f6,_0x584abb){_0x33e9f6=_0x33e9f6-0x0;var _0xa288fc=_0x68ee[_0x33e9f6];return _0xa288fc;};'use strict';var util=require(_0xe68e('0x0'));var path=require(_0xe68e('0x1'));var _=require(_0xe68e('0x2'));var fs=require('fs');var json2xls=require(_0xe68e('0x3'));var BPromise=require(_0xe68e('0x4'));var zipdir=require(_0xe68e('0x5'));var rimraf=require(_0xe68e('0x6'));var db=require(_0xe68e('0x7'))['db'];var dbH=require('../../mysqldb')[_0xe68e('0x8')];var logger=require('../../config/logger')(_0xe68e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe68e('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe68e('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x222f99,_0x50c4d9){var _0x3073e6={'status':_0x222f99};var _0x37d3da={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50c4d9){_0x3073e6['savename']=_0x50c4d9;}return db[_0xe68e('0xb')][_0xe68e('0xc')](_0x3073e6,_0x37d3da);}function main(){var _0x4a8a55=0x1388;var _0xe90916;logger[_0xe68e('0xd')](util[_0xe68e('0xe')](_0xe68e('0xf'),EXTRACTED_REPORT_ID,_0xe68e('0x10')));return db[_0xe68e('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe68e('0x12')]})[_0xe68e('0x13')](function(_0x4706a3){if(_0x4706a3){_0xe90916=_0x4706a3;_0x4a8a55=_0xe90916[_0xe68e('0x12')]||0x1388;}})[_0xe68e('0x13')](function(){return dbH['sequelize'][_0xe68e('0x14')](util['format'](_0xe68e('0x15'),QUERY),{'type':dbH[_0xe68e('0x16')][_0xe68e('0x17')][_0xe68e('0x18')]});})[_0xe68e('0x13')](function(_0x5b7b65){if(!_0x5b7b65[0x0][_0xe68e('0x19')]){return analyticExtractedReport(_0xe68e('0x1a'));}var _0x14a53c=[];var _0x25cc4f=0x0;if(_0xe90916['split']){if(_0x5b7b65&&_0x5b7b65[_0xe68e('0x1b')]){var _0x57aee8=_[_0xe68e('0x1c')](_0x5b7b65[0x0][_0xe68e('0x19')]/_0x4a8a55);var _0x12ccb3=Number[_0xe68e('0x1d')](_0x5b7b65[0x0][_0xe68e('0x19')]/_0x4a8a55)?_0x5b7b65[0x0][_0xe68e('0x19')]%_0x4a8a55:0x0;_0x57aee8[_0xe68e('0x1e')](function(_0x2c17da){if(_0x2c17da>0x0){_0x25cc4f+=_0x4a8a55;}_0x14a53c[_0xe68e('0x1f')](dbH[_0xe68e('0x16')][_0xe68e('0x14')](util[_0xe68e('0xe')](_0xe68e('0x20'),QUERY,_0x4a8a55,_0x25cc4f),{'type':dbH[_0xe68e('0x16')]['QueryTypes'][_0xe68e('0x18')]}));});if(_0x12ccb3>0x0){_0x25cc4f+=_0x4a8a55;_0x14a53c[_0xe68e('0x1f')](dbH[_0xe68e('0x16')][_0xe68e('0x14')](util[_0xe68e('0xe')](_0xe68e('0x20'),QUERY,_0x12ccb3,_0x25cc4f),{'type':dbH[_0xe68e('0x16')][_0xe68e('0x17')][_0xe68e('0x18')]}));}}}else{_0x14a53c['push'](dbH[_0xe68e('0x16')]['query'](QUERY,{'type':dbH[_0xe68e('0x16')][_0xe68e('0x17')][_0xe68e('0x18')]}));}var _0x180851=path['dirname'](PATH);var _0x343cd7=path[_0xe68e('0x21')](PATH,_0xe68e('0x22'));var _0x5c5a6f=_0xe90916['split']&&_0x14a53c[_0xe68e('0x1b')]>0x1;var _0x240d9c=[];if(!fs[_0xe68e('0x23')](path['join'](_0x180851,_0x343cd7))&&_0x5c5a6f){fs[_0xe68e('0x24')](path[_0xe68e('0x25')](_0x180851,_0x343cd7));}return BPromise[_0xe68e('0x26')](_0x14a53c,function(_0x53fc7c){_0x240d9c['push'](_0x53fc7c);})[_0xe68e('0x13')](function(){for(var _0x5510b3=0x0;_0x5510b3<_0x240d9c[_0xe68e('0x1b')];_0x5510b3+=0x1){var _0x34938e;var _0x3ac103=_0x240d9c[_0x5510b3];if(_0x5c5a6f){_0x34938e=path[_0xe68e('0x25')](_0x180851,_0x343cd7,util[_0xe68e('0xe')](_0xe68e('0x27'),_0x343cd7,_0x5510b3,_0xe68e('0x28')));}else{_0x34938e=path['join'](_0x180851,util[_0xe68e('0xe')](_0xe68e('0x29'),_0x343cd7,_0xe68e('0x28')));}fs[_0xe68e('0x2a')](_0x34938e,json2xls(_0x3ac103),'binary');}})[_0xe68e('0x13')](function(){if(_0x5c5a6f){return new Promise(function(_0x23cdcd){zipdir(path[_0xe68e('0x25')](_0x180851,_0x343cd7),{'saveTo':path['join'](_0x180851,util[_0xe68e('0xe')]('%s.%s',_0x343cd7,_0xe68e('0x2b')))},function(_0x4e6a27,_0x3a5809){rimraf(path['join'](_0x180851,_0x343cd7),function(){});_0x23cdcd(_0xe68e('0x2c'));});});}})[_0xe68e('0x13')](function(){logger['info'](util[_0xe68e('0xe')](_0xe68e('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xe68e('0x2e'),_0x5c5a6f?util[_0xe68e('0xe')](_0xe68e('0x29'),_0x343cd7,_0x5c5a6f?'zip':_0xe68e('0x28')):null);});})['catch'](function(_0x25c60f){logger[_0xe68e('0xd')](util[_0xe68e('0xe')](_0xe68e('0x2f'),EXTRACTED_REPORT_ID,_0xe68e('0x10')),util[_0xe68e('0x30')](_0x25c60f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xe68e('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x61fe=['join','mkdirSync','each','%s%d.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync'];(function(_0x23c3d6,_0x3b8641){var _0x2dddae=function(_0x4d10f2){while(--_0x4d10f2){_0x23c3d6['push'](_0x23c3d6['shift']());}};_0x2dddae(++_0x3b8641);}(_0x61fe,0x1be));var _0xe61f=function(_0x4acfd2,_0x159ac6){_0x4acfd2=_0x4acfd2-0x0;var _0x21a893=_0x61fe[_0x4acfd2];return _0x21a893;};'use strict';var util=require(_0xe61f('0x0'));var path=require(_0xe61f('0x1'));var _=require(_0xe61f('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xe61f('0x3'))['db'];var dbH=require(_0xe61f('0x3'))[_0xe61f('0x4')];var logger=require(_0xe61f('0x5'))(_0xe61f('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xe61f('0x7')][0x2]);var QUERY=process[_0xe61f('0x7')][0x3];var PATH=process[_0xe61f('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4cb6f6,_0x1fb913){var _0x49de53={'status':_0x4cb6f6};var _0x30a059={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1fb913){_0x49de53[_0xe61f('0x8')]=_0x1fb913;}return db[_0xe61f('0x9')]['update'](_0x49de53,_0x30a059);}function main(){var _0x530894=0x1388;var _0x58fe98;logger[_0xe61f('0xa')](util[_0xe61f('0xb')](_0xe61f('0xc'),EXTRACTED_REPORT_ID,_0xe61f('0xd')));return db[_0xe61f('0xe')][_0xe61f('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe61f('0x10'),_0xe61f('0x11')]})['then'](function(_0x9fa782){if(_0x9fa782){_0x58fe98=_0x9fa782;_0x530894=_0x58fe98[_0xe61f('0x11')]||0x1388;}})[_0xe61f('0x12')](function(){return dbH[_0xe61f('0x13')][_0xe61f('0x14')](util[_0xe61f('0xb')](_0xe61f('0x15'),QUERY),{'type':dbH[_0xe61f('0x13')][_0xe61f('0x16')][_0xe61f('0x17')]});})[_0xe61f('0x12')](function(_0x454365){if(!_0x454365[0x0][_0xe61f('0x18')]){return analyticExtractedReport(_0xe61f('0x19'));}var _0x5537c0=[];var _0x13e234=0x0;if(_0x58fe98[_0xe61f('0x10')]){if(_0x454365&&_0x454365[_0xe61f('0x1a')]){var _0x20e3bc=_[_0xe61f('0x1b')](_0x454365[0x0]['num']/_0x530894);var _0x242d85=Number['isInteger'](_0x454365[0x0]['num']/_0x530894)?_0x454365[0x0][_0xe61f('0x18')]%_0x530894:0x0;_0x20e3bc[_0xe61f('0x1c')](function(_0x42f480){if(_0x42f480>0x0){_0x13e234+=_0x530894;}_0x5537c0[_0xe61f('0x1d')](dbH[_0xe61f('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x530894,_0x13e234),{'type':dbH[_0xe61f('0x13')][_0xe61f('0x16')]['SELECT']}));});if(_0x242d85>0x0){_0x13e234+=_0x530894;_0x5537c0[_0xe61f('0x1d')](dbH[_0xe61f('0x13')][_0xe61f('0x14')](util[_0xe61f('0xb')](_0xe61f('0x1e'),QUERY,_0x242d85,_0x13e234),{'type':dbH[_0xe61f('0x13')][_0xe61f('0x16')][_0xe61f('0x17')]}));}}}else{_0x5537c0[_0xe61f('0x1d')](dbH['sequelize'][_0xe61f('0x14')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xe61f('0x17')]}));}var _0x504741=path['dirname'](PATH);var _0x32b4e6=path[_0xe61f('0x1f')](PATH,_0xe61f('0x20'));var _0x4266c6=_0x58fe98['split']&&_0x5537c0[_0xe61f('0x1a')]>0x1;var _0x550d49=[];if(!fs[_0xe61f('0x21')](path[_0xe61f('0x22')](_0x504741,_0x32b4e6))&&_0x4266c6){fs[_0xe61f('0x23')](path['join'](_0x504741,_0x32b4e6));}return BPromise[_0xe61f('0x24')](_0x5537c0,function(_0x22670e){_0x550d49[_0xe61f('0x1d')](_0x22670e);})[_0xe61f('0x12')](function(){for(var _0x18fea5=0x0;_0x18fea5<_0x550d49[_0xe61f('0x1a')];_0x18fea5+=0x1){var _0x305457;var _0x531448=_0x550d49[_0x18fea5];if(_0x4266c6){_0x305457=path[_0xe61f('0x22')](_0x504741,_0x32b4e6,util['format'](_0xe61f('0x25'),_0x32b4e6,_0x18fea5,'xlsx'));}else{_0x305457=path[_0xe61f('0x22')](_0x504741,util[_0xe61f('0xb')]('%s.%s',_0x32b4e6,'xlsx'));}fs[_0xe61f('0x26')](_0x305457,json2xls(_0x531448),_0xe61f('0x27'));}})[_0xe61f('0x12')](function(){if(_0x4266c6){return new Promise(function(_0x3905fe){zipdir(path[_0xe61f('0x22')](_0x504741,_0x32b4e6),{'saveTo':path['join'](_0x504741,util[_0xe61f('0xb')]('%s.%s',_0x32b4e6,_0xe61f('0x28')))},function(_0xcc35aa,_0x44ce60){rimraf(path['join'](_0x504741,_0x32b4e6),function(){});_0x3905fe(_0xe61f('0x29'));});});}})[_0xe61f('0x12')](function(){logger['info'](util[_0xe61f('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe61f('0xd')));return analyticExtractedReport(_0xe61f('0x2a'),_0x4266c6?util[_0xe61f('0xb')]('%s.%s',_0x32b4e6,_0x4266c6?_0xe61f('0x28'):'xlsx'):null);});})[_0xe61f('0x2b')](function(_0x175113){logger[_0xe61f('0xa')](util[_0xe61f('0xb')](_0xe61f('0x2c'),EXTRACTED_REPORT_ID,_0xe61f('0xd')),util[_0xe61f('0x2d')](_0x175113,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe61f('0x2e'));})['finally'](function(){process[_0xe61f('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 980b9bb..26d59b4 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 _0x8628=[',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','playback','hasOwnProperty','extension','push','type','format','priority','VoiceExtensionId','inbound','extensions','Set','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x8628,0x1f2));var _0x8862=function(_0x54e145,_0x18d9f8){_0x54e145=_0x54e145-0x0;var _0x3e92dd=_0x8628[_0x54e145];return _0x3e92dd;};'use strict';var _=require(_0x8862('0x0'));var util=require(_0x8862('0x1'));function rewrite(_0x6fff9,_0x8c84bd){var _0xd8f10=this;return _0x6fff9[_0x8862('0x2')][_0x8862('0x3')][_0x8862('0x4')]({'raw':!![]})[_0x8862('0x5')](function(_0x3d0eab){_0xd8f10[_0x8862('0x6')]=_0x3d0eab;return _0x6fff9['models'][_0x8862('0x7')]['findAll']({'where':{'IntervalId':_0x8c84bd[_0x8862('0x8')]},'raw':!![]});})[_0x8862('0x5')](function(_0x4e9f98){return _0x6fff9[_0x8862('0x2')][_0x8862('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x8862('0x9')](_[_0x8862('0xa')](_0x4e9f98,'exten'))}},'order':[{'raw':_0x8862('0xb')}],'raw':!![]});})[_0x8862('0x5')](function(_0x177661){var _0xc42f0f=_['filter'](_0x177661,{'priority':'1'});var _0x35242b=_[_0x8862('0xc')](_0x177661,{'isApp':0x1});var _0x1371d8=_['groupBy'](_0x35242b,_0x8862('0xd'));var _0x258a82=[_0x8862('0xe'),_0x8862('0xf')];var _0x2d059a=[];var _0x3228fa=[];for(var _0x361c31 in _0x1371d8){if(_0x1371d8[_0x8862('0x10')](_0x361c31)){_0xd8f10['priority']=0x2;_0xd8f10['extensions']=[];_0xd8f10[_0x8862('0x11')]=_['find'](_0xc42f0f,{'exten':_0x1371d8[_0x361c31][0x0]['exten']});_0xd8f10['extensions'][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':'Set','appdata':util[_0x8862('0x14')]('CDR(type)=%s',_0x1371d8[_0x361c31][0x0][_0x8862('0x13')]),'context':_0x1371d8[_0x361c31][0x0]['context'],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});if(_0x1371d8[_0x361c31][0x0][_0x8862('0x13')]===_0x8862('0x17')){_0xd8f10[_0x8862('0x18')][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':_0x8862('0x19'),'appdata':'CDR(routeid)='+_0x1371d8[_0x361c31][0x0][_0x8862('0x16')],'context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});}else if(_0x1371d8[_0x361c31][0x0][_0x8862('0x13')]===_0x8862('0x1b')){if(_0xd8f10[_0x8862('0x11')]){_0xd8f10['extensions'][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':'Set','appdata':_0x8862('0x1c')+(_0xd8f10['extension'][_0x8862('0x1d')]?_0x8862('0x1e')+_0xd8f10[_0x8862('0x11')][_0x8862('0x1d')]+'}':'${EXTEN}'),'context':_0x1371d8[_0x361c31][0x0]['context'],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});}_0xd8f10['extensions'][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':_0x8862('0x19'),'appdata':_0x8862('0x1f')+_0x1371d8[_0x361c31][0x0][_0x8862('0x16')],'context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0]['VoiceExtensionId']});var _0x2a4732=_0xd8f10[_0x8862('0x15')]++;_0xd8f10[_0x8862('0x18')][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0]['type'],'app':_0x8862('0x20'),'appdata':_0x8862('0x21')+(_0x2a4732+0x2)+_0x8862('0x22')+(_0x2a4732+0x1)+')','context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0x2a4732,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});if(_0xd8f10[_0x8862('0x11')]){_0xd8f10[_0x8862('0x18')][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':'Set','appdata':_0xd8f10[_0x8862('0x11')]['cutdigits']?_0x8862('0x23')+_0xd8f10[_0x8862('0x11')][_0x8862('0x1d')]+'}':_0x8862('0x24'),'context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0]['exten'],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0]['VoiceExtensionId']});}_0xd8f10['extensions'][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':_0x8862('0x19'),'appdata':_0x8862('0x25')+_0x1371d8[_0x361c31][0x0]['VoiceExtensionId'],'context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0]['exten'],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0]['VoiceExtensionId']});if(_0xd8f10[_0x8862('0x11')]&&_0xd8f10[_0x8862('0x11')]['hasOwnProperty']('recordingFormat')&&_0xd8f10[_0x8862('0x11')][_0x8862('0x26')]!=='none'){_0xd8f10['extensions'][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0]['type'],'app':_0x8862('0x19'),'appdata':_0x8862('0x27'),'context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0]['exten'],'priority':_0xd8f10['priority']++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});_0xd8f10['extensions'][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':'Set','appdata':_0x8862('0x28')+_0xd8f10[_0x8862('0x11')]['recordingFormat']||'wav','context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});}}_0xd8f10[_0x8862('0x18')][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':_0x8862('0x19'),'appdata':_0x8862('0x29'),'context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});_0xd8f10['extensions']['push']({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':_0x8862('0x19'),'appdata':_0x8862('0x2a'),'context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});_0xd8f10[_0x8862('0x18')][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0]['type'],'app':_0x8862('0x19'),'appdata':_0x8862('0x2b'),'context':_0x1371d8[_0x361c31][0x0]['context'],'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'priority':_0xd8f10[_0x8862('0x15')]++,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});for(var _0x5ba77b=0x0,_0x4715fd=0x0;_0x5ba77b<_0x1371d8[_0x361c31]['length'];_0x5ba77b+=0x1,_0x4715fd=0x0){var _0x47bdae=_0x1371d8[_0x361c31][_0x5ba77b];if(_0x47bdae['type']){_0x47bdae[_0x8862('0x13')]=_0x47bdae[_0x8862('0x13')][_0x8862('0x2c')]();}var _0x10d2dc=[];var _0x21ad0a=[];delete _0x47bdae['id'];delete _0x47bdae[_0x8862('0x2d')];delete _0x47bdae[_0x8862('0x2e')];var _0x521fa2=_0x47bdae['interval']!==_0x8862('0x2f')?[_0x47bdae['interval']]:_0x47bdae[_0x8862('0x8')]?_[_0x8862('0xa')](_[_0x8862('0xc')](_0xd8f10[_0x8862('0x6')],{'IntervalId':_0x47bdae[_0x8862('0x8')]}),_0x8862('0x30')):[];if(_0x47bdae[_0x8862('0x10')]('tag')){if(_0x47bdae[_0x8862('0x31')]&&_0x47bdae[_0x8862('0x31')]!=='--'){_0x10d2dc[_0x8862('0x12')]({'type':_0x47bdae[_0x8862('0x13')],'app':_0x8862('0x19'),'appdata':'CDR(tag)='+_0x47bdae[_0x8862('0x31')],'context':_0x47bdae[_0x8862('0x1a')],'exten':_0x47bdae['exten'],'priority':_0x521fa2[_0x8862('0x32')]+_0xd8f10[_0x8862('0x15')]+_0x4715fd++,'VoiceExtensionId':_0x47bdae[_0x8862('0x16')]});}}if(_0x47bdae['type']===_0x8862('0x1b')&&_0x47bdae['hasOwnProperty'](_0x8862('0x33'))){if(_0x47bdae[_0x8862('0x33')]){_0x10d2dc[_0x8862('0x12')]({'type':_0x47bdae[_0x8862('0x13')],'app':_0x8862('0x20'),'appdata':_0x8862('0x34')+_0x47bdae[_0x8862('0x33')]+')','context':_0x47bdae[_0x8862('0x1a')],'exten':_0x47bdae[_0x8862('0xd')],'priority':_0x521fa2['length']+_0xd8f10[_0x8862('0x15')]+_0x4715fd++,'VoiceExtensionId':_0x47bdae[_0x8862('0x16')]});}else{_0x10d2dc['push']({'type':_0x47bdae[_0x8862('0x13')],'app':_0x8862('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x47bdae['context'],'exten':_0x47bdae[_0x8862('0xd')],'priority':_0x521fa2[_0x8862('0x32')]+_0xd8f10[_0x8862('0x15')]+_0x4715fd++,'VoiceExtensionId':_0x47bdae['VoiceExtensionId']});}}if(_0x47bdae[_0x8862('0x10')]('answer')){if(_0x258a82['indexOf'](_0x47bdae[_0x8862('0x35')][_0x8862('0x2c')]())>=0x0&&_0x47bdae[_0x8862('0x36')]!==_0x8862('0x37')){if(_0x47bdae[_0x8862('0x38')]){_0x10d2dc['push']({'type':_0x47bdae[_0x8862('0x13')],'app':_0x8862('0x20'),'appdata':_0x8862('0x39'),'context':_0x47bdae['context'],'exten':_0x47bdae['exten'],'priority':_0x521fa2[_0x8862('0x32')]+_0xd8f10[_0x8862('0x15')]+_0x4715fd++,'VoiceExtensionId':_0x47bdae['VoiceExtensionId']});_0x10d2dc[_0x8862('0x12')]({'type':_0x47bdae[_0x8862('0x13')],'app':_0x8862('0x19'),'appdata':_0x8862('0x3a'),'context':_0x47bdae[_0x8862('0x1a')],'exten':_0x47bdae[_0x8862('0xd')],'priority':_0x521fa2[_0x8862('0x32')]+_0xd8f10[_0x8862('0x15')]+_0x4715fd++,'VoiceExtensionId':_0x47bdae[_0x8862('0x16')]});}else{_0x10d2dc[_0x8862('0x12')]({'type':_0x47bdae[_0x8862('0x13')],'app':_0x8862('0x20'),'appdata':_0x8862('0x3b'),'context':_0x47bdae[_0x8862('0x1a')],'exten':_0x47bdae[_0x8862('0xd')],'priority':_0x521fa2[_0x8862('0x32')]+_0xd8f10[_0x8862('0x15')]+_0x4715fd++,'VoiceExtensionId':_0x47bdae[_0x8862('0x16')]});_0x10d2dc[_0x8862('0x12')]({'type':_0x47bdae['type'],'app':_0x8862('0x19'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x47bdae[_0x8862('0x1a')],'exten':_0x47bdae[_0x8862('0xd')],'priority':_0x521fa2[_0x8862('0x32')]+_0xd8f10['priority']+_0x4715fd++,'VoiceExtensionId':_0x47bdae[_0x8862('0x16')]});}}}for(var _0x4a0e94=0x0;_0x4a0e94<_0x521fa2[_0x8862('0x32')];_0x4a0e94+=0x1){var _0x324553=_0xd8f10['priority']+_0x521fa2[_0x8862('0x32')];var _0xd2c4b6=_0x4a0e94===_0x521fa2[_0x8862('0x32')]-0x1?_0xd8f10[_0x8862('0x15')]+_0x10d2dc[_0x8862('0x32')]+_0x21ad0a[_0x8862('0x32')]+0x2:_0xd8f10[_0x8862('0x15')]+_0x4a0e94+0x1;_0x10d2dc[_0x8862('0x3c')](_0x4a0e94,0x0,{'type':_0x47bdae[_0x8862('0x13')],'app':_0x8862('0x3d'),'appdata':_0x521fa2[_0x4a0e94]+'?'+_0x47bdae[_0x8862('0x1a')]+_0x8862('0x3e')+_0x324553+':'+_0x47bdae[_0x8862('0x1a')]+_0x8862('0x3e')+_0xd2c4b6,'exten':_0x47bdae[_0x8862('0xd')],'context':_0x47bdae[_0x8862('0x1a')],'priority':_0xd8f10['priority']+_0x4a0e94,'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});}_0x47bdae[_0x8862('0x15')]=_0x10d2dc[_0x8862('0x32')]?_[_0x8862('0x3f')](_0x10d2dc)['priority']+0x1:_0xd8f10[_0x8862('0x15')];_0xd8f10[_0x8862('0x15')]=(_0x21ad0a[_0x8862('0x32')]?_[_0x8862('0x3f')](_0x21ad0a)[_0x8862('0x15')]:_0x47bdae['priority'])+0x1;_0xd8f10[_0x8862('0x18')]=_[_0x8862('0x40')](_0xd8f10[_0x8862('0x18')],_0x10d2dc,[_0x47bdae],_0x21ad0a);}_0xd8f10[_0x8862('0x18')][_0x8862('0x12')]({'type':_0x1371d8[_0x361c31][0x0][_0x8862('0x13')],'app':_0x8862('0x41'),'exten':_0x1371d8[_0x361c31][0x0][_0x8862('0xd')],'context':_0x1371d8[_0x361c31][0x0][_0x8862('0x1a')],'priority':_0xd8f10[_0x8862('0x15')],'VoiceExtensionId':_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]});_0x2d059a[_0x8862('0x12')](_0x1371d8[_0x361c31][0x0][_0x8862('0x16')]);_0x3228fa=_[_0x8862('0x40')](_0x3228fa,_0xd8f10[_0x8862('0x18')]);}}return _0x6fff9['transaction'](function(_0x2d6514){return _0x6fff9[_0x8862('0x2')][_0x8862('0x7')][_0x8862('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x2d059a}},'transaction':_0x2d6514})[_0x8862('0x5')](function(_0x454517){return _0x6fff9[_0x8862('0x2')][_0x8862('0x7')][_0x8862('0x43')](_[_0x8862('0x44')](_0x3228fa,_0x8862('0x15')),{'transaction':_0x2d6514});});});})['catch'](function(_0x2e9062){console[_0x8862('0x45')](_0x2e9062);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x383b=['queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','context','VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','IntervalId','tag','CDR(tag)=','length','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','transaction','destroy','catch','rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy'];(function(_0x43ec4a,_0x5e9548){var _0x1fd398=function(_0x1f1e09){while(--_0x1f1e09){_0x43ec4a['push'](_0x43ec4a['shift']());}};_0x1fd398(++_0x5e9548);}(_0x383b,0xbf));var _0xb383=function(_0x92b9a5,_0x2e8c30){_0x92b9a5=_0x92b9a5-0x0;var _0x2596d9=_0x383b[_0x92b9a5];return _0x2596d9;};'use strict';var _=require(_0xb383('0x0'));var util=require(_0xb383('0x1'));function rewrite(_0x5b50e4,_0x4a2bd3){var _0x16e6cb=this;return _0x5b50e4['models'][_0xb383('0x2')][_0xb383('0x3')]({'raw':!![]})[_0xb383('0x4')](function(_0x5b5a7d){_0x16e6cb[_0xb383('0x5')]=_0x5b5a7d;return _0x5b50e4[_0xb383('0x6')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x4a2bd3['IntervalId']},'raw':!![]});})[_0xb383('0x4')](function(_0x4e68f4){return _0x5b50e4[_0xb383('0x6')][_0xb383('0x7')][_0xb383('0x3')]({'where':{'exten':{'$in':_[_0xb383('0x8')](_['map'](_0x4e68f4,_0xb383('0x9')))}},'order':[{'raw':_0xb383('0xa')}],'raw':!![]});})['then'](function(_0x3f8c78){var _0x60ce1c=_[_0xb383('0xb')](_0x3f8c78,{'priority':'1'});var _0x3c39df=_['filter'](_0x3f8c78,{'isApp':0x1});var _0x5e092b=_[_0xb383('0xc')](_0x3c39df,_0xb383('0x9'));var _0xbba499=[_0xb383('0xd'),_0xb383('0xe')];var _0x398b35=[];var _0x2adfcd=[];for(var _0x18299a in _0x5e092b){if(_0x5e092b[_0xb383('0xf')](_0x18299a)){_0x16e6cb[_0xb383('0x10')]=0x2;_0x16e6cb[_0xb383('0x11')]=[];_0x16e6cb[_0xb383('0x12')]=_['find'](_0x60ce1c,{'exten':_0x5e092b[_0x18299a][0x0]['exten']});_0x16e6cb['extensions'][_0xb383('0x13')]({'type':_0x5e092b[_0x18299a][0x0][_0xb383('0x14')],'app':_0xb383('0x15'),'appdata':util[_0xb383('0x16')]('CDR(type)=%s',_0x5e092b[_0x18299a][0x0]['type']),'context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb[_0xb383('0x10')]++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});if(_0x5e092b[_0x18299a][0x0][_0xb383('0x14')]==='inbound'){_0x16e6cb[_0xb383('0x11')][_0xb383('0x13')]({'type':_0x5e092b[_0x18299a][0x0][_0xb383('0x14')],'app':_0xb383('0x15'),'appdata':_0xb383('0x19')+_0x5e092b[_0x18299a][0x0]['VoiceExtensionId'],'context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb[_0xb383('0x10')]++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0]['VoiceExtensionId']});}else if(_0x5e092b[_0x18299a][0x0][_0xb383('0x14')]===_0xb383('0x1a')){if(_0x16e6cb[_0xb383('0x12')]){_0x16e6cb['extensions']['push']({'type':_0x5e092b[_0x18299a][0x0]['type'],'app':'Set','appdata':_0xb383('0x1b')+(_0x16e6cb[_0xb383('0x12')][_0xb383('0x1c')]?_0xb383('0x1d')+_0x16e6cb[_0xb383('0x12')]['cutdigits']+'}':_0xb383('0x1e')),'context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb['priority']++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});}_0x16e6cb[_0xb383('0x11')]['push']({'type':_0x5e092b[_0x18299a][0x0][_0xb383('0x14')],'app':_0xb383('0x15'),'appdata':'CDR(routeid)='+_0x5e092b[_0x18299a][0x0][_0xb383('0x18')],'context':_0x5e092b[_0x18299a][0x0]['context'],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb[_0xb383('0x10')]++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});var _0x27650f=_0x16e6cb[_0xb383('0x10')]++;_0x16e6cb[_0xb383('0x11')][_0xb383('0x13')]({'type':_0x5e092b[_0x18299a][0x0][_0xb383('0x14')],'app':_0xb383('0x1f'),'appdata':_0xb383('0x20')+(_0x27650f+0x2)+'):Goto('+(_0x27650f+0x1)+')','context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x27650f,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});if(_0x16e6cb[_0xb383('0x12')]){_0x16e6cb[_0xb383('0x11')][_0xb383('0x13')]({'type':_0x5e092b[_0x18299a][0x0]['type'],'app':_0xb383('0x15'),'appdata':_0x16e6cb[_0xb383('0x12')][_0xb383('0x1c')]?_0xb383('0x21')+_0x16e6cb[_0xb383('0x12')][_0xb383('0x1c')]+'}':_0xb383('0x22'),'context':_0x5e092b[_0x18299a][0x0]['context'],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb[_0xb383('0x10')]++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});}_0x16e6cb['extensions']['push']({'type':_0x5e092b[_0x18299a][0x0][_0xb383('0x14')],'app':'Set','appdata':_0xb383('0x23')+_0x5e092b[_0x18299a][0x0]['VoiceExtensionId'],'context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb[_0xb383('0x10')]++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});if(_0x16e6cb[_0xb383('0x12')]&&_0x16e6cb[_0xb383('0x12')]['hasOwnProperty'](_0xb383('0x24'))&&_0x16e6cb[_0xb383('0x12')][_0xb383('0x24')]!=='none'){_0x16e6cb['extensions']['push']({'type':_0x5e092b[_0x18299a][0x0]['type'],'app':'Set','appdata':_0xb383('0x25'),'context':_0x5e092b[_0x18299a][0x0]['context'],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb['priority']++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});_0x16e6cb['extensions'][_0xb383('0x13')]({'type':_0x5e092b[_0x18299a][0x0][_0xb383('0x14')],'app':_0xb383('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x16e6cb[_0xb383('0x12')][_0xb383('0x24')]||_0xb383('0x26'),'context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb['priority']++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});}}_0x16e6cb[_0xb383('0x11')][_0xb383('0x13')]({'type':_0x5e092b[_0x18299a][0x0][_0xb383('0x14')],'app':_0xb383('0x15'),'appdata':_0xb383('0x27'),'context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0]['exten'],'priority':_0x16e6cb[_0xb383('0x10')]++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});_0x16e6cb['extensions']['push']({'type':_0x5e092b[_0x18299a][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'priority':_0x16e6cb['priority']++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});_0x16e6cb['extensions'][_0xb383('0x13')]({'type':_0x5e092b[_0x18299a][0x0]['type'],'app':'Set','appdata':_0xb383('0x28'),'context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'exten':_0x5e092b[_0x18299a][0x0]['exten'],'priority':_0x16e6cb[_0xb383('0x10')]++,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});for(var _0x450a6c=0x0,_0x27c543=0x0;_0x450a6c<_0x5e092b[_0x18299a]['length'];_0x450a6c+=0x1,_0x27c543=0x0){var _0x379afe=_0x5e092b[_0x18299a][_0x450a6c];if(_0x379afe[_0xb383('0x14')]){_0x379afe[_0xb383('0x14')]=_0x379afe[_0xb383('0x14')][_0xb383('0x29')]();}var _0xc53bbb=[];var _0x38cb83=[];delete _0x379afe['id'];delete _0x379afe[_0xb383('0x2a')];delete _0x379afe[_0xb383('0x2b')];var _0x479a51=_0x379afe[_0xb383('0x2c')]!==_0xb383('0x2d')?[_0x379afe['interval']]:_0x379afe['IntervalId']?_[_0xb383('0x2e')](_[_0xb383('0xb')](_0x16e6cb['intervals'],{'IntervalId':_0x379afe[_0xb383('0x2f')]}),_0xb383('0x2c')):[];if(_0x379afe[_0xb383('0xf')](_0xb383('0x30'))){if(_0x379afe['tag']&&_0x379afe[_0xb383('0x30')]!=='--'){_0xc53bbb[_0xb383('0x13')]({'type':_0x379afe[_0xb383('0x14')],'app':_0xb383('0x15'),'appdata':_0xb383('0x31')+_0x379afe[_0xb383('0x30')],'context':_0x379afe[_0xb383('0x17')],'exten':_0x379afe[_0xb383('0x9')],'priority':_0x479a51[_0xb383('0x32')]+_0x16e6cb[_0xb383('0x10')]+_0x27c543++,'VoiceExtensionId':_0x379afe[_0xb383('0x18')]});}}if(_0x379afe[_0xb383('0x14')]==='outbound'&&_0x379afe[_0xb383('0xf')](_0xb383('0x33'))){if(_0x379afe[_0xb383('0x33')]){_0xc53bbb[_0xb383('0x13')]({'type':_0x379afe[_0xb383('0x14')],'app':_0xb383('0x1f'),'appdata':_0xb383('0x34')+_0x379afe['callerID']+')','context':_0x379afe[_0xb383('0x17')],'exten':_0x379afe['exten'],'priority':_0x479a51[_0xb383('0x32')]+_0x16e6cb['priority']+_0x27c543++,'VoiceExtensionId':_0x379afe['VoiceExtensionId']});}else{_0xc53bbb[_0xb383('0x13')]({'type':_0x379afe[_0xb383('0x14')],'app':_0xb383('0x1f'),'appdata':_0xb383('0x35'),'context':_0x379afe['context'],'exten':_0x379afe['exten'],'priority':_0x479a51[_0xb383('0x32')]+_0x16e6cb[_0xb383('0x10')]+_0x27c543++,'VoiceExtensionId':_0x379afe[_0xb383('0x18')]});}}if(_0x379afe[_0xb383('0xf')](_0xb383('0x36'))){if(_0xbba499['indexOf'](_0x379afe[_0xb383('0x37')][_0xb383('0x29')]())>=0x0&&_0x379afe[_0xb383('0x38')]!==_0xb383('0x39')){if(_0x379afe['answer']){_0xc53bbb[_0xb383('0x13')]({'type':_0x379afe['type'],'app':_0xb383('0x1f'),'appdata':_0xb383('0x3a'),'context':_0x379afe[_0xb383('0x17')],'exten':_0x379afe[_0xb383('0x9')],'priority':_0x479a51[_0xb383('0x32')]+_0x16e6cb[_0xb383('0x10')]+_0x27c543++,'VoiceExtensionId':_0x379afe[_0xb383('0x18')]});_0xc53bbb[_0xb383('0x13')]({'type':_0x379afe[_0xb383('0x14')],'app':_0xb383('0x15'),'appdata':_0xb383('0x3b'),'context':_0x379afe[_0xb383('0x17')],'exten':_0x379afe[_0xb383('0x9')],'priority':_0x479a51[_0xb383('0x32')]+_0x16e6cb[_0xb383('0x10')]+_0x27c543++,'VoiceExtensionId':_0x379afe['VoiceExtensionId']});}else{_0xc53bbb[_0xb383('0x13')]({'type':_0x379afe[_0xb383('0x14')],'app':_0xb383('0x1f'),'appdata':_0xb383('0x3c'),'context':_0x379afe['context'],'exten':_0x379afe[_0xb383('0x9')],'priority':_0x479a51[_0xb383('0x32')]+_0x16e6cb['priority']+_0x27c543++,'VoiceExtensionId':_0x379afe[_0xb383('0x18')]});_0xc53bbb[_0xb383('0x13')]({'type':_0x379afe[_0xb383('0x14')],'app':_0xb383('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x379afe[_0xb383('0x17')],'exten':_0x379afe[_0xb383('0x9')],'priority':_0x479a51[_0xb383('0x32')]+_0x16e6cb['priority']+_0x27c543++,'VoiceExtensionId':_0x379afe[_0xb383('0x18')]});}}}for(var _0x53a776=0x0;_0x53a776<_0x479a51[_0xb383('0x32')];_0x53a776+=0x1){var _0x5dd427=_0x16e6cb['priority']+_0x479a51[_0xb383('0x32')];var _0x52ac63=_0x53a776===_0x479a51[_0xb383('0x32')]-0x1?_0x16e6cb[_0xb383('0x10')]+_0xc53bbb[_0xb383('0x32')]+_0x38cb83[_0xb383('0x32')]+0x2:_0x16e6cb['priority']+_0x53a776+0x1;_0xc53bbb['splice'](_0x53a776,0x0,{'type':_0x379afe['type'],'app':'GotoIfTime','appdata':_0x479a51[_0x53a776]+'?'+_0x379afe[_0xb383('0x17')]+_0xb383('0x3d')+_0x5dd427+':'+_0x379afe[_0xb383('0x17')]+_0xb383('0x3d')+_0x52ac63,'exten':_0x379afe['exten'],'context':_0x379afe[_0xb383('0x17')],'priority':_0x16e6cb[_0xb383('0x10')]+_0x53a776,'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});}_0x379afe[_0xb383('0x10')]=_0xc53bbb['length']?_[_0xb383('0x3e')](_0xc53bbb)[_0xb383('0x10')]+0x1:_0x16e6cb[_0xb383('0x10')];_0x16e6cb['priority']=(_0x38cb83[_0xb383('0x32')]?_[_0xb383('0x3e')](_0x38cb83)[_0xb383('0x10')]:_0x379afe[_0xb383('0x10')])+0x1;_0x16e6cb[_0xb383('0x11')]=_[_0xb383('0x3f')](_0x16e6cb[_0xb383('0x11')],_0xc53bbb,[_0x379afe],_0x38cb83);}_0x16e6cb[_0xb383('0x11')]['push']({'type':_0x5e092b[_0x18299a][0x0]['type'],'app':'Hangup','exten':_0x5e092b[_0x18299a][0x0][_0xb383('0x9')],'context':_0x5e092b[_0x18299a][0x0][_0xb383('0x17')],'priority':_0x16e6cb['priority'],'VoiceExtensionId':_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]});_0x398b35[_0xb383('0x13')](_0x5e092b[_0x18299a][0x0][_0xb383('0x18')]);_0x2adfcd=_['concat'](_0x2adfcd,_0x16e6cb[_0xb383('0x11')]);}}return _0x5b50e4[_0xb383('0x40')](function(_0x3c0534){return _0x5b50e4[_0xb383('0x6')]['VoiceExtension'][_0xb383('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x398b35}},'transaction':_0x3c0534})[_0xb383('0x4')](function(_0x148249){return _0x5b50e4['models'][_0xb383('0x7')]['bulkCreate'](_['sortBy'](_0x2adfcd,_0xb383('0x10')),{'transaction':_0x3c0534});});});})[_0xb383('0x42')](function(_0x19efef){console['error'](_0x19efef);});}exports[_0xb383('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8adfd4f..698c4cc 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 _0x802e=['Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','find','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','stringify','checkHopper','inspect','insert','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','into','cm_hopper','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_black','ListId\x20=\x20?','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','query','VoiceQueueId','onlyIfOpen','sequelize','VoiceQueue','Campaign','CampaignId','all','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error'];(function(_0x59c2fb,_0x42fb75){var _0x2b8607=function(_0x4b3cd5){while(--_0x4b3cd5){_0x59c2fb['push'](_0x59c2fb['shift']());}};_0x2b8607(++_0x42fb75);}(_0x802e,0xdf));var _0xe802=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x802e[_0x455c6c];return _0x488242;};'use strict';var BPromise=require(_0xe802('0x0'));var util=require('util');var _=require(_0xe802('0x1'));var fs=require('fs');var squel=require(_0xe802('0x2'));var Papa=require('papaparse');var Redis=require(_0xe802('0x3'));var db=require(_0xe802('0x4'))['db'];var config=require(_0xe802('0x5'));var logger=require(_0xe802('0x6'))(_0xe802('0x7'));config['redis']=_[_0xe802('0x8')](config[_0xe802('0x9')],{'host':_0xe802('0xa'),'port':0x18eb});var socket=require(_0xe802('0xb'))(new Redis(config['redis']));require(_0xe802('0xc'))[_0xe802('0xd')](socket);try{if(!process['argv'][0x2]||process[_0xe802('0xe')][0x2]===_0xe802('0xf')||process['argv'][0x2]===_0xe802('0x10')){throw new Error(_0xe802('0x11'));}var FILEPATH=process[_0xe802('0xe')][0x2];if(!process[_0xe802('0xe')][0x3]||process['argv'][0x3]===_0xe802('0xf')||process[_0xe802('0xe')][0x3]==='null'||!process['argv'][0x4]||process[_0xe802('0xe')][0x4]==='undefined'||process['argv'][0x4]===_0xe802('0x10')){throw new Error(_0xe802('0x12'));}var FIELDS=_[_0xe802('0x13')](process['argv'][0x3][_0xe802('0x14')](','),process[_0xe802('0xe')][0x4][_0xe802('0x14')](','));if(!process[_0xe802('0xe')][0x5]||process['argv'][0x5]===_0xe802('0xf')||process[_0xe802('0xe')][0x5]===_0xe802('0x10')){throw new Error(_0xe802('0x15'));}var LISTID=process[_0xe802('0xe')][0x5];var COMPANYID=process[_0xe802('0xe')][0x6]&&process[_0xe802('0xe')][0x6]!==_0xe802('0xf')&&process[_0xe802('0xe')][0x6]!=='null'?process[_0xe802('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xe802('0xe')][0x7]!==_0xe802('0xf')&&process[_0xe802('0xe')][0x7]!==_0xe802('0x10')?process[_0xe802('0xe')][0x7]:null;if(!process[_0xe802('0xe')][0x8]||process['argv'][0x8]===_0xe802('0xf')||process[_0xe802('0xe')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x1e68fa){logger[_0xe802('0x16')](_0x1e68fa);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(_0x46878d,_0x4501fb,_0x12dd08,_0x10442e){var _0xa91acb={'message':_0x4501fb};_0xa91acb[_0x46878d]=!![];if(_0x12dd08){_0xa91acb[_0xe802('0x17')]=_0x12dd08;}if(_0x10442e){_0xa91acb['index']=_0x10442e;}return _0xa91acb;}function isEmail(_0x3819c6){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))*$/[_0xe802('0x18')](_0x3819c6);}function checkRow(_0xad0d0e,_0x171abd,_0x29869f){return new BPromise(function(_0x105d5d,_0x2bc1e2){if(_[_0xe802('0x19')](_0xad0d0e)){return _0x2bc1e2(handleCheckRowError(_0xe802('0x16'),_0xe802('0x1a'),null,_0x29869f));}if(_0xad0d0e[_0xe802('0x1b')]&&_0xad0d0e[_0xe802('0x1b')][_0xe802('0x1c')]){var _0x4f7e02=_['map'](_0xad0d0e[_0xe802('0x1b')],_0xe802('0x1d'))['join'](';');return _0x2bc1e2(handleCheckRowError(_0xe802('0x16'),_0x4f7e02,null,_0x29869f));}var _0x5c28f6={};for(var _0x565929 in FIELDS){if(FIELDS[_0xe802('0x1e')](_0x565929)&&FIELDS[_0x565929]){_0x5c28f6[_0x565929]=_0xad0d0e[_0xe802('0x1f')][0x0][FIELDS[_0x565929]]||_0xad0d0e[_0xe802('0x1f')][0x0]['\ufeff'+FIELDS[_0x565929]];}}if(!_0x5c28f6['firstName']){return _0x2bc1e2(handleCheckRowError(_0xe802('0x16'),_0xe802('0x20'),null,_0x29869f));}if(!_0x5c28f6['phone']){return _0x2bc1e2(handleCheckRowError('error',_0xe802('0x21'),null,_0x29869f));}if(_0x5c28f6[_0xe802('0x22')]){var _0x43af29=moment(_0x5c28f6['birthDate'],_0xe802('0x23'));if(!_0x43af29[_0xe802('0x24')]()){return _0x2bc1e2(handleCheckRowError(_0xe802('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x29869f));}}if(_0x5c28f6['email']){if(!isEmail(_0x5c28f6[_0xe802('0x25')])){return _0x2bc1e2(handleCheckRowError(_0xe802('0x16'),_0xe802('0x26'),null,_0x29869f));}}_0x5c28f6[_0xe802('0x27')]=LISTID;_0x5c28f6['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x171abd){var _0x186c45={};for(var _0xe85140=0x0,_0x98f487=DUPLICATES['length'];_0xe85140<_0x98f487;_0xe85140+=0x1){_0x186c45[DUPLICATES[_0xe85140]]=_0x5c28f6[DUPLICATES[_0xe85140]];}var _0x15080c=_[_0xe802('0x28')](_0x171abd,_0x186c45);if(_0x15080c){return _0x2bc1e2(handleCheckRowError('duplicate',_0xe802('0x29'),_0x15080c,_0x29869f));}}return db[_0xe802('0x2a')][_0xe802('0x2b')](_0x5c28f6,{'raw':!![],'hooks':![],'fields':_[_0xe802('0x2c')](_0x5c28f6)})[_0xe802('0x2d')](function(_0x585904){if(DUPLICATES&&DUPLICATES[_0xe802('0x1c')]&&_0x171abd){_0x171abd['push'](_[_0xe802('0x2e')](_0x5c28f6,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x585904['id'];return _0x105d5d();})[_0xe802('0x2f')](function(_0x262843){return _0x2bc1e2(handleCheckRowError(_0xe802('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x262843[_0xe802('0x1d')]||JSON[_0xe802('0x30')](_0x262843)),null,_0x29869f));});});}function checkHopper(){function _0x53b326(){return function(_0xc7a65f){logger[_0xe802('0x16')]('cmContact',_0xe802('0x31'),util[_0xe802('0x32')](_0xc7a65f,{'showHidden':![],'depth':null}));};}var _0x3b7478=function(_0x1c5a18,_0x3b871){var _0x1f5cb2=squel[_0xe802('0x33')]()['into']('cm_hopper')['fromQuery']([_0xe802('0x34'),_0xe802('0x35'),_0xe802('0x36'),_0xe802('0x27'),_0x3b871,_0xe802('0x37'),_0xe802('0x38')],squel[_0xe802('0x39')]()[_0xe802('0x3a')](_0xe802('0x34'),_0xe802('0x34'))[_0xe802('0x3a')](_0xe802('0x3b'),_0xe802('0x35'))[_0xe802('0x3a')]('id',_0xe802('0x36'))['field'](LISTID[_0xe802('0x3c')](),'ListId')[_0xe802('0x3a')](_0x1c5a18['id'][_0xe802('0x3c')](),_0x3b871)[_0xe802('0x3a')]('NOW()',_0xe802('0x37'))[_0xe802('0x3a')](_0xe802('0x3b'),_0xe802('0x38'))['from'](_0xe802('0x3d'))[_0xe802('0x3e')](_0xe802('0x3f'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xe802('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xe802('0x3e')](_0xe802('0x40'),squel[_0xe802('0x39')]()[_0xe802('0x3a')](_0xe802('0x34'))[_0xe802('0x41')]('cm_hopper')[_0xe802('0x3e')](_0x3b871+_0xe802('0x42'),_0x1c5a18['id'][_0xe802('0x3c')]())))[_0xe802('0x3c')]();return _0x1f5cb2;};var _0xf702f9=function(_0x8ecf3a,_0x2c39ec){var _0x2a7c71=squel[_0xe802('0x33')]()[_0xe802('0x43')](_0xe802('0x44'))[_0xe802('0x45')](['phone',_0xe802('0x35'),_0xe802('0x36'),_0xe802('0x27'),_0x2c39ec,_0xe802('0x37'),_0xe802('0x38')],squel[_0xe802('0x39')]()[_0xe802('0x3a')]('phone',_0xe802('0x34'))['field'](_0xe802('0x3b'),'scheduledAt')['field']('id',_0xe802('0x36'))['field'](LISTID[_0xe802('0x3c')](),_0xe802('0x27'))['field'](_0x8ecf3a['id']['toString'](),_0x2c39ec)[_0xe802('0x3a')](_0xe802('0x3b'),_0xe802('0x37'))[_0xe802('0x3a')](_0xe802('0x3b'),'updatedAt')['from'](_0xe802('0x3d'))[_0xe802('0x3e')](_0xe802('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0xe802('0x3c')]())[_0xe802('0x3e')](_0xe802('0x46'),squel[_0xe802('0x47')](hopperContacts))['where'](_0xe802('0x48'))['where'](_0xe802('0x40'),squel[_0xe802('0x39')]()[_0xe802('0x3a')](_0xe802('0x49'))[_0xe802('0x41')]('cm_hopper_final')[_0xe802('0x3e')](_0x2c39ec+'\x20=\x20?',_0x8ecf3a['id']['toString']()))[_0xe802('0x3e')](_0xe802('0x40'),squel['select']()[_0xe802('0x3a')](_0xe802('0x34'))['from'](_0xe802('0x44'))[_0xe802('0x3e')](_0x2c39ec+'\x20=\x20?',_0x8ecf3a['id'][_0xe802('0x3c')]())))[_0xe802('0x3c')]();return _0x2a7c71;};function _0x736b6b(_0x2f3bcd,_0x1e07fd){var _0x5ebef8=squel[_0xe802('0x33')]()[_0xe802('0x43')](_0xe802('0x44'))[_0xe802('0x45')](['phone','scheduledAt',_0xe802('0x36'),_0xe802('0x27'),_0x1e07fd,_0xe802('0x37'),_0xe802('0x38')],squel[_0xe802('0x39')]()[_0xe802('0x3a')](_0xe802('0x34'),'phone')[_0xe802('0x3a')](_0xe802('0x3b'),_0xe802('0x35'))[_0xe802('0x3a')]('id','ContactId')['field'](LISTID['toString'](),_0xe802('0x27'))['field'](_0x2f3bcd['id'][_0xe802('0x3c')](),_0x1e07fd)[_0xe802('0x3a')]('NOW()',_0xe802('0x37'))['field'](_0xe802('0x3b'),_0xe802('0x38'))[_0xe802('0x41')]('cm_contacts')[_0xe802('0x3e')](_0xe802('0x3f'))[_0xe802('0x3e')]('ListId\x20=\x20?',LISTID['toString']())[_0xe802('0x3e')](_0xe802('0x46'),squel[_0xe802('0x47')](hopperContacts))[_0xe802('0x3e')](_0xe802('0x48')))[_0xe802('0x3c')]();return _0x5ebef8;}function _0x1ae10e(_0x2bd9f8,_0x496aa7){var _0x55ecb1=squel[_0xe802('0x33')]()[_0xe802('0x43')](_0xe802('0x4a'))[_0xe802('0x45')]([_0xe802('0x34'),_0xe802('0x36'),'ListId',_0x496aa7,_0xe802('0x37'),_0xe802('0x38')],squel[_0xe802('0x39')]()[_0xe802('0x3a')](_0xe802('0x34'),_0xe802('0x34'))[_0xe802('0x3a')]('id','ContactId')[_0xe802('0x3a')](LISTID['toString'](),_0xe802('0x27'))[_0xe802('0x3a')](_0x2bd9f8['id']['toString'](),_0x496aa7)[_0xe802('0x3a')](_0xe802('0x3b'),_0xe802('0x37'))[_0xe802('0x3a')]('NOW()','updatedAt')[_0xe802('0x41')]('cm_contacts')[_0xe802('0x3e')](_0xe802('0x3f'))[_0xe802('0x3e')](_0xe802('0x4b'),LISTID[_0xe802('0x3c')]())['where'](_0xe802('0x46'),squel[_0xe802('0x47')](hopperContacts))[_0xe802('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xe802('0x3c')]();return _0x55ecb1;}return db['VoiceQueue'][_0xe802('0x4c')]({'where':{'type':_0xe802('0x4d')},'attributes':['id',_0xe802('0x4e')],'include':[{'model':db[_0xe802('0x4f')],'as':_0xe802('0x50'),'where':{'id':LISTID}}]})[_0xe802('0x2d')](function(_0x10df21){var _0x43c0ba=[];if(_0x10df21){var _0x2ed262;for(var _0x537d01=0x0,_0x31a0ce;_0x537d01<_0x10df21[_0xe802('0x1c')];_0x537d01+=0x1){_0x31a0ce=_0x10df21[_0x537d01][_0xe802('0x51')]({'plain':!![]});switch(_0x31a0ce[_0xe802('0x4e')]){case _0xe802('0x52'):_0x43c0ba[_0xe802('0x53')](db['sequelize'][_0xe802('0x54')](_0xf702f9(_0x31a0ce,_0xe802('0x55')))[_0xe802('0x2d')](function(){})['catch'](_0x53b326()));break;case _0xe802('0x56'):_0x43c0ba[_0xe802('0x53')](db[_0xe802('0x57')][_0xe802('0x54')](_0x3b7478(_0x31a0ce,_0xe802('0x55')))['then'](function(){})[_0xe802('0x2f')](_0x53b326()));break;default:_0x43c0ba[_0xe802('0x53')](db[_0xe802('0x57')][_0xe802('0x54')](_0x736b6b(_0x31a0ce,'VoiceQueueId'))[_0xe802('0x2d')](function(){})['catch'](_0x53b326()));}}}return _0x43c0ba;})['all']()[_0xe802('0x2d')](function(){return db[_0xe802('0x58')]['findAll']({'where':{'type':_0xe802('0x4d')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x1d940b){var _0x1e37b7=[];if(_0x1d940b){var _0x144167;for(var _0x5c5b50=0x0,_0x5bd3c0;_0x5c5b50<_0x1d940b[_0xe802('0x1c')];_0x5c5b50+=0x1){_0x5bd3c0=_0x1d940b[_0x5c5b50][_0xe802('0x51')]({'plain':!![]});_0x1e37b7[_0xe802('0x53')](db[_0xe802('0x57')][_0xe802('0x54')](_0x1ae10e(_0x5bd3c0,_0xe802('0x55')))[_0xe802('0x2d')](function(){})[_0xe802('0x2f')](_0x53b326()));}}return _0x1e37b7;})['all']();})[_0xe802('0x2d')](function(){return db[_0xe802('0x59')][_0xe802('0x4c')]({'attributes':['id',_0xe802('0x4e')],'include':[{'model':db[_0xe802('0x4f')],'as':_0xe802('0x50'),'where':{'id':LISTID}}]})[_0xe802('0x2d')](function(_0x41b440){var _0x4850f9=[];if(_0x41b440){for(var _0x50f2ba=0x0,_0x16e61f;_0x50f2ba<_0x41b440['length'];_0x50f2ba+=0x1){_0x16e61f=_0x41b440[_0x50f2ba][_0xe802('0x51')]({'plain':!![]});switch(_0x16e61f[_0xe802('0x4e')]){case _0xe802('0x52'):_0x4850f9[_0xe802('0x53')](db[_0xe802('0x57')][_0xe802('0x54')](_0xf702f9(_0x16e61f,'CampaignId'))[_0xe802('0x2d')](function(){})[_0xe802('0x2f')](_0x53b326()));break;case _0xe802('0x56'):_0x4850f9[_0xe802('0x53')](db[_0xe802('0x57')]['query'](_0x3b7478(_0x16e61f,_0xe802('0x5a')))[_0xe802('0x2d')](function(){})['catch'](_0x53b326()));break;default:_0x4850f9[_0xe802('0x53')](db[_0xe802('0x57')]['query'](_0x736b6b(_0x16e61f,_0xe802('0x5a')))[_0xe802('0x2d')](function(){})[_0xe802('0x2f')](_0x53b326()));}}}return _0x4850f9;})[_0xe802('0x5b')]();})['then'](function(){return db['Campaign'][_0xe802('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xe802('0x4f')],'as':_0xe802('0x5c'),'where':{'id':LISTID}}]})[_0xe802('0x2d')](function(_0x31c515){var _0xccb40c=[];if(_0x31c515){for(var _0x1137aa=0x0,_0x33b71c;_0x1137aa<_0x31c515[_0xe802('0x1c')];_0x1137aa+=0x1){_0x33b71c=_0x31c515[_0x1137aa][_0xe802('0x51')]({'plain':!![]});_0xccb40c[_0xe802('0x53')](db['sequelize']['query'](_0x1ae10e(_0x33b71c,_0xe802('0x5a')))[_0xe802('0x2d')](function(){})[_0xe802('0x2f')](_0x53b326()));}}return _0xccb40c;})[_0xe802('0x5b')]();})[_0xe802('0x2f')](function(_0x428f78){logger[_0xe802('0x16')](_0xe802('0x5d'),'generalCheckHopper',_0x428f78[_0xe802('0x1d')]);});}var processPromises=function(_0x494576){return BPromise[_0xe802('0x5b')](promises)[_0xe802('0x2d')](function(_0x5d45f2){})[_0xe802('0x2f')](function(_0x3381f1){logger['error'](_0xe802('0x5e'),JSON[_0xe802('0x30')](_0x3381f1));})[_0xe802('0x5f')](function(){socket[_0xe802('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x494576){return _0x494576[_0xe802('0x61')]();}});};var endCsv=function(){return BPromise[_0xe802('0x62')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe802('0x2d')](function(){socket[_0xe802('0x60')](_0xe802('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe802('0x64')](FILEPATH);}catch(_0x5d8ad2){logger[_0xe802('0x16')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x5d8ad2));}finally{process[_0xe802('0x65')](0x0);}});};process['on'](_0xe802('0x66'),function(){logger[_0xe802('0x67')](_0xe802('0x68'));endCsv();});function main(){return BPromise['resolve']()[_0xe802('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe802('0x14')](',');return db[_0xe802('0x2a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x3a3846){var _0x10365a=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe802('0x69')](_0x10365a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x45d99f,_0x21776b){total+=0x1;var _0x1b0c3e=total;promises['push'](checkRow(_0x45d99f,_0x3a3846,_0x1b0c3e)[_0xe802('0x2d')](function(){success+=0x1;})[_0xe802('0x2f')](function(_0x6f837f){if(_0x6f837f[_0xe802('0x16')]){errors+=0x1;delete _0x6f837f[_0xe802('0x16')];}else if(_0x6f837f[_0xe802('0x6a')]){duplicates+=0x1;delete _0x6f837f[_0xe802('0x6a')];}rows[_0xe802('0x53')](_0x6f837f);}));if(total%0xc8===0x0){_0x21776b[_0xe802('0x6b')]();return processPromises(_0x21776b);}},'complete':function(){return processPromises()[_0xe802('0x2d')](function(){logger[_0xe802('0x67')](_0xe802('0x6c'));endCsv();});},'error':function(_0x51c8af,_0x47effb){logger['info'](_0xe802('0x6d'),JSON[_0xe802('0x30')](_0x51c8af));endCsv();}});})[_0xe802('0x2f')](function(_0x2d80cc){logger['error'](_0xe802('0x6e'),JSON[_0xe802('0x30')](_0x2d80cc));});}main(); \ No newline at end of file +var _0x15a9=['inspect','insert','cm_hopper','fromQuery','updatedAt','select','field','phone','NOW()','scheduledAt','ContactId','toString','createdAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','into','id\x20IN\x20?','str','cm_hopper_final','\x20=\x20?','cm_hopper_black','CmList','Lists','get','dialCheckDuplicateType','sequelize','query','VoiceQueueId','onlyIfOpen','VoiceQueue','BlackLists','all','Campaign','findAll','always','CampaignId','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','map','join','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','CmContact','keys','then','length','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper'];(function(_0x536029,_0x16cd57){var _0x3b564a=function(_0x4b31c7){while(--_0x4b31c7){_0x536029['push'](_0x536029['shift']());}};_0x3b564a(++_0x16cd57);}(_0x15a9,0xa0));var _0x915a=function(_0x48af49,_0x243d64){_0x48af49=_0x48af49-0x0;var _0x339c55=_0x15a9[_0x48af49];return _0x339c55;};'use strict';var BPromise=require(_0x915a('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x915a('0x1'));var Papa=require(_0x915a('0x2'));var Redis=require(_0x915a('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x915a('0x4'));var logger=require(_0x915a('0x5'))('api');config[_0x915a('0x6')]=_[_0x915a('0x7')](config['redis'],{'host':_0x915a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x915a('0x6')]));require(_0x915a('0x9'))[_0x915a('0xa')](socket);try{if(!process[_0x915a('0xb')][0x2]||process[_0x915a('0xb')][0x2]===_0x915a('0xc')||process[_0x915a('0xb')][0x2]===_0x915a('0xd')){throw new Error(_0x915a('0xe'));}var FILEPATH=process[_0x915a('0xb')][0x2];if(!process[_0x915a('0xb')][0x3]||process[_0x915a('0xb')][0x3]===_0x915a('0xc')||process[_0x915a('0xb')][0x3]==='null'||!process[_0x915a('0xb')][0x4]||process[_0x915a('0xb')][0x4]===_0x915a('0xc')||process['argv'][0x4]===_0x915a('0xd')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x915a('0xf')](process['argv'][0x3][_0x915a('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x915a('0xb')][0x5]||process[_0x915a('0xb')][0x5]==='undefined'||process['argv'][0x5]===_0x915a('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x915a('0xb')][0x5];var COMPANYID=process[_0x915a('0xb')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x915a('0xb')][0x6]!==_0x915a('0xd')?process[_0x915a('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x915a('0xc')&&process['argv'][0x7]!==_0x915a('0xd')?process[_0x915a('0xb')][0x7]:null;if(!process[_0x915a('0xb')][0x8]||process[_0x915a('0xb')][0x8]===_0x915a('0xc')||process[_0x915a('0xb')][0x8]===_0x915a('0xd')){throw new Error(_0x915a('0x11'));}var SOCKET_TIMESTAMP=process[_0x915a('0xb')][0x8];}catch(_0x4e42c7){logger[_0x915a('0x12')](_0x4e42c7);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(_0x2ea38c,_0x4abefe,_0xb8bf8e,_0x207ea7){var _0xe37a1f={'message':_0x4abefe};_0xe37a1f[_0x2ea38c]=!![];if(_0xb8bf8e){_0xe37a1f[_0x915a('0x13')]=_0xb8bf8e;}if(_0x207ea7){_0xe37a1f[_0x915a('0x14')]=_0x207ea7;}return _0xe37a1f;}function isEmail(_0x1a0d87){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))*$/[_0x915a('0x15')](_0x1a0d87);}function checkRow(_0x33e60d,_0x5bbf14,_0x3333e8){return new BPromise(function(_0x250e42,_0x509860){if(_['isNil'](_0x33e60d)){return _0x509860(handleCheckRowError(_0x915a('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3333e8));}if(_0x33e60d[_0x915a('0x16')]&&_0x33e60d[_0x915a('0x16')]['length']){var _0xa975a=_[_0x915a('0x17')](_0x33e60d['errors'],'message')[_0x915a('0x18')](';');return _0x509860(handleCheckRowError(_0x915a('0x12'),_0xa975a,null,_0x3333e8));}var _0x4de0b6={};for(var _0x3ed6f2 in FIELDS){if(FIELDS['hasOwnProperty'](_0x3ed6f2)&&FIELDS[_0x3ed6f2]){_0x4de0b6[_0x3ed6f2]=_0x33e60d[_0x915a('0x19')][0x0][FIELDS[_0x3ed6f2]]||_0x33e60d['data'][0x0]['\ufeff'+FIELDS[_0x3ed6f2]];}}if(!_0x4de0b6[_0x915a('0x1a')]){return _0x509860(handleCheckRowError('error',_0x915a('0x1b'),null,_0x3333e8));}if(!_0x4de0b6['phone']){return _0x509860(handleCheckRowError(_0x915a('0x12'),'phone\x20not\x20specified!',null,_0x3333e8));}if(_0x4de0b6[_0x915a('0x1c')]){var _0x42d443=moment(_0x4de0b6[_0x915a('0x1c')],_0x915a('0x1d'));if(!_0x42d443[_0x915a('0x1e')]()){return _0x509860(handleCheckRowError(_0x915a('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3333e8));}}if(_0x4de0b6[_0x915a('0x1f')]){if(!isEmail(_0x4de0b6[_0x915a('0x1f')])){return _0x509860(handleCheckRowError('error',_0x915a('0x20'),null,_0x3333e8));}}_0x4de0b6[_0x915a('0x21')]=LISTID;_0x4de0b6[_0x915a('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5bbf14){var _0x523fee={};for(var _0x2e9dd0=0x0,_0x3ef117=DUPLICATES['length'];_0x2e9dd0<_0x3ef117;_0x2e9dd0+=0x1){_0x523fee[DUPLICATES[_0x2e9dd0]]=_0x4de0b6[DUPLICATES[_0x2e9dd0]];}var _0x2e876f=_['find'](_0x5bbf14,_0x523fee);if(_0x2e876f){return _0x509860(handleCheckRowError(_0x915a('0x23'),'Duplicate\x20Contact',_0x2e876f,_0x3333e8));}}return db[_0x915a('0x24')]['create'](_0x4de0b6,{'raw':!![],'hooks':![],'fields':_[_0x915a('0x25')](_0x4de0b6)})[_0x915a('0x26')](function(_0x3902a7){if(DUPLICATES&&DUPLICATES[_0x915a('0x27')]&&_0x5bbf14){_0x5bbf14[_0x915a('0x28')](_[_0x915a('0x29')](_0x4de0b6,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3902a7['id'];return _0x250e42();})[_0x915a('0x2a')](function(_0x174c23){return _0x509860(handleCheckRowError(_0x915a('0x12'),_0x915a('0x2b')+(_0x174c23['message']||JSON[_0x915a('0x2c')](_0x174c23)),null,_0x3333e8));});});}function checkHopper(){function _0x4adb64(){return function(_0x474e05){logger[_0x915a('0x12')]('cmContact',_0x915a('0x2d'),util[_0x915a('0x2e')](_0x474e05,{'showHidden':![],'depth':null}));};}var _0x1e3e25=function(_0x2ae613,_0xab87ce){var _0x3b1273=squel[_0x915a('0x2f')]()['into'](_0x915a('0x30'))[_0x915a('0x31')](['phone','scheduledAt','ContactId',_0x915a('0x21'),_0xab87ce,'createdAt',_0x915a('0x32')],squel[_0x915a('0x33')]()[_0x915a('0x34')](_0x915a('0x35'),_0x915a('0x35'))[_0x915a('0x34')](_0x915a('0x36'),_0x915a('0x37'))['field']('id',_0x915a('0x38'))['field'](LISTID[_0x915a('0x39')](),_0x915a('0x21'))[_0x915a('0x34')](_0x2ae613['id'][_0x915a('0x39')](),_0xab87ce)['field'](_0x915a('0x36'),_0x915a('0x3a'))[_0x915a('0x34')](_0x915a('0x36'),_0x915a('0x32'))['from'](_0x915a('0x3b'))[_0x915a('0x3c')](_0x915a('0x3d'))['where'](_0x915a('0x3e'),LISTID['toString']())['where'](_0x915a('0x3f'))[_0x915a('0x3c')](_0x915a('0x40'),squel[_0x915a('0x33')]()['field'](_0x915a('0x35'))[_0x915a('0x41')](_0x915a('0x30'))['where'](_0xab87ce+'\x20=\x20?',_0x2ae613['id'][_0x915a('0x39')]())))[_0x915a('0x39')]();return _0x3b1273;};var _0x1c6b2f=function(_0x1d2564,_0x2be14f){var _0x1b4810=squel[_0x915a('0x2f')]()[_0x915a('0x42')](_0x915a('0x30'))[_0x915a('0x31')](['phone','scheduledAt',_0x915a('0x38'),'ListId',_0x2be14f,_0x915a('0x3a'),_0x915a('0x32')],squel['select']()[_0x915a('0x34')](_0x915a('0x35'),_0x915a('0x35'))['field']('NOW()',_0x915a('0x37'))[_0x915a('0x34')]('id',_0x915a('0x38'))[_0x915a('0x34')](LISTID['toString'](),'ListId')['field'](_0x1d2564['id'][_0x915a('0x39')](),_0x2be14f)['field']('NOW()',_0x915a('0x3a'))[_0x915a('0x34')](_0x915a('0x36'),_0x915a('0x32'))[_0x915a('0x41')](_0x915a('0x3b'))[_0x915a('0x3c')](_0x915a('0x3d'))[_0x915a('0x3c')](_0x915a('0x3e'),LISTID['toString']())[_0x915a('0x3c')](_0x915a('0x43'),squel[_0x915a('0x44')](hopperContacts))['where'](_0x915a('0x3f'))[_0x915a('0x3c')](_0x915a('0x40'),squel[_0x915a('0x33')]()['field']('calleridnum')[_0x915a('0x41')](_0x915a('0x45'))[_0x915a('0x3c')](_0x2be14f+_0x915a('0x46'),_0x1d2564['id'][_0x915a('0x39')]()))[_0x915a('0x3c')](_0x915a('0x40'),squel['select']()[_0x915a('0x34')](_0x915a('0x35'))[_0x915a('0x41')]('cm_hopper')['where'](_0x2be14f+'\x20=\x20?',_0x1d2564['id'][_0x915a('0x39')]())))[_0x915a('0x39')]();return _0x1b4810;};function _0x4c7f92(_0x39e1e6,_0x199d40){var _0xfb1b55=squel[_0x915a('0x2f')]()['into'](_0x915a('0x30'))[_0x915a('0x31')](['phone',_0x915a('0x37'),_0x915a('0x38'),_0x915a('0x21'),_0x199d40,_0x915a('0x3a'),_0x915a('0x32')],squel[_0x915a('0x33')]()['field'](_0x915a('0x35'),_0x915a('0x35'))[_0x915a('0x34')](_0x915a('0x36'),_0x915a('0x37'))[_0x915a('0x34')]('id',_0x915a('0x38'))[_0x915a('0x34')](LISTID[_0x915a('0x39')](),_0x915a('0x21'))[_0x915a('0x34')](_0x39e1e6['id'][_0x915a('0x39')](),_0x199d40)[_0x915a('0x34')](_0x915a('0x36'),'createdAt')[_0x915a('0x34')](_0x915a('0x36'),_0x915a('0x32'))[_0x915a('0x41')](_0x915a('0x3b'))[_0x915a('0x3c')](_0x915a('0x3d'))[_0x915a('0x3c')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x915a('0x43'),squel[_0x915a('0x44')](hopperContacts))[_0x915a('0x3c')](_0x915a('0x3f')))['toString']();return _0xfb1b55;}function _0x144238(_0x46b0b8,_0x3f671d){var _0x5a4390=squel['insert']()[_0x915a('0x42')](_0x915a('0x47'))[_0x915a('0x31')]([_0x915a('0x35'),_0x915a('0x38'),_0x915a('0x21'),_0x3f671d,_0x915a('0x3a'),'updatedAt'],squel[_0x915a('0x33')]()['field']('phone',_0x915a('0x35'))['field']('id',_0x915a('0x38'))[_0x915a('0x34')](LISTID['toString'](),_0x915a('0x21'))['field'](_0x46b0b8['id'][_0x915a('0x39')](),_0x3f671d)['field'](_0x915a('0x36'),_0x915a('0x3a'))[_0x915a('0x34')](_0x915a('0x36'),_0x915a('0x32'))[_0x915a('0x41')]('cm_contacts')[_0x915a('0x3c')](_0x915a('0x3d'))[_0x915a('0x3c')](_0x915a('0x3e'),LISTID[_0x915a('0x39')]())[_0x915a('0x3c')](_0x915a('0x43'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x5a4390;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x915a('0x48')],'as':_0x915a('0x49'),'where':{'id':LISTID}}]})[_0x915a('0x26')](function(_0x346b1d){var _0x4f211c=[];if(_0x346b1d){var _0x24940b;for(var _0x12d10a=0x0,_0x55e2a0;_0x12d10a<_0x346b1d[_0x915a('0x27')];_0x12d10a+=0x1){_0x55e2a0=_0x346b1d[_0x12d10a][_0x915a('0x4a')]({'plain':!![]});switch(_0x55e2a0[_0x915a('0x4b')]){case'always':_0x4f211c['push'](db[_0x915a('0x4c')][_0x915a('0x4d')](_0x1c6b2f(_0x55e2a0,_0x915a('0x4e')))[_0x915a('0x26')](function(){})[_0x915a('0x2a')](_0x4adb64()));break;case _0x915a('0x4f'):_0x4f211c[_0x915a('0x28')](db['sequelize'][_0x915a('0x4d')](_0x1e3e25(_0x55e2a0,_0x915a('0x4e')))[_0x915a('0x26')](function(){})[_0x915a('0x2a')](_0x4adb64()));break;default:_0x4f211c['push'](db['sequelize'][_0x915a('0x4d')](_0x4c7f92(_0x55e2a0,'VoiceQueueId'))[_0x915a('0x26')](function(){})['catch'](_0x4adb64()));}}}return _0x4f211c;})['all']()['then'](function(){return db[_0x915a('0x50')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x915a('0x51'),'where':{'id':LISTID}}]})[_0x915a('0x26')](function(_0xdfde3f){var _0x360833=[];if(_0xdfde3f){var _0x290ab2;for(var _0x830c88=0x0,_0x24e2e4;_0x830c88<_0xdfde3f[_0x915a('0x27')];_0x830c88+=0x1){_0x24e2e4=_0xdfde3f[_0x830c88]['get']({'plain':!![]});_0x360833[_0x915a('0x28')](db[_0x915a('0x4c')][_0x915a('0x4d')](_0x144238(_0x24e2e4,_0x915a('0x4e')))[_0x915a('0x26')](function(){})['catch'](_0x4adb64()));}}return _0x360833;})[_0x915a('0x52')]();})[_0x915a('0x26')](function(){return db[_0x915a('0x53')][_0x915a('0x54')]({'attributes':['id',_0x915a('0x4b')],'include':[{'model':db[_0x915a('0x48')],'as':_0x915a('0x49'),'where':{'id':LISTID}}]})[_0x915a('0x26')](function(_0x1708f5){var _0x5ad023=[];if(_0x1708f5){for(var _0x2b5146=0x0,_0x3e076b;_0x2b5146<_0x1708f5['length'];_0x2b5146+=0x1){_0x3e076b=_0x1708f5[_0x2b5146][_0x915a('0x4a')]({'plain':!![]});switch(_0x3e076b[_0x915a('0x4b')]){case _0x915a('0x55'):_0x5ad023['push'](db['sequelize'][_0x915a('0x4d')](_0x1c6b2f(_0x3e076b,'CampaignId'))[_0x915a('0x26')](function(){})[_0x915a('0x2a')](_0x4adb64()));break;case _0x915a('0x4f'):_0x5ad023[_0x915a('0x28')](db[_0x915a('0x4c')]['query'](_0x1e3e25(_0x3e076b,_0x915a('0x56')))[_0x915a('0x26')](function(){})[_0x915a('0x2a')](_0x4adb64()));break;default:_0x5ad023['push'](db[_0x915a('0x4c')][_0x915a('0x4d')](_0x4c7f92(_0x3e076b,_0x915a('0x56')))[_0x915a('0x26')](function(){})['catch'](_0x4adb64()));}}}return _0x5ad023;})[_0x915a('0x52')]();})[_0x915a('0x26')](function(){return db['Campaign'][_0x915a('0x54')]({'attributes':['id'],'include':[{'model':db[_0x915a('0x48')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x915a('0x26')](function(_0x375b26){var _0x1cff69=[];if(_0x375b26){for(var _0x4799b9=0x0,_0x56a69d;_0x4799b9<_0x375b26[_0x915a('0x27')];_0x4799b9+=0x1){_0x56a69d=_0x375b26[_0x4799b9]['get']({'plain':!![]});_0x1cff69[_0x915a('0x28')](db[_0x915a('0x4c')][_0x915a('0x4d')](_0x144238(_0x56a69d,'CampaignId'))[_0x915a('0x26')](function(){})['catch'](_0x4adb64()));}}return _0x1cff69;})[_0x915a('0x52')]();})[_0x915a('0x2a')](function(_0x38e850){logger[_0x915a('0x12')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x38e850['message']);});}var processPromises=function(_0x5e1bfd){return BPromise['all'](promises)['then'](function(_0x4d6985){})[_0x915a('0x2a')](function(_0x4998b7){logger['error'](_0x915a('0x57'),JSON[_0x915a('0x2c')](_0x4998b7));})[_0x915a('0x58')](function(){socket[_0x915a('0x59')](_0x915a('0x5a')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5e1bfd){return _0x5e1bfd[_0x915a('0x5b')]();}});};var endCsv=function(){return BPromise[_0x915a('0x5c')]()[_0x915a('0x26')](function(){if(hopperContacts){return checkHopper();}})[_0x915a('0x26')](function(){socket[_0x915a('0x59')](_0x915a('0x5a')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x915a('0x5d')](FILEPATH);}catch(_0x547f94){logger[_0x915a('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x915a('0x2c')](_0x547f94));}finally{process[_0x915a('0x5e')](0x0);}});};process['on']('SIGINT',function(){logger[_0x915a('0x5f')](_0x915a('0x60'));endCsv();});function main(){return BPromise['resolve']()[_0x915a('0x26')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x915a('0x24')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x915a('0x26')](function(_0x5bd907){var _0x37fbfc=fs[_0x915a('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x915a('0x62')](_0x37fbfc,{'header':!![],'skipEmptyLines':!![],'step':function(_0x114aaf,_0x5cd6a8){total+=0x1;var _0x35c377=total;promises[_0x915a('0x28')](checkRow(_0x114aaf,_0x5bd907,_0x35c377)[_0x915a('0x26')](function(){success+=0x1;})[_0x915a('0x2a')](function(_0x5a5dd7){if(_0x5a5dd7[_0x915a('0x12')]){errors+=0x1;delete _0x5a5dd7[_0x915a('0x12')];}else if(_0x5a5dd7[_0x915a('0x23')]){duplicates+=0x1;delete _0x5a5dd7[_0x915a('0x23')];}rows[_0x915a('0x28')](_0x5a5dd7);}));if(total%0xc8===0x0){_0x5cd6a8[_0x915a('0x63')]();return processPromises(_0x5cd6a8);}},'complete':function(){return processPromises()[_0x915a('0x26')](function(){logger['info'](_0x915a('0x64'));endCsv();});},'error':function(_0xe11603,_0x5c9082){logger[_0x915a('0x5f')](_0x915a('0x65'),JSON[_0x915a('0x2c')](_0xe11603));endCsv();}});})['catch'](function(_0x427454){logger[_0x915a('0x12')](_0x915a('0x66'),JSON[_0x915a('0x2c')](_0x427454));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3ce83f0..996d9b6 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 _0xe632=['lodash','papaparse','util','bluebird','moment','squel','ioredis','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','push','all','split','length','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','select','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','\x20=\x20','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','MIN(id)','group','info','error','message','exit','errors','code','sequelize','query','spread','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','.csv','includes','header','ContactItemType','name','_description','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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','DROP\x20TABLE\x20','contactId','contactTypeId','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path'];(function(_0x34145e,_0x4a4c6){var _0x26b867=function(_0x510831){while(--_0x510831){_0x34145e['push'](_0x34145e['shift']());}};_0x26b867(++_0x4a4c6);}(_0xe632,0xb9));var _0x2e63=function(_0x39467e,_0x4c3e09){_0x39467e=_0x39467e-0x0;var _0x1aeb95=_0xe632[_0x39467e];return _0x1aeb95;};'use strict';var fs=require('fs');var path=require(_0x2e63('0x0'));var _=require(_0x2e63('0x1'));var Papa=require(_0x2e63('0x2'));var util=require(_0x2e63('0x3'));var BPromise=require(_0x2e63('0x4'));var moment=require(_0x2e63('0x5'));var squel=require(_0x2e63('0x6'));var Redis=require(_0x2e63('0x7'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0x2e63('0x8'));config[_0x2e63('0x9')]=_[_0x2e63('0xa')](config['redis'],{'host':_0x2e63('0xb'),'port':0x18eb});var socket=require(_0x2e63('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x2e63('0xd')](_0x2e63('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x2e63('0xd')](_0x2e63('0xe'));function isEmail(_0xef97a9){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))*$/[_0x2e63('0xf')](_0xef97a9);}function selectNotIn(_0x1a64e2,_0x525721,_0x205961,_0x4d880e,_0x5ee1a0){return squel['select']()[_0x2e63('0x10')](_0x2e63('0x11'))[_0x2e63('0x12')](_0x4d880e)[_0x2e63('0x13')](_0x525721,null,_0x525721+'.id\x20=\x20'+_0x4d880e+'.'+_0x205961)[_0x2e63('0x14')](_0x4d880e+'.'+_0x205961+'\x20=\x20'+_0x1a64e2+'.'+_0x205961)[_0x2e63('0x14')](_0x525721+_0x2e63('0x15')+_0x5ee1a0[_0x2e63('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x35500f,_0x27b96b){promisesAdditionalPhones=[];return db['CmContact'][_0x2e63('0x16')]({'raw':!![],'attributes':['id',_0x2e63('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x2e63('0x18')](function(_0x1bebe2){if(_0x1bebe2!==null){var _0x520998=[];for(var _0x1d0554=0x0;_0x1d0554<_0x1bebe2['length'];_0x1d0554++){var _0x59ae2d=_0x1bebe2[_0x1d0554];_0x520998[_0x2e63('0x19')](insertAdditionalPhones(_0x59ae2d));}}Promise[_0x2e63('0x1a')](_0x520998)[_0x2e63('0x18')](function(){_0x35500f({'val':0x1});});});});}function insertAdditionalPhones(_0x4af306){return new Promise(function(_0x140d9a,_0x442d5c){var _0x499529=_0x4af306[_0x2e63('0x17')];var _0x5e1e02=_0x499529[_0x2e63('0x1b')](';');var _0x5998dc=[];orderBy=0x0;for(var _0x2938e5=0x0;_0x2938e5<_0x5e1e02['length'];_0x2938e5++){_0x5998dc[_0x2e63('0x19')](splitAdditionalPhone(_0x4af306['id'],_0x5e1e02[_0x2938e5]));}Promise[_0x2e63('0x1a')](_0x5998dc)[_0x2e63('0x18')](function(){_0x140d9a({'val':_0x5e1e02[_0x2e63('0x1c')]});});});}function splitAdditionalPhone(_0x101eb9,_0x15ebbc){return new Promise(function(_0x25844f,_0x451373){var _0x3f9bad=_0x15ebbc['split'](':');var _0x755595=_0x3f9bad[0x0];var _0x284923=_0x3f9bad[0x1];if(!_['isNil'](_0x284923)){var _0x42aac5=_0x284923[_0x2e63('0x1b')]('|');var _0x596dc5=[];for(var _0x58d745=0x0;_0x58d745<_0x42aac5[_0x2e63('0x1c')];_0x58d745++){if(_0x42aac5[_0x58d745]!==''){var _0x3c86e2=_[_0x2e63('0x1d')](promisesAdditionalPhones,{'contactId':_0x101eb9,'phone':_0x42aac5[_0x58d745]});if(_0x3c86e2['length']==0x0){orderBy++;promisesAdditionalPhones[_0x2e63('0x19')]({'contactId':_0x101eb9,'contactTypeId':_0x755595,'phone':_0x42aac5[_0x58d745],'orderBy':orderBy});}}}_0x25844f({'ok':0x1});}else _0x25844f({'res':0x0});});}function createAdditionalPhone(_0x1569a8,_0x5ec96c,_0x437974,_0x502c9b){var _0x47174f='';var _0x3046b8='';var _0x14dc3d=_0x437974['split']('§');_0x47174f=_0x14dc3d[0x0];if(_0x14dc3d[_0x2e63('0x1c')]==0x2)_0x3046b8=_0x14dc3d[0x1];return new Promise(function(_0x390e6e,_0x3f7262){return db['CmContactHasItem'][_0x2e63('0x1e')]({'where':{'CmContactId':_0x1569a8,'item':_0x47174f}})[_0x2e63('0x18')](function(_0x450169){if(_0x450169){return db[_0x2e63('0x1f')][_0x2e63('0x20')]({'ItemTypeId':_0x5ec96c,'description':_0x3046b8,'OrderBy':_0x502c9b},{'where':{'CmContactId':_0x1569a8,'item':_0x47174f}})['then'](function(_0x3d4008){_0x390e6e({'res':_0x2e63('0x21')});});}else{return db[_0x2e63('0x1f')][_0x2e63('0x22')]({'CmContactId':_0x1569a8,'item':_0x47174f,'description':_0x3046b8,'ItemTypeId':_0x5ec96c,'OrderBy':_0x502c9b,'ItemClass':_0x2e63('0x23')})[_0x2e63('0x18')](function(_0x2513e5){_0x390e6e({'res':_0x2e63('0x24')});});}});});}function insertCmHopper(_0x143f15,_0x139399,_0x59872b,_0x13b660,_0x8ff55d){var _0x2b5f78=[_0x2e63('0x25'),_0x2e63('0x26'),_0x2e63('0x27'),'cm_contacts.ListId',_0x139399+'.'+_0x13b660,_0x2e63('0x28'),_0x2e63('0x29'),_0x2e63('0x2a'),_0x2e63('0x2b'),'\x22'+_0x8ff55d+'\x22'];return squel[_0x2e63('0x2c')]()[_0x2e63('0x2d')](_0x2e63('0x2e'))[_0x2e63('0x2f')]([_0x2e63('0x11'),_0x2e63('0x30'),_0x2e63('0x31'),_0x2e63('0x32'),_0x13b660,_0x2e63('0x33'),_0x2e63('0x34'),_0x2e63('0x35'),_0x2e63('0x36'),_0x2e63('0x37')],squel['select']()[_0x2e63('0x38')](_0x2b5f78)[_0x2e63('0x12')](_0x139399)['join'](_0x2e63('0x39'),null,_0x2e63('0x3a')+_0x139399+_0x2e63('0x3b'))['join'](_0x59872b,null,_0x59872b+_0x2e63('0x3c')+_0x139399+'.'+_0x13b660)[_0x2e63('0x14')](_0x139399+_0x2e63('0x3d'),_0x143f15)[_0x2e63('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x2e63('0x3e'),selectNotIn(_0x139399,_0x59872b,_0x13b660,_0x2e63('0x2e'),['\x22always\x22',_0x2e63('0x3f')]))['where'](_0x2e63('0x3e'),selectNotIn(_0x139399,_0x59872b,_0x13b660,_0x2e63('0x2e'),[_0x2e63('0x40')])))[_0x2e63('0x41')]();}function insertCmHopperBlack(_0x33ea1f,_0x5549b7,_0x4665c7,_0x5127f1){var _0x56433a=[_0x2e63('0x25'),'cm_contacts.id',_0x2e63('0x42'),_0x5549b7+'.'+_0x5127f1,_0x2e63('0x28'),_0x2e63('0x29')];return squel['insert']()['into'](_0x2e63('0x43'))['fromQuery']([_0x2e63('0x11'),'ContactId','ListId',_0x5127f1,_0x2e63('0x33'),_0x2e63('0x34')],squel[_0x2e63('0x44')]()[_0x2e63('0x38')](_0x56433a)[_0x2e63('0x12')](_0x5549b7)[_0x2e63('0x13')](_0x2e63('0x39'),null,_0x2e63('0x3a')+_0x5549b7+_0x2e63('0x3b'))[_0x2e63('0x13')](_0x4665c7,null,_0x4665c7+_0x2e63('0x3c')+_0x5549b7+'.'+_0x5127f1)['where'](_0x5549b7+_0x2e63('0x3d'),_0x33ea1f)['where'](_0x2e63('0x45'),NOW)[_0x2e63('0x14')](_0x2e63('0x3e'),squel['select']()[_0x2e63('0x10')](_0x2e63('0x11'))[_0x2e63('0x12')](_0x2e63('0x43'))['where'](_0x2e63('0x46'),_0x33ea1f)[_0x2e63('0x14')](_0x5127f1+'\x20=\x20'+_0x5549b7+'.'+_0x5127f1)))[_0x2e63('0x41')]();}function insertTzCmHopper(_0x498144,_0xdb8ac3,_0x2832a7,_0x20e327,_0x346f4b,_0x402781){var _0x26c217=[_0x2e63('0x25'),_0x2e63('0x47')+_0x402781+'.offset-cm_contacts.utcOffset\x20minute)',_0x2e63('0x27'),'cm_contacts.ListId',_0xdb8ac3+'.'+_0x20e327,_0x2e63('0x28'),_0x2e63('0x29'),'cm_contacts.priority',_0x2e63('0x2b'),'\x22'+_0x346f4b+'\x22'];var _0x40c126=squel[_0x2e63('0x2c')]()[_0x2e63('0x2d')]('cm_hopper')[_0x2e63('0x2f')](['phone',_0x2e63('0x30'),_0x2e63('0x31'),_0x2e63('0x32'),_0x20e327,'createdAt',_0x2e63('0x34'),_0x2e63('0x35'),_0x2e63('0x36'),_0x2e63('0x37')],squel[_0x2e63('0x44')]()['fields'](_0x26c217)[_0x2e63('0x12')](_0xdb8ac3)[_0x2e63('0x13')](_0x2e63('0x39'),null,_0x2e63('0x3a')+_0xdb8ac3+_0x2e63('0x3b'))['join'](_0x2832a7,null,_0x2832a7+'.id\x20=\x20'+_0xdb8ac3+'.'+_0x20e327)[_0x2e63('0x13')](_0x402781,null,_0x402781+_0x2e63('0x3c')+_0xdb8ac3+'.'+_0x20e327)['where'](_0xdb8ac3+_0x2e63('0x3d'),_0x498144)[_0x2e63('0x14')](_0x2e63('0x45'),NOW)[_0x2e63('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xdb8ac3,_0x2832a7,_0x20e327,_0x2e63('0x2e'),[_0x2e63('0x40'),_0x2e63('0x3f')]))[_0x2e63('0x14')](_0x2e63('0x3e'),selectNotIn(_0xdb8ac3,_0x2832a7,_0x20e327,'cm_hopper',[_0x2e63('0x40')])))[_0x2e63('0x41')]();return _0x40c126;}function insertTzCmHopperBlack(_0x4aad57,_0x3b0fc0,_0x56bd34,_0x52248f){var _0x19f7ab=[_0x2e63('0x25'),_0x2e63('0x27'),_0x2e63('0x42'),_0x3b0fc0+'.'+_0x52248f,_0x2e63('0x28'),'cm_contacts.updatedAt'];return squel[_0x2e63('0x2c')]()[_0x2e63('0x2d')](_0x2e63('0x43'))[_0x2e63('0x2f')]([_0x2e63('0x11'),_0x2e63('0x31'),_0x2e63('0x32'),_0x52248f,'createdAt',_0x2e63('0x34')],squel[_0x2e63('0x44')]()[_0x2e63('0x38')](_0x19f7ab)[_0x2e63('0x12')](_0x3b0fc0)[_0x2e63('0x13')](_0x2e63('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x3b0fc0+'.CmListId')['join'](_0x56bd34,null,_0x56bd34+_0x2e63('0x3c')+_0x3b0fc0+'.'+_0x52248f)[_0x2e63('0x14')](_0x3b0fc0+_0x2e63('0x3d'),_0x4aad57)['where'](_0x2e63('0x45'),NOW)[_0x2e63('0x14')](_0x2e63('0x3e'),squel['select']()[_0x2e63('0x10')](_0x2e63('0x11'))[_0x2e63('0x12')]('cm_hopper_black')[_0x2e63('0x14')](_0x2e63('0x46'),_0x4aad57)[_0x2e63('0x14')](_0x52248f+_0x2e63('0x48')+_0x3b0fc0+'.'+_0x52248f)))[_0x2e63('0x41')]();}function insertCmHopperAdditionalPhones(_0x41a092){var _0x4f2db1=['cm_hopper.id','cm_contact_has_items.item',_0x2e63('0x49'),_0x2e63('0x4a'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x2e63('0x2d')](_0x2e63('0x4b'))[_0x2e63('0x2f')]([_0x2e63('0x4c'),_0x2e63('0x11'),_0x2e63('0x4d'),_0x2e63('0x33'),_0x2e63('0x34')],squel['select']()['fields'](_0x4f2db1)['from'](_0x2e63('0x2e'))[_0x2e63('0x13')](_0x2e63('0x39'),null,_0x2e63('0x4e'))[_0x2e63('0x13')]('cm_contact_has_items',null,_0x2e63('0x4f'))[_0x2e63('0x14')](_0x2e63('0x50'),_0x41a092)[_0x2e63('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x2e63('0x41')]();}function insertCmContact(_0x148820,_0x4b3f25,_0x1bac06,_0xd9a2e0){var _0xf66ca6=_[_0x2e63('0x51')](_[_0x2e63('0x52')](_0xd9a2e0),[_0x2e63('0x32'),_0x2e63('0x53'),_0x2e63('0x33'),_0x2e63('0x34')]);return squel[_0x2e63('0x2c')]()[_0x2e63('0x2d')](_0x2e63('0x39'))[_0x2e63('0x2f')](_0xf66ca6,squel[_0x2e63('0x44')]()[_0x2e63('0x38')](_0xf66ca6)['from'](_0x4b3f25)[_0x2e63('0x14')]('('+_0x1bac06[_0x2e63('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x2e63('0x44')]()[_0x2e63('0x38')](_0x1bac06)[_0x2e63('0x12')]('cm_contacts')[_0x2e63('0x14')]('ListId\x20=\x20?',_0x148820)[_0x2e63('0x14')](_0x2e63('0x54')))[_0x2e63('0x14')]('id\x20IN\x20?',squel['select']()[_0x2e63('0x10')](_0x2e63('0x55'),'min_id')[_0x2e63('0x12')](_0x4b3f25)[_0x2e63('0x56')](_0x1bac06[_0x2e63('0x13')](','))))[_0x2e63('0x41')]();}function handleStop(){logger[_0x2e63('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3eaec3){logger[_0x2e63('0x58')](_0x3eaec3[_0x2e63('0x59')]);process[_0x2e63('0x5a')](0x1);}function handleError(_0x92a571,_0x1370a5){stats[_0x2e63('0x5b')]['push']({'name':_0x1370a5[_0x2e63('0x5c')],'message':_0x1370a5[_0x2e63('0x59')],'row':_0x92a571});}function handleQuery(_0x2176b5){logger['info'](_0x2176b5);return db[_0x2e63('0x5d')][_0x2e63('0x5e')](_0x2176b5)[_0x2e63('0x5f')](function(_0x4f0ac7){results['push'](_0x4f0ac7);})['catch'](function(_0x2964a0){logger['error'](_0x2964a0['message']);});}function updateTzCampaigns(_0x5b7ccc){return new Promise(function(_0x1ee084,_0x3d8dc2){var _0x46904d=squel[_0x2e63('0x44')]()['fields']([_0x2e63('0x60'),'campaigns.dialTimezone'])[_0x2e63('0x12')]('campaigns')[_0x2e63('0x13')](_0x2e63('0x61'),null,_0x2e63('0x62'))[_0x2e63('0x14')](_0x2e63('0x63')+_0x5b7ccc);db[_0x2e63('0x5d')][_0x2e63('0x5e')](_0x46904d['toString']())[_0x2e63('0x5f')](function(_0x5d4a1e){var _0x314d55=[];for(var _0x33f8c9=0x0;_0x33f8c9<_0x5d4a1e['length'];_0x33f8c9++){_0x314d55[_0x2e63('0x19')](getTimezoneData(_0x5d4a1e[_0x33f8c9],tmp_campaigns));}BPromise[_0x2e63('0x1a')](_0x314d55)[_0x2e63('0x18')](function(){_0x1ee084({'val':0x1});});})[_0x2e63('0x64')](function(_0x4243e0){logger[_0x2e63('0x58')](_0x4243e0[_0x2e63('0x59')]);_0x1ee084({'val':0x0});});});}function updateTzVoiceQueues(_0xffec23){return new Promise(function(_0x2ada02,_0x1ff269){var _0x553577=squel[_0x2e63('0x44')]()['fields']([_0x2e63('0x65'),_0x2e63('0x66')])[_0x2e63('0x12')](_0x2e63('0x67'))[_0x2e63('0x13')](_0x2e63('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x2e63('0x69')+_0xffec23);db[_0x2e63('0x5d')]['query'](_0x553577[_0x2e63('0x41')]())[_0x2e63('0x5f')](function(_0x5d0659){var _0x1a9a83=[];for(var _0x542a4b=0x0;_0x542a4b<_0x5d0659['length'];_0x542a4b++){_0x1a9a83[_0x2e63('0x19')](getTimezoneData(_0x5d0659[_0x542a4b],tmp_voice_queues));}BPromise[_0x2e63('0x1a')](_0x1a9a83)['then'](function(){_0x2ada02({'val':0x1});});})[_0x2e63('0x64')](function(_0x2d0323){logger[_0x2e63('0x58')](_0x2d0323['message']);_0x2ada02({'val':0x0});});});}function getTimezoneData(_0x4a5cd4,_0x29ed8b){return new Promise(function(_0x289390,_0x97e250){var _0x5a8ea2=shared[_0x2e63('0x6a')];var _0x117658=_0x5a8ea2[_0x4a5cd4[_0x2e63('0x6b')]];if(_[_0x2e63('0x6c')](_0x117658)){_0x289390({'ret':0x1});}else{var _0x28f802=_0x117658[_0x2e63('0x6d')];var _0x3e0245=squel[_0x2e63('0x2c')]()[_0x2e63('0x2d')](_0x29ed8b)[_0x2e63('0x6e')]('id',_0x4a5cd4['id'])[_0x2e63('0x6e')](_0x2e63('0x6f'),_0x28f802)[_0x2e63('0x6e')](_0x2e63('0x6b'),_0x4a5cd4[_0x2e63('0x6b')])[_0x2e63('0x41')]();return db[_0x2e63('0x5d')]['query'](_0x3e0245)[_0x2e63('0x5f')](function(_0x1e9df2){_0x289390({'ret':0x1});})[_0x2e63('0x64')](function(_0x22f4de){logger[_0x2e63('0x58')](_0x22f4de[_0x2e63('0x59')]);_0x97e250({'ret':0x1});});}});}function handleTZQuery(_0x1e24d8){logger['info'](_0x1e24d8);return db[_0x2e63('0x5d')][_0x2e63('0x5e')](_0x1e24d8)[_0x2e63('0x5f')](function(_0x3bcc8e){})[_0x2e63('0x64')](function(_0xce5788){logger[_0x2e63('0x58')](_0xce5788['message']);});}function main(_0x2802d0,_0x4b465e,_0x120387,_0x5eca41){logger[_0x2e63('0x57')](_0x2e63('0x70'),_0x2802d0,JSON[_0x2e63('0x71')](_0x4b465e));process[_0x2e63('0x72')](_0x2e63('0x73'));var _0x4ef8d5=_0x4b465e[_0x2e63('0x74')];var _0x336f23=_['clone'](_0x4ef8d5);var _0x277537=_0x4b465e[_0x2e63('0x75')];var _0x473947=path[_0x2e63('0x13')](config['root'],'server/files/tmp',_0x277537+_0x2e63('0x76'));hasTZ=_[_0x2e63('0x52')](_0x4ef8d5)[_0x2e63('0x77')](_0x2e63('0x6b'));var _0x55855b=_[_0x2e63('0x52')](_0x4ef8d5)['join']();logger[_0x2e63('0x57')](_0x2e63('0x78'),_0x55855b);db[_0x2e63('0x79')]['findAll']({'raw':!![],'attributes':['id',_0x2e63('0x7a')]})['then'](function(_0x47e440){for(var _0x584707=0x0;_0x584707<_0x47e440[_0x2e63('0x1c')];_0x584707++){if(_0x47e440[_0x584707][_0x2e63('0x7a')]in _0x4ef8d5){contactItemTypes['push'](_0x47e440[_0x584707]);delete _0x336f23[_0x47e440[_0x584707][_0x2e63('0x7a')]];hasAdditionalPhones=!![];}for(var _0x3137b9 in _0x4ef8d5){if(_0x47e440[_0x584707][_0x2e63('0x7a')]+_0x2e63('0x7b')===_0x3137b9){phoneDescriptions[_0x2e63('0x19')]({'itemTypeId':_0x47e440[_0x584707]['id'],'description':_0x3137b9});delete _0x336f23[_0x3137b9];}}}if(hasAdditionalPhones)_0x336f23[_0x2e63('0x17')]='';var _0xaf4025=_[_0x2e63('0x52')](_0x336f23)['join']();logger[_0x2e63('0x57')](_0x2e63('0x78'),_0xaf4025);fs['writeFileSync'](_0x473947,_0xaf4025+'\x0a');Papa[_0x2e63('0x7c')](fs[_0x2e63('0x7d')](_0x2802d0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2305f6,_0x97ea9f){try{for(var _0x438e5a=0x0,_0x53761d=[];_0x438e5a<_0x2305f6[_0x2e63('0x7e')][_0x2e63('0x1c')];_0x438e5a++){stats[_0x2e63('0x7f')]+=0x1;if(_0x2305f6[_0x2e63('0x5b')][_0x438e5a]){handleError(_0x2305f6['data'][_0x438e5a],_0x2305f6[_0x2e63('0x5b')][_0x438e5a]);}else{var _0x1e6b09=[];var _0x2f8133=[];var _0x5b0697={};for(var _0x4758d5 in _0x4ef8d5){let _0x5030be=contactItemTypes[_0x2e63('0x80')](_0x379686=>_0x379686[_0x2e63('0x7a')]===_0x4758d5);let _0x34fe93=contactItemTypes[_0x2e63('0x80')](_0x40a45f=>_0x40a45f[_0x2e63('0x7a')]+_0x2e63('0x7b')===_0x4758d5);if(_[_0x2e63('0x6c')](_0x5030be)&&_[_0x2e63('0x6c')](_0x34fe93)){if(_0x4ef8d5[_0x2e63('0x81')](_0x4758d5)){if(_0x2305f6['data'][_0x438e5a][_0x4ef8d5[_0x4758d5]]){var _0x2dffed=_[_0x2e63('0x82')](_0x2305f6[_0x2e63('0x7e')][_0x438e5a][_0x4ef8d5[_0x4758d5]][_0x2e63('0x83')](/"/g,'\x27'));switch(_0x4758d5){case'scheduledat':var _0x441e1a=moment(_0x2dffed,_0x2e63('0xe'),!![]);if(_0x441e1a[_0x2e63('0x84')]()){_0x53761d[_0x2e63('0x19')]('\x22'+_0x2dffed+'\x22');}else{_0x1e6b09[_0x2e63('0x19')](_0x2e63('0x85'));}break;case _0x2e63('0x35'):var _0x159bd0=parseInt(_0x2dffed);_0x2dffed=_[_0x2e63('0x86')](_0x159bd0)||_0x159bd0<0x0||_0x159bd0>0x4?_0x5eca41?0x3:0x2:_0x159bd0;_0x53761d[_0x2e63('0x19')]('\x22'+_0x2dffed+'\x22');break;case'UserId':var _0x47f38d=parseInt(_0x2dffed);if(_[_0x2e63('0x87')](_0x47f38d)&&_['includes'](_0x120387,_0x47f38d)){_0x53761d[_0x2e63('0x19')]('\x22'+_0x47f38d+'\x22');}else{_0x1e6b09[_0x2e63('0x19')](_0x2e63('0x88'));}break;case _0x2e63('0x89'):if(isEmail(_0x2dffed)){_0x53761d[_0x2e63('0x19')]('\x22'+_0x2dffed+'\x22');}else{_0x1e6b09['push'](_0x2e63('0x8a'));}break;case _0x2e63('0x8b'):var _0x5e1d90=moment(_0x2dffed,_0x2e63('0x8c'),!![]);if(_0x5e1d90['isValid']()){_0x53761d[_0x2e63('0x19')]('\x22'+_0x2dffed+'\x22');}else{_0x1e6b09[_0x2e63('0x19')](_0x2e63('0x8d'));}break;case _0x2e63('0x6b'):var _0x3d1743=shared[_0x2e63('0x6a')];var _0x125320=_0x3d1743[_0x2dffed];if(!_['isNil'](_0x125320)){var _0x5b74b7=_0x125320[_0x2e63('0x6d')];_0x53761d[_0x2e63('0x19')]('\x22'+_0x2dffed+'\x22');_0x53761d[_0x2e63('0x19')]('\x22'+_0x5b74b7+'\x22');}break;default:_0x53761d[_0x2e63('0x19')]('\x22'+_0x2dffed+'\x22');}}else{switch(_0x4758d5){case _0x2e63('0x8e'):case _0x2e63('0x11'):_0x1e6b09[_0x2e63('0x19')](_0x4758d5+_0x2e63('0x8f'));break;default:_0x53761d[_0x2e63('0x19')]('\x22\x22');}}}}else{var _0x4205aa='';if(!_[_0x2e63('0x6c')](_0x5030be)){if(!_0x5b0697[_0x2e63('0x81')](_0x5030be['id'])){if(!_[_0x2e63('0x6c')](_0x2305f6['data'][_0x438e5a][_0x4ef8d5[_0x4758d5]])){var _0x2dffed=_[_0x2e63('0x82')](_0x2305f6[_0x2e63('0x7e')][_0x438e5a][_0x4ef8d5[_0x4758d5]][_0x2e63('0x83')](/"/g,'\x27'));var _0x3427de=phoneDescriptions[_0x2e63('0x80')](_0x5d007c=>_0x5d007c[_0x2e63('0x90')]===_0x5030be['id']);if(!_['isNil'](_0x3427de)){var _0x45ffd9=_[_0x2e63('0x82')](_0x2305f6[_0x2e63('0x7e')][_0x438e5a][_0x4ef8d5[_0x3427de['description']]][_0x2e63('0x83')](/"/g,'\x27'));if(!_[_0x2e63('0x6c')](_0x45ffd9))_0x2dffed=_0x2dffed+'§'+_0x45ffd9;}if(_0x4205aa=='')_0x4205aa=_0x2dffed;else _0x4205aa+='|'+_0x2dffed;}_0x2f8133[_0x2e63('0x19')](_0x5030be['id']+':'+_0x4205aa);_0x5b0697[_0x5030be['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53761d[_0x2e63('0x19')]('\x22'+_0x2f8133['join'](';')+'\x22');}if(_0x1e6b09[_0x2e63('0x1c')]){handleError(_0x2305f6[_0x2e63('0x7e')][_0x438e5a],{'code':'SystemRow','message':_0x1e6b09['join']()});}else{fs[_0x2e63('0x91')](_0x473947,_0x53761d[_0x2e63('0x13')]()+'\x0a');}_0x53761d=[];}if(!(stats['rows']%0xc8)){socket[_0x2e63('0x92')](_0x2e63('0x93')+_0x277537,stats);stats[_0x2e63('0x5b')]=[];}}if(stopped){logger[_0x2e63('0x57')](_0x2e63('0x94'));_0x97ea9f[_0x2e63('0x95')]();}}catch(_0x2353c9){handleError(_0x2305f6[_0x2e63('0x7e')][_0x438e5a],{'code':_0x2e63('0x96'),'message':_0x2353c9['message']});logger[_0x2e63('0x58')](_0x2e63('0x97'),_0x2353c9[_0x2e63('0x59')]);}},'complete':function(){try{var _0x1fc321=[];var _0x31aedb=[];var _0x157f75=_0x2e63('0x39');if(_0x4b465e[_0x2e63('0x98')]&&_0x4b465e['duplicates'][_0x2e63('0x1c')]){_0x157f75=_0x2e63('0x99')+_0x277537;_0x1fc321[_0x2e63('0x19')](_0x2e63('0x9a')+_0x157f75+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x2e63('0x9b')+_0x277537;tmp_voice_queues=_0x2e63('0x9c')+_0x277537;_0x31aedb['push'](_0x2e63('0x9a')+tmp_campaigns+_0x2e63('0x9d'));_0x31aedb['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x2e63('0x9d'));BPromise[_0x2e63('0x9e')](_0x31aedb,handleTZQuery)[_0x2e63('0x18')](function(_0x15e364){updateTzCampaigns(_0x4b465e[_0x2e63('0x32')])[_0x2e63('0x18')](function(_0x5b495e){updateTzVoiceQueues(_0x4b465e[_0x2e63('0x32')])[_0x2e63('0x18')](function(_0x21534b){if(hasTZ)_0xaf4025=_0xaf4025[_0x2e63('0x83')]('dialTimezone','dialTimezone,utcOffset');var _0x235247=util[_0x2e63('0xd')](_0x2e63('0x9f'),_0x473947,_0x157f75,_0xaf4025,_0x4b465e['ListId'],_0x4b465e[_0x2e63('0x53')]||null,NOW,NOW);if(_['isNil'](_0x4ef8d5[_0x2e63('0x30')])){_0x235247+=',\x20scheduledAt\x20=\x20NOW()';}_0x1fc321[_0x2e63('0x19')](_0x235247);if(_0x4b465e['duplicates']&&_0x4b465e[_0x2e63('0x98')][_0x2e63('0x1c')]){_0x1fc321[_0x2e63('0x19')](insertCmContact(_0x4b465e[_0x2e63('0x32')],_0x157f75,_0x4b465e[_0x2e63('0x98')],_0x4ef8d5));_0x1fc321[_0x2e63('0x19')](_0x2e63('0xa0')+_0x157f75+';');}BPromise[_0x2e63('0x9e')](_0x1fc321,handleQuery)['then'](function(_0x4e5f2f){BPromise['all']([handleAdditionalPhones()])[_0x2e63('0x18')](function(){_0x1fc321=[];for(var _0x2cf7e3=0x0;_0x2cf7e3\x20\x20','root','server/files/tmp','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','AdditionalPhones','then','length','push','all','isNil','split','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','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.id','cm_contacts.ListId','insert','cm_hopper_black','ListId','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys'];(function(_0x576703,_0x43699f){var _0x315a2c=function(_0x5b6a80){while(--_0x5b6a80){_0x576703['push'](_0x576703['shift']());}};_0x315a2c(++_0x43699f);}(_0xadc4,0x113));var _0x4adc=function(_0x319dda,_0x2352b3){_0x319dda=_0x319dda-0x0;var _0x2dbbde=_0xadc4[_0x319dda];return _0x2dbbde;};'use strict';var fs=require('fs');var path=require(_0x4adc('0x0'));var _=require(_0x4adc('0x1'));var Papa=require(_0x4adc('0x2'));var util=require(_0x4adc('0x3'));var BPromise=require(_0x4adc('0x4'));var moment=require(_0x4adc('0x5'));var squel=require(_0x4adc('0x6'));var Redis=require('ioredis');var db=require(_0x4adc('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')('import');config[_0x4adc('0x8')]=_[_0x4adc('0x9')](config[_0x4adc('0x8')],{'host':_0x4adc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x4adc('0xb')](_0x4adc('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4adc('0xb')](_0x4adc('0xc'));function isEmail(_0x315462){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))*$/[_0x4adc('0xd')](_0x315462);}function selectNotIn(_0x24bbd4,_0xbeeafd,_0x13cc44,_0x2f7b71,_0x3b3a05){return squel[_0x4adc('0xe')]()[_0x4adc('0xf')]('phone')[_0x4adc('0x10')](_0x2f7b71)[_0x4adc('0x11')](_0xbeeafd,null,_0xbeeafd+_0x4adc('0x12')+_0x2f7b71+'.'+_0x13cc44)[_0x4adc('0x13')](_0x2f7b71+'.'+_0x13cc44+_0x4adc('0x14')+_0x24bbd4+'.'+_0x13cc44)[_0x4adc('0x13')](_0xbeeafd+'.dialCheckDuplicateType\x20IN\x20('+_0x3b3a05[_0x4adc('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x45dbea,_0x444d13){promisesAdditionalPhones=[];return db[_0x4adc('0x15')]['findAll']({'raw':!![],'attributes':['id',_0x4adc('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x4adc('0x17')](function(_0x269e98){if(_0x269e98!==null){var _0x4fc1fc=[];for(var _0x35e82d=0x0;_0x35e82d<_0x269e98[_0x4adc('0x18')];_0x35e82d++){var _0x656cc3=_0x269e98[_0x35e82d];_0x4fc1fc[_0x4adc('0x19')](insertAdditionalPhones(_0x656cc3));}}Promise[_0x4adc('0x1a')](_0x4fc1fc)[_0x4adc('0x17')](function(){_0x45dbea({'val':0x1});});});});}function insertAdditionalPhones(_0x4c480a){return new Promise(function(_0x133885,_0x5ec7e0){var _0x1c8d12=_0x4c480a[_0x4adc('0x16')];var _0x36f491=_0x1c8d12['split'](';');var _0x4e087f=[];orderBy=0x0;for(var _0x2cb120=0x0;_0x2cb120<_0x36f491[_0x4adc('0x18')];_0x2cb120++){_0x4e087f[_0x4adc('0x19')](splitAdditionalPhone(_0x4c480a['id'],_0x36f491[_0x2cb120]));}Promise[_0x4adc('0x1a')](_0x4e087f)[_0x4adc('0x17')](function(){_0x133885({'val':_0x36f491['length']});});});}function splitAdditionalPhone(_0x46d96b,_0x80e3d){return new Promise(function(_0x3efc46,_0x5512bf){var _0x1b7986=_0x80e3d['split'](':');var _0x5ae537=_0x1b7986[0x0];var _0x4ab366=_0x1b7986[0x1];if(!_[_0x4adc('0x1b')](_0x4ab366)){var _0x137d48=_0x4ab366[_0x4adc('0x1c')]('|');var _0x197be6=[];for(var _0x5cde14=0x0;_0x5cde14<_0x137d48['length'];_0x5cde14++){if(_0x137d48[_0x5cde14]!==''){var _0x4a7bcc=_[_0x4adc('0x1d')](promisesAdditionalPhones,{'contactId':_0x46d96b,'phone':_0x137d48[_0x5cde14]});if(_0x4a7bcc[_0x4adc('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x46d96b,'contactTypeId':_0x5ae537,'phone':_0x137d48[_0x5cde14],'orderBy':orderBy});}}}_0x3efc46({'ok':0x1});}else _0x3efc46({'res':0x0});});}function createAdditionalPhone(_0x47a290,_0x405753,_0x193ca9,_0x497561){var _0x4270a1='';var _0x37659a='';var _0x10ff10=_0x193ca9[_0x4adc('0x1c')]('§');_0x4270a1=_0x10ff10[0x0];if(_0x10ff10[_0x4adc('0x18')]==0x2)_0x37659a=_0x10ff10[0x1];return new Promise(function(_0x528f63,_0x394ce5){return db['CmContactHasItem'][_0x4adc('0x1e')]({'where':{'CmContactId':_0x47a290,'item':_0x4270a1}})[_0x4adc('0x17')](function(_0x41b99c){if(_0x41b99c){return db[_0x4adc('0x1f')][_0x4adc('0x20')]({'ItemTypeId':_0x405753,'description':_0x37659a,'OrderBy':_0x497561},{'where':{'CmContactId':_0x47a290,'item':_0x4270a1}})[_0x4adc('0x17')](function(_0x13f0d0){_0x528f63({'res':_0x4adc('0x21')});});}else{return db[_0x4adc('0x1f')][_0x4adc('0x22')]({'CmContactId':_0x47a290,'item':_0x4270a1,'description':_0x37659a,'ItemTypeId':_0x405753,'OrderBy':_0x497561,'ItemClass':_0x4adc('0x23')})[_0x4adc('0x17')](function(_0x670186){_0x528f63({'res':_0x4adc('0x24')});});}});});}function insertCmHopper(_0x45fb42,_0x3da6fc,_0x5bc1ef,_0x31ea41,_0x54f0f1){var _0x58726c=[_0x4adc('0x25'),_0x4adc('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x3da6fc+'.'+_0x31ea41,_0x4adc('0x27'),_0x4adc('0x28'),_0x4adc('0x29'),_0x4adc('0x2a'),'\x22'+_0x54f0f1+'\x22'];return squel['insert']()[_0x4adc('0x2b')](_0x4adc('0x2c'))[_0x4adc('0x2d')]([_0x4adc('0x2e'),_0x4adc('0x2f'),_0x4adc('0x30'),'ListId',_0x31ea41,_0x4adc('0x31'),_0x4adc('0x32'),_0x4adc('0x33'),_0x4adc('0x34'),_0x4adc('0x35')],squel[_0x4adc('0xe')]()[_0x4adc('0x36')](_0x58726c)[_0x4adc('0x10')](_0x3da6fc)['join'](_0x4adc('0x37'),null,_0x4adc('0x38')+_0x3da6fc+_0x4adc('0x39'))[_0x4adc('0x11')](_0x5bc1ef,null,_0x5bc1ef+_0x4adc('0x12')+_0x3da6fc+'.'+_0x31ea41)[_0x4adc('0x13')](_0x3da6fc+_0x4adc('0x3a'),_0x45fb42)[_0x4adc('0x13')](_0x4adc('0x3b'),NOW)[_0x4adc('0x13')](_0x4adc('0x3c'),selectNotIn(_0x3da6fc,_0x5bc1ef,_0x31ea41,_0x4adc('0x2c'),[_0x4adc('0x3d'),_0x4adc('0x3e')]))[_0x4adc('0x13')](_0x4adc('0x3c'),selectNotIn(_0x3da6fc,_0x5bc1ef,_0x31ea41,_0x4adc('0x2c'),[_0x4adc('0x3d')])))[_0x4adc('0x3f')]();}function insertCmHopperBlack(_0x404c5f,_0x35da51,_0x372786,_0xfbb99f){var _0x699c02=[_0x4adc('0x25'),_0x4adc('0x40'),_0x4adc('0x41'),_0x35da51+'.'+_0xfbb99f,_0x4adc('0x27'),_0x4adc('0x28')];return squel[_0x4adc('0x42')]()[_0x4adc('0x2b')](_0x4adc('0x43'))[_0x4adc('0x2d')]([_0x4adc('0x2e'),_0x4adc('0x30'),_0x4adc('0x44'),_0xfbb99f,_0x4adc('0x31'),_0x4adc('0x32')],squel[_0x4adc('0xe')]()['fields'](_0x699c02)[_0x4adc('0x10')](_0x35da51)[_0x4adc('0x11')]('cm_contacts',null,_0x4adc('0x38')+_0x35da51+_0x4adc('0x39'))[_0x4adc('0x11')](_0x372786,null,_0x372786+_0x4adc('0x12')+_0x35da51+'.'+_0xfbb99f)[_0x4adc('0x13')](_0x35da51+_0x4adc('0x3a'),_0x404c5f)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4adc('0x13')](_0x4adc('0x3c'),squel[_0x4adc('0xe')]()[_0x4adc('0xf')](_0x4adc('0x2e'))[_0x4adc('0x10')](_0x4adc('0x43'))[_0x4adc('0x13')](_0x4adc('0x45'),_0x404c5f)['where'](_0xfbb99f+_0x4adc('0x14')+_0x35da51+'.'+_0xfbb99f)))[_0x4adc('0x3f')]();}function insertTzCmHopper(_0x4d64ea,_0x2f0c4a,_0x4a456f,_0x103431,_0x50baec,_0x2bcda2){var _0x35637f=[_0x4adc('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x2bcda2+_0x4adc('0x46'),_0x4adc('0x40'),_0x4adc('0x41'),_0x2f0c4a+'.'+_0x103431,_0x4adc('0x27'),'cm_contacts.updatedAt','cm_contacts.priority',_0x4adc('0x2a'),'\x22'+_0x50baec+'\x22'];var _0x471207=squel[_0x4adc('0x42')]()[_0x4adc('0x2b')](_0x4adc('0x2c'))['fromQuery']([_0x4adc('0x2e'),_0x4adc('0x2f'),_0x4adc('0x30'),'ListId',_0x103431,_0x4adc('0x31'),_0x4adc('0x32'),_0x4adc('0x33'),_0x4adc('0x34'),_0x4adc('0x35')],squel[_0x4adc('0xe')]()[_0x4adc('0x36')](_0x35637f)[_0x4adc('0x10')](_0x2f0c4a)[_0x4adc('0x11')](_0x4adc('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x2f0c4a+_0x4adc('0x39'))[_0x4adc('0x11')](_0x4a456f,null,_0x4a456f+_0x4adc('0x12')+_0x2f0c4a+'.'+_0x103431)[_0x4adc('0x11')](_0x2bcda2,null,_0x2bcda2+_0x4adc('0x12')+_0x2f0c4a+'.'+_0x103431)[_0x4adc('0x13')](_0x2f0c4a+_0x4adc('0x3a'),_0x4d64ea)[_0x4adc('0x13')](_0x4adc('0x3b'),NOW)[_0x4adc('0x13')](_0x4adc('0x3c'),selectNotIn(_0x2f0c4a,_0x4a456f,_0x103431,'cm_hopper',[_0x4adc('0x3d'),_0x4adc('0x3e')]))[_0x4adc('0x13')](_0x4adc('0x3c'),selectNotIn(_0x2f0c4a,_0x4a456f,_0x103431,_0x4adc('0x2c'),[_0x4adc('0x3d')])))[_0x4adc('0x3f')]();return _0x471207;}function insertTzCmHopperBlack(_0x25a28a,_0x3c0cba,_0x32152a,_0x2753b6){var _0x299438=[_0x4adc('0x25'),'cm_contacts.id','cm_contacts.ListId',_0x3c0cba+'.'+_0x2753b6,_0x4adc('0x27'),_0x4adc('0x28')];return squel[_0x4adc('0x42')]()[_0x4adc('0x2b')]('cm_hopper_black')[_0x4adc('0x2d')]([_0x4adc('0x2e'),_0x4adc('0x30'),'ListId',_0x2753b6,'createdAt',_0x4adc('0x32')],squel[_0x4adc('0xe')]()[_0x4adc('0x36')](_0x299438)['from'](_0x3c0cba)['join'](_0x4adc('0x37'),null,_0x4adc('0x38')+_0x3c0cba+'.CmListId')[_0x4adc('0x11')](_0x32152a,null,_0x32152a+'.id\x20=\x20'+_0x3c0cba+'.'+_0x2753b6)[_0x4adc('0x13')](_0x3c0cba+'.CmListId\x20=\x20?',_0x25a28a)[_0x4adc('0x13')](_0x4adc('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x4adc('0xe')]()[_0x4adc('0xf')]('phone')[_0x4adc('0x10')](_0x4adc('0x43'))[_0x4adc('0x13')](_0x4adc('0x45'),_0x25a28a)[_0x4adc('0x13')](_0x2753b6+_0x4adc('0x14')+_0x3c0cba+'.'+_0x2753b6)))[_0x4adc('0x3f')]();}function insertCmHopperAdditionalPhones(_0x20f3c6){var _0x282645=[_0x4adc('0x47'),'cm_contact_has_items.item',_0x4adc('0x48'),_0x4adc('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x4adc('0x42')]()[_0x4adc('0x2b')]('cm_hopper_additional_phones')[_0x4adc('0x2d')]([_0x4adc('0x4a'),_0x4adc('0x2e'),_0x4adc('0x4b'),_0x4adc('0x31'),'updatedAt'],squel[_0x4adc('0xe')]()['fields'](_0x282645)[_0x4adc('0x10')](_0x4adc('0x2c'))[_0x4adc('0x11')](_0x4adc('0x37'),null,_0x4adc('0x4c'))[_0x4adc('0x11')](_0x4adc('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x4adc('0x4e'),_0x20f3c6)[_0x4adc('0x13')](_0x4adc('0x3b'),NOW))[_0x4adc('0x3f')]();}function insertCmContact(_0x448e5e,_0x405269,_0xf67d9a,_0x398d15){var _0x25a4f1=_[_0x4adc('0x4f')](_[_0x4adc('0x50')](_0x398d15),['ListId',_0x4adc('0x51'),'createdAt',_0x4adc('0x32')]);return squel['insert']()[_0x4adc('0x2b')](_0x4adc('0x37'))['fromQuery'](_0x25a4f1,squel['select']()[_0x4adc('0x36')](_0x25a4f1)[_0x4adc('0x10')](_0x405269)['where']('('+_0xf67d9a[_0x4adc('0x11')](',')+_0x4adc('0x52'),squel['select']()[_0x4adc('0x36')](_0xf67d9a)[_0x4adc('0x10')]('cm_contacts')['where']('ListId\x20=\x20?',_0x448e5e)[_0x4adc('0x13')](_0x4adc('0x53')))['where'](_0x4adc('0x54'),squel[_0x4adc('0xe')]()[_0x4adc('0xf')](_0x4adc('0x55'),_0x4adc('0x56'))['from'](_0x405269)['group'](_0xf67d9a[_0x4adc('0x11')](','))))['toString']();}function handleStop(){logger['info'](_0x4adc('0x57'));stopped=!![];}function handleUncaughtException(_0x3b2ae7){logger[_0x4adc('0x58')](_0x3b2ae7[_0x4adc('0x59')]);process[_0x4adc('0x5a')](0x1);}function handleError(_0x5344ef,_0x249ffe){stats[_0x4adc('0x5b')][_0x4adc('0x19')]({'name':_0x249ffe[_0x4adc('0x5c')],'message':_0x249ffe[_0x4adc('0x59')],'row':_0x5344ef});}function handleQuery(_0x5c02b2){logger[_0x4adc('0x5d')](_0x5c02b2);return db[_0x4adc('0x5e')][_0x4adc('0x5f')](_0x5c02b2)['spread'](function(_0x359cf9){results[_0x4adc('0x19')](_0x359cf9);})[_0x4adc('0x60')](function(_0x22ea86){logger[_0x4adc('0x58')](_0x22ea86[_0x4adc('0x59')]);});}function updateTzCampaigns(_0x5016c8){return new Promise(function(_0x233f1d,_0x257980){var _0x513a82=squel[_0x4adc('0xe')]()['fields']([_0x4adc('0x61'),_0x4adc('0x62')])[_0x4adc('0x10')]('campaigns')[_0x4adc('0x11')](_0x4adc('0x63'),null,_0x4adc('0x64'))['where'](_0x4adc('0x65')+_0x5016c8);db[_0x4adc('0x5e')][_0x4adc('0x5f')](_0x513a82[_0x4adc('0x3f')]())[_0x4adc('0x66')](function(_0xf47225){var _0x565b69=[];for(var _0xf14921=0x0;_0xf14921<_0xf47225['length'];_0xf14921++){_0x565b69['push'](getTimezoneData(_0xf47225[_0xf14921],tmp_campaigns));}BPromise[_0x4adc('0x1a')](_0x565b69)[_0x4adc('0x17')](function(){_0x233f1d({'val':0x1});});})['catch'](function(_0xc236ec){logger['error'](_0xc236ec[_0x4adc('0x59')]);_0x233f1d({'val':0x0});});});}function updateTzVoiceQueues(_0x1b998c){return new Promise(function(_0x4e222f,_0x2ac820){var _0x171560=squel[_0x4adc('0xe')]()[_0x4adc('0x36')]([_0x4adc('0x67'),_0x4adc('0x68')])['from'](_0x4adc('0x69'))['join']('voice_queues_has_cm_lists',null,_0x4adc('0x6a'))[_0x4adc('0x13')]('voice_queues_has_cm_lists.CmListId='+_0x1b998c);db[_0x4adc('0x5e')][_0x4adc('0x5f')](_0x171560[_0x4adc('0x3f')]())[_0x4adc('0x66')](function(_0x3931aa){var _0x8513a3=[];for(var _0x41114b=0x0;_0x41114b<_0x3931aa[_0x4adc('0x18')];_0x41114b++){_0x8513a3[_0x4adc('0x19')](getTimezoneData(_0x3931aa[_0x41114b],tmp_voice_queues));}BPromise['all'](_0x8513a3)[_0x4adc('0x17')](function(){_0x4e222f({'val':0x1});});})['catch'](function(_0x46c911){logger[_0x4adc('0x58')](_0x46c911[_0x4adc('0x59')]);_0x4e222f({'val':0x0});});});}function getTimezoneData(_0x3e45ef,_0x2419b0){return new Promise(function(_0x3f035c,_0x1f7275){var _0x5d17ae=shared[_0x4adc('0x6b')];var _0x1c4ff=_0x5d17ae[_0x3e45ef[_0x4adc('0x6c')]];if(_[_0x4adc('0x1b')](_0x1c4ff)){_0x3f035c({'ret':0x1});}else{var _0x1412b0=_0x1c4ff[_0x4adc('0x6d')];var _0x2183a6=squel[_0x4adc('0x42')]()['into'](_0x2419b0)['set']('id',_0x3e45ef['id'])[_0x4adc('0x6e')](_0x4adc('0x6f'),_0x1412b0)['set'](_0x4adc('0x6c'),_0x3e45ef[_0x4adc('0x6c')])['toString']();return db[_0x4adc('0x5e')]['query'](_0x2183a6)[_0x4adc('0x66')](function(_0x58fcb4){_0x3f035c({'ret':0x1});})[_0x4adc('0x60')](function(_0x36b7fb){logger[_0x4adc('0x58')](_0x36b7fb[_0x4adc('0x59')]);_0x1f7275({'ret':0x1});});}});}function handleTZQuery(_0x4e00ff){logger[_0x4adc('0x5d')](_0x4e00ff);return db['sequelize'][_0x4adc('0x5f')](_0x4e00ff)['spread'](function(_0x1b443a){})[_0x4adc('0x60')](function(_0x2e115c){logger['error'](_0x2e115c[_0x4adc('0x59')]);});}function main(_0x505c6b,_0x58ad5f,_0x494330,_0x467313){logger[_0x4adc('0x5d')]('main',_0x505c6b,JSON[_0x4adc('0x70')](_0x58ad5f));process[_0x4adc('0x71')](_0x4adc('0x72'));var _0x5f1726=_0x58ad5f[_0x4adc('0x73')];var _0x22c818=_['clone'](_0x5f1726);var _0x3ca9fc=_0x58ad5f[_0x4adc('0x74')];var _0x479110=path['join'](config['root'],'server/files/tmp',_0x3ca9fc+'.csv');hasTZ=_['keys'](_0x5f1726)[_0x4adc('0x75')](_0x4adc('0x6c'));var _0x58c78d=_['keys'](_0x5f1726)[_0x4adc('0x11')]();logger[_0x4adc('0x5d')]('header',_0x58c78d);db[_0x4adc('0x76')][_0x4adc('0x77')]({'raw':!![],'attributes':['id',_0x4adc('0x78')]})[_0x4adc('0x17')](function(_0x2dccc1){for(var _0x390f0f=0x0;_0x390f0f<_0x2dccc1['length'];_0x390f0f++){if(_0x2dccc1[_0x390f0f][_0x4adc('0x78')]in _0x5f1726){contactItemTypes['push'](_0x2dccc1[_0x390f0f]);delete _0x22c818[_0x2dccc1[_0x390f0f][_0x4adc('0x78')]];hasAdditionalPhones=!![];}for(var _0x31d066 in _0x5f1726){if(_0x2dccc1[_0x390f0f][_0x4adc('0x78')]+'_description'===_0x31d066){phoneDescriptions[_0x4adc('0x19')]({'itemTypeId':_0x2dccc1[_0x390f0f]['id'],'description':_0x31d066});delete _0x22c818[_0x31d066];}}}if(hasAdditionalPhones)_0x22c818[_0x4adc('0x16')]='';var _0x557c16=_[_0x4adc('0x50')](_0x22c818)[_0x4adc('0x11')]();logger[_0x4adc('0x5d')]('header',_0x557c16);fs['writeFileSync'](_0x479110,_0x557c16+'\x0a');Papa[_0x4adc('0x79')](fs['createReadStream'](_0x505c6b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3f233d,_0x42b9bc){try{for(var _0x2b3cac=0x0,_0x44386f=[];_0x2b3cac<_0x3f233d[_0x4adc('0x7a')][_0x4adc('0x18')];_0x2b3cac++){stats[_0x4adc('0x7b')]+=0x1;if(_0x3f233d[_0x4adc('0x5b')][_0x2b3cac]){handleError(_0x3f233d[_0x4adc('0x7a')][_0x2b3cac],_0x3f233d[_0x4adc('0x5b')][_0x2b3cac]);}else{var _0x391452=[];var _0x39e3d9=[];var _0x33d907={};for(var _0x13c1cf in _0x5f1726){let _0x471cb4=contactItemTypes['find'](_0x5eeaac=>_0x5eeaac[_0x4adc('0x78')]===_0x13c1cf);let _0x506e7c=contactItemTypes['find'](_0x5b5561=>_0x5b5561[_0x4adc('0x78')]+_0x4adc('0x7c')===_0x13c1cf);if(_[_0x4adc('0x1b')](_0x471cb4)&&_['isNil'](_0x506e7c)){if(_0x5f1726['hasOwnProperty'](_0x13c1cf)){if(_0x3f233d[_0x4adc('0x7a')][_0x2b3cac][_0x5f1726[_0x13c1cf]]){var _0x53f37b=_['trim'](_0x3f233d[_0x4adc('0x7a')][_0x2b3cac][_0x5f1726[_0x13c1cf]][_0x4adc('0x7d')](/"/g,'\x27'));switch(_0x13c1cf){case _0x4adc('0x2f'):var _0x2e28cf=moment(_0x53f37b,_0x4adc('0xc'),!![]);if(_0x2e28cf[_0x4adc('0x7e')]()){_0x44386f[_0x4adc('0x19')]('\x22'+_0x53f37b+'\x22');}else{_0x391452[_0x4adc('0x19')](_0x4adc('0x7f'));}break;case _0x4adc('0x33'):var _0x3a805b=parseInt(_0x53f37b);_0x53f37b=_[_0x4adc('0x80')](_0x3a805b)||_0x3a805b<0x0||_0x3a805b>0x4?_0x467313?0x3:0x2:_0x3a805b;_0x44386f[_0x4adc('0x19')]('\x22'+_0x53f37b+'\x22');break;case _0x4adc('0x34'):var _0x3271b5=parseInt(_0x53f37b);if(_['isNumber'](_0x3271b5)&&_[_0x4adc('0x75')](_0x494330,_0x3271b5)){_0x44386f[_0x4adc('0x19')]('\x22'+_0x3271b5+'\x22');}else{_0x391452[_0x4adc('0x19')](_0x4adc('0x81'));}break;case _0x4adc('0x82'):if(isEmail(_0x53f37b)){_0x44386f['push']('\x22'+_0x53f37b+'\x22');}else{_0x391452[_0x4adc('0x19')]('email\x20wrong\x20format');}break;case _0x4adc('0x83'):var _0x4ed26a=moment(_0x53f37b,_0x4adc('0x84'),!![]);if(_0x4ed26a['isValid']()){_0x44386f['push']('\x22'+_0x53f37b+'\x22');}else{_0x391452[_0x4adc('0x19')](_0x4adc('0x85'));}break;case'dialTimezone':var _0x87011c=shared[_0x4adc('0x6b')];var _0x5cf6d9=_0x87011c[_0x53f37b];if(!_[_0x4adc('0x1b')](_0x5cf6d9)){var _0x49805c=_0x5cf6d9[_0x4adc('0x6d')];_0x44386f['push']('\x22'+_0x53f37b+'\x22');_0x44386f[_0x4adc('0x19')]('\x22'+_0x49805c+'\x22');}break;default:_0x44386f[_0x4adc('0x19')]('\x22'+_0x53f37b+'\x22');}}else{switch(_0x13c1cf){case _0x4adc('0x86'):case _0x4adc('0x2e'):_0x391452[_0x4adc('0x19')](_0x13c1cf+_0x4adc('0x87'));break;default:_0x44386f[_0x4adc('0x19')]('\x22\x22');}}}}else{var _0x54332b='';if(!_[_0x4adc('0x1b')](_0x471cb4)){if(!_0x33d907[_0x4adc('0x88')](_0x471cb4['id'])){if(!_[_0x4adc('0x1b')](_0x3f233d[_0x4adc('0x7a')][_0x2b3cac][_0x5f1726[_0x13c1cf]])){var _0x53f37b=_[_0x4adc('0x89')](_0x3f233d[_0x4adc('0x7a')][_0x2b3cac][_0x5f1726[_0x13c1cf]][_0x4adc('0x7d')](/"/g,'\x27'));var _0x47c699=phoneDescriptions['find'](_0x43af62=>_0x43af62[_0x4adc('0x8a')]===_0x471cb4['id']);if(!_[_0x4adc('0x1b')](_0x47c699)){var _0x3dced5=_[_0x4adc('0x89')](_0x3f233d[_0x4adc('0x7a')][_0x2b3cac][_0x5f1726[_0x47c699['description']]][_0x4adc('0x7d')](/"/g,'\x27'));if(!_[_0x4adc('0x1b')](_0x3dced5))_0x53f37b=_0x53f37b+'§'+_0x3dced5;}if(_0x54332b=='')_0x54332b=_0x53f37b;else _0x54332b+='|'+_0x53f37b;}_0x39e3d9[_0x4adc('0x19')](_0x471cb4['id']+':'+_0x54332b);_0x33d907[_0x471cb4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x44386f[_0x4adc('0x19')]('\x22'+_0x39e3d9[_0x4adc('0x11')](';')+'\x22');}if(_0x391452[_0x4adc('0x18')]){handleError(_0x3f233d['data'][_0x2b3cac],{'code':'SystemRow','message':_0x391452[_0x4adc('0x11')]()});}else{fs[_0x4adc('0x8b')](_0x479110,_0x44386f[_0x4adc('0x11')]()+'\x0a');}_0x44386f=[];}if(!(stats[_0x4adc('0x7b')]%0xc8)){socket['emit'](_0x4adc('0x8c')+_0x3ca9fc,stats);stats[_0x4adc('0x5b')]=[];}}if(stopped){logger[_0x4adc('0x5d')](_0x4adc('0x8d'));_0x42b9bc[_0x4adc('0x8e')]();}}catch(_0x44017b){handleError(_0x3f233d[_0x4adc('0x7a')][_0x2b3cac],{'code':_0x4adc('0x8f'),'message':_0x44017b[_0x4adc('0x59')]});logger[_0x4adc('0x58')](_0x4adc('0x90'),_0x44017b[_0x4adc('0x59')]);}},'complete':function(){try{var _0x49da3b=[];var _0x1abf2c=[];var _0x329a05='cm_contacts';if(_0x58ad5f[_0x4adc('0x91')]&&_0x58ad5f['duplicates'][_0x4adc('0x18')]){_0x329a05=_0x4adc('0x92')+_0x3ca9fc;_0x49da3b['push'](_0x4adc('0x93')+_0x329a05+_0x4adc('0x94'));}tmp_campaigns=_0x4adc('0x95')+_0x3ca9fc;tmp_voice_queues=_0x4adc('0x96')+_0x3ca9fc;_0x1abf2c[_0x4adc('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x4adc('0x97'));_0x1abf2c[_0x4adc('0x19')](_0x4adc('0x93')+tmp_voice_queues+_0x4adc('0x97'));BPromise[_0x4adc('0x98')](_0x1abf2c,handleTZQuery)[_0x4adc('0x17')](function(_0x3c3db9){updateTzCampaigns(_0x58ad5f[_0x4adc('0x44')])['then'](function(_0x3c3cb2){updateTzVoiceQueues(_0x58ad5f[_0x4adc('0x44')])[_0x4adc('0x17')](function(_0xc148bb){if(hasTZ)_0x557c16=_0x557c16['replace'](_0x4adc('0x6c'),_0x4adc('0x99'));var _0x12b851=util['format'](_0x4adc('0x9a'),_0x479110,_0x329a05,_0x557c16,_0x58ad5f[_0x4adc('0x44')],_0x58ad5f[_0x4adc('0x51')]||null,NOW,NOW);if(_[_0x4adc('0x1b')](_0x5f1726[_0x4adc('0x2f')])){_0x12b851+=_0x4adc('0x9b');}_0x49da3b['push'](_0x12b851);if(_0x58ad5f[_0x4adc('0x91')]&&_0x58ad5f['duplicates'][_0x4adc('0x18')]){_0x49da3b['push'](insertCmContact(_0x58ad5f[_0x4adc('0x44')],_0x329a05,_0x58ad5f[_0x4adc('0x91')],_0x5f1726));_0x49da3b[_0x4adc('0x19')]('DROP\x20TABLE\x20'+_0x329a05+';');}BPromise['each'](_0x49da3b,handleQuery)['then'](function(_0x627c1a){BPromise[_0x4adc('0x1a')]([handleAdditionalPhones()])[_0x4adc('0x17')](function(){_0x49da3b=[];for(var _0x1d4fd5=0x0;_0x1d4fd5\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','phone','from','\x20=\x20','where'];(function(_0x4ae506,_0x5a97ed){var _0x18e3a1=function(_0x3995a2){while(--_0x3995a2){_0x4ae506['push'](_0x4ae506['shift']());}};_0x18e3a1(++_0x5a97ed);}(_0xa057,0x123));var _0x7a05=function(_0x2d069a,_0x518d4f){_0x2d069a=_0x2d069a-0x0;var _0x100397=_0xa057[_0x2d069a];return _0x100397;};'use strict';var fs=require('fs');var path=require(_0x7a05('0x0'));var _=require(_0x7a05('0x1'));var Papa=require('papaparse');var util=require(_0x7a05('0x2'));var BPromise=require(_0x7a05('0x3'));var moment=require(_0x7a05('0x4'));var squel=require('squel');var Redis=require(_0x7a05('0x5'));var db=require(_0x7a05('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x7a05('0x7'))('import');config['redis']=_[_0x7a05('0x8')](config[_0x7a05('0x9')],{'host':_0x7a05('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a05('0x9')]));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()[_0x7a05('0xb')](_0x7a05('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x7a05('0xb')](_0x7a05('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x417ca9){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))*$/[_0x7a05('0xe')](_0x417ca9);}function selectNotIn(_0x1e2f9e,_0xa3c03e,_0x4a7a63,_0x73b0d8,_0x463a80){return squel['select']()['field'](_0x7a05('0xf'))[_0x7a05('0x10')](_0x73b0d8)['join'](_0xa3c03e,null,_0xa3c03e+'.id\x20=\x20'+_0x73b0d8+'.'+_0x4a7a63)['where'](_0x73b0d8+'.'+_0x4a7a63+_0x7a05('0x11')+_0x1e2f9e+'.'+_0x4a7a63)[_0x7a05('0x12')](_0xa3c03e+_0x7a05('0x13')+_0x463a80[_0x7a05('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x31c140,_0x351ac2){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7a05('0x15')][_0x7a05('0x16')]('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0x37d394){if(_0x37d394!==null){var _0x8ad482=[];for(var _0x480c8b=0x0;_0x480c8b<_0x37d394[_0x7a05('0x17')];_0x480c8b++){var _0x3b45e9=_0x37d394[_0x480c8b];if(!_['isNil'](_0x3b45e9[_0x7a05('0xf')])){if(!_[_0x7a05('0x18')](_0x3b45e9[_0x7a05('0x19')]))_0x8ad482['push'](insertAdditionalPhones(_0x3b45e9));promisesContact['push']({'contact':_0x3b45e9});}}}Promise[_0x7a05('0x1a')](_0x8ad482)['then'](function(){_0x31c140({'val':0x1});});})[_0x7a05('0x1b')](function(_0x37a562){logger['error'](_0x37a562['message']);});});}function insertAdditionalPhones(_0x4d8c17){return new Promise(function(_0x2acc80,_0x296177){var _0x443f33=_0x4d8c17[_0x7a05('0x19')];if(_['isNil'](_0x443f33))_0x296177({'val':0x0});else{var _0x1db649=_0x443f33[_0x7a05('0x1c')](';');var _0x3e9ef2=[];orderBy=0x0;for(var _0x593c1b=0x0;_0x593c1b<_0x1db649[_0x7a05('0x17')];_0x593c1b++){_0x3e9ef2[_0x7a05('0x1d')](splitAdditionalPhone(_0x4d8c17['id'],_0x1db649[_0x593c1b]));}Promise[_0x7a05('0x1a')](_0x3e9ef2)[_0x7a05('0x1e')](function(){_0x2acc80({'val':_0x1db649[_0x7a05('0x17')]});});}});}function splitAdditionalPhone(_0x472bdd,_0xb23a2a){return new Promise(function(_0x29c958,_0x133f49){var _0x219a94=_0xb23a2a[_0x7a05('0x1c')](':');var _0x4beb4a=_0x219a94[0x0];var _0x591ab5=_0x219a94[0x1];if(_0x591ab5!==''){var _0x5a2fc5=_0x591ab5[_0x7a05('0x1c')]('|');var _0x172d79=[];for(var _0x124697=0x0;_0x124697<_0x5a2fc5[_0x7a05('0x17')];_0x124697++){if(_0x5a2fc5[_0x124697]!==''){var _0x465dd6=_[_0x7a05('0x1f')](promisesAdditionalPhones,{'contactId':_0x472bdd,'phone':_0x5a2fc5[_0x124697]});if(_0x465dd6[_0x7a05('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x7a05('0x1d')]({'contactId':_0x472bdd,'contactTypeId':_0x4beb4a,'phone':_0x5a2fc5[_0x124697],'orderBy':orderBy});}}}_0x29c958({'ok':0x1});}else _0x29c958({'res':0x0});});}function createAdditionalPhone(_0xc45b3e,_0x4a5cf8,_0x49e37b,_0x20a4f2){var _0x57e4e2='';var _0x4f26bc='';var _0x2cd660=_0x49e37b[_0x7a05('0x1c')]('§');_0x57e4e2=_0x2cd660[0x0];if(_0x2cd660[_0x7a05('0x17')]==0x2)_0x4f26bc=_0x2cd660[0x1];return new Promise(function(_0x210c6f,_0x37a4f6){return db['CmContactHasItem'][_0x7a05('0x20')]({'where':{'CmContactId':_0xc45b3e,'item':_0x57e4e2}})[_0x7a05('0x1e')](function(_0x37dbf1){if(_0x37dbf1){return db['CmContactHasItem'][_0x7a05('0x21')]({'ItemTypeId':_0x4a5cf8,'description':_0x4f26bc,'OrderBy':_0x20a4f2},{'where':{'CmContactId':_0xc45b3e,'item':_0x57e4e2}})[_0x7a05('0x1e')](function(_0xae8ebe){_0x210c6f({'res':'updated'});});}else{return db[_0x7a05('0x22')][_0x7a05('0x23')]({'CmContactId':_0xc45b3e,'item':_0x57e4e2,'ItemTypeId':_0x4a5cf8,'description':_0x4f26bc,'OrderBy':_0x20a4f2,'ItemClass':_0x7a05('0x24')})[_0x7a05('0x1e')](function(_0x5a8587){_0x210c6f({'res':_0x7a05('0x25')});});}});});}function updateContact(_0x4dd3b1){return new Promise(function(_0x2580fe,_0x41ec2a){var _0x560575=_0x4dd3b1['id'];delete _0x4dd3b1['id'];return db[_0x7a05('0x26')][_0x7a05('0x21')](_0x4dd3b1,{'where':{'id':_0x560575}})[_0x7a05('0x1e')](function(_0x4e52bd){updatedRows+=0x1;return db[_0x7a05('0x27')][_0x7a05('0x21')]({'phone':_0x4dd3b1['phone']},{'where':{'ContactId':_0x560575}})[_0x7a05('0x1e')](function(_0x40ed80){_0x2580fe({'ret':'OK'});});});});}function insertCmHopper(_0x4f0fb6,_0x5ec5e1,_0x3de609,_0x423418,_0x547c40){var _0x1a62a6=[_0x7a05('0x28'),_0x7a05('0x29'),_0x7a05('0x2a'),'cm_contacts.ListId',_0x5ec5e1+'.'+_0x423418,_0x7a05('0x2b'),_0x7a05('0x2c'),_0x7a05('0x2d'),_0x7a05('0x2e'),'\x22'+_0x547c40+'\x22'];return squel['insert']()['into'](_0x7a05('0x2f'))['fromQuery']([_0x7a05('0xf'),'scheduledat','ContactId',_0x7a05('0x30'),_0x423418,_0x7a05('0x31'),_0x7a05('0x32'),_0x7a05('0x33'),_0x7a05('0x34'),_0x7a05('0x35')],squel[_0x7a05('0x36')]()[_0x7a05('0x37')](_0x1a62a6)[_0x7a05('0x10')](_0x5ec5e1)[_0x7a05('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x5ec5e1+_0x7a05('0x38'))[_0x7a05('0x14')](_0x3de609,null,_0x3de609+_0x7a05('0x39')+_0x5ec5e1+'.'+_0x423418)[_0x7a05('0x12')](_0x5ec5e1+'.CmListId\x20=\x20?',_0x4f0fb6)[_0x7a05('0x12')](_0x7a05('0x3a'),NOW)['where'](_0x7a05('0x3b'),selectNotIn(_0x5ec5e1,_0x3de609,_0x423418,_0x7a05('0x2f'),[_0x7a05('0x3c'),_0x7a05('0x3d')]))[_0x7a05('0x12')](_0x7a05('0x3b'),selectNotIn(_0x5ec5e1,_0x3de609,_0x423418,_0x7a05('0x2f'),[_0x7a05('0x3c')])))['toString']();}function insertCmHopperBlack(_0x411f47,_0x1ab496,_0x255d61,_0x487e85){var _0x12d5f0=[_0x7a05('0x28'),_0x7a05('0x2a'),_0x7a05('0x3e'),_0x1ab496+'.'+_0x487e85,'cm_contacts.createdAt',_0x7a05('0x2c')];return squel['insert']()['into'](_0x7a05('0x3f'))[_0x7a05('0x40')](['phone',_0x7a05('0x41'),_0x7a05('0x30'),_0x487e85,_0x7a05('0x31'),_0x7a05('0x32')],squel[_0x7a05('0x36')]()[_0x7a05('0x37')](_0x12d5f0)[_0x7a05('0x10')](_0x1ab496)[_0x7a05('0x14')](_0x7a05('0x42'),null,_0x7a05('0x43')+_0x1ab496+_0x7a05('0x38'))[_0x7a05('0x14')](_0x255d61,null,_0x255d61+_0x7a05('0x39')+_0x1ab496+'.'+_0x487e85)[_0x7a05('0x12')](_0x1ab496+_0x7a05('0x44'),_0x411f47)['where'](_0x7a05('0x3a'),NOW)[_0x7a05('0x12')](_0x7a05('0x3b'),squel[_0x7a05('0x36')]()['field'](_0x7a05('0xf'))[_0x7a05('0x10')](_0x7a05('0x3f'))[_0x7a05('0x12')]('ListId\x20=\x20?',_0x411f47)[_0x7a05('0x12')](_0x487e85+'\x20=\x20?',_0x1ab496+'.'+_0x487e85)))[_0x7a05('0x45')]();}function insertCmHopperAdditionalPhones(_0x3b871f){var _0x4876f0=[_0x7a05('0x46'),_0x7a05('0x47'),_0x7a05('0x48'),'cm_contact_has_items.createdAt',_0x7a05('0x49')];return squel[_0x7a05('0x4a')]()[_0x7a05('0x4b')](_0x7a05('0x4c'))['fromQuery']([_0x7a05('0x4d'),'phone',_0x7a05('0x4e'),_0x7a05('0x31'),_0x7a05('0x32')],squel[_0x7a05('0x36')]()[_0x7a05('0x37')](_0x4876f0)[_0x7a05('0x10')](_0x7a05('0x2f'))[_0x7a05('0x14')](_0x7a05('0x42'),null,_0x7a05('0x4f'))['join'](_0x7a05('0x50'),null,_0x7a05('0x51'))[_0x7a05('0x12')](_0x7a05('0x52'),_0x3b871f)[_0x7a05('0x12')](_0x7a05('0x3a'),NOW))[_0x7a05('0x45')]();}function insertCmContact(_0x54a5d8,_0x197b83,_0x27eff0,_0x254202){var _0x50d1c0=_['concat'](_[_0x7a05('0x53')](_0x254202),[_0x7a05('0x30'),'CompanyId',_0x7a05('0x31'),_0x7a05('0x32')]);return squel[_0x7a05('0x4a')]()[_0x7a05('0x4b')](_0x7a05('0x42'))[_0x7a05('0x40')](_0x50d1c0,squel[_0x7a05('0x36')]()['fields'](_0x50d1c0)[_0x7a05('0x10')](_0x197b83)[_0x7a05('0x12')]('('+_0x27eff0[_0x7a05('0x14')](',')+_0x7a05('0x54'),squel[_0x7a05('0x36')]()[_0x7a05('0x37')](_0x27eff0)[_0x7a05('0x10')](_0x7a05('0x42'))[_0x7a05('0x12')](_0x7a05('0x55'),_0x54a5d8))[_0x7a05('0x12')]('id\x20IN\x20?',squel[_0x7a05('0x36')]()[_0x7a05('0x56')](_0x7a05('0x57'),_0x7a05('0x58'))[_0x7a05('0x10')](_0x197b83)['group'](_0x27eff0['join'](','))))[_0x7a05('0x45')]();}function handleStop(){logger[_0x7a05('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4e98d7){logger[_0x7a05('0x5a')](_0x4e98d7[_0x7a05('0x5b')]);process['exit'](0x1);}function handleError(_0x14ffa8,_0x42183a){stats[_0x7a05('0x5c')][_0x7a05('0x1d')]({'name':_0x42183a[_0x7a05('0x5d')],'message':_0x42183a[_0x7a05('0x5b')],'row':_0x14ffa8});}function handleQuery(_0x8ebae){logger[_0x7a05('0x59')](_0x8ebae);return db['sequelize'][_0x7a05('0x16')](_0x8ebae)[_0x7a05('0x5e')](function(_0x9bf39a){results[_0x7a05('0x1d')](_0x9bf39a);})['catch'](function(_0xc3e758){logger[_0x7a05('0x5a')](_0xc3e758['message']);});}function main(_0x5e618f,_0x5703f3,_0x2247b1,_0x4e405d){logger['info'](_0x7a05('0x5f'),_0x5e618f,JSON['stringify'](_0x5703f3));process[_0x7a05('0x60')](_0x7a05('0x61'));var _0x3bbab7=_0x5703f3[_0x7a05('0x62')];var _0x6c4afd=_[_0x7a05('0x63')](_0x3bbab7);var _0x40e672=_0x5703f3[_0x7a05('0x64')];var _0xb46043=path[_0x7a05('0x14')](config[_0x7a05('0x65')],_0x7a05('0x66'),_0x40e672+'.csv');logger[_0x7a05('0x59')](_0x7a05('0x67'),_0x5703f3);db[_0x7a05('0x68')][_0x7a05('0x69')]({'raw':!![],'attributes':['id',_0x7a05('0x6a')]})[_0x7a05('0x1e')](function(_0x3984d2){for(var _0x87560d=0x0;_0x87560d<_0x3984d2[_0x7a05('0x17')];_0x87560d++){if(_0x3984d2[_0x87560d][_0x7a05('0x6a')]in _0x3bbab7){contactItemTypes[_0x7a05('0x1d')](_0x3984d2[_0x87560d]);delete _0x6c4afd[_0x3984d2[_0x87560d][_0x7a05('0x6a')]];hasAdditionalPhones=!![];}for(var _0x2758e6 in _0x3bbab7){if(_0x3984d2[_0x87560d][_0x7a05('0x6a')]+'_description'===_0x2758e6){phoneDescriptions['push']({'itemTypeId':_0x3984d2[_0x87560d]['id'],'description':_0x2758e6});delete _0x6c4afd[_0x2758e6];}}}if(hasAdditionalPhones)_0x6c4afd[_0x7a05('0x19')]='';var _0x414260=_[_0x7a05('0x53')](_0x6c4afd)['join']();logger['info'](_0x7a05('0x6b'),_0x414260);fs[_0x7a05('0x6c')](_0xb46043,_0x414260+'\x0a');Papa[_0x7a05('0x6d')](fs['createReadStream'](_0x5e618f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x147bb0,_0x4d7bd4){try{for(var _0x2e3031=0x0,_0x54a209=[];_0x2e3031<_0x147bb0['data'][_0x7a05('0x17')];_0x2e3031++){stats[_0x7a05('0x6e')]+=0x1;if(_0x147bb0[_0x7a05('0x5c')][_0x2e3031]){handleError(_0x147bb0['data'][_0x2e3031],_0x147bb0[_0x7a05('0x5c')][_0x2e3031]);}else{var _0x3b3b5d=[];var _0x530db9=[];var _0x3e9dff={};for(var _0x1788db in _0x3bbab7){let _0x37b696=contactItemTypes[_0x7a05('0x6f')](_0x418f4a=>_0x418f4a[_0x7a05('0x6a')]===_0x1788db);let _0xeedb6a=contactItemTypes[_0x7a05('0x6f')](_0x4503e0=>_0x4503e0[_0x7a05('0x6a')]+'_description'===_0x1788db);if(_[_0x7a05('0x18')](_0x37b696)&&_['isNil'](_0xeedb6a)){if(_0x3bbab7[_0x7a05('0x70')](_0x1788db)){if(_0x147bb0[_0x7a05('0x71')][_0x2e3031][_0x3bbab7[_0x1788db]]){var _0x45e46d=_[_0x7a05('0x72')](_0x147bb0[_0x7a05('0x71')][_0x2e3031][_0x3bbab7[_0x1788db]]['replace'](/"/g,'\x27'));switch(_0x1788db){case'scheduledat':var _0x544c5c=moment(_0x45e46d,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x544c5c[_0x7a05('0x73')]()){_0x54a209['push']('\x22'+_0x45e46d+'\x22');}else{_0x3b3b5d[_0x7a05('0x1d')](_0x7a05('0x74'));}break;case'priority':var _0x112095=parseInt(_0x45e46d);_0x45e46d=_['isNaN'](_0x112095)||_0x112095<0x0||_0x112095>0x4?_0x4e405d?0x3:0x2:_0x112095;_0x54a209[_0x7a05('0x1d')]('\x22'+_0x45e46d+'\x22');break;case _0x7a05('0x34'):var _0x108a30=parseInt(_0x45e46d);if(_['isNumber'](_0x108a30)&&_[_0x7a05('0x75')](_0x2247b1,_0x108a30)){_0x54a209['push']('\x22'+_0x108a30+'\x22');}else{_0x3b3b5d[_0x7a05('0x1d')](_0x7a05('0x76'));}break;case _0x7a05('0x77'):if(isEmail(_0x45e46d)){_0x54a209[_0x7a05('0x1d')]('\x22'+_0x45e46d+'\x22');}else{_0x3b3b5d[_0x7a05('0x1d')](_0x7a05('0x78'));}break;case'dateOfBirth':var _0x5ee102=moment(_0x45e46d,'YYYY-MM-DD',!![]);if(_0x5ee102[_0x7a05('0x73')]()){_0x54a209['push']('\x22'+_0x45e46d+'\x22');}else{_0x3b3b5d[_0x7a05('0x1d')](_0x7a05('0x79'));}break;default:_0x54a209['push']('\x22'+_0x45e46d+'\x22');}}else{switch(_0x1788db){case _0x7a05('0x7a'):case _0x7a05('0xf'):_0x3b3b5d[_0x7a05('0x1d')](_0x1788db+_0x7a05('0x7b'));break;default:_0x54a209[_0x7a05('0x1d')]('\x22\x22');}}}}else{var _0x2c40ee='';if(!_['isNil'](_0x37b696)){if(!_0x3e9dff[_0x7a05('0x70')](_0x37b696['id'])){for(var _0xfd9395=0x0;_0xfd9395<_0x3bbab7[_0x1788db]['length'];_0xfd9395++){var _0x45e46d=_[_0x7a05('0x72')](_0x147bb0[_0x7a05('0x71')][_0x2e3031][_0x3bbab7[_0x1788db][_0xfd9395]][_0x7a05('0x7c')](/"/g,'\x27'));var _0x2cefdf=phoneDescriptions[_0x7a05('0x6f')](_0xbcb153=>_0xbcb153['itemTypeId']===_0x37b696['id']);if(!_[_0x7a05('0x18')](_0x2cefdf)){var _0x1e3344=_[_0x7a05('0x72')](_0x147bb0[_0x7a05('0x71')][_0x2e3031][_0x3bbab7[_0x2cefdf[_0x7a05('0x7d')]][0x0]][_0x7a05('0x7c')](/"/g,'\x27'));if(!_[_0x7a05('0x18')](_0x1e3344))_0x45e46d=_0x45e46d+'§'+_0x1e3344;}if(_0x2c40ee=='')_0x2c40ee=_0x45e46d;else _0x2c40ee+='|'+_0x45e46d;}_0x530db9[_0x7a05('0x1d')](_0x37b696['id']+':'+_0x2c40ee);_0x3e9dff[_0x37b696['id']]=0x1;}}}}if(hasAdditionalPhones){_0x54a209[_0x7a05('0x1d')]('\x22'+_0x530db9['join'](';')+'\x22');}if(_0x3b3b5d[_0x7a05('0x17')]){handleError(_0x147bb0[_0x7a05('0x71')][_0x2e3031],{'code':_0x7a05('0x7e'),'message':_0x3b3b5d[_0x7a05('0x14')]()});}else{fs[_0x7a05('0x7f')](_0xb46043,_0x54a209[_0x7a05('0x14')]()+'\x0a');}_0x54a209=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x40e672,stats);stats['errors']=[];}}if(stopped){logger[_0x7a05('0x59')](_0x7a05('0x80'));_0x4d7bd4[_0x7a05('0x81')]();}}catch(_0x2a0f66){handleError(_0x147bb0['data'][_0x2e3031],{'code':_0x7a05('0x82'),'message':_0x2a0f66[_0x7a05('0x5b')]});logger[_0x7a05('0x5a')](_0x7a05('0x83'),_0x2a0f66['message']);}},'complete':function(){try{var _0x572c6b=[];var _0x1ffe0c=tempTableName;_0x572c6b[_0x7a05('0x1d')](_0x7a05('0x84')+_0x1ffe0c+_0x7a05('0x85'));logger[_0x7a05('0x59')]('CIS\x20len',contactItemTypes[_0x7a05('0x17')]);var _0x51a993=util['format'](_0x7a05('0x86'),_0xb46043,_0x1ffe0c,_0x414260,_0x5703f3[_0x7a05('0x30')],_0x5703f3[_0x7a05('0x87')]||null,NOW,NOW);if(_['isNil'](_0x3bbab7[_0x7a05('0x88')])){_0x51a993+=',\x20scheduledAt\x20=\x20NOW()';}_0x572c6b[_0x7a05('0x1d')](_0x51a993);BPromise[_0x7a05('0x89')](_0x572c6b,handleQuery)[_0x7a05('0x1e')](function(_0x1e6e83){BPromise[_0x7a05('0x1a')]([handleAdditionalPhones()])[_0x7a05('0x1e')](function(){_0x572c6b=[];for(var _0x4df7a5=0x0;_0x4df7a5\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','moment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','cm_contacts_temp_','YYYYMMDDHHmmss','test','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','then','catch','error','message','split','filter','findOne','CmContactHasItem','update','updated','create','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','select','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.createdAt','cm_hopper_black','field','from','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','fromQuery','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id'];(function(_0x31c5e9,_0x30e373){var _0x517a8d=function(_0x7f9a48){while(--_0x7f9a48){_0x31c5e9['push'](_0x31c5e9['shift']());}};_0x517a8d(++_0x30e373);}(_0x315f,0x174));var _0xf315=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x315f[_0x83af7f];return _0x32d85c;};'use strict';var fs=require('fs');var path=require(_0xf315('0x0'));var _=require('lodash');var Papa=require(_0xf315('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xf315('0x2'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xf315('0x3'))('import');config[_0xf315('0x4')]=_[_0xf315('0x5')](config[_0xf315('0x4')],{'host':_0xf315('0x6'),'port':0x18eb});var socket=require(_0xf315('0x7'))(new Redis(config[_0xf315('0x4')]));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()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xf315('0x8')+moment()['format'](_0xf315('0x9'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x150ba0){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))*$/[_0xf315('0xa')](_0x150ba0);}function selectNotIn(_0x272156,_0x143e1c,_0x50b49e,_0x48f0d4,_0x42d26a){return squel['select']()['field'](_0xf315('0xb'))['from'](_0x48f0d4)[_0xf315('0xc')](_0x143e1c,null,_0x143e1c+_0xf315('0xd')+_0x48f0d4+'.'+_0x50b49e)[_0xf315('0xe')](_0x48f0d4+'.'+_0x50b49e+_0xf315('0xf')+_0x272156+'.'+_0x50b49e)['where'](_0x143e1c+_0xf315('0x10')+_0x42d26a[_0xf315('0xc')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x56deea,_0x19bb1a){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xf315('0x11')](_0xf315('0x12')+tempTableName)[_0xf315('0x13')](function(_0x22c049){if(_0x22c049!==null){var _0x45fc6d=[];for(var _0x3c2e05=0x0;_0x3c2e05<_0x22c049[_0xf315('0x14')];_0x3c2e05++){var _0x44e8ab=_0x22c049[_0x3c2e05];if(!_[_0xf315('0x15')](_0x44e8ab[_0xf315('0xb')])){if(!_[_0xf315('0x15')](_0x44e8ab[_0xf315('0x16')]))_0x45fc6d[_0xf315('0x17')](insertAdditionalPhones(_0x44e8ab));promisesContact[_0xf315('0x17')]({'contact':_0x44e8ab});}}}Promise['all'](_0x45fc6d)[_0xf315('0x18')](function(){_0x56deea({'val':0x1});});})[_0xf315('0x19')](function(_0x28d528){logger[_0xf315('0x1a')](_0x28d528[_0xf315('0x1b')]);});});}function insertAdditionalPhones(_0xf695e4){return new Promise(function(_0x46fb5d,_0x42e89f){var _0x558377=_0xf695e4[_0xf315('0x16')];if(_[_0xf315('0x15')](_0x558377))_0x42e89f({'val':0x0});else{var _0x9159ca=_0x558377[_0xf315('0x1c')](';');var _0x21dfad=[];orderBy=0x0;for(var _0x56f6e3=0x0;_0x56f6e3<_0x9159ca[_0xf315('0x14')];_0x56f6e3++){_0x21dfad['push'](splitAdditionalPhone(_0xf695e4['id'],_0x9159ca[_0x56f6e3]));}Promise['all'](_0x21dfad)['then'](function(){_0x46fb5d({'val':_0x9159ca[_0xf315('0x14')]});});}});}function splitAdditionalPhone(_0x219bf2,_0x14021d){return new Promise(function(_0x3dd922,_0x523ee9){var _0x5b6a9b=_0x14021d[_0xf315('0x1c')](':');var _0x10354c=_0x5b6a9b[0x0];var _0x4b730d=_0x5b6a9b[0x1];if(_0x4b730d!==''){var _0x325a29=_0x4b730d['split']('|');var _0x52b51=[];for(var _0x4d16e2=0x0;_0x4d16e2<_0x325a29[_0xf315('0x14')];_0x4d16e2++){if(_0x325a29[_0x4d16e2]!==''){var _0x379b5b=_[_0xf315('0x1d')](promisesAdditionalPhones,{'contactId':_0x219bf2,'phone':_0x325a29[_0x4d16e2]});if(_0x379b5b[_0xf315('0x14')]==0x0){orderBy++;promisesAdditionalPhones[_0xf315('0x17')]({'contactId':_0x219bf2,'contactTypeId':_0x10354c,'phone':_0x325a29[_0x4d16e2],'orderBy':orderBy});}}}_0x3dd922({'ok':0x1});}else _0x3dd922({'res':0x0});});}function createAdditionalPhone(_0x478cca,_0x510ad6,_0x456325,_0x2072db){var _0x8866ef='';var _0x46ceb3='';var _0x25b141=_0x456325[_0xf315('0x1c')]('§');_0x8866ef=_0x25b141[0x0];if(_0x25b141[_0xf315('0x14')]==0x2)_0x46ceb3=_0x25b141[0x1];return new Promise(function(_0x443773,_0x11993e){return db['CmContactHasItem'][_0xf315('0x1e')]({'where':{'CmContactId':_0x478cca,'item':_0x8866ef}})[_0xf315('0x18')](function(_0x41bfdc){if(_0x41bfdc){return db[_0xf315('0x1f')][_0xf315('0x20')]({'ItemTypeId':_0x510ad6,'description':_0x46ceb3,'OrderBy':_0x2072db},{'where':{'CmContactId':_0x478cca,'item':_0x8866ef}})[_0xf315('0x18')](function(_0x36afcd){_0x443773({'res':_0xf315('0x21')});});}else{return db['CmContactHasItem'][_0xf315('0x22')]({'CmContactId':_0x478cca,'item':_0x8866ef,'ItemTypeId':_0x510ad6,'description':_0x46ceb3,'OrderBy':_0x2072db,'ItemClass':'PHONE'})[_0xf315('0x18')](function(_0x3ebe6c){_0x443773({'res':_0xf315('0x23')});});}});});}function updateContact(_0x1df5ad){return new Promise(function(_0xe5550f,_0x1430f0){var _0x1c2195=_0x1df5ad['id'];delete _0x1df5ad['id'];return db['CmContact'][_0xf315('0x20')](_0x1df5ad,{'where':{'id':_0x1c2195}})[_0xf315('0x18')](function(_0x10ac94){updatedRows+=0x1;return db['CmHopper'][_0xf315('0x20')]({'phone':_0x1df5ad[_0xf315('0xb')]},{'where':{'ContactId':_0x1c2195}})[_0xf315('0x18')](function(_0x357915){_0xe5550f({'ret':'OK'});});});});}function insertCmHopper(_0x172968,_0x34d592,_0x4d1e17,_0x5d29ca,_0x202d97){var _0x5efc19=[_0xf315('0x24'),'cm_contacts.scheduledat','cm_contacts.id',_0xf315('0x25'),_0x34d592+'.'+_0x5d29ca,'cm_contacts.createdAt',_0xf315('0x26'),_0xf315('0x27'),_0xf315('0x28'),'\x22'+_0x202d97+'\x22'];return squel[_0xf315('0x29')]()[_0xf315('0x2a')](_0xf315('0x2b'))['fromQuery']([_0xf315('0xb'),_0xf315('0x2c'),_0xf315('0x2d'),_0xf315('0x2e'),_0x5d29ca,_0xf315('0x2f'),_0xf315('0x30'),_0xf315('0x31'),_0xf315('0x32'),'recallme'],squel[_0xf315('0x33')]()[_0xf315('0x34')](_0x5efc19)['from'](_0x34d592)[_0xf315('0xc')](_0xf315('0x35'),null,_0xf315('0x36')+_0x34d592+_0xf315('0x37'))[_0xf315('0xc')](_0x4d1e17,null,_0x4d1e17+'.id\x20=\x20'+_0x34d592+'.'+_0x5d29ca)['where'](_0x34d592+_0xf315('0x38'),_0x172968)[_0xf315('0xe')](_0xf315('0x39'),NOW)[_0xf315('0xe')](_0xf315('0x3a'),selectNotIn(_0x34d592,_0x4d1e17,_0x5d29ca,'cm_hopper',[_0xf315('0x3b'),_0xf315('0x3c')]))[_0xf315('0xe')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x34d592,_0x4d1e17,_0x5d29ca,_0xf315('0x2b'),[_0xf315('0x3b')])))[_0xf315('0x3d')]();}function insertCmHopperBlack(_0x830f26,_0x96c222,_0x4d8e86,_0x12dbdf){var _0x3dc79b=['cm_contacts.phone','cm_contacts.id',_0xf315('0x25'),_0x96c222+'.'+_0x12dbdf,_0xf315('0x3e'),'cm_contacts.updatedAt'];return squel[_0xf315('0x29')]()[_0xf315('0x2a')](_0xf315('0x3f'))['fromQuery']([_0xf315('0xb'),_0xf315('0x2d'),_0xf315('0x2e'),_0x12dbdf,_0xf315('0x2f'),'updatedAt'],squel[_0xf315('0x33')]()[_0xf315('0x34')](_0x3dc79b)['from'](_0x96c222)['join'](_0xf315('0x35'),null,_0xf315('0x36')+_0x96c222+'.CmListId')[_0xf315('0xc')](_0x4d8e86,null,_0x4d8e86+_0xf315('0xd')+_0x96c222+'.'+_0x12dbdf)['where'](_0x96c222+_0xf315('0x38'),_0x830f26)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf315('0xe')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf315('0x33')]()[_0xf315('0x40')](_0xf315('0xb'))[_0xf315('0x41')]('cm_hopper_black')[_0xf315('0xe')](_0xf315('0x42'),_0x830f26)[_0xf315('0xe')](_0x12dbdf+_0xf315('0x43'),_0x96c222+'.'+_0x12dbdf)))[_0xf315('0x3d')]();}function insertCmHopperAdditionalPhones(_0x55d1a3){var _0xbdd4bb=['cm_hopper.id',_0xf315('0x44'),_0xf315('0x45'),'cm_contact_has_items.createdAt',_0xf315('0x46')];return squel['insert']()[_0xf315('0x2a')](_0xf315('0x47'))[_0xf315('0x48')]([_0xf315('0x49'),_0xf315('0xb'),_0xf315('0x4a'),_0xf315('0x2f'),_0xf315('0x30')],squel[_0xf315('0x33')]()[_0xf315('0x34')](_0xbdd4bb)[_0xf315('0x41')](_0xf315('0x2b'))[_0xf315('0xc')](_0xf315('0x35'),null,_0xf315('0x4b'))['join']('cm_contact_has_items',null,_0xf315('0x4c'))[_0xf315('0xe')](_0xf315('0x4d'),_0x55d1a3)[_0xf315('0xe')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xf315('0x3d')]();}function insertCmContact(_0xf7328b,_0x165c71,_0x2bc208,_0x597622){var _0x246e1e=_[_0xf315('0x4e')](_[_0xf315('0x4f')](_0x597622),[_0xf315('0x2e'),'CompanyId',_0xf315('0x2f'),_0xf315('0x30')]);return squel[_0xf315('0x29')]()[_0xf315('0x2a')](_0xf315('0x35'))[_0xf315('0x48')](_0x246e1e,squel[_0xf315('0x33')]()[_0xf315('0x34')](_0x246e1e)[_0xf315('0x41')](_0x165c71)[_0xf315('0xe')]('('+_0x2bc208[_0xf315('0xc')](',')+_0xf315('0x50'),squel['select']()[_0xf315('0x34')](_0x2bc208)[_0xf315('0x41')](_0xf315('0x35'))[_0xf315('0xe')](_0xf315('0x42'),_0xf7328b))[_0xf315('0xe')](_0xf315('0x51'),squel[_0xf315('0x33')]()[_0xf315('0x40')](_0xf315('0x52'),_0xf315('0x53'))[_0xf315('0x41')](_0x165c71)['group'](_0x2bc208['join'](','))))[_0xf315('0x3d')]();}function handleStop(){logger[_0xf315('0x54')](_0xf315('0x55'));stopped=!![];}function handleUncaughtException(_0x29033e){logger['error'](_0x29033e[_0xf315('0x1b')]);process[_0xf315('0x56')](0x1);}function handleError(_0x4dbd0d,_0x1b8982){stats[_0xf315('0x57')]['push']({'name':_0x1b8982[_0xf315('0x58')],'message':_0x1b8982[_0xf315('0x1b')],'row':_0x4dbd0d});}function handleQuery(_0x29c3ba){logger[_0xf315('0x54')](_0x29c3ba);return db[_0xf315('0x59')][_0xf315('0x11')](_0x29c3ba)[_0xf315('0x13')](function(_0x15c586){results['push'](_0x15c586);})[_0xf315('0x19')](function(_0x39facb){logger[_0xf315('0x1a')](_0x39facb[_0xf315('0x1b')]);});}function main(_0x56ba90,_0x39a17b,_0x72bc4c,_0xec4df7){logger[_0xf315('0x54')](_0xf315('0x5a'),_0x56ba90,JSON[_0xf315('0x5b')](_0x39a17b));process[_0xf315('0x5c')](_0xf315('0x5d'));var _0x5bb2ad=_0x39a17b[_0xf315('0x5e')];var _0x24a10f=_[_0xf315('0x5f')](_0x5bb2ad);var _0x5eae43=_0x39a17b[_0xf315('0x60')];var _0x199990=path[_0xf315('0xc')](config[_0xf315('0x61')],'server/files/tmp',_0x5eae43+_0xf315('0x62'));logger[_0xf315('0x54')](_0xf315('0x63'),_0x39a17b);db[_0xf315('0x64')][_0xf315('0x65')]({'raw':!![],'attributes':['id',_0xf315('0x66')]})[_0xf315('0x18')](function(_0x315a61){for(var _0x3c4660=0x0;_0x3c4660<_0x315a61['length'];_0x3c4660++){if(_0x315a61[_0x3c4660]['name']in _0x5bb2ad){contactItemTypes[_0xf315('0x17')](_0x315a61[_0x3c4660]);delete _0x24a10f[_0x315a61[_0x3c4660][_0xf315('0x66')]];hasAdditionalPhones=!![];}for(var _0x4d85ce in _0x5bb2ad){if(_0x315a61[_0x3c4660][_0xf315('0x66')]+_0xf315('0x67')===_0x4d85ce){phoneDescriptions[_0xf315('0x17')]({'itemTypeId':_0x315a61[_0x3c4660]['id'],'description':_0x4d85ce});delete _0x24a10f[_0x4d85ce];}}}if(hasAdditionalPhones)_0x24a10f[_0xf315('0x16')]='';var _0x360c3a=_['keys'](_0x24a10f)[_0xf315('0xc')]();logger[_0xf315('0x54')]('header',_0x360c3a);fs[_0xf315('0x68')](_0x199990,_0x360c3a+'\x0a');Papa[_0xf315('0x69')](fs['createReadStream'](_0x56ba90),{'header':!![],'skipEmptyLines':!![],'step':function(_0x159e34,_0x2bcfb9){try{for(var _0x3cfca6=0x0,_0x5d8d5a=[];_0x3cfca6<_0x159e34[_0xf315('0x6a')][_0xf315('0x14')];_0x3cfca6++){stats[_0xf315('0x6b')]+=0x1;if(_0x159e34['errors'][_0x3cfca6]){handleError(_0x159e34[_0xf315('0x6a')][_0x3cfca6],_0x159e34['errors'][_0x3cfca6]);}else{var _0x2aec74=[];var _0x323504=[];var _0x3569df={};for(var _0x5ab151 in _0x5bb2ad){let _0x546c10=contactItemTypes['find'](_0x22c8f6=>_0x22c8f6[_0xf315('0x66')]===_0x5ab151);let _0x5cc49a=contactItemTypes[_0xf315('0x6c')](_0x21813e=>_0x21813e['name']+_0xf315('0x67')===_0x5ab151);if(_[_0xf315('0x15')](_0x546c10)&&_[_0xf315('0x15')](_0x5cc49a)){if(_0x5bb2ad[_0xf315('0x6d')](_0x5ab151)){if(_0x159e34[_0xf315('0x6a')][_0x3cfca6][_0x5bb2ad[_0x5ab151]]){var _0x53e030=_[_0xf315('0x6e')](_0x159e34[_0xf315('0x6a')][_0x3cfca6][_0x5bb2ad[_0x5ab151]][_0xf315('0x6f')](/"/g,'\x27'));switch(_0x5ab151){case _0xf315('0x2c'):var _0x19f6c6=moment(_0x53e030,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x19f6c6[_0xf315('0x70')]()){_0x5d8d5a['push']('\x22'+_0x53e030+'\x22');}else{_0x2aec74[_0xf315('0x17')](_0xf315('0x71'));}break;case _0xf315('0x31'):var _0x108295=parseInt(_0x53e030);_0x53e030=_[_0xf315('0x72')](_0x108295)||_0x108295<0x0||_0x108295>0x4?_0xec4df7?0x3:0x2:_0x108295;_0x5d8d5a[_0xf315('0x17')]('\x22'+_0x53e030+'\x22');break;case _0xf315('0x32'):var _0x5e7746=parseInt(_0x53e030);if(_['isNumber'](_0x5e7746)&&_[_0xf315('0x73')](_0x72bc4c,_0x5e7746)){_0x5d8d5a[_0xf315('0x17')]('\x22'+_0x5e7746+'\x22');}else{_0x2aec74[_0xf315('0x17')](_0xf315('0x74'));}break;case _0xf315('0x75'):if(isEmail(_0x53e030)){_0x5d8d5a['push']('\x22'+_0x53e030+'\x22');}else{_0x2aec74[_0xf315('0x17')](_0xf315('0x76'));}break;case _0xf315('0x77'):var _0x5b8d80=moment(_0x53e030,_0xf315('0x78'),!![]);if(_0x5b8d80[_0xf315('0x70')]()){_0x5d8d5a[_0xf315('0x17')]('\x22'+_0x53e030+'\x22');}else{_0x2aec74['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5d8d5a[_0xf315('0x17')]('\x22'+_0x53e030+'\x22');}}else{switch(_0x5ab151){case _0xf315('0x79'):case _0xf315('0xb'):_0x2aec74['push'](_0x5ab151+'\x20not\x20specified');break;default:_0x5d8d5a[_0xf315('0x17')]('\x22\x22');}}}}else{var _0x482768='';if(!_[_0xf315('0x15')](_0x546c10)){if(!_0x3569df[_0xf315('0x6d')](_0x546c10['id'])){for(var _0x4ba848=0x0;_0x4ba848<_0x5bb2ad[_0x5ab151][_0xf315('0x14')];_0x4ba848++){var _0x53e030=_[_0xf315('0x6e')](_0x159e34[_0xf315('0x6a')][_0x3cfca6][_0x5bb2ad[_0x5ab151][_0x4ba848]][_0xf315('0x6f')](/"/g,'\x27'));var _0x20b4f2=phoneDescriptions[_0xf315('0x6c')](_0x581c12=>_0x581c12[_0xf315('0x7a')]===_0x546c10['id']);if(!_[_0xf315('0x15')](_0x20b4f2)){var _0x4c29ff=_[_0xf315('0x6e')](_0x159e34[_0xf315('0x6a')][_0x3cfca6][_0x5bb2ad[_0x20b4f2[_0xf315('0x7b')]][0x0]][_0xf315('0x6f')](/"/g,'\x27'));if(!_[_0xf315('0x15')](_0x4c29ff))_0x53e030=_0x53e030+'§'+_0x4c29ff;}if(_0x482768=='')_0x482768=_0x53e030;else _0x482768+='|'+_0x53e030;}_0x323504[_0xf315('0x17')](_0x546c10['id']+':'+_0x482768);_0x3569df[_0x546c10['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5d8d5a[_0xf315('0x17')]('\x22'+_0x323504[_0xf315('0xc')](';')+'\x22');}if(_0x2aec74['length']){handleError(_0x159e34[_0xf315('0x6a')][_0x3cfca6],{'code':'SystemRow','message':_0x2aec74['join']()});}else{fs[_0xf315('0x7c')](_0x199990,_0x5d8d5a[_0xf315('0xc')]()+'\x0a');}_0x5d8d5a=[];}if(!(stats[_0xf315('0x6b')]%0xc8)){socket[_0xf315('0x7d')](_0xf315('0x7e')+_0x5eae43,stats);stats[_0xf315('0x57')]=[];}}if(stopped){logger['info'](_0xf315('0x7f'));_0x2bcfb9[_0xf315('0x80')]();}}catch(_0x5802d3){handleError(_0x159e34[_0xf315('0x6a')][_0x3cfca6],{'code':'SystemError','message':_0x5802d3[_0xf315('0x1b')]});logger[_0xf315('0x1a')](_0xf315('0x81'),_0x5802d3[_0xf315('0x1b')]);}},'complete':function(){try{var _0xddd252=[];var _0x56c305=tempTableName;_0xddd252[_0xf315('0x17')](_0xf315('0x82')+_0x56c305+_0xf315('0x83'));logger[_0xf315('0x54')]('CIS\x20len',contactItemTypes[_0xf315('0x14')]);var _0x334542=util[_0xf315('0x84')](_0xf315('0x85'),_0x199990,_0x56c305,_0x360c3a,_0x39a17b[_0xf315('0x2e')],_0x39a17b['CompanyId']||null,NOW,NOW);if(_[_0xf315('0x15')](_0x5bb2ad[_0xf315('0x2c')])){_0x334542+=',\x20scheduledAt\x20=\x20NOW()';}_0xddd252['push'](_0x334542);BPromise['each'](_0xddd252,handleQuery)[_0xf315('0x18')](function(_0x2a3a40){BPromise[_0xf315('0x86')]([handleAdditionalPhones()])[_0xf315('0x18')](function(){_0xddd252=[];for(var _0x1cd4f4=0x0;_0x1cd4f4\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.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.subject','i.thirdDisposition','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','Contact.phone','Contact.mobile','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','Setting','findOne','enableEmailPreview','COUNT(*)','getSelectedTags','isEmpty','where','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','../../mysqldb','getAccountFK','role','agent','select','field','name','color','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','from','users','u.id\x20=\x20ui.UserId','ui.','map','getInteractionsTables','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','it.','\x20=\x20i.id','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','isEmail','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','sqlOperator','conditions','length','find','buildExpression','type','default','text','value','unreadMessages','and','Contact','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','end','Tag','tags','clause','ids','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','plainBody','body','keys','some','compact','\x20IN\x20?','createdAt','parse','$gte','$lte','\x20=\x20?','then','fields','read','filter','capitalize','chat'];(function(_0x11f2af,_0x182726){var _0x260133=function(_0x20ee8d){while(--_0x20ee8d){_0x11f2af['push'](_0x11f2af['shift']());}};_0x260133(++_0x182726);}(_0x34cb,0x17f));var _0xb34c=function(_0x673bf0,_0x2f085f){_0x673bf0=_0x673bf0-0x0;var _0x3d7c02=_0x34cb[_0x673bf0];return _0x3d7c02;};'use strict';var _=require(_0xb34c('0x0'));var squel=require(_0xb34c('0x1'));var as=require(_0xb34c('0x2'));var qs=require(_0xb34c('0x3'));var updateInteraction=require('./update-interaction')[_0xb34c('0x4')];var utils=require('./utils');var db=require(_0xb34c('0x5'))['db'];function skipInteractionsQuery(_0x5324c9,_0x4f1565,_0x49a240){var _0x506fc6=![];var _0x235fb2=utils[_0xb34c('0x6')](_0x5324c9);if(_0x4f1565[_0xb34c('0x7')]===_0xb34c('0x8')&&!_0x49a240['search']&&!_0x49a240[_0x235fb2]){_0x506fc6=!![];}return _0x506fc6;}function getTagsQuery(){return squel[_0xb34c('0x9')]()[_0xb34c('0xa')]('id')[_0xb34c('0xa')](_0xb34c('0xb'))[_0xb34c('0xa')](_0xb34c('0xc'))['from'](_0xb34c('0xd'));}function getUsersQuery(_0x18017a,_0x21e71f){var _0x4203b5=utils[_0xb34c('0xe')](_0x18017a);var _0x3ff190=_0xb34c('0xf')+_0x18017a+_0xb34c('0x10');var _0x33720d=squel[_0xb34c('0x9')]()[_0xb34c('0xa')](_0xb34c('0x11'))['field'](_0xb34c('0x12'))[_0xb34c('0xa')]('ui.'+_0x4203b5)[_0xb34c('0x13')](_0x3ff190,'ui')['left_join'](_0xb34c('0x14'),'u',_0xb34c('0x15'));if(_0x21e71f['length']>0x0){_0x33720d['where'](_0xb34c('0x16')+_0x4203b5+'\x20IN\x20?',_[_0xb34c('0x17')](_0x21e71f,'id'));}return _0x33720d;}function getInteractionsQuery(_0x368c4e){var _0x3a7ec2=utils[_0xb34c('0x18')](_0x368c4e);var _0x54b38f=utils[_0xb34c('0x6')](_0x368c4e);var _0x2bc03e=utils[_0xb34c('0xe')](_0x368c4e);return squel[_0xb34c('0x9')]()['from'](_0x3a7ec2[_0xb34c('0x19')],'i')[_0xb34c('0x1a')](_0xb34c('0x1b'),'c',_0xb34c('0x1c'))[_0xb34c('0x1a')](_0xb34c('0x14'),'o',_0xb34c('0x1d'))['left_join'](_0x3a7ec2[_0xb34c('0x1e')],'a',_0xb34c('0x1f')+_0x54b38f)['left_join'](_0x3a7ec2[_0xb34c('0x20')],'me',_0xb34c('0x21')+_0x2bc03e+'\x20=\x20i.id')[_0xb34c('0x1a')](_0x3a7ec2['interactionsTags'],'it',_0xb34c('0x22')+_0x2bc03e+_0xb34c('0x23'))[_0xb34c('0x1a')](_0xb34c('0xd'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x4bac33={'body':squel['expr'](),'contact':squel[_0xb34c('0x24')](),'default':squel[_0xb34c('0x24')](),'fields':squel[_0xb34c('0x24')](),'filter':squel[_0xb34c('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0xb34c('0x24')](),'ids':null},'user':squel[_0xb34c('0x24')]()};return _0x4bac33;}function parseTagParameter(_0x2b80cb){var _0x4942f5=squel[_0xb34c('0x24')]();if(_0x2b80cb){var _0x558978=utils['getSelectedTags'](_0x2b80cb);_0x558978[_0xb34c('0x25')](function(_0x5826dd){_0x4942f5['or'](_0xb34c('0x26'),'%,'+_0x5826dd+',%');});}return _0x4942f5;}function parseReadParameter(_0x1904d5){var _0x3a5f7e='';if(_0x1904d5){_0x3a5f7e='unreadMessages\x20{OPERATOR}\x200';if(_0x1904d5==='1'){_0x3a5f7e=_0x3a5f7e[_0xb34c('0x27')](_0xb34c('0x28'),'=');}else{_0x3a5f7e=_0x3a5f7e[_0xb34c('0x27')]('{OPERATOR}','>');}}return _0x3a5f7e;}function parseSearchFilter(_0x1219c1,_0x158681){var _0x5c3b59=squel[_0xb34c('0x24')]();if(_0x158681){var _0x1872ac=_0x158681[_0xb34c('0x27')]('\x5c','\x5c\x5c')[_0xb34c('0x27')](/'/g,'\x27\x27');if(qs[_0xb34c('0x29')](_0x1872ac)){_0x5c3b59['or'](_0xb34c('0x2a'),_0x1872ac+'%');if([_0xb34c('0x2b'),'whatsapp']['includes'](_0x1219c1)){_0x5c3b59['or'](_0xb34c('0x2c'),_0x1872ac+'%');}else if(_0x1219c1===_0xb34c('0x2d')){_0x5c3b59['or']('i.fax\x20LIKE\x20?',_0x1872ac+'%');}else if(_0x1219c1===_0xb34c('0x2e')){_0x5c3b59['or'](_0xb34c('0x2f'),_0x1872ac+'%');}}else if(_0x1219c1==='mail'&&qs[_0xb34c('0x30')](_0x1872ac)){_0x5c3b59['or']('c.email\x20LIKE\x20?',_0x1872ac+'%');}else{if(_0x1219c1===_0xb34c('0x31')){_0x5c3b59['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb34c('0x32')](_0x1872ac,!![]))['or'](_0xb34c('0x33'),qs[_0xb34c('0x32')](_0x1872ac));}else if(_0x1219c1!=='fax'){_0x5c3b59['or'](_0xb34c('0x34'),qs['getFullTextValue'](_0x1872ac));}_0x5c3b59['or'](_0xb34c('0x35'),qs['getFullTextValue'](_0x1872ac,!![]),null);}}return _0x5c3b59;}function parseAdvancedSearchFilter(_0x3cdf91,_0x27f267){var _0x1c6581=getSqlClauses();var _0x5c58ff=as[_0xb34c('0x36')](_0x3cdf91);var _0xe23003=_0x5c58ff[_0xb34c('0x37')];for(var _0x4d78a6=0x0;_0x4d78a6<_0x5c58ff[_0xb34c('0x38')][_0xb34c('0x39')];_0x4d78a6++){var _0x1059d4=_0x5c58ff[_0xb34c('0x38')][_0x4d78a6];var _0x4b4f8a='i';var _0x491b06=_[_0xb34c('0x3a')](_0x27f267,['name',_0x1059d4[_0xb34c('0xa')]]);if(_0x491b06){var _0x67122f=as[_0xb34c('0x3b')](_0x4b4f8a,_0x491b06[_0xb34c('0x3c')],_0x1059d4);_0x1c6581[_0xb34c('0x3d')][_0xe23003](_0x67122f[_0xb34c('0x3e')],_0x67122f[_0xb34c('0x3f')]['start'],_0x67122f['value']['end']);}else{switch(_0x1059d4[_0xb34c('0xa')]){case _0xb34c('0x40'):var _0x4eefd6=parseReadParameter(_0x1059d4[_0xb34c('0x3f')]);_0x1c6581['read'][_0xb34c('0x41')](_0x4eefd6);break;case _0xb34c('0x42'):if(_0x1059d4['operator']===_0xb34c('0x43')){if(_0x1059d4['value'][_0xb34c('0x44')]('\x20')[_0xb34c('0x39')]>0x1){_0x1c6581['contact'][_0xe23003]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb34c('0x32')](_0x1059d4[_0xb34c('0x3f')],!![]),null);}else{var _0x2e275d='%'+_0x1059d4['value']+'%';_0x1c6581[_0xb34c('0x45')][_0xe23003](_0xb34c('0x46'),_0x2e275d,_0x2e275d,_0x2e275d);}}else{_0x491b06=_['find'](_0x27f267,[_0xb34c('0xb'),'ContactId']);_0x1059d4[_0xb34c('0xa')]=_0xb34c('0x47');_0x67122f=as[_0xb34c('0x3b')](_0x4b4f8a,_0x491b06[_0xb34c('0x3c')],_0x1059d4);_0x1c6581['contact'][_0xe23003](_0x67122f[_0xb34c('0x3e')],_0x67122f[_0xb34c('0x3f')][_0xb34c('0x48')],_0x67122f['value'][_0xb34c('0x49')]);}break;case _0xb34c('0x4a'):var _0x24d8d9=_0x1059d4[_0xb34c('0x3f')][_0xb34c('0x44')](',')[_0xb34c('0x17')](function(_0x584b75){return Number(_0x584b75);});var _0x5f0500=parseTagParameter(_0x24d8d9);_0x1c6581[_0xb34c('0x4b')][_0xb34c('0x4c')][_0xb34c('0x41')](_0x5f0500);_0x1c6581['tags'][_0xb34c('0x4d')]=_0x24d8d9;break;case _0xb34c('0x4e'):if(_0x1059d4[_0xb34c('0x4f')]===_0xb34c('0x43')){_0x1c6581['user'][_0xe23003](_0xb34c('0x50'),'%'+_0x1059d4[_0xb34c('0x3f')]+'%',null);}else{_0x491b06=_[_0xb34c('0x3a')](_0x27f267,['name','UserId']);_0x1059d4[_0xb34c('0xa')]=_0xb34c('0x51');_0x67122f=as['buildExpression'](_0x4b4f8a,_0x491b06[_0xb34c('0x3c')],_0x1059d4);_0x1c6581[_0xb34c('0x52')][_0xe23003](_0x67122f[_0xb34c('0x3e')],_0x67122f['value']['start'],_0x67122f['value'][_0xb34c('0x49')]);}break;case'body':case _0xb34c('0x53'):_0x67122f=as[_0xb34c('0x3b')]('me',null,_0x1059d4);_0x1c6581[_0xb34c('0x54')][_0xe23003](_0x67122f[_0xb34c('0x3e')],_0x67122f[_0xb34c('0x3f')]['start'],_0x67122f[_0xb34c('0x3f')]['end']);break;}}}return _0x1c6581;}function parseModelFields(_0x36876d,_0x3f65e6,_0x166247){var _0x3245d1=utils[_0xb34c('0x6')](_0x36876d);var _0x1f384b=squel[_0xb34c('0x24')]();var _0x48e9e2=_(_0x3f65e6)[_0xb34c('0x55')]()[_0xb34c('0x17')](function(_0x5f2a84){return _[_0xb34c('0x56')](_0x166247,[_0xb34c('0xb'),_0x5f2a84])?_0x5f2a84:undefined;})[_0xb34c('0x57')]()['value']();if(_0x48e9e2['length']>0x0){_0x48e9e2[_0xb34c('0x25')](function(_0x4cd601){if(_0x4cd601===_0x3245d1){_0x1f384b[_0xb34c('0x41')]('i.'+_0x3245d1+_0xb34c('0x58'),[]['concat'](_0x3f65e6[_0x4cd601]));}else if(_0x4cd601===_0xb34c('0x59')){var _0x2b5bc7=JSON[_0xb34c('0x5a')](_0x3f65e6[_0x4cd601])[_0xb34c('0x5b')];var _0x8c9947=JSON['parse'](_0x3f65e6[_0x4cd601])[_0xb34c('0x5c')];_0x1f384b[_0xb34c('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b5bc7,_0x8c9947);}else{if(_0x3f65e6[_0x4cd601]==='null'){_0x1f384b[_0xb34c('0x41')]('i.'+_0x4cd601+'\x20IS\x20NULL');}else{_0x1f384b[_0xb34c('0x41')]('i.'+_0x4cd601+_0xb34c('0x5d'),_0x3f65e6[_0x4cd601]);}}});}return _0x1f384b;}function parseQueryParameters(_0x197e75,_0xa16d18,_0x295a8e){var _0x53abc1=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x197e75,_0xa16d18,_0x295a8e);})[_0xb34c('0x5e')](function(_0x10d39a){_0x53abc1[_0xb34c('0x5f')][_0xb34c('0x41')](_0x10d39a);return parseReadParameter(_0xa16d18['read']);})['then'](function(_0x77773c){_0x53abc1[_0xb34c('0x60')][_0xb34c('0x41')](_0x77773c);return parseTagParameter(_0xa16d18['tag']);})['then'](function(_0x28fba0){_0x53abc1[_0xb34c('0x4b')][_0xb34c('0x4c')][_0xb34c('0x41')](_0x28fba0);return parseSearchFilter(_0x197e75,_0xa16d18[_0xb34c('0x61')]);})['then'](function(_0x48a2c2){_0x53abc1[_0xb34c('0x61')]=_0x48a2c2;return _0x53abc1;});}function checkAccountsRestrictions(_0x2a21f5,_0x1915e6,_0x1bde8f){var _0x30b76b=utils['getAccountFK'](_0x2a21f5);var _0x35ab78='get'+_[_0xb34c('0x62')](_0x2a21f5)+(_0x2a21f5===_0xb34c('0x63')?_0xb34c('0x64'):_0xb34c('0x65'));var _0xeef3ab=squel[_0xb34c('0x24')]();return Promise[_0xb34c('0x66')]()[_0xb34c('0x5e')](function(){if(_0x1bde8f[_0xb34c('0x67')]&&_0x1915e6[_0xb34c('0x7')]===_0xb34c('0x8')){return _0x1915e6[_0x35ab78]({'attributes':['id'],'raw':!![]});}})[_0xb34c('0x5e')](function(_0x8b8965){if(_0x8b8965){if(_0x8b8965[_0xb34c('0x39')]===0x0){_0xeef3ab[_0xb34c('0x41')]('i.'+_0x30b76b+'\x20IS\x20NULL');}else{_0xeef3ab[_0xb34c('0x41')]('i.'+_0x30b76b+_0xb34c('0x58'),_['map'](_0x8b8965,'id'));}}else if(!_0x1bde8f[_0x30b76b]){_0xeef3ab[_0xb34c('0x41')]('i.'+_0x30b76b+_0xb34c('0x68'));}})[_0xb34c('0x5e')](function(){return _0xeef3ab;});}function getClosedOrderClause(_0xfc6b3d,_0x39cf0a){var _0x5b2a7d='';var _0xcc362e=['i.thirdDisposition',_0xb34c('0x69'),_0xb34c('0x6a')];if(_0xfc6b3d===_0xb34c('0x31')){_0xcc362e[_0xb34c('0x6b')](_0xb34c('0x6c'));}if(_0x39cf0a[_0xb34c('0x6d')]==='0'&&_0xfc6b3d===_0xb34c('0x31')){_0x5b2a7d=_0xb34c('0x6c');}else{if(_0x39cf0a['closed']==='1'){_0xcc362e[_0xb34c('0x6e')]();}_0x5b2a7d=_0xb34c('0x6f')+_0xcc362e['join'](',\x20')+')';}return _0x5b2a7d;}function getFilteredInteractions(_0x4bd0a8,_0x3e9ce0,_0x2203e3,_0x44817b){var _0x524e85=utils[_0xb34c('0xe')](_0x4bd0a8);var _0x360439=_['capitalize'](_0x4bd0a8)+'Interaction';var _0x22ca68=[];var _0x4a06d6=getTagsQuery();var _0x290930={'type':db[_0xb34c('0x70')]['QueryTypes'][_0xb34c('0x71')],'raw':!![]};var _0x28bd94=[];var _0x5f434d=[];return db[_0xb34c('0x72')]['query'](_0x4a06d6[_0xb34c('0x73')](),_0x290930)[_0xb34c('0x5e')](function(_0x5dbb17){_0x22ca68=_[_0xb34c('0x74')](_0x5dbb17,'id');_0x290930=_[_0xb34c('0x75')](_0x290930,{'model':db[_0x360439],'mapToModel':!![],'nest':!![]});if(_0x2203e3[_0xb34c('0x5f')]){_0x44817b[_0xb34c('0x76')][_0xb34c('0x25')](function(_0x3fc7c9){_0x3e9ce0[_0xb34c('0xa')]('i.'+_0x3fc7c9);});}else{_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x77'),_0xb34c('0x40'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x78'),_0xb34c('0x79'));_0x3e9ce0[_0xb34c('0xa')]('a.mandatoryDisposition',_0xb34c('0x7a'));if(_0x4bd0a8===_0xb34c('0x31')){_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x7b'),'Account.email');_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x7c'),_0xb34c('0x7d'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x7e'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x7f'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x80'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x81'));_0x3e9ce0[_0xb34c('0xa')]('i.closedAt');_0x3e9ce0[_0xb34c('0xa')]('i.attach');_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x82'));_0x3e9ce0[_0xb34c('0xa')]('i.lastMsgDirection');_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x83'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x6a'));_0x3e9ce0['field'](_0xb34c('0x69'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x84'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x6c'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x85'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x86'));_0x3e9ce0[_0xb34c('0xa')]('i.MailAccountId');_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x87'));}else if(_0x4bd0a8===_0xb34c('0x2e')){_0x3e9ce0['field']('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',_0xb34c('0x7d'));}else{_0x3e9ce0['field'](_0xb34c('0x88'),_0xb34c('0x7d'));}if(_0x4bd0a8!=='mail'){_0x3e9ce0['field'](_0xb34c('0x89'));}_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x8a'),_0xb34c('0x8b'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x8c'),'Contact.lastName');_0x3e9ce0[_0xb34c('0xa')]('c.email',_0xb34c('0x8d'));_0x3e9ce0[_0xb34c('0xa')]('c.phone',_0xb34c('0x8e'));_0x3e9ce0[_0xb34c('0xa')]('c.mobile',_0xb34c('0x8f'));_0x3e9ce0['field']('c.fax','Contact.fax');_0x3e9ce0[_0xb34c('0xa')]('o.fullname',_0xb34c('0x90'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x91'),_0xb34c('0x92'));_0x3e9ce0[_0xb34c('0xa')](_0xb34c('0x93'),_0xb34c('0x94'));}if(_0x44817b['limit']){_0x3e9ce0[_0xb34c('0x95')](_0x44817b[_0xb34c('0x95')]);}if(_0x44817b[_0xb34c('0x96')]){_0x3e9ce0[_0xb34c('0x96')](_0x44817b[_0xb34c('0x96')]);}return db['sequelize'][_0xb34c('0x97')](_0x3e9ce0[_0xb34c('0x73')](),_0x290930);})[_0xb34c('0x5e')](function(_0x58aa93){_0x28bd94=_0x58aa93;var _0x462e3f=getUsersQuery(_0x4bd0a8,_0x28bd94);return db[_0xb34c('0x72')][_0xb34c('0x97')](_0x462e3f[_0xb34c('0x73')](),_0x290930);})[_0xb34c('0x5e')](function(_0x2267a4){_0x5f434d=_['groupBy'](_0x2267a4,_0x524e85);if(_0x4bd0a8===_0xb34c('0x31')){return db[_0xb34c('0x98')][_0xb34c('0x99')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x4df8c9){var _0x5433cc=_0x4df8c9?_0x4df8c9[_0xb34c('0x9a')]:undefined;var _0x1624cc=_0x28bd94['map'](function(_0x10791d){return updateInteraction(_0x10791d,_0x22ca68,_0x5f434d,_0x5433cc);});return Promise['all'](_0x1624cc);});}function countFilteredInteractions(_0x2e448e,_0x263526){var _0x3cf606=_0x2e448e['clone']();_0x3cf606['field'](_0xb34c('0x9b'));_0x3cf606['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb34c('0x40'));var _0x112075=utils[_0xb34c('0x9c')](_0x263526);if(!_[_0xb34c('0x9d')](_0x112075)){_0x3cf606[_0xb34c('0x9e')](_0xb34c('0x9f'),_0x112075);}var _0x4fdbe7={'type':db[_0xb34c('0x70')]['QueryTypes'][_0xb34c('0x71')],'raw':!![]};return db[_0xb34c('0x72')][_0xb34c('0x97')](_0x3cf606[_0xb34c('0x73')](),_0x4fdbe7);}module[_0xb34c('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x9807=['where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','messages','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','fax','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','type','default','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','plainBody','buildExpression','some','compact','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','tag','clause','filter','get','chat','Websites','Accounts','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.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.id','i.createdAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','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','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','isEmpty','exports','lodash','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','getInteractionFK','u.fullname','left_join','u.id\x20=\x20ui.UserId'];(function(_0x2c536d,_0x1990ac){var _0xf0137f=function(_0x2eda31){while(--_0x2eda31){_0x2c536d['push'](_0x2c536d['shift']());}};_0xf0137f(++_0x1990ac);}(_0x9807,0x129));var _0x7980=function(_0x307060,_0x26dc3d){_0x307060=_0x307060-0x0;var _0x3a2587=_0x9807[_0x307060];return _0x3a2587;};'use strict';var _=require(_0x7980('0x0'));var squel=require('squel');var as=require(_0x7980('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0x7980('0x2'))[_0x7980('0x3')];var utils=require(_0x7980('0x4'));var db=require(_0x7980('0x5'))['db'];function skipInteractionsQuery(_0x3c8498,_0x29bc08,_0x531de6){var _0x7bc1e0=![];var _0x41b839=utils[_0x7980('0x6')](_0x3c8498);if(_0x29bc08[_0x7980('0x7')]===_0x7980('0x8')&&!_0x531de6[_0x7980('0x9')]&&!_0x531de6[_0x41b839]){_0x7bc1e0=!![];}return _0x7bc1e0;}function getTagsQuery(){return squel[_0x7980('0xa')]()[_0x7980('0xb')]('id')[_0x7980('0xb')](_0x7980('0xc'))['field'](_0x7980('0xd'))[_0x7980('0xe')]('tools_tags');}function getUsersQuery(_0x534436,_0x3ba9ee){var _0x44bdfe=utils[_0x7980('0xf')](_0x534436);var _0x551d88='user_has_'+_0x534436+'_interactions';var _0x2d53f3=squel['select']()['field']('u.id')['field'](_0x7980('0x10'))[_0x7980('0xb')]('ui.'+_0x44bdfe)[_0x7980('0xe')](_0x551d88,'ui')[_0x7980('0x11')]('users','u',_0x7980('0x12'));if(_0x3ba9ee['length']>0x0){_0x2d53f3[_0x7980('0x13')]('ui.'+_0x44bdfe+_0x7980('0x14'),_[_0x7980('0x15')](_0x3ba9ee,'id'));}return _0x2d53f3;}function getInteractionsQuery(_0x2993f8){var _0x1f4ed7=utils[_0x7980('0x16')](_0x2993f8);var _0x574c3d=utils[_0x7980('0x6')](_0x2993f8);var _0x4a2819=utils[_0x7980('0xf')](_0x2993f8);return squel[_0x7980('0xa')]()[_0x7980('0xe')](_0x1f4ed7[_0x7980('0x17')],'i')[_0x7980('0x11')](_0x7980('0x18'),'c',_0x7980('0x19'))['left_join'](_0x7980('0x1a'),'o',_0x7980('0x1b'))[_0x7980('0x11')](_0x1f4ed7[_0x7980('0x1c')],'a','a.id\x20=\x20i.'+_0x574c3d)[_0x7980('0x11')](_0x1f4ed7[_0x7980('0x1d')],'me','me.'+_0x4a2819+'\x20=\x20i.id')[_0x7980('0x11')](_0x1f4ed7[_0x7980('0x1e')],'it',_0x7980('0x1f')+_0x4a2819+_0x7980('0x20'))[_0x7980('0x11')]('tools_tags','t',_0x7980('0x21'));}function getSqlClauses(){var _0x42cc55={'body':squel[_0x7980('0x22')](),'contact':squel['expr'](),'default':squel[_0x7980('0x22')](),'fields':squel[_0x7980('0x22')](),'filter':squel[_0x7980('0x22')](),'read':squel[_0x7980('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x7980('0x22')]()};return _0x42cc55;}function parseTagParameter(_0x3cd5f0){var _0x2ca093=squel[_0x7980('0x22')]();if(_0x3cd5f0){var _0x1f311a=utils[_0x7980('0x23')](_0x3cd5f0);_0x1f311a[_0x7980('0x24')](function(_0x5c4fb2){_0x2ca093['or'](_0x7980('0x25'),'%,'+_0x5c4fb2+',%');});}return _0x2ca093;}function parseReadParameter(_0x5d7d95){var _0x5ed6e5='';if(_0x5d7d95){_0x5ed6e5='unreadMessages\x20{OPERATOR}\x200';if(_0x5d7d95==='1'){_0x5ed6e5=_0x5ed6e5['replace'](_0x7980('0x26'),'=');}else{_0x5ed6e5=_0x5ed6e5['replace'](_0x7980('0x26'),'>');}}return _0x5ed6e5;}function parseSearchFilter(_0x514477,_0x560753){var _0x4fb4f6=squel[_0x7980('0x22')]();if(_0x560753){var _0x53967a=_0x560753['replace']('\x5c','\x5c\x5c')[_0x7980('0x27')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x53967a)){_0x4fb4f6['or'](_0x7980('0x28'),_0x53967a+'%');if([_0x7980('0x29'),'whatsapp'][_0x7980('0x2a')](_0x514477)){_0x4fb4f6['or'](_0x7980('0x2b'),_0x53967a+'%');}else if(_0x514477==='fax'){_0x4fb4f6['or'](_0x7980('0x2c'),_0x53967a+'%');}else if(_0x514477===_0x7980('0x2d')){_0x4fb4f6['or'](_0x7980('0x2e'),_0x53967a+'%');}}else if(_0x514477===_0x7980('0x2f')&&qs[_0x7980('0x30')](_0x53967a)){_0x4fb4f6['or']('c.email\x20LIKE\x20?',_0x53967a+'%');}else{if(_0x514477===_0x7980('0x2f')){_0x4fb4f6['or'](_0x7980('0x31'),qs[_0x7980('0x32')](_0x53967a,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7980('0x32')](_0x53967a));}else if(_0x514477!==_0x7980('0x33')){_0x4fb4f6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7980('0x32')](_0x53967a));}_0x4fb4f6['or'](_0x7980('0x34'),qs[_0x7980('0x32')](_0x53967a,!![]),null);}}return _0x4fb4f6;}function parseAdvancedSearchFilter(_0x5a75c3,_0x102bf5){var _0x21d37a=getSqlClauses();var _0x3f70fb=as[_0x7980('0x35')](_0x5a75c3);var _0x3d4ef4=_0x3f70fb[_0x7980('0x36')];for(var _0x699439=0x0;_0x699439<_0x3f70fb[_0x7980('0x37')][_0x7980('0x38')];_0x699439++){var _0x48bd2a=_0x3f70fb[_0x7980('0x37')][_0x699439];var _0x2982fb='i';var _0x5482f4=_['find'](_0x102bf5,[_0x7980('0xc'),_0x48bd2a[_0x7980('0xb')]]);if(_0x5482f4){var _0x46a87a=as['buildExpression'](_0x2982fb,_0x5482f4[_0x7980('0x39')],_0x48bd2a);_0x21d37a[_0x7980('0x3a')][_0x3d4ef4](_0x46a87a[_0x7980('0x3b')],_0x46a87a[_0x7980('0x3c')][_0x7980('0x3d')],_0x46a87a[_0x7980('0x3c')][_0x7980('0x3e')]);}else{switch(_0x48bd2a[_0x7980('0xb')]){case _0x7980('0x3f'):var _0x5b7037=parseReadParameter(_0x48bd2a['value']);_0x21d37a[_0x7980('0x40')][_0x7980('0x41')](_0x5b7037);break;case _0x7980('0x42'):if(_0x48bd2a[_0x7980('0x43')]===_0x7980('0x44')){if(_0x48bd2a[_0x7980('0x3c')][_0x7980('0x45')]('\x20')['length']>0x1){_0x21d37a[_0x7980('0x46')][_0x3d4ef4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7980('0x32')](_0x48bd2a[_0x7980('0x3c')],!![]),null);}else{var _0x2f45db='%'+_0x48bd2a[_0x7980('0x3c')]+'%';_0x21d37a[_0x7980('0x46')][_0x3d4ef4](_0x7980('0x47'),_0x2f45db,_0x2f45db,_0x2f45db);}}else{_0x5482f4=_['find'](_0x102bf5,[_0x7980('0xc'),_0x7980('0x48')]);_0x48bd2a[_0x7980('0xb')]=_0x7980('0x48');_0x46a87a=as['buildExpression'](_0x2982fb,_0x5482f4[_0x7980('0x39')],_0x48bd2a);_0x21d37a[_0x7980('0x46')][_0x3d4ef4](_0x46a87a[_0x7980('0x3b')],_0x46a87a[_0x7980('0x3c')][_0x7980('0x3d')],_0x46a87a[_0x7980('0x3c')][_0x7980('0x3e')]);}break;case _0x7980('0x49'):var _0x22032f=_0x48bd2a[_0x7980('0x3c')][_0x7980('0x45')](',')['map'](function(_0x2c50aa){return Number(_0x2c50aa);});var _0x50ed26=parseTagParameter(_0x22032f);_0x21d37a[_0x7980('0x4a')]['clause']['and'](_0x50ed26);_0x21d37a['tags'][_0x7980('0x4b')]=_0x22032f;break;case _0x7980('0x4c'):if(_0x48bd2a['operator']===_0x7980('0x44')){_0x21d37a[_0x7980('0x4d')][_0x3d4ef4](_0x7980('0x4e'),'%'+_0x48bd2a[_0x7980('0x3c')]+'%',null);}else{_0x5482f4=_[_0x7980('0x4f')](_0x102bf5,['name','UserId']);_0x48bd2a[_0x7980('0xb')]=_0x7980('0x50');_0x46a87a=as['buildExpression'](_0x2982fb,_0x5482f4['type'],_0x48bd2a);_0x21d37a[_0x7980('0x4d')][_0x3d4ef4](_0x46a87a[_0x7980('0x3b')],_0x46a87a['value'][_0x7980('0x3d')],_0x46a87a[_0x7980('0x3c')][_0x7980('0x3e')]);}break;case _0x7980('0x51'):case _0x7980('0x52'):_0x46a87a=as[_0x7980('0x53')]('me',null,_0x48bd2a);_0x21d37a[_0x7980('0x51')][_0x3d4ef4](_0x46a87a['text'],_0x46a87a[_0x7980('0x3c')]['start'],_0x46a87a[_0x7980('0x3c')][_0x7980('0x3e')]);break;}}}return _0x21d37a;}function parseModelFields(_0x52ae4c,_0x4ed24b,_0x29715d){var _0x56b3be=utils[_0x7980('0x6')](_0x52ae4c);var _0xd1f4ca=squel['expr']();var _0x2081b3=_(_0x4ed24b)['keys']()[_0x7980('0x15')](function(_0x3d2a68){return _[_0x7980('0x54')](_0x29715d,[_0x7980('0xc'),_0x3d2a68])?_0x3d2a68:undefined;})[_0x7980('0x55')]()[_0x7980('0x3c')]();if(_0x2081b3['length']>0x0){_0x2081b3[_0x7980('0x24')](function(_0x460796){if(_0x460796===_0x56b3be){_0xd1f4ca[_0x7980('0x41')]('i.'+_0x56b3be+'\x20IN\x20?',[]['concat'](_0x4ed24b[_0x460796]));}else if(_0x460796===_0x7980('0x56')){var _0x36c657=JSON['parse'](_0x4ed24b[_0x460796])[_0x7980('0x57')];var _0x766079=JSON[_0x7980('0x58')](_0x4ed24b[_0x460796])[_0x7980('0x59')];_0xd1f4ca[_0x7980('0x41')](_0x7980('0x5a'),_0x36c657,_0x766079);}else{if(_0x4ed24b[_0x460796]===_0x7980('0x5b')){_0xd1f4ca[_0x7980('0x41')]('i.'+_0x460796+_0x7980('0x5c'));}else{_0xd1f4ca[_0x7980('0x41')]('i.'+_0x460796+'\x20=\x20?',_0x4ed24b[_0x460796]);}}});}return _0xd1f4ca;}function parseQueryParameters(_0x54b8d7,_0x16a21e,_0x5a1b44){var _0x34f93d=getSqlClauses();return Promise[_0x7980('0x5d')]()['then'](function(){return parseModelFields(_0x54b8d7,_0x16a21e,_0x5a1b44);})[_0x7980('0x5e')](function(_0x4e0c20){_0x34f93d['fields'][_0x7980('0x41')](_0x4e0c20);return parseReadParameter(_0x16a21e[_0x7980('0x40')]);})[_0x7980('0x5e')](function(_0x5de670){_0x34f93d[_0x7980('0x40')][_0x7980('0x41')](_0x5de670);return parseTagParameter(_0x16a21e[_0x7980('0x5f')]);})[_0x7980('0x5e')](function(_0x4f4409){_0x34f93d[_0x7980('0x4a')][_0x7980('0x60')][_0x7980('0x41')](_0x4f4409);return parseSearchFilter(_0x54b8d7,_0x16a21e[_0x7980('0x61')]);})['then'](function(_0x309b88){_0x34f93d['filter']=_0x309b88;return _0x34f93d;});}function checkAccountsRestrictions(_0x5aaf97,_0xdf5941,_0x4471e8){var _0x4ab8e5=utils[_0x7980('0x6')](_0x5aaf97);var _0x25f5e4=_0x7980('0x62')+_['capitalize'](_0x5aaf97)+(_0x5aaf97===_0x7980('0x63')?_0x7980('0x64'):_0x7980('0x65'));var _0x541c9=squel['expr']();return Promise[_0x7980('0x5d')]()['then'](function(){if(_0x4471e8[_0x7980('0x9')]&&_0xdf5941[_0x7980('0x7')]===_0x7980('0x8')){return _0xdf5941[_0x25f5e4]({'attributes':['id'],'raw':!![]});}})[_0x7980('0x5e')](function(_0x522529){if(_0x522529){if(_0x522529[_0x7980('0x38')]===0x0){_0x541c9[_0x7980('0x41')]('i.'+_0x4ab8e5+'\x20IS\x20NULL');}else{_0x541c9[_0x7980('0x41')]('i.'+_0x4ab8e5+'\x20IN\x20?',_[_0x7980('0x15')](_0x522529,'id'));}}else if(!_0x4471e8[_0x4ab8e5]){_0x541c9[_0x7980('0x41')]('i.'+_0x4ab8e5+'\x20IS\x20NOT\x20NULL');}})[_0x7980('0x5e')](function(){return _0x541c9;});}function getClosedOrderClause(_0x9c595f,_0x35816b){var _0x84d7c9='';var _0x43ebb7=[_0x7980('0x66'),_0x7980('0x67'),_0x7980('0x68')];if(_0x9c595f===_0x7980('0x2f')){_0x43ebb7['unshift'](_0x7980('0x69'));}if(_0x35816b[_0x7980('0x6a')]==='0'&&_0x9c595f==='mail'){_0x84d7c9=_0x7980('0x69');}else{if(_0x35816b['closed']==='1'){_0x43ebb7[_0x7980('0x6b')]();}_0x84d7c9=_0x7980('0x6c')+_0x43ebb7[_0x7980('0x6d')](',\x20')+')';}return _0x84d7c9;}function getFilteredInteractions(_0x1abc7f,_0x43b7b1,_0x1c4663,_0x232e69){var _0x116ba5=utils[_0x7980('0xf')](_0x1abc7f);var _0x54b179=_[_0x7980('0x6e')](_0x1abc7f)+_0x7980('0x6f');var _0x2c2e97=[];var _0x224a1d=getTagsQuery();var _0x29f1ef={'type':db[_0x7980('0x70')][_0x7980('0x71')][_0x7980('0x72')],'raw':!![]};var _0xb8b14c=[];var _0x224c0a=[];return db[_0x7980('0x73')][_0x7980('0x74')](_0x224a1d[_0x7980('0x75')](),_0x29f1ef)[_0x7980('0x5e')](function(_0x2e0d11){_0x2c2e97=_[_0x7980('0x76')](_0x2e0d11,'id');_0x29f1ef=_['merge'](_0x29f1ef,{'model':db[_0x54b179],'mapToModel':!![],'nest':!![]});if(_0x1c4663['fields']){_0x232e69[_0x7980('0x77')]['forEach'](function(_0x19012a){_0x43b7b1[_0x7980('0xb')]('i.'+_0x19012a);});}else{_0x43b7b1[_0x7980('0xb')](_0x7980('0x78'),'unreadMessages');_0x43b7b1['field'](_0x7980('0x79'),'Account.key');_0x43b7b1['field'](_0x7980('0x7a'),_0x7980('0x7b'));if(_0x1abc7f==='mail'){_0x43b7b1[_0x7980('0xb')](_0x7980('0x7c'),'Account.email');_0x43b7b1['field'](_0x7980('0x7d'),'contactName');_0x43b7b1[_0x7980('0xb')](_0x7980('0x7e'));_0x43b7b1[_0x7980('0xb')](_0x7980('0x7f'));_0x43b7b1[_0x7980('0xb')]('i.updatedAt');_0x43b7b1[_0x7980('0xb')]('i.closed');_0x43b7b1['field']('i.closedAt');_0x43b7b1[_0x7980('0xb')]('i.attach');_0x43b7b1[_0x7980('0xb')](_0x7980('0x80'));_0x43b7b1[_0x7980('0xb')](_0x7980('0x81'));_0x43b7b1[_0x7980('0xb')](_0x7980('0x82'));_0x43b7b1[_0x7980('0xb')](_0x7980('0x68'));_0x43b7b1[_0x7980('0xb')]('i.secondDisposition');_0x43b7b1['field'](_0x7980('0x66'));_0x43b7b1['field'](_0x7980('0x69'));_0x43b7b1[_0x7980('0xb')](_0x7980('0x83'));_0x43b7b1['field'](_0x7980('0x84'));_0x43b7b1['field'](_0x7980('0x85'));_0x43b7b1['field'](_0x7980('0x86'));}else if(_0x1abc7f===_0x7980('0x2d')){_0x43b7b1['field'](_0x7980('0x87'),'contactName');}else{_0x43b7b1[_0x7980('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',_0x7980('0x88'));}if(_0x1abc7f!==_0x7980('0x2f')){_0x43b7b1['field'](_0x7980('0x89'));}_0x43b7b1[_0x7980('0xb')](_0x7980('0x8a'),'Contact.firstName');_0x43b7b1['field'](_0x7980('0x8b'),_0x7980('0x8c'));_0x43b7b1[_0x7980('0xb')](_0x7980('0x8d'),'Contact.email');_0x43b7b1[_0x7980('0xb')](_0x7980('0x8e'),'Contact.phone');_0x43b7b1['field']('c.mobile','Contact.mobile');_0x43b7b1[_0x7980('0xb')](_0x7980('0x8f'),'Contact.fax');_0x43b7b1[_0x7980('0xb')](_0x7980('0x90'),_0x7980('0x91'));_0x43b7b1[_0x7980('0xb')](_0x7980('0x92'),_0x7980('0x93'));_0x43b7b1['field'](_0x7980('0x94'),_0x7980('0x95'));}if(_0x232e69[_0x7980('0x96')]){_0x43b7b1[_0x7980('0x96')](_0x232e69[_0x7980('0x96')]);}if(_0x232e69[_0x7980('0x97')]){_0x43b7b1[_0x7980('0x97')](_0x232e69[_0x7980('0x97')]);}return db[_0x7980('0x73')][_0x7980('0x74')](_0x43b7b1[_0x7980('0x75')](),_0x29f1ef);})['then'](function(_0x1534a2){_0xb8b14c=_0x1534a2;var _0x41cba5=getUsersQuery(_0x1abc7f,_0xb8b14c);return db[_0x7980('0x73')][_0x7980('0x74')](_0x41cba5[_0x7980('0x75')](),_0x29f1ef);})[_0x7980('0x5e')](function(_0x22625e){_0x224c0a=_[_0x7980('0x98')](_0x22625e,_0x116ba5);if(_0x1abc7f==='mail'){return db[_0x7980('0x99')][_0x7980('0x9a')]({'attributes':[_0x7980('0x9b')],'raw':!![]});}})[_0x7980('0x5e')](function(_0x289972){var _0x3247fc=_0x289972?_0x289972[_0x7980('0x9b')]:undefined;var _0x76d2ab=_0xb8b14c[_0x7980('0x15')](function(_0x161a8a){return updateInteraction(_0x161a8a,_0x2c2e97,_0x224c0a,_0x3247fc);});return Promise['all'](_0x76d2ab);});}function countFilteredInteractions(_0x15bb1f,_0x3d61ed){var _0x24dc94=_0x15bb1f['clone']();_0x24dc94[_0x7980('0xb')]('COUNT(*)');_0x24dc94[_0x7980('0xb')](_0x7980('0x78'),'unreadMessages');var _0x4de37d=utils['getSelectedTags'](_0x3d61ed);if(!_[_0x7980('0x9c')](_0x4de37d)){_0x24dc94['where']('t.id\x20IN\x20?',_0x4de37d);}var _0x5526db={'type':db[_0x7980('0x70')][_0x7980('0x71')][_0x7980('0x72')],'raw':!![]};return db[_0x7980('0x73')][_0x7980('0x74')](_0x24dc94[_0x7980('0x75')](),_0x5526db);}module[_0x7980('0x9d')]={'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 03a5511..bef93d6 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 _0x5c48=['findOne','plainBody','-id','then','lastMsgText','trimStart','Users','TagIds','Tags','catch','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','unmanaged','abandoned','total','closed','UserId','answered','disposition','MailMessage'];(function(_0x3b5e02,_0x535469){var _0x59464c=function(_0x2d11cb){while(--_0x2d11cb){_0x3b5e02['push'](_0x3b5e02['shift']());}};_0x59464c(++_0x535469);}(_0x5c48,0xc0));var _0x85c4=function(_0x3e8496,_0x5cee69){_0x3e8496=_0x3e8496-0x0;var _0x3d324c=_0x5c48[_0x3e8496];return _0x3d324c;};'use strict';var _=require(_0x85c4('0x0'));var db=require(_0x85c4('0x1'))['db'];function getInteractionUsers(_0x582dd0,_0x2d3392){return new Promise(function(_0x485876,_0x15aaab){try{var _0x10077b=[];if(_0x2d3392[_0x582dd0]){_0x10077b=_0x2d3392[_0x582dd0][_0x85c4('0x2')](function(_0x35a59e){return{'id':_0x35a59e['id'],'fullname':_0x35a59e['fullname']};});}return _0x485876(_0x10077b);}catch(_0x1467eb){_0x15aaab(_0x1467eb);}});}function getInteractionTags(_0x257111,_0x42a081){var _0x56e2e3=[];if(_0x257111){_0x257111[_0x85c4('0x3')](',')[_0x85c4('0x4')](function(_0x1163a0){_0x56e2e3[_0x85c4('0x5')](_0x42a081[_0x1163a0]);});}return _0x56e2e3;}function updateWaitingCounter(_0x1c1a4a){if(_0x1c1a4a[_0x85c4('0x6')]){_0x1c1a4a[_0x85c4('0x6')]-=0x1;}}function updateInteractionCounters(_0x5b89f2){_0x5b89f2['waiting']=0x0;_0x5b89f2[_0x85c4('0x7')]=0x0;_0x5b89f2['answered']=0x0;_0x5b89f2[_0x85c4('0x8')]=0x0;_0x5b89f2[_0x85c4('0x9')]=0x0;_0x5b89f2[_0x85c4('0xa')]=0x0;if(_0x5b89f2[_0x85c4('0xb')]){if(_0x5b89f2['disposition']===_0x85c4('0x9')){_0x5b89f2['abandoned']+=0x1;updateWaitingCounter(_0x5b89f2);}if(_0x5b89f2[_0x85c4('0xc')]){_0x5b89f2[_0x85c4('0xd')]+=0x1;if(_0x5b89f2[_0x85c4('0x7')]){_0x5b89f2[_0x85c4('0x7')]-=0x1;}}else{if(_0x5b89f2[_0x85c4('0xe')]){_0x5b89f2['unmanaged']+=0x1;updateWaitingCounter(_0x5b89f2);}}}else{if(!_0x5b89f2[_0x85c4('0xc')]){_0x5b89f2['waiting']+=0x1;}if(_0x5b89f2[_0x85c4('0xc')]){_0x5b89f2[_0x85c4('0x7')]+=0x1;updateWaitingCounter(_0x5b89f2);}}_0x5b89f2['total']+=0x1;return _0x5b89f2;}function getLastMessageText(_0x4cd781){return db[_0x85c4('0xf')][_0x85c4('0x10')]({'where':{'$and':[{'MailInteractionId':_0x4cd781['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x85c4('0x11')],'order':_0x85c4('0x12'),'raw':!![]})[_0x85c4('0x13')](function(_0x3c87df){if(_0x3c87df&&_0x3c87df[_0x85c4('0x11')]){_0x4cd781[_0x85c4('0x14')]=_[_0x85c4('0x15')](_0x3c87df[_0x85c4('0x11')]);}return _0x4cd781;})['catch'](function(_0x4a8eff){throw _0x4a8eff;});}exports['updateInteraction']=function(_0x225127,_0x29da0d,_0x259ab6,_0x457bb8){return new Promise(function(_0x460fb1,_0x3a36b6){return getInteractionUsers(_0x225127['id'],_0x259ab6)[_0x85c4('0x13')](function(_0x4bcbff){_0x225127[_0x85c4('0x16')]=_0x4bcbff;return getInteractionTags(_0x225127[_0x85c4('0x17')],_0x29da0d);})[_0x85c4('0x13')](function(_0x827f4c){_0x225127[_0x85c4('0x18')]=_0x827f4c;delete _0x225127['TagIds'];return updateInteractionCounters(_0x225127);})[_0x85c4('0x13')](function(_0x1b44c8){if(_0x457bb8){return getLastMessageText(_0x1b44c8);}else{return _0x1b44c8;}})['then'](function(_0x4cb0ae){_0x460fb1(_0x4cb0ae);})[_0x85c4('0x19')](function(_0x24c9d9){_0x3a36b6(_0x24c9d9);});});}; \ No newline at end of file +var _0xb82e=['total','closed','disposition','UserId','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','Users','TagIds','then','Tags','lodash','../../mysqldb','fullname','forEach','push','waiting','talking','answered','unmanaged','abandoned'];(function(_0x515d81,_0x59a74b){var _0x4b09b8=function(_0x358db2){while(--_0x358db2){_0x515d81['push'](_0x515d81['shift']());}};_0x4b09b8(++_0x59a74b);}(_0xb82e,0x122));var _0xeb82=function(_0x287827,_0x2a369b){_0x287827=_0x287827-0x0;var _0x538d76=_0xb82e[_0x287827];return _0x538d76;};'use strict';var _=require(_0xeb82('0x0'));var db=require(_0xeb82('0x1'))['db'];function getInteractionUsers(_0x40194e,_0x434e36){return new Promise(function(_0x57fbc1,_0x3ae1f3){try{var _0x2926a7=[];if(_0x434e36[_0x40194e]){_0x2926a7=_0x434e36[_0x40194e]['map'](function(_0x253f4f){return{'id':_0x253f4f['id'],'fullname':_0x253f4f[_0xeb82('0x2')]};});}return _0x57fbc1(_0x2926a7);}catch(_0x4303a4){_0x3ae1f3(_0x4303a4);}});}function getInteractionTags(_0x16e8e7,_0x44a734){var _0xaa90b5=[];if(_0x16e8e7){_0x16e8e7['split'](',')[_0xeb82('0x3')](function(_0x3100ac){_0xaa90b5[_0xeb82('0x4')](_0x44a734[_0x3100ac]);});}return _0xaa90b5;}function updateWaitingCounter(_0x54d326){if(_0x54d326[_0xeb82('0x5')]){_0x54d326[_0xeb82('0x5')]-=0x1;}}function updateInteractionCounters(_0x523065){_0x523065[_0xeb82('0x5')]=0x0;_0x523065[_0xeb82('0x6')]=0x0;_0x523065[_0xeb82('0x7')]=0x0;_0x523065[_0xeb82('0x8')]=0x0;_0x523065[_0xeb82('0x9')]=0x0;_0x523065[_0xeb82('0xa')]=0x0;if(_0x523065[_0xeb82('0xb')]){if(_0x523065[_0xeb82('0xc')]===_0xeb82('0x9')){_0x523065[_0xeb82('0x9')]+=0x1;updateWaitingCounter(_0x523065);}if(_0x523065[_0xeb82('0xd')]){_0x523065[_0xeb82('0x7')]+=0x1;if(_0x523065['talking']){_0x523065[_0xeb82('0x6')]-=0x1;}}else{if(_0x523065['disposition']){_0x523065[_0xeb82('0x8')]+=0x1;updateWaitingCounter(_0x523065);}}}else{if(!_0x523065[_0xeb82('0xd')]){_0x523065['waiting']+=0x1;}if(_0x523065['UserId']){_0x523065[_0xeb82('0x6')]+=0x1;updateWaitingCounter(_0x523065);}}_0x523065[_0xeb82('0xa')]+=0x1;return _0x523065;}function getLastMessageText(_0xc95cbd){return db[_0xeb82('0xe')][_0xeb82('0xf')]({'where':{'$and':[{'MailInteractionId':_0xc95cbd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xeb82('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xeb82('0x11')],'order':_0xeb82('0x12'),'raw':!![]})['then'](function(_0xa21f2f){if(_0xa21f2f&&_0xa21f2f[_0xeb82('0x11')]){_0xc95cbd[_0xeb82('0x13')]=_['trimStart'](_0xa21f2f[_0xeb82('0x11')]);}return _0xc95cbd;})[_0xeb82('0x14')](function(_0x354f92){throw _0x354f92;});}exports['updateInteraction']=function(_0x46f171,_0x460cef,_0x578b66,_0x423497){return new Promise(function(_0x568197,_0x11d9f3){return getInteractionUsers(_0x46f171['id'],_0x578b66)['then'](function(_0x2b45dc){_0x46f171[_0xeb82('0x15')]=_0x2b45dc;return getInteractionTags(_0x46f171[_0xeb82('0x16')],_0x460cef);})[_0xeb82('0x17')](function(_0x5af1f5){_0x46f171[_0xeb82('0x18')]=_0x5af1f5;delete _0x46f171[_0xeb82('0x16')];return updateInteractionCounters(_0x46f171);})['then'](function(_0x57dde9){if(_0x423497){return getLastMessageText(_0x57dde9);}else{return _0x57dde9;}})[_0xeb82('0x17')](function(_0x42588c){_0x568197(_0x42588c);})[_0xeb82('0x14')](function(_0x4d54de){_0x11d9f3(_0x4d54de);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 5cd6264..50e0ca6 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 _0x3281=['upperFirst','unknown','accounts','_messages','_interactions','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','info','catch','error','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Account','InteractionId'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3281,0x7d));var _0x1328=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x3281[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var db=require(_0x1328('0x0'))['db'];var loggers={'openchannel':require(_0x1328('0x1'))(_0x1328('0x2')),'mail':require(_0x1328('0x1'))('mail-interactions'),'fax':require(_0x1328('0x1'))(_0x1328('0x3')),'sms':require(_0x1328('0x1'))(_0x1328('0x4')),'chat':require(_0x1328('0x1'))(_0x1328('0x5')),'whatsapp':require(_0x1328('0x1'))('whatsapp-interactions')};function getAccountFK(_0x4b98ec){return _[_0x1328('0x6')](_0x4b98ec)+(_0x4b98ec===_0x1328('0x7')?'Website':_0x1328('0x8'))+'Id';}function getInteractionFK(_0x282d4c){return _['capitalize'](_0x282d4c)+_0x1328('0x9');}function getInteractionId(_0x5508aa,_0x495812,_0x3c97ea){if(_0x5508aa&&_0x5508aa[_[_0x1328('0xa')](_0x3c97ea)+_0x1328('0x9')]){return _0x5508aa[_[_0x1328('0xa')](_0x3c97ea)+_0x1328('0x9')];}else if(_0x5508aa&&_0x5508aa['id']){return _0x5508aa['id'];}else if(_0x495812&&_0x495812['id']){return _0x495812['id'];}else{return _0x1328('0xb');}}function getInteractionsTables(_0x39fb79){return{'accounts':_0x39fb79+'_'+(_0x39fb79===_0x1328('0x7')?'websites':_0x1328('0xc')),'interactions':_0x39fb79+'_interactions','interactionsTags':_0x39fb79+'_interaction_has_tags','messages':_0x39fb79+_0x1328('0xd'),'userInteractions':'user_has_'+_0x39fb79+_0x1328('0xe')};}function getSelectedTags(_0x487b82){var _0x9d871e=[];if(_0x487b82){_0x9d871e=Array[_0x1328('0xf')](_0x487b82)?_0x487b82:[_0x487b82];}return _0x9d871e;}function log(_0x554dd2,_0x4bc6d8,_0x383752,_0x39fbe8,_0x5ecb85,_0x4b9336){loggers[_0x5ecb85['toLowerCase']()][_0x554dd2](_0x1328('0x10'),_0x4b9336[_0x1328('0x11')](),_0x4bc6d8?_0x4bc6d8['id']:null,_0x4bc6d8?_0x4bc6d8[_0x1328('0x12')]:null,_0x4bc6d8?_0x4bc6d8[_0x1328('0x13')]:null,getInteractionId(_0x383752,_0x39fbe8,_0x5ecb85),_0x383752?JSON['stringify'](_0x383752):_0x1328('0x14'));}function updateUser(_0x247ec5,_0x598586,_0x41e2b5,_0x339ec1,_0xd8ee26){db[_['upperFirst'](_0x339ec1)+_0x1328('0x15')][_0x1328('0x16')]({'where':{'id':getInteractionId(_0x598586,_0x41e2b5,_0x339ec1)}})[_0x1328('0x17')](function(_0x5f2cf6){if(_0x5f2cf6){return _0x5f2cf6['update']({'UserId':_0x247ec5?_0x247ec5['id']:null});}})['then'](function(_0x236015){if(_0x236015){log(_0x1328('0x18'),_0x247ec5,_0x598586,_0x41e2b5,_0x339ec1,_0xd8ee26);}})[_0x1328('0x19')](function(){log(_0x1328('0x1a'),_0x247ec5,_0x598586,_0x41e2b5,_0x339ec1,_0xd8ee26);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x43a4=['isArray','toLowerCase','toUpperCase','name','stringify','null','Interaction','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_messages','user_has_'];(function(_0x32b396,_0x3167fd){var _0x328de6=function(_0x56c824){while(--_0x56c824){_0x32b396['push'](_0x32b396['shift']());}};_0x328de6(++_0x3167fd);}(_0x43a4,0x96));var _0x443a=function(_0x434002,_0x566d6f){_0x434002=_0x434002-0x0;var _0x64e2cb=_0x43a4[_0x434002];return _0x64e2cb;};'use strict';var _=require(_0x443a('0x0'));var db=require(_0x443a('0x1'))['db'];var loggers={'openchannel':require(_0x443a('0x2'))(_0x443a('0x3')),'mail':require(_0x443a('0x2'))(_0x443a('0x4')),'fax':require(_0x443a('0x2'))(_0x443a('0x5')),'sms':require(_0x443a('0x2'))(_0x443a('0x6')),'chat':require(_0x443a('0x2'))(_0x443a('0x7')),'whatsapp':require(_0x443a('0x2'))('whatsapp-interactions')};function getAccountFK(_0x4b8938){return _[_0x443a('0x8')](_0x4b8938)+(_0x4b8938===_0x443a('0x9')?_0x443a('0xa'):_0x443a('0xb'))+'Id';}function getInteractionFK(_0x55ee5c){return _['capitalize'](_0x55ee5c)+'InteractionId';}function getInteractionId(_0x4ccb97,_0x13839c,_0x1bb373){if(_0x4ccb97&&_0x4ccb97[_[_0x443a('0xc')](_0x1bb373)+_0x443a('0xd')]){return _0x4ccb97[_[_0x443a('0xc')](_0x1bb373)+_0x443a('0xd')];}else if(_0x4ccb97&&_0x4ccb97['id']){return _0x4ccb97['id'];}else if(_0x13839c&&_0x13839c['id']){return _0x13839c['id'];}else{return _0x443a('0xe');}}function getInteractionsTables(_0x2ffa9c){return{'accounts':_0x2ffa9c+'_'+(_0x2ffa9c===_0x443a('0x9')?_0x443a('0xf'):_0x443a('0x10')),'interactions':_0x2ffa9c+_0x443a('0x11'),'interactionsTags':_0x2ffa9c+'_interaction_has_tags','messages':_0x2ffa9c+_0x443a('0x12'),'userInteractions':_0x443a('0x13')+_0x2ffa9c+_0x443a('0x11')};}function getSelectedTags(_0x2bc3d5){var _0x2bef89=[];if(_0x2bc3d5){_0x2bef89=Array[_0x443a('0x14')](_0x2bc3d5)?_0x2bc3d5:[_0x2bc3d5];}return _0x2bef89;}function log(_0x2eec89,_0xc28967,_0x4bd27c,_0x28ff46,_0x3cdd21,_0x4ee6a0){loggers[_0x3cdd21[_0x443a('0x15')]()][_0x2eec89]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ee6a0[_0x443a('0x16')](),_0xc28967?_0xc28967['id']:null,_0xc28967?_0xc28967[_0x443a('0x17')]:null,_0xc28967?_0xc28967['role']:null,getInteractionId(_0x4bd27c,_0x28ff46,_0x3cdd21),_0x4bd27c?JSON[_0x443a('0x18')](_0x4bd27c):_0x443a('0x19'));}function updateUser(_0x111263,_0xfe1807,_0x4bacbb,_0x27fc72,_0x5fe1eb){db[_[_0x443a('0xc')](_0x27fc72)+_0x443a('0x1a')][_0x443a('0x1b')]({'where':{'id':getInteractionId(_0xfe1807,_0x4bacbb,_0x27fc72)}})[_0x443a('0x1c')](function(_0x390b28){if(_0x390b28){return _0x390b28[_0x443a('0x1d')]({'UserId':_0x111263?_0x111263['id']:null});}})[_0x443a('0x1c')](function(_0x4c3e48){if(_0x4c3e48){log(_0x443a('0x1e'),_0x111263,_0xfe1807,_0x4bacbb,_0x27fc72,_0x5fe1eb);}})[_0x443a('0x1f')](function(){log(_0x443a('0x20'),_0x111263,_0xfe1807,_0x4bacbb,_0x27fc72,_0x5fe1eb);});}module[_0x443a('0x21')]={'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 00e1b90..78fb46d 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 _0xf832=['license','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment'];(function(_0x579ed3,_0x5496fb){var _0x5ae9da=function(_0x1316cb){while(--_0x1316cb){_0x579ed3['push'](_0x579ed3['shift']());}};_0x5ae9da(++_0x5496fb);}(_0xf832,0x175));var _0x2f83=function(_0x411d8c,_0x22d9ff){_0x411d8c=_0x411d8c-0x0;var _0x34f6e5=_0xf832[_0x411d8c];return _0x34f6e5;};'use strict';var crypto=require(_0x2f83('0x0'));var util=require(_0x2f83('0x1'));var compose=require(_0x2f83('0x2'));var db=require(_0x2f83('0x3'))['db'];var config=require(_0x2f83('0x4'));function getValueFromLicense(_0x4fd5b8,_0x2b2d4d){if(_0x4fd5b8&&_0x2b2d4d){if(_0x2b2d4d['data1']&&_0x2b2d4d[_0x2f83('0x5')]){var _0x1de3a9=_0x2b2d4d[_0x2f83('0x6')];var _0x4ba9a0=_0x2b2d4d[_0x2f83('0x5')];var _0x4510ff=_0x1de3a9['split']('-')[0x4];var _0x55704a=_0x1de3a9[_0x2f83('0x7')]('-')[0x0];var _0x2fa415=crypto['createDecipher'](_0x2f83('0x8'),util[_0x2f83('0x9')](_0x2f83('0xa'),_0x4510ff,_0x1de3a9,_0x55704a));var _0x3379ea=_0x2fa415[_0x2f83('0xb')](_0x4ba9a0,_0x2f83('0xc'),_0x2f83('0xd'));_0x3379ea+=_0x2fa415[_0x2f83('0xe')](_0x2f83('0xd'));var _0x3d7fc1=JSON[_0x2f83('0xf')](_0x3379ea);return _0x3d7fc1['hasOwnProperty'](_0x4fd5b8)?_0x3d7fc1[_0x4fd5b8]:null;}}return null;}function isLimit(_0x47c7c2,_0xed036b,_0x2e1364,_0x18fec1){var _0x21303e=_0xed036b;return compose()['use'](function(_0x1464ed,_0x3f114e,_0x2b89c9){return db['License'][_0x2f83('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x2f83('0x11')](function(_0x3fc4af){var _0x447637=getValueFromLicense(_0x47c7c2,_0x3fc4af);return _0x447637?_0x447637:_0x21303e;})[_0x2f83('0x11')](function(_0x2227fd){_0x21303e=_0x2227fd;return _0x2e1364[_0x2f83('0x12')](_0x18fec1);})['then'](function(_0x564ac8){if(_0x564ac8>=_0x21303e){return _0x3f114e[_0x2f83('0x13')](0x193)['json']({'message':util[_0x2f83('0x9')](_0x2f83('0x14'),_0x47c7c2)});}_0x2b89c9();})[_0x2f83('0x15')](function(_0x17ff9f){_0x2b89c9(_0x17ff9f);});});}function isUserLimit(){return isLimit(_0x2f83('0x16'),0x1,db[_0x2f83('0x17')],{'where':{'$or':[{'role':_0x2f83('0x18')},{'role':_0x2f83('0x19')}]}});}exports[_0x2f83('0x1a')]=isUserLimit; \ No newline at end of file +var _0x74f1=['then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','license','split','aes-256-ctr','format','base64','utf8','final','parse','use','License'];(function(_0x15f85c,_0x104463){var _0x4a08c3=function(_0x5e5520){while(--_0x5e5520){_0x15f85c['push'](_0x15f85c['shift']());}};_0x4a08c3(++_0x104463);}(_0x74f1,0xa2));var _0x174f=function(_0x13a5a8,_0x186495){_0x13a5a8=_0x13a5a8-0x0;var _0x397582=_0x74f1[_0x13a5a8];return _0x397582;};'use strict';var crypto=require('crypto');var util=require(_0x174f('0x0'));var compose=require(_0x174f('0x1'));var db=require(_0x174f('0x2'))['db'];var config=require(_0x174f('0x3'));function getValueFromLicense(_0x12edf6,_0x5a6d28){if(_0x12edf6&&_0x5a6d28){if(_0x5a6d28['data1']&&_0x5a6d28['license']){var _0x3f2572=_0x5a6d28['data1'];var _0x2dd5b6=_0x5a6d28[_0x174f('0x4')];var _0x28726a=_0x3f2572[_0x174f('0x5')]('-')[0x4];var _0xaf5f05=_0x3f2572[_0x174f('0x5')]('-')[0x0];var _0x1027b1=crypto['createDecipher'](_0x174f('0x6'),util[_0x174f('0x7')]('%s:%s:%s',_0x28726a,_0x3f2572,_0xaf5f05));var _0x43b319=_0x1027b1['update'](_0x2dd5b6,_0x174f('0x8'),_0x174f('0x9'));_0x43b319+=_0x1027b1[_0x174f('0xa')](_0x174f('0x9'));var _0x5b17bd=JSON[_0x174f('0xb')](_0x43b319);return _0x5b17bd['hasOwnProperty'](_0x12edf6)?_0x5b17bd[_0x12edf6]:null;}}return null;}function isLimit(_0x4f9f46,_0x3b8b42,_0x4eb4a8,_0x40c973){var _0x5b5bfe=_0x3b8b42;return compose()[_0x174f('0xc')](function(_0x287fa6,_0x2a30b4,_0x54200c){return db[_0x174f('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x174f('0xe')](function(_0x2be2a9){var _0x5e162d=getValueFromLicense(_0x4f9f46,_0x2be2a9);return _0x5e162d?_0x5e162d:_0x5b5bfe;})[_0x174f('0xe')](function(_0xfcb616){_0x5b5bfe=_0xfcb616;return _0x4eb4a8['count'](_0x40c973);})['then'](function(_0x2f70d8){if(_0x2f70d8>=_0x5b5bfe){return _0x2a30b4[_0x174f('0xf')](0x193)['json']({'message':util[_0x174f('0x7')](_0x174f('0x10'),_0x4f9f46)});}_0x54200c();})[_0x174f('0x11')](function(_0x80bf14){_0x54200c(_0x80bf14);});});}function isUserLimit(){return isLimit(_0x174f('0x12'),0x1,db[_0x174f('0x13')],{'where':{'$or':[{'role':'admin'},{'role':_0x174f('0x14')}]}});}exports[_0x174f('0x15')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5f6fa34..8e95629 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 _0x7391=['$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','$gte','>=\x20?','start','pop','utcOffset','format','add','hours','minutes','lodash','sqlOperator','and','replace','[$and]','split','length','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','YYYY-MM-DD','castTo','text','CAST(','field'];(function(_0x40b949,_0x309679){var _0x317358=function(_0x4c60b2){while(--_0x4c60b2){_0x40b949['push'](_0x40b949['shift']());}};_0x317358(++_0x309679);}(_0x7391,0x1b9));var _0x1739=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0x7391[_0x295a3d];return _0x23a732;};'use strict';var _=require(_0x1739('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x22445b){var _0x180708={'conditions':[]};_0x180708[_0x1739('0x1')]=_['startsWith'](_0x22445b,'[$or]')?'or':_0x1739('0x2');var _0x31fd06=_0x22445b[_0x1739('0x3')](_0x1739('0x4'),'')['replace']('[$or]','')[_0x1739('0x5')]('||');for(var _0x1d24ef=0x0;_0x1d24ef<_0x31fd06[_0x1739('0x6')];_0x1d24ef++){var _0x40b529=_0x31fd06[_0x1d24ef][_0x1739('0x5')](':=');var _0x289418=_0x40b529[0x0];var _0x58226b=_0x40b529['slice'](0x1);_0x58226b[_0x1739('0x7')](function(_0xba677a){var _0x2baf1f=_0xba677a[_0x1739('0x5')]('[')[_0x1739('0x8')]();var _0x218e90=_0xba677a[_0x1739('0x9')](/\[(.*?)\]/g);_0x218e90[_0x1739('0x7')](function(_0x1669c7){var _0x4be855=_0x1669c7[_0x1739('0x5')]('[')[_0x1739('0xa')](function(_0x212c90){return _0x212c90[_0x1739('0xb')](']')>-0x1;})['map'](function(_0x3d1ac6){return _0x3d1ac6['split'](']')[0x0];})[0x0];_0x180708[_0x1739('0xc')][_0x1739('0xd')]({'field':_0x289418,'operator':_0x2baf1f,'value':_0x4be855});});});}return _0x180708;};exports[_0x1739('0xe')]=function(_0x4a2240,_0x2f5d02,_0x1f50bc){var _0x58da88={};if(_0x2f5d02===_0x1739('0xf')){if(_0x1f50bc[_0x1739('0x10')]==='$eq'){_0x1f50bc[_0x1739('0x10')]=_0x1739('0x11');_0x1f50bc['value']+=','+_0x1f50bc[_0x1739('0x12')];}else if(_[_0x1739('0x13')]([_0x1739('0x14'),_0x1739('0x15')],_0x1f50bc['operator'])){_0x1f50bc[_0x1739('0x12')]=moment(_0x1f50bc['value'])['add'](0x1,'days')['format'](_0x1739('0x16'));}}if(_0x1f50bc[_0x1739('0x17')]){_0x2f5d02=_0x1f50bc[_0x1739('0x17')];_0x58da88[_0x1739('0x18')]=_0x1739('0x19')+_0x4a2240+'.'+_0x1f50bc[_0x1739('0x1a')]+'\x20AS\x20'+_0x1f50bc['castTo']+')\x20'+parseOperator(_0x1f50bc[_0x1739('0x10')]);}else{_0x58da88['text']=_0x4a2240+'.'+_0x1f50bc[_0x1739('0x1a')]+'\x20'+parseOperator(_0x1f50bc[_0x1739('0x10')]);}if(_['includes']([_0x1739('0x1b'),_0x1739('0x1c')],_0x1f50bc[_0x1739('0x10')]))_0x58da88[_0x1739('0x18')]='('+_0x58da88[_0x1739('0x18')]+_0x1739('0x1d')+_0x4a2240+'.'+_0x1f50bc[_0x1739('0x1a')]+_0x1739('0x1e');_0x58da88[_0x1739('0x12')]=parseValue(_0x2f5d02,_0x1f50bc['operator'],_0x1f50bc['value']);return _0x58da88;};function parseOperator(_0x55edf6){var _0x2222d6;switch(_0x55edf6){case _0x1739('0x1f'):_0x2222d6=_0x1739('0x20');break;case _0x1739('0x1c'):_0x2222d6=_0x1739('0x21');break;case _0x1739('0x22'):_0x2222d6=_0x1739('0x23');break;case'$ne':_0x2222d6=_0x1739('0x24');break;case _0x1739('0x25'):case _0x1739('0x26'):case _0x1739('0x27'):_0x2222d6=_0x1739('0x28');break;case'$lt':_0x2222d6=_0x1739('0x29');break;case _0x1739('0x14'):_0x2222d6=_0x1739('0x2a');break;case _0x1739('0x15'):_0x2222d6='<=\x20?';break;case _0x1739('0x2b'):_0x2222d6=_0x1739('0x2c');break;case'$between':_0x2222d6='BETWEEN\x20?\x20AND\x20?';break;}return _0x2222d6;}function parseValue(_0x5d43f3,_0x25160b,_0x4de1ea){var _0x27b21f={'start':undefined,'end':undefined};switch(_0x25160b){case _0x1739('0x1f'):case'$notIn':_0x27b21f[_0x1739('0x2d')]=_0x4de1ea[_0x1739('0x5')](',');break;case'$substring':_0x27b21f[_0x1739('0x2d')]='%'+_0x4de1ea+'%';break;case _0x1739('0x26'):_0x27b21f['start']=_0x4de1ea+'%';break;case'$endsWith':_0x27b21f[_0x1739('0x2d')]='%'+_0x4de1ea;break;case _0x1739('0x11'):var _0x3ff186=_0x4de1ea[_0x1739('0x5')](',');var _0x4de1ea=_0x3ff186['shift']();var _0x215455=_0x3ff186[_0x1739('0x2e')]();if(_0x5d43f3===_0x1739('0xf')){_0x4de1ea=moment(_0x4de1ea)[_0x1739('0x2f')](0x0,!![])[_0x1739('0x30')]();_0x215455=moment(_0x215455)[_0x1739('0x2f')](0x0,!![])[_0x1739('0x31')](0x17,_0x1739('0x32'))['add'](0x3b,_0x1739('0x33'))['add'](0x3b,'seconds')[_0x1739('0x30')]();}_0x27b21f={'start':_0x4de1ea,'end':_0x215455};break;default:_0x27b21f[_0x1739('0x2d')]=_0x4de1ea;break;}return _0x27b21f;} \ No newline at end of file +var _0x2906=['replace','split','length','slice','forEach','shift','match','filter','conditions','push','DATE','$eq','operator','value','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','includes','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$in','start','pop','utcOffset','format','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and'];(function(_0x248b9f,_0x48a153){var _0x3b7e96=function(_0x5630a6){while(--_0x5630a6){_0x248b9f['push'](_0x248b9f['shift']());}};_0x3b7e96(++_0x48a153);}(_0x2906,0x1d1));var _0x6290=function(_0x2c3f08,_0x380f2b){_0x2c3f08=_0x2c3f08-0x0;var _0x4ea2ab=_0x2906[_0x2c3f08];return _0x4ea2ab;};'use strict';var _=require(_0x6290('0x0'));var moment=require(_0x6290('0x1'));exports[_0x6290('0x2')]=function(_0x1da312){var _0x3e6598={'conditions':[]};_0x3e6598[_0x6290('0x3')]=_[_0x6290('0x4')](_0x1da312,_0x6290('0x5'))?'or':_0x6290('0x6');var _0x1bb38f=_0x1da312[_0x6290('0x7')]('[$and]','')[_0x6290('0x7')]('[$or]','')[_0x6290('0x8')]('||');for(var _0x4d3963=0x0;_0x4d3963<_0x1bb38f[_0x6290('0x9')];_0x4d3963++){var _0x317db3=_0x1bb38f[_0x4d3963][_0x6290('0x8')](':=');var _0x3b3fba=_0x317db3[0x0];var _0x49a227=_0x317db3[_0x6290('0xa')](0x1);_0x49a227[_0x6290('0xb')](function(_0x3f511a){var _0x3ee639=_0x3f511a[_0x6290('0x8')]('[')[_0x6290('0xc')]();var _0x3c4ca3=_0x3f511a[_0x6290('0xd')](/\[(.*?)\]/g);_0x3c4ca3['forEach'](function(_0xa80e27){var _0x1456c0=_0xa80e27[_0x6290('0x8')]('[')[_0x6290('0xe')](function(_0xdd20d1){return _0xdd20d1['indexOf'](']')>-0x1;})['map'](function(_0x7b4090){return _0x7b4090[_0x6290('0x8')](']')[0x0];})[0x0];_0x3e6598[_0x6290('0xf')][_0x6290('0x10')]({'field':_0x3b3fba,'operator':_0x3ee639,'value':_0x1456c0});});});}return _0x3e6598;};exports['buildExpression']=function(_0x38efb8,_0x51b50b,_0x2380a8){var _0x409444={};if(_0x51b50b===_0x6290('0x11')){if(_0x2380a8['operator']===_0x6290('0x12')){_0x2380a8[_0x6290('0x13')]='$between';_0x2380a8['value']+=','+_0x2380a8[_0x6290('0x14')];}else if(_['includes'](['$gt',_0x6290('0x15')],_0x2380a8[_0x6290('0x13')])){_0x2380a8[_0x6290('0x14')]=moment(_0x2380a8['value'])[_0x6290('0x16')](0x1,_0x6290('0x17'))['format'](_0x6290('0x18'));}}if(_0x2380a8[_0x6290('0x19')]){_0x51b50b=_0x2380a8[_0x6290('0x19')];_0x409444[_0x6290('0x1a')]=_0x6290('0x1b')+_0x38efb8+'.'+_0x2380a8[_0x6290('0x1c')]+'\x20AS\x20'+_0x2380a8['castTo']+')\x20'+parseOperator(_0x2380a8['operator']);}else{_0x409444[_0x6290('0x1a')]=_0x38efb8+'.'+_0x2380a8[_0x6290('0x1c')]+'\x20'+parseOperator(_0x2380a8[_0x6290('0x13')]);}if(_[_0x6290('0x1d')]([_0x6290('0x1e'),'$notIn'],_0x2380a8[_0x6290('0x13')]))_0x409444['text']='('+_0x409444[_0x6290('0x1a')]+_0x6290('0x1f')+_0x38efb8+'.'+_0x2380a8[_0x6290('0x1c')]+_0x6290('0x20');_0x409444[_0x6290('0x14')]=parseValue(_0x51b50b,_0x2380a8[_0x6290('0x13')],_0x2380a8[_0x6290('0x14')]);return _0x409444;};function parseOperator(_0x435f0d){var _0x144d56;switch(_0x435f0d){case'$in':_0x144d56=_0x6290('0x21');break;case _0x6290('0x22'):_0x144d56=_0x6290('0x23');break;case _0x6290('0x12'):_0x144d56=_0x6290('0x24');break;case'$ne':_0x144d56=_0x6290('0x25');break;case _0x6290('0x26'):case _0x6290('0x27'):case _0x6290('0x28'):_0x144d56=_0x6290('0x29');break;case _0x6290('0x2a'):_0x144d56=_0x6290('0x2b');break;case _0x6290('0x2c'):_0x144d56=_0x6290('0x2d');break;case _0x6290('0x15'):_0x144d56=_0x6290('0x2e');break;case _0x6290('0x2f'):_0x144d56=_0x6290('0x30');break;case _0x6290('0x31'):_0x144d56=_0x6290('0x32');break;}return _0x144d56;}function parseValue(_0x9f202c,_0x1f0b48,_0x566f27){var _0x48773e={'start':undefined,'end':undefined};switch(_0x1f0b48){case _0x6290('0x33'):case _0x6290('0x22'):_0x48773e['start']=_0x566f27['split'](',');break;case'$substring':_0x48773e[_0x6290('0x34')]='%'+_0x566f27+'%';break;case _0x6290('0x27'):_0x48773e[_0x6290('0x34')]=_0x566f27+'%';break;case'$endsWith':_0x48773e['start']='%'+_0x566f27;break;case _0x6290('0x31'):var _0x3dc5fc=_0x566f27[_0x6290('0x8')](',');var _0x566f27=_0x3dc5fc[_0x6290('0xc')]();var _0x52b30f=_0x3dc5fc[_0x6290('0x35')]();if(_0x9f202c===_0x6290('0x11')){_0x566f27=moment(_0x566f27)[_0x6290('0x36')](0x0,!![])[_0x6290('0x37')]();_0x52b30f=moment(_0x52b30f)[_0x6290('0x36')](0x0,!![])['add'](0x17,_0x6290('0x38'))['add'](0x3b,_0x6290('0x39'))[_0x6290('0x16')](0x3b,_0x6290('0x3a'))[_0x6290('0x37')]();}_0x48773e={'start':_0x566f27,'end':_0x52b30f};break;default:_0x48773e[_0x6290('0x34')]=_0x566f27;break;}return _0x48773e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 0d80d49..7f359e9 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 _0x4444=['ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','name','filters','intersection','attributes','nolimit','where','pick','filter','columns','value','merge','VIRTUAL','lower','sequelize','moment','keys','includes','parse','fields','split','isEmpty','forOwn','find','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4444,0x1a2));var _0x4444=function(_0x335e51,_0x3c63fb){_0x335e51=_0x335e51-0x0;var _0x11637f=_0x4444[_0x335e51];return _0x11637f;};'use strict';var _=require('lodash');var sequelize=require(_0x4444('0x0'));var moment=require(_0x4444('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2d1aae){var _0x3907b8=['ne'];try{var _0x567b2d=JSON['parse'](_0x2d1aae);var _0x14f3df=Object[_0x4444('0x2')](_0x567b2d)[0x0];return _0x3907b8[_0x4444('0x3')](_0x14f3df);}catch(_0x1db920){return![];}}function getOperatorValue(_0x432991){var _0x1000ed=JSON[_0x4444('0x4')](_0x432991);var _0x23a792=Object[_0x4444('0x2')](_0x1000ed)[0x0];var _0x21073e=_0x1000ed[_0x23a792];return{['$'+_0x23a792]:_0x21073e};}exports[_0x4444('0x5')]=function(_0x19aaf0){var _0xde81f7=null;if(_0x19aaf0){_0xde81f7=_0x19aaf0[_0x4444('0x6')](',');}return _0xde81f7;};exports['filters']=function(_0x18921f,_0x567369){var _0x3cd28a={};if(!_[_0x4444('0x7')](_0x18921f)){_[_0x4444('0x8')](_0x18921f,function(_0x4427b7,_0x5c161b){try{if(_0x567369){var _0x2dccbf=_[_0x4444('0x9')](_0x567369,{'name':_0x5c161b})||{};if(hasSequelizeOperator(_0x4427b7)){_0x3cd28a[_0x5c161b]=getOperatorValue(_0x4427b7);}else if(_0x2dccbf[_0x4444('0xa')]===_0x4444('0xb')&&_[_0x4444('0xc')](_0x4427b7)){var _0x399edc=JSON['parse'](_0x4427b7);var _0x2fceff={'$gte':moment(moment(_0x399edc['$gte'])[_0x4444('0xd')](_0x4444('0xe')))[_0x4444('0xf')]()[_0x4444('0xd')](),'$lte':moment(moment(_0x399edc[_0x4444('0x10')])[_0x4444('0xd')](_0x4444('0xe')))[_0x4444('0xf')]()[_0x4444('0x11')](0x1,'s')['format']()};_0x3cd28a[_0x5c161b]=_0x2fceff;}else if(_0x2dccbf['name']==='uniqueid'){_0x3cd28a[_0x5c161b]=_0x4427b7;}else{_0x3cd28a[_0x5c161b]=_['isArray'](_0x4427b7)?_0x4427b7:JSON[_0x4444('0x4')](_0x4427b7);}}else{_0x3cd28a[_0x5c161b]=_[_0x4444('0x12')](_0x4427b7)?_0x4427b7:JSON[_0x4444('0x4')](_0x4427b7);}}catch(_0x561bef){_0x3cd28a[_0x5c161b]=_0x4427b7[_0x4444('0x6')](',');}});}return _0x3cd28a;};exports[_0x4444('0x13')]=function(_0x2e5a01){_0x2e5a01=parseInt(_0x2e5a01,0xa);if(!_0x2e5a01||_0x2e5a01<0x0){_0x2e5a01=LIMIT_VALUE;}return _0x2e5a01;};exports[_0x4444('0x14')]=function(_0x100480){_0x100480=parseInt(_0x100480,0xa);if(!_0x100480||_0x100480<0x0){_0x100480=0x0;}return _0x100480;};exports[_0x4444('0x15')]=function(_0x54f9ab){var _0x4120e6,_0x15babf=null;if(_0x54f9ab){_0x4120e6=_0x54f9ab[_0x4444('0x6')](',');_0x15babf=_[_0x4444('0x16')](_0x4120e6,function(_0x2a2865){if(_0x2a2865[_0x4444('0x17')]('-')===0x0){return[_0x2a2865===_0x4444('0x18')?sequelize[_0x4444('0x19')](sequelize['col'](_0x4444('0x18')),_0x4444('0x1a')):_0x2a2865[_0x4444('0x1b')](0x1),_0x4444('0x1c')];}else{return[_0x2a2865==='priority'?sequelize['cast'](sequelize[_0x4444('0x1d')](_0x4444('0x18')),_0x4444('0x1a')):_0x2a2865,_0x4444('0x1e')];}});}return _0x15babf;};exports[_0x4444('0x1f')]=function(_0x1c6559,_0x41e764){if(_[_0x4444('0x7')](_0x1c6559)){return _0x1c6559;}if(_[_0x4444('0x12')](_0x1c6559)){for(var _0x79a26b=0x0;_0x79a26b<_0x1c6559[_0x4444('0x20')];_0x79a26b+=0x1){_0x1c6559[_0x79a26b]=this[_0x4444('0x1f')](_0x1c6559[_0x79a26b],_0x41e764);}return _0x1c6559;}if(!_[_0x4444('0x21')](_0x1c6559)){return _0x1c6559;}if(_[_0x4444('0x22')](_0x41e764)){_0x41e764=[_0x41e764];}if(!_[_0x4444('0x12')](_0x41e764)){return _0x1c6559;}for(var _0xc104c7=0x0;_0xc104c7<_0x41e764[_0x4444('0x20')];_0xc104c7+=0x1){_[_0x4444('0x23')](_0x1c6559,_0x41e764[_0xc104c7]);}for(var _0x4129cc in _0x1c6559){if(_0x1c6559[_0x4444('0x24')](_0x4129cc)){_0x1c6559[_0x4129cc]=this['omit'](_0x1c6559[_0x4129cc],_0x41e764);}}return _0x1c6559;};exports[_0x4444('0x25')]=function(_0x341fd0){return _0x341fd0['match'](RegExp(_0x4444('0x26')))?!![]:![];};exports['isEmail']=function(_0x42cb3e){return _0x42cb3e[_0x4444('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x4444('0x28')]=function(_0x63a450,_0x1d1deb){var _0x48ab2d=[];var _0x47fc68=/[ `!@#$%^&*()_\-?~]/;var _0x39ebeb=_0x1d1deb?_0x4444('0x29'):_0x4444('0x2a');_0x63a450['split'](/[ ,]+/)[_0x4444('0x2b')](function(_0x409e72){_0x409e72=_0x409e72[_0x4444('0x2c')](/([^:]")"+/g,'$1');_0x409e72='+'+_0x409e72+'*';var _0x3c4fd2=_0x409e72['match'](_0x47fc68);if(_0x3c4fd2){_0x409e72='\x22'+_0x409e72+'\x22';}_0x48ab2d[_0x4444('0x2d')](_0x409e72);});_0x39ebeb=_0x39ebeb[_0x4444('0x2c')](_0x4444('0x2a'),_0x48ab2d[_0x4444('0x2e')]('\x20'));return _0x39ebeb;};exports[_0x4444('0x2f')]=function(_0x4084e9,_0xaad26f,_0xbf21a8){var _0x4be0ca={},_0x4ef4b3={};if(_0xaad26f[_0x4444('0x30')][_0x4444('0x31')]){_0xaad26f[_0x4444('0x30')]['id']=_0xaad26f[_0x4444('0x30')]['$id'];delete _0xaad26f[_0x4444('0x30')][_0x4444('0x31')];}_0x4be0ca[_0x4444('0x32')]=_[_0x4444('0x16')](_0x4084e9,_0x4444('0x33'));_0x4be0ca[_0x4444('0x30')]=_['keys'](_0xaad26f[_0x4444('0x30')]);_0x4be0ca[_0x4444('0x34')]=_[_0x4444('0x35')](_0x4be0ca[_0x4444('0x32')],_0x4be0ca[_0x4444('0x30')]);_0x4ef4b3[_0x4444('0x36')]=_[_0x4444('0x35')](_0x4be0ca['model'],this[_0x4444('0x5')](_0xaad26f[_0x4444('0x30')][_0x4444('0x5')]));_0x4ef4b3[_0x4444('0x36')]=_0x4ef4b3[_0x4444('0x36')][_0x4444('0x20')]?_0x4ef4b3[_0x4444('0x36')]:_0x4be0ca[_0x4444('0x32')];if(!_0xaad26f[_0x4444('0x30')]['hasOwnProperty'](_0x4444('0x37'))){_0x4ef4b3[_0x4444('0x13')]=this['limit'](_0xaad26f[_0x4444('0x30')][_0x4444('0x13')]);_0x4ef4b3[_0x4444('0x14')]=this[_0x4444('0x14')](_0xaad26f[_0x4444('0x30')]['offset']);}_0x4ef4b3['order']=this[_0x4444('0x15')](_0xaad26f[_0x4444('0x30')][_0x4444('0x15')]);_0x4ef4b3[_0x4444('0x38')]=this[_0x4444('0x34')](_[_0x4444('0x39')](_0xaad26f[_0x4444('0x30')],_0x4be0ca[_0x4444('0x34')]),_0x4084e9);if(_0xaad26f['query'][_0x4444('0x3a')]){var _0x569f66=_0x4084e9;var _0x5964c9=_0xaad26f['query'][_0x4444('0x3a')];if(typeof _0x5964c9==='object'){_0x569f66=_[_0x4444('0x3a')](_0x4084e9,function(_0x363c6d){return _['includes'](_0x5964c9[_0x4444('0x3b')],_0x363c6d[_0x4444('0x33')]);});_0x5964c9=_0x5964c9[_0x4444('0x3c')];}_0x4ef4b3['where']=_[_0x4444('0x3d')](_0x4ef4b3['where'],{'$or':_['map'](_0x569f66,function(_0x108595){if(_0x108595[_0x4444('0xa')]!==_0x4444('0x3e')){if(_0xbf21a8){return sequelize['where'](sequelize['fn'](_0x4444('0x3f'),sequelize[_0x4444('0x1d')](_0x108595['name'])),{'$like':sequelize['fn'](_0x4444('0x3f'),'%'+_0xaad26f['query'][_0x4444('0x3a')]+'%')});}else{var _0x139762={};_0x139762[_0x108595[_0x4444('0x33')]]={'$like':'%'+_0xaad26f[_0x4444('0x30')]['filter']+'%'};return _0x139762;}}})});}_0x4ef4b3=_[_0x4444('0x3d')]({},_0x4ef4b3,_0xaad26f['options']);return _0x4ef4b3;}; \ No newline at end of file +var _0x76c4=['cast','omit','isArray','length','unset','hasOwnProperty','isNumeric','match','\x22{EXPR}\x22','replace','getOptions','$id','query','model','filters','intersection','attributes','order','pick','filter','value','merge','where','lower','col','options','lodash','sequelize','moment','keys','includes','parse','fields','split','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','limit','offset','sort','map','indexOf','priority','unsigned','substr'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x76c4,0x1a2));var _0x476c=function(_0x342b41,_0x2396aa){_0x342b41=_0x342b41-0x0;var _0x5a0456=_0x76c4[_0x342b41];return _0x5a0456;};'use strict';var _=require(_0x476c('0x0'));var sequelize=require(_0x476c('0x1'));var moment=require(_0x476c('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1c6e5a){var _0x4fe416=['ne'];try{var _0x394f2f=JSON['parse'](_0x1c6e5a);var _0x40ee23=Object[_0x476c('0x3')](_0x394f2f)[0x0];return _0x4fe416[_0x476c('0x4')](_0x40ee23);}catch(_0x16f1a0){return![];}}function getOperatorValue(_0x861888){var _0x41a5f0=JSON[_0x476c('0x5')](_0x861888);var _0x254f4f=Object[_0x476c('0x3')](_0x41a5f0)[0x0];var _0x14f3d9=_0x41a5f0[_0x254f4f];return{['$'+_0x254f4f]:_0x14f3d9};}exports[_0x476c('0x6')]=function(_0x3f52fa){var _0x19253a=null;if(_0x3f52fa){_0x19253a=_0x3f52fa[_0x476c('0x7')](',');}return _0x19253a;};exports['filters']=function(_0x3e3c27,_0x4d3c32){var _0x4dd12e={};if(!_[_0x476c('0x8')](_0x3e3c27)){_[_0x476c('0x9')](_0x3e3c27,function(_0x1f9d70,_0x3347e2){try{if(_0x4d3c32){var _0x1ccc51=_[_0x476c('0xa')](_0x4d3c32,{'name':_0x3347e2})||{};if(hasSequelizeOperator(_0x1f9d70)){_0x4dd12e[_0x3347e2]=getOperatorValue(_0x1f9d70);}else if(_0x1ccc51[_0x476c('0xb')]===_0x476c('0xc')&&_[_0x476c('0xd')](_0x1f9d70)){var _0x30bdfa=JSON[_0x476c('0x5')](_0x1f9d70);var _0x244239={'$gte':moment(moment(_0x30bdfa[_0x476c('0xe')])[_0x476c('0xf')](_0x476c('0x10')))[_0x476c('0x11')]()[_0x476c('0xf')](),'$lte':moment(moment(_0x30bdfa[_0x476c('0x12')])[_0x476c('0xf')](_0x476c('0x10')))[_0x476c('0x11')]()[_0x476c('0x13')](0x1,'s')[_0x476c('0xf')]()};_0x4dd12e[_0x3347e2]=_0x244239;}else if(_0x1ccc51[_0x476c('0x14')]===_0x476c('0x15')){_0x4dd12e[_0x3347e2]=_0x1f9d70;}else{_0x4dd12e[_0x3347e2]=_['isArray'](_0x1f9d70)?_0x1f9d70:JSON[_0x476c('0x5')](_0x1f9d70);}}else{_0x4dd12e[_0x3347e2]=_['isArray'](_0x1f9d70)?_0x1f9d70:JSON['parse'](_0x1f9d70);}}catch(_0x1b7010){_0x4dd12e[_0x3347e2]=_0x1f9d70['split'](',');}});}return _0x4dd12e;};exports[_0x476c('0x16')]=function(_0x1502c8){_0x1502c8=parseInt(_0x1502c8,0xa);if(!_0x1502c8||_0x1502c8<0x0){_0x1502c8=LIMIT_VALUE;}return _0x1502c8;};exports[_0x476c('0x17')]=function(_0x3bfb6e){_0x3bfb6e=parseInt(_0x3bfb6e,0xa);if(!_0x3bfb6e||_0x3bfb6e<0x0){_0x3bfb6e=0x0;}return _0x3bfb6e;};exports[_0x476c('0x18')]=function(_0x9a6a95){var _0x5aec43,_0x328380=null;if(_0x9a6a95){_0x5aec43=_0x9a6a95[_0x476c('0x7')](',');_0x328380=_[_0x476c('0x19')](_0x5aec43,function(_0x52c550){if(_0x52c550[_0x476c('0x1a')]('-')===0x0){return[_0x52c550===_0x476c('0x1b')?sequelize['cast'](sequelize['col']('priority'),_0x476c('0x1c')):_0x52c550[_0x476c('0x1d')](0x1),'DESC'];}else{return[_0x52c550===_0x476c('0x1b')?sequelize[_0x476c('0x1e')](sequelize['col']('priority'),_0x476c('0x1c')):_0x52c550,'ASC'];}});}return _0x328380;};exports[_0x476c('0x1f')]=function(_0x568229,_0x5b84c6){if(_['isEmpty'](_0x568229)){return _0x568229;}if(_[_0x476c('0x20')](_0x568229)){for(var _0x5cd951=0x0;_0x5cd951<_0x568229[_0x476c('0x21')];_0x5cd951+=0x1){_0x568229[_0x5cd951]=this['omit'](_0x568229[_0x5cd951],_0x5b84c6);}return _0x568229;}if(!_['isObject'](_0x568229)){return _0x568229;}if(_['isString'](_0x5b84c6)){_0x5b84c6=[_0x5b84c6];}if(!_[_0x476c('0x20')](_0x5b84c6)){return _0x568229;}for(var _0x247a03=0x0;_0x247a03<_0x5b84c6['length'];_0x247a03+=0x1){_[_0x476c('0x22')](_0x568229,_0x5b84c6[_0x247a03]);}for(var _0x4b83d8 in _0x568229){if(_0x568229[_0x476c('0x23')](_0x4b83d8)){_0x568229[_0x4b83d8]=this[_0x476c('0x1f')](_0x568229[_0x4b83d8],_0x5b84c6);}}return _0x568229;};exports[_0x476c('0x24')]=function(_0x1ab356){return _0x1ab356[_0x476c('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x199b0e){return _0x199b0e[_0x476c('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1fcaf3,_0x2a56c6){var _0x2325f4=[];var _0x61b048=/[ `!@#$%^&*()_\-?~]/;var _0x32178a=_0x2a56c6?_0x476c('0x26'):'{EXPR}';_0x1fcaf3['split'](/[ ,]+/)['forEach'](function(_0x2de5f2){_0x2de5f2=_0x2de5f2[_0x476c('0x27')](/([^:]")"+/g,'$1');_0x2de5f2='+'+_0x2de5f2+'*';var _0x2b9197=_0x2de5f2[_0x476c('0x25')](_0x61b048);if(_0x2b9197){_0x2de5f2='\x22'+_0x2de5f2+'\x22';}_0x2325f4['push'](_0x2de5f2);});_0x32178a=_0x32178a[_0x476c('0x27')]('{EXPR}',_0x2325f4['join']('\x20'));return _0x32178a;};exports[_0x476c('0x28')]=function(_0x28b128,_0x57ce48,_0x1a1aae){var _0x18b740={},_0x47af45={};if(_0x57ce48['query'][_0x476c('0x29')]){_0x57ce48[_0x476c('0x2a')]['id']=_0x57ce48[_0x476c('0x2a')][_0x476c('0x29')];delete _0x57ce48[_0x476c('0x2a')][_0x476c('0x29')];}_0x18b740[_0x476c('0x2b')]=_[_0x476c('0x19')](_0x28b128,_0x476c('0x14'));_0x18b740['query']=_[_0x476c('0x3')](_0x57ce48['query']);_0x18b740[_0x476c('0x2c')]=_['intersection'](_0x18b740[_0x476c('0x2b')],_0x18b740[_0x476c('0x2a')]);_0x47af45['attributes']=_[_0x476c('0x2d')](_0x18b740[_0x476c('0x2b')],this['fields'](_0x57ce48[_0x476c('0x2a')][_0x476c('0x6')]));_0x47af45[_0x476c('0x2e')]=_0x47af45[_0x476c('0x2e')][_0x476c('0x21')]?_0x47af45[_0x476c('0x2e')]:_0x18b740[_0x476c('0x2b')];if(!_0x57ce48[_0x476c('0x2a')][_0x476c('0x23')]('nolimit')){_0x47af45[_0x476c('0x16')]=this[_0x476c('0x16')](_0x57ce48[_0x476c('0x2a')][_0x476c('0x16')]);_0x47af45[_0x476c('0x17')]=this[_0x476c('0x17')](_0x57ce48[_0x476c('0x2a')][_0x476c('0x17')]);}_0x47af45[_0x476c('0x2f')]=this[_0x476c('0x18')](_0x57ce48[_0x476c('0x2a')][_0x476c('0x18')]);_0x47af45['where']=this[_0x476c('0x2c')](_[_0x476c('0x30')](_0x57ce48[_0x476c('0x2a')],_0x18b740[_0x476c('0x2c')]),_0x28b128);if(_0x57ce48[_0x476c('0x2a')][_0x476c('0x31')]){var _0x5091eb=_0x28b128;var _0x20316c=_0x57ce48[_0x476c('0x2a')][_0x476c('0x31')];if(typeof _0x20316c==='object'){_0x5091eb=_['filter'](_0x28b128,function(_0x4db369){return _[_0x476c('0x4')](_0x20316c['columns'],_0x4db369['name']);});_0x20316c=_0x20316c[_0x476c('0x32')];}_0x47af45['where']=_[_0x476c('0x33')](_0x47af45[_0x476c('0x34')],{'$or':_[_0x476c('0x19')](_0x5091eb,function(_0x59b55){if(_0x59b55[_0x476c('0xb')]!=='VIRTUAL'){if(_0x1a1aae){return sequelize['where'](sequelize['fn'](_0x476c('0x35'),sequelize[_0x476c('0x36')](_0x59b55[_0x476c('0x14')])),{'$like':sequelize['fn'](_0x476c('0x35'),'%'+_0x57ce48[_0x476c('0x2a')]['filter']+'%')});}else{var _0x4e615b={};_0x4e615b[_0x59b55[_0x476c('0x14')]]={'$like':'%'+_0x57ce48[_0x476c('0x2a')][_0x476c('0x31')]+'%'};return _0x4e615b;}}})});}_0x47af45=_[_0x476c('0x33')]({},_0x47af45,_0x57ce48[_0x476c('0x37')]);return _0x47af45;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 6da5dcc..940bcd1 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 _0x253a=['whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','http','client','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','findOne','all','flatten','map','value','getAgentIdsByQueues','getAgentIdsByStatus','resolve','includes','findAll','name','fullname','pauseType','find','globalStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','chatPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x253a,0x6c));var _0xa253=function(_0x542db6,_0x53ac3e){_0x542db6=_0x542db6-0x0;var _0x50ee9d=_0x253a[_0x542db6];return _0x50ee9d;};'use strict';var _=require(_0xa253('0x0'));var jayson=require(_0xa253('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0xa253('0x2')]({'port':0x232a});var routingClient=jayson[_0xa253('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x47ae87,_0x140838){var _0x4a52e1=[_0x47ae87['chatPause'],_0x47ae87['faxPause'],_0x47ae87[_0xa253('0x4')],_0x47ae87[_0xa253('0x5')],_0x47ae87[_0xa253('0x6')],_0x47ae87[_0xa253('0x7')],_0x47ae87[_0xa253('0x8')]];if(!_0x140838)return _[_0xa253('0x9')](_0x4a52e1);var _0x52e30d=_[_0xa253('0xa')](_0x4a52e1);return _0x52e30d[_0xa253('0xb')]>0x0&&_0x52e30d[_0xa253('0xb')]<_0x4a52e1['length']?!![]:![];}function isIdle(_0x2ff6d3){return _0x2ff6d3==='idle'||_0x2ff6d3===_0xa253('0xc')||_0x2ff6d3===_0xa253('0xd')||_0x2ff6d3===_0xa253('0xe')||_[_0xa253('0xf')](_0x2ff6d3);}function isAgentIdle(_0x4e6297){if(_0x4e6297[_0xa253('0x10')]!==_0xa253('0x11')&&_0x4e6297[_0xa253('0x7')]){_0x4e6297['voiceStatus']=_0xa253('0x12');return![];}return _[_0xa253('0x9')]([_0x4e6297[_0xa253('0x13')],_0x4e6297[_0xa253('0x14')],_0x4e6297[_0xa253('0x15')],_0x4e6297[_0xa253('0x16')],_0x4e6297[_0xa253('0x17')],_0x4e6297[_0xa253('0x10')],_0x4e6297['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xa253('0x18')](_0xa253('0x19'),{})[_0xa253('0x1a')](function(_0x33a0b1){if(_0x33a0b1[_0xa253('0x1b')]){throw new Error(_0xa253('0x1c'));}var _0x54670f=_0x33a0b1['result'];return routingClient['request'](_0xa253('0x19'),{})['then'](function(_0x1a374c){if(_0x1a374c[_0xa253('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x3bf191=_0x1a374c['result'];return _[_0xa253('0x1d')]({},_0x54670f,_0x3bf191);});})[_0xa253('0x1e')](function(_0x11e31c){throw _0x11e31c;});}exports[_0xa253('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x304eee){var _0x2f9d68=_0xa253('0xc');if(isAgentPaused(_0x304eee))_0x2f9d68='pause';else if(isAgentPaused(_0x304eee,!![]))_0x2f9d68=_0xa253('0x20');else if(isAgentIdle(_0x304eee))_0x2f9d68='idle';else _0x2f9d68=_0xa253('0x21');return _0x2f9d68;}exports[_0xa253('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x55a9e3,_0x326af6){var _0x4992fd=_['isArray'](_0x55a9e3)?_0x55a9e3:[_0x55a9e3];var _0x5348b3=_[_0xa253('0x23')](_0x326af6)+_0xa253('0x24');var _0x2957ad=_['map'](_0x4992fd,function(_0x1b6b63){return db[_0x5348b3][_0xa253('0x25')]({'where':{'id':_0x1b6b63}})[_0xa253('0x1a')](function(_0x1320ea){if(!_0x1320ea)return[];return _0x1320ea['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xa253('0x26')](_0x2957ad)[_0xa253('0x1a')](function(_0x2cafa2){var _0x2724b7=_(_0x2cafa2)[_0xa253('0x27')]()[_0xa253('0x28')]('id')['uniq']()[_0xa253('0x29')]();return _0x2724b7;});}exports[_0xa253('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1c632c,_0x4e293f,_0x13d4db){try{if(_0x4e293f[_0xa253('0xb')]>0x0){_0x1c632c=_0x1c632c[_0xa253('0xa')](function(_0x44c749){return _0x4e293f['includes'](_0x44c749['id']);});}var _0x458d52=_0x1c632c[_0xa253('0xa')](function(_0x4eee75){var _0x3126d1=_0xa253('0x21');if(isAgentIdle(_0x4eee75)){_0x3126d1=_0xa253('0x11');}return _0x3126d1===_0x13d4db;});return _[_0xa253('0x28')](_0x458d52,'id');}catch(_0xafb815){throw _0xafb815;}}exports[_0xa253('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x44afac,_0x321c3e,_0x58c215){return Promise[_0xa253('0x2c')]()['then'](function(){if(_0x321c3e[_0xa253('0xb')]>0x0){_0x44afac=_0x44afac[_0xa253('0xa')](function(_0x4df01e){return _0x321c3e[_0xa253('0x2d')](_0x4df01e['id']);});}return _0x44afac;})[_0xa253('0x1a')](function(){return db['User'][_0xa253('0x2e')]({'attributes':['id',_0xa253('0x2f'),_0xa253('0x30'),'chatPause','faxPause',_0xa253('0x4'),_0xa253('0x5'),_0xa253('0x6'),'voicePause','whatsappPause',_0xa253('0x31')],'where':{'id':{'$in':_['map'](_0x44afac,'id')}},'raw':!![]});})[_0xa253('0x1a')](function(_0x2f6929){return _0x2f6929['map'](function(_0x2b83af){var _0x151c36=_[_0xa253('0x32')](_0x44afac,['id',_0x2b83af['id']]);var _0x144aad=filterAgentAttributes(_0x151c36);_[_0xa253('0x1d')](_0x2b83af,_0x144aad);_0x2b83af[_0xa253('0x33')]=getAgentStatus(_0x2b83af);return _0x2b83af;});})['then'](function(_0x562af7){var _0x574db6=sortAgentsByStatus(_0x562af7,_0x58c215);return _[_0xa253('0x28')](_0x574db6,'id');})['catch'](function(_0x2da82a){throw _0x2da82a;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2ed525){var _0x138470={'fields':[],'order':null};var _0x26cc38=_0x2ed525[_0xa253('0x34')](',');_0x138470[_0xa253('0x35')]=_[_0xa253('0xa')](_0x26cc38,function(_0x8a84d9){if(!_0x8a84d9[_0xa253('0x2d')]('globalStatus')){return!![];}_0x138470[_0xa253('0x36')]=_[_0xa253('0x37')](_0x8a84d9,'-')?_0xa253('0x38'):_0xa253('0x39');return![];});return _0x138470;}exports[_0xa253('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x248954){if(_0x248954[_0xa253('0x2d')](_0xa253('0x30'))&&!_0x248954[_0xa253('0x2d')](_0xa253('0x3b'))){var _0x1f285e=_0x248954[_0xa253('0x3c')](0x0,_0x248954[_0xa253('0x3d')](_0xa253('0x30')));_0x248954+=','+_0x1f285e+_0xa253('0x3b');}return _0x248954;}exports[_0xa253('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x46fea1,_0x259b9c){var _0x1e657c=_0x46fea1[_0xa253('0x3f')](function(_0x4d3905,_0x365459){if(_0x4d3905[_0xa253('0x33')]===_0x365459[_0xa253('0x33')]){if(_0x4d3905[_0xa253('0x33')]===_0xa253('0x12')){if(_0x259b9c===_0xa253('0x38')){return(_0x4d3905['pauseType']||'')<(_0x365459[_0xa253('0x31')]||'')||_0x4d3905[_0xa253('0x30')]['toLowerCase']()>_0x365459[_0xa253('0x30')][_0xa253('0x40')]()?0x1:-0x1;}else{return(_0x4d3905[_0xa253('0x31')]||'')<(_0x365459['pauseType']||'')||_0x4d3905[_0xa253('0x30')][_0xa253('0x40')]()>_0x365459[_0xa253('0x30')][_0xa253('0x40')]()?-0x1:0x1;}}else{if(_0x259b9c==='DESC'){return _0x4d3905['fullname'][_0xa253('0x40')]()<_0x365459[_0xa253('0x30')]['toLowerCase']()?0x1:-0x1;}else{return _0x4d3905[_0xa253('0x30')]['toLowerCase']()<_0x365459[_0xa253('0x30')][_0xa253('0x40')]()?-0x1:0x1;}}}else{if(_0x259b9c===_0xa253('0x38')){return _0x4d3905[_0xa253('0x33')]<_0x365459[_0xa253('0x33')]?0x1:-0x1;}else{return _0x4d3905[_0xa253('0x33')]<_0x365459[_0xa253('0x33')]?-0x1:0x1;}}});return _0x1e657c;}exports[_0xa253('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x62e3aa){var _0x5b4aed=['userpic',_0xa253('0x42'),_0xa253('0x43'),'lastPauseAt',_0xa253('0x31'),_0xa253('0x44'),_0xa253('0x3b'),_0xa253('0x45'),_0xa253('0x46'),_0xa253('0x5'),_0xa253('0x4'),_0xa253('0x6'),_0xa253('0x8'),'faxPause',_0xa253('0x7'),_0xa253('0x47'),_0xa253('0x48'),'mailCapacity',_0xa253('0x49'),_0xa253('0x4a'),'faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity',_0xa253('0x4b'),_0xa253('0x4c'),'whatsappCurrentCapacity',_0xa253('0x4d'),'chatStatus',_0xa253('0x16'),'mailStatus',_0xa253('0x17'),_0xa253('0x4e'),_0xa253('0x14'),_0xa253('0x10'),_0xa253('0x4f'),_0xa253('0x50'),_0xa253('0x51'),_0xa253('0x52'),_0xa253('0x53'),_0xa253('0x54'),_0xa253('0x55'),'queue',_0xa253('0x56'),_0xa253('0x57'),'phoneBarEnableScreenRecordingByAgent',_0xa253('0x58'),_0xa253('0x59')];var _0x5e41b4=['chatPause','openchannelPause','mailPause',_0xa253('0x6'),_0xa253('0x8'),'faxPause',_0xa253('0x7'),_0xa253('0x42')];var _0x2c4554=_(_0x62e3aa)[_0xa253('0x5a')](_0x5e41b4)[_0xa253('0x5b')](_0x5b4aed)[_0xa253('0x29')]();return _0x2c4554;}exports[_0xa253('0x5c')]=filterAgentAttributes; \ No newline at end of file +var _0xd05b=['../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','length','idle','unknown','unavailable','ringing','voiceStatus','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','result','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','value','filter','includes','busy','resolve','findAll','name','fullname','whatsappPause','find','getSortedAgentsIdsByStatus','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','pause','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','filterAgentAttributes','lodash'];(function(_0x4e8d1f,_0x3d69f9){var _0x1badc8=function(_0x47a205){while(--_0x47a205){_0x4e8d1f['push'](_0x4e8d1f['shift']());}};_0x1badc8(++_0x3d69f9);}(_0xd05b,0x1d5));var _0xbd05=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xd05b[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xbd05('0x0'));var jayson=require('jayson/promise');var db=require(_0xbd05('0x1'))['db'];var amiClient=jayson[_0xbd05('0x2')][_0xbd05('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0xbd05('0x3')]({'port':0x232c});function isAgentPaused(_0x1bce54,_0x4c44d5){var _0x25b809=[_0x1bce54[_0xbd05('0x4')],_0x1bce54[_0xbd05('0x5')],_0x1bce54[_0xbd05('0x6')],_0x1bce54[_0xbd05('0x7')],_0x1bce54[_0xbd05('0x8')],_0x1bce54[_0xbd05('0x9')],_0x1bce54['whatsappPause']];if(!_0x4c44d5)return _[_0xbd05('0xa')](_0x25b809);var _0x5c2d61=_['filter'](_0x25b809);return _0x5c2d61[_0xbd05('0xb')]>0x0&&_0x5c2d61['length']<_0x25b809[_0xbd05('0xb')]?!![]:![];}function isIdle(_0x1824c6){return _0x1824c6===_0xbd05('0xc')||_0x1824c6===_0xbd05('0xd')||_0x1824c6===_0xbd05('0xe')||_0x1824c6===_0xbd05('0xf')||_['isNil'](_0x1824c6);}function isAgentIdle(_0x4d95b2){if(_0x4d95b2['voiceStatus']!==_0xbd05('0xc')&&_0x4d95b2[_0xbd05('0x9')]){_0x4d95b2[_0xbd05('0x10')]='pause';return![];}return _[_0xbd05('0xa')]([_0x4d95b2[_0xbd05('0x11')],_0x4d95b2[_0xbd05('0x12')],_0x4d95b2['mailStatus'],_0x4d95b2[_0xbd05('0x13')],_0x4d95b2[_0xbd05('0x14')],_0x4d95b2['voiceStatus'],_0x4d95b2[_0xbd05('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xbd05('0x16')](_0xbd05('0x17'),{})['then'](function(_0x4b1b4c){if(_0x4b1b4c['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x43571f=_0x4b1b4c[_0xbd05('0x18')];return routingClient[_0xbd05('0x16')]('Agents',{})[_0xbd05('0x19')](function(_0x17bfcc){if(_0x17bfcc[_0xbd05('0x1a')]){throw new Error(_0xbd05('0x1b'));}var _0x5dfa1f=_0x17bfcc[_0xbd05('0x18')];return _[_0xbd05('0x1c')]({},_0x43571f,_0x5dfa1f);});})[_0xbd05('0x1d')](function(_0x482f66){throw _0x482f66;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x56f36e){var _0x3780b0=_0xbd05('0xd');if(isAgentPaused(_0x56f36e))_0x3780b0='pause';else if(isAgentPaused(_0x56f36e,!![]))_0x3780b0=_0xbd05('0x1e');else if(isAgentIdle(_0x56f36e))_0x3780b0=_0xbd05('0xc');else _0x3780b0='busy';return _0x3780b0;}exports[_0xbd05('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x2241fe,_0x119e5a){var _0x132ebf=_[_0xbd05('0x20')](_0x2241fe)?_0x2241fe:[_0x2241fe];var _0x2fac47=_[_0xbd05('0x21')](_0x119e5a)+_0xbd05('0x22');var _0x4b5709=_[_0xbd05('0x23')](_0x132ebf,function(_0x256455){return db[_0x2fac47][_0xbd05('0x24')]({'where':{'id':_0x256455}})[_0xbd05('0x19')](function(_0x5d6772){if(!_0x5d6772)return[];return _0x5d6772['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xbd05('0x25')](_0x4b5709)[_0xbd05('0x19')](function(_0x41eb2e){var _0x17496b=_(_0x41eb2e)[_0xbd05('0x26')]()[_0xbd05('0x23')]('id')['uniq']()[_0xbd05('0x27')]();return _0x17496b;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1414d8,_0x5c09fa,_0x1fbfa9){try{if(_0x5c09fa['length']>0x0){_0x1414d8=_0x1414d8[_0xbd05('0x28')](function(_0x544ea2){return _0x5c09fa[_0xbd05('0x29')](_0x544ea2['id']);});}var _0xf503ed=_0x1414d8[_0xbd05('0x28')](function(_0x209d4c){var _0x3cb22d=_0xbd05('0x2a');if(isAgentIdle(_0x209d4c)){_0x3cb22d='idle';}return _0x3cb22d===_0x1fbfa9;});return _[_0xbd05('0x23')](_0xf503ed,'id');}catch(_0xb6a6e2){throw _0xb6a6e2;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x599dba,_0x2bbdcd,_0x3b570f){return Promise[_0xbd05('0x2b')]()['then'](function(){if(_0x2bbdcd['length']>0x0){_0x599dba=_0x599dba['filter'](function(_0x4d57b9){return _0x2bbdcd['includes'](_0x4d57b9['id']);});}return _0x599dba;})[_0xbd05('0x19')](function(){return db['User'][_0xbd05('0x2c')]({'attributes':['id',_0xbd05('0x2d'),_0xbd05('0x2e'),_0xbd05('0x4'),_0xbd05('0x5'),_0xbd05('0x6'),_0xbd05('0x7'),'smsPause',_0xbd05('0x9'),_0xbd05('0x2f'),'pauseType'],'where':{'id':{'$in':_[_0xbd05('0x23')](_0x599dba,'id')}},'raw':!![]});})[_0xbd05('0x19')](function(_0x171f9b){return _0x171f9b['map'](function(_0x4fc621){var _0x34654c=_[_0xbd05('0x30')](_0x599dba,['id',_0x4fc621['id']]);var _0x48aaba=filterAgentAttributes(_0x34654c);_[_0xbd05('0x1c')](_0x4fc621,_0x48aaba);_0x4fc621['globalStatus']=getAgentStatus(_0x4fc621);return _0x4fc621;});})[_0xbd05('0x19')](function(_0x1de7bb){var _0x3c1fa7=sortAgentsByStatus(_0x1de7bb,_0x3b570f);return _['map'](_0x3c1fa7,'id');})[_0xbd05('0x1d')](function(_0x77b6af){throw _0x77b6af;});}exports[_0xbd05('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xc99dd1){var _0x396c1e={'fields':[],'order':null};var _0x10651b=_0xc99dd1['split'](',');_0x396c1e[_0xbd05('0x32')]=_[_0xbd05('0x28')](_0x10651b,function(_0x5a3304){if(!_0x5a3304['includes'](_0xbd05('0x33'))){return!![];}_0x396c1e[_0xbd05('0x34')]=_[_0xbd05('0x35')](_0x5a3304,'-')?_0xbd05('0x36'):_0xbd05('0x37');return![];});return _0x396c1e;}exports[_0xbd05('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x11e840){if(_0x11e840[_0xbd05('0x29')](_0xbd05('0x2e'))&&!_0x11e840[_0xbd05('0x29')](_0xbd05('0x39'))){var _0x8b81c0=_0x11e840[_0xbd05('0x3a')](0x0,_0x11e840[_0xbd05('0x3b')]('fullname'));_0x11e840+=','+_0x8b81c0+'internal';}return _0x11e840;}exports[_0xbd05('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x264dac,_0x46b6d3){var _0x46514c=_0x264dac[_0xbd05('0x3d')](function(_0x4bc32f,_0x18d8d1){if(_0x4bc32f[_0xbd05('0x33')]===_0x18d8d1[_0xbd05('0x33')]){if(_0x4bc32f['globalStatus']===_0xbd05('0x3e')){if(_0x46b6d3===_0xbd05('0x36')){return(_0x4bc32f[_0xbd05('0x3f')]||'')<(_0x18d8d1[_0xbd05('0x3f')]||'')||_0x4bc32f[_0xbd05('0x2e')][_0xbd05('0x40')]()>_0x18d8d1[_0xbd05('0x2e')][_0xbd05('0x40')]()?0x1:-0x1;}else{return(_0x4bc32f[_0xbd05('0x3f')]||'')<(_0x18d8d1[_0xbd05('0x3f')]||'')||_0x4bc32f['fullname']['toLowerCase']()>_0x18d8d1[_0xbd05('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x46b6d3==='DESC'){return _0x4bc32f[_0xbd05('0x2e')][_0xbd05('0x40')]()<_0x18d8d1[_0xbd05('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x4bc32f[_0xbd05('0x2e')][_0xbd05('0x40')]()<_0x18d8d1[_0xbd05('0x2e')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x46b6d3==='DESC'){return _0x4bc32f[_0xbd05('0x33')]<_0x18d8d1['globalStatus']?0x1:-0x1;}else{return _0x4bc32f['globalStatus']<_0x18d8d1['globalStatus']?-0x1:0x1;}}});return _0x46514c;}exports[_0xbd05('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x341e2f){var _0x2945e9=[_0xbd05('0x42'),'online',_0xbd05('0x43'),_0xbd05('0x44'),'pauseType',_0xbd05('0x44'),_0xbd05('0x39'),_0xbd05('0x45'),_0xbd05('0x4'),_0xbd05('0x7'),_0xbd05('0x6'),'smsPause',_0xbd05('0x2f'),'faxPause','voicePause',_0xbd05('0x46'),'openchannelCapacity',_0xbd05('0x47'),_0xbd05('0x48'),'whatsappCapacity',_0xbd05('0x49'),'chatCurrentCapacity',_0xbd05('0x4a'),_0xbd05('0x4b'),_0xbd05('0x4c'),'whatsappCurrentCapacity',_0xbd05('0x4d'),_0xbd05('0x11'),'openchannelStatus',_0xbd05('0x4e'),'smsStatus',_0xbd05('0x15'),'faxStatus',_0xbd05('0x10'),_0xbd05('0x4f'),_0xbd05('0x50'),_0xbd05('0x51'),_0xbd05('0x52'),_0xbd05('0x53'),_0xbd05('0x54'),'voiceStatusTime','queue',_0xbd05('0x55'),_0xbd05('0x56'),_0xbd05('0x57'),_0xbd05('0x58'),_0xbd05('0x59')];var _0x328db0=[_0xbd05('0x4'),_0xbd05('0x7'),_0xbd05('0x6'),'smsPause',_0xbd05('0x2f'),'faxPause',_0xbd05('0x9'),_0xbd05('0x5a')];var _0x530eba=_(_0x341e2f)[_0xbd05('0x5b')](_0x328db0)[_0xbd05('0x5c')](_0x2945e9)['value']();return _0x530eba;}exports[_0xbd05('0x5d')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index be60e1a..7d3d3f5 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 _0x0fd2=['initializeQueues','lodash','jayson/promise','util','client','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','ringing','ringInUse','talking','unavailable','unknown','pTalking','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','voice','concat','outbound','map','get','available','originated','merge','pick'];(function(_0x460b4f,_0x33e261){var _0x4dd29d=function(_0x5d4124){while(--_0x5d4124){_0x460b4f['push'](_0x460b4f['shift']());}};_0x4dd29d(++_0x33e261);}(_0x0fd2,0x15f));var _0x20fd=function(_0x3aa308,_0x3fead2){_0x3aa308=_0x3aa308-0x0;var _0x7abe0a=_0x0fd2[_0x3aa308];return _0x7abe0a;};'use strict';var _=require(_0x20fd('0x0'));var jayson=require(_0x20fd('0x1'));var util=require(_0x20fd('0x2'));var amiClient=jayson[_0x20fd('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x20fd('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x20fd('0x4'),_0x20fd('0x5'),_0x20fd('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x20fd('0x7'),_0x20fd('0x8'),_0x20fd('0x9'),_0x20fd('0xa'),_0x20fd('0xb'),'onHold',_0x20fd('0xc'),_0x20fd('0xd'),_0x20fd('0xe'),_0x20fd('0xf'),_0x20fd('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x20fd('0x11'),'originated','message',_0x20fd('0x12'),_0x20fd('0x13'),_0x20fd('0x14'),_0x20fd('0x15'),_0x20fd('0x16'),_0x20fd('0x17'),_0x20fd('0x18'),_0x20fd('0x19'),'erlangAbandonmentRate',_0x20fd('0x1a'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x20fd('0x1b'),_0x20fd('0x1c'),'predictiveIntervalTotalCalls',_0x20fd('0x1d'),'predictiveIntervalDroppedCallsTimeout',_0x20fd('0x1e'),'predictiveIntervalAvgHoldtime',_0x20fd('0x1f')];function getRealtimeQueues(_0x17c790,_0x485ad8){var _0xfa116a=_0x485ad8==='voice'?amiClient:routingClient;return _0xfa116a[_0x20fd('0x20')](_[_0x20fd('0x21')](_0x485ad8)+_0x20fd('0x22'),_0x17c790)['then'](function(_0xc272b9){if(_0xc272b9[_0x20fd('0x23')])throw new Error(util[_0x20fd('0x24')](_0x20fd('0x25'),_0x485ad8));return _0xc272b9[_0x20fd('0x26')];})[_0x20fd('0x27')](function(_0xb55d54){throw _0xb55d54;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x59685b,_0x3847c5,_0x595a06,_0x1775d5){var _0x215a7a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x595a06===_0x20fd('0x28')){if(_0x1775d5==='inbound'){_0x215a7a=_0x215a7a[_0x20fd('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1775d5===_0x20fd('0x2a')){_0x215a7a=_0x215a7a[_0x20fd('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x59685b[_0x20fd('0x2b')](function(_0x50b027){var _0x13bf5c=_0x50b027[_0x20fd('0x2c')]({'plain':!![]});_0x13bf5c[_0x20fd('0x5')]=0x0;_0x13bf5c['loggedInDb']=0x0;_0x13bf5c[_0x20fd('0x4')]=0x0;_0x13bf5c[_0x20fd('0x2d')]=0x0;_0x13bf5c[_0x20fd('0x6')]=0x0;if(_0x595a06==='voice'){_0x13bf5c[_0x20fd('0xe')]=0x0;_0x13bf5c[_0x20fd('0x7')]=0x0;if(_0x1775d5===_0x20fd('0x2a')){_0x13bf5c[_0x20fd('0x11')]=0x0;_0x13bf5c[_0x20fd('0x2e')]=0x0;}}var _0x46742a=_['find'](_0x3847c5,['id',_0x13bf5c['id']]);if(_0x46742a){_[_0x20fd('0x2f')](_0x13bf5c,_[_0x20fd('0x30')](_0x46742a,_0x215a7a));}return _0x13bf5c;});}exports[_0x20fd('0x31')]=initializeQueues; \ No newline at end of file +var _0xff88=['predictiveIntervalAvgTalktime','voice','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','inbound','concat','outbound','get','loggedIn','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit'];(function(_0xbea9b3,_0x158fea){var _0x5083e2=function(_0x4c88fe){while(--_0x4c88fe){_0xbea9b3['push'](_0xbea9b3['shift']());}};_0x5083e2(++_0x158fea);}(_0xff88,0x1d1));var _0x8ff8=function(_0x5c0ad6,_0x100bab){_0x5c0ad6=_0x5c0ad6-0x0;var _0x31f85e=_0xff88[_0x5c0ad6];return _0x31f85e;};'use strict';var _=require(_0x8ff8('0x0'));var jayson=require(_0x8ff8('0x1'));var util=require(_0x8ff8('0x2'));var amiClient=jayson[_0x8ff8('0x3')][_0x8ff8('0x4')]({'port':0x232a});var routingClient=jayson[_0x8ff8('0x3')][_0x8ff8('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8ff8('0x5'),'loggedIn',_0x8ff8('0x6'),_0x8ff8('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x8ff8('0x8'),_0x8ff8('0x9'),_0x8ff8('0xa'),_0x8ff8('0xb'),'notInUse',_0x8ff8('0xc'),_0x8ff8('0xd'),_0x8ff8('0xe'),_0x8ff8('0xf'),_0x8ff8('0x10'),_0x8ff8('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8ff8('0x12'),_0x8ff8('0x13'),_0x8ff8('0x14'),'statusMessage',_0x8ff8('0x15'),_0x8ff8('0x16'),'Trunk',_0x8ff8('0x17'),_0x8ff8('0x18'),_0x8ff8('0x19'),_0x8ff8('0x1a'),_0x8ff8('0x1b'),_0x8ff8('0x1c'),'dialPredictiveInterval',_0x8ff8('0x1d'),_0x8ff8('0x1e'),_0x8ff8('0x1f'),_0x8ff8('0x20'),'predictiveIntervalAnsweredCalls',_0x8ff8('0x21'),_0x8ff8('0x22'),'predictiveIntervalAvgHoldtime',_0x8ff8('0x23')];function getRealtimeQueues(_0x28de29,_0x3ae73b){var _0xec0bd8=_0x3ae73b===_0x8ff8('0x24')?amiClient:routingClient;return _0xec0bd8[_0x8ff8('0x25')](_['startCase'](_0x3ae73b)+'Queues',_0x28de29)['then'](function(_0x2a0ca8){if(_0x2a0ca8['error'])throw new Error(util[_0x8ff8('0x26')](_0x8ff8('0x27'),_0x3ae73b));return _0x2a0ca8[_0x8ff8('0x28')];})['catch'](function(_0x109829){throw _0x109829;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0xc0a0b9,_0x1472ff,_0x1a3d37,_0xbddcff){var _0x2da86a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1a3d37===_0x8ff8('0x24')){if(_0xbddcff===_0x8ff8('0x29')){_0x2da86a=_0x2da86a[_0x8ff8('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0xbddcff===_0x8ff8('0x2b')){_0x2da86a=_0x2da86a[_0x8ff8('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xc0a0b9['map'](function(_0x1c7c86){var _0x422c13=_0x1c7c86[_0x8ff8('0x2c')]({'plain':!![]});_0x422c13[_0x8ff8('0x6')]=0x0;_0x422c13['loggedInDb']=0x0;_0x422c13[_0x8ff8('0x2d')]=0x0;_0x422c13[_0x8ff8('0x5')]=0x0;_0x422c13[_0x8ff8('0x7')]=0x0;if(_0x1a3d37===_0x8ff8('0x24')){_0x422c13[_0x8ff8('0xf')]=0x0;_0x422c13[_0x8ff8('0x8')]=0x0;if(_0xbddcff==='outbound'){_0x422c13[_0x8ff8('0x12')]=0x0;_0x422c13[_0x8ff8('0x13')]=0x0;}}var _0x2b3993=_[_0x8ff8('0x2e')](_0x1472ff,['id',_0x422c13['id']]);if(_0x2b3993){_[_0x8ff8('0x2f')](_0x422c13,_[_0x8ff8('0x30')](_0x2b3993,_0x2da86a));}return _0x422c13;});}exports[_0x8ff8('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index bfa3bca..1fc5e5d 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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(_0x40e74c,_0x1883a2){var _0x3a8c6b=function(_0x1a4ae4){while(--_0x1a4ae4){_0x40e74c['push'](_0x40e74c['shift']());}};_0x3a8c6b(++_0x1883a2);}(_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 +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(_0x4db537,_0x53a37b){var _0x25d062=function(_0x5954b1){while(--_0x5954b1){_0x4db537['push'](_0x4db537['shift']());}};_0x25d062(++_0x53a37b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 f8ac34a..6c2e9eb 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 _0x4e97=['replace','macAddress','md5','digest','hex','substring','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','IPv4','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x4e97,0x186));var _0x74e9=function(_0x36489a,_0x226c81){_0x36489a=_0x36489a-0x0;var _0x396094=_0x4e97[_0x36489a];return _0x396094;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x74e9('0x0'));var exec=require(_0x74e9('0x1'))['execSync'];var config=require(_0x74e9('0x2'));function getInterfaces(){var _0x2d2ef0=[];var _0x4984e4=os[_0x74e9('0x3')]();var _0x3b2555=_[_0x74e9('0x4')](_[_0x74e9('0x5')](_0x4984e4));for(var _0x1f39ef=0x0;_0x1f39ef<_0x3b2555[_0x74e9('0x6')];_0x1f39ef++){var _0x5b270b=_0x4984e4[_0x3b2555[_0x1f39ef]]['filter'](function(_0x2641a3){return _0x2641a3['family']===_0x74e9('0x7')&&_0x2641a3['internal']===![];});_0x2d2ef0=_0x2d2ef0[_0x74e9('0x8')](_0x5b270b);}return _0x2d2ef0;}function getFirstInterface(){var _0x4b90a8=_[_0x74e9('0x9')](getInterfaces());return{'macAddress':_0x4b90a8&&_0x4b90a8['mac']?_0x4b90a8['mac']:_0x74e9('0xa'),'ipAddress':_0x4b90a8&&_0x4b90a8[_0x74e9('0xb')]?_0x4b90a8[_0x74e9('0xb')]:_0x74e9('0xc')};}exports[_0x74e9('0xd')]=getFirstInterface;function getCPUhash(){var _0x2df5bc=_[_0x74e9('0x4')](os[_0x74e9('0xe')]()[_0x74e9('0xf')](function(_0x5793fd){return _0x5793fd[_0x74e9('0x10')];}))[_0x74e9('0x11')](':');return crypto[_0x74e9('0x12')]('md5')[_0x74e9('0x13')](_0x2df5bc)['digest']('hex');}exports[_0x74e9('0x14')]=function(){var _0x51d39b=os[_0x74e9('0x15')]();var _0x5f0222=/[0-9a-f-]{36}/;if(config[_0x74e9('0x16')]&&_0x5f0222[_0x74e9('0x17')](config[_0x74e9('0x16')])){return config[_0x74e9('0x16')];}else if(_0x51d39b==='win32'){return exec(_0x74e9('0x18'),{'encoding':_0x74e9('0x19')})[_0x74e9('0x1a')]('\x0d\x0a','');}else{var _0x3f0cae=getFirstInterface();var _0x28a1c0=getCPUhash();var _0x4174ca=_0x28a1c0+'|'+os['hostname']()+'|'+_0x3f0cae[_0x74e9('0x1b')]+'|'+_0x3f0cae['ipAddress'];var _0x25b1b3=crypto['createHash'](_0x74e9('0x1c'))[_0x74e9('0x13')](_0x4174ca)[_0x74e9('0x1d')](_0x74e9('0x1e'));return _0x25b1b3[_0x74e9('0x1f')](0x0,0x8)+'-'+_0x25b1b3['substring'](0x8,0xc)+'-'+_0x25b1b3[_0x74e9('0x1f')](0xc,0x10)+'-'+_0x25b1b3['substring'](0x10,0x14)+'-'+_0x25b1b3[_0x74e9('0x1f')](0x14);}}; \ No newline at end of file +var _0xe655=['win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','substring','lodash','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest','hex','platform','licenseToken','test'];(function(_0x3b33a7,_0x66840d){var _0xa6e75e=function(_0x193f67){while(--_0x193f67){_0x3b33a7['push'](_0x3b33a7['shift']());}};_0xa6e75e(++_0x66840d);}(_0xe655,0xf4));var _0x5e65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe655[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5e65('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x5e65('0x1'));var exec=require('child_process')[_0x5e65('0x2')];var config=require(_0x5e65('0x3'));function getInterfaces(){var _0x2f42f9=[];var _0x32c897=os[_0x5e65('0x4')]();var _0x597b0c=_[_0x5e65('0x5')](_[_0x5e65('0x6')](_0x32c897));for(var _0xdda353=0x0;_0xdda353<_0x597b0c['length'];_0xdda353++){var _0x2b778f=_0x32c897[_0x597b0c[_0xdda353]][_0x5e65('0x7')](function(_0x1356dd){return _0x1356dd[_0x5e65('0x8')]===_0x5e65('0x9')&&_0x1356dd[_0x5e65('0xa')]===![];});_0x2f42f9=_0x2f42f9[_0x5e65('0xb')](_0x2b778f);}return _0x2f42f9;}function getFirstInterface(){var _0x35c584=_[_0x5e65('0xc')](getInterfaces());return{'macAddress':_0x35c584&&_0x35c584[_0x5e65('0xd')]?_0x35c584[_0x5e65('0xd')]:'00:00:00:00:00:00','ipAddress':_0x35c584&&_0x35c584[_0x5e65('0xe')]?_0x35c584[_0x5e65('0xe')]:_0x5e65('0xf')};}exports[_0x5e65('0x10')]=getFirstInterface;function getCPUhash(){var _0x170c6b=_[_0x5e65('0x5')](os[_0x5e65('0x11')]()['map'](function(_0x488183){return _0x488183[_0x5e65('0x12')];}))[_0x5e65('0x13')](':');return crypto[_0x5e65('0x14')](_0x5e65('0x15'))[_0x5e65('0x16')](_0x170c6b)[_0x5e65('0x17')](_0x5e65('0x18'));}exports['getUuid']=function(){var _0x37c399=os[_0x5e65('0x19')]();var _0x14d536=/[0-9a-f-]{36}/;if(config[_0x5e65('0x1a')]&&_0x14d536[_0x5e65('0x1b')](config['licenseToken'])){return config[_0x5e65('0x1a')];}else if(_0x37c399===_0x5e65('0x1c')){return exec(_0x5e65('0x1d'),{'encoding':_0x5e65('0x1e')})[_0x5e65('0x1f')]('\x0d\x0a','');}else{var _0x31c648=getFirstInterface();var _0x34e589=getCPUhash();var _0x2e385e=_0x34e589+'|'+os['hostname']()+'|'+_0x31c648['macAddress']+'|'+_0x31c648[_0x5e65('0x20')];var _0x56c81f=crypto[_0x5e65('0x14')](_0x5e65('0x15'))[_0x5e65('0x16')](_0x2e385e)['digest']('hex');return _0x56c81f[_0x5e65('0x21')](0x0,0x8)+'-'+_0x56c81f[_0x5e65('0x21')](0x8,0xc)+'-'+_0x56c81f[_0x5e65('0x21')](0xc,0x10)+'-'+_0x56c81f[_0x5e65('0x21')](0x10,0x14)+'-'+_0x56c81f[_0x5e65('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index cdc38ea..bd8e579 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 _0x8063=['NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','message','finally','getUuid','License','findOrCreate','default','util','moment','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','catch','get','data1','data2','then','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x8063,0x147));var _0x3806=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8063[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0x3806('0x0'));var moment=require(_0x3806('0x1'));var rp=require('request-promise');var BPromise=require(_0x3806('0x2'));var pkginfo=require(_0x3806('0x3'))(module,_0x3806('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x3806('0x5'));var hardware=require(_0x3806('0x6'));var logger=require(_0x3806('0x7'))('license');var HOST=_0x3806('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2154f7){return new BPromise(function(_0x9107a8,_0x3cb698){var _0x3d8936=util[_0x3806('0x9')](_0x3806('0xa'),HOST,_0x2154f7,module['exports'][_0x3806('0x4')]);if(oldToken){_0x3d8936=util['format'](_0x3806('0xb'),HOST,_0x2154f7,module[_0x3806('0xc')][_0x3806('0x4')],oldToken);}var _0x25dc75={'uri':_0x3d8936,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x25dc75)['then'](function(_0x495c4e){_0x9107a8(_0x495c4e);})[_0x3806('0xd')](function(_0x13ccb1){_0x3cb698(_0x13ccb1);});});}function manageLicense(_0x5550a6,_0x4f9264){var _0x1652e4=_0x4f9264[_0x3806('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x1652e4[_0x3806('0xf')]!==_0x5550a6&&!_0x1652e4[_0x3806('0x10')]){oldToken=_0x1652e4[_0x3806('0xf')];}httpRequest(_0x5550a6)[_0x3806('0x11')](function(_0x44c8c6){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x44c8c6['active']){isOldTokenSent=![];if(!_0x1652e4[_0x3806('0x12')]&&_0x1652e4[_0x3806('0x12')]!=_0x44c8c6[_0x3806('0x12')]||_0x1652e4[_0x3806('0x12')]&&_0x1652e4['data2']){logger[_0x3806('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x1652e4[_0x3806('0x12')]&&!_0x1652e4[_0x3806('0x10')]&&_0x1652e4[_0x3806('0x12')]!=_0x44c8c6[_0x3806('0x12')]){logger[_0x3806('0x13')](_0x3806('0x14'));}if(_0x1652e4[_0x3806('0x12')]&&!_0x1652e4[_0x3806('0x10')]&&_0x1652e4[_0x3806('0x12')]==_0x44c8c6[_0x3806('0x12')]){return _0x4f9264;}return _0x4f9264[_0x3806('0x15')]({'data1':_0x5550a6,'data2':null,'license':_0x44c8c6[_0x3806('0x12')]});}else{if(_0x44c8c6[_0x3806('0x12')]||_0x1652e4[_0x3806('0x12')]){if(!_0x1652e4['data2']){if(_0x1652e4['data1']==_0x5550a6){GRAY_PERIOD_REASON=_0x3806('0x16');logger['info'](_0x3806('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x3806('0x13')](_0x3806('0x18'),_0x1652e4[_0x3806('0xf')],_0x5550a6);}logger['info'](_0x3806('0x19'),GRAY_PERIOD_REASON[_0x3806('0x1a')](),moment()[_0x3806('0x9')](_0x3806('0x1b')));return _0x4f9264[_0x3806('0x15')]({'data2':encryptor[_0x3806('0x1c')](moment()[_0x3806('0x9')](_0x3806('0x1b')))});}else{if(moment()[_0x3806('0x1d')](encryptor[_0x3806('0x1e')](_0x1652e4['data2']),_0x3806('0x1f'))>DAYS){logger[_0x3806('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0x3806('0x9')](_0x3806('0x1b')));isOldTokenSent=![];return _0x4f9264[_0x3806('0x15')]({'data1':_0x5550a6,'data2':null,'license':null});}}}else{if(_0x1652e4[_0x3806('0xf')]!=_0x5550a6){logger[_0x3806('0x13')](_0x3806('0x18'),_0x1652e4[_0x3806('0xf')],_0x5550a6);return _0x4f9264[_0x3806('0x15')]({'data1':_0x5550a6,'data2':null,'license':null});}}}return _0x4f9264;})['then'](function(_0x3b3a21){_0x4f9264=_0x3b3a21;})[_0x3806('0xd')](function(_0x179ef2){logger[_0x3806('0x20')](_0x179ef2[_0x3806('0x21')]);})[_0x3806('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x3806('0x23')](),_0x4f9264);},TIME);});}function defaultLicense(){var _0x285174=hardware['getUuid']();if(_0x285174){return db[_0x3806('0x24')][_0x3806('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x285174}})['spread'](function(_0x13a92d,_0x42be6a){logger[_0x3806('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x285174);manageLicense(_0x285174,_0x13a92d);})['catch'](function(_0x173dfc){logger[_0x3806('0x20')](_0x173dfc[_0x3806('0x21')]);});}}exports[_0x3806('0x26')]=defaultLicense; \ No newline at end of file +var _0x925a=['data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','version','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','catch','get','data1','then','active','license'];(function(_0x112f50,_0x5268eb){var _0x787585=function(_0x1aa10d){while(--_0x1aa10d){_0x112f50['push'](_0x112f50['shift']());}};_0x787585(++_0x5268eb);}(_0x925a,0x100));var _0xa925=function(_0x5f2d8d,_0x59edbe){_0x5f2d8d=_0x5f2d8d-0x0;var _0x4c3976=_0x925a[_0x5f2d8d];return _0x4c3976;};'use strict';var util=require(_0xa925('0x0'));var moment=require('moment');var rp=require(_0xa925('0x1'));var BPromise=require(_0xa925('0x2'));var pkginfo=require('pkginfo')(module,_0xa925('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xa925('0x4'));var logger=require(_0xa925('0x5'))('license');var HOST=_0xa925('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x327a31){return new BPromise(function(_0x2be7da,_0x431e97){var _0x32a9aa=util[_0xa925('0x7')](_0xa925('0x8'),HOST,_0x327a31,module['exports'][_0xa925('0x3')]);if(oldToken){_0x32a9aa=util[_0xa925('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x327a31,module[_0xa925('0x9')][_0xa925('0x3')],oldToken);}var _0x33bc92={'uri':_0x32a9aa,'method':_0xa925('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x33bc92)['then'](function(_0x9ba6db){_0x2be7da(_0x9ba6db);})[_0xa925('0xb')](function(_0x4e9175){_0x431e97(_0x4e9175);});});}function manageLicense(_0x4169ed,_0x5ec5a2){var _0x2ce6d7=_0x5ec5a2[_0xa925('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x2ce6d7[_0xa925('0xd')]!==_0x4169ed&&!_0x2ce6d7['data2']){oldToken=_0x2ce6d7[_0xa925('0xd')];}httpRequest(_0x4169ed)[_0xa925('0xe')](function(_0x14b590){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x14b590[_0xa925('0xf')]){isOldTokenSent=![];if(!_0x2ce6d7[_0xa925('0x10')]&&_0x2ce6d7[_0xa925('0x10')]!=_0x14b590['license']||_0x2ce6d7[_0xa925('0x10')]&&_0x2ce6d7[_0xa925('0x11')]){logger[_0xa925('0x12')](_0xa925('0x13'));}if(_0x2ce6d7[_0xa925('0x10')]&&!_0x2ce6d7[_0xa925('0x11')]&&_0x2ce6d7[_0xa925('0x10')]!=_0x14b590[_0xa925('0x10')]){logger[_0xa925('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2ce6d7[_0xa925('0x10')]&&!_0x2ce6d7[_0xa925('0x11')]&&_0x2ce6d7[_0xa925('0x10')]==_0x14b590[_0xa925('0x10')]){return _0x5ec5a2;}return _0x5ec5a2[_0xa925('0x14')]({'data1':_0x4169ed,'data2':null,'license':_0x14b590[_0xa925('0x10')]});}else{if(_0x14b590['license']||_0x2ce6d7[_0xa925('0x10')]){if(!_0x2ce6d7[_0xa925('0x11')]){if(_0x2ce6d7[_0xa925('0xd')]==_0x4169ed){GRAY_PERIOD_REASON=_0xa925('0x15');logger[_0xa925('0x12')](_0xa925('0x16'));}else{GRAY_PERIOD_REASON=_0xa925('0x17');logger['info'](_0xa925('0x18'),_0x2ce6d7[_0xa925('0xd')],_0x4169ed);}logger[_0xa925('0x12')](_0xa925('0x19'),GRAY_PERIOD_REASON[_0xa925('0x1a')](),moment()[_0xa925('0x7')](_0xa925('0x1b')));return _0x5ec5a2[_0xa925('0x14')]({'data2':encryptor[_0xa925('0x1c')](moment()[_0xa925('0x7')](_0xa925('0x1b')))});}else{if(moment()['diff'](encryptor[_0xa925('0x1d')](_0x2ce6d7['data2']),_0xa925('0x1e'))>DAYS){logger[_0xa925('0x12')](_0xa925('0x1f'),moment()[_0xa925('0x7')](_0xa925('0x1b')));isOldTokenSent=![];return _0x5ec5a2[_0xa925('0x14')]({'data1':_0x4169ed,'data2':null,'license':null});}}}else{if(_0x2ce6d7['data1']!=_0x4169ed){logger[_0xa925('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2ce6d7[_0xa925('0xd')],_0x4169ed);return _0x5ec5a2[_0xa925('0x14')]({'data1':_0x4169ed,'data2':null,'license':null});}}}return _0x5ec5a2;})['then'](function(_0x6e295e){_0x5ec5a2=_0x6e295e;})[_0xa925('0xb')](function(_0x7fcee8){logger['error'](_0x7fcee8[_0xa925('0x20')]);})[_0xa925('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xa925('0x22')](),_0x5ec5a2);},TIME);});}function defaultLicense(){var _0x45f4e7=hardware['getUuid']();if(_0x45f4e7){return db[_0xa925('0x23')][_0xa925('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x45f4e7}})['spread'](function(_0x1c1a50,_0x413f03){logger[_0xa925('0x12')](_0xa925('0x25'),_0x45f4e7);manageLicense(_0x45f4e7,_0x1c1a50);})[_0xa925('0xb')](function(_0x401678){logger['error'](_0x401678[_0xa925('0x20')]);});}}exports[_0xa925('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9dc2387..bee8027 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 _0xa700=['%s:%s:%s','demo','uuid','machineUuid','gray','format','grayReason','changed','disabled','User','role','sequelize','col','admin','telephone','users','telephones','forEach','user','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','defaults','then','catch','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString'];(function(_0x5819d9,_0x2f7168){var _0x1cae39=function(_0x5d1d18){while(--_0x5d1d18){_0x5819d9['push'](_0x5819d9['shift']());}};_0x1cae39(++_0x2f7168);}(_0xa700,0xdf));var _0x0a70=function(_0x251ff8,_0x181c7f){_0x251ff8=_0x251ff8-0x0;var _0xda0abc=_0xa700[_0x251ff8];return _0xda0abc;};'use strict';var util=require('util');var _=require(_0x0a70('0x0'));var moment=require(_0x0a70('0x1'));var BPromise=require(_0x0a70('0x2'));var hardware=require('./hardware');var encryptor=require(_0x0a70('0x3'));var db=require(_0x0a70('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0a70('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0a70('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0a70('0x6'),'machineUuid':hardware[_0x0a70('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x427524){return new BPromise(function(_0x11bc25,_0x1ff2df){return db[_0x0a70('0x8')]['find'](_[_0x0a70('0x9')](_0x427524,{'raw':!![],'where':{'id':0x1}}))[_0x0a70('0xa')](function(_0x164789){return checkLicense(_0x164789,null);})[_0x0a70('0xa')](function(_0x5a634d){_0x11bc25(_0x5a634d);return;})[_0x0a70('0xb')](function(_0x3551e5){_0x1ff2df(_0x3551e5);});});}function checkLicense(_0x448325,_0xefa437){if(!_0x448325){demoLicense['uuid']=_0x448325[_0x0a70('0xc')];return demoLicense;}try{var _0x46e24c=_0xefa437||_0x448325['license'];if(_[_0x0a70('0xd')](_0x46e24c)){throw new Error(_0x0a70('0xe'));}var _0x3906f1=_0x448325['data1'];var _0x1ddfc4=_0x448325['data2'];var _0x54225b=_0x3906f1['split']('-')[0x4];var _0x57c0ca=_0x3906f1[_0x0a70('0xf')]('-')[0x0];var _0x217404=encryptor[_0x0a70('0x10')](_0x46e24c,util['format'](_0x0a70('0x11'),_0x54225b,_0x3906f1,_0x57c0ca));var _0x13fed3=JSON['parse'](_0x217404);_0x13fed3[_0x0a70('0x12')]=![];_0x13fed3[_0x0a70('0x13')]=_0x3906f1;_0x13fed3[_0x0a70('0x14')]=hardware[_0x0a70('0x7')]();if(_0x1ddfc4){var _0x1cbab7=encryptor[_0x0a70('0x10')](_0x1ddfc4);_0x13fed3[_0x0a70('0x15')]=_0x1cbab7;_0x13fed3['deadline']=moment(_0x1cbab7)['add'](0x7,'days')[_0x0a70('0x16')]();_0x13fed3[_0x0a70('0x17')]=_0x13fed3[_0x0a70('0x13')]!=_0x13fed3[_0x0a70('0x14')]?_0x0a70('0x18'):_0x0a70('0x19');}return _0x13fed3;}catch(_0x36737a){breakingLicense[_0x0a70('0x13')]=_0x448325['data1'];breakingLicense['message']=_0x36737a['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c88af,_0x2d9355){getLicense()[_0x0a70('0xa')](function(_0x3df766){return db[_0x0a70('0x1a')]['findAll']({'attributes':[_0x0a70('0x1b'),[db[_0x0a70('0x1c')]['fn']('COUNT',db['sequelize'][_0x0a70('0x1d')](_0x0a70('0x1b'))),'count']],'group':_0x0a70('0x1b'),'where':{'role':{'$or':[_0x0a70('0x1e'),'user',_0x0a70('0x1f')]}},'raw':!![]})[_0x0a70('0xa')](function(_0x26372d){var _0x970456={'user':_0x3df766[_0x0a70('0x20')]||0x0,'telephone':_0x3df766[_0x0a70('0x21')]||0x0};_0x26372d[_0x0a70('0x22')](function(_0x24aa11){var _0x1227f0=_0x24aa11[_0x0a70('0x1b')]===_0x0a70('0x1e')?_0x0a70('0x23'):_0x24aa11[_0x0a70('0x1b')];_0x970456[_0x1227f0]-=_0x24aa11[_0x0a70('0x24')];if(_0x970456[_0x1227f0]<0x0)_0x970456[_0x1227f0]=0x0;});_0x2c88af(_0x970456);return;});})['catch'](function(_0x57093a){_0x2d9355(_0x57093a);});});}function checkUserLimits(_0x1a4b57){return new BPromise(function(_0x4fa45d,_0x4d8039){getLimits()['then'](function(_0x5adc40){var _0x435b49=_[_0x0a70('0x25')](_[_0x0a70('0x26')](_0x1a4b57,_0x0a70('0x1b')),[_0x0a70('0x1e'),_0x0a70('0x23'),_0x0a70('0x1f')]);var _0x34b807=(_0x435b49[_0x0a70('0x1e')]||0x0)+(_0x435b49[_0x0a70('0x23')]||0x0);var _0x24765e=_0x435b49['telephone']||0x0;if(_0x34b807>_0x5adc40['user'])return _0x4d8039(_0x0a70('0x27'));if(_0x24765e>_0x5adc40[_0x0a70('0x1f')])return _0x4d8039('License\x20limit\x20reached\x20for\x20telephones');return _0x4fa45d();})[_0x0a70('0xb')](function(_0x233889){_0x4d8039(_0x233889);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6222=['User','findAll','role','COUNT','sequelize','col','admin','user','forEach','count','catch','pick','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','add','days','grayReason','machineUuid','disabled','data1','message'];(function(_0x32cfd7,_0x1cdee6){var _0x125f35=function(_0x35c218){while(--_0x35c218){_0x32cfd7['push'](_0x32cfd7['shift']());}};_0x125f35(++_0x1cdee6);}(_0x6222,0x10b));var _0x2622=function(_0x1c214f,_0x38f3d2){_0x1c214f=_0x1c214f-0x0;var _0xf604d8=_0x6222[_0x1c214f];return _0xf604d8;};'use strict';var util=require('util');var _=require(_0x2622('0x0'));var moment=require(_0x2622('0x1'));var BPromise=require(_0x2622('0x2'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x2622('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2622('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x2622('0x5'),'machineUuid':hardware[_0x2622('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2622('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2622('0x7'),'machineUuid':hardware[_0x2622('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3aa8c0){return new BPromise(function(_0x16c451,_0x427ffd){return db[_0x2622('0x8')]['find'](_['defaults'](_0x3aa8c0,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x446aa7){return checkLicense(_0x446aa7,null);})[_0x2622('0x9')](function(_0x1a46fc){_0x16c451(_0x1a46fc);return;})['catch'](function(_0x48207d){_0x427ffd(_0x48207d);});});}function checkLicense(_0xf26b52,_0x5f4df4){if(!_0xf26b52){demoLicense[_0x2622('0xa')]=_0xf26b52['data1'];return demoLicense;}try{var _0x23a5d=_0x5f4df4||_0xf26b52[_0x2622('0xb')];if(_[_0x2622('0xc')](_0x23a5d)){throw new Error(_0x2622('0xd'));}var _0xaaee45=_0xf26b52['data1'];var _0x10f56f=_0xf26b52[_0x2622('0xe')];var _0x2dec2d=_0xaaee45[_0x2622('0xf')]('-')[0x4];var _0xe02a93=_0xaaee45[_0x2622('0xf')]('-')[0x0];var _0x3acbb3=encryptor[_0x2622('0x10')](_0x23a5d,util[_0x2622('0x11')]('%s:%s:%s',_0x2dec2d,_0xaaee45,_0xe02a93));var _0x971cb9=JSON[_0x2622('0x12')](_0x3acbb3);_0x971cb9[_0x2622('0x13')]=![];_0x971cb9[_0x2622('0xa')]=_0xaaee45;_0x971cb9['machineUuid']=hardware[_0x2622('0x6')]();if(_0x10f56f){var _0x7de266=encryptor[_0x2622('0x10')](_0x10f56f);_0x971cb9['gray']=_0x7de266;_0x971cb9['deadline']=moment(_0x7de266)[_0x2622('0x14')](0x7,_0x2622('0x15'))['format']();_0x971cb9[_0x2622('0x16')]=_0x971cb9['uuid']!=_0x971cb9[_0x2622('0x17')]?'changed':_0x2622('0x18');}return _0x971cb9;}catch(_0xe71050){breakingLicense[_0x2622('0xa')]=_0xf26b52[_0x2622('0x19')];breakingLicense[_0x2622('0x1a')]=_0xe71050[_0x2622('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x467a4a,_0x5b9dc2){getLicense()['then'](function(_0x538f85){return db[_0x2622('0x1b')][_0x2622('0x1c')]({'attributes':[_0x2622('0x1d'),[db['sequelize']['fn'](_0x2622('0x1e'),db[_0x2622('0x1f')][_0x2622('0x20')](_0x2622('0x1d'))),'count']],'group':_0x2622('0x1d'),'where':{'role':{'$or':[_0x2622('0x21'),_0x2622('0x22'),'telephone']}},'raw':!![]})[_0x2622('0x9')](function(_0x2aff3a){var _0x338502={'user':_0x538f85['users']||0x0,'telephone':_0x538f85['telephones']||0x0};_0x2aff3a[_0x2622('0x23')](function(_0x181627){var _0x250edd=_0x181627['role']==='admin'?_0x2622('0x22'):_0x181627['role'];_0x338502[_0x250edd]-=_0x181627[_0x2622('0x24')];if(_0x338502[_0x250edd]<0x0)_0x338502[_0x250edd]=0x0;});_0x467a4a(_0x338502);return;});})[_0x2622('0x25')](function(_0xbb8131){_0x5b9dc2(_0xbb8131);});});}function checkUserLimits(_0x2d18fa){return new BPromise(function(_0x3ce3ce,_0x12e967){getLimits()['then'](function(_0x51f01f){var _0x2ff34c=_[_0x2622('0x26')](_['countBy'](_0x2d18fa,_0x2622('0x1d')),[_0x2622('0x21'),_0x2622('0x22'),_0x2622('0x27')]);var _0x1d5ab3=(_0x2ff34c[_0x2622('0x21')]||0x0)+(_0x2ff34c[_0x2622('0x22')]||0x0);var _0x38616f=_0x2ff34c[_0x2622('0x27')]||0x0;if(_0x1d5ab3>_0x51f01f[_0x2622('0x22')])return _0x12e967(_0x2622('0x28'));if(_0x38616f>_0x51f01f[_0x2622('0x27')])return _0x12e967(_0x2622('0x29'));return _0x3ce3ce();})['catch'](function(_0x39894b){_0x12e967(_0x39894b);});});}module['exports']={'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 20fedeb..7c05c85 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 _0xf7b4=['app-id','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4a74e5,_0x108772){_0x4a74e5=_0x4a74e5-0x0;var _0x1339c6=_0xf7b4[_0x4a74e5];return _0x1339c6;};'use strict';module[_0x4f7b('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4f7b('0x1'),'GOOGLE_SECRET':_0x4f7b('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x5f2f=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x1a2fe6,_0x59751a){var _0x1abef8=function(_0x277470){while(--_0x277470){_0x1a2fe6['push'](_0x1a2fe6['shift']());}};_0x1abef8(++_0x59751a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x328718,_0x26e2c2){_0x328718=_0x328718-0x0;var _0x2d8f14=_0x5f2f[_0x328718];return _0x2d8f14;};'use strict';module[_0xf5f2('0x0')]={'DOMAIN':_0xf5f2('0x1'),'SESSION_SECRET':_0xf5f2('0x2'),'GOOGLE_ID':_0xf5f2('0x3'),'GOOGLE_SECRET':_0xf5f2('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2409b48..4d1c0cc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c82=['exports'];(function(_0x4671a5,_0x1db5f4){var _0x12f1ac=function(_0x3f09de){while(--_0x3f09de){_0x4671a5['push'](_0x4671a5['shift']());}};_0x12f1ac(++_0x1db5f4);}(_0x9c82,0x130));var _0x29c8=function(_0x16fe85,_0x1b0c3e){_0x16fe85=_0x16fe85-0x0;var _0x5ee363=_0x9c82[_0x16fe85];return _0x5ee363;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0x29c8('0x0')]=fileLogger; \ No newline at end of file +var _0x79f6=['exports','../utils/loggers','fileLogger'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0x79f6,0x7c));var _0x679f=function(_0x4a2456,_0x53d6ca){_0x4a2456=_0x4a2456-0x0;var _0x471e32=_0x79f6[_0x4a2456];return _0x471e32;};'use strict';var fileLogger=require(_0x679f('0x0'))[_0x679f('0x1')];module[_0x679f('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index fe662c3..68da525 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 _0xe1be=['../../services/xdr/index.js','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/routing/index.js','xdr'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xe1be,0xfd));var _0xee1b=function(_0x431cfa,_0x21bf84){_0x431cfa=_0x431cfa-0x0;var _0x1f206a=_0xe1be[_0x431cfa];return _0x1f206a;};'use strict';var path=require('path');var cfg=require(_0xee1b('0x0'));var env={'NODE_PATH':path[_0xee1b('0x1')](path[_0xee1b('0x2')](cfg[_0xee1b('0x3')],_0xee1b('0x4')))};var pm2config={'apps':[{'name':_0xee1b('0x5'),'script':path['join'](__dirname,_0xee1b('0x6')),'env':env},{'name':_0xee1b('0x7'),'script':path['join'](__dirname,_0xee1b('0x8')),'env':env},{'name':'agi','script':path[_0xee1b('0x2')](__dirname,_0xee1b('0x9')),'env':env},{'name':_0xee1b('0xa'),'script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0xee1b('0x2')](__dirname,_0xee1b('0xb')),'env':env},{'name':_0xee1b('0xc'),'script':path['join'](__dirname,_0xee1b('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x6389=['../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','path','resolve','join','root','legacy-libs','ami'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6389,0x8a));var _0x9638=function(_0x350be4,_0x1193fc){_0x350be4=_0x350be4-0x0;var _0xdc0969=_0x6389[_0x350be4];return _0xdc0969;};'use strict';var path=require(_0x9638('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x9638('0x1')](path[_0x9638('0x2')](cfg[_0x9638('0x3')],_0x9638('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x9638('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x9638('0x5'),'script':path[_0x9638('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x9638('0x2')](__dirname,_0x9638('0x6')),'env':env},{'name':_0x9638('0x7'),'script':path[_0x9638('0x2')](__dirname,_0x9638('0x8')),'env':env},{'name':_0x9638('0x9'),'script':path[_0x9638('0x2')](__dirname,_0x9638('0xa')),'env':env},{'name':_0x9638('0xb'),'script':path[_0x9638('0x2')](__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 b99a086..448296b 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 _0x2801=['describe','delete','dump','saved','bluebird','connect','connected','start','then','disconnect','stop','list'];(function(_0x1bb9b5,_0x22f532){var _0x1441d8=function(_0x148ba7){while(--_0x148ba7){_0x1bb9b5['push'](_0x1bb9b5['shift']());}};_0x1441d8(++_0x22f532);}(_0x2801,0x1a8));var _0x1280=function(_0x8d75fd,_0x26ba4a){_0x8d75fd=_0x8d75fd-0x0;var _0x29e0bd=_0x2801[_0x8d75fd];return _0x29e0bd;};'use strict';var pm2=require('pm2');var BPromise=require(_0x1280('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x3179e2,_0x4cf40a){return pm2[_0x1280('0x1')](function(_0xfa8438){if(_0xfa8438){return _0x4cf40a(_0xfa8438);}return _0x3179e2(_0x1280('0x2'));});});};exports[_0x1280('0x3')]=function(_0xd8328d){return connect()[_0x1280('0x4')](function(){return new BPromise(function(_0x5dd2c7,_0x6a99d9){return pm2['start'](_0xd8328d,function(_0x17dc00,_0x504a4f){if(_0x17dc00){return _0x6a99d9(_0x17dc00);}pm2[_0x1280('0x5')]();return _0x5dd2c7(_0x504a4f);});});});};exports['stop']=function(_0x2654c8){return connect()['then'](function(){return new BPromise(function(_0x39032c,_0x576278){return pm2[_0x1280('0x6')](_0x2654c8,function(_0x2e8385,_0x2baff1){if(_0x2e8385){return _0x576278(_0x2e8385);}pm2[_0x1280('0x5')]();return _0x39032c(_0x2baff1);});});});};exports['restart']=function(_0x356113){return connect()[_0x1280('0x4')](function(){return new BPromise(function(_0x58293d,_0x5ef45b){return pm2['restart'](_0x356113,function(_0x5b2e8f,_0xd2a826){if(_0x5b2e8f){return _0x5ef45b(_0x5b2e8f);}pm2[_0x1280('0x5')]();return _0x58293d(_0xd2a826);});});});};exports[_0x1280('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2d4408,_0x48a711){return pm2[_0x1280('0x7')](function(_0x1debb7,_0x55de19){if(_0x1debb7){return _0x48a711(_0x1debb7);}pm2[_0x1280('0x5')]();return _0x2d4408(_0x55de19);});});});};exports[_0x1280('0x8')]=function(_0x2ce077){return connect()[_0x1280('0x4')](function(){return new BPromise(function(_0xf410bf,_0x3ea115){return pm2['describe'](_0x2ce077,function(_0x2c15da,_0xc4ea80){if(_0x2c15da){return _0x3ea115(_0x2c15da);}pm2[_0x1280('0x5')]();return _0xf410bf(_0xc4ea80);});});});};exports[_0x1280('0x9')]=function(_0x2969a8){return connect()[_0x1280('0x4')](function(){return new BPromise(function(_0x31a9d2,_0x423369){return pm2[_0x1280('0x9')](_0x2969a8,function(_0x91a54,_0x2469bc){if(_0x91a54){return _0x423369(_0x91a54);}pm2['disconnect']();return _0x31a9d2(_0x2469bc);});});});};exports[_0x1280('0xa')]=function(){return connect()[_0x1280('0x4')](function(){return new BPromise(function(_0x38993f,_0x4750a2){return pm2[_0x1280('0xa')](function(_0x5c5122){if(_0x5c5122){return _0x4750a2(_0x5c5122);}return _0x38993f(_0x1280('0xb'));});});});}; \ No newline at end of file +var _0x8bfe=['then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config','connect','connected','start'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x8bfe,0x105));var _0xe8bf=function(_0x45cd59,_0x5be7c0){_0x45cd59=_0x45cd59-0x0;var _0x39541a=_0x8bfe[_0x45cd59];return _0x39541a;};'use strict';var pm2=require(_0xe8bf('0x0'));var BPromise=require('bluebird');var config=require(_0xe8bf('0x1'));function connect(){return new BPromise(function(_0x16b438,_0x33ad11){return pm2[_0xe8bf('0x2')](function(_0x305ebb){if(_0x305ebb){return _0x33ad11(_0x305ebb);}return _0x16b438(_0xe8bf('0x3'));});});};exports[_0xe8bf('0x4')]=function(_0x34e8f9){return connect()[_0xe8bf('0x5')](function(){return new BPromise(function(_0x4416a8,_0x17f98b){return pm2[_0xe8bf('0x4')](_0x34e8f9,function(_0x32e955,_0x41ba54){if(_0x32e955){return _0x17f98b(_0x32e955);}pm2[_0xe8bf('0x6')]();return _0x4416a8(_0x41ba54);});});});};exports[_0xe8bf('0x7')]=function(_0x760c81){return connect()[_0xe8bf('0x5')](function(){return new BPromise(function(_0x58e99f,_0x5c4920){return pm2[_0xe8bf('0x7')](_0x760c81,function(_0x3ea0dc,_0x453c37){if(_0x3ea0dc){return _0x5c4920(_0x3ea0dc);}pm2[_0xe8bf('0x6')]();return _0x58e99f(_0x453c37);});});});};exports[_0xe8bf('0x8')]=function(_0x4fa7d5){return connect()['then'](function(){return new BPromise(function(_0x471896,_0x432e8c){return pm2[_0xe8bf('0x8')](_0x4fa7d5,function(_0x124dc7,_0x67bc42){if(_0x124dc7){return _0x432e8c(_0x124dc7);}pm2[_0xe8bf('0x6')]();return _0x471896(_0x67bc42);});});});};exports['list']=function(){return connect()[_0xe8bf('0x5')](function(){return new BPromise(function(_0x1088c2,_0x2840a8){return pm2[_0xe8bf('0x9')](function(_0x3a5d0a,_0x2b70a2){if(_0x3a5d0a){return _0x2840a8(_0x3a5d0a);}pm2[_0xe8bf('0x6')]();return _0x1088c2(_0x2b70a2);});});});};exports[_0xe8bf('0xa')]=function(_0x2b7735){return connect()[_0xe8bf('0x5')](function(){return new BPromise(function(_0x58a8c0,_0x566efa){return pm2['describe'](_0x2b7735,function(_0x187bc8,_0xccb914){if(_0x187bc8){return _0x566efa(_0x187bc8);}pm2['disconnect']();return _0x58a8c0(_0xccb914);});});});};exports[_0xe8bf('0xb')]=function(_0x249d30){return connect()['then'](function(){return new BPromise(function(_0xe22d8f,_0x397a72){return pm2[_0xe8bf('0xb')](_0x249d30,function(_0xb97798,_0x1d7483){if(_0xb97798){return _0x397a72(_0xb97798);}pm2[_0xe8bf('0x6')]();return _0xe22d8f(_0x1d7483);});});});};exports[_0xe8bf('0xc')]=function(){return connect()[_0xe8bf('0x5')](function(){return new BPromise(function(_0x46eae4,_0x1667f2){return pm2['dump'](function(_0x235b93){if(_0x235b93){return _0x1667f2(_0x235b93);}return _0x46eae4(_0xe8bf('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index cf3a6ee..34fd47f 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 _0x2578=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update'];(function(_0x5031f0,_0x596066){var _0x59f11b=function(_0x13002b){while(--_0x13002b){_0x5031f0['push'](_0x5031f0['shift']());}};_0x59f11b(++_0x596066);}(_0x2578,0x178));var _0x8257=function(_0x562148,_0x28c75f){_0x562148=_0x562148-0x0;var _0x3fc4b3=_0x2578[_0x562148];return _0x3fc4b3;};'use strict';var _=require(_0x8257('0x0'));var moment=require('moment');var Redis=require(_0x8257('0x1'));var util=require('util');var config=require(_0x8257('0x2'));var db=require(_0x8257('0x3'))['db'];var logger=require(_0x8257('0x4'))(_0x8257('0x5'));config['redis']=_['defaults'](config[_0x8257('0x6')],{'host':_0x8257('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8257('0x6')]));function closeInteractions(){var _0x1ca701=0x0;var _0x299615=[];return db[_0x8257('0x8')][_0x8257('0x9')]({'raw':!![],'attributes':['id',_0x8257('0xa')],'where':{'id':0x1}})[_0x8257('0xb')](function(_0x196c97){_0x1ca701=_0x196c97[_0x8257('0xa')];if(_0x1ca701){return db[_0x8257('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x8257('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x196c97[_0x8257('0xa')],_0x8257('0xe'))}}});}else{return[];}})['then'](function(_0x287e14){if(_0x287e14&&_0x287e14[_0x8257('0xf')]){_0x299615=_[_0x8257('0x10')](_0x287e14||[],'id');logger[_0x8257('0x11')](_0x8257('0x12'),_0x299615['join']());return db[_0x8257('0xc')]['update']({'closeReason':_0x8257('0x13'),'disposition':_0x8257('0x14'),'closed':!![],'closedAt':moment()[_0x8257('0x15')](_0x8257('0x16'))},{'where':{'id':_0x299615}});}})[_0x8257('0xb')](function(){if(_0x299615&&_0x299615['length']){logger[_0x8257('0x11')](_0x8257('0x17'),_0x299615[_0x8257('0x18')]());for(var _0x5c715b=0x0;_0x5c715b<_0x299615['length'];_0x5c715b++){io[_0x8257('0x19')](_0x8257('0x1a'),{'id':_0x299615[_0x5c715b],'closed':!![]});}}})[_0x8257('0x1b')](function(_0x223192){logger[_0x8257('0x1c')](_0x8257('0x1d'),_0x223192?util[_0x8257('0x1e')](_0x223192,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xea02=['error','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','schedule','redis','defaults','socket.io-emitter','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','chatInteraction:update','catch'];(function(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0xea02,0x10b));var _0x2ea0=function(_0x2a9d41,_0x4027a0){_0x2a9d41=_0x2a9d41-0x0;var _0x800fc2=_0xea02[_0x2a9d41];return _0x800fc2;};'use strict';var _=require(_0x2ea0('0x0'));var moment=require(_0x2ea0('0x1'));var Redis=require('ioredis');var util=require(_0x2ea0('0x2'));var config=require(_0x2ea0('0x3'));var db=require(_0x2ea0('0x4'))['db'];var logger=require('../logger')(_0x2ea0('0x5'));config[_0x2ea0('0x6')]=_[_0x2ea0('0x7')](config[_0x2ea0('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2ea0('0x8'))(new Redis(config[_0x2ea0('0x6')]));function closeInteractions(){var _0x292d5d=0x0;var _0x4b4e9c=[];return db['Setting'][_0x2ea0('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x2ea0('0xa')](function(_0x295673){_0x292d5d=_0x295673[_0x2ea0('0xb')];if(_0x292d5d){return db[_0x2ea0('0xc')][_0x2ea0('0xd')]({'raw':!![],'attributes':['id',_0x2ea0('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2ea0('0xf')](_0x295673['chatTimeout'],_0x2ea0('0x10'))}}});}else{return[];}})[_0x2ea0('0xa')](function(_0x52169e){if(_0x52169e&&_0x52169e['length']){_0x4b4e9c=_[_0x2ea0('0x11')](_0x52169e||[],'id');logger[_0x2ea0('0x12')](_0x2ea0('0x13'),_0x4b4e9c[_0x2ea0('0x14')]());return db[_0x2ea0('0xc')][_0x2ea0('0x15')]({'closeReason':_0x2ea0('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x2ea0('0x17')](_0x2ea0('0x18'))},{'where':{'id':_0x4b4e9c}});}})[_0x2ea0('0xa')](function(){if(_0x4b4e9c&&_0x4b4e9c['length']){logger[_0x2ea0('0x12')](_0x2ea0('0x19'),_0x4b4e9c[_0x2ea0('0x14')]());for(var _0x3930ca=0x0;_0x3930ca<_0x4b4e9c[_0x2ea0('0x1a')];_0x3930ca++){io[_0x2ea0('0x1b')](_0x2ea0('0x1c'),{'id':_0x4b4e9c[_0x3930ca],'closed':!![]});}}})[_0x2ea0('0x1d')](function(_0xef3e60){logger[_0x2ea0('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0xef3e60?util[_0x2ea0('0x1f')](_0xef3e60,{'showHidden':![],'depth':null}):'');});}exports[_0x2ea0('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 6c2f054..83017e0 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 _0x52b3=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x2c64c5,_0x19d51a){var _0x32f63c=function(_0x1d0bbf){while(--_0x1d0bbf){_0x2c64c5['push'](_0x2c64c5['shift']());}};_0x32f63c(++_0x19d51a);}(_0x52b3,0xcc));var _0x352b=function(_0x137868,_0x1bf62d){_0x137868=_0x137868-0x0;var _0x4bf232=_0x52b3[_0x137868];return _0x4bf232;};'use strict';function start(){var _0x361209=require(_0x352b('0x0'));return _0x361209[_0x352b('0x1')]();}module[_0x352b('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x45fb=['exports'];(function(_0x15607d,_0x2f6bf0){var _0x48f894=function(_0x14d59f){while(--_0x14d59f){_0x15607d['push'](_0x15607d['shift']());}};_0x48f894(++_0x2f6bf0);}(_0x45fb,0x10e));var _0xb45f=function(_0x1b4574,_0x282759){_0x1b4574=_0x1b4574-0x0;var _0x188b6b=_0x45fb[_0x1b4574];return _0x188b6b;};'use strict';function start(){var _0x447a83=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x447a83['startAllRefreshIntervals']();}module[_0xb45f('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index beddef3..1e58ef7 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 _0x2b37=['active','endAt','add','add\x20cron','update','update\x20cron','path','lodash','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','client','http','email','format','MailAccount','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','basename','extname','zip','status','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','existsSync','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error\x20mail','info','error','stringify','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron'];(function(_0x257cdc,_0x2bba23){var _0x354a6f=function(_0x3238ea){while(--_0x3238ea){_0x257cdc['push'](_0x257cdc['shift']());}};_0x354a6f(++_0x2bba23);}(_0x2b37,0xea));var _0x72b3=function(_0x33b43f,_0x39f816){_0x33b43f=_0x33b43f-0x0;var _0x151327=_0x2b37[_0x33b43f];return _0x151327;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x72b3('0x0'));var _=require(_0x72b3('0x1'));var moment=require('moment');var CronJobManager=require(_0x72b3('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0x72b3('0x3'));var logger=require(_0x72b3('0x4'))(_0x72b3('0x5'));var db=require(_0x72b3('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x72b3('0x7')][_0x72b3('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3428dc,_0x12bc55){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x3428dc[_0x72b3('0x9')]);var _0x41460f=!![];var _0xbe9c10=_0x3428dc['MailAccount']['getSmtpOptions']();var _0x2fb85e={'account':_0xbe9c10,'message':{'from':util[_0x72b3('0xa')]('\x22%s\x22\x20<%s>',_0x3428dc[_0x72b3('0xb')][_0x72b3('0xc')],_0x3428dc[_0x72b3('0xb')][_0x72b3('0x9')]||_0x3428dc[_0x72b3('0xb')]['Smtp']['user']),'to':_0x3428dc[_0x72b3('0x9')],'cc':_0x3428dc['cc'],'bcc':_0x3428dc['bcc'],'subject':util[_0x72b3('0xa')](_0x72b3('0xd'),_0x12bc55[_0x72b3('0xc')],_0x3428dc[_0x72b3('0xe')],_0x3428dc['subtractUnit'])}};var _0x2174f6=path[_0x72b3('0xf')](__dirname,_0x72b3('0x10'));var _0x501fbc=_0x12bc55[_0x72b3('0x11')];var _0x1ad3c1=util[_0x72b3('0xa')]('%s.%s',path[_0x72b3('0x12')](_0x12bc55[_0x72b3('0x11')],path[_0x72b3('0x13')](_0x12bc55[_0x72b3('0x11')])),_0x72b3('0x14'));var _0x296214=path[_0x72b3('0xf')](_0x2174f6,_0x501fbc);var _0x9fec86=path[_0x72b3('0xf')](_0x2174f6,_0x1ad3c1);if(fs['existsSync'](_0x296214)){_0x12bc55[_0x72b3('0x15')]=_0x72b3('0x16');_0x2fb85e[_0x72b3('0x17')]['attachments']=[{'filename':_0x501fbc,'path':_0x296214}];_0x2fb85e['message'][_0x72b3('0x18')]=util[_0x72b3('0xa')](_0x72b3('0x19'),JSON['stringify'](_0x12bc55,null,0x2));}else if(fs[_0x72b3('0x1a')](_0x9fec86)){_0x12bc55[_0x72b3('0x15')]=_0x72b3('0x16');_0x2fb85e[_0x72b3('0x17')][_0x72b3('0x1b')]=[{'filename':_0x1ad3c1,'path':_0x9fec86}];}else{_0x2fb85e[_0x72b3('0x17')][_0x72b3('0x18')]=_0x72b3('0x1c');if(!_0x3428dc['sendIfEmpty']){_0x41460f=![];logger['info'](_0x72b3('0x1d'));}}if(_0x41460f){return client[_0x72b3('0x1e')](_0x72b3('0x1f'),_0x2fb85e)['then'](function(_0x22c8c2){if(_0x22c8c2['error']){return logger['error'](_0x72b3('0x20'),JSON['stringify'](_0x22c8c2));}return logger[_0x72b3('0x21')]('email\x20sent');})['catch'](function(_0x4d837c){return logger[_0x72b3('0x22')](_0x72b3('0x20'),JSON[_0x72b3('0x23')](_0x4d837c));});}};}function handleError(){return function(_0x538222){return logger[_0x72b3('0x22')](JSON[_0x72b3('0x23')](_0x538222));};}function handleResult(_0x4d2b35){return function(_0x43def7){logger[_0x72b3('0x21')]('data',JSON['stringify'](_0x43def7));if(_0x4d2b35[_0x72b3('0xb')]&&_0x4d2b35[_0x72b3('0xb')]['Smtp']&&!_[_0x72b3('0x24')](_0x4d2b35['email'])){setTimeout(handleSendEmail(_0x4d2b35,_0x43def7),0x3c*0x3e8);}};}function handleJob(_0x162307){return function(){try{if(_['isNil'](_0x162307[_0x72b3('0xe')])){return logger[_0x72b3('0x21')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x72b3('0x24')](_0x162307[_0x72b3('0x25')])){return logger[_0x72b3('0x21')](_0x72b3('0x26'));}var _0x5ab0f1={'startDate':moment()[_0x72b3('0x27')](_0x162307['subtractNumber'],_0x162307['subtractUnit'])[_0x72b3('0xa')](_0x72b3('0x28')),'endDate':moment()[_0x72b3('0xa')](_0x72b3('0x28')),'type':_0x72b3('0x29'),'output':_0x162307[_0x72b3('0x2a')],'name':_0x162307[_0x72b3('0xc')]};if(!_[_0x72b3('0x24')](_0x162307['DefaultReportId'])){logger[_0x72b3('0x21')](_0x72b3('0x2b'),_0x162307['DefaultReportId']);return analyticDefaultReportController[_0x72b3('0x2c')]({'id':_0x162307[_0x72b3('0x2d')]},_0x5ab0f1)[_0x72b3('0x2e')](handleResult(_0x162307))[_0x72b3('0x2f')](handleError());}if(!_[_0x72b3('0x24')](_0x162307[_0x72b3('0x30')])){logger[_0x72b3('0x21')](_0x72b3('0x31'),_0x162307[_0x72b3('0x30')]);return analyticCustomReportController[_0x72b3('0x2c')]({'id':_0x162307[_0x72b3('0x30')]},_0x5ab0f1)[_0x72b3('0x2e')](handleResult(_0x162307))[_0x72b3('0x2f')](handleError());}}catch(_0x36c466){logger[_0x72b3('0x22')](JSON[_0x72b3('0x23')](_0x36c466));}return logger[_0x72b3('0x21')](_0x72b3('0x32'));};}function getJobs(_0x355270){var _0x6c7559={};if(_0x355270){_0x6c7559['id']=_0x355270;}return db[_0x72b3('0x33')][_0x72b3('0x34')]({'where':_0x6c7559,'include':[{'model':db[_0x72b3('0xb')],'attributes':['id',_0x72b3('0xc'),_0x72b3('0x9')],'include':[{'model':db[_0x72b3('0x35')],'as':'Smtp','include':[{'model':db[_0x72b3('0x36')],'as':'CloudProvider'}]}]}]})[_0x72b3('0x2e')](function(_0x34023e){var _0x5f5886=_['keys'](manager[_0x72b3('0x37')]);var _0x59a068=_[_0x72b3('0x38')](_0x34023e,function(_0x14d977){return _0x14d977['id'][_0x72b3('0x39')]();});var _0x5f137e=_[_0x72b3('0x3a')](_0x34023e,function(_0x188828){return _0x188828['id'][_0x72b3('0x39')]();});var _0x3c60ae=_0x355270?_0x59a068:_[_0x72b3('0x3b')](_0x59a068,_0x5f5886);var _0xdd6c38=_['intersection'](_0x59a068,_0x5f5886);var _0x5bfddd=_[_0x72b3('0x3b')](_0x5f5886,_0x59a068);var _0x46a045;var _0x5bc5f6;for(_0x46a045=0x0;_0x46a045<_0x5bfddd[_0x72b3('0x3c')]&&!_0x355270;_0x46a045+=0x1){_0x5bc5f6=_0x5bfddd[_0x46a045][_0x72b3('0x39')]();if(manager[_0x72b3('0x3d')](_0x5bc5f6)){manager[_0x72b3('0x3e')](_0x5bc5f6);manager[_0x72b3('0x3f')](_0x5bc5f6);logger['info'](_0x72b3('0x40'),_0x5bc5f6);}}logger[_0x72b3('0x21')](_0x72b3('0x41'),JSON[_0x72b3('0x23')](_0x3c60ae));for(_0x46a045=0x0;_0x46a045<_0x3c60ae[_0x72b3('0x3c')];_0x46a045+=0x1){_0x5bc5f6=_0x3c60ae[_0x46a045]['toString']();logger['info'](_0x72b3('0x42'),_0x5bc5f6);if(_0x355270){logger[_0x72b3('0x21')]('my\x20id',_0x355270);logger[_0x72b3('0x21')](JSON[_0x72b3('0x23')](_0x5f137e[_0x5bc5f6]));BPromise[_0x72b3('0x43')]()[_0x72b3('0x2e')](handleJob(_0x5f137e[_0x5bc5f6]));logger[_0x72b3('0x21')](_0x72b3('0x44'),_0x5f137e[_0x5bc5f6]['name'],_0x5f137e[_0x5bc5f6][_0x72b3('0x45')]);}else if(_0x5f137e[_0x5bc5f6][_0x72b3('0x45')]&&_0x5f137e[_0x5bc5f6][_0x72b3('0x46')]&&moment()['isBetween'](_0x5f137e[_0x5bc5f6]['startAt'],_0x5f137e[_0x5bc5f6][_0x72b3('0x47')])){manager[_0x72b3('0x48')](_0x5bc5f6,_0x5f137e[_0x5bc5f6][_0x72b3('0x45')],handleJob(_0x5f137e[_0x5bc5f6]));manager['start'](_0x5bc5f6);logger[_0x72b3('0x21')](_0x72b3('0x49'),_0x5f137e[_0x5bc5f6]['name'],_0x5f137e[_0x5bc5f6][_0x72b3('0x45')]);}else if(manager[_0x72b3('0x3d')](_0x5bc5f6)){manager[_0x72b3('0x3e')](_0x5bc5f6);manager[_0x72b3('0x3f')](_0x5bc5f6);logger[_0x72b3('0x21')]('stop\x20cron',_0x5f137e[_0x5bc5f6][_0x72b3('0xc')],_0x5f137e[_0x5bc5f6][_0x72b3('0x45')]);}}for(_0x46a045=0x0,_0x5bc5f6;_0x46a045<_0xdd6c38[_0x72b3('0x3c')]&&!_0x355270;_0x46a045+=0x1){_0x5bc5f6=_0xdd6c38[_0x46a045][_0x72b3('0x39')]();if(manager['exists'](_0x5bc5f6)){if(_0x5f137e[_0x5bc5f6][_0x72b3('0x45')]&&_0x5f137e[_0x5bc5f6][_0x72b3('0x46')]&&moment()['isBetween'](_0x5f137e[_0x5bc5f6]['startAt'],_0x5f137e[_0x5bc5f6][_0x72b3('0x47')])){manager[_0x72b3('0x4a')](_0x5bc5f6,_0x5f137e[_0x5bc5f6][_0x72b3('0x45')],handleJob(_0x5f137e[_0x5bc5f6]));logger['info'](_0x72b3('0x4b'),_0x5f137e[_0x5bc5f6]['name'],_0x5f137e[_0x5bc5f6][_0x72b3('0x45')]);}else{manager['stop'](_0x5bc5f6);manager[_0x72b3('0x3f')](_0x5bc5f6);logger[_0x72b3('0x21')]('stop\x20cron',_0x5f137e[_0x5bc5f6][_0x72b3('0xc')],_0x5f137e[_0x5bc5f6][_0x72b3('0x45')]);}}}})[_0x72b3('0x2f')](function(_0x2251dd){logger[_0x72b3('0x22')](JSON[_0x72b3('0x23')](_0x2251dd));});}exports['run']=function(_0x30c521){return getJobs(_0x30c521);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0592=['../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','MailAccount','getSmtpOptions','format','name','email','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','status','Sent','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','existsSync','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','then','error','stringify','email\x20sent','error\x20mail','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','intersection','difference','length','stop','delete\x20cron','toRun','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','exists','stop\x20cron','update','deleteJob','run','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger'];(function(_0x2d99f0,_0x1f0ac7){var _0x4545b7=function(_0x27b022){while(--_0x27b022){_0x2d99f0['push'](_0x2d99f0['shift']());}};_0x4545b7(++_0x1f0ac7);}(_0x0592,0x18e));var _0x2059=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0592[_0xfae23b];return _0x200640;};'use strict';var fs=require('fs');var util=require(_0x2059('0x0'));var path=require(_0x2059('0x1'));var _=require(_0x2059('0x2'));var moment=require(_0x2059('0x3'));var CronJobManager=require(_0x2059('0x4'));var jayson=require(_0x2059('0x5'));var BPromise=require('bluebird');var logger=require(_0x2059('0x6'))('schedule');var db=require(_0x2059('0x7'))['db'];var analyticCustomReportController=require(_0x2059('0x8'));var analyticDefaultReportController=require(_0x2059('0x9'));var client=jayson[_0x2059('0xa')][_0x2059('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x71adbb,_0x2653a4){return function(){logger[_0x2059('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x71adbb['email']);var _0xc9c4d9=!![];var _0x46fb1e=_0x71adbb[_0x2059('0xd')][_0x2059('0xe')]();var _0x17d9aa={'account':_0x46fb1e,'message':{'from':util[_0x2059('0xf')]('\x22%s\x22\x20<%s>',_0x71adbb[_0x2059('0xd')][_0x2059('0x10')],_0x71adbb[_0x2059('0xd')][_0x2059('0x11')]||_0x71adbb[_0x2059('0xd')][_0x2059('0x12')][_0x2059('0x13')]),'to':_0x71adbb['email'],'cc':_0x71adbb['cc'],'bcc':_0x71adbb['bcc'],'subject':util[_0x2059('0xf')](_0x2059('0x14'),_0x2653a4[_0x2059('0x10')],_0x71adbb[_0x2059('0x15')],_0x71adbb[_0x2059('0x16')])}};var _0x58e01c=path[_0x2059('0x17')](__dirname,_0x2059('0x18'));var _0x2f8f94=_0x2653a4[_0x2059('0x19')];var _0x140188=util[_0x2059('0xf')](_0x2059('0x1a'),path[_0x2059('0x1b')](_0x2653a4[_0x2059('0x19')],path['extname'](_0x2653a4['savename'])),_0x2059('0x1c'));var _0x55c384=path[_0x2059('0x17')](_0x58e01c,_0x2f8f94);var _0x1479f2=path[_0x2059('0x17')](_0x58e01c,_0x140188);if(fs['existsSync'](_0x55c384)){_0x2653a4[_0x2059('0x1d')]=_0x2059('0x1e');_0x17d9aa[_0x2059('0x1f')][_0x2059('0x20')]=[{'filename':_0x2f8f94,'path':_0x55c384}];_0x17d9aa[_0x2059('0x1f')][_0x2059('0x21')]=util[_0x2059('0xf')](_0x2059('0x22'),JSON['stringify'](_0x2653a4,null,0x2));}else if(fs[_0x2059('0x23')](_0x1479f2)){_0x2653a4['status']=_0x2059('0x1e');_0x17d9aa['message']['attachments']=[{'filename':_0x140188,'path':_0x1479f2}];}else{_0x17d9aa[_0x2059('0x1f')][_0x2059('0x21')]=_0x2059('0x24');if(!_0x71adbb[_0x2059('0x25')]){_0xc9c4d9=![];logger[_0x2059('0xc')](_0x2059('0x26'));}}if(_0xc9c4d9){return client[_0x2059('0x27')]('SendMail',_0x17d9aa)[_0x2059('0x28')](function(_0x4150eb){if(_0x4150eb[_0x2059('0x29')]){return logger[_0x2059('0x29')]('error\x20mail',JSON[_0x2059('0x2a')](_0x4150eb));}return logger[_0x2059('0xc')](_0x2059('0x2b'));})['catch'](function(_0x584370){return logger[_0x2059('0x29')](_0x2059('0x2c'),JSON[_0x2059('0x2a')](_0x584370));});}};}function handleError(){return function(_0xb689eb){return logger[_0x2059('0x29')](JSON[_0x2059('0x2a')](_0xb689eb));};}function handleResult(_0x11eea3){return function(_0x576a94){logger[_0x2059('0xc')]('data',JSON[_0x2059('0x2a')](_0x576a94));if(_0x11eea3[_0x2059('0xd')]&&_0x11eea3[_0x2059('0xd')][_0x2059('0x12')]&&!_[_0x2059('0x2d')](_0x11eea3[_0x2059('0x11')])){setTimeout(handleSendEmail(_0x11eea3,_0x576a94),0x3c*0x3e8);}};}function handleJob(_0x492228){return function(){try{if(_[_0x2059('0x2d')](_0x492228[_0x2059('0x15')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x2059('0x2d')](_0x492228[_0x2059('0x16')])){return logger[_0x2059('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0xedf313={'startDate':moment()[_0x2059('0x2e')](_0x492228[_0x2059('0x15')],_0x492228[_0x2059('0x16')])[_0x2059('0xf')](_0x2059('0x2f')),'endDate':moment()[_0x2059('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x2059('0x30'),'output':_0x492228[_0x2059('0x31')],'name':_0x492228[_0x2059('0x10')]};if(!_['isNil'](_0x492228[_0x2059('0x32')])){logger[_0x2059('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x492228['DefaultReportId']);return analyticDefaultReportController[_0x2059('0x33')]({'id':_0x492228['DefaultReportId']},_0xedf313)['then'](handleResult(_0x492228))[_0x2059('0x34')](handleError());}if(!_[_0x2059('0x2d')](_0x492228['CustomReportId'])){logger[_0x2059('0xc')]('exec\x20custom\x20report\x20id:%s',_0x492228[_0x2059('0x35')]);return analyticCustomReportController[_0x2059('0x33')]({'id':_0x492228['CustomReportId']},_0xedf313)['then'](handleResult(_0x492228))[_0x2059('0x34')](handleError());}}catch(_0x3ec070){logger[_0x2059('0x29')](JSON['stringify'](_0x3ec070));}return logger[_0x2059('0xc')]('no\x20report\x20id');};}function getJobs(_0x42a899){var _0x1301f5={};if(_0x42a899){_0x1301f5['id']=_0x42a899;}return db[_0x2059('0x36')][_0x2059('0x37')]({'where':_0x1301f5,'include':[{'model':db[_0x2059('0xd')],'attributes':['id',_0x2059('0x10'),_0x2059('0x11')],'include':[{'model':db[_0x2059('0x38')],'as':_0x2059('0x12'),'include':[{'model':db[_0x2059('0x39')],'as':_0x2059('0x39')}]}]}]})[_0x2059('0x28')](function(_0x27ae65){var _0x959d8a=_[_0x2059('0x3a')](manager['jobs']);var _0x4c57af=_[_0x2059('0x3b')](_0x27ae65,function(_0x5c0a75){return _0x5c0a75['id']['toString']();});var _0x3484ed=_['keyBy'](_0x27ae65,function(_0x47bc64){return _0x47bc64['id'][_0x2059('0x3c')]();});var _0x59a541=_0x42a899?_0x4c57af:_['difference'](_0x4c57af,_0x959d8a);var _0x528e51=_[_0x2059('0x3d')](_0x4c57af,_0x959d8a);var _0x173aa1=_[_0x2059('0x3e')](_0x959d8a,_0x4c57af);var _0x3823b7;var _0x21eaa9;for(_0x3823b7=0x0;_0x3823b7<_0x173aa1[_0x2059('0x3f')]&&!_0x42a899;_0x3823b7+=0x1){_0x21eaa9=_0x173aa1[_0x3823b7][_0x2059('0x3c')]();if(manager['exists'](_0x21eaa9)){manager[_0x2059('0x40')](_0x21eaa9);manager['deleteJob'](_0x21eaa9);logger[_0x2059('0xc')](_0x2059('0x41'),_0x21eaa9);}}logger['info'](_0x2059('0x42'),JSON[_0x2059('0x2a')](_0x59a541));for(_0x3823b7=0x0;_0x3823b7<_0x59a541[_0x2059('0x3f')];_0x3823b7+=0x1){_0x21eaa9=_0x59a541[_0x3823b7][_0x2059('0x3c')]();logger[_0x2059('0xc')]('index',_0x21eaa9);if(_0x42a899){logger['info']('my\x20id',_0x42a899);logger['info'](JSON['stringify'](_0x3484ed[_0x21eaa9]));BPromise[_0x2059('0x43')]()['then'](handleJob(_0x3484ed[_0x21eaa9]));logger[_0x2059('0xc')](_0x2059('0x44'),_0x3484ed[_0x21eaa9][_0x2059('0x10')],_0x3484ed[_0x21eaa9]['cron']);}else if(_0x3484ed[_0x21eaa9][_0x2059('0x45')]&&_0x3484ed[_0x21eaa9]['active']&&moment()[_0x2059('0x46')](_0x3484ed[_0x21eaa9][_0x2059('0x47')],_0x3484ed[_0x21eaa9][_0x2059('0x48')])){manager[_0x2059('0x49')](_0x21eaa9,_0x3484ed[_0x21eaa9]['cron'],handleJob(_0x3484ed[_0x21eaa9]));manager[_0x2059('0x4a')](_0x21eaa9);logger[_0x2059('0xc')](_0x2059('0x4b'),_0x3484ed[_0x21eaa9][_0x2059('0x10')],_0x3484ed[_0x21eaa9][_0x2059('0x45')]);}else if(manager[_0x2059('0x4c')](_0x21eaa9)){manager[_0x2059('0x40')](_0x21eaa9);manager['deleteJob'](_0x21eaa9);logger[_0x2059('0xc')](_0x2059('0x4d'),_0x3484ed[_0x21eaa9][_0x2059('0x10')],_0x3484ed[_0x21eaa9][_0x2059('0x45')]);}}for(_0x3823b7=0x0,_0x21eaa9;_0x3823b7<_0x528e51[_0x2059('0x3f')]&&!_0x42a899;_0x3823b7+=0x1){_0x21eaa9=_0x528e51[_0x3823b7][_0x2059('0x3c')]();if(manager[_0x2059('0x4c')](_0x21eaa9)){if(_0x3484ed[_0x21eaa9][_0x2059('0x45')]&&_0x3484ed[_0x21eaa9]['active']&&moment()[_0x2059('0x46')](_0x3484ed[_0x21eaa9][_0x2059('0x47')],_0x3484ed[_0x21eaa9][_0x2059('0x48')])){manager[_0x2059('0x4e')](_0x21eaa9,_0x3484ed[_0x21eaa9][_0x2059('0x45')],handleJob(_0x3484ed[_0x21eaa9]));logger[_0x2059('0xc')]('update\x20cron',_0x3484ed[_0x21eaa9][_0x2059('0x10')],_0x3484ed[_0x21eaa9]['cron']);}else{manager[_0x2059('0x40')](_0x21eaa9);manager[_0x2059('0x4f')](_0x21eaa9);logger[_0x2059('0xc')](_0x2059('0x4d'),_0x3484ed[_0x21eaa9][_0x2059('0x10')],_0x3484ed[_0x21eaa9]['cron']);}}}})['catch'](function(_0x260b1a){logger[_0x2059('0x29')](JSON[_0x2059('0x2a')](_0x260b1a));});}exports[_0x2059('0x50')]=function(_0x485737){return getJobs(_0x485737);};exports[_0x2059('0x4a')]=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 fae0181..f650a5c 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 _0xf958=['Negative','Neutral','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','transcribeAccountId','all','lodash','request-promise','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment'];(function(_0x1a1dea,_0x16206e){var _0x35d9e2=function(_0x1fdc40){while(--_0x1fdc40){_0x1a1dea['push'](_0x1a1dea['shift']());}};_0x35d9e2(++_0x16206e);}(_0xf958,0xe6));var _0x8f95=function(_0x187329,_0x4823ea){_0x187329=_0x187329-0x0;var _0x1434eb=_0xf958[_0x187329];return _0x1434eb;};var _=require(_0x8f95('0x0'));var AWS=require('aws-sdk');var rp=require(_0x8f95('0x1'));var util=require('util');var BPromise=require(_0x8f95('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x8f95('0x3'))(_0x8f95('0x4'));function getTranscriptionJob(_0x1aeb7b,_0x482c0c,_0x49d448,_0x32df52){return new Promise(function(_0x10a425,_0x281f38){var _0x5c2af8=new AWS['TranscribeService']({'accessKeyId':_0x482c0c,'secretAccessKey':_0x1aeb7b,'region':_0x49d448});_0x5c2af8[_0x8f95('0x5')]({'TranscriptionJobName':_0x32df52},function(_0x109bed,_0x435b5b){if(_0x109bed){return _0x281f38(_0x109bed);}else{return _0x10a425(_0x435b5b);}});});}function sentiment(_0x19cbd0,_0x3b695c,_0x585025,_0x378eb1,_0x604646){return new Promise(function(_0x56d8e2,_0x382f2c){var _0x4e97bd=new AWS[(_0x8f95('0x6'))]({'accessKeyId':_0x3b695c,'secretAccessKey':_0x19cbd0,'region':_0x585025});_0x4e97bd['detectSentiment']({'Text':_0x378eb1,'LanguageCode':_0x604646[_0x8f95('0x7')](0x0,0x2)},function(_0x3e7423,_0x3ffccb){if(_0x3e7423){return _0x382f2c(_0x3e7423);}else{return _0x56d8e2(_0x3ffccb);}});});}function checkTranscribeJob(_0x506b47,_0x464cff,_0x158a35){var _0x7fc65f;return new BPromise(function(_0x5d4acf,_0x19bcc8){logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0xa'),_0x506b47['id'],_0x506b47[_0x8f95('0xb')]));return getTranscriptionJob(_0x158a35[_0x8f95('0xc')],_0x158a35[_0x8f95('0xd')],_0x464cff['transcribeRegion'],_0x506b47['transcribeName'])['then'](function(_0x56e816){logger['info'](util[_0x8f95('0x9')](_0x8f95('0xe'),_0x506b47['id'],_0x506b47[_0x8f95('0xb')],_0x56e816[_0x8f95('0xf')]['TranscriptionJobStatus']));if(!_0x506b47['fileText']){switch(_0x56e816[_0x8f95('0xf')][_0x8f95('0x10')]){case'COMPLETED':var _0x445db0={'transcribeStatus':_0x56e816[_0x8f95('0xf')][_0x8f95('0x10')],'fileUri':_0x56e816[_0x8f95('0xf')]['Transcript'][_0x8f95('0x11')]};logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x12'),_0x506b47['id']));return rp({'uri':_0x56e816['TranscriptionJob']['Transcript'][_0x8f95('0x11')],'json':!![]})[_0x8f95('0x13')](function(_0x13e7c5){logger[_0x8f95('0x8')](util[_0x8f95('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x506b47['id']));if(_0x13e7c5&&_0x13e7c5[_0x8f95('0x14')]&&_0x13e7c5[_0x8f95('0x14')]['transcripts']&&_0x13e7c5[_0x8f95('0x14')][_0x8f95('0x15')]['length']){_0x445db0[_0x8f95('0x16')]='';for(var _0x4c96eb=0x0;_0x4c96eb<_0x13e7c5[_0x8f95('0x14')][_0x8f95('0x15')]['length'];_0x4c96eb++){_0x445db0[_0x8f95('0x16')]+=_0x13e7c5['results']['transcripts'][_0x4c96eb][_0x8f95('0x17')]+'';}}return _0x506b47['update'](_0x445db0);})[_0x8f95('0x13')](function(){logger['info'](util['format'](_0x8f95('0x18'),_0x506b47['id']));if(!_0x506b47['tempSentiment']){throw new db[(_0x8f95('0x19'))]['ValidationError'](_0x8f95('0x1a'));}if(!_0x464cff[_0x8f95('0x1b')]||!_0x464cff[_0x8f95('0x1c')]||!_0x464cff[_0x8f95('0x1d')]||!_0x464cff[_0x8f95('0x1e')]||!_0x464cff[_0x8f95('0x1f')]){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x21'));}if(!_0x445db0[_0x8f95('0x16')]){throw new Error(_0x8f95('0x22'));}if(_0x464cff['sentimentAccountId']===_0x158a35['id']){return _0x158a35;}else{return db[_0x8f95('0x23')][_0x8f95('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x511043){if(!_0x511043){throw new db[(_0x8f95('0x19'))]['ValidationError'](_0x8f95('0x25'));}if(!_0x511043['data1']||!_0x511043['data2']){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x26'));}_0x7fc65f=_0x511043;logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x27'),_0x506b47['id']));return sentiment(_0x7fc65f[_0x8f95('0xc')],_0x7fc65f[_0x8f95('0xd')],_0x464cff[_0x8f95('0x1d')],_0x445db0[_0x8f95('0x16')],_0x464cff['language']);})[_0x8f95('0x13')](function(_0x53e273){logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x28'),_0x506b47['id']));return _0x506b47[_0x8f95('0x29')]({'sentiment':_0x53e273['Sentiment'],'sPositive':_0x53e273[_0x8f95('0x2a')][_0x8f95('0x2b')],'sNegative':_0x53e273[_0x8f95('0x2a')]['Negative'],'sMixed':_0x53e273['SentimentScore'][_0x8f95('0x2c')],'sNeutral':_0x53e273[_0x8f95('0x2a')]['Neutral']});})[_0x8f95('0x13')](function(){logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x18'),_0x506b47['id']));_0x5d4acf();});case _0x8f95('0x2d'):return _0x506b47[_0x8f95('0x29')]({'transcribeStatus':_0x8f95('0x2d'),'failureReason':_0x56e816[_0x8f95('0xf')][_0x8f95('0x2e')]})[_0x8f95('0x13')](function(){logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x18'),_0x506b47['id']));_0x5d4acf();});default:logger[_0x8f95('0x8')](util['format'](_0x8f95('0x2f'),_0x506b47['id']));break;}}else{return BPromise[_0x8f95('0x30')]()[_0x8f95('0x13')](function(){if(!_0x506b47[_0x8f95('0x31')]){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x1a'));}if(!_0x464cff[_0x8f95('0x1b')]||!_0x464cff[_0x8f95('0x1c')]||!_0x464cff[_0x8f95('0x1d')]||!_0x464cff[_0x8f95('0x1e')]||!_0x464cff[_0x8f95('0x1f')]){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x506b47[_0x8f95('0x16')]){throw new Error(_0x8f95('0x22'));}if(_0x464cff[_0x8f95('0x1c')]===_0x158a35['id']){return _0x158a35;}else{return db[_0x8f95('0x23')][_0x8f95('0x24')]({'where':{'id':_settings[_0x8f95('0x1c')]}});}})[_0x8f95('0x13')](function(_0x423329){if(!_0x423329){throw new db['Sequelize'][(_0x8f95('0x20'))](_0x8f95('0x25'));}if(!_0x423329[_0x8f95('0xc')]||!_0x423329[_0x8f95('0xd')]){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x7fc65f=_0x423329;logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x27'),_0x506b47['id']));return sentiment(_0x7fc65f[_0x8f95('0xc')],_0x7fc65f['data2'],_0x464cff['sentimentRegion'],_0x506b47['fileText'],_0x464cff[_0x8f95('0x1e')]);})[_0x8f95('0x13')](function(_0x50f94a){logger[_0x8f95('0x8')](util['format'](_0x8f95('0x28'),_0x506b47['id']));return _0x506b47[_0x8f95('0x29')]({'sentiment':_0x50f94a['Sentiment'],'sPositive':_0x50f94a[_0x8f95('0x2a')][_0x8f95('0x2b')],'sNegative':_0x50f94a[_0x8f95('0x2a')][_0x8f95('0x32')],'sMixed':_0x50f94a[_0x8f95('0x2a')][_0x8f95('0x2c')],'sNeutral':_0x50f94a[_0x8f95('0x2a')][_0x8f95('0x33')],'transcribeStatus':_0x8f95('0x34')});})[_0x8f95('0x13')](function(){logger['info'](util[_0x8f95('0x9')](_0x8f95('0x18'),_0x506b47['id']));_0x5d4acf();});}})[_0x8f95('0x35')](function(_0x335940){if(_0x335940){if(!_0x335940[_0x8f95('0x36')]||_0x335940[_0x8f95('0x36')]!==_0x8f95('0x37')){logger[_0x8f95('0x38')](util[_0x8f95('0x9')](_0x8f95('0x39'),_0x506b47['id']),util[_0x8f95('0x3a')](_0x335940,{'showHidden':![],'depth':null}));}}_0x5d4acf();});});}function checkTranscribe(){var _0x704c2a;var _0x55f9ae;var _0x335201;return db[_0x8f95('0x3b')][_0x8f95('0x3c')]({'where':{'transcribeStatus':_0x8f95('0x3d')}})[_0x8f95('0x13')](function(_0x4065a8){if(!_0x4065a8||!_0x4065a8[_0x8f95('0x3e')]){throw new db['Sequelize'][(_0x8f95('0x20'))](_0x8f95('0x3f'));}_0x704c2a=_0x4065a8;return db[_0x8f95('0x40')][_0x8f95('0x24')]({'where':{'id':0x1}});})[_0x8f95('0x13')](function(_0x489813){if(!_0x489813){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x41'));}_0x55f9ae=_0x489813;if(!_0x55f9ae[_0x8f95('0x4')]||!_0x55f9ae['transcribeAccountId']||!_0x55f9ae[_0x8f95('0x42')]||!_0x55f9ae[_0x8f95('0x1e')]||!_0x55f9ae[_0x8f95('0x1f')]){throw new db[(_0x8f95('0x19'))]['ValidationError'](_0x8f95('0x43'));}return db[_0x8f95('0x23')][_0x8f95('0x24')]({'where':{'id':_0x55f9ae[_0x8f95('0x44')]}});})[_0x8f95('0x13')](function(_0x43b175){if(!_0x43b175){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x25'));}if(!_0x43b175[_0x8f95('0xc')]||!_0x43b175[_0x8f95('0xd')]){throw new db['Sequelize']['ValidationError'](_0x8f95('0x26'));}_0x335201=_0x43b175;var _0x36d15b=[];_0x704c2a['forEach'](function(_0x24545f){_0x36d15b['push'](checkTranscribeJob(_0x24545f,_0x55f9ae,_0x335201));});return BPromise[_0x8f95('0x45')](_0x36d15b);})[_0x8f95('0x35')](function(_0x4b3c05){if(_0x4b3c05){if(!_0x4b3c05['name']||_0x4b3c05[_0x8f95('0x36')]!==_0x8f95('0x37')){logger['error'](util[_0x8f95('0x3a')](_0x4b3c05,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9c00=['length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Transcript\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','bucket','Transcribe\x20not\x20configured','transcribeAccountId','push','all','start','lodash','aws-sdk','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results'];(function(_0xa75afc,_0x529ad3){var _0x15e93c=function(_0x136892){while(--_0x136892){_0xa75afc['push'](_0xa75afc['shift']());}};_0x15e93c(++_0x529ad3);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5874ca,_0xf90b52){_0x5874ca=_0x5874ca-0x0;var _0x4b41d7=_0x9c00[_0x5874ca];return _0x4b41d7;};var _=require(_0x09c0('0x0'));var AWS=require(_0x09c0('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0x09c0('0x2'));var db=require(_0x09c0('0x3'))['db'];var logger=require('../../config/logger')(_0x09c0('0x4'));function getTranscriptionJob(_0x2c702c,_0x2ed715,_0x2fd03e,_0x1cbf99){return new Promise(function(_0x5914eb,_0x4d5fc3){var _0x1f3d7e=new AWS[(_0x09c0('0x5'))]({'accessKeyId':_0x2ed715,'secretAccessKey':_0x2c702c,'region':_0x2fd03e});_0x1f3d7e[_0x09c0('0x6')]({'TranscriptionJobName':_0x1cbf99},function(_0x3187aa,_0x17cd9d){if(_0x3187aa){return _0x4d5fc3(_0x3187aa);}else{return _0x5914eb(_0x17cd9d);}});});}function sentiment(_0x49487a,_0x6558ca,_0x1c1246,_0xa20b5c,_0x1feb1d){return new Promise(function(_0x27a33c,_0x1e16f4){var _0x1fec4f=new AWS[(_0x09c0('0x7'))]({'accessKeyId':_0x6558ca,'secretAccessKey':_0x49487a,'region':_0x1c1246});_0x1fec4f[_0x09c0('0x8')]({'Text':_0xa20b5c,'LanguageCode':_0x1feb1d[_0x09c0('0x9')](0x0,0x2)},function(_0x179b1b,_0x2a8262){if(_0x179b1b){return _0x1e16f4(_0x179b1b);}else{return _0x27a33c(_0x2a8262);}});});}function checkTranscribeJob(_0x2929f1,_0x144271,_0x3b95cc){var _0x331905;return new BPromise(function(_0x6149a8,_0x2a86da){logger[_0x09c0('0xa')](util[_0x09c0('0xb')](_0x09c0('0xc'),_0x2929f1['id'],_0x2929f1[_0x09c0('0xd')]));return getTranscriptionJob(_0x3b95cc[_0x09c0('0xe')],_0x3b95cc[_0x09c0('0xf')],_0x144271[_0x09c0('0x10')],_0x2929f1[_0x09c0('0xd')])['then'](function(_0x590129){logger['info'](util[_0x09c0('0xb')](_0x09c0('0x11'),_0x2929f1['id'],_0x2929f1[_0x09c0('0xd')],_0x590129[_0x09c0('0x12')]['TranscriptionJobStatus']));if(!_0x2929f1[_0x09c0('0x13')]){switch(_0x590129['TranscriptionJob']['TranscriptionJobStatus']){case _0x09c0('0x14'):var _0x50fccc={'transcribeStatus':_0x590129[_0x09c0('0x12')][_0x09c0('0x15')],'fileUri':_0x590129[_0x09c0('0x12')]['Transcript'][_0x09c0('0x16')]};logger[_0x09c0('0xa')](util[_0x09c0('0xb')](_0x09c0('0x17'),_0x2929f1['id']));return rp({'uri':_0x590129[_0x09c0('0x12')][_0x09c0('0x18')][_0x09c0('0x16')],'json':!![]})['then'](function(_0x1695e8){logger[_0x09c0('0xa')](util[_0x09c0('0xb')](_0x09c0('0x19'),_0x2929f1['id']));if(_0x1695e8&&_0x1695e8['results']&&_0x1695e8['results'][_0x09c0('0x1a')]&&_0x1695e8[_0x09c0('0x1b')][_0x09c0('0x1a')][_0x09c0('0x1c')]){_0x50fccc['fileText']='';for(var _0x42ebfc=0x0;_0x42ebfc<_0x1695e8[_0x09c0('0x1b')]['transcripts'][_0x09c0('0x1c')];_0x42ebfc++){_0x50fccc[_0x09c0('0x13')]+=_0x1695e8[_0x09c0('0x1b')][_0x09c0('0x1a')][_0x42ebfc][_0x09c0('0x1d')]+'';}}return _0x2929f1[_0x09c0('0x1e')](_0x50fccc);})[_0x09c0('0x1f')](function(){logger[_0x09c0('0xa')](util[_0x09c0('0xb')](_0x09c0('0x20'),_0x2929f1['id']));if(!_0x2929f1[_0x09c0('0x21')]){throw new db['Sequelize'][(_0x09c0('0x22'))](_0x09c0('0x23'));}if(!_0x144271['sentiment']||!_0x144271[_0x09c0('0x24')]||!_0x144271['sentimentRegion']||!_0x144271[_0x09c0('0x25')]||!_0x144271['bucket']){throw new db[(_0x09c0('0x26'))][(_0x09c0('0x22'))](_0x09c0('0x27'));}if(!_0x50fccc[_0x09c0('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x144271['sentimentAccountId']===_0x3b95cc['id']){return _0x3b95cc;}else{return db[_0x09c0('0x28')][_0x09c0('0x29')]({'where':{'id':_settings[_0x09c0('0x24')]}});}})['then'](function(_0x321ee6){if(!_0x321ee6){throw new db['Sequelize'][(_0x09c0('0x22'))](_0x09c0('0x2a'));}if(!_0x321ee6[_0x09c0('0xe')]||!_0x321ee6['data2']){throw new db[(_0x09c0('0x26'))][(_0x09c0('0x22'))](_0x09c0('0x2b'));}_0x331905=_0x321ee6;logger[_0x09c0('0xa')](util[_0x09c0('0xb')](_0x09c0('0x2c'),_0x2929f1['id']));return sentiment(_0x331905[_0x09c0('0xe')],_0x331905['data2'],_0x144271[_0x09c0('0x2d')],_0x50fccc[_0x09c0('0x13')],_0x144271[_0x09c0('0x25')]);})[_0x09c0('0x1f')](function(_0x2c1ad3){logger['info'](util[_0x09c0('0xb')](_0x09c0('0x2e'),_0x2929f1['id']));return _0x2929f1[_0x09c0('0x1e')]({'sentiment':_0x2c1ad3[_0x09c0('0x2f')],'sPositive':_0x2c1ad3[_0x09c0('0x30')]['Positive'],'sNegative':_0x2c1ad3[_0x09c0('0x30')][_0x09c0('0x31')],'sMixed':_0x2c1ad3[_0x09c0('0x30')][_0x09c0('0x32')],'sNeutral':_0x2c1ad3[_0x09c0('0x30')][_0x09c0('0x33')]});})[_0x09c0('0x1f')](function(){logger['info'](util[_0x09c0('0xb')](_0x09c0('0x20'),_0x2929f1['id']));_0x6149a8();});case _0x09c0('0x34'):return _0x2929f1[_0x09c0('0x1e')]({'transcribeStatus':_0x09c0('0x34'),'failureReason':_0x590129['TranscriptionJob']['FailureReason']})['then'](function(){logger['info'](util[_0x09c0('0xb')](_0x09c0('0x20'),_0x2929f1['id']));_0x6149a8();});default:logger[_0x09c0('0xa')](util[_0x09c0('0xb')](_0x09c0('0x35'),_0x2929f1['id']));break;}}else{return BPromise['resolve']()[_0x09c0('0x1f')](function(){if(!_0x2929f1[_0x09c0('0x21')]){throw new db['Sequelize'][(_0x09c0('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x144271[_0x09c0('0x36')]||!_0x144271['sentimentAccountId']||!_0x144271[_0x09c0('0x2d')]||!_0x144271[_0x09c0('0x25')]||!_0x144271['bucket']){throw new db[(_0x09c0('0x26'))][(_0x09c0('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2929f1[_0x09c0('0x13')]){throw new Error(_0x09c0('0x37'));}if(_0x144271[_0x09c0('0x24')]===_0x3b95cc['id']){return _0x3b95cc;}else{return db[_0x09c0('0x28')][_0x09c0('0x29')]({'where':{'id':_settings[_0x09c0('0x24')]}});}})['then'](function(_0x24bb97){if(!_0x24bb97){throw new db[(_0x09c0('0x26'))][(_0x09c0('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x24bb97[_0x09c0('0xe')]||!_0x24bb97[_0x09c0('0xf')]){throw new db[(_0x09c0('0x26'))]['ValidationError'](_0x09c0('0x2b'));}_0x331905=_0x24bb97;logger[_0x09c0('0xa')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2929f1['id']));return sentiment(_0x331905[_0x09c0('0xe')],_0x331905[_0x09c0('0xf')],_0x144271['sentimentRegion'],_0x2929f1[_0x09c0('0x13')],_0x144271[_0x09c0('0x25')]);})['then'](function(_0xbabba1){logger[_0x09c0('0xa')](util[_0x09c0('0xb')](_0x09c0('0x2e'),_0x2929f1['id']));return _0x2929f1[_0x09c0('0x1e')]({'sentiment':_0xbabba1['Sentiment'],'sPositive':_0xbabba1[_0x09c0('0x30')]['Positive'],'sNegative':_0xbabba1['SentimentScore'][_0x09c0('0x31')],'sMixed':_0xbabba1[_0x09c0('0x30')][_0x09c0('0x32')],'sNeutral':_0xbabba1[_0x09c0('0x30')][_0x09c0('0x33')],'transcribeStatus':_0x09c0('0x14')});})['then'](function(){logger['info'](util['format'](_0x09c0('0x20'),_0x2929f1['id']));_0x6149a8();});}})[_0x09c0('0x38')](function(_0x2bd700){if(_0x2bd700){if(!_0x2bd700['name']||_0x2bd700[_0x09c0('0x39')]!==_0x09c0('0x3a')){logger[_0x09c0('0x3b')](util[_0x09c0('0xb')](_0x09c0('0x3c'),_0x2929f1['id']),util[_0x09c0('0x3d')](_0x2bd700,{'showHidden':![],'depth':null}));}}_0x6149a8();});});}function checkTranscribe(){var _0x298ab4;var _0x2b3c56;var _0x3f6d14;return db[_0x09c0('0x3e')][_0x09c0('0x3f')]({'where':{'transcribeStatus':_0x09c0('0x40')}})[_0x09c0('0x1f')](function(_0xa5eb6e){if(!_0xa5eb6e||!_0xa5eb6e[_0x09c0('0x1c')]){throw new db[(_0x09c0('0x26'))][(_0x09c0('0x22'))](_0x09c0('0x41'));}_0x298ab4=_0xa5eb6e;return db[_0x09c0('0x42')][_0x09c0('0x29')]({'where':{'id':0x1}});})['then'](function(_0x4acf54){if(!_0x4acf54){throw new db[(_0x09c0('0x26'))][(_0x09c0('0x22'))](_0x09c0('0x43'));}_0x2b3c56=_0x4acf54;if(!_0x2b3c56[_0x09c0('0x4')]||!_0x2b3c56['transcribeAccountId']||!_0x2b3c56[_0x09c0('0x10')]||!_0x2b3c56[_0x09c0('0x25')]||!_0x2b3c56[_0x09c0('0x44')]){throw new db['Sequelize'][(_0x09c0('0x22'))](_0x09c0('0x45'));}return db[_0x09c0('0x28')][_0x09c0('0x29')]({'where':{'id':_0x2b3c56[_0x09c0('0x46')]}});})[_0x09c0('0x1f')](function(_0x45ecd0){if(!_0x45ecd0){throw new db['Sequelize'][(_0x09c0('0x22'))](_0x09c0('0x2a'));}if(!_0x45ecd0[_0x09c0('0xe')]||!_0x45ecd0[_0x09c0('0xf')]){throw new db[(_0x09c0('0x26'))][(_0x09c0('0x22'))](_0x09c0('0x2b'));}_0x3f6d14=_0x45ecd0;var _0x4987cf=[];_0x298ab4['forEach'](function(_0xe72bef){_0x4987cf[_0x09c0('0x47')](checkTranscribeJob(_0xe72bef,_0x2b3c56,_0x3f6d14));});return BPromise[_0x09c0('0x48')](_0x4987cf);})['catch'](function(_0x1af651){if(_0x1af651){if(!_0x1af651['name']||_0x1af651[_0x09c0('0x39')]!==_0x09c0('0x3a')){logger[_0x09c0('0x3b')](util[_0x09c0('0x3d')](_0x1af651,{'showHidden':![],'depth':null}));}}});}exports[_0x09c0('0x49')]=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 a35aade..5c1c4f2 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 _0x6645=['length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','format','then','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract'];(function(_0x344784,_0xbd0943){var _0x2ae6f=function(_0x2b5eb7){while(--_0x2b5eb7){_0x344784['push'](_0x344784['shift']());}};_0x2ae6f(++_0xbd0943);}(_0x6645,0xcb));var _0x5664=function(_0x4f691f,_0x477e72){_0x4f691f=_0x4f691f-0x0;var _0x4ef633=_0x6645[_0x4f691f];return _0x4ef633;};'use strict';var _=require(_0x5664('0x0'));var moment=require(_0x5664('0x1'));var Redis=require(_0x5664('0x2'));var util=require(_0x5664('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x5664('0x4'))('schedule');config[_0x5664('0x5')]=_[_0x5664('0x6')](config[_0x5664('0x5')],{'host':_0x5664('0x7'),'port':0x18eb});var io=require(_0x5664('0x8'))(new Redis(config[_0x5664('0x5')]));function closeInteractions(){var _0x390407=[];return db[_0x5664('0x9')][_0x5664('0xa')]({'raw':!![],'attributes':['id',_0x5664('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5664('0xc')](0x18,'hours')}}})['then'](function(_0x1d8d3d){if(_0x1d8d3d&&_0x1d8d3d[_0x5664('0xd')]){_0x390407=_[_0x5664('0xe')](_0x1d8d3d||[],'id');logger[_0x5664('0xf')](_0x5664('0x10'),_0x390407['join']());return db[_0x5664('0x9')][_0x5664('0x11')]({'closeReason':_0x5664('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x5664('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x390407}});}})[_0x5664('0x14')](function(){if(_0x390407&&_0x390407['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x390407['join']());for(var _0x205704=0x0;_0x205704<_0x390407[_0x5664('0xd')];_0x205704++){io[_0x5664('0x15')](_0x5664('0x16'),{'id':_0x390407[_0x205704],'closed':!![]});}}})[_0x5664('0x17')](function(_0x55b4af){logger[_0x5664('0x18')](_0x5664('0x19'),_0x55b4af?util['inspect'](_0x55b4af,{'showHidden':![],'depth':null}):'');});}exports[_0x5664('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x94a0=['util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','then','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis'];(function(_0x39cdb8,_0x15ee98){var _0x44bbc9=function(_0x395338){while(--_0x395338){_0x39cdb8['push'](_0x39cdb8['shift']());}};_0x44bbc9(++_0x15ee98);}(_0x94a0,0x85));var _0x094a=function(_0x25c73d,_0x986f2b){_0x25c73d=_0x25c73d-0x0;var _0x4c0313=_0x94a0[_0x25c73d];return _0x4c0313;};'use strict';var _=require(_0x094a('0x0'));var moment=require('moment');var Redis=require(_0x094a('0x1'));var util=require(_0x094a('0x2'));var config=require('../../config/environment');var db=require(_0x094a('0x3'))['db'];var logger=require('../logger')('schedule');config[_0x094a('0x4')]=_[_0x094a('0x5')](config[_0x094a('0x4')],{'host':_0x094a('0x6'),'port':0x18eb});var io=require(_0x094a('0x7'))(new Redis(config[_0x094a('0x4')]));function closeInteractions(){var _0x1a9464=[];return db[_0x094a('0x8')][_0x094a('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x094a('0xa')](0x18,_0x094a('0xb'))}}})['then'](function(_0x5300eb){if(_0x5300eb&&_0x5300eb['length']){_0x1a9464=_['map'](_0x5300eb||[],'id');logger['info'](_0x094a('0xc'),_0x1a9464[_0x094a('0xd')]());return db['WhatsappInteraction'][_0x094a('0xe')]({'closeReason':_0x094a('0xf'),'disposition':_0x094a('0x10'),'closed':!![],'closedAt':moment()['format'](_0x094a('0x11'))},{'where':{'id':_0x1a9464}});}})[_0x094a('0x12')](function(){if(_0x1a9464&&_0x1a9464[_0x094a('0x13')]){logger[_0x094a('0x14')](_0x094a('0x15'),_0x1a9464[_0x094a('0xd')]());for(var _0x4f0676=0x0;_0x4f0676<_0x1a9464[_0x094a('0x13')];_0x4f0676++){io[_0x094a('0x16')](_0x094a('0x17'),{'id':_0x1a9464[_0x4f0676],'closed':!![]});}}})['catch'](function(_0x3795de){logger[_0x094a('0x18')](_0x094a('0x19'),_0x3795de?util[_0x094a('0x1a')](_0x3795de,{'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 846e0a8..57d5649 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15d5=['CmHopper','bulkCreate','finished\x20populating','hopper1','contacts2','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','log','contacts1'];(function(_0x2b9133,_0x444838){var _0x1a2b3a=function(_0x16f4c1){while(--_0x16f4c1){_0x2b9133['push'](_0x2b9133['shift']());}};_0x1a2b3a(++_0x444838);}(_0x15d5,0x165));var _0x515d=function(_0x5a77bd,_0x15e831){_0x5a77bd=_0x5a77bd-0x0;var _0x120cd2=_0x15d5[_0x5a77bd];return _0x120cd2;};'use strict';var util=require('util');var db=require(_0x515d('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x515d('0x1')]({'id':i,'firstName':_0x515d('0x2')+i,'lastName':_0x515d('0x3')+i,'phone':0xf879fb460+i,'email':_0x515d('0x4')+i+_0x515d('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x515d('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x515d('0x6')](),'updatedAt':Date[_0x515d('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x515d('0x2')+i,'lastName':_0x515d('0x3')+i,'phone':0xf879fb460+i,'email':_0x515d('0x4')+i+_0x515d('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x515d('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x515d('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x515d('0x6')](),'updatedAt':Date[_0x515d('0x6')]()});}db[_0x515d('0x7')]['destroy']({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x515d('0x8')](function(){console[_0x515d('0x9')]('finished\x20populating',_0x515d('0xa'));return db[_0x515d('0xb')]['destroy']({'where':{}});})['then'](function(){return db[_0x515d('0xb')][_0x515d('0xc')](hopper);})[_0x515d('0x8')](function(){console[_0x515d('0x9')](_0x515d('0xd'),_0x515d('0xe'));return db['CmContact'][_0x515d('0xc')](contacts2);})[_0x515d('0x8')](function(){console[_0x515d('0x9')]('finished\x20populating',_0x515d('0xf'));return db[_0x515d('0xb')][_0x515d('0xc')](hopper2);})[_0x515d('0x8')](function(){console[_0x515d('0x9')](_0x515d('0xd'),'hopper2');})['catch'](function(_0x4bbaa9){console[_0x515d('0x9')](_0x4bbaa9);}); \ No newline at end of file +var _0x7e61=['catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','destroy','then','CmContact','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','hopper2'];(function(_0x221d99,_0xfa9179){var _0x2d4f4e=function(_0x397b51){while(--_0x397b51){_0x221d99['push'](_0x221d99['shift']());}};_0x2d4f4e(++_0xfa9179);}(_0x7e61,0xb5));var _0x17e6=function(_0x3be27c,_0x24f9ea){_0x3be27c=_0x3be27c-0x0;var _0x4d620a=_0x7e61[_0x3be27c];return _0x4d620a;};'use strict';var util=require('util');var db=require(_0x17e6('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x17e6('0x1')]({'id':i,'firstName':_0x17e6('0x2')+i,'lastName':_0x17e6('0x3')+i,'phone':0xf879fb460+i,'email':_0x17e6('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x17e6('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x17e6('0x5')](),'updatedAt':Date[_0x17e6('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x17e6('0x1')]({'id':i,'firstName':_0x17e6('0x2')+i,'lastName':_0x17e6('0x3')+i,'phone':0xf879fb460+i,'email':_0x17e6('0x4')+i+_0x17e6('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x17e6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x17e6('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x17e6('0x5')](),'updatedAt':Date['now']()});}db['CmContact'][_0x17e6('0x7')]({'where':{}})[_0x17e6('0x8')](function(){return db[_0x17e6('0x9')][_0x17e6('0xa')](contacts);})[_0x17e6('0x8')](function(){console[_0x17e6('0xb')]('finished\x20populating',_0x17e6('0xc'));return db[_0x17e6('0xd')][_0x17e6('0x7')]({'where':{}});})[_0x17e6('0x8')](function(){return db[_0x17e6('0xd')][_0x17e6('0xa')](hopper);})[_0x17e6('0x8')](function(){console['log'](_0x17e6('0xe'),_0x17e6('0xf'));return db[_0x17e6('0x9')][_0x17e6('0xa')](contacts2);})['then'](function(){console[_0x17e6('0xb')](_0x17e6('0xe'),'contacts2');return db[_0x17e6('0xd')][_0x17e6('0xa')](hopper2);})['then'](function(){console[_0x17e6('0xb')]('finished\x20populating',_0x17e6('0x10'));})[_0x17e6('0x11')](function(_0xc10e79){console[_0x17e6('0xb')](_0xc10e79);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 4b716a6..7dbaf5d 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3f2=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all'];(function(_0x332f1e,_0x276841){var _0x372a9a=function(_0x1c1eb2){while(--_0x1c1eb2){_0x332f1e['push'](_0x332f1e['shift']());}};_0x372a9a(++_0x276841);}(_0xe3f2,0x181));var _0x2e3f=function(_0x46ebdb,_0x251cc0){_0x46ebdb=_0x46ebdb-0x0;var _0x3f9e9e=_0xe3f2[_0x46ebdb];return _0x3f9e9e;};'use strict';var util=require(_0x2e3f('0x0'));var db=require(_0x2e3f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x2e3f('0x2')](_0x2e3f('0x3'),_0x2e3f('0x4'),i),'fullname':util[_0x2e3f('0x2')]('%s%s',_0x2e3f('0x4'),i),'email':util[_0x2e3f('0x2')](_0x2e3f('0x5'),_0x2e3f('0x4'),i),'role':'agent','password':_0x2e3f('0x6'),'internal':0xfa0+i,'type':_0x2e3f('0x7'),'transport':[_0x2e3f('0x8'),'ws',_0x2e3f('0x9')],'disallow':[_0x2e3f('0xa')],'allow':['ulaw'],'defaultuser':util[_0x2e3f('0x2')](_0x2e3f('0x3'),_0x2e3f('0x4'),i),'encryption':_0x2e3f('0xb'),'avpf':_0x2e3f('0xb'),'force_avp':_0x2e3f('0xb'),'icesupport':_0x2e3f('0xb'),'dtlsenable':_0x2e3f('0xb'),'dtlsverify':'no','dtlscertfile':_0x2e3f('0xc'),'dtlsprivatekey':_0x2e3f('0xd'),'dtlssetup':'actpass','callerid':util[_0x2e3f('0x2')](_0x2e3f('0xe'),util[_0x2e3f('0x2')](_0x2e3f('0x3'),_0x2e3f('0x4'),i),0xfa0+i)});}db['User'][_0x2e3f('0xf')](users)[_0x2e3f('0x10')](function(){console['log']('add\x20user');})[_0x2e3f('0x11')](function(_0x439aac){console['log'](_0x439aac);}); \ No newline at end of file +var _0x7746=['add\x20user','catch','push','format','%s%s','agent','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','bulkCreate','then','log'];(function(_0x5ac7d7,_0x109040){var _0x23955f=function(_0x52a2ac){while(--_0x52a2ac){_0x5ac7d7['push'](_0x5ac7d7['shift']());}};_0x23955f(++_0x109040);}(_0x7746,0x68));var _0x6774=function(_0x214bbc,_0x564d3d){_0x214bbc=_0x214bbc-0x0;var _0x1ea0d7=_0x7746[_0x214bbc];return _0x1ea0d7;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6774('0x0')]({'name':util[_0x6774('0x1')](_0x6774('0x2'),_0x6774('0x3'),i),'fullname':util[_0x6774('0x1')](_0x6774('0x2'),'agent',i),'email':util[_0x6774('0x1')]('%s%s@xcally.com',_0x6774('0x3'),i),'role':_0x6774('0x3'),'password':_0x6774('0x4'),'internal':0xfa0+i,'type':_0x6774('0x5'),'transport':[_0x6774('0x6'),'ws','wss'],'disallow':[_0x6774('0x7')],'allow':[_0x6774('0x8')],'defaultuser':util[_0x6774('0x1')]('%s%s','agent',i),'encryption':_0x6774('0x9'),'avpf':_0x6774('0x9'),'force_avp':_0x6774('0x9'),'icesupport':_0x6774('0x9'),'dtlsenable':_0x6774('0x9'),'dtlsverify':'no','dtlscertfile':_0x6774('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x6774('0x1')](_0x6774('0xb'),util['format'](_0x6774('0x2'),_0x6774('0x3'),i),0xfa0+i)});}db['User'][_0x6774('0xc')](users)[_0x6774('0xd')](function(){console[_0x6774('0xe')](_0x6774('0xf'));})[_0x6774('0x10')](function(_0x1684be){console[_0x6774('0xe')](_0x1684be);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 9702d8c..031611f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa32b=['emit','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remotePort','CONNECTED','lodash','bluebird','name','Agents','User','role','agent','telephone','type','ivr','VoiceQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','then','map','where','format','length','user:%s','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','voice:inbound','SmsQueues','MailQueue','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','chat','fax','sms','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions'];(function(_0x9d854b,_0x4b3416){var _0x3cf5fc=function(_0x38c6fe){while(--_0x38c6fe){_0x9d854b['push'](_0x9d854b['shift']());}};_0x3cf5fc(++_0x4b3416);}(_0xa32b,0x68));var _0xba32=function(_0xb6a965,_0x5c5ace){_0xb6a965=_0xb6a965-0x0;var _0x51d37d=_0xa32b[_0xb6a965];return _0x51d37d;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var BPromise=require(_0xba32('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xba32('0x2')],'include':[{'as':_0xba32('0x3'),'model':db[_0xba32('0x4')],'attributes':['id','name',_0xba32('0x5')],'raw':!![],'where':{'role':_0xba32('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xba32('0x2')],'where':{'role':_0xba32('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xba32('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xba32('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xba32('0x8')],'where':{'type':_0xba32('0x9')}};function getAssociatedResources(_0xeeb52c,_0x157f04,_0x5d8f64){return db['UserProfileSection']['findOne']({'where':{'name':_0xeeb52c,'userProfileId':_0x157f04},'raw':!![]})['then'](function(_0x41e762){if(_0x41e762){if(_0x41e762['autoAssociation']){switch(_0xeeb52c){case _0xba32('0xa'):case'ChatQueues':case _0xba32('0xb'):case'SmsQueues':case'MailQueues':case _0xba32('0xc'):case _0xba32('0xd'):return db[_0x5d8f64][_0xba32('0xe')](queryQueues);case _0xba32('0xf'):return db[_0x5d8f64][_0xba32('0xe')](queryTelephones);case'Trunks':return db[_0x5d8f64][_0xba32('0xe')](queryTrunks);case _0xba32('0x10'):return db[_0x5d8f64][_0xba32('0xe')](queryCampaigns);}}else{return db[_0xba32('0x11')][_0xba32('0xe')]({'attributes':[_0xba32('0x12')],'where':{'sectionId':_0x41e762['id']},'raw':!![]})[_0xba32('0x13')](function(_0x5c0bd8){if(_0x5c0bd8){var _0x176763={'where':{'id':_[_0xba32('0x14')](_0x5c0bd8,_0xba32('0x12'))},'raw':!![]};switch(_0x5d8f64){case _0xba32('0x4'):_0x176763[_0xba32('0x15')]['role']='telephone';break;case'Campaign':_0x176763['where'][_0xba32('0x8')]=_0xba32('0x9');break;}return db[_0x5d8f64][_0xba32('0xe')](_0x176763);}else{return[];}});}}else{return[];}})[_0xba32('0x13')](function(_0x751145){return _0x751145;});}function joinOrLeaveQueues(_0x1bcce4,_0x47f903,_0x4f9e48,_0x5bd326){_0x1bcce4[_0x47f903](util[_0xba32('0x16')]('%s:queue:%s',_0x4f9e48,_0x5bd326[_0xba32('0x2')]));if(_0x5bd326[_0xba32('0x3')]){for(var _0x4266dc=0x0;_0x4266dc<_0x5bd326[_0xba32('0x3')][_0xba32('0x17')];_0x4266dc+=0x1){_0x1bcce4[_0x47f903](util[_0xba32('0x16')](_0xba32('0x18'),_0x5bd326['Agents'][_0x4266dc][_0xba32('0x2')]));}}}function joinOrLeave(_0x35f168,_0x34a3cd,_0x171626){var _0x5eb640;if(_0x35f168['handshake'][_0xba32('0x19')]['id']){db[_0xba32('0x4')]['find']({'attributes':['id',_0xba32('0x2'),'role',_0xba32('0x1a')],'where':{'id':_0x35f168[_0xba32('0x1b')][_0xba32('0x19')]['id']},'include':[{'model':db[_0xba32('0x1c')],'as':_0xba32('0x1d'),'attributes':['id'],'raw':!![]},{'model':db[_0xba32('0x1e')],'as':_0xba32('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xba32('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xba32('0x21')],'as':_0xba32('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xba32('0x23')],'as':_0xba32('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xba32('0x25')],'as':_0xba32('0x26'),'attributes':['id'],'raw':!![]}]})[_0xba32('0x13')](function(_0x1ef5ed){if(_0x1ef5ed){_0x5eb640=_0x1ef5ed;_0x35f168[_0x34a3cd](util['format'](_0xba32('0x18'),_0x1ef5ed[_0xba32('0x2')]));var _0x19d88b=[];switch(_0x1ef5ed[_0xba32('0x5')]){case _0xba32('0x27'):_0x35f168[_0x34a3cd]('voice:inbound');_0x35f168[_0x34a3cd](_0xba32('0x28'));if(queryQueues['hasOwnProperty'](_0xba32('0x29'))){delete queryQueues[_0xba32('0x29')];}_0x19d88b['push'](db[_0xba32('0x2a')][_0xba32('0xe')](queryQueues));_0x19d88b[_0xba32('0x2b')](db[_0xba32('0x2c')]['findAll'](queryQueues));_0x19d88b[_0xba32('0x2b')](db[_0xba32('0x2d')]['findAll'](queryQueues));_0x19d88b[_0xba32('0x2b')](db[_0xba32('0x2e')][_0xba32('0xe')](queryQueues));_0x19d88b[_0xba32('0x2b')](db['MailQueue'][_0xba32('0xe')](queryQueues));_0x19d88b['push'](db[_0xba32('0x2f')][_0xba32('0xe')](queryQueues));_0x19d88b[_0xba32('0x2b')](db['WhatsappQueue'][_0xba32('0xe')](queryQueues));_0x19d88b[_0xba32('0x2b')](db['User'][_0xba32('0xe')](queryTelephones));_0x19d88b[_0xba32('0x2b')](db[_0xba32('0x30')][_0xba32('0xe')](queryTrunks));_0x19d88b['push'](db['Campaign'][_0xba32('0xe')](queryCampaigns));_0x19d88b['push'](db[_0xba32('0x4')][_0xba32('0xe')](queryAgents));break;case _0xba32('0x31'):_0x35f168[_0x34a3cd](_0xba32('0x32'));_0x35f168[_0x34a3cd]('voice:outbound');_0x19d88b[_0xba32('0x2b')](getAssociatedResources(_0xba32('0xa'),_0x1ef5ed[_0xba32('0x1a')],_0xba32('0x2a')));_0x19d88b['push'](getAssociatedResources('ChatQueues',_0x1ef5ed[_0xba32('0x1a')],_0xba32('0x2c')));_0x19d88b[_0xba32('0x2b')](getAssociatedResources(_0xba32('0xb'),_0x1ef5ed[_0xba32('0x1a')],_0xba32('0x2d')));_0x19d88b[_0xba32('0x2b')](getAssociatedResources(_0xba32('0x33'),_0x1ef5ed[_0xba32('0x1a')],_0xba32('0x2e')));_0x19d88b[_0xba32('0x2b')](getAssociatedResources('MailQueues',_0x1ef5ed[_0xba32('0x1a')],_0xba32('0x34')));_0x19d88b[_0xba32('0x2b')](getAssociatedResources(_0xba32('0xc'),_0x1ef5ed['userProfileId'],_0xba32('0x2f')));_0x19d88b['push'](getAssociatedResources(_0xba32('0xd'),_0x1ef5ed['userProfileId'],_0xba32('0x35')));_0x19d88b[_0xba32('0x2b')](getAssociatedResources(_0xba32('0xf'),_0x1ef5ed[_0xba32('0x1a')],_0xba32('0x4')));_0x19d88b[_0xba32('0x2b')](getAssociatedResources('Trunks',_0x1ef5ed[_0xba32('0x1a')],'Trunk'));_0x19d88b[_0xba32('0x2b')](getAssociatedResources(_0xba32('0x10'),_0x1ef5ed[_0xba32('0x1a')],'Campaign'));_0x19d88b[_0xba32('0x2b')](db[_0xba32('0x4')]['findAll'](queryAgents));break;case _0xba32('0x6'):_0x35f168[_0x34a3cd](_0xba32('0x32'));_0x35f168[_0x34a3cd](_0xba32('0x28'));_0x19d88b['push'](_0x1ef5ed[_0xba32('0x36')]({'attributes':['id',_0xba32('0x2')]}));_0x19d88b['push'](_0x1ef5ed[_0xba32('0x37')]({'attributes':['id',_0xba32('0x2')]}));_0x19d88b[_0xba32('0x2b')](_0x1ef5ed[_0xba32('0x38')]({'attributes':['id','name']}));_0x19d88b[_0xba32('0x2b')](_0x1ef5ed[_0xba32('0x39')]({'attributes':['id','name']}));_0x19d88b[_0xba32('0x2b')](_0x1ef5ed[_0xba32('0x3a')]({'attributes':['id','name']}));_0x19d88b[_0xba32('0x2b')](_0x1ef5ed['getOpenchannelQueues']({'attributes':['id',_0xba32('0x2')]}));_0x19d88b[_0xba32('0x2b')](_0x1ef5ed[_0xba32('0x3b')]({'attributes':['id',_0xba32('0x2')]}));break;}return BPromise[_0xba32('0x3c')](_0x19d88b);}})[_0xba32('0x13')](function(_0x4be0e5){if(_0x4be0e5&&_0x4be0e5[_0xba32('0x17')]){for(var _0x44aae2=0x0;_0x44aae2<_0x4be0e5[_0xba32('0x17')];_0x44aae2+=0x1){for(var _0x277670=0x0;_0x277670<_0x4be0e5[_0x44aae2][_0xba32('0x17')];_0x277670+=0x1){switch(_0x44aae2){case 0x0:joinOrLeaveQueues(_0x35f168,_0x34a3cd,'voice',_0x4be0e5[_0x44aae2][_0x277670]);break;case 0x1:joinOrLeaveQueues(_0x35f168,_0x34a3cd,_0xba32('0x3d'),_0x4be0e5[_0x44aae2][_0x277670]);break;case 0x2:joinOrLeaveQueues(_0x35f168,_0x34a3cd,_0xba32('0x3e'),_0x4be0e5[_0x44aae2][_0x277670]);break;case 0x3:joinOrLeaveQueues(_0x35f168,_0x34a3cd,_0xba32('0x3f'),_0x4be0e5[_0x44aae2][_0x277670]);break;case 0x4:joinOrLeaveQueues(_0x35f168,_0x34a3cd,'mail',_0x4be0e5[_0x44aae2][_0x277670]);break;case 0x5:joinOrLeaveQueues(_0x35f168,_0x34a3cd,'openchannel',_0x4be0e5[_0x44aae2][_0x277670]);break;case 0x6:joinOrLeaveQueues(_0x35f168,_0x34a3cd,_0xba32('0x40'),_0x4be0e5[_0x44aae2][_0x277670]);break;case 0x7:if(_0x5eb640[_0xba32('0x5')]!=='agent')_0x35f168[_0x34a3cd](util['format'](_0xba32('0x41'),_0x4be0e5[_0x44aae2][_0x277670][_0xba32('0x2')]));break;case 0x8:if(_0x5eb640[_0xba32('0x5')]!=='agent')_0x35f168[_0x34a3cd](util['format'](_0xba32('0x42'),_0x4be0e5[_0x44aae2][_0x277670][_0xba32('0x2')]));break;case 0x9:if(_0x5eb640[_0xba32('0x5')]!==_0xba32('0x6'))_0x35f168[_0x34a3cd](util['format'](_0xba32('0x43'),_0x4be0e5[_0x44aae2][_0x277670][_0xba32('0x8')],_0x4be0e5[_0x44aae2][_0x277670][_0xba32('0x2')]));break;case 0xa:_0x35f168[_0x34a3cd](util[_0xba32('0x16')]('user:%s',_0x4be0e5[_0x44aae2][_0x277670][_0xba32('0x2')]));break;}}}}})[_0xba32('0x13')](function(){if(_0x34a3cd===_0xba32('0x44')){var _0xf4fa51=_['map'](_0x5eb640[_0xba32('0x1d')],'id');return _0x5eb640[_0xba32('0x45')](_0xf4fa51)[_0xba32('0x13')](function(){for(var _0x73a0e4=0x0;_0x73a0e4<_0xf4fa51[_0xba32('0x17')];_0x73a0e4+=0x1){_0x171626['emit'](_0xba32('0x46'),{'ChatInteractionId':Number(_0xf4fa51[_0x73a0e4]),'UserId':Number(_0x5eb640['id'])});}});}})[_0xba32('0x13')](function(){if(_0x34a3cd===_0xba32('0x44')){var _0x311e17=_['map'](_0x5eb640[_0xba32('0x1f')],'id');return _0x5eb640[_0xba32('0x47')](_0x311e17)[_0xba32('0x13')](function(){for(var _0x2cbe01=0x0;_0x2cbe01<_0x311e17['length'];_0x2cbe01+=0x1){_0x171626['emit'](_0xba32('0x48'),{'MailInteractionId':Number(_0x311e17[_0x2cbe01]),'UserId':Number(_0x5eb640['id'])});}});}})[_0xba32('0x13')](function(){if(_0x34a3cd===_0xba32('0x44')){var _0x1e3a83=_[_0xba32('0x14')](_0x5eb640['FaxInteractions'],'id');return _0x5eb640[_0xba32('0x49')](_0x1e3a83)[_0xba32('0x13')](function(){for(var _0x246ad3=0x0;_0x246ad3<_0x1e3a83[_0xba32('0x17')];_0x246ad3+=0x1){_0x171626['emit'](_0xba32('0x4a'),{'FaxInteractionId':Number(_0x1e3a83[_0x246ad3]),'UserId':Number(_0x5eb640['id'])});}});}})[_0xba32('0x13')](function(){if(_0x34a3cd==='leave'){var _0x3e0a3c=_['map'](_0x5eb640['SmsInteractions'],'id');return _0x5eb640[_0xba32('0x4b')](_0x3e0a3c)[_0xba32('0x13')](function(){for(var _0x1d0302=0x0;_0x1d0302<_0x3e0a3c['length'];_0x1d0302+=0x1){_0x171626[_0xba32('0x4c')](_0xba32('0x4d'),{'SmsInteractionId':Number(_0x3e0a3c[_0x1d0302]),'UserId':Number(_0x5eb640['id'])});}});}})[_0xba32('0x13')](function(){if(_0x34a3cd===_0xba32('0x44')){var _0x23de08=_['map'](_0x5eb640[_0xba32('0x24')],'id');return _0x5eb640['removeOpenchannelInteractions'](_0x23de08)[_0xba32('0x13')](function(){for(var _0x154cf0=0x0;_0x154cf0<_0x23de08[_0xba32('0x17')];_0x154cf0+=0x1){_0x171626[_0xba32('0x4c')](_0xba32('0x4e'),{'OpenchannelInteractionId':Number(_0x23de08[_0x154cf0]),'UserId':Number(_0x5eb640['id'])});}});}})[_0xba32('0x13')](function(){if(_0x34a3cd===_0xba32('0x44')){var _0x3f4c95=_[_0xba32('0x14')](_0x5eb640[_0xba32('0x26')],'id');return _0x5eb640[_0xba32('0x4f')](_0x3f4c95)[_0xba32('0x13')](function(){for(var _0x328cb8=0x0;_0x328cb8<_0x3f4c95[_0xba32('0x17')];_0x328cb8+=0x1){_0x171626[_0xba32('0x4c')](_0xba32('0x50'),{'WhatsappInteractionId':Number(_0x3f4c95[_0x328cb8]),'UserId':Number(_0x5eb640['id'])});}});}})['catch'](function(_0x5d32a0){_0x35f168[_0xba32('0x51')](_0x5d32a0);});}}function onDisconnect(_0x34e9ea,_0x23cb82){joinOrLeave(_0x34e9ea,_0xba32('0x44'),_0x23cb82);}function onConnect(_0x460348){joinOrLeave(_0x460348,_0xba32('0x52'));}exports[_0xba32('0x53')]=function(_0x4a4c35){_0x4a4c35['on'](_0xba32('0x54'),function(_0x229840){_0x229840[_0xba32('0x55')](0x0);_0x229840[_0xba32('0x56')]=_0x229840[_0xba32('0x57')][_0xba32('0x54')]['remoteAddress']+':'+_0x229840[_0xba32('0x57')][_0xba32('0x54')][_0xba32('0x58')];_0x229840['connectedAt']=new Date();_0x229840[_0xba32('0x51')]=function(_0x543d2f){console[_0xba32('0x51')]('SocketIO\x20'+_0x229840['nsp'][_0xba32('0x2')]+'['+_0x229840[_0xba32('0x56')]+']',_0x543d2f);};_0x229840['on']('disconnect',function(){onDisconnect(_0x229840,_0x4a4c35);_0x229840[_0xba32('0x51')]('DISCONNECTED');});onConnect(_0x229840);_0x229840[_0xba32('0x51')](_0xba32('0x59'));});}; \ No newline at end of file +var _0xda2d=['ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','voice:outbound','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','VoiceQueue','FaxQueue','MailQueues','OpenchannelQueues','WhatsappQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','findAll','Telephones','Trunks','IvrCampaigns','map','resourceId','Campaign','where','format','Agents','length','user:%s','handshake','query','User','userProfileId'];(function(_0x4dfd10,_0x3169d5){var _0x267950=function(_0x15b4ae){while(--_0x15b4ae){_0x4dfd10['push'](_0x4dfd10['shift']());}};_0x267950(++_0x3169d5);}(_0xda2d,0x102));var _0xdda2=function(_0x31b5e3,_0x1bca8f){_0x31b5e3=_0x31b5e3-0x0;var _0x25aa9e=_0xda2d[_0x31b5e3];return _0x25aa9e;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var BPromise=require(_0xdda2('0x1'));var db=require(_0xdda2('0x2'))['db'];var config=require(_0xdda2('0x3'));var queryQueues={'attributes':['id',_0xdda2('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0xdda2('0x5')],'raw':!![],'where':{'role':_0xdda2('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdda2('0x4')],'where':{'role':_0xdda2('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xdda2('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xdda2('0x4')],'where':{'role':_0xdda2('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdda2('0x4'),_0xdda2('0x8')],'where':{'type':_0xdda2('0x9')}};function getAssociatedResources(_0x4a97f3,_0x1a774e,_0x22c6e5){return db['UserProfileSection'][_0xdda2('0xa')]({'where':{'name':_0x4a97f3,'userProfileId':_0x1a774e},'raw':!![]})[_0xdda2('0xb')](function(_0x42d990){if(_0x42d990){if(_0x42d990[_0xdda2('0xc')]){switch(_0x4a97f3){case _0xdda2('0xd'):case _0xdda2('0xe'):case _0xdda2('0xf'):case _0xdda2('0x10'):case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x22c6e5][_0xdda2('0x11')](queryQueues);case _0xdda2('0x12'):return db[_0x22c6e5][_0xdda2('0x11')](queryTelephones);case _0xdda2('0x13'):return db[_0x22c6e5][_0xdda2('0x11')](queryTrunks);case _0xdda2('0x14'):return db[_0x22c6e5][_0xdda2('0x11')](queryCampaigns);}}else{return db['UserProfileResource'][_0xdda2('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x42d990['id']},'raw':!![]})[_0xdda2('0xb')](function(_0xb6b01e){if(_0xb6b01e){var _0x3553d5={'where':{'id':_[_0xdda2('0x15')](_0xb6b01e,_0xdda2('0x16'))},'raw':!![]};switch(_0x22c6e5){case'User':_0x3553d5['where'][_0xdda2('0x5')]='telephone';break;case _0xdda2('0x17'):_0x3553d5[_0xdda2('0x18')][_0xdda2('0x8')]=_0xdda2('0x9');break;}return db[_0x22c6e5][_0xdda2('0x11')](_0x3553d5);}else{return[];}});}}else{return[];}})[_0xdda2('0xb')](function(_0x3ca127){return _0x3ca127;});}function joinOrLeaveQueues(_0x351151,_0x3c02a4,_0x337b0b,_0x312ef1){_0x351151[_0x3c02a4](util[_0xdda2('0x19')]('%s:queue:%s',_0x337b0b,_0x312ef1[_0xdda2('0x4')]));if(_0x312ef1['Agents']){for(var _0xc4567c=0x0;_0xc4567c<_0x312ef1[_0xdda2('0x1a')][_0xdda2('0x1b')];_0xc4567c+=0x1){_0x351151[_0x3c02a4](util['format'](_0xdda2('0x1c'),_0x312ef1['Agents'][_0xc4567c][_0xdda2('0x4')]));}}}function joinOrLeave(_0x107ee4,_0x4ac3eb,_0x144f1e){var _0xfda248;if(_0x107ee4[_0xdda2('0x1d')][_0xdda2('0x1e')]['id']){db[_0xdda2('0x1f')]['find']({'attributes':['id',_0xdda2('0x4'),_0xdda2('0x5'),_0xdda2('0x20')],'where':{'id':_0x107ee4[_0xdda2('0x1d')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xdda2('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xdda2('0x22')],'as':_0xdda2('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xdda2('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xdda2('0x25')],'as':_0xdda2('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xdda2('0x27')],'as':_0xdda2('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xdda2('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xdda2('0xb')](function(_0x255bbc){if(_0x255bbc){_0xfda248=_0x255bbc;_0x107ee4[_0x4ac3eb](util['format'](_0xdda2('0x1c'),_0x255bbc[_0xdda2('0x4')]));var _0x3b18b8=[];switch(_0x255bbc[_0xdda2('0x5')]){case'admin':_0x107ee4[_0x4ac3eb](_0xdda2('0x2a'));_0x107ee4[_0x4ac3eb](_0xdda2('0x2b'));if(queryQueues['hasOwnProperty'](_0xdda2('0x2c'))){delete queryQueues['include'];}_0x3b18b8[_0xdda2('0x2d')](db['VoiceQueue']['findAll'](queryQueues));_0x3b18b8['push'](db[_0xdda2('0x2e')]['findAll'](queryQueues));_0x3b18b8[_0xdda2('0x2d')](db['FaxQueue']['findAll'](queryQueues));_0x3b18b8['push'](db[_0xdda2('0x2f')][_0xdda2('0x11')](queryQueues));_0x3b18b8[_0xdda2('0x2d')](db[_0xdda2('0x30')][_0xdda2('0x11')](queryQueues));_0x3b18b8[_0xdda2('0x2d')](db[_0xdda2('0x31')][_0xdda2('0x11')](queryQueues));_0x3b18b8[_0xdda2('0x2d')](db[_0xdda2('0x32')]['findAll'](queryQueues));_0x3b18b8[_0xdda2('0x2d')](db[_0xdda2('0x1f')][_0xdda2('0x11')](queryTelephones));_0x3b18b8[_0xdda2('0x2d')](db[_0xdda2('0x33')][_0xdda2('0x11')](queryTrunks));_0x3b18b8[_0xdda2('0x2d')](db['Campaign']['findAll'](queryCampaigns));_0x3b18b8[_0xdda2('0x2d')](db[_0xdda2('0x1f')][_0xdda2('0x11')](queryAgents));break;case'user':_0x107ee4[_0x4ac3eb]('voice:inbound');_0x107ee4[_0x4ac3eb](_0xdda2('0x2b'));_0x3b18b8[_0xdda2('0x2d')](getAssociatedResources(_0xdda2('0xd'),_0x255bbc[_0xdda2('0x20')],_0xdda2('0x34')));_0x3b18b8['push'](getAssociatedResources(_0xdda2('0xe'),_0x255bbc[_0xdda2('0x20')],'ChatQueue'));_0x3b18b8['push'](getAssociatedResources(_0xdda2('0xf'),_0x255bbc[_0xdda2('0x20')],_0xdda2('0x35')));_0x3b18b8[_0xdda2('0x2d')](getAssociatedResources(_0xdda2('0x10'),_0x255bbc['userProfileId'],_0xdda2('0x2f')));_0x3b18b8[_0xdda2('0x2d')](getAssociatedResources(_0xdda2('0x36'),_0x255bbc[_0xdda2('0x20')],'MailQueue'));_0x3b18b8['push'](getAssociatedResources(_0xdda2('0x37'),_0x255bbc[_0xdda2('0x20')],_0xdda2('0x31')));_0x3b18b8['push'](getAssociatedResources(_0xdda2('0x38'),_0x255bbc['userProfileId'],_0xdda2('0x32')));_0x3b18b8['push'](getAssociatedResources(_0xdda2('0x12'),_0x255bbc[_0xdda2('0x20')],_0xdda2('0x1f')));_0x3b18b8[_0xdda2('0x2d')](getAssociatedResources('Trunks',_0x255bbc[_0xdda2('0x20')],'Trunk'));_0x3b18b8[_0xdda2('0x2d')](getAssociatedResources('IvrCampaigns',_0x255bbc[_0xdda2('0x20')],_0xdda2('0x17')));_0x3b18b8[_0xdda2('0x2d')](db[_0xdda2('0x1f')][_0xdda2('0x11')](queryAgents));break;case'agent':_0x107ee4[_0x4ac3eb](_0xdda2('0x2a'));_0x107ee4[_0x4ac3eb](_0xdda2('0x2b'));_0x3b18b8['push'](_0x255bbc[_0xdda2('0x39')]({'attributes':['id','name']}));_0x3b18b8[_0xdda2('0x2d')](_0x255bbc[_0xdda2('0x3a')]({'attributes':['id',_0xdda2('0x4')]}));_0x3b18b8[_0xdda2('0x2d')](_0x255bbc[_0xdda2('0x3b')]({'attributes':['id',_0xdda2('0x4')]}));_0x3b18b8[_0xdda2('0x2d')](_0x255bbc[_0xdda2('0x3c')]({'attributes':['id',_0xdda2('0x4')]}));_0x3b18b8[_0xdda2('0x2d')](_0x255bbc[_0xdda2('0x3d')]({'attributes':['id',_0xdda2('0x4')]}));_0x3b18b8[_0xdda2('0x2d')](_0x255bbc['getOpenchannelQueues']({'attributes':['id','name']}));_0x3b18b8['push'](_0x255bbc[_0xdda2('0x3e')]({'attributes':['id',_0xdda2('0x4')]}));break;}return BPromise['all'](_0x3b18b8);}})[_0xdda2('0xb')](function(_0x18f229){if(_0x18f229&&_0x18f229[_0xdda2('0x1b')]){for(var _0x5e56a8=0x0;_0x5e56a8<_0x18f229[_0xdda2('0x1b')];_0x5e56a8+=0x1){for(var _0x1fa4d0=0x0;_0x1fa4d0<_0x18f229[_0x5e56a8]['length'];_0x1fa4d0+=0x1){switch(_0x5e56a8){case 0x0:joinOrLeaveQueues(_0x107ee4,_0x4ac3eb,'voice',_0x18f229[_0x5e56a8][_0x1fa4d0]);break;case 0x1:joinOrLeaveQueues(_0x107ee4,_0x4ac3eb,_0xdda2('0x3f'),_0x18f229[_0x5e56a8][_0x1fa4d0]);break;case 0x2:joinOrLeaveQueues(_0x107ee4,_0x4ac3eb,'fax',_0x18f229[_0x5e56a8][_0x1fa4d0]);break;case 0x3:joinOrLeaveQueues(_0x107ee4,_0x4ac3eb,_0xdda2('0x40'),_0x18f229[_0x5e56a8][_0x1fa4d0]);break;case 0x4:joinOrLeaveQueues(_0x107ee4,_0x4ac3eb,'mail',_0x18f229[_0x5e56a8][_0x1fa4d0]);break;case 0x5:joinOrLeaveQueues(_0x107ee4,_0x4ac3eb,_0xdda2('0x41'),_0x18f229[_0x5e56a8][_0x1fa4d0]);break;case 0x6:joinOrLeaveQueues(_0x107ee4,_0x4ac3eb,_0xdda2('0x42'),_0x18f229[_0x5e56a8][_0x1fa4d0]);break;case 0x7:if(_0xfda248['role']!=='agent')_0x107ee4[_0x4ac3eb](util[_0xdda2('0x19')](_0xdda2('0x43'),_0x18f229[_0x5e56a8][_0x1fa4d0][_0xdda2('0x4')]));break;case 0x8:if(_0xfda248[_0xdda2('0x5')]!=='agent')_0x107ee4[_0x4ac3eb](util[_0xdda2('0x19')](_0xdda2('0x44'),_0x18f229[_0x5e56a8][_0x1fa4d0][_0xdda2('0x4')]));break;case 0x9:if(_0xfda248[_0xdda2('0x5')]!==_0xdda2('0x6'))_0x107ee4[_0x4ac3eb](util['format'](_0xdda2('0x45'),_0x18f229[_0x5e56a8][_0x1fa4d0][_0xdda2('0x8')],_0x18f229[_0x5e56a8][_0x1fa4d0]['name']));break;case 0xa:_0x107ee4[_0x4ac3eb](util[_0xdda2('0x19')](_0xdda2('0x1c'),_0x18f229[_0x5e56a8][_0x1fa4d0][_0xdda2('0x4')]));break;}}}}})[_0xdda2('0xb')](function(){if(_0x4ac3eb===_0xdda2('0x46')){var _0x265169=_['map'](_0xfda248[_0xdda2('0x21')],'id');return _0xfda248['removeChatInteractions'](_0x265169)[_0xdda2('0xb')](function(){for(var _0x4a70ff=0x0;_0x4a70ff<_0x265169[_0xdda2('0x1b')];_0x4a70ff+=0x1){_0x144f1e['emit'](_0xdda2('0x47'),{'ChatInteractionId':Number(_0x265169[_0x4a70ff]),'UserId':Number(_0xfda248['id'])});}});}})[_0xdda2('0xb')](function(){if(_0x4ac3eb===_0xdda2('0x46')){var _0x119f70=_[_0xdda2('0x15')](_0xfda248[_0xdda2('0x23')],'id');return _0xfda248[_0xdda2('0x48')](_0x119f70)[_0xdda2('0xb')](function(){for(var _0x538ebb=0x0;_0x538ebb<_0x119f70[_0xdda2('0x1b')];_0x538ebb+=0x1){_0x144f1e[_0xdda2('0x49')](_0xdda2('0x4a'),{'MailInteractionId':Number(_0x119f70[_0x538ebb]),'UserId':Number(_0xfda248['id'])});}});}})['then'](function(){if(_0x4ac3eb===_0xdda2('0x46')){var _0x1c2d24=_['map'](_0xfda248[_0xdda2('0x24')],'id');return _0xfda248['removeFaxInteractions'](_0x1c2d24)[_0xdda2('0xb')](function(){for(var _0x10fbac=0x0;_0x10fbac<_0x1c2d24[_0xdda2('0x1b')];_0x10fbac+=0x1){_0x144f1e[_0xdda2('0x49')](_0xdda2('0x4b'),{'FaxInteractionId':Number(_0x1c2d24[_0x10fbac]),'UserId':Number(_0xfda248['id'])});}});}})['then'](function(){if(_0x4ac3eb==='leave'){var _0x5c2cb2=_[_0xdda2('0x15')](_0xfda248[_0xdda2('0x26')],'id');return _0xfda248['removeSmsInteractions'](_0x5c2cb2)[_0xdda2('0xb')](function(){for(var _0x126977=0x0;_0x126977<_0x5c2cb2[_0xdda2('0x1b')];_0x126977+=0x1){_0x144f1e['emit'](_0xdda2('0x4c'),{'SmsInteractionId':Number(_0x5c2cb2[_0x126977]),'UserId':Number(_0xfda248['id'])});}});}})[_0xdda2('0xb')](function(){if(_0x4ac3eb===_0xdda2('0x46')){var _0x58ae15=_[_0xdda2('0x15')](_0xfda248[_0xdda2('0x28')],'id');return _0xfda248[_0xdda2('0x4d')](_0x58ae15)[_0xdda2('0xb')](function(){for(var _0x5d8602=0x0;_0x5d8602<_0x58ae15[_0xdda2('0x1b')];_0x5d8602+=0x1){_0x144f1e['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x58ae15[_0x5d8602]),'UserId':Number(_0xfda248['id'])});}});}})['then'](function(){if(_0x4ac3eb===_0xdda2('0x46')){var _0x35b38a=_[_0xdda2('0x15')](_0xfda248[_0xdda2('0x4e')],'id');return _0xfda248[_0xdda2('0x4f')](_0x35b38a)[_0xdda2('0xb')](function(){for(var _0x29a739=0x0;_0x29a739<_0x35b38a[_0xdda2('0x1b')];_0x29a739+=0x1){_0x144f1e[_0xdda2('0x49')](_0xdda2('0x50'),{'WhatsappInteractionId':Number(_0x35b38a[_0x29a739]),'UserId':Number(_0xfda248['id'])});}});}})[_0xdda2('0x51')](function(_0x5e6dcf){_0x107ee4[_0xdda2('0x52')](_0x5e6dcf);});}}function onDisconnect(_0x173022,_0x266ec0){joinOrLeave(_0x173022,_0xdda2('0x46'),_0x266ec0);}function onConnect(_0x90bb5c){joinOrLeave(_0x90bb5c,_0xdda2('0x53'));}exports[_0xdda2('0x54')]=function(_0x57fb41){_0x57fb41['on'](_0xdda2('0x55'),function(_0x2afcae){_0x2afcae[_0xdda2('0x56')](0x0);_0x2afcae[_0xdda2('0x57')]=_0x2afcae[_0xdda2('0x58')]['connection'][_0xdda2('0x59')]+':'+_0x2afcae[_0xdda2('0x58')][_0xdda2('0x55')][_0xdda2('0x5a')];_0x2afcae[_0xdda2('0x5b')]=new Date();_0x2afcae['log']=function(_0x17aaab){console[_0xdda2('0x52')](_0xdda2('0x5c')+_0x2afcae[_0xdda2('0x5d')][_0xdda2('0x4')]+'['+_0x2afcae['address']+']',_0x17aaab);};_0x2afcae['on'](_0xdda2('0x5e'),function(){onDisconnect(_0x2afcae,_0x57fb41);_0x2afcae[_0xdda2('0x52')](_0xdda2('0x5f'));});onConnect(_0x2afcae);_0x2afcae['log'](_0xdda2('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 2f793e0..f5c4a2c 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 _0x732e=['../logger','client','http','ChatInteraction','newinteraction','Chat','afterUpdate','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','closedinteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','code','Trigger,\x20%s','catch','error','get','channel','motionChannel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','event','offlineMessage','opened','sequelize','SELECT','AfterCreate','closed','changed','substatus','AfterUpdate','User','fullname','internal','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise'];(function(_0x231a8c,_0x215a94){var _0x139bd9=function(_0x26612e){while(--_0x26612e){_0x231a8c['push'](_0x231a8c['shift']());}};_0x139bd9(++_0x215a94);}(_0x732e,0xd8));var _0xe732=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x732e[_0x1f7996];return _0x584609;};'use strict';var util=require(_0xe732('0x0'));var db=require(_0xe732('0x1'))['db'];var jayson=require(_0xe732('0x2'));var logger=require(_0xe732('0x3'))('triggers');var client=jayson[_0xe732('0x4')][_0xe732('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xe732('0x6'),'event':'afterCreate','condition':_0xe732('0x7'),'callback':afterCreate},{'channel':_0xe732('0x8'),'model':_0xe732('0x6'),'event':_0xe732('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0xe732('0xa'),'event':_0xe732('0xb'),'condition':_0xe732('0xc'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xe732('0xd'),'event':'afterCreate','condition':_0xe732('0xc'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':_0xe732('0xb'),'condition':_0xe732('0x7'),'callback':afterCreate},{'channel':_0xe732('0xe'),'model':_0xe732('0xf'),'event':_0xe732('0x9'),'condition':_0xe732('0x10'),'callback':afterUpdate},{'channel':_0xe732('0xe'),'model':'SmsMessage','event':'afterCreate','condition':_0xe732('0xc'),'callback':afterCreateMessage},{'channel':_0xe732('0x11'),'model':_0xe732('0x12'),'event':_0xe732('0xb'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0xe732('0x9'),'condition':_0xe732('0x10'),'callback':afterUpdate},{'channel':_0xe732('0x11'),'model':_0xe732('0x13'),'event':_0xe732('0xb'),'condition':_0xe732('0xc'),'callback':afterCreateMessage},{'channel':_0xe732('0x14'),'model':_0xe732('0x15'),'event':_0xe732('0xb'),'condition':_0xe732('0x7'),'callback':afterCreate},{'channel':_0xe732('0x14'),'model':_0xe732('0x15'),'event':_0xe732('0x9'),'condition':_0xe732('0x10'),'callback':afterUpdate},{'channel':'Fax','model':_0xe732('0x16'),'event':_0xe732('0xb'),'condition':_0xe732('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xe732('0x17'),'event':_0xe732('0xb'),'condition':_0xe732('0x7'),'callback':afterCreate},{'channel':_0xe732('0x18'),'model':_0xe732('0x17'),'event':_0xe732('0x9'),'condition':_0xe732('0x10'),'callback':afterUpdate},{'channel':_0xe732('0x18'),'model':'MailMessage','event':_0xe732('0xb'),'condition':_0xe732('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xe732('0x19'),'event':_0xe732('0xb'),'condition':_0xe732('0x7'),'callback':afterCreate},{'channel':_0xe732('0x1a'),'model':_0xe732('0x19'),'event':_0xe732('0x9'),'condition':_0xe732('0x10'),'callback':afterUpdate},{'channel':_0xe732('0x1a'),'model':_0xe732('0x1b'),'event':_0xe732('0xb'),'condition':_0xe732('0xc'),'callback':afterCreateMessage}];function request(_0x60e3b8){return client['request'](_0xe732('0x1c'),_0x60e3b8)[_0xe732('0x1d')](function(_0x38818f){logger[_0xe732('0x1e')]('Trigger,\x20%s',_0xe732('0x1c'),_0x38818f);if(_0x38818f['error']){if(_0x38818f['error'][_0xe732('0x1f')]===0x1f4){logger['error'](_0xe732('0x20'),_0xe732('0x1c'),_0x38818f['error']);}}})[_0xe732('0x21')](function(_0x27fc3a){logger[_0xe732('0x22')](_0xe732('0x20'),_0xe732('0x1c'),_0x27fc3a);});}function afterCreateMessage(_0x368584){return function(_0xcdd889){_0xcdd889=_0xcdd889[_0xe732('0x23')]({'plain':!![]});_0xcdd889[_0xe732('0x24')]=_0x368584;_0xcdd889[_0xe732('0x25')]=_0x368584;_0xcdd889['event']=_0xcdd889[_0xe732('0x26')];Promise[_0xe732('0x27')]()[_0xe732('0x1d')](function(){if(typeof _0xcdd889[_0xe732('0x28')]===_0xe732('0x29'))return null;var _0x4a84bd=_0xe732('0x2a')+_0xcdd889[_0xe732('0x28')];return db['sequelize']['query'](_0x4a84bd,{'type':db[_0xe732('0x2b')][_0xe732('0x2c')]['SELECT'],'raw':!![]});})[_0xe732('0x1d')](function(_0x3eab9d){if(_0x3eab9d){_0xcdd889[_0xe732('0x2d')]=_0x3eab9d[0x0];}if(typeof _0xcdd889[_0xe732('0x2e')]==='undefined')return;return getAgent(_0xcdd889[_0xe732('0x2e')]);})[_0xe732('0x1d')](function(_0x996f84){if(_0x996f84){_0xcdd889[_0xe732('0x2f')]=util[_0xe732('0x30')](_0xe732('0x31'),_0x996f84[_0xe732('0x32')]);_0xcdd889[_0xe732('0x33')]=_0x996f84;_0xcdd889[_0xe732('0x24')]=_0x368584;return request({'event':_0xe732('0x34'),'message':_0xcdd889});}else{return request({'event':_0xe732('0x35'),'message':_0xcdd889});}})[_0xe732('0x21')](function(_0x4aa64a){logger['error']('Trigger,\x20%s','AfterCreateMessage',_0x4aa64a);});};}function afterCreateOfflineMessage(_0x4ae61e){return function(_0x30ee1c){_0x30ee1c=_0x30ee1c[_0xe732('0x23')]({'plain':!![]});_0x30ee1c[_0xe732('0x24')]=_0x4ae61e;_0x30ee1c[_0xe732('0x25')]=_0x4ae61e;_0x30ee1c[_0xe732('0x36')]=_0xe732('0x37');return request({'event':_0x30ee1c[_0xe732('0x36')],'message':_0x30ee1c});};}function afterCreate(_0x5a0061,_0x465146){return function(_0x4031cb){_0x4031cb=_0x4031cb['get']({'plain':!![]});_0x4031cb['channel']=_0x5a0061;_0x4031cb['motionChannel']=_0x5a0061;_0x4031cb[_0xe732('0x36')]=_0xe732('0x38');Promise['resolve']()['then'](function(){var _0x366475=_0xe732('0x2a')+_0x4031cb[_0xe732('0x28')];return db[_0xe732('0x39')]['query'](_0x366475,{'type':db[_0xe732('0x2b')][_0xe732('0x2c')][_0xe732('0x3a')],'raw':!![]});})[_0xe732('0x1d')](function(_0x2d67c6){if(_0x2d67c6){_0x4031cb['contact']=_0x2d67c6[0x0];}if(typeof _0x4031cb[_0xe732('0x2e')]==='undefined')return;return getAgent(_0x4031cb[_0xe732('0x2e')]);})[_0xe732('0x1d')](function(_0x1159fa){if(_0x1159fa){_0x4031cb['interface']=util[_0xe732('0x30')](_0xe732('0x31'),_0x1159fa[_0xe732('0x32')]);_0x4031cb[_0xe732('0x33')]=_0x1159fa;}return request({'event':_0x465146,'message':_0x4031cb});})[_0xe732('0x21')](function(_0x55834c){logger['error'](_0xe732('0x20'),_0xe732('0x3b'),_0x55834c);});};}function afterUpdate(_0x1e565a){return function(_0x288dab){var _0x3987a9=_0x288dab['changed'](_0xe732('0x3c'))&&_0x288dab[_0xe732('0x3c')];var _0x5a7ea5=_0x288dab[_0xe732('0x3d')](_0xe732('0x3e'));if(_0x3987a9||_0x5a7ea5){var _0x383b79=_0x3987a9?_0xe732('0x10'):_0xe732('0x3e');var _0x324995=_0x288dab[_0xe732('0x23')]({'plain':!![]});_0x324995[_0xe732('0x24')]=_0x1e565a;_0x324995[_0xe732('0x25')]=_0x1e565a;_0x324995['event']=_0x3987a9?_0xe732('0x3c'):_0xe732('0x3e');var _0x1a177e=_0xe732('0x2a')+_0x324995[_0xe732('0x28')];return db['sequelize']['query'](_0x1a177e,{'type':db[_0xe732('0x2b')]['QueryTypes'][_0xe732('0x3a')],'raw':!![]})[_0xe732('0x1d')](function(_0x3c821d){if(_0x3c821d){_0x324995[_0xe732('0x2d')]=_0x3c821d[0x0];}if(typeof _0x324995['UserId']===_0xe732('0x29'))return;return getAgent(_0x324995[_0xe732('0x2e')]);})[_0xe732('0x1d')](function(_0xcb2487){if(_0xcb2487){_0x324995[_0xe732('0x2f')]=util[_0xe732('0x30')]('SIP/%s',_0xcb2487[_0xe732('0x32')]);_0x324995['agent']=_0xcb2487;}return request({'event':_0x383b79,'message':_0x324995});})['catch'](function(_0x4eadc9){logger[_0xe732('0x22')](_0xe732('0x20'),_0xe732('0x3f'),_0x4eadc9);});}};}function getAgent(_0x1f3572){return db[_0xe732('0x40')]['find']({'where':{'id':_0x1f3572},'attributes':['id',_0xe732('0x32'),_0xe732('0x41'),'email',_0xe732('0x42')],'raw':!![]})['then'](function(_0x128a9d){return _0x128a9d;});}exports['default']=function(){for(var _0x338dce=0x0;_0x338dce=_0x44b4d0[_0xea92('0x11')]){throw Error(_0xea92('0x12'));}_0xee427(_0x1e6ad9);})['catch'](function(_0x31f83b){_0x44f2e2(_0x31f83b);});});}; \ No newline at end of file +var _0xf54c=['then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','chat','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count'];(function(_0x2a5057,_0x47a687){var _0x32cd96=function(_0x1e53c1){while(--_0x1e53c1){_0x2a5057['push'](_0x2a5057['shift']());}};_0x32cd96(++_0x47a687);}(_0xf54c,0xdf));var _0xcf54=function(_0x44d7f8,_0x42ef75){_0x44d7f8=_0x44d7f8-0x0;var _0x3a5012=_0xf54c[_0x44d7f8];return _0x3a5012;};'use strict';var _=require(_0xcf54('0x0'));var BPromise=require(_0xcf54('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xcf54('0x2'));var channels=['voice','mail',_0xcf54('0x3'),_0xcf54('0x4'),_0xcf54('0x5'),_0xcf54('0x6'),_0xcf54('0x7')];exports[_0xcf54('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x50ac83){_0x50ac83=_0x50ac83[_0xcf54('0x9')]();return _['includes'](channels,_0x50ac83);};exports[_0xcf54('0xa')]=function(_0x1d7418,_0x2748e4,_0x272d00,_0x4834e4){var _0x11a251={'loginAttempts':_0x2748e4,'blocked':_0x272d00};if(!_[_0xcf54('0xb')](_0x4834e4)){_0x11a251[_0xcf54('0xc')]=_0x4834e4;}return _0x1d7418[_0xcf54('0xd')](_0x11a251);};exports[_0xcf54('0xe')]=function(_0x1ca9f0){return new BPromise(function(_0x5bc46f,_0x3ec8f){var _0x544728=0x0;if(_0x1ca9f0[_0xcf54('0xf')]!==_0xcf54('0x10')){_0x5bc46f(_0x1ca9f0);}db[_0xcf54('0x11')][_0xcf54('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1ca9f0['id']}}})['then'](function(_0x95acf1){_0x544728=_0x95acf1;return util['getLicense']();})[_0xcf54('0x13')](function(_0x565877){if(_0x565877&&_0x565877[_0xcf54('0x14')]&&_0x544728>=_0x565877[_0xcf54('0x14')]){throw Error(_0xcf54('0x15'));}_0x5bc46f(_0x1ca9f0);})['catch'](function(_0x59bebe){_0x3ec8f(_0x59bebe);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 96de8b6..20458a7 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['Bad\x20Request','name','Not\x20Found','Forbidden','OutOfInterval','stack','send','exports','util','message','Error','inherits'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf4eb,0xec));var _0xbf4e=function(_0x36ced9,_0x5947a5){_0x36ced9=_0x36ced9-0x0;var _0x1b4ba7=_0xf4eb[_0x36ced9];return _0x1b4ba7;};'use strict';var util=require(_0xbf4e('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x479210,_0x5ed5b9){this[_0xbf4e('0x1')]=_0x479210||'Internal\x20Server\x20Error';this['name']=_0x5ed5b9||_0xbf4e('0x2');util[_0xbf4e('0x3')](APIError,Error);};var APIBadRequestError=function(_0x32d1d7){this[_0xbf4e('0x1')]=_0x32d1d7||_0xbf4e('0x4');this[_0xbf4e('0x5')]=_0xbf4e('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x449d55){this['message']=_0x449d55||'Entity\x20not\x20found';this[_0xbf4e('0x5')]=_0xbf4e('0x6');util[_0xbf4e('0x3')](APINotFoundError,APIError);};function getStatusCode(_0xc86f04){switch(_0xc86f04){case _0xbf4e('0x4'):return 0x190;case _0xbf4e('0x7'),_0xbf4e('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d9a07){return function(_0x7dfb74){logger['error'](_0x7dfb74[_0xbf4e('0x9')]);var _0xcf6ba8=getStatusCode(_0x7dfb74['name']);if(_0x7dfb74[_0xbf4e('0x5')])delete _0x7dfb74['name'];return _0x4d9a07['status'](_0xcf6ba8)[_0xbf4e('0xa')](_0x7dfb74);};}module[_0xbf4e('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x91a7=['name','inherits','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack','status','send','../config/logger','api','message'];(function(_0x4dc422,_0x248d61){var _0x12a079=function(_0x376d95){while(--_0x376d95){_0x4dc422['push'](_0x4dc422['shift']());}};_0x12a079(++_0x248d61);}(_0x91a7,0xe7));var _0x791a=function(_0x32af48,_0x4fd7ab){_0x32af48=_0x32af48-0x0;var _0x21ade0=_0x91a7[_0x32af48];return _0x21ade0;};'use strict';var util=require('util');var logger=require(_0x791a('0x0'))(_0x791a('0x1'));var APIError=function(_0x268862,_0x5d2796){this[_0x791a('0x2')]=_0x268862||'Internal\x20Server\x20Error';this[_0x791a('0x3')]=_0x5d2796||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x32fe2b){this[_0x791a('0x2')]=_0x32fe2b||'Bad\x20Request';this[_0x791a('0x3')]='Bad\x20Request';util[_0x791a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x159e24){this['message']=_0x159e24||_0x791a('0x5');this[_0x791a('0x3')]=_0x791a('0x6');util[_0x791a('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x266e4b){switch(_0x266e4b){case'Bad\x20Request':return 0x190;case _0x791a('0x7'),_0x791a('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2bd26a){return function(_0x206eea){logger[_0x791a('0x9')](_0x206eea[_0x791a('0xa')]);var _0x2805c9=getStatusCode(_0x206eea[_0x791a('0x3')]);if(_0x206eea['name'])delete _0x206eea['name'];return _0x2bd26a[_0x791a('0xb')](_0x2805c9)[_0x791a('0xc')](_0x206eea);};}module['exports']={'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 3360d3b..f794f62 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x728e=['render','json','send','exports','404','status'];(function(_0x4d438d,_0x4a9a1b){var _0x6c9229=function(_0x45e66e){while(--_0x45e66e){_0x4d438d['push'](_0x4d438d['shift']());}};_0x6c9229(++_0x4a9a1b);}(_0x728e,0x153));var _0xe728=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x728e[_0x14add3];return _0x4a174f;};'use strict';module[_0xe728('0x0')][0x194]=function pageNotFound(_0x32a405,_0x3ebcc6){var _0x22f903=_0xe728('0x1');var _0x4e1336=0x194;var _0x48bce1={'status':_0x4e1336};_0x3ebcc6[_0xe728('0x2')](_0x48bce1[_0xe728('0x2')]);_0x3ebcc6[_0xe728('0x3')](_0x22f903,{},function(_0x3f3db7,_0x52a8c4){if(_0x3f3db7){return _0x3ebcc6['status'](_0x48bce1['status'])[_0xe728('0x4')](_0x48bce1);}_0x3ebcc6[_0xe728('0x5')](_0x52a8c4);});}; \ No newline at end of file +var _0x9d56=['404','status','render','send','exports'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x9d56,0x15d));var _0x69d5=function(_0x530437,_0x516376){_0x530437=_0x530437-0x0;var _0x48c8e3=_0x9d56[_0x530437];return _0x48c8e3;};'use strict';module[_0x69d5('0x0')][0x194]=function pageNotFound(_0x366fb4,_0x20f12f){var _0x21f9b7=_0x69d5('0x1');var _0x3b8570=0x194;var _0x225a0a={'status':_0x3b8570};_0x20f12f[_0x69d5('0x2')](_0x225a0a[_0x69d5('0x2')]);_0x20f12f[_0x69d5('0x3')](_0x21f9b7,{},function(_0x1c0e25,_0x3806e4){if(_0x1c0e25){return _0x20f12f['status'](_0x225a0a[_0x69d5('0x2')])['json'](_0x225a0a);}_0x20f12f[_0x69d5('0x4')](_0x3806e4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 7539182..11332a0 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1ff=['SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','Website','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Company','cm_contact_has_tags','CmHopperAdditionalPhone','CmHopperId','CampaignId','Condition','All','AutomationAllId','Any','OneAny','AutomationAnyId','Action','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmContactId','Trigger','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','Variable','VariableId','Configurations','int_desk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','Dynamics365Account','FreshsalesConfiguration','FromId','ToId','SessionId','JscriptyProject','ProjectId','JscriptyAnswerReport','FaxQueues','team_has_sms_queues','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','VoicePrefix','UserProfileSection','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','user','Imap','exports','../config/environment','sequelize','lodash','jstz','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserMailQueue','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','Integration','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareMessage','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteraction','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','UserVoiceQueue','UserVoicePrefix','ChatQueues','UserChatQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','UserWhatsappQueue','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Team','Teams','TeamVoiceQueue','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','Account','ChatWebsiteId','Items','FaxAccountId','Exntensions','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','Tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId'];(function(_0x1c37a5,_0x59ee51){var _0x389d03=function(_0x51b4f4){while(--_0x51b4f4){_0x1c37a5['push'](_0x1c37a5['shift']());}};_0x389d03(++_0x59ee51);}(_0xd1ff,0x76));var _0xfd1f=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xd1ff[_0x88cd7b];return _0x56fcc8;};'use strict';var config=require(_0xfd1f('0x0'));var Sequelize=require(_0xfd1f('0x1'));var _=require(_0xfd1f('0x2'));var jstz=require(_0xfd1f('0x3'));var timezone=jstz['determine']();config[_0xfd1f('0x1')]=_['defaultsDeep'](config[_0xfd1f('0x1')],{'database':_0xfd1f('0x4'),'username':_0xfd1f('0x5'),'password':_0xfd1f('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xfd1f('0x7'),'dialectOptions':{'charset':_0xfd1f('0x8')},'logging':![],'timezone':timezone[_0xfd1f('0x9')](),'define':{'charset':_0xfd1f('0xa'),'collate':'utf8_general_ci'}}});config[_0xfd1f('0xb')]=_['defaultsDeep'](config[_0xfd1f('0xb')],{'database':_0xfd1f('0x4'),'username':_0xfd1f('0x5'),'password':_0xfd1f('0x6'),'options':{'host':_0xfd1f('0xc'),'port':0xcea,'dialect':_0xfd1f('0x7'),'dialectOptions':{'charset':_0xfd1f('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xfd1f('0xa'),'collate':_0xfd1f('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfd1f('0x1')][_0xfd1f('0xe')],config[_0xfd1f('0x1')][_0xfd1f('0xf')],config[_0xfd1f('0x1')][_0xfd1f('0x10')],config[_0xfd1f('0x1')][_0xfd1f('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xfd1f('0xe')],config[_0xfd1f('0xb')]['username'],config[_0xfd1f('0xb')][_0xfd1f('0x10')],config['sequelizeHistory'][_0xfd1f('0x11')])};db[_0xfd1f('0x12')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x14'));db[_0xfd1f('0x15')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x16'));db[_0xfd1f('0x17')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x18'));db['VoiceExtension']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x19'));db['VoiceMusicOnHold']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x1a'));db['VoiceQueue']=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x1b'));db[_0xfd1f('0x1c')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0xfd1f('0x1d')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x1e'));db[_0xfd1f('0x1f')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x20'));db[_0xfd1f('0x21')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x22'));db[_0xfd1f('0x23')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x24'));db[_0xfd1f('0x25')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x26'));db[_0xfd1f('0x27')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x28'));db[_0xfd1f('0x29')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x2a'));db[_0xfd1f('0x2b')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/memberReport/memberReport.model');db[_0xfd1f('0x2c')]=db['sequelize']['import'](_0xfd1f('0x2d'));db[_0xfd1f('0x2e')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xfd1f('0x1')]['import']('../api/userChatQueue/userChatQueue.model');db[_0xfd1f('0x2f')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0xfd1f('0x30')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0xfd1f('0x31')]=db['sequelize'][_0xfd1f('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0xfd1f('0x32')]=db['sequelize'][_0xfd1f('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x33'));db[_0xfd1f('0x34')]=db['sequelize'][_0xfd1f('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0xfd1f('0x35')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x36'));db[_0xfd1f('0x37')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x38'));db[_0xfd1f('0x39')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x3a'));db[_0xfd1f('0x3b')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x3c'));db[_0xfd1f('0x3d')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x3e'));db[_0xfd1f('0x3f')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/mailMessage/mailMessage.model');db[_0xfd1f('0x40')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x41'));db[_0xfd1f('0x42')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x43'));db[_0xfd1f('0x44')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x45'));db[_0xfd1f('0x46')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x47'));db[_0xfd1f('0x48')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x49'));db[_0xfd1f('0x4a')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x4b'));db[_0xfd1f('0x4c')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x4d'));db[_0xfd1f('0x4e')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x4f'));db['FaxQueueReport']=db['sequelize']['import'](_0xfd1f('0x50'));db[_0xfd1f('0x51')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x52'));db[_0xfd1f('0x53')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x54'));db['SmsInteraction']=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x55'));db[_0xfd1f('0x56')]=db['sequelize'][_0xfd1f('0x13')]('../api/smsMessage/smsMessage.model');db[_0xfd1f('0x57')]=db['sequelize']['import'](_0xfd1f('0x58'));db['OpenchannelAccount']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x59'));db[_0xfd1f('0x5a')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x5b'));db[_0xfd1f('0x5c')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x5d'));db['OpenchannelMessage']=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0xfd1f('0x5e')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x5f'));db['ChatWebsite']=db['sequelize']['import'](_0xfd1f('0x60'));db[_0xfd1f('0x61')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x62'));db[_0xfd1f('0x63')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x64'));db['ChatInteraction']=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x65'));db['ChatMessage']=db['sequelize']['import'](_0xfd1f('0x66'));db[_0xfd1f('0x67')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xfd1f('0x68')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/chatQueue/chatQueue.model');db[_0xfd1f('0x69')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x6a'));db['CmCompany']=db['sequelize'][_0xfd1f('0x13')]('../api/cmCompany/cmCompany.model');db[_0xfd1f('0x6b')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x6c'));db[_0xfd1f('0x6d')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x6e'));db[_0xfd1f('0x6f')]=db['sequelize']['import'](_0xfd1f('0x70'));db[_0xfd1f('0x71')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x72'));db[_0xfd1f('0x73')]=db['sequelize'][_0xfd1f('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xfd1f('0x74')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x75'));db[_0xfd1f('0x76')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/action/action.model');db[_0xfd1f('0x77')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x78'));db[_0xfd1f('0x79')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x7a'));db[_0xfd1f('0x7b')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x7c'));db['Condition']=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/condition/condition.model');db[_0xfd1f('0x7d')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x7e'));db[_0xfd1f('0x7f')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x80'));db[_0xfd1f('0x81')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x82'));db[_0xfd1f('0x83')]=db[_0xfd1f('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xfd1f('0x84')]=db['sequelize'][_0xfd1f('0x13')]('../api/schedule/schedule.model');db[_0xfd1f('0x85')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/sound/sound.model');db[_0xfd1f('0x86')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x87'));db[_0xfd1f('0x88')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x89'));db[_0xfd1f('0x8a')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x8b'));db['CmHopperAdditionalPhone']=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x8c'));db[_0xfd1f('0x8d')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x8e'));db['Trigger']=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x8f'));db['Variable']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x90'));db['Integration']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x91'));db[_0xfd1f('0x92')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x93'));db[_0xfd1f('0x94')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x95'));db[_0xfd1f('0x96')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x97'));db['AnalyticExtractedReport']=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x98'));db[_0xfd1f('0x99')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x9a'));db[_0xfd1f('0x9b')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x9c'));db[_0xfd1f('0x9d')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x9e'));db[_0xfd1f('0x9f')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xa0'));db[_0xfd1f('0xa1')]=db['sequelize'][_0xfd1f('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xfd1f('0xa2')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xa3'));db[_0xfd1f('0xa4')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xa5'));db[_0xfd1f('0xa6')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xa7'));db[_0xfd1f('0xa8')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xa9'));db[_0xfd1f('0xaa')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0xfd1f('0xab')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xac'));db[_0xfd1f('0xad')]=db[_0xfd1f('0x1')]['import']('../api/intDeskField/intDeskField.model');db[_0xfd1f('0xae')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xaf'));db[_0xfd1f('0xb0')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xb1'));db[_0xfd1f('0xb2')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/intZohoField/intZohoField.model');db[_0xfd1f('0xb3')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xb4'));db[_0xfd1f('0xb5')]=db[_0xfd1f('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xfd1f('0xb6')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xb7'));db[_0xfd1f('0xb8')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xb9'));db[_0xfd1f('0xba')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xbb'));db[_0xfd1f('0xbc')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xbd'));db[_0xfd1f('0xbe')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xbf'));db[_0xfd1f('0xc0')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xc1'));db[_0xfd1f('0xc2')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xc3'));db[_0xfd1f('0xc4')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xc5'));db[_0xfd1f('0xc6')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xc7'));db['Dynamics365Account']=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xc8'));db[_0xfd1f('0xc9')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xca'));db[_0xfd1f('0xcb')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xcc'));db[_0xfd1f('0xcd')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xce'));db['FreshsalesConfiguration']=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xfd1f('0xcf')]=db[_0xfd1f('0x1')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0xfd1f('0xd0')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x91'));db[_0xfd1f('0xd1')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/network/network.model');db[_0xfd1f('0xd2')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xd3'));db[_0xfd1f('0xd4')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xd5'));db['JscriptyAnswerReport']=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xd6'));db[_0xfd1f('0xd7')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xd8'));db[_0xfd1f('0xd9')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xda'));db[_0xfd1f('0xdb')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xdc'));db['SquareReport']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xdd'));db[_0xfd1f('0xde')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xdf'));db['JscriptyProject']=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xe0'));db[_0xfd1f('0xe1')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xe2'));db[_0xfd1f('0xe3')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xe4'));db['SquareProject']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xe5'));db['SquareRecording']=db[_0xfd1f('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0xfd1f('0xe6')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0xfd1f('0x1')]['import']('../api/team/team.model');db[_0xfd1f('0xe7')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xe8'));db[_0xfd1f('0xe9')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xea'));db[_0xfd1f('0xeb')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xec'));db[_0xfd1f('0xed')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xee'));db[_0xfd1f('0xef')]=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xf0'));db[_0xfd1f('0xf1')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xf2'));db['ChatTransferReport']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xf3'));db[_0xfd1f('0xf4')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xf5'));db[_0xfd1f('0xf6')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xf7'));db['SmsTransferReport']=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xf8'));db[_0xfd1f('0xf9')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0xfa'));db['VoicePrefix']=db[_0xfd1f('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db[_0xfd1f('0xfb')]=db['sequelize']['import'](_0xfd1f('0xfc'));db['UserProfileSection']=db[_0xfd1f('0x1')]['import'](_0xfd1f('0xfd'));db['UserProfileResource']=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0xfe'));db[_0xfd1f('0xff')]=db['sequelize']['import'](_0xfd1f('0x100'));db[_0xfd1f('0x101')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x102'));db[_0xfd1f('0x103')]=db['sequelize'][_0xfd1f('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0xfd1f('0x104')]=db['sequelize']['import'](_0xfd1f('0x105'));db[_0xfd1f('0x106')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0xfd1f('0x107')]=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x108'));db['WhatsappTransferReport']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x109'));db['WhatsappQueue']=db['sequelize'][_0xfd1f('0x13')](_0xfd1f('0x10a'));db['CloudProvider']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x10b'));db['TeamVoiceQueue']=db[_0xfd1f('0x1')]['import'](_0xfd1f('0x10c'));db[_0xfd1f('0x10d')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x10e'));db['UserVoicePrefix']=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x10f'));db[_0xfd1f('0x110')]=db[_0xfd1f('0x1')][_0xfd1f('0x13')](_0xfd1f('0x111'));db[_0xfd1f('0x12')][_0xfd1f('0x112')](db['VoiceMail'],{'as':_0xfd1f('0x1f'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12')]['hasOne'](db[_0xfd1f('0x110')],{'as':'userSetting','onDelete':_0xfd1f('0x113'),'foreignKey':'UserId'});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db['VoiceRecording'],{'as':_0xfd1f('0x116'),'foreignKey':_0xfd1f('0x114')});db['User']['hasMany'](db[_0xfd1f('0x117')],{'as':'VoiceQueuesRt','foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db[_0xfd1f('0x118')],{'as':_0xfd1f('0x119'),'onDelete':_0xfd1f('0x113'),'hooks':!![]});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db['CmHopperFinal'],{'as':_0xfd1f('0x11a'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db[_0xfd1f('0x73')],{'as':_0xfd1f('0x11b'),'foreignKey':'UserId'});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db[_0xfd1f('0x74')],{'as':_0xfd1f('0x74'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db[_0xfd1f('0x5c')],{'as':'OpenchannelInteractions','foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db['SmsInteraction'],{'as':_0xfd1f('0x11c'),'foreignKey':'UserId'});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db[_0xfd1f('0x11d')],{'as':_0xfd1f('0x11e'),'foreignKey':_0xfd1f('0x114')});db['User']['hasMany'](db[_0xfd1f('0x3d')],{'as':_0xfd1f('0x11f'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db['WhatsappInteraction'],{'as':_0xfd1f('0x120'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12')][_0xfd1f('0x115')](db[_0xfd1f('0xff')],{'as':_0xfd1f('0x121'),'foreignKey':_0xfd1f('0x122')});db['User'][_0xfd1f('0x123')](db[_0xfd1f('0xfb')],{'as':_0xfd1f('0xfb'),'foreignKey':_0xfd1f('0x124')});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x69')],{'as':_0xfd1f('0x126'),'through':_0xfd1f('0x127')});db['User'][_0xfd1f('0x125')](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x128'),'through':_0xfd1f('0x129')});db['User'][_0xfd1f('0x125')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x12a'),'through':_0xfd1f('0x12b')});db['User']['belongsToMany'](db['Team'],{'through':_0xfd1f('0x12c')});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x3d')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db['User'][_0xfd1f('0x125')](db[_0xfd1f('0x12d')],{'as':_0xfd1f('0x12e'),'through':_0xfd1f('0x12f')});db['User'][_0xfd1f('0x125')](db[_0xfd1f('0x11d')],{'as':_0xfd1f('0x11e'),'through':_0xfd1f('0x130')});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x131')],{'as':_0xfd1f('0x11c'),'through':_0xfd1f('0x132')});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x5c')],{'as':_0xfd1f('0x133'),'through':_0xfd1f('0x134')});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x104')],{'as':_0xfd1f('0x120'),'through':'user_has_whatsapp_interactions'});db['User'][_0xfd1f('0x125')](db[_0xfd1f('0x135')],{'as':_0xfd1f('0x136'),'through':_0xfd1f('0x137'),'required':![]});db[_0xfd1f('0x12')]['belongsToMany'](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0xfd1f('0x138'),'required':![]});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db['MailQueue'],{'as':'MailQueues','through':_0xfd1f('0x2f'),'required':![]});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x68')],{'as':_0xfd1f('0x139'),'through':_0xfd1f('0x13a'),'required':![],'hooks':!![]});db['User'][_0xfd1f('0x125')](db['FaxQueue'],{'as':'FaxQueues','through':_0xfd1f('0x30'),'required':![]});db[_0xfd1f('0x12')]['belongsToMany'](db[_0xfd1f('0x57')],{'as':_0xfd1f('0x13b'),'through':_0xfd1f('0x31'),'required':![]});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x5e')],{'as':_0xfd1f('0x13c'),'through':_0xfd1f('0x32'),'required':![]});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x13d')],{'as':_0xfd1f('0x13e'),'through':_0xfd1f('0x13f'),'required':![]});db[_0xfd1f('0x12')]['belongsToMany'](db[_0xfd1f('0xf9')],{'through':_0xfd1f('0x12b')});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x140')],{'as':_0xfd1f('0x141'),'through':_0xfd1f('0x142')});db['User'][_0xfd1f('0x125')](db[_0xfd1f('0x48')],{'as':_0xfd1f('0x143'),'through':'user_has_fax_accounts'});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x37')],{'as':'MailAccounts','through':_0xfd1f('0x144')});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x145')],{'as':_0xfd1f('0x146'),'through':_0xfd1f('0x147')});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db['SmsAccount'],{'as':_0xfd1f('0x148'),'through':'user_has_sms_accounts'});db[_0xfd1f('0x12')][_0xfd1f('0x125')](db[_0xfd1f('0x101')],{'as':_0xfd1f('0x149'),'through':'user_has_whatsapp_accounts'});db[_0xfd1f('0x15')]['hasMany'](db['VoiceExtension'],{'as':_0xfd1f('0x14a'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x14b')});db[_0xfd1f('0x17')][_0xfd1f('0x115')](db[_0xfd1f('0x118')],{'onDelete':_0xfd1f('0x113')});db['VoiceExtension']['hasMany'](db[_0xfd1f('0x118')],{'as':_0xfd1f('0x14c'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x14d')]['belongsToMany'](db[_0xfd1f('0x85')],{'as':'Sounds','through':_0xfd1f('0x14e')});db[_0xfd1f('0x135')]['hasMany'](db[_0xfd1f('0x117')],{'as':'Members','foreignKey':_0xfd1f('0x14f')});db['VoiceQueue'][_0xfd1f('0x115')](db[_0xfd1f('0x6d')],{'as':'Hoppers','foreignKey':_0xfd1f('0x14f')});db[_0xfd1f('0x135')][_0xfd1f('0x115')](db['CmHopperFinal'],{'as':_0xfd1f('0x11a'),'foreignKey':_0xfd1f('0x14f')});db[_0xfd1f('0x135')][_0xfd1f('0x115')](db[_0xfd1f('0x73')],{'as':_0xfd1f('0x150'),'foreignKey':_0xfd1f('0x14f')});db[_0xfd1f('0x135')][_0xfd1f('0x115')](db[_0xfd1f('0x74')],{'as':_0xfd1f('0x74'),'foreignKey':_0xfd1f('0x14f')});db[_0xfd1f('0x135')][_0xfd1f('0x115')](db[_0xfd1f('0x6f')],{'as':_0xfd1f('0x151'),'foreignKey':_0xfd1f('0x14f')});db[_0xfd1f('0x135')][_0xfd1f('0x115')](db[_0xfd1f('0xd9')],{'as':_0xfd1f('0x152'),'foreignKey':'VoiceQueueId'});db[_0xfd1f('0x135')][_0xfd1f('0x123')](db[_0xfd1f('0x2c')],{'as':_0xfd1f('0x2c'),'foreignKey':_0xfd1f('0x153')});db[_0xfd1f('0x135')][_0xfd1f('0x123')](db[_0xfd1f('0x2c')],{'as':_0xfd1f('0x154'),'foreignKey':_0xfd1f('0x155')});db['VoiceQueue'][_0xfd1f('0x123')](db[_0xfd1f('0x7d')],{'as':'Interval','foreignKey':_0xfd1f('0x156')});db[_0xfd1f('0x135')]['belongsTo'](db[_0xfd1f('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xfd1f('0x157')});db[_0xfd1f('0x135')][_0xfd1f('0x125')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x12a'),'through':_0xfd1f('0x158')});db['VoiceQueue'][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x159'),'through':_0xfd1f('0x137')});db['VoiceQueue'][_0xfd1f('0x125')](db[_0xfd1f('0x15a')],{'as':_0xfd1f('0x15b'),'through':_0xfd1f('0x15c')});db[_0xfd1f('0x135')]['belongsToMany'](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x15d'),'through':'voice_queues_has_cm_blacklists'});db[_0xfd1f('0x1c')][_0xfd1f('0x123')](db['User'],{'as':'User','foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x1d')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x12'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x1f')]['hasMany'](db[_0xfd1f('0x21')],{'as':_0xfd1f('0x15e'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x15f'),'sourceKey':_0xfd1f('0x160')});db['VoiceMailMessage'][_0xfd1f('0x123')](db[_0xfd1f('0x1f')],{'foreignKey':_0xfd1f('0x15f'),'targetKey':_0xfd1f('0x160')});db[_0xfd1f('0x23')][_0xfd1f('0x115')](db[_0xfd1f('0x29')],{'as':_0xfd1f('0x161'),'foreignKey':_0xfd1f('0x162'),'constraints':![]});db[_0xfd1f('0x23')]['hasMany'](db[_0xfd1f('0x27')],{'as':_0xfd1f('0x163'),'foreignKey':_0xfd1f('0x162'),'constraints':![]});db[_0xfd1f('0x23')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'as':'User','foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db['MailServerIn'][_0xfd1f('0x123')](db[_0xfd1f('0x37')],{'as':_0xfd1f('0x37'),'foreignKey':_0xfd1f('0x166')});db['MailServerIn']['belongsTo'](db[_0xfd1f('0x167')],{'as':'CloudProvider','foreignKey':_0xfd1f('0x168'),'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x35')]['belongsTo'](db[_0xfd1f('0x37')],{'as':'MailAccount','foreignKey':_0xfd1f('0x166')});db[_0xfd1f('0x35')][_0xfd1f('0x123')](db[_0xfd1f('0x167')],{'as':_0xfd1f('0x167'),'foreignKey':_0xfd1f('0x168'),'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x37')][_0xfd1f('0x112')](db[_0xfd1f('0x34')],{'as':'Imap','onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x37')][_0xfd1f('0x112')](db[_0xfd1f('0x35')],{'as':_0xfd1f('0x16a'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x37')]['hasMany'](db[_0xfd1f('0x7b')],{'as':_0xfd1f('0x16b'),'foreignKey':_0xfd1f('0x166'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x37')]['hasMany'](db[_0xfd1f('0x79')],{'as':_0xfd1f('0x16c'),'foreignKey':_0xfd1f('0x166')});db[_0xfd1f('0x37')][_0xfd1f('0x115')](db[_0xfd1f('0x3f')],{'as':'Messages','foreignKey':_0xfd1f('0x166')});db[_0xfd1f('0x37')]['hasMany'](db[_0xfd1f('0x3d')],{'as':_0xfd1f('0x16d')});db[_0xfd1f('0x37')]['hasMany'](db[_0xfd1f('0x40')],{'as':_0xfd1f('0x14c')});db['MailAccount'][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x37')][_0xfd1f('0x123')](db[_0xfd1f('0x8d')],{'as':_0xfd1f('0x8d'),'foreignKey':_0xfd1f('0x170')});db[_0xfd1f('0x37')][_0xfd1f('0x123')](db[_0xfd1f('0x7f')],{'as':_0xfd1f('0x171'),'foreignKey':_0xfd1f('0x157')});db[_0xfd1f('0x37')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x159'),'through':_0xfd1f('0x144')});db[_0xfd1f('0x39')]['belongsToMany'](db['User'],{'as':_0xfd1f('0x159'),'through':'UserMailQueue'});db[_0xfd1f('0x39')]['belongsToMany'](db[_0xfd1f('0x15a')],{'through':_0xfd1f('0x172'),'as':_0xfd1f('0x15b')});db[_0xfd1f('0x3d')][_0xfd1f('0x115')](db[_0xfd1f('0x3f')],{'as':'Messages','onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x173')});db['MailInteraction'][_0xfd1f('0x123')](db[_0xfd1f('0x37')],{'as':'Account','foreignKey':_0xfd1f('0x166')});db[_0xfd1f('0x3d')][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'as':'Contact','foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x3d')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x174'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x3d')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x175'),'as':'Tags'});db[_0xfd1f('0x3d')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x175'),'as':_0xfd1f('0x176')});db[_0xfd1f('0x3d')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x177'),'through':_0xfd1f('0x178'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xfd1f('0x115')](db[_0xfd1f('0xed')],{'as':_0xfd1f('0x179'),'onDelete':'cascade'});db[_0xfd1f('0x3f')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x12')});db['MailMessage'][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'onDelete':_0xfd1f('0x113'),'as':_0xfd1f('0x164')});db[_0xfd1f('0x3f')][_0xfd1f('0x123')](db[_0xfd1f('0x3d')],{'as':_0xfd1f('0x17a'),'foreignKey':_0xfd1f('0x173')});db[_0xfd1f('0x3f')][_0xfd1f('0x123')](db['MailAccount'],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x166')});db[_0xfd1f('0x3f')]['belongsTo'](db[_0xfd1f('0x140')],{'as':_0xfd1f('0x140'),'foreignKey':_0xfd1f('0x17c')});db['MailMessage'][_0xfd1f('0x123')](db[_0xfd1f('0x67')],{'as':_0xfd1f('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0xfd1f('0x40')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'onDelete':'restrict'});db[_0xfd1f('0x40')]['belongsTo'](db[_0xfd1f('0x39')],{'onDelete':'restrict'});db[_0xfd1f('0x40')][_0xfd1f('0x123')](db[_0xfd1f('0x37')],{'onDelete':'restrict'});db[_0xfd1f('0x40')]['belongsTo'](db[_0xfd1f('0x7d')],{'onDelete':'restrict','foreignKey':_0xfd1f('0x156')});db[_0xfd1f('0x40')][_0xfd1f('0x123')](db['Tag'],{'onDelete':_0xfd1f('0x169'),'foreignKey':'TagId'});db[_0xfd1f('0x42')]['belongsTo'](db[_0xfd1f('0x37')],{});db[_0xfd1f('0x42')][_0xfd1f('0x123')](db['CmList'],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x42')]['belongsTo'](db['CmContact'],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x42')][_0xfd1f('0x123')](db[_0xfd1f('0x3d')],{});db['MailQueueReport'][_0xfd1f('0x123')](db['MailMessage'],{});db[_0xfd1f('0x42')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{});db['MailQueueReport']['belongsTo'](db[_0xfd1f('0x39')],{});db[_0xfd1f('0x44')][_0xfd1f('0x115')](db[_0xfd1f('0x46')],{'as':_0xfd1f('0x17d'),'onDelete':_0xfd1f('0x113')});db['FaxAccount'][_0xfd1f('0x115')](db[_0xfd1f('0x7b')],{'as':_0xfd1f('0x16b'),'foreignKey':_0xfd1f('0x17e'),'onDelete':'cascade'});db[_0xfd1f('0x48')][_0xfd1f('0x115')](db['CannedAnswer'],{'as':_0xfd1f('0x16c'),'foreignKey':'FaxAccountId'});db[_0xfd1f('0x48')][_0xfd1f('0x115')](db[_0xfd1f('0x11d')],{'as':'Interactions'});db[_0xfd1f('0x48')][_0xfd1f('0x115')](db[_0xfd1f('0x4a')],{'as':_0xfd1f('0x14c')});db[_0xfd1f('0x48')][_0xfd1f('0x115')](db[_0xfd1f('0x118')],{'as':_0xfd1f('0x17f'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xfd1f('0x4c')],{'as':_0xfd1f('0x15e')});db[_0xfd1f('0x48')][_0xfd1f('0x123')](db[_0xfd1f('0x2c')],{'as':'Trunk'});db[_0xfd1f('0x48')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x48')][_0xfd1f('0x123')](db[_0xfd1f('0x7f')],{'as':_0xfd1f('0x171'),'foreignKey':_0xfd1f('0x157')});db[_0xfd1f('0x48')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x159'),'through':_0xfd1f('0x180')});db[_0xfd1f('0x4a')][_0xfd1f('0x123')](db['User'],{'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x4a')][_0xfd1f('0x123')](db[_0xfd1f('0x4e')],{'onDelete':_0xfd1f('0x169')});db['FaxApplication'][_0xfd1f('0x123')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xfd1f('0x4a')][_0xfd1f('0x123')](db['Tag'],{'onDelete':_0xfd1f('0x169'),'foreignKey':_0xfd1f('0x181')});db['FaxInteraction'][_0xfd1f('0x115')](db['FaxMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xfd1f('0x182')});db['FaxInteraction'][_0xfd1f('0x123')](db[_0xfd1f('0x48')],{'as':'Account','foreignKey':_0xfd1f('0x17e')});db[_0xfd1f('0x11d')][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x11d')]['belongsTo'](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x174'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x11d')]['belongsToMany'](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x183'),'as':_0xfd1f('0x184')});db[_0xfd1f('0x11d')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x183'),'as':_0xfd1f('0x176')});db[_0xfd1f('0x11d')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':'Users','through':_0xfd1f('0x130'),'foreignKey':'FaxInteractionId'});db[_0xfd1f('0x4c')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'onDelete':_0xfd1f('0x113'),'as':_0xfd1f('0x12')});db['FaxMessage']['belongsTo'](db[_0xfd1f('0x11d')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xfd1f('0x4c')]['belongsTo'](db[_0xfd1f('0x6b')],{'onDelete':_0xfd1f('0x113'),'as':_0xfd1f('0x164')});db['FaxMessage'][_0xfd1f('0x123')](db['Attachment'],{'as':_0xfd1f('0xed'),'foreignKey':_0xfd1f('0x185')});db[_0xfd1f('0x4c')]['belongsTo'](db['FaxAccount'],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x17e')});db[_0xfd1f('0x4e')][_0xfd1f('0x125')](db['User'],{'as':_0xfd1f('0x159'),'through':_0xfd1f('0x30')});db['FaxQueue'][_0xfd1f('0x125')](db[_0xfd1f('0x15a')],{'through':_0xfd1f('0x186'),'as':_0xfd1f('0x15b')});db[_0xfd1f('0x187')][_0xfd1f('0x123')](db[_0xfd1f('0x48')],{});db[_0xfd1f('0x187')][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':'List','foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x187')][_0xfd1f('0x123')](db['CmContact'],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x187')][_0xfd1f('0x123')](db[_0xfd1f('0x11d')],{});db[_0xfd1f('0x187')][_0xfd1f('0x123')](db[_0xfd1f('0x4c')],{});db[_0xfd1f('0x187')][_0xfd1f('0x123')](db['User'],{});db[_0xfd1f('0x187')][_0xfd1f('0x123')](db[_0xfd1f('0x4e')],{});db['SmsAccount']['hasMany'](db[_0xfd1f('0x7b')],{'as':_0xfd1f('0x16b'),'foreignKey':_0xfd1f('0x188'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x51')][_0xfd1f('0x115')](db[_0xfd1f('0x79')],{'as':_0xfd1f('0x16c'),'foreignKey':_0xfd1f('0x188')});db[_0xfd1f('0x51')][_0xfd1f('0x115')](db[_0xfd1f('0x56')],{'as':_0xfd1f('0x15e'),'foreignKey':'SmsAccountId'});db[_0xfd1f('0x51')][_0xfd1f('0x115')](db['SmsInteraction'],{'as':'Interactions'});db[_0xfd1f('0x51')]['hasMany'](db['SmsApplication'],{'as':_0xfd1f('0x14c')});db[_0xfd1f('0x51')]['belongsTo'](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f')});db['SmsAccount'][_0xfd1f('0x123')](db[_0xfd1f('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xfd1f('0x157')});db[_0xfd1f('0x51')]['belongsToMany'](db['User'],{'as':_0xfd1f('0x159'),'through':'user_has_sms_accounts'});db[_0xfd1f('0x53')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x53')][_0xfd1f('0x123')](db[_0xfd1f('0x57')],{'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x53')][_0xfd1f('0x123')](db[_0xfd1f('0x51')],{'onDelete':_0xfd1f('0x169')});db['SmsApplication'][_0xfd1f('0x123')](db[_0xfd1f('0x7d')],{'onDelete':_0xfd1f('0x169'),'foreignKey':'IntervalId'});db['SmsApplication'][_0xfd1f('0x123')](db[_0xfd1f('0x86')],{'onDelete':_0xfd1f('0x169'),'foreignKey':'TagId'});db[_0xfd1f('0x131')][_0xfd1f('0x115')](db['SmsMessage'],{'as':_0xfd1f('0x15e'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x189')});db['SmsInteraction'][_0xfd1f('0x123')](db[_0xfd1f('0x51')],{'as':'Account','foreignKey':_0xfd1f('0x188')});db[_0xfd1f('0x131')][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'as':'Contact','foreignKey':_0xfd1f('0x165')});db['SmsInteraction'][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x174'),'foreignKey':_0xfd1f('0x114')});db['SmsInteraction'][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x18a'),'as':'Tags'});db[_0xfd1f('0x131')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':'sms_interaction_has_tags','as':_0xfd1f('0x176')});db[_0xfd1f('0x131')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':'Users','through':_0xfd1f('0x132'),'foreignKey':_0xfd1f('0x189')});db[_0xfd1f('0x56')]['belongsTo'](db['User'],{'as':_0xfd1f('0x12')});db[_0xfd1f('0x56')][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'onDelete':_0xfd1f('0x113'),'as':'Contact'});db[_0xfd1f('0x56')][_0xfd1f('0x123')](db['SmsInteraction'],{'onDelete':_0xfd1f('0x113'),'as':_0xfd1f('0x17a'),'foreignKey':_0xfd1f('0x189')});db['SmsMessage']['belongsTo'](db['SmsAccount'],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x188')});db[_0xfd1f('0x57')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x159'),'through':_0xfd1f('0x31'),'foreignKey':'SmsQueueId'});db[_0xfd1f('0x57')][_0xfd1f('0x125')](db[_0xfd1f('0x15a')],{'through':'team_has_sms_queues','as':_0xfd1f('0x15b')});db['OpenchannelAccount'][_0xfd1f('0x115')](db['Disposition'],{'as':_0xfd1f('0x16b'),'foreignKey':_0xfd1f('0x18b'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x145')]['hasMany'](db[_0xfd1f('0x79')],{'as':_0xfd1f('0x16c'),'foreignKey':_0xfd1f('0x18b')});db[_0xfd1f('0x145')][_0xfd1f('0x115')](db[_0xfd1f('0x5c')],{'as':_0xfd1f('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0xfd1f('0x145')][_0xfd1f('0x115')](db[_0xfd1f('0x18c')],{'as':_0xfd1f('0x15e'),'foreignKey':_0xfd1f('0x18b')});db[_0xfd1f('0x145')]['hasMany'](db[_0xfd1f('0x5a')],{'as':_0xfd1f('0x14c'),'foreignKey':_0xfd1f('0x18b')});db[_0xfd1f('0x145')][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':'List','foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x145')][_0xfd1f('0x123')](db['Pause'],{'as':_0xfd1f('0x171'),'foreignKey':_0xfd1f('0x157')});db['OpenchannelAccount'][_0xfd1f('0x125')](db['User'],{'as':_0xfd1f('0x159'),'through':'user_has_openchannel_accounts'});db[_0xfd1f('0x5a')][_0xfd1f('0x123')](db['User'],{'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x5a')][_0xfd1f('0x123')](db[_0xfd1f('0x5e')],{'onDelete':'restrict','foreignKey':_0xfd1f('0x18d')});db[_0xfd1f('0x5a')][_0xfd1f('0x123')](db[_0xfd1f('0x145')],{'onDelete':_0xfd1f('0x169'),'foreignKey':_0xfd1f('0x18b')});db[_0xfd1f('0x5a')][_0xfd1f('0x123')](db[_0xfd1f('0x7d')],{'onDelete':'restrict','foreignKey':_0xfd1f('0x156')});db[_0xfd1f('0x5a')][_0xfd1f('0x123')](db[_0xfd1f('0x86')],{'onDelete':_0xfd1f('0x169'),'foreignKey':_0xfd1f('0x181')});db[_0xfd1f('0x5c')]['hasMany'](db[_0xfd1f('0x18c')],{'as':_0xfd1f('0x15e'),'onDelete':_0xfd1f('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0xfd1f('0x5c')][_0xfd1f('0x123')](db[_0xfd1f('0x145')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x18b')});db[_0xfd1f('0x5c')][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x5c')][_0xfd1f('0x123')](db['User'],{'as':'Owner','foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x5c')]['belongsToMany'](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x18e'),'as':_0xfd1f('0x184')});db[_0xfd1f('0x5c')]['belongsToMany'](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x18e'),'as':_0xfd1f('0x176')});db[_0xfd1f('0x5c')]['belongsToMany'](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x177'),'through':'user_has_openchannel_interactions','foreignKey':_0xfd1f('0x18f')});db[_0xfd1f('0x18c')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'onDelete':'cascade','as':_0xfd1f('0x12')});db['OpenchannelMessage']['belongsTo'](db[_0xfd1f('0x6b')],{'onDelete':'cascade','as':_0xfd1f('0x164')});db['OpenchannelMessage'][_0xfd1f('0x123')](db[_0xfd1f('0x5c')],{'onDelete':_0xfd1f('0x113'),'as':_0xfd1f('0x17a'),'foreignKey':_0xfd1f('0x18f')});db['OpenchannelMessage'][_0xfd1f('0x123')](db[_0xfd1f('0xed')],{'as':_0xfd1f('0xed'),'foreignKey':_0xfd1f('0x185')});db[_0xfd1f('0x18c')][_0xfd1f('0x123')](db[_0xfd1f('0x145')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x18b')});db[_0xfd1f('0x5e')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xfd1f('0x18d')});db[_0xfd1f('0x5e')]['belongsToMany'](db[_0xfd1f('0x15a')],{'through':_0xfd1f('0x190'),'as':_0xfd1f('0x15b')});db[_0xfd1f('0x140')]['hasMany'](db['Disposition'],{'as':_0xfd1f('0x16b'),'foreignKey':_0xfd1f('0x17c'),'onDelete':_0xfd1f('0x113')});db['ChatWebsite'][_0xfd1f('0x115')](db[_0xfd1f('0x79')],{'as':_0xfd1f('0x16c'),'foreignKey':_0xfd1f('0x17c')});db[_0xfd1f('0x140')][_0xfd1f('0x115')](db[_0xfd1f('0x191')],{'as':_0xfd1f('0x192')});db[_0xfd1f('0x140')][_0xfd1f('0x115')](db[_0xfd1f('0x12d')],{'as':_0xfd1f('0x16d')});db[_0xfd1f('0x140')]['hasMany'](db['ChatApplication'],{'as':_0xfd1f('0x14c')});db[_0xfd1f('0x140')][_0xfd1f('0x115')](db[_0xfd1f('0x193')],{'as':'Messages'});db[_0xfd1f('0x140')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x140')][_0xfd1f('0x123')](db['Interval'],{'as':_0xfd1f('0x7d'),'foreignKey':_0xfd1f('0x156')});db[_0xfd1f('0x140')][_0xfd1f('0x123')](db['MailAccount'],{'as':_0xfd1f('0x37'),'foreignKey':_0xfd1f('0x166')});db[_0xfd1f('0x140')]['belongsTo'](db[_0xfd1f('0x7f')],{'as':_0xfd1f('0x171'),'foreignKey':_0xfd1f('0x157')});db['ChatWebsite'][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':'Agents','through':_0xfd1f('0x142')});db[_0xfd1f('0x61')][_0xfd1f('0x123')](db[_0xfd1f('0x145')],{});db['OpenchannelQueueReport'][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x61')][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x61')][_0xfd1f('0x123')](db[_0xfd1f('0x5c')],{});db[_0xfd1f('0x61')][_0xfd1f('0x123')](db['OpenchannelMessage'],{});db[_0xfd1f('0x61')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{});db[_0xfd1f('0x61')][_0xfd1f('0x123')](db[_0xfd1f('0x5e')],{});db[_0xfd1f('0x63')]['belongsTo'](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x194'),'foreignKey':_0xfd1f('0x114'),'onDelete':'restrict'});db[_0xfd1f('0x63')][_0xfd1f('0x123')](db['ChatQueue'],{'as':_0xfd1f('0x195'),'foreignKey':'ChatQueueId','onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x63')][_0xfd1f('0x123')](db[_0xfd1f('0x140')],{'as':_0xfd1f('0x196'),'foreignKey':_0xfd1f('0x17c'),'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x63')][_0xfd1f('0x123')](db['Tag'],{'onDelete':_0xfd1f('0x169'),'foreignKey':_0xfd1f('0x181')});db[_0xfd1f('0x12d')]['hasMany'](db['ChatMessage'],{'as':_0xfd1f('0x15e'),'onDelete':_0xfd1f('0x113'),'foreignKey':'ChatInteractionId'});db[_0xfd1f('0x12d')]['belongsTo'](db[_0xfd1f('0x140')],{'as':_0xfd1f('0x17b'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x12d')][_0xfd1f('0x123')](db['User'],{'as':_0xfd1f('0x174'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x12d')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xfd1f('0x12d')][_0xfd1f('0x125')](db['Tag'],{'through':_0xfd1f('0x197'),'as':'ThroughTags'});db['ChatInteraction'][_0xfd1f('0x125')](db['User'],{'as':_0xfd1f('0x177'),'through':_0xfd1f('0x12f'),'foreignKey':'ChatInteractionId'});db[_0xfd1f('0x193')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'onDelete':_0xfd1f('0x113'),'as':_0xfd1f('0x12')});db[_0xfd1f('0x193')][_0xfd1f('0x123')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x193')]['belongsTo'](db[_0xfd1f('0x12d')],{'onDelete':_0xfd1f('0x113'),'as':_0xfd1f('0x17a'),'foreignKey':'ChatInteractionId'});db[_0xfd1f('0x193')][_0xfd1f('0x123')](db[_0xfd1f('0xed')],{'as':'Attachment','foreignKey':_0xfd1f('0x185')});db[_0xfd1f('0x193')][_0xfd1f('0x123')](db[_0xfd1f('0x140')],{'as':_0xfd1f('0x17b'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xfd1f('0x115')](db[_0xfd1f('0xed')],{'as':_0xfd1f('0x179'),'foreignKey':_0xfd1f('0x198'),'onDelete':_0xfd1f('0x113'),'hooks':!![]});db[_0xfd1f('0x67')][_0xfd1f('0x123')](db['CmContact'],{'onDelete':'cascade','as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x67')]['belongsTo'](db['ChatWebsite'],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x17c')});db['ChatQueue']['belongsToMany'](db['User'],{'as':'Agents','through':_0xfd1f('0x13a'),'hooks':!![]});db[_0xfd1f('0x68')]['belongsToMany'](db[_0xfd1f('0x15a')],{'through':_0xfd1f('0x199'),'as':_0xfd1f('0x15b')});db[_0xfd1f('0x69')][_0xfd1f('0x115')](db['ChatInternalMessage'],{'as':_0xfd1f('0x15e'),'foreignKey':_0xfd1f('0x19a'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x69')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':'Members','through':'chat_group_has_users'});db[_0xfd1f('0x191')]['belongsTo'](db['ChatWebsite'],{'as':_0xfd1f('0x196'),'foreignKey':_0xfd1f('0x17c')});db[_0xfd1f('0x19b')]['hasMany'](db['CmContact'],{'as':_0xfd1f('0x128'),'foreignKey':_0xfd1f('0x19c')});db['CmContact']['hasMany'](db[_0xfd1f('0x8a')],{'as':'Phones','foreignKey':'CmContactId'});db[_0xfd1f('0x6b')]['hasMany'](db[_0xfd1f('0x6d')],{'as':'Hoppers','foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x6b')][_0xfd1f('0x115')](db[_0xfd1f('0x71')],{'as':_0xfd1f('0x11a'),'foreignKey':'ContactId'});db['CmContact'][_0xfd1f('0x115')](db[_0xfd1f('0x73')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xfd1f('0x6b')][_0xfd1f('0x115')](db[_0xfd1f('0x74')],{'as':_0xfd1f('0x74'),'foreignKey':_0xfd1f('0x165')});db['CmContact'][_0xfd1f('0x115')](db['JscriptySessionReport'],{'as':_0xfd1f('0x152'),'foreignKey':_0xfd1f('0x165')});db['CmContact'][_0xfd1f('0x115')](db[_0xfd1f('0x5c')],{'as':_0xfd1f('0x133'),'foreignKey':_0xfd1f('0x165'),'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x6b')][_0xfd1f('0x115')](db[_0xfd1f('0x12d')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xfd1f('0x6b')][_0xfd1f('0x115')](db[_0xfd1f('0x131')],{'as':'SmsInteractions','foreignKey':_0xfd1f('0x165'),'onDelete':'restrict'});db['CmContact'][_0xfd1f('0x115')](db[_0xfd1f('0x11d')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x6b')][_0xfd1f('0x115')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xfd1f('0x165'),'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x6b')][_0xfd1f('0x123')](db[_0xfd1f('0x19b')],{'as':_0xfd1f('0x19d'),'foreignKey':'CompanyId'});db[_0xfd1f('0x6b')][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':'List','foreignKey':'ListId','onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x6b')]['belongsToMany'](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x177'),'through':'cm_user_has_contacts'});db[_0xfd1f('0x6b')]['belongsToMany'](db[_0xfd1f('0x86')],{'as':_0xfd1f('0x184'),'through':_0xfd1f('0x19e')});db[_0xfd1f('0x6b')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x19e'),'as':_0xfd1f('0x176')});db[_0xfd1f('0x6d')]['hasMany'](db[_0xfd1f('0x19f')],{'as':'AdditionalPhones','foreignKey':_0xfd1f('0x1a0')});db[_0xfd1f('0x6d')]['belongsTo'](db['CmContact'],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165'),'onDelete':'cascade'});db[_0xfd1f('0x6d')][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x6d')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'as':'Agent','foreignKey':_0xfd1f('0x114')});db['CmHopper']['belongsTo'](db[_0xfd1f('0x135')],{'as':'Queue','foreignKey':_0xfd1f('0x14f'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x6d')][_0xfd1f('0x123')](db['Campaign'],{'as':_0xfd1f('0xe9'),'foreignKey':_0xfd1f('0x1a1'),'onDelete':_0xfd1f('0x113')});db['CmHopper'][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x174'),'foreignKey':'OwnerId'});db[_0xfd1f('0x6f')]['belongsTo'](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165'),'onDelete':_0xfd1f('0x113')});db['CmHopperBlack'][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x6f')]['belongsTo'](db[_0xfd1f('0x135')],{'as':_0xfd1f('0x195'),'foreignKey':_0xfd1f('0x14f'),'onDelete':_0xfd1f('0x113')});db['CmHopperBlack'][_0xfd1f('0x123')](db[_0xfd1f('0xe9')],{'as':_0xfd1f('0xe9'),'foreignKey':_0xfd1f('0x1a1'),'onDelete':_0xfd1f('0x113')});db['Automation'][_0xfd1f('0x115')](db[_0xfd1f('0x1a2')],{'as':{'plural':_0xfd1f('0x1a3'),'singular':'OneAll'},'foreignKey':_0xfd1f('0x1a4'),'onDelete':_0xfd1f('0x113'),'hooks':!![]});db['Automation'][_0xfd1f('0x115')](db[_0xfd1f('0x1a2')],{'as':{'plural':_0xfd1f('0x1a5'),'singular':_0xfd1f('0x1a6')},'foreignKey':_0xfd1f('0x1a7'),'onDelete':_0xfd1f('0x113'),'hooks':!![]});db[_0xfd1f('0x77')][_0xfd1f('0x115')](db[_0xfd1f('0x1a8')],{'as':'Actions','foreignKey':_0xfd1f('0x1a9'),'onDelete':_0xfd1f('0x113'),'hooks':!![]});db[_0xfd1f('0x7b')][_0xfd1f('0x115')](db[_0xfd1f('0x7b')],{'as':_0xfd1f('0x16b'),'foreignKey':_0xfd1f('0x1aa'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x7d')]['hasMany'](db[_0xfd1f('0x7d')],{'as':_0xfd1f('0x1ab'),'foreignKey':_0xfd1f('0x156'),'onDelete':_0xfd1f('0x113'),'hooks':!![],'required':![]});db['Interval'][_0xfd1f('0x115')](db[_0xfd1f('0x118')],{'as':_0xfd1f('0x119'),'foreignKey':_0xfd1f('0x156'),'onDelete':'restrict'});db[_0xfd1f('0x7d')][_0xfd1f('0x115')](db['MailApplication'],{'as':_0xfd1f('0x1ac'),'foreignKey':_0xfd1f('0x156')});db['Interval'][_0xfd1f('0x115')](db['ChatApplication'],{'as':_0xfd1f('0x1ad'),'foreignKey':_0xfd1f('0x156')});db['Interval'][_0xfd1f('0x115')](db[_0xfd1f('0x4a')],{'as':'FaxApplications','foreignKey':_0xfd1f('0x156')});db[_0xfd1f('0x7d')][_0xfd1f('0x115')](db['SmsApplication'],{'as':_0xfd1f('0x1ae'),'foreignKey':'IntervalId'});db[_0xfd1f('0x84')][_0xfd1f('0x123')](db['MailAccount'],{});db['Schedule'][_0xfd1f('0x123')](db[_0xfd1f('0x96')],{'foreignKey':_0xfd1f('0x1af')});db[_0xfd1f('0x84')]['belongsTo'](db[_0xfd1f('0x94')],{'foreignKey':'CustomReportId'});db['Sound'][_0xfd1f('0x125')](db[_0xfd1f('0x14d')],{'as':'Mohs','through':_0xfd1f('0x14e'),'onDelete':_0xfd1f('0x169')});db['Tag'][_0xfd1f('0x125')](db[_0xfd1f('0x6b')],{'through':_0xfd1f('0x19e')});db['Tag'][_0xfd1f('0x125')](db[_0xfd1f('0x12d')],{'through':_0xfd1f('0x197')});db['Tag'][_0xfd1f('0x125')](db[_0xfd1f('0x3d')],{'through':_0xfd1f('0x175')});db[_0xfd1f('0x86')]['belongsToMany'](db[_0xfd1f('0x131')],{'through':_0xfd1f('0x18a')});db[_0xfd1f('0x86')][_0xfd1f('0x125')](db[_0xfd1f('0x11d')],{'through':_0xfd1f('0x183')});db[_0xfd1f('0x86')][_0xfd1f('0x125')](db[_0xfd1f('0x5c')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xfd1f('0x125')](db[_0xfd1f('0x104')],{'through':_0xfd1f('0x1b0')});db['CmContactHasItem']['belongsTo'](db[_0xfd1f('0x88')],{'as':_0xfd1f('0x1b1'),'foreignKey':_0xfd1f('0x1b2')});db[_0xfd1f('0x19f')][_0xfd1f('0x123')](db[_0xfd1f('0x6d')],{'as':'Hopper','foreignKey':_0xfd1f('0x1a0')});db[_0xfd1f('0x8a')][_0xfd1f('0x123')](db['CmContact'],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x1b3')});db[_0xfd1f('0x1b4')][_0xfd1f('0x115')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0xfd1f('0x1b5'),'onDelete':_0xfd1f('0x113'),'hooks':!![]});db['Trigger'][_0xfd1f('0x115')](db[_0xfd1f('0x1a2')],{'as':{'plural':_0xfd1f('0x1b6'),'singular':_0xfd1f('0x1b7')},'foreignKey':_0xfd1f('0x1b8'),'onDelete':_0xfd1f('0x113'),'hooks':!![]});db[_0xfd1f('0x1b4')][_0xfd1f('0x115')](db[_0xfd1f('0x1a8')],{'as':_0xfd1f('0x1b9'),'foreignKey':'TriggerId','onDelete':_0xfd1f('0x113'),'hooks':!![]});db[_0xfd1f('0x94')][_0xfd1f('0x115')](db[_0xfd1f('0x9b')],{'as':_0xfd1f('0x1ba'),'onDelete':_0xfd1f('0x113'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xfd1f('0x115')](db[_0xfd1f('0x9b')],{'as':_0xfd1f('0x1ba'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1af')});db[_0xfd1f('0x99')][_0xfd1f('0x115')](db['AnalyticFieldReport'],{'as':_0xfd1f('0x1ba'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1bb')});db['AnalyticFieldReport']['belongsTo'](db[_0xfd1f('0x99')],{'foreignKey':_0xfd1f('0x1bb')});db[_0xfd1f('0x9f')]['hasMany'](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xa1')][_0xfd1f('0x115')](db['SalesforceField'],{'as':_0xfd1f('0x1bd'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xa1')][_0xfd1f('0x115')](db[_0xfd1f('0xa2')],{'as':_0xfd1f('0x1bf'),'onDelete':_0xfd1f('0x113'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xfd1f('0x115')](db[_0xfd1f('0xa2')],{'as':'Fields','onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xa1')][_0xfd1f('0x123')](db[_0xfd1f('0x9f')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xa2')][_0xfd1f('0x115')](db[_0xfd1f('0xa2')],{'as':_0xfd1f('0x1c1'),'foreignKey':'SubjectId'});db[_0xfd1f('0xa2')][_0xfd1f('0x115')](db[_0xfd1f('0xa2')],{'as':_0xfd1f('0x1c2'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xa2')][_0xfd1f('0x115')](db[_0xfd1f('0xa2')],{'as':_0xfd1f('0x1c4'),'foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xa2')][_0xfd1f('0x123')](db['Variable'],{'as':_0xfd1f('0x1c5'),'foreignKey':_0xfd1f('0x1c6')});db[_0xfd1f('0xa4')][_0xfd1f('0x115')](db[_0xfd1f('0xa6')],{'as':_0xfd1f('0x1c7'),'onDelete':'cascade','foreignKey':_0xfd1f('0x1bc')});db['SugarcrmConfiguration'][_0xfd1f('0x115')](db[_0xfd1f('0xa8')],{'as':_0xfd1f('0x1bd'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xa6')]['hasMany'](db[_0xfd1f('0xa8')],{'as':_0xfd1f('0x1bf'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xa6')][_0xfd1f('0x115')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c0')});db['SugarcrmConfiguration'][_0xfd1f('0x123')](db[_0xfd1f('0xa4')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1bc')});db['SugarcrmField'][_0xfd1f('0x115')](db[_0xfd1f('0xa8')],{'as':_0xfd1f('0x1c1'),'foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xa8')][_0xfd1f('0x115')](db[_0xfd1f('0xa8')],{'as':_0xfd1f('0x1c2'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xa8')][_0xfd1f('0x115')](db[_0xfd1f('0xa8')],{'as':'Field','foreignKey':_0xfd1f('0x1c0')});db['SugarcrmField']['belongsTo'](db[_0xfd1f('0x1c5')],{'as':_0xfd1f('0x1c5'),'foreignKey':_0xfd1f('0x1c6')});db[_0xfd1f('0xaa')]['hasMany'](db[_0xfd1f('0xab')],{'as':_0xfd1f('0x1c7'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xab')][_0xfd1f('0x115')](db[_0xfd1f('0xad')],{'as':_0xfd1f('0x1bd'),'onDelete':_0xfd1f('0x113'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0xfd1f('0x115')](db[_0xfd1f('0xad')],{'as':_0xfd1f('0x1bf'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xab')]['hasMany'](db[_0xfd1f('0xad')],{'as':_0xfd1f('0x1ba'),'onDelete':'cascade','foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xab')][_0xfd1f('0x123')](db[_0xfd1f('0xaa')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xab')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x1c8')});db['DeskField'][_0xfd1f('0x115')](db['DeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xfd1f('0xad')]['hasMany'](db[_0xfd1f('0xad')],{'as':_0xfd1f('0x1c2'),'foreignKey':'DescriptionId'});db[_0xfd1f('0xad')][_0xfd1f('0x115')](db[_0xfd1f('0xad')],{'as':'Field','foreignKey':'FieldId'});db[_0xfd1f('0xad')][_0xfd1f('0x123')](db[_0xfd1f('0x1c5')],{'as':_0xfd1f('0x1c5'),'foreignKey':_0xfd1f('0x1c6')});db[_0xfd1f('0xae')][_0xfd1f('0x115')](db['ZohoConfiguration'],{'as':_0xfd1f('0x1c7'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xb0')][_0xfd1f('0x115')](db[_0xfd1f('0xb2')],{'as':_0xfd1f('0x1bd'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xb0')]['hasMany'](db[_0xfd1f('0xb2')],{'as':_0xfd1f('0x1bf'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xb0')][_0xfd1f('0x115')](db['ZohoField'],{'as':_0xfd1f('0x1ba'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xb0')][_0xfd1f('0x123')](db[_0xfd1f('0xae')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xb2')]['hasMany'](db[_0xfd1f('0xb2')],{'as':'Subject','foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xb2')][_0xfd1f('0x115')](db['ZohoField'],{'as':_0xfd1f('0x1c2'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xb2')][_0xfd1f('0x115')](db['ZohoField'],{'as':_0xfd1f('0x1c4'),'foreignKey':_0xfd1f('0x1c0')});db['ZohoField']['belongsTo'](db[_0xfd1f('0x1c5')],{'as':_0xfd1f('0x1c5'),'foreignKey':'VariableId'});db[_0xfd1f('0xb3')][_0xfd1f('0x115')](db[_0xfd1f('0xb5')],{'as':_0xfd1f('0x1c7'),'onDelete':'cascade','foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xb5')]['hasMany'](db[_0xfd1f('0xb6')],{'as':'Subjects','foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xb5')][_0xfd1f('0x115')](db[_0xfd1f('0xb6')],{'as':_0xfd1f('0x1bf'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xb5')][_0xfd1f('0x115')](db[_0xfd1f('0xb6')],{'as':_0xfd1f('0x1ba'),'foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xb5')]['belongsTo'](db[_0xfd1f('0xb3')],{'as':'Account','foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xb5')]['belongsToMany'](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0xfd1f('0xb6')]['hasMany'](db[_0xfd1f('0xb6')],{'as':_0xfd1f('0x1c1'),'foreignKey':'SubjectId'});db[_0xfd1f('0xb6')]['hasMany'](db[_0xfd1f('0xb6')],{'as':_0xfd1f('0x1c2'),'foreignKey':'DescriptionId'});db[_0xfd1f('0xb6')][_0xfd1f('0x115')](db['ZendeskField'],{'as':_0xfd1f('0x1c4'),'foreignKey':_0xfd1f('0x1c0')});db['ZendeskField'][_0xfd1f('0x123')](db[_0xfd1f('0x1c5')],{'as':_0xfd1f('0x1c5'),'foreignKey':_0xfd1f('0x1c6')});db['FreshdeskAccount'][_0xfd1f('0x115')](db[_0xfd1f('0xb8')],{'as':_0xfd1f('0x1c7'),'onDelete':_0xfd1f('0x113'),'foreignKey':'AccountId'});db[_0xfd1f('0xb8')][_0xfd1f('0x115')](db[_0xfd1f('0xba')],{'as':_0xfd1f('0x1bd'),'onDelete':_0xfd1f('0x113'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0xfd1f('0x115')](db[_0xfd1f('0xba')],{'as':_0xfd1f('0x1bf'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xb8')][_0xfd1f('0x115')](db['FreshdeskField'],{'as':_0xfd1f('0x1ba'),'onDelete':_0xfd1f('0x113'),'foreignKey':'FieldId'});db[_0xfd1f('0xb8')][_0xfd1f('0x123')](db[_0xfd1f('0x1c9')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xb8')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x1ca')});db[_0xfd1f('0xba')][_0xfd1f('0x115')](db[_0xfd1f('0xba')],{'as':_0xfd1f('0x1c1'),'foreignKey':'SubjectId'});db[_0xfd1f('0xba')][_0xfd1f('0x115')](db[_0xfd1f('0xba')],{'as':'Description','foreignKey':_0xfd1f('0x1c3')});db['FreshdeskField'][_0xfd1f('0x115')](db[_0xfd1f('0xba')],{'as':'Field','foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xba')]['belongsTo'](db['Variable'],{'as':_0xfd1f('0x1c5'),'foreignKey':'VariableId'});db['VtigerAccount'][_0xfd1f('0x115')](db[_0xfd1f('0xbe')],{'as':_0xfd1f('0x1c7'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xbe')][_0xfd1f('0x115')](db[_0xfd1f('0xc0')],{'as':_0xfd1f('0x1bd'),'foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xbe')][_0xfd1f('0x115')](db[_0xfd1f('0xc0')],{'as':_0xfd1f('0x1bf'),'foreignKey':_0xfd1f('0x1c3')});db['VtigerConfiguration']['hasMany'](db[_0xfd1f('0xc0')],{'as':_0xfd1f('0x1ba'),'foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xbe')][_0xfd1f('0x123')](db[_0xfd1f('0xbc')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xc0')]['hasMany'](db[_0xfd1f('0xc0')],{'as':_0xfd1f('0x1c1'),'foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xc0')][_0xfd1f('0x115')](db[_0xfd1f('0xc0')],{'as':_0xfd1f('0x1c2'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xc0')][_0xfd1f('0x115')](db['VtigerField'],{'as':_0xfd1f('0x1c4'),'foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xc0')][_0xfd1f('0x123')](db['Variable'],{'as':'Variable','foreignKey':_0xfd1f('0x1c6')});db[_0xfd1f('0xc2')][_0xfd1f('0x115')](db['ServicenowConfiguration'],{'as':_0xfd1f('0x1c7'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1bc')});db['ServicenowConfiguration'][_0xfd1f('0x115')](db[_0xfd1f('0xc6')],{'as':_0xfd1f('0x1bd'),'foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xc4')][_0xfd1f('0x115')](db[_0xfd1f('0xc6')],{'as':_0xfd1f('0x1bf'),'foreignKey':'DescriptionId'});db[_0xfd1f('0xc4')]['hasMany'](db[_0xfd1f('0xc6')],{'as':'Fields','foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xc4')][_0xfd1f('0x123')](db[_0xfd1f('0xc2')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0xfd1f('0x115')](db['ServicenowField'],{'as':_0xfd1f('0x1c1'),'foreignKey':'SubjectId'});db[_0xfd1f('0xc6')][_0xfd1f('0x115')](db[_0xfd1f('0xc6')],{'as':_0xfd1f('0x1c2'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xc6')][_0xfd1f('0x115')](db[_0xfd1f('0xc6')],{'as':'Field','foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xc6')][_0xfd1f('0x123')](db[_0xfd1f('0x1c5')],{'as':'Variable','foreignKey':'VariableId'});db[_0xfd1f('0x1cb')][_0xfd1f('0x115')](db[_0xfd1f('0xc9')],{'as':_0xfd1f('0x1c7'),'onDelete':'cascade','foreignKey':_0xfd1f('0x1bc')});db['Dynamics365Account'][_0xfd1f('0x123')](db['CloudProvider'],{'as':_0xfd1f('0x167'),'foreignKey':_0xfd1f('0x168')});db['Dynamics365Configuration'][_0xfd1f('0x115')](db[_0xfd1f('0xcb')],{'as':_0xfd1f('0x1bd'),'onDelete':'cascade','foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xc9')]['hasMany'](db[_0xfd1f('0xcb')],{'as':'Descriptions','onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xc9')]['hasMany'](db[_0xfd1f('0xcb')],{'as':_0xfd1f('0x1ba'),'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xc9')]['belongsTo'](db[_0xfd1f('0x1cb')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1bc')});db[_0xfd1f('0xcb')][_0xfd1f('0x115')](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xfd1f('0xcb')]['hasMany'](db[_0xfd1f('0xcb')],{'as':'Description','foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0xcb')]['hasMany'](db[_0xfd1f('0xcb')],{'as':_0xfd1f('0x1c4'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xfd1f('0x123')](db['Variable'],{'as':_0xfd1f('0x1c5'),'foreignKey':_0xfd1f('0x1c6')});db['FreshsalesAccount'][_0xfd1f('0x115')](db['FreshsalesConfiguration'],{'as':_0xfd1f('0x1c7'),'onDelete':_0xfd1f('0x113'),'foreignKey':'AccountId'});db[_0xfd1f('0x1cc')]['hasMany'](db[_0xfd1f('0xcf')],{'as':_0xfd1f('0x1bd'),'foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0x1cc')]['hasMany'](db['FreshsalesField'],{'as':_0xfd1f('0x1bf'),'foreignKey':_0xfd1f('0x1c3')});db[_0xfd1f('0x1cc')]['hasMany'](db['FreshsalesField'],{'as':_0xfd1f('0x1ba'),'foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0x1cc')][_0xfd1f('0x123')](db[_0xfd1f('0xcd')],{'as':_0xfd1f('0x17b'),'foreignKey':'AccountId'});db[_0xfd1f('0xcf')][_0xfd1f('0x115')](db[_0xfd1f('0xcf')],{'as':'Subject','foreignKey':_0xfd1f('0x1be')});db[_0xfd1f('0xcf')]['hasMany'](db['FreshsalesField'],{'as':_0xfd1f('0x1c2'),'foreignKey':_0xfd1f('0x1c3')});db['FreshsalesField']['hasMany'](db[_0xfd1f('0xcf')],{'as':'Field','foreignKey':_0xfd1f('0x1c0')});db[_0xfd1f('0xcf')][_0xfd1f('0x123')](db['Variable'],{'as':_0xfd1f('0x1c5'),'foreignKey':_0xfd1f('0x1c6')});db[_0xfd1f('0xd2')][_0xfd1f('0x123')](db['ChatWebsite'],{});db[_0xfd1f('0xd2')][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0xd2')][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x164'),'foreignKey':'ContactId'});db[_0xfd1f('0xd2')][_0xfd1f('0x123')](db[_0xfd1f('0x12d')],{});db['ChatQueueReport'][_0xfd1f('0x123')](db[_0xfd1f('0x193')],{});db['ChatQueueReport']['belongsTo'](db[_0xfd1f('0x12')],{});db[_0xfd1f('0xd2')][_0xfd1f('0x123')](db[_0xfd1f('0x68')],{});db[_0xfd1f('0xd4')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'onDelete':'cascade','foreignKey':_0xfd1f('0x1cd')});db['ChatInternalMessage'][_0xfd1f('0x123')](db['User'],{'onDelete':_0xfd1f('0x113'),'foreignKey':_0xfd1f('0x1ce')});db[_0xfd1f('0xd9')][_0xfd1f('0x115')](db[_0xfd1f('0xd7')],{'foreignKey':_0xfd1f('0x1cf'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0xd9')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xfd1f('0x1cf'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0xdb')][_0xfd1f('0x123')](db['SmsAccount'],{});db[_0xfd1f('0xdb')][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0xdb')][_0xfd1f('0x123')](db['CmContact'],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0xdb')][_0xfd1f('0x123')](db[_0xfd1f('0x131')],{});db[_0xfd1f('0xdb')]['belongsTo'](db[_0xfd1f('0x56')],{});db[_0xfd1f('0xdb')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{});db['SmsQueueReport'][_0xfd1f('0x123')](db[_0xfd1f('0x57')],{});db[_0xfd1f('0x1d0')][_0xfd1f('0x115')](db[_0xfd1f('0xd9')],{'foreignKey':_0xfd1f('0x1d1')});db[_0xfd1f('0x1d0')][_0xfd1f('0x115')](db['JscriptyQuestionReport'],{'foreignKey':_0xfd1f('0x1d1')});db[_0xfd1f('0x1d0')][_0xfd1f('0x115')](db[_0xfd1f('0x1d2')],{'foreignKey':_0xfd1f('0x1d1')});db['Team'][_0xfd1f('0x125')](db['User'],{'as':_0xfd1f('0x159'),'through':_0xfd1f('0x12c')});db[_0xfd1f('0x15a')][_0xfd1f('0x125')](db[_0xfd1f('0x135')],{'through':_0xfd1f('0x15c'),'as':_0xfd1f('0x136')});db[_0xfd1f('0x15a')][_0xfd1f('0x125')](db[_0xfd1f('0x39')],{'through':_0xfd1f('0x172'),'as':'MailQueues'});db[_0xfd1f('0x15a')]['belongsToMany'](db['ChatQueue'],{'through':_0xfd1f('0x199'),'as':'ChatQueues'});db['Team'][_0xfd1f('0x125')](db[_0xfd1f('0x4e')],{'through':_0xfd1f('0x186'),'as':_0xfd1f('0x1d3')});db[_0xfd1f('0x15a')][_0xfd1f('0x125')](db[_0xfd1f('0x57')],{'through':_0xfd1f('0x1d4'),'as':_0xfd1f('0x13b')});db['Team']['belongsToMany'](db[_0xfd1f('0x5e')],{'through':'team_has_openchannel_queues','as':_0xfd1f('0x13c')});db['Team'][_0xfd1f('0x125')](db[_0xfd1f('0x13d')],{'through':_0xfd1f('0x1d5'),'as':_0xfd1f('0x13e')});db['Team'][_0xfd1f('0x125')](db['VoicePrefix'],{'through':_0xfd1f('0x10d'),'as':_0xfd1f('0x1d6')});db['Campaign']['hasMany'](db[_0xfd1f('0x6d')],{'as':'Hoppers','foreignKey':_0xfd1f('0x1a1')});db[_0xfd1f('0xe9')]['hasMany'](db[_0xfd1f('0x71')],{'as':_0xfd1f('0x11a'),'foreignKey':_0xfd1f('0x1a1')});db['Campaign'][_0xfd1f('0x115')](db[_0xfd1f('0x73')],{'as':_0xfd1f('0x150'),'foreignKey':'CampaignId'});db['Campaign'][_0xfd1f('0x115')](db[_0xfd1f('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0xfd1f('0xe9')]['belongsTo'](db[_0xfd1f('0x2c')],{'as':_0xfd1f('0x2c'),'foreignKey':_0xfd1f('0x153')});db[_0xfd1f('0xe9')][_0xfd1f('0x123')](db[_0xfd1f('0x2c')],{'as':_0xfd1f('0x154'),'foreignKey':_0xfd1f('0x155')});db[_0xfd1f('0xe9')][_0xfd1f('0x123')](db[_0xfd1f('0x7d')],{'as':_0xfd1f('0x7d'),'foreignKey':_0xfd1f('0x156')});db[_0xfd1f('0xe9')][_0xfd1f('0x123')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0xfd1f('0x1d7')});db['Campaign'][_0xfd1f('0x125')](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x12a'),'through':_0xfd1f('0x1d8')});db[_0xfd1f('0xe9')][_0xfd1f('0x125')](db[_0xfd1f('0xf9')],{'as':'BlackLists','through':_0xfd1f('0x1d9')});db[_0xfd1f('0xed')][_0xfd1f('0x123')](db['ChatOfflineMessage'],{'as':_0xfd1f('0x67'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport']['belongsTo'](db['MailMessage'],{});db['MailTransferReport'][_0xfd1f('0x123')](db['MailInteraction'],{});db[_0xfd1f('0xf1')][_0xfd1f('0x123')](db['MailAccount'],{'foreignKey':_0xfd1f('0x1da'),'as':'FromAccount'});db['MailTransferReport'][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1db'),'as':_0xfd1f('0x1dc')});db[_0xfd1f('0xf1')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1dd'),'as':'ToAgent'});db['MailTransferReport']['belongsTo'](db[_0xfd1f('0x39')],{'foreignKey':_0xfd1f('0x1de'),'as':_0xfd1f('0x1df')});db[_0xfd1f('0xf1')][_0xfd1f('0x123')](db[_0xfd1f('0x37')],{'foreignKey':_0xfd1f('0x1e0'),'as':_0xfd1f('0x1e1')});db[_0xfd1f('0x1e2')]['belongsTo'](db['ChatMessage'],{});db[_0xfd1f('0x1e2')]['belongsTo'](db['ChatInteraction'],{});db[_0xfd1f('0x1e2')]['belongsTo'](db[_0xfd1f('0x140')],{'foreignKey':_0xfd1f('0x1e3'),'as':_0xfd1f('0x1e4')});db[_0xfd1f('0x1e2')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1db'),'as':_0xfd1f('0x1dc')});db[_0xfd1f('0x1e2')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':'ToUserId','as':_0xfd1f('0x1e5')});db['ChatTransferReport'][_0xfd1f('0x123')](db[_0xfd1f('0x68')],{'foreignKey':'ToChatQueueId','as':_0xfd1f('0x1df')});db[_0xfd1f('0x1e2')][_0xfd1f('0x123')](db[_0xfd1f('0x140')],{'foreignKey':_0xfd1f('0x1e6'),'as':_0xfd1f('0x1e1')});db[_0xfd1f('0xf4')][_0xfd1f('0x123')](db[_0xfd1f('0x4c')],{});db[_0xfd1f('0xf4')][_0xfd1f('0x123')](db[_0xfd1f('0x11d')],{});db[_0xfd1f('0xf4')][_0xfd1f('0x123')](db[_0xfd1f('0x48')],{'foreignKey':_0xfd1f('0x1e7'),'as':_0xfd1f('0x1e4')});db['FaxTransferReport'][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1db'),'as':_0xfd1f('0x1dc')});db[_0xfd1f('0xf4')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1dd'),'as':'ToAgent'});db[_0xfd1f('0xf4')][_0xfd1f('0x123')](db[_0xfd1f('0x4e')],{'foreignKey':_0xfd1f('0x1e8'),'as':'ToQueue'});db[_0xfd1f('0xf4')][_0xfd1f('0x123')](db['FaxAccount'],{'foreignKey':_0xfd1f('0x1e9'),'as':_0xfd1f('0x1e1')});db[_0xfd1f('0xf6')]['belongsTo'](db[_0xfd1f('0x18c')],{});db['OpenchannelTransferReport'][_0xfd1f('0x123')](db[_0xfd1f('0x5c')],{});db[_0xfd1f('0xf6')][_0xfd1f('0x123')](db[_0xfd1f('0x145')],{'foreignKey':'FromOpenchannelAccountId','as':_0xfd1f('0x1e4')});db[_0xfd1f('0xf6')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1db'),'as':_0xfd1f('0x1dc')});db[_0xfd1f('0xf6')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1dd'),'as':_0xfd1f('0x1e5')});db[_0xfd1f('0xf6')]['belongsTo'](db[_0xfd1f('0x5e')],{'foreignKey':_0xfd1f('0x1ea'),'as':_0xfd1f('0x1df')});db[_0xfd1f('0xf6')][_0xfd1f('0x123')](db[_0xfd1f('0x145')],{'foreignKey':_0xfd1f('0x1eb'),'as':'ToAccount'});db[_0xfd1f('0x1ec')][_0xfd1f('0x123')](db['SmsMessage'],{});db['SmsTransferReport']['belongsTo'](db['SmsInteraction'],{});db['SmsTransferReport'][_0xfd1f('0x123')](db[_0xfd1f('0x51')],{'foreignKey':_0xfd1f('0x1ed'),'as':_0xfd1f('0x1e4')});db[_0xfd1f('0x1ec')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1db'),'as':_0xfd1f('0x1dc')});db[_0xfd1f('0x1ec')]['belongsTo'](db[_0xfd1f('0x12')],{'foreignKey':_0xfd1f('0x1dd'),'as':_0xfd1f('0x1e5')});db['SmsTransferReport'][_0xfd1f('0x123')](db[_0xfd1f('0x57')],{'foreignKey':_0xfd1f('0x1ee'),'as':_0xfd1f('0x1df')});db['SmsTransferReport'][_0xfd1f('0x123')](db[_0xfd1f('0x51')],{'foreignKey':_0xfd1f('0x1ef'),'as':_0xfd1f('0x1e1')});db[_0xfd1f('0xf9')][_0xfd1f('0x115')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xfd1f('0x16f'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0xf9')][_0xfd1f('0x115')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db['CmList'][_0xfd1f('0x115')](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x128'),'onDelete':'cascade','foreignKey':_0xfd1f('0x16f')});db['CmList'][_0xfd1f('0x115')](db['CmHopperFinal'],{'as':_0xfd1f('0x11a'),'foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0xf9')]['hasMany'](db[_0xfd1f('0x73')],{'as':_0xfd1f('0x11b'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':_0xfd1f('0x74'),'foreignKey':_0xfd1f('0x16f')});db['CmList'][_0xfd1f('0x125')](db[_0xfd1f('0x135')],{'as':'Queues','through':_0xfd1f('0x158')});db[_0xfd1f('0xf9')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':'Agents','through':_0xfd1f('0x12b')});db['VoicePrefix'][_0xfd1f('0x115')](db[_0xfd1f('0x118')],{'as':_0xfd1f('0x119'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x1f0')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':'Agents','through':_0xfd1f('0x138')});db[_0xfd1f('0x1f0')][_0xfd1f('0x125')](db[_0xfd1f('0x15a')],{'through':'TeamVoicePrefix','as':_0xfd1f('0x15b')});db['UserProfile'][_0xfd1f('0x115')](db['User'],{'as':'Users','foreignKey':_0xfd1f('0x124')});db[_0xfd1f('0xfb')]['hasMany'](db[_0xfd1f('0x1f1')],{'as':_0xfd1f('0x1f2'),'foreignKey':'userProfileId','onDelete':_0xfd1f('0x113')});db['UserProfileSection'][_0xfd1f('0x115')](db[_0xfd1f('0x1f3')],{'as':'Resources','foreignKey':_0xfd1f('0x1f4'),'onDelete':_0xfd1f('0x113')});db[_0xfd1f('0x101')][_0xfd1f('0x115')](db['Disposition'],{'as':_0xfd1f('0x16b'),'foreignKey':_0xfd1f('0x1f5'),'onDelete':_0xfd1f('0x113')});db['WhatsappAccount'][_0xfd1f('0x115')](db[_0xfd1f('0x79')],{'as':'Answers','foreignKey':_0xfd1f('0x1f5')});db[_0xfd1f('0x101')][_0xfd1f('0x115')](db[_0xfd1f('0x106')],{'as':_0xfd1f('0x15e'),'foreignKey':'WhatsappAccountId'});db[_0xfd1f('0x101')][_0xfd1f('0x115')](db[_0xfd1f('0x104')],{'as':'Interactions'});db[_0xfd1f('0x101')][_0xfd1f('0x115')](db[_0xfd1f('0x103')],{'as':_0xfd1f('0x14c')});db[_0xfd1f('0x101')][_0xfd1f('0x123')](db[_0xfd1f('0xf9')],{'as':'List','foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x101')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xfd1f('0x157')});db[_0xfd1f('0x101')]['belongsToMany'](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x159'),'through':_0xfd1f('0x1f6')});db[_0xfd1f('0x103')][_0xfd1f('0x123')](db['User'],{'onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x103')][_0xfd1f('0x123')](db[_0xfd1f('0x13d')],{'onDelete':'restrict'});db[_0xfd1f('0x103')]['belongsTo'](db['WhatsappAccount'],{'onDelete':'restrict'});db['WhatsappApplication'][_0xfd1f('0x123')](db[_0xfd1f('0x7d')],{'onDelete':_0xfd1f('0x169'),'foreignKey':_0xfd1f('0x156')});db['WhatsappApplication'][_0xfd1f('0x123')](db[_0xfd1f('0x86')],{'onDelete':'restrict','foreignKey':_0xfd1f('0x181')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':_0xfd1f('0x15e'),'onDelete':'cascade','foreignKey':_0xfd1f('0x1f7')});db[_0xfd1f('0x104')][_0xfd1f('0x123')](db[_0xfd1f('0x101')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1f5')});db[_0xfd1f('0x104')][_0xfd1f('0x123')](db['CmContact'],{'as':_0xfd1f('0x164'),'foreignKey':'ContactId'});db[_0xfd1f('0x104')][_0xfd1f('0x123')](db['User'],{'as':_0xfd1f('0x174'),'foreignKey':_0xfd1f('0x114')});db[_0xfd1f('0x104')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x1b0'),'as':'Tags'});db[_0xfd1f('0x104')][_0xfd1f('0x125')](db[_0xfd1f('0x86')],{'through':_0xfd1f('0x1b0'),'as':_0xfd1f('0x176')});db[_0xfd1f('0x104')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x177'),'through':_0xfd1f('0x1f8'),'foreignKey':_0xfd1f('0x1f7')});db[_0xfd1f('0x106')][_0xfd1f('0x123')](db['User'],{'as':_0xfd1f('0x12')});db['WhatsappMessage']['belongsTo'](db[_0xfd1f('0x6b')],{'onDelete':_0xfd1f('0x113'),'as':_0xfd1f('0x164')});db[_0xfd1f('0x106')][_0xfd1f('0x123')](db['WhatsappInteraction'],{'onDelete':_0xfd1f('0x113'),'as':'Interaction','foreignKey':_0xfd1f('0x1f7')});db['WhatsappMessage']['belongsTo'](db[_0xfd1f('0x101')],{'as':_0xfd1f('0x17b'),'foreignKey':_0xfd1f('0x1f5')});db['WhatsappQueueReport'][_0xfd1f('0x123')](db[_0xfd1f('0x101')],{});db[_0xfd1f('0x107')]['belongsTo'](db[_0xfd1f('0xf9')],{'as':_0xfd1f('0x16e'),'foreignKey':_0xfd1f('0x16f')});db[_0xfd1f('0x107')][_0xfd1f('0x123')](db[_0xfd1f('0x6b')],{'as':_0xfd1f('0x164'),'foreignKey':_0xfd1f('0x165')});db[_0xfd1f('0x107')][_0xfd1f('0x123')](db[_0xfd1f('0x104')],{});db[_0xfd1f('0x107')]['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0xfd1f('0x123')](db[_0xfd1f('0x106')],{});db['WhatsappQueueReport'][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xfd1f('0x106')],{});db[_0xfd1f('0x1f9')]['belongsTo'](db[_0xfd1f('0x104')],{});db[_0xfd1f('0x1f9')][_0xfd1f('0x123')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xfd1f('0x1e4')});db[_0xfd1f('0x1f9')][_0xfd1f('0x123')](db[_0xfd1f('0x101')],{'foreignKey':_0xfd1f('0x1fa'),'as':_0xfd1f('0x1e1')});db[_0xfd1f('0x1f9')]['belongsTo'](db[_0xfd1f('0x13d')],{'foreignKey':_0xfd1f('0x1fb'),'as':_0xfd1f('0x1df')});db[_0xfd1f('0x1f9')][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'foreignKey':'FromUserId','as':_0xfd1f('0x1dc')});db[_0xfd1f('0x1f9')][_0xfd1f('0x123')](db['User'],{'foreignKey':'ToUserId','as':_0xfd1f('0x1e5')});db[_0xfd1f('0x13d')][_0xfd1f('0x125')](db[_0xfd1f('0x12')],{'as':'Agents','through':_0xfd1f('0x13f'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0xfd1f('0x125')](db[_0xfd1f('0x15a')],{'through':_0xfd1f('0x1d5'),'as':_0xfd1f('0x15b')});db['UserSetting'][_0xfd1f('0x123')](db[_0xfd1f('0x12')],{'as':_0xfd1f('0x1fc'),'foreignKey':_0xfd1f('0x114'),'onDelete':_0xfd1f('0x113'),'hooks':!![]});db[_0xfd1f('0x167')][_0xfd1f('0x112')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0xfd1f('0x169')});db[_0xfd1f('0x167')][_0xfd1f('0x112')](db[_0xfd1f('0x34')],{'as':_0xfd1f('0x1fd'),'onDelete':'restrict'});db[_0xfd1f('0x167')]['hasOne'](db[_0xfd1f('0x35')],{'as':_0xfd1f('0x16a'),'onDelete':'restrict'});module[_0xfd1f('0x1fe')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0b13=['../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','UserSetting','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','HopperFinals','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_chat_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','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','Applications','Sounds','Members','VoiceQueueId','VoiceQueue','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Interaction','ChatOfflineMessageId','TagId','Dashboard','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','IntervalId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatWebsiteId','Attachments','UserChatQueue','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','CmHopperBlack','All','OneAll','Condition','Any','Actions','ParentId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','CmContactHasItem','ContactItemType','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','AccountId','Subjects','Descriptions','FieldId','Subject','SubjectId','Description','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','DescriptionId','DeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Account','Dynamics365Field','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','team_has_fax_queues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','FromUserId','ToOpenchannelQueueId','ToOpenchannelAccountId','CustomFields','TeamVoicePrefix','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','jstz','defaultsDeep','sequelize','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','utf8','utf8_general_ci','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0x0b13,0x134));var _0x30b1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0b13[_0x5b644e];return _0x49c6bf;};'use strict';var config=require(_0x30b1('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x30b1('0x1'));var timezone=jstz['determine']();config['sequelize']=_[_0x30b1('0x2')](config[_0x30b1('0x3')],{'database':'motion2','username':_0x30b1('0x4'),'password':_0x30b1('0x5'),'options':{'host':_0x30b1('0x6'),'port':0xcea,'dialect':_0x30b1('0x7'),'dialectOptions':{'charset':_0x30b1('0x8')},'logging':![],'timezone':timezone[_0x30b1('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x30b1('0xa')]=_[_0x30b1('0x2')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0x30b1('0x5'),'options':{'host':_0x30b1('0x6'),'port':0xcea,'dialect':_0x30b1('0x7'),'dialectOptions':{'charset':_0x30b1('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x30b1('0xb'),'collate':_0x30b1('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x30b1('0xd')],config[_0x30b1('0x3')][_0x30b1('0xe')],config['sequelize'][_0x30b1('0xf')],config[_0x30b1('0x3')][_0x30b1('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x30b1('0xa')]['database'],config['sequelizeHistory']['username'],config['sequelizeHistory'][_0x30b1('0xf')],config[_0x30b1('0xa')][_0x30b1('0x10')])};db['User']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x12'));db[_0x30b1('0x13')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x14'));db[_0x30b1('0x15')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x16'));db['VoiceExtension']=db[_0x30b1('0x3')]['import'](_0x30b1('0x17'));db[_0x30b1('0x18')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x19'));db['VoiceQueue']=db[_0x30b1('0x3')]['import'](_0x30b1('0x1a'));db['VoiceRecording']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x1b'));db[_0x30b1('0x1c')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x1d'));db[_0x30b1('0x1e')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x1f'));db[_0x30b1('0x20')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x21'));db[_0x30b1('0x22')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x23'));db['VoiceDialReport']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x24'));db['VoiceAgentReport']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x25'));db[_0x30b1('0x26')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x27'));db['MemberReport']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x28'));db[_0x30b1('0x29')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/trunk/trunk.model');db[_0x30b1('0x2a')]=db['sequelize']['import'](_0x30b1('0x2b'));db[_0x30b1('0x2c')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x30b1('0x2d')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x2e'));db['UserChatQueue']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x2f'));db[_0x30b1('0x30')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/userMailQueue/userMailQueue.model');db[_0x30b1('0x31')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x32'));db[_0x30b1('0x33')]=db['sequelize']['import'](_0x30b1('0x34'));db[_0x30b1('0x35')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x36'));db[_0x30b1('0x37')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x38'));db[_0x30b1('0x39')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x3a'));db[_0x30b1('0x3b')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x3c'));db[_0x30b1('0x3d')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x3e'));db[_0x30b1('0x3f')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x40'));db[_0x30b1('0x41')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0x30b1('0x42')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x43'));db[_0x30b1('0x44')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x45'));db[_0x30b1('0x46')]=db['sequelize']['import'](_0x30b1('0x47'));db[_0x30b1('0x48')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x49'));db['Dashboard']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x4a'));db[_0x30b1('0x4b')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x4c'));db[_0x30b1('0x4d')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x4e'));db[_0x30b1('0x4f')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/faxApplication/faxApplication.model');db[_0x30b1('0x50')]=db['sequelize'][_0x30b1('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0x30b1('0x51')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x52'));db[_0x30b1('0x53')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x54'));db[_0x30b1('0x55')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x56'));db[_0x30b1('0x57')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x58'));db[_0x30b1('0x59')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x5a'));db[_0x30b1('0x5b')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x5c'));db[_0x30b1('0x5d')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/smsMessage/smsMessage.model');db[_0x30b1('0x5e')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x5f'));db[_0x30b1('0x60')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x61'));db[_0x30b1('0x62')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x63'));db[_0x30b1('0x64')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x65'));db[_0x30b1('0x66')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x67'));db[_0x30b1('0x68')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x69'));db['ChatWebsite']=db['sequelize'][_0x30b1('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0x30b1('0x6a')]=db[_0x30b1('0x3')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x30b1('0x3')]['import'](_0x30b1('0x6b'));db[_0x30b1('0x6c')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x6d'));db[_0x30b1('0x6e')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x6f'));db[_0x30b1('0x70')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x71'));db[_0x30b1('0x72')]=db[_0x30b1('0x3')]['import']('../api/chatQueue/chatQueue.model');db[_0x30b1('0x73')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x74'));db[_0x30b1('0x75')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x76'));db[_0x30b1('0x77')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x78'));db[_0x30b1('0x79')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x7a'));db[_0x30b1('0x7b')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x7c'));db['CmHopperBlack']=db[_0x30b1('0x3')]['import'](_0x30b1('0x7d'));db[_0x30b1('0x7e')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x7f'));db[_0x30b1('0x80')]=db[_0x30b1('0x3')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x30b1('0x81')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x30b1('0x82')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x83'));db[_0x30b1('0x84')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/action/action.model');db[_0x30b1('0x85')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/automation/automation.model');db[_0x30b1('0x86')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x87'));db[_0x30b1('0x88')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x89'));db['Condition']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x8a'));db[_0x30b1('0x8b')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x8c'));db[_0x30b1('0x8d')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x8e'));db[_0x30b1('0x8f')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x90'));db[_0x30b1('0x91')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x30b1('0x92')]=db['sequelize']['import'](_0x30b1('0x93'));db[_0x30b1('0x94')]=db['sequelize']['import'](_0x30b1('0x95'));db[_0x30b1('0x96')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x97'));db['ContactItemType']=db['sequelize']['import'](_0x30b1('0x98'));db['CmContactHasItem']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x99'));db[_0x30b1('0x9a')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x9b'));db['Template']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x9c'));db['Trigger']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x9d'));db[_0x30b1('0x9e')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/variable/variable.model');db['Integration']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x9f'));db[_0x30b1('0xa0')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xa1'));db[_0x30b1('0xa2')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xa3'));db[_0x30b1('0xa4')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xa5'));db[_0x30b1('0xa6')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xa7'));db['AnalyticFieldReport']=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xa8'));db['SalesforceAccount']=db[_0x30b1('0x3')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x30b1('0x3')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x30b1('0xa9')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xaa'));db['SugarcrmConfiguration']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xab'));db[_0x30b1('0xac')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xad'));db[_0x30b1('0xae')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xaf'));db[_0x30b1('0xb0')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xb1'));db['DeskField']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xb2'));db[_0x30b1('0xb3')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xb4'));db[_0x30b1('0xb5')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xb6'));db[_0x30b1('0xb7')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xb8'));db[_0x30b1('0xb9')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xba'));db[_0x30b1('0xbb')]=db['sequelize'][_0x30b1('0x11')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x30b1('0xbc')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xbd'));db[_0x30b1('0xbe')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xbf'));db[_0x30b1('0xc0')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x30b1('0xc1')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xc2'));db[_0x30b1('0xc3')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xc4'));db[_0x30b1('0xc5')]=db[_0x30b1('0x3')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x30b1('0xc6')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x30b1('0xc7')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xc8'));db[_0x30b1('0xc9')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xca'));db[_0x30b1('0xcb')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xcc'));db['Dynamics365Account']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xcd'));db[_0x30b1('0xce')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xcf'));db[_0x30b1('0xd0')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xd1'));db['FreshsalesConfiguration']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xd2'));db[_0x30b1('0xd3')]=db[_0x30b1('0x3')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0x30b1('0xd4')]=db[_0x30b1('0x3')]['import']('../api/integration/integration.model');db[_0x30b1('0xd5')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/network/network.model');db[_0x30b1('0xd6')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xd7'));db['ChatInternalMessage']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xd8'));db[_0x30b1('0xd9')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xda'));db[_0x30b1('0xdb')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xdc'));db[_0x30b1('0xdd')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xde'));db[_0x30b1('0xdf')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xe0'));db['SquareReport']=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xe1'));db[_0x30b1('0xe2')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0x30b1('0xe3')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xe4'));db[_0x30b1('0xe5')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xe6'));db[_0x30b1('0xe7')]=db['sequelize']['import'](_0x30b1('0xe8'));db[_0x30b1('0xe9')]=db['sequelize'][_0x30b1('0x11')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xea'));db[_0x30b1('0xeb')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xec'));db[_0x30b1('0xed')]=db['sequelize']['import'](_0x30b1('0xee'));db[_0x30b1('0xef')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/campaign/campaign.model');db[_0x30b1('0xf0')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xf1'));db['Attachment']=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/attachment/attachment.model');db[_0x30b1('0xf2')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xf3'));db[_0x30b1('0xf4')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xf5'));db[_0x30b1('0xf6')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xf7'));db[_0x30b1('0xf8')]=db[_0x30b1('0x3')]['import'](_0x30b1('0xf9'));db[_0x30b1('0xfa')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xfb'));db[_0x30b1('0xfc')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0xfd'));db['CmList']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0xfe'));db[_0x30b1('0xff')]=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x100'));db[_0x30b1('0x101')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x102'));db['UserProfileSection']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x103'));db[_0x30b1('0x104')]=db[_0x30b1('0x3')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x30b1('0x105')]=db['sequelize']['import'](_0x30b1('0x106'));db[_0x30b1('0x107')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x108'));db[_0x30b1('0x109')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/whatsappApplication/whatsappApplication.model');db[_0x30b1('0x10a')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x10b'));db['WhatsappMessage']=db['sequelize'][_0x30b1('0x11')](_0x30b1('0x10c'));db[_0x30b1('0x10d')]=db['sequelize'][_0x30b1('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x30b1('0x10e')]=db['sequelize']['import'](_0x30b1('0x10f'));db[_0x30b1('0x110')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x111'));db[_0x30b1('0x112')]=db[_0x30b1('0x3')]['import'](_0x30b1('0x113'));db[_0x30b1('0x114')]=db[_0x30b1('0x3')][_0x30b1('0x11')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x115'));db[_0x30b1('0x116')]=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x117'));db['UserSetting']=db[_0x30b1('0x3')][_0x30b1('0x11')](_0x30b1('0x118'));db[_0x30b1('0x119')][_0x30b1('0x11a')](db[_0x30b1('0x1e')],{'as':_0x30b1('0x1e'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x11c')});db['User'][_0x30b1('0x11a')](db[_0x30b1('0x11d')],{'as':_0x30b1('0x11e'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x11c')});db['User'][_0x30b1('0x11f')](db[_0x30b1('0x120')],{'as':_0x30b1('0x121'),'foreignKey':'UserId'});db[_0x30b1('0x119')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x30b1('0x122'),'foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x119')]['hasMany'](db[_0x30b1('0x123')],{'as':'Extensions','onDelete':_0x30b1('0x11b'),'hooks':!![]});db[_0x30b1('0x119')]['hasMany'](db[_0x30b1('0x7e')],{'as':_0x30b1('0x124'),'foreignKey':_0x30b1('0x11c')});db['User'][_0x30b1('0x11f')](db[_0x30b1('0x80')],{'as':_0x30b1('0x125'),'foreignKey':_0x30b1('0x11c')});db['User'][_0x30b1('0x11f')](db['ReportAgentPreview'],{'as':_0x30b1('0x81'),'foreignKey':_0x30b1('0x11c')});db['User'][_0x30b1('0x11f')](db[_0x30b1('0x64')],{'as':'OpenchannelInteractions','foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x119')]['hasMany'](db['ChatInteraction'],{'as':_0x30b1('0x126'),'foreignKey':_0x30b1('0x11c')});db['User'][_0x30b1('0x11f')](db['SmsInteraction'],{'as':_0x30b1('0x127'),'foreignKey':'UserId'});db['User'][_0x30b1('0x11f')](db[_0x30b1('0x50')],{'as':_0x30b1('0x128'),'foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x119')][_0x30b1('0x11f')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x119')][_0x30b1('0x11f')](db[_0x30b1('0x10a')],{'as':'WhatsappInteractions','foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x119')][_0x30b1('0x11f')](db[_0x30b1('0x105')],{'as':'UserNotifications','foreignKey':_0x30b1('0x129')});db[_0x30b1('0x119')][_0x30b1('0x12a')](db[_0x30b1('0x101')],{'as':'UserProfile','foreignKey':_0x30b1('0x12b')});db['User'][_0x30b1('0x12c')](db[_0x30b1('0x73')],{'as':_0x30b1('0x12d'),'through':_0x30b1('0x12e')});db[_0x30b1('0x119')]['belongsToMany'](db[_0x30b1('0x79')],{'as':_0x30b1('0x12f'),'through':'cm_user_has_contacts'});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x130')],{'as':_0x30b1('0x131'),'through':_0x30b1('0x132')});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0xeb')],{'through':_0x30b1('0x133')});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x42')],{'as':_0x30b1('0x134'),'through':'user_has_mail_interactions'});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x6c')],{'as':_0x30b1('0x126'),'through':_0x30b1('0x135')});db['User'][_0x30b1('0x12c')](db[_0x30b1('0x50')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User']['belongsToMany'](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x30b1('0x136')});db[_0x30b1('0x119')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x30b1('0x137'),'through':_0x30b1('0x138')});db['User'][_0x30b1('0x12c')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x30b1('0x139')});db['User'][_0x30b1('0x12c')](db['VoiceQueue'],{'as':_0x30b1('0x13a'),'through':'UserVoiceQueue','required':![]});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0xff')],{'as':_0x30b1('0x13b'),'through':_0x30b1('0x116'),'required':![]});db['User'][_0x30b1('0x12c')](db[_0x30b1('0x3f')],{'as':_0x30b1('0x13c'),'through':_0x30b1('0x30'),'required':![]});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x72')],{'as':_0x30b1('0x13d'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x53')],{'as':_0x30b1('0x13e'),'through':_0x30b1('0x31'),'required':![]});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x5e')],{'as':_0x30b1('0x13f'),'through':_0x30b1('0x33'),'required':![]});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x68')],{'as':_0x30b1('0x140'),'through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db['WhatsappQueue'],{'as':_0x30b1('0x141'),'through':_0x30b1('0x37'),'required':![]});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x130')],{'through':_0x30b1('0x132')});db['User'][_0x30b1('0x12c')](db[_0x30b1('0x142')],{'as':'ChatWebsites','through':_0x30b1('0x143')});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x4d')],{'as':'FaxAccounts','through':_0x30b1('0x144')});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x3d')],{'as':_0x30b1('0x145'),'through':_0x30b1('0x146')});db['User'][_0x30b1('0x12c')](db['OpenchannelAccount'],{'as':_0x30b1('0x147'),'through':_0x30b1('0x148')});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x57')],{'as':_0x30b1('0x149'),'through':_0x30b1('0x14a')});db[_0x30b1('0x119')][_0x30b1('0x12c')](db[_0x30b1('0x107')],{'as':_0x30b1('0x14b'),'through':_0x30b1('0x14c')});db[_0x30b1('0x13')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x30b1('0x15')][_0x30b1('0x11f')](db[_0x30b1('0x123')],{'onDelete':_0x30b1('0x11b')});db['VoiceExtension'][_0x30b1('0x11f')](db['VoiceExtension'],{'as':_0x30b1('0x14d'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0x30b1('0x12c')](db[_0x30b1('0x94')],{'as':_0x30b1('0x14e'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x30b1('0x11f')](db[_0x30b1('0x2c')],{'as':_0x30b1('0x14f'),'foreignKey':_0x30b1('0x150')});db[_0x30b1('0x151')][_0x30b1('0x11f')](db[_0x30b1('0x7b')],{'as':_0x30b1('0x152'),'foreignKey':_0x30b1('0x150')});db['VoiceQueue']['hasMany'](db['CmHopperFinal'],{'as':_0x30b1('0x124'),'foreignKey':_0x30b1('0x150')});db['VoiceQueue'][_0x30b1('0x11f')](db[_0x30b1('0x80')],{'as':_0x30b1('0x153'),'foreignKey':_0x30b1('0x150')});db[_0x30b1('0x151')][_0x30b1('0x11f')](db[_0x30b1('0x81')],{'as':'ReportAgentPreview','foreignKey':_0x30b1('0x150')});db[_0x30b1('0x151')][_0x30b1('0x11f')](db['CmHopperBlack'],{'as':_0x30b1('0x154'),'foreignKey':_0x30b1('0x150')});db['VoiceQueue'][_0x30b1('0x11f')](db[_0x30b1('0xdd')],{'as':_0x30b1('0x155'),'foreignKey':_0x30b1('0x150')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0x30b1('0x156')});db[_0x30b1('0x151')][_0x30b1('0x12a')](db[_0x30b1('0x29')],{'as':_0x30b1('0x157'),'foreignKey':'TrunkBackupId'});db[_0x30b1('0x151')][_0x30b1('0x12a')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x30b1('0x151')][_0x30b1('0x12a')](db[_0x30b1('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0x30b1('0x158')});db[_0x30b1('0x151')][_0x30b1('0x12c')](db['CmList'],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x30b1('0x151')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':'Agents','through':_0x30b1('0x2d')});db[_0x30b1('0x151')][_0x30b1('0x12c')](db['Team'],{'as':_0x30b1('0x159'),'through':_0x30b1('0x114')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x30b1('0x15a'),'through':_0x30b1('0x15b')});db[_0x30b1('0x120')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x119'),'foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x1c')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x119'),'foreignKey':'UserId'});db[_0x30b1('0x1e')][_0x30b1('0x11f')](db[_0x30b1('0x20')],{'as':_0x30b1('0x15c'),'onDelete':'cascade','foreignKey':_0x30b1('0x15d'),'sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db[_0x30b1('0x1e')],{'foreignKey':_0x30b1('0x15d'),'targetKey':_0x30b1('0x15e')});db[_0x30b1('0x22')][_0x30b1('0x11f')](db[_0x30b1('0x26')],{'as':_0x30b1('0x15f'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x30b1('0x160')],{'as':'AgentReports','foreignKey':_0x30b1('0x161'),'constraints':![]});db[_0x30b1('0x22')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x119'),'foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x22')][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x39')][_0x30b1('0x12a')](db[_0x30b1('0x3d')],{'as':_0x30b1('0x3d'),'foreignKey':_0x30b1('0x164')});db[_0x30b1('0x39')]['belongsTo'](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x30b1('0x165'),'onDelete':_0x30b1('0x166')});db[_0x30b1('0x3b')]['belongsTo'](db[_0x30b1('0x3d')],{'as':_0x30b1('0x3d'),'foreignKey':_0x30b1('0x164')});db[_0x30b1('0x3b')]['belongsTo'](db['CloudProvider'],{'as':_0x30b1('0x112'),'foreignKey':_0x30b1('0x165'),'onDelete':'restrict'});db[_0x30b1('0x3d')][_0x30b1('0x11a')](db['MailServerIn'],{'as':_0x30b1('0x167'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x3d')][_0x30b1('0x11a')](db[_0x30b1('0x3b')],{'as':_0x30b1('0x168'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x3d')][_0x30b1('0x11f')](db[_0x30b1('0x88')],{'as':_0x30b1('0x169'),'foreignKey':_0x30b1('0x164'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x3d')][_0x30b1('0x11f')](db['CannedAnswer'],{'as':_0x30b1('0x16a'),'foreignKey':_0x30b1('0x164')});db[_0x30b1('0x3d')][_0x30b1('0x11f')](db['MailMessage'],{'as':_0x30b1('0x15c'),'foreignKey':_0x30b1('0x164')});db[_0x30b1('0x3d')]['hasMany'](db[_0x30b1('0x42')],{'as':_0x30b1('0x16b')});db['MailAccount']['hasMany'](db[_0x30b1('0x46')],{'as':'Applications'});db[_0x30b1('0x3d')][_0x30b1('0x12a')](db['CmList'],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x3d')]['belongsTo'](db[_0x30b1('0x16e')],{'as':_0x30b1('0x16e'),'foreignKey':_0x30b1('0x16f')});db[_0x30b1('0x3d')]['belongsTo'](db['Pause'],{'as':_0x30b1('0x170'),'foreignKey':_0x30b1('0x158')});db[_0x30b1('0x3d')]['belongsToMany'](db[_0x30b1('0x119')],{'as':_0x30b1('0x171'),'through':'user_has_mail_accounts'});db[_0x30b1('0x3f')][_0x30b1('0x12c')](db['User'],{'as':_0x30b1('0x171'),'through':_0x30b1('0x30')});db[_0x30b1('0x3f')]['belongsToMany'](db[_0x30b1('0xeb')],{'through':_0x30b1('0x172'),'as':_0x30b1('0x159')});db[_0x30b1('0x42')][_0x30b1('0x11f')](db[_0x30b1('0x44')],{'as':_0x30b1('0x15c'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x173')});db[_0x30b1('0x42')][_0x30b1('0x12a')](db[_0x30b1('0x3d')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x164')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x42')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x175'),'foreignKey':'UserId'});db['MailInteraction'][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':_0x30b1('0x176'),'as':_0x30b1('0x177')});db[_0x30b1('0x42')][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':'mail_interaction_has_tags','as':_0x30b1('0x178')});db['MailInteraction'][_0x30b1('0x12c')](db['User'],{'as':_0x30b1('0x179'),'through':'user_has_mail_interactions','foreignKey':_0x30b1('0x173')});db['MailMessage']['hasMany'](db[_0x30b1('0x17a')],{'as':'Attachments','onDelete':_0x30b1('0x11b')});db[_0x30b1('0x44')]['belongsTo'](db[_0x30b1('0x119')],{'as':_0x30b1('0x119')});db[_0x30b1('0x44')][_0x30b1('0x12a')](db['CmContact'],{'onDelete':_0x30b1('0x11b'),'as':_0x30b1('0x162')});db['MailMessage'][_0x30b1('0x12a')](db['MailInteraction'],{'as':_0x30b1('0x17b'),'foreignKey':_0x30b1('0x173')});db[_0x30b1('0x44')][_0x30b1('0x12a')](db['MailAccount'],{'as':'Account','foreignKey':_0x30b1('0x164')});db[_0x30b1('0x44')]['belongsTo'](db[_0x30b1('0x142')],{'as':_0x30b1('0x142'),'foreignKey':'ChatWebsiteId'});db[_0x30b1('0x44')][_0x30b1('0x12a')](db[_0x30b1('0x70')],{'as':'ChatOfflineMessage','foreignKey':_0x30b1('0x17c')});db[_0x30b1('0x46')]['belongsTo'](db[_0x30b1('0x119')],{'onDelete':_0x30b1('0x166')});db[_0x30b1('0x46')][_0x30b1('0x12a')](db[_0x30b1('0x3f')],{'onDelete':_0x30b1('0x166')});db[_0x30b1('0x46')]['belongsTo'](db[_0x30b1('0x3d')],{'onDelete':'restrict'});db[_0x30b1('0x46')][_0x30b1('0x12a')](db[_0x30b1('0x8b')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['MailApplication'][_0x30b1('0x12a')](db[_0x30b1('0x96')],{'onDelete':_0x30b1('0x166'),'foreignKey':_0x30b1('0x17d')});db[_0x30b1('0x48')][_0x30b1('0x12a')](db[_0x30b1('0x3d')],{});db[_0x30b1('0x48')][_0x30b1('0x12a')](db['CmList'],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x48')][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x48')][_0x30b1('0x12a')](db[_0x30b1('0x42')],{});db[_0x30b1('0x48')][_0x30b1('0x12a')](db[_0x30b1('0x44')],{});db['MailQueueReport'][_0x30b1('0x12a')](db['User'],{});db[_0x30b1('0x48')][_0x30b1('0x12a')](db['MailQueue'],{});db[_0x30b1('0x17e')][_0x30b1('0x11f')](db[_0x30b1('0x4b')],{'as':'Items','onDelete':_0x30b1('0x11b')});db[_0x30b1('0x4d')][_0x30b1('0x11f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x30b1('0x17f'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x4d')][_0x30b1('0x11f')](db[_0x30b1('0x86')],{'as':_0x30b1('0x16a'),'foreignKey':'FaxAccountId'});db[_0x30b1('0x4d')]['hasMany'](db[_0x30b1('0x50')],{'as':'Interactions'});db[_0x30b1('0x4d')][_0x30b1('0x11f')](db[_0x30b1('0x4f')],{'as':_0x30b1('0x14d')});db[_0x30b1('0x4d')][_0x30b1('0x11f')](db[_0x30b1('0x123')],{'as':_0x30b1('0x180'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x4d')][_0x30b1('0x11f')](db[_0x30b1('0x51')],{'as':_0x30b1('0x15c')});db[_0x30b1('0x4d')]['belongsTo'](db[_0x30b1('0x29')],{'as':_0x30b1('0x29')});db[_0x30b1('0x4d')][_0x30b1('0x12a')](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x4d')][_0x30b1('0x12a')](db['Pause'],{'as':_0x30b1('0x170'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x30b1('0x4d')]['belongsToMany'](db['User'],{'as':_0x30b1('0x171'),'through':_0x30b1('0x144')});db[_0x30b1('0x4f')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'onDelete':_0x30b1('0x166')});db[_0x30b1('0x4f')][_0x30b1('0x12a')](db[_0x30b1('0x53')],{'onDelete':_0x30b1('0x166')});db[_0x30b1('0x4f')][_0x30b1('0x12a')](db[_0x30b1('0x4d')],{'onDelete':'restrict'});db['FaxApplication'][_0x30b1('0x12a')](db[_0x30b1('0x96')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x30b1('0x50')][_0x30b1('0x11f')](db[_0x30b1('0x51')],{'as':_0x30b1('0x15c'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x181')});db[_0x30b1('0x50')][_0x30b1('0x12a')](db[_0x30b1('0x4d')],{'as':_0x30b1('0x174'),'foreignKey':'FaxAccountId'});db[_0x30b1('0x50')][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':'Contact','foreignKey':_0x30b1('0x163')});db['FaxInteraction'][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x175'),'foreignKey':'UserId'});db[_0x30b1('0x50')][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':_0x30b1('0x182'),'as':_0x30b1('0x177')});db[_0x30b1('0x50')][_0x30b1('0x12c')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x30b1('0x178')});db['FaxInteraction'][_0x30b1('0x12c')](db['User'],{'as':_0x30b1('0x179'),'through':'user_has_fax_interactions','foreignKey':_0x30b1('0x181')});db[_0x30b1('0x51')][_0x30b1('0x12a')](db['User'],{'onDelete':'cascade','as':_0x30b1('0x119')});db[_0x30b1('0x51')][_0x30b1('0x12a')](db['FaxInteraction'],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0x30b1('0x51')][_0x30b1('0x12a')](db['CmContact'],{'onDelete':'cascade','as':_0x30b1('0x162')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':_0x30b1('0x17a'),'foreignKey':_0x30b1('0x183')});db['FaxMessage']['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x30b1('0x17f')});db[_0x30b1('0x53')]['belongsToMany'](db[_0x30b1('0x119')],{'as':_0x30b1('0x171'),'through':'UserFaxQueue'});db[_0x30b1('0x53')][_0x30b1('0x12c')](db[_0x30b1('0xeb')],{'through':'team_has_fax_queues','as':_0x30b1('0x159')});db[_0x30b1('0x55')]['belongsTo'](db[_0x30b1('0x4d')],{});db['FaxQueueReport'][_0x30b1('0x12a')](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x55')][_0x30b1('0x12a')](db['CmContact'],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x55')][_0x30b1('0x12a')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x30b1('0x12a')](db[_0x30b1('0x51')],{});db['FaxQueueReport'][_0x30b1('0x12a')](db[_0x30b1('0x119')],{});db[_0x30b1('0x55')][_0x30b1('0x12a')](db[_0x30b1('0x53')],{});db[_0x30b1('0x57')][_0x30b1('0x11f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x30b1('0x184'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x57')]['hasMany'](db[_0x30b1('0x86')],{'as':_0x30b1('0x16a'),'foreignKey':_0x30b1('0x184')});db['SmsAccount'][_0x30b1('0x11f')](db['SmsMessage'],{'as':_0x30b1('0x15c'),'foreignKey':_0x30b1('0x184')});db[_0x30b1('0x57')][_0x30b1('0x11f')](db[_0x30b1('0x5b')],{'as':'Interactions'});db[_0x30b1('0x57')][_0x30b1('0x11f')](db[_0x30b1('0x59')],{'as':_0x30b1('0x14d')});db[_0x30b1('0x57')][_0x30b1('0x12a')](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x57')][_0x30b1('0x12a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x30b1('0x158')});db[_0x30b1('0x57')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x171'),'through':_0x30b1('0x14a')});db['SmsApplication'][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'onDelete':'restrict'});db[_0x30b1('0x59')][_0x30b1('0x12a')](db[_0x30b1('0x5e')],{'onDelete':_0x30b1('0x166')});db[_0x30b1('0x59')][_0x30b1('0x12a')](db[_0x30b1('0x57')],{'onDelete':_0x30b1('0x166')});db[_0x30b1('0x59')]['belongsTo'](db['Interval'],{'onDelete':_0x30b1('0x166'),'foreignKey':_0x30b1('0x185')});db['SmsApplication'][_0x30b1('0x12a')](db[_0x30b1('0x96')],{'onDelete':'restrict','foreignKey':_0x30b1('0x17d')});db[_0x30b1('0x5b')][_0x30b1('0x11f')](db['SmsMessage'],{'as':_0x30b1('0x15c'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x186')});db[_0x30b1('0x5b')][_0x30b1('0x12a')](db[_0x30b1('0x57')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x184')});db[_0x30b1('0x5b')]['belongsTo'](db['CmContact'],{'as':_0x30b1('0x162'),'foreignKey':'ContactId'});db[_0x30b1('0x5b')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x175'),'foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x5b')][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':_0x30b1('0x187'),'as':'Tags'});db['SmsInteraction'][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':_0x30b1('0x187'),'as':_0x30b1('0x178')});db[_0x30b1('0x5b')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x179'),'through':_0x30b1('0x136'),'foreignKey':_0x30b1('0x186')});db[_0x30b1('0x5d')]['belongsTo'](db[_0x30b1('0x119')],{'as':_0x30b1('0x119')});db[_0x30b1('0x5d')]['belongsTo'](db['CmContact'],{'onDelete':_0x30b1('0x11b'),'as':'Contact'});db['SmsMessage'][_0x30b1('0x12a')](db[_0x30b1('0x5b')],{'onDelete':_0x30b1('0x11b'),'as':'Interaction','foreignKey':_0x30b1('0x186')});db[_0x30b1('0x5d')][_0x30b1('0x12a')](db[_0x30b1('0x57')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x30b1('0x5e')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x171'),'through':_0x30b1('0x33'),'foreignKey':'SmsQueueId'});db[_0x30b1('0x5e')][_0x30b1('0x12c')](db['Team'],{'through':_0x30b1('0x188'),'as':_0x30b1('0x159')});db[_0x30b1('0x60')][_0x30b1('0x11f')](db[_0x30b1('0x88')],{'as':_0x30b1('0x169'),'foreignKey':_0x30b1('0x189'),'onDelete':_0x30b1('0x11b')});db['OpenchannelAccount']['hasMany'](db[_0x30b1('0x86')],{'as':_0x30b1('0x16a'),'foreignKey':_0x30b1('0x189')});db['OpenchannelAccount'][_0x30b1('0x11f')](db[_0x30b1('0x64')],{'as':_0x30b1('0x16b'),'foreignKey':_0x30b1('0x189')});db['OpenchannelAccount'][_0x30b1('0x11f')](db[_0x30b1('0x66')],{'as':_0x30b1('0x15c'),'foreignKey':_0x30b1('0x189')});db[_0x30b1('0x60')][_0x30b1('0x11f')](db['OpenchannelApplication'],{'as':_0x30b1('0x14d'),'foreignKey':_0x30b1('0x189')});db[_0x30b1('0x60')][_0x30b1('0x12a')](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':'ListId'});db[_0x30b1('0x60')][_0x30b1('0x12a')](db[_0x30b1('0x8d')],{'as':_0x30b1('0x170'),'foreignKey':_0x30b1('0x158')});db[_0x30b1('0x60')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x171'),'through':_0x30b1('0x148')});db[_0x30b1('0x62')]['belongsTo'](db[_0x30b1('0x119')],{'onDelete':_0x30b1('0x166')});db[_0x30b1('0x62')][_0x30b1('0x12a')](db[_0x30b1('0x68')],{'onDelete':_0x30b1('0x166'),'foreignKey':_0x30b1('0x18a')});db[_0x30b1('0x62')][_0x30b1('0x12a')](db[_0x30b1('0x60')],{'onDelete':'restrict','foreignKey':_0x30b1('0x189')});db['OpenchannelApplication'][_0x30b1('0x12a')](db[_0x30b1('0x8b')],{'onDelete':_0x30b1('0x166'),'foreignKey':_0x30b1('0x185')});db[_0x30b1('0x62')][_0x30b1('0x12a')](db['Tag'],{'onDelete':_0x30b1('0x166'),'foreignKey':_0x30b1('0x17d')});db[_0x30b1('0x64')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x18b')});db['OpenchannelInteraction'][_0x30b1('0x12a')](db[_0x30b1('0x60')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x189')});db[_0x30b1('0x64')][_0x30b1('0x12a')](db['CmContact'],{'as':_0x30b1('0x162'),'foreignKey':'ContactId'});db[_0x30b1('0x64')][_0x30b1('0x12a')](db['User'],{'as':_0x30b1('0x175'),'foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x64')][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':_0x30b1('0x18c'),'as':_0x30b1('0x177')});db['OpenchannelInteraction']['belongsToMany'](db[_0x30b1('0x96')],{'through':_0x30b1('0x18c'),'as':_0x30b1('0x178')});db[_0x30b1('0x64')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':'Users','through':_0x30b1('0x138'),'foreignKey':_0x30b1('0x18b')});db[_0x30b1('0x66')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'onDelete':_0x30b1('0x11b'),'as':_0x30b1('0x119')});db[_0x30b1('0x66')]['belongsTo'](db[_0x30b1('0x79')],{'onDelete':_0x30b1('0x11b'),'as':'Contact'});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x30b1('0x11b'),'as':_0x30b1('0x17b'),'foreignKey':_0x30b1('0x18b')});db['OpenchannelMessage'][_0x30b1('0x12a')](db[_0x30b1('0x17a')],{'as':_0x30b1('0x17a'),'foreignKey':_0x30b1('0x183')});db[_0x30b1('0x66')]['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x30b1('0x68')][_0x30b1('0x12c')](db['User'],{'as':_0x30b1('0x171'),'through':'UserOpenchannelQueue','foreignKey':_0x30b1('0x18a')});db[_0x30b1('0x68')][_0x30b1('0x12c')](db[_0x30b1('0xeb')],{'through':'team_has_openchannel_queues','as':_0x30b1('0x159')});db[_0x30b1('0x142')]['hasMany'](db[_0x30b1('0x88')],{'as':_0x30b1('0x169'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x30b1('0x142')][_0x30b1('0x11f')](db[_0x30b1('0x86')],{'as':_0x30b1('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x30b1('0x142')]['hasMany'](db['ChatProactiveAction'],{'as':_0x30b1('0x18d')});db[_0x30b1('0x142')]['hasMany'](db['ChatInteraction'],{'as':_0x30b1('0x16b')});db[_0x30b1('0x142')][_0x30b1('0x11f')](db[_0x30b1('0x18e')],{'as':_0x30b1('0x14d')});db[_0x30b1('0x142')][_0x30b1('0x11f')](db[_0x30b1('0x6e')],{'as':_0x30b1('0x15c')});db[_0x30b1('0x142')][_0x30b1('0x12a')](db['CmList'],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x142')][_0x30b1('0x12a')](db[_0x30b1('0x8b')],{'as':_0x30b1('0x8b'),'foreignKey':_0x30b1('0x185')});db[_0x30b1('0x142')][_0x30b1('0x12a')](db[_0x30b1('0x3d')],{'as':_0x30b1('0x3d'),'foreignKey':'MailAccountId'});db[_0x30b1('0x142')]['belongsTo'](db[_0x30b1('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0x30b1('0x158')});db[_0x30b1('0x142')][_0x30b1('0x12c')](db['User'],{'as':'Agents','through':_0x30b1('0x143')});db[_0x30b1('0x6a')][_0x30b1('0x12a')](db[_0x30b1('0x60')],{});db[_0x30b1('0x6a')][_0x30b1('0x12a')](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':'ListId'});db[_0x30b1('0x6a')]['belongsTo'](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db['OpenchannelQueueReport'][_0x30b1('0x12a')](db[_0x30b1('0x64')],{});db[_0x30b1('0x6a')][_0x30b1('0x12a')](db[_0x30b1('0x66')],{});db['OpenchannelQueueReport'][_0x30b1('0x12a')](db[_0x30b1('0x119')],{});db[_0x30b1('0x6a')][_0x30b1('0x12a')](db[_0x30b1('0x68')],{});db[_0x30b1('0x18e')]['belongsTo'](db[_0x30b1('0x119')],{'as':_0x30b1('0x18f'),'foreignKey':_0x30b1('0x11c'),'onDelete':'restrict'});db[_0x30b1('0x18e')]['belongsTo'](db[_0x30b1('0x72')],{'as':_0x30b1('0x190'),'foreignKey':_0x30b1('0x191'),'onDelete':'restrict'});db[_0x30b1('0x18e')][_0x30b1('0x12a')](db[_0x30b1('0x142')],{'as':_0x30b1('0x192'),'foreignKey':'ChatWebsiteId','onDelete':_0x30b1('0x166')});db['ChatApplication'][_0x30b1('0x12a')](db[_0x30b1('0x96')],{'onDelete':_0x30b1('0x166'),'foreignKey':_0x30b1('0x17d')});db[_0x30b1('0x6c')]['hasMany'](db[_0x30b1('0x6e')],{'as':_0x30b1('0x15c'),'onDelete':_0x30b1('0x11b'),'foreignKey':'ChatInteractionId'});db[_0x30b1('0x6c')][_0x30b1('0x12a')](db[_0x30b1('0x142')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x30b1('0x6c')][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x6c')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x175'),'foreignKey':_0x30b1('0x11c')});db[_0x30b1('0x6c')][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':_0x30b1('0x193'),'as':_0x30b1('0x177')});db['ChatInteraction'][_0x30b1('0x12c')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x30b1('0x178')});db[_0x30b1('0x6c')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x179'),'through':'user_has_chat_interactions','foreignKey':_0x30b1('0x194')});db[_0x30b1('0x6e')]['belongsTo'](db[_0x30b1('0x119')],{'onDelete':'cascade','as':_0x30b1('0x119')});db[_0x30b1('0x6e')][_0x30b1('0x12a')](db['CmContact'],{'onDelete':_0x30b1('0x11b'),'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x6e')][_0x30b1('0x12a')](db['ChatInteraction'],{'onDelete':_0x30b1('0x11b'),'as':_0x30b1('0x17b'),'foreignKey':'ChatInteractionId'});db[_0x30b1('0x6e')][_0x30b1('0x12a')](db[_0x30b1('0x17a')],{'as':'Attachment','foreignKey':_0x30b1('0x183')});db[_0x30b1('0x6e')][_0x30b1('0x12a')](db[_0x30b1('0x142')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x195')});db[_0x30b1('0x70')][_0x30b1('0x11f')](db[_0x30b1('0x17a')],{'as':_0x30b1('0x196'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0x30b1('0x70')][_0x30b1('0x12a')](db['CmContact'],{'onDelete':'cascade','as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x70')][_0x30b1('0x12a')](db[_0x30b1('0x142')],{'as':_0x30b1('0x174'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':'Agents','through':_0x30b1('0x197'),'hooks':!![]});db[_0x30b1('0x72')]['belongsToMany'](db[_0x30b1('0xeb')],{'through':_0x30b1('0x198'),'as':_0x30b1('0x159')});db[_0x30b1('0x73')][_0x30b1('0x11f')](db[_0x30b1('0x199')],{'as':_0x30b1('0x15c'),'foreignKey':_0x30b1('0x19a'),'onDelete':'cascade'});db['ChatGroup'][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x14f'),'through':_0x30b1('0x12e')});db[_0x30b1('0x75')][_0x30b1('0x12a')](db[_0x30b1('0x142')],{'as':'Website','foreignKey':_0x30b1('0x195')});db[_0x30b1('0x77')][_0x30b1('0x11f')](db[_0x30b1('0x79')],{'as':_0x30b1('0x12f'),'foreignKey':_0x30b1('0x19b')});db[_0x30b1('0x79')][_0x30b1('0x11f')](db['CmContactHasItem'],{'as':_0x30b1('0x19c'),'foreignKey':_0x30b1('0x19d')});db[_0x30b1('0x79')][_0x30b1('0x11f')](db[_0x30b1('0x7b')],{'as':_0x30b1('0x152'),'foreignKey':_0x30b1('0x163')});db['CmContact'][_0x30b1('0x11f')](db['CmHopperFinal'],{'as':_0x30b1('0x124'),'foreignKey':'ContactId'});db[_0x30b1('0x79')][_0x30b1('0x11f')](db[_0x30b1('0x80')],{'as':_0x30b1('0x153'),'foreignKey':_0x30b1('0x163')});db['CmContact'][_0x30b1('0x11f')](db['ReportAgentPreview'],{'as':_0x30b1('0x81'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x79')][_0x30b1('0x11f')](db[_0x30b1('0xdd')],{'as':_0x30b1('0x155'),'foreignKey':_0x30b1('0x163')});db['CmContact'][_0x30b1('0x11f')](db[_0x30b1('0x64')],{'as':_0x30b1('0x137'),'foreignKey':_0x30b1('0x163'),'onDelete':'restrict'});db[_0x30b1('0x79')][_0x30b1('0x11f')](db[_0x30b1('0x6c')],{'as':_0x30b1('0x126'),'foreignKey':_0x30b1('0x163'),'onDelete':_0x30b1('0x166')});db[_0x30b1('0x79')][_0x30b1('0x11f')](db[_0x30b1('0x5b')],{'as':_0x30b1('0x127'),'foreignKey':_0x30b1('0x163'),'onDelete':_0x30b1('0x166')});db[_0x30b1('0x79')][_0x30b1('0x11f')](db[_0x30b1('0x50')],{'as':_0x30b1('0x128'),'foreignKey':_0x30b1('0x163'),'onDelete':'restrict'});db[_0x30b1('0x79')][_0x30b1('0x11f')](db[_0x30b1('0x42')],{'as':_0x30b1('0x134'),'foreignKey':_0x30b1('0x163'),'onDelete':_0x30b1('0x166')});db[_0x30b1('0x79')][_0x30b1('0x12a')](db[_0x30b1('0x77')],{'as':_0x30b1('0x19e'),'foreignKey':_0x30b1('0x19b')});db[_0x30b1('0x79')][_0x30b1('0x12a')](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x79')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x179'),'through':_0x30b1('0x19f')});db[_0x30b1('0x79')][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'as':_0x30b1('0x177'),'through':'cm_contact_has_tags'});db['CmContact'][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':_0x30b1('0x1a0'),'as':_0x30b1('0x178')});db[_0x30b1('0x7b')][_0x30b1('0x11f')](db[_0x30b1('0x9a')],{'as':_0x30b1('0x1a1'),'foreignKey':_0x30b1('0x1a2')});db[_0x30b1('0x7b')]['belongsTo'](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163'),'onDelete':_0x30b1('0x11b')});db['CmHopper'][_0x30b1('0x12a')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x30b1('0x7b')]['belongsTo'](db[_0x30b1('0x119')],{'as':_0x30b1('0x18f'),'foreignKey':_0x30b1('0x11c')});db['CmHopper']['belongsTo'](db[_0x30b1('0x151')],{'as':'Queue','foreignKey':_0x30b1('0x150'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x7b')][_0x30b1('0x12a')](db[_0x30b1('0xef')],{'as':'Campaign','foreignKey':_0x30b1('0x1a3'),'onDelete':'cascade'});db[_0x30b1('0x7b')]['belongsTo'](db['User'],{'as':_0x30b1('0x175'),'foreignKey':_0x30b1('0x1a4')});db[_0x30b1('0x1a5')][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163'),'onDelete':_0x30b1('0x11b')});db['CmHopperBlack'][_0x30b1('0x12a')](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d'),'onDelete':_0x30b1('0x11b')});db['CmHopperBlack'][_0x30b1('0x12a')](db[_0x30b1('0x151')],{'as':_0x30b1('0x190'),'foreignKey':_0x30b1('0x150'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x1a5')][_0x30b1('0x12a')](db[_0x30b1('0xef')],{'as':'Campaign','foreignKey':_0x30b1('0x1a3'),'onDelete':'cascade'});db[_0x30b1('0x85')][_0x30b1('0x11f')](db['Condition'],{'as':{'plural':_0x30b1('0x1a6'),'singular':_0x30b1('0x1a7')},'foreignKey':'AutomationAllId','onDelete':_0x30b1('0x11b'),'hooks':!![]});db[_0x30b1('0x85')][_0x30b1('0x11f')](db[_0x30b1('0x1a8')],{'as':{'plural':_0x30b1('0x1a9'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x30b1('0x11b'),'hooks':!![]});db[_0x30b1('0x85')][_0x30b1('0x11f')](db[_0x30b1('0x84')],{'as':_0x30b1('0x1aa'),'foreignKey':'AutomationId','onDelete':_0x30b1('0x11b'),'hooks':!![]});db[_0x30b1('0x88')]['hasMany'](db[_0x30b1('0x88')],{'as':'Dispositions','foreignKey':_0x30b1('0x1ab'),'onDelete':_0x30b1('0x11b')});db['Interval'][_0x30b1('0x11f')](db[_0x30b1('0x8b')],{'as':_0x30b1('0x1ac'),'foreignKey':_0x30b1('0x185'),'onDelete':_0x30b1('0x11b'),'hooks':!![],'required':![]});db[_0x30b1('0x8b')][_0x30b1('0x11f')](db[_0x30b1('0x123')],{'as':_0x30b1('0x1ad'),'foreignKey':_0x30b1('0x185'),'onDelete':'restrict'});db[_0x30b1('0x8b')][_0x30b1('0x11f')](db[_0x30b1('0x46')],{'as':_0x30b1('0x1ae'),'foreignKey':_0x30b1('0x185')});db[_0x30b1('0x8b')][_0x30b1('0x11f')](db[_0x30b1('0x18e')],{'as':'ChatApplications','foreignKey':_0x30b1('0x185')});db[_0x30b1('0x8b')][_0x30b1('0x11f')](db[_0x30b1('0x4f')],{'as':_0x30b1('0x1af'),'foreignKey':_0x30b1('0x185')});db[_0x30b1('0x8b')]['hasMany'](db[_0x30b1('0x59')],{'as':_0x30b1('0x1b0'),'foreignKey':_0x30b1('0x185')});db[_0x30b1('0x92')]['belongsTo'](db['MailAccount'],{});db[_0x30b1('0x92')][_0x30b1('0x12a')](db[_0x30b1('0xa4')],{'foreignKey':_0x30b1('0x1b1')});db[_0x30b1('0x92')][_0x30b1('0x12a')](db[_0x30b1('0xa2')],{'foreignKey':_0x30b1('0x1b2')});db[_0x30b1('0x94')]['belongsToMany'](db[_0x30b1('0x18')],{'as':_0x30b1('0x1b3'),'through':_0x30b1('0x1b4'),'onDelete':_0x30b1('0x166')});db[_0x30b1('0x96')][_0x30b1('0x12c')](db[_0x30b1('0x79')],{'through':_0x30b1('0x1a0')});db[_0x30b1('0x96')]['belongsToMany'](db['ChatInteraction'],{'through':_0x30b1('0x193')});db[_0x30b1('0x96')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag'][_0x30b1('0x12c')](db[_0x30b1('0x5b')],{'through':_0x30b1('0x187')});db[_0x30b1('0x96')][_0x30b1('0x12c')](db['FaxInteraction'],{'through':_0x30b1('0x182')});db[_0x30b1('0x96')][_0x30b1('0x12c')](db[_0x30b1('0x64')],{'through':_0x30b1('0x18c')});db[_0x30b1('0x96')]['belongsToMany'](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x30b1('0x1b5')]['belongsTo'](db[_0x30b1('0x1b6')],{'as':'ItemType','foreignKey':_0x30b1('0x1b7')});db[_0x30b1('0x9a')][_0x30b1('0x12a')](db[_0x30b1('0x7b')],{'as':_0x30b1('0x1b8'),'foreignKey':_0x30b1('0x1a2')});db[_0x30b1('0x1b5')][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':'CmContactId'});db[_0x30b1('0x1b9')][_0x30b1('0x11f')](db[_0x30b1('0x1a8')],{'as':{'plural':_0x30b1('0x1ba'),'singular':_0x30b1('0x1bb')},'foreignKey':_0x30b1('0x1bc'),'onDelete':_0x30b1('0x11b'),'hooks':!![]});db[_0x30b1('0x1b9')][_0x30b1('0x11f')](db[_0x30b1('0x1a8')],{'as':{'plural':_0x30b1('0x1bd'),'singular':_0x30b1('0x1be')},'foreignKey':_0x30b1('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x30b1('0x1b9')]['hasMany'](db[_0x30b1('0x84')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x30b1('0x11b'),'hooks':!![]});db[_0x30b1('0xa2')][_0x30b1('0x11f')](db[_0x30b1('0x1c0')],{'as':'Fields','onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1b2'),'hooks':!![]});db[_0x30b1('0xa4')][_0x30b1('0x11f')](db[_0x30b1('0x1c0')],{'as':_0x30b1('0x1c1'),'onDelete':_0x30b1('0x11b'),'foreignKey':'DefaultReportId'});db[_0x30b1('0xa6')]['hasMany'](db[_0x30b1('0x1c0')],{'as':_0x30b1('0x1c1'),'onDelete':'cascade','foreignKey':_0x30b1('0x1c2')});db[_0x30b1('0x1c0')][_0x30b1('0x12a')](db[_0x30b1('0xa6')],{'foreignKey':_0x30b1('0x1c2')});db[_0x30b1('0x1c3')]['hasMany'](db[_0x30b1('0x1c4')],{'as':_0x30b1('0x1c5'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1c6')});db['SalesforceConfiguration'][_0x30b1('0x11f')](db['SalesforceField'],{'as':_0x30b1('0x1c7'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x30b1('0x1c4')][_0x30b1('0x11f')](db[_0x30b1('0xa9')],{'as':_0x30b1('0x1c8'),'onDelete':_0x30b1('0x11b'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x30b1('0x11f')](db[_0x30b1('0xa9')],{'as':_0x30b1('0x1c1'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1c9')});db['SalesforceConfiguration'][_0x30b1('0x12a')](db[_0x30b1('0x1c3')],{'as':'Account','foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0xa9')][_0x30b1('0x11f')](db['SalesforceField'],{'as':_0x30b1('0x1ca'),'foreignKey':_0x30b1('0x1cb')});db['SalesforceField'][_0x30b1('0x11f')](db[_0x30b1('0xa9')],{'as':_0x30b1('0x1cc'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x30b1('0x11f')](db[_0x30b1('0xa9')],{'as':_0x30b1('0x1cd'),'foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0xa9')][_0x30b1('0x12a')](db[_0x30b1('0x9e')],{'as':'Variable','foreignKey':_0x30b1('0x1ce')});db[_0x30b1('0x1cf')][_0x30b1('0x11f')](db['SugarcrmConfiguration'],{'as':_0x30b1('0x1c5'),'onDelete':'cascade','foreignKey':_0x30b1('0x1c6')});db['SugarcrmConfiguration'][_0x30b1('0x11f')](db[_0x30b1('0xac')],{'as':'Subjects','onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0x1d0')]['hasMany'](db[_0x30b1('0xac')],{'as':_0x30b1('0x1c8'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0x1d0')][_0x30b1('0x11f')](db['SugarcrmField'],{'as':_0x30b1('0x1c1'),'onDelete':_0x30b1('0x11b'),'foreignKey':'FieldId'});db[_0x30b1('0x1d0')][_0x30b1('0x12a')](db[_0x30b1('0x1cf')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0xac')][_0x30b1('0x11f')](db[_0x30b1('0xac')],{'as':_0x30b1('0x1ca'),'foreignKey':_0x30b1('0x1cb')});db['SugarcrmField']['hasMany'](db[_0x30b1('0xac')],{'as':_0x30b1('0x1cc'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0xac')][_0x30b1('0x11f')](db[_0x30b1('0xac')],{'as':'Field','foreignKey':'FieldId'});db['SugarcrmField'][_0x30b1('0x12a')](db['Variable'],{'as':_0x30b1('0x9e'),'foreignKey':_0x30b1('0x1ce')});db[_0x30b1('0xae')][_0x30b1('0x11f')](db[_0x30b1('0xb0')],{'as':_0x30b1('0x1c5'),'onDelete':_0x30b1('0x11b'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x30b1('0x11f')](db['DeskField'],{'as':_0x30b1('0x1c7'),'onDelete':'cascade','foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0xb0')][_0x30b1('0x11f')](db[_0x30b1('0x1d2')],{'as':_0x30b1('0x1c8'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1d1')});db['DeskConfiguration'][_0x30b1('0x11f')](db['DeskField'],{'as':_0x30b1('0x1c1'),'onDelete':_0x30b1('0x11b'),'foreignKey':'FieldId'});db[_0x30b1('0xb0')]['belongsTo'](db['DeskAccount'],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0xb0')][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':'int_desk_configuration_has_tags'});db['DeskField']['hasMany'](db[_0x30b1('0x1d2')],{'as':'Subject','foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0x1d2')]['hasMany'](db[_0x30b1('0x1d2')],{'as':_0x30b1('0x1cc'),'foreignKey':_0x30b1('0x1d1')});db['DeskField'][_0x30b1('0x11f')](db[_0x30b1('0x1d2')],{'as':_0x30b1('0x1cd'),'foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0x1d2')][_0x30b1('0x12a')](db['Variable'],{'as':_0x30b1('0x9e'),'foreignKey':_0x30b1('0x1ce')});db['ZohoAccount'][_0x30b1('0x11f')](db[_0x30b1('0xb5')],{'as':_0x30b1('0x1c5'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1c6')});db['ZohoConfiguration'][_0x30b1('0x11f')](db['ZohoField'],{'as':_0x30b1('0x1c7'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1cb')});db['ZohoConfiguration'][_0x30b1('0x11f')](db['ZohoField'],{'as':_0x30b1('0x1c8'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0xb5')][_0x30b1('0x11f')](db[_0x30b1('0xb7')],{'as':_0x30b1('0x1c1'),'onDelete':'cascade','foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0xb5')][_0x30b1('0x12a')](db[_0x30b1('0xb3')],{'as':_0x30b1('0x174'),'foreignKey':'AccountId'});db[_0x30b1('0xb7')][_0x30b1('0x11f')](db[_0x30b1('0xb7')],{'as':_0x30b1('0x1ca'),'foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0xb7')]['hasMany'](db['ZohoField'],{'as':_0x30b1('0x1cc'),'foreignKey':'DescriptionId'});db[_0x30b1('0xb7')][_0x30b1('0x11f')](db[_0x30b1('0xb7')],{'as':_0x30b1('0x1cd'),'foreignKey':_0x30b1('0x1c9')});db['ZohoField'][_0x30b1('0x12a')](db[_0x30b1('0x9e')],{'as':_0x30b1('0x9e'),'foreignKey':'VariableId'});db[_0x30b1('0xb9')][_0x30b1('0x11f')](db[_0x30b1('0xbb')],{'as':'Configurations','onDelete':_0x30b1('0x11b'),'foreignKey':'AccountId'});db[_0x30b1('0xbb')][_0x30b1('0x11f')](db[_0x30b1('0xbc')],{'as':_0x30b1('0x1c7'),'foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0xbb')][_0x30b1('0x11f')](db['ZendeskField'],{'as':_0x30b1('0x1c8'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0xbb')][_0x30b1('0x11f')](db[_0x30b1('0xbc')],{'as':_0x30b1('0x1c1'),'foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0xbb')][_0x30b1('0x12a')](db[_0x30b1('0xb9')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0xbb')][_0x30b1('0x12c')](db['Tag'],{'through':_0x30b1('0x1d3')});db['ZendeskField'][_0x30b1('0x11f')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x30b1('0xbc')][_0x30b1('0x11f')](db[_0x30b1('0xbc')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x30b1('0xbc')][_0x30b1('0x11f')](db['ZendeskField'],{'as':_0x30b1('0x1cd'),'foreignKey':'FieldId'});db[_0x30b1('0xbc')][_0x30b1('0x12a')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['FreshdeskAccount'][_0x30b1('0x11f')](db['FreshdeskConfiguration'],{'as':_0x30b1('0x1c5'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x30b1('0xc0')][_0x30b1('0x11f')](db[_0x30b1('0xc1')],{'as':_0x30b1('0x1c7'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0xc0')]['hasMany'](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0xc0')][_0x30b1('0x11f')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x30b1('0x11b'),'foreignKey':'FieldId'});db[_0x30b1('0xc0')][_0x30b1('0x12a')](db[_0x30b1('0xbe')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0xc0')][_0x30b1('0x12c')](db['Tag'],{'through':_0x30b1('0x1d4')});db['FreshdeskField']['hasMany'](db[_0x30b1('0xc1')],{'as':'Subject','foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0xc1')][_0x30b1('0x11f')](db[_0x30b1('0xc1')],{'as':_0x30b1('0x1cc'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0xc1')][_0x30b1('0x11f')](db[_0x30b1('0xc1')],{'as':_0x30b1('0x1cd'),'foreignKey':'FieldId'});db[_0x30b1('0xc1')][_0x30b1('0x12a')](db[_0x30b1('0x9e')],{'as':'Variable','foreignKey':_0x30b1('0x1ce')});db['VtigerAccount'][_0x30b1('0x11f')](db[_0x30b1('0xc5')],{'as':_0x30b1('0x1c5'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0xc5')][_0x30b1('0x11f')](db[_0x30b1('0xc6')],{'as':_0x30b1('0x1c7'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x30b1('0x11f')](db[_0x30b1('0xc6')],{'as':_0x30b1('0x1c8'),'foreignKey':_0x30b1('0x1d1')});db['VtigerConfiguration']['hasMany'](db[_0x30b1('0xc6')],{'as':'Fields','foreignKey':_0x30b1('0x1c9')});db['VtigerConfiguration'][_0x30b1('0x12a')](db['VtigerAccount'],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0xc6')][_0x30b1('0x11f')](db[_0x30b1('0xc6')],{'as':_0x30b1('0x1ca'),'foreignKey':'SubjectId'});db[_0x30b1('0xc6')]['hasMany'](db[_0x30b1('0xc6')],{'as':_0x30b1('0x1cc'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0xc6')][_0x30b1('0x11f')](db[_0x30b1('0xc6')],{'as':_0x30b1('0x1cd'),'foreignKey':'FieldId'});db[_0x30b1('0xc6')]['belongsTo'](db[_0x30b1('0x9e')],{'as':'Variable','foreignKey':_0x30b1('0x1ce')});db[_0x30b1('0xc7')][_0x30b1('0x11f')](db[_0x30b1('0xc9')],{'as':_0x30b1('0x1c5'),'onDelete':_0x30b1('0x11b'),'foreignKey':'AccountId'});db[_0x30b1('0xc9')]['hasMany'](db['ServicenowField'],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x30b1('0x11f')](db[_0x30b1('0xcb')],{'as':'Descriptions','foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0xc9')][_0x30b1('0x11f')](db[_0x30b1('0xcb')],{'as':_0x30b1('0x1c1'),'foreignKey':'FieldId'});db[_0x30b1('0xc9')][_0x30b1('0x12a')](db[_0x30b1('0xc7')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1c6')});db['ServicenowField'][_0x30b1('0x11f')](db[_0x30b1('0xcb')],{'as':_0x30b1('0x1ca'),'foreignKey':'SubjectId'});db[_0x30b1('0xcb')][_0x30b1('0x11f')](db[_0x30b1('0xcb')],{'as':_0x30b1('0x1cc'),'foreignKey':'DescriptionId'});db[_0x30b1('0xcb')][_0x30b1('0x11f')](db['ServicenowField'],{'as':'Field','foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0xcb')][_0x30b1('0x12a')](db[_0x30b1('0x9e')],{'as':_0x30b1('0x9e'),'foreignKey':_0x30b1('0x1ce')});db[_0x30b1('0x1d5')][_0x30b1('0x11f')](db['Dynamics365Configuration'],{'as':_0x30b1('0x1c5'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1c6')});db['Dynamics365Account'][_0x30b1('0x12a')](db[_0x30b1('0x112')],{'as':_0x30b1('0x112'),'foreignKey':_0x30b1('0x165')});db[_0x30b1('0xce')]['hasMany'](db[_0x30b1('0x1d6')],{'as':_0x30b1('0x1c7'),'onDelete':_0x30b1('0x11b'),'foreignKey':'SubjectId'});db[_0x30b1('0xce')][_0x30b1('0x11f')](db[_0x30b1('0x1d6')],{'as':_0x30b1('0x1c8'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0xce')][_0x30b1('0x11f')](db[_0x30b1('0x1d6')],{'as':_0x30b1('0x1c1'),'onDelete':'cascade','foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0xce')][_0x30b1('0x12a')](db[_0x30b1('0x1d5')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0x1d6')]['hasMany'](db[_0x30b1('0x1d6')],{'as':_0x30b1('0x1ca'),'foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0x1d6')][_0x30b1('0x11f')](db['Dynamics365Field'],{'as':_0x30b1('0x1cc'),'foreignKey':_0x30b1('0x1d1')});db[_0x30b1('0x1d6')][_0x30b1('0x11f')](db[_0x30b1('0x1d6')],{'as':_0x30b1('0x1cd'),'foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0x1d6')][_0x30b1('0x12a')](db[_0x30b1('0x9e')],{'as':_0x30b1('0x9e'),'foreignKey':_0x30b1('0x1ce')});db[_0x30b1('0xd0')][_0x30b1('0x11f')](db['FreshsalesConfiguration'],{'as':_0x30b1('0x1c5'),'onDelete':'cascade','foreignKey':_0x30b1('0x1c6')});db['FreshsalesConfiguration'][_0x30b1('0x11f')](db[_0x30b1('0xd3')],{'as':'Subjects','foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0x1d7')][_0x30b1('0x11f')](db[_0x30b1('0xd3')],{'as':_0x30b1('0x1c8'),'foreignKey':_0x30b1('0x1d1')});db['FreshsalesConfiguration'][_0x30b1('0x11f')](db[_0x30b1('0xd3')],{'as':'Fields','foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0x1d7')][_0x30b1('0x12a')](db[_0x30b1('0xd0')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1c6')});db[_0x30b1('0xd3')]['hasMany'](db[_0x30b1('0xd3')],{'as':_0x30b1('0x1ca'),'foreignKey':_0x30b1('0x1cb')});db[_0x30b1('0xd3')]['hasMany'](db['FreshsalesField'],{'as':_0x30b1('0x1cc'),'foreignKey':_0x30b1('0x1d1')});db['FreshsalesField'][_0x30b1('0x11f')](db[_0x30b1('0xd3')],{'as':_0x30b1('0x1cd'),'foreignKey':_0x30b1('0x1c9')});db[_0x30b1('0xd3')]['belongsTo'](db[_0x30b1('0x9e')],{'as':_0x30b1('0x9e'),'foreignKey':_0x30b1('0x1ce')});db['ChatQueueReport']['belongsTo'](db['ChatWebsite'],{});db[_0x30b1('0xd6')][_0x30b1('0x12a')](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0xd6')][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0xd6')][_0x30b1('0x12a')](db['ChatInteraction'],{});db[_0x30b1('0xd6')][_0x30b1('0x12a')](db[_0x30b1('0x6e')],{});db[_0x30b1('0xd6')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{});db[_0x30b1('0xd6')]['belongsTo'](db[_0x30b1('0x72')],{});db[_0x30b1('0x199')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1d8')});db[_0x30b1('0x199')][_0x30b1('0x12a')](db['User'],{'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1d9')});db[_0x30b1('0xdd')][_0x30b1('0x11f')](db[_0x30b1('0xdb')],{'foreignKey':_0x30b1('0x1da'),'onDelete':_0x30b1('0x11b')});db['JscriptySessionReport'][_0x30b1('0x11f')](db[_0x30b1('0xd9')],{'foreignKey':_0x30b1('0x1da'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0xdf')][_0x30b1('0x12a')](db['SmsAccount'],{});db[_0x30b1('0xdf')][_0x30b1('0x12a')](db['CmList'],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db['SmsQueueReport'][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0xdf')]['belongsTo'](db[_0x30b1('0x5b')],{});db[_0x30b1('0xdf')][_0x30b1('0x12a')](db[_0x30b1('0x5d')],{});db[_0x30b1('0xdf')]['belongsTo'](db[_0x30b1('0x119')],{});db[_0x30b1('0xdf')][_0x30b1('0x12a')](db[_0x30b1('0x5e')],{});db[_0x30b1('0xe2')][_0x30b1('0x11f')](db[_0x30b1('0xdd')],{'foreignKey':_0x30b1('0x1db')});db[_0x30b1('0xe2')]['hasMany'](db[_0x30b1('0xdb')],{'foreignKey':'ProjectId'});db[_0x30b1('0xe2')][_0x30b1('0x11f')](db[_0x30b1('0xd9')],{'foreignKey':_0x30b1('0x1db')});db[_0x30b1('0xeb')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x171'),'through':_0x30b1('0x133')});db[_0x30b1('0xeb')]['belongsToMany'](db[_0x30b1('0x151')],{'through':_0x30b1('0x114'),'as':_0x30b1('0x13a')});db[_0x30b1('0xeb')][_0x30b1('0x12c')](db[_0x30b1('0x3f')],{'through':_0x30b1('0x172'),'as':_0x30b1('0x13c')});db[_0x30b1('0xeb')]['belongsToMany'](db[_0x30b1('0x72')],{'through':_0x30b1('0x198'),'as':_0x30b1('0x13d')});db[_0x30b1('0xeb')][_0x30b1('0x12c')](db[_0x30b1('0x53')],{'through':_0x30b1('0x1dc'),'as':_0x30b1('0x13e')});db[_0x30b1('0xeb')]['belongsToMany'](db[_0x30b1('0x5e')],{'through':_0x30b1('0x188'),'as':_0x30b1('0x13f')});db[_0x30b1('0xeb')][_0x30b1('0x12c')](db[_0x30b1('0x68')],{'through':_0x30b1('0x1dd'),'as':_0x30b1('0x140')});db[_0x30b1('0xeb')][_0x30b1('0x12c')](db[_0x30b1('0x110')],{'through':_0x30b1('0x1de'),'as':_0x30b1('0x141')});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x30b1('0x13b')});db[_0x30b1('0xef')][_0x30b1('0x11f')](db[_0x30b1('0x7b')],{'as':_0x30b1('0x152'),'foreignKey':'CampaignId'});db[_0x30b1('0xef')][_0x30b1('0x11f')](db['CmHopperFinal'],{'as':_0x30b1('0x124'),'foreignKey':_0x30b1('0x1a3')});db[_0x30b1('0xef')][_0x30b1('0x11f')](db['CmHopperHistory'],{'as':_0x30b1('0x153'),'foreignKey':_0x30b1('0x1a3')});db[_0x30b1('0xef')][_0x30b1('0x11f')](db[_0x30b1('0x1a5')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x30b1('0xef')]['belongsTo'](db[_0x30b1('0x29')],{'as':_0x30b1('0x29'),'foreignKey':_0x30b1('0x156')});db['Campaign'][_0x30b1('0x12a')](db[_0x30b1('0x29')],{'as':_0x30b1('0x157'),'foreignKey':_0x30b1('0x1df')});db[_0x30b1('0xef')]['belongsTo'](db[_0x30b1('0x8b')],{'as':_0x30b1('0x8b'),'foreignKey':_0x30b1('0x185')});db[_0x30b1('0xef')][_0x30b1('0x12a')](db['SquareProject'],{'as':_0x30b1('0xe7'),'foreignKey':_0x30b1('0x1e0')});db[_0x30b1('0xef')][_0x30b1('0x12c')](db[_0x30b1('0x130')],{'as':_0x30b1('0x131'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x30b1('0x12c')](db[_0x30b1('0x130')],{'as':_0x30b1('0x15a'),'through':'campaigns_has_cm_blacklists'});db[_0x30b1('0x17a')]['belongsTo'](db[_0x30b1('0x70')],{'as':_0x30b1('0x70'),'foreignKey':_0x30b1('0x17c')});db[_0x30b1('0xf4')][_0x30b1('0x12a')](db[_0x30b1('0x44')],{});db[_0x30b1('0xf4')][_0x30b1('0x12a')](db[_0x30b1('0x42')],{});db[_0x30b1('0xf4')][_0x30b1('0x12a')](db[_0x30b1('0x3d')],{'foreignKey':'FromMailAccountId','as':_0x30b1('0x1e1')});db[_0x30b1('0xf4')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x30b1('0xf4')]['belongsTo'](db[_0x30b1('0x119')],{'foreignKey':_0x30b1('0x1e2'),'as':_0x30b1('0x1e3')});db[_0x30b1('0xf4')][_0x30b1('0x12a')](db[_0x30b1('0x3f')],{'foreignKey':_0x30b1('0x1e4'),'as':_0x30b1('0x1e5')});db['MailTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x3d')],{'foreignKey':'ToMailAccountId','as':_0x30b1('0x1e6')});db['ChatTransferReport'][_0x30b1('0x12a')](db['ChatMessage'],{});db['ChatTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x6c')],{});db[_0x30b1('0xf6')][_0x30b1('0x12a')](db[_0x30b1('0x142')],{'foreignKey':_0x30b1('0x1e7'),'as':'FromAccount'});db['ChatTransferReport'][_0x30b1('0x12a')](db['User'],{'foreignKey':'FromUserId','as':_0x30b1('0x1e8')});db[_0x30b1('0xf6')]['belongsTo'](db[_0x30b1('0x119')],{'foreignKey':_0x30b1('0x1e2'),'as':'ToAgent'});db[_0x30b1('0xf6')][_0x30b1('0x12a')](db[_0x30b1('0x72')],{'foreignKey':_0x30b1('0x1e9'),'as':'ToQueue'});db[_0x30b1('0xf6')][_0x30b1('0x12a')](db['ChatWebsite'],{'foreignKey':_0x30b1('0x1ea'),'as':'ToAccount'});db[_0x30b1('0xf8')]['belongsTo'](db[_0x30b1('0x51')],{});db[_0x30b1('0xf8')]['belongsTo'](db[_0x30b1('0x50')],{});db['FaxTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x4d')],{'foreignKey':_0x30b1('0x1eb'),'as':_0x30b1('0x1e1')});db['FaxTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'foreignKey':'FromUserId','as':_0x30b1('0x1e8')});db[_0x30b1('0xf8')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x30b1('0xf8')][_0x30b1('0x12a')](db[_0x30b1('0x53')],{'foreignKey':_0x30b1('0x1ec'),'as':_0x30b1('0x1e5')});db['FaxTransferReport']['belongsTo'](db[_0x30b1('0x4d')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x66')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x30b1('0x64')],{});db[_0x30b1('0xfa')][_0x30b1('0x12a')](db[_0x30b1('0x60')],{'foreignKey':_0x30b1('0x1ed'),'as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x30b1('0x119')],{'foreignKey':_0x30b1('0x1ee'),'as':_0x30b1('0x1e8')});db[_0x30b1('0xfa')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'foreignKey':_0x30b1('0x1e2'),'as':_0x30b1('0x1e3')});db[_0x30b1('0xfa')][_0x30b1('0x12a')](db[_0x30b1('0x68')],{'foreignKey':_0x30b1('0x1ef'),'as':_0x30b1('0x1e5')});db['OpenchannelTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x60')],{'foreignKey':_0x30b1('0x1f0'),'as':'ToAccount'});db[_0x30b1('0xfc')][_0x30b1('0x12a')](db['SmsMessage'],{});db['SmsTransferReport'][_0x30b1('0x12a')](db['SmsInteraction'],{});db[_0x30b1('0xfc')][_0x30b1('0x12a')](db[_0x30b1('0x57')],{'foreignKey':'FromSmsAccountId','as':_0x30b1('0x1e1')});db[_0x30b1('0xfc')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'foreignKey':'FromUserId','as':_0x30b1('0x1e8')});db[_0x30b1('0xfc')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'foreignKey':'ToUserId','as':_0x30b1('0x1e3')});db['SmsTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x5e')],{'foreignKey':'ToSmsQueueId','as':_0x30b1('0x1e5')});db[_0x30b1('0xfc')]['belongsTo'](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x30b1('0x130')][_0x30b1('0x11f')](db[_0x30b1('0x88')],{'as':'Dispositions','foreignKey':_0x30b1('0x16d'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x130')][_0x30b1('0x11f')](db[_0x30b1('0x82')],{'as':_0x30b1('0x1f1'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x130')]['hasMany'](db[_0x30b1('0x79')],{'as':_0x30b1('0x12f'),'onDelete':'cascade','foreignKey':_0x30b1('0x16d')});db['CmList'][_0x30b1('0x11f')](db[_0x30b1('0x7e')],{'as':_0x30b1('0x124'),'foreignKey':'ListId'});db[_0x30b1('0x130')][_0x30b1('0x11f')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x130')][_0x30b1('0x11f')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x130')][_0x30b1('0x12c')](db['VoiceQueue'],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x30b1('0x130')][_0x30b1('0x12c')](db['User'],{'as':_0x30b1('0x171'),'through':_0x30b1('0x132')});db['VoicePrefix'][_0x30b1('0x11f')](db[_0x30b1('0x123')],{'as':_0x30b1('0x1ad'),'onDelete':'cascade'});db[_0x30b1('0xff')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':'Agents','through':_0x30b1('0x116')});db[_0x30b1('0xff')]['belongsToMany'](db[_0x30b1('0xeb')],{'through':_0x30b1('0x1f2'),'as':_0x30b1('0x159')});db['UserProfile']['hasMany'](db[_0x30b1('0x119')],{'as':_0x30b1('0x179'),'foreignKey':'userProfileId'});db[_0x30b1('0x101')][_0x30b1('0x11f')](db[_0x30b1('0x1f3')],{'as':_0x30b1('0x1f4'),'foreignKey':_0x30b1('0x12b'),'onDelete':_0x30b1('0x11b')});db['UserProfileSection'][_0x30b1('0x11f')](db['UserProfileResource'],{'as':_0x30b1('0x1f5'),'foreignKey':_0x30b1('0x1f6'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x107')][_0x30b1('0x11f')](db[_0x30b1('0x88')],{'as':'Dispositions','foreignKey':_0x30b1('0x1f7'),'onDelete':_0x30b1('0x11b')});db[_0x30b1('0x107')][_0x30b1('0x11f')](db[_0x30b1('0x86')],{'as':_0x30b1('0x16a'),'foreignKey':_0x30b1('0x1f7')});db[_0x30b1('0x107')][_0x30b1('0x11f')](db[_0x30b1('0x1f8')],{'as':_0x30b1('0x15c'),'foreignKey':_0x30b1('0x1f7')});db[_0x30b1('0x107')]['hasMany'](db[_0x30b1('0x10a')],{'as':'Interactions'});db[_0x30b1('0x107')][_0x30b1('0x11f')](db[_0x30b1('0x109')],{'as':_0x30b1('0x14d')});db[_0x30b1('0x107')][_0x30b1('0x12a')](db['CmList'],{'as':_0x30b1('0x16c'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x30b1('0x12a')](db[_0x30b1('0x8d')],{'as':_0x30b1('0x170'),'foreignKey':_0x30b1('0x158')});db[_0x30b1('0x107')]['belongsToMany'](db[_0x30b1('0x119')],{'as':_0x30b1('0x171'),'through':_0x30b1('0x14c')});db[_0x30b1('0x109')]['belongsTo'](db[_0x30b1('0x119')],{'onDelete':'restrict'});db[_0x30b1('0x109')][_0x30b1('0x12a')](db[_0x30b1('0x110')],{'onDelete':_0x30b1('0x166')});db['WhatsappApplication']['belongsTo'](db[_0x30b1('0x107')],{'onDelete':_0x30b1('0x166')});db[_0x30b1('0x109')][_0x30b1('0x12a')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db['WhatsappApplication'][_0x30b1('0x12a')](db[_0x30b1('0x96')],{'onDelete':_0x30b1('0x166'),'foreignKey':_0x30b1('0x17d')});db['WhatsappInteraction'][_0x30b1('0x11f')](db['WhatsappMessage'],{'as':_0x30b1('0x15c'),'onDelete':_0x30b1('0x11b'),'foreignKey':_0x30b1('0x1f9')});db[_0x30b1('0x10a')][_0x30b1('0x12a')](db['WhatsappAccount'],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1f7')});db[_0x30b1('0x10a')][_0x30b1('0x12a')](db[_0x30b1('0x79')],{'as':_0x30b1('0x162'),'foreignKey':_0x30b1('0x163')});db[_0x30b1('0x10a')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x175'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':'whatsapp_interaction_has_tags','as':_0x30b1('0x177')});db[_0x30b1('0x10a')][_0x30b1('0x12c')](db[_0x30b1('0x96')],{'through':_0x30b1('0x1fa'),'as':_0x30b1('0x178')});db[_0x30b1('0x10a')][_0x30b1('0x12c')](db['User'],{'as':_0x30b1('0x179'),'through':'user_has_whatsapp_interactions','foreignKey':_0x30b1('0x1f9')});db[_0x30b1('0x1f8')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x119')});db['WhatsappMessage']['belongsTo'](db[_0x30b1('0x79')],{'onDelete':'cascade','as':'Contact'});db[_0x30b1('0x1f8')][_0x30b1('0x12a')](db[_0x30b1('0x10a')],{'onDelete':'cascade','as':_0x30b1('0x17b'),'foreignKey':_0x30b1('0x1f9')});db[_0x30b1('0x1f8')][_0x30b1('0x12a')](db[_0x30b1('0x107')],{'as':_0x30b1('0x174'),'foreignKey':_0x30b1('0x1f7')});db[_0x30b1('0x10d')]['belongsTo'](db['WhatsappAccount'],{});db[_0x30b1('0x10d')]['belongsTo'](db[_0x30b1('0x130')],{'as':_0x30b1('0x16c'),'foreignKey':_0x30b1('0x16d')});db[_0x30b1('0x10d')][_0x30b1('0x12a')](db['CmContact'],{'as':'Contact','foreignKey':_0x30b1('0x163')});db[_0x30b1('0x10d')][_0x30b1('0x12a')](db[_0x30b1('0x10a')],{});db['WhatsappQueueReport'][_0x30b1('0x12a')](db[_0x30b1('0x110')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x30b1('0x1f8')],{});db[_0x30b1('0x10d')][_0x30b1('0x12a')](db['User'],{});db[_0x30b1('0x10e')][_0x30b1('0x12a')](db['WhatsappMessage'],{});db[_0x30b1('0x10e')]['belongsTo'](db[_0x30b1('0x10a')],{});db['WhatsappTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x107')],{'foreignKey':_0x30b1('0x1fb'),'as':_0x30b1('0x1e1')});db['WhatsappTransferReport'][_0x30b1('0x12a')](db['WhatsappAccount'],{'foreignKey':_0x30b1('0x1fc'),'as':_0x30b1('0x1e6')});db[_0x30b1('0x10e')][_0x30b1('0x12a')](db[_0x30b1('0x110')],{'foreignKey':'ToQueueId','as':_0x30b1('0x1e5')});db[_0x30b1('0x10e')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'foreignKey':_0x30b1('0x1ee'),'as':_0x30b1('0x1e8')});db['WhatsappTransferReport'][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'foreignKey':_0x30b1('0x1e2'),'as':_0x30b1('0x1e3')});db[_0x30b1('0x110')][_0x30b1('0x12c')](db[_0x30b1('0x119')],{'as':_0x30b1('0x171'),'through':_0x30b1('0x37'),'foreignKey':_0x30b1('0x1fd')});db['WhatsappQueue'][_0x30b1('0x12c')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0x30b1('0x159')});db[_0x30b1('0x11d')][_0x30b1('0x12a')](db[_0x30b1('0x119')],{'as':_0x30b1('0x1fe'),'foreignKey':_0x30b1('0x11c'),'onDelete':_0x30b1('0x11b'),'hooks':!![]});db['CloudProvider'][_0x30b1('0x11a')](db['Dynamics365Account'],{'as':_0x30b1('0x1d5'),'onDelete':'restrict'});db[_0x30b1('0x112')]['hasOne'](db[_0x30b1('0x39')],{'as':_0x30b1('0x167'),'onDelete':_0x30b1('0x166')});db[_0x30b1('0x112')][_0x30b1('0x11a')](db[_0x30b1('0x3b')],{'as':'Smtp','onDelete':_0x30b1('0x166')});module[_0x30b1('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index abc8559..5a9f684 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aa9=['./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/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/automation','/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/schedule','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/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/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','./api/license','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/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/version','/api/system','./api/system','./api/pm2','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','get','/index.html','path','express','./errors','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages'];(function(_0x2bdcfd,_0x32697d){var _0x53a635=function(_0x5de676){while(--_0x5de676){_0x2bdcfd['push'](_0x2bdcfd['shift']());}};_0x53a635(++_0x32697d);}(_0x2aa9,0xbc));var _0x92aa=function(_0x109647,_0xf32e0){_0x109647=_0x109647-0x0;var _0xae9526=_0x2aa9[_0x109647];return _0xae9526;};'use strict';var path=require(_0x92aa('0x0'));var express=require(_0x92aa('0x1'));var errors=require(_0x92aa('0x2'));var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x92aa('0x3')];var clientSideLogs=require(_0x92aa('0x4'));exports[_0x92aa('0x5')]=function(_0x4ec903){return setupLoggers(_0x4ec903)[_0x92aa('0x6')](function(){_0x4ec903[_0x92aa('0x7')]('/api/users',require(_0x92aa('0x8')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x9'),require(_0x92aa('0xa')));_0x4ec903[_0x92aa('0x7')]('/api/voice/contexts',require(_0x92aa('0xb')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xc'),require(_0x92aa('0xd')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xe'),require(_0x92aa('0xf')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x10'),require(_0x92aa('0x11')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x12'),require(_0x92aa('0x13')));_0x4ec903[_0x92aa('0x7')]('/api/screen/recordings',require(_0x92aa('0x14')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x15'),require(_0x92aa('0x16')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x17'),require(_0x92aa('0x18')));_0x4ec903['use'](_0x92aa('0x19'),require(_0x92aa('0x1a')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x1b'),require('./api/voiceDialReport'));_0x4ec903['use'](_0x92aa('0x1c'),require(_0x92aa('0x1d')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x1e'),require(_0x92aa('0x1f')));_0x4ec903['use']('/api/members/reports',require(_0x92aa('0x20')));_0x4ec903['use'](_0x92aa('0x21'),require('./api/trunk'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x22'),require(_0x92aa('0x23')));_0x4ec903[_0x92aa('0x7')]('/api/mail/out_servers',require(_0x92aa('0x24')));_0x4ec903['use'](_0x92aa('0x25'),require(_0x92aa('0x26')));_0x4ec903['use'](_0x92aa('0x27'),require(_0x92aa('0x28')));_0x4ec903['use'](_0x92aa('0x29'),require(_0x92aa('0x2a')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x2b'),require('./api/mailInteraction'));_0x4ec903['use']('/api/mail/messages',require(_0x92aa('0x2c')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x2d'),require(_0x92aa('0x2e')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x2f'),require(_0x92aa('0x30')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x31'),require(_0x92aa('0x32')));_0x4ec903['use'](_0x92aa('0x33'),require(_0x92aa('0x34')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x35'),require(_0x92aa('0x36')));_0x4ec903[_0x92aa('0x7')]('/api/fax/applications',require(_0x92aa('0x37')));_0x4ec903[_0x92aa('0x7')]('/api/fax/interactions',require('./api/faxInteraction'));_0x4ec903[_0x92aa('0x7')]('/api/fax/messages',require('./api/faxMessage'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x38'),require(_0x92aa('0x39')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x3a'),require('./api/faxQueueReport'));_0x4ec903['use']('/api/sms/accounts',require('./api/smsAccount'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x3b'),require(_0x92aa('0x3c')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x3d'),require('./api/smsInteraction'));_0x4ec903['use'](_0x92aa('0x3e'),require('./api/smsMessage'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x3f'),require('./api/smsQueue'));_0x4ec903['use'](_0x92aa('0x40'),require('./api/openchannelAccount'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x41'),require(_0x92aa('0x42')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x43'),require(_0x92aa('0x44')));_0x4ec903['use'](_0x92aa('0x45'),require('./api/openchannelMessage'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x46'),require(_0x92aa('0x47')));_0x4ec903['use'](_0x92aa('0x48'),require(_0x92aa('0x49')));_0x4ec903['use']('/api/openchannel/reports/queue',require(_0x92aa('0x4a')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x4b'),require(_0x92aa('0x4c')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x4d'),require(_0x92aa('0x4e')));_0x4ec903[_0x92aa('0x7')]('/api/chat/messages',require(_0x92aa('0x4f')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x50'),require(_0x92aa('0x51')));_0x4ec903['use'](_0x92aa('0x52'),require(_0x92aa('0x53')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x54'),require(_0x92aa('0x55')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x56'),require(_0x92aa('0x57')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x58'),require(_0x92aa('0x59')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x5a'),require(_0x92aa('0x5b')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x5c'),require(_0x92aa('0x5d')));_0x4ec903['use'](_0x92aa('0x5e'),require('./api/cmHopperBlack'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x5f'),require(_0x92aa('0x60')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x61'),require(_0x92aa('0x62')));_0x4ec903[_0x92aa('0x7')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x4ec903[_0x92aa('0x7')]('/api/actions',require('./api/action'));_0x4ec903[_0x92aa('0x7')]('/api/automations',require(_0x92aa('0x63')));_0x4ec903['use']('/api/canned_answers',require('./api/cannedAnswer'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x64'),require(_0x92aa('0x65')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x66'),require(_0x92aa('0x67')));_0x4ec903['use'](_0x92aa('0x68'),require(_0x92aa('0x69')));_0x4ec903['use'](_0x92aa('0x6a'),require(_0x92aa('0x6b')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x6c'),require(_0x92aa('0x6d')));_0x4ec903['use'](_0x92aa('0x6e'),require(_0x92aa('0x6f')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x70'),require(_0x92aa('0x71')));_0x4ec903[_0x92aa('0x7')]('/api/sounds',require(_0x92aa('0x72')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x73'),require(_0x92aa('0x74')));_0x4ec903[_0x92aa('0x7')]('/api/contact_item_types',require(_0x92aa('0x75')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x76'),require(_0x92aa('0x77')));_0x4ec903['use']('/api/cm_hopper_additional_phones',require(_0x92aa('0x78')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x79'),require(_0x92aa('0x7a')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x7b'),require(_0x92aa('0x7c')));_0x4ec903[_0x92aa('0x7')]('/api/variables',require(_0x92aa('0x7d')));_0x4ec903['use'](_0x92aa('0x7e'),require(_0x92aa('0x7f')));_0x4ec903['use'](_0x92aa('0x80'),require('./api/integrationReport'));_0x4ec903[_0x92aa('0x7')]('/api/analytics/custom_reports',require(_0x92aa('0x81')));_0x4ec903[_0x92aa('0x7')]('/api/analytics/default_reports',require(_0x92aa('0x82')));_0x4ec903['use'](_0x92aa('0x83'),require(_0x92aa('0x84')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x85'),require(_0x92aa('0x86')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x87'),require('./api/analyticFieldReport'));_0x4ec903[_0x92aa('0x7')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x88'),require('./api/intSalesforceAccount'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x89'),require('./api/intSalesforceConfiguration'));_0x4ec903[_0x92aa('0x7')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x8a'),require(_0x92aa('0x8b')));_0x4ec903[_0x92aa('0x7')]('/api/integrations/sugarcrm/configurations',require(_0x92aa('0x8c')));_0x4ec903['use']('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x4ec903['use']('/api/integrations/desk/accounts',require(_0x92aa('0x8d')));_0x4ec903['use'](_0x92aa('0x8e'),require(_0x92aa('0x8f')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x90'),require(_0x92aa('0x91')));_0x4ec903['use'](_0x92aa('0x92'),require('./api/intZohoAccount'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x93'),require('./api/intZohoConfiguration'));_0x4ec903['use'](_0x92aa('0x94'),require(_0x92aa('0x95')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x96'),require(_0x92aa('0x97')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x98'),require('./api/intZendeskConfiguration'));_0x4ec903['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x4ec903[_0x92aa('0x7')]('/api/integrations/freshdesk/accounts',require(_0x92aa('0x99')));_0x4ec903[_0x92aa('0x7')]('/api/integrations/freshdesk/configurations',require(_0x92aa('0x9a')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x9b'),require('./api/intFreshdeskField'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x9c'),require(_0x92aa('0x9d')));_0x4ec903[_0x92aa('0x7')]('/api/integrations/vtiger/configurations',require(_0x92aa('0x9e')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x9f'),require(_0x92aa('0xa0')));_0x4ec903['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xa1'),require(_0x92aa('0xa2')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xa3'),require(_0x92aa('0xa4')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xa5'),require(_0x92aa('0xa6')));_0x4ec903['use'](_0x92aa('0xa7'),require('./api/intDynamics365Configuration'));_0x4ec903['use'](_0x92aa('0xa8'),require(_0x92aa('0xa9')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xaa'),require('./api/intFreshsalesAccount'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xab'),require(_0x92aa('0xac')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xad'),require(_0x92aa('0xae')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xaf'),require(_0x92aa('0xb0')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xb1'),require(_0x92aa('0xb2')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xb3'),require('./api/chatInternalMessage'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xb4'),require('./api/jscriptyAnswerReport'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xb5'),require(_0x92aa('0xb6')));_0x4ec903['use'](_0x92aa('0xb7'),require(_0x92aa('0xb8')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xb9'),require(_0x92aa('0xba')));_0x4ec903['use'](_0x92aa('0xbb'),require(_0x92aa('0xbc')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xbd'),require(_0x92aa('0xbe')));_0x4ec903[_0x92aa('0x7')]('/api/jscripty/projects',require(_0x92aa('0xbf')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xc0'),require('./api/setting'));_0x4ec903['use'](_0x92aa('0xc1'),require(_0x92aa('0xc2')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xc3'),require('./api/squareProject'));_0x4ec903['use'](_0x92aa('0xc4'),require(_0x92aa('0xc5')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xc6'),require('./api/squareMessage'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xc7'),require(_0x92aa('0xc8')));_0x4ec903[_0x92aa('0x7')]('/api/license',require(_0x92aa('0xc9')));_0x4ec903['use']('/api/campaigns',require('./api/campaign'));_0x4ec903[_0x92aa('0x7')]('/api/migrations',require(_0x92aa('0xca')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xcb'),require(_0x92aa('0xcc')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xcd'),require(_0x92aa('0xce')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xcf'),require(_0x92aa('0xd0')));_0x4ec903['use'](_0x92aa('0xd1'),require(_0x92aa('0xd2')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xd3'),require('./api/faxTransferReport'));_0x4ec903['use'](_0x92aa('0xd4'),require(_0x92aa('0xd5')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xd6'),require(_0x92aa('0xd7')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xd8'),require(_0x92aa('0xd9')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xda'),require(_0x92aa('0xdb')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xdc'),require(_0x92aa('0xdd')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xde'),require('./api/userProfileSection'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xdf'),require(_0x92aa('0xe0')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xe1'),require('./api/userNotification'));_0x4ec903['use'](_0x92aa('0xe2'),require('./api/whatsappAccount'));_0x4ec903['use']('/api/whatsapp/applications',require(_0x92aa('0xe3')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xe4'),require(_0x92aa('0xe5')));_0x4ec903['use']('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xe6'),require(_0x92aa('0xe7')));_0x4ec903[_0x92aa('0x7')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xe8'),require('./api/whatsappQueue'));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xe9'),require(_0x92aa('0xea')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xeb'),require('./api/realtime'));_0x4ec903['use'](_0x92aa('0xec'),require(_0x92aa('0xed')));_0x4ec903['use'](_0x92aa('0xee'),require('./api/authLocal'));_0x4ec903['use'](_0x92aa('0xef'),require(_0x92aa('0xf0')));_0x4ec903['use'](_0x92aa('0xf1'),require(_0x92aa('0xf2')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xf3'),require(_0x92aa('0xf4')));_0x4ec903['use'](_0x92aa('0xf5'),require(_0x92aa('0xf6')));_0x4ec903['use'](_0x92aa('0xf7'),require(_0x92aa('0xf8')));_0x4ec903[_0x92aa('0x7')](_0x92aa('0xf9'),require(_0x92aa('0xfa')));_0x4ec903['use']('/api/pm2',require(_0x92aa('0xfb')));_0x4ec903[_0x92aa('0x7')]('/api/webbar',require('./api/webbar'));_0x4ec903['use'](_0x92aa('0xfc'),clientSideLogs);_0x4ec903['use'](_0x92aa('0xfd'),express[_0x92aa('0xfe')](path[_0x92aa('0xff')](config[_0x92aa('0x100')],_0x92aa('0xfd'))));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x101'),express[_0x92aa('0xfe')](path[_0x92aa('0xff')](config[_0x92aa('0x100')],_0x92aa('0x101'))));_0x4ec903[_0x92aa('0x7')]('/demo',express[_0x92aa('0xfe')](path['join'](config[_0x92aa('0x100')],_0x92aa('0x102'))));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x103'),express[_0x92aa('0xfe')](path[_0x92aa('0xff')](config[_0x92aa('0x100')],_0x92aa('0x104'),_0x92aa('0x105'))));_0x4ec903[_0x92aa('0x7')](_0x92aa('0x106'),express[_0x92aa('0xfe')](path[_0x92aa('0xff')](config[_0x92aa('0x100')],_0x92aa('0x107'))));_0x4ec903[_0x92aa('0x108')](_0x92aa('0x109'))['get'](errors[0x194]);_0x4ec903[_0x92aa('0x108')]('/*')['get'](function(_0x167ab7,_0x5d95e8){_0x5d95e8[_0x92aa('0x10a')](path['resolve'](_0x4ec903[_0x92aa('0x10b')]('appPath')+_0x92aa('0x10c')));});return _0x4ec903;});}; \ No newline at end of file +var _0x62ff=['/api/fax/reports/queue','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/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/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/configurations','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.1.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/applications','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','./api/faxQueue'];(function(_0x2a8cb1,_0x398ad7){var _0x31bdee=function(_0x5f5cd4){while(--_0x5f5cd4){_0x2a8cb1['push'](_0x2a8cb1['shift']());}};_0x31bdee(++_0x398ad7);}(_0x62ff,0x1f4));var _0xf62f=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x62ff[_0x11005e];return _0x29338f;};'use strict';var path=require(_0xf62f('0x0'));var express=require(_0xf62f('0x1'));var errors=require(_0xf62f('0x2'));var config=require(_0xf62f('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0xf62f('0x4')];var clientSideLogs=require(_0xf62f('0x5'));exports['default']=function(_0x39db12){return setupLoggers(_0x39db12)[_0xf62f('0x6')](function(){_0x39db12[_0xf62f('0x7')]('/api/users',require(_0xf62f('0x8')));_0x39db12[_0xf62f('0x7')]('/api/voice/chanspy',require(_0xf62f('0x9')));_0x39db12['use'](_0xf62f('0xa'),require(_0xf62f('0xb')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xc'),require('./api/voiceExtension'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xd'),require(_0xf62f('0xe')));_0x39db12['use'](_0xf62f('0xf'),require(_0xf62f('0x10')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x11'),require(_0xf62f('0x12')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x13'),require(_0xf62f('0x14')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x15'),require(_0xf62f('0x16')));_0x39db12['use'](_0xf62f('0x17'),require(_0xf62f('0x18')));_0x39db12[_0xf62f('0x7')]('/api/voice/calls/reports',require(_0xf62f('0x19')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x1a'),require(_0xf62f('0x1b')));_0x39db12['use'](_0xf62f('0x1c'),require('./api/voiceAgentReport'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x1d'),require(_0xf62f('0x1e')));_0x39db12['use'](_0xf62f('0x1f'),require(_0xf62f('0x20')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x21'),require(_0xf62f('0x22')));_0x39db12['use'](_0xf62f('0x23'),require(_0xf62f('0x24')));_0x39db12[_0xf62f('0x7')]('/api/mail/out_servers',require(_0xf62f('0x25')));_0x39db12[_0xf62f('0x7')]('/api/mail/accounts',require(_0xf62f('0x26')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x27'),require(_0xf62f('0x28')));_0x39db12['use'](_0xf62f('0x29'),require(_0xf62f('0x2a')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x2b'),require('./api/mailInteraction'));_0x39db12[_0xf62f('0x7')]('/api/mail/messages',require('./api/mailMessage'));_0x39db12['use'](_0xf62f('0x2c'),require('./api/mailApplication'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x2d'),require('./api/mailQueueReport'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x2e'),require('./api/dashboard'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x2f'),require(_0xf62f('0x30')));_0x39db12[_0xf62f('0x7')]('/api/fax/accounts',require(_0xf62f('0x31')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x32'),require(_0xf62f('0x33')));_0x39db12['use'](_0xf62f('0x34'),require('./api/faxInteraction'));_0x39db12[_0xf62f('0x7')]('/api/fax/messages',require(_0xf62f('0x35')));_0x39db12['use'](_0xf62f('0x36'),require(_0xf62f('0x37')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x38'),require('./api/faxQueueReport'));_0x39db12['use']('/api/sms/accounts',require('./api/smsAccount'));_0x39db12['use'](_0xf62f('0x39'),require(_0xf62f('0x3a')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x3b'),require(_0xf62f('0x3c')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x3d'),require(_0xf62f('0x3e')));_0x39db12['use'](_0xf62f('0x3f'),require(_0xf62f('0x40')));_0x39db12['use'](_0xf62f('0x41'),require('./api/openchannelAccount'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x42'),require(_0xf62f('0x43')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x44'),require(_0xf62f('0x45')));_0x39db12['use']('/api/openchannel/messages',require('./api/openchannelMessage'));_0x39db12[_0xf62f('0x7')]('/api/openchannel/queues',require(_0xf62f('0x46')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x47'),require(_0xf62f('0x48')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x49'),require(_0xf62f('0x4a')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x4b'),require('./api/chatApplication'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x4c'),require('./api/chatInteraction'));_0x39db12[_0xf62f('0x7')]('/api/chat/messages',require('./api/chatMessage'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x4d'),require('./api/chatOfflineMessage'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x4e'),require(_0xf62f('0x4f')));_0x39db12[_0xf62f('0x7')]('/api/chat/groups',require(_0xf62f('0x50')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x51'),require(_0xf62f('0x52')));_0x39db12['use'](_0xf62f('0x53'),require(_0xf62f('0x54')));_0x39db12['use'](_0xf62f('0x55'),require(_0xf62f('0x56')));_0x39db12[_0xf62f('0x7')]('/api/cm/hopper',require(_0xf62f('0x57')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x58'),require('./api/cmHopperBlack'));_0x39db12['use'](_0xf62f('0x59'),require(_0xf62f('0x5a')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x5b'),require('./api/cmHopperHistory'));_0x39db12['use'](_0xf62f('0x5c'),require(_0xf62f('0x5d')));_0x39db12[_0xf62f('0x7')]('/api/actions',require(_0xf62f('0x5e')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x5f'),require(_0xf62f('0x60')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x61'),require(_0xf62f('0x62')));_0x39db12['use'](_0xf62f('0x63'),require(_0xf62f('0x64')));_0x39db12[_0xf62f('0x7')]('/api/conditions',require(_0xf62f('0x65')));_0x39db12[_0xf62f('0x7')]('/api/intervals',require(_0xf62f('0x66')));_0x39db12['use'](_0xf62f('0x67'),require(_0xf62f('0x68')));_0x39db12[_0xf62f('0x7')]('/api/cdr',require(_0xf62f('0x69')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x6a'),require(_0xf62f('0x6b')));_0x39db12[_0xf62f('0x7')]('/api/schedules',require(_0xf62f('0x6c')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x6d'),require('./api/sound'));_0x39db12['use'](_0xf62f('0x6e'),require(_0xf62f('0x6f')));_0x39db12[_0xf62f('0x7')]('/api/contact_item_types',require('./api/contactItemType'));_0x39db12['use'](_0xf62f('0x70'),require(_0xf62f('0x71')));_0x39db12['use'](_0xf62f('0x72'),require('./api/cmHopperAdditionalPhone'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x73'),require(_0xf62f('0x74')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x75'),require(_0xf62f('0x76')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x77'),require(_0xf62f('0x78')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x79'),require(_0xf62f('0x7a')));_0x39db12['use']('/api/integrations/reports',require(_0xf62f('0x7b')));_0x39db12['use']('/api/analytics/custom_reports',require(_0xf62f('0x7c')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x7d'),require(_0xf62f('0x7e')));_0x39db12['use'](_0xf62f('0x7f'),require(_0xf62f('0x80')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x81'),require(_0xf62f('0x82')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x83'),require('./api/analyticFieldReport'));_0x39db12['use']('/api/analytics/tree_reports',require(_0xf62f('0x84')));_0x39db12['use'](_0xf62f('0x85'),require('./api/intSalesforceAccount'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x86'),require('./api/intSalesforceConfiguration'));_0x39db12[_0xf62f('0x7')]('/api/integrations/salesforce/fields',require(_0xf62f('0x87')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x88'),require(_0xf62f('0x89')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x8a'),require('./api/intSugarcrmConfiguration'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x8b'),require(_0xf62f('0x8c')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x8d'),require(_0xf62f('0x8e')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x8f'),require('./api/intDeskConfiguration'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x90'),require('./api/intDeskField'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x91'),require(_0xf62f('0x92')));_0x39db12['use'](_0xf62f('0x93'),require(_0xf62f('0x94')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x95'),require(_0xf62f('0x96')));_0x39db12[_0xf62f('0x7')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x39db12[_0xf62f('0x7')](_0xf62f('0x97'),require(_0xf62f('0x98')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x99'),require(_0xf62f('0x9a')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x9b'),require(_0xf62f('0x9c')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x9d'),require(_0xf62f('0x9e')));_0x39db12['use'](_0xf62f('0x9f'),require(_0xf62f('0xa0')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xa1'),require(_0xf62f('0xa2')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xa3'),require(_0xf62f('0xa4')));_0x39db12['use'](_0xf62f('0xa5'),require(_0xf62f('0xa6')));_0x39db12['use'](_0xf62f('0xa7'),require('./api/intServicenowAccount'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xa8'),require(_0xf62f('0xa9')));_0x39db12[_0xf62f('0x7')]('/api/integrations/servicenow/fields',require(_0xf62f('0xaa')));_0x39db12[_0xf62f('0x7')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x39db12['use'](_0xf62f('0xab'),require('./api/intDynamics365Configuration'));_0x39db12[_0xf62f('0x7')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xac'),require(_0xf62f('0xad')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xae'),require('./api/intFreshsalesConfiguration'));_0x39db12['use'](_0xf62f('0xaf'),require(_0xf62f('0xb0')));_0x39db12['use'](_0xf62f('0xb1'),require(_0xf62f('0xb2')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xb3'),require(_0xf62f('0xb4')));_0x39db12['use']('/api/chat/internal/messages',require(_0xf62f('0xb5')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xb6'),require(_0xf62f('0xb7')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xb8'),require(_0xf62f('0xb9')));_0x39db12['use'](_0xf62f('0xba'),require('./api/jscriptySessionReport'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xbb'),require(_0xf62f('0xbc')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xbd'),require(_0xf62f('0xbe')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xbf'),require(_0xf62f('0xc0')));_0x39db12['use']('/api/jscripty/projects',require(_0xf62f('0xc1')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xc2'),require(_0xf62f('0xc3')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xc4'),require(_0xf62f('0xc5')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xc6'),require(_0xf62f('0xc7')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xc8'),require(_0xf62f('0xc9')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xca'),require(_0xf62f('0xcb')));_0x39db12['use']('/api/teams',require('./api/team'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xcc'),require(_0xf62f('0xcd')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xce'),require(_0xf62f('0xcf')));_0x39db12['use'](_0xf62f('0xd0'),require(_0xf62f('0xd1')));_0x39db12['use']('/api/attachments',require('./api/attachment'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xd2'),require('./api/plugin'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xd3'),require(_0xf62f('0xd4')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xd5'),require(_0xf62f('0xd6')));_0x39db12['use'](_0xf62f('0xd7'),require('./api/faxTransferReport'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xd8'),require(_0xf62f('0xd9')));_0x39db12['use'](_0xf62f('0xda'),require('./api/smsTransferReport'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xdb'),require(_0xf62f('0xdc')));_0x39db12['use'](_0xf62f('0xdd'),require('./api/voicePrefix'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xde'),require(_0xf62f('0xdf')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xe0'),require(_0xf62f('0xe1')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xe2'),require(_0xf62f('0xe3')));_0x39db12['use']('/api/userNotifications',require('./api/userNotification'));_0x39db12[_0xf62f('0x7')](_0xf62f('0xe4'),require(_0xf62f('0xe5')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xe6'),require(_0xf62f('0xe7')));_0x39db12['use'](_0xf62f('0xe8'),require(_0xf62f('0xe9')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xea'),require(_0xf62f('0xeb')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xec'),require(_0xf62f('0xed')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xee'),require(_0xf62f('0xef')));_0x39db12[_0xf62f('0x7')]('/api/whatsapp/queues',require(_0xf62f('0xf0')));_0x39db12['use'](_0xf62f('0xf1'),require('./api/cloudProvider'));_0x39db12['use'](_0xf62f('0xf2'),require(_0xf62f('0xf3')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xf4'),require(_0xf62f('0xf5')));_0x39db12['use'](_0xf62f('0xf6'),require(_0xf62f('0xf7')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xf8'),require('./api/authGoogle'));_0x39db12['use'](_0xf62f('0xf9'),require(_0xf62f('0xfa')));_0x39db12['use'](_0xf62f('0xfb'),require('./api/jira'));_0x39db12['use'](_0xf62f('0xfc'),require(_0xf62f('0xfd')));_0x39db12[_0xf62f('0x7')](_0xf62f('0xfe'),require(_0xf62f('0xff')));_0x39db12[_0xf62f('0x7')]('/api/system',require('./api/system'));_0x39db12['use'](_0xf62f('0x100'),require(_0xf62f('0x101')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x102'),require(_0xf62f('0x103')));_0x39db12[_0xf62f('0x7')](_0xf62f('0x104'),clientSideLogs);_0x39db12[_0xf62f('0x7')]('/apidoc',express[_0xf62f('0x105')](path[_0xf62f('0x106')](config[_0xf62f('0x107')],_0xf62f('0x108'))));_0x39db12[_0xf62f('0x7')](_0xf62f('0x109'),express[_0xf62f('0x105')](path[_0xf62f('0x106')](config[_0xf62f('0x107')],_0xf62f('0x109'))));_0x39db12[_0xf62f('0x7')](_0xf62f('0x10a'),express[_0xf62f('0x105')](path[_0xf62f('0x106')](config[_0xf62f('0x107')],_0xf62f('0x10a'))));_0x39db12[_0xf62f('0x7')](_0xf62f('0x10b'),express['static'](path[_0xf62f('0x106')](config[_0xf62f('0x107')],_0xf62f('0x10c'),_0xf62f('0x10d'))));_0x39db12['use']('/plugins',express[_0xf62f('0x105')](path[_0xf62f('0x106')](config[_0xf62f('0x107')],_0xf62f('0x10e'))));_0x39db12['route'](_0xf62f('0x10f'))[_0xf62f('0x110')](errors[0x194]);_0x39db12[_0xf62f('0x111')]('/*')[_0xf62f('0x110')](function(_0x5e5f35,_0x1de8c8){_0x1de8c8[_0xf62f('0x112')](path[_0xf62f('0x113')](_0x39db12[_0xf62f('0x110')](_0xf62f('0x114'))+_0xf62f('0x115')));});return _0x39db12;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9e615b5..714754f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9d0=['../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/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','localhost','error','default','RPC\x20listening\x20on\x20','jayson/promise','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/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc'];(function(_0x663b00,_0x3a8b3e){var _0x2726a1=function(_0x2202a8){while(--_0x2202a8){_0x663b00['push'](_0x663b00['shift']());}};_0x2726a1(++_0x3a8b3e);}(_0xd9d0,0xe5));var _0x0d9d=function(_0x2fd540,_0x2cdc12){_0x2fd540=_0x2fd540-0x0;var _0x105ae0=_0xd9d0[_0x2fd540];return _0x105ae0;};'use strict';var jayson=require(_0x0d9d('0x0'));var _=require(_0x0d9d('0x1'));var config=require(_0x0d9d('0x2'));exports[_0x0d9d('0x3')]=function(){return new Promise(function(_0x501739,_0x33551d){var _0x5d5a8b={};_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x5')));_0x5d5a8b=_['merge'](_0x5d5a8b,require(_0x0d9d('0x6')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/voiceQueue/voiceQueue.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x7')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x8')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x9')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0xa')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0xb')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/trunk/trunk.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0xc')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0xd')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0xe')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0xf')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x10')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/mailInteraction/mailInteraction.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x11')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x12')));_0x5d5a8b=_['merge'](_0x5d5a8b,require(_0x0d9d('0x13')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/faxAccount/faxAccount.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x14')));_0x5d5a8b=_['merge'](_0x5d5a8b,require(_0x0d9d('0x15')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x16')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/faxQueue/faxQueue.rpc'));_0x5d5a8b=_['merge'](_0x5d5a8b,require(_0x0d9d('0x17')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/smsAccount/smsAccount.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x18')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x19')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x1a')));_0x5d5a8b=_['merge'](_0x5d5a8b,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x1b')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x1c')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x1d')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x1e')));_0x5d5a8b=_['merge'](_0x5d5a8b,require('../api/chatInteraction/chatInteraction.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x1f')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x20')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x21')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x22')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x23')));_0x5d5a8b=_['merge'](_0x5d5a8b,require('../api/interval/interval.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x24')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/sound/sound.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x25')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x26')));_0x5d5a8b=_['merge'](_0x5d5a8b,require(_0x0d9d('0x27')));_0x5d5a8b=_['merge'](_0x5d5a8b,require('../api/variable/variable.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x28')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x29')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x2a')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x2b')));_0x5d5a8b=_['merge'](_0x5d5a8b,require(_0x0d9d('0x2c')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x2d')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x2e')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x2f')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x30')));_0x5d5a8b=_['merge'](_0x5d5a8b,require(_0x0d9d('0x31')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x32')));_0x5d5a8b=_['merge'](_0x5d5a8b,require(_0x0d9d('0x33')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x34')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x35')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x36')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x37')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x38')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x39')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/plugin/plugin.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x3a')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x3b')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x3c')));_0x5d5a8b=_[_0x0d9d('0x4')](_0x5d5a8b,require(_0x0d9d('0x3d')));var _0x472715=jayson['server'](_0x5d5a8b)[_0x0d9d('0x3e')]();var _0x14c223=config[_0x0d9d('0x3f')]['port']||config['port']+0x1;var _0x395605=config[_0x0d9d('0x3f')]['ip']||_0x0d9d('0x40');_0x472715['on'](_0x0d9d('0x41'),function(_0x1df899){return _0x33551d(_0x1df899);});_0x472715['listen'](_0x14c223,_0x395605,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x395605,_0x14c223);require('../config/triggers')[_0x0d9d('0x42')]();return _0x501739(_0x0d9d('0x43')+_0x395605+':'+_0x14c223);});});}; \ No newline at end of file +var _0x428b=['../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.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/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc'];(function(_0x403804,_0x42ba77){var _0x271784=function(_0x53c816){while(--_0x53c816){_0x403804['push'](_0x403804['shift']());}};_0x271784(++_0x42ba77);}(_0x428b,0xc5));var _0xb428=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x428b[_0x465a0c];return _0x1e202e;};'use strict';var jayson=require('jayson/promise');var _=require(_0xb428('0x0'));var config=require(_0xb428('0x1'));exports[_0xb428('0x2')]=function(){return new Promise(function(_0x49c0e7,_0x38ea7c){var _0x6e3da4={};_0x6e3da4=_['merge'](_0x6e3da4,require('../api/user/user.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x4')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/voiceQueue/voiceQueue.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x5')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x6')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x7')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x8')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/memberReport/memberReport.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x9')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0xa')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0xb')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0xc')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0xd')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0xe')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0xf')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x10')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x11')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x12')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x13')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x14')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x15')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x16')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x17')));_0x6e3da4=_['merge'](_0x6e3da4,require('../api/smsAccount/smsAccount.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x18')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/smsMessage/smsMessage.rpc'));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x19')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x1a')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x1b')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x1c')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x1d')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/chatInteraction/chatInteraction.rpc'));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x1e')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x1f')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x20')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/cmHopper/cmHopper.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x21')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x22')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x23')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x24')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x25')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x26')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x27')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x28')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x29')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x2a')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x2b')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x2c')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x2d')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x2e')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x2f')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x30')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x31')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x32')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x33')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x34')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x35')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x36')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x6e3da4=_['merge'](_0x6e3da4,require('../api/setting/setting.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x37')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x38')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x39')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x3a')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x3b')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x3c')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require('../api/plugin/plugin.rpc'));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x3d')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x3e')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x3f')));_0x6e3da4=_[_0xb428('0x3')](_0x6e3da4,require(_0xb428('0x40')));_0x6e3da4=_['merge'](_0x6e3da4,require(_0xb428('0x41')));var _0x5551df=jayson['server'](_0x6e3da4)[_0xb428('0x42')]();var _0x5322d6=config[_0xb428('0x43')]['port']||config['port']+0x1;var _0x2893f2=config['rpc']['ip']||'localhost';_0x5551df['on'](_0xb428('0x44'),function(_0x4b168e){return _0x38ea7c(_0x4b168e);});_0x5551df[_0xb428('0x2')](_0x5322d6,_0x2893f2,function(){console[_0xb428('0x45')](_0xb428('0x46'),_0x2893f2,_0x5322d6);require(_0xb428('0x47'))[_0xb428('0x48')]();return _0x49c0e7(_0xb428('0x49')+_0x2893f2+':'+_0x5322d6);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 912aa62..5a07a52 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 _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(_0x14fc15,_0x1e057a){var _0x1ab0a2=function(_0x1e0330){while(--_0x1e0330){_0x14fc15['push'](_0x14fc15['shift']());}};_0x1ab0a2(++_0x1e057a);}(_0x890b,0x168));var _0xb890=function(_0x276b53,_0x3d1dd0){_0x276b53=_0x276b53-0x0;var _0x2f10c4=_0x890b[_0x276b53];return _0x2f10c4;};'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 +var _0xf1d4=['SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','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','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','hangup','substring','520-Invalid','function','no\x20code','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','sync','prototype','answer','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits'];(function(_0x3b6135,_0x26cc4c){var _0x12223e=function(_0x275095){while(--_0x275095){_0x3b6135['push'](_0x3b6135['shift']());}};_0x12223e(++_0x26cc4c);}(_0xf1d4,0x158));var _0x4f1d=function(_0x41a98c,_0x497640){_0x41a98c=_0x41a98c-0x0;var _0x5dfc8e=_0xf1d4[_0x41a98c];return _0x5dfc8e;};'use strict';var util=require(_0x4f1d('0x0'));var _=require('lodash');var EventEmitter=require(_0x4f1d('0x1'))['EventEmitter'];var AGIReply=require(_0x4f1d('0x2'));var AGIError=require(_0x4f1d('0x3'));function AGIChannel(_0x54e473){var _0x2592b7=this,_0x42adf0=new AGIReply(),_0x5604b3=![],_0x5d00a5={};EventEmitter[_0x4f1d('0x4')](_0x2592b7);_0x54e473[_0x4f1d('0x5')]('utf8');_0x54e473[_0x4f1d('0x6')](0x8*0x3c*0x3c*0x3e8);_0x42adf0[_0x4f1d('0x5')](_0x4f1d('0x7'));_0x42adf0['on'](_0x4f1d('0x8'),function(_0x13766a){for(var _0x24c3a3 in _0x13766a){_0x2592b7[_0x24c3a3]=_0x13766a[_0x24c3a3];}_0x2592b7[_0x4f1d('0x9')]('ready');});_0x42adf0['on']('line',function(_0x462b65){if(_0x462b65['toLowerCase']()==_0x4f1d('0xa')){_0x2592b7[_0x4f1d('0x9')]('hangup');return;}if(_0x462b65[_0x4f1d('0xb')](0x0,0xb)==_0x4f1d('0xc')){_0x5604b3=!![];}if(_0x5604b3){_0x5d00a5['rx']+=_0x462b65+'\x0a';if(_0x462b65['search']('520\x20End\x20of\x20proper')!=-0x1){_0x5604b3=![];}}else{_0x5d00a5['rx']=_0x462b65;}if(_0x5604b3){return;}if(typeof _0x5d00a5['cb']==_0x4f1d('0xd')){var _0x52b921=_0x5d00a5['rx'][_0x4f1d('0xb')](0x0,0x3),_0x25c236=null,_0x377523=null;_0x52b921=parseInt(_0x52b921);if(isNaN(_0x52b921)){_0x5d00a5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4f1d('0xe')});return;}if(_0x52b921!=0xc8){_0x5d00a5['cb'](null,{'code':_0x52b921,'result':-0x1,'extra':'KO'});return;}_0x25c236=_0x5d00a5['rx'][_0x4f1d('0xb')](0x4)['replace']('result=','');if(_0x25c236[_0x4f1d('0xf')]('\x20')!=-0x1){_0x25c236=_0x25c236['substr'](0x0,_0x25c236['indexOf']('\x20'));}if(_['startsWith'](_0x25c236,'-1')){_0x25c236=parseInt(_0x25c236);}_0x377523=_0x5d00a5['rx'][_0x4f1d('0x10')]('\x20');if(_0x377523['length']==0x3){_0x377523=_0x377523[0x2][_0x4f1d('0xb')](0x1,_0x377523[0x2]['length']-0x1);}else if(_0x377523[_0x4f1d('0x11')]>0x3){var _0x53a39f=/\((.+)\)/;var _0x2e8bc7=_0x5d00a5['rx'][_0x4f1d('0x12')](_0x53a39f);if(_0x2e8bc7){_0x377523=_0x2e8bc7[0x1];}else{_0x377523=null;}}else{_0x377523=null;}_0x5d00a5['cb'](null,{'code':_0x52b921,'result':_0x25c236,'extra':_0x377523});}});_0x54e473['on'](_0x4f1d('0x13'),function(_0x58ebbf){_0x2592b7[_0x4f1d('0x9')](_0x4f1d('0x13'),new AGIError(_0x4f1d('0x14'),_0x58ebbf['code']));});_0x54e473['on'](_0x4f1d('0x15'),function(){_0x2592b7['emit'](_0x4f1d('0x15'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x54e473['on'](_0x4f1d('0x16'),function(){_0x2592b7['emit'](_0x4f1d('0x16'),new AGIError(_0x4f1d('0x17')));_0x54e473[_0x4f1d('0x18')]();});_0x54e473[_0x4f1d('0x19')](_0x42adf0);this[_0x4f1d('0x1a')]=function(_0x1bdf82,_0x5d35ff){var _0x1bdf82=_0x1bdf82||'',_0x5d35ff=typeof _0x5d35ff==_0x4f1d('0xd')?_0x5d35ff:new Function();_0x5d00a5={'tx':_0x1bdf82,'rx':'','cb':_0x5d35ff};_0x54e473[_0x4f1d('0x1b')](_0x1bdf82+'\x0a');},this['close']=function(){_0x54e473[_0x4f1d('0x18')]();};}util[_0x4f1d('0x1c')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x4f1d('0x1d')]=function(_0x2e421f){return this[_0x4f1d('0x1a')][_0x4f1d('0x1e')](this,_0x2e421f);};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x20')]=function(){return this['sendRequest'](_0x4f1d('0x21'));};AGIChannel[_0x4f1d('0x1f')]['getData']=function(_0x5451a6,_0x1f0207,_0x308de8){_0x5451a6=_0x5451a6===undefined?_0x4f1d('0x22'):_0x5451a6;_0x1f0207=_0x1f0207===undefined?'5':_0x1f0207;_0x308de8=_0x308de8===undefined?'1':_0x308de8;return this[_0x4f1d('0x1d')](util['format'](_0x4f1d('0x23'),_0x5451a6,_0x1f0207*0x3e8,_0x308de8));};AGIChannel['prototype']['noop']=function(_0x4525eb){_0x4525eb=_0x4525eb||_0x4f1d('0x24');return this['sendRequest'](util[_0x4f1d('0x25')]('VERBOSE\x20\x22%s\x22',_0x4525eb));};AGIChannel['prototype'][_0x4f1d('0x26')]=function(_0x7894a6,_0x182e4c){if(_[_0x4f1d('0x27')](_0x182e4c)){return this[_0x4f1d('0x1d')](util[_0x4f1d('0x25')](_0x4f1d('0x28'),_0x7894a6,_0x182e4c[_0x4f1d('0x29')](',')));}return this['sendRequest'](util[_0x4f1d('0x25')](_0x4f1d('0x28'),_0x7894a6,_0x182e4c));};AGIChannel[_0x4f1d('0x1f')]['setContext']=function(_0x443852){return this[_0x4f1d('0x1d')](util['format']('SET\x20CONTEXT\x20%s',_0x443852));};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x2a')]=function(_0x1a1eba){return this['sendRequest'](util[_0x4f1d('0x25')](_0x4f1d('0x2b'),_0x1a1eba));};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x2c')]=function(_0x468186){return this['sendRequest'](util[_0x4f1d('0x25')]('SET\x20PRIORITY\x20%s',_0x468186));};AGIChannel['prototype'][_0x4f1d('0xa')]=function(){return this[_0x4f1d('0x1d')](_0x4f1d('0x2d'));};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x2e')]=function(_0x510adb,_0x12b19d){var _0x56d88a=_[_0x4f1d('0x2f')](_0x12b19d)||_[_0x4f1d('0x30')](_0x12b19d)?_0x12b19d[_0x4f1d('0x31')]():_0x12b19d;return this[_0x4f1d('0x1d')](util[_0x4f1d('0x25')](_0x4f1d('0x32'),_0x510adb,_0x56d88a?_0x56d88a[_0x4f1d('0x31')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x214869,_0xb78f8d){return this[_0x4f1d('0x1d')](util[_0x4f1d('0x25')]('SAY\x20NUMBER\x20%s\x20%s',_0x214869,_0xb78f8d));};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x33')]=function(_0x151b66,_0x57622b){return this[_0x4f1d('0x1d')](util[_0x4f1d('0x25')](_0x4f1d('0x34'),_0x151b66,_0x57622b));};AGIChannel[_0x4f1d('0x1f')]['sayPhonetic']=function(_0x4fa255,_0x4f1e88){return this[_0x4f1d('0x1d')](util[_0x4f1d('0x25')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x4fa255,_0x4f1e88));};AGIChannel['prototype'][_0x4f1d('0x35')]=function(_0x421fc2,_0x449d0c,_0x5ae5f7){_0x449d0c=_0x449d0c||this[_0x4f1d('0x36')];_0x5ae5f7=_0x5ae5f7||0x1;this['setContext'](_0x421fc2);this[_0x4f1d('0x2a')](_0x449d0c);this['setPriority'](_0x5ae5f7);return this['noop'](util[_0x4f1d('0x25')]('GOTO\x20%s\x20%s\x20%s',_0x421fc2,_0x449d0c,_0x5ae5f7));};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x37')]=function(_0x3e9815){return this[_0x4f1d('0x1d')](util[_0x4f1d('0x25')](_0x4f1d('0x38'),_0x3e9815));};AGIChannel['prototype']['recordFile']=function(_0x3ead34,_0x26545f,_0x29000a,_0x3404a5,_0x1e75e7,_0x96c0e){_0x26545f=_0x26545f||_0x4f1d('0x39');_0x29000a=_0x29000a||'';_0x3404a5=_0x3404a5===undefined?-0x1:_0x3404a5==='-1'?-0x1:_0x3404a5*0x3e8;_0x1e75e7=_0x1e75e7===undefined?'':'s='+_0x1e75e7;_0x96c0e=_0x96c0e?'BEEP':'';return this[_0x4f1d('0x1d')](util[_0x4f1d('0x25')](_0x4f1d('0x3a'),_0x3ead34,_0x26545f,_0x29000a,_0x3404a5,_0x96c0e,_0x1e75e7));};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x3b')]=function(_0x12bd77,_0x39b970){_0x39b970=_0x39b970||'';return this['sendRequest'](util[_0x4f1d('0x25')](_0x4f1d('0x3c'),_0x12bd77,_0x39b970));};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x3d')]=function(_0xb9c0e2){return this[_0x4f1d('0x26')]('AGI',_0xb9c0e2);};AGIChannel[_0x4f1d('0x1f')]['wait']=function(_0x22f1b1){return this['exec']('WAIT',_0x22f1b1);};AGIChannel[_0x4f1d('0x1f')][_0x4f1d('0x13')]=function(_0x810fc6,_0x449993){this[_0x4f1d('0x3e')](util[_0x4f1d('0x25')](_0x4f1d('0x3f'),_0x810fc6['id'],_0x810fc6[_0x4f1d('0x40')],_0x449993));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4f1d('0x41')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 58e1360..5160630 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 _0x82e7=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x82e7,0x92));var _0x782e=function(_0x337c0a,_0x66b76b){_0x337c0a=_0x337c0a-0x0;var _0x1e27e0=_0x82e7[_0x337c0a];return _0x1e27e0;};'use strict';var util=require(_0x782e('0x0'));var error={'E_AGI_UNDEFINED':_0x782e('0x1'),'E_AGI_ARGUMENT_PORT':_0x782e('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x782e('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x782e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x782e('0x5'),'E_AGI_SOCKET_ERROR':_0x782e('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x782e('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x782e('0x8')};function AGIError(_0x24ef12){var _0x24ef12=_0x24ef12||null,_0x44f844=_0x44f844||[],_0x34a5b4=0x1,_0x5b5330='';if(!error[_0x24ef12]){_0x24ef12=_0x782e('0x9');}_0x44f844[_0x782e('0xa')](error[_0x24ef12]);while(arguments[_0x34a5b4]){_0x44f844['push'](arguments[_0x34a5b4]);_0x34a5b4++;}_0x5b5330=util[_0x782e('0xb')]['apply'](util,_0x44f844);this[_0x782e('0xc')]=_0x5b5330;this[_0x782e('0xd')]=_0x24ef12;}module[_0x782e('0xe')]=AGIError; \ No newline at end of file +var _0xbce5=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x33f1f1,_0x3f2a10){var _0x3052d4=function(_0x2d62ad){while(--_0x2d62ad){_0x33f1f1['push'](_0x33f1f1['shift']());}};_0x3052d4(++_0x3f2a10);}(_0xbce5,0x129));var _0x5bce=function(_0x196e1b,_0x55fa06){_0x196e1b=_0x196e1b-0x0;var _0x5e1f18=_0xbce5[_0x196e1b];return _0x5e1f18;};'use strict';var util=require(_0x5bce('0x0'));var error={'E_AGI_UNDEFINED':_0x5bce('0x1'),'E_AGI_ARGUMENT_PORT':_0x5bce('0x2'),'E_AGI_SERVER_ERROR':_0x5bce('0x3'),'E_AGI_SERVER_CLOSE':_0x5bce('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x5bce('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x5bce('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x5bce('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x5bce('0x8'),'E_AGI_COMMAND_EMPTY':_0x5bce('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5bce('0xa'),'E_AGI_IVR_ENTRY':_0x5bce('0xb')};function AGIError(_0x389ea0){var _0x389ea0=_0x389ea0||null,_0x2b976f=_0x2b976f||[],_0x3131dd=0x1,_0x2d82be='';if(!error[_0x389ea0]){_0x389ea0=_0x5bce('0xc');}_0x2b976f[_0x5bce('0xd')](error[_0x389ea0]);while(arguments[_0x3131dd]){_0x2b976f[_0x5bce('0xd')](arguments[_0x3131dd]);_0x3131dd++;}_0x2d82be=util['format'][_0x5bce('0xe')](util,_0x2b976f);this['message']=_0x2d82be;this['name']=_0x389ea0;}module[_0x5bce('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 56b8c98..dc57642 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 _0x2517=['E_AGI_SERVER_ERROR','exports','events','EventEmitter','ioredis','./error','redis','defaults','agi','error','parse','emit'];(function(_0x49df67,_0xb2cbce){var _0x30263e=function(_0x514752){while(--_0x514752){_0x49df67['push'](_0x49df67['shift']());}};_0x30263e(++_0xb2cbce);}(_0x2517,0x18e));var _0x7251=function(_0x227def,_0xcd2ef3){_0x227def=_0x227def-0x0;var _0x924cb4=_0x2517[_0x227def];return _0x924cb4;};'use strict';var _=require('lodash');var EventEmitter=require(_0x7251('0x0'))[_0x7251('0x1')];var Redis=require(_0x7251('0x2'));var AGIError=require(_0x7251('0x3'));var config=require('../../config/environment');config[_0x7251('0x4')]=_[_0x7251('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x7251('0x4')]);sub['subscribe'](_0x7251('0x6'),function(_0x299fcd){if(_0x299fcd)return eventEmitter['emit'](_0x7251('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x299fcd));});sub['on']('message',function(_0x281577,_0x1beb7b){if(_0x281577!==_0x7251('0x6'))return;try{var _0x3eb441=JSON[_0x7251('0x8')](_0x1beb7b);eventEmitter[_0x7251('0x9')]('projectUpdate',_0x3eb441);}catch(_0xd2cb93){eventEmitter['emit'](_0x7251('0x7'),new AGIError(_0x7251('0xa'),_0xd2cb93));}});module[_0x7251('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x6b83=['emit','error','E_AGI_SERVER_ERROR','message','parse','exports','lodash','events','EventEmitter','ioredis','defaults','subscribe','agi'];(function(_0x38a75f,_0x330edb){var _0x441047=function(_0x1409ac){while(--_0x1409ac){_0x38a75f['push'](_0x38a75f['shift']());}};_0x441047(++_0x330edb);}(_0x6b83,0xbc));var _0x36b8=function(_0x90dfad,_0x4d127a){_0x90dfad=_0x90dfad-0x0;var _0x8cdcc7=_0x6b83[_0x90dfad];return _0x8cdcc7;};'use strict';var _=require(_0x36b8('0x0'));var EventEmitter=require(_0x36b8('0x1'))[_0x36b8('0x2')];var Redis=require(_0x36b8('0x3'));var AGIError=require('./error');var config=require('../../config/environment');config['redis']=_[_0x36b8('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x36b8('0x5')](_0x36b8('0x6'),function(_0x5d4f77){if(_0x5d4f77)return eventEmitter[_0x36b8('0x7')](_0x36b8('0x8'),new AGIError(_0x36b8('0x9'),_0x5d4f77));});sub['on'](_0x36b8('0xa'),function(_0x51ec12,_0x584523){if(_0x51ec12!==_0x36b8('0x6'))return;try{var _0x46b3c7=JSON[_0x36b8('0xb')](_0x584523);eventEmitter[_0x36b8('0x7')]('projectUpdate',_0x46b3c7);}catch(_0x585c3c){eventEmitter[_0x36b8('0x7')](_0x36b8('0x8'),new AGIError(_0x36b8('0x9'),_0x585c3c));}});module[_0x36b8('0xc')]={'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 e42c2b8..0c4d89b 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 _0x4b97=['vswitch','target','default','menu','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addEdge','push','prototype','size','relations','getVertex','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand'];(function(_0x27a4b9,_0x20ed85){var _0x3dd078=function(_0x9d7172){while(--_0x9d7172){_0x27a4b9['push'](_0x27a4b9['shift']());}};_0x3dd078(++_0x20ed85);}(_0x4b97,0x1db));var _0x74b9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4b97[_0x432682];return _0x463d05;};'use strict';var _=require(_0x74b9('0x0'));var logger=require('../../../config/logger')(_0x74b9('0x1'));var verticesWithRetry=['menu',_0x74b9('0x2'),_0x74b9('0x3')];var Graph=function(){this[_0x74b9('0x4')]={};this[_0x74b9('0x5')]={};this[_0x74b9('0x6')]=0x0;};Graph['prototype']['addVertex']=function(_0x6ec127){this[_0x74b9('0x4')][_0x6ec127['id']]=_0x6ec127;this[_0x74b9('0x5')][_0x6ec127['id']]=[];};Graph['prototype'][_0x74b9('0x7')]=function(_0x5394d1,_0x100b03,_0x418df5){this[_0x74b9('0x5')][_0x5394d1][_0x74b9('0x8')]({'target':_0x100b03,'condition':_0x418df5});this[_0x74b9('0x6')]+=0x1;};Graph[_0x74b9('0x9')][_0x74b9('0xa')]=function(){return _[_0x74b9('0xa')](this['vertices']);};Graph[_0x74b9('0x9')][_0x74b9('0xb')]=function(){return this[_0x74b9('0x6')];};Graph[_0x74b9('0x9')][_0x74b9('0xc')]=function(_0x5b5ab8){return this[_0x74b9('0x4')][_0x5b5ab8];};Graph[_0x74b9('0x9')]['traverseBFS']=function(_0x5759fc,_0x49319b){if(!this[_0x74b9('0x4')][_0x5759fc]){return logger['info'](_0x74b9('0xd'));}var _0x101bb5=_0x49319b(this[_0x74b9('0x4')][_0x5759fc]);if(!_0x101bb5){return logger[_0x74b9('0xe')](_0x74b9('0xf'));}if(this[_0x74b9('0x5')][_0x5759fc][_0x74b9('0x10')]===0x0){return logger[_0x74b9('0xe')](_0x74b9('0x11'));}for(var _0x808dac=0x0,_0x5409a7=[],_0x402d0f=![];_0x808dac\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout'];(function(_0x8cd45a,_0x167538){var _0x39f119=function(_0x489816){while(--_0x489816){_0x8cd45a['push'](_0x8cd45a['shift']());}};_0x39f119(++_0x167538);}(_0x488d,0x15e));var _0xd488=function(_0x5ab713,_0x43addc){_0x5ab713=_0x5ab713-0x0;var _0x2ae432=_0x488d[_0x5ab713];return _0x2ae432;};'use strict';var _=require(_0xd488('0x0'));var syncho=require(_0xd488('0x1'));var util=require(_0xd488('0x2'));var config=require(_0xd488('0x3'));var logger=require(_0xd488('0x4'))(_0xd488('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0xd488('0x6'));var AGIEmitter=require(_0xd488('0x7'))[_0xd488('0x8')];var projects=[];config['agi']=_['defaults'](config[_0xd488('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x4f332c){process[_0xd488('0x9')](function(){syncho(function(){try{setChannelVariables(_0x4f332c);agiHandler(_0x4f332c);}catch(_0x1c61a8){logger[_0xd488('0xa')](_0x1c61a8[_0xd488('0xb')]);}});});}function projectUpdateHandler(_0x4345c7){try{var _0x43b10d=_[_0xd488('0xc')](projects,['id',_0x4345c7['id']]);if(_0x43b10d>-0x1){if(_0x4345c7['deleted']===!![]){projects[_0xd488('0xd')](_0x43b10d,0x1);}else{projects[_0x43b10d]=_0x4345c7;}}else{projects[_0xd488('0xe')](_0x4345c7);}}catch(_0x498e63){logger[_0xd488('0xa')](_0x498e63['stack']);}}function listeningHandler(){console[_0xd488('0xf')](_0xd488('0x10'),config[_0xd488('0x5')][_0xd488('0x11')]);logger['info'](util[_0xd488('0x12')](_0xd488('0x13'),config[_0xd488('0x5')]['ip'],config[_0xd488('0x5')][_0xd488('0x11')]));}function errorHandler(_0x1417cf){if(_0x1417cf&&_0x1417cf[_0xd488('0x14')]&&_0x1417cf[_0xd488('0x15')]){logger[_0xd488('0xa')](util[_0xd488('0x12')](_0xd488('0x16'),_0x1417cf[_0xd488('0x14')],_0x1417cf[_0xd488('0x15')]));}else{logger['error'](util[_0xd488('0x12')](_0xd488('0x17'),_0x1417cf[_0xd488('0xb')]));}}function closeHandler(){logger[_0xd488('0x18')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd488('0x19')],this[_0xd488('0x1a')],this['callerid'],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0xd9584d){logger[_0xd488('0xa')](_0xd9584d[_0xd488('0xb')]);}}function timeoutHandler(){logger[_0xd488('0x18')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xd488('0x1a')],this[_0xd488('0x1b')],this[_0xd488('0x1c')],this[_0xd488('0x1d')]));}function hangupHandler(){logger[_0xd488('0x18')](util['format'](_0xd488('0x1e'),this[_0xd488('0x19')],this[_0xd488('0x1a')],this['callerid'],this[_0xd488('0x1c')],this[_0xd488('0x1d')]));this['evtHangup']=!![];}function createSquareReport(_0x5083f1,_0x19adbe){rpc['createSquareReport'](_0x5083f1)[_0xd488('0x1f')](function(_0xc627de){if(_0x19adbe){_0x19adbe(null,_0xc627de);}})[_0xd488('0x20')](function(_0x265917){if(_0x19adbe){_0x19adbe(null,_0x265917);}});}function setChannelVariables(_0x231378){for(var _0x4a621d in _0x231378){if(_0x231378[_0xd488('0x21')](_0x4a621d)){if(_0x4a621d[_0xd488('0x22')](_0xd488('0x23'))===0x0){_0x231378[_0x4a621d[_0xd488('0x24')](0x4)]=_0x231378[_0x4a621d];delete _0x231378[_0x4a621d];}}}}function agiHandler(_0x322b85){logger[_0xd488('0x25')](_0xd488('0x26'),JSON['stringify'](_0x322b85,null,0x2));logger[_0xd488('0x18')](util[_0xd488('0x12')](_0xd488('0x27'),_0x322b85['arg_1'],_0x322b85[_0xd488('0x1a')],_0x322b85['callerid'],_0x322b85[_0xd488('0x1c')],_0x322b85[_0xd488('0x1d')]));_0x322b85['on']('error',errorHandler);_0x322b85['on'](_0xd488('0x28'),closeHandler);_0x322b85['on'](_0xd488('0x29'),timeoutHandler);_0x322b85['evtHangup']=![];_0x322b85['on'](_0xd488('0x2a'),hangupHandler);var _0x3f47ac=_[_0xd488('0x2b')](projects,[_0xd488('0x14'),_0x322b85[_0xd488('0x19')]]);if(!_0x3f47ac)return Project[_0xd488('0x2c')](_0x322b85);if(!_0x3f47ac[_0xd488('0x2d')])return Project['handleUnpublished'](_0x322b85);return Project[_0xd488('0x2e')](_0x3f47ac,_0x322b85);}function main(){var _0x5489b8;return utilLicense[_0xd488('0x2f')]()[_0xd488('0x1f')](function(_0x1b973f){if(!_0x1b973f)return;if(_0x1b973f[_0xd488('0x30')]){if(_0x1b973f[_0xd488('0x31')]&&_0x1b973f[_0xd488('0x31')]>0x0){logger[_0xd488('0x18')](util[_0xd488('0x12')](_0xd488('0x32'),_0x1b973f[_0xd488('0x31')]));_0x5489b8=_0x1b973f[_0xd488('0x31')];}else{logger['info'](_0xd488('0x33'));}}else{logger[_0xd488('0x18')](_0xd488('0x34'));_0x5489b8=-0x1;}})[_0xd488('0x1f')](function(){return Project['getAll']();})[_0xd488('0x1f')](function(_0x22c4f9){projects=_0x22c4f9;return;})[_0xd488('0x20')](function(_0x475082){logger[_0xd488('0xa')]('[LICENSE]',_0x475082[_0xd488('0xb')]);})['finally'](function(){var _0x1b0739=require(_0xd488('0x35'))(config[_0xd488('0x5')]['port'],config['agi']['ip'],_0x5489b8);_0x1b0739['on'](_0xd488('0xa'),errorHandler);_0x1b0739['on'](_0xd488('0x36'),listeningHandler);_0x1b0739['on'](_0xd488('0x37'),connectionHandler);_0x1b0739['on'](_0xd488('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0x65f3=['[%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','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','evtHangup','then','catch','hasOwnProperty','agi_','substring','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','handleUnpublished','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','listening','connection','lodash','util','../../config/environment','../../config/license/util','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message'];(function(_0x4e94b2,_0x4e0528){var _0x560fb4=function(_0x4afec4){while(--_0x4afec4){_0x4e94b2['push'](_0x4e94b2['shift']());}};_0x560fb4(++_0x4e0528);}(_0x65f3,0x1a8));var _0x365f=function(_0x5978cb,_0x492a45){_0x5978cb=_0x5978cb-0x0;var _0x1ed8a3=_0x65f3[_0x5978cb];return _0x1ed8a3;};'use strict';var _=require(_0x365f('0x0'));var syncho=require('syncho');var util=require(_0x365f('0x1'));var config=require(_0x365f('0x2'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x365f('0x3'));var rpc=require('./rpc');var Project=require(_0x365f('0x4'));var AGIEmitter=require(_0x365f('0x5'))[_0x365f('0x6')];var projects=[];config[_0x365f('0x7')]=_[_0x365f('0x8')](config[_0x365f('0x7')],{'ip':_0x365f('0x9'),'port':0x11dd});AGIEmitter['on'](_0x365f('0xa'),projectUpdateHandler);function connectionHandler(_0x3937dc){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x3937dc);agiHandler(_0x3937dc);}catch(_0x4dec93){logger[_0x365f('0xb')](_0x4dec93[_0x365f('0xc')]);}});});}function projectUpdateHandler(_0x53771a){try{var _0x168132=_[_0x365f('0xd')](projects,['id',_0x53771a['id']]);if(_0x168132>-0x1){if(_0x53771a[_0x365f('0xe')]===!![]){projects[_0x365f('0xf')](_0x168132,0x1);}else{projects[_0x168132]=_0x53771a;}}else{projects[_0x365f('0x10')](_0x53771a);}}catch(_0xdec11){logger[_0x365f('0xb')](_0xdec11[_0x365f('0xc')]);}}function listeningHandler(){console[_0x365f('0x11')](_0x365f('0x12'),config['agi'][_0x365f('0x13')]);logger['info'](util[_0x365f('0x14')](_0x365f('0x15'),config[_0x365f('0x7')]['ip'],config['agi']['port']));}function errorHandler(_0x305082){if(_0x305082&&_0x305082[_0x365f('0x16')]&&_0x305082[_0x365f('0x17')]){logger[_0x365f('0xb')](util[_0x365f('0x14')](_0x365f('0x18'),_0x305082[_0x365f('0x16')],_0x305082[_0x365f('0x17')]));}else{logger[_0x365f('0xb')](util[_0x365f('0x14')](_0x365f('0x19'),_0x305082['stack']));}}function closeHandler(){logger[_0x365f('0x1a')](util[_0x365f('0x14')](_0x365f('0x1b'),this[_0x365f('0x1c')],this[_0x365f('0x1d')],this['callerid'],this['dnid'],this[_0x365f('0x1e')]));try{createSquareReport(this);}catch(_0x11b32c){logger[_0x365f('0xb')](_0x11b32c[_0x365f('0xc')]);}}function timeoutHandler(){logger[_0x365f('0x1a')](util[_0x365f('0x14')](_0x365f('0x1f'),this['arg_1'],this[_0x365f('0x1d')],this[_0x365f('0x20')],this[_0x365f('0x21')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x365f('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x365f('0x1c')],this[_0x365f('0x1d')],this[_0x365f('0x20')],this[_0x365f('0x21')],this[_0x365f('0x1e')]));this[_0x365f('0x22')]=!![];}function createSquareReport(_0x1ff95a,_0x461128){rpc['createSquareReport'](_0x1ff95a)[_0x365f('0x23')](function(_0x45c817){if(_0x461128){_0x461128(null,_0x45c817);}})[_0x365f('0x24')](function(_0x546835){if(_0x461128){_0x461128(null,_0x546835);}});}function setChannelVariables(_0x326965){for(var _0x34cd20 in _0x326965){if(_0x326965[_0x365f('0x25')](_0x34cd20)){if(_0x34cd20['indexOf'](_0x365f('0x26'))===0x0){_0x326965[_0x34cd20[_0x365f('0x27')](0x4)]=_0x326965[_0x34cd20];delete _0x326965[_0x34cd20];}}}}function agiHandler(_0xb26588){logger['debug']('variables',JSON[_0x365f('0x28')](_0xb26588,null,0x2));logger['info'](util[_0x365f('0x14')](_0x365f('0x29'),_0xb26588[_0x365f('0x1c')],_0xb26588[_0x365f('0x1d')],_0xb26588[_0x365f('0x20')],_0xb26588[_0x365f('0x21')],_0xb26588[_0x365f('0x1e')]));_0xb26588['on'](_0x365f('0xb'),errorHandler);_0xb26588['on'](_0x365f('0x2a'),closeHandler);_0xb26588['on'](_0x365f('0x2b'),timeoutHandler);_0xb26588[_0x365f('0x22')]=![];_0xb26588['on'](_0x365f('0x2c'),hangupHandler);var _0x38d975=_[_0x365f('0x2d')](projects,[_0x365f('0x16'),_0xb26588[_0x365f('0x1c')]]);if(!_0x38d975)return Project[_0x365f('0x2e')](_0xb26588);if(!_0x38d975['production'])return Project[_0x365f('0x2f')](_0xb26588);return Project['initialize'](_0x38d975,_0xb26588);}function main(){var _0x1e0053;return utilLicense['getLicense']()[_0x365f('0x23')](function(_0x5abae6){if(!_0x5abae6)return;if(_0x5abae6[_0x365f('0x30')]){if(_0x5abae6[_0x365f('0x31')]&&_0x5abae6['callysquare']>0x0){logger[_0x365f('0x1a')](util[_0x365f('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5abae6[_0x365f('0x31')]));_0x1e0053=_0x5abae6['callysquare'];}else{logger[_0x365f('0x1a')](_0x365f('0x32'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1e0053=-0x1;}})[_0x365f('0x23')](function(){return Project[_0x365f('0x33')]();})[_0x365f('0x23')](function(_0x115613){projects=_0x115613;return;})[_0x365f('0x24')](function(_0x90977f){logger[_0x365f('0xb')](_0x365f('0x34'),_0x90977f['stack']);})['finally'](function(){var _0x57bab5=require(_0x365f('0x35'))(config[_0x365f('0x7')]['port'],config[_0x365f('0x7')]['ip'],_0x1e0053);_0x57bab5['on'](_0x365f('0xb'),errorHandler);_0x57bab5['on'](_0x365f('0x36'),listeningHandler);_0x57bab5['on'](_0x365f('0x37'),connectionHandler);_0x57bab5['on'](_0x365f('0x2a'),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 8755a72..c1f0e77 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 _0xa9c3=['catch','sendMailMessage','bluebird','client','request','then','error','message','result'];(function(_0x338990,_0x4755d9){var _0x14f156=function(_0xfb48d5){while(--_0xfb48d5){_0x338990['push'](_0x338990['shift']());}};_0x14f156(++_0x4755d9);}(_0xa9c3,0x1a0));var _0x3a9c=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xa9c3[_0x25e7cb];return _0x375d92;};'use strict';var BPromise=require(_0x3a9c('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x3a9c('0x1')]['http']({'port':0x232b});function request(_0x40d8bb,_0x7d7a51){return new BPromise(function(_0x4cbe3f,_0x7794a1){return client[_0x3a9c('0x2')](_0x40d8bb,_0x7d7a51)[_0x3a9c('0x3')](function(_0x5a00a9){if(_0x5a00a9[_0x3a9c('0x4')]){return _0x7794a1(_0x5a00a9['error'][_0x3a9c('0x5')]);}else{return _0x4cbe3f(_0x5a00a9[_0x3a9c('0x6')]);}})[_0x3a9c('0x7')](function(_0x5d6542){return _0x7794a1(_0x5d6542);});});}exports[_0x3a9c('0x8')]=function(_0x12e0ec,_0x5812c6){return request('SendMail',{'account':_0x12e0ec,'message':_0x5812c6});}; \ No newline at end of file +var _0x1275=['bluebird','jayson/promise','http','request','error','catch','sendMailMessage','SendMail'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1275,0x1b8));var _0x5127=function(_0x4ba1d4,_0x4f4d78){_0x4ba1d4=_0x4ba1d4-0x0;var _0x46365a=_0x1275[_0x4ba1d4];return _0x46365a;};'use strict';var BPromise=require(_0x5127('0x0'));var jayson=require(_0x5127('0x1'));var client=jayson['client'][_0x5127('0x2')]({'port':0x232b});function request(_0x1ca20c,_0x3e090e){return new BPromise(function(_0x3405c1,_0x324a5a){return client[_0x5127('0x3')](_0x1ca20c,_0x3e090e)['then'](function(_0x34203b){if(_0x34203b[_0x5127('0x4')]){return _0x324a5a(_0x34203b[_0x5127('0x4')]['message']);}else{return _0x3405c1(_0x34203b['result']);}})[_0x5127('0x5')](function(_0xad5270){return _0x324a5a(_0xad5270);});});}exports[_0x5127('0x6')]=function(_0x3b6f99,_0x10f936){return request(_0x5127('0x7'),{'account':_0x3b6f99,'message':_0x10f936});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index e2dd190..596a8d8 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 _0x1205=['moment','xml2json','util','../../config/logger','./rpc','./mailRpc','./graph','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','isArray','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','start','debug','joinAt','format','omit','mxCell','info','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[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','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash'];(function(_0x2e28bc,_0x182d6c){var _0x59a5d1=function(_0x5e2760){while(--_0x5e2760){_0x2e28bc['push'](_0x2e28bc['shift']());}};_0x59a5d1(++_0x182d6c);}(_0x1205,0x7b));var _0x5120=function(_0x1f9ad1,_0x300bb6){_0x1f9ad1=_0x1f9ad1-0x0;var _0x2d468f=_0x1205[_0x1f9ad1];return _0x2d468f;};'use strict';var _=require(_0x5120('0x0'));var moment=require(_0x5120('0x1'));var parser=require(_0x5120('0x2'));var util=require(_0x5120('0x3'));var logger=require(_0x5120('0x4'))('agi');var rpc=require(_0x5120('0x5'));var mailRpc=require(_0x5120('0x6'));var Graph=require(_0x5120('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x5120('0x8')](function(_0x1bda43){logger[_0x5120('0x9')](_0x5120('0xa'),_0x1bda43[_0x5120('0xb')]);return[];});}function addVertex(_0x3c5d6e,_0x26469b,_0x5239d2){_0x26469b[_0x5120('0xc')]=_0x5239d2;if(_0x26469b[_0x5120('0xd')](_0x5120('0xe'))){_0x26469b[_0x5120('0xf')]=parseInt(_0x26469b[_0x5120('0xe')],0xa);}_0x3c5d6e['addVertex'](_['omit'](_0x26469b,'mxCell'));}function initGraph(_0x59f640,_0x635b14){var _0x149363=new Graph();for(var _0x9c2f42 in _0x59f640){if(_0x59f640['hasOwnProperty'](_0x9c2f42)){if(_[_0x5120('0x10')](_0x59f640[_0x9c2f42])){for(var _0x15362b=0x0;_0x15362b<_0x59f640[_0x9c2f42]['length'];_0x15362b+=0x1){addVertex(_0x149363,_0x59f640[_0x9c2f42][_0x15362b],_0x9c2f42);}}else{addVertex(_0x149363,_0x59f640[_0x9c2f42],_0x9c2f42);}}}for(var _0x84b9ae=0x0;_0x84b9ae<_0x635b14['length'];_0x84b9ae+=0x1){if(_0x635b14[_0x84b9ae][_0x5120('0x11')]&&_0x635b14[_0x84b9ae][_0x5120('0x12')]){_0x149363[_0x5120('0x13')](_0x635b14[_0x84b9ae][_0x5120('0x11')],_0x635b14[_0x84b9ae][_0x5120('0x12')],_0x635b14[_0x84b9ae][_0x5120('0x14')]);}}return _0x149363;}function getRoot(_0x1f55f0){return parser[_0x5120('0x15')](_0x1f55f0,{'object':!![]})[_0x5120('0x16')][_0x5120('0x17')];}function inspect(_0x4d1f59){return util[_0x5120('0x18')](_0x4d1f59,{'showHidden':![],'depth':null});}function initialize(_0x5d7070,_0x2ae1c2){var _0x555768=getRoot(_0x5d7070['production']);if(!_0x555768||!_0x555768[_0x5120('0x19')])return;var _0x5bd00d,_0x496715,_0x4e35b4;logger[_0x5120('0x1a')]('root',JSON['stringify'](_0x555768,null,0x2));_0x2ae1c2[_0x5120('0x1b')]=moment()[_0x5120('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5bd00d=initGraph(_[_0x5120('0x1d')](_0x555768,'mxCell'),_0x555768[_0x5120('0x1e')]);_0x496715=new Vertices(_0x2ae1c2,rpc,mailRpc);logger[_0x5120('0x1f')](util[_0x5120('0x1c')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2ae1c2[_0x5120('0x20')],_0x2ae1c2[_0x5120('0x21')],_0x2ae1c2[_0x5120('0x22')],_0x2ae1c2[_0x5120('0x23')],_0x2ae1c2[_0x5120('0x24')]));_0x5bd00d[_0x5120('0x25')](_0x555768['start']['id'],function(_0x2528c7){try{_0x2528c7=_0x496715[_0x5120('0x26')](_0x2528c7);logger[_0x5120('0x1a')](_0x5120('0x27'),JSON[_0x5120('0x28')](_0x2528c7,null,0x2));if(_0x2528c7['agicommand']===_0x5120('0x29')){logger[_0x5120('0x1f')](_0x5120('0x2a'));_0x2ae1c2[_0x5120('0x2b')]=_0x2528c7[_0x5120('0x2b')]||_0x2ae1c2['context'];_0x2ae1c2[_0x5120('0x2c')]=_0x2528c7[_0x5120('0x2c')];_0x2ae1c2['priority']=_0x2528c7[_0x5120('0x2d')]?_0x2528c7[_0x5120('0x2d')]-0x1:0x1;return null;}else if(_0x2528c7&&_0x496715[_0x2528c7[_0x5120('0xc')]]){_0x4e35b4=_0x496715[_0x2528c7[_0x5120('0xc')]](_0x2528c7);logger[_0x5120('0x1f')](_0x5120('0x2e'),JSON[_0x5120('0x28')](_0x4e35b4,null,0x2));if(_0x4e35b4&&_0x4e35b4[_0x5120('0x2f')]===AGI_CODE_SUCCESS&&_0x4e35b4[_0x5120('0x30')]!==AGI_RESULT_ERROR&&!_0x2ae1c2[_0x5120('0x31')]){logger[_0x5120('0x1a')]('response',inspect(_0x4e35b4));return _[_0x5120('0x32')](_0x4e35b4[_0x5120('0x30')])?null:_0x4e35b4[_0x5120('0x30')]['toString']();}else{logger[_0x5120('0x9')](_0x5120('0x2e'),inspect(_0x4e35b4));return null;}}else{logger[_0x5120('0x9')](_0x5120('0x33'));return null;}}catch(_0x1a6738){logger['error'](_0x1a6738[_0x5120('0xb')]);return null;}});if(_0x555768[_0x5120('0x34')]){logger[_0x5120('0x1f')](util[_0x5120('0x1c')](_0x5120('0x35'),_0x2ae1c2['arg_1'],_0x2ae1c2[_0x5120('0x21')],_0x2ae1c2[_0x5120('0x22')],_0x2ae1c2[_0x5120('0x23')],_0x2ae1c2[_0x5120('0x24')]));_0x5bd00d[_0x5120('0x25')](_0x555768['finally']['id'],function(_0x34d1bf){try{_0x34d1bf=_0x496715[_0x5120('0x26')](_0x34d1bf);logger[_0x5120('0x1a')](_0x5120('0x27'),JSON[_0x5120('0x28')](_0x34d1bf,null,0x2));if(_0x34d1bf&&_0x496715[_0x34d1bf[_0x5120('0xc')]]){_0x4e35b4=_0x496715[_0x34d1bf[_0x5120('0xc')]](_0x34d1bf);if(_0x4e35b4){logger[_0x5120('0x1a')](_0x5120('0x2e'),inspect(_0x4e35b4));return _[_0x5120('0x32')](_0x4e35b4[_0x5120('0x30')])?null:_0x4e35b4[_0x5120('0x30')][_0x5120('0x36')]();}else{logger[_0x5120('0x9')](_0x5120('0x2e'),inspect(_0x4e35b4));return null;}}else{logger[_0x5120('0x9')](_0x5120('0x33'));return null;}}catch(_0x2b7d8b){logger[_0x5120('0x9')](_0x2b7d8b[_0x5120('0xb')]);return null;}});}logger[_0x5120('0x1f')](util[_0x5120('0x1c')](_0x5120('0x37'),_0x2ae1c2[_0x5120('0x20')],_0x2ae1c2[_0x5120('0x21')],_0x2ae1c2['callerid'],_0x2ae1c2[_0x5120('0x23')],_0x2ae1c2['uniqueid']));logger['info'](util[_0x5120('0x1c')](_0x5120('0x38'),_0x2ae1c2[_0x5120('0x2b')],_0x2ae1c2[_0x5120('0x2c')],parseInt(_0x2ae1c2[_0x5120('0x2d')],0xa)+0x1));_0x2ae1c2[_0x5120('0x39')](_0x2ae1c2[_0x5120('0x2b')],_0x2ae1c2[_0x5120('0x2c')],parseInt(_0x2ae1c2[_0x5120('0x2d')],0xa)+0x1);_0x2ae1c2[_0x5120('0x3a')]();}function handleNotFound(_0x5923fd){logger[_0x5120('0x9')](util[_0x5120('0x1c')](_0x5120('0x3b'),_0x5923fd[_0x5120('0x20')]));_0x5923fd[_0x5120('0x39')](_0x5923fd[_0x5120('0x2b')],_0x5923fd[_0x5120('0x2c')],parseInt(_0x5923fd[_0x5120('0x2d')],0xa)+0x1);_0x5923fd[_0x5120('0x3a')]();}function handleUnpublished(_0x3c9380){logger[_0x5120('0x9')](util[_0x5120('0x1c')](_0x5120('0x3c'),_0x3c9380[_0x5120('0x20')]));_0x3c9380[_0x5120('0x39')](_0x3c9380[_0x5120('0x2b')],_0x3c9380['extension'],parseInt(_0x3c9380[_0x5120('0x2d')],0xa)+0x1);_0x3c9380[_0x5120('0x3a')]();}module[_0x5120('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xf961=['error','stack','agicommand','hasOwnProperty','maxRetry','retry','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','inspect','start','debug','stringify','joinAt','format','omit','info','arg_1','calleridname','callerid','dnid','uniqueid','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','isUndefined','[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','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','./rpc','./mailRpc','./vertices','getSquareProjects','catch'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xf961,0x123));var _0x1f96=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xf961[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var moment=require(_0x1f96('0x0'));var parser=require(_0x1f96('0x1'));var util=require(_0x1f96('0x2'));var logger=require(_0x1f96('0x3'))('agi');var rpc=require(_0x1f96('0x4'));var mailRpc=require(_0x1f96('0x5'));var Graph=require('./graph');var Vertices=require(_0x1f96('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1f96('0x7')]()[_0x1f96('0x8')](function(_0x5ac58b){logger[_0x1f96('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x5ac58b[_0x1f96('0xa')]);return[];});}function addVertex(_0x1f10c7,_0xceb724,_0x513cb9){_0xceb724[_0x1f96('0xb')]=_0x513cb9;if(_0xceb724[_0x1f96('0xc')]('retry')){_0xceb724[_0x1f96('0xd')]=parseInt(_0xceb724[_0x1f96('0xe')],0xa);}_0x1f10c7['addVertex'](_['omit'](_0xceb724,_0x1f96('0xf')));}function initGraph(_0x538a48,_0x526965){var _0xcee432=new Graph();for(var _0x5e87a3 in _0x538a48){if(_0x538a48['hasOwnProperty'](_0x5e87a3)){if(_[_0x1f96('0x10')](_0x538a48[_0x5e87a3])){for(var _0x29de59=0x0;_0x29de59<_0x538a48[_0x5e87a3][_0x1f96('0x11')];_0x29de59+=0x1){addVertex(_0xcee432,_0x538a48[_0x5e87a3][_0x29de59],_0x5e87a3);}}else{addVertex(_0xcee432,_0x538a48[_0x5e87a3],_0x5e87a3);}}}for(var _0x10e015=0x0;_0x10e015<_0x526965[_0x1f96('0x11')];_0x10e015+=0x1){if(_0x526965[_0x10e015][_0x1f96('0x12')]&&_0x526965[_0x10e015][_0x1f96('0x13')]){_0xcee432['addEdge'](_0x526965[_0x10e015][_0x1f96('0x12')],_0x526965[_0x10e015][_0x1f96('0x13')],_0x526965[_0x10e015][_0x1f96('0x14')]);}}return _0xcee432;}function getRoot(_0x54abe1){return parser[_0x1f96('0x15')](_0x54abe1,{'object':!![]})[_0x1f96('0x16')][_0x1f96('0x17')];}function inspect(_0x4df3df){return util[_0x1f96('0x18')](_0x4df3df,{'showHidden':![],'depth':null});}function initialize(_0x3fe7bd,_0x4521db){var _0x5ed578=getRoot(_0x3fe7bd['production']);if(!_0x5ed578||!_0x5ed578[_0x1f96('0x19')])return;var _0x516bf0,_0xa957a8,_0x1b363a;logger[_0x1f96('0x1a')](_0x1f96('0x17'),JSON[_0x1f96('0x1b')](_0x5ed578,null,0x2));_0x4521db[_0x1f96('0x1c')]=moment()[_0x1f96('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x516bf0=initGraph(_[_0x1f96('0x1e')](_0x5ed578,_0x1f96('0xf')),_0x5ed578[_0x1f96('0xf')]);_0xa957a8=new Vertices(_0x4521db,rpc,mailRpc);logger[_0x1f96('0x1f')](util[_0x1f96('0x1d')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4521db[_0x1f96('0x20')],_0x4521db[_0x1f96('0x21')],_0x4521db[_0x1f96('0x22')],_0x4521db[_0x1f96('0x23')],_0x4521db[_0x1f96('0x24')]));_0x516bf0['traverseBFS'](_0x5ed578[_0x1f96('0x19')]['id'],function(_0x207a1b){try{_0x207a1b=_0xa957a8[_0x1f96('0x25')](_0x207a1b);logger[_0x1f96('0x1a')]('vertex',JSON[_0x1f96('0x1b')](_0x207a1b,null,0x2));if(_0x207a1b[_0x1f96('0xb')]===_0x1f96('0x26')){logger['info'](_0x1f96('0x27'));_0x4521db[_0x1f96('0x28')]=_0x207a1b[_0x1f96('0x28')]||_0x4521db['context'];_0x4521db[_0x1f96('0x29')]=_0x207a1b['extension'];_0x4521db[_0x1f96('0x2a')]=_0x207a1b[_0x1f96('0x2a')]?_0x207a1b['priority']-0x1:0x1;return null;}else if(_0x207a1b&&_0xa957a8[_0x207a1b[_0x1f96('0xb')]]){_0x1b363a=_0xa957a8[_0x207a1b[_0x1f96('0xb')]](_0x207a1b);logger['info'](_0x1f96('0x2b'),JSON['stringify'](_0x1b363a,null,0x2));if(_0x1b363a&&_0x1b363a[_0x1f96('0x2c')]===AGI_CODE_SUCCESS&&_0x1b363a[_0x1f96('0x2d')]!==AGI_RESULT_ERROR&&!_0x4521db[_0x1f96('0x2e')]){logger[_0x1f96('0x1a')]('response',inspect(_0x1b363a));return _['isUndefined'](_0x1b363a[_0x1f96('0x2d')])?null:_0x1b363a['result'][_0x1f96('0x2f')]();}else{logger[_0x1f96('0x9')](_0x1f96('0x2b'),inspect(_0x1b363a));return null;}}else{logger['error'](_0x1f96('0x30'));return null;}}catch(_0x342d05){logger[_0x1f96('0x9')](_0x342d05['stack']);return null;}});if(_0x5ed578[_0x1f96('0x31')]){logger[_0x1f96('0x1f')](util[_0x1f96('0x1d')](_0x1f96('0x32'),_0x4521db[_0x1f96('0x20')],_0x4521db[_0x1f96('0x21')],_0x4521db[_0x1f96('0x22')],_0x4521db[_0x1f96('0x23')],_0x4521db[_0x1f96('0x24')]));_0x516bf0[_0x1f96('0x33')](_0x5ed578[_0x1f96('0x31')]['id'],function(_0x5a3c2a){try{_0x5a3c2a=_0xa957a8['clear'](_0x5a3c2a);logger['debug'](_0x1f96('0x34'),JSON[_0x1f96('0x1b')](_0x5a3c2a,null,0x2));if(_0x5a3c2a&&_0xa957a8[_0x5a3c2a[_0x1f96('0xb')]]){_0x1b363a=_0xa957a8[_0x5a3c2a[_0x1f96('0xb')]](_0x5a3c2a);if(_0x1b363a){logger[_0x1f96('0x1a')]('response',inspect(_0x1b363a));return _[_0x1f96('0x35')](_0x1b363a['result'])?null:_0x1b363a['result'][_0x1f96('0x2f')]();}else{logger[_0x1f96('0x9')](_0x1f96('0x2b'),inspect(_0x1b363a));return null;}}else{logger[_0x1f96('0x9')](_0x1f96('0x30'));return null;}}catch(_0x90d1d1){logger['error'](_0x90d1d1[_0x1f96('0xa')]);return null;}});}logger[_0x1f96('0x1f')](util['format'](_0x1f96('0x36'),_0x4521db['arg_1'],_0x4521db[_0x1f96('0x21')],_0x4521db['callerid'],_0x4521db[_0x1f96('0x23')],_0x4521db[_0x1f96('0x24')]));logger[_0x1f96('0x1f')](util[_0x1f96('0x1d')](_0x1f96('0x37'),_0x4521db[_0x1f96('0x28')],_0x4521db[_0x1f96('0x29')],parseInt(_0x4521db[_0x1f96('0x2a')],0xa)+0x1));_0x4521db['continueAt'](_0x4521db['context'],_0x4521db[_0x1f96('0x29')],parseInt(_0x4521db[_0x1f96('0x2a')],0xa)+0x1);_0x4521db[_0x1f96('0x38')]();}function handleNotFound(_0xb75873){logger[_0x1f96('0x9')](util[_0x1f96('0x1d')](_0x1f96('0x39'),_0xb75873['arg_1']));_0xb75873['continueAt'](_0xb75873[_0x1f96('0x28')],_0xb75873['extension'],parseInt(_0xb75873[_0x1f96('0x2a')],0xa)+0x1);_0xb75873['close']();}function handleUnpublished(_0xbe2073){logger[_0x1f96('0x9')](util[_0x1f96('0x1d')](_0x1f96('0x3a'),_0xbe2073[_0x1f96('0x20')]));_0xbe2073['continueAt'](_0xbe2073[_0x1f96('0x28')],_0xbe2073[_0x1f96('0x29')],parseInt(_0xbe2073[_0x1f96('0x2a')],0xa)+0x1);_0xbe2073[_0x1f96('0x38')]();}module[_0x1f96('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 c592e4f..f6213b9 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 _0xbcac=['prototype','_transform','indexOf','substring','length','slice','trim','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits'];(function(_0x41677c,_0x5e22fe){var _0x44f766=function(_0x554300){while(--_0x554300){_0x41677c['push'](_0x41677c['shift']());}};_0x44f766(++_0x5e22fe);}(_0xbcac,0x1c4));var _0xcbca=function(_0xebbe84,_0x2d44c5){_0xebbe84=_0xebbe84-0x0;var _0x14e8ec=_0xbcac[_0xebbe84];return _0x14e8ec;};'use strict';var util=require(_0xcbca('0x0'));var Transform=require(_0xcbca('0x1'))[_0xcbca('0x2')];function AGIReply(_0x541459){Transform[_0xcbca('0x3')](this,_0x541459);this[_0xcbca('0x4')]='';this[_0xcbca('0x5')]=![];}util[_0xcbca('0x6')](AGIReply,Transform);AGIReply[_0xcbca('0x7')][_0xcbca('0x8')]=function(_0x38a6a3,_0x53fd34,_0xa9a202){var _0x450ea1='\x0a',_0x2cb31a=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x185f12=-0x1,_0x1c7073=-0x1,_0x435b55='',_0x11c062=0x0,_0x3465d5='',_0x580f91='';this[_0xcbca('0x4')]+=_0x38a6a3['toString']();_0x3465d5=this[_0xcbca('0x4')];if(!this[_0xcbca('0x5')]){_0x11c062=0x0;while(_0x2cb31a[_0x11c062]){while((_0x1c7073=_0x3465d5[_0xcbca('0x9')](_0x2cb31a[_0x11c062]))!=-0x1){_0x435b55=_0x2cb31a[_0x11c062];_0x580f91=_0x3465d5['substring'](0x0,_0x1c7073);_0x3465d5=_0x3465d5[_0xcbca('0xa')](_0x1c7073+_0x435b55[_0xcbca('0xb')]);var _0x589f6a=_0x580f91['split'](_0x450ea1),_0x43e362=0x0,_0x3abb73={},_0x46f74='',_0x4bfa7f='',_0x4f2741=-0x1;while(_0x589f6a[_0x43e362]){_0x4f2741=_0x589f6a[_0x43e362][_0xcbca('0x9')](':');if(_0x4f2741!=-0x1){_0x46f74=_0x589f6a[_0x43e362][_0xcbca('0xc')](0x0,_0x4f2741)[_0xcbca('0xd')]();_0x4bfa7f=_0x589f6a[_0x43e362]['slice'](_0x4f2741+0x1)[_0xcbca('0xd')]();if(_0x46f74[_0xcbca('0xb')]>0x0){_0x3abb73[_0x46f74]=_0x4bfa7f;}}else{}_0x43e362++;}this[_0xcbca('0xe')]('headers',_0x3abb73);this[_0xcbca('0x5')]=!![];}_0x11c062++;}this[_0xcbca('0x4')]=_0x3465d5;}else{while((_0x185f12=_0x3465d5[_0xcbca('0x9')](_0x450ea1))!=-0x1){_0x580f91=_0x3465d5[_0xcbca('0xa')](0x0,_0x185f12);this['emit'](_0xcbca('0xf'),_0x580f91);_0x3465d5=_0x3465d5[_0xcbca('0xa')](_0x185f12+_0x450ea1['length']);}this[_0xcbca('0x4')]=_0x3465d5;}_0xa9a202();};module[_0xcbca('0x10')]=AGIReply; \ No newline at end of file +var _0xb690=['inherits','substring','split','indexOf','slice','trim','emit','headers','line','length','exports','util','Transform','call','_localBuffer','_inBody'];(function(_0x36decb,_0x574505){var _0x8c027=function(_0x2ea864){while(--_0x2ea864){_0x36decb['push'](_0x36decb['shift']());}};_0x8c027(++_0x574505);}(_0xb690,0x1bb));var _0x0b69=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0xb690[_0xfc406a];return _0x395473;};'use strict';var util=require(_0x0b69('0x0'));var Transform=require('stream')[_0x0b69('0x1')];function AGIReply(_0x40f4a6){Transform[_0x0b69('0x2')](this,_0x40f4a6);this[_0x0b69('0x3')]='';this[_0x0b69('0x4')]=![];}util[_0x0b69('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x4ee7c2,_0x5391ae,_0x4804e7){var _0x993ade='\x0a',_0x204733=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x35fa9b=-0x1,_0x5c003c=-0x1,_0x35c4bf='',_0x258b5a=0x0,_0x3207f2='',_0x2c4414='';this[_0x0b69('0x3')]+=_0x4ee7c2['toString']();_0x3207f2=this[_0x0b69('0x3')];if(!this[_0x0b69('0x4')]){_0x258b5a=0x0;while(_0x204733[_0x258b5a]){while((_0x5c003c=_0x3207f2['indexOf'](_0x204733[_0x258b5a]))!=-0x1){_0x35c4bf=_0x204733[_0x258b5a];_0x2c4414=_0x3207f2[_0x0b69('0x6')](0x0,_0x5c003c);_0x3207f2=_0x3207f2['substring'](_0x5c003c+_0x35c4bf['length']);var _0x204c7b=_0x2c4414[_0x0b69('0x7')](_0x993ade),_0x2949c0=0x0,_0x40488f={},_0xb0e5ea='',_0x5f396e='',_0x289e19=-0x1;while(_0x204c7b[_0x2949c0]){_0x289e19=_0x204c7b[_0x2949c0][_0x0b69('0x8')](':');if(_0x289e19!=-0x1){_0xb0e5ea=_0x204c7b[_0x2949c0][_0x0b69('0x9')](0x0,_0x289e19)[_0x0b69('0xa')]();_0x5f396e=_0x204c7b[_0x2949c0][_0x0b69('0x9')](_0x289e19+0x1)[_0x0b69('0xa')]();if(_0xb0e5ea['length']>0x0){_0x40488f[_0xb0e5ea]=_0x5f396e;}}else{}_0x2949c0++;}this[_0x0b69('0xb')](_0x0b69('0xc'),_0x40488f);this[_0x0b69('0x4')]=!![];}_0x258b5a++;}this['_localBuffer']=_0x3207f2;}else{while((_0x35fa9b=_0x3207f2[_0x0b69('0x8')](_0x993ade))!=-0x1){_0x2c4414=_0x3207f2[_0x0b69('0x6')](0x0,_0x35fa9b);this[_0x0b69('0xb')](_0x0b69('0xd'),_0x2c4414);_0x3207f2=_0x3207f2['substring'](_0x35fa9b+_0x993ade[_0x0b69('0xe')]);}this[_0x0b69('0x3')]=_0x3207f2;}_0x4804e7();};module[_0x0b69('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 52ca645..daf840a 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 _0x3c7b=['getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','name','getSquareProject','ShowSquareProject','production','ShowMailAccount','Smtp','CloudProvider','email'];(function(_0x3de8b9,_0x555647){var _0x3015d1=function(_0x52c273){while(--_0x52c273){_0x3de8b9['push'](_0x3de8b9['shift']());}};_0x3015d1(++_0x555647);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x1bbe5e,_0x19eefc){_0x1bbe5e=_0x1bbe5e-0x0;var _0x526947=_0x3c7b[_0x1bbe5e];return _0x526947;};'use strict';var _=require(_0xb3c7('0x0'));var moment=require(_0xb3c7('0x1'));var jayson=require(_0xb3c7('0x2'));var client=jayson[_0xb3c7('0x3')][_0xb3c7('0x4')]({'port':0x2329});function request(_0x4e4405,_0x4a83a4){return new Promise(function(_0x500bea,_0x5b34ef){return client[_0xb3c7('0x5')](_0x4e4405,_0x4a83a4)[_0xb3c7('0x6')](function(_0x4b3f30){if(_0x4b3f30[_0xb3c7('0x7')]){return _0x5b34ef(_0x4b3f30['error'][_0xb3c7('0x8')]);}else{return _0x500bea(_0x4b3f30[_0xb3c7('0x9')]);}})[_0xb3c7('0xa')](function(_0x1851a5){return _0x5b34ef(_0x1851a5);});});}exports[_0xb3c7('0xb')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xb3c7('0xc'),'production']}});};exports[_0xb3c7('0xd')]=function(_0x41dc8a){return request(_0xb3c7('0xe'),{'options':{'raw':![],'where':{'name':_0x41dc8a},'attributes':[_0xb3c7('0xf')]}});};exports['getMailAccountById']=function(_0x3bb4f1){return request(_0xb3c7('0x10'),{'options':{'raw':![],'where':{'id':_0x3bb4f1},'include':[{'model':'MailServerOut','as':_0xb3c7('0x11'),'include':[{'model':_0xb3c7('0x12'),'as':_0xb3c7('0x12')}]}],'attributes':['id',_0xb3c7('0xc'),_0xb3c7('0x13')],'smtp':!![]}});};exports[_0xb3c7('0x14')]=function(_0xc30bf9){return request('ShowSquareProject',{'options':{'where':{'id':_0xc30bf9},'attributes':[_0xb3c7('0xc')]}});};exports[_0xb3c7('0x15')]=function(_0x4d66c8){return request(_0xb3c7('0x16'),{'options':{'where':{'id':_0x4d66c8},'attributes':[_0xb3c7('0xc')]}});};exports[_0xb3c7('0x17')]=function(_0x2a24c7){return request(_0xb3c7('0x18'),{'options':{'where':{'id':_0x2a24c7},'attributes':[_0xb3c7('0xc')]}});};exports[_0xb3c7('0x19')]=function(_0x379c16){return request(_0xb3c7('0x1a'),{'options':{'where':{'id':_0x379c16},'attributes':[_0xb3c7('0x1b')]}});};exports[_0xb3c7('0x1c')]=function(_0x197e2f){return request('ShowUser',{'options':{'where':{'id':_0x197e2f},'attributes':['name']}});};exports[_0xb3c7('0x1d')]=function(_0x3bba70){return request(_0xb3c7('0x1e'),{'options':{'where':{'phone':_0x3bba70[_0xb3c7('0x1f')]},'attributes':['id']}});};exports[_0xb3c7('0x20')]=function(_0x4c0705){return request(_0xb3c7('0x21'),{'options':{'where':{'id':_0x4c0705},'attributes':[_0xb3c7('0xc')]}});};exports[_0xb3c7('0x22')]=function(_0x2d497f){return request('ShowSound',{'options':{'where':{'id':_0x2d497f},'attributes':['save_name']}});};exports[_0xb3c7('0x23')]=function(_0x1996db){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1996db},'include':[{'model':_0xb3c7('0x24'),'as':_0xb3c7('0x25')}]}});};exports[_0xb3c7('0x26')]=function(_0x47549c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x47549c},'attributes':['id','name']}});};exports[_0xb3c7('0x27')]=function(_0x13fe96){return request(_0xb3c7('0x28'),{'body':_0x13fe96});};exports[_0xb3c7('0x29')]=function(_0x1ca9cb){return request('CreateSquareDetailsReport',{'body':_0x1ca9cb});};exports[_0xb3c7('0x2a')]=function(_0x13d5ad){return request(_0xb3c7('0x2b'),{'body':_[_0xb3c7('0x2c')](_0x13d5ad,{'project_name':_0x13d5ad['arg_1'],'prev_project_name':_0x13d5ad[_0xb3c7('0x2d')]||'','is_subproject':_0x13d5ad[_0xb3c7('0x2d')]?!![]:![],'leaveAt':moment()[_0xb3c7('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xb3c7('0x2f')]=function(_0x54b6de){return request(_0xb3c7('0x30'),{'body':_0x54b6de});};exports[_0xb3c7('0x31')]=function(_0x29c707){return request('CreateSquareMessage',{'body':_0x29c707});};exports[_0xb3c7('0x32')]=function(_0x394568){return request(_0xb3c7('0x33'),{'options':{'raw':![],'where':{'phone':_0x394568[_0xb3c7('0x1f')],'ListId':_0x394568[_0xb3c7('0x34')]}}})[_0xb3c7('0x6')](function(_0x221d13){if(_0x221d13){return _0x221d13;}return request(_0xb3c7('0x35'),{'body':_0x394568});});};exports[_0xb3c7('0x36')]=function(_0x4e27ee){return request(_0xb3c7('0x37'),{'options':{'where':{'id':_0x4e27ee},'attributes':[_0xb3c7('0xc')]}});};exports[_0xb3c7('0x38')]=function(_0x562a14,_0x2c67a9){return request('LoginUser',{'body':{'interface':_0x2c67a9},'options':{'where':_0x562a14}});};exports['agentPause']=function(_0x4a80c4,_0x18c2cd,_0x35e80e){return request(_0xb3c7('0x39'),{'body':{'type':_0x18c2cd,'uniqueid':_0x35e80e},'options':{'where':_0x4a80c4}});};exports[_0xb3c7('0x3a')]=function(_0x52e418){return request('UnpauseUser',{'body':{},'options':{'where':_0x52e418}});};exports[_0xb3c7('0x3b')]=function(_0x1aba77){return request(_0xb3c7('0x3c'),{'body':{},'options':{'where':_0x1aba77}});}; \ No newline at end of file +var _0x2e35=['ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','catch','GetSquareProjects','name','getSquareProject','production','ShowMailAccount','MailServerOut','CloudProvider','email','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn'];(function(_0x233a7b,_0x79a380){var _0x3e53d2=function(_0x1a7bc0){while(--_0x1a7bc0){_0x233a7b['push'](_0x233a7b['shift']());}};_0x3e53d2(++_0x79a380);}(_0x2e35,0x1d0));var _0x52e3=function(_0x13b96e,_0x2b2600){_0x13b96e=_0x13b96e-0x0;var _0x125a71=_0x2e35[_0x13b96e];return _0x125a71;};'use strict';var _=require(_0x52e3('0x0'));var moment=require(_0x52e3('0x1'));var jayson=require(_0x52e3('0x2'));var client=jayson['client'][_0x52e3('0x3')]({'port':0x2329});function request(_0xcbe6c5,_0x16d807){return new Promise(function(_0x3dc244,_0x4ccab4){return client[_0x52e3('0x4')](_0xcbe6c5,_0x16d807)[_0x52e3('0x5')](function(_0x1f6987){if(_0x1f6987[_0x52e3('0x6')]){return _0x4ccab4(_0x1f6987['error']['message']);}else{return _0x3dc244(_0x1f6987['result']);}})[_0x52e3('0x7')](function(_0x4d77a0){return _0x4ccab4(_0x4d77a0);});});}exports['getSquareProjects']=function(){return request(_0x52e3('0x8'),{'options':{'raw':![],'attributes':['id',_0x52e3('0x9'),'production']}});};exports[_0x52e3('0xa')]=function(_0x1153c4){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1153c4},'attributes':[_0x52e3('0xb')]}});};exports['getMailAccountById']=function(_0x343960){return request(_0x52e3('0xc'),{'options':{'raw':![],'where':{'id':_0x343960},'include':[{'model':_0x52e3('0xd'),'as':'Smtp','include':[{'model':_0x52e3('0xe'),'as':_0x52e3('0xe')}]}],'attributes':['id','name',_0x52e3('0xf')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x57c51c){return request('ShowSquareProject',{'options':{'where':{'id':_0x57c51c},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x105c80){return request(_0x52e3('0x10'),{'options':{'where':{'id':_0x105c80},'attributes':[_0x52e3('0x9')]}});};exports[_0x52e3('0x11')]=function(_0x46a90b){return request(_0x52e3('0x12'),{'options':{'where':{'id':_0x46a90b},'attributes':[_0x52e3('0x9')]}});};exports[_0x52e3('0x13')]=function(_0x46e236){return request(_0x52e3('0x14'),{'options':{'where':{'id':_0x46e236},'attributes':[_0x52e3('0x15')]}});};exports['getUserById']=function(_0x325b46){return request(_0x52e3('0x16'),{'options':{'where':{'id':_0x325b46},'attributes':['name']}});};exports[_0x52e3('0x17')]=function(_0x2e82e2){return request(_0x52e3('0x18'),{'options':{'where':{'phone':_0x2e82e2[_0x52e3('0x19')]},'attributes':['id']}});};exports[_0x52e3('0x1a')]=function(_0xa9e99a){return request(_0x52e3('0x1b'),{'options':{'where':{'id':_0xa9e99a},'attributes':[_0x52e3('0x9')]}});};exports[_0x52e3('0x1c')]=function(_0xf3f633){return request(_0x52e3('0x1d'),{'options':{'where':{'id':_0xf3f633},'attributes':[_0x52e3('0x1e')]}});};exports[_0x52e3('0x1f')]=function(_0x360d5c){return request(_0x52e3('0x20'),{'options':{'raw':![],'where':{'id':_0x360d5c},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x164872){return request('ShowSmsAccount',{'options':{'where':{'id':_0x164872},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x1f2635){return request('CreateSmsMessage',{'body':_0x1f2635});};exports[_0x52e3('0x21')]=function(_0x4ae9d1){return request(_0x52e3('0x22'),{'body':_0x4ae9d1});};exports[_0x52e3('0x23')]=function(_0x5b9ff1){return request(_0x52e3('0x24'),{'body':_[_0x52e3('0x25')](_0x5b9ff1,{'project_name':_0x5b9ff1[_0x52e3('0x26')],'prev_project_name':_0x5b9ff1[_0x52e3('0x27')]||'','is_subproject':_0x5b9ff1['arg_2']?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x52e3('0x28')]=function(_0x11d967){return request(_0x52e3('0x29'),{'body':_0x11d967});};exports[_0x52e3('0x2a')]=function(_0x3fe875){return request('CreateSquareMessage',{'body':_0x3fe875});};exports[_0x52e3('0x2b')]=function(_0x51eb72){return request(_0x52e3('0x2c'),{'options':{'raw':![],'where':{'phone':_0x51eb72[_0x52e3('0x19')],'ListId':_0x51eb72[_0x52e3('0x2d')]}}})[_0x52e3('0x5')](function(_0x583ea9){if(_0x583ea9){return _0x583ea9;}return request(_0x52e3('0x2e'),{'body':_0x51eb72});});};exports[_0x52e3('0x2f')]=function(_0x4885ce){return request('ShowPause',{'options':{'where':{'id':_0x4885ce},'attributes':[_0x52e3('0x9')]}});};exports[_0x52e3('0x30')]=function(_0x12c97a,_0x538599){return request(_0x52e3('0x31'),{'body':{'interface':_0x538599},'options':{'where':_0x12c97a}});};exports[_0x52e3('0x32')]=function(_0x1c13a2,_0x33420f,_0x2ad0c8){return request(_0x52e3('0x33'),{'body':{'type':_0x33420f,'uniqueid':_0x2ad0c8},'options':{'where':_0x1c13a2}});};exports['agentUnpause']=function(_0xaa690a){return request('UnpauseUser',{'body':{},'options':{'where':_0xaa690a}});};exports[_0x52e3('0x34')]=function(_0x3ba5df){return request(_0x52e3('0x35'),{'body':{},'options':{'where':_0x3ba5df}});}; \ 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 dc38833..43ffef7 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 _0x0170=['./polly','./lex'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x0170,0x1d6));var _0x0017=function(_0x2aa0f9,_0x2eff37){_0x2aa0f9=_0x2aa0f9-0x0;var _0x152acb=_0x0170[_0x2aa0f9];return _0x152acb;};var polly=require(_0x0017('0x0'));var lex=require(_0x0017('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x565f=['./lex','exports'];(function(_0x2703a8,_0x10e1ae){var _0x50f972=function(_0x514c7c){while(--_0x514c7c){_0x2703a8['push'](_0x2703a8['shift']());}};_0x50f972(++_0x10e1ae);}(_0x565f,0x68));var _0xf565=function(_0x3e8455,_0x34f727){_0x3e8455=_0x3e8455-0x0;var _0x50f8e4=_0x565f[_0x3e8455];return _0x50f8e4;};var polly=require('./polly');var lex=require(_0xf565('0x0'));module[_0xf565('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index b03915b..d7cf920 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9354=['exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9354,0x96));var _0x4935=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x9354[_0x314a8c];return _0x1d4607;};'use strict';var lex=require('./lib/api');module[_0x4935('0x0')]=function(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc){return lex(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc);}; \ No newline at end of file +var _0xee5b=['./lib/api'];(function(_0x4b669b,_0x1815ff){var _0x49514b=function(_0x5237ac){while(--_0x5237ac){_0x4b669b['push'](_0x4b669b['shift']());}};_0x49514b(++_0x1815ff);}(_0xee5b,0x1f4));var _0xbee5=function(_0x6e3e2b,_0x452e0b){_0x6e3e2b=_0x6e3e2b-0x0;var _0x369dd2=_0xee5b[_0x6e3e2b];return _0x369dd2;};'use strict';var lex=require(_0xbee5('0x0'));module['exports']=function(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857){return lex(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857);}; \ 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 216aa20..bbb9dbd 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(_0x2d20dd,_0x3047c5){var _0x3e2929=function(_0x422612){while(--_0x422612){_0x2d20dd['push'](_0x2d20dd['shift']());}};_0x3e2929(++_0x3047c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x57bbdc,_0x3c3afb){var _0x5b4499=function(_0x120bc5){while(--_0x120bc5){_0x57bbdc['push'](_0x57bbdc['shift']());}};_0x5b4499(++_0x3c3afb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 299827c..81398bb 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 _0xfac9=['exports','./lib/api'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xfac9,0x14f));var _0x9fac=function(_0x1040a5,_0x1ec4f1){_0x1040a5=_0x1040a5-0x0;var _0x3d4e73=_0xfac9[_0x1040a5];return _0x3d4e73;};'use strict';var polly=require(_0x9fac('0x0'));module[_0x9fac('0x1')]=function(_0x36cab1,_0x6bf535,_0x34d7a0,_0x1f99ff,_0x595051,_0x65b1b,_0x1e2205){return polly(_0x36cab1,_0x6bf535,_0x34d7a0,_0x1f99ff,_0x595051,_0x65b1b,_0x1e2205);}; \ No newline at end of file +var _0x669e=['exports','./lib/api'];(function(_0x4789bc,_0x955524){var _0x66fd14=function(_0x5a2dac){while(--_0x5a2dac){_0x4789bc['push'](_0x4789bc['shift']());}};_0x66fd14(++_0x955524);}(_0x669e,0x10b));var _0xe669=function(_0x221c98,_0x33d10b){_0x221c98=_0x221c98-0x0;var _0x11f9f5=_0x669e[_0x221c98];return _0x11f9f5;};'use strict';var polly=require(_0xe669('0x0'));module[_0xe669('0x1')]=function(_0x38e09f,_0x70e688,_0x2136d8,_0x428d0a,_0x3fdc95,_0x31a259,_0x4ceb65){return polly(_0x38e09f,_0x70e688,_0x2136d8,_0x428d0a,_0x3fdc95,_0x31a259,_0x4ceb65);}; \ 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 397113e..f1f1af3 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 _0x353f=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x4b6a01,_0x386039){var _0xc374a3=function(_0x49791b){while(--_0x49791b){_0x4b6a01['push'](_0x4b6a01['shift']());}};_0xc374a3(++_0x386039);}(_0x353f,0x162));var _0xf353=function(_0x79324e,_0x4af67e){_0x79324e=_0x79324e-0x0;var _0x555666=_0x353f[_0x79324e];return _0x555666;};'use strict';var fs=require('fs');var path=require(_0xf353('0x0'));var BPromise=require('bluebird');var rs=require(_0xf353('0x1'));var AWS=require(_0xf353('0x2'));function pollyResult(_0x3dc184,_0x8823f8,_0x2909d7){return new BPromise(function(_0x33406f,_0x1e446a){_0x3dc184[_0xf353('0x3')](_0x8823f8,function(_0x5b3d2e,_0x484bf1){if(_0x5b3d2e){_0x1e446a(_0x5b3d2e);}else if(_0x484bf1){if(_0x484bf1[_0xf353('0x4')]instanceof Buffer){fs['writeFile'](_0x2909d7,_0x484bf1[_0xf353('0x4')],function(_0xed150b){if(_0xed150b){_0x1e446a(_0xed150b);}else{_0x33406f();}});}else{_0x1e446a(new Error(_0xf353('0x5')));}}else{_0x1e446a(new Error(_0xf353('0x6')));}});});}module['exports']=function(_0x12d05f,_0x3b6159,_0x48a934,_0x336402,_0x1b3bea,_0x2b2d70,_0x1a3e0f){var _0x184fcd=new AWS[(_0xf353('0x7'))]({'accessKeyId':_0x12d05f,'secretAccessKey':_0x3b6159,'region':_0x48a934});var _0x16d568={'Text':_0x1b3bea,'TextType':_0x2b2d70||_0xf353('0x8'),'OutputFormat':_0xf353('0x9'),'VoiceId':_0x336402};return pollyResult(_0x184fcd,_0x16d568,_0x1a3e0f);}; \ No newline at end of file +var _0x65be=['randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x65be,0xcf));var _0xe65b=function(_0x1d2794,_0x405ce8){_0x1d2794=_0x1d2794-0x0;var _0x45fe45=_0x65be[_0x1d2794];return _0x45fe45;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xe65b('0x0'));var AWS=require(_0xe65b('0x1'));function pollyResult(_0x3c552f,_0x476324,_0x3888e6){return new BPromise(function(_0x355101,_0x7cd65e){_0x3c552f[_0xe65b('0x2')](_0x476324,function(_0xbabf2e,_0x41d507){if(_0xbabf2e){_0x7cd65e(_0xbabf2e);}else if(_0x41d507){if(_0x41d507['AudioStream']instanceof Buffer){fs[_0xe65b('0x3')](_0x3888e6,_0x41d507[_0xe65b('0x4')],function(_0x41b3c9){if(_0x41b3c9){_0x7cd65e(_0x41b3c9);}else{_0x355101();}});}else{_0x7cd65e(new Error(_0xe65b('0x5')));}}else{_0x7cd65e(new Error(_0xe65b('0x6')));}});});}module[_0xe65b('0x7')]=function(_0x382d6b,_0xc8ce32,_0x56796f,_0x502ddd,_0x3a53e5,_0x3e8110,_0x2ec4b3){var _0x40a86c=new AWS['Polly']({'accessKeyId':_0x382d6b,'secretAccessKey':_0xc8ce32,'region':_0x56796f});var _0x1411f0={'Text':_0x3a53e5,'TextType':_0x3e8110||_0xe65b('0x8'),'OutputFormat':'mp3','VoiceId':_0x502ddd};return pollyResult(_0x40a86c,_0x1411f0,_0x2ec4b3);}; \ 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 db2cd07..3c7ff81 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x311a=['exports'];(function(_0x1a3984,_0x492a1d){var _0x386311=function(_0x124884){while(--_0x124884){_0x1a3984['push'](_0x1a3984['shift']());}};_0x386311(++_0x492a1d);}(_0x311a,0x15b));var _0xa311=function(_0x325e25,_0x25e559){_0x325e25=_0x325e25-0x0;var _0x4f9bd5=_0x311a[_0x325e25];return _0x4f9bd5;};'use strict';var asr=require('./lib/api');module[_0xa311('0x0')]=function(_0x10933f,_0x2f348b,_0x4d4f4d,_0x3c9085){return asr(_0x10933f,_0x2f348b,_0x4d4f4d);}; \ No newline at end of file +var _0x5a9d=['./lib/api','exports'];(function(_0x39d4e4,_0x3b91c4){var _0x377a40=function(_0xd1aeca){while(--_0xd1aeca){_0x39d4e4['push'](_0x39d4e4['shift']());}};_0x377a40(++_0x3b91c4);}(_0x5a9d,0xd0));var _0xd5a9=function(_0x466fe1,_0x2fdd84){_0x466fe1=_0x466fe1-0x0;var _0x411732=_0x5a9d[_0x466fe1];return _0x411732;};'use strict';var asr=require(_0xd5a9('0x0'));module[_0xd5a9('0x1')]=function(_0x30b29f,_0x524ebb,_0x4f79a0,_0x5b9097){return asr(_0x30b29f,_0x524ebb,_0x4f79a0);}; \ 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 4264133..67ef2e0 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 _0x20ce=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com'];(function(_0x57110e,_0x57955f){var _0x2a13c5=function(_0x71cc0a){while(--_0x71cc0a){_0x57110e['push'](_0x57110e['shift']());}};_0x2a13c5(++_0x57955f);}(_0x20ce,0x10d));var _0xe20c=function(_0x21e125,_0xa88c07){_0x21e125=_0x21e125-0x0;var _0x155675=_0x20ce[_0x21e125];return _0x155675;};'use strict';var url=require(_0xe20c('0x0'));var BPromise=require(_0xe20c('0x1'));var fs=require('fs');var host=_0xe20c('0x2');module['exports']=function(_0x377a74,_0x34b536,_0x213486){return new BPromise(function(_0x26479b,_0x7e5160){var _0x23f743;if(typeof _0x377a74!==_0xe20c('0x3')||_0x377a74[_0xe20c('0x4')]===0x0){return _0x7e5160(_0xe20c('0x5'));}if(typeof _0x34b536!==_0xe20c('0x3')||_0x34b536[_0xe20c('0x4')]===0x0){return _0x7e5160(_0xe20c('0x6'));}if(typeof _0x213486!==_0xe20c('0x7')&&(typeof _0x213486!==_0xe20c('0x3')||_0x213486[_0xe20c('0x4')]===0x0)){return _0x7e5160(_0xe20c('0x8'));}try{_0x23f743=fs[_0xe20c('0x9')](_0x377a74)[_0xe20c('0xa')](_0xe20c('0xb'));}catch(_0x16aaaa){return _0x7e5160(_0x16aaaa);}return _0x26479b({'method':_0xe20c('0xc'),'uri':host+_0xe20c('0xd')+_0x34b536,'body':{'config':{'encoding':_0xe20c('0xe'),'sampleRateHertz':_0xe20c('0xf'),'languageCode':_0x213486},'audio':{'content':_0x23f743}},'json':!![]});});}; \ No newline at end of file +var _0xfa2f=['length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','https://speech.googleapis.com','string'];(function(_0x2fc6cf,_0x274ca4){var _0x2390d7=function(_0x5ee1b0){while(--_0x5ee1b0){_0x2fc6cf['push'](_0x2fc6cf['shift']());}};_0x2390d7(++_0x274ca4);}(_0xfa2f,0xe8));var _0xffa2=function(_0x2cd7d1,_0x588b43){_0x2cd7d1=_0x2cd7d1-0x0;var _0x53a607=_0xfa2f[_0x2cd7d1];return _0x53a607;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xffa2('0x0');module['exports']=function(_0x2411c2,_0x34de1d,_0x4d6507){return new BPromise(function(_0x54d423,_0x3fcced){var _0x12b74e;if(typeof _0x2411c2!==_0xffa2('0x1')||_0x2411c2[_0xffa2('0x2')]===0x0){return _0x3fcced(_0xffa2('0x3'));}if(typeof _0x34de1d!==_0xffa2('0x1')||_0x34de1d[_0xffa2('0x2')]===0x0){return _0x3fcced('key\x20should\x20be\x20a\x20string');}if(typeof _0x4d6507!=='undefined'&&(typeof _0x4d6507!==_0xffa2('0x1')||_0x4d6507[_0xffa2('0x2')]===0x0)){return _0x3fcced(_0xffa2('0x4'));}try{_0x12b74e=fs[_0xffa2('0x5')](_0x2411c2)[_0xffa2('0x6')](_0xffa2('0x7'));}catch(_0x1fa2eb){return _0x3fcced(_0x1fa2eb);}return _0x54d423({'method':'POST','uri':host+_0xffa2('0x8')+_0x34de1d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x4d6507},'audio':{'content':_0x12b74e}},'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 947d40b..cefc566 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 _0xa386=['./asr'];(function(_0x110624,_0x3ab97a){var _0x4b015b=function(_0x3aa7fa){while(--_0x3aa7fa){_0x110624['push'](_0x110624['shift']());}};_0x4b015b(++_0x3ab97a);}(_0xa386,0x148));var _0x6a38=function(_0x131bb1,_0x5c91cc){_0x131bb1=_0x131bb1-0x0;var _0x4b006b=_0xa386[_0x131bb1];return _0x4b006b;};var asr=require(_0x6a38('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x27e6=['exports'];(function(_0x1688fd,_0x1150a9){var _0x3b0b20=function(_0x5b2df8){while(--_0x5b2df8){_0x1688fd['push'](_0x1688fd['shift']());}};_0x3b0b20(++_0x1150a9);}(_0x27e6,0x11b));var _0x627e=function(_0x55b745,_0x36e0fa){_0x55b745=_0x55b745-0x0;var _0x1772a7=_0x27e6[_0x55b745];return _0x1772a7;};var asr=require('./asr');module[_0x627e('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 90f89b5..aa1e583 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 _0x24c0=['boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','apiai-promise','bluebird','dialogflow','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','host','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','WHAT_EVER','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','POST','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','data','.wav','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','googleDialogflow','source','resolvedQuery','result','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields'];(function(_0x3c979f,_0x15f73d){var _0x1c8604=function(_0x3e4957){while(--_0x3e4957){_0x3c979f['push'](_0x3c979f['shift']());}};_0x1c8604(++_0x15f73d);}(_0x24c0,0x11a));var _0x024c=function(_0x578c02,_0x215428){_0x578c02=_0x578c02-0x0;var _0x5dfa9e=_0x24c0[_0x578c02];return _0x5dfa9e;};'use strict';var apiai=require(_0x024c('0x0'));var BPromise=require(_0x024c('0x1'));var dialogflow=require(_0x024c('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require(_0x024c('0x3'));var querystring=require(_0x024c('0x4'));var rp=require(_0x024c('0x5'));var rs=require('randomstring');var sox=require(_0x024c('0x6'));var tts=require(_0x024c('0x7'));var urlParse=require(_0x024c('0x8'))[_0x024c('0x9')];var util=require(_0x024c('0xa'));var aws=require(_0x024c('0xb'));var google=require(_0x024c('0xc'));var sestek=require('./sestek');var tilde=require(_0x024c('0xd'));var logger=require(_0x024c('0xe'))(_0x024c('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x2104df,_0x593902){return new BPromise(function(_0x268189,_0x3fddc6){var _0x4209ec=urlParse(_0x2104df);var _0x4cb685=_0x4209ec['protocol']==='https:'?https:http;var _0x531330={'host':_0x4209ec[_0x024c('0x10')],'path':_0x4209ec['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4cb685['get'](_0x531330,function(_0x5efd0f){if(_0x5efd0f[_0x024c('0x11')]!==0xc8){logger[_0x024c('0x12')](_0x024c('0x13')+_0x2104df+_0x024c('0x14')+_0x5efd0f[_0x024c('0x11')]+'\x20('+_0x5efd0f['statusMessage']+')');_0x3fddc6(new Error(_0x024c('0x13')+_0x2104df+_0x024c('0x14')+_0x5efd0f[_0x024c('0x11')]+'\x20('+_0x5efd0f[_0x024c('0x15')]+')'));return;}var _0x1ad732=fs[_0x024c('0x16')](_0x593902);_0x1ad732['on']('finish',function(){logger[_0x024c('0x17')](_0x024c('0x18'));_0x1ad732['close'](_0x268189);});_0x1ad732['on'](_0x024c('0x12'),function(_0x5a5eb3){fs[_0x024c('0x19')](_0x593902);logger[_0x024c('0x12')](_0x024c('0x1a'),_0x5a5eb3);_0x3fddc6(_0x5a5eb3);});_0x5efd0f[_0x024c('0x1b')](_0x1ad732);})['on'](_0x024c('0x12'),function(_0x349e8c){logger['error'](_0x349e8c);_0x3fddc6(_0x349e8c);})[_0x024c('0x1c')]();});}function uploadFile(_0x2571bf){return new BPromise(function(_0x1b9123,_0x5530d8){var _0x2786b1=urlParse(_0x2571bf);var _0x2e5ccd=_0x2786b1['protocol']==='https:'?https:http;var _0x4af00b={'host':_0x2786b1[_0x024c('0x10')],'path':_0x2786b1['path'],'headers':{'user-agent':_0x024c('0x1d')}};_0x2e5ccd['get'](_0x4af00b,function(_0x1b8de3){if(_0x1b8de3['statusCode']!==0xc8){_0x5530d8(new Error(_0x024c('0x13')+_0x2571bf+_0x024c('0x14')+_0x1b8de3[_0x024c('0x11')]+'\x20('+_0x1b8de3[_0x024c('0x15')]+')'));return;}var _0x4d7e95='';_0x1b8de3['on']('data',function(_0x1becb7){_0x4d7e95+=_0x1becb7;});_0x1b8de3['on']('end',function(){_0x1b9123(_0x4d7e95);});})['on'](_0x024c('0x12'),function(_0x2b16e0){_0x5530d8(_0x2b16e0);})[_0x024c('0x1c')]();});}function convertFile(_0x14a8f7,_0x1e52ff){return new BPromise(function(_0xd9b79a,_0x3af27a){var _0x27d9ea=sox['transcode'](_0x14a8f7,_0x1e52ff,{'sampleRate':0x1f40,'format':_0x024c('0x1e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27d9ea['on']('error',function(_0x2a4b09){logger[_0x024c('0x12')](_0x024c('0x1f'),_0x2a4b09);_0x3af27a(_0x2a4b09);});_0x27d9ea['on'](_0x024c('0x1c'),function(){logger[_0x024c('0x17')](_0x024c('0x20'));_0xd9b79a();});_0x27d9ea[_0x024c('0x21')]();});}function base64Decode(_0x28647d,_0x444acf){var _0x2bb234=path[_0x024c('0x22')](__dirname,_0x024c('0x23'),rs[_0x024c('0x24')](0x4)+'.wav');fs[_0x024c('0x25')](_0x2bb234,_0x28647d,_0x024c('0x26'));return convertFile(_0x2bb234,_0x444acf)[_0x024c('0x27')](function(){try{fs[_0x024c('0x19')](_0x2bb234);fs['chmodSync'](_0x444acf,_0x024c('0x28'));}catch(_0x5e387e){logger[_0x024c('0x12')](_0x5e387e);}return _0x444acf[_0x024c('0x29')]('.')[0x0];});}function base64Encode(_0x14cd1a){var _0x1199d7=fs[_0x024c('0x2a')](_0x14cd1a);return new Buffer(_0x1199d7)['toString'](_0x024c('0x26'));}exports[_0x024c('0x2b')]=function(_0x2e8feb,_0xa218df,_0x425e2a,_0x4233a5,_0x2ad40e,_0x16f250){var _0x2fd56d,_0x3c7866;var _0x159e87=_0x024c('0x2c');var _0x44c8f1=_0x024c('0x2d')+_0x2e8feb;var _0x3505da={};if(_0xa218df==='ssml'){_0x3505da[_0x024c('0x2e')]={'ssml':_0x425e2a};}else{_0x3505da['input']={'text':_0x425e2a};};_0x3505da['voice']={'languageCode':_0x4233a5,'ssmlGender':_0x2ad40e};_0x3505da[_0x024c('0x2f')]={'audioEncoding':_0x024c('0x30'),'sampleRateHertz':0x1f40};var _0x529128={'url':_0x159e87+'text:synthesize'+_0x44c8f1,'method':_0x024c('0x31'),'json':!![],'body':_0x3505da};return rp(_0x529128)[_0x024c('0x27')](function(_0x31566f){return new BPromise(function(_0x3dd40a,_0x4d47e1){_0x2fd56d=path[_0x024c('0x22')](__dirname,'tmp',rs[_0x024c('0x24')](0x4)+_0x024c('0x32'));var _0x39dd35=Buffer[_0x024c('0x33')](_0x31566f[_0x024c('0x34')],_0x024c('0x26'));return fs[_0x024c('0x35')](_0x2fd56d,_0x39dd35,function(_0x4da29c){_0x4d47e1(_0x4da29c);},function(_0x1c442b){fs[_0x024c('0x36')](_0x2fd56d,_0x024c('0x28'));_0x3dd40a(_0x1c442b);});});})[_0x024c('0x27')](function(_0x191454){_0x3c7866=path[_0x024c('0x22')](__dirname,_0x024c('0x23'),rs[_0x024c('0x24')](0x4)+'.wav');return convertFile(_0x2fd56d,_0x3c7866);})[_0x024c('0x27')](function(){try{fs[_0x024c('0x19')](_0x2fd56d);fs[_0x024c('0x36')](_0x3c7866,_0x024c('0x28'));}catch(_0x1c884a){logger[_0x024c('0x12')](_0x1c884a);}logger[_0x024c('0x17')](_0x024c('0x37'),_0x3c7866[_0x024c('0x29')]('.')[0x0]);return _0x3c7866[_0x024c('0x29')]('.')[0x0];});};exports['googleTTS']=function(_0x5b9f54,_0x461b46){var _0x101df4='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x227c89,_0x23e55a;var _0x45aa8c;var _0x43a665={'encoding':'utf8','method':_0x024c('0x31'),'timeout':0x2710,'url':_0x101df4,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x024c('0x38')]([[[_0x024c('0x39'),JSON['stringify']([_0x5b9f54,_0x461b46||'en',![],_0x024c('0x3a')]),null,_0x024c('0x3b')]]]))};return rp(_0x43a665)[_0x024c('0x27')](function(_0x3624c2){try{_0x45aa8c=eval(_0x3624c2[_0x024c('0x3c')](0x5))[0x0][0x2];}catch(_0x5e80b4){throw new Error(_0x024c('0x3d')+_0x3624c2['data']);}if(!_0x45aa8c){if(_0x5b9f54['length']>0xc8){throw new Error(_0x024c('0x3e'));}else{throw new Error('lang\x20\x22'+_0x461b46+_0x024c('0x3f'));}}try{_0x45aa8c=eval(_0x45aa8c)[0x0];}catch(_0x3926cf){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x024c('0x40')]);}const _0x4b2b8f=_0x45aa8c;_0x227c89=path[_0x024c('0x22')](__dirname,_0x024c('0x23'),rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x227c89,_0x45aa8c,{'encoding':'base64'});_0x23e55a=path[_0x024c('0x22')](__dirname,_0x024c('0x23'),rs[_0x024c('0x24')](0x4)+_0x024c('0x41'));return convertFile(_0x227c89,_0x23e55a);})[_0x024c('0x27')](function(){try{fs[_0x024c('0x19')](_0x227c89);fs[_0x024c('0x36')](_0x23e55a,'777');}catch(_0x5489c6){logger['error'](_0x5489c6);}logger[_0x024c('0x17')]('goggleTTS\x20path',_0x23e55a[_0x024c('0x29')]('.')[0x0]);return _0x23e55a['split']('.')[0x0];});};exports[_0x024c('0x42')]=function(_0x262c15,_0x4d046a,_0x1e9676){return google[_0x024c('0x43')](_0x262c15,_0x4d046a,_0x1e9676)[_0x024c('0x27')](function(_0x16c9e3){logger[_0x024c('0x17')](_0x16c9e3[_0x024c('0x44')]);return rp(_0x16c9e3);})[_0x024c('0x27')](function(_0x30e00b){var _0x3fd01e='';var _0x282354=0x0;try{fs[_0x024c('0x19')](_0x262c15);}catch(_0xcce2fb){logger['error'](_0xcce2fb);}if(_0x30e00b&&_0x30e00b['results']){_0x3fd01e=_0x30e00b[_0x024c('0x45')][_0x024c('0x46')](function(_0xa6eee9){return _0xa6eee9&&_0xa6eee9['alternatives'][0x0]&&_0xa6eee9[_0x024c('0x47')][0x0][_0x024c('0x48')]?_0xa6eee9[_0x024c('0x47')][0x0][_0x024c('0x48')]:'';})[_0x024c('0x49')]('\x0a');_0x282354=_0x30e00b[_0x024c('0x45')]['map'](function(_0x37b0df){return _0x37b0df&&_0x37b0df[_0x024c('0x47')][0x0]&&_0x37b0df[_0x024c('0x47')][0x0][_0x024c('0x4a')]?_0x37b0df[_0x024c('0x47')][0x0][_0x024c('0x4a')]:0x0;})[_0x024c('0x49')]('\x0a');}logger[_0x024c('0x17')](_0x024c('0x4b'),_0x3fd01e);logger[_0x024c('0x17')](_0x024c('0x4c'),_0x282354);return{'transcript':_0x3fd01e,'confidence':_0x282354};})[_0x024c('0x4d')](function(_0x377f8d){logger[_0x024c('0x12')]('[%s]\x20%s:%s',_0x377f8d[_0x024c('0x11')],_0x377f8d[_0x024c('0x4e')],_0x377f8d['message']);});};exports[_0x024c('0x4f')]=function(_0xb9a730,_0x1806c8,_0x36de81,_0x481eaa){var _0x553ff7=apiai(_0x1806c8,{'language':_0x481eaa||'en'});return _0x553ff7['textRequest'](_0x36de81,{'sessionId':md5(_0xb9a730)})[_0x024c('0x27')](function(_0x3b15f9){logger[_0x024c('0x17')](JSON[_0x024c('0x38')](_0x3b15f9));return{'source':_0x3b15f9['result'][_0x024c('0x50')],'resolvedQuery':_0x3b15f9['result'][_0x024c('0x51')],'action':_0x3b15f9['result']['action'],'actionIncomplete':_0x3b15f9[_0x024c('0x52')][_0x024c('0x53')],'speech':_0x3b15f9[_0x024c('0x52')][_0x024c('0x54')][_0x024c('0x55')],'score':_0x3b15f9[_0x024c('0x52')][_0x024c('0x56')],'statusCode':_0x3b15f9[_0x024c('0x57')][_0x024c('0x58')],'endConversation':_0x3b15f9['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x3b15f9[_0x024c('0x52')][_0x024c('0x59')][_0x024c('0x5a')]};});};exports[_0x024c('0x5b')]=function(_0x18f4ad,_0xf36d5a,_0x5c5534,_0x44c998,_0xf2104e,_0x502e03){var _0x2336f1=_0x44c998[_0x024c('0x5c')](/\\n/g,'\x0a');var _0x32bc9f={'credentials':{'private_key':_0x2336f1,'client_email':_0x5c5534}};var _0x2da5ed=new dialogflow[(_0x024c('0x5d'))](_0x32bc9f);var _0x587eb6=_0x2da5ed[_0x024c('0x5e')](_0xf36d5a,md5(_0x18f4ad));var _0x2b2ea4={'session':_0x587eb6,'queryInput':{'text':{'text':_0xf2104e,'languageCode':_0x502e03}}};return _0x2da5ed['detectIntent'](_0x2b2ea4)['then'](function(_0x19a5d2){if(_0x19a5d2&&_0x19a5d2[_0x024c('0x5f')]){logger['info'](_0x024c('0x60'),JSON[_0x024c('0x38')](_0x19a5d2));var _0x1f1496=_0x19a5d2[0x0];if(_0x1f1496){var _0x1aa8b5={'action':_0x1f1496[_0x024c('0x61')][_0x024c('0x62')],'allRequiredParamsPresent':_0x1f1496['queryResult'][_0x024c('0x63')],'endConversation':_0x1f1496['queryResult'][_0x024c('0x64')]&&_0x1f1496['queryResult'][_0x024c('0x64')][_0x024c('0x65')]?_0x1f1496[_0x024c('0x61')][_0x024c('0x64')]['fields']['end_conversation'][_0x024c('0x66')]:![],'fulfillmentText':_0x1f1496[_0x024c('0x61')][_0x024c('0x67')],'intentName':_0x1f1496[_0x024c('0x61')][_0x024c('0x68')]['name'],'intentDisplayName':_0x1f1496['queryResult'][_0x024c('0x68')][_0x024c('0x69')],'isFallbackIntent':_0x1f1496['queryResult'][_0x024c('0x68')][_0x024c('0x6a')],'languageCode':_0x1f1496[_0x024c('0x61')]['languageCode'],'queryText':_0x1f1496[_0x024c('0x61')][_0x024c('0x6b')],'responseId':_0x1f1496[_0x024c('0x6c')],'score':_0x1f1496[_0x024c('0x61')][_0x024c('0x6d')],'speech':_0x1f1496[_0x024c('0x61')][_0x024c('0x67')],'providerResponse':JSON[_0x024c('0x38')](_0x19a5d2)};return _0x1aa8b5;}}});};exports[_0x024c('0x6e')]=function(_0x25765f,_0x1338d5,_0x1a96b5,_0x49aa8e){return tilde[_0x024c('0x43')](_0x25765f,_0x1338d5,_0x1a96b5,_0x49aa8e)[_0x024c('0x27')](function(_0x5cfb6f){try{fs[_0x024c('0x19')](_0x25765f);}catch(_0x2f1dfb){logger['error'](_0x2f1dfb);}logger[_0x024c('0x17')](_0x024c('0x6f'),_0x5cfb6f[_0x024c('0x48')]);logger[_0x024c('0x17')](_0x024c('0x70'),_0x5cfb6f['confidence']);return _0x5cfb6f;});};exports[_0x024c('0x71')]=function(_0x5c60f5,_0x1aa904,_0x4a2928,_0x3de88a,_0x557ac2,_0x570d24){var _0x866b30=path[_0x024c('0x22')](__dirname,_0x024c('0x23'),rs[_0x024c('0x24')](0x4)+_0x024c('0x32'));var _0x7a8ed6;return aws[_0x024c('0x72')](_0x5c60f5,_0x1aa904,_0x4a2928,_0x3de88a,_0x557ac2,_0x570d24,_0x866b30)[_0x024c('0x27')](function(){_0x7a8ed6=path['resolve'](__dirname,_0x024c('0x23'),rs[_0x024c('0x24')](0x4)+_0x024c('0x41'));return convertFile(_0x866b30,_0x7a8ed6);})['then'](function(){try{fs[_0x024c('0x19')](_0x866b30);fs[_0x024c('0x36')](_0x7a8ed6,_0x024c('0x28'));}catch(_0x3574cc){logger['error'](_0x3574cc);}return _0x7a8ed6[_0x024c('0x29')]('.')[0x0];});};exports['awsLex']=function(_0xa7c0fb,_0x1ae762,_0x356dbd,_0x37dead,_0x55cc67,_0x3d2011){return aws[_0x024c('0x73')](_0xa7c0fb,_0x1ae762,_0x356dbd,_0x37dead,_0x55cc67,_0x3d2011)['then'](function(_0x519a72){logger['info'](JSON[_0x024c('0x38')](_0x519a72));return _0x519a72;});};exports['ispeechTTS']=function(_0x46c600,_0x5da119,_0x1c3466,_0x2ca782){var _0x3e357d=util['format'](_0x024c('0x74'),ISPEECH_API,_0x46c600,encodeURIComponent(_0x5da119),_0x1c3466,_0x2ca782);var _0x248e8f=path[_0x024c('0x22')](__dirname,_0x024c('0x23'),rs['generate'](0x4)+'.mp3');var _0x10fc94;return downloadFile(_0x3e357d,_0x248e8f)['then'](function(){_0x10fc94=path[_0x024c('0x22')](__dirname,'tmp',rs[_0x024c('0x24')](0x4)+_0x024c('0x41'));return convertFile(_0x248e8f,_0x10fc94);})['then'](function(){try{fs[_0x024c('0x19')](_0x248e8f);fs[_0x024c('0x36')](_0x10fc94,'777');}catch(_0x21547b){logger['error'](_0x21547b);}return _0x10fc94[_0x024c('0x29')]('.')[0x0];});};exports[_0x024c('0x75')]=function(_0x3c6a7d,_0x5c5361,_0x59835a,_0x3c1e9d){var _0x828d41=util[_0x024c('0x76')](_0x024c('0x77'),ISPEECH_API,_0x5c5361,_0x59835a,base64Encode(_0x3c6a7d),_0x3c1e9d?util[_0x024c('0x76')](_0x024c('0x78'),encodeURIComponent(_0x3c1e9d)):_0x024c('0x79'));return uploadFile(_0x828d41)[_0x024c('0x27')](function(_0x55500d){return querystring[_0x024c('0x9')](_0x55500d);});};exports['sestekNDA']=function(_0x3b4a68,_0x21e357){return sestek['nda'](_0x3b4a68,_0x21e357)['then'](function(_0x939f65){logger['info'](JSON[_0x024c('0x38')](_0x939f65));var _0x3e8b6e={'speech':_0x939f65[_0x024c('0x7a')],'action':_0x939f65[_0x024c('0x7b')]?_0x939f65[_0x024c('0x7b')][_0x024c('0x7c')]:undefined,'actiondata':_0x939f65['channelData']?_0x939f65[_0x024c('0x7b')][_0x024c('0x7d')]:undefined};if(_0x939f65['channelData']&&_0x939f65['channelData'][_0x024c('0x7e')]){return base64Decode(_0x939f65[_0x024c('0x7b')][_0x024c('0x7e')]['Data'],path[_0x024c('0x22')](__dirname,_0x024c('0x23'),rs[_0x024c('0x24')](0x4)+'.wav'))[_0x024c('0x27')](function(_0xecf313){_0x3e8b6e['audiofile']=_0xecf313;return _0x3e8b6e;});}return _0x3e8b6e;});};exports[_0x024c('0x7f')]=function(){return __dirname;}; \ No newline at end of file +var _0x54a9=['audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','unlink','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','result','source','action','fulfillment','status','code','endConversation','metadata','googleDialogflowV2','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','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','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','close','pipe','end','get','data','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','.mp3','from'];(function(_0x4c11fb,_0x32dbc0){var _0x4caf73=function(_0x63181b){while(--_0x63181b){_0x4c11fb['push'](_0x4c11fb['shift']());}};_0x4caf73(++_0x32dbc0);}(_0x54a9,0x15c));var _0x954a=function(_0x2a4063,_0x48cf8b){_0x2a4063=_0x2a4063-0x0;var _0x35396b=_0x54a9[_0x2a4063];return _0x35396b;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x954a('0x0'));var fs=require('fs');var http=require(_0x954a('0x1'));var https=require(_0x954a('0x2'));var md5=require(_0x954a('0x3'));var path=require(_0x954a('0x4'));var querystring=require(_0x954a('0x5'));var rp=require(_0x954a('0x6'));var rs=require(_0x954a('0x7'));var sox=require('sox');var tts=require(_0x954a('0x8'));var urlParse=require(_0x954a('0x9'))[_0x954a('0xa')];var util=require(_0x954a('0xb'));var aws=require(_0x954a('0xc'));var google=require(_0x954a('0xd'));var sestek=require(_0x954a('0xe'));var tilde=require(_0x954a('0xf'));var logger=require(_0x954a('0x10'))(_0x954a('0x11'));var ISPEECH_API=_0x954a('0x12');function downloadFile(_0x5db3e0,_0x5660ae){return new BPromise(function(_0x16f4de,_0x599616){var _0x3bbd60=urlParse(_0x5db3e0);var _0x216923=_0x3bbd60[_0x954a('0x13')]===_0x954a('0x14')?https:http;var _0x40b148={'host':_0x3bbd60[_0x954a('0x15')],'path':_0x3bbd60[_0x954a('0x4')],'headers':{'user-agent':_0x954a('0x16')}};_0x216923['get'](_0x40b148,function(_0x2ddbf7){if(_0x2ddbf7[_0x954a('0x17')]!==0xc8){logger[_0x954a('0x18')](_0x954a('0x19')+_0x5db3e0+_0x954a('0x1a')+_0x2ddbf7[_0x954a('0x17')]+'\x20('+_0x2ddbf7[_0x954a('0x1b')]+')');_0x599616(new Error(_0x954a('0x19')+_0x5db3e0+_0x954a('0x1a')+_0x2ddbf7['statusCode']+'\x20('+_0x2ddbf7['statusMessage']+')'));return;}var _0x3eb634=fs['createWriteStream'](_0x5660ae);_0x3eb634['on'](_0x954a('0x1c'),function(){logger['info']('finish\x20download\x20file');_0x3eb634[_0x954a('0x1d')](_0x16f4de);});_0x3eb634['on']('error',function(_0x4a1675){fs['unlink'](_0x5660ae);logger[_0x954a('0x18')]('download\x20error',_0x4a1675);_0x599616(_0x4a1675);});_0x2ddbf7[_0x954a('0x1e')](_0x3eb634);})['on'](_0x954a('0x18'),function(_0xe2ff5f){logger['error'](_0xe2ff5f);_0x599616(_0xe2ff5f);})[_0x954a('0x1f')]();});}function uploadFile(_0x4bb0aa){return new BPromise(function(_0x1a21f9,_0xc17c37){var _0x19e091=urlParse(_0x4bb0aa);var _0x1e3265=_0x19e091[_0x954a('0x13')]===_0x954a('0x14')?https:http;var _0x16846f={'host':_0x19e091[_0x954a('0x15')],'path':_0x19e091['path'],'headers':{'user-agent':_0x954a('0x16')}};_0x1e3265[_0x954a('0x20')](_0x16846f,function(_0x2d6d8b){if(_0x2d6d8b[_0x954a('0x17')]!==0xc8){_0xc17c37(new Error(_0x954a('0x19')+_0x4bb0aa+'\x20failed,\x20status\x20code\x20=\x20'+_0x2d6d8b[_0x954a('0x17')]+'\x20('+_0x2d6d8b[_0x954a('0x1b')]+')'));return;}var _0x203ba4='';_0x2d6d8b['on'](_0x954a('0x21'),function(_0x432530){_0x203ba4+=_0x432530;});_0x2d6d8b['on']('end',function(){_0x1a21f9(_0x203ba4);});})['on']('error',function(_0x5507cb){_0xc17c37(_0x5507cb);})[_0x954a('0x1f')]();});}function convertFile(_0x45ee7a,_0x275f50){return new BPromise(function(_0x441095,_0x3be446){var _0x336871=sox[_0x954a('0x22')](_0x45ee7a,_0x275f50,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x336871['on'](_0x954a('0x18'),function(_0x5e0868){logger['error'](_0x954a('0x23'),_0x5e0868);_0x3be446(_0x5e0868);});_0x336871['on']('end',function(){logger[_0x954a('0x24')](_0x954a('0x25'));_0x441095();});_0x336871[_0x954a('0x26')]();});}function base64Decode(_0x1d8356,_0x2116b8){var _0x49fc96=path[_0x954a('0x27')](__dirname,_0x954a('0x28'),rs[_0x954a('0x29')](0x4)+_0x954a('0x2a'));fs[_0x954a('0x2b')](_0x49fc96,_0x1d8356,'base64');return convertFile(_0x49fc96,_0x2116b8)[_0x954a('0x2c')](function(){try{fs['unlink'](_0x49fc96);fs[_0x954a('0x2d')](_0x2116b8,_0x954a('0x2e'));}catch(_0x5fad6c){logger['error'](_0x5fad6c);}return _0x2116b8[_0x954a('0x2f')]('.')[0x0];});}function base64Encode(_0x4b4ef0){var _0x30da05=fs[_0x954a('0x30')](_0x4b4ef0);return new Buffer(_0x30da05)[_0x954a('0x31')](_0x954a('0x32'));}exports[_0x954a('0x33')]=function(_0x332cfd,_0x1cfab7,_0xced3aa,_0x271b83,_0x4195c0,_0x2af95b){var _0x49c4d6,_0x2fb688;var _0x123f30=_0x954a('0x34');var _0x7041db=_0x954a('0x35')+_0x332cfd;var _0xec5e1c={};if(_0x1cfab7===_0x954a('0x36')){_0xec5e1c[_0x954a('0x37')]={'ssml':_0xced3aa};}else{_0xec5e1c[_0x954a('0x37')]={'text':_0xced3aa};};_0xec5e1c['voice']={'languageCode':_0x271b83,'ssmlGender':_0x4195c0};_0xec5e1c['audioConfig']={'audioEncoding':_0x954a('0x38'),'sampleRateHertz':0x1f40};var _0x3d1054={'url':_0x123f30+_0x954a('0x39')+_0x7041db,'method':'POST','json':!![],'body':_0xec5e1c};return rp(_0x3d1054)['then'](function(_0x15c781){return new BPromise(function(_0x485059,_0x509b0f){_0x49c4d6=path[_0x954a('0x27')](__dirname,'tmp',rs[_0x954a('0x29')](0x4)+_0x954a('0x3a'));var _0x340625=Buffer[_0x954a('0x3b')](_0x15c781[_0x954a('0x3c')],_0x954a('0x32'));return fs[_0x954a('0x3d')](_0x49c4d6,_0x340625,function(_0x14a003){_0x509b0f(_0x14a003);},function(_0x597309){fs[_0x954a('0x2d')](_0x49c4d6,'777');_0x485059(_0x597309);});});})[_0x954a('0x2c')](function(_0x51f87e){_0x2fb688=path[_0x954a('0x27')](__dirname,_0x954a('0x28'),rs[_0x954a('0x29')](0x4)+'.wav');return convertFile(_0x49c4d6,_0x2fb688);})[_0x954a('0x2c')](function(){try{fs['unlink'](_0x49c4d6);fs['chmodSync'](_0x2fb688,_0x954a('0x2e'));}catch(_0x5e74f4){logger['error'](_0x5e74f4);}logger[_0x954a('0x24')](_0x954a('0x3e'),_0x2fb688[_0x954a('0x2f')]('.')[0x0]);return _0x2fb688[_0x954a('0x2f')]('.')[0x0];});};exports[_0x954a('0x3f')]=function(_0x40213d,_0x8a5d8e){var _0x462e1a=_0x954a('0x40');var _0x2c6856,_0x115cc6;var _0x59abcc;var _0x999c07={'encoding':_0x954a('0x41'),'method':_0x954a('0x42'),'timeout':0x2710,'url':_0x462e1a,'headers':{'Content-Type':_0x954a('0x43')},'body':'f.req='+encodeURIComponent(JSON[_0x954a('0x44')]([[[_0x954a('0x45'),JSON['stringify']([_0x40213d,_0x8a5d8e||'en',![],'null']),null,_0x954a('0x46')]]]))};return rp(_0x999c07)[_0x954a('0x2c')](function(_0x241c68){try{_0x59abcc=eval(_0x241c68[_0x954a('0x47')](0x5))[0x0][0x2];}catch(_0x31908d){throw new Error(_0x954a('0x48')+_0x241c68[_0x954a('0x21')]);}if(!_0x59abcc){if(_0x40213d[_0x954a('0x49')]>0xc8){throw new Error(_0x954a('0x4a'));}else{throw new Error(_0x954a('0x4b')+_0x8a5d8e+_0x954a('0x4c'));}}try{_0x59abcc=eval(_0x59abcc)[0x0];}catch(_0x2beb91){throw new Error(_0x954a('0x48')+res[_0x954a('0x21')]);}const _0x6cdab8=_0x59abcc;_0x2c6856=path[_0x954a('0x27')](__dirname,_0x954a('0x28'),rs[_0x954a('0x29')](0x4)+_0x954a('0x3a'));fs['writeFileSync'](_0x2c6856,_0x59abcc,{'encoding':_0x954a('0x32')});_0x115cc6=path[_0x954a('0x27')](__dirname,'tmp',rs[_0x954a('0x29')](0x4)+_0x954a('0x2a'));return convertFile(_0x2c6856,_0x115cc6);})[_0x954a('0x2c')](function(){try{fs[_0x954a('0x4d')](_0x2c6856);fs[_0x954a('0x2d')](_0x115cc6,_0x954a('0x2e'));}catch(_0x582328){logger['error'](_0x582328);}logger['info'](_0x954a('0x4e'),_0x115cc6['split']('.')[0x0]);return _0x115cc6[_0x954a('0x2f')]('.')[0x0];});};exports[_0x954a('0x4f')]=function(_0x1a277d,_0x55cd31,_0x2ff12e){return google[_0x954a('0x50')](_0x1a277d,_0x55cd31,_0x2ff12e)[_0x954a('0x2c')](function(_0xf757ec){logger['info'](_0xf757ec[_0x954a('0x51')]);return rp(_0xf757ec);})['then'](function(_0x32a018){var _0x2efb20='';var _0x9d5716=0x0;try{fs[_0x954a('0x4d')](_0x1a277d);}catch(_0x5d94a5){logger[_0x954a('0x18')](_0x5d94a5);}if(_0x32a018&&_0x32a018['results']){_0x2efb20=_0x32a018[_0x954a('0x52')][_0x954a('0x53')](function(_0x5b1ccd){return _0x5b1ccd&&_0x5b1ccd['alternatives'][0x0]&&_0x5b1ccd[_0x954a('0x54')][0x0][_0x954a('0x55')]?_0x5b1ccd[_0x954a('0x54')][0x0]['transcript']:'';})[_0x954a('0x56')]('\x0a');_0x9d5716=_0x32a018[_0x954a('0x52')][_0x954a('0x53')](function(_0x4f60d1){return _0x4f60d1&&_0x4f60d1['alternatives'][0x0]&&_0x4f60d1[_0x954a('0x54')][0x0]['confidence']?_0x4f60d1[_0x954a('0x54')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x954a('0x24')]('googleASR\x20transcription',_0x2efb20);logger[_0x954a('0x24')](_0x954a('0x57'),_0x9d5716);return{'transcript':_0x2efb20,'confidence':_0x9d5716};})[_0x954a('0x58')](function(_0x51a02c){logger['error'](_0x954a('0x59'),_0x51a02c[_0x954a('0x17')],_0x51a02c['name'],_0x51a02c[_0x954a('0x5a')]);});};exports[_0x954a('0x5b')]=function(_0x4cb518,_0x4921e5,_0x1c7f65,_0x17a12f){var _0x2a0883=apiai(_0x4921e5,{'language':_0x17a12f||'en'});return _0x2a0883['textRequest'](_0x1c7f65,{'sessionId':md5(_0x4cb518)})['then'](function(_0x32777c){logger['info'](JSON[_0x954a('0x44')](_0x32777c));return{'source':_0x32777c[_0x954a('0x5c')][_0x954a('0x5d')],'resolvedQuery':_0x32777c['result']['resolvedQuery'],'action':_0x32777c[_0x954a('0x5c')][_0x954a('0x5e')],'actionIncomplete':_0x32777c['result']['actionIncomplete'],'speech':_0x32777c['result'][_0x954a('0x5f')]['speech'],'score':_0x32777c[_0x954a('0x5c')]['score'],'statusCode':_0x32777c[_0x954a('0x60')][_0x954a('0x61')],'endConversation':_0x32777c['result']['metadata'][_0x954a('0x62')]||![],'isFallbackIntent':_0x32777c[_0x954a('0x5c')][_0x954a('0x63')]['isFallbackIntent']};});};exports[_0x954a('0x64')]=function(_0x2cf42f,_0x5297f9,_0x342a24,_0x538d63,_0x15f8f7,_0x464e73){var _0xd41b79=_0x538d63['replace'](/\\n/g,'\x0a');var _0x5ead22={'credentials':{'private_key':_0xd41b79,'client_email':_0x342a24}};var _0xe8b4a8=new dialogflow['SessionsClient'](_0x5ead22);var _0x5d1012=_0xe8b4a8[_0x954a('0x65')](_0x5297f9,md5(_0x2cf42f));var _0x5a6950={'session':_0x5d1012,'queryInput':{'text':{'text':_0x15f8f7,'languageCode':_0x464e73}}};return _0xe8b4a8['detectIntent'](_0x5a6950)[_0x954a('0x2c')](function(_0x1ee7e9){if(_0x1ee7e9&&_0x1ee7e9[_0x954a('0x49')]){logger[_0x954a('0x24')](_0x954a('0x66'),JSON['stringify'](_0x1ee7e9));var _0x419d29=_0x1ee7e9[0x0];if(_0x419d29){var _0x719c95={'action':_0x419d29['queryResult'][_0x954a('0x5e')],'allRequiredParamsPresent':_0x419d29[_0x954a('0x67')]['allRequiredParamsPresent'],'endConversation':_0x419d29[_0x954a('0x67')][_0x954a('0x68')]&&_0x419d29['queryResult']['diagnosticInfo'][_0x954a('0x69')]?_0x419d29[_0x954a('0x67')]['diagnosticInfo'][_0x954a('0x69')]['end_conversation'][_0x954a('0x6a')]:![],'fulfillmentText':_0x419d29[_0x954a('0x67')][_0x954a('0x6b')],'intentName':_0x419d29[_0x954a('0x67')][_0x954a('0x6c')][_0x954a('0x6d')],'intentDisplayName':_0x419d29[_0x954a('0x67')][_0x954a('0x6c')][_0x954a('0x6e')],'isFallbackIntent':_0x419d29[_0x954a('0x67')]['intent'][_0x954a('0x6f')],'languageCode':_0x419d29[_0x954a('0x67')]['languageCode'],'queryText':_0x419d29[_0x954a('0x67')]['queryText'],'responseId':_0x419d29[_0x954a('0x70')],'score':_0x419d29[_0x954a('0x67')][_0x954a('0x71')],'speech':_0x419d29['queryResult'][_0x954a('0x6b')],'providerResponse':JSON[_0x954a('0x44')](_0x1ee7e9)};return _0x719c95;}}});};exports[_0x954a('0x72')]=function(_0x18cc02,_0x74d9dd,_0x37693a,_0x272f98){return tilde['asr'](_0x18cc02,_0x74d9dd,_0x37693a,_0x272f98)[_0x954a('0x2c')](function(_0x555a80){try{fs['unlink'](_0x18cc02);}catch(_0x3a0cde){logger[_0x954a('0x18')](_0x3a0cde);}logger[_0x954a('0x24')](_0x954a('0x73'),_0x555a80[_0x954a('0x55')]);logger[_0x954a('0x24')](_0x954a('0x74'),_0x555a80[_0x954a('0x75')]);return _0x555a80;});};exports[_0x954a('0x76')]=function(_0x25699e,_0x57c8b3,_0x359ec5,_0x4b22de,_0x16bca6,_0x76caf1){var _0x1fdca7=path[_0x954a('0x27')](__dirname,_0x954a('0x28'),rs[_0x954a('0x29')](0x4)+_0x954a('0x3a'));var _0x1e8d48;return aws[_0x954a('0x77')](_0x25699e,_0x57c8b3,_0x359ec5,_0x4b22de,_0x16bca6,_0x76caf1,_0x1fdca7)[_0x954a('0x2c')](function(){_0x1e8d48=path['resolve'](__dirname,'tmp',rs[_0x954a('0x29')](0x4)+_0x954a('0x2a'));return convertFile(_0x1fdca7,_0x1e8d48);})[_0x954a('0x2c')](function(){try{fs[_0x954a('0x4d')](_0x1fdca7);fs[_0x954a('0x2d')](_0x1e8d48,_0x954a('0x2e'));}catch(_0x2f0711){logger[_0x954a('0x18')](_0x2f0711);}return _0x1e8d48[_0x954a('0x2f')]('.')[0x0];});};exports['awsLex']=function(_0x2d49c6,_0x402bf1,_0x433fa0,_0x59eb6f,_0x341ab3,_0x57e1bd){return aws[_0x954a('0x78')](_0x2d49c6,_0x402bf1,_0x433fa0,_0x59eb6f,_0x341ab3,_0x57e1bd)[_0x954a('0x2c')](function(_0x56c9bb){logger[_0x954a('0x24')](JSON['stringify'](_0x56c9bb));return _0x56c9bb;});};exports[_0x954a('0x79')]=function(_0x8a3eb7,_0xe0d78b,_0x37605f,_0x83a4e2){var _0x3e6f69=util[_0x954a('0x7a')](_0x954a('0x7b'),ISPEECH_API,_0x8a3eb7,encodeURIComponent(_0xe0d78b),_0x37605f,_0x83a4e2);var _0x3e141c=path['resolve'](__dirname,'tmp',rs[_0x954a('0x29')](0x4)+_0x954a('0x3a'));var _0x1321d2;return downloadFile(_0x3e6f69,_0x3e141c)[_0x954a('0x2c')](function(){_0x1321d2=path[_0x954a('0x27')](__dirname,_0x954a('0x28'),rs[_0x954a('0x29')](0x4)+'.wav');return convertFile(_0x3e141c,_0x1321d2);})[_0x954a('0x2c')](function(){try{fs['unlink'](_0x3e141c);fs[_0x954a('0x2d')](_0x1321d2,_0x954a('0x2e'));}catch(_0x56cc5a){logger[_0x954a('0x18')](_0x56cc5a);}return _0x1321d2[_0x954a('0x2f')]('.')[0x0];});};exports[_0x954a('0x7c')]=function(_0x35d187,_0xde680d,_0x3c6f52,_0x2414a0){var _0x4bf73a=util[_0x954a('0x7a')](_0x954a('0x7d'),ISPEECH_API,_0xde680d,_0x3c6f52,base64Encode(_0x35d187),_0x2414a0?util['format'](_0x954a('0x7e'),encodeURIComponent(_0x2414a0)):_0x954a('0x7f'));return uploadFile(_0x4bf73a)['then'](function(_0x2de6e3){return querystring['parse'](_0x2de6e3);});};exports['sestekNDA']=function(_0xfaaf27,_0x19bfb7){return sestek[_0x954a('0x80')](_0xfaaf27,_0x19bfb7)['then'](function(_0x5eba31){logger[_0x954a('0x24')](JSON[_0x954a('0x44')](_0x5eba31));var _0x4bbf6b={'speech':_0x5eba31[_0x954a('0x81')],'action':_0x5eba31[_0x954a('0x82')]?_0x5eba31[_0x954a('0x82')][_0x954a('0x83')]:undefined,'actiondata':_0x5eba31['channelData']?_0x5eba31[_0x954a('0x82')]['CustomActionData']:undefined};if(_0x5eba31[_0x954a('0x82')]&&_0x5eba31['channelData'][_0x954a('0x84')]){return base64Decode(_0x5eba31[_0x954a('0x82')][_0x954a('0x84')][_0x954a('0x85')],path[_0x954a('0x27')](__dirname,'tmp',rs[_0x954a('0x29')](0x4)+_0x954a('0x2a')))[_0x954a('0x2c')](function(_0x1219ed){_0x4bbf6b[_0x954a('0x86')]=_0x1219ed;return _0x4bbf6b;});}return _0x4bbf6b;});};exports[_0x954a('0x87')]=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 0407e79..0d84f6e 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 _0x3142=['./nda','exports'];(function(_0x3b000c,_0x12346e){var _0x383708=function(_0x2e9911){while(--_0x2e9911){_0x3b000c['push'](_0x3b000c['shift']());}};_0x383708(++_0x12346e);}(_0x3142,0xce));var _0x2314=function(_0xef8d0,_0x1ef7c9){_0xef8d0=_0xef8d0-0x0;var _0x13e9f1=_0x3142[_0xef8d0];return _0x13e9f1;};var nda=require(_0x2314('0x0'));module[_0x2314('0x1')]={'nda':nda}; \ No newline at end of file +var _0x0718=['./nda','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x0718,0x168));var _0x8071=function(_0x322387,_0x4a33a0){_0x322387=_0x322387-0x0;var _0x5b3b45=_0x0718[_0x322387];return _0x5b3b45;};var nda=require(_0x8071('0x0'));module[_0x8071('0x1')]={'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 9464c6e..504035a 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 _0x3276=['body','channelData','ProjectName','ndagenerate_audio','audio/wav','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','agi','exports','POST','resolve','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project'];(function(_0x286d78,_0x2e1e90){var _0x1c6b35=function(_0x17b89a){while(--_0x17b89a){_0x286d78['push'](_0x286d78['shift']());}};_0x1c6b35(++_0x2e1e90);}(_0x3276,0xc7));var _0x6327=function(_0xd44e58,_0x22823e){_0xd44e58=_0xd44e58-0x0;var _0x38b8cd=_0x3276[_0xd44e58];return _0x38b8cd;};'use strict';var rp=require(_0x6327('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x6327('0x1'));module[_0x6327('0x2')]=function(_0x23e033,_0x1ca8a6){var _0x270378={'method':_0x6327('0x3'),'uri':url[_0x6327('0x4')](_0x1ca8a6['ndauth_url'],'/token'),'form':{'grant_type':_0x6327('0x5'),'username':_0x1ca8a6[_0x6327('0x6')],'password':_0x1ca8a6[_0x6327('0x5')]},'json':!![]};return rp(_0x270378)['then'](function(_0x29ba24){var _0x3e9616={'method':_0x6327('0x3'),'uri':url[_0x6327('0x4')](_0x1ca8a6['ndassistant_url'],_0x6327('0x7')),'body':{'type':_0x1ca8a6[_0x6327('0x8')]||'message','channelId':_0x6327('0x9'),'conversation':{'id':_0x23e033[_0x6327('0xa')]},'from':{'id':_0x23e033['callerid'],'name':_0x23e033[_0x6327('0xb')]},'recipient':{'id':_0x23e033[_0x6327('0xc')],'name':_0x23e033[_0x6327('0xd')]},'text':_0x1ca8a6['text'],'channelData':{}},'headers':{'Authorization':_0x6327('0xe')+_0x29ba24[_0x6327('0xf')]},'json':!![]};if(_0x1ca8a6[_0x6327('0x10')]){_0x3e9616[_0x6327('0x11')][_0x6327('0x12')][_0x6327('0x13')]=_0x1ca8a6[_0x6327('0x10')];}if(_0x1ca8a6[_0x6327('0x14')]=='1'){_0x3e9616[_0x6327('0x11')][_0x6327('0x12')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6327('0x15')};}if(_0x1ca8a6['custom_action']){_0x3e9616[_0x6327('0x11')][_0x6327('0x12')][_0x6327('0x16')]=_0x1ca8a6['custom_action'];if(_0x1ca8a6[_0x6327('0x17')]){_0x3e9616[_0x6327('0x11')][_0x6327('0x12')][_0x6327('0x18')]=_0x1ca8a6[_0x6327('0x17')];}}logger[_0x6327('0x19')](JSON[_0x6327('0x1a')](_0x3e9616));return rp(_0x3e9616);});}; \ No newline at end of file +var _0xe706=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','custom_action','info','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then'];(function(_0x3970d9,_0x43e60d){var _0x42ff83=function(_0x4505cf){while(--_0x4505cf){_0x3970d9['push'](_0x3970d9['shift']());}};_0x42ff83(++_0x43e60d);}(_0xe706,0xa3));var _0x6e70=function(_0x4a5195,_0x20603e){_0x4a5195=_0x4a5195-0x0;var _0x30908e=_0xe706[_0x4a5195];return _0x30908e;};'use strict';var rp=require(_0x6e70('0x0'));var url=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('agi');module[_0x6e70('0x3')]=function(_0x315629,_0x2ca810){var _0x7dfbc3={'method':_0x6e70('0x4'),'uri':url[_0x6e70('0x5')](_0x2ca810[_0x6e70('0x6')],_0x6e70('0x7')),'form':{'grant_type':_0x6e70('0x8'),'username':_0x2ca810[_0x6e70('0x9')],'password':_0x2ca810[_0x6e70('0x8')]},'json':!![]};return rp(_0x7dfbc3)[_0x6e70('0xa')](function(_0x45a2d4){var _0x188ed3={'method':_0x6e70('0x4'),'uri':url[_0x6e70('0x5')](_0x2ca810[_0x6e70('0xb')],_0x6e70('0xc')),'body':{'type':_0x2ca810[_0x6e70('0xd')]||_0x6e70('0xe'),'channelId':_0x6e70('0xf'),'conversation':{'id':_0x315629[_0x6e70('0x10')]},'from':{'id':_0x315629[_0x6e70('0x11')],'name':_0x315629[_0x6e70('0x12')]},'recipient':{'id':_0x315629['dnid'],'name':_0x315629['extension']},'text':_0x2ca810[_0x6e70('0x13')],'channelData':{}},'headers':{'Authorization':_0x6e70('0x14')+_0x45a2d4[_0x6e70('0x15')]},'json':!![]};if(_0x2ca810[_0x6e70('0x16')]){_0x188ed3[_0x6e70('0x17')][_0x6e70('0x18')][_0x6e70('0x19')]=_0x2ca810[_0x6e70('0x16')];}if(_0x2ca810['ndagenerate_audio']=='1'){_0x188ed3['body']['channelData'][_0x6e70('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2ca810['custom_action']){_0x188ed3[_0x6e70('0x17')][_0x6e70('0x18')]['CustomAction']=_0x2ca810[_0x6e70('0x1b')];if(_0x2ca810['custom_action_data']){_0x188ed3[_0x6e70('0x17')][_0x6e70('0x18')]['CustomActionData']=_0x2ca810['custom_action_data'];}}logger[_0x6e70('0x1c')](JSON['stringify'](_0x188ed3));return rp(_0x188ed3);});}; \ 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 e045511..bcbcdad 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 _0xdc8b=['./lib/api'];(function(_0x243754,_0x5d0260){var _0x4d774f=function(_0x58557f){while(--_0x58557f){_0x243754['push'](_0x243754['shift']());}};_0x4d774f(++_0x5d0260);}(_0xdc8b,0x6d));var _0xbdc8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdc8b[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0xbdc8('0x0'));module['exports']=function(_0x876fe2,_0x9297bd,_0x2b9f68,_0x321e65){return asr(_0x876fe2,_0x9297bd,_0x2b9f68,_0x321e65);}; \ No newline at end of file +var _0x8173=['exports','./lib/api'];(function(_0x21ce6c,_0x116ac2){var _0x4d4cb3=function(_0x22e1fe){while(--_0x22e1fe){_0x21ce6c['push'](_0x21ce6c['shift']());}};_0x4d4cb3(++_0x116ac2);}(_0x8173,0x1db));var _0x3817=function(_0x165ef3,_0x3c7bd6){_0x165ef3=_0x165ef3-0x0;var _0x5d9945=_0x8173[_0x165ef3];return _0x5d9945;};'use strict';var asr=require(_0x3817('0x0'));module[_0x3817('0x1')]=function(_0x4ff507,_0x34c605,_0x177ac7,_0x165db8){return asr(_0x4ff507,_0x34c605,_0x177ac7,_0x165db8);}; \ 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 e178692..30d4a48 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 _0x4420=['error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS'];(function(_0x1ed496,_0x634f07){var _0x2324fd=function(_0x10f61){while(--_0x10f61){_0x1ed496['push'](_0x1ed496['shift']());}};_0x2324fd(++_0x634f07);}(_0x4420,0x1b6));var _0x0442=function(_0x51acb3,_0x1afabd){_0x51acb3=_0x51acb3-0x0;var _0x213b78=_0x4420[_0x51acb3];return _0x213b78;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0442('0x0'));var crypto=require(_0x0442('0x1'));var logger=require('../../../../../../config/logger')(_0x0442('0x2'));module[_0x0442('0x3')]=function(_0xbcaaa,_0xd7b2e3,_0x56e772,_0x310ca2){return new BPromise(function(_0x183526,_0x4d0a92){logger[_0x0442('0x4')](_0x0442('0x5'),_0x310ca2||_0x0442('0x6'));var _0x3a3121=new WebSocket(_0x310ca2||_0x0442('0x6'),{'perMessageDeflate':![]});var _0x264289='';var _0x2332e7='0';var _0x476dea='1';var _0x4aa5f6=_0x0442('0x7');function _0x4747ed(_0xdffc01){var _0x46952a=crypto[_0x0442('0x8')]('sha1');_0x46952a[_0x0442('0x9')](_0xdffc01);return _0x46952a['digest'](_0x0442('0xa'));}function _0x28dc86(){try{logger[_0x0442('0x4')](_0x0442('0xb'));var _0x497b97=moment()[_0x0442('0xc')]();var _0x386f49=_0x4747ed(_0x497b97+_0xd7b2e3+_0x56e772);_0x3a3121[_0x0442('0xd')](JSON[_0x0442('0xe')]({'appID':_0xd7b2e3,'timestamp':_0x497b97,'appKey':_0x386f49}));var _0x4da3dd=fs[_0x0442('0xf')](_0xbcaaa);_0x4da3dd['on'](_0x0442('0x10'),function(_0x54a7f9){_0x3a3121['send'](_0x54a7f9);});_0x4da3dd['on']('close',function(){_0x3a3121['send'](_0x0442('0x11'));});}catch(_0x22ffe3){logger[_0x0442('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x0442('0xe')](_0x22ffe3));_0x3a3121[_0x0442('0x13')]();}}function _0x22fddd(_0x4379c6){try{if(_0x4379c6){var _0x170d40=JSON['parse'](_0x4379c6);switch(_0x170d40[_0x0442('0x14')]){case 0x0:if(_0x170d40[_0x0442('0x15')]){if(_0x170d40[_0x0442('0x15')][_0x0442('0x16')]){logger[_0x0442('0x4')](_0x0442('0x17'),JSON['stringify'](_0x170d40[_0x0442('0x15')]['hypotheses']));_0x264289=_0x170d40['result'][_0x0442('0x18')][0x0][_0x0442('0x19')];_0x2332e7=_0x170d40[_0x0442('0x15')][_0x0442('0x18')][0x0][_0x0442('0x1a')];_0x476dea='0';_0x4aa5f6=_0x0442('0x1b');_0x3a3121[_0x0442('0x13')]();}}break;case 0x1:logger[_0x0442('0x4')](_0x0442('0x7'));_0x476dea='1';_0x4aa5f6=_0x0442('0x7');break;case 0x2:logger[_0x0442('0x4')](_0x0442('0x1c'));_0x476dea='2';_0x4aa5f6=_0x0442('0x1c');break;case 0x9:logger[_0x0442('0x4')](_0x0442('0x1d'));_0x476dea='9';_0x4aa5f6=_0x0442('0x1d');break;case 0xa:logger[_0x0442('0x4')]('Authentication\x20failed.');_0x476dea='10';_0x4aa5f6=_0x0442('0x1e');break;case 0xb:logger['info'](_0x0442('0x1f'));_0x476dea='11';_0x4aa5f6=_0x0442('0x1f');}}}catch(_0x146b6d){logger[_0x0442('0x12')](_0x0442('0x20'),JSON[_0x0442('0xe')](_0x146b6d));_0x3a3121[_0x0442('0x13')]();}}function _0x35f34f(){logger[_0x0442('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x183526({'transcript':_0x264289,'confidence':_0x2332e7,'status':_0x476dea,'status_message':_0x4aa5f6});}function _0x1eca86(_0x5511e5){logger['error'](_0x0442('0x21'));if(!_[_0x0442('0x22')](_0x5511e5)){logger[_0x0442('0x12')](_[_0x0442('0x23')](_0x5511e5)?JSON['stringify'](_0x5511e5):_0x5511e5);}}_0x3a3121['on'](_0x0442('0x24'),_0x28dc86);_0x3a3121['on'](_0x0442('0x25'),_0x22fddd);_0x3a3121['on']('close',_0x35f34f);_0x3a3121['on'](_0x0442('0x12'),_0x1eca86);});}; \ No newline at end of file +var _0xbf90=['exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','../../../../../../config/logger'];(function(_0xafb4d3,_0x43eb04){var _0x305429=function(_0x14f466){while(--_0x14f466){_0xafb4d3['push'](_0xafb4d3['shift']());}};_0x305429(++_0x43eb04);}(_0xbf90,0x1eb));var _0x0bf9=function(_0x10642e,_0x275ca){_0x10642e=_0x10642e-0x0;var _0x2f5459=_0xbf90[_0x10642e];return _0x2f5459;};'use strict';var BPromise=require(_0x0bf9('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0bf9('0x1'));var crypto=require('crypto');var logger=require(_0x0bf9('0x2'))('agi');module[_0x0bf9('0x3')]=function(_0x33c88d,_0x5c4a52,_0x14df0f,_0x157066){return new BPromise(function(_0x5a36a6,_0x1488f9){logger[_0x0bf9('0x4')]('Tilde\x20URI',_0x157066||_0x0bf9('0x5'));var _0x4b459d=new WebSocket(_0x157066||_0x0bf9('0x5'),{'perMessageDeflate':![]});var _0x32ba2e='';var _0x49dbe2='0';var _0x1a2bc6='1';var _0x4f6f07=_0x0bf9('0x6');function _0x4757b0(_0x150c9c){var _0x4fadf4=crypto[_0x0bf9('0x7')](_0x0bf9('0x8'));_0x4fadf4[_0x0bf9('0x9')](_0x150c9c);return _0x4fadf4[_0x0bf9('0xa')](_0x0bf9('0xb'));}function _0x2e7be8(){try{logger['info'](_0x0bf9('0xc'));var _0x13f2c4=moment()[_0x0bf9('0xd')]();var _0x2e38c4=_0x4757b0(_0x13f2c4+_0x5c4a52+_0x14df0f);_0x4b459d[_0x0bf9('0xe')](JSON[_0x0bf9('0xf')]({'appID':_0x5c4a52,'timestamp':_0x13f2c4,'appKey':_0x2e38c4}));var _0x555048=fs[_0x0bf9('0x10')](_0x33c88d);_0x555048['on']('data',function(_0x33669f){_0x4b459d['send'](_0x33669f);});_0x555048['on']('close',function(){_0x4b459d[_0x0bf9('0xe')]('EOS');});}catch(_0x49d4ba){logger[_0x0bf9('0x11')](_0x0bf9('0x12'),JSON[_0x0bf9('0xf')](_0x49d4ba));_0x4b459d['terminate']();}}function _0x4b3502(_0x46ae8b){try{if(_0x46ae8b){var _0x34f65a=JSON[_0x0bf9('0x13')](_0x46ae8b);switch(_0x34f65a[_0x0bf9('0x14')]){case 0x0:if(_0x34f65a[_0x0bf9('0x15')]){if(_0x34f65a['result'][_0x0bf9('0x16')]){logger[_0x0bf9('0x4')](_0x0bf9('0x17'),JSON['stringify'](_0x34f65a[_0x0bf9('0x15')][_0x0bf9('0x18')]));_0x32ba2e=_0x34f65a[_0x0bf9('0x15')][_0x0bf9('0x18')][0x0][_0x0bf9('0x19')];_0x49dbe2=_0x34f65a['result'][_0x0bf9('0x18')][0x0][_0x0bf9('0x1a')];_0x1a2bc6='0';_0x4f6f07=_0x0bf9('0x1b');_0x4b459d[_0x0bf9('0x1c')]();}}break;case 0x1:logger[_0x0bf9('0x4')](_0x0bf9('0x6'));_0x1a2bc6='1';_0x4f6f07=_0x0bf9('0x6');break;case 0x2:logger[_0x0bf9('0x4')](_0x0bf9('0x1d'));_0x1a2bc6='2';_0x4f6f07=_0x0bf9('0x1d');break;case 0x9:logger[_0x0bf9('0x4')](_0x0bf9('0x1e'));_0x1a2bc6='9';_0x4f6f07=_0x0bf9('0x1e');break;case 0xa:logger[_0x0bf9('0x4')](_0x0bf9('0x1f'));_0x1a2bc6='10';_0x4f6f07='Authentication\x20failed.';break;case 0xb:logger[_0x0bf9('0x4')](_0x0bf9('0x20'));_0x1a2bc6='11';_0x4f6f07=_0x0bf9('0x20');}}}catch(_0x28d66f){logger[_0x0bf9('0x11')](_0x0bf9('0x21'),JSON['stringify'](_0x28d66f));_0x4b459d['terminate']();}}function _0x30a1b1(){logger[_0x0bf9('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x5a36a6({'transcript':_0x32ba2e,'confidence':_0x49dbe2,'status':_0x1a2bc6,'status_message':_0x4f6f07});}function _0x32952e(_0x3a1f8a){logger['error'](_0x0bf9('0x22'));if(!_[_0x0bf9('0x23')](_0x3a1f8a)){logger[_0x0bf9('0x11')](_['isObject'](_0x3a1f8a)?JSON[_0x0bf9('0xf')](_0x3a1f8a):_0x3a1f8a);}}_0x4b459d['on'](_0x0bf9('0x24'),_0x2e7be8);_0x4b459d['on'](_0x0bf9('0x25'),_0x4b3502);_0x4b459d['on']('close',_0x30a1b1);_0x4b459d['on']('error',_0x32952e);});}; \ 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 3793f53..98cbb74 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 _0xcac0=['exports','./asr'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xcac0,0xb3));var _0x0cac=function(_0x52f9ce,_0x4a7845){_0x52f9ce=_0x52f9ce-0x0;var _0x36f765=_0xcac0[_0x52f9ce];return _0x36f765;};var asr=require(_0x0cac('0x0'));module[_0x0cac('0x1')]={'asr':asr}; \ No newline at end of file +var _0xcecc=['./asr','exports'];(function(_0xe54275,_0x5a059c){var _0x3cf6c0=function(_0x37f96d){while(--_0x37f96d){_0xe54275['push'](_0xe54275['shift']());}};_0x3cf6c0(++_0x5a059c);}(_0xcecc,0x16a));var _0xccec=function(_0x579da2,_0x5d454a){_0x579da2=_0x579da2-0x0;var _0x3bda3c=_0xcecc[_0x579da2];return _0x3bda3c;};var asr=require(_0xccec('0x0'));module[_0xccec('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 65a14bb..880c18b 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0xd4f97a,_0x38f31c){var _0x1cea9a=function(_0x1ab595){while(--_0x1ab595){_0xd4f97a['push'](_0xd4f97a['shift']());}};_0x1cea9a(++_0x38f31c);}(_0x34e8,0x12c));var _0x834e=function(_0x285791,_0x1d2a2c){_0x285791=_0x285791-0x0;var _0x484bba=_0x34e8[_0x285791];return _0x484bba;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ 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(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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 268b898..85a7505 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 _0x688a=['grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','command','args','Wait\x20%s\x20seconds\x20before\x20answer','answer','no\x20list\x20selected','delay','add','minutes','sync','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','toUpperCase','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','googleDialogflowV2','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','bot','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','generate','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','forEach','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','randomstring','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','channel','prototype','getVariable','rpc','getVariableById','catch','getVoiceQueue','getSquareProject','getSquareProjectById','name','getSquareOdbc','dsn','getUser','getUserById','then','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','sendMailMessage','mailRpc','getIntervals','IntervalId','interval','map','open','error','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','format','%s/%s@from-sip/n','LOCAL','shellCommand','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','googleTTS','google_tts_language','method','timeout','number','includes','POST','PUT','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','isPlainObject','%s.%s','saveRestApiResult','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block'];(function(_0x2bb2d3,_0x333629){var _0x40805d=function(_0x313689){while(--_0x313689){_0x2bb2d3['push'](_0x2bb2d3['shift']());}};_0x40805d(++_0x333629);}(_0x688a,0x124));var _0xa688=function(_0x2bb9dc,_0x41562d){_0x2bb9dc=_0x2bb9dc-0x0;var _0xcb47af=_0x688a[_0x2bb9dc];return _0xcb47af;};'use strict';var fs=require('fs');var util=require(_0xa688('0x0'));var _=require(_0xa688('0x1'));var sh=require(_0xa688('0x2'));var odbc=require('odbc')();var rs=require(_0xa688('0x3'));var moment=require('moment');var Mustache=require(_0xa688('0x4'));var rp=require(_0xa688('0x5'));var logger=require('../../config/logger')(_0xa688('0x6'));var config=require(_0xa688('0x7'));var shared=require(_0xa688('0x8'));var scripts=require(_0xa688('0x9'));var FILES_PATH=_0xa688('0xa');var recursiveMapAttributes=[_0xa688('0xb'),'rawBody'];var verticesWithRetry=['menu',_0xa688('0xc'),_0xa688('0xd')];var AGIVertices=function(_0x1ab9f2,_0x5c3bc6,_0x4d3b92){this[_0xa688('0xe')]=_0x1ab9f2;this['rpc']=_0x5c3bc6;this['mailRpc']=_0x4d3b92;};AGIVertices[_0xa688('0xf')][_0xa688('0x10')]=function(_0x2d66d9,_0x13be99){this[_0xa688('0x11')][_0xa688('0x12')](_0x2d66d9)['then'](function(_0x47cb16){_0x13be99(null,_0x47cb16?_0x47cb16['name']:![]);})[_0xa688('0x13')](function(_0x33eed4){_0x13be99(_0x33eed4);});};AGIVertices['prototype'][_0xa688('0x14')]=function(_0x5044c7,_0x10c371){this[_0xa688('0x11')]['getVoiceQueueById'](_0x5044c7)['then'](function(_0x2d4871){_0x10c371(null,_0x2d4871?_0x2d4871['name']:![]);})[_0xa688('0x13')](function(_0x5b8b1f){_0x10c371(_0x5b8b1f);});};AGIVertices[_0xa688('0xf')][_0xa688('0x15')]=function(_0x41082d,_0x25b453){this[_0xa688('0x11')][_0xa688('0x16')](_0x41082d)['then'](function(_0x59e392){_0x25b453(null,_0x59e392?_0x59e392[_0xa688('0x17')]:![]);})[_0xa688('0x13')](function(_0x5dc07f){_0x25b453(_0x5dc07f);});};AGIVertices['prototype'][_0xa688('0x18')]=function(_0x2085bf,_0x545c52){this[_0xa688('0x11')]['getSquareOdbcById'](_0x2085bf)['then'](function(_0x152cfe){_0x545c52(null,_0x152cfe?_0x152cfe[_0xa688('0x19')]:![]);})[_0xa688('0x13')](function(_0x27f12e){_0x545c52(_0x27f12e);});};AGIVertices[_0xa688('0xf')][_0xa688('0x1a')]=function(_0x7d9036,_0x203214){this[_0xa688('0x11')][_0xa688('0x1b')](_0x7d9036)[_0xa688('0x1c')](function(_0x301560){_0x203214(null,_0x301560?_0x301560[_0xa688('0x17')]:![]);})[_0xa688('0x13')](function(_0x48cb17){_0x203214(_0x48cb17);});};AGIVertices[_0xa688('0xf')][_0xa688('0x1d')]=function(_0x4fa15e,_0x2eb299){this[_0xa688('0x11')]['getTrunkById'](_0x4fa15e)[_0xa688('0x1c')](function(_0x3b09c9){_0x2eb299(null,_0x3b09c9?_0x3b09c9[_0xa688('0x17')]:![]);})[_0xa688('0x13')](function(_0x153a86){_0x2eb299(_0x153a86);});};AGIVertices[_0xa688('0xf')][_0xa688('0x1e')]=function(_0x286376,_0x3fa53f){var _0x100f14=this;this[_0xa688('0x11')][_0xa688('0x1f')](_0x286376)[_0xa688('0x1c')](function(_0x12a35a){_0x3fa53f(null,_0x12a35a?_0x100f14[_0xa688('0x20')](_0x12a35a['save_name']):![]);})[_0xa688('0x13')](function(_0x1bdd8e){_0x3fa53f(_0x1bdd8e);});};AGIVertices[_0xa688('0xf')][_0xa688('0x21')]=function(_0x3d52fc,_0x10fbce){this['rpc']['getMailAccountById'](_0x3d52fc)['then'](function(_0x1824d1){_0x10fbce(null,_0x1824d1?_0x1824d1:![]);})['catch'](function(_0x5d8753){_0x10fbce(_0x5d8753);});};AGIVertices[_0xa688('0xf')][_0xa688('0x22')]=function(_0x29e83c,_0x40bf1f,_0x197854){this[_0xa688('0x23')]['sendMailMessage'](_0x29e83c,_0x40bf1f)['then'](function(){_0x197854(null);})['catch'](function(_0x58d820){_0x197854(_0x58d820);});};AGIVertices[_0xa688('0xf')][_0xa688('0x24')]=function(_0x2218fb,_0x489c32){this[_0xa688('0x11')]['getIntervalById'](_0x2218fb)['then'](function(_0x4e6b59){if(_0x4e6b59){if(_0x4e6b59[_0xa688('0x25')]){_0x489c32(null,[_0x4e6b59[_0xa688('0x26')]]);}else{_0x489c32(null,_[_0xa688('0x27')](_0x4e6b59['Intervals'],'interval'));}}else{_0x489c32(null,![]);}})[_0xa688('0x13')](function(_0x42c27a){_0x489c32(_0x42c27a);});};AGIVertices[_0xa688('0xf')][_0xa688('0x20')]=function(_0x325f74){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x325f74);};AGIVertices[_0xa688('0xf')]['getQueryOdbc']=function(_0x11806b,_0x2f8f0d,_0x19e13b){odbc[_0xa688('0x28')](_0x11806b,function(_0x5a8074){if(_0x5a8074){logger[_0xa688('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5a8074);_0x19e13b(_0x5a8074);}else{logger['info'](_0xa688('0x2a'));odbc['query'](_0x2f8f0d,function(_0xb4a6f5,_0x5bb763){if(_0xb4a6f5){logger[_0xa688('0x2b')](_0xa688('0x2c'),_0x2f8f0d);_0x19e13b(_0xb4a6f5);}else{logger[_0xa688('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x2f8f0d);odbc[_0xa688('0x2d')](function(_0x3982e3){if(_0x3982e3){logger[_0xa688('0x29')](_0xa688('0x2e'),_0x3982e3);}_0x19e13b(null,_0x5bb763);});}});}});};AGIVertices[_0xa688('0xf')][_0xa688('0x2f')]=function(_0x30c831,_0x9d54a6){this[_0xa688('0x11')][_0xa688('0x30')](_0x30c831)[_0xa688('0x1c')](function(_0x4fe5b1){_0x9d54a6(null,_0x4fe5b1?_0x4fe5b1:![]);})[_0xa688('0x13')](function(_0x5436a8){_0x9d54a6(_0x5436a8);});};AGIVertices[_0xa688('0xf')][_0xa688('0x31')]=function(_0x1b901d,_0x3242fd){this['rpc'][_0xa688('0x31')](_0x1b901d)[_0xa688('0x1c')](function(_0x4b3bbd){_0x3242fd(null,_0x4b3bbd);})[_0xa688('0x13')](function(_0x1a7081){_0x3242fd(_0x1a7081);});};AGIVertices[_0xa688('0xf')][_0xa688('0x32')]=function(_0x3205d4,_0x1f9ce6,_0x2aac96){this[_0xa688('0x11')][_0xa688('0x32')]({'uniqueid':this['channel'][_0xa688('0x33')],'node':_0x3205d4[_0xa688('0x34')],'application':_0x3205d4[_0xa688('0x35')],'data':_0x1f9ce6||null,'project_name':this[_0xa688('0xe')][_0xa688('0x36')],'callerid':this[_0xa688('0xe')][_0xa688('0x37')]})[_0xa688('0x1c')](function(_0x52e48f){if(_0x2aac96){_0x2aac96(null,_0x52e48f);}})[_0xa688('0x13')](function(_0x23f07d){if(_0x2aac96){_0x2aac96(_0x23f07d);}});};AGIVertices[_0xa688('0xf')][_0xa688('0x38')]=function(_0x4f5cbd,_0x2c33ea,_0x243147,_0x5ce16d){this[_0xa688('0x11')][_0xa688('0x38')]({'uniqueid':this[_0xa688('0xe')][_0xa688('0x33')],'callerid':this[_0xa688('0xe')][_0xa688('0x37')],'calleridname':this['channel'][_0xa688('0x39')],'context':this[_0xa688('0xe')][_0xa688('0x3a')],'extension':this[_0xa688('0xe')][_0xa688('0x3b')],'priority':this['channel'][_0xa688('0x3c')],'accountcode':this[_0xa688('0xe')][_0xa688('0x3d')],'dnid':this[_0xa688('0xe')][_0xa688('0x3e')],'projectName':this[_0xa688('0xe')]['arg_1'],'saveName':_0x2c33ea,'filename':_0x4f5cbd[_0xa688('0x3f')]||_0x2c33ea,'savePath':_0x243147})[_0xa688('0x1c')](function(_0x249265){_0x5ce16d(null,_0x249265);})[_0xa688('0x13')](function(_0xc539d2){_0x5ce16d(_0xc539d2);});};AGIVertices[_0xa688('0xf')][_0xa688('0x40')]=function(_0x497ec3,_0x1e1d1d,_0x1e8758,_0x296a7d,_0x19b99e){this['rpc'][_0xa688('0x40')]({'uniqueid':this[_0xa688('0xe')][_0xa688('0x33')],'body':_0x497ec3,'direction':_0x1e1d1d,'providerName':_0x1e8758,'providerResponse':_0x296a7d})[_0xa688('0x1c')](function(_0x379903){if(_0x19b99e){_0x19b99e(null,_0x379903);}})[_0xa688('0x13')](function(_0x59172b){if(_0x19b99e){_0x19b99e(_0x59172b);}});};AGIVertices[_0xa688('0xf')]['createCmContact']=function(_0x132615,_0x58753e){this['rpc'][_0xa688('0x41')]({'firstName':_[_0xa688('0x42')](_0x132615[_0xa688('0x17')])||_['isNil'](_0x132615[_0xa688('0x17')])?'callback_'+Math['random']():_0x132615['name'],'lastName':_['isEmpty'](_0x132615['lastName'])||_[_0xa688('0x43')](_0x132615[_0xa688('0x44')])?null:_0x132615[_0xa688('0x44')],'phone':_0x132615['phone'],'ListId':_0x132615[_0xa688('0x45')],'scheduledat':_0x132615['scheduledAt'],'callbackUniqueid':this[_0xa688('0xe')][_0xa688('0x33')],'tags':_0xa688('0x46'),'description':_0xa688('0x47')+_0x132615[_0xa688('0x48')][_0xa688('0x49')](),'priority':_0x132615[_0xa688('0x4a')]})[_0xa688('0x1c')](function(_0x2571be){_0x58753e(null,_0x2571be);})[_0xa688('0x13')](function(_0x4e3025){_0x58753e(_0x4e3025);});};AGIVertices['prototype']['getPause']=function(_0x4bdb86,_0x26efbb){this[_0xa688('0x11')][_0xa688('0x4b')](_0x4bdb86)[_0xa688('0x1c')](function(_0x36a717){_0x26efbb(null,_0x36a717?_0x36a717[_0xa688('0x17')]:![]);})[_0xa688('0x13')](function(_0x35bfe4){_0x26efbb(_0x35bfe4);});};AGIVertices[_0xa688('0xf')][_0xa688('0x4c')]=function(_0x3a8b47,_0x3377ac,_0x43c2e8){var _0xa44aad={'role':'agent'};_0xa44aad[_0x3a8b47]=this['channel'][_0xa688('0x37')];this['rpc']['agentPause'](_0xa44aad,_0x3377ac,this[_0xa688('0xe')][_0xa688('0x33')])['then'](function(_0x40ceb7){_0x43c2e8(null,_['isNil'](_0x40ceb7)?![]:!![]);})[_0xa688('0x13')](function(_0x58496c){logger[_0xa688('0x29')](_0x58496c);_0x43c2e8(null,![]);});};AGIVertices['prototype'][_0xa688('0x4d')]=function(_0x1b52a4,_0x1acd66){var _0x2558e9={'role':'agent'};_0x2558e9[_0x1b52a4]=this[_0xa688('0xe')][_0xa688('0x37')];this[_0xa688('0x11')][_0xa688('0x4d')](_0x2558e9)['then'](function(_0x1d5160){_0x1acd66(null,_[_0xa688('0x43')](_0x1d5160)?![]:!![]);})['catch'](function(_0x50510b){logger[_0xa688('0x29')](_0x50510b);_0x1acd66(null,![]);});};AGIVertices[_0xa688('0xf')][_0xa688('0x4e')]=function(_0x3871dc,_0x2e82e0){var _0x9d35e5={'role':_0xa688('0x4f')};_0x9d35e5[_0x3871dc]=this[_0xa688('0xe')]['callerid'];this[_0xa688('0x11')][_0xa688('0x4e')](_0x9d35e5)[_0xa688('0x1c')](function(_0x56f0b7){_0x2e82e0(null,_[_0xa688('0x43')](_0x56f0b7)?![]:!![]);})[_0xa688('0x13')](function(_0x29910a){logger[_0xa688('0x29')](_0x29910a);_0x2e82e0(null,![]);});};AGIVertices[_0xa688('0xf')][_0xa688('0x50')]=function(_0x520228,_0x14e1b4){var _0x4c48c2={'role':_0xa688('0x4f')};_0x4c48c2[_0x520228]=this[_0xa688('0xe')][_0xa688('0x37')];var _0x25a74f=_0x520228!='internal'?util[_0xa688('0x51')](_0xa688('0x52'),_0xa688('0x53'),this['channel'][_0xa688('0x37')]):undefined;this['rpc'][_0xa688('0x50')](_0x4c48c2,_0x25a74f)[_0xa688('0x1c')](function(_0x180755){_0x14e1b4(null,_['isNil'](_0x180755)?![]:!![]);})[_0xa688('0x13')](function(_0x3d161d){logger[_0xa688('0x29')](_0x3d161d);_0x14e1b4(null,![]);});};AGIVertices[_0xa688('0xf')][_0xa688('0x54')]=function(_0x365bf7,_0x1cdde3){sh['exec'](_['trim'](_0x365bf7),function(_0x58e812,_0x31758e){var _0x4f07ef=_0x31758e[_0xa688('0x55')](/(\r\n|\n|\r)/gm,'');_0x1cdde3(null,_0x4f07ef);});};AGIVertices['prototype'][_0xa688('0x56')]=function(_0x40835d,_0x179b65){scripts[_0xa688('0x56')](_0x40835d[_0xa688('0x57')],_0x40835d[_0xa688('0x58')]||_0xa688('0x59'),_0x40835d[_0xa688('0x59')],_0x40835d[_0xa688('0x5a')]||'en-US',_0x40835d[_0xa688('0x5b')]||_0xa688('0x5c'),_0x40835d['audioEncoding']||'MP3')[_0xa688('0x1c')](function(_0x120d4c){_0x179b65(null,_0x120d4c);})['catch'](function(_0x3e6679){_0x179b65(_0x3e6679);});};AGIVertices[_0xa688('0xf')][_0xa688('0x5d')]=function(_0x54cffd,_0x553fd9){scripts[_0xa688('0x5d')](_0x54cffd[_0xa688('0x59')],_0x54cffd[_0xa688('0x5e')]||'en',0x1)[_0xa688('0x1c')](function(_0x1d35ec){_0x553fd9(null,_0x1d35ec);})[_0xa688('0x13')](function(_0x276fbd){_0x553fd9(_0x276fbd);});};AGIVertices['prototype']['restAPI']=function(_0x252967,_0x483f55){var _0x18bf56={'uri':_0x252967['url'],'method':_0x252967[_0xa688('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x252967[_0xa688('0x60')])===_0xa688('0x61')&&parseInt(_0x252967['timeout'])>=0x1?parseInt(_0x252967[_0xa688('0x60')])*0x3e8:0x5*0x3e8};if(_[_0xa688('0x62')]([_0xa688('0x63'),_0xa688('0x64')],_0x18bf56[_0xa688('0x5f')]['toUpperCase']())){try{_0x18bf56[_0xa688('0x65')]=_0x252967[_0xa688('0x66')]?JSON[_0xa688('0x67')](_0x252967[_0xa688('0x66')]):{};}catch(_0x50f23b){logger[_0xa688('0x29')](_0xa688('0x68'),_0x50f23b);}}try{_0x18bf56[_0xa688('0x69')]=_0x252967[_0xa688('0xb')]?JSON[_0xa688('0x67')](_0x252967[_0xa688('0xb')]):{};}catch(_0x3ac7c0){logger[_0xa688('0x29')](_0xa688('0x6a'),_0x3ac7c0);}if(_0x252967[_0xa688('0x6b')]){try{var _0x6c1885=require(_0x252967[_0xa688('0x6b')])['sync'](this,_0x18bf56);_0x18bf56[_0xa688('0x6c')]=Mustache[_0xa688('0x6d')](_0x252967[_0xa688('0x6e')],_0x6c1885,{},['$$','$$']);if(_0x18bf56[_0xa688('0x69')]){_0x18bf56[_0xa688('0x69')]=JSON['parse'](Mustache[_0xa688('0x6d')](JSON[_0xa688('0x6f')](_0x18bf56[_0xa688('0x69')]),_0x6c1885,{},['$$','$$']));}if(_0x18bf56[_0xa688('0x65')]){_0x18bf56[_0xa688('0x65')]=JSON['parse'](Mustache[_0xa688('0x6d')](JSON['stringify'](_0x18bf56['body']),_0x6c1885,{},['$$','$$']));}}catch(_0x10c09f){logger[_0xa688('0x29')](_0xa688('0x70'),_0x10c09f);}}rp(_0x18bf56)[_0xa688('0x1c')](function(_0x5a1f54){var _0xf38db7={'statusCode':_0x5a1f54['statusCode']||0xc8,'statusMessage':_0x5a1f54[_0xa688('0x71')]||'OK','headers':_0x5a1f54[_0xa688('0x69')]||{},'body':_0x5a1f54[_0xa688('0x65')]||{}};_0x483f55(null,_0xf38db7);})[_0xa688('0x13')](function(_0x5dfdac){var _0x41ba38={'statusCode':_0x5dfdac['statusCode']||0x1f4,'statusMessage':_0x5dfdac[_0xa688('0x72')]||_0xa688('0x73'),'headers':_0x5dfdac[_0xa688('0x74')][_0xa688('0x69')]||{},'body':_0x5dfdac[_0xa688('0x74')][_0xa688('0x65')]||{}};_0x483f55(null,_0x41ba38);});};AGIVertices[_0xa688('0xf')]['googleDialogflow']=function(_0x1c3dc2,_0x32af92){scripts['googleDialogflow'](this['channel'][_0xa688('0x33')],_0x1c3dc2[_0xa688('0x75')],_0x1c3dc2['text'],_0x1c3dc2[_0xa688('0x76')]||'en')[_0xa688('0x1c')](function(_0x55b4f2){_0x32af92(null,_0x55b4f2);})[_0xa688('0x13')](function(_0x14f04a){_0x32af92(_0x14f04a);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x1cc95b,_0x55894b){scripts['googleDialogflowV2'](this['channel'][_0xa688('0x33')],_0x1cc95b[_0xa688('0x77')],_0x1cc95b['client_email'],_0x1cc95b[_0xa688('0x78')],_0x1cc95b[_0xa688('0x59')],_0x1cc95b[_0xa688('0x79')]||'en')[_0xa688('0x1c')](function(_0x3223e1){_0x55894b(null,_0x3223e1);})['catch'](function(_0x2185ea){_0x55894b(_0x2185ea);});};AGIVertices[_0xa688('0xf')][_0xa688('0x7a')]=function(_0x15ee1a,_0xa2b5fd){scripts[_0xa688('0x7a')](this[_0xa688('0xe')],_0x15ee1a)[_0xa688('0x1c')](function(_0x679712){_0xa2b5fd(null,_0x679712);})[_0xa688('0x13')](function(_0x33476e){_0xa2b5fd(_0x33476e);});};AGIVertices['prototype']['ispeechTTS']=function(_0x20c596,_0x1b087c){scripts[_0xa688('0x7b')](_0x20c596[_0xa688('0x75')],_0x20c596[_0xa688('0x59')],_0x20c596[_0xa688('0x7c')]||'en-US',_0x20c596[_0xa688('0x7d')])[_0xa688('0x1c')](function(_0x3d721e){_0x1b087c(null,_0x3d721e);})[_0xa688('0x13')](function(_0x5693c4){_0x1b087c(_0x5693c4);});};AGIVertices[_0xa688('0xf')][_0xa688('0x7e')]=function(_0x3ad430,_0x41cac9,_0xf5f53c){scripts[_0xa688('0x7e')](_0x41cac9,_0x3ad430[_0xa688('0x75')],_0x3ad430[_0xa688('0x7f')]||_0xa688('0x80'),this[_0xa688('0x81')](_0x3ad430[_0xa688('0x82')])?_0x3ad430[_0xa688('0x82')]:undefined)[_0xa688('0x1c')](function(_0x59a59b){_0xf5f53c(null,_0x59a59b);})[_0xa688('0x13')](function(_0x27496c){_0xf5f53c(_0x27496c);});};AGIVertices['prototype'][_0xa688('0x83')]=function(_0x3f42a1,_0x147e82){scripts[_0xa688('0x83')](_0x3f42a1[_0xa688('0x84')],_0x3f42a1['aws_secret_access_key'],_0x3f42a1[_0xa688('0x85')],_0x3f42a1[_0xa688('0x86')]||_0xa688('0x87'),_0x3f42a1[_0xa688('0x59')],_0x3f42a1[_0xa688('0x88')]||_0xa688('0x59'))[_0xa688('0x1c')](function(_0x42951b){_0x147e82(null,_0x42951b);})[_0xa688('0x13')](function(_0x2819b8){_0x147e82(_0x2819b8);});};AGIVertices[_0xa688('0xf')][_0xa688('0x89')]=function(_0x28ad0e,_0x185999){scripts[_0xa688('0x89')](this[_0xa688('0xe')][_0xa688('0x33')],_0x28ad0e[_0xa688('0x84')],_0x28ad0e[_0xa688('0x8a')],_0x28ad0e[_0xa688('0x8b')],_0x28ad0e[_0xa688('0x59')],_0x28ad0e[_0xa688('0x8c')])['then'](function(_0x14b1be){_0x185999(null,_0x14b1be);})[_0xa688('0x13')](function(_0x678be1){_0x185999(_0x678be1);});};AGIVertices[_0xa688('0xf')]['googleASR']=function(_0x101ba9,_0x2da120,_0xa96a){scripts[_0xa688('0x8d')](_0x2da120,_0x101ba9[_0xa688('0x75')],_0x101ba9[_0xa688('0x8e')]||'en-US')['then'](function(_0x239990){_0xa96a(null,_0x239990);})[_0xa688('0x13')](function(_0x43cbb4){_0xa96a(_0x43cbb4);});};AGIVertices[_0xa688('0xf')][_0xa688('0x8f')]=function(_0xd2b5ec,_0x2b0bcf,_0x5bc42f){scripts[_0xa688('0x8f')](_0x2b0bcf,_0xd2b5ec[_0xa688('0x90')],_0xd2b5ec[_0xa688('0x91')],_0xd2b5ec[_0xa688('0x6c')])[_0xa688('0x1c')](function(_0x11b408){_0x5bc42f(null,_0x11b408);})[_0xa688('0x13')](function(_0x5a9df2){_0x5bc42f(_0x5a9df2);});};AGIVertices[_0xa688('0xf')][_0xa688('0x92')]=function(_0x18acba){var _0x3d8ca5=_[_0xa688('0x62')](verticesWithRetry,_0x18acba['agicommand'])?_0x18acba:_[_0xa688('0x93')](_0x18acba);for(var _0x4d717d in _0x3d8ca5){if(_0x3d8ca5[_0xa688('0x94')](_0x4d717d)){if(_0x3d8ca5[_0x4d717d]&&_['isString'](_0x3d8ca5[_0x4d717d])){if(_[_0xa688('0x62')](recursiveMapAttributes,_0x4d717d)){_0x3d8ca5[_0x4d717d]=this[_0xa688('0x95')](_0x3d8ca5[_0x4d717d]);}else{_0x3d8ca5[_0x4d717d]=this[_0xa688('0x96')](_0x3d8ca5[_0x4d717d]);}}}}return _0x3d8ca5;};AGIVertices[_0xa688('0xf')][_0xa688('0x97')]=function(_0x2942ae){for(var _0x1ae71b in _0x2942ae){if(_0x2942ae[_0xa688('0x94')](_0x1ae71b)){if(_['isPlainObject'](_0x2942ae[_0x1ae71b])){this[_0xa688('0x97')](_0x2942ae[_0x1ae71b]);}else if(_[_0xa688('0x98')](_0x2942ae[_0x1ae71b])){for(var _0x1e40a0=0x0;_0x1e40a0<_0x2942ae[_0x1ae71b][_0xa688('0x99')];_0x1e40a0++){this[_0xa688('0x97')](_0x2942ae[_0x1ae71b][_0x1e40a0]);}}else if(_[_0xa688('0x9a')](_0x2942ae[_0x1ae71b])){_0x2942ae[_0x1ae71b]=this[_0xa688('0x96')](_0x2942ae[_0x1ae71b]);}}}};AGIVertices[_0xa688('0xf')]['saveRestApiResult']=function(_0x52d6c3,_0x469e54){for(var _0x5be304 in _0x52d6c3){if(_0x52d6c3[_0xa688('0x94')](_0x5be304)){if(_[_0xa688('0x9b')](_0x52d6c3[_0x5be304])){if(!_[_0xa688('0x42')](_0x52d6c3[_0x5be304])){this['saveRestApiResult'](_0x52d6c3[_0x5be304],util[_0xa688('0x51')](_0xa688('0x9c'),_0x469e54,_0x5be304));}}else if(_[_0xa688('0x98')](_0x52d6c3[_0x5be304])){for(var _0x30f6db=0x0;_0x30f6db<_0x52d6c3[_0x5be304]['length'];_0x30f6db++){this[_0xa688('0x9d')](_0x52d6c3[_0x5be304][_0x30f6db],util['format'](_0xa688('0x9c'),_0x469e54,_0x5be304+'['+_0x30f6db+']'));}}else{if(!_[_0xa688('0x43')](_0x52d6c3[_0x5be304])){this[_0xa688('0xe')][_0xa688('0x9e')](util[_0xa688('0x51')](_0xa688('0x9c'),_0x469e54,_0x5be304),_0x52d6c3[_0x5be304]);}}}}};AGIVertices[_0xa688('0xf')][_0xa688('0x95')]=function(_0x24d771){try{var _0x57de44=JSON[_0xa688('0x67')](_0x24d771);this[_0xa688('0x97')](_0x57de44);return JSON['stringify'](_0x57de44);}catch(_0x1a7e75){return this[_0xa688('0x96')](_0x24d771);}};AGIVertices[_0xa688('0xf')][_0xa688('0x96')]=function(_0x2d8b99){var _0x10452d=_0x2d8b99[_0xa688('0x9f')]('{');for(var _0x15492b=0x1;_0x15492b<_0x10452d['length'];_0x15492b+=0x1){var _0x27c62c=_0x10452d[_0x15492b][_0xa688('0x9f')]('}');if(_0x27c62c[_0xa688('0x99')]>0x1){_0x2d8b99=_0x2d8b99[_0xa688('0xa0')]('{'+_0x27c62c[0x0]+'}',this[_0xa688('0xe')][_0xa688('0x10')](_0x27c62c[0x0])[_0xa688('0xa1')]||_0x27c62c[0x0]);}}if(_0x10452d[_0xa688('0x99')]===0x1){return _0x2d8b99['toString']();}return this[_0xa688('0x96')](_0x2d8b99);};AGIVertices['prototype'][_0xa688('0xa2')]=function(_0x33e972,_0x50a0f1){var _0x39b6a0=this[_0xa688('0xe')][_0xa688('0x10')](_0x33e972);if(_0x39b6a0[_0xa688('0xa3')]===-0x1){return _0x39b6a0;}logger['info'](util[_0xa688('0x51')](_0xa688('0xa4'),_0x50a0f1,_0x39b6a0[_0xa688('0xa1')]));return this[_0xa688('0xe')]['setVariable'](_0x50a0f1,_0x39b6a0[_0xa688('0xa1')]);};AGIVertices[_0xa688('0xf')]['isConfigured']=function(_0x3b4ed9){return _0x3b4ed9&&_0x3b4ed9!=='0'&&_0x3b4ed9!=='-1'&&_0x3b4ed9!=='';};AGIVertices[_0xa688('0xf')][_0xa688('0xa5')]=function(_0xe34843){this['createSquareDetailsReport']['sync'](this,_0xe34843,'-');_0xe34843['retry']=_0xe34843[_0xa688('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa688('0xf')][_0xa688('0xa6')]=function(_0x2e693e){logger[_0xa688('0x2b')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2e693e[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x2e693e['text'])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xa8'));}var _0x274cde='\x22'+_0x2e693e[_0xa688('0x59')]+'\x22';if(this[_0xa688('0x81')](_0x2e693e['options'])){_0x274cde+=','+_0x2e693e['options'];}var _0x50c9be=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0xaa'),_0x274cde);if(_0x50c9be[_0xa688('0xa3')]===-0x1){return _0x50c9be;}return this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0xab'),_0x274cde));};AGIVertices[_0xa688('0xf')][_0xa688('0xac')]=function(_0x3d6d02){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0xad'),_0x3d6d02[_0xa688('0x34')]));if(!this['isConfigured'](_0x3d6d02[_0xa688('0xae')])){return this[_0xa688('0xe')]['noop'](_0xa688('0xaf'));}var _0x25f373=_0x3d6d02[_0xa688('0xae')];if(this[_0xa688('0x81')](_0x3d6d02[_0xa688('0x74')])){_0x25f373+=','+_0x3d6d02[_0xa688('0x74')];}var _0x4485d7=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0xb0'),_0x25f373);if(_0x4485d7['result']===-0x1){return _0x4485d7;}var _0x5dff97=this[_0xa688('0xa2')]('RECOG_CONFIDENCE()',_0xa688('0xb1'));if(_0x5dff97[_0xa688('0xa3')]===-0x1){return _0x5dff97;}var _0x51b97e=this[_0xa688('0xa2')](_0xa688('0xb2'),_0xa688('0xb3'));if(_0x51b97e[_0xa688('0xa3')]===-0x1){return _0x51b97e;}var _0x19ea57=this['getAndSetVariable']('RECOG_INSTANCE()',_0xa688('0xb4'));if(_0x19ea57['result']===-0x1){return _0x19ea57;}return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x25f373));};AGIVertices[_0xa688('0xf')][_0xa688('0x6')]=function(_0x466307){logger[_0xa688('0x2b')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x466307['label']));return this[_0xa688('0xe')][_0xa688('0x6')]([_0x466307[_0xa688('0xb5')],_0x466307[_0xa688('0xb6')]]);};AGIVertices[_0xa688('0xf')]['answer']=function(_0xe669b7){logger[_0xa688('0x2b')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xe669b7[_0xa688('0x34')]));if(this['isConfigured'](_0xe669b7['timeout'])){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0xb7'),_0xe669b7[_0xa688('0x60')]));var _0x8eb42=this[_0xa688('0xe')]['wait'](_0xe669b7[_0xa688('0x60')]);if(_0x8eb42['result']===-0x1){return _0x8eb42;}}return this[_0xa688('0xe')][_0xa688('0xb8')]();};AGIVertices[_0xa688('0xf')][_0xa688('0x46')]=function(_0x4b9c73){logger[_0xa688('0x2b')](util[_0xa688('0x51')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4b9c73[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x4b9c73[_0xa688('0x45')])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x4b9c73,_0xa688('0xb9'));}_0x4b9c73[_0xa688('0x48')]=moment();if(this['isConfigured'](_0x4b9c73[_0xa688('0xba')])){_0x4b9c73['scheduledAt']=moment()[_0xa688('0xbb')](_0x4b9c73[_0xa688('0xba')],_0xa688('0xbc'));}if(!this[_0xa688('0x81')](_0x4b9c73[_0xa688('0x4a')])){_0x4b9c73[_0xa688('0x4a')]=0x2;}this[_0xa688('0x41')][_0xa688('0xbd')](this,_0x4b9c73);return this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4b9c73[_0xa688('0xbe')],_0x4b9c73[_0xa688('0x45')],_0x4b9c73[_0xa688('0x48')]));};AGIVertices['prototype'][_0xa688('0xbf')]=function(_0x4d691){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0xc0'),_0x4d691['label']));var _0x1f64cb=this['channel'][_0xa688('0xa9')](_0x4d691[_0xa688('0xc1')],_0x4d691[_0xa688('0x74')]);if(_0x1f64cb['result']===-0x1){return _0x1f64cb;}return this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0xc2'),_0x4d691['application'],_0x4d691['options']));};AGIVertices[_0xa688('0xf')]['lumenvoxtts']=function(_0x5d24d3){logger[_0xa688('0x2b')](util['format'](_0xa688('0xc3'),_0x5d24d3[_0xa688('0x34')]));if(!this['isConfigured'](_0x5d24d3[_0xa688('0x59')])){return this['channel'][_0xa688('0xa7')](_0xa688('0xa8'));}var _0x7a5ab6='\x22'+_0x5d24d3[_0xa688('0x59')]+'\x22';if(this['isConfigured'](_0x5d24d3[_0xa688('0x74')])){_0x7a5ab6+=','+_0x5d24d3['options'];}var _0x32f8de=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0xaa'),_0x7a5ab6);if(_0x32f8de['result']===-0x1){return _0x32f8de;}return this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')]('Executed\x20command\x20MRCPSynth\x20%s',_0x7a5ab6));};AGIVertices[_0xa688('0xf')][_0xa688('0xc4')]=function(_0x3ec4cf){logger['info'](util[_0xa688('0x51')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3ec4cf[_0xa688('0x34')]));if(!this['isConfigured'](_0x3ec4cf[_0xa688('0x59')])){return this[_0xa688('0xe')]['noop'](_0xa688('0xa8'));}var _0x441e52='\x22'+_0x3ec4cf['text']+'\x22';if(this['isConfigured'](_0x3ec4cf[_0xa688('0x74')])){_0x441e52+=','+_0x3ec4cf[_0xa688('0x74')];}var _0x2d06d4=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0xaa'),_0x441e52);if(_0x2d06d4[_0xa688('0xa3')]===-0x1){return _0x2d06d4;}return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0xab'),_0x441e52));};AGIVertices['prototype'][_0xa688('0xc5')]=function(_0x5cb660){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0xc6'),_0x5cb660[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x5cb660[_0xa688('0xae')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xaf'));}var _0x3c8ee8=_0x5cb660[_0xa688('0xae')];if(this[_0xa688('0x81')](_0x5cb660['options'])){_0x3c8ee8+=','+_0x5cb660[_0xa688('0x74')];}var _0x34feaf=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0xb0'),_0x3c8ee8);if(_0x34feaf['result']===-0x1){return _0x34feaf;}var _0x4f15f6=this[_0xa688('0xa2')](_0xa688('0xc7'),_0xa688('0xc8'));if(_0x4f15f6[_0xa688('0xa3')]===-0x1){return _0x4f15f6;}var _0x57f1fa=this[_0xa688('0xa2')]('RECOG_INPUT()',_0xa688('0xc9'));if(_0x57f1fa[_0xa688('0xa3')]===-0x1){return _0x57f1fa;}var _0x5521e0=this[_0xa688('0xa2')](_0xa688('0xca'),_0xa688('0xcb'));if(_0x5521e0[_0xa688('0xa3')]===-0x1){return _0x5521e0;}return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3c8ee8));};AGIVertices[_0xa688('0xf')][_0xa688('0xcc')]=function(_0x489077){logger[_0xa688('0x2b')](util[_0xa688('0x51')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x489077[_0xa688('0x34')]));if(!this['isConfigured'](_0x489077[_0xa688('0xae')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xaf'));}var _0x3032f8=_0x489077['grammar'];if(this[_0xa688('0x81')](_0x489077[_0xa688('0x74')])){_0x3032f8+=','+_0x489077[_0xa688('0x74')];}var _0x5c40c9=this[_0xa688('0xe')][_0xa688('0xa9')]('MRCPRecog',_0x3032f8);if(_0x5c40c9['result']===-0x1){return _0x5c40c9;}var _0x5dac5=this[_0xa688('0xa2')](_0xa688('0xc7'),'SESTEK_ASR_CONFIDENCE');if(_0x5dac5[_0xa688('0xa3')]===-0x1){return _0x5dac5;}var _0x2c2188=this[_0xa688('0xa2')]('RECOG_INPUT()',_0xa688('0xcd'));if(_0x2c2188[_0xa688('0xa3')]===-0x1){return _0x2c2188;}var _0x4f8949=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x4f8949['result']===-0x1){return _0x4f8949;}return this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0xce'),_0x3032f8));};AGIVertices[_0xa688('0xf')][_0xa688('0xcf')]=function(_0x5c9122){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0xd0'),_0x5c9122['label']));if(!this[_0xa688('0x81')](_0x5c9122[_0xa688('0xd1')])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x5c9122,_0xa688('0xd2'));}var _0x577939=this[_0xa688('0x18')]['sync'](this,_0x5c9122['odbc_id']);if(!_0x577939){return this[_0xa688('0xe')][_0xa688('0x29')](_0x5c9122,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5c9122[_0xa688('0xd3')])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x5c9122,_0xa688('0xd4'));}var _0x1aafe6=_0x5c9122[_0xa688('0xd3')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0xd5'),_0x1aafe6));var _0x552171=this[_0xa688('0xd6')]['sync'](this,_0x577939,_0x1aafe6);this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x5c9122,_0x1aafe6);if(!this['isConfigured'](_0x5c9122[_0xa688('0xd7')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xd8'));}var _0x4ac102=this[_0xa688('0x10')][_0xa688('0xbd')](this,_0x5c9122[_0xa688('0xd7')]);if(!_0x4ac102){return this[_0xa688('0xe')][_0xa688('0x29')](_0x5c9122,_0xa688('0xd9'));}var _0x8d62ba=this;_0x552171['forEach'](function(_0x57c73d,_0xb51412){Object[_0xa688('0xda')](_0x57c73d)['forEach'](function(_0x56127a){_0x8d62ba['channel']['setVariable'](util['format'](_0xa688('0xdb'),_0x4ac102,_0xb51412,_0x56127a),_0x57c73d[_0x56127a]);});});this[_0xa688('0xe')][_0xa688('0x9e')](util['format']('%s_ROWS_COUNT',_0x4ac102),_0x552171['length']);return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0xdc'),_0x4ac102));};AGIVertices['prototype']['dial']=function(_0x5cd07c){logger[_0xa688('0xdd')](util[_0xa688('0x51')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x5cd07c[_0xa688('0x34')]));if(!this['isConfigured'](_0x5cd07c[_0xa688('0xde')])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x5cd07c,_0xa688('0xdf'));}var _0x5ece5f=this[_0xa688('0x1a')][_0xa688('0xbd')](this,_0x5cd07c['sip_id']);if(!_0x5ece5f){return this['channel'][_0xa688('0x29')](_0x5cd07c,_0xa688('0xe0'));}var _0x360fe4=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0xe1'),[util['format'](_0xa688('0xe2'),_0x5ece5f),_0x5cd07c[_0xa688('0x60')],_0x5cd07c[_0xa688('0xe3')],_0x5cd07c[_0xa688('0x6e')]]);if(_0x360fe4[_0xa688('0xa3')]===-0x1){return _0x360fe4;}return this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0xe4'),_0xa688('0xe1')));};AGIVertices['prototype'][_0xa688('0xe5')]=function(_0x3561dc){logger[_0xa688('0x2b')](util['format'](_0xa688('0xe6'),_0x3561dc['label']));if(!this[_0xa688('0x81')](_0x3561dc[_0xa688('0x75')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xe7'));}if(!this[_0xa688('0x81')](_0x3561dc[_0xa688('0x59')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xa8'));}this[_0xa688('0xe')]['bot']=!![];this[_0xa688('0x32')](_0x3561dc);this[_0xa688('0x40')](_0x3561dc['text'],'in','','');this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')]('Trying\x20Dialogflow:\x20%s',_0x3561dc[_0xa688('0x59')]));var _0x3706c9=this['googleDialogflow']['sync'](this,_0x3561dc);if(_0x3706c9){for(var _0x2625f7 in _0x3706c9){if(_0x3706c9[_0xa688('0x94')](_0x2625f7)){this['channel'][_0xa688('0x9e')](util[_0xa688('0x51')](_0xa688('0xe8'),_0x2625f7[_0xa688('0xe9')]()),_0x3706c9[_0x2625f7]);}}this['createSquareMessage'](_0x3706c9['speech'],_0xa688('0xea'),_0xa688('0xe5'),'');return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')]('Dialogflow\x20Result\x20%s',_0x3706c9[_0xa688('0xeb')]));}return this[_0xa688('0xe')][_0xa688('0x29')](_0x3561dc,_0xa688('0xec'));};AGIVertices[_0xa688('0xf')][_0xa688('0xed')]=function(_0x136d17){logger[_0xa688('0x2b')](util['format'](_0xa688('0xee'),_0x136d17[_0xa688('0x34')]));if(!this['isConfigured'](_0x136d17[_0xa688('0x77')])){return this[_0xa688('0xe')]['noop'](_0xa688('0xef'));}if(!this[_0xa688('0x81')](_0x136d17[_0xa688('0xf0')])){return this[_0xa688('0xe')]['noop'](_0xa688('0xf1'));}if(!this['isConfigured'](_0x136d17['private_key'])){return this[_0xa688('0xe')]['noop'](_0xa688('0xf2'));}if(!this[_0xa688('0x81')](_0x136d17['dialogflowV2_language'])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xf3'));}if(!this['isConfigured'](_0x136d17[_0xa688('0x59')])){return this[_0xa688('0xe')]['noop'](_0xa688('0xa8'));}this[_0xa688('0xe')]['bot']=!![];this[_0xa688('0x32')](_0x136d17);this[_0xa688('0x40')](_0x136d17[_0xa688('0x59')],'in','','');this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')]('Trying\x20DialogflowV2:\x20%s',_0x136d17[_0xa688('0x59')]));var _0x27c122=this[_0xa688('0xf4')][_0xa688('0xbd')](this,_0x136d17);if(_0x27c122){for(var _0x5be4e7 in _0x27c122){if(_0x27c122[_0xa688('0x94')](_0x5be4e7)){if(_0x5be4e7!==_0xa688('0xf5')){this['channel'][_0xa688('0x9e')](util[_0xa688('0x51')](_0xa688('0xe8'),_0x5be4e7[_0xa688('0xe9')]()),_0x27c122[_0x5be4e7]);}}}this[_0xa688('0x40')](_0x27c122[_0xa688('0xeb')],_0xa688('0xea'),_0xa688('0xed'),_0x27c122[_0xa688('0xf5')]);return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')]('DialogflowV2\x20Result\x20%s',_0x27c122[_0xa688('0xeb')]));}return this['channel'][_0xa688('0x29')](_0x136d17,_0xa688('0xf6'));};AGIVertices[_0xa688('0xf')][_0xa688('0xf7')]=function(_0x1996a9){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0xf8'),_0x1996a9['label']));if(!this[_0xa688('0x81')](_0x1996a9[_0xa688('0xf9')])){return this['channel'][_0xa688('0xa7')](_0xa688('0xfa'));}if(!this[_0xa688('0x81')](_0x1996a9[_0xa688('0xfb')])){return this['channel']['noop'](_0xa688('0xfc'));}if(!this[_0xa688('0x81')](_0x1996a9['password'])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xfd'));}if(!this[_0xa688('0x81')](_0x1996a9[_0xa688('0xfe')])){return this['channel'][_0xa688('0xa7')](_0xa688('0xa8'));}this[_0xa688('0xe')][_0xa688('0xff')]=!![];this['createSquareDetailsReport'](_0x1996a9);this[_0xa688('0x40')](_0x1996a9[_0xa688('0x59')],'in','','');this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')]('Trying\x20SestekNDA:\x20%s',_0x1996a9[_0xa688('0x59')]));var _0x8549b8=this[_0xa688('0x7a')][_0xa688('0xbd')](this,_0x1996a9);if(_0x8549b8){for(var _0x357627 in _0x8549b8){if(_0x8549b8[_0xa688('0x94')](_0x357627)){this['channel']['setVariable'](util[_0xa688('0x51')]('SESTEK_NDA_%s',_0x357627[_0xa688('0xe9')]()),_0x8549b8[_0x357627]);}}this[_0xa688('0x40')](_0x8549b8[_0xa688('0xeb')],_0xa688('0xea'),_0xa688('0xf7'),'');if(_0x8549b8['audiofile']){this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x100'),_0x8549b8['audiofile']));var _0x14f7d9=this[_0xa688('0xe')]['streamFile'](_0x8549b8[_0xa688('0x101')]);try{fs[_0xa688('0x102')](_0x8549b8['audiofile']+'.wav');}catch(_0x23245a){logger[_0xa688('0x29')](_0x23245a);}return _0x14f7d9;}else{return this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x103'),_0x8549b8[_0xa688('0xeb')]));}}return this[_0xa688('0xe')][_0xa688('0x29')](_0x1996a9,_0xa688('0x104'));};AGIVertices[_0xa688('0xf')][_0xa688('0x105')]=function(_0x27895a){logger[_0xa688('0x2b')](util['format'](_0xa688('0x106'),_0x27895a['label']));return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0x105'));};AGIVertices[_0xa688('0xf')][_0xa688('0x107')]=function(_0x1e3ef8){logger[_0xa688('0x2b')](util['format'](_0xa688('0x108'),_0x1e3ef8[_0xa688('0x34')]));var _0x11dc8b='';if(_0x1e3ef8[_0xa688('0x109')]){if(!this[_0xa688('0x81')](_0x1e3ef8[_0xa688('0x109')])){return this['channel'][_0xa688('0x29')](_0x1e3ef8,_0xa688('0x10a'));}else{var _0x659b80=parseInt(_0x1e3ef8[_0xa688('0x109')],0xa);if(isNaN(_0x659b80)){_0x11dc8b=_0x1e3ef8[_0xa688('0x109')];}else{_0x11dc8b=this[_0xa688('0x1d')][_0xa688('0xbd')](this,_0x1e3ef8['trunk_id']);if(!_0x11dc8b){return this[_0xa688('0xe')][_0xa688('0x29')](_0x1e3ef8,_0xa688('0x10b'));}}}}else if(_0x1e3ef8[_0xa688('0x10c')]){_0x11dc8b=_0x1e3ef8[_0xa688('0x10c')];}else{return this[_0xa688('0xe')][_0xa688('0x29')](_0x1e3ef8,'no\x20trunk\x20selected');}var _0x33dfc4=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0xe1'),[util[_0xa688('0x51')]('SIP/%s/%s',_0x11dc8b,_0x1e3ef8[_0xa688('0xbe')]),_0x1e3ef8[_0xa688('0x60')],_0x1e3ef8[_0xa688('0xe3')],_0x1e3ef8[_0xa688('0x6e')]]);if(_0x33dfc4[_0xa688('0xa3')]===-0x1){return _0x33dfc4;}return this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xa688('0xf')][_0xa688('0x10d')]=function(_0x3d2647){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x10e'),_0x3d2647[_0xa688('0x34')]));return this[_0xa688('0xe')]['noop']('finally');};AGIVertices[_0xa688('0xf')][_0xa688('0xc')]=function(_0x25f318){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x10f'),_0x25f318[_0xa688('0x34')]));if(_0x25f318[_0xa688('0x110')]===0x0){return this[_0xa688('0xa5')](_0x25f318);}_0x25f318[_0xa688('0x110')]-=0x1;if(!this[_0xa688('0x81')](_0x25f318['file_id'])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x25f318,_0xa688('0x111'));}var _0x4d2383=this[_0xa688('0x1e')]['sync'](this,_0x25f318[_0xa688('0x112')]);if(!_0x4d2383){return this['channel'][_0xa688('0x29')](_0x25f318,_0xa688('0x113'));}if(!this[_0xa688('0x81')](_0x25f318['variable_id'])){return this[_0xa688('0xe')][_0xa688('0x29')](_0xa688('0xd8'));}var _0x47b0e1=this[_0xa688('0xe')][_0xa688('0x114')](_0x4d2383,_0x25f318[_0xa688('0x115')],_0x25f318[_0xa688('0x116')]);var _0x270ae8=_0x47b0e1['result']?_0x47b0e1[_0xa688('0xa3')][_0xa688('0x49')]():'';logger[_0xa688('0x2b')](_0xa688('0x117'),JSON['stringify'](_0x47b0e1));if(_0x47b0e1['result']===-0x1){this[_0xa688('0x32')]['sync'](this,_0x25f318,_0x270ae8);return _0x47b0e1;}else if(_0x47b0e1['extra']===_0xa688('0x60')){_0x47b0e1[_0xa688('0xa3')]=_0x270ae8[_0xa688('0x99')]>=parseInt(_0x25f318[_0xa688('0x118')])?'x':'i';}else{_0x47b0e1[_0xa688('0xa3')]=_0x270ae8[_0xa688('0x99')]>=parseInt(_0x25f318[_0xa688('0x118')])&&_0x270ae8[_0xa688('0x99')]<=parseInt(_0x25f318[_0xa688('0x116')])?'x':'i';}var _0x5644b8=this[_0xa688('0x10')][_0xa688('0xbd')](this,_0x25f318['variable_id']);if(!_0x5644b8){return this[_0xa688('0xe')][_0xa688('0x29')](_0x25f318,_0xa688('0xd9'));}this[_0xa688('0xe')][_0xa688('0x9e')](_0x5644b8,_0x270ae8);if(this[_0xa688('0x81')](_0x25f318['hiddendigitsnum'])){var _0x5d382b=parseInt(_0x25f318[_0xa688('0x119')],0xa);var _0x13e25b=rs['generate']({'charset':'*','length':_0x5d382b});var _0x3f142b=_0x270ae8['length'];if(_0x3f142b>0x0){if(_0x3f142b>_0x5d382b){this['createSquareDetailsReport'][_0xa688('0xbd')](this,_0x25f318,_0x25f318[_0xa688('0x11a')]==='first'?_0x13e25b+_0x270ae8[_0xa688('0x11b')](_0x5d382b):_0x270ae8[_0xa688('0x11b')](0x0,_0x3f142b-_0x5d382b)+_0x13e25b);}else{this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x25f318,rs['generate']({'charset':'*','length':_0x3f142b}));}}else{this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x25f318,'');}}else{this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x25f318,_0x270ae8);}return _0x47b0e1;};AGIVertices[_0xa688('0xf')][_0xa688('0xd')]=function(_0x4bec97){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x11c'),_0x4bec97[_0xa688('0x34')]));return this[_0xa688('0xc')](_0x4bec97);};AGIVertices[_0xa688('0xf')][_0xa688('0x11d')]=function(_0x59fbb5){logger[_0xa688('0x2b')](util[_0xa688('0x51')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x59fbb5[_0xa688('0x34')]));this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x59fbb5,_0x59fbb5[_0xa688('0x11e')]);return this[_0xa688('0xe')][_0xa688('0xa7')](util['format']('GOAL\x20%s',_0x59fbb5[_0xa688('0x11e')]));};AGIVertices['prototype'][_0xa688('0x11f')]=function(_0xf4b5a2){logger[_0xa688('0x2b')](util['format'](_0xa688('0x120'),_0xf4b5a2[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0xf4b5a2[_0xa688('0x84')])||!this[_0xa688('0x81')](_0xf4b5a2[_0xa688('0x8a')])){return this[_0xa688('0xe')][_0xa688('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xa688('0x81')](_0xf4b5a2[_0xa688('0x59')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xa8'));}this[_0xa688('0xe')][_0xa688('0xa7')](util['format'](_0xa688('0x121'),_0xf4b5a2[_0xa688('0x59')]));var _0xba8db8=this[_0xa688('0x83')][_0xa688('0xbd')](this,_0xf4b5a2);if(_0xba8db8){this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x122'),_0xba8db8));var _0x5a6610=this['channel'][_0xa688('0x123')](_0xba8db8);try{fs[_0xa688('0x102')](_0xba8db8+'.wav');}catch(_0x105778){logger[_0xa688('0x29')](_0x105778);}return _0x5a6610;}return this[_0xa688('0xe')][_0xa688('0x29')](_0xf4b5a2,_0xa688('0x124'));};AGIVertices[_0xa688('0xf')]['awslex']=function(_0x314294){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x125'),_0x314294[_0xa688('0x34')]));if(!this['isConfigured'](_0x314294[_0xa688('0x84')])||!this[_0xa688('0x81')](_0x314294[_0xa688('0x8a')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0x126'));}if(!this[_0xa688('0x81')](_0x314294[_0xa688('0x8c')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0x127'));}if(!this[_0xa688('0x81')](_0x314294[_0xa688('0x59')])){return this['channel']['noop'](_0xa688('0xa8'));}this[_0xa688('0xe')][_0xa688('0xff')]=!![];this[_0xa688('0x32')](_0x314294);this[_0xa688('0x40')](_0x314294[_0xa688('0x59')],'in','','');this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x128'),_0x314294[_0xa688('0x59')]));var _0x5c3f6d=this[_0xa688('0x89')]['sync'](this,_0x314294);if(_0x5c3f6d){for(var _0x39c905 in _0x5c3f6d){if(_0x5c3f6d['hasOwnProperty'](_0x39c905)&&_['isString'](_0x5c3f6d[_0x39c905])){this[_0xa688('0xe')]['setVariable'](util[_0xa688('0x51')](_0xa688('0x129'),_0x39c905[_0xa688('0xe9')]()),_0x5c3f6d[_0x39c905]);}}if(_[_0xa688('0x43')](_0x5c3f6d[_0xa688('0x72')])){return this['channel']['noop'](_0xa688('0x12a'));}else{this[_0xa688('0x40')](_0x5c3f6d[_0xa688('0x72')],_0xa688('0xea'),_0xa688('0x12b'),'');return this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x12c'),_0x5c3f6d['message']));}}return this[_0xa688('0xe')][_0xa688('0x29')](_0x314294,_0xa688('0x12d'));};AGIVertices[_0xa688('0xf')][_0xa688('0x12e')]=function(_0xc18401){logger[_0xa688('0x2b')](util['format'](_0xa688('0x12f'),_0xc18401['label'],_0xc18401[_0xa688('0x60')]));if(!this[_0xa688('0x81')](_0xc18401['key'])){return this['channel'][_0xa688('0xa7')](_0xa688('0xe7'));}var _0x285ebb=_0xa688('0x130');var _0x18d065=util[_0xa688('0x51')](_0xa688('0x131'),FILES_PATH,rs['generate'](0x4));var _0x46c525=util[_0xa688('0x51')]('%s.%s',_0x18d065,_0x285ebb);var _0x37d706=!![];if(_0xc18401[_0xa688('0x132')]===_0xa688('0x133')){_0x37d706=![];}var _0xad0027=this['channel'][_0xa688('0x134')](_0x18d065,_0x285ebb,_0xc18401[_0xa688('0x135')],_0xc18401[_0xa688('0x60')],undefined,_0x37d706);if(_0xad0027['result']!==-0x1){this['channel']['noop'](util[_0xa688('0x51')](_0xa688('0x136'),_0x46c525));var _0xc9500a=this[_0xa688('0x8d')][_0xa688('0xbd')](this,_0xc18401,_0x46c525);if(_0xc9500a){for(var _0x33c66f in _0xc9500a){if(_0xc9500a[_0xa688('0x94')](_0x33c66f)){this[_0xa688('0xe')]['setVariable'](util[_0xa688('0x51')](_0xa688('0x137'),_0x33c66f['toUpperCase']()),_0xc9500a[_0x33c66f]);}}return this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')]('GoogleASR\x20Result\x20%s',JSON[_0xa688('0x6f')](_0xc9500a)));}}return _0xad0027;};AGIVertices['prototype'][_0xa688('0x138')]=function(_0x1e2e60){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x139'),_0x1e2e60['label']));if(!this['isConfigured'](_0x1e2e60[_0xa688('0x90')])){return this[_0xa688('0xe')]['noop'](_0xa688('0x13a'));}if(!this[_0xa688('0x81')](_0x1e2e60[_0xa688('0x91')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0x13b'));}var _0x5992f3=_0xa688('0x130');var _0x112a52=util[_0xa688('0x51')](_0xa688('0x131'),FILES_PATH,rs[_0xa688('0x13c')](0x4));var _0x428ea6=util[_0xa688('0x51')](_0xa688('0x9c'),_0x112a52,_0x5992f3);var _0x506e2d=!![];if(_0x1e2e60['beep']==='NOBEEP'){_0x506e2d=![];}var _0x26cc60=this['channel'][_0xa688('0x134')](_0x112a52,_0x5992f3,_0x1e2e60[_0xa688('0x135')],_0x1e2e60[_0xa688('0x60')],undefined,_0x506e2d);if(_0x26cc60['result']!==-0x1){this[_0xa688('0xe')][_0xa688('0xa7')](util['format'](_0xa688('0x13d'),_0x428ea6));var _0x4f4ac0=this[_0xa688('0x8f')][_0xa688('0xbd')](this,_0x1e2e60,_0x428ea6);if(_0x4f4ac0){for(var _0x13dd90 in _0x4f4ac0){if(_0x4f4ac0[_0xa688('0x94')](_0x13dd90)){this[_0xa688('0xe')][_0xa688('0x9e')](util[_0xa688('0x51')](_0xa688('0x13e'),_0x13dd90[_0xa688('0xe9')]()),_0x4f4ac0[_0x13dd90]);}}return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0x13f'),JSON[_0xa688('0x6f')](_0x4f4ac0)));}}return _0x26cc60;};AGIVertices['prototype'][_0xa688('0x140')]=function(_0x936dc2){logger[_0xa688('0x2b')](util['format'](_0xa688('0x141'),_0x936dc2[_0xa688('0x34')]));return this[_0xa688('0xe')][_0xa688('0x142')](_0x936dc2[_0xa688('0x3a')],_0x936dc2[_0xa688('0x3b')],_0x936dc2[_0xa688('0x3c')]);};AGIVertices['prototype'][_0xa688('0x143')]=function(_0xd35daa){logger['info'](util[_0xa688('0x51')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xd35daa[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0xd35daa[_0xa688('0x144')])){return this['channel'][_0xa688('0x29')](_0xd35daa,_0xa688('0x145'));}try{var _0x28013c=eval(_0xd35daa[_0xa688('0x144')])?_0xa688('0x146'):_0xa688('0x147');this['channel'][_0xa688('0xa7')](util['format'](_0xa688('0x148'),_0xd35daa[_0xa688('0x144')],_0x28013c));return{'code':0xc8,'result':_0x28013c};}catch(_0x204eb2){return{'code':0xc8,'result':_0xa688('0x147')};}};AGIVertices[_0xa688('0xf')][_0xa688('0x149')]=function(_0x39194e){logger[_0xa688('0x2b')](util['format'](_0xa688('0x14a'),_0x39194e[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x39194e[_0xa688('0x14b')])){return this['channel']['error'](_0x39194e,_0xa688('0x14c'));}var _0x2e8137=this[_0xa688('0x24')][_0xa688('0xbd')](this,_0x39194e[_0xa688('0x14b')]);if(!_0x2e8137){return this['channel'][_0xa688('0x29')](_0x39194e,_0xa688('0x14d'));}for(var _0x41e28b=0x0;_0x41e28b<_0x2e8137['length'];_0x41e28b+=0x1){var _0xfc266b=this[_0xa688('0xe')][_0xa688('0x10')](util[_0xa688('0x51')](_0xa688('0x14e'),_0x2e8137[_0x41e28b]));if(_0xfc266b[_0xa688('0xa3')]===-0x1){return _0xfc266b;}logger[_0xa688('0x2b')](util[_0xa688('0x51')]('IFTIME\x20%s\x20%s',_0x2e8137[_0x41e28b],_0xfc266b[_0xa688('0xa1')]));if(_0xfc266b[_0xa688('0xa1')]===_0xa688('0x146')){logger[_0xa688('0x2b')](util['format']('IFTIME\x20%s\x20%s',_0x2e8137[_0x41e28b],_0xa688('0x146')));this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x14f'),_0x2e8137[_0x41e28b],_0xa688('0x146')));return{'code':0xc8,'result':'true'};}else{logger[_0xa688('0x2b')](util['format']('IFTIME\x20%s\x20%s',_0x2e8137[_0x41e28b],_0xa688('0x147')));this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x14f'),_0x2e8137[_0x41e28b],_0xa688('0x147')));}}return{'code':0xc8,'result':_0xa688('0x147')};};AGIVertices['prototype'][_0xa688('0x150')]=function(_0x5d9980){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x151'),_0x5d9980[_0xa688('0x34')]));return this[_0xa688('0xe')][_0xa688('0x150')]();};AGIVertices[_0xa688('0xf')][_0xa688('0x152')]=function(_0x5b7d20){logger['info'](util['format'](_0xa688('0x153'),_0x5b7d20[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x5b7d20[_0xa688('0x75')])){return this['channel'][_0xa688('0xa7')]('no\x20key\x20configured');}var _0x66ea65=_0xa688('0x130');var _0x4362d7=util[_0xa688('0x51')](_0xa688('0x131'),FILES_PATH,rs[_0xa688('0x13c')](0x4));var _0x550577=util['format'](_0xa688('0x9c'),_0x4362d7,_0x66ea65);var _0x500379=!![];if(_0x5b7d20['beep']===_0xa688('0x133')){_0x500379=![];}var _0x2615cb=this[_0xa688('0xe')][_0xa688('0x134')](_0x4362d7,_0x66ea65,_0x5b7d20[_0xa688('0x135')],_0x5b7d20['timeout'],undefined,_0x500379);if(_0x2615cb['result']!==-0x1){this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')]('ispeech\x20%s\x20file\x20created',_0x550577));var _0x3aaadf=this[_0xa688('0x7e')][_0xa688('0xbd')](this,_0x5b7d20,_0x550577);if(_0x3aaadf){for(var _0x2400c5 in _0x3aaadf){if(_0x3aaadf['hasOwnProperty'](_0x2400c5)){this[_0xa688('0xe')]['setVariable'](util[_0xa688('0x51')](_0xa688('0x154'),_0x2400c5['toUpperCase']()),_0x3aaadf[_0x2400c5]);}}return this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x155'),JSON['stringify'](_0x3aaadf)));}}return _0x2615cb;};AGIVertices['prototype'][_0xa688('0x156')]=function(_0x358455){logger['info'](util[_0xa688('0x51')](_0xa688('0x157'),_0x358455[_0xa688('0x34')]));if(!this['isConfigured'](_0x358455[_0xa688('0x75')])){return this[_0xa688('0xe')][_0xa688('0xa7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x358455[_0xa688('0x59')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0xa8'));}this[_0xa688('0xe')]['noop'](util['format'](_0xa688('0x158'),_0x358455['text']));var _0x2e8bdc=this[_0xa688('0x7b')][_0xa688('0xbd')](this,_0x358455);if(_0x2e8bdc){this['channel'][_0xa688('0xa7')](util['format'](_0xa688('0x159'),_0x2e8bdc));var _0x4efe37=this['channel'][_0xa688('0x123')](_0x2e8bdc,_0x358455[_0xa688('0x135')]);try{fs[_0xa688('0x102')](_0x2e8bdc+_0xa688('0x15a'));}catch(_0x281cf4){logger[_0xa688('0x29')](_0x281cf4);}return _0x4efe37;}return this[_0xa688('0xe')]['error'](_0x358455,_0xa688('0x15b'));};AGIVertices[_0xa688('0xf')][_0xa688('0x15c')]=function(_0xac049a){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x15d'),_0xac049a['label']));if(!this[_0xa688('0x81')](_0xac049a['findBy'])){return this[_0xa688('0xe')][_0xa688('0x29')](_0xac049a,_0xa688('0x15e'));}logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x15f'),this[_0xa688('0xe')]['callerid'],_0xac049a['findBy']));var _0x1414c4=this[_0xa688('0x50')]['sync'](this,_0xac049a[_0xa688('0x160')]);if(_0x1414c4){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x161'),this[_0xa688('0xe')][_0xa688('0x37')],_0xac049a['findBy']));this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa688('0xe')][_0xa688('0x37')],_0xac049a[_0xa688('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa688('0x2b')](util[_0xa688('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa688('0xe')][_0xa688('0x37')],_0xac049a['findBy']));this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x162'),this[_0xa688('0xe')]['callerid'],_0xac049a[_0xa688('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa688('0xf')]['logout']=function(_0x4d9a5f){logger[_0xa688('0x2b')](util[_0xa688('0x51')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x4d9a5f[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x4d9a5f[_0xa688('0x160')])){return this[_0xa688('0xe')]['error'](_0x4d9a5f,_0xa688('0x15e'));}logger['info'](util[_0xa688('0x51')](_0xa688('0x15f'),this[_0xa688('0xe')][_0xa688('0x37')],_0x4d9a5f[_0xa688('0x160')]));var _0x16c412=this[_0xa688('0x4e')][_0xa688('0xbd')](this,_0x4d9a5f[_0xa688('0x160')]);if(_0x16c412){logger[_0xa688('0x2b')](util['format'](_0xa688('0x161'),this[_0xa688('0xe')][_0xa688('0x37')],_0x4d9a5f['findBy']));this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa688('0xe')][_0xa688('0x37')],_0x4d9a5f[_0xa688('0x160')]));return{'code':0xc8,'result':_0xa688('0x163')};}else{logger['info'](util[_0xa688('0x51')](_0xa688('0x162'),this[_0xa688('0xe')]['callerid'],_0x4d9a5f[_0xa688('0x160')]));this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa688('0xe')][_0xa688('0x37')],_0x4d9a5f[_0xa688('0x160')]));return{'code':0xc8,'result':_0xa688('0x164')};}};AGIVertices[_0xa688('0xf')][_0xa688('0x165')]=function(_0x9e056e){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x166'),_0x9e056e[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x9e056e['operation'])){return this['channel'][_0xa688('0x29')](_0x9e056e,_0xa688('0x167'));}this[_0xa688('0xe')][_0xa688('0xa7')](util['format'](_0xa688('0x168'),_0x9e056e[_0xa688('0x169')]));var _0xd28dd1=eval(_0x9e056e[_0xa688('0x169')]);if(!this['isConfigured'](_0x9e056e['variable_id'])){return this['channel'][_0xa688('0xa7')](_0xa688('0xd8'));}var _0x132a7e=this[_0xa688('0x10')][_0xa688('0xbd')](this,_0x9e056e[_0xa688('0xd7')]);if(!_0x132a7e){return this[_0xa688('0xe')][_0xa688('0x29')](_0x9e056e,'no\x20variable\x20found');}if(_[_0xa688('0x98')](_0xd28dd1)){var _0x3d12a7=this;_0xd28dd1[_0xa688('0x16a')](function(_0x43e4c4,_0x2c231f){_0x3d12a7['channel'][_0xa688('0x9e')](util[_0xa688('0x51')](_0xa688('0x16b'),_0x132a7e,_0x2c231f),_0x43e4c4);});return this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x16c'),_0x132a7e));}else{return this['channel']['setVariable'](_0x132a7e,_0xd28dd1);}};AGIVertices[_0xa688('0xf')][_0xa688('0x16d')]=function(_0x399dc4){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x16e'),_0x399dc4[_0xa688('0x34')]));if(_0x399dc4[_0xa688('0x110')]===0x0){return this[_0xa688('0xa5')](_0x399dc4);}_0x399dc4[_0xa688('0x110')]-=0x1;if(!this[_0xa688('0x81')](_0x399dc4['file_id'])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x399dc4,_0xa688('0x111'));}var _0xb16119=this['getSound'][_0xa688('0xbd')](this,_0x399dc4['file_id']);if(!_0xb16119){return this[_0xa688('0xe')][_0xa688('0x29')](_0x399dc4,_0xa688('0x113'));}var _0x2881ed=this['channel'][_0xa688('0x114')](_0xb16119,_0x399dc4[_0xa688('0x115')],_0x399dc4['digit']);var _0x34af62=_0x2881ed[_0xa688('0xa3')];if(_0x2881ed[_0xa688('0xa3')]===-0x1){this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x399dc4,'-1');return _0x2881ed;}else if(_0x2881ed['extra']===_0xa688('0x60')){_0x2881ed[_0xa688('0xa3')]=_0x2881ed[_0xa688('0xa3')]['length']>0x0?_0x2881ed['result']:'t';}else if(_['isEmpty'](_0x2881ed[_0xa688('0xa3')])){_0x2881ed[_0xa688('0xa3')]='#';_0x34af62='#';}if(!this[_0xa688('0x81')](_0x399dc4['variable_id'])){this['channel']['noop'](_0xa688('0xd8'));}else{var _0x97791f=this[_0xa688('0x10')][_0xa688('0xbd')](this,_0x399dc4[_0xa688('0xd7')]);if(!_0x97791f){return this[_0xa688('0xe')][_0xa688('0x29')](_0x399dc4,'no\x20variable\x20found');}this[_0xa688('0xe')]['setVariable'](_0x97791f,_0x34af62);}this[_0xa688('0x32')]['sync'](this,_0x399dc4,_0x34af62);return _0x2881ed;};AGIVertices['prototype'][_0xa688('0xa7')]=function(_0x595416){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x16f'),_0x595416['label']));return this['channel']['noop'](_0x595416['output']||_0x595416[_0xa688('0x34')]);};AGIVertices['prototype'][_0xa688('0x170')]=function(_0x4dbe33){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x171'),_0x4dbe33[_0xa688('0x34')]));if(!this['isConfigured'](_0x4dbe33[_0xa688('0x160')])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x4dbe33,_0xa688('0x15e'));}logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x15f'),this[_0xa688('0xe')][_0xa688('0x37')],_0x4dbe33[_0xa688('0x160')]));var _0x568c56=this[_0xa688('0x172')][_0xa688('0xbd')](this,_0x4dbe33['pause_id']);var _0x5d5f5b=this[_0xa688('0x4c')][_0xa688('0xbd')](this,_0x4dbe33[_0xa688('0x160')],_0x568c56);if(_0x5d5f5b){logger[_0xa688('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x4dbe33['findBy']));this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x161'),this['channel'][_0xa688('0x37')],_0x4dbe33[_0xa688('0x160')]));return{'code':0xc8,'result':_0xa688('0x163')};}else{logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x162'),this[_0xa688('0xe')][_0xa688('0x37')],_0x4dbe33[_0xa688('0x160')]));this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x161'),this[_0xa688('0xe')]['callerid'],_0x4dbe33['findBy']));return{'code':0xc8,'result':_0xa688('0x164')};}};AGIVertices['prototype'][_0xa688('0x173')]=function(_0x1ed6f1){logger[_0xa688('0x2b')](util['format'](_0xa688('0x174'),_0x1ed6f1['label']));if(!this['isConfigured'](_0x1ed6f1[_0xa688('0x112')])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x1ed6f1,_0xa688('0x111'));}var _0x2051e5=this['getSound']['sync'](this,_0x1ed6f1[_0xa688('0x112')]);if(!_0x2051e5){return this[_0xa688('0xe')]['error'](_0x1ed6f1,'no\x20file\x20audio\x20found');}var _0x4c00a6=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0x175'),[_0x2051e5,_0x1ed6f1[_0xa688('0xe3')]]);if(_0x4c00a6['result']===-0x1){return _0x4c00a6;}return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0xc2'),'PLAYBACK',_0x2051e5));};AGIVertices['prototype'][_0xa688('0x176')]=function(_0x5afa4e){logger['info'](util[_0xa688('0x51')](_0xa688('0x177'),_0x5afa4e[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x5afa4e[_0xa688('0x178')])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x5afa4e,'no\x20queue\x20selected');}var _0x5d3238='';var _0x4ea127=parseInt(_0x5afa4e[_0xa688('0x178')],0xa);if(isNaN(_0x4ea127)){_0x5d3238=_0x5afa4e['queue_id'];}else{_0x5d3238=this[_0xa688('0x14')][_0xa688('0xbd')](this,_0x5afa4e[_0xa688('0x178')]);if(!_0x5d3238){return this['channel'][_0xa688('0x29')](_0x5afa4e,_0xa688('0x179'));}}var _0x5d9475='';if(this[_0xa688('0x81')](_0x5afa4e[_0xa688('0x112')])){var _0x3404d3=this[_0xa688('0x1e')][_0xa688('0xbd')](this,_0x5afa4e[_0xa688('0x112')]);if(_0x3404d3){_0x5d9475=_0x3404d3;}}this[_0xa688('0x32')]['sync'](this,_0x5afa4e,_0x5d3238);if(_0x5afa4e[_0xa688('0xe3')][_0xa688('0x17a')]('x')<0x0){_0x5afa4e[_0xa688('0xe3')]+='x';}if(_0x5afa4e['opts'][_0xa688('0x17a')]('X')<0x0){_0x5afa4e[_0xa688('0xe3')]+='X';}this[_0xa688('0xe')][_0xa688('0x9e')](_0xa688('0x17b'),_0x5d3238?_0x5d3238[_0xa688('0x17c')]():'');var _0xa3ef2c=this[_0xa688('0xe')][_0xa688('0xa9')]('QUEUE',[_0x5d3238,_0x5afa4e[_0xa688('0xe3')],_0x5afa4e[_0xa688('0x6e')],_0x5d9475,_0x5afa4e['timeout'],_0x5afa4e['agi'],_0x5afa4e['macro'],_0x5afa4e[_0xa688('0x17d')],'',_0x5afa4e[_0xa688('0x17e')]]);if(_0xa3ef2c[_0xa688('0xa3')]===-0x1){return _0xa3ef2c;}return this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')]('Executed\x20command\x20%s\x20%s',_0xa688('0x17f'),_0x5d3238));};AGIVertices[_0xa688('0xf')]['record']=function(_0x5717e2){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x180'),_0x5717e2[_0xa688('0x34')]));var _0x595291=_0x5717e2[_0xa688('0x181')]||_0xa688('0x130');var _0x34d2cf=util['format'](_0xa688('0x182'),this[_0xa688('0xe')][_0xa688('0x33')],rs[_0xa688('0x13c')](0x5));var _0x399ffb=util[_0xa688('0x51')](_0xa688('0x183'),FILES_PATH,_0x34d2cf,_0x595291);var _0x3958e1=util[_0xa688('0x51')](_0xa688('0x131'),FILES_PATH,_0x34d2cf);this[_0xa688('0x38')][_0xa688('0xbd')](this,_0x5717e2,_0x34d2cf,_0x399ffb);this[_0xa688('0xe')][_0xa688('0x9e')](_0xa688('0x184'),_0x34d2cf);logger[_0xa688('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x3958e1,_0x595291,_0x5717e2[_0xa688('0x185')],_0x5717e2[_0xa688('0x60')]);return this[_0xa688('0xe')][_0xa688('0x134')](_0x3958e1,_0x595291,_0x5717e2[_0xa688('0x185')],_0x5717e2[_0xa688('0x60')],undefined,!![]);};AGIVertices[_0xa688('0xf')][_0xa688('0x186')]=function(_0x5be79d){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x187'),_0x5be79d['label']));if(!this[_0xa688('0x81')](_0x5be79d['url'])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0x188'));}var _0x1b9beb=this[_0xa688('0x189')]['sync'](this,_0x5be79d);logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x18a'),util[_0xa688('0x18b')](_0x1b9beb,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5be79d[_0xa688('0xd7')])){return this[_0xa688('0xe')]['noop'](_0xa688('0x18c'));}var _0x56121e=this[_0xa688('0x10')]['sync'](this,_0x5be79d[_0xa688('0xd7')]);if(!_0x56121e){return this[_0xa688('0xe')][_0xa688('0x29')](_0x5be79d,_0xa688('0xd9'));}this[_0xa688('0xe')][_0xa688('0x9e')](util[_0xa688('0x51')]('%s_STATUS_CODE',_0x56121e),_0x1b9beb[_0xa688('0x18d')]?_0x1b9beb[_0xa688('0x18d')]:_0xa688('0x18e'));this['channel'][_0xa688('0x9e')](util['format'](_0xa688('0x18f'),_0x56121e),_0x1b9beb[_0xa688('0x71')]?_0x1b9beb[_0xa688('0x71')]:'OK');if(_0x1b9beb['body']){try{this['saveRestApiResult'](_0x1b9beb[_0xa688('0x65')],_0x56121e);}catch(_0x5aaecd){logger['error'](util['format'](_0xa688('0x190'),_0x56121e));}}return this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0xdc'),_0x56121e));};AGIVertices[_0xa688('0xf')][_0xa688('0x191')]=function(_0x4d3643){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x192'),_0x4d3643[_0xa688('0x34')]));return this[_0xa688('0xe')]['sayDigits'](_0x4d3643['digits'][_0xa688('0x55')](/\s+/g,''),_0x4d3643['escape_digits']);};AGIVertices[_0xa688('0xf')][_0xa688('0x193')]=function(_0x550f38){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x194'),_0x550f38[_0xa688('0x34')]));return this[_0xa688('0xe')][_0xa688('0x195')](_0x550f38[_0xa688('0x61')][_0xa688('0x55')](/\s+/g,''),_0x550f38[_0xa688('0x185')]);};AGIVertices[_0xa688('0xf')][_0xa688('0x196')]=function(_0x1451da){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x197'),_0x1451da['label']));return this[_0xa688('0xe')]['sayPhonetic'](_0x1451da['text'],_0x1451da[_0xa688('0x185')]);};AGIVertices['prototype'][_0xa688('0x198')]=function(_0x5c4587){logger[_0xa688('0x2b')](util[_0xa688('0x51')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5c4587[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x5c4587[_0xa688('0x199')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0x19a'));}var _0x2fbf41=this['getMailAccount'][_0xa688('0xbd')](this,_0x5c4587[_0xa688('0x199')]);if(!_0x2fbf41||!_0x2fbf41[_0xa688('0x19b')]){return this[_0xa688('0xe')][_0xa688('0x29')](_0x5c4587,'no\x20mail\x20account\x20found');}var _0xd82a4={'from':util[_0xa688('0x51')](_0xa688('0x19c'),_0x2fbf41[_0xa688('0x17')],_0x2fbf41[_0xa688('0x19d')]||_0x2fbf41[_0xa688('0x19b')]['user']),'to':_0x5c4587['to']||'','cc':_0x5c4587['cc']||'','bcc':_0x5c4587[_0xa688('0x19e')]||'','subject':_0x5c4587[_0xa688('0x19f')],'html':_0x5c4587[_0xa688('0x59')],'text':_0x5c4587[_0xa688('0x59')]};if(this[_0xa688('0x81')](_0x5c4587[_0xa688('0x1a0')])){}logger[_0xa688('0xdd')](_0xa688('0x1a1'),JSON[_0xa688('0x6f')](_0xd82a4));this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x5c4587,_0x5c4587[_0xa688('0x199')]);this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x1a2'),_0x2fbf41[_0xa688('0x17')]));this[_0xa688('0x22')][_0xa688('0xbd')](this,_0x2fbf41[_0xa688('0x1a3')],_0xd82a4);return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0x1a4'));};AGIVertices[_0xa688('0xf')]['sendFax']=function(_0xc792ac){logger['info'](util[_0xa688('0x51')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xc792ac[_0xa688('0x34')]));return this[_0xa688('0xe')][_0xa688('0xa7')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0xa688('0x1a5')]=function(_0x2ae5c2){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x1a6'),_0x2ae5c2['label']));if(!this[_0xa688('0x81')](_0x2ae5c2[_0xa688('0x1a7')])){return this[_0xa688('0xe')][_0xa688('0xa7')]('no\x20sms\x20account\x20configured');}var _0x474844=this[_0xa688('0x2f')][_0xa688('0xbd')](this,_0x2ae5c2[_0xa688('0x1a7')]);if(!_0x474844){return this[_0xa688('0xe')][_0xa688('0x29')](_0x2ae5c2,_0xa688('0x1a8'));}var _0x5939a6={'body':_0x2ae5c2[_0xa688('0x1a9')],'phone':_0x2ae5c2['to']||'','SmsAccountId':_0x474844['id']};logger[_0xa688('0xdd')]('sendSMS\x20message',JSON['stringify'](_0x5939a6));this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x2ae5c2,_0x2ae5c2['sms_account_id']);this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0x1aa'),_0x474844[_0xa688('0x17')]));this['createSmsMessage'][_0xa688('0xbd')](this,_0x5939a6);return this['channel'][_0xa688('0xa7')](_0xa688('0x1ab'));};AGIVertices['prototype'][_0xa688('0x1ac')]=function(_0x1ace58){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x1ad'),_0x1ace58['label']));if(!this[_0xa688('0x81')](_0x1ace58[_0xa688('0xd7')])){return this['channel'][_0xa688('0x29')](_0x1ace58,_0xa688('0x1ae'));}var _0x33ab2e=this[_0xa688('0x10')]['sync'](this,_0x1ace58[_0xa688('0xd7')]);if(!_0x33ab2e){return this[_0xa688('0xe')][_0xa688('0x29')](_0x1ace58,_0xa688('0xd9'));}return this['channel'][_0xa688('0x9e')](_0x33ab2e,_0x1ace58[_0xa688('0x1af')]);};AGIVertices[_0xa688('0xf')][_0xa688('0x1b0')]=function(_0x35b295){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x1b1'),_0x35b295['label']));this['channel'][_0xa688('0xa7')](_0xa688('0x1b2'));if(_0x35b295['answer']===_0xa688('0x1b3')){this[_0xa688('0xe')]['noop'](_0xa688('0x1b4'));return this[_0xa688('0xe')]['answer']();}return this['channel'][_0xa688('0xa7')](_0xa688('0x1b5'));};AGIVertices['prototype'][_0xa688('0x1b6')]=function(_0x209676){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x1b7'),_0x209676[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x209676['project_id'])){return this[_0xa688('0xe')]['error'](_0x209676,_0xa688('0x1b8'));}var _0x3f162d=this[_0xa688('0x15')][_0xa688('0xbd')](this,_0x209676['project_id']);if(!this[_0xa688('0x81')](_0x3f162d)){return this['channel']['error'](_0x209676,util[_0xa688('0x51')](_0xa688('0x1b9'),_0x209676[_0xa688('0x1ba')]));}if(_0x3f162d===this[_0xa688('0xe')][_0xa688('0x36')]){return this[_0xa688('0xe')][_0xa688('0x29')](_0x209676,_0xa688('0x1bb'));}this[_0xa688('0x32')][_0xa688('0xbd')](this,_0x209676,_0x3f162d);var _0x242c55=this[_0xa688('0xe')][_0xa688('0xa9')](_0xa688('0x1bc'),util[_0xa688('0x51')](_0xa688('0x1bd'),config['agi']['host']||_0xa688('0x1be'),_0x3f162d,this[_0xa688('0xe')][_0xa688('0x36')]));if(_0x242c55[_0xa688('0xa3')]===-0x1){return _0x242c55;}return this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0xc2'),_0xa688('0x1bc'),_0x3f162d));};AGIVertices[_0xa688('0xf')][_0xa688('0x1bf')]=function(_0xaeec81){logger['info'](util[_0xa688('0x51')](_0xa688('0x1c0'),_0xaeec81[_0xa688('0x34')]));var _0xee201f=this[_0xa688('0x54')]['sync'](this,_0xaeec81[_0xa688('0xb5')]);this[_0xa688('0x32')][_0xa688('0xbd')](this,_0xaeec81,_0xaeec81[_0xa688('0xb5')]);if(this[_0xa688('0x81')](_0xaeec81[_0xa688('0xd7')])){var _0x356c22=this[_0xa688('0x10')]['sync'](this,_0xaeec81[_0xa688('0xd7')]);if(_0x356c22){this[_0xa688('0xe')][_0xa688('0x9e')](_0x356c22,_0xee201f);return this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x1c1'),_0xaeec81[_0xa688('0xb5')],_0x356c22));}}return this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0x1c2'),_0xaeec81[_0xa688('0xb5')]));};AGIVertices[_0xa688('0xf')][_0xa688('0x1c3')]=function(_0x1343aa){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x1c4'),_0x1343aa['label']));_0x1343aa[_0xa688('0x59')]=_0x1343aa[_0xa688('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1343aa[_0xa688('0x57')])){return this[_0xa688('0xe')][_0xa688('0xa7')](_0xa688('0x1c5'));}if(!this['isConfigured'](_0x1343aa[_0xa688('0x59')])){return this[_0xa688('0xe')]['noop']('no\x20text\x20configured');}this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1343aa[_0xa688('0x59')]));var _0x260785=this[_0xa688('0x56')]['sync'](this,_0x1343aa);if(_0x260785){this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0x1c6'),_0x260785));var _0x35b945=this[_0xa688('0xe')][_0xa688('0x123')](_0x260785);try{fs[_0xa688('0x102')](_0x260785+'.wav');}catch(_0x106a67){logger['error'](_0x106a67);}return _0x35b945;}return this[_0xa688('0xe')]['error'](_0x1343aa,_0xa688('0x1c7'));};AGIVertices[_0xa688('0xf')]['tts']=function(_0x2923a2){logger['info'](util[_0xa688('0x51')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2923a2[_0xa688('0x34')]));_0x2923a2[_0xa688('0x59')]=_0x2923a2[_0xa688('0x59')][_0xa688('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa688('0x81')](_0x2923a2[_0xa688('0x59')])){return this['channel'][_0xa688('0xa7')](_0xa688('0xa8'));}this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0x1c8'),_0x2923a2[_0xa688('0x59')]));var _0x209340=this['googleTTS'][_0xa688('0xbd')](this,_0x2923a2);if(_0x209340){this[_0xa688('0xe')][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x1c9'),_0x209340));var _0x1a4fd8=this[_0xa688('0xe')]['streamFile'](_0x209340);try{fs[_0xa688('0x102')](_0x209340+'.wav');}catch(_0x1acd23){logger[_0xa688('0x29')](_0x1acd23);}return _0x1a4fd8;}return this[_0xa688('0xe')][_0xa688('0x29')](_0x2923a2,_0xa688('0x1ca'));};AGIVertices['prototype'][_0xa688('0x1cb')]=function(_0x1d7855){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x1cc'),_0x1d7855[_0xa688('0x34')]));if(!this['isConfigured'](_0x1d7855[_0xa688('0x160')])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x1d7855,_0xa688('0x15e'));}logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x15f'),this[_0xa688('0xe')][_0xa688('0x37')],_0x1d7855[_0xa688('0x160')]));var _0x589ebb=this[_0xa688('0x4d')][_0xa688('0xbd')](this,_0x1d7855['findBy']);if(_0x589ebb){logger['info'](util[_0xa688('0x51')](_0xa688('0x161'),this[_0xa688('0xe')]['callerid'],_0x1d7855[_0xa688('0x160')]));this['channel'][_0xa688('0xa7')](util[_0xa688('0x51')](_0xa688('0x161'),this[_0xa688('0xe')]['callerid'],_0x1d7855[_0xa688('0x160')]));return{'code':0xc8,'result':_0xa688('0x163')};}else{logger[_0xa688('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa688('0xe')][_0xa688('0x37')],_0x1d7855[_0xa688('0x160')]));this[_0xa688('0xe')]['noop'](util[_0xa688('0x51')](_0xa688('0x162'),this[_0xa688('0xe')][_0xa688('0x37')],_0x1d7855[_0xa688('0x160')]));return{'code':0xc8,'result':_0xa688('0x164')};}};AGIVertices[_0xa688('0xf')]['voicemail']=function(_0x349077){logger['info'](util[_0xa688('0x51')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x349077[_0xa688('0x34')]));var _0x4f8db4=this[_0xa688('0xe')]['exec'](_0xa688('0x1cd'),[_0x349077['mailbox'],_0x349077['options']]);if(_0x4f8db4[_0xa688('0xa3')]===-0x1){return _0x4f8db4;}return this[_0xa688('0xe')][_0xa688('0xa7')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x349077[_0xa688('0x1ce')]));};AGIVertices[_0xa688('0xf')][_0xa688('0x1cf')]=function(_0x2c751f){logger[_0xa688('0x2b')](util[_0xa688('0x51')](_0xa688('0x1d0'),_0x2c751f[_0xa688('0x34')]));if(!this[_0xa688('0x81')](_0x2c751f['variable_id'])){return this[_0xa688('0xe')][_0xa688('0x29')](_0x2c751f,_0xa688('0x1ae'));}var _0xf08ad9=this[_0xa688('0x10')][_0xa688('0xbd')](this,_0x2c751f[_0xa688('0xd7')]);if(!_0xf08ad9){return this[_0xa688('0xe')][_0xa688('0x29')](_0x2c751f,_0xa688('0xd9'));}var _0x35f9c5=this[_0xa688('0xe')][_0xa688('0x10')](_0xf08ad9);return{'code':0xc8,'result':_0x35f9c5[_0xa688('0xa1')]?_0x35f9c5[_0xa688('0xa1')]:'-'};};String[_0xa688('0xf')][_0xa688('0xa0')]=function(_0xd59e0b,_0x53d734){return this[_0xa688('0x9f')](_0xd59e0b)['join'](_0x53d734);};module[_0xa688('0x1d1')]=AGIVertices; \ No newline at end of file +var _0xeebe=['Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','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','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeech\x20TTS\x20is\x20unreachable','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','%s_STATUS_CODE','200','statusMessage','saydigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','template_id','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','mailRpc','prototype','getVariable','rpc','getVariableById','getVoiceQueue','getVoiceQueueById','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunk','getTrunkById','getSound','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','callback_','random','lastName','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','replace','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','googleTTS','method','number','timeout','includes','POST','PUT','toUpperCase','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','isEmpty','%s.%s','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','maxRetry','sync','retry','noop','exec','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xeebe,0xff));var _0xeeeb=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xeebe[_0x36eaaa];return _0x461349;};'use strict';var fs=require('fs');var util=require(_0xeeeb('0x0'));var _=require('lodash');var sh=require(_0xeeeb('0x1'));var odbc=require('odbc')();var rs=require(_0xeeeb('0x2'));var moment=require(_0xeeeb('0x3'));var Mustache=require(_0xeeeb('0x4'));var rp=require(_0xeeeb('0x5'));var logger=require(_0xeeeb('0x6'))(_0xeeeb('0x7'));var config=require(_0xeeeb('0x8'));var shared=require(_0xeeeb('0x9'));var scripts=require(_0xeeeb('0xa'));var FILES_PATH=_0xeeeb('0xb');var recursiveMapAttributes=[_0xeeeb('0xc'),_0xeeeb('0xd')];var verticesWithRetry=[_0xeeeb('0xe'),_0xeeeb('0xf'),_0xeeeb('0x10')];var AGIVertices=function(_0x263799,_0x22bb55,_0x426a82){this['channel']=_0x263799;this['rpc']=_0x22bb55;this[_0xeeeb('0x11')]=_0x426a82;};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x13')]=function(_0x51a844,_0x3eb739){this[_0xeeeb('0x14')][_0xeeeb('0x15')](_0x51a844)['then'](function(_0x379530){_0x3eb739(null,_0x379530?_0x379530['name']:![]);})['catch'](function(_0x309bdf){_0x3eb739(_0x309bdf);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x16')]=function(_0x292f1f,_0x476382){this[_0xeeeb('0x14')][_0xeeeb('0x17')](_0x292f1f)[_0xeeeb('0x18')](function(_0x40b8e8){_0x476382(null,_0x40b8e8?_0x40b8e8[_0xeeeb('0x19')]:![]);})[_0xeeeb('0x1a')](function(_0xd23e0e){_0x476382(_0xd23e0e);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1b')]=function(_0x253cf4,_0x1b1d02){this[_0xeeeb('0x14')][_0xeeeb('0x1c')](_0x253cf4)[_0xeeeb('0x18')](function(_0x2db8b1){_0x1b1d02(null,_0x2db8b1?_0x2db8b1[_0xeeeb('0x19')]:![]);})[_0xeeeb('0x1a')](function(_0x2dba71){_0x1b1d02(_0x2dba71);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1d')]=function(_0x4359c0,_0x434cdf){this['rpc'][_0xeeeb('0x1e')](_0x4359c0)['then'](function(_0x5ec06e){_0x434cdf(null,_0x5ec06e?_0x5ec06e['dsn']:![]);})['catch'](function(_0x9bf651){_0x434cdf(_0x9bf651);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1f')]=function(_0x2d2b7f,_0x1de972){this['rpc']['getUserById'](_0x2d2b7f)[_0xeeeb('0x18')](function(_0x27cd2b){_0x1de972(null,_0x27cd2b?_0x27cd2b[_0xeeeb('0x19')]:![]);})[_0xeeeb('0x1a')](function(_0x15aa09){_0x1de972(_0x15aa09);});};AGIVertices['prototype'][_0xeeeb('0x20')]=function(_0x422eed,_0x47aa45){this['rpc'][_0xeeeb('0x21')](_0x422eed)[_0xeeeb('0x18')](function(_0x20ee2d){_0x47aa45(null,_0x20ee2d?_0x20ee2d[_0xeeeb('0x19')]:![]);})[_0xeeeb('0x1a')](function(_0x192698){_0x47aa45(_0x192698);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x22')]=function(_0xd1732,_0x25e359){var _0x2e82aa=this;this['rpc']['getSoundById'](_0xd1732)[_0xeeeb('0x18')](function(_0x1c35d1){_0x25e359(null,_0x1c35d1?_0x2e82aa[_0xeeeb('0x23')](_0x1c35d1['save_name']):![]);})[_0xeeeb('0x1a')](function(_0x210acb){_0x25e359(_0x210acb);});};AGIVertices['prototype'][_0xeeeb('0x24')]=function(_0x243dd6,_0x15a798){this[_0xeeeb('0x14')][_0xeeeb('0x25')](_0x243dd6)[_0xeeeb('0x18')](function(_0x4d3433){_0x15a798(null,_0x4d3433?_0x4d3433:![]);})[_0xeeeb('0x1a')](function(_0x5023eb){_0x15a798(_0x5023eb);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x26')]=function(_0x2e0072,_0x276313,_0x5d08d0){this['mailRpc'][_0xeeeb('0x26')](_0x2e0072,_0x276313)[_0xeeeb('0x18')](function(){_0x5d08d0(null);})[_0xeeeb('0x1a')](function(_0x22a911){_0x5d08d0(_0x22a911);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x27')]=function(_0x5045d7,_0x2e0100){this['rpc'][_0xeeeb('0x28')](_0x5045d7)[_0xeeeb('0x18')](function(_0x449b89){if(_0x449b89){if(_0x449b89[_0xeeeb('0x29')]){_0x2e0100(null,[_0x449b89['interval']]);}else{_0x2e0100(null,_['map'](_0x449b89[_0xeeeb('0x2a')],_0xeeeb('0x2b')));}}else{_0x2e0100(null,![]);}})[_0xeeeb('0x1a')](function(_0x28c4d7){_0x2e0100(_0x28c4d7);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x23')]=function(_0x17d162){return util[_0xeeeb('0x2c')]('%s/sounds/converted/%s',FILES_PATH,_0x17d162);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x2d')]=function(_0x247756,_0x5a8ab2,_0x5ae7ff){odbc[_0xeeeb('0x2e')](_0x247756,function(_0x5505e3){if(_0x5505e3){logger[_0xeeeb('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5505e3);_0x5ae7ff(_0x5505e3);}else{logger[_0xeeeb('0x30')]('ODBC\x20connection\x20successfully');odbc['query'](_0x5a8ab2,function(_0xabaf01,_0x5ce769){if(_0xabaf01){logger[_0xeeeb('0x30')]('Error\x20executing\x20query\x20%s',_0x5a8ab2);_0x5ae7ff(_0xabaf01);}else{logger[_0xeeeb('0x30')](_0xeeeb('0x31'),_0x5a8ab2);odbc[_0xeeeb('0x32')](function(_0x507ffb){if(_0x507ffb){logger[_0xeeeb('0x2f')](_0xeeeb('0x33'),_0x507ffb);}_0x5ae7ff(null,_0x5ce769);});}});}});};AGIVertices['prototype'][_0xeeeb('0x34')]=function(_0x1735e4,_0xfe4a35){this[_0xeeeb('0x14')][_0xeeeb('0x35')](_0x1735e4)['then'](function(_0x31b540){_0xfe4a35(null,_0x31b540?_0x31b540:![]);})['catch'](function(_0x5ebea3){_0xfe4a35(_0x5ebea3);});};AGIVertices['prototype']['createSmsMessage']=function(_0x21c10f,_0x3751fb){this[_0xeeeb('0x14')][_0xeeeb('0x36')](_0x21c10f)['then'](function(_0x1f2b76){_0x3751fb(null,_0x1f2b76);})[_0xeeeb('0x1a')](function(_0x1c8f5e){_0x3751fb(_0x1c8f5e);});};AGIVertices[_0xeeeb('0x12')]['createSquareDetailsReport']=function(_0x5bc37b,_0x51d378,_0x545101){this[_0xeeeb('0x14')][_0xeeeb('0x37')]({'uniqueid':this[_0xeeeb('0x38')][_0xeeeb('0x39')],'node':_0x5bc37b[_0xeeeb('0x3a')],'application':_0x5bc37b[_0xeeeb('0x3b')],'data':_0x51d378||null,'project_name':this['channel'][_0xeeeb('0x3c')],'callerid':this[_0xeeeb('0x38')][_0xeeeb('0x3d')]})[_0xeeeb('0x18')](function(_0x52d9a6){if(_0x545101){_0x545101(null,_0x52d9a6);}})[_0xeeeb('0x1a')](function(_0x7de8de){if(_0x545101){_0x545101(_0x7de8de);}});};AGIVertices[_0xeeeb('0x12')]['createSquareRecording']=function(_0x986d6a,_0x43007a,_0x521bd7,_0x15de13){this[_0xeeeb('0x14')][_0xeeeb('0x3e')]({'uniqueid':this[_0xeeeb('0x38')][_0xeeeb('0x39')],'callerid':this[_0xeeeb('0x38')]['callerid'],'calleridname':this[_0xeeeb('0x38')]['calleridname'],'context':this[_0xeeeb('0x38')][_0xeeeb('0x3f')],'extension':this[_0xeeeb('0x38')][_0xeeeb('0x40')],'priority':this['channel'][_0xeeeb('0x41')],'accountcode':this[_0xeeeb('0x38')][_0xeeeb('0x42')],'dnid':this[_0xeeeb('0x38')][_0xeeeb('0x43')],'projectName':this[_0xeeeb('0x38')]['arg_1'],'saveName':_0x43007a,'filename':_0x986d6a[_0xeeeb('0x44')]||_0x43007a,'savePath':_0x521bd7})[_0xeeeb('0x18')](function(_0x72aa7e){_0x15de13(null,_0x72aa7e);})[_0xeeeb('0x1a')](function(_0x16b1d6){_0x15de13(_0x16b1d6);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x45')]=function(_0x5b903c,_0x8efdbe,_0x462eba,_0x4ada29,_0x1032a8){this[_0xeeeb('0x14')][_0xeeeb('0x45')]({'uniqueid':this[_0xeeeb('0x38')][_0xeeeb('0x39')],'body':_0x5b903c,'direction':_0x8efdbe,'providerName':_0x462eba,'providerResponse':_0x4ada29})[_0xeeeb('0x18')](function(_0x387bea){if(_0x1032a8){_0x1032a8(null,_0x387bea);}})[_0xeeeb('0x1a')](function(_0x1d7312){if(_0x1032a8){_0x1032a8(_0x1d7312);}});};AGIVertices[_0xeeeb('0x12')]['createCmContact']=function(_0x26bd2e,_0x29075b){this[_0xeeeb('0x14')]['createCmContact']({'firstName':_['isEmpty'](_0x26bd2e[_0xeeeb('0x19')])||_['isNil'](_0x26bd2e['name'])?_0xeeeb('0x46')+Math[_0xeeeb('0x47')]():_0x26bd2e[_0xeeeb('0x19')],'lastName':_['isEmpty'](_0x26bd2e[_0xeeeb('0x48')])||_[_0xeeeb('0x49')](_0x26bd2e[_0xeeeb('0x48')])?null:_0x26bd2e[_0xeeeb('0x48')],'phone':_0x26bd2e[_0xeeeb('0x4a')],'ListId':_0x26bd2e[_0xeeeb('0x4b')],'scheduledat':_0x26bd2e['scheduledAt'],'callbackUniqueid':this[_0xeeeb('0x38')]['uniqueid'],'tags':_0xeeeb('0x4c'),'description':_0xeeeb('0x4d')+_0x26bd2e[_0xeeeb('0x4e')][_0xeeeb('0x4f')](),'priority':_0x26bd2e[_0xeeeb('0x50')]})[_0xeeeb('0x18')](function(_0x587bcb){_0x29075b(null,_0x587bcb);})['catch'](function(_0x4fdf85){_0x29075b(_0x4fdf85);});};AGIVertices['prototype'][_0xeeeb('0x51')]=function(_0xc1f06d,_0x30bb33){this[_0xeeeb('0x14')][_0xeeeb('0x52')](_0xc1f06d)[_0xeeeb('0x18')](function(_0x1fffce){_0x30bb33(null,_0x1fffce?_0x1fffce[_0xeeeb('0x19')]:![]);})['catch'](function(_0x587570){_0x30bb33(_0x587570);});};AGIVertices['prototype'][_0xeeeb('0x53')]=function(_0x1ad67b,_0x4e0ed8,_0x2299a9){var _0x561d6a={'role':_0xeeeb('0x54')};_0x561d6a[_0x1ad67b]=this[_0xeeeb('0x38')]['callerid'];this['rpc'][_0xeeeb('0x53')](_0x561d6a,_0x4e0ed8,this[_0xeeeb('0x38')][_0xeeeb('0x39')])[_0xeeeb('0x18')](function(_0x489744){_0x2299a9(null,_[_0xeeeb('0x49')](_0x489744)?![]:!![]);})[_0xeeeb('0x1a')](function(_0x3c6528){logger[_0xeeeb('0x2f')](_0x3c6528);_0x2299a9(null,![]);});};AGIVertices['prototype'][_0xeeeb('0x55')]=function(_0x1989e0,_0x53e7d7){var _0x1b7175={'role':_0xeeeb('0x54')};_0x1b7175[_0x1989e0]=this[_0xeeeb('0x38')][_0xeeeb('0x3d')];this[_0xeeeb('0x14')][_0xeeeb('0x55')](_0x1b7175)['then'](function(_0x261761){_0x53e7d7(null,_[_0xeeeb('0x49')](_0x261761)?![]:!![]);})['catch'](function(_0xc679ac){logger[_0xeeeb('0x2f')](_0xc679ac);_0x53e7d7(null,![]);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x56')]=function(_0x1672a7,_0x20b42e){var _0x12d595={'role':_0xeeeb('0x54')};_0x12d595[_0x1672a7]=this[_0xeeeb('0x38')][_0xeeeb('0x3d')];this['rpc'][_0xeeeb('0x56')](_0x12d595)['then'](function(_0x1e087b){_0x20b42e(null,_[_0xeeeb('0x49')](_0x1e087b)?![]:!![]);})['catch'](function(_0x5904b6){logger[_0xeeeb('0x2f')](_0x5904b6);_0x20b42e(null,![]);});};AGIVertices['prototype'][_0xeeeb('0x57')]=function(_0x231d31,_0x581211){var _0x1c05d0={'role':_0xeeeb('0x54')};_0x1c05d0[_0x231d31]=this[_0xeeeb('0x38')][_0xeeeb('0x3d')];var _0x11d8af=_0x231d31!=_0xeeeb('0x58')?util[_0xeeeb('0x2c')](_0xeeeb('0x59'),'LOCAL',this[_0xeeeb('0x38')][_0xeeeb('0x3d')]):undefined;this[_0xeeeb('0x14')][_0xeeeb('0x57')](_0x1c05d0,_0x11d8af)[_0xeeeb('0x18')](function(_0x1da01b){_0x581211(null,_['isNil'](_0x1da01b)?![]:!![]);})[_0xeeeb('0x1a')](function(_0x126747){logger[_0xeeeb('0x2f')](_0x126747);_0x581211(null,![]);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x5a')]=function(_0x170601,_0x2bd357){sh['exec'](_['trim'](_0x170601),function(_0x14dc1f,_0x515b66){var _0xedb3a2=_0x515b66[_0xeeeb('0x5b')](/(\r\n|\n|\r)/gm,'');_0x2bd357(null,_0xedb3a2);});};AGIVertices[_0xeeeb('0x12')]['googleCloudTTS']=function(_0x206a5f,_0x1c7457){scripts['googleCloudTTS'](_0x206a5f[_0xeeeb('0x5c')],_0x206a5f['google_cloud_tts_text_type']||_0xeeeb('0x5d'),_0x206a5f['text'],_0x206a5f[_0xeeeb('0x5e')]||_0xeeeb('0x5f'),_0x206a5f[_0xeeeb('0x60')]||'MALE',_0x206a5f[_0xeeeb('0x61')]||'MP3')[_0xeeeb('0x18')](function(_0x4b273b){_0x1c7457(null,_0x4b273b);})['catch'](function(_0x4f875f){_0x1c7457(_0x4f875f);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x62')]=function(_0x224717,_0x5c88b1){scripts[_0xeeeb('0x62')](_0x224717[_0xeeeb('0x5d')],_0x224717['google_tts_language']||'en',0x1)[_0xeeeb('0x18')](function(_0x10a44c){_0x5c88b1(null,_0x10a44c);})[_0xeeeb('0x1a')](function(_0x2a15ff){_0x5c88b1(_0x2a15ff);});};AGIVertices['prototype']['restAPI']=function(_0xa3d617,_0x46f400){var _0x397714={'uri':_0xa3d617['url'],'method':_0xa3d617[_0xeeeb('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xa3d617['timeout'])===_0xeeeb('0x64')&&parseInt(_0xa3d617['timeout'])>=0x1?parseInt(_0xa3d617[_0xeeeb('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xeeeb('0x66')]([_0xeeeb('0x67'),_0xeeeb('0x68')],_0x397714[_0xeeeb('0x63')][_0xeeeb('0x69')]())){try{_0x397714['body']=_0xa3d617[_0xeeeb('0xd')]?JSON[_0xeeeb('0x6a')](_0xa3d617[_0xeeeb('0xd')]):{};}catch(_0x3fc839){logger[_0xeeeb('0x2f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3fc839);}}try{_0x397714[_0xeeeb('0x6b')]=_0xa3d617['rawHeaders']?JSON[_0xeeeb('0x6a')](_0xa3d617['rawHeaders']):{};}catch(_0x2d9972){logger['error'](_0xeeeb('0x6c'),_0x2d9972);}if(_0xa3d617[_0xeeeb('0x6d')]){try{var _0x55cb48=require(_0xa3d617[_0xeeeb('0x6d')])['sync'](this,_0x397714);_0x397714[_0xeeeb('0x6e')]=Mustache[_0xeeeb('0x6f')](_0xa3d617[_0xeeeb('0x70')],_0x55cb48,{},['$$','$$']);if(_0x397714[_0xeeeb('0x6b')]){_0x397714['headers']=JSON['parse'](Mustache[_0xeeeb('0x6f')](JSON['stringify'](_0x397714[_0xeeeb('0x6b')]),_0x55cb48,{},['$$','$$']));}if(_0x397714[_0xeeeb('0x71')]){_0x397714[_0xeeeb('0x71')]=JSON[_0xeeeb('0x6a')](Mustache[_0xeeeb('0x6f')](JSON[_0xeeeb('0x72')](_0x397714[_0xeeeb('0x71')]),_0x55cb48,{},['$$','$$']));}}catch(_0x4931cb){logger[_0xeeeb('0x2f')](_0xeeeb('0x73'),_0x4931cb);}}rp(_0x397714)[_0xeeeb('0x18')](function(_0x301982){var _0x2feddf={'statusCode':_0x301982[_0xeeeb('0x74')]||0xc8,'statusMessage':_0x301982['statusMessage']||'OK','headers':_0x301982['headers']||{},'body':_0x301982[_0xeeeb('0x71')]||{}};_0x46f400(null,_0x2feddf);})[_0xeeeb('0x1a')](function(_0x44109e){var _0x1459d0={'statusCode':_0x44109e['statusCode']||0x1f4,'statusMessage':_0x44109e[_0xeeeb('0x75')]||_0xeeeb('0x76'),'headers':_0x44109e[_0xeeeb('0x77')][_0xeeeb('0x6b')]||{},'body':_0x44109e[_0xeeeb('0x77')][_0xeeeb('0x71')]||{}};_0x46f400(null,_0x1459d0);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x78')]=function(_0x1a0bf8,_0x119969){scripts[_0xeeeb('0x78')](this[_0xeeeb('0x38')][_0xeeeb('0x39')],_0x1a0bf8[_0xeeeb('0x79')],_0x1a0bf8[_0xeeeb('0x5d')],_0x1a0bf8['dialogflow_language']||'en')[_0xeeeb('0x18')](function(_0x1863c1){_0x119969(null,_0x1863c1);})[_0xeeeb('0x1a')](function(_0x3beeb8){_0x119969(_0x3beeb8);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x7a')]=function(_0x4eee21,_0x347183){scripts[_0xeeeb('0x7a')](this[_0xeeeb('0x38')]['uniqueid'],_0x4eee21['dialogflowV2_project_id'],_0x4eee21[_0xeeeb('0x7b')],_0x4eee21['private_key'],_0x4eee21['text'],_0x4eee21[_0xeeeb('0x7c')]||'en')[_0xeeeb('0x18')](function(_0x56f5bc){_0x347183(null,_0x56f5bc);})[_0xeeeb('0x1a')](function(_0x40c39c){_0x347183(_0x40c39c);});};AGIVertices['prototype'][_0xeeeb('0x7d')]=function(_0xe27710,_0xe68c87){scripts['sestekNDA'](this['channel'],_0xe27710)['then'](function(_0x5ddc75){_0xe68c87(null,_0x5ddc75);})[_0xeeeb('0x1a')](function(_0x412de1){_0xe68c87(_0x412de1);});};AGIVertices[_0xeeeb('0x12')]['ispeechTTS']=function(_0x589a3a,_0xa41356){scripts[_0xeeeb('0x7e')](_0x589a3a['key'],_0x589a3a['text'],_0x589a3a[_0xeeeb('0x7f')]||'en-US',_0x589a3a[_0xeeeb('0x80')])[_0xeeeb('0x18')](function(_0x4e51ef){_0xa41356(null,_0x4e51ef);})[_0xeeeb('0x1a')](function(_0x9fe369){_0xa41356(_0x9fe369);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x81')]=function(_0x45d51f,_0x5a2732,_0x80d840){scripts[_0xeeeb('0x81')](_0x5a2732,_0x45d51f[_0xeeeb('0x79')],_0x45d51f[_0xeeeb('0x82')]||'en-US',this[_0xeeeb('0x83')](_0x45d51f[_0xeeeb('0x84')])?_0x45d51f['model']:undefined)[_0xeeeb('0x18')](function(_0x69ba8){_0x80d840(null,_0x69ba8);})[_0xeeeb('0x1a')](function(_0x102ed4){_0x80d840(_0x102ed4);});};AGIVertices['prototype'][_0xeeeb('0x85')]=function(_0x49978c,_0x20fa2a){scripts[_0xeeeb('0x85')](_0x49978c['aws_access_key_id'],_0x49978c['aws_secret_access_key'],_0x49978c[_0xeeeb('0x86')],_0x49978c[_0xeeeb('0x87')]||'Amy',_0x49978c['text'],_0x49978c[_0xeeeb('0x88')]||_0xeeeb('0x5d'))[_0xeeeb('0x18')](function(_0x16bbe2){_0x20fa2a(null,_0x16bbe2);})['catch'](function(_0x2fcaba){_0x20fa2a(_0x2fcaba);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x89')]=function(_0x397c39,_0x43b631){scripts[_0xeeeb('0x89')](this['channel']['uniqueid'],_0x397c39[_0xeeeb('0x8a')],_0x397c39[_0xeeeb('0x8b')],_0x397c39[_0xeeeb('0x8c')],_0x397c39['text'],_0x397c39[_0xeeeb('0x8d')])[_0xeeeb('0x18')](function(_0x495d74){_0x43b631(null,_0x495d74);})[_0xeeeb('0x1a')](function(_0x1dd755){_0x43b631(_0x1dd755);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x8e')]=function(_0x5c7e22,_0x845f15,_0x129649){scripts['googleASR'](_0x845f15,_0x5c7e22[_0xeeeb('0x79')],_0x5c7e22[_0xeeeb('0x8f')]||_0xeeeb('0x5f'))[_0xeeeb('0x18')](function(_0x267e77){_0x129649(null,_0x267e77);})[_0xeeeb('0x1a')](function(_0x355618){_0x129649(_0x355618);});};AGIVertices[_0xeeeb('0x12')]['tildeASR']=function(_0x53acb2,_0x474772,_0x41fb33){scripts[_0xeeeb('0x90')](_0x474772,_0x53acb2[_0xeeeb('0x91')],_0x53acb2['appsecret'],_0x53acb2['uri'])[_0xeeeb('0x18')](function(_0x14280e){_0x41fb33(null,_0x14280e);})[_0xeeeb('0x1a')](function(_0x5e3909){_0x41fb33(_0x5e3909);});};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x92')]=function(_0x6f2b69){var _0x1b7b9a=_[_0xeeeb('0x66')](verticesWithRetry,_0x6f2b69[_0xeeeb('0x3b')])?_0x6f2b69:_[_0xeeeb('0x93')](_0x6f2b69);for(var _0x115332 in _0x1b7b9a){if(_0x1b7b9a[_0xeeeb('0x94')](_0x115332)){if(_0x1b7b9a[_0x115332]&&_[_0xeeeb('0x95')](_0x1b7b9a[_0x115332])){if(_[_0xeeeb('0x66')](recursiveMapAttributes,_0x115332)){_0x1b7b9a[_0x115332]=this[_0xeeeb('0x96')](_0x1b7b9a[_0x115332]);}else{_0x1b7b9a[_0x115332]=this[_0xeeeb('0x97')](_0x1b7b9a[_0x115332]);}}}}return _0x1b7b9a;};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x98')]=function(_0x2b5509){for(var _0x31e322 in _0x2b5509){if(_0x2b5509['hasOwnProperty'](_0x31e322)){if(_['isPlainObject'](_0x2b5509[_0x31e322])){this['recursiveNodeIndex'](_0x2b5509[_0x31e322]);}else if(_[_0xeeeb('0x99')](_0x2b5509[_0x31e322])){for(var _0xdd43b2=0x0;_0xdd43b2<_0x2b5509[_0x31e322][_0xeeeb('0x9a')];_0xdd43b2++){this[_0xeeeb('0x98')](_0x2b5509[_0x31e322][_0xdd43b2]);}}else if(_[_0xeeeb('0x95')](_0x2b5509[_0x31e322])){_0x2b5509[_0x31e322]=this[_0xeeeb('0x97')](_0x2b5509[_0x31e322]);}}}};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x9b')]=function(_0x26855c,_0x3f97a8){for(var _0x5b4e78 in _0x26855c){if(_0x26855c[_0xeeeb('0x94')](_0x5b4e78)){if(_[_0xeeeb('0x9c')](_0x26855c[_0x5b4e78])){if(!_[_0xeeeb('0x9d')](_0x26855c[_0x5b4e78])){this[_0xeeeb('0x9b')](_0x26855c[_0x5b4e78],util[_0xeeeb('0x2c')](_0xeeeb('0x9e'),_0x3f97a8,_0x5b4e78));}}else if(_[_0xeeeb('0x99')](_0x26855c[_0x5b4e78])){for(var _0x3251e6=0x0;_0x3251e6<_0x26855c[_0x5b4e78][_0xeeeb('0x9a')];_0x3251e6++){this[_0xeeeb('0x9b')](_0x26855c[_0x5b4e78][_0x3251e6],util[_0xeeeb('0x2c')](_0xeeeb('0x9e'),_0x3f97a8,_0x5b4e78+'['+_0x3251e6+']'));}}else{if(!_[_0xeeeb('0x49')](_0x26855c[_0x5b4e78])){this['channel']['setVariable'](util[_0xeeeb('0x2c')](_0xeeeb('0x9e'),_0x3f97a8,_0x5b4e78),_0x26855c[_0x5b4e78]);}}}}};AGIVertices[_0xeeeb('0x12')]['replaceObjectAllVariables']=function(_0x5e27ed){try{var _0x4862f0=JSON[_0xeeeb('0x6a')](_0x5e27ed);this[_0xeeeb('0x98')](_0x4862f0);return JSON[_0xeeeb('0x72')](_0x4862f0);}catch(_0x212352){return this[_0xeeeb('0x97')](_0x5e27ed);}};AGIVertices['prototype'][_0xeeeb('0x97')]=function(_0x1462d7){var _0x5bb65c=_0x1462d7[_0xeeeb('0x9f')]('{');for(var _0x1c99c8=0x1;_0x1c99c8<_0x5bb65c['length'];_0x1c99c8+=0x1){var _0x300854=_0x5bb65c[_0x1c99c8][_0xeeeb('0x9f')]('}');if(_0x300854[_0xeeeb('0x9a')]>0x1){_0x1462d7=_0x1462d7[_0xeeeb('0xa0')]('{'+_0x300854[0x0]+'}',this[_0xeeeb('0x38')][_0xeeeb('0x13')](_0x300854[0x0])['extra']||_0x300854[0x0]);}}if(_0x5bb65c[_0xeeeb('0x9a')]===0x1){return _0x1462d7[_0xeeeb('0x4f')]();}return this[_0xeeeb('0x97')](_0x1462d7);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0xa1')]=function(_0x3f5daf,_0x5005de){var _0x14cdc0=this['channel'][_0xeeeb('0x13')](_0x3f5daf);if(_0x14cdc0[_0xeeeb('0xa2')]===-0x1){return _0x14cdc0;}logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xa3'),_0x5005de,_0x14cdc0[_0xeeeb('0xa4')]));return this[_0xeeeb('0x38')][_0xeeeb('0xa5')](_0x5005de,_0x14cdc0[_0xeeeb('0xa4')]);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x83')]=function(_0x20155b){return _0x20155b&&_0x20155b!=='0'&&_0x20155b!=='-1'&&_0x20155b!=='';};AGIVertices['prototype'][_0xeeeb('0xa6')]=function(_0x4e1a2e){this[_0xeeeb('0x37')][_0xeeeb('0xa7')](this,_0x4e1a2e,'-');_0x4e1a2e[_0xeeeb('0xa8')]=_0x4e1a2e['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xeeeb('0x12')]['mrcpsynth']=function(_0x1e16ed){logger[_0xeeeb('0x30')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1e16ed['label']));if(!this[_0xeeeb('0x83')](_0x1e16ed[_0xeeeb('0x5d')])){return this['channel'][_0xeeeb('0xa9')]('no\x20text\x20configured');}var _0x3b6c18='\x22'+_0x1e16ed['text']+'\x22';if(this[_0xeeeb('0x83')](_0x1e16ed[_0xeeeb('0x77')])){_0x3b6c18+=','+_0x1e16ed['options'];}var _0x80f42e=this['channel'][_0xeeeb('0xaa')]('MRCPSynth',_0x3b6c18);if(_0x80f42e[_0xeeeb('0xa2')]===-0x1){return _0x80f42e;}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xab'),_0x3b6c18));};AGIVertices['prototype']['mrcprecog']=function(_0x4e83cc){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xac'),_0x4e83cc[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x4e83cc['grammar'])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xad'));}var _0x8ebf42=_0x4e83cc[_0xeeeb('0xae')];if(this[_0xeeeb('0x83')](_0x4e83cc['options'])){_0x8ebf42+=','+_0x4e83cc[_0xeeeb('0x77')];}var _0x506f12=this[_0xeeeb('0x38')]['exec'](_0xeeeb('0xaf'),_0x8ebf42);if(_0x506f12[_0xeeeb('0xa2')]===-0x1){return _0x506f12;}var _0x4089ce=this['getAndSetVariable'](_0xeeeb('0xb0'),_0xeeeb('0xb1'));if(_0x4089ce['result']===-0x1){return _0x4089ce;}var _0xc6afd8=this[_0xeeeb('0xa1')](_0xeeeb('0xb2'),'MRCP_RECOG_TRANSCRIPT');if(_0xc6afd8[_0xeeeb('0xa2')]===-0x1){return _0xc6afd8;}var _0x3048bc=this['getAndSetVariable'](_0xeeeb('0xb3'),_0xeeeb('0xb4'));if(_0x3048bc[_0xeeeb('0xa2')]===-0x1){return _0x3048bc;}return this[_0xeeeb('0x38')]['noop'](util[_0xeeeb('0x2c')](_0xeeeb('0xb5'),_0x8ebf42));};AGIVertices['prototype']['agi']=function(_0x1833a3){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xb6'),_0x1833a3[_0xeeeb('0x3a')]));return this[_0xeeeb('0x38')][_0xeeeb('0x7')]([_0x1833a3[_0xeeeb('0xb7')],_0x1833a3[_0xeeeb('0xb8')]]);};AGIVertices[_0xeeeb('0x12')]['answer']=function(_0x166588){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xb9'),_0x166588[_0xeeeb('0x3a')]));if(this[_0xeeeb('0x83')](_0x166588['timeout'])){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xba'),_0x166588[_0xeeeb('0x65')]));var _0x57364d=this[_0xeeeb('0x38')][_0xeeeb('0xbb')](_0x166588[_0xeeeb('0x65')]);if(_0x57364d[_0xeeeb('0xa2')]===-0x1){return _0x57364d;}}return this[_0xeeeb('0x38')]['answer']();};AGIVertices[_0xeeeb('0x12')]['callback']=function(_0x1441b2){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x1441b2[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x1441b2['list_id'])){return this[_0xeeeb('0x38')]['error'](_0x1441b2,_0xeeeb('0xbc'));}_0x1441b2['scheduledAt']=moment();if(this[_0xeeeb('0x83')](_0x1441b2[_0xeeeb('0xbd')])){_0x1441b2[_0xeeeb('0x4e')]=moment()[_0xeeeb('0xbe')](_0x1441b2[_0xeeeb('0xbd')],'minutes');}if(!this['isConfigured'](_0x1441b2[_0xeeeb('0x50')])){_0x1441b2[_0xeeeb('0x50')]=0x2;}this[_0xeeeb('0xbf')][_0xeeeb('0xa7')](this,_0x1441b2);return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xc0'),_0x1441b2['phone'],_0x1441b2[_0xeeeb('0x4b')],_0x1441b2[_0xeeeb('0x4e')]));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0xc1')]=function(_0x4bfade){logger[_0xeeeb('0x30')](util['format'](_0xeeeb('0xc2'),_0x4bfade[_0xeeeb('0x3a')]));var _0x360248=this['channel'][_0xeeeb('0xaa')](_0x4bfade[_0xeeeb('0xc3')],_0x4bfade[_0xeeeb('0x77')]);if(_0x360248[_0xeeeb('0xa2')]===-0x1){return _0x360248;}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xc4'),_0x4bfade[_0xeeeb('0xc3')],_0x4bfade[_0xeeeb('0x77')]));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0xc5')]=function(_0x5ae665){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xc6'),_0x5ae665[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x5ae665[_0xeeeb('0x5d')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}var _0x2bafe3='\x22'+_0x5ae665[_0xeeeb('0x5d')]+'\x22';if(this[_0xeeeb('0x83')](_0x5ae665[_0xeeeb('0x77')])){_0x2bafe3+=','+_0x5ae665['options'];}var _0x4498ce=this[_0xeeeb('0x38')][_0xeeeb('0xaa')]('MRCPSynth',_0x2bafe3);if(_0x4498ce[_0xeeeb('0xa2')]===-0x1){return _0x4498ce;}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xab'),_0x2bafe3));};AGIVertices[_0xeeeb('0x12')]['sestektts']=function(_0x409e02){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xc8'),_0x409e02[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x409e02[_0xeeeb('0x5d')])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}var _0x589f9b='\x22'+_0x409e02[_0xeeeb('0x5d')]+'\x22';if(this[_0xeeeb('0x83')](_0x409e02[_0xeeeb('0x77')])){_0x589f9b+=','+_0x409e02[_0xeeeb('0x77')];}var _0x1f2b24=this[_0xeeeb('0x38')][_0xeeeb('0xaa')](_0xeeeb('0xc9'),_0x589f9b);if(_0x1f2b24[_0xeeeb('0xa2')]===-0x1){return _0x1f2b24;}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xab'),_0x589f9b));};AGIVertices[_0xeeeb('0x12')]['lumenvoxasr']=function(_0x32ddb1){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xca'),_0x32ddb1['label']));if(!this[_0xeeeb('0x83')](_0x32ddb1[_0xeeeb('0xae')])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0xad'));}var _0x192067=_0x32ddb1[_0xeeeb('0xae')];if(this[_0xeeeb('0x83')](_0x32ddb1[_0xeeeb('0x77')])){_0x192067+=','+_0x32ddb1['options'];}var _0x2d5fa3=this['channel'][_0xeeeb('0xaa')](_0xeeeb('0xaf'),_0x192067);if(_0x2d5fa3[_0xeeeb('0xa2')]===-0x1){return _0x2d5fa3;}var _0x5f3ddf=this[_0xeeeb('0xa1')]('RECOG_CONFIDENCE()',_0xeeeb('0xcb'));if(_0x5f3ddf[_0xeeeb('0xa2')]===-0x1){return _0x5f3ddf;}var _0x364fe3=this[_0xeeeb('0xa1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x364fe3['result']===-0x1){return _0x364fe3;}var _0x19ab4e=this[_0xeeeb('0xa1')](_0xeeeb('0xb3'),_0xeeeb('0xcc'));if(_0x19ab4e[_0xeeeb('0xa2')]===-0x1){return _0x19ab4e;}return this['channel']['noop'](util[_0xeeeb('0x2c')](_0xeeeb('0xb5'),_0x192067));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0xcd')]=function(_0xb2f134){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xce'),_0xb2f134[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0xb2f134[_0xeeeb('0xae')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xad'));}var _0x482baf=_0xb2f134['grammar'];if(this[_0xeeeb('0x83')](_0xb2f134['options'])){_0x482baf+=','+_0xb2f134[_0xeeeb('0x77')];}var _0x165cd6=this[_0xeeeb('0x38')][_0xeeeb('0xaa')](_0xeeeb('0xaf'),_0x482baf);if(_0x165cd6['result']===-0x1){return _0x165cd6;}var _0x3cab09=this[_0xeeeb('0xa1')](_0xeeeb('0xb0'),_0xeeeb('0xcf'));if(_0x3cab09[_0xeeeb('0xa2')]===-0x1){return _0x3cab09;}var _0x40bde0=this[_0xeeeb('0xa1')]('RECOG_INPUT()',_0xeeeb('0xd0'));if(_0x40bde0[_0xeeeb('0xa2')]===-0x1){return _0x40bde0;}var _0x2662dd=this['getAndSetVariable']('RECOG_INSTANCE()',_0xeeeb('0xd1'));if(_0x2662dd[_0xeeeb('0xa2')]===-0x1){return _0x2662dd;}return this[_0xeeeb('0x38')]['noop'](util[_0xeeeb('0x2c')](_0xeeeb('0xb5'),_0x482baf));};AGIVertices[_0xeeeb('0x12')]['database']=function(_0x28500a){logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0xd2'),_0x28500a['label']));if(!this[_0xeeeb('0x83')](_0x28500a[_0xeeeb('0xd3')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x28500a,_0xeeeb('0xd4'));}var _0x5843cc=this[_0xeeeb('0x1d')]['sync'](this,_0x28500a[_0xeeeb('0xd3')]);if(!_0x5843cc){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x28500a,_0xeeeb('0xd5'));}if(!this[_0xeeeb('0x83')](_0x28500a['query'])){return this[_0xeeeb('0x38')]['error'](_0x28500a,'no\x20query\x20configured');}var _0x1c3f88=_0x28500a[_0xeeeb('0xd6')][_0xeeeb('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xd7'),_0x1c3f88));var _0x16c698=this[_0xeeeb('0x2d')]['sync'](this,_0x5843cc,_0x1c3f88);this[_0xeeeb('0x37')][_0xeeeb('0xa7')](this,_0x28500a,_0x1c3f88);if(!this[_0xeeeb('0x83')](_0x28500a[_0xeeeb('0xd8')])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0xd9'));}var _0x3163e8=this[_0xeeeb('0x13')][_0xeeeb('0xa7')](this,_0x28500a['variable_id']);if(!_0x3163e8){return this[_0xeeeb('0x38')]['error'](_0x28500a,_0xeeeb('0xda'));}var _0x541f83=this;_0x16c698['forEach'](function(_0x315111,_0x58bbfb){Object[_0xeeeb('0xdb')](_0x315111)[_0xeeeb('0xdc')](function(_0x42b230){_0x541f83[_0xeeeb('0x38')][_0xeeeb('0xa5')](util[_0xeeeb('0x2c')]('%s[%s][%s]',_0x3163e8,_0x58bbfb,_0x42b230),_0x315111[_0x42b230]);});});this[_0xeeeb('0x38')][_0xeeeb('0xa5')](util[_0xeeeb('0x2c')](_0xeeeb('0xdd'),_0x3163e8),_0x16c698[_0xeeeb('0x9a')]);return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format'](_0xeeeb('0xde'),_0x3163e8));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0xdf')]=function(_0xc70bd3){logger[_0xeeeb('0xe0')](util[_0xeeeb('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xc70bd3[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0xc70bd3[_0xeeeb('0xe1')])){return this[_0xeeeb('0x38')]['error'](_0xc70bd3,_0xeeeb('0xe2'));}var _0x348a60=this[_0xeeeb('0x1f')][_0xeeeb('0xa7')](this,_0xc70bd3[_0xeeeb('0xe1')]);if(!_0x348a60){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0xc70bd3,_0xeeeb('0xe3'));}var _0x3ddafe=this[_0xeeeb('0x38')]['exec']('DIAL',[util[_0xeeeb('0x2c')](_0xeeeb('0xe4'),_0x348a60),_0xc70bd3[_0xeeeb('0x65')],_0xc70bd3['opts'],_0xc70bd3[_0xeeeb('0x70')]]);if(_0x3ddafe[_0xeeeb('0xa2')]===-0x1){return _0x3ddafe;}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')]('Executed\x20command\x20%s',_0xeeeb('0xe5')));};AGIVertices[_0xeeeb('0x12')]['dialogflow']=function(_0x3b2add){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xe6'),_0x3b2add[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x3b2add[_0xeeeb('0x79')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xe7'));}if(!this[_0xeeeb('0x83')](_0x3b2add['text'])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}this[_0xeeeb('0x38')][_0xeeeb('0xe8')]=!![];this['createSquareDetailsReport'](_0x3b2add);this[_0xeeeb('0x45')](_0x3b2add['text'],'in','','');this[_0xeeeb('0x38')]['noop'](util['format'](_0xeeeb('0xe9'),_0x3b2add[_0xeeeb('0x5d')]));var _0x181ef3=this[_0xeeeb('0x78')][_0xeeeb('0xa7')](this,_0x3b2add);if(_0x181ef3){for(var _0x4bce18 in _0x181ef3){if(_0x181ef3[_0xeeeb('0x94')](_0x4bce18)){this[_0xeeeb('0x38')]['setVariable'](util[_0xeeeb('0x2c')](_0xeeeb('0xea'),_0x4bce18[_0xeeeb('0x69')]()),_0x181ef3[_0x4bce18]);}}this[_0xeeeb('0x45')](_0x181ef3[_0xeeeb('0xeb')],_0xeeeb('0xec'),_0xeeeb('0xed'),'');return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xee'),_0x181ef3[_0xeeeb('0xeb')]));}return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x3b2add,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xeeeb('0xef')]=function(_0x1a1f83){logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0xf0'),_0x1a1f83[_0xeeeb('0x3a')]));if(!this['isConfigured'](_0x1a1f83[_0xeeeb('0xf1')])){return this['channel'][_0xeeeb('0xa9')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x1a1f83[_0xeeeb('0x7b')])){return this['channel'][_0xeeeb('0xa9')]('no\x20client_email\x20configured');}if(!this[_0xeeeb('0x83')](_0x1a1f83['private_key'])){return this[_0xeeeb('0x38')]['noop'](_0xeeeb('0xf2'));}if(!this[_0xeeeb('0x83')](_0x1a1f83[_0xeeeb('0x7c')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xf3'));}if(!this[_0xeeeb('0x83')](_0x1a1f83[_0xeeeb('0x5d')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}this['channel']['bot']=!![];this[_0xeeeb('0x37')](_0x1a1f83);this[_0xeeeb('0x45')](_0x1a1f83[_0xeeeb('0x5d')],'in','','');this['channel'][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xf4'),_0x1a1f83['text']));var _0x422223=this[_0xeeeb('0x7a')][_0xeeeb('0xa7')](this,_0x1a1f83);if(_0x422223){for(var _0x472028 in _0x422223){if(_0x422223['hasOwnProperty'](_0x472028)){if(_0x472028!==_0xeeeb('0xf5')){this['channel']['setVariable'](util['format']('DIALOGFLOW_%s',_0x472028[_0xeeeb('0x69')]()),_0x422223[_0x472028]);}}}this[_0xeeeb('0x45')](_0x422223['speech'],_0xeeeb('0xec'),'dialogflowV2',_0x422223[_0xeeeb('0xf5')]);return this['channel'][_0xeeeb('0xa9')](util['format'](_0xeeeb('0xf6'),_0x422223[_0xeeeb('0xeb')]));}return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x1a1f83,_0xeeeb('0xf7'));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0xf8')]=function(_0xb2cfed){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0xf9'),_0xb2cfed[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0xb2cfed[_0xeeeb('0xfa')])){return this['channel']['noop'](_0xeeeb('0xfb'));}if(!this[_0xeeeb('0x83')](_0xb2cfed[_0xeeeb('0xfc')])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0xfd'));}if(!this[_0xeeeb('0x83')](_0xb2cfed[_0xeeeb('0xfe')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')]('no\x20password\x20configured');}if(!this['isConfigured'](_0xb2cfed[_0xeeeb('0xff')])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0xb2cfed);this[_0xeeeb('0x45')](_0xb2cfed[_0xeeeb('0x5d')],'in','','');this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')]('Trying\x20SestekNDA:\x20%s',_0xb2cfed[_0xeeeb('0x5d')]));var _0x3ebe18=this['sestekNDA'][_0xeeeb('0xa7')](this,_0xb2cfed);if(_0x3ebe18){for(var _0x2613e4 in _0x3ebe18){if(_0x3ebe18[_0xeeeb('0x94')](_0x2613e4)){this[_0xeeeb('0x38')]['setVariable'](util['format'](_0xeeeb('0x100'),_0x2613e4[_0xeeeb('0x69')]()),_0x3ebe18[_0x2613e4]);}}this[_0xeeeb('0x45')](_0x3ebe18['speech'],_0xeeeb('0xec'),_0xeeeb('0xf8'),'');if(_0x3ebe18[_0xeeeb('0x101')]){this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format'](_0xeeeb('0x102'),_0x3ebe18[_0xeeeb('0x101')]));var _0x1725b7=this['channel'][_0xeeeb('0x103')](_0x3ebe18['audiofile']);try{fs[_0xeeeb('0x104')](_0x3ebe18[_0xeeeb('0x101')]+_0xeeeb('0x105'));}catch(_0x1e9370){logger[_0xeeeb('0x2f')](_0x1e9370);}return _0x1725b7;}else{return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x106'),_0x3ebe18[_0xeeeb('0xeb')]));}}return this['channel']['error'](_0xb2cfed,_0xeeeb('0x107'));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x108')]=function(_0xc89446){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')]('Enter\x20in\x20END\x20(%s)\x20block',_0xc89446[_0xeeeb('0x3a')]));return this[_0xeeeb('0x38')][_0xeeeb('0xa9')]('end');};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x109')]=function(_0x3f5de4){logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0x10a'),_0x3f5de4[_0xeeeb('0x3a')]));var _0x10032c='';if(_0x3f5de4[_0xeeeb('0x10b')]){if(!this[_0xeeeb('0x83')](_0x3f5de4[_0xeeeb('0x10b')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x3f5de4,'no\x20trunk\x20selected');}else{var _0x6228e8=parseInt(_0x3f5de4[_0xeeeb('0x10b')],0xa);if(isNaN(_0x6228e8)){_0x10032c=_0x3f5de4[_0xeeeb('0x10b')];}else{_0x10032c=this['getTrunk'][_0xeeeb('0xa7')](this,_0x3f5de4['trunk_id']);if(!_0x10032c){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x3f5de4,'no\x20trunk\x20found');}}}}else if(_0x3f5de4[_0xeeeb('0x10c')]){_0x10032c=_0x3f5de4['trunk_name'];}else{return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x3f5de4,_0xeeeb('0x10d'));}var _0x2edf1a=this['channel'][_0xeeeb('0xaa')](_0xeeeb('0xe5'),[util[_0xeeeb('0x2c')](_0xeeeb('0x10e'),_0x10032c,_0x3f5de4[_0xeeeb('0x4a')]),_0x3f5de4['timeout'],_0x3f5de4[_0xeeeb('0x10f')],_0x3f5de4[_0xeeeb('0x70')]]);if(_0x2edf1a['result']===-0x1){return _0x2edf1a;}return this['channel'][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x110'),'DIAL'));};AGIVertices['prototype']['finally']=function(_0x4f81a0){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x111'),_0x4f81a0[_0xeeeb('0x3a')]));return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x112'));};AGIVertices[_0xeeeb('0x12')]['getdigits']=function(_0x6b6743){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x113'),_0x6b6743[_0xeeeb('0x3a')]));if(_0x6b6743[_0xeeeb('0xa8')]===0x0){return this['maxRetry'](_0x6b6743);}_0x6b6743[_0xeeeb('0xa8')]-=0x1;if(!this[_0xeeeb('0x83')](_0x6b6743[_0xeeeb('0x114')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x6b6743,_0xeeeb('0x115'));}var _0x11175e=this[_0xeeeb('0x22')]['sync'](this,_0x6b6743[_0xeeeb('0x114')]);if(!_0x11175e){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x6b6743,'no\x20file\x20audio\x20found');}if(!this[_0xeeeb('0x83')](_0x6b6743[_0xeeeb('0xd8')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0xeeeb('0xd9'));}var _0x2403f0=this[_0xeeeb('0x38')]['getData'](_0x11175e,_0x6b6743[_0xeeeb('0x116')],_0x6b6743['maxdigit']);var _0x4877e1=_0x2403f0['result']?_0x2403f0[_0xeeeb('0xa2')]['toString']():'';logger[_0xeeeb('0x30')](_0xeeeb('0x117'),JSON['stringify'](_0x2403f0));if(_0x2403f0[_0xeeeb('0xa2')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x6b6743,_0x4877e1);return _0x2403f0;}else if(_0x2403f0[_0xeeeb('0xa4')]===_0xeeeb('0x65')){_0x2403f0[_0xeeeb('0xa2')]=_0x4877e1[_0xeeeb('0x9a')]>=parseInt(_0x6b6743[_0xeeeb('0x118')])?'x':'i';}else{_0x2403f0[_0xeeeb('0xa2')]=_0x4877e1['length']>=parseInt(_0x6b6743[_0xeeeb('0x118')])&&_0x4877e1[_0xeeeb('0x9a')]<=parseInt(_0x6b6743[_0xeeeb('0x119')])?'x':'i';}var _0x451c41=this[_0xeeeb('0x13')][_0xeeeb('0xa7')](this,_0x6b6743[_0xeeeb('0xd8')]);if(!_0x451c41){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x6b6743,_0xeeeb('0xda'));}this[_0xeeeb('0x38')][_0xeeeb('0xa5')](_0x451c41,_0x4877e1);if(this['isConfigured'](_0x6b6743[_0xeeeb('0x11a')])){var _0x14dbd9=parseInt(_0x6b6743[_0xeeeb('0x11a')],0xa);var _0x5ae337=rs[_0xeeeb('0x11b')]({'charset':'*','length':_0x14dbd9});var _0xe7f4f1=_0x4877e1[_0xeeeb('0x9a')];if(_0xe7f4f1>0x0){if(_0xe7f4f1>_0x14dbd9){this['createSquareDetailsReport'][_0xeeeb('0xa7')](this,_0x6b6743,_0x6b6743[_0xeeeb('0x11c')]===_0xeeeb('0x11d')?_0x5ae337+_0x4877e1['substr'](_0x14dbd9):_0x4877e1[_0xeeeb('0x11e')](0x0,_0xe7f4f1-_0x14dbd9)+_0x5ae337);}else{this[_0xeeeb('0x37')][_0xeeeb('0xa7')](this,_0x6b6743,rs[_0xeeeb('0x11b')]({'charset':'*','length':_0xe7f4f1}));}}else{this['createSquareDetailsReport'][_0xeeeb('0xa7')](this,_0x6b6743,'');}}else{this[_0xeeeb('0x37')]['sync'](this,_0x6b6743,_0x4877e1);}return _0x2403f0;};AGIVertices['prototype'][_0xeeeb('0x10')]=function(_0x1aee93){logger['info'](util[_0xeeeb('0x2c')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1aee93[_0xeeeb('0x3a')]));return this[_0xeeeb('0xf')](_0x1aee93);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x11f')]=function(_0x9f0c24){logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0x120'),_0x9f0c24['label']));this[_0xeeeb('0x37')]['sync'](this,_0x9f0c24,_0x9f0c24[_0xeeeb('0x121')]);return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x122'),_0x9f0c24[_0xeeeb('0x121')]));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x123')]=function(_0x1ee094){logger['info'](util['format'](_0xeeeb('0x124'),_0x1ee094[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x1ee094[_0xeeeb('0x8a')])||!this[_0xeeeb('0x83')](_0x1ee094['aws_secret_access_key'])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x125'));}if(!this[_0xeeeb('0x83')](_0x1ee094[_0xeeeb('0x5d')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x126'),_0x1ee094[_0xeeeb('0x5d')]));var _0x4bd09e=this['awsPolly']['sync'](this,_0x1ee094);if(_0x4bd09e){this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x4bd09e));var _0x862979=this[_0xeeeb('0x38')][_0xeeeb('0x103')](_0x4bd09e);try{fs[_0xeeeb('0x104')](_0x4bd09e+_0xeeeb('0x105'));}catch(_0x2447dd){logger[_0xeeeb('0x2f')](_0x2447dd);}return _0x862979;}return this[_0xeeeb('0x38')]['error'](_0x1ee094,_0xeeeb('0x127'));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x128')]=function(_0x1778ed){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x129'),_0x1778ed[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x1778ed[_0xeeeb('0x8a')])||!this[_0xeeeb('0x83')](_0x1778ed[_0xeeeb('0x8b')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x125'));}if(!this[_0xeeeb('0x83')](_0x1778ed[_0xeeeb('0x8d')])){return this[_0xeeeb('0x38')]['noop'](_0xeeeb('0x12a'));}if(!this[_0xeeeb('0x83')](_0x1778ed[_0xeeeb('0x5d')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}this[_0xeeeb('0x38')][_0xeeeb('0xe8')]=!![];this[_0xeeeb('0x37')](_0x1778ed);this[_0xeeeb('0x45')](_0x1778ed[_0xeeeb('0x5d')],'in','','');this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x1778ed[_0xeeeb('0x5d')]));var _0x2057f6=this[_0xeeeb('0x89')][_0xeeeb('0xa7')](this,_0x1778ed);if(_0x2057f6){for(var _0x5f1553 in _0x2057f6){if(_0x2057f6[_0xeeeb('0x94')](_0x5f1553)&&_['isString'](_0x2057f6[_0x5f1553])){this[_0xeeeb('0x38')][_0xeeeb('0xa5')](util[_0xeeeb('0x2c')](_0xeeeb('0x12b'),_0x5f1553[_0xeeeb('0x69')]()),_0x2057f6[_0x5f1553]);}}if(_[_0xeeeb('0x49')](_0x2057f6[_0xeeeb('0x75')])){return this['channel']['noop'](_0xeeeb('0x12c'));}else{this[_0xeeeb('0x45')](_0x2057f6[_0xeeeb('0x75')],_0xeeeb('0xec'),'amazonlex','');return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x12d'),_0x2057f6['message']));}}return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x1778ed,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x12e')]=function(_0x5713fa){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5713fa['label'],_0x5713fa[_0xeeeb('0x65')]));if(!this['isConfigured'](_0x5713fa[_0xeeeb('0x79')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xe7'));}var _0x2e9795=_0xeeeb('0x12f');var _0x522020=util['format'](_0xeeeb('0x130'),FILES_PATH,rs[_0xeeeb('0x11b')](0x4));var _0x1a0f1b=util['format'](_0xeeeb('0x9e'),_0x522020,_0x2e9795);var _0x4d8a17=!![];if(_0x5713fa['beep']===_0xeeeb('0x131')){_0x4d8a17=![];}var _0x513d22=this['channel']['recordFile'](_0x522020,_0x2e9795,_0x5713fa[_0xeeeb('0x132')],_0x5713fa[_0xeeeb('0x65')],undefined,_0x4d8a17);if(_0x513d22['result']!==-0x1){this[_0xeeeb('0x38')]['noop'](util['format'](_0xeeeb('0x133'),_0x1a0f1b));var _0x394d69=this['googleASR'][_0xeeeb('0xa7')](this,_0x5713fa,_0x1a0f1b);if(_0x394d69){for(var _0x264f3e in _0x394d69){if(_0x394d69[_0xeeeb('0x94')](_0x264f3e)){this[_0xeeeb('0x38')][_0xeeeb('0xa5')](util['format'](_0xeeeb('0x134'),_0x264f3e[_0xeeeb('0x69')]()),_0x394d69[_0x264f3e]);}}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')]('GoogleASR\x20Result\x20%s',JSON[_0xeeeb('0x72')](_0x394d69)));}}return _0x513d22;};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x135')]=function(_0x39a808){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x136'),_0x39a808[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x39a808[_0xeeeb('0x91')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')]('no\x20appid\x20configured');}if(!this[_0xeeeb('0x83')](_0x39a808['appsecret'])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x137'));}var _0x20bcd3=_0xeeeb('0x12f');var _0x12fc8a=util[_0xeeeb('0x2c')](_0xeeeb('0x130'),FILES_PATH,rs[_0xeeeb('0x11b')](0x4));var _0x1a72c1=util[_0xeeeb('0x2c')](_0xeeeb('0x9e'),_0x12fc8a,_0x20bcd3);var _0x1c8811=!![];if(_0x39a808[_0xeeeb('0x138')]===_0xeeeb('0x131')){_0x1c8811=![];}var _0x569e17=this[_0xeeeb('0x38')][_0xeeeb('0x139')](_0x12fc8a,_0x20bcd3,_0x39a808[_0xeeeb('0x132')],_0x39a808[_0xeeeb('0x65')],undefined,_0x1c8811);if(_0x569e17[_0xeeeb('0xa2')]!==-0x1){this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format'](_0xeeeb('0x13a'),_0x1a72c1));var _0x427e81=this[_0xeeeb('0x90')][_0xeeeb('0xa7')](this,_0x39a808,_0x1a72c1);if(_0x427e81){for(var _0x36035c in _0x427e81){if(_0x427e81['hasOwnProperty'](_0x36035c)){this['channel'][_0xeeeb('0xa5')](util[_0xeeeb('0x2c')](_0xeeeb('0x13b'),_0x36035c[_0xeeeb('0x69')]()),_0x427e81[_0x36035c]);}}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x13c'),JSON[_0xeeeb('0x72')](_0x427e81)));}}return _0x569e17;};AGIVertices[_0xeeeb('0x12')]['gotoc']=function(_0x5023ef){logger[_0xeeeb('0x30')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5023ef[_0xeeeb('0x3a')]));return this[_0xeeeb('0x38')][_0xeeeb('0x13d')](_0x5023ef[_0xeeeb('0x3f')],_0x5023ef['extension'],_0x5023ef[_0xeeeb('0x41')]);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x13e')]=function(_0x4fe876){logger[_0xeeeb('0x30')](util['format'](_0xeeeb('0x13f'),_0x4fe876[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x4fe876[_0xeeeb('0x140')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x4fe876,_0xeeeb('0x141'));}try{var _0x5d0b4b=eval(_0x4fe876[_0xeeeb('0x140')])?_0xeeeb('0x142'):_0xeeeb('0x143');this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x144'),_0x4fe876[_0xeeeb('0x140')],_0x5d0b4b));return{'code':0xc8,'result':_0x5d0b4b};}catch(_0x56199a){return{'code':0xc8,'result':_0xeeeb('0x143')};}};AGIVertices[_0xeeeb('0x12')]['gotoiftime']=function(_0x54e22f){logger[_0xeeeb('0x30')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x54e22f['label']));if(!this[_0xeeeb('0x83')](_0x54e22f[_0xeeeb('0x145')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x54e22f,_0xeeeb('0x146'));}var _0x196278=this[_0xeeeb('0x27')][_0xeeeb('0xa7')](this,_0x54e22f['interval_id']);if(!_0x196278){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x54e22f,_0xeeeb('0x147'));}for(var _0x17ce06=0x0;_0x17ce06<_0x196278[_0xeeeb('0x9a')];_0x17ce06+=0x1){var _0x119c1d=this[_0xeeeb('0x38')][_0xeeeb('0x13')](util[_0xeeeb('0x2c')](_0xeeeb('0x148'),_0x196278[_0x17ce06]));if(_0x119c1d[_0xeeeb('0xa2')]===-0x1){return _0x119c1d;}logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x149'),_0x196278[_0x17ce06],_0x119c1d[_0xeeeb('0xa4')]));if(_0x119c1d['extra']==='true'){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x149'),_0x196278[_0x17ce06],_0xeeeb('0x142')));this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x149'),_0x196278[_0x17ce06],_0xeeeb('0x142')));return{'code':0xc8,'result':_0xeeeb('0x142')};}else{logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0x149'),_0x196278[_0x17ce06],'false'));this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x149'),_0x196278[_0x17ce06],'false'));}}return{'code':0xc8,'result':_0xeeeb('0x143')};};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x14a')]=function(_0x3ead57){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x14b'),_0x3ead57['label']));return this['channel'][_0xeeeb('0x14a')]();};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x14c')]=function(_0xc91d56){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0xc91d56['label']));if(!this[_0xeeeb('0x83')](_0xc91d56[_0xeeeb('0x79')])){return this['channel'][_0xeeeb('0xa9')]('no\x20key\x20configured');}var _0x59d3c6=_0xeeeb('0x12f');var _0x367c69=util['format'](_0xeeeb('0x130'),FILES_PATH,rs[_0xeeeb('0x11b')](0x4));var _0x5478b6=util[_0xeeeb('0x2c')](_0xeeeb('0x9e'),_0x367c69,_0x59d3c6);var _0xccc7f1=!![];if(_0xc91d56[_0xeeeb('0x138')]===_0xeeeb('0x131')){_0xccc7f1=![];}var _0x2f5436=this[_0xeeeb('0x38')][_0xeeeb('0x139')](_0x367c69,_0x59d3c6,_0xc91d56[_0xeeeb('0x132')],_0xc91d56[_0xeeeb('0x65')],undefined,_0xccc7f1);if(_0x2f5436[_0xeeeb('0xa2')]!==-0x1){this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x14d'),_0x5478b6));var _0x4f6345=this['ispeechASR'][_0xeeeb('0xa7')](this,_0xc91d56,_0x5478b6);if(_0x4f6345){for(var _0x5ca924 in _0x4f6345){if(_0x4f6345['hasOwnProperty'](_0x5ca924)){this[_0xeeeb('0x38')][_0xeeeb('0xa5')](util[_0xeeeb('0x2c')](_0xeeeb('0x14e'),_0x5ca924['toUpperCase']()),_0x4f6345[_0x5ca924]);}}return this['channel'][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')]('IspeechASR\x20Result\x20%s',JSON[_0xeeeb('0x72')](_0x4f6345)));}}return _0x2f5436;};AGIVertices[_0xeeeb('0x12')]['ispeechtts']=function(_0x2a77d6){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2a77d6[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x2a77d6[_0xeeeb('0x79')])){return this['channel']['noop'](_0xeeeb('0xe7'));}if(!this[_0xeeeb('0x83')](_0x2a77d6[_0xeeeb('0x5d')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')]('Trying\x20ispeech\x20TTS\x20%s',_0x2a77d6[_0xeeeb('0x5d')]));var _0x5ed272=this['ispeechTTS'][_0xeeeb('0xa7')](this,_0x2a77d6);if(_0x5ed272){this['channel'][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x14d'),_0x5ed272));var _0x3c1368=this[_0xeeeb('0x38')]['streamFile'](_0x5ed272,_0x2a77d6[_0xeeeb('0x132')]);try{fs[_0xeeeb('0x104')](_0x5ed272+_0xeeeb('0x105'));}catch(_0x4edb2c){logger[_0xeeeb('0x2f')](_0x4edb2c);}return _0x3c1368;}return this[_0xeeeb('0x38')]['error'](_0x2a77d6,_0xeeeb('0x14f'));};AGIVertices['prototype']['login']=function(_0x460d3f){logger['info'](util[_0xeeeb('0x2c')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x460d3f[_0xeeeb('0x3a')]));if(!this['isConfigured'](_0x460d3f['findBy'])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x460d3f,_0xeeeb('0x150'));}logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xeeeb('0x38')]['callerid'],_0x460d3f['findBy']));var _0x1ae2c1=this[_0xeeeb('0x57')][_0xeeeb('0xa7')](this,_0x460d3f['findBy']);if(_0x1ae2c1){logger[_0xeeeb('0x30')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x460d3f[_0xeeeb('0x151')]));this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x152'),this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x460d3f[_0xeeeb('0x151')]));return{'code':0xc8,'result':_0xeeeb('0x153')};}else{logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x460d3f[_0xeeeb('0x151')]));this['channel'][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x154'),this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x460d3f[_0xeeeb('0x151')]));return{'code':0xc8,'result':_0xeeeb('0x155')};}};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x156')]=function(_0x4e1fd8){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x157'),_0x4e1fd8[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x4e1fd8[_0xeeeb('0x151')])){return this['channel'][_0xeeeb('0x2f')](_0x4e1fd8,_0xeeeb('0x150'));}logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x158'),this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x4e1fd8[_0xeeeb('0x151')]));var _0xae0382=this['agentLogout']['sync'](this,_0x4e1fd8[_0xeeeb('0x151')]);if(_0xae0382){logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0x152'),this[_0xeeeb('0x38')]['callerid'],_0x4e1fd8[_0xeeeb('0x151')]));this['channel'][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x152'),this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x4e1fd8[_0xeeeb('0x151')]));return{'code':0xc8,'result':_0xeeeb('0x153')};}else{logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x154'),this['channel'][_0xeeeb('0x3d')],_0x4e1fd8[_0xeeeb('0x151')]));this['channel'][_0xeeeb('0xa9')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x4e1fd8[_0xeeeb('0x151')]));return{'code':0xc8,'result':_0xeeeb('0x155')};}};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x159')]=function(_0x1b0250){logger[_0xeeeb('0x30')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1b0250[_0xeeeb('0x3a')]));if(!this['isConfigured'](_0x1b0250[_0xeeeb('0x15a')])){return this[_0xeeeb('0x38')]['error'](_0x1b0250,_0xeeeb('0x15b'));}this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x15c'),_0x1b0250['operation']));var _0x65b172=eval(_0x1b0250[_0xeeeb('0x15a')]);if(!this[_0xeeeb('0x83')](_0x1b0250[_0xeeeb('0xd8')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5dce0d=this[_0xeeeb('0x13')]['sync'](this,_0x1b0250['variable_id']);if(!_0x5dce0d){return this['channel'][_0xeeeb('0x2f')](_0x1b0250,_0xeeeb('0xda'));}if(_[_0xeeeb('0x99')](_0x65b172)){var _0x535a3f=this;_0x65b172[_0xeeeb('0xdc')](function(_0x32f829,_0x51d6d4){_0x535a3f[_0xeeeb('0x38')][_0xeeeb('0xa5')](util[_0xeeeb('0x2c')]('%s[%s]',_0x5dce0d,_0x51d6d4),_0x32f829);});return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x15d'),_0x5dce0d));}else{return this[_0xeeeb('0x38')][_0xeeeb('0xa5')](_0x5dce0d,_0x65b172);}};AGIVertices['prototype'][_0xeeeb('0xe')]=function(_0x519bf6){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x15e'),_0x519bf6[_0xeeeb('0x3a')]));if(_0x519bf6[_0xeeeb('0xa8')]===0x0){return this['maxRetry'](_0x519bf6);}_0x519bf6[_0xeeeb('0xa8')]-=0x1;if(!this[_0xeeeb('0x83')](_0x519bf6[_0xeeeb('0x114')])){return this[_0xeeeb('0x38')]['error'](_0x519bf6,_0xeeeb('0x115'));}var _0x20919f=this['getSound'][_0xeeeb('0xa7')](this,_0x519bf6[_0xeeeb('0x114')]);if(!_0x20919f){return this['channel'][_0xeeeb('0x2f')](_0x519bf6,_0xeeeb('0x15f'));}var _0x2e7b41=this['channel']['getData'](_0x20919f,_0x519bf6['response'],_0x519bf6[_0xeeeb('0x160')]);var _0x22e011=_0x2e7b41[_0xeeeb('0xa2')];if(_0x2e7b41[_0xeeeb('0xa2')]===-0x1){this['createSquareDetailsReport'][_0xeeeb('0xa7')](this,_0x519bf6,'-1');return _0x2e7b41;}else if(_0x2e7b41[_0xeeeb('0xa4')]===_0xeeeb('0x65')){_0x2e7b41[_0xeeeb('0xa2')]=_0x2e7b41['result']['length']>0x0?_0x2e7b41[_0xeeeb('0xa2')]:'t';}else if(_['isEmpty'](_0x2e7b41[_0xeeeb('0xa2')])){_0x2e7b41['result']='#';_0x22e011='#';}if(!this[_0xeeeb('0x83')](_0x519bf6[_0xeeeb('0xd8')])){this['channel']['noop'](_0xeeeb('0xd9'));}else{var _0x22cb45=this[_0xeeeb('0x13')][_0xeeeb('0xa7')](this,_0x519bf6[_0xeeeb('0xd8')]);if(!_0x22cb45){return this[_0xeeeb('0x38')]['error'](_0x519bf6,_0xeeeb('0xda'));}this[_0xeeeb('0x38')]['setVariable'](_0x22cb45,_0x22e011);}this[_0xeeeb('0x37')][_0xeeeb('0xa7')](this,_0x519bf6,_0x22e011);return _0x2e7b41;};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0xa9')]=function(_0x291b09){logger['info'](util[_0xeeeb('0x2c')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x291b09[_0xeeeb('0x3a')]));return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0x291b09[_0xeeeb('0x161')]||_0x291b09[_0xeeeb('0x3a')]);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x162')]=function(_0x4eebd0){logger[_0xeeeb('0x30')](util['format'](_0xeeeb('0x163'),_0x4eebd0[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x4eebd0[_0xeeeb('0x151')])){return this['channel'][_0xeeeb('0x2f')](_0x4eebd0,_0xeeeb('0x150'));}logger['info'](util[_0xeeeb('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xeeeb('0x3d')],_0x4eebd0[_0xeeeb('0x151')]));var _0x58e8c3=this['getPause'][_0xeeeb('0xa7')](this,_0x4eebd0[_0xeeeb('0x164')]);var _0x8eaf6e=this[_0xeeeb('0x53')]['sync'](this,_0x4eebd0['findBy'],_0x58e8c3);if(_0x8eaf6e){logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0x152'),this[_0xeeeb('0x38')]['callerid'],_0x4eebd0['findBy']));this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x152'),this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x4eebd0['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xeeeb('0x30')](util['format'](_0xeeeb('0x154'),this['channel'][_0xeeeb('0x3d')],_0x4eebd0['findBy']));this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x152'),this[_0xeeeb('0x38')]['callerid'],_0x4eebd0[_0xeeeb('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xeeeb('0x165')]=function(_0x20fbfd){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x20fbfd[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x20fbfd[_0xeeeb('0x114')])){return this['channel'][_0xeeeb('0x2f')](_0x20fbfd,_0xeeeb('0x115'));}var _0x17546f=this[_0xeeeb('0x22')][_0xeeeb('0xa7')](this,_0x20fbfd[_0xeeeb('0x114')]);if(!_0x17546f){return this['channel'][_0xeeeb('0x2f')](_0x20fbfd,_0xeeeb('0x15f'));}var _0x597b59=this[_0xeeeb('0x38')][_0xeeeb('0xaa')](_0xeeeb('0x166'),[_0x17546f,_0x20fbfd['opts']]);if(_0x597b59['result']===-0x1){return _0x597b59;}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xc4'),'PLAYBACK',_0x17546f));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x167')]=function(_0x345b9f){logger[_0xeeeb('0x30')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x345b9f['label']));if(!this[_0xeeeb('0x83')](_0x345b9f[_0xeeeb('0x168')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x345b9f,'no\x20queue\x20selected');}var _0x27e2e2='';var _0xfbd477=parseInt(_0x345b9f['queue_id'],0xa);if(isNaN(_0xfbd477)){_0x27e2e2=_0x345b9f['queue_id'];}else{_0x27e2e2=this['getVoiceQueue']['sync'](this,_0x345b9f[_0xeeeb('0x168')]);if(!_0x27e2e2){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x345b9f,_0xeeeb('0x169'));}}var _0x48e825='';if(this['isConfigured'](_0x345b9f[_0xeeeb('0x114')])){var _0xe9649a=this[_0xeeeb('0x22')][_0xeeeb('0xa7')](this,_0x345b9f[_0xeeeb('0x114')]);if(_0xe9649a){_0x48e825=_0xe9649a;}}this[_0xeeeb('0x37')]['sync'](this,_0x345b9f,_0x27e2e2);if(_0x345b9f['opts'][_0xeeeb('0x16a')]('x')<0x0){_0x345b9f['opts']+='x';}if(_0x345b9f[_0xeeeb('0x10f')][_0xeeeb('0x16a')]('X')<0x0){_0x345b9f[_0xeeeb('0x10f')]+='X';}this['channel'][_0xeeeb('0xa5')](_0xeeeb('0x16b'),_0x27e2e2?_0x27e2e2[_0xeeeb('0x16c')]():'');var _0x5f3e5f=this[_0xeeeb('0x38')][_0xeeeb('0xaa')](_0xeeeb('0x16d'),[_0x27e2e2,_0x345b9f['opts'],_0x345b9f[_0xeeeb('0x70')],_0x48e825,_0x345b9f[_0xeeeb('0x65')],_0x345b9f[_0xeeeb('0x7')],_0x345b9f[_0xeeeb('0x16e')],_0x345b9f[_0xeeeb('0x16f')],'',_0x345b9f['position']]);if(_0x5f3e5f[_0xeeeb('0xa2')]===-0x1){return _0x5f3e5f;}return this['channel'][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xc4'),_0xeeeb('0x16d'),_0x27e2e2));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x170')]=function(_0x2e5c7e){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x171'),_0x2e5c7e[_0xeeeb('0x3a')]));var _0x3a0315=_0x2e5c7e[_0xeeeb('0x172')]||_0xeeeb('0x12f');var _0x1dcda3=util[_0xeeeb('0x2c')](_0xeeeb('0x173'),this[_0xeeeb('0x38')][_0xeeeb('0x39')],rs[_0xeeeb('0x11b')](0x5));var _0x34a553=util[_0xeeeb('0x2c')](_0xeeeb('0x174'),FILES_PATH,_0x1dcda3,_0x3a0315);var _0x5b0750=util[_0xeeeb('0x2c')]('%s/recordings/%s',FILES_PATH,_0x1dcda3);this['createSquareRecording'][_0xeeeb('0xa7')](this,_0x2e5c7e,_0x1dcda3,_0x34a553);this[_0xeeeb('0x38')][_0xeeeb('0xa5')](_0xeeeb('0x175'),_0x1dcda3);logger['info'](_0xeeeb('0x176'),_0x5b0750,_0x3a0315,_0x2e5c7e['escape_digits'],_0x2e5c7e['timeout']);return this['channel'][_0xeeeb('0x139')](_0x5b0750,_0x3a0315,_0x2e5c7e['escape_digits'],_0x2e5c7e[_0xeeeb('0x65')],undefined,!![]);};AGIVertices[_0xeeeb('0x12')]['restapi']=function(_0x4a1dc9){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x177'),_0x4a1dc9['label']));if(!this[_0xeeeb('0x83')](_0x4a1dc9[_0xeeeb('0x70')])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0x178'));}var _0x4711d2=this[_0xeeeb('0x179')][_0xeeeb('0xa7')](this,_0x4a1dc9);logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x17a'),util[_0xeeeb('0x17b')](_0x4711d2,{'showHidden':![],'depth':null})));if(!this[_0xeeeb('0x83')](_0x4a1dc9[_0xeeeb('0xd8')])){return this['channel'][_0xeeeb('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0xdddc2d=this['getVariable'][_0xeeeb('0xa7')](this,_0x4a1dc9[_0xeeeb('0xd8')]);if(!_0xdddc2d){return this[_0xeeeb('0x38')]['error'](_0x4a1dc9,_0xeeeb('0xda'));}this[_0xeeeb('0x38')][_0xeeeb('0xa5')](util[_0xeeeb('0x2c')](_0xeeeb('0x17c'),_0xdddc2d),_0x4711d2[_0xeeeb('0x74')]?_0x4711d2[_0xeeeb('0x74')]:_0xeeeb('0x17d'));this['channel'][_0xeeeb('0xa5')](util[_0xeeeb('0x2c')]('%s_STATUS_MESSAGE',_0xdddc2d),_0x4711d2[_0xeeeb('0x17e')]?_0x4711d2[_0xeeeb('0x17e')]:'OK');if(_0x4711d2['body']){try{this['saveRestApiResult'](_0x4711d2[_0xeeeb('0x71')],_0xdddc2d);}catch(_0x21bd69){logger['error'](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xdddc2d));}}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format'](_0xeeeb('0xde'),_0xdddc2d));};AGIVertices['prototype'][_0xeeeb('0x17f')]=function(_0x22262e){logger['info'](util[_0xeeeb('0x2c')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x22262e[_0xeeeb('0x3a')]));return this[_0xeeeb('0x38')]['sayDigits'](_0x22262e[_0xeeeb('0x180')]['replace'](/\s+/g,''),_0x22262e[_0xeeeb('0x181')]);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x182')]=function(_0x3e658c){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x183'),_0x3e658c[_0xeeeb('0x3a')]));return this['channel']['sayNumber'](_0x3e658c[_0xeeeb('0x64')][_0xeeeb('0x5b')](/\s+/g,''),_0x3e658c['escape_digits']);};AGIVertices[_0xeeeb('0x12')]['sayphonetic']=function(_0x308b1c){logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0x184'),_0x308b1c[_0xeeeb('0x3a')]));return this[_0xeeeb('0x38')][_0xeeeb('0x185')](_0x308b1c[_0xeeeb('0x5d')],_0x308b1c[_0xeeeb('0x181')]);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x186')]=function(_0xd7ad62){logger['info'](util['format'](_0xeeeb('0x187'),_0xd7ad62[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0xd7ad62['account_id'])){return this['channel']['noop']('no\x20mail\x20account\x20configured');}var _0x53a814=this['getMailAccount'][_0xeeeb('0xa7')](this,_0xd7ad62[_0xeeeb('0x188')]);if(!_0x53a814||!_0x53a814[_0xeeeb('0x189')]){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0xd7ad62,_0xeeeb('0x18a'));}var _0x1bb3b6={'from':util[_0xeeeb('0x2c')]('\x22%s\x22\x20<%s>',_0x53a814['name'],_0x53a814[_0xeeeb('0x18b')]||_0x53a814[_0xeeeb('0x189')][_0xeeeb('0x18c')]),'to':_0xd7ad62['to']||'','cc':_0xd7ad62['cc']||'','bcc':_0xd7ad62[_0xeeeb('0x18d')]||'','subject':_0xd7ad62[_0xeeeb('0x18e')],'html':_0xd7ad62[_0xeeeb('0x5d')],'text':_0xd7ad62['text']};if(this[_0xeeeb('0x83')](_0xd7ad62[_0xeeeb('0x18f')])){}logger[_0xeeeb('0xe0')]('sendMail\x20message',JSON[_0xeeeb('0x72')](_0x1bb3b6));this[_0xeeeb('0x37')][_0xeeeb('0xa7')](this,_0xd7ad62,_0xd7ad62[_0xeeeb('0x188')]);this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x53a814['name']));this[_0xeeeb('0x26')][_0xeeeb('0xa7')](this,_0x53a814[_0xeeeb('0x190')],_0x1bb3b6);return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x191'));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x192')]=function(_0x45d7d7){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x193'),_0x45d7d7[_0xeeeb('0x3a')]));return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0x194'));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x195')]=function(_0x133235){logger['info'](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x133235['label']));if(!this['isConfigured'](_0x133235[_0xeeeb('0x196')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x197'));}var _0xb35f25=this[_0xeeeb('0x34')][_0xeeeb('0xa7')](this,_0x133235[_0xeeeb('0x196')]);if(!_0xb35f25){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x133235,_0xeeeb('0x198'));}var _0x2443d5={'body':_0x133235[_0xeeeb('0x199')],'phone':_0x133235['to']||'','SmsAccountId':_0xb35f25['id']};logger['debug'](_0xeeeb('0x19a'),JSON['stringify'](_0x2443d5));this[_0xeeeb('0x37')][_0xeeeb('0xa7')](this,_0x133235,_0x133235[_0xeeeb('0x196')]);this[_0xeeeb('0x38')]['noop'](util[_0xeeeb('0x2c')](_0xeeeb('0x19b'),_0xb35f25[_0xeeeb('0x19')]));this[_0xeeeb('0x36')]['sync'](this,_0x2443d5);return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0x19c'));};AGIVertices[_0xeeeb('0x12')]['set']=function(_0x5891a1){logger[_0xeeeb('0x30')](util['format'](_0xeeeb('0x19d'),_0x5891a1[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x5891a1[_0xeeeb('0xd8')])){return this['channel'][_0xeeeb('0x2f')](_0x5891a1,_0xeeeb('0x19e'));}var _0x131fef=this[_0xeeeb('0x13')][_0xeeeb('0xa7')](this,_0x5891a1[_0xeeeb('0xd8')]);if(!_0x131fef){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x5891a1,_0xeeeb('0xda'));}return this[_0xeeeb('0x38')]['setVariable'](_0x131fef,_0x5891a1[_0xeeeb('0x19f')]);};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1a0')]=function(_0x5b5eb9){logger['info'](util[_0xeeeb('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5b5eb9[_0xeeeb('0x3a')]));this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x1a1'));if(_0x5b5eb9['answer']==='yes'){this[_0xeeeb('0x38')]['noop']('Answer');return this[_0xeeeb('0x38')][_0xeeeb('0x1a2')]();}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x1a3'));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1a4')]=function(_0x4102cb){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x1a5'),_0x4102cb[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x4102cb[_0xeeeb('0x1a6')])){return this[_0xeeeb('0x38')]['error'](_0x4102cb,_0xeeeb('0x1a7'));}var _0x3c632f=this[_0xeeeb('0x1b')][_0xeeeb('0xa7')](this,_0x4102cb[_0xeeeb('0x1a6')]);if(!this[_0xeeeb('0x83')](_0x3c632f)){return this[_0xeeeb('0x38')]['error'](_0x4102cb,util[_0xeeeb('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4102cb[_0xeeeb('0x1a6')]));}if(_0x3c632f===this[_0xeeeb('0x38')][_0xeeeb('0x3c')]){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x4102cb,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xeeeb('0x37')][_0xeeeb('0xa7')](this,_0x4102cb,_0x3c632f);var _0xb2650e=this[_0xeeeb('0x38')][_0xeeeb('0xaa')](_0xeeeb('0x1a8'),util[_0xeeeb('0x2c')](_0xeeeb('0x1a9'),config['agi'][_0xeeeb('0x1aa')]||'127.0.0.1',_0x3c632f,this[_0xeeeb('0x38')][_0xeeeb('0x3c')]));if(_0xb2650e[_0xeeeb('0xa2')]===-0x1){return _0xb2650e;}return this['channel']['noop'](util[_0xeeeb('0x2c')](_0xeeeb('0xc4'),_0xeeeb('0x1a8'),_0x3c632f));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1ab')]=function(_0xebaf01){logger[_0xeeeb('0x30')](util['format'](_0xeeeb('0x1ac'),_0xebaf01[_0xeeeb('0x3a')]));var _0x3ec6b3=this[_0xeeeb('0x5a')]['sync'](this,_0xebaf01[_0xeeeb('0xb7')]);this[_0xeeeb('0x37')]['sync'](this,_0xebaf01,_0xebaf01[_0xeeeb('0xb7')]);if(this[_0xeeeb('0x83')](_0xebaf01[_0xeeeb('0xd8')])){var _0x14bb26=this[_0xeeeb('0x13')][_0xeeeb('0xa7')](this,_0xebaf01[_0xeeeb('0xd8')]);if(_0x14bb26){this[_0xeeeb('0x38')][_0xeeeb('0xa5')](_0x14bb26,_0x3ec6b3);return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xebaf01[_0xeeeb('0xb7')],_0x14bb26));}}return this[_0xeeeb('0x38')]['noop'](util['format'](_0xeeeb('0x1ad'),_0xebaf01[_0xeeeb('0xb7')]));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1ae')]=function(_0x55afbc){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x1af'),_0x55afbc[_0xeeeb('0x3a')]));_0x55afbc[_0xeeeb('0x5d')]=_0x55afbc[_0xeeeb('0x5d')][_0xeeeb('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x55afbc[_0xeeeb('0x5c')])){return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](_0xeeeb('0x1b0'));}if(!this[_0xeeeb('0x83')](_0x55afbc['text'])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0x1b1'),_0x55afbc[_0xeeeb('0x5d')]));var _0x49299d=this[_0xeeeb('0x1b2')][_0xeeeb('0xa7')](this,_0x55afbc);if(_0x49299d){this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x49299d));var _0x3d90cd=this[_0xeeeb('0x38')][_0xeeeb('0x103')](_0x49299d);try{fs[_0xeeeb('0x104')](_0x49299d+_0xeeeb('0x105'));}catch(_0x59a1f5){logger['error'](_0x59a1f5);}return _0x3d90cd;}return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x55afbc,_0xeeeb('0x1b3'));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1b4')]=function(_0x133b68){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x1b5'),_0x133b68[_0xeeeb('0x3a')]));_0x133b68[_0xeeeb('0x5d')]=_0x133b68[_0xeeeb('0x5d')][_0xeeeb('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xeeeb('0x83')](_0x133b68[_0xeeeb('0x5d')])){return this['channel'][_0xeeeb('0xa9')](_0xeeeb('0xc7'));}this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x133b68['text']));var _0x240a1a=this[_0xeeeb('0x62')][_0xeeeb('0xa7')](this,_0x133b68);if(_0x240a1a){this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x240a1a));var _0x553311=this[_0xeeeb('0x38')][_0xeeeb('0x103')](_0x240a1a);try{fs['unlink'](_0x240a1a+_0xeeeb('0x105'));}catch(_0x1e60ef){logger[_0xeeeb('0x2f')](_0x1e60ef);}return _0x553311;}return this[_0xeeeb('0x38')]['error'](_0x133b68,_0xeeeb('0x1b6'));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1b7')]=function(_0x41b885){logger['info'](util['format'](_0xeeeb('0x1b8'),_0x41b885[_0xeeeb('0x3a')]));if(!this[_0xeeeb('0x83')](_0x41b885[_0xeeeb('0x151')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0x41b885,_0xeeeb('0x150'));}logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x158'),this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x41b885['findBy']));var _0x3ff12f=this[_0xeeeb('0x55')][_0xeeeb('0xa7')](this,_0x41b885[_0xeeeb('0x151')]);if(_0x3ff12f){logger[_0xeeeb('0x30')](util['format'](_0xeeeb('0x152'),this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x41b885[_0xeeeb('0x151')]));this[_0xeeeb('0x38')]['noop'](util[_0xeeeb('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xeeeb('0x38')]['callerid'],_0x41b885['findBy']));return{'code':0xc8,'result':_0xeeeb('0x153')};}else{logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x154'),this['channel'][_0xeeeb('0x3d')],_0x41b885['findBy']));this[_0xeeeb('0x38')]['noop'](util[_0xeeeb('0x2c')](_0xeeeb('0x154'),this[_0xeeeb('0x38')][_0xeeeb('0x3d')],_0x41b885[_0xeeeb('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1b9')]=function(_0x10d7ad){logger[_0xeeeb('0x30')](util[_0xeeeb('0x2c')](_0xeeeb('0x1ba'),_0x10d7ad[_0xeeeb('0x3a')]));var _0x42b404=this[_0xeeeb('0x38')][_0xeeeb('0xaa')]('VOICEMAIL',[_0x10d7ad[_0xeeeb('0x1bb')],_0x10d7ad[_0xeeeb('0x77')]]);if(_0x42b404[_0xeeeb('0xa2')]===-0x1){return _0x42b404;}return this[_0xeeeb('0x38')][_0xeeeb('0xa9')](util[_0xeeeb('0x2c')](_0xeeeb('0xc4'),_0xeeeb('0x1bc'),_0x10d7ad['mailbox']));};AGIVertices[_0xeeeb('0x12')][_0xeeeb('0x1bd')]=function(_0xedde78){logger['info'](util[_0xeeeb('0x2c')](_0xeeeb('0x1be'),_0xedde78[_0xeeeb('0x3a')]));if(!this['isConfigured'](_0xedde78[_0xeeeb('0xd8')])){return this[_0xeeeb('0x38')][_0xeeeb('0x2f')](_0xedde78,'no\x20variable\x20selected');}var _0x372d16=this[_0xeeeb('0x13')]['sync'](this,_0xedde78[_0xeeeb('0xd8')]);if(!_0x372d16){return this['channel']['error'](_0xedde78,_0xeeeb('0xda'));}var _0x26a2e0=this[_0xeeeb('0x38')][_0xeeeb('0x13')](_0x372d16);return{'code':0xc8,'result':_0x26a2e0['extra']?_0x26a2e0[_0xeeeb('0xa4')]:'-'};};String[_0xeeeb('0x12')][_0xeeeb('0xa0')]=function(_0xb0e930,_0x646b09){return this['split'](_0xb0e930)[_0xeeeb('0x1bf')](_0x646b09);};module[_0xeeeb('0x1c0')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 7dab107..6d10321 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 _0xf5d4=['transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','prototype','syncAgentConnect','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5d4,0xab));var _0x4f5d=function(_0xb40bf3,_0x2ec29f){_0xb40bf3=_0xb40bf3-0x0;var _0x1b72b6=_0xf5d4[_0xb40bf3];return _0x1b72b6;};'use strict';var _=require(_0x4f5d('0x0'));var moment=require(_0x4f5d('0x1'));var ami=require(_0x4f5d('0x2'));var logger=require('../../../config/logger')(_0x4f5d('0x3'));var RpcUser=require(_0x4f5d('0x4'));var RpcVoiceAgentReport=require(_0x4f5d('0x5'));function Acw(_0x230dd6){this['voiceQueues']=_0x230dd6[_0x4f5d('0x6')];this['agents']=_0x230dd6[_0x4f5d('0x7')];this[_0x4f5d('0x8')]=_0x230dd6[_0x4f5d('0x8')];this[_0x4f5d('0x9')]={};ami['on'](_0x4f5d('0xa'),this['syncAgentConnect'][_0x4f5d('0xb')](this));ami['on'](_0x4f5d('0xc'),this[_0x4f5d('0xd')][_0x4f5d('0xb')](this));ami['on'](_0x4f5d('0xe'),this[_0x4f5d('0xf')][_0x4f5d('0xb')](this));ami['on'](_0x4f5d('0x10'),this[_0x4f5d('0x11')]['bind'](this));ami['on']('attendedtransfer',this[_0x4f5d('0x12')][_0x4f5d('0xb')](this));ami['on'](_0x4f5d('0x13'),this[_0x4f5d('0x14')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0x4f5d('0x15')]['bind'](this));}function getDiff(_0xafa988){var _0x45e0bc=moment()[_0x4f5d('0x16')](0x0);var _0x219a26=moment(_0xafa988)[_0x4f5d('0x16')](0x0);return _0x45e0bc['diff'](_0x219a26,'seconds');}Acw['prototype'][_0x4f5d('0x17')]=function(_0x2a5924){try{var _0x140cce=this;var _0x2c61f4=this[_0x4f5d('0x9')][_0x2a5924][_0x4f5d('0x18')];var _0x13247b=this[_0x4f5d('0x9')][_0x2a5924][_0x4f5d('0x19')];var _0x16bd2f=this[_0x4f5d('0x6')][_0x13247b];var _0x318d91=![];var _0x3cabee=_0x4f5d('0x1a');if(_0x16bd2f[_0x4f5d('0x1b')]){if(_0x16bd2f[_0x4f5d('0x1c')][_0x4f5d('0x1d')]){_0x318d91=!![];_0x3cabee=_0x16bd2f[_0x4f5d('0x1c')]['name'];}}return ami[_0x4f5d('0x1e')]({'action':_0x4f5d('0x1f'),'interface':_0x2c61f4,'paused':!![],'reason':_0x3cabee})[_0x4f5d('0x20')](function(){if(_0x140cce['agents'][_0x2c61f4]){return RpcUser[_0x4f5d('0x21')](_0x140cce[_0x4f5d('0x7')][_0x2c61f4]['id'])[_0x4f5d('0x20')](function(_0x4809b0){if(_0x4809b0&&!_0x4809b0[_0x4f5d('0x22')]){logger['info'](_0x4f5d('0x23'),_0x2a5924,_0x2c61f4,_0x13247b);var _0x52e543=_0x140cce[_0x4f5d('0x9')][_0x2a5924][_0x4f5d('0x24')]&&_0x140cce[_0x4f5d('0x9')][_0x2a5924][_0x4f5d('0x25')]?_0x140cce['channels'][_0x2a5924][_0x4f5d('0x25')]:_0x2a5924;return RpcUser[_0x4f5d('0x26')](_0x140cce['agents'][_0x2c61f4],_0x3cabee,_0x52e543)['then'](function(){if(!_0x318d91){_0x140cce[_0x4f5d('0x8')][_0x2c61f4]={};logger[_0x4f5d('0x27')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2a5924,_0x140cce[_0x4f5d('0x6')][_0x13247b][_0x4f5d('0x28')],_0x2c61f4,_0x13247b);_0x140cce[_0x4f5d('0x8')][_0x2c61f4][_0x4f5d('0x29')]=setTimeout(_0x140cce[_0x4f5d('0x2a')][_0x4f5d('0xb')](_0x140cce,_0x2c61f4),_0x140cce[_0x4f5d('0x6')][_0x13247b][_0x4f5d('0x28')]*0x3e8);_0x140cce[_0x4f5d('0x8')][_0x2c61f4][_0x4f5d('0x2b')]=moment()[_0x4f5d('0x2c')](_0x4f5d('0x2d'));_0x140cce['timers'][_0x2c61f4][_0x4f5d('0x2e')]=_0x2a5924;_0x140cce['timers'][_0x2c61f4][_0x4f5d('0x19')]=_0x13247b;_0x140cce[_0x4f5d('0x8')][_0x2c61f4]['updateAcw']=function(){var _0x4a9507=getDiff(_0x140cce[_0x4f5d('0x8')][_0x2c61f4][_0x4f5d('0x2b')]);clearTimeout(_0x140cce[_0x4f5d('0x8')][_0x2c61f4][_0x4f5d('0x29')]);_0x140cce[_0x4f5d('0x8')][_0x2c61f4]['timer']=![];RpcVoiceAgentReport[_0x4f5d('0x2f')]({'acwtime':_0x4a9507},_0x140cce[_0x4f5d('0x8')][_0x2c61f4][_0x4f5d('0x2e')],_0x2c61f4)[_0x4f5d('0x20')](function(_0x53f7a1){logger[_0x4f5d('0x27')](_0x4f5d('0x30'),_0x2a5924,_0x4a9507,_0x53f7a1);})[_0x4f5d('0x31')](function(_0x316ed2){logger[_0x4f5d('0x32')](_0x4f5d('0x33'),_0x2a5924,_0x316ed2);});delete _0x140cce[_0x4f5d('0x8')][_0x2c61f4];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2a5924,_0x2c61f4,_0x13247b);}});}})[_0x4f5d('0x31')](function(){logger[_0x4f5d('0x32')](_0x4f5d('0x34'),_0x2a5924,_0x140cce['voiceQueues'][_0x13247b][_0x4f5d('0x28')],_0x2c61f4,_0x13247b);})[_0x4f5d('0x35')](function(){delete _0x140cce[_0x4f5d('0x9')][_0x2a5924];});}catch(_0x3745e9){logger[_0x4f5d('0x32')](_0x4f5d('0x36'),_0x3745e9[_0x4f5d('0x37')]);}};Acw['prototype'][_0x4f5d('0x2a')]=function(_0x50a221){try{var _0x3b8120=this;if(_0x3b8120[_0x4f5d('0x8')][_0x50a221]){_0x3b8120[_0x4f5d('0x8')][_0x50a221]['timer']=![];var _0x496f5f=_0x3b8120[_0x4f5d('0x8')][_0x50a221]['uniqueid'];var _0x53c3b4=_0x3b8120['timers'][_0x50a221][_0x4f5d('0x19')];var _0x155883=_0x3b8120[_0x4f5d('0x6')][_0x53c3b4][_0x4f5d('0x28')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x496f5f,_0x50a221);RpcUser[_0x4f5d('0x38')](this[_0x4f5d('0x7')][_0x50a221]);RpcVoiceAgentReport[_0x4f5d('0x2f')]({'acwtime':_0x155883,'agentacw':!![]},_0x496f5f,_0x50a221)[_0x4f5d('0x20')](function(_0x24fd52){logger[_0x4f5d('0x27')](_0x4f5d('0x30'),_0x496f5f,_0x155883,_0x24fd52);})[_0x4f5d('0x31')](function(_0x10cdf0){logger[_0x4f5d('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x496f5f,_0x10cdf0);});}else{logger['error'](_0x4f5d('0x39'),_0x50a221);if(_0x3b8120[_0x4f5d('0x8')]){logger[_0x4f5d('0x27')](_0x4f5d('0x3a'),JSON[_0x4f5d('0x3b')](_0x3b8120['timers']));}}}catch(_0x4352a8){logger['error'](_0x4f5d('0x3c'),_0x4352a8['message']);}};Acw[_0x4f5d('0x3d')][_0x4f5d('0x3e')]=function(_0x57db66){try{if(this['voiceQueues'][_0x57db66[_0x4f5d('0x19')]]&&(this[_0x4f5d('0x6')][_0x57db66[_0x4f5d('0x19')]][_0x4f5d('0x3')]||this[_0x4f5d('0x6')][_0x57db66['queue']][_0x4f5d('0x1b')])){if(this[_0x4f5d('0x7')][_0x57db66[_0x4f5d('0x18')]]){this[_0x4f5d('0x9')][_0x57db66['uniqueid']]={'queue':_0x57db66[_0x4f5d('0x19')],'interface':_0x57db66[_0x4f5d('0x18')],'destlinkedid':_0x57db66[_0x4f5d('0x25')]};}}}catch(_0x47223d){logger[_0x4f5d('0x32')]('[ACW][syncAgentConnect]\x20%s',_0x47223d[_0x4f5d('0x37')]);}};Acw[_0x4f5d('0x3d')]['syncAgentConnectPreview']=function(_0x192eb7){try{if(this['voiceQueues'][_0x192eb7[_0x4f5d('0x19')]]&&(this[_0x4f5d('0x6')][_0x192eb7[_0x4f5d('0x19')]][_0x4f5d('0x3')]||this['voiceQueues'][_0x192eb7[_0x4f5d('0x19')]][_0x4f5d('0x1b')])){if(this[_0x4f5d('0x7')][_0x192eb7[_0x4f5d('0x18')]]){this[_0x4f5d('0x9')][_0x192eb7[_0x4f5d('0x2e')]]={'queue':_0x192eb7['queue'],'interface':_0x192eb7['interface']};}}}catch(_0x12bddd){logger[_0x4f5d('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x12bddd[_0x4f5d('0x37')]);}};Acw[_0x4f5d('0x3d')][_0x4f5d('0xd')]=function(_0x47d2a6){try{if(this[_0x4f5d('0x9')][_0x47d2a6[_0x4f5d('0x2e')]]&&_[_0x4f5d('0x3f')](this[_0x4f5d('0x9')][_0x47d2a6[_0x4f5d('0x2e')]][_0x4f5d('0x24')])){logger[_0x4f5d('0x27')](_0x4f5d('0x40'),_0x47d2a6[_0x4f5d('0x2e')]);this[_0x4f5d('0x17')](_0x47d2a6['uniqueid']);}else if(this[_0x4f5d('0x9')][_0x47d2a6['linkedid']]&&_[_0x4f5d('0x3f')](this[_0x4f5d('0x9')][_0x47d2a6[_0x4f5d('0x41')]]['attended'])){logger[_0x4f5d('0x27')](_0x4f5d('0x42'),_0x47d2a6[_0x4f5d('0x41')]);this[_0x4f5d('0x17')](_0x47d2a6['linkedid']);}}catch(_0x3375d1){logger[_0x4f5d('0x32')](_0x4f5d('0x43'),_0x3375d1['message']);}};Acw[_0x4f5d('0x3d')][_0x4f5d('0xf')]=function(_0x84b0d4){try{if(this[_0x4f5d('0x9')][_0x84b0d4[_0x4f5d('0x2e')]]&&this[_0x4f5d('0x9')][_0x84b0d4[_0x4f5d('0x2e')]]['attended']){logger[_0x4f5d('0x27')](_0x4f5d('0x44'),_0x84b0d4[_0x4f5d('0x2e')]);this['startAcw'](_0x84b0d4[_0x4f5d('0x2e')]);}else if(this['channels'][_0x84b0d4[_0x4f5d('0x41')]]&&this[_0x4f5d('0x9')][_0x84b0d4[_0x4f5d('0x41')]][_0x4f5d('0x24')]){logger[_0x4f5d('0x27')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x84b0d4['linkedid']);this[_0x4f5d('0x17')](_0x84b0d4[_0x4f5d('0x41')]);}}catch(_0x34163c){logger[_0x4f5d('0x32')]('[ACW][syncHangup]\x20%s',_0x34163c['message']);}};Acw[_0x4f5d('0x3d')][_0x4f5d('0x12')]=function(_0x52823f){try{if(!_['isNil'](this[_0x4f5d('0x9')][_0x52823f[_0x4f5d('0x45')]])){this[_0x4f5d('0x17')](_0x52823f[_0x4f5d('0x45')]);if(this[_0x4f5d('0x9')][_0x52823f[_0x4f5d('0x46')]]){this['channels'][_0x52823f[_0x4f5d('0x46')]][_0x4f5d('0x24')]=!![];this[_0x4f5d('0x9')][_0x52823f['transfertargetuniqueid']]=this[_0x4f5d('0x9')][_0x52823f[_0x4f5d('0x46')]];delete this[_0x4f5d('0x9')][_0x52823f[_0x4f5d('0x46')]];}}else if(!_['isNil'](this[_0x4f5d('0x9')][_0x52823f['transfertargetuniqueid']])){this['startAcw'](_0x52823f[_0x4f5d('0x47')]);if(this[_0x4f5d('0x9')][_0x52823f[_0x4f5d('0x48')]]){this[_0x4f5d('0x9')][_0x52823f['origtransfereruniqueid']][_0x4f5d('0x24')]=!![];this[_0x4f5d('0x9')][_0x52823f[_0x4f5d('0x45')]]=this[_0x4f5d('0x9')][_0x52823f[_0x4f5d('0x48')]];delete this[_0x4f5d('0x9')][_0x52823f[_0x4f5d('0x48')]];}}}catch(_0x27039b){logger[_0x4f5d('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0x27039b[_0x4f5d('0x37')]);}};Acw[_0x4f5d('0x3d')][_0x4f5d('0x14')]=function(_0x32942b){try{if(this[_0x4f5d('0x9')][_0x32942b[_0x4f5d('0x49')]]){logger[_0x4f5d('0x27')](_0x4f5d('0x4a'),JSON['stringify'](_0x32942b[_0x4f5d('0x49')]));this[_0x4f5d('0x17')](_0x32942b['transfereruniqueid']);}else if(this[_0x4f5d('0x9')][_0x32942b['transfererlinkedid']]){logger[_0x4f5d('0x27')](_0x4f5d('0x4b'),JSON[_0x4f5d('0x3b')](_0x32942b['transfererlinkedid']));this[_0x4f5d('0x17')](_0x32942b['transfererlinkedid']);}}catch(_0x3a2367){logger[_0x4f5d('0x32')](_0x4f5d('0x4c'),_0x3a2367[_0x4f5d('0x37')]);}};Acw[_0x4f5d('0x3d')][_0x4f5d('0x11')]=function(_0x79acd5){try{if(this[_0x4f5d('0x6')][_0x79acd5[_0x4f5d('0x19')]]&&this[_0x4f5d('0x6')][_0x79acd5[_0x4f5d('0x19')]][_0x4f5d('0x4d')]==='all'){if(this['agents'][_0x79acd5[_0x4f5d('0x18')]]){logger[_0x4f5d('0x27')](_0x4f5d('0x4e'),_0x79acd5[_0x4f5d('0x2e')],_0x79acd5[_0x4f5d('0x18')],_0x79acd5['queue']);return RpcUser[_0x4f5d('0x26')](this[_0x4f5d('0x7')][_0x79acd5[_0x4f5d('0x18')]],_0x4f5d('0x4f'),_0x79acd5[_0x4f5d('0x2e')]);}}}catch(_0x4a34aa){logger[_0x4f5d('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4a34aa['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x69cf=['[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','syncAgentConnect','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','lodash','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','bind','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','uniqueid','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update'];(function(_0x13f2be,_0x34ded7){var _0x341e89=function(_0x3e2848){while(--_0x3e2848){_0x13f2be['push'](_0x13f2be['shift']());}};_0x341e89(++_0x34ded7);}(_0x69cf,0x6d));var _0xf69c=function(_0x263fe3,_0x216b34){_0x263fe3=_0x263fe3-0x0;var _0x578222=_0x69cf[_0x263fe3];return _0x578222;};'use strict';var _=require(_0xf69c('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0xf69c('0x1'))('acw');var RpcUser=require(_0xf69c('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5317a6){this[_0xf69c('0x3')]=_0x5317a6[_0xf69c('0x3')];this['agents']=_0x5317a6[_0xf69c('0x4')];this[_0xf69c('0x5')]=_0x5317a6[_0xf69c('0x5')];this[_0xf69c('0x6')]={};ami['on'](_0xf69c('0x7'),this['syncAgentConnect']['bind'](this));ami['on']('hanguprequest',this[_0xf69c('0x8')]['bind'](this));ami['on'](_0xf69c('0x9'),this['syncHangup']['bind'](this));ami['on'](_0xf69c('0xa'),this[_0xf69c('0xb')][_0xf69c('0xc')](this));ami['on'](_0xf69c('0xd'),this['syncAttendedTransfer'][_0xf69c('0xc')](this));ami['on'](_0xf69c('0xe'),this[_0xf69c('0xf')][_0xf69c('0xc')](this));ami['on']('custom:agentConnectPreview',this[_0xf69c('0x10')]['bind'](this));}function getDiff(_0x19b799){var _0x3338ed=moment()[_0xf69c('0x11')](0x0);var _0x4d0afa=moment(_0x19b799)['milliseconds'](0x0);return _0x3338ed['diff'](_0x4d0afa,_0xf69c('0x12'));}Acw[_0xf69c('0x13')][_0xf69c('0x14')]=function(_0x238c26){try{var _0x1e05fe=this;var _0x5e4f66=this['channels'][_0x238c26][_0xf69c('0x15')];var _0x1f0966=this[_0xf69c('0x6')][_0x238c26][_0xf69c('0x16')];var _0x1c767d=this[_0xf69c('0x3')][_0x1f0966];var _0xe5d7e=![];var _0x46f5d8='ACW';if(_0x1c767d[_0xf69c('0x17')]){if(_0x1c767d['mandatoryDispositionPause'][_0xf69c('0x18')]){_0xe5d7e=!![];_0x46f5d8=_0x1c767d[_0xf69c('0x19')][_0xf69c('0x18')];}}return ami['Action']({'action':_0xf69c('0x1a'),'interface':_0x5e4f66,'paused':!![],'reason':_0x46f5d8})[_0xf69c('0x1b')](function(){if(_0x1e05fe[_0xf69c('0x4')][_0x5e4f66]){return RpcUser[_0xf69c('0x1c')](_0x1e05fe[_0xf69c('0x4')][_0x5e4f66]['id'])[_0xf69c('0x1b')](function(_0x5c2b00){if(_0x5c2b00&&!_0x5c2b00[_0xf69c('0x1d')]){logger[_0xf69c('0x1e')](_0xf69c('0x1f'),_0x238c26,_0x5e4f66,_0x1f0966);var _0x10998a=_0x1e05fe['channels'][_0x238c26][_0xf69c('0x20')]&&_0x1e05fe[_0xf69c('0x6')][_0x238c26]['destlinkedid']?_0x1e05fe[_0xf69c('0x6')][_0x238c26][_0xf69c('0x21')]:_0x238c26;return RpcUser['savePause'](_0x1e05fe['agents'][_0x5e4f66],_0x46f5d8,_0x10998a)[_0xf69c('0x1b')](function(){if(!_0xe5d7e){_0x1e05fe[_0xf69c('0x5')][_0x5e4f66]={};logger[_0xf69c('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x238c26,_0x1e05fe[_0xf69c('0x3')][_0x1f0966][_0xf69c('0x22')],_0x5e4f66,_0x1f0966);_0x1e05fe[_0xf69c('0x5')][_0x5e4f66][_0xf69c('0x23')]=setTimeout(_0x1e05fe[_0xf69c('0x24')][_0xf69c('0xc')](_0x1e05fe,_0x5e4f66),_0x1e05fe[_0xf69c('0x3')][_0x1f0966]['acwTimeout']*0x3e8);_0x1e05fe[_0xf69c('0x5')][_0x5e4f66][_0xf69c('0x25')]=moment()['format'](_0xf69c('0x26'));_0x1e05fe[_0xf69c('0x5')][_0x5e4f66]['uniqueid']=_0x238c26;_0x1e05fe[_0xf69c('0x5')][_0x5e4f66][_0xf69c('0x16')]=_0x1f0966;_0x1e05fe[_0xf69c('0x5')][_0x5e4f66][_0xf69c('0x27')]=function(){var _0x43f767=getDiff(_0x1e05fe[_0xf69c('0x5')][_0x5e4f66][_0xf69c('0x25')]);clearTimeout(_0x1e05fe[_0xf69c('0x5')][_0x5e4f66][_0xf69c('0x23')]);_0x1e05fe[_0xf69c('0x5')][_0x5e4f66][_0xf69c('0x23')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x43f767},_0x1e05fe[_0xf69c('0x5')][_0x5e4f66]['uniqueid'],_0x5e4f66)[_0xf69c('0x1b')](function(_0x4c523e){logger[_0xf69c('0x1e')](_0xf69c('0x28'),_0x238c26,_0x43f767,_0x4c523e);})[_0xf69c('0x29')](function(_0x477432){logger[_0xf69c('0x2a')](_0xf69c('0x2b'),_0x238c26,_0x477432);});delete _0x1e05fe[_0xf69c('0x5')][_0x5e4f66];};}});}else{logger['info'](_0xf69c('0x2c'),_0x238c26,_0x5e4f66,_0x1f0966);}});}})['catch'](function(){logger[_0xf69c('0x2a')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x238c26,_0x1e05fe[_0xf69c('0x3')][_0x1f0966][_0xf69c('0x22')],_0x5e4f66,_0x1f0966);})[_0xf69c('0x2d')](function(){delete _0x1e05fe['channels'][_0x238c26];});}catch(_0x45ed52){logger['error']('[ACW][START]\x20%s',_0x45ed52[_0xf69c('0x2e')]);}};Acw[_0xf69c('0x13')][_0xf69c('0x24')]=function(_0x588188){try{var _0x56d7ea=this;if(_0x56d7ea[_0xf69c('0x5')][_0x588188]){_0x56d7ea[_0xf69c('0x5')][_0x588188]['timer']=![];var _0x562ea9=_0x56d7ea[_0xf69c('0x5')][_0x588188][_0xf69c('0x2f')];var _0x7a868f=_0x56d7ea[_0xf69c('0x5')][_0x588188]['queue'];var _0x339994=_0x56d7ea['voiceQueues'][_0x7a868f][_0xf69c('0x22')];logger['info'](_0xf69c('0x30'),_0x562ea9,_0x588188);RpcUser[_0xf69c('0x31')](this[_0xf69c('0x4')][_0x588188]);RpcVoiceAgentReport[_0xf69c('0x32')]({'acwtime':_0x339994,'agentacw':!![]},_0x562ea9,_0x588188)[_0xf69c('0x1b')](function(_0x4644f6){logger[_0xf69c('0x1e')](_0xf69c('0x28'),_0x562ea9,_0x339994,_0x4644f6);})[_0xf69c('0x29')](function(_0x36704a){logger[_0xf69c('0x2a')](_0xf69c('0x2b'),_0x562ea9,_0x36704a);});}else{logger['error'](_0xf69c('0x33'),_0x588188);if(_0x56d7ea['timers']){logger['info'](_0xf69c('0x34'),JSON['stringify'](_0x56d7ea['timers']));}}}catch(_0x7f689c){logger[_0xf69c('0x2a')]('[ACW][STOP]\x20%s',_0x7f689c[_0xf69c('0x2e')]);}};Acw['prototype'][_0xf69c('0x35')]=function(_0x499930){try{if(this[_0xf69c('0x3')][_0x499930[_0xf69c('0x16')]]&&(this[_0xf69c('0x3')][_0x499930[_0xf69c('0x16')]][_0xf69c('0x36')]||this[_0xf69c('0x3')][_0x499930[_0xf69c('0x16')]]['mandatoryDisposition'])){if(this[_0xf69c('0x4')][_0x499930[_0xf69c('0x15')]]){this[_0xf69c('0x6')][_0x499930[_0xf69c('0x2f')]]={'queue':_0x499930[_0xf69c('0x16')],'interface':_0x499930[_0xf69c('0x15')],'destlinkedid':_0x499930[_0xf69c('0x21')]};}}}catch(_0x3307a8){logger['error'](_0xf69c('0x37'),_0x3307a8['message']);}};Acw[_0xf69c('0x13')][_0xf69c('0x10')]=function(_0x1dc694){try{if(this['voiceQueues'][_0x1dc694[_0xf69c('0x16')]]&&(this[_0xf69c('0x3')][_0x1dc694[_0xf69c('0x16')]]['acw']||this[_0xf69c('0x3')][_0x1dc694[_0xf69c('0x16')]]['mandatoryDisposition'])){if(this[_0xf69c('0x4')][_0x1dc694[_0xf69c('0x15')]]){this[_0xf69c('0x6')][_0x1dc694[_0xf69c('0x2f')]]={'queue':_0x1dc694[_0xf69c('0x16')],'interface':_0x1dc694[_0xf69c('0x15')]};}}}catch(_0x1be62d){logger[_0xf69c('0x2a')](_0xf69c('0x38'),_0x1be62d[_0xf69c('0x2e')]);}};Acw['prototype']['syncHangupRequest']=function(_0x51bc6d){try{if(this['channels'][_0x51bc6d[_0xf69c('0x2f')]]&&_[_0xf69c('0x39')](this['channels'][_0x51bc6d[_0xf69c('0x2f')]][_0xf69c('0x20')])){logger['info'](_0xf69c('0x3a'),_0x51bc6d[_0xf69c('0x2f')]);this[_0xf69c('0x14')](_0x51bc6d[_0xf69c('0x2f')]);}else if(this['channels'][_0x51bc6d[_0xf69c('0x3b')]]&&_[_0xf69c('0x39')](this['channels'][_0x51bc6d['linkedid']][_0xf69c('0x20')])){logger[_0xf69c('0x1e')]('[%s][HANGUP:LINKEDID]',_0x51bc6d[_0xf69c('0x3b')]);this[_0xf69c('0x14')](_0x51bc6d[_0xf69c('0x3b')]);}}catch(_0x379fb9){logger[_0xf69c('0x2a')](_0xf69c('0x3c'),_0x379fb9[_0xf69c('0x2e')]);}};Acw['prototype'][_0xf69c('0x3d')]=function(_0x13ff51){try{if(this[_0xf69c('0x6')][_0x13ff51[_0xf69c('0x2f')]]&&this[_0xf69c('0x6')][_0x13ff51[_0xf69c('0x2f')]][_0xf69c('0x20')]){logger[_0xf69c('0x1e')](_0xf69c('0x3e'),_0x13ff51[_0xf69c('0x2f')]);this[_0xf69c('0x14')](_0x13ff51[_0xf69c('0x2f')]);}else if(this[_0xf69c('0x6')][_0x13ff51[_0xf69c('0x3b')]]&&this[_0xf69c('0x6')][_0x13ff51[_0xf69c('0x3b')]]['attended']){logger[_0xf69c('0x1e')](_0xf69c('0x3f'),_0x13ff51[_0xf69c('0x3b')]);this['startAcw'](_0x13ff51[_0xf69c('0x3b')]);}}catch(_0xc83914){logger[_0xf69c('0x2a')](_0xf69c('0x40'),_0xc83914[_0xf69c('0x2e')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x3da07e){try{if(!_[_0xf69c('0x41')](this[_0xf69c('0x6')][_0x3da07e[_0xf69c('0x42')]])){this[_0xf69c('0x14')](_0x3da07e[_0xf69c('0x42')]);if(this[_0xf69c('0x6')][_0x3da07e[_0xf69c('0x43')]]){this[_0xf69c('0x6')][_0x3da07e[_0xf69c('0x43')]][_0xf69c('0x20')]=!![];this[_0xf69c('0x6')][_0x3da07e['transfertargetuniqueid']]=this['channels'][_0x3da07e[_0xf69c('0x43')]];delete this['channels'][_0x3da07e[_0xf69c('0x43')]];}}else if(!_[_0xf69c('0x41')](this['channels'][_0x3da07e['transfertargetuniqueid']])){this[_0xf69c('0x14')](_0x3da07e['transfertargetuniqueid']);if(this[_0xf69c('0x6')][_0x3da07e[_0xf69c('0x44')]]){this[_0xf69c('0x6')][_0x3da07e[_0xf69c('0x44')]][_0xf69c('0x20')]=!![];this[_0xf69c('0x6')][_0x3da07e[_0xf69c('0x42')]]=this['channels'][_0x3da07e[_0xf69c('0x44')]];delete this[_0xf69c('0x6')][_0x3da07e['origtransfereruniqueid']];}}}catch(_0xa9ca4d){logger[_0xf69c('0x2a')](_0xf69c('0x45'),_0xa9ca4d[_0xf69c('0x2e')]);}};Acw[_0xf69c('0x13')][_0xf69c('0xf')]=function(_0x3b94ee){try{if(this[_0xf69c('0x6')][_0x3b94ee[_0xf69c('0x46')]]){logger[_0xf69c('0x1e')](_0xf69c('0x47'),JSON['stringify'](_0x3b94ee['transfereruniqueid']));this[_0xf69c('0x14')](_0x3b94ee['transfereruniqueid']);}else if(this[_0xf69c('0x6')][_0x3b94ee['transfererlinkedid']]){logger[_0xf69c('0x1e')](_0xf69c('0x48'),JSON['stringify'](_0x3b94ee[_0xf69c('0x49')]));this[_0xf69c('0x14')](_0x3b94ee['transfererlinkedid']);}}catch(_0x4dbc5d){logger[_0xf69c('0x2a')](_0xf69c('0x4a'),_0x4dbc5d[_0xf69c('0x2e')]);}};Acw[_0xf69c('0x13')][_0xf69c('0xb')]=function(_0x5cf65c){try{if(this['voiceQueues'][_0x5cf65c['queue']]&&this['voiceQueues'][_0x5cf65c[_0xf69c('0x16')]][_0xf69c('0x4b')]===_0xf69c('0x4c')){if(this['agents'][_0x5cf65c[_0xf69c('0x15')]]){logger['info'](_0xf69c('0x4d'),_0x5cf65c[_0xf69c('0x2f')],_0x5cf65c[_0xf69c('0x15')],_0x5cf65c[_0xf69c('0x16')]);return RpcUser[_0xf69c('0x4e')](this[_0xf69c('0x4')][_0x5cf65c[_0xf69c('0x15')]],_0xf69c('0x4f'),_0x5cf65c['uniqueid']);}}}catch(_0x4ef335){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4ef335[_0xf69c('0x2e')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cf62e12..2e0c86f 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 _0x78e0=['format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','close','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','username','password','keepConnected','action','error'];(function(_0x25dbbc,_0x396b3f){var _0x407db2=function(_0x1ee68b){while(--_0x1ee68b){_0x25dbbc['push'](_0x25dbbc['shift']());}};_0x407db2(++_0x396b3f);}(_0x78e0,0x1f3));var _0x078e=function(_0x544ded,_0x2cd874){_0x544ded=_0x544ded-0x0;var _0x598372=_0x78e0[_0x544ded];return _0x598372;};'use strict';var Manager=require(_0x078e('0x0'));var BPromise=require(_0x078e('0x1'));var util=require(_0x078e('0x2'));var logger=require(_0x078e('0x3'))('ami');var config=require(_0x078e('0x4'));var ami=new Manager(config['asterisk']['port'],config[_0x078e('0x5')]['ip'],config[_0x078e('0x5')][_0x078e('0x6')],config['asterisk'][_0x078e('0x7')],!![]);ami[_0x078e('0x8')]();ami['Action']=BPromise['promisify'](ami[_0x078e('0x9')]);function error(_0x29fa56){logger[_0x078e('0xa')](util[_0x078e('0xb')](_0x078e('0xc'),config['asterisk'][_0x078e('0x6')],config[_0x078e('0x5')]['ip'],config[_0x078e('0x5')][_0x078e('0xd')],util[_0x078e('0xe')](_0x29fa56,![],null)));}function close(){logger['error'](util[_0x078e('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x078e('0x5')][_0x078e('0x6')],config[_0x078e('0x5')]['ip'],config['asterisk'][_0x078e('0xd')]));}ami[_0x078e('0xf')]=function(){return function(){return ami[_0x078e('0x10')]({'action':_0x078e('0x11')});};};ami[_0x078e('0x12')]=function(){return function(){return ami[_0x078e('0x10')]({'action':_0x078e('0x13')});};};ami[_0x078e('0x14')]=function(){return function(){return ami[_0x078e('0x10')]({'action':_0x078e('0x15')});};};ami[_0x078e('0x16')]=function(){return function(){return ami[_0x078e('0x10')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x078e('0x10')]({'action':'coreshowchannels'});};};function connect(){logger[_0x078e('0x17')](util[_0x078e('0xb')](_0x078e('0x18'),config[_0x078e('0x5')][_0x078e('0x6')],config[_0x078e('0x5')]['ip'],config[_0x078e('0x5')][_0x078e('0xd')]));ami[_0x078e('0x19')](_0x078e('0xa'),error);ami[_0x078e('0x19')]('close',close);}ami['on'](_0x078e('0x1a'),connect);ami['on']('shutdown',function(_0x2cb9bf){logger['info'](util[_0x078e('0xb')](_0x078e('0x1b'),config[_0x078e('0x5')][_0x078e('0x6')],config[_0x078e('0x5')]['ip'],config[_0x078e('0x5')][_0x078e('0xd')],util[_0x078e('0xe')](_0x2cb9bf,![],null)));});ami['on'](_0x078e('0x1c'),function(){logger[_0x078e('0x17')](util[_0x078e('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x078e('0x5')][_0x078e('0x6')],config['asterisk']['ip'],config[_0x078e('0x5')][_0x078e('0xd')]));return Promise['resolve']()[_0x078e('0x1d')](ami[_0x078e('0xf')]())['then'](ami['actionDeviceStateList']())['then'](ami[_0x078e('0x14')]())[_0x078e('0x1d')](ami['actionQueueSummary']())[_0x078e('0x1d')](ami[_0x078e('0x1e')]())[_0x078e('0x1f')](function(_0x451dc2){logger[_0x078e('0xa')](_0x078e('0x20'),util[_0x078e('0xe')](_0x451dc2,{'showHidden':![],'depth':null}));});});ami[_0x078e('0x19')](_0x078e('0xa'),error);ami[_0x078e('0x19')](_0x078e('0x21'),close);module['exports']=ami; \ No newline at end of file +var _0xa469=['port','asterisk','username','keepConnected','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','sipshowregistry','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','actionDeviceStateList','then','[ami.js][fullybooted]','asterisk-manager','util','../../config/logger','ami'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xa469,0xf4));var _0x9a46=function(_0x1232fd,_0x31f665){_0x1232fd=_0x1232fd-0x0;var _0x4a1b07=_0xa469[_0x1232fd];return _0x4a1b07;};'use strict';var Manager=require(_0x9a46('0x0'));var BPromise=require('bluebird');var util=require(_0x9a46('0x1'));var logger=require(_0x9a46('0x2'))(_0x9a46('0x3'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x9a46('0x4')],config[_0x9a46('0x5')]['ip'],config[_0x9a46('0x5')][_0x9a46('0x6')],config['asterisk']['password'],!![]);ami[_0x9a46('0x7')]();ami[_0x9a46('0x8')]=BPromise['promisify'](ami['action']);function error(_0x545623){logger[_0x9a46('0x9')](util[_0x9a46('0xa')](_0x9a46('0xb'),config[_0x9a46('0x5')][_0x9a46('0x6')],config[_0x9a46('0x5')]['ip'],config[_0x9a46('0x5')][_0x9a46('0x4')],util[_0x9a46('0xc')](_0x545623,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x9a46('0x5')][_0x9a46('0x6')],config[_0x9a46('0x5')]['ip'],config['asterisk'][_0x9a46('0x4')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x9a46('0x8')]({'action':_0x9a46('0xd')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x9a46('0xe')});};};ami[_0x9a46('0xf')]=function(){return function(){return ami[_0x9a46('0x8')]({'action':'sippeerstatus'});};};ami[_0x9a46('0x10')]=function(){return function(){return ami[_0x9a46('0x8')]({'action':_0x9a46('0x11')});};};ami[_0x9a46('0x12')]=function(){return function(){return ami[_0x9a46('0x8')]({'action':_0x9a46('0x13')});};};function connect(){logger['info'](util[_0x9a46('0xa')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x9a46('0x6')],config[_0x9a46('0x5')]['ip'],config[_0x9a46('0x5')][_0x9a46('0x4')]));ami['once'](_0x9a46('0x9'),error);ami[_0x9a46('0x14')](_0x9a46('0x15'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x17eb27){logger[_0x9a46('0x16')](util[_0x9a46('0xa')](_0x9a46('0x17'),config[_0x9a46('0x5')][_0x9a46('0x6')],config[_0x9a46('0x5')]['ip'],config[_0x9a46('0x5')][_0x9a46('0x4')],util[_0x9a46('0xc')](_0x17eb27,![],null)));});ami['on'](_0x9a46('0x18'),function(){logger[_0x9a46('0x16')](util[_0x9a46('0xa')](_0x9a46('0x19'),config['asterisk'][_0x9a46('0x6')],config['asterisk']['ip'],config[_0x9a46('0x5')][_0x9a46('0x4')]));return Promise[_0x9a46('0x1a')]()['then'](ami[_0x9a46('0x1b')]())['then'](ami[_0x9a46('0x1c')]())[_0x9a46('0x1d')](ami['actionSipPeerStatus']())['then'](ami[_0x9a46('0x10')]())[_0x9a46('0x1d')](ami[_0x9a46('0x12')]())['catch'](function(_0x4e1964){logger[_0x9a46('0x9')](_0x9a46('0x1e'),util[_0x9a46('0xc')](_0x4e1964,{'showHidden':![],'depth':null}));});});ami[_0x9a46('0x14')](_0x9a46('0x9'),error);ami[_0x9a46('0x14')](_0x9a46('0x15'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d65e3b2..7a77dcc 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x4e2272,_0x2e1ae0){var _0x45511c=function(_0x285414){while(--_0x285414){_0x4e2272['push'](_0x4e2272['shift']());}};_0x45511c(++_0x2e1ae0);}(_0xac4a,0x13f));var _0xaac4=function(_0x69095,_0x9c37ca){_0x69095=_0x69095-0x0;var _0x278c95=_0xac4a[_0x69095];return _0x278c95;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda3f,0xec));var _0xfda3=function(_0x5579e9,_0x54e865){_0x5579e9=_0x5579e9-0x0;var _0x1bfd1c=_0xda3f[_0x5579e9];return _0x1bfd1c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index fd2bebe..80caa98 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 _0xcfb4=['info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','stringify','isTrunkReachable','active','format','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','ifTime','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','push','iftime\x20%s,%s','interval','timezones','content','indexOf','true','catch','command','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','booked','Queue','method\x20not\x20recognized','silly','intervalIftime','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','additional','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','voiceQueue','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','actionid','strategy','rrmemory','locked','paused','stateinterface','isNil','roundrobin','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAMDActive','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','dialGlobalMaxRetry','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','dialQueueProject','AnswerAGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','resolve','available','talking','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','assign','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','Action','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','queueCallerAbandonCreateState','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','dialCutDigit','SIP/%s/%s%s','trim','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','ivrTotalCallsDays','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','reachable','getContactDialer','countReScheduled','[countReScheduled]\x20','ACTIVE','RUNNING','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginate]\x20','checkContactBlack','[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','[abandonmentRate]','m\x20=\x20','p\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','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','lodash','uuid','ioredis','./utils','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','newexten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','voice:queue:%s','name','voice_queue:save'];(function(_0x2f0266,_0x273eda){var _0x40854b=function(_0x37853a){while(--_0x37853a){_0x2f0266['push'](_0x2f0266['shift']());}};_0x40854b(++_0x273eda);}(_0xcfb4,0x1d8));var _0x4cfb=function(_0x340fbb,_0x17d23f){_0x340fbb=_0x340fbb-0x0;var _0x4a8c20=_0xcfb4[_0x340fbb];return _0x4a8c20;};'use strict';var util=require('util');var _=require(_0x4cfb('0x0'));var uuid=require(_0x4cfb('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x4cfb('0x2'));var utils=require(_0x4cfb('0x3'));var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require(_0x4cfb('0x4'));var logger=require(_0x4cfb('0x5'))('dialer');var loggerBooked=require(_0x4cfb('0x5'))('booked');var loggerPredictive=require(_0x4cfb('0x5'))(_0x4cfb('0x6'));var loggerPredictiveCalls=require(_0x4cfb('0x5'))(_0x4cfb('0x7'));var loggerSyncQueueSummary=require(_0x4cfb('0x5'))(_0x4cfb('0x8'));var ami=require(_0x4cfb('0x9'));config[_0x4cfb('0xa')]=_['defaults'](config[_0x4cfb('0xa')],{'host':_0x4cfb('0xb'),'port':0x18eb});var io=require(_0x4cfb('0xc'))(new Redis(config['redis']));var cmHopper=require(_0x4cfb('0xd'));var voiceQueueRt=require(_0x4cfb('0xe'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x4cfb('0xf'));var Action=require(_0x4cfb('0x10'));var History=require('./models/history');var Final=require(_0x4cfb('0x11'));var AgentComplete=require(_0x4cfb('0x12'));var QueueCallerAbandon=require(_0x4cfb('0x13'));var Hangup=require(_0x4cfb('0x14'));var ipAgi=process[_0x4cfb('0x15')][_0x4cfb('0x16')]||_0x4cfb('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4cfb('0x18')][_0x4cfb('0x19')]=function(_0x317b5c){this[_0x4cfb('0x1a')]=this[_0x4cfb('0x1a')]?this['tail'][_0x4cfb('0x1b')](_0x317b5c):_0x317b5c();};function Dialer(_0xfcb71d,_0x535942){this[_0x4cfb('0x1c')]=new Sequence();this['preview']=_0x535942;this[_0x4cfb('0x1d')]=_0xfcb71d['voiceQueues'];this[_0x4cfb('0x1e')]=_0xfcb71d[_0x4cfb('0x1e')];this[_0x4cfb('0x1f')]=_0xfcb71d[_0x4cfb('0x1f')];this[_0x4cfb('0x20')]=_0xfcb71d[_0x4cfb('0x20')];this[_0x4cfb('0x21')]=config[_0x4cfb('0x21')]||0x2;this[_0x4cfb('0x22')]={};this['actions']={};this[_0x4cfb('0x23')]={};this[_0x4cfb('0x24')]={};this['optionPredictive']={};this[_0x4cfb('0x25')]={};this[_0x4cfb('0x26')]={};this[_0x4cfb('0x27')]={};this[_0x4cfb('0x28')]={};this[_0x4cfb('0x29')]={};this[_0x4cfb('0x2a')]={};ami['on'](_0x4cfb('0x2b'),this[_0x4cfb('0x2c')][_0x4cfb('0x2d')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x4cfb('0x2d')](this));ami['on'](_0x4cfb('0x2e'),this[_0x4cfb('0x2f')][_0x4cfb('0x2d')](this));ami['on']('agentcomplete',this[_0x4cfb('0x30')][_0x4cfb('0x2d')](this));ami['on'](_0x4cfb('0x31'),this[_0x4cfb('0x8')][_0x4cfb('0x2d')](this));ami['on'](_0x4cfb('0x32'),this['syncQueueSummaryComplete'][_0x4cfb('0x2d')](this));ami['on'](_0x4cfb('0x33'),this['syncHangup'][_0x4cfb('0x2d')](this));ami['on'](_0x4cfb('0x34'),this['syncNewExten'][_0x4cfb('0x2d')](this));ami['on'](_0x4cfb('0x35'),this[_0x4cfb('0x36')]['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x4cfb('0x2d')](this));ami['on'](_0x4cfb('0x37'),this[_0x4cfb('0x38')]['bind'](this));this['loopCampaigns']();this[_0x4cfb('0x39')]();RpcSetting[_0x4cfb('0x3a')]()[_0x4cfb('0x3b')](function(_0x16b092){previewRecallmeReminderInterval=_0x16b092[_0x4cfb('0x3c')];});}function isNotNull(_0x3e5cb4){return _0x3e5cb4!==null&&!_[_0x4cfb('0x3d')](_0x3e5cb4);}function msgResponse(_0x4e1340,_0x422fe6,_0x3c435f){return{'action':_0x4e1340,'response':_0x422fe6,'message':_0x3c435f,'stack':_0x3c435f};}function emit(_0x56d0a6,_0xe5edf6,_0x2de613){io['to'](_0x56d0a6)[_0x4cfb('0x3e')](_0xe5edf6,_0x2de613);}function emitOutboundVoiceQueueSummary(_0x5aaa80){if(_0x5aaa80[_0x4cfb('0x3f')]===_0x4cfb('0x40')){logger[_0x4cfb('0x41')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x4cfb('0x42')](_0x5aaa80,{'showHidden':![],'depth':null}));emit(util['format'](_0x4cfb('0x43'),_0x5aaa80[_0x4cfb('0x44')]),_0x4cfb('0x45'),_0x5aaa80);}}function checkGetDataPredictive(_0x3aa061){if(isNotNull(_0x3aa061)&&!_['isEmpty'](_0x3aa061)){loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x47'));loggerPredictive[_0x4cfb('0x46')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3aa061[_0x4cfb('0x48')]);loggerPredictive[_0x4cfb('0x46')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3aa061['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x49'),_0x3aa061[_0x4cfb('0x4a')]);loggerPredictive[_0x4cfb('0x46')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3aa061[_0x4cfb('0x4b')]);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x4c'),_0x3aa061[_0x4cfb('0x4d')]);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x4e'),_0x3aa061[_0x4cfb('0x4f')]);loggerPredictive['info'](_0x4cfb('0x50'));if(_0x3aa061[_0x4cfb('0x48')]>0x0){if(!_[_0x4cfb('0x3d')](_0x3aa061[_0x4cfb('0x4f')])&&_0x3aa061['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x51'));if(!_[_0x4cfb('0x3d')](_0x3aa061[_0x4cfb('0x4d')])&&_0x3aa061[_0x4cfb('0x4d')]>0x0){return!![];}loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x52'));}else{loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x53'));}}else{loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x54'));}return![];}function mergeDataErlangB(_0x47e15f){return function(_0x3f3348){loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x55'));loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x56'),_0x3f3348[_0x4cfb('0x57')]);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x58'),_0x3f3348[_0x4cfb('0x59')]);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x5a'),_0x3f3348[_0x4cfb('0x5b')]);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x5c'),_0x3f3348[_0x4cfb('0x5d')]);loggerPredictive['info'](_0x4cfb('0x5a'),_0x3f3348['erlangAbandonmentRate']);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x50'));_[_0x4cfb('0x5e')](_0x47e15f,_0x3f3348);};}function ifInterval(_0xeefebd,_0x3c7fe2){if(_[_0x4cfb('0x3d')](_0x3c7fe2)){return![];}return utils[_0x4cfb('0x5f')](undefined,_0x3c7fe2)<_0xeefebd*0x3c;}function clearPredictiveAttributes(_0x53adce){if(_0x53adce['startProgressive']){_0x53adce[_0x4cfb('0x26')]=undefined;loggerPredictive[_0x4cfb('0x41')](_0x53adce[_0x4cfb('0x44')],_0x4cfb('0x60'));}if(_0x53adce[_0x4cfb('0x25')]){_0x53adce[_0x4cfb('0x25')]=undefined;loggerPredictive[_0x4cfb('0x41')](_0x53adce[_0x4cfb('0x44')],_0x4cfb('0x61'));}if(_0x53adce[_0x4cfb('0x62')]){clearInterval(_0x53adce['handlePredictive']);_0x53adce[_0x4cfb('0x62')]=undefined;loggerPredictive[_0x4cfb('0x41')](_0x53adce['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x21099d,_0x12d4f1){return function(_0x4a8408){loggerPredictive[_0x4cfb('0x63')](_0x12d4f1['name'],_0x21099d);loggerPredictive[_0x4cfb('0x63')](_0x4a8408['stack']);clearPredictiveAttributes(_0x12d4f1);};}function loggerCatch(_0x222fbc){return function(_0x1000ec){logger[_0x4cfb('0x63')](_0x222fbc,util['inspect'](_0x1000ec,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x313677,_0x39979b,_0x5a2b83){return function(_0x2e0b6d){utils[_0x4cfb('0x64')](_0x39979b,_0x5a2b83,0x0);logger[_0x4cfb('0x63')](_0x313677,util['inspect'](_0x2e0b6d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4959ea){return function(_0x355849){if(isNotNull(_0x355849)&&isNotNull(_0x355849[0x0])){if(_0x355849[0x0][_0x4cfb('0x65')]>0x0){_0x4959ea[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')][_0x4cfb('0x68')];logger['info'](_0x4cfb('0x69')+_0x4959ea['name'],_0x355849[0x0]['contactsRescheduled'],_0x4cfb('0x6a'));}else{_0x4959ea[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')][_0x4cfb('0x6b')];logger[_0x4cfb('0x46')](_0x4cfb('0x6c')+_0x4959ea[_0x4cfb('0x44')]);}}};}function createObjHistory(_0x266647,_0x2764eb,_0x3e706b,_0x512043,_0x5d57f1){_0x266647['message']=_0x3e706b;var _0xdfefdc=new Action(_0x266647,_0x2764eb);var _0xfd48d3=new History(_0xdfefdc);_0xfd48d3[_0x4cfb('0x6d')]=_0x512043;_0xfd48d3[_0x4cfb('0x6e')]=_0x5d57f1;_0xfd48d3[_0x4cfb('0x6f')]=_0xdfefdc[_0x4cfb('0x70')];return _0xfd48d3;}function unlockQueueStatus(_0x36675d,_0xd6291b){setTimeout(function(){if(_[_0x4cfb('0x3d')](_0x36675d[_0x4cfb('0x71')])){loggerBooked['error'](_0x4cfb('0x72'),_0xd6291b);}_0x36675d[_0x4cfb('0x71')]=!![];loggerBooked[_0x4cfb('0x46')](_0x4cfb('0x73'),_0xd6291b,JSON['stringify'](_[_0x4cfb('0x74')](_0x36675d,[_0x4cfb('0x44'),_0x4cfb('0x71')])));},0x1f3);}function checkInterval(_0x524028){return function(){if(!isNotNull(_0x524028['Interval'])){_0x524028[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')]['NULL_INTERVAL'];throw _0x524028[_0x4cfb('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x524028[_0x4cfb('0x75')]['Intervals'])){_0x524028[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')][_0x4cfb('0x76')];throw _0x524028[_0x4cfb('0x44')]+_0x4cfb('0x77');}if(!isNotNull(_['isEmpty'](_0x524028[_0x4cfb('0x75')][_0x4cfb('0x78')]))){_0x524028[_0x4cfb('0x66')]=utils['CAMPAIGN_STATUS'][_0x4cfb('0x76')];throw _0x524028[_0x4cfb('0x44')]+_0x4cfb('0x77');}};}function checkIsIVRCampaignActive(_0x366ede){return function(){if(!utils[_0x4cfb('0x79')](_0x366ede)){_0x366ede[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')][_0x4cfb('0x7a')];throw _0x366ede[_0x4cfb('0x44')]+_0x4cfb('0x7b');}};}function emitCampaignSummary(_0x3e6692){if(utils[_0x4cfb('0x7c')](_0x3e6692)){emit(util['format']('campaign:ivr:%s',_0x3e6692['name']),_0x4cfb('0x7d'),_0x3e6692);}}function loggerCatchQueueSummary(_0x2919d3,_0x48742c){return function(_0x42200e){clearPredictiveAttributes(_0x48742c);emitCampaignSummary(_0x48742c);loggerSyncQueueSummary[_0x4cfb('0x41')](_0x2919d3,util[_0x4cfb('0x42')](_0x42200e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x59657c){if(_0x59657c[_0x4cfb('0x7e')]){if(_0x59657c[_0x4cfb('0x7f')]===0x0){_0x59657c[_0x4cfb('0x7e')]=![];_0x59657c[_0x4cfb('0x66')]=utils['CAMPAIGN_STATUS'][_0x4cfb('0x7a')];loggerSyncQueueSummary['debug'](_0x4cfb('0x80'),_0x59657c[_0x4cfb('0x44')],_0x4cfb('0x81'));}else{_0x59657c['message']=utils[_0x4cfb('0x67')][_0x4cfb('0x82')];loggerSyncQueueSummary[_0x4cfb('0x41')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x59657c[_0x4cfb('0x44')],'is\x20disactive');}emitCampaignSummary(_0x59657c);}}function myreject(_0x292487){return function(_0x505a78){return _0x292487(msgResponse('[ifTime][Action]','Error',JSON[_0x4cfb('0x83')](_0x505a78)));};}Dialer[_0x4cfb('0x18')][_0x4cfb('0x84')]=function(_0x2c6d34){return!_[_0x4cfb('0x3d')](_0x2c6d34)&&_0x2c6d34&&!_[_0x4cfb('0x3d')](_0x2c6d34[_0x4cfb('0x44')])&&!_[_0x4cfb('0x3d')](_0x2c6d34[_0x4cfb('0x85')])&&_0x2c6d34[_0x4cfb('0x85')]&&(this[_0x4cfb('0x20')][util[_0x4cfb('0x86')](_0x4cfb('0x87'),_0x2c6d34['name'])][_0x4cfb('0x88')]==='reachable'||this['trunks'][util['format'](_0x4cfb('0x87'),_0x2c6d34[_0x4cfb('0x44')])]['status']===_0x4cfb('0x89'));};Dialer[_0x4cfb('0x18')][_0x4cfb('0x8a')]=function(_0x138d31){var _0x27b473=this;return function(){if(!_0x27b473['isTrunkReachable'](_0x138d31[_0x4cfb('0x8b')])){if(!_0x27b473[_0x4cfb('0x84')](_0x138d31[_0x4cfb('0x8c')])){_0x138d31[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')]['TRUNK_NOT_REACHABLE'];throw _0x138d31['name']+_0x4cfb('0x8d');}}};};Dialer[_0x4cfb('0x18')][_0x4cfb('0x8e')]=function(_0xdba974,_0x42a233,_0xf30aa5,_0x175dca){var _0x763fee=this;return function(){var _0x14e2b6=!![];return _0x763fee[_0x4cfb('0x8f')](_0xdba974,_0x42a233,_0xf30aa5,_0x175dca,_0x14e2b6);};};Dialer[_0x4cfb('0x18')]['checkIfTimeIntervals']=function(_0x170862,_0x28e77d,_0x58b21e,_0x65490){var _0x15a9b4=this;return function(){var _0x3238b9=![];return _0x15a9b4['ifTimeIvr'](_0x170862[_0x4cfb('0x78')],_0x28e77d,_0x58b21e,_0x65490,_0x3238b9);};};Dialer[_0x4cfb('0x18')][_0x4cfb('0x8f')]=function(_0x54f3b2,_0x312d0c,_0x46e8a4,_0x12162c,_0x1a31b0){var _0x225253=[];return new Promise(function(_0x2ca92b,_0x1d12fb){if(!isNotNull(_0x54f3b2)){_0x12162c[_0x4cfb('0x66')]=utils['CAMPAIGN_STATUS'][_0x4cfb('0x76')];return _0x1d12fb(msgResponse('ifTime',_0x4cfb('0x90'),_0x46e8a4+_0x4cfb('0x91')));}if(_[_0x4cfb('0x92')](_0x54f3b2)){_0x12162c['message']=utils[_0x4cfb('0x67')][_0x4cfb('0x93')];return _0x1d12fb(msgResponse(_0x4cfb('0x94'),'Failure',_0x46e8a4+'\x20Intervals\x20is\x20empty\x20'));}if(_0x312d0c&&_[_0x4cfb('0x3d')](config['timezones'][_0x312d0c])){_0x12162c[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')][_0x4cfb('0x95')];return _0x1d12fb(msgResponse(_0x4cfb('0x94'),_0x4cfb('0x90'),_0x46e8a4+_0x4cfb('0x96')+_0x312d0c));}if(_['isArray'](_0x54f3b2)){for(var _0x52df94=0x0;_0x52df94<_0x54f3b2[_0x4cfb('0x97')];_0x52df94+=0x1){_0x225253[_0x4cfb('0x98')](ami['Action']({'action':'command','command':util[_0x4cfb('0x86')](_0x4cfb('0x99'),_0x54f3b2[_0x52df94][_0x4cfb('0x9a')],!_[_0x4cfb('0x3d')](config[_0x4cfb('0x9b')][_0x312d0c])?_0x312d0c:'')})[_0x4cfb('0x3b')](function(_0x50f079){return _0x50f079[_0x4cfb('0x9c')][_0x4cfb('0x9d')](_0x4cfb('0x9e'))>=0x0;})[_0x4cfb('0x9f')](myreject(_0x1d12fb)));}}else{_0x225253['push'](ami['Action']({'action':_0x4cfb('0xa0'),'command':util[_0x4cfb('0x86')]('iftime\x20%s,%s',_0x54f3b2,!_[_0x4cfb('0x3d')](config['timezones'][_0x312d0c])?_0x312d0c:'')})['then'](function(_0x5152cc){return _0x5152cc['content'][_0x4cfb('0x9d')]('true')>=0x0;})[_0x4cfb('0x9f')](myreject(_0x1d12fb)));}Promise[_0x4cfb('0xa1')](_0x225253)[_0x4cfb('0x3b')](function(_0x2fb44d){var _0xa5fef9=_['some'](_0x2fb44d);if(_0xa5fef9){return _0x2ca92b(_0xa5fef9);}else{_0x12162c[_0x4cfb('0x66')]=_0x1a31b0?utils[_0x4cfb('0x67')][_0x4cfb('0xa2')]:utils[_0x4cfb('0x67')][_0x4cfb('0xa3')];return _0x1d12fb(msgResponse('[ifTime][promiseAll]',_0x4cfb('0x90'),'Global:\x20'+_0x1a31b0+'\x20'+_0x46e8a4+_0x4cfb('0xa4')+util[_0x4cfb('0x42')](_0x54f3b2,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x312d0c));}})[_0x4cfb('0x9f')](function(_0xe0468d){return _0x1d12fb(msgResponse(_0x4cfb('0x94'),_0x4cfb('0x90'),JSON[_0x4cfb('0x83')](_0xe0468d)));});});};Dialer[_0x4cfb('0x18')]['loopCampaigns']=function(){var _0x346c30=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x4cfb('0x3b')](function(){setInterval(function(){_0x346c30[_0x4cfb('0xa5')]();},0x3e8);});};Dialer[_0x4cfb('0x18')][_0x4cfb('0xa5')]=function(){var _0x163124=this;var _0x5f6c49;for(var _0x459e17 in this[_0x4cfb('0x1e')]){if(typeof this[_0x4cfb('0x1e')][_0x459e17]!==_0x4cfb('0xa6')){_0x5f6c49=this['campaigns'][_0x459e17];if(utils[_0x4cfb('0x7c')](_0x5f6c49)&&utils[_0x4cfb('0x79')](_0x5f6c49)){_0x5f6c49[_0x4cfb('0x7e')]=!![];Promise['resolve']()[_0x4cfb('0x3b')](checkIsIVRCampaignActive(_0x5f6c49))['then'](checkInterval(_0x5f6c49))[_0x4cfb('0x3b')](_0x163124[_0x4cfb('0x8a')](_0x5f6c49))[_0x4cfb('0x3b')](_0x163124[_0x4cfb('0x8e')](_0x5f6c49[_0x4cfb('0xa7')],_0x5f6c49[_0x4cfb('0xa8')],_0x5f6c49['name'],_0x5f6c49))[_0x4cfb('0x3b')](_0x163124[_0x4cfb('0xa9')](_0x5f6c49[_0x4cfb('0x75')],_0x5f6c49['dialTimezone'],_0x5f6c49[_0x4cfb('0x44')],_0x5f6c49))['then'](_0x163124[_0x4cfb('0xaa')](_0x5f6c49))[_0x4cfb('0x9f')](loggerCatchQueueSummary(_0x4cfb('0xab'),_0x5f6c49));}else{notSendMessagesCampaign(_0x5f6c49);}}}};Dialer[_0x4cfb('0x18')][_0x4cfb('0xac')]=function(_0x47cb11){if(_0x47cb11[_0x4cfb('0xad')]!==_0x4cfb('0x6')){clearPredictiveAttributes(_0x47cb11);}switch(_0x47cb11[_0x4cfb('0xad')]){case _0x4cfb('0xae'):this[_0x4cfb('0xaf')](_0x47cb11,0x1);break;case _0x4cfb('0xb0'):this[_0x4cfb('0xaf')](_0x47cb11,_0x47cb11['dialPowerLevel']);break;case _0x4cfb('0x6'):this['predictive'](_0x47cb11);break;case _0x4cfb('0xb1'):this[_0x4cfb('0xaf')](_0x47cb11,0x1);break;default:logger[_0x4cfb('0x63')](_0x4cfb('0xb2'),_0x47cb11[_0x4cfb('0x44')],_0x4cfb('0xb3'));}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x94')]=function(_0x8a04ff,_0x1037cf){var _0x5e9cd3=_0x8a04ff[_0x4cfb('0xa8')];var _0x4a90c5=_0x1037cf?_0x8a04ff[_0x4cfb('0xa7')]:_0x8a04ff[_0x4cfb('0x75')][_0x4cfb('0x78')];logger[_0x4cfb('0xb4')]('Dialer::ifTime()',_0x4a90c5,_0x5e9cd3,_0x8a04ff[_0x4cfb('0x44')],util['format']('Voice\x20Queue\x20%s\x20$s',_0x8a04ff[_0x4cfb('0x44')],_0x8a04ff['id']));var _0x428f3d=null;return Interval[_0x4cfb('0xb5')](_0x4a90c5,_0x5e9cd3)[_0x4cfb('0x3b')](function(_0x34b278){if(_0x34b278===!![]){return _0x34b278;}else{_0x8a04ff['message']=_0x1037cf?utils[_0x4cfb('0x67')][_0x4cfb('0xa2')]:utils['CAMPAIGN_STATUS'][_0x4cfb('0xa3')];_0x428f3d=msgResponse('[ifTime][promiseAll]',_0x4cfb('0x90'),'Global:\x20'+_0x1037cf+'\x20'+_0x8a04ff[_0x4cfb('0x44')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x4a90c5,{'showHidden':![],'depth':null})+_0x4cfb('0xb6')+_0x5e9cd3);}if(_0x428f3d!==null){logger[_0x4cfb('0xb4')](_0x4cfb('0xb7'),_0x428f3d);_0x428f3d[_0x4cfb('0xb8')]=_0x1037cf;throw _0x428f3d;}})[_0x4cfb('0x9f')](function(_0x5f2f87){logger[_0x4cfb('0x63')](_0x4cfb('0xb9'),_0x5f2f87);throw msgResponse(_0x4cfb('0xba'),'Error',util[_0x4cfb('0x42')](_0x5f2f87,{'showHidden':![],'depth':null}));});};Dialer[_0x4cfb('0x18')][_0x4cfb('0x2c')]=function(_0x556b9a){if(this[_0x4cfb('0x1d')][_0x556b9a[_0x4cfb('0xbb')]]){if(this[_0x4cfb('0x24')][_0x556b9a[_0x4cfb('0xbc')]]&&this['uniqueId'][_0x556b9a[_0x4cfb('0xbc')]][_0x4cfb('0x3f')]!==_0x4cfb('0xbd')){this[_0x4cfb('0xbe')](this[_0x4cfb('0x1d')][_0x556b9a[_0x4cfb('0xbb')]]);this[_0x4cfb('0x24')][_0x556b9a[_0x4cfb('0xbc')]]['answertime']=moment()['format'](_0x4cfb('0xbf'));}}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x30')]=function(_0x1eea33){var _0xf56d44=this['uniqueId'][_0x1eea33[_0x4cfb('0xbc')]];if(this[_0x4cfb('0x1d')][_0x1eea33[_0x4cfb('0xbb')]]){if(_0xf56d44&&_0xf56d44[_0x4cfb('0x3f')]!==_0x4cfb('0xbd')){delete this[_0x4cfb('0x24')][_0x1eea33[_0x4cfb('0xbc')]];this[_0x4cfb('0x1d')][_0x1eea33[_0x4cfb('0xbb')]]['outboundAnswerCallsDay']+=0x1;var _0xf69b56=new AgentComplete(_0xf56d44,_0x1eea33);if(_0x1eea33[_0x4cfb('0xc0')]===_0x4cfb('0xc1')){_0xf69b56[_0x4cfb('0xc2')]=this[_0x4cfb('0x1d')][_0x1eea33[_0x4cfb('0xbb')]][_0x4cfb('0xc3')]&&this[_0x4cfb('0x1d')][_0x1eea33[_0x4cfb('0xbb')]][_0x4cfb('0xc4')]?moment()[_0x4cfb('0x86')](_0x4cfb('0xbf')):undefined;}hopperUtils[_0x4cfb('0xc5')](_0xf69b56)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0xc6')));hopperUtils['moveContactManagedDialer'](_0xf69b56)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0xc7')));}}};Dialer['prototype'][_0x4cfb('0xc8')]=function(_0x346ed8){var _0xd7cef0=this[_0x4cfb('0x24')][_0x346ed8['uniqueid']];var _0x57b9c3=this;var _0x29918a=![];var _0x1ea31c;var _0x4f7b01;if(this['voiceQueues'][_0x346ed8['queue']]){if(_0xd7cef0&&_0xd7cef0[_0x4cfb('0x3f')]!==_0x4cfb('0xbd')){delete this['uniqueId'][_0x346ed8['uniqueid']];this['updateOriginated'](this[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]]);_0xd7cef0['droptime']=moment()[_0x4cfb('0x86')](_0x4cfb('0xbf'));var _0x33e7ea=new QueueCallerAbandon(_0xd7cef0,_0x346ed8);if(utils[_0x4cfb('0x5f')](_0xd7cef0[_0x4cfb('0xc9')],_0xd7cef0[_0x4cfb('0xca')])>=_0xd7cef0[_0x4cfb('0xcb')]){this['voiceQueues'][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0x4a')]+=0x1;this[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0xcc')]+=0x1;_0x33e7ea['state']=0xa;_0x33e7ea[_0x4cfb('0x6e')]=_0x4cfb('0xcd');_0x33e7ea[_0x4cfb('0xce')]=_0x4cfb('0xcf');_0x33e7ea['agiafterat']=this[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0xc3')]?moment()['format'](_0x4cfb('0xbf')):undefined;_0x33e7ea[_0x4cfb('0xd0')]+=0x1;_0x33e7ea[_0x4cfb('0xd1')]+=0x1;_0x1ea31c=this['voiceQueues'][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0xd2')];_0x4f7b01=this[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0xd3')];hopperUtils['verifyAdditionalPhones'](_0x33e7ea,_0x33e7ea[_0x4cfb('0x6d')],_0xd7cef0['voiceQueue'])['then'](function(_0x5a08bb){_0x29918a=_0x5a08bb[_0x4cfb('0xd4')]==0x1;if(_0x33e7ea[_0x4cfb('0xd0')]>=_0x57b9c3['voiceQueues'][_0x346ed8['queue']]['dialDropMaxRetry']){_0x57b9c3['queueCallerAbandonCreateState'](_0x33e7ea,_0x5a08bb[_0x4cfb('0xd4')]);}else{hopperUtils[_0x4cfb('0xd5')]({'active':![],'countdropretry':_0x33e7ea[_0x4cfb('0xd0')],'scheduledat':moment()[_0x4cfb('0xd6')](_0x57b9c3[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0xd2')],_0x4cfb('0xd7'))[_0x4cfb('0x86')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xd7cef0[_0x4cfb('0xd8')],'ListId':_0xd7cef0[_0x4cfb('0xd9')],'VoiceQueueId':_0xd7cef0[_0x4cfb('0xda')]||undefined,'CampaignId':_0xd7cef0[_0x4cfb('0xdb')]||undefined})['catch'](loggerCatch(_0x4cfb('0xdc')));var _0x100104=new History(_0x33e7ea);_0x100104['state']=0xa;_0x100104[_0x4cfb('0x6e')]='Drop';_0x100104[_0x4cfb('0x70')]=moment()[_0x4cfb('0x86')](_0x4cfb('0xbf'));_0x100104[_0x4cfb('0x6f')]=_0x100104[_0x4cfb('0x70')];_0x100104[_0x4cfb('0xdd')]=_0x33e7ea[_0x4cfb('0xdd')];_0x100104['calleridnum']=_0x33e7ea[_0x4cfb('0xde')];hopperUtils[_0x4cfb('0xc5')](_0x100104)['catch'](loggerCatch(_0x4cfb('0xdf')));}})[_0x4cfb('0x3b')](function(){if(_0x29918a)hopperUtils[_0x4cfb('0xe0')](_0x33e7ea,_0x1ea31c,_0x4f7b01)['then'](function(){return 0x1;});});}else{this[_0x4cfb('0x1d')][_0x346ed8['queue']][_0x4cfb('0x4b')]+=0x1;this[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]]['outboundDropCallsDayCallersExit']+=0x1;_0x33e7ea[_0x4cfb('0x6d')]=0xb;_0x33e7ea['statedesc']=_0x4cfb('0xe1');_0x33e7ea[_0x4cfb('0xce')]=_0x4cfb('0xe2');_0x33e7ea[_0x4cfb('0xe3')]+=0x1;_0x33e7ea[_0x4cfb('0xd1')]+=0x1;_0x1ea31c=this[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0xe4')];_0x4f7b01=this[_0x4cfb('0x1d')][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0xd3')];hopperUtils[_0x4cfb('0xe5')](_0x33e7ea,_0x33e7ea['state'],_0xd7cef0[_0x4cfb('0xe6')])[_0x4cfb('0x3b')](function(_0x5ab2ff){if(_0x33e7ea['countabandonedretry']>=_0x57b9c3[_0x4cfb('0x1d')][_0x346ed8['queue']][_0x4cfb('0xe7')]){_0x57b9c3['queueCallerAbandonCreateState'](_0x33e7ea,_0x5ab2ff['additional']);}else{hopperUtils[_0x4cfb('0xd5')]({'active':![],'countabandonedretry':_0x33e7ea[_0x4cfb('0xe3')],'scheduledat':moment()[_0x4cfb('0xd6')](_0x57b9c3['voiceQueues'][_0x346ed8[_0x4cfb('0xbb')]][_0x4cfb('0xe4')],_0x4cfb('0xd7'))[_0x4cfb('0x86')](_0x4cfb('0xbf')),'ContactId':_0xd7cef0[_0x4cfb('0xd8')],'ListId':_0xd7cef0[_0x4cfb('0xd9')],'VoiceQueueId':_0xd7cef0['VoiceQueueId']||undefined,'CampaignId':_0xd7cef0[_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0xe8')));var _0x4b56b6=new History(_0x33e7ea);_0x4b56b6['state']=0xb;_0x4b56b6['statedesc']=_0x4cfb('0xe1');_0x4b56b6[_0x4cfb('0x70')]=moment()['format'](_0x4cfb('0xbf'));_0x4b56b6[_0x4cfb('0x6f')]=_0x4b56b6['starttime'];_0x4b56b6[_0x4cfb('0xdd')]=_0x33e7ea[_0x4cfb('0xdd')];_0x4b56b6[_0x4cfb('0xde')]=_0x33e7ea[_0x4cfb('0xde')];hopperUtils['createHistory'](_0x4b56b6)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0xe9')));}})[_0x4cfb('0x3b')](function(){if(_0x29918a)hopperUtils[_0x4cfb('0xe0')](_0x33e7ea,_0x1ea31c,_0x4f7b01)[_0x4cfb('0x3b')](function(){return 0x1;});});}}}};Dialer[_0x4cfb('0x18')][_0x4cfb('0xea')]=function(_0x936dcf){if(this[_0x4cfb('0xeb')][_0x936dcf[_0x4cfb('0xbc')]]){this[_0x4cfb('0xeb')][_0x936dcf[_0x4cfb('0xbc')]]['channel']=_0x936dcf['channel'];}if(this[_0x4cfb('0x24')][_0x936dcf[_0x4cfb('0xbc')]]){this['uniqueId'][_0x936dcf['uniqueid']][_0x4cfb('0xec')]=_0x936dcf[_0x4cfb('0xec')];}};Dialer[_0x4cfb('0x18')]['syncQueueMember']=function(_0xe64be9){if(!this['actions'][_0xe64be9['actionid']]){return;}var _0x476e83=this[_0x4cfb('0x1d')][this[_0x4cfb('0xeb')][_0xe64be9[_0x4cfb('0xed')]][_0x4cfb('0xbb')]][_0x4cfb('0xee')]||_0x4cfb('0xef');if(_0x476e83==='roundrobin'){if(this[_0x4cfb('0xeb')][_0xe64be9[_0x4cfb('0xed')]]&&_['isNil'](this['actions'][_0xe64be9['actionid']][_0x4cfb('0xf0')])&&_0xe64be9['status']==='1'&&_0xe64be9[_0x4cfb('0xf1')]==='0'){if(this[_0x4cfb('0x1f')][_0xe64be9[_0x4cfb('0xf2')]]){if(!this[_0x4cfb('0x1f')][_0xe64be9[_0x4cfb('0xf2')]][_0x4cfb('0xf0')]){this[_0x4cfb('0x1f')][_0xe64be9[_0x4cfb('0xf2')]]['locked']=!![];this[_0x4cfb('0xeb')][_0xe64be9[_0x4cfb('0xed')]][_0x4cfb('0xf0')]=!![];this[_0x4cfb('0xeb')][_0xe64be9['actionid']][_0x4cfb('0xf2')]=_0xe64be9[_0x4cfb('0xf2')];}}}}else if(_0x476e83===_0x4cfb('0xef')){if(this[_0x4cfb('0xeb')][_0xe64be9['actionid']]){if(this['agents'][_0xe64be9[_0x4cfb('0xf2')]]){this[_0x4cfb('0xeb')][_0xe64be9[_0x4cfb('0xed')]][_0x4cfb('0xf2')]=_0xe64be9['stateinterface'];if(_[_0x4cfb('0xf3')](this[_0x4cfb('0x28')][this[_0x4cfb('0xeb')][_0xe64be9[_0x4cfb('0xed')]][_0x4cfb('0xbb')]])){this[_0x4cfb('0x28')][this[_0x4cfb('0xeb')][_0xe64be9[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]=[];}this[_0x4cfb('0x28')][this['actions'][_0xe64be9[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]['push'](_['merge'](_[_0x4cfb('0x74')](this[_0x4cfb('0xeb')][_0xe64be9[_0x4cfb('0xed')]],['idHopper',_0x4cfb('0xf2')]),{'status':_0xe64be9[_0x4cfb('0x88')],'paused':_0xe64be9[_0x4cfb('0xf1')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x249582){if(!this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]]){return;}var _0x1f3de1=this;var _0x2ad2d4=this[_0x4cfb('0x1d')][this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]]['queue']];var _0x278195=_0x2ad2d4[_0x4cfb('0xee')]||_0x4cfb('0xef');if(_0x278195===_0x4cfb('0xf4')){if(this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]]&&this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]]['stateinterface']){this['preview']['run'](this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xf5')],this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xf2')])[_0x4cfb('0x9f')](function(_0x2a01dd){logger[_0x4cfb('0x63')](_0x4cfb('0xf6'),util[_0x4cfb('0x42')](_0x2a01dd,{'showHidden':![],'depth':null}));})[_0x4cfb('0x1b')](function(){_0x1f3de1[_0x4cfb('0xbe')](_0x1f3de1['voiceQueues'][_0x1f3de1['actions'][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]);_0x1f3de1[_0x4cfb('0x1f')][_0x1f3de1[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]]['stateinterface']][_0x4cfb('0xf0')]=![];delete _0x1f3de1['actions'][_0x249582['actionid']];unlockQueueStatus(_0x2ad2d4);});}else{this[_0x4cfb('0xbe')](this['voiceQueues'][this['actions'][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]);hopperUtils[_0x4cfb('0xd5')]({'active':![],'ContactId':this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xd8')],'ListId':this['actions'][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xd9')],'VoiceQueueId':this[_0x4cfb('0xeb')][_0x249582['actionid']][_0x4cfb('0xda')]||undefined,'CampaignId':this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]]['CampaignId']||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0xf7')));delete this['actions'][_0x249582[_0x4cfb('0xed')]];unlockQueueStatus(_0x2ad2d4);}}else if(_0x278195===_0x4cfb('0xef')){var _0xc27be5;if(this[_0x4cfb('0xeb')][_0x249582['actionid']]&&!_[_0x4cfb('0x92')](this[_0x4cfb('0x28')][this[_0x4cfb('0xeb')][_0x249582['actionid']][_0x4cfb('0xbb')]])){if(this[_0x4cfb('0x29')][_0x1f3de1[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]){this[_0x4cfb('0x29')][_0x1f3de1[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]=this[_0x4cfb('0x29')][this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]?this[_0x4cfb('0x29')][this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]:this['queueBooked'][this['actions'][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]?this[_0x4cfb('0x28')][this['actions'][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]]['_rr']||0x0:0x0;}this[_0x4cfb('0x28')][this[_0x4cfb('0xeb')][_0x249582['actionid']][_0x4cfb('0xbb')]][_0x4cfb('0xf8')]=this[_0x4cfb('0x29')][this[_0x4cfb('0xeb')][_0x249582[_0x4cfb('0xed')]][_0x4cfb('0xbb')]];for(var _0x1a0c2c=0x0;_0x1a0c2c=_0x5b870a['dialGlobalMaxRetry']){_0x5c4f7c[_0x4cfb('0x11e')](_0x108101,_0x35a8c4,_0x2a1ead,_0x4cfb('0x11f'));}else{if(_0x108101[_0x4cfb('0x116')]>=_0x5b870a[_0x4cfb('0x120')]){_0x5c4f7c[_0x4cfb('0x121')](_0x108101,_0x35a8c4,_0x2a1ead,_0x4cfb('0x122'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x108101[_0x4cfb('0x116')],'scheduledat':moment()[_0x4cfb('0xd6')](_0x5b870a[_0x4cfb('0x123')],_0x4cfb('0xd7'))[_0x4cfb('0x86')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x108101[_0x4cfb('0xd8')],'ListId':_0x108101[_0x4cfb('0xd9')],'VoiceQueueId':_0x108101[_0x4cfb('0xda')]||undefined,'CampaignId':_0x108101[_0x4cfb('0xdb')]||undefined})['catch'](loggerCatch(_0x4cfb('0x124')));_0x35a8c4({'reschedule':0x1});}}});}if(_0xa63091[_0x4cfb('0x3f')]===_0x4cfb('0xbd')&&this[_0x4cfb('0x1e')][_0xa63091[_0x4cfb('0xbb')]][_0x4cfb('0x125')]&&_0x5e005d['value']===_0x4cfb('0x126')){delete this[_0x4cfb('0x24')][_0x5e005d[_0x4cfb('0xbc')]];this[_0x4cfb('0xbe')](this['campaigns'][_0xa63091[_0x4cfb('0xbb')]]);_0x4dcaaf=new Hangup(_0xa63091,_0x5e005d);_0x4dcaaf['state']=0x12;_0x4dcaaf[_0x4cfb('0x6e')]=_0x4cfb('0x10d');_0x4dcaaf[_0x4cfb('0x10e')]=_0x4cfb('0x10f');ami[_0x4cfb('0x3e')]('custom:amd',ut[_0x4cfb('0x117')](_0x4dcaaf,'amd'));this[_0x4cfb('0x112')](_0x4dcaaf,_0x4cfb('0x127'),_0x4cfb('0x128'));}if(_0xa63091[_0x4cfb('0x3f')]===_0x4cfb('0xbd')&&this[_0x4cfb('0x1e')][_0xa63091[_0x4cfb('0xbb')]][_0x4cfb('0x125')]&&_0x5e005d[_0x4cfb('0x10a')]===_0x4cfb('0x129')){return new Promise(function(_0x2108a9,_0x273179){delete _0x5c4f7c[_0x4cfb('0x24')][_0x5e005d[_0x4cfb('0xbc')]];_0x5c4f7c[_0x4cfb('0xbe')](_0x5c4f7c[_0x4cfb('0x1e')][_0xa63091[_0x4cfb('0xbb')]]);_0x5c4f7c[_0x4cfb('0x1e')][_0xa63091[_0x4cfb('0xbb')]][_0x4cfb('0x10b')]+=0x1;_0x5c4f7c[_0x4cfb('0x1e')][_0xa63091[_0x4cfb('0xbb')]][_0x4cfb('0x10c')]+=0x1;var _0x406ae4=_0x5c4f7c[_0x4cfb('0x1e')][_0xa63091[_0x4cfb('0xbb')]];var _0x2287c8=new Hangup(_0xa63091,_0x5e005d);_0x2287c8[_0x4cfb('0x6d')]=0x13;_0x2287c8[_0x4cfb('0x6e')]=_0x4cfb('0x115');_0x2287c8[_0x4cfb('0x10e')]=_0x4cfb('0x10f');_0x2287c8[_0x4cfb('0x116')]+=0x1;_0x2287c8[_0x4cfb('0xd1')]+=0x1;_0x2287c8[_0x4cfb('0x111')]=!![];ami['emit']('custom:amd',ut[_0x4cfb('0x117')](_0x2287c8,_0x4cfb('0x111')));hopperUtils[_0x4cfb('0xc5')](_0x2287c8)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x118')));if(_0x2287c8[_0x4cfb('0x119')]+_0x2287c8[_0x4cfb('0x11a')]+_0x2287c8[_0x4cfb('0x11b')]+_0x2287c8[_0x4cfb('0x11c')]+_0x2287c8['countdropretry']+_0x2287c8[_0x4cfb('0xe3')]+_0x2287c8[_0x4cfb('0x116')]+_0x2287c8[_0x4cfb('0x11d')]>=_0x406ae4[_0x4cfb('0x12a')]){_0x5c4f7c[_0x4cfb('0x11e')](_0x2287c8,_0x2108a9,_0x273179,'reason19\x20machine....');}else{if(_0x2287c8[_0x4cfb('0x116')]>=_0x406ae4['dialMachineMaxRetry']){_0x5c4f7c[_0x4cfb('0x121')](_0x2287c8,_0x2108a9,_0x273179,'reason\x2019\x20machine....');}else{hopperUtils[_0x4cfb('0xd5')]({'active':![],'countmachineretry':_0x2287c8[_0x4cfb('0x116')],'scheduledat':moment()[_0x4cfb('0xd6')](_0x406ae4[_0x4cfb('0x123')],_0x4cfb('0xd7'))[_0x4cfb('0x86')](_0x4cfb('0xbf')),'ContactId':_0x2287c8[_0x4cfb('0xd8')],'ListId':_0x2287c8[_0x4cfb('0xd9')],'VoiceQueueId':_0x2287c8['VoiceQueueId']||undefined,'CampaignId':_0x2287c8['CampaignId']||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x124')));_0x2108a9({'reschedule':0x1});}}});}}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x12b')]=function(_0x46c365){var _0x4529c4=this['uniqueId'][_0x46c365[_0x4cfb('0xbc')]];var _0x402ef6;if(_0x4529c4&&_0x4529c4[_0x4cfb('0x3f')]===_0x4cfb('0xbd')){delete this[_0x4cfb('0x24')][_0x46c365[_0x4cfb('0xbc')]];this['updateOriginated'](this[_0x4cfb('0x1e')][_0x4529c4[_0x4cfb('0xbb')]]);this[_0x4cfb('0x1e')][_0x4529c4[_0x4cfb('0xbb')]][_0x4cfb('0x12c')]+=0x1;_0x402ef6=new Hangup(_0x4529c4,_0x46c365);hopperUtils[_0x4cfb('0xc5')](_0x402ef6)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x12d')));hopperUtils[_0x4cfb('0x12e')](_0x402ef6)[_0x4cfb('0x9f')](loggerCatch('[syncHangupIvr]'));}if(_0x4529c4&&_0x4529c4[_0x4cfb('0x3f')]!==_0x4cfb('0xbd')&&isNotNull(this[_0x4cfb('0x1d')][_0x4529c4[_0x4cfb('0xbb')]][_0x4cfb('0x12f')])){delete this[_0x4cfb('0x24')][_0x46c365['uniqueid']];this[_0x4cfb('0xbe')](this['voiceQueues'][_0x4529c4[_0x4cfb('0xbb')]]);this['voiceQueues'][_0x4529c4[_0x4cfb('0xbb')]][_0x4cfb('0x10b')]+=0x1;this['voiceQueues'][_0x4529c4[_0x4cfb('0xbb')]][_0x4cfb('0x10c')]+=0x1;_0x402ef6=new Hangup(_0x4529c4,_0x46c365);_0x402ef6[_0x4cfb('0x6d')]=0x10;_0x402ef6['statedesc']=_0x4cfb('0x130');_0x402ef6[_0x4cfb('0x10e')]='AGI';hopperUtils['createHistory'](_0x402ef6)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x12d')));hopperUtils[_0x4cfb('0x12e')](_0x402ef6)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x131')));}if(_0x4529c4&&_0x4529c4[_0x4cfb('0x3f')]!==_0x4cfb('0xbd')&&!isNotNull(this['voiceQueues'][_0x4529c4[_0x4cfb('0xbb')]]['dialQueueProject'])){delete this[_0x4cfb('0x24')][_0x46c365['uniqueid']];this[_0x4cfb('0xbe')](this[_0x4cfb('0x1d')][_0x4529c4[_0x4cfb('0xbb')]]);this[_0x4cfb('0x1d')][_0x4529c4[_0x4cfb('0xbb')]][_0x4cfb('0x132')]+=0x1;_0x402ef6=new Hangup(_0x4529c4,_0x46c365);_0x402ef6['state']=0xc;_0x402ef6[_0x4cfb('0x6e')]=_0x46c365[_0x4cfb('0x133')];_0x402ef6[_0x4cfb('0x10e')]=_0x4cfb('0x134');hopperUtils[_0x4cfb('0xc5')](_0x402ef6)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x12d')));hopperUtils['moveContactManagedDialer'](_0x402ef6)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x131')));}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x8')]=function(_0x2d599f){var _0x3c31db=this;if(!_0x3c31db['queuesSummary'][_0x2d599f[_0x4cfb('0x44')]]){_0x3c31db[_0x4cfb('0x2a')][_0x2d599f['name']]={'running':![]};}else if(_0x3c31db[_0x4cfb('0x2a')][_0x2d599f['name']]['running']===!![]){return;}else if(_0x3c31db[_0x4cfb('0x2a')][_0x2d599f[_0x4cfb('0x44')]]['running']===![]){_0x3c31db['queuesSummary'][_0x2d599f[_0x4cfb('0x44')]][_0x4cfb('0x135')]=!![];}var _0x1b20d4=_0x3c31db[_0x4cfb('0x1d')][_0x2d599f[_0x4cfb('0x44')]];var _0x4ba197=_0x1b20d4['message']!==utils[_0x4cfb('0x67')][_0x4cfb('0x7a')];var _0x58244f=utils['isPreviewCampaign'](_0x1b20d4);_0x1b20d4[_0x4cfb('0x136')]=utils['getQueueCampaignStatusMessage'](_0x1b20d4,_0x3c31db[_0x4cfb('0x20')]);Promise[_0x4cfb('0x137')]()[_0x4cfb('0x3b')](function(){if(_0x1b20d4['statusMessage']===utils[_0x4cfb('0x67')][_0x4cfb('0x7a')]){if(_0x4ba197){clearPredictiveAttributes(_0x1b20d4);_0x2d599f[_0x4cfb('0x25')]=undefined;_0x2d599f[_0x4cfb('0x26')]=undefined;}if(_0x1b20d4[_0x4cfb('0x136')]===utils[_0x4cfb('0x67')]['INACTIVE']){_0x2d599f[_0x4cfb('0x138')]=0x0;_0x2d599f['paused']=0x0;_0x2d599f['inUse']=0x0;_0x2d599f[_0x4cfb('0x139')]=0x0;_0x2d599f[_0x4cfb('0x13a')]=0x0;}}else if(_0x1b20d4[_0x4cfb('0x136')]===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x58244f){return _0x3c31db['ifTime'](_0x1b20d4,!![])[_0x4cfb('0x3b')](function(){return _0x3c31db[_0x4cfb('0x94')](_0x1b20d4,![]);})['then'](function(){return _0x3c31db[_0x4cfb('0xac')](_0x1b20d4);})['catch'](function(_0x144bd4){loggerSyncQueueSummary['debug'](_0x4cfb('0x13b'),util[_0x4cfb('0x42')](_0x144bd4,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1b20d4);});}else{clearPredictiveAttributes(_0x1b20d4);}})['then'](function(){var _0x1a206c=_0x2d599f['compareToOutboundQueue'](_0x1b20d4);if(_0x1a206c||_0x1b20d4[_0x4cfb('0x13c')]){_0x1b20d4['queueSummaryCountersUpdated']=![];_0x2d599f['updateReportFromOutboundQueue'](_0x1b20d4);Object[_0x4cfb('0x13d')](_0x1b20d4,_0x2d599f);emitOutboundVoiceQueueSummary(_0x2d599f);}_0x3c31db[_0x4cfb('0x2a')][_0x1b20d4[_0x4cfb('0x44')]]['running']=![];})['catch'](function(_0x4d29e4){logger['error']('[syncQueueSummary]',util['inspect'](_0x4d29e4,{'showHidden':![],'depth':null}));_0x3c31db['queuesSummary'][_0x1b20d4[_0x4cfb('0x44')]][_0x4cfb('0x135')]=![];});};Dialer['prototype'][_0x4cfb('0x13e')]=_['throttle'](function(){var _0x36dc66=_[_0x4cfb('0x13f')](this['voiceQueues'],function(_0x1258ff){return _0x1258ff[_0x4cfb('0x140')];});var _0x27c97d=_[_0x4cfb('0x13f')](this[_0x4cfb('0x1f')],function(_0x4f7c10){return _0x4f7c10[_0x4cfb('0x141')]&&_0x4f7c10[_0x4cfb('0x88')]==='reachable';});if(_0x36dc66['length']>0x0&&_0x27c97d['length']>0x0){return Promise[_0x4cfb('0x137')]()[_0x4cfb('0x3b')](cmHopper[_0x4cfb('0x142')](_[_0x4cfb('0x143')](_0x36dc66,'id'),previewRecallmeReminderInterval,_['map'](_0x27c97d,'id')))[_0x4cfb('0x3b')](function(_0x37f192){for(var _0x4d94b8=0x0;_0x4d94b8<_0x37f192[_0x4cfb('0x97')];_0x4d94b8++){var _0x36e219=_0x37f192[_0x4d94b8][_0x4cfb('0x144')][_0x4cfb('0x44')];if(_0x36e219)io['to'](util[_0x4cfb('0x86')](_0x4cfb('0x145'),_0x36e219))[_0x4cfb('0x3e')](_0x4cfb('0x146'),{'hopper':_0x37f192[_0x4d94b8]});}})[_0x4cfb('0x9f')](function(_0x43a188){logger[_0x4cfb('0x63')]('checkPreviewRecallReminder',_0x43a188);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4cfb('0x18')][_0x4cfb('0x39')]=function(){var _0x57b02a=this;setInterval(function(){_0x57b02a[_0x4cfb('0x147')](_0x57b02a['uniqueId'],_0x4cfb('0x148'));_0x57b02a[_0x4cfb('0x147')](_0x57b02a[_0x4cfb('0xeb')],_0x4cfb('0x149'));},0x32c8);};Dialer[_0x4cfb('0x18')][_0x4cfb('0x147')]=function(_0x228e36,_0x5aa911){var _0x455405=this;for(var _0x585b2b in _0x228e36){if(typeof _0x228e36[_0x585b2b]!==_0x4cfb('0xa6')){this[_0x4cfb('0x1c')]['enqueue'](function(){if(!_[_0x4cfb('0xf3')](_0x228e36[_0x585b2b])){return ami[_0x4cfb('0x14a')]({'action':_0x4cfb('0x88'),'channel':_0x228e36[_0x585b2b][_0x4cfb('0xec')]})[_0x4cfb('0x9f')](function(_0x912892){if(_0x912892[_0x4cfb('0x66')]===_0x4cfb('0x14b')){setTimeout(function(){if(_0x228e36[_0x585b2b]&&_0x228e36[_0x585b2b][_0x4cfb('0x3f')]!=='ivr'){_0x455405[_0x4cfb('0xbe')](_0x455405[_0x4cfb('0x1d')][_0x228e36[_0x585b2b][_0x4cfb('0xbb')]]);logger[_0x4cfb('0x63')](_0x4cfb('0x14c'),_0x5aa911,_0x585b2b,_0x228e36[_0x585b2b][_0x4cfb('0xbb')]);delete _0x228e36[_0x585b2b];}if(_0x228e36[_0x585b2b]&&_0x228e36[_0x585b2b][_0x4cfb('0x3f')]==='ivr'){_0x455405[_0x4cfb('0xbe')](_0x455405['campaigns'][_0x228e36[_0x585b2b][_0x4cfb('0xbb')]]);logger[_0x4cfb('0x63')]('[Dialer][checkChannel][ivr]',_0x5aa911,_0x585b2b,_0x228e36[_0x585b2b][_0x4cfb('0xbb')]);delete _0x228e36[_0x585b2b];}},0x2328);}});}});}}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x14d')]=function(_0x271d72){return Promise['resolve']()[_0x4cfb('0x3b')](voiceQueueRt[_0x4cfb('0x14d')](_0x271d72))[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x14e')));};Dialer[_0x4cfb('0x18')][_0x4cfb('0xbe')]=function(_0x2aff46){if(!_[_0x4cfb('0x3d')](_0x2aff46)&&_0x2aff46!==null){if(typeof _0x2aff46[_0x4cfb('0x7f')]!==_0x4cfb('0xa6')){if(_0x2aff46[_0x4cfb('0x7f')]>0x0){_0x2aff46[_0x4cfb('0x7f')]-=0x1;}else{logger[_0x4cfb('0x63')](_0x4cfb('0x14f'));}}}else{logger[_0x4cfb('0x63')](_0x4cfb('0x150'));}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x151')]=function(_0x21c8ca,_0x2deff4){var _0x5b9fa8=this;return function(_0x570dd3){_0x5b9fa8[_0x4cfb('0xbe')](_0x2deff4);logger['error'](_0x21c8ca,util[_0x4cfb('0x42')](_0x570dd3,{'showHidden':![],'depth':null}));};};Dialer[_0x4cfb('0x18')][_0x4cfb('0x152')]=function(_0x3c326f,_0x155561,_0x5422de){var _0x40dad2={'state':0x19,'statedesc':_0x4cfb('0x153')};this[_0x4cfb('0xbe')](_0x155561);this['saveInDb'](_[_0x4cfb('0x5e')](_0x40dad2,_[_0x4cfb('0x74')](_0x5422de,[_0x4cfb('0xd8'),_0x4cfb('0xd9'),_0x4cfb('0x154'),_0x4cfb('0xda'),_0x4cfb('0xdb')])),_0x4cfb('0x155'),_0x4cfb('0x156'));logger[_0x4cfb('0x63')](_0x3c326f);};Dialer[_0x4cfb('0x18')][_0x4cfb('0x112')]=function(_0xdaef47,_0x427831,_0x3e5963){hopperUtils[_0x4cfb('0xc5')](_0xdaef47)[_0x4cfb('0x9f')](loggerCatch(_0x427831));hopperUtils['moveContactManagedDialer'](_0xdaef47)[_0x4cfb('0x9f')](loggerCatch(_0x3e5963));};Dialer['prototype'][_0x4cfb('0x157')]=function(_0x221e9d,_0x4c4cad){hopperUtils[_0x4cfb('0xc5')](_0x221e9d)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0xc6')));if(_0x4c4cad==0x0){hopperUtils['moveContactManagedDialer'](_0x221e9d)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x4cfb('0x18')]['checkPreviewRecallReminder']=function(_0x25bd37){return Promise[_0x4cfb('0x137')]()[_0x4cfb('0x3b')](cmHopper[_0x4cfb('0x142')](_0x25bd37['id'],previewRecallmeReminderInterval))[_0x4cfb('0x3b')](function(_0x577f1c){for(var _0x1bb6af=0x0;_0x1bb6af<_0x577f1c['length'];_0x1bb6af++){var _0xca2a40=_0x577f1c[_0x1bb6af][_0x4cfb('0x144')]['name'];if(_0xca2a40)io['to'](util[_0x4cfb('0x86')](_0x4cfb('0x145'),_0xca2a40))[_0x4cfb('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x577f1c[_0x1bb6af]});}})[_0x4cfb('0x9f')](function(){});};Dialer[_0x4cfb('0x18')][_0x4cfb('0xaa')]=function(_0x3fcbf0){var _0x43ddf2=this;return function(){_0x43ddf2['handleIvr'](_0x3fcbf0);};};Dialer[_0x4cfb('0x18')][_0x4cfb('0x158')]=function(_0x4e4c24,_0x5c5aa3){var _0x178169=this;var _0x4e03b5=uuid['v4']();this[_0x4cfb('0xeb')][_0x4e03b5]=new Action(_0x4e4c24,_0x5c5aa3,_0x4e03b5);return new Promise(function(_0x2380c9,_0x2c3c51){if(_[_0x4cfb('0x3d')](_0x4e4c24)&&typeof _0x4e4c24!==_0x4cfb('0x159')){return _0x2c3c51(msgResponse('originate','Failure',_0x4cfb('0x15a')));}if(_[_0x4cfb('0x3d')](_0x5c5aa3[_0x4cfb('0x15b')])||_0x5c5aa3[_0x4cfb('0x15b')]===null){return _0x2c3c51(msgResponse(_0x4cfb('0x15c'),_0x4cfb('0x90'),_0x4cfb('0x15d')));}var _0x3c3179={'XMD-CALLERID':_0x178169['actions'][_0x4e03b5][_0x4cfb('0x15e')](),'XMD-AGI':_0x4e4c24[_0x4cfb('0x12f')]?util['format'](_0x4cfb('0x15f'),ipAgi,_0x4e4c24[_0x4cfb('0x12f')]):_0x4cfb('0x160'),'XMD-AGIAFTER':_0x4e4c24[_0x4cfb('0xc3')]?util[_0x4cfb('0x86')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4e4c24[_0x4cfb('0xc3')]):_0x4cfb('0x160'),'XMD-QUEUE':utils[_0x4cfb('0x161')](_0x4e4c24)?util[_0x4cfb('0x86')](_0x4cfb('0x162'),_0x4e4c24[_0x4cfb('0x44')],_0x4e4c24[_0x4cfb('0x163')]||'',_0x4e4c24[_0x4cfb('0xc4')]?'c':'',_0x4e4c24['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x5c5aa3[_0x4cfb('0xd8')],'XMD-CDRTYPE':_0x4cfb('0x164'),'CALLERID(all)':_0x178169[_0x4cfb('0xeb')][_0x4e03b5][_0x4cfb('0x15e')](),'XMD-AMD':_0x4e4c24[_0x4cfb('0x125')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x4cfb('0x165')};if(_0x4e4c24[_0x4cfb('0x125')]){_0x3c3179['XMD-AMDINITIALSILENCE']=_0x4e4c24[_0x4cfb('0x166')]||0x9c4;_0x3c3179[_0x4cfb('0x167')]=_0x4e4c24['dialAMDGreeting']||0x5dc;_0x3c3179['XMD-AMDAFTERGREETINGSILENCE']=_0x4e4c24[_0x4cfb('0x168')]||0x320;_0x3c3179['XMD-AMDTOTALANALYSISTIME']=_0x4e4c24['dialAMDTotalAnalysisTime']||0x1388;_0x3c3179[_0x4cfb('0x169')]=_0x4e4c24[_0x4cfb('0x16a')]||0x64;_0x3c3179[_0x4cfb('0x16b')]=_0x4e4c24[_0x4cfb('0x16c')]||0x32;_0x3c3179[_0x4cfb('0x16d')]=_0x4e4c24[_0x4cfb('0x16e')]||0x3;_0x3c3179[_0x4cfb('0x16f')]=_0x4e4c24[_0x4cfb('0x170')]||0x100;_0x3c3179[_0x4cfb('0x171')]=_0x4e4c24[_0x4cfb('0x172')]||0x1388;}if(utils[_0x4cfb('0x161')](_0x4e4c24)){_0x3c3179[_0x4cfb('0x173')]=_0x5c5aa3[_0x4cfb('0xda')];}else{_0x3c3179['XMD-CAMPAIGNID']=_0x5c5aa3[_0x4cfb('0xdb')];}for(var _0x462f2c in _0x5c5aa3[_0x4cfb('0x174')]){if(typeof _0x5c5aa3['Contact'][_0x462f2c]!==_0x4cfb('0xa6')){if(isNotNull(_0x5c5aa3[_0x4cfb('0x174')][_0x462f2c])&&_0x462f2c!=='id'&&_0x462f2c!=='tags'&&_0x462f2c!==_0x4cfb('0x175')&&_0x462f2c!==_0x4cfb('0x176')){_0x3c3179[util[_0x4cfb('0x86')](_0x4cfb('0x177'),_0x4cfb('0x178'),_[_0x4cfb('0x179')](_0x462f2c))]=_0x5c5aa3[_0x4cfb('0x174')][_0x462f2c];}}}var _0x5cb860=_0x178169[_0x4cfb('0x84')](_0x4e4c24['Trunk'])?utils[_0x4cfb('0x17a')](_0x4e4c24[_0x4cfb('0x8b')][_0x4cfb('0x17b')],_0x4e4c24[_0x4cfb('0x17c')],_0x4e4c24[_0x4cfb('0x17d')]>0x0?utils['getCallerIdRandom'](_0x4e4c24[_0x4cfb('0x17e')],_0x4e4c24['dialRandomLastDigitCallerIdNumber']):_0x4e4c24[_0x4cfb('0x17e')]):utils[_0x4cfb('0x17a')](_[_0x4cfb('0xf3')](_0x4e4c24[_0x4cfb('0x8c')])?_0x4e4c24[_0x4cfb('0x8b')][_0x4cfb('0x17b')]:_0x4e4c24[_0x4cfb('0x8c')][_0x4cfb('0x17b')],_0x4e4c24[_0x4cfb('0x17c')],_0x4e4c24[_0x4cfb('0x17d')]>0x0?utils[_0x4cfb('0x17f')](_0x4e4c24[_0x4cfb('0x17e')],_0x4e4c24[_0x4cfb('0x17d')]):_0x4e4c24[_0x4cfb('0x17e')]);if(_0x5cb860){_0x3c3179[_0x4cfb('0x180')]=_0x178169[_0x4cfb('0xeb')][_0x4e03b5][_0x4cfb('0x181')]=utils['extractCalleridName'](_0x5cb860);_0x3c3179[_0x4cfb('0x182')]=_0x5c5aa3['phone'];}_0x4e4c24[_0x4cfb('0x183')]=_0x3c3179;return ami['Action']({'actionid':_0x4e03b5,'action':_0x4cfb('0x15c'),'channel':_0x178169[_0x4cfb('0x84')](_0x4e4c24[_0x4cfb('0x8b')])?util[_0x4cfb('0x86')]('SIP/%s/%s%s',_0x4e4c24[_0x4cfb('0x8b')][_0x4cfb('0x44')],isNotNull(_0x4e4c24[_0x4cfb('0x184')])?_0x4e4c24[_0x4cfb('0x184')]['trim']()||'':'',_0x4e4c24[_0x4cfb('0x185')]>0x0?_0x5c5aa3[_0x4cfb('0x15b')]['substring'](_0x4e4c24['dialCutDigit']):_0x5c5aa3[_0x4cfb('0x15b')]):util[_0x4cfb('0x86')](_0x4cfb('0x186'),_['isNil'](_0x4e4c24[_0x4cfb('0x8c')])?_0x4e4c24[_0x4cfb('0x8b')][_0x4cfb('0x44')]:_0x4e4c24[_0x4cfb('0x8c')][_0x4cfb('0x44')],isNotNull(_0x4e4c24[_0x4cfb('0x184')])?_0x4e4c24[_0x4cfb('0x184')][_0x4cfb('0x187')]()||'':'',_0x4e4c24[_0x4cfb('0x185')]>0x0?_0x5c5aa3[_0x4cfb('0x15b')][_0x4cfb('0x188')](_0x4e4c24[_0x4cfb('0x185')]):_0x5c5aa3['phone']),'callerid':_0x5cb860,'Exten':_0x4cfb('0x165'),'Context':_0x4cfb('0x189'),'Priority':'1','variable':_0x3c3179,'timeout':(_0x4e4c24[_0x4cfb('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e03b5})[_0x4cfb('0x3b')](function(_0x5a3ecb){return _0x2380c9(_0x5a3ecb);})['catch'](function(_0x3710a2){_0x4e4c24[_0x4cfb('0x18b')]+=0x1;var _0x264717=new History(_0x178169[_0x4cfb('0xeb')][_0x4e03b5]);logger[_0x4cfb('0x63')](util[_0x4cfb('0x86')](_0x4cfb('0x18c'),JSON['stringify'](_0x3710a2)));_0x264717[_0x4cfb('0x6d')]=0xe;_0x264717[_0x4cfb('0x6e')]=_0x4cfb('0x18d');_0x264717[_0x4cfb('0x70')]=moment()['format'](_0x4cfb('0xbf'));_0x264717['endtime']=_0x264717['starttime'];hopperUtils[_0x4cfb('0xc5')](_0x264717)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x18e')));_0x178169[_0x4cfb('0x12e')](_0x264717)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x18e')))['finally'](function(){delete _0x178169['actions'][_0x4e03b5];return _0x2c3c51(msgResponse(_0x4cfb('0x15c'),_0x4cfb('0x18f'),'originate\x20action\x20Error'));});});});};Dialer[_0x4cfb('0x18')][_0x4cfb('0x190')]=function(_0x361d2b,_0x3eacf2,_0x41252b){var _0x3f56d9=new History(_0x3eacf2);if(_0x3f56d9[_0x4cfb('0x119')]+_0x3f56d9[_0x4cfb('0x11a')]+_0x3f56d9[_0x4cfb('0x11b')]+_0x3f56d9[_0x4cfb('0x11c')]+_0x3f56d9[_0x4cfb('0xd0')]+_0x3f56d9['countabandonedretry']+_0x3f56d9['countmachineretry']+_0x3f56d9[_0x4cfb('0x11d')]>=_0x41252b[_0x4cfb('0x12a')]-0x1){return!![];}switch(_0x361d2b){case 0x3:if(_0x3f56d9['countnoanswerretry']>=_0x41252b[_0x4cfb('0x191')]-0x1){return!![];}hopperUtils[_0x4cfb('0xd5')]({'active':![],'countnoanswerretry':_0x3f56d9[_0x4cfb('0x11b')]+=0x1,'scheduledat':moment()[_0x4cfb('0xd6')](_0x41252b[_0x4cfb('0x192')],_0x4cfb('0xd7'))[_0x4cfb('0x86')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f56d9[_0x4cfb('0xd8')],'ListId':_0x3f56d9[_0x4cfb('0xd9')],'VoiceQueueId':_0x3f56d9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x3f56d9['CampaignId']||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x193')));break;case 0x5:if(_0x3f56d9[_0x4cfb('0x119')]>=_0x41252b['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3f56d9[_0x4cfb('0x119')]+=0x1,'scheduledat':moment()[_0x4cfb('0xd6')](_0x41252b[_0x4cfb('0x194')],_0x4cfb('0xd7'))[_0x4cfb('0x86')](_0x4cfb('0xbf')),'ContactId':_0x3f56d9['ContactId'],'ListId':_0x3f56d9[_0x4cfb('0xd9')],'VoiceQueueId':_0x3f56d9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x3f56d9[_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x195')));break;case 0x8:if(_0x3f56d9[_0x4cfb('0x11a')]>=_0x41252b['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x4cfb('0xd5')]({'active':![],'countcongestionretry':_0x3f56d9[_0x4cfb('0x11a')]+=0x1,'scheduledat':moment()[_0x4cfb('0xd6')](_0x41252b['dialCongestionRetryFrequency'],_0x4cfb('0xd7'))[_0x4cfb('0x86')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f56d9['ContactId'],'ListId':_0x3f56d9['ListId'],'VoiceQueueId':_0x3f56d9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x3f56d9['CampaignId']||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x196')));break;case 0x0:if(_0x3f56d9[_0x4cfb('0x11c')]>=_0x41252b[_0x4cfb('0x197')]-0x1){return!![];}else{hopperUtils[_0x4cfb('0xd5')]({'active':![],'countnosuchnumberretry':_0x3f56d9[_0x4cfb('0x11c')]+=0x1,'scheduledat':moment()[_0x4cfb('0xd6')](_0x41252b[_0x4cfb('0x198')],_0x4cfb('0xd7'))[_0x4cfb('0x86')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f56d9[_0x4cfb('0xd8')],'ListId':_0x3f56d9[_0x4cfb('0xd9')],'VoiceQueueId':_0x3f56d9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x3f56d9[_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3f56d9['countdropretry']>=_0x41252b[_0x4cfb('0x199')]-0x1){return!![];}hopperUtils[_0x4cfb('0xd5')]({'active':![],'countdropretry':_0x3f56d9[_0x4cfb('0xd0')]+=0x1,'scheduledat':moment()['add'](_0x41252b[_0x4cfb('0xd2')],_0x4cfb('0xd7'))[_0x4cfb('0x86')](_0x4cfb('0xbf')),'ContactId':_0x3f56d9[_0x4cfb('0xd8')],'ListId':_0x3f56d9[_0x4cfb('0xd9')],'VoiceQueueId':_0x3f56d9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x3f56d9[_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0xdc')));break;case 0xb:if(_0x3f56d9[_0x4cfb('0xe3')]>=_0x41252b[_0x4cfb('0xe7')]-0x1){return!![];}hopperUtils[_0x4cfb('0xd5')]({'active':![],'countabandonedretry':_0x3f56d9['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x41252b[_0x4cfb('0xe4')],_0x4cfb('0xd7'))[_0x4cfb('0x86')](_0x4cfb('0xbf')),'ContactId':_0x3f56d9['ContactId'],'ListId':_0x3f56d9[_0x4cfb('0xd9')],'VoiceQueueId':_0x3f56d9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x3f56d9[_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3f56d9[_0x4cfb('0x116')]>=_0x41252b['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x4cfb('0xd5')]({'active':![],'countmachineretry':_0x3f56d9[_0x4cfb('0x116')]+=0x1,'scheduledat':moment()[_0x4cfb('0xd6')](_0x41252b['dialMachineRetryFrequency'],_0x4cfb('0xd7'))['format'](_0x4cfb('0xbf')),'ContactId':_0x3f56d9[_0x4cfb('0xd8')],'ListId':_0x3f56d9[_0x4cfb('0xd9')],'VoiceQueueId':_0x3f56d9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x3f56d9[_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x124')));break;case 0x14:if(_0x3f56d9[_0x4cfb('0x11d')]>=_0x41252b[_0x4cfb('0x19a')]-0x1){return!![];}hopperUtils[_0x4cfb('0xd5')]({'active':![],'countagentrejectretry':_0x3f56d9['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x4cfb('0xd6')](_0x41252b[_0x4cfb('0x19b')],_0x4cfb('0xd7'))['format'](_0x4cfb('0xbf')),'ContactId':_0x3f56d9[_0x4cfb('0xd8')],'ListId':_0x3f56d9[_0x4cfb('0xd9')],'VoiceQueueId':_0x3f56d9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x3f56d9[_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x19c')));break;default:return!![];}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x106')]=function(_0x59622a,_0x2d7447,_0x25224f){var _0x137dcb=this;var _0x487576=new History(_0x59622a);var _0x3963e2=![];var _0x1d447d;var _0x3c7a20;return new Promise(function(_0x2e583c,_0x34e44e){if(_[_0x4cfb('0x3d')](_0x2d7447)&&typeof _0x2d7447!==_0x4cfb('0x159')){return _0x34e44e(msgResponse('[callProgressDetecting]',_0x4cfb('0x90'),_0x4cfb('0x19d')));}if(_[_0x4cfb('0x3d')](_0x25224f)&&typeof _0x25224f!==_0x4cfb('0x159')){return _0x34e44e(msgResponse(_0x4cfb('0x19e'),_0x4cfb('0x90'),'evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x487576,_0x25224f[_0x4cfb('0xc0')],_0x2d7447)[_0x4cfb('0x3b')](function(_0x1fb4cb){if(_0x1fb4cb[_0x4cfb('0xd4')]==0x1)_0x3963e2=!![];switch(_0x25224f['reason']){case'0':_0x2d7447[_0x4cfb('0x19f')]+=0x1;_0x487576[_0x4cfb('0x6d')]=0x0;_0x487576['statedesc']='NoSuchNumber';_0x487576['countnosuchnumberretry']+=0x1;_0x487576[_0x4cfb('0xd1')]+=0x1;ami[_0x4cfb('0x3e')](_0x4cfb('0x1a0'),ut['buildObj'](_0x59622a,_0x4cfb('0x1a1')));_0x1d447d=_0x2d7447[_0x4cfb('0x198')];_0x3c7a20=_0x2d7447[_0x4cfb('0xd3')];hopperUtils[_0x4cfb('0xc5')](_0x487576)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x118')));if(_0x137dcb[_0x4cfb('0x190')](0x0,_0x59622a,_0x2d7447)&&!_0x3963e2){if(_0x487576[_0x4cfb('0x11c')]>=_0x2d7447['dialNoSuchNumberMaxRetry']){_0x137dcb[_0x4cfb('0x121')](_0x487576,_0x2e583c,_0x34e44e,'reason\x200\x20no\x20such\x20number....');}else{_0x137dcb[_0x4cfb('0x11e')](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1a2'));}}break;case'3':_0x2d7447['outboundNoAnswerCallsDay']+=0x1;_0x487576[_0x4cfb('0x6d')]=0x3;_0x487576[_0x4cfb('0x6e')]=_0x4cfb('0x1a3');_0x487576[_0x4cfb('0x11b')]+=0x1;_0x487576['countglobal']+=0x1;var _0x4f6651=ut[_0x4cfb('0x1a4')](_0x59622a,_0x2d7447);ami[_0x4cfb('0x3e')](_0x4cfb('0x1a5'),_0x4f6651);_0x1d447d=_0x2d7447[_0x4cfb('0x192')];_0x3c7a20=_0x2d7447['callAdditionalPhoneAfterMin'];hopperUtils[_0x4cfb('0xc5')](_0x487576)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x1a6')));if(_0x137dcb['checkRetriveMax'](0x3,_0x59622a,_0x2d7447)&&!_0x3963e2){if(_0x487576['countnoanswerretry']>=_0x2d7447[_0x4cfb('0x191')]){_0x137dcb[_0x4cfb('0x121')](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1a7'));}else{_0x137dcb[_0x4cfb('0x11e')](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1a7'));}}break;case'5':_0x2d7447[_0x4cfb('0x1a8')]+=0x1;_0x487576[_0x4cfb('0x6d')]=0x5;_0x487576[_0x4cfb('0x6e')]=_0x4cfb('0x1a9');_0x487576['countbusyretry']+=0x1;_0x487576[_0x4cfb('0xd1')]+=0x1;ami[_0x4cfb('0x3e')](_0x4cfb('0x1aa'),ut[_0x4cfb('0x117')](_0x59622a,_0x4cfb('0x1ab')));_0x1d447d=_0x2d7447[_0x4cfb('0x194')];_0x3c7a20=_0x2d7447['callAdditionalPhoneAfterMin'];hopperUtils[_0x4cfb('0xc5')](_0x487576)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x1ac')));if(_0x137dcb[_0x4cfb('0x190')](0x5,_0x59622a,_0x2d7447)&&!_0x3963e2){if(_0x487576[_0x4cfb('0x119')]>=_0x2d7447[_0x4cfb('0x1ad')]){_0x137dcb[_0x4cfb('0x121')](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1ae'));}else{_0x137dcb['stateGlobal'](_0x487576,_0x2e583c,_0x34e44e,'reason\x205\x20busy');}}break;case'8':_0x2d7447['outboundCongestionCallsDay']+=0x1;_0x487576[_0x4cfb('0x6d')]=0x8;_0x487576['statedesc']=_0x4cfb('0x1af');_0x487576[_0x4cfb('0x11a')]+=0x1;_0x487576[_0x4cfb('0xd1')]+=0x1;_0x1d447d=_0x2d7447[_0x4cfb('0x1b0')];_0x3c7a20=_0x2d7447[_0x4cfb('0xd3')];ami['emit']('custom:agentcongestion',ut['buildObj'](_0x59622a,'congestion'));hopperUtils[_0x4cfb('0xc5')](_0x487576)[_0x4cfb('0x9f')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x137dcb[_0x4cfb('0x190')](0x8,_0x59622a,_0x2d7447)&&!_0x3963e2){if(_0x487576[_0x4cfb('0x11a')]>=_0x2d7447[_0x4cfb('0x1b1')]){_0x137dcb[_0x4cfb('0x121')](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1b2'));}else{_0x137dcb['stateGlobal'](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1b2'));}}break;case'11':_0x2d7447[_0x4cfb('0x1b3')]+=0x1;_0x487576[_0x4cfb('0x6d')]=0xb;_0x487576[_0x4cfb('0x6e')]=_0x4cfb('0xe1');_0x487576['countabandonedretry']+=0x1;_0x487576[_0x4cfb('0xd1')]+=0x1;_0x1d447d=_0x2d7447[_0x4cfb('0xe4')];_0x3c7a20=_0x2d7447[_0x4cfb('0xd3')];hopperUtils[_0x4cfb('0xc5')](_0x487576)['catch'](loggerCatch(_0x4cfb('0xe9')));if(_0x137dcb[_0x4cfb('0x190')](0xb,_0x59622a,_0x2d7447)&&!_0x3963e2){if(_0x487576[_0x4cfb('0xe3')]>=_0x2d7447['dialAbandonedMaxRetry']){_0x137dcb[_0x4cfb('0x121')](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1b4'));}else{_0x137dcb[_0x4cfb('0x11e')](_0x487576,_0x2e583c,_0x34e44e,'reason\x2011\x20abandoned');}}break;case'20':_0x2d7447[_0x4cfb('0x1b5')]+=0x1;_0x487576[_0x4cfb('0x6d')]=0x14;_0x487576[_0x4cfb('0x6e')]=_0x4cfb('0x1b6');_0x487576[_0x4cfb('0x11d')]+=0x1;_0x487576[_0x4cfb('0xd1')]+=0x1;_0x1d447d=_0x2d7447[_0x4cfb('0x19b')];_0x3c7a20=_0x2d7447[_0x4cfb('0xd3')];ami[_0x4cfb('0x3e')](_0x4cfb('0x1b7'),ut[_0x4cfb('0x117')](_0x59622a,'agentreject'));hopperUtils['createHistory'](_0x487576)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x1b8')));if(_0x137dcb['checkRetriveMax'](0x14,_0x59622a,_0x2d7447)&&!_0x3963e2){if(_0x487576[_0x4cfb('0x11d')]>=_0x2d7447[_0x4cfb('0x19a')]){_0x137dcb[_0x4cfb('0x121')](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1b9'));}else{_0x137dcb[_0x4cfb('0x11e')](_0x487576,_0x2e583c,_0x34e44e,_0x4cfb('0x1b9'));}}break;default:_0x2d7447[_0x4cfb('0x132')]+=0x1;_0x487576[_0x4cfb('0x6d')]=0xc;_0x487576['statedesc']=_0x25224f['reason'];_0x1d447d=_0x2d7447[_0x4cfb('0x19b')];_0x3c7a20=_0x2d7447[_0x4cfb('0xd3')];hopperUtils[_0x4cfb('0xc5')](_0x487576)[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x1ba')));if(_0x137dcb[_0x4cfb('0x190')](_0x25224f['reason'],_0x59622a,_0x2d7447)&&!_0x3963e2){if(_0x487576['countbusyretry']+_0x487576[_0x4cfb('0x11a')]+_0x487576[_0x4cfb('0x11b')]+_0x487576[_0x4cfb('0x11c')]+_0x487576[_0x4cfb('0xd0')]+_0x487576[_0x4cfb('0xe3')]+_0x487576[_0x4cfb('0x116')]+_0x487576[_0x4cfb('0x11d')]>=_0x2d7447[_0x4cfb('0x12a')]){_0x137dcb[_0x4cfb('0x11e')](_0x487576,_0x2e583c,_0x34e44e,_0x25224f[_0x4cfb('0xc0')]);}else{_0x137dcb[_0x4cfb('0x121')](_0x487576,_0x2e583c,_0x34e44e,_0x25224f[_0x4cfb('0xc0')]);}}}})[_0x4cfb('0x3b')](function(){if(_0x3963e2){hopperUtils[_0x4cfb('0xe0')](_0x487576,_0x1d447d,_0x3c7a20)[_0x4cfb('0x3b')](function(){return _0x2e583c(0x1);});}});});};Dialer[_0x4cfb('0x18')][_0x4cfb('0x11e')]=function(_0x5c07e1,_0x20d823,_0x307e7e,_0x2cfb36){var _0x3f7b68=new Final(_0x5c07e1);_0x3f7b68[_0x4cfb('0x6d')]=0xf;_0x3f7b68[_0x4cfb('0x6e')]=_0x4cfb('0x1bb');this[_0x4cfb('0x121')](_0x3f7b68,_0x20d823,_0x307e7e,_0x2cfb36);};Dialer['prototype']['createStateFinal']=function(_0x2bf5be,_0x37bc12,_0x4bd1ac,_0x104bbb){hopperUtils[_0x4cfb('0x12e')](_0x2bf5be)[_0x4cfb('0x3b')](function(){return _0x37bc12(msgResponse(_0x4cfb('0x19e'),_0x4cfb('0x105'),_0x104bbb));})[_0x4cfb('0x9f')](function(){return _0x4bd1ac(msgResponse(_0x4cfb('0x1bc'),_0x4cfb('0x90'),_0x4cfb('0x1bd')));});};Dialer[_0x4cfb('0x18')][_0x4cfb('0x6')]=function(_0x131424){var _0x400774=_0x131424[_0x4cfb('0x1be')]/0x64;var _0x5cec38=_0x131424['outboundDropCallsDayTimeout']/(_0x131424[_0x4cfb('0x1bf')]+_0x131424[_0x4cfb('0x10b')]);var _0x57667d=Math[_0x4cfb('0x1c0')](_0x131424[_0x4cfb('0x1c1')]*(_0x131424[_0x4cfb('0x1c2')]/0x64));var _0x6f291c=Math[_0x4cfb('0x1c0')](_0x131424[_0x4cfb('0x1c1')]*(_0x131424[_0x4cfb('0x1c3')]/0x64));var _0x5f04c3=_0x131424[_0x4cfb('0x138')]+_0x131424['talking'];var _0x115272=Math[_0x4cfb('0x1c4')](_0x131424['erlangCalls']*_0x131424[_0x4cfb('0x5b')]*_0x131424[_0x4cfb('0x1c5')]*_0x131424[_0x4cfb('0x1c6')]);if(_[_0x4cfb('0x3d')](_0x131424[_0x4cfb('0x26')])){if(!_['isUndefined'](_0x131424[_0x4cfb('0x25')])){_0x131424[_0x4cfb('0x25')]=undefined;loggerPredictive[_0x4cfb('0x63')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x4cfb('0x3d')](_0x131424[_0x4cfb('0x62')])){loggerPredictive[_0x4cfb('0x63')]('[startMethodPredictive][StartProgressive]',_0x4cfb('0x1c7'));clearInterval(_0x131424['handlePredictive']);_0x131424[_0x4cfb('0x62')]=undefined;}_0x131424[_0x4cfb('0x26')]=moment()['format'](_0x4cfb('0xbf'));loggerPredictive[_0x4cfb('0x46')](_0x131424['name'],'collection\x20data\x20in\x20progressive\x20at',_0x131424[_0x4cfb('0x26')]);this[_0x4cfb('0xaf')](_0x131424,0x1);}else if(ifInterval(_0x131424[_0x4cfb('0x1c8')],_0x131424[_0x4cfb('0x26')])){this[_0x4cfb('0xaf')](_0x131424,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x131424[_0x4cfb('0x26')],_0x131424[_0x4cfb('0x44')]);_0x131424[_0x4cfb('0x57')]=0x0;_0x131424[_0x4cfb('0xcc')]=0x0;}else if(_0x400774<_0x5cec38&&_0x131424[_0x4cfb('0x1c9')]===_0x4cfb('0x1ca')){clearPredictiveAttributes(_0x131424);loggerPredictive['info'](_0x4cfb('0x1cb'),_0x4cfb('0x1cc'),_0x5cec38,'startProgressive',_0x131424[_0x4cfb('0x44')]);}else if(_0x115272<_0x131424[_0x4cfb('0xcc')]&&_0x131424[_0x4cfb('0x1c9')]==='dropRate'){clearPredictiveAttributes(_0x131424);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x4cfb('0x1cd'),_0x115272,_0x4cfb('0x1ce'),_0x131424[_0x4cfb('0xcc')],_0x4cfb('0x26'),_0x131424['name']);}else if(!ifInterval(_0x131424['dialPredictiveInterval'],_0x131424['startProgressive'])&&_[_0x4cfb('0x3d')](_0x131424['startPredictive'])&&!_[_0x4cfb('0x3d')](_0x131424[_0x4cfb('0x26')])){_0x131424[_0x4cfb('0x25')]=moment()[_0x4cfb('0x86')](_0x4cfb('0xbf'));loggerPredictive[_0x4cfb('0x46')](_0x131424['name'],'started\x20in\x20predictive\x20at',_0x131424[_0x4cfb('0x25')]);hopperUtils[_0x4cfb('0x1cf')](_0x131424[_0x4cfb('0x1c8')])[_0x4cfb('0x3b')](this[_0x4cfb('0x1d0')](_0x131424))[_0x4cfb('0x3b')](mergeDataErlangB(_0x131424))[_0x4cfb('0x3b')](this[_0x4cfb('0x1d1')](_0x131424))[_0x4cfb('0x9f')](loggerCatchPredictive(_0x4cfb('0x1d2'),_0x131424));}else if(!ifInterval(_0x131424['dialPredictiveInterval'],_0x131424[_0x4cfb('0x25')])){_0x131424[_0x4cfb('0xcc')]=0x0;_0x131424[_0x4cfb('0x25')]=moment()[_0x4cfb('0x86')](_0x4cfb('0xbf'));loggerPredictive[_0x4cfb('0x46')](_0x131424[_0x4cfb('0x44')],_0x4cfb('0x1d3'),_0x131424['startPredictive']);clearInterval(_0x131424[_0x4cfb('0x62')]);_0x131424[_0x4cfb('0x62')]=undefined;hopperUtils['avgHandleTime'](_0x131424['dialPredictiveInterval'])[_0x4cfb('0x3b')](this[_0x4cfb('0x1d0')](_0x131424))[_0x4cfb('0x3b')](mergeDataErlangB(_0x131424))['then'](this['startMethodPredictive'](_0x131424))[_0x4cfb('0x9f')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x131424));}else if(_0x131424[_0x4cfb('0x1c1')]&&_0x5f04c3<_0x131424[_0x4cfb('0x1c1')]-_0x6f291c){clearPredictiveAttributes(_0x131424);loggerPredictive['info'](_0x131424[_0x4cfb('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5f04c3,_0x4cfb('0x1d4'),_0x131424[_0x4cfb('0x1c1')],'-',_0x6f291c,'=',_0x131424[_0x4cfb('0x1c1')]-_0x6f291c,')');}else if(_0x131424[_0x4cfb('0x1c1')]&&_0x5f04c3>_0x131424[_0x4cfb('0x1c1')]+_0x57667d){clearPredictiveAttributes(_0x131424);loggerPredictive[_0x4cfb('0x46')](_0x131424[_0x4cfb('0x44')],_0x4cfb('0x1d5'),_0x5f04c3,_0x4cfb('0x1d6'),_0x131424[_0x4cfb('0x1c1')],'+',_0x57667d,'=',_0x131424[_0x4cfb('0x1c1')]+_0x57667d,')');}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x1d0')]=function(_0x298d88){var _0x15b586=this;return function(_0x54501c){return new Promise(function(_0x43d0c1,_0x8b9080){_[_0x4cfb('0x5e')](_0x298d88,_0x54501c[0x0]);if(checkGetDataPredictive(_0x54501c[0x0])){var _0x33cf3c=_0x298d88[_0x4cfb('0x1c1')]=_0x298d88[_0x4cfb('0x139')]+_0x298d88[_0x4cfb('0x138')];var _0x55ac67=_0x298d88[_0x4cfb('0x1c8')]*0x3c;var _0x31a830=_0x54501c[0x0][_0x4cfb('0x4f')]+_0x54501c[0x0][_0x4cfb('0x4d')];var _0x237973=(_0x54501c[0x0][_0x4cfb('0x1d7')]+_0x54501c[0x0][_0x4cfb('0x4a')]+_0x54501c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x54501c[0x0][_0x4cfb('0x48')];_0x298d88['predictiveIntervalHitRate']=_0x237973>0x0?_0x237973:0x1;switch(_0x298d88[_0x4cfb('0x1c9')]){case _0x4cfb('0x1ca'):var _0x21b184=_0x298d88[_0x4cfb('0x1be')]/0x64;return _0x15b586[_0x4cfb('0x1d8')](_0x33cf3c,_0x55ac67,_0x31a830,_0x237973,_0x21b184)[_0x4cfb('0x3b')](function(_0x1c7695){return _0x43d0c1(_0x1c7695);});case _0x4cfb('0x1d9'):var _0x416e20=_0x298d88['dialPredictiveOptimizationPercentage']/0x64;return _0x15b586['busyFactor'](_0x33cf3c,_0x55ac67,_0x31a830,_0x237973,_0x416e20)[_0x4cfb('0x3b')](function(_0x393949){return _0x43d0c1(_0x393949);});default:return _0x8b9080(msgResponse(_0x4cfb('0x1da'),_0x4cfb('0x90'),'Unknown\x20Predictive'));}}else{return _0x8b9080(msgResponse(_0x4cfb('0x1da'),_0x4cfb('0x90'),_0x4cfb('0x1db')));}});};};Dialer[_0x4cfb('0x18')]['getDataPredictiveOld']=function(_0x559285){var _0x57cf60=this;return function(_0x44caa8){return new Promise(function(_0x453ea2,_0x1ed9e5){_[_0x4cfb('0x5e')](_0x559285,_0x44caa8[0x0]);if(checkGetDataPredictive(_0x44caa8[0x0])){loggerPredictive[_0x4cfb('0x46')](JSON['stringify'](_0x44caa8[0x0]));if(_0x559285[_0x4cfb('0x1c9')]==='dropRate'){return _0x57cf60['getVoiceQueueRtPauses'](_0x559285['id'])['then'](function(_0x9bfaaa){var _0x46646b=_0x559285[_0x4cfb('0x1dc')]-_0x9bfaaa[0x0]['outboundQueuePauses'];var _0x358181=_0x559285['dialPredictiveInterval']*0x3c;var _0x121f9c=_0x44caa8[0x0]['predictiveIntervalAvgTalktime']+_0x44caa8[0x0]['predictiveIntervalAvgHoldtime'];var _0x3d89ee=(_0x44caa8[0x0][_0x4cfb('0x1d7')]+_0x44caa8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x44caa8[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x44caa8[0x0]['predictiveIntervalTotalCalls'];var _0x15e4ec=_0x559285['dialPredictiveOptimizationPercentage']/0x64;_0x559285[_0x4cfb('0x1dd')]=_0x9bfaaa[0x0][_0x4cfb('0x1de')]||0x0;_0x559285['predictiveIntervalHitRate']=_0x3d89ee>0x0?_0x3d89ee:0x1;return _0x57cf60[_0x4cfb('0x1d8')](_0x46646b,_0x358181,_0x121f9c,_0x3d89ee,_0x15e4ec);})[_0x4cfb('0x3b')](function(_0x5b794e){return _0x453ea2(_0x5b794e);})[_0x4cfb('0x9f')](function(_0x375fa4){return _0x1ed9e5(msgResponse(_0x4cfb('0x1df'),'Failure',JSON[_0x4cfb('0x83')](_0x375fa4)));});}if(_0x559285[_0x4cfb('0x1c9')]===_0x4cfb('0x1d9')){return _0x57cf60[_0x4cfb('0x14d')](_0x559285['id'])['then'](function(_0x4c4919){var _0x172994=_0x559285[_0x4cfb('0x1dc')]-_0x4c4919[0x0][_0x4cfb('0x1de')];var _0x32ad26=_0x559285[_0x4cfb('0x1c8')]*0x3c;var _0x532b05=_0x44caa8[0x0][_0x4cfb('0x4f')]+_0x44caa8[0x0]['predictiveIntervalAvgHoldtime'];var _0x2a2cc3=(_0x44caa8[0x0]['predictiveIntervalAnsweredCalls']+_0x44caa8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x44caa8[0x0][_0x4cfb('0x4b')])/_0x44caa8[0x0][_0x4cfb('0x48')];var _0x33acfd=_0x559285['dialPredictiveOptimizationPercentage']/0x64;_0x559285[_0x4cfb('0x1dd')]=_0x4c4919[0x0]['outboundQueuePauses']||0x0;_0x559285[_0x4cfb('0x1c5')]=_0x2a2cc3>0x0?_0x2a2cc3:0x1;return _0x57cf60[_0x4cfb('0x1e0')](_0x172994,_0x32ad26,_0x532b05,_0x2a2cc3,_0x33acfd);})[_0x4cfb('0x3b')](function(_0x4484fd){return _0x453ea2(_0x4484fd);})[_0x4cfb('0x9f')](function(_0x1b5b2b){return _0x1ed9e5(msgResponse(_0x4cfb('0x1df'),'Failure',JSON['stringify'](_0x1b5b2b)));});}}else{return _0x1ed9e5(msgResponse(_0x4cfb('0x1da'),'Failure',_0x4cfb('0x1db')));}});};};Dialer[_0x4cfb('0x18')][_0x4cfb('0x1d1')]=function(_0x1fc0e2){var _0x2f28fb=this;return function(){var _0x2287fc=0x0;var _0x149422=Math[_0x4cfb('0x1c4')](_0x1fc0e2['erlangCallToSecond']*0x3e8);if(_0x149422>0x0){_0x149422=_0x149422<0x64?0x64:_0x149422;loggerPredictive[_0x4cfb('0x46')](_0x1fc0e2['name'],_0x4cfb('0x1e1'),_0x149422,_0x4cfb('0x1e2'));_0x1fc0e2[_0x4cfb('0x62')]=setInterval(function(){_0x2f28fb['handlePredictive'](_0x1fc0e2);loggerPredictiveCalls['info'](_0x4cfb('0x1e3'),_0x2287fc+=0x1);},_0x149422);}else{loggerPredictive[_0x4cfb('0x46')](_0x1fc0e2['name'],_0x4cfb('0x1e4'));}};};Dialer[_0x4cfb('0x18')]['checkContactBlack']=function(_0x2d093e,_0x540cb9){var _0x26960d=this;return function(_0x2f7232){if(_[_0x4cfb('0x92')](_0x2f7232)){if(_['isNil'](_0x540cb9[_0x4cfb('0x154')])||!_0x540cb9[_0x4cfb('0x1e5')]){if(_0x2d093e['dialMethod']==='booked'){_0x2d093e[_0x4cfb('0x71')]=_[_0x4cfb('0x3d')](_0x2d093e['queueStatusComplete'])?!![]:_0x2d093e[_0x4cfb('0x71')];var _0x361505=uuid['v4']();_0x26960d[_0x4cfb('0xeb')][_0x361505]=new Action(_0x2d093e,_0x540cb9,_0x361505);loggerBooked[_0x4cfb('0x46')]('[booked][checkContactBlack]',_0x361505,'queueStatusComplete:\x20',JSON[_0x4cfb('0x83')](_0x2d093e['queueStatusComplete']),_0x4cfb('0x1e6'),_0x2d093e['name']);if(_0x2d093e['queueStatusComplete']){_0x2d093e['queueStatusComplete']=![];_0x26960d[_0x4cfb('0x28')][_0x26960d[_0x4cfb('0xeb')][_0x361505]['queue']]=[];ami[_0x4cfb('0x14a')]({'actionid':_0x361505,'action':_0x4cfb('0x1e7'),'queue':_0x2d093e[_0x4cfb('0x44')]})[_0x4cfb('0x9f')](function(){_0x26960d[_0x4cfb('0xbe')](_0x2d093e);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x26960d[_0x4cfb('0xeb')][_0x361505][_0x4cfb('0xd8')],'ListId':_0x26960d[_0x4cfb('0xeb')][_0x361505][_0x4cfb('0xd9')],'VoiceQueueId':_0x26960d[_0x4cfb('0xeb')][_0x361505][_0x4cfb('0xda')]||undefined,'CampaignId':_0x26960d[_0x4cfb('0xeb')][_0x361505][_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x1e8')));delete _0x26960d[_0x4cfb('0xeb')][_0x361505];});}else{loggerBooked[_0x4cfb('0x46')](_0x4cfb('0x1e9'),JSON['stringify'](_0x2d093e['queueStatusComplete']),_0x4cfb('0x1e6'),_0x2d093e['name']);_0x26960d[_0x4cfb('0xbe')](_0x2d093e);hopperUtils[_0x4cfb('0xd5')]({'active':![],'ContactId':_0x26960d['actions'][_0x361505]['ContactId'],'ListId':_0x26960d[_0x4cfb('0xeb')][_0x361505][_0x4cfb('0xd9')],'VoiceQueueId':_0x26960d[_0x4cfb('0xeb')][_0x361505][_0x4cfb('0xda')]||undefined,'CampaignId':_0x26960d[_0x4cfb('0xeb')][_0x361505][_0x4cfb('0xdb')]||undefined})[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x1e8')));delete _0x26960d[_0x4cfb('0xeb')][_0x361505];}}else{return _0x26960d['actionOriginate'](_0x2d093e,_0x540cb9);}}else{if(utils[_0x4cfb('0x5f')](undefined,_0x540cb9[_0x4cfb('0x1ea')])<_0x2d093e[_0x4cfb('0x1eb')]*0x3c){if(_0x540cb9[_0x4cfb('0x144')]&&!_0x540cb9[_0x4cfb('0x144')]['voicePause']){_0x26960d['preview']['run'](_0x540cb9['id'])[_0x4cfb('0x1b')](function(){_0x26960d[_0x4cfb('0xbe')](_0x2d093e);});}else{hopperUtils[_0x4cfb('0x1ec')]({'active':![]},_0x540cb9['id'],0x1)[_0x4cfb('0x1b')](function(){_0x26960d[_0x4cfb('0xbe')](_0x2d093e);});}}else{_0x2d093e['outboundReCallsDay']+=0x1;_0x26960d['updateOriginated'](_0x2d093e);if(_0x2d093e[_0x4cfb('0x1ed')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x540cb9['ContactId'],'ListId':_0x540cb9[_0x4cfb('0xd9')],'VoiceQueueId':_0x540cb9[_0x4cfb('0xda')]||undefined,'CampaignId':_0x540cb9[_0x4cfb('0xdb')]||undefined})['catch'](loggerCatch(_0x4cfb('0x1ee')));hopperUtils[_0x4cfb('0xc5')](createObjHistory(_0x2d093e,_0x540cb9,utils[_0x4cfb('0x67')]['QUEUE_RECALL'],0x17,_0x4cfb('0x1ef')))['catch'](loggerCatch(_0x4cfb('0x1f0')));}else{_0x26960d[_0x4cfb('0x112')](createObjHistory(_0x2d093e,_0x540cb9,utils['CAMPAIGN_STATUS'][_0x4cfb('0x1f1')],0x16,_0x4cfb('0x1f2')),'[Originate][HistoryRecallClose][historyCatch]',_0x4cfb('0x1f3'));}}}}else{_0x2d093e['outboundBlacklistCallsDay']+=0x1;_0x26960d['saveInDb'](createObjHistory(_0x2d093e,_0x540cb9,utils['CAMPAIGN_STATUS'][_0x4cfb('0x1f4')],0xd,_0x4cfb('0x1f5')),_0x4cfb('0x1f6'),'[Originate][MoveBlacklist]');throw _0x4cfb('0x1f7');}};};Dialer[_0x4cfb('0x18')]['handleIvr']=function(_0x33d4ef){var _0x4803f8=this;var _0x47f028=_0x33d4ef[_0x4cfb('0x1f8')]-_0x33d4ef['originated']-_0x33d4ef[_0x4cfb('0x1f9')];emitCampaignSummary(_0x33d4ef);if(_0x47f028>0x0){if(_0x47f028>this['maxNumberOriginate']){_0x47f028=this[_0x4cfb('0x21')];}_0x33d4ef[_0x4cfb('0x1f9')]+=_0x47f028;hopperUtils[_0x4cfb('0x1fa')](_0x33d4ef['id'],_0x47f028,_0x33d4ef[_0x4cfb('0x1fb')],_0x33d4ef)[_0x4cfb('0x3b')](function(_0x1fa032){_0x33d4ef['temp']-=_0x47f028;_0x33d4ef['temp']=_0x33d4ef['temp']>0x0?_0x33d4ef[_0x4cfb('0x1f9')]:0x0;if(!utils[_0x4cfb('0x1fc')](_0x1fa032)){_0x33d4ef[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')]['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x33d4ef[_0x4cfb('0x44')]);}else{_0x33d4ef[_0x4cfb('0x7f')]+=_0x1fa032[_0x4cfb('0x97')];_0x33d4ef[_0x4cfb('0x66')]=utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x96ee03=0x0;_0x96ee03<_0x1fa032[_0x4cfb('0x97')];_0x96ee03+=0x1){_0x33d4ef[_0x4cfb('0x1fd')]+=0x1;if(_['isNil'](_0x1fa032[_0x96ee03])||_['isNil'](_0x1fa032[_0x96ee03][_0x4cfb('0x174')])||_[_0x4cfb('0xf3')](_0x1fa032[_0x96ee03][_0x4cfb('0x15b')])){_0x4803f8[_0x4cfb('0x152')]('[actionOriginate]\x20',_0x33d4ef,_0x1fa032[_0x96ee03]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x4cfb('0x74')](_0x1fa032[_0x96ee03],[_0x4cfb('0xdb'),'phone']))[_0x4cfb('0x3b')](_0x4803f8['checkContactBlack'](_0x33d4ef,_0x1fa032[_0x96ee03]))[_0x4cfb('0x9f')](_0x4803f8[_0x4cfb('0x151')](_0x4cfb('0x1fe'),_0x33d4ef));}}}})[_0x4cfb('0x9f')](loggerGetContactDialer('[getContactCampaign2]',_0x33d4ef,_0x47f028));}};Dialer[_0x4cfb('0x18')][_0x4cfb('0xaf')]=function(_0x5aded1,_0x3686c8){var _0x2c7aad=this;var _0x74f8d2=[];if(_0x3686c8<0x1||_0x5aded1[_0x4cfb('0xad')]===_0x4cfb('0xb1')){_0x3686c8=0x1;}var _0x1bc598=Math['floor'](_0x5aded1['available']*_0x3686c8)-_0x5aded1['originated']-_0x5aded1['temp'];if(_0x5aded1[_0x4cfb('0x1ff')]>0x0){var _0x4f34db=_0x5aded1[_0x4cfb('0x1ff')]-_0x5aded1[_0x4cfb('0x7f')]-_0x5aded1[_0x4cfb('0x139')]-_0x5aded1['temp']-_0x5aded1[_0x4cfb('0x13a')];if(_0x1bc598>_0x4f34db){_0x1bc598=_0x4f34db;}}if(_0x1bc598>0x0){if(_0x5aded1['dialMethod']===_0x4cfb('0xb1')){_0x1bc598=0x1;}if(_0x1bc598>this[_0x4cfb('0x21')]){_0x1bc598=this[_0x4cfb('0x21')];}_0x5aded1[_0x4cfb('0x1f9')]+=_0x1bc598;for(var _0xc4c85f in this[_0x4cfb('0x1f')]){if(typeof this['agents'][_0xc4c85f]!==_0x4cfb('0xa6')){if(this[_0x4cfb('0x1f')][_0xc4c85f][_0x4cfb('0x6d')]===_0x4cfb('0x200')&&this['agents'][_0xc4c85f][_0x4cfb('0x88')]===_0x4cfb('0x201')){_0x74f8d2['push'](this[_0x4cfb('0x1f')][_0xc4c85f]['id']);}}}hopperUtils[_0x4cfb('0x202')](_0x5aded1,_0x74f8d2,_0x1bc598)[_0x4cfb('0x3b')](function(_0x40c943){_0x5aded1[_0x4cfb('0x1f9')]-=_0x1bc598;_0x5aded1[_0x4cfb('0x1f9')]=_0x5aded1[_0x4cfb('0x1f9')]>0x0?_0x5aded1[_0x4cfb('0x1f9')]:0x0;if(!utils[_0x4cfb('0x1fc')](_0x40c943)){hopperUtils[_0x4cfb('0x203')](_0x5aded1)[_0x4cfb('0x3b')](sendMessageReschedule(_0x5aded1))[_0x4cfb('0x9f')](loggerCatch(_0x4cfb('0x204')));}else{_0x5aded1[_0x4cfb('0x7f')]+=_0x40c943['length'];_0x5aded1[_0x4cfb('0x66')]=_0x5aded1['dialMethod']===_0x4cfb('0xb1')?utils[_0x4cfb('0x67')][_0x4cfb('0x205')]:utils[_0x4cfb('0x67')][_0x4cfb('0x206')];for(var _0x386c73=0x0;_0x386c73<_0x40c943[_0x4cfb('0x97')];_0x386c73+=0x1){if(_[_0x4cfb('0xf3')](_0x40c943[_0x386c73])||_[_0x4cfb('0xf3')](_0x40c943[_0x386c73][_0x4cfb('0x174')])||_[_0x4cfb('0xf3')](_0x40c943[_0x386c73][_0x4cfb('0x15b')])){_0x2c7aad[_0x4cfb('0x152')]('[actionOriginate]\x20',_0x5aded1,_0x40c943[_0x386c73]);}else{hopperUtils[_0x4cfb('0x207')](_[_0x4cfb('0x74')](_0x40c943[_0x386c73],[_0x4cfb('0xda'),'phone']))[_0x4cfb('0x3b')](_0x2c7aad['checkContactBlack'](_0x5aded1,_0x40c943[_0x386c73]))['catch'](_0x2c7aad[_0x4cfb('0x151')]('[actionOriginate]\x20',_0x5aded1));}}}})[_0x4cfb('0x9f')](loggerGetContactDialer('[getContactDialer2]',_0x5aded1,_0x1bc598));}};Dialer[_0x4cfb('0x18')][_0x4cfb('0x62')]=function(_0x3629aa){if(_0x3629aa[_0x4cfb('0x1ff')]>0x0){var _0x91d798=_0x3629aa[_0x4cfb('0x1ff')]-_0x3629aa[_0x4cfb('0x7f')]-_0x3629aa['talking'];if(_0x91d798>0x0){this[_0x4cfb('0x208')](_0x3629aa);}else{loggerPredictiveCalls['info'](_0x4cfb('0x209'));}}else{this[_0x4cfb('0x208')](_0x3629aa);}};Dialer['prototype'][_0x4cfb('0x208')]=function(_0x2d7ded){var _0x1972b5=this;var _0x5d602c=[];_0x2d7ded[_0x4cfb('0x7f')]+=0x1;for(var _0x388049 in this[_0x4cfb('0x1f')]){if(typeof this[_0x4cfb('0x1f')][_0x388049]!==_0x4cfb('0xa6')){if(this[_0x4cfb('0x1f')][_0x388049][_0x4cfb('0x6d')]===_0x4cfb('0x200')&&this[_0x4cfb('0x1f')][_0x388049][_0x4cfb('0x88')]===_0x4cfb('0x201')){_0x5d602c[_0x4cfb('0x98')](this[_0x4cfb('0x1f')][_0x388049]['id']);}}}return this[_0x4cfb('0x202')](_0x2d7ded['id'],_0x5d602c,0x1,_0x2d7ded[_0x4cfb('0x1fb')],_0x2d7ded)[_0x4cfb('0x3b')](function(_0x15cc59){if(!utils[_0x4cfb('0x1fc')](_0x15cc59)){utils['checkContactLowerLimitOriginate'](_0x2d7ded,0x1,0x0);return hopperUtils[_0x4cfb('0x203')](_0x2d7ded)['then'](sendMessageReschedule(_0x2d7ded))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x2d7ded[_0x4cfb('0x66')]=utils[_0x4cfb('0x67')][_0x4cfb('0x206')];if(_[_0x4cfb('0xf3')](_0x15cc59[0x0])||_['isNil'](_0x15cc59[0x0][_0x4cfb('0x174')])||_['isNil'](_0x15cc59[0x0][_0x4cfb('0x15b')])){_0x1972b5[_0x4cfb('0x152')](_0x4cfb('0x20a'),_0x2d7ded,_0x15cc59[0x0]);}else{return hopperUtils[_0x4cfb('0x207')](_[_0x4cfb('0x74')](_0x15cc59[0x0],[_0x4cfb('0xda'),_0x4cfb('0x15b')]))[_0x4cfb('0x3b')](_0x1972b5[_0x4cfb('0x20b')](_0x2d7ded,_0x15cc59[0x0]))[_0x4cfb('0x9f')](_0x1972b5[_0x4cfb('0x151')](_0x4cfb('0x20c'),_0x2d7ded));}}})[_0x4cfb('0x9f')](loggerGetContactDialer(_0x4cfb('0x20d'),_0x2d7ded,0x1));};Dialer[_0x4cfb('0x18')][_0x4cfb('0x1d8')]=function(_0x2dfbd6,_0x10babd,_0x564b40,_0x514c8a,_0xdcd916,_0x25f2bd){loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x20e'));loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x20f'),_0x2dfbd6);loggerPredictive[_0x4cfb('0x46')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x10babd);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x210'),_0x564b40);loggerPredictive[_0x4cfb('0x46')]('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',_0x514c8a);loggerPredictive[_0x4cfb('0x46')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xdcd916);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x50'));return new Promise(function(_0x4ef151,_0x3731dc){if(_0x2dfbd6<=0x0||isNaN(_0x2dfbd6)){return _0x3731dc(msgResponse(_0x4cfb('0x211'),'Error',_0x4cfb('0x212')+_0x2dfbd6));}if(_0x564b40<=0x0||isNaN(_0x564b40)){return _0x3731dc(msgResponse('[abandonmentRate]',_0x4cfb('0x18f'),'Ts\x20=\x20'+_0x564b40));}if(_0x514c8a<=0x0||isNaN(_0x514c8a)){return _0x3731dc(msgResponse(_0x4cfb('0x211'),'Error',_0x4cfb('0x213')+_0x514c8a));}if(_0x10babd<=0x0||isNaN(_0x10babd)){return _0x3731dc(msgResponse(_0x4cfb('0x211'),'Error',_0x4cfb('0x214')+_0x10babd));}if(_0xdcd916<=0x0||isNaN(_0xdcd916)){return _0x3731dc(msgResponse(_0x4cfb('0x211'),_0x4cfb('0x18f'),_0x4cfb('0x215')+_0xdcd916));}_0x25f2bd=_0x25f2bd||0x0;var _0x47d746=0x1/_0x564b40;var _0x272f46=0x0;var _0x38198a=0x0;var _0x43a24f=0x0;var _0xbe127b=0x0;for(var _0x59fb93=0x0;_0x43a24f<_0xdcd916;_0x59fb93+=0x1){_0x38198a=_0x59fb93/_0x10babd;_0x272f46=(_0x514c8a*_0x38198a+_0x25f2bd)/_0x47d746;_0x43a24f=utils[_0x4cfb('0x216')](_0x272f46,_0x2dfbd6);_0xbe127b=_0x272f46/_0x2dfbd6*(0x1-utils[_0x4cfb('0x216')](_0x272f46,_0x2dfbd6));}return _0x4ef151({'erlangCalls':_0x59fb93,'erlangCallToSecond':_0x10babd/_0x59fb93,'erlangAbandonmentRate':_0x43a24f,'erlangBusyFactor':_0xbe127b});});};Dialer[_0x4cfb('0x18')]['busyFactor']=function(_0x1013f4,_0x86333e,_0x28b347,_0xa6399f,_0x9e24a2,_0x4c0f51){loggerPredictive['info'](_0x4cfb('0x217'));loggerPredictive['info']('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',_0x1013f4);loggerPredictive['info'](_0x4cfb('0x218'),_0x86333e);loggerPredictive[_0x4cfb('0x46')](_0x4cfb('0x210'),_0x28b347);loggerPredictive['info'](_0x4cfb('0x219'),_0xa6399f);loggerPredictive[_0x4cfb('0x46')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9e24a2);loggerPredictive['info'](_0x4cfb('0x50'));return new Promise(function(_0x224c31,_0x497b92){if(_0x1013f4<=0x0||isNaN(_0x1013f4)){return _0x497b92(msgResponse(_0x4cfb('0x21a'),_0x4cfb('0x18f'),_0x4cfb('0x212')+_0x1013f4));}if(_0x28b347<=0x0||isNaN(_0x28b347)){return _0x497b92(msgResponse(_0x4cfb('0x21a'),'Error',_0x4cfb('0x21b')+_0x28b347));}if(_0xa6399f<=0x0||isNaN(_0xa6399f)){return _0x497b92(msgResponse(_0x4cfb('0x21a'),_0x4cfb('0x18f'),'p\x20=\x20'+_0xa6399f));}if(_0x86333e<=0x0||isNaN(_0x86333e)){return _0x497b92(msgResponse(_0x4cfb('0x21a'),_0x4cfb('0x18f'),_0x4cfb('0x214')+_0x86333e));}if(_0x9e24a2<=0x0||isNaN(_0x9e24a2)){return _0x497b92(msgResponse(_0x4cfb('0x21a'),_0x4cfb('0x18f'),_0x4cfb('0x21c')+_0x9e24a2));}_0x4c0f51=_0x4c0f51||0x0;var _0x5c9a77=0x1/_0x28b347;var _0x248964=0x0;var _0x3747e5=0x0;var _0x248b74=0x0;var _0x1c6055=0x0;for(var _0x2afd83=0x0;_0x1c6055<_0x9e24a2;_0x2afd83+=0x1){_0x3747e5=_0x2afd83/_0x86333e;_0x248964=(_0xa6399f*_0x3747e5+_0x4c0f51)/_0x5c9a77;_0x248b74=utils[_0x4cfb('0x216')](_0x248964,_0x1013f4);_0x1c6055=_0x248964/_0x1013f4*(0x1-utils['erlangb'](_0x248964,_0x1013f4));}return _0x224c31({'erlangCalls':_0x2afd83,'erlangCallToSecond':_0x86333e/_0x2afd83,'erlangAbandonmentRate':_0x248b74,'erlangBusyFactor':_0x1c6055});});};module[_0x4cfb('0x21d')]=Dialer; \ No newline at end of file +var _0xfc2e=['isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','some','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','syncCampaigns','isIVRCampaign','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','silly','Dialer::ifTime()','intervalIftime','[ifTime][promiseAll]','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','ivr','outboundAnswerCallsDay','reason','agent','dialQueueProject2','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','state','Drop','dropreason','countdropretry','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','idHopper','[Catch][Preview][syncQueueStatusComplete]','rrmemory','_rr','unlockRR','Agent:\x20','run','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','resolve','available','inUse','talking','[syncQueueSummary]','compareToOutboundQueue','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[actions]','undefined','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','user:dialPreviewRecallReminder','actionOriginate','object','phone','originate','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','getCaller','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','dialOriginateTimeout','[originateError]:\x20%s','endtime','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[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]','predictiveIntervalErlangCallsDroppedCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','getContactDialer','countReScheduled','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','p\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]','Umin\x20=\x20','exports','util','lodash','moment','ioredis','./utils','./utils/hopper','dialer','../../../config/logger','booked','predictive','predictiveCalls','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','uniqueId','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','emit','type','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','format','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','stringify'];(function(_0x58408c,_0x24d968){var _0x3b30e6=function(_0x15a2f1){while(--_0x15a2f1){_0x58408c['push'](_0x58408c['shift']());}};_0x3b30e6(++_0x24d968);}(_0xfc2e,0x192));var _0xefc2=function(_0x13570f,_0x13a01a){_0x13570f=_0x13570f-0x0;var _0x553e97=_0xfc2e[_0x13570f];return _0x553e97;};'use strict';var util=require(_0xefc2('0x0'));var _=require(_0xefc2('0x1'));var uuid=require('uuid');var moment=require(_0xefc2('0x2'));var rr=require('rr');var Redis=require(_0xefc2('0x3'));var utils=require(_0xefc2('0x4'));var hopperUtils=require(_0xefc2('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0xefc2('0x6'));var loggerBooked=require(_0xefc2('0x7'))(_0xefc2('0x8'));var loggerPredictive=require(_0xefc2('0x7'))(_0xefc2('0x9'));var loggerPredictiveCalls=require(_0xefc2('0x7'))(_0xefc2('0xa'));var loggerSyncQueueSummary=require(_0xefc2('0x7'))('syncQueueSummary');var ami=require(_0xefc2('0xb'));config[_0xefc2('0xc')]=_['defaults'](config[_0xefc2('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xefc2('0xd'))(new Redis(config[_0xefc2('0xc')]));var cmHopper=require(_0xefc2('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xefc2('0xf'));var Interval=require(_0xefc2('0x10'));var Action=require(_0xefc2('0x11'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xefc2('0x12'));var Hangup=require(_0xefc2('0x13'));var ipAgi=process[_0xefc2('0x14')][_0xefc2('0x15')]||_0xefc2('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xefc2('0x17')][_0xefc2('0x18')]=function(_0x365d91){this['tail']=this[_0xefc2('0x19')]?this[_0xefc2('0x19')][_0xefc2('0x1a')](_0x365d91):_0x365d91();};function Dialer(_0x1bb3b5,_0x4f0574){this[_0xefc2('0x1b')]=new Sequence();this[_0xefc2('0x1c')]=_0x4f0574;this[_0xefc2('0x1d')]=_0x1bb3b5[_0xefc2('0x1d')];this[_0xefc2('0x1e')]=_0x1bb3b5[_0xefc2('0x1e')];this[_0xefc2('0x1f')]=_0x1bb3b5[_0xefc2('0x1f')];this[_0xefc2('0x20')]=_0x1bb3b5[_0xefc2('0x20')];this[_0xefc2('0x21')]=config[_0xefc2('0x21')]||0x2;this['channels']={};this[_0xefc2('0x22')]={};this['contactsId']={};this[_0xefc2('0x23')]={};this['optionPredictive']={};this['startPredictive']={};this[_0xefc2('0x24')]={};this[_0xefc2('0x25')]={};this[_0xefc2('0x26')]={};this[_0xefc2('0x27')]={};this[_0xefc2('0x28')]={};ami['on'](_0xefc2('0x29'),this[_0xefc2('0x2a')][_0xefc2('0x2b')](this));ami['on'](_0xefc2('0x2c'),this[_0xefc2('0x2d')][_0xefc2('0x2b')](this));ami['on'](_0xefc2('0x2e'),this['syncOriginateResponse'][_0xefc2('0x2b')](this));ami['on'](_0xefc2('0x2f'),this['syncAgentComplete'][_0xefc2('0x2b')](this));ami['on'](_0xefc2('0x30'),this[_0xefc2('0x31')]['bind'](this));ami['on'](_0xefc2('0x32'),this[_0xefc2('0x33')][_0xefc2('0x2b')](this));ami['on'](_0xefc2('0x34'),this[_0xefc2('0x35')][_0xefc2('0x2b')](this));ami['on'](_0xefc2('0x36'),this[_0xefc2('0x37')][_0xefc2('0x2b')](this));ami['on']('varset',this[_0xefc2('0x38')][_0xefc2('0x2b')](this));ami['on']('queuemember',this[_0xefc2('0x39')][_0xefc2('0x2b')](this));ami['on'](_0xefc2('0x3a'),this[_0xefc2('0x3b')][_0xefc2('0x2b')](this));this[_0xefc2('0x3c')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()['then'](function(_0x3ebf6f){previewRecallmeReminderInterval=_0x3ebf6f['previewRecallmeReminderInterval'];});}function isNotNull(_0x598569){return _0x598569!==null&&!_['isUndefined'](_0x598569);}function msgResponse(_0x4169f9,_0x7f84e4,_0x1a7703){return{'action':_0x4169f9,'response':_0x7f84e4,'message':_0x1a7703,'stack':_0x1a7703};}function emit(_0x1b1e9f,_0x39400a,_0x31f060){io['to'](_0x1b1e9f)[_0xefc2('0x3d')](_0x39400a,_0x31f060);}function emitOutboundVoiceQueueSummary(_0xb91bcf){if(_0xb91bcf[_0xefc2('0x3e')]==='outbound'){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xefc2('0x3f')](_0xb91bcf,{'showHidden':![],'depth':null}));emit(util['format'](_0xefc2('0x40'),_0xb91bcf[_0xefc2('0x41')]),_0xefc2('0x42'),_0xb91bcf);}}function checkGetDataPredictive(_0x222eb6){if(isNotNull(_0x222eb6)&&!_[_0xefc2('0x43')](_0x222eb6)){loggerPredictive[_0xefc2('0x44')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xefc2('0x44')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x222eb6[_0xefc2('0x45')]);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x46'),_0x222eb6[_0xefc2('0x47')]);loggerPredictive[_0xefc2('0x44')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x222eb6['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x48'),_0x222eb6[_0xefc2('0x49')]);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x4a'),_0x222eb6[_0xefc2('0x4b')]);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x4c'),_0x222eb6['predictiveIntervalAvgTalktime']);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x4d'));if(_0x222eb6[_0xefc2('0x45')]>0x0){if(!_[_0xefc2('0x4e')](_0x222eb6[_0xefc2('0x4f')])&&_0x222eb6[_0xefc2('0x4f')]>0x0){return!![];}loggerPredictive['info'](_0xefc2('0x50'));if(!_[_0xefc2('0x4e')](_0x222eb6[_0xefc2('0x4b')])&&_0x222eb6[_0xefc2('0x4b')]>0x0){return!![];}loggerPredictive['info'](_0xefc2('0x51'));}else{loggerPredictive[_0xefc2('0x44')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xefc2('0x44')](_0xefc2('0x52'));}return![];}function mergeDataErlangB(_0x2ce8f1){return function(_0x21f644){loggerPredictive[_0xefc2('0x44')](_0xefc2('0x53'));loggerPredictive[_0xefc2('0x44')](_0xefc2('0x54'),_0x21f644[_0xefc2('0x55')]);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x56'),_0x21f644[_0xefc2('0x57')]);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x58'),_0x21f644[_0xefc2('0x59')]);loggerPredictive['info'](_0xefc2('0x5a'),_0x21f644[_0xefc2('0x5b')]);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x58'),_0x21f644['erlangAbandonmentRate']);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x4d'));_[_0xefc2('0x5c')](_0x2ce8f1,_0x21f644);};}function ifInterval(_0x3c71bd,_0xeb0baf){if(_[_0xefc2('0x4e')](_0xeb0baf)){return![];}return utils[_0xefc2('0x5d')](undefined,_0xeb0baf)<_0x3c71bd*0x3c;}function clearPredictiveAttributes(_0x26e331){if(_0x26e331[_0xefc2('0x24')]){_0x26e331[_0xefc2('0x24')]=undefined;loggerPredictive[_0xefc2('0x5e')](_0x26e331[_0xefc2('0x41')],_0xefc2('0x5f'));}if(_0x26e331[_0xefc2('0x60')]){_0x26e331['startPredictive']=undefined;loggerPredictive[_0xefc2('0x5e')](_0x26e331[_0xefc2('0x41')],_0xefc2('0x61'));}if(_0x26e331[_0xefc2('0x62')]){clearInterval(_0x26e331[_0xefc2('0x62')]);_0x26e331['handlePredictive']=undefined;loggerPredictive[_0xefc2('0x5e')](_0x26e331[_0xefc2('0x41')],_0xefc2('0x63'));}}function loggerCatchPredictive(_0xbcc9ee,_0x137b4a){return function(_0x1ac44d){loggerPredictive[_0xefc2('0x64')](_0x137b4a[_0xefc2('0x41')],_0xbcc9ee);loggerPredictive['error'](_0x1ac44d[_0xefc2('0x65')]);clearPredictiveAttributes(_0x137b4a);};}function loggerCatch(_0x12f21d){return function(_0x14cdfd){logger[_0xefc2('0x64')](_0x12f21d,util[_0xefc2('0x3f')](_0x14cdfd,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1f4462,_0x51d3db,_0x3468da){return function(_0x104d56){utils[_0xefc2('0x66')](_0x51d3db,_0x3468da,0x0);logger[_0xefc2('0x64')](_0x1f4462,util['inspect'](_0x104d56,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3a5501){return function(_0x5e6690){if(isNotNull(_0x5e6690)&&isNotNull(_0x5e6690[0x0])){if(_0x5e6690[0x0][_0xefc2('0x67')]>0x0){_0x3a5501['message']=utils[_0xefc2('0x68')][_0xefc2('0x69')];logger[_0xefc2('0x44')](_0xefc2('0x6a')+_0x3a5501[_0xefc2('0x41')],_0x5e6690[0x0][_0xefc2('0x67')],_0xefc2('0x6b'));}else{_0x3a5501[_0xefc2('0x6c')]=utils[_0xefc2('0x68')][_0xefc2('0x6d')];logger[_0xefc2('0x44')](_0xefc2('0x6e')+_0x3a5501[_0xefc2('0x41')]);}}};}function createObjHistory(_0x3789e7,_0x4dba3a,_0x536d30,_0x22c795,_0x341260){_0x3789e7['message']=_0x536d30;var _0x2bd38c=new Action(_0x3789e7,_0x4dba3a);var _0x81d160=new History(_0x2bd38c);_0x81d160['state']=_0x22c795;_0x81d160[_0xefc2('0x6f')]=_0x341260;_0x81d160['endtime']=_0x2bd38c[_0xefc2('0x70')];return _0x81d160;}function unlockQueueStatus(_0x2fd588,_0x35c946){setTimeout(function(){if(_[_0xefc2('0x4e')](_0x2fd588[_0xefc2('0x71')])){loggerBooked[_0xefc2('0x64')](_0xefc2('0x72'),_0x35c946);}_0x2fd588[_0xefc2('0x71')]=!![];loggerBooked[_0xefc2('0x44')](_0xefc2('0x73'),_0x35c946,JSON['stringify'](_[_0xefc2('0x74')](_0x2fd588,[_0xefc2('0x41'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x343185){return function(){if(!isNotNull(_0x343185[_0xefc2('0x75')])){_0x343185[_0xefc2('0x6c')]=utils[_0xefc2('0x68')][_0xefc2('0x76')];throw _0x343185[_0xefc2('0x41')]+_0xefc2('0x77');}if(!isNotNull(_0x343185['Interval'][_0xefc2('0x78')])){_0x343185[_0xefc2('0x6c')]=utils[_0xefc2('0x68')][_0xefc2('0x76')];throw _0x343185[_0xefc2('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x343185['Interval']['Intervals']))){_0x343185[_0xefc2('0x6c')]=utils['CAMPAIGN_STATUS'][_0xefc2('0x76')];throw _0x343185[_0xefc2('0x41')]+_0xefc2('0x77');}};}function checkIsIVRCampaignActive(_0x4fff6e){return function(){if(!utils[_0xefc2('0x79')](_0x4fff6e)){_0x4fff6e[_0xefc2('0x6c')]=utils[_0xefc2('0x68')]['INACTIVE'];throw _0x4fff6e[_0xefc2('0x41')]+_0xefc2('0x7a');}};}function emitCampaignSummary(_0x24ed12){if(utils['isIVRCampaign'](_0x24ed12)){emit(util[_0xefc2('0x7b')](_0xefc2('0x7c'),_0x24ed12[_0xefc2('0x41')]),_0xefc2('0x7d'),_0x24ed12);}}function loggerCatchQueueSummary(_0x25cf28,_0xf99fbc){return function(_0x1f0b46){clearPredictiveAttributes(_0xf99fbc);emitCampaignSummary(_0xf99fbc);loggerSyncQueueSummary['debug'](_0x25cf28,util['inspect'](_0x1f0b46,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4bdf6b){if(_0x4bdf6b['sendMessageOneNotActive']){if(_0x4bdf6b[_0xefc2('0x7e')]===0x0){_0x4bdf6b[_0xefc2('0x7f')]=![];_0x4bdf6b[_0xefc2('0x6c')]=utils['CAMPAIGN_STATUS'][_0xefc2('0x80')];loggerSyncQueueSummary[_0xefc2('0x5e')](_0xefc2('0x81'),_0x4bdf6b[_0xefc2('0x41')],_0xefc2('0x82'));}else{_0x4bdf6b['message']=utils[_0xefc2('0x68')][_0xefc2('0x83')];loggerSyncQueueSummary[_0xefc2('0x5e')](_0xefc2('0x81'),_0x4bdf6b[_0xefc2('0x41')],_0xefc2('0x84'));}emitCampaignSummary(_0x4bdf6b);}}function myreject(_0x5777b7){return function(_0x4fcaae){return _0x5777b7(msgResponse(_0xefc2('0x85'),_0xefc2('0x86'),JSON[_0xefc2('0x87')](_0x4fcaae)));};}Dialer['prototype'][_0xefc2('0x88')]=function(_0x2d869f){return!_[_0xefc2('0x4e')](_0x2d869f)&&_0x2d869f&&!_['isUndefined'](_0x2d869f[_0xefc2('0x41')])&&!_[_0xefc2('0x4e')](_0x2d869f[_0xefc2('0x89')])&&_0x2d869f['active']&&(this[_0xefc2('0x20')][util[_0xefc2('0x7b')](_0xefc2('0x8a'),_0x2d869f[_0xefc2('0x41')])][_0xefc2('0x8b')]===_0xefc2('0x8c')||this['trunks'][util[_0xefc2('0x7b')](_0xefc2('0x8a'),_0x2d869f['name'])][_0xefc2('0x8b')]===_0xefc2('0x8d'));};Dialer[_0xefc2('0x17')][_0xefc2('0x8e')]=function(_0x11b8ba){var _0x45b4fb=this;return function(){if(!_0x45b4fb['isTrunkReachable'](_0x11b8ba[_0xefc2('0x8f')])){if(!_0x45b4fb[_0xefc2('0x88')](_0x11b8ba[_0xefc2('0x90')])){_0x11b8ba[_0xefc2('0x6c')]=utils['CAMPAIGN_STATUS'][_0xefc2('0x91')];throw _0x11b8ba[_0xefc2('0x41')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xefc2('0x17')][_0xefc2('0x92')]=function(_0x61206c,_0x1c74cb,_0x366a9e,_0x1a2d82){var _0x8812e9=this;return function(){var _0x257e35=!![];return _0x8812e9[_0xefc2('0x93')](_0x61206c,_0x1c74cb,_0x366a9e,_0x1a2d82,_0x257e35);};};Dialer[_0xefc2('0x17')][_0xefc2('0x94')]=function(_0x565723,_0x45f484,_0x11ef35,_0x1fe0ce){var _0x5e24c4=this;return function(){var _0x460c74=![];return _0x5e24c4[_0xefc2('0x93')](_0x565723[_0xefc2('0x78')],_0x45f484,_0x11ef35,_0x1fe0ce,_0x460c74);};};Dialer[_0xefc2('0x17')][_0xefc2('0x93')]=function(_0x295151,_0x5c4134,_0x2e5e79,_0x403150,_0x3d3342){var _0x4b48ad=[];return new Promise(function(_0xea725f,_0x1ae01b){if(!isNotNull(_0x295151)){_0x403150['message']=utils[_0xefc2('0x68')][_0xefc2('0x76')];return _0x1ae01b(msgResponse(_0xefc2('0x95'),_0xefc2('0x96'),_0x2e5e79+_0xefc2('0x97')));}if(_[_0xefc2('0x43')](_0x295151)){_0x403150['message']=utils['CAMPAIGN_STATUS'][_0xefc2('0x98')];return _0x1ae01b(msgResponse('ifTime','Failure',_0x2e5e79+'\x20Intervals\x20is\x20empty\x20'));}if(_0x5c4134&&_[_0xefc2('0x4e')](config[_0xefc2('0x99')][_0x5c4134])){_0x403150['message']=utils[_0xefc2('0x68')][_0xefc2('0x9a')];return _0x1ae01b(msgResponse(_0xefc2('0x95'),_0xefc2('0x96'),_0x2e5e79+_0xefc2('0x9b')+_0x5c4134));}if(_[_0xefc2('0x9c')](_0x295151)){for(var _0x9dde60=0x0;_0x9dde60<_0x295151[_0xefc2('0x9d')];_0x9dde60+=0x1){_0x4b48ad[_0xefc2('0x9e')](ami[_0xefc2('0x9f')]({'action':_0xefc2('0xa0'),'command':util[_0xefc2('0x7b')](_0xefc2('0xa1'),_0x295151[_0x9dde60][_0xefc2('0xa2')],!_[_0xefc2('0x4e')](config[_0xefc2('0x99')][_0x5c4134])?_0x5c4134:'')})[_0xefc2('0xa3')](function(_0x4ac36c){return _0x4ac36c[_0xefc2('0xa4')][_0xefc2('0xa5')](_0xefc2('0xa6'))>=0x0;})[_0xefc2('0xa7')](myreject(_0x1ae01b)));}}else{_0x4b48ad[_0xefc2('0x9e')](ami[_0xefc2('0x9f')]({'action':'command','command':util[_0xefc2('0x7b')](_0xefc2('0xa1'),_0x295151,!_[_0xefc2('0x4e')](config[_0xefc2('0x99')][_0x5c4134])?_0x5c4134:'')})[_0xefc2('0xa3')](function(_0x299bb6){return _0x299bb6[_0xefc2('0xa4')][_0xefc2('0xa5')](_0xefc2('0xa6'))>=0x0;})['catch'](myreject(_0x1ae01b)));}Promise['all'](_0x4b48ad)[_0xefc2('0xa3')](function(_0x3d510e){var _0x39b162=_[_0xefc2('0xa8')](_0x3d510e);if(_0x39b162){return _0xea725f(_0x39b162);}else{_0x403150['message']=_0x3d3342?utils[_0xefc2('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xefc2('0x68')][_0xefc2('0xa9')];return _0x1ae01b(msgResponse('[ifTime][promiseAll]','Failure',_0xefc2('0xaa')+_0x3d3342+'\x20'+_0x2e5e79+_0xefc2('0xab')+util[_0xefc2('0x3f')](_0x295151,{'showHidden':![],'depth':null})+_0xefc2('0xac')+_0x5c4134));}})[_0xefc2('0xa7')](function(_0x44e8dd){return _0x1ae01b(msgResponse(_0xefc2('0x95'),_0xefc2('0x96'),JSON[_0xefc2('0x87')](_0x44e8dd)));});});};Dialer[_0xefc2('0x17')][_0xefc2('0x3c')]=function(){var _0x22b334=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xefc2('0xa3')](function(){setInterval(function(){_0x22b334['syncCampaigns']();},0x3e8);});};Dialer[_0xefc2('0x17')][_0xefc2('0xad')]=function(){var _0xc9aacc=this;var _0x47d63f;for(var _0x3f45e5 in this[_0xefc2('0x1e')]){if(typeof this[_0xefc2('0x1e')][_0x3f45e5]!=='undefined'){_0x47d63f=this[_0xefc2('0x1e')][_0x3f45e5];if(utils[_0xefc2('0xae')](_0x47d63f)&&utils[_0xefc2('0x79')](_0x47d63f)){_0x47d63f[_0xefc2('0x7f')]=!![];Promise['resolve']()[_0xefc2('0xa3')](checkIsIVRCampaignActive(_0x47d63f))[_0xefc2('0xa3')](checkInterval(_0x47d63f))[_0xefc2('0xa3')](_0xc9aacc[_0xefc2('0x8e')](_0x47d63f))[_0xefc2('0xa3')](_0xc9aacc[_0xefc2('0x92')](_0x47d63f[_0xefc2('0xaf')],_0x47d63f['dialTimezone'],_0x47d63f['name'],_0x47d63f))['then'](_0xc9aacc['checkIfTimeIntervals'](_0x47d63f['Interval'],_0x47d63f[_0xefc2('0xb0')],_0x47d63f[_0xefc2('0x41')],_0x47d63f))['then'](_0xc9aacc[_0xefc2('0xb1')](_0x47d63f))['catch'](loggerCatchQueueSummary(_0xefc2('0xb2'),_0x47d63f));}else{notSendMessagesCampaign(_0x47d63f);}}}};Dialer[_0xefc2('0x17')][_0xefc2('0xb3')]=function(_0x4c6bda){if(_0x4c6bda[_0xefc2('0xb4')]!==_0xefc2('0x9')){clearPredictiveAttributes(_0x4c6bda);}switch(_0x4c6bda['dialMethod']){case _0xefc2('0xb5'):this[_0xefc2('0xb6')](_0x4c6bda,0x1);break;case _0xefc2('0xb7'):this[_0xefc2('0xb6')](_0x4c6bda,_0x4c6bda[_0xefc2('0xb8')]);break;case _0xefc2('0x9'):this['predictive'](_0x4c6bda);break;case _0xefc2('0x8'):this[_0xefc2('0xb6')](_0x4c6bda,0x1);break;default:logger[_0xefc2('0x64')](_0xefc2('0xb9'),_0x4c6bda['name'],'method\x20not\x20recognized');}};Dialer[_0xefc2('0x17')]['ifTime']=function(_0x1f3b9c,_0x162712){var _0x38b4da=_0x1f3b9c[_0xefc2('0xb0')];var _0x1f6a9f=_0x162712?_0x1f3b9c[_0xefc2('0xaf')]:_0x1f3b9c[_0xefc2('0x75')][_0xefc2('0x78')];logger[_0xefc2('0xba')](_0xefc2('0xbb'),_0x1f6a9f,_0x38b4da,_0x1f3b9c[_0xefc2('0x41')],util[_0xefc2('0x7b')]('Voice\x20Queue\x20%s\x20$s',_0x1f3b9c[_0xefc2('0x41')],_0x1f3b9c['id']));var _0x2451f6=null;return Interval[_0xefc2('0xbc')](_0x1f6a9f,_0x38b4da)[_0xefc2('0xa3')](function(_0x1ff91b){if(_0x1ff91b===!![]){return _0x1ff91b;}else{_0x1f3b9c[_0xefc2('0x6c')]=_0x162712?utils[_0xefc2('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xefc2('0x68')][_0xefc2('0xa9')];_0x2451f6=msgResponse(_0xefc2('0xbd'),'Failure',_0xefc2('0xaa')+_0x162712+'\x20'+_0x1f3b9c[_0xefc2('0x41')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x1f6a9f,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x38b4da);}if(_0x2451f6!==null){logger['silly'](_0xefc2('0xbe'),_0x2451f6);_0x2451f6['isGlobal']=_0x162712;throw _0x2451f6;}})[_0xefc2('0xa7')](function(_0x3e81c8){logger[_0xefc2('0x64')](_0xefc2('0xbf'),_0x3e81c8);throw msgResponse(_0xefc2('0x85'),_0xefc2('0x86'),util[_0xefc2('0x3f')](_0x3e81c8,{'showHidden':![],'depth':null}));});};Dialer[_0xefc2('0x17')][_0xefc2('0x2a')]=function(_0x3ada8f){if(this[_0xefc2('0x1d')][_0x3ada8f[_0xefc2('0xc0')]]){if(this[_0xefc2('0x23')][_0x3ada8f['uniqueid']]&&this[_0xefc2('0x23')][_0x3ada8f[_0xefc2('0xc1')]][_0xefc2('0x3e')]!=='ivr'){this['updateOriginated'](this[_0xefc2('0x1d')][_0x3ada8f[_0xefc2('0xc0')]]);this[_0xefc2('0x23')][_0x3ada8f[_0xefc2('0xc1')]][_0xefc2('0xc2')]=moment()[_0xefc2('0x7b')](_0xefc2('0xc3'));}}};Dialer[_0xefc2('0x17')][_0xefc2('0xc4')]=function(_0x4d6fde){var _0x3ebf28=this[_0xefc2('0x23')][_0x4d6fde['uniqueid']];if(this[_0xefc2('0x1d')][_0x4d6fde['queue']]){if(_0x3ebf28&&_0x3ebf28[_0xefc2('0x3e')]!==_0xefc2('0xc5')){delete this[_0xefc2('0x23')][_0x4d6fde[_0xefc2('0xc1')]];this[_0xefc2('0x1d')][_0x4d6fde[_0xefc2('0xc0')]][_0xefc2('0xc6')]+=0x1;var _0x5ae018=new AgentComplete(_0x3ebf28,_0x4d6fde);if(_0x4d6fde[_0xefc2('0xc7')]===_0xefc2('0xc8')){_0x5ae018['agiafterat']=this['voiceQueues'][_0x4d6fde[_0xefc2('0xc0')]][_0xefc2('0xc9')]&&this[_0xefc2('0x1d')][_0x4d6fde[_0xefc2('0xc0')]]['dialAgiAfterHangupAgent']?moment()['format'](_0xefc2('0xc3')):undefined;}hopperUtils['createHistory'](_0x5ae018)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0xca')));hopperUtils[_0xefc2('0xcb')](_0x5ae018)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0xcc')));}}};Dialer['prototype'][_0xefc2('0x2d')]=function(_0x1aae31){var _0x5af80e=this[_0xefc2('0x23')][_0x1aae31[_0xefc2('0xc1')]];var _0x1b1915=this;var _0x118c27=![];var _0x350493;var _0x1b63cb;if(this[_0xefc2('0x1d')][_0x1aae31['queue']]){if(_0x5af80e&&_0x5af80e['type']!==_0xefc2('0xc5')){delete this[_0xefc2('0x23')][_0x1aae31['uniqueid']];this[_0xefc2('0xcd')](this[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]]);_0x5af80e[_0xefc2('0xce')]=moment()[_0xefc2('0x7b')](_0xefc2('0xc3'));var _0x576ea2=new QueueCallerAbandon(_0x5af80e,_0x1aae31);if(utils[_0xefc2('0x5d')](_0x5af80e['droptime'],_0x5af80e[_0xefc2('0xcf')])>=_0x5af80e[_0xefc2('0xd0')]){this[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0xd1')]+=0x1;this[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0xd2')]+=0x1;this[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x576ea2[_0xefc2('0xd3')]=0xa;_0x576ea2[_0xefc2('0x6f')]=_0xefc2('0xd4');_0x576ea2[_0xefc2('0xd5')]='TIMEOUT';_0x576ea2['agiafterat']=this[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]]['dialQueueProject2']?moment()[_0xefc2('0x7b')](_0xefc2('0xc3')):undefined;_0x576ea2[_0xefc2('0xd6')]+=0x1;_0x576ea2['countglobal']+=0x1;_0x350493=this[_0xefc2('0x1d')][_0x1aae31['queue']]['dialDropRetryFrequency'];_0x1b63cb=this[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0xd7')];hopperUtils['verifyAdditionalPhones'](_0x576ea2,_0x576ea2['state'],_0x5af80e[_0xefc2('0xd8')])[_0xefc2('0xa3')](function(_0x30aa6d){_0x118c27=_0x30aa6d[_0xefc2('0xd9')]==0x1;if(_0x576ea2['countdropretry']>=_0x1b1915['voiceQueues'][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0xda')]){_0x1b1915[_0xefc2('0xdb')](_0x576ea2,_0x30aa6d[_0xefc2('0xd9')]);}else{hopperUtils[_0xefc2('0xdc')]({'active':![],'countdropretry':_0x576ea2[_0xefc2('0xd6')],'scheduledat':moment()[_0xefc2('0xdd')](_0x1b1915[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0xde')],_0xefc2('0xdf'))[_0xefc2('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5af80e[_0xefc2('0xe0')],'ListId':_0x5af80e[_0xefc2('0xe1')],'VoiceQueueId':_0x5af80e[_0xefc2('0xe2')]||undefined,'CampaignId':_0x5af80e['CampaignId']||undefined})['catch'](loggerCatch(_0xefc2('0xe3')));var _0x4cc4ef=new History(_0x576ea2);_0x4cc4ef[_0xefc2('0xd3')]=0xa;_0x4cc4ef['statedesc']=_0xefc2('0xd4');_0x4cc4ef['starttime']=moment()['format'](_0xefc2('0xc3'));_0x4cc4ef['endtime']=_0x4cc4ef['starttime'];_0x4cc4ef[_0xefc2('0xe4')]=_0x576ea2[_0xefc2('0xe4')];_0x4cc4ef[_0xefc2('0xe5')]=_0x576ea2[_0xefc2('0xe5')];hopperUtils[_0xefc2('0xe6')](_0x4cc4ef)['catch'](loggerCatch(_0xefc2('0xe7')));}})[_0xefc2('0xa3')](function(){if(_0x118c27)hopperUtils[_0xefc2('0xe8')](_0x576ea2,_0x350493,_0x1b63cb)[_0xefc2('0xa3')](function(){return 0x1;});});}else{this['voiceQueues'][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0x49')]+=0x1;this[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0xe9')]+=0x1;_0x576ea2['state']=0xb;_0x576ea2[_0xefc2('0x6f')]=_0xefc2('0xea');_0x576ea2[_0xefc2('0xd5')]=_0xefc2('0xeb');_0x576ea2[_0xefc2('0xec')]+=0x1;_0x576ea2[_0xefc2('0xed')]+=0x1;_0x350493=this['voiceQueues'][_0x1aae31['queue']][_0xefc2('0xee')];_0x1b63cb=this[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xefc2('0xef')](_0x576ea2,_0x576ea2[_0xefc2('0xd3')],_0x5af80e[_0xefc2('0xd8')])[_0xefc2('0xa3')](function(_0x516f1b){if(_0x576ea2[_0xefc2('0xec')]>=_0x1b1915[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0xf0')]){_0x1b1915[_0xefc2('0xdb')](_0x576ea2,_0x516f1b[_0xefc2('0xd9')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x576ea2['countabandonedretry'],'scheduledat':moment()['add'](_0x1b1915[_0xefc2('0x1d')][_0x1aae31[_0xefc2('0xc0')]][_0xefc2('0xee')],'minutes')[_0xefc2('0x7b')](_0xefc2('0xc3')),'ContactId':_0x5af80e['ContactId'],'ListId':_0x5af80e[_0xefc2('0xe1')],'VoiceQueueId':_0x5af80e[_0xefc2('0xe2')]||undefined,'CampaignId':_0x5af80e[_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0xf2')));var _0x562672=new History(_0x576ea2);_0x562672[_0xefc2('0xd3')]=0xb;_0x562672['statedesc']=_0xefc2('0xea');_0x562672[_0xefc2('0x70')]=moment()[_0xefc2('0x7b')](_0xefc2('0xc3'));_0x562672['endtime']=_0x562672[_0xefc2('0x70')];_0x562672[_0xefc2('0xe4')]=_0x576ea2[_0xefc2('0xe4')];_0x562672[_0xefc2('0xe5')]=_0x576ea2[_0xefc2('0xe5')];hopperUtils['createHistory'](_0x562672)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0xf3')));}})[_0xefc2('0xa3')](function(){if(_0x118c27)hopperUtils['swapAdditionalPhones'](_0x576ea2,_0x350493,_0x1b63cb)[_0xefc2('0xa3')](function(){return 0x1;});});}}}};Dialer[_0xefc2('0x17')]['syncNewExten']=function(_0x58484d){if(this[_0xefc2('0x22')][_0x58484d[_0xefc2('0xc1')]]){this[_0xefc2('0x22')][_0x58484d['uniqueid']][_0xefc2('0xf4')]=_0x58484d[_0xefc2('0xf4')];}if(this[_0xefc2('0x23')][_0x58484d[_0xefc2('0xc1')]]){this[_0xefc2('0x23')][_0x58484d[_0xefc2('0xc1')]][_0xefc2('0xf4')]=_0x58484d[_0xefc2('0xf4')];}};Dialer[_0xefc2('0x17')]['syncQueueMember']=function(_0x1ed9e3){if(!this[_0xefc2('0x22')][_0x1ed9e3[_0xefc2('0xf5')]]){return;}var _0x20f3de=this[_0xefc2('0x1d')][this[_0xefc2('0x22')][_0x1ed9e3['actionid']][_0xefc2('0xc0')]][_0xefc2('0xf6')]||'rrmemory';if(_0x20f3de===_0xefc2('0xf7')){if(this['actions'][_0x1ed9e3['actionid']]&&_[_0xefc2('0xf8')](this[_0xefc2('0x22')][_0x1ed9e3[_0xefc2('0xf5')]][_0xefc2('0xf9')])&&_0x1ed9e3['status']==='1'&&_0x1ed9e3[_0xefc2('0xfa')]==='0'){if(this[_0xefc2('0x1f')][_0x1ed9e3['stateinterface']]){if(!this['agents'][_0x1ed9e3[_0xefc2('0xfb')]][_0xefc2('0xf9')]){this[_0xefc2('0x1f')][_0x1ed9e3[_0xefc2('0xfb')]][_0xefc2('0xf9')]=!![];this[_0xefc2('0x22')][_0x1ed9e3[_0xefc2('0xf5')]][_0xefc2('0xf9')]=!![];this['actions'][_0x1ed9e3[_0xefc2('0xf5')]][_0xefc2('0xfb')]=_0x1ed9e3['stateinterface'];}}}}else if(_0x20f3de==='rrmemory'){if(this[_0xefc2('0x22')][_0x1ed9e3[_0xefc2('0xf5')]]){if(this['agents'][_0x1ed9e3[_0xefc2('0xfb')]]){this[_0xefc2('0x22')][_0x1ed9e3[_0xefc2('0xf5')]][_0xefc2('0xfb')]=_0x1ed9e3['stateinterface'];if(_['isNil'](this[_0xefc2('0x26')][this['actions'][_0x1ed9e3['actionid']][_0xefc2('0xc0')]])){this[_0xefc2('0x26')][this[_0xefc2('0x22')][_0x1ed9e3['actionid']]['queue']]=[];}this[_0xefc2('0x26')][this[_0xefc2('0x22')][_0x1ed9e3[_0xefc2('0xf5')]][_0xefc2('0xc0')]]['push'](_['merge'](_[_0xefc2('0x74')](this[_0xefc2('0x22')][_0x1ed9e3[_0xefc2('0xf5')]],[_0xefc2('0xfc'),_0xefc2('0xfb')]),{'status':_0x1ed9e3[_0xefc2('0x8b')],'paused':_0x1ed9e3[_0xefc2('0xfa')]}));}}}};Dialer[_0xefc2('0x17')][_0xefc2('0x3b')]=function(_0x1a5512){if(!this[_0xefc2('0x22')][_0x1a5512['actionid']]){return;}var _0x3a2bdb=this;var _0x5b56a2=this[_0xefc2('0x1d')][this['actions'][_0x1a5512[_0xefc2('0xf5')]]['queue']];var _0x22f253=_0x5b56a2[_0xefc2('0xf6')]||'rrmemory';if(_0x22f253===_0xefc2('0xf7')){if(this[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]]&&this[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]]['stateinterface']){this[_0xefc2('0x1c')]['run'](this[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]][_0xefc2('0xfc')],this['actions'][_0x1a5512[_0xefc2('0xf5')]][_0xefc2('0xfb')])[_0xefc2('0xa7')](function(_0x41167d){logger[_0xefc2('0x64')](_0xefc2('0xfd'),util['inspect'](_0x41167d,{'showHidden':![],'depth':null}));})[_0xefc2('0x1a')](function(){_0x3a2bdb[_0xefc2('0xcd')](_0x3a2bdb['voiceQueues'][_0x3a2bdb['actions'][_0x1a5512['actionid']]['queue']]);_0x3a2bdb[_0xefc2('0x1f')][_0x3a2bdb['actions'][_0x1a5512['actionid']][_0xefc2('0xfb')]]['locked']=![];delete _0x3a2bdb['actions'][_0x1a5512[_0xefc2('0xf5')]];unlockQueueStatus(_0x5b56a2);});}else{this[_0xefc2('0xcd')](this[_0xefc2('0x1d')][this['actions'][_0x1a5512[_0xefc2('0xf5')]][_0xefc2('0xc0')]]);hopperUtils[_0xefc2('0xdc')]({'active':![],'ContactId':this['actions'][_0x1a5512['actionid']][_0xefc2('0xe0')],'ListId':this[_0xefc2('0x22')][_0x1a5512['actionid']][_0xefc2('0xe1')],'VoiceQueueId':this[_0xefc2('0x22')][_0x1a5512['actionid']][_0xefc2('0xe2')]||undefined,'CampaignId':this['actions'][_0x1a5512[_0xefc2('0xf5')]][_0xefc2('0xf1')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]];unlockQueueStatus(_0x5b56a2);}}else if(_0x22f253===_0xefc2('0xfe')){var _0x4f6a64;if(this[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]]&&!_[_0xefc2('0x43')](this[_0xefc2('0x26')][this[_0xefc2('0x22')][_0x1a5512['actionid']]['queue']])){if(this['queueBookedRR'][_0x3a2bdb[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]]['queue']]){this[_0xefc2('0x27')][_0x3a2bdb[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]][_0xefc2('0xc0')]]=this[_0xefc2('0x27')][this['actions'][_0x1a5512['actionid']][_0xefc2('0xc0')]]?this['queueBookedRR'][this[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]][_0xefc2('0xc0')]]:this['queueBooked'][this[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]]['queue']]?this[_0xefc2('0x26')][this[_0xefc2('0x22')][_0x1a5512[_0xefc2('0xf5')]]['queue']][_0xefc2('0xff')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x1a5512[_0xefc2('0xf5')]][_0xefc2('0xc0')]][_0xefc2('0xff')]=this[_0xefc2('0x27')][this['actions'][_0x1a5512['actionid']][_0xefc2('0xc0')]];for(var _0x440036=0x0;_0x440036=_0x319b8a[_0xefc2('0x122')]){_0x169f0c['stateGlobal'](_0x55e3dd,_0x3979b2,_0x145177,_0xefc2('0x123'));}else{if(_0x55e3dd[_0xefc2('0x11b')]>=_0x319b8a[_0xefc2('0x124')]){_0x169f0c[_0xefc2('0x125')](_0x55e3dd,_0x3979b2,_0x145177,_0xefc2('0x126'));}else{hopperUtils[_0xefc2('0xdc')]({'active':![],'countmachineretry':_0x55e3dd['countmachineretry'],'scheduledat':moment()[_0xefc2('0xdd')](_0x319b8a[_0xefc2('0x127')],_0xefc2('0xdf'))[_0xefc2('0x7b')](_0xefc2('0xc3')),'ContactId':_0x55e3dd['ContactId'],'ListId':_0x55e3dd[_0xefc2('0xe1')],'VoiceQueueId':_0x55e3dd[_0xefc2('0xe2')]||undefined,'CampaignId':_0x55e3dd[_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x128')));_0x3979b2({'reschedule':0x1});}}});}if(_0x3fba0d[_0xefc2('0x3e')]===_0xefc2('0xc5')&&this[_0xefc2('0x1e')][_0x3fba0d[_0xefc2('0xc0')]][_0xefc2('0x10e')]&&_0x5b085d[_0xefc2('0x10f')]===_0xefc2('0x129')){delete this[_0xefc2('0x23')][_0x5b085d[_0xefc2('0xc1')]];this['updateOriginated'](this[_0xefc2('0x1e')][_0x3fba0d[_0xefc2('0xc0')]]);_0x3bcdd6=new Hangup(_0x3fba0d,_0x5b085d);_0x3bcdd6[_0xefc2('0xd3')]=0x12;_0x3bcdd6[_0xefc2('0x6f')]=_0xefc2('0x111');_0x3bcdd6['membername']=_0xefc2('0x113');ami[_0xefc2('0x3d')]('custom:amd',ut[_0xefc2('0x115')](_0x3bcdd6,'amd'));this[_0xefc2('0x117')](_0x3bcdd6,_0xefc2('0x12a'),_0xefc2('0x12b'));}if(_0x3fba0d[_0xefc2('0x3e')]==='ivr'&&this[_0xefc2('0x1e')][_0x3fba0d['queue']][_0xefc2('0x10e')]&&_0x5b085d[_0xefc2('0x10f')]===_0xefc2('0x12c')){return new Promise(function(_0x423728,_0x557d85){delete _0x169f0c[_0xefc2('0x23')][_0x5b085d[_0xefc2('0xc1')]];_0x169f0c[_0xefc2('0xcd')](_0x169f0c[_0xefc2('0x1e')][_0x3fba0d[_0xefc2('0xc0')]]);_0x169f0c[_0xefc2('0x1e')][_0x3fba0d['queue']][_0xefc2('0xc6')]+=0x1;_0x169f0c[_0xefc2('0x1e')][_0x3fba0d[_0xefc2('0xc0')]][_0xefc2('0x110')]+=0x1;var _0x3568c8=_0x169f0c[_0xefc2('0x1e')][_0x3fba0d['queue']];var _0x4874d7=new Hangup(_0x3fba0d,_0x5b085d);_0x4874d7[_0xefc2('0xd3')]=0x13;_0x4874d7[_0xefc2('0x6f')]=_0xefc2('0x11a');_0x4874d7[_0xefc2('0x112')]=_0xefc2('0x113');_0x4874d7[_0xefc2('0x11b')]+=0x1;_0x4874d7['countglobal']+=0x1;_0x4874d7[_0xefc2('0x116')]=!![];ami[_0xefc2('0x3d')]('custom:amd',ut[_0xefc2('0x115')](_0x4874d7,'amd'));hopperUtils[_0xefc2('0xe6')](_0x4874d7)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x11c')));if(_0x4874d7[_0xefc2('0x11d')]+_0x4874d7[_0xefc2('0x11e')]+_0x4874d7['countnoanswerretry']+_0x4874d7['countnosuchnumberretry']+_0x4874d7[_0xefc2('0xd6')]+_0x4874d7[_0xefc2('0xec')]+_0x4874d7[_0xefc2('0x11b')]+_0x4874d7[_0xefc2('0x121')]>=_0x3568c8['dialGlobalMaxRetry']){_0x169f0c[_0xefc2('0x12d')](_0x4874d7,_0x423728,_0x557d85,_0xefc2('0x123'));}else{if(_0x4874d7[_0xefc2('0x11b')]>=_0x3568c8[_0xefc2('0x124')]){_0x169f0c[_0xefc2('0x125')](_0x4874d7,_0x423728,_0x557d85,_0xefc2('0x126'));}else{hopperUtils[_0xefc2('0xdc')]({'active':![],'countmachineretry':_0x4874d7[_0xefc2('0x11b')],'scheduledat':moment()[_0xefc2('0xdd')](_0x3568c8[_0xefc2('0x127')],_0xefc2('0xdf'))[_0xefc2('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4874d7[_0xefc2('0xe0')],'ListId':_0x4874d7[_0xefc2('0xe1')],'VoiceQueueId':_0x4874d7[_0xefc2('0xe2')]||undefined,'CampaignId':_0x4874d7[_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch('[rescheduleContact][Machine]'));_0x423728({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xefc2('0x35')]=function(_0x36c851){var _0x569c3e=this[_0xefc2('0x23')][_0x36c851['uniqueid']];var _0x83c6b8;if(_0x569c3e&&_0x569c3e[_0xefc2('0x3e')]==='ivr'){delete this[_0xefc2('0x23')][_0x36c851['uniqueid']];this['updateOriginated'](this[_0xefc2('0x1e')][_0x569c3e[_0xefc2('0xc0')]]);this[_0xefc2('0x1e')][_0x569c3e[_0xefc2('0xc0')]][_0xefc2('0x12e')]+=0x1;_0x83c6b8=new Hangup(_0x569c3e,_0x36c851);hopperUtils[_0xefc2('0xe6')](_0x83c6b8)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x12f')));hopperUtils[_0xefc2('0xcb')](_0x83c6b8)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x130')));}if(_0x569c3e&&_0x569c3e['type']!==_0xefc2('0xc5')&&isNotNull(this['voiceQueues'][_0x569c3e[_0xefc2('0xc0')]][_0xefc2('0x131')])){delete this[_0xefc2('0x23')][_0x36c851[_0xefc2('0xc1')]];this[_0xefc2('0xcd')](this[_0xefc2('0x1d')][_0x569c3e[_0xefc2('0xc0')]]);this[_0xefc2('0x1d')][_0x569c3e['queue']][_0xefc2('0xc6')]+=0x1;this[_0xefc2('0x1d')][_0x569c3e['queue']][_0xefc2('0x110')]+=0x1;_0x83c6b8=new Hangup(_0x569c3e,_0x36c851);_0x83c6b8[_0xefc2('0xd3')]=0x10;_0x83c6b8[_0xefc2('0x6f')]=_0xefc2('0x132');_0x83c6b8[_0xefc2('0x112')]=_0xefc2('0x133');hopperUtils[_0xefc2('0xe6')](_0x83c6b8)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x12f')));hopperUtils[_0xefc2('0xcb')](_0x83c6b8)['catch'](loggerCatch(_0xefc2('0x130')));}if(_0x569c3e&&_0x569c3e[_0xefc2('0x3e')]!==_0xefc2('0xc5')&&!isNotNull(this[_0xefc2('0x1d')][_0x569c3e[_0xefc2('0xc0')]][_0xefc2('0x131')])){delete this[_0xefc2('0x23')][_0x36c851[_0xefc2('0xc1')]];this[_0xefc2('0xcd')](this[_0xefc2('0x1d')][_0x569c3e['queue']]);this[_0xefc2('0x1d')][_0x569c3e[_0xefc2('0xc0')]][_0xefc2('0x134')]+=0x1;_0x83c6b8=new Hangup(_0x569c3e,_0x36c851);_0x83c6b8[_0xefc2('0xd3')]=0xc;_0x83c6b8[_0xefc2('0x6f')]=_0x36c851[_0xefc2('0x135')];_0x83c6b8[_0xefc2('0x112')]=_0xefc2('0x136');hopperUtils['createHistory'](_0x83c6b8)['catch'](loggerCatch(_0xefc2('0x12f')));hopperUtils['moveContactManagedDialer'](_0x83c6b8)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x130')));}};Dialer[_0xefc2('0x17')][_0xefc2('0x31')]=function(_0x2a0c1c){var _0x458c1f=this;if(!_0x458c1f['queuesSummary'][_0x2a0c1c[_0xefc2('0x41')]]){_0x458c1f[_0xefc2('0x28')][_0x2a0c1c[_0xefc2('0x41')]]={'running':![]};}else if(_0x458c1f[_0xefc2('0x28')][_0x2a0c1c[_0xefc2('0x41')]]['running']===!![]){return;}else if(_0x458c1f['queuesSummary'][_0x2a0c1c[_0xefc2('0x41')]][_0xefc2('0x137')]===![]){_0x458c1f[_0xefc2('0x28')][_0x2a0c1c[_0xefc2('0x41')]][_0xefc2('0x137')]=!![];}var _0x23c174=_0x458c1f[_0xefc2('0x1d')][_0x2a0c1c[_0xefc2('0x41')]];var _0x37eec4=_0x23c174[_0xefc2('0x6c')]!==utils[_0xefc2('0x68')]['INACTIVE'];var _0x7406c=utils['isPreviewCampaign'](_0x23c174);_0x23c174[_0xefc2('0x138')]=utils['getQueueCampaignStatusMessage'](_0x23c174,_0x458c1f[_0xefc2('0x20')]);Promise[_0xefc2('0x139')]()[_0xefc2('0xa3')](function(){if(_0x23c174['statusMessage']===utils[_0xefc2('0x68')][_0xefc2('0x80')]){if(_0x37eec4){clearPredictiveAttributes(_0x23c174);_0x2a0c1c[_0xefc2('0x60')]=undefined;_0x2a0c1c[_0xefc2('0x24')]=undefined;}if(_0x23c174[_0xefc2('0x138')]===utils[_0xefc2('0x68')][_0xefc2('0x80')]){_0x2a0c1c[_0xefc2('0x13a')]=0x0;_0x2a0c1c[_0xefc2('0xfa')]=0x0;_0x2a0c1c[_0xefc2('0x13b')]=0x0;_0x2a0c1c[_0xefc2('0x13c')]=0x0;_0x2a0c1c['pTalking']=0x0;}}else if(_0x23c174[_0xefc2('0x138')]===utils[_0xefc2('0x68')]['ACTIVE']&&!_0x7406c){return _0x458c1f[_0xefc2('0x95')](_0x23c174,!![])[_0xefc2('0xa3')](function(){return _0x458c1f[_0xefc2('0x95')](_0x23c174,![]);})[_0xefc2('0xa3')](function(){return _0x458c1f[_0xefc2('0xb3')](_0x23c174);})[_0xefc2('0xa7')](function(_0x2eb0f6){loggerSyncQueueSummary[_0xefc2('0x5e')](_0xefc2('0x13d'),util[_0xefc2('0x3f')](_0x2eb0f6,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x23c174);});}else{clearPredictiveAttributes(_0x23c174);}})[_0xefc2('0xa3')](function(){var _0x36036b=_0x2a0c1c[_0xefc2('0x13e')](_0x23c174);if(_0x36036b||_0x23c174['queueSummaryCountersUpdated']){_0x23c174['queueSummaryCountersUpdated']=![];_0x2a0c1c[_0xefc2('0x13f')](_0x23c174);Object[_0xefc2('0x140')](_0x23c174,_0x2a0c1c);emitOutboundVoiceQueueSummary(_0x2a0c1c);}_0x458c1f['queuesSummary'][_0x23c174[_0xefc2('0x41')]][_0xefc2('0x137')]=![];})[_0xefc2('0xa7')](function(_0x250fad){logger[_0xefc2('0x64')](_0xefc2('0x13d'),util['inspect'](_0x250fad,{'showHidden':![],'depth':null}));_0x458c1f[_0xefc2('0x28')][_0x23c174[_0xefc2('0x41')]][_0xefc2('0x137')]=![];});};Dialer[_0xefc2('0x17')][_0xefc2('0x33')]=_['throttle'](function(){var _0x374b66=_[_0xefc2('0x141')](this[_0xefc2('0x1d')],function(_0x593f60){return _0x593f60[_0xefc2('0x142')];});var _0x20c0af=_[_0xefc2('0x141')](this[_0xefc2('0x1f')],function(_0x816de9){return _0x816de9[_0xefc2('0x143')]&&_0x816de9['status']===_0xefc2('0x8c');});if(_0x374b66[_0xefc2('0x9d')]>0x0&&_0x20c0af[_0xefc2('0x9d')]>0x0){return Promise[_0xefc2('0x139')]()['then'](cmHopper[_0xefc2('0x144')](_['map'](_0x374b66,'id'),previewRecallmeReminderInterval,_[_0xefc2('0x145')](_0x20c0af,'id')))['then'](function(_0x40ac3f){for(var _0x5240e4=0x0;_0x5240e4<_0x40ac3f[_0xefc2('0x9d')];_0x5240e4++){var _0x2b6f66=_0x40ac3f[_0x5240e4][_0xefc2('0x146')][_0xefc2('0x41')];if(_0x2b6f66)io['to'](util['format'](_0xefc2('0x147'),_0x2b6f66))[_0xefc2('0x3d')]('user:dialPreviewRecallReminder',{'hopper':_0x40ac3f[_0x5240e4]});}})[_0xefc2('0xa7')](function(_0x3dee8a){logger[_0xefc2('0x64')](_0xefc2('0x148'),_0x3dee8a);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xefc2('0x17')][_0xefc2('0x149')]=function(){var _0x29397a=this;setInterval(function(){_0x29397a[_0xefc2('0x14a')](_0x29397a[_0xefc2('0x23')],'[uniqueid]');_0x29397a['clearZombieChannels'](_0x29397a[_0xefc2('0x22')],_0xefc2('0x14b'));},0x32c8);};Dialer[_0xefc2('0x17')]['clearZombieChannels']=function(_0x4ec74e,_0x2ba206){var _0x2c29a0=this;for(var _0x4584bd in _0x4ec74e){if(typeof _0x4ec74e[_0x4584bd]!==_0xefc2('0x14c')){this[_0xefc2('0x1b')][_0xefc2('0x18')](function(){if(!_[_0xefc2('0xf8')](_0x4ec74e[_0x4584bd])){return ami[_0xefc2('0x9f')]({'action':'status','channel':_0x4ec74e[_0x4584bd]['channel']})[_0xefc2('0xa7')](function(_0x5f30af){if(_0x5f30af['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x4ec74e[_0x4584bd]&&_0x4ec74e[_0x4584bd][_0xefc2('0x3e')]!==_0xefc2('0xc5')){_0x2c29a0[_0xefc2('0xcd')](_0x2c29a0[_0xefc2('0x1d')][_0x4ec74e[_0x4584bd][_0xefc2('0xc0')]]);logger[_0xefc2('0x64')](_0xefc2('0x14d'),_0x2ba206,_0x4584bd,_0x4ec74e[_0x4584bd][_0xefc2('0xc0')]);delete _0x4ec74e[_0x4584bd];}if(_0x4ec74e[_0x4584bd]&&_0x4ec74e[_0x4584bd]['type']==='ivr'){_0x2c29a0[_0xefc2('0xcd')](_0x2c29a0[_0xefc2('0x1e')][_0x4ec74e[_0x4584bd][_0xefc2('0xc0')]]);logger[_0xefc2('0x64')]('[Dialer][checkChannel][ivr]',_0x2ba206,_0x4584bd,_0x4ec74e[_0x4584bd][_0xefc2('0xc0')]);delete _0x4ec74e[_0x4584bd];}},0x2328);}});}});}}};Dialer[_0xefc2('0x17')][_0xefc2('0x14e')]=function(_0x414357){return Promise[_0xefc2('0x139')]()[_0xefc2('0xa3')](voiceQueueRt[_0xefc2('0x14e')](_0x414357))[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x14f')));};Dialer[_0xefc2('0x17')][_0xefc2('0xcd')]=function(_0x43cc24){if(!_[_0xefc2('0x4e')](_0x43cc24)&&_0x43cc24!==null){if(typeof _0x43cc24[_0xefc2('0x7e')]!==_0xefc2('0x14c')){if(_0x43cc24[_0xefc2('0x7e')]>0x0){_0x43cc24[_0xefc2('0x7e')]-=0x1;}else{logger[_0xefc2('0x64')](_0xefc2('0x150'));}}}else{logger['error'](_0xefc2('0x151'));}};Dialer[_0xefc2('0x17')][_0xefc2('0x152')]=function(_0x3ac948,_0x19e449){var _0x2d83d2=this;return function(_0x372f73){_0x2d83d2[_0xefc2('0xcd')](_0x19e449);logger[_0xefc2('0x64')](_0x3ac948,util[_0xefc2('0x3f')](_0x372f73,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xefc2('0x153')]=function(_0x4e59ed,_0x4e9f1f,_0x36b9f2){var _0x3d91ca={'state':0x19,'statedesc':_0xefc2('0x154')};this[_0xefc2('0xcd')](_0x4e9f1f);this[_0xefc2('0x117')](_[_0xefc2('0x5c')](_0x3d91ca,_['pick'](_0x36b9f2,[_0xefc2('0xe0'),_0xefc2('0xe1'),_0xefc2('0x155'),'VoiceQueueId',_0xefc2('0xf1')])),_0xefc2('0x156'),_0xefc2('0x157'));logger[_0xefc2('0x64')](_0x4e59ed);};Dialer[_0xefc2('0x17')][_0xefc2('0x117')]=function(_0xcba84b,_0x1271f9,_0x1cbec4){hopperUtils[_0xefc2('0xe6')](_0xcba84b)[_0xefc2('0xa7')](loggerCatch(_0x1271f9));hopperUtils[_0xefc2('0xcb')](_0xcba84b)[_0xefc2('0xa7')](loggerCatch(_0x1cbec4));};Dialer[_0xefc2('0x17')][_0xefc2('0xdb')]=function(_0x18023a,_0x22995a){hopperUtils['createHistory'](_0x18023a)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0xca')));if(_0x22995a==0x0){hopperUtils[_0xefc2('0xcb')](_0x18023a)[_0xefc2('0xa7')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xefc2('0x17')]['checkPreviewRecallReminder']=function(_0x2b73e7){return Promise[_0xefc2('0x139')]()[_0xefc2('0xa3')](cmHopper[_0xefc2('0x144')](_0x2b73e7['id'],previewRecallmeReminderInterval))[_0xefc2('0xa3')](function(_0x9bf708){for(var _0x1d84ff=0x0;_0x1d84ff<_0x9bf708['length'];_0x1d84ff++){var _0x9432ca=_0x9bf708[_0x1d84ff][_0xefc2('0x146')]['name'];if(_0x9432ca)io['to'](util['format'](_0xefc2('0x147'),_0x9432ca))['emit'](_0xefc2('0x158'),{'hopper':_0x9bf708[_0x1d84ff]});}})[_0xefc2('0xa7')](function(){});};Dialer[_0xefc2('0x17')][_0xefc2('0xb1')]=function(_0x4e87a5){var _0x38d8b1=this;return function(){_0x38d8b1['handleIvr'](_0x4e87a5);};};Dialer[_0xefc2('0x17')][_0xefc2('0x159')]=function(_0x389c2a,_0x3a437f){var _0x361c05=this;var _0x45b3ec=uuid['v4']();this[_0xefc2('0x22')][_0x45b3ec]=new Action(_0x389c2a,_0x3a437f,_0x45b3ec);return new Promise(function(_0x2c40e9,_0x5c0703){if(_[_0xefc2('0x4e')](_0x389c2a)&&typeof _0x389c2a!==_0xefc2('0x15a')){return _0x5c0703(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xefc2('0x4e')](_0x3a437f[_0xefc2('0x15b')])||_0x3a437f['phone']===null){return _0x5c0703(msgResponse(_0xefc2('0x15c'),_0xefc2('0x96'),'contact\x20is\x20undefine'));}var _0x4195f8={'XMD-CALLERID':_0x361c05[_0xefc2('0x22')][_0x45b3ec]['getCaller'](),'XMD-AGI':_0x389c2a[_0xefc2('0x131')]?util[_0xefc2('0x7b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x389c2a['dialQueueProject']):_0xefc2('0x15d'),'XMD-AGIAFTER':_0x389c2a[_0xefc2('0xc9')]?util[_0xefc2('0x7b')](_0xefc2('0x15e'),ipAgi,_0x389c2a[_0xefc2('0xc9')]):'NONE','XMD-QUEUE':utils[_0xefc2('0x15f')](_0x389c2a)?util[_0xefc2('0x7b')](_0xefc2('0x160'),_0x389c2a['name'],_0x389c2a['dialQueueOptions']||'',_0x389c2a[_0xefc2('0x161')]?'c':'',_0x389c2a[_0xefc2('0xd0')]||0x3):_0xefc2('0x15d'),'XMD-CONTACTID':_0x3a437f[_0xefc2('0xe0')],'XMD-CDRTYPE':_0xefc2('0x6'),'CALLERID(all)':_0x361c05['actions'][_0x45b3ec][_0xefc2('0x162')](),'XMD-AMD':_0x389c2a['dialAMDActive']?'ACTIVE':_0xefc2('0x15d'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x389c2a[_0xefc2('0x10e')]){_0x4195f8['XMD-AMDINITIALSILENCE']=_0x389c2a['dialAMDInitialSilence']||0x9c4;_0x4195f8[_0xefc2('0x163')]=_0x389c2a[_0xefc2('0x164')]||0x5dc;_0x4195f8[_0xefc2('0x165')]=_0x389c2a[_0xefc2('0x166')]||0x320;_0x4195f8[_0xefc2('0x167')]=_0x389c2a['dialAMDTotalAnalysisTime']||0x1388;_0x4195f8[_0xefc2('0x168')]=_0x389c2a[_0xefc2('0x169')]||0x64;_0x4195f8[_0xefc2('0x16a')]=_0x389c2a['dialAMDBetweenWordsSilence']||0x32;_0x4195f8[_0xefc2('0x16b')]=_0x389c2a[_0xefc2('0x16c')]||0x3;_0x4195f8[_0xefc2('0x16d')]=_0x389c2a[_0xefc2('0x16e')]||0x100;_0x4195f8[_0xefc2('0x16f')]=_0x389c2a[_0xefc2('0x170')]||0x1388;}if(utils[_0xefc2('0x15f')](_0x389c2a)){_0x4195f8[_0xefc2('0x171')]=_0x3a437f[_0xefc2('0xe2')];}else{_0x4195f8[_0xefc2('0x172')]=_0x3a437f[_0xefc2('0xf1')];}for(var _0x4c154e in _0x3a437f[_0xefc2('0x173')]){if(typeof _0x3a437f['Contact'][_0x4c154e]!==_0xefc2('0x14c')){if(isNotNull(_0x3a437f['Contact'][_0x4c154e])&&_0x4c154e!=='id'&&_0x4c154e!==_0xefc2('0x174')&&_0x4c154e!==_0xefc2('0x175')&&_0x4c154e!==_0xefc2('0x176')){_0x4195f8[util['format'](_0xefc2('0x177'),_0xefc2('0x178'),_['toUpper'](_0x4c154e))]=_0x3a437f[_0xefc2('0x173')][_0x4c154e];}}}var _0x1ced3f=_0x361c05['isTrunkReachable'](_0x389c2a[_0xefc2('0x8f')])?utils[_0xefc2('0x179')](_0x389c2a['Trunk'][_0xefc2('0x17a')],_0x389c2a['dialOriginateCallerIdName'],_0x389c2a['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xefc2('0x17b')](_0x389c2a['dialOriginateCallerIdNumber'],_0x389c2a[_0xefc2('0x17c')]):_0x389c2a[_0xefc2('0x17d')]):utils[_0xefc2('0x179')](_[_0xefc2('0xf8')](_0x389c2a[_0xefc2('0x90')])?_0x389c2a[_0xefc2('0x8f')][_0xefc2('0x17a')]:_0x389c2a['TrunkBackup'][_0xefc2('0x17a')],_0x389c2a[_0xefc2('0x17e')],_0x389c2a[_0xefc2('0x17c')]>0x0?utils[_0xefc2('0x17b')](_0x389c2a[_0xefc2('0x17d')],_0x389c2a['dialRandomLastDigitCallerIdNumber']):_0x389c2a[_0xefc2('0x17d')]);if(_0x1ced3f){_0x4195f8[_0xefc2('0x17f')]=_0x361c05['actions'][_0x45b3ec][_0xefc2('0x180')]=utils[_0xefc2('0x181')](_0x1ced3f);_0x4195f8[_0xefc2('0x182')]=_0x3a437f[_0xefc2('0x15b')];}_0x389c2a[_0xefc2('0x183')]=_0x4195f8;return ami[_0xefc2('0x9f')]({'actionid':_0x45b3ec,'action':_0xefc2('0x15c'),'channel':_0x361c05['isTrunkReachable'](_0x389c2a[_0xefc2('0x8f')])?util['format'](_0xefc2('0x184'),_0x389c2a['Trunk'][_0xefc2('0x41')],isNotNull(_0x389c2a[_0xefc2('0x185')])?_0x389c2a[_0xefc2('0x185')][_0xefc2('0x186')]()||'':'',_0x389c2a['dialCutDigit']>0x0?_0x3a437f['phone'][_0xefc2('0x187')](_0x389c2a[_0xefc2('0x188')]):_0x3a437f['phone']):util['format']('SIP/%s/%s%s',_['isNil'](_0x389c2a[_0xefc2('0x90')])?_0x389c2a[_0xefc2('0x8f')][_0xefc2('0x41')]:_0x389c2a[_0xefc2('0x90')][_0xefc2('0x41')],isNotNull(_0x389c2a[_0xefc2('0x185')])?_0x389c2a[_0xefc2('0x185')][_0xefc2('0x186')]()||'':'',_0x389c2a[_0xefc2('0x188')]>0x0?_0x3a437f[_0xefc2('0x15b')][_0xefc2('0x187')](_0x389c2a[_0xefc2('0x188')]):_0x3a437f['phone']),'callerid':_0x1ced3f,'Exten':_0xefc2('0x10d'),'Context':'from-sip','Priority':'1','variable':_0x4195f8,'timeout':(_0x389c2a[_0xefc2('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x45b3ec})[_0xefc2('0xa3')](function(_0x1dca27){return _0x2c40e9(_0x1dca27);})['catch'](function(_0x4efb87){_0x389c2a['outboundOriginateFailureCallsDay']+=0x1;var _0x357fd2=new History(_0x361c05[_0xefc2('0x22')][_0x45b3ec]);logger[_0xefc2('0x64')](util['format'](_0xefc2('0x18a'),JSON[_0xefc2('0x87')](_0x4efb87)));_0x357fd2[_0xefc2('0xd3')]=0xe;_0x357fd2['statedesc']='OriginateError';_0x357fd2['starttime']=moment()[_0xefc2('0x7b')](_0xefc2('0xc3'));_0x357fd2[_0xefc2('0x18b')]=_0x357fd2[_0xefc2('0x70')];hopperUtils[_0xefc2('0xe6')](_0x357fd2)['catch'](loggerCatch(_0xefc2('0x18c')));_0x361c05[_0xefc2('0xcb')](_0x357fd2)[_0xefc2('0xa7')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x361c05[_0xefc2('0x22')][_0x45b3ec];return _0x5c0703(msgResponse('originate',_0xefc2('0x86'),_0xefc2('0x18d')));});});});};Dialer[_0xefc2('0x17')][_0xefc2('0x18e')]=function(_0x366fed,_0x307e1f,_0x196db1){var _0x1106c1=new History(_0x307e1f);if(_0x1106c1[_0xefc2('0x11d')]+_0x1106c1[_0xefc2('0x11e')]+_0x1106c1[_0xefc2('0x11f')]+_0x1106c1[_0xefc2('0x120')]+_0x1106c1[_0xefc2('0xd6')]+_0x1106c1[_0xefc2('0xec')]+_0x1106c1[_0xefc2('0x11b')]+_0x1106c1[_0xefc2('0x121')]>=_0x196db1['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x366fed){case 0x3:if(_0x1106c1[_0xefc2('0x11f')]>=_0x196db1[_0xefc2('0x18f')]-0x1){return!![];}hopperUtils[_0xefc2('0xdc')]({'active':![],'countnoanswerretry':_0x1106c1[_0xefc2('0x11f')]+=0x1,'scheduledat':moment()[_0xefc2('0xdd')](_0x196db1[_0xefc2('0x190')],'minutes')[_0xefc2('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1106c1[_0xefc2('0xe0')],'ListId':_0x1106c1['ListId'],'VoiceQueueId':_0x1106c1[_0xefc2('0xe2')]||undefined,'CampaignId':_0x1106c1[_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1106c1[_0xefc2('0x11d')]>=_0x196db1[_0xefc2('0x191')]-0x1){return!![];}hopperUtils[_0xefc2('0xdc')]({'active':![],'countbusyretry':_0x1106c1['countbusyretry']+=0x1,'scheduledat':moment()[_0xefc2('0xdd')](_0x196db1[_0xefc2('0x192')],_0xefc2('0xdf'))['format'](_0xefc2('0xc3')),'ContactId':_0x1106c1[_0xefc2('0xe0')],'ListId':_0x1106c1[_0xefc2('0xe1')],'VoiceQueueId':_0x1106c1[_0xefc2('0xe2')]||undefined,'CampaignId':_0x1106c1[_0xefc2('0xf1')]||undefined})['catch'](loggerCatch(_0xefc2('0x193')));break;case 0x8:if(_0x1106c1[_0xefc2('0x11e')]>=_0x196db1[_0xefc2('0x194')]-0x1){return!![];}hopperUtils[_0xefc2('0xdc')]({'active':![],'countcongestionretry':_0x1106c1[_0xefc2('0x11e')]+=0x1,'scheduledat':moment()[_0xefc2('0xdd')](_0x196db1[_0xefc2('0x195')],_0xefc2('0xdf'))[_0xefc2('0x7b')](_0xefc2('0xc3')),'ContactId':_0x1106c1[_0xefc2('0xe0')],'ListId':_0x1106c1['ListId'],'VoiceQueueId':_0x1106c1['VoiceQueueId']||undefined,'CampaignId':_0x1106c1[_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x196')));break;case 0x0:if(_0x1106c1[_0xefc2('0x120')]>=_0x196db1[_0xefc2('0x197')]-0x1){return!![];}else{hopperUtils[_0xefc2('0xdc')]({'active':![],'countnosuchnumberretry':_0x1106c1['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x196db1[_0xefc2('0x198')],_0xefc2('0xdf'))[_0xefc2('0x7b')](_0xefc2('0xc3')),'ContactId':_0x1106c1[_0xefc2('0xe0')],'ListId':_0x1106c1[_0xefc2('0xe1')],'VoiceQueueId':_0x1106c1[_0xefc2('0xe2')]||undefined,'CampaignId':_0x1106c1[_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x199')));}break;case 0xa:if(_0x1106c1[_0xefc2('0xd6')]>=_0x196db1[_0xefc2('0xda')]-0x1){return!![];}hopperUtils[_0xefc2('0xdc')]({'active':![],'countdropretry':_0x1106c1[_0xefc2('0xd6')]+=0x1,'scheduledat':moment()[_0xefc2('0xdd')](_0x196db1[_0xefc2('0xde')],'minutes')[_0xefc2('0x7b')](_0xefc2('0xc3')),'ContactId':_0x1106c1[_0xefc2('0xe0')],'ListId':_0x1106c1[_0xefc2('0xe1')],'VoiceQueueId':_0x1106c1[_0xefc2('0xe2')]||undefined,'CampaignId':_0x1106c1['CampaignId']||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0xe3')));break;case 0xb:if(_0x1106c1[_0xefc2('0xec')]>=_0x196db1[_0xefc2('0xf0')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1106c1[_0xefc2('0xec')]+=0x1,'scheduledat':moment()[_0xefc2('0xdd')](_0x196db1['dialAbandonedRetryFrequency'],_0xefc2('0xdf'))[_0xefc2('0x7b')](_0xefc2('0xc3')),'ContactId':_0x1106c1['ContactId'],'ListId':_0x1106c1[_0xefc2('0xe1')],'VoiceQueueId':_0x1106c1['VoiceQueueId']||undefined,'CampaignId':_0x1106c1[_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0xf2')));break;case 0x13:if(_0x1106c1[_0xefc2('0x11b')]>=_0x196db1[_0xefc2('0x124')]-0x1){return!![];}hopperUtils[_0xefc2('0xdc')]({'active':![],'countmachineretry':_0x1106c1['countmachineretry']+=0x1,'scheduledat':moment()[_0xefc2('0xdd')](_0x196db1[_0xefc2('0x127')],'minutes')['format'](_0xefc2('0xc3')),'ContactId':_0x1106c1[_0xefc2('0xe0')],'ListId':_0x1106c1[_0xefc2('0xe1')],'VoiceQueueId':_0x1106c1[_0xefc2('0xe2')]||undefined,'CampaignId':_0x1106c1[_0xefc2('0xf1')]||undefined})['catch'](loggerCatch(_0xefc2('0x128')));break;case 0x14:if(_0x1106c1[_0xefc2('0x121')]>=_0x196db1['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xefc2('0xdc')]({'active':![],'countagentrejectretry':_0x1106c1[_0xefc2('0x121')]+=0x1,'scheduledat':moment()[_0xefc2('0xdd')](_0x196db1[_0xefc2('0x19a')],'minutes')[_0xefc2('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1106c1['ContactId'],'ListId':_0x1106c1[_0xefc2('0xe1')],'VoiceQueueId':_0x1106c1['VoiceQueueId']||undefined,'CampaignId':_0x1106c1[_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x19b')));break;default:return!![];}};Dialer[_0xefc2('0x17')]['callProgressDetecting']=function(_0x2688c4,_0x451b73,_0x2c04e1){var _0x229d86=this;var _0x58ded0=new History(_0x2688c4);var _0x2fba3d=![];var _0x2d7fe3;var _0x4a749;return new Promise(function(_0x4e869f,_0x47c7cc){if(_['isUndefined'](_0x451b73)&&typeof _0x451b73!=='object'){return _0x47c7cc(msgResponse(_0xefc2('0x19c'),_0xefc2('0x96'),_0xefc2('0x19d')));}if(_[_0xefc2('0x4e')](_0x2c04e1)&&typeof _0x2c04e1!=='object'){return _0x47c7cc(msgResponse('[callProgressDetecting]',_0xefc2('0x96'),'evt\x20is\x20undefine'));}hopperUtils[_0xefc2('0xef')](_0x58ded0,_0x2c04e1[_0xefc2('0xc7')],_0x451b73)[_0xefc2('0xa3')](function(_0x3b1ed1){if(_0x3b1ed1['additional']==0x1)_0x2fba3d=!![];switch(_0x2c04e1['reason']){case'0':_0x451b73[_0xefc2('0x19e')]+=0x1;_0x58ded0[_0xefc2('0xd3')]=0x0;_0x58ded0[_0xefc2('0x6f')]='NoSuchNumber';_0x58ded0[_0xefc2('0x120')]+=0x1;_0x58ded0['countglobal']+=0x1;ami[_0xefc2('0x3d')](_0xefc2('0x19f'),ut['buildObj'](_0x2688c4,'nosuchnumber'));_0x2d7fe3=_0x451b73[_0xefc2('0x198')];_0x4a749=_0x451b73[_0xefc2('0xd7')];hopperUtils[_0xefc2('0xe6')](_0x58ded0)['catch'](loggerCatch(_0xefc2('0x11c')));if(_0x229d86[_0xefc2('0x18e')](0x0,_0x2688c4,_0x451b73)&&!_0x2fba3d){if(_0x58ded0[_0xefc2('0x120')]>=_0x451b73[_0xefc2('0x197')]){_0x229d86[_0xefc2('0x125')](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1a0'));}else{_0x229d86[_0xefc2('0x12d')](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1a0'));}}break;case'3':_0x451b73[_0xefc2('0x1a1')]+=0x1;_0x58ded0[_0xefc2('0xd3')]=0x3;_0x58ded0[_0xefc2('0x6f')]=_0xefc2('0x1a2');_0x58ded0[_0xefc2('0x11f')]+=0x1;_0x58ded0['countglobal']+=0x1;var _0xb2bdbe=ut[_0xefc2('0x1a3')](_0x2688c4,_0x451b73);ami[_0xefc2('0x3d')](_0xefc2('0x1a4'),_0xb2bdbe);_0x2d7fe3=_0x451b73['dialNoAnswerRetryFrequency'];_0x4a749=_0x451b73[_0xefc2('0xd7')];hopperUtils[_0xefc2('0xe6')](_0x58ded0)[_0xefc2('0xa7')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x229d86[_0xefc2('0x18e')](0x3,_0x2688c4,_0x451b73)&&!_0x2fba3d){if(_0x58ded0[_0xefc2('0x11f')]>=_0x451b73[_0xefc2('0x18f')]){_0x229d86[_0xefc2('0x125')](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1a5'));}else{_0x229d86[_0xefc2('0x12d')](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1a5'));}}break;case'5':_0x451b73[_0xefc2('0x1a6')]+=0x1;_0x58ded0[_0xefc2('0xd3')]=0x5;_0x58ded0[_0xefc2('0x6f')]=_0xefc2('0x1a7');_0x58ded0[_0xefc2('0x11d')]+=0x1;_0x58ded0[_0xefc2('0xed')]+=0x1;ami[_0xefc2('0x3d')](_0xefc2('0x1a8'),ut[_0xefc2('0x115')](_0x2688c4,'busy'));_0x2d7fe3=_0x451b73[_0xefc2('0x192')];_0x4a749=_0x451b73[_0xefc2('0xd7')];hopperUtils[_0xefc2('0xe6')](_0x58ded0)['catch'](loggerCatch(_0xefc2('0x1a9')));if(_0x229d86[_0xefc2('0x18e')](0x5,_0x2688c4,_0x451b73)&&!_0x2fba3d){if(_0x58ded0[_0xefc2('0x11d')]>=_0x451b73['dialBusyMaxRetry']){_0x229d86[_0xefc2('0x125')](_0x58ded0,_0x4e869f,_0x47c7cc,'reason\x205\x20busy');}else{_0x229d86[_0xefc2('0x12d')](_0x58ded0,_0x4e869f,_0x47c7cc,'reason\x205\x20busy');}}break;case'8':_0x451b73[_0xefc2('0x1aa')]+=0x1;_0x58ded0[_0xefc2('0xd3')]=0x8;_0x58ded0[_0xefc2('0x6f')]=_0xefc2('0x1ab');_0x58ded0['countcongestionretry']+=0x1;_0x58ded0[_0xefc2('0xed')]+=0x1;_0x2d7fe3=_0x451b73[_0xefc2('0x195')];_0x4a749=_0x451b73['callAdditionalPhoneAfterMin'];ami[_0xefc2('0x3d')](_0xefc2('0x1ac'),ut['buildObj'](_0x2688c4,_0xefc2('0x1ad')));hopperUtils[_0xefc2('0xe6')](_0x58ded0)['catch'](loggerCatch(_0xefc2('0x1ae')));if(_0x229d86[_0xefc2('0x18e')](0x8,_0x2688c4,_0x451b73)&&!_0x2fba3d){if(_0x58ded0[_0xefc2('0x11e')]>=_0x451b73[_0xefc2('0x194')]){_0x229d86[_0xefc2('0x125')](_0x58ded0,_0x4e869f,_0x47c7cc,'reason\x208\x20congestion');}else{_0x229d86[_0xefc2('0x12d')](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1af'));}}break;case'11':_0x451b73['outboundAbandonedCallsDay']+=0x1;_0x58ded0[_0xefc2('0xd3')]=0xb;_0x58ded0[_0xefc2('0x6f')]='Abandoned';_0x58ded0[_0xefc2('0xec')]+=0x1;_0x58ded0['countglobal']+=0x1;_0x2d7fe3=_0x451b73['dialAbandonedRetryFrequency'];_0x4a749=_0x451b73[_0xefc2('0xd7')];hopperUtils[_0xefc2('0xe6')](_0x58ded0)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0xf3')));if(_0x229d86[_0xefc2('0x18e')](0xb,_0x2688c4,_0x451b73)&&!_0x2fba3d){if(_0x58ded0[_0xefc2('0xec')]>=_0x451b73[_0xefc2('0xf0')]){_0x229d86['createStateFinal'](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1b0'));}else{_0x229d86[_0xefc2('0x12d')](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1b0'));}}break;case'20':_0x451b73['outboundRejectCallsDay']+=0x1;_0x58ded0['state']=0x14;_0x58ded0[_0xefc2('0x6f')]=_0xefc2('0x1b1');_0x58ded0['countagentrejectretry']+=0x1;_0x58ded0[_0xefc2('0xed')]+=0x1;_0x2d7fe3=_0x451b73[_0xefc2('0x19a')];_0x4a749=_0x451b73[_0xefc2('0xd7')];ami[_0xefc2('0x3d')](_0xefc2('0x1b2'),ut[_0xefc2('0x115')](_0x2688c4,'agentreject'));hopperUtils[_0xefc2('0xe6')](_0x58ded0)[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x1b3')));if(_0x229d86['checkRetriveMax'](0x14,_0x2688c4,_0x451b73)&&!_0x2fba3d){if(_0x58ded0['countagentrejectretry']>=_0x451b73[_0xefc2('0x1b4')]){_0x229d86['createStateFinal'](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1b5'));}else{_0x229d86[_0xefc2('0x12d')](_0x58ded0,_0x4e869f,_0x47c7cc,_0xefc2('0x1b5'));}}break;default:_0x451b73[_0xefc2('0x134')]+=0x1;_0x58ded0['state']=0xc;_0x58ded0[_0xefc2('0x6f')]=_0x2c04e1[_0xefc2('0xc7')];_0x2d7fe3=_0x451b73['dialAgentRejectRetryFrequency'];_0x4a749=_0x451b73[_0xefc2('0xd7')];hopperUtils[_0xefc2('0xe6')](_0x58ded0)['catch'](loggerCatch(_0xefc2('0x1b6')));if(_0x229d86[_0xefc2('0x18e')](_0x2c04e1['reason'],_0x2688c4,_0x451b73)&&!_0x2fba3d){if(_0x58ded0[_0xefc2('0x11d')]+_0x58ded0[_0xefc2('0x11e')]+_0x58ded0[_0xefc2('0x11f')]+_0x58ded0[_0xefc2('0x120')]+_0x58ded0[_0xefc2('0xd6')]+_0x58ded0[_0xefc2('0xec')]+_0x58ded0[_0xefc2('0x11b')]+_0x58ded0[_0xefc2('0x121')]>=_0x451b73[_0xefc2('0x122')]){_0x229d86[_0xefc2('0x12d')](_0x58ded0,_0x4e869f,_0x47c7cc,_0x2c04e1[_0xefc2('0xc7')]);}else{_0x229d86[_0xefc2('0x125')](_0x58ded0,_0x4e869f,_0x47c7cc,_0x2c04e1[_0xefc2('0xc7')]);}}}})[_0xefc2('0xa3')](function(){if(_0x2fba3d){hopperUtils[_0xefc2('0xe8')](_0x58ded0,_0x2d7fe3,_0x4a749)[_0xefc2('0xa3')](function(){return _0x4e869f(0x1);});}});});};Dialer[_0xefc2('0x17')]['stateGlobal']=function(_0x5394ad,_0x3e75bc,_0x270a44,_0x2bfe6c){var _0x297d85=new Final(_0x5394ad);_0x297d85['state']=0xf;_0x297d85[_0xefc2('0x6f')]=_0xefc2('0x1b7');this[_0xefc2('0x125')](_0x297d85,_0x3e75bc,_0x270a44,_0x2bfe6c);};Dialer[_0xefc2('0x17')][_0xefc2('0x125')]=function(_0xd342d6,_0x250518,_0x3d2e5c,_0x50c8ab){hopperUtils[_0xefc2('0xcb')](_0xd342d6)['then'](function(){return _0x250518(msgResponse('[callProgressDetecting]',_0xefc2('0x108'),_0x50c8ab));})[_0xefc2('0xa7')](function(){return _0x3d2e5c(msgResponse('[moveContactManagedDialer][0]',_0xefc2('0x96'),_0xefc2('0x1b8')));});};Dialer[_0xefc2('0x17')][_0xefc2('0x9')]=function(_0x2fd79e){var _0x19ff01=_0x2fd79e[_0xefc2('0x1b9')]/0x64;var _0x6a0254=_0x2fd79e['outboundDropCallsDayTimeout']/(_0x2fd79e[_0xefc2('0xd2')]+_0x2fd79e[_0xefc2('0xc6')]);var _0x120e57=Math[_0xefc2('0x1ba')](_0x2fd79e[_0xefc2('0x1bb')]*(_0x2fd79e[_0xefc2('0x1bc')]/0x64));var _0x5e00a5=Math[_0xefc2('0x1ba')](_0x2fd79e[_0xefc2('0x1bb')]*(_0x2fd79e[_0xefc2('0x1bd')]/0x64));var _0x35e259=_0x2fd79e[_0xefc2('0x13a')]+_0x2fd79e[_0xefc2('0x13c')];var _0x2ea6d1=Math[_0xefc2('0x1be')](_0x2fd79e['erlangCalls']*_0x2fd79e[_0xefc2('0x59')]*_0x2fd79e[_0xefc2('0x1bf')]*_0x2fd79e[_0xefc2('0x1c0')]);if(_[_0xefc2('0x4e')](_0x2fd79e['startProgressive'])){if(!_[_0xefc2('0x4e')](_0x2fd79e[_0xefc2('0x60')])){_0x2fd79e[_0xefc2('0x60')]=undefined;loggerPredictive['error'](_0xefc2('0x1c1'),_0xefc2('0x1c2'));}if(!_[_0xefc2('0x4e')](_0x2fd79e[_0xefc2('0x62')])){loggerPredictive['error'](_0xefc2('0x1c1'),_0xefc2('0x1c3'));clearInterval(_0x2fd79e[_0xefc2('0x62')]);_0x2fd79e[_0xefc2('0x62')]=undefined;}_0x2fd79e[_0xefc2('0x24')]=moment()[_0xefc2('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xefc2('0x44')](_0x2fd79e[_0xefc2('0x41')],_0xefc2('0x1c4'),_0x2fd79e[_0xefc2('0x24')]);this['handlePower'](_0x2fd79e,0x1);}else if(ifInterval(_0x2fd79e[_0xefc2('0x1c5')],_0x2fd79e['startProgressive'])){this['handlePower'](_0x2fd79e,0x1);loggerPredictiveCalls[_0xefc2('0x44')](_0xefc2('0x1c6'),_0x2fd79e[_0xefc2('0x24')],_0x2fd79e[_0xefc2('0x41')]);_0x2fd79e[_0xefc2('0x55')]=0x0;_0x2fd79e[_0xefc2('0x1c7')]=0x0;}else if(_0x19ff01<_0x6a0254&&_0x2fd79e['dialPredictiveOptimization']===_0xefc2('0x1c8')){clearPredictiveAttributes(_0x2fd79e);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x1c9'),_0xefc2('0x1ca'),_0x6a0254,'startProgressive',_0x2fd79e['name']);}else if(_0x2ea6d1<_0x2fd79e['predictiveIntervalErlangCallsDroppedCalls']&&_0x2fd79e[_0xefc2('0x1cb')]===_0xefc2('0x1c8')){clearPredictiveAttributes(_0x2fd79e);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x1cc'),_0xefc2('0x1cd'),_0x2ea6d1,'Drop\x20in\x20this\x20interval',_0x2fd79e[_0xefc2('0x1c7')],_0xefc2('0x24'),_0x2fd79e['name']);}else if(!ifInterval(_0x2fd79e[_0xefc2('0x1c5')],_0x2fd79e[_0xefc2('0x24')])&&_[_0xefc2('0x4e')](_0x2fd79e[_0xefc2('0x60')])&&!_[_0xefc2('0x4e')](_0x2fd79e[_0xefc2('0x24')])){_0x2fd79e['startPredictive']=moment()[_0xefc2('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xefc2('0x44')](_0x2fd79e[_0xefc2('0x41')],_0xefc2('0x1ce'),_0x2fd79e[_0xefc2('0x60')]);hopperUtils[_0xefc2('0x1cf')](_0x2fd79e[_0xefc2('0x1c5')])['then'](this[_0xefc2('0x1d0')](_0x2fd79e))[_0xefc2('0xa3')](mergeDataErlangB(_0x2fd79e))['then'](this[_0xefc2('0x1d1')](_0x2fd79e))[_0xefc2('0xa7')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2fd79e));}else if(!ifInterval(_0x2fd79e[_0xefc2('0x1c5')],_0x2fd79e[_0xefc2('0x60')])){_0x2fd79e[_0xefc2('0x1c7')]=0x0;_0x2fd79e[_0xefc2('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2fd79e[_0xefc2('0x41')],_0xefc2('0x1d2'),_0x2fd79e[_0xefc2('0x60')]);clearInterval(_0x2fd79e['handlePredictive']);_0x2fd79e[_0xefc2('0x62')]=undefined;hopperUtils[_0xefc2('0x1cf')](_0x2fd79e[_0xefc2('0x1c5')])[_0xefc2('0xa3')](this[_0xefc2('0x1d0')](_0x2fd79e))['then'](mergeDataErlangB(_0x2fd79e))[_0xefc2('0xa3')](this[_0xefc2('0x1d1')](_0x2fd79e))['catch'](loggerCatchPredictive(_0xefc2('0x1d3'),_0x2fd79e));}else if(_0x2fd79e[_0xefc2('0x1bb')]&&_0x35e259<_0x2fd79e[_0xefc2('0x1bb')]-_0x5e00a5){clearPredictiveAttributes(_0x2fd79e);loggerPredictive[_0xefc2('0x44')](_0x2fd79e[_0xefc2('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x35e259,_0xefc2('0x1d4'),_0x2fd79e[_0xefc2('0x1bb')],'-',_0x5e00a5,'=',_0x2fd79e[_0xefc2('0x1bb')]-_0x5e00a5,')');}else if(_0x2fd79e[_0xefc2('0x1bb')]&&_0x35e259>_0x2fd79e['predictiveIntervalAvailable']+_0x120e57){clearPredictiveAttributes(_0x2fd79e);loggerPredictive[_0xefc2('0x44')](_0x2fd79e[_0xefc2('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x35e259,')\x20are\x20more\x20than\x20threshold\x20(',_0x2fd79e[_0xefc2('0x1bb')],'+',_0x120e57,'=',_0x2fd79e[_0xefc2('0x1bb')]+_0x120e57,')');}};Dialer['prototype'][_0xefc2('0x1d0')]=function(_0x2ebe8a){var _0x45592b=this;return function(_0x5bf612){return new Promise(function(_0x596c19,_0x50a8ac){_[_0xefc2('0x5c')](_0x2ebe8a,_0x5bf612[0x0]);if(checkGetDataPredictive(_0x5bf612[0x0])){var _0x4dac72=_0x2ebe8a[_0xefc2('0x1bb')]=_0x2ebe8a['talking']+_0x2ebe8a[_0xefc2('0x13a')];var _0x5c3d5c=_0x2ebe8a[_0xefc2('0x1c5')]*0x3c;var _0x474b31=_0x5bf612[0x0][_0xefc2('0x4f')]+_0x5bf612[0x0][_0xefc2('0x4b')];var _0x5ca08a=(_0x5bf612[0x0][_0xefc2('0x47')]+_0x5bf612[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5bf612[0x0][_0xefc2('0x49')])/_0x5bf612[0x0][_0xefc2('0x45')];_0x2ebe8a[_0xefc2('0x1bf')]=_0x5ca08a>0x0?_0x5ca08a:0x1;switch(_0x2ebe8a['dialPredictiveOptimization']){case _0xefc2('0x1c8'):var _0x2c8e08=_0x2ebe8a[_0xefc2('0x1b9')]/0x64;return _0x45592b[_0xefc2('0x1d5')](_0x4dac72,_0x5c3d5c,_0x474b31,_0x5ca08a,_0x2c8e08)[_0xefc2('0xa3')](function(_0x4d3fc1){return _0x596c19(_0x4d3fc1);});case'agentBusyFactor':var _0x202d7f=_0x2ebe8a[_0xefc2('0x1b9')]/0x64;return _0x45592b[_0xefc2('0x1d6')](_0x4dac72,_0x5c3d5c,_0x474b31,_0x5ca08a,_0x202d7f)[_0xefc2('0xa3')](function(_0x45616f){return _0x596c19(_0x45616f);});default:return _0x50a8ac(msgResponse(_0xefc2('0x1d7'),'Failure','Unknown\x20Predictive'));}}else{return _0x50a8ac(msgResponse('[getDataPredictive]',_0xefc2('0x96'),_0xefc2('0x1d8')));}});};};Dialer['prototype'][_0xefc2('0x1d9')]=function(_0x1bd1dd){var _0x38ef4c=this;return function(_0x1d95b8){return new Promise(function(_0x41dbc5,_0x452cfd){_['merge'](_0x1bd1dd,_0x1d95b8[0x0]);if(checkGetDataPredictive(_0x1d95b8[0x0])){loggerPredictive['info'](JSON[_0xefc2('0x87')](_0x1d95b8[0x0]));if(_0x1bd1dd[_0xefc2('0x1cb')]===_0xefc2('0x1c8')){return _0x38ef4c[_0xefc2('0x14e')](_0x1bd1dd['id'])[_0xefc2('0xa3')](function(_0x9bb492){var _0x23b30e=_0x1bd1dd[_0xefc2('0x1da')]-_0x9bb492[0x0][_0xefc2('0x1db')];var _0x4b4010=_0x1bd1dd['dialPredictiveInterval']*0x3c;var _0xbbe509=_0x1d95b8[0x0][_0xefc2('0x4f')]+_0x1d95b8[0x0][_0xefc2('0x4b')];var _0x28cfe0=(_0x1d95b8[0x0][_0xefc2('0x47')]+_0x1d95b8[0x0][_0xefc2('0xd1')]+_0x1d95b8[0x0][_0xefc2('0x49')])/_0x1d95b8[0x0][_0xefc2('0x45')];var _0x2ee05f=_0x1bd1dd[_0xefc2('0x1b9')]/0x64;_0x1bd1dd[_0xefc2('0x1dc')]=_0x9bb492[0x0][_0xefc2('0x1db')]||0x0;_0x1bd1dd[_0xefc2('0x1bf')]=_0x28cfe0>0x0?_0x28cfe0:0x1;return _0x38ef4c[_0xefc2('0x1d5')](_0x23b30e,_0x4b4010,_0xbbe509,_0x28cfe0,_0x2ee05f);})[_0xefc2('0xa3')](function(_0xd2fc2d){return _0x41dbc5(_0xd2fc2d);})[_0xefc2('0xa7')](function(_0x189acb){return _0x452cfd(msgResponse(_0xefc2('0x1dd'),_0xefc2('0x96'),JSON[_0xefc2('0x87')](_0x189acb)));});}if(_0x1bd1dd['dialPredictiveOptimization']==='agentBusyFactor'){return _0x38ef4c[_0xefc2('0x14e')](_0x1bd1dd['id'])['then'](function(_0xcc2d35){var _0x4ff4c2=_0x1bd1dd[_0xefc2('0x1da')]-_0xcc2d35[0x0][_0xefc2('0x1db')];var _0x3d5a95=_0x1bd1dd[_0xefc2('0x1c5')]*0x3c;var _0x86c283=_0x1d95b8[0x0][_0xefc2('0x4f')]+_0x1d95b8[0x0][_0xefc2('0x4b')];var _0x712ec1=(_0x1d95b8[0x0]['predictiveIntervalAnsweredCalls']+_0x1d95b8[0x0][_0xefc2('0xd1')]+_0x1d95b8[0x0][_0xefc2('0x49')])/_0x1d95b8[0x0][_0xefc2('0x45')];var _0x28edab=_0x1bd1dd[_0xefc2('0x1b9')]/0x64;_0x1bd1dd[_0xefc2('0x1dc')]=_0xcc2d35[0x0][_0xefc2('0x1db')]||0x0;_0x1bd1dd[_0xefc2('0x1bf')]=_0x712ec1>0x0?_0x712ec1:0x1;return _0x38ef4c[_0xefc2('0x1d6')](_0x4ff4c2,_0x3d5a95,_0x86c283,_0x712ec1,_0x28edab);})['then'](function(_0x49763f){return _0x41dbc5(_0x49763f);})['catch'](function(_0x5cba14){return _0x452cfd(msgResponse(_0xefc2('0x1dd'),_0xefc2('0x96'),JSON[_0xefc2('0x87')](_0x5cba14)));});}}else{return _0x452cfd(msgResponse('[getDataPredictive]',_0xefc2('0x96'),'check\x20failure'));}});};};Dialer[_0xefc2('0x17')][_0xefc2('0x1d1')]=function(_0x1f742e){var _0x276b42=this;return function(){var _0x3b282e=0x0;var _0x5df4f4=Math[_0xefc2('0x1be')](_0x1f742e[_0xefc2('0x57')]*0x3e8);if(_0x5df4f4>0x0){_0x5df4f4=_0x5df4f4<0x64?0x64:_0x5df4f4;loggerPredictive[_0xefc2('0x44')](_0x1f742e['name'],'one\x20call\x20every:',_0x5df4f4,_0xefc2('0x1de'));_0x1f742e[_0xefc2('0x62')]=setInterval(function(){_0x276b42[_0xefc2('0x62')](_0x1f742e);loggerPredictiveCalls[_0xefc2('0x44')]('[handlePredictive]',_0x3b282e+=0x1);},_0x5df4f4);}else{loggerPredictive['info'](_0x1f742e[_0xefc2('0x41')],_0xefc2('0x1df'));}};};Dialer[_0xefc2('0x17')][_0xefc2('0x1e0')]=function(_0x76e31a,_0x34e6a6){var _0x1e1739=this;return function(_0x1a4a7e){if(_['isEmpty'](_0x1a4a7e)){if(_[_0xefc2('0xf8')](_0x34e6a6[_0xefc2('0x155')])||!_0x34e6a6[_0xefc2('0x1e1')]){if(_0x76e31a[_0xefc2('0xb4')]===_0xefc2('0x8')){_0x76e31a[_0xefc2('0x71')]=_[_0xefc2('0x4e')](_0x76e31a[_0xefc2('0x71')])?!![]:_0x76e31a['queueStatusComplete'];var _0x29b09f=uuid['v4']();_0x1e1739[_0xefc2('0x22')][_0x29b09f]=new Action(_0x76e31a,_0x34e6a6,_0x29b09f);loggerBooked[_0xefc2('0x44')](_0xefc2('0x1e2'),_0x29b09f,'queueStatusComplete:\x20',JSON[_0xefc2('0x87')](_0x76e31a[_0xefc2('0x71')]),_0xefc2('0x1e3'),_0x76e31a[_0xefc2('0x41')]);if(_0x76e31a[_0xefc2('0x71')]){_0x76e31a['queueStatusComplete']=![];_0x1e1739['queueBooked'][_0x1e1739[_0xefc2('0x22')][_0x29b09f]['queue']]=[];ami['Action']({'actionid':_0x29b09f,'action':'queuestatus','queue':_0x76e31a['name']})['catch'](function(){_0x1e1739[_0xefc2('0xcd')](_0x76e31a);hopperUtils[_0xefc2('0xdc')]({'active':![],'ContactId':_0x1e1739[_0xefc2('0x22')][_0x29b09f]['ContactId'],'ListId':_0x1e1739[_0xefc2('0x22')][_0x29b09f][_0xefc2('0xe1')],'VoiceQueueId':_0x1e1739['actions'][_0x29b09f][_0xefc2('0xe2')]||undefined,'CampaignId':_0x1e1739[_0xefc2('0x22')][_0x29b09f]['CampaignId']||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x1e4')));delete _0x1e1739[_0xefc2('0x22')][_0x29b09f];});}else{loggerBooked[_0xefc2('0x44')](_0xefc2('0x1e5'),JSON[_0xefc2('0x87')](_0x76e31a['queueStatusComplete']),_0xefc2('0x1e3'),_0x76e31a[_0xefc2('0x41')]);_0x1e1739['updateOriginated'](_0x76e31a);hopperUtils[_0xefc2('0xdc')]({'active':![],'ContactId':_0x1e1739[_0xefc2('0x22')][_0x29b09f][_0xefc2('0xe0')],'ListId':_0x1e1739[_0xefc2('0x22')][_0x29b09f][_0xefc2('0xe1')],'VoiceQueueId':_0x1e1739[_0xefc2('0x22')][_0x29b09f][_0xefc2('0xe2')]||undefined,'CampaignId':_0x1e1739[_0xefc2('0x22')][_0x29b09f][_0xefc2('0xf1')]||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x1e4')));delete _0x1e1739[_0xefc2('0x22')][_0x29b09f];}}else{return _0x1e1739['actionOriginate'](_0x76e31a,_0x34e6a6);}}else{if(utils[_0xefc2('0x5d')](undefined,_0x34e6a6[_0xefc2('0x1e6')])<_0x76e31a[_0xefc2('0x1e7')]*0x3c){if(_0x34e6a6[_0xefc2('0x146')]&&!_0x34e6a6[_0xefc2('0x146')][_0xefc2('0x1e8')]){_0x1e1739[_0xefc2('0x1c')]['run'](_0x34e6a6['id'])[_0xefc2('0x1a')](function(){_0x1e1739[_0xefc2('0xcd')](_0x76e31a);});}else{hopperUtils[_0xefc2('0x1e9')]({'active':![]},_0x34e6a6['id'],0x1)[_0xefc2('0x1a')](function(){_0x1e1739[_0xefc2('0xcd')](_0x76e31a);});}}else{_0x76e31a['outboundReCallsDay']+=0x1;_0x1e1739[_0xefc2('0xcd')](_0x76e31a);if(_0x76e31a[_0xefc2('0x1ea')]){hopperUtils[_0xefc2('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x34e6a6[_0xefc2('0xe0')],'ListId':_0x34e6a6[_0xefc2('0xe1')],'VoiceQueueId':_0x34e6a6['VoiceQueueId']||undefined,'CampaignId':_0x34e6a6['CampaignId']||undefined})[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x1eb')));hopperUtils[_0xefc2('0xe6')](createObjHistory(_0x76e31a,_0x34e6a6,utils[_0xefc2('0x68')][_0xefc2('0x1ec')],0x17,_0xefc2('0x1ed')))[_0xefc2('0xa7')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x1e1739[_0xefc2('0x117')](createObjHistory(_0x76e31a,_0x34e6a6,utils['CAMPAIGN_STATUS'][_0xefc2('0x1ee')],0x16,_0xefc2('0x1ef')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x76e31a[_0xefc2('0x1f0')]+=0x1;_0x1e1739[_0xefc2('0x117')](createObjHistory(_0x76e31a,_0x34e6a6,utils[_0xefc2('0x68')]['BLACKLIST'],0xd,_0xefc2('0x1f1')),'[Originate][historyBlacklist]',_0xefc2('0x1f2'));throw _0xefc2('0x1f3');}};};Dialer[_0xefc2('0x17')][_0xefc2('0x1f4')]=function(_0x48c115){var _0x270a70=this;var _0x682ade=_0x48c115['limitCalls']-_0x48c115[_0xefc2('0x7e')]-_0x48c115[_0xefc2('0x1f5')];emitCampaignSummary(_0x48c115);if(_0x682ade>0x0){if(_0x682ade>this[_0xefc2('0x21')]){_0x682ade=this[_0xefc2('0x21')];}_0x48c115[_0xefc2('0x1f5')]+=_0x682ade;hopperUtils[_0xefc2('0x1f6')](_0x48c115['id'],_0x682ade,_0x48c115[_0xefc2('0x1f7')],_0x48c115)[_0xefc2('0xa3')](function(_0x5569d7){_0x48c115[_0xefc2('0x1f5')]-=_0x682ade;_0x48c115[_0xefc2('0x1f5')]=_0x48c115[_0xefc2('0x1f5')]>0x0?_0x48c115[_0xefc2('0x1f5')]:0x0;if(!utils[_0xefc2('0x1f8')](_0x5569d7)){_0x48c115[_0xefc2('0x6c')]=utils[_0xefc2('0x68')][_0xefc2('0x6d')];logger[_0xefc2('0x44')](_0xefc2('0x1f9')+_0x48c115['name']);}else{_0x48c115[_0xefc2('0x7e')]+=_0x5569d7['length'];_0x48c115['message']=utils[_0xefc2('0x68')][_0xefc2('0x1fa')];for(var _0x10f7ac=0x0;_0x10f7ac<_0x5569d7[_0xefc2('0x9d')];_0x10f7ac+=0x1){_0x48c115['ivrTotalCallsDays']+=0x1;if(_[_0xefc2('0xf8')](_0x5569d7[_0x10f7ac])||_[_0xefc2('0xf8')](_0x5569d7[_0x10f7ac][_0xefc2('0x173')])||_['isNil'](_0x5569d7[_0x10f7ac][_0xefc2('0x15b')])){_0x270a70[_0xefc2('0x153')](_0xefc2('0x1fb'),_0x48c115,_0x5569d7[_0x10f7ac]);}else{hopperUtils[_0xefc2('0x1fc')](_[_0xefc2('0x74')](_0x5569d7[_0x10f7ac],[_0xefc2('0xf1'),_0xefc2('0x15b')]))[_0xefc2('0xa3')](_0x270a70[_0xefc2('0x1e0')](_0x48c115,_0x5569d7[_0x10f7ac]))[_0xefc2('0xa7')](_0x270a70['loggerHandler'](_0xefc2('0x1fd'),_0x48c115));}}}})[_0xefc2('0xa7')](loggerGetContactDialer(_0xefc2('0x1fe'),_0x48c115,_0x682ade));}};Dialer['prototype'][_0xefc2('0xb6')]=function(_0x461bbb,_0x3d927c){var _0x5730d3=this;var _0x1c5dd0=[];if(_0x3d927c<0x1||_0x461bbb[_0xefc2('0xb4')]===_0xefc2('0x8')){_0x3d927c=0x1;}var _0x1a9d84=Math[_0xefc2('0x1be')](_0x461bbb[_0xefc2('0x13a')]*_0x3d927c)-_0x461bbb[_0xefc2('0x7e')]-_0x461bbb['temp'];if(_0x461bbb[_0xefc2('0x1ff')]>0x0){var _0x5badf7=_0x461bbb['dialLimitQueue']-_0x461bbb[_0xefc2('0x7e')]-_0x461bbb[_0xefc2('0x13c')]-_0x461bbb[_0xefc2('0x1f5')]-_0x461bbb[_0xefc2('0x200')];if(_0x1a9d84>_0x5badf7){_0x1a9d84=_0x5badf7;}}if(_0x1a9d84>0x0){if(_0x461bbb[_0xefc2('0xb4')]===_0xefc2('0x8')){_0x1a9d84=0x1;}if(_0x1a9d84>this[_0xefc2('0x21')]){_0x1a9d84=this[_0xefc2('0x21')];}_0x461bbb[_0xefc2('0x1f5')]+=_0x1a9d84;for(var _0x31256a in this[_0xefc2('0x1f')]){if(typeof this[_0xefc2('0x1f')][_0x31256a]!==_0xefc2('0x14c')){if(this[_0xefc2('0x1f')][_0x31256a]['state']==='not_inuse'&&this['agents'][_0x31256a]['status']==='reachable'){_0x1c5dd0[_0xefc2('0x9e')](this[_0xefc2('0x1f')][_0x31256a]['id']);}}}hopperUtils[_0xefc2('0x201')](_0x461bbb,_0x1c5dd0,_0x1a9d84)[_0xefc2('0xa3')](function(_0x5010e1){_0x461bbb['temp']-=_0x1a9d84;_0x461bbb[_0xefc2('0x1f5')]=_0x461bbb[_0xefc2('0x1f5')]>0x0?_0x461bbb[_0xefc2('0x1f5')]:0x0;if(!utils[_0xefc2('0x1f8')](_0x5010e1)){hopperUtils[_0xefc2('0x202')](_0x461bbb)[_0xefc2('0xa3')](sendMessageReschedule(_0x461bbb))[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x203')));}else{_0x461bbb[_0xefc2('0x7e')]+=_0x5010e1['length'];_0x461bbb['message']=_0x461bbb['dialMethod']==='booked'?utils[_0xefc2('0x68')]['ACTIVE']:utils[_0xefc2('0x68')]['RUNNING'];for(var _0x538d59=0x0;_0x538d59<_0x5010e1[_0xefc2('0x9d')];_0x538d59+=0x1){if(_['isNil'](_0x5010e1[_0x538d59])||_[_0xefc2('0xf8')](_0x5010e1[_0x538d59][_0xefc2('0x173')])||_['isNil'](_0x5010e1[_0x538d59][_0xefc2('0x15b')])){_0x5730d3[_0xefc2('0x153')](_0xefc2('0x1fb'),_0x461bbb,_0x5010e1[_0x538d59]);}else{hopperUtils['checkIsBlackList'](_[_0xefc2('0x74')](_0x5010e1[_0x538d59],[_0xefc2('0xe2'),'phone']))[_0xefc2('0xa3')](_0x5730d3[_0xefc2('0x1e0')](_0x461bbb,_0x5010e1[_0x538d59]))['catch'](_0x5730d3[_0xefc2('0x152')](_0xefc2('0x1fb'),_0x461bbb));}}}})[_0xefc2('0xa7')](loggerGetContactDialer(_0xefc2('0x204'),_0x461bbb,_0x1a9d84));}};Dialer['prototype'][_0xefc2('0x62')]=function(_0x337672){if(_0x337672[_0xefc2('0x1ff')]>0x0){var _0xe28ff3=_0x337672[_0xefc2('0x1ff')]-_0x337672[_0xefc2('0x7e')]-_0x337672[_0xefc2('0x13c')];if(_0xe28ff3>0x0){this[_0xefc2('0x205')](_0x337672);}else{loggerPredictiveCalls['info'](_0xefc2('0x206'));}}else{this['tryOriginatePredictive'](_0x337672);}};Dialer[_0xefc2('0x17')][_0xefc2('0x205')]=function(_0x98e2ef){var _0x55a577=this;var _0x46e208=[];_0x98e2ef[_0xefc2('0x7e')]+=0x1;for(var _0x43e73a in this[_0xefc2('0x1f')]){if(typeof this[_0xefc2('0x1f')][_0x43e73a]!=='undefined'){if(this[_0xefc2('0x1f')][_0x43e73a][_0xefc2('0xd3')]===_0xefc2('0x207')&&this[_0xefc2('0x1f')][_0x43e73a][_0xefc2('0x8b')]===_0xefc2('0x8c')){_0x46e208[_0xefc2('0x9e')](this[_0xefc2('0x1f')][_0x43e73a]['id']);}}}return this[_0xefc2('0x201')](_0x98e2ef['id'],_0x46e208,0x1,_0x98e2ef[_0xefc2('0x1f7')],_0x98e2ef)[_0xefc2('0xa3')](function(_0x140595){if(!utils[_0xefc2('0x1f8')](_0x140595)){utils['checkContactLowerLimitOriginate'](_0x98e2ef,0x1,0x0);return hopperUtils[_0xefc2('0x202')](_0x98e2ef)[_0xefc2('0xa3')](sendMessageReschedule(_0x98e2ef))[_0xefc2('0xa7')](loggerCatch(_0xefc2('0x203')));}else{_0x98e2ef[_0xefc2('0x6c')]=utils['CAMPAIGN_STATUS'][_0xefc2('0x1fa')];if(_['isNil'](_0x140595[0x0])||_[_0xefc2('0xf8')](_0x140595[0x0][_0xefc2('0x173')])||_['isNil'](_0x140595[0x0][_0xefc2('0x15b')])){_0x55a577[_0xefc2('0x153')](_0xefc2('0x1fb'),_0x98e2ef,_0x140595[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x140595[0x0],['VoiceQueueId',_0xefc2('0x15b')]))['then'](_0x55a577[_0xefc2('0x1e0')](_0x98e2ef,_0x140595[0x0]))[_0xefc2('0xa7')](_0x55a577[_0xefc2('0x152')](_0xefc2('0x208'),_0x98e2ef));}}})[_0xefc2('0xa7')](loggerGetContactDialer(_0xefc2('0x209'),_0x98e2ef,0x1));};Dialer['prototype'][_0xefc2('0x1d5')]=function(_0x1ba29a,_0x33a107,_0x48ef09,_0x193779,_0x24f481,_0x4c450c){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xefc2('0x20a'),_0x1ba29a);loggerPredictive[_0xefc2('0x44')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33a107);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x20b'),_0x48ef09);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x20c'),_0x193779);loggerPredictive[_0xefc2('0x44')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24f481);loggerPredictive[_0xefc2('0x44')]('---------------------------');return new Promise(function(_0xbe6709,_0x14dede){if(_0x1ba29a<=0x0||isNaN(_0x1ba29a)){return _0x14dede(msgResponse('[abandonmentRate]',_0xefc2('0x86'),_0xefc2('0x20d')+_0x1ba29a));}if(_0x48ef09<=0x0||isNaN(_0x48ef09)){return _0x14dede(msgResponse(_0xefc2('0x20e'),'Error',_0xefc2('0x20f')+_0x48ef09));}if(_0x193779<=0x0||isNaN(_0x193779)){return _0x14dede(msgResponse(_0xefc2('0x20e'),_0xefc2('0x86'),_0xefc2('0x210')+_0x193779));}if(_0x33a107<=0x0||isNaN(_0x33a107)){return _0x14dede(msgResponse(_0xefc2('0x20e'),'Error',_0xefc2('0x211')+_0x33a107));}if(_0x24f481<=0x0||isNaN(_0x24f481)){return _0x14dede(msgResponse('[abandonmentRate]',_0xefc2('0x86'),_0xefc2('0x212')+_0x24f481));}_0x4c450c=_0x4c450c||0x0;var _0x30a346=0x1/_0x48ef09;var _0x15dfcc=0x0;var _0x2ac4a4=0x0;var _0x3c3c08=0x0;var _0x50369a=0x0;for(var _0x59fbc2=0x0;_0x3c3c08<_0x24f481;_0x59fbc2+=0x1){_0x2ac4a4=_0x59fbc2/_0x33a107;_0x15dfcc=(_0x193779*_0x2ac4a4+_0x4c450c)/_0x30a346;_0x3c3c08=utils['erlangb'](_0x15dfcc,_0x1ba29a);_0x50369a=_0x15dfcc/_0x1ba29a*(0x1-utils[_0xefc2('0x213')](_0x15dfcc,_0x1ba29a));}return _0xbe6709({'erlangCalls':_0x59fbc2,'erlangCallToSecond':_0x33a107/_0x59fbc2,'erlangAbandonmentRate':_0x3c3c08,'erlangBusyFactor':_0x50369a});});};Dialer[_0xefc2('0x17')][_0xefc2('0x1d6')]=function(_0x3450da,_0xc98c25,_0x429945,_0x263924,_0x340a41,_0x23b961){loggerPredictive[_0xefc2('0x44')](_0xefc2('0x214'));loggerPredictive[_0xefc2('0x44')](_0xefc2('0x20a'),_0x3450da);loggerPredictive['info'](_0xefc2('0x215'),_0xc98c25);loggerPredictive['info'](_0xefc2('0x20b'),_0x429945);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x20c'),_0x263924);loggerPredictive[_0xefc2('0x44')](_0xefc2('0x216'),_0x340a41);loggerPredictive['info']('---------------------------');return new Promise(function(_0x3f239b,_0xb7b85b){if(_0x3450da<=0x0||isNaN(_0x3450da)){return _0xb7b85b(msgResponse(_0xefc2('0x217'),_0xefc2('0x86'),_0xefc2('0x20d')+_0x3450da));}if(_0x429945<=0x0||isNaN(_0x429945)){return _0xb7b85b(msgResponse('[busyFactor]','Error',_0xefc2('0x20f')+_0x429945));}if(_0x263924<=0x0||isNaN(_0x263924)){return _0xb7b85b(msgResponse(_0xefc2('0x217'),_0xefc2('0x86'),_0xefc2('0x210')+_0x263924));}if(_0xc98c25<=0x0||isNaN(_0xc98c25)){return _0xb7b85b(msgResponse(_0xefc2('0x217'),_0xefc2('0x86'),_0xefc2('0x211')+_0xc98c25));}if(_0x340a41<=0x0||isNaN(_0x340a41)){return _0xb7b85b(msgResponse(_0xefc2('0x217'),'Error',_0xefc2('0x218')+_0x340a41));}_0x23b961=_0x23b961||0x0;var _0xa8206f=0x1/_0x429945;var _0x3065ea=0x0;var _0x3a1f15=0x0;var _0xd15230=0x0;var _0x1337a2=0x0;for(var _0x1d9dd7=0x0;_0x1337a2<_0x340a41;_0x1d9dd7+=0x1){_0x3a1f15=_0x1d9dd7/_0xc98c25;_0x3065ea=(_0x263924*_0x3a1f15+_0x23b961)/_0xa8206f;_0xd15230=utils[_0xefc2('0x213')](_0x3065ea,_0x3450da);_0x1337a2=_0x3065ea/_0x3450da*(0x1-utils['erlangb'](_0x3065ea,_0x3450da));}return _0x3f239b({'erlangCalls':_0x1d9dd7,'erlangCallToSecond':_0xc98c25/_0x1d9dd7,'erlangAbandonmentRate':_0xd15230,'erlangBusyFactor':_0x1337a2});});};module[_0xefc2('0x219')]=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 a408450..82c44df 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 _0xca42=['getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype'];(function(_0x13b228,_0x5a74b7){var _0x35434d=function(_0x3828c3){while(--_0x3828c3){_0x13b228['push'](_0x13b228['shift']());}};_0x35434d(++_0x5a74b7);}(_0xca42,0x177));var _0x2ca4=function(_0x3c84ad,_0x397112){_0x3c84ad=_0x3c84ad-0x0;var _0x5f1a11=_0xca42[_0x3c84ad];return _0x5f1a11;};'use strict';var util=require(_0x2ca4('0x0'));var _=require(_0x2ca4('0x1'));var moment=require(_0x2ca4('0x2'));function checkNameSurname(_0x13826c,_0x52ff81,_0x5cbadb){var _0x58fbe4='';if(!_[_0x2ca4('0x3')](_0x52ff81)&&_0x2ca4('0x4')===typeof _0x52ff81){_0x58fbe4+=_0x52ff81;}if(!_[_0x2ca4('0x3')](_0x5cbadb)&&_0x2ca4('0x4')===typeof _0x5cbadb){_0x58fbe4+='\x20'+_0x5cbadb;}if(_0x58fbe4!==''){return _0x58fbe4;}return _0x13826c;}function Action(_0x4d5d24,_0x30de7d,_0x5aca3f){this['voiceQueue']=_0x4d5d24;this[_0x2ca4('0x5')]=_0x5aca3f||undefined;this[_0x2ca4('0x6')]=checkNameSurname(_0x30de7d[_0x2ca4('0x7')][_0x2ca4('0x8')],_0x30de7d[_0x2ca4('0x7')][_0x2ca4('0x9')],_0x30de7d[_0x2ca4('0x7')]['lastName']);this[_0x2ca4('0xa')]=_0x30de7d[_0x2ca4('0x8')];this[_0x2ca4('0xb')]=_0x4d5d24[_0x2ca4('0x6')];this[_0x2ca4('0xc')]=_0x30de7d[_0x2ca4('0xc')]||![];this[_0x2ca4('0xd')]=_0x4d5d24[_0x2ca4('0xd')];this[_0x2ca4('0xe')]=_0x4d5d24[_0x2ca4('0xe')]||0x3;this[_0x2ca4('0xf')]=_0x30de7d[_0x2ca4('0xf')];this[_0x2ca4('0x10')]=_0x30de7d[_0x2ca4('0x10')];this['countcongestionretry']=_0x30de7d[_0x2ca4('0x11')];this[_0x2ca4('0x12')]=_0x30de7d[_0x2ca4('0x12')];this[_0x2ca4('0x13')]=_0x30de7d[_0x2ca4('0x13')];this[_0x2ca4('0x14')]=_0x30de7d[_0x2ca4('0x14')];this[_0x2ca4('0x15')]=_0x30de7d['countabandonedretry'];this['countmachineretry']=_0x30de7d['countmachineretry'];this['countagentrejectretry']=_0x30de7d[_0x2ca4('0x16')];this[_0x2ca4('0x17')]=_0x30de7d[_0x2ca4('0x17')];this[_0x2ca4('0x18')]=_0x30de7d[_0x2ca4('0x18')];this[_0x2ca4('0x19')]=_0x30de7d[_0x2ca4('0x19')];this[_0x2ca4('0x1a')]=_0x30de7d[_0x2ca4('0x1a')];this[_0x2ca4('0x1b')]=_0x30de7d['CampaignId'];this['idHopper']=_0x30de7d['id'];this[_0x2ca4('0x1c')]=_0x30de7d[_0x2ca4('0x7')]['firstName']||'';this[_0x2ca4('0x1d')]=moment()[_0x2ca4('0x1e')](_0x2ca4('0x1f'));this[_0x2ca4('0x20')]=_0x30de7d['callback'];this[_0x2ca4('0x21')]=_0x30de7d[_0x2ca4('0x21')];this[_0x2ca4('0x22')]=_0x30de7d[_0x2ca4('0x22')];this[_0x2ca4('0x23')]=_0x30de7d[_0x2ca4('0x23')];this[_0x2ca4('0x24')]='';this[_0x2ca4('0x25')]='';}Action[_0x2ca4('0x26')][_0x2ca4('0x27')]=function(){return util[_0x2ca4('0x1e')](_0x2ca4('0x28'),this[_0x2ca4('0x6')],this[_0x2ca4('0x29')][_0x2ca4('0x2a')]>0x0?this[_0x2ca4('0xa')][_0x2ca4('0x2b')](this[_0x2ca4('0x29')][_0x2ca4('0x2a')]):this[_0x2ca4('0xa')]);};Action[_0x2ca4('0x26')][_0x2ca4('0x2c')]=function(){return this['queue'];};module[_0x2ca4('0x2d')]=Action; \ No newline at end of file +var _0xdcca=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','Contact','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','dialCutDigit','number','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','lastName','phone','queue','active'];(function(_0x3817b1,_0x97e1bf){var _0x2a6d08=function(_0x434cb1){while(--_0x434cb1){_0x3817b1['push'](_0x3817b1['shift']());}};_0x2a6d08(++_0x97e1bf);}(_0xdcca,0xa1));var _0xadcc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcca[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xadcc('0x0'));var _=require('lodash');var moment=require(_0xadcc('0x1'));function checkNameSurname(_0x3a56b9,_0x5a1e4a,_0x369c49){var _0x5b1f59='';if(!_[_0xadcc('0x2')](_0x5a1e4a)&&_0xadcc('0x3')===typeof _0x5a1e4a){_0x5b1f59+=_0x5a1e4a;}if(!_[_0xadcc('0x2')](_0x369c49)&&'string'===typeof _0x369c49){_0x5b1f59+='\x20'+_0x369c49;}if(_0x5b1f59!==''){return _0x5b1f59;}return _0x3a56b9;}function Action(_0x4a9c58,_0x32056c,_0x74a589){this[_0xadcc('0x4')]=_0x4a9c58;this[_0xadcc('0x5')]=_0x74a589||undefined;this[_0xadcc('0x6')]=checkNameSurname(_0x32056c['Contact']['phone'],_0x32056c['Contact']['firstName'],_0x32056c['Contact'][_0xadcc('0x7')]);this['number']=_0x32056c[_0xadcc('0x8')];this[_0xadcc('0x9')]=_0x4a9c58[_0xadcc('0x6')];this[_0xadcc('0xa')]=_0x32056c[_0xadcc('0xa')]||![];this['type']=_0x4a9c58[_0xadcc('0xb')];this[_0xadcc('0xc')]=_0x4a9c58['dialQueueTimeout']||0x3;this[_0xadcc('0xd')]=_0x32056c[_0xadcc('0xd')];this[_0xadcc('0xe')]=_0x32056c[_0xadcc('0xe')];this[_0xadcc('0xf')]=_0x32056c[_0xadcc('0xf')];this[_0xadcc('0x10')]=_0x32056c[_0xadcc('0x10')];this[_0xadcc('0x11')]=_0x32056c[_0xadcc('0x11')];this[_0xadcc('0x12')]=_0x32056c[_0xadcc('0x12')];this[_0xadcc('0x13')]=_0x32056c[_0xadcc('0x13')];this[_0xadcc('0x14')]=_0x32056c[_0xadcc('0x14')];this[_0xadcc('0x15')]=_0x32056c['countagentrejectretry'];this['ContactId']=_0x32056c[_0xadcc('0x16')];this[_0xadcc('0x17')]=_0x32056c[_0xadcc('0x17')];this[_0xadcc('0x18')]=_0x32056c[_0xadcc('0x18')];this['VoiceQueueId']=_0x32056c[_0xadcc('0x19')];this['CampaignId']=_0x32056c[_0xadcc('0x1a')];this[_0xadcc('0x1b')]=_0x32056c['id'];this[_0xadcc('0x1c')]=_0x32056c[_0xadcc('0x1d')]['firstName']||'';this['starttime']=moment()[_0xadcc('0x1e')](_0xadcc('0x1f'));this[_0xadcc('0x20')]=_0x32056c[_0xadcc('0x20')];this[_0xadcc('0x21')]=_0x32056c[_0xadcc('0x21')];this[_0xadcc('0x22')]=_0x32056c[_0xadcc('0x22')];this[_0xadcc('0x23')]=_0x32056c[_0xadcc('0x23')];this[_0xadcc('0x24')]='';this['originatecalleridname']='';}Action[_0xadcc('0x25')][_0xadcc('0x26')]=function(){return util[_0xadcc('0x1e')]('\x22%s\x22\x20<%s>',this[_0xadcc('0x6')],this[_0xadcc('0x4')][_0xadcc('0x27')]>0x0?this['number']['substring'](this['voiceQueue'][_0xadcc('0x27')]):this[_0xadcc('0x28')]);};Action[_0xadcc('0x25')][_0xadcc('0x29')]=function(){return this[_0xadcc('0x9')];};module[_0xadcc('0x2a')]=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 3e002ec..3939160 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 _0x60a1=['Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','endtime','membername','reason','callback','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc'];(function(_0x13edaf,_0x2e98a1){var _0x65774=function(_0x2b8197){while(--_0x2b8197){_0x13edaf['push'](_0x13edaf['shift']());}};_0x65774(++_0x2e98a1);}(_0x60a1,0xce));var _0x160a=function(_0xb34015,_0x460b8e){_0xb34015=_0xb34015-0x0;var _0x398652=_0x60a1[_0xb34015];return _0x398652;};'use strict';var moment=require(_0x160a('0x0'));var utils=require(_0x160a('0x1'));function AgentComplete(_0x1f46d5,_0x26f228){this[_0x160a('0x2')]=0x4;this[_0x160a('0x3')]=_0x160a('0x4');this[_0x160a('0x5')]=_0x1f46d5[_0x160a('0x5')];this[_0x160a('0x6')]=_0x1f46d5[_0x160a('0x6')];this[_0x160a('0x7')]=_0x1f46d5[_0x160a('0x6')]==='outbound'?_0x160a('0x8'):_0x1f46d5[_0x160a('0x6')];this[_0x160a('0x9')]=_0x1f46d5[_0x160a('0x9')];this[_0x160a('0xa')]=_0x1f46d5['countcongestionretry'];this[_0x160a('0xb')]=_0x1f46d5['countnoanswerretry'];this['countglobal']=_0x1f46d5['countbusyretry']+_0x1f46d5['countcongestionretry']+_0x1f46d5[_0x160a('0xb')]+_0x1f46d5['countnosuchnumberretry']+_0x1f46d5['countdropretry']+_0x1f46d5[_0x160a('0xc')]+_0x1f46d5[_0x160a('0xd')]+_0x1f46d5['countagentrejectretry'];this['countnosuchnumberretry']=_0x1f46d5[_0x160a('0xe')];this['countdropretry']=_0x1f46d5['countdropretry'];this[_0x160a('0xc')]=_0x1f46d5[_0x160a('0xc')];this[_0x160a('0xd')]=_0x1f46d5[_0x160a('0xd')];this['countagentrejectretry']=_0x1f46d5['countagentrejectretry'];this[_0x160a('0xf')]=_0x26f228[_0x160a('0xf')];this[_0x160a('0x10')]=_0x1f46d5[_0x160a('0x11')];this[_0x160a('0x12')]=_0x1f46d5[_0x160a('0x13')];this[_0x160a('0x14')]=_0x1f46d5[_0x160a('0x14')];this['responsetime']=_0x1f46d5[_0x160a('0x15')];this[_0x160a('0x16')]=_0x1f46d5[_0x160a('0x16')];this['endtime']=moment()[_0x160a('0x17')](_0x160a('0x18'));this[_0x160a('0x19')]=utils[_0x160a('0x1a')](_0x1f46d5[_0x160a('0x15')],_0x1f46d5[_0x160a('0x14')]);this['holdtime']=utils[_0x160a('0x1a')](_0x1f46d5['answertime'],_0x1f46d5[_0x160a('0x15')]);this[_0x160a('0x1b')]=utils[_0x160a('0x1a')](this[_0x160a('0x1c')],_0x1f46d5[_0x160a('0x16')]);this[_0x160a('0x8')]=_0x26f228[_0x160a('0x8')];this[_0x160a('0x1d')]=_0x26f228[_0x160a('0x1d')];this[_0x160a('0x1e')]=_0x26f228[_0x160a('0x1e')];this[_0x160a('0x1f')]=_0x1f46d5[_0x160a('0x1f')];this['callbackuniqueid']=_0x1f46d5['callbackuniqueid'];this[_0x160a('0x20')]=_0x1f46d5[_0x160a('0x20')];this[_0x160a('0x21')]=_0x1f46d5['recallme'];this['ContactId']=_0x1f46d5['ContactId'];this[_0x160a('0x22')]=_0x1f46d5['ListId'];this[_0x160a('0x23')]=_0x1f46d5[_0x160a('0x23')];this[_0x160a('0x24')]=_0x1f46d5['VoiceQueueId'];this[_0x160a('0x25')]=_0x1f46d5[_0x160a('0x25')];this['originatecalleridnum']=_0x1f46d5[_0x160a('0x26')]||'';this[_0x160a('0x27')]=_0x1f46d5[_0x160a('0x27')]||'';this['agiafterat']=_0x1f46d5[_0x160a('0x28')];}module[_0x160a('0x29')]=AgentComplete; \ No newline at end of file +var _0x906d=['exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x906d,0xbd));var _0xd906=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x906d[_0x22b68a];return _0x1ac67a;};'use strict';var moment=require(_0xd906('0x0'));var utils=require(_0xd906('0x1'));function AgentComplete(_0x4a4410,_0x4c10b1){this[_0xd906('0x2')]=0x4;this['statedesc']=_0xd906('0x3');this[_0xd906('0x4')]=_0x4a4410['scheduledat'];this[_0xd906('0x5')]=_0x4a4410['type'];this[_0xd906('0x6')]=_0x4a4410[_0xd906('0x5')]===_0xd906('0x7')?_0xd906('0x8'):_0x4a4410[_0xd906('0x5')];this[_0xd906('0x9')]=_0x4a4410[_0xd906('0x9')];this[_0xd906('0xa')]=_0x4a4410[_0xd906('0xa')];this['countnoanswerretry']=_0x4a4410[_0xd906('0xb')];this[_0xd906('0xc')]=_0x4a4410['countbusyretry']+_0x4a4410[_0xd906('0xa')]+_0x4a4410[_0xd906('0xb')]+_0x4a4410['countnosuchnumberretry']+_0x4a4410[_0xd906('0xd')]+_0x4a4410['countabandonedretry']+_0x4a4410[_0xd906('0xe')]+_0x4a4410[_0xd906('0xf')];this[_0xd906('0x10')]=_0x4a4410[_0xd906('0x10')];this[_0xd906('0xd')]=_0x4a4410['countdropretry'];this[_0xd906('0x11')]=_0x4a4410[_0xd906('0x11')];this[_0xd906('0xe')]=_0x4a4410[_0xd906('0xe')];this[_0xd906('0xf')]=_0x4a4410[_0xd906('0xf')];this[_0xd906('0x12')]=_0x4c10b1[_0xd906('0x12')];this[_0xd906('0x13')]=_0x4a4410[_0xd906('0x14')];this[_0xd906('0x15')]=_0x4a4410[_0xd906('0x16')];this[_0xd906('0x17')]=_0x4a4410[_0xd906('0x17')];this['responsetime']=_0x4a4410[_0xd906('0x18')];this['answertime']=_0x4a4410[_0xd906('0x19')];this[_0xd906('0x1a')]=moment()[_0xd906('0x1b')](_0xd906('0x1c'));this[_0xd906('0x1d')]=utils['getSeconds'](_0x4a4410[_0xd906('0x18')],_0x4a4410[_0xd906('0x17')]);this['holdtime']=utils[_0xd906('0x1e')](_0x4a4410[_0xd906('0x19')],_0x4a4410[_0xd906('0x18')]);this[_0xd906('0x1f')]=utils[_0xd906('0x1e')](this[_0xd906('0x1a')],_0x4a4410[_0xd906('0x19')]);this[_0xd906('0x8')]=_0x4c10b1[_0xd906('0x8')];this[_0xd906('0x20')]=_0x4c10b1['membername'];this[_0xd906('0x21')]=_0x4c10b1[_0xd906('0x21')];this[_0xd906('0x22')]=_0x4a4410[_0xd906('0x22')];this['callbackuniqueid']=_0x4a4410[_0xd906('0x23')];this[_0xd906('0x24')]=_0x4a4410[_0xd906('0x24')];this[_0xd906('0x25')]=_0x4a4410['recallme'];this[_0xd906('0x26')]=_0x4a4410[_0xd906('0x26')];this[_0xd906('0x27')]=_0x4a4410['ListId'];this[_0xd906('0x28')]=_0x4a4410[_0xd906('0x28')];this[_0xd906('0x29')]=_0x4a4410[_0xd906('0x29')];this[_0xd906('0x2a')]=_0x4a4410[_0xd906('0x2a')];this[_0xd906('0x2b')]=_0x4a4410[_0xd906('0x2b')]||'';this[_0xd906('0x2c')]=_0x4a4410['originatecalleridname']||'';this[_0xd906('0x2d')]=_0x4a4410[_0xd906('0x2d')];}module[_0xd906('0x2e')]=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 690b2fa..7e956d3 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 _0x8ff0=['originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x346451,_0x58bd82){var _0xaa8b67=function(_0xd257d2){while(--_0xd257d2){_0x346451['push'](_0x346451['shift']());}};_0xaa8b67(++_0x58bd82);}(_0x8ff0,0x1d2));var _0x08ff=function(_0x5b1f65,_0x1b5cb4){_0x5b1f65=_0x5b1f65-0x0;var _0x290cc6=_0x8ff0[_0x5b1f65];return _0x290cc6;};'use strict';function Final(_0x3cf032){this[_0x08ff('0x0')]=_0x3cf032[_0x08ff('0x0')];this[_0x08ff('0x1')]=_0x3cf032[_0x08ff('0x1')];this['type']=_0x3cf032[_0x08ff('0x2')];this[_0x08ff('0x3')]=_0x3cf032[_0x08ff('0x2')]==='outbound'?_0x08ff('0x4'):_0x3cf032[_0x08ff('0x2')];this[_0x08ff('0x5')]=_0x3cf032['countbusyretry'];this[_0x08ff('0x6')]=_0x3cf032[_0x08ff('0x6')];this['countnoanswerretry']=_0x3cf032['countnoanswerretry'];this[_0x08ff('0x7')]=_0x3cf032['countbusyretry']+_0x3cf032[_0x08ff('0x6')]+_0x3cf032[_0x08ff('0x8')]+_0x3cf032[_0x08ff('0x9')]+_0x3cf032[_0x08ff('0xa')]+_0x3cf032[_0x08ff('0xb')]+_0x3cf032['countmachineretry']+_0x3cf032[_0x08ff('0xc')];this['countnosuchnumberretry']=_0x3cf032[_0x08ff('0x9')];this[_0x08ff('0xa')]=_0x3cf032[_0x08ff('0xa')];this['countabandonedretry']=_0x3cf032['countabandonedretry'];this['countmachineretry']=_0x3cf032[_0x08ff('0xd')];this[_0x08ff('0xc')]=_0x3cf032[_0x08ff('0xc')];this[_0x08ff('0x4')]=_0x3cf032[_0x08ff('0x4')];this[_0x08ff('0xe')]=_0x3cf032['calleridname'];this['calleridnum']=_0x3cf032[_0x08ff('0xf')];this['starttime']=_0x3cf032[_0x08ff('0x10')];this[_0x08ff('0x11')]=_0x3cf032['responsetime'];this['endtime']=_0x3cf032['responsetime'];this[_0x08ff('0x12')]=_0x3cf032['ringtime']||0x0;this[_0x08ff('0x13')]=_0x3cf032['holdtime']||0x0;this[_0x08ff('0x14')]=_0x3cf032[_0x08ff('0x14')]||0x0;this[_0x08ff('0x15')]=_0x3cf032[_0x08ff('0x15')];this['callbackuniqueid']=_0x3cf032[_0x08ff('0x16')];this['callbackat']=_0x3cf032['callbackat'];this[_0x08ff('0x17')]=_0x3cf032[_0x08ff('0x17')];this['ContactId']=_0x3cf032[_0x08ff('0x18')];this[_0x08ff('0x19')]=_0x3cf032[_0x08ff('0x19')];this['UserId']=_0x3cf032[_0x08ff('0x1a')];this[_0x08ff('0x1b')]=_0x3cf032['VoiceQueueId'];this[_0x08ff('0x1c')]=_0x3cf032[_0x08ff('0x1c')];this[_0x08ff('0x1d')]=_0x3cf032[_0x08ff('0x1d')]||'';this[_0x08ff('0x1e')]=_0x3cf032[_0x08ff('0x1e')]||'';this[_0x08ff('0x1f')]=_0x3cf032['state'];this[_0x08ff('0x20')]=_0x3cf032[_0x08ff('0x20')];}module['exports']=Final; \ No newline at end of file +var _0xe459=['scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xe459,0x1b9));var _0x9e45=function(_0x25dafc,_0x170eb0){_0x25dafc=_0x25dafc-0x0;var _0x40f403=_0xe459[_0x25dafc];return _0x40f403;};'use strict';function Final(_0x58a876){this[_0x9e45('0x0')]=_0x58a876[_0x9e45('0x0')];this[_0x9e45('0x1')]=_0x58a876[_0x9e45('0x1')];this['type']=_0x58a876[_0x9e45('0x2')];this['campaigntype']=_0x58a876[_0x9e45('0x2')]===_0x9e45('0x3')?_0x9e45('0x4'):_0x58a876[_0x9e45('0x2')];this['countbusyretry']=_0x58a876['countbusyretry'];this[_0x9e45('0x5')]=_0x58a876[_0x9e45('0x5')];this[_0x9e45('0x6')]=_0x58a876[_0x9e45('0x6')];this[_0x9e45('0x7')]=_0x58a876['countbusyretry']+_0x58a876[_0x9e45('0x5')]+_0x58a876['countnoanswerretry']+_0x58a876[_0x9e45('0x8')]+_0x58a876['countdropretry']+_0x58a876[_0x9e45('0x9')]+_0x58a876['countmachineretry']+_0x58a876['countagentrejectretry'];this[_0x9e45('0x8')]=_0x58a876['countnosuchnumberretry'];this[_0x9e45('0xa')]=_0x58a876['countdropretry'];this[_0x9e45('0x9')]=_0x58a876[_0x9e45('0x9')];this[_0x9e45('0xb')]=_0x58a876['countmachineretry'];this[_0x9e45('0xc')]=_0x58a876['countagentrejectretry'];this['queue']=_0x58a876['queue'];this[_0x9e45('0xd')]=_0x58a876[_0x9e45('0xd')];this[_0x9e45('0xe')]=_0x58a876[_0x9e45('0xe')];this['starttime']=_0x58a876[_0x9e45('0xf')];this[_0x9e45('0x10')]=_0x58a876['responsetime'];this[_0x9e45('0x11')]=_0x58a876[_0x9e45('0x10')];this[_0x9e45('0x12')]=_0x58a876[_0x9e45('0x12')]||0x0;this[_0x9e45('0x13')]=_0x58a876[_0x9e45('0x13')]||0x0;this['talktime']=_0x58a876['talktime']||0x0;this[_0x9e45('0x14')]=_0x58a876[_0x9e45('0x14')];this[_0x9e45('0x15')]=_0x58a876[_0x9e45('0x15')];this['callbackat']=_0x58a876[_0x9e45('0x16')];this[_0x9e45('0x17')]=_0x58a876[_0x9e45('0x17')];this[_0x9e45('0x18')]=_0x58a876[_0x9e45('0x18')];this[_0x9e45('0x19')]=_0x58a876['ListId'];this['UserId']=_0x58a876[_0x9e45('0x1a')];this[_0x9e45('0x1b')]=_0x58a876[_0x9e45('0x1b')];this[_0x9e45('0x1c')]=_0x58a876[_0x9e45('0x1c')];this[_0x9e45('0x1d')]=_0x58a876[_0x9e45('0x1d')]||'';this[_0x9e45('0x1e')]=_0x58a876['originatecalleridname']||'';this['state']=_0x58a876[_0x9e45('0x1f')];this[_0x9e45('0x20')]=_0x58a876['statedesc'];}module[_0x9e45('0x21')]=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 966cc48..0a35b48 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 _0x074e=['YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format'];(function(_0x416c6e,_0x120569){var _0x1deb84=function(_0x1e6aba){while(--_0x1e6aba){_0x416c6e['push'](_0x416c6e['shift']());}};_0x1deb84(++_0x120569);}(_0x074e,0xbd));var _0xe074=function(_0x9647da,_0x1f7117){_0x9647da=_0x9647da-0x0;var _0x25c414=_0x074e[_0x9647da];return _0x25c414;};'use strict';var moment=require('moment');var utils=require(_0xe074('0x0'));function Hangup(_0x45a7f0,_0x3c5260){this[_0xe074('0x1')]=0x4;this['statedesc']=_0xe074('0x2');this['scheduledat']=_0x45a7f0[_0xe074('0x3')];this[_0xe074('0x4')]=_0x45a7f0['type'];this[_0xe074('0x5')]=_0x45a7f0[_0xe074('0x4')]===_0xe074('0x6')?_0xe074('0x7'):_0x45a7f0[_0xe074('0x4')];this['amd']=_0x45a7f0[_0xe074('0x8')]||![];this[_0xe074('0x9')]=_0x45a7f0[_0xe074('0x9')];this[_0xe074('0xa')]=_0x45a7f0[_0xe074('0xa')];this[_0xe074('0xb')]=_0x45a7f0[_0xe074('0xb')];this['countglobal']=_0x45a7f0[_0xe074('0x9')]+_0x45a7f0[_0xe074('0xa')]+_0x45a7f0['countnoanswerretry']+_0x45a7f0['countnosuchnumberretry']+_0x45a7f0[_0xe074('0xc')]+_0x45a7f0[_0xe074('0xd')]+_0x45a7f0[_0xe074('0xe')]+_0x45a7f0[_0xe074('0xf')];this[_0xe074('0x10')]=_0x45a7f0[_0xe074('0x10')];this[_0xe074('0xc')]=_0x45a7f0[_0xe074('0xc')];this['countabandonedretry']=_0x45a7f0[_0xe074('0xd')];this[_0xe074('0xe')]=_0x45a7f0[_0xe074('0xe')];this[_0xe074('0xf')]=_0x45a7f0['countagentrejectretry'];this[_0xe074('0x11')]=_0x3c5260[_0xe074('0x11')];this[_0xe074('0x12')]=_0x45a7f0[_0xe074('0x13')];this[_0xe074('0x14')]=_0x45a7f0[_0xe074('0x15')];this[_0xe074('0x16')]=_0x45a7f0[_0xe074('0x16')];this['responsetime']=_0x45a7f0[_0xe074('0x17')];this[_0xe074('0x18')]=moment()[_0xe074('0x19')](_0xe074('0x1a'));this[_0xe074('0x1b')]=utils['getSeconds'](_0x45a7f0[_0xe074('0x17')],_0x45a7f0['starttime']);this[_0xe074('0x1c')]=0x0;this[_0xe074('0x1d')]=utils[_0xe074('0x1e')](this[_0xe074('0x18')],_0x45a7f0['responsetime']);this['queue']=_0x45a7f0[_0xe074('0x7')];this['membername']=_0xe074('0x1f');this[_0xe074('0x20')]=_0x3c5260['cause-txt'];this[_0xe074('0x21')]=_0x45a7f0['callback'];this[_0xe074('0x22')]=_0x45a7f0[_0xe074('0x22')];this[_0xe074('0x23')]=_0x45a7f0['callbackat'];this[_0xe074('0x24')]=_0x45a7f0['recallme'];this[_0xe074('0x25')]=_0x45a7f0[_0xe074('0x25')];this[_0xe074('0x26')]=_0x45a7f0[_0xe074('0x26')];this[_0xe074('0x27')]=_0x45a7f0[_0xe074('0x27')];this[_0xe074('0x28')]=_0x45a7f0[_0xe074('0x28')];this[_0xe074('0x29')]=_0x45a7f0[_0xe074('0x29')];}module[_0xe074('0x2a')]=Hangup; \ No newline at end of file +var _0x88c8=['type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','../utils','state','scheduledat'];(function(_0x244e6f,_0x19aa0f){var _0x3585d3=function(_0x424ab2){while(--_0x424ab2){_0x244e6f['push'](_0x244e6f['shift']());}};_0x3585d3(++_0x19aa0f);}(_0x88c8,0xca));var _0x888c=function(_0x1621f3,_0x251dc5){_0x1621f3=_0x1621f3-0x0;var _0x39afba=_0x88c8[_0x1621f3];return _0x39afba;};'use strict';var moment=require('moment');var utils=require(_0x888c('0x0'));function Hangup(_0x3963cd,_0x3d13e){this[_0x888c('0x1')]=0x4;this['statedesc']='Answer';this[_0x888c('0x2')]=_0x3963cd[_0x888c('0x2')];this[_0x888c('0x3')]=_0x3963cd[_0x888c('0x3')];this[_0x888c('0x4')]=_0x3963cd[_0x888c('0x3')]===_0x888c('0x5')?_0x888c('0x6'):_0x3963cd[_0x888c('0x3')];this[_0x888c('0x7')]=_0x3963cd[_0x888c('0x7')]||![];this[_0x888c('0x8')]=_0x3963cd['countbusyretry'];this['countcongestionretry']=_0x3963cd[_0x888c('0x9')];this[_0x888c('0xa')]=_0x3963cd[_0x888c('0xa')];this[_0x888c('0xb')]=_0x3963cd[_0x888c('0x8')]+_0x3963cd[_0x888c('0x9')]+_0x3963cd[_0x888c('0xa')]+_0x3963cd['countnosuchnumberretry']+_0x3963cd[_0x888c('0xc')]+_0x3963cd[_0x888c('0xd')]+_0x3963cd[_0x888c('0xe')]+_0x3963cd['countagentrejectretry'];this['countnosuchnumberretry']=_0x3963cd[_0x888c('0xf')];this[_0x888c('0xc')]=_0x3963cd[_0x888c('0xc')];this[_0x888c('0xd')]=_0x3963cd['countabandonedretry'];this[_0x888c('0xe')]=_0x3963cd['countmachineretry'];this[_0x888c('0x10')]=_0x3963cd[_0x888c('0x10')];this[_0x888c('0x11')]=_0x3d13e[_0x888c('0x11')];this[_0x888c('0x12')]=_0x3963cd[_0x888c('0x13')];this[_0x888c('0x14')]=_0x3963cd[_0x888c('0x15')];this[_0x888c('0x16')]=_0x3963cd[_0x888c('0x16')];this[_0x888c('0x17')]=_0x3963cd['responsetime'];this[_0x888c('0x18')]=moment()[_0x888c('0x19')](_0x888c('0x1a'));this[_0x888c('0x1b')]=utils[_0x888c('0x1c')](_0x3963cd[_0x888c('0x17')],_0x3963cd[_0x888c('0x16')]);this['holdtime']=0x0;this[_0x888c('0x1d')]=utils[_0x888c('0x1c')](this[_0x888c('0x18')],_0x3963cd[_0x888c('0x17')]);this[_0x888c('0x6')]=_0x3963cd[_0x888c('0x6')];this[_0x888c('0x1e')]='IVR';this['reason']=_0x3d13e[_0x888c('0x1f')];this['callback']=_0x3963cd[_0x888c('0x20')];this[_0x888c('0x21')]=_0x3963cd[_0x888c('0x21')];this[_0x888c('0x22')]=_0x3963cd[_0x888c('0x22')];this[_0x888c('0x23')]=_0x3963cd[_0x888c('0x23')];this[_0x888c('0x24')]=_0x3963cd[_0x888c('0x24')];this[_0x888c('0x25')]=_0x3963cd[_0x888c('0x25')];this[_0x888c('0x26')]=_0x3963cd['UserId'];this['VoiceQueueId']=_0x3963cd['VoiceQueueId'];this[_0x888c('0x27')]=_0x3963cd['CampaignId'];}module[_0x888c('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 251aed7..2be40ad 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 _0x9498=['number','starttime','responsetime','endtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum'];(function(_0x481fed,_0x3f8542){var _0x3b5245=function(_0x157dfd){while(--_0x157dfd){_0x481fed['push'](_0x481fed['shift']());}};_0x3b5245(++_0x3f8542);}(_0x9498,0x105));var _0x8949=function(_0x3a8247,_0x309e12){_0x3a8247=_0x3a8247-0x0;var _0x5c4d56=_0x9498[_0x3a8247];return _0x5c4d56;};'use strict';var utils=require(_0x8949('0x0'));function History(_0x2b7d97){this[_0x8949('0x1')]=_0x2b7d97[_0x8949('0x1')];this[_0x8949('0x2')]=_0x2b7d97[_0x8949('0x2')]||undefined;this[_0x8949('0x3')]=_0x2b7d97['type'];this[_0x8949('0x4')]=_0x2b7d97['type']===_0x8949('0x5')?_0x8949('0x6'):_0x2b7d97[_0x8949('0x3')];this[_0x8949('0x7')]=_0x2b7d97[_0x8949('0x7')];this[_0x8949('0x8')]=_0x2b7d97[_0x8949('0x8')];this['countnoanswerretry']=_0x2b7d97[_0x8949('0x9')];this[_0x8949('0xa')]=_0x2b7d97[_0x8949('0x7')]+_0x2b7d97[_0x8949('0x8')]+_0x2b7d97['countnoanswerretry']+_0x2b7d97['countnosuchnumberretry']+_0x2b7d97[_0x8949('0xb')]+_0x2b7d97[_0x8949('0xc')]+_0x2b7d97[_0x8949('0xd')]+_0x2b7d97['countagentrejectretry'];this[_0x8949('0xe')]=_0x2b7d97['countnosuchnumberretry'];this[_0x8949('0xb')]=_0x2b7d97[_0x8949('0xb')];this['countabandonedretry']=_0x2b7d97[_0x8949('0xc')];this[_0x8949('0xd')]=_0x2b7d97[_0x8949('0xd')];this[_0x8949('0xf')]=_0x2b7d97[_0x8949('0xf')];this[_0x8949('0x6')]=_0x2b7d97[_0x8949('0x6')];this[_0x8949('0x10')]=_0x2b7d97[_0x8949('0x11')];this[_0x8949('0x12')]=_0x2b7d97[_0x8949('0x13')];this[_0x8949('0x14')]=_0x2b7d97[_0x8949('0x14')];this[_0x8949('0x15')]=_0x2b7d97[_0x8949('0x15')];this[_0x8949('0x16')]=_0x2b7d97['responsetime'];this['ringtime']=utils[_0x8949('0x17')](_0x2b7d97[_0x8949('0x15')],_0x2b7d97['starttime']);this['holdtime']=0x0;this[_0x8949('0x18')]=0x0;this['callback']=_0x2b7d97[_0x8949('0x19')];this[_0x8949('0x1a')]=_0x2b7d97['callbackuniqueid'];this[_0x8949('0x1b')]=_0x2b7d97['callbackat'];this['recallme']=_0x2b7d97[_0x8949('0x1c')];this['ContactId']=_0x2b7d97['ContactId'];this[_0x8949('0x1d')]=_0x2b7d97['ListId'];this[_0x8949('0x1e')]=_0x2b7d97[_0x8949('0x1e')];this[_0x8949('0x1f')]=_0x2b7d97[_0x8949('0x1f')];this['CampaignId']=_0x2b7d97[_0x8949('0x20')];this['originatecalleridnum']=_0x2b7d97[_0x8949('0x21')]||'';this['originatecalleridname']=_0x2b7d97['originatecalleridname']||'';this[_0x8949('0x22')]=_0x2b7d97[_0x8949('0x22')];this['statedesc']=_0x2b7d97['statedesc'];}module['exports']=History; \ No newline at end of file +var _0xdcab=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime','responsetime','getSeconds','holdtime','talktime','callbackuniqueid','callbackat','recallme'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xdcab,0x13a));var _0xbdca=function(_0x55cbab,_0x1c083b){_0x55cbab=_0x55cbab-0x0;var _0x1a9cdd=_0xdcab[_0x55cbab];return _0x1a9cdd;};'use strict';var utils=require(_0xbdca('0x0'));function History(_0x184b24){this[_0xbdca('0x1')]=_0x184b24[_0xbdca('0x1')];this[_0xbdca('0x2')]=_0x184b24[_0xbdca('0x2')]||undefined;this[_0xbdca('0x3')]=_0x184b24['type'];this[_0xbdca('0x4')]=_0x184b24[_0xbdca('0x3')]===_0xbdca('0x5')?_0xbdca('0x6'):_0x184b24['type'];this['countbusyretry']=_0x184b24[_0xbdca('0x7')];this[_0xbdca('0x8')]=_0x184b24[_0xbdca('0x8')];this[_0xbdca('0x9')]=_0x184b24[_0xbdca('0x9')];this[_0xbdca('0xa')]=_0x184b24[_0xbdca('0x7')]+_0x184b24['countcongestionretry']+_0x184b24[_0xbdca('0x9')]+_0x184b24[_0xbdca('0xb')]+_0x184b24[_0xbdca('0xc')]+_0x184b24[_0xbdca('0xd')]+_0x184b24[_0xbdca('0xe')]+_0x184b24[_0xbdca('0xf')];this[_0xbdca('0xb')]=_0x184b24[_0xbdca('0xb')];this[_0xbdca('0xc')]=_0x184b24[_0xbdca('0xc')];this['countabandonedretry']=_0x184b24[_0xbdca('0xd')];this[_0xbdca('0xe')]=_0x184b24[_0xbdca('0xe')];this['countagentrejectretry']=_0x184b24[_0xbdca('0xf')];this[_0xbdca('0x6')]=_0x184b24['queue'];this['calleridname']=_0x184b24[_0xbdca('0x10')];this['calleridnum']=_0x184b24[_0xbdca('0x11')];this[_0xbdca('0x12')]=_0x184b24[_0xbdca('0x12')];this[_0xbdca('0x13')]=_0x184b24[_0xbdca('0x13')];this['endtime']=_0x184b24[_0xbdca('0x13')];this['ringtime']=utils[_0xbdca('0x14')](_0x184b24['responsetime'],_0x184b24['starttime']);this[_0xbdca('0x15')]=0x0;this[_0xbdca('0x16')]=0x0;this['callback']=_0x184b24['callback'];this[_0xbdca('0x17')]=_0x184b24[_0xbdca('0x17')];this[_0xbdca('0x18')]=_0x184b24[_0xbdca('0x18')];this[_0xbdca('0x19')]=_0x184b24[_0xbdca('0x19')];this[_0xbdca('0x1a')]=_0x184b24['ContactId'];this[_0xbdca('0x1b')]=_0x184b24[_0xbdca('0x1b')];this[_0xbdca('0x1c')]=_0x184b24[_0xbdca('0x1c')];this['VoiceQueueId']=_0x184b24[_0xbdca('0x1d')];this[_0xbdca('0x1e')]=_0x184b24['CampaignId'];this[_0xbdca('0x1f')]=_0x184b24[_0xbdca('0x1f')]||'';this['originatecalleridname']=_0x184b24['originatecalleridname']||'';this[_0xbdca('0x20')]=_0x184b24[_0xbdca('0x20')];this[_0xbdca('0x21')]=_0x184b24[_0xbdca('0x21')];}module['exports']=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 a385488..4fb4700 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 _0xcea7=['ringtime','getSeconds','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime'];(function(_0x55680e,_0xb76d61){var _0x18183a=function(_0x3ea21c){while(--_0x3ea21c){_0x55680e['push'](_0x55680e['shift']());}};_0x18183a(++_0xb76d61);}(_0xcea7,0x1ee));var _0x7cea=function(_0x5ebcb8,_0x1caf89){_0x5ebcb8=_0x5ebcb8-0x0;var _0x560c58=_0xcea7[_0x5ebcb8];return _0x560c58;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x24317e,_0xc5b300){this[_0x7cea('0x0')]=_0x24317e[_0x7cea('0x0')];this[_0x7cea('0x1')]=_0x24317e['type'];this[_0x7cea('0x2')]=_0x24317e[_0x7cea('0x1')]===_0x7cea('0x3')?_0x7cea('0x4'):_0x24317e[_0x7cea('0x1')];this[_0x7cea('0x5')]=_0x24317e[_0x7cea('0x5')];this[_0x7cea('0x6')]=_0x24317e['countcongestionretry'];this[_0x7cea('0x7')]=_0x24317e[_0x7cea('0x7')];this[_0x7cea('0x8')]=_0x24317e[_0x7cea('0x5')]+_0x24317e[_0x7cea('0x6')]+_0x24317e[_0x7cea('0x7')]+_0x24317e['countnosuchnumberretry']+_0x24317e['countdropretry']+_0x24317e['countabandonedretry']+_0x24317e[_0x7cea('0x9')]+_0x24317e['countagentrejectretry'];this['countnosuchnumberretry']=_0x24317e[_0x7cea('0xa')];this[_0x7cea('0xb')]=_0x24317e['countdropretry'];this[_0x7cea('0xc')]=_0x24317e[_0x7cea('0xc')];this['countmachineretry']=_0x24317e['countmachineretry'];this[_0x7cea('0xd')]=_0x24317e['countagentrejectretry'];this[_0x7cea('0xe')]=_0xc5b300[_0x7cea('0xe')];this['calleridname']=_0x24317e['name'];this[_0x7cea('0xf')]=_0x24317e[_0x7cea('0x10')];this[_0x7cea('0x11')]=_0x24317e['starttime'];this['responsetime']=_0x24317e[_0x7cea('0x12')];this[_0x7cea('0x13')]=_0x24317e[_0x7cea('0x13')];this[_0x7cea('0x14')]=_0x24317e[_0x7cea('0x14')];this[_0x7cea('0x15')]=this[_0x7cea('0x13')];this[_0x7cea('0x16')]=utils[_0x7cea('0x17')](_0x24317e[_0x7cea('0x12')],_0x24317e['starttime']);this[_0x7cea('0x18')]=utils['getSeconds'](this[_0x7cea('0x13')],_0x24317e[_0x7cea('0x12')]);this['talktime']=0x0;this[_0x7cea('0x4')]=_0xc5b300[_0x7cea('0x4')];this[_0x7cea('0x19')]=_0xc5b300[_0x7cea('0x1a')];this[_0x7cea('0x1b')]=_0xc5b300['reason'];this[_0x7cea('0x1c')]=_0x24317e[_0x7cea('0x1c')];this[_0x7cea('0x1d')]=_0x24317e[_0x7cea('0x1d')];this['callbackat']=_0x24317e[_0x7cea('0x1e')];this[_0x7cea('0x1f')]=_0x24317e[_0x7cea('0x1f')];this[_0x7cea('0x20')]=_0x24317e[_0x7cea('0x20')];this[_0x7cea('0x21')]=_0x24317e[_0x7cea('0x21')];this[_0x7cea('0x22')]=_0x24317e[_0x7cea('0x22')];this[_0x7cea('0x23')]=_0x24317e[_0x7cea('0x23')];this[_0x7cea('0x24')]=_0x24317e['CampaignId'];this[_0x7cea('0x25')]=_0x24317e[_0x7cea('0x25')]||'';this[_0x7cea('0x26')]=_0x24317e[_0x7cea('0x26')]||'';this[_0x7cea('0x27')]=_0x24317e[_0x7cea('0x27')];this[_0x7cea('0x28')]=_0x24317e[_0x7cea('0x28')];this[_0x7cea('0x29')]=_0x24317e[_0x7cea('0x29')];}module[_0x7cea('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xaf11=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridnum','starttime','responsetime','droptime','dropreason','ringtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat'];(function(_0x55763d,_0x20a747){var _0x4ccdb6=function(_0x2e6ca){while(--_0x2e6ca){_0x55763d['push'](_0x55763d['shift']());}};_0x4ccdb6(++_0x20a747);}(_0xaf11,0xfa));var _0x1af1=function(_0x3d2510,_0xf85f38){_0x3d2510=_0x3d2510-0x0;var _0x5746fd=_0xaf11[_0x3d2510];return _0x5746fd;};'use strict';var utils=require(_0x1af1('0x0'));function QueueCallerAbandon(_0x3feb42,_0xe8d0ca){this[_0x1af1('0x1')]=_0x3feb42['scheduledat'];this[_0x1af1('0x2')]=_0x3feb42[_0x1af1('0x2')];this[_0x1af1('0x3')]=_0x3feb42[_0x1af1('0x2')]===_0x1af1('0x4')?_0x1af1('0x5'):_0x3feb42[_0x1af1('0x2')];this[_0x1af1('0x6')]=_0x3feb42[_0x1af1('0x6')];this[_0x1af1('0x7')]=_0x3feb42[_0x1af1('0x7')];this[_0x1af1('0x8')]=_0x3feb42[_0x1af1('0x8')];this['countglobal']=_0x3feb42['countbusyretry']+_0x3feb42[_0x1af1('0x7')]+_0x3feb42[_0x1af1('0x8')]+_0x3feb42[_0x1af1('0x9')]+_0x3feb42['countdropretry']+_0x3feb42[_0x1af1('0xa')]+_0x3feb42[_0x1af1('0xb')]+_0x3feb42[_0x1af1('0xc')];this[_0x1af1('0x9')]=_0x3feb42['countnosuchnumberretry'];this[_0x1af1('0xd')]=_0x3feb42['countdropretry'];this[_0x1af1('0xa')]=_0x3feb42[_0x1af1('0xa')];this[_0x1af1('0xb')]=_0x3feb42[_0x1af1('0xb')];this[_0x1af1('0xc')]=_0x3feb42['countagentrejectretry'];this['uniqueid']=_0xe8d0ca['uniqueid'];this['calleridname']=_0x3feb42['name'];this[_0x1af1('0xe')]=_0x3feb42['number'];this[_0x1af1('0xf')]=_0x3feb42[_0x1af1('0xf')];this[_0x1af1('0x10')]=_0x3feb42[_0x1af1('0x10')];this[_0x1af1('0x11')]=_0x3feb42[_0x1af1('0x11')];this[_0x1af1('0x12')]=_0x3feb42['dropreason'];this['endtime']=this[_0x1af1('0x11')];this[_0x1af1('0x13')]=utils['getSeconds'](_0x3feb42[_0x1af1('0x10')],_0x3feb42[_0x1af1('0xf')]);this['holdtime']=utils['getSeconds'](this[_0x1af1('0x11')],_0x3feb42[_0x1af1('0x10')]);this[_0x1af1('0x14')]=0x0;this[_0x1af1('0x5')]=_0xe8d0ca[_0x1af1('0x5')];this['membername']=_0xe8d0ca['connectedlinename'];this[_0x1af1('0x15')]=_0xe8d0ca[_0x1af1('0x15')];this[_0x1af1('0x16')]=_0x3feb42['callback'];this['callbackuniqueid']=_0x3feb42[_0x1af1('0x17')];this[_0x1af1('0x18')]=_0x3feb42[_0x1af1('0x18')];this['recallme']=_0x3feb42[_0x1af1('0x19')];this['ContactId']=_0x3feb42[_0x1af1('0x1a')];this[_0x1af1('0x1b')]=_0x3feb42[_0x1af1('0x1b')];this['UserId']=_0x3feb42[_0x1af1('0x1c')];this[_0x1af1('0x1d')]=_0x3feb42[_0x1af1('0x1d')];this['CampaignId']=_0x3feb42[_0x1af1('0x1e')];this[_0x1af1('0x1f')]=_0x3feb42[_0x1af1('0x1f')]||'';this[_0x1af1('0x20')]=_0x3feb42[_0x1af1('0x20')]||'';this[_0x1af1('0x21')]=_0x3feb42['agiafterat'];this[_0x1af1('0x22')]=_0x3feb42[_0x1af1('0x22')];this[_0x1af1('0x23')]=_0x3feb42[_0x1af1('0x23')];}module['exports']=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 597222d..472856d 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 _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(_0x2e8f00,_0x2b91bf){var _0x1f2ee1=function(_0x1d78b4){while(--_0x1d78b4){_0x2e8f00['push'](_0x2e8f00['shift']());}};_0x1f2ee1(++_0x2b91bf);}(_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 +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(_0x551a60,_0x33c3cf){var _0x5c3ffa=function(_0x196608){while(--_0x196608){_0x551a60['push'](_0x551a60['shift']());}};_0x5c3ffa(++_0x33c3cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 806fbb0..81d3d9e 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 _0x3082=['INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','available','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','NULL_INTERVAL','isEmpty','dialGlobalInterval','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','loggedIn','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','isUndefined','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED'];(function(_0x44899d,_0x1c20ee){var _0x12883f=function(_0x5258ed){while(--_0x5258ed){_0x44899d['push'](_0x44899d['shift']());}};_0x12883f(++_0x1c20ee);}(_0x3082,0x1ee));var _0x2308=function(_0x1c5200,_0x1b462c){_0x1c5200=_0x1c5200-0x0;var _0xc8e0e=_0x3082[_0x1c5200];return _0xc8e0e;};'use strict';var _=require(_0x2308('0x0'));var moment=require(_0x2308('0x1'));var util=require(_0x2308('0x2'));var logger=require(_0x2308('0x3'))(_0x2308('0x4'));var timezones=require(_0x2308('0x5'))[_0x2308('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x2308('0x7'),'BLACKLIST':_0x2308('0x8'),'CONTACTS_RESCHEDULED':_0x2308('0x9'),'DEACTIVATED':_0x2308('0xa'),'DISACTIVED':_0x2308('0xb'),'EMPTY_INTERVAL':_0x2308('0xc'),'INACTIVE':_0x2308('0xd'),'NO_AGENTS_LOGGED':_0x2308('0xe'),'NO_AVAILABLE_CONTACTS':_0x2308('0xf'),'NULL_INTERVAL':_0x2308('0x10'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x2308('0x11'),'QUEUE_RECALL':_0x2308('0x12'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x2308('0x13'),'UNKNOWN_TIMEZONE':_0x2308('0x14'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x2308('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x53f681){return _0x53f681[_0x2308('0x16')]===_0x2308('0x17');}exports[_0x2308('0x18')]=isPreviewCampaign;function isIVRCampaign(_0x25a2f9){return _0x25a2f9['type']==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0xd4b71e){return _0xd4b71e[_0x2308('0x19')]===_0x2308('0x1a');}exports[_0x2308('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0x4bdd5a){return _0x4bdd5a[_0x2308('0x1c')];}exports[_0x2308('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x340c73){return _0x340c73[_0x2308('0x1e')];}exports[_0x2308('0x1f')]=isIVRCampaignActive;function getSeconds(_0x26153f,_0x3c7f48){var _0x30d0fd=moment(_0x26153f)[_0x2308('0x20')](0x0);var _0x3c8d7e=moment(_0x3c7f48)['milliseconds'](0x0);return _0x30d0fd[_0x2308('0x21')](_0x3c8d7e,_0x2308('0x22'));}exports[_0x2308('0x23')]=getSeconds;function hasQueueCampaignDataChanged(_0x19b909,_0xa259ed){var _0x102378=![];var _0x386748=_0x19b909[_0x2308('0x16')]!==_0xa259ed[_0x2308('0x16')]||_0x19b909[_0x2308('0x1c')]!==_0xa259ed['dialActive']||_0x19b909['message']!==_0xa259ed['message'];var _0x218f80=_0x19b909[_0x2308('0x24')]!==_0xa259ed['available']||_0x19b909['loggedIn']!==_0xa259ed['loggedIn']||_0x19b909['loggedInDb']!==_0xa259ed[_0x2308('0x25')]||_0x19b909[_0x2308('0x26')]!==_0xa259ed[_0x2308('0x26')]||_0x19b909[_0x2308('0x27')]!==_0xa259ed[_0x2308('0x27')]||_0x19b909['pTalking']!==_0xa259ed[_0x2308('0x28')]||_0x19b909[_0x2308('0x29')]!==_0xa259ed[_0x2308('0x29')]||_0x19b909[_0x2308('0x2a')]!==_0xa259ed[_0x2308('0x2a')]||_0x19b909[_0x2308('0x2b')]!==_0xa259ed[_0x2308('0x2b')];if(_0x19b909[_0x2308('0x2c')]&&_0xa259ed[_0x2308('0x2c')]){_0x102378=_0x19b909[_0x2308('0x2c')][_0x2308('0x2d')]!==_0xa259ed['Trunk'][_0x2308('0x2d')]||_0x19b909[_0x2308('0x2c')][_0x2308('0x1e')]!==_0xa259ed[_0x2308('0x2c')][_0x2308('0x1e')];}return _0x386748||_0x218f80||_0x102378;}exports[_0x2308('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x84c03d){var _0x38710d=null;var _0x2bcdd6=_0x84c03d[_0x2308('0x2f')];if(_[_0x2308('0x30')](_0x84c03d['dialGlobalInterval'])||_[_0x2308('0x30')](_0x84c03d[_0x2308('0x31')])||_['isNil'](_0x84c03d['Interval']['Intervals'])){_0x38710d=CAMPAIGN_STATUS[_0x2308('0x32')];}else if(_[_0x2308('0x33')](_0x84c03d[_0x2308('0x34')])||_[_0x2308('0x33')](_0x84c03d[_0x2308('0x31')][_0x2308('0x35')])){_0x38710d=CAMPAIGN_STATUS[_0x2308('0x36')];}else if(_0x2bcdd6&&!timezones[_0x2bcdd6]){_0x38710d=CAMPAIGN_STATUS[_0x2308('0x37')];}return _0x38710d;}function checkAnyValidTrunk(_0x31a5c6,_0x583a3f){var _0x22f4f2=null;var _0x2c52da=_0x2308('0x38');var _0x130b02=[_0x2308('0x39'),_0x2308('0x3a')];var _0x17ed6a=!![];if(_0x31a5c6[_0x2308('0x2c')]&&_0x31a5c6[_0x2308('0x2c')][_0x2308('0x1e')]){_0x2c52da+=_0x31a5c6['Trunk'][_0x2308('0x2d')];_0x22f4f2=_0x583a3f[_0x2c52da];_0x17ed6a=_0x130b02[_0x2308('0x3b')](_0x22f4f2[_0x2308('0x3c')]);}else if(_0x31a5c6[_0x2308('0x3d')]&&_0x31a5c6[_0x2308('0x3d')][_0x2308('0x1e')]){_0x2c52da+=_0x31a5c6[_0x2308('0x3d')][_0x2308('0x2d')];_0x22f4f2=_0x583a3f[_0x2c52da];_0x17ed6a=_0x130b02[_0x2308('0x3b')](_0x22f4f2[_0x2308('0x3c')]);}return _0x17ed6a;}function getQueueCampaignStatusMessage(_0x1052d1,_0x13bfc7){var _0x24f20b=CAMPAIGN_STATUS[_0x2308('0x7')];var _0x2d71bb=isPreviewCampaign(_0x1052d1);if(!isQueueCampaignActive(_0x1052d1)){if(_0x2d71bb){_0x24f20b=CAMPAIGN_STATUS[_0x2308('0x3e')];}else{if(_0x1052d1['originated']===0x0&&_0x1052d1['talking']===0x0&&_0x1052d1['waiting']===0x0&&(_0x1052d1[_0x2308('0x28')]||0x0)===0x0){_0x24f20b=CAMPAIGN_STATUS['INACTIVE'];}else{_0x24f20b=CAMPAIGN_STATUS[_0x2308('0x3f')];}}}else if(_0x1052d1[_0x2308('0x40')]===0x0){_0x24f20b=CAMPAIGN_STATUS[_0x2308('0x41')];}else if(!checkAnyValidTrunk(_0x1052d1,_0x13bfc7)){_0x24f20b=CAMPAIGN_STATUS[_0x2308('0x42')];}else if(!isPreviewCampaign(_0x1052d1)){var _0x1e80e8=checkAnyValidQueueCampaignInterval(_0x1052d1);if(_0x1e80e8){_0x24f20b=_0x1e80e8;}}return _0x24f20b;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xc7e5c2){var _0x5b96db=CAMPAIGN_STATUS[_0x2308('0x3f')];if(_0xc7e5c2['originated']===0x0&&_0xc7e5c2[_0x2308('0x27')]===0x0&&_0xc7e5c2[_0x2308('0x29')]===0x0&&(_0xc7e5c2['pTalking']||0x0)===0x0){_0x5b96db=CAMPAIGN_STATUS[_0x2308('0x3e')];}return _0x5b96db;}exports[_0x2308('0x43')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x22e8b2){var _0x12d55d=_0x22e8b2['match'](/"(.*?)"/);return _0x12d55d?_0x12d55d[0x1]:_0x22e8b2;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x30ff6a,_0x3445b6,_0x13f691){if(!_['isUndefined'](_0x13f691)&&typeof _0x13f691==='string'&&!_['isEmpty'](_0x13f691)){if(!_[_0x2308('0x44')](_0x3445b6)&&typeof _0x3445b6==='string'&&!_['isEmpty'](_0x3445b6)){return util[_0x2308('0x45')](_0x2308('0x46'),_0x3445b6,_0x13f691);}return util[_0x2308('0x45')](_0x2308('0x46'),_0x13f691,_0x13f691);}if(!_['isUndefined'](_0x30ff6a)&&typeof _0x30ff6a===_0x2308('0x47')&&!_['isEmpty'](_0x30ff6a)){return _0x30ff6a;}return _0x2308('0x48');}exports[_0x2308('0x49')]=getCallerId;function getCallerIdRandom(_0x25e7e8,_0x4085df){var _0x350ef5;var _0x6ee4b8;var _0x47dc11;if(_0x4085df<=0x0){_0x4085df=0x1;}_0x350ef5=new RegExp(_0x2308('0x4a')+_0x4085df+'}$');_0x6ee4b8=Math['pow'](0xa,_0x4085df-0x1);_0x47dc11=Math[_0x2308('0x4b')](0xa,_0x4085df)-0x1;return util[_0x2308('0x45')]('%s',_['replace'](_0x25e7e8,_0x350ef5,_['random'](_0x6ee4b8,_0x47dc11)[_0x2308('0x4c')]()));}exports[_0x2308('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x4ea08a){if(_0x4ea08a[_0x2308('0x2b')]&&_0x4ea08a[_0x2308('0x2b')]>0x0){_0x4ea08a['originated']-=0x1;}else{logger[_0x2308('0x4e')](_0x2308('0x4f'));}}exports[_0x2308('0x50')]=decrementOriginate;function checkContactEmpty(_0x502cb7){return _0x502cb7&&_0x502cb7[_0x2308('0x51')]>0x0;}exports[_0x2308('0x52')]=checkContactEmpty;function erlangb(_0x14f903,_0x19d826){if(_0x19d826===0x0){return 0x0;}var _0x21da32=0x1;for(var _0x1eef16=0x1;_0x1eef16<=_0x19d826;_0x1eef16+=0x1){_0x21da32=0x1+_0x21da32*_0x1eef16/_0x14f903;}return 0x1/_0x21da32;}exports[_0x2308('0x53')]=erlangb;function checkContactLowerLimitOriginate(_0x35b0d8,_0xa5f3e0,_0x283154){if(_0xa5f3e0>_0x283154){for(var _0x41df32=0x0;_0x41df32<_0xa5f3e0-_0x283154;_0x41df32+=0x1){decrementOriginate(_0x35b0d8);}}}exports[_0x2308('0x54')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x2369=['NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','originated','Trunk','name','hasQueueCampaignDataChanged','dialGlobalInterval','isNil','Intervals','NULL_INTERVAL','isEmpty','Interval','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','talking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','decrementOriginate','length','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x2369,0x194));var _0x9236=function(_0x105d27,_0x3401f8){_0x105d27=_0x105d27-0x0;var _0x4bd161=_0x2369[_0x105d27];return _0x4bd161;};'use strict';var _=require(_0x9236('0x0'));var moment=require(_0x9236('0x1'));var util=require(_0x9236('0x2'));var logger=require('../../../../config/logger')(_0x9236('0x3'));var timezones=require(_0x9236('0x4'))[_0x9236('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x9236('0x6'),'BLACKLIST':_0x9236('0x7'),'CONTACTS_RESCHEDULED':_0x9236('0x8'),'DEACTIVATED':_0x9236('0x9'),'DISACTIVED':_0x9236('0xa'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x9236('0xb'),'NO_AGENTS_LOGGED':_0x9236('0xc'),'NO_AVAILABLE_CONTACTS':_0x9236('0xd'),'NULL_INTERVAL':_0x9236('0xe'),'OVERTIME_INTERVAL':_0x9236('0xf'),'OVERTIME_GLOBAL_INTERVAL':_0x9236('0x10'),'QUEUE_RECALL':_0x9236('0x11'),'RECALL_TIMEOUT':_0x9236('0x12'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x9236('0x13'),'UNREACHABLE_TRUNK':_0x9236('0x14')};exports[_0x9236('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x29ca41){return _0x29ca41[_0x9236('0x16')]===_0x9236('0x17');}exports[_0x9236('0x18')]=isPreviewCampaign;function isIVRCampaign(_0x35a3e8){return _0x35a3e8['type']===_0x9236('0x19');}exports[_0x9236('0x1a')]=isIVRCampaign;function isOutboundQueue(_0xda2aca){return _0xda2aca[_0x9236('0x1b')]==='outbound';}exports[_0x9236('0x1c')]=isOutboundQueue;function isQueueCampaignActive(_0x1db619){return _0x1db619[_0x9236('0x1d')];}exports[_0x9236('0x1e')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3bb272){return _0x3bb272[_0x9236('0x1f')];}exports[_0x9236('0x20')]=isIVRCampaignActive;function getSeconds(_0x366aa9,_0x227bcf){var _0x20a47a=moment(_0x366aa9)[_0x9236('0x21')](0x0);var _0xdae1b0=moment(_0x227bcf)[_0x9236('0x21')](0x0);return _0x20a47a[_0x9236('0x22')](_0xdae1b0,_0x9236('0x23'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x1eb618,_0x12be73){var _0x14a73e=![];var _0x479a67=_0x1eb618['dialMethod']!==_0x12be73['dialMethod']||_0x1eb618[_0x9236('0x1d')]!==_0x12be73[_0x9236('0x1d')]||_0x1eb618[_0x9236('0x24')]!==_0x12be73[_0x9236('0x24')];var _0x52231d=_0x1eb618['available']!==_0x12be73[_0x9236('0x25')]||_0x1eb618[_0x9236('0x26')]!==_0x12be73[_0x9236('0x26')]||_0x1eb618[_0x9236('0x27')]!==_0x12be73[_0x9236('0x27')]||_0x1eb618[_0x9236('0x28')]!==_0x12be73[_0x9236('0x28')]||_0x1eb618['talking']!==_0x12be73['talking']||_0x1eb618[_0x9236('0x29')]!==_0x12be73[_0x9236('0x29')]||_0x1eb618[_0x9236('0x2a')]!==_0x12be73[_0x9236('0x2a')]||_0x1eb618['inUse']!==_0x12be73['inUse']||_0x1eb618['originated']!==_0x12be73[_0x9236('0x2b')];if(_0x1eb618['Trunk']&&_0x12be73[_0x9236('0x2c')]){_0x14a73e=_0x1eb618[_0x9236('0x2c')]['name']!==_0x12be73[_0x9236('0x2c')][_0x9236('0x2d')]||_0x1eb618[_0x9236('0x2c')][_0x9236('0x1f')]!==_0x12be73[_0x9236('0x2c')][_0x9236('0x1f')];}return _0x479a67||_0x52231d||_0x14a73e;}exports[_0x9236('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1d27cc){var _0x48778a=null;var _0x6a8f76=_0x1d27cc['dialTimezone'];if(_['isNil'](_0x1d27cc[_0x9236('0x2f')])||_[_0x9236('0x30')](_0x1d27cc['Interval'])||_['isNil'](_0x1d27cc['Interval'][_0x9236('0x31')])){_0x48778a=CAMPAIGN_STATUS[_0x9236('0x32')];}else if(_[_0x9236('0x33')](_0x1d27cc[_0x9236('0x2f')])||_['isEmpty'](_0x1d27cc[_0x9236('0x34')][_0x9236('0x31')])){_0x48778a=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x6a8f76&&!timezones[_0x6a8f76]){_0x48778a=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x48778a;}function checkAnyValidTrunk(_0x283910,_0x4491ac){var _0x49bc19=null;var _0x2d7657=_0x9236('0x35');var _0x4fcb10=[_0x9236('0x36'),_0x9236('0x37')];var _0x352394=!![];if(_0x283910['Trunk']&&_0x283910[_0x9236('0x2c')][_0x9236('0x1f')]){_0x2d7657+=_0x283910[_0x9236('0x2c')][_0x9236('0x2d')];_0x49bc19=_0x4491ac[_0x2d7657];_0x352394=_0x4fcb10['includes'](_0x49bc19[_0x9236('0x38')]);}else if(_0x283910['TrunkBackup']&&_0x283910['TrunkBackup']['active']){_0x2d7657+=_0x283910[_0x9236('0x39')][_0x9236('0x2d')];_0x49bc19=_0x4491ac[_0x2d7657];_0x352394=_0x4fcb10[_0x9236('0x3a')](_0x49bc19[_0x9236('0x38')]);}return _0x352394;}function getQueueCampaignStatusMessage(_0x42c7fa,_0x4a999){var _0x4c1fe1=CAMPAIGN_STATUS['ACTIVE'];var _0x225bef=isPreviewCampaign(_0x42c7fa);if(!isQueueCampaignActive(_0x42c7fa)){if(_0x225bef){_0x4c1fe1=CAMPAIGN_STATUS[_0x9236('0x3b')];}else{if(_0x42c7fa[_0x9236('0x2b')]===0x0&&_0x42c7fa[_0x9236('0x3c')]===0x0&&_0x42c7fa[_0x9236('0x2a')]===0x0&&(_0x42c7fa[_0x9236('0x29')]||0x0)===0x0){_0x4c1fe1=CAMPAIGN_STATUS[_0x9236('0x3b')];}else{_0x4c1fe1=CAMPAIGN_STATUS[_0x9236('0x3d')];}}}else if(_0x42c7fa['loggedIn']===0x0){_0x4c1fe1=CAMPAIGN_STATUS[_0x9236('0x3e')];}else if(!checkAnyValidTrunk(_0x42c7fa,_0x4a999)){_0x4c1fe1=CAMPAIGN_STATUS[_0x9236('0x3f')];}else if(!isPreviewCampaign(_0x42c7fa)){var _0x1d71e6=checkAnyValidQueueCampaignInterval(_0x42c7fa);if(_0x1d71e6){_0x4c1fe1=_0x1d71e6;}}return _0x4c1fe1;}exports[_0x9236('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3064f2){var _0x15f49a=CAMPAIGN_STATUS[_0x9236('0x3d')];if(_0x3064f2['originated']===0x0&&_0x3064f2[_0x9236('0x3c')]===0x0&&_0x3064f2['waiting']===0x0&&(_0x3064f2[_0x9236('0x29')]||0x0)===0x0){_0x15f49a=CAMPAIGN_STATUS[_0x9236('0x3b')];}return _0x15f49a;}exports[_0x9236('0x41')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x217ba1){var _0x105e45=_0x217ba1['match'](/"(.*?)"/);return _0x105e45?_0x105e45[0x1]:_0x217ba1;}exports[_0x9236('0x42')]=extractCalleridName;function getCallerId(_0x10dc93,_0x5b2a6b,_0xc3f3d4){if(!_[_0x9236('0x43')](_0xc3f3d4)&&typeof _0xc3f3d4===_0x9236('0x44')&&!_[_0x9236('0x33')](_0xc3f3d4)){if(!_[_0x9236('0x43')](_0x5b2a6b)&&typeof _0x5b2a6b===_0x9236('0x44')&&!_[_0x9236('0x33')](_0x5b2a6b)){return util[_0x9236('0x45')](_0x9236('0x46'),_0x5b2a6b,_0xc3f3d4);}return util[_0x9236('0x45')](_0x9236('0x46'),_0xc3f3d4,_0xc3f3d4);}if(!_['isUndefined'](_0x10dc93)&&typeof _0x10dc93==='string'&&!_[_0x9236('0x33')](_0x10dc93)){return _0x10dc93;}return _0x9236('0x47');}exports[_0x9236('0x48')]=getCallerId;function getCallerIdRandom(_0x5bedc6,_0x118cec){var _0x3c0f58;var _0xaf6610;var _0x4cbf83;if(_0x118cec<=0x0){_0x118cec=0x1;}_0x3c0f58=new RegExp('\x5cw{0,'+_0x118cec+'}$');_0xaf6610=Math[_0x9236('0x49')](0xa,_0x118cec-0x1);_0x4cbf83=Math[_0x9236('0x49')](0xa,_0x118cec)-0x1;return util['format']('%s',_[_0x9236('0x4a')](_0x5bedc6,_0x3c0f58,_[_0x9236('0x4b')](_0xaf6610,_0x4cbf83)[_0x9236('0x4c')]()));}exports[_0x9236('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x13a780){if(_0x13a780[_0x9236('0x2b')]&&_0x13a780[_0x9236('0x2b')]>0x0){_0x13a780['originated']-=0x1;}else{logger[_0x9236('0x4e')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x9236('0x4f')]=decrementOriginate;function checkContactEmpty(_0x557724){return _0x557724&&_0x557724[_0x9236('0x50')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x2f033d,_0x11bcfa){if(_0x11bcfa===0x0){return 0x0;}var _0x1ad22=0x1;for(var _0x2dea08=0x1;_0x2dea08<=_0x11bcfa;_0x2dea08+=0x1){_0x1ad22=0x1+_0x1ad22*_0x2dea08/_0x2f033d;}return 0x1/_0x1ad22;}exports[_0x9236('0x51')]=erlangb;function checkContactLowerLimitOriginate(_0x43e32e,_0x320e80,_0x36db60){if(_0x320e80>_0x36db60){for(var _0x4f511e=0x0;_0x4f511e<_0x320e80-_0x36db60;_0x4f511e+=0x1){decrementOriginate(_0x43e32e);}}}exports[_0x9236('0x52')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7d7c8d8..33b75b6 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(_0x5a7feb,_0x57d596){var _0x214970=function(_0x52ea6e){while(--_0x52ea6e){_0x5a7feb['push'](_0x5a7feb['shift']());}};_0x214970(++_0x57d596);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x23898c,_0x25d8a2){var _0xcf58ac=function(_0x54bf4d){while(--_0x54bf4d){_0x23898c['push'](_0x23898c['shift']());}};_0xcf58ac(++_0x25d8a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 5dd85ee..fce29a5 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 _0xa4c8=['\x20receiveFax\x20','merge','pick','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','actions','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./channel','./util/util','./action','../rpc/attachment','channels','faxAccounts','trunks','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','create','parse','.pdf','application/pdf','catch','error','stringify'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0xa4c8,0xa4));var _0x8a4c=function(_0x24ffcf,_0xdfe083){_0x24ffcf=_0x24ffcf-0x0;var _0x4e74f8=_0xa4c8[_0x24ffcf];return _0x4e74f8;};'use strict';var util=require(_0x8a4c('0x0'));var _=require(_0x8a4c('0x1'));var BPromise=require(_0x8a4c('0x2'));var uuid=require(_0x8a4c('0x3'));var moment=require(_0x8a4c('0x4'));var path=require(_0x8a4c('0x5'));var tiff2pdf=require(_0x8a4c('0x6'));var gs=require('./util/gs');var logger=require(_0x8a4c('0x7'))(_0x8a4c('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x8a4c('0x9'));var ut=require(_0x8a4c('0xa'));var Action=require(_0x8a4c('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x8a4c('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x22c899){this[_0x8a4c('0xd')]={};this[_0x8a4c('0xe')]=_0x22c899[_0x8a4c('0xe')];this[_0x8a4c('0xf')]=_0x22c899['trunks'];this['actions']={};ami['on']('newchannel',this[_0x8a4c('0x10')][_0x8a4c('0x11')](this));ami['on'](_0x8a4c('0x12'),this[_0x8a4c('0x13')][_0x8a4c('0x11')](this));ami['on'](_0x8a4c('0x14'),this[_0x8a4c('0x15')][_0x8a4c('0x11')](this));ami['on'](_0x8a4c('0x16'),this[_0x8a4c('0x17')][_0x8a4c('0x11')](this));ami['on'](_0x8a4c('0x18'),this['syncFaxStatus'][_0x8a4c('0x11')](this));ami['on'](_0x8a4c('0x19'),this[_0x8a4c('0x1a')][_0x8a4c('0x11')](this));ami['on'](_0x8a4c('0x1b'),this[_0x8a4c('0x1c')][_0x8a4c('0x11')](this));ami['on']('originateresponse',this[_0x8a4c('0x1d')][_0x8a4c('0x11')](this));}Fax[_0x8a4c('0x1e')]['syncNewchannel']=function(_0x401f5a){if(_0x401f5a['context']===_0x8a4c('0x1f')){for(var _0x501c75 in this['faxAccounts']){if(this[_0x8a4c('0xe')]['hasOwnProperty'](_0x501c75)){if(_0x401f5a[_0x8a4c('0x20')]===this['faxAccounts'][_0x501c75][_0x8a4c('0x21')]){this[_0x8a4c('0xd')][_0x401f5a[_0x8a4c('0x22')]]={};this[_0x8a4c('0xd')][_0x401f5a[_0x8a4c('0x22')]][_0x8a4c('0x23')]=_0x401f5a['channel'];this[_0x8a4c('0xd')][_0x401f5a[_0x8a4c('0x22')]]['id']=this['faxAccounts'][_0x501c75]['id'];this[_0x8a4c('0xd')][_0x401f5a[_0x8a4c('0x22')]][_0x8a4c('0x24')]=this[_0x8a4c('0xe')][_0x501c75][_0x8a4c('0x24')];logger[_0x8a4c('0x25')](_0x401f5a['uniqueid'],_0x8a4c('0x26'));}}}}if(this['actions'][_0x401f5a[_0x8a4c('0x22')]]){this[_0x8a4c('0xd')][_0x401f5a[_0x8a4c('0x22')]]={};this['channels'][_0x401f5a[_0x8a4c('0x22')]][_0x8a4c('0x23')]=_0x401f5a[_0x8a4c('0x23')];logger['info'](_0x401f5a[_0x8a4c('0x22')],_0x8a4c('0x26'));}};Fax[_0x8a4c('0x1e')][_0x8a4c('0x13')]=function(_0x322b32){if(this[_0x8a4c('0xd')][_0x322b32[_0x8a4c('0x22')]]){for(var _0xb1d010 in _0x322b32[_0x8a4c('0x27')]){if(_0x322b32[_0x8a4c('0x27')][_0x8a4c('0x28')](_0xb1d010)){this[_0x8a4c('0xd')][_0x322b32[_0x8a4c('0x22')]][_0xb1d010]=_0x322b32['value'];}}}};Fax[_0x8a4c('0x1e')][_0x8a4c('0x15')]=function(_0x409e92){if(this[_0x8a4c('0xd')][_0x409e92[_0x8a4c('0x22')]]){this['channels'][_0x409e92[_0x8a4c('0x22')]][_0x8a4c('0x29')]=_0x409e92[_0x8a4c('0x29')];this[_0x8a4c('0xd')][_0x409e92['uniqueid']][_0x8a4c('0x2a')]=_0x409e92['channelstatedesc'];}};Fax[_0x8a4c('0x1e')][_0x8a4c('0x17')]=function(_0x3c2049){if(this['channels'][_0x3c2049[_0x8a4c('0x22')]]){for(var _0x2cee7d in _0x3c2049[_0x8a4c('0x27')]){if(_0x3c2049[_0x8a4c('0x27')]['hasOwnProperty'](_0x2cee7d)){this[_0x8a4c('0xd')][_0x3c2049[_0x8a4c('0x22')]][_0x2cee7d]=_0x3c2049[_0x8a4c('0x2b')];}}}};Fax[_0x8a4c('0x1e')][_0x8a4c('0x2c')]=function(_0x4ea54c){if(this[_0x8a4c('0xd')][_0x4ea54c['uniqueid']]){this[_0x8a4c('0xd')][_0x4ea54c[_0x8a4c('0x22')]][_0x8a4c('0x2d')]=_0x4ea54c[_0x8a4c('0x2d')];this[_0x8a4c('0xd')][_0x4ea54c[_0x8a4c('0x22')]][_0x8a4c('0x2e')]=_0x4ea54c[_0x8a4c('0x2e')];this[_0x8a4c('0xd')][_0x4ea54c[_0x8a4c('0x22')]][_0x8a4c('0x21')]=_0x4ea54c[_0x8a4c('0x21')];this[_0x8a4c('0xd')][_0x4ea54c[_0x8a4c('0x22')]][_0x8a4c('0x2f')]=_0x4ea54c['filename'];logger['info'](_0x4ea54c['uniqueid'],_0x8a4c('0x30'));}};Fax['prototype'][_0x8a4c('0x1a')]=function(_0x5dae2b){var _0x3c0bcf=this;if(this[_0x8a4c('0xd')][_0x5dae2b[_0x8a4c('0x22')]]){var _0x2a1d8e=this[_0x8a4c('0xd')][_0x5dae2b[_0x8a4c('0x22')]]['id'];this[_0x8a4c('0xd')][_0x5dae2b[_0x8a4c('0x22')]][_0x8a4c('0x31')]=_0x5dae2b[_0x8a4c('0x31')];this[_0x8a4c('0xd')][_0x5dae2b[_0x8a4c('0x22')]][_0x8a4c('0x32')]=_0x5dae2b[_0x8a4c('0x32')];this['channels'][_0x5dae2b[_0x8a4c('0x22')]][_0x8a4c('0x21')]=_0x5dae2b['localstationid'];this[_0x8a4c('0xd')][_0x5dae2b[_0x8a4c('0x22')]][_0x8a4c('0x33')]=_0x5dae2b['resolution'];this[_0x8a4c('0xd')][_0x5dae2b[_0x8a4c('0x22')]][_0x8a4c('0x34')]=_0x5dae2b['transferrate'];this['channels'][_0x5dae2b['uniqueid']][_0x8a4c('0x2f')]=_0x5dae2b[_0x8a4c('0x2f')];this[_0x8a4c('0xd')][_0x5dae2b['uniqueid']][_0x8a4c('0x35')]=_0x5dae2b['calleridnum'];if(this[_0x8a4c('0xd')][_0x5dae2b[_0x8a4c('0x22')]][_0x8a4c('0x32')]>0x0){tiff2pdf(_0x5dae2b[_0x8a4c('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x505d89){logger['info'](_0x5dae2b[_0x8a4c('0x22')],'\x20result\x20conversion\x20file\x20',_0x505d89[_0x8a4c('0x36')]);attachment[_0x8a4c('0x37')]({'name':path[_0x8a4c('0x38')](_0x5dae2b[_0x8a4c('0x2f')])[_0x8a4c('0x24')],'basename':path[_0x8a4c('0x38')](_0x5dae2b[_0x8a4c('0x2f')])['name']+_0x8a4c('0x39'),'type':_0x8a4c('0x3a')})['then'](function(_0x406b02){faxAccount['notify'](_0x2a1d8e,{'from':_0x5dae2b[_0x8a4c('0x35')],'mapKey':'fax','body':path[_0x8a4c('0x38')](_0x5dae2b[_0x8a4c('0x2f')])[_0x8a4c('0x24')]+'.pdf','AttachmentId':_0x406b02['id']})[_0x8a4c('0x3b')](function(_0x5c06a2){logger[_0x8a4c('0x3c')](_0x5dae2b[_0x8a4c('0x22')],'\x20notify\x20',JSON[_0x8a4c('0x3d')](_0x5c06a2));});})[_0x8a4c('0x3b')](function(_0x30c462){logger[_0x8a4c('0x3c')](_0x5dae2b[_0x8a4c('0x22')],_0x8a4c('0x3e'),JSON[_0x8a4c('0x3d')](_0x30c462));});});}logger[_0x8a4c('0x25')](_0x5dae2b[_0x8a4c('0x22')],_0x8a4c('0x3e'));}};Fax[_0x8a4c('0x1e')][_0x8a4c('0x1d')]=function(_0x303bb0){if(this['actions'][_0x303bb0['uniqueid']]){_[_0x8a4c('0x3f')](this['channels'][_0x303bb0[_0x8a4c('0x22')]],_[_0x8a4c('0x40')](_0x303bb0,['response','reason']));}};function updateStatus(_0x43026d){if(_0x43026d[_0x8a4c('0x41')]){faxMessage[_0x8a4c('0x42')](_0x43026d['AttachmentId'],{'failMessage':_0x8a4c('0x43')})[_0x8a4c('0x44')](function(_0x5c142c){ut[_0x8a4c('0x45')](_0x8a4c('0x46'),_0x5c142c);})['catch'](function(_0x265743){ut['logger'](_0x8a4c('0x47'),_0x265743);});}else{ut[_0x8a4c('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x8a4c('0x1e')]['updateStatus']=function(_0x581512,_0x333577,_0x1acb52){var _0x48361d=this;var _0x561e27={};if(_0x333577){_0x561e27={'read':_0x333577};}else{_0x561e27={'failMessage':_0x1acb52};}if(this[_0x8a4c('0x48')][_0x581512][_0x8a4c('0x41')]){faxMessage['update'](this['actions'][_0x581512][_0x8a4c('0x41')],_0x561e27)[_0x8a4c('0x44')](function(_0x181818){ut[_0x8a4c('0x45')](_0x8a4c('0x49'),_0x181818);})['catch'](function(_0x2c8c28){ut[_0x8a4c('0x45')]('[Fax][Message][NoUpdate1]',_0x2c8c28);})[_0x8a4c('0x4a')](function(){delete _0x48361d[_0x8a4c('0xd')][_0x581512];delete _0x48361d[_0x8a4c('0x48')][_0x581512];});}else{ut[_0x8a4c('0x45')](_0x8a4c('0x4b'));delete this[_0x8a4c('0xd')][_0x581512];delete this[_0x8a4c('0x48')][_0x581512];}};Fax['prototype'][_0x8a4c('0x1c')]=function(_0x473465){var _0x5db2fa=this;if(this[_0x8a4c('0xd')][_0x473465['uniqueid']]){if(this[_0x8a4c('0x48')][_0x473465[_0x8a4c('0x22')]]){this[_0x8a4c('0xd')][_0x473465[_0x8a4c('0x22')]]['id']=this[_0x8a4c('0x48')][_0x473465[_0x8a4c('0x22')]]['id'];this[_0x8a4c('0xd')][_0x473465[_0x8a4c('0x22')]][_0x8a4c('0x24')]=this[_0x8a4c('0x48')][_0x473465['uniqueid']][_0x8a4c('0x24')];}logger[_0x8a4c('0x25')](_0x473465[_0x8a4c('0x22')],this[_0x8a4c('0x48')][_0x473465[_0x8a4c('0x22')]]?_0x8a4c('0x4c'):_0x8a4c('0x4d'),JSON[_0x8a4c('0x3d')](this[_0x8a4c('0xd')][_0x473465[_0x8a4c('0x22')]]));if(this[_0x8a4c('0x48')][_0x473465['uniqueid']]){if(this['channels'][_0x473465['uniqueid']][_0x8a4c('0x4e')]>0x0&&this[_0x8a4c('0xd')][_0x473465[_0x8a4c('0x22')]][_0x8a4c('0x18')]==='SUCCESS'){this[_0x8a4c('0x4f')](_0x473465['uniqueid'],!![]);}else{this[_0x8a4c('0x4f')](_0x473465['uniqueid'],![],this[_0x8a4c('0xd')][_0x473465['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x473465[_0x8a4c('0x22')]][_0x8a4c('0x50')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x8a4c('0x51')]=function(_0xae029){var _0xe8a1c9=this;return new BPromise(function(_0x2d9f72,_0x4457b4){_0xe8a1c9[_0x8a4c('0x52')](_0xae029,_0xe8a1c9['faxAccounts'][_0xae029[_0x8a4c('0x53')]])[_0x8a4c('0x44')](function(_0x2c9288){ut[_0x8a4c('0x45')](_0x8a4c('0x54'),_0x2c9288);_0x2d9f72(ut[_0x8a4c('0x36')]('Fax\x20received'));})[_0x8a4c('0x3b')](function(_0xe535b1){ut[_0x8a4c('0x45')]('[Fax][execOriginate][failure]',_0xe535b1);updateStatus(_0xae029);_0x4457b4(ut[_0x8a4c('0x36')](_0x8a4c('0x55')));});});};Fax['prototype'][_0x8a4c('0x56')]=function(_0xecea2b){var _0x57f15e=this;return new BPromise(function(_0x584058,_0x36ffe0){var _0x8c8085=_0x57f15e[_0x8a4c('0x57')](_0x57f15e[_0x8a4c('0xe')][_0xecea2b[_0x8a4c('0x53')]][_0x8a4c('0x58')],_0xecea2b);if(_0x8c8085['isValid']){_0x584058(ut[_0x8a4c('0x36')](_0x8a4c('0x59')));}else{_0x36ffe0(ut[_0x8a4c('0x36')](_0x8c8085[_0x8a4c('0x36')]));}});};function originate(_0x44bcc8,_0x457df5,_0x12963e){return new BPromise(function(_0x2fc4af,_0x79f570){if(_0x12963e){var _0x2b55dd=util[_0x8a4c('0x5a')](_0x8a4c('0x5b'),path['parse'](_0x44bcc8[_0x8a4c('0x5')])[_0x8a4c('0x24')],_0x44bcc8[_0x8a4c('0x5')]);gs[_0x8a4c('0x5c')](_0x2b55dd)[_0x8a4c('0x44')](function(){_0x44bcc8['path']=util[_0x8a4c('0x5a')](_0x8a4c('0x5d'),path[_0x8a4c('0x38')](_0x44bcc8[_0x8a4c('0x5')])['dir'],path['parse'](_0x44bcc8[_0x8a4c('0x5')])[_0x8a4c('0x24')]);_0x457df5[_0x8a4c('0x5e')]=_0x44bcc8[_0x8a4c('0x5')];ut[_0x8a4c('0x45')](_0x8a4c('0x5f'),'');ami[_0x8a4c('0x60')](ut[_0x8a4c('0x61')](_0x44bcc8,_0x457df5))['then'](function(_0x15b890){_0x2fc4af(_0x15b890);})[_0x8a4c('0x3b')](function(_0x393251){_0x79f570(_0x393251);});})[_0x8a4c('0x3b')](function(_0x57baef){_0x79f570(_0x57baef);});}else{ami[_0x8a4c('0x60')](ut[_0x8a4c('0x61')](_0x44bcc8,_0x457df5))[_0x8a4c('0x44')](function(_0x2c8e3f){_0x2fc4af(_0x2c8e3f);})[_0x8a4c('0x3b')](function(_0x2a7a4a){_0x79f570(_0x2a7a4a);});}});}Fax[_0x8a4c('0x1e')][_0x8a4c('0x52')]=function(_0x1ae675,_0x3c709f){var _0x3cd571=this;return new BPromise(function(_0x586a7b,_0x45b060){var _0x2fb26e=uuid['v4']();var _0x3028b0=ut[_0x8a4c('0x62')](_0x1ae675,_0x3c709f);_0x3cd571[_0x8a4c('0x48')][_0x2fb26e]=new Action(_0x2fb26e,_0x3c709f,_0x1ae675);var _0x1303cf=_0x3cd571[_0x8a4c('0x48')][_0x2fb26e];if(path['parse'](_0x1ae675['path'])[_0x8a4c('0x63')]===_0x8a4c('0x39')){originate(_0x1303cf,_0x3028b0,!![])['then'](function(_0x39e160){_0x586a7b(_0x39e160);})[_0x8a4c('0x3b')](function(_0x40e4ef){_0x45b060(_0x40e4ef);});}else{originate(_0x1303cf,_0x3028b0,![])[_0x8a4c('0x44')](function(_0x236a9b){_0x586a7b(_0x236a9b);})['catch'](function(_0x292ed8){_0x45b060(_0x292ed8);});}});};Fax[_0x8a4c('0x1e')][_0x8a4c('0x64')]=function(_0x520781){return!_[_0x8a4c('0x65')](_0x520781)&&!_[_0x8a4c('0x65')](_0x520781[_0x8a4c('0x24')])&&!_[_0x8a4c('0x65')](_0x520781[_0x8a4c('0x66')])&&_0x520781['active']&&!_[_0x8a4c('0x65')](this[_0x8a4c('0xf')][util[_0x8a4c('0x5a')]('SIP/%s',_0x520781[_0x8a4c('0x24')])])&&!_[_0x8a4c('0x65')](this[_0x8a4c('0xf')][util[_0x8a4c('0x5a')](_0x8a4c('0x67'),_0x520781[_0x8a4c('0x24')])][_0x8a4c('0x2e')])&&(this[_0x8a4c('0xf')][util[_0x8a4c('0x5a')](_0x8a4c('0x67'),_0x520781[_0x8a4c('0x24')])][_0x8a4c('0x2e')]===_0x8a4c('0x68')||this['trunks'][util[_0x8a4c('0x5a')](_0x8a4c('0x67'),_0x520781['name'])][_0x8a4c('0x2e')]==='unmonitored');};Fax[_0x8a4c('0x1e')][_0x8a4c('0x57')]=function(_0x5b9820,_0x48a5f1){if(!this[_0x8a4c('0x64')](_0x5b9820)){ut[_0x8a4c('0x45')](_0x8a4c('0x69'),_[_0x8a4c('0x65')](_0x5b9820)?'':_0x5b9820[_0x8a4c('0x24')]+_0x8a4c('0x6a'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x8a4c('0x65')](_0x48a5f1[_0x8a4c('0x8')])){ut[_0x8a4c('0x45')](_0x8a4c('0x6b'),JSON[_0x8a4c('0x3d')](_0x48a5f1));return{'isValid':![],'message':_0x8a4c('0x6c')};}if(_[_0x8a4c('0x65')](_0x48a5f1[_0x8a4c('0x5')])){ut[_0x8a4c('0x45')](_0x8a4c('0x6d'),JSON[_0x8a4c('0x3d')](_0x48a5f1));return{'isValid':![],'message':_0x8a4c('0x6e')};}return{'isValid':!![],'message':_0x8a4c('0x6f')};};module[_0x8a4c('0x70')]=Fax; \ No newline at end of file +var _0xf06c=['syncOriginateResponse','prototype','from-voip-provider','exten','localstationid','uniqueid','channels','channel','name','\x20syncNewchannel\x20','info','syncVarSet','variable','hasOwnProperty','value','channelstatedesc','operation','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','.pdf','error','stringify','catch','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','updateStatus','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup'];(function(_0xf353c,_0x2ba378){var _0x54ddcf=function(_0x525fd5){while(--_0x525fd5){_0xf353c['push'](_0xf353c['shift']());}};_0x54ddcf(++_0x2ba378);}(_0xf06c,0x1a7));var _0xcf06=function(_0x3be313,_0x2ba0f8){_0x3be313=_0x3be313-0x0;var _0x5ef934=_0xf06c[_0x3be313];return _0x5ef934;};'use strict';var util=require(_0xcf06('0x0'));var _=require(_0xcf06('0x1'));var BPromise=require(_0xcf06('0x2'));var uuid=require(_0xcf06('0x3'));var moment=require(_0xcf06('0x4'));var path=require(_0xcf06('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0xcf06('0x6'))(_0xcf06('0x7'));var ami=require(_0xcf06('0x8'));var rpcDb=require(_0xcf06('0x9'));var Channel=require('./channel');var ut=require(_0xcf06('0xa'));var Action=require(_0xcf06('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xcf06('0xc'));var faxMessage=require(_0xcf06('0xd'));function Fax(_0x5a1b9d){this['channels']={};this[_0xcf06('0xe')]=_0x5a1b9d[_0xcf06('0xe')];this['trunks']=_0x5a1b9d[_0xcf06('0xf')];this[_0xcf06('0x10')]={};ami['on']('newchannel',this[_0xcf06('0x11')][_0xcf06('0x12')](this));ami['on'](_0xcf06('0x13'),this['syncVarSet']['bind'](this));ami['on'](_0xcf06('0x14'),this[_0xcf06('0x15')][_0xcf06('0x12')](this));ami['on'](_0xcf06('0x16'),this[_0xcf06('0x17')][_0xcf06('0x12')](this));ami['on'](_0xcf06('0x18'),this[_0xcf06('0x19')][_0xcf06('0x12')](this));ami['on'](_0xcf06('0x1a'),this[_0xcf06('0x1b')][_0xcf06('0x12')](this));ami['on'](_0xcf06('0x1c'),this['syncHangup'][_0xcf06('0x12')](this));ami['on']('originateresponse',this[_0xcf06('0x1d')][_0xcf06('0x12')](this));}Fax[_0xcf06('0x1e')][_0xcf06('0x11')]=function(_0x987770){if(_0x987770['context']===_0xcf06('0x1f')){for(var _0x95a41f in this['faxAccounts']){if(this[_0xcf06('0xe')]['hasOwnProperty'](_0x95a41f)){if(_0x987770[_0xcf06('0x20')]===this['faxAccounts'][_0x95a41f][_0xcf06('0x21')]){this['channels'][_0x987770[_0xcf06('0x22')]]={};this[_0xcf06('0x23')][_0x987770[_0xcf06('0x22')]][_0xcf06('0x24')]=_0x987770['channel'];this['channels'][_0x987770['uniqueid']]['id']=this['faxAccounts'][_0x95a41f]['id'];this['channels'][_0x987770[_0xcf06('0x22')]][_0xcf06('0x25')]=this[_0xcf06('0xe')][_0x95a41f][_0xcf06('0x25')];logger['info'](_0x987770[_0xcf06('0x22')],_0xcf06('0x26'));}}}}if(this[_0xcf06('0x10')][_0x987770[_0xcf06('0x22')]]){this[_0xcf06('0x23')][_0x987770[_0xcf06('0x22')]]={};this['channels'][_0x987770['uniqueid']][_0xcf06('0x24')]=_0x987770[_0xcf06('0x24')];logger[_0xcf06('0x27')](_0x987770[_0xcf06('0x22')],_0xcf06('0x26'));}};Fax[_0xcf06('0x1e')][_0xcf06('0x28')]=function(_0x332ebc){if(this[_0xcf06('0x23')][_0x332ebc[_0xcf06('0x22')]]){for(var _0x156225 in _0x332ebc[_0xcf06('0x29')]){if(_0x332ebc[_0xcf06('0x29')][_0xcf06('0x2a')](_0x156225)){this[_0xcf06('0x23')][_0x332ebc[_0xcf06('0x22')]][_0x156225]=_0x332ebc[_0xcf06('0x2b')];}}}};Fax[_0xcf06('0x1e')][_0xcf06('0x15')]=function(_0x4e0194){if(this[_0xcf06('0x23')][_0x4e0194[_0xcf06('0x22')]]){this[_0xcf06('0x23')][_0x4e0194[_0xcf06('0x22')]]['channelstate']=_0x4e0194['channelstate'];this['channels'][_0x4e0194[_0xcf06('0x22')]][_0xcf06('0x2c')]=_0x4e0194['channelstatedesc'];}};Fax[_0xcf06('0x1e')][_0xcf06('0x17')]=function(_0x3e59e3){if(this[_0xcf06('0x23')][_0x3e59e3[_0xcf06('0x22')]]){for(var _0x1c40da in _0x3e59e3[_0xcf06('0x29')]){if(_0x3e59e3['variable'][_0xcf06('0x2a')](_0x1c40da)){this[_0xcf06('0x23')][_0x3e59e3['uniqueid']][_0x1c40da]=_0x3e59e3['value'];}}}};Fax['prototype']['syncFaxStatus']=function(_0x114aec){if(this['channels'][_0x114aec[_0xcf06('0x22')]]){this[_0xcf06('0x23')][_0x114aec[_0xcf06('0x22')]][_0xcf06('0x2d')]=_0x114aec[_0xcf06('0x2d')];this[_0xcf06('0x23')][_0x114aec[_0xcf06('0x22')]]['status']=_0x114aec['status'];this[_0xcf06('0x23')][_0x114aec[_0xcf06('0x22')]][_0xcf06('0x21')]=_0x114aec[_0xcf06('0x21')];this[_0xcf06('0x23')][_0x114aec[_0xcf06('0x22')]]['filename']=_0x114aec[_0xcf06('0x2e')];logger[_0xcf06('0x27')](_0x114aec[_0xcf06('0x22')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xcf06('0x1b')]=function(_0x4dd874){var _0x8a8f70=this;if(this[_0xcf06('0x23')][_0x4dd874[_0xcf06('0x22')]]){var _0x126635=this['channels'][_0x4dd874[_0xcf06('0x22')]]['id'];this[_0xcf06('0x23')][_0x4dd874[_0xcf06('0x22')]]['remotestationid']=_0x4dd874[_0xcf06('0x2f')];this['channels'][_0x4dd874[_0xcf06('0x22')]]['pagestransferred']=_0x4dd874[_0xcf06('0x30')];this[_0xcf06('0x23')][_0x4dd874[_0xcf06('0x22')]][_0xcf06('0x21')]=_0x4dd874['localstationid'];this[_0xcf06('0x23')][_0x4dd874['uniqueid']][_0xcf06('0x31')]=_0x4dd874['resolution'];this[_0xcf06('0x23')][_0x4dd874[_0xcf06('0x22')]][_0xcf06('0x32')]=_0x4dd874[_0xcf06('0x32')];this[_0xcf06('0x23')][_0x4dd874['uniqueid']][_0xcf06('0x2e')]=_0x4dd874[_0xcf06('0x2e')];this[_0xcf06('0x23')][_0x4dd874[_0xcf06('0x22')]][_0xcf06('0x33')]=_0x4dd874[_0xcf06('0x33')];if(this[_0xcf06('0x23')][_0x4dd874[_0xcf06('0x22')]][_0xcf06('0x30')]>0x0){tiff2pdf(_0x4dd874[_0xcf06('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0xa09956){logger[_0xcf06('0x27')](_0x4dd874[_0xcf06('0x22')],_0xcf06('0x34'),_0xa09956[_0xcf06('0x35')]);attachment[_0xcf06('0x36')]({'name':path[_0xcf06('0x37')](_0x4dd874[_0xcf06('0x2e')])[_0xcf06('0x25')],'basename':path['parse'](_0x4dd874[_0xcf06('0x2e')])[_0xcf06('0x25')]+'.pdf','type':_0xcf06('0x38')})[_0xcf06('0x39')](function(_0x3fbccf){faxAccount['notify'](_0x126635,{'from':_0x4dd874[_0xcf06('0x33')],'mapKey':_0xcf06('0x7'),'body':path[_0xcf06('0x37')](_0x4dd874[_0xcf06('0x2e')])[_0xcf06('0x25')]+_0xcf06('0x3a'),'AttachmentId':_0x3fbccf['id']})['catch'](function(_0x5f8f98){logger[_0xcf06('0x3b')](_0x4dd874[_0xcf06('0x22')],'\x20notify\x20',JSON[_0xcf06('0x3c')](_0x5f8f98));});})[_0xcf06('0x3d')](function(_0x2b5181){logger[_0xcf06('0x3b')](_0x4dd874[_0xcf06('0x22')],_0xcf06('0x3e'),JSON[_0xcf06('0x3c')](_0x2b5181));});});}logger['info'](_0x4dd874[_0xcf06('0x22')],_0xcf06('0x3e'));}};Fax['prototype'][_0xcf06('0x1d')]=function(_0x27b49e){if(this[_0xcf06('0x10')][_0x27b49e[_0xcf06('0x22')]]){_[_0xcf06('0x3f')](this['channels'][_0x27b49e[_0xcf06('0x22')]],_[_0xcf06('0x40')](_0x27b49e,[_0xcf06('0x41'),'reason']));}};function updateStatus(_0x2c597b){if(_0x2c597b[_0xcf06('0x42')]){faxMessage[_0xcf06('0x43')](_0x2c597b[_0xcf06('0x42')],{'failMessage':_0xcf06('0x44')})[_0xcf06('0x39')](function(_0x1956ef){ut['logger'](_0xcf06('0x45'),_0x1956ef);})[_0xcf06('0x3d')](function(_0x33ab20){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x33ab20);});}else{ut[_0xcf06('0x46')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xcf06('0x1e')][_0xcf06('0x47')]=function(_0x3d004d,_0x15f203,_0x3c9a01){var _0x4e79fd=this;var _0x3ee7b9={};if(_0x15f203){_0x3ee7b9={'read':_0x15f203};}else{_0x3ee7b9={'failMessage':_0x3c9a01};}if(this[_0xcf06('0x10')][_0x3d004d]['AttachmentId']){faxMessage['update'](this['actions'][_0x3d004d]['AttachmentId'],_0x3ee7b9)[_0xcf06('0x39')](function(_0x41168d){ut[_0xcf06('0x46')]('[Fax][Message][Updated]',_0x41168d);})[_0xcf06('0x3d')](function(_0x13764b){ut[_0xcf06('0x46')]('[Fax][Message][NoUpdate1]',_0x13764b);})[_0xcf06('0x48')](function(){delete _0x4e79fd[_0xcf06('0x23')][_0x3d004d];delete _0x4e79fd[_0xcf06('0x10')][_0x3d004d];});}else{ut[_0xcf06('0x46')](_0xcf06('0x49'));delete this['channels'][_0x3d004d];delete this[_0xcf06('0x10')][_0x3d004d];}};Fax[_0xcf06('0x1e')][_0xcf06('0x4a')]=function(_0x37b2ef){var _0x498c67=this;if(this['channels'][_0x37b2ef[_0xcf06('0x22')]]){if(this['actions'][_0x37b2ef[_0xcf06('0x22')]]){this['channels'][_0x37b2ef[_0xcf06('0x22')]]['id']=this['actions'][_0x37b2ef[_0xcf06('0x22')]]['id'];this['channels'][_0x37b2ef[_0xcf06('0x22')]][_0xcf06('0x25')]=this[_0xcf06('0x10')][_0x37b2ef[_0xcf06('0x22')]][_0xcf06('0x25')];}logger[_0xcf06('0x27')](_0x37b2ef[_0xcf06('0x22')],this[_0xcf06('0x10')][_0x37b2ef[_0xcf06('0x22')]]?_0xcf06('0x4b'):_0xcf06('0x4c'),JSON[_0xcf06('0x3c')](this[_0xcf06('0x23')][_0x37b2ef[_0xcf06('0x22')]]));if(this[_0xcf06('0x10')][_0x37b2ef['uniqueid']]){if(this['channels'][_0x37b2ef['uniqueid']][_0xcf06('0x4d')]>0x0&&this[_0xcf06('0x23')][_0x37b2ef[_0xcf06('0x22')]][_0xcf06('0x18')]===_0xcf06('0x4e')){this[_0xcf06('0x47')](_0x37b2ef[_0xcf06('0x22')],!![]);}else{this[_0xcf06('0x47')](_0x37b2ef[_0xcf06('0x22')],![],this['channels'][_0x37b2ef[_0xcf06('0x22')]][_0xcf06('0x4f')]?'SENDING\x20FAILED:\x20'+this[_0xcf06('0x23')][_0x37b2ef[_0xcf06('0x22')]][_0xcf06('0x4f')]:_0xcf06('0x50'));}}}};Fax[_0xcf06('0x1e')]['send']=function(_0x1dd26c){var _0x175d04=this;return new BPromise(function(_0x3e856b,_0x1df452){_0x175d04[_0xcf06('0x51')](_0x1dd26c,_0x175d04[_0xcf06('0xe')][_0x1dd26c['FaxAccountId']])[_0xcf06('0x39')](function(_0x64ee42){ut['logger'](_0xcf06('0x52'),_0x64ee42);_0x3e856b(ut['message'](_0xcf06('0x53')));})[_0xcf06('0x3d')](function(_0x3d2c04){ut[_0xcf06('0x46')](_0xcf06('0x54'),_0x3d2c04);updateStatus(_0x1dd26c);_0x1df452(ut[_0xcf06('0x35')](_0xcf06('0x55')));});});};Fax[_0xcf06('0x1e')][_0xcf06('0x56')]=function(_0x4a7e1c){var _0x359235=this;return new BPromise(function(_0x4bc8e8,_0x4c3435){var _0x960487=_0x359235[_0xcf06('0x57')](_0x359235[_0xcf06('0xe')][_0x4a7e1c['FaxAccountId']][_0xcf06('0x58')],_0x4a7e1c);if(_0x960487[_0xcf06('0x59')]){_0x4bc8e8(ut[_0xcf06('0x35')](_0xcf06('0x5a')));}else{_0x4c3435(ut['message'](_0x960487[_0xcf06('0x35')]));}});};function originate(_0x5b0f46,_0x21b602,_0x57014d){return new BPromise(function(_0xbd4709,_0x5bbb3d){if(_0x57014d){var _0x35d530=util[_0xcf06('0x5b')](_0xcf06('0x5c'),path['parse'](_0x5b0f46[_0xcf06('0x5')])[_0xcf06('0x25')],_0x5b0f46['path']);gs[_0xcf06('0x5d')](_0x35d530)[_0xcf06('0x39')](function(){_0x5b0f46[_0xcf06('0x5')]=util['format'](_0xcf06('0x5e'),path[_0xcf06('0x37')](_0x5b0f46[_0xcf06('0x5')])['dir'],path[_0xcf06('0x37')](_0x5b0f46['path'])[_0xcf06('0x25')]);_0x21b602[_0xcf06('0x5f')]=_0x5b0f46[_0xcf06('0x5')];ut['logger'](_0xcf06('0x60'),'');ami[_0xcf06('0x61')](ut[_0xcf06('0x62')](_0x5b0f46,_0x21b602))['then'](function(_0x11de71){_0xbd4709(_0x11de71);})['catch'](function(_0x5b9cd6){_0x5bbb3d(_0x5b9cd6);});})['catch'](function(_0x11e7d5){_0x5bbb3d(_0x11e7d5);});}else{ami[_0xcf06('0x61')](ut['variablesAction'](_0x5b0f46,_0x21b602))[_0xcf06('0x39')](function(_0x1e1cb5){_0xbd4709(_0x1e1cb5);})['catch'](function(_0x4a11a2){_0x5bbb3d(_0x4a11a2);});}});}Fax[_0xcf06('0x1e')]['execOriginate']=function(_0x481551,_0x1e0c96){var _0x1ff163=this;return new BPromise(function(_0x44b16f,_0x5a9995){var _0x578f21=uuid['v4']();var _0x1d6585=ut[_0xcf06('0x63')](_0x481551,_0x1e0c96);_0x1ff163[_0xcf06('0x10')][_0x578f21]=new Action(_0x578f21,_0x1e0c96,_0x481551);var _0x49a825=_0x1ff163[_0xcf06('0x10')][_0x578f21];if(path['parse'](_0x481551['path'])[_0xcf06('0x64')]===_0xcf06('0x3a')){originate(_0x49a825,_0x1d6585,!![])[_0xcf06('0x39')](function(_0xf7e11){_0x44b16f(_0xf7e11);})[_0xcf06('0x3d')](function(_0x5b684d){_0x5a9995(_0x5b684d);});}else{originate(_0x49a825,_0x1d6585,![])['then'](function(_0x4af950){_0x44b16f(_0x4af950);})[_0xcf06('0x3d')](function(_0x279dda){_0x5a9995(_0x279dda);});}});};Fax['prototype'][_0xcf06('0x65')]=function(_0x3ac611){return!_[_0xcf06('0x66')](_0x3ac611)&&!_[_0xcf06('0x66')](_0x3ac611[_0xcf06('0x25')])&&!_[_0xcf06('0x66')](_0x3ac611[_0xcf06('0x67')])&&_0x3ac611[_0xcf06('0x67')]&&!_[_0xcf06('0x66')](this[_0xcf06('0xf')][util[_0xcf06('0x5b')](_0xcf06('0x68'),_0x3ac611[_0xcf06('0x25')])])&&!_[_0xcf06('0x66')](this[_0xcf06('0xf')][util['format'](_0xcf06('0x68'),_0x3ac611[_0xcf06('0x25')])]['status'])&&(this[_0xcf06('0xf')][util[_0xcf06('0x5b')](_0xcf06('0x68'),_0x3ac611[_0xcf06('0x25')])][_0xcf06('0x69')]===_0xcf06('0x6a')||this[_0xcf06('0xf')][util[_0xcf06('0x5b')](_0xcf06('0x68'),_0x3ac611[_0xcf06('0x25')])][_0xcf06('0x69')]==='unmonitored');};Fax[_0xcf06('0x1e')][_0xcf06('0x57')]=function(_0x117e1d,_0x213d76){if(!this[_0xcf06('0x65')](_0x117e1d)){ut[_0xcf06('0x46')](_0xcf06('0x6b'),_[_0xcf06('0x66')](_0x117e1d)?'':_0x117e1d[_0xcf06('0x25')]+_0xcf06('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x213d76[_0xcf06('0x7')])){ut[_0xcf06('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xcf06('0x3c')](_0x213d76));return{'isValid':![],'message':_0xcf06('0x6d')};}if(_[_0xcf06('0x66')](_0x213d76['path'])){ut[_0xcf06('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xcf06('0x3c')](_0x213d76));return{'isValid':![],'message':_0xcf06('0x6e')};}return{'isValid':!![],'message':_0xcf06('0x6f')};};module[_0xcf06('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0e767ae..794ae78 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 _0xab0b=['lodash','error','inspect','notify','resolve','then','[Notify]\x20','bluebird'];(function(_0x2bf14b,_0x409fc8){var _0x32f2d4=function(_0x1f5602){while(--_0x1f5602){_0x2bf14b['push'](_0x2bf14b['shift']());}};_0x32f2d4(++_0x409fc8);}(_0xab0b,0x14f));var _0xbab0=function(_0x3dd60f,_0x4566bd){_0x3dd60f=_0x3dd60f-0x0;var _0x2cb70e=_0xab0b[_0x3dd60f];return _0x2cb70e;};'use strict';var util=require('util');var BPromise=require(_0xbab0('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0xbab0('0x1'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x268ad8){return function(_0x5d125d){logger[_0xbab0('0x2')](_0x268ad8,util[_0xbab0('0x3')](_0x5d125d,{'showHidden':![],'depth':null}));};}exports[_0xbab0('0x4')]=function(_0x531143,_0x5eece9){return BPromise[_0xbab0('0x5')]()[_0xbab0('0x6')](faxAccount[_0xbab0('0x4')](_0x531143,_0x5eece9))['catch'](loggerCatch(_0xbab0('0x7')));}; \ No newline at end of file +var _0x1a28=['notify','then','catch','[Notify]\x20','util','bluebird','preview','error','inspect'];(function(_0x5ee1ef,_0x8d83d5){var _0x601cdc=function(_0xf3f658){while(--_0xf3f658){_0x5ee1ef['push'](_0x5ee1ef['shift']());}};_0x601cdc(++_0x8d83d5);}(_0x1a28,0x136));var _0x81a2=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x1a28[_0x4f08dd];return _0x3017ee;};'use strict';var util=require(_0x81a2('0x0'));var BPromise=require(_0x81a2('0x1'));var logger=require('../../../config/logger')(_0x81a2('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xe4055a){return function(_0x1d2bf6){logger[_0x81a2('0x3')](_0xe4055a,util[_0x81a2('0x4')](_0x1d2bf6,{'showHidden':![],'depth':null}));};}exports[_0x81a2('0x5')]=function(_0x3310ca,_0x31ee8f){return BPromise['resolve']()[_0x81a2('0x6')](faxAccount[_0x81a2('0x5')](_0x3310ca,_0x31ee8f))[_0x81a2('0x7')](loggerCatch(_0x81a2('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index a2ba23f..09bcf60 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 _0xdf8d=['child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x5c6aa1,_0x5792a2){var _0x23b899=function(_0x336149){while(--_0x336149){_0x5c6aa1['push'](_0x5c6aa1['shift']());}};_0x23b899(++_0x5792a2);}(_0xdf8d,0x1aa));var _0xddf8=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0xdf8d[_0xa3463d];return _0x50fd67;};'use strict';var util=require(_0xddf8('0x0'));var logger=require(_0xddf8('0x1'))(_0xddf8('0x2'));var BPromise=require(_0xddf8('0x3'));var exec=require(_0xddf8('0x4'))[_0xddf8('0x5')];exports['execute']=function(_0x20a789){return new BPromise(function(_0x68ac74,_0x2bd646){exec(_0x20a789,function(_0x2553e7,_0x47e945,_0x1e3ae3){logger[_0xddf8('0x6')](_0xddf8('0x7'),_0x47e945);if(_0x2553e7){logger[_0xddf8('0x6')](_0xddf8('0x7'),_0xddf8('0x8'),util[_0xddf8('0x9')](_0x2553e7,{'showHidden':![],'depth':null}),_0x47e945,_0x1e3ae3);_0x2bd646(_0x2553e7);}_0x68ac74(_0x47e945);});});}; \ No newline at end of file +var _0x60be=['../../../../config/logger','fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x72ae5a,_0x174cab){var _0x1127f0=function(_0x42cc8c){while(--_0x42cc8c){_0x72ae5a['push'](_0x72ae5a['shift']());}};_0x1127f0(++_0x174cab);}(_0x60be,0x1ad));var _0xe60b=function(_0x340ea5,_0x1c0c96){_0x340ea5=_0x340ea5-0x0;var _0xd74a4e=_0x60be[_0x340ea5];return _0xd74a4e;};'use strict';var util=require(_0xe60b('0x0'));var logger=require(_0xe60b('0x1'))(_0xe60b('0x2'));var BPromise=require(_0xe60b('0x3'));var exec=require(_0xe60b('0x4'))[_0xe60b('0x5')];exports['execute']=function(_0x45fbad){return new BPromise(function(_0x253daf,_0x2be07e){exec(_0x45fbad,function(_0x132e51,_0x5161a6,_0x4e44d4){logger[_0xe60b('0x6')](_0xe60b('0x7'),_0x5161a6);if(_0x132e51){logger[_0xe60b('0x6')](_0xe60b('0x7'),_0xe60b('0x8'),util[_0xe60b('0x9')](_0x132e51,{'showHidden':![],'depth':null}),_0x5161a6,_0x4e44d4);_0x2be07e(_0x132e51);}_0x253daf(_0x5161a6);});});}; \ 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 cb58a76..c045052 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 _0x88b7=['info','ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','lodash','../../../../config/logger','message','logger'];(function(_0x4876df,_0xddf42f){var _0x1d4b9b=function(_0x156e76){while(--_0x156e76){_0x4876df['push'](_0x4876df['shift']());}};_0x1d4b9b(++_0xddf42f);}(_0x88b7,0x9c));var _0x788b=function(_0x49d006,_0x148007){_0x49d006=_0x49d006-0x0;var _0x4aa288=_0x88b7[_0x49d006];return _0x4aa288;};'use strict';var util=require('util');var _=require(_0x788b('0x0'));var moment=require('moment');var logger=require(_0x788b('0x1'))('fax');exports[_0x788b('0x2')]=function(_0xe92625){return{'message':_0xe92625};};exports[_0x788b('0x3')]=function(_0x13b4dc,_0x3fb57e){logger[_0x788b('0x4')](_0x13b4dc,util['inspect'](_0x3fb57e,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2bba64,_0x335b32){var _0x55308c={'XMF-ECM':_0x335b32[_0x788b('0x5')],'XMF-HEADERINFO':_0x335b32[_0x788b('0x6')],'XMF-MINRATE':_0x335b32[_0x788b('0x7')],'XMF-MAXRATE':_0x335b32['maxrate'],'XMF-MODEM':util[_0x788b('0x8')](_0x788b('0x9'),_0x335b32[_0x788b('0xa')]),'XMF-GATEWAY':_0x335b32['gateway'],'XMF-FAXDETECT':_0x335b32[_0x788b('0xb')],'XMF-T38TIMEOUT':_0x335b32[_0x788b('0xc')],'XMF-LOCALSTATIONID':_0x335b32[_0x788b('0xd')],'XMF-PATH':_0x2bba64['path']};return _0x55308c;};exports[_0x788b('0xe')]=function(_0x4267f7,_0x35dabc){return{'actionid':_0x4267f7[_0x788b('0xf')],'action':_0x788b('0x10'),'channel':_0x4267f7[_0x788b('0x11')],'Exten':_0x788b('0x12'),'Context':_0x788b('0x13'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x4267f7[_0x788b('0x6')]?_0x4267f7[_0x788b('0x6')]:'',_0x4267f7[_0x788b('0xd')]),'variable':_0x35dabc,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4267f7[_0x788b('0xf')]};}; \ No newline at end of file +var _0xb861=['util','moment','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x29220c,_0x471cc8){var _0x5097a7=function(_0x2fb698){while(--_0x2fb698){_0x29220c['push'](_0x29220c['shift']());}};_0x5097a7(++_0x471cc8);}(_0xb861,0xa1));var _0x1b86=function(_0x505f73,_0x1f95d8){_0x505f73=_0x505f73-0x0;var _0x227e7f=_0xb861[_0x505f73];return _0x227e7f;};'use strict';var util=require(_0x1b86('0x0'));var _=require('lodash');var moment=require(_0x1b86('0x1'));var logger=require('../../../../config/logger')(_0x1b86('0x2'));exports[_0x1b86('0x3')]=function(_0x417493){return{'message':_0x417493};};exports[_0x1b86('0x4')]=function(_0x2eea9c,_0x3e5a9d){logger[_0x1b86('0x5')](_0x2eea9c,util[_0x1b86('0x6')](_0x3e5a9d,{'showHidden':![],'depth':null}));};exports[_0x1b86('0x7')]=function(_0x5a5652,_0x1617fa){var _0x5c3a12={'XMF-ECM':_0x1617fa['ecm'],'XMF-HEADERINFO':_0x1617fa[_0x1b86('0x8')],'XMF-MINRATE':_0x1617fa[_0x1b86('0x9')],'XMF-MAXRATE':_0x1617fa[_0x1b86('0xa')],'XMF-MODEM':util[_0x1b86('0xb')](_0x1b86('0xc'),_0x1617fa['modem']),'XMF-GATEWAY':_0x1617fa['gateway'],'XMF-FAXDETECT':_0x1617fa[_0x1b86('0xd')],'XMF-T38TIMEOUT':_0x1617fa[_0x1b86('0xe')],'XMF-LOCALSTATIONID':_0x1617fa[_0x1b86('0xf')],'XMF-PATH':_0x5a5652[_0x1b86('0x10')]};return _0x5c3a12;};exports[_0x1b86('0x11')]=function(_0x19b00d,_0x2f6736){return{'actionid':_0x19b00d[_0x1b86('0x12')],'action':_0x1b86('0x13'),'channel':_0x19b00d[_0x1b86('0x14')],'Exten':_0x1b86('0x15'),'Context':_0x1b86('0x16'),'Priority':'1','callerid':util[_0x1b86('0xb')]('\x22%s\x22\x20<%s>',_0x19b00d['headerinfo']?_0x19b00d[_0x1b86('0x8')]:'',_0x19b00d['localstationid']),'variable':_0x2f6736,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x19b00d['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6029a2b..aefb3c0 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 _0x71cd=['initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','listen','sync','catch','error','[index.js][main]','inspect','moment','./server','./realtime','./report','./acw','./preview','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71cd,0x1a6));var _0xd71c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71cd[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require('util');var moment=require(_0xd71c('0x0'));var server=require(_0xd71c('0x1'));var Realtime=require(_0xd71c('0x2'));var Report=require(_0xd71c('0x3'));var Acw=require(_0xd71c('0x4'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0xd71c('0x5'));var Fax=require('./fax');var user=require(_0xd71c('0x6'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xd71c('0x7'));var trunk=require(_0xd71c('0x8'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0xd71c('0x9'));var campaign=require(_0xd71c('0xa'));var voiceExtension=require(_0xd71c('0xb'));var faxAccount=require(_0xd71c('0xc'));var zendesk=require(_0xd71c('0xd'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xd71c('0xe'));var vtiger=require(_0xd71c('0xf'));var freshsales=require(_0xd71c('0x10'));var servicenow=require(_0xd71c('0x11'));var dynamics365=require(_0xd71c('0x12'));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(_0xd71c('0x13'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd71c('0x14')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd71c('0x14')](_0xd71c('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xd71c('0x16')]()[_0xd71c('0x17')](user[_0xd71c('0x18')]())[_0xd71c('0x17')](realtime[_0xd71c('0x19')]())[_0xd71c('0x17')](user[_0xd71c('0x1a')]())['then'](realtime[_0xd71c('0x1b')]())[_0xd71c('0x17')](trunk[_0xd71c('0x1c')]())[_0xd71c('0x17')](realtime[_0xd71c('0x1d')]())['then'](voiceQueue[_0xd71c('0x1e')]())[_0xd71c('0x17')](realtime[_0xd71c('0x1f')]())[_0xd71c('0x17')](trigger[_0xd71c('0x20')]())[_0xd71c('0x17')](realtime[_0xd71c('0x21')]())[_0xd71c('0x17')](template[_0xd71c('0x22')]())[_0xd71c('0x17')](realtime[_0xd71c('0x23')]())['then'](zendesk[_0xd71c('0x24')]())[_0xd71c('0x17')](realtime[_0xd71c('0x25')]())[_0xd71c('0x17')](salesforce[_0xd71c('0x26')]())['then'](realtime[_0xd71c('0x27')]())[_0xd71c('0x17')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xd71c('0x28')]())[_0xd71c('0x17')](freshdesk[_0xd71c('0x29')]())[_0xd71c('0x17')](realtime[_0xd71c('0x2a')]())[_0xd71c('0x17')](desk[_0xd71c('0x2b')]())[_0xd71c('0x17')](realtime['initDeskAccounts']())[_0xd71c('0x17')](zoho[_0xd71c('0x2c')]())[_0xd71c('0x17')](realtime[_0xd71c('0x2d')]())['then'](vtiger[_0xd71c('0x2e')]())[_0xd71c('0x17')](realtime[_0xd71c('0x2f')]())[_0xd71c('0x17')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xd71c('0x30')]())[_0xd71c('0x17')](servicenow[_0xd71c('0x31')]())[_0xd71c('0x17')](realtime[_0xd71c('0x32')]())[_0xd71c('0x17')](dynamics365[_0xd71c('0x33')]())[_0xd71c('0x17')](realtime['initDynamics365Accounts']())[_0xd71c('0x17')](campaign['getCampaigns']())[_0xd71c('0x17')](realtime[_0xd71c('0x34')]())[_0xd71c('0x17')](voiceExtension[_0xd71c('0x35')]())[_0xd71c('0x17')](realtime['initVoiceExtensions']())[_0xd71c('0x17')](faxAccount['getFaxAccounts']())[_0xd71c('0x17')](realtime[_0xd71c('0x36')]())[_0xd71c('0x17')](function(){return realtime;});}function initParams(){return Promise[_0xd71c('0x16')]()[_0xd71c('0x17')](voiceQueueReport[_0xd71c('0x37')]())[_0xd71c('0x17')](realtime['initVoiceQueueReports']())[_0xd71c('0x17')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xd71c('0x17')](realtime[_0xd71c('0x38')]())[_0xd71c('0x17')](cmHopperHistory[_0xd71c('0x39')]())[_0xd71c('0x17')](realtime['initCampaignHopperHistory']())[_0xd71c('0x17')](voiceCallReport[_0xd71c('0x3a')]())[_0xd71c('0x17')](realtime[_0xd71c('0x3b')]())['catch'](function(_0x564a59){logger['error'](_0xd71c('0x3c'),util['inspect'](_0x564a59,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd71c('0x3d')](realtime,preview,fax)[_0xd71c('0x17')](function(){return initRealtime();})[_0xd71c('0x17')](function(){return initParams();})['then'](function(){report[_0xd71c('0x3e')]();setInterval(initRealtime,0x1388);})[_0xd71c('0x3f')](function(_0x21d42e){logger[_0xd71c('0x40')](_0xd71c('0x41'),util[_0xd71c('0x42')](_0x21d42e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xa6cc=['getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','ami','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts'];(function(_0x12b830,_0xd66540){var _0x261dc4=function(_0x57037a){while(--_0x57037a){_0x12b830['push'](_0x12b830['shift']());}};_0x261dc4(++_0xd66540);}(_0xa6cc,0xe3));var _0xca6c=function(_0x18ae6d,_0x255d00){_0x18ae6d=_0x18ae6d-0x0;var _0x3deb94=_0xa6cc[_0x18ae6d];return _0x3deb94;};'use strict';var util=require(_0xca6c('0x0'));var moment=require(_0xca6c('0x1'));var server=require(_0xca6c('0x2'));var Realtime=require(_0xca6c('0x3'));var Report=require(_0xca6c('0x4'));var Acw=require(_0xca6c('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xca6c('0x6'));var Preview=require(_0xca6c('0x7'));var Fax=require(_0xca6c('0x8'));var user=require(_0xca6c('0x9'));var voiceQueue=require(_0xca6c('0xa'));var voiceQueueReport=require(_0xca6c('0xb'));var voiceCallReport=require(_0xca6c('0xc'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xca6c('0xd'));var cmHopperHistory=require(_0xca6c('0xe'));var campaign=require(_0xca6c('0xf'));var voiceExtension=require(_0xca6c('0x10'));var faxAccount=require(_0xca6c('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xca6c('0x12'));var freshdesk=require(_0xca6c('0x13'));var desk=require(_0xca6c('0x14'));var zoho=require(_0xca6c('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xca6c('0x16'));var servicenow=require(_0xca6c('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xca6c('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xca6c('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xca6c('0x1a')]()[_0xca6c('0x1b')](user[_0xca6c('0x1c')]())[_0xca6c('0x1b')](realtime['initAgents']())[_0xca6c('0x1b')](user[_0xca6c('0x1d')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x1e')]())[_0xca6c('0x1b')](trunk[_0xca6c('0x1f')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x20')]())['then'](voiceQueue[_0xca6c('0x21')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x22')]())[_0xca6c('0x1b')](trigger['getTriggers']())['then'](realtime[_0xca6c('0x23')]())[_0xca6c('0x1b')](template[_0xca6c('0x24')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x25')]())[_0xca6c('0x1b')](zendesk[_0xca6c('0x26')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x27')]())[_0xca6c('0x1b')](salesforce['getSalesforceAccounts']())[_0xca6c('0x1b')](realtime[_0xca6c('0x28')]())[_0xca6c('0x1b')](sugarcrm['getSugarcrmAccounts']())[_0xca6c('0x1b')](realtime['initSugarcrmAccounts']())[_0xca6c('0x1b')](freshdesk[_0xca6c('0x29')]())['then'](realtime[_0xca6c('0x2a')]())['then'](desk[_0xca6c('0x2b')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x2c')]())['then'](zoho['getZohoAccounts']())['then'](realtime[_0xca6c('0x2d')]())['then'](vtiger[_0xca6c('0x2e')]())['then'](realtime[_0xca6c('0x2f')]())['then'](freshsales['getFreshsalesAccounts']())[_0xca6c('0x1b')](realtime[_0xca6c('0x30')]())['then'](servicenow['getServicenowAccounts']())[_0xca6c('0x1b')](realtime[_0xca6c('0x31')]())[_0xca6c('0x1b')](dynamics365[_0xca6c('0x32')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x33')]())['then'](campaign[_0xca6c('0x34')]())[_0xca6c('0x1b')](realtime['initCampaigns']())[_0xca6c('0x1b')](voiceExtension[_0xca6c('0x35')]())['then'](realtime[_0xca6c('0x36')]())['then'](faxAccount[_0xca6c('0x37')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x38')]())[_0xca6c('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0xca6c('0x1a')]()[_0xca6c('0x1b')](voiceQueueReport[_0xca6c('0x39')]())['then'](realtime[_0xca6c('0x3a')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xca6c('0x1b')](realtime[_0xca6c('0x3b')]())[_0xca6c('0x1b')](cmHopperHistory[_0xca6c('0x3c')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x3d')]())[_0xca6c('0x1b')](voiceCallReport[_0xca6c('0x3e')]())[_0xca6c('0x1b')](realtime[_0xca6c('0x3f')]())[_0xca6c('0x40')](function(_0x4b2913){logger[_0xca6c('0x41')](_0xca6c('0x42'),util[_0xca6c('0x43')](_0x4b2913,{'showHidden':![],'depth':null}));});}function main(){return server[_0xca6c('0x44')](realtime,preview,fax)[_0xca6c('0x1b')](function(){return initRealtime();})[_0xca6c('0x1b')](function(){return initParams();})[_0xca6c('0x1b')](function(){report[_0xca6c('0x45')]();setInterval(initRealtime,0x1388);})[_0xca6c('0x40')](function(_0x1e7be3){logger[_0xca6c('0x41')](_0xca6c('0x46'),util[_0xca6c('0x43')](_0x1e7be3,{'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 be27372..1306a9a 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 _0x0aeb=['user:save','emit','user:presence','exports','lodash','util','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','talking','statePause','toNumber','format','status','stringify','user:%s'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x0aeb,0x7c));var _0xb0ae=function(_0x4654b1,_0x530fdd){_0x4654b1=_0x4654b1-0x0;var _0x44da23=_0x0aeb[_0x4654b1];return _0x44da23;};'use strict';var _=require(_0xb0ae('0x0'));var util=require(_0xb0ae('0x1'));var moment=require('moment');var md5=require(_0xb0ae('0x2'));var Redis=require(_0xb0ae('0x3'));var config=require(_0xb0ae('0x4'));config['redis']=_[_0xb0ae('0x5')](config[_0xb0ae('0x6')],{'host':_0xb0ae('0x7'),'port':0x18eb});var io=require(_0xb0ae('0x8'))(new Redis(config['redis']));function Agent(_0x530f36){this['id']=_0x530f36['id']||0x0;this['name']=_0x530f36[_0xb0ae('0x9')]||'';this[_0xb0ae('0xa')]=_0x530f36[_0xb0ae('0xa')]||'';this['accountcode']=_0x530f36[_0xb0ae('0xb')]||'';this['fullname']=_0x530f36[_0xb0ae('0xc')]||'';this[_0xb0ae('0xd')]='unknown';this['stateTime']=0x0;this['status']=_0xb0ae('0xe');this[_0xb0ae('0xf')]='';this[_0xb0ae('0x10')]='';this[_0xb0ae('0x11')]='';this[_0xb0ae('0x12')]='';this[_0xb0ae('0x13')]=_0x530f36[_0xb0ae('0x13')]||![];this[_0xb0ae('0x14')]=_0xb0ae('0xe');this[_0xb0ae('0x15')]=0x0;this[_0xb0ae('0x16')]='';this[_0xb0ae('0x17')]='';this[_0xb0ae('0x18')]=![];this[_0xb0ae('0x19')]=![];this[_0xb0ae('0x2')]='';}Agent['prototype'][_0xb0ae('0x1a')]=function(_0x49a0a6){var _0x34c9d7;if(_0x49a0a6&&_0x49a0a6[_0xb0ae('0xd')]){_0x34c9d7=_0x49a0a6[_0xb0ae('0xd')][_0xb0ae('0x1b')]();switch(_0x34c9d7){case _0xb0ae('0x1c'):_0x34c9d7='idle';break;case'inuse':_0x34c9d7=_0xb0ae('0x1d');break;}}if(_0x34c9d7&&this[_0xb0ae('0x14')]!==_0x34c9d7||_0x49a0a6[_0xb0ae('0x1e')]){this[_0xb0ae('0x15')]=_[_0xb0ae('0x1f')](moment()[_0xb0ae('0x20')]('x'));}if(_0x34c9d7){this[_0xb0ae('0x14')]=_0x34c9d7;}var _0xcee461={'id':this['id'],'name':this['name'],'email':this[_0xb0ae('0xa')],'accountcode':this[_0xb0ae('0xb')],'fullname':this['fullname'],'state':this[_0xb0ae('0xd')],'stateTime':this['stateTime'],'status':this[_0xb0ae('0x21')],'address':this['address'],'online':this[_0xb0ae('0x13')],'voiceStatus':this[_0xb0ae('0x14')],'voiceStatusTime':this[_0xb0ae('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xb0ae('0x17')],'interface':this['interface'],'onhold':this['onhold']};var _0x50298c=md5(JSON[_0xb0ae('0x22')](_0xcee461));if(this[_0xb0ae('0x2')]!==_0x50298c){this[_0xb0ae('0x2')]=_0x50298c;io['to'](util[_0xb0ae('0x20')](_0xb0ae('0x23'),_0xcee461['name']))['emit'](_0xb0ae('0x24'),_0xcee461);io[_0xb0ae('0x25')](_0xb0ae('0x26'),_0xcee461);}};module[_0xb0ae('0x27')]=Agent; \ No newline at end of file +var _0xee64=['user:save','exports','lodash','util','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','fullname','unknown','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','format','accountcode','interface','user:%s','emit'];(function(_0x4a4028,_0x1fdbd7){var _0x12985d=function(_0x3a7e8a){while(--_0x3a7e8a){_0x4a4028['push'](_0x4a4028['shift']());}};_0x12985d(++_0x1fdbd7);}(_0xee64,0x1ca));var _0x4ee6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xee64[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4ee6('0x0'));var util=require(_0x4ee6('0x1'));var moment=require('moment');var md5=require(_0x4ee6('0x2'));var Redis=require(_0x4ee6('0x3'));var config=require(_0x4ee6('0x4'));config['redis']=_['defaults'](config[_0x4ee6('0x5')],{'host':_0x4ee6('0x6'),'port':0x18eb});var io=require(_0x4ee6('0x7'))(new Redis(config['redis']));function Agent(_0x14088){this['id']=_0x14088['id']||0x0;this['name']=_0x14088[_0x4ee6('0x8')]||'';this[_0x4ee6('0x9')]=_0x14088[_0x4ee6('0x9')]||'';this['accountcode']=_0x14088['accountcode']||'';this[_0x4ee6('0xa')]=_0x14088['fullname']||'';this['state']=_0x4ee6('0xb');this['stateTime']=0x0;this[_0x4ee6('0xc')]=_0x4ee6('0xb');this[_0x4ee6('0xd')]='';this[_0x4ee6('0xe')]='';this[_0x4ee6('0xf')]='';this['interface']='';this[_0x4ee6('0x10')]=_0x14088[_0x4ee6('0x10')]||![];this[_0x4ee6('0x11')]=_0x4ee6('0xb');this[_0x4ee6('0x12')]=0x0;this[_0x4ee6('0x13')]='';this[_0x4ee6('0x14')]='';this[_0x4ee6('0x15')]=![];this['local']=![];this[_0x4ee6('0x2')]='';}Agent[_0x4ee6('0x16')][_0x4ee6('0x17')]=function(_0x3eccc9){var _0x10fa95;if(_0x3eccc9&&_0x3eccc9['state']){_0x10fa95=_0x3eccc9[_0x4ee6('0x18')][_0x4ee6('0x19')]();switch(_0x10fa95){case'not_inuse':_0x10fa95=_0x4ee6('0x1a');break;case _0x4ee6('0x1b'):_0x10fa95=_0x4ee6('0x1c');break;}}if(_0x10fa95&&this[_0x4ee6('0x11')]!==_0x10fa95||_0x3eccc9[_0x4ee6('0x1d')]){this['voiceStatusTime']=_[_0x4ee6('0x1e')](moment()[_0x4ee6('0x1f')]('x'));}if(_0x10fa95){this[_0x4ee6('0x11')]=_0x10fa95;}var _0x2bec04={'id':this['id'],'name':this[_0x4ee6('0x8')],'email':this[_0x4ee6('0x9')],'accountcode':this[_0x4ee6('0x20')],'fullname':this[_0x4ee6('0xa')],'state':this[_0x4ee6('0x18')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x4ee6('0xd')],'online':this[_0x4ee6('0x10')],'voiceStatus':this[_0x4ee6('0x11')],'voiceStatusTime':this[_0x4ee6('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x4ee6('0x21')],'onhold':this[_0x4ee6('0x15')]};var _0x13cd8e=md5(JSON['stringify'](_0x2bec04));if(this[_0x4ee6('0x2')]!==_0x13cd8e){this[_0x4ee6('0x2')]=_0x13cd8e;io['to'](util[_0x4ee6('0x1f')](_0x4ee6('0x22'),_0x2bec04[_0x4ee6('0x8')]))[_0x4ee6('0x23')](_0x4ee6('0x24'),_0x2bec04);io['emit']('user:presence',_0x2bec04);}};module[_0x4ee6('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 9ccc5e6..81a5a70 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 _0xdea4=['dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x1aeb39,_0x2e8404){var _0x439790=function(_0x199911){while(--_0x199911){_0x1aeb39['push'](_0x1aeb39['shift']());}};_0x439790(++_0x2e8404);}(_0xdea4,0x1e0));var _0x4dea=function(_0x1df054,_0x15ae76){_0x1df054=_0x1df054-0x0;var _0x231b77=_0xdea4[_0x1df054];return _0x231b77;};'use strict';function Campaign(_0x458ac5){this['id']=_0x458ac5['id']||0x0;this[_0x4dea('0x0')]=_0x458ac5[_0x4dea('0x0')]||'';this[_0x4dea('0x1')]=_0x458ac5['type']||_0x4dea('0x2');this[_0x4dea('0x3')]=0x0;this['temp']=0x0;this[_0x4dea('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x4dea('0x5')]=!![];this[_0x4dea('0x6')]=_0x458ac5[_0x4dea('0x6')];this[_0x4dea('0x7')]=_0x458ac5[_0x4dea('0x7')];this['dialTimezone']=_0x458ac5['dialTimezone']||null;this['dialGlobalInterval']=_0x458ac5[_0x4dea('0x8')]?_0x458ac5[_0x4dea('0x8')]:null;this[_0x4dea('0x9')]=_0x458ac5['dialOriginateCallerIdName'];this[_0x4dea('0xa')]=_0x458ac5[_0x4dea('0xa')];this[_0x4dea('0xb')]=_0x458ac5[_0x4dea('0xb')]||0x1e;this[_0x4dea('0xc')]=_0x458ac5['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x458ac5[_0x4dea('0xd')];this[_0x4dea('0xe')]=_0x458ac5[_0x4dea('0xe')];this[_0x4dea('0xf')]=_0x458ac5[_0x4dea('0xf')];this[_0x4dea('0x10')]=_0x458ac5[_0x4dea('0x10')];this[_0x4dea('0x11')]=_0x458ac5['dialNoAnswerRetryFrequency'];this[_0x4dea('0x12')]=_0x458ac5[_0x4dea('0x12')];this[_0x4dea('0x13')]=_0x458ac5[_0x4dea('0x13')]||0x3;this[_0x4dea('0x14')]=_0x458ac5[_0x4dea('0x14')]||0x96;this[_0x4dea('0x15')]=_0x458ac5[_0x4dea('0x15')]||0x3;this[_0x4dea('0x16')]=_0x458ac5[_0x4dea('0x16')]||0x96;this[_0x4dea('0x17')]=_0x458ac5['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x458ac5['dialAbandonedRetryFrequency']||0x96;this[_0x4dea('0x18')]=_0x458ac5['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x458ac5[_0x4dea('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0x458ac5[_0x4dea('0x1a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x458ac5[_0x4dea('0x1b')]||0x96;this[_0x4dea('0x1c')]=_0x458ac5[_0x4dea('0x1c')]||_0x4dea('0x1d');this['dialPrefix']=_0x458ac5[_0x4dea('0x1e')]||undefined;this[_0x4dea('0x1f')]=_0x458ac5[_0x4dea('0x1f')]||undefined;this[_0x4dea('0x20')]=_0x458ac5[_0x4dea('0x20')]||undefined;this[_0x4dea('0x21')]=_0x458ac5[_0x4dea('0x21')]?_0x458ac5[_0x4dea('0x21')]:undefined;this[_0x4dea('0x22')]=_0x458ac5[_0x4dea('0x22')]?_0x458ac5[_0x4dea('0x22')]:undefined;this[_0x4dea('0x23')]=_0x458ac5['Interval']?_0x458ac5[_0x4dea('0x23')]:undefined;this[_0x4dea('0x24')]=_0x458ac5[_0x4dea('0x24')]?_0x458ac5[_0x4dea('0x24')]:undefined;this[_0x4dea('0x25')]=_0x458ac5[_0x4dea('0x24')]?_0x458ac5[_0x4dea('0x24')]['name']:undefined;this[_0x4dea('0x26')]=_0x458ac5[_0x4dea('0x26')]||![];this['dialAMDInitialSilence']=_0x458ac5['dialAMDInitialSilence'];this[_0x4dea('0x27')]=_0x458ac5[_0x4dea('0x27')];this[_0x4dea('0x28')]=_0x458ac5[_0x4dea('0x28')];this[_0x4dea('0x29')]=_0x458ac5[_0x4dea('0x29')];this[_0x4dea('0x2a')]=_0x458ac5['dialAMDMinWordLength'];this[_0x4dea('0x2b')]=_0x458ac5[_0x4dea('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x458ac5['dialAMDMaximumNumberOfWords'];this[_0x4dea('0x2c')]=_0x458ac5['dialAMDSilenceThreshold'];this[_0x4dea('0x2d')]=_0x458ac5[_0x4dea('0x2d')];}module[_0x4dea('0x2e')]=Campaign; \ No newline at end of file +var _0x5b87=['dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x42cf3b,_0x3bb5d7){var _0x416c2d=function(_0x2c774c){while(--_0x2c774c){_0x42cf3b['push'](_0x42cf3b['shift']());}};_0x416c2d(++_0x3bb5d7);}(_0x5b87,0x73));var _0x75b8=function(_0x3d613a,_0x3a1a21){_0x3d613a=_0x3d613a-0x0;var _0x44f3f2=_0x5b87[_0x3d613a];return _0x44f3f2;};'use strict';function Campaign(_0x89c9b2){this['id']=_0x89c9b2['id']||0x0;this[_0x75b8('0x0')]=_0x89c9b2[_0x75b8('0x0')]||'';this[_0x75b8('0x1')]=_0x89c9b2[_0x75b8('0x1')]||_0x75b8('0x2');this[_0x75b8('0x3')]=0x0;this[_0x75b8('0x4')]=0x0;this[_0x75b8('0x5')]=0x0;this[_0x75b8('0x6')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this['active']=_0x89c9b2[_0x75b8('0x7')];this[_0x75b8('0x8')]=_0x89c9b2[_0x75b8('0x8')];this[_0x75b8('0x9')]=_0x89c9b2[_0x75b8('0x9')]||null;this[_0x75b8('0xa')]=_0x89c9b2['dialGlobalInterval']?_0x89c9b2[_0x75b8('0xa')]:null;this['dialOriginateCallerIdName']=_0x89c9b2['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x89c9b2[_0x75b8('0xb')];this['dialOriginateTimeout']=_0x89c9b2[_0x75b8('0xc')]||0x1e;this[_0x75b8('0xd')]=_0x89c9b2[_0x75b8('0xd')];this[_0x75b8('0xe')]=_0x89c9b2[_0x75b8('0xe')];this[_0x75b8('0xf')]=_0x89c9b2[_0x75b8('0xf')];this['dialBusyRetryFrequency']=_0x89c9b2[_0x75b8('0x10')];this[_0x75b8('0x11')]=_0x89c9b2[_0x75b8('0x11')];this['dialNoAnswerRetryFrequency']=_0x89c9b2['dialNoAnswerRetryFrequency'];this[_0x75b8('0x12')]=_0x89c9b2[_0x75b8('0x12')];this[_0x75b8('0x13')]=_0x89c9b2[_0x75b8('0x13')]||0x3;this[_0x75b8('0x14')]=_0x89c9b2['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x89c9b2['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x89c9b2['dialDropRetryFrequency']||0x96;this[_0x75b8('0x15')]=_0x89c9b2[_0x75b8('0x15')]||0x3;this[_0x75b8('0x16')]=_0x89c9b2[_0x75b8('0x16')]||0x96;this[_0x75b8('0x17')]=_0x89c9b2[_0x75b8('0x17')]||0x3;this[_0x75b8('0x18')]=_0x89c9b2['dialMachineRetryFrequency']||0x96;this[_0x75b8('0x19')]=_0x89c9b2['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x89c9b2[_0x75b8('0x1a')]||0x96;this['dialOrderByScheduledAt']=_0x89c9b2[_0x75b8('0x1b')]||'DESC';this[_0x75b8('0x1c')]=_0x89c9b2[_0x75b8('0x1c')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x89c9b2[_0x75b8('0x1d')]||undefined;this[_0x75b8('0x1e')]=_0x89c9b2['dialCutDigit']||undefined;this['TrunkBackup']=_0x89c9b2[_0x75b8('0x1f')]?_0x89c9b2[_0x75b8('0x1f')]:undefined;this[_0x75b8('0x20')]=_0x89c9b2[_0x75b8('0x20')]?_0x89c9b2[_0x75b8('0x20')]:undefined;this['Interval']=_0x89c9b2['Interval']?_0x89c9b2[_0x75b8('0x21')]:undefined;this['SquareProject']=_0x89c9b2[_0x75b8('0x22')]?_0x89c9b2[_0x75b8('0x22')]:undefined;this[_0x75b8('0x23')]=_0x89c9b2[_0x75b8('0x22')]?_0x89c9b2[_0x75b8('0x22')][_0x75b8('0x0')]:undefined;this[_0x75b8('0x24')]=_0x89c9b2['dialAMDActive']||![];this[_0x75b8('0x25')]=_0x89c9b2[_0x75b8('0x25')];this[_0x75b8('0x26')]=_0x89c9b2[_0x75b8('0x26')];this['dialAMDAfterGreetingSilence']=_0x89c9b2[_0x75b8('0x27')];this['dialAMDTotalAnalysisTime']=_0x89c9b2[_0x75b8('0x28')];this[_0x75b8('0x29')]=_0x89c9b2[_0x75b8('0x29')];this['dialAMDBetweenWordsSilence']=_0x89c9b2['dialAMDBetweenWordsSilence'];this[_0x75b8('0x2a')]=_0x89c9b2[_0x75b8('0x2a')];this[_0x75b8('0x2b')]=_0x89c9b2['dialAMDSilenceThreshold'];this[_0x75b8('0x2c')]=_0x89c9b2[_0x75b8('0x2c')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 28a6dfe..fec61ce 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 _0x8254=['linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','uniqueid'];(function(_0x2dbcef,_0x1cfecb){var _0x5a90ea=function(_0x189054){while(--_0x189054){_0x2dbcef['push'](_0x2dbcef['shift']());}};_0x5a90ea(++_0x1cfecb);}(_0x8254,0x95));var _0x4825=function(_0x27eba9,_0x3f02c2){_0x27eba9=_0x27eba9-0x0;var _0xde7060=_0x8254[_0x27eba9];return _0xde7060;};'use strict';function Channel(){this[_0x4825('0x0')]=null;this['channel']='';this[_0x4825('0x1')]='';this['calleridnum']=0x0;this[_0x4825('0x2')]='';this[_0x4825('0x3')]=undefined;this[_0x4825('0x4')]=undefined;this['accountcode']=0x0;this[_0x4825('0x5')]='';this[_0x4825('0x6')]=0x0;this[_0x4825('0x7')]=0x0;this[_0x4825('0x8')]=0x0;this[_0x4825('0x9')]=![];this[_0x4825('0xa')]=null;this['endtime']=null;this[_0x4825('0xb')]=![];this[_0x4825('0xc')]=![];this[_0x4825('0xd')]='';this['lastdata']='';this[_0x4825('0xe')]=0x0;this[_0x4825('0xf')]=0x0;this[_0x4825('0x10')]=0x0;this[_0x4825('0x11')]=null;this['tag']=null;this[_0x4825('0x12')]=null;this[_0x4825('0x13')]=![];this[_0x4825('0x14')]=null;this['queue']=null;this[_0x4825('0x15')]=[];this[_0x4825('0x16')]=undefined;this[_0x4825('0x17')]=undefined;this[_0x4825('0x18')]=undefined;this[_0x4825('0x19')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x8325=['transferType','mohtime','exports','starttime','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','transferconnectedlinenum'];(function(_0x58b7e6,_0x2cae19){var _0x45c719=function(_0x33406d){while(--_0x33406d){_0x58b7e6['push'](_0x58b7e6['shift']());}};_0x45c719(++_0x2cae19);}(_0x8325,0x1f1));var _0x5832=function(_0x5bbf34,_0x479bc5){_0x5bbf34=_0x5bbf34-0x0;var _0x50c07c=_0x8325[_0x5bbf34];return _0x50c07c;};'use strict';function Channel(){this[_0x5832('0x0')]=null;this['channel']='';this[_0x5832('0x1')]='';this['calleridnum']=0x0;this[_0x5832('0x2')]='';this['connectedlinenum']=undefined;this[_0x5832('0x3')]=undefined;this[_0x5832('0x4')]=0x0;this[_0x5832('0x5')]='';this[_0x5832('0x6')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x5832('0x7')]=![];this[_0x5832('0x8')]=null;this[_0x5832('0x9')]=null;this[_0x5832('0xa')]=![];this[_0x5832('0xb')]=![];this[_0x5832('0xc')]='';this['lastdata']='';this[_0x5832('0xd')]=0x0;this[_0x5832('0xe')]=0x0;this[_0x5832('0xf')]=0x0;this[_0x5832('0x10')]=null;this[_0x5832('0x11')]=null;this[_0x5832('0x12')]=null;this[_0x5832('0x13')]=![];this[_0x5832('0x14')]=null;this[_0x5832('0x15')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x5832('0x16')]=undefined;this[_0x5832('0x17')]=undefined;this[_0x5832('0x18')]=0x0;}module[_0x5832('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9ddb4f2..37fe0ed 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 _0x51d3=['consumerKey','consumerSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x51d3,0xe2));var _0x351d=function(_0x2cc022,_0x40826a){_0x2cc022=_0x2cc022-0x0;var _0x3bc332=_0x51d3[_0x2cc022];return _0x3bc332;};'use strict';function DeskAccount(_0x289986){this['id']=_0x289986['id']||0x0;this[_0x351d('0x0')]=_0x289986['name']||'';this[_0x351d('0x1')]=_0x289986[_0x351d('0x1')]||'';this[_0x351d('0x2')]=_0x289986[_0x351d('0x2')]||'';this[_0x351d('0x3')]=_0x289986[_0x351d('0x3')]||'';this[_0x351d('0x4')]=_0x289986[_0x351d('0x4')]||'';this[_0x351d('0x5')]=_0x289986[_0x351d('0x5')]||'';this[_0x351d('0x6')]=_0x289986[_0x351d('0x6')]||'';this['token']=_0x289986['token']||'';this['tokenSecret']=_0x289986['tokenSecret']||'';this[_0x351d('0x7')]=_0x289986[_0x351d('0x7')]||'';this[_0x351d('0x8')]=_0x289986[_0x351d('0x8')]||'';this[_0x351d('0x9')]=_0x289986[_0x351d('0x9')]||{};}module[_0x351d('0xa')]=DeskAccount; \ No newline at end of file +var _0x449f=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x449f,0x1af));var _0xf449=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x449f[_0x4b6830];return _0x239e4a;};'use strict';function DeskAccount(_0x43aa96){this['id']=_0x43aa96['id']||0x0;this[_0xf449('0x0')]=_0x43aa96['name']||'';this[_0xf449('0x1')]=_0x43aa96['username']||'';this[_0xf449('0x2')]=_0x43aa96[_0xf449('0x2')]||'';this['authType']=_0x43aa96[_0xf449('0x3')]||'';this[_0xf449('0x4')]=_0x43aa96[_0xf449('0x4')]||'';this['consumerKey']=_0x43aa96[_0xf449('0x5')]||'';this[_0xf449('0x6')]=_0x43aa96[_0xf449('0x6')]||'';this[_0xf449('0x7')]=_0x43aa96[_0xf449('0x7')]||'';this[_0xf449('0x8')]=_0x43aa96[_0xf449('0x8')]||'';this['type']=_0x43aa96[_0xf449('0x9')]||'';this['serverUrl']=_0x43aa96[_0xf449('0xa')]||'';this[_0xf449('0xb')]=_0x43aa96[_0xf449('0xb')]||{};}module[_0xf449('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 f05adde..567ffd8 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 _0x65d1=['CloudProvider','name','username','password','tenantId','clientId','serverUrl','modernAuthentication','Configurations'];(function(_0x51bf5d,_0x21f000){var _0x40f2b3=function(_0x33795f){while(--_0x33795f){_0x51bf5d['push'](_0x51bf5d['shift']());}};_0x40f2b3(++_0x21f000);}(_0x65d1,0xa3));var _0x165d=function(_0x57a4d0,_0xa6e6b){_0x57a4d0=_0x57a4d0-0x0;var _0xaaadee=_0x65d1[_0x57a4d0];return _0xaaadee;};'use strict';function Dynamics365Account(_0x3fe656){this['id']=_0x3fe656['id']||0x0;this[_0x165d('0x0')]=_0x3fe656[_0x165d('0x0')]||'';this[_0x165d('0x1')]=_0x3fe656[_0x165d('0x1')]||'';this[_0x165d('0x2')]=_0x3fe656[_0x165d('0x2')]||'';this['remoteUri']=_0x3fe656['remoteUri']||'';this[_0x165d('0x3')]=_0x3fe656[_0x165d('0x3')]||'';this[_0x165d('0x4')]=_0x3fe656['clientId']||'';this['clientSecret']=_0x3fe656['clientSecret']||{};this[_0x165d('0x5')]=_0x3fe656[_0x165d('0x5')]||'';this['modernAuthentication']=_0x3fe656[_0x165d('0x6')]||![];this[_0x165d('0x7')]=_0x3fe656[_0x165d('0x7')]||{};this['CloudProvider']=_0x3fe656[_0x165d('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x12b5=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x549daf,_0x22ae61){var _0x513d31=function(_0xe11d95){while(--_0xe11d95){_0x549daf['push'](_0x549daf['shift']());}};_0x513d31(++_0x22ae61);}(_0x12b5,0x72));var _0x512b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12b5[_0x14add3];return _0x4a174f;};'use strict';function Dynamics365Account(_0x255399){this['id']=_0x255399['id']||0x0;this[_0x512b('0x0')]=_0x255399[_0x512b('0x0')]||'';this['username']=_0x255399[_0x512b('0x1')]||'';this[_0x512b('0x2')]=_0x255399[_0x512b('0x2')]||'';this[_0x512b('0x3')]=_0x255399[_0x512b('0x3')]||'';this[_0x512b('0x4')]=_0x255399[_0x512b('0x4')]||'';this[_0x512b('0x5')]=_0x255399[_0x512b('0x5')]||'';this['clientSecret']=_0x255399[_0x512b('0x6')]||{};this[_0x512b('0x7')]=_0x255399[_0x512b('0x7')]||'';this[_0x512b('0x8')]=_0x255399['modernAuthentication']||![];this[_0x512b('0x9')]=_0x255399[_0x512b('0x9')]||{};this[_0x512b('0xa')]=_0x255399[_0x512b('0xa')]||{};}module[_0x512b('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 253db3d..e23014b 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 _0x8b0f=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x8b0f,0x191));var _0xf8b0=function(_0x1fb149,_0x5ec2b1){_0x1fb149=_0x1fb149-0x0;var _0x193b4a=_0x8b0f[_0x1fb149];return _0x193b4a;};'use strict';function FaxAccount(_0x13c7c8){this['id']=_0x13c7c8['id']||0x0;this['name']=_0x13c7c8[_0xf8b0('0x0')]||'';this[_0xf8b0('0x1')]=_0x13c7c8[_0xf8b0('0x1')];this['ecm']=_0x13c7c8[_0xf8b0('0x2')];this[_0xf8b0('0x3')]=_0x13c7c8['headerinfo'];this[_0xf8b0('0x4')]=_0x13c7c8[_0xf8b0('0x4')];this[_0xf8b0('0x5')]=_0x13c7c8[_0xf8b0('0x5')]||0x960;this[_0xf8b0('0x6')]=_0x13c7c8[_0xf8b0('0x6')]||0x3840;this['modem']=_0x13c7c8[_0xf8b0('0x7')]||'v17,v27,v29';this['gateway']=_0x13c7c8[_0xf8b0('0x8')]||'no';this['faxdetect']=_0x13c7c8[_0xf8b0('0x9')]||'no';this[_0xf8b0('0xa')]=_0x13c7c8['t38timeout']||0x1388;this['tech']=_0x13c7c8['tech']||'SIP';this[_0xf8b0('0xb')]=_0x13c7c8[_0xf8b0('0xb')]?_0x13c7c8[_0xf8b0('0xb')]:undefined;this[_0xf8b0('0xc')]=_0x13c7c8['ListId'];this[_0xf8b0('0xd')]=_0x13c7c8[_0xf8b0('0xd')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xd922=['tech','Trunk','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x4723d1,_0x515d2e){var _0x335b7f=function(_0x559134){while(--_0x559134){_0x4723d1['push'](_0x4723d1['shift']());}};_0x335b7f(++_0x515d2e);}(_0xd922,0xd6));var _0x2d92=function(_0x1acbec,_0x313095){_0x1acbec=_0x1acbec-0x0;var _0x557465=_0xd922[_0x1acbec];return _0x557465;};'use strict';function FaxAccount(_0x4a8ce9){this['id']=_0x4a8ce9['id']||0x0;this[_0x2d92('0x0')]=_0x4a8ce9[_0x2d92('0x0')]||'';this['description']=_0x4a8ce9['description'];this[_0x2d92('0x1')]=_0x4a8ce9['ecm'];this[_0x2d92('0x2')]=_0x4a8ce9[_0x2d92('0x2')];this[_0x2d92('0x3')]=_0x4a8ce9[_0x2d92('0x3')];this[_0x2d92('0x4')]=_0x4a8ce9[_0x2d92('0x4')]||0x960;this[_0x2d92('0x5')]=_0x4a8ce9[_0x2d92('0x5')]||0x3840;this[_0x2d92('0x6')]=_0x4a8ce9[_0x2d92('0x6')]||_0x2d92('0x7');this['gateway']=_0x4a8ce9[_0x2d92('0x8')]||'no';this[_0x2d92('0x9')]=_0x4a8ce9['faxdetect']||'no';this[_0x2d92('0xa')]=_0x4a8ce9['t38timeout']||0x1388;this[_0x2d92('0xb')]=_0x4a8ce9[_0x2d92('0xb')]||'SIP';this[_0x2d92('0xc')]=_0x4a8ce9[_0x2d92('0xc')]?_0x4a8ce9['Trunk']:undefined;this['ListId']=_0x4a8ce9['ListId'];this[_0x2d92('0xd')]=_0x4a8ce9[_0x2d92('0xd')];}module[_0x2d92('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index bd6f029..9218c0e 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 _0x1fdb=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x1fdb,0x93));var _0xb1fd=function(_0xb357ee,_0x1b9fda){_0xb357ee=_0xb357ee-0x0;var _0x4b94a0=_0x1fdb[_0xb357ee];return _0x4b94a0;};'use strict';function FreshdeskAccount(_0x23e383){this['id']=_0x23e383['id']||0x0;this[_0xb1fd('0x0')]=_0x23e383[_0xb1fd('0x0')]||'';this[_0xb1fd('0x1')]=_0x23e383[_0xb1fd('0x1')]||'';this[_0xb1fd('0x2')]=_0x23e383['token']||'';this[_0xb1fd('0x3')]=_0x23e383[_0xb1fd('0x3')]||'';this[_0xb1fd('0x4')]=_0x23e383[_0xb1fd('0x4')]||'';this[_0xb1fd('0x5')]=_0x23e383[_0xb1fd('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x3734=['name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x3734,0x156));var _0x4373=function(_0x586f72,_0x5a50ae){_0x586f72=_0x586f72-0x0;var _0x1b0202=_0x3734[_0x586f72];return _0x1b0202;};'use strict';function FreshdeskAccount(_0x4a8d93){this['id']=_0x4a8d93['id']||0x0;this[_0x4373('0x0')]=_0x4a8d93['name']||'';this[_0x4373('0x1')]=_0x4a8d93[_0x4373('0x1')]||'';this['apiKey']=_0x4a8d93[_0x4373('0x2')]||'';this['remoteUri']=_0x4a8d93[_0x4373('0x3')]||'';this[_0x4373('0x4')]=_0x4a8d93[_0x4373('0x4')]||'';this[_0x4373('0x5')]=_0x4a8d93[_0x4373('0x5')]||{};}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 becfddc..0b1b85f 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 _0xceae=['Configurations','exports','name','apiKey','remoteUri','serverUrl'];(function(_0x3e5fe4,_0x180cce){var _0x2a8f3a=function(_0x33dc63){while(--_0x33dc63){_0x3e5fe4['push'](_0x3e5fe4['shift']());}};_0x2a8f3a(++_0x180cce);}(_0xceae,0x122));var _0xecea=function(_0x2bdaf6,_0x5a48fe){_0x2bdaf6=_0x2bdaf6-0x0;var _0x33c743=_0xceae[_0x2bdaf6];return _0x33c743;};'use strict';function FreshsalesAccount(_0x4eea5e){this['id']=_0x4eea5e['id']||0x0;this[_0xecea('0x0')]=_0x4eea5e['name']||'';this['username']=_0x4eea5e['username']||'';this[_0xecea('0x1')]=_0x4eea5e['token']||'';this['remoteUri']=_0x4eea5e[_0xecea('0x2')]||'';this[_0xecea('0x3')]=_0x4eea5e[_0xecea('0x3')]||'';this[_0xecea('0x4')]=_0x4eea5e[_0xecea('0x4')]||{};}module[_0xecea('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x88d5=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x525cfe,_0x41983d){var _0x29b28a=function(_0x272d7e){while(--_0x272d7e){_0x525cfe['push'](_0x525cfe['shift']());}};_0x29b28a(++_0x41983d);}(_0x88d5,0x76));var _0x588d=function(_0x4da1f5,_0x288df6){_0x4da1f5=_0x4da1f5-0x0;var _0x332f4a=_0x88d5[_0x4da1f5];return _0x332f4a;};'use strict';function FreshsalesAccount(_0xadcb1a){this['id']=_0xadcb1a['id']||0x0;this[_0x588d('0x0')]=_0xadcb1a[_0x588d('0x0')]||'';this[_0x588d('0x1')]=_0xadcb1a[_0x588d('0x1')]||'';this['apiKey']=_0xadcb1a[_0x588d('0x2')]||'';this[_0x588d('0x3')]=_0xadcb1a['remoteUri']||'';this[_0x588d('0x4')]=_0xadcb1a[_0x588d('0x4')]||'';this[_0x588d('0x5')]=_0xadcb1a[_0x588d('0x5')]||{};}module[_0x588d('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 dbafcbb..bd49211 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 _0xa390=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa390,0xf2));var _0x0a39=function(_0x304c90,_0x576641){_0x304c90=_0x304c90-0x0;var _0x38681e=_0xa390[_0x304c90];return _0x38681e;};'use strict';function QueueReport(){this[_0x0a39('0x0')]=_0x0a39('0x1');this[_0x0a39('0x2')]='';this['calleridnum']='';this[_0x0a39('0x3')]='';this[_0x0a39('0x4')]='';this[_0x0a39('0x5')]=null;this[_0x0a39('0x6')]=null;this['position']=0x1;this[_0x0a39('0x7')]=0x1;this[_0x0a39('0x8')]=![];this[_0x0a39('0x9')]=null;this[_0x0a39('0xa')]=![];this[_0x0a39('0xb')]=null;this[_0x0a39('0xc')]=![];this[_0x0a39('0xd')]=null;this[_0x0a39('0xe')]=0x1;this['channel']='';this[_0x0a39('0xf')]='';this[_0x0a39('0x10')]='';this[_0x0a39('0x11')]='';this[_0x0a39('0x12')]='';this[_0x0a39('0x13')]='';this[_0x0a39('0x14')]='';this[_0x0a39('0x15')]=0x0;this['assigned']=![];this[_0x0a39('0x16')]='';this[_0x0a39('0x17')]=_0x0a39('0x18');this[_0x0a39('0x19')]=null;this[_0x0a39('0x1a')]=0x0;this[_0x0a39('0x1b')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x7751=['routealias','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','exten','priority','assigned','motionChannel','voice'];(function(_0x80b9b8,_0x2a2163){var _0xb7fe18=function(_0x4db660){while(--_0x4db660){_0x80b9b8['push'](_0x80b9b8['shift']());}};_0xb7fe18(++_0x2a2163);}(_0x7751,0x108));var _0x1775=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7751[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this['type']=_0x1775('0x0');this[_0x1775('0x1')]='';this[_0x1775('0x2')]='';this[_0x1775('0x3')]='';this[_0x1775('0x4')]='';this[_0x1775('0x5')]=null;this[_0x1775('0x6')]=null;this[_0x1775('0x7')]=0x1;this[_0x1775('0x8')]=0x1;this[_0x1775('0x9')]=![];this['queuecallerabandonAt']=null;this[_0x1775('0xa')]=![];this[_0x1775('0xb')]=null;this['queuecallerexit']=![];this[_0x1775('0xc')]=null;this[_0x1775('0xd')]=0x1;this['channel']='';this[_0x1775('0xe')]='';this['connectedlinename']='';this[_0x1775('0xf')]='';this[_0x1775('0x10')]='';this[_0x1775('0x11')]='';this[_0x1775('0x12')]='';this['holdtime']=0x0;this[_0x1775('0x13')]=![];this['lastAssignedTo']='';this[_0x1775('0x14')]=_0x1775('0x15');this[_0x1775('0x16')]=null;this[_0x1775('0x17')]=0x0;this[_0x1775('0x18')]={};}module[_0x1775('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 79faf28..8bf3c15 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 _0x85de=['exports','name','username','remoteUri','password','clientId','securityToken','type','serverUrl','Configurations'];(function(_0x2db477,_0x3711ea){var _0x1cbddb=function(_0x750ba4){while(--_0x750ba4){_0x2db477['push'](_0x2db477['shift']());}};_0x1cbddb(++_0x3711ea);}(_0x85de,0x65));var _0xe85d=function(_0x2f4ebf,_0x315e8f){_0x2f4ebf=_0x2f4ebf-0x0;var _0x2dd6e5=_0x85de[_0x2f4ebf];return _0x2dd6e5;};'use strict';function SalesforceAccount(_0x587ccf){this['id']=_0x587ccf['id']||0x0;this[_0xe85d('0x0')]=_0x587ccf[_0xe85d('0x0')]||'';this[_0xe85d('0x1')]=_0x587ccf[_0xe85d('0x1')]||'';this[_0xe85d('0x2')]=_0x587ccf['remoteUri']||'';this[_0xe85d('0x3')]=_0x587ccf[_0xe85d('0x3')]||'';this[_0xe85d('0x4')]=_0x587ccf[_0xe85d('0x4')]||'';this['clientSecret']=_0x587ccf['clientSecret']||'';this[_0xe85d('0x5')]=_0x587ccf[_0xe85d('0x5')]||'';this[_0xe85d('0x6')]=_0x587ccf[_0xe85d('0x6')]||'integrationTab';this[_0xe85d('0x7')]=_0x587ccf[_0xe85d('0x7')]||'';this[_0xe85d('0x8')]=_0x587ccf[_0xe85d('0x8')]||{};}module[_0xe85d('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x101e=['exports','name','username','password','clientId','clientSecret','securityToken','type','Configurations'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x101e,0xbe));var _0xe101=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x101e[_0x1facfa];return _0x9ec701;};'use strict';function SalesforceAccount(_0x1ffcdb){this['id']=_0x1ffcdb['id']||0x0;this['name']=_0x1ffcdb[_0xe101('0x0')]||'';this['username']=_0x1ffcdb[_0xe101('0x1')]||'';this['remoteUri']=_0x1ffcdb['remoteUri']||'';this[_0xe101('0x2')]=_0x1ffcdb['password']||'';this[_0xe101('0x3')]=_0x1ffcdb['clientId']||'';this[_0xe101('0x4')]=_0x1ffcdb[_0xe101('0x4')]||'';this[_0xe101('0x5')]=_0x1ffcdb[_0xe101('0x5')]||'';this[_0xe101('0x6')]=_0x1ffcdb['type']||'integrationTab';this['serverUrl']=_0x1ffcdb['serverUrl']||'';this['Configurations']=_0x1ffcdb[_0xe101('0x7')]||{};}module[_0xe101('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fd41239..86c69d8 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 _0xa8dd=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x365941,_0x34bd06){var _0x25fbad=function(_0x4159f9){while(--_0x4159f9){_0x365941['push'](_0x365941['shift']());}};_0x25fbad(++_0x34bd06);}(_0xa8dd,0x95));var _0xda8d=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0xa8dd[_0x2442b9];return _0x31b571;};'use strict';function ServicenowAccount(_0x598963){this['id']=_0x598963['id']||0x0;this['name']=_0x598963[_0xda8d('0x0')]||'';this[_0xda8d('0x1')]=_0x598963[_0xda8d('0x1')]||'';this[_0xda8d('0x2')]=_0x598963[_0xda8d('0x2')]||'';this['remoteUri']=_0x598963[_0xda8d('0x3')]||'';this[_0xda8d('0x4')]=_0x598963[_0xda8d('0x4')]||'';this[_0xda8d('0x5')]=_0x598963[_0xda8d('0x5')]||{};}module[_0xda8d('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x60bf=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x10fdd1,_0x258bae){var _0x32eb73=function(_0x552d45){while(--_0x552d45){_0x10fdd1['push'](_0x10fdd1['shift']());}};_0x32eb73(++_0x258bae);}(_0x60bf,0xfd));var _0xf60b=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x60bf[_0x5d80de];return _0x1c7556;};'use strict';function ServicenowAccount(_0x40174c){this['id']=_0x40174c['id']||0x0;this[_0xf60b('0x0')]=_0x40174c[_0xf60b('0x0')]||'';this[_0xf60b('0x1')]=_0x40174c[_0xf60b('0x1')]||'';this[_0xf60b('0x2')]=_0x40174c[_0xf60b('0x2')]||'';this[_0xf60b('0x3')]=_0x40174c[_0xf60b('0x3')]||'';this[_0xf60b('0x4')]=_0x40174c[_0xf60b('0x4')]||'';this[_0xf60b('0x5')]=_0x40174c[_0xf60b('0x5')]||{};}module[_0xf60b('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 39df8d5..faba1c7 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 _0x7f97=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x30375c,_0x4747a6){var _0x219b4d=function(_0x97adbb){while(--_0x97adbb){_0x30375c['push'](_0x30375c['shift']());}};_0x219b4d(++_0x4747a6);}(_0x7f97,0x199));var _0x77f9=function(_0x51cc18,_0x3f75c6){_0x51cc18=_0x51cc18-0x0;var _0x382d90=_0x7f97[_0x51cc18];return _0x382d90;};'use strict';function SugarcrmAccount(_0x545281){this['id']=_0x545281['id']||0x0;this[_0x77f9('0x0')]=_0x545281[_0x77f9('0x0')]||'';this[_0x77f9('0x1')]=_0x545281[_0x77f9('0x1')]||'';this[_0x77f9('0x2')]=_0x545281['password']||'';this[_0x77f9('0x3')]=_0x545281[_0x77f9('0x3')]||'';this[_0x77f9('0x4')]=_0x545281['serverUrl']||'';this[_0x77f9('0x5')]=_0x545281[_0x77f9('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x8598=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1c1030,_0x3de996){var _0x338df1=function(_0x395c92){while(--_0x395c92){_0x1c1030['push'](_0x1c1030['shift']());}};_0x338df1(++_0x3de996);}(_0x8598,0xfd));var _0x8859=function(_0x5d90b8,_0x528b3a){_0x5d90b8=_0x5d90b8-0x0;var _0x5712b3=_0x8598[_0x5d90b8];return _0x5712b3;};'use strict';function SugarcrmAccount(_0x285989){this['id']=_0x285989['id']||0x0;this[_0x8859('0x0')]=_0x285989['name']||'';this[_0x8859('0x1')]=_0x285989[_0x8859('0x1')]||'';this[_0x8859('0x2')]=_0x285989[_0x8859('0x2')]||'';this[_0x8859('0x3')]=_0x285989[_0x8859('0x3')]||'';this[_0x8859('0x4')]=_0x285989[_0x8859('0x4')]||'';this[_0x8859('0x5')]=_0x285989[_0x8859('0x5')]||{};}module[_0x8859('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index d397207..f4337d4 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 _0xcbbb=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0xc66736,_0x131621){var _0x46b7d0=function(_0x9d8170){while(--_0x9d8170){_0xc66736['push'](_0xc66736['shift']());}};_0x46b7d0(++_0x131621);}(_0xcbbb,0x1ee));var _0xbcbb=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcbbb[_0x243b59];return _0x3e1676;};'use strict';function Telephone(_0x537fec){this['id']=_0x537fec['id']||0x0;this[_0xbcbb('0x0')]=_0x537fec[_0xbcbb('0x0')]||'';this[_0xbcbb('0x1')]=_0x537fec[_0xbcbb('0x1')]||'';this[_0xbcbb('0x2')]=_0xbcbb('0x3');this[_0xbcbb('0x4')]=0x0;this[_0xbcbb('0x5')]=_0xbcbb('0x3');this[_0xbcbb('0x6')]='';}module[_0xbcbb('0x7')]=Telephone; \ No newline at end of file +var _0xd2c2=['address','exports','name','accountcode','stateTime'];(function(_0x28aef1,_0x4ec6b5){var _0x3c22db=function(_0x2a9d3e){while(--_0x2a9d3e){_0x28aef1['push'](_0x28aef1['shift']());}};_0x3c22db(++_0x4ec6b5);}(_0xd2c2,0x1ce));var _0x2d2c=function(_0x2675ac,_0x947e03){_0x2675ac=_0x2675ac-0x0;var _0x1cffe9=_0xd2c2[_0x2675ac];return _0x1cffe9;};'use strict';function Telephone(_0x1c7bb0){this['id']=_0x1c7bb0['id']||0x0;this[_0x2d2c('0x0')]=_0x1c7bb0[_0x2d2c('0x0')]||'';this['accountcode']=_0x1c7bb0[_0x2d2c('0x1')]||'';this['state']='unknown';this[_0x2d2c('0x2')]=0x0;this['status']='unknown';this[_0x2d2c('0x3')]='';}module[_0x2d2c('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index e78e05b..7735073 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x3e1b13,_0x3b325c){var _0x5059dc=function(_0x318513){while(--_0x318513){_0x3e1b13['push'](_0x3e1b13['shift']());}};_0x5059dc(++_0x3b325c);}(_0xb10b,0x12a));var _0xbb10=function(_0x15eab7,_0x49bed6){_0x15eab7=_0x15eab7-0x0;var _0x1f15c6=_0xb10b[_0x15eab7];return _0x1f15c6;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x3c0fd8,_0x49b780){var _0x17758d=function(_0x298860){while(--_0x298860){_0x3c0fd8['push'](_0x3c0fd8['shift']());}};_0x17758d(++_0x49b780);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index cd7a402..edd2132 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(_0x15599c,_0x1ebd6a){var _0x5f1b30=function(_0x131418){while(--_0x131418){_0x15599c['push'](_0x15599c['shift']());}};_0x5f1b30(++_0x1ebd6a);}(_0x4fc2,0x111));var _0x24fc=function(_0x22f5ea,_0x3a6a30){_0x22f5ea=_0x22f5ea-0x0;var _0xe5955=_0x4fc2[_0x22f5ea];return _0xe5955;};'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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['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 3f9b2a8..1b68be4 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 _0x380b=['address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','split','host','port','domain','registrationtime'];(function(_0x3e7bb8,_0x11f26c){var _0x160bf4=function(_0xbc65a5){while(--_0xbc65a5){_0x3e7bb8['push'](_0x3e7bb8['shift']());}};_0x160bf4(++_0x11f26c);}(_0x380b,0xf3));var _0xb380=function(_0x376769,_0x10edd6){_0x376769=_0x376769-0x0;var _0x2b97c3=_0x380b[_0x376769];return _0x2b97c3;};'use strict';function Trunk(_0xe329c8){this['id']=_0xe329c8['id']||0x0;this[_0xb380('0x0')]=_0xe329c8['active']||![];this['name']=_0xe329c8[_0xb380('0x1')]||'';this[_0xb380('0x2')]=_0xb380('0x3');this[_0xb380('0x4')]=0x0;this[_0xb380('0x5')]=_0xb380('0x3');this[_0xb380('0x6')]=_0xe329c8[_0xb380('0x6')]&&_0xe329c8[_0xb380('0x6')]['indexOf'](':')?_0xe329c8[_0xb380('0x6')][_0xb380('0x7')](':')[0x0]:'';this[_0xb380('0x8')]='';this[_0xb380('0x9')]='';this[_0xb380('0xa')]='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0xb380('0x3');this[_0xb380('0xb')]='';this[_0xb380('0xc')]='';this[_0xb380('0xd')]=_0xe329c8[_0xb380('0xd')]||'';}module[_0xb380('0xe')]=Trunk; \ No newline at end of file +var _0x85b3=['status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','state','unknown','stateTime'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x85b3,0x83));var _0x385b=function(_0x8ba7d4,_0x48c3f9){_0x8ba7d4=_0x8ba7d4-0x0;var _0x47ce3d=_0x85b3[_0x8ba7d4];return _0x47ce3d;};'use strict';function Trunk(_0x1bb020){this['id']=_0x1bb020['id']||0x0;this['active']=_0x1bb020[_0x385b('0x0')]||![];this[_0x385b('0x1')]=_0x1bb020['name']||'';this[_0x385b('0x2')]=_0x385b('0x3');this[_0x385b('0x4')]=0x0;this[_0x385b('0x5')]=_0x385b('0x3');this[_0x385b('0x6')]=_0x1bb020[_0x385b('0x6')]&&_0x1bb020[_0x385b('0x6')][_0x385b('0x7')](':')?_0x1bb020[_0x385b('0x6')][_0x385b('0x8')](':')[0x0]:'';this[_0x385b('0x9')]='';this[_0x385b('0xa')]='';this['domain']='';this[_0x385b('0xb')]='';this[_0x385b('0xc')]='';this[_0x385b('0xd')]=_0x385b('0x3');this[_0x385b('0xe')]='';this['address']='';this[_0x385b('0xf')]=_0x1bb020['defaultuser']||'';}module[_0x385b('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8bc289b..2874505 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 _0xa142=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0xa142,0x1a7));var _0x2a14=function(_0xb6da2d,_0x9dbbba){_0xb6da2d=_0xb6da2d-0x0;var _0x155572=_0xa142[_0xb6da2d];return _0x155572;};'use strict';function voiceExtension(_0x310689){this['id']=_0x310689['id']||0x0;this['exten']=_0x310689[_0x2a14('0x0')]||'';this[_0x2a14('0x1')]=_0x310689['recordingFormat']||_0x2a14('0x2');this['mandatoryDisposition']=_0x310689[_0x2a14('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x9f9d=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x9f9d,0x174));var _0xd9f9=function(_0x310bef,_0x38797c){_0x310bef=_0x310bef-0x0;var _0x59716f=_0x9f9d[_0x310bef];return _0x59716f;};'use strict';function voiceExtension(_0x178bf8){this['id']=_0x178bf8['id']||0x0;this[_0xd9f9('0x0')]=_0x178bf8[_0xd9f9('0x0')]||'';this[_0xd9f9('0x1')]=_0x178bf8[_0xd9f9('0x1')]||'none';this[_0xd9f9('0x2')]=_0x178bf8[_0xd9f9('0x2')]||![];}module[_0xd9f9('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 8de7dc5..daf7ea2 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 _0x8382=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','abandoned','inUse','invalid','loggedIn','paused','ringing','ringInUse','unavailable','acw','acwTimeout','autopause','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x8382,0x147));var _0x2838=function(_0x55dbdb,_0x1edfa7){_0x55dbdb=_0x55dbdb-0x0;var _0x1cbd3b=_0x8382[_0x55dbdb];return _0x1cbd3b;};'use strict';var monitorFormat={'wav':_0x2838('0x0'),'wav49':_0x2838('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x2838('0x2'),'leastrecent':_0x2838('0x3'),'linear':'linear','random':_0x2838('0x4'),'ringall':_0x2838('0x5'),'rr':_0x2838('0x6'),'rrmemory':_0x2838('0x7'),'rrordered':_0x2838('0x8'),'wrandom':_0x2838('0x9')};function VoiceQueue(_0x22d231){this['id']=_0x22d231['id']||0x0;this[_0x2838('0xa')]=_0x22d231[_0x2838('0xa')]||'';this[_0x2838('0xb')]=_0x22d231[_0x2838('0xb')]||'';this[_0x2838('0xc')]=_0x22d231[_0x2838('0xc')]||_0x2838('0xd');this[_0x2838('0xe')]=0x0;this[_0x2838('0xf')]=0x0;this[_0x2838('0x10')]=0x0;this[_0x2838('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x2838('0x12')]=0x0;this['unmanaged']=0x0;this[_0x2838('0x13')]=0x0;this['available']=0x0;this['busy']=0x0;this[_0x2838('0x14')]=0x0;this[_0x2838('0x15')]=0x0;this[_0x2838('0x16')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x2838('0x17')]=0x0;this[_0x2838('0x18')]=0x0;this[_0x2838('0x19')]=0x0;this['talking']=0x0;this[_0x2838('0x1a')]=0x0;this['unknown']=0x0;this[_0x2838('0x1b')]=_0x22d231[_0x2838('0x1b')]||![];this[_0x2838('0x1c')]=_0x22d231[_0x2838('0x1c')]||0xa;this[_0x2838('0x1d')]=_0x22d231['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x2838('0x1e')]='';this[_0x2838('0x1f')]=0x0;this[_0x2838('0x20')]=0x0;this['dialTimezone']=_0x22d231[_0x2838('0x21')]||null;this['dialGlobalInterval']=_0x22d231[_0x2838('0x22')]?_0x22d231[_0x2838('0x22')]:null;this[_0x2838('0x23')]=_0x22d231[_0x2838('0x23')];this[_0x2838('0x24')]=_0x22d231[_0x2838('0x24')]||_0x2838('0x25');this[_0x2838('0x26')]=_0x22d231['dialLimitChannel']||0x0;this[_0x2838('0x27')]=_0x22d231[_0x2838('0x27')]||0x0;this[_0x2838('0x28')]=_0x22d231[_0x2838('0x28')]||0x1;this[_0x2838('0x29')]=_0x22d231[_0x2838('0x29')]||_0x2838('0x2a');this[_0x2838('0x2b')]=_0x22d231[_0x2838('0x2b')]||0.03;this[_0x2838('0x2c')]=_0x22d231[_0x2838('0x2c')]||0x258;this[_0x2838('0x2d')]=_0x22d231[_0x2838('0x2d')]||_0x2838('0x2e');this[_0x2838('0x2f')]=_0x22d231[_0x2838('0x2f')]||'anonymous';this[_0x2838('0x30')]=_0x22d231['dialOriginateTimeout']||0x1e;this[_0x2838('0x31')]=_0x22d231[_0x2838('0x31')]||_0x2838('0x32');this[_0x2838('0x33')]=_0x22d231[_0x2838('0x33')]||0x3;this[_0x2838('0x34')]=_0x22d231[_0x2838('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x22d231[_0x2838('0x35')]||0x3;this[_0x2838('0x36')]=_0x22d231[_0x2838('0x36')]||0x96;this[_0x2838('0x37')]=_0x22d231[_0x2838('0x37')]||0x3;this[_0x2838('0x38')]=_0x22d231['dialBusyRetryFrequency']||0x96;this[_0x2838('0x39')]=_0x22d231[_0x2838('0x39')]||0x3;this[_0x2838('0x3a')]=_0x22d231[_0x2838('0x3a')]||0x96;this[_0x2838('0x3b')]=_0x22d231[_0x2838('0x3b')]||0x3;this[_0x2838('0x3c')]=_0x22d231[_0x2838('0x3c')]||0x96;this[_0x2838('0x3d')]=_0x22d231[_0x2838('0x3d')]||0x3;this[_0x2838('0x3e')]=_0x22d231[_0x2838('0x3e')]||0x96;this[_0x2838('0x3f')]=_0x22d231[_0x2838('0x3f')]||0x3;this[_0x2838('0x40')]=_0x22d231[_0x2838('0x40')]||0x96;this['dialMachineMaxRetry']=_0x22d231['dialMachineMaxRetry']||0x3;this[_0x2838('0x41')]=_0x22d231['dialMachineRetryFrequency']||0x96;this[_0x2838('0x42')]=_0x22d231[_0x2838('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x22d231[_0x2838('0x43')]||0x96;this[_0x2838('0x44')]=_0x22d231[_0x2838('0x44')]||0x3;this[_0x2838('0x45')]=_0x22d231[_0x2838('0x45')]||0x4;this[_0x2838('0x46')]=_0x22d231[_0x2838('0x46')]?_0x22d231['Trunk']:undefined;this[_0x2838('0x47')]=_0x22d231[_0x2838('0x47')]?_0x22d231[_0x2838('0x47')]:undefined;this[_0x2838('0x48')]=_0x22d231[_0x2838('0x48')]||undefined;this[_0x2838('0x49')]=_0x22d231[_0x2838('0x49')]?_0x22d231[_0x2838('0x49')]:undefined;this[_0x2838('0x4a')]=_0x22d231[_0x2838('0x4a')]||_0x2838('0x4b');this[_0x2838('0x4c')]=_0x22d231['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2838('0x4d')]=_0x22d231[_0x2838('0x4d')]||undefined;this[_0x2838('0x4e')]=strategy[_0x22d231[_0x2838('0x4e')]];this[_0x2838('0x4f')]=!![];this[_0x2838('0x50')]=_0x22d231[_0x2838('0x50')]||![];this[_0x2838('0x51')]=_0x22d231['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x22d231[_0x2838('0x52')];this['dialAMDAfterGreetingSilence']=_0x22d231[_0x2838('0x53')];this['dialAMDTotalAnalysisTime']=_0x22d231['dialAMDTotalAnalysisTime'];this[_0x2838('0x54')]=_0x22d231['dialAMDMinWordLength'];this[_0x2838('0x55')]=_0x22d231[_0x2838('0x55')];this[_0x2838('0x56')]=_0x22d231[_0x2838('0x56')];this[_0x2838('0x57')]=_0x22d231['dialAMDSilenceThreshold'];this[_0x2838('0x58')]=_0x22d231[_0x2838('0x58')];this[_0x2838('0x59')]=0x0;this[_0x2838('0x5a')]=0x0;this[_0x2838('0x5b')]=_0x22d231[_0x2838('0x5b')];this['outboundAnswerCallsDay']=0x0;this[_0x2838('0x5c')]=0x0;this[_0x2838('0x5d')]=0x0;this[_0x2838('0x5e')]=0x0;this[_0x2838('0x5f')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x2838('0x60')]=0x0;this[_0x2838('0x61')]=0x0;this[_0x2838('0x62')]=0x0;this[_0x2838('0x63')]=0x0;this[_0x2838('0x64')]=0x0;this[_0x2838('0x65')]=0x0;this[_0x2838('0x66')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x2838('0x67')]=undefined;this[_0x2838('0x68')]=undefined;this['handlePredictive']=undefined;this[_0x2838('0x69')]=1.05;this[_0x2838('0x6a')]=0x0;this[_0x2838('0x6b')]=0x0;this[_0x2838('0x6c')]=0x0;this[_0x2838('0x6d')]=0x0;this[_0x2838('0x6e')]=0x0;this[_0x2838('0x6f')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x2838('0x70')]=0x0;this['predictiveIntervalMaxThreshold']=_0x22d231['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x22d231[_0x2838('0x71')]||0xa;this[_0x2838('0x72')]=0x0;this[_0x2838('0x73')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x2838('0x74')]=0x0;this[_0x2838('0x75')]=0x0;this[_0x2838('0x76')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x22d231[_0x2838('0x77')]||0x1e;this[_0x2838('0x78')]=_0x22d231[_0x2838('0x78')]||![];this[_0x2838('0x79')]=!!_0x22d231[_0x2838('0x79')]||![];this[_0x2838('0x7a')]=!!_0x22d231[_0x2838('0x7a')]||![];this[_0x2838('0x7b')]=_0x22d231[_0x2838('0x7b')]||undefined;this[_0x2838('0x7c')]=_0x22d231[_0x2838('0x7c')]||![];this['dialAgiAfterHangupAgent']=_0x22d231['dialAgiAfterHangupAgent']||![];this[_0x2838('0xb')]=monitorFormat[_0x22d231[_0x2838('0xb')]]?monitorFormat[_0x22d231[_0x2838('0xb')]]:undefined;this[_0x2838('0x7d')]=_0x22d231[_0x2838('0x7d')]||![];this[_0x2838('0x7e')]=_0x22d231[_0x2838('0x7e')]?_0x22d231[_0x2838('0x7e')]:undefined;this[_0x2838('0x7f')]=![];}module[_0x2838('0x80')]=VoiceQueue; \ No newline at end of file +var _0x8f40=['loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','gsm','fewestcalls','linear','random','roundrobin','rrmemory','rrordered','name','monitor_format','inbound','waiting','total','answered','sumHoldTime','sumBillable','available','busy','inUse','invalid'];(function(_0x21ed71,_0x3fca8e){var _0x515130=function(_0x4141a7){while(--_0x4141a7){_0x21ed71['push'](_0x21ed71['shift']());}};_0x515130(++_0x3fca8e);}(_0x8f40,0x15b));var _0x08f4=function(_0x23b5f9,_0xa24822){_0x23b5f9=_0x23b5f9-0x0;var _0x226fd6=_0x8f40[_0x23b5f9];return _0x226fd6;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x08f4('0x0')};var strategy={'fewestcalls':_0x08f4('0x1'),'leastrecent':'leastrecent','linear':_0x08f4('0x2'),'random':_0x08f4('0x3'),'ringall':'ringall','rr':_0x08f4('0x4'),'rrmemory':_0x08f4('0x5'),'rrordered':_0x08f4('0x6'),'wrandom':'wrandom'};function VoiceQueue(_0x547e38){this['id']=_0x547e38['id']||0x0;this[_0x08f4('0x7')]=_0x547e38[_0x08f4('0x7')]||'';this[_0x08f4('0x8')]=_0x547e38[_0x08f4('0x8')]||'';this['type']=_0x547e38['type']||_0x08f4('0x9');this[_0x08f4('0xa')]=0x0;this[_0x08f4('0xb')]=0x0;this[_0x08f4('0xc')]=0x0;this['sumDuration']=0x0;this[_0x08f4('0xd')]=0x0;this[_0x08f4('0xe')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x08f4('0xf')]=0x0;this[_0x08f4('0x10')]=0x0;this[_0x08f4('0x11')]=0x0;this[_0x08f4('0x12')]=0x0;this[_0x08f4('0x13')]=0x0;this[_0x08f4('0x14')]=0x0;this[_0x08f4('0x15')]=0x0;this[_0x08f4('0x16')]=0x0;this[_0x08f4('0x17')]=0x0;this['ringInUse']=0x0;this[_0x08f4('0x18')]=0x0;this[_0x08f4('0x19')]=0x0;this['unknown']=0x0;this[_0x08f4('0x1a')]=_0x547e38[_0x08f4('0x1a')]||![];this[_0x08f4('0x1b')]=_0x547e38[_0x08f4('0x1b')]||0xa;this[_0x08f4('0x1c')]=_0x547e38[_0x08f4('0x1c')]||'no';this[_0x08f4('0x1d')]=!![];this[_0x08f4('0x1e')]='';this[_0x08f4('0x1f')]='';this[_0x08f4('0x20')]=0x0;this[_0x08f4('0x21')]=0x0;this[_0x08f4('0x22')]=_0x547e38[_0x08f4('0x22')]||null;this[_0x08f4('0x23')]=_0x547e38[_0x08f4('0x23')]?_0x547e38[_0x08f4('0x23')]:null;this[_0x08f4('0x24')]=_0x547e38[_0x08f4('0x24')];this[_0x08f4('0x25')]=_0x547e38['dialMethod']||_0x08f4('0x26');this['dialLimitChannel']=_0x547e38[_0x08f4('0x27')]||0x0;this[_0x08f4('0x28')]=_0x547e38[_0x08f4('0x28')]||0x0;this[_0x08f4('0x29')]=_0x547e38[_0x08f4('0x29')]||0x1;this['dialPredictiveOptimization']=_0x547e38['dialPredictiveOptimization']||_0x08f4('0x2a');this[_0x08f4('0x2b')]=_0x547e38[_0x08f4('0x2b')]||0.03;this['dialPredictiveInterval']=_0x547e38[_0x08f4('0x2c')]||0x258;this[_0x08f4('0x2d')]=_0x547e38['dialOriginateCallerIdName']||'anonymous';this[_0x08f4('0x2e')]=_0x547e38['dialOriginateCallerIdNumber']||'anonymous';this['dialOriginateTimeout']=_0x547e38[_0x08f4('0x2f')]||0x1e;this['dialQueueOptions']=_0x547e38[_0x08f4('0x30')]||'tTxX';this[_0x08f4('0x31')]=_0x547e38[_0x08f4('0x31')]||0x3;this[_0x08f4('0x32')]=_0x547e38[_0x08f4('0x32')]||undefined;this[_0x08f4('0x33')]=_0x547e38[_0x08f4('0x33')]||0x3;this[_0x08f4('0x34')]=_0x547e38[_0x08f4('0x34')]||0x96;this[_0x08f4('0x35')]=_0x547e38['dialBusyMaxRetry']||0x3;this[_0x08f4('0x36')]=_0x547e38[_0x08f4('0x36')]||0x96;this['dialNoAnswerMaxRetry']=_0x547e38[_0x08f4('0x37')]||0x3;this[_0x08f4('0x38')]=_0x547e38[_0x08f4('0x38')]||0x96;this[_0x08f4('0x39')]=_0x547e38[_0x08f4('0x39')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x547e38[_0x08f4('0x3a')]||0x96;this['dialDropMaxRetry']=_0x547e38['dialDropMaxRetry']||0x3;this[_0x08f4('0x3b')]=_0x547e38[_0x08f4('0x3b')]||0x96;this['dialAbandonedMaxRetry']=_0x547e38[_0x08f4('0x3c')]||0x3;this[_0x08f4('0x3d')]=_0x547e38[_0x08f4('0x3d')]||0x96;this[_0x08f4('0x3e')]=_0x547e38[_0x08f4('0x3e')]||0x3;this[_0x08f4('0x3f')]=_0x547e38[_0x08f4('0x3f')]||0x96;this[_0x08f4('0x40')]=_0x547e38[_0x08f4('0x40')]||0x3;this[_0x08f4('0x41')]=_0x547e38[_0x08f4('0x41')]||0x96;this[_0x08f4('0x42')]=_0x547e38['callAdditionalPhoneAfterMin']||0x3;this[_0x08f4('0x43')]=_0x547e38['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x547e38['Trunk']?_0x547e38['Trunk']:undefined;this['TrunkBackup']=_0x547e38[_0x08f4('0x44')]?_0x547e38[_0x08f4('0x44')]:undefined;this['dialPrefix']=_0x547e38[_0x08f4('0x45')]||undefined;this[_0x08f4('0x46')]=_0x547e38[_0x08f4('0x46')]?_0x547e38['Interval']:undefined;this[_0x08f4('0x47')]=_0x547e38[_0x08f4('0x47')]||_0x08f4('0x48');this[_0x08f4('0x49')]=_0x547e38[_0x08f4('0x49')]||undefined;this[_0x08f4('0x4a')]=_0x547e38[_0x08f4('0x4a')]||undefined;this[_0x08f4('0x4b')]=strategy[_0x547e38[_0x08f4('0x4b')]];this['queueStatusComplete']=!![];this[_0x08f4('0x4c')]=_0x547e38['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x547e38[_0x08f4('0x4d')];this[_0x08f4('0x4e')]=_0x547e38[_0x08f4('0x4e')];this[_0x08f4('0x4f')]=_0x547e38['dialAMDAfterGreetingSilence'];this[_0x08f4('0x50')]=_0x547e38[_0x08f4('0x50')];this[_0x08f4('0x51')]=_0x547e38['dialAMDMinWordLength'];this[_0x08f4('0x52')]=_0x547e38['dialAMDBetweenWordsSilence'];this[_0x08f4('0x53')]=_0x547e38[_0x08f4('0x53')];this[_0x08f4('0x54')]=_0x547e38[_0x08f4('0x54')];this[_0x08f4('0x55')]=_0x547e38['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x08f4('0x56')]=_0x547e38['timeout'];this[_0x08f4('0x57')]=0x0;this[_0x08f4('0x58')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x08f4('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x08f4('0x5a')]=0x0;this[_0x08f4('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x08f4('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x08f4('0x5d')]=0x0;this[_0x08f4('0x5e')]=0x0;this[_0x08f4('0x5f')]=undefined;this[_0x08f4('0x60')]=undefined;this[_0x08f4('0x61')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x08f4('0x62')]=0x0;this[_0x08f4('0x63')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x08f4('0x64')]=0x0;this[_0x08f4('0x65')]=0x0;this[_0x08f4('0x66')]=0x0;this[_0x08f4('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x08f4('0x68')]=_0x547e38[_0x08f4('0x69')]||0x14;this[_0x08f4('0x6a')]=_0x547e38[_0x08f4('0x69')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x08f4('0x6b')]=0x1;this[_0x08f4('0x6c')]=0x0;this[_0x08f4('0x6d')]=0x0;this[_0x08f4('0x6e')]=0x0;this[_0x08f4('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x547e38[_0x08f4('0x70')]||0x1e;this[_0x08f4('0x71')]=_0x547e38[_0x08f4('0x71')]||![];this[_0x08f4('0x72')]=!!_0x547e38[_0x08f4('0x72')]||![];this[_0x08f4('0x73')]=!!_0x547e38[_0x08f4('0x73')]||![];this[_0x08f4('0x74')]=_0x547e38[_0x08f4('0x74')]||undefined;this[_0x08f4('0x75')]=_0x547e38[_0x08f4('0x75')]||![];this['dialAgiAfterHangupAgent']=_0x547e38[_0x08f4('0x76')]||![];this[_0x08f4('0x8')]=monitorFormat[_0x547e38[_0x08f4('0x8')]]?monitorFormat[_0x547e38[_0x08f4('0x8')]]:undefined;this['mandatoryDisposition']=_0x547e38[_0x08f4('0x77')]||![];this[_0x08f4('0x78')]=_0x547e38[_0x08f4('0x78')]?_0x547e38[_0x08f4('0x78')]:undefined;this[_0x08f4('0x79')]=![];}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 eeb4df5..146b50b 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 _0x72b1=['paused','ringing','talking','waiting','answered','loggedIn','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','message','Trunk','active','callerid','createReport','invalid','onHold','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','exten','xcally-motion-preview','prototype','compareToInboundQueue','compareToOutboundQueue','statusMessage','some','updateReportFromOutboundQueue','outboundAnswerCallsDay','preview','exports','available','loggedInDb'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x72b1,0x16e));var _0x172b=function(_0x456bb2,_0x141194){_0x456bb2=_0x456bb2-0x0;var _0x12d9fb=_0x72b1[_0x456bb2];return _0x12d9fb;};'use strict';var INBOUND_COUNTERS=[_0x172b('0x0'),'loggedIn',_0x172b('0x1'),_0x172b('0x2'),_0x172b('0x3'),_0x172b('0x4'),_0x172b('0x5')];var OUTBOUND_COUNTERS=[_0x172b('0x0'),_0x172b('0x6'),'inUse',_0x172b('0x7'),_0x172b('0x1'),_0x172b('0x8'),_0x172b('0x9'),'outboundAnswerCallsDay',_0x172b('0xa'),'outboundBusyCallsDay',_0x172b('0xb'),'outboundNoAnswerCallsDay',_0x172b('0xc'),_0x172b('0xd'),_0x172b('0xe'),_0x172b('0xf'),'paused',_0x172b('0x10'),_0x172b('0x4'),_0x172b('0x11'),_0x172b('0x12'),_0x172b('0x13'),_0x172b('0x5')];function VoiceQueueSummary(_0x1d899a){this['id']=_0x1d899a['id'];this['name']=_0x1d899a[_0x172b('0x14')];this[_0x172b('0x15')]=_0x1d899a[_0x172b('0x15')];this['abandoned']=_0x1d899a[_0x172b('0x16')]||0x0;this['answered']=_0x1d899a[_0x172b('0x6')]||0x0;this[_0x172b('0x0')]=_0x1d899a['available']||0x0;this[_0x172b('0x17')]=_0x1d899a[_0x172b('0x17')]||0x0;this[_0x172b('0x18')]=_0x1d899a[_0x172b('0x18')]||0x0;this['invalid']=_0x1d899a['invalid']||0x0;this[_0x172b('0x7')]=_0x1d899a[_0x172b('0x7')]||0x0;this[_0x172b('0x1')]=_0x1d899a[_0x172b('0x1')]||0x0;this['onHold']=_0x1d899a['onHold']||0x0;this[_0x172b('0x19')]=_0x1d899a[_0x172b('0x19')]||0x0;this[_0x172b('0x2')]=_0x1d899a[_0x172b('0x2')]||0x0;this[_0x172b('0x3')]=_0x1d899a['ringing']||0x0;this[_0x172b('0x1a')]=_0x1d899a[_0x172b('0x1a')];this[_0x172b('0x11')]=_0x1d899a[_0x172b('0x11')];this[_0x172b('0x12')]=_0x1d899a[_0x172b('0x12')];this[_0x172b('0x1b')]=_0x1d899a['sumHoldTime']||0x0;this['talking']=_0x1d899a['talking']||0x0;this['total']=_0x1d899a[_0x172b('0x13')]||0x0;this['type']=_0x1d899a[_0x172b('0x1c')];this[_0x172b('0x1d')]=_0x1d899a[_0x172b('0x1d')]||0x0;this[_0x172b('0x1e')]=_0x1d899a[_0x172b('0x1e')]||0x0;this[_0x172b('0x1f')]=_0x1d899a[_0x172b('0x1f')]||0x0;this[_0x172b('0x5')]=_0x1d899a[_0x172b('0x5')]||0x0;if(_0x1d899a['type']===_0x172b('0x20')){this[_0x172b('0x10')]=_0x1d899a[_0x172b('0x10')]||0x0;this[_0x172b('0x21')]=_0x1d899a[_0x172b('0x21')];this[_0x172b('0x22')]=_0x1d899a[_0x172b('0x22')];this['dialOriginateCallerIdName']=_0x1d899a[_0x172b('0x23')];this[_0x172b('0x24')]=_0x1d899a['dialOriginateCallerIdNumber'];this[_0x172b('0x25')]=_0x1d899a[_0x172b('0x25')];this[_0x172b('0x26')]=_0x1d899a[_0x172b('0x26')];this[_0x172b('0x27')]=_0x1d899a['temp'];this[_0x172b('0x28')]=_0x1d899a[_0x172b('0x28')];this['outboundAnswerCallsDay']=_0x1d899a['outboundAnswerCallsDay'];this[_0x172b('0xa')]=_0x1d899a[_0x172b('0xa')];this[_0x172b('0x29')]=_0x1d899a[_0x172b('0x29')];this[_0x172b('0xb')]=_0x1d899a[_0x172b('0xb')];this[_0x172b('0x2a')]=_0x1d899a[_0x172b('0x2a')];this[_0x172b('0x2b')]=_0x1d899a[_0x172b('0x2b')];this[_0x172b('0x2c')]=_0x1d899a[_0x172b('0x2c')];this[_0x172b('0x2d')]=_0x1d899a[_0x172b('0x2d')];this[_0x172b('0xc')]=_0x1d899a[_0x172b('0xc')];this[_0x172b('0x2e')]=_0x1d899a[_0x172b('0x2e')];this[_0x172b('0xd')]=_0x1d899a[_0x172b('0xd')];this[_0x172b('0xe')]=_0x1d899a[_0x172b('0xe')];this[_0x172b('0xf')]=_0x1d899a[_0x172b('0xf')];this[_0x172b('0x2f')]=_0x1d899a['predictiveIntervalAnsweredCalls'];this[_0x172b('0x30')]=_0x1d899a[_0x172b('0x30')];this[_0x172b('0x31')]=_0x1d899a['predictiveIntervalAvgTalktime'];this[_0x172b('0x32')]=_0x1d899a['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x1d899a['predictiveIntervalDroppedCallsTimeout'];this[_0x172b('0x33')]=_0x1d899a['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x1d899a[_0x172b('0x34')];this[_0x172b('0x35')]=_0x1d899a[_0x172b('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x1d899a[_0x172b('0x36')];this[_0x172b('0x37')]=_0x1d899a[_0x172b('0x37')];this[_0x172b('0x38')]=_0x1d899a[_0x172b('0x38')];this[_0x172b('0x39')]=_0x1d899a[_0x172b('0x39')];this[_0x172b('0x8')]=_0x1d899a[_0x172b('0x8')];this[_0x172b('0x3a')]=_0x1d899a[_0x172b('0x3a')];this[_0x172b('0x3b')]=_0x1d899a[_0x172b('0x3b')];this[_0x172b('0x3c')]=_0x1d899a[_0x172b('0x3c')];this[_0x172b('0x3d')]=_0x1d899a[_0x172b('0x3d')];this[_0x172b('0x3e')]=_0x1d899a[_0x172b('0x3e')];this['startProgressive']=_0x1d899a['startProgressive'];this[_0x172b('0x3f')]=_0x1d899a['message'];this['statusMessage']=_0x1d899a['statusMessage'];}if(_0x1d899a[_0x172b('0x40')]){this[_0x172b('0x40')]={'id':_0x1d899a[_0x172b('0x40')]['id'],'name':_0x1d899a['Trunk'][_0x172b('0x14')],'active':_0x1d899a[_0x172b('0x40')][_0x172b('0x41')],'callerid':_0x1d899a['Trunk'][_0x172b('0x42')]};}}VoiceQueueSummary['prototype'][_0x172b('0x43')]=function(_0x4a05da,_0x362f83,_0xc45ecd,_0x59bfd1){this[_0x172b('0x1')]=0x0;this[_0x172b('0x4')]=0x0;this['paused']=0x0;this[_0x172b('0x1e')]=0x0;this[_0x172b('0x19')]=0x0;this[_0x172b('0x18')]=0x0;this[_0x172b('0x17')]=0x0;this[_0x172b('0x44')]=0x0;this[_0x172b('0x1d')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x172b('0x45')]=0x0;if(_0xc45ecd){if(_0xc45ecd['available']){this['available']=Number(_0xc45ecd['available']);}if(_0xc45ecd[_0x172b('0x46')]){this[_0x172b('0x7')]=Number(_0xc45ecd[_0x172b('0x46')]);}if(_0xc45ecd[_0x172b('0x47')]){this['waiting']=Number(_0xc45ecd[_0x172b('0x47')]);}}for(var _0x3dc5da=0x0;_0x3dc5da<_0x4a05da[_0x172b('0x48')];_0x3dc5da++){var _0x17793c=_0x362f83[_0x172b('0x49')+_0x4a05da[_0x3dc5da][_0x172b('0x14')]];if(_0x17793c&&_0x17793c[_0x172b('0x4a')]){this[_0x172b('0x1')]+=0x1;}if(_0x4a05da[_0x3dc5da][_0x172b('0x4b')]==='1'){this[_0x172b('0x4')]+=0x1;}if(_0x4a05da[_0x3dc5da][_0x172b('0x2')]==='1'&&!['2','7','8'][_0x172b('0x4c')](_0x4a05da[_0x3dc5da]['status'])){this[_0x172b('0x2')]+=0x1;}switch(_0x4a05da[_0x3dc5da][_0x172b('0x4d')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x172b('0x18')]+=0x1;break;case'3':this[_0x172b('0x17')]+=0x1;break;case'4':this[_0x172b('0x44')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x172b('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x172b('0x22')]===_0x172b('0x4e')){var _0x769536=Object[_0x172b('0x4f')](_0x59bfd1);for(var _0x24ab0c=0x0;_0x24ab0c<_0x769536[_0x172b('0x48')];_0x24ab0c++){var _0x3131eb=_0x769536[_0x24ab0c];var _0x1fc1e1=_0x59bfd1[_0x3131eb];if(_0x1fc1e1[_0x172b('0x50')]===this[_0x172b('0x14')]&&_0x1fc1e1['type']==='dialer'&&_0x1fc1e1[_0x172b('0x51')]===_0x172b('0x52')){this['talking']+=0x1;}}if(this['talking']>this[_0x172b('0x18')]){this[_0x172b('0x4')]=this[_0x172b('0x18')];}this[_0x172b('0x10')]=0x0;}return this;};VoiceQueueSummary[_0x172b('0x53')][_0x172b('0x54')]=function(_0x5c0526){var _0x28ffa1=![];if(_0x5c0526){_0x28ffa1=INBOUND_COUNTERS['some'](function(_0x5f22eb){return this[_0x5f22eb]!==_0x5c0526[_0x5f22eb];},this);}return _0x28ffa1;};VoiceQueueSummary[_0x172b('0x53')][_0x172b('0x55')]=function(_0x1b95ca){var _0x4fa9ac=![];var _0x3c2fbd=![];var _0x1cb872=![];if(_0x1b95ca){_0x4fa9ac=this[_0x172b('0x22')]!==_0x1b95ca['dialMethod']||this['dialActive']!==_0x1b95ca[_0x172b('0x21')]||this[_0x172b('0x3f')]!==_0x1b95ca[_0x172b('0x3f')]||this[_0x172b('0x56')]!==_0x1b95ca[_0x172b('0x56')];_0x3c2fbd=OUTBOUND_COUNTERS[_0x172b('0x57')](function(_0x39ff88){return this[_0x39ff88]!==_0x1b95ca[_0x39ff88];},this);if(this[_0x172b('0x40')]&&_0x1b95ca['Trunk']){_0x1cb872=this[_0x172b('0x40')]['name']!==_0x1b95ca['Trunk'][_0x172b('0x14')]||this['Trunk'][_0x172b('0x41')]!==_0x1b95ca[_0x172b('0x40')][_0x172b('0x41')];}}return _0x4fa9ac||_0x3c2fbd||_0x1cb872;};VoiceQueueSummary['prototype'][_0x172b('0x58')]=function(_0x51b1a1){this[_0x172b('0x6')]=_0x51b1a1[_0x172b('0x6')];this['message']=_0x51b1a1[_0x172b('0x3f')];this['statusMessage']=_0x51b1a1[_0x172b('0x56')];this[_0x172b('0x8')]=_0x51b1a1[_0x172b('0x8')];this[_0x172b('0x9')]=_0x51b1a1[_0x172b('0x9')];this['outboundAnswerCallsDay']=_0x51b1a1[_0x172b('0x59')];this[_0x172b('0xa')]=_0x51b1a1[_0x172b('0xa')];this[_0x172b('0x29')]=_0x51b1a1['outboundBusyCallsDay'];this[_0x172b('0xb')]=_0x51b1a1['outboundCongestionCallsDay'];this[_0x172b('0x2d')]=_0x51b1a1[_0x172b('0x2d')];this[_0x172b('0xc')]=_0x51b1a1[_0x172b('0xc')];this[_0x172b('0xd')]=_0x51b1a1[_0x172b('0xd')];this['outboundRejectCallsDay']=_0x51b1a1[_0x172b('0xe')];this[_0x172b('0xf')]=_0x51b1a1[_0x172b('0xf')];this['sumBillable']=_0x51b1a1[_0x172b('0x11')];this['sumDuration']=_0x51b1a1['sumDuration'];this[_0x172b('0x13')]=_0x51b1a1[_0x172b('0x13')];if(this[_0x172b('0x22')]===_0x172b('0x5a')){this[_0x172b('0x10')]=_0x51b1a1[_0x172b('0x10')];}};module[_0x172b('0x5b')]=VoiceQueueSummary; \ No newline at end of file +var _0x2f2e=['outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','updateReportFromOutboundQueue','outboundRejectCallsDay','preview','exports','loggedIn','loggedInDb','ringing','waiting','available','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundReCallsDay','outboundUnknownCallsDay','paused','pTalking','talking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x2f2e,0x146));var _0xe2f2=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x2f2e[_0x146a97];return _0x259d5c;};'use strict';var INBOUND_COUNTERS=['available',_0xe2f2('0x0'),_0xe2f2('0x1'),'paused',_0xe2f2('0x2'),'talking',_0xe2f2('0x3')];var OUTBOUND_COUNTERS=[_0xe2f2('0x4'),_0xe2f2('0x5'),_0xe2f2('0x6'),'loggedIn','loggedInDb','originated',_0xe2f2('0x7'),_0xe2f2('0x8'),_0xe2f2('0x9'),_0xe2f2('0xa'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0xe2f2('0xb'),'outboundRejectCallsDay',_0xe2f2('0xc'),_0xe2f2('0xd'),_0xe2f2('0xe'),_0xe2f2('0xf'),'sumBillable',_0xe2f2('0x10'),_0xe2f2('0x11'),'waiting'];function VoiceQueueSummary(_0x1a8aa3){this['id']=_0x1a8aa3['id'];this[_0xe2f2('0x12')]=_0x1a8aa3[_0xe2f2('0x12')];this[_0xe2f2('0x13')]=_0x1a8aa3[_0xe2f2('0x13')];this[_0xe2f2('0x14')]=_0x1a8aa3[_0xe2f2('0x14')]||0x0;this[_0xe2f2('0x5')]=_0x1a8aa3[_0xe2f2('0x5')]||0x0;this[_0xe2f2('0x4')]=_0x1a8aa3['available']||0x0;this[_0xe2f2('0x15')]=_0x1a8aa3[_0xe2f2('0x15')]||0x0;this[_0xe2f2('0x6')]=_0x1a8aa3[_0xe2f2('0x6')]||0x0;this[_0xe2f2('0x16')]=_0x1a8aa3['invalid']||0x0;this['loggedIn']=_0x1a8aa3[_0xe2f2('0x0')]||0x0;this[_0xe2f2('0x1')]=_0x1a8aa3[_0xe2f2('0x1')]||0x0;this['onHold']=_0x1a8aa3[_0xe2f2('0x17')]||0x0;this[_0xe2f2('0x18')]=_0x1a8aa3[_0xe2f2('0x18')]||0x0;this['paused']=_0x1a8aa3[_0xe2f2('0xd')]||0x0;this[_0xe2f2('0x2')]=_0x1a8aa3[_0xe2f2('0x2')]||0x0;this[_0xe2f2('0x19')]=_0x1a8aa3[_0xe2f2('0x19')];this[_0xe2f2('0x1a')]=_0x1a8aa3['sumBillable'];this[_0xe2f2('0x10')]=_0x1a8aa3[_0xe2f2('0x10')];this[_0xe2f2('0x1b')]=_0x1a8aa3[_0xe2f2('0x1b')]||0x0;this[_0xe2f2('0xf')]=_0x1a8aa3[_0xe2f2('0xf')]||0x0;this[_0xe2f2('0x11')]=_0x1a8aa3[_0xe2f2('0x11')]||0x0;this[_0xe2f2('0x1c')]=_0x1a8aa3[_0xe2f2('0x1c')];this[_0xe2f2('0x1d')]=_0x1a8aa3['unavailable']||0x0;this[_0xe2f2('0x1e')]=_0x1a8aa3[_0xe2f2('0x1e')]||0x0;this[_0xe2f2('0x1f')]=_0x1a8aa3[_0xe2f2('0x1f')]||0x0;this[_0xe2f2('0x3')]=_0x1a8aa3[_0xe2f2('0x3')]||0x0;if(_0x1a8aa3[_0xe2f2('0x1c')]===_0xe2f2('0x20')){this[_0xe2f2('0xe')]=_0x1a8aa3['pTalking']||0x0;this[_0xe2f2('0x21')]=_0x1a8aa3['dialActive'];this[_0xe2f2('0x22')]=_0x1a8aa3[_0xe2f2('0x22')];this[_0xe2f2('0x23')]=_0x1a8aa3['dialOriginateCallerIdName'];this[_0xe2f2('0x24')]=_0x1a8aa3['dialOriginateCallerIdNumber'];this[_0xe2f2('0x25')]=_0x1a8aa3['dialOriginateTimeout'];this[_0xe2f2('0x26')]=_0x1a8aa3[_0xe2f2('0x26')];this[_0xe2f2('0x27')]=_0x1a8aa3[_0xe2f2('0x27')];this[_0xe2f2('0x28')]=_0x1a8aa3[_0xe2f2('0x28')];this['outboundAnswerCallsDay']=_0x1a8aa3[_0xe2f2('0x8')];this[_0xe2f2('0x9')]=_0x1a8aa3[_0xe2f2('0x9')];this['outboundBusyCallsDay']=_0x1a8aa3['outboundBusyCallsDay'];this[_0xe2f2('0x29')]=_0x1a8aa3[_0xe2f2('0x29')];this[_0xe2f2('0x2a')]=_0x1a8aa3[_0xe2f2('0x2a')];this['outboundDropCallsDayCallersExit']=_0x1a8aa3[_0xe2f2('0x2b')];this['outboundDropCallsDayTimeout']=_0x1a8aa3[_0xe2f2('0x2c')];this[_0xe2f2('0x2d')]=_0x1a8aa3[_0xe2f2('0x2d')];this[_0xe2f2('0x2e')]=_0x1a8aa3['outboundNoSuchCallsDay'];this[_0xe2f2('0x2f')]=_0x1a8aa3[_0xe2f2('0x2f')];this[_0xe2f2('0xb')]=_0x1a8aa3['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x1a8aa3['outboundRejectCallsDay'];this[_0xe2f2('0xc')]=_0x1a8aa3[_0xe2f2('0xc')];this[_0xe2f2('0x30')]=_0x1a8aa3[_0xe2f2('0x30')];this[_0xe2f2('0x31')]=_0x1a8aa3['predictiveIntervalAvgHoldtime'];this[_0xe2f2('0x32')]=_0x1a8aa3['predictiveIntervalAvgTalktime'];this[_0xe2f2('0x33')]=_0x1a8aa3[_0xe2f2('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x1a8aa3[_0xe2f2('0x34')];this[_0xe2f2('0x35')]=_0x1a8aa3[_0xe2f2('0x35')];this[_0xe2f2('0x36')]=_0x1a8aa3[_0xe2f2('0x36')];this[_0xe2f2('0x37')]=_0x1a8aa3[_0xe2f2('0x37')];this[_0xe2f2('0x38')]=_0x1a8aa3['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x1a8aa3[_0xe2f2('0x39')];this['predictiveIntervalAvailable']=_0x1a8aa3[_0xe2f2('0x3a')];this[_0xe2f2('0x3b')]=_0x1a8aa3[_0xe2f2('0x3b')];this['originated']=_0x1a8aa3[_0xe2f2('0x3c')];this['erlangCalls']=_0x1a8aa3[_0xe2f2('0x3d')];this[_0xe2f2('0x3e')]=_0x1a8aa3[_0xe2f2('0x3e')];this[_0xe2f2('0x3f')]=_0x1a8aa3[_0xe2f2('0x3f')];this[_0xe2f2('0x40')]=_0x1a8aa3['erlangBusyFactor'];this[_0xe2f2('0x41')]=_0x1a8aa3[_0xe2f2('0x41')];this[_0xe2f2('0x42')]=_0x1a8aa3[_0xe2f2('0x42')];this[_0xe2f2('0x43')]=_0x1a8aa3[_0xe2f2('0x43')];this[_0xe2f2('0x44')]=_0x1a8aa3[_0xe2f2('0x44')];}if(_0x1a8aa3['Trunk']){this['Trunk']={'id':_0x1a8aa3[_0xe2f2('0x45')]['id'],'name':_0x1a8aa3['Trunk'][_0xe2f2('0x12')],'active':_0x1a8aa3['Trunk'][_0xe2f2('0x46')],'callerid':_0x1a8aa3[_0xe2f2('0x45')][_0xe2f2('0x47')]};}}VoiceQueueSummary['prototype'][_0xe2f2('0x48')]=function(_0x2d305d,_0x39c271,_0x260f2e,_0x27b3d0){this[_0xe2f2('0x1')]=0x0;this[_0xe2f2('0xf')]=0x0;this[_0xe2f2('0xd')]=0x0;this['unknown']=0x0;this[_0xe2f2('0x18')]=0x0;this[_0xe2f2('0x6')]=0x0;this['busy']=0x0;this[_0xe2f2('0x16')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0xe2f2('0x19')]=0x0;this[_0xe2f2('0x17')]=0x0;if(_0x260f2e){if(_0x260f2e['available']){this[_0xe2f2('0x4')]=Number(_0x260f2e[_0xe2f2('0x4')]);}if(_0x260f2e[_0xe2f2('0x49')]){this[_0xe2f2('0x0')]=Number(_0x260f2e['loggedin']);}if(_0x260f2e[_0xe2f2('0x4a')]){this[_0xe2f2('0x3')]=Number(_0x260f2e[_0xe2f2('0x4a')]);}}for(var _0x2135d3=0x0;_0x2135d3<_0x2d305d[_0xe2f2('0x4b')];_0x2135d3++){var _0x53e01f=_0x39c271['SIP/'+_0x2d305d[_0x2135d3][_0xe2f2('0x12')]];if(_0x53e01f&&_0x53e01f[_0xe2f2('0x4c')]){this[_0xe2f2('0x1')]+=0x1;}if(_0x2d305d[_0x2135d3][_0xe2f2('0x4d')]==='1'){this[_0xe2f2('0xf')]+=0x1;}if(_0x2d305d[_0x2135d3][_0xe2f2('0xd')]==='1'&&!['2','7','8'][_0xe2f2('0x4e')](_0x2d305d[_0x2135d3][_0xe2f2('0x4f')])){this[_0xe2f2('0xd')]+=0x1;}switch(_0x2d305d[_0x2135d3][_0xe2f2('0x4f')]){case'0':this[_0xe2f2('0x1e')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xe2f2('0x6')]+=0x1;break;case'3':this[_0xe2f2('0x15')]+=0x1;break;case'4':this[_0xe2f2('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xe2f2('0x2')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0xe2f2('0x50')){var _0x3805cf=Object[_0xe2f2('0x51')](_0x27b3d0);for(var _0x34a7fa=0x0;_0x34a7fa<_0x3805cf[_0xe2f2('0x4b')];_0x34a7fa++){var _0x17d607=_0x3805cf[_0x34a7fa];var _0x4110f3=_0x27b3d0[_0x17d607];if(_0x4110f3[_0xe2f2('0x52')]===this[_0xe2f2('0x12')]&&_0x4110f3[_0xe2f2('0x1c')]===_0xe2f2('0x53')&&_0x4110f3[_0xe2f2('0x54')]===_0xe2f2('0x55')){this[_0xe2f2('0xf')]+=0x1;}}if(this['talking']>this[_0xe2f2('0x6')]){this[_0xe2f2('0xf')]=this[_0xe2f2('0x6')];}this[_0xe2f2('0xe')]=0x0;}return this;};VoiceQueueSummary[_0xe2f2('0x56')][_0xe2f2('0x57')]=function(_0x54d32c){var _0x3b0c49=![];if(_0x54d32c){_0x3b0c49=INBOUND_COUNTERS[_0xe2f2('0x58')](function(_0x18f806){return this[_0x18f806]!==_0x54d32c[_0x18f806];},this);}return _0x3b0c49;};VoiceQueueSummary[_0xe2f2('0x56')]['compareToOutboundQueue']=function(_0x262144){var _0x455fde=![];var _0x74295f=![];var _0x2bf020=![];if(_0x262144){_0x455fde=this[_0xe2f2('0x22')]!==_0x262144[_0xe2f2('0x22')]||this[_0xe2f2('0x21')]!==_0x262144[_0xe2f2('0x21')]||this[_0xe2f2('0x43')]!==_0x262144[_0xe2f2('0x43')]||this[_0xe2f2('0x44')]!==_0x262144['statusMessage'];_0x74295f=OUTBOUND_COUNTERS[_0xe2f2('0x58')](function(_0x4eeaac){return this[_0x4eeaac]!==_0x262144[_0x4eeaac];},this);if(this[_0xe2f2('0x45')]&&_0x262144[_0xe2f2('0x45')]){_0x2bf020=this[_0xe2f2('0x45')]['name']!==_0x262144[_0xe2f2('0x45')][_0xe2f2('0x12')]||this[_0xe2f2('0x45')][_0xe2f2('0x46')]!==_0x262144[_0xe2f2('0x45')]['active'];}}return _0x455fde||_0x74295f||_0x2bf020;};VoiceQueueSummary[_0xe2f2('0x56')][_0xe2f2('0x59')]=function(_0xfe4ec9){this['answered']=_0xfe4ec9['answered'];this[_0xe2f2('0x43')]=_0xfe4ec9['message'];this[_0xe2f2('0x44')]=_0xfe4ec9[_0xe2f2('0x44')];this[_0xe2f2('0x3c')]=_0xfe4ec9['originated'];this[_0xe2f2('0x7')]=_0xfe4ec9[_0xe2f2('0x7')];this[_0xe2f2('0x8')]=_0xfe4ec9[_0xe2f2('0x8')];this[_0xe2f2('0x9')]=_0xfe4ec9[_0xe2f2('0x9')];this[_0xe2f2('0xa')]=_0xfe4ec9[_0xe2f2('0xa')];this[_0xe2f2('0x29')]=_0xfe4ec9['outboundCongestionCallsDay'];this[_0xe2f2('0x2d')]=_0xfe4ec9[_0xe2f2('0x2d')];this[_0xe2f2('0x2e')]=_0xfe4ec9[_0xe2f2('0x2e')];this[_0xe2f2('0xb')]=_0xfe4ec9[_0xe2f2('0xb')];this[_0xe2f2('0x5a')]=_0xfe4ec9[_0xe2f2('0x5a')];this[_0xe2f2('0xc')]=_0xfe4ec9['outboundUnknownCallsDay'];this[_0xe2f2('0x1a')]=_0xfe4ec9[_0xe2f2('0x1a')];this['sumDuration']=_0xfe4ec9[_0xe2f2('0x10')];this[_0xe2f2('0x11')]=_0xfe4ec9[_0xe2f2('0x11')];if(this[_0xe2f2('0x22')]===_0xe2f2('0x5b')){this[_0xe2f2('0xe')]=_0xfe4ec9[_0xe2f2('0xe')];}};module[_0xe2f2('0x5c')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 550d6fa..e5c335f 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 _0xce11=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0xb151cc,_0x14edc0){var _0x555a24=function(_0x194c94){while(--_0x194c94){_0xb151cc['push'](_0xb151cc['shift']());}};_0x555a24(++_0x14edc0);}(_0xce11,0x165));var _0x1ce1=function(_0x4f6ca5,_0x4dea09){_0x4f6ca5=_0x4f6ca5-0x0;var _0x2eac21=_0xce11[_0x4f6ca5];return _0x2eac21;};'use strict';function VtigerAccount(_0x219c5c){this['id']=_0x219c5c['id']||0x0;this[_0x1ce1('0x0')]=_0x219c5c[_0x1ce1('0x0')]||'';this[_0x1ce1('0x1')]=_0x219c5c[_0x1ce1('0x1')]||'';this[_0x1ce1('0x2')]=_0x219c5c[_0x1ce1('0x2')]||'';this[_0x1ce1('0x3')]=_0x219c5c['remoteUri']||'';this[_0x1ce1('0x4')]=_0x219c5c[_0x1ce1('0x4')]||'';this[_0x1ce1('0x5')]=_0x219c5c[_0x1ce1('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x26cb=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5b8fb4,_0x417983){var _0x7e355a=function(_0x234f2b){while(--_0x234f2b){_0x5b8fb4['push'](_0x5b8fb4['shift']());}};_0x7e355a(++_0x417983);}(_0x26cb,0x19b));var _0xb26c=function(_0x3ed1bd,_0x51a119){_0x3ed1bd=_0x3ed1bd-0x0;var _0x1f1d62=_0x26cb[_0x3ed1bd];return _0x1f1d62;};'use strict';function VtigerAccount(_0x4e2c35){this['id']=_0x4e2c35['id']||0x0;this[_0xb26c('0x0')]=_0x4e2c35['name']||'';this[_0xb26c('0x1')]=_0x4e2c35['username']||'';this[_0xb26c('0x2')]=_0x4e2c35[_0xb26c('0x2')]||'';this[_0xb26c('0x3')]=_0x4e2c35['remoteUri']||'';this[_0xb26c('0x4')]=_0x4e2c35['serverUrl']||'';this[_0xb26c('0x5')]=_0x4e2c35[_0xb26c('0x5')]||{};}module[_0xb26c('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c3e2003..4aea78c 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 _0x4173=['username','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0x4173,0xbc));var _0x3417=function(_0x1924fd,_0x2ae46d){_0x1924fd=_0x1924fd-0x0;var _0x45df39=_0x4173[_0x1924fd];return _0x45df39;};'use strict';function ZendeskAccount(_0x106cde){this['id']=_0x106cde['id']||0x0;this[_0x3417('0x0')]=_0x106cde[_0x3417('0x0')]||'';this[_0x3417('0x1')]=_0x106cde['username']||'';this['password']=_0x106cde['password']||'';this['token']=_0x106cde[_0x3417('0x2')]||'';this[_0x3417('0x3')]=_0x106cde[_0x3417('0x3')]||'';this[_0x3417('0x4')]=_0x106cde['authType']||'';this[_0x3417('0x5')]=_0x106cde['type']||_0x3417('0x6');this[_0x3417('0x7')]=_0x106cde['serverUrl']||'';this[_0x3417('0x8')]=_0x106cde[_0x3417('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x6923=['password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name','username'];(function(_0x5cb0dc,_0x4a406d){var _0x378e6a=function(_0x439192){while(--_0x439192){_0x5cb0dc['push'](_0x5cb0dc['shift']());}};_0x378e6a(++_0x4a406d);}(_0x6923,0x1ca));var _0x3692=function(_0x49f259,_0x10ea44){_0x49f259=_0x49f259-0x0;var _0x3605ee=_0x6923[_0x49f259];return _0x3605ee;};'use strict';function ZendeskAccount(_0x326d6e){this['id']=_0x326d6e['id']||0x0;this[_0x3692('0x0')]=_0x326d6e[_0x3692('0x0')]||'';this[_0x3692('0x1')]=_0x326d6e['username']||'';this[_0x3692('0x2')]=_0x326d6e[_0x3692('0x2')]||'';this[_0x3692('0x3')]=_0x326d6e['token']||'';this[_0x3692('0x4')]=_0x326d6e[_0x3692('0x4')]||'';this[_0x3692('0x5')]=_0x326d6e[_0x3692('0x5')]||'';this[_0x3692('0x6')]=_0x326d6e['type']||'integrationTab';this[_0x3692('0x7')]=_0x326d6e[_0x3692('0x7')]||'';this[_0x3692('0x8')]=_0x326d6e['Configurations']||{};}module[_0x3692('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index daa476e..9b65cf8 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 _0x7ebd=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description'];(function(_0x12ac05,_0x1edb9d){var _0x452105=function(_0x592fc0){while(--_0x592fc0){_0x12ac05['push'](_0x12ac05['shift']());}};_0x452105(++_0x1edb9d);}(_0x7ebd,0x134));var _0xd7eb=function(_0x9e86cb,_0xc9044a){_0x9e86cb=_0x9e86cb-0x0;var _0x3766d0=_0x7ebd[_0x9e86cb];return _0x3766d0;};'use strict';function ZohoAccount(_0x3a36fb){this['id']=_0x3a36fb['id']||0x0;this[_0xd7eb('0x0')]=_0x3a36fb['name']||'';this[_0xd7eb('0x1')]=_0x3a36fb[_0xd7eb('0x1')]||'';this[_0xd7eb('0x2')]=_0x3a36fb['host']||'';this[_0xd7eb('0x3')]=_0x3a36fb[_0xd7eb('0x3')]||'';this[_0xd7eb('0x4')]=_0x3a36fb[_0xd7eb('0x4')]||'';this['clientSecret']=_0x3a36fb[_0xd7eb('0x5')]||'';this[_0xd7eb('0x6')]=_0x3a36fb['serverUrl']||'';this[_0xd7eb('0x7')]=_0x3a36fb['code']||'';this[_0xd7eb('0x8')]=_0x3a36fb[_0xd7eb('0x8')]||'';this[_0xd7eb('0x9')]=_0x3a36fb[_0xd7eb('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x6ac1=['Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x20143d,_0x407c1c){var _0x446d08=function(_0x1342b4){while(--_0x1342b4){_0x20143d['push'](_0x20143d['shift']());}};_0x446d08(++_0x407c1c);}(_0x6ac1,0x1b9));var _0x16ac=function(_0x445fbc,_0x1a17f9){_0x445fbc=_0x445fbc-0x0;var _0x5762a9=_0x6ac1[_0x445fbc];return _0x5762a9;};'use strict';function ZohoAccount(_0x3acf5b){this['id']=_0x3acf5b['id']||0x0;this[_0x16ac('0x0')]=_0x3acf5b[_0x16ac('0x0')]||'';this[_0x16ac('0x1')]=_0x3acf5b[_0x16ac('0x1')]||'';this[_0x16ac('0x2')]=_0x3acf5b[_0x16ac('0x2')]||'';this[_0x16ac('0x3')]=_0x3acf5b[_0x16ac('0x3')]||'';this['clientId']=_0x3acf5b[_0x16ac('0x4')]||'';this[_0x16ac('0x5')]=_0x3acf5b['clientSecret']||'';this[_0x16ac('0x6')]=_0x3acf5b[_0x16ac('0x6')]||'';this[_0x16ac('0x7')]=_0x3acf5b['code']||'';this[_0x16ac('0x8')]=_0x3acf5b[_0x16ac('0x8')]||'';this[_0x16ac('0x9')]=_0x3acf5b[_0x16ac('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 324bd95..69c890f 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 _0x896e=['Contact','phone','firstName','lastName','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','queue','membername','Agent','format','SIP/%s','calleridname'];(function(_0x5bc59d,_0x1db548){var _0xa0812f=function(_0x5530f1){while(--_0x5530f1){_0x5bc59d['push'](_0x5bc59d['shift']());}};_0xa0812f(++_0x1db548);}(_0x896e,0x1e9));var _0xe896=function(_0x20b2e1,_0x5c9740){_0x20b2e1=_0x20b2e1-0x0;var _0x5a66f5=_0x896e[_0x20b2e1];return _0x5a66f5;};'use strict';var util=require(_0xe896('0x0'));var _=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));function checkNameSurname(_0x229b59,_0x36085e,_0x26d296){var _0x2af995='';if(!_[_0xe896('0x3')](_0x36085e)&&_0xe896('0x4')===typeof _0x36085e){_0x2af995+=_0x36085e;}if(!_[_0xe896('0x3')](_0x26d296)&&_0xe896('0x4')===typeof _0x26d296){_0x2af995+='\x20'+_0x26d296;}if(_0x2af995!==''){return _0x2af995;}return _0x229b59;}function Action(_0x318a7b,_0x52ac80,_0x24c430,_0x7a0721,_0x3b902c){this[_0xe896('0x5')]=_0x24c430||undefined;this[_0xe896('0x6')]=_0x318a7b['id'];this['queue']=_0x52ac80[_0xe896('0x7')];this[_0xe896('0x8')]=_0x52ac80[_0xe896('0x8')];this['campaigntype']=_0xe896('0x9');this['dialAnswer']=![];this[_0xe896('0xa')]=_['isNil'](_0x318a7b[_0xe896('0xb')])?undefined:_0x318a7b[_0xe896('0xb')][_0xe896('0x7')];this['channelAgent']=this[_0xe896('0xa')]?util[_0xe896('0xc')](_0xe896('0xd'),this['membername']):_0x7a0721||undefined;this[_0xe896('0xe')]=checkNameSurname(_0x318a7b[_0xe896('0xf')][_0xe896('0x10')],_0x318a7b['Contact'][_0xe896('0x11')],_0x318a7b[_0xe896('0xf')][_0xe896('0x12')]);this['active']=_0x318a7b['active']||![];this[_0xe896('0x13')]=_0x318a7b[_0xe896('0x10')];this['scheduledat']=_0x318a7b['scheduledat'];this[_0xe896('0x14')]=_0x318a7b[_0xe896('0x14')]||0x0;this['countcongestionretry']=_0x318a7b[_0xe896('0x15')]||0x0;this['countnoanswerretry']=_0x318a7b[_0xe896('0x16')]||0x0;this[_0xe896('0x17')]=(_0x318a7b[_0xe896('0x14')]||0x0)+(_0x318a7b['countcongestionretry']||0x0)+(_0x318a7b[_0xe896('0x16')]||0x0)+(_0x318a7b[_0xe896('0x18')]||0x0)+(_0x318a7b[_0xe896('0x19')]||0x0)+(_0x318a7b[_0xe896('0x1a')]||0x0)+(_0x318a7b[_0xe896('0x1b')]||0x0)+(_0x318a7b[_0xe896('0x1c')]||0x0);this[_0xe896('0x18')]=_0x318a7b[_0xe896('0x18')]||0x0;this['countdropretry']=_0x318a7b[_0xe896('0x19')]||0x0;this['countabandonedretry']=_0x318a7b['countabandonedretry']||0x0;this[_0xe896('0x1b')]=_0x318a7b[_0xe896('0x1b')]||0x0;this[_0xe896('0x1c')]=_0x318a7b[_0xe896('0x1c')]||0x0;this['callback']=_0x318a7b[_0xe896('0x1d')];this['callbackuniqueid']=_0x318a7b['callbackuniqueid'];this[_0xe896('0x1e')]=_0x318a7b[_0xe896('0x1e')];this[_0xe896('0x1f')]=_0x318a7b[_0xe896('0x1f')];this[_0xe896('0x20')]=_0x318a7b[_0xe896('0x20')];this[_0xe896('0x21')]=_0x318a7b['ListId'];this[_0xe896('0x22')]=_[_0xe896('0x3')](_0x318a7b[_0xe896('0xb')])?_0x318a7b['UserId']:_0x318a7b[_0xe896('0xb')]['id'];this[_0xe896('0x23')]=_0x318a7b[_0xe896('0x23')];this[_0xe896('0x24')]='';this[_0xe896('0x25')]='';}Action[_0xe896('0x26')]['getCaller']=function(){return util[_0xe896('0xc')](_0xe896('0x27'),this[_0xe896('0xe')],this[_0xe896('0x28')]);};module[_0xe896('0x29')]=Action; \ No newline at end of file +var _0xb78e=['Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname'];(function(_0x17bccc,_0x4cc003){var _0x16e5fe=function(_0x3f7b2a){while(--_0x3f7b2a){_0x17bccc['push'](_0x17bccc['shift']());}};_0x16e5fe(++_0x4cc003);}(_0xb78e,0x1c9));var _0xeb78=function(_0x542b09,_0x4d2b7e){_0x542b09=_0x542b09-0x0;var _0x5a9ec2=_0xb78e[_0x542b09];return _0x5a9ec2;};'use strict';var util=require(_0xeb78('0x0'));var _=require(_0xeb78('0x1'));var moment=require('moment');function checkNameSurname(_0x1570f5,_0x2785f9,_0xb198c1){var _0x2520cf='';if(!_[_0xeb78('0x2')](_0x2785f9)&&_0xeb78('0x3')===typeof _0x2785f9){_0x2520cf+=_0x2785f9;}if(!_[_0xeb78('0x2')](_0xb198c1)&&_0xeb78('0x3')===typeof _0xb198c1){_0x2520cf+='\x20'+_0xb198c1;}if(_0x2520cf!==''){return _0x2520cf;}return _0x1570f5;}function Action(_0x57ec6b,_0x3c35e7,_0x17a736,_0x1ccc2f,_0x30c884){this[_0xeb78('0x4')]=_0x17a736||undefined;this[_0xeb78('0x5')]=_0x57ec6b['id'];this[_0xeb78('0x6')]=_0x3c35e7['name'];this[_0xeb78('0x7')]=_0x3c35e7[_0xeb78('0x7')];this[_0xeb78('0x8')]=_0xeb78('0x6');this[_0xeb78('0x9')]=![];this[_0xeb78('0xa')]=_[_0xeb78('0x2')](_0x57ec6b[_0xeb78('0xb')])?undefined:_0x57ec6b[_0xeb78('0xb')]['name'];this[_0xeb78('0xc')]=this[_0xeb78('0xa')]?util[_0xeb78('0xd')](_0xeb78('0xe'),this[_0xeb78('0xa')]):_0x1ccc2f||undefined;this[_0xeb78('0xf')]=checkNameSurname(_0x57ec6b[_0xeb78('0x10')][_0xeb78('0x11')],_0x57ec6b[_0xeb78('0x10')][_0xeb78('0x12')],_0x57ec6b['Contact'][_0xeb78('0x13')]);this[_0xeb78('0x14')]=_0x57ec6b['active']||![];this['calleridnum']=_0x57ec6b['phone'];this[_0xeb78('0x15')]=_0x57ec6b['scheduledat'];this[_0xeb78('0x16')]=_0x57ec6b[_0xeb78('0x16')]||0x0;this['countcongestionretry']=_0x57ec6b[_0xeb78('0x17')]||0x0;this['countnoanswerretry']=_0x57ec6b[_0xeb78('0x18')]||0x0;this[_0xeb78('0x19')]=(_0x57ec6b['countbusyretry']||0x0)+(_0x57ec6b[_0xeb78('0x17')]||0x0)+(_0x57ec6b[_0xeb78('0x18')]||0x0)+(_0x57ec6b[_0xeb78('0x1a')]||0x0)+(_0x57ec6b['countdropretry']||0x0)+(_0x57ec6b[_0xeb78('0x1b')]||0x0)+(_0x57ec6b[_0xeb78('0x1c')]||0x0)+(_0x57ec6b['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x57ec6b[_0xeb78('0x1a')]||0x0;this[_0xeb78('0x1d')]=_0x57ec6b[_0xeb78('0x1d')]||0x0;this[_0xeb78('0x1b')]=_0x57ec6b[_0xeb78('0x1b')]||0x0;this[_0xeb78('0x1c')]=_0x57ec6b[_0xeb78('0x1c')]||0x0;this[_0xeb78('0x1e')]=_0x57ec6b[_0xeb78('0x1e')]||0x0;this['callback']=_0x57ec6b['callback'];this['callbackuniqueid']=_0x57ec6b['callbackuniqueid'];this[_0xeb78('0x1f')]=_0x57ec6b['callbackat'];this[_0xeb78('0x20')]=_0x57ec6b[_0xeb78('0x20')];this['ContactId']=_0x57ec6b[_0xeb78('0x21')];this['ListId']=_0x57ec6b[_0xeb78('0x22')];this[_0xeb78('0x23')]=_[_0xeb78('0x2')](_0x57ec6b[_0xeb78('0xb')])?_0x57ec6b['UserId']:_0x57ec6b[_0xeb78('0xb')]['id'];this['VoiceQueueId']=_0x57ec6b[_0xeb78('0x24')];this[_0xeb78('0x25')]='';this[_0xeb78('0x26')]='';}Action['prototype'][_0xeb78('0x27')]=function(){return util[_0xeb78('0xd')](_0xeb78('0x28'),this[_0xeb78('0xf')],this[_0xeb78('0x29')]);};module[_0xeb78('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index d7dc3f7..2719f96 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 _0x9c44=['Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','Answer','[syncHangup][talking]','cause','statedesc','channelstate','transfer','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','sequence','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pTalking','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','name','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','originated','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','isNil','Contact','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]'];(function(_0x437dcd,_0x4d95b1){var _0x12f927=function(_0x33b1c1){while(--_0x33b1c1){_0x437dcd['push'](_0x437dcd['shift']());}};_0x12f927(++_0x4d95b1);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x49c4('0x0'));var moment=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));var logger=require(_0x49c4('0x4'))(_0x49c4('0x5'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x49c4('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x49c4('0x7'));var Action=require(_0x49c4('0x8'));var ut=require(_0x49c4('0x9'));var utils=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitVoiceQueueChannelRemove(_0x46e475){logger[_0x49c4('0x24')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x46e475));emit(util['format'](_0x49c4('0x25'),_0x46e475['name']),'voice_queue_channel:remove',_0x46e475);io[_0x49c4('0x23')](_0x49c4('0x26'),_0x46e475);}function notSendMessagesQueue(_0x26c640){if(_0x26c640[_0x49c4('0x27')]){if(_0x26c640['originated']===0x0&&_0x26c640['pTalking']===0x0){_0x26c640[_0x49c4('0x27')]=![];_0x26c640[_0x49c4('0x28')]=0x0;_0x26c640['paused']=0x0;_0x26c640[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];ut[_0x49c4('0x2c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x26c640['name']+_0x49c4('0x2d'));}else{_0x26c640['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2e')];ut[_0x49c4('0x2c')](_0x49c4('0x2f'),_0x26c640['name']+_0x49c4('0x30'));}}}Preview[_0x49c4('0x31')][_0x49c4('0x22')]=function(){var _0x4f28a2=this;setInterval(function(){_0x4f28a2[_0x49c4('0x32')]();},0x7cf);};Preview[_0x49c4('0x31')][_0x49c4('0x32')]=function(){var _0x427b26=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x46f7ea in _0x427b26){if(_0x427b26['hasOwnProperty'](_0x46f7ea)&&(_0x427b26[_0x46f7ea]['dialMethod']==='preview'||_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x34'))&&_0x427b26[_0x46f7ea][_0x49c4('0x35')]===_0x49c4('0x36')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x37')]();}}if(_0x427b26[_0x49c4('0x38')](_0x46f7ea)&&_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x5')&&_0x427b26[_0x46f7ea]['type']==='outbound'){if(_0x427b26[_0x46f7ea][_0x49c4('0x39')]){this[_0x49c4('0x3a')](_0x427b26[_0x46f7ea]);if(_0x427b26[_0x46f7ea][_0x49c4('0x3b')])this[_0x49c4('0x3c')](_0x427b26[_0x46f7ea]);}else{notSendMessagesQueue(_0x427b26[_0x46f7ea]);}}}};Preview[_0x49c4('0x31')]['clearZombieChannel']=function(_0x2aac35){var _0x84c621=this;this[_0x49c4('0x3d')]['enqueue'](function(){if(!_['isNil'](_0x84c621[_0x49c4('0x13')][_0x2aac35])){loggerAction[_0x49c4('0x24')](_0x49c4('0x3e'),_0x2aac35,_0x49c4('0x3f'),_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')],_0x49c4('0x41'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]]['originated']),_0x49c4('0x43'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35]['queue']][_0x49c4('0x44')]),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x13')][_0x2aac35]['dialAnswer']),JSON[_0x49c4('0x42')](_[_0x49c4('0x45')](_0x84c621[_0x49c4('0x13')][_0x2aac35],[_0x49c4('0x46'),_0x49c4('0x47'),_0x49c4('0x48'),_0x49c4('0x49')])));return ami[_0x49c4('0x4a')]({'action':_0x49c4('0x4b'),'channel':_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x4c')]})['catch'](function(_0x2d2510){if(_0x2d2510[_0x49c4('0x29')]===_0x49c4('0x4d')){setTimeout(function(){if(_0x84c621[_0x49c4('0x13')][_0x2aac35]){ut[_0x49c4('0x4e')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]],_0x49c4('0x4f'));if(_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x50')]===!![]){ut[_0x49c4('0x51')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]],'[clearZombieChannel]');ut[_0x49c4('0x52')](_0x49c4('0x53')+_0x2aac35,_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]);}ut[_0x49c4('0x52')](_0x49c4('0x54')+_0x2aac35,_0x84c621['actions'][_0x2aac35]['queue']);delete _0x84c621[_0x49c4('0x13')][_0x2aac35];}},0x2328);}});}});};Preview[_0x49c4('0x31')][_0x49c4('0x37')]=function(){var _0x117151=this;loggerAction['info'](_0x49c4('0x55'),_[_0x49c4('0x56')](this[_0x49c4('0x13')]));for(var _0x444270 in this[_0x49c4('0x13')]){if(_0x117151[_0x49c4('0x13')][_0x49c4('0x38')](_0x444270)){_0x117151[_0x49c4('0x57')](_0x444270);}}};Preview[_0x49c4('0x31')]['recallMe']=function(_0x2ad771){var _0x4d27d0=this;rpcDb[_0x49c4('0x58')](_0x2ad771['id'],ut[_0x49c4('0x59')](this[_0x49c4('0x14')]))[_0x49c4('0x5a')](function(_0x2d93d8){if(!_['isNil'](_0x2d93d8)){for(var _0x592e8e=0x0;_0x592e8e<_0x2d93d8[_0x49c4('0x5b')];_0x592e8e+=0x1){if(ut[_0x49c4('0x5c')](_0x2d93d8[_0x592e8e][_0x49c4('0x5d')])<_0x2ad771[_0x49c4('0x5e')]*0x3c){if(_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]&&!_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]['voicePause']){_0x4d27d0[_0x49c4('0x60')](_0x2d93d8[_0x592e8e]['id'])['then'](ut[_0x49c4('0x61')](_0x49c4('0x62')))[_0x49c4('0x63')](ut[_0x49c4('0x61')](_0x49c4('0x62')));}else{rpcDb[_0x49c4('0x64')](_0x2d93d8[_0x592e8e]['id']);}}else{var _0x2c6be1=new Action(_0x2d93d8[_0x592e8e],_0x2ad771);_0x2c6be1['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x2ad771['outboundReCallsDay']+=0x1;ut[_0x49c4('0x67')](_0x2c6be1,0x17,_0x49c4('0x68'));if(_0x2ad771[_0x49c4('0x69')]){rpcDb[_0x49c4('0x6a')](ut['createBody'](_0x2d93d8[_0x592e8e]));rpcDb['createCustomerHistory'](_0x2c6be1,_0x49c4('0x6b'));}else{ut['logCustomer'](_0x2c6be1,0x16,_0x49c4('0x6c'));rpcDb[_0x49c4('0x6d')](_0x2c6be1,_0x49c4('0x6e'));rpcDb[_0x49c4('0x6f')](_0x2c6be1,_0x49c4('0x6e'));}}}}})[_0x49c4('0x63')](ut[_0x49c4('0x61')]('[getContactRecallMe]'));};Preview[_0x49c4('0x31')][_0x49c4('0x3a')]=function(_0x3936d3){_0x3936d3[_0x49c4('0x27')]=!![];if(ut[_0x49c4('0x70')](_0x3936d3[_0x49c4('0x71')])){_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x72')];}else if(!ut[_0x49c4('0x73')](_0x3936d3['dialActive'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];}else if(!this['isTrunkReachable'](_0x3936d3['Trunk'])){if(!this[_0x49c4('0x74')](_0x3936d3['TrunkBackup'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x75')];}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x76')];}}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')]['ACTIVE'];}};Preview[_0x49c4('0x31')][_0x49c4('0x77')]=function(_0x207572,_0x208208,_0x73840f){var _0xa431d=this;var _0x5d24f3=this['actions'][_0x208208];var _0x1ef0c1=this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]];var _0xf7a10f;var _0x23288e=![];var _0x6b2592=0x2;var _0xc2033f=0x3;if(_0x1ef0c1){switch(_0x73840f){case'1':_0x1ef0c1['outboundNoSuchCallsDay']+=0x1;_0x5d24f3[_0x49c4('0x78')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut['totalGlobal'](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x0,'NoSuchNumber');ami[_0x49c4('0x23')](_0x49c4('0x7a'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x7c')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x7d'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'0',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x483770){_0x23288e=_0x483770[_0x49c4('0x7f')]==0x1;_0x6b2592=_0x1ef0c1[_0x49c4('0x80')];_0xc2033f=_0x1ef0c1['callAdditionalPhoneAfterMin'];if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5d24f3['countnosuchnumberretry']>=_0x1ef0c1['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0x84'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0x78'),_0x1ef0c1['dialNoSuchNumberRetryFrequency']),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}delete this['actions'][_0x207572[_0x49c4('0x88')]];}else{_0x5d24f3[_0x49c4('0x78')]++;logger[_0x49c4('0x24')](_0x49c4('0x89'),_0x5d24f3['countnosuchnumberretry']);logger[_0x49c4('0x24')]('id',_0x5d24f3[_0x49c4('0x8a')]);_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnosuchnumberretry':_0x5d24f3['countnosuchnumberretry']}})[_0x49c4('0x5a')](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'ANSWER':var _0x5d6de0=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x5d24f3[_0x49c4('0x8c')]=_0x5d6de0;_0x5d24f3[_0x49c4('0x8d')]=_0x5d6de0;_0x5d24f3['dialAnswer']=!![];_0x1ef0c1['pTalking']+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x8e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);ami[_0x49c4('0x23')]('custom:agentconnect',ut[_0x49c4('0x7b')](_0x5d24f3,'connect',this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));if(_0x1ef0c1[_0x49c4('0x92')]){ami[_0x49c4('0x23')](_0x49c4('0x93'),ut[_0x49c4('0x94')](_0x5d24f3));}break;case'16':ami[_0x49c4('0x23')](_0x49c4('0x95'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96'),this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96')));_0x1ef0c1[_0x49c4('0x97')]+=0x1;_0x1ef0c1[_0x49c4('0x98')]+=0x1;_0x1ef0c1[_0x49c4('0x99')]+=0x1;ut[_0x49c4('0x51')](_0x1ef0c1,'[16]');_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x4,'Answer');rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x9a'));rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0x9b'));rpcDb['crateCustomerReportQueue'](_0x5d24f3);_0x1ef0c1['sumDuration']+=_0x5d24f3['talktime'];_0x1ef0c1[_0x49c4('0x9c')]+=_0x5d24f3[_0x49c4('0x9d')];logger[_0x49c4('0x24')](_0x49c4('0x9e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);delete this['actions'][_0x207572[_0x49c4('0x88')]];break;case _0x49c4('0x9f'):_0x1ef0c1[_0x49c4('0xa0')]+=0x1;_0x5d24f3['countbusyretry']+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x5,_0x49c4('0xa1'));_0x6b2592=_0x1ef0c1[_0x49c4('0xa2')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xa4'),ut['buildObj'](_0x5d24f3,_0x49c4('0xa5')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xa6'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'5',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x4a204d){_0x23288e=_0x4a204d['additional']==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xa8'));}else{if(_0x5d24f3[_0x49c4('0xa9')]>=_0x1ef0c1[_0x49c4('0xaa')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xa6'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xa9'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xa9')]++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countbusyretry':_0x5d24f3['countbusyretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case _0x49c4('0xad'):_0x1ef0c1['outboundNoAnswerCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xae')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x3,_0x49c4('0xaf'));_0x6b2592=_0x1ef0c1['dialNoAnswerRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];var _0x2329b6=ut['buildNoAnswerEventPayload'](_0x5d24f3,_0x1ef0c1);ami[_0x49c4('0x23')](_0x49c4('0xb0'),_0x2329b6);rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb1'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'3',_0x1ef0c1)['then'](function(_0x37fef1){_0x23288e=_0x37fef1[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5d24f3[_0x49c4('0xae')]>=_0x1ef0c1['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xae'),_0x1ef0c1[_0x49c4('0xb2')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3['idContact'],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CONGESTION':_0x1ef0c1['outboundCongestionCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xb3')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut['logCustomer'](_0x5d24f3,0x8,_0x49c4('0xb4'));_0x6b2592=_0x1ef0c1[_0x49c4('0xb5')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xb6'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xb7')));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb8'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'8',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x16864c){_0x23288e=_0x16864c[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb['createCustomerFinal'](_0xf7a10f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5d24f3[_0x49c4('0xb3')]>=_0x1ef0c1[_0x49c4('0xb9')]){rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xb8'));}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xb3'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countcongestionretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countcongestionretry':_0x5d24f3[_0x49c4('0xb3')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CANCEL':_0x1ef0c1[_0x49c4('0xba')]+=0x1;_0x5d24f3[_0x49c4('0xbb')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x14,_0x49c4('0xbc'));_0x6b2592=_0x1ef0c1['dialAgentRejectRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xbd'),ut[_0x49c4('0x7b')](_0x5d24f3,'agentreject'));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xbe'));_0xa431d['verifyAdditionalPhones'](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x532ba5){_0x23288e=_0x532ba5[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0xf7a10f,_0x49c4('0xbf'));}else{if(_0x5d24f3[_0x49c4('0xbb')]>=_0x1ef0c1[_0x49c4('0xc0')]){rpcDb['createCustomerFinal'](_0x5d24f3,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,'countagentrejectretry',_0x1ef0c1[_0x49c4('0xc1')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'ABANDONED':_0x1ef0c1[_0x49c4('0xc2')]+=0x1;_0x5d24f3[_0x49c4('0xc3')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xb,_0x49c4('0xc4'));rpcDb[_0x49c4('0x6d')](_0x5d24f3,'[callProgressDetectingCustomer][logAbandoned]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'11',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x85418e){_0x23288e=_0x85418e[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xc5'));}else{if(_0x5d24f3[_0x49c4('0xc6')]>=_0x1ef0c1[_0x49c4('0xc7')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xc5'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xc3'),_0x1ef0c1[_0x49c4('0xc8')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3['activeContact']);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'18':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0xca')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x12,_0x207572['cause-txt']||_0x207572['dialstatus']);ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcd'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x2b6e61){_0x23288e=_0x2b6e61[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0x12,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcd'));}else{rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xcd'));}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3['countnoanswerretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;case'19':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x13,_0x207572[_0x49c4('0xce')]||_0x207572['dialstatus']);ami['emit']('custom:amd',ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcf'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)['then'](function(_0x3ea304){_0x23288e=_0x3ea304[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcf'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xcf'));}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;default:if(_0x5d24f3[_0x49c4('0x50')]){ut['decrementTalkink'](_0x1ef0c1,'[default]');ut[_0x49c4('0x52')](_0x49c4('0xd0')+_0x1ef0c1['name'],_0x207572);}_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xc,_0x207572[_0x49c4('0xce')]||_0x207572[_0x49c4('0xd1')]);_0x6b2592=_0x1ef0c1[_0x49c4('0xc1')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];rpcDb['createCustomerHistory'](_0x5d24f3,'[callProgressDetectingCustomer][logUnknown]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x42f2db){_0x23288e=_0x42f2db['additional']==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xd2'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xd2'));}delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0x88')]];}else{_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});}});}if(!(_0x5d24f3[_0x49c4('0x50')]&&_0x73840f==='16')){ut[_0x49c4('0x4e')](_0x1ef0c1,_0x49c4('0xd3'));logger['info'](_0x49c4('0xd4'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],'originated:\x20',_0x1ef0c1['originated']);}if(_0x73840f!==_0x49c4('0xd5')){delete this['actions'][_0x207572[_0x49c4('0x88')]];delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0xd6')]];}_0x1ef0c1[_0x49c4('0xd7')]=!![];}};Preview[_0x49c4('0x31')][_0x49c4('0xd8')]=function(_0x3238e7,_0xe9e187,_0x31ba95){if(_[_0x49c4('0xd9')](_0xe9e187)&&_0x49c4('0xda')!==typeof _0xe9e187){return;}if(_[_0x49c4('0xd9')](_0x31ba95)&&'object'!==typeof _0x31ba95){return;}switch(_0x31ba95[_0x49c4('0xdb')]){case'0':ut[_0x49c4('0xdc')](_0x3238e7,0x0,_0x49c4('0xdd'));rpcDb['createAgentHistory'](_0x3238e7,_0x49c4('0xde'));break;case'3':ut['logAgent'](_0x3238e7,0x3,_0x49c4('0xaf'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe0'));break;case'5':ut[_0x49c4('0xdc')](_0x3238e7,0x5,'Busy');rpcDb[_0x49c4('0xdf')](_0x3238e7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3238e7,0x8,_0x49c4('0xb4'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));break;case'22':ut['logAgent'](_0x3238e7,0x16,'AnswerAGI');rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe2'));break;default:ut[_0x49c4('0xdc')](_0x3238e7,0xc,_0x31ba95[_0x49c4('0xdb')]);rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));}ut[_0x49c4('0x4e')](_0xe9e187,_0x49c4('0xe3'));logger[_0x49c4('0x24')]('[originated][decrement][callProgressDetectingAgent]',_0x3238e7[_0x49c4('0x8f')],_0x49c4('0x90'),_0xe9e187['name'],'originated:\x20',_0xe9e187[_0x49c4('0xe4')]);delete this['actions'][_0x3238e7[_0x49c4('0x8f')]];};Preview['prototype'][_0x49c4('0x7e')]=function(_0x4b83a6,_0x30781e,_0x1fb51e){return cmHopperAdditionalPhone[_0x49c4('0x7e')](_0x4b83a6,_0x30781e,_0x1fb51e)[_0x49c4('0x63')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x49c4('0x31')][_0x49c4('0xac')]=function(_0x3ce256,_0x5737b4,_0x367d3d){return cmHopperAdditionalPhone[_0x49c4('0xac')](_0x3ce256,_0x5737b4,_0x367d3d)['catch'](logger['info'](_0x49c4('0xe5')));};Preview[_0x49c4('0x31')][_0x49c4('0x8b')]=function(_0x49dc8a){return Promise[_0x49c4('0xe6')]()[_0x49c4('0x5a')](cmHopperAdditionalPhone[_0x49c4('0x8b')](_0x49dc8a))[_0x49c4('0x63')](logger['info'](_0x49c4('0xe7')));};Preview['prototype']['checkInBlack']=function(_0xf5f718,_0x171530,_0x12fda9,_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new Promise(function(_0x947dd8,_0xa6f48){if(_[_0x49c4('0xe8')](_0x171530)||_['isNil'](_0x171530[_0x49c4('0xe9')])||_['isNil'](_0x171530['phone'])||_[_0x49c4('0xe8')](_0x171530[_0x49c4('0x48')])){_0xa6f48(ut[_0x49c4('0x29')]('Contact\x20is\x20undefined',_0x24ff20,_0x5adb90));return;}var _0x336853=uuid['v4']();var _0x4a874a=_0x32b6e4[_0x49c4('0x10')][_0x171530[_0x49c4('0x3f')][_0x49c4('0x91')]];var _0x3738d7=_0x12fda9?_0x32b6e4[_0x49c4('0x14')][_0x12fda9]['id']:undefined;_0x32b6e4[_0x49c4('0x13')][_0x336853]=new Action(_0x171530,_0x4a874a,_0x336853,_0x12fda9,_0x3738d7);var _0x2b31ac=_0x32b6e4['actions'][_0x336853];_0x2b31ac[_0x49c4('0x86')]=_0x24ff20;_0x2b31ac[_0x49c4('0x87')]=_0x5adb90;_0x2b31ac[_0x49c4('0xea')]=_0x12fda9;if(_[_0x49c4('0xeb')](_0xf5f718)){_0x32b6e4['execCall'](_0x2b31ac,_0x4a874a,_0x171530,_0x12fda9)['then'](function(_0x4c15ff){logger[_0x49c4('0x24')](_0x49c4('0xec'),_0x49c4('0xed')+_0x2b31ac[_0x49c4('0x40')]+_0x49c4('0xee')+_0x2b31ac[_0x49c4('0x8a')],JSON[_0x49c4('0x42')](_0x4c15ff));ami['emit'](_0x49c4('0xef'),ut[_0x49c4('0x7b')](_0x2b31ac,'called',_0x32b6e4['campaignsPreview'][_0x2b31ac['queue']]));_0x947dd8(ut[_0x49c4('0x29')](_0x49c4('0xf0')));})[_0x49c4('0x63')](function(_0x3d0013){ut[_0x49c4('0x2c')](_0x49c4('0xf1'),_0x3d0013);_0xa6f48(ut[_0x49c4('0x29')]('Call\x20failed',_0x24ff20,_0x5adb90));});}else{_0x4a874a[_0x49c4('0xf2')]+=0x1;ut[_0x49c4('0xf3')](_0x2b31ac);rpcDb[_0x49c4('0xf4')](_0x2b31ac,_0x49c4('0xf5'));delete _0x32b6e4['actions'][_0x336853];_0xa6f48(ut[_0x49c4('0x29')](_0x49c4('0xf6'),_0x24ff20,_0x5adb90));}});};Preview[_0x49c4('0x31')][_0x49c4('0x74')]=function(_0x12d707){return!_['isNil'](_0x12d707)&&!_[_0x49c4('0xe8')](_0x12d707['name'])&&!_['isNil'](_0x12d707[_0x49c4('0xf7')])&&_0x12d707[_0x49c4('0xf7')]&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util[_0x49c4('0x65')]('SIP/%s',_0x12d707[_0x49c4('0x91')])])&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])]['status'])&&(this[_0x49c4('0x12')][util[_0x49c4('0x65')](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xf9')||this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xfa'));};Preview[_0x49c4('0x31')]['run']=function(_0x34ce60,_0x39dc83){return this[_0x49c4('0xfb')](_0x34ce60,_0x39dc83)[_0x49c4('0x5a')](function(_0xa2c8cf){return _['pick'](_0xa2c8cf,[_0x49c4('0x29')]);})[_0x49c4('0x63')](function(_0x789121){if(_0x789121[_0x49c4('0xfc')]){rpcDb[_0x49c4('0xfd')](_0x34ce60);}if(_0x789121[_0x49c4('0xf7')]){rpcDb[_0x49c4('0x64')](_0x34ce60);}throw _[_0x49c4('0x45')](_0x789121,[_0x49c4('0x29')]);});};Preview[_0x49c4('0x31')]['execRun']=function(_0x2d3211,_0x1b6966){var _0x2c4d2a=this;var _0x1745f8,_0xe22808;return rpcDb['getContactPreview'](_0x2d3211)['then'](function(_0x13aab1){if(!_[_0x49c4('0xe8')](_0x13aab1[0x0])){_0xe22808=_0x13aab1[0x0][_0x49c4('0xfe')]?![]:!![];_0x1745f8=_0x13aab1[0x0][_0x49c4('0xfe')]?!![]:![];_0x1745f8=_0x1b6966?!![]:_0x1745f8;}var _0xd87f7e=_0x2c4d2a[_0x49c4('0xff')](_0x13aab1);if(_0xd87f7e['isValid']){rpcDb[_0x49c4('0x100')](_[_0x49c4('0x45')](_0x13aab1[0x0],['VoiceQueueId',_0x49c4('0x101')]))['then'](function(_0x30d99a){_0x2c4d2a[_0x49c4('0x102')](_0x30d99a,_0x13aab1[0x0],_0x1b6966,_0xe22808,_0x1745f8)[_0x49c4('0x5a')](function(_0x5db4a1){return _0x5db4a1;})[_0x49c4('0x63')](function(_0x4f431e){throw _0x4f431e;});})[_0x49c4('0x63')](function(_0x5025ee){ut['logger'](_0x49c4('0x103'),_0x5025ee);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),_0xe22808,_0x1745f8);});}else{throw ut[_0x49c4('0x29')](_0xd87f7e[_0x49c4('0x29')],_0xe22808,_0x1745f8);}})[_0x49c4('0x63')](function(_0x5a06d7){ut['logger'](_0x49c4('0x105'),_0x5a06d7);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),![],!![]);});};Preview[_0x49c4('0x31')][_0x49c4('0xff')]=function(_0x3d2dd0){if(_[_0x49c4('0xe8')](_0x3d2dd0)||_['isEmpty'](_0x3d2dd0)||!_['isNil'](_0x3d2dd0[0x0]['Agent'])&&_['isNil'](_0x3d2dd0[0x0][_0x49c4('0x5f')]['name'])){ut[_0x49c4('0x2c')](_0x49c4('0x106'),_0x3d2dd0);return{'isValid':![],'message':_0x49c4('0x107')};}var _0x53dd04=this['campaignsPreview'][_0x3d2dd0[0x0][_0x49c4('0x3f')][_0x49c4('0x91')]];_0x53dd04['message']=utils[_0x49c4('0x2a')][_0x49c4('0x76')];if(_[_0x49c4('0xe8')](_0x53dd04)){ut[_0x49c4('0x2c')](_0x49c4('0x108'),_0x53dd04);return{'isValid':![],'message':_0x49c4('0x109')};}if(!this['isTrunkReachable'](_0x53dd04[_0x49c4('0x10a')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10c'));if(!this[_0x49c4('0x74')](_0x53dd04[_0x49c4('0x10d')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x49c4('0x73')](_0x53dd04[_0x49c4('0x39')])){ut[_0x49c4('0x2c')](_0x49c4('0x10f'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110')};}return{'isValid':!![],'message':_0x49c4('0x111')};};Preview[_0x49c4('0x31')][_0x49c4('0x112')]=function(_0x3a8fe1,_0x29c6fc,_0x1642fd,_0x4806ac){var _0xc641bc=this;return new Promise(function(_0xcec186,_0x1c8258){var _0x471e28=_0x3a8fe1[_0x49c4('0x8f')];var _0x5a471d=_0xc641bc['isTrunkReachable'](_0x29c6fc[_0x49c4('0x10a')])?util[_0x49c4('0x65')]('SIP/%s/%s%s',_0x29c6fc['Trunk'][_0x49c4('0x91')],_['isNil'](_0x29c6fc[_0x49c4('0x113')])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc[_0x49c4('0x115')]>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd[_0x49c4('0x101')]):util['format'](_0x49c4('0x117'),_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x91')]:_0x29c6fc['TrunkBackup'][_0x49c4('0x91')],_[_0x49c4('0xe8')](_0x29c6fc['dialPrefix'])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc['dialCutDigit']>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd['phone']);var _0x1ee36e=_0xc641bc[_0x49c4('0x74')](_0x29c6fc[_0x49c4('0x10a')])?ut[_0x49c4('0x118')](_0x29c6fc['Trunk'][_0x49c4('0x119')],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc['dialOriginateCallerIdNumber']):ut[_0x49c4('0x118')](_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x119')]:_0x29c6fc[_0x49c4('0x10d')]['callerid'],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc[_0x49c4('0x11c')]);if(_0x1ee36e){_0x3a8fe1[_0x49c4('0x11d')]=ut[_0x49c4('0x11e')](_0x1ee36e);_0x3a8fe1[_0x49c4('0x11f')]=ut[_0x49c4('0x120')](_0x1ee36e);}var _0x37dbbf=ut[_0x49c4('0x121')](_0x29c6fc,_0x1642fd,_0x5a471d,_0x1ee36e,_0x471e28,_0x3a8fe1);_[_0x49c4('0x122')](_0x3a8fe1,ut['toLowerVariables'](_0x37dbbf));_0x3a8fe1[_0x49c4('0x123')]=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x29c6fc[_0x49c4('0x124')]=_0x37dbbf;var _0x5adc01=ut[_0x49c4('0x125')](_0x3a8fe1,_0x29c6fc,_0x37dbbf,_0x3a8fe1[_0x49c4('0x87')],_0x4806ac);return ami['Action'](_0x5adc01)[_0x49c4('0x5a')](function(_0x245fae){_0x29c6fc[_0x49c4('0xe4')]+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x126'),_0x471e28,'\x20Queue',_0x29c6fc[_0x49c4('0x91')],'originated:\x20',_0x29c6fc[_0x49c4('0xe4')]);_0xcec186(_0x245fae);})[_0x49c4('0x63')](function(_0x294b2c){ut['logAgent'](_0x3a8fe1,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xdf')](_0x3a8fe1,_0x49c4('0x128'));_0x1c8258(_0x294b2c);});});};Preview['prototype']['syncNewExten']=function(_0x256d6b){if(this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]]){this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]][_0x49c4('0x4c')]=_0x256d6b['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x2eae62){var _0x417cef=this;var _0x153450=this[_0x49c4('0x13')][_0x2eae62['actionid']];if(_0x153450){if(_0x153450[_0x49c4('0xea')]&&this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]){ut[_0x49c4('0x129')](_0x153450,this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]][_0x49c4('0x91')],this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]['id']);}var _0x39e6f5=_[_0x49c4('0x12a')](_0x153450);_0x39e6f5['responsetime']=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3308c4=_0x417cef[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]];if(ut[_0x49c4('0x12b')](_0x2eae62['response'])){if(_0x153450[_0x49c4('0x86')]){rpcDb['unlockContact'](_0x153450['idContact']);}if(_0x153450['activeContact']){rpcDb[_0x49c4('0x64')](_0x153450[_0x49c4('0x8a')]);}ami[_0x49c4('0x23')]('custom:agentringnoanswer',ut[_0x49c4('0x7b')](_0x153450,'rejected',this[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]]));this[_0x49c4('0xd8')](_0x39e6f5,_0x3308c4,_0x2eae62);}else{_0x153450['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));ut[_0x49c4('0xdc')](_0x39e6f5,0x4,_0x49c4('0x12c'));rpcDb[_0x49c4('0xdf')](_0x39e6f5,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x49c4('0x31')][_0x49c4('0x1a')]=function(_0x15e35f){var _0x6b1554=this['actions'][_0x15e35f['linkedid']];var _0x238884;if(_0x6b1554){_0x238884=this[_0x49c4('0x10')][_0x6b1554['queue']];logger[_0x49c4('0x24')](_0x49c4('0x12d'),_0x15e35f[_0x49c4('0x88')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);}if(this['actions'][_0x15e35f['linkedid']]&&_0x15e35f[_0x49c4('0x88')]!==_0x15e35f[_0x49c4('0x8f')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]]['dialAnswer']){this[_0x49c4('0x77')](_0x15e35f,_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')]);}else if(this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]][_0x49c4('0x50')]){logger['info']('[syncHangup][talking][cause]',_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884[_0x49c4('0x91')],_0x49c4('0x43'),_0x238884['pTalking']);this['callProgressDetectingCustomer'](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}}else if(_0x6b1554&&_[_0x49c4('0xe8')](_0x6b1554[_0x49c4('0x12f')])&&_0x238884['dialQueueProject']&&_0x15e35f[_0x49c4('0x88')]===_0x15e35f[_0x49c4('0x8f')]&&_[_0x49c4('0xe8')](_0x15e35f['reason'])&&_0x15e35f[_0x49c4('0x12e')]==='16'&&_0x15e35f[_0x49c4('0x130')]==='6'&&_[_0x49c4('0xd9')](_0x6b1554['transfer'])){if(_0x6b1554[_0x49c4('0x86')]){rpcDb[_0x49c4('0xfd')](_0x6b1554['idContact']);}if(_0x6b1554[_0x49c4('0x87')]){rpcDb[_0x49c4('0x64')](_0x6b1554['idContact']);}_0x15e35f[_0x49c4('0xdb')]='22';this[_0x49c4('0xd8')](_0x6b1554,_0x238884,_0x15e35f);}else if(_0x6b1554&&_0x6b1554[_0x49c4('0x131')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][transfer]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884['pTalking']);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}else if(this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][cause]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],'\x20Queue',_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')]);}}};Preview['prototype'][_0x49c4('0x1d')]=function(_0x40afb8){if(this[_0x49c4('0x13')][_0x40afb8[_0x49c4('0xd6')]]&&_0x40afb8[_0x49c4('0xd6')]!==_0x40afb8['destuniqueid']){this[_0x49c4('0x77')](_0x40afb8,_0x40afb8[_0x49c4('0xd6')],_0x40afb8[_0x49c4('0xd1')]);}};Preview[_0x49c4('0x31')][_0x49c4('0x1b')]=function(_0x39abbf){if(this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]&&_0x39abbf['linkedid']!==_0x39abbf[_0x49c4('0x8f')]&&!this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]['dialAnswer']){if(_0x39abbf['cause']==='1'){this[_0x49c4('0x77')](_0x39abbf,_0x39abbf['linkedid'],_0x39abbf[_0x49c4('0x12e')]);}}};Preview[_0x49c4('0x31')][_0x49c4('0x132')]=function(_0x3f0e74,_0x55f423,_0x3ce0f9){if(this[_0x49c4('0x13')][_0x3f0e74]){if(_[_0x49c4('0xe8')](this[_0x49c4('0x13')][_0x3f0e74]['variables'])){this[_0x49c4('0x13')][_0x3f0e74][_0x49c4('0x124')]={};}this['actions'][_0x3f0e74][_0x49c4('0x124')][_0x55f423]=_0x3ce0f9;}};Preview[_0x49c4('0x31')][_0x49c4('0x133')]=function(_0x72eab6){try{if(!_[_0x49c4('0xe8')](_0x72eab6)){if(ut[_0x49c4('0x134')](_[_0x49c4('0x135')](_0x72eab6[_0x49c4('0x136')])[0x0])){this['addVariable'](_0x72eab6['uniqueid'],_['keys'](_0x72eab6[_0x49c4('0x136')])[0x0],_0x72eab6[_0x49c4('0x137')]);}}}catch(_0x418ead){logger[_0x49c4('0x138')](_0x49c4('0x139'),util['inspect'](_0x418ead,{'showHidden':![],'depth':null}));}};Preview[_0x49c4('0x31')][_0x49c4('0x20')]=function(_0x9786bf){if(_0x9786bf){if(this[_0x49c4('0x13')][_0x9786bf['transfertargetlinkedid']]){this['actions'][_0x9786bf[_0x49c4('0x13a')]][_0x49c4('0x131')]=!![];}}};Preview[_0x49c4('0x31')][_0x49c4('0x13b')]=function(_0x281151){if(_0x281151){if(this[_0x49c4('0x13')][_0x281151['transfererlinkedid']]){this['actions'][_0x281151[_0x49c4('0x13c')]][_0x49c4('0x131')]=!![];}}};module[_0x49c4('0x13d')]=Preview; \ No newline at end of file +var _0xa9e0=['originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','Answer','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','swapAdditionalPhones','countnoanswerretry','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','Congestion','dialCongestionRetryFrequency','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','unlockAgent','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','lookAgent','isEmpty','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Call\x20failed','outboundBlacklistCallsDay','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','actionid','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','syncHangupRequest','keys','addVariable','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels'];(function(_0x3818f0,_0x328080){var _0x5466cb=function(_0x50932c){while(--_0x50932c){_0x3818f0['push'](_0x3818f0['shift']());}};_0x5466cb(++_0x328080);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8e'),ut[_0x0a9e('0x8f')](_0x211ef9));}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x90'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x91'),this[_0x0a9e('0x10')][_0x211ef9['queue']]));emitVoiceQueueChannelRemove(ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x91')));_0xe22ccc[_0x0a9e('0x92')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x93')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,'[16]');_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x4,_0x0a9e('0x94'));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x211ef9,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0a9e('0x95')](_0x211ef9);_0xe22ccc[_0x0a9e('0x96')]+=_0x211ef9[_0x0a9e('0x97')];_0xe22ccc[_0x0a9e('0x98')]+=_0x211ef9[_0x0a9e('0x97')];logger[_0x0a9e('0x26')](_0x0a9e('0x99'),_0x211ef9[_0x0a9e('0x9a')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9b')]+=0x1;_0x211ef9[_0x0a9e('0x9c')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x5,_0x0a9e('0x9d'));_0x47de4c=_0xe22ccc[_0x0a9e('0x9e')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];ami[_0x0a9e('0x25')](_0x0a9e('0x9f'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa0')));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xa1'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x361b21){_0x2da03c=_0x361b21['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa2')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa3'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa4'));}else{if(_0x211ef9[_0x0a9e('0x9c')]>=_0xe22ccc[_0x0a9e('0xa5')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa1'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x9c'),_0xe22ccc[_0x0a9e('0x9e')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9[_0x0a9e('0x9c')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0x9c')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xa6')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'NOANSWER':_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xa7')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut['totalGlobal'](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xa8')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa9')];var _0x5637a1=ut[_0x0a9e('0xaa')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xab'),_0x5637a1);rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xac'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x482ca2){_0x2da03c=_0x482ca2[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa2')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xad'));}else{if(_0x211ef9['countnoanswerretry']>=_0xe22ccc[_0x0a9e('0xae')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xac'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xa7'),_0xe22ccc['dialNoAnswerRetryFrequency']),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9[_0x0a9e('0xa7')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xa7')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case _0x0a9e('0xaf'):_0xe22ccc['outboundCongestionCallsDay']+=0x1;_0x211ef9['countcongestionretry']+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb0'));_0x47de4c=_0xe22ccc[_0x0a9e('0xb1')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa9')];ami[_0x0a9e('0x25')]('custom:agentcongestion',ut[_0x0a9e('0x78')](_0x211ef9,'congestion'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xb2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x50f8d7){_0x2da03c=_0x50f8d7[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa2')]){_0x5df0ad=ut['cloneAction'](_0x211ef9,0xf,_0x0a9e('0xa3'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb3'));}else{if(_0x211ef9[_0x0a9e('0xb4')]>=_0xe22ccc[_0x0a9e('0xb5')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb2'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb4'),_0xe22ccc[_0x0a9e('0x9e')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9[_0x0a9e('0xb4')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb4')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xa6')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xb6'):_0xe22ccc[_0x0a9e('0xb7')]+=0x1;_0x211ef9[_0x0a9e('0xb8')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,'AgentReject');_0x47de4c=_0xe22ccc[_0x0a9e('0xb9')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa9')];ami[_0x0a9e('0x25')](_0x0a9e('0xba'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xbb')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xbc'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x151956){_0x2da03c=_0x151956[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbd'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xbe'));}else{if(_0x211ef9[_0x0a9e('0xb8')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xbe'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0x82')](_0x211ef9,'countagentrejectretry',_0xe22ccc[_0x0a9e('0xb9')]),_0x211ef9[_0x0a9e('0xbf')],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9[_0x0a9e('0xa7')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xa6')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case _0x0a9e('0xc0'):_0xe22ccc[_0x0a9e('0xc1')]+=0x1;_0x211ef9[_0x0a9e('0xc2')]+=0x1;_0x211ef9['countglobal']=ut['totalGlobal'](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc3'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc4'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x17793e){_0x2da03c=_0x17793e[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc4'));}else{if(_0x211ef9[_0x0a9e('0xc5')]>=_0xe22ccc[_0x0a9e('0xc6')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xc2'),_0xe22ccc[_0x0a9e('0xc7')]),_0x211ef9[_0x0a9e('0xbf')],_0x211ef9['activeContact']);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xa7')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xa6')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'18':_0xe22ccc[_0x0a9e('0xc8')]+=0x1;_0x211ef9[_0x0a9e('0xc9')]+=0x1;_0x211ef9['countglobal']=ut['totalGlobal'](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x12,_0x3aedd0['cause-txt']||_0x3aedd0[_0x0a9e('0xca')]);ami['emit'](_0x0a9e('0xcb'),ut['buildObj'](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcc'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x17cb30){_0x2da03c=_0x17cb30[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa2')]){_0x5df0ad=ut['cloneAction'](_0x211ef9,0x12,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcc'));}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xcc'));}}else{_0x211ef9[_0x0a9e('0xa7')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xa7')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xa6')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xc8')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xcd')]||_0x3aedd0[_0x0a9e('0xca')]);ami['emit'](_0x0a9e('0xcb'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xce')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcf'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'18',_0xe22ccc)['then'](function(_0x21902c){_0x2da03c=_0x21902c[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa2')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcf'));}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][machine]');}}else{_0x211ef9[_0x0a9e('0xa7')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xa6')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9['dialAnswer']){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xd0'));ut[_0x0a9e('0x50')](_0x0a9e('0xd1')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xc8')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xcd')]||_0x3aedd0[_0x0a9e('0xca')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xb9')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa9')];rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xd2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x556443){_0x2da03c=_0x556443[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa2')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xd3'));}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd3'));}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac[_0x0a9e('0xa6')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut['updateOriginated'](_0xe22ccc,_0x0a9e('0xd4'));logger[_0x0a9e('0x26')](_0x0a9e('0xd5'),_0x211ef9['uniqueid'],_0x0a9e('0xd6'),_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc['originated']);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd7')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd8')]=function(_0x4795ae,_0x3bab3e,_0x1fcfe6){if(_[_0x0a9e('0xd9')](_0x3bab3e)&&'object'!==typeof _0x3bab3e){return;}if(_['isUndefined'](_0x1fcfe6)&&'object'!==typeof _0x1fcfe6){return;}switch(_0x1fcfe6[_0x0a9e('0xda')]){case'0':ut[_0x0a9e('0xdb')](_0x4795ae,0x0,'NoSuchNumber');rpcDb[_0x0a9e('0xdc')](_0x4795ae,_0x0a9e('0xdd'));break;case'3':ut[_0x0a9e('0xdb')](_0x4795ae,0x3,'NoAnswer');rpcDb[_0x0a9e('0xdc')](_0x4795ae,_0x0a9e('0xde'));break;case'5':ut[_0x0a9e('0xdb')](_0x4795ae,0x5,_0x0a9e('0x9d'));rpcDb[_0x0a9e('0xdc')](_0x4795ae,_0x0a9e('0xdf'));break;case'8':ut[_0x0a9e('0xdb')](_0x4795ae,0x8,_0x0a9e('0xb0'));rpcDb[_0x0a9e('0xdc')](_0x4795ae,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x0a9e('0xdb')](_0x4795ae,0x16,'AnswerAGI');rpcDb[_0x0a9e('0xdc')](_0x4795ae,_0x0a9e('0xe0'));break;default:ut[_0x0a9e('0xdb')](_0x4795ae,0xc,_0x1fcfe6[_0x0a9e('0xda')]);rpcDb[_0x0a9e('0xdc')](_0x4795ae,_0x0a9e('0xe1'));}ut['updateOriginated'](_0x3bab3e,_0x0a9e('0xe2'));logger[_0x0a9e('0x26')](_0x0a9e('0xe3'),_0x4795ae[_0x0a9e('0x9a')],'\x20Queue',_0x3bab3e[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x3bab3e[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x4795ae[_0x0a9e('0x9a')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x25931e,_0x3299b7,_0x3539b7){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x25931e,_0x3299b7,_0x3539b7)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xa6')]=function(_0x253f74,_0x2895c5,_0x20ae21){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x253f74,_0x2895c5,_0x20ae21)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview['prototype'][_0x0a9e('0x86')]=function(_0x41e446){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x41e446))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe7')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe8')]=function(_0x5a7dad,_0x251753,_0x446e6,_0x15a9ed,_0x3db98f){var _0x2b624e=this;return new Promise(function(_0x3942fd,_0x5cb48d){if(_[_0x0a9e('0x41')](_0x251753)||_['isNil'](_0x251753['Contact'])||_['isNil'](_0x251753[_0x0a9e('0xe9')])||_[_0x0a9e('0x41')](_0x251753[_0x0a9e('0x48')])){_0x5cb48d(ut[_0x0a9e('0x4b')]('Contact\x20is\x20undefined',_0x15a9ed,_0x3db98f));return;}var _0x4156a5=uuid['v4']();var _0x309fa9=_0x2b624e[_0x0a9e('0x10')][_0x251753[_0x0a9e('0x42')][_0x0a9e('0x29')]];var _0x4b6c21=_0x446e6?_0x2b624e['agents'][_0x446e6]['id']:undefined;_0x2b624e[_0x0a9e('0x13')][_0x4156a5]=new Action(_0x251753,_0x309fa9,_0x4156a5,_0x446e6,_0x4b6c21);var _0x33bcb2=_0x2b624e[_0x0a9e('0x13')][_0x4156a5];_0x33bcb2['unlockAgent']=_0x15a9ed;_0x33bcb2[_0x0a9e('0x83')]=_0x3db98f;_0x33bcb2[_0x0a9e('0xea')]=_0x446e6;if(_[_0x0a9e('0xeb')](_0x5a7dad)){_0x2b624e['execCall'](_0x33bcb2,_0x309fa9,_0x251753,_0x446e6)[_0x0a9e('0x56')](function(_0x2bf85d){logger[_0x0a9e('0x26')]('[Preview][execCall][success]',_0x0a9e('0xec')+_0x33bcb2[_0x0a9e('0x43')]+_0x0a9e('0xed')+_0x33bcb2['idContact'],JSON['stringify'](_0x2bf85d));ami['emit'](_0x0a9e('0xee'),ut[_0x0a9e('0x78')](_0x33bcb2,_0x0a9e('0xef'),_0x2b624e[_0x0a9e('0x10')][_0x33bcb2['queue']]));_0x3942fd(ut[_0x0a9e('0x4b')]('Calling'));})[_0x0a9e('0x5e')](function(_0x2ff2ab){ut[_0x0a9e('0x32')]('[Preview][execCall][failure]',_0x2ff2ab);_0x5cb48d(ut[_0x0a9e('0x4b')](_0x0a9e('0xf0'),_0x15a9ed,_0x3db98f));});}else{_0x309fa9[_0x0a9e('0xf1')]+=0x1;ut['logBlacklist'](_0x33bcb2);rpcDb[_0x0a9e('0xf2')](_0x33bcb2,'[Blacklist][error]');delete _0x2b624e[_0x0a9e('0x13')][_0x4156a5];_0x5cb48d(ut['message'](_0x0a9e('0xf3'),_0x15a9ed,_0x3db98f));}});};Preview['prototype'][_0x0a9e('0x70')]=function(_0x37215d){return!_[_0x0a9e('0x41')](_0x37215d)&&!_[_0x0a9e('0x41')](_0x37215d[_0x0a9e('0x29')])&&!_[_0x0a9e('0x41')](_0x37215d[_0x0a9e('0xf4')])&&_0x37215d['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf5'),_0x37215d[_0x0a9e('0x29')])])&&!_['isNil'](this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf5'),_0x37215d['name'])][_0x0a9e('0xf6')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf5'),_0x37215d[_0x0a9e('0x29')])][_0x0a9e('0xf6')]===_0x0a9e('0xf7')||this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf5'),_0x37215d['name'])][_0x0a9e('0xf6')]==='unmonitored');};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x5b9c76,_0x315e31){return this[_0x0a9e('0xf8')](_0x5b9c76,_0x315e31)[_0x0a9e('0x56')](function(_0x5691ac){return _[_0x0a9e('0x46')](_0x5691ac,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x55a599){if(_0x55a599[_0x0a9e('0xf9')]){rpcDb[_0x0a9e('0xfa')](_0x5b9c76);}if(_0x55a599[_0x0a9e('0xf4')]){rpcDb[_0x0a9e('0x60')](_0x5b9c76);}throw _[_0x0a9e('0x46')](_0x55a599,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')]['execRun']=function(_0x4e1b3,_0x228c10){var _0x38f793=this;var _0x2ce3be,_0x3de77e;return rpcDb[_0x0a9e('0xfb')](_0x4e1b3)[_0x0a9e('0x56')](function(_0x5d6a48){if(!_['isNil'](_0x5d6a48[0x0])){_0x3de77e=_0x5d6a48[0x0][_0x0a9e('0xfc')]?![]:!![];_0x2ce3be=_0x5d6a48[0x0][_0x0a9e('0xfc')]?!![]:![];_0x2ce3be=_0x228c10?!![]:_0x2ce3be;}var _0x1f4929=_0x38f793[_0x0a9e('0xfd')](_0x5d6a48);if(_0x1f4929[_0x0a9e('0xfe')]){rpcDb[_0x0a9e('0xff')](_[_0x0a9e('0x46')](_0x5d6a48[0x0],['VoiceQueueId',_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x2d8e91){_0x38f793[_0x0a9e('0xe8')](_0x2d8e91,_0x5d6a48[0x0],_0x228c10,_0x3de77e,_0x2ce3be)[_0x0a9e('0x56')](function(_0x3c6082){return _0x3c6082;})[_0x0a9e('0x5e')](function(_0x54f0b8){throw _0x54f0b8;});})[_0x0a9e('0x5e')](function(_0x294310){ut[_0x0a9e('0x32')]('[Preview][checkIsBlackList]',_0x294310);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x100'),_0x3de77e,_0x2ce3be);});}else{throw ut[_0x0a9e('0x4b')](_0x1f4929[_0x0a9e('0x4b')],_0x3de77e,_0x2ce3be);}})['catch'](function(_0x38892b){ut[_0x0a9e('0x32')](_0x0a9e('0x101'),_0x38892b);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x100'),![],!![]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfd')]=function(_0x385e5d){if(_['isNil'](_0x385e5d)||_[_0x0a9e('0xeb')](_0x385e5d)||!_[_0x0a9e('0x41')](_0x385e5d[0x0][_0x0a9e('0x5a')])&&_[_0x0a9e('0x41')](_0x385e5d[0x0]['Agent']['name'])){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x385e5d);return{'isValid':![],'message':_0x0a9e('0x103')};}var _0x596ba3=this[_0x0a9e('0x10')][_0x385e5d[0x0][_0x0a9e('0x42')]['name']];_0x596ba3[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x104')];if(_['isNil'](_0x596ba3)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x596ba3);return{'isValid':![],'message':_0x0a9e('0x105')};}if(!this[_0x0a9e('0x70')](_0x596ba3[_0x0a9e('0x106')])){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x0a9e('0x108')+_0x596ba3['name']+_0x0a9e('0x109'));if(!this[_0x0a9e('0x70')](_0x596ba3[_0x0a9e('0x10a')])){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x596ba3[_0x0a9e('0x29')]+_0x0a9e('0x10b'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x596ba3[_0x0a9e('0x3c')])){ut['logger'](_0x0a9e('0x10c'),_0x596ba3[_0x0a9e('0x29')]+_0x0a9e('0x10d'));return{'isValid':![],'message':_0x0a9e('0x108')+_0x596ba3[_0x0a9e('0x29')]+_0x0a9e('0x10d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x50e32a,_0x504403,_0x593f9e,_0x38dceb){var _0x5dc978=this;return new Promise(function(_0x550cbf,_0x26223f){var _0x4a7a3c=_0x50e32a[_0x0a9e('0x9a')];var _0x142e53=_0x5dc978[_0x0a9e('0x70')](_0x504403['Trunk'])?util[_0x0a9e('0x27')](_0x0a9e('0x10e'),_0x504403[_0x0a9e('0x106')]['name'],_['isNil'](_0x504403[_0x0a9e('0x10f')])?'':_0x504403[_0x0a9e('0x10f')][_0x0a9e('0x110')]()||'',_0x504403[_0x0a9e('0x111')]>0x0?_0x593f9e[_0x0a9e('0xe9')][_0x0a9e('0x112')](_0x504403[_0x0a9e('0x111')]):_0x593f9e[_0x0a9e('0xe9')]):util[_0x0a9e('0x27')](_0x0a9e('0x10e'),_['isNil'](_0x504403['TrunkBackup'])?_0x504403['Trunk'][_0x0a9e('0x29')]:_0x504403[_0x0a9e('0x10a')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x504403[_0x0a9e('0x10f')])?'':_0x504403[_0x0a9e('0x10f')][_0x0a9e('0x110')]()||'',_0x504403[_0x0a9e('0x111')]>0x0?_0x593f9e['phone']['substring'](_0x504403[_0x0a9e('0x111')]):_0x593f9e[_0x0a9e('0xe9')]);var _0x51be40=_0x5dc978[_0x0a9e('0x70')](_0x504403[_0x0a9e('0x106')])?ut[_0x0a9e('0x113')](_0x504403[_0x0a9e('0x106')][_0x0a9e('0x114')],_0x504403[_0x0a9e('0x115')],_0x504403[_0x0a9e('0x116')]>0x0?ut[_0x0a9e('0x117')](_0x504403[_0x0a9e('0x118')],_0x504403[_0x0a9e('0x116')]):_0x504403[_0x0a9e('0x118')]):ut[_0x0a9e('0x113')](_['isNil'](_0x504403[_0x0a9e('0x10a')])?_0x504403[_0x0a9e('0x106')][_0x0a9e('0x114')]:_0x504403[_0x0a9e('0x10a')][_0x0a9e('0x114')],_0x504403[_0x0a9e('0x115')],_0x504403[_0x0a9e('0x116')]>0x0?ut[_0x0a9e('0x117')](_0x504403[_0x0a9e('0x118')],_0x504403[_0x0a9e('0x116')]):_0x504403[_0x0a9e('0x118')]);if(_0x51be40){_0x50e32a[_0x0a9e('0x119')]=ut['extractCalleridName'](_0x51be40);_0x50e32a['originatecalleridnum']=ut[_0x0a9e('0x11a')](_0x51be40);}var _0x401207=ut[_0x0a9e('0x11b')](_0x504403,_0x593f9e,_0x142e53,_0x51be40,_0x4a7a3c,_0x50e32a);_[_0x0a9e('0x11c')](_0x50e32a,ut[_0x0a9e('0x11d')](_0x401207));_0x50e32a[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x504403[_0x0a9e('0x11e')]=_0x401207;var _0x49fd0e=ut[_0x0a9e('0x11f')](_0x50e32a,_0x504403,_0x401207,_0x50e32a[_0x0a9e('0x83')],_0x38dceb);return ami[_0x0a9e('0x120')](_0x49fd0e)[_0x0a9e('0x56')](function(_0x2dd93c){_0x504403[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x121'),_0x4a7a3c,_0x0a9e('0xd6'),_0x504403[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x504403[_0x0a9e('0x2d')]);_0x550cbf(_0x2dd93c);})[_0x0a9e('0x5e')](function(_0x3f7cb6){ut[_0x0a9e('0xdb')](_0x50e32a,0xe,_0x0a9e('0x122'));rpcDb['createAgentHistory'](_0x50e32a,'[originateFailure][logOriginateFailure]');_0x26223f(_0x3f7cb6);});});};Preview[_0x0a9e('0xd')][_0x0a9e('0x1d')]=function(_0x52b365){if(this['actions'][_0x52b365[_0x0a9e('0x84')]]){this[_0x0a9e('0x13')][_0x52b365[_0x0a9e('0x84')]]['channel']=_0x52b365[_0x0a9e('0x4a')];}};Preview['prototype'][_0x0a9e('0x17')]=function(_0x4bf1e3){var _0x22d31f=this;var _0x5e9c92=this[_0x0a9e('0x13')][_0x4bf1e3[_0x0a9e('0x123')]];if(_0x5e9c92){if(_0x5e9c92[_0x0a9e('0xea')]&&this['agents'][_0x5e9c92[_0x0a9e('0xea')]]){ut['logLookAgent'](_0x5e9c92,this['agents'][_0x5e9c92[_0x0a9e('0xea')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x5e9c92[_0x0a9e('0xea')]]['id']);}var _0x1d51fd=_[_0x0a9e('0x124')](_0x5e9c92);_0x1d51fd[_0x0a9e('0x125')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x151f16=_0x22d31f[_0x0a9e('0x10')][_0x5e9c92[_0x0a9e('0x43')]];if(ut[_0x0a9e('0x126')](_0x4bf1e3[_0x0a9e('0x127')])){if(_0x5e9c92[_0x0a9e('0xbf')]){rpcDb[_0x0a9e('0xfa')](_0x5e9c92[_0x0a9e('0x85')]);}if(_0x5e9c92[_0x0a9e('0x83')]){rpcDb[_0x0a9e('0x60')](_0x5e9c92['idContact']);}ami[_0x0a9e('0x25')](_0x0a9e('0x128'),ut[_0x0a9e('0x78')](_0x5e9c92,_0x0a9e('0x129'),this['campaignsPreview'][_0x5e9c92['queue']]));this['callProgressDetectingAgent'](_0x1d51fd,_0x151f16,_0x4bf1e3);}else{_0x5e9c92[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));ut[_0x0a9e('0xdb')](_0x1d51fd,0x4,_0x0a9e('0x94'));rpcDb[_0x0a9e('0xdc')](_0x1d51fd,_0x0a9e('0x12a'));}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1a')]=function(_0x1cc73e){var _0x2154d8=this[_0x0a9e('0x13')][_0x1cc73e['linkedid']];var _0x283c59;if(_0x2154d8){_0x283c59=this['campaignsPreview'][_0x2154d8[_0x0a9e('0x43')]];logger['info'](_0x0a9e('0x12b'),_0x1cc73e[_0x0a9e('0x84')],_0x0a9e('0xd6'),_0x283c59['name'],_0x0a9e('0x8a'),_0x283c59[_0x0a9e('0x2e')]);}if(this['actions'][_0x1cc73e['linkedid']]&&_0x1cc73e[_0x0a9e('0x84')]!==_0x1cc73e[_0x0a9e('0x9a')]){if(_0x1cc73e[_0x0a9e('0x12c')]==='16'&&this['actions'][_0x1cc73e['linkedid']]['dialAnswer']){this[_0x0a9e('0x72')](_0x1cc73e,_0x1cc73e[_0x0a9e('0x84')],_0x1cc73e[_0x0a9e('0x12c')]);}else if(this[_0x0a9e('0x13')][_0x1cc73e[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x12d'),_0x1cc73e[_0x0a9e('0x84')],_0x1cc73e[_0x0a9e('0x12c')],_0x0a9e('0xd6'),_0x283c59[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x283c59[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x1cc73e,_0x1cc73e[_0x0a9e('0x84')],_0x1cc73e[_0x0a9e('0x12c')]);}}else if(_0x2154d8&&_[_0x0a9e('0x41')](_0x2154d8['statedesc'])&&_0x283c59[_0x0a9e('0x12e')]&&_0x1cc73e[_0x0a9e('0x84')]===_0x1cc73e[_0x0a9e('0x9a')]&&_[_0x0a9e('0x41')](_0x1cc73e[_0x0a9e('0xda')])&&_0x1cc73e[_0x0a9e('0x12c')]==='16'&&_0x1cc73e['channelstate']==='6'&&_[_0x0a9e('0xd9')](_0x2154d8[_0x0a9e('0x12f')])){if(_0x2154d8[_0x0a9e('0xbf')]){rpcDb[_0x0a9e('0xfa')](_0x2154d8[_0x0a9e('0x85')]);}if(_0x2154d8[_0x0a9e('0x83')]){rpcDb[_0x0a9e('0x60')](_0x2154d8[_0x0a9e('0x85')]);}_0x1cc73e[_0x0a9e('0xda')]='22';this['callProgressDetectingAgent'](_0x2154d8,_0x283c59,_0x1cc73e);}else if(_0x2154d8&&_0x2154d8['transfer']){if(_0x1cc73e[_0x0a9e('0x12c')]==='16'&&this[_0x0a9e('0x13')][_0x1cc73e['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][transfer]',_0x1cc73e[_0x0a9e('0x84')],_0x1cc73e['cause'],_0x0a9e('0xd6'),_0x283c59[_0x0a9e('0x29')],'pTalking:\x20',_0x283c59[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x1cc73e,_0x1cc73e['linkedid'],_0x1cc73e[_0x0a9e('0x12c')]);}else if(this[_0x0a9e('0x13')][_0x1cc73e['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x12d'),_0x1cc73e[_0x0a9e('0x84')],_0x1cc73e[_0x0a9e('0x12c')],_0x0a9e('0xd6'),_0x283c59['name'],_0x0a9e('0x8a'),_0x283c59[_0x0a9e('0x2e')]);this['callProgressDetectingCustomer'](_0x1cc73e,_0x1cc73e[_0x0a9e('0x84')],_0x1cc73e[_0x0a9e('0x12c')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1c')]=function(_0x3fae71){if(this[_0x0a9e('0x13')][_0x3fae71[_0x0a9e('0xd7')]]&&_0x3fae71['destlinkedid']!==_0x3fae71['destuniqueid']){this['callProgressDetectingCustomer'](_0x3fae71,_0x3fae71['destlinkedid'],_0x3fae71['dialstatus']);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x130')]=function(_0x556344){if(this['actions'][_0x556344[_0x0a9e('0x84')]]&&_0x556344['linkedid']!==_0x556344[_0x0a9e('0x9a')]&&!this[_0x0a9e('0x13')][_0x556344[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){if(_0x556344[_0x0a9e('0x12c')]==='1'){this[_0x0a9e('0x72')](_0x556344,_0x556344['linkedid'],_0x556344[_0x0a9e('0x12c')]);}}};Preview[_0x0a9e('0xd')]['addVariable']=function(_0x44cdb8,_0x1c0d54,_0x2e0e9b){if(this[_0x0a9e('0x13')][_0x44cdb8]){if(_[_0x0a9e('0x41')](this[_0x0a9e('0x13')][_0x44cdb8][_0x0a9e('0x11e')])){this['actions'][_0x44cdb8][_0x0a9e('0x11e')]={};}this['actions'][_0x44cdb8][_0x0a9e('0x11e')][_0x1c0d54]=_0x2e0e9b;}};Preview[_0x0a9e('0xd')]['syncVarSet']=function(_0x28b7de){try{if(!_[_0x0a9e('0x41')](_0x28b7de)){if(ut['filterKey'](_[_0x0a9e('0x131')](_0x28b7de['variable'])[0x0])){this[_0x0a9e('0x132')](_0x28b7de[_0x0a9e('0x9a')],_['keys'](_0x28b7de[_0x0a9e('0x133')])[0x0],_0x28b7de['value']);}}}catch(_0x1d046c){logger[_0x0a9e('0x134')](_0x0a9e('0x135'),util[_0x0a9e('0x136')](_0x1d046c,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0xa45906){if(_0xa45906){if(this['actions'][_0xa45906[_0x0a9e('0x137')]]){this[_0x0a9e('0x13')][_0xa45906[_0x0a9e('0x137')]][_0x0a9e('0x12f')]=!![];}}};Preview[_0x0a9e('0xd')]['syncBlindTransfer']=function(_0xb376ed){if(_0xb376ed){if(this['actions'][_0xb376ed['transfererlinkedid']]){this[_0x0a9e('0x13')][_0xb376ed['transfererlinkedid']][_0x0a9e('0x12f')]=!![];}}};module[_0x0a9e('0x138')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3e8ca22..52fb279 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 _0xe686=['moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperBlack','error','createHistory','catch','[createHistory]\x20','resolve','then'];(function(_0x215f2e,_0x4ea997){var _0x136655=function(_0x188b53){while(--_0x188b53){_0x215f2e['push'](_0x215f2e['shift']());}};_0x136655(++_0x4ea997);}(_0xe686,0xf9));var _0x6e68=function(_0x162a77,_0x1866aa){_0x162a77=_0x162a77-0x0;var _0x1ea0b1=_0xe686[_0x162a77];return _0x1ea0b1;};'use strict';var util=require(_0x6e68('0x0'));var BPromise=require(_0x6e68('0x1'));var logger=require(_0x6e68('0x2'))(_0x6e68('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6e68('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x562c38){return function(_0x3ff71c){logger[_0x6e68('0x5')](_0x562c38,util['inspect'](_0x3ff71c,{'showHidden':![],'depth':null}));};}function create(_0x1c9ad1){return cmHopperHistory[_0x6e68('0x6')](_0x1c9ad1)[_0x6e68('0x7')](loggerCatch(_0x6e68('0x8')));}function createAgent(_0x31f6e4){return BPromise[_0x6e68('0x9')]()[_0x6e68('0xa')](agentReportPreview[_0x6e68('0x6')](_0x31f6e4))[_0x6e68('0x7')](loggerCatch(_0x6e68('0x8')));}function moveContact(_0x485af3){return cmHopper[_0x6e68('0xb')](_0x485af3,!![])[_0x6e68('0x7')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x6e68('0xc')]=function(_0x6743bb){return cmHopperBlack[_0x6e68('0xc')](_0x6743bb)[_0x6e68('0x7')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6e68('0xd')]=function(_0x2e0cea){return BPromise[_0x6e68('0x9')]()[_0x6e68('0xa')](cmHopper[_0x6e68('0xd')](_0x2e0cea))[_0x6e68('0x7')](loggerCatch(_0x6e68('0xe')));};exports[_0x6e68('0x6')]=function(_0x5c4dc0,_0x16d390){create(_0x5c4dc0)[_0x6e68('0x7')](loggerCatch(_0x16d390));moveContact(_0x5c4dc0)[_0x6e68('0x7')](loggerCatch(_0x16d390));};exports[_0x6e68('0xf')]=function(_0x25b3bd,_0x152f43){createAgent(_0x25b3bd)['catch'](loggerCatch(_0x152f43));};exports[_0x6e68('0x10')]=function(_0x10be2a,_0x35de08){create(_0x10be2a)['catch'](loggerCatch(_0x35de08));};exports[_0x6e68('0x11')]=function(_0x4e676c,_0x2b38b3){moveContact(_0x4e676c)[_0x6e68('0x7')](loggerCatch(_0x2b38b3));};exports[_0x6e68('0x12')]=function(_0x501da8,_0x5e2acc,_0x392bc0){if(_0x5e2acc){_0x501da8[_0x6e68('0x13')]=null;}if(_0x392bc0){_0x501da8['active']=![];}return cmHopper['rescheduleContact'](_0x501da8)[_0x6e68('0x7')](loggerCatch(_0x6e68('0x14')));};exports['countReScheduled']=function(_0x4e9c0f){return cmHopper[_0x6e68('0x15')](_0x4e9c0f)[_0x6e68('0x7')](loggerCatch(_0x6e68('0x16')));};exports['unlockContact']=function(_0x338bff){return cmHopper[_0x6e68('0x17')]({'UserId':null},_0x338bff,0x1)[_0x6e68('0x7')](loggerCatch('[unlockContact]\x20'));};exports[_0x6e68('0x18')]=function(_0x243a42){return cmHopper[_0x6e68('0x17')]({'active':![]},_0x243a42,0x1)[_0x6e68('0x7')](loggerCatch(_0x6e68('0x19')));};exports[_0x6e68('0x1a')]=function(_0x3596ff){var _0x3ba0c6={};_0x3ba0c6[_0x6e68('0x1b')]=_0x3596ff[_0x6e68('0x1b')];_0x3ba0c6['uniqueid']=_0x3596ff[_0x6e68('0x1c')];_0x3ba0c6[_0x6e68('0x1d')]=_0x3596ff[_0x6e68('0x1d')];_0x3ba0c6[_0x6e68('0x1e')]=_0x3596ff[_0x6e68('0x1e')];_0x3ba0c6[_0x6e68('0x1f')]=_0x3596ff[_0x6e68('0x1f')];_0x3ba0c6[_0x6e68('0x20')]=_0x3596ff[_0x6e68('0x21')];_0x3ba0c6[_0x6e68('0x22')]=_0x3596ff[_0x6e68('0x21')];_0x3ba0c6[_0x6e68('0x23')]=0x1;_0x3ba0c6[_0x6e68('0x24')]=_0x3596ff['endtime'];_0x3ba0c6[_0x6e68('0x25')]=_0x3596ff[_0x6e68('0x26')];_0x3ba0c6[_0x6e68('0x27')]=_0x6e68('0x28');_0x3ba0c6[_0x6e68('0x29')]=_0x6e68('0x2a');_0x3ba0c6[_0x6e68('0x2b')]=0x0;_0x3ba0c6['assigned']=0x1;_0x3ba0c6[_0x6e68('0x2c')]=_0x3596ff['membername'];_0x3ba0c6[_0x6e68('0x2d')]=_0x6e68('0x2e');return BPromise['resolve']()['then'](voiceQueueReport[_0x6e68('0x2f')](_0x3ba0c6))[_0x6e68('0x7')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x6e68('0x30')]=function(_0x2f1066,_0x499631){return BPromise[_0x6e68('0x9')]()[_0x6e68('0xa')](cmHopper['getContactRecallMe'](_0x2f1066,_0x499631))[_0x6e68('0x7')](loggerCatch(_0x6e68('0x31')));};exports[_0x6e68('0x32')]=function(_0x85f773){return cmHopper[_0x6e68('0x12')](_0x85f773,!![],!![])[_0x6e68('0x7')](loggerCatch(_0x6e68('0x33')));}; \ No newline at end of file +var _0x1f2d=['calleridnum','calleridname','queue','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','[createHistory]\x20','resolve','then','createHistory','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0x1f2d,0x1d5));var _0xd1f2=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0x1f2d[_0x134448];return _0x2d52a1;};'use strict';var util=require('util');var BPromise=require(_0xd1f2('0x0'));var logger=require(_0xd1f2('0x1'))(_0xd1f2('0x2'));var cmHopper=require(_0xd1f2('0x3'));var cmHopperHistory=require(_0xd1f2('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xd1f2('0x5'));var voiceQueueReport=require(_0xd1f2('0x6'));function loggerCatch(_0x476fac){return function(_0x48665d){logger['error'](_0x476fac,util[_0xd1f2('0x7')](_0x48665d,{'showHidden':![],'depth':null}));};}function create(_0x2044ae){return cmHopperHistory['createHistory'](_0x2044ae)['catch'](loggerCatch(_0xd1f2('0x8')));}function createAgent(_0x29e588){return BPromise[_0xd1f2('0x9')]()[_0xd1f2('0xa')](agentReportPreview[_0xd1f2('0xb')](_0x29e588))['catch'](loggerCatch(_0xd1f2('0x8')));}function moveContact(_0x1db999){return cmHopper['moveContactManagedDialer'](_0x1db999,!![])[_0xd1f2('0xc')](loggerCatch(_0xd1f2('0xd')));}exports[_0xd1f2('0xe')]=function(_0x2e61c8){return cmHopperBlack[_0xd1f2('0xe')](_0x2e61c8)[_0xd1f2('0xc')](loggerCatch(_0xd1f2('0xf')));};exports[_0xd1f2('0x10')]=function(_0x24eb41){return BPromise[_0xd1f2('0x9')]()[_0xd1f2('0xa')](cmHopper[_0xd1f2('0x10')](_0x24eb41))[_0xd1f2('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0xd1f2('0xb')]=function(_0x790ec0,_0x572362){create(_0x790ec0)[_0xd1f2('0xc')](loggerCatch(_0x572362));moveContact(_0x790ec0)[_0xd1f2('0xc')](loggerCatch(_0x572362));};exports[_0xd1f2('0x11')]=function(_0x4e8999,_0x8a09ef){createAgent(_0x4e8999)[_0xd1f2('0xc')](loggerCatch(_0x8a09ef));};exports[_0xd1f2('0x12')]=function(_0x4033d7,_0x58435a){create(_0x4033d7)[_0xd1f2('0xc')](loggerCatch(_0x58435a));};exports[_0xd1f2('0x13')]=function(_0xc378cc,_0x52bfe2){moveContact(_0xc378cc)['catch'](loggerCatch(_0x52bfe2));};exports[_0xd1f2('0x14')]=function(_0x534ee1,_0x25b539,_0x50084a){if(_0x25b539){_0x534ee1[_0xd1f2('0x15')]=null;}if(_0x50084a){_0x534ee1[_0xd1f2('0x16')]=![];}return cmHopper[_0xd1f2('0x14')](_0x534ee1)[_0xd1f2('0xc')](loggerCatch(_0xd1f2('0x17')));};exports[_0xd1f2('0x18')]=function(_0x551987){return cmHopper[_0xd1f2('0x18')](_0x551987)[_0xd1f2('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0xd1f2('0x19')]=function(_0x1d5f0d){return cmHopper[_0xd1f2('0x19')]({'UserId':null},_0x1d5f0d,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xd1f2('0x1a')]=function(_0x471f65){return cmHopper[_0xd1f2('0x19')]({'active':![]},_0x471f65,0x1)['catch'](loggerCatch(_0xd1f2('0x1b')));};exports[_0xd1f2('0x1c')]=function(_0x523810){var _0x1f7aba={};_0x1f7aba[_0xd1f2('0x1d')]=_0x523810[_0xd1f2('0x1d')];_0x1f7aba['uniqueid']=_0x523810[_0xd1f2('0x1e')];_0x1f7aba[_0xd1f2('0x1f')]=_0x523810[_0xd1f2('0x1f')];_0x1f7aba[_0xd1f2('0x20')]=_0x523810['calleridname'];_0x1f7aba[_0xd1f2('0x21')]=_0x523810['queue'];_0x1f7aba['queuecallerjoinAt']=_0x523810['answertime'];_0x1f7aba[_0xd1f2('0x22')]=_0x523810['answertime'];_0x1f7aba[_0xd1f2('0x23')]=0x1;_0x1f7aba['queuecallercompleteAt']=_0x523810[_0xd1f2('0x24')];_0x1f7aba[_0xd1f2('0x25')]=_0x523810[_0xd1f2('0x26')];_0x1f7aba['context']=_0xd1f2('0x27');_0x1f7aba['exten']=_0xd1f2('0x28');_0x1f7aba[_0xd1f2('0x29')]=0x0;_0x1f7aba[_0xd1f2('0x2a')]=0x1;_0x1f7aba[_0xd1f2('0x2b')]=_0x523810['membername'];_0x1f7aba[_0xd1f2('0x2c')]=_0xd1f2('0x2d');return BPromise[_0xd1f2('0x9')]()['then'](voiceQueueReport[_0xd1f2('0x2e')](_0x1f7aba))[_0xd1f2('0xc')](loggerCatch(_0xd1f2('0x2f')));};exports[_0xd1f2('0x30')]=function(_0x24e0d5,_0x45e224){return BPromise[_0xd1f2('0x9')]()[_0xd1f2('0xa')](cmHopper['getContactRecallMe'](_0x24e0d5,_0x45e224))[_0xd1f2('0xc')](loggerCatch(_0xd1f2('0x31')));};exports['rescheduleContactInQueue']=function(_0x8fd908){return cmHopper[_0xd1f2('0x14')](_0x8fd908,!![],!![])[_0xd1f2('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 7f47e49..dd59592 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 _0xf71f=['interface','voice','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','not_inuse','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','membername','countnoanswerretry','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','logger2','message','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','starttime','endtime','logAgent','state','responsetime','ringtime','logLookAgent','UserId','logCustomer','getSeconds','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','statedesc','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','lastevent'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0xf71f,0x1ec));var _0xff71=function(_0x4b3474,_0x59eab4){_0x4b3474=_0x4b3474-0x0;var _0x55bc48=_0xf71f[_0x4b3474];return _0x55bc48;};'use strict';var util=require(_0xff71('0x0'));var _=require(_0xff71('0x1'));var moment=require(_0xff71('0x2'));var logger=require(_0xff71('0x3'))(_0xff71('0x4'));var ipAgi=process[_0xff71('0x5')][_0xff71('0x6')]||_0xff71('0x7');var utils=require('../../dialer/utils');exports[_0xff71('0x8')]=function(_0x4c8467){return function(_0x3ba731){logger[_0xff71('0x9')](_0x4c8467,util[_0xff71('0xa')](_0x3ba731,{'showHidden':![],'depth':null}));};};exports[_0xff71('0xb')]=function(_0x5b6401,_0x5e8f6d){logger['info'](_0x5b6401,util[_0xff71('0xa')](_0x5e8f6d,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x570cf2,_0x5cf82a){logger[_0xff71('0x9')](_0x570cf2,util[_0xff71('0xa')](_0x5cf82a,{'showHidden':![],'depth':null}));};exports[_0xff71('0xc')]=function(_0x3f5e6a){return function(_0x1c1a02){logger['info'](_0x3f5e6a,util[_0xff71('0xa')](_0x1c1a02,{'showHidden':![],'depth':null}));};};exports[_0xff71('0xd')]=function(_0x218fd7,_0x54d73c,_0x5957c1){return{'message':_0x218fd7,'unlock':_0x54d73c,'active':_0x5957c1};};exports[_0xff71('0xe')]=function(_0x2e456e,_0xc58786,_0x39ba8e){if(!_['isUndefined'](_0x39ba8e)&&'string'===typeof _0x39ba8e&&!_[_0xff71('0xf')](_0x39ba8e)){if(!_[_0xff71('0x10')](_0xc58786)&&_0xff71('0x11')===typeof _0xc58786&&!_[_0xff71('0xf')](_0xc58786)){return util[_0xff71('0x12')]('\x22%s\x22\x20<%s>',_0xc58786,_0x39ba8e);}return util[_0xff71('0x12')](_0xff71('0x13'),_0x39ba8e,_0x39ba8e);}if(!_[_0xff71('0x10')](_0x2e456e)&&'string'===typeof _0x2e456e&&!_[_0xff71('0xf')](_0x2e456e)){return _0x2e456e;}return _0xff71('0x14');};exports[_0xff71('0x15')]=function(_0x33e519){if(_[_0xff71('0x16')](_0x33e519)){return![];}return _0x33e519;};exports[_0xff71('0x17')]=function(_0x29c905,_0x2a6aa6,_0x1e2c4f,_0x6373ee,_0x519b95,_0x1fc3c6){var _0x46508e={'XMD-QUEUE':_0x2a6aa6[_0xff71('0x18')]?_0x2a6aa6[_0xff71('0x18')][_0xff71('0x19')]:'','XMD-CALLERID':_0x6373ee,'XMD-CALLERID-PREVIEW':_0x1fc3c6?util[_0xff71('0x12')](_0xff71('0x13'),_0x1fc3c6[_0xff71('0x1a')],_0x1fc3c6['calleridnum']):_0x6373ee,'XMD-DIALID':_0x519b95,'XMD-CONTACTID':_0x2a6aa6[_0xff71('0x1b')],'XMD-CDRTYPE':_0xff71('0x1c'),'CALLERID(all)':_0x6373ee,'XMD-VOICEQUEUEID':_0x2a6aa6[_0xff71('0x1d')],'XMD-DIALCHANNEL':_0x1e2c4f,'XMD-DIALTIMEOUT':_0x29c905[_0xff71('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xff71('0x12')]('\x22rtTxX%s%s\x22',_0x29c905['dialQueueProject2']?'g':'',_['isEmpty'](_0x29c905[_0xff71('0x1f')])?'':_0xff71('0x20')),'XMD-DIALURL':_0x29c905['dialPreviewUrl']||'','XMD-AGI':_0x29c905[_0xff71('0x21')]?util[_0xff71('0x12')](_0xff71('0x22'),ipAgi,_0x29c905[_0xff71('0x21')]):_0xff71('0x23'),'XMD-AGIAFTER':_0x29c905[_0xff71('0x24')]?util[_0xff71('0x12')](_0xff71('0x22'),ipAgi,_0x29c905['dialQueueProject2']):_0xff71('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x1fc3c6?_0x1fc3c6[_0xff71('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x1fc3c6?_0x1fc3c6['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x29c905[_0xff71('0x1f')])){_0x46508e[util[_0xff71('0x12')]('%s',_0xff71('0x26'))]=_0x29c905['monitor_format'];_0x46508e[util['format']('%s',_0xff71('0x27'))]=_0x519b95;}if(_0x2a6aa6&&_0x2a6aa6[_0xff71('0x28')]){for(var _0x1b93a0 in _0x2a6aa6[_0xff71('0x28')]){if(_0x2a6aa6[_0xff71('0x28')]['hasOwnProperty'](_0x1b93a0)){if(!_[_0xff71('0x16')](_0x2a6aa6[_0xff71('0x28')][_0x1b93a0])&&_0x1b93a0!=='id'&&_0x1b93a0!==_0xff71('0x29')&&_0x1b93a0!=='createdAt'&&_0x1b93a0!=='updatedAt'){_0x46508e[util['format']('%s%s',_0xff71('0x2a'),_[_0xff71('0x2b')](_0x1b93a0))]=_0x2a6aa6[_0xff71('0x28')][_0x1b93a0];}}}}return _0x46508e;};exports[_0xff71('0x2c')]=function(_0x1fe4dd){var _0x13eea3={};for(var _0x3fb792 in _0x1fe4dd){if(_0x1fe4dd['hasOwnProperty'](_0x3fb792)){_0x13eea3[util[_0xff71('0x12')]('%s',_[_0xff71('0x2d')](_0x3fb792))]=_0x1fe4dd[_0x3fb792];}}return{'variables':_0x13eea3};};exports[_0xff71('0x2e')]=function(_0x2ff250,_0x5809b7){if(!_[_0xff71('0x16')](_0x2ff250)){if(_0x2ff250[_0xff71('0x2f')](_0xff71('0x30'))){if(_0x2ff250['originated']>0x0){_0x2ff250[_0xff71('0x30')]-=0x1;}else{logger['error'](_0xff71('0x31'),_0x5809b7);}}}else{logger[_0xff71('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5809b7);}};exports[_0xff71('0x32')]=function(_0x50941d){var _0x59f389=moment()['format'](_0xff71('0x33'));_0x50941d['state']=0xd;_0x50941d['statedesc']='Blacklist';_0x50941d[_0xff71('0x34')]=_0x59f389;_0x50941d['responsetime']=_0x59f389;_0x50941d[_0xff71('0x35')]=_0x59f389;};exports[_0xff71('0x36')]=function(_0x29201d,_0x46d029,_0x863c3){var _0x46cd7f=moment()[_0xff71('0x12')](_0xff71('0x33'));_0x29201d[_0xff71('0x37')]=_0x46d029;_0x29201d['statedesc']=_0x863c3;_0x29201d[_0xff71('0x38')]=_0x46cd7f;_0x29201d[_0xff71('0x39')]=utils['getSeconds'](_0x29201d[_0xff71('0x38')],_0x29201d[_0xff71('0x34')]);};exports[_0xff71('0x3a')]=function(_0xa2da74,_0x59085e,_0x4dc7ee){_0xa2da74['membername']=_0x59085e;_0xa2da74[_0xff71('0x3b')]=_0x4dc7ee;};exports[_0xff71('0x3c')]=function(_0x3eac20,_0x40b70d,_0x1e5a7e){var _0x2bbbf5=moment()[_0xff71('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x3eac20[_0xff71('0x37')]=_0x40b70d;_0x3eac20['statedesc']=_0x1e5a7e;_0x3eac20[_0xff71('0x38')]=_0x3eac20[_0xff71('0x38')]?_0x3eac20[_0xff71('0x38')]:_0x2bbbf5;_0x3eac20[_0xff71('0x35')]=_0x3eac20['endtime']?_0x3eac20[_0xff71('0x35')]:_0x2bbbf5;_0x3eac20[_0xff71('0x39')]=utils[_0xff71('0x3d')](_0x3eac20[_0xff71('0x38')]||0x0,_0x3eac20[_0xff71('0x34')]||0x0);_0x3eac20[_0xff71('0x3e')]=_0x3eac20[_0xff71('0x3f')]?utils[_0xff71('0x3d')](_0x3eac20[_0xff71('0x35')],_0x3eac20[_0xff71('0x3f')]):0x0;};exports[_0xff71('0x40')]=function(_0x2ed9a9){return _0x2ed9a9==='Failure';};exports['variablesAction']=function(_0x155d40,_0x3cb3e7,_0x465368,_0x3c2077,_0x4d0a5c){var _0x233ba8=_0x3c2077?_0xff71('0x41'):_0x155d40[_0xff71('0x1a')];_0x233ba8=_0x4d0a5c?_0xff71('0x42'):_0x233ba8;return{'actionid':_0x155d40[_0xff71('0x43')],'action':_0xff71('0x44'),'channel':_0x155d40[_0xff71('0x45')],'callerid':util[_0xff71('0x12')](_0xff71('0x13'),_0x233ba8,_0x155d40[_0xff71('0x46')]),'Exten':_0xff71('0x47'),'Context':_0xff71('0x48'),'Priority':'1','variable':_0x465368,'timeout':(_0x3cb3e7['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x155d40[_0xff71('0x43')]};};exports[_0xff71('0x49')]=function(_0x31aab0){return _0x31aab0[_0xff71('0x4a')]+_0x31aab0[_0xff71('0x4b')]+_0x31aab0['countnoanswerretry']+_0x31aab0[_0xff71('0x4c')]+_0x31aab0[_0xff71('0x4d')];};exports['cloneAction']=function(_0xc76039){var _0x34313a=_['clone'](_0xc76039);_0x34313a[_0xff71('0x37')]=0xf;_0x34313a[_0xff71('0x4e')]='Global';return _0x34313a;};exports[_0xff71('0x4f')]=function(_0x157d28,_0xa7d742,_0x350bd0){var _0x52c3de={};_0x52c3de[_0xa7d742]=_0x157d28[_0xa7d742];_0x52c3de[_0xff71('0x50')]=![];_0x52c3de[_0xff71('0x51')]=moment()[_0xff71('0x52')](_0x350bd0,_0xff71('0x53'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x52c3de['ContactId']=_0x157d28[_0xff71('0x1b')];_0x52c3de['ListId']=_0x157d28[_0xff71('0x54')];_0x52c3de[_0xff71('0x1d')]=_0x157d28[_0xff71('0x1d')]||undefined;return _0x52c3de;};exports[_0xff71('0x55')]=function(_0x15ca53,_0x398470){if(!_['isNil'](_0x15ca53)){if(_0x15ca53[_0xff71('0x56')]>0x0){_0x15ca53[_0xff71('0x56')]-=0x1;}else{logger[_0xff71('0x9')](_0x398470,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xff71('0x9')](_0x398470,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x2e38b4){if(_0x2e38b4<=0x0){return!![];}return![];};function buildObj(_0x1094dd,_0x3ac18b,_0x397137){_0x1094dd[_0xff71('0x57')]=_0x3ac18b;_0x1094dd[_0xff71('0x19')]=_0x1094dd['queue'];_0x1094dd[_0xff71('0x58')]=_0x1094dd['channelAgent'];_0x1094dd['motionChannel']=_0xff71('0x59');if(_0x397137){_0x1094dd[_0xff71('0x5a')]=_0x397137[_0xff71('0x5a')];}return _0x1094dd;}exports[_0xff71('0x5b')]=buildObj;exports[_0xff71('0x5c')]=function(_0x1bdc58){var _0x1fa8e5={};_0x1fa8e5[_0xff71('0x5d')]=_0x1bdc58[_0xff71('0x5d')];_0x1fa8e5[_0xff71('0x58')]=_0x1bdc58[_0xff71('0x45')];_0x1fa8e5['uniqueid']=_0x1bdc58['uniqueid'];return _0x1fa8e5;};exports[_0xff71('0x5e')]=function(_0x5394a6){var _0x229cfb=[];for(var _0x384bc1 in _0x5394a6){if(_0x5394a6[_0xff71('0x2f')](_0x384bc1)){if(!_[_0xff71('0x16')](_0x5394a6[_0x384bc1])&&_0x5394a6[_0x384bc1][_0xff71('0x37')]===_0xff71('0x5f')&&_0x5394a6[_0x384bc1]['status']===_0xff71('0x60')){_0x229cfb[_0xff71('0x61')](_0x5394a6[_0x384bc1]['id']);}}}return _0x229cfb;};exports[_0xff71('0x62')]=function(_0x3c1520){var _0x1ecaf1=moment()[_0xff71('0x63')](0x0);var _0x29cae1=moment(_0x3c1520)['milliseconds'](0x0);return _0x1ecaf1[_0xff71('0x64')](_0x29cae1,_0xff71('0x65'));};exports[_0xff71('0x66')]=function(_0x377ab7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x377ab7['ContactId'],'ListId':_0x377ab7['ListId'],'VoiceQueueId':_0x377ab7[_0xff71('0x1d')]||undefined,'CampaignId':_0x377ab7[_0xff71('0x67')]||undefined};};exports[_0xff71('0x68')]=function(_0x4c74ab){if(_0x4c74ab===_0xff71('0x43')||_0x4c74ab===_0xff71('0x69')||_0x4c74ab===_0xff71('0x5d')||_0x4c74ab==='type'||_0x4c74ab==='campaigntype'||_0x4c74ab==='dialAnswer'||_0x4c74ab===_0xff71('0x6a')||_0x4c74ab===_0xff71('0x45')||_0x4c74ab===_0xff71('0x1a')||_0x4c74ab===_0xff71('0x50')||_0x4c74ab===_0xff71('0x46')||_0x4c74ab===_0xff71('0x51')||_0x4c74ab==='countbusyretry'||_0x4c74ab==='countcongestionretry'||_0x4c74ab===_0xff71('0x6b')||_0x4c74ab==='countglobal'||_0x4c74ab==='callback'||_0x4c74ab===_0xff71('0x6c')||_0x4c74ab===_0xff71('0x6d')||_0x4c74ab===_0xff71('0x6e')||_0x4c74ab===_0xff71('0x1b')||_0x4c74ab===_0xff71('0x54')||_0x4c74ab===_0xff71('0x3b')||_0x4c74ab===_0xff71('0x1d')||_0x4c74ab===_0xff71('0x6f')||_0x4c74ab===_0xff71('0x70')||_0x4c74ab===_0xff71('0x71')||_0x4c74ab===_0xff71('0x72')||_0x4c74ab==='xmd-listid'||_0x4c74ab==='xmd-dialurl'||_0x4c74ab===_0xff71('0x73')||_0x4c74ab===_0xff71('0x74')||_0x4c74ab===_0xff71('0x75')||_0x4c74ab===_0xff71('0x76')||_0x4c74ab===_0xff71('0x77')||_0x4c74ab==='xmd-cdrtype'||_0x4c74ab===_0xff71('0x78')||_0x4c74ab===_0xff71('0x79')||_0x4c74ab===_0xff71('0x7a')||_0x4c74ab===_0xff71('0x7b')||_0x4c74ab===_0xff71('0x7c')||_0x4c74ab===_0xff71('0x7d')||_0x4c74ab===_0xff71('0x7e')||_0x4c74ab===_0xff71('0x7f')||_0x4c74ab===_0xff71('0x80')||_0x4c74ab==='rtpaudioqosrtt'||_0x4c74ab==='rtpaudioqosrttbridged'||_0x4c74ab===_0xff71('0x7b')||_0x4c74ab==='rtpaudioqosbridged'||_0x4c74ab==='rtpaudioqosjitter'||_0x4c74ab===_0xff71('0x7e')||_0x4c74ab===_0xff71('0x7f')||_0x4c74ab==='rtpaudioqoslossbridged'||_0x4c74ab===_0xff71('0x81')||_0x4c74ab==='rtpaudioqosrttbridged'||_0x4c74ab===_0xff71('0x82')||_0x4c74ab===_0xff71('0x83')||_0x4c74ab===_0xff71('0x37')||_0x4c74ab===_0xff71('0x4e')){return![];}return!![];};exports[_0xff71('0x84')]=function(_0xee549,_0x448224){var _0x44d0d4,_0x1dfc23,_0x4b3f83;if(_0x448224<=0x0){_0x448224=0x1;}_0x44d0d4=new RegExp(_0xff71('0x85')+_0x448224+'}$');_0x1dfc23=Math['pow'](0xa,_0x448224-0x1);_0x4b3f83=Math[_0xff71('0x86')](0xa,_0x448224)-0x1;return util['format']('%s',_['replace'](_0xee549,_0x44d0d4,_[_0xff71('0x87')](_0x1dfc23,_0x4b3f83)));};exports[_0xff71('0x88')]=function(_0x31c03a){var _0x27f834=_0x31c03a[_0xff71('0x89')](/"(.*?)"/);return _0x27f834?_0x27f834[0x1]:_0x31c03a;};exports[_0xff71('0x8a')]=function(_0x145e30){var _0x59d453=_0x145e30['match'](/<(.*?)>/);return _0x59d453?_0x59d453[0x1]:_0x145e30;};function buildNoAnswerEventPayload(_0x1f77dc,_0x5ab7a7){var _0xcef150=buildObj(_0x1f77dc,_0xff71('0x8b'));if(!_[_0xff71('0xf')](_0x5ab7a7['variables'])){Object[_0xff71('0x8c')](_0x5ab7a7[_0xff71('0x8d')])[_0xff71('0x8e')](function(_0x5e3e33){_0xcef150[_0x5e3e33[_0xff71('0x8f')]()]=_0x5ab7a7[_0xff71('0x8d')][_0x5e3e33];});}return _0xcef150;}exports[_0xff71('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x7eec=['statedesc','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','calleridname','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','totalGlobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','idContact','type','countcongestionretry','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridNumber','match','variables','keys','forEach','toLowerCase','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','logger','info','inspect','loggerError','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','createdAt','XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','endtime','logAgent'];(function(_0x4a0c2c,_0x307e0a){var _0x5068e2=function(_0x5c6252){while(--_0x5c6252){_0x4a0c2c['push'](_0x4a0c2c['shift']());}};_0x5068e2(++_0x307e0a);}(_0x7eec,0x177));var _0xc7ee=function(_0x5d26ed,_0x14ddab){_0x5d26ed=_0x5d26ed-0x0;var _0x3f9bac=_0x7eec[_0x5d26ed];return _0x3f9bac;};'use strict';var util=require('util');var _=require(_0xc7ee('0x0'));var moment=require(_0xc7ee('0x1'));var logger=require(_0xc7ee('0x2'))('preview');var ipAgi=process[_0xc7ee('0x3')][_0xc7ee('0x4')]||_0xc7ee('0x5');var utils=require('../../dialer/utils');exports[_0xc7ee('0x6')]=function(_0x4af6f1){return function(_0x3cca59){logger[_0xc7ee('0x7')](_0x4af6f1,util['inspect'](_0x3cca59,{'showHidden':![],'depth':null}));};};exports[_0xc7ee('0x8')]=function(_0x13a93c,_0xd15be1){logger[_0xc7ee('0x9')](_0x13a93c,util[_0xc7ee('0xa')](_0xd15be1,{'showHidden':![],'depth':null}));};exports[_0xc7ee('0xb')]=function(_0x348b7c,_0x3ccef1){logger[_0xc7ee('0x7')](_0x348b7c,util[_0xc7ee('0xa')](_0x3ccef1,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3c6acf){return function(_0x1c2421){logger[_0xc7ee('0x9')](_0x3c6acf,util[_0xc7ee('0xa')](_0x1c2421,{'showHidden':![],'depth':null}));};};exports[_0xc7ee('0xc')]=function(_0x274a4c,_0xc5878e,_0xbf5cbf){return{'message':_0x274a4c,'unlock':_0xc5878e,'active':_0xbf5cbf};};exports[_0xc7ee('0xd')]=function(_0x271a7c,_0x3f3c63,_0x530ea1){if(!_['isUndefined'](_0x530ea1)&&_0xc7ee('0xe')===typeof _0x530ea1&&!_[_0xc7ee('0xf')](_0x530ea1)){if(!_[_0xc7ee('0x10')](_0x3f3c63)&&_0xc7ee('0xe')===typeof _0x3f3c63&&!_[_0xc7ee('0xf')](_0x3f3c63)){return util[_0xc7ee('0x11')](_0xc7ee('0x12'),_0x3f3c63,_0x530ea1);}return util['format'](_0xc7ee('0x12'),_0x530ea1,_0x530ea1);}if(!_[_0xc7ee('0x10')](_0x271a7c)&&_0xc7ee('0xe')===typeof _0x271a7c&&!_['isEmpty'](_0x271a7c)){return _0x271a7c;}return _0xc7ee('0x13');};exports[_0xc7ee('0x14')]=function(_0x4027a3){if(_['isNil'](_0x4027a3)){return![];}return _0x4027a3;};exports[_0xc7ee('0x15')]=function(_0x54a93d,_0x18005c,_0x24951a,_0x455f9e,_0x489f57,_0x40a9f5){var _0x45ddd5={'XMD-QUEUE':_0x18005c[_0xc7ee('0x16')]?_0x18005c['Queue']['name']:'','XMD-CALLERID':_0x455f9e,'XMD-CALLERID-PREVIEW':_0x40a9f5?util[_0xc7ee('0x11')](_0xc7ee('0x12'),_0x40a9f5['calleridname'],_0x40a9f5[_0xc7ee('0x17')]):_0x455f9e,'XMD-DIALID':_0x489f57,'XMD-CONTACTID':_0x18005c[_0xc7ee('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x455f9e,'XMD-VOICEQUEUEID':_0x18005c[_0xc7ee('0x19')],'XMD-DIALCHANNEL':_0x24951a,'XMD-DIALTIMEOUT':_0x54a93d[_0xc7ee('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xc7ee('0x11')](_0xc7ee('0x1b'),_0x54a93d[_0xc7ee('0x1c')]?'g':'',_[_0xc7ee('0xf')](_0x54a93d[_0xc7ee('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x54a93d[_0xc7ee('0x1e')]||'','XMD-AGI':_0x54a93d[_0xc7ee('0x1f')]?util[_0xc7ee('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x54a93d[_0xc7ee('0x1f')]):_0xc7ee('0x20'),'XMD-AGIAFTER':_0x54a93d[_0xc7ee('0x1c')]?util[_0xc7ee('0x11')](_0xc7ee('0x21'),ipAgi,_0x54a93d[_0xc7ee('0x1c')]):_0xc7ee('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x40a9f5?_0x40a9f5['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x40a9f5?_0x40a9f5[_0xc7ee('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xc7ee('0x23')};if(!_[_0xc7ee('0xf')](_0x54a93d[_0xc7ee('0x1d')])){_0x45ddd5[util[_0xc7ee('0x11')]('%s',_0xc7ee('0x24'))]=_0x54a93d[_0xc7ee('0x1d')];_0x45ddd5[util[_0xc7ee('0x11')]('%s',_0xc7ee('0x25'))]=_0x489f57;}if(_0x18005c&&_0x18005c[_0xc7ee('0x26')]){for(var _0x4c84bf in _0x18005c['Contact']){if(_0x18005c[_0xc7ee('0x26')][_0xc7ee('0x27')](_0x4c84bf)){if(!_[_0xc7ee('0x28')](_0x18005c[_0xc7ee('0x26')][_0x4c84bf])&&_0x4c84bf!=='id'&&_0x4c84bf!=='tags'&&_0x4c84bf!==_0xc7ee('0x29')&&_0x4c84bf!=='updatedAt'){_0x45ddd5[util[_0xc7ee('0x11')]('%s%s',_0xc7ee('0x2a'),_[_0xc7ee('0x2b')](_0x4c84bf))]=_0x18005c[_0xc7ee('0x26')][_0x4c84bf];}}}}return _0x45ddd5;};exports['toLowerVariables']=function(_0x19eea9){var _0x50c95b={};for(var _0x4f2fac in _0x19eea9){if(_0x19eea9[_0xc7ee('0x27')](_0x4f2fac)){_0x50c95b[util[_0xc7ee('0x11')]('%s',_['toLower'](_0x4f2fac))]=_0x19eea9[_0x4f2fac];}}return{'variables':_0x50c95b};};exports[_0xc7ee('0x2c')]=function(_0x114db0,_0x34b9e9){if(!_[_0xc7ee('0x28')](_0x114db0)){if(_0x114db0['hasOwnProperty'](_0xc7ee('0x2d'))){if(_0x114db0[_0xc7ee('0x2d')]>0x0){_0x114db0[_0xc7ee('0x2d')]-=0x1;}else{logger['error'](_0xc7ee('0x2e'),_0x34b9e9);}}}else{logger[_0xc7ee('0x7')](_0xc7ee('0x2f'),_0x34b9e9);}};exports['logBlacklist']=function(_0x1af300){var _0x30d271=moment()[_0xc7ee('0x11')](_0xc7ee('0x30'));_0x1af300[_0xc7ee('0x31')]=0xd;_0x1af300['statedesc']=_0xc7ee('0x32');_0x1af300[_0xc7ee('0x33')]=_0x30d271;_0x1af300['responsetime']=_0x30d271;_0x1af300[_0xc7ee('0x34')]=_0x30d271;};exports[_0xc7ee('0x35')]=function(_0x1c1966,_0x1cfd84,_0x499b4d){var _0x2c0d78=moment()[_0xc7ee('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c1966['state']=_0x1cfd84;_0x1c1966[_0xc7ee('0x36')]=_0x499b4d;_0x1c1966[_0xc7ee('0x37')]=_0x2c0d78;_0x1c1966[_0xc7ee('0x38')]=utils[_0xc7ee('0x39')](_0x1c1966['responsetime'],_0x1c1966[_0xc7ee('0x33')]);};exports[_0xc7ee('0x3a')]=function(_0xcdbbf8,_0x49c978,_0x153743){_0xcdbbf8[_0xc7ee('0x3b')]=_0x49c978;_0xcdbbf8[_0xc7ee('0x3c')]=_0x153743;};exports[_0xc7ee('0x3d')]=function(_0x79bfec,_0x19d8fb,_0x3438fc){var _0x475cb8=moment()[_0xc7ee('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x79bfec[_0xc7ee('0x31')]=_0x19d8fb;_0x79bfec[_0xc7ee('0x36')]=_0x3438fc;_0x79bfec[_0xc7ee('0x37')]=_0x79bfec[_0xc7ee('0x37')]?_0x79bfec['responsetime']:_0x475cb8;_0x79bfec[_0xc7ee('0x34')]=_0x79bfec[_0xc7ee('0x34')]?_0x79bfec[_0xc7ee('0x34')]:_0x475cb8;_0x79bfec[_0xc7ee('0x38')]=utils[_0xc7ee('0x39')](_0x79bfec['responsetime']||0x0,_0x79bfec[_0xc7ee('0x33')]||0x0);_0x79bfec[_0xc7ee('0x3e')]=_0x79bfec[_0xc7ee('0x3f')]?utils[_0xc7ee('0x39')](_0x79bfec[_0xc7ee('0x34')],_0x79bfec['answertime']):0x0;};exports[_0xc7ee('0x40')]=function(_0x28fca8){return _0x28fca8===_0xc7ee('0x41');};exports['variablesAction']=function(_0x56d862,_0x46d6cb,_0x3a2e80,_0x43dee1,_0xffe4e5){var _0x2b953c=_0x43dee1?'RECALL':_0x56d862[_0xc7ee('0x42')];_0x2b953c=_0xffe4e5?_0xc7ee('0x43'):_0x2b953c;return{'actionid':_0x56d862[_0xc7ee('0x44')],'action':_0xc7ee('0x45'),'channel':_0x56d862[_0xc7ee('0x46')],'callerid':util[_0xc7ee('0x11')](_0xc7ee('0x12'),_0x2b953c,_0x56d862[_0xc7ee('0x17')]),'Exten':_0xc7ee('0x47'),'Context':_0xc7ee('0x48'),'Priority':'1','variable':_0x3a2e80,'timeout':(_0x46d6cb['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x56d862[_0xc7ee('0x44')]};};exports[_0xc7ee('0x49')]=function(_0xe1b473){return _0xe1b473[_0xc7ee('0x4a')]+_0xe1b473['countcongestionretry']+_0xe1b473[_0xc7ee('0x4b')]+_0xe1b473['countagentrejectretry']+_0xe1b473[_0xc7ee('0x4c')];};exports[_0xc7ee('0x4d')]=function(_0xef0153){var _0x50bd24=_[_0xc7ee('0x4e')](_0xef0153);_0x50bd24[_0xc7ee('0x31')]=0xf;_0x50bd24[_0xc7ee('0x36')]=_0xc7ee('0x4f');return _0x50bd24;};exports[_0xc7ee('0x50')]=function(_0x1bfbdc,_0x58cf6c,_0x1214a1){var _0x41d32b={};_0x41d32b[_0x58cf6c]=_0x1bfbdc[_0x58cf6c];_0x41d32b[_0xc7ee('0x51')]=![];_0x41d32b[_0xc7ee('0x52')]=moment()[_0xc7ee('0x53')](_0x1214a1,'minutes')[_0xc7ee('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x41d32b[_0xc7ee('0x18')]=_0x1bfbdc['ContactId'];_0x41d32b['ListId']=_0x1bfbdc[_0xc7ee('0x54')];_0x41d32b[_0xc7ee('0x19')]=_0x1bfbdc[_0xc7ee('0x19')]||undefined;return _0x41d32b;};exports[_0xc7ee('0x55')]=function(_0x223d2e,_0x262ea4){if(!_[_0xc7ee('0x28')](_0x223d2e)){if(_0x223d2e[_0xc7ee('0x56')]>0x0){_0x223d2e[_0xc7ee('0x56')]-=0x1;}else{logger[_0xc7ee('0x7')](_0x262ea4,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc7ee('0x7')](_0x262ea4,_0xc7ee('0x57'));}};exports[_0xc7ee('0x58')]=function(_0xb41415){if(_0xb41415<=0x0){return!![];}return![];};function buildObj(_0x36ca9b,_0x3d232d,_0x5bf5d9){_0x36ca9b[_0xc7ee('0x59')]=_0x3d232d;_0x36ca9b['name']=_0x36ca9b[_0xc7ee('0x5a')];_0x36ca9b[_0xc7ee('0x5b')]=_0x36ca9b[_0xc7ee('0x46')];_0x36ca9b[_0xc7ee('0x5c')]=_0xc7ee('0x5d');if(_0x5bf5d9){_0x36ca9b['mandatoryDisposition']=_0x5bf5d9[_0xc7ee('0x5e')];}return _0x36ca9b;}exports['buildObj']=buildObj;exports[_0xc7ee('0x5f')]=function(_0x3b64a8){var _0x366e81={};_0x366e81[_0xc7ee('0x5a')]=_0x3b64a8['queue'];_0x366e81['interface']=_0x3b64a8[_0xc7ee('0x46')];_0x366e81[_0xc7ee('0x44')]=_0x3b64a8[_0xc7ee('0x44')];return _0x366e81;};exports[_0xc7ee('0x60')]=function(_0x10ddc2){var _0x369d5e=[];for(var _0x3f3f1f in _0x10ddc2){if(_0x10ddc2[_0xc7ee('0x27')](_0x3f3f1f)){if(!_['isNil'](_0x10ddc2[_0x3f3f1f])&&_0x10ddc2[_0x3f3f1f][_0xc7ee('0x31')]===_0xc7ee('0x61')&&_0x10ddc2[_0x3f3f1f][_0xc7ee('0x62')]===_0xc7ee('0x63')){_0x369d5e[_0xc7ee('0x64')](_0x10ddc2[_0x3f3f1f]['id']);}}}return _0x369d5e;};exports[_0xc7ee('0x65')]=function(_0x487fe7){var _0x27cad5=moment()['milliseconds'](0x0);var _0x2e0dd4=moment(_0x487fe7)[_0xc7ee('0x66')](0x0);return _0x27cad5[_0xc7ee('0x67')](_0x2e0dd4,_0xc7ee('0x68'));};exports[_0xc7ee('0x69')]=function(_0x434c65){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x434c65[_0xc7ee('0x18')],'ListId':_0x434c65['ListId'],'VoiceQueueId':_0x434c65[_0xc7ee('0x19')]||undefined,'CampaignId':_0x434c65['CampaignId']||undefined};};exports['filterKey']=function(_0x22e8f1){if(_0x22e8f1==='uniqueid'||_0x22e8f1===_0xc7ee('0x6a')||_0x22e8f1===_0xc7ee('0x5a')||_0x22e8f1===_0xc7ee('0x6b')||_0x22e8f1==='campaigntype'||_0x22e8f1==='dialAnswer'||_0x22e8f1===_0xc7ee('0x3b')||_0x22e8f1===_0xc7ee('0x46')||_0x22e8f1==='calleridname'||_0x22e8f1===_0xc7ee('0x51')||_0x22e8f1==='calleridnum'||_0x22e8f1===_0xc7ee('0x52')||_0x22e8f1===_0xc7ee('0x4a')||_0x22e8f1===_0xc7ee('0x6c')||_0x22e8f1===_0xc7ee('0x4b')||_0x22e8f1===_0xc7ee('0x6d')||_0x22e8f1==='callback'||_0x22e8f1===_0xc7ee('0x6e')||_0x22e8f1===_0xc7ee('0x6f')||_0x22e8f1==='recallme'||_0x22e8f1===_0xc7ee('0x18')||_0x22e8f1===_0xc7ee('0x54')||_0x22e8f1===_0xc7ee('0x3c')||_0x22e8f1===_0xc7ee('0x19')||_0x22e8f1===_0xc7ee('0x70')||_0x22e8f1===_0xc7ee('0x71')||_0x22e8f1===_0xc7ee('0x72')||_0x22e8f1===_0xc7ee('0x73')||_0x22e8f1===_0xc7ee('0x74')||_0x22e8f1===_0xc7ee('0x75')||_0x22e8f1==='xmd-dialtimeout'||_0x22e8f1===_0xc7ee('0x76')||_0x22e8f1===_0xc7ee('0x77')||_0x22e8f1===_0xc7ee('0x78')||_0x22e8f1==='xmd-contactid'||_0x22e8f1===_0xc7ee('0x79')||_0x22e8f1==='xmd-callerid'||_0x22e8f1===_0xc7ee('0x7a')||_0x22e8f1===_0xc7ee('0x7b')||_0x22e8f1===_0xc7ee('0x7c')||_0x22e8f1==='rtpaudioqosbridged'||_0x22e8f1===_0xc7ee('0x7d')||_0x22e8f1===_0xc7ee('0x7e')||_0x22e8f1===_0xc7ee('0x7f')||_0x22e8f1===_0xc7ee('0x80')||_0x22e8f1===_0xc7ee('0x81')||_0x22e8f1===_0xc7ee('0x82')||_0x22e8f1===_0xc7ee('0x7c')||_0x22e8f1===_0xc7ee('0x83')||_0x22e8f1===_0xc7ee('0x7d')||_0x22e8f1===_0xc7ee('0x7e')||_0x22e8f1===_0xc7ee('0x7f')||_0x22e8f1===_0xc7ee('0x80')||_0x22e8f1==='rtpaudioqosrtt'||_0x22e8f1===_0xc7ee('0x82')||_0x22e8f1===_0xc7ee('0x84')||_0x22e8f1==='bridgepvtcallid'||_0x22e8f1===_0xc7ee('0x31')||_0x22e8f1===_0xc7ee('0x36')){return![];}return!![];};exports[_0xc7ee('0x85')]=function(_0xe1149f,_0x52943a){var _0x56ad15,_0x1b782e,_0x15ba88;if(_0x52943a<=0x0){_0x52943a=0x1;}_0x56ad15=new RegExp(_0xc7ee('0x86')+_0x52943a+'}$');_0x1b782e=Math['pow'](0xa,_0x52943a-0x1);_0x15ba88=Math[_0xc7ee('0x87')](0xa,_0x52943a)-0x1;return util[_0xc7ee('0x11')]('%s',_[_0xc7ee('0x88')](_0xe1149f,_0x56ad15,_['random'](_0x1b782e,_0x15ba88)));};exports['extractCalleridName']=function(_0x370cc3){var _0x1d58b2=_0x370cc3['match'](/"(.*?)"/);return _0x1d58b2?_0x1d58b2[0x1]:_0x370cc3;};exports[_0xc7ee('0x89')]=function(_0x181c72){var _0x326512=_0x181c72[_0xc7ee('0x8a')](/<(.*?)>/);return _0x326512?_0x326512[0x1]:_0x181c72;};function buildNoAnswerEventPayload(_0x4d2944,_0x130a09){var _0x443179=buildObj(_0x4d2944,'noanswer');if(!_['isEmpty'](_0x130a09[_0xc7ee('0x8b')])){Object[_0xc7ee('0x8c')](_0x130a09[_0xc7ee('0x8b')])[_0xc7ee('0x8d')](function(_0x159b69){_0x443179[_0x159b69[_0xc7ee('0x8e')]()]=_0x130a09[_0xc7ee('0x8b')][_0x159b69];});}return _0x443179;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index b91fd0f..182bee2 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 _0xae0e=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x4d91ca,_0x4eae07){var _0xaca230=function(_0x127963){while(--_0x127963){_0x4d91ca['push'](_0x4d91ca['shift']());}};_0xaca230(++_0x4eae07);}(_0xae0e,0xda));var _0xeae0=function(_0x37672d,_0x55a7c5){_0x37672d=_0x37672d-0x0;var _0x375a54=_0xae0e[_0x37672d];return _0x375a54;};'use strict';exports[_0xeae0('0x0')]={'queue':{'type':_0xeae0('0x1'),'required':!![]},'interface':{'type':_0xeae0('0x1'),'required':!![]},'membername':{'type':_0xeae0('0x1'),'required':!![]},'penalty':{'type':_0xeae0('0x2'),'required':![]},'paused':{'type':_0xeae0('0x3'),'required':![]}};exports[_0xeae0('0x4')]={'queue':{'type':_0xeae0('0x1'),'required':!![]},'interface':{'type':_0xeae0('0x1'),'required':!![]}};exports[_0xeae0('0x5')]={'interface':{'type':_0xeae0('0x1'),'required':!![]},'paused':{'type':_0xeae0('0x3')},'reason':{'type':_0xeae0('0x1'),'required':![]}};exports[_0xeae0('0x6')]={'module':{'type':_0xeae0('0x1'),'required':![]}};exports[_0xeae0('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xeae0('0x1'),'required':!![]},'filename':{'type':_0xeae0('0x1')},'format':{'type':_0xeae0('0x1')},'mixmonitorid':{'type':_0xeae0('0x1')}};exports[_0xeae0('0x8')]={'uniqueid':{'type':_0xeae0('0x1'),'required':!![]}};exports[_0xeae0('0x9')]={'uniqueid':{'type':_0xeae0('0x1'),'required':!![]},'exten':{'type':_0xeae0('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xa22d=['queueadd','string','number','boolean','queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0xa22d,0x1b9));var _0xda22=function(_0x2bda25,_0xfd5db6){_0x2bda25=_0x2bda25-0x0;var _0x4a386d=_0xa22d[_0x2bda25];return _0x4a386d;};'use strict';exports[_0xda22('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xda22('0x1'),'required':!![]},'membername':{'type':_0xda22('0x1'),'required':!![]},'penalty':{'type':_0xda22('0x2'),'required':![]},'paused':{'type':_0xda22('0x3'),'required':![]}};exports[_0xda22('0x4')]={'queue':{'type':_0xda22('0x1'),'required':!![]},'interface':{'type':_0xda22('0x1'),'required':!![]}};exports[_0xda22('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xda22('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xda22('0x6')]={'uniqueid':{'type':_0xda22('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xda22('0x1'),'required':!![]},'filename':{'type':_0xda22('0x1')},'format':{'type':_0xda22('0x1')},'mixmonitorid':{'type':_0xda22('0x1')}};exports[_0xda22('0x7')]={'uniqueid':{'type':_0xda22('0x1'),'required':!![]}};exports[_0xda22('0x8')]={'uniqueid':{'type':_0xda22('0x1'),'required':!![]},'exten':{'type':_0xda22('0x1'),'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 dfc2686..1c3aeca 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 _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0x25d88a,_0x42ffe7){var _0x3ad9ce=function(_0x57316e){while(--_0x57316e){_0x25d88a['push'](_0x25d88a['shift']());}};_0x3ad9ce(++_0x42ffe7);}(_0x757a,0xde));var _0xa757=function(_0x3812a7,_0x5b0c32){_0x3812a7=_0x3812a7-0x0;var _0x27d8b6=_0x757a[_0x3812a7];return _0x27d8b6;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0x3d2859,_0x1dce06){var _0x474404=function(_0x4adc34){while(--_0x4adc34){_0x3d2859['push'](_0x3d2859['shift']());}};_0x474404(++_0x1dce06);}(_0x757a,0xde));var _0xa757=function(_0x13f612,_0x2fc1db){_0x13f612=_0x13f612-0x0;var _0x79acd6=_0x757a[_0x13f612];return _0x79acd6;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 7dafd13..d452996 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 _0x2695=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2695,0x18f));var _0x5269=function(_0x3ae935,_0x5bacf5){_0x3ae935=_0x3ae935-0x0;var _0x43f090=_0x2695[_0x3ae935];return _0x43f090;};'use strict';function mergeDBDataToRealtime(_0x49c9dc,_0xc2c4d9){var _0x4d262b=Object[_0x5269('0x0')]({},_0x49c9dc);for(var _0x19bbe1 in _0xc2c4d9){if(_0x4d262b[_0x5269('0x1')](_0x19bbe1)){_0x4d262b[_0x19bbe1]=_0xc2c4d9[_0x19bbe1];}}return _0x4d262b;}exports[_0x5269('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xfd03=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x5d082a,_0x4aa33f){var _0xebd7f4=function(_0x247bb3){while(--_0x247bb3){_0x5d082a['push'](_0x5d082a['shift']());}};_0xebd7f4(++_0x4aa33f);}(_0xfd03,0x149));var _0x3fd0=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xfd03[_0x445c98];return _0x2fe913;};'use strict';function mergeDBDataToRealtime(_0x102e20,_0x56085a){var _0x5194aa=Object[_0x3fd0('0x0')]({},_0x102e20);for(var _0x155677 in _0x56085a){if(_0x5194aa[_0x3fd0('0x1')](_0x155677)){_0x5194aa[_0x155677]=_0x56085a[_0x155677];}}return _0x5194aa;}exports[_0x3fd0('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 72843a8..3e17de4 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 _0x5245=['exports','lodash','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','name','isNil','accountcode','interface','format','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','keys','channel','split','getAgentByInternal','calleridnum','outbound','destination','exten','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','voiceAgentReport','isArray','forEach','voiceDialReport','Local','substring','indexOf','find','mobile','phone','lastIndexOf','membername'];(function(_0x3c7f08,_0x40ad55){var _0x1a678f=function(_0xe47312){while(--_0xe47312){_0x3c7f08['push'](_0x3c7f08['shift']());}};_0x1a678f(++_0x40ad55);}(_0x5245,0x171));var _0x5524=function(_0x163555,_0x27ce78){_0x163555=_0x163555-0x0;var _0x250307=_0x5245[_0x163555];return _0x250307;};'use strict';var _=require(_0x5524('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x5524('0x1'));var ami=require(_0x5524('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x5524('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x5524('0x4'));var RpcVoiceQueueReport=require(_0x5524('0x5'));var RpcVoiceRecording=require(_0x5524('0x6'));var RpcVoiceTransferReport=require(_0x5524('0x7'));var VoiceQueueReport=require(_0x5524('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x5524('0x9'));var UserReport=require('./userReport');function Report(_0x4679bd){this[_0x5524('0xa')]=_0x4679bd;this[_0x5524('0xb')]=_0x4679bd[_0x5524('0xb')];this[_0x5524('0xc')]=_0x4679bd[_0x5524('0xc')];}Report[_0x5524('0xd')][_0x5524('0xe')]=function(_0x52479b){var _0x279e62=new VoiceQueueReport(this[_0x5524('0xa')]);var _0x4eda69=new VoiceAgentReport(this[_0x5524('0xa')]);var _0x2dbe5f=new VoiceDialReport(this[_0x5524('0xa')]);var _0x32cd10=new VoiceCallReport(this[_0x5524('0xa')]);var _0x3b3553=new UserReport(this[_0x5524('0xa')]);if(config[_0x5524('0xf')]&&config[_0x5524('0xf')][_0x5524('0x10')]){ami['on'](_0x5524('0x11'),this[_0x5524('0x12')][_0x5524('0x13')](this));ami['on']('custom:voiceCallReport',this[_0x5524('0x14')][_0x5524('0x13')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0x5524('0x15'),this['voiceDialReport'][_0x5524('0x13')](this));ami['on'](_0x5524('0x16'),this[_0x5524('0x17')]['bind'](this));ami['on'](_0x5524('0x18'),this[_0x5524('0x19')][_0x5524('0x13')](this));}};Report[_0x5524('0xd')]['findAgent']=function(_0x50ffa2){var _0x3f2f1c;_0x3f2f1c=_['find'](this[_0x5524('0xb')],function(_0x63189){return _0x63189['accountcode']==_0x50ffa2||_0x63189[_0x5524('0x1a')]==_0x50ffa2;});if(_[_0x5524('0x1b')](_0x3f2f1c)){var _0x5ad39a=_['find'](this[_0x5524('0xc')],function(_0x35bc15){return _0x35bc15[_0x5524('0x1c')]==_0x50ffa2||_0x35bc15[_0x5524('0x1a')]==_0x50ffa2;});if(_0x5ad39a){_0x3f2f1c=_['find'](this[_0x5524('0xb')],function(_0x5a808e){return _0x5a808e[_0x5524('0x1d')]==util[_0x5524('0x1e')](_0x5524('0x1f'),_0x5ad39a[_0x5524('0x1a')]);});}}return _0x3f2f1c;};Report['prototype']['voiceQueueReport']=function(_0x5b46dc){for(var _0x3b44e5=0x0;_0x3b44e5<_0x5b46dc[_0x5524('0x20')];_0x3b44e5+=0x1){var _0x219fcb=this[_0x5524('0x21')](_0x5b46dc[_0x3b44e5][_0x5524('0x22')]);if(_0x219fcb){_0x5b46dc[_0x3b44e5][_0x5524('0x1c')]=_0x219fcb[_0x5524('0x1c')];_0x5b46dc[_0x3b44e5][_0x5524('0x23')]=!![];_0x5b46dc[_0x3b44e5][_0x5524('0x24')]=_0x219fcb[_0x5524('0x1a')];_0x5b46dc[_0x3b44e5][_0x5524('0x1d')]=_[_0x5524('0x1b')](_0x219fcb[_0x5524('0x1d')])?util[_0x5524('0x1e')](_0x5524('0x1f'),_0x219fcb[_0x5524('0x1a')]):_0x219fcb[_0x5524('0x1d')];if(_0x5b46dc[_0x3b44e5][_0x5524('0x25')]){_0x5b46dc[_0x3b44e5][_0x5524('0x26')]=moment()[_0x5524('0x1e')](_0x5524('0x27'));}if(_0x5b46dc[_0x3b44e5][_0x5524('0x28')]){_0x5b46dc[_0x3b44e5][_0x5524('0x29')]=moment()[_0x5524('0x1e')](_0x5524('0x27'));}RpcMemberReport[_0x5524('0x12')](_0x5b46dc[_0x3b44e5]);}RpcVoiceQueueReport[_0x5524('0x2a')](_0x5b46dc[_0x3b44e5]);}};function extractCalleridNumber(_0x5de6a2){var _0x2ce230=_0x5de6a2[_0x5524('0x2b')](/<(.*?)>/);return _0x2ce230?_0x2ce230[0x1]:_0x5de6a2;}Report[_0x5524('0xd')]['getAgentByInternal']=function(_0x4e4f43){for(var _0x170512=0x0;_0x170512','calleridname','transfers','linkedid','uniqueid','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x8422,0xf7));var _0x2842=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x8422[_0x2dc343];return _0x51eac5;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var config=require(_0x2842('0x0'));var ami=require(_0x2842('0x1'));var RpcVoiceAgentReport=require(_0x2842('0x2'));var RpcVoiceCallReport=require(_0x2842('0x3'));var RpcVoiceDialReport=require(_0x2842('0x4'));var RpcMemberReport=require(_0x2842('0x5'));var RpcVoiceQueueReport=require(_0x2842('0x6'));var RpcVoiceRecording=require(_0x2842('0x7'));var RpcVoiceTransferReport=require(_0x2842('0x8'));var VoiceQueueReport=require(_0x2842('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2842('0xa'));var VoiceDialReport=require(_0x2842('0xb'));var UserReport=require(_0x2842('0xc'));function Report(_0xe2f30f){this[_0x2842('0xd')]=_0xe2f30f;this['agents']=_0xe2f30f['agents'];this[_0x2842('0xe')]=_0xe2f30f[_0x2842('0xe')];}Report[_0x2842('0xf')][_0x2842('0x10')]=function(_0x3b6e7a){var _0x1694ba=new VoiceQueueReport(this['realtime']);var _0x51dafe=new VoiceAgentReport(this['realtime']);var _0xa9f634=new VoiceDialReport(this[_0x2842('0xd')]);var _0x5986ea=new VoiceCallReport(this[_0x2842('0xd')]);var _0x730f8a=new UserReport(this['realtime']);if(config[_0x2842('0x11')]&&config[_0x2842('0x11')][_0x2842('0x12')]){ami['on'](_0x2842('0x13'),this[_0x2842('0x14')][_0x2842('0x15')](this));ami['on'](_0x2842('0x16'),this['voiceCallReport'][_0x2842('0x15')](this));ami['on'](_0x2842('0x17'),this['voiceAgentReport']['bind'](this));ami['on'](_0x2842('0x18'),this[_0x2842('0x19')][_0x2842('0x15')](this));ami['on'](_0x2842('0x1a'),this[_0x2842('0x1b')]['bind'](this));ami['on']('attendedtransfer',this[_0x2842('0x1c')]['bind'](this));}};Report['prototype'][_0x2842('0x1d')]=function(_0x590a11){var _0x5eb4e5;_0x5eb4e5=_['find'](this['agents'],function(_0x37d311){return _0x37d311[_0x2842('0x1e')]==_0x590a11||_0x37d311[_0x2842('0x1f')]==_0x590a11;});if(_[_0x2842('0x20')](_0x5eb4e5)){var _0x3d4e4d=_[_0x2842('0x21')](this['telephones'],function(_0x3ebe60){return _0x3ebe60[_0x2842('0x1e')]==_0x590a11||_0x3ebe60[_0x2842('0x1f')]==_0x590a11;});if(_0x3d4e4d){_0x5eb4e5=_[_0x2842('0x21')](this[_0x2842('0x22')],function(_0x3b4a8e){return _0x3b4a8e[_0x2842('0x23')]==util[_0x2842('0x24')](_0x2842('0x25'),_0x3d4e4d['name']);});}}return _0x5eb4e5;};Report['prototype'][_0x2842('0x14')]=function(_0x292e05){for(var _0x41ce6b=0x0;_0x41ce6b<_0x292e05['length'];_0x41ce6b+=0x1){var _0x5e5bc2=this[_0x2842('0x1d')](_0x292e05[_0x41ce6b][_0x2842('0x26')]);if(_0x5e5bc2){_0x292e05[_0x41ce6b][_0x2842('0x1e')]=_0x5e5bc2['accountcode'];_0x292e05[_0x41ce6b][_0x2842('0x27')]=!![];_0x292e05[_0x41ce6b][_0x2842('0x28')]=_0x5e5bc2[_0x2842('0x1f')];_0x292e05[_0x41ce6b][_0x2842('0x23')]=_['isNil'](_0x5e5bc2[_0x2842('0x23')])?util['format']('SIP/%s',_0x5e5bc2[_0x2842('0x1f')]):_0x5e5bc2['interface'];if(_0x292e05[_0x41ce6b][_0x2842('0x29')]){_0x292e05[_0x41ce6b]['queuecallercompleteAt']=moment()[_0x2842('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x292e05[_0x41ce6b]['queuecallerexit']){_0x292e05[_0x41ce6b][_0x2842('0x2a')]=moment()[_0x2842('0x24')](_0x2842('0x2b'));}RpcMemberReport[_0x2842('0x14')](_0x292e05[_0x41ce6b]);}RpcVoiceQueueReport[_0x2842('0x2c')](_0x292e05[_0x41ce6b]);}};function extractCalleridNumber(_0x5b541a){var _0x4f19b9=_0x5b541a['match'](/<(.*?)>/);return _0x4f19b9?_0x4f19b9[0x1]:_0x5b541a;}Report[_0x2842('0xf')][_0x2842('0x2d')]=function(_0x4c25b1){for(var _0x4fcb28=0x0;_0x4fcb280x0?!![]:![];if(!_0xc69213){return this[_0xd3c4('0x18')](this[_0xd3c4('0x13')][_0xd3c4('0x68')]);}};VoiceQueueReport[_0xd3c4('0x34')][_0xd3c4('0x19')]=function(_0x39564e){var _0x4ac024=this[_0xd3c4('0x13')]['id'];if(this[_0xd3c4('0x13')][_0xd3c4('0x60')][_0x4ac024]&&this[_0xd3c4('0x13')][_0xd3c4('0x60')][_0x4ac024][_0x39564e[_0xd3c4('0x5f')]]){this[_0xd3c4('0x13')]['queuestatus'][_0x4ac024][_0x39564e[_0xd3c4('0x5f')]][_0xd3c4('0x63')]['push'](_0x39564e);}};VoiceQueueReport[_0xd3c4('0x34')]['syncQueueSummary']=function(_0x3e3b09){var _0x5700e6=this;try{if(this[_0xd3c4('0x59')](_0x3e3b09)&&this[_0xd3c4('0x59')](_0x3e3b09['queue'])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0xd3c4('0x3c')](_0x3e3b09,{'showHidden':![],'depth':null}));var _0x12bb6a=this[_0xd3c4('0x11')][_0x3e3b09[_0xd3c4('0x4a')]];if(_0x12bb6a){logger[_0xd3c4('0x69')](_0xd3c4('0x6a'),_0x12bb6a[_0xd3c4('0x58')]);this[_0xd3c4('0x13')][_0xd3c4('0x5c')][_0x12bb6a[_0xd3c4('0x58')]]={'summaryEvent':_0x3e3b09};this[_0xd3c4('0x13')][_0xd3c4('0x67')]+=0x1;return ami['Action']({'action':_0xd3c4('0x60'),'queue':_0x12bb6a[_0xd3c4('0x58')]})[_0xd3c4('0x5e')](function(_0x482107){if(!_0x5700e6['summary'][_0xd3c4('0x60')][_0x3e3b09['actionid']]){_0x5700e6['summary'][_0xd3c4('0x60')][_0x3e3b09[_0xd3c4('0x5f')]]={};}_0x5700e6[_0xd3c4('0x13')][_0xd3c4('0x60')][_0x3e3b09[_0xd3c4('0x5f')]][_0x482107[_0xd3c4('0x5f')]]={'queue':_0x12bb6a[_0xd3c4('0x58')],'agents':[]};})[_0xd3c4('0x39')](function(_0x44faa8){throw _0x44faa8;});}}}catch(_0x4ee606){logger[_0xd3c4('0x3e')]('[voiceQueueReport][queuesummary]',util[_0xd3c4('0x3c')](_0x4ee606,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x3a9cba){if(this[_0xd3c4('0x13')][_0xd3c4('0x67')]>0x0){this[_0xd3c4('0x13')]['completeEvent']=_0x3a9cba;return;}logger[_0xd3c4('0x56')](_0xd3c4('0x6b'),util['inspect'](_0x3a9cba,{'showHidden':![],'depth':null}));this[_0xd3c4('0x13')]=initializeSummary();ami[_0xd3c4('0x44')](_0xd3c4('0x6c'),{});};VoiceQueueReport[_0xd3c4('0x34')][_0xd3c4('0x1c')]=function(_0x27557e){try{if(this[_0xd3c4('0x59')](_0x27557e)){logger[_0xd3c4('0x56')]('[%s][voiceQueueReport][queuecallerjoin]',_0x27557e[_0xd3c4('0x48')],util[_0xd3c4('0x3c')](_0x27557e,{'showHidden':![],'depth':null}));if(_[_0xd3c4('0x5a')](this[_0xd3c4('0x3d')][_0x27557e[_0xd3c4('0x48')]])){this[_0xd3c4('0x3d')][_0x27557e[_0xd3c4('0x48')]]=[];}if(_[_0xd3c4('0x5a')](this[_0xd3c4('0xf')][_0x27557e[_0xd3c4('0x48')]])){this[_0xd3c4('0xf')][_0x27557e[_0xd3c4('0x48')]]={};}var _0x52ae74=new QueueReport();_0x52ae74[_0xd3c4('0x4a')]=_0x27557e['queue'];_0x52ae74[_0xd3c4('0x54')]=this['voiceQueues'][_0x52ae74[_0xd3c4('0x4a')]]&&this[_0xd3c4('0x11')][_0x52ae74[_0xd3c4('0x4a')]][_0xd3c4('0x54')]?this[_0xd3c4('0x11')][_0x52ae74[_0xd3c4('0x4a')]][_0xd3c4('0x54')]||_0xd3c4('0x55'):'inbound';_0x52ae74[_0xd3c4('0x6d')]=moment()[_0xd3c4('0x50')](_0xd3c4('0x6e'));_0x52ae74[_0xd3c4('0x6f')]=_0x27557e[_0xd3c4('0x6f')];_0x52ae74[_0xd3c4('0x70')]=_0x27557e[_0xd3c4('0x70')];_0x52ae74['uniqueid']=_0x27557e[_0xd3c4('0x48')];_0x52ae74[_0xd3c4('0x71')]=this[_0xd3c4('0xf')][_0x27557e['uniqueid']][_0xd3c4('0x71')];logger[_0xd3c4('0x69')](_0xd3c4('0x72'),_0x52ae74[_0xd3c4('0x4a')],_0x52ae74[_0xd3c4('0x54')]);_['merge'](_0x52ae74,_[_0xd3c4('0x73')](_0x27557e,_['keys'](_0x52ae74)));this[_0xd3c4('0x3d')][_0x27557e['uniqueid']][_0xd3c4('0x74')](_0x52ae74);this[_0xd3c4('0xf')][_0x27557e[_0xd3c4('0x48')]]=_0x52ae74;this[_0xd3c4('0x45')](_0x52ae74,_0xd3c4('0x75'));}}catch(_0x21c812){logger['error'](_0xd3c4('0x76'),_0x27557e[_0xd3c4('0x48')],util[_0xd3c4('0x3c')](_0x21c812,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x41b40c){try{if(this[_0xd3c4('0x59')](_0x41b40c)){logger[_0xd3c4('0x56')]('[%s][voiceQueueReport][queuecallerabandon]',_0x41b40c[_0xd3c4('0x48')],util[_0xd3c4('0x3c')](_0x41b40c,{'showHidden':![],'depth':null}));if(this[_0xd3c4('0x3d')][_0x41b40c[_0xd3c4('0x48')]]){var _0x2207a5=_['last'](this[_0xd3c4('0x3d')][_0x41b40c['uniqueid']]);_0x2207a5[_0xd3c4('0x77')]=![];_0x2207a5[_0xd3c4('0x78')]=null;_0x2207a5[_0xd3c4('0x79')]=_0x41b40c['holdtime'];_0x2207a5['originalposition']=_0x41b40c['originalposition'];_0x2207a5[_0xd3c4('0x1d')]=!![];_0x2207a5['queuecallerabandonAt']=moment()['format'](_0xd3c4('0x6e'));_0x2207a5['queuecallerexitreason']=_0xd3c4('0x7a');_0x2207a5['lastAssignedTo']=null;logger[_0xd3c4('0x69')](_0xd3c4('0x7b'),_0x2207a5[_0xd3c4('0x4a')],_0x2207a5[_0xd3c4('0x54')]);this[_0xd3c4('0xf')][_0x41b40c['uniqueid']]=_0x2207a5;this['emitVoiceQueueChannelRemove'](_0x2207a5,_0xd3c4('0x1d'));}}}catch(_0x215881){logger[_0xd3c4('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x41b40c[_0xd3c4('0x48')],util[_0xd3c4('0x3c')](_0x215881,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd3c4('0x34')][_0xd3c4('0x1f')]=function(_0x5c2356){try{if(this[_0xd3c4('0x59')](_0x5c2356)){logger[_0xd3c4('0x56')]('[%s][voiceQueueReport][queuecallerleave]',_0x5c2356[_0xd3c4('0x48')],util[_0xd3c4('0x3c')](_0x5c2356,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5c2356[_0xd3c4('0x48')]]){var _0x5c4648=_['last'](this[_0xd3c4('0x3d')][_0x5c2356[_0xd3c4('0x48')]]);_0x5c4648[_0xd3c4('0x7c')]=moment()[_0xd3c4('0x50')](_0xd3c4('0x6e'));_0x5c4648[_0xd3c4('0x7d')]=_0x5c2356['connectedlinenum'];_0x5c4648['connectedlinename']=_0x5c2356[_0xd3c4('0x7e')];logger[_0xd3c4('0x69')](_0xd3c4('0x7f'),_0x5c4648[_0xd3c4('0x4a')],_0x5c4648[_0xd3c4('0x54')],_0x5c2356[_0xd3c4('0x7d')],_0x5c2356[_0xd3c4('0x7e')]);this['channels'][_0x5c2356['uniqueid']]=_0x5c4648;this[_0xd3c4('0x45')](_0x5c4648,_0xd3c4('0x80'));}}}catch(_0x294734){logger['error'](_0xd3c4('0x81'),_0x5c2356[_0xd3c4('0x48')],util[_0xd3c4('0x3c')](_0x294734,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd3c4('0x34')][_0xd3c4('0x22')]=function(_0x545afa){try{if(this[_0xd3c4('0x59')](_0x545afa)){logger[_0xd3c4('0x56')](_0xd3c4('0x82'),_0x545afa['uniqueid'],util[_0xd3c4('0x3c')](_0x545afa,{'showHidden':![],'depth':null}));if(this[_0xd3c4('0x3d')][_0x545afa['uniqueid']]){var _0x3db1ff=_[_0xd3c4('0x83')](this[_0xd3c4('0x3d')][_0x545afa[_0xd3c4('0x48')]]);_0x3db1ff[_0xd3c4('0x77')]=!![];_0x3db1ff['queuecallerexitreason']=_0xd3c4('0x84');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3db1ff[_0xd3c4('0x4a')],_0x3db1ff[_0xd3c4('0x54')]);}}}catch(_0x164f70){logger[_0xd3c4('0x3e')](_0xd3c4('0x82'),_0x545afa[_0xd3c4('0x48')],util[_0xd3c4('0x3c')](_0x164f70,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd3c4('0x20')]=function(_0x5a1d16){try{if(this[_0xd3c4('0x59')](_0x5a1d16)){logger[_0xd3c4('0x56')](_0xd3c4('0x85'),_0x5a1d16['uniqueid'],util[_0xd3c4('0x3c')](_0x5a1d16,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5a1d16[_0xd3c4('0x48')]]){var _0x2573ae=_[_0xd3c4('0x83')](this[_0xd3c4('0x3d')][_0x5a1d16[_0xd3c4('0x48')]]);_0x2573ae['queuecallerabandon']=![];_0x2573ae['queuecallerabandonAt']=null;_0x2573ae[_0xd3c4('0x86')]=!![];_0x2573ae[_0xd3c4('0x87')]=_0x5a1d16['membername'];_0x2573ae[_0xd3c4('0x79')]=_0x5a1d16[_0xd3c4('0x79')];_0x2573ae['queuecallercomplete']=!![];_0x2573ae[_0xd3c4('0x88')]=![];_0x2573ae[_0xd3c4('0x89')]=null;if(!_0x2573ae[_0xd3c4('0x8a')]){if(_0x5a1d16[_0xd3c4('0x8b')]=='transfer'){_0x2573ae['queuecallerexitreason']=_0xd3c4('0x8c');logger[_0xd3c4('0x69')](_0xd3c4('0x8d'),_0x2573ae[_0xd3c4('0x4a')],_0x2573ae[_0xd3c4('0x54')]);}else{if(_[_0xd3c4('0x8e')](_0x5a1d16[_0xd3c4('0x8f')]['toLowerCase'](),_0xd3c4('0x90'))){if(this[_0xd3c4('0x3d')][_0x5a1d16[_0xd3c4('0x91')]]){var _0x3dc41b=_[_0xd3c4('0x83')](this[_0xd3c4('0x3d')][_0x5a1d16[_0xd3c4('0x91')]]);_0x3dc41b['queuecallercomplete']=![];_0x3dc41b['queuecallerexit']=!![];_0x3dc41b['queuecallerexitAt']=moment(_0x2573ae[_0xd3c4('0x6d')])[_0xd3c4('0x92')](_0x5a1d16[_0xd3c4('0x79')],_0xd3c4('0x93'))['format'](_0xd3c4('0x6e'));_0x3dc41b[_0xd3c4('0x4e')]=_0xd3c4('0x94');_0x3dc41b[_0xd3c4('0x8a')]=!![];_0x3dc41b[_0xd3c4('0x95')]=_0xd3c4('0x96');_0x3dc41b[_0xd3c4('0x97')]=_0x5a1d16[_0xd3c4('0x98')];_0x3dc41b[_0xd3c4('0x99')]=_0x5a1d16['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x3dc41b[_0xd3c4('0x4a')],_0x3dc41b[_0xd3c4('0x54')]);var _0x3805e8=this[_0xd3c4('0x3d')][_0x5a1d16[_0xd3c4('0x91')]];this[_0xd3c4('0x3d')][_0x5a1d16[_0xd3c4('0x91')]]=this[_0xd3c4('0x3d')][_0x5a1d16['uniqueid']];this['queueReports'][_0x5a1d16['uniqueid']]=_0x3805e8;}}else{_0x2573ae[_0xd3c4('0x4e')]='COMPLETEDBY'+_0x5a1d16[_0xd3c4('0x8b')][_0xd3c4('0x9a')]();logger['info'](_0xd3c4('0x9b'),_0x2573ae[_0xd3c4('0x4a')],_0x2573ae['type'],_0x2573ae[_0xd3c4('0x4e')]);}}}this[_0xd3c4('0xf')][_0x5a1d16[_0xd3c4('0x48')]]=_0x2573ae;}}}catch(_0xc10498){logger[_0xd3c4('0x3e')](_0xd3c4('0x85'),_0x5a1d16['uniqueid'],util[_0xd3c4('0x3c')](_0xc10498,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd3c4('0x34')][_0xd3c4('0x24')]=function(_0x58aad8){try{if(this[_0xd3c4('0x59')](_0x58aad8)){logger['debug'](_0xd3c4('0x9c'),_0x58aad8[_0xd3c4('0x48')],util[_0xd3c4('0x3c')](_0x58aad8,{'showHidden':![],'depth':null}));this[_0xd3c4('0x9d')](_0x58aad8[_0xd3c4('0x48')],_[_0xd3c4('0x9e')](_0x58aad8[_0xd3c4('0x9f')])[0x0],_0x58aad8[_0xd3c4('0xa0')]);if(this['queueReports'][_0x58aad8[_0xd3c4('0x48')]]){var _0x2f3380=_[_0xd3c4('0x83')](this[_0xd3c4('0x3d')][_0x58aad8[_0xd3c4('0x48')]]);if(_0x2f3380){if(this[_0xd3c4('0x59')](_0x58aad8[_0xd3c4('0x9f')])&&this['isNotNull'](_0x58aad8[_0xd3c4('0x9f')][_0xd3c4('0x60')])){switch(_0x58aad8[_0xd3c4('0xa0')]){case _0xd3c4('0xa1'):_0x2f3380[_0xd3c4('0x88')]=![];_0x2f3380['queuecallerexitAt']=null;break;case _0xd3c4('0xa2'):_0x2f3380[_0xd3c4('0xa3')]=_0xd3c4('0xa4');_0x2f3380[_0xd3c4('0x88')]=!![];_0x2f3380['queuecallerexitAt']=moment()[_0xd3c4('0x50')](_0xd3c4('0x6e'));_0x2f3380[_0xd3c4('0x7c')]=moment()[_0xd3c4('0x50')](_0xd3c4('0x6e'));logger[_0xd3c4('0x56')](_0xd3c4('0xa5'),_0x58aad8['uniqueid'],util[_0xd3c4('0x3c')](_0x2f3380,{'showHidden':![],'depth':null}));ami[_0xd3c4('0x44')]('custom:timeout',_0x2f3380);break;default:_0x2f3380[_0xd3c4('0x88')]=!![];_0x2f3380[_0xd3c4('0x89')]=moment()[_0xd3c4('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f3380[_0xd3c4('0x7c')]=moment()[_0xd3c4('0x50')](_0xd3c4('0x6e'));}_0x2f3380[_0xd3c4('0x1d')]=![];_0x2f3380[_0xd3c4('0xa6')]=null;_0x2f3380[_0xd3c4('0x4e')]=_0x58aad8['value'];this[_0xd3c4('0xf')][_0x58aad8[_0xd3c4('0x48')]]=_0x2f3380;this[_0xd3c4('0x4c')](_0x2f3380,_0xd3c4('0x23'));}else if(this[_0xd3c4('0x59')](_0x58aad8[_0xd3c4('0x9f')])&&this['isNotNull'](_0x58aad8[_0xd3c4('0x9f')]['queueposition'])){if(!_0x2f3380[_0xd3c4('0x1d')]){_0x2f3380[_0xd3c4('0x88')]=!![];_0x2f3380[_0xd3c4('0x89')]=moment()[_0xd3c4('0x50')](_0xd3c4('0x6e'));_0x2f3380[_0xd3c4('0x4e')]=_0xd3c4('0xa7');_0x2f3380[_0xd3c4('0x7c')]=moment()[_0xd3c4('0x50')](_0xd3c4('0x6e'));this[_0xd3c4('0xf')][_0x58aad8['uniqueid']]=_0x2f3380;}}logger[_0xd3c4('0x69')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x58aad8[_0xd3c4('0x48')],_0x2f3380[_0xd3c4('0x4a')],_0x2f3380[_0xd3c4('0x54')],_[_0xd3c4('0x9e')](_0x58aad8[_0xd3c4('0x9f')])[0x0],_0x58aad8[_0xd3c4('0xa0')]);_0x2f3380[_0xd3c4('0x14')]=this[_0xd3c4('0x14')][_0x58aad8[_0xd3c4('0x48')]];}}}}catch(_0x44a539){logger[_0xd3c4('0x3e')](_0xd3c4('0x9c'),_0x58aad8['uniqueid'],util['inspect'](_0x44a539,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x4f7296,_0x335227,_0x5b3d82){var _0x1105e4=[_0xd3c4('0xa8'),_0xd3c4('0xa9'),_0xd3c4('0xaa'),'rtpaudioqosjitterbridged',_0xd3c4('0xab'),_0xd3c4('0xac'),_0xd3c4('0xad'),_0xd3c4('0xae'),_0xd3c4('0xaf'),_0xd3c4('0xb0'),_0xd3c4('0xb1'),_0xd3c4('0xb2'),_0xd3c4('0xb3'),_0xd3c4('0xb4'),_0xd3c4('0xb5'),'memberlastcall',_0xd3c4('0xb6'),_0xd3c4('0xb7'),'memberrealtime'];if(!_[_0xd3c4('0x37')](_0x335227)&&!_['includes'](_0x1105e4,_0x335227)){if(_['isUndefined'](this[_0xd3c4('0x14')][_0x4f7296])){this[_0xd3c4('0x14')][_0x4f7296]={};}this[_0xd3c4('0x14')][_0x4f7296][_0x335227]=_0x5b3d82;}};VoiceQueueReport[_0xd3c4('0x34')][_0xd3c4('0xb8')]=function(_0xeb7cb3,_0x630d1,_0x5802d2){var _0x4a83e7={};for(var _0x32e23d=0x0;_0x32e23d0x0?!![]:![];if(!_0x30ad7b){return this['syncQueueSummaryComplete'](this[_0x0f47('0x14')][_0x0f47('0x70')]);}};VoiceQueueReport['prototype'][_0x0f47('0x1b')]=function(_0x192f48){var _0x4f7717=this[_0x0f47('0x14')]['id'];if(this['summary'][_0x0f47('0x67')][_0x4f7717]&&this[_0x0f47('0x14')][_0x0f47('0x67')][_0x4f7717][_0x192f48['actionid']]){this[_0x0f47('0x14')][_0x0f47('0x67')][_0x4f7717][_0x192f48['actionid']]['agents']['push'](_0x192f48);}};VoiceQueueReport[_0x0f47('0x39')][_0x0f47('0x71')]=function(_0x230682){var _0x34c822=this;try{if(this[_0x0f47('0x5f')](_0x230682)&&this['isNotNull'](_0x230682[_0x0f47('0x52')])){logger['debug'](_0x0f47('0x72'),util[_0x0f47('0x43')](_0x230682,{'showHidden':![],'depth':null}));var _0x225509=this[_0x0f47('0x12')][_0x230682[_0x0f47('0x52')]];if(_0x225509){logger[_0x0f47('0x73')](_0x0f47('0x74'),_0x225509[_0x0f47('0x5d')]);this[_0x0f47('0x14')][_0x0f47('0x61')][_0x225509[_0x0f47('0x5d')]]={'summaryEvent':_0x230682};this[_0x0f47('0x14')]['statusRequests']+=0x1;return ami[_0x0f47('0x3c')]({'action':_0x0f47('0x67'),'queue':_0x225509['name']})[_0x0f47('0x75')](function(_0x44b640){if(!_0x34c822[_0x0f47('0x14')][_0x0f47('0x67')][_0x230682['actionid']]){_0x34c822[_0x0f47('0x14')][_0x0f47('0x67')][_0x230682['actionid']]={};}_0x34c822['summary']['queuestatus'][_0x230682['actionid']][_0x44b640[_0x0f47('0x66')]]={'queue':_0x225509[_0x0f47('0x5d')],'agents':[]};})['catch'](function(_0x2e3b29){throw _0x2e3b29;});}}}catch(_0x135186){logger[_0x0f47('0x41')]('[voiceQueueReport][queuesummary]',util[_0x0f47('0x43')](_0x135186,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f47('0x39')][_0x0f47('0x19')]=function(_0x450133){if(this[_0x0f47('0x14')][_0x0f47('0x6f')]>0x0){this['summary']['completeEvent']=_0x450133;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x0f47('0x43')](_0x450133,{'showHidden':![],'depth':null}));this[_0x0f47('0x14')]=initializeSummary();ami[_0x0f47('0x4b')](_0x0f47('0x76'),{});};VoiceQueueReport['prototype'][_0x0f47('0x1f')]=function(_0x4354a3){try{if(this[_0x0f47('0x5f')](_0x4354a3)){logger['debug'](_0x0f47('0x77'),_0x4354a3['uniqueid'],util[_0x0f47('0x43')](_0x4354a3,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x0f47('0xd')][_0x4354a3[_0x0f47('0x50')]])){this[_0x0f47('0xd')][_0x4354a3['uniqueid']]=[];}if(_[_0x0f47('0x60')](this['channels'][_0x4354a3[_0x0f47('0x50')]])){this[_0x0f47('0x10')][_0x4354a3[_0x0f47('0x50')]]={};}var _0xf384da=new QueueReport();_0xf384da[_0x0f47('0x52')]=_0x4354a3[_0x0f47('0x52')];_0xf384da['type']=this[_0x0f47('0x12')][_0xf384da[_0x0f47('0x52')]]&&this[_0x0f47('0x12')][_0xf384da['queue']][_0x0f47('0x5b')]?this[_0x0f47('0x12')][_0xf384da[_0x0f47('0x52')]][_0x0f47('0x5b')]||_0x0f47('0x5c'):'inbound';_0xf384da[_0x0f47('0x78')]=moment()[_0x0f47('0x57')](_0x0f47('0x79'));_0xf384da[_0x0f47('0x7a')]=_0x4354a3[_0x0f47('0x7a')];_0xf384da[_0x0f47('0x7b')]=_0x4354a3[_0x0f47('0x7b')];_0xf384da[_0x0f47('0x50')]=_0x4354a3[_0x0f47('0x50')];_0xf384da['routealias']=this[_0x0f47('0x10')][_0x4354a3['uniqueid']][_0x0f47('0x7c')];logger[_0x0f47('0x73')](_0x0f47('0x7d'),_0xf384da[_0x0f47('0x52')],_0xf384da[_0x0f47('0x5b')]);_[_0x0f47('0x7e')](_0xf384da,_[_0x0f47('0x7f')](_0x4354a3,_['keys'](_0xf384da)));this[_0x0f47('0xd')][_0x4354a3[_0x0f47('0x50')]]['push'](_0xf384da);this[_0x0f47('0x10')][_0x4354a3['uniqueid']]=_0xf384da;this[_0x0f47('0x4c')](_0xf384da,_0x0f47('0x1e'));}}catch(_0x574eef){logger[_0x0f47('0x41')](_0x0f47('0x77'),_0x4354a3[_0x0f47('0x50')],util[_0x0f47('0x43')](_0x574eef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f47('0x39')][_0x0f47('0x80')]=function(_0x215aaa){try{if(this[_0x0f47('0x5f')](_0x215aaa)){logger['debug'](_0x0f47('0x81'),_0x215aaa[_0x0f47('0x50')],util['inspect'](_0x215aaa,{'showHidden':![],'depth':null}));if(this[_0x0f47('0xd')][_0x215aaa[_0x0f47('0x50')]]){var _0x2bb142=_['last'](this['queueReports'][_0x215aaa['uniqueid']]);_0x2bb142['queuecallercomplete']=![];_0x2bb142['queuecallercompleteAt']=null;_0x2bb142['holdtime']=_0x215aaa['holdtime'];_0x2bb142['originalposition']=_0x215aaa['originalposition'];_0x2bb142['queuecallerabandon']=!![];_0x2bb142[_0x0f47('0x82')]=moment()['format'](_0x0f47('0x79'));_0x2bb142[_0x0f47('0x55')]=_0x0f47('0x83');_0x2bb142['lastAssignedTo']=null;logger[_0x0f47('0x73')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2bb142[_0x0f47('0x52')],_0x2bb142[_0x0f47('0x5b')]);this[_0x0f47('0x10')][_0x215aaa[_0x0f47('0x50')]]=_0x2bb142;this[_0x0f47('0x49')](_0x2bb142,_0x0f47('0x20'));}}}catch(_0xfbfa0a){logger['error'](_0x0f47('0x81'),_0x215aaa[_0x0f47('0x50')],util[_0x0f47('0x43')](_0xfbfa0a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f47('0x39')][_0x0f47('0x22')]=function(_0x322184){try{if(this['isNotNull'](_0x322184)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x322184[_0x0f47('0x50')],util[_0x0f47('0x43')](_0x322184,{'showHidden':![],'depth':null}));if(this[_0x0f47('0xd')][_0x322184['uniqueid']]){var _0x529bf7=_[_0x0f47('0x84')](this[_0x0f47('0xd')][_0x322184[_0x0f47('0x50')]]);_0x529bf7[_0x0f47('0x85')]=moment()[_0x0f47('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x529bf7[_0x0f47('0x86')]=_0x322184[_0x0f47('0x86')];_0x529bf7[_0x0f47('0x87')]=_0x322184['connectedlinename'];logger[_0x0f47('0x73')](_0x0f47('0x88'),_0x529bf7[_0x0f47('0x52')],_0x529bf7[_0x0f47('0x5b')],_0x322184['connectedlinenum'],_0x322184[_0x0f47('0x87')]);this['channels'][_0x322184['uniqueid']]=_0x529bf7;this[_0x0f47('0x4c')](_0x529bf7,_0x0f47('0x21'));}}}catch(_0x472efe){logger[_0x0f47('0x41')]('[%s][voiceQueueReport][queuecallerleave]',_0x322184['uniqueid'],util[_0x0f47('0x43')](_0x472efe,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0f47('0x89')]=function(_0x15121c){try{if(this['isNotNull'](_0x15121c)){logger[_0x0f47('0x4d')](_0x0f47('0x8a'),_0x15121c[_0x0f47('0x50')],util[_0x0f47('0x43')](_0x15121c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x15121c['uniqueid']]){var _0xb367fe=_[_0x0f47('0x84')](this[_0x0f47('0xd')][_0x15121c[_0x0f47('0x50')]]);_0xb367fe['queuecallercomplete']=!![];_0xb367fe[_0x0f47('0x55')]=_0x0f47('0x8b');logger[_0x0f47('0x73')](_0x0f47('0x8c'),_0xb367fe['queue'],_0xb367fe[_0x0f47('0x5b')]);}}}catch(_0xc30999){logger[_0x0f47('0x41')](_0x0f47('0x8a'),_0x15121c['uniqueid'],util['inspect'](_0xc30999,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f47('0x39')][_0x0f47('0x24')]=function(_0xd0d51f){try{if(this[_0x0f47('0x5f')](_0xd0d51f)){logger[_0x0f47('0x4d')]('[%s][voiceQueueReport][agentcomplete]',_0xd0d51f[_0x0f47('0x50')],util['inspect'](_0xd0d51f,{'showHidden':![],'depth':null}));if(this[_0x0f47('0xd')][_0xd0d51f[_0x0f47('0x50')]]){var _0x28c72b=_[_0x0f47('0x84')](this[_0x0f47('0xd')][_0xd0d51f[_0x0f47('0x50')]]);_0x28c72b[_0x0f47('0x20')]=![];_0x28c72b[_0x0f47('0x82')]=null;_0x28c72b[_0x0f47('0x8d')]=!![];_0x28c72b[_0x0f47('0x8e')]=_0xd0d51f['membername'];_0x28c72b[_0x0f47('0x8f')]=_0xd0d51f[_0x0f47('0x8f')];_0x28c72b[_0x0f47('0x90')]=!![];_0x28c72b[_0x0f47('0x91')]=![];_0x28c72b[_0x0f47('0x92')]=null;if(!_0x28c72b[_0x0f47('0x93')]){if(_0xd0d51f[_0x0f47('0x94')]==_0x0f47('0x93')){_0x28c72b['queuecallerexitreason']=_0x0f47('0x95');logger[_0x0f47('0x73')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x28c72b[_0x0f47('0x52')],_0x28c72b[_0x0f47('0x5b')]);}else{if(_[_0x0f47('0x96')](_0xd0d51f[_0x0f47('0x3e')][_0x0f47('0x97')](),_0x0f47('0x98'))){if(this[_0x0f47('0xd')][_0xd0d51f['linkedid']]){var _0x1ff7bf=_['last'](this[_0x0f47('0xd')][_0xd0d51f[_0x0f47('0x99')]]);_0x1ff7bf['queuecallercomplete']=![];_0x1ff7bf[_0x0f47('0x91')]=!![];_0x1ff7bf[_0x0f47('0x92')]=moment(_0x28c72b[_0x0f47('0x78')])[_0x0f47('0x9a')](_0xd0d51f[_0x0f47('0x8f')],_0x0f47('0x9b'))[_0x0f47('0x57')](_0x0f47('0x79'));_0x1ff7bf['queuecallerexitreason']='FORWARDTRANSFER';_0x1ff7bf[_0x0f47('0x93')]=!![];_0x1ff7bf[_0x0f47('0x9c')]=_0x0f47('0x9d');_0x1ff7bf['transferexten']=_0xd0d51f[_0x0f47('0x9e')];_0x1ff7bf[_0x0f47('0x9f')]=_0xd0d51f[_0x0f47('0x50')];logger['info'](_0x0f47('0xa0'),_0x1ff7bf[_0x0f47('0x52')],_0x1ff7bf[_0x0f47('0x5b')]);var _0x3bf1cc=this[_0x0f47('0xd')][_0xd0d51f['linkedid']];this[_0x0f47('0xd')][_0xd0d51f[_0x0f47('0x99')]]=this[_0x0f47('0xd')][_0xd0d51f[_0x0f47('0x50')]];this[_0x0f47('0xd')][_0xd0d51f[_0x0f47('0x50')]]=_0x3bf1cc;}}else{_0x28c72b[_0x0f47('0x55')]=_0x0f47('0xa1')+_0xd0d51f[_0x0f47('0x94')][_0x0f47('0xa2')]();logger['info'](_0x0f47('0xa3'),_0x28c72b[_0x0f47('0x52')],_0x28c72b['type'],_0x28c72b['queuecallerexitreason']);}}}this[_0x0f47('0x10')][_0xd0d51f[_0x0f47('0x50')]]=_0x28c72b;}}}catch(_0x1cca23){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0xd0d51f[_0x0f47('0x50')],util['inspect'](_0x1cca23,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0f47('0x26')]=function(_0x553522){try{if(this[_0x0f47('0x5f')](_0x553522)){logger[_0x0f47('0x4d')](_0x0f47('0xa4'),_0x553522['uniqueid'],util[_0x0f47('0x43')](_0x553522,{'showHidden':![],'depth':null}));this[_0x0f47('0xa5')](_0x553522[_0x0f47('0x50')],_['keys'](_0x553522[_0x0f47('0xa6')])[0x0],_0x553522['value']);if(this[_0x0f47('0xd')][_0x553522[_0x0f47('0x50')]]){var _0x28d909=_[_0x0f47('0x84')](this[_0x0f47('0xd')][_0x553522[_0x0f47('0x50')]]);if(_0x28d909){if(this[_0x0f47('0x5f')](_0x553522['variable'])&&this[_0x0f47('0x5f')](_0x553522[_0x0f47('0xa6')]['queuestatus'])){switch(_0x553522['value']){case'CONTINUE':_0x28d909[_0x0f47('0x91')]=![];_0x28d909[_0x0f47('0x92')]=null;break;case'TIMEOUT':_0x28d909[_0x0f47('0xa7')]=_0x0f47('0xa8');_0x28d909[_0x0f47('0x91')]=!![];_0x28d909[_0x0f47('0x92')]=moment()[_0x0f47('0x57')](_0x0f47('0x79'));_0x28d909[_0x0f47('0x85')]=moment()[_0x0f47('0x57')](_0x0f47('0x79'));logger[_0x0f47('0x4d')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x553522[_0x0f47('0x50')],util[_0x0f47('0x43')](_0x28d909,{'showHidden':![],'depth':null}));ami[_0x0f47('0x4b')](_0x0f47('0xa9'),_0x28d909);break;default:_0x28d909['queuecallerexit']=!![];_0x28d909['queuecallerexitAt']=moment()[_0x0f47('0x57')](_0x0f47('0x79'));_0x28d909['queuecallerleaveAt']=moment()[_0x0f47('0x57')]('YYYY-MM-DD\x20HH:mm:ss');}_0x28d909[_0x0f47('0x20')]=![];_0x28d909[_0x0f47('0x82')]=null;_0x28d909[_0x0f47('0x55')]=_0x553522[_0x0f47('0xaa')];this[_0x0f47('0x10')][_0x553522[_0x0f47('0x50')]]=_0x28d909;this[_0x0f47('0x49')](_0x28d909,_0x0f47('0xab'));}else if(this['isNotNull'](_0x553522[_0x0f47('0xa6')])&&this[_0x0f47('0x5f')](_0x553522[_0x0f47('0xa6')][_0x0f47('0xac')])){if(!_0x28d909[_0x0f47('0x20')]){_0x28d909['queuecallerexit']=!![];_0x28d909[_0x0f47('0x92')]=moment()[_0x0f47('0x57')](_0x0f47('0x79'));_0x28d909[_0x0f47('0x55')]=_0x0f47('0xad');_0x28d909['queuecallerleaveAt']=moment()[_0x0f47('0x57')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x553522[_0x0f47('0x50')]]=_0x28d909;}}logger[_0x0f47('0x73')](_0x0f47('0xae'),_0x553522[_0x0f47('0x50')],_0x28d909[_0x0f47('0x52')],_0x28d909[_0x0f47('0x5b')],_[_0x0f47('0xaf')](_0x553522[_0x0f47('0xa6')])[0x0],_0x553522['value']);_0x28d909[_0x0f47('0x15')]=this[_0x0f47('0x15')][_0x553522[_0x0f47('0x50')]];}}}}catch(_0x3fb313){logger[_0x0f47('0x41')](_0x0f47('0xa4'),_0x553522[_0x0f47('0x50')],util[_0x0f47('0x43')](_0x3fb313,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0f47('0x39')]['addVariable']=function(_0x21bb3c,_0x3876c6,_0x4109ff){var _0x192310=[_0x0f47('0xb0'),'rtpaudioqosbridged',_0x0f47('0xb1'),_0x0f47('0xb2'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x0f47('0xb3'),'rtpaudioqosrttbridged',_0x0f47('0xb4'),_0x0f47('0xb5'),_0x0f47('0xb6'),_0x0f47('0xb7'),_0x0f47('0xb8'),'memberdynamic',_0x0f47('0xb9'),_0x0f47('0xba'),'membername','memberpenalty',_0x0f47('0xbb')];if(!_['isNil'](_0x3876c6)&&!_[_0x0f47('0xbc')](_0x192310,_0x3876c6)){if(_[_0x0f47('0x60')](this[_0x0f47('0x15')][_0x21bb3c])){this[_0x0f47('0x15')][_0x21bb3c]={};}this[_0x0f47('0x15')][_0x21bb3c][_0x3876c6]=_0x4109ff;}};VoiceQueueReport[_0x0f47('0x39')][_0x0f47('0xbd')]=function(_0x4c36e1,_0x4f5bbc,_0x45c605){var _0x96c0af={};for(var _0xd61193=0x0;_0xd61193=0x0?moment(_0x4282df[_0xfb1b('0x19')])['diff'](_0x4282df['starttime'],_0xfb1b('0xe')):null,'data1':_0xfb1b('0x1a'),'data2':_0x4282df['accountcode'],'data3':_0x4282df[_0xfb1b('0x1b')],'data4':_0x4282df[_0xfb1b('0x1c')]||null,'role':_0xfb1b('0x12'),'internal':_0x4282df[_0xfb1b('0x13')]?_['toNumber'](_0x4282df[_0xfb1b('0x13')]):undefined,'uniqueid':_0x4282df['uniqueid']},'log':_0xfb1b('0x8')});}; \ No newline at end of file +var _0x9b40=['dialstring','moment','lodash','util','../client','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','outbound','exten'];(function(_0x37464d,_0x29bf11){var _0x4e7573=function(_0x4de5e3){while(--_0x4de5e3){_0x37464d['push'](_0x37464d['shift']());}};_0x4e7573(++_0x29bf11);}(_0x9b40,0x1c3));var _0x09b4=function(_0x1f455a,_0xa0dbbb){_0x1f455a=_0x1f455a-0x0;var _0x3aa220=_0x9b40[_0x1f455a];return _0x3aa220;};'use strict';var moment=require(_0x09b4('0x0'));var _=require(_0x09b4('0x1'));var util=require(_0x09b4('0x2'));var client=require(_0x09b4('0x3'));exports['voiceQueueReport']=function(_0x1f42b4){var _0x24fd35=_0x1f42b4['queuecallercompleteAt']||_0x1f42b4[_0x09b4('0x4')];return client[_0x09b4('0x5')](_0x09b4('0x6'),{'body':{'channel':_0x09b4('0x7'),'membername':_0x1f42b4['lastAssignedTo'],'interface':_[_0x09b4('0x8')](_0x1f42b4[_0x09b4('0x9')])?util[_0x09b4('0xa')](_0x09b4('0xb'),_0x1f42b4[_0x09b4('0xc')]):_0x1f42b4[_0x09b4('0x9')],'type':_0x09b4('0xd'),'enterAt':_0x1f42b4[_0x09b4('0xe')],'exitAt':_0x24fd35,'duration':moment(_0x24fd35)[_0x09b4('0xf')](_0x1f42b4[_0x09b4('0xe')],_0x09b4('0x10')),'data1':_0x09b4('0x11'),'data2':_0x1f42b4[_0x09b4('0x12')],'data3':_0x1f42b4['exten'],'data4':null,'data5':_0x1f42b4[_0x09b4('0x13')],'role':_0x09b4('0x14'),'internal':_0x1f42b4[_0x09b4('0x15')]?_[_0x09b4('0x16')](_0x1f42b4[_0x09b4('0x15')]):undefined,'uniqueid':_0x1f42b4[_0x09b4('0x17')]},'log':_0x09b4('0x6')});};exports[_0x09b4('0x18')]=function(_0x36e573){return client[_0x09b4('0x5')](_0x09b4('0x6'),{'body':{'channel':_0x09b4('0x7'),'membername':_0x36e573['membername'],'interface':_0x36e573[_0x09b4('0x9')],'type':_0x09b4('0xd'),'enterAt':_0x36e573[_0x09b4('0x19')],'exitAt':_0x36e573[_0x09b4('0x1a')],'duration':moment(_0x36e573[_0x09b4('0x1a')])[_0x09b4('0xf')](_0x36e573[_0x09b4('0x19')],_0x09b4('0x10'))>=0x0?moment(_0x36e573[_0x09b4('0x1a')])[_0x09b4('0xf')](_0x36e573[_0x09b4('0x19')],'seconds'):null,'data1':_0x09b4('0x1b'),'data2':_0x36e573[_0x09b4('0x15')],'data3':_0x36e573[_0x09b4('0x1c')],'data4':_0x36e573[_0x09b4('0x1d')]||null,'role':_0x09b4('0x14'),'internal':_0x36e573[_0x09b4('0x15')]?_[_0x09b4('0x16')](_0x36e573['accountcode']):undefined,'uniqueid':_0x36e573[_0x09b4('0x17')]},'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 403a5ec..ca74f8e 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 _0xa7b5=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xa7b5,0x162));var _0x5a7b=function(_0x1bc696,_0x1d6ba8){_0x1bc696=_0x1bc696-0x0;var _0x33e2ad=_0xa7b5[_0x1bc696];return _0x33e2ad;};'use strict';var client=require(_0x5a7b('0x0'));exports[_0x5a7b('0x1')]=function(){return client[_0x5a7b('0x2')](_0x5a7b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5a7b('0x4'),'previewRecallmeReminderInterval']},'log':_0x5a7b('0x5')});}; \ No newline at end of file +var _0x1219=['stopRecordingOnTransfer','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9121('0x0'));exports[_0x9121('0x1')]=function(){return client[_0x9121('0x2')](_0x9121('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9121('0x4'),'previewRecallmeReminderInterval']},'log':_0x9121('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7bd044f..bb9cb19 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 _0x6c05=['../client','getTemplates','GetTemplate','name','html'];(function(_0x394515,_0x87b540){var _0x4ead4d=function(_0x4e3de8){while(--_0x4e3de8){_0x394515['push'](_0x394515['shift']());}};_0x4ead4d(++_0x87b540);}(_0x6c05,0x64));var _0x56c0=function(_0x187984,_0x21a80b){_0x187984=_0x187984-0x0;var _0x44d6d1=_0x6c05[_0x187984];return _0x44d6d1;};'use strict';var client=require(_0x56c0('0x0'));exports[_0x56c0('0x1')]=function(_0x3a5998){return function(_0x4bc192){return client['Request'](_0x56c0('0x2'),{'options':{'raw':!![],'attributes':['id',_0x56c0('0x3'),_0x56c0('0x4')]},'log':_0x56c0('0x2')});};}; \ No newline at end of file +var _0x5236=['../client','getTemplates','Request','name','html'];(function(_0x4026bf,_0x41385d){var _0x60b065=function(_0xc01e1d){while(--_0xc01e1d){_0x4026bf['push'](_0x4026bf['shift']());}};_0x60b065(++_0x41385d);}(_0x5236,0x109));var _0x6523=function(_0x163d96,_0x6e775f){_0x163d96=_0x163d96-0x0;var _0x47299c=_0x5236[_0x163d96];return _0x47299c;};'use strict';var client=require(_0x6523('0x0'));exports[_0x6523('0x1')]=function(_0xf13e7c){return function(_0x411c47){return client[_0x6523('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x6523('0x3'),_0x6523('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e199446..e5bce96 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 _0x967f=['operator','value','Condition','AnyConditions','Action','data1','data2','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','AllConditions','field'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x967f,0xa3));var _0xf967=function(_0x39049b,_0x2550a5){_0x39049b=_0x39049b-0x0;var _0x2a74f1=_0x967f[_0x39049b];return _0x2a74f1;};'use strict';var client=require(_0xf967('0x0'));exports[_0xf967('0x1')]=function(_0x31fe62){return function(_0x1044cf){return client[_0xf967('0x2')](_0xf967('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf967('0x4'),_0xf967('0x5')],'include':[{'model':'Condition','as':_0xf967('0x6'),'attributes':['id',_0xf967('0x7'),_0xf967('0x8'),_0xf967('0x9')]},{'model':_0xf967('0xa'),'as':_0xf967('0xb'),'attributes':['id',_0xf967('0x7'),_0xf967('0x8'),'value']},{'model':_0xf967('0xc'),'as':'Actions','attributes':['id','action',_0xf967('0xd'),_0xf967('0xe'),'data3',_0xf967('0xf'),_0xf967('0x10'),_0xf967('0x11'),_0xf967('0x12')]}]},'log':_0xf967('0x3')});};}; \ No newline at end of file +var _0x8f10=['operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data5','data6','GetTrigger','../client','getTriggers','Request','name','channel','status','Condition','AllConditions','field'];(function(_0x30e830,_0x9475e2){var _0x545513=function(_0x42952b){while(--_0x42952b){_0x30e830['push'](_0x30e830['shift']());}};_0x545513(++_0x9475e2);}(_0x8f10,0x19b));var _0x08f1=function(_0x551550,_0x58a3f7){_0x551550=_0x551550-0x0;var _0x58c9fb=_0x8f10[_0x551550];return _0x58c9fb;};'use strict';var client=require(_0x08f1('0x0'));exports[_0x08f1('0x1')]=function(_0x4c685a){return function(_0x11fa8c){return client[_0x08f1('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x08f1('0x3'),_0x08f1('0x4'),_0x08f1('0x5')],'include':[{'model':_0x08f1('0x6'),'as':_0x08f1('0x7'),'attributes':['id',_0x08f1('0x8'),_0x08f1('0x9'),_0x08f1('0xa')]},{'model':_0x08f1('0x6'),'as':_0x08f1('0xb'),'attributes':['id',_0x08f1('0x8'),_0x08f1('0x9'),_0x08f1('0xa')]},{'model':_0x08f1('0xc'),'as':_0x08f1('0xd'),'attributes':['id',_0x08f1('0xe'),_0x08f1('0xf'),_0x08f1('0x10'),_0x08f1('0x11'),'data4',_0x08f1('0x12'),_0x08f1('0x13'),'data7']}]},'log':_0x08f1('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e33c8fb..bf3c45e 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 _0x22df=['Request','registry','GetTrunk','../client','getTrunks'];(function(_0x2c0fd1,_0x1b54ea){var _0x4c9a81=function(_0x5d1b50){while(--_0x5d1b50){_0x2c0fd1['push'](_0x2c0fd1['shift']());}};_0x4c9a81(++_0x1b54ea);}(_0x22df,0xda));var _0xf22d=function(_0x2d6e4c,_0x60b377){_0x2d6e4c=_0x2d6e4c-0x0;var _0x133419=_0x22df[_0x2d6e4c];return _0x133419;};'use strict';var client=require(_0xf22d('0x0'));exports[_0xf22d('0x1')]=function(_0x4add6a){return function(_0x5bce26){return client[_0xf22d('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xf22d('0x3'),'defaultuser']},'log':_0xf22d('0x4')});};}; \ No newline at end of file +var _0x8323=['Request','name','registry','defaultuser','GetTrunk','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8323,0x8f));var _0x3832=function(_0xb0787e,_0xab707f){_0xb0787e=_0xb0787e-0x0;var _0x1cdcd6=_0x8323[_0xb0787e];return _0x1cdcd6;};'use strict';var client=require(_0x3832('0x0'));exports['getTrunks']=function(_0x4a5a1b){return function(_0x5336f7){return client[_0x3832('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3832('0x2'),_0x3832('0x3'),_0x3832('0x4')]},'log':_0x3832('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b62c39e..485cab7 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe706,0xa3));var _0x6e70=function(_0xa81926,_0x38e368){_0xa81926=_0xa81926-0x0;var _0x8177ef=_0xe706[_0xa81926];return _0x8177ef;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x3c82ac,_0x104a4c){var _0x3be1c6=function(_0x4ee6c2){while(--_0x4ee6c2){_0x3c82ac['push'](_0x3c82ac['shift']());}};_0x3be1c6(++_0x104a4c);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index dc6f5fe..7f87fdc 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 _0x6ffc=['UpdateVoiceAgentReport','Request','CreateVoiceAgentReport','update'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x6ffc,0x7d));var _0xc6ff=function(_0x4a87d8,_0x86db22){_0x4a87d8=_0x4a87d8-0x0;var _0x1b2c9c=_0x6ffc[_0x4a87d8];return _0x1b2c9c;};'use strict';var client=require('../client');exports['create']=function(_0x16c63c){return client[_0xc6ff('0x0')](_0xc6ff('0x1'),{'body':_0x16c63c,'log':'CreateVoiceAgentReport'});};exports[_0xc6ff('0x2')]=function(_0x21505e,_0x277492,_0x1b88b4){return client[_0xc6ff('0x0')](_0xc6ff('0x3'),{'body':_0x21505e,'options':{'where':{'uniqueid':_0x277492,'interface':_0x1b88b4,'agentcomplete':!![]}},'log':_0xc6ff('0x3')});}; \ No newline at end of file +var _0xd881=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xd881,0xff));var _0x1d88=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd881[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x1d88('0x0'));exports[_0x1d88('0x1')]=function(_0x1c0a3a){return client[_0x1d88('0x2')](_0x1d88('0x3'),{'body':_0x1c0a3a,'log':'CreateVoiceAgentReport'});};exports[_0x1d88('0x4')]=function(_0xc2dd0c,_0x52d564,_0x32551f){return client[_0x1d88('0x2')](_0x1d88('0x5'),{'body':_0xc2dd0c,'options':{'where':{'uniqueid':_0x52d564,'interface':_0x32551f,'agentcomplete':!![]}},'log':_0x1d88('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6106b79..3ca41e7 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 _0x584f=['GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','calleridnum','DOCUMENTATION'];(function(_0x4fb264,_0x1d30ce){var _0x571cf9=function(_0x7cc893){while(--_0x7cc893){_0x4fb264['push'](_0x4fb264['shift']());}};_0x571cf9(++_0x1d30ce);}(_0x584f,0x172));var _0xf584=function(_0x53c26d,_0x4ad64e){_0x53c26d=_0x53c26d-0x0;var _0x5727d6=_0x584f[_0x53c26d];return _0x5727d6;};'use strict';var moment=require(_0xf584('0x0'));var util=require(_0xf584('0x1'));var _=require('lodash');var client=require(_0xf584('0x2'));exports[_0xf584('0x3')]=function(_0x578cfd){return client[_0xf584('0x4')](_0xf584('0x5'),{'body':_['merge'](_0x578cfd,{'source':_0x578cfd[_0xf584('0x6')],'destinationcontext':_0x578cfd['context'],'callerid':_0x578cfd['callerid'],'amaflags':_0xf584('0x7')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0xf584('0x4')](_0xf584('0x8'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xf584('0x9')](_0xf584('0xa'))[_0xf584('0xb')](_0xf584('0xc')),moment()[_0xf584('0xd')](_0xf584('0xa'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xf584('0xe'),_0xf584('0xf'),_0xf584('0x10')]},'log':_0xf584('0x11')});};}; \ No newline at end of file +var _0x2613=['util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','billableseconds','GetVoiceCallReports'];(function(_0x82b489,_0x2e9388){var _0x1d4795=function(_0x228d4b){while(--_0x228d4b){_0x82b489['push'](_0x82b489['shift']());}};_0x1d4795(++_0x2e9388);}(_0x2613,0x1ce));var _0x3261=function(_0xfc4ce3,_0x417f0d){_0xfc4ce3=_0xfc4ce3-0x0;var _0x2fb706=_0x2613[_0xfc4ce3];return _0x2fb706;};'use strict';var moment=require('moment');var util=require(_0x3261('0x0'));var _=require(_0x3261('0x1'));var client=require(_0x3261('0x2'));exports[_0x3261('0x3')]=function(_0x54b169){return client[_0x3261('0x4')](_0x3261('0x5'),{'body':_['merge'](_0x54b169,{'source':_0x54b169[_0x3261('0x6')],'destinationcontext':_0x54b169[_0x3261('0x7')],'callerid':_0x54b169['callerid'],'amaflags':_0x3261('0x8')}),'log':_0x3261('0x5')});};exports[_0x3261('0x9')]=function(){return function(){return client[_0x3261('0x4')](_0x3261('0xa'),{'options':{'where':{'type':[_0x3261('0xb')],'createdAt':{'$between':[moment()[_0x3261('0xc')](_0x3261('0xd'))[_0x3261('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x3261('0xf')](_0x3261('0xd'))[_0x3261('0xe')](_0x3261('0x10'))]}},'attributes':['type',_0x3261('0x11'),_0x3261('0x12'),_0x3261('0x13')]},'log':_0x3261('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 7eb40b3..5c73cfc 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 _0xfe0c=['CreateVoiceDialReport','../client','Request'];(function(_0x32b4ea,_0x2a5d47){var _0x473238=function(_0x2123bf){while(--_0x2123bf){_0x32b4ea['push'](_0x32b4ea['shift']());}};_0x473238(++_0x2a5d47);}(_0xfe0c,0xf4));var _0xcfe0=function(_0x4fa277,_0x16c55a){_0x4fa277=_0x4fa277-0x0;var _0x1ed46e=_0xfe0c[_0x4fa277];return _0x1ed46e;};'use strict';var client=require(_0xcfe0('0x0'));exports['create']=function(_0x144209){return client[_0xcfe0('0x1')](_0xcfe0('0x2'),{'body':_0x144209,'log':_0xcfe0('0x2')});}; \ No newline at end of file +var _0x1821=['../client','create','Request','CreateVoiceDialReport'];(function(_0x5b3788,_0x189ea5){var _0x206cbc=function(_0x3659ee){while(--_0x3659ee){_0x5b3788['push'](_0x5b3788['shift']());}};_0x206cbc(++_0x189ea5);}(_0x1821,0x194));var _0x1182=function(_0xfb7477,_0xeef23a){_0xfb7477=_0xfb7477-0x0;var _0x14c911=_0x1821[_0xfb7477];return _0x14c911;};'use strict';var client=require(_0x1182('0x0'));exports[_0x1182('0x1')]=function(_0x633c16){return client[_0x1182('0x2')](_0x1182('0x3'),{'body':_0x633c16,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 38971a2..857045a 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 _0x6f2f=['recordingFormat','../client','getVoiceExtensions'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x6f2f[_0x456fb1];return _0x4083d6;};'use strict';var client=require(_0xf6f2('0x0'));exports[_0xf6f2('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xf6f2('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x3140=['getVoiceExtensions','Request','GetVoiceExtension','../client'];(function(_0x496f7a,_0x5d8af0){var _0x2a70f6=function(_0x2c2a0c){while(--_0x2c2a0c){_0x496f7a['push'](_0x496f7a['shift']());}};_0x2a70f6(++_0x5d8af0);}(_0x3140,0xaf));var _0x0314=function(_0x19cfac,_0x3745dc){_0x19cfac=_0x19cfac-0x0;var _0x25d2a5=_0x3140[_0x19cfac];return _0x25d2a5;};'use strict';var client=require(_0x0314('0x0'));exports[_0x0314('0x1')]=function(){return function(){return client[_0x0314('0x2')](_0x0314('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x0314('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5908ce2..445fb7f 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 _0xa5ad=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject'];(function(_0xfb0fd2,_0x57bf5c){var _0x7510b1=function(_0x3e9a2a){while(--_0x3e9a2a){_0xfb0fd2['push'](_0xfb0fd2['shift']());}};_0x7510b1(++_0x57bf5c);}(_0xa5ad,0x67));var _0xda5a=function(_0x1bf34b,_0x3b3bf0){_0x1bf34b=_0x1bf34b-0x0;var _0xacbff8=_0xa5ad[_0x1bf34b];return _0xacbff8;};'use strict';var client=require(_0xda5a('0x0'));exports[_0xda5a('0x1')]=function(){return function(){return client[_0xda5a('0x2')](_0xda5a('0x3'),{'options':{'raw':![],'attributes':['id',_0xda5a('0x4'),'acw',_0xda5a('0x5'),'autopause','monitor_format',_0xda5a('0x6'),_0xda5a('0x7'),'dialMethod','dialLimitChannel',_0xda5a('0x8'),_0xda5a('0x9'),_0xda5a('0xa'),_0xda5a('0xb'),_0xda5a('0xc'),_0xda5a('0xd'),_0xda5a('0xe'),_0xda5a('0xf'),_0xda5a('0x10'),_0xda5a('0x11'),_0xda5a('0x12'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0xda5a('0x13'),_0xda5a('0x14'),_0xda5a('0x15'),_0xda5a('0x16'),'dialGlobalMaxRetry',_0xda5a('0x17'),_0xda5a('0x18'),_0xda5a('0x19'),_0xda5a('0x1a'),_0xda5a('0x1b'),'dialAMDInitialSilence','dialAMDGreeting',_0xda5a('0x1c'),'dialAMDTotalAnalysisTime',_0xda5a('0x1d'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xda5a('0x1e'),_0xda5a('0x1f'),_0xda5a('0x20'),_0xda5a('0x21'),_0xda5a('0x22'),_0xda5a('0x23'),_0xda5a('0x24'),_0xda5a('0x25'),_0xda5a('0x26'),_0xda5a('0x27'),'strategy',_0xda5a('0x28'),_0xda5a('0x29'),_0xda5a('0x2a'),_0xda5a('0x2b'),_0xda5a('0x2c'),_0xda5a('0x2d'),'dialAbandonedMaxRetry',_0xda5a('0x2e'),_0xda5a('0x2f'),'dialMachineRetryFrequency',_0xda5a('0x30'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0xda5a('0x31'),_0xda5a('0x32'),_0xda5a('0x33'),_0xda5a('0x34')],'include':[{'model':_0xda5a('0x35'),'as':'Trunk','attributes':['id',_0xda5a('0x4'),'callerid',_0xda5a('0x36')]},{'model':_0xda5a('0x37'),'as':_0xda5a('0x38'),'attributes':['id',_0xda5a('0x4')]},{'model':_0xda5a('0x35'),'as':_0xda5a('0x39'),'attributes':['id',_0xda5a('0x4'),'callerid','active']},{'model':_0xda5a('0x3a'),'as':_0xda5a('0x3a'),'attributes':['id',_0xda5a('0x4')],'include':[{'model':_0xda5a('0x3a'),'as':_0xda5a('0x3b'),'attributes':['id',_0xda5a('0x4'),_0xda5a('0x3c')]}]}]},'log':_0xda5a('0x1')});};}; \ No newline at end of file +var _0x6443=['Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','getVoiceQueues','Request','name','acwTimeout','monitor_format','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0x22a9b4,_0x4adefa){var _0x275e70=function(_0x2017eb){while(--_0x2017eb){_0x22a9b4['push'](_0x22a9b4['shift']());}};_0x275e70(++_0x4adefa);}(_0x6443,0x164));var _0x3644=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x6443[_0x5e28c2];return _0x1a8cc6;};'use strict';var client=require('../client');exports[_0x3644('0x0')]=function(){return function(){return client[_0x3644('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x3644('0x2'),'acw',_0x3644('0x3'),'autopause',_0x3644('0x4'),_0x3644('0x5'),_0x3644('0x6'),'dialMethod','dialLimitChannel',_0x3644('0x7'),_0x3644('0x8'),_0x3644('0x9'),_0x3644('0xa'),_0x3644('0xb'),_0x3644('0xc'),_0x3644('0xd'),_0x3644('0xe'),_0x3644('0xf'),_0x3644('0x10'),_0x3644('0x11'),_0x3644('0x12'),'dialCongestionRetryFrequency',_0x3644('0x13'),'dialBusyRetryFrequency',_0x3644('0x14'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval',_0x3644('0x15'),_0x3644('0x16'),_0x3644('0x17'),_0x3644('0x18'),_0x3644('0x19'),_0x3644('0x1a'),_0x3644('0x1b'),_0x3644('0x1c'),_0x3644('0x1d'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x3644('0x1e'),'timeout',_0x3644('0x1f'),_0x3644('0x20'),_0x3644('0x21'),_0x3644('0x22'),_0x3644('0x23'),_0x3644('0x24'),_0x3644('0x4'),_0x3644('0x25'),_0x3644('0x26'),_0x3644('0x27'),_0x3644('0x28'),_0x3644('0x29'),'dialDropMaxRetry',_0x3644('0x2a'),_0x3644('0x2b'),_0x3644('0x2c'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x3644('0x2d'),_0x3644('0x2e'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x3644('0x2f'),_0x3644('0x30'),_0x3644('0x31')],'include':[{'model':_0x3644('0x32'),'as':_0x3644('0x32'),'attributes':['id','name',_0x3644('0x33'),_0x3644('0x34')]},{'model':_0x3644('0x35'),'as':_0x3644('0x36'),'attributes':['id',_0x3644('0x2')]},{'model':_0x3644('0x32'),'as':_0x3644('0x37'),'attributes':['id',_0x3644('0x2'),_0x3644('0x33'),_0x3644('0x34')]},{'model':_0x3644('0x38'),'as':_0x3644('0x38'),'attributes':['id',_0x3644('0x2')],'include':[{'model':_0x3644('0x38'),'as':_0x3644('0x39'),'attributes':['id',_0x3644('0x2'),'interval']}]}]},'log':_0x3644('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b4aabef..b4a3de7 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(_0x25b88b,_0x565a8e){var _0x341dc4=function(_0x4133b7){while(--_0x4133b7){_0x25b88b['push'](_0x25b88b['shift']());}};_0x341dc4(++_0x565a8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x12641b,_0x218312){var _0x5e82cf=function(_0x42a01f){while(--_0x42a01f){_0x12641b['push'](_0x12641b['shift']());}};_0x5e82cf(++_0x218312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 9df8f42..43d7a3b 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 _0x5ac1=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x33e247,_0x110d6d){var _0x4d265e=function(_0x2a7790){while(--_0x2a7790){_0x33e247['push'](_0x33e247['shift']());}};_0x4d265e(++_0x110d6d);}(_0x5ac1,0x106));var _0x15ac=function(_0x4dd59e,_0x13be8d){_0x4dd59e=_0x4dd59e-0x0;var _0x48de19=_0x5ac1[_0x4dd59e];return _0x48de19;};'use strict';var client=require('../client');exports[_0x15ac('0x0')]=function(_0x58301c){return function(){return client[_0x15ac('0x1')](_0x15ac('0x2'),{'options':{'where':{'VoiceQueueId':_0x58301c,'paused':!![]},'raw':!![]},'log':_0x15ac('0x0')});};}; \ No newline at end of file +var _0x1bf6=['Request','../client','getVoiceQueueRtPauses'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x1bf6,0x15d));var _0x61bf=function(_0x54b455,_0x2f2057){_0x54b455=_0x54b455-0x0;var _0x16390a=_0x1bf6[_0x54b455];return _0x16390a;};'use strict';var client=require(_0x61bf('0x0'));exports[_0x61bf('0x1')]=function(_0x308af8){return function(){return client[_0x61bf('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x308af8,'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 5ef555a..72bada8 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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3700ac,_0x58c5c8){var _0x2d2325=function(_0x288923){while(--_0x288923){_0x3700ac['push'](_0x3700ac['shift']());}};_0x2d2325(++_0x58c5c8);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x5a984d,_0x14b91f){var _0x44a167=function(_0x185392){while(--_0x185392){_0x5a984d['push'](_0x5a984d['shift']());}};_0x44a167(++_0x14b91f);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e7843ab..ddbebb8 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 _0x5cfa=['transfertargetexten','transfertargetlinkedid','origtransfererexten','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','attendedTransfer','result','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext'];(function(_0x3be11f,_0x8f0c2a){var _0x4aeb72=function(_0x55ec70){while(--_0x55ec70){_0x3be11f['push'](_0x3be11f['shift']());}};_0x4aeb72(++_0x8f0c2a);}(_0x5cfa,0x1a7));var _0xa5cf=function(_0x34304d,_0x24ff5c){_0x34304d=_0x34304d-0x0;var _0x17e0b0=_0x5cfa[_0x34304d];return _0x17e0b0;};'use strict';var client=require('../client');exports[_0xa5cf('0x0')]={};exports[_0xa5cf('0x1')]=function(_0x57a4f8){return client[_0xa5cf('0x2')](_0xa5cf('0x3'),{'body':{'result':_0x57a4f8['result'],'transfererchannel':_0x57a4f8[_0xa5cf('0x4')],'transferercalleridnum':_0x57a4f8['transferercalleridnum'],'transferercalleridname':_0x57a4f8['transferercalleridname'],'transfererconnectedlinenum':_0x57a4f8['transfererconnectedlinenum'],'transfererconnectedlinename':_0x57a4f8[_0xa5cf('0x5')],'transfereraccountcode':_0x57a4f8[_0xa5cf('0x6')],'transferercontext':_0x57a4f8[_0xa5cf('0x7')],'transfererexten':_0x57a4f8[_0xa5cf('0x8')],'transfererlinkedid':_0x57a4f8[_0xa5cf('0x9')],'transfereechannel':_0x57a4f8[_0xa5cf('0xa')],'transfereecalleridnum':_0x57a4f8[_0xa5cf('0xb')],'transfereecalleridname':_0x57a4f8[_0xa5cf('0xc')],'transfereeconnectedlinenum':_0x57a4f8[_0xa5cf('0xd')],'transfereeconnectedlinename':_0x57a4f8['transfereeconnectedlinename'],'transfereeaccountcode':_0x57a4f8[_0xa5cf('0xe')],'transfereecontext':_0x57a4f8[_0xa5cf('0xf')],'transfereeexten':_0x57a4f8[_0xa5cf('0x10')],'transfereelinkedid':_0x57a4f8[_0xa5cf('0x11')],'isexternal':_0x57a4f8['isexternal'],'context':_0x57a4f8[_0xa5cf('0x12')],'extension':_0x57a4f8['extension'],'type':'blind'},'log':_0xa5cf('0x3')});};exports[_0xa5cf('0x13')]=function(_0x4e8c40){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4e8c40[_0xa5cf('0x14')],'transfererchannel':_0x4e8c40['origtransfererchannel'],'transferercalleridnum':_0x4e8c40['origtransferercalleridnum'],'transferercalleridname':_0x4e8c40[_0xa5cf('0x15')],'transfererconnectedlinenum':_0x4e8c40[_0xa5cf('0x16')],'transfererconnectedlinename':_0x4e8c40[_0xa5cf('0x17')],'transfereraccountcode':_0x4e8c40[_0xa5cf('0x18')],'transferercontext':_0x4e8c40[_0xa5cf('0x19')],'transfererexten':_0x4e8c40['secondtransfererexten'],'transfererlinkedid':_0x4e8c40[_0xa5cf('0x1a')],'transfereechannel':_0x4e8c40[_0xa5cf('0x1b')],'transfereecalleridnum':_0x4e8c40[_0xa5cf('0x1c')],'transfereecalleridname':_0x4e8c40['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4e8c40[_0xa5cf('0x1d')],'transfereeconnectedlinename':_0x4e8c40[_0xa5cf('0x1e')],'transfereeaccountcode':_0x4e8c40['transfertargetaccountcode'],'transfereecontext':_0x4e8c40[_0xa5cf('0x1f')],'transfereeexten':_0x4e8c40[_0xa5cf('0x20')],'transfereelinkedid':_0x4e8c40[_0xa5cf('0x21')],'isexternal':_0x4e8c40['isexternal'],'context':_0x4e8c40['origtransferercontext'],'extension':_0x4e8c40[_0xa5cf('0x22')],'type':'attended'},'log':_0xa5cf('0x3')});}; \ No newline at end of file +var _0x4c0e=['origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','CreateVoiceTransferReport','origtransfererchannel'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x4c0e,0x1d5));var _0xe4c0=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0x4c0e[_0x5814ca];return _0xeb1833;};'use strict';var client=require(_0xe4c0('0x0'));exports[_0xe4c0('0x1')]={};exports[_0xe4c0('0x2')]=function(_0x38ad8f){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x38ad8f[_0xe4c0('0x3')],'transfererchannel':_0x38ad8f[_0xe4c0('0x4')],'transferercalleridnum':_0x38ad8f[_0xe4c0('0x5')],'transferercalleridname':_0x38ad8f[_0xe4c0('0x6')],'transfererconnectedlinenum':_0x38ad8f[_0xe4c0('0x7')],'transfererconnectedlinename':_0x38ad8f[_0xe4c0('0x8')],'transfereraccountcode':_0x38ad8f[_0xe4c0('0x9')],'transferercontext':_0x38ad8f['transferercontext'],'transfererexten':_0x38ad8f[_0xe4c0('0xa')],'transfererlinkedid':_0x38ad8f[_0xe4c0('0xb')],'transfereechannel':_0x38ad8f[_0xe4c0('0xc')],'transfereecalleridnum':_0x38ad8f[_0xe4c0('0xd')],'transfereecalleridname':_0x38ad8f['transfereecalleridname'],'transfereeconnectedlinenum':_0x38ad8f[_0xe4c0('0xe')],'transfereeconnectedlinename':_0x38ad8f[_0xe4c0('0xf')],'transfereeaccountcode':_0x38ad8f['transfereeaccountcode'],'transfereecontext':_0x38ad8f[_0xe4c0('0x10')],'transfereeexten':_0x38ad8f['transfereeexten'],'transfereelinkedid':_0x38ad8f[_0xe4c0('0x11')],'isexternal':_0x38ad8f[_0xe4c0('0x12')],'context':_0x38ad8f[_0xe4c0('0x13')],'extension':_0x38ad8f[_0xe4c0('0x14')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0xe4c0('0x15')]=function(_0x2afde5){return client[_0xe4c0('0x16')](_0xe4c0('0x17'),{'body':{'result':_0x2afde5['result'],'transfererchannel':_0x2afde5[_0xe4c0('0x18')],'transferercalleridnum':_0x2afde5[_0xe4c0('0x19')],'transferercalleridname':_0x2afde5['origtransferercalleridname'],'transfererconnectedlinenum':_0x2afde5[_0xe4c0('0x1a')],'transfererconnectedlinename':_0x2afde5[_0xe4c0('0x1b')],'transfereraccountcode':_0x2afde5['origtransfereraccountcode'],'transferercontext':_0x2afde5['secondtransferercontext'],'transfererexten':_0x2afde5[_0xe4c0('0x1c')],'transfererlinkedid':_0x2afde5['origtransfererlinkedid'],'transfereechannel':_0x2afde5[_0xe4c0('0x1d')],'transfereecalleridnum':_0x2afde5[_0xe4c0('0x1e')],'transfereecalleridname':_0x2afde5['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2afde5[_0xe4c0('0x1f')],'transfereeconnectedlinename':_0x2afde5[_0xe4c0('0x20')],'transfereeaccountcode':_0x2afde5[_0xe4c0('0x21')],'transfereecontext':_0x2afde5[_0xe4c0('0x22')],'transfereeexten':_0x2afde5['transfertargetexten'],'transfereelinkedid':_0x2afde5[_0xe4c0('0x23')],'isexternal':_0x2afde5[_0xe4c0('0x12')],'context':_0x2afde5['origtransferercontext'],'extension':_0x2afde5[_0xe4c0('0x24')],'type':_0xe4c0('0x25')},'log':_0xe4c0('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b51e302..06019d8 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 _0x0faf=['wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','length','map','resolve','destinationchannel','stop','StopMixMonitor\x20Success','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','Redirect','exten','context','telephones','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','reload','module','action','Action','then','message','catch','isConnected','error','command','Command','content','voiceQueues','push','find','omit','undefined','values','channels','uniqueid','channel','%s.%s','filename'];(function(_0x2de866,_0x2327ff){var _0x361fe6=function(_0x4eaef6){while(--_0x4eaef6){_0x2de866['push'](_0x2de866['shift']());}};_0x361fe6(++_0x2327ff);}(_0x0faf,0x132));var _0xf0fa=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0x0faf[_0x10d0f0];return _0x93e308;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var jayson=require(_0xf0fa('0x1'));var schema=require(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var config=require(_0xf0fa('0x4'));var properties=require(_0xf0fa('0x5'));var ami=require(_0xf0fa('0x6'));var VoiceQueueSummary=require(_0xf0fa('0x7'));exports[_0xf0fa('0x8')]=function(_0x283f04,_0x5d9b58,_0x3637a3){return new Promise(function(_0x44ffa0,_0x25b5c4){var _0x3a703b={'QueuePause':function(_0x2db1d9){return new Promise(function(_0x587865){var _0x42f7fd=util[_0xf0fa('0x9')]('%s/%s','SIP',_0x2db1d9[_0xf0fa('0xa')]);if(_0x283f04[_0xf0fa('0xb')]&&_0x283f04[_0xf0fa('0xb')][_0x42f7fd]&&_0x283f04[_0xf0fa('0xb')][_0x42f7fd][_0xf0fa('0xc')]){_0x283f04[_0xf0fa('0xb')][_0x42f7fd][_0xf0fa('0xd')]();}if(_0x283f04[_0xf0fa('0xe')][_0x42f7fd]){_0x283f04['agents'][_0x42f7fd][_0xf0fa('0xf')]({'statePause':_0x2db1d9['pause']?!![]:![]});}_0x587865({'code':0xc8,'message':_0xf0fa('0x10')});});},'Reload':function(_0x521034){var _0x39ae2b=this;return new Promise(function(_0x17326f,_0x39a086){if(ami['isConnected']()==![]){return _0x39a086(_0x39ae2b['error'](0x1f4,[config[_0xf0fa('0x11')]['ip'],config['asterisk'][_0xf0fa('0x12')],_0xf0fa('0x13')][_0xf0fa('0x14')]('\x20')));}_0x521034=_[_0xf0fa('0x15')](_0x521034,_[_0xf0fa('0x16')](properties[_0xf0fa('0x17')][_0xf0fa('0x18')]));_0x521034[_0xf0fa('0x19')]='Reload';return ami[_0xf0fa('0x1a')](_0x521034)[_0xf0fa('0x1b')](function(_0x30ce17){_0x17326f({'code':0xc8,'message':_0x30ce17[_0xf0fa('0x1c')]});})[_0xf0fa('0x1d')](function(_0x386e5f){_0x39a086(_0x39ae2b['error'](0x1f5,_0x386e5f['message']));});});},'Command':function(_0x2f376d){var _0x2751cc=this;return new Promise(function(_0x151d09,_0x2385e2){if(ami[_0xf0fa('0x1e')]()==![]){return _0x2385e2(_0x2751cc[_0xf0fa('0x1f')](0x1f4,[config[_0xf0fa('0x11')]['ip'],config[_0xf0fa('0x11')][_0xf0fa('0x12')],_0xf0fa('0x13')][_0xf0fa('0x14')]('\x20')));}_0x2f376d=_['pick'](_0x2f376d,_0xf0fa('0x20'));_0x2f376d[_0xf0fa('0x19')]=_0xf0fa('0x21');return ami[_0xf0fa('0x1a')](_0x2f376d)[_0xf0fa('0x1b')](function(_0x2b22c5){_0x151d09({'code':0xc8,'message':_0x2b22c5[_0xf0fa('0x22')]});})[_0xf0fa('0x1d')](function(_0x3feb0c){_0x2385e2(_0x2751cc['error'](0x1f5,_0x3feb0c[_0xf0fa('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x19e392){var _0x56134e=[];for(var _0x3b5d7d in _0x283f04[_0xf0fa('0x23')]){if(_0x283f04[_0xf0fa('0x23')]['hasOwnProperty'](_0x3b5d7d)){var _0xded80d=_0x283f04[_0xf0fa('0x23')][_0x3b5d7d];var _0x3d10fb=new VoiceQueueSummary(_0xded80d);_0x56134e[_0xf0fa('0x24')](_0x3d10fb);}}_0x19e392({'count':_0x56134e['length'],'rows':_0x56134e});});},'UpdateVoiceQueue':function(_0x4be235){return new Promise(function(_0x287810,_0x1c5eaf){var _0x1679cf=_[_0xf0fa('0x25')](_0x283f04['voiceQueues'],{'id':parseInt(_0x4be235['id'])});var _0x4058d6=_[_0xf0fa('0x26')](_0x4be235,['id']);if(_0x1679cf){for(var _0x1279cf in _0x4058d6){if(typeof _0x4058d6[_0x1279cf]!=='undefined'&&typeof _0x1679cf[_0x1279cf]!==_0xf0fa('0x27')){_0x1679cf[_0x1279cf]=_0x4058d6[_0x1279cf];}}_0x287810(_0x1679cf);}else{_0x1c5eaf();}});},'VoiceChannels':function(){return new Promise(function(_0x593697){var _0x42c656=_[_0xf0fa('0x28')](_0x283f04[_0xf0fa('0x29')]);_0x593697({'count':_0x42c656['length'],'rows':_0x42c656});});},'VoiceChannelMixMonitor':function(_0x35d202){var _0x33cc64=this;return new Promise(function(_0x574ba7,_0x212986){if(ami[_0xf0fa('0x1e')]()==![]){return _0x212986(_0x33cc64[_0xf0fa('0x1f')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf0fa('0x12')],_0xf0fa('0x13')]['join']('\x20')));}var _0x38cf8c=schema(properties['voicechannel'])['validate'](_0x35d202);if(_0x38cf8c['length']>0x0){return _0x212986(_0x33cc64[_0xf0fa('0x1f')](0x1f4,_['map'](_0x38cf8c,_0xf0fa('0x1c'))[_0xf0fa('0x14')](',\x20')));}var _0x5e1d57=_[_0xf0fa('0x25')](_0x283f04[_0xf0fa('0x29')],{'uniqueid':_0x35d202[_0xf0fa('0x2a')]});if(_0x5e1d57&&_0x5e1d57[_0xf0fa('0x2b')]){var _0xe61cb7=util['format'](_0xf0fa('0x2c'),_0x35d202[_0xf0fa('0x2d')]||_0x35d202[_0xf0fa('0x2a')],_0x35d202['format']||_0xf0fa('0x2e'));return ami[_0xf0fa('0x1a')]({'action':_0xf0fa('0x2f'),'channel':_0x5e1d57[_0xf0fa('0x2b')],'file':_0xe61cb7,'options':'ai(mixmonitorid)'})['then'](function(_0x2a9f4b){var _0x68b3fe=_[_0xf0fa('0x25')](_0x5e1d57[_0xf0fa('0x30')],{'filename':_0xf0fa('0x31')+_0xe61cb7['toLowerCase']()});if(_['isNil'](_0x68b3fe)){_0x5e1d57['monitors']['push']({'filename':_0xf0fa('0x31')+_0xe61cb7[_0xf0fa('0x32')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x2a9f4b[_0xf0fa('0x33')],'status':_0xf0fa('0x34')});}else{_0x68b3fe[_0xf0fa('0x33')]=_0x2a9f4b[_0xf0fa('0x33')];_0x68b3fe[_0xf0fa('0x35')]=_0xf0fa('0x34');}_0x574ba7({'code':0xc8,'message':[_0x35d202[_0xf0fa('0x2a')],'MixMonitor\x20Success',_0x2a9f4b['mixmonitorid']][_0xf0fa('0x14')]('\x20'),'mixmonitorid':_0x2a9f4b[_0xf0fa('0x33')]});})[_0xf0fa('0x1d')](function(_0x46e376){_0x212986(_0x33cc64[_0xf0fa('0x1f')](0x1f5,[_0x35d202[_0xf0fa('0x2a')],_0x46e376['message'][_0xf0fa('0x32')]()]['join']('\x20')));});}else{return _0x212986(_0x33cc64[_0xf0fa('0x1f')](0x1f5,_0xf0fa('0x36')));}});},'VoiceChannelStopMixMonitor':function(_0x6e1fd9){var _0x4107ba=this;return new Promise(function(_0x14bee8,_0x8cce53){if(ami[_0xf0fa('0x1e')]()==![]){return _0x8cce53(_0x4107ba[_0xf0fa('0x1f')](0x1f4,[config[_0xf0fa('0x11')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xf0fa('0x14')]('\x20')));}var _0x34be72=schema(properties['voicechannel'])[_0xf0fa('0x2')](_0x6e1fd9);if(_0x34be72[_0xf0fa('0x37')]>0x0){return _0x8cce53(_0x4107ba[_0xf0fa('0x1f')](0x1f4,_[_0xf0fa('0x38')](_0x34be72,'message')[_0xf0fa('0x14')](',\x20')));}var _0x1f3916=_[_0xf0fa('0x25')](_0x283f04[_0xf0fa('0x29')],{'uniqueid':_0x6e1fd9[_0xf0fa('0x2a')]});if(_0x1f3916){return Promise[_0xf0fa('0x39')]()[_0xf0fa('0x1b')](function(){if(_0x1f3916[_0xf0fa('0x2b')]){return ami[_0xf0fa('0x1a')]({'action':'StopMixMonitor','channel':_0x1f3916[_0xf0fa('0x2b')],'mixmonitorid':_0x6e1fd9[_0xf0fa('0x33')]})[_0xf0fa('0x1d')](function(){});}})[_0xf0fa('0x1b')](function(){if(_0x1f3916[_0xf0fa('0x3a')]){return ami[_0xf0fa('0x1a')]({'action':'StopMixMonitor','channel':_0x1f3916[_0xf0fa('0x3a')],'mixmonitorid':_0x6e1fd9[_0xf0fa('0x33')]})['catch'](function(){});}})[_0xf0fa('0x1b')](function(){var _0x235e99=_[_0xf0fa('0x25')](_0x1f3916[_0xf0fa('0x30')],{'mixmonitorid':_0x6e1fd9[_0xf0fa('0x33')]});if(_0x235e99){_0x235e99[_0xf0fa('0x35')]=_0xf0fa('0x3b');}})[_0xf0fa('0x1b')](function(){var _0x35272e=util['format'](_0xf0fa('0x2c'),_0x6e1fd9['filename']||_0x6e1fd9[_0xf0fa('0x2a')],_0x6e1fd9[_0xf0fa('0x9')]||_0xf0fa('0x2e'));var _0x569ba9=_[_0xf0fa('0x25')](_0x1f3916[_0xf0fa('0x30')],{'filename':_0xf0fa('0x31')+_0x35272e[_0xf0fa('0x32')]()});if(_0x569ba9){_0x569ba9[_0xf0fa('0x35')]='stop';}})[_0xf0fa('0x1b')](function(){_0x14bee8({'code':0xc8,'message':[_0x6e1fd9['uniqueid'],_0xf0fa('0x3c')][_0xf0fa('0x14')]('\x20')});})[_0xf0fa('0x1d')](function(_0x141087){_0x8cce53(_0x4107ba[_0xf0fa('0x1f')](0x1f5,[_0x6e1fd9['uniqueid'],_0x141087[_0xf0fa('0x1c')][_0xf0fa('0x32')]()][_0xf0fa('0x14')]('\x20')));});}else{return _0x8cce53(_0x4107ba[_0xf0fa('0x1f')](0x1f5,_0xf0fa('0x36')));}});},'VoiceQueuesChannels':function(_0x29f3d0){var _0x52e781=this;return new Promise(function(_0x44a3bf){var _0x5e1e8e=_['values'](_0x283f04['queueChannels']);var _0x31a192={'count':_0x5e1e8e[_0xf0fa('0x37')],'rows':_0x5e1e8e};if(_0x29f3d0&&_0x29f3d0[_0xf0fa('0x3d')]){if(![_0xf0fa('0x3e'),_0xf0fa('0x3f')][_0xf0fa('0x40')](_0x29f3d0[_0xf0fa('0x3d')])){return _0x25b5c4(_0x52e781[_0xf0fa('0x1f')](0x190,_0xf0fa('0x41')));}var _0x506b2f=_[_0xf0fa('0x42')](_0x5e1e8e,function(_0x5c4f0c){return _0x5c4f0c[_0xf0fa('0x3d')]===_0x29f3d0[_0xf0fa('0x3d')];});_0x31a192[_0xf0fa('0x43')]=_0x506b2f[_0xf0fa('0x37')];_0x31a192['rows']=_0x506b2f;}_0x44a3bf(_0x31a192);});},'VoiceQueuesChannel':function(_0x36e343){var _0x5844a3=this;return new Promise(function(_0x2f0e8e,_0x398ea0){var _0x10b45c=schema(properties[_0xf0fa('0x44')])[_0xf0fa('0x2')](_0x36e343);if(_0x10b45c[_0xf0fa('0x37')]>0x0){return _0x398ea0(_0x5844a3['error'](0x1f4,_[_0xf0fa('0x38')](_0x10b45c,_0xf0fa('0x1c'))['join'](',\x20')));}var _0x4498b3=_[_0xf0fa('0x25')](_0x283f04['queueChannels'],{'uniqueid':_0x36e343[_0xf0fa('0x2a')]});if(_0x4498b3){_0x2f0e8e(_0x4498b3);}else{return _0x398ea0(_0x5844a3[_0xf0fa('0x1f')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0xd01a7a){var _0x3c5014=this;return new Promise(function(_0xd7cd1a,_0x4db972){if(ami[_0xf0fa('0x1e')]()==![]){return _0x4db972(_0x3c5014[_0xf0fa('0x1f')](0x1f4,[config['asterisk']['ip'],config[_0xf0fa('0x11')][_0xf0fa('0x12')],_0xf0fa('0x13')]['join']('\x20')));}var _0x3ac82c=schema(properties[_0xf0fa('0x45')])['validate'](_0xd01a7a);if(_0x3ac82c[_0xf0fa('0x37')]>0x0){return _0x4db972(_0x3c5014[_0xf0fa('0x1f')](0x1f4,_[_0xf0fa('0x38')](_0x3ac82c,_0xf0fa('0x1c'))[_0xf0fa('0x14')](',\x20')));}var _0x19c816=_[_0xf0fa('0x25')](_0x283f04[_0xf0fa('0x46')],{'uniqueid':_0xd01a7a[_0xf0fa('0x2a')]});if(_0x19c816&&_0x19c816[_0xf0fa('0x2b')]){return ami['Action']({'action':_0xf0fa('0x47'),'channel':_0x19c816[_0xf0fa('0x2b')]})[_0xf0fa('0x1b')](function(_0x664a0d){_0xd7cd1a({'code':0xc8,'message':[_0xd01a7a[_0xf0fa('0x2a')],_0x664a0d[_0xf0fa('0x1c')][_0xf0fa('0x32')]()]['join']('\x20')});})[_0xf0fa('0x1d')](function(_0x195632){_0x4db972(_0x3c5014[_0xf0fa('0x1f')](0x1f5,[_0xd01a7a[_0xf0fa('0x2a')],_0x195632[_0xf0fa('0x1c')][_0xf0fa('0x32')]()][_0xf0fa('0x14')]('\x20')));});}else{return _0x4db972(_0x3c5014['error'](0x1f5,_0xf0fa('0x36')));}});},'VoiceQueuesChannelRedirect':function(_0x150076){var _0x2e21ba=this;return new Promise(function(_0x1f608e,_0x473e3d){if(ami['isConnected']()==![]){return _0x473e3d(_0x2e21ba['error'](0x1f4,[config['asterisk']['ip'],config[_0xf0fa('0x11')][_0xf0fa('0x12')],_0xf0fa('0x13')][_0xf0fa('0x14')]('\x20')));}var _0x508df9=schema(properties['voicequeuechannelredirect'])[_0xf0fa('0x2')](_0x150076);if(_0x508df9['length']>0x0){return _0x473e3d(_0x2e21ba[_0xf0fa('0x1f')](0x1f4,_[_0xf0fa('0x38')](_0x508df9,_0xf0fa('0x1c'))[_0xf0fa('0x14')](',\x20')));}var _0x1b4c03=_['find'](_0x283f04[_0xf0fa('0x46')],{'uniqueid':_0x150076[_0xf0fa('0x2a')]});if(_0x1b4c03&&_0x1b4c03[_0xf0fa('0x2b')]){return ami[_0xf0fa('0x1a')]({'action':_0xf0fa('0x48'),'channel':_0x1b4c03[_0xf0fa('0x2b')],'exten':_0x150076[_0xf0fa('0x49')],'context':_0x150076[_0xf0fa('0x4a')]||_0x1b4c03[_0xf0fa('0x4a')],'priority':0x1})['then'](function(_0x5b166d){_0x1f608e({'code':0xc8,'message':[_0x150076[_0xf0fa('0x2a')],_0x5b166d['message'][_0xf0fa('0x32')]()]['join']('\x20')});})['catch'](function(_0x4a851b){_0x473e3d(_0x2e21ba[_0xf0fa('0x1f')](0x1f5,[_0x150076[_0xf0fa('0x2a')],_0x4a851b[_0xf0fa('0x1c')][_0xf0fa('0x32')]()][_0xf0fa('0x14')]('\x20')));});}else{return _0x473e3d(_0x2e21ba[_0xf0fa('0x1f')](0x1f5,_0xf0fa('0x36')));}});},'Agents':function(_0x2b7965){return new Promise(function(_0x2a5a11){var _0x1cd67c=_['values'](_0x283f04[_0xf0fa('0xe')]);if(_0x2b7965&&_0x2b7965['id']){var _0x5de588=_[_0xf0fa('0x25')](_0x1cd67c,function(_0x56c701){return _0x56c701['id']===_0x2b7965['id'];});_0x2a5a11(_0x5de588);}else{_0x2a5a11({'count':_0x1cd67c[_0xf0fa('0x37')],'rows':_0x1cd67c});}});},'Telephones':function(){return new Promise(function(_0x499e82){var _0xfc616e=_['values'](_0x283f04[_0xf0fa('0x4b')]);_0x499e82({'count':_0xfc616e[_0xf0fa('0x37')],'rows':_0xfc616e});});},'Trunks':function(){return new Promise(function(_0x274ae3){var _0x17ab19=_[_0xf0fa('0x28')](_0x283f04['trunks']);_0x274ae3({'count':_0x17ab19['length'],'rows':_0x17ab19});});},'OutboundChannels':function(){return new Promise(function(_0x4224ce){var _0x157772=_['values'](_0x283f04['outboundChannels']);_0x4224ce({'count':_0x157772[_0xf0fa('0x37')],'rows':_0x157772});});},'Outbound':function(){return new Promise(function(_0x1390d8){_0x1390d8(_0x283f04[_0xf0fa('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0x38b507){var _0x2748ef=_['values'](_0x283f04[_0xf0fa('0x4c')]);_0x38b507({'count':_0x2748ef[_0xf0fa('0x37')],'rows':_0x2748ef});});},'VoiceQueuesPreview':function(_0x16492b){var _0x5ab304=this;return new Promise(function(_0x5c2839,_0x82277a){_0x5d9b58[_0xf0fa('0x4d')](_0x16492b['id'])['then'](function(_0x4c1032){_0x5c2839({'code':0xc8,'message':_0x4c1032[_0xf0fa('0x1c')]});})[_0xf0fa('0x1d')](function(_0x22cf95){_0x82277a(_0x5ab304['error'](0x1f4,_0x22cf95['message']));});});},'EventManager':function(_0x516eec){var _0x39711c=this;return new Promise(function(_0x4df165,_0x5a27e8){if(!_0x516eec[_0xf0fa('0x4e')]){return _0x5a27e8(_0x39711c[_0xf0fa('0x1f')](0x1f4,_0xf0fa('0x4f')));}ami[_0xf0fa('0x50')](_0xf0fa('0x51')+_0x516eec[_0xf0fa('0x4e')],_0x516eec['message']);_0x4df165({'code':0xc8,'message':_0x516eec});});},'FaxAccounts':function(){return new Promise(function(_0x1b538a){var _0x18281f=_[_0xf0fa('0x28')](_0x283f04['faxAccounts']);_0x1b538a({'count':_0x18281f[_0xf0fa('0x37')],'rows':_0x18281f});});},'SendFax':function(_0x4b803f){var _0x4e8263=this;return new Promise(function(_0x21a479,_0x5141d4){_0x3637a3['send'](_0x4b803f)[_0xf0fa('0x1b')](function(_0x418ee8){_0x21a479({'code':0xc8,'message':_0x418ee8[_0xf0fa('0x1c')]});})['catch'](function(_0xe1b0ff){_0x5141d4(_0x4e8263[_0xf0fa('0x1f')](0x1f4,_0xe1b0ff['message']));});});},'CheckAfterSend':function(_0x6fc2af){var _0xb8aff2=this;return new Promise(function(_0x22c518,_0xe232f8){_0x3637a3[_0xf0fa('0x52')](_0x6fc2af)[_0xf0fa('0x1b')](function(_0x56265f){_0x22c518({'code':0xc8,'message':_0x56265f[_0xf0fa('0x1c')]});})['catch'](function(_0x101751){_0xe232f8(_0xb8aff2[_0xf0fa('0x1f')](0x1f4,_0x101751[_0xf0fa('0x1c')]));});});}};var _0x487ed0=jayson[_0xf0fa('0x53')](_0x3a703b)[_0xf0fa('0x54')]();_0x487ed0['on'](_0xf0fa('0x1f'),function(_0x578ca0){return _0x25b5c4(_0x578ca0);});_0x487ed0['listen'](0x232a,_0xf0fa('0x55'),function(){console[_0xf0fa('0x56')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x44ffa0(_0xf0fa('0x57')+0x232a);});});}; \ No newline at end of file +var _0x5162=['pick','keys','reload','module','action','Action','then','catch','message','Command','content','voiceQueues','hasOwnProperty','push','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','type','inbound','outbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','event','faxAccounts','send','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5162,0x103));var _0x2516=function(_0x6cf2c7,_0x27a3a0){_0x6cf2c7=_0x6cf2c7-0x0;var _0x4d0752=_0x5162[_0x6cf2c7];return _0x4d0752;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var moment=require('moment');var config=require(_0x2516('0x1'));var properties=require(_0x2516('0x2'));var ami=require(_0x2516('0x3'));var VoiceQueueSummary=require(_0x2516('0x4'));exports[_0x2516('0x5')]=function(_0x25dce6,_0x3a7984,_0x5b71b5){return new Promise(function(_0x48f411,_0x5beeb3){var _0x20a4a4={'QueuePause':function(_0xba4b36){return new Promise(function(_0xa1557){var _0x3a8834=util[_0x2516('0x6')](_0x2516('0x7'),_0x2516('0x8'),_0xba4b36['name']);if(_0x25dce6[_0x2516('0x9')]&&_0x25dce6[_0x2516('0x9')][_0x3a8834]&&_0x25dce6[_0x2516('0x9')][_0x3a8834]['timer']){_0x25dce6['timers'][_0x3a8834]['updateAcw']();}if(_0x25dce6['agents'][_0x3a8834]){_0x25dce6[_0x2516('0xa')][_0x3a8834][_0x2516('0xb')]({'statePause':_0xba4b36[_0x2516('0xc')]?!![]:![]});}_0xa1557({'code':0xc8,'message':_0x2516('0xd')});});},'Reload':function(_0x56c69c){var _0x33496b=this;return new Promise(function(_0x458aca,_0x171da2){if(ami[_0x2516('0xe')]()==![]){return _0x171da2(_0x33496b[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')][_0x2516('0x11')],_0x2516('0x12')][_0x2516('0x13')]('\x20')));}_0x56c69c=_[_0x2516('0x14')](_0x56c69c,_[_0x2516('0x15')](properties[_0x2516('0x16')][_0x2516('0x17')]));_0x56c69c[_0x2516('0x18')]='Reload';return ami[_0x2516('0x19')](_0x56c69c)[_0x2516('0x1a')](function(_0x1a1005){_0x458aca({'code':0xc8,'message':_0x1a1005['message']});})[_0x2516('0x1b')](function(_0x5e96c7){_0x171da2(_0x33496b['error'](0x1f5,_0x5e96c7[_0x2516('0x1c')]));});});},'Command':function(_0x3583cf){var _0x151168=this;return new Promise(function(_0x618aed,_0x198b93){if(ami[_0x2516('0xe')]()==![]){return _0x198b93(_0x151168[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')][_0x2516('0x11')],_0x2516('0x12')][_0x2516('0x13')]('\x20')));}_0x3583cf=_[_0x2516('0x14')](_0x3583cf,'command');_0x3583cf['action']=_0x2516('0x1d');return ami[_0x2516('0x19')](_0x3583cf)[_0x2516('0x1a')](function(_0x2d5b1b){_0x618aed({'code':0xc8,'message':_0x2d5b1b[_0x2516('0x1e')]});})[_0x2516('0x1b')](function(_0x3d906d){_0x198b93(_0x151168[_0x2516('0xf')](0x1f5,_0x3d906d['message']));});});},'VoiceQueues':function(){return new Promise(function(_0xa4538d){var _0x39c63f=[];for(var _0x774b60 in _0x25dce6[_0x2516('0x1f')]){if(_0x25dce6['voiceQueues'][_0x2516('0x20')](_0x774b60)){var _0x30eeb9=_0x25dce6[_0x2516('0x1f')][_0x774b60];var _0x3d728a=new VoiceQueueSummary(_0x30eeb9);_0x39c63f[_0x2516('0x21')](_0x3d728a);}}_0xa4538d({'count':_0x39c63f['length'],'rows':_0x39c63f});});},'UpdateVoiceQueue':function(_0x3c5c3c){return new Promise(function(_0x1750e7,_0x935035){var _0x2cb847=_[_0x2516('0x22')](_0x25dce6[_0x2516('0x1f')],{'id':parseInt(_0x3c5c3c['id'])});var _0x556f01=_[_0x2516('0x23')](_0x3c5c3c,['id']);if(_0x2cb847){for(var _0x20dc9f in _0x556f01){if(typeof _0x556f01[_0x20dc9f]!=='undefined'&&typeof _0x2cb847[_0x20dc9f]!==_0x2516('0x24')){_0x2cb847[_0x20dc9f]=_0x556f01[_0x20dc9f];}}_0x1750e7(_0x2cb847);}else{_0x935035();}});},'VoiceChannels':function(){return new Promise(function(_0x1de031){var _0x4527f1=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x26')]);_0x1de031({'count':_0x4527f1[_0x2516('0x27')],'rows':_0x4527f1});});},'VoiceChannelMixMonitor':function(_0x2e92f2){var _0x3c1daf=this;return new Promise(function(_0x10f9ec,_0x12d790){if(ami[_0x2516('0xe')]()==![]){return _0x12d790(_0x3c1daf[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')][_0x2516('0x11')],'ami\x20disconnected'][_0x2516('0x13')]('\x20')));}var _0x54147b=schema(properties[_0x2516('0x28')])['validate'](_0x2e92f2);if(_0x54147b[_0x2516('0x27')]>0x0){return _0x12d790(_0x3c1daf['error'](0x1f4,_[_0x2516('0x29')](_0x54147b,_0x2516('0x1c'))[_0x2516('0x13')](',\x20')));}var _0x261cff=_[_0x2516('0x22')](_0x25dce6[_0x2516('0x26')],{'uniqueid':_0x2e92f2[_0x2516('0x2a')]});if(_0x261cff&&_0x261cff[_0x2516('0x2b')]){var _0x1ad634=util['format'](_0x2516('0x2c'),_0x2e92f2[_0x2516('0x2d')]||_0x2e92f2[_0x2516('0x2a')],_0x2e92f2[_0x2516('0x6')]||'wav');return ami['Action']({'action':_0x2516('0x2e'),'channel':_0x261cff[_0x2516('0x2b')],'file':_0x1ad634,'options':_0x2516('0x2f')})[_0x2516('0x1a')](function(_0x45c12e){var _0x164f07=_[_0x2516('0x22')](_0x261cff[_0x2516('0x30')],{'filename':_0x2516('0x31')+_0x1ad634[_0x2516('0x32')]()});if(_['isNil'](_0x164f07)){_0x261cff['monitors'][_0x2516('0x21')]({'filename':_0x2516('0x31')+_0x1ad634['toLowerCase'](),'createdAt':moment()['format'](_0x2516('0x33')),'mixmonitorid':_0x45c12e[_0x2516('0x34')],'status':'rec'});}else{_0x164f07[_0x2516('0x34')]=_0x45c12e['mixmonitorid'];_0x164f07[_0x2516('0x35')]=_0x2516('0x36');}_0x10f9ec({'code':0xc8,'message':[_0x2e92f2['uniqueid'],_0x2516('0x37'),_0x45c12e[_0x2516('0x34')]][_0x2516('0x13')]('\x20'),'mixmonitorid':_0x45c12e[_0x2516('0x34')]});})[_0x2516('0x1b')](function(_0x25c33a){_0x12d790(_0x3c1daf[_0x2516('0xf')](0x1f5,[_0x2e92f2[_0x2516('0x2a')],_0x25c33a[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')));});}else{return _0x12d790(_0x3c1daf[_0x2516('0xf')](0x1f5,_0x2516('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x4c832b){var _0x1b72cd=this;return new Promise(function(_0x1bc0e,_0x5debf2){if(ami[_0x2516('0xe')]()==![]){return _0x5debf2(_0x1b72cd[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')][_0x2516('0x11')],'ami\x20disconnected'][_0x2516('0x13')]('\x20')));}var _0xe5bc76=schema(properties[_0x2516('0x28')])[_0x2516('0x39')](_0x4c832b);if(_0xe5bc76[_0x2516('0x27')]>0x0){return _0x5debf2(_0x1b72cd[_0x2516('0xf')](0x1f4,_['map'](_0xe5bc76,_0x2516('0x1c'))[_0x2516('0x13')](',\x20')));}var _0xe64acc=_[_0x2516('0x22')](_0x25dce6[_0x2516('0x26')],{'uniqueid':_0x4c832b[_0x2516('0x2a')]});if(_0xe64acc){return Promise[_0x2516('0x3a')]()['then'](function(){if(_0xe64acc[_0x2516('0x2b')]){return ami['Action']({'action':_0x2516('0x3b'),'channel':_0xe64acc['channel'],'mixmonitorid':_0x4c832b[_0x2516('0x34')]})[_0x2516('0x1b')](function(){});}})[_0x2516('0x1a')](function(){if(_0xe64acc['destinationchannel']){return ami['Action']({'action':_0x2516('0x3b'),'channel':_0xe64acc[_0x2516('0x3c')],'mixmonitorid':_0x4c832b['mixmonitorid']})['catch'](function(){});}})[_0x2516('0x1a')](function(){var _0x147e05=_[_0x2516('0x22')](_0xe64acc['monitors'],{'mixmonitorid':_0x4c832b[_0x2516('0x34')]});if(_0x147e05){_0x147e05['status']=_0x2516('0x3d');}})[_0x2516('0x1a')](function(){var _0x318128=util[_0x2516('0x6')]('%s.%s',_0x4c832b[_0x2516('0x2d')]||_0x4c832b[_0x2516('0x2a')],_0x4c832b[_0x2516('0x6')]||_0x2516('0x3e'));var _0x43874c=_['find'](_0xe64acc[_0x2516('0x30')],{'filename':_0x2516('0x31')+_0x318128[_0x2516('0x32')]()});if(_0x43874c){_0x43874c[_0x2516('0x35')]='stop';}})[_0x2516('0x1a')](function(){_0x1bc0e({'code':0xc8,'message':[_0x4c832b[_0x2516('0x2a')],_0x2516('0x3f')][_0x2516('0x13')]('\x20')});})[_0x2516('0x1b')](function(_0x4f805d){_0x5debf2(_0x1b72cd[_0x2516('0xf')](0x1f5,[_0x4c832b[_0x2516('0x2a')],_0x4f805d[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')));});}else{return _0x5debf2(_0x1b72cd[_0x2516('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4f3eba){var _0x54e8df=this;return new Promise(function(_0x323590){var _0x4f7eb4=_['values'](_0x25dce6['queueChannels']);var _0x5e7cb={'count':_0x4f7eb4[_0x2516('0x27')],'rows':_0x4f7eb4};if(_0x4f3eba&&_0x4f3eba[_0x2516('0x40')]){if(![_0x2516('0x41'),_0x2516('0x42')]['includes'](_0x4f3eba[_0x2516('0x40')])){return _0x5beeb3(_0x54e8df[_0x2516('0xf')](0x190,_0x2516('0x43')));}var _0x4f75cd=_[_0x2516('0x44')](_0x4f7eb4,function(_0x350206){return _0x350206['type']===_0x4f3eba[_0x2516('0x40')];});_0x5e7cb[_0x2516('0x45')]=_0x4f75cd[_0x2516('0x27')];_0x5e7cb[_0x2516('0x46')]=_0x4f75cd;}_0x323590(_0x5e7cb);});},'VoiceQueuesChannel':function(_0x185298){var _0x5d92cb=this;return new Promise(function(_0x47edff,_0x2a877a){var _0x526b15=schema(properties[_0x2516('0x47')])['validate'](_0x185298);if(_0x526b15[_0x2516('0x27')]>0x0){return _0x2a877a(_0x5d92cb[_0x2516('0xf')](0x1f4,_[_0x2516('0x29')](_0x526b15,_0x2516('0x1c'))[_0x2516('0x13')](',\x20')));}var _0x4751fd=_[_0x2516('0x22')](_0x25dce6[_0x2516('0x48')],{'uniqueid':_0x185298[_0x2516('0x2a')]});if(_0x4751fd){_0x47edff(_0x4751fd);}else{return _0x2a877a(_0x5d92cb[_0x2516('0xf')](0x1f5,_0x2516('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x4f095a){var _0x1b2493=this;return new Promise(function(_0x6c7d5f,_0x3adc8c){if(ami['isConnected']()==![]){return _0x3adc8c(_0x1b2493[_0x2516('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x2516('0x10')][_0x2516('0x11')],_0x2516('0x12')]['join']('\x20')));}var _0x566224=schema(properties['voicequeuechannelhangup'])[_0x2516('0x39')](_0x4f095a);if(_0x566224[_0x2516('0x27')]>0x0){return _0x3adc8c(_0x1b2493[_0x2516('0xf')](0x1f4,_[_0x2516('0x29')](_0x566224,'message')[_0x2516('0x13')](',\x20')));}var _0x20a267=_[_0x2516('0x22')](_0x25dce6['queueChannels'],{'uniqueid':_0x4f095a[_0x2516('0x2a')]});if(_0x20a267&&_0x20a267[_0x2516('0x2b')]){return ami[_0x2516('0x19')]({'action':_0x2516('0x49'),'channel':_0x20a267[_0x2516('0x2b')]})[_0x2516('0x1a')](function(_0x26b897){_0x6c7d5f({'code':0xc8,'message':[_0x4f095a[_0x2516('0x2a')],_0x26b897[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')});})[_0x2516('0x1b')](function(_0xa10d29){_0x3adc8c(_0x1b2493['error'](0x1f5,[_0x4f095a[_0x2516('0x2a')],_0xa10d29[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')));});}else{return _0x3adc8c(_0x1b2493[_0x2516('0xf')](0x1f5,_0x2516('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0x314c28){var _0x496001=this;return new Promise(function(_0x3ce0d6,_0xab7abf){if(ami[_0x2516('0xe')]()==![]){return _0xab7abf(_0x496001[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x331d78=schema(properties[_0x2516('0x4a')])[_0x2516('0x39')](_0x314c28);if(_0x331d78[_0x2516('0x27')]>0x0){return _0xab7abf(_0x496001['error'](0x1f4,_['map'](_0x331d78,_0x2516('0x1c'))['join'](',\x20')));}var _0x1c0540=_[_0x2516('0x22')](_0x25dce6['queueChannels'],{'uniqueid':_0x314c28[_0x2516('0x2a')]});if(_0x1c0540&&_0x1c0540[_0x2516('0x2b')]){return ami[_0x2516('0x19')]({'action':_0x2516('0x4b'),'channel':_0x1c0540[_0x2516('0x2b')],'exten':_0x314c28[_0x2516('0x4c')],'context':_0x314c28[_0x2516('0x4d')]||_0x1c0540[_0x2516('0x4d')],'priority':0x1})[_0x2516('0x1a')](function(_0x4c86a3){_0x3ce0d6({'code':0xc8,'message':[_0x314c28['uniqueid'],_0x4c86a3[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')});})['catch'](function(_0x23610d){_0xab7abf(_0x496001['error'](0x1f5,[_0x314c28[_0x2516('0x2a')],_0x23610d[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')));});}else{return _0xab7abf(_0x496001[_0x2516('0xf')](0x1f5,_0x2516('0x38')));}});},'Agents':function(_0x3d0d99){return new Promise(function(_0x3379f8){var _0x6029a3=_[_0x2516('0x25')](_0x25dce6['agents']);if(_0x3d0d99&&_0x3d0d99['id']){var _0x4eac04=_[_0x2516('0x22')](_0x6029a3,function(_0x598f4a){return _0x598f4a['id']===_0x3d0d99['id'];});_0x3379f8(_0x4eac04);}else{_0x3379f8({'count':_0x6029a3['length'],'rows':_0x6029a3});}});},'Telephones':function(){return new Promise(function(_0x12e768){var _0x3960b3=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x4e')]);_0x12e768({'count':_0x3960b3[_0x2516('0x27')],'rows':_0x3960b3});});},'Trunks':function(){return new Promise(function(_0x371c06){var _0x1808fa=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x4f')]);_0x371c06({'count':_0x1808fa['length'],'rows':_0x1808fa});});},'OutboundChannels':function(){return new Promise(function(_0xe966c8){var _0x2e1029=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x50')]);_0xe966c8({'count':_0x2e1029['length'],'rows':_0x2e1029});});},'Outbound':function(){return new Promise(function(_0x9df753){_0x9df753(_0x25dce6[_0x2516('0x42')]);});},'Campaigns':function(){return new Promise(function(_0x737c82){var _0x2cb00e=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x51')]);_0x737c82({'count':_0x2cb00e['length'],'rows':_0x2cb00e});});},'VoiceQueuesPreview':function(_0x373bbc){var _0x4f5123=this;return new Promise(function(_0x509c68,_0x377083){_0x3a7984[_0x2516('0x52')](_0x373bbc['id'])[_0x2516('0x1a')](function(_0x49a992){_0x509c68({'code':0xc8,'message':_0x49a992[_0x2516('0x1c')]});})[_0x2516('0x1b')](function(_0x121818){_0x377083(_0x4f5123[_0x2516('0xf')](0x1f4,_0x121818['message']));});});},'EventManager':function(_0xbb8074){var _0x186083=this;return new Promise(function(_0x371cdc,_0x1d1983){if(!_0xbb8074['event']){return _0x1d1983(_0x186083[_0x2516('0xf')](0x1f4,_0x2516('0x53')));}ami[_0x2516('0x54')]('custom:'+_0xbb8074[_0x2516('0x55')],_0xbb8074['message']);_0x371cdc({'code':0xc8,'message':_0xbb8074});});},'FaxAccounts':function(){return new Promise(function(_0x293e40){var _0x437a04=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x56')]);_0x293e40({'count':_0x437a04[_0x2516('0x27')],'rows':_0x437a04});});},'SendFax':function(_0x502cbf){var _0x5f0806=this;return new Promise(function(_0x4d671b,_0x3d8389){_0x5b71b5[_0x2516('0x57')](_0x502cbf)['then'](function(_0x2a54ee){_0x4d671b({'code':0xc8,'message':_0x2a54ee[_0x2516('0x1c')]});})[_0x2516('0x1b')](function(_0x44a023){_0x3d8389(_0x5f0806[_0x2516('0xf')](0x1f4,_0x44a023[_0x2516('0x1c')]));});});},'CheckAfterSend':function(_0x493c5c){var _0x84db05=this;return new Promise(function(_0x13d4fb,_0x20270a){_0x5b71b5['checkAfterSend'](_0x493c5c)['then'](function(_0x52e6be){_0x13d4fb({'code':0xc8,'message':_0x52e6be[_0x2516('0x1c')]});})[_0x2516('0x1b')](function(_0x14d4db){_0x20270a(_0x84db05[_0x2516('0xf')](0x1f4,_0x14d4db['message']));});});}};var _0x4a2158=jayson['server'](_0x20a4a4)[_0x2516('0x58')]();_0x4a2158['on'](_0x2516('0xf'),function(_0x379aa8){return _0x5beeb3(_0x379aa8);});_0x4a2158[_0x2516('0x5')](0x232a,_0x2516('0x59'),function(){console[_0x2516('0x5a')](_0x2516('0x5b'),0x232a);return _0x48f411(_0x2516('0x5c')+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 c52f29c..439a4bf 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 _0xed66=['firstName','lastName','fax','createdAt','scheduledAt','updatedAt','resolve','getContacts','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','defaults','localhost','redis','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','routeId','destcalleridnum','calleridnum'];(function(_0x42dfbf,_0x2810e7){var _0x920656=function(_0x13a52a){while(--_0x13a52a){_0x42dfbf['push'](_0x42dfbf['shift']());}};_0x920656(++_0x2810e7);}(_0xed66,0x1a0));var _0x6ed6=function(_0x37e775,_0x3bb1c6){_0x37e775=_0x37e775-0x0;var _0x3c1ab5=_0xed66[_0x37e775];return _0x3c1ab5;};'use strict';var _=require(_0x6ed6('0x0'));var BPromise=require(_0x6ed6('0x1'));var Redis=require(_0x6ed6('0x2'));var util=require(_0x6ed6('0x3'));var config=require(_0x6ed6('0x4'));var logger=require(_0x6ed6('0x5'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x6ed6('0x6')](config['redis'],{'host':_0x6ed6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6ed6('0x8')]));function emit(_0x57fbe3,_0x1c0bce,_0x3abdfd,_0x5b9716,_0x3806b8){logger[_0x6ed6('0x9')]('[CM][%s][%s]',_0x57fbe3,_0x1c0bce['id'],_0x3abdfd,_0x5b9716,JSON[_0x6ed6('0xa')](_0x3806b8));io['to'](_0x3abdfd)[_0x6ed6('0xb')](_0x5b9716,_0x3806b8);}exports[_0x6ed6('0xc')]=function(_0x3f5c2e,_0x21213e,_0x5dec1c,_0x45f658){var _0xee4e08,_0x56989d;var _0x43e7fc={};var _0x1545c1;var _0x2af68a=Number(_0x5dec1c[_0x6ed6('0xd')]);var _0x1c0e69=_0x5dec1c['data2']?Boolean(Number(_0x5dec1c[_0x6ed6('0xe')])):![];var _0x6e9eff;var _0x40cf37=![];if(!_[_0x6ed6('0xf')](_0x5dec1c[_0x6ed6('0x10')])){if(_0x5dec1c['data5']=='1')_0x40cf37=!![];}if(!_0x40cf37){if(_0x45f658[_0x6ed6('0x11')]){_0x43e7fc['id']=_0x45f658[_0x6ed6('0x11')];}}if(!_0x43e7fc['id']){_0x43e7fc['ListId']=_0x2af68a;_0x6e9eff=_0x5dec1c[_0x6ed6('0x12')]&&_0x5dec1c[_0x6ed6('0x12')]!=='0'?_0x5dec1c[_0x6ed6('0x12')][_0x6ed6('0x13')](','):[_0x6ed6('0x14')];_0x43e7fc['$or']=_['map'](_0x6e9eff,function(_0x409654){var _0x105021={};_0x105021[_0x409654]=_0x45f658[_0x6ed6('0x15')]?_0x45f658[_0x6ed6('0x16')]:_0x45f658[_0x6ed6('0x17')];return _0x105021;});_0x1545c1=_0x45f658[_0x6ed6('0x15')]?_0x45f658[_0x6ed6('0x16')]:_0x45f658[_0x6ed6('0x17')];}var _0x581808=['id',_0x6ed6('0x18'),_0x6ed6('0x19'),_0x6ed6('0x14'),'mobile',_0x6ed6('0x1a'),'ListId',_0x6ed6('0x1b'),_0x6ed6('0x1c'),_0x6ed6('0x1d')];var _0x48751e=_['union'](_0x581808,_0x6e9eff);BPromise[_0x6ed6('0x1e')]()['then'](cmContactRpc[_0x6ed6('0x1f')]({'attributes':_0x48751e,'where':_0x43e7fc,'phone':_0x1545c1}))[_0x6ed6('0x20')](function(_0x253dbd){_0x56989d=_0x253dbd;if(!_['isEmpty'](_0x56989d)){if(_0x56989d[_0x6ed6('0x21')]===0x1){_0xee4e08=_0x56989d[0x0];logger['info'](_0x6ed6('0x22'),_0x45f658[_0x6ed6('0x23')],_0x21213e['id'],_0xee4e08['id']);}else{logger['info'](_0x6ed6('0x24'),_0x45f658[_0x6ed6('0x23')],_0x21213e['id'],_[_0x6ed6('0x25')](_0x56989d,'id')[_0x6ed6('0x26')](','));}return;}else{logger['info'](_0x6ed6('0x27'),_0x45f658[_0x6ed6('0x23')],_0x21213e['id']);var _0x1bf9bf={'ListId':_0x2af68a};var _0x2d2996=_0x5dec1c[_0x6ed6('0x28')]&&_0x5dec1c[_0x6ed6('0x28')]!=='0'?_0x5dec1c[_0x6ed6('0x28')]:'phone';if(_0x1c0e69){logger[_0x6ed6('0x9')](_0x6ed6('0x29'),_0x45f658[_0x6ed6('0x23')],_0x21213e['id']);_0x1bf9bf[_0x2d2996]=_[_0x6ed6('0xf')](_0x45f658[_0x6ed6('0x15')])?_0x45f658['calleridnum']:_0x45f658[_0x6ed6('0x16')];if(_[_0x6ed6('0xf')](_0x45f658[_0x6ed6('0x15')])){_0x1bf9bf[_0x6ed6('0x18')]=_0x45f658['calleridname']&&_0x45f658[_0x6ed6('0x2a')]!==_0x6ed6('0x2b')?_0x45f658[_0x6ed6('0x2a')]:_0x6ed6('0x2c');}else{_0x1bf9bf[_0x6ed6('0x18')]=_0x45f658['destcalleridname']&&_0x45f658[_0x6ed6('0x2d')]!==_0x6ed6('0x2b')?_0x45f658[_0x6ed6('0x2d')]:'Unknown';}return BPromise[_0x6ed6('0x1e')]()[_0x6ed6('0x20')](cmContactRpc['createContact'](_0x1bf9bf))[_0x6ed6('0x20')](function(_0x267a6c){_0xee4e08=_0x267a6c;_0x56989d['push'](_0x267a6c);if(_0xee4e08){logger[_0x6ed6('0x9')](_0x6ed6('0x2e'),_0x45f658[_0x6ed6('0x23')],_0x21213e['id'],_0xee4e08['id']);}return;});}else{logger[_0x6ed6('0x9')](_0x6ed6('0x2f'),_0x45f658['uniqueid'],_0x21213e['id']);_0x1bf9bf[_0x2d2996]=_[_0x6ed6('0xf')](_0x45f658[_0x6ed6('0x15')])?_0x45f658[_0x6ed6('0x17')]:_0x45f658[_0x6ed6('0x16')];if(_[_0x6ed6('0xf')](_0x45f658[_0x6ed6('0x15')])){_0x1bf9bf['firstName']=_0x45f658[_0x6ed6('0x2a')]&&_0x45f658['calleridname']!==''?_0x45f658[_0x6ed6('0x2a')]:_0x6ed6('0x2c');}else{_0x1bf9bf['firstName']=_0x45f658[_0x6ed6('0x2d')]&&_0x45f658[_0x6ed6('0x2d')]!==_0x6ed6('0x2b')?_0x45f658[_0x6ed6('0x2d')]:_0x6ed6('0x2c');}_0xee4e08=_0x1bf9bf;_0x56989d[_0x6ed6('0x30')](_0x1bf9bf);return;}}})[_0x6ed6('0x20')](function(){if(_0x3f5c2e){emit(_0x45f658[_0x6ed6('0x23')],_0x21213e,util[_0x6ed6('0x31')](_0x6ed6('0x32'),_0x3f5c2e[_0x6ed6('0x33')]),util['format'](_0x6ed6('0x34'),_0x5dec1c[_0x6ed6('0x35')]['toLowerCase']()),{'evt':_[_0x6ed6('0x36')](_0x45f658,{'autoCreate':_0x1c0e69}),'contact':_0xee4e08===undefined?{}:_0xee4e08,'contacts':_0x56989d[_0x6ed6('0x21')]===0x0?undefined:_0x56989d});}});}; \ No newline at end of file +var _0xa9b3=['user:%s','name','format','trigger:%s','toLowerCase','merge','ioredis','util','../../../../config/environment','trigger','redis','defaults','localhost','info','[CM][%s][%s]','exec','data1','data2','isNil','data5','xmd-contactid','data3','phone','$or','map','routeId','calleridnum','destcalleridnum','lastName','mobile','ListId','scheduledAt','updatedAt','union','getContacts','then','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s'];(function(_0x4b658b,_0x27f87e){var _0x5ad2e5=function(_0x39fbbc){while(--_0x39fbbc){_0x4b658b['push'](_0x4b658b['shift']());}};_0x5ad2e5(++_0x27f87e);}(_0xa9b3,0xca));var _0x3a9b=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa9b3[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x3a9b('0x0'));var util=require(_0x3a9b('0x1'));var config=require(_0x3a9b('0x2'));var logger=require('../../../../config/logger')(_0x3a9b('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0x3a9b('0x4')]=_[_0x3a9b('0x5')](config['redis'],{'host':_0x3a9b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3a9b('0x4')]));function emit(_0x4dd648,_0x1c6d35,_0x145932,_0x438938,_0x518648){logger[_0x3a9b('0x7')](_0x3a9b('0x8'),_0x4dd648,_0x1c6d35['id'],_0x145932,_0x438938,JSON['stringify'](_0x518648));io['to'](_0x145932)['emit'](_0x438938,_0x518648);}exports[_0x3a9b('0x9')]=function(_0x35df5f,_0x185471,_0x5c386f,_0x1447f0){var _0x1baa1e,_0x41905d;var _0x11c8f0={};var _0x30361b;var _0x345261=Number(_0x5c386f[_0x3a9b('0xa')]);var _0x5b5a03=_0x5c386f['data2']?Boolean(Number(_0x5c386f[_0x3a9b('0xb')])):![];var _0x1789be;var _0x295ea2=![];if(!_[_0x3a9b('0xc')](_0x5c386f[_0x3a9b('0xd')])){if(_0x5c386f['data5']=='1')_0x295ea2=!![];}if(!_0x295ea2){if(_0x1447f0[_0x3a9b('0xe')]){_0x11c8f0['id']=_0x1447f0[_0x3a9b('0xe')];}}if(!_0x11c8f0['id']){_0x11c8f0['ListId']=_0x345261;_0x1789be=_0x5c386f[_0x3a9b('0xf')]&&_0x5c386f[_0x3a9b('0xf')]!=='0'?_0x5c386f[_0x3a9b('0xf')]['split'](','):[_0x3a9b('0x10')];_0x11c8f0[_0x3a9b('0x11')]=_[_0x3a9b('0x12')](_0x1789be,function(_0x507271){var _0x16abb1={};_0x16abb1[_0x507271]=_0x1447f0[_0x3a9b('0x13')]?_0x1447f0['destcalleridnum']:_0x1447f0[_0x3a9b('0x14')];return _0x16abb1;});_0x30361b=_0x1447f0[_0x3a9b('0x13')]?_0x1447f0[_0x3a9b('0x15')]:_0x1447f0[_0x3a9b('0x14')];}var _0x5d4061=['id','firstName',_0x3a9b('0x16'),'phone',_0x3a9b('0x17'),'fax',_0x3a9b('0x18'),'createdAt',_0x3a9b('0x19'),_0x3a9b('0x1a')];var _0x3ad036=_[_0x3a9b('0x1b')](_0x5d4061,_0x1789be);BPromise['resolve']()['then'](cmContactRpc[_0x3a9b('0x1c')]({'attributes':_0x3ad036,'where':_0x11c8f0,'phone':_0x30361b}))[_0x3a9b('0x1d')](function(_0x430a28){_0x41905d=_0x430a28;if(!_['isEmpty'](_0x41905d)){if(_0x41905d[_0x3a9b('0x1e')]===0x1){_0x1baa1e=_0x41905d[0x0];logger[_0x3a9b('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1447f0[_0x3a9b('0x1f')],_0x185471['id'],_0x1baa1e['id']);}else{logger[_0x3a9b('0x7')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1447f0[_0x3a9b('0x1f')],_0x185471['id'],_[_0x3a9b('0x12')](_0x41905d,'id')[_0x3a9b('0x20')](','));}return;}else{logger['info'](_0x3a9b('0x21'),_0x1447f0[_0x3a9b('0x1f')],_0x185471['id']);var _0x4251af={'ListId':_0x345261};var _0x3cb7dd=_0x5c386f[_0x3a9b('0x22')]&&_0x5c386f[_0x3a9b('0x22')]!=='0'?_0x5c386f['data4']:'phone';if(_0x5b5a03){logger['info'](_0x3a9b('0x23'),_0x1447f0[_0x3a9b('0x1f')],_0x185471['id']);_0x4251af[_0x3cb7dd]=_[_0x3a9b('0xc')](_0x1447f0[_0x3a9b('0x13')])?_0x1447f0['calleridnum']:_0x1447f0[_0x3a9b('0x15')];if(_['isNil'](_0x1447f0['routeId'])){_0x4251af[_0x3a9b('0x24')]=_0x1447f0[_0x3a9b('0x25')]&&_0x1447f0[_0x3a9b('0x25')]!==''?_0x1447f0['calleridname']:_0x3a9b('0x26');}else{_0x4251af[_0x3a9b('0x24')]=_0x1447f0['destcalleridname']&&_0x1447f0[_0x3a9b('0x27')]!==''?_0x1447f0[_0x3a9b('0x27')]:_0x3a9b('0x26');}return BPromise[_0x3a9b('0x28')]()['then'](cmContactRpc['createContact'](_0x4251af))['then'](function(_0x2947cf){_0x1baa1e=_0x2947cf;_0x41905d[_0x3a9b('0x29')](_0x2947cf);if(_0x1baa1e){logger[_0x3a9b('0x7')](_0x3a9b('0x2a'),_0x1447f0['uniqueid'],_0x185471['id'],_0x1baa1e['id']);}return;});}else{logger[_0x3a9b('0x7')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x1447f0['uniqueid'],_0x185471['id']);_0x4251af[_0x3cb7dd]=_[_0x3a9b('0xc')](_0x1447f0['routeId'])?_0x1447f0['calleridnum']:_0x1447f0[_0x3a9b('0x15')];if(_[_0x3a9b('0xc')](_0x1447f0['routeId'])){_0x4251af['firstName']=_0x1447f0[_0x3a9b('0x25')]&&_0x1447f0[_0x3a9b('0x25')]!==''?_0x1447f0[_0x3a9b('0x25')]:_0x3a9b('0x26');}else{_0x4251af['firstName']=_0x1447f0[_0x3a9b('0x27')]&&_0x1447f0[_0x3a9b('0x27')]!==''?_0x1447f0['destcalleridname']:'Unknown';}_0x1baa1e=_0x4251af;_0x41905d[_0x3a9b('0x29')](_0x4251af);return;}}})[_0x3a9b('0x1d')](function(){if(_0x35df5f){emit(_0x1447f0[_0x3a9b('0x1f')],_0x185471,util['format'](_0x3a9b('0x2b'),_0x35df5f[_0x3a9b('0x2c')]),util[_0x3a9b('0x2d')](_0x3a9b('0x2e'),_0x5c386f['action'][_0x3a9b('0x2f')]()),{'evt':_[_0x3a9b('0x30')](_0x1447f0,{'autoCreate':_0x5b5a03}),'contact':_0x1baa1e===undefined?{}:_0x1baa1e,'contacts':_0x41905d[_0x3a9b('0x1e')]===0x0?undefined:_0x41905d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 884e237..628cbb4 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 _0x3e24=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','triggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','render','template\x20not\x20found','uri','buildUri','isNil','data4','location','uriLocation','data5','800','windowHeight','data6','600','winapp','winApplication','winArguments','data3','format','user:%s','trigger:%s:%s','interface','name','trigger:%s','exec','queue','urlforward','script','parse','query','channel','AllConditions','checkConditions','AnyConditions','some','field','account','ChatWebsiteId','operator','AccountId','value','upperFirst','interaction','message','event','agent','membername','lastevent','routeId','null','substatus','offlineMessage','created','equals','util','lodash','url','mustache','ioredis','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x3e24,0x167));var _0x43e2=function(_0x455ed5,_0xab57cc){_0x455ed5=_0x455ed5-0x0;var _0x481ac4=_0x3e24[_0x455ed5];return _0x481ac4;};'use strict';var util=require(_0x43e2('0x0'));var _=require(_0x43e2('0x1'));var url=require(_0x43e2('0x2'));var Mustache=require(_0x43e2('0x3'));var Redis=require(_0x43e2('0x4'));var urlforward=require('./urlforward');var integration=require(_0x43e2('0x5'));var cmContact=require(_0x43e2('0x6'));var script=require('./script');var config=require(_0x43e2('0x7'));var logger=require(_0x43e2('0x8'))(_0x43e2('0x9'));var ami=require(_0x43e2('0xa'));config[_0x43e2('0xb')]=_[_0x43e2('0xc')](config[_0x43e2('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x43e2('0xd'))(new Redis(config[_0x43e2('0xb')]));var operators={'equals':function(_0x4bd2ce,_0x1c96f9){return _0x4bd2ce==_0x1c96f9;},'not_equals':function(_0x2fdf85,_0x5375d8){return _0x2fdf85!=_0x5375d8;}};var barAndWebActions=[_0x43e2('0xe'),_0x43e2('0x2'),'winapp'];function Trigger(_0x45848e){this['triggers']=_0x45848e['triggers'];this['agents']=_0x45848e[_0x43e2('0xf')];this[_0x43e2('0x10')]=_0x45848e[_0x43e2('0x10')];this[_0x43e2('0x11')]=_0x45848e[_0x43e2('0x11')];this[_0x43e2('0x12')]=_0x45848e[_0x43e2('0x12')];this[_0x43e2('0x13')]=_0x45848e[_0x43e2('0x13')];this[_0x43e2('0x14')]=_0x45848e[_0x43e2('0x14')];this[_0x43e2('0x15')]=_0x45848e['salesforceAccounts'];this[_0x43e2('0x16')]=_0x45848e[_0x43e2('0x16')];this[_0x43e2('0x17')]=_0x45848e[_0x43e2('0x17')];this['deskAccounts']=_0x45848e['deskAccounts'];this[_0x43e2('0x18')]=_0x45848e[_0x43e2('0x18')];this[_0x43e2('0x19')]=_0x45848e[_0x43e2('0x19')];this[_0x43e2('0x1a')]=_0x45848e[_0x43e2('0x1a')];this[_0x43e2('0x1b')]=_0x45848e[_0x43e2('0x1b')];this[_0x43e2('0x1c')]={'zendesk':this[_0x43e2('0x13')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x43e2('0x14')],'sugarcrm':this[_0x43e2('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0x43e2('0x1d')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x43e2('0x1a')],'freshsales':this[_0x43e2('0x1b')],'servicenow':this[_0x43e2('0x19')]};ami['on'](_0x43e2('0x1e'),this[_0x43e2('0x1f')]['bind'](this));ami['on'](_0x43e2('0x20'),this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on']('custom:agentringnoanswer',this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x22'),this[_0x43e2('0x1f')]['bind'](this));ami['on'](_0x43e2('0x23'),this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x24'),this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x25'),this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x26'),this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on']('custom:agentreject',this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on']('custom:amd',this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x27'),this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on']('custom:timeout',this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x28'),this[_0x43e2('0x29')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x2a'),this['syncAgentDial']['bind'](this));ami['on'](_0x43e2('0x2b'),this[_0x43e2('0x29')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x2c'),this[_0x43e2('0x1f')]['bind'](this));ami['on'](_0x43e2('0x2d'),this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x2e'),this[_0x43e2('0x1f')][_0x43e2('0x21')](this));ami['on'](_0x43e2('0x2f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x43e2('0x30'),this[_0x43e2('0x1f')]['bind'](this));ami['on'](_0x43e2('0x31'),this[_0x43e2('0x1f')]['bind'](this));ami['on'](_0x43e2('0x32'),this['syncCustomEvent']['bind'](this));ami['on']('custom:offlineMessage',this[_0x43e2('0x1f')]['bind'](this));}Trigger[_0x43e2('0x33')][_0x43e2('0x34')]=function(_0x128e22,_0x3bb911,_0x44670b){logger[_0x43e2('0x35')](_0x128e22,_0x3bb911,JSON[_0x43e2('0x36')](_0x44670b));io['to'](_0x128e22)[_0x43e2('0x34')](_0x3bb911,_0x44670b);};Trigger[_0x43e2('0x33')][_0x43e2('0x1f')]=function(_0x28261f){var _0xf38103=_[_0x43e2('0x37')](_0x28261f);if(typeof _0xf38103[_0x43e2('0x38')]===_0x43e2('0x39')){_0xf38103[_0x43e2('0x38')]=_0x43e2('0x3a');}this['checkTriggers'](_0xf38103);};Trigger['prototype']['syncAgentDial']=function(_0x3313bc){if(this[_0x43e2('0xf')][_0x3313bc['interface']]){this['syncCustomEvent'](_0x3313bc);}};Trigger[_0x43e2('0x33')][_0x43e2('0x3b')]=function(_0x8a62e4){var _0x200d70;for(var _0x2f9567 in this[_0x43e2('0x3c')]){if(this[_0x43e2('0x3c')][_0x43e2('0x3d')](_0x2f9567)){if(this[_0x43e2('0x3c')][_0x2f9567][_0x43e2('0x3e')]){_0x200d70=this[_0x43e2('0x3f')](this[_0x43e2('0x3c')][_0x2f9567],_0x8a62e4);if(_0x200d70){_[_0x43e2('0x40')](_0x8a62e4,_0x8a62e4[_0x43e2('0x41')]);for(var _0x5e0673=0x0,_0xf6b2ae,_0x577d2e,_0xc1fbb4;_0x5e06730x0){_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 +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x450029,_0x285a5e){var _0x3608b4=function(_0x5869a7){while(--_0x5869a7){_0x450029['push'](_0x450029['shift']());}};_0x3608b4(++_0x285a5e);}(_0x814b,0x1a2));var _0xb814=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x814b[_0x90a39a];return _0x2b62f7;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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 387f7ea..fdd1d33 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 _0xa9a0=['data2','resolve','data5','POST','clientId','password','clientSecret','then','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','destcalleridnum','contacts','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','calleridnum','&$filter=','replace','%2b','4.0','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','nameField','customField','idField','substring','indexOf','content','incidents','getString','Subjects','Descriptions','/contacts(','ticketType','phonecall','callDirection','queue','phonecalls','assign','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','dynamics365','defaults','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId'];(function(_0x50b700,_0x1d3962){var _0x31ec9c=function(_0x2a144c){while(--_0x2a144c){_0x50b700['push'](_0x50b700['shift']());}};_0x31ec9c(++_0x1d3962);}(_0xa9a0,0xc4));var _0x0a9a=function(_0x2ad1f6,_0x2198de){_0x2ad1f6=_0x2ad1f6-0x0;var _0x56d039=_0xa9a0[_0x2ad1f6];return _0x56d039;};'use strict';var _=require(_0x0a9a('0x0'));var rp=require(_0x0a9a('0x1'));var util=require(_0x0a9a('0x2'));var intUtil=require(_0x0a9a('0x3'));var md5=require('md5');var Redis=require(_0x0a9a('0x4'));var logger=require('../../../../config/logger')(_0x0a9a('0x5'));var config=require('../../../../config/environment');config['redis']=_[_0x0a9a('0x6')](config[_0x0a9a('0x7')],{'host':_0x0a9a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9a('0x7')]));function getAuthToken(_0x28211,_0x10ea21,_0x67b1a4){if(_0x28211[_0x0a9a('0x9')]){_0x28211[_0x0a9a('0xa')]=_0x28211[_0x0a9a('0xb')][_0x0a9a('0xc')];_0x28211[_0x0a9a('0xd')]=_0x28211[_0x0a9a('0xb')][_0x0a9a('0xe')];return Promise[_0x0a9a('0xf')](_0x28211[_0x0a9a('0xb')][_0x0a9a('0x10')]);}var _0x3606a0={'method':_0x0a9a('0x11'),'uri':_0x10ea21,'form':{'client_id':_0x28211[_0x0a9a('0x12')],'resource':_0x28211[_0x0a9a('0xa')],'username':_0x28211['username'],'password':_0x28211[_0x0a9a('0x13')],'grant_type':_0x0a9a('0x13'),'client_secret':_0x28211[_0x0a9a('0x14')]},'json':!![]};return rp(_0x3606a0)[_0x0a9a('0x15')](function(_0x1d5de5){return _0x1d5de5['access_token'];})[_0x0a9a('0x16')](function(_0x4eeef7){logger[_0x0a9a('0x17')]('['+[_0x67b1a4['toUpperCase']()]+_0x0a9a('0x18'));return _0x4eeef7[_0x0a9a('0x19')];});}function getUser(_0xc185bf,_0x3ded2e,_0x559ebe,_0x121807,_0x4864c2,_0x2c699b){return new Promise(function(_0x53b71b,_0x561fee){return getAuthToken(_0x3ded2e,_0x121807,_0x2c699b)[_0x0a9a('0x15')](function(_0x53f684){var _0x1ecadf={'method':_0x0a9a('0x1a'),'uri':_0x4864c2+_0x0a9a('0x1b'),'headers':{'Authorization':_0x0a9a('0x1c')+_0x53f684,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ecadf);})[_0x0a9a('0x15')](function(_0x599bef){var _0x280c36=_0x599bef[_0x0a9a('0x1d')];var _0x45fb32=![];var _0x44de9b=null;if(!_['isNil'](_0x559ebe)){if(intUtil[_0x0a9a('0x1e')](_0x559ebe['email'])){_0xc185bf[_0x0a9a('0x1f')]=_0x559ebe[_0x0a9a('0x20')];for(_0x44de9b=0x0;_0x44de9b<_0x280c36[_0x0a9a('0x21')];_0x44de9b++){if(_0x280c36[_0x44de9b][_0x0a9a('0x22')]===_0x559ebe['email']&&!_0x280c36[_0x44de9b][_0x0a9a('0x23')]){_0x45fb32=!![];logger[_0x0a9a('0x24')]('['+[_0x2c699b[_0x0a9a('0x25')]()]+_0x0a9a('0x26')+_0x280c36[_0x44de9b][_0x0a9a('0x27')]+'!');_0xc185bf[_0x0a9a('0x28')]=_0x280c36[_0x44de9b][_0x0a9a('0x27')];}}}}if(!_0x45fb32){logger[_0x0a9a('0x24')]('['+[_0x2c699b[_0x0a9a('0x25')]()]+_0x0a9a('0x29'));_0xc185bf[_0x0a9a('0x1f')]=_0x3ded2e[_0x0a9a('0x2a')];for(_0x44de9b=0x0;_0x44de9b<_0x280c36[_0x0a9a('0x21')];_0x44de9b++){if(_0x280c36[_0x44de9b][_0x0a9a('0x22')]===_0x3ded2e[_0x0a9a('0x2a')]){_0xc185bf[_0x0a9a('0x28')]=_0x280c36[_0x44de9b][_0x0a9a('0x27')];}}}_0x53b71b(_0xc185bf);})[_0x0a9a('0x16')](function(_0x1b4d2e){_0x561fee(_0x1b4d2e['message']);});});}function createEndUser(_0x13511c,_0x4bd060,_0x991e32,_0x18b296,_0x5028b4,_0x4ff94c,_0x42817e){return new Promise(function(_0x5cc635,_0x1ab61a){return getAuthToken(_0x4bd060,_0x991e32,_0x4ff94c)[_0x0a9a('0x15')](function(_0x23daaa){var _0x1ede76=_0x4ff94c[_0x0a9a('0x2b')]()==='outbound'?_0x5028b4[_0x0a9a('0x2c')]:_0x5028b4['calleridnum'];var _0x515e5c={'method':'POST','uri':_0x18b296+_0x0a9a('0x2d'),'body':{'fullname':_0x1ede76,'firstname':_0x1ede76,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0a9a('0x2e')+_0x13511c[_0x0a9a('0x28')]+')'},'headers':{'Authorization':_0x0a9a('0x1c')+_0x23daaa,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x515e5c[_0x0a9a('0x2f')][_0x42817e]=_0x1ede76;return rp(_0x515e5c);})['then'](function(_0x12c606){var _0x384667=_0x12c606[_0x0a9a('0x30')][_0x0a9a('0x31')];var _0x489123=_0x384667['substring'](_0x384667[_0x0a9a('0x32')]('(')+0x1,_0x384667[_0x0a9a('0x32')](')'));_0x13511c[_0x0a9a('0x33')]=_0x489123;_0x5cc635(_0x13511c);})['catch'](function(_0x1426b3){_0x1ab61a(_0x1426b3[_0x0a9a('0x19')]);});});}function getEndUser(_0x3ff6ac,_0x4e5a5f,_0x2bf3cb,_0x307863,_0x58dd08,_0x5a1d50,_0x7c1896,_0x32b97f){var _0x2e87a6=_0x5a1d50['toLowerCase']()==='outbound'?_0x58dd08[_0x0a9a('0x2c')]:_0x58dd08[_0x0a9a('0x34')];return getAuthToken(_0x4e5a5f,_0x2bf3cb,_0x5a1d50)[_0x0a9a('0x15')](function(_0x1add1c){_0x32b97f=_0x32b97f?_0x32b97f:'telephone1';var _0x1af763={'method':_0x0a9a('0x1a'),'uri':_0x307863+'contacts?$select='+_0x32b97f+_0x0a9a('0x35')+_0x32b97f+'\x20eq\x20\x27'+_0x2e87a6[_0x0a9a('0x36')]('+',_0x0a9a('0x37'))+'\x27','headers':{'Authorization':_0x0a9a('0x1c')+_0x1add1c,'If-None-Match':null,'OData-Version':_0x0a9a('0x38')},'json':!![]};return rp(_0x1af763);})['then'](function(_0x38c189){var _0x364a84=![];if(!_0x38c189)return _0x364a84;var _0x3fe3a8=_0x38c189[_0x0a9a('0x1d')];for(var _0x4a68ba=0x0;_0x4a68ba<_0x3fe3a8[_0x0a9a('0x21')];_0x4a68ba++){if(_0x3fe3a8[_0x4a68ba][_0x32b97f]===_0x2e87a6){_0x364a84=!![];_0x3ff6ac['enduserId']=_0x3fe3a8[_0x4a68ba][_0x0a9a('0x39')];}}return _0x364a84;})[_0x0a9a('0x15')](function(_0x2d5a7f){if(_0x2d5a7f)return _0x3ff6ac;if(_0x7c1896===_0x0a9a('0x3a')){logger[_0x0a9a('0x24')]('['+[_0x5a1d50[_0x0a9a('0x25')]()]+_0x0a9a('0x3b'));return _0x3ff6ac;}return createEndUser(_0x3ff6ac,_0x4e5a5f,_0x2bf3cb,_0x307863,_0x58dd08,_0x5a1d50,_0x32b97f)['then'](function(_0x3ddcb2){logger[_0x0a9a('0x24')]('['+[_0x5a1d50['toUpperCase']()]+_0x0a9a('0x3c'),_0x3ddcb2[_0x0a9a('0x33')]);return _0x3ddcb2;});});}function getCustomFields(_0x1ee8d0,_0x297771,_0x203ad9){var _0x42d5fd={};if(_0x1ee8d0['length']>0x0){_[_0x0a9a('0x3d')](_0x1ee8d0,function(_0x1ad2db){if(_[_0x0a9a('0x3e')](['string','picklist'],_0x1ad2db['type'])&&_0x1ad2db[_0x0a9a('0x3f')]&&!_0x1ad2db[_0x0a9a('0x40')]){var _0x3d29b7=_0x1ad2db[_0x0a9a('0x41')][_0x0a9a('0x2b')]();var _0x21871f=_0x3d29b7[_0x0a9a('0x42')](0x0,_0x3d29b7[_0x0a9a('0x43')]('_'));var _0xd11ef1=_0x3d29b7['substring'](_0x3d29b7[_0x0a9a('0x43')]('_')+0x1);if(_0x21871f===_0x203ad9){_0x42d5fd[_0xd11ef1]=_0x1ad2db[_0x0a9a('0x44')];}}});}return _0x42d5fd;}function getTicket(_0x1bf433,_0x3361ac,_0x130e39,_0x44f7e5,_0x430567,_0x334c12,_0x58f416){return new Promise(function(_0x25af26,_0x3fccd0){var _0x4c7bce;return getAuthToken(_0x3361ac,_0x130e39,_0x58f416)['then'](function(_0x24965a){if(_0x334c12['ticketType']==='incident'){_0x4c7bce={'method':_0x0a9a('0x11'),'uri':_0x44f7e5+_0x0a9a('0x45'),'body':Object['assign']({},{'title':intUtil[_0x0a9a('0x46')](_0x334c12[_0x0a9a('0x47')],_0x430567,'\x20'),'description':intUtil[_0x0a9a('0x46')](_0x334c12[_0x0a9a('0x48')],_0x430567,'\x0a'),'customerid_contact@odata.bind':_0x1bf433[_0x0a9a('0x33')]?_0x0a9a('0x49')+_0x1bf433[_0x0a9a('0x33')]+')':undefined,'ownerid@odata.bind':_0x0a9a('0x2e')+_0x1bf433[_0x0a9a('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x334c12['Fields'],_0x430567,_0x334c12[_0x0a9a('0x4a')])),'headers':{'Authorization':'Bearer\x20'+_0x24965a,'OData-Version':_0x0a9a('0x38')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x334c12[_0x0a9a('0x4a')]===_0x0a9a('0x4b')){var _0x181e81=_0x1bf433[_0x0a9a('0x33')]?[{'partyid_systemuser@odata.bind':_0x0a9a('0x2e')+_0x1bf433[_0x0a9a('0x28')]+')','participationtypemask':_0x1bf433[_0x0a9a('0x4c')]===_0x0a9a('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x0a9a('0x49')+_0x1bf433[_0x0a9a('0x33')]+')','participationtypemask':_0x1bf433['callDirection']===_0x0a9a('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0a9a('0x2e')+_0x1bf433['userId']+')','participationtypemask':_0x1bf433[_0x0a9a('0x4c')]===_0x0a9a('0x4d')?0x2:0x1}];_0x4c7bce={'method':_0x0a9a('0x11'),'uri':_0x44f7e5+_0x0a9a('0x4e'),'body':Object[_0x0a9a('0x4f')]({},{'subject':intUtil[_0x0a9a('0x46')](_0x334c12[_0x0a9a('0x47')],_0x430567,'\x20'),'phonenumber':String(_0x430567['calleridnum']),'description':intUtil[_0x0a9a('0x46')](_0x334c12[_0x0a9a('0x48')],_0x430567,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1bf433['enduserId']?_0x0a9a('0x49')+_0x1bf433[_0x0a9a('0x33')]+')':undefined,'ownerid@odata.bind':_0x0a9a('0x2e')+_0x1bf433[_0x0a9a('0x28')]+')','directioncode':_0x1bf433['callDirection']===_0x0a9a('0x4d')?![]:!![],'phonecall_activity_parties':_0x181e81},getCustomFields(_0x334c12['Fields'],_0x430567,_0x334c12[_0x0a9a('0x4a')])),'headers':{'Authorization':'Bearer\x20'+_0x24965a,'OData-Version':_0x0a9a('0x38')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4c7bce);})[_0x0a9a('0x15')](function(_0x36945f){var _0x29e3b2=_0x36945f[_0x0a9a('0x30')]['odata-entityid'];var _0x557d9a=_0x29e3b2[_0x0a9a('0x42')](_0x29e3b2[_0x0a9a('0x32')]('(')+0x1,_0x29e3b2[_0x0a9a('0x32')](')'));_0x1bf433['ticketId']=_0x557d9a;_0x25af26(_0x1bf433);})[_0x0a9a('0x16')](function(_0x99c5cd){_0x3fccd0(_0x99c5cd['message']);});});}function emit(_0x1fe3d0,_0x5e8dbb,_0x183316,_0x21efc9){var _0x5da76f={'uri':util['format'](_0x0a9a('0x50'),_0x1fe3d0,_0x183316,_0x21efc9)};io['to'](util[_0x0a9a('0x51')]('user:%s',_0x5e8dbb))[_0x0a9a('0x52')]('trigger:browser:url',_0x5da76f);}exports['cs']=function(_0x5c2188,_0x3ada33,_0x435716,_0x820b3a,_0x10ea70,_0x2f6d1a,_0x3b6c49,_0x169a9f){var _0x3839c9={};_0x2f6d1a[_0x0a9a('0xa')]=_0x2f6d1a[_0x0a9a('0x9')]?intUtil[_0x0a9a('0x53')](_0x2f6d1a['CloudProvider']['data7']):intUtil[_0x0a9a('0x53')](_0x2f6d1a[_0x0a9a('0xa')]);_0x2f6d1a[_0x0a9a('0x54')]=intUtil[_0x0a9a('0x53')](_0x2f6d1a['serverUrl']);_0x3839c9[_0x0a9a('0x4c')]=_0x169a9f===_0x0a9a('0x4d')||_0x169a9f==='unmanaged'?_0x0a9a('0x4d'):'outbound';var _0x334dc9=_0x2f6d1a['modernAuthentication']?util[_0x0a9a('0x51')]('%s/api/data/v9.0/',_0x2f6d1a['CloudProvider']['data7']):util[_0x0a9a('0x51')](_0x0a9a('0x55'),_0x2f6d1a[_0x0a9a('0xa')]);var _0x3d822b=util[_0x0a9a('0x51')](_0x0a9a('0x56'),_0x2f6d1a[_0x0a9a('0xd')]);var _0x1f8014=util[_0x0a9a('0x51')](_0x0a9a('0x57'),_0x2f6d1a[_0x0a9a('0x54')],_0x3ada33[_0x0a9a('0x58')],md5(_0x3ada33[_0x0a9a('0x58')]));if(_0x10ea70&&_0x10ea70['monitor_format']){logger[_0x0a9a('0x24')](_0x0a9a('0x59'),'Recording\x20is\x20enabled!');_0x3ada33[_0x0a9a('0x5a')]=_0x1f8014;}else if(_0x3b6c49&&_0x3b6c49[_0x0a9a('0x5b')]&&_0x3b6c49[_0x0a9a('0x5b')]!=='none'){logger[_0x0a9a('0x24')](_0x0a9a('0x5c'),_0x0a9a('0x5d'));_0x3ada33[_0x0a9a('0x5a')]=_0x1f8014;}else{_0x3ada33[_0x0a9a('0x5a')]='';}return getUser(_0x3839c9,_0x2f6d1a,_0x820b3a,_0x3d822b,_0x334dc9,_0x169a9f)[_0x0a9a('0x15')](function(_0x3af85f){logger[_0x0a9a('0x24')]('['+_0x169a9f['toUpperCase']()+_0x0a9a('0x5e'),_0x3af85f[_0x0a9a('0x28')]);logger[_0x0a9a('0x24')]('['+_0x169a9f[_0x0a9a('0x25')]()+_0x0a9a('0x5f'),_0x3af85f[_0x0a9a('0x1f')]);return getEndUser(_0x3af85f,_0x2f6d1a,_0x3d822b,_0x334dc9,_0x3ada33,_0x169a9f,_0x435716[_0x0a9a('0x60')],_0x435716[_0x0a9a('0x61')]);})[_0x0a9a('0x15')](function(_0x489733){logger[_0x0a9a('0x24')]('['+_0x169a9f[_0x0a9a('0x25')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x489733[_0x0a9a('0x33')]);logger[_0x0a9a('0x24')]('['+_0x169a9f[_0x0a9a('0x25')]()+_0x0a9a('0x62'),_0x3ada33[_0x0a9a('0x34')]);return getTicket(_0x489733,_0x2f6d1a,_0x3d822b,_0x334dc9,_0x3ada33,_0x435716,_0x169a9f);})[_0x0a9a('0x15')](function(_0x408bf4){logger['info'](util[_0x0a9a('0x51')]('['+_0x169a9f[_0x0a9a('0x25')]()+_0x0a9a('0x63'),_0x435716[_0x0a9a('0x4a')],_0x408bf4['ticketId']));logger[_0x0a9a('0x24')](util['format']('['+_0x169a9f[_0x0a9a('0x25')]()+_0x0a9a('0x64'),_0x169a9f));if(_0x169a9f!==_0x0a9a('0x65')&&_0x435716[_0x0a9a('0x66')]){logger[_0x0a9a('0x24')]('['+_0x169a9f['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2f6d1a[_0x0a9a('0xa')],_0x820b3a[_0x0a9a('0x67')],_0x435716['ticketType'],_0x408bf4['ticketId']);}})[_0x0a9a('0x16')](function(_0x42dacc){logger[_0x0a9a('0x17')]('['+_0x169a9f[_0x0a9a('0x25')]()+_0x0a9a('0x68'),_0x42dacc[_0x0a9a('0x19')]);console[_0x0a9a('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x42dacc);});}; \ No newline at end of file +var _0x0747=['&$filter=','\x20eq\x20\x27','replace','%2b',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','idField','indexOf','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','ticketId','format','user:%s','emit','serverUrl','stripTrailingSlash','unmanaged','%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','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','request-promise','./util','dynamics365','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5','POST','clientId','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','contacts','/systemusers(','userId','Bearer\x20','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','calleridnum','telephone1','contacts?$select='];(function(_0x53fa56,_0x49c6b8){var _0x2381e7=function(_0x22d9d5){while(--_0x22d9d5){_0x53fa56['push'](_0x53fa56['shift']());}};_0x2381e7(++_0x49c6b8);}(_0x0747,0x1df));var _0x7074=function(_0x58d2a5,_0x1ce3dd){_0x58d2a5=_0x58d2a5-0x0;var _0xbcb221=_0x0747[_0x58d2a5];return _0xbcb221;};'use strict';var _=require(_0x7074('0x0'));var rp=require(_0x7074('0x1'));var util=require('util');var intUtil=require(_0x7074('0x2'));var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x7074('0x3'));var config=require('../../../../config/environment');config[_0x7074('0x4')]=_['defaults'](config['redis'],{'host':_0x7074('0x5'),'port':0x18eb});var io=require(_0x7074('0x6'))(new Redis(config[_0x7074('0x4')]));function getAuthToken(_0xa35af8,_0x42b368,_0x36d593){if(_0xa35af8[_0x7074('0x7')]){_0xa35af8[_0x7074('0x8')]=_0xa35af8['CloudProvider'][_0x7074('0x9')];_0xa35af8[_0x7074('0xa')]=_0xa35af8[_0x7074('0xb')][_0x7074('0xc')];return Promise[_0x7074('0xd')](_0xa35af8[_0x7074('0xb')][_0x7074('0xe')]);}var _0x291aa7={'method':_0x7074('0xf'),'uri':_0x42b368,'form':{'client_id':_0xa35af8[_0x7074('0x10')],'resource':_0xa35af8[_0x7074('0x8')],'username':_0xa35af8[_0x7074('0x11')],'password':_0xa35af8[_0x7074('0x12')],'grant_type':'password','client_secret':_0xa35af8['clientSecret']},'json':!![]};return rp(_0x291aa7)[_0x7074('0x13')](function(_0x53e84d){return _0x53e84d[_0x7074('0x14')];})[_0x7074('0x15')](function(_0x37882b){logger[_0x7074('0x16')]('['+[_0x36d593[_0x7074('0x17')]()]+_0x7074('0x18'));return _0x37882b[_0x7074('0x19')];});}function getUser(_0x3a46cf,_0x59dc71,_0x396188,_0x385f57,_0x27e407,_0x172346){return new Promise(function(_0xaf1fed,_0x30607d){return getAuthToken(_0x59dc71,_0x385f57,_0x172346)[_0x7074('0x13')](function(_0x22d059){var _0x44e55b={'method':_0x7074('0x1a'),'uri':_0x27e407+_0x7074('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x22d059,'OData-Version':_0x7074('0x1c')},'json':!![]};return rp(_0x44e55b);})[_0x7074('0x13')](function(_0x434d1d){var _0x47d9a5=_0x434d1d[_0x7074('0x1d')];var _0x1ef30f=![];var _0x9d8a5c=null;if(!_[_0x7074('0x1e')](_0x396188)){if(intUtil[_0x7074('0x1f')](_0x396188[_0x7074('0x20')])){_0x3a46cf[_0x7074('0x21')]=_0x396188[_0x7074('0x20')];for(_0x9d8a5c=0x0;_0x9d8a5c<_0x47d9a5[_0x7074('0x22')];_0x9d8a5c++){if(_0x47d9a5[_0x9d8a5c][_0x7074('0x23')]===_0x396188['email']&&!_0x47d9a5[_0x9d8a5c][_0x7074('0x24')]){_0x1ef30f=!![];logger[_0x7074('0x25')]('['+[_0x172346[_0x7074('0x17')]()]+']\x20Agent\x20found\x20'+_0x47d9a5[_0x9d8a5c][_0x7074('0x26')]+'!');_0x3a46cf['userId']=_0x47d9a5[_0x9d8a5c][_0x7074('0x26')];}}}}if(!_0x1ef30f){logger['info']('['+[_0x172346[_0x7074('0x17')]()]+_0x7074('0x27'));_0x3a46cf[_0x7074('0x21')]=_0x59dc71[_0x7074('0x11')];for(_0x9d8a5c=0x0;_0x9d8a5c<_0x47d9a5[_0x7074('0x22')];_0x9d8a5c++){if(_0x47d9a5[_0x9d8a5c][_0x7074('0x23')]===_0x59dc71['username']){_0x3a46cf['userId']=_0x47d9a5[_0x9d8a5c][_0x7074('0x26')];}}}_0xaf1fed(_0x3a46cf);})[_0x7074('0x15')](function(_0xd34f7d){_0x30607d(_0xd34f7d[_0x7074('0x19')]);});});}function createEndUser(_0x13321d,_0x36ee61,_0x3bd9b0,_0x5969b9,_0x114de6,_0x3a5c20,_0x4cd30f){return new Promise(function(_0x11c020,_0x44409a){return getAuthToken(_0x36ee61,_0x3bd9b0,_0x3a5c20)[_0x7074('0x13')](function(_0x30df97){var _0x1542d8=_0x3a5c20[_0x7074('0x28')]()==='outbound'?_0x114de6[_0x7074('0x29')]:_0x114de6['calleridnum'];var _0x156659={'method':_0x7074('0xf'),'uri':_0x5969b9+_0x7074('0x2a'),'body':{'fullname':_0x1542d8,'firstname':_0x1542d8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7074('0x2b')+_0x13321d[_0x7074('0x2c')]+')'},'headers':{'Authorization':_0x7074('0x2d')+_0x30df97,'OData-Version':_0x7074('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x156659[_0x7074('0x2e')][_0x4cd30f]=_0x1542d8;return rp(_0x156659);})[_0x7074('0x13')](function(_0x5ad68d){var _0x505010=_0x5ad68d[_0x7074('0x2f')][_0x7074('0x30')];var _0x5eada5=_0x505010[_0x7074('0x31')](_0x505010['lastIndexOf']('(')+0x1,_0x505010[_0x7074('0x32')](')'));_0x13321d[_0x7074('0x33')]=_0x5eada5;_0x11c020(_0x13321d);})[_0x7074('0x15')](function(_0x5454e3){_0x44409a(_0x5454e3['message']);});});}function getEndUser(_0x572d2f,_0xec85fb,_0x3fef3d,_0x2446f4,_0x52d64d,_0x56a78e,_0x3f0ada,_0x4b8431){var _0x473903=_0x56a78e['toLowerCase']()===_0x7074('0x34')?_0x52d64d[_0x7074('0x29')]:_0x52d64d[_0x7074('0x35')];return getAuthToken(_0xec85fb,_0x3fef3d,_0x56a78e)['then'](function(_0x2a6226){_0x4b8431=_0x4b8431?_0x4b8431:_0x7074('0x36');var _0x86b040={'method':'GET','uri':_0x2446f4+_0x7074('0x37')+_0x4b8431+_0x7074('0x38')+_0x4b8431+_0x7074('0x39')+_0x473903[_0x7074('0x3a')]('+',_0x7074('0x3b'))+'\x27','headers':{'Authorization':_0x7074('0x2d')+_0x2a6226,'If-None-Match':null,'OData-Version':_0x7074('0x1c')},'json':!![]};return rp(_0x86b040);})[_0x7074('0x13')](function(_0x28a13d){var _0x44357=![];if(!_0x28a13d)return _0x44357;var _0x11fba8=_0x28a13d[_0x7074('0x1d')];for(var _0x2400dc=0x0;_0x2400dc<_0x11fba8[_0x7074('0x22')];_0x2400dc++){if(_0x11fba8[_0x2400dc][_0x4b8431]===_0x473903){_0x44357=!![];_0x572d2f['enduserId']=_0x11fba8[_0x2400dc]['contactid'];}}return _0x44357;})[_0x7074('0x13')](function(_0x20dd54){if(_0x20dd54)return _0x572d2f;if(_0x3f0ada==='nothing'){logger[_0x7074('0x25')]('['+[_0x56a78e[_0x7074('0x17')]()]+_0x7074('0x3c'));return _0x572d2f;}return createEndUser(_0x572d2f,_0xec85fb,_0x3fef3d,_0x2446f4,_0x52d64d,_0x56a78e,_0x4b8431)[_0x7074('0x13')](function(_0x3f5969){logger[_0x7074('0x25')]('['+[_0x56a78e[_0x7074('0x17')]()]+_0x7074('0x3d'),_0x3f5969[_0x7074('0x33')]);return _0x3f5969;});});}function getCustomFields(_0x40da80,_0x47c5f3,_0x24cc91){var _0x5f5d4a={};if(_0x40da80['length']>0x0){_[_0x7074('0x3e')](_0x40da80,function(_0x1cb1b1){if(_[_0x7074('0x3f')]([_0x7074('0x40'),_0x7074('0x41')],_0x1cb1b1['type'])&&_0x1cb1b1[_0x7074('0x42')]&&!_0x1cb1b1['customField']){var _0x52beb6=_0x1cb1b1[_0x7074('0x43')][_0x7074('0x28')]();var _0x19d197=_0x52beb6[_0x7074('0x31')](0x0,_0x52beb6[_0x7074('0x44')]('_'));var _0x53637b=_0x52beb6[_0x7074('0x31')](_0x52beb6['indexOf']('_')+0x1);if(_0x19d197===_0x24cc91){_0x5f5d4a[_0x53637b]=_0x1cb1b1['content'];}}});}return _0x5f5d4a;}function getTicket(_0x22936b,_0x47c91b,_0x364204,_0x1c6d23,_0x3dc55a,_0x12c1cb,_0xf726f3){return new Promise(function(_0x2e870f,_0x4ae3fd){var _0x10f3cb;return getAuthToken(_0x47c91b,_0x364204,_0xf726f3)['then'](function(_0x2f88ad){if(_0x12c1cb['ticketType']===_0x7074('0x45')){_0x10f3cb={'method':'POST','uri':_0x1c6d23+'incidents','body':Object[_0x7074('0x46')]({},{'title':intUtil[_0x7074('0x47')](_0x12c1cb[_0x7074('0x48')],_0x3dc55a,'\x20'),'description':intUtil[_0x7074('0x47')](_0x12c1cb[_0x7074('0x49')],_0x3dc55a,'\x0a'),'customerid_contact@odata.bind':_0x22936b[_0x7074('0x33')]?_0x7074('0x4a')+_0x22936b['enduserId']+')':undefined,'ownerid@odata.bind':_0x7074('0x2b')+_0x22936b[_0x7074('0x2c')]+')','caseorigincode':'1'},getCustomFields(_0x12c1cb[_0x7074('0x4b')],_0x3dc55a,_0x12c1cb[_0x7074('0x4c')])),'headers':{'Authorization':_0x7074('0x2d')+_0x2f88ad,'OData-Version':_0x7074('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x12c1cb[_0x7074('0x4c')]===_0x7074('0x4d')){var _0x85e3e1=_0x22936b[_0x7074('0x33')]?[{'partyid_systemuser@odata.bind':_0x7074('0x2b')+_0x22936b[_0x7074('0x2c')]+')','participationtypemask':_0x22936b[_0x7074('0x4e')]===_0x7074('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x22936b[_0x7074('0x33')]+')','participationtypemask':_0x22936b[_0x7074('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x22936b['userId']+')','participationtypemask':_0x22936b[_0x7074('0x4e')]==='queue'?0x2:0x1}];_0x10f3cb={'method':_0x7074('0xf'),'uri':_0x1c6d23+_0x7074('0x50'),'body':Object[_0x7074('0x46')]({},{'subject':intUtil[_0x7074('0x47')](_0x12c1cb[_0x7074('0x48')],_0x3dc55a,'\x20'),'phonenumber':String(_0x3dc55a[_0x7074('0x35')]),'description':intUtil[_0x7074('0x47')](_0x12c1cb[_0x7074('0x49')],_0x3dc55a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x22936b[_0x7074('0x33')]?_0x7074('0x4a')+_0x22936b[_0x7074('0x33')]+')':undefined,'ownerid@odata.bind':_0x7074('0x2b')+_0x22936b[_0x7074('0x2c')]+')','directioncode':_0x22936b[_0x7074('0x4e')]===_0x7074('0x4f')?![]:!![],'phonecall_activity_parties':_0x85e3e1},getCustomFields(_0x12c1cb[_0x7074('0x4b')],_0x3dc55a,_0x12c1cb['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x2f88ad,'OData-Version':_0x7074('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x10f3cb);})[_0x7074('0x13')](function(_0x3eedf5){var _0x403d4b=_0x3eedf5[_0x7074('0x2f')]['odata-entityid'];var _0x6dc057=_0x403d4b['substring'](_0x403d4b['lastIndexOf']('(')+0x1,_0x403d4b[_0x7074('0x32')](')'));_0x22936b[_0x7074('0x51')]=_0x6dc057;_0x2e870f(_0x22936b);})['catch'](function(_0x16982e){_0x4ae3fd(_0x16982e[_0x7074('0x19')]);});});}function emit(_0x5ec0cb,_0x422a25,_0x24d8d0,_0x1a75c5){var _0x4f6d65={'uri':util[_0x7074('0x52')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x5ec0cb,_0x24d8d0,_0x1a75c5)};io['to'](util[_0x7074('0x52')](_0x7074('0x53'),_0x422a25))[_0x7074('0x54')]('trigger:browser:url',_0x4f6d65);}exports['cs']=function(_0x5b9ea7,_0x4bca17,_0x394fc9,_0x40323c,_0x25c508,_0xd91fe5,_0x3b46dc,_0x233bbc){var _0x4bc2b7={};_0xd91fe5[_0x7074('0x8')]=_0xd91fe5[_0x7074('0x7')]?intUtil['stripTrailingSlash'](_0xd91fe5[_0x7074('0xb')][_0x7074('0x9')]):intUtil['stripTrailingSlash'](_0xd91fe5['remoteUri']);_0xd91fe5[_0x7074('0x55')]=intUtil[_0x7074('0x56')](_0xd91fe5[_0x7074('0x55')]);_0x4bc2b7['callDirection']=_0x233bbc===_0x7074('0x4f')||_0x233bbc===_0x7074('0x57')?_0x7074('0x4f'):'outbound';var _0x19632f=_0xd91fe5['modernAuthentication']?util['format'](_0x7074('0x58'),_0xd91fe5['CloudProvider']['data7']):util[_0x7074('0x52')](_0x7074('0x58'),_0xd91fe5[_0x7074('0x8')]);var _0x406036=util[_0x7074('0x52')](_0x7074('0x59'),_0xd91fe5['tenantId']);var _0x40cded=util[_0x7074('0x52')](_0x7074('0x5a'),_0xd91fe5[_0x7074('0x55')],_0x4bca17[_0x7074('0x5b')],md5(_0x4bca17[_0x7074('0x5b')]));if(_0x25c508&&_0x25c508[_0x7074('0x5c')]){logger[_0x7074('0x25')]('[QUEUE]',_0x7074('0x5d'));_0x4bca17['recordingURL']=_0x40cded;}else if(_0x3b46dc&&_0x3b46dc[_0x7074('0x5e')]&&_0x3b46dc['recordingFormat']!==_0x7074('0x5f')){logger[_0x7074('0x25')]('[OUTBOUND]',_0x7074('0x5d'));_0x4bca17[_0x7074('0x60')]=_0x40cded;}else{_0x4bca17[_0x7074('0x60')]='';}return getUser(_0x4bc2b7,_0xd91fe5,_0x40323c,_0x406036,_0x19632f,_0x233bbc)[_0x7074('0x13')](function(_0x489335){logger[_0x7074('0x25')]('['+_0x233bbc['toUpperCase']()+_0x7074('0x61'),_0x489335[_0x7074('0x2c')]);logger['info']('['+_0x233bbc[_0x7074('0x17')]()+_0x7074('0x62'),_0x489335[_0x7074('0x21')]);return getEndUser(_0x489335,_0xd91fe5,_0x406036,_0x19632f,_0x4bca17,_0x233bbc,_0x394fc9[_0x7074('0x63')],_0x394fc9[_0x7074('0x64')]);})[_0x7074('0x13')](function(_0x1bf721){logger['info']('['+_0x233bbc[_0x7074('0x17')]()+_0x7074('0x65'),_0x1bf721[_0x7074('0x33')]);logger['info']('['+_0x233bbc['toUpperCase']()+_0x7074('0x66'),_0x4bca17[_0x7074('0x35')]);return getTicket(_0x1bf721,_0xd91fe5,_0x406036,_0x19632f,_0x4bca17,_0x394fc9,_0x233bbc);})[_0x7074('0x13')](function(_0x207556){logger[_0x7074('0x25')](util[_0x7074('0x52')]('['+_0x233bbc[_0x7074('0x17')]()+_0x7074('0x67'),_0x394fc9[_0x7074('0x4c')],_0x207556[_0x7074('0x51')]));logger[_0x7074('0x25')](util['format']('['+_0x233bbc[_0x7074('0x17')]()+_0x7074('0x68'),_0x233bbc));if(_0x233bbc!==_0x7074('0x57')&&_0x394fc9[_0x7074('0x69')]){logger['info']('['+_0x233bbc[_0x7074('0x17')]()+']',_0x7074('0x6a'));emit(_0xd91fe5['remoteUri'],_0x40323c['name'],_0x394fc9[_0x7074('0x4c')],_0x207556[_0x7074('0x51')]);}})[_0x7074('0x15')](function(_0x57feb1){logger[_0x7074('0x16')]('['+_0x233bbc[_0x7074('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x57feb1[_0x7074('0x19')]);console[_0x7074('0x16')]('Error\x20running\x20Dynamics365\x20integration',_0x57feb1);});}; \ 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 c9e8143..d08456e 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 _0x23a0=['length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','apiKey','toString','base64','debug','stringify','defaults','GET','forEach','includes','string','picklist','type','nameField','toLowerCase','idField','customField','push','content','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','Authorization','catch','unmanaged','lastevent','toUpperCase','lodash','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','keyBy','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23a0,0x181));var _0x023a=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0x23a0[_0x282a1f];return _0x296ea7;};'use strict';var _=require(_0x023a('0x0'));var rp=require('request-promise');var md5=require(_0x023a('0x1'));var util=require('util');var Redis=require(_0x023a('0x2'));var intUtil=require(_0x023a('0x3'));var config=require(_0x023a('0x4'));var logger=require(_0x023a('0x5'))(_0x023a('0x6'));config[_0x023a('0x7')]=_['defaults'](config[_0x023a('0x7')],{'host':_0x023a('0x8'),'port':0x18eb});var io=require(_0x023a('0x9'))(new Redis(config[_0x023a('0x7')]));var headers={'Content-Type':_0x023a('0xa'),'Accept':_0x023a('0xa')};function emit(_0x16a41e,_0x528670,_0xc9b48){io['to'](_0x16a41e)[_0x023a('0xb')](_0x528670,_0xc9b48);}function getTicket(_0x547992,_0x27da02,_0x344c2a,_0x3d3dc0,_0x188763){logger[_0x023a('0xc')]('Creating\x20new\x20ticket...');var _0x31ce69=_['merge']({'responder_id':_0x27da02['id'],'requester_id':_0x344c2a['id'],'name':util[_0x023a('0xd')](_0x023a('0xe'),_0x188763[_0x023a('0xf')]),'phone':_0x188763[_0x023a('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x023a('0x11')](_0x3d3dc0[_0x023a('0x12')],_0x188763,'\x20'),'description':intUtil[_0x023a('0x11')](_0x3d3dc0[_0x023a('0x13')],_0x188763,'
'),'tags':getTags(_0x3d3dc0[_0x023a('0x14')],_0x023a('0x15'))},getCustomFields(_0x3d3dc0[_0x023a('0x16')],_0x188763));_0x31ce69[_0x023a('0x17')]=_['mapValues'](_[_0x023a('0x18')](_0x31ce69[_0x023a('0x17')],'id'),'value');return request({'uri':util[_0x023a('0xd')]('%s/api/v2/tickets',_0x547992['remoteUri']),'method':_0x023a('0x19'),'body':_0x31ce69})[_0x023a('0x1a')](function(_0x2624d7){logger[_0x023a('0xc')](_0x023a('0x1b'));return _0x2624d7;});}function getUser(_0x56fe85,_0x16399b){if(intUtil[_0x023a('0x1c')](_0x16399b)){return request({'uri':util[_0x023a('0xd')](_0x023a('0x1d'),_0x56fe85['remoteUri']),'qs':{'email':_0x16399b}})[_0x023a('0x1a')](function(_0x4fdfff){if(_0x4fdfff[_0x023a('0x1e')]){logger[_0x023a('0xc')](_0x023a('0x1f'));return _[_0x023a('0x20')](_0x4fdfff,function(_0x7662c5){return _0x7662c5['contact'][_0x023a('0x21')]===_0x16399b;});}else{logger[_0x023a('0xc')](_0x023a('0x22'));return request({'uri':util[_0x023a('0xd')](_0x023a('0x23'),_0x56fe85[_0x023a('0x24')])})[_0x023a('0x1a')](function(_0x330df0){logger[_0x023a('0xc')](_0x023a('0x25'));return _0x330df0;});}});}else{logger['info'](_0x023a('0x26'));return request({'uri':util[_0x023a('0xd')]('%s/api/v2/agents/me',_0x56fe85[_0x023a('0x24')])})[_0x023a('0x1a')](function(_0x13e82b){logger[_0x023a('0xc')](_0x023a('0x25'));return _0x13e82b;});}}function getEndUser(_0x1baec4,_0x5997ed,_0x3da7da){logger[_0x023a('0xc')]('Searching\x20enduser\x20with\x20phone',_0x3da7da);return request({'uri':util[_0x023a('0xd')](_0x023a('0x27'),_0x1baec4['remoteUri']),'qs':{'phone':_0x3da7da}})[_0x023a('0x1a')](function(_0x5f520d){if(_0x5f520d[_0x023a('0x1e')]){logger[_0x023a('0xc')](_0x023a('0x28'));return _[_0x023a('0x20')](_0x5f520d,{'phone':_0x3da7da});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x023a('0x27'),_0x1baec4['remoteUri']),'method':'POST','body':{'name':_0x5997ed,'phone':_0x3da7da}})[_0x023a('0x1a')](function(_0x2f6ea2){logger[_0x023a('0xc')]('Enduser\x20created.');return _0x2f6ea2;});}});}function getAuth(_0x41a08e){return util[_0x023a('0xd')]('Basic\x20%s',new Buffer(_0x41a08e[_0x023a('0x29')]+':X')[_0x023a('0x2a')](_0x023a('0x2b')));}function request(_0x33b1a5){logger[_0x023a('0x2c')]('[HTTP]',JSON[_0x023a('0x2d')](_0x33b1a5));return rp(_[_0x023a('0x2e')](_0x33b1a5,{'method':_0x023a('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x251a58,_0x18ebff){var _0x405e89=[];if(_0x251a58&&_0x251a58[_0x023a('0x1e')]>0x0){_0x405e89=_['map'](_0x251a58,_0x18ebff);}return _0x405e89;}function getCustomFields(_0x517cad,_0x3789bc){var _0x217952=[];var _0x52fd19={'custom_fields':[]};if(_0x517cad['length']>0x0){_[_0x023a('0x30')](_0x517cad,function(_0x38711a){if(_[_0x023a('0x31')]([_0x023a('0x32'),_0x023a('0x33')],_0x38711a[_0x023a('0x34')])&&_0x38711a[_0x023a('0x35')]&&!_0x38711a['customField']){_0x52fd19[_0x38711a[_0x023a('0x35')][_0x023a('0x36')]()]=_0x38711a['content'][_0x023a('0x2a')]();}else if(_[_0x023a('0x31')]([_0x023a('0x32'),'picklist'],_0x38711a['type'])&&_0x38711a[_0x023a('0x37')]&&_0x38711a[_0x023a('0x38')]){_0x52fd19['custom_fields'][_0x023a('0x39')]({'id':_0x38711a[_0x023a('0x37')],'value':_0x38711a[_0x023a('0x3a')]['toString']()});}else if(_0x38711a[_0x023a('0x34')]==='variable'&&_0x38711a['variableName']&&_0x38711a[_0x023a('0x37')]&&_0x38711a[_0x023a('0x38')]){_0x3789bc[_0x38711a[_0x023a('0x3b')]]&&_0x52fd19[_0x023a('0x17')][_0x023a('0x39')]({'id':_0x38711a[_0x023a('0x37')],'value':_0x3789bc[_0x38711a[_0x023a('0x3b')]][_0x023a('0x2a')]()});}else if(_0x38711a[_0x023a('0x34')]===_0x023a('0x3c')&&_0x38711a[_0x023a('0x3d')]&&_0x38711a[_0x023a('0x3d')]['name']&&_0x38711a['idField']&&_0x38711a['customField']){_0x3789bc[_0x38711a[_0x023a('0x3d')]['name'][_0x023a('0x36')]()]&&_0x52fd19[_0x023a('0x17')]['push']({'id':_0x38711a[_0x023a('0x37')],'value':_0x3789bc[_0x38711a[_0x023a('0x3d')][_0x023a('0x15')][_0x023a('0x36')]()]['toString']()});}});}return _0x52fd19;}exports['queue']=function(_0x5acc09,_0x5185f5,_0x913666,_0x48e875,_0x122817,_0x43642e){var _0xc602da,_0x744f80;_0x43642e[_0x023a('0x24')]=intUtil[_0x023a('0x3e')](_0x43642e[_0x023a('0x24')]);_0x43642e[_0x023a('0x3f')]=intUtil['stripTrailingSlash'](_0x43642e['serverUrl']);if(_0x122817&&_0x122817[_0x023a('0x40')]){logger['info'](_0x023a('0x41'),_0x023a('0x42'));_0x5185f5[_0x023a('0x43')]=util[_0x023a('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x43642e[_0x023a('0x3f')],_0x5185f5[_0x023a('0x44')],md5(_0x5185f5[_0x023a('0x44')]));}else{_0x5185f5[_0x023a('0x43')]='';}headers['Authorization']=getAuth(_0x43642e);return getUser(_0x43642e,_0x48e875[_0x023a('0x21')])[_0x023a('0x1a')](function(_0x24886b){_0xc602da=_0x24886b;logger[_0x023a('0xc')](_0x023a('0x45'),_0xc602da['id']);return getEndUser(_0x43642e,_0x5185f5[_0x023a('0xf')],_0x5185f5[_0x023a('0x10')]);})[_0x023a('0x1a')](function(_0x54f50c){_0x744f80=_0x54f50c;logger[_0x023a('0xc')](_0x023a('0x46'),_0x744f80['id']);return getTicket(_0x43642e,_0xc602da,_0x744f80,_0x913666,_0x5185f5);})[_0x023a('0x1a')](function(_0x1ae900){if(_0x1ae900&&_0x1ae900['id']){logger['info'](_0x023a('0x1b'));logger[_0x023a('0xc')](_0x023a('0x47'),_0x1ae900['id']);logger[_0x023a('0xc')](_0x023a('0x41'),_0x023a('0x48'));emit(util['format'](_0x023a('0x49'),_0x48e875[_0x023a('0x15')]),_0x023a('0x4a'),{'uri':util[_0x023a('0xd')](_0x023a('0x4b'),_0x43642e[_0x023a('0x24')],_0x1ae900['id'])});}})['catch'](function(_0x47f45b){logger[_0x023a('0x4c')](_0x023a('0x41'),JSON['stringify'](_0x47f45b));});};exports[_0x023a('0x4d')]=function(_0x5c84e2,_0x172bbe,_0x12d92e,_0x533ca4,_0x1545bd,_0x35c813,_0x2b97ab){var _0x2a3376,_0xd9d3e2;_0x35c813[_0x023a('0x24')]=intUtil['stripTrailingSlash'](_0x35c813[_0x023a('0x24')]);_0x35c813[_0x023a('0x3f')]=intUtil[_0x023a('0x3e')](_0x35c813['serverUrl']);if(_0x2b97ab&&_0x2b97ab['recordingFormat']&&_0x2b97ab['recordingFormat']!=='none'){logger[_0x023a('0xc')]('[OUTBOUND]',_0x023a('0x42'));_0x172bbe[_0x023a('0x43')]=util[_0x023a('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35c813[_0x023a('0x3f')],_0x172bbe['uniqueid'],md5(_0x172bbe[_0x023a('0x44')]));}headers[_0x023a('0x4e')]=getAuth(_0x35c813);return getUser(_0x35c813,_0x533ca4[_0x023a('0x21')])[_0x023a('0x1a')](function(_0x3d9634){_0x2a3376=_0x3d9634;logger[_0x023a('0xc')](_0x023a('0x45'),_0x2a3376['id']);return getEndUser(_0x35c813,_0x172bbe['destcalleridname'],_0x172bbe['destcalleridnum']);})[_0x023a('0x1a')](function(_0x1d1d69){_0xd9d3e2=_0x1d1d69;logger[_0x023a('0xc')](_0x023a('0x46'),_0xd9d3e2['id']);return getTicket(_0x35c813,_0x2a3376,_0xd9d3e2,_0x12d92e,_0x172bbe);})[_0x023a('0x1a')](function(_0x45e627){if(_0x45e627&&_0x45e627['id']){logger['info'](_0x023a('0x1b'));logger[_0x023a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x45e627['id']);logger['info']('[OUTBOUND]',_0x023a('0x48'));emit(util[_0x023a('0xd')](_0x023a('0x49'),_0x533ca4[_0x023a('0x15')]),_0x023a('0x4a'),{'uri':util[_0x023a('0xd')]('%s/helpdesk/tickets/%d',_0x35c813[_0x023a('0x24')],_0x45e627['id'])});}})[_0x023a('0x4f')](function(_0x469d5e){logger[_0x023a('0x4c')]('[OUTBOUND]',JSON[_0x023a('0x2d')](_0x469d5e));});};exports[_0x023a('0x50')]=function(_0x4c535b,_0x87f876,_0x2a3df2,_0x49d323,_0xdd822f,_0x44ed15){var _0x164755,_0x2c378b;_0x44ed15[_0x023a('0x24')]=intUtil[_0x023a('0x3e')](_0x44ed15[_0x023a('0x24')]);_0x44ed15[_0x023a('0x3f')]=intUtil[_0x023a('0x3e')](_0x44ed15[_0x023a('0x3f')]);if(_0xdd822f&&_0xdd822f[_0x023a('0x40')]){logger[_0x023a('0xc')]('['+_0x87f876[_0x023a('0x51')][_0x023a('0x52')]()+']',_0x023a('0x42'));_0x87f876[_0x023a('0x43')]=util[_0x023a('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44ed15[_0x023a('0x3f')],_0x87f876[_0x023a('0x44')],md5(_0x87f876[_0x023a('0x44')]));}else{_0x87f876['recordingURL']='';}headers[_0x023a('0x4e')]=getAuth(_0x44ed15);return getUser(_0x44ed15,'')[_0x023a('0x1a')](function(_0x406228){_0x164755=_0x406228;logger[_0x023a('0xc')]('The\x20User\x20ID\x20is:',_0x164755['id']);return getEndUser(_0x44ed15,_0x87f876[_0x023a('0xf')],_0x87f876[_0x023a('0x10')]);})[_0x023a('0x1a')](function(_0x3ee7ee){_0x2c378b=_0x3ee7ee;logger[_0x023a('0xc')](_0x023a('0x46'),_0x2c378b['id']);return getTicket(_0x44ed15,_0x164755,_0x2c378b,_0x2a3df2,_0x87f876);})[_0x023a('0x1a')](function(_0x35ced3){if(_0x35ced3){logger[_0x023a('0xc')](_0x023a('0x1b'));logger[_0x023a('0xc')](_0x023a('0x47'),_0x35ced3['id']);}})['catch'](function(_0x1b6965){logger['error']('['+_0x87f876['lastevent']['toUpperCase']()+']',JSON[_0x023a('0x2d')](_0x1b6965));});}; \ No newline at end of file +var _0x1ab8=['getString','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','variableName','idField','push','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','freshdesk','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects'];(function(_0xba2d74,_0x336253){var _0x4fb4aa=function(_0x212eb4){while(--_0x212eb4){_0xba2d74['push'](_0xba2d74['shift']());}};_0x4fb4aa(++_0x336253);}(_0x1ab8,0x1bb));var _0x81ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1ab8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x81ab('0x0'));var rp=require(_0x81ab('0x1'));var md5=require(_0x81ab('0x2'));var util=require('util');var Redis=require(_0x81ab('0x3'));var intUtil=require(_0x81ab('0x4'));var config=require(_0x81ab('0x5'));var logger=require('../../../../config/logger')(_0x81ab('0x6'));config[_0x81ab('0x7')]=_['defaults'](config[_0x81ab('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x81ab('0x7')]));var headers={'Content-Type':_0x81ab('0x8'),'Accept':_0x81ab('0x8')};function emit(_0x31337a,_0x2b61ad,_0x4f9d0a){io['to'](_0x31337a)[_0x81ab('0x9')](_0x2b61ad,_0x4f9d0a);}function getTicket(_0xc2da7e,_0x46ac1e,_0x43c16c,_0x1c460c,_0x1cddaf){logger[_0x81ab('0xa')](_0x81ab('0xb'));var _0x1979c9=_[_0x81ab('0xc')]({'responder_id':_0x46ac1e['id'],'requester_id':_0x43c16c['id'],'name':util['format'](_0x81ab('0xd'),_0x1cddaf[_0x81ab('0xe')]),'phone':_0x1cddaf[_0x81ab('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x1c460c[_0x81ab('0x10')],_0x1cddaf,'\x20'),'description':intUtil[_0x81ab('0x11')](_0x1c460c[_0x81ab('0x12')],_0x1cddaf,_0x81ab('0x13')),'tags':getTags(_0x1c460c[_0x81ab('0x14')],_0x81ab('0x15'))},getCustomFields(_0x1c460c['Fields'],_0x1cddaf));_0x1979c9[_0x81ab('0x16')]=_[_0x81ab('0x17')](_[_0x81ab('0x18')](_0x1979c9[_0x81ab('0x16')],'id'),_0x81ab('0x19'));return request({'uri':util[_0x81ab('0x1a')](_0x81ab('0x1b'),_0xc2da7e['remoteUri']),'method':'POST','body':_0x1979c9})[_0x81ab('0x1c')](function(_0x19e99f){logger[_0x81ab('0xa')](_0x81ab('0x1d'));return _0x19e99f;});}function getUser(_0xa3c48e,_0x2bf4b9){if(intUtil[_0x81ab('0x1e')](_0x2bf4b9)){return request({'uri':util[_0x81ab('0x1a')](_0x81ab('0x1f'),_0xa3c48e['remoteUri']),'qs':{'email':_0x2bf4b9}})[_0x81ab('0x1c')](function(_0x8a302e){if(_0x8a302e[_0x81ab('0x20')]){logger['info'](_0x81ab('0x21'));return _[_0x81ab('0x22')](_0x8a302e,function(_0x32fe9c){return _0x32fe9c[_0x81ab('0x23')][_0x81ab('0x24')]===_0x2bf4b9;});}else{logger[_0x81ab('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x81ab('0x1a')](_0x81ab('0x25'),_0xa3c48e[_0x81ab('0x26')])})[_0x81ab('0x1c')](function(_0x238aa6){logger['info'](_0x81ab('0x27'));return _0x238aa6;});}});}else{logger[_0x81ab('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x81ab('0x25'),_0xa3c48e['remoteUri'])})[_0x81ab('0x1c')](function(_0x55b257){logger['info'](_0x81ab('0x27'));return _0x55b257;});}}function getEndUser(_0x58b40d,_0x589e66,_0x4367e3){logger[_0x81ab('0xa')](_0x81ab('0x28'),_0x4367e3);return request({'uri':util[_0x81ab('0x1a')]('%s/api/v2/contacts',_0x58b40d[_0x81ab('0x26')]),'qs':{'phone':_0x4367e3}})[_0x81ab('0x1c')](function(_0x49f3f5){if(_0x49f3f5[_0x81ab('0x20')]){logger[_0x81ab('0xa')](_0x81ab('0x29'));return _[_0x81ab('0x22')](_0x49f3f5,{'phone':_0x4367e3});}else{logger[_0x81ab('0xa')](_0x81ab('0x2a'));return request({'uri':util[_0x81ab('0x1a')]('%s/api/v2/contacts',_0x58b40d[_0x81ab('0x26')]),'method':'POST','body':{'name':_0x589e66,'phone':_0x4367e3}})[_0x81ab('0x1c')](function(_0x1e5c31){logger[_0x81ab('0xa')](_0x81ab('0x2b'));return _0x1e5c31;});}});}function getAuth(_0x592937){return util[_0x81ab('0x1a')](_0x81ab('0x2c'),new Buffer(_0x592937[_0x81ab('0x2d')]+':X')[_0x81ab('0x2e')](_0x81ab('0x2f')));}function request(_0xc65c44){logger[_0x81ab('0x30')](_0x81ab('0x31'),JSON[_0x81ab('0x32')](_0xc65c44));return rp(_[_0x81ab('0x33')](_0xc65c44,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x10a91f,_0x468ad7){var _0x254402=[];if(_0x10a91f&&_0x10a91f[_0x81ab('0x20')]>0x0){_0x254402=_[_0x81ab('0x34')](_0x10a91f,_0x468ad7);}return _0x254402;}function getCustomFields(_0x1fc5e1,_0x1a0157){var _0x13c748=[];var _0x1226bc={'custom_fields':[]};if(_0x1fc5e1['length']>0x0){_[_0x81ab('0x35')](_0x1fc5e1,function(_0xb94144){if(_[_0x81ab('0x36')]([_0x81ab('0x37'),'picklist'],_0xb94144[_0x81ab('0x38')])&&_0xb94144[_0x81ab('0x39')]&&!_0xb94144[_0x81ab('0x3a')]){_0x1226bc[_0xb94144['nameField'][_0x81ab('0x3b')]()]=_0xb94144[_0x81ab('0x3c')][_0x81ab('0x2e')]();}else if(_[_0x81ab('0x36')]([_0x81ab('0x37'),_0x81ab('0x3d')],_0xb94144[_0x81ab('0x38')])&&_0xb94144['idField']&&_0xb94144[_0x81ab('0x3a')]){_0x1226bc[_0x81ab('0x16')]['push']({'id':_0xb94144['idField'],'value':_0xb94144[_0x81ab('0x3c')][_0x81ab('0x2e')]()});}else if(_0xb94144[_0x81ab('0x38')]==='variable'&&_0xb94144[_0x81ab('0x3e')]&&_0xb94144[_0x81ab('0x3f')]&&_0xb94144['customField']){_0x1a0157[_0xb94144['variableName']]&&_0x1226bc['custom_fields'][_0x81ab('0x40')]({'id':_0xb94144['idField'],'value':_0x1a0157[_0xb94144[_0x81ab('0x3e')]][_0x81ab('0x2e')]()});}else if(_0xb94144[_0x81ab('0x38')]==='customVariable'&&_0xb94144[_0x81ab('0x41')]&&_0xb94144[_0x81ab('0x41')][_0x81ab('0x15')]&&_0xb94144['idField']&&_0xb94144[_0x81ab('0x3a')]){_0x1a0157[_0xb94144[_0x81ab('0x41')][_0x81ab('0x15')][_0x81ab('0x3b')]()]&&_0x1226bc[_0x81ab('0x16')]['push']({'id':_0xb94144[_0x81ab('0x3f')],'value':_0x1a0157[_0xb94144[_0x81ab('0x41')]['name'][_0x81ab('0x3b')]()][_0x81ab('0x2e')]()});}});}return _0x1226bc;}exports[_0x81ab('0x42')]=function(_0x207097,_0x300456,_0x14a01b,_0x2ff498,_0x1bb199,_0x2afd9a){var _0xb71009,_0x49d773;_0x2afd9a[_0x81ab('0x26')]=intUtil[_0x81ab('0x43')](_0x2afd9a['remoteUri']);_0x2afd9a[_0x81ab('0x44')]=intUtil[_0x81ab('0x43')](_0x2afd9a[_0x81ab('0x44')]);if(_0x1bb199&&_0x1bb199['monitor_format']){logger[_0x81ab('0xa')]('[QUEUE]',_0x81ab('0x45'));_0x300456[_0x81ab('0x46')]=util[_0x81ab('0x1a')](_0x81ab('0x47'),_0x2afd9a[_0x81ab('0x44')],_0x300456[_0x81ab('0x48')],md5(_0x300456[_0x81ab('0x48')]));}else{_0x300456['recordingURL']='';}headers[_0x81ab('0x49')]=getAuth(_0x2afd9a);return getUser(_0x2afd9a,_0x2ff498[_0x81ab('0x24')])['then'](function(_0x348fc8){_0xb71009=_0x348fc8;logger[_0x81ab('0xa')](_0x81ab('0x4a'),_0xb71009['id']);return getEndUser(_0x2afd9a,_0x300456['calleridname'],_0x300456[_0x81ab('0xf')]);})[_0x81ab('0x1c')](function(_0x21eaa0){_0x49d773=_0x21eaa0;logger[_0x81ab('0xa')](_0x81ab('0x4b'),_0x49d773['id']);return getTicket(_0x2afd9a,_0xb71009,_0x49d773,_0x14a01b,_0x300456);})[_0x81ab('0x1c')](function(_0xd794a2){if(_0xd794a2&&_0xd794a2['id']){logger[_0x81ab('0xa')](_0x81ab('0x1d'));logger[_0x81ab('0xa')]('The\x20Ticket\x20ID\x20is:',_0xd794a2['id']);logger[_0x81ab('0xa')](_0x81ab('0x4c'),_0x81ab('0x4d'));emit(util[_0x81ab('0x1a')](_0x81ab('0x4e'),_0x2ff498[_0x81ab('0x15')]),_0x81ab('0x4f'),{'uri':util[_0x81ab('0x1a')](_0x81ab('0x50'),_0x2afd9a[_0x81ab('0x26')],_0xd794a2['id'])});}})[_0x81ab('0x51')](function(_0x59625c){logger[_0x81ab('0x52')]('[QUEUE]',JSON['stringify'](_0x59625c));});};exports['outbound']=function(_0x1cdee7,_0x22eabe,_0x4fe77c,_0x39fa2c,_0x113679,_0x42955b,_0x306579){var _0x535d49,_0x316b14;_0x42955b[_0x81ab('0x26')]=intUtil[_0x81ab('0x43')](_0x42955b['remoteUri']);_0x42955b[_0x81ab('0x44')]=intUtil[_0x81ab('0x43')](_0x42955b[_0x81ab('0x44')]);if(_0x306579&&_0x306579[_0x81ab('0x53')]&&_0x306579['recordingFormat']!==_0x81ab('0x54')){logger[_0x81ab('0xa')]('[OUTBOUND]',_0x81ab('0x45'));_0x22eabe[_0x81ab('0x46')]=util[_0x81ab('0x1a')](_0x81ab('0x47'),_0x42955b[_0x81ab('0x44')],_0x22eabe[_0x81ab('0x48')],md5(_0x22eabe[_0x81ab('0x48')]));}headers[_0x81ab('0x49')]=getAuth(_0x42955b);return getUser(_0x42955b,_0x39fa2c['email'])['then'](function(_0x4b446a){_0x535d49=_0x4b446a;logger[_0x81ab('0xa')](_0x81ab('0x4a'),_0x535d49['id']);return getEndUser(_0x42955b,_0x22eabe[_0x81ab('0x55')],_0x22eabe[_0x81ab('0x56')]);})[_0x81ab('0x1c')](function(_0x25d030){_0x316b14=_0x25d030;logger[_0x81ab('0xa')](_0x81ab('0x4b'),_0x316b14['id']);return getTicket(_0x42955b,_0x535d49,_0x316b14,_0x4fe77c,_0x22eabe);})[_0x81ab('0x1c')](function(_0xb179dd){if(_0xb179dd&&_0xb179dd['id']){logger[_0x81ab('0xa')](_0x81ab('0x1d'));logger[_0x81ab('0xa')]('The\x20Ticket\x20ID\x20is:',_0xb179dd['id']);logger[_0x81ab('0xa')](_0x81ab('0x57'),_0x81ab('0x4d'));emit(util[_0x81ab('0x1a')](_0x81ab('0x4e'),_0x39fa2c['name']),_0x81ab('0x4f'),{'uri':util['format'](_0x81ab('0x50'),_0x42955b[_0x81ab('0x26')],_0xb179dd['id'])});}})[_0x81ab('0x51')](function(_0x39a43a){logger[_0x81ab('0x52')](_0x81ab('0x57'),JSON[_0x81ab('0x32')](_0x39a43a));});};exports[_0x81ab('0x58')]=function(_0x4f2a5f,_0x311349,_0x558c60,_0x4cb794,_0xae8319,_0x411fe3){var _0x71738c,_0x28c41a;_0x411fe3[_0x81ab('0x26')]=intUtil[_0x81ab('0x43')](_0x411fe3[_0x81ab('0x26')]);_0x411fe3['serverUrl']=intUtil['stripTrailingSlash'](_0x411fe3[_0x81ab('0x44')]);if(_0xae8319&&_0xae8319['monitor_format']){logger[_0x81ab('0xa')]('['+_0x311349[_0x81ab('0x59')][_0x81ab('0x5a')]()+']',_0x81ab('0x45'));_0x311349['recordingURL']=util[_0x81ab('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x411fe3[_0x81ab('0x44')],_0x311349[_0x81ab('0x48')],md5(_0x311349['uniqueid']));}else{_0x311349[_0x81ab('0x46')]='';}headers[_0x81ab('0x49')]=getAuth(_0x411fe3);return getUser(_0x411fe3,'')[_0x81ab('0x1c')](function(_0xe6a886){_0x71738c=_0xe6a886;logger['info'](_0x81ab('0x4a'),_0x71738c['id']);return getEndUser(_0x411fe3,_0x311349['calleridname'],_0x311349[_0x81ab('0xf')]);})[_0x81ab('0x1c')](function(_0x1c86f0){_0x28c41a=_0x1c86f0;logger[_0x81ab('0xa')]('The\x20Enduser\x20ID\x20is:',_0x28c41a['id']);return getTicket(_0x411fe3,_0x71738c,_0x28c41a,_0x558c60,_0x311349);})['then'](function(_0x5aa73c){if(_0x5aa73c){logger['info'](_0x81ab('0x1d'));logger[_0x81ab('0xa')](_0x81ab('0x5b'),_0x5aa73c['id']);}})[_0x81ab('0x51')](function(_0x81984c){logger['error']('['+_0x311349[_0x81ab('0x59')][_0x81ab('0x5a')]()+']',JSON['stringify'](_0x81984c));});}; \ 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 f59ff64..365c1aa 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 _0x4522=['freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','&f=','contacts','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','getString','Subjects','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','calleridnum','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','../../../../config/environment','../../../../config/logger'];(function(_0xa04212,_0x10d7ec){var _0x3a2837=function(_0x1e2812){while(--_0x1e2812){_0xa04212['push'](_0xa04212['shift']());}};_0x3a2837(++_0x10d7ec);}(_0x4522,0x175));var _0x2452=function(_0x2bc9ac,_0x23190d){_0x2bc9ac=_0x2bc9ac-0x0;var _0x2e2121=_0x4522[_0x2bc9ac];return _0x2e2121;};'use strict';var _=require(_0x2452('0x0'));var rp=require(_0x2452('0x1'));var md5=require(_0x2452('0x2'));var util=require(_0x2452('0x3'));var moment=require(_0x2452('0x4'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x2452('0x5'));var logger=require(_0x2452('0x6'))(_0x2452('0x7'));config[_0x2452('0x8')]=_[_0x2452('0x9')](config[_0x2452('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x2452('0xa'))(new Redis(config[_0x2452('0x8')]));function getAdminId(_0x1affed,_0x13723e,_0x4dcff4,_0x4c6c2d){return new Promise(function(_0x22703a,_0x321a78){var _0x5635e1=![];var _0x5a27f8={'method':'GET','uri':_0x4c6c2d+_0x2452('0xb'),'json':!![]};_0x5a27f8['headers']=_0x4dcff4;logger[_0x2452('0xc')](_0x2452('0xd'));return rp(_0x5a27f8)[_0x2452('0xe')](function(_0x101f86){if(_0x101f86){var _0x395cf2=_0x101f86[_0x2452('0xf')];var _0x56acf9=null;for(_0x56acf9=0x0;_0x56acf9<_0x395cf2[_0x2452('0x10')];_0x56acf9++){if(_0x395cf2[_0x56acf9]['email']===_0x1affed[_0x2452('0x11')]){_0x1affed['adminId']=_0x395cf2[_0x56acf9]['id'];_0x5635e1=!![];}}if(_0x5635e1){logger[_0x2452('0xc')](_0x2452('0x12'),_0x1affed[_0x2452('0x13')]);_0x22703a(_0x1affed);}else{_0x321a78({'statusCode':0x194,'message':_0x2452('0x14')});}}else{_0x321a78({'statusCode':0x194,'message':_0x2452('0x14')});}})[_0x2452('0x15')](function(_0x65005f){logger[_0x2452('0x16')]('['+[_0x13723e[_0x2452('0x17')]()]+']',_0x65005f[_0x2452('0x18')]);_0x321a78(_0x65005f);});});}function getUser(_0x2ba2da,_0x54f122,_0x10619d){return function(_0x2830b6){return new Promise(function(_0xad548d,_0x3992d4){var _0x1a73e2={'method':_0x2452('0x19'),'uri':_0x10619d+_0x2452('0xb'),'json':!![]};_0x1a73e2[_0x2452('0x1a')]=_0x54f122;logger['info'](_0x2452('0x1b'));return rp(_0x1a73e2)[_0x2452('0xe')](function(_0x266d54){if(_0x266d54){var _0x2c561a=_0x266d54[_0x2452('0xf')];var _0x22109a=![];var _0x1ec6a7=null;if(_0x2830b6[_0x2452('0x1c')]!==null){logger[_0x2452('0xc')](_0x2452('0x1d'),_0x2830b6[_0x2452('0x1c')]);_0x2830b6[_0x2452('0x1e')]=_0x2830b6[_0x2452('0x1c')];for(_0x1ec6a7=0x0;_0x1ec6a7<_0x2c561a[_0x2452('0x10')];_0x1ec6a7++){if(_0x2c561a[_0x1ec6a7][_0x2452('0x1f')]===_0x2830b6[_0x2452('0x1c')]){_0x22109a=!![];_0x2830b6[_0x2452('0x20')]=_0x2c561a[_0x1ec6a7]['id'];logger['info'](_0x2452('0x21'),_0x2830b6[_0x2452('0x20')]);}}}if(!_0x22109a){logger[_0x2452('0xc')](_0x2452('0x22'));_0x2830b6[_0x2452('0x1e')]=_0x2830b6[_0x2452('0x11')];_0x2830b6[_0x2452('0x20')]=_0x2830b6[_0x2452('0x13')];_0x22109a=!![];}if(_0x22109a){_0xad548d(_0x2830b6);}else{_0x3992d4({'statusCode':0x194,'message':_0x2452('0x14')});}}else{_0x3992d4({'statusCode':0x194,'message':_0x2452('0x14')});}})[_0x2452('0x15')](function(_0x341b51){logger['error']('['+[_0x2ba2da[_0x2452('0x17')]()]+']',_0x341b51[_0x2452('0x18')]);_0x3992d4(_0x341b51);});});};}function searchContact(_0x5ca562,_0x4404fb,_0x1870e1,_0x5425c7){return new Promise(function(_0x3d46a2,_0x597560){var _0x23c4a1={'method':_0x2452('0x19'),'headers':_0x4404fb,'uri':_0x5ca562+'/api/lookup?q='+_0x5425c7+_0x2452('0x23')+_0x1870e1+'&entities=contact','json':!![]};rp(_0x23c4a1)[_0x2452('0xe')](function(_0x4c0add){var _0x136e0d=_['find'](_0x4c0add[_0x2452('0x24')][_0x2452('0x24')],[_0x1870e1,_0x5425c7]);_0x3d46a2(_0x136e0d);})[_0x2452('0x15')](function(_0x23e8aa){_0x597560(_0x23e8aa);});});}function getEndUser(_0xda85d0,_0xd89e61,_0x503c0f){return function(_0x359435){return new Promise(function(_0x51e577,_0x15b808){logger[_0x2452('0xc')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x359435['contactNumber']));searchContact(_0x503c0f,_0xd89e61,_0x2452('0x25'),_0x359435[_0x2452('0x26')])['then'](function(_0x40843b){if(_0x40843b){_0x359435[_0x2452('0x27')]=_0x40843b['id'];logger[_0x2452('0xc')](_0x2452('0x28'),_0x359435[_0x2452('0x27')]);return _0x51e577(_0x359435);}searchContact(_0x503c0f,_0xd89e61,_0x2452('0x29'),_0x359435[_0x2452('0x26')])[_0x2452('0xe')](function(_0x2c3371){if(_0x2c3371){_0x359435[_0x2452('0x27')]=_0x2c3371['id'];logger[_0x2452('0xc')](_0x2452('0x2a'),_0x359435[_0x2452('0x27')]);return _0x51e577(_0x359435);}createEndUser(_0x359435,_0xda85d0,_0xd89e61,_0x503c0f)['then'](function(_0x15d060){logger['info'](_0x2452('0x2b'),_0x15d060[_0x2452('0x27')]);return _0x51e577(_0x15d060);});});})[_0x2452('0x15')](function(_0x24245a){_0x15b808(_0x24245a);});});};}function createEndUser(_0x1fdfff,_0x32efb9,_0x231f96,_0x52cbc5){return new Promise(function(_0x180acd,_0x55bb6e){var _0x225cf7=moment();var _0x8144bd={'method':_0x2452('0x2c'),'uri':_0x52cbc5+_0x2452('0x2d'),'body':{'contact':{'last_name':_0x1fdfff[_0x2452('0x26')],'work_number':_0x1fdfff['contactNumber'],'mobile_number':_0x1fdfff[_0x2452('0x26')],'owner_id':_0x1fdfff[_0x2452('0x20')],'created_at':_0x225cf7[_0x2452('0x2e')](_0x2452('0x2f'))}},'json':!![]};_0x8144bd[_0x2452('0x1a')]=_0x231f96;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x8144bd)[_0x2452('0xe')](function(_0x5d5e7d){_0x1fdfff['endUserId']=_0x5d5e7d['contact']['id'];_0x180acd(_0x1fdfff);})[_0x2452('0x15')](function(_0x4ce36d){logger[_0x2452('0x16')]('['+[_0x32efb9[_0x2452('0x17')]()]+']',_0x4ce36d['message']);_0x55bb6e(_0x4ce36d[_0x2452('0x18')]);});});}function getTicket(_0xf2f228,_0x19c521,_0x4d5b44,_0x317675,_0x26b83c){return function(_0x38359d){logger[_0x2452('0xc')](_0x2452('0x30'));return new Promise(function(_0x5e0dee,_0x2963e4){var _0x4ddc3b=moment();var _0x4d5afa={'method':_0x2452('0x2c'),'uri':_0x4d5b44+'/api/tasks','body':{'title':intUtil[_0x2452('0x31')](_0x317675[_0x2452('0x32')],_0x26b83c,'\x20'),'description':intUtil[_0x2452('0x31')](_0x317675[_0x2452('0x33')],_0x26b83c,'\x0a'),'owner_id':_0x38359d['userId'],'creater_id':_0x38359d[_0x2452('0x13')],'targetable_id':_0x38359d[_0x2452('0x27')],'targetable_type':'Contact','created_at':_0x4ddc3b[_0x2452('0x2e')](_0x2452('0x2f')),'due_date':_0x4ddc3b['add'](0x1e,'m')[_0x2452('0x2e')](_0x2452('0x2f'))},'json':!![]};_0x4d5afa['headers']=_0x19c521;return rp(_0x4d5afa)[_0x2452('0xe')](function(_0xeec074){_0x38359d[_0x2452('0x34')]=_0xeec074[_0x2452('0x35')]['id'];logger[_0x2452('0xc')](_0x2452('0x36'),_0x38359d[_0x2452('0x34')]);_0x5e0dee(_0x38359d);})[_0x2452('0x15')](function(_0x238ab5){logger['error']('['+[_0xf2f228['toUpperCase']()]+']',_0x238ab5['message']);_0x2963e4(_0x238ab5[_0x2452('0x18')]);});});};}function emit(_0x2972b6,_0x359589,_0x4db65f){var _0x3a314e={'uri':_0x2972b6+_0x2452('0x37')+_0x4db65f};io['to'](util['format'](_0x2452('0x38'),_0x359589))[_0x2452('0x39')]('trigger:browser:url',_0x3a314e);}exports['cs']=function(_0x7f9071,_0x1106fe,_0x336863,_0x42f92e,_0x10114a,_0x9d58c3,_0x4f36e2,_0x78f06d){var _0x33227a={};var _0x54e59b={'Authorization':_0x2452('0x3a')+_0x9d58c3['apiKey']};_0x9d58c3[_0x2452('0x3b')]=intUtil[_0x2452('0x3c')](_0x9d58c3[_0x2452('0x3b')]);_0x9d58c3['serverUrl']=intUtil[_0x2452('0x3c')](_0x9d58c3[_0x2452('0x3d')]);var _0x3ebab=_0x9d58c3[_0x2452('0x3b')];_0x33227a['adminEmail']=_0x9d58c3['username'];_0x33227a[_0x2452('0x26')]=_0x78f06d[_0x2452('0x3e')]()===_0x2452('0x3f')?_0x1106fe['destcalleridnum']:_0x1106fe[_0x2452('0x40')];_0x33227a['callDirection']=_0x78f06d===_0x2452('0x41')||_0x78f06d===_0x2452('0x42')?'queue':_0x2452('0x3f');if(_0x42f92e){_0x33227a[_0x2452('0x1c')]=_0x42f92e[_0x2452('0x1f')];}var _0x4e3845=util[_0x2452('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9d58c3['serverUrl'],_0x1106fe[_0x2452('0x43')],md5(_0x1106fe[_0x2452('0x43')]));if(_0x10114a&&_0x10114a['monitor_format']){logger[_0x2452('0xc')]('[QUEUE]',_0x2452('0x44'));_0x1106fe['recordingURL']=_0x4e3845;}else if(_0x4f36e2&&_0x4f36e2[_0x2452('0x45')]&&_0x4f36e2[_0x2452('0x45')]!==_0x2452('0x46')){logger[_0x2452('0xc')](_0x2452('0x47'),_0x2452('0x44'));_0x1106fe[_0x2452('0x48')]=_0x4e3845;}else{_0x1106fe[_0x2452('0x48')]='';}return getAdminId(_0x33227a,_0x78f06d,_0x54e59b,_0x3ebab)[_0x2452('0xe')](getUser(_0x78f06d,_0x54e59b,_0x3ebab))['then'](getEndUser(_0x78f06d,_0x54e59b,_0x3ebab))['then'](getTicket(_0x78f06d,_0x54e59b,_0x3ebab,_0x336863,_0x1106fe))[_0x2452('0xe')](function(_0x5bcf94){logger['info'](util[_0x2452('0x2e')](_0x2452('0x49'),_0x5bcf94[_0x2452('0x34')]));if(_0x78f06d!=='unmanaged'){logger[_0x2452('0xc')]('['+[_0x78f06d[_0x2452('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3ebab,_0x42f92e['name'],_0x5bcf94[_0x2452('0x27')]);}})[_0x2452('0x15')](function(_0xb31f5a){logger[_0x2452('0x16')]('['+[_0x78f06d[_0x2452('0x17')]()]+_0x2452('0x4a'),util[_0x2452('0x4b')](_0xb31f5a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc7c5=['redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','GET','Getting\x20user\x20list','userEmail','agentEmail','userId','Admin\x20selected','adminEmail','error','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults'];(function(_0x323753,_0x429ec0){var _0x149c09=function(_0x23db54){while(--_0x23db54){_0x323753['push'](_0x323753['shift']());}};_0x149c09(++_0x429ec0);}(_0xc7c5,0x142));var _0x5c7c=function(_0x2cb7b2,_0x28f0af){_0x2cb7b2=_0x2cb7b2-0x0;var _0x4abea4=_0xc7c5[_0x2cb7b2];return _0x4abea4;};'use strict';var _=require(_0x5c7c('0x0'));var rp=require(_0x5c7c('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0x5c7c('0x2'));var Promise=require(_0x5c7c('0x3'));var Redis=require(_0x5c7c('0x4'));var intUtil=require(_0x5c7c('0x5'));var config=require(_0x5c7c('0x6'));var logger=require(_0x5c7c('0x7'))(_0x5c7c('0x8'));config['redis']=_[_0x5c7c('0x9')](config[_0x5c7c('0xa')],{'host':_0x5c7c('0xb'),'port':0x18eb});var io=require(_0x5c7c('0xc'))(new Redis(config[_0x5c7c('0xa')]));function getAdminId(_0x1a9989,_0x280e77,_0x3a1401,_0x1e3320){return new Promise(function(_0x5f139f,_0x225d2b){var _0x3a6fb0=![];var _0x7ed824={'method':'GET','uri':_0x1e3320+_0x5c7c('0xd'),'json':!![]};_0x7ed824[_0x5c7c('0xe')]=_0x3a1401;logger[_0x5c7c('0xf')](_0x5c7c('0x10'));return rp(_0x7ed824)[_0x5c7c('0x11')](function(_0x240949){if(_0x240949){var _0x44d669=_0x240949[_0x5c7c('0x12')];var _0x575e96=null;for(_0x575e96=0x0;_0x575e96<_0x44d669[_0x5c7c('0x13')];_0x575e96++){if(_0x44d669[_0x575e96][_0x5c7c('0x14')]===_0x1a9989['adminEmail']){_0x1a9989[_0x5c7c('0x15')]=_0x44d669[_0x575e96]['id'];_0x3a6fb0=!![];}}if(_0x3a6fb0){logger[_0x5c7c('0xf')](_0x5c7c('0x16'),_0x1a9989[_0x5c7c('0x15')]);_0x5f139f(_0x1a9989);}else{_0x225d2b({'statusCode':0x194,'message':_0x5c7c('0x17')});}}else{_0x225d2b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x5c7c('0x18')](function(_0x4a93db){logger['error']('['+[_0x280e77[_0x5c7c('0x19')]()]+']',_0x4a93db[_0x5c7c('0x1a')]);_0x225d2b(_0x4a93db);});});}function getUser(_0x212078,_0x59e0ed,_0x18a779){return function(_0x26ccb9){return new Promise(function(_0x409883,_0x3e1b97){var _0x4afc28={'method':_0x5c7c('0x1b'),'uri':_0x18a779+_0x5c7c('0xd'),'json':!![]};_0x4afc28[_0x5c7c('0xe')]=_0x59e0ed;logger[_0x5c7c('0xf')](_0x5c7c('0x1c'));return rp(_0x4afc28)[_0x5c7c('0x11')](function(_0x165873){if(_0x165873){var _0x1e9b51=_0x165873[_0x5c7c('0x12')];var _0x4a7a85=![];var _0x2d1bcd=null;if(_0x26ccb9['agentEmail']!==null){logger[_0x5c7c('0xf')]('Getting\x20user\x20with\x20email',_0x26ccb9['agentEmail']);_0x26ccb9[_0x5c7c('0x1d')]=_0x26ccb9[_0x5c7c('0x1e')];for(_0x2d1bcd=0x0;_0x2d1bcd<_0x1e9b51['length'];_0x2d1bcd++){if(_0x1e9b51[_0x2d1bcd][_0x5c7c('0x14')]===_0x26ccb9[_0x5c7c('0x1e')]){_0x4a7a85=!![];_0x26ccb9[_0x5c7c('0x1f')]=_0x1e9b51[_0x2d1bcd]['id'];logger[_0x5c7c('0xf')]('User\x20found:',_0x26ccb9[_0x5c7c('0x1f')]);}}}if(!_0x4a7a85){logger[_0x5c7c('0xf')](_0x5c7c('0x20'));_0x26ccb9[_0x5c7c('0x1d')]=_0x26ccb9[_0x5c7c('0x21')];_0x26ccb9['userId']=_0x26ccb9['adminId'];_0x4a7a85=!![];}if(_0x4a7a85){_0x409883(_0x26ccb9);}else{_0x3e1b97({'statusCode':0x194,'message':_0x5c7c('0x17')});}}else{_0x3e1b97({'statusCode':0x194,'message':_0x5c7c('0x17')});}})[_0x5c7c('0x18')](function(_0x52cf0c){logger[_0x5c7c('0x22')]('['+[_0x212078['toUpperCase']()]+']',_0x52cf0c['message']);_0x3e1b97(_0x52cf0c);});});};}function searchContact(_0x2a4879,_0x1cb3e7,_0x536258,_0x4adb78){return new Promise(function(_0x5e2870,_0x215c36){var _0x3ed1f1={'method':_0x5c7c('0x1b'),'headers':_0x1cb3e7,'uri':_0x2a4879+'/api/lookup?q='+_0x4adb78+_0x5c7c('0x23')+_0x536258+_0x5c7c('0x24'),'json':!![]};rp(_0x3ed1f1)[_0x5c7c('0x11')](function(_0x1b27c8){var _0x107e36=_[_0x5c7c('0x25')](_0x1b27c8[_0x5c7c('0x26')][_0x5c7c('0x26')],[_0x536258,_0x4adb78]);_0x5e2870(_0x107e36);})[_0x5c7c('0x18')](function(_0x53b0f5){_0x215c36(_0x53b0f5);});});}function getEndUser(_0x384d3d,_0xaabca8,_0x44ed3e){return function(_0x3f9eb5){return new Promise(function(_0x328cf4,_0x49e652){logger[_0x5c7c('0xf')](util['format'](_0x5c7c('0x27'),_0x3f9eb5[_0x5c7c('0x28')]));searchContact(_0x44ed3e,_0xaabca8,_0x5c7c('0x29'),_0x3f9eb5[_0x5c7c('0x28')])['then'](function(_0x4eb883){if(_0x4eb883){_0x3f9eb5[_0x5c7c('0x2a')]=_0x4eb883['id'];logger[_0x5c7c('0xf')](_0x5c7c('0x2b'),_0x3f9eb5[_0x5c7c('0x2a')]);return _0x328cf4(_0x3f9eb5);}searchContact(_0x44ed3e,_0xaabca8,_0x5c7c('0x2c'),_0x3f9eb5[_0x5c7c('0x28')])[_0x5c7c('0x11')](function(_0x32db28){if(_0x32db28){_0x3f9eb5[_0x5c7c('0x2a')]=_0x32db28['id'];logger[_0x5c7c('0xf')](_0x5c7c('0x2d'),_0x3f9eb5[_0x5c7c('0x2a')]);return _0x328cf4(_0x3f9eb5);}createEndUser(_0x3f9eb5,_0x384d3d,_0xaabca8,_0x44ed3e)[_0x5c7c('0x11')](function(_0x132c82){logger[_0x5c7c('0xf')]('Contact\x20created:',_0x132c82[_0x5c7c('0x2a')]);return _0x328cf4(_0x132c82);});});})[_0x5c7c('0x18')](function(_0x403911){_0x49e652(_0x403911);});});};}function createEndUser(_0xb32eaa,_0x419f47,_0x33f08c,_0x51e234){return new Promise(function(_0xa9a94e,_0x15c0d2){var _0x3ebea2=moment();var _0x1de2c8={'method':'POST','uri':_0x51e234+_0x5c7c('0x2e'),'body':{'contact':{'last_name':_0xb32eaa[_0x5c7c('0x28')],'work_number':_0xb32eaa[_0x5c7c('0x28')],'mobile_number':_0xb32eaa[_0x5c7c('0x28')],'owner_id':_0xb32eaa[_0x5c7c('0x1f')],'created_at':_0x3ebea2[_0x5c7c('0x2f')](_0x5c7c('0x30'))}},'json':!![]};_0x1de2c8[_0x5c7c('0xe')]=_0x33f08c;logger[_0x5c7c('0xf')](_0x5c7c('0x31'));return rp(_0x1de2c8)[_0x5c7c('0x11')](function(_0x180a11){_0xb32eaa['endUserId']=_0x180a11['contact']['id'];_0xa9a94e(_0xb32eaa);})[_0x5c7c('0x18')](function(_0x555c75){logger[_0x5c7c('0x22')]('['+[_0x419f47['toUpperCase']()]+']',_0x555c75[_0x5c7c('0x1a')]);_0x15c0d2(_0x555c75[_0x5c7c('0x1a')]);});});}function getTicket(_0x5271fa,_0x5d4750,_0x5db147,_0xe6558f,_0x556169){return function(_0x3e957e){logger['info'](_0x5c7c('0x32'));return new Promise(function(_0x1fc440,_0x250dcd){var _0x322eb7=moment();var _0x501c72={'method':_0x5c7c('0x33'),'uri':_0x5db147+_0x5c7c('0x34'),'body':{'title':intUtil[_0x5c7c('0x35')](_0xe6558f['Subjects'],_0x556169,'\x20'),'description':intUtil[_0x5c7c('0x35')](_0xe6558f[_0x5c7c('0x36')],_0x556169,'\x0a'),'owner_id':_0x3e957e[_0x5c7c('0x1f')],'creater_id':_0x3e957e['adminId'],'targetable_id':_0x3e957e[_0x5c7c('0x2a')],'targetable_type':_0x5c7c('0x37'),'created_at':_0x322eb7[_0x5c7c('0x2f')](_0x5c7c('0x30')),'due_date':_0x322eb7[_0x5c7c('0x38')](0x1e,'m')[_0x5c7c('0x2f')](_0x5c7c('0x30'))},'json':!![]};_0x501c72[_0x5c7c('0xe')]=_0x5d4750;return rp(_0x501c72)[_0x5c7c('0x11')](function(_0x4e1789){_0x3e957e['ticketId']=_0x4e1789[_0x5c7c('0x39')]['id'];logger[_0x5c7c('0xf')](_0x5c7c('0x3a'),_0x3e957e[_0x5c7c('0x3b')]);_0x1fc440(_0x3e957e);})[_0x5c7c('0x18')](function(_0x4f6a93){logger[_0x5c7c('0x22')]('['+[_0x5271fa[_0x5c7c('0x19')]()]+']',_0x4f6a93[_0x5c7c('0x1a')]);_0x250dcd(_0x4f6a93[_0x5c7c('0x1a')]);});});};}function emit(_0x3bd137,_0x3b7e4f,_0x4f6143){var _0x1a9cf4={'uri':_0x3bd137+'/contacts/'+_0x4f6143};io['to'](util[_0x5c7c('0x2f')](_0x5c7c('0x3c'),_0x3b7e4f))['emit']('trigger:browser:url',_0x1a9cf4);}exports['cs']=function(_0x5b8708,_0x5ed3ab,_0x4f82f8,_0x3c2e13,_0x5e3159,_0x3163dc,_0x29579f,_0x250f90){var _0x1e4a5f={};var _0x37e196={'Authorization':_0x5c7c('0x3d')+_0x3163dc[_0x5c7c('0x3e')]};_0x3163dc[_0x5c7c('0x3f')]=intUtil[_0x5c7c('0x40')](_0x3163dc[_0x5c7c('0x3f')]);_0x3163dc[_0x5c7c('0x41')]=intUtil[_0x5c7c('0x40')](_0x3163dc[_0x5c7c('0x41')]);var _0x63473c=_0x3163dc[_0x5c7c('0x3f')];_0x1e4a5f[_0x5c7c('0x21')]=_0x3163dc[_0x5c7c('0x42')];_0x1e4a5f['contactNumber']=_0x250f90['toLowerCase']()===_0x5c7c('0x43')?_0x5ed3ab[_0x5c7c('0x44')]:_0x5ed3ab[_0x5c7c('0x45')];_0x1e4a5f[_0x5c7c('0x46')]=_0x250f90==='queue'||_0x250f90===_0x5c7c('0x47')?'queue':_0x5c7c('0x43');if(_0x3c2e13){_0x1e4a5f[_0x5c7c('0x1e')]=_0x3c2e13[_0x5c7c('0x14')];}var _0x7cd712=util[_0x5c7c('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3163dc[_0x5c7c('0x41')],_0x5ed3ab[_0x5c7c('0x48')],md5(_0x5ed3ab[_0x5c7c('0x48')]));if(_0x5e3159&&_0x5e3159[_0x5c7c('0x49')]){logger[_0x5c7c('0xf')](_0x5c7c('0x4a'),_0x5c7c('0x4b'));_0x5ed3ab[_0x5c7c('0x4c')]=_0x7cd712;}else if(_0x29579f&&_0x29579f[_0x5c7c('0x4d')]&&_0x29579f[_0x5c7c('0x4d')]!==_0x5c7c('0x4e')){logger[_0x5c7c('0xf')](_0x5c7c('0x4f'),_0x5c7c('0x4b'));_0x5ed3ab[_0x5c7c('0x4c')]=_0x7cd712;}else{_0x5ed3ab[_0x5c7c('0x4c')]='';}return getAdminId(_0x1e4a5f,_0x250f90,_0x37e196,_0x63473c)[_0x5c7c('0x11')](getUser(_0x250f90,_0x37e196,_0x63473c))[_0x5c7c('0x11')](getEndUser(_0x250f90,_0x37e196,_0x63473c))[_0x5c7c('0x11')](getTicket(_0x250f90,_0x37e196,_0x63473c,_0x4f82f8,_0x5ed3ab))[_0x5c7c('0x11')](function(_0x2fe876){logger[_0x5c7c('0xf')](util[_0x5c7c('0x2f')](_0x5c7c('0x50'),_0x2fe876[_0x5c7c('0x3b')]));if(_0x250f90!==_0x5c7c('0x47')){logger[_0x5c7c('0xf')]('['+[_0x250f90[_0x5c7c('0x19')]()]+']',_0x5c7c('0x51'));emit(_0x63473c,_0x3c2e13['name'],_0x2fe876[_0x5c7c('0x2a')]);}})[_0x5c7c('0x18')](function(_0x2bcb61){logger[_0x5c7c('0x22')]('['+[_0x250f90['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x5c7c('0x52')](_0x2bcb61,{'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 48aea2a..7925426 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 _0xc3d9=['../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','sugarcrm','freshsales','log','unknown\x20integration'];(function(_0x5c0ed7,_0x2f635e){var _0x58805e=function(_0x563983){while(--_0x563983){_0x5c0ed7['push'](_0x5c0ed7['shift']());}};_0x58805e(++_0x2f635e);}(_0xc3d9,0x13e));var _0x9c3d=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xc3d9[_0x2eb3db];return _0x358f33;};'use strict';var _=require(_0x9c3d('0x0'));var util=require(_0x9c3d('0x1'));var zendesk=require(_0x9c3d('0x2'));var salesforce=require(_0x9c3d('0x3'));var sugarcrm=require(_0x9c3d('0x4'));var freshdesk=require(_0x9c3d('0x5'));var zoho=require('./zoho');var desk=require(_0x9c3d('0x6'));var vtiger=require(_0x9c3d('0x7'));var servicenow=require(_0x9c3d('0x8'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=['zendesk',_0x9c3d('0x9'),'sugarcrm',_0x9c3d('0xa'),_0x9c3d('0xb'),_0x9c3d('0xc'),_0x9c3d('0xd'),_0x9c3d('0xe'),'freshsales',_0x9c3d('0xf')];exports[_0x9c3d('0x10')]=function(_0x3f2bf3,_0x4cb6b7,_0x563a7c,_0x1d8b72,_0x380f50,_0xdf50ee){if(_0x563a7c){if(_[_0x9c3d('0x11')](integrations,_0x3f2bf3[_0x9c3d('0x12')][_0x9c3d('0x13')]())){try{var _0x4f0821=null;var _0x46579b='';var _0x992514=_0x563a7c[_0x3f2bf3[_0x9c3d('0x12')][_0x9c3d('0x13')]()];if(_0x992514){var _0x4a59ee=_0x992514[_0x3f2bf3[_0x9c3d('0x14')]];if(_0x4a59ee){var _0x29c509=_['find'](_0x4a59ee[_0x9c3d('0x15')],{'id':parseInt(_0x3f2bf3[_0x9c3d('0x16')],0xa)});if(_0x29c509){if(_0x1d8b72){if(_0x380f50&&_0x4cb6b7[_0x9c3d('0x17')]){_0x46579b='queue';}else if(_0x4cb6b7[_0x9c3d('0x18')]){_0x46579b=_0x9c3d('0x19');}else{console['log'](_0x9c3d('0x1a'),_0x4cb6b7);}}else{_0x46579b=_0x9c3d('0x1b');}switch(_0x3f2bf3[_0x9c3d('0x12')][_0x9c3d('0x13')]()){case _0x9c3d('0x1c'):zendesk[_0x46579b](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee);break;case'salesforce':salesforce[_0x46579b](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee);break;case _0x9c3d('0x1d'):sugarcrm[_0x46579b](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee);break;case _0x9c3d('0xa'):freshdesk[_0x46579b](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee);break;case _0x9c3d('0xb'):zoho[_0x46579b](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee);break;case _0x9c3d('0xc'):desk[_0x46579b](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee);break;case _0x9c3d('0xd'):vtiger[_0x46579b](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee);break;case _0x9c3d('0x1e'):freshsales['cs'](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee,_0x46579b);break;case _0x9c3d('0xf'):servicenow['cs'](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee,_0x46579b);break;case'dynamics365':dynamics365['cs'](_0x3f2bf3,_0x4cb6b7,_0x29c509,_0x1d8b72,_0x380f50,_0x4a59ee,_0xdf50ee,_0x46579b);break;default:console[_0x9c3d('0x1f')](_0x9c3d('0x20'));}}else{_0x4f0821=require(_0x9c3d('0x21'))(_0x3f2bf3[_0x9c3d('0x12')][_0x9c3d('0x13')]());_0x4f0821[_0x9c3d('0x22')]('[EXEC]',util['format'](_0x9c3d('0x23'),_0x3f2bf3['data1'][_0x9c3d('0x13')](),_0x3f2bf3[_0x9c3d('0x16')]));}}else{_0x4f0821=require(_0x9c3d('0x21'))(_0x3f2bf3[_0x9c3d('0x12')][_0x9c3d('0x13')]());_0x4f0821['error'](_0x9c3d('0x24'),util[_0x9c3d('0x25')](_0x9c3d('0x26'),_0x3f2bf3['data1'][_0x9c3d('0x13')](),_0x3f2bf3[_0x9c3d('0x14')]));}}else{}}catch(_0x1ac058){console[_0x9c3d('0x22')](_0x1ac058);}}}}; \ No newline at end of file +var _0x210c=['error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound','sugarcrm','zoho','log','unknown\x20integration','../../../../config/logger'];(function(_0x194660,_0x57e63d){var _0x1084e3=function(_0x4ff65d){while(--_0x4ff65d){_0x194660['push'](_0x194660['shift']());}};_0x1084e3(++_0x57e63d);}(_0x210c,0x190));var _0xc210=function(_0x18307e,_0x1898e8){_0x18307e=_0x18307e-0x0;var _0x24186b=_0x210c[_0x18307e];return _0x24186b;};'use strict';var _=require(_0xc210('0x0'));var util=require(_0xc210('0x1'));var zendesk=require(_0xc210('0x2'));var salesforce=require(_0xc210('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xc210('0x4'));var zoho=require(_0xc210('0x5'));var desk=require('./desk');var vtiger=require(_0xc210('0x6'));var servicenow=require(_0xc210('0x7'));var dynamics365=require(_0xc210('0x8'));var freshsales=require(_0xc210('0x9'));var integrations=[_0xc210('0xa'),_0xc210('0xb'),'sugarcrm',_0xc210('0xc'),'zoho',_0xc210('0xd'),_0xc210('0xe'),_0xc210('0xf'),_0xc210('0x10'),_0xc210('0x11')];exports[_0xc210('0x12')]=function(_0x256647,_0x3834f5,_0xf38c33,_0xb37e78,_0x2048f5,_0x29fe25){if(_0xf38c33){if(_[_0xc210('0x13')](integrations,_0x256647[_0xc210('0x14')][_0xc210('0x15')]())){try{var _0xb17978=null;var _0x2f50be='';var _0x519e8e=_0xf38c33[_0x256647[_0xc210('0x14')][_0xc210('0x15')]()];if(_0x519e8e){var _0x146066=_0x519e8e[_0x256647[_0xc210('0x16')]];if(_0x146066){var _0x3ee7d3=_['find'](_0x146066[_0xc210('0x17')],{'id':parseInt(_0x256647[_0xc210('0x18')],0xa)});if(_0x3ee7d3){if(_0xb37e78){if(_0x2048f5&&_0x3834f5[_0xc210('0x19')]){_0x2f50be=_0xc210('0x19');}else if(_0x3834f5['routeId']){_0x2f50be=_0xc210('0x1a');}else{console['log']('EVENT\x20UNKNOWN',_0x3834f5);}}else{_0x2f50be='unmanaged';}switch(_0x256647['data1'][_0xc210('0x15')]()){case _0xc210('0xa'):zendesk[_0x2f50be](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25);break;case _0xc210('0xb'):salesforce[_0x2f50be](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25);break;case _0xc210('0x1b'):sugarcrm[_0x2f50be](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25);break;case _0xc210('0xc'):freshdesk[_0x2f50be](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25);break;case _0xc210('0x1c'):zoho[_0x2f50be](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25);break;case'desk':desk[_0x2f50be](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25);break;case _0xc210('0xe'):vtiger[_0x2f50be](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25);break;case _0xc210('0x10'):freshsales['cs'](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25,_0x2f50be);break;case _0xc210('0x11'):servicenow['cs'](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25,_0x2f50be);break;case _0xc210('0xf'):dynamics365['cs'](_0x256647,_0x3834f5,_0x3ee7d3,_0xb37e78,_0x2048f5,_0x146066,_0x29fe25,_0x2f50be);break;default:console[_0xc210('0x1d')](_0xc210('0x1e'));}}else{_0xb17978=require(_0xc210('0x1f'))(_0x256647[_0xc210('0x14')]['toLowerCase']());_0xb17978[_0xc210('0x20')](_0xc210('0x21'),util[_0xc210('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x256647[_0xc210('0x14')][_0xc210('0x15')](),_0x256647['data3']));}}else{_0xb17978=require(_0xc210('0x1f'))(_0x256647[_0xc210('0x14')]['toLowerCase']());_0xb17978['error'](_0xc210('0x21'),util[_0xc210('0x22')](_0xc210('0x23'),_0x256647[_0xc210('0x14')][_0xc210('0x15')](),_0x256647['data2']));}}else{}}catch(_0x11f57d){console['error'](_0x11f57d);}}}}; \ 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 f4f56ea..5905ce6 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 _0x3ca4=['ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','account','ticketType','Case','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','cloneDeep','Account','additionalSearchAccount','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','Task'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x3ca4,0x171));var _0x43ca=function(_0x324b5c,_0x1c1b94){_0x324b5c=_0x324b5c-0x0;var _0x68d844=_0x3ca4[_0x324b5c];return _0x68d844;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x43ca('0x0'));var BPromise=require(_0x43ca('0x1'));var md5=require(_0x43ca('0x2'));var jsforce=require(_0x43ca('0x3'));var util=require(_0x43ca('0x4'));var Redis=require(_0x43ca('0x5'));var intUtil=require(_0x43ca('0x6'));var config=require(_0x43ca('0x7'));var logger=require(_0x43ca('0x8'))('salesforce');config['redis']=_[_0x43ca('0x9')](config[_0x43ca('0xa')],{'host':_0x43ca('0xb'),'port':0x18eb});var io=require(_0x43ca('0xc'))(new Redis(config[_0x43ca('0xa')]));function emit(_0x92484,_0x1c8614,_0x62712d){io['to'](_0x92484)['emit'](_0x1c8614,_0x62712d);}function getTicket(_0x56e267,_0x183abe,_0x11fd61,_0x4743b1,_0xa319d0,_0x24d2f9,_0x432835,_0x546a04){var _0x59e1b2=Object[_0x43ca('0xd')]({},{'OwnerId':_0x183abe['id'],'Subject':intUtil[_0x43ca('0xe')](_0x4743b1[_0x43ca('0xf')],_0xa319d0,'\x20'),'Description':intUtil[_0x43ca('0xe')](_0x4743b1[_0x43ca('0x10')],_0xa319d0,'\x0a')},getCustomFields(_0x24d2f9,_0xa319d0));if(_0x11fd61){if(_0x4743b1['ticketType']===_0x43ca('0x11')){_0x59e1b2[_0x43ca('0x12')]=moment[_0x43ca('0x13')]();_0x59e1b2[_0x43ca('0x14')]=![];_0x59e1b2[_0x43ca('0x15')]=![];if(_0x11fd61['endUserType']===_0x43ca('0x16')||_0x11fd61[_0x43ca('0x17')]===_0x43ca('0x18')){_0x59e1b2['WhoId']=_0x11fd61['id'];}else if(_0x11fd61[_0x43ca('0x17')]===_0x43ca('0x19')){_0x59e1b2['WhatId']=_0x11fd61['id'];}}else if(_0x4743b1[_0x43ca('0x1a')]===_0x43ca('0x1b')){if(_0x11fd61[_0x43ca('0x17')]===_0x43ca('0x16')){_0x59e1b2['ContactId']=_0x11fd61['id'];}else if(_0x11fd61[_0x43ca('0x17')]===_0x43ca('0x19')){_0x59e1b2['AccountId']=_0x11fd61['id'];}else if(_0x11fd61['endUserType']==='lead'&&_0x4743b1[_0x43ca('0x1c')]){_0x59e1b2[_0x4743b1[_0x43ca('0x1c')]]=_0x11fd61['id'];}else{logger['info'](_0x43ca('0x1d'));}}}return _0x432835[_0x43ca('0x1e')](_0x4743b1['ticketType'])[_0x43ca('0x1f')](_0x59e1b2);}function getUser(_0x5e5995,_0x52f9e3,_0x339da5){if(!_[_0x43ca('0x20')](_0x52f9e3)&&intUtil[_0x43ca('0x21')](_0x52f9e3)){var _0x35e445={'Email':_0x52f9e3};var _0x3a0dbc={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x339da5['sobject'](_0x43ca('0x22'))[_0x43ca('0x23')](_0x35e445,_0x3a0dbc)[_0x43ca('0x24')]()[_0x43ca('0x25')](function(_0x290bf0){if(_0x290bf0[_0x43ca('0x26')]){var _0x2cda1c=_[_0x43ca('0x23')](_0x290bf0,function(_0x4c7fe8){return _0x4c7fe8['Email']===_0x52f9e3;});if(_0x2cda1c){logger['info'](_0x43ca('0x27'),_0x52f9e3);return BPromise[_0x43ca('0x28')]({'id':_0x2cda1c['Id'],'name':_0x2cda1c[_0x43ca('0x29')]});}}else{logger[_0x43ca('0x2a')](_0x43ca('0x2b'),_0x52f9e3);return _0x339da5[_0x43ca('0x2c')]()['then'](function(_0x44ddf5){return BPromise[_0x43ca('0x28')]({'id':_0x44ddf5[_0x43ca('0x2d')],'name':_0x44ddf5[_0x43ca('0x2e')]});});}});}else{logger[_0x43ca('0x2a')](_0x43ca('0x2b'),_0x52f9e3);return _0x339da5['identity']()[_0x43ca('0x25')](function(_0x78ddc5){return BPromise[_0x43ca('0x28')]({'id':_0x78ddc5[_0x43ca('0x2d')],'name':_0x78ddc5[_0x43ca('0x2e')]});});}}function getEndUser(_0xe6b2d8,_0x350234,_0x4ce605,_0x241f94,_0xd60d1b){var _0x4f8152={'$or':{'Phone':_0x241f94}};var _0x8d8b39={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x43ca('0x28')]()['then'](function(){logger[_0x43ca('0x2a')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x241f94,_0x350234[_0x43ca('0x2f')]);switch(_0x350234['moduleSearch']){case'contact_lead':var _0x3abf1c=_['cloneDeep'](_0x4f8152);if(_0x350234[_0x43ca('0x30')]){var _0x8d7c43={};_0x8d7c43[_0x350234[_0x43ca('0x30')]]=_0x241f94;_[_0x43ca('0x31')](_0x3abf1c[_0x43ca('0x32')],_0x8d7c43);}return _0xd60d1b[_0x43ca('0x1e')](_0x43ca('0x33'))['find'](_0x3abf1c,_0x8d8b39)[_0x43ca('0x24')]()[_0x43ca('0x25')](function(_0x2422a2){if(_0x2422a2&&_0x2422a2['length']){return _0x2422a2;}else{var _0x5db055=_['cloneDeep'](_0x4f8152);if(_0x350234['additionalSearchLead']){var _0x551d82={};_0x551d82[_0x350234[_0x43ca('0x34')]]=_0x241f94;_[_0x43ca('0x31')](_0x5db055[_0x43ca('0x32')],_0x551d82);}return _0xd60d1b['sobject'](_0x43ca('0x35'))[_0x43ca('0x23')](_0x5db055,_0x8d8b39);}});case _0x43ca('0x36'):var _0x26dfba=_[_0x43ca('0x37')](_0x4f8152);if(_0x350234['additionalSearchAccount']){var _0x8d7c43={};_0x8d7c43[_0x350234['additionalSearchAccount']]=_0x241f94;_[_0x43ca('0x31')](_0x26dfba[_0x43ca('0x32')],_0x8d7c43);}return _0xd60d1b['sobject'](_0x43ca('0x38'))[_0x43ca('0x23')](_0x26dfba,_0x8d8b39)[_0x43ca('0x24')]()[_0x43ca('0x25')](function(_0x455f4c){if(_0x455f4c&&_0x455f4c[_0x43ca('0x26')]){return _0x455f4c;}else{var _0x2ddca8=_['cloneDeep'](_0x4f8152);if(_0x350234[_0x43ca('0x30')]){var _0x1b2a30={};_0x1b2a30[_0x350234[_0x43ca('0x30')]]=_0x241f94;_[_0x43ca('0x31')](_0x2ddca8[_0x43ca('0x32')],_0x1b2a30);}return _0xd60d1b[_0x43ca('0x1e')](_0x43ca('0x33'))[_0x43ca('0x23')](_0x2ddca8,_0x8d8b39)[_0x43ca('0x25')](function(_0x54238e){if(_0x54238e&&_0x54238e['length']){return _0x54238e;}else{var _0xcdc03c=_[_0x43ca('0x37')](_0x4f8152);if(_0x350234['additionalSearchLead']){var _0x1dd226={};_0x1dd226[_0x350234['additionalSearchLead']]=_0x241f94;_[_0x43ca('0x31')](_0xcdc03c['$or'],_0x1dd226);}return _0xd60d1b['sobject'](_0x43ca('0x35'))[_0x43ca('0x23')](_0xcdc03c,_0x8d8b39);}});}});case _0x43ca('0x16'):var _0x3abf1c=_[_0x43ca('0x37')](_0x4f8152);if(_0x350234[_0x43ca('0x30')]){var _0x8d7c43={};_0x8d7c43[_0x350234[_0x43ca('0x30')]]=_0x241f94;_[_0x43ca('0x31')](_0x3abf1c[_0x43ca('0x32')],_0x8d7c43);}return _0xd60d1b[_0x43ca('0x1e')](_0x43ca('0x33'))[_0x43ca('0x23')](_0x3abf1c,_0x8d8b39)[_0x43ca('0x24')]();case _0x43ca('0x18'):var _0x224608=_['cloneDeep'](_0x4f8152);if(_0x350234[_0x43ca('0x34')]){var _0x8d7c43={};_0x8d7c43[_0x350234[_0x43ca('0x34')]]=_0x241f94;_[_0x43ca('0x31')](_0x224608[_0x43ca('0x32')],_0x8d7c43);}return _0xd60d1b[_0x43ca('0x1e')](_0x43ca('0x35'))[_0x43ca('0x23')](_0x224608,_0x8d8b39);case _0x43ca('0x19'):var _0x26dfba=_[_0x43ca('0x37')](_0x4f8152);if(_0x350234[_0x43ca('0x39')]){var _0x8d7c43={};_0x8d7c43[_0x350234[_0x43ca('0x39')]]=_0x241f94;_[_0x43ca('0x31')](_0x26dfba[_0x43ca('0x32')],_0x8d7c43);}return _0xd60d1b[_0x43ca('0x1e')](_0x43ca('0x38'))[_0x43ca('0x23')](_0x26dfba,_0x8d8b39);default:return null;}})[_0x43ca('0x25')](function(_0xdacd07){if(_0xdacd07&&_0xdacd07[_0x43ca('0x26')]){var _0x117575=_['first'](_0xdacd07);if(_0x117575){return BPromise[_0x43ca('0x28')]({'id':_0x117575['Id'],'name':_0x117575['Name'],'phone':_0x117575[_0x43ca('0x3a')],'endUserType':_0x117575[_0x43ca('0x3b')][_0x43ca('0x3c')]['toLowerCase']()});}}})[_0x43ca('0x25')](function(_0x318167){if(_0x318167){logger['info'](_0x43ca('0x3d'),_0x318167[_0x43ca('0x17')],_0x241f94);return BPromise[_0x43ca('0x28')](_0x318167);}else{logger[_0x43ca('0x2a')](_0x43ca('0x3e'),_0x241f94);var _0x55908c={'Phone':_0x241f94};if(_0x350234[_0x43ca('0x3f')]){if(_0x350234[_0x43ca('0x3f')]===_0x43ca('0x16')){logger['info'](_0x43ca('0x40'),_0x241f94,_0x350234[_0x43ca('0x3f')]);_0x55908c[_0x43ca('0x41')]=_0x4ce605!==_0x43ca('0x42')?_0x4ce605:util[_0x43ca('0x43')](_0x43ca('0x44'),_0x241f94);}else if(_0x350234[_0x43ca('0x3f')]===_0x43ca('0x18')){logger[_0x43ca('0x2a')](_0x43ca('0x40'),_0x241f94,_0x350234['moduleCreate']);_0x55908c[_0x43ca('0x41')]=_0x4ce605!==''?_0x4ce605:util[_0x43ca('0x43')](_0x43ca('0x44'),_0x241f94);_0x55908c[_0x43ca('0x45')]=_0x43ca('0x46');}else if(_0x350234[_0x43ca('0x3f')]===_0x43ca('0x19')){logger[_0x43ca('0x2a')](_0x43ca('0x40'),_0x241f94,_0x350234[_0x43ca('0x3f')]);_0x55908c[_0x43ca('0x29')]=_0x4ce605!==_0x43ca('0x42')?_0x4ce605:util[_0x43ca('0x43')](_0x43ca('0x44'),_0x241f94);}else{return null;}}return _0xd60d1b['sobject'](_[_0x43ca('0x47')](_0x350234['moduleCreate']))[_0x43ca('0x1f')](_0x55908c)[_0x43ca('0x25')](function(_0xba09f4){return BPromise[_0x43ca('0x28')]({'id':_0xba09f4['id'],'endUserType':_0x350234[_0x43ca('0x3f')]});});}});}function getCustomFields(_0xc8f734,_0x4a3aaa){var _0x1ec9fc={};if(_0xc8f734['length']>0x0){_[_0x43ca('0x48')](_0xc8f734,function(_0x469f9d){if(_[_0x43ca('0x49')]([_0x43ca('0x4a'),_0x43ca('0x4b')],_0x469f9d[_0x43ca('0x3c')])&&_0x469f9d['idField']){_0x1ec9fc[_0x469f9d[_0x43ca('0x4c')]]=_0x469f9d[_0x43ca('0x4d')][_0x43ca('0x4e')]();}else if(_0x469f9d[_0x43ca('0x3c')]===_0x43ca('0x4f')&&_0x469f9d[_0x43ca('0x50')]&&_0x469f9d[_0x43ca('0x4c')]){_0x4a3aaa[_0x469f9d['variableName']]&&(_0x1ec9fc[_0x469f9d[_0x43ca('0x4c')]]=_0x4a3aaa[_0x469f9d[_0x43ca('0x50')]][_0x43ca('0x4e')]());}else if(_0x469f9d[_0x43ca('0x3c')]===_0x43ca('0x51')&&_0x469f9d[_0x43ca('0x52')]&&_0x469f9d[_0x43ca('0x52')][_0x43ca('0x53')]&&_0x469f9d[_0x43ca('0x4c')]){_0x4a3aaa[_0x469f9d[_0x43ca('0x52')][_0x43ca('0x53')]['toLowerCase']()]&&(_0x1ec9fc[_0x469f9d[_0x43ca('0x4c')]]=_0x4a3aaa[_0x469f9d[_0x43ca('0x52')]['name'][_0x43ca('0x54')]()]['toString']());}});}return _0x1ec9fc;}function getConnection(_0x287d64){var _0x24339a=_0x287d64[_0x43ca('0x55')][_0x43ca('0x56')](_0x287d64[_0x43ca('0x57')]);var _0x3409f6=new jsforce[(_0x43ca('0x58'))]({'oauth2':{'loginUrl':_0x287d64[_0x43ca('0x59')]||'https://login.salesforce.com','clientId':_0x287d64[_0x43ca('0x5a')],'clientSecret':_0x287d64[_0x43ca('0x5b')]}});return _0x3409f6[_0x43ca('0x5c')](_0x287d64[_0x43ca('0x5d')],_0x24339a)[_0x43ca('0x25')](function(){logger[_0x43ca('0x2a')](_0x43ca('0x5e'));return _0x3409f6;});}exports[_0x43ca('0x5f')]=function(_0x1f8b82,_0x51a211,_0x1a000a,_0xa59ae0,_0x5e7870,_0x51489a){var _0x5e487a,_0x395d44,_0x91b9ee,_0x8551df;_0x51489a[_0x43ca('0x60')]=intUtil[_0x43ca('0x61')](_0x51489a[_0x43ca('0x60')]);_0x51489a[_0x43ca('0x59')]=intUtil[_0x43ca('0x61')](_0x51489a[_0x43ca('0x59')]);if(_0x5e7870&&_0x5e7870[_0x43ca('0x62')]){logger[_0x43ca('0x2a')](_0x43ca('0x63'),_0x43ca('0x64'));_0x51a211['recordingURL']=util[_0x43ca('0x43')](_0x43ca('0x65'),_0x51489a[_0x43ca('0x60')],_0x51a211['uniqueid'],md5(_0x51a211['uniqueid']));}else{_0x51a211['recordingURL']='';}return getConnection(_0x51489a)['then'](function(_0x8fdb2c){_0x8551df=_0x8fdb2c;return getUser(_0x51489a,_0xa59ae0[_0x43ca('0x66')],_0x8551df);})[_0x43ca('0x25')](function(_0xac32fd){_0x5e487a=_0xac32fd;return getEndUser(_0x51489a,_0x1a000a,_0x51a211[_0x43ca('0x67')],_0x51a211[_0x43ca('0x68')],_0x8551df);})['then'](function(_0x2b4b94){_0x395d44=_0x2b4b94;return getTicket(_0x51489a,_0x5e487a,_0x395d44,_0x1a000a,_0x51a211,_0x1a000a[_0x43ca('0x69')],_0x8551df,'queue');})[_0x43ca('0x25')](function(_0xb9cd0e){_0x91b9ee=_0xb9cd0e;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x91b9ee['id']);logger[_0x43ca('0x2a')](_0x43ca('0x6a'),_0x91b9ee['id'],_0xa59ae0['name'],_0x51489a[_0x43ca('0x3c')]);switch(_0x51489a[_0x43ca('0x3c')]){case _0x43ca('0x6b'):emit(util[_0x43ca('0x43')]('user:%s',_0xa59ae0[_0x43ca('0x53')]),'trigger:salesforce:display',{'recordId':_0x91b9ee['id']});break;case'newTab':emit(util[_0x43ca('0x43')](_0x43ca('0x6c'),_0xa59ae0[_0x43ca('0x53')]),'trigger:browser:url',{'uri':util[_0x43ca('0x43')](_0x43ca('0x6d'),_0x8551df[_0x43ca('0x6e')],_0x91b9ee['id'])});break;default:logger[_0x43ca('0x6f')](_0x43ca('0x70'));}})[_0x43ca('0x71')](function(_0x328015){logger[_0x43ca('0x6f')]('[QUEUE]',_0x328015);});};exports[_0x43ca('0x72')]=function(_0x5c08e5,_0x2275a1,_0x35612b,_0x189fe2,_0x3a55e0,_0x44b5ea,_0x154859){var _0x3ce736,_0x284236,_0x3d1f82,_0x5e0fd3;_0x44b5ea[_0x43ca('0x60')]=intUtil[_0x43ca('0x61')](_0x44b5ea['serverUrl']);_0x44b5ea[_0x43ca('0x59')]=intUtil[_0x43ca('0x61')](_0x44b5ea[_0x43ca('0x59')]);if(_0x154859&&_0x154859[_0x43ca('0x73')]&&_0x154859[_0x43ca('0x73')]!==_0x43ca('0x74')){logger[_0x43ca('0x2a')](_0x43ca('0x75'),_0x43ca('0x64'));_0x2275a1[_0x43ca('0x76')]=util[_0x43ca('0x43')](_0x43ca('0x65'),_0x44b5ea[_0x43ca('0x60')],_0x2275a1['uniqueid'],md5(_0x2275a1[_0x43ca('0x77')]));}return getConnection(_0x44b5ea)[_0x43ca('0x25')](function(_0x1ce5da){_0x5e0fd3=_0x1ce5da;return getUser(_0x44b5ea,_0x189fe2[_0x43ca('0x66')],_0x5e0fd3);})[_0x43ca('0x25')](function(_0x3ef177){_0x3ce736=_0x3ef177;return getEndUser(_0x44b5ea,_0x35612b,_0x2275a1[_0x43ca('0x78')],_0x2275a1[_0x43ca('0x79')],_0x5e0fd3);})['then'](function(_0xaf2991){_0x284236=_0xaf2991;return getTicket(_0x44b5ea,_0x3ce736,_0x284236,_0x35612b,_0x2275a1,_0x35612b[_0x43ca('0x69')],_0x5e0fd3,_0x43ca('0x72'));})[_0x43ca('0x25')](function(_0x587a74){_0x3d1f82=_0x587a74;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3d1f82['id']);logger[_0x43ca('0x2a')](_0x43ca('0x7a'),_0x3d1f82['id'],_0x189fe2['name'],_0x44b5ea[_0x43ca('0x3c')]);switch(_0x44b5ea[_0x43ca('0x3c')]){case'integrationTab':emit(util['format'](_0x43ca('0x6c'),_0x189fe2[_0x43ca('0x53')]),_0x43ca('0x7b'),{'recordId':_0x3d1f82['id']});break;case _0x43ca('0x7c'):emit(util[_0x43ca('0x43')](_0x43ca('0x6c'),_0x189fe2[_0x43ca('0x53')]),'trigger:browser:url',{'uri':util[_0x43ca('0x43')](_0x43ca('0x6d'),_0x5e0fd3[_0x43ca('0x6e')],_0x3d1f82['id'])});break;default:logger[_0x43ca('0x6f')]('[OUTBOUND]',_0x43ca('0x7d'));}})[_0x43ca('0x71')](function(_0x18de9d){logger['error'](_0x43ca('0x75'),_0x18de9d);});};exports['unmanaged']=function(_0x9af0a7,_0x282567,_0x9344d7,_0x28f33f,_0x1d20ba,_0x5834ed){var _0x44eec2,_0x57a9aa,_0x285cd0,_0x1ab079;_0x5834ed[_0x43ca('0x60')]=intUtil['stripTrailingSlash'](_0x5834ed[_0x43ca('0x60')]);_0x5834ed[_0x43ca('0x59')]=intUtil['stripTrailingSlash'](_0x5834ed[_0x43ca('0x59')]);if(_0x1d20ba&&_0x1d20ba[_0x43ca('0x62')]){logger[_0x43ca('0x2a')]('['+_0x282567[_0x43ca('0x7e')][_0x43ca('0x7f')]()+']',_0x43ca('0x64'));_0x282567[_0x43ca('0x76')]=util[_0x43ca('0x43')](_0x43ca('0x65'),_0x5834ed[_0x43ca('0x60')],_0x282567[_0x43ca('0x77')],md5(_0x282567[_0x43ca('0x77')]));}else{_0x282567[_0x43ca('0x76')]='';}return getConnection(_0x5834ed)[_0x43ca('0x25')](function(_0x356c42){_0x1ab079=_0x356c42;if(!_[_0x43ca('0x20')](_0x28f33f)){return getUser(_0x5834ed,_0x28f33f[_0x43ca('0x53')],_0x1ab079);}else{return getUser(_0x5834ed,null,_0x1ab079);}})[_0x43ca('0x25')](function(_0x4b1c24){_0x44eec2=_0x4b1c24;return getEndUser(_0x5834ed,_0x9344d7,_0x282567[_0x43ca('0x67')],_0x282567[_0x43ca('0x68')],_0x1ab079);})['then'](function(_0x226c70){_0x57a9aa=_0x226c70;return getTicket(_0x5834ed,_0x44eec2,_0x57a9aa,_0x9344d7,_0x282567,_0x9344d7[_0x43ca('0x69')],_0x1ab079);})['then'](function(_0x8cc6bc){_0x285cd0=_0x8cc6bc;logger[_0x43ca('0x2a')]('['+_0x282567['lastevent']['toUpperCase']()+_0x43ca('0x80'),_0x285cd0['id']);logger[_0x43ca('0x2a')]('['+_0x282567[_0x43ca('0x7e')][_0x43ca('0x7f')]()+']\x20Integration\x20account\x20type\x20%s.',_0x5834ed[_0x43ca('0x3c')]);})[_0x43ca('0x71')](function(_0x30687b){logger[_0x43ca('0x6f')]('['+_0x282567[_0x43ca('0x7e')][_0x43ca('0x7f')]()+']',_0x30687b);});}; \ No newline at end of file +var _0xac8d=['Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','assign','getString','Subjects','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','lead','WhoId','endUserType','account','WhatId','ticketType','contact','ContactId','AccountId','leadId','sobject','isNil','validateEmail','User','find','length','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','Lead','additionalSearchAccount','$or','Account','execute','first','Phone','toLowerCase','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','create','includes','string','picklist','type','idField','content','variable','variableName','customVariable','Variable','name','toString','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','instanceUrl'];(function(_0x53e507,_0xa63b69){var _0x3001fc=function(_0x59ae4f){while(--_0x59ae4f){_0x53e507['push'](_0x53e507['shift']());}};_0x3001fc(++_0xa63b69);}(_0xac8d,0x108));var _0xdac8=function(_0x217fec,_0x50058f){_0x217fec=_0x217fec-0x0;var _0x48cf71=_0xac8d[_0x217fec];return _0x48cf71;};'use strict';var _=require('lodash');var rp=require(_0xdac8('0x0'));var moment=require(_0xdac8('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xdac8('0x2'));var Redis=require(_0xdac8('0x3'));var intUtil=require('./util');var config=require(_0xdac8('0x4'));var logger=require(_0xdac8('0x5'))('salesforce');config[_0xdac8('0x6')]=_[_0xdac8('0x7')](config[_0xdac8('0x6')],{'host':_0xdac8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdac8('0x6')]));function emit(_0x189843,_0x8553da,_0x3e1162){io['to'](_0x189843)[_0xdac8('0x9')](_0x8553da,_0x3e1162);}function getTicket(_0x144d3f,_0xc0d1d6,_0x297945,_0xae6369,_0xbde9e4,_0x42b8d5,_0x58642c,_0x159a92){var _0x5d71f4=Object[_0xdac8('0xa')]({},{'OwnerId':_0xc0d1d6['id'],'Subject':intUtil[_0xdac8('0xb')](_0xae6369[_0xdac8('0xc')],_0xbde9e4,'\x20'),'Description':intUtil[_0xdac8('0xb')](_0xae6369['Descriptions'],_0xbde9e4,'\x0a')},getCustomFields(_0x42b8d5,_0xbde9e4));if(_0x297945){if(_0xae6369['ticketType']===_0xdac8('0xd')){_0x5d71f4[_0xdac8('0xe')]=moment[_0xdac8('0xf')]();_0x5d71f4[_0xdac8('0x10')]=![];_0x5d71f4[_0xdac8('0x11')]=![];if(_0x297945['endUserType']==='contact'||_0x297945['endUserType']===_0xdac8('0x12')){_0x5d71f4[_0xdac8('0x13')]=_0x297945['id'];}else if(_0x297945[_0xdac8('0x14')]===_0xdac8('0x15')){_0x5d71f4[_0xdac8('0x16')]=_0x297945['id'];}}else if(_0xae6369[_0xdac8('0x17')]==='Case'){if(_0x297945['endUserType']===_0xdac8('0x18')){_0x5d71f4[_0xdac8('0x19')]=_0x297945['id'];}else if(_0x297945[_0xdac8('0x14')]===_0xdac8('0x15')){_0x5d71f4[_0xdac8('0x1a')]=_0x297945['id'];}else if(_0x297945[_0xdac8('0x14')]==='lead'&&_0xae6369[_0xdac8('0x1b')]){_0x5d71f4[_0xae6369[_0xdac8('0x1b')]]=_0x297945['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x58642c[_0xdac8('0x1c')](_0xae6369[_0xdac8('0x17')])['create'](_0x5d71f4);}function getUser(_0x4d97f1,_0x1bf097,_0x1a97cf){if(!_[_0xdac8('0x1d')](_0x1bf097)&&intUtil[_0xdac8('0x1e')](_0x1bf097)){var _0x362173={'Email':_0x1bf097};var _0x2ea1c6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1a97cf[_0xdac8('0x1c')](_0xdac8('0x1f'))[_0xdac8('0x20')](_0x362173,_0x2ea1c6)['execute']()['then'](function(_0x4904d5){if(_0x4904d5[_0xdac8('0x21')]){var _0x328893=_[_0xdac8('0x20')](_0x4904d5,function(_0x83fa84){return _0x83fa84['Email']===_0x1bf097;});if(_0x328893){logger['info'](_0xdac8('0x22'),_0x1bf097);return BPromise[_0xdac8('0x23')]({'id':_0x328893['Id'],'name':_0x328893[_0xdac8('0x24')]});}}else{logger[_0xdac8('0x25')](_0xdac8('0x26'),_0x1bf097);return _0x1a97cf['identity']()[_0xdac8('0x27')](function(_0x165d2c){return BPromise[_0xdac8('0x23')]({'id':_0x165d2c[_0xdac8('0x28')],'name':_0x165d2c[_0xdac8('0x29')]});});}});}else{logger['info'](_0xdac8('0x26'),_0x1bf097);return _0x1a97cf[_0xdac8('0x2a')]()[_0xdac8('0x27')](function(_0x2c5b3c){return BPromise[_0xdac8('0x23')]({'id':_0x2c5b3c['user_id'],'name':_0x2c5b3c[_0xdac8('0x29')]});});}}function getEndUser(_0x34673e,_0x207dcb,_0x5047b5,_0x44ffa2,_0x47fa46){var _0x475c18={'$or':{'Phone':_0x44ffa2}};var _0x4744b8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdac8('0x23')]()[_0xdac8('0x27')](function(){logger['info'](_0xdac8('0x2b'),_0x44ffa2,_0x207dcb[_0xdac8('0x2c')]);switch(_0x207dcb[_0xdac8('0x2c')]){case'contact_lead':var _0x24544e=_[_0xdac8('0x2d')](_0x475c18);if(_0x207dcb[_0xdac8('0x2e')]){var _0x1419a1={};_0x1419a1[_0x207dcb['additionalSearchContact']]=_0x44ffa2;_[_0xdac8('0x2f')](_0x24544e['$or'],_0x1419a1);}return _0x47fa46[_0xdac8('0x1c')](_0xdac8('0x30'))[_0xdac8('0x20')](_0x24544e,_0x4744b8)['execute']()['then'](function(_0x1a87a0){if(_0x1a87a0&&_0x1a87a0[_0xdac8('0x21')]){return _0x1a87a0;}else{var _0x5cbc5e=_[_0xdac8('0x2d')](_0x475c18);if(_0x207dcb[_0xdac8('0x31')]){var _0x2bf06c={};_0x2bf06c[_0x207dcb[_0xdac8('0x31')]]=_0x44ffa2;_['merge'](_0x5cbc5e['$or'],_0x2bf06c);}return _0x47fa46[_0xdac8('0x1c')](_0xdac8('0x32'))[_0xdac8('0x20')](_0x5cbc5e,_0x4744b8);}});case'account_contact_lead':var _0x182a97=_[_0xdac8('0x2d')](_0x475c18);if(_0x207dcb[_0xdac8('0x33')]){var _0x1419a1={};_0x1419a1[_0x207dcb[_0xdac8('0x33')]]=_0x44ffa2;_['merge'](_0x182a97[_0xdac8('0x34')],_0x1419a1);}return _0x47fa46['sobject'](_0xdac8('0x35'))['find'](_0x182a97,_0x4744b8)['execute']()[_0xdac8('0x27')](function(_0x576368){if(_0x576368&&_0x576368[_0xdac8('0x21')]){return _0x576368;}else{var _0x4bc563=_[_0xdac8('0x2d')](_0x475c18);if(_0x207dcb[_0xdac8('0x2e')]){var _0x8d3dfd={};_0x8d3dfd[_0x207dcb[_0xdac8('0x2e')]]=_0x44ffa2;_[_0xdac8('0x2f')](_0x4bc563[_0xdac8('0x34')],_0x8d3dfd);}return _0x47fa46['sobject'](_0xdac8('0x30'))[_0xdac8('0x20')](_0x4bc563,_0x4744b8)[_0xdac8('0x27')](function(_0x3d140e){if(_0x3d140e&&_0x3d140e['length']){return _0x3d140e;}else{var _0x5d18b6=_[_0xdac8('0x2d')](_0x475c18);if(_0x207dcb[_0xdac8('0x31')]){var _0x53f454={};_0x53f454[_0x207dcb['additionalSearchLead']]=_0x44ffa2;_[_0xdac8('0x2f')](_0x5d18b6[_0xdac8('0x34')],_0x53f454);}return _0x47fa46[_0xdac8('0x1c')]('Lead')[_0xdac8('0x20')](_0x5d18b6,_0x4744b8);}});}});case _0xdac8('0x18'):var _0x24544e=_[_0xdac8('0x2d')](_0x475c18);if(_0x207dcb[_0xdac8('0x2e')]){var _0x1419a1={};_0x1419a1[_0x207dcb[_0xdac8('0x2e')]]=_0x44ffa2;_[_0xdac8('0x2f')](_0x24544e[_0xdac8('0x34')],_0x1419a1);}return _0x47fa46[_0xdac8('0x1c')](_0xdac8('0x30'))[_0xdac8('0x20')](_0x24544e,_0x4744b8)[_0xdac8('0x36')]();case _0xdac8('0x12'):var _0x255cef=_[_0xdac8('0x2d')](_0x475c18);if(_0x207dcb[_0xdac8('0x31')]){var _0x1419a1={};_0x1419a1[_0x207dcb[_0xdac8('0x31')]]=_0x44ffa2;_[_0xdac8('0x2f')](_0x255cef[_0xdac8('0x34')],_0x1419a1);}return _0x47fa46['sobject']('Lead')[_0xdac8('0x20')](_0x255cef,_0x4744b8);case _0xdac8('0x15'):var _0x182a97=_[_0xdac8('0x2d')](_0x475c18);if(_0x207dcb['additionalSearchAccount']){var _0x1419a1={};_0x1419a1[_0x207dcb[_0xdac8('0x33')]]=_0x44ffa2;_[_0xdac8('0x2f')](_0x182a97[_0xdac8('0x34')],_0x1419a1);}return _0x47fa46['sobject'](_0xdac8('0x35'))[_0xdac8('0x20')](_0x182a97,_0x4744b8);default:return null;}})[_0xdac8('0x27')](function(_0x28cfa4){if(_0x28cfa4&&_0x28cfa4[_0xdac8('0x21')]){var _0x56e30b=_[_0xdac8('0x37')](_0x28cfa4);if(_0x56e30b){return BPromise['resolve']({'id':_0x56e30b['Id'],'name':_0x56e30b['Name'],'phone':_0x56e30b[_0xdac8('0x38')],'endUserType':_0x56e30b['attributes']['type'][_0xdac8('0x39')]()});}}})[_0xdac8('0x27')](function(_0x1c02f7){if(_0x1c02f7){logger[_0xdac8('0x25')](_0xdac8('0x3a'),_0x1c02f7[_0xdac8('0x14')],_0x44ffa2);return BPromise['resolve'](_0x1c02f7);}else{logger['info'](_0xdac8('0x3b'),_0x44ffa2);var _0x3c65cd={'Phone':_0x44ffa2};if(_0x207dcb['moduleCreate']){if(_0x207dcb['moduleCreate']===_0xdac8('0x18')){logger[_0xdac8('0x25')](_0xdac8('0x3c'),_0x44ffa2,_0x207dcb[_0xdac8('0x3d')]);_0x3c65cd[_0xdac8('0x3e')]=_0x5047b5!==_0xdac8('0x3f')?_0x5047b5:util[_0xdac8('0x40')](_0xdac8('0x41'),_0x44ffa2);}else if(_0x207dcb[_0xdac8('0x3d')]===_0xdac8('0x12')){logger[_0xdac8('0x25')](_0xdac8('0x3c'),_0x44ffa2,_0x207dcb['moduleCreate']);_0x3c65cd[_0xdac8('0x3e')]=_0x5047b5!==_0xdac8('0x3f')?_0x5047b5:util[_0xdac8('0x40')](_0xdac8('0x41'),_0x44ffa2);_0x3c65cd[_0xdac8('0x42')]=_0xdac8('0x43');}else if(_0x207dcb[_0xdac8('0x3d')]===_0xdac8('0x15')){logger[_0xdac8('0x25')](_0xdac8('0x3c'),_0x44ffa2,_0x207dcb['moduleCreate']);_0x3c65cd[_0xdac8('0x24')]=_0x5047b5!==_0xdac8('0x3f')?_0x5047b5:util[_0xdac8('0x40')](_0xdac8('0x41'),_0x44ffa2);}else{return null;}}return _0x47fa46[_0xdac8('0x1c')](_['upperFirst'](_0x207dcb[_0xdac8('0x3d')]))[_0xdac8('0x44')](_0x3c65cd)[_0xdac8('0x27')](function(_0x35723a){return BPromise[_0xdac8('0x23')]({'id':_0x35723a['id'],'endUserType':_0x207dcb['moduleCreate']});});}});}function getCustomFields(_0x783daa,_0x232e8d){var _0x4edd5e={};if(_0x783daa[_0xdac8('0x21')]>0x0){_['forEach'](_0x783daa,function(_0x3fe9d1){if(_[_0xdac8('0x45')]([_0xdac8('0x46'),_0xdac8('0x47')],_0x3fe9d1[_0xdac8('0x48')])&&_0x3fe9d1['idField']){_0x4edd5e[_0x3fe9d1[_0xdac8('0x49')]]=_0x3fe9d1[_0xdac8('0x4a')]['toString']();}else if(_0x3fe9d1[_0xdac8('0x48')]===_0xdac8('0x4b')&&_0x3fe9d1[_0xdac8('0x4c')]&&_0x3fe9d1[_0xdac8('0x49')]){_0x232e8d[_0x3fe9d1[_0xdac8('0x4c')]]&&(_0x4edd5e[_0x3fe9d1[_0xdac8('0x49')]]=_0x232e8d[_0x3fe9d1['variableName']]['toString']());}else if(_0x3fe9d1['type']===_0xdac8('0x4d')&&_0x3fe9d1[_0xdac8('0x4e')]&&_0x3fe9d1[_0xdac8('0x4e')][_0xdac8('0x4f')]&&_0x3fe9d1[_0xdac8('0x49')]){_0x232e8d[_0x3fe9d1[_0xdac8('0x4e')]['name']['toLowerCase']()]&&(_0x4edd5e[_0x3fe9d1[_0xdac8('0x49')]]=_0x232e8d[_0x3fe9d1[_0xdac8('0x4e')][_0xdac8('0x4f')][_0xdac8('0x39')]()][_0xdac8('0x50')]());}});}return _0x4edd5e;}function getConnection(_0x555a67){var _0xef38ad=_0x555a67[_0xdac8('0x51')][_0xdac8('0x52')](_0x555a67[_0xdac8('0x53')]);var _0x1812dd=new jsforce[(_0xdac8('0x54'))]({'oauth2':{'loginUrl':_0x555a67[_0xdac8('0x55')]||'https://login.salesforce.com','clientId':_0x555a67[_0xdac8('0x56')],'clientSecret':_0x555a67[_0xdac8('0x57')]}});return _0x1812dd['login'](_0x555a67[_0xdac8('0x58')],_0xef38ad)[_0xdac8('0x27')](function(){logger[_0xdac8('0x25')](_0xdac8('0x59'));return _0x1812dd;});}exports[_0xdac8('0x5a')]=function(_0x1cd680,_0xbf58fb,_0xd2e94b,_0x170d3c,_0x4057b1,_0xc61d4f){var _0x39f546,_0x54e2bb,_0x21fb2d,_0x278f44;_0xc61d4f[_0xdac8('0x5b')]=intUtil['stripTrailingSlash'](_0xc61d4f[_0xdac8('0x5b')]);_0xc61d4f[_0xdac8('0x55')]=intUtil[_0xdac8('0x5c')](_0xc61d4f[_0xdac8('0x55')]);if(_0x4057b1&&_0x4057b1['monitor_format']){logger[_0xdac8('0x25')]('[QUEUE]',_0xdac8('0x5d'));_0xbf58fb[_0xdac8('0x5e')]=util[_0xdac8('0x40')](_0xdac8('0x5f'),_0xc61d4f['serverUrl'],_0xbf58fb[_0xdac8('0x60')],md5(_0xbf58fb[_0xdac8('0x60')]));}else{_0xbf58fb[_0xdac8('0x5e')]='';}return getConnection(_0xc61d4f)['then'](function(_0x5be095){_0x278f44=_0x5be095;return getUser(_0xc61d4f,_0x170d3c['email'],_0x278f44);})[_0xdac8('0x27')](function(_0x35cc7a){_0x39f546=_0x35cc7a;return getEndUser(_0xc61d4f,_0xd2e94b,_0xbf58fb[_0xdac8('0x61')],_0xbf58fb[_0xdac8('0x62')],_0x278f44);})[_0xdac8('0x27')](function(_0x3052b9){_0x54e2bb=_0x3052b9;return getTicket(_0xc61d4f,_0x39f546,_0x54e2bb,_0xd2e94b,_0xbf58fb,_0xd2e94b[_0xdac8('0x63')],_0x278f44,_0xdac8('0x5a'));})[_0xdac8('0x27')](function(_0x5c84ea){_0x21fb2d=_0x5c84ea;logger[_0xdac8('0x25')](_0xdac8('0x64'),_0x21fb2d['id']);logger['info'](_0xdac8('0x65'),_0x21fb2d['id'],_0x170d3c[_0xdac8('0x4f')],_0xc61d4f[_0xdac8('0x48')]);switch(_0xc61d4f[_0xdac8('0x48')]){case _0xdac8('0x66'):emit(util[_0xdac8('0x40')]('user:%s',_0x170d3c[_0xdac8('0x4f')]),_0xdac8('0x67'),{'recordId':_0x21fb2d['id']});break;case _0xdac8('0x68'):emit(util[_0xdac8('0x40')](_0xdac8('0x69'),_0x170d3c[_0xdac8('0x4f')]),'trigger:browser:url',{'uri':util[_0xdac8('0x40')](_0xdac8('0x6a'),_0x278f44['instanceUrl'],_0x21fb2d['id'])});break;default:logger[_0xdac8('0x6b')](_0xdac8('0x6c'));}})['catch'](function(_0x291c72){logger['error']('[QUEUE]',_0x291c72);});};exports[_0xdac8('0x6d')]=function(_0x55b65f,_0x3c68e8,_0x3c407f,_0x1e5b9d,_0x4e4845,_0x364f07,_0x30bfbc){var _0x402e10,_0x4697b4,_0x579109,_0x42bb92;_0x364f07[_0xdac8('0x5b')]=intUtil[_0xdac8('0x5c')](_0x364f07[_0xdac8('0x5b')]);_0x364f07['remoteUri']=intUtil[_0xdac8('0x5c')](_0x364f07['remoteUri']);if(_0x30bfbc&&_0x30bfbc[_0xdac8('0x6e')]&&_0x30bfbc[_0xdac8('0x6e')]!==_0xdac8('0x6f')){logger[_0xdac8('0x25')](_0xdac8('0x70'),_0xdac8('0x5d'));_0x3c68e8[_0xdac8('0x5e')]=util[_0xdac8('0x40')](_0xdac8('0x5f'),_0x364f07[_0xdac8('0x5b')],_0x3c68e8['uniqueid'],md5(_0x3c68e8[_0xdac8('0x60')]));}return getConnection(_0x364f07)[_0xdac8('0x27')](function(_0x500602){_0x42bb92=_0x500602;return getUser(_0x364f07,_0x1e5b9d[_0xdac8('0x71')],_0x42bb92);})[_0xdac8('0x27')](function(_0xda0715){_0x402e10=_0xda0715;return getEndUser(_0x364f07,_0x3c407f,_0x3c68e8[_0xdac8('0x72')],_0x3c68e8[_0xdac8('0x73')],_0x42bb92);})[_0xdac8('0x27')](function(_0x4ff4c2){_0x4697b4=_0x4ff4c2;return getTicket(_0x364f07,_0x402e10,_0x4697b4,_0x3c407f,_0x3c68e8,_0x3c407f[_0xdac8('0x63')],_0x42bb92,_0xdac8('0x6d'));})[_0xdac8('0x27')](function(_0x300d0f){_0x579109=_0x300d0f;logger[_0xdac8('0x25')](_0xdac8('0x74'),_0x579109['id']);logger[_0xdac8('0x25')](_0xdac8('0x75'),_0x579109['id'],_0x1e5b9d[_0xdac8('0x4f')],_0x364f07[_0xdac8('0x48')]);switch(_0x364f07[_0xdac8('0x48')]){case'integrationTab':emit(util[_0xdac8('0x40')]('user:%s',_0x1e5b9d[_0xdac8('0x4f')]),_0xdac8('0x67'),{'recordId':_0x579109['id']});break;case _0xdac8('0x68'):emit(util[_0xdac8('0x40')]('user:%s',_0x1e5b9d['name']),_0xdac8('0x76'),{'uri':util[_0xdac8('0x40')](_0xdac8('0x6a'),_0x42bb92[_0xdac8('0x77')],_0x579109['id'])});break;default:logger[_0xdac8('0x6b')](_0xdac8('0x70'),_0xdac8('0x78'));}})[_0xdac8('0x79')](function(_0x49fa7a){logger[_0xdac8('0x6b')](_0xdac8('0x70'),_0x49fa7a);});};exports[_0xdac8('0x7a')]=function(_0x1d4fe1,_0x363671,_0x400921,_0x24f731,_0x23f45c,_0xc3e1fc){var _0x11816a,_0xb28edd,_0x509171,_0x451fd0;_0xc3e1fc[_0xdac8('0x5b')]=intUtil[_0xdac8('0x5c')](_0xc3e1fc['serverUrl']);_0xc3e1fc[_0xdac8('0x55')]=intUtil[_0xdac8('0x5c')](_0xc3e1fc[_0xdac8('0x55')]);if(_0x23f45c&&_0x23f45c[_0xdac8('0x7b')]){logger[_0xdac8('0x25')]('['+_0x363671['lastevent'][_0xdac8('0x7c')]()+']','Recording\x20is\x20enabled!');_0x363671['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc3e1fc['serverUrl'],_0x363671[_0xdac8('0x60')],md5(_0x363671[_0xdac8('0x60')]));}else{_0x363671[_0xdac8('0x5e')]='';}return getConnection(_0xc3e1fc)['then'](function(_0x358876){_0x451fd0=_0x358876;if(!_['isNil'](_0x24f731)){return getUser(_0xc3e1fc,_0x24f731[_0xdac8('0x4f')],_0x451fd0);}else{return getUser(_0xc3e1fc,null,_0x451fd0);}})[_0xdac8('0x27')](function(_0x2d795d){_0x11816a=_0x2d795d;return getEndUser(_0xc3e1fc,_0x400921,_0x363671[_0xdac8('0x61')],_0x363671[_0xdac8('0x62')],_0x451fd0);})[_0xdac8('0x27')](function(_0x335fbb){_0xb28edd=_0x335fbb;return getTicket(_0xc3e1fc,_0x11816a,_0xb28edd,_0x400921,_0x363671,_0x400921[_0xdac8('0x63')],_0x451fd0);})[_0xdac8('0x27')](function(_0x18dbf2){_0x509171=_0x18dbf2;logger[_0xdac8('0x25')]('['+_0x363671[_0xdac8('0x7d')]['toUpperCase']()+_0xdac8('0x7e'),_0x509171['id']);logger[_0xdac8('0x25')]('['+_0x363671[_0xdac8('0x7d')]['toUpperCase']()+_0xdac8('0x7f'),_0xc3e1fc[_0xdac8('0x48')]);})['catch'](function(_0x396503){logger[_0xdac8('0x6b')]('['+_0x363671[_0xdac8('0x7d')][_0xdac8('0x7c')]()+']',_0x396503);});}; \ 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 34e9fc6..32ceb97 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 _0x008e=['/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','servicenow','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','sys_id','info','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','userId','adminId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','catch','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','picklist','type','customField','nameField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','ticketId','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue'];(function(_0x40ae63,_0x478b08){var _0x29c9bf=function(_0x423a9b){while(--_0x423a9b){_0x40ae63['push'](_0x40ae63['shift']());}};_0x29c9bf(++_0x478b08);}(_0x008e,0xe8));var _0xe008=function(_0xfe752a,_0x4d9d44){_0xfe752a=_0xfe752a-0x0;var _0x2f6c0d=_0x008e[_0xfe752a];return _0x2f6c0d;};'use strict';var _=require(_0xe008('0x0'));var Promise=require(_0xe008('0x1'));var rp=require('request-promise');var util=require(_0xe008('0x2'));var md5=require(_0xe008('0x3'));var Redis=require(_0xe008('0x4'));var intUtil=require(_0xe008('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe008('0x6'));config[_0xe008('0x7')]=_['defaults'](config[_0xe008('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe008('0x8'))(new Redis(config[_0xe008('0x7')]));function getAdminUser(_0x13e787,_0x3eeff4,_0x1f6722,_0x5aefa2,_0x432c2a,_0x1bc3f0){return new Promise(function(_0xac3cfc,_0x50232f){var _0x5daeb1={'method':'GET','uri':_0x5aefa2+_0xe008('0x9')+'&'+_0x432c2a+'&'+_0x1bc3f0,'auth':_0x3eeff4,'json':!![]};return rp(_0x5daeb1)['then'](function(_0x10d879){if(_0x10d879[_0xe008('0xa')][_0xe008('0xb')]>0x0){_0x1f6722['adminId']=_0x10d879['result'][0x0][_0xe008('0xc')];}logger[_0xe008('0xd')]('['+[_0x13e787['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x1f6722);_0xac3cfc(_0x1f6722);})['catch'](function(_0x1e2e17){logger[_0xe008('0xe')]('['+[_0x13e787['toUpperCase']()]+']',_0x1e2e17[_0xe008('0xf')]);_0x50232f(_0x1e2e17[_0xe008('0xf')]);});});}function getUser(_0x19035e,_0x2d8971,_0x567030,_0x5f240e,_0x256e87){return function(_0xe6e862){logger[_0xe008('0xd')]('['+[_0x19035e[_0xe008('0x10')]()]+_0xe008('0x11'),_0xe6e862);return new Promise(function(_0x1aa5cc,_0x13fd5d){if(intUtil[_0xe008('0x12')](_0xe6e862[_0xe008('0x13')])){var _0x4d7ad8={'method':_0xe008('0x14'),'uri':_0x567030+_0xe008('0x15')+_0xe6e862[_0xe008('0x13')]+'&'+_0x5f240e+'&'+_0x256e87,'auth':_0x2d8971,'json':!![]};logger[_0xe008('0xd')]('['+[_0x19035e[_0xe008('0x10')]()]+_0xe008('0x16'),_0x4d7ad8);return rp(_0x4d7ad8)[_0xe008('0x17')](function(_0x229d2f){logger[_0xe008('0xd')]('['+[_0x19035e[_0xe008('0x10')]()]+_0xe008('0x18'),_0x229d2f);if(_0x229d2f['result'][_0xe008('0xb')]>0x0&&String(_0x229d2f[_0xe008('0xa')][0x0][_0xe008('0x19')])==='true'){_0xe6e862[_0xe008('0x1a')]=_0x229d2f[_0xe008('0xa')][0x0]['sys_id'];}else{_0xe6e862['userId']=_0xe6e862[_0xe008('0x1b')];_0xe6e862['userEmail']=_0xe6e862['adminEmail'];}logger[_0xe008('0xd')]('['+[_0x19035e[_0xe008('0x10')]()]+'],\x20getUser\x20crm',_0xe6e862);_0x1aa5cc(_0xe6e862);})['catch'](function(_0x1a07d9){logger['error']('['+[_0x19035e[_0xe008('0x10')]()]+']',_0x1a07d9['message']);_0x13fd5d(_0x1a07d9[_0xe008('0xf')]);});}else{logger['info']('['+[_0x19035e[_0xe008('0x10')]()]+_0xe008('0x1c'));_0xe6e862['userId']=_0xe6e862['adminId'];_0xe6e862[_0xe008('0x13')]=_0xe6e862[_0xe008('0x1d')];_0x1aa5cc(_0xe6e862);}});};}function createEndUser(_0x4b693c,_0x2ed5f8,_0x44647f,_0x41507b,_0x3fd3e2){logger[_0xe008('0xd')]('['+[_0x4b693c[_0xe008('0x10')]()]+_0xe008('0x1e'),_0x44647f);return new Promise(function(_0x5ee0da,_0x2de0d8){var _0x43a0a1={'method':_0xe008('0x1f'),'uri':_0x41507b+_0xe008('0x20')+_0x3fd3e2,'body':{'user_name':_0x44647f[_0xe008('0x21')],'roles':_0xe008('0x22'),'first_name':_0x44647f[_0xe008('0x21')],'active':_0xe008('0x23'),'date_format':'System','phone':_0x44647f[_0xe008('0x21')]},'auth':_0x2ed5f8,'json':!![]};return rp(_0x43a0a1)[_0xe008('0x17')](function(_0x226826){logger[_0xe008('0xd')]('['+[_0x4b693c[_0xe008('0x10')]()]+'],\x20EndUser\x20schema',_0x226826[_0xe008('0xa')]);_0x44647f['endUserId']=_0x226826['result']['sys_id'];_0x5ee0da(_0x44647f);})[_0xe008('0x24')](function(_0x168f75){logger['error']('['+[_0x4b693c[_0xe008('0x10')]()]+']',_0x168f75[_0xe008('0xf')]);_0x2de0d8(_0x168f75[_0xe008('0xf')]);});});}function getEndUser(_0x212124,_0x241edb,_0x8822d9,_0x17b282,_0x377292){return function(_0x4f79fb){logger[_0xe008('0xd')]('['+[_0x212124[_0xe008('0x10')]()]+_0xe008('0x25'),_0x4f79fb);return new Promise(function(_0x49773c,_0x549715){var _0x2238c8={'method':_0xe008('0x14'),'uri':_0x8822d9+'sys_user?sysparm_query=phone%3D'+_0x4f79fb[_0xe008('0x21')]+'&'+_0x17b282+'&'+_0x377292,'auth':_0x241edb,'json':!![]};return rp(_0x2238c8)[_0xe008('0x17')](function(_0x377e12){if(_0x377e12[_0xe008('0xa')][_0xe008('0xb')]>0x0){_0x4f79fb[_0xe008('0x26')]=_0x377e12[_0xe008('0xa')][0x0][_0xe008('0xc')];logger[_0xe008('0xd')]('['+[_0x212124[_0xe008('0x10')]()]+_0xe008('0x27'),_0x4f79fb);_0x49773c(_0x4f79fb);}else{return createEndUser(_0x212124,_0x241edb,_0x4f79fb,_0x8822d9,_0x17b282)['then'](function(_0x8e9970){logger[_0xe008('0xd')]('['+[_0x212124[_0xe008('0x10')]()]+_0xe008('0x28'),_0x8e9970);_0x49773c(_0x8e9970);});}})[_0xe008('0x24')](function(_0x25340d){logger[_0xe008('0xe')]('['+[_0x212124[_0xe008('0x10')]()]+']',_0x25340d[_0xe008('0xf')]);_0x549715(_0x25340d[_0xe008('0xf')]);});});};}function getCustomFields(_0x19b75e,_0x13404c){var _0x146f43={};if(_0x19b75e[_0xe008('0xb')]>0x0){_['forEach'](_0x19b75e,function(_0x151e3c){if(_[_0xe008('0x29')](['string',_0xe008('0x2a')],_0x151e3c[_0xe008('0x2b')])&&_0x151e3c['nameField']&&!_0x151e3c[_0xe008('0x2c')]){_0x146f43[_0x151e3c[_0xe008('0x2d')][_0xe008('0x2e')]()]=_0x151e3c[_0xe008('0x2f')]['toString']();}else if(_['includes'](['string',_0xe008('0x2a')],_0x151e3c[_0xe008('0x2b')])&&_0x151e3c[_0xe008('0x30')]&&_0x151e3c[_0xe008('0x2c')]){_0x146f43[_0x151e3c[_0xe008('0x30')][_0xe008('0x2e')]()]=_0x151e3c['content'][_0xe008('0x31')]();}else if(_0x151e3c[_0xe008('0x2b')]===_0xe008('0x32')&&_0x151e3c[_0xe008('0x33')]&&_0x151e3c['idField']&&_0x151e3c[_0xe008('0x2c')]){_0x146f43[_0x151e3c[_0xe008('0x30')]['toLowerCase']()]=_0x13404c[_0x151e3c[_0xe008('0x33')]][_0xe008('0x31')]();}else if(_0x151e3c['type']===_0xe008('0x34')&&_0x151e3c[_0xe008('0x35')]&&_0x151e3c[_0xe008('0x35')][_0xe008('0x36')]&&_0x151e3c[_0xe008('0x30')]&&_0x151e3c[_0xe008('0x2c')]){_0x146f43[_0x151e3c[_0xe008('0x30')][_0xe008('0x2e')]()]=_0x13404c[_0x151e3c[_0xe008('0x35')][_0xe008('0x36')][_0xe008('0x2e')]()][_0xe008('0x31')]();}});}return _0x146f43;}function getTicket(_0x1cf938,_0x17ba00,_0x155db6,_0x451d50,_0x1837b5,_0xc8a1d5){return function(_0x4c3043){logger[_0xe008('0xd')]('['+[_0x1cf938[_0xe008('0x10')]()]+_0xe008('0x37'),_0x4c3043);return new Promise(function(_0x540ea2,_0x31854f){var _0x15e7e2=_0x1cf938[_0xe008('0x2e')]()===_0xe008('0x38')?_0x4c3043[_0xe008('0x1a')]:_0x4c3043[_0xe008('0x26')];var _0x229f13={'method':_0xe008('0x1f'),'uri':_0x155db6+_0xe008('0x39')+'?'+_0xc8a1d5,'body':Object[_0xe008('0x3a')]({},{'active':'true','caller_id':_0x15e7e2,'assigned_to':_0x4c3043['userId'],'short_description':intUtil[_0xe008('0x3b')](_0x451d50[_0xe008('0x3c')],_0x1837b5,'\x20'),'description':intUtil[_0xe008('0x3b')](_0x451d50['Descriptions'],_0x1837b5,'\x0a')},getCustomFields(_0x451d50['Fields'],_0x1837b5)),'auth':_0x17ba00,'json':!![]};return rp(_0x229f13)[_0xe008('0x17')](function(_0x1c1f6d){logger['info']('['+[_0x1cf938[_0xe008('0x10')]()]+_0xe008('0x3d'),_0x1c1f6d[_0xe008('0xa')]);_0x4c3043['ticketId']=_0x1c1f6d[_0xe008('0xa')][_0xe008('0xc')];_0x4c3043[_0xe008('0x3e')]=_0x1c1f6d[_0xe008('0xa')][_0xe008('0x3f')];logger[_0xe008('0xd')]('['+[_0x1cf938[_0xe008('0x10')]()]+_0xe008('0x40'),_0x4c3043);_0x540ea2(_0x4c3043);})[_0xe008('0x24')](function(_0x2fe617){logger[_0xe008('0xe')]('['+[_0x1cf938[_0xe008('0x10')]()]+']',_0x2fe617[_0xe008('0xf')]);_0x31854f(_0x2fe617[_0xe008('0xf')]);});});};}function createRemoteTag(_0x284d5d,_0x26a258,_0x4ec573,_0x4d8551){return new Promise(function(_0x49caac,_0x5a3026){var _0x155cf4={'method':_0xe008('0x1f'),'uri':_0x4ec573+_0xe008('0x41')+'?'+_0x4d8551,'body':{'short_description':_0x284d5d,'global':!![],'active':!![],'name':_0x284d5d},'auth':_0x26a258,'json':!![]};return rp(_0x155cf4)[_0xe008('0x17')](function(_0x38f046){var _0x51dd36=_0x38f046[_0xe008('0xa')][_0xe008('0xc')];_0x49caac(_0x51dd36);});});}function getRemoteTag(_0x118878,_0x4fce15,_0x496a3a,_0x55c25f,_0x5911c3){return new Promise(function(_0x36ee1c,_0x596f74){var _0x427639={'method':_0xe008('0x14'),'uri':_0x496a3a+'label'+'?sysparm_query=name%3D'+_0x118878+'&'+_0x55c25f,'auth':_0x4fce15,'json':!![]};return rp(_0x427639)[_0xe008('0x17')](function(_0x581c23){if(_0x581c23[_0xe008('0xa')]['length']>0x0){var _0x37c109=_0x581c23[_0xe008('0xa')][0x0][_0xe008('0xc')];_0x36ee1c(_0x37c109);}else{return createRemoteTag(_0x118878,_0x4fce15,_0x496a3a,_0x55c25f)[_0xe008('0x17')](function(_0x3042f6){_0x36ee1c(_0x3042f6);});}});});}function assignTagToIncident(_0x34d4e0,_0x594469,_0x14197e,_0x5811aa,_0x12759c){return new Promise(function(_0x2bbaa6,_0x2e5ea9){var _0x44f342={'method':_0xe008('0x1f'),'uri':_0x14197e+_0xe008('0x42')+'?'+_0x12759c,'body':{'label':_0x34d4e0,'table':_0xe008('0x39'),'id_type':_0xe008('0x43'),'table_key':_0x5811aa[_0xe008('0x44')],'title':'Incident\x20-\x20'+_0x5811aa['ticketNumber'],'id_display':_0x5811aa[_0xe008('0x3e')]},'auth':_0x594469,'json':!![]};return rp(_0x44f342)[_0xe008('0x17')](function(_0x216da1){_0x2bbaa6();})[_0xe008('0x24')](function(){_0x2bbaa6();});});}function manageTags(_0x14bb24,_0x443329,_0xe2e476,_0x4d9c91,_0x43eea1,_0x456636,_0x4a3ed8){return new Promise(function(_0x53299d,_0x1f53f4){var _0x4dffca=[];_0x443329[_0xe008('0x45')](function(_0x1e66d9){_0x4dffca[_0xe008('0x46')](getRemoteTag(_0x1e66d9,_0xe2e476,_0x4d9c91,_0x456636,_0x4a3ed8));});return Promise['all'](_0x4dffca)[_0xe008('0x17')](function(_0x5e394d){if(_0x5e394d['length']){logger['info']('['+[_0x14bb24['toUpperCase']()]+_0xe008('0x47'),_0x5e394d);var _0x550a78=[];_0x5e394d['forEach'](function(_0x3ef83d){_0x550a78['push'](assignTagToIncident(_0x3ef83d,_0xe2e476,_0x4d9c91,_0x43eea1,_0x456636));});return Promise[_0xe008('0x48')](_0x550a78)[_0xe008('0x17')](function(){_0x53299d();})[_0xe008('0x24')](function(){_0x53299d();});}else{_0x53299d();}});});}function getTags(_0x26ee00,_0x6b1ca3,_0x4dd979,_0x187996,_0x350e17,_0x87e43b){return function(_0x4ff195){return new Promise(function(_0x599121,_0x14ff7e){var _0x434037=[];var _0x25dfc6=_0x187996[_0xe008('0x49')];if(_0x25dfc6&&_0x25dfc6[_0xe008('0xb')]>0x0){_0x434037=_[_0xe008('0x4a')](_0x25dfc6,_0xe008('0x36'));}if(_0x434037[_0xe008('0xb')]>0x0){return manageTags(_0x26ee00,_0x434037,_0x6b1ca3,_0x4dd979,_0x4ff195,_0x350e17,_0x87e43b)[_0xe008('0x17')](function(){_0x599121(_0x4ff195);});}else{_0x599121(_0x4ff195);}});};}function emit(_0xf17b42,_0x46aa3b,_0xff6c8){var _0x18a056=_0xe008('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xe008('0x4c')+'%255EORDERBYDESCnumber';var _0x439480={'uri':_0xf17b42+_0xe008('0x4d')+_0xff6c8+_0x18a056};io['to'](util[_0xe008('0x4e')]('user:%s',_0x46aa3b))['emit'](_0xe008('0x4f'),_0x439480);}exports['cs']=function(_0x29049b,_0x47b54f,_0x360e2b,_0x652c58,_0x315741,_0x1b5a62,_0x328cf9,_0x203001){var _0x3641d9={};var _0x190381={'user':_0x1b5a62['username'],'pass':_0x1b5a62[_0xe008('0x50')]};var _0x171330=_0xe008('0x51');var _0x139dda='sysparm_display_value=true';_0x1b5a62[_0xe008('0x52')]=intUtil[_0xe008('0x53')](_0x1b5a62[_0xe008('0x52')]);_0x1b5a62[_0xe008('0x54')]=intUtil[_0xe008('0x53')](_0x1b5a62[_0xe008('0x54')]);var _0x598044=util[_0xe008('0x4e')](_0xe008('0x55'),_0x1b5a62[_0xe008('0x52')]);_0x3641d9[_0xe008('0x13')]=!_['isNil'](_0x652c58)?_0x652c58[_0xe008('0x56')]:null;_0x3641d9[_0xe008('0x1d')]=_0x1b5a62[_0xe008('0x56')];_0x3641d9[_0xe008('0x21')]=_0x203001[_0xe008('0x2e')]()===_0xe008('0x38')?_0x47b54f[_0xe008('0x57')]:_0x47b54f[_0xe008('0x58')];_0x3641d9[_0xe008('0x59')]=_0x203001===_0xe008('0x5a')||_0x203001===_0xe008('0x5b')?'queue':_0xe008('0x38');var _0x9d21e1=util[_0xe008('0x4e')](_0xe008('0x5c'),_0x1b5a62[_0xe008('0x54')],_0x47b54f['uniqueid'],md5(_0x47b54f[_0xe008('0x5d')]));if(_0x315741&&_0x315741[_0xe008('0x5e')]){logger[_0xe008('0xd')]('[QUEUE]',_0xe008('0x5f'));_0x47b54f[_0xe008('0x60')]=_0x9d21e1;}else if(_0x328cf9&&_0x328cf9[_0xe008('0x61')]&&_0x328cf9[_0xe008('0x61')]!==_0xe008('0x62')){logger[_0xe008('0xd')]('[OUTBOUND]',_0xe008('0x5f'));_0x47b54f['recordingURL']=_0x9d21e1;}else{_0x47b54f[_0xe008('0x60')]='';}return getAdminUser(_0x203001,_0x190381,_0x3641d9,_0x598044,_0x139dda,_0x171330)[_0xe008('0x17')](getUser(_0x203001,_0x190381,_0x598044,_0x139dda,_0x171330))[_0xe008('0x17')](getEndUser(_0x203001,_0x190381,_0x598044,_0x139dda,_0x171330))[_0xe008('0x17')](getTicket(_0x203001,_0x190381,_0x598044,_0x360e2b,_0x47b54f,_0x139dda))[_0xe008('0x17')](function(_0x5d06d3){logger[_0xe008('0xd')](util[_0xe008('0x4e')](_0xe008('0x63'),_0x5d06d3['ticketId']));logger[_0xe008('0xd')](util[_0xe008('0x4e')](_0xe008('0x64'),_0x203001));if(_0x203001!==_0xe008('0x5b')){logger[_0xe008('0xd')]('['+[_0x203001['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1b5a62['remoteUri'],_0x652c58[_0xe008('0x36')],_0x5d06d3['ticketId']);}})[_0xe008('0x24')](function(_0x45d0e1){logger[_0xe008('0xe')]('['+[_0x203001[_0xe008('0x10')]()]+_0xe008('0x65'),util[_0xe008('0x66')](_0x45d0e1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xaada=['password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','../../../../config/logger','servicenow','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','GET','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','sys_id','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','Variable','name','outbound','POST','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','label_entry','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','username'];(function(_0x5be1b1,_0x4a8bb8){var _0x3c4194=function(_0x4e766d){while(--_0x4e766d){_0x5be1b1['push'](_0x5be1b1['shift']());}};_0x3c4194(++_0x4a8bb8);}(_0xaada,0x14e));var _0xaaad=function(_0x5e11a0,_0x21fcc8){_0x5e11a0=_0x5e11a0-0x0;var _0x35a0dc=_0xaada[_0x5e11a0];return _0x35a0dc;};'use strict';var _=require(_0xaaad('0x0'));var Promise=require(_0xaaad('0x1'));var rp=require(_0xaaad('0x2'));var util=require(_0xaaad('0x3'));var md5=require('md5');var Redis=require(_0xaaad('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xaaad('0x5'))(_0xaaad('0x6'));config[_0xaaad('0x7')]=_['defaults'](config[_0xaaad('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xaaad('0x8'))(new Redis(config[_0xaaad('0x7')]));function getAdminUser(_0x3dbfc9,_0x50874c,_0x3e4e37,_0xb98389,_0x230a5b,_0x1b626f){return new Promise(function(_0x4302bd,_0x5d71f4){var _0x1a730d={'method':'GET','uri':_0xb98389+_0xaaad('0x9')+'&'+_0x230a5b+'&'+_0x1b626f,'auth':_0x50874c,'json':!![]};return rp(_0x1a730d)[_0xaaad('0xa')](function(_0x3aa4a1){if(_0x3aa4a1['result'][_0xaaad('0xb')]>0x0){_0x3e4e37[_0xaaad('0xc')]=_0x3aa4a1[_0xaaad('0xd')][0x0]['sys_id'];}logger[_0xaaad('0xe')]('['+[_0x3dbfc9['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x3e4e37);_0x4302bd(_0x3e4e37);})[_0xaaad('0xf')](function(_0x12f072){logger[_0xaaad('0x10')]('['+[_0x3dbfc9[_0xaaad('0x11')]()]+']',_0x12f072[_0xaaad('0x12')]);_0x5d71f4(_0x12f072[_0xaaad('0x12')]);});});}function getUser(_0xf98ca7,_0x28e225,_0x22a6f3,_0x1bc2d7,_0x3d017f){return function(_0x1d1e94){logger['info']('['+[_0xf98ca7[_0xaaad('0x11')]()]+_0xaaad('0x13'),_0x1d1e94);return new Promise(function(_0x2f959c,_0x55f1bf){if(intUtil[_0xaaad('0x14')](_0x1d1e94['userEmail'])){var _0x161350={'method':_0xaaad('0x15'),'uri':_0x22a6f3+_0xaaad('0x16')+_0x1d1e94[_0xaaad('0x17')]+'&'+_0x1bc2d7+'&'+_0x3d017f,'auth':_0x28e225,'json':!![]};logger[_0xaaad('0xe')]('['+[_0xf98ca7[_0xaaad('0x11')]()]+_0xaaad('0x18'),_0x161350);return rp(_0x161350)[_0xaaad('0xa')](function(_0x5c96fa){logger[_0xaaad('0xe')]('['+[_0xf98ca7['toUpperCase']()]+_0xaaad('0x19'),_0x5c96fa);if(_0x5c96fa[_0xaaad('0xd')][_0xaaad('0xb')]>0x0&&String(_0x5c96fa[_0xaaad('0xd')][0x0][_0xaaad('0x1a')])===_0xaaad('0x1b')){_0x1d1e94[_0xaaad('0x1c')]=_0x5c96fa[_0xaaad('0xd')][0x0]['sys_id'];}else{_0x1d1e94[_0xaaad('0x1c')]=_0x1d1e94[_0xaaad('0xc')];_0x1d1e94['userEmail']=_0x1d1e94[_0xaaad('0x1d')];}logger[_0xaaad('0xe')]('['+[_0xf98ca7[_0xaaad('0x11')]()]+_0xaaad('0x1e'),_0x1d1e94);_0x2f959c(_0x1d1e94);})[_0xaaad('0xf')](function(_0x39137b){logger[_0xaaad('0x10')]('['+[_0xf98ca7[_0xaaad('0x11')]()]+']',_0x39137b[_0xaaad('0x12')]);_0x55f1bf(_0x39137b[_0xaaad('0x12')]);});}else{logger[_0xaaad('0xe')]('['+[_0xf98ca7['toUpperCase']()]+_0xaaad('0x1f'));_0x1d1e94[_0xaaad('0x1c')]=_0x1d1e94['adminId'];_0x1d1e94[_0xaaad('0x17')]=_0x1d1e94['adminEmail'];_0x2f959c(_0x1d1e94);}});};}function createEndUser(_0x26e141,_0x67190,_0x17d66d,_0x35fe76,_0x3f4619){logger[_0xaaad('0xe')]('['+[_0x26e141['toUpperCase']()]+_0xaaad('0x20'),_0x17d66d);return new Promise(function(_0x24c5f7,_0x2a77c6){var _0x2a4370={'method':'POST','uri':_0x35fe76+_0xaaad('0x21')+_0x3f4619,'body':{'user_name':_0x17d66d[_0xaaad('0x22')],'roles':'user','first_name':_0x17d66d['endUserNumber'],'active':_0xaaad('0x1b'),'date_format':'System','phone':_0x17d66d[_0xaaad('0x22')]},'auth':_0x67190,'json':!![]};return rp(_0x2a4370)[_0xaaad('0xa')](function(_0x2e5060){logger[_0xaaad('0xe')]('['+[_0x26e141['toUpperCase']()]+_0xaaad('0x23'),_0x2e5060[_0xaaad('0xd')]);_0x17d66d[_0xaaad('0x24')]=_0x2e5060[_0xaaad('0xd')][_0xaaad('0x25')];_0x24c5f7(_0x17d66d);})['catch'](function(_0x3cc7f9){logger[_0xaaad('0x10')]('['+[_0x26e141[_0xaaad('0x11')]()]+']',_0x3cc7f9[_0xaaad('0x12')]);_0x2a77c6(_0x3cc7f9['message']);});});}function getEndUser(_0x1392ba,_0xa92461,_0x37a6fa,_0x2d4d73,_0x5664f2){return function(_0x409def){logger['info']('['+[_0x1392ba[_0xaaad('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x409def);return new Promise(function(_0x818892,_0x3e0418){var _0x34c862={'method':_0xaaad('0x15'),'uri':_0x37a6fa+'sys_user?sysparm_query=phone%3D'+_0x409def[_0xaaad('0x22')]+'&'+_0x2d4d73+'&'+_0x5664f2,'auth':_0xa92461,'json':!![]};return rp(_0x34c862)['then'](function(_0x27634c){if(_0x27634c[_0xaaad('0xd')][_0xaaad('0xb')]>0x0){_0x409def['endUserId']=_0x27634c['result'][0x0]['sys_id'];logger[_0xaaad('0xe')]('['+[_0x1392ba[_0xaaad('0x11')]()]+_0xaaad('0x26'),_0x409def);_0x818892(_0x409def);}else{return createEndUser(_0x1392ba,_0xa92461,_0x409def,_0x37a6fa,_0x2d4d73)['then'](function(_0xadb2fa){logger[_0xaaad('0xe')]('['+[_0x1392ba[_0xaaad('0x11')]()]+_0xaaad('0x27'),_0xadb2fa);_0x818892(_0xadb2fa);});}})[_0xaaad('0xf')](function(_0x19c65d){logger[_0xaaad('0x10')]('['+[_0x1392ba[_0xaaad('0x11')]()]+']',_0x19c65d[_0xaaad('0x12')]);_0x3e0418(_0x19c65d[_0xaaad('0x12')]);});});};}function getCustomFields(_0x4bc2e2,_0x7372ab){var _0x352a57={};if(_0x4bc2e2[_0xaaad('0xb')]>0x0){_[_0xaaad('0x28')](_0x4bc2e2,function(_0x39dda3){if(_[_0xaaad('0x29')]([_0xaaad('0x2a'),_0xaaad('0x2b')],_0x39dda3[_0xaaad('0x2c')])&&_0x39dda3[_0xaaad('0x2d')]&&!_0x39dda3[_0xaaad('0x2e')]){_0x352a57[_0x39dda3['nameField'][_0xaaad('0x2f')]()]=_0x39dda3[_0xaaad('0x30')][_0xaaad('0x31')]();}else if(_[_0xaaad('0x29')]([_0xaaad('0x2a'),_0xaaad('0x2b')],_0x39dda3[_0xaaad('0x2c')])&&_0x39dda3['idField']&&_0x39dda3['customField']){_0x352a57[_0x39dda3[_0xaaad('0x32')][_0xaaad('0x2f')]()]=_0x39dda3[_0xaaad('0x30')][_0xaaad('0x31')]();}else if(_0x39dda3['type']===_0xaaad('0x33')&&_0x39dda3[_0xaaad('0x34')]&&_0x39dda3[_0xaaad('0x32')]&&_0x39dda3[_0xaaad('0x2e')]){_0x352a57[_0x39dda3[_0xaaad('0x32')][_0xaaad('0x2f')]()]=_0x7372ab[_0x39dda3['variableName']][_0xaaad('0x31')]();}else if(_0x39dda3['type']==='customVariable'&&_0x39dda3[_0xaaad('0x35')]&&_0x39dda3[_0xaaad('0x35')][_0xaaad('0x36')]&&_0x39dda3[_0xaaad('0x32')]&&_0x39dda3[_0xaaad('0x2e')]){_0x352a57[_0x39dda3[_0xaaad('0x32')][_0xaaad('0x2f')]()]=_0x7372ab[_0x39dda3['Variable'][_0xaaad('0x36')][_0xaaad('0x2f')]()][_0xaaad('0x31')]();}});}return _0x352a57;}function getTicket(_0x40b5b8,_0x9c07a8,_0x44232,_0x5993a5,_0x1cb034,_0x3e1745){return function(_0x2398fd){logger[_0xaaad('0xe')]('['+[_0x40b5b8[_0xaaad('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x2398fd);return new Promise(function(_0x1d223c,_0x3daa04){var _0x3de9a3=_0x40b5b8[_0xaaad('0x2f')]()===_0xaaad('0x37')?_0x2398fd['userId']:_0x2398fd[_0xaaad('0x24')];var _0x3bc03b={'method':_0xaaad('0x38'),'uri':_0x44232+_0xaaad('0x39')+'?'+_0x3e1745,'body':Object[_0xaaad('0x3a')]({},{'active':_0xaaad('0x1b'),'caller_id':_0x3de9a3,'assigned_to':_0x2398fd[_0xaaad('0x1c')],'short_description':intUtil[_0xaaad('0x3b')](_0x5993a5[_0xaaad('0x3c')],_0x1cb034,'\x20'),'description':intUtil[_0xaaad('0x3b')](_0x5993a5[_0xaaad('0x3d')],_0x1cb034,'\x0a')},getCustomFields(_0x5993a5['Fields'],_0x1cb034)),'auth':_0x9c07a8,'json':!![]};return rp(_0x3bc03b)['then'](function(_0x4f0972){logger['info']('['+[_0x40b5b8['toUpperCase']()]+_0xaaad('0x3e'),_0x4f0972[_0xaaad('0xd')]);_0x2398fd[_0xaaad('0x3f')]=_0x4f0972[_0xaaad('0xd')][_0xaaad('0x25')];_0x2398fd['ticketNumber']=_0x4f0972[_0xaaad('0xd')][_0xaaad('0x40')];logger[_0xaaad('0xe')]('['+[_0x40b5b8[_0xaaad('0x11')]()]+_0xaaad('0x41'),_0x2398fd);_0x1d223c(_0x2398fd);})[_0xaaad('0xf')](function(_0x19205b){logger[_0xaaad('0x10')]('['+[_0x40b5b8[_0xaaad('0x11')]()]+']',_0x19205b['message']);_0x3daa04(_0x19205b['message']);});});};}function createRemoteTag(_0x126e29,_0x389190,_0x37fd53,_0x4eb74b){return new Promise(function(_0x21fbbf,_0xbb8f00){var _0xea4658={'method':'POST','uri':_0x37fd53+_0xaaad('0x42')+'?'+_0x4eb74b,'body':{'short_description':_0x126e29,'global':!![],'active':!![],'name':_0x126e29},'auth':_0x389190,'json':!![]};return rp(_0xea4658)[_0xaaad('0xa')](function(_0x2c481d){var _0x1d81e4=_0x2c481d['result'][_0xaaad('0x25')];_0x21fbbf(_0x1d81e4);});});}function getRemoteTag(_0x38466a,_0x25a487,_0x3ffd49,_0x161c94,_0x1f5da7){return new Promise(function(_0x11806f,_0x33cbbc){var _0x100e30={'method':_0xaaad('0x15'),'uri':_0x3ffd49+_0xaaad('0x42')+'?sysparm_query=name%3D'+_0x38466a+'&'+_0x161c94,'auth':_0x25a487,'json':!![]};return rp(_0x100e30)[_0xaaad('0xa')](function(_0x1f36f0){if(_0x1f36f0[_0xaaad('0xd')]['length']>0x0){var _0x138f8e=_0x1f36f0[_0xaaad('0xd')][0x0]['sys_id'];_0x11806f(_0x138f8e);}else{return createRemoteTag(_0x38466a,_0x25a487,_0x3ffd49,_0x161c94)['then'](function(_0x51ffaf){_0x11806f(_0x51ffaf);});}});});}function assignTagToIncident(_0x7f1b47,_0x9bd508,_0x373f98,_0x10bb5b,_0x4467c2){return new Promise(function(_0x5e3345,_0x57f8c7){var _0xd879dc={'method':'POST','uri':_0x373f98+_0xaaad('0x43')+'?'+_0x4467c2,'body':{'label':_0x7f1b47,'table':_0xaaad('0x39'),'id_type':'Incident','table_key':_0x10bb5b['ticketId'],'title':'Incident\x20-\x20'+_0x10bb5b['ticketNumber'],'id_display':_0x10bb5b[_0xaaad('0x44')]},'auth':_0x9bd508,'json':!![]};return rp(_0xd879dc)['then'](function(_0x57888b){_0x5e3345();})[_0xaaad('0xf')](function(){_0x5e3345();});});}function manageTags(_0x230594,_0x4f53b6,_0xa8e5df,_0x19648b,_0x48259d,_0x46a7e8,_0x4a04e2){return new Promise(function(_0x53d389,_0x4f8172){var _0x4b4c1d=[];_0x4f53b6[_0xaaad('0x28')](function(_0x16df5f){_0x4b4c1d[_0xaaad('0x45')](getRemoteTag(_0x16df5f,_0xa8e5df,_0x19648b,_0x46a7e8,_0x4a04e2));});return Promise[_0xaaad('0x46')](_0x4b4c1d)[_0xaaad('0xa')](function(_0x5490c6){if(_0x5490c6[_0xaaad('0xb')]){logger['info']('['+[_0x230594[_0xaaad('0x11')]()]+_0xaaad('0x47'),_0x5490c6);var _0x2cbb5b=[];_0x5490c6[_0xaaad('0x28')](function(_0x1cfb98){_0x2cbb5b[_0xaaad('0x45')](assignTagToIncident(_0x1cfb98,_0xa8e5df,_0x19648b,_0x48259d,_0x46a7e8));});return Promise[_0xaaad('0x46')](_0x2cbb5b)['then'](function(){_0x53d389();})[_0xaaad('0xf')](function(){_0x53d389();});}else{_0x53d389();}});});}function getTags(_0x3d6bfb,_0x5043ae,_0x47e85d,_0x334902,_0x5826f1,_0x35a5f8){return function(_0x207381){return new Promise(function(_0x283f01,_0x78cc94){var _0x54de97=[];var _0x152d24=_0x334902[_0xaaad('0x48')];if(_0x152d24&&_0x152d24[_0xaaad('0xb')]>0x0){_0x54de97=_[_0xaaad('0x49')](_0x152d24,_0xaaad('0x36'));}if(_0x54de97[_0xaaad('0xb')]>0x0){return manageTags(_0x3d6bfb,_0x54de97,_0x5043ae,_0x47e85d,_0x207381,_0x5826f1,_0x35a5f8)['then'](function(){_0x283f01(_0x207381);});}else{_0x283f01(_0x207381);}});};}function emit(_0x3859cb,_0x53a068,_0x4b83f1){var _0x19842d=_0xaaad('0x4a')+_0xaaad('0x4b')+_0xaaad('0x4c')+_0xaaad('0x4d');var _0x540db2={'uri':_0x3859cb+_0xaaad('0x4e')+_0x4b83f1+_0x19842d};io['to'](util['format'](_0xaaad('0x4f'),_0x53a068))[_0xaaad('0x50')]('trigger:browser:url',_0x540db2);}exports['cs']=function(_0x2da91c,_0x4e4f0b,_0x4b39fc,_0x45d81b,_0x23cf16,_0xe561f4,_0x34f7fc,_0x3a938a){var _0x310a0a={};var _0x38bc2c={'user':_0xe561f4[_0xaaad('0x51')],'pass':_0xe561f4[_0xaaad('0x52')]};var _0x31522e=_0xaaad('0x53');var _0x2dc9e7=_0xaaad('0x54');_0xe561f4[_0xaaad('0x55')]=intUtil[_0xaaad('0x56')](_0xe561f4[_0xaaad('0x55')]);_0xe561f4[_0xaaad('0x57')]=intUtil[_0xaaad('0x56')](_0xe561f4[_0xaaad('0x57')]);var _0x1cb654=util[_0xaaad('0x58')](_0xaaad('0x59'),_0xe561f4[_0xaaad('0x55')]);_0x310a0a['userEmail']=!_[_0xaaad('0x5a')](_0x45d81b)?_0x45d81b['email']:null;_0x310a0a[_0xaaad('0x1d')]=_0xe561f4['email'];_0x310a0a[_0xaaad('0x22')]=_0x3a938a[_0xaaad('0x2f')]()==='outbound'?_0x4e4f0b['destcalleridnum']:_0x4e4f0b[_0xaaad('0x5b')];_0x310a0a[_0xaaad('0x5c')]=_0x3a938a===_0xaaad('0x5d')||_0x3a938a===_0xaaad('0x5e')?_0xaaad('0x5d'):_0xaaad('0x37');var _0x532626=util[_0xaaad('0x58')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe561f4[_0xaaad('0x57')],_0x4e4f0b[_0xaaad('0x5f')],md5(_0x4e4f0b['uniqueid']));if(_0x23cf16&&_0x23cf16[_0xaaad('0x60')]){logger['info'](_0xaaad('0x61'),'Recording\x20is\x20enabled!');_0x4e4f0b[_0xaaad('0x62')]=_0x532626;}else if(_0x34f7fc&&_0x34f7fc[_0xaaad('0x63')]&&_0x34f7fc[_0xaaad('0x63')]!=='none'){logger[_0xaaad('0xe')]('[OUTBOUND]',_0xaaad('0x64'));_0x4e4f0b[_0xaaad('0x62')]=_0x532626;}else{_0x4e4f0b['recordingURL']='';}return getAdminUser(_0x3a938a,_0x38bc2c,_0x310a0a,_0x1cb654,_0x2dc9e7,_0x31522e)[_0xaaad('0xa')](getUser(_0x3a938a,_0x38bc2c,_0x1cb654,_0x2dc9e7,_0x31522e))[_0xaaad('0xa')](getEndUser(_0x3a938a,_0x38bc2c,_0x1cb654,_0x2dc9e7,_0x31522e))[_0xaaad('0xa')](getTicket(_0x3a938a,_0x38bc2c,_0x1cb654,_0x4b39fc,_0x4e4f0b,_0x2dc9e7))['then'](function(_0x127e95){logger['info'](util[_0xaaad('0x58')](_0xaaad('0x65'),_0x127e95[_0xaaad('0x3f')]));logger['info'](util[_0xaaad('0x58')]('call\x20direction:\x20%s',_0x3a938a));if(_0x3a938a!==_0xaaad('0x5e')){logger[_0xaaad('0xe')]('['+[_0x3a938a[_0xaaad('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xe561f4[_0xaaad('0x55')],_0x45d81b[_0xaaad('0x36')],_0x127e95['ticketId']);}})[_0xaaad('0xf')](function(_0x1745f3){logger['error']('['+[_0x3a938a[_0xaaad('0x11')]()]+_0xaaad('0x66'),util[_0xaaad('0x67')](_0x1745f3,{'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 86a3868..268806f 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 _0x319f=['getString','Subjects','created_by','description','Descriptions','date_start','slice','replace','duration_hours','parent_type','Contacts','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','get_server_info','isNil','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','variable','push','customVariable','Variable','login','username','password','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','error','outbound','uri','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','toUpperCase','lastevent','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x319f,0x6a));var _0xf319=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x319f[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var rp=require(_0xf319('0x0'));var BPromise=require(_0xf319('0x1'));var md5=require(_0xf319('0x2'));var util=require(_0xf319('0x3'));var Redis=require(_0xf319('0x4'));var intUtil=require(_0xf319('0x5'));var config=require('../../../../config/environment');var logger=require(_0xf319('0x6'))(_0xf319('0x7'));config['redis']=_['defaults'](config[_0xf319('0x8')],{'host':_0xf319('0x9'),'port':0x18eb});var io=require(_0xf319('0xa'))(new Redis(config[_0xf319('0x8')]));var def={'method':_0xf319('0xb'),'json':!![]};function emit(_0x4de1b1,_0x3fc236,_0x7ad82a){io['to'](_0x4de1b1)[_0xf319('0xc')](_0x3fc236,_0x7ad82a);}function getTicket(_0x4016d,_0x2affce,_0x579231,_0x4767e0,_0x47a8e7,_0x1790b1,_0x8b28f6,_0x1fb960){logger[_0xf319('0xd')](_0xf319('0xe'));var _0x174f4f=new Date();var _0x54b362=[{'name':_0xf319('0xf'),'value':intUtil[_0xf319('0x10')](_0x4767e0[_0xf319('0x11')],_0x47a8e7,'\x20')},{'name':'assigned_user_id','value':_0x2affce['id']},{'name':_0xf319('0x12'),'value':_0x2affce['id']},{'name':_0xf319('0x13'),'value':intUtil[_0xf319('0x10')](_0x4767e0[_0xf319('0x14')],_0x47a8e7,'\x0a')},{'name':_0xf319('0x15'),'value':_0x174f4f['toISOString']()[_0xf319('0x16')](0x0,0x13)[_0xf319('0x17')]('T','\x20')},{'name':_0xf319('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x579231['id']},{'name':_0xf319('0x19'),'value':_0xf319('0x1a')},{'name':'parent_name','value':_0x579231['name']},{'name':_0xf319('0x1b'),'value':_0x1fb960}];if(_0x1790b1[_0xf319('0x1c')]){_[_0xf319('0x1d')](_0x1790b1,function(_0x516434){if(_0x47a8e7[_0x516434[_0xf319('0x1e')]]){_0x54b362['push']({'name':_0x516434[_0xf319('0x1f')],'value':_0x47a8e7[_0x516434['variableName']]});}});}return request({'form':{'method':_0xf319('0x20'),'input_type':_0xf319('0x21'),'response_type':_0xf319('0x21'),'rest_data':JSON[_0xf319('0x22')]({'session':_0x8b28f6['id'],'module_name':_0xf319('0x23'),'name_value_list':_0x54b362})}});}function getAuth(_0x107774){return util[_0xf319('0x24')](_0xf319('0x25'),new Buffer(_0x107774[_0xf319('0x26')]+':X')['toString']('base64'));}function getServerInfo(_0x115af0){return request({'form':{'method':_0xf319('0x27'),'input_type':'JSON','response_type':_0xf319('0x21'),'rest_data':JSON[_0xf319('0x22')]({'session':_0x115af0['id']})}});}function getUser(_0x5edc40,_0x5c9adb,_0x3fbc03){if(!_[_0xf319('0x28')](_0x5c9adb)){logger[_0xf319('0xd')]('Getting\x20agent\x20with\x20name',_0x5c9adb);return request({'form':{'method':'get_entry_list','input_type':_0xf319('0x21'),'response_type':'JSON','rest_data':JSON[_0xf319('0x22')]({'session':_0x3fbc03['id'],'module_name':'Employees','query':util['format'](_0xf319('0x29'),_0x5c9adb),'order_by':'','offset':'0','select_fields':['id',_0xf319('0xf'),_0xf319('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf319('0x2b')](function(_0x46de99){if(_0x46de99[_0xf319('0x2c')][_0xf319('0x1c')]){var _0x21084d=_[_0xf319('0x2d')](_0x46de99['entry_list'],function(_0x570136){return _0x570136[_0xf319('0x2e')][_0xf319('0x2a')][_0xf319('0x2f')]===_0x5c9adb;});if(_0x21084d){logger[_0xf319('0xd')](_0xf319('0x30'));return BPromise[_0xf319('0x31')]({'id':_0x21084d[_0xf319('0x2e')]['id'][_0xf319('0x2f')],'name':_0x21084d[_0xf319('0x2e')]['name']['value']});}}logger[_0xf319('0xd')](_0xf319('0x32'));return BPromise[_0xf319('0x31')]({'id':_0x3fbc03[_0xf319('0x2e')][_0xf319('0x33')]['value'],'name':_0x3fbc03[_0xf319('0x2e')]['user_name']['value']});});}else{logger[_0xf319('0xd')](_0xf319('0x34'));return BPromise[_0xf319('0x31')]({'id':_0x3fbc03[_0xf319('0x2e')][_0xf319('0x33')][_0xf319('0x2f')],'name':_0x3fbc03[_0xf319('0x2e')][_0xf319('0x2a')][_0xf319('0x2f')]});}}function getEndUser(_0xf9df46,_0x32ae86,_0x48cfce,_0x5f20bc){logger['info'](_0xf319('0x35'),_0x48cfce);return request({'form':{'method':'get_entry_list','input_type':_0xf319('0x21'),'response_type':_0xf319('0x21'),'rest_data':JSON[_0xf319('0x22')]({'session':_0x5f20bc['id'],'module_name':_0xf319('0x1a'),'query':util[_0xf319('0x24')](_0xf319('0x36'),_0x48cfce),'order_by':'','offset':'0','select_fields':['id',_0xf319('0xf'),_0xf319('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4f1607){if(_0x4f1607[_0xf319('0x2c')][_0xf319('0x1c')]){var _0x58472c=_[_0xf319('0x2d')](_0x4f1607['entry_list'],function(_0x1b0140){return _0x1b0140['name_value_list'][_0xf319('0x37')]['value']===_0x48cfce;});if(_0x58472c){logger['info'](_0xf319('0x38'));return BPromise[_0xf319('0x31')]({'id':_0x58472c[_0xf319('0x2e')]['id'][_0xf319('0x2f')],'name':_0x58472c[_0xf319('0x2e')][_0xf319('0xf')][_0xf319('0x2f')],'phone':_0x58472c[_0xf319('0x2e')][_0xf319('0x37')][_0xf319('0x2f')]});}}else{logger['info'](_0xf319('0x39'));return request({'form':{'method':'set_entry','input_type':_0xf319('0x21'),'response_type':_0xf319('0x21'),'rest_data':JSON[_0xf319('0x22')]({'session':_0x5f20bc['id'],'module_name':'Contacts','name_value_list':[{'name':_0xf319('0x3a'),'value':_0x32ae86!==_0xf319('0x3b')?_0x32ae86:util['format']('Caller\x20-\x20%s',_0x48cfce)},{'name':_0xf319('0x37'),'value':_0x48cfce}]})}})[_0xf319('0x2b')](function(_0x5bc698){logger[_0xf319('0xd')](_0xf319('0x3c'));return BPromise[_0xf319('0x31')]({'id':_0x5bc698['id'],'name':_0x5bc698[_0xf319('0x2c')][_0xf319('0x3a')][_0xf319('0x2f')],'phone':_0x5bc698['entry_list']['phone_home'][_0xf319('0x2f')]});});}});}function request(_0xbfe126){logger[_0xf319('0x3d')]('[HTTP]',JSON[_0xf319('0x22')](_0xbfe126));return rp(_[_0xf319('0x3e')](def,_0xbfe126));}function getTags(_0xa0a549,_0x150d55){var _0x28027b=[];if(_0xa0a549&&_0xa0a549['length']>0x0){_0x28027b=_[_0xf319('0x3f')](_0xa0a549,_0x150d55);}return _0x28027b;}function getCustomFields(_0x2f4e61,_0x504106){var _0x3363e8=[];var _0x3a5f69={'custom_fields':[]};if(_0x2f4e61[_0xf319('0x1c')]>0x0){_[_0xf319('0x1d')](_0x2f4e61,function(_0x54aea8){if(_0x54aea8[_0xf319('0x40')]===_0xf319('0x41')&&_0x54aea8[_0xf319('0x42')]&&!_0x54aea8[_0xf319('0x43')]){_0x3a5f69[_0x54aea8['nameField'][_0xf319('0x44')]()]=_0x54aea8[_0xf319('0x45')][_0xf319('0x46')]();}else if(_0x54aea8['type']==='string'&&_0x54aea8[_0xf319('0x1f')]&&_0x54aea8[_0xf319('0x43')]){_0x3a5f69[_0xf319('0x47')]['push']({'id':_0x54aea8[_0xf319('0x1f')],'value':_0x54aea8['content'][_0xf319('0x46')]()});}else if(_0x54aea8['type']===_0xf319('0x48')&&_0x54aea8[_0xf319('0x1e')]&&_0x54aea8['idField']&&_0x54aea8[_0xf319('0x43')]){_0x504106[_0x54aea8['variableName']]&&_0x3a5f69[_0xf319('0x47')][_0xf319('0x49')]({'id':_0x54aea8[_0xf319('0x1f')],'value':_0x504106[_0x54aea8[_0xf319('0x1e')]]['toString']()});}else if(_0x54aea8[_0xf319('0x40')]===_0xf319('0x4a')&&_0x54aea8[_0xf319('0x4b')]&&_0x54aea8[_0xf319('0x4b')][_0xf319('0xf')]&&_0x54aea8['idField']&&_0x54aea8[_0xf319('0x43')]){_0x504106[_0x54aea8[_0xf319('0x4b')][_0xf319('0xf')]['toLowerCase']()]&&_0x3a5f69[_0xf319('0x47')][_0xf319('0x49')]({'id':_0x54aea8[_0xf319('0x1f')],'value':_0x504106[_0x54aea8[_0xf319('0x4b')][_0xf319('0xf')][_0xf319('0x44')]()][_0xf319('0x46')]()});}});}return _0x3a5f69;}function getConnection(_0x29d150){return request({'method':_0xf319('0xb'),'form':{'method':_0xf319('0x4c'),'input_type':'JSON','response_type':_0xf319('0x21'),'rest_data':JSON[_0xf319('0x22')]({'user_auth':{'user_name':_0x29d150[_0xf319('0x4d')],'password':_0x29d150[_0xf319('0x4e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xf319('0x2b')](function(_0x5cea27){var _0x4fbe06=_0x5cea27;if(_0x4fbe06['id']){def['sessionID']=_0x4fbe06['id'];return BPromise[_0xf319('0x31')](_0x4fbe06);}else{throw new Error(util[_0xf319('0x24')](_0xf319('0x4f'),_0x29d150['id']));}});}function setRelationship(_0x5d0203,_0x3a1410,_0x127a0c,_0x3c7521){return request({'form':{'method':_0xf319('0x50'),'input_type':'JSON','response_type':_0xf319('0x21'),'rest_data':JSON[_0xf319('0x22')]({'session':_0x5d0203['id'],'module_name':_0xf319('0x23'),'module_id':_0x127a0c['id'],'link_field_name':_0x3c7521,'related_ids':[_0x3a1410['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf319('0x51')]=function(_0x361753,_0x28ad70,_0x53f962,_0x5312fe,_0x21489b,_0x1d5f52){var _0x591665,_0x2bd1bf,_0x77439b,_0x5cc865;_0x1d5f52['remoteUri']=intUtil[_0xf319('0x52')](_0x1d5f52['remoteUri']);_0x1d5f52[_0xf319('0x53')]=intUtil[_0xf319('0x52')](_0x1d5f52[_0xf319('0x53')]);def['uri']=util[_0xf319('0x24')]('%s/service/v4_1/rest.php',_0x1d5f52[_0xf319('0x54')]);if(_0x21489b&&_0x21489b[_0xf319('0x55')]){logger[_0xf319('0xd')](_0xf319('0x56'),_0xf319('0x57'));_0x28ad70['recordingURL']=util[_0xf319('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d5f52[_0xf319('0x53')],_0x28ad70[_0xf319('0x58')],md5(_0x28ad70[_0xf319('0x58')]));}else{_0x28ad70[_0xf319('0x59')]='';}return getConnection(_0x1d5f52)[_0xf319('0x2b')](function(_0x521660){_0x5cc865=_0x521660;return getUser(_0x1d5f52,_0x5312fe[_0xf319('0xf')],_0x5cc865);})['then'](function(_0x4e516b){_0x591665=_0x4e516b;logger[_0xf319('0xd')](_0xf319('0x5a'),_0x591665['id']);return getEndUser(_0x1d5f52,_0x28ad70[_0xf319('0x5b')],_0x28ad70[_0xf319('0x5c')],_0x5cc865);})['then'](function(_0x3706b0){_0x2bd1bf=_0x3706b0;logger[_0xf319('0xd')](_0xf319('0x5d'),_0x2bd1bf['id']);return getTicket(_0x1d5f52,_0x591665,_0x2bd1bf,_0x53f962,_0x28ad70,_0x53f962[_0xf319('0x5e')],_0x5cc865,_0xf319('0x5f'));})[_0xf319('0x2b')](function(_0x16ceb7){_0x77439b=_0x16ceb7;logger['info'](_0xf319('0x60'));logger[_0xf319('0xd')](_0xf319('0x61'),_0x77439b['id']);return setRelationship(_0x5cc865,_0x591665,_0x77439b,_0xf319('0x62'));})['then'](function(){return setRelationship(_0x5cc865,_0x2bd1bf,_0x77439b,'contacts');})[_0xf319('0x2b')](function(){return getServerInfo(_0x5cc865);})[_0xf319('0x2b')](function(_0x32ad98){var _0x3233ea=parseInt(_0x32ad98['version'][_0xf319('0x63')](0x0));var _0x5d1770=util['format'](_0xf319('0x64'),_0x1d5f52[_0xf319('0x54')],_0x77439b['id']);if(_0x3233ea>0x6){_0x5d1770=util[_0xf319('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1d5f52[_0xf319('0x54')],_0x77439b['id']);}logger['info'](_0xf319('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf319('0x24')](_0xf319('0x65'),_0x5312fe[_0xf319('0xf')]),_0xf319('0x66'),{'uri':_0x5d1770});})['catch'](function(_0x1d6e2f){logger[_0xf319('0x67')]('[QUEUE]',JSON['stringify'](_0x1d6e2f));});};exports[_0xf319('0x68')]=function(_0x15c2dd,_0x5888aa,_0x5a948d,_0x5dfbaf,_0x37d1f5,_0x5532ce,_0x3aeb45){var _0x2df9f6,_0x49a2f4,_0x414070,_0x860868;_0x5532ce[_0xf319('0x54')]=intUtil[_0xf319('0x52')](_0x5532ce[_0xf319('0x54')]);_0x5532ce['serverUrl']=intUtil[_0xf319('0x52')](_0x5532ce[_0xf319('0x53')]);def[_0xf319('0x69')]=util[_0xf319('0x24')](_0xf319('0x6a'),_0x5532ce[_0xf319('0x54')]);if(_0x3aeb45&&_0x3aeb45['recordingFormat']&&_0x3aeb45[_0xf319('0x6b')]!==_0xf319('0x6c')){logger[_0xf319('0xd')](_0xf319('0x6d'),_0xf319('0x57'));_0x5888aa[_0xf319('0x59')]=util[_0xf319('0x24')](_0xf319('0x6e'),_0x5532ce[_0xf319('0x53')],_0x5888aa[_0xf319('0x58')],md5(_0x5888aa['uniqueid']));}return getConnection(_0x5532ce)[_0xf319('0x2b')](function(_0x34b6fb){_0x860868=_0x34b6fb;return getUser(_0x5532ce,_0x5dfbaf[_0xf319('0xf')],_0x860868);})['then'](function(_0x5e94d8){_0x2df9f6=_0x5e94d8;logger[_0xf319('0xd')](_0xf319('0x5a'),_0x2df9f6['id']);return getEndUser(_0x5532ce,_0x5888aa[_0xf319('0x6f')],_0x5888aa[_0xf319('0x70')],_0x860868);})[_0xf319('0x2b')](function(_0x45d084){_0x49a2f4=_0x45d084;logger[_0xf319('0xd')](_0xf319('0x5d'),_0x49a2f4['id']);return getTicket(_0x5532ce,_0x2df9f6,_0x49a2f4,_0x5a948d,_0x5888aa,_0x5a948d['Fields'],_0x860868,_0xf319('0x71'));})[_0xf319('0x2b')](function(_0xe35861){_0x414070=_0xe35861;logger[_0xf319('0xd')]('Ticket\x20created!');logger[_0xf319('0xd')]('The\x20Ticket\x20ID\x20is:',_0x414070['id']);return setRelationship(_0x860868,_0x2df9f6,_0x414070,_0xf319('0x62'));})[_0xf319('0x2b')](function(){return setRelationship(_0x860868,_0x49a2f4,_0x414070,_0xf319('0x72'));})[_0xf319('0x2b')](function(){return getServerInfo(_0x860868);})[_0xf319('0x2b')](function(_0x22c73a){var _0x514cfe=parseInt(_0x22c73a[_0xf319('0x73')][_0xf319('0x63')](0x0));var _0xf88eef=util['format'](_0xf319('0x64'),_0x5532ce['remoteUri'],_0x414070['id']);if(_0x514cfe>0x6){_0xf88eef=util[_0xf319('0x24')](_0xf319('0x74'),_0x5532ce['remoteUri'],_0x414070['id']);}logger[_0xf319('0xd')]('[OUTBOUND]',_0xf319('0x75'));emit(util[_0xf319('0x24')]('user:%s',_0x5dfbaf['name']),_0xf319('0x66'),{'uri':_0xf88eef});})[_0xf319('0x76')](function(_0x1e5713){logger['error'](_0xf319('0x6d'),JSON[_0xf319('0x22')](_0x1e5713));});};exports[_0xf319('0x77')]=function(_0x13b73d,_0x1f5fc4,_0xac7043,_0x50e314,_0x549bb9,_0x59e2cd){var _0x5a43b,_0x50088e,_0x53fb07,_0x2afff8;_0x59e2cd[_0xf319('0x54')]=intUtil[_0xf319('0x52')](_0x59e2cd[_0xf319('0x54')]);_0x59e2cd[_0xf319('0x53')]=intUtil[_0xf319('0x52')](_0x59e2cd[_0xf319('0x53')]);def['uri']=util['format'](_0xf319('0x6a'),_0x59e2cd['remoteUri']);if(_0x549bb9&&_0x549bb9['monitor_format']){logger[_0xf319('0xd')]('['+_0x1f5fc4['lastevent'][_0xf319('0x78')]()+']',_0xf319('0x57'));_0x1f5fc4[_0xf319('0x59')]=util[_0xf319('0x24')](_0xf319('0x6e'),_0x59e2cd[_0xf319('0x53')],_0x1f5fc4[_0xf319('0x58')],md5(_0x1f5fc4[_0xf319('0x58')]));}else{_0x1f5fc4[_0xf319('0x59')]='';}return getConnection(_0x59e2cd)[_0xf319('0x2b')](function(_0x3701bb){_0x2afff8=_0x3701bb;if(!_['isNil'](_0x50e314)){return getUser(_0x59e2cd,_0x50e314[_0xf319('0xf')],_0x2afff8);}else{return getUser(_0x59e2cd,null,_0x2afff8);}})[_0xf319('0x2b')](function(_0x455255){_0x5a43b=_0x455255;logger[_0xf319('0xd')]('The\x20User\x20ID\x20is:',_0x5a43b['id']);return getEndUser(_0x59e2cd,_0x1f5fc4['calleridname'],_0x1f5fc4[_0xf319('0x5c')],_0x2afff8);})[_0xf319('0x2b')](function(_0x4d1d3b){_0x50088e=_0x4d1d3b;logger[_0xf319('0xd')]('The\x20Enduser\x20ID\x20is:',_0x50088e['id']);return getTicket(_0x59e2cd,_0x5a43b,_0x50088e,_0xac7043,_0x1f5fc4,_0xac7043[_0xf319('0x5e')],_0x2afff8,_0xf319('0x5f'));})[_0xf319('0x2b')](function(_0x536e3b){_0x53fb07=_0x536e3b;logger['info']('Ticket\x20created!');logger[_0xf319('0xd')]('The\x20Ticket\x20ID\x20is:',_0x53fb07['id']);return setRelationship(_0x2afff8,_0x5a43b,_0x53fb07,'users');})[_0xf319('0x2b')](function(){return setRelationship(_0x2afff8,_0x50088e,_0x53fb07,_0xf319('0x72'));})[_0xf319('0x2b')](function(){return getServerInfo(_0x2afff8);})['catch'](function(_0x4695ba){logger[_0xf319('0x67')]('['+_0x1f5fc4[_0xf319('0x79')][_0xf319('0x78')]()+']',JSON[_0xf319('0x22')](_0x4695ba));});}; \ No newline at end of file +var _0x9094=['name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','variableName','customVariable','Variable','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','[QUEUE]','outbound','%s/service/v4_1/rest.php','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','lastevent','toUpperCase','Inbound','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','Descriptions','date_start','slice','replace','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','set_entry','JSON','Calls','format','apiKey','toString','base64','get_server_info','stringify','get_entry_list','Employees','user_name','entry_list','find'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9094,0x1af));var _0x4909=function(_0x5bf929,_0x2e90f2){_0x5bf929=_0x5bf929-0x0;var _0x40fc46=_0x9094[_0x5bf929];return _0x40fc46;};'use strict';var _=require(_0x4909('0x0'));var rp=require(_0x4909('0x1'));var BPromise=require(_0x4909('0x2'));var md5=require(_0x4909('0x3'));var util=require(_0x4909('0x4'));var Redis=require('ioredis');var intUtil=require(_0x4909('0x5'));var config=require(_0x4909('0x6'));var logger=require('../../../../config/logger')(_0x4909('0x7'));config[_0x4909('0x8')]=_['defaults'](config[_0x4909('0x8')],{'host':_0x4909('0x9'),'port':0x18eb});var io=require(_0x4909('0xa'))(new Redis(config['redis']));var def={'method':_0x4909('0xb'),'json':!![]};function emit(_0x45fc26,_0x385146,_0x1aeb21){io['to'](_0x45fc26)[_0x4909('0xc')](_0x385146,_0x1aeb21);}function getTicket(_0x2a20d9,_0x490ab6,_0x5c7e0e,_0x47b0a6,_0x42abac,_0x1a9a05,_0x5dd97b,_0x2396b5){logger[_0x4909('0xd')]('Creating\x20new\x20ticket...');var _0x208b4a=new Date();var _0xee8205=[{'name':_0x4909('0xe'),'value':intUtil[_0x4909('0xf')](_0x47b0a6[_0x4909('0x10')],_0x42abac,'\x20')},{'name':_0x4909('0x11'),'value':_0x490ab6['id']},{'name':'created_by','value':_0x490ab6['id']},{'name':'description','value':intUtil[_0x4909('0xf')](_0x47b0a6[_0x4909('0x12')],_0x42abac,'\x0a')},{'name':_0x4909('0x13'),'value':_0x208b4a['toISOString']()[_0x4909('0x14')](0x0,0x13)[_0x4909('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x4909('0x16'),'value':_0x5c7e0e['id']},{'name':_0x4909('0x17'),'value':_0x4909('0x18')},{'name':_0x4909('0x19'),'value':_0x5c7e0e['name']},{'name':_0x4909('0x1a'),'value':_0x2396b5}];if(_0x1a9a05[_0x4909('0x1b')]){_[_0x4909('0x1c')](_0x1a9a05,function(_0x20d4d){if(_0x42abac[_0x20d4d['variableName']]){_0xee8205[_0x4909('0x1d')]({'name':_0x20d4d[_0x4909('0x1e')],'value':_0x42abac[_0x20d4d['variableName']]});}});}return request({'form':{'method':_0x4909('0x1f'),'input_type':_0x4909('0x20'),'response_type':_0x4909('0x20'),'rest_data':JSON['stringify']({'session':_0x5dd97b['id'],'module_name':_0x4909('0x21'),'name_value_list':_0xee8205})}});}function getAuth(_0x1b18bb){return util[_0x4909('0x22')]('Basic\x20%s',new Buffer(_0x1b18bb[_0x4909('0x23')]+':X')[_0x4909('0x24')](_0x4909('0x25')));}function getServerInfo(_0x12ba32){return request({'form':{'method':_0x4909('0x26'),'input_type':'JSON','response_type':_0x4909('0x20'),'rest_data':JSON[_0x4909('0x27')]({'session':_0x12ba32['id']})}});}function getUser(_0x959624,_0x5f132d,_0x3633f7){if(!_['isNil'](_0x5f132d)){logger[_0x4909('0xd')]('Getting\x20agent\x20with\x20name',_0x5f132d);return request({'form':{'method':_0x4909('0x28'),'input_type':_0x4909('0x20'),'response_type':_0x4909('0x20'),'rest_data':JSON[_0x4909('0x27')]({'session':_0x3633f7['id'],'module_name':_0x4909('0x29'),'query':util[_0x4909('0x22')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5f132d),'order_by':'','offset':'0','select_fields':['id',_0x4909('0xe'),_0x4909('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5a9466){if(_0x5a9466[_0x4909('0x2b')]['length']){var _0x1cf3ec=_[_0x4909('0x2c')](_0x5a9466[_0x4909('0x2b')],function(_0x5e1795){return _0x5e1795[_0x4909('0x2d')][_0x4909('0x2a')]['value']===_0x5f132d;});if(_0x1cf3ec){logger[_0x4909('0xd')](_0x4909('0x2e'));return BPromise[_0x4909('0x2f')]({'id':_0x1cf3ec[_0x4909('0x2d')]['id'][_0x4909('0x30')],'name':_0x1cf3ec[_0x4909('0x2d')][_0x4909('0xe')][_0x4909('0x30')]});}}logger[_0x4909('0xd')](_0x4909('0x31'));return BPromise[_0x4909('0x2f')]({'id':_0x3633f7[_0x4909('0x2d')][_0x4909('0x32')]['value'],'name':_0x3633f7[_0x4909('0x2d')]['user_name'][_0x4909('0x30')]});});}else{logger[_0x4909('0xd')](_0x4909('0x33'));return BPromise[_0x4909('0x2f')]({'id':_0x3633f7[_0x4909('0x2d')][_0x4909('0x32')][_0x4909('0x30')],'name':_0x3633f7[_0x4909('0x2d')][_0x4909('0x2a')][_0x4909('0x30')]});}}function getEndUser(_0x392a7a,_0x38484f,_0x1987fd,_0x237479){logger[_0x4909('0xd')]('Searching\x20enduser\x20with\x20phone',_0x1987fd);return request({'form':{'method':_0x4909('0x28'),'input_type':_0x4909('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x237479['id'],'module_name':'Contacts','query':util['format'](_0x4909('0x34'),_0x1987fd),'order_by':'','offset':'0','select_fields':['id',_0x4909('0xe'),_0x4909('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4909('0x36')](function(_0x591c83){if(_0x591c83[_0x4909('0x2b')]['length']){var _0x634681=_[_0x4909('0x2c')](_0x591c83['entry_list'],function(_0x3c3800){return _0x3c3800['name_value_list'][_0x4909('0x35')]['value']===_0x1987fd;});if(_0x634681){logger[_0x4909('0xd')](_0x4909('0x37'));return BPromise['resolve']({'id':_0x634681[_0x4909('0x2d')]['id']['value'],'name':_0x634681[_0x4909('0x2d')][_0x4909('0xe')][_0x4909('0x30')],'phone':_0x634681['name_value_list'][_0x4909('0x35')][_0x4909('0x30')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x4909('0x1f'),'input_type':_0x4909('0x20'),'response_type':'JSON','rest_data':JSON[_0x4909('0x27')]({'session':_0x237479['id'],'module_name':_0x4909('0x18'),'name_value_list':[{'name':_0x4909('0x38'),'value':_0x38484f!==_0x4909('0x39')?_0x38484f:util['format']('Caller\x20-\x20%s',_0x1987fd)},{'name':_0x4909('0x35'),'value':_0x1987fd}]})}})[_0x4909('0x36')](function(_0x19c440){logger[_0x4909('0xd')](_0x4909('0x3a'));return BPromise[_0x4909('0x2f')]({'id':_0x19c440['id'],'name':_0x19c440[_0x4909('0x2b')]['first_name'][_0x4909('0x30')],'phone':_0x19c440[_0x4909('0x2b')][_0x4909('0x35')][_0x4909('0x30')]});});}});}function request(_0x51a59f){logger[_0x4909('0x3b')](_0x4909('0x3c'),JSON['stringify'](_0x51a59f));return rp(_[_0x4909('0x3d')](def,_0x51a59f));}function getTags(_0x35d357,_0x3307a0){var _0x448a7a=[];if(_0x35d357&&_0x35d357['length']>0x0){_0x448a7a=_[_0x4909('0x3e')](_0x35d357,_0x3307a0);}return _0x448a7a;}function getCustomFields(_0x11b58b,_0x4a13f5){var _0x44d78f=[];var _0x196ebb={'custom_fields':[]};if(_0x11b58b['length']>0x0){_[_0x4909('0x1c')](_0x11b58b,function(_0x47cd4c){if(_0x47cd4c[_0x4909('0x3f')]===_0x4909('0x40')&&_0x47cd4c[_0x4909('0x41')]&&!_0x47cd4c[_0x4909('0x42')]){_0x196ebb[_0x47cd4c['nameField'][_0x4909('0x43')]()]=_0x47cd4c['content'][_0x4909('0x24')]();}else if(_0x47cd4c[_0x4909('0x3f')]===_0x4909('0x40')&&_0x47cd4c[_0x4909('0x1e')]&&_0x47cd4c['customField']){_0x196ebb[_0x4909('0x44')]['push']({'id':_0x47cd4c['idField'],'value':_0x47cd4c[_0x4909('0x45')][_0x4909('0x24')]()});}else if(_0x47cd4c[_0x4909('0x3f')]===_0x4909('0x46')&&_0x47cd4c[_0x4909('0x47')]&&_0x47cd4c['idField']&&_0x47cd4c[_0x4909('0x42')]){_0x4a13f5[_0x47cd4c['variableName']]&&_0x196ebb[_0x4909('0x44')][_0x4909('0x1d')]({'id':_0x47cd4c[_0x4909('0x1e')],'value':_0x4a13f5[_0x47cd4c[_0x4909('0x47')]][_0x4909('0x24')]()});}else if(_0x47cd4c[_0x4909('0x3f')]===_0x4909('0x48')&&_0x47cd4c[_0x4909('0x49')]&&_0x47cd4c[_0x4909('0x49')][_0x4909('0xe')]&&_0x47cd4c['idField']&&_0x47cd4c[_0x4909('0x42')]){_0x4a13f5[_0x47cd4c[_0x4909('0x49')]['name'][_0x4909('0x43')]()]&&_0x196ebb['custom_fields'][_0x4909('0x1d')]({'id':_0x47cd4c[_0x4909('0x1e')],'value':_0x4a13f5[_0x47cd4c['Variable'][_0x4909('0xe')]['toLowerCase']()][_0x4909('0x24')]()});}});}return _0x196ebb;}function getConnection(_0x5b3556){return request({'method':_0x4909('0xb'),'form':{'method':'login','input_type':_0x4909('0x20'),'response_type':_0x4909('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5b3556['username'],'password':_0x5b3556[_0x4909('0x4a')],'encryption':_0x4909('0x4b')},'application':_0x4909('0x4c')})}})[_0x4909('0x36')](function(_0x2ee043){var _0x35c30a=_0x2ee043;if(_0x35c30a['id']){def[_0x4909('0x4d')]=_0x35c30a['id'];return BPromise[_0x4909('0x2f')](_0x35c30a);}else{throw new Error(util[_0x4909('0x22')]('Account\x20%d\x20is\x20not\x20valid',_0x5b3556['id']));}});}function setRelationship(_0x24ac30,_0x4c797a,_0x3be65f,_0x1cbdff){return request({'form':{'method':_0x4909('0x4e'),'input_type':_0x4909('0x20'),'response_type':_0x4909('0x20'),'rest_data':JSON[_0x4909('0x27')]({'session':_0x24ac30['id'],'module_name':_0x4909('0x21'),'module_id':_0x3be65f['id'],'link_field_name':_0x1cbdff,'related_ids':[_0x4c797a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4909('0x4f')]=function(_0x4e3194,_0x453883,_0x275a0a,_0x30d39c,_0x34b895,_0x314409){var _0x190a89,_0x504291,_0x50bbb7,_0x11ebc1;_0x314409[_0x4909('0x50')]=intUtil[_0x4909('0x51')](_0x314409[_0x4909('0x50')]);_0x314409[_0x4909('0x52')]=intUtil[_0x4909('0x51')](_0x314409[_0x4909('0x52')]);def[_0x4909('0x53')]=util[_0x4909('0x22')]('%s/service/v4_1/rest.php',_0x314409['remoteUri']);if(_0x34b895&&_0x34b895[_0x4909('0x54')]){logger[_0x4909('0xd')]('[QUEUE]',_0x4909('0x55'));_0x453883['recordingURL']=util[_0x4909('0x22')](_0x4909('0x56'),_0x314409[_0x4909('0x52')],_0x453883[_0x4909('0x57')],md5(_0x453883[_0x4909('0x57')]));}else{_0x453883[_0x4909('0x58')]='';}return getConnection(_0x314409)[_0x4909('0x36')](function(_0x1e399a){_0x11ebc1=_0x1e399a;return getUser(_0x314409,_0x30d39c[_0x4909('0xe')],_0x11ebc1);})['then'](function(_0x11afd7){_0x190a89=_0x11afd7;logger['info'](_0x4909('0x59'),_0x190a89['id']);return getEndUser(_0x314409,_0x453883[_0x4909('0x5a')],_0x453883[_0x4909('0x5b')],_0x11ebc1);})[_0x4909('0x36')](function(_0x4370f4){_0x504291=_0x4370f4;logger['info'](_0x4909('0x5c'),_0x504291['id']);return getTicket(_0x314409,_0x190a89,_0x504291,_0x275a0a,_0x453883,_0x275a0a[_0x4909('0x5d')],_0x11ebc1,'Inbound');})[_0x4909('0x36')](function(_0x375f57){_0x50bbb7=_0x375f57;logger['info'](_0x4909('0x5e'));logger[_0x4909('0xd')](_0x4909('0x5f'),_0x50bbb7['id']);return setRelationship(_0x11ebc1,_0x190a89,_0x50bbb7,_0x4909('0x60'));})[_0x4909('0x36')](function(){return setRelationship(_0x11ebc1,_0x504291,_0x50bbb7,_0x4909('0x61'));})[_0x4909('0x36')](function(){return getServerInfo(_0x11ebc1);})[_0x4909('0x36')](function(_0x3298d2){var _0x15b490=parseInt(_0x3298d2[_0x4909('0x62')][_0x4909('0x63')](0x0));var _0x1911f8=util[_0x4909('0x22')](_0x4909('0x64'),_0x314409[_0x4909('0x50')],_0x50bbb7['id']);if(_0x15b490>0x6){_0x1911f8=util['format'](_0x4909('0x65'),_0x314409[_0x4909('0x50')],_0x50bbb7['id']);}logger[_0x4909('0xd')]('[QUEUE]',_0x4909('0x66'));emit(util['format'](_0x4909('0x67'),_0x30d39c[_0x4909('0xe')]),_0x4909('0x68'),{'uri':_0x1911f8});})[_0x4909('0x69')](function(_0x4c45f1){logger[_0x4909('0x6a')](_0x4909('0x6b'),JSON[_0x4909('0x27')](_0x4c45f1));});};exports[_0x4909('0x6c')]=function(_0x284e01,_0x4723d8,_0x443962,_0x5d9570,_0x819de1,_0x3e6029,_0x153fe1){var _0x4608fd,_0x2e6ba7,_0x883cb3,_0x205fd8;_0x3e6029[_0x4909('0x50')]=intUtil[_0x4909('0x51')](_0x3e6029['remoteUri']);_0x3e6029[_0x4909('0x52')]=intUtil[_0x4909('0x51')](_0x3e6029[_0x4909('0x52')]);def[_0x4909('0x53')]=util[_0x4909('0x22')](_0x4909('0x6d'),_0x3e6029[_0x4909('0x50')]);if(_0x153fe1&&_0x153fe1[_0x4909('0x6e')]&&_0x153fe1['recordingFormat']!==_0x4909('0x6f')){logger[_0x4909('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4723d8[_0x4909('0x58')]=util[_0x4909('0x22')](_0x4909('0x56'),_0x3e6029['serverUrl'],_0x4723d8['uniqueid'],md5(_0x4723d8[_0x4909('0x57')]));}return getConnection(_0x3e6029)[_0x4909('0x36')](function(_0x1937a9){_0x205fd8=_0x1937a9;return getUser(_0x3e6029,_0x5d9570[_0x4909('0xe')],_0x205fd8);})[_0x4909('0x36')](function(_0x263f3f){_0x4608fd=_0x263f3f;logger[_0x4909('0xd')](_0x4909('0x59'),_0x4608fd['id']);return getEndUser(_0x3e6029,_0x4723d8['destcalleridname'],_0x4723d8[_0x4909('0x70')],_0x205fd8);})[_0x4909('0x36')](function(_0x387657){_0x2e6ba7=_0x387657;logger[_0x4909('0xd')]('The\x20Enduser\x20ID\x20is:',_0x2e6ba7['id']);return getTicket(_0x3e6029,_0x4608fd,_0x2e6ba7,_0x443962,_0x4723d8,_0x443962['Fields'],_0x205fd8,_0x4909('0x71'));})[_0x4909('0x36')](function(_0x20bbec){_0x883cb3=_0x20bbec;logger[_0x4909('0xd')](_0x4909('0x5e'));logger[_0x4909('0xd')](_0x4909('0x5f'),_0x883cb3['id']);return setRelationship(_0x205fd8,_0x4608fd,_0x883cb3,_0x4909('0x60'));})[_0x4909('0x36')](function(){return setRelationship(_0x205fd8,_0x2e6ba7,_0x883cb3,_0x4909('0x61'));})['then'](function(){return getServerInfo(_0x205fd8);})[_0x4909('0x36')](function(_0x2bad34){var _0x192d5c=parseInt(_0x2bad34['version'][_0x4909('0x63')](0x0));var _0x1b43ed=util['format'](_0x4909('0x64'),_0x3e6029['remoteUri'],_0x883cb3['id']);if(_0x192d5c>0x6){_0x1b43ed=util[_0x4909('0x22')](_0x4909('0x65'),_0x3e6029[_0x4909('0x50')],_0x883cb3['id']);}logger['info']('[OUTBOUND]',_0x4909('0x66'));emit(util['format'](_0x4909('0x67'),_0x5d9570[_0x4909('0xe')]),_0x4909('0x68'),{'uri':_0x1b43ed});})[_0x4909('0x69')](function(_0x2b3709){logger[_0x4909('0x6a')](_0x4909('0x72'),JSON[_0x4909('0x27')](_0x2b3709));});};exports[_0x4909('0x73')]=function(_0x1684b7,_0x542570,_0x39a33c,_0x35ab86,_0x1cbce5,_0x3d0ad4){var _0x9260fd,_0x3d2050,_0x316b31,_0x41ca6f;_0x3d0ad4['remoteUri']=intUtil['stripTrailingSlash'](_0x3d0ad4[_0x4909('0x50')]);_0x3d0ad4[_0x4909('0x52')]=intUtil['stripTrailingSlash'](_0x3d0ad4['serverUrl']);def[_0x4909('0x53')]=util[_0x4909('0x22')](_0x4909('0x6d'),_0x3d0ad4[_0x4909('0x50')]);if(_0x1cbce5&&_0x1cbce5['monitor_format']){logger[_0x4909('0xd')]('['+_0x542570[_0x4909('0x74')][_0x4909('0x75')]()+']',_0x4909('0x55'));_0x542570[_0x4909('0x58')]=util[_0x4909('0x22')](_0x4909('0x56'),_0x3d0ad4[_0x4909('0x52')],_0x542570[_0x4909('0x57')],md5(_0x542570[_0x4909('0x57')]));}else{_0x542570[_0x4909('0x58')]='';}return getConnection(_0x3d0ad4)['then'](function(_0xe1c304){_0x41ca6f=_0xe1c304;if(!_['isNil'](_0x35ab86)){return getUser(_0x3d0ad4,_0x35ab86[_0x4909('0xe')],_0x41ca6f);}else{return getUser(_0x3d0ad4,null,_0x41ca6f);}})[_0x4909('0x36')](function(_0x3a5104){_0x9260fd=_0x3a5104;logger[_0x4909('0xd')]('The\x20User\x20ID\x20is:',_0x9260fd['id']);return getEndUser(_0x3d0ad4,_0x542570[_0x4909('0x5a')],_0x542570[_0x4909('0x5b')],_0x41ca6f);})[_0x4909('0x36')](function(_0x3d627b){_0x3d2050=_0x3d627b;logger['info'](_0x4909('0x5c'),_0x3d2050['id']);return getTicket(_0x3d0ad4,_0x9260fd,_0x3d2050,_0x39a33c,_0x542570,_0x39a33c[_0x4909('0x5d')],_0x41ca6f,_0x4909('0x76'));})[_0x4909('0x36')](function(_0xcaedea){_0x316b31=_0xcaedea;logger[_0x4909('0xd')](_0x4909('0x5e'));logger[_0x4909('0xd')](_0x4909('0x5f'),_0x316b31['id']);return setRelationship(_0x41ca6f,_0x9260fd,_0x316b31,'users');})[_0x4909('0x36')](function(){return setRelationship(_0x41ca6f,_0x3d2050,_0x316b31,_0x4909('0x61'));})[_0x4909('0x36')](function(){return getServerInfo(_0x41ca6f);})[_0x4909('0x69')](function(_0x44bcb9){logger[_0x4909('0x6a')]('['+_0x542570['lastevent'][_0x4909('0x75')]()+']',JSON[_0x4909('0x27')](_0x44bcb9));});}; \ 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 19e3197..12ebd6a 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 _0x12ea=['isNil','test','lodash','util','getString','length','sortBy','type','string','push','variableName','customVariable','name','toLowerCase','Variable','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','join','slice','substring','lastIndexOf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12ea,0x188));var _0xa12e=function(_0x301ad4,_0x106963){_0x301ad4=_0x301ad4-0x0;var _0x98c3a1=_0x12ea[_0x301ad4];return _0x98c3a1;};'use strict';var _=require(_0xa12e('0x0'));var util=require(_0xa12e('0x1'));exports[_0xa12e('0x2')]=function(_0x51e669,_0x29579f,_0xc9d5d7){var _0x1e6a25=[];if(_0x51e669[_0xa12e('0x3')]>0x0){var _0x3200c1=_[_0xa12e('0x4')](_0x51e669,['id']);for(var _0x21c03e=0x0;_0x21c03e<_0x3200c1['length'];_0x21c03e++){var _0x1eb530=_0x3200c1[_0x21c03e];if(_0x1eb530[_0xa12e('0x5')]===_0xa12e('0x6')){_0x1e6a25[_0xa12e('0x7')](_0x1eb530['content']);}else if(_0x1eb530[_0xa12e('0x5')]==='variable'&&_0x1eb530['variableName']){_0x29579f[_0x1eb530[_0xa12e('0x8')]]&&_0x1e6a25[_0xa12e('0x7')](_0x29579f[_0x1eb530[_0xa12e('0x8')]]['toString']());}else if(_0x1eb530['type']===_0xa12e('0x9')&&_0x1eb530['Variable']&&_0x1eb530['Variable'][_0xa12e('0xa')]){_0x29579f[_0x1eb530['Variable'][_0xa12e('0xa')][_0xa12e('0xb')]()]&&_0x1e6a25[_0xa12e('0x7')](_0x29579f[_0x1eb530[_0xa12e('0xc')]['name'][_0xa12e('0xb')]()]['toString']());}else if(_0x1eb530[_0xa12e('0x5')]===_0xa12e('0xd')){if(_0x1eb530[_0xa12e('0xe')]===_0xa12e('0x6')&&_0x1eb530[_0xa12e('0xf')]){_0x1e6a25[_0xa12e('0x7')](util[_0xa12e('0x10')](_0xa12e('0x11'),_0x1eb530['key'],_0x1eb530[_0xa12e('0x12')]));}else if(_0x1eb530['keyType']===_0xa12e('0x13')&&_0x1eb530[_0xa12e('0x8')]&&_0x1eb530['key']){_0x29579f[_0x1eb530[_0xa12e('0x8')]]&&_0x1e6a25[_0xa12e('0x7')](util[_0xa12e('0x10')](_0xa12e('0x11'),_0x1eb530[_0xa12e('0xf')],_0x29579f[_0x1eb530[_0xa12e('0x8')]]));}else if(_0x1eb530[_0xa12e('0xe')]===_0xa12e('0x9')&&_0x1eb530['Variable']&&_0x1eb530[_0xa12e('0xc')][_0xa12e('0xa')]&&_0x1eb530[_0xa12e('0xf')]){_0x29579f[_0x1eb530[_0xa12e('0xc')]['name'][_0xa12e('0xb')]()]&&_0x1e6a25[_0xa12e('0x7')](util[_0xa12e('0x10')](_0xa12e('0x11'),_0x1eb530[_0xa12e('0xf')],_0x29579f[_0x1eb530[_0xa12e('0xc')][_0xa12e('0xa')][_0xa12e('0xb')]()]));}}}}return _0x1e6a25[_0xa12e('0x14')](_0xc9d5d7);};exports['stripTrailingSlash']=function(_0x5dfd76){var _0x543883=_0x5dfd76[_0xa12e('0x15')](-0x1);if(_0x543883==='/'){_0x5dfd76=_0x5dfd76[_0xa12e('0x16')](0x0,_0x5dfd76[_0xa12e('0x17')](_0x543883));}return _0x5dfd76;};exports['validateEmail']=function(_0x5c0fae){if(!_[_0xa12e('0x18')](_0x5c0fae)&&_0x5c0fae!==''){var _0x63e1d4=/^(([^<>()\[\]\\.,;:\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 _0x63e1d4[_0xa12e('0x19')](String(_0x5c0fae)[_0xa12e('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xd11e=['util','getString','length','sortBy','string','content','type','variable','variableName','push','Variable','name','toLowerCase','toString','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','slice','substring','lastIndexOf','validateEmail','test','lodash'];(function(_0x5af01e,_0x481622){var _0x35192f=function(_0x390524){while(--_0x390524){_0x5af01e['push'](_0x5af01e['shift']());}};_0x35192f(++_0x481622);}(_0xd11e,0x1ca));var _0xed11=function(_0x37d718,_0x4b5779){_0x37d718=_0x37d718-0x0;var _0x1b650a=_0xd11e[_0x37d718];return _0x1b650a;};'use strict';var _=require(_0xed11('0x0'));var util=require(_0xed11('0x1'));exports[_0xed11('0x2')]=function(_0x241642,_0x220812,_0x49c90a){var _0x14ef56=[];if(_0x241642[_0xed11('0x3')]>0x0){var _0xa5e350=_[_0xed11('0x4')](_0x241642,['id']);for(var _0x6ad37=0x0;_0x6ad37<_0xa5e350[_0xed11('0x3')];_0x6ad37++){var _0xb68922=_0xa5e350[_0x6ad37];if(_0xb68922['type']===_0xed11('0x5')){_0x14ef56['push'](_0xb68922[_0xed11('0x6')]);}else if(_0xb68922[_0xed11('0x7')]===_0xed11('0x8')&&_0xb68922[_0xed11('0x9')]){_0x220812[_0xb68922[_0xed11('0x9')]]&&_0x14ef56[_0xed11('0xa')](_0x220812[_0xb68922['variableName']]['toString']());}else if(_0xb68922[_0xed11('0x7')]==='customVariable'&&_0xb68922[_0xed11('0xb')]&&_0xb68922[_0xed11('0xb')]['name']){_0x220812[_0xb68922[_0xed11('0xb')][_0xed11('0xc')][_0xed11('0xd')]()]&&_0x14ef56['push'](_0x220812[_0xb68922[_0xed11('0xb')][_0xed11('0xc')][_0xed11('0xd')]()][_0xed11('0xe')]());}else if(_0xb68922[_0xed11('0x7')]===_0xed11('0xf')){if(_0xb68922['keyType']===_0xed11('0x5')&&_0xb68922[_0xed11('0x10')]){_0x14ef56[_0xed11('0xa')](util[_0xed11('0x11')](_0xed11('0x12'),_0xb68922[_0xed11('0x10')],_0xb68922[_0xed11('0x13')]));}else if(_0xb68922[_0xed11('0x14')]===_0xed11('0x8')&&_0xb68922['variableName']&&_0xb68922[_0xed11('0x10')]){_0x220812[_0xb68922[_0xed11('0x9')]]&&_0x14ef56['push'](util[_0xed11('0x11')]('%s:\x20%s',_0xb68922[_0xed11('0x10')],_0x220812[_0xb68922[_0xed11('0x9')]]));}else if(_0xb68922[_0xed11('0x14')]==='customVariable'&&_0xb68922[_0xed11('0xb')]&&_0xb68922[_0xed11('0xb')][_0xed11('0xc')]&&_0xb68922[_0xed11('0x10')]){_0x220812[_0xb68922[_0xed11('0xb')][_0xed11('0xc')]['toLowerCase']()]&&_0x14ef56[_0xed11('0xa')](util[_0xed11('0x11')](_0xed11('0x12'),_0xb68922[_0xed11('0x10')],_0x220812[_0xb68922[_0xed11('0xb')][_0xed11('0xc')][_0xed11('0xd')]()]));}}}}return _0x14ef56[_0xed11('0x15')](_0x49c90a);};exports['stripTrailingSlash']=function(_0x53c716){var _0x25984a=_0x53c716[_0xed11('0x16')](-0x1);if(_0x25984a==='/'){_0x53c716=_0x53c716[_0xed11('0x17')](0x0,_0x53c716[_0xed11('0x18')](_0x25984a));}return _0x53c716;};exports[_0xed11('0x19')]=function(_0x17e526){if(!_['isNil'](_0x17e526)&&_0x17e526!==''){var _0x350cea=/^(([^<>()\[\]\\.,;:\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 _0x350cea[_0xed11('0x1a')](String(_0x17e526)[_0xed11('0xd')]());}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 aeb2068..68841d5 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(_0x12a9ea,_0x342aef){var _0x52e51c=function(_0x560e7a){while(--_0x560e7a){_0x12a9ea['push'](_0x12a9ea['shift']());}};_0x52e51c(++_0x342aef);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x35bbcc,_0x5f1c93){var _0x5e3436=function(_0x51c29d){while(--_0x51c29d){_0x35bbcc['push'](_0x35bbcc['shift']());}};_0x5e3436(++_0x5f1c93);}(_0x34e8,0x12c));var _0x834e=function(_0x9d6299,_0x3a0083){_0x9d6299=_0x9d6299-0x0;var _0x363f3f=_0x34e8[_0x9d6299];return _0x363f3f;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ 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 f73bab2..78e0426 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 _0x9889=['info','format','%s/tickets.json','remoteUri','POST','merge','name','Subjects','Descriptions','getString','Fields','Ticket\x20created!','ticket','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','nameField','customField','toLowerCase','string','idField','push','content','variable','variableName','custom_fields','type','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','application/json'];(function(_0x314ecc,_0x257599){var _0x403708=function(_0x24f761){while(--_0x24f761){_0x314ecc['push'](_0x314ecc['shift']());}};_0x403708(++_0x257599);}(_0x9889,0xc8));var _0x9988=function(_0x552ea5,_0x28c15c){_0x552ea5=_0x552ea5-0x0;var _0x34dc4a=_0x9889[_0x552ea5];return _0x34dc4a;};'use strict';var _=require(_0x9988('0x0'));var rp=require('request-promise');var md5=require(_0x9988('0x1'));var util=require(_0x9988('0x2'));var Redis=require(_0x9988('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x9988('0x4'))(_0x9988('0x5'));config['redis']=_['defaults'](config[_0x9988('0x6')],{'host':_0x9988('0x7'),'port':0x18eb});var io=require(_0x9988('0x8'))(new Redis(config[_0x9988('0x6')]));function emit(_0x219dbd,_0x4f72f7,_0x374d89){io['to'](_0x219dbd)['emit'](_0x4f72f7,_0x374d89);}var headers={'Content-Type':_0x9988('0x9'),'Accept':_0x9988('0x9')};function getTicket(_0x44d7ef,_0x1bf564,_0x4c5850,_0x4e7f79,_0x396244){logger[_0x9988('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x9988('0xb')](_0x9988('0xc'),_0x44d7ef[_0x9988('0xd')]),'method':_0x9988('0xe'),'body':{'ticket':_[_0x9988('0xf')]({'requester_id':_0x4c5850['id'],'submitter_id':_0x1bf564?_0x1bf564['id']:undefined,'assignee_id':_0x1bf564?_0x1bf564['id']:undefined,'tags':getTags(_0x4e7f79['Tags'],_0x9988('0x10')),'subject':intUtil['getString'](_0x4e7f79[_0x9988('0x11')],_0x396244,'\x20'),'description':intUtil['getString'](_0x4e7f79[_0x9988('0x12')],_0x396244,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9988('0x13')](_0x4e7f79[_0x9988('0x12')],_0x396244,'\x0a')}},getCustomFields(_0x4e7f79[_0x9988('0x14')],_0x396244))}})['then'](function(_0x3ff9da){logger[_0x9988('0xa')](_0x9988('0x15'));return _0x3ff9da[_0x9988('0x16')];});}function getUser(_0x5c9e8c,_0x49b474){if(intUtil['validateEmail'](_0x49b474)){logger[_0x9988('0xa')]('Getting\x20agent\x20with\x20email',_0x49b474);return request({'uri':util[_0x9988('0xb')](_0x9988('0x17'),_0x5c9e8c[_0x9988('0xd')]),'qs':{'query':util[_0x9988('0xb')](_0x9988('0x18'),_0x49b474)}})[_0x9988('0x19')](function(_0x13ea03){if(_0x13ea03['count']){logger[_0x9988('0xa')](_0x9988('0x1a'));return _[_0x9988('0x1b')](_0x13ea03['results'],{'email':_0x49b474,'role':_0x9988('0x1c')});}else{logger[_0x9988('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x9988('0x1d'),_0x5c9e8c[_0x9988('0xd')])})[_0x9988('0x19')](function(_0x36c1c3){logger[_0x9988('0xa')]('Admin\x20account\x20selected.');return _0x36c1c3[_0x9988('0x1e')];});}});}else{logger[_0x9988('0xa')](_0x9988('0x1f'));return request({'uri':util[_0x9988('0xb')]('%s/users/me.json',_0x5c9e8c[_0x9988('0xd')])})['then'](function(_0x1e3ccf){logger[_0x9988('0xa')](_0x9988('0x20'));return _0x1e3ccf['user'];});}}function getEndUser(_0x100ded,_0xa80df8,_0x504c11){logger[_0x9988('0xa')]('Searching\x20enduser\x20with\x20phone',_0x504c11);return request({'uri':util[_0x9988('0xb')](_0x9988('0x17'),_0x100ded['remoteUri']),'qs':{'query':util['format'](_0x9988('0x21'),_0x504c11)}})[_0x9988('0x19')](function(_0x381f72){var _0x4fc5e7;if(_0x381f72[_0x9988('0x22')][_0x9988('0x23')]){_0x381f72[_0x9988('0x22')]=_[_0x9988('0x24')](_0x381f72[_0x9988('0x22')],{'suspended':![],'role':_0x9988('0x25')});if(_0x381f72[_0x9988('0x22')]['length']){_0x4fc5e7=_['first'](_0x381f72['results']);}}if(_0x4fc5e7){logger[_0x9988('0xa')](_0x9988('0x26'));return _0x4fc5e7;}else{logger['info'](_0x9988('0x27'));return request({'uri':util['format'](_0x9988('0x28'),_0x100ded[_0x9988('0xd')]),'method':'POST','body':{'user':{'role':_0x9988('0x25'),'name':util[_0x9988('0xb')]('Caller\x20-\x20%s',_0xa80df8||_0x504c11),'phone':_0x504c11}}})[_0x9988('0x19')](function(_0x2c86e5){logger[_0x9988('0xa')]('Enduser\x20created.');return _0x2c86e5[_0x9988('0x1e')];});}});}function getAuth(_0x393601){var _0x26a5ae;if(_0x393601[_0x9988('0x29')]===_0x9988('0x2a')){_0x26a5ae=util['format']('%s:%s',_0x393601[_0x9988('0x2b')],_0x393601[_0x9988('0x2a')]);}else if(_0x393601['authType']==='token'){_0x26a5ae=util[_0x9988('0xb')]('%s/token:%s',_0x393601[_0x9988('0x2b')],_0x393601[_0x9988('0x2c')]);}return util[_0x9988('0xb')](_0x9988('0x2d'),new Buffer(_0x26a5ae)[_0x9988('0x2e')](_0x9988('0x2f')));}function request(_0x5cc173){logger[_0x9988('0x30')](_0x9988('0x31'),JSON[_0x9988('0x32')](_0x5cc173));return rp(_[_0x9988('0x33')](_0x5cc173,{'method':_0x9988('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x299e6c,_0xc65265){var _0x437885=[];if(_0x299e6c&&_0x299e6c[_0x9988('0x23')]>0x0){_0x437885=_[_0x9988('0x35')](_0x299e6c,_0xc65265);}return _0x437885;}function getCustomFields(_0x4dc762,_0x5ddc78){var _0x390d43=[];var _0x5dc66c={'custom_fields':[]};if(_0x4dc762[_0x9988('0x23')]>0x0){_[_0x9988('0x36')](_0x4dc762,function(_0x4f4559){if(_[_0x9988('0x37')](['string','picklist'],_0x4f4559['type'])&&_0x4f4559[_0x9988('0x38')]&&!_0x4f4559[_0x9988('0x39')]){_0x5dc66c[_0x4f4559['nameField'][_0x9988('0x3a')]()]=_0x4f4559['content'][_0x9988('0x2e')]();}else if(_[_0x9988('0x37')]([_0x9988('0x3b'),'picklist'],_0x4f4559['type'])&&_0x4f4559[_0x9988('0x3c')]&&_0x4f4559[_0x9988('0x39')]){_0x5dc66c['custom_fields'][_0x9988('0x3d')]({'id':_0x4f4559['idField'],'value':_0x4f4559[_0x9988('0x3e')]['toString']()});}else if(_0x4f4559['type']===_0x9988('0x3f')&&_0x4f4559['variableName']&&_0x4f4559[_0x9988('0x3c')]&&_0x4f4559[_0x9988('0x39')]){_0x5ddc78[_0x4f4559[_0x9988('0x40')]]&&_0x5dc66c[_0x9988('0x41')][_0x9988('0x3d')]({'id':_0x4f4559[_0x9988('0x3c')],'value':_0x5ddc78[_0x4f4559[_0x9988('0x40')]][_0x9988('0x2e')]()});}else if(_0x4f4559[_0x9988('0x42')]==='customVariable'&&_0x4f4559[_0x9988('0x43')]&&_0x4f4559[_0x9988('0x43')][_0x9988('0x10')]&&_0x4f4559['idField']&&_0x4f4559[_0x9988('0x39')]){_0x5ddc78[_0x4f4559[_0x9988('0x43')][_0x9988('0x10')][_0x9988('0x3a')]()]&&_0x5dc66c['custom_fields'][_0x9988('0x3d')]({'id':_0x4f4559['idField'],'value':_0x5ddc78[_0x4f4559[_0x9988('0x43')][_0x9988('0x10')][_0x9988('0x3a')]()][_0x9988('0x2e')]()});}});}return _0x5dc66c;}exports['queue']=function(_0x382ca3,_0x6c118,_0x6f3ab3,_0x331434,_0x3b8287,_0x16b034){var _0x150382,_0x2a2ec6;_0x16b034[_0x9988('0xd')]=intUtil[_0x9988('0x44')](_0x16b034[_0x9988('0xd')]);_0x16b034['serverUrl']=intUtil[_0x9988('0x44')](_0x16b034[_0x9988('0x45')]);if(_0x3b8287&&_0x3b8287[_0x9988('0x46')]){logger[_0x9988('0xa')](_0x9988('0x47'),_0x9988('0x48'));_0x6c118['recordingURL']=util[_0x9988('0xb')](_0x9988('0x49'),_0x16b034['serverUrl'],_0x6c118[_0x9988('0x4a')],md5(_0x6c118[_0x9988('0x4a')]));}else{_0x6c118[_0x9988('0x4b')]='';}headers['Authorization']=getAuth(_0x16b034);return getUser(_0x16b034,_0x331434[_0x9988('0x4c')])[_0x9988('0x19')](function(_0x363d9b){_0x150382=_0x363d9b;logger['info'](_0x9988('0x4d'),_0x150382['id']);return getEndUser(_0x16b034,_0x6c118[_0x9988('0x4e')],_0x6c118['calleridnum']);})[_0x9988('0x19')](function(_0x20d79f){_0x2a2ec6=_0x20d79f;logger[_0x9988('0xa')](_0x9988('0x4f'),_0x2a2ec6['id']);return getTicket(_0x16b034,_0x150382,_0x2a2ec6,_0x6f3ab3,_0x6c118);})[_0x9988('0x19')](function(_0x298e5b){if(_0x298e5b){logger[_0x9988('0xa')](_0x9988('0x50'),_0x298e5b['id']);switch(_0x16b034[_0x9988('0x42')]){case'integrationTab':logger[_0x9988('0xa')](_0x9988('0x47'),_0x9988('0x51'));return request({'uri':util[_0x9988('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x16b034['remoteUri'],_0x150382['id'],_0x298e5b['id']),'method':_0x9988('0xe')});case _0x9988('0x52'):logger[_0x9988('0xa')](_0x9988('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9988('0xb')](_0x9988('0x53'),_0x331434[_0x9988('0x10')]),_0x9988('0x54'),{'uri':util['format'](_0x9988('0x55'),_0x16b034['remoteUri'][_0x9988('0x56')](_0x9988('0x57'),''),_0x298e5b['id'])});break;default:logger[_0x9988('0x58')](_0x9988('0x47'),_0x9988('0x59'));}}})[_0x9988('0x5a')](function(_0x50bac3){logger[_0x9988('0x58')](_0x9988('0x5b'),util[_0x9988('0x5c')](_0x50bac3,{'showHidden':!![],'depth':null}));});};exports[_0x9988('0x5d')]=function(_0x953dc2,_0x4ee88b,_0x53dbd6,_0x1bae17,_0x8f274b,_0x3c210d,_0x51b606){var _0x4415e3,_0xf96d6e;_0x3c210d[_0x9988('0xd')]=intUtil[_0x9988('0x44')](_0x3c210d['remoteUri']);_0x3c210d['serverUrl']=intUtil[_0x9988('0x44')](_0x3c210d[_0x9988('0x45')]);if(_0x51b606&&_0x51b606[_0x9988('0x5e')]&&_0x51b606[_0x9988('0x5e')]!=='none'){logger['info'](_0x9988('0x5f'),_0x9988('0x48'));_0x4ee88b['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c210d[_0x9988('0x45')],_0x4ee88b[_0x9988('0x4a')],md5(_0x4ee88b[_0x9988('0x4a')]));}headers[_0x9988('0x60')]=getAuth(_0x3c210d);return getUser(_0x3c210d,_0x1bae17[_0x9988('0x4c')])[_0x9988('0x19')](function(_0x2db142){_0x4415e3=_0x2db142;logger[_0x9988('0xa')](_0x9988('0x4d'),_0x4415e3['id']);return getEndUser(_0x3c210d,_0x4ee88b[_0x9988('0x61')],_0x4ee88b['destcalleridnum']);})[_0x9988('0x19')](function(_0x259571){_0xf96d6e=_0x259571;logger[_0x9988('0xa')](_0x9988('0x4f'),_0xf96d6e['id']);return getTicket(_0x3c210d,_0x4415e3,_0xf96d6e,_0x53dbd6,_0x4ee88b);})[_0x9988('0x19')](function(_0x6c267){if(_0x6c267){logger[_0x9988('0xa')](_0x9988('0x50'),_0x6c267['id']);switch(_0x3c210d[_0x9988('0x42')]){case _0x9988('0x62'):logger['info'](_0x9988('0x5f'),_0x9988('0x51'));return request({'uri':util[_0x9988('0xb')](_0x9988('0x63'),_0x3c210d[_0x9988('0xd')],_0x4415e3['id'],_0x6c267['id']),'method':_0x9988('0xe')});case _0x9988('0x52'):logger[_0x9988('0xa')](_0x9988('0x5f'),_0x9988('0x64'));emit(util[_0x9988('0xb')](_0x9988('0x53'),_0x1bae17[_0x9988('0x10')]),_0x9988('0x54'),{'uri':util[_0x9988('0xb')](_0x9988('0x55'),_0x3c210d[_0x9988('0xd')][_0x9988('0x56')](_0x9988('0x57'),''),_0x6c267['id'])});break;default:logger[_0x9988('0x58')](_0x9988('0x5f'),_0x9988('0x59'));}}})[_0x9988('0x5a')](function(_0xa3adfc){logger[_0x9988('0x58')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x9988('0x5c')](_0xa3adfc,{'showHidden':!![],'depth':null}));});};exports[_0x9988('0x65')]=function(_0x42ff05,_0x244099,_0xd1c7dc,_0x11c660,_0x363965,_0x3bf9cf){var _0x284dbe,_0xa78fc5;_0x3bf9cf['remoteUri']=intUtil[_0x9988('0x44')](_0x3bf9cf['remoteUri']);_0x3bf9cf['serverUrl']=intUtil[_0x9988('0x44')](_0x3bf9cf[_0x9988('0x45')]);if(_0x363965&&_0x363965['monitor_format']){logger[_0x9988('0xa')]('['+_0x244099[_0x9988('0x66')][_0x9988('0x67')]()+']',_0x9988('0x48'));_0x244099[_0x9988('0x4b')]=util['format'](_0x9988('0x49'),_0x3bf9cf['serverUrl'],_0x244099[_0x9988('0x4a')],md5(_0x244099[_0x9988('0x4a')]));}else{_0x244099[_0x9988('0x4b')]='';}headers[_0x9988('0x60')]=getAuth(_0x3bf9cf);return getUser(_0x3bf9cf)['then'](function(_0x1a7108){_0x284dbe=_0x1a7108;logger['info'](_0x9988('0x4d'),_0x284dbe['id']);return getEndUser(_0x3bf9cf,_0x244099[_0x9988('0x4e')],_0x244099[_0x9988('0x68')]);})[_0x9988('0x19')](function(_0xbe8693){_0xa78fc5=_0xbe8693;logger[_0x9988('0xa')](_0x9988('0x4f'),_0xa78fc5['id']);return getTicket(_0x3bf9cf,_0x284dbe,_0xa78fc5,_0xd1c7dc,_0x244099);})[_0x9988('0x19')](function(_0x50298b){if(_0x50298b){logger[_0x9988('0xa')](_0x9988('0x50'),_0x50298b['id']);}})['catch'](function(_0x3af9b2){logger[_0x9988('0x58')]('['+_0x244099[_0x9988('0x66')][_0x9988('0x67')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x9988('0x5c')](_0x3af9b2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8edf=['lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','%s/tickets.json','merge','Tags','Subjects','getString','Descriptions','Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','%s/search.json','remoteUri','length','first','Enduser\x20found!','end-user','Caller\x20-\x20%s','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','picklist','type','nameField','customField','includes','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','queue','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','user:%s','%s/agent/tickets/%s','replace','error','catch','inspect','outbound','stripTrailingSlash','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','[OUTBOUND]','trigger:browser:url','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration'];(function(_0xafd93b,_0x121549){var _0x182c05=function(_0x2e640a){while(--_0x2e640a){_0xafd93b['push'](_0xafd93b['shift']());}};_0x182c05(++_0x121549);}(_0x8edf,0xd4));var _0xf8ed=function(_0x362823,_0x5b5d2c){_0x362823=_0x362823-0x0;var _0x52b208=_0x8edf[_0x362823];return _0x52b208;};'use strict';var _=require(_0xf8ed('0x0'));var rp=require('request-promise');var md5=require(_0xf8ed('0x1'));var util=require(_0xf8ed('0x2'));var Redis=require('ioredis');var intUtil=require(_0xf8ed('0x3'));var config=require(_0xf8ed('0x4'));var logger=require(_0xf8ed('0x5'))('zendesk');config[_0xf8ed('0x6')]=_[_0xf8ed('0x7')](config[_0xf8ed('0x6')],{'host':_0xf8ed('0x8'),'port':0x18eb});var io=require(_0xf8ed('0x9'))(new Redis(config['redis']));function emit(_0x27e5ce,_0x21d4d0,_0x52bf03){io['to'](_0x27e5ce)[_0xf8ed('0xa')](_0x21d4d0,_0x52bf03);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x57c1ba,_0x1ede10,_0x54f9cc,_0x150319,_0x2d8148){logger[_0xf8ed('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0xf8ed('0xc'),_0x57c1ba['remoteUri']),'method':'POST','body':{'ticket':_[_0xf8ed('0xd')]({'requester_id':_0x54f9cc['id'],'submitter_id':_0x1ede10?_0x1ede10['id']:undefined,'assignee_id':_0x1ede10?_0x1ede10['id']:undefined,'tags':getTags(_0x150319[_0xf8ed('0xe')],'name'),'subject':intUtil['getString'](_0x150319[_0xf8ed('0xf')],_0x2d8148,'\x20'),'description':intUtil['getString'](_0x150319['Descriptions'],_0x2d8148,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf8ed('0x10')](_0x150319[_0xf8ed('0x11')],_0x2d8148,'\x0a')}},getCustomFields(_0x150319[_0xf8ed('0x12')],_0x2d8148))}})['then'](function(_0x4a3fce){logger['info']('Ticket\x20created!');return _0x4a3fce[_0xf8ed('0x13')];});}function getUser(_0x329f33,_0x5b276f){if(intUtil[_0xf8ed('0x14')](_0x5b276f)){logger[_0xf8ed('0xb')](_0xf8ed('0x15'),_0x5b276f);return request({'uri':util[_0xf8ed('0x16')]('%s/search.json',_0x329f33['remoteUri']),'qs':{'query':util[_0xf8ed('0x16')](_0xf8ed('0x17'),_0x5b276f)}})[_0xf8ed('0x18')](function(_0x357ffa){if(_0x357ffa[_0xf8ed('0x19')]){logger['info'](_0xf8ed('0x1a'));return _[_0xf8ed('0x1b')](_0x357ffa[_0xf8ed('0x1c')],{'email':_0x5b276f,'role':'agent'});}else{logger[_0xf8ed('0xb')](_0xf8ed('0x1d'));return request({'uri':util[_0xf8ed('0x16')]('%s/users/me.json',_0x329f33['remoteUri'])})[_0xf8ed('0x18')](function(_0x508351){logger['info'](_0xf8ed('0x1e'));return _0x508351[_0xf8ed('0x1f')];});}});}else{logger[_0xf8ed('0xb')](_0xf8ed('0x1d'));return request({'uri':util[_0xf8ed('0x16')](_0xf8ed('0x20'),_0x329f33['remoteUri'])})['then'](function(_0x22096a){logger['info']('Admin\x20account\x20selected.');return _0x22096a[_0xf8ed('0x1f')];});}}function getEndUser(_0x5a699b,_0x366b9a,_0x2f828e){logger[_0xf8ed('0xb')]('Searching\x20enduser\x20with\x20phone',_0x2f828e);return request({'uri':util['format'](_0xf8ed('0x21'),_0x5a699b[_0xf8ed('0x22')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2f828e)}})[_0xf8ed('0x18')](function(_0x1ae42){var _0x5959df;if(_0x1ae42[_0xf8ed('0x1c')]['length']){_0x1ae42[_0xf8ed('0x1c')]=_['filter'](_0x1ae42[_0xf8ed('0x1c')],{'suspended':![],'role':'end-user'});if(_0x1ae42[_0xf8ed('0x1c')][_0xf8ed('0x23')]){_0x5959df=_[_0xf8ed('0x24')](_0x1ae42[_0xf8ed('0x1c')]);}}if(_0x5959df){logger['info'](_0xf8ed('0x25'));return _0x5959df;}else{logger[_0xf8ed('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf8ed('0x16')]('%s/users.json',_0x5a699b[_0xf8ed('0x22')]),'method':'POST','body':{'user':{'role':_0xf8ed('0x26'),'name':util['format'](_0xf8ed('0x27'),_0x366b9a||_0x2f828e),'phone':_0x2f828e}}})[_0xf8ed('0x18')](function(_0x4169b4){logger[_0xf8ed('0xb')]('Enduser\x20created.');return _0x4169b4[_0xf8ed('0x1f')];});}});}function getAuth(_0x13b0ee){var _0xf2dd7;if(_0x13b0ee[_0xf8ed('0x28')]===_0xf8ed('0x29')){_0xf2dd7=util[_0xf8ed('0x16')]('%s:%s',_0x13b0ee[_0xf8ed('0x2a')],_0x13b0ee[_0xf8ed('0x29')]);}else if(_0x13b0ee[_0xf8ed('0x28')]===_0xf8ed('0x2b')){_0xf2dd7=util[_0xf8ed('0x16')](_0xf8ed('0x2c'),_0x13b0ee[_0xf8ed('0x2a')],_0x13b0ee[_0xf8ed('0x2b')]);}return util['format'](_0xf8ed('0x2d'),new Buffer(_0xf2dd7)[_0xf8ed('0x2e')](_0xf8ed('0x2f')));}function request(_0x39ca94){logger['debug'](_0xf8ed('0x30'),JSON[_0xf8ed('0x31')](_0x39ca94));return rp(_[_0xf8ed('0x7')](_0x39ca94,{'method':_0xf8ed('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x967896,_0x274ae5){var _0x2d9a66=[];if(_0x967896&&_0x967896['length']>0x0){_0x2d9a66=_[_0xf8ed('0x33')](_0x967896,_0x274ae5);}return _0x2d9a66;}function getCustomFields(_0x19b3f1,_0x9425cd){var _0x4ee264=[];var _0xe7614={'custom_fields':[]};if(_0x19b3f1[_0xf8ed('0x23')]>0x0){_[_0xf8ed('0x34')](_0x19b3f1,function(_0x28334b){if(_['includes'](['string',_0xf8ed('0x35')],_0x28334b[_0xf8ed('0x36')])&&_0x28334b[_0xf8ed('0x37')]&&!_0x28334b[_0xf8ed('0x38')]){_0xe7614[_0x28334b[_0xf8ed('0x37')]['toLowerCase']()]=_0x28334b['content']['toString']();}else if(_[_0xf8ed('0x39')](['string',_0xf8ed('0x35')],_0x28334b[_0xf8ed('0x36')])&&_0x28334b[_0xf8ed('0x3a')]&&_0x28334b[_0xf8ed('0x38')]){_0xe7614[_0xf8ed('0x3b')][_0xf8ed('0x3c')]({'id':_0x28334b[_0xf8ed('0x3a')],'value':_0x28334b[_0xf8ed('0x3d')]['toString']()});}else if(_0x28334b[_0xf8ed('0x36')]===_0xf8ed('0x3e')&&_0x28334b[_0xf8ed('0x3f')]&&_0x28334b[_0xf8ed('0x3a')]&&_0x28334b['customField']){_0x9425cd[_0x28334b[_0xf8ed('0x3f')]]&&_0xe7614[_0xf8ed('0x3b')][_0xf8ed('0x3c')]({'id':_0x28334b[_0xf8ed('0x3a')],'value':_0x9425cd[_0x28334b[_0xf8ed('0x3f')]][_0xf8ed('0x2e')]()});}else if(_0x28334b[_0xf8ed('0x36')]===_0xf8ed('0x40')&&_0x28334b[_0xf8ed('0x41')]&&_0x28334b['Variable'][_0xf8ed('0x42')]&&_0x28334b[_0xf8ed('0x3a')]&&_0x28334b[_0xf8ed('0x38')]){_0x9425cd[_0x28334b[_0xf8ed('0x41')]['name'][_0xf8ed('0x43')]()]&&_0xe7614[_0xf8ed('0x3b')][_0xf8ed('0x3c')]({'id':_0x28334b[_0xf8ed('0x3a')],'value':_0x9425cd[_0x28334b[_0xf8ed('0x41')][_0xf8ed('0x42')]['toLowerCase']()]['toString']()});}});}return _0xe7614;}exports[_0xf8ed('0x44')]=function(_0x243c70,_0x98ab3a,_0x3b6baa,_0x13f0c9,_0x106edc,_0x485839){var _0x233319,_0x52bbf2;_0x485839['remoteUri']=intUtil['stripTrailingSlash'](_0x485839[_0xf8ed('0x22')]);_0x485839[_0xf8ed('0x45')]=intUtil['stripTrailingSlash'](_0x485839[_0xf8ed('0x45')]);if(_0x106edc&&_0x106edc[_0xf8ed('0x46')]){logger[_0xf8ed('0xb')](_0xf8ed('0x47'),'Recording\x20is\x20enabled!');_0x98ab3a[_0xf8ed('0x48')]=util[_0xf8ed('0x16')](_0xf8ed('0x49'),_0x485839['serverUrl'],_0x98ab3a[_0xf8ed('0x4a')],md5(_0x98ab3a['uniqueid']));}else{_0x98ab3a[_0xf8ed('0x48')]='';}headers[_0xf8ed('0x4b')]=getAuth(_0x485839);return getUser(_0x485839,_0x13f0c9[_0xf8ed('0x4c')])[_0xf8ed('0x18')](function(_0x2ed385){_0x233319=_0x2ed385;logger[_0xf8ed('0xb')](_0xf8ed('0x4d'),_0x233319['id']);return getEndUser(_0x485839,_0x98ab3a[_0xf8ed('0x4e')],_0x98ab3a[_0xf8ed('0x4f')]);})[_0xf8ed('0x18')](function(_0x584f3a){_0x52bbf2=_0x584f3a;logger[_0xf8ed('0xb')](_0xf8ed('0x50'),_0x52bbf2['id']);return getTicket(_0x485839,_0x233319,_0x52bbf2,_0x3b6baa,_0x98ab3a);})[_0xf8ed('0x18')](function(_0xc5d33){if(_0xc5d33){logger[_0xf8ed('0xb')](_0xf8ed('0x51'),_0xc5d33['id']);switch(_0x485839[_0xf8ed('0x36')]){case _0xf8ed('0x52'):logger['info']('[QUEUE]',_0xf8ed('0x53'));return request({'uri':util[_0xf8ed('0x16')](_0xf8ed('0x54'),_0x485839['remoteUri'],_0x233319['id'],_0xc5d33['id']),'method':_0xf8ed('0x55')});case _0xf8ed('0x56'):logger[_0xf8ed('0xb')](_0xf8ed('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf8ed('0x16')](_0xf8ed('0x57'),_0x13f0c9['name']),'trigger:browser:url',{'uri':util[_0xf8ed('0x16')](_0xf8ed('0x58'),_0x485839['remoteUri'][_0xf8ed('0x59')]('/api/v2',''),_0xc5d33['id'])});break;default:logger[_0xf8ed('0x5a')](_0xf8ed('0x47'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xf8ed('0x5b')](function(_0xf6a6e0){logger[_0xf8ed('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xf8ed('0x5c')](_0xf6a6e0,{'showHidden':!![],'depth':null}));});};exports[_0xf8ed('0x5d')]=function(_0x2b7f53,_0x3cd5f5,_0x63f9e7,_0x3a63fc,_0x514af9,_0xb78ed2,_0x21b74a){var _0x30d4b9,_0x1bb7ba;_0xb78ed2['remoteUri']=intUtil[_0xf8ed('0x5e')](_0xb78ed2[_0xf8ed('0x22')]);_0xb78ed2[_0xf8ed('0x45')]=intUtil[_0xf8ed('0x5e')](_0xb78ed2['serverUrl']);if(_0x21b74a&&_0x21b74a[_0xf8ed('0x5f')]&&_0x21b74a[_0xf8ed('0x5f')]!=='none'){logger[_0xf8ed('0xb')]('[OUTBOUND]',_0xf8ed('0x60'));_0x3cd5f5['recordingURL']=util['format'](_0xf8ed('0x49'),_0xb78ed2[_0xf8ed('0x45')],_0x3cd5f5[_0xf8ed('0x4a')],md5(_0x3cd5f5[_0xf8ed('0x4a')]));}headers['Authorization']=getAuth(_0xb78ed2);return getUser(_0xb78ed2,_0x3a63fc[_0xf8ed('0x4c')])[_0xf8ed('0x18')](function(_0x24c391){_0x30d4b9=_0x24c391;logger[_0xf8ed('0xb')]('The\x20User\x20ID\x20is:',_0x30d4b9['id']);return getEndUser(_0xb78ed2,_0x3cd5f5[_0xf8ed('0x61')],_0x3cd5f5['destcalleridnum']);})[_0xf8ed('0x18')](function(_0x84bb5f){_0x1bb7ba=_0x84bb5f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1bb7ba['id']);return getTicket(_0xb78ed2,_0x30d4b9,_0x1bb7ba,_0x63f9e7,_0x3cd5f5);})[_0xf8ed('0x18')](function(_0x36f406){if(_0x36f406){logger[_0xf8ed('0xb')]('The\x20Ticket\x20ID\x20is:',_0x36f406['id']);switch(_0xb78ed2['type']){case _0xf8ed('0x52'):logger[_0xf8ed('0xb')](_0xf8ed('0x62'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xf8ed('0x16')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xb78ed2[_0xf8ed('0x22')],_0x30d4b9['id'],_0x36f406['id']),'method':'POST'});case _0xf8ed('0x56'):logger[_0xf8ed('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf8ed('0x16')](_0xf8ed('0x57'),_0x3a63fc['name']),_0xf8ed('0x63'),{'uri':util[_0xf8ed('0x16')](_0xf8ed('0x58'),_0xb78ed2['remoteUri'][_0xf8ed('0x59')](_0xf8ed('0x64'),''),_0x36f406['id'])});break;default:logger[_0xf8ed('0x5a')]('[OUTBOUND]',_0xf8ed('0x65'));}}})['catch'](function(_0x1a31ed){logger[_0xf8ed('0x5a')](_0xf8ed('0x66'),util['inspect'](_0x1a31ed,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1f06e9,_0x51da97,_0x32d6bf,_0x2242df,_0x48cdd9,_0x5141e6){var _0x121f25,_0x4f4d35;_0x5141e6[_0xf8ed('0x22')]=intUtil['stripTrailingSlash'](_0x5141e6[_0xf8ed('0x22')]);_0x5141e6['serverUrl']=intUtil[_0xf8ed('0x5e')](_0x5141e6[_0xf8ed('0x45')]);if(_0x48cdd9&&_0x48cdd9[_0xf8ed('0x46')]){logger[_0xf8ed('0xb')]('['+_0x51da97[_0xf8ed('0x67')]['toUpperCase']()+']',_0xf8ed('0x60'));_0x51da97['recordingURL']=util[_0xf8ed('0x16')](_0xf8ed('0x49'),_0x5141e6[_0xf8ed('0x45')],_0x51da97[_0xf8ed('0x4a')],md5(_0x51da97[_0xf8ed('0x4a')]));}else{_0x51da97['recordingURL']='';}headers[_0xf8ed('0x4b')]=getAuth(_0x5141e6);return getUser(_0x5141e6)[_0xf8ed('0x18')](function(_0x504d80){_0x121f25=_0x504d80;logger['info'](_0xf8ed('0x4d'),_0x121f25['id']);return getEndUser(_0x5141e6,_0x51da97[_0xf8ed('0x4e')],_0x51da97[_0xf8ed('0x4f')]);})['then'](function(_0x5f0ee7){_0x4f4d35=_0x5f0ee7;logger[_0xf8ed('0xb')](_0xf8ed('0x50'),_0x4f4d35['id']);return getTicket(_0x5141e6,_0x121f25,_0x4f4d35,_0x32d6bf,_0x51da97);})[_0xf8ed('0x18')](function(_0x85f7be){if(_0x85f7be){logger[_0xf8ed('0xb')](_0xf8ed('0x51'),_0x85f7be['id']);}})[_0xf8ed('0x5b')](function(_0x2aee81){logger[_0xf8ed('0x5a')]('['+_0x51da97[_0xf8ed('0x67')][_0xf8ed('0x68')]()+']'+_0xf8ed('0x69'),util[_0xf8ed('0x5c')](_0x2aee81,{'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 2f90ec8..834964e 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 _0x2f13=['complete','connect','Answered','rejected','abandoned','timeout','Timeout','starttime','agentcalledAt','Inbound','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','POST','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','startCase','log','GET','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result'];(function(_0x102bd0,_0x24a0d5){var _0x4d1c30=function(_0x22af4a){while(--_0x22af4a){_0x102bd0['push'](_0x102bd0['shift']());}};_0x4d1c30(++_0x24a0d5);}(_0x2f13,0x1f0));var _0x32f1=function(_0x341d27,_0x1072e1){_0x341d27=_0x341d27-0x0;var _0x3cba50=_0x2f13[_0x341d27];return _0x3cba50;};'use strict';var _=require(_0x32f1('0x0'));var rp=require(_0x32f1('0x1'));var md5=require(_0x32f1('0x2'));var util=require(_0x32f1('0x3'));var intUtil=require(_0x32f1('0x4'));var moment=require('moment');var Redis=require(_0x32f1('0x5'));var BPromise=require(_0x32f1('0x6'));var config=require('../../../../config/environment');var logger=require(_0x32f1('0x7'))(_0x32f1('0x8'));config[_0x32f1('0x9')]=_[_0x32f1('0xa')](config[_0x32f1('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x32f1('0xb'))(new Redis(config['redis']));function emit(_0xf8e80a,_0x5e065b,_0xc2dde8){io['to'](_0xf8e80a)[_0x32f1('0xc')](_0x5e065b,_0xc2dde8);}function request(_0x522c29){logger[_0x32f1('0xd')](_0x32f1('0xe'),JSON[_0x32f1('0xf')](_0x522c29));return rp(_0x522c29);}function getCustomFields(_0x3d2a6b,_0x528e63){var _0x157742={};if(_0x3d2a6b[_0x32f1('0x10')]>0x0){_[_0x32f1('0x11')](_0x3d2a6b,function(_0x2cc71e){if(_['includes'](['string',_0x32f1('0x12')],_0x2cc71e[_0x32f1('0x13')])&&_0x2cc71e[_0x32f1('0x14')]){_0x157742[_0x2cc71e[_0x32f1('0x14')]]=_0x2cc71e[_0x32f1('0x15')][_0x32f1('0x16')]();}else if(_0x2cc71e[_0x32f1('0x13')]===_0x32f1('0x17')&&_0x2cc71e[_0x32f1('0x18')]&&_0x2cc71e[_0x32f1('0x14')]&&_0x528e63[_0x2cc71e['variableName']]){_0x157742[_0x2cc71e[_0x32f1('0x14')]]=_0x528e63[_0x2cc71e['variableName']][_0x32f1('0x16')]();}else if(_0x2cc71e['type']===_0x32f1('0x19')&&_0x2cc71e[_0x32f1('0x1a')]&&_0x2cc71e[_0x32f1('0x1a')][_0x32f1('0x1b')]&&_0x2cc71e[_0x32f1('0x14')]&&_0x528e63[_0x2cc71e[_0x32f1('0x1a')][_0x32f1('0x1b')][_0x32f1('0x1c')]()]){_0x157742[_0x2cc71e[_0x32f1('0x14')]]=_0x528e63[_0x2cc71e['Variable'][_0x32f1('0x1b')][_0x32f1('0x1c')]()][_0x32f1('0x16')]();}});}return _0x157742;}function getName(_0x4c5fe9){if(_0x4c5fe9['indexOf']('\x20')>0x0){var _0x234c6c=_0x4c5fe9[_0x32f1('0x1d')](/ (.+)/);if(_0x234c6c[0x1]){return _0x234c6c;}}return[_0x4c5fe9,_0x4c5fe9];}var accountsTokens={};function getAccessToken(_0x4ab5e0){return new Promise(function(_0x15071e,_0x35486c){if(!_[_0x32f1('0x1e')](accountsTokens[_0x4ab5e0['id']])&&!_[_0x32f1('0x1e')](accountsTokens[_0x4ab5e0['id']][_0x32f1('0x1f')])){if(moment()[_0x32f1('0x20')](accountsTokens[_0x4ab5e0['id']]['expires_in'])){_0x15071e(accountsTokens[_0x4ab5e0['id']][_0x32f1('0x1f')]);}}var _0x20f3f0;switch(_0x4ab5e0['zone']){case'US':_0x20f3f0=_0x32f1('0x21');break;case'AU':_0x20f3f0=_0x32f1('0x22');break;case'EU':_0x20f3f0=_0x32f1('0x23');break;case'IN':_0x20f3f0=_0x32f1('0x24');break;case'CN':_0x20f3f0=_0x32f1('0x25');break;default:_0x20f3f0=_0x32f1('0x23');break;}var _0x509254={'method':'POST','uri':_0x20f3f0+_0x32f1('0x26'),'qs':{'refresh_token':_0x4ab5e0[_0x32f1('0x27')],'client_id':_0x4ab5e0[_0x32f1('0x28')],'client_secret':_0x4ab5e0[_0x32f1('0x29')],'grant_type':_0x32f1('0x2a')},'json':!![]};return rp(_0x509254)[_0x32f1('0x2b')](function(_0x36e801){accountsTokens[_0x4ab5e0['id']]={'access_token':_0x36e801['access_token'],'expires_in':moment()['add'](_0x36e801[_0x32f1('0x2c')],_0x32f1('0x2d'))};_0x15071e(_0x36e801['access_token']);})[_0x32f1('0x2e')](function(_0x2715fa){logger[_0x32f1('0x2f')](_0x32f1('0x30'),_0x2715fa['stack']);_0x35486c(_0x2715fa);});});}function getUser(_0xd6c1b9,_0x1f8523,_0x2f0fa0,_0x3aebda){logger['info']('Search\x20user');return request({'method':'GET','uri':util[_0x32f1('0x31')](_0x32f1('0x32'),_0x1f8523),'qs':{'type':_0x32f1('0x33')},'headers':{'Authorization':_0x32f1('0x34')+_0xd6c1b9},'json':!![]})['then'](function(_0x3b9f15){if(_0x3b9f15[_0x32f1('0x35')]){var _0x469196=-0x1;if(_[_0x32f1('0x36')](_0x3b9f15[_0x32f1('0x35')])){if(!_[_0x32f1('0x1e')](_0x3aebda)){_0x469196=_['findIndex'](_0x3b9f15[_0x32f1('0x35')],function(_0x56eb83){return _0x56eb83[_0x32f1('0x37')]===_0x3aebda;});}if(_0x469196>=0x0){logger[_0x32f1('0x38')](_0x32f1('0x39'));}else{logger['info'](_0x32f1('0x3a'));_0x469196=_[_0x32f1('0x3b')](_0x3b9f15[_0x32f1('0x35')],function(_0x502a7f){return _0x502a7f[_0x32f1('0x3c')]['name']===_0x32f1('0x3d');});}return _0x3b9f15[_0x32f1('0x35')][_0x469196];}else{if(_0x3b9f15[_0x32f1('0x3e')][_0x32f1('0x3c')][_0x32f1('0x1b')]===_0x32f1('0x3d')){logger[_0x32f1('0x38')]('Using\x20the\x20admin\x20account!');user=_0x3b9f15[_0x32f1('0x3e')];return user;}else{logger[_0x32f1('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x32f1('0xf')](_0x3b9f15));throw new Error(_0x32f1('0x3f')+JSON['stringify'](_0x3b9f15));}}}else{logger[_0x32f1('0x2f')](_0x32f1('0x40'),JSON[_0x32f1('0xf')](_0x3b9f15));throw new Error(_0x32f1('0x3f')+JSON[_0x32f1('0xf')](_0x3b9f15));}})[_0x32f1('0x2e')](function(_0x340f97){console[_0x32f1('0x2f')](_0x340f97);});}function getZohoUser(_0x29f331,_0xb5e20a){return new BPromise(function(_0x537589,_0x3a53b1){request(_0x29f331)[_0x32f1('0x2b')](function(_0x493f41){var _0x2f0155=null;if(_0x493f41){_0x2f0155=_0x493f41['data'][0x0];_0x2f0155[_0x32f1('0x41')]=_0xb5e20a;}_0x537589(_0x2f0155);})[_0x32f1('0x2e')](function(_0x470d78){_0x3a53b1(_0x470d78);});});}function createEndUser(_0x1ba019,_0x25edd8,_0x17172b,_0x37ac32,_0x216bcd,_0x89838a){var _0x17172b=getName(_0x17172b);return request({'method':_0x32f1('0x42'),'uri':'https://www.zohoapis.'+_0x25edd8+'/crm/v2/'+_['startCase'](_0x89838a[_0x32f1('0x43')])+'s','body':{'data':[{'Last_Name':_0x17172b[0x1],'First_Name':_0x17172b[0x0],'Phone':_0x37ac32,'Owner':{'name':!_['isNil'](_0x216bcd[_0x32f1('0x44')][_0x32f1('0x1b')])?_0x216bcd[_0x32f1('0x44')][_0x32f1('0x1b')]:!_[_0x32f1('0x1e')](_0x216bcd[_0x32f1('0x45')])?_0x216bcd[_0x32f1('0x45')]+'\x20'+_0x216bcd[_0x32f1('0x46')]:_0x216bcd[_0x32f1('0x46')],'id':_0x216bcd['id']}}]},'headers':{'Authorization':_0x32f1('0x34')+_0x1ba019},'json':!![]})['then'](function(_0x4351c4){if(_0x4351c4&&_0x4351c4[_0x32f1('0x47')][0x0][_0x32f1('0x48')]===_0x32f1('0x49')){var _0x2b15c2=_0x4351c4[_0x32f1('0x47')][0x0][_0x32f1('0x4a')];_0x2b15c2['enduserType']=_[_0x32f1('0x4b')](_0x89838a[_0x32f1('0x43')])+'s';return _0x2b15c2;}logger[_0x32f1('0x2f')](_0x32f1('0x40'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x32f1('0x2e')](function(_0x1d9644){console[_0x32f1('0x4c')]('CREATE\x20ERROR',_0x1d9644);});}function getEndUser(_0x505480,_0xd6f491,_0x23246d,_0x4c8bf7,_0x20aeab,_0x39c6b6,_0x966fac){var _0x2bd831={'method':_0x32f1('0x4d'),'uri':'','headers':{'Authorization':_0x32f1('0x34')+_0x505480},'json':!![]};switch(_0x966fac['moduleSearch']){case _0x32f1('0x4e'):_0x2bd831[_0x32f1('0x4f')]='https://www.zohoapis.'+_0xd6f491+_0x32f1('0x50')+_0x20aeab+'))';return getZohoUser(_0x2bd831,'Contacts')[_0x32f1('0x2b')](function(_0x5390f1){if(_0x5390f1)return _0x5390f1;_0x2bd831['uri']=_0x32f1('0x51')+_0xd6f491+_0x32f1('0x52')+_0x20aeab+'))';return getZohoUser(_0x2bd831,_0x32f1('0x53'))[_0x32f1('0x2b')](function(_0x198caf){if(_0x198caf)return _0x198caf;if(_0x966fac[_0x32f1('0x43')]!='nothing'){return createEndUser(_0x505480,_0xd6f491,_0x4c8bf7,_0x20aeab,_0x39c6b6,_0x966fac);}else{return{};}});});break;case _0x32f1('0x54'):_0x2bd831['uri']=_0x32f1('0x51')+_0xd6f491+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x20aeab+'))';return getZohoUser(_0x2bd831,_0x32f1('0x55'))[_0x32f1('0x2b')](function(_0x3be1ee){if(_0x3be1ee)return _0x3be1ee;if(_0x966fac['moduleCreate']!='nothing'){return createEndUser(_0x505480,_0xd6f491,_0x4c8bf7,_0x20aeab,_0x39c6b6,_0x966fac);}else{return{};}});break;case _0x32f1('0x56'):_0x2bd831[_0x32f1('0x4f')]=_0x32f1('0x51')+_0xd6f491+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x20aeab+'))';return getZohoUser(_0x2bd831,_0x32f1('0x53'))[_0x32f1('0x2b')](function(_0x4a8858){if(_0x4a8858)return _0x4a8858;if(_0x966fac[_0x32f1('0x43')]!='nothing'){return createEndUser(_0x505480,_0xd6f491,_0x4c8bf7,_0x20aeab,_0x39c6b6,_0x966fac);}else{return{};}});break;}}function getCall(_0x79c628,_0x3c9423,_0x583f01,_0x4884e2,_0x24ef38,_0x326d22,_0x4daade,_0x47783f){logger[_0x32f1('0x38')](_0x32f1('0x57'));var _0x2a87a3={};_0x2a87a3[_0x32f1('0x58')]={'name':!_['isNil'](_0x4884e2[_0x32f1('0x44')][_0x32f1('0x1b')])&&!_[_0x32f1('0x1e')](_0x4884e2[_0x32f1('0x3c')]['name'])&&_0x4884e2[_0x32f1('0x3c')][_0x32f1('0x1b')]===_0x32f1('0x59')?_0x4884e2[_0x32f1('0x44')][_0x32f1('0x1b')]:!_[_0x32f1('0x1e')](_0x4884e2[_0x32f1('0x45')])?_0x4884e2[_0x32f1('0x45')]+'\x20'+_0x4884e2['last_name']:_0x4884e2[_0x32f1('0x46')],'id':_0x4884e2['id']};_0x2a87a3[_0x32f1('0x5a')]=intUtil['getString'](_0x326d22[_0x32f1('0x5b')],_0x4daade,'\x20');_0x2a87a3[_0x32f1('0x5c')]=intUtil[_0x32f1('0x5d')](_0x326d22[_0x32f1('0x5e')],_0x4daade,'\x0a');if(_0x24ef38[_0x32f1('0x41')]===_0x32f1('0x55')){_0x2a87a3[_0x32f1('0x5f')]={'name':!_['isNil'](_0x24ef38[_0x32f1('0x60')])?_0x24ef38[_0x32f1('0x60')]:!_[_0x32f1('0x1e')](_0x24ef38[_0x32f1('0x61')])?_0x24ef38[_0x32f1('0x61')]+'\x20'+_0x24ef38[_0x32f1('0x62')]:_0x24ef38[_0x32f1('0x62')],'id':_0x24ef38['id']};}if(_0x24ef38['enduserType']===_0x32f1('0x53')){_0x2a87a3[_0x32f1('0x63')]={'name':!_['isNil'](_0x24ef38[_0x32f1('0x60')])?_0x24ef38[_0x32f1('0x60')]:!_[_0x32f1('0x1e')](_0x24ef38[_0x32f1('0x61')])?_0x24ef38[_0x32f1('0x61')]+'\x20'+_0x24ef38[_0x32f1('0x62')]:_0x24ef38['Last_Name'],'id':_0x24ef38['id']};_0x2a87a3[_0x32f1('0x64')]=_[_0x32f1('0x4b')](_0x24ef38['enduserType']);}if(_0x4daade['talktime']){_0x2a87a3[_0x32f1('0x65')]=moment[_0x32f1('0x66')](parseInt(_0x4daade[_0x32f1('0x67')])*0x3e8)['format'](_0x32f1('0x68'));}else if(_0x4daade[_0x32f1('0x69')]&&_0x4daade[_0x32f1('0x6a')]){_0x2a87a3['Call_Duration']=moment[_0x32f1('0x66')](moment(_0x4daade[_0x32f1('0x6a')],'YYYY-MM-DDTHH:mm:ss')[_0x32f1('0x6b')](moment(_0x4daade['starttime'],_0x32f1('0x6c'))))[_0x32f1('0x31')]('mm:ss');}switch(_0x4daade[_0x32f1('0x6d')]){case _0x32f1('0x6e'):_0x2a87a3[_0x32f1('0x6f')]='Called';break;case _0x32f1('0x70'):case _0x32f1('0x71'):_0x2a87a3[_0x32f1('0x6f')]=_0x32f1('0x72');break;case _0x32f1('0x73'):_0x2a87a3[_0x32f1('0x6f')]='Rejected';break;case _0x32f1('0x74'):_0x2a87a3['Call_Result']='Abandoned';break;case _0x32f1('0x75'):_0x2a87a3[_0x32f1('0x6f')]=_0x32f1('0x76');default:}_0x2a87a3['Call_Start_Time']=(_0x47783f==='outbound'?moment(_0x4daade[_0x32f1('0x77')])['format'](_0x32f1('0x6c')):moment(_0x4daade[_0x32f1('0x78')])[_0x32f1('0x31')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x32f1('0x31')](_0x32f1('0x6c'));_0x2a87a3['Call_Type']=_0x47783f||_0x32f1('0x79');_0x2a87a3=_['merge'](_0x2a87a3,getCustomFields(_0x326d22['Fields'],_0x4daade));return request({'method':_0x32f1('0x42'),'uri':_0x32f1('0x51')+_0x3c9423+_0x32f1('0x7a'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x79c628},'body':{'data':[_0x2a87a3]},'json':!![]})[_0x32f1('0x2b')](function(_0xd17ef0){if(_0xd17ef0&&_0xd17ef0[_0x32f1('0x47')][0x0]['code']==='SUCCESS'){logger['info']('Call\x20created!');return{'id':_0xd17ef0[_0x32f1('0x47')][0x0]['details']['id']};}})[_0x32f1('0x2e')](function(_0x275429){logger['info'](_0x32f1('0x7b'),_0x275429['stack']);console['log']('err',_0x275429);});}exports[_0x32f1('0x7c')]=function(_0x36294b,_0x410a26,_0x24e8d2,_0x462f78,_0x56d0b7,_0x2a5142){var _0x54427e,_0x3558df,_0x28981b;_0x2a5142[_0x32f1('0x7d')]=intUtil[_0x32f1('0x7e')](_0x2a5142[_0x32f1('0x7d')]);_0x2a5142[_0x32f1('0x7f')]=intUtil[_0x32f1('0x7e')](_0x2a5142['serverUrl']);if(_0x56d0b7&&_0x56d0b7[_0x32f1('0x80')]){logger[_0x32f1('0x38')]('[QUEUE]',_0x32f1('0x81'));_0x410a26[_0x32f1('0x82')]=_0x2a5142[_0x32f1('0x7f')]+_0x32f1('0x83')+_0x410a26[_0x32f1('0x84')]+_0x32f1('0x85')+md5(_0x410a26[_0x32f1('0x84')]);}else{_0x410a26[_0x32f1('0x82')]='';}var _0xc15cca=_0x2a5142['host']===_0x32f1('0x86')?'eu':_0x32f1('0x87');return getAccessToken(_0x2a5142)[_0x32f1('0x2b')](function(_0x21a2bb){_0x28981b=_0x21a2bb;return getUser(_0x28981b,_0xc15cca,_0x2a5142,_0x462f78['email']);})['then'](function(_0x10f756){_0x54427e=_0x10f756;logger[_0x32f1('0x38')](_0x32f1('0x88'),_0x54427e['id']);return getEndUser(_0x28981b,_0xc15cca,_0x2a5142,_0x410a26[_0x32f1('0x89')],_0x410a26[_0x32f1('0x8a')],_0x54427e,_0x24e8d2);})['then'](function(_0x591c89){_0x3558df=_0x591c89;return getCall(_0x28981b,_0xc15cca,_0x2a5142,_0x54427e,_0x3558df,_0x24e8d2,_0x410a26,_0x32f1('0x79'));})[_0x32f1('0x2b')](function(_0x47a82e){if(_0x47a82e){logger['info'](_0x32f1('0x8b'),_0x47a82e['id']);logger[_0x32f1('0x38')](_0x32f1('0x8c'),_0x32f1('0x8d'));emit(util[_0x32f1('0x31')](_0x32f1('0x8e'),_0x462f78[_0x32f1('0x1b')]),_0x32f1('0x8f'),{'uri':_0x32f1('0x90')+_0x2a5142[_0x32f1('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x47a82e['id']});}})[_0x32f1('0x2e')](function(_0x17a498){logger['error']('[QUEUE]',JSON[_0x32f1('0xf')](_0x17a498));});};exports[_0x32f1('0x91')]=function(_0x4248d5,_0x5e87df,_0x2e8569,_0x590c14,_0x43a08f,_0x24be5d,_0x504b47){var _0x1c3e33,_0x453938,_0x425cc3;_0x24be5d[_0x32f1('0x7d')]=intUtil['stripTrailingSlash'](_0x24be5d[_0x32f1('0x7d')]);_0x24be5d[_0x32f1('0x7f')]=intUtil[_0x32f1('0x7e')](_0x24be5d['serverUrl']);if(_0x504b47&&_0x504b47[_0x32f1('0x92')]&&_0x504b47[_0x32f1('0x92')]!=='none'){logger[_0x32f1('0x38')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5e87df[_0x32f1('0x82')]=_0x24be5d['serverUrl']+_0x32f1('0x83')+_0x5e87df['uniqueid']+_0x32f1('0x85')+md5(_0x5e87df[_0x32f1('0x84')]);}var _0x1ae430=_0x24be5d[_0x32f1('0x7d')]===_0x32f1('0x86')?'eu':_0x32f1('0x87');return getAccessToken(_0x24be5d)[_0x32f1('0x2b')](function(_0x224820){_0x425cc3=_0x224820;return getUser(_0x425cc3,_0x1ae430,_0x24be5d,_0x590c14[_0x32f1('0x37')]);})['then'](function(_0x22a217){_0x1c3e33=_0x22a217;logger[_0x32f1('0x38')](_0x32f1('0x88'),_0x1c3e33['id']);return getEndUser(_0x425cc3,_0x1ae430,_0x24be5d,_0x5e87df[_0x32f1('0x93')],_0x5e87df[_0x32f1('0x94')],_0x1c3e33,_0x2e8569);})[_0x32f1('0x2b')](function(_0x3e843e){_0x453938=_0x3e843e;return getCall(_0x425cc3,_0x1ae430,_0x24be5d,_0x1c3e33,_0x453938,_0x2e8569,_0x5e87df,'Outbound');})['then'](function(_0x450561){if(_0x450561){logger[_0x32f1('0x38')](_0x32f1('0x8b'),_0x450561['id']);logger['info'](_0x32f1('0x95'),_0x32f1('0x8d'));emit(util[_0x32f1('0x31')](_0x32f1('0x8e'),_0x590c14[_0x32f1('0x1b')]),_0x32f1('0x8f'),{'uri':_0x32f1('0x90')+_0x24be5d[_0x32f1('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x450561['id']});}})['catch'](function(_0x32ab19){logger[_0x32f1('0x2f')](_0x32f1('0x95'),JSON['stringify'](_0x32ab19));});};exports[_0x32f1('0x96')]=function(_0x450d3f,_0x250905,_0x3339cd,_0x28e78a,_0x1e44a4,_0x467a55){var _0x24529f,_0x38747f,_0x58ef86;_0x467a55[_0x32f1('0x7d')]=intUtil[_0x32f1('0x7e')](_0x467a55[_0x32f1('0x7d')]);_0x467a55['serverUrl']=intUtil[_0x32f1('0x7e')](_0x467a55[_0x32f1('0x7f')]);if(_0x1e44a4&&_0x1e44a4['monitor_format']){logger['info']('['+_0x250905[_0x32f1('0x6d')][_0x32f1('0x97')]()+']','Recording\x20is\x20enabled!');_0x250905[_0x32f1('0x82')]=_0x467a55[_0x32f1('0x7f')]+_0x32f1('0x83')+_0x250905[_0x32f1('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x250905[_0x32f1('0x84')]);}else{_0x250905[_0x32f1('0x82')]='';}var _0x1529ed=_0x467a55[_0x32f1('0x7d')]===_0x32f1('0x86')?'eu':_0x32f1('0x87');return getAccessToken(_0x467a55)['then'](function(_0x307f13){_0x58ef86=_0x307f13;return getUser(_0x58ef86,_0x1529ed,_0x467a55);})[_0x32f1('0x2b')](function(_0x1d87d3){_0x24529f=_0x1d87d3;logger[_0x32f1('0x38')](_0x32f1('0x88'),_0x24529f['id']);return getEndUser(_0x58ef86,_0x1529ed,_0x467a55,_0x250905[_0x32f1('0x89')],_0x250905['calleridnum'],_0x24529f,_0x3339cd);})[_0x32f1('0x2b')](function(_0x609f0a){_0x38747f=_0x609f0a;return getCall(_0x58ef86,_0x1529ed,_0x467a55,_0x24529f,_0x38747f,_0x3339cd,_0x250905,_0x32f1('0x79'));})[_0x32f1('0x2b')](function(_0x1b95c8){if(_0x1b95c8){logger[_0x32f1('0x38')](_0x32f1('0x8b'),_0x1b95c8['id']);}})[_0x32f1('0x2e')](function(_0x3b5b2c){logger[_0x32f1('0x2f')]('['+_0x250905[_0x32f1('0x6d')][_0x32f1('0x97')]()+']',JSON[_0x32f1('0xf')](_0x3b5b2c));});}; \ No newline at end of file +var _0xecf0=['toString','variableName','type','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','clientId','clientSecret','refresh_token','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','info','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','The\x20failing\x20result\x20is','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','Called','complete','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','data','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','com','The\x20User\x20ID\x20is:','destcalleridnum','user:%s','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField'];(function(_0x2f7425,_0x3a5571){var _0x3025db=function(_0x23c187){while(--_0x23c187){_0x2f7425['push'](_0x2f7425['shift']());}};_0x3025db(++_0x3a5571);}(_0xecf0,0x84));var _0x0ecf=function(_0x12ec50,_0x5c868a){_0x12ec50=_0x12ec50-0x0;var _0x32dd5e=_0xecf0[_0x12ec50];return _0x32dd5e;};'use strict';var _=require(_0x0ecf('0x0'));var rp=require(_0x0ecf('0x1'));var md5=require(_0x0ecf('0x2'));var util=require(_0x0ecf('0x3'));var intUtil=require('./util');var moment=require(_0x0ecf('0x4'));var Redis=require(_0x0ecf('0x5'));var BPromise=require(_0x0ecf('0x6'));var config=require(_0x0ecf('0x7'));var logger=require(_0x0ecf('0x8'))(_0x0ecf('0x9'));config[_0x0ecf('0xa')]=_[_0x0ecf('0xb')](config['redis'],{'host':_0x0ecf('0xc'),'port':0x18eb});var io=require(_0x0ecf('0xd'))(new Redis(config['redis']));function emit(_0x591064,_0x3ee443,_0x31916f){io['to'](_0x591064)[_0x0ecf('0xe')](_0x3ee443,_0x31916f);}function request(_0x3dd280){logger[_0x0ecf('0xf')](_0x0ecf('0x10'),JSON[_0x0ecf('0x11')](_0x3dd280));return rp(_0x3dd280);}function getCustomFields(_0x98f9ca,_0x5d4d75){var _0x2947c6={};if(_0x98f9ca[_0x0ecf('0x12')]>0x0){_[_0x0ecf('0x13')](_0x98f9ca,function(_0x34d63c){if(_[_0x0ecf('0x14')]([_0x0ecf('0x15'),_0x0ecf('0x16')],_0x34d63c['type'])&&_0x34d63c[_0x0ecf('0x17')]){_0x2947c6[_0x34d63c[_0x0ecf('0x17')]]=_0x34d63c['content'][_0x0ecf('0x18')]();}else if(_0x34d63c['type']==='variable'&&_0x34d63c[_0x0ecf('0x19')]&&_0x34d63c[_0x0ecf('0x17')]&&_0x5d4d75[_0x34d63c[_0x0ecf('0x19')]]){_0x2947c6[_0x34d63c[_0x0ecf('0x17')]]=_0x5d4d75[_0x34d63c[_0x0ecf('0x19')]]['toString']();}else if(_0x34d63c[_0x0ecf('0x1a')]==='customVariable'&&_0x34d63c[_0x0ecf('0x1b')]&&_0x34d63c[_0x0ecf('0x1b')][_0x0ecf('0x1c')]&&_0x34d63c[_0x0ecf('0x17')]&&_0x5d4d75[_0x34d63c[_0x0ecf('0x1b')][_0x0ecf('0x1c')][_0x0ecf('0x1d')]()]){_0x2947c6[_0x34d63c['idField']]=_0x5d4d75[_0x34d63c[_0x0ecf('0x1b')]['name'][_0x0ecf('0x1d')]()][_0x0ecf('0x18')]();}});}return _0x2947c6;}function getName(_0x4dd7d6){if(_0x4dd7d6[_0x0ecf('0x1e')]('\x20')>0x0){var _0x54d4ed=_0x4dd7d6['split'](/ (.+)/);if(_0x54d4ed[0x1]){return _0x54d4ed;}}return[_0x4dd7d6,_0x4dd7d6];}var accountsTokens={};function getAccessToken(_0x5b079){return new Promise(function(_0x4982dd,_0x348e46){if(!_[_0x0ecf('0x1f')](accountsTokens[_0x5b079['id']])&&!_[_0x0ecf('0x1f')](accountsTokens[_0x5b079['id']][_0x0ecf('0x20')])){if(moment()[_0x0ecf('0x21')](accountsTokens[_0x5b079['id']]['expires_in'])){_0x4982dd(accountsTokens[_0x5b079['id']][_0x0ecf('0x20')]);}}var _0x828703;switch(_0x5b079[_0x0ecf('0x22')]){case'US':_0x828703=_0x0ecf('0x23');break;case'AU':_0x828703=_0x0ecf('0x24');break;case'EU':_0x828703=_0x0ecf('0x25');break;case'IN':_0x828703=_0x0ecf('0x26');break;case'CN':_0x828703='https://accounts.zoho.com.cn';break;default:_0x828703=_0x0ecf('0x25');break;}var _0x55e09c={'method':'POST','uri':_0x828703+_0x0ecf('0x27'),'qs':{'refresh_token':_0x5b079['refreshToken'],'client_id':_0x5b079[_0x0ecf('0x28')],'client_secret':_0x5b079[_0x0ecf('0x29')],'grant_type':_0x0ecf('0x2a')},'json':!![]};return rp(_0x55e09c)['then'](function(_0x440382){accountsTokens[_0x5b079['id']]={'access_token':_0x440382[_0x0ecf('0x20')],'expires_in':moment()['add'](_0x440382[_0x0ecf('0x2b')],'seconds')};_0x4982dd(_0x440382['access_token']);})[_0x0ecf('0x2c')](function(_0x1e9b20){logger[_0x0ecf('0x2d')](_0x0ecf('0x2e'),_0x1e9b20[_0x0ecf('0x2f')]);_0x348e46(_0x1e9b20);});});}function getUser(_0x5df966,_0x2e1d3b,_0x1e87dd,_0xfd6f63){logger['info'](_0x0ecf('0x30'));return request({'method':_0x0ecf('0x31'),'uri':util[_0x0ecf('0x32')](_0x0ecf('0x33'),_0x2e1d3b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x0ecf('0x34')+_0x5df966},'json':!![]})[_0x0ecf('0x35')](function(_0xbc96bc){if(_0xbc96bc[_0x0ecf('0x36')]){var _0x2bc371=-0x1;if(_[_0x0ecf('0x37')](_0xbc96bc[_0x0ecf('0x36')])){if(!_[_0x0ecf('0x1f')](_0xfd6f63)){_0x2bc371=_['findIndex'](_0xbc96bc[_0x0ecf('0x36')],function(_0x59b018){return _0x59b018[_0x0ecf('0x38')]===_0xfd6f63;});}if(_0x2bc371>=0x0){logger['info'](_0x0ecf('0x39'));}else{logger['info'](_0x0ecf('0x3a'));_0x2bc371=_[_0x0ecf('0x3b')](_0xbc96bc[_0x0ecf('0x36')],function(_0x2642a1){return _0x2642a1[_0x0ecf('0x3c')][_0x0ecf('0x1c')]===_0x0ecf('0x3d');});}return _0xbc96bc[_0x0ecf('0x36')][_0x2bc371];}else{if(_0xbc96bc[_0x0ecf('0x3e')][_0x0ecf('0x3c')][_0x0ecf('0x1c')]===_0x0ecf('0x3d')){logger[_0x0ecf('0x3f')](_0x0ecf('0x3a'));user=_0xbc96bc[_0x0ecf('0x3e')];return user;}else{logger[_0x0ecf('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x0ecf('0x11')](_0xbc96bc));throw new Error(_0x0ecf('0x40')+JSON['stringify'](_0xbc96bc));}}}else{logger[_0x0ecf('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x0ecf('0x11')](_0xbc96bc));throw new Error(_0x0ecf('0x40')+JSON[_0x0ecf('0x11')](_0xbc96bc));}})[_0x0ecf('0x2c')](function(_0x47de68){console[_0x0ecf('0x2d')](_0x47de68);});}function getZohoUser(_0x3a5d5d,_0x5c18d8){return new BPromise(function(_0x471473,_0x1d8e4b){request(_0x3a5d5d)['then'](function(_0x5c3b55){var _0x2a2442=null;if(_0x5c3b55){_0x2a2442=_0x5c3b55['data'][0x0];_0x2a2442[_0x0ecf('0x41')]=_0x5c18d8;}_0x471473(_0x2a2442);})[_0x0ecf('0x2c')](function(_0x12adc1){_0x1d8e4b(_0x12adc1);});});}function createEndUser(_0x105492,_0x159cc4,_0x4539b5,_0x79def6,_0x1427af,_0x51d723){var _0x4539b5=getName(_0x4539b5);return request({'method':_0x0ecf('0x42'),'uri':_0x0ecf('0x43')+_0x159cc4+'/crm/v2/'+_[_0x0ecf('0x44')](_0x51d723[_0x0ecf('0x45')])+'s','body':{'data':[{'Last_Name':_0x4539b5[0x1],'First_Name':_0x4539b5[0x0],'Phone':_0x79def6,'Owner':{'name':!_[_0x0ecf('0x1f')](_0x1427af['role'][_0x0ecf('0x1c')])?_0x1427af[_0x0ecf('0x46')]['name']:!_[_0x0ecf('0x1f')](_0x1427af['first_name'])?_0x1427af[_0x0ecf('0x47')]+'\x20'+_0x1427af[_0x0ecf('0x48')]:_0x1427af['last_name'],'id':_0x1427af['id']}}]},'headers':{'Authorization':_0x0ecf('0x34')+_0x105492},'json':!![]})[_0x0ecf('0x35')](function(_0x4ba6e6){if(_0x4ba6e6&&_0x4ba6e6['data'][0x0][_0x0ecf('0x49')]===_0x0ecf('0x4a')){var _0x24190e=_0x4ba6e6['data'][0x0][_0x0ecf('0x4b')];_0x24190e[_0x0ecf('0x41')]=_[_0x0ecf('0x44')](_0x51d723[_0x0ecf('0x45')])+'s';return _0x24190e;}logger[_0x0ecf('0x2d')](_0x0ecf('0x4c'),JSON[_0x0ecf('0x11')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x0ecf('0x2c')](function(_0x49c82f){console['log'](_0x0ecf('0x4d'),_0x49c82f);});}function getEndUser(_0x5395c2,_0xf74d36,_0x15407d,_0x49e2c1,_0x18768a,_0x26576b,_0x43946c){var _0x2e4711={'method':'GET','uri':'','headers':{'Authorization':_0x0ecf('0x34')+_0x5395c2},'json':!![]};switch(_0x43946c['moduleSearch']){case _0x0ecf('0x4e'):_0x2e4711[_0x0ecf('0x4f')]='https://www.zohoapis.'+_0xf74d36+_0x0ecf('0x50')+_0x18768a+'))';return getZohoUser(_0x2e4711,_0x0ecf('0x51'))[_0x0ecf('0x35')](function(_0x29592a){if(_0x29592a)return _0x29592a;_0x2e4711[_0x0ecf('0x4f')]=_0x0ecf('0x43')+_0xf74d36+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x18768a+'))';return getZohoUser(_0x2e4711,'Leads')[_0x0ecf('0x35')](function(_0x3914fc){if(_0x3914fc)return _0x3914fc;if(_0x43946c[_0x0ecf('0x45')]!=_0x0ecf('0x52')){return createEndUser(_0x5395c2,_0xf74d36,_0x49e2c1,_0x18768a,_0x26576b,_0x43946c);}else{return{};}});});break;case _0x0ecf('0x53'):_0x2e4711[_0x0ecf('0x4f')]=_0x0ecf('0x43')+_0xf74d36+_0x0ecf('0x50')+_0x18768a+'))';return getZohoUser(_0x2e4711,_0x0ecf('0x51'))[_0x0ecf('0x35')](function(_0x44a893){if(_0x44a893)return _0x44a893;if(_0x43946c[_0x0ecf('0x45')]!=_0x0ecf('0x52')){return createEndUser(_0x5395c2,_0xf74d36,_0x49e2c1,_0x18768a,_0x26576b,_0x43946c);}else{return{};}});break;case'lead':_0x2e4711[_0x0ecf('0x4f')]=_0x0ecf('0x43')+_0xf74d36+_0x0ecf('0x54')+_0x18768a+'))';return getZohoUser(_0x2e4711,'Leads')[_0x0ecf('0x35')](function(_0x452072){if(_0x452072)return _0x452072;if(_0x43946c[_0x0ecf('0x45')]!=_0x0ecf('0x52')){return createEndUser(_0x5395c2,_0xf74d36,_0x49e2c1,_0x18768a,_0x26576b,_0x43946c);}else{return{};}});break;}}function getCall(_0x53210a,_0x2c7940,_0x41b947,_0x55341e,_0x2f27a1,_0x1b884c,_0x4bbb54,_0x184fb0){logger[_0x0ecf('0x3f')](_0x0ecf('0x55'));var _0x5b3d0f={};_0x5b3d0f[_0x0ecf('0x56')]={'name':!_[_0x0ecf('0x1f')](_0x55341e[_0x0ecf('0x46')][_0x0ecf('0x1c')])&&!_[_0x0ecf('0x1f')](_0x55341e[_0x0ecf('0x3c')]['name'])&&_0x55341e[_0x0ecf('0x3c')]['name']===_0x0ecf('0x57')?_0x55341e[_0x0ecf('0x46')][_0x0ecf('0x1c')]:!_[_0x0ecf('0x1f')](_0x55341e[_0x0ecf('0x47')])?_0x55341e[_0x0ecf('0x47')]+'\x20'+_0x55341e[_0x0ecf('0x48')]:_0x55341e[_0x0ecf('0x48')],'id':_0x55341e['id']};_0x5b3d0f[_0x0ecf('0x58')]=intUtil[_0x0ecf('0x59')](_0x1b884c[_0x0ecf('0x5a')],_0x4bbb54,'\x20');_0x5b3d0f[_0x0ecf('0x5b')]=intUtil[_0x0ecf('0x59')](_0x1b884c[_0x0ecf('0x5c')],_0x4bbb54,'\x0a');if(_0x2f27a1[_0x0ecf('0x41')]===_0x0ecf('0x51')){_0x5b3d0f['Who_Id']={'name':!_[_0x0ecf('0x1f')](_0x2f27a1[_0x0ecf('0x5d')])?_0x2f27a1['Full_Name']:!_[_0x0ecf('0x1f')](_0x2f27a1[_0x0ecf('0x5e')])?_0x2f27a1[_0x0ecf('0x5e')]+'\x20'+_0x2f27a1[_0x0ecf('0x5f')]:_0x2f27a1[_0x0ecf('0x5f')],'id':_0x2f27a1['id']};}if(_0x2f27a1['enduserType']===_0x0ecf('0x60')){_0x5b3d0f[_0x0ecf('0x61')]={'name':!_[_0x0ecf('0x1f')](_0x2f27a1[_0x0ecf('0x5d')])?_0x2f27a1['Full_Name']:!_[_0x0ecf('0x1f')](_0x2f27a1[_0x0ecf('0x5e')])?_0x2f27a1[_0x0ecf('0x5e')]+'\x20'+_0x2f27a1[_0x0ecf('0x5f')]:_0x2f27a1[_0x0ecf('0x5f')],'id':_0x2f27a1['id']};_0x5b3d0f[_0x0ecf('0x62')]=_[_0x0ecf('0x44')](_0x2f27a1['enduserType']);}if(_0x4bbb54[_0x0ecf('0x63')]){_0x5b3d0f[_0x0ecf('0x64')]=moment[_0x0ecf('0x65')](parseInt(_0x4bbb54[_0x0ecf('0x63')])*0x3e8)[_0x0ecf('0x32')](_0x0ecf('0x66'));}else if(_0x4bbb54[_0x0ecf('0x67')]&&_0x4bbb54[_0x0ecf('0x68')]){_0x5b3d0f[_0x0ecf('0x64')]=moment['utc'](moment(_0x4bbb54[_0x0ecf('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0x0ecf('0x69')](moment(_0x4bbb54[_0x0ecf('0x6a')],_0x0ecf('0x6b'))))[_0x0ecf('0x32')](_0x0ecf('0x66'));}switch(_0x4bbb54[_0x0ecf('0x6c')]){case'called':_0x5b3d0f['Call_Result']=_0x0ecf('0x6d');break;case _0x0ecf('0x6e'):case'connect':_0x5b3d0f[_0x0ecf('0x6f')]='Answered';break;case _0x0ecf('0x70'):_0x5b3d0f[_0x0ecf('0x6f')]=_0x0ecf('0x71');break;case _0x0ecf('0x72'):_0x5b3d0f[_0x0ecf('0x6f')]=_0x0ecf('0x73');break;case _0x0ecf('0x74'):_0x5b3d0f[_0x0ecf('0x6f')]=_0x0ecf('0x75');default:}_0x5b3d0f[_0x0ecf('0x76')]=(_0x184fb0===_0x0ecf('0x77')?moment(_0x4bbb54['starttime'])[_0x0ecf('0x32')](_0x0ecf('0x6b')):moment(_0x4bbb54[_0x0ecf('0x78')])[_0x0ecf('0x32')](_0x0ecf('0x6b')))||moment()[_0x0ecf('0x32')](_0x0ecf('0x6b'));_0x5b3d0f[_0x0ecf('0x79')]=_0x184fb0||'Inbound';_0x5b3d0f=_[_0x0ecf('0x7a')](_0x5b3d0f,getCustomFields(_0x1b884c[_0x0ecf('0x7b')],_0x4bbb54));return request({'method':_0x0ecf('0x42'),'uri':_0x0ecf('0x43')+_0x2c7940+_0x0ecf('0x7c'),'headers':{'Authorization':_0x0ecf('0x34')+_0x53210a},'body':{'data':[_0x5b3d0f]},'json':!![]})[_0x0ecf('0x35')](function(_0x5685f5){if(_0x5685f5&&_0x5685f5['data'][0x0][_0x0ecf('0x49')]===_0x0ecf('0x4a')){logger[_0x0ecf('0x3f')](_0x0ecf('0x7d'));return{'id':_0x5685f5[_0x0ecf('0x7e')][0x0][_0x0ecf('0x4b')]['id']};}})[_0x0ecf('0x2c')](function(_0x279c34){logger[_0x0ecf('0x3f')](_0x0ecf('0x7f'),_0x279c34[_0x0ecf('0x2f')]);console['log']('err',_0x279c34);});}exports['queue']=function(_0x521c9d,_0x31b398,_0x2b08e3,_0x4e0f43,_0x31ebe8,_0x596d7a){var _0x4b2482,_0x371dfa,_0x2c120d;_0x596d7a[_0x0ecf('0x80')]=intUtil[_0x0ecf('0x81')](_0x596d7a[_0x0ecf('0x80')]);_0x596d7a['serverUrl']=intUtil[_0x0ecf('0x81')](_0x596d7a[_0x0ecf('0x82')]);if(_0x31ebe8&&_0x31ebe8[_0x0ecf('0x83')]){logger[_0x0ecf('0x3f')]('[QUEUE]',_0x0ecf('0x84'));_0x31b398['recordingURL']=_0x596d7a[_0x0ecf('0x82')]+_0x0ecf('0x85')+_0x31b398['uniqueid']+_0x0ecf('0x86')+md5(_0x31b398[_0x0ecf('0x87')]);}else{_0x31b398['recordingURL']='';}var _0x544d2b=_0x596d7a['host']===_0x0ecf('0x88')?'eu':'com';return getAccessToken(_0x596d7a)[_0x0ecf('0x35')](function(_0xa44d2b){_0x2c120d=_0xa44d2b;return getUser(_0x2c120d,_0x544d2b,_0x596d7a,_0x4e0f43['email']);})[_0x0ecf('0x35')](function(_0x535d70){_0x4b2482=_0x535d70;logger[_0x0ecf('0x3f')]('The\x20User\x20ID\x20is:',_0x4b2482['id']);return getEndUser(_0x2c120d,_0x544d2b,_0x596d7a,_0x31b398[_0x0ecf('0x89')],_0x31b398[_0x0ecf('0x8a')],_0x4b2482,_0x2b08e3);})[_0x0ecf('0x35')](function(_0x1853c4){_0x371dfa=_0x1853c4;return getCall(_0x2c120d,_0x544d2b,_0x596d7a,_0x4b2482,_0x371dfa,_0x2b08e3,_0x31b398,_0x0ecf('0x8b'));})['then'](function(_0x4ea8b3){if(_0x4ea8b3){logger[_0x0ecf('0x3f')](_0x0ecf('0x8c'),_0x4ea8b3['id']);logger['info']('[QUEUE]',_0x0ecf('0x8d'));emit(util[_0x0ecf('0x32')]('user:%s',_0x4e0f43['name']),_0x0ecf('0x8e'),{'uri':_0x0ecf('0x8f')+_0x596d7a['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4ea8b3['id']});}})['catch'](function(_0x278ba1){logger['error'](_0x0ecf('0x90'),JSON[_0x0ecf('0x11')](_0x278ba1));});};exports['outbound']=function(_0x206369,_0x551934,_0x3080c1,_0x152fa2,_0xd4396b,_0x5a45d1,_0x3cdcd7){var _0x2aea12,_0x2d069a,_0x2fec15;_0x5a45d1[_0x0ecf('0x80')]=intUtil[_0x0ecf('0x81')](_0x5a45d1['host']);_0x5a45d1[_0x0ecf('0x82')]=intUtil[_0x0ecf('0x81')](_0x5a45d1[_0x0ecf('0x82')]);if(_0x3cdcd7&&_0x3cdcd7[_0x0ecf('0x91')]&&_0x3cdcd7['recordingFormat']!==_0x0ecf('0x92')){logger[_0x0ecf('0x3f')](_0x0ecf('0x93'),'Recording\x20is\x20enabled!');_0x551934[_0x0ecf('0x94')]=_0x5a45d1[_0x0ecf('0x82')]+_0x0ecf('0x85')+_0x551934[_0x0ecf('0x87')]+_0x0ecf('0x86')+md5(_0x551934['uniqueid']);}var _0x3bf601=_0x5a45d1[_0x0ecf('0x80')]===_0x0ecf('0x88')?'eu':_0x0ecf('0x95');return getAccessToken(_0x5a45d1)[_0x0ecf('0x35')](function(_0xd93032){_0x2fec15=_0xd93032;return getUser(_0x2fec15,_0x3bf601,_0x5a45d1,_0x152fa2[_0x0ecf('0x38')]);})[_0x0ecf('0x35')](function(_0x241149){_0x2aea12=_0x241149;logger[_0x0ecf('0x3f')](_0x0ecf('0x96'),_0x2aea12['id']);return getEndUser(_0x2fec15,_0x3bf601,_0x5a45d1,_0x551934['destcalleridname'],_0x551934[_0x0ecf('0x97')],_0x2aea12,_0x3080c1);})[_0x0ecf('0x35')](function(_0x158ef6){_0x2d069a=_0x158ef6;return getCall(_0x2fec15,_0x3bf601,_0x5a45d1,_0x2aea12,_0x2d069a,_0x3080c1,_0x551934,'Outbound');})[_0x0ecf('0x35')](function(_0x3ce7bd){if(_0x3ce7bd){logger['info'](_0x0ecf('0x8c'),_0x3ce7bd['id']);logger[_0x0ecf('0x3f')](_0x0ecf('0x93'),_0x0ecf('0x8d'));emit(util[_0x0ecf('0x32')](_0x0ecf('0x98'),_0x152fa2[_0x0ecf('0x1c')]),'trigger:browser:url',{'uri':'https://crm.'+_0x5a45d1[_0x0ecf('0x80')]+_0x0ecf('0x99')+_0x3ce7bd['id']});}})[_0x0ecf('0x2c')](function(_0x162f07){logger['error']('[OUTBOUND]',JSON[_0x0ecf('0x11')](_0x162f07));});};exports[_0x0ecf('0x9a')]=function(_0xe64d44,_0xb91a9,_0x4998f7,_0x1a628a,_0x4d0bf2,_0x254b22){var _0x1dc00a,_0x28e65a,_0x10e1bd;_0x254b22[_0x0ecf('0x80')]=intUtil[_0x0ecf('0x81')](_0x254b22[_0x0ecf('0x80')]);_0x254b22['serverUrl']=intUtil['stripTrailingSlash'](_0x254b22[_0x0ecf('0x82')]);if(_0x4d0bf2&&_0x4d0bf2[_0x0ecf('0x83')]){logger['info']('['+_0xb91a9[_0x0ecf('0x6c')][_0x0ecf('0x9b')]()+']',_0x0ecf('0x84'));_0xb91a9[_0x0ecf('0x94')]=_0x254b22['serverUrl']+_0x0ecf('0x85')+_0xb91a9[_0x0ecf('0x87')]+_0x0ecf('0x86')+md5(_0xb91a9[_0x0ecf('0x87')]);}else{_0xb91a9[_0x0ecf('0x94')]='';}var _0x303970=_0x254b22[_0x0ecf('0x80')]===_0x0ecf('0x88')?'eu':_0x0ecf('0x95');return getAccessToken(_0x254b22)[_0x0ecf('0x35')](function(_0x1d82da){_0x10e1bd=_0x1d82da;return getUser(_0x10e1bd,_0x303970,_0x254b22);})['then'](function(_0x20d9ad){_0x1dc00a=_0x20d9ad;logger[_0x0ecf('0x3f')](_0x0ecf('0x96'),_0x1dc00a['id']);return getEndUser(_0x10e1bd,_0x303970,_0x254b22,_0xb91a9[_0x0ecf('0x89')],_0xb91a9[_0x0ecf('0x8a')],_0x1dc00a,_0x4998f7);})[_0x0ecf('0x35')](function(_0x31f7dd){_0x28e65a=_0x31f7dd;return getCall(_0x10e1bd,_0x303970,_0x254b22,_0x1dc00a,_0x28e65a,_0x4998f7,_0xb91a9,_0x0ecf('0x8b'));})['then'](function(_0x2b3029){if(_0x2b3029){logger[_0x0ecf('0x3f')](_0x0ecf('0x8c'),_0x2b3029['id']);}})[_0x0ecf('0x2c')](function(_0x1828b5){logger[_0x0ecf('0x2d')]('['+_0xb91a9[_0x0ecf('0x6c')][_0x0ecf('0x9b')]()+']',JSON[_0x0ecf('0x11')](_0x1828b5));});}; \ 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 ce726e8..ba59f8b 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 _0x4631=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger','exec','data2','Script','render','error'];(function(_0x54c864,_0x127886){var _0x4461e4=function(_0x2594ed){while(--_0x2594ed){_0x54c864['push'](_0x54c864['shift']());}};_0x4461e4(++_0x127886);}(_0x4631,0x156));var _0x1463=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x4631[_0x15e6fe];return _0x34894d;};'use strict';var util=require(_0x1463('0x0'));var sh=require(_0x1463('0x1'));var Mustache=require('mustache');var logger=require(_0x1463('0x2'))(_0x1463('0x3'));exports[_0x1463('0x4')]=function(_0x188a19,_0x22e3a0){var _0x1b8efd=_0x188a19[_0x1463('0x5')]?_0x188a19[_0x1463('0x5')]:_0x1463('0x6');var _0x6e7e62=_0x188a19['data3']?Mustache[_0x1463('0x7')](_0x188a19['data3'],_0x22e3a0):_0x22e3a0;sh[_0x1463('0x4')](_0x6e7e62,function(_0x4ffe24,_0x20a283,_0xa53781){if(_0x4ffe24!==0x0){logger[_0x1463('0x8')](util['format'](_0x1463('0x9'),_0x1b8efd,_0x6e7e62,_0x4ffe24,_0xa53781));}else{logger[_0x1463('0xa')](util[_0x1463('0xb')](_0x1463('0xc'),_0x1b8efd,_0x6e7e62,_0x20a283));}});}; \ No newline at end of file +var _0x20e4=['data2','data3','render','exec','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','../../../../config/logger'];(function(_0x243e12,_0x2d7bc5){var _0x3fddfc=function(_0x2896ee){while(--_0x2896ee){_0x243e12['push'](_0x243e12['shift']());}};_0x3fddfc(++_0x2d7bc5);}(_0x20e4,0xa0));var _0x420e=function(_0x53fb96,_0x16a8d1){_0x53fb96=_0x53fb96-0x0;var _0x2a1384=_0x20e4[_0x53fb96];return _0x2a1384;};'use strict';var util=require('util');var sh=require(_0x420e('0x0'));var Mustache=require('mustache');var logger=require(_0x420e('0x1'))('trigger');exports['exec']=function(_0x190cfd,_0x174585){var _0x2a976=_0x190cfd[_0x420e('0x2')]?_0x190cfd[_0x420e('0x2')]:'Script';var _0x6f3e95=_0x190cfd[_0x420e('0x3')]?Mustache[_0x420e('0x4')](_0x190cfd[_0x420e('0x3')],_0x174585):_0x174585;sh[_0x420e('0x5')](_0x6f3e95,function(_0x42c902,_0x3d6e3f,_0x1cf955){if(_0x42c902!==0x0){logger['error'](util[_0x420e('0x6')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2a976,_0x6f3e95,_0x42c902,_0x1cf955));}else{logger[_0x420e('0x7')](util[_0x420e('0x6')](_0x420e('0x8'),_0x2a976,_0x6f3e95,_0x3d6e3f));}});}; \ 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 0cfe3ec..3f97c91 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 _0x405f=['util','lodash','mustache','../../../../config/logger','exec','data1','render','data2','number','data5','headers','data6','error','toUpperCase','GET','DELETE','PUT','data7','parse','body','stack','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil',',\x20request\x20body:\x20','object','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'];(function(_0x5af459,_0x45d683){var _0x5ac0ae=function(_0x5dfbed){while(--_0x5dfbed){_0x5af459['push'](_0x5af459['shift']());}};_0x5ac0ae(++_0x45d683);}(_0x405f,0xa5));var _0xf405=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x405f[_0x369151];return _0x4292d5;};'use strict';var rp=require('request-promise');var util=require(_0xf405('0x0'));var _=require(_0xf405('0x1'));var Mustache=require(_0xf405('0x2'));var logger=require(_0xf405('0x3'))('trigger');exports[_0xf405('0x4')]=function(_0x5c15bb,_0x4bc616){var _0x5ed2c4,_0x373013;var _0x46edec={'method':_0x5c15bb[_0xf405('0x5')]['toUpperCase'](),'uri':Mustache[_0xf405('0x6')](_0x5c15bb[_0xf405('0x7')],_0x4bc616),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5c15bb['data5'])===_0xf405('0x8')&&parseInt(_0x5c15bb[_0xf405('0x9')])>=0x1&&parseInt(_0x5c15bb['data5'])<=0xa?parseInt(_0x5c15bb[_0xf405('0x9')])*0x3e8:0x5*0x3e8};try{_0x46edec[_0xf405('0xa')]=_0x5c15bb['data6']?JSON['parse'](Mustache[_0xf405('0x6')](_0x5c15bb[_0xf405('0xb')],_0x4bc616)):{};}catch(_0xb268f0){logger[_0xf405('0xc')](_0xb268f0['stack']);}switch(_0x5c15bb[_0xf405('0x5')][_0xf405('0xd')]()){case _0xf405('0xe'):case _0xf405('0xf'):_0x5ed2c4=null;_0x46edec['qs']=_0x4bc616;break;case'POST':case _0xf405('0x10'):if(_0x5c15bb[_0xf405('0x11')]){try{_0x5ed2c4=JSON[_0xf405('0x12')](Mustache[_0xf405('0x6')](_0x5c15bb[_0xf405('0x11')],_0x4bc616));_0x46edec[_0xf405('0x13')]=_0x5ed2c4;}catch(_0x25b79e){logger[_0xf405('0xc')](_0x25b79e[_0xf405('0x14')]);logger[_0xf405('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x5ed2c4=_0x4bc616;_0x46edec['body']=_0x5ed2c4;}break;}logger[_0xf405('0x15')](util['format'](_0xf405('0x16'),_0x5c15bb[_0xf405('0x5')],_0x5c15bb['data2'],JSON['stringify'](_0x46edec)));rp(_0x46edec)['then'](function(_0x40709c){_0x5ed2c4=!_[_0xf405('0x17')](_0x5ed2c4)?_0xf405('0x18')+_0x5ed2c4:'';_0x373013=typeof _0x40709c[_0xf405('0x13')]===_0xf405('0x19')?JSON['stringify'](_0x40709c[_0xf405('0x13')]):_0x40709c['body'];logger[_0xf405('0x15')](util[_0xf405('0x1a')](_0xf405('0x1b'),_0x5c15bb['data1'],_0x5c15bb[_0xf405('0x7')],_0x40709c[_0xf405('0x1c')],_0x373013));})[_0xf405('0x1d')](function(_0x49c24b){logger[_0xf405('0xc')](util['format'](_0xf405('0x1e'),_0x5c15bb['data1'],_0x5c15bb[_0xf405('0x7')],_0x49c24b[_0xf405('0x1c')],_0x49c24b[_0xf405('0x1f')],_0x49c24b[_0xf405('0x20')]));});}; \ No newline at end of file +var _0xef9e=['stack','toUpperCase','POST','PUT','data7','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','info','%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','trigger','exec','data1','render','data5','number','headers','parse','data6','error'];(function(_0x2b2680,_0x3adf49){var _0x2d5403=function(_0x1a47f6){while(--_0x1a47f6){_0x2b2680['push'](_0x2b2680['shift']());}};_0x2d5403(++_0x3adf49);}(_0xef9e,0x1db));var _0xeef9=function(_0x492739,_0x4d7d80){_0x492739=_0x492739-0x0;var _0x4b668c=_0xef9e[_0x492739];return _0x4b668c;};'use strict';var rp=require(_0xeef9('0x0'));var util=require(_0xeef9('0x1'));var _=require(_0xeef9('0x2'));var Mustache=require(_0xeef9('0x3'));var logger=require(_0xeef9('0x4'))(_0xeef9('0x5'));exports[_0xeef9('0x6')]=function(_0x5bc9a8,_0x44b703){var _0xebce8,_0x589a06;var _0x206282={'method':_0x5bc9a8[_0xeef9('0x7')]['toUpperCase'](),'uri':Mustache[_0xeef9('0x8')](_0x5bc9a8['data2'],_0x44b703),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5bc9a8[_0xeef9('0x9')])===_0xeef9('0xa')&&parseInt(_0x5bc9a8[_0xeef9('0x9')])>=0x1&&parseInt(_0x5bc9a8[_0xeef9('0x9')])<=0xa?parseInt(_0x5bc9a8[_0xeef9('0x9')])*0x3e8:0x5*0x3e8};try{_0x206282[_0xeef9('0xb')]=_0x5bc9a8['data6']?JSON[_0xeef9('0xc')](Mustache['render'](_0x5bc9a8[_0xeef9('0xd')],_0x44b703)):{};}catch(_0x2d7f03){logger[_0xeef9('0xe')](_0x2d7f03[_0xeef9('0xf')]);}switch(_0x5bc9a8[_0xeef9('0x7')][_0xeef9('0x10')]()){case'GET':case'DELETE':_0xebce8=null;_0x206282['qs']=_0x44b703;break;case _0xeef9('0x11'):case _0xeef9('0x12'):if(_0x5bc9a8[_0xeef9('0x13')]){try{_0xebce8=JSON['parse'](Mustache['render'](_0x5bc9a8[_0xeef9('0x13')],_0x44b703));_0x206282[_0xeef9('0x14')]=_0xebce8;}catch(_0x1dcaba){logger[_0xeef9('0xe')](_0x1dcaba['stack']);logger[_0xeef9('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0xebce8=_0x44b703;_0x206282[_0xeef9('0x14')]=_0xebce8;}break;}logger['info'](util[_0xeef9('0x15')](_0xeef9('0x16'),_0x5bc9a8[_0xeef9('0x7')],_0x5bc9a8[_0xeef9('0x17')],JSON[_0xeef9('0x18')](_0x206282)));rp(_0x206282)[_0xeef9('0x19')](function(_0x207069){_0xebce8=!_[_0xeef9('0x1a')](_0xebce8)?',\x20request\x20body:\x20'+_0xebce8:'';_0x589a06=typeof _0x207069[_0xeef9('0x14')]===_0xeef9('0x1b')?JSON[_0xeef9('0x18')](_0x207069[_0xeef9('0x14')]):_0x207069['body'];logger[_0xeef9('0x1c')](util['format'](_0xeef9('0x1d'),_0x5bc9a8['data1'],_0x5bc9a8[_0xeef9('0x17')],_0x207069[_0xeef9('0x1e')],_0x589a06));})[_0xeef9('0x1f')](function(_0x2c2b6d){logger[_0xeef9('0xe')](util[_0xeef9('0x15')](_0xeef9('0x20'),_0x5bc9a8[_0xeef9('0x7')],_0x5bc9a8['data2'],_0x2c2b6d[_0xeef9('0x1e')],_0x2c2b6d[_0xeef9('0x21')],_0x2c2b6d[_0xeef9('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b496c18..0cd7f3a 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 _0xe8c4=['debug','rpc','error','message','exports','jayson/promise','bluebird','../../config/logger','routing','http','request','then'];(function(_0x483cbe,_0x1432a7){var _0x20330d=function(_0x23ad4b){while(--_0x23ad4b){_0x483cbe['push'](_0x483cbe['shift']());}};_0x20330d(++_0x1432a7);}(_0xe8c4,0x1d9));var _0x4e8c=function(_0x5197ff,_0x56ffe9){_0x5197ff=_0x5197ff-0x0;var _0x41b1e3=_0xe8c4[_0x5197ff];return _0x41b1e3;};'use strict';var jayson=require(_0x4e8c('0x0'));var BPromise=require(_0x4e8c('0x1'));var logger=require(_0x4e8c('0x2'))(_0x4e8c('0x3'));var client=jayson['client'][_0x4e8c('0x4')]({'port':0x2329});client['Request']=function(_0x3fd689,_0x10fdc2){return new BPromise(function(_0x29e86e,_0x10d337){return client[_0x4e8c('0x5')](_0x3fd689,_0x10fdc2)[_0x4e8c('0x6')](function(_0x10cb89){logger[_0x4e8c('0x7')](_0x4e8c('0x8'),_0x4e8c('0x3'),_0x3fd689,_0x10fdc2,_0x10cb89);if(_0x10cb89['error']){logger[_0x4e8c('0x9')](_0x4e8c('0x8'),_0x4e8c('0x3'),_0x3fd689,_0x10cb89[_0x4e8c('0x9')][_0x4e8c('0xa')],_0x10fdc2);return _0x10d337(_0x10cb89[_0x4e8c('0x9')][_0x4e8c('0xa')]);}else{return _0x29e86e(_0x10cb89['result']);}})['catch'](function(_0x11f4e7){logger[_0x4e8c('0x9')](_0x4e8c('0x8'),_0x4e8c('0x3'),_0x3fd689,_0x11f4e7,_0x10fdc2);return _0x10d337(_0x11f4e7);});});};module[_0x4e8c('0xb')]=client; \ No newline at end of file +var _0xbf06=['result','catch','exports','jayson/promise','client','http','Request','request','then','debug','routing','error','message'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0xbf06,0x1f1));var _0x6bf0=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xbf06[_0x2763f2];return _0x3ef471;};'use strict';var jayson=require(_0x6bf0('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x6bf0('0x1')][_0x6bf0('0x2')]({'port':0x2329});client[_0x6bf0('0x3')]=function(_0x2e5ef7,_0x2aff4a){return new BPromise(function(_0x5b9767,_0x2c612d){return client[_0x6bf0('0x4')](_0x2e5ef7,_0x2aff4a)[_0x6bf0('0x5')](function(_0x4bd100){logger[_0x6bf0('0x6')]('rpc',_0x6bf0('0x7'),_0x2e5ef7,_0x2aff4a,_0x4bd100);if(_0x4bd100[_0x6bf0('0x8')]){logger[_0x6bf0('0x8')]('rpc',_0x6bf0('0x7'),_0x2e5ef7,_0x4bd100['error'][_0x6bf0('0x9')],_0x2aff4a);return _0x2c612d(_0x4bd100[_0x6bf0('0x8')][_0x6bf0('0x9')]);}else{return _0x5b9767(_0x4bd100[_0x6bf0('0xa')]);}})[_0x6bf0('0xb')](function(_0x5ef5e1){logger[_0x6bf0('0x8')]('rpc','routing',_0x2e5ef7,_0x5ef5e1,_0x2aff4a);return _0x2c612d(_0x5ef5e1);});});};module[_0x6bf0('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ce5af9a..f544f95 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 _0xf333=['listen','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','getMailAccounts','then','initMailAccounts','refresh','mailAccounts'];(function(_0x1ad30f,_0x2ee135){var _0x3c7f13=function(_0x273f4a){while(--_0x273f4a){_0x1ad30f['push'](_0x1ad30f['shift']());}};_0x3c7f13(++_0x2ee135);}(_0xf333,0xa9));var _0x3f33=function(_0x49f68e,_0x172b1f){_0x49f68e=_0x49f68e-0x0;var _0x2ef93c=_0xf333[_0x49f68e];return _0x2ef93c;};'use strict';var server=require(_0x3f33('0x0'));var Realtime=require(_0x3f33('0x1'));var EmailChannel=require(_0x3f33('0x2'));var mailAccount=require(_0x3f33('0x3'));var setting=require(_0x3f33('0x4'));var logger=require('../../config/logger')(_0x3f33('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x3f33('0x6')]())[_0x3f33('0x7')](realtime[_0x3f33('0x8')]())['then'](function(){email[_0x3f33('0x9')](realtime[_0x3f33('0xa')]);return realtime;});}function main(){return server[_0x3f33('0xb')](realtime,email)[_0x3f33('0x7')](function(){return initRealtime();})[_0x3f33('0x7')](function(){return setting['getSettings']();})[_0x3f33('0x7')](function(_0x14bebc){return setInterval(initRealtime,_0x14bebc['loginMailFrequency']*0x3e8);})[_0x3f33('0xc')](function(_0x433f61){logger[_0x3f33('0xd')](_0x3f33('0xe'),_0x433f61);});}main(); \ No newline at end of file +var _0xe896=['loginMailFrequency','catch','error','./realtime','./rpc/mailAccount','./rpc/setting','email','then','getMailAccounts','refresh'];(function(_0x41f46e,_0xa5c23e){var _0x4c5bc1=function(_0xe287b8){while(--_0xe287b8){_0x41f46e['push'](_0x41f46e['shift']());}};_0x4c5bc1(++_0xa5c23e);}(_0xe896,0xe9));var _0x6e89=function(_0x441b5a,_0x5ac767){_0x441b5a=_0x441b5a-0x0;var _0x5a3827=_0xe896[_0x441b5a];return _0x5a3827;};'use strict';var server=require('./server');var Realtime=require(_0x6e89('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x6e89('0x1'));var setting=require(_0x6e89('0x2'));var logger=require('../../config/logger')(_0x6e89('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x6e89('0x4')](mailAccount[_0x6e89('0x5')]())[_0x6e89('0x4')](realtime['initMailAccounts']())[_0x6e89('0x4')](function(){email[_0x6e89('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x6e89('0x4')](function(){return initRealtime();})[_0x6e89('0x4')](function(){return setting['getSettings']();})[_0x6e89('0x4')](function(_0x58ee2d){return setInterval(initRealtime,_0x58ee2d[_0x6e89('0x7')]*0x3e8);})[_0x6e89('0x8')](function(_0x3718e9){logger[_0x6e89('0x9')]('Email\x20service\x20initialization',_0x3718e9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 40e0d58..d330946 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 _0x2b11=['./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','messageStatus','isNil','stringify','refresh','hasOwnProperty','service','provider','custom','box','end','handleImapEnd','bind','handleImapError','handleImapBox','connected','total','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','lastSync','status','sendMail','send','verifySmtp','Smtp','verify','verified','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x2b11,0x1af));var _0x12b1=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x2b11[_0xccf869];return _0x21a9db;};'use strict';var _=require('lodash');var moment=require(_0x12b1('0x0'));var BPromise=require('bluebird');var md5=require(_0x12b1('0x1'));var Redis=require(_0x12b1('0x2'));var config=require(_0x12b1('0x3'));var logger=require(_0x12b1('0x4'))(_0x12b1('0x5'));config[_0x12b1('0x6')]=_[_0x12b1('0x7')](config[_0x12b1('0x6')],{'host':_0x12b1('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x12b1('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x12b1('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x557da0){logger[_0x12b1('0xa')](_0x12b1('0xb'));this[_0x12b1('0xc')]=_0x557da0[_0x12b1('0xc')];this[_0x12b1('0xd')]={};this[_0x12b1('0xe')]=new EmailSmtp();}EmailChannel[_0x12b1('0xf')][_0x12b1('0x10')]=function(_0x41fb4a){var _0x22ca0e=this['mailAccounts'][_0x41fb4a];var _0x3a1704={'id':_0x22ca0e['id'],'name':_0x22ca0e[_0x12b1('0x11')],'key':_0x22ca0e['key'],'active':_0x22ca0e[_0x12b1('0x12')],'Imap':{'status':_0x22ca0e[_0x12b1('0x13')]['status'],'messageStatus':_0x22ca0e[_0x12b1('0x13')][_0x12b1('0x14')],'total':_0x22ca0e[_0x12b1('0x13')]['total']}};if(_[_0x12b1('0x15')](md5Accounts[_0x41fb4a])){md5Accounts[_0x41fb4a]={};}var _0xc7e496=md5(JSON[_0x12b1('0x16')](_0x3a1704));if(md5Accounts[_0x41fb4a][_0x12b1('0x1')]!==_0xc7e496){md5Accounts[_0x41fb4a][_0x12b1('0x1')]=_0xc7e496;io[_0x12b1('0x10')]('mailAccount:update',_0x3a1704);}};EmailChannel[_0x12b1('0xf')][_0x12b1('0x17')]=function(_0x57ea3b){for(var _0x92bed0 in _0x57ea3b){if(_0x57ea3b[_0x12b1('0x18')](_0x92bed0)){if(_0x57ea3b[_0x92bed0][_0x12b1('0x13')]&&_0x57ea3b[_0x92bed0][_0x12b1('0x12')]){var _0x1aedf0=_0x57ea3b[_0x92bed0][_0x12b1('0x13')];if(!_0x1aedf0[_0x12b1('0x19')]&&_0x57ea3b[_0x92bed0][_0x12b1('0x1a')]!==_0x12b1('0x1b'))_0x1aedf0[_0x12b1('0x19')]=_0x57ea3b[_0x92bed0][_0x12b1('0x1a')];if(!this['imapAccounts']['hasOwnProperty'](_0x1aedf0['id'])){this['imapAccounts'][_0x1aedf0['id']]=new EmailImap(_0x1aedf0,_0x57ea3b[_0x92bed0][_0x12b1('0x5')]);this['imapAccounts'][_0x1aedf0['id']]['on'](_0x12b1('0x1c'),this['handleImapBox']['bind'](this,_0x92bed0));this[_0x12b1('0xd')][_0x1aedf0['id']]['on'](_0x12b1('0x5'),this['handleImapEmail']['bind'](this,_0x92bed0));this[_0x12b1('0xd')][_0x1aedf0['id']]['on'](_0x12b1('0x1d'),this[_0x12b1('0x1e')][_0x12b1('0x1f')](this,_0x92bed0));this[_0x12b1('0xd')][_0x1aedf0['id']]['on']('error',this[_0x12b1('0x20')]['bind'](this,_0x92bed0));}}else{if(_['isNil'](this[_0x12b1('0xc')][_0x92bed0][_0x12b1('0x13')])){this[_0x12b1('0xc')][_0x92bed0][_0x12b1('0x13')]={};}this[_0x12b1('0xc')][_0x92bed0][_0x12b1('0x13')]['status']='disabled';this['mailAccounts'][_0x92bed0][_0x12b1('0x13')][_0x12b1('0x14')]='';this[_0x12b1('0x10')](_0x92bed0);}}}};EmailChannel[_0x12b1('0xf')][_0x12b1('0x21')]=function(_0x4327a9,_0x3e55a8){if(this[_0x12b1('0xc')][_0x4327a9]){this[_0x12b1('0xc')][_0x4327a9][_0x12b1('0x13')]['status']=_0x12b1('0x22');this['mailAccounts'][_0x4327a9][_0x12b1('0x13')][_0x12b1('0x14')]=_0x3e55a8[_0x12b1('0x11')];if(_0x3e55a8['messages']){this[_0x12b1('0xc')][_0x4327a9][_0x12b1('0x13')][_0x12b1('0x23')]=_0x3e55a8[_0x12b1('0x24')][_0x12b1('0x23')];}return this[_0x12b1('0x10')](_0x4327a9);}};EmailChannel['prototype'][_0x12b1('0x25')]=function(_0x2c38fb,_0x58edf0){logger[_0x12b1('0xa')](_0x12b1('0x26'),_0x58edf0[_0x12b1('0x27')],_0x58edf0[_0x12b1('0x28')],_0x58edf0[_0x12b1('0x29')],_0x2c38fb);if(this[_0x12b1('0xc')][_0x2c38fb]){return mailAccount[_0x12b1('0x2a')](_0x2c38fb,_0x58edf0)[_0x12b1('0x2b')](function(_0x4a2b43){if(_0x4a2b43){logger[_0x12b1('0xa')](_0x12b1('0x2c'));}})[_0x12b1('0x2d')](function(_0x401d11){logger[_0x12b1('0x2e')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x12b1('0x16')](_0x401d11));});}};EmailChannel[_0x12b1('0xf')][_0x12b1('0x1e')]=function(_0x4cf508){if(this['mailAccounts'][_0x4cf508]&&this[_0x12b1('0xc')][_0x4cf508][_0x12b1('0x13')]){if(this['imapAccounts'][this['mailAccounts'][_0x4cf508][_0x12b1('0x13')]['id']]){delete this[_0x12b1('0xd')][this['mailAccounts'][_0x4cf508][_0x12b1('0x13')]['id']];}this[_0x12b1('0xc')][_0x4cf508][_0x12b1('0x13')][_0x12b1('0x2f')]=moment();this[_0x12b1('0x10')](_0x4cf508);}};EmailChannel[_0x12b1('0xf')][_0x12b1('0x20')]=function(_0x18eeba,_0x372f27){if(this[_0x12b1('0xc')][_0x18eeba]){this[_0x12b1('0xc')][_0x18eeba][_0x12b1('0x13')][_0x12b1('0x30')]=_0x12b1('0x2e');this[_0x12b1('0xc')][_0x18eeba][_0x12b1('0x13')][_0x12b1('0x14')]=_0x372f27;return this['emit'](_0x18eeba);}};EmailChannel[_0x12b1('0xf')][_0x12b1('0x31')]=function(_0x4b01e6,_0x4685f3){return this['smtp'][_0x12b1('0x32')](_0x4b01e6,_0x4685f3);};EmailChannel[_0x12b1('0xf')][_0x12b1('0x33')]=function(_0x1ea76a){var _0x5df148=this;if(this[_0x12b1('0xc')][_0x1ea76a['id']]){if(_[_0x12b1('0x15')](this[_0x12b1('0xc')][_0x1ea76a['id']]['Smtp'])){this[_0x12b1('0xc')][_0x1ea76a['id']][_0x12b1('0x34')]={};}this[_0x12b1('0xc')][_0x1ea76a['id']]['Smtp'][_0x12b1('0x2f')]=moment();return new BPromise(function(_0x1e1e01,_0x3bd8b3){return _0x5df148[_0x12b1('0xe')][_0x12b1('0x35')](_0x1ea76a)['then'](function(_0x5548ae){_0x5df148['mailAccounts'][_0x1ea76a['id']][_0x12b1('0x34')][_0x12b1('0x30')]=_0x12b1('0x36');_0x5df148[_0x12b1('0xc')][_0x1ea76a['id']][_0x12b1('0x34')]['messageStatus']='';_0x5df148[_0x12b1('0x10')](_0x1ea76a['id']);_0x1e1e01(_0x5548ae);})[_0x12b1('0x2d')](function(_0x3013bf){_0x5df148['mailAccounts'][_0x1ea76a['id']]['Smtp'][_0x12b1('0x30')]='error';_0x5df148[_0x12b1('0xc')][_0x1ea76a['id']][_0x12b1('0x34')][_0x12b1('0x14')]=_0x3013bf;_0x5df148[_0x12b1('0x10')](_0x1ea76a['id']);_0x3bd8b3(_0x3013bf);});});}return this[_0x12b1('0xe')][_0x12b1('0x35')](_0x1ea76a);};module['exports']=EmailChannel; \ No newline at end of file +var _0xab7c=['handleImapError','sendMail','verifySmtp','Smtp','verify','then','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','prototype','refresh','service','custom','provider','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync'];(function(_0x343dfb,_0xed8587){var _0x297fe2=function(_0x19cbbd){while(--_0x19cbbd){_0x343dfb['push'](_0x343dfb['shift']());}};_0x297fe2(++_0xed8587);}(_0xab7c,0xb0));var _0xcab7=function(_0x2c8cab,_0x585275){_0x2c8cab=_0x2c8cab-0x0;var _0x5f5261=_0xab7c[_0x2c8cab];return _0x5f5261;};'use strict';var _=require('lodash');var moment=require(_0xcab7('0x0'));var BPromise=require(_0xcab7('0x1'));var md5=require(_0xcab7('0x2'));var Redis=require(_0xcab7('0x3'));var config=require(_0xcab7('0x4'));var logger=require(_0xcab7('0x5'))(_0xcab7('0x6'));config[_0xcab7('0x7')]=_[_0xcab7('0x8')](config[_0xcab7('0x7')],{'host':_0xcab7('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcab7('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xcab7('0xa'));var md5Accounts={};function EmailChannel(_0x48634f){logger['info']('start\x20email\x20channel');this['mailAccounts']=_0x48634f[_0xcab7('0xb')];this[_0xcab7('0xc')]={};this[_0xcab7('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0xcab7('0xe')]=function(_0x4961d4){var _0x5cc268=this['mailAccounts'][_0x4961d4];var _0x476b82={'id':_0x5cc268['id'],'name':_0x5cc268[_0xcab7('0xf')],'key':_0x5cc268[_0xcab7('0x10')],'active':_0x5cc268[_0xcab7('0x11')],'Imap':{'status':_0x5cc268[_0xcab7('0x12')][_0xcab7('0x13')],'messageStatus':_0x5cc268[_0xcab7('0x12')][_0xcab7('0x14')],'total':_0x5cc268[_0xcab7('0x12')][_0xcab7('0x15')]}};if(_[_0xcab7('0x16')](md5Accounts[_0x4961d4])){md5Accounts[_0x4961d4]={};}var _0x3e3e3f=md5(JSON[_0xcab7('0x17')](_0x476b82));if(md5Accounts[_0x4961d4][_0xcab7('0x2')]!==_0x3e3e3f){md5Accounts[_0x4961d4]['md5']=_0x3e3e3f;io[_0xcab7('0xe')]('mailAccount:update',_0x476b82);}};EmailChannel[_0xcab7('0x18')][_0xcab7('0x19')]=function(_0x52dece){for(var _0x4f2795 in _0x52dece){if(_0x52dece['hasOwnProperty'](_0x4f2795)){if(_0x52dece[_0x4f2795][_0xcab7('0x12')]&&_0x52dece[_0x4f2795][_0xcab7('0x11')]){var _0x147cca=_0x52dece[_0x4f2795][_0xcab7('0x12')];if(!_0x147cca[_0xcab7('0x1a')]&&_0x52dece[_0x4f2795]['provider']!==_0xcab7('0x1b'))_0x147cca[_0xcab7('0x1a')]=_0x52dece[_0x4f2795][_0xcab7('0x1c')];if(!this[_0xcab7('0xc')][_0xcab7('0x1d')](_0x147cca['id'])){this[_0xcab7('0xc')][_0x147cca['id']]=new EmailImap(_0x147cca,_0x52dece[_0x4f2795]['email']);this[_0xcab7('0xc')][_0x147cca['id']]['on'](_0xcab7('0x1e'),this[_0xcab7('0x1f')][_0xcab7('0x20')](this,_0x4f2795));this[_0xcab7('0xc')][_0x147cca['id']]['on']('email',this[_0xcab7('0x21')][_0xcab7('0x20')](this,_0x4f2795));this[_0xcab7('0xc')][_0x147cca['id']]['on'](_0xcab7('0x22'),this[_0xcab7('0x23')][_0xcab7('0x20')](this,_0x4f2795));this[_0xcab7('0xc')][_0x147cca['id']]['on']('error',this['handleImapError'][_0xcab7('0x20')](this,_0x4f2795));}}else{if(_[_0xcab7('0x16')](this[_0xcab7('0xb')][_0x4f2795]['Imap'])){this[_0xcab7('0xb')][_0x4f2795]['Imap']={};}this['mailAccounts'][_0x4f2795][_0xcab7('0x12')][_0xcab7('0x13')]='disabled';this[_0xcab7('0xb')][_0x4f2795][_0xcab7('0x12')]['messageStatus']='';this[_0xcab7('0xe')](_0x4f2795);}}}};EmailChannel[_0xcab7('0x18')][_0xcab7('0x1f')]=function(_0x4f0c39,_0x23cf12){if(this[_0xcab7('0xb')][_0x4f0c39]){this['mailAccounts'][_0x4f0c39][_0xcab7('0x12')]['status']=_0xcab7('0x24');this[_0xcab7('0xb')][_0x4f0c39][_0xcab7('0x12')][_0xcab7('0x14')]=_0x23cf12['name'];if(_0x23cf12[_0xcab7('0x25')]){this['mailAccounts'][_0x4f0c39][_0xcab7('0x12')]['total']=_0x23cf12[_0xcab7('0x25')][_0xcab7('0x15')];}return this[_0xcab7('0xe')](_0x4f0c39);}};EmailChannel[_0xcab7('0x18')][_0xcab7('0x21')]=function(_0x3fa645,_0x4470e2){logger[_0xcab7('0x26')](_0xcab7('0x27'),_0x4470e2[_0xcab7('0x28')],_0x4470e2[_0xcab7('0x29')],_0x4470e2[_0xcab7('0x2a')],_0x3fa645);if(this[_0xcab7('0xb')][_0x3fa645]){return mailAccount[_0xcab7('0x2b')](_0x3fa645,_0x4470e2)['then'](function(_0x50d0de){if(_0x50d0de){logger[_0xcab7('0x26')]('Mail\x20accepted\x20from\x20routing');}})[_0xcab7('0x2c')](function(_0x207aa4){logger[_0xcab7('0x2d')](_0xcab7('0x2e'),JSON[_0xcab7('0x17')](_0x207aa4));});}};EmailChannel[_0xcab7('0x18')][_0xcab7('0x23')]=function(_0x10d84b){if(this[_0xcab7('0xb')][_0x10d84b]&&this['mailAccounts'][_0x10d84b][_0xcab7('0x12')]){if(this['imapAccounts'][this[_0xcab7('0xb')][_0x10d84b][_0xcab7('0x12')]['id']]){delete this[_0xcab7('0xc')][this['mailAccounts'][_0x10d84b][_0xcab7('0x12')]['id']];}this[_0xcab7('0xb')][_0x10d84b]['Imap'][_0xcab7('0x2f')]=moment();this[_0xcab7('0xe')](_0x10d84b);}};EmailChannel[_0xcab7('0x18')][_0xcab7('0x30')]=function(_0xb67bc2,_0x28f401){if(this[_0xcab7('0xb')][_0xb67bc2]){this['mailAccounts'][_0xb67bc2]['Imap']['status']=_0xcab7('0x2d');this[_0xcab7('0xb')][_0xb67bc2][_0xcab7('0x12')]['messageStatus']=_0x28f401;return this['emit'](_0xb67bc2);}};EmailChannel[_0xcab7('0x18')][_0xcab7('0x31')]=function(_0x58196a,_0x2d9d20){return this[_0xcab7('0xd')]['send'](_0x58196a,_0x2d9d20);};EmailChannel[_0xcab7('0x18')][_0xcab7('0x32')]=function(_0xca56f7){var _0x3f4f00=this;if(this['mailAccounts'][_0xca56f7['id']]){if(_[_0xcab7('0x16')](this[_0xcab7('0xb')][_0xca56f7['id']][_0xcab7('0x33')])){this[_0xcab7('0xb')][_0xca56f7['id']][_0xcab7('0x33')]={};}this[_0xcab7('0xb')][_0xca56f7['id']]['Smtp'][_0xcab7('0x2f')]=moment();return new BPromise(function(_0x26976f,_0x15fc34){return _0x3f4f00[_0xcab7('0xd')][_0xcab7('0x34')](_0xca56f7)[_0xcab7('0x35')](function(_0x537807){_0x3f4f00[_0xcab7('0xb')][_0xca56f7['id']][_0xcab7('0x33')][_0xcab7('0x13')]=_0xcab7('0x36');_0x3f4f00[_0xcab7('0xb')][_0xca56f7['id']][_0xcab7('0x33')][_0xcab7('0x14')]='';_0x3f4f00['emit'](_0xca56f7['id']);_0x26976f(_0x537807);})['catch'](function(_0x470364){_0x3f4f00[_0xcab7('0xb')][_0xca56f7['id']]['Smtp'][_0xcab7('0x13')]=_0xcab7('0x2d');_0x3f4f00[_0xcab7('0xb')][_0xca56f7['id']][_0xcab7('0x33')][_0xcab7('0x14')]=_0x470364;_0x3f4f00[_0xcab7('0xe')](_0xca56f7['id']);_0x15fc34(_0x470364);});});}return this[_0xcab7('0xd')][_0xcab7('0x34')](_0xca56f7);};module[_0xcab7('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 996fa57..e924f00 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 _0x9498=['getAccount','connTimeout','authTimeout','service','user','generateXOAuth2Token','CloudProvider','password','authentication','host','port','tls','required','handleReady','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','end','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','handleFetchError','stringify','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','account','once','bind','handleEnd','error','connect','inherits','prototype'];(function(_0x3c8cd1,_0x32e9cb){var _0x193ab7=function(_0x1003f1){while(--_0x1003f1){_0x3c8cd1['push'](_0x3c8cd1['shift']());}};_0x193ab7(++_0x32e9cb);}(_0x9498,0x105));var _0x8949=function(_0x4ad7bd,_0x42bc63){_0x4ad7bd=_0x4ad7bd-0x0;var _0x4fc366=_0x9498[_0x4ad7bd];return _0x4fc366;};'use strict';var _=require(_0x8949('0x0'));var util=require(_0x8949('0x1'));var Imap=require(_0x8949('0x2'));var simpleParser=require(_0x8949('0x3'))[_0x8949('0x4')];var Iconv=require(_0x8949('0x5'))[_0x8949('0x6')];var EventEmitter=require('events')[_0x8949('0x7')];var utils=require('./utils');var logger=require(_0x8949('0x8'))(_0x8949('0x9'));function EmailImap(_0x38f043,_0xb2466c){this[_0x8949('0xa')]=_0x38f043[_0x8949('0xa')];this[_0x8949('0xb')]=this['getAccount'](_0x38f043,_0xb2466c);this[_0x8949('0x2')]=new Imap(this[_0x8949('0xb')]);this[_0x8949('0x2')][_0x8949('0xc')]('ready',this['handleReady'][_0x8949('0xd')](this));this[_0x8949('0x2')][_0x8949('0xc')]('end',this[_0x8949('0xe')]['bind'](this));this[_0x8949('0x2')]['on'](_0x8949('0xf'),this['handleError'][_0x8949('0xd')](this));this[_0x8949('0x2')][_0x8949('0x10')]();}util[_0x8949('0x11')](EmailImap,EventEmitter);EmailImap[_0x8949('0x12')][_0x8949('0x13')]=function(_0x23dbca,_0xf36c8f){var _0xd0dd59={'connTimeout':_0x23dbca[_0x8949('0x14')]?_0x23dbca[_0x8949('0x14')]*0x3e8:0x2710,'authTimeout':_0x23dbca[_0x8949('0x15')]?_0x23dbca[_0x8949('0x15')]*0x3e8:0x1388};if(_0x23dbca[_0x8949('0x16')]){_0xd0dd59[_0x8949('0x17')]=_0x23dbca[_0x8949('0x17')];if(_0x23dbca['modernAuthentication']){_0xd0dd59['xoauth2']=utils[_0x8949('0x18')](_0x23dbca[_0x8949('0x19')]['data5'],_0x23dbca['user']);}else{_0xd0dd59[_0x8949('0x1a')]=_0x23dbca['password'];}}else{if(_0x23dbca[_0x8949('0x1b')]){_0xd0dd59[_0x8949('0x17')]=_0x23dbca['user'];_0xd0dd59[_0x8949('0x1a')]=_0x23dbca['password'];}}_0xd0dd59['email']=_0xf36c8f||_0x23dbca[_0x8949('0x17')]||'anonymous@xcally.com';_0xd0dd59['host']=_0x23dbca[_0x8949('0x1c')];_0xd0dd59['port']=_0x23dbca[_0x8949('0x1d')]||0x3e1;if(_0x23dbca[_0x8949('0x1e')]){_0xd0dd59[_0x8949('0x1e')]=!![];}else{_0xd0dd59[_0x8949('0x1e')]=![];_0xd0dd59['autotls']=_0x8949('0x1f');}return _0xd0dd59;};EmailImap['prototype'][_0x8949('0x20')]=function(){this['imap']['openBox'](this[_0x8949('0xa')],![],this[_0x8949('0x21')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x4f2a88,_0x219339){if(_0x4f2a88){this[_0x8949('0x22')](_0x4f2a88,!![]);}else{this[_0x8949('0x23')]('box',_0x219339);this[_0x8949('0x24')]();}};EmailImap[_0x8949('0x12')][_0x8949('0x25')]=function(_0x530cd6){if(_0x530cd6){this[_0x8949('0x22')](_0x530cd6,!![]);}else{this['imap'][_0x8949('0x26')]();}};EmailImap[_0x8949('0x12')][_0x8949('0x24')]=function(){this[_0x8949('0x2')][_0x8949('0x27')](['UNSEEN'],this[_0x8949('0x28')][_0x8949('0xd')](this));};EmailImap[_0x8949('0x12')]['handleReadUnseen']=function(_0x13c4d5,_0xf332e5){if(_0x13c4d5){this[_0x8949('0x22')](_0x13c4d5,!![]);}else{if(_0xf332e5['length']){try{var _0x29974d=this[_0x8949('0x2')][_0x8949('0x29')](_0xf332e5,{'bodies':'','markSeen':!![]});_0x29974d['on'](_0x8949('0x2a'),this[_0x8949('0x2b')][_0x8949('0xd')](this));_0x29974d['once'](_0x8949('0xf'),this['handleFetchError'][_0x8949('0xd')](this));_0x29974d[_0x8949('0xc')]('end',this[_0x8949('0x2c')][_0x8949('0xd')](this));}catch(_0x175953){logger['error'](_0x175953);}}else{this['imap'][_0x8949('0x2d')](!![],this[_0x8949('0x25')][_0x8949('0xd')](this));}}};EmailImap['prototype'][_0x8949('0x2b')]=function(_0xfffc34){_0xfffc34['on'](_0x8949('0x2e'),this['handleMessageBody'][_0x8949('0xd')](this));_0xfffc34[_0x8949('0xc')](_0x8949('0x2f'),this['handleMessageAttributes']['bind'](this));_0xfffc34[_0x8949('0xc')](_0x8949('0x26'),this[_0x8949('0x30')][_0x8949('0xd')](this));};EmailImap['prototype'][_0x8949('0x31')]=function(_0xced64c){simpleParser(_0xced64c,{'Iconv':Iconv},this[_0x8949('0x32')][_0x8949('0xd')](this));};EmailImap[_0x8949('0x12')][_0x8949('0x33')]=function(){};EmailImap[_0x8949('0x12')][_0x8949('0x30')]=function(){};EmailImap[_0x8949('0x12')][_0x8949('0x32')]=function(_0x29d2c4,_0x4117d9){if(_0x29d2c4){logger['error'](_0x29d2c4);}else{var _0x2324ad=this;utils['parser'](this[_0x8949('0xb')],_0x4117d9,function(_0x7dd8c9){_0x2324ad[_0x8949('0x23')]('email',_0x7dd8c9);});}};EmailImap[_0x8949('0x12')]['handleFetchEnd']=function(){this[_0x8949('0x2')][_0x8949('0x2d')](!![],this[_0x8949('0x25')][_0x8949('0xd')](this));};EmailImap[_0x8949('0x12')][_0x8949('0x34')]=function(_0x41efa1){this[_0x8949('0x22')](_0x41efa1);this['imap']['closeBox'](!![],this['handleCloseBox'][_0x8949('0xd')](this));};EmailImap[_0x8949('0x12')]['handleEnd']=function(){this['emit']('end');};EmailImap['prototype'][_0x8949('0x22')]=function(_0xc0a1d1,_0x70db5c){logger[_0x8949('0xf')](_0x8949('0x22'),this[_0x8949('0xb')][_0x8949('0x9')],JSON[_0x8949('0x35')](_0xc0a1d1));var _0x55e83a='';if(_0xc0a1d1){if(_0xc0a1d1['textCode']){_0x55e83a=_0xc0a1d1['textCode'];}else{for(var _0x18bbdb in _0xc0a1d1){if(_0xc0a1d1['hasOwnProperty'](_0x18bbdb)){_0x55e83a+=_[_0x8949('0x36')](_0x18bbdb)+':\x20'+_0xc0a1d1[_0x18bbdb]+'\x0a';}}}}if(_0x70db5c){this['imap'][_0x8949('0x26')]();}else{this[_0x8949('0x23')](_0x8949('0xf'),_0x55e83a);this[_0x8949('0x23')](_0x8949('0x26'));}};module[_0x8949('0x37')]=EmailImap; \ No newline at end of file +var _0xd101=['fetch','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','lodash','util','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','CloudProvider','password','authentication','anonymous@xcally.com','port','tls','autotls','required','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xd101,0xcd));var _0x1d10=function(_0x137705,_0x601f3a){_0x137705=_0x137705-0x0;var _0x3413fb=_0xd101[_0x137705];return _0x3413fb;};'use strict';var _=require(_0x1d10('0x0'));var util=require(_0x1d10('0x1'));var Imap=require('imap');var simpleParser=require(_0x1d10('0x2'))[_0x1d10('0x3')];var Iconv=require(_0x1d10('0x4'))[_0x1d10('0x5')];var EventEmitter=require(_0x1d10('0x6'))[_0x1d10('0x7')];var utils=require(_0x1d10('0x8'));var logger=require(_0x1d10('0x9'))(_0x1d10('0xa'));function EmailImap(_0xa0958f,_0x4dc352){this[_0x1d10('0xb')]=_0xa0958f[_0x1d10('0xb')];this[_0x1d10('0xc')]=this[_0x1d10('0xd')](_0xa0958f,_0x4dc352);this[_0x1d10('0xe')]=new Imap(this[_0x1d10('0xc')]);this[_0x1d10('0xe')][_0x1d10('0xf')](_0x1d10('0x10'),this[_0x1d10('0x11')][_0x1d10('0x12')](this));this[_0x1d10('0xe')][_0x1d10('0xf')](_0x1d10('0x13'),this[_0x1d10('0x14')][_0x1d10('0x12')](this));this['imap']['on']('error',this[_0x1d10('0x15')][_0x1d10('0x12')](this));this[_0x1d10('0xe')][_0x1d10('0x16')]();}util[_0x1d10('0x17')](EmailImap,EventEmitter);EmailImap[_0x1d10('0x18')][_0x1d10('0xd')]=function(_0xb9450c,_0x210fb4){var _0x4a8723={'connTimeout':_0xb9450c['connTimeout']?_0xb9450c[_0x1d10('0x19')]*0x3e8:0x2710,'authTimeout':_0xb9450c[_0x1d10('0x1a')]?_0xb9450c['authTimeout']*0x3e8:0x1388};if(_0xb9450c['service']){_0x4a8723[_0x1d10('0x1b')]=_0xb9450c[_0x1d10('0x1b')];if(_0xb9450c[_0x1d10('0x1c')]){_0x4a8723[_0x1d10('0x1d')]=utils['generateXOAuth2Token'](_0xb9450c[_0x1d10('0x1e')]['data5'],_0xb9450c[_0x1d10('0x1b')]);}else{_0x4a8723[_0x1d10('0x1f')]=_0xb9450c[_0x1d10('0x1f')];}}else{if(_0xb9450c[_0x1d10('0x20')]){_0x4a8723['user']=_0xb9450c[_0x1d10('0x1b')];_0x4a8723[_0x1d10('0x1f')]=_0xb9450c['password'];}}_0x4a8723[_0x1d10('0xa')]=_0x210fb4||_0xb9450c[_0x1d10('0x1b')]||_0x1d10('0x21');_0x4a8723['host']=_0xb9450c['host'];_0x4a8723[_0x1d10('0x22')]=_0xb9450c[_0x1d10('0x22')]||0x3e1;if(_0xb9450c[_0x1d10('0x23')]){_0x4a8723[_0x1d10('0x23')]=!![];}else{_0x4a8723['tls']=![];_0x4a8723[_0x1d10('0x24')]=_0x1d10('0x25');}return _0x4a8723;};EmailImap['prototype'][_0x1d10('0x11')]=function(){this['imap'][_0x1d10('0x26')](this[_0x1d10('0xb')],![],this[_0x1d10('0x27')][_0x1d10('0x12')](this));};EmailImap[_0x1d10('0x18')]['handleOpenBox']=function(_0x129910,_0x15f44c){if(_0x129910){this['handleError'](_0x129910,!![]);}else{this[_0x1d10('0x28')]('box',_0x15f44c);this[_0x1d10('0x29')]();}};EmailImap[_0x1d10('0x18')][_0x1d10('0x2a')]=function(_0x5ac4d5){if(_0x5ac4d5){this[_0x1d10('0x15')](_0x5ac4d5,!![]);}else{this['imap'][_0x1d10('0x13')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x1d10('0xe')][_0x1d10('0x2b')]([_0x1d10('0x2c')],this[_0x1d10('0x2d')][_0x1d10('0x12')](this));};EmailImap[_0x1d10('0x18')][_0x1d10('0x2d')]=function(_0x429c00,_0x5e592d){if(_0x429c00){this[_0x1d10('0x15')](_0x429c00,!![]);}else{if(_0x5e592d[_0x1d10('0x2e')]){try{var _0x5743e5=this[_0x1d10('0xe')][_0x1d10('0x2f')](_0x5e592d,{'bodies':'','markSeen':!![]});_0x5743e5['on']('message',this[_0x1d10('0x30')]['bind'](this));_0x5743e5[_0x1d10('0xf')](_0x1d10('0x31'),this[_0x1d10('0x32')][_0x1d10('0x12')](this));_0x5743e5[_0x1d10('0xf')](_0x1d10('0x13'),this[_0x1d10('0x33')][_0x1d10('0x12')](this));}catch(_0x4ca482){logger[_0x1d10('0x31')](_0x4ca482);}}else{this['imap'][_0x1d10('0x34')](!![],this[_0x1d10('0x2a')]['bind'](this));}}};EmailImap[_0x1d10('0x18')]['handleFetchMessage']=function(_0x479de4){_0x479de4['on'](_0x1d10('0x35'),this[_0x1d10('0x36')]['bind'](this));_0x479de4[_0x1d10('0xf')](_0x1d10('0x37'),this[_0x1d10('0x38')]['bind'](this));_0x479de4['once'](_0x1d10('0x13'),this[_0x1d10('0x39')][_0x1d10('0x12')](this));};EmailImap[_0x1d10('0x18')]['handleMessageBody']=function(_0x1178c2){simpleParser(_0x1178c2,{'Iconv':Iconv},this[_0x1d10('0x3a')]['bind'](this));};EmailImap[_0x1d10('0x18')]['handleMessageAttributes']=function(){};EmailImap[_0x1d10('0x18')][_0x1d10('0x39')]=function(){};EmailImap['prototype'][_0x1d10('0x3a')]=function(_0x4c1d15,_0x589a01){if(_0x4c1d15){logger[_0x1d10('0x31')](_0x4c1d15);}else{var _0x48939d=this;utils[_0x1d10('0x3b')](this[_0x1d10('0xc')],_0x589a01,function(_0x59c776){_0x48939d['emit'](_0x1d10('0xa'),_0x59c776);});}};EmailImap['prototype'][_0x1d10('0x33')]=function(){this[_0x1d10('0xe')][_0x1d10('0x34')](!![],this[_0x1d10('0x2a')][_0x1d10('0x12')](this));};EmailImap[_0x1d10('0x18')]['handleFetchError']=function(_0x2721a3){this[_0x1d10('0x15')](_0x2721a3);this[_0x1d10('0xe')][_0x1d10('0x34')](!![],this[_0x1d10('0x2a')][_0x1d10('0x12')](this));};EmailImap[_0x1d10('0x18')][_0x1d10('0x14')]=function(){this[_0x1d10('0x28')]('end');};EmailImap[_0x1d10('0x18')]['handleError']=function(_0x10970c,_0x31456b){logger[_0x1d10('0x31')](_0x1d10('0x15'),this[_0x1d10('0xc')][_0x1d10('0xa')],JSON['stringify'](_0x10970c));var _0x585b12='';if(_0x10970c){if(_0x10970c[_0x1d10('0x3c')]){_0x585b12=_0x10970c[_0x1d10('0x3c')];}else{for(var _0x5bb498 in _0x10970c){if(_0x10970c[_0x1d10('0x3d')](_0x5bb498)){_0x585b12+=_[_0x1d10('0x3e')](_0x5bb498)+':\x20'+_0x10970c[_0x5bb498]+'\x0a';}}}}if(_0x31456b){this[_0x1d10('0xe')][_0x1d10('0x13')]();}else{this[_0x1d10('0x28')](_0x1d10('0x31'),_0x585b12);this['emit'](_0x1d10('0x13'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 7980d67..4f27357 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 _0x522f=['Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','compile','verify'];(function(_0x336265,_0x680dcc){var _0x3450be=function(_0x198ff4){while(--_0x198ff4){_0x336265['push'](_0x336265['shift']());}};_0x3450be(++_0x680dcc);}(_0x522f,0xb1));var _0xf522=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x522f[_0x57b54c];return _0x59cc19;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xf522('0x0'));function EmailSmtp(){}EmailSmtp[_0xf522('0x1')][_0xf522('0x2')]=function(_0x353eae,_0x1582f1){return new Promise(function(_0xc58127,_0x26eb6d){var _0x4d17d9=nodemailer['createTransport'](_0x353eae);_0x4d17d9['use'](_0xf522('0x3'),inlineBase64());_0x4d17d9['sendMail'](_0x1582f1,function(_0x4a5202,_0x378e18){if(_0x4a5202){_0x26eb6d(_0x4a5202['toString']());}else{_0xc58127(_0x378e18);}});});};EmailSmtp[_0xf522('0x1')]['verify']=function(_0x4052bc){return new Promise(function(_0x2c45df,_0x2d0813){var _0x3f0c89=nodemailer['createTransport'](_0x4052bc);_0x3f0c89[_0xf522('0x4')](function(_0x3ba954,_0x23c60f){if(_0x3ba954){_0x2d0813(_0x3ba954['toString']());}else{if(_0x23c60f){_0x2c45df(_0x23c60f);}else{_0x2d0813(_0xf522('0x5'));}}});});};module[_0xf522('0x6')]=EmailSmtp; \ No newline at end of file +var _0x6cd6=['compile','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','createTransport','use'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x6cd6,0x1a3));var _0x66cd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6cd6[_0x321bb2];return _0x9c12ed;};'use strict';var nodemailer=require(_0x66cd('0x0'));var inlineBase64=require(_0x66cd('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x531b29,_0x306780){return new Promise(function(_0x4d62f5,_0x4fa9a7){var _0x1c0a3e=nodemailer[_0x66cd('0x2')](_0x531b29);_0x1c0a3e[_0x66cd('0x3')](_0x66cd('0x4'),inlineBase64());_0x1c0a3e[_0x66cd('0x5')](_0x306780,function(_0x97e229,_0x239cc1){if(_0x97e229){_0x4fa9a7(_0x97e229[_0x66cd('0x6')]());}else{_0x4d62f5(_0x239cc1);}});});};EmailSmtp['prototype']['verify']=function(_0x28bbf6){return new Promise(function(_0x2778a4,_0x3e4324){var _0x47c832=nodemailer['createTransport'](_0x28bbf6);_0x47c832[_0x66cd('0x7')](function(_0x3d61b5,_0x4c901f){if(_0x3d61b5){_0x3e4324(_0x3d61b5['toString']());}else{if(_0x4c901f){_0x2778a4(_0x4c901f);}else{_0x3e4324('Not\x20verifired');}}});});};module[_0x66cd('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2ab1d82..a24c668 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 _0x962e=['../../../config/logger','email','head','value','address','generate','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','@xcally.com','html','test','replace','\x20[Attachment:\x20','body','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','path','util','node-tnef'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x962e,0x1ee));var _0xe962=function(_0x1f058b,_0x4a47cf){_0x1f058b=_0x1f058b-0x0;var _0x5c5232=_0x962e[_0x1f058b];return _0x5c5232;};'use strict';var _=require('lodash');var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0xe962('0x0'));var util=require(_0xe962('0x1'));var tnef=require(_0xe962('0x2'));var logger=require(_0xe962('0x3'))(_0xe962('0x4'));var config=require('../../../config/environment');function getAddress(_0x535a12){var _0x1aaf25=_[_0xe962('0x5')](_0x535a12[_0xe962('0x6')]);return _0x1aaf25&&_0x1aaf25[_0xe962('0x7')]?_0x1aaf25['address']:'anonymous'+random[_0xe962('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x253c3b){var _0x56b2f7=_[_0xe962('0x5')](_0x253c3b[_0xe962('0x6')]);if(_0x56b2f7&&_0x56b2f7[_0xe962('0x9')]){if(_0x56b2f7[_0xe962('0x9')]==_0x56b2f7[_0xe962('0x7')]){return _0x56b2f7[_0xe962('0x9')][_0xe962('0xa')](0x0,_0x56b2f7[_0xe962('0x9')][_0xe962('0xb')]('@'));}var _0x27682d=_0x56b2f7[_0xe962('0x9')][_0xe962('0xc')](/\s+/);return _0x27682d[_0xe962('0xd')]>0x1?_0x27682d[_0xe962('0xe')](0x0,-0x1)[_0xe962('0xf')]('\x20'):_0x56b2f7[_0xe962('0x9')];}return _0xe962('0x10');}function getLastName(_0x5c3de8){var _0x14cb0b=_[_0xe962('0x5')](_0x5c3de8[_0xe962('0x6')]);if(_0x14cb0b&&_0x14cb0b[_0xe962('0x9')]){var _0x2f901d=_0x14cb0b[_0xe962('0x9')][_0xe962('0xc')](/\s+/);return _0x2f901d[_0xe962('0xd')]>0x1?_0x2f901d[_0xe962('0x11')]():'';}return'';}function getMails(_0x294779,_0xf2cdae){var _0x25451d='';for(var _0x44390f=0x0;_0x44390f<_0xf2cdae[_0xe962('0x6')]['length'];_0x44390f+=0x1){if(_0xf2cdae['value'][_0x44390f][_0xe962('0x7')]!==_0x294779){if(!_[_0xe962('0x12')](_0x25451d)){_0x25451d+=',';}_0x25451d+=_0xf2cdae['value'][_0x44390f][_0xe962('0x9')]||_0xf2cdae[_0xe962('0x6')][_0x44390f][_0xe962('0x7')]||'';_0x25451d+='\x20<';_0x25451d+=_0xf2cdae[_0xe962('0x6')][_0x44390f][_0xe962('0x7')]?_0xf2cdae[_0xe962('0x6')][_0x44390f][_0xe962('0x7')]:_0xe962('0x13')+random[_0xe962('0x8')](0x6)+_0xe962('0x14');_0x25451d+='>';}}return _0x25451d;}function parseEmail(_0x236c30,_0xcc97d9,_0x3e26b0){if(_0xcc97d9[_0xe962('0x15')]){var _0x5d193a=/)<[^<]*)*<\/script>/gi;while(_0x5d193a[_0xe962('0x16')](_0xcc97d9[_0xe962('0x15')])){_0xcc97d9[_0xe962('0x15')]=_0xcc97d9[_0xe962('0x15')][_0xe962('0x17')](_0x5d193a,'');}if(_0xcc97d9[_0xe962('0x15')]['includes'](_0xe962('0x18'))){var _0x44eea4=[];_0xcc97d9['attachments']['forEach'](_0x12ee64=>{_0x44eea4[_0xe962('0x19')](_0x12ee64[_0xe962('0x1a')]);});var _0x3da0e1=/]+>/g;var _0x12c54c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2799d5=_0xcc97d9[_0xe962('0x15')][_0xe962('0x17')](_0x12c54c,'_SRC');var _0x406219=_0x2799d5[_0xe962('0x17')](_0x3da0e1,'_IMG');for(let _0x8f7f5b=0x0;_0x8f7f5b<_0x44eea4[_0xe962('0xd')];_0x8f7f5b++){var _0x40b804=_0x406219['replace'](_0xe962('0x1b'),_0xe962('0x1c')+_0x44eea4[_0x8f7f5b]+'\x20]');_0x406219=_0x40b804;}_0xcc97d9[_0xe962('0x15')]=_0x406219;}_0x3e26b0[_0xe962('0x1d')]=_0xcc97d9[_0xe962('0x15')];}else{_0x3e26b0[_0xe962('0x1d')]=_0xcc97d9['textAsHtml'];}if(_0x3e26b0[_0xe962('0x1d')]){_0x3e26b0[_0xe962('0x1d')]=_0x3e26b0['body'][_0xe962('0x17')](/0x0){var _0x547ba1=['Auto-Submitted:\x20auto-replied',_0xe962('0x2e'),_0xe962('0x2f')];for(var _0x9ea686=0x0;_0x9ea686<_0xcc97d9[_0xe962('0x2d')][_0xe962('0xd')];_0x9ea686++){var _0x1290a5=_[_0xe962('0xb')](_0x547ba1,_0xcc97d9[_0xe962('0x2d')][_0x9ea686][_0xe962('0x30')]);if(_0x1290a5>=0x0){_0x3e26b0[_0xe962('0x31')]=!![];}}}return _0x3e26b0;}exports[_0xe962('0x32')]=function(_0x4fc004,_0x16927c,_0x207286){var _0xae2fd1={'from':getAddress(_0x16927c[_0xe962('0x33')]),'firstName':getFirstName(_0x16927c[_0xe962('0x33')]),'lastName':getLastName(_0x16927c[_0xe962('0x33')]),'mapKey':_0xe962('0x4'),'message':{'from':getMails(_0x4fc004[_0xe962('0x4')],_0x16927c[_0xe962('0x33')]),'to':_0x4fc004[_0xe962('0x4')],'cc':'','subject':_0x16927c['subject']||'','messageId':_0x16927c[_0xe962('0x34')],'inReplyTo':_0x16927c[_0xe962('0x35')],'sentAt':moment(_0x16927c[_0xe962('0x36')])[_0xe962('0x26')](_0xe962('0x37')),'attach':![],'attachments':[]}};if(!_0x16927c['html']&&!_0x16927c[_0xe962('0x38')]){var _0x1417a1=_['filter'](_0x16927c[_0xe962('0x23')],{'contentType':_0xe962('0x39')});if(_0x1417a1[_0xe962('0xd')]){logger[_0xe962('0x3a')](util[_0xe962('0x26')](_0xe962('0x3b'),_0x16927c['messageId']));tnef[_0xe962('0x3c')](_[_0xe962('0x3d')](_0x1417a1)['content'],function(_0x1de0f2,_0x3722a7){if(_0x3722a7){_0x16927c['html']=_0x3722a7[_0xe962('0x3e')]||'

Empty\x20message

';if(_0x3722a7[_0xe962('0x3f')]){for(var _0x1b8156=0x0;_0x1b8156<_0x3722a7[_0xe962('0x3f')][_0xe962('0xd')];_0x1b8156++){var _0x4e9cd5=_0x3722a7['Attachments'][_0x1b8156];_0xae2fd1[_0xe962('0x1f')]['attachments'][_0xe962('0x19')]({'filename':_0x4e9cd5['Title'],'content':Buffer['from'](_0x4e9cd5[_0xe962('0x40')])});}}}_0x207286(parseEmail(_0x4fc004,_0x16927c,_0xae2fd1));});}else{_0x16927c[_0xe962('0x15')]=_0xe962('0x41');_0x207286(parseEmail(_0x4fc004,_0x16927c,_0xae2fd1));}}else{_0x207286(parseEmail(_0x4fc004,_0x16927c,_0xae2fd1));}};exports[_0xe962('0x42')]=function(_0x466540,_0xf9df2b){var _0x50849b=[_0xe962('0x43')+(_0xf9df2b||''),_0xe962('0x44')+_0x466540,'',''];return Buffer['from'](_0x50849b[_0xe962('0xf')](''),_0xe962('0x45'))['toString'](_0xe962('0x46'));}; \ No newline at end of file +var _0x1376=['contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser','from','subject','messageId','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','email','../../../config/environment','head','value','address','@xcally.com','name','substring','length','slice','Anonymous','pop','isEmpty','anonymous','generate','html','replace','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x31d892[_0x6137('0xe')](0x0,-0x1)['join']('\x20'):_0x35a74e[_0x6137('0xb')];}return _0x6137('0xf');}function getLastName(_0x5b74d2){var _0x394bca=_[_0x6137('0x7')](_0x5b74d2[_0x6137('0x8')]);if(_0x394bca&&_0x394bca[_0x6137('0xb')]){var _0x25bb51=_0x394bca['name']['split'](/\s+/);return _0x25bb51['length']>0x1?_0x25bb51[_0x6137('0x10')]():'';}return'';}function getMails(_0x4a678c,_0x3e4e14){var _0x16f499='';for(var _0x40470c=0x0;_0x40470c<_0x3e4e14[_0x6137('0x8')]['length'];_0x40470c+=0x1){if(_0x3e4e14[_0x6137('0x8')][_0x40470c][_0x6137('0x9')]!==_0x4a678c){if(!_[_0x6137('0x11')](_0x16f499)){_0x16f499+=',';}_0x16f499+=_0x3e4e14['value'][_0x40470c][_0x6137('0xb')]||_0x3e4e14[_0x6137('0x8')][_0x40470c]['address']||'';_0x16f499+='\x20<';_0x16f499+=_0x3e4e14[_0x6137('0x8')][_0x40470c][_0x6137('0x9')]?_0x3e4e14['value'][_0x40470c]['address']:_0x6137('0x12')+random[_0x6137('0x13')](0x6)+'@xcally.com';_0x16f499+='>';}}return _0x16f499;}function parseEmail(_0x629c54,_0x439b7e,_0x23e3be){if(_0x439b7e[_0x6137('0x14')]){var _0x351ef1=/)<[^<]*)*<\/script>/gi;while(_0x351ef1['test'](_0x439b7e[_0x6137('0x14')])){_0x439b7e[_0x6137('0x14')]=_0x439b7e[_0x6137('0x14')][_0x6137('0x15')](_0x351ef1,'');}if(_0x439b7e[_0x6137('0x14')]['includes'](_0x6137('0x16'))){var _0x523071=[];_0x439b7e[_0x6137('0x17')][_0x6137('0x18')](_0x40cfe7=>{_0x523071[_0x6137('0x19')](_0x40cfe7[_0x6137('0x1a')]);});var _0xd44cc0=/]+>/g;var _0xfe0e8f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x46f861=_0x439b7e[_0x6137('0x14')]['replace'](_0xfe0e8f,_0x6137('0x1b'));var _0x521ce8=_0x46f861['replace'](_0xd44cc0,_0x6137('0x1c'));for(let _0x1c6d55=0x0;_0x1c6d55<_0x523071['length'];_0x1c6d55++){var _0x5443f7=_0x521ce8[_0x6137('0x15')](_0x6137('0x1c'),_0x6137('0x1d')+_0x523071[_0x1c6d55]+'\x20]');_0x521ce8=_0x5443f7;}_0x439b7e[_0x6137('0x14')]=_0x521ce8;}_0x23e3be[_0x6137('0x1e')]=_0x439b7e[_0x6137('0x14')];}else{_0x23e3be['body']=_0x439b7e[_0x6137('0x1f')];}if(_0x23e3be[_0x6137('0x1e')]){_0x23e3be[_0x6137('0x1e')]=_0x23e3be['body'][_0x6137('0x15')](/0x0){var _0x45ab5a=[_0x6137('0x34'),_0x6137('0x35'),_0x6137('0x36')];for(var _0x1268a6=0x0;_0x1268a6<_0x439b7e[_0x6137('0x33')][_0x6137('0xd')];_0x1268a6++){var _0x48150c=_['indexOf'](_0x45ab5a,_0x439b7e[_0x6137('0x33')][_0x1268a6][_0x6137('0x37')]);if(_0x48150c>=0x0){_0x23e3be['isAutoreply']=!![];}}}return _0x23e3be;}exports[_0x6137('0x38')]=function(_0x5413b3,_0x178037,_0x17c265){var _0x4dc76b={'from':getAddress(_0x178037['from']),'firstName':getFirstName(_0x178037['from']),'lastName':getLastName(_0x178037[_0x6137('0x39')]),'mapKey':_0x6137('0x5'),'message':{'from':getMails(_0x5413b3[_0x6137('0x5')],_0x178037[_0x6137('0x39')]),'to':_0x5413b3[_0x6137('0x5')],'cc':'','subject':_0x178037[_0x6137('0x3a')]||'','messageId':_0x178037[_0x6137('0x3b')],'inReplyTo':_0x178037['inReplyTo'],'sentAt':moment(_0x178037['date'])[_0x6137('0x2a')](_0x6137('0x3c')),'attach':![],'attachments':[]}};if(!_0x178037[_0x6137('0x14')]&&!_0x178037[_0x6137('0x1f')]){var _0x5d0776=_[_0x6137('0x3d')](_0x178037['attachments'],{'contentType':_0x6137('0x3e')});if(_0x5d0776[_0x6137('0xd')]){logger[_0x6137('0x3f')](util[_0x6137('0x2a')](_0x6137('0x40'),_0x178037[_0x6137('0x3b')]));tnef['parseBuffer'](_[_0x6137('0x41')](_0x5d0776)['content'],function(_0x23838f,_0x36fff5){if(_0x36fff5){_0x178037[_0x6137('0x14')]=_0x36fff5['BodyHTML']||_0x6137('0x42');if(_0x36fff5[_0x6137('0x43')]){for(var _0x53f4a5=0x0;_0x53f4a5<_0x36fff5[_0x6137('0x43')][_0x6137('0xd')];_0x53f4a5++){var _0x2ee7c1=_0x36fff5[_0x6137('0x43')][_0x53f4a5];_0x4dc76b[_0x6137('0x21')][_0x6137('0x17')][_0x6137('0x19')]({'filename':_0x2ee7c1[_0x6137('0x44')],'content':Buffer[_0x6137('0x39')](_0x2ee7c1[_0x6137('0x45')])});}}}_0x17c265(parseEmail(_0x5413b3,_0x178037,_0x4dc76b));});}else{_0x178037[_0x6137('0x14')]=_0x6137('0x42');_0x17c265(parseEmail(_0x5413b3,_0x178037,_0x4dc76b));}}else{_0x17c265(parseEmail(_0x5413b3,_0x178037,_0x4dc76b));}};exports[_0x6137('0x46')]=function(_0x36ff9f,_0x981fa1){var _0xc24d46=[_0x6137('0x47')+(_0x981fa1||''),_0x6137('0x48')+_0x36ff9f,'',''];return Buffer[_0x6137('0x39')](_0xc24d46[_0x6137('0x2d')](''),_0x6137('0x49'))[_0x6137('0x4a')](_0x6137('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e960c09..8295213 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 _0x226a=['Service','key','SERV','active','Imap','Smtp','lodash'];(function(_0x58ae51,_0x470d39){var _0xfaede0=function(_0x20178d){while(--_0x20178d){_0x58ae51['push'](_0x58ae51['shift']());}};_0xfaede0(++_0x470d39);}(_0x226a,0x1f0));var _0xa226=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x226a[_0x47cfa0];return _0x386b1d;};'use strict';var _=require(_0xa226('0x0'));function MailAccount(_0x3f87b3){this['id']=_0x3f87b3['id']||0x0;this['name']=_0x3f87b3['name']||_0xa226('0x1');this[_0xa226('0x2')]=_0x3f87b3[_0xa226('0x2')]||_0xa226('0x3');this[_0xa226('0x4')]=_0x3f87b3[_0xa226('0x4')]||![];this['Imap']=_0x3f87b3[_0xa226('0x5')]||[];this[_0xa226('0x6')]=_0x3f87b3[_0xa226('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x66c2=['active','Imap','Smtp','exports','lodash','name','key'];(function(_0x13f729,_0x2689d0){var _0x5d1288=function(_0xd85899){while(--_0xd85899){_0x13f729['push'](_0x13f729['shift']());}};_0x5d1288(++_0x2689d0);}(_0x66c2,0xdd));var _0x266c=function(_0x10cc6d,_0xef7adc){_0x10cc6d=_0x10cc6d-0x0;var _0x56fd87=_0x66c2[_0x10cc6d];return _0x56fd87;};'use strict';var _=require(_0x266c('0x0'));function MailAccount(_0x532f6a){this['id']=_0x532f6a['id']||0x0;this[_0x266c('0x1')]=_0x532f6a[_0x266c('0x1')]||'Service';this[_0x266c('0x2')]=_0x532f6a[_0x266c('0x2')]||'SERV';this[_0x266c('0x3')]=_0x532f6a['active']||![];this[_0x266c('0x4')]=_0x532f6a[_0x266c('0x4')]||[];this[_0x266c('0x5')]=_0x532f6a[_0x266c('0x5')]||[];}module[_0x266c('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 73d3d77..e307b15 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 _0x55ac=['initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x55ac,0xee));var _0xc55a=function(_0x5bb063,_0x38396a){_0x5bb063=_0x5bb063-0x0;var _0x5654c2=_0x55ac[_0x5bb063];return _0x5654c2;};'use strict';var _=require(_0xc55a('0x0'));var MailAccount=require(_0xc55a('0x1'));var Realtime=function(){this[_0xc55a('0x2')]={};};function freeIsNotKey(_0x57accd,_0x5b603c,_0x215ba2){var _0xbd9ee3=_['mapKeys'](_0x57accd,function(_0x5ec51a,_0x2a1277){return _0x5ec51a[_0x215ba2];});for(var _0x543229 in _0x5b603c){if(_0x5b603c[_0xc55a('0x3')](_0x543229)){if(!_0xbd9ee3[_0x543229]){delete _0x5b603c[_0x543229];}}}}Realtime[_0xc55a('0x4')]['mergeFromDatabase']=function(_0x14fed9,_0x30b2ab){for(var _0x5c60b1 in _0x30b2ab){if(_0x14fed9[_0xc55a('0x3')](_0x5c60b1)){_0x14fed9[_0x5c60b1]=_0x30b2ab[_0x5c60b1];}}};Realtime[_0xc55a('0x4')][_0xc55a('0x5')]=function(){var _0x5eccd1=this;return function(_0x2be61a){if(_0x2be61a){freeIsNotKey(_0x2be61a,_0x5eccd1['mailAccounts'],'id');for(var _0x2d8149=0x0,_0x14b152={},_0x37d655={};_0x2d8149<_0x2be61a['length'];_0x2d8149+=0x1){_0x14b152=_0x2be61a[_0x2d8149];if(_[_0xc55a('0x6')](_0x5eccd1[_0xc55a('0x2')][_0x14b152['id']])){_0x5eccd1['mailAccounts'][_0x14b152['id']]=new MailAccount(_0x14b152);}else{_[_0xc55a('0x7')](_0x5eccd1[_0xc55a('0x2')][_0x14b152['id']],_0x14b152);}}}return _0x5eccd1[_0xc55a('0x2')];};};module[_0xc55a('0x8')]=Realtime; \ No newline at end of file +var _0xa960=['prototype','initMailAccounts','mailAccounts','isUndefined','merge','exports','mapKeys','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa960,0xc6));var _0x0a96=function(_0x507dd9,_0x150210){_0x507dd9=_0x507dd9-0x0;var _0x5a1ccb=_0xa960[_0x507dd9];return _0x5a1ccb;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1276ce,_0x997519,_0x38deec){var _0x342f37=_[_0x0a96('0x0')](_0x1276ce,function(_0xd36c46,_0x61e8da){return _0xd36c46[_0x38deec];});for(var _0x48df2d in _0x997519){if(_0x997519[_0x0a96('0x1')](_0x48df2d)){if(!_0x342f37[_0x48df2d]){delete _0x997519[_0x48df2d];}}}}Realtime[_0x0a96('0x2')]['mergeFromDatabase']=function(_0x15577f,_0x2039d2){for(var _0x4b4770 in _0x2039d2){if(_0x15577f[_0x0a96('0x1')](_0x4b4770)){_0x15577f[_0x4b4770]=_0x2039d2[_0x4b4770];}}};Realtime['prototype'][_0x0a96('0x3')]=function(){var _0x595d33=this;return function(_0x2a8d73){if(_0x2a8d73){freeIsNotKey(_0x2a8d73,_0x595d33[_0x0a96('0x4')],'id');for(var _0x319528=0x0,_0x438597={},_0x123023={};_0x319528<_0x2a8d73['length'];_0x319528+=0x1){_0x438597=_0x2a8d73[_0x319528];if(_[_0x0a96('0x5')](_0x595d33[_0x0a96('0x4')][_0x438597['id']])){_0x595d33[_0x0a96('0x4')][_0x438597['id']]=new MailAccount(_0x438597);}else{_[_0x0a96('0x6')](_0x595d33[_0x0a96('0x4')][_0x438597['id']],_0x438597);}}}return _0x595d33[_0x0a96('0x4')];};};module[_0x0a96('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index c42e7a2..3ee3acd 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 _0xa4dc=['Request','NotifyMailAccount','../client','getMailAccounts','name','provider','service','email','active','ListId','TemplateId','MailServerIn','CloudProvider','type','data5','Smtp','getMailAccount','notify'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa4dc,0x16a));var _0xca4d=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xa4dc[_0x2c7618];return _0x5ce3f0;};'use strict';var client=require(_0xca4d('0x0'));exports[_0xca4d('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xca4d('0x2'),_0xca4d('0x3'),_0xca4d('0x4'),_0xca4d('0x5'),_0xca4d('0x6'),'key',_0xca4d('0x7'),_0xca4d('0x8')],'raw':![],'include':[{'model':_0xca4d('0x9'),'as':'Imap','include':[{'model':_0xca4d('0xa'),'attributes':['id','name',_0xca4d('0x4'),_0xca4d('0xb'),_0xca4d('0xc')],'as':_0xca4d('0xa')}]},{'model':'MailServerOut','as':_0xca4d('0xd'),'include':[{'model':_0xca4d('0xa'),'attributes':['id','name',_0xca4d('0x4'),'type',_0xca4d('0xc')],'as':_0xca4d('0xa')}]}]},'log':_0xca4d('0xe')});};};exports[_0xca4d('0xf')]=function(_0x2b7b48,_0x434e77){return client[_0xca4d('0x10')](_0xca4d('0x11'),{'account':{'id':_0x2b7b48},'body':_0x434e77,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x2df7=['provider','service','email','key','ListId','TemplateId','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name'];(function(_0x40de9c,_0x3bf239){var _0x515b58=function(_0xf08a75){while(--_0xf08a75){_0x40de9c['push'](_0x40de9c['shift']());}};_0x515b58(++_0x3bf239);}(_0x2df7,0x1f4));var _0x72df=function(_0x2ebd3e,_0x59ce03){_0x2ebd3e=_0x2ebd3e-0x0;var _0x1b372a=_0x2df7[_0x2ebd3e];return _0x1b372a;};'use strict';var client=require(_0x72df('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x72df('0x1')](_0x72df('0x2'),{'options':{'attributes':['id',_0x72df('0x3'),_0x72df('0x4'),_0x72df('0x5'),_0x72df('0x6'),'active',_0x72df('0x7'),_0x72df('0x8'),_0x72df('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x72df('0xa'),'include':[{'model':_0x72df('0xb'),'attributes':['id','name','service',_0x72df('0xc'),_0x72df('0xd')],'as':'CloudProvider'}]},{'model':_0x72df('0xe'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x72df('0x3'),_0x72df('0x5'),_0x72df('0xc'),_0x72df('0xd')],'as':_0x72df('0xb')}]}]},'log':_0x72df('0xf')});};};exports[_0x72df('0x10')]=function(_0x2f9d2e,_0x406f80){return client[_0x72df('0x1')](_0x72df('0x11'),{'account':{'id':_0x2f9d2e},'body':_0x406f80,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 99b3602..2c935cf 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 _0x5f60=['GetSettings','../client','loginMailFrequency'];(function(_0x565a1,_0x1099cf){var _0x4a9bdb=function(_0x4844db){while(--_0x4844db){_0x565a1['push'](_0x565a1['shift']());}};_0x4a9bdb(++_0x1099cf);}(_0x5f60,0xac));var _0x05f6=function(_0x28d1ea,_0x426311){_0x28d1ea=_0x28d1ea-0x0;var _0x1667b6=_0x5f60[_0x28d1ea];return _0x1667b6;};'use strict';var client=require(_0x05f6('0x0'));exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x05f6('0x1')]},'log':_0x05f6('0x2')});}; \ No newline at end of file +var _0x4c8d=['loginMailFrequency','GetSettings','../client','Request','ShowSetting'];(function(_0x3f0b1f,_0x5554cb){var _0x123659=function(_0x2ee993){while(--_0x2ee993){_0x3f0b1f['push'](_0x3f0b1f['shift']());}};_0x123659(++_0x5554cb);}(_0x4c8d,0x129));var _0xd4c8=function(_0x4a41cd,_0x3fcd11){_0x4a41cd=_0x4a41cd-0x0;var _0xf815ea=_0x4c8d[_0x4a41cd];return _0xf815ea;};'use strict';var client=require(_0xd4c8('0x0'));exports['getSettings']=function(){return client[_0xd4c8('0x1')](_0xd4c8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd4c8('0x3')]},'log':_0xd4c8('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 2295030..a6357a1 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 66facd3..07368fa 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 _0xb839=['default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','sticky-session','ioredis','timeout','port','socket.io','polling','redis','defaults','localhost','adapter'];(function(_0x315861,_0x735b4){var _0x3e2b76=function(_0x436457){while(--_0x436457){_0x315861['push'](_0x315861['shift']());}};_0x3e2b76(++_0x735b4);}(_0xb839,0x6d));var _0x9b83=function(_0x5ea8e6,_0x2b651e){_0x5ea8e6=_0x5ea8e6-0x0;var _0x28c97a=_0xb839[_0x5ea8e6];return _0x28c97a;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x9b83('0x0'));var sticky=require(_0x9b83('0x1'));var Redis=require(_0x9b83('0x2'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server[_0x9b83('0x3')]=0xdbba0;if(sticky['listen'](server,config[_0x9b83('0x4')])){var socketio=require(_0x9b83('0x5'))(server,{'transports':['websocket',_0x9b83('0x6')]});config[_0x9b83('0x7')]=_[_0x9b83('0x8')](config[_0x9b83('0x7')],{'host':_0x9b83('0x9'),'port':0x18eb});socketio[_0x9b83('0xa')](require('socket.io-redis')({'pubClient':new Redis(config[_0x9b83('0x7')]),'subClient':new Redis(config[_0x9b83('0x7')])}));require('../../config/triggers')[_0x9b83('0xb')]();require(_0x9b83('0xc'))[_0x9b83('0xb')](socketio);require(_0x9b83('0xd'))[_0x9b83('0xb')](app);require(_0x9b83('0xe'))[_0x9b83('0xb')](app);}else{server[_0x9b83('0xf')](_0x9b83('0x10'),function(){console[_0x9b83('0x11')](_0x9b83('0x12'),config[_0x9b83('0x4')]);});}exports=module[_0x9b83('0x13')]=app; \ No newline at end of file +var _0x33ec=['lodash','express','sticky-session','ioredis','../../config/environment','listen','port','socket.io','websocket','polling','defaults','redis','adapter','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x3a1d54,_0x3554d1){var _0x3e1611=function(_0x53a533){while(--_0x53a533){_0x3a1d54['push'](_0x3a1d54['shift']());}};_0x3e1611(++_0x3554d1);}(_0x33ec,0xdc));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc33e('0x0'));var http=require('http');var express=require(_0xc33e('0x1'));var sticky=require(_0xc33e('0x2'));var Redis=require(_0xc33e('0x3'));var config=require(_0xc33e('0x4'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0xc33e('0x5')](server,config[_0xc33e('0x6')])){var socketio=require(_0xc33e('0x7'))(server,{'transports':[_0xc33e('0x8'),_0xc33e('0x9')]});config['redis']=_[_0xc33e('0xa')](config[_0xc33e('0xb')],{'host':'localhost','port':0x18eb});socketio[_0xc33e('0xc')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0xc33e('0xd'))[_0xc33e('0xe')]();require(_0xc33e('0xf'))[_0xc33e('0xe')](socketio);require('../../config/express')['default'](app);require(_0xc33e('0x10'))[_0xc33e('0xe')](app);}else{server[_0xc33e('0x11')](_0xc33e('0x12'),function(){console[_0xc33e('0x13')](_0xc33e('0x14'),config[_0xc33e('0x6')]);});}exports=module[_0xc33e('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 63ffd1d..5ffb928 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 _0x0305=['debug','rpc','error','result','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','then'];(function(_0x363ce1,_0x2aaed9){var _0x2778e6=function(_0x188389){while(--_0x188389){_0x363ce1['push'](_0x363ce1['shift']());}};_0x2778e6(++_0x2aaed9);}(_0x0305,0x7d));var _0x5030=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x0305[_0x4a6cf8];return _0x22205e;};'use strict';var jayson=require(_0x5030('0x0'));var BPromise=require(_0x5030('0x1'));var logger=require(_0x5030('0x2'))(_0x5030('0x3'));var client=jayson[_0x5030('0x4')][_0x5030('0x5')]({'port':0x2329});client['Request']=function(_0x368f7c,_0x17d635){return new BPromise(function(_0x1f8a62,_0x1fc1e5){return client['request'](_0x368f7c,_0x17d635)[_0x5030('0x6')](function(_0x52246f){logger[_0x5030('0x7')](_0x5030('0x8'),_0x5030('0x3'),_0x368f7c,_0x17d635,_0x52246f);if(_0x52246f[_0x5030('0x9')]){logger['error'](_0x5030('0x8'),'routing',_0x368f7c,_0x52246f[_0x5030('0x9')]['message'],_0x17d635);return _0x1fc1e5(_0x52246f[_0x5030('0x9')]['message']);}else{return _0x1f8a62(_0x52246f[_0x5030('0xa')]);}})['catch'](function(_0xf4f3c9){logger[_0x5030('0x9')](_0x5030('0x8'),_0x5030('0x3'),_0x368f7c,_0xf4f3c9,_0x17d635);return _0x1fc1e5(_0xf4f3c9);});});};module[_0x5030('0xb')]=client; \ No newline at end of file +var _0x59af=['Request','then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','client','http'];(function(_0x1364da,_0x4d91ef){var _0x219d72=function(_0x189a26){while(--_0x189a26){_0x1364da['push'](_0x1364da['shift']());}};_0x219d72(++_0x4d91ef);}(_0x59af,0x95));var _0xf59a=function(_0x1915fd,_0x8785da){_0x1915fd=_0x1915fd-0x0;var _0x1d37d9=_0x59af[_0x1915fd];return _0x1d37d9;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xf59a('0x0'));var logger=require(_0xf59a('0x1'))(_0xf59a('0x2'));var client=jayson[_0xf59a('0x3')][_0xf59a('0x4')]({'port':0x2329});client[_0xf59a('0x5')]=function(_0x164316,_0x53740c){return new BPromise(function(_0x4196e8,_0xafa331){return client['request'](_0x164316,_0x53740c)[_0xf59a('0x6')](function(_0x27b32e){logger[_0xf59a('0x7')](_0xf59a('0x8'),_0xf59a('0x2'),_0x164316,_0x53740c,_0x27b32e);if(_0x27b32e[_0xf59a('0x9')]){logger[_0xf59a('0x9')](_0xf59a('0x8'),_0xf59a('0x2'),_0x164316,_0x27b32e[_0xf59a('0x9')][_0xf59a('0xa')],_0x53740c);return _0xafa331(_0x27b32e[_0xf59a('0x9')][_0xf59a('0xa')]);}else{return _0x4196e8(_0x27b32e[_0xf59a('0xb')]);}})[_0xf59a('0xc')](function(_0x1952e9){logger['error'](_0xf59a('0x8'),'routing',_0x164316,_0x1952e9,_0x53740c);return _0xafa331(_0x1952e9);});});};module[_0xf59a('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index d641b58..e646930 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 _0x0b8a=['getSmsQueues','getMailQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues'];(function(_0x31c4b1,_0x10f2c5){var _0x2ecb3b=function(_0x39dfde){while(--_0x39dfde){_0x31c4b1['push'](_0x31c4b1['shift']());}};_0x2ecb3b(++_0x10f2c5);}(_0x0b8a,0x10a));var _0xa0b8=function(_0x43d3bf,_0xb8d031){_0x43d3bf=_0x43d3bf-0x0;var _0x3993b3=_0x0b8a[_0x43d3bf];return _0x3993b3;};'use strict';var BPromise=require(_0xa0b8('0x0'));var server=require(_0xa0b8('0x1'));var Realtime=require(_0xa0b8('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xa0b8('0x3'));var smsQueue=require(_0xa0b8('0x4'));var mailQueue=require(_0xa0b8('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xa0b8('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xa0b8('0x7')](user['getAgents']())['then'](realtime[_0xa0b8('0x8')]())[_0xa0b8('0x7')](interval[_0xa0b8('0x9')]())[_0xa0b8('0x7')](realtime[_0xa0b8('0xa')]())[_0xa0b8('0x7')](openchannelQueue[_0xa0b8('0xb')]())[_0xa0b8('0x7')](realtime[_0xa0b8('0xc')]())['then'](chatQueue['getChatQueues']())[_0xa0b8('0x7')](realtime[_0xa0b8('0xd')]())[_0xa0b8('0x7')](smsQueue[_0xa0b8('0xe')]())[_0xa0b8('0x7')](realtime['initSmsQueues']())[_0xa0b8('0x7')](mailQueue[_0xa0b8('0xf')]())[_0xa0b8('0x7')](realtime['initMailQueues']())[_0xa0b8('0x7')](faxQueue['getFaxQueues']())[_0xa0b8('0x7')](realtime[_0xa0b8('0x10')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xa0b8('0x7')](realtime[_0xa0b8('0x11')]())['then'](function(){return realtime;});}function main(){return server[_0xa0b8('0x12')](realtime)[_0xa0b8('0x7')](function(_0x1b219b){return initRealtime();})[_0xa0b8('0x7')](function(_0x1e7747){return setInterval(initRealtime,0x1388);})[_0xa0b8('0x13')](function(_0x4ad0d8){console['log'](_0x4ad0d8);});}main(); \ No newline at end of file +var _0xf4c0=['initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xf4c0,0xf5));var _0x0f4c=function(_0x52cfd0,_0x33152f){_0x52cfd0=_0x52cfd0-0x0;var _0x64bb79=_0xf4c0[_0x52cfd0];return _0x64bb79;};'use strict';var BPromise=require(_0x0f4c('0x0'));var server=require(_0x0f4c('0x1'));var Realtime=require(_0x0f4c('0x2'));var user=require(_0x0f4c('0x3'));var interval=require(_0x0f4c('0x4'));var openchannelQueue=require(_0x0f4c('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x0f4c('0x6'));var faxQueue=require(_0x0f4c('0x7'));var whatsappQueue=require(_0x0f4c('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x0f4c('0x9')](user[_0x0f4c('0xa')]())[_0x0f4c('0x9')](realtime[_0x0f4c('0xb')]())[_0x0f4c('0x9')](interval[_0x0f4c('0xc')]())[_0x0f4c('0x9')](realtime['initIntervals']())[_0x0f4c('0x9')](openchannelQueue['getOpenchannelQueues']())[_0x0f4c('0x9')](realtime[_0x0f4c('0xd')]())['then'](chatQueue[_0x0f4c('0xe')]())['then'](realtime[_0x0f4c('0xf')]())[_0x0f4c('0x9')](smsQueue['getSmsQueues']())['then'](realtime['initSmsQueues']())[_0x0f4c('0x9')](mailQueue[_0x0f4c('0x10')]())[_0x0f4c('0x9')](realtime[_0x0f4c('0x11')]())[_0x0f4c('0x9')](faxQueue[_0x0f4c('0x12')]())['then'](realtime[_0x0f4c('0x13')]())[_0x0f4c('0x9')](whatsappQueue[_0x0f4c('0x14')]())[_0x0f4c('0x9')](realtime['initWhatsappQueues']())[_0x0f4c('0x9')](function(){return realtime;});}function main(){return server[_0x0f4c('0x15')](realtime)['then'](function(_0x341f97){return initRealtime();})[_0x0f4c('0x9')](function(_0x56c08c){return setInterval(initRealtime,0x1388);})[_0x0f4c('0x16')](function(_0x4a3b66){console[_0x0f4c('0x17')](_0x4a3b66);});}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 96cf6f7..d8ee1f2 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x1a6583,_0x37c9c0){var _0x4728c6=function(_0x57d2ad){while(--_0x57d2ad){_0x1a6583['push'](_0x1a6583['shift']());}};_0x4728c6(++_0x37c9c0);}(_0x7a54,0x106));var _0x47a5=function(_0x1fb3dd,_0x3f8e51){_0x1fb3dd=_0x1fb3dd-0x0;var _0xb4cb2a=_0x7a54[_0x1fb3dd];return _0xb4cb2a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x340737,_0x58ecf1){var _0x2e3559=function(_0x547529){while(--_0x547529){_0x340737['push'](_0x340737['shift']());}};_0x2e3559(++_0x58ecf1);}(_0xe14b,0x93));var _0xbe14=function(_0x4a5eca,_0x23dc49){_0x4a5eca=_0x4a5eca-0x0;var _0x5ceaa0=_0xe14b[_0x4a5eca];return _0x5ceaa0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 65273cb..7faff27 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 _0x3978=['http','request','then','error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x284552,_0x519c5e){var _0x16fb96=function(_0x28d631){while(--_0x28d631){_0x284552['push'](_0x284552['shift']());}};_0x16fb96(++_0x519c5e);}(_0x3978,0xa2));var _0x8397=function(_0x308639,_0x19de11){_0x308639=_0x308639-0x0;var _0x56b456=_0x3978[_0x308639];return _0x56b456;};'use strict';var BPromise=require(_0x8397('0x0'));var jayson=require(_0x8397('0x1'));var client=jayson[_0x8397('0x2')][_0x8397('0x3')]({'port':0x232b});function request(_0x56f6e5,_0x4786c0){return new BPromise(function(_0x3c5743,_0x3a1ee3){return client[_0x8397('0x4')](_0x56f6e5,_0x4786c0)[_0x8397('0x5')](function(_0xda8f32){if(_0xda8f32[_0x8397('0x6')]){return _0x3a1ee3(_0xda8f32[_0x8397('0x6')]['message']);}else{return _0x3c5743(_0xda8f32[_0x8397('0x7')]);}})[_0x8397('0x8')](function(_0x5d5ed3){return _0x3a1ee3(_0x5d5ed3);});});}exports[_0x8397('0x9')]=function(_0x29f94f,_0x46ad01){return request(_0x8397('0xa'),{'account':_0x29f94f,'message':_0x46ad01});}; \ No newline at end of file +var _0x7e51=['error','message','result','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x1c4d6a,_0x24cbfd){var _0x21603c=function(_0x2efd66){while(--_0x2efd66){_0x1c4d6a['push'](_0x1c4d6a['shift']());}};_0x21603c(++_0x24cbfd);}(_0x7e51,0x72));var _0x17e5=function(_0x5b758c,_0x3b595b){_0x5b758c=_0x5b758c-0x0;var _0x4b12f9=_0x7e51[_0x5b758c];return _0x4b12f9;};'use strict';var BPromise=require(_0x17e5('0x0'));var jayson=require(_0x17e5('0x1'));var client=jayson[_0x17e5('0x2')][_0x17e5('0x3')]({'port':0x232b});function request(_0x23b0bb,_0x4eed9c){return new BPromise(function(_0x233af0,_0x27faa5){return client[_0x17e5('0x4')](_0x23b0bb,_0x4eed9c)[_0x17e5('0x5')](function(_0x319874){if(_0x319874[_0x17e5('0x6')]){return _0x27faa5(_0x319874[_0x17e5('0x6')][_0x17e5('0x7')]);}else{return _0x233af0(_0x319874[_0x17e5('0x8')]);}})['catch'](function(_0xb179d8){return _0x27faa5(_0xb179d8);});});}exports['sendMailMessage']=function(_0x1d895a,_0x3a056e){return request(_0x17e5('0x9'),{'account':_0x1d895a,'message':_0x3a056e});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index dd0bf3e..62002a3 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 _0xa044=['prototype','mail','sms','length','Status','StatusTime','toNumber','chatPause','mailCurrentCapacity','smsCurrentCapacity','busyQueue','faxWaitingInteractions','stringify','md5','user:save','exports','moment','defaults','redis','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','CurrentCapacity','Capacity','idle'];(function(_0x598b8b,_0x457cf4){var _0x368ae4=function(_0x1f3aae){while(--_0x1f3aae){_0x598b8b['push'](_0x598b8b['shift']());}};_0x368ae4(++_0x457cf4);}(_0xa044,0x84));var _0x4a04=function(_0x2620c6,_0x2cde0b){_0x2620c6=_0x2620c6-0x0;var _0x35d218=_0xa044[_0x2620c6];return _0x35d218;};'use strict';var _=require('lodash');var moment=require(_0x4a04('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x4a04('0x1')](config[_0x4a04('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x4a04('0x3'))(new Redis(config[_0x4a04('0x2')]));function Agent(_0x2d9069){this['id']=_0x2d9069['id']||0x0;this[_0x4a04('0x4')]=_0x2d9069[_0x4a04('0x4')]||'';this[_0x4a04('0x5')]=_0x2d9069['online']||!![];this[_0x4a04('0x6')]=_0x2d9069[_0x4a04('0x6')]||![];this['chatPause']=_0x2d9069['chatPause']||![];this[_0x4a04('0x7')]=_0x2d9069[_0x4a04('0x7')]||![];this['faxPause']=_0x2d9069[_0x4a04('0x8')]||![];this[_0x4a04('0x9')]=_0x2d9069[_0x4a04('0x9')]||![];this[_0x4a04('0xa')]=_0x2d9069['openchannelPause']||![];this[_0x4a04('0xb')]='unknown';this[_0x4a04('0xc')]=0x0;this[_0x4a04('0xd')]=_0x2d9069[_0x4a04('0xd')]||0x0;this[_0x4a04('0xe')]=0x0;this[_0x4a04('0xf')]=_0x4a04('0x10');this[_0x4a04('0x11')]=0x0;this[_0x4a04('0x12')]=_0x2d9069[_0x4a04('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x4a04('0x13')]=_0x4a04('0x10');this['faxStatusTime']=0x0;this[_0x4a04('0x14')]=_0x2d9069[_0x4a04('0x14')]||0x0;this[_0x4a04('0x15')]=0x0;this[_0x4a04('0x16')]='unknown';this[_0x4a04('0x17')]=0x0;this[_0x4a04('0x18')]=_0x2d9069[_0x4a04('0x18')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x4a04('0x19')]=_0x4a04('0x10');this['whatsappStatusTime']=0x0;this[_0x4a04('0x1a')]=_0x2d9069[_0x4a04('0x1a')]||0x0;this[_0x4a04('0x1b')]=0x0;this[_0x4a04('0x1c')]=_0x4a04('0x10');this[_0x4a04('0x1d')]=0x0;this[_0x4a04('0x1e')]=_0x2d9069[_0x4a04('0x1e')]||0x0;this[_0x4a04('0x1f')]=0x0;this[_0x4a04('0x20')]=![];this['busyQueue']=undefined;this['md5']='';this[_0x4a04('0x21')]={};this['faxWaitingInteractions']={};this[_0x4a04('0x22')]={};this[_0x4a04('0x23')]={};this[_0x4a04('0x24')]={};this[_0x4a04('0x25')]={};this[_0x4a04('0x26')]();}Agent['prototype']['getChannelStatus']=function(_0x3f05f2){if(this[_0x3f05f2+_0x4a04('0x27')]>0x0){if(this[_0x3f05f2+_0x4a04('0x28')]>0x0&&this[_0x3f05f2+_0x4a04('0x27')]>=this[_0x3f05f2+_0x4a04('0x28')]){return'maxcapacity';}else{return'working';}}else{return _0x4a04('0x29');}};Agent[_0x4a04('0x2a')]['updateRealtime']=function(){var _0x3bcc4c=[_0x4a04('0x2b'),'chat','openchannel','fax',_0x4a04('0x2c'),'whatsapp'];for(var _0x8e66a0=0x0;_0x8e66a0<_0x3bcc4c[_0x4a04('0x2d')];_0x8e66a0+=0x1){var _0x972230=this['getChannelStatus'](_0x3bcc4c[_0x8e66a0]);if(this[_0x3bcc4c[_0x8e66a0]+_0x4a04('0x2e')]!==_0x972230){this[_0x3bcc4c[_0x8e66a0]+_0x4a04('0x2f')]=_[_0x4a04('0x30')](moment()['format']('x'));}this[_0x3bcc4c[_0x8e66a0]+_0x4a04('0x2e')]=_0x972230;}var _0x190de7={'id':this['id'],'name':this[_0x4a04('0x4')],'online':this[_0x4a04('0x5')],'voicePause':this[_0x4a04('0x6')],'chatPause':this[_0x4a04('0x31')],'mailPause':this[_0x4a04('0x7')],'smsPause':this[_0x4a04('0x9')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x4a04('0xb')],'chatStatusTime':this[_0x4a04('0xc')],'chatCapacity':this[_0x4a04('0xd')],'chatCurrentCapacity':this[_0x4a04('0xe')],'mailStatus':this[_0x4a04('0xf')],'mailStatusTime':this[_0x4a04('0x11')],'mailCapacity':this[_0x4a04('0x12')],'mailCurrentCapacity':this[_0x4a04('0x32')],'faxStatus':this[_0x4a04('0x13')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x4a04('0x14')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x4a04('0x16')],'smsStatusTime':this[_0x4a04('0x17')],'smsCapacity':this[_0x4a04('0x18')],'smsCurrentCapacity':this[_0x4a04('0x33')],'whatsappStatus':this[_0x4a04('0x19')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x4a04('0x1a')],'whatsappCurrentCapacity':this[_0x4a04('0x1b')],'openchannelStatus':this[_0x4a04('0x1c')],'openchannelStatusTime':this[_0x4a04('0x1d')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x4a04('0x1f')],'busy':this[_0x4a04('0x20')],'busyQueue':this[_0x4a04('0x34')],'chatWaitingInteractions':this[_0x4a04('0x21')],'faxWaitingInteractions':this[_0x4a04('0x35')],'mailWaitingInteractions':this[_0x4a04('0x22')],'openchannelWaitingInteractions':this[_0x4a04('0x23')],'smsWaitingInteractions':this[_0x4a04('0x24')],'whatsappWaitingInteractions':this[_0x4a04('0x25')]};var _0x96d71=md5(JSON[_0x4a04('0x36')](_0x190de7));if(this['md5']!==_0x96d71){this[_0x4a04('0x37')]=_0x96d71;io['emit'](_0x4a04('0x38'),_0x190de7);}};module[_0x4a04('0x39')]=Agent; \ No newline at end of file +var _0xf02a=['Status','format','name','mailCurrentCapacity','busyQueue','stringify','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf02a,0x153));var _0xaf02=function(_0x4c8833,_0x14e755){_0x4c8833=_0x4c8833-0x0;var _0x30df54=_0xf02a[_0x4c8833];return _0x30df54;};'use strict';var _=require(_0xaf02('0x0'));var moment=require('moment');var md5=require(_0xaf02('0x1'));var Redis=require(_0xaf02('0x2'));var config=require(_0xaf02('0x3'));config['redis']=_['defaults'](config[_0xaf02('0x4')],{'host':_0xaf02('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x385f7b){this['id']=_0x385f7b['id']||0x0;this['name']=_0x385f7b['name']||'';this[_0xaf02('0x6')]=_0x385f7b[_0xaf02('0x6')]||!![];this[_0xaf02('0x7')]=_0x385f7b[_0xaf02('0x7')]||![];this[_0xaf02('0x8')]=_0x385f7b[_0xaf02('0x8')]||![];this[_0xaf02('0x9')]=_0x385f7b[_0xaf02('0x9')]||![];this[_0xaf02('0xa')]=_0x385f7b[_0xaf02('0xa')]||![];this['smsPause']=_0x385f7b[_0xaf02('0xb')]||![];this[_0xaf02('0xc')]=_0x385f7b[_0xaf02('0xc')]||![];this[_0xaf02('0xd')]=_0xaf02('0xe');this[_0xaf02('0xf')]=0x0;this[_0xaf02('0x10')]=_0x385f7b['chatCapacity']||0x0;this[_0xaf02('0x11')]=0x0;this[_0xaf02('0x12')]=_0xaf02('0xe');this[_0xaf02('0x13')]=0x0;this[_0xaf02('0x14')]=_0x385f7b[_0xaf02('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xaf02('0x15')]=_0xaf02('0xe');this[_0xaf02('0x16')]=0x0;this[_0xaf02('0x17')]=_0x385f7b[_0xaf02('0x17')]||0x0;this[_0xaf02('0x18')]=0x0;this[_0xaf02('0x19')]='unknown';this[_0xaf02('0x1a')]=0x0;this[_0xaf02('0x1b')]=_0x385f7b[_0xaf02('0x1b')]||0x0;this[_0xaf02('0x1c')]=0x0;this[_0xaf02('0x1d')]=_0xaf02('0xe');this[_0xaf02('0x1e')]=0x0;this['whatsappCapacity']=_0x385f7b[_0xaf02('0x1f')]||0x0;this[_0xaf02('0x20')]=0x0;this[_0xaf02('0x21')]=_0xaf02('0xe');this['openchannelStatusTime']=0x0;this[_0xaf02('0x22')]=_0x385f7b[_0xaf02('0x22')]||0x0;this[_0xaf02('0x23')]=0x0;this[_0xaf02('0x24')]=![];this['busyQueue']=undefined;this[_0xaf02('0x1')]='';this[_0xaf02('0x25')]={};this[_0xaf02('0x26')]={};this['mailWaitingInteractions']={};this[_0xaf02('0x27')]={};this[_0xaf02('0x28')]={};this[_0xaf02('0x29')]={};this[_0xaf02('0x2a')]();}Agent[_0xaf02('0x2b')][_0xaf02('0x2c')]=function(_0x12fe27){if(this[_0x12fe27+_0xaf02('0x2d')]>0x0){if(this[_0x12fe27+'Capacity']>0x0&&this[_0x12fe27+_0xaf02('0x2d')]>=this[_0x12fe27+_0xaf02('0x2e')]){return _0xaf02('0x2f');}else{return _0xaf02('0x30');}}else{return _0xaf02('0x31');}};Agent[_0xaf02('0x2b')][_0xaf02('0x2a')]=function(){var _0x470382=[_0xaf02('0x32'),_0xaf02('0x33'),_0xaf02('0x34'),_0xaf02('0x35'),_0xaf02('0x36'),_0xaf02('0x37')];for(var _0x3c3368=0x0;_0x3c3368<_0x470382[_0xaf02('0x38')];_0x3c3368+=0x1){var _0x5b76cd=this[_0xaf02('0x2c')](_0x470382[_0x3c3368]);if(this[_0x470382[_0x3c3368]+_0xaf02('0x39')]!==_0x5b76cd){this[_0x470382[_0x3c3368]+'StatusTime']=_['toNumber'](moment()[_0xaf02('0x3a')]('x'));}this[_0x470382[_0x3c3368]+_0xaf02('0x39')]=_0x5b76cd;}var _0x1d4f60={'id':this['id'],'name':this[_0xaf02('0x3b')],'online':this[_0xaf02('0x6')],'voicePause':this[_0xaf02('0x7')],'chatPause':this[_0xaf02('0x8')],'mailPause':this[_0xaf02('0x9')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xaf02('0xf')],'chatCapacity':this[_0xaf02('0x10')],'chatCurrentCapacity':this[_0xaf02('0x11')],'mailStatus':this[_0xaf02('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xaf02('0x14')],'mailCurrentCapacity':this[_0xaf02('0x3c')],'faxStatus':this[_0xaf02('0x15')],'faxStatusTime':this[_0xaf02('0x16')],'faxCapacity':this[_0xaf02('0x17')],'faxCurrentCapacity':this[_0xaf02('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xaf02('0x1a')],'smsCapacity':this[_0xaf02('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xaf02('0x1e')],'whatsappCapacity':this[_0xaf02('0x1f')],'whatsappCurrentCapacity':this[_0xaf02('0x20')],'openchannelStatus':this[_0xaf02('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xaf02('0x23')],'busy':this[_0xaf02('0x24')],'busyQueue':this[_0xaf02('0x3d')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xaf02('0x26')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xaf02('0x27')],'smsWaitingInteractions':this[_0xaf02('0x28')],'whatsappWaitingInteractions':this[_0xaf02('0x29')]};var _0x8a91a=md5(JSON[_0xaf02('0x3e')](_0x1d4f60));if(this['md5']!==_0x8a91a){this[_0xaf02('0x1')]=_0x8a91a;io[_0xaf02('0x3f')](_0xaf02('0x40'),_0x1d4f60);}};module[_0xaf02('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 85cc8cd..52df058 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 _0x74a9=['map','prototype','updateRealtime','loggedIn','paused','length','chatPause','available','stringify','format','emit','chat_queue:save','exports','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr'];(function(_0x3ca646,_0x5aedc7){var _0x24a781=function(_0x46e707){while(--_0x46e707){_0x3ca646['push'](_0x3ca646['shift']());}};_0x24a781(++_0x5aedc7);}(_0x74a9,0xb5));var _0x974a=function(_0x3891e8,_0x3b6b95){_0x3891e8=_0x3891e8-0x0;var _0xc34c60=_0x74a9[_0x3891e8];return _0xc34c60;};'use strict';var _=require('lodash');var md5=require(_0x974a('0x0'));var util=require(_0x974a('0x1'));var Redis=require(_0x974a('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x974a('0x3')](config[_0x974a('0x4')],{'host':_0x974a('0x5'),'port':0x18eb});var io=require(_0x974a('0x6'))(new Redis(config[_0x974a('0x4')]));function ChatQueue(_0x4b41d0){this['id']=_0x4b41d0['id']||0x0;this[_0x974a('0x7')]=_0x4b41d0['name']||'';this['timeout']=_0x4b41d0['timeout']||0xa;this[_0x974a('0x8')]=_0x4b41d0[_0x974a('0x8')]||_0x974a('0x9');this['Agents']=_0x4b41d0[_0x974a('0xa')];this[_0x974a('0xb')]={};this[_0x974a('0xc')]=0x0;this[_0x974a('0x0')]='';this[_0x974a('0xd')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x461d43=this[_0x974a('0xb')][_0x974a('0xe')];this[_0x974a('0xb')]=_[_0x974a('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x974a('0xe')]=_0x461d43;};ChatQueue[_0x974a('0x10')][_0x974a('0x11')]=function(){this[_0x974a('0x12')]=0x0;this[_0x974a('0x13')]=0x0;for(var _0xcec187=0x0;_0xcec187=0x0?this['available']:0x0;var _0x14a21e={'id':this['id'],'available':this[_0x974a('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x974a('0x13')],'waiting':this[_0x974a('0xc')]};var _0x9066c1=md5(JSON[_0x974a('0x17')](_0x14a21e));if(this['md5']!==_0x9066c1){this[_0x974a('0x0')]=_0x9066c1;io['to'](util[_0x974a('0x18')]('chat:queue:%s',_0x14a21e['name']))[_0x974a('0x19')](_0x974a('0x1a'),_0x14a21e);}};module[_0x974a('0x1b')]=ChatQueue; \ No newline at end of file +var _0x8724=['Agents','waiting','updateRouting','mapAgentsId','map','_rr','prototype','paused','loggedIn','available','stringify','md5','chat:queue:%s','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0x44db8e,_0x143b54){var _0x40667a=function(_0x618866){while(--_0x618866){_0x44db8e['push'](_0x44db8e['shift']());}};_0x40667a(++_0x143b54);}(_0x8724,0x86));var _0x4872=function(_0xf9cdf1,_0x1879fe){_0xf9cdf1=_0xf9cdf1-0x0;var _0x26bf12=_0x8724[_0xf9cdf1];return _0x26bf12;};'use strict';var _=require(_0x4872('0x0'));var md5=require('md5');var util=require(_0x4872('0x1'));var Redis=require(_0x4872('0x2'));var config=require(_0x4872('0x3'));config[_0x4872('0x4')]=_[_0x4872('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4872('0x6'))(new Redis(config[_0x4872('0x4')]));function ChatQueue(_0x130db3){this['id']=_0x130db3['id']||0x0;this[_0x4872('0x7')]=_0x130db3[_0x4872('0x7')]||'';this['timeout']=_0x130db3[_0x4872('0x8')]||0xa;this[_0x4872('0x9')]=_0x130db3[_0x4872('0x9')]||'beepall';this[_0x4872('0xa')]=_0x130db3[_0x4872('0xa')];this['mapAgentsId']={};this[_0x4872('0xb')]=0x0;this['md5']='';this[_0x4872('0xc')]();this['updateRealtime']();}ChatQueue['prototype'][_0x4872('0xc')]=function(){var _0xea6f73=this[_0x4872('0xd')]['_rr'];this[_0x4872('0xd')]=_[_0x4872('0xe')](this[_0x4872('0xa')],'id');this[_0x4872('0xd')][_0x4872('0xf')]=_0xea6f73;};ChatQueue[_0x4872('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x4872('0x11')]=0x0;for(var _0x1f84de=0x0;_0x1f84de=0x0?this[_0x4872('0x13')]:0x0;var _0x472cd1={'id':this['id'],'available':this[_0x4872('0x13')],'loggedIn':this[_0x4872('0x12')],'name':this[_0x4872('0x7')],'paused':this[_0x4872('0x11')],'waiting':this['waiting']};var _0x143868=md5(JSON[_0x4872('0x14')](_0x472cd1));if(this[_0x4872('0x15')]!==_0x143868){this[_0x4872('0x15')]=_0x143868;io['to'](util['format'](_0x4872('0x16'),_0x472cd1[_0x4872('0x7')]))['emit']('chat_queue:save',_0x472cd1);}};module[_0x4872('0x17')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6efd568..f29a370 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 _0x225e=['length','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused'];(function(_0x106f27,_0x46ef58){var _0x15796b=function(_0x33e84f){while(--_0x33e84f){_0x106f27['push'](_0x106f27['shift']());}};_0x15796b(++_0x46ef58);}(_0x225e,0x9e));var _0xe225=function(_0x275d97,_0x365811){_0x275d97=_0x275d97-0x0;var _0x2a0924=_0x225e[_0x275d97];return _0x2a0924;};'use strict';var _=require(_0xe225('0x0'));var md5=require(_0xe225('0x1'));var util=require(_0xe225('0x2'));var Redis=require(_0xe225('0x3'));var config=require(_0xe225('0x4'));config[_0xe225('0x5')]=_[_0xe225('0x6')](config['redis'],{'host':_0xe225('0x7'),'port':0x18eb});var io=require(_0xe225('0x8'))(new Redis(config[_0xe225('0x5')]));function FaxQueue(_0x8ced2e){this['id']=_0x8ced2e['id']||0x0;this[_0xe225('0x9')]=_0x8ced2e[_0xe225('0x9')]||'';this[_0xe225('0xa')]=_0x8ced2e[_0xe225('0xa')]||0xa;this[_0xe225('0xb')]=_0x8ced2e[_0xe225('0xb')]||_0xe225('0xc');this['Agents']=_0x8ced2e[_0xe225('0xd')];this[_0xe225('0xe')]={};this[_0xe225('0xf')]=0x0;this[_0xe225('0x1')]='';this[_0xe225('0x10')]();this[_0xe225('0x11')]();}FaxQueue[_0xe225('0x12')][_0xe225('0x10')]=function(){var _0xe23a2d=this[_0xe225('0xe')]['_rr'];this[_0xe225('0xe')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xe225('0x13')]=_0xe23a2d;};FaxQueue[_0xe225('0x12')][_0xe225('0x11')]=function(){this[_0xe225('0x14')]=0x0;this[_0xe225('0x15')]=0x0;for(var _0x449cd5=0x0;_0x449cd5=0x0?this['available']:0x0;var _0x5c29a8={'id':this['id'],'available':this[_0xe225('0x18')],'loggedIn':this[_0xe225('0x14')],'name':this[_0xe225('0x9')],'paused':this['paused'],'waiting':this[_0xe225('0xf')]};var _0x209c88=md5(JSON[_0xe225('0x19')](_0x5c29a8));if(this[_0xe225('0x1')]!==_0x209c88){this['md5']=_0x209c88;io['to'](util['format'](_0xe225('0x1a'),_0x5c29a8[_0xe225('0x9')]))[_0xe225('0x1b')](_0xe225('0x1c'),_0x5c29a8);}};module[_0xe225('0x1d')]=FaxQueue; \ No newline at end of file +var _0x1d5b=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','_rr','map','updateRealtime','loggedIn','paused','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash'];(function(_0x4a63fd,_0xd95437){var _0x56db7e=function(_0x3984e0){while(--_0x3984e0){_0x4a63fd['push'](_0x4a63fd['shift']());}};_0x56db7e(++_0xd95437);}(_0x1d5b,0xd7));var _0xb1d5=function(_0x290542,_0xb56f2f){_0x290542=_0x290542-0x0;var _0x18dc30=_0x1d5b[_0x290542];return _0x18dc30;};'use strict';var _=require(_0xb1d5('0x0'));var md5=require(_0xb1d5('0x1'));var util=require(_0xb1d5('0x2'));var Redis=require(_0xb1d5('0x3'));var config=require(_0xb1d5('0x4'));config[_0xb1d5('0x5')]=_[_0xb1d5('0x6')](config['redis'],{'host':_0xb1d5('0x7'),'port':0x18eb});var io=require(_0xb1d5('0x8'))(new Redis(config[_0xb1d5('0x5')]));function FaxQueue(_0x45f56d){this['id']=_0x45f56d['id']||0x0;this[_0xb1d5('0x9')]=_0x45f56d[_0xb1d5('0x9')]||'';this[_0xb1d5('0xa')]=_0x45f56d[_0xb1d5('0xa')]||0xa;this[_0xb1d5('0xb')]=_0x45f56d[_0xb1d5('0xb')]||'beepall';this['Agents']=_0x45f56d[_0xb1d5('0xc')];this[_0xb1d5('0xd')]={};this[_0xb1d5('0xe')]=0x0;this[_0xb1d5('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xb1d5('0xf')]['updateRouting']=function(){var _0x73e164=this[_0xb1d5('0xd')][_0xb1d5('0x10')];this[_0xb1d5('0xd')]=_[_0xb1d5('0x11')](this['Agents'],'id');this[_0xb1d5('0xd')][_0xb1d5('0x10')]=_0x73e164;};FaxQueue[_0xb1d5('0xf')][_0xb1d5('0x12')]=function(){this[_0xb1d5('0x13')]=0x0;this[_0xb1d5('0x14')]=0x0;for(var _0x59e853=0x0;_0x59e853=0x0?this[_0xb1d5('0x15')]:0x0;var _0x176530={'id':this['id'],'available':this[_0xb1d5('0x15')],'loggedIn':this[_0xb1d5('0x13')],'name':this[_0xb1d5('0x9')],'paused':this[_0xb1d5('0x14')],'waiting':this[_0xb1d5('0xe')]};var _0x3a92f1=md5(JSON[_0xb1d5('0x16')](_0x176530));if(this[_0xb1d5('0x1')]!==_0x3a92f1){this[_0xb1d5('0x1')]=_0x3a92f1;io['to'](util['format'](_0xb1d5('0x17'),_0x176530[_0xb1d5('0x9')]))[_0xb1d5('0x18')](_0xb1d5('0x19'),_0x176530);}};module[_0xb1d5('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d7a076f..275fb43 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 _0xe14c=['exports','name','Intervals'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0xe14c,0x136));var _0xce14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe14c[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x2895f4){this['id']=_0x2895f4['id']||0x0;this[_0xce14('0x0')]=_0x2895f4[_0xce14('0x0')]||'';this[_0xce14('0x1')]=_0x2895f4[_0xce14('0x1')]||{};}module[_0xce14('0x2')]=Interval; \ No newline at end of file +var _0x55ef=['Intervals','name'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x55ef,0x17d));var _0xf55e=function(_0x3a8320,_0x3588e9){_0x3a8320=_0x3a8320-0x0;var _0x4e14fe=_0x55ef[_0x3a8320];return _0x4e14fe;};'use strict';function Interval(_0x128231){this['id']=_0x128231['id']||0x0;this[_0xf55e('0x0')]=_0x128231['name']||'';this[_0xf55e('0x1')]=_0x128231[_0xf55e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 6c54075..3e9824a 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 _0x24b1=['updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','format','mail:queue:%s','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x299523,_0x6e4b95){var _0x187b16=function(_0x3bcb6c){while(--_0x3bcb6c){_0x299523['push'](_0x299523['shift']());}};_0x187b16(++_0x6e4b95);}(_0x24b1,0x1bb));var _0x124b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x24b1[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x124b('0x0'));var md5=require(_0x124b('0x1'));var util=require(_0x124b('0x2'));var Redis=require(_0x124b('0x3'));var config=require(_0x124b('0x4'));config[_0x124b('0x5')]=_[_0x124b('0x6')](config['redis'],{'host':_0x124b('0x7'),'port':0x18eb});var io=require(_0x124b('0x8'))(new Redis(config['redis']));function MailQueue(_0x40f8e3){this['id']=_0x40f8e3['id']||0x0;this[_0x124b('0x9')]=_0x40f8e3[_0x124b('0x9')]||'';this[_0x124b('0xa')]=_0x40f8e3['timeout']||0xa;this[_0x124b('0xb')]=_0x40f8e3[_0x124b('0xb')]||_0x124b('0xc');this['Agents']=_0x40f8e3[_0x124b('0xd')];this[_0x124b('0xe')]={};this[_0x124b('0xf')]=0x0;this['md5']='';this[_0x124b('0x10')]();this[_0x124b('0x11')]();}MailQueue[_0x124b('0x12')][_0x124b('0x10')]=function(){var _0x61f8e5=this['mapAgentsId'][_0x124b('0x13')];this[_0x124b('0xe')]=_['map'](this[_0x124b('0xd')],'id');this[_0x124b('0xe')][_0x124b('0x13')]=_0x61f8e5;};MailQueue[_0x124b('0x12')]['updateRealtime']=function(){this[_0x124b('0x14')]=0x0;this[_0x124b('0x15')]=0x0;for(var _0x2a45d0=0x0;_0x2a45d0=0x0?this[_0x124b('0x18')]:0x0;var _0xf59410={'id':this['id'],'available':this[_0x124b('0x18')],'loggedIn':this[_0x124b('0x14')],'name':this[_0x124b('0x9')],'paused':this[_0x124b('0x15')],'waiting':this['waiting']};var _0x426358=md5(JSON['stringify'](_0xf59410));if(this[_0x124b('0x1')]!==_0x426358){this['md5']=_0x426358;io['to'](util[_0x124b('0x19')](_0x124b('0x1a'),_0xf59410[_0x124b('0x9')]))['emit']('mail_queue:save',_0xf59410);}};module['exports']=MailQueue; \ No newline at end of file +var _0x382f=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','length','online','mailPause','paused','available','loggedIn','stringify','format','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name'];(function(_0x5da04a,_0x1856fe){var _0x3b92b6=function(_0x529b58){while(--_0x529b58){_0x5da04a['push'](_0x5da04a['shift']());}};_0x3b92b6(++_0x1856fe);}(_0x382f,0x155));var _0xf382=function(_0x364e99,_0x3649bb){_0x364e99=_0x364e99-0x0;var _0x2c9730=_0x382f[_0x364e99];return _0x2c9730;};'use strict';var _=require('lodash');var md5=require(_0xf382('0x0'));var util=require(_0xf382('0x1'));var Redis=require(_0xf382('0x2'));var config=require(_0xf382('0x3'));config[_0xf382('0x4')]=_['defaults'](config[_0xf382('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xf382('0x5'))(new Redis(config[_0xf382('0x4')]));function MailQueue(_0x408fc0){this['id']=_0x408fc0['id']||0x0;this['name']=_0x408fc0[_0xf382('0x6')]||'';this[_0xf382('0x7')]=_0x408fc0[_0xf382('0x7')]||0xa;this['strategy']=_0x408fc0[_0xf382('0x8')]||_0xf382('0x9');this['Agents']=_0x408fc0[_0xf382('0xa')];this['mapAgentsId']={};this[_0xf382('0xb')]=0x0;this[_0xf382('0x0')]='';this[_0xf382('0xc')]();this[_0xf382('0xd')]();}MailQueue['prototype'][_0xf382('0xc')]=function(){var _0x3250a1=this['mapAgentsId'][_0xf382('0xe')];this[_0xf382('0xf')]=_[_0xf382('0x10')](this[_0xf382('0xa')],'id');this['mapAgentsId'][_0xf382('0xe')]=_0x3250a1;};MailQueue[_0xf382('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x47bb5c=0x0;_0x47bb5c=0x0?this[_0xf382('0x16')]:0x0;var _0x109450={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf382('0x17')],'name':this[_0xf382('0x6')],'paused':this[_0xf382('0x15')],'waiting':this[_0xf382('0xb')]};var _0x2ba649=md5(JSON[_0xf382('0x18')](_0x109450));if(this[_0xf382('0x0')]!==_0x2ba649){this[_0xf382('0x0')]=_0x2ba649;io['to'](util[_0xf382('0x19')]('mail:queue:%s',_0x109450[_0xf382('0x6')]))[_0xf382('0x1a')](_0xf382('0x1b'),_0x109450);}};module[_0xf382('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 4f8712e..123211a 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x2ef3,0xba));var _0x32ef=function(_0x35d827,_0x2e0cd0){_0x35d827=_0x35d827-0x0;var _0x10aab0=_0x2ef3[_0x35d827];return _0x10aab0;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +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(_0x2687e5,_0x5d297f){var _0x2e7d32=function(_0x406f30){while(--_0x406f30){_0x2687e5['push'](_0x2687e5['shift']());}};_0x2e7d32(++_0x5d297f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0x5fc3[_0x2c1114];return _0x2b877c;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 648b50e..843af34 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 _0x0faf=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment'];(function(_0xbfcf07,_0x3dd6f0){var _0x2a7548=function(_0x2653e3){while(--_0x2653e3){_0xbfcf07['push'](_0xbfcf07['shift']());}};_0x2a7548(++_0x3dd6f0);}(_0x0faf,0x132));var _0xf0fa=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0faf[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0xf0fa('0x0'));var md5=require('md5');var util=require(_0xf0fa('0x1'));var Redis=require(_0xf0fa('0x2'));var config=require(_0xf0fa('0x3'));config[_0xf0fa('0x4')]=_[_0xf0fa('0x5')](config[_0xf0fa('0x4')],{'host':_0xf0fa('0x6'),'port':0x18eb});var io=require(_0xf0fa('0x7'))(new Redis(config[_0xf0fa('0x4')]));function SmsQueue(_0x5d9b58){this['id']=_0x5d9b58['id']||0x0;this[_0xf0fa('0x8')]=_0x5d9b58[_0xf0fa('0x8')]||'';this[_0xf0fa('0x9')]=_0x5d9b58[_0xf0fa('0x9')]||0xa;this[_0xf0fa('0xa')]=_0x5d9b58['strategy']||_0xf0fa('0xb');this[_0xf0fa('0xc')]=_0x5d9b58['Agents'];this['mapAgentsId']={};this[_0xf0fa('0xd')]=0x0;this[_0xf0fa('0xe')]='';this[_0xf0fa('0xf')]();this[_0xf0fa('0x10')]();}SmsQueue[_0xf0fa('0x11')][_0xf0fa('0xf')]=function(){var _0x379ff6=this[_0xf0fa('0x12')]['_rr'];this[_0xf0fa('0x12')]=_['map'](this[_0xf0fa('0xc')],'id');this['mapAgentsId'][_0xf0fa('0x13')]=_0x379ff6;};SmsQueue[_0xf0fa('0x11')][_0xf0fa('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x42591b=0x0;_0x42591b=0x0?this[_0xf0fa('0x19')]:0x0;var _0x2bdf82={'id':this['id'],'available':this[_0xf0fa('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xf0fa('0x18')],'waiting':this[_0xf0fa('0xd')]};var _0x151d09=md5(JSON[_0xf0fa('0x1a')](_0x2bdf82));if(this[_0xf0fa('0xe')]!==_0x151d09){this[_0xf0fa('0xe')]=_0x151d09;io['to'](util[_0xf0fa('0x1b')](_0xf0fa('0x1c'),_0x2bdf82[_0xf0fa('0x8')]))[_0xf0fa('0x1d')](_0xf0fa('0x1e'),_0x2bdf82);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x7a2c=['sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','map','_rr','prototype','loggedIn','paused','length','online','smsPause','available','sms:queue:%s'];(function(_0x22df4d,_0xa4790a){var _0x6a2020=function(_0x215c88){while(--_0x215c88){_0x22df4d['push'](_0x22df4d['shift']());}};_0x6a2020(++_0xa4790a);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x1479e4,_0x1c3f20){_0x1479e4=_0x1479e4-0x0;var _0x461a1b=_0x7a2c[_0x1479e4];return _0x461a1b;};'use strict';var _=require(_0xc7a2('0x0'));var md5=require('md5');var util=require(_0xc7a2('0x1'));var Redis=require(_0xc7a2('0x2'));var config=require(_0xc7a2('0x3'));config[_0xc7a2('0x4')]=_[_0xc7a2('0x5')](config[_0xc7a2('0x4')],{'host':_0xc7a2('0x6'),'port':0x18eb});var io=require(_0xc7a2('0x7'))(new Redis(config['redis']));function SmsQueue(_0x3a47c8){this['id']=_0x3a47c8['id']||0x0;this[_0xc7a2('0x8')]=_0x3a47c8['name']||'';this['timeout']=_0x3a47c8['timeout']||0xa;this[_0xc7a2('0x9')]=_0x3a47c8[_0xc7a2('0x9')]||_0xc7a2('0xa');this[_0xc7a2('0xb')]=_0x3a47c8['Agents'];this[_0xc7a2('0xc')]={};this[_0xc7a2('0xd')]=0x0;this[_0xc7a2('0xe')]='';this['updateRouting']();this[_0xc7a2('0xf')]();}SmsQueue['prototype'][_0xc7a2('0x10')]=function(){var _0x32adcc=this[_0xc7a2('0xc')]['_rr'];this[_0xc7a2('0xc')]=_[_0xc7a2('0x11')](this[_0xc7a2('0xb')],'id');this['mapAgentsId'][_0xc7a2('0x12')]=_0x32adcc;};SmsQueue[_0xc7a2('0x13')][_0xc7a2('0xf')]=function(){this[_0xc7a2('0x14')]=0x0;this[_0xc7a2('0x15')]=0x0;for(var _0x2af363=0x0;_0x2af363=0x0?this[_0xc7a2('0x19')]:0x0;var _0x293343={'id':this['id'],'available':this[_0xc7a2('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xc7a2('0x15')],'waiting':this[_0xc7a2('0xd')]};var _0x51cbb3=md5(JSON['stringify'](_0x293343));if(this['md5']!==_0x51cbb3){this[_0xc7a2('0xe')]=_0x51cbb3;io['to'](util['format'](_0xc7a2('0x1a'),_0x293343[_0xc7a2('0x8')]))['emit'](_0xc7a2('0x1b'),_0x293343);}};module[_0xc7a2('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 40041ab..1b6b343 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 _0x2212=['available','whatsapp:queue:%s','emit','lodash','md5','util','../../../config/environment','defaults','localhost','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','whatsappPause'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2212,0x121));var _0x2221=function(_0xe1f06,_0x56eb98){_0xe1f06=_0xe1f06-0x0;var _0x490ea9=_0x2212[_0xe1f06];return _0x490ea9;};'use strict';var _=require(_0x2221('0x0'));var md5=require(_0x2221('0x1'));var util=require(_0x2221('0x2'));var Redis=require('ioredis');var config=require(_0x2221('0x3'));config['redis']=_[_0x2221('0x4')](config['redis'],{'host':_0x2221('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2221('0x6')]));function WhatsappQueue(_0x2cc17e){this['id']=_0x2cc17e['id']||0x0;this[_0x2221('0x7')]=_0x2cc17e[_0x2221('0x7')]||'';this['timeout']=_0x2cc17e[_0x2221('0x8')]||0xa;this[_0x2221('0x9')]=_0x2cc17e[_0x2221('0x9')]||_0x2221('0xa');this[_0x2221('0xb')]=_0x2cc17e[_0x2221('0xb')];this[_0x2221('0xc')]={};this[_0x2221('0xd')]=0x0;this[_0x2221('0x1')]='';this[_0x2221('0xe')]();this[_0x2221('0xf')]();}WhatsappQueue[_0x2221('0x10')][_0x2221('0xe')]=function(){var _0x104e6a=this[_0x2221('0xc')][_0x2221('0x11')];this['mapAgentsId']=_[_0x2221('0x12')](this[_0x2221('0xb')],'id');this[_0x2221('0xc')][_0x2221('0x11')]=_0x104e6a;};WhatsappQueue[_0x2221('0x10')]['updateRealtime']=function(){this[_0x2221('0x13')]=0x0;this[_0x2221('0x14')]=0x0;for(var _0x9dbeaa=0x0;_0x9dbeaa=0x0?this[_0x2221('0x17')]:0x0;var _0x22b247={'id':this['id'],'available':this[_0x2221('0x17')],'loggedIn':this[_0x2221('0x13')],'name':this[_0x2221('0x7')],'paused':this[_0x2221('0x14')],'waiting':this[_0x2221('0xd')]};var _0x206376=md5(JSON['stringify'](_0x22b247));if(this['md5']!==_0x206376){this[_0x2221('0x1')]=_0x206376;io['to'](util['format'](_0x2221('0x18'),_0x22b247[_0x2221('0x7')]))[_0x2221('0x19')]('whatsapp_queue:save',_0x22b247);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x5dd4=['defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','available','waiting','stringify','format','exports','lodash','../../../config/environment'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0x5dd4,0x15c));var _0x45dd=function(_0x6223d3,_0x9bec85){_0x6223d3=_0x6223d3-0x0;var _0x4e4d27=_0x5dd4[_0x6223d3];return _0x4e4d27;};'use strict';var _=require(_0x45dd('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x45dd('0x1'));config['redis']=_[_0x45dd('0x2')](config['redis'],{'host':_0x45dd('0x3'),'port':0x18eb});var io=require(_0x45dd('0x4'))(new Redis(config[_0x45dd('0x5')]));function WhatsappQueue(_0x3385e0){this['id']=_0x3385e0['id']||0x0;this[_0x45dd('0x6')]=_0x3385e0[_0x45dd('0x6')]||'';this['timeout']=_0x3385e0[_0x45dd('0x7')]||0xa;this[_0x45dd('0x8')]=_0x3385e0[_0x45dd('0x8')]||'beepall';this[_0x45dd('0x9')]=_0x3385e0[_0x45dd('0x9')];this[_0x45dd('0xa')]={};this['waiting']=0x0;this[_0x45dd('0xb')]='';this[_0x45dd('0xc')]();this['updateRealtime']();}WhatsappQueue[_0x45dd('0xd')][_0x45dd('0xc')]=function(){var _0x180c80=this[_0x45dd('0xa')][_0x45dd('0xe')];this[_0x45dd('0xa')]=_[_0x45dd('0xf')](this[_0x45dd('0x9')],'id');this[_0x45dd('0xa')]['_rr']=_0x180c80;};WhatsappQueue[_0x45dd('0xd')]['updateRealtime']=function(){this[_0x45dd('0x10')]=0x0;this[_0x45dd('0x11')]=0x0;for(var _0x170c60=0x0;_0x170c60=0x0?this[_0x45dd('0x14')]:0x0;var _0x28ebb9={'id':this['id'],'available':this[_0x45dd('0x14')],'loggedIn':this[_0x45dd('0x10')],'name':this[_0x45dd('0x6')],'paused':this[_0x45dd('0x11')],'waiting':this[_0x45dd('0x15')]};var _0x2ed055=md5(JSON[_0x45dd('0x16')](_0x28ebb9));if(this[_0x45dd('0xb')]!==_0x2ed055){this['md5']=_0x2ed055;io['to'](util[_0x45dd('0x17')]('whatsapp:queue:%s',_0x28ebb9['name']))['emit']('whatsapp_queue:save',_0x28ebb9);}};module[_0x45dd('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index d35e68d..3737ff5 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(_0x4d9bae,_0x35b5b9){var _0x3a2053=function(_0x5d90d4){while(--_0x5d90d4){_0x4d9bae['push'](_0x4d9bae['shift']());}};_0x3a2053(++_0x35b5b9);}(_0xb10b,0x12a));var _0xbb10=function(_0x709665,_0x2596cb){_0x709665=_0x709665-0x0;var _0x31ef83=_0xb10b[_0x709665];return _0x31ef83;};'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 _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(_0x1234be,_0x78976f){var _0x12825c=function(_0x1ca488){while(--_0x1ca488){_0x1234be['push'](_0x1234be['shift']());}};_0x12825c(++_0x78976f);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c5eac,_0x319ede){_0x2c5eac=_0x2c5eac-0x0;var _0x13773d=_0xb10b[_0x2c5eac];return _0x13773d;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 443b28d..38830ab 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 _0x802c=['addTagsToChatInteraction','../client','UpdateChatInteraction','addTags','Request'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x802c,0x6f));var _0xc802=function(_0x9b497,_0x419469){_0x9b497=_0x9b497-0x0;var _0x18f86f=_0x802c[_0x9b497];return _0x18f86f;};'use strict';var client=require(_0xc802('0x0'));exports['update']=function(_0x45f870,_0x556f1b){return client['Request'](_0xc802('0x1'),{'body':_0x556f1b,'options':{'where':{'id':_0x45f870}},'log':'updateChatInteraction'});};exports[_0xc802('0x2')]=function(_0x2070ea,_0x37cdf0){return client[_0xc802('0x3')]('AddTagsToChatInteraction',{'body':_0x37cdf0,'options':{'where':{'id':_0x2070ea}},'log':_0xc802('0x4')});}; \ No newline at end of file +var _0xefe5=['../client','UpdateChatInteraction','updateChatInteraction','Request','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xefe5,0xf6));var _0x5efe=function(_0x314df2,_0x235772){_0x314df2=_0x314df2-0x0;var _0x317ba6=_0xefe5[_0x314df2];return _0x317ba6;};'use strict';var client=require(_0x5efe('0x0'));exports['update']=function(_0xc10ebf,_0x2ee514){return client['Request'](_0x5efe('0x1'),{'body':_0x2ee514,'options':{'where':{'id':_0xc10ebf}},'log':_0x5efe('0x2')});};exports['addTags']=function(_0x14cb1e,_0x5551f1){return client[_0x5efe('0x3')](_0x5efe('0x4'),{'body':_0x5551f1,'options':{'where':{'id':_0x14cb1e}},'log':_0x5efe('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index dfc4691..2f65d18 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 _0xd090=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x3b1ea2,_0x27da70){var _0xe90a3f=function(_0x41eaca){while(--_0x41eaca){_0x3b1ea2['push'](_0x3b1ea2['shift']());}};_0xe90a3f(++_0x27da70);}(_0xd090,0x84));var _0x0d09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd090[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0d09('0x0'));exports[_0x0d09('0x1')]=function(_0x20be4c){return client[_0x0d09('0x2')](_0x0d09('0x3'),{'body':_0x20be4c,'log':_0x0d09('0x4')});}; \ No newline at end of file +var _0x5833=['Request','../client'];(function(_0x5957e6,_0x51adc2){var _0x570488=function(_0x6d3582){while(--_0x6d3582){_0x5957e6['push'](_0x5957e6['shift']());}};_0x570488(++_0x51adc2);}(_0x5833,0x1a5));var _0x3583=function(_0x19ec04,_0x36d636){_0x19ec04=_0x19ec04-0x0;var _0x3d289e=_0x5833[_0x19ec04];return _0x3d289e;};'use strict';var client=require(_0x3583('0x0'));exports['create']=function(_0x484be8){return client[_0x3583('0x1')]('CreateChatMessage',{'body':_0x484be8,'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 665ae50..500a8e3 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 _0xc5c7=['strategy','Agents','online','chatPause','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x115c61,_0x1c587c){_0x115c61=_0x115c61-0x0;var _0x6a79c5=_0xc5c7[_0x115c61];return _0x6a79c5;};'use strict';var client=require('../client');exports[_0x7c5c('0x0')]=function(){return function(){return client[_0x7c5c('0x1')](_0x7c5c('0x2'),{'options':{'raw':![],'attributes':['id',_0x7c5c('0x3'),_0x7c5c('0x4'),_0x7c5c('0x5')],'include':[{'model':'User','as':_0x7c5c('0x6'),'attributes':['id',_0x7c5c('0x3'),_0x7c5c('0x7'),_0x7c5c('0x8')]}]},'log':_0x7c5c('0x0')});};}; \ No newline at end of file +var _0x7722=['strategy','User','Agents','online','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x3e80d3,_0x4188cc){var _0x4d5330=function(_0x26dac3){while(--_0x26dac3){_0x3e80d3['push'](_0x3e80d3['shift']());}};_0x4d5330(++_0x4188cc);}(_0x7722,0x14e));var _0x2772=function(_0x13bbd3,_0x5cb86d){_0x13bbd3=_0x13bbd3-0x0;var _0x508af8=_0x7722[_0x13bbd3];return _0x508af8;};'use strict';var client=require(_0x2772('0x0'));exports[_0x2772('0x1')]=function(){return function(){return client[_0x2772('0x2')](_0x2772('0x3'),{'options':{'raw':![],'attributes':['id',_0x2772('0x4'),_0x2772('0x5'),_0x2772('0x6')],'include':[{'model':_0x2772('0x7'),'as':_0x2772('0x8'),'attributes':['id','name',_0x2772('0x9'),'chatPause']}]},'log':_0x2772('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 4280a23..d5ed5d9 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 _0x9cff=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x13bc9b,_0x3df78f){_0x13bc9b=_0x13bc9b-0x0;var _0x592837=_0x9cff[_0x13bc9b];return _0x592837;};'use strict';var client=require('../client');exports[_0xf9cf('0x0')]=function(_0x1e4896){return client[_0xf9cf('0x1')]('CreateChatQueueReport',{'body':_0x1e4896,'log':_0xf9cf('0x2')});};exports[_0xf9cf('0x3')]=function(_0x41a299,_0x5060e0){return client[_0xf9cf('0x1')](_0xf9cf('0x4'),{'body':_0x5060e0,'options':{'where':{'uniqueid':_0x41a299},'order':[['id',_0xf9cf('0x5')]],'limit':0x1},'log':_0xf9cf('0x4')});}; \ No newline at end of file +var _0x7c8e=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x17dfbf,_0x240258){var _0x55c3e1=function(_0x1bd06f){while(--_0x1bd06f){_0x17dfbf['push'](_0x17dfbf['shift']());}};_0x55c3e1(++_0x240258);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x12c3d1,_0x3c6ae7){_0x12c3d1=_0x12c3d1-0x0;var _0x282840=_0x7c8e[_0x12c3d1];return _0x282840;};'use strict';var client=require('../client');exports[_0xe7c8('0x0')]=function(_0x259669){return client[_0xe7c8('0x1')](_0xe7c8('0x2'),{'body':_0x259669,'log':_0xe7c8('0x2')});};exports[_0xe7c8('0x3')]=function(_0x1e8e67,_0x2d314f){return client[_0xe7c8('0x1')](_0xe7c8('0x4'),{'body':_0x2d314f,'options':{'where':{'uniqueid':_0x1e8e67},'order':[['id',_0xe7c8('0x5')]],'limit':0x1},'log':_0xe7c8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9228ed2..2d1ab5a 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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x7a54,0x106));var _0x47a5=function(_0x528702,_0x47b3bf){_0x528702=_0x528702-0x0;var _0x5d823=_0x7a54[_0x528702];return _0x5d823;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x7a54,0x106));var _0x47a5=function(_0x5d6be5,_0x2052ee){_0x5d6be5=_0x5d6be5-0x0;var _0x4435fd=_0x7a54[_0x5d6be5];return _0x4435fd;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index cd4a650..a5b2442 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 _0x1fac=['create','Request','CreateFaxMessage','../client'];(function(_0x12195d,_0x373eb5){var _0x44d5e9=function(_0x293995){while(--_0x293995){_0x12195d['push'](_0x12195d['shift']());}};_0x44d5e9(++_0x373eb5);}(_0x1fac,0x137));var _0xc1fa=function(_0x3a35a8,_0x8afed5){_0x3a35a8=_0x3a35a8-0x0;var _0x5b96c2=_0x1fac[_0x3a35a8];return _0x5b96c2;};'use strict';var client=require(_0xc1fa('0x0'));exports[_0xc1fa('0x1')]=function(_0x31522b){return client[_0xc1fa('0x2')](_0xc1fa('0x3'),{'body':_0x31522b,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x5ecb=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ecb,0xc5));var _0xb5ec=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x5ecb[_0x5c6994];return _0x1d5c84;};'use strict';var client=require(_0xb5ec('0x0'));exports[_0xb5ec('0x1')]=function(_0x4cd484){return client[_0xb5ec('0x2')](_0xb5ec('0x3'),{'body':_0x4cd484,'log':_0xb5ec('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 08ee404..045907d 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 _0x1352=['getFaxQueues','Request','GetFaxQueue','name','strategy','User','Agents','online','faxPause'];(function(_0x476a6b,_0x13ca38){var _0x36e241=function(_0x32dcfb){while(--_0x32dcfb){_0x476a6b['push'](_0x476a6b['shift']());}};_0x36e241(++_0x13ca38);}(_0x1352,0x7e));var _0x2135=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x1352[_0x5e3b04];return _0x1fc44d;};'use strict';var client=require('../client');exports[_0x2135('0x0')]=function(){return function(){return client[_0x2135('0x1')](_0x2135('0x2'),{'options':{'raw':![],'attributes':['id',_0x2135('0x3'),'timeout',_0x2135('0x4')],'include':[{'model':_0x2135('0x5'),'as':_0x2135('0x6'),'attributes':['id',_0x2135('0x3'),_0x2135('0x7'),_0x2135('0x8')]}]},'log':_0x2135('0x0')});};}; \ No newline at end of file +var _0x96de=['getFaxQueues','Request','GetFaxQueue','timeout','strategy','Agents','name','online','../client'];(function(_0xb05410,_0x984323){var _0x2944d8=function(_0x1f6e62){while(--_0x1f6e62){_0xb05410['push'](_0xb05410['shift']());}};_0x2944d8(++_0x984323);}(_0x96de,0x18b));var _0xe96d=function(_0x1b64bf,_0x10805b){_0x1b64bf=_0x1b64bf-0x0;var _0x2d0085=_0x96de[_0x1b64bf];return _0x2d0085;};'use strict';var client=require(_0xe96d('0x0'));exports[_0xe96d('0x1')]=function(){return function(){return client[_0xe96d('0x2')](_0xe96d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe96d('0x4'),_0xe96d('0x5')],'include':[{'model':'User','as':_0xe96d('0x6'),'attributes':['id',_0xe96d('0x7'),_0xe96d('0x8'),'faxPause']}]},'log':_0xe96d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 5debd64..838e12f 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 _0xc9f3=['../client','Request','update','DESC','UpdateFaxQueueReport'];(function(_0x26b183,_0x494c12){var _0xe55f3b=function(_0x28972d){while(--_0x28972d){_0x26b183['push'](_0x26b183['shift']());}};_0xe55f3b(++_0x494c12);}(_0xc9f3,0x1a4));var _0x3c9f=function(_0x2edf1d,_0x195f6){_0x2edf1d=_0x2edf1d-0x0;var _0x1cca03=_0xc9f3[_0x2edf1d];return _0x1cca03;};'use strict';var client=require(_0x3c9f('0x0'));exports['create']=function(_0x184059){return client[_0x3c9f('0x1')]('CreateFaxQueueReport',{'body':_0x184059,'log':'CreateFaxQueueReport'});};exports[_0x3c9f('0x2')]=function(_0x5d614b,_0x4645da){return client[_0x3c9f('0x1')]('UpdateFaxQueueReport',{'body':_0x4645da,'options':{'where':{'uniqueid':_0x5d614b},'order':[['id',_0x3c9f('0x3')]],'limit':0x1},'log':_0x3c9f('0x4')});}; \ No newline at end of file +var _0xcf41=['update','UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0xcf41,0x99));var _0x1cf4=function(_0x513983,_0x3111e4){_0x513983=_0x513983-0x0;var _0x399ca4=_0xcf41[_0x513983];return _0x399ca4;};'use strict';var client=require('../client');exports[_0x1cf4('0x0')]=function(_0x266e44){return client[_0x1cf4('0x1')](_0x1cf4('0x2'),{'body':_0x266e44,'log':_0x1cf4('0x2')});};exports[_0x1cf4('0x3')]=function(_0x411057,_0x1af8f1){return client[_0x1cf4('0x1')](_0x1cf4('0x4'),{'body':_0x1af8f1,'options':{'where':{'uniqueid':_0x411057},'order':[['id',_0x1cf4('0x5')]],'limit':0x1},'log':_0x1cf4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e5ac993..8d97980 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 _0x1649=['GetInterval','Interval','name','../client','getIntervals','Request'];(function(_0x1cfc39,_0x15adef){var _0x1ae59b=function(_0x153274){while(--_0x153274){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x1ae59b(++_0x15adef);}(_0x1649,0x1d1));var _0x9164=function(_0x3f01aa,_0x383677){_0x3f01aa=_0x3f01aa-0x0;var _0x186ddf=_0x1649[_0x3f01aa];return _0x186ddf;};'use strict';var client=require(_0x9164('0x0'));exports[_0x9164('0x1')]=function(){return function(){return client[_0x9164('0x2')](_0x9164('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x9164('0x4'),'as':'Intervals','attributes':['id',_0x9164('0x5'),'interval']}]},'log':_0x9164('0x1')});};}; \ No newline at end of file +var _0xa83b=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa83b,0x70));var _0xba83=function(_0x5b5d81,_0x439922){_0x5b5d81=_0x5b5d81-0x0;var _0x441395=_0xa83b[_0x5b5d81];return _0x441395;};'use strict';var client=require(_0xba83('0x0'));exports[_0xba83('0x1')]=function(){return function(){return client[_0xba83('0x2')](_0xba83('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xba83('0x4')],'include':[{'model':_0xba83('0x5'),'as':_0xba83('0x6'),'attributes':['id','name',_0xba83('0x7')]}]},'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 0be5f34..fe17b35 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 _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x246b52,_0x49cfa5){var _0x5a71f0=function(_0x4ef2bc){while(--_0x4ef2bc){_0x246b52['push'](_0x246b52['shift']());}};_0x5a71f0(++_0x49cfa5);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x3d740d,_0x373d2a){_0x3d740d=_0x3d740d-0x0;var _0x3e32be=_0xcf2f[_0x3d740d];return _0x3e32be;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file +var _0xd117=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x4f7b5e,_0x555f6f){var _0x4bac7b=function(_0x45fc9b){while(--_0x45fc9b){_0x4f7b5e['push'](_0x4f7b5e['shift']());}};_0x4bac7b(++_0x555f6f);}(_0xd117,0x182));var _0x7d11=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0xd117[_0x307bf6];return _0x2878fc;};'use strict';var client=require(_0x7d11('0x0'));exports[_0x7d11('0x1')]=function(_0x2737ce,_0x45ee65){return client[_0x7d11('0x2')](_0x7d11('0x3'),{'body':_0x45ee65,'options':{'where':{'id':_0x2737ce}},'log':_0x7d11('0x4')});};exports[_0x7d11('0x5')]=function(_0x3c07be,_0x31fcb0){return client[_0x7d11('0x2')](_0x7d11('0x6'),{'body':_0x31fcb0,'options':{'where':{'id':_0x3c07be}},'log':_0x7d11('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 77fbcdc..d5d79a2 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 _0xc4e2=['Request','CreateMailMessage','createMailMessage'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xc4e2,0x138));var _0x2c4e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xc4e2[_0x31e29a];return _0x32d892;};'use strict';var client=require('../client');exports['create']=function(_0x36b9d1){return client[_0x2c4e('0x0')](_0x2c4e('0x1'),{'body':_0x36b9d1,'log':_0x2c4e('0x2')});}; \ No newline at end of file +var _0xb544=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x4ca9aa,_0x1ff656){var _0x2a83f1=function(_0x352c7a){while(--_0x352c7a){_0x4ca9aa['push'](_0x4ca9aa['shift']());}};_0x2a83f1(++_0x1ff656);}(_0xb544,0x105));var _0x4b54=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xb544[_0x88cd7b];return _0x56fcc8;};'use strict';var client=require(_0x4b54('0x0'));exports[_0x4b54('0x1')]=function(_0x2df417){return client[_0x4b54('0x2')](_0x4b54('0x3'),{'body':_0x2df417,'log':_0x4b54('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index cf48275..cd8fbfe 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 _0xa2e3=['GetMailQueue','name','timeout','strategy','online','mailPause','../client'];(function(_0x3a8ec5,_0x378f44){var _0x483caf=function(_0x559670){while(--_0x559670){_0x3a8ec5['push'](_0x3a8ec5['shift']());}};_0x483caf(++_0x378f44);}(_0xa2e3,0xbc));var _0x3a2e=function(_0x59334c,_0x24d854){_0x59334c=_0x59334c-0x0;var _0x5f0bcd=_0xa2e3[_0x59334c];return _0x5f0bcd;};'use strict';var client=require(_0x3a2e('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x3a2e('0x1'),{'options':{'raw':![],'attributes':['id',_0x3a2e('0x2'),_0x3a2e('0x3'),_0x3a2e('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x3a2e('0x5'),_0x3a2e('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x0f2b=['name','timeout','strategy','mailPause','getMailQueues','Request','GetMailQueue'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0f2b,0xa5));var _0xb0f2=function(_0x2ddabc,_0x50064a){_0x2ddabc=_0x2ddabc-0x0;var _0x2b2ecd=_0x0f2b[_0x2ddabc];return _0x2b2ecd;};'use strict';var client=require('../client');exports[_0xb0f2('0x0')]=function(){return function(){return client[_0xb0f2('0x1')](_0xb0f2('0x2'),{'options':{'raw':![],'attributes':['id',_0xb0f2('0x3'),_0xb0f2('0x4'),_0xb0f2('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0xb0f2('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 003a589..93bcc86 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 _0x2c8f=['DESC','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c8f,0x115));var _0xf2c8=function(_0x1c3735,_0x4b6f12){_0x1c3735=_0x1c3735-0x0;var _0x5b7645=_0x2c8f[_0x1c3735];return _0x5b7645;};'use strict';var client=require('../client');exports[_0xf2c8('0x0')]=function(_0x2465f4){return client[_0xf2c8('0x1')](_0xf2c8('0x2'),{'body':_0x2465f4,'log':_0xf2c8('0x2')});};exports[_0xf2c8('0x3')]=function(_0x32eb2b,_0x10eac1){return client[_0xf2c8('0x1')](_0xf2c8('0x4'),{'body':_0x10eac1,'options':{'where':{'uniqueid':_0x32eb2b},'order':[['id',_0xf2c8('0x5')]],'limit':0x1},'log':_0xf2c8('0x4')});}; \ No newline at end of file +var _0xadea=['CreateMailQueueReport','Request','UpdateMailQueueReport','../client'];(function(_0x204ead,_0x53f876){var _0x4d3df9=function(_0x5be15a){while(--_0x5be15a){_0x204ead['push'](_0x204ead['shift']());}};_0x4d3df9(++_0x53f876);}(_0xadea,0x1eb));var _0xaade=function(_0x33d239,_0x24bb87){_0x33d239=_0x33d239-0x0;var _0x6784c2=_0xadea[_0x33d239];return _0x6784c2;};'use strict';var client=require(_0xaade('0x0'));exports['create']=function(_0x41be93){return client['Request'](_0xaade('0x1'),{'body':_0x41be93,'log':'CreateMailQueueReport'});};exports['update']=function(_0xfc1018,_0x1e9fdc){return client[_0xaade('0x2')]('UpdateMailQueueReport',{'body':_0x1e9fdc,'options':{'where':{'uniqueid':_0xfc1018},'order':[['id','DESC']],'limit':0x1},'log':_0xaade('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 6d764bf..bb84601 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 _0xdcf0=['update','Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x3d8597,_0x4934a0){var _0x54fff3=function(_0x32de02){while(--_0x32de02){_0x3d8597['push'](_0x3d8597['shift']());}};_0x54fff3(++_0x4934a0);}(_0xdcf0,0xfb));var _0x0dcf=function(_0x368f75,_0x1c2395){_0x368f75=_0x368f75-0x0;var _0x5e673d=_0xdcf0[_0x368f75];return _0x5e673d;};'use strict';var client=require(_0x0dcf('0x0'));exports[_0x0dcf('0x1')]=function(_0x262635,_0x9a858b){return client[_0x0dcf('0x2')]('UpdateOpenchannelInteraction',{'body':_0x9a858b,'options':{'where':{'id':_0x262635}},'log':_0x0dcf('0x3')});};exports['addTags']=function(_0x144f2d,_0x2f7421){return client[_0x0dcf('0x2')](_0x0dcf('0x4'),{'body':_0x2f7421,'options':{'where':{'id':_0x144f2d}},'log':_0x0dcf('0x5')});}; \ No newline at end of file +var _0xaf11=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0xe4bae2,_0xe63239){var _0x3a4f5f=function(_0xb738ef){while(--_0xb738ef){_0xe4bae2['push'](_0xe4bae2['shift']());}};_0x3a4f5f(++_0xe63239);}(_0xaf11,0x15e));var _0x1af1=function(_0x4ae613,_0x377384){_0x4ae613=_0x4ae613-0x0;var _0x5f714a=_0xaf11[_0x4ae613];return _0x5f714a;};'use strict';var client=require(_0x1af1('0x0'));exports[_0x1af1('0x1')]=function(_0x1ef113,_0x51fa96){return client[_0x1af1('0x2')]('UpdateOpenchannelInteraction',{'body':_0x51fa96,'options':{'where':{'id':_0x1ef113}},'log':_0x1af1('0x3')});};exports['addTags']=function(_0x115855,_0x305c06){return client[_0x1af1('0x2')](_0x1af1('0x4'),{'body':_0x305c06,'options':{'where':{'id':_0x115855}},'log':_0x1af1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 85b89ef..932544c 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 _0x24cf=['CreateOpenchannelMessage','../client','create','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x24cf,0x121));var _0xf24c=function(_0x4fd06a,_0x252f06){_0x4fd06a=_0x4fd06a-0x0;var _0xbe3793=_0x24cf[_0x4fd06a];return _0xbe3793;};'use strict';var client=require(_0xf24c('0x0'));exports[_0xf24c('0x1')]=function(_0x2728a5){return client[_0xf24c('0x2')](_0xf24c('0x3'),{'body':_0x2728a5,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x91f2=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x91f2,0xe7));var _0x291f=function(_0x50e6ba,_0x4c816f){_0x50e6ba=_0x50e6ba-0x0;var _0x1ad4f7=_0x91f2[_0x50e6ba];return _0x1ad4f7;};'use strict';var client=require('../client');exports[_0x291f('0x0')]=function(_0x119d86){return client[_0x291f('0x1')](_0x291f('0x2'),{'body':_0x119d86,'log':_0x291f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 75e2473..dc6f41f 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 _0x8b7f=['Agents','openchannelPause','../client','getOpenchannelQueues','name','User'];(function(_0x204d00,_0x2cedbf){var _0x684f4f=function(_0x34a3ff){while(--_0x34a3ff){_0x204d00['push'](_0x204d00['shift']());}};_0x684f4f(++_0x2cedbf);}(_0x8b7f,0x17c));var _0xf8b7=function(_0x12ea4a,_0x5491d3){_0x12ea4a=_0x12ea4a-0x0;var _0xc88b23=_0x8b7f[_0x12ea4a];return _0xc88b23;};'use strict';var client=require(_0xf8b7('0x0'));exports[_0xf8b7('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xf8b7('0x2'),'timeout','strategy'],'include':[{'model':_0xf8b7('0x3'),'as':_0xf8b7('0x4'),'attributes':['id','name','online',_0xf8b7('0x5')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x3d5e=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents'];(function(_0x245a7d,_0x253c2f){var _0x24789d=function(_0x189e60){while(--_0x189e60){_0x245a7d['push'](_0x245a7d['shift']());}};_0x24789d(++_0x253c2f);}(_0x3d5e,0x124));var _0xe3d5=function(_0x4b0a01,_0x52d11f){_0x4b0a01=_0x4b0a01-0x0;var _0x5a0ac6=_0x3d5e[_0x4b0a01];return _0x5a0ac6;};'use strict';var client=require(_0xe3d5('0x0'));exports[_0xe3d5('0x1')]=function(){return function(){return client[_0xe3d5('0x2')](_0xe3d5('0x3'),{'options':{'raw':![],'attributes':['id',_0xe3d5('0x4'),'timeout',_0xe3d5('0x5')],'include':[{'model':_0xe3d5('0x6'),'as':_0xe3d5('0x7'),'attributes':['id',_0xe3d5('0x4'),_0xe3d5('0x8'),_0xe3d5('0x9')]}]},'log':_0xe3d5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5b1b41c..0ce80d0 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 _0x9829=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x4a82b9,_0x4ef826){var _0x230a38=function(_0x899506){while(--_0x899506){_0x4a82b9['push'](_0x4a82b9['shift']());}};_0x230a38(++_0x4ef826);}(_0x9829,0xfb));var _0x9982=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x9829[_0x454018];return _0x24697d;};'use strict';var client=require(_0x9982('0x0'));exports['create']=function(_0x486d89){return client[_0x9982('0x1')]('CreateOpenchannelQueueReport',{'body':_0x486d89,'log':_0x9982('0x2')});};exports[_0x9982('0x3')]=function(_0x276750,_0x47bbf1){return client[_0x9982('0x1')](_0x9982('0x4'),{'body':_0x47bbf1,'options':{'where':{'uniqueid':_0x276750},'order':[['id',_0x9982('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x927e=['../client','create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x270240,_0x16f655){var _0x54ca1f=function(_0x5b5c35){while(--_0x5b5c35){_0x270240['push'](_0x270240['shift']());}};_0x54ca1f(++_0x16f655);}(_0x927e,0x1ab));var _0xe927=function(_0x48026e,_0x2bb295){_0x48026e=_0x48026e-0x0;var _0x4b42aa=_0x927e[_0x48026e];return _0x4b42aa;};'use strict';var client=require(_0xe927('0x0'));exports[_0xe927('0x1')]=function(_0x4b582d){return client['Request'](_0xe927('0x2'),{'body':_0x4b582d,'log':_0xe927('0x2')});};exports[_0xe927('0x3')]=function(_0x44f4a1,_0x7a169){return client[_0xe927('0x4')](_0xe927('0x5'),{'body':_0x7a169,'options':{'where':{'uniqueid':_0x44f4a1},'order':[['id',_0xe927('0x6')]],'limit':0x1},'log':_0xe927('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index f901031..b80e5e4 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 _0x85d8=['../client','update','Request','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x591b0e,_0x24b44a){var _0x52f471=function(_0x3843aa){while(--_0x3843aa){_0x591b0e['push'](_0x591b0e['shift']());}};_0x52f471(++_0x24b44a);}(_0x85d8,0x1b0));var _0x885d=function(_0x2bae3e,_0x4966e0){_0x2bae3e=_0x2bae3e-0x0;var _0x411f99=_0x85d8[_0x2bae3e];return _0x411f99;};'use strict';var client=require(_0x885d('0x0'));exports[_0x885d('0x1')]=function(_0x347816,_0x763604){return client[_0x885d('0x2')]('UpdateSmsInteraction',{'body':_0x763604,'options':{'where':{'id':_0x347816}},'log':_0x885d('0x3')});};exports[_0x885d('0x4')]=function(_0x320d7d,_0x3fe8a0){return client['Request']('AddTagsToSmsInteraction',{'body':_0x3fe8a0,'options':{'where':{'id':_0x320d7d}},'log':_0x885d('0x5')});}; \ No newline at end of file +var _0xb7fc=['UpdateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request'];(function(_0x4cbf58,_0x237046){var _0x46e759=function(_0x48cdbb){while(--_0x48cdbb){_0x4cbf58['push'](_0x4cbf58['shift']());}};_0x46e759(++_0x237046);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x779496,_0x9b0b0b){_0x779496=_0x779496-0x0;var _0x472493=_0xb7fc[_0x779496];return _0x472493;};'use strict';var client=require(_0xcb7f('0x0'));exports['update']=function(_0x52c9f2,_0x189517){return client[_0xcb7f('0x1')](_0xcb7f('0x2'),{'body':_0x189517,'options':{'where':{'id':_0x52c9f2}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x23c877,_0x28247a){return client[_0xcb7f('0x1')](_0xcb7f('0x3'),{'body':_0x28247a,'options':{'where':{'id':_0x23c877}},'log':_0xcb7f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e0be087..4eff9b8 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 _0xb8ec=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x1f0e77,_0x37a67f){var _0x4d4419=function(_0x33eee1){while(--_0x33eee1){_0x1f0e77['push'](_0x1f0e77['shift']());}};_0x4d4419(++_0x37a67f);}(_0xb8ec,0x166));var _0xcb8e=function(_0x4dda87,_0x1cb885){_0x4dda87=_0x4dda87-0x0;var _0x36bb3b=_0xb8ec[_0x4dda87];return _0x36bb3b;};'use strict';var client=require(_0xcb8e('0x0'));exports[_0xcb8e('0x1')]=function(_0x11c49f){return client[_0xcb8e('0x2')](_0xcb8e('0x3'),{'body':_0x11c49f,'log':_0xcb8e('0x4')});}; \ No newline at end of file +var _0xa17a=['Request','CreateSmsMessage','../client','create'];(function(_0x2860ae,_0x53a09c){var _0x267f05=function(_0x21da6e){while(--_0x21da6e){_0x2860ae['push'](_0x2860ae['shift']());}};_0x267f05(++_0x53a09c);}(_0xa17a,0x9a));var _0xaa17=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xa17a[_0x5b740b];return _0x6f8f4e;};'use strict';var client=require(_0xaa17('0x0'));exports[_0xaa17('0x1')]=function(_0x166f77){return client[_0xaa17('0x2')](_0xaa17('0x3'),{'body':_0x166f77,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index ade44af..54b5180 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0xf07c6e,_0x54bd6d){var _0x636721=function(_0x25b693){while(--_0x25b693){_0xf07c6e['push'](_0xf07c6e['shift']());}};_0x636721(++_0x54bd6d);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x5537e6,_0xddf3dc){var _0x44115a=function(_0x5beb06){while(--_0x5beb06){_0x5537e6['push'](_0x5537e6['shift']());}};_0x44115a(++_0xddf3dc);}(_0x70e0,0x17b));var _0x070e=function(_0x370f74,_0x5acebb){_0x370f74=_0x370f74-0x0;var _0x5ce117=_0x70e0[_0x370f74];return _0x5ce117;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 2abed5b..320e08d 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x504223,_0x2b03f6){var _0x53c4a8=function(_0x86823f){while(--_0x86823f){_0x504223['push'](_0x504223['shift']());}};_0x53c4a8(++_0x2b03f6);}(_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){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x5025dd,_0x187ba7){var _0x4765b7=function(_0x4dd204){while(--_0x4dd204){_0x5025dd['push'](_0x5025dd['shift']());}};_0x4765b7(++_0x187ba7);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 8e58958..4a96723 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(_0xda5e08,_0xbae603){var _0x280d0d=function(_0x8fd0d7){while(--_0x8fd0d7){_0xda5e08['push'](_0xda5e08['shift']());}};_0x280d0d(++_0xbae603);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x1c8b63,_0x5c2cd2){var _0x227879=function(_0x32295a){while(--_0x32295a){_0x1c8b63['push'](_0x1c8b63['shift']());}};_0x227879(++_0x5c2cd2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 6b0165c..5a244ff 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 _0xee3c=['../client','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x40c72c,_0x51ab94){var _0x41ccd2=function(_0x19d7cd){while(--_0x19d7cd){_0x40c72c['push'](_0x40c72c['shift']());}};_0x41ccd2(++_0x51ab94);}(_0xee3c,0x14a));var _0xcee3=function(_0x31b049,_0x44c6a1){_0x31b049=_0x31b049-0x0;var _0x5204ac=_0xee3c[_0x31b049];return _0x5204ac;};'use strict';var client=require(_0xcee3('0x0'));exports[_0xcee3('0x1')]=function(_0x325d92,_0x3de08f){return client[_0xcee3('0x2')](_0xcee3('0x3'),{'body':_0x3de08f,'options':{'where':{'id':_0x325d92}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x435892,_0x4cd398){return client[_0xcee3('0x2')](_0xcee3('0x4'),{'body':_0x4cd398,'options':{'where':{'id':_0x435892}},'log':_0xcee3('0x5')});}; \ No newline at end of file +var _0x53ec=['../client','update','Request','UpdateWhatsappInteraction','addTags','addTagsToWhatsappInteraction'];(function(_0x544e15,_0x534688){var _0x4f5617=function(_0x381c9b){while(--_0x381c9b){_0x544e15['push'](_0x544e15['shift']());}};_0x4f5617(++_0x534688);}(_0x53ec,0x192));var _0xc53e=function(_0x5b9dd7,_0x43a06e){_0x5b9dd7=_0x5b9dd7-0x0;var _0x49ec19=_0x53ec[_0x5b9dd7];return _0x49ec19;};'use strict';var client=require(_0xc53e('0x0'));exports[_0xc53e('0x1')]=function(_0x2d5f51,_0x476d3a){return client[_0xc53e('0x2')](_0xc53e('0x3'),{'body':_0x476d3a,'options':{'where':{'id':_0x2d5f51}},'log':'updateWhatsappInteraction'});};exports[_0xc53e('0x4')]=function(_0x4e954a,_0x2b90f6){return client[_0xc53e('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x2b90f6,'options':{'where':{'id':_0x4e954a}},'log':_0xc53e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4b08d02..7d0c383 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 _0x0b90=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x1298f7,_0x30ae04){var _0xa02335=function(_0x1377b1){while(--_0x1377b1){_0x1298f7['push'](_0x1298f7['shift']());}};_0xa02335(++_0x30ae04);}(_0x0b90,0xed));var _0x00b9=function(_0x3512c3,_0x346843){_0x3512c3=_0x3512c3-0x0;var _0x3b2842=_0x0b90[_0x3512c3];return _0x3b2842;};'use strict';var client=require(_0x00b9('0x0'));exports[_0x00b9('0x1')]=function(_0x55b0de){return client['Request'](_0x00b9('0x2'),{'body':_0x55b0de,'log':_0x00b9('0x3')});}; \ No newline at end of file +var _0x74ef=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x4278fc,_0x138e9d){var _0x11cf77=function(_0x451e08){while(--_0x451e08){_0x4278fc['push'](_0x4278fc['shift']());}};_0x11cf77(++_0x138e9d);}(_0x74ef,0xae));var _0xf74e=function(_0xb604d9,_0x2ca058){_0xb604d9=_0xb604d9-0x0;var _0x2c7828=_0x74ef[_0xb604d9];return _0x2c7828;};'use strict';var client=require(_0xf74e('0x0'));exports[_0xf74e('0x1')]=function(_0x29c243){return client[_0xf74e('0x2')](_0xf74e('0x3'),{'body':_0x29c243,'log':_0xf74e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ee2ddb3..7735824 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 _0xe1f0=['name','timeout','strategy','User','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0xe1f0,0x1ac));var _0x0e1f=function(_0x52f313,_0x549b80){_0x52f313=_0x52f313-0x0;var _0x947225=_0xe1f0[_0x52f313];return _0x947225;};'use strict';var client=require(_0x0e1f('0x0'));exports[_0x0e1f('0x1')]=function(){return function(){return client[_0x0e1f('0x2')](_0x0e1f('0x3'),{'options':{'raw':![],'attributes':['id',_0x0e1f('0x4'),_0x0e1f('0x5'),_0x0e1f('0x6')],'include':[{'model':_0x0e1f('0x7'),'as':'Agents','attributes':['id',_0x0e1f('0x4'),'online',_0x0e1f('0x8')]}]},'log':_0x0e1f('0x1')});};}; \ No newline at end of file +var _0x9b38=['getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout','strategy','User','online'];(function(_0xe4d6c6,_0x3bdbf2){var _0x3a8935=function(_0x131483){while(--_0x131483){_0xe4d6c6['push'](_0xe4d6c6['shift']());}};_0x3a8935(++_0x3bdbf2);}(_0x9b38,0xd0));var _0x89b3=function(_0x16812c,_0x293ecc){_0x16812c=_0x16812c-0x0;var _0x49f3ed=_0x9b38[_0x16812c];return _0x49f3ed;};'use strict';var client=require(_0x89b3('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x89b3('0x1')](_0x89b3('0x2'),{'options':{'raw':![],'attributes':['id',_0x89b3('0x3'),_0x89b3('0x4'),_0x89b3('0x5')],'include':[{'model':_0x89b3('0x6'),'as':'Agents','attributes':['id',_0x89b3('0x3'),_0x89b3('0x7'),'whatsappPause']}]},'log':_0x89b3('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 7e8077a..a1f064d 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 _0x71d3=['UpdateWhatsappQueueReport','Request','CreateWhatsappQueueReport','update'];(function(_0x4e05a7,_0x5301f7){var _0xcdd47d=function(_0x5da300){while(--_0x5da300){_0x4e05a7['push'](_0x4e05a7['shift']());}};_0xcdd47d(++_0x5301f7);}(_0x71d3,0x191));var _0x371d=function(_0x2dfcad,_0x427431){_0x2dfcad=_0x2dfcad-0x0;var _0x564698=_0x71d3[_0x2dfcad];return _0x564698;};'use strict';var client=require('../client');exports['create']=function(_0x3de7c6){return client[_0x371d('0x0')](_0x371d('0x1'),{'body':_0x3de7c6,'log':'CreateWhatsappQueueReport'});};exports[_0x371d('0x2')]=function(_0x3cc4e7,_0x533074){return client[_0x371d('0x0')]('UpdateWhatsappQueueReport',{'body':_0x533074,'options':{'where':{'uniqueid':_0x3cc4e7},'order':[['id','DESC']],'limit':0x1},'log':_0x371d('0x3')});}; \ No newline at end of file +var _0xd7ee=['UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport','update','Request'];(function(_0x3ef036,_0x19c989){var _0x35b5aa=function(_0x54d54c){while(--_0x54d54c){_0x3ef036['push'](_0x3ef036['shift']());}};_0x35b5aa(++_0x19c989);}(_0xd7ee,0x19f));var _0xed7e=function(_0x6dc241,_0x3d6db7){_0x6dc241=_0x6dc241-0x0;var _0xac50e7=_0xd7ee[_0x6dc241];return _0xac50e7;};'use strict';var client=require(_0xed7e('0x0'));exports[_0xed7e('0x1')]=function(_0x27a8c8){return client['Request'](_0xed7e('0x2'),{'body':_0x27a8c8,'log':_0xed7e('0x2')});};exports[_0xed7e('0x3')]=function(_0x1c1316,_0x3e09ed){return client[_0xed7e('0x4')](_0xed7e('0x5'),{'body':_0x3e09ed,'options':{'where':{'uniqueid':_0x1c1316},'order':[['id',_0xed7e('0x6')]],'limit':0x1},'log':_0xed7e('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 63b80b9..1a1b41e 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 _0x0ff1=['[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','createQueue','channel','format','START:%s','rules','end','close','complete','next','agent','stop','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','error'];(function(_0x165472,_0x9d40ec){var _0x358714=function(_0x4c8536){while(--_0x4c8536){_0x165472['push'](_0x165472['shift']());}};_0x358714(++_0x9d40ec);}(_0x0ff1,0x1ad));var _0x10ff=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x0ff1[_0x5a5395];return _0x4da43d;};'use strict';var schema=require(_0x10ff('0x0'));var _=require(_0x10ff('0x1'));var util=require(_0x10ff('0x2'));var seqqueue=require(_0x10ff('0x3'));var logger=require('../../../../config/logger')(_0x10ff('0x4'));var strategy=require(_0x10ff('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x10ff('0x6'),'message':_0x10ff('0x7')}});function writeLog(_0x1f20f9,_0x5485f0,_0x5b2a48){return logger[_0x10ff('0x8')](util['format'](_0x10ff('0x9'),_0x1f20f9,_0x5485f0[_0x10ff('0xa')],_0x5b2a48));}function handleFindAgent(_0x536109){return function(_0x3fb191){return _0x3fb191[_0x10ff('0xa')]['toLowerCase']()===_0x536109['toLowerCase']();};}exports[_0x10ff('0xb')]=function(_0x16919d,_0x2f5798,_0x224b99,_0x301763){return function(_0x556e90){try{var _0x4a44a9={'name':_0x2f5798[0x0],'timeout':_0x2f5798[0x1]};var _0x41e72b=queue[_0x10ff('0x0')](_0x4a44a9,{'typecast':!![]});if(_0x41e72b['length']){logger[_0x10ff('0xc')](_0x10ff('0xd'),_0x16919d,_[_0x10ff('0xe')](_0x41e72b,_0x10ff('0xf'))[_0x10ff('0x10')](',\x20'));_0x556e90['stop']();}else{var _0x3f4e3a=_[_0x10ff('0x11')](_0x224b99[_0x10ff('0x12')],handleFindAgent(_0x4a44a9[_0x10ff('0xa')]));if(_0x3f4e3a){var _0xb789d6=(_0x4a44a9[_0x10ff('0x13')]||0xa)*0x3e8;var _0x3cc144,_0x3e7e5c;var _0x39860e=seqqueue[_0x10ff('0x14')](_0xb789d6);_0x39860e['id']=_0x16919d;_0x39860e['atimeout']=_0xb789d6;_0x39860e[_0x10ff('0x15')]=_0x301763['channel'];writeLog(_0x16919d,_0x3f4e3a,util[_0x10ff('0x16')](_0x10ff('0x17'),_0xb789d6));_0x224b99[_0x10ff('0x18')][_0x16919d]['on'](_0x10ff('0x19'),function(){logger[_0x10ff('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x16919d);clearTimeout(_0x3e7e5c);_0x3e7e5c=undefined;_0x39860e[_0x10ff('0x1a')]();if(_0x224b99[_0x10ff('0x18')][_0x16919d]){delete _0x224b99['rules'][_0x16919d];}_0x556e90['stop']();});_0x224b99[_0x10ff('0x18')][_0x16919d]['on'](_0x10ff('0x1b'),function(){if(_0x224b99[_0x10ff('0x18')][_0x16919d]){delete _0x224b99[_0x10ff('0x18')][_0x16919d];}});_0x3e7e5c=setTimeout(function(){logger[_0x10ff('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x16919d);clearTimeout(_0x3e7e5c);_0x39860e[_0x10ff('0x1a')]();_0x556e90[_0x10ff('0x1c')]();},_0xb789d6);strategy[_0x10ff('0x1d')](_0x39860e,_0x3f4e3a,_0x224b99,_0x301763);}else{logger[_0x10ff('0xc')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x16919d,_0x4a44a9[_0x10ff('0xa')]);_0x556e90[_0x10ff('0x1e')]();}}}catch(_0x37aab6){console[_0x10ff('0x1f')](_0x37aab6);logger[_0x10ff('0xc')](_0x10ff('0x20'),_0x16919d,_0x37aab6[_0x10ff('0x21')]);_0x556e90[_0x10ff('0x1e')]();}};}; \ No newline at end of file +var _0xec19=['channel','format','START:%s','rules','end','close','stop','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','find','createQueue','atimeout'];(function(_0x398e9e,_0x1e6f59){var _0x451bbf=function(_0x28c858){while(--_0x28c858){_0x398e9e['push'](_0x398e9e['shift']());}};_0x451bbf(++_0x1e6f59);}(_0xec19,0x95));var _0x9ec1=function(_0x15945a,_0x2004c9){_0x15945a=_0x15945a-0x0;var _0x4454ef=_0xec19[_0x15945a];return _0x4454ef;};'use strict';var schema=require(_0x9ec1('0x0'));var _=require('lodash');var util=require(_0x9ec1('0x1'));var seqqueue=require(_0x9ec1('0x2'));var logger=require(_0x9ec1('0x3'))(_0x9ec1('0x4'));var strategy=require(_0x9ec1('0x5'));var queue=schema({'name':{'type':_0x9ec1('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9ec1('0x7'),'message':_0x9ec1('0x8')}});function writeLog(_0x469480,_0x4f693c,_0x391440){return logger['info'](util['format'](_0x9ec1('0x9'),_0x469480,_0x4f693c['name'],_0x391440));}function handleFindAgent(_0xc1ed0e){return function(_0x439f58){return _0x439f58[_0x9ec1('0xa')][_0x9ec1('0xb')]()===_0xc1ed0e[_0x9ec1('0xb')]();};}exports[_0x9ec1('0xc')]=function(_0x2d97e2,_0x2b79b6,_0x3b12b1,_0x1cc8b3){return function(_0x1b6f4e){try{var _0x3489d1={'name':_0x2b79b6[0x0],'timeout':_0x2b79b6[0x1]};var _0x52998f=queue[_0x9ec1('0x0')](_0x3489d1,{'typecast':!![]});if(_0x52998f[_0x9ec1('0xd')]){logger[_0x9ec1('0xe')](_0x9ec1('0xf'),_0x2d97e2,_[_0x9ec1('0x10')](_0x52998f,_0x9ec1('0x11'))['join'](',\x20'));_0x1b6f4e['stop']();}else{var _0x567aab=_[_0x9ec1('0x12')](_0x3b12b1['agents'],handleFindAgent(_0x3489d1['name']));if(_0x567aab){var _0x3a478d=(_0x3489d1['timeout']||0xa)*0x3e8;var _0x15534b,_0x278cda;var _0x308045=seqqueue[_0x9ec1('0x13')](_0x3a478d);_0x308045['id']=_0x2d97e2;_0x308045[_0x9ec1('0x14')]=_0x3a478d;_0x308045[_0x9ec1('0x15')]=_0x1cc8b3[_0x9ec1('0x15')];writeLog(_0x2d97e2,_0x567aab,util[_0x9ec1('0x16')](_0x9ec1('0x17'),_0x3a478d));_0x3b12b1[_0x9ec1('0x18')][_0x2d97e2]['on'](_0x9ec1('0x19'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x2d97e2);clearTimeout(_0x278cda);_0x278cda=undefined;_0x308045[_0x9ec1('0x1a')]();if(_0x3b12b1[_0x9ec1('0x18')][_0x2d97e2]){delete _0x3b12b1[_0x9ec1('0x18')][_0x2d97e2];}_0x1b6f4e[_0x9ec1('0x1b')]();});_0x3b12b1[_0x9ec1('0x18')][_0x2d97e2]['on'](_0x9ec1('0x1c'),function(){if(_0x3b12b1[_0x9ec1('0x18')][_0x2d97e2]){delete _0x3b12b1['rules'][_0x2d97e2];}});_0x278cda=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x2d97e2);clearTimeout(_0x278cda);_0x308045['close']();_0x1b6f4e[_0x9ec1('0x1d')]();},_0x3a478d);strategy[_0x9ec1('0x1e')](_0x308045,_0x567aab,_0x3b12b1,_0x1cc8b3);}else{logger['error'](_0x9ec1('0x1f'),_0x2d97e2,_0x3489d1[_0x9ec1('0xa')]);_0x1b6f4e[_0x9ec1('0x1b')]();}}}catch(_0x2f1857){console[_0x9ec1('0x20')](_0x2f1857);logger[_0x9ec1('0xe')]('[%s][QUEUE]\x20%s',_0x2d97e2,_0x2f1857[_0x9ec1('0x21')]);_0x1b6f4e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 2910ba9..78fd7cb 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 _0xb7fa=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','interaction','chat','account','upperFirst','AccountId','InteractionId','body','getMustacheRender','create','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','providerName','then','dialogState','Failed','stringify','lodash','moment','aws-sdk','./utils','routing','../../rpc/openchannelMessage'];(function(_0x545fd1,_0x27c094){var _0xe4a20b=function(_0x291ff5){while(--_0x291ff5){_0x545fd1['push'](_0x545fd1['shift']());}};_0xe4a20b(++_0x27c094);}(_0xb7fa,0x1e9));var _0xab7f=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0xb7fa[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0xab7f('0x0'));var moment=require(_0xab7f('0x1'));var AWS=require(_0xab7f('0x2'));var utils=require(_0xab7f('0x3'));var logger=require('../../../../config/logger')(_0xab7f('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xab7f('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xab7f('0x6')),'faxMessage':require(_0xab7f('0x7')),'whatsappMessage':require(_0xab7f('0x8'))};exports[_0xab7f('0x9')]=function(_0x8b539b,_0x299e08){return function(_0x1342db){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0xab7f('0xa')](_0xab7f('0xb'),_0x8b539b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1342db[_0xab7f('0xc')]();}var _0x2905d0={'ContactId':this[_0xab7f('0xd')]['id'],'sentAt':moment()[_0xab7f('0xe')](_0xab7f('0xf')),'direction':_0xab7f('0x10')};if(this['channel']===_0xab7f('0x11')||this[_0xab7f('0x12')]===_0xab7f('0x13')){_0x2905d0[_0xab7f('0x14')]=this[_0xab7f('0x15')]['phone'];}var _0x58d008=this[_0xab7f('0x12')];if(_0x58d008===_0xab7f('0x16')){_0x2905d0['ChatWebsiteId']=this[_0xab7f('0x17')]['id'];}else{_0x2905d0[_[_0xab7f('0x18')](_0x58d008)+_0xab7f('0x19')]=this[_0xab7f('0x17')]['id'];}_0x2905d0[_[_0xab7f('0x18')](_0x58d008)+_0xab7f('0x1a')]=this[_0xab7f('0x15')]['id'];if(this['interaction']['created']){var _0x5a6bad=_0x299e08[0x4];if(!_['isEmpty'](_0x5a6bad)){_0x2905d0[_0xab7f('0x1b')]=utils[_0xab7f('0x1c')](_0x5a6bad,this);return rpc[_0x58d008+'Message'][_0xab7f('0x1d')](_0x2905d0)['then'](function(_0xdd612c){logger['info'](_0xab7f('0xb'),_0x8b539b,_0x2905d0['body']);})[_0xab7f('0x1e')](function(_0x1d1afd){logger[_0xab7f('0x1f')](_0xab7f('0xb'),_0x8b539b,JSON['stringify'](_0x1d1afd));})[_0xab7f('0x20')](function(){logger[_0xab7f('0xa')](_0xab7f('0x21'),_0x8b539b);_0x1342db[_0xab7f('0x22')]();});}else{logger[_0xab7f('0xa')](_0xab7f('0x23'),_0x8b539b);_0x1342db[_0xab7f('0x22')]();}}else{var _0x4c0ecd=this;var _0x301924=new AWS['LexRuntime']({'accessKeyId':_0x299e08[0x0],'secretAccessKey':_0x299e08[0x1],'region':_0x299e08[0x2]});var _0x5b89fc={'botAlias':_0xab7f('0x24'),'botName':_0x299e08[0x3],'inputText':this[_0xab7f('0x25')][_0xab7f('0x1b')],'userId':this[_0xab7f('0x12')]+':'+this[_0xab7f('0x15')]['id']['toString']()};_0x301924[_0xab7f('0x26')](_0x5b89fc,function(_0x449163,_0x1758bf){if(_0x449163){logger['error'](_0xab7f('0xb'),_0x8b539b,_0x449163['message']);_0x1342db['next']();}else if(_0x1758bf&&_0x1758bf['message']){_0x4c0ecd['body'][_0xab7f('0x27')]=_0x1758bf;_0x2905d0[_0xab7f('0x1b')]=_0x1758bf[_0xab7f('0x25')];_0x2905d0[_0xab7f('0x28')]=_0xab7f('0x27');_0x2905d0['providerResponse']=JSON['stringify'](_0x1758bf);return rpc[_0x58d008+'Message'][_0xab7f('0x1d')](_0x2905d0)[_0xab7f('0x29')](function(_0x31e393){logger[_0xab7f('0xa')](_0xab7f('0xb'),_0x8b539b,_0x2905d0[_0xab7f('0x1b')]);if(_0x1758bf[_0xab7f('0x2a')]==_0xab7f('0x2b')){_0x1342db[_0xab7f('0xc')]();}else{_0x1342db[_0xab7f('0x22')]();}})[_0xab7f('0x1e')](function(_0x22a1c3){logger['error']('[%s][AMAZONLEX]\x20%s',_0x8b539b,JSON[_0xab7f('0x2c')](_0x22a1c3));_0x1342db[_0xab7f('0xc')]();});}else{_0x1342db[_0xab7f('0xc')]();}});}}catch(_0x4be982){logger[_0xab7f('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x8b539b,JSON[_0xab7f('0x2c')](_0x4be982));_0x1342db[_0xab7f('0x22')]();}};}; \ No newline at end of file +var _0x0b2a=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','created','getMustacheRender','create','body','catch','error','stringify','[%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','toString','amazonlex','providerName','providerResponse','Message','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x545262,_0x37382a){var _0x368866=function(_0xbfc841){while(--_0xbfc841){_0x545262['push'](_0x545262['shift']());}};_0x368866(++_0x37382a);}(_0x0b2a,0x169));var _0xa0b2=function(_0x2e1013,_0x19f287){_0x2e1013=_0x2e1013-0x0;var _0xc7af59=_0x0b2a[_0x2e1013];return _0xc7af59;};'use strict';var _=require(_0xa0b2('0x0'));var moment=require(_0xa0b2('0x1'));var AWS=require(_0xa0b2('0x2'));var utils=require(_0xa0b2('0x3'));var logger=require(_0xa0b2('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa0b2('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa0b2('0x6')),'faxMessage':require(_0xa0b2('0x7')),'whatsappMessage':require(_0xa0b2('0x8'))};exports[_0xa0b2('0x9')]=function(_0x2a0803,_0x1451a8){return function(_0x18d48d){try{if(!_['isNil'](this[_0xa0b2('0xa')][_0xa0b2('0xb')])){logger[_0xa0b2('0xc')](_0xa0b2('0xd'),_0x2a0803,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x18d48d[_0xa0b2('0xe')]();}var _0x1a8e3b={'ContactId':this[_0xa0b2('0xf')]['id'],'sentAt':moment()[_0xa0b2('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa0b2('0x11')};if(this[_0xa0b2('0x12')]==='sms'||this[_0xa0b2('0x12')]===_0xa0b2('0x13')){_0x1a8e3b[_0xa0b2('0x14')]=this[_0xa0b2('0xa')][_0xa0b2('0x14')];}var _0x55dfc0=this[_0xa0b2('0x12')];if(_0x55dfc0===_0xa0b2('0x15')){_0x1a8e3b['ChatWebsiteId']=this[_0xa0b2('0x16')]['id'];}else{_0x1a8e3b[_[_0xa0b2('0x17')](_0x55dfc0)+_0xa0b2('0x18')]=this[_0xa0b2('0x16')]['id'];}_0x1a8e3b[_[_0xa0b2('0x17')](_0x55dfc0)+'InteractionId']=this[_0xa0b2('0xa')]['id'];if(this[_0xa0b2('0xa')][_0xa0b2('0x19')]){var _0x3b109c=_0x1451a8[0x4];if(!_['isEmpty'](_0x3b109c)){_0x1a8e3b['body']=utils[_0xa0b2('0x1a')](_0x3b109c,this);return rpc[_0x55dfc0+'Message'][_0xa0b2('0x1b')](_0x1a8e3b)['then'](function(_0x2d36d6){logger[_0xa0b2('0xc')](_0xa0b2('0xd'),_0x2a0803,_0x1a8e3b[_0xa0b2('0x1c')]);})[_0xa0b2('0x1d')](function(_0x2107ac){logger[_0xa0b2('0x1e')](_0xa0b2('0xd'),_0x2a0803,JSON[_0xa0b2('0x1f')](_0x2107ac));})['finally'](function(){logger[_0xa0b2('0xc')](_0xa0b2('0x20'),_0x2a0803);_0x18d48d[_0xa0b2('0x21')]();});}else{logger[_0xa0b2('0xc')](_0xa0b2('0x22'),_0x2a0803);_0x18d48d[_0xa0b2('0x21')]();}}else{var _0x45b762=this;var _0x2cd7bd=new AWS[(_0xa0b2('0x23'))]({'accessKeyId':_0x1451a8[0x0],'secretAccessKey':_0x1451a8[0x1],'region':_0x1451a8[0x2]});var _0x327676={'botAlias':_0xa0b2('0x24'),'botName':_0x1451a8[0x3],'inputText':this[_0xa0b2('0x25')][_0xa0b2('0x1c')],'userId':this['channel']+':'+this['interaction']['id'][_0xa0b2('0x26')]()};_0x2cd7bd['postText'](_0x327676,function(_0x4c8ce7,_0xf0dcb4){if(_0x4c8ce7){logger['error'](_0xa0b2('0xd'),_0x2a0803,_0x4c8ce7[_0xa0b2('0x25')]);_0x18d48d[_0xa0b2('0xe')]();}else if(_0xf0dcb4&&_0xf0dcb4[_0xa0b2('0x25')]){_0x45b762[_0xa0b2('0x1c')][_0xa0b2('0x27')]=_0xf0dcb4;_0x1a8e3b['body']=_0xf0dcb4['message'];_0x1a8e3b[_0xa0b2('0x28')]=_0xa0b2('0x27');_0x1a8e3b[_0xa0b2('0x29')]=JSON[_0xa0b2('0x1f')](_0xf0dcb4);return rpc[_0x55dfc0+_0xa0b2('0x2a')][_0xa0b2('0x1b')](_0x1a8e3b)[_0xa0b2('0x2b')](function(_0x2b1b0d){logger[_0xa0b2('0xc')](_0xa0b2('0xd'),_0x2a0803,_0x1a8e3b[_0xa0b2('0x1c')]);if(_0xf0dcb4[_0xa0b2('0x2c')]==_0xa0b2('0x2d')){_0x18d48d[_0xa0b2('0xe')]();}else{_0x18d48d[_0xa0b2('0x21')]();}})[_0xa0b2('0x1d')](function(_0x1ce830){logger[_0xa0b2('0x1e')](_0xa0b2('0xd'),_0x2a0803,JSON[_0xa0b2('0x1f')](_0x1ce830));_0x18d48d['next']();});}else{_0x18d48d[_0xa0b2('0xe')]();}});}}catch(_0x2944b6){logger['error'](_0xa0b2('0xd'),_0x2a0803,JSON['stringify'](_0x2944b6));_0x18d48d[_0xa0b2('0x21')]();}};}; \ 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 35ad731..8187536 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 _0x9079=['Re:','Re:\x20','chat','ChatWebsiteId','account','Message','inReplyTo','messageId','html','','';_0x4bace8[_0x9907('0x31')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x9907('0x32'),'Precedence':_0x9907('0x33')};return mailRpc[_0x9907('0x34')](this[_0x9907('0x2a')][_0x9907('0x35')],_0x4bace8)[_0x9907('0x36')](function(_0x2e7a10){logger[_0x9907('0x15')](_0x9907('0x37'),_0x5cacf9);_0x4bace8[_0x9907('0x2d')]=_0x2e7a10[_0x9907('0x22')]['messageId'];return rpc[_0x5c0044+_0x9907('0x2b')][_0x9907('0x38')](_0x4bace8);})[_0x9907('0x36')](function(_0x887197){logger[_0x9907('0x15')](_0x9907('0x16'),_0x5cacf9,JSON[_0x9907('0x39')](_0x887197));})[_0x9907('0x3a')](function(_0x72104c){logger[_0x9907('0x3b')]('[RPC][%s][AUTOREPLY]\x20%s',_0x5cacf9,JSON[_0x9907('0x39')](_0x72104c));})[_0x9907('0x3c')](function(){Promise[_0x9907('0x3d')]()[_0x9907('0x36')](function(){if(_0x3810f7[0x0]!=='2'||_0x51881f[_0x9907('0x3e')])return;return rpc[_0x5c0044+_0x9907('0x3f')][_0x9907('0x40')](_0x51881f['id'],{'autoreplyExecuted':!![]})['then'](function(_0xa76e21){logger[_0x9907('0x15')](_0x9907('0x1c'),_0x5cacf9,JSON[_0x9907('0x39')](_0xa76e21));})[_0x9907('0x3a')](function(_0x5b6d0a){logger[_0x9907('0x3b')](_0x9907('0x41'),_0x5cacf9,JSON[_0x9907('0x39')](_0x5b6d0a));});})[_0x9907('0x36')](function(){_0x51475f[_0x9907('0x17')]();});});}else{return rpc[this[_0x9907('0x11')]+'Message'][_0x9907('0x38')](_0x4bace8)[_0x9907('0x36')](function(){logger[_0x9907('0x15')](_0x9907('0x16'),_0x5cacf9,_0x4bace8[_0x9907('0x13')]);})['catch'](function(_0x18cdd2){logger[_0x9907('0x3b')]('[%s][AUTOREPLY]\x20%s',_0x5cacf9,JSON['stringify'](_0x18cdd2));})[_0x9907('0x3c')](function(){Promise['resolve']()[_0x9907('0x36')](function(){if(_0x3810f7[0x0]!=='2'||_0x51881f[_0x9907('0x3e')])return;return rpc[_0x5c0044+_0x9907('0x3f')][_0x9907('0x40')](_0x51881f['id'],{'autoreplyExecuted':!![]})['then'](function(_0x72e984){logger[_0x9907('0x15')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5cacf9,JSON[_0x9907('0x39')](_0x72e984));})[_0x9907('0x3a')](function(_0x518f0a){logger[_0x9907('0x3b')](_0x9907('0x41'),_0x5cacf9,JSON['stringify'](_0x518f0a));});})['then'](function(){_0x51475f[_0x9907('0x17')]();});});}}}catch(_0x16ab4a){logger['error'](_0x9907('0x16'),_0x5cacf9,JSON['stringify'](_0x16ab4a));_0x51475f['stop']();}};}; \ No newline at end of file +var _0x0274=['resolve','catch','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../mailRpc','mail','info','[%s][AUTOREPLY]\x20%s','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','message','phone','read','subject','channel','chat','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','replace','','headers','auto-replied','All','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally'];(function(_0x5965ef,_0x589e8e){var _0x228260=function(_0xd57c22){while(--_0xd57c22){_0x5965ef['push'](_0x5965ef['shift']());}};_0x228260(++_0x589e8e);}(_0x0274,0x7a));var _0x4027=function(_0x114c1c,_0x5bfd6d){_0x114c1c=_0x114c1c-0x0;var _0x50a0a6=_0x0274[_0x114c1c];return _0x50a0a6;};'use strict';var _=require(_0x4027('0x0'));var moment=require(_0x4027('0x1'));var utils=require('./utils');var logger=require(_0x4027('0x2'))(_0x4027('0x3'));var rpc={'chatMessage':require(_0x4027('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4027('0x5')),'smsMessage':require(_0x4027('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4027('0x7')),'chatInteraction':require(_0x4027('0x8')),'openchannelInteraction':require(_0x4027('0x9')),'mailInteraction':require(_0x4027('0xa')),'smsInteraction':require(_0x4027('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x4027('0xc'));exports['consequence']=function(_0x4d1177,_0x403b3c,_0x1576ae,_0x453f7b){return function(_0x3dff92){try{var _0x586b67=this['channel'];if(_0x586b67===_0x4027('0xd')&&_0x453f7b['body']['isAutoreply']){logger[_0x4027('0xe')](_0x4027('0xf'),_0x4d1177,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x3dff92[_0x4027('0x10')]();}if(_0x403b3c[0x0]==='1'&&(_['isNil'](this[_0x4027('0x11')][_0x4027('0x12')])||!this['interaction'][_0x4027('0x12')])){logger[_0x4027('0xe')](_0x4027('0xf'),_0x4d1177,_0x4027('0x13'));return _0x3dff92[_0x4027('0x10')]();}if(_0x403b3c[0x0]==='2'&&this[_0x4027('0x11')][_0x4027('0x14')]){logger['info'](_0x4027('0x15'),_0x4d1177,_0x4027('0x16'));return _0x3dff92[_0x4027('0x10')]();}var _0x510f73={'ContactId':this[_0x4027('0x17')]['id'],'sentAt':moment()[_0x4027('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4027('0x19')};if(this['channel']===_0x4027('0xd')){_0x510f73[_0x4027('0x1a')]=utils[_0x4027('0x1b')](_0x403b3c[0x2],this);}else{_0x510f73[_0x4027('0x1a')]=utils[_0x4027('0x1b')](_0x403b3c[0x1],this);}if(this[_0x4027('0x1c')]){_0x510f73['to']=this['message']['from']||'';if(this['channel']===_0x4027('0xd')&&_0x403b3c[0x1]==='1'){_0x510f73['cc']=this[_0x4027('0x1c')]['cc']||'';}_0x510f73['from']=this[_0x4027('0x1c')]['to']||'';_0x510f73[_0x4027('0x1d')]=this['message'][_0x4027('0x1d')]||'';_0x510f73[_0x4027('0x1e')]=!![];if(this[_0x4027('0x1c')][_0x4027('0x1f')]){_0x510f73[_0x4027('0x1f')]='';_0x510f73[_0x4027('0x1f')]+=_['startsWith'](this['message'][_0x4027('0x1f')],'Re:')?'':'Re:\x20';_0x510f73['subject']+=this[_0x4027('0x1c')]['subject'];}}if(this[_0x4027('0x20')]===_0x4027('0x21')){_0x510f73['ChatWebsiteId']=this[_0x4027('0x22')]['id'];}else{_0x510f73[_[_0x4027('0x23')](this['channel'])+_0x4027('0x24')]=this[_0x4027('0x22')]['id'];}_0x510f73[_['upperFirst'](this[_0x4027('0x20')])+_0x4027('0x25')]=this[_0x4027('0x11')]['id'];var _0x57f6d8=this[_0x4027('0x11')];if(rpc[this[_0x4027('0x20')]+_0x4027('0x26')]){if(this[_0x4027('0x20')]==='mail'){_0x510f73[_0x4027('0x27')]=this[_0x4027('0x1c')][_0x4027('0x28')];_0x510f73['html']=_0x4027('0x29')+_[_0x4027('0x2a')](_0x510f73[_0x4027('0x1a')],_0x4027('0x2b'),']+(>|$)/g,''),'priorityTrue':_0x4b1661[0x1],'priorityFalse':_0x4b1661[0x2]};var _0x582593=gotoif[_0xfd8a('0x0')](_0x365408,{'typecast':!![]});if(_0x582593['length']){logger['error'](_0xfd8a('0xb'),_0x3109c5,_[_0xfd8a('0xc')](_0x582593,_0xfd8a('0xd'))[_0xfd8a('0xe')](',\x20'));_0x525f0b[_0xfd8a('0xf')]();}else{try{var _0x10dea1=eval('('+_0x365408[_0xfd8a('0x10')]+')');var _0x5bcfb3=_0x10dea1?_0x365408[_0xfd8a('0x11')]:_0x365408[_0xfd8a('0x12')];logger['info'](_0xfd8a('0x13'),_0x3109c5,_0x365408[_0xfd8a('0x10')],_0x10dea1,_0x5bcfb3||_0xfd8a('0x14'));if(_0x5bcfb3){var _0x45daa4=_[_0xfd8a('0x15')](_0x525f0b[_0xfd8a('0x16')](),{'p':_0x5bcfb3});if(_0x45daa4>=0x0){logger[_0xfd8a('0x17')](_0xfd8a('0x18'),_0x3109c5,_0x5bcfb3||_0xfd8a('0x14'),_0x45daa4);_0x525f0b[_0xfd8a('0x14')](_0x45daa4);}else{logger[_0xfd8a('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3109c5,_0x5bcfb3||'next');_0x525f0b['stop']();}}else{_0x525f0b[_0xfd8a('0x14')]();}}catch(_0x764ab2){logger[_0xfd8a('0x19')](_0xfd8a('0x1a'),_0x3109c5,_0x764ab2['message']);_0x525f0b[_0xfd8a('0xf')]();}}}catch(_0xb4bf82){logger[_0xfd8a('0x19')]('[%s][GOTOIF]\x20%s',_0x3109c5,JSON['stringify'](_0xb4bf82));_0x525f0b[_0xfd8a('0xf')]();}};}; \ No newline at end of file +var _0x4dcf=['[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','replace','length'];(function(_0x6628e4,_0x1cfd1b){var _0x424deb=function(_0x4d5f0c){while(--_0x4d5f0c){_0x6628e4['push'](_0x6628e4['shift']());}};_0x424deb(++_0x1cfd1b);}(_0x4dcf,0x1d1));var _0xf4dc=function(_0x31281a,_0x10040e){_0x31281a=_0x31281a-0x0;var _0x23aa3f=_0x4dcf[_0x31281a];return _0x23aa3f;};'use strict';var schema=require(_0xf4dc('0x0'));var _=require(_0xf4dc('0x1'));var htmlToText=require(_0xf4dc('0x2'));var utils=require(_0xf4dc('0x3'));var logger=require(_0xf4dc('0x4'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xf4dc('0x5')},'priorityTrue':{'type':_0xf4dc('0x6'),'message':_0xf4dc('0x7')},'priorityFalse':{'type':_0xf4dc('0x6'),'message':_0xf4dc('0x8')}});exports['consequence']=function(_0x4bd6fb,_0x10c203){return function(_0x1d1fa2){try{var _0x361de5={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x10c203[0x0],this),{'wordwrap':![]})[_0xf4dc('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x10c203[0x1],'priorityFalse':_0x10c203[0x2]};var _0x4f6230=gotoif[_0xf4dc('0x0')](_0x361de5,{'typecast':!![]});if(_0x4f6230[_0xf4dc('0xa')]){logger['error'](_0xf4dc('0xb'),_0x4bd6fb,_[_0xf4dc('0xc')](_0x4f6230,_0xf4dc('0xd'))[_0xf4dc('0xe')](',\x20'));_0x1d1fa2[_0xf4dc('0xf')]();}else{try{var _0x1f9dd1=eval('('+_0x361de5['condition']+')');var _0x36e223=_0x1f9dd1?_0x361de5[_0xf4dc('0x10')]:_0x361de5[_0xf4dc('0x11')];logger[_0xf4dc('0x12')](_0xf4dc('0x13'),_0x4bd6fb,_0x361de5[_0xf4dc('0x14')],_0x1f9dd1,_0x36e223||_0xf4dc('0x15'));if(_0x36e223){var _0x47e10b=_[_0xf4dc('0x16')](_0x1d1fa2['rules'](),{'p':_0x36e223});if(_0x47e10b>=0x0){logger[_0xf4dc('0x12')](_0xf4dc('0x17'),_0x4bd6fb,_0x36e223||_0xf4dc('0x15'),_0x47e10b);_0x1d1fa2[_0xf4dc('0x15')](_0x47e10b);}else{logger[_0xf4dc('0x12')](_0xf4dc('0x18'),_0x4bd6fb,_0x36e223||'next');_0x1d1fa2['stop']();}}else{_0x1d1fa2[_0xf4dc('0x15')]();}}catch(_0x8521d9){logger[_0xf4dc('0x19')](_0xf4dc('0x1a'),_0x4bd6fb,_0x8521d9[_0xf4dc('0xd')]);_0x1d1fa2[_0xf4dc('0xf')]();}}}catch(_0xd7051f){logger[_0xf4dc('0x19')](_0xf4dc('0xb'),_0x4bd6fb,JSON[_0xf4dc('0x1b')](_0xd7051f));_0x1d1fa2[_0xf4dc('0xf')]();}};}; \ 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 63efacb..c916935 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 _0x2af2=['validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify'];(function(_0x1d2008,_0x324211){var _0x28781f=function(_0x47ba28){while(--_0x47ba28){_0x1d2008['push'](_0x1d2008['shift']());}};_0x28781f(++_0x324211);}(_0x2af2,0x10a));var _0x22af=function(_0x950e51,_0x2eed7b){_0x950e51=_0x950e51-0x0;var _0x114f56=_0x2af2[_0x950e51];return _0x114f56;};'use strict';var schema=require(_0x22af('0x0'));var _=require(_0x22af('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x22af('0x2'),'required':!![],'message':_0x22af('0x3')}});exports[_0x22af('0x4')]=function(_0x587ac7,_0x3495fb){return function(_0x234594){try{var _0x3e7af5={'priority':_0x3495fb[0x0]};var _0x3e8146=gotop[_0x22af('0x0')](_0x3e7af5,{'typecast':!![]});if(_0x3e8146['length']){logger[_0x22af('0x5')]('[%s][GOTOP]\x20%s',_0x587ac7,_[_0x22af('0x6')](_0x3e8146,_0x22af('0x7'))[_0x22af('0x8')](',\x20'));_0x234594[_0x22af('0x9')]();}else{logger[_0x22af('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x587ac7,_0x3e7af5[_0x22af('0xb')]);if(_0x3e7af5[_0x22af('0xb')]){var _0x118862=_[_0x22af('0xc')](_0x234594[_0x22af('0xd')](),{'p':_0x3e7af5[_0x22af('0xb')]});if(_0x118862>=0x0){logger[_0x22af('0xa')](_0x22af('0xe'),_0x587ac7,_0x3e7af5[_0x22af('0xb')]||_0x22af('0xf'),_0x118862);_0x234594[_0x22af('0xf')](_0x118862);}else{logger[_0x22af('0xa')](_0x22af('0x10'),_0x587ac7,_0x3e7af5[_0x22af('0xb')]||_0x22af('0xf'));_0x234594[_0x22af('0x9')]();}}else{_0x234594[_0x22af('0xf')]();}}}catch(_0x3e5d43){logger['error'](_0x22af('0x11'),_0x587ac7,JSON[_0x22af('0x12')](_0x3e5d43));_0x234594['stop']();}};}; \ No newline at end of file +var _0x9888=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9888,0x87));var _0x8988=function(_0xc23cd4,_0x7cc3b5){_0xc23cd4=_0xc23cd4-0x0;var _0x2fa99b=_0x9888[_0xc23cd4];return _0x2fa99b;};'use strict';var schema=require(_0x8988('0x0'));var _=require(_0x8988('0x1'));var logger=require(_0x8988('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x8988('0x3')}});exports[_0x8988('0x4')]=function(_0x599211,_0x1cfdcf){return function(_0x44193f){try{var _0xe7223e={'priority':_0x1cfdcf[0x0]};var _0x23f1e2=gotop[_0x8988('0x0')](_0xe7223e,{'typecast':!![]});if(_0x23f1e2[_0x8988('0x5')]){logger[_0x8988('0x6')](_0x8988('0x7'),_0x599211,_[_0x8988('0x8')](_0x23f1e2,'message')[_0x8988('0x9')](',\x20'));_0x44193f[_0x8988('0xa')]();}else{logger[_0x8988('0xb')](_0x8988('0xc'),_0x599211,_0xe7223e['priority']);if(_0xe7223e[_0x8988('0xd')]){var _0x20d548=_['findIndex'](_0x44193f[_0x8988('0xe')](),{'p':_0xe7223e[_0x8988('0xd')]});if(_0x20d548>=0x0){logger['info'](_0x8988('0xf'),_0x599211,_0xe7223e[_0x8988('0xd')]||_0x8988('0x10'),_0x20d548);_0x44193f[_0x8988('0x10')](_0x20d548);}else{logger[_0x8988('0xb')](_0x8988('0x11'),_0x599211,_0xe7223e[_0x8988('0xd')]||_0x8988('0x10'));_0x44193f['stop']();}}else{_0x44193f[_0x8988('0x10')]();}}}catch(_0x74209b){logger[_0x8988('0x6')](_0x8988('0x7'),_0x599211,JSON['stringify'](_0x74209b));_0x44193f[_0x8988('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 e15c542..ad0d57b 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 _0x4c5a=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','stop','error','stringify','lodash','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c5a,0x1c0));var _0xa4c5=function(_0x4f0456,_0x795c81){_0x4f0456=_0x4f0456-0x0;var _0x52caea=_0x4c5a[_0x4f0456];return _0x52caea;};'use strict';var _=require(_0xa4c5('0x0'));var utils=require(_0xa4c5('0x1'));var logger=require('../../../../config/logger')(_0xa4c5('0x2'));var rpc={'chatMessage':require(_0xa4c5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa4c5('0x4')),'smsMessage':require(_0xa4c5('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa4c5('0x6'))};exports['consequence']=function(_0x4ed3bd,_0x748d28){return function(_0x1141fe){try{var _0x1b7b9e={'body':utils[_0xa4c5('0x7')](_0x748d28[0x0],this),'ContactId':this['contact']['id']};if(this[_0xa4c5('0x8')]===_0xa4c5('0x9')){_0x1b7b9e[_0xa4c5('0xa')]=this[_0xa4c5('0xb')]['id'];}else{_0x1b7b9e[_['upperFirst'](this[_0xa4c5('0x8')])+_0xa4c5('0xc')]=this[_0xa4c5('0xb')]['id'];}_0x1b7b9e[_[_0xa4c5('0xd')](this[_0xa4c5('0x8')])+_0xa4c5('0xe')]=this[_0xa4c5('0xf')]['id'];if(rpc[this[_0xa4c5('0x8')]+_0xa4c5('0x10')]){return rpc[this[_0xa4c5('0x8')]+_0xa4c5('0x10')]['create'](_0x1b7b9e)[_0xa4c5('0x11')](function(_0x1ee5b6){logger[_0xa4c5('0x12')](_0xa4c5('0x13'),_0x4ed3bd,_0x1b7b9e[_0xa4c5('0x14')]);_0x1141fe[_0xa4c5('0x15')]();})['catch'](function(_0x44c912){logger['error'](_0xa4c5('0x13'),_0x4ed3bd,JSON['stringify'](_0x44c912));_0x1141fe[_0xa4c5('0x16')]();});}}catch(_0x47bc0c){logger[_0xa4c5('0x17')](_0xa4c5('0x13'),_0x4ed3bd,JSON[_0xa4c5('0x18')](_0x47bc0c));_0x1141fe[_0xa4c5('0x16')]();}};}; \ No newline at end of file +var _0x0efb=['account','InteractionId','interaction','Message','[%s][MESSAGE]\x20%s','body','next','error','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','upperFirst'];(function(_0x105a8a,_0x15a3a2){var _0x105a0e=function(_0x3beeb1){while(--_0x3beeb1){_0x105a8a['push'](_0x105a8a['shift']());}};_0x105a0e(++_0x15a3a2);}(_0x0efb,0x163));var _0xb0ef=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0x0efb[_0x26efac];return _0x8482e4;};'use strict';var _=require(_0xb0ef('0x0'));var utils=require(_0xb0ef('0x1'));var logger=require(_0xb0ef('0x2'))(_0xb0ef('0x3'));var rpc={'chatMessage':require(_0xb0ef('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb0ef('0x5')),'smsMessage':require(_0xb0ef('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb0ef('0x7'))};exports['consequence']=function(_0x108863,_0x4ad968){return function(_0x13a2ac){try{var _0x345b3a={'body':utils[_0xb0ef('0x8')](_0x4ad968[0x0],this),'ContactId':this[_0xb0ef('0x9')]['id']};if(this[_0xb0ef('0xa')]===_0xb0ef('0xb')){_0x345b3a['ChatWebsiteId']=this['account']['id'];}else{_0x345b3a[_[_0xb0ef('0xc')](this[_0xb0ef('0xa')])+'AccountId']=this[_0xb0ef('0xd')]['id'];}_0x345b3a[_['upperFirst'](this[_0xb0ef('0xa')])+_0xb0ef('0xe')]=this[_0xb0ef('0xf')]['id'];if(rpc[this[_0xb0ef('0xa')]+_0xb0ef('0x10')]){return rpc[this[_0xb0ef('0xa')]+_0xb0ef('0x10')]['create'](_0x345b3a)['then'](function(_0x11940d){logger['info'](_0xb0ef('0x11'),_0x108863,_0x345b3a[_0xb0ef('0x12')]);_0x13a2ac[_0xb0ef('0x13')]();})['catch'](function(_0x47a48f){logger[_0xb0ef('0x14')](_0xb0ef('0x11'),_0x108863,JSON['stringify'](_0x47a48f));_0x13a2ac[_0xb0ef('0x15')]();});}}catch(_0x33fc1c){logger[_0xb0ef('0x14')](_0xb0ef('0x11'),_0x108863,JSON[_0xb0ef('0x16')](_0x33fc1c));_0x13a2ac[_0xb0ef('0x15')]();}};}; \ 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 8473fec..f9e1687 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 _0x51ef=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x3c0a2e,_0x17072c){var _0x44dbc2=function(_0x1c35aa){while(--_0x1c35aa){_0x3c0a2e['push'](_0x3c0a2e['shift']());}};_0x44dbc2(++_0x17072c);}(_0x51ef,0x1e4));var _0xf51e=function(_0x2ab8a3,_0x3e63c3){_0x2ab8a3=_0x2ab8a3-0x0;var _0x40a4d6=_0x51ef[_0x2ab8a3];return _0x40a4d6;};'use strict';var utils=require(_0xf51e('0x0'));var logger=require(_0xf51e('0x1'))(_0xf51e('0x2'));exports[_0xf51e('0x3')]=function(_0x5d35ab,_0xb20ce0){return function(_0x6a4a17){try{logger[_0xf51e('0x4')](_0xf51e('0x5'),_0x5d35ab,utils[_0xf51e('0x6')](_0xb20ce0[0x0],this));_0x6a4a17[_0xf51e('0x7')]();}catch(_0x34c1f7){logger[_0xf51e('0x8')](_0xf51e('0x5'),_0x5d35ab,JSON[_0xf51e('0x9')](_0x34c1f7));_0x6a4a17[_0xf51e('0xa')]();}};}; \ No newline at end of file +var _0x85f6=['[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','next','error'];(function(_0x5d747e,_0x18ee9b){var _0x3f2eab=function(_0x2d275a){while(--_0x2d275a){_0x5d747e['push'](_0x5d747e['shift']());}};_0x3f2eab(++_0x18ee9b);}(_0x85f6,0xdf));var _0x685f=function(_0x9fcebb,_0x1440fa){_0x9fcebb=_0x9fcebb-0x0;var _0x4cedcf=_0x85f6[_0x9fcebb];return _0x4cedcf;};'use strict';var utils=require(_0x685f('0x0'));var logger=require(_0x685f('0x1'))(_0x685f('0x2'));exports[_0x685f('0x3')]=function(_0x465bad,_0x39b453){return function(_0x27abc2){try{logger[_0x685f('0x4')]('[%s][NOOP]\x20%s',_0x465bad,utils['getMustacheRender'](_0x39b453[0x0],this));_0x27abc2[_0x685f('0x5')]();}catch(_0x5dfd56){logger[_0x685f('0x6')](_0x685f('0x7'),_0x465bad,JSON[_0x685f('0x8')](_0x5dfd56));_0x27abc2[_0x685f('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 1c6f025..20e34cb 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 _0xfb86=['rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','./strategy','redis','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfb86,0x9a));var _0x6fb8=function(_0xb517fb,_0x1ae8bc){_0xb517fb=_0xb517fb-0x0;var _0x348a16=_0xfb86[_0xb517fb];return _0x348a16;};'use strict';var schema=require(_0x6fb8('0x0'));var _=require(_0x6fb8('0x1'));var util=require(_0x6fb8('0x2'));var seqqueue=require(_0x6fb8('0x3'));var moment=require(_0x6fb8('0x4'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x6fb8('0x5'));config['redis']=_['defaults'](config[_0x6fb8('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6fb8('0x7'))(new Redis(config['redis']));var attributes=['id',_0x6fb8('0x8'),_0x6fb8('0x9'),_0x6fb8('0xa'),_0x6fb8('0xb'),_0x6fb8('0xc')];function emit(_0x1e7b5b,_0x471101,_0x21df40){io['to'](_0x1e7b5b)[_0x6fb8('0xd')](_0x471101,_0x21df40);}function emitChannelQueueInteraction(_0x28a21e,_0x49552e,_0x238f67,_0x20f930,_0x1b2949,_0x502bd3,_0x195d76,_0x1c0c6e){var _0x172319=_['clone'](_0x238f67);_0x172319[_0x6fb8('0x8')]=_0x1c0c6e;_0x172319['queue']=_0x49552e;_0x172319['account']=_0x20f930;_0x172319['id']=_0x1b2949;if(_0x502bd3){attributes['push'](_['capitalize'](_0x28a21e)+'InteractionId');_0x195d76[util['format']('%sQueuesWaitingInteractions',_0x28a21e)][_0x1b2949]=_['pick'](_0x172319,attributes);}else{delete _0x195d76[util[_0x6fb8('0xe')](_0x6fb8('0xf'),_0x28a21e)][_0x1b2949];}emit(util[_0x6fb8('0xe')](_0x6fb8('0x10'),_0x28a21e,_0x49552e),util[_0x6fb8('0xe')](_0x6fb8('0x11'),_0x28a21e,_0x502bd3?'save':'remove'),_[_0x6fb8('0x12')](_0x172319,attributes));}var rpc={'openchannelQueueReport':require(_0x6fb8('0x13')),'mailQueueReport':require(_0x6fb8('0x14')),'chatQueueReport':require(_0x6fb8('0x15')),'smsQueueReport':require(_0x6fb8('0x16')),'faxQueueReport':require(_0x6fb8('0x17')),'whatsappQueueReport':require(_0x6fb8('0x18'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x6fb8('0x19'),'message':_0x6fb8('0x1a')}});function startRouting(_0x52a0df,_0x260176,_0x5ef0c6,_0x2e5186){if(_0x52a0df&&_0x260176&&_0x5ef0c6){_0x260176[_0x6fb8('0x1b')]+=0x1;var _0x330b38={'uniqueid':_0x52a0df,'from':_0x5ef0c6[_0x6fb8('0x1c')]?_0x5ef0c6[_0x6fb8('0x1c')]['from']:'','joinAt':moment()[_0x6fb8('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ef0c6[_0x6fb8('0x1d')]?_0x5ef0c6[_0x6fb8('0x1d')]['id']:null,'ListId':_0x5ef0c6[_0x6fb8('0x1e')]?_0x5ef0c6[_0x6fb8('0x1e')]['id']:null};_0x330b38[_[_0x6fb8('0x1f')](_0x5ef0c6[_0x6fb8('0x20')])+_0x6fb8('0x21')]=_0x260176['id']||null;_0x330b38[_[_0x6fb8('0x1f')](_0x5ef0c6[_0x6fb8('0x20')])+_0x6fb8('0x22')]=_0x5ef0c6[_0x6fb8('0x23')]?_0x5ef0c6['interaction']['id']:null;_0x330b38[_[_0x6fb8('0x1f')](_0x5ef0c6[_0x6fb8('0x20')])+_0x6fb8('0x24')]=_0x5ef0c6['message']?_0x5ef0c6[_0x6fb8('0x25')]['id']:null;_0x330b38[_[_0x6fb8('0x1f')](_0x5ef0c6[_0x6fb8('0x20')])+(_0x5ef0c6[_0x6fb8('0x20')]!=='chat'?'AccountId':_0x6fb8('0x26'))]=_0x5ef0c6[_0x6fb8('0x9')]?_0x5ef0c6[_0x6fb8('0x9')]['id']:null;logger[_0x6fb8('0x27')](util[_0x6fb8('0xe')](_0x6fb8('0x28'),_0x52a0df,_0x260176[_0x6fb8('0x29')]));emitChannelQueueInteraction(_0x5ef0c6[_0x6fb8('0x20')],_0x260176[_0x6fb8('0x29')],_0x330b38,_0x5ef0c6[_0x6fb8('0x9')]['name'],_0x5ef0c6['message']['id'],!![],_0x2e5186,_0x260176['id']);if(rpc[_0x5ef0c6[_0x6fb8('0x20')]+_0x6fb8('0x2a')]){return rpc[_0x5ef0c6['channel']+_0x6fb8('0x2a')][_0x6fb8('0x2b')](_0x330b38)[_0x6fb8('0x2c')](function(_0x3a5abf){logger[_0x6fb8('0x2d')](_0x6fb8('0x2e'));});}}}function stopRouting(_0x3ab4ff,_0x5e8d8d,_0x54ab2d,_0x50706b){if(_0x3ab4ff&&_0x5e8d8d){_0x5e8d8d[_0x6fb8('0x1b')]-=0x1;var _0x22692c={'leaveAt':moment()[_0x6fb8('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x6fb8('0xe')](_0x6fb8('0x2f')),'reason':'accepted'};logger[_0x6fb8('0x27')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x3ab4ff,_0x5e8d8d[_0x6fb8('0x29')]));emitChannelQueueInteraction(_0x54ab2d['channel'],_0x5e8d8d[_0x6fb8('0x29')],_0x54ab2d['body'],_0x54ab2d['account']['name'],_0x54ab2d[_0x6fb8('0x25')]['id'],![],_0x50706b,_0x5e8d8d['id']);if(rpc[_0x54ab2d[_0x6fb8('0x20')]+_0x6fb8('0x2a')]){return rpc[_0x54ab2d['channel']+_0x6fb8('0x2a')][_0x6fb8('0x30')](_0x3ab4ff,_0x22692c)[_0x6fb8('0x2c')](function(_0xdb894a){logger[_0x6fb8('0x2d')](_0x6fb8('0x31'));});}}}function endRouting(_0x3d278c,_0x52a275,_0x45fdd3,_0x366c87){if(_0x3d278c&&_0x52a275){_0x52a275[_0x6fb8('0x1b')]-=0x1;var _0x6b0240={'leaveAt':moment()[_0x6fb8('0xe')](_0x6fb8('0x2f')),'exitAt':moment()[_0x6fb8('0xe')](_0x6fb8('0x2f')),'reason':_0x6fb8('0x32')};logger[_0x6fb8('0x27')](util[_0x6fb8('0xe')](_0x6fb8('0x33'),_0x3d278c,_0x52a275[_0x6fb8('0x29')]));emitChannelQueueInteraction(_0x45fdd3['channel'],_0x52a275[_0x6fb8('0x29')],_0x45fdd3['body'],_0x45fdd3['account'][_0x6fb8('0x29')],_0x45fdd3['message']['id'],![],_0x366c87);if(rpc[_0x45fdd3[_0x6fb8('0x20')]+_0x6fb8('0x2a')]){return rpc[_0x45fdd3[_0x6fb8('0x20')]+_0x6fb8('0x2a')]['update'](_0x3d278c,_0x6b0240)[_0x6fb8('0x2c')](function(_0x212bf8){logger[_0x6fb8('0x2d')](_0x6fb8('0x31'));});}}}function handleFindQueue(_0x97e4d4){return function(_0x147930){return _0x147930[_0x6fb8('0x29')][_0x6fb8('0x34')]()===_0x97e4d4['toLowerCase']();};}exports[_0x6fb8('0x35')]=function(_0x276823,_0x3d43af,_0x28f8a4,_0x5c0756){return function(_0x13c427){try{var _0x2c0f78={'name':_0x3d43af[0x0],'timeout':_0x3d43af[0x1]};var _0x12fa72=queue['validate'](_0x2c0f78,{'typecast':!![]});if(_0x12fa72['length']){logger[_0x6fb8('0x2d')](_0x6fb8('0x36'),_0x276823,_[_0x6fb8('0x37')](_0x12fa72,_0x6fb8('0x25'))[_0x6fb8('0x38')](',\x20'));_0x13c427[_0x6fb8('0x39')]();}else{var _0x400621=_[_0x6fb8('0x3a')](_0x28f8a4[_0x5c0756['channel']+'Queues'],handleFindQueue(_0x2c0f78[_0x6fb8('0x29')]));if(_0x400621){startRouting(_0x276823,_0x400621,_0x5c0756,_0x28f8a4);var _0x54fd79=(_0x400621[_0x6fb8('0x32')]||0xa)*0x3e8;var _0x38e8ee=(_0x2c0f78['timeout']||0x14)*0x3e8;var _0x1a94e9;if(_0x54fd79>_0x38e8ee){_0x38e8ee=_0x54fd79;}var _0x29ce24=seqqueue[_0x6fb8('0x3b')](_0x54fd79);_0x29ce24['id']=_0x276823;_0x29ce24[_0x6fb8('0x3c')]=_0x54fd79;_0x29ce24[_0x6fb8('0x3d')]=_0x38e8ee;_0x29ce24[_0x6fb8('0x20')]=_0x5c0756['channel'];_0x28f8a4[_0x6fb8('0x3e')][_0x276823]['on'](_0x6fb8('0x3f'),function(){logger[_0x6fb8('0x27')](_0x6fb8('0x40'),_0x276823);stopRouting(_0x276823,_0x400621,_0x5c0756,_0x28f8a4);clearTimeout(_0x1a94e9);_0x1a94e9=undefined;_0x29ce24[_0x6fb8('0x41')](!![]);if(_0x28f8a4[_0x6fb8('0x3e')][_0x276823]){delete _0x28f8a4[_0x6fb8('0x3e')][_0x276823];}_0x13c427['stop']();});_0x28f8a4['rules'][_0x276823]['on']('complete',function(){if(_0x28f8a4[_0x6fb8('0x3e')][_0x276823]){delete _0x28f8a4[_0x6fb8('0x3e')][_0x276823];}});_0x1a94e9=setTimeout(function(){logger[_0x6fb8('0x27')](_0x6fb8('0x42'),_0x276823);endRouting(_0x276823,_0x400621,_0x5c0756,_0x28f8a4);clearTimeout(_0x1a94e9);_0x29ce24[_0x6fb8('0x41')](!![]);_0x13c427[_0x6fb8('0x43')]();},_0x38e8ee);switch(_0x400621[_0x6fb8('0x44')]){case _0x6fb8('0x45'):strategy[_0x6fb8('0x45')](_0x29ce24,_0x400621,_0x28f8a4,_0x5c0756);break;default:strategy['beepall'](_0x29ce24,_0x400621,_0x28f8a4,_0x5c0756);}}else{logger[_0x6fb8('0x2d')](_0x6fb8('0x46'),_0x276823,_0x2c0f78[_0x6fb8('0x29')]);_0x13c427[_0x6fb8('0x39')]();}}}catch(_0x1a0bf4){console['log'](_0x1a0bf4);logger[_0x6fb8('0x2d')]('[%s][QUEUE]\x20%s',_0x276823,_0x1a0bf4[_0x6fb8('0x47')]);_0x13c427[_0x6fb8('0x39')]();}};}; \ No newline at end of file +var _0x25f7=['info','[%s][START:QUEUE][NAME:%s]','message','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','name','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','length','[%s][QUEUE]\x20%s','map','join','stop','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','log','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue','from','joinAt','emit','queue_id','account','push','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','chat','WebsiteId'];(function(_0x5df5d4,_0x50b98e){var _0x38b9ed=function(_0x1d1cb4){while(--_0x1d1cb4){_0x5df5d4['push'](_0x5df5d4['shift']());}};_0x38b9ed(++_0x50b98e);}(_0x25f7,0x153));var _0x725f=function(_0x492e95,_0x5aa7d9){_0x492e95=_0x492e95-0x0;var _0x17b396=_0x25f7[_0x492e95];return _0x17b396;};'use strict';var schema=require(_0x725f('0x0'));var _=require(_0x725f('0x1'));var util=require('util');var seqqueue=require(_0x725f('0x2'));var moment=require(_0x725f('0x3'));var Redis=require(_0x725f('0x4'));var config=require(_0x725f('0x5'));var logger=require(_0x725f('0x6'))(_0x725f('0x7'));var strategy=require(_0x725f('0x8'));config[_0x725f('0x9')]=_[_0x725f('0xa')](config[_0x725f('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x725f('0xb'))(new Redis(config[_0x725f('0x9')]));var attributes=['id','queue_id','account',_0x725f('0xc'),_0x725f('0xd'),_0x725f('0xe')];function emit(_0x4ced2b,_0xb3de35,_0x260924){io['to'](_0x4ced2b)[_0x725f('0xf')](_0xb3de35,_0x260924);}function emitChannelQueueInteraction(_0x1b2532,_0x3cfd1c,_0x284e02,_0x29c7b1,_0x5e2b2d,_0x232175,_0x44414c,_0x18f56b){var _0x5b617f=_['clone'](_0x284e02);_0x5b617f[_0x725f('0x10')]=_0x18f56b;_0x5b617f['queue']=_0x3cfd1c;_0x5b617f[_0x725f('0x11')]=_0x29c7b1;_0x5b617f['id']=_0x5e2b2d;if(_0x232175){attributes[_0x725f('0x12')](_['capitalize'](_0x1b2532)+'InteractionId');_0x44414c[util['format'](_0x725f('0x13'),_0x1b2532)][_0x5e2b2d]=_['pick'](_0x5b617f,attributes);}else{delete _0x44414c[util[_0x725f('0x14')](_0x725f('0x13'),_0x1b2532)][_0x5e2b2d];}emit(util[_0x725f('0x14')](_0x725f('0x15'),_0x1b2532,_0x3cfd1c),util['format'](_0x725f('0x16'),_0x1b2532,_0x232175?_0x725f('0x17'):_0x725f('0x18')),_['pick'](_0x5b617f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x725f('0x19')),'smsQueueReport':require(_0x725f('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x725f('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x725f('0x1c')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x28df81,_0x2c9385,_0x5115d5,_0x2557fb){if(_0x28df81&&_0x2c9385&&_0x5115d5){_0x2c9385[_0x725f('0x1d')]+=0x1;var _0x29f8f4={'uniqueid':_0x28df81,'from':_0x5115d5[_0x725f('0x1e')]?_0x5115d5[_0x725f('0x1e')][_0x725f('0xd')]:'','joinAt':moment()[_0x725f('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5115d5['contact']?_0x5115d5[_0x725f('0x1f')]['id']:null,'ListId':_0x5115d5[_0x725f('0x20')]?_0x5115d5[_0x725f('0x20')]['id']:null};_0x29f8f4[_[_0x725f('0x21')](_0x5115d5[_0x725f('0x22')])+_0x725f('0x23')]=_0x2c9385['id']||null;_0x29f8f4[_[_0x725f('0x21')](_0x5115d5[_0x725f('0x22')])+_0x725f('0x24')]=_0x5115d5['interaction']?_0x5115d5[_0x725f('0x25')]['id']:null;_0x29f8f4[_[_0x725f('0x21')](_0x5115d5[_0x725f('0x22')])+_0x725f('0x26')]=_0x5115d5['message']?_0x5115d5['message']['id']:null;_0x29f8f4[_['upperFirst'](_0x5115d5[_0x725f('0x22')])+(_0x5115d5[_0x725f('0x22')]!==_0x725f('0x27')?'AccountId':_0x725f('0x28'))]=_0x5115d5[_0x725f('0x11')]?_0x5115d5[_0x725f('0x11')]['id']:null;logger[_0x725f('0x29')](util[_0x725f('0x14')](_0x725f('0x2a'),_0x28df81,_0x2c9385['name']));emitChannelQueueInteraction(_0x5115d5[_0x725f('0x22')],_0x2c9385['name'],_0x29f8f4,_0x5115d5[_0x725f('0x11')]['name'],_0x5115d5[_0x725f('0x2b')]['id'],!![],_0x2557fb,_0x2c9385['id']);if(rpc[_0x5115d5[_0x725f('0x22')]+_0x725f('0x2c')]){return rpc[_0x5115d5[_0x725f('0x22')]+_0x725f('0x2c')][_0x725f('0x2d')](_0x29f8f4)[_0x725f('0x2e')](function(_0x2ba184){logger['error'](_0x725f('0x2f'));});}}}function stopRouting(_0x3eeefe,_0x4e70ba,_0x3d6e93,_0x4f4a80){if(_0x3eeefe&&_0x4e70ba){_0x4e70ba[_0x725f('0x1d')]-=0x1;var _0xc23872={'leaveAt':moment()[_0x725f('0x14')](_0x725f('0x30')),'acceptAt':moment()[_0x725f('0x14')](_0x725f('0x30')),'reason':_0x725f('0x31')};logger[_0x725f('0x29')](util[_0x725f('0x14')](_0x725f('0x32'),_0x3eeefe,_0x4e70ba[_0x725f('0x33')]));emitChannelQueueInteraction(_0x3d6e93[_0x725f('0x22')],_0x4e70ba[_0x725f('0x33')],_0x3d6e93[_0x725f('0x1e')],_0x3d6e93[_0x725f('0x11')][_0x725f('0x33')],_0x3d6e93[_0x725f('0x2b')]['id'],![],_0x4f4a80,_0x4e70ba['id']);if(rpc[_0x3d6e93[_0x725f('0x22')]+_0x725f('0x2c')]){return rpc[_0x3d6e93[_0x725f('0x22')]+_0x725f('0x2c')][_0x725f('0x34')](_0x3eeefe,_0xc23872)[_0x725f('0x2e')](function(_0x13ed74){logger[_0x725f('0x35')](_0x725f('0x36'));});}}}function endRouting(_0x410d3e,_0x22e93c,_0x20726e,_0x1562cb){if(_0x410d3e&&_0x22e93c){_0x22e93c[_0x725f('0x1d')]-=0x1;var _0x36c0bd={'leaveAt':moment()['format'](_0x725f('0x30')),'exitAt':moment()['format'](_0x725f('0x30')),'reason':_0x725f('0x37')};logger[_0x725f('0x29')](util[_0x725f('0x14')](_0x725f('0x38'),_0x410d3e,_0x22e93c[_0x725f('0x33')]));emitChannelQueueInteraction(_0x20726e[_0x725f('0x22')],_0x22e93c[_0x725f('0x33')],_0x20726e[_0x725f('0x1e')],_0x20726e[_0x725f('0x11')][_0x725f('0x33')],_0x20726e[_0x725f('0x2b')]['id'],![],_0x1562cb);if(rpc[_0x20726e[_0x725f('0x22')]+_0x725f('0x2c')]){return rpc[_0x20726e[_0x725f('0x22')]+_0x725f('0x2c')][_0x725f('0x34')](_0x410d3e,_0x36c0bd)[_0x725f('0x2e')](function(_0xdb77a7){logger['error'](_0x725f('0x36'));});}}}function handleFindQueue(_0x3d4bd6){return function(_0x4f9f98){return _0x4f9f98[_0x725f('0x33')]['toLowerCase']()===_0x3d4bd6['toLowerCase']();};}exports['consequence']=function(_0x1c3f69,_0x4e5b01,_0x527fa0,_0x599f92){return function(_0x562502){try{var _0x3c856e={'name':_0x4e5b01[0x0],'timeout':_0x4e5b01[0x1]};var _0x5b4ace=queue['validate'](_0x3c856e,{'typecast':!![]});if(_0x5b4ace[_0x725f('0x39')]){logger[_0x725f('0x35')](_0x725f('0x3a'),_0x1c3f69,_[_0x725f('0x3b')](_0x5b4ace,_0x725f('0x2b'))[_0x725f('0x3c')](',\x20'));_0x562502[_0x725f('0x3d')]();}else{var _0x195479=_['find'](_0x527fa0[_0x599f92['channel']+'Queues'],handleFindQueue(_0x3c856e[_0x725f('0x33')]));if(_0x195479){startRouting(_0x1c3f69,_0x195479,_0x599f92,_0x527fa0);var _0x5f3b3e=(_0x195479[_0x725f('0x37')]||0xa)*0x3e8;var _0x14befb=(_0x3c856e['timeout']||0x14)*0x3e8;var _0x2463b9;if(_0x5f3b3e>_0x14befb){_0x14befb=_0x5f3b3e;}var _0x20771e=seqqueue[_0x725f('0x3e')](_0x5f3b3e);_0x20771e['id']=_0x1c3f69;_0x20771e[_0x725f('0x3f')]=_0x5f3b3e;_0x20771e[_0x725f('0x40')]=_0x14befb;_0x20771e[_0x725f('0x22')]=_0x599f92[_0x725f('0x22')];_0x527fa0[_0x725f('0x41')][_0x1c3f69]['on'](_0x725f('0x42'),function(){logger[_0x725f('0x29')](_0x725f('0x43'),_0x1c3f69);stopRouting(_0x1c3f69,_0x195479,_0x599f92,_0x527fa0);clearTimeout(_0x2463b9);_0x2463b9=undefined;_0x20771e[_0x725f('0x44')](!![]);if(_0x527fa0[_0x725f('0x41')][_0x1c3f69]){delete _0x527fa0['rules'][_0x1c3f69];}_0x562502[_0x725f('0x3d')]();});_0x527fa0[_0x725f('0x41')][_0x1c3f69]['on'](_0x725f('0x45'),function(){if(_0x527fa0[_0x725f('0x41')][_0x1c3f69]){delete _0x527fa0[_0x725f('0x41')][_0x1c3f69];}});_0x2463b9=setTimeout(function(){logger[_0x725f('0x29')](_0x725f('0x46'),_0x1c3f69);endRouting(_0x1c3f69,_0x195479,_0x599f92,_0x527fa0);clearTimeout(_0x2463b9);_0x20771e[_0x725f('0x44')](!![]);_0x562502['next']();},_0x14befb);switch(_0x195479[_0x725f('0x47')]){case _0x725f('0x48'):strategy[_0x725f('0x48')](_0x20771e,_0x195479,_0x527fa0,_0x599f92);break;default:strategy[_0x725f('0x49')](_0x20771e,_0x195479,_0x527fa0,_0x599f92);}}else{logger[_0x725f('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1c3f69,_0x3c856e['name']);_0x562502[_0x725f('0x3d')]();}}}catch(_0x19f5ee){console[_0x725f('0x4a')](_0x19f5ee);logger['error'](_0x725f('0x3a'),_0x1c3f69,_0x19f5ee[_0x725f('0x4b')]);_0x562502[_0x725f('0x3d')]();}};}; \ 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 6477015..be2c5b7 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 _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(_0x506e4e,_0x1e893b){var _0x23719c=function(_0x33e3c0){while(--_0x33e3c0){_0x506e4e['push'](_0x506e4e['shift']());}};_0x23719c(++_0x1e893b);}(_0x9b67,0xf6));var _0x79b6=function(_0xb2bdd7,_0x4d8771){_0xb2bdd7=_0xb2bdd7-0x0;var _0x3ba60f=_0x9b67[_0xb2bdd7];return _0x3ba60f;};'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 +var _0x7fbe=['notificationId','squeue','agent','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x7fbe[_0x56e4e7];return _0x383618;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xe7fb('0x0'));var logger=require(_0xe7fb('0x1'))(_0xe7fb('0x2'));var Agent=function(_0x1703d5,_0x517d3a,_0x47625b,_0x11d2c4){this[_0xe7fb('0x3')]=uuid['v4']();this[_0xe7fb('0x4')]=_0x1703d5;this[_0xe7fb('0x5')]=_0x517d3a;this[_0xe7fb('0x6')]=_0x47625b;this[_0xe7fb('0x2')]=_0x11d2c4;this[_0xe7fb('0x4')][_0xe7fb('0x7')](this['handleRun'][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on']('timeout',this['handleTimeout'][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on'](_0xe7fb('0xa'),this[_0xe7fb('0xb')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0x7')]=function(){this[_0xe7fb('0x4')][_0xe7fb('0x7')](this[_0xe7fb('0xd')][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xe7fb('0xc')][_0xe7fb('0xd')]=function(){logger['debug'](_0xe7fb('0xe'),this[_0xe7fb('0x4')]['id'],this['agent']['id']);if(_[_0xe7fb('0xf')](this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){logger[_0xe7fb('0x11')](_0xe7fb('0x12'),this['squeue']['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}else{if(this['routing'][_0xe7fb('0x13')]||util[_0xe7fb('0x14')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],this['squeue'][_0xe7fb('0x15')],![])){this['realtime'][_0xe7fb('0x10')][this['agent']['id']][_0xe7fb('0x16')]=!![];this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x18')](this['realtime'],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this['squeue']['channel']);util['showNotification'](this[_0xe7fb('0x3')],this['squeue']['id'],this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);util['writeLog'](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],_0xe7fb('0x19')+(this[_0xe7fb('0x2')][_0xe7fb('0x13')]?':FORCED':''));}else{logger['debug'](_0xe7fb('0x1a'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}}};Agent[_0xe7fb('0xc')][_0xe7fb('0x9')]=function(_0x5f265f){if(_[_0xe7fb('0xf')](this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){return logger['debug'](_0xe7fb('0x12'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe7fb('0x4')]['id'],this['agent']['id']);util[_0xe7fb('0x1b')](this[_0xe7fb('0x3')],this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']]['busy']=![];this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x1c')](this[_0xe7fb('0x6')],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this[_0xe7fb('0x4')]['channel']);util[_0xe7fb('0x1d')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],_0x5f265f?_0xe7fb('0x1e'):_0xe7fb('0x1f'));}if(!_0x5f265f){setTimeout(this[_0xe7fb('0x7')][_0xe7fb('0x8')](this),0x3e8);}};function agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35){return new Agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35);}module[_0xe7fb('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index db8463a..9667fcc 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 _0xf905=['bind','handleDrained','prototype','push','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','debug','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','busy','removeWaitingNotification','exports','./util','../../../../../config/logger','routing','squeue','queue','realtime','handleRun','handleTimeout','timeout'];(function(_0x258bed,_0x38123f){var _0x3d2826=function(_0x48e591){while(--_0x48e591){_0x258bed['push'](_0x258bed['shift']());}};_0x3d2826(++_0x38123f);}(_0xf905,0x1be));var _0x5f90=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xf905[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x5f90('0x0'));var logger=require(_0x5f90('0x1'))(_0x5f90('0x2'));var Beepall=function(_0xd6a0b2,_0xd7b99c,_0x41c243,_0x5d6941){this['notificationId']=uuid['v4']();this[_0x5f90('0x3')]=_0xd6a0b2;this[_0x5f90('0x4')]=_0xd7b99c;this[_0x5f90('0x5')]=_0x41c243;this[_0x5f90('0x2')]=_0x5d6941;this[_0x5f90('0x3')]['push'](this[_0x5f90('0x6')]['bind'](this),this[_0x5f90('0x7')]['bind'](this));this['squeue']['on'](_0x5f90('0x8'),this[_0x5f90('0x7')][_0x5f90('0x9')](this));this[_0x5f90('0x3')]['on']('drained',this[_0x5f90('0xa')][_0x5f90('0x9')](this));};Beepall[_0x5f90('0xb')][_0x5f90('0xc')]=function(){this['squeue'][_0x5f90('0xc')](this[_0x5f90('0x6')]['bind'](this),this[_0x5f90('0x7')][_0x5f90('0x9')](this));};Beepall[_0x5f90('0xb')][_0x5f90('0xa')]=function(){this[_0x5f90('0x7')](!![]);};Beepall[_0x5f90('0xb')]['handleRun']=function(){var _0x116342=!![];if(!_[_0x5f90('0xd')](this[_0x5f90('0x4')])&&!_['isNil'](this[_0x5f90('0x4')][_0x5f90('0xe')])&&this[_0x5f90('0x4')]['Agents'][_0x5f90('0xf')]>0x0){for(var _0x1bb1ce=0x0,_0x504010;_0x1bb1ce0x0){for(var _0x4b0576=0x0,_0x5cecf8;_0x4b05760x0&&_0x5ba55a[_0x15d9d4+_0xe2cf('0x24')]>=_0x5ba55a[_0x15d9d4+_0xe2cf('0x22')]){writeLog(_0xd226cd,_0x5ba55a,_0x15d9d4[_0xe2cf('0x25')]()+_0xe2cf('0x26'));return![];}}return!![];};exports[_0xe2cf('0x27')]=function(_0x1e6c40,_0x5b71cd,_0xce95d9,_0xbc7449,_0x422944){return sendNotification(!![],_0x1e6c40,_0x5b71cd,_0xce95d9,_0xbc7449,_0x422944);};exports[_0xe2cf('0x28')]=function(_0x1a3bd9,_0x1f2296,_0x2c5330,_0x15c400,_0x3bc50a){return sendNotification(![],_0x1a3bd9,_0x1f2296,_0x2c5330,_0x15c400,_0x3bc50a);};exports[_0xe2cf('0x29')]=function(_0x4480ca,_0x5a30d9,_0x5e8bfd){var _0x175aa7=_0x5a30d9[_0xe2cf('0x2a')]['UserId'];if(!_0x175aa7&&_0x5e8bfd){_0x175aa7=_0x5e8bfd['id'];}var _0x1f2a30=_[_0xe2cf('0x2b')](_0x4480ca[_0x5a30d9[_0xe2cf('0x2c')]+_0xe2cf('0x2d')],function(_0x5b9972){var _0x2a7c4b=_[_0xe2cf('0x2e')](_0x5a30d9['channel'])+_0xe2cf('0x2f');return _0x5b9972[_0x2a7c4b]===_0x5a30d9['interaction']['id'];});if(!_0x1f2a30&&_0x175aa7){_0x1f2a30=_[_0xe2cf('0x2b')](_0x4480ca['agents'][_0x175aa7][_0x5a30d9[_0xe2cf('0x2c')]+_0xe2cf('0x30')],function(_0x4370a6){return _0x4370a6['id']===_0x5a30d9[_0xe2cf('0x2a')]['id'];});}return _0x1f2a30;};exports['saveWaitingNotification']=function(_0x3f8fd6,_0x4f5692,_0x593d4a,_0xcf9d93){_0x3f8fd6[_0xe2cf('0x31')][_0x593d4a['id']][_0xcf9d93+_0xe2cf('0x30')][_0x4f5692['message']['id']]={'id':_0x4f5692[_0xe2cf('0x2a')]['id']};};exports['removeWaitingNotification']=function(_0x229eda,_0x291e8c,_0x1490d8,_0x4fc161){delete _0x229eda[_0xe2cf('0x31')][_0x1490d8['id']][_0x4fc161+_0xe2cf('0x30')][_0x291e8c['message']['id']];};exports[_0xe2cf('0x32')]=writeLog; \ No newline at end of file +var _0xa087=['redis','defaults','socket.io-emitter','name','emit','user:save','\x20interaction','account','notificationSound','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','user:%s','format','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','hideNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','routing'];(function(_0x4bfd95,_0x1c3b3b){var _0x1484cd=function(_0x2c622b){while(--_0x2c622b){_0x4bfd95['push'](_0x4bfd95['shift']());}};_0x1484cd(++_0x1c3b3b);}(_0xa087,0x14a));var _0x7a08=function(_0x1748a8,_0x5471bb){_0x1748a8=_0x1748a8-0x0;var _0xc3d04c=_0xa087[_0x1748a8];return _0xc3d04c;};'use strict';var _=require(_0x7a08('0x0'));var util=require(_0x7a08('0x1'));var utils=require(_0x7a08('0x2'));var Redis=require(_0x7a08('0x3'));var config=require(_0x7a08('0x4'));var logger=require('../../../../../config/logger')(_0x7a08('0x5'));config[_0x7a08('0x6')]=_[_0x7a08('0x7')](config[_0x7a08('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x7a08('0x8'))(new Redis(config[_0x7a08('0x6')]));function sendNotification(_0x237fcd,_0x48ac83,_0x34c079,_0x2bb40a,_0x442060,_0x288126){io['to'](util['format']('user:%s',_0x2bb40a[_0x7a08('0x9')]))[_0x7a08('0xa')](_0x7a08('0xb'),_0x2bb40a);var _0x532f3c=_0x288126||{};var _0x16d8b3=_0x34c079['split']('.');var _0x3e0ebd={'uniqueid':_0x48ac83,'channel':_0x16d8b3[0x0],'id':_0x16d8b3[0x1],'title':_0x16d8b3[0x0]+_0x7a08('0xc'),'interactionId':_0x16d8b3[0x2],'queue':_0x442060?_0x442060[_0x7a08('0x9')]:null,'sound':_0x532f3c[_0x7a08('0xd')][_0x7a08('0xe')],'shake':_0x532f3c[_0x7a08('0xd')]['notificationShake']};try{if(!_0x532f3c[_0x7a08('0xf')]){_0x532f3c[_0x7a08('0xf')]={};}if(_0x442060){_0x532f3c[_0x7a08('0xf')]['queue']=_0x442060;}else if(_0x532f3c['body'][_0x7a08('0x10')]){delete _0x532f3c[_0x7a08('0xf')][_0x7a08('0x10')];}_0x3e0ebd['msg']=utils[_0x7a08('0x11')](_0x532f3c['account'][_0x7a08('0x12')],_0x532f3c);}catch(_0x1ac0d8){_0x3e0ebd[_0x7a08('0x13')]=_0x7a08('0x14');logger['error'](util['format'](_0x7a08('0x15'),_0x48ac83,_0x1ac0d8[_0x7a08('0x16')]));}io['to'](util['format'](_0x7a08('0x17'),_0x2bb40a[_0x7a08('0x9')]))[_0x7a08('0xa')](util[_0x7a08('0x18')]('notification:%s',_0x237fcd?_0x7a08('0x19'):'remove'),_0x3e0ebd);}function writeLog(_0x5d4e27,_0x4ba137,_0x1a24fb){return logger[_0x7a08('0x1a')](util[_0x7a08('0x18')](_0x7a08('0x1b'),_0x5d4e27,_0x4ba137[_0x7a08('0x9')],_0x1a24fb));}exports[_0x7a08('0x1c')]=function(_0x43a6dd,_0x20059e,_0x14deb4,_0x598df3){if(_0x20059e['busy']){writeLog(_0x43a6dd,_0x20059e,_0x7a08('0x1d'));return![];}if(!_0x20059e['online']){writeLog(_0x43a6dd,_0x20059e,_0x7a08('0x1e'));return![];}if(_0x20059e[_0x14deb4+'Pause']){writeLog(_0x43a6dd,_0x20059e,_0x7a08('0x1f'));return![];}if(_0x598df3&&_0x20059e[_0x7a08('0x20')](_0x14deb4+_0x7a08('0x21'))&&_0x20059e[_0x7a08('0x20')](_0x14deb4+_0x7a08('0x22'))){if(_0x20059e[_0x14deb4+_0x7a08('0x21')]>0x0&&_0x20059e[_0x14deb4+'CurrentCapacity']>=_0x20059e[_0x14deb4+_0x7a08('0x21')]){writeLog(_0x43a6dd,_0x20059e,_0x14deb4[_0x7a08('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x1fc4a8,_0x4935a0,_0xba5d9b,_0x210885,_0x2c08cc){return sendNotification(!![],_0x1fc4a8,_0x4935a0,_0xba5d9b,_0x210885,_0x2c08cc);};exports[_0x7a08('0x24')]=function(_0x22f936,_0x32a2d4,_0x17bb52,_0x4243de,_0x529cf2){return sendNotification(![],_0x22f936,_0x32a2d4,_0x17bb52,_0x4243de,_0x529cf2);};exports['checkWaitingNotifications']=function(_0x27ea7a,_0x4567bf,_0x5432cf){var _0x43d008=_0x4567bf[_0x7a08('0x25')][_0x7a08('0x26')];if(!_0x43d008&&_0x5432cf){_0x43d008=_0x5432cf['id'];}var _0x49798f=_[_0x7a08('0x27')](_0x27ea7a[_0x4567bf[_0x7a08('0x28')]+_0x7a08('0x29')],function(_0x19c489){var _0x4141e6=_[_0x7a08('0x2a')](_0x4567bf['channel'])+_0x7a08('0x2b');return _0x19c489[_0x4141e6]===_0x4567bf['interaction']['id'];});if(!_0x49798f&&_0x43d008){_0x49798f=_[_0x7a08('0x27')](_0x27ea7a['agents'][_0x43d008][_0x4567bf[_0x7a08('0x28')]+_0x7a08('0x2c')],function(_0x54fb56){return _0x54fb56['id']===_0x4567bf[_0x7a08('0x25')]['id'];});}return _0x49798f;};exports[_0x7a08('0x2d')]=function(_0x418a3f,_0x16aad1,_0x5a02b9,_0x37a39f){_0x418a3f['agents'][_0x5a02b9['id']][_0x37a39f+_0x7a08('0x2c')][_0x16aad1[_0x7a08('0x16')]['id']]={'id':_0x16aad1[_0x7a08('0x25')]['id']};};exports[_0x7a08('0x2e')]=function(_0x560380,_0x56b7c0,_0x4ddc46,_0x20322d){delete _0x560380['agents'][_0x4ddc46['id']][_0x20322d+_0x7a08('0x2c')][_0x56b7c0[_0x7a08('0x16')]['id']];};exports[_0x7a08('0x2f')]=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 4507dcd..faf0977 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 _0x70c8=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','lodash','../../../../config/logger','routing','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x39637b,_0x512d81){var _0x1c7905=function(_0x31fe56){while(--_0x31fe56){_0x39637b['push'](_0x39637b['shift']());}};_0x1c7905(++_0x512d81);}(_0x70c8,0xa9));var _0x870c=function(_0x3ca7f0,_0x405904){_0x3ca7f0=_0x3ca7f0-0x0;var _0x440fa5=_0x70c8[_0x3ca7f0];return _0x440fa5;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x870c('0x0'));var utils=require('./utils');var logger=require(_0x870c('0x1'))(_0x870c('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1007f2,_0x25f057){return function(_0x11e069){try{var _0x3e27fa={'command':_0x25f057[0x0]};var _0x18c445=system[_0x870c('0x3')](_0x3e27fa,{'typecast':!![]});if(_0x18c445[_0x870c('0x4')]){logger[_0x870c('0x5')](_0x870c('0x6'),_0x1007f2,_[_0x870c('0x7')](_0x18c445,_0x870c('0x8'))[_0x870c('0x9')](',\x20'));logger['info'](_0x870c('0xa'),_0x1007f2);_0x11e069[_0x870c('0xb')]();}else{var _0x52de4c=this;var _0x3ad7bc=utils[_0x870c('0xc')](_0x25f057[0x0],this);logger[_0x870c('0xd')](_0x870c('0xe'),_0x1007f2,_0x3ad7bc);sh['exec'](_[_0x870c('0xf')](_0x3ad7bc),function(_0x15ffb8,_0x54a087){logger[_0x870c('0xd')](_0x870c('0x10'),_0x1007f2,_0x15ffb8);if(_0x15ffb8==0x0){var _0x312377=_0x54a087[_0x870c('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x870c('0x12')](_0x25f057[0x1])||_['isEmpty'](_0x25f057[0x1])){logger[_0x870c('0xd')](_0x870c('0x13'),_0x1007f2);_0x52de4c[_0x870c('0x14')][_0x25f057[0x1]]=_0x312377;}else{logger['info'](_0x870c('0x15'),_0x1007f2,_0x25f057[0x1],_0x312377);_0x52de4c[_0x870c('0x14')][_0x25f057[0x1]]=_0x312377;}}_0x11e069[_0x870c('0xb')]();});}}catch(_0x1f5aae){logger[_0x870c('0x5')](_0x870c('0x6'),_0x1007f2,_[_0x870c('0x16')](_0x1f5aae)?JSON['stringify'](_0x1f5aae):_0x1f5aae);logger[_0x870c('0xd')](_0x870c('0xa'),_0x1007f2);_0x11e069['next']();}};}; \ No newline at end of file +var _0x22b0=['validate','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify'];(function(_0x687064,_0x5e2b3d){var _0x40c21c=function(_0x125f4f){while(--_0x125f4f){_0x687064['push'](_0x687064['shift']());}};_0x40c21c(++_0x5e2b3d);}(_0x22b0,0x177));var _0x022b=function(_0x1eb663,_0xefc41a){_0x1eb663=_0x1eb663-0x0;var _0x255540=_0x22b0[_0x1eb663];return _0x255540;};'use strict';var schema=require(_0x022b('0x0'));var sh=require('shelljs');var _=require(_0x022b('0x1'));var utils=require(_0x022b('0x2'));var logger=require(_0x022b('0x3'))(_0x022b('0x4'));var system=schema({'command':{'type':_0x022b('0x5'),'required':!![],'message':_0x022b('0x6')}});exports[_0x022b('0x7')]=function(_0x479d51,_0x2bf4f1){return function(_0x7b2362){try{var _0x2cb696={'command':_0x2bf4f1[0x0]};var _0x34bcf6=system[_0x022b('0x0')](_0x2cb696,{'typecast':!![]});if(_0x34bcf6[_0x022b('0x8')]){logger[_0x022b('0x9')](_0x022b('0xa'),_0x479d51,_[_0x022b('0xb')](_0x34bcf6,_0x022b('0xc'))[_0x022b('0xd')](',\x20'));logger[_0x022b('0xe')](_0x022b('0xf'),_0x479d51);_0x7b2362[_0x022b('0x10')]();}else{var _0x48f958=this;var _0x28d177=utils[_0x022b('0x11')](_0x2bf4f1[0x0],this);logger[_0x022b('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x479d51,_0x28d177);sh['exec'](_['trim'](_0x28d177),function(_0x5b183f,_0x25cf86){logger['info'](_0x022b('0x12'),_0x479d51,_0x5b183f);if(_0x5b183f==0x0){var _0x3deb52=_0x25cf86['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x022b('0x13')](_0x2bf4f1[0x1])||_[_0x022b('0x14')](_0x2bf4f1[0x1])){logger[_0x022b('0xe')](_0x022b('0x15'),_0x479d51);_0x48f958[_0x022b('0x16')][_0x2bf4f1[0x1]]=_0x3deb52;}else{logger[_0x022b('0xe')](_0x022b('0x17'),_0x479d51,_0x2bf4f1[0x1],_0x3deb52);_0x48f958[_0x022b('0x16')][_0x2bf4f1[0x1]]=_0x3deb52;}}_0x7b2362['next']();});}}catch(_0x4ccff9){logger[_0x022b('0x9')](_0x022b('0xa'),_0x479d51,_['isObject'](_0x4ccff9)?JSON[_0x022b('0x18')](_0x4ccff9):_0x4ccff9);logger[_0x022b('0xe')](_0x022b('0xf'),_0x479d51);_0x7b2362[_0x022b('0x10')]();}};}; \ 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 e7cbd60..ac08919 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 _0xb0e9=['routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','next','error','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x40ca1b,_0x39d6f3){var _0x2eb0f0=function(_0x4fb6e2){while(--_0x4fb6e2){_0x40ca1b['push'](_0x40ca1b['shift']());}};_0x2eb0f0(++_0x39d6f3);}(_0xb0e9,0x13e));var _0x9b0e=function(_0x54b2f7,_0x2faed0){_0x54b2f7=_0x54b2f7-0x0;var _0x55572d=_0xb0e9[_0x54b2f7];return _0x55572d;};'use strict';var schema=require(_0x9b0e('0x0'));var _=require(_0x9b0e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9b0e('0x2')),'smsInteraction':require(_0x9b0e('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x9b0e('0x4')),'whatsappInteraction':require(_0x9b0e('0x5'))};var logger=require(_0x9b0e('0x6'))(_0x9b0e('0x7'));var tag=schema({'tag':{'type':_0x9b0e('0x8'),'required':!![],'message':_0x9b0e('0x9')}});exports[_0x9b0e('0xa')]=function(_0x1f8175,_0x54f478,_0x31a205,_0x1d4480){return function(_0x4fe656){try{var _0x218dd7={'tag':_0x54f478[0x0]};var _0x313dbd=tag['validate'](_0x218dd7,{'typecast':!![]});if(_0x313dbd['length']){logger['error'](_0x9b0e('0xb'),_0x1f8175,_['map'](_0x313dbd,_0x9b0e('0xc'))['join'](',\x20'));logger[_0x9b0e('0xd')](_0x9b0e('0xe'),_0x1f8175);_0x4fe656['next']();}else{var _0x4b0c02={'ids':[_0x54f478[0x0]]};if(rpc[_0x1d4480['channel']+_0x9b0e('0xf')]){rpc[_0x1d4480[_0x9b0e('0x10')]+_0x9b0e('0xf')]['addTags'](_0x1d4480[_0x9b0e('0x11')]['id'],_0x4b0c02)[_0x9b0e('0x12')](function(_0xfd7da2){logger['info'](_0x9b0e('0x13'),_0x1f8175,_0x54f478[0x1],_0x1d4480['channel'],_0x1d4480[_0x9b0e('0x11')]['id']);})[_0x9b0e('0x14')](function(_0x373747){logger['error'](_0x9b0e('0xb'),_0x1f8175,JSON[_0x9b0e('0x15')](_0x373747));logger[_0x9b0e('0xd')](_0x9b0e('0xe'),_0x1f8175);})['finally'](function(){_0x4fe656[_0x9b0e('0x16')]();});}}}catch(_0x1a2283){logger[_0x9b0e('0x17')](_0x9b0e('0xb'),_0x1f8175,_[_0x9b0e('0x18')](_0x1a2283)?JSON[_0x9b0e('0x15')](_0x1a2283):_0x1a2283);logger['info'](_0x9b0e('0xe'),_0x1f8175);_0x4fe656['next']();}};}; \ No newline at end of file +var _0x2c84=['validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','finally','isObject'];(function(_0x494e23,_0x59bc35){var _0x195cce=function(_0x517bfb){while(--_0x517bfb){_0x494e23['push'](_0x494e23['shift']());}};_0x195cce(++_0x59bc35);}(_0x2c84,0xfc));var _0x42c8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2c84[_0x501510];return _0x1e6ee5;};'use strict';var schema=require(_0x42c8('0x0'));var _=require(_0x42c8('0x1'));var rpc={'chatInteraction':require(_0x42c8('0x2')),'openchannelInteraction':require(_0x42c8('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x42c8('0x4')),'faxInteraction':require(_0x42c8('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x42c8('0x6'))(_0x42c8('0x7'));var tag=schema({'tag':{'type':_0x42c8('0x8'),'required':!![],'message':_0x42c8('0x9')}});exports[_0x42c8('0xa')]=function(_0xae201d,_0x12929b,_0x309daf,_0x5af835){return function(_0x5336fe){try{var _0x26f90e={'tag':_0x12929b[0x0]};var _0x4e3566=tag[_0x42c8('0x0')](_0x26f90e,{'typecast':!![]});if(_0x4e3566['length']){logger[_0x42c8('0xb')]('[%s][TAG]\x20%s',_0xae201d,_[_0x42c8('0xc')](_0x4e3566,_0x42c8('0xd'))[_0x42c8('0xe')](',\x20'));logger['info'](_0x42c8('0xf'),_0xae201d);_0x5336fe[_0x42c8('0x10')]();}else{var _0x596daa={'ids':[_0x12929b[0x0]]};if(rpc[_0x5af835[_0x42c8('0x11')]+_0x42c8('0x12')]){rpc[_0x5af835[_0x42c8('0x11')]+_0x42c8('0x12')][_0x42c8('0x13')](_0x5af835[_0x42c8('0x14')]['id'],_0x596daa)[_0x42c8('0x15')](function(_0x56e4af){logger[_0x42c8('0x16')](_0x42c8('0x17'),_0xae201d,_0x12929b[0x1],_0x5af835[_0x42c8('0x11')],_0x5af835[_0x42c8('0x14')]['id']);})['catch'](function(_0x209144){logger['error'](_0x42c8('0x18'),_0xae201d,JSON[_0x42c8('0x19')](_0x209144));logger[_0x42c8('0x16')](_0x42c8('0xf'),_0xae201d);})[_0x42c8('0x1a')](function(){_0x5336fe[_0x42c8('0x10')]();});}}}catch(_0x226504){logger[_0x42c8('0xb')](_0x42c8('0x18'),_0xae201d,_[_0x42c8('0x1b')](_0x226504)?JSON['stringify'](_0x226504):_0x226504);logger['info'](_0x42c8('0xf'),_0xae201d);_0x5336fe[_0x42c8('0x10')]();}};}; \ 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 3b9821e..de687e0 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 _0xbb0b=['jsonrpc','2.0','method','login','stringify','utf8','POST','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','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','next','request-promise','routing','lodash','consequence','\x20-\x20','replace','push','?params=','urlOnRing','title'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xbb0b,0xbc));var _0xbbb0=function(_0x56971a,_0x9b2573){_0x56971a=_0x56971a-0x0;var _0xcec517=_0xbb0b[_0x56971a];return _0xcec517;};'use strict';var rp=require(_0xbbb0('0x0'));var logger=require('../../../../config/logger')(_0xbbb0('0x1'));var _=require(_0xbbb0('0x2'));var arr=[];exports[_0xbbb0('0x3')]=function(_0x5e45ce,_0x17dc9a){return function(_0x70724d){var _0x5dd1df=_0x17dc9a[0xa];var _0x2bf948=_0x17dc9a[0xb];var _0xb587e9=_0x17dc9a[0xc];var _0x4422b8=_0x17dc9a[0xd];var _0x17e88b=_0x17dc9a[0xe];var _0x3f1207=_0x17dc9a[0xf]['replace'](/\n/g,_0xbbb0('0x4'));var _0x5462d0=_0x17dc9a[0x10][_0xbbb0('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x2bf948)){arr[_0xbbb0('0x6')](_0x2bf948);var _0x3ce1d4=_0x17dc9a[0x3];var _0x3b5b3c=_0x17dc9a[0x4];var _0x16016d=_0x17dc9a[0x1];var _0x115ee4=_0x17dc9a[0x0];var _0x55030b={};_0x55030b['urlOnAnswer']=_0x17dc9a[0x8]+_0xbbb0('0x7')+_0xb587e9+'|'+_0x5dd1df+'|'+_0x4422b8+'|'+_0x2bf948+'|'+_0x17e88b;_0x55030b[_0xbbb0('0x8')]=_0x17dc9a[0x7]+_0xbbb0('0x7')+_0xb587e9+'|'+_0x5dd1df+'|'+_0x4422b8+'|'+_0x2bf948+'|'+_0x17e88b+'|'+_0x3f1207+'|'+_0x5462d0;_0x55030b[_0xbbb0('0x9')]=_0x17dc9a[0x9];var _0xc78a9a={};_0xc78a9a[_0xbbb0('0xa')]=_0xbbb0('0xb');_0xc78a9a[_0xbbb0('0xc')]=_0xbbb0('0xd');var _0x4857cb=[];_0x4857cb[_0xbbb0('0x6')](_0x17dc9a[0x2]);_0x4857cb['push'](_0x17dc9a[0x5]);_0x4857cb[_0xbbb0('0x6')](_0x17dc9a[0x6]);_0xc78a9a['params']=_0x4857cb;_0xc78a9a['id']=0x1;var _0x13072a=JSON[_0xbbb0('0xe')](_0xc78a9a);var _0x430fd1={'encoding':_0xbbb0('0xf'),'method':_0xbbb0('0x10'),'timeout':0x2710,'url':_0x3ce1d4,'headers':{'Content-Type':'application/json-rpc'},'body':_0x13072a};return rp(_0x430fd1)[_0xbbb0('0x11')](function(_0x3c6acf){const _0x4f222e=JSON[_0xbbb0('0x12')](_0x3c6acf);if(!_0x4f222e[_0xbbb0('0x13')]['logged']){throw new Error(_0xbbb0('0x14'));}var _0x126134=_0x2bf948;var _0x25dcb1='channelId='+_0x16016d+_0xbbb0('0x15')+_0x115ee4+_0xbbb0('0x16')+_0x126134+_0xbbb0('0x17')+JSON[_0xbbb0('0xe')](_0x55030b);var _0x18abfd=_0x3b5b3c+'?'+_0x25dcb1;return rp(_0x18abfd);})[_0xbbb0('0x11')](function(_0x5b419c){logger[_0xbbb0('0x18')](_0xbbb0('0x19'),_0x5e45ce,_0x5b419c);_0x70724d[_0xbbb0('0x1a')]();})[_0xbbb0('0x1b')](function(_0x36433a){logger[_0xbbb0('0x1c')](_0xbbb0('0x1d'),_0x5e45ce,_[_0xbbb0('0x1e')](_0x36433a)?JSON[_0xbbb0('0xe')](_0x36433a):_0x36433a);_0x70724d['stop']();});}else{logger['info'](_0xbbb0('0x1f'),_0x5e45ce);_0x70724d[_0xbbb0('0x20')]();}};}; \ No newline at end of file +var _0x885e=['title','jsonrpc','2.0','login','params','stringify','utf8','POST','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','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','next','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params='];(function(_0x167f1f,_0x156679){var _0x940f1c=function(_0x167927){while(--_0x167927){_0x167f1f['push'](_0x167f1f['shift']());}};_0x940f1c(++_0x156679);}(_0x885e,0x7f));var _0xe885=function(_0x2703cb,_0x1bbfba){_0x2703cb=_0x2703cb-0x0;var _0x2a373c=_0x885e[_0x2703cb];return _0x2a373c;};'use strict';var rp=require('request-promise');var logger=require(_0xe885('0x0'))('routing');var _=require(_0xe885('0x1'));var arr=[];exports[_0xe885('0x2')]=function(_0x135bb5,_0x82ea34){return function(_0x40ae56){var _0x3d0161=_0x82ea34[0xa];var _0x31c514=_0x82ea34[0xb];var _0x2cfe53=_0x82ea34[0xc];var _0x3b9409=_0x82ea34[0xd];var _0x2c739d=_0x82ea34[0xe];var _0x459662=_0x82ea34[0xf][_0xe885('0x3')](/\n/g,_0xe885('0x4'));var _0x3d7329=_0x82ea34[0x10][_0xe885('0x3')](/\n/g,'\x20');if(!arr[_0xe885('0x5')](_0x31c514)){arr[_0xe885('0x6')](_0x31c514);var _0x4ac072=_0x82ea34[0x3];var _0x27c225=_0x82ea34[0x4];var _0x40d3db=_0x82ea34[0x1];var _0x24b238=_0x82ea34[0x0];var _0x213be1={};_0x213be1[_0xe885('0x7')]=_0x82ea34[0x8]+_0xe885('0x8')+_0x2cfe53+'|'+_0x3d0161+'|'+_0x3b9409+'|'+_0x31c514+'|'+_0x2c739d;_0x213be1['urlOnRing']=_0x82ea34[0x7]+'?params='+_0x2cfe53+'|'+_0x3d0161+'|'+_0x3b9409+'|'+_0x31c514+'|'+_0x2c739d+'|'+_0x459662+'|'+_0x3d7329;_0x213be1[_0xe885('0x9')]=_0x82ea34[0x9];var _0x3f077a={};_0x3f077a[_0xe885('0xa')]=_0xe885('0xb');_0x3f077a['method']=_0xe885('0xc');var _0x2e8c5d=[];_0x2e8c5d['push'](_0x82ea34[0x2]);_0x2e8c5d[_0xe885('0x6')](_0x82ea34[0x5]);_0x2e8c5d[_0xe885('0x6')](_0x82ea34[0x6]);_0x3f077a[_0xe885('0xd')]=_0x2e8c5d;_0x3f077a['id']=0x1;var _0x56861e=JSON[_0xe885('0xe')](_0x3f077a);var _0x1061e1={'encoding':_0xe885('0xf'),'method':_0xe885('0x10'),'timeout':0x2710,'url':_0x4ac072,'headers':{'Content-Type':'application/json-rpc'},'body':_0x56861e};return rp(_0x1061e1)[_0xe885('0x11')](function(_0x98fb1f){const _0x1dbae3=JSON['parse'](_0x98fb1f);if(!_0x1dbae3[_0xe885('0x12')][_0xe885('0x13')]){throw new Error(_0xe885('0x14'));}var _0x4f7199=_0x31c514;var _0x1967ed=_0xe885('0x15')+_0x40d3db+_0xe885('0x16')+_0x24b238+_0xe885('0x17')+_0x4f7199+_0xe885('0x18')+JSON[_0xe885('0xe')](_0x213be1);var _0x2ea00b=_0x27c225+'?'+_0x1967ed;return rp(_0x2ea00b);})[_0xe885('0x11')](function(_0x30337a){logger[_0xe885('0x19')](_0xe885('0x1a'),_0x135bb5,_0x30337a);_0x40ae56[_0xe885('0x1b')]();})[_0xe885('0x1c')](function(_0x233432){logger[_0xe885('0x1d')](_0xe885('0x1e'),_0x135bb5,_[_0xe885('0x1f')](_0x233432)?JSON[_0xe885('0xe')](_0x233432):_0x233432);_0x40ae56[_0xe885('0x1b')]();});}else{logger[_0xe885('0x19')](_0xe885('0x20'),_0x135bb5);_0x40ae56[_0xe885('0x21')]();}};}; \ 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 0dc7c6d..b476e2a 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3edb1a,_0x2b7053){var _0x45c234=function(_0x52e865){while(--_0x52e865){_0x3edb1a['push'](_0x3edb1a['shift']());}};_0x45c234(++_0x2b7053);}(_0xe706,0xa3));var _0x6e70=function(_0x16dbab,_0x3ac1e1){_0x16dbab=_0x16dbab-0x0;var _0x59b0b2=_0xe706[_0x16dbab];return _0x59b0b2;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x5e20ec,_0x270e7a){var _0x5cd965=function(_0x318564){while(--_0x318564){_0x5e20ec['push'](_0x5e20ec['shift']());}};_0x5cd965(++_0x270e7a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9fb7cee..780b677 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 _0xcc58=['util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','existsSync','app','.js','toLowerCase','appdata','split','mail','push','join','length','dialogflow','dialogflowv2','slice','amazonlex','tag','tvox','getMustacheRender','notificationTemplate','ContactId','body','format','%s:%s:%s','./interval','condition','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:'];(function(_0x7b5c69,_0x3ec935){var _0x1d877b=function(_0x50a8c9){while(--_0x50a8c9){_0x7b5c69['push'](_0x7b5c69['shift']());}};_0x1d877b(++_0x3ec935);}(_0xcc58,0xd0));var _0x8cc5=function(_0x1e57ec,_0x5c9f15){_0x1e57ec=_0x1e57ec-0x0;var _0xb9b576=_0xcc58[_0x1e57ec];return _0xb9b576;};'use strict';var _=require('lodash');var util=require(_0x8cc5('0x0'));var path=require(_0x8cc5('0x1'));var fs=require('fs');var jayson=require(_0x8cc5('0x2'));var BPromise=require(_0x8cc5('0x3'));var utils=require(_0x8cc5('0x4'));var sUtils=require(_0x8cc5('0x5'));var logger=require('../../../config/logger')(_0x8cc5('0x6'));var rpc={'openchannelQueueReport':require(_0x8cc5('0x7')),'mailQueueReport':require(_0x8cc5('0x8')),'chatQueueReport':require(_0x8cc5('0x9')),'smsQueueReport':require(_0x8cc5('0xa')),'faxQueueReport':require(_0x8cc5('0xb')),'whatsappQueueReport':require(_0x8cc5('0xc'))};var RuleEngine=require(_0x8cc5('0xd'));function getId(_0x324122,_0x2fab35,_0x5ec8ea){return util['format'](_0x8cc5('0xe'),_0x324122,_0x2fab35||0x0,_0x5ec8ea||0x0);}function getIntervals(_0x17f852,_0x12ed16){var _0x1c7d5d=[];if(!_[_0x8cc5('0xf')](_0x12ed16[_0x8cc5('0x10')])&&!_[_0x8cc5('0xf')](_0x17f852[_0x12ed16[_0x8cc5('0x10')]])&&!_[_0x8cc5('0xf')](_0x17f852[_0x12ed16[_0x8cc5('0x10')]][_0x8cc5('0x11')])){_0x1c7d5d=_[_0x8cc5('0x12')](_0x17f852[_0x12ed16[_0x8cc5('0x10')]][_0x8cc5('0x11')],_0x8cc5('0x13'));}else if(!_[_0x8cc5('0xf')](_0x12ed16[_0x8cc5('0x13')])){_0x1c7d5d=[_0x12ed16['interval']];}return _0x1c7d5d;}exports[_0x8cc5('0x14')]=function(_0x5c9479){_0x5c9479[_0x8cc5('0x15')]={};return new BPromise(function(_0x3d9145,_0xc15aa1){var _0x108e8f={'Start':function(_0x31e6d2){var _0x3d2911=this;return new Promise(function(_0x2111f2,_0x2a6ad0){if(_0x31e6d2){try{var _0x33ec9d=[];var _0x1e3892=getId(_0x31e6d2[_0x8cc5('0x16')],_0x31e6d2[_0x8cc5('0x17')]?_0x31e6d2[_0x8cc5('0x17')]['id']:0x0,_0x31e6d2[_0x8cc5('0x18')]?_0x31e6d2['interaction']['id']:0x0);var _0x549e99=sUtils['checkWaitingNotifications'](_0x5c9479,_0x31e6d2);if(!_0x549e99&&_0x31e6d2['applications']&&_[_0x8cc5('0x19')](_0x31e6d2[_0x8cc5('0x1a')])&&_0x31e6d2[_0x8cc5('0x1a')]['length']){for(var _0x41f8ed=0x0;_0x41f8ed<_0x31e6d2[_0x8cc5('0x1a')]['length'];_0x41f8ed+=0x1){var _0x3ccf1f=_0x31e6d2[_0x8cc5('0x1a')][_0x41f8ed];if(fs[_0x8cc5('0x1b')](path['join'](__dirname,_0x8cc5('0x1a'),_0x3ccf1f[_0x8cc5('0x1c')]+_0x8cc5('0x1d')))){var _0x450242=[];switch(_0x3ccf1f[_0x8cc5('0x1c')][_0x8cc5('0x1e')]()){case'autoreply':var _0x11b34a=_0x3ccf1f[_0x8cc5('0x1f')][_0x8cc5('0x20')](',');if(_0x31e6d2[_0x8cc5('0x16')]===_0x8cc5('0x21')){_0x450242[_0x8cc5('0x22')](_0x11b34a[0x0]);_0x450242['push'](_0x11b34a[0x1]);_0x450242[_0x8cc5('0x22')](_0x11b34a['slice'](0x2,_0x11b34a['length'])[_0x8cc5('0x23')](','));}else{_0x450242[_0x8cc5('0x22')](_0x11b34a[0x0]);_0x450242[_0x8cc5('0x22')](_0x11b34a['slice'](0x1,_0x11b34a[_0x8cc5('0x24')])[_0x8cc5('0x23')](','));}break;case _0x8cc5('0x25'):var _0x4fafec=_0x3ccf1f['appdata']['split'](',');_0x450242['push'](_0x4fafec[0x0]);_0x450242['push'](_0x4fafec[0x1]);_0x450242['push'](_0x4fafec['slice'](0x2,_0x4fafec[_0x8cc5('0x24')])[_0x8cc5('0x23')](','));break;case _0x8cc5('0x26'):var _0x38ceaa=_0x3ccf1f[_0x8cc5('0x1f')][_0x8cc5('0x20')](',');_0x450242['push'](_0x38ceaa[0x0]);_0x450242['push'](_0x38ceaa[0x1]);_0x450242[_0x8cc5('0x22')](_0x38ceaa[0x2]);_0x450242[_0x8cc5('0x22')](_0x38ceaa[0x3]);_0x450242[_0x8cc5('0x22')](_0x38ceaa[_0x8cc5('0x27')](0x4,_0x38ceaa[_0x8cc5('0x24')])['join'](','));break;case _0x8cc5('0x28'):var _0x3c80f6=_0x3ccf1f['appdata']['split'](',');_0x450242[_0x8cc5('0x22')](_0x3c80f6[0x0]);_0x450242[_0x8cc5('0x22')](_0x3c80f6[0x1]);_0x450242[_0x8cc5('0x22')](_0x3c80f6[0x2]);_0x450242[_0x8cc5('0x22')](_0x3c80f6[0x3]);_0x450242[_0x8cc5('0x22')](_0x3c80f6[_0x8cc5('0x27')](0x4,_0x3c80f6[_0x8cc5('0x24')])[_0x8cc5('0x23')](','));break;case _0x8cc5('0x17'):_0x450242[_0x8cc5('0x22')](_0x3ccf1f[_0x8cc5('0x1f')]);break;case _0x8cc5('0x29'):_0x450242[_0x8cc5('0x22')](_0x3ccf1f['TagId']);_0x450242['push'](_0x3ccf1f[_0x8cc5('0x1f')]);break;case _0x8cc5('0x2a'):var _0x423518=utils[_0x8cc5('0x2b')](_0x31e6d2['account'][_0x8cc5('0x2c')],_0x31e6d2);var _0x49f0bd=_0x3ccf1f[_0x8cc5('0x1f')][_0x8cc5('0x20')](',');_0x450242[_0x8cc5('0x22')](_0x49f0bd[0x0]);_0x450242['push'](_0x49f0bd[0x1]);_0x450242['push'](_0x49f0bd[0x2]);_0x450242[_0x8cc5('0x22')](_0x49f0bd[0x3]);_0x450242[_0x8cc5('0x22')](_0x49f0bd[0x4]);_0x450242[_0x8cc5('0x22')](_0x49f0bd[0x5]);_0x450242['push'](_0x49f0bd[0x6]);_0x450242[_0x8cc5('0x22')](_0x49f0bd[0x7]);_0x450242[_0x8cc5('0x22')](_0x49f0bd[0x8]);_0x450242[_0x8cc5('0x22')](_0x49f0bd[0x9]);_0x450242['push'](_0x49f0bd[0xa]);_0x450242[_0x8cc5('0x22')](_0x31e6d2['interaction']['id']);_0x450242[_0x8cc5('0x22')](_0x31e6d2[_0x8cc5('0x17')]['id']);_0x450242[_0x8cc5('0x22')](_0x3ccf1f['ChatWebsiteId']);_0x450242['push'](_0x31e6d2[_0x8cc5('0x18')][_0x8cc5('0x2d')]);_0x450242['push'](_0x31e6d2[_0x8cc5('0x2e')][_0x8cc5('0x2e')]);_0x450242[_0x8cc5('0x22')](_0x423518);break;default:_0x450242=_['isNil'](_0x3ccf1f['appdata'])?[]:_0x3ccf1f[_0x8cc5('0x1f')][_0x8cc5('0x20')](',');}var _0x4690c0={'id':util[_0x8cc5('0x2f')](_0x8cc5('0x30'),_0x1e3892,_0x3ccf1f['id'],_0x3ccf1f[_0x8cc5('0x1c')]),'condition':require(_0x8cc5('0x31'))[_0x8cc5('0x32')](_0x1e3892,getIntervals(_0x5c9479['intervals'],_0x3ccf1f),_0x5c9479),'consequence':require('./applications/'+_0x3ccf1f[_0x8cc5('0x1c')])[_0x8cc5('0x33')](_0x1e3892,_0x450242,_0x5c9479,_0x31e6d2),'p':_0x3ccf1f[_0x8cc5('0x34')]||0x0};logger[_0x8cc5('0x35')](_0x8cc5('0x36'),_0x4690c0['id'],_0x8cc5('0x37'),getIntervals(_0x5c9479[_0x8cc5('0x38')],_0x3ccf1f)['join']('\x20|\x20'));_0x33ec9d[_0x8cc5('0x22')](_0x4690c0);}else{logger['error'](_0x8cc5('0x39'),path[_0x8cc5('0x23')](__dirname,_0x8cc5('0x1a'),_0x3ccf1f['app']+_0x8cc5('0x1d')));}}_0x5c9479['rules'][_0x1e3892]=new RuleEngine(_0x33ec9d);_0x5c9479['rules'][_0x1e3892][_0x8cc5('0x3a')](_0x31e6d2,function(_0x4d0958){logger[_0x8cc5('0x35')]('Applications\x20executed',JSON[_0x8cc5('0x3b')](_0x4d0958[_0x8cc5('0x3c')]));if(_0x5c9479[_0x8cc5('0x15')][_0x1e3892]){_0x5c9479[_0x8cc5('0x15')][_0x1e3892][_0x8cc5('0x3d')](_0x8cc5('0x3e'));}});return _0x2111f2({'code':0xc8,'message':_0x31e6d2});}else{if(_0x549e99){logger['info'](util['format'](_0x8cc5('0x3f'),_0x1e3892));}else{logger[_0x8cc5('0x35')](_0x8cc5('0x40'));}return _0x2111f2({'code':0xc8,'message':_0x31e6d2});}}catch(_0x386308){logger[_0x8cc5('0x41')](_0x386308[_0x8cc5('0x42')]);return _0x2a6ad0(_0x3d2911['error'](0x1f4,_0x386308));}}return _0x2a6ad0(_0x8cc5('0x43'));});},'AcceptMessage':function(_0x212f9d){var _0x375047=this;return new Promise(function(_0x529afb,_0x2b1e04){if(_0x212f9d['agent']&&_0x212f9d[_0x8cc5('0x44')]['id']){if(_0x5c9479[_0x8cc5('0x45')][_0x212f9d[_0x8cc5('0x44')]['id']]){_0x5c9479[_0x8cc5('0x45')][_0x212f9d['agent']['id']][_0x8cc5('0x46')]=![];_0x5c9479[_0x8cc5('0x45')][_0x212f9d[_0x8cc5('0x44')]['id']][_0x8cc5('0x47')]=undefined;}}if(_0x212f9d['message']&&_0x212f9d['message']['id']){try{var _0x4ac6bc=getId(_0x212f9d[_0x8cc5('0x16')],_0x212f9d[_0x8cc5('0x17')]?_0x212f9d[_0x8cc5('0x17')]['id']:0x0,_0x212f9d[_0x8cc5('0x18')]?_0x212f9d[_0x8cc5('0x18')]['id']:0x0);if(_0x5c9479[_0x8cc5('0x15')][_0x4ac6bc]){_0x5c9479[_0x8cc5('0x15')][_0x4ac6bc][_0x8cc5('0x3d')](_0x8cc5('0x48'));if(rpc[_0x212f9d[_0x8cc5('0x16')]+_0x8cc5('0x49')]){rpc[_0x212f9d[_0x8cc5('0x16')]+_0x8cc5('0x49')]['update'](_0x4ac6bc,{'UserId':_0x212f9d[_0x8cc5('0x17')][_0x8cc5('0x4a')]})[_0x8cc5('0x4b')](function(){logger[_0x8cc5('0x41')](_0x8cc5('0x4c'));});}}return _0x529afb({'code':0xc8,'message':_0x212f9d});}catch(_0x858db4){logger[_0x8cc5('0x41')](_0x858db4[_0x8cc5('0x42')]);return _0x2b1e04(_0x375047['error'](0x1f4,_0x858db4));}}logger[_0x8cc5('0x41')]('message\x20is\x20empty');return _0x2b1e04(_0x375047[_0x8cc5('0x41')](0x1f4,_0x8cc5('0x4d')));});},'RejectMessage':function(_0x420245){var _0x423b7f=this;return new Promise(function(_0x28444d,_0xc7c4e8){if(_0x420245[_0x8cc5('0x44')]&&_0x420245[_0x8cc5('0x44')]['id']){try{if(_0x5c9479['agents'][_0x420245[_0x8cc5('0x44')]['id']]){_0x5c9479['agents'][_0x420245[_0x8cc5('0x44')]['id']]['busy']=![];_0x5c9479[_0x8cc5('0x45')][_0x420245[_0x8cc5('0x44')]['id']][_0x8cc5('0x47')]=undefined;}return _0x28444d({'code':0xc8,'message':_0x420245});}catch(_0x23c257){logger[_0x8cc5('0x41')](_0x23c257['stack']);return _0xc7c4e8(_0x423b7f[_0x8cc5('0x41')](0x1f4,_0x23c257));}}logger['error'](_0x8cc5('0x4d'));return _0xc7c4e8(_0x423b7f[_0x8cc5('0x41')](0x1f4,_0x8cc5('0x4d')));});},'AbandonInteraction':function(_0x35fc9f){var _0x3aa056=this;return new Promise(function(_0x383dcb,_0x7bd2d9){if(_0x35fc9f[_0x8cc5('0x16')]&&_0x35fc9f[_0x8cc5('0x18')]&&_0x35fc9f[_0x8cc5('0x18')]['id']){try{var _0x39cd80=getId(_0x35fc9f[_0x8cc5('0x16')],_0x35fc9f[_0x8cc5('0x17')]?_0x35fc9f[_0x8cc5('0x17')]['id']:0x0,_0x35fc9f['interaction']?_0x35fc9f['interaction']['id']:0x0);if(_0x5c9479[_0x8cc5('0x15')][_0x39cd80]){_0x5c9479[_0x8cc5('0x15')][_0x39cd80][_0x8cc5('0x3d')](_0x8cc5('0x48'));}return _0x383dcb({'code':0xc8,'message':_0x35fc9f});}catch(_0x4c678b){logger[_0x8cc5('0x41')](_0x4c678b['stack']);return _0x7bd2d9(_0x3aa056[_0x8cc5('0x41')](0x1f4,_0x4c678b));}}logger[_0x8cc5('0x41')](_0x8cc5('0x4d'));return _0x7bd2d9(_0x3aa056[_0x8cc5('0x41')](0x1f4,_0x8cc5('0x4d')));});},'AgentCapacity':function(_0x1d0531){var _0x361467=this;return new Promise(function(_0x2299eb,_0x21face){if(_0x5c9479[_0x8cc5('0x45')][_0x8cc5('0x4e')](_0x1d0531['id'])){for(var _0x182e2e in _0x1d0531[_0x8cc5('0x4f')]){if(_0x1d0531[_0x8cc5('0x4f')]['hasOwnProperty'](_0x182e2e)){if(_0x5c9479['agents'][_0x1d0531['id']][_0x8cc5('0x4e')](_0x182e2e+_0x8cc5('0x50'))){_0x5c9479['agents'][_0x1d0531['id']][_0x182e2e+'CurrentCapacity']=parseInt(_0x1d0531['capacity'][_0x182e2e],0xa);}}}_0x5c9479[_0x8cc5('0x45')][_0x1d0531['id']]['updateRealtime']();return _0x2299eb({'code':0xc8,'message':_0x5c9479['agents'][_0x1d0531['id']]});}else{return _0x21face(_0x361467[_0x8cc5('0x41')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2d8a4f){return new Promise(function(_0x282d2a){var _0x3a80ee=_[_0x8cc5('0x51')](_0x5c9479[_0x8cc5('0x45')]);if(_0x2d8a4f&&_0x2d8a4f['id']){var _0x5e11c5=_[_0x8cc5('0x52')](_0x3a80ee,function(_0x317f4c){return _0x317f4c['id']===_0x2d8a4f['id'];});_0x282d2a(_0x5e11c5);}else{_0x282d2a({'count':_0x3a80ee[_0x8cc5('0x24')],'rows':_0x3a80ee});}});},'ChatQueues':function(){return new Promise(function(_0x4076b2){var _0x75ac3b=[];for(var _0x14beae in _0x5c9479[_0x8cc5('0x53')]){if(_0x5c9479[_0x8cc5('0x53')]['hasOwnProperty'](_0x14beae)){var _0x19260c=_0x5c9479[_0x8cc5('0x53')][_0x14beae];var _0x95db59={'id':_0x19260c['id'],'available':_0x19260c[_0x8cc5('0x54')],'loggedIn':_0x19260c[_0x8cc5('0x55')],'name':_0x19260c[_0x8cc5('0x56')],'paused':_0x19260c[_0x8cc5('0x57')],'waiting':_0x19260c[_0x8cc5('0x58')]};_0x75ac3b[_0x8cc5('0x22')](_0x95db59);}}_0x4076b2({'count':_0x75ac3b[_0x8cc5('0x24')],'rows':_0x75ac3b});});},'MailQueues':function(){return new Promise(function(_0x19f593){var _0x5a91b7=[];for(var _0x485592 in _0x5c9479[_0x8cc5('0x59')]){if(_0x5c9479[_0x8cc5('0x59')][_0x8cc5('0x4e')](_0x485592)){var _0x3ef3b4=_0x5c9479[_0x8cc5('0x59')][_0x485592];var _0xbced3e={'id':_0x3ef3b4['id'],'available':_0x3ef3b4[_0x8cc5('0x54')],'loggedIn':_0x3ef3b4[_0x8cc5('0x55')],'name':_0x3ef3b4[_0x8cc5('0x56')],'paused':_0x3ef3b4[_0x8cc5('0x57')],'waiting':_0x3ef3b4[_0x8cc5('0x58')]};_0x5a91b7[_0x8cc5('0x22')](_0xbced3e);}}_0x19f593({'count':_0x5a91b7[_0x8cc5('0x24')],'rows':_0x5a91b7});});},'OpenchannelQueues':function(){return new Promise(function(_0x4e4410){var _0x1d14c0=[];for(var _0x452674 in _0x5c9479[_0x8cc5('0x5a')]){if(_0x5c9479['openchannelQueues']['hasOwnProperty'](_0x452674)){var _0x354d6e=_0x5c9479['openchannelQueues'][_0x452674];var _0x49ab3c={'id':_0x354d6e['id'],'available':_0x354d6e[_0x8cc5('0x54')],'loggedIn':_0x354d6e[_0x8cc5('0x55')],'name':_0x354d6e[_0x8cc5('0x56')],'paused':_0x354d6e[_0x8cc5('0x57')],'waiting':_0x354d6e[_0x8cc5('0x58')]};_0x1d14c0['push'](_0x49ab3c);}}_0x4e4410({'count':_0x1d14c0[_0x8cc5('0x24')],'rows':_0x1d14c0});});},'SmsQueues':function(){return new Promise(function(_0x4d8ed3){var _0x1a6446=[];for(var _0x92b678 in _0x5c9479[_0x8cc5('0x5b')]){if(_0x5c9479['smsQueues'][_0x8cc5('0x4e')](_0x92b678)){var _0x36d2d6=_0x5c9479['smsQueues'][_0x92b678];var _0xdde579={'id':_0x36d2d6['id'],'available':_0x36d2d6[_0x8cc5('0x54')],'loggedIn':_0x36d2d6[_0x8cc5('0x55')],'name':_0x36d2d6[_0x8cc5('0x56')],'paused':_0x36d2d6[_0x8cc5('0x57')],'waiting':_0x36d2d6['waiting']};_0x1a6446[_0x8cc5('0x22')](_0xdde579);}}_0x4d8ed3({'count':_0x1a6446['length'],'rows':_0x1a6446});});},'FaxQueues':function(){return new Promise(function(_0x4425a4){var _0x55fd21=[];for(var _0x51eed5 in _0x5c9479[_0x8cc5('0x5c')]){if(_0x5c9479[_0x8cc5('0x5c')][_0x8cc5('0x4e')](_0x51eed5)){var _0x483459=_0x5c9479['faxQueues'][_0x51eed5];var _0x50c3eb={'id':_0x483459['id'],'available':_0x483459[_0x8cc5('0x54')],'loggedIn':_0x483459['loggedIn'],'name':_0x483459[_0x8cc5('0x56')],'paused':_0x483459[_0x8cc5('0x57')],'waiting':_0x483459['waiting']};_0x55fd21[_0x8cc5('0x22')](_0x50c3eb);}}_0x4425a4({'count':_0x55fd21['length'],'rows':_0x55fd21});});},'WhatsappQueues':function(){return new Promise(function(_0x8a6a8e){var _0x185f3b=[];for(var _0x118dc7 in _0x5c9479[_0x8cc5('0x5d')]){if(_0x5c9479[_0x8cc5('0x5d')][_0x8cc5('0x4e')](_0x118dc7)){var _0x2596c6=_0x5c9479[_0x8cc5('0x5d')][_0x118dc7];var _0x130832={'id':_0x2596c6['id'],'available':_0x2596c6[_0x8cc5('0x54')],'loggedIn':_0x2596c6[_0x8cc5('0x55')],'name':_0x2596c6[_0x8cc5('0x56')],'paused':_0x2596c6[_0x8cc5('0x57')],'waiting':_0x2596c6[_0x8cc5('0x58')]};_0x185f3b[_0x8cc5('0x22')](_0x130832);}}_0x8a6a8e({'count':_0x185f3b[_0x8cc5('0x24')],'rows':_0x185f3b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xa8adce){var _0x47eb50=_[_0x8cc5('0x51')](_0x5c9479[_0x8cc5('0x5e')]);_0xa8adce({'count':_0x47eb50[_0x8cc5('0x24')],'rows':_0x47eb50});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1bee29){var _0x455061=_[_0x8cc5('0x51')](_0x5c9479[_0x8cc5('0x5f')]);_0x1bee29({'count':_0x455061[_0x8cc5('0x24')],'rows':_0x455061});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4eeaed){var _0x274222=_['values'](_0x5c9479['openchannelQueuesWaitingInteractions']);_0x4eeaed({'count':_0x274222[_0x8cc5('0x24')],'rows':_0x274222});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3b37e3){var _0x3bc2b=_[_0x8cc5('0x51')](_0x5c9479[_0x8cc5('0x60')]);_0x3b37e3({'count':_0x3bc2b[_0x8cc5('0x24')],'rows':_0x3bc2b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x55c3ef){var _0x26f513=_[_0x8cc5('0x51')](_0x5c9479[_0x8cc5('0x61')]);_0x55c3ef({'count':_0x26f513[_0x8cc5('0x24')],'rows':_0x26f513});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xb87d6f){var _0x5a8277=_[_0x8cc5('0x51')](_0x5c9479[_0x8cc5('0x62')]);_0xb87d6f({'count':_0x5a8277[_0x8cc5('0x24')],'rows':_0x5a8277});});}};var _0x386a3b=jayson[_0x8cc5('0x63')](_0x108e8f)[_0x8cc5('0x64')]();_0x386a3b['on'](_0x8cc5('0x41'),function(_0xefda1b){logger['error'](JSON[_0x8cc5('0x3b')](_0xefda1b));return _0xc15aa1(_0xefda1b);});_0x386a3b[_0x8cc5('0x14')](0x232c,_0x8cc5('0x65'),function(){console['log'](_0x8cc5('0x66'),0x232c);return _0x3d9145(_0x8cc5('0x67')+0x232c);});});}; \ No newline at end of file +var _0xbf4f=['../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','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','jayson/promise','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport'];(function(_0x4599a3,_0x179523){var _0x587900=function(_0x4bc3e9){while(--_0x4bc3e9){_0x4599a3['push'](_0x4599a3['shift']());}};_0x587900(++_0x179523);}(_0xbf4f,0x13f));var _0xfbf4=function(_0x37e9c1,_0x20ff2a){_0x37e9c1=_0x37e9c1-0x0;var _0x3b12bd=_0xbf4f[_0x37e9c1];return _0x3b12bd;};'use strict';var _=require(_0xfbf4('0x0'));var util=require(_0xfbf4('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xfbf4('0x2'));var BPromise=require('bluebird');var utils=require(_0xfbf4('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0xfbf4('0x4'))(_0xfbf4('0x5'));var rpc={'openchannelQueueReport':require(_0xfbf4('0x6')),'mailQueueReport':require(_0xfbf4('0x7')),'chatQueueReport':require(_0xfbf4('0x8')),'smsQueueReport':require(_0xfbf4('0x9')),'faxQueueReport':require(_0xfbf4('0xa')),'whatsappQueueReport':require(_0xfbf4('0xb'))};var RuleEngine=require(_0xfbf4('0xc'));function getId(_0x162ea1,_0x54c19b,_0x554870){return util[_0xfbf4('0xd')](_0xfbf4('0xe'),_0x162ea1,_0x54c19b||0x0,_0x554870||0x0);}function getIntervals(_0x58d602,_0x4bba38){var _0x149271=[];if(!_[_0xfbf4('0xf')](_0x4bba38[_0xfbf4('0x10')])&&!_['isNil'](_0x58d602[_0x4bba38[_0xfbf4('0x10')]])&&!_[_0xfbf4('0xf')](_0x58d602[_0x4bba38[_0xfbf4('0x10')]]['Intervals'])){_0x149271=_[_0xfbf4('0x11')](_0x58d602[_0x4bba38[_0xfbf4('0x10')]][_0xfbf4('0x12')],_0xfbf4('0x13'));}else if(!_[_0xfbf4('0xf')](_0x4bba38[_0xfbf4('0x13')])){_0x149271=[_0x4bba38[_0xfbf4('0x13')]];}return _0x149271;}exports[_0xfbf4('0x14')]=function(_0x295b87){_0x295b87['rules']={};return new BPromise(function(_0x4adc36,_0x1a327d){var _0x5a2869={'Start':function(_0x24d04a){var _0x4a3879=this;return new Promise(function(_0x18d526,_0x981761){if(_0x24d04a){try{var _0x3fae03=[];var _0x5da6e6=getId(_0x24d04a['channel'],_0x24d04a[_0xfbf4('0x15')]?_0x24d04a['message']['id']:0x0,_0x24d04a[_0xfbf4('0x16')]?_0x24d04a[_0xfbf4('0x16')]['id']:0x0);var _0x5bec49=sUtils[_0xfbf4('0x17')](_0x295b87,_0x24d04a);if(!_0x5bec49&&_0x24d04a[_0xfbf4('0x18')]&&_[_0xfbf4('0x19')](_0x24d04a[_0xfbf4('0x18')])&&_0x24d04a[_0xfbf4('0x18')]['length']){for(var _0x50a6cc=0x0;_0x50a6cc<_0x24d04a['applications'][_0xfbf4('0x1a')];_0x50a6cc+=0x1){var _0x2e2b2a=_0x24d04a[_0xfbf4('0x18')][_0x50a6cc];if(fs[_0xfbf4('0x1b')](path[_0xfbf4('0x1c')](__dirname,_0xfbf4('0x18'),_0x2e2b2a['app']+_0xfbf4('0x1d')))){var _0x3385e0=[];switch(_0x2e2b2a[_0xfbf4('0x1e')][_0xfbf4('0x1f')]()){case _0xfbf4('0x20'):var _0x4ad91b=_0x2e2b2a[_0xfbf4('0x21')][_0xfbf4('0x22')](',');if(_0x24d04a[_0xfbf4('0x23')]===_0xfbf4('0x24')){_0x3385e0[_0xfbf4('0x25')](_0x4ad91b[0x0]);_0x3385e0[_0xfbf4('0x25')](_0x4ad91b[0x1]);_0x3385e0[_0xfbf4('0x25')](_0x4ad91b[_0xfbf4('0x26')](0x2,_0x4ad91b[_0xfbf4('0x1a')])[_0xfbf4('0x1c')](','));}else{_0x3385e0[_0xfbf4('0x25')](_0x4ad91b[0x0]);_0x3385e0[_0xfbf4('0x25')](_0x4ad91b[_0xfbf4('0x26')](0x1,_0x4ad91b[_0xfbf4('0x1a')])['join'](','));}break;case _0xfbf4('0x27'):var _0x2583e7=_0x2e2b2a['appdata'][_0xfbf4('0x22')](',');_0x3385e0[_0xfbf4('0x25')](_0x2583e7[0x0]);_0x3385e0['push'](_0x2583e7[0x1]);_0x3385e0[_0xfbf4('0x25')](_0x2583e7[_0xfbf4('0x26')](0x2,_0x2583e7['length'])[_0xfbf4('0x1c')](','));break;case _0xfbf4('0x28'):var _0x12cc8e=_0x2e2b2a['appdata'][_0xfbf4('0x22')](',');_0x3385e0[_0xfbf4('0x25')](_0x12cc8e[0x0]);_0x3385e0[_0xfbf4('0x25')](_0x12cc8e[0x1]);_0x3385e0[_0xfbf4('0x25')](_0x12cc8e[0x2]);_0x3385e0[_0xfbf4('0x25')](_0x12cc8e[0x3]);_0x3385e0[_0xfbf4('0x25')](_0x12cc8e['slice'](0x4,_0x12cc8e[_0xfbf4('0x1a')])[_0xfbf4('0x1c')](','));break;case _0xfbf4('0x29'):var _0x2b2061=_0x2e2b2a[_0xfbf4('0x21')][_0xfbf4('0x22')](',');_0x3385e0['push'](_0x2b2061[0x0]);_0x3385e0[_0xfbf4('0x25')](_0x2b2061[0x1]);_0x3385e0[_0xfbf4('0x25')](_0x2b2061[0x2]);_0x3385e0[_0xfbf4('0x25')](_0x2b2061[0x3]);_0x3385e0[_0xfbf4('0x25')](_0x2b2061[_0xfbf4('0x26')](0x4,_0x2b2061[_0xfbf4('0x1a')])[_0xfbf4('0x1c')](','));break;case _0xfbf4('0x15'):_0x3385e0[_0xfbf4('0x25')](_0x2e2b2a[_0xfbf4('0x21')]);break;case _0xfbf4('0x2a'):_0x3385e0[_0xfbf4('0x25')](_0x2e2b2a[_0xfbf4('0x2b')]);_0x3385e0[_0xfbf4('0x25')](_0x2e2b2a[_0xfbf4('0x21')]);break;case'tvox':var _0x1e60fe=utils[_0xfbf4('0x2c')](_0x24d04a[_0xfbf4('0x2d')][_0xfbf4('0x2e')],_0x24d04a);var _0x5dc3a3=_0x2e2b2a[_0xfbf4('0x21')][_0xfbf4('0x22')](',');_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x0]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x1]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x2]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x3]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x4]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x5]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x6]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x7]);_0x3385e0['push'](_0x5dc3a3[0x8]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0x9]);_0x3385e0[_0xfbf4('0x25')](_0x5dc3a3[0xa]);_0x3385e0[_0xfbf4('0x25')](_0x24d04a[_0xfbf4('0x16')]['id']);_0x3385e0[_0xfbf4('0x25')](_0x24d04a['message']['id']);_0x3385e0[_0xfbf4('0x25')](_0x2e2b2a[_0xfbf4('0x2f')]);_0x3385e0['push'](_0x24d04a[_0xfbf4('0x16')][_0xfbf4('0x30')]);_0x3385e0[_0xfbf4('0x25')](_0x24d04a[_0xfbf4('0x31')]['body']);_0x3385e0[_0xfbf4('0x25')](_0x1e60fe);break;default:_0x3385e0=_[_0xfbf4('0xf')](_0x2e2b2a['appdata'])?[]:_0x2e2b2a['appdata'][_0xfbf4('0x22')](',');}var _0xd04c3={'id':util[_0xfbf4('0xd')](_0xfbf4('0x32'),_0x5da6e6,_0x2e2b2a['id'],_0x2e2b2a[_0xfbf4('0x1e')]),'condition':require(_0xfbf4('0x33'))[_0xfbf4('0x34')](_0x5da6e6,getIntervals(_0x295b87[_0xfbf4('0x35')],_0x2e2b2a),_0x295b87),'consequence':require(_0xfbf4('0x36')+_0x2e2b2a[_0xfbf4('0x1e')])[_0xfbf4('0x37')](_0x5da6e6,_0x3385e0,_0x295b87,_0x24d04a),'p':_0x2e2b2a[_0xfbf4('0x38')]||0x0};logger[_0xfbf4('0x39')]('Push\x20new\x20rule',_0xd04c3['id'],_0xfbf4('0x3a'),getIntervals(_0x295b87['intervals'],_0x2e2b2a)[_0xfbf4('0x1c')](_0xfbf4('0x3b')));_0x3fae03[_0xfbf4('0x25')](_0xd04c3);}else{logger['error'](_0xfbf4('0x3c'),path[_0xfbf4('0x1c')](__dirname,_0xfbf4('0x18'),_0x2e2b2a[_0xfbf4('0x1e')]+_0xfbf4('0x1d')));}}_0x295b87[_0xfbf4('0x3d')][_0x5da6e6]=new RuleEngine(_0x3fae03);_0x295b87[_0xfbf4('0x3d')][_0x5da6e6][_0xfbf4('0x3e')](_0x24d04a,function(_0x56c3d7){logger['info'](_0xfbf4('0x3f'),JSON[_0xfbf4('0x40')](_0x56c3d7['matchPath']));if(_0x295b87[_0xfbf4('0x3d')][_0x5da6e6]){_0x295b87[_0xfbf4('0x3d')][_0x5da6e6][_0xfbf4('0x41')](_0xfbf4('0x42'));}});return _0x18d526({'code':0xc8,'message':_0x24d04a});}else{if(_0x5bec49){logger[_0xfbf4('0x39')](util['format'](_0xfbf4('0x43'),_0x5da6e6));}else{logger['info'](_0xfbf4('0x44'));}return _0x18d526({'code':0xc8,'message':_0x24d04a});}}catch(_0x4df23d){logger['error'](_0x4df23d[_0xfbf4('0x45')]);return _0x981761(_0x4a3879[_0xfbf4('0x46')](0x1f4,_0x4df23d));}}return _0x981761(_0xfbf4('0x47'));});},'AcceptMessage':function(_0x7248fa){var _0x1203a7=this;return new Promise(function(_0x1b6032,_0x122d91){if(_0x7248fa[_0xfbf4('0x48')]&&_0x7248fa[_0xfbf4('0x48')]['id']){if(_0x295b87[_0xfbf4('0x49')][_0x7248fa[_0xfbf4('0x48')]['id']]){_0x295b87['agents'][_0x7248fa[_0xfbf4('0x48')]['id']][_0xfbf4('0x4a')]=![];_0x295b87[_0xfbf4('0x49')][_0x7248fa['agent']['id']][_0xfbf4('0x4b')]=undefined;}}if(_0x7248fa[_0xfbf4('0x15')]&&_0x7248fa[_0xfbf4('0x15')]['id']){try{var _0x279157=getId(_0x7248fa[_0xfbf4('0x23')],_0x7248fa[_0xfbf4('0x15')]?_0x7248fa['message']['id']:0x0,_0x7248fa[_0xfbf4('0x16')]?_0x7248fa[_0xfbf4('0x16')]['id']:0x0);if(_0x295b87[_0xfbf4('0x3d')][_0x279157]){_0x295b87[_0xfbf4('0x3d')][_0x279157]['emit']('end');if(rpc[_0x7248fa[_0xfbf4('0x23')]+_0xfbf4('0x4c')]){rpc[_0x7248fa[_0xfbf4('0x23')]+_0xfbf4('0x4c')][_0xfbf4('0x4d')](_0x279157,{'UserId':_0x7248fa[_0xfbf4('0x15')]['UserId']})[_0xfbf4('0x4e')](function(){logger['error'](_0xfbf4('0x4f'));});}}return _0x1b6032({'code':0xc8,'message':_0x7248fa});}catch(_0x1b05f2){logger['error'](_0x1b05f2[_0xfbf4('0x45')]);return _0x122d91(_0x1203a7['error'](0x1f4,_0x1b05f2));}}logger['error'](_0xfbf4('0x50'));return _0x122d91(_0x1203a7[_0xfbf4('0x46')](0x1f4,_0xfbf4('0x50')));});},'RejectMessage':function(_0x255ad0){var _0x56cffc=this;return new Promise(function(_0x216883,_0x3dadf7){if(_0x255ad0['agent']&&_0x255ad0[_0xfbf4('0x48')]['id']){try{if(_0x295b87[_0xfbf4('0x49')][_0x255ad0[_0xfbf4('0x48')]['id']]){_0x295b87[_0xfbf4('0x49')][_0x255ad0[_0xfbf4('0x48')]['id']][_0xfbf4('0x4a')]=![];_0x295b87[_0xfbf4('0x49')][_0x255ad0[_0xfbf4('0x48')]['id']][_0xfbf4('0x4b')]=undefined;}return _0x216883({'code':0xc8,'message':_0x255ad0});}catch(_0x4f08d2){logger[_0xfbf4('0x46')](_0x4f08d2[_0xfbf4('0x45')]);return _0x3dadf7(_0x56cffc[_0xfbf4('0x46')](0x1f4,_0x4f08d2));}}logger['error'](_0xfbf4('0x50'));return _0x3dadf7(_0x56cffc[_0xfbf4('0x46')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x214e65){var _0x540e2a=this;return new Promise(function(_0x4e2b69,_0x160cb8){if(_0x214e65[_0xfbf4('0x23')]&&_0x214e65[_0xfbf4('0x16')]&&_0x214e65[_0xfbf4('0x16')]['id']){try{var _0x17f95f=getId(_0x214e65[_0xfbf4('0x23')],_0x214e65[_0xfbf4('0x15')]?_0x214e65[_0xfbf4('0x15')]['id']:0x0,_0x214e65['interaction']?_0x214e65[_0xfbf4('0x16')]['id']:0x0);if(_0x295b87[_0xfbf4('0x3d')][_0x17f95f]){_0x295b87['rules'][_0x17f95f][_0xfbf4('0x41')](_0xfbf4('0x51'));}return _0x4e2b69({'code':0xc8,'message':_0x214e65});}catch(_0x4012b2){logger[_0xfbf4('0x46')](_0x4012b2[_0xfbf4('0x45')]);return _0x160cb8(_0x540e2a[_0xfbf4('0x46')](0x1f4,_0x4012b2));}}logger[_0xfbf4('0x46')](_0xfbf4('0x50'));return _0x160cb8(_0x540e2a[_0xfbf4('0x46')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x138f42){var _0x3e2b58=this;return new Promise(function(_0x480e28,_0x334b16){if(_0x295b87['agents'][_0xfbf4('0x52')](_0x138f42['id'])){for(var _0x39fe41 in _0x138f42['capacity']){if(_0x138f42[_0xfbf4('0x53')][_0xfbf4('0x52')](_0x39fe41)){if(_0x295b87[_0xfbf4('0x49')][_0x138f42['id']][_0xfbf4('0x52')](_0x39fe41+'CurrentCapacity')){_0x295b87[_0xfbf4('0x49')][_0x138f42['id']][_0x39fe41+'CurrentCapacity']=parseInt(_0x138f42['capacity'][_0x39fe41],0xa);}}}_0x295b87[_0xfbf4('0x49')][_0x138f42['id']]['updateRealtime']();return _0x480e28({'code':0xc8,'message':_0x295b87[_0xfbf4('0x49')][_0x138f42['id']]});}else{return _0x334b16(_0x3e2b58[_0xfbf4('0x46')](0x1f4,_0xfbf4('0x54')));}});},'Agents':function(_0x460edb){return new Promise(function(_0x1f98d0){var _0xd4462d=_[_0xfbf4('0x55')](_0x295b87[_0xfbf4('0x49')]);if(_0x460edb&&_0x460edb['id']){var _0x4899c6=_[_0xfbf4('0x56')](_0xd4462d,function(_0x4732aa){return _0x4732aa['id']===_0x460edb['id'];});_0x1f98d0(_0x4899c6);}else{_0x1f98d0({'count':_0xd4462d[_0xfbf4('0x1a')],'rows':_0xd4462d});}});},'ChatQueues':function(){return new Promise(function(_0x484ca9){var _0x53782e=[];for(var _0x2a6d5c in _0x295b87[_0xfbf4('0x57')]){if(_0x295b87[_0xfbf4('0x57')][_0xfbf4('0x52')](_0x2a6d5c)){var _0x24ebc8=_0x295b87[_0xfbf4('0x57')][_0x2a6d5c];var _0x10cc28={'id':_0x24ebc8['id'],'available':_0x24ebc8[_0xfbf4('0x58')],'loggedIn':_0x24ebc8[_0xfbf4('0x59')],'name':_0x24ebc8[_0xfbf4('0x5a')],'paused':_0x24ebc8[_0xfbf4('0x5b')],'waiting':_0x24ebc8[_0xfbf4('0x5c')]};_0x53782e['push'](_0x10cc28);}}_0x484ca9({'count':_0x53782e['length'],'rows':_0x53782e});});},'MailQueues':function(){return new Promise(function(_0x3b6555){var _0x1032e9=[];for(var _0x37fc23 in _0x295b87[_0xfbf4('0x5d')]){if(_0x295b87[_0xfbf4('0x5d')][_0xfbf4('0x52')](_0x37fc23)){var _0x19bffa=_0x295b87['mailQueues'][_0x37fc23];var _0x4628b2={'id':_0x19bffa['id'],'available':_0x19bffa[_0xfbf4('0x58')],'loggedIn':_0x19bffa[_0xfbf4('0x59')],'name':_0x19bffa['name'],'paused':_0x19bffa[_0xfbf4('0x5b')],'waiting':_0x19bffa[_0xfbf4('0x5c')]};_0x1032e9[_0xfbf4('0x25')](_0x4628b2);}}_0x3b6555({'count':_0x1032e9[_0xfbf4('0x1a')],'rows':_0x1032e9});});},'OpenchannelQueues':function(){return new Promise(function(_0x10bc30){var _0x372fb6=[];for(var _0x174e9f in _0x295b87[_0xfbf4('0x5e')]){if(_0x295b87[_0xfbf4('0x5e')][_0xfbf4('0x52')](_0x174e9f)){var _0x15d3b6=_0x295b87[_0xfbf4('0x5e')][_0x174e9f];var _0x495ac2={'id':_0x15d3b6['id'],'available':_0x15d3b6[_0xfbf4('0x58')],'loggedIn':_0x15d3b6[_0xfbf4('0x59')],'name':_0x15d3b6[_0xfbf4('0x5a')],'paused':_0x15d3b6[_0xfbf4('0x5b')],'waiting':_0x15d3b6[_0xfbf4('0x5c')]};_0x372fb6[_0xfbf4('0x25')](_0x495ac2);}}_0x10bc30({'count':_0x372fb6[_0xfbf4('0x1a')],'rows':_0x372fb6});});},'SmsQueues':function(){return new Promise(function(_0x540c95){var _0x352802=[];for(var _0x1c7bfe in _0x295b87[_0xfbf4('0x5f')]){if(_0x295b87[_0xfbf4('0x5f')]['hasOwnProperty'](_0x1c7bfe)){var _0x533411=_0x295b87[_0xfbf4('0x5f')][_0x1c7bfe];var _0x25cbdf={'id':_0x533411['id'],'available':_0x533411[_0xfbf4('0x58')],'loggedIn':_0x533411[_0xfbf4('0x59')],'name':_0x533411[_0xfbf4('0x5a')],'paused':_0x533411['paused'],'waiting':_0x533411[_0xfbf4('0x5c')]};_0x352802[_0xfbf4('0x25')](_0x25cbdf);}}_0x540c95({'count':_0x352802['length'],'rows':_0x352802});});},'FaxQueues':function(){return new Promise(function(_0x2ee1f3){var _0x354524=[];for(var _0xe73622 in _0x295b87[_0xfbf4('0x60')]){if(_0x295b87[_0xfbf4('0x60')]['hasOwnProperty'](_0xe73622)){var _0x228aae=_0x295b87['faxQueues'][_0xe73622];var _0xb69642={'id':_0x228aae['id'],'available':_0x228aae['available'],'loggedIn':_0x228aae['loggedIn'],'name':_0x228aae[_0xfbf4('0x5a')],'paused':_0x228aae[_0xfbf4('0x5b')],'waiting':_0x228aae['waiting']};_0x354524[_0xfbf4('0x25')](_0xb69642);}}_0x2ee1f3({'count':_0x354524[_0xfbf4('0x1a')],'rows':_0x354524});});},'WhatsappQueues':function(){return new Promise(function(_0x507a44){var _0x24a043=[];for(var _0x3f19d8 in _0x295b87['whatsappQueues']){if(_0x295b87[_0xfbf4('0x61')][_0xfbf4('0x52')](_0x3f19d8)){var _0x485ef8=_0x295b87[_0xfbf4('0x61')][_0x3f19d8];var _0x520de5={'id':_0x485ef8['id'],'available':_0x485ef8['available'],'loggedIn':_0x485ef8['loggedIn'],'name':_0x485ef8['name'],'paused':_0x485ef8[_0xfbf4('0x5b')],'waiting':_0x485ef8['waiting']};_0x24a043['push'](_0x520de5);}}_0x507a44({'count':_0x24a043['length'],'rows':_0x24a043});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x108fee){var _0x4a2874=_[_0xfbf4('0x55')](_0x295b87[_0xfbf4('0x62')]);_0x108fee({'count':_0x4a2874[_0xfbf4('0x1a')],'rows':_0x4a2874});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x432b3f){var _0x5c0134=_['values'](_0x295b87[_0xfbf4('0x63')]);_0x432b3f({'count':_0x5c0134[_0xfbf4('0x1a')],'rows':_0x5c0134});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4f8396){var _0x51560c=_[_0xfbf4('0x55')](_0x295b87[_0xfbf4('0x64')]);_0x4f8396({'count':_0x51560c[_0xfbf4('0x1a')],'rows':_0x51560c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x13c251){var _0x4ad5cc=_[_0xfbf4('0x55')](_0x295b87[_0xfbf4('0x65')]);_0x13c251({'count':_0x4ad5cc['length'],'rows':_0x4ad5cc});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x6b8af0){var _0x14026c=_[_0xfbf4('0x55')](_0x295b87[_0xfbf4('0x66')]);_0x6b8af0({'count':_0x14026c[_0xfbf4('0x1a')],'rows':_0x14026c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x331f85){var _0x96cea7=_[_0xfbf4('0x55')](_0x295b87[_0xfbf4('0x67')]);_0x331f85({'count':_0x96cea7[_0xfbf4('0x1a')],'rows':_0x96cea7});});}};var _0x3f1400=jayson[_0xfbf4('0x68')](_0x5a2869)[_0xfbf4('0x69')]();_0x3f1400['on']('error',function(_0x27658){logger[_0xfbf4('0x46')](JSON['stringify'](_0x27658));return _0x1a327d(_0x27658);});_0x3f1400[_0xfbf4('0x14')](0x232c,_0xfbf4('0x6a'),function(){console[_0xfbf4('0x6b')](_0xfbf4('0x6c'),0x232c);return _0x4adc36(_0xfbf4('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 8184e54..54b06bb 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 _0x321a=['[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','catch','stack','stop','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','rules','info','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s'];(function(_0x28e178,_0x2f91a3){var _0x1abf49=function(_0xc4a41c){while(--_0xc4a41c){_0x28e178['push'](_0x28e178['shift']());}};_0x1abf49(++_0x2f91a3);}(_0x321a,0xc4));var _0xa321=function(_0x20da0f,_0x322b66){_0x20da0f=_0x20da0f-0x0;var _0x1949a2=_0x321a[_0x20da0f];return _0x1949a2;};'use strict';var util=require('util');var BPromise=require(_0xa321('0x0'));var jayson=require(_0xa321('0x1'));var _=require(_0xa321('0x2'));var logger=require('../../../config/logger')(_0xa321('0x3'));var client=jayson[_0xa321('0x4')][_0xa321('0x5')]({'port':0x232a});function request(_0x478019,_0x5a32f0){return new BPromise(function(_0x289ecb,_0xc1c5d){return client[_0xa321('0x6')](_0x478019,_0x5a32f0)[_0xa321('0x7')](function(_0x3182f7){if(_0x3182f7[_0xa321('0x8')]){return _0xc1c5d(_0x3182f7[_0xa321('0x8')][_0xa321('0x9')]);}else{return _0x289ecb(_0x3182f7['result']);}})['catch'](function(_0x4f9733){return _0xc1c5d(_0x4f9733);});});}exports['condition']=function(_0x30f66d,_0x2f3fbc,_0x24c175){return function(_0x362d45){if(_0x24c175['rules']&&!_0x24c175[_0xa321('0xa')][_0x30f66d]){logger[_0xa321('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x30f66d);return _0x362d45['stop']();}var _0xfa09=[];for(var _0xcb9573=0x0;_0xcb9573<_0x2f3fbc[_0xa321('0xc')];_0xcb9573+=0x1){_0xfa09[_0xa321('0xd')](request(_0xa321('0xe'),{'command':util[_0xa321('0xf')](_0xa321('0x10'),_0x2f3fbc[_0xcb9573])})[_0xa321('0x7')](function(_0x3d6a1b){return _0x3d6a1b&&_0x3d6a1b['message']&&_0x3d6a1b[_0xa321('0x9')][_0xa321('0x11')](_0xa321('0x12'))>=0x0?!![]:![];})['catch'](function(_0x23218c){logger[_0xa321('0x8')](_0xa321('0x13'),_0x30f66d,_0x2f3fbc[_0xcb9573]);}));}BPromise['all'](_0xfa09)[_0xa321('0x7')](function(_0x32a9ca){var _0x1835da=_['some'](_0x32a9ca);logger[_0xa321('0xb')](_0xa321('0x14'),_0x30f66d,_0x2f3fbc[_0xa321('0x15')](_0xa321('0x16')),_0x1835da);_0x362d45[_0xa321('0x17')](_0x1835da);})[_0xa321('0x18')](function(_0x446aef){console['log'](_0x446aef);logger[_0xa321('0x8')](_0xa321('0x14'),_0x30f66d,_0x2f3fbc[_0xa321('0x15')]('\x20|\x20'),_0x446aef[_0xa321('0x19')]);_0x362d45[_0xa321('0x1a')]();});};}; \ No newline at end of file +var _0xe035=['lodash','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','jayson/promise'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe035,0x1af));var _0x5e03=function(_0x2812ca,_0x13a24f){_0x2812ca=_0x2812ca-0x0;var _0x5b3180=_0xe035[_0x2812ca];return _0x5b3180;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x5e03('0x0'));var _=require(_0x5e03('0x1'));var logger=require('../../../config/logger')('routing');var client=jayson[_0x5e03('0x2')][_0x5e03('0x3')]({'port':0x232a});function request(_0x3046a9,_0x48fd1c){return new BPromise(function(_0x5d19c6,_0x28a2ee){return client[_0x5e03('0x4')](_0x3046a9,_0x48fd1c)[_0x5e03('0x5')](function(_0x5aae3c){if(_0x5aae3c[_0x5e03('0x6')]){return _0x28a2ee(_0x5aae3c['error'][_0x5e03('0x7')]);}else{return _0x5d19c6(_0x5aae3c[_0x5e03('0x8')]);}})[_0x5e03('0x9')](function(_0x2aa79a){return _0x28a2ee(_0x2aa79a);});});}exports[_0x5e03('0xa')]=function(_0x32ad86,_0x32e7c5,_0x1b38b2){return function(_0x3449fa){if(_0x1b38b2['rules']&&!_0x1b38b2[_0x5e03('0xb')][_0x32ad86]){logger[_0x5e03('0xc')](_0x5e03('0xd'),_0x32ad86);return _0x3449fa['stop']();}var _0x1a278e=[];for(var _0x3851c3=0x0;_0x3851c3<_0x32e7c5[_0x5e03('0xe')];_0x3851c3+=0x1){_0x1a278e[_0x5e03('0xf')](request('Command',{'command':util[_0x5e03('0x10')]('iftime\x20%s',_0x32e7c5[_0x3851c3])})['then'](function(_0x6eba41){return _0x6eba41&&_0x6eba41[_0x5e03('0x7')]&&_0x6eba41[_0x5e03('0x7')]['indexOf']('true')>=0x0?!![]:![];})['catch'](function(_0x5cd725){logger['error'](_0x5e03('0x11'),_0x32ad86,_0x32e7c5[_0x3851c3]);}));}BPromise[_0x5e03('0x12')](_0x1a278e)['then'](function(_0x295337){var _0x463e95=_[_0x5e03('0x13')](_0x295337);logger[_0x5e03('0xc')](_0x5e03('0x14'),_0x32ad86,_0x32e7c5[_0x5e03('0x15')](_0x5e03('0x16')),_0x463e95);_0x3449fa[_0x5e03('0x17')](_0x463e95);})['catch'](function(_0x87ff6){console[_0x5e03('0x18')](_0x87ff6);logger[_0x5e03('0x6')](_0x5e03('0x14'),_0x32ad86,_0x32e7c5['join']('\x20|\x20'),_0x87ff6[_0x5e03('0x19')]);_0x3449fa[_0x5e03('0x1a')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index de864b6..f63e321 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 _0x153f=['type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','info','format','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x153f,0x15b));var _0xf153=function(_0x134f66,_0x12ccd2){_0x134f66=_0x134f66-0x0;var _0x470de3=_0x153f[_0x134f66];return _0x470de3;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var utils=require(_0xf153('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44cea3,_0x2afb9a){utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x44cea3[_0xf153('0x5')],_0x44cea3['channel'],_0x44cea3[_0xf153('0x6')],_0x44cea3[_0xf153('0x7')],_0x44cea3[_0xf153('0x8')],_0x44cea3[_0xf153('0x9')],_0x44cea3[_0xf153('0xa')],_0x44cea3['lastevent']));if(_0x44cea3[_0xf153('0x6')]){utils[_0xf153('0xb')](_0x44cea3[_0xf153('0x6')])[_0xf153('0xc')](function(_0x253fd3){if(_0x253fd3){_0x44cea3[_0xf153('0xd')]=_0x253fd3[_0xf153('0xd')];_0x44cea3[_0xf153('0xe')]=_0x44cea3[_0xf153('0xf')]?_0x253fd3[_0xf153('0x10')]:![];_0x44cea3['acwtime']=_0x44cea3[_0xf153('0xe')]?_0x253fd3[_0xf153('0x11')]:0x0;}utils[_0xf153('0x12')]('CreateVoiceAgentReport',_0x44cea3);});}else{utils[_0xf153('0x12')](_0xf153('0x13'),_0x44cea3);}if(_0x2afb9a){delete transfers[_0x44cea3[_0xf153('0x5')]];}else{delete agents[_0x44cea3[_0xf153('0x14')]];}}exports[_0xf153('0x15')]=function(_0x107d31){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31['uniqueid']),_0x107d31);agents[_0x107d31[_0xf153('0x14')]]=_0x107d31;agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x18')]=utils[_0xf153('0x19')]();agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x1b');agents[_0x107d31[_0xf153('0x14')]]['connectedlinenum']=null;agents[_0x107d31[_0xf153('0x14')]]['connectedlinename']=null;utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x1c'),_0x107d31[_0xf153('0x5')],agents[_0x107d31['destuniqueid']][_0xf153('0x7')],_0x107d31[_0xf153('0x14')]));}catch(_0x41946a){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31[_0xf153('0x5')]),_0x41946a);}};exports[_0xf153('0x1e')]=function(_0x3735a7){try{if(!_[_0xf153('0x1f')](agents[_0x3735a7[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x3735a7);utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x21'),_0x3735a7[_0xf153('0x5')],agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x7')],_0x3735a7[_0xf153('0x14')]));agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1e')]=!![];agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x22')]=utils[_0xf153('0x19')]();agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x23');agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x24')]=_0xf153('0x23');agents[_0x3735a7['destuniqueid']][_0xf153('0x25')]=_0x3735a7[_0xf153('0x26')]?parseInt(_0x3735a7['ringtime'])/0x3e8:0x0;agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x27')]=0x0;unanswered['push'](_0x3735a7[_0xf153('0x14')]);}}catch(_0x10295e){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x10295e);}};exports[_0xf153('0x28')]=function(_0x3b5f4f){try{_[_0xf153('0x29')](agents,function(_0x8e31bf,_0x13b541){if(_0x8e31bf[_0xf153('0x5')]==_0x3b5f4f['uniqueid']&&!_[_0xf153('0x2a')](unanswered,_0x8e31bf[_0xf153('0x14')])){utils[_0xf153('0x16')](util[_0xf153('0x4')]('[%s][agents][queuecallerabandon]',_0x3b5f4f['uniqueid']),_0x3b5f4f);utils[_0xf153('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3b5f4f[_0xf153('0x5')],_0x8e31bf['membername'],_0x8e31bf[_0xf153('0x14')]));_0x8e31bf['agentringnoanswer']=!![];_0x8e31bf[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x8e31bf['lastevent']=_0xf153('0x2b');_0x8e31bf[_0xf153('0x24')]=_0xf153('0x2b');_0x8e31bf[_0xf153('0x25')]=_0x3b5f4f[_0xf153('0x25')];_0x8e31bf[_0xf153('0x27')]=0x0;writeDB(_0x8e31bf);}});}catch(_0x4ab69c){utils[_0xf153('0x1d')](util['format'](_0xf153('0x2c'),_0x3b5f4f[_0xf153('0x5')]),_0x4ab69c);}};exports[_0xf153('0x2d')]=function(_0x1820c3){try{if(agents[_0x1820c3[_0xf153('0x14')]]){utils[_0xf153('0x16')](util['format'](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1820c3);utils[_0xf153('0x3')](util['format'](_0xf153('0x2f'),_0x1820c3[_0xf153('0x5')],agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x7')],_0x1820c3[_0xf153('0x14')]));agents[_0x1820c3[_0xf153('0x14')]]['agentconnectAt']=utils[_0xf153('0x19')]();agents[_0x1820c3[_0xf153('0x14')]]['connectedlinenum']=_0x1820c3[_0xf153('0xa')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x30')]=_0x1820c3[_0xf153('0x30')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];agents[_0x1820c3['destuniqueid']][_0xf153('0x1a')]=_0xf153('0x31');_[_0xf153('0x29')](agents,function(_0x352e7c,_0x25657a){if(_0x352e7c[_0xf153('0x14')]!=_0x1820c3['destuniqueid']&&_0x352e7c['uniqueid']==_0x1820c3[_0xf153('0x5')]){_0x352e7c['talktime']=0x0;_0x352e7c[_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];_0x352e7c[_0xf153('0x1e')]=!![];_0x352e7c[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x352e7c[_0xf153('0x1a')]='answered_elsewhere';_0x352e7c['reason']=_0xf153('0x32');_0x352e7c[_0xf153('0x33')]=_0x1820c3['destuniqueid'];_0x352e7c[_0xf153('0x34')]=_0x1820c3[_0xf153('0x7')];writeDB(_0x352e7c);}});}}catch(_0x1edf65){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1edf65);}};exports[_0xf153('0xf')]=function(_0x1b453f){try{if(!_[_0xf153('0x1f')](agents[_0x1b453f[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x1b453f);utils[_0xf153('0x3')](util['format'](_0xf153('0x36'),_0x1b453f[_0xf153('0x5')],agents[_0x1b453f['destuniqueid']][_0xf153('0x7')],_0x1b453f['destuniqueid']));agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0xf')]=!![];agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt']=utils[_0xf153('0x19')]();agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt'],agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x38')]);agents[_0x1b453f['destuniqueid']][_0xf153('0x24')]=_0x1b453f[_0xf153('0x24')];agents[_0x1b453f[_0xf153('0x14')]]['lastevent']=_0xf153('0x39');writeDB(agents[_0x1b453f[_0xf153('0x14')]]);}}catch(_0x82dc34){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x82dc34);}};exports[_0xf153('0x3a')]=function(_0x3b91ed){try{if(!_['isNil'](agents[_0x3b91ed[_0xf153('0x3b')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x3b91ed[_0xf153('0x5')]),_0x3b91ed);utils[_0xf153('0x3')](util['format'](_0xf153('0x3c'),_0x3b91ed[_0xf153('0x5')],agents[_0x3b91ed['transfereruniqueid']][_0xf153('0x7')],agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')]));agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3d')]=!![];agents[_0x3b91ed[_0xf153('0x3b')]]['transfertype']=_0xf153('0x3e');agents[_0x3b91ed[_0xf153('0x3b')]]['transferexten']=_0x3b91ed['extension'];agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3f')]=agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')];}}catch(_0x419e7e){utils[_0xf153('0x1d')](util['format'](_0xf153('0x40'),_0x3b91ed['uniqueid']),_0x419e7e);}};exports[_0xf153('0x41')]=function(_0x365209){try{utils[_0xf153('0x16')](util['format'](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x365209);if(_0x365209[_0xf153('0x43')]==_0x365209[_0xf153('0x44')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x45')]])){utils[_0xf153('0x3')](util['format'](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209[_0xf153('0x45')]]['membername']));agents[_0x365209[_0xf153('0x45')]][_0xf153('0x3d')]=!![];agents[_0x365209[_0xf153('0x45')]][_0xf153('0x47')]=_0xf153('0x48');agents[_0x365209[_0xf153('0x45')]][_0xf153('0x49')]=_0x365209[_0xf153('0x4a')];agents[_0x365209['secondtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x43')];}if(_0x365209['transfereeuniqueid']&&agents[_0x365209[_0xf153('0x4b')]]){agents[_0x365209[_0xf153('0x4b')]][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x4b')]]=_[_0xf153('0x4d')](agents[_0x365209[_0xf153('0x4b')]]);transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x9')];transfers[_0x365209[_0xf153('0x4b')]]['calleridname']=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x4e')];transfers[_0x365209['transfereeuniqueid']][_0xf153('0x18')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x38')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x25')]=0x0;transfers[_0x365209['transfereeuniqueid']][_0xf153('0x4c')]=0x2;}}else if(_0x365209[_0xf153('0x45')]==_0x365209[_0xf153('0x4f')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x43')]])){utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209['origtransfereruniqueid']][_0xf153('0x7')]));agents[_0x365209[_0xf153('0x43')]]['transfer']=!![];agents[_0x365209[_0xf153('0x43')]]['transfertype']=_0xf153('0x48');agents[_0x365209[_0xf153('0x43')]]['transferexten']=_0x365209[_0xf153('0x50')];agents[_0x365209['origtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x45')];}if(_0x365209[_0xf153('0x51')]&&agents[_0x365209[_0xf153('0x51')]]){agents[_0x365209['transfertargetuniqueid']][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x51')]]=_['clone'](agents[_0x365209[_0xf153('0x51')]]);transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x43')]][_0xf153('0x9')];transfers[_0x365209['transfertargetuniqueid']][_0xf153('0x4e')]=agents[_0x365209['origtransfereruniqueid']][_0xf153('0x4e')];transfers[_0x365209[_0xf153('0x51')]]['agentcalledAt']=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x38')]=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x25')]=0x0;transfers[_0x365209[_0xf153('0x51')]]['agententerreason']=0x2;}}}catch(_0x671efe){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x671efe);}};exports[_0xf153('0x52')]=function(_0x37443f){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x53'),_0x37443f[_0xf153('0x5')]),_0x37443f);if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]===_0xf153('0x23')){if(_0x37443f[_0xf153('0x54')]==='21'){agents[_0x37443f['uniqueid']][_0xf153('0x24')]='rejected';agents[_0x37443f['uniqueid']][_0xf153('0x1a')]='rejected';}utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(agents[_0x37443f['uniqueid']]);var _0x59e22d=unanswered[_0xf153('0x56')](_0x37443f[_0xf153('0x5')]);if(_0x59e22d>-0x1){unanswered[_0xf153('0x57')](_0x59e22d,0x1);}}if(transfers[_0x37443f['uniqueid']]){transfers[_0x37443f[_0xf153('0x5')]]['agentcomplete']=!![];transfers[_0x37443f['uniqueid']][_0xf153('0x58')]=utils[_0xf153('0x19')]();transfers[_0x37443f[_0xf153('0x5')]]['talktime']=utils[_0xf153('0x37')](transfers[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x38')]);transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]=_0xf153('0x59');transfers[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],transfers[_0x37443f[_0xf153('0x5')]]['membername'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(transfers[_0x37443f[_0xf153('0x5')]],!![]);}if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f['uniqueid']][_0xf153('0x38')]){agents[_0x37443f[_0xf153('0x5')]][_0xf153('0xf')]=!![];agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x58')]=utils[_0xf153('0x19')]();agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],agents[_0x37443f['uniqueid']]['agentconnectAt']);agents[_0x37443f['uniqueid']][_0xf153('0x24')]=agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x3d')]?_0xf153('0x3d'):_0xf153('0x59');agents[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f['uniqueid']][_0xf153('0x1a')]));writeDB(agents[_0x37443f[_0xf153('0x5')]]);}}catch(_0x2651ff){utils['error'](util['format']('[%s][agents][hangup]',_0x37443f[_0xf153('0x5')]),_0x2651ff);}}; \ No newline at end of file +var _0x2bc6=['lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum'];(function(_0x3c413c,_0x176e2f){var _0x11af80=function(_0x5b78e1){while(--_0x5b78e1){_0x3c413c['push'](_0x3c413c['shift']());}};_0x11af80(++_0x176e2f);}(_0x2bc6,0x163));var _0x62bc=function(_0x1b65eb,_0x3f511f){_0x1b65eb=_0x1b65eb-0x0;var _0x33ff7b=_0x2bc6[_0x1b65eb];return _0x33ff7b;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var utils=require(_0x62bc('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x56939b,_0x4b4e73){utils['info'](util['format'](_0x62bc('0x3'),_0x56939b['uniqueid'],_0x56939b[_0x62bc('0x4')],_0x56939b[_0x62bc('0x5')],_0x56939b['membername'],_0x56939b[_0x62bc('0x6')],_0x56939b[_0x62bc('0x7')],_0x56939b[_0x62bc('0x8')],_0x56939b[_0x62bc('0x9')]));if(_0x56939b[_0x62bc('0x5')]){utils[_0x62bc('0xa')](_0x56939b['queue'])[_0x62bc('0xb')](function(_0x762c71){if(_0x762c71){_0x56939b[_0x62bc('0xc')]=_0x762c71[_0x62bc('0xc')];_0x56939b['agentacw']=_0x56939b[_0x62bc('0xd')]?_0x762c71[_0x62bc('0xe')]:![];_0x56939b[_0x62bc('0xf')]=_0x56939b['agentacw']?_0x762c71[_0x62bc('0x10')]:0x0;}utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);});}else{utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);}if(_0x4b4e73){delete transfers[_0x56939b[_0x62bc('0x13')]];}else{delete agents[_0x56939b[_0x62bc('0x14')]];}}exports['agentcalled']=function(_0x2a96ae){try{utils[_0x62bc('0x15')](util['format'](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x2a96ae);agents[_0x2a96ae[_0x62bc('0x14')]]=_0x2a96ae;agents[_0x2a96ae['destuniqueid']][_0x62bc('0x17')]=utils[_0x62bc('0x18')]();agents[_0x2a96ae['destuniqueid']]['lastevent']=_0x62bc('0x19');agents[_0x2a96ae[_0x62bc('0x14')]]['connectedlinenum']=null;agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1a')]=null;utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1d'),_0x2a96ae[_0x62bc('0x13')],agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x2a96ae[_0x62bc('0x14')]));}catch(_0x5ed51c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x5ed51c);}};exports['agentringnoanswer']=function(_0x380621){try{if(!_['isNil'](agents[_0x380621[_0x62bc('0x14')]])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')]('[%s][agents][agentringnoanswer]',_0x380621[_0x62bc('0x13')]),_0x380621);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1f'),_0x380621[_0x62bc('0x13')],agents[_0x380621[_0x62bc('0x14')]]['membername'],_0x380621[_0x62bc('0x14')]));agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x20')]=!![];agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x21')]=utils['now']();agents[_0x380621['destuniqueid']][_0x62bc('0x9')]='timeout';agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x22')]=_0x62bc('0x23');agents[_0x380621['destuniqueid']][_0x62bc('0x24')]=_0x380621[_0x62bc('0x25')]?parseInt(_0x380621[_0x62bc('0x25')])/0x3e8:0x0;agents[_0x380621['destuniqueid']]['talktime']=0x0;unanswered[_0x62bc('0x26')](_0x380621[_0x62bc('0x14')]);}}catch(_0x23817c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x27'),_0x380621[_0x62bc('0x13')]),_0x23817c);}};exports[_0x62bc('0x28')]=function(_0x5a9302){try{_[_0x62bc('0x29')](agents,function(_0x5e4491,_0x26701b){if(_0x5e4491[_0x62bc('0x13')]==_0x5a9302[_0x62bc('0x13')]&&!_[_0x62bc('0x2a')](unanswered,_0x5e4491[_0x62bc('0x14')])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x2b'),_0x5a9302[_0x62bc('0x13')]),_0x5a9302);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x2c'),_0x5a9302[_0x62bc('0x13')],_0x5e4491[_0x62bc('0x1e')],_0x5e4491[_0x62bc('0x14')]));_0x5e4491[_0x62bc('0x20')]=!![];_0x5e4491[_0x62bc('0x21')]=utils['now']();_0x5e4491[_0x62bc('0x9')]='abandoned';_0x5e4491['reason']=_0x62bc('0x2d');_0x5e4491['holdtime']=_0x5a9302['holdtime'];_0x5e4491['talktime']=0x0;writeDB(_0x5e4491);}});}catch(_0x3f22c1){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][queuecallerabandon]',_0x5a9302['uniqueid']),_0x3f22c1);}};exports['agentconnect']=function(_0x3c938d){try{if(agents[_0x3c938d[_0x62bc('0x14')]]){utils['debug'](util['format'](_0x62bc('0x2f'),_0x3c938d[_0x62bc('0x13')]),_0x3c938d);utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x30'),_0x3c938d[_0x62bc('0x13')],agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x3c938d['destuniqueid']));agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x31')]=utils['now']();agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x8')]=_0x3c938d[_0x62bc('0x8')];agents[_0x3c938d[_0x62bc('0x14')]]['connectedlinename']=_0x3c938d[_0x62bc('0x1a')];agents[_0x3c938d['destuniqueid']][_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x9')]='connect';_[_0x62bc('0x29')](agents,function(_0x5c806b,_0x392550){if(_0x5c806b[_0x62bc('0x14')]!=_0x3c938d[_0x62bc('0x14')]&&_0x5c806b[_0x62bc('0x13')]==_0x3c938d[_0x62bc('0x13')]){_0x5c806b[_0x62bc('0x32')]=0x0;_0x5c806b[_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];_0x5c806b[_0x62bc('0x20')]=!![];_0x5c806b['agentringnoanswerAt']=utils['now']();_0x5c806b[_0x62bc('0x9')]=_0x62bc('0x33');_0x5c806b['reason']=_0x62bc('0x33');_0x5c806b[_0x62bc('0x34')]=_0x3c938d[_0x62bc('0x14')];_0x5c806b[_0x62bc('0x35')]=_0x3c938d[_0x62bc('0x1e')];writeDB(_0x5c806b);}});}}catch(_0x5f3752){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][agentconnect]',_0x3c938d['uniqueid']),_0x5f3752);}};exports[_0x62bc('0xd')]=function(_0xdbd9ee){try{if(!_[_0x62bc('0x36')](agents[_0xdbd9ee['destuniqueid']])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0xdbd9ee);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xdbd9ee[_0x62bc('0x13')],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x1e')],_0xdbd9ee[_0x62bc('0x14')]));agents[_0xdbd9ee[_0x62bc('0x14')]]['agentcomplete']=!![];agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt']=utils[_0x62bc('0x18')]();agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt'],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x31')]);agents[_0xdbd9ee[_0x62bc('0x14')]][_0x62bc('0x22')]=_0xdbd9ee[_0x62bc('0x22')];agents[_0xdbd9ee[_0x62bc('0x14')]]['lastevent']=_0x62bc('0x39');writeDB(agents[_0xdbd9ee[_0x62bc('0x14')]]);}}catch(_0x4859fc){utils[_0x62bc('0x2e')](util['format'](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0x4859fc);}};exports[_0x62bc('0x3a')]=function(_0xca6190){try{if(!_[_0x62bc('0x36')](agents[_0xca6190[_0x62bc('0x3b')]])){utils[_0x62bc('0x15')](util['format'](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0xca6190);utils['info'](util[_0x62bc('0x1c')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0xca6190[_0x62bc('0x13')],agents[_0xca6190[_0x62bc('0x3b')]]['membername'],agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')]));agents[_0xca6190[_0x62bc('0x3b')]]['transfer']=!![];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3d')]=_0x62bc('0x3e');agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3f')]=_0xca6190[_0x62bc('0x40')];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x41')]=agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')];}}catch(_0x44d2a2){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0x44d2a2);}};exports[_0x62bc('0x42')]=function(_0x5b0e9b){try{utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x5b0e9b);if(_0x5b0e9b[_0x62bc('0x44')]==_0x5b0e9b[_0x62bc('0x45')]){if(!_[_0x62bc('0x36')](agents[_0x5b0e9b[_0x62bc('0x46')]])){utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x47'),_0x5b0e9b[_0x62bc('0x44')],agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x1e')]));agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3f')]=_0x5b0e9b[_0x62bc('0x4a')];agents[_0x5b0e9b[_0x62bc('0x46')]]['transferuniqueid']=_0x5b0e9b['origtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x4b')]&&agents[_0x5b0e9b[_0x62bc('0x4b')]]){agents[_0x5b0e9b[_0x62bc('0x4b')]]['agententerreason']=0x1;transfers[_0x5b0e9b[_0x62bc('0x4b')]]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x4b')]]);transfers[_0x5b0e9b[_0x62bc('0x4b')]]['calleridnum']=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x7')];transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4d')]=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x4b')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b['transfereeuniqueid']][_0x62bc('0x24')]=0x0;transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4e')]=0x2;}}else if(_0x5b0e9b['secondtransfereruniqueid']==_0x5b0e9b[_0x62bc('0x4f')]){if(!_['isNil'](agents[_0x5b0e9b[_0x62bc('0x44')]])){utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x47'),_0x5b0e9b['origtransfereruniqueid'],agents[_0x5b0e9b[_0x62bc('0x44')]]['membername']));agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x44')]]['transferexten']=_0x5b0e9b[_0x62bc('0x50')];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x41')]=_0x5b0e9b['secondtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x51')]&&agents[_0x5b0e9b[_0x62bc('0x51')]]){agents[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x1;transfers[_0x5b0e9b['transfertargetuniqueid']]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x51')]]);transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x7')]=agents[_0x5b0e9b[_0x62bc('0x44')]]['calleridnum'];transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x4d')]=agents[_0x5b0e9b['origtransfereruniqueid']][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x51')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b[_0x62bc('0x51')]]['holdtime']=0x0;transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x2;}}}catch(_0x6bb64b){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x6bb64b);}};exports[_0x62bc('0x52')]=function(_0x177fba){try{utils['debug'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba[_0x62bc('0x13')]),_0x177fba);if(agents[_0x177fba[_0x62bc('0x13')]]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]===_0x62bc('0x23')){if(_0x177fba[_0x62bc('0x54')]==='21'){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]=_0x62bc('0x55');agents[_0x177fba['uniqueid']][_0x62bc('0x9')]=_0x62bc('0x55');}utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);var _0x5698a4=unanswered[_0x62bc('0x56')](_0x177fba[_0x62bc('0x13')]);if(_0x5698a4>-0x1){unanswered[_0x62bc('0x57')](_0x5698a4,0x1);}}if(transfers[_0x177fba[_0x62bc('0x13')]]){transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](transfers[_0x177fba['uniqueid']][_0x62bc('0x58')],transfers[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);transfers[_0x177fba[_0x62bc('0x13')]]['reason']=_0x62bc('0x59');transfers[_0x177fba[_0x62bc('0x13')]]['lastevent']=_0x62bc('0x39');utils['info'](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],transfers[_0x177fba['uniqueid']][_0x62bc('0x1e')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(transfers[_0x177fba[_0x62bc('0x13')]],!![]);}if(agents[_0x177fba['uniqueid']]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x31')]){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')],agents[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);agents[_0x177fba['uniqueid']]['reason']=agents[_0x177fba[_0x62bc('0x13')]]['transfer']?_0x62bc('0x48'):_0x62bc('0x59');agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]=_0x62bc('0x39');utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x5a'),_0x177fba['uniqueid'],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]]['reason'],agents[_0x177fba[_0x62bc('0x13')]]['lastevent']));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);}}catch(_0x3aa295){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba['uniqueid']),_0x3aa295);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d876f14..81cbd93 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 _0x39d2=['destination','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','calleridnum','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','transfer','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s'];(function(_0x1c100b,_0x5e17a0){var _0x2417fe=function(_0x4f5756){while(--_0x4f5756){_0x1c100b['push'](_0x1c100b['shift']());}};_0x2417fe(++_0x5e17a0);}(_0x39d2,0xf5));var _0x239d=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0x39d2[_0x4b2251];return _0x5d22fb;};'use strict';var _=require(_0x239d('0x0'));var util=require('util');var utils=require(_0x239d('0x1'));var transfers=require(_0x239d('0x2'));var dispositions=[_0x239d('0x3'),_0x239d('0x4'),_0x239d('0x4'),_0x239d('0x3'),_0x239d('0x3'),_0x239d('0x3'),_0x239d('0x5'),_0x239d('0x6'),_0x239d('0x4'),_0x239d('0x4'),_0x239d('0x4')];var channels={};function writeDB(_0x53d457){var _0x262efe;if(transfers[_0x239d('0x7')][_0x53d457[_0x239d('0x8')]]){_0x262efe=_0x53d457[_0x239d('0x8')];_0x53d457[_0x239d('0x8')]=transfers[_0x239d('0x7')][_0x53d457[_0x239d('0x8')]][_0x239d('0x9')];}utils[_0x239d('0xa')](util[_0x239d('0xb')](_0x239d('0xc'),_0x53d457[_0x239d('0x8')],_0x53d457[_0x239d('0xd')],_0x53d457[_0x239d('0xe')],_0x53d457[_0x239d('0xf')],_0x53d457['interface'],_0x53d457['calleridnum'],_0x53d457[_0x239d('0x10')],_0x53d457[_0x239d('0x11')]));if(_0x53d457[_0x239d('0x12')]){utils[_0x239d('0x13')](_0x53d457[_0x239d('0x12')])[_0x239d('0x14')](function(_0x138c4a){if(_0x138c4a){_0x53d457[_0x239d('0x15')]=_0x138c4a['id'];}utils[_0x239d('0x16')]('CreateVoiceCallReport',_0x53d457);});}else{utils[_0x239d('0x16')](_0x239d('0x17'),_0x53d457);}if(channels[_0x53d457[_0x239d('0x8')]]){delete channels[_0x53d457[_0x239d('0x8')]];}else if(_0x262efe&&channels[_0x262efe]){if(!transfers[_0x239d('0x7')][_0x262efe]['recording'])delete transfers['blinds'][_0x262efe];delete channels[_0x262efe];}}exports[_0x239d('0x18')]=function(_0x5857d5){try{utils[_0x239d('0x19')](util['format'](_0x239d('0x1a'),_0x5857d5[_0x239d('0x8')]),_0x5857d5);if(_0x5857d5[_0x239d('0x8')]==_0x5857d5[_0x239d('0x1b')]&&_0x5857d5[_0x239d('0xd')]!=_0x239d('0x1c')){utils[_0x239d('0xa')](util[_0x239d('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x5857d5[_0x239d('0x8')],_0x5857d5['context'],_0x5857d5[_0x239d('0x1d')]));channels[_0x5857d5[_0x239d('0x8')]]={'uniqueid':_0x5857d5[_0x239d('0x8')],'accountcode':_0x5857d5[_0x239d('0x12')],'source':_0x5857d5[_0x239d('0x1e')],'destination':_0x5857d5[_0x239d('0x1d')],'destinationcontext':_0x5857d5[_0x239d('0x1f')],'channel':_0x5857d5[_0x239d('0xd')],'starttime':utils[_0x239d('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x239d('0x3'),'amaflags':_0x239d('0x21')};}}catch(_0x2b8ad0){utils[_0x239d('0x22')](util['format'](_0x239d('0x1a'),_0x5857d5[_0x239d('0x8')]),_0x2b8ad0);}};exports[_0x239d('0x23')]=function(_0x197043){try{utils[_0x239d('0x19')](util[_0x239d('0xb')](_0x239d('0x24'),_0x197043[_0x239d('0x8')]),_0x197043);if(!_[_0x239d('0x25')](channels[_0x197043['uniqueid']])&&_0x197043[_0x239d('0x26')]==0x6){utils[_0x239d('0xa')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x197043[_0x239d('0x8')],_0x197043['context'],_0x197043['channel']));if(_[_0x239d('0x25')](channels[_0x197043[_0x239d('0x8')]]['systemanswertime'])){channels[_0x197043[_0x239d('0x8')]]['systemanswertime']=utils['now']();}}else if(!_['isNil'](channels[_0x197043[_0x239d('0x1b')]])&&_0x197043[_0x239d('0x26')]==0x6&&_0x197043[_0x239d('0x1f')]!=_0x239d('0x27')){utils['info'](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x197043[_0x239d('0x8')],_0x197043[_0x239d('0x1b')],_0x197043[_0x239d('0x1f')],_0x197043[_0x239d('0xd')]));channels[_0x197043['linkedid']][_0x239d('0x12')]=_0x197043[_0x239d('0x12')];channels[_0x197043[_0x239d('0x1b')]][_0x239d('0x28')]=_0x197043[_0x239d('0xd')];if(_['isNil'](channels[_0x197043[_0x239d('0x1b')]][_0x239d('0x29')])){channels[_0x197043[_0x239d('0x1b')]][_0x239d('0x29')]=utils[_0x239d('0x20')]();}channels[_0x197043[_0x239d('0x1b')]][_0x239d('0x2a')]=dispositions[_[_0x239d('0x2b')](_0x197043[_0x239d('0x26')])]||_0x239d('0x5');}}catch(_0x2f6c73){utils[_0x239d('0x22')](util['format'](_0x239d('0x24'),_0x197043[_0x239d('0x8')]),_0x2f6c73);}};exports[_0x239d('0x2c')]=function(_0x4086cc){try{if(!_[_0x239d('0x25')](channels[_0x4086cc[_0x239d('0x8')]])){utils['debug'](util[_0x239d('0xb')]('[%s][calls][hangup]',_0x4086cc[_0x239d('0x8')]),_0x4086cc);if(_[_0x239d('0x25')](channels[_0x4086cc['uniqueid']][_0x239d('0x2d')])){channels[_0x4086cc[_0x239d('0x8')]][_0x239d('0x2d')]=_0x4086cc[_0x239d('0x2e')]+'\x20<'+_0x4086cc['calleridnum']+'>';}utils['info'](util[_0x239d('0xb')](_0x239d('0x2f'),_0x4086cc[_0x239d('0x8')],channels[_0x4086cc[_0x239d('0x8')]][_0x239d('0x2d')],_0x4086cc['cause-txt']));channels[_0x4086cc['uniqueid']][_0x239d('0x30')]=utils['now']();channels[_0x4086cc[_0x239d('0x8')]]['duration']=utils[_0x239d('0x31')](channels[_0x4086cc['uniqueid']][_0x239d('0x30')],channels[_0x4086cc[_0x239d('0x8')]][_0x239d('0x32')]);channels[_0x4086cc[_0x239d('0x8')]]['billableseconds']=channels[_0x4086cc[_0x239d('0x8')]][_0x239d('0x29')]?utils[_0x239d('0x31')](channels[_0x4086cc[_0x239d('0x8')]][_0x239d('0x30')],channels[_0x4086cc[_0x239d('0x8')]][_0x239d('0x29')]):0x0;writeDB(channels[_0x4086cc['uniqueid']]);}}catch(_0x2e2360){utils[_0x239d('0x22')](util[_0x239d('0xb')](_0x239d('0x33'),_0x4086cc[_0x239d('0x8')]),_0x2e2360);}};exports[_0x239d('0x34')]=function(_0x664138){try{if(!_[_0x239d('0x25')](channels[_0x664138[_0x239d('0x35')]])){utils[_0x239d('0x19')](util['format'](_0x239d('0x36'),_0x664138['origtransfereruniqueid']),_0x664138);if(channels[_0x664138[_0x239d('0x35')]]['channel']==_0x664138[_0x239d('0x37')]){utils[_0x239d('0xa')](util[_0x239d('0xb')](_0x239d('0x38'),_0x664138[_0x239d('0x39')],_0x664138['localtwolinkedid'],_0x664138['secondtransfererchannel']));channels[_0x664138[_0x239d('0x35')]][_0x239d('0x28')]=_0x664138[_0x239d('0x3a')];channels[_0x664138[_0x239d('0x35')]]['userfield']=_0x239d('0x3b');}else if(channels[_0x664138[_0x239d('0x35')]][_0x239d('0xd')]=_0x664138['transfertargetchannel']){utils[_0x239d('0xa')](util[_0x239d('0xb')](_0x239d('0x38'),_0x664138[_0x239d('0x39')],_0x664138['localtwolinkedid'],_0x664138[_0x239d('0x3c')]));channels[_0x664138[_0x239d('0x35')]]['destinationchannel']=_0x664138['origtransfererchannel'];channels[_0x664138['localtwolinkedid']][_0x239d('0x3d')]=_0x239d('0x3b');}}}catch(_0x42e2d3){utils[_0x239d('0x22')](util['format']('[%s][calls][attendedtransfer]',_0x664138[_0x239d('0x39')]),_0x42e2d3);}};exports[_0x239d('0x3e')]=function(_0x498e6d){try{if(!_[_0x239d('0x25')](channels[_0x498e6d[_0x239d('0x8')]])){utils['debug'](util[_0x239d('0xb')](_0x239d('0x3f'),_0x498e6d[_0x239d('0x8')]),_0x498e6d);channels[_0x498e6d['uniqueid']][_0x239d('0x40')]=utils[_0x239d('0x20')]();utils['info'](util['format'](_0x239d('0x41'),_0x498e6d['uniqueid'],channels[_0x498e6d[_0x239d('0x8')]][_0x239d('0x40')]));}}catch(_0x27e30c){utils[_0x239d('0x22')](util[_0x239d('0xb')]('[%s][calls][musiconholdstart]',_0x498e6d['uniqueid']),_0x27e30c);}};exports[_0x239d('0x42')]=function(_0x55fbe0){try{if(!_[_0x239d('0x25')](channels[_0x55fbe0[_0x239d('0x8')]])){utils[_0x239d('0x19')](util[_0x239d('0xb')](_0x239d('0x43'),_0x55fbe0[_0x239d('0x8')]),_0x55fbe0);if(!_[_0x239d('0x25')](channels[_0x55fbe0[_0x239d('0x8')]][_0x239d('0x40')])){channels[_0x55fbe0[_0x239d('0x8')]][_0x239d('0x44')]+=utils[_0x239d('0x31')](utils['now'](),channels[_0x55fbe0['uniqueid']][_0x239d('0x40')]);utils[_0x239d('0xa')](util[_0x239d('0xb')](_0x239d('0x45'),_0x55fbe0[_0x239d('0x8')],channels[_0x55fbe0[_0x239d('0x8')]][_0x239d('0x44')]));delete channels[_0x55fbe0[_0x239d('0x8')]][_0x239d('0x40')];}}}catch(_0x4da310){utils[_0x239d('0x22')](util['format'](_0x239d('0x43'),_0x55fbe0[_0x239d('0x8')]),_0x4da310);}};exports[_0x239d('0x46')]=function(_0x444e60){try{if(!_[_0x239d('0x25')](channels[_0x444e60[_0x239d('0x8')]])){utils[_0x239d('0x19')](util['format'](_0x239d('0x47'),_0x444e60[_0x239d('0x8')]),_0x444e60);if(!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')][_0x239d('0x49')])){utils['info'](util[_0x239d('0xb')](_0x239d('0x4a'),_0x444e60[_0x239d('0x8')],_0x444e60[_0x239d('0x4b')]));channels[_0x444e60[_0x239d('0x8')]][_0x239d('0x4c')]=_0x444e60['value'];}if(!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')][_0x239d('0x4d')])){utils[_0x239d('0xa')](util[_0x239d('0xb')](_0x239d('0x4e'),_0x444e60[_0x239d('0x8')],_0x444e60[_0x239d('0x4b')]));channels[_0x444e60[_0x239d('0x8')]][_0x239d('0x4f')]=_0x444e60['value'];channels[_0x444e60[_0x239d('0x8')]][_0x239d('0x2d')]='\x22'+_0x444e60[_0x239d('0x4b')]+'\x22\x20<'+_0x444e60[_0x239d('0x4b')]+'>';}if(!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')]['xmd-callerid-preview'])||!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')]['xmd-callerid'])){utils[_0x239d('0xa')](util[_0x239d('0xb')](_0x239d('0x50'),_0x444e60[_0x239d('0x8')],!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')]['xmd-callerid-preview'])?_0x239d('0x51'):'xmd-callerid',_0x444e60[_0x239d('0x4b')]));channels[_0x444e60['uniqueid']]['callerid']=_0x444e60[_0x239d('0x4b')];}if(!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')][_0x239d('0x52')])||!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')][_0x239d('0x53')])){utils[_0x239d('0xa')](util[_0x239d('0xb')](_0x239d('0x50'),_0x444e60['uniqueid'],!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')][_0x239d('0x52')])?_0x239d('0x52'):'xmcs-queue',_0x444e60[_0x239d('0x4b')]));channels[_0x444e60[_0x239d('0x8')]][_0x239d('0x54')]=_0x239d('0x55');channels[_0x444e60[_0x239d('0x8')]][_0x239d('0x56')]=_0x444e60[_0x239d('0x4b')];channels[_0x444e60['uniqueid']][_0x239d('0xe')]=!![];}if(!_['isNil'](_0x444e60[_0x239d('0x48')]['xmd-contactid'])){utils[_0x239d('0xa')](util[_0x239d('0xb')](_0x239d('0x57'),_0x444e60[_0x239d('0x8')],_0x444e60['value']));channels[_0x444e60['uniqueid']]['ContactId']=_0x444e60[_0x239d('0x4b')];}if(!_[_0x239d('0x25')](_0x444e60['variable']['xmd-cdrtype'])){utils[_0x239d('0xa')](util['format'](_0x239d('0x58'),_0x444e60['uniqueid'],_0x444e60[_0x239d('0x4b')]));channels[_0x444e60['uniqueid']][_0x239d('0x59')]=_0x444e60['value'];}if(!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')][_0x239d('0x5a')])){utils[_0x239d('0xa')](util['format'](_0x239d('0x5b'),_0x444e60[_0x239d('0x8')],_0x444e60[_0x239d('0x4b')]));channels[_0x444e60[_0x239d('0x8')]][_0x239d('0x5c')]=_0x444e60['value'];}if(!_[_0x239d('0x25')](_0x444e60[_0x239d('0x48')]['sipcallid'])){utils[_0x239d('0xa')](util[_0x239d('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x444e60[_0x239d('0x8')],_0x444e60[_0x239d('0x4b')]));channels[_0x444e60[_0x239d('0x8')]][_0x239d('0x5d')]=_0x444e60['value'];}}}catch(_0x393f27){utils['error'](util['format'](_0x239d('0x47'),_0x444e60[_0x239d('0x8')]),_0x393f27);}};exports['newexten']=function(_0x44de7c){try{if(!_[_0x239d('0x25')](channels[_0x44de7c['uniqueid']])){utils['debug'](util[_0x239d('0xb')](_0x239d('0x5e'),_0x44de7c[_0x239d('0x8')]),_0x44de7c);utils['info'](util[_0x239d('0xb')](_0x239d('0x5f'),_0x44de7c[_0x239d('0x8')],_0x44de7c[_0x239d('0x60')],_0x44de7c[_0x239d('0x61')]));if(_0x44de7c[_0x239d('0x60')][_0x239d('0x62')]()==_0x239d('0x63')&&_[_0x239d('0x64')](_0x44de7c[_0x239d('0x61')]['toLowerCase'](),_0x239d('0x65'))){var _0xfc03fb=_0x44de7c[_0x239d('0x61')][_0x239d('0x66')]('=');var _0x4f2965=_0xfc03fb[0x0][_0x239d('0x67')](_0xfc03fb[0x0][_0x239d('0x68')]('(')+0x1,_0xfc03fb[0x0][_0x239d('0x68')](')'));var _0x90f013=_0xfc03fb[0x1];channels[_0x44de7c[_0x239d('0x8')]][_0x4f2965]=_0x90f013;}if(!_[_0x239d('0x69')]([_0x239d('0x2c'),_0x239d('0x6a'),_0x239d('0x6b'),_0x239d('0x63'),'gotoif'],_0x44de7c['application'][_0x239d('0x62')]())){channels[_0x44de7c[_0x239d('0x8')]][_0x239d('0x54')]=_0x44de7c[_0x239d('0x60')];channels[_0x44de7c[_0x239d('0x8')]][_0x239d('0x56')]=_0x44de7c[_0x239d('0x61')];}}}catch(_0x4c6352){utils[_0x239d('0x22')](util[_0x239d('0xb')](_0x239d('0x5e'),_0x44de7c[_0x239d('0x8')]),_0x4c6352);}}; \ No newline at end of file +var _0xd8a5=['[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','xmd-callerid','xmd-callerid-preview','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','lastdata','queue','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd8a5,0x160));var _0x5d8a=function(_0x4e8297,_0x19f4fe){_0x4e8297=_0x4e8297-0x0;var _0x1afc62=_0xd8a5[_0x4e8297];return _0x1afc62;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var utils=require(_0x5d8a('0x1'));var transfers=require(_0x5d8a('0x2'));var dispositions=['NO\x20ANSWER',_0x5d8a('0x3'),_0x5d8a('0x3'),_0x5d8a('0x4'),_0x5d8a('0x4'),_0x5d8a('0x4'),_0x5d8a('0x5'),_0x5d8a('0x6'),_0x5d8a('0x3'),_0x5d8a('0x3'),_0x5d8a('0x3')];var channels={};function writeDB(_0x441fb9){var _0x3514c5;if(transfers[_0x5d8a('0x7')][_0x441fb9['uniqueid']]){_0x3514c5=_0x441fb9[_0x5d8a('0x8')];_0x441fb9[_0x5d8a('0x8')]=transfers[_0x5d8a('0x7')][_0x441fb9[_0x5d8a('0x8')]][_0x5d8a('0x9')];}utils['info'](util[_0x5d8a('0xa')](_0x5d8a('0xb'),_0x441fb9[_0x5d8a('0x8')],_0x441fb9[_0x5d8a('0xc')],_0x441fb9['queue'],_0x441fb9[_0x5d8a('0xd')],_0x441fb9[_0x5d8a('0xe')],_0x441fb9['calleridnum'],_0x441fb9[_0x5d8a('0xf')],_0x441fb9[_0x5d8a('0x10')]));if(_0x441fb9[_0x5d8a('0x11')]){utils[_0x5d8a('0x12')](_0x441fb9[_0x5d8a('0x11')])[_0x5d8a('0x13')](function(_0x3727d3){if(_0x3727d3){_0x441fb9[_0x5d8a('0x14')]=_0x3727d3['id'];}utils[_0x5d8a('0x15')](_0x5d8a('0x16'),_0x441fb9);});}else{utils[_0x5d8a('0x15')](_0x5d8a('0x16'),_0x441fb9);}if(channels[_0x441fb9['uniqueid']]){delete channels[_0x441fb9['uniqueid']];}else if(_0x3514c5&&channels[_0x3514c5]){if(!transfers[_0x5d8a('0x7')][_0x3514c5][_0x5d8a('0x17')])delete transfers['blinds'][_0x3514c5];delete channels[_0x3514c5];}}exports[_0x5d8a('0x18')]=function(_0x119d08){try{utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')]('[%s][calls][newchannel]',_0x119d08[_0x5d8a('0x8')]),_0x119d08);if(_0x119d08['uniqueid']==_0x119d08[_0x5d8a('0x1a')]&&_0x119d08[_0x5d8a('0xc')]!=_0x5d8a('0x1b')){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x1d'),_0x119d08[_0x5d8a('0x8')],_0x119d08['context'],_0x119d08[_0x5d8a('0x1e')]));channels[_0x119d08[_0x5d8a('0x8')]]={'uniqueid':_0x119d08[_0x5d8a('0x8')],'accountcode':_0x119d08[_0x5d8a('0x11')],'source':_0x119d08['calleridnum'],'destination':_0x119d08[_0x5d8a('0x1e')],'destinationcontext':_0x119d08[_0x5d8a('0x1f')],'channel':_0x119d08[_0x5d8a('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5d8a('0x4'),'amaflags':_0x5d8a('0x20')};}}catch(_0x186aa9){utils[_0x5d8a('0x21')](util['format'](_0x5d8a('0x22'),_0x119d08[_0x5d8a('0x8')]),_0x186aa9);}};exports['newstate']=function(_0x93d735){try{utils['debug'](util[_0x5d8a('0xa')](_0x5d8a('0x23'),_0x93d735[_0x5d8a('0x8')]),_0x93d735);if(!_['isNil'](channels[_0x93d735[_0x5d8a('0x8')]])&&_0x93d735[_0x5d8a('0x24')]==0x6){utils['info'](util['format'](_0x5d8a('0x25'),_0x93d735[_0x5d8a('0x8')],_0x93d735[_0x5d8a('0x1f')],_0x93d735['channel']));if(_[_0x5d8a('0x26')](channels[_0x93d735[_0x5d8a('0x8')]]['systemanswertime'])){channels[_0x93d735[_0x5d8a('0x8')]][_0x5d8a('0x27')]=utils[_0x5d8a('0x28')]();}}else if(!_[_0x5d8a('0x26')](channels[_0x93d735[_0x5d8a('0x1a')]])&&_0x93d735['channelstate']==0x6&&_0x93d735[_0x5d8a('0x1f')]!=_0x5d8a('0x29')){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x2a'),_0x93d735[_0x5d8a('0x8')],_0x93d735[_0x5d8a('0x1a')],_0x93d735[_0x5d8a('0x1f')],_0x93d735['channel']));channels[_0x93d735[_0x5d8a('0x1a')]][_0x5d8a('0x11')]=_0x93d735[_0x5d8a('0x11')];channels[_0x93d735[_0x5d8a('0x1a')]][_0x5d8a('0x2b')]=_0x93d735[_0x5d8a('0xc')];if(_[_0x5d8a('0x26')](channels[_0x93d735[_0x5d8a('0x1a')]][_0x5d8a('0x2c')])){channels[_0x93d735[_0x5d8a('0x1a')]][_0x5d8a('0x2c')]=utils[_0x5d8a('0x28')]();}channels[_0x93d735['linkedid']][_0x5d8a('0x2d')]=dispositions[_[_0x5d8a('0x2e')](_0x93d735[_0x5d8a('0x24')])]||'ANSWERED';}}catch(_0x3d6b9c){utils['error'](util[_0x5d8a('0xa')]('[%s][calls][newstate]',_0x93d735['uniqueid']),_0x3d6b9c);}};exports[_0x5d8a('0x2f')]=function(_0x543f69){try{if(!_['isNil'](channels[_0x543f69[_0x5d8a('0x8')]])){utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')](_0x5d8a('0x30'),_0x543f69[_0x5d8a('0x8')]),_0x543f69);if(_[_0x5d8a('0x26')](channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x31')])){channels[_0x543f69[_0x5d8a('0x8')]]['callerid']=_0x543f69['calleridname']+'\x20<'+_0x543f69['calleridnum']+'>';}utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x32'),_0x543f69[_0x5d8a('0x8')],channels[_0x543f69['uniqueid']]['callerid'],_0x543f69[_0x5d8a('0x33')]));channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x34')]=utils[_0x5d8a('0x28')]();channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x35')]=utils[_0x5d8a('0x36')](channels[_0x543f69['uniqueid']]['endtime'],channels[_0x543f69['uniqueid']][_0x5d8a('0x37')]);channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x38')]=channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x2c')]?utils[_0x5d8a('0x36')](channels[_0x543f69[_0x5d8a('0x8')]]['endtime'],channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x2c')]):0x0;writeDB(channels[_0x543f69[_0x5d8a('0x8')]]);}}catch(_0x4c87ca){utils[_0x5d8a('0x21')](util[_0x5d8a('0xa')](_0x5d8a('0x30'),_0x543f69[_0x5d8a('0x8')]),_0x4c87ca);}};exports['attendedtransfer']=function(_0x58ea69){try{if(!_[_0x5d8a('0x26')](channels[_0x58ea69[_0x5d8a('0x39')]])){utils[_0x5d8a('0x19')](util['format'](_0x5d8a('0x3a'),_0x58ea69['origtransfereruniqueid']),_0x58ea69);if(channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0xc')]==_0x58ea69['transfereechannel']){utils['info'](util[_0x5d8a('0xa')](_0x5d8a('0x3b'),_0x58ea69[_0x5d8a('0x3c')],_0x58ea69[_0x5d8a('0x39')],_0x58ea69[_0x5d8a('0x3d')]));channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0x2b')]=_0x58ea69[_0x5d8a('0x3d')];channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0x3e')]=_0x5d8a('0x3f');}else if(channels[_0x58ea69['localtwolinkedid']][_0x5d8a('0xc')]=_0x58ea69[_0x5d8a('0x40')]){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x3b'),_0x58ea69[_0x5d8a('0x3c')],_0x58ea69['localtwolinkedid'],_0x58ea69['origtransfererchannel']));channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0x2b')]=_0x58ea69[_0x5d8a('0x41')];channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0x3e')]=_0x5d8a('0x3f');}}}catch(_0x1d1d54){utils[_0x5d8a('0x21')](util['format'](_0x5d8a('0x3a'),_0x58ea69['origtransfereruniqueid']),_0x1d1d54);}};exports['musiconholdstart']=function(_0x37cd25){try{if(!_['isNil'](channels[_0x37cd25[_0x5d8a('0x8')]])){utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')](_0x5d8a('0x42'),_0x37cd25['uniqueid']),_0x37cd25);channels[_0x37cd25['uniqueid']][_0x5d8a('0x43')]=utils[_0x5d8a('0x28')]();utils['info'](util[_0x5d8a('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x37cd25['uniqueid'],channels[_0x37cd25[_0x5d8a('0x8')]][_0x5d8a('0x43')]));}}catch(_0x513b8f){utils[_0x5d8a('0x21')](util['format'](_0x5d8a('0x42'),_0x37cd25[_0x5d8a('0x8')]),_0x513b8f);}};exports[_0x5d8a('0x44')]=function(_0x3543c2){try{if(!_[_0x5d8a('0x26')](channels[_0x3543c2[_0x5d8a('0x8')]])){utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')]('[%s][calls][musiconholdstop]',_0x3543c2['uniqueid']),_0x3543c2);if(!_[_0x5d8a('0x26')](channels[_0x3543c2['uniqueid']]['musiconholdstartAt'])){channels[_0x3543c2[_0x5d8a('0x8')]][_0x5d8a('0x45')]+=utils['diffTime'](utils['now'](),channels[_0x3543c2[_0x5d8a('0x8')]]['musiconholdstartAt']);utils[_0x5d8a('0x1c')](util['format'](_0x5d8a('0x46'),_0x3543c2[_0x5d8a('0x8')],channels[_0x3543c2[_0x5d8a('0x8')]][_0x5d8a('0x45')]));delete channels[_0x3543c2[_0x5d8a('0x8')]][_0x5d8a('0x43')];}}}catch(_0x27ac14){utils['error'](util[_0x5d8a('0xa')](_0x5d8a('0x47'),_0x3543c2[_0x5d8a('0x8')]),_0x27ac14);}};exports[_0x5d8a('0x48')]=function(_0xf1ee00){try{if(!_['isNil'](channels[_0xf1ee00[_0x5d8a('0x8')]])){utils['debug'](util[_0x5d8a('0xa')]('[%s][calls][varset]',_0xf1ee00[_0x5d8a('0x8')]),_0xf1ee00);if(!_['isNil'](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x4a')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x4b'),_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x4d')]=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x4e')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x4f')]=_0xf1ee00[_0x5d8a('0x4c')];channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x31')]='\x22'+_0xf1ee00['value']+'\x22\x20<'+_0xf1ee00[_0x5d8a('0x4c')]+'>';}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')]['xmd-callerid-preview'])||!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x50')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xf1ee00[_0x5d8a('0x8')],!_['isNil'](_0xf1ee00['variable'][_0x5d8a('0x51')])?_0x5d8a('0x51'):_0x5d8a('0x50'),_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]]['callerid']=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00['variable'][_0x5d8a('0x52')])||!_['isNil'](_0xf1ee00['variable']['xmcs-queue'])){utils[_0x5d8a('0x1c')](util['format'](_0x5d8a('0x53'),_0xf1ee00[_0x5d8a('0x8')],!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x52')])?'xmd-queue':_0x5d8a('0x54'),_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x55')]='Queue';channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x56')]=_0xf1ee00[_0x5d8a('0x4c')];channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x57')]=!![];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')]['xmd-contactid'])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xf1ee00['uniqueid'],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x58')]=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x59')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x5a'),_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]]['type']=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x5b')])){utils[_0x5d8a('0x1c')](util['format'](_0x5d8a('0x5c'),_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00['uniqueid']][_0x5d8a('0x5d')]=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x5e')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]]['sipcallid']=_0xf1ee00[_0x5d8a('0x4c')];}}}catch(_0x40aab8){utils[_0x5d8a('0x21')](util[_0x5d8a('0xa')](_0x5d8a('0x5f'),_0xf1ee00['uniqueid']),_0x40aab8);}};exports[_0x5d8a('0x60')]=function(_0x1a3084){try{if(!_[_0x5d8a('0x26')](channels[_0x1a3084[_0x5d8a('0x8')]])){utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')]('[%s][calls][newexten]',_0x1a3084[_0x5d8a('0x8')]),_0x1a3084);utils['info'](util[_0x5d8a('0xa')](_0x5d8a('0x61'),_0x1a3084['uniqueid'],_0x1a3084[_0x5d8a('0x62')],_0x1a3084[_0x5d8a('0x63')]));if(_0x1a3084['application']['toLowerCase']()==_0x5d8a('0x64')&&_[_0x5d8a('0x65')](_0x1a3084['appdata'][_0x5d8a('0x66')](),_0x5d8a('0x67'))){var _0x2c78d2=_0x1a3084[_0x5d8a('0x63')]['split']('=');var _0x483dd2=_0x2c78d2[0x0][_0x5d8a('0x68')](_0x2c78d2[0x0][_0x5d8a('0x69')]('(')+0x1,_0x2c78d2[0x0][_0x5d8a('0x69')](')'));var _0x17ffdd=_0x2c78d2[0x1];channels[_0x1a3084[_0x5d8a('0x8')]][_0x483dd2]=_0x17ffdd;}if(!_[_0x5d8a('0x6a')]([_0x5d8a('0x2f'),_0x5d8a('0x6b'),_0x5d8a('0x6c'),_0x5d8a('0x64'),_0x5d8a('0x6d')],_0x1a3084[_0x5d8a('0x62')][_0x5d8a('0x66')]())){channels[_0x1a3084['uniqueid']][_0x5d8a('0x55')]=_0x1a3084[_0x5d8a('0x62')];channels[_0x1a3084[_0x5d8a('0x8')]][_0x5d8a('0x56')]=_0x1a3084[_0x5d8a('0x63')];}}}catch(_0x4c87aa){utils[_0x5d8a('0x21')](util['format'](_0x5d8a('0x6e'),_0x1a3084[_0x5d8a('0x8')]),_0x4c87aa);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5788286..2495e15 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 _0xb9d9=['fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown'];(function(_0x2a1946,_0x2bbefa){var _0x8d307f=function(_0x391297){while(--_0x391297){_0x2a1946['push'](_0x2a1946['shift']());}};_0x8d307f(++_0x2bbefa);}(_0xb9d9,0x1b3));var _0x9b9d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb9d9[_0x14add3];return _0x4a174f;};'use strict';var utils=require(_0x9b9d('0x0'));exports[_0x9b9d('0x1')]=function(){utils[_0x9b9d('0x2')](_0x9b9d('0x3'));};exports['shutdown']=function(){utils[_0x9b9d('0x2')](_0x9b9d('0x4'));};exports[_0x9b9d('0x5')]=function(){utils['info'](_0x9b9d('0x6'));};exports[_0x9b9d('0x7')]=function(_0xc2a6e7){utils[_0x9b9d('0x7')]('[core]\x20error',_0xc2a6e7);};exports[_0x9b9d('0x8')]=function(){utils['info'](_0x9b9d('0x9'));};exports[_0x9b9d('0xa')]=function(_0x5881bf){}; \ No newline at end of file +var _0x63cb=['error','[core]\x20error','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x4cf25b,_0x5c5a69){var _0x32abd9=function(_0x79ae5){while(--_0x79ae5){_0x4cf25b['push'](_0x4cf25b['shift']());}};_0x32abd9(++_0x5c5a69);}(_0x63cb,0x158));var _0xb63c=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x63cb[_0xf51c06];return _0x1d5420;};'use strict';var utils=require(_0xb63c('0x0'));exports[_0xb63c('0x1')]=function(){utils[_0xb63c('0x2')](_0xb63c('0x3'));};exports[_0xb63c('0x4')]=function(){utils[_0xb63c('0x2')](_0xb63c('0x5'));};exports[_0xb63c('0x6')]=function(){utils[_0xb63c('0x2')](_0xb63c('0x7'));};exports[_0xb63c('0x8')]=function(_0x2640b3){utils[_0xb63c('0x8')](_0xb63c('0x9'),_0x2640b3);};exports['close']=function(){utils[_0xb63c('0x2')]('[core]\x20close');};exports[_0xb63c('0xa')]=function(_0x416bf2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ee069c0..eabfeb7 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 _0x2753=['[%s][dials][dialend]','dialstatus','ANSWER','assign','connect','answertime','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','endtime','holdtime','billableseconds','diffTime','[%s][dials][hangup]','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','calleridnum','request','newexten','debug','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr(routeid)','split','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2753,0x158));var _0x3275=function(_0x3a9492,_0x480040){_0x3a9492=_0x3a9492-0x0;var _0x19ec65=_0x2753[_0x3a9492];return _0x19ec65;};'use strict';var _=require(_0x3275('0x0'));var util=require('util');var utils=require(_0x3275('0x1'));var dials={};function writeDB(_0x3441c3){utils[_0x3275('0x2')](util[_0x3275('0x3')](_0x3275('0x4'),_0x3441c3['uniqueid'],_0x3441c3['channel'],_0x3441c3['dialstring'],_0x3441c3[_0x3275('0x5')],_0x3441c3['connectedlinenum'],_0x3441c3['dialstatus']));utils[_0x3275('0x6')]('CreateVoiceDialReport',_0x3441c3);delete dials[_0x3441c3['uniqueid']];}exports[_0x3275('0x7')]=function(_0x52bab3){try{utils[_0x3275('0x8')](util[_0x3275('0x3')](_0x3275('0x9'),_0x52bab3[_0x3275('0xa')]),_0x52bab3);utils[_0x3275('0x2')](util[_0x3275('0x3')](_0x3275('0xb'),_0x52bab3[_0x3275('0xa')],_0x52bab3[_0x3275('0xc')],_0x52bab3[_0x3275('0xd')]));if(_0x52bab3[_0x3275('0xc')]['toLowerCase']()=='set'&&_[_0x3275('0xe')](_0x52bab3[_0x3275('0xd')][_0x3275('0xf')](),_0x3275('0x10'))){var _0x76e1e4=_0x52bab3[_0x3275('0xd')][_0x3275('0x11')]('=');dials[_0x52bab3['uniqueid']]={'routeId':_0x76e1e4[0x1]};}}catch(_0x3d4a4c){utils['error'](util[_0x3275('0x3')](_0x3275('0x9'),_0x52bab3[_0x3275('0xa')]),_0x3d4a4c);}};exports['varset']=function(_0x523cb4){try{utils[_0x3275('0x8')](util[_0x3275('0x3')]('[%s][dials][varset]',_0x523cb4[_0x3275('0xa')]),_0x523cb4);if(!_[_0x3275('0x12')](_0x523cb4[_0x3275('0x13')][_0x3275('0x14')])){utils[_0x3275('0x2')](util['format'](_0x3275('0x15'),_0x523cb4[_0x3275('0xa')],_0x523cb4[_0x3275('0x16')]));dials[_0x523cb4[_0x3275('0xa')]]={'routeId':_0x523cb4[_0x3275('0x16')]};}}catch(_0x312481){utils['error'](util[_0x3275('0x3')](_0x3275('0x17'),_0x523cb4[_0x3275('0xa')]),_0x312481);}};exports[_0x3275('0x18')]=function(_0x3a30c3){try{if(!_[_0x3275('0x12')](dials[_0x3a30c3[_0x3275('0xa')]])){utils['debug'](util[_0x3275('0x3')](_0x3275('0x19'),_0x3a30c3[_0x3275('0xa')]),_0x3a30c3);dials[_0x3a30c3[_0x3275('0xa')]]=_['assign'](dials[_0x3a30c3[_0x3275('0xa')]],_0x3a30c3);dials[_0x3a30c3[_0x3275('0xa')]]['starttime']=utils[_0x3275('0x1a')]();dials[_0x3a30c3[_0x3275('0xa')]][_0x3275('0x1b')]=_0x3275('0x1c');utils[_0x3275('0x2')](util[_0x3275('0x3')](_0x3275('0x1d'),_0x3a30c3[_0x3275('0xa')],dials[_0x3a30c3[_0x3275('0xa')]][_0x3275('0x1e')]));}}catch(_0xc89ef3){utils[_0x3275('0x1f')](util[_0x3275('0x3')](_0x3275('0x19'),_0x3a30c3[_0x3275('0xa')]),_0xc89ef3);}};exports['dialend']=function(_0x180729){try{if(!_[_0x3275('0x12')](dials[_0x180729[_0x3275('0xa')]])){utils[_0x3275('0x8')](util[_0x3275('0x3')](_0x3275('0x20'),_0x180729[_0x3275('0xa')]),_0x180729);dials[_0x180729[_0x3275('0xa')]][_0x3275('0x21')]=_0x180729[_0x3275('0x21')];if(_0x180729[_0x3275('0x21')]==_0x3275('0x22')){dials[_0x180729['uniqueid']]=_[_0x3275('0x23')](dials[_0x180729[_0x3275('0xa')]],_0x180729);dials[_0x180729[_0x3275('0xa')]]['answertime']=utils['now']();dials[_0x180729['uniqueid']][_0x3275('0x1b')]=_0x3275('0x24');utils[_0x3275('0x2')](util[_0x3275('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x180729['uniqueid'],_0x180729[_0x3275('0x21')],dials[_0x180729[_0x3275('0xa')]][_0x3275('0x25')]));}else{utils[_0x3275('0x2')](util[_0x3275('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x180729[_0x3275('0xa')],_0x180729['dialstatus']));}}}catch(_0x50a993){utils['error'](util[_0x3275('0x3')](_0x3275('0x20'),_0x180729[_0x3275('0xa')]),_0x50a993);}};exports[_0x3275('0x26')]=function(_0x3b75b0){try{if(!_[_0x3275('0x12')](dials[_0x3b75b0[_0x3275('0xa')]])){utils[_0x3275('0x8')](util[_0x3275('0x3')]('[%s][dials][hangup]',_0x3b75b0[_0x3275('0xa')]),_0x3b75b0);utils[_0x3275('0x2')](util[_0x3275('0x3')](_0x3275('0x27'),_0x3b75b0['uniqueid'],_0x3b75b0[_0x3275('0x5')],_0x3b75b0[_0x3275('0x28')],_0x3b75b0['cause-txt']));dials[_0x3b75b0['uniqueid']]=_[_0x3275('0x23')](dials[_0x3b75b0[_0x3275('0xa')]],{'endtime':utils[_0x3275('0x1a')](),'lastevent':'complete'});dials[_0x3b75b0[_0x3275('0xa')]][_0x3275('0x29')]=utils['diffTime'](dials[_0x3b75b0['uniqueid']][_0x3275('0x2a')],dials[_0x3b75b0[_0x3275('0xa')]][_0x3275('0x1e')]);dials[_0x3b75b0[_0x3275('0xa')]][_0x3275('0x2b')]=utils['diffTime'](dials[_0x3b75b0[_0x3275('0xa')]][_0x3275('0x25')]||dials[_0x3b75b0[_0x3275('0xa')]][_0x3275('0x2a')],dials[_0x3b75b0[_0x3275('0xa')]]['starttime']);dials[_0x3b75b0[_0x3275('0xa')]][_0x3275('0x2c')]=dials[_0x3b75b0['uniqueid']][_0x3275('0x25')]?utils[_0x3275('0x2d')](dials[_0x3b75b0[_0x3275('0xa')]]['endtime'],dials[_0x3b75b0[_0x3275('0xa')]][_0x3275('0x25')]):0x0;writeDB(dials[_0x3b75b0[_0x3275('0xa')]]);}}catch(_0x29f881){utils['error'](util['format'](_0x3275('0x2e'),_0x3b75b0[_0x3275('0xa')]),_0x29f881);}}; \ No newline at end of file +var _0xaca0=['split','error','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridname','cause-txt','duration','holdtime','diffTime','endtime','billableseconds','util','./utils','info','format','uniqueid','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaca0,0x1e7));var _0x0aca=function(_0x2d419d,_0x4a569b){_0x2d419d=_0x2d419d-0x0;var _0x119a6a=_0xaca0[_0x2d419d];return _0x119a6a;};'use strict';var _=require('lodash');var util=require(_0x0aca('0x0'));var utils=require(_0x0aca('0x1'));var dials={};function writeDB(_0x1f532b){utils[_0x0aca('0x2')](util[_0x0aca('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1f532b[_0x0aca('0x4')],_0x1f532b['channel'],_0x1f532b[_0x0aca('0x5')],_0x1f532b[_0x0aca('0x6')],_0x1f532b['connectedlinenum'],_0x1f532b[_0x0aca('0x7')]));utils[_0x0aca('0x8')](_0x0aca('0x9'),_0x1f532b);delete dials[_0x1f532b[_0x0aca('0x4')]];}exports['newexten']=function(_0x5bfd79){try{utils[_0x0aca('0xa')](util['format'](_0x0aca('0xb'),_0x5bfd79[_0x0aca('0x4')]),_0x5bfd79);utils[_0x0aca('0x2')](util[_0x0aca('0x3')](_0x0aca('0xc'),_0x5bfd79[_0x0aca('0x4')],_0x5bfd79['application'],_0x5bfd79[_0x0aca('0xd')]));if(_0x5bfd79[_0x0aca('0xe')][_0x0aca('0xf')]()==_0x0aca('0x10')&&_[_0x0aca('0x11')](_0x5bfd79['appdata'][_0x0aca('0xf')](),_0x0aca('0x12'))){var _0x331d7e=_0x5bfd79[_0x0aca('0xd')][_0x0aca('0x13')]('=');dials[_0x5bfd79[_0x0aca('0x4')]]={'routeId':_0x331d7e[0x1]};}}catch(_0xb35b1f){utils[_0x0aca('0x14')](util['format']('[%s][dials][newexten]',_0x5bfd79[_0x0aca('0x4')]),_0xb35b1f);}};exports['varset']=function(_0x204184){try{utils[_0x0aca('0xa')](util[_0x0aca('0x3')](_0x0aca('0x15'),_0x204184[_0x0aca('0x4')]),_0x204184);if(!_[_0x0aca('0x16')](_0x204184['variable'][_0x0aca('0x17')])){utils['info'](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x204184['uniqueid'],_0x204184['value']));dials[_0x204184['uniqueid']]={'routeId':_0x204184[_0x0aca('0x18')]};}}catch(_0x55437a){utils[_0x0aca('0x14')](util['format'](_0x0aca('0x15'),_0x204184[_0x0aca('0x4')]),_0x55437a);}};exports[_0x0aca('0x19')]=function(_0x4ffa7c){try{if(!_['isNil'](dials[_0x4ffa7c[_0x0aca('0x4')]])){utils[_0x0aca('0xa')](util['format'](_0x0aca('0x1a'),_0x4ffa7c[_0x0aca('0x4')]),_0x4ffa7c);dials[_0x4ffa7c[_0x0aca('0x4')]]=_[_0x0aca('0x1b')](dials[_0x4ffa7c[_0x0aca('0x4')]],_0x4ffa7c);dials[_0x4ffa7c[_0x0aca('0x4')]][_0x0aca('0x1c')]=utils[_0x0aca('0x1d')]();dials[_0x4ffa7c[_0x0aca('0x4')]]['lastevent']=_0x0aca('0x1e');utils[_0x0aca('0x2')](util[_0x0aca('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4ffa7c[_0x0aca('0x4')],dials[_0x4ffa7c['uniqueid']][_0x0aca('0x1c')]));}}catch(_0x12f6db){utils['error'](util[_0x0aca('0x3')](_0x0aca('0x1a'),_0x4ffa7c[_0x0aca('0x4')]),_0x12f6db);}};exports[_0x0aca('0x1f')]=function(_0x18272a){try{if(!_[_0x0aca('0x16')](dials[_0x18272a[_0x0aca('0x4')]])){utils[_0x0aca('0xa')](util[_0x0aca('0x3')](_0x0aca('0x20'),_0x18272a['uniqueid']),_0x18272a);dials[_0x18272a[_0x0aca('0x4')]][_0x0aca('0x7')]=_0x18272a[_0x0aca('0x7')];if(_0x18272a[_0x0aca('0x7')]==_0x0aca('0x21')){dials[_0x18272a['uniqueid']]=_[_0x0aca('0x1b')](dials[_0x18272a['uniqueid']],_0x18272a);dials[_0x18272a[_0x0aca('0x4')]][_0x0aca('0x22')]=utils[_0x0aca('0x1d')]();dials[_0x18272a[_0x0aca('0x4')]][_0x0aca('0x23')]='connect';utils[_0x0aca('0x2')](util[_0x0aca('0x3')](_0x0aca('0x24'),_0x18272a[_0x0aca('0x4')],_0x18272a[_0x0aca('0x7')],dials[_0x18272a[_0x0aca('0x4')]][_0x0aca('0x22')]));}else{utils['info'](util[_0x0aca('0x3')](_0x0aca('0x25'),_0x18272a[_0x0aca('0x4')],_0x18272a[_0x0aca('0x7')]));}}}catch(_0x264128){utils[_0x0aca('0x14')](util[_0x0aca('0x3')](_0x0aca('0x20'),_0x18272a[_0x0aca('0x4')]),_0x264128);}};exports['hangup']=function(_0x4cfb00){try{if(!_[_0x0aca('0x16')](dials[_0x4cfb00['uniqueid']])){utils[_0x0aca('0xa')](util[_0x0aca('0x3')](_0x0aca('0x26'),_0x4cfb00[_0x0aca('0x4')]),_0x4cfb00);utils[_0x0aca('0x2')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4cfb00[_0x0aca('0x4')],_0x4cfb00[_0x0aca('0x6')],_0x4cfb00[_0x0aca('0x27')],_0x4cfb00[_0x0aca('0x28')]));dials[_0x4cfb00[_0x0aca('0x4')]]=_[_0x0aca('0x1b')](dials[_0x4cfb00[_0x0aca('0x4')]],{'endtime':utils[_0x0aca('0x1d')](),'lastevent':'complete'});dials[_0x4cfb00[_0x0aca('0x4')]][_0x0aca('0x29')]=utils['diffTime'](dials[_0x4cfb00['uniqueid']]['endtime'],dials[_0x4cfb00['uniqueid']][_0x0aca('0x1c')]);dials[_0x4cfb00['uniqueid']][_0x0aca('0x2a')]=utils[_0x0aca('0x2b')](dials[_0x4cfb00[_0x0aca('0x4')]][_0x0aca('0x22')]||dials[_0x4cfb00[_0x0aca('0x4')]][_0x0aca('0x2c')],dials[_0x4cfb00['uniqueid']][_0x0aca('0x1c')]);dials[_0x4cfb00[_0x0aca('0x4')]][_0x0aca('0x2d')]=dials[_0x4cfb00[_0x0aca('0x4')]][_0x0aca('0x22')]?utils[_0x0aca('0x2b')](dials[_0x4cfb00[_0x0aca('0x4')]][_0x0aca('0x2c')],dials[_0x4cfb00[_0x0aca('0x4')]]['answertime']):0x0;writeDB(dials[_0x4cfb00[_0x0aca('0x4')]]);}}catch(_0x53526c){utils[_0x0aca('0x14')](util['format'](_0x0aca('0x26'),_0x4cfb00[_0x0aca('0x4')]),_0x53526c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6149748..88739ea 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 _0x2b4b=['varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x2b4b,0x1a1));var _0xb2b4=function(_0x5e54a9,_0x591fea){_0x5e54a9=_0x5e54a9-0x0;var _0x4e46ab=_0x2b4b[_0x5e54a9];return _0x4e46ab;};var AsteriskManager=require('asterisk-manager');var config=require(_0xb2b4('0x0'));var utils=require(_0xb2b4('0x1'));var util=require(_0xb2b4('0x2'));var isXDREnabled=config[_0xb2b4('0x3')]&&config[_0xb2b4('0x3')]['disabled']?!config[_0xb2b4('0x3')][_0xb2b4('0x4')]:!![];var isProduction=config['env']===_0xb2b4('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0xb2b4('0x3')][_0xb2b4('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xb2b4('0x7')][_0xb2b4('0x8')],config['asterisk']['ip'],config[_0xb2b4('0x7')][_0xb2b4('0x9')],config[_0xb2b4('0x7')][_0xb2b4('0xa')],!![]);ami[_0xb2b4('0xb')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xb2b4('0xc')](_0xb2b4('0xd'));}else{var agents=require(_0xb2b4('0xe'));var calls=require(_0xb2b4('0xf'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xb2b4('0x10'));var dials=require(_0xb2b4('0x11'));var transfers=require(_0xb2b4('0x12'));var core=require('./core.controller');ami['on'](_0xb2b4('0x13'),core[_0xb2b4('0x13')]);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core[_0xb2b4('0x14')]);ami['on']('error',core[_0xb2b4('0x15')]);ami['on'](_0xb2b4('0x16'),core[_0xb2b4('0x16')]);ami['on'](_0xb2b4('0x17'),core[_0xb2b4('0x17')]);ami['on'](_0xb2b4('0x18'),function(_0x3affbf){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x1b'),_0x3affbf[_0xb2b4('0x1c')]),_0x3affbf);members[_0xb2b4('0x18')](_0x3affbf);}catch(_0x45ab00){utils[_0xb2b4('0x15')](util['format'](_0xb2b4('0x1b'),_0x3affbf[_0xb2b4('0x1c')]),_0x45ab00);}});ami['on'](_0xb2b4('0x1d'),function(_0x57612c){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x1e'),_0x57612c[_0xb2b4('0x1f')]),_0x57612c);agents[_0xb2b4('0x1d')](_0x57612c);}catch(_0x59de7e){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x1e'),_0x57612c['uniqueid']),_0x59de7e);}});ami['on'](_0xb2b4('0x20'),function(_0x455676){try{utils[_0xb2b4('0x19')](util['format'](_0xb2b4('0x21'),_0x455676[_0xb2b4('0x1f')]),_0x455676);agents[_0xb2b4('0x20')](_0x455676);}catch(_0x12d3e4){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')]('[%s][index][agentringnoanswer]',_0x455676['uniqueid']),_0x12d3e4);}});ami['on'](_0xb2b4('0x22'),function(_0x5c72c9){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x23'),_0x5c72c9[_0xb2b4('0x1f')]),_0x5c72c9);agents[_0xb2b4('0x22')](_0x5c72c9);queues[_0xb2b4('0x22')](_0x5c72c9);}catch(_0x5cf4ad){utils['error'](util[_0xb2b4('0x1a')](_0xb2b4('0x23'),_0x5c72c9[_0xb2b4('0x1f')]),_0x5cf4ad);}});ami['on'](_0xb2b4('0x24'),function(_0x565486){try{utils['debug'](util[_0xb2b4('0x1a')](_0xb2b4('0x25'),_0x565486[_0xb2b4('0x1f')]),_0x565486);agents[_0xb2b4('0x24')](_0x565486);queues[_0xb2b4('0x24')](_0x565486);members[_0xb2b4('0x24')](_0x565486);}catch(_0x4a568b){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x25'),_0x565486[_0xb2b4('0x1f')]),_0x4a568b);}});ami['on']('queuecallerabandon',function(_0x2d40da){try{utils[_0xb2b4('0x19')](util['format']('[%s][index][queuecallerabandon]',_0x2d40da[_0xb2b4('0x1f')]),_0x2d40da);agents[_0xb2b4('0x26')](_0x2d40da);queues[_0xb2b4('0x26')](_0x2d40da);}catch(_0x3e6a45){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x27'),_0x2d40da['uniqueid']),_0x3e6a45);}});ami['on'](_0xb2b4('0x28'),function(_0x553801){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x29'),_0x553801[_0xb2b4('0x1f')]),_0x553801);queues[_0xb2b4('0x28')](_0x553801);recordings[_0xb2b4('0x28')](_0x553801);}catch(_0x454e84){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x29'),_0x553801[_0xb2b4('0x1f')]),_0x454e84);}});ami['on'](_0xb2b4('0x2a'),function(_0x3f23c4){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x2b'),_0x3f23c4[_0xb2b4('0x1f')]),_0x3f23c4);queues[_0xb2b4('0x2a')](_0x3f23c4);}catch(_0x19ec23){utils['error'](util[_0xb2b4('0x1a')](_0xb2b4('0x2b'),_0x3f23c4[_0xb2b4('0x1f')]),_0x19ec23);}});ami['on'](_0xb2b4('0x2c'),function(_0xdcebb0){try{utils['debug'](util[_0xb2b4('0x1a')]('[%s][index][musiconholdstart]',_0xdcebb0[_0xb2b4('0x1f')]),_0xdcebb0);queues[_0xb2b4('0x2c')](_0xdcebb0);calls[_0xb2b4('0x2c')](_0xdcebb0);}catch(_0xc29d3a){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x2d'),_0xdcebb0[_0xb2b4('0x1f')]),_0xc29d3a);}});ami['on'](_0xb2b4('0x2e'),function(_0x4f9d07){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x2f'),_0x4f9d07['uniqueid']),_0x4f9d07);queues[_0xb2b4('0x2e')](_0x4f9d07);calls[_0xb2b4('0x2e')](_0x4f9d07);}catch(_0x46d933){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x2f'),_0x4f9d07[_0xb2b4('0x1f')]),_0x46d933);}});ami['on']('newstate',function(_0x1242ed){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x30'),_0x1242ed[_0xb2b4('0x1f')]),_0x1242ed);calls['newstate'](_0x1242ed);recordings[_0xb2b4('0x31')](_0x1242ed);}catch(_0x5c3f5c){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')]('[%s][index][newstate]',_0x1242ed[_0xb2b4('0x1f')]),_0x5c3f5c);}});ami['on'](_0xb2b4('0x32'),function(_0x294a8e){try{utils['debug'](util[_0xb2b4('0x1a')](_0xb2b4('0x33'),_0x294a8e[_0xb2b4('0x1f')]),_0x294a8e);calls[_0xb2b4('0x32')](_0x294a8e);recordings[_0xb2b4('0x32')](_0x294a8e);dials['hangup'](_0x294a8e);agents[_0xb2b4('0x32')](_0x294a8e);queues[_0xb2b4('0x32')](_0x294a8e);}catch(_0xe978a4){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x33'),_0x294a8e[_0xb2b4('0x1f')]),_0xe978a4);}});ami['on'](_0xb2b4('0x34'),function(_0x33ffd8){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x35'),_0x33ffd8[_0xb2b4('0x1f')]),_0x33ffd8);members[_0xb2b4('0x34')](_0x33ffd8);}catch(_0x2da90d){utils[_0xb2b4('0x15')](util['format'](_0xb2b4('0x35'),_0x33ffd8['uniqueid']),_0x2da90d);}});ami['on'](_0xb2b4('0x36'),function(_0x4cd1e6){try{utils[_0xb2b4('0x19')](util['format'](_0xb2b4('0x37'),_0x4cd1e6[_0xb2b4('0x1f')]),_0x4cd1e6);queues[_0xb2b4('0x36')](_0x4cd1e6);agents['blindtransfer'](_0x4cd1e6);transfers[_0xb2b4('0x36')](_0x4cd1e6);recordings[_0xb2b4('0x36')](_0x4cd1e6);}catch(_0xcf1da0){utils['error'](util[_0xb2b4('0x1a')]('[%s][index][blindtransfer]',_0x4cd1e6[_0xb2b4('0x1f')]),_0xcf1da0);}});ami['on'](_0xb2b4('0x38'),function(_0x40fafc){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x39'),_0x40fafc[_0xb2b4('0x3a')]),_0x40fafc);queues['attendedtransfer'](_0x40fafc);transfers[_0xb2b4('0x38')](_0x40fafc);agents[_0xb2b4('0x38')](_0x40fafc);calls['attendedtransfer'](_0x40fafc);}catch(_0x2501c2){utils['error'](util['format'](_0xb2b4('0x39'),_0x40fafc[_0xb2b4('0x3a')]),_0x2501c2);}});ami['on'](_0xb2b4('0x3b'),function(_0x45c5f2){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')](_0xb2b4('0x3c'),_0x45c5f2[_0xb2b4('0x1f')]),_0x45c5f2);queues[_0xb2b4('0x3b')](_0x45c5f2);recordings[_0xb2b4('0x3b')](_0x45c5f2);calls['varset'](_0x45c5f2);dials['varset'](_0x45c5f2);}catch(_0x283562){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x3c'),_0x45c5f2['uniqueid']),_0x283562);}});ami['on'](_0xb2b4('0x3d'),function(_0xb1a06f){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')]('[%s][index][newexten]',_0xb1a06f[_0xb2b4('0x1f')]),_0xb1a06f);calls['newexten'](_0xb1a06f);recordings['newexten'](_0xb1a06f);dials[_0xb2b4('0x3d')](_0xb1a06f);}catch(_0x167937){utils[_0xb2b4('0x15')](util['format'](_0xb2b4('0x3e'),_0xb1a06f[_0xb2b4('0x1f')]),_0x167937);}});ami['on'](_0xb2b4('0x3f'),function(_0x1fa5a8){try{utils['debug'](util[_0xb2b4('0x1a')]('[%s][index][newchannel]',_0x1fa5a8[_0xb2b4('0x1f')]),_0x1fa5a8);calls['newchannel'](_0x1fa5a8);recordings[_0xb2b4('0x3f')](_0x1fa5a8);}catch(_0x5b5419){utils['error'](util[_0xb2b4('0x1a')](_0xb2b4('0x40'),_0x1fa5a8[_0xb2b4('0x1f')]),_0x5b5419);}});ami['on'](_0xb2b4('0x41'),function(_0x59980b){try{utils[_0xb2b4('0x19')](util[_0xb2b4('0x1a')]('[%s][index][dialbegin]',_0x59980b[_0xb2b4('0x1f')]),_0x59980b);dials[_0xb2b4('0x41')](_0x59980b);}catch(_0x4fec1f){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')]('[%s]dialbegin',_0x59980b['uniqueid']),_0x4fec1f);}});ami['on'](_0xb2b4('0x42'),function(_0x3dc0b2){try{utils[_0xb2b4('0x19')](util['format'](_0xb2b4('0x43'),_0x3dc0b2[_0xb2b4('0x1f')]),_0x3dc0b2);dials['dialend'](_0x3dc0b2);}catch(_0x1ea9fd){utils[_0xb2b4('0x15')](util[_0xb2b4('0x1a')](_0xb2b4('0x43'),_0x3dc0b2[_0xb2b4('0x1f')]),_0x1ea9fd);}});} \ No newline at end of file +var _0xc848=['dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env','production','local','port','asterisk','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]','agentcalled','debug','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][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]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin'];(function(_0x15526e,_0x223176){var _0x2c2005=function(_0x236bb2){while(--_0x236bb2){_0x15526e['push'](_0x15526e['shift']());}};_0x2c2005(++_0x223176);}(_0xc848,0x90));var _0x8c84=function(_0x48a29e,_0x221a31){_0x48a29e=_0x48a29e-0x0;var _0x3122e=_0xc848[_0x48a29e];return _0x3122e;};var AsteriskManager=require(_0x8c84('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x8c84('0x1'));var isXDREnabled=config[_0x8c84('0x2')]&&config[_0x8c84('0x2')][_0x8c84('0x3')]?!config['xdr'][_0x8c84('0x3')]:!![];var isProduction=config[_0x8c84('0x4')]===_0x8c84('0x5')||![];var isLocalAsterisk=config[_0x8c84('0x2')]&&config['xdr'][_0x8c84('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x8c84('0x7')],config[_0x8c84('0x8')]['ip'],config[_0x8c84('0x8')]['username'],config[_0x8c84('0x8')][_0x8c84('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x8c84('0xa')](_0x8c84('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8c84('0xa')](_0x8c84('0xc'));}else{var agents=require(_0x8c84('0xd'));var calls=require(_0x8c84('0xe'));var queues=require(_0x8c84('0xf'));var recordings=require('./recordings.controller');var members=require(_0x8c84('0x10'));var dials=require(_0x8c84('0x11'));var transfers=require(_0x8c84('0x12'));var core=require(_0x8c84('0x13'));ami['on'](_0x8c84('0x14'),core[_0x8c84('0x14')]);ami['on']('shutdown',core[_0x8c84('0x15')]);ami['on']('fullybooted',core[_0x8c84('0x16')]);ami['on'](_0x8c84('0x17'),core[_0x8c84('0x17')]);ami['on'](_0x8c84('0x18'),core[_0x8c84('0x18')]);ami['on'](_0x8c84('0x19'),core['managerevent']);ami['on'](_0x8c84('0x1a'),function(_0x24f3af){try{utils['debug'](util[_0x8c84('0x1b')]('[%s][index][devicestatechange]',_0x24f3af[_0x8c84('0x1c')]),_0x24f3af);members[_0x8c84('0x1a')](_0x24f3af);}catch(_0x3b732c){utils['error'](util[_0x8c84('0x1b')](_0x8c84('0x1d'),_0x24f3af['device']),_0x3b732c);}});ami['on'](_0x8c84('0x1e'),function(_0x2103c0){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')]('[%s][index][agentcalled]',_0x2103c0[_0x8c84('0x20')]),_0x2103c0);agents[_0x8c84('0x1e')](_0x2103c0);}catch(_0x5099b9){utils['error'](util['format']('[%s][index][agentcalled]',_0x2103c0[_0x8c84('0x20')]),_0x5099b9);}});ami['on']('agentringnoanswer',function(_0x2bee75){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')]('[%s][index][agentringnoanswer]',_0x2bee75[_0x8c84('0x20')]),_0x2bee75);agents[_0x8c84('0x21')](_0x2bee75);}catch(_0x9c6bdf){utils['error'](util['format'](_0x8c84('0x22'),_0x2bee75['uniqueid']),_0x9c6bdf);}});ami['on']('agentconnect',function(_0x354e46){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')](_0x8c84('0x23'),_0x354e46[_0x8c84('0x20')]),_0x354e46);agents['agentconnect'](_0x354e46);queues[_0x8c84('0x24')](_0x354e46);}catch(_0x4fcb29){utils['error'](util[_0x8c84('0x1b')](_0x8c84('0x23'),_0x354e46[_0x8c84('0x20')]),_0x4fcb29);}});ami['on'](_0x8c84('0x25'),function(_0x24b8ce){try{utils[_0x8c84('0x1f')](util['format'](_0x8c84('0x26'),_0x24b8ce[_0x8c84('0x20')]),_0x24b8ce);agents['agentcomplete'](_0x24b8ce);queues[_0x8c84('0x25')](_0x24b8ce);members['agentcomplete'](_0x24b8ce);}catch(_0x138c11){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')](_0x8c84('0x26'),_0x24b8ce[_0x8c84('0x20')]),_0x138c11);}});ami['on'](_0x8c84('0x27'),function(_0x45162b){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')]('[%s][index][queuecallerabandon]',_0x45162b['uniqueid']),_0x45162b);agents[_0x8c84('0x27')](_0x45162b);queues[_0x8c84('0x27')](_0x45162b);}catch(_0x1343fb){utils['error'](util[_0x8c84('0x1b')](_0x8c84('0x28'),_0x45162b['uniqueid']),_0x1343fb);}});ami['on'](_0x8c84('0x29'),function(_0xc4449a){try{utils[_0x8c84('0x1f')](util['format'](_0x8c84('0x2a'),_0xc4449a[_0x8c84('0x20')]),_0xc4449a);queues['queuecallerjoin'](_0xc4449a);recordings['queuecallerjoin'](_0xc4449a);}catch(_0x3f822e){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')](_0x8c84('0x2a'),_0xc4449a[_0x8c84('0x20')]),_0x3f822e);}});ami['on'](_0x8c84('0x2b'),function(_0x4599fd){try{utils[_0x8c84('0x1f')](util['format']('[%s][index][queuecallerleave]',_0x4599fd['uniqueid']),_0x4599fd);queues['queuecallerleave'](_0x4599fd);}catch(_0x5416ee){utils['error'](util[_0x8c84('0x1b')](_0x8c84('0x2c'),_0x4599fd[_0x8c84('0x20')]),_0x5416ee);}});ami['on'](_0x8c84('0x2d'),function(_0x2e8740){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')]('[%s][index][musiconholdstart]',_0x2e8740[_0x8c84('0x20')]),_0x2e8740);queues['musiconholdstart'](_0x2e8740);calls[_0x8c84('0x2d')](_0x2e8740);}catch(_0x2a52bb){utils[_0x8c84('0x17')](util['format'](_0x8c84('0x2e'),_0x2e8740[_0x8c84('0x20')]),_0x2a52bb);}});ami['on'](_0x8c84('0x2f'),function(_0x5a4c71){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')](_0x8c84('0x30'),_0x5a4c71[_0x8c84('0x20')]),_0x5a4c71);queues[_0x8c84('0x2f')](_0x5a4c71);calls['musiconholdstop'](_0x5a4c71);}catch(_0x5a2ec7){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')]('[%s][index][musiconholdstop]',_0x5a4c71[_0x8c84('0x20')]),_0x5a2ec7);}});ami['on'](_0x8c84('0x31'),function(_0x1da0d5){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')]('[%s][index][newstate]',_0x1da0d5['uniqueid']),_0x1da0d5);calls[_0x8c84('0x31')](_0x1da0d5);recordings[_0x8c84('0x31')](_0x1da0d5);}catch(_0xef13bb){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')](_0x8c84('0x32'),_0x1da0d5[_0x8c84('0x20')]),_0xef13bb);}});ami['on'](_0x8c84('0x33'),function(_0x46c72e){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')](_0x8c84('0x34'),_0x46c72e[_0x8c84('0x20')]),_0x46c72e);calls[_0x8c84('0x33')](_0x46c72e);recordings['hangup'](_0x46c72e);dials[_0x8c84('0x33')](_0x46c72e);agents['hangup'](_0x46c72e);queues[_0x8c84('0x33')](_0x46c72e);}catch(_0x44571a){utils[_0x8c84('0x17')](util['format'](_0x8c84('0x34'),_0x46c72e[_0x8c84('0x20')]),_0x44571a);}});ami['on'](_0x8c84('0x35'),function(_0x52b485){try{utils[_0x8c84('0x1f')](util['format'](_0x8c84('0x36'),_0x52b485[_0x8c84('0x20')]),_0x52b485);members['cdr'](_0x52b485);}catch(_0x74ee81){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')](_0x8c84('0x36'),_0x52b485['uniqueid']),_0x74ee81);}});ami['on'](_0x8c84('0x37'),function(_0x1c3d0c){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')](_0x8c84('0x38'),_0x1c3d0c[_0x8c84('0x20')]),_0x1c3d0c);queues[_0x8c84('0x37')](_0x1c3d0c);agents[_0x8c84('0x37')](_0x1c3d0c);transfers[_0x8c84('0x37')](_0x1c3d0c);recordings[_0x8c84('0x37')](_0x1c3d0c);}catch(_0x54cb96){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')]('[%s][index][blindtransfer]',_0x1c3d0c[_0x8c84('0x20')]),_0x54cb96);}});ami['on']('attendedtransfer',function(_0x4cd1c0){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')]('[%s][index][attendedtransfer]',_0x4cd1c0[_0x8c84('0x39')]),_0x4cd1c0);queues['attendedtransfer'](_0x4cd1c0);transfers[_0x8c84('0x3a')](_0x4cd1c0);agents[_0x8c84('0x3a')](_0x4cd1c0);calls[_0x8c84('0x3a')](_0x4cd1c0);}catch(_0x378337){utils['error'](util[_0x8c84('0x1b')](_0x8c84('0x3b'),_0x4cd1c0[_0x8c84('0x39')]),_0x378337);}});ami['on'](_0x8c84('0x3c'),function(_0xafbbd){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')](_0x8c84('0x3d'),_0xafbbd[_0x8c84('0x20')]),_0xafbbd);queues[_0x8c84('0x3c')](_0xafbbd);recordings[_0x8c84('0x3c')](_0xafbbd);calls[_0x8c84('0x3c')](_0xafbbd);dials[_0x8c84('0x3c')](_0xafbbd);}catch(_0x159ea3){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')](_0x8c84('0x3d'),_0xafbbd[_0x8c84('0x20')]),_0x159ea3);}});ami['on']('newexten',function(_0x22b9c5){try{utils['debug'](util[_0x8c84('0x1b')](_0x8c84('0x3e'),_0x22b9c5[_0x8c84('0x20')]),_0x22b9c5);calls[_0x8c84('0x3f')](_0x22b9c5);recordings['newexten'](_0x22b9c5);dials[_0x8c84('0x3f')](_0x22b9c5);}catch(_0x4d9de7){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')](_0x8c84('0x3e'),_0x22b9c5[_0x8c84('0x20')]),_0x4d9de7);}});ami['on']('newchannel',function(_0x343d6a){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')](_0x8c84('0x40'),_0x343d6a[_0x8c84('0x20')]),_0x343d6a);calls['newchannel'](_0x343d6a);recordings[_0x8c84('0x41')](_0x343d6a);}catch(_0x5b4d32){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')](_0x8c84('0x40'),_0x343d6a[_0x8c84('0x20')]),_0x5b4d32);}});ami['on'](_0x8c84('0x42'),function(_0x4f4762){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')](_0x8c84('0x43'),_0x4f4762[_0x8c84('0x20')]),_0x4f4762);dials[_0x8c84('0x42')](_0x4f4762);}catch(_0x44699a){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')](_0x8c84('0x44'),_0x4f4762['uniqueid']),_0x44699a);}});ami['on'](_0x8c84('0x45'),function(_0x289ccb){try{utils[_0x8c84('0x1f')](util[_0x8c84('0x1b')](_0x8c84('0x46'),_0x289ccb[_0x8c84('0x20')]),_0x289ccb);dials[_0x8c84('0x45')](_0x289ccb);}catch(_0x34ec73){utils[_0x8c84('0x17')](util[_0x8c84('0x1b')]('[%s][index][dialend]',_0x289ccb[_0x8c84('0x20')]),_0x34ec73);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8ca6b25..88a619d 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 _0x297b=['devicestatechange','debug','device','info','INUSE','BUSY','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','split','data1','type','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','then','membername','internal','CreateMemberReport','name','request','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith'];(function(_0x57cf37,_0x149b89){var _0x2df46f=function(_0x70283c){while(--_0x70283c){_0x57cf37['push'](_0x57cf37['shift']());}};_0x2df46f(++_0x149b89);}(_0x297b,0x85));var _0xb297=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x297b[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0xb297('0x0'));var util=require('util');var utils=require(_0xb297('0x1'));var members={};var exclude=[_0xb297('0x2'),_0xb297('0x3')];function writeDB(_0x5cbd91){utils['info'](util[_0xb297('0x4')](_0xb297('0x5'),_0x5cbd91['uniqueid'],_0x5cbd91[_0xb297('0x6')],_0x5cbd91[_0xb297('0x7')],_0x5cbd91['data2'],_0x5cbd91['membername'],_0x5cbd91['type']));if(_0x5cbd91[_0xb297('0x6')]){utils['getUserByInterface'](_0x5cbd91['interface'])[_0xb297('0x8')](function(_0x522bd4){if(_0x522bd4){_0x5cbd91[_0xb297('0x9')]=_0x522bd4['name'];_0x5cbd91['internal']=_0x522bd4[_0xb297('0xa')];utils['request'](_0xb297('0xb'),_0x5cbd91);}else{utils['getUserByName'](_0x5cbd91['interface']['split']('/')[0x1])[_0xb297('0x8')](function(_0x24818e){if(_0x24818e){_0x5cbd91[_0xb297('0x9')]=_0x24818e[_0xb297('0xc')];_0x5cbd91[_0xb297('0xa')]=_0x24818e['internal'];utils[_0xb297('0xd')]('CreateMemberReport',_0x5cbd91);}});}})[_0xb297('0xe')](function(_0x1cb3c2){utils[_0xb297('0xf')](util['format'](_0xb297('0x10'),_0x5cbd91[_0xb297('0x11')]),_0x1cb3c2);});}delete members[_0x5cbd91[_0xb297('0x6')]];}function startsWith(_0x2187a8,_0x5ddea4){return _[_0xb297('0x12')](_0x2187a8,function(_0x4b1933){return _[_0xb297('0x13')](_0x5ddea4,_0x4b1933);});}exports[_0xb297('0x14')]=function(_0x53823d){try{utils[_0xb297('0x15')](util[_0xb297('0x4')]('[%s][members][devicestatechange]',members[_0x53823d[_0xb297('0x16')]]?members[_0x53823d[_0xb297('0x16')]][_0xb297('0x11')]:_0x53823d['device']),_0x53823d);utils[_0xb297('0x17')](util[_0xb297('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x53823d[_0xb297('0x16')]]?members[_0x53823d['device']][_0xb297('0x11')]:_0x53823d[_0xb297('0x16')],_0x53823d['state'],_0x53823d[_0xb297('0x16')]));switch(_0x53823d['state']){case _0xb297('0x18'):case _0xb297('0x19'):if(!startsWith(exclude,_0x53823d[_0xb297('0x16')])){members[_0x53823d[_0xb297('0x16')]]={'channel':'voice','interface':_0x53823d['device'],'type':'TALKING','enterAt':utils[_0xb297('0x1a')](),'role':_0xb297('0x1b')};}break;case _0xb297('0x1c'):if(!_[_0xb297('0x1d')](members[_0x53823d[_0xb297('0x16')]])){members[_0x53823d[_0xb297('0x16')]][_0xb297('0x1e')]=utils[_0xb297('0x1a')]();members[_0x53823d[_0xb297('0x16')]][_0xb297('0x1f')]=utils[_0xb297('0x20')](members[_0x53823d[_0xb297('0x16')]][_0xb297('0x1e')],members[_0x53823d['device']][_0xb297('0x21')]);if(members[_0x53823d[_0xb297('0x16')]][_0xb297('0x11')]){writeDB(members[_0x53823d[_0xb297('0x16')]]);}}break;default:break;}}catch(_0x3fe4f8){utils[_0xb297('0xf')](util[_0xb297('0x4')](_0xb297('0x22'),members[_0x53823d['device']]?members[_0x53823d[_0xb297('0x16')]][_0xb297('0x11')]:_0x53823d[_0xb297('0x16')]),_0x3fe4f8);}};exports[_0xb297('0x23')]=function(_0x428d12){try{if(!_['isNil'](members[_0x428d12[_0xb297('0x6')]])){utils['debug'](util[_0xb297('0x4')](_0xb297('0x24'),_0x428d12[_0xb297('0x11')]),_0x428d12);utils['info'](util['format'](_0xb297('0x25'),_0x428d12[_0xb297('0x11')],_0x428d12[_0xb297('0x6')],_0x428d12[_0xb297('0x26')]));members[_0x428d12[_0xb297('0x6')]]=_[_0xb297('0x27')](members[_0x428d12[_0xb297('0x6')]],{'data4':_0x428d12[_0xb297('0x26')],'uniqueid':_0x428d12[_0xb297('0x11')]});}}catch(_0x401506){utils[_0xb297('0xf')](util['format'](_0xb297('0x24'),_0x428d12[_0xb297('0x11')]),_0x401506);}};exports[_0xb297('0x28')]=function(_0xaea1cc){try{utils['debug'](util[_0xb297('0x4')](_0xb297('0x29'),_0xaea1cc[_0xb297('0x11')]),_0xaea1cc);if(_0xaea1cc[_0xb297('0x7')]){var _0x2a6919=_0xaea1cc[_0xb297('0x7')][_0xb297('0x2a')]('-')[0x0];if(!_[_0xb297('0x1d')](members[_0x2a6919])){members[_0x2a6919]=_['assign'](members[_0x2a6919],{'data1':members[_0x2a6919][_0xb297('0x2b')]||_0xaea1cc[_0xb297('0x2c')],'data2':members[_0x2a6919][_0xb297('0x2d')]||_0xaea1cc['source'],'data3':members[_0x2a6919][_0xb297('0x2e')]||_0xaea1cc[_0xb297('0x2f')],'uniqueid':members[_0x2a6919][_0xb297('0x11')]||_0xaea1cc[_0xb297('0x11')]});utils[_0xb297('0x17')](util['format'](_0xb297('0x30'),_0xaea1cc[_0xb297('0x11')],members[_0x2a6919][_0xb297('0x2b')],members[_0x2a6919][_0xb297('0x2d')],members[_0x2a6919][_0xb297('0x2e')]));if(members[_0x2a6919]['exitAt']){writeDB(members[_0x2a6919]);}}}if(_0xaea1cc[_0xb297('0x31')]){var _0x30b6ef=_0xaea1cc[_0xb297('0x31')][_0xb297('0x2a')]('-')[0x0];if(!_['isNil'](members[_0x30b6ef])){members[_0x30b6ef]=_[_0xb297('0x27')](members[_0x30b6ef],{'data1':members[_0x30b6ef][_0xb297('0x2b')]||_0xaea1cc[_0xb297('0x2c')],'data2':members[_0x30b6ef][_0xb297('0x2d')]||_0xaea1cc[_0xb297('0x32')],'data3':members[_0x30b6ef][_0xb297('0x2e')]||_0xaea1cc[_0xb297('0x2f')],'uniqueid':members[_0x30b6ef][_0xb297('0x11')]||_0xaea1cc['uniqueid']});utils[_0xb297('0x17')](util['format'](_0xb297('0x30'),_0xaea1cc[_0xb297('0x11')],members[_0x30b6ef][_0xb297('0x2b')],members[_0x30b6ef][_0xb297('0x2d')],members[_0x30b6ef][_0xb297('0x2e')]));if(members[_0x30b6ef][_0xb297('0x1e')]){writeDB(members[_0x30b6ef]);}}}}catch(_0x51da4f){utils['error'](util[_0xb297('0x4')]('[%s][members][cdr]',_0xaea1cc[_0xb297('0x11')]),_0x51da4f);}}; \ No newline at end of file +var _0xfb68=['name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','now','agent','NOT_INUSE','duration','exitAt','agentcomplete','isNil','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','source','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then'];(function(_0x266654,_0x44f52b){var _0x373544=function(_0xe6d8de){while(--_0xe6d8de){_0x266654['push'](_0x266654['shift']());}};_0x373544(++_0x44f52b);}(_0xfb68,0x1d2));var _0x8fb6=function(_0x2935a5,_0x2252ca){_0x2935a5=_0x2935a5-0x0;var _0x3bafa6=_0xfb68[_0x2935a5];return _0x3bafa6;};'use strict';var _=require(_0x8fb6('0x0'));var util=require(_0x8fb6('0x1'));var utils=require(_0x8fb6('0x2'));var members={};var exclude=[_0x8fb6('0x3'),_0x8fb6('0x4')];function writeDB(_0x5b1aea){utils['info'](util[_0x8fb6('0x5')](_0x8fb6('0x6'),_0x5b1aea[_0x8fb6('0x7')],_0x5b1aea[_0x8fb6('0x8')],_0x5b1aea[_0x8fb6('0x9')],_0x5b1aea['data2'],_0x5b1aea[_0x8fb6('0xa')],_0x5b1aea[_0x8fb6('0xb')]));if(_0x5b1aea[_0x8fb6('0x8')]){utils[_0x8fb6('0xc')](_0x5b1aea[_0x8fb6('0x8')])[_0x8fb6('0xd')](function(_0x368988){if(_0x368988){_0x5b1aea['membername']=_0x368988[_0x8fb6('0xe')];_0x5b1aea['internal']=_0x368988[_0x8fb6('0xf')];utils['request'](_0x8fb6('0x10'),_0x5b1aea);}else{utils[_0x8fb6('0x11')](_0x5b1aea['interface'][_0x8fb6('0x12')]('/')[0x1])[_0x8fb6('0xd')](function(_0x28d16b){if(_0x28d16b){_0x5b1aea[_0x8fb6('0xa')]=_0x28d16b[_0x8fb6('0xe')];_0x5b1aea['internal']=_0x28d16b[_0x8fb6('0xf')];utils[_0x8fb6('0x13')]('CreateMemberReport',_0x5b1aea);}});}})[_0x8fb6('0x14')](function(_0x287935){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')](_0x8fb6('0x16'),_0x5b1aea[_0x8fb6('0x7')]),_0x287935);});}delete members[_0x5b1aea[_0x8fb6('0x8')]];}function startsWith(_0x11543c,_0x10db95){return _['some'](_0x11543c,function(_0x551c16){return _[_0x8fb6('0x17')](_0x10db95,_0x551c16);});}exports[_0x8fb6('0x18')]=function(_0x259deb){try{utils[_0x8fb6('0x19')](util[_0x8fb6('0x5')](_0x8fb6('0x1a'),members[_0x259deb[_0x8fb6('0x1b')]]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb[_0x8fb6('0x1b')]),_0x259deb);utils['info'](util[_0x8fb6('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x259deb['device']]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb['device'],_0x259deb['state'],_0x259deb[_0x8fb6('0x1b')]));switch(_0x259deb[_0x8fb6('0x1c')]){case'INUSE':case _0x8fb6('0x1d'):if(!startsWith(exclude,_0x259deb['device'])){members[_0x259deb['device']]={'channel':'voice','interface':_0x259deb[_0x8fb6('0x1b')],'type':'TALKING','enterAt':utils[_0x8fb6('0x1e')](),'role':_0x8fb6('0x1f')};}break;case _0x8fb6('0x20'):if(!_['isNil'](members[_0x259deb[_0x8fb6('0x1b')]])){members[_0x259deb[_0x8fb6('0x1b')]]['exitAt']=utils[_0x8fb6('0x1e')]();members[_0x259deb['device']][_0x8fb6('0x21')]=utils['diffTime'](members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x22')],members[_0x259deb[_0x8fb6('0x1b')]]['enterAt']);if(members[_0x259deb['device']]['uniqueid']){writeDB(members[_0x259deb[_0x8fb6('0x1b')]]);}}break;default:break;}}catch(_0x443cce){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')]('[%s][members][devicestatechange]',members[_0x259deb[_0x8fb6('0x1b')]]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb[_0x8fb6('0x1b')]),_0x443cce);}};exports[_0x8fb6('0x23')]=function(_0x4438c3){try{if(!_[_0x8fb6('0x24')](members[_0x4438c3['interface']])){utils[_0x8fb6('0x19')](util[_0x8fb6('0x5')]('[%s][members][agentcomplete]',_0x4438c3['uniqueid']),_0x4438c3);utils[_0x8fb6('0x25')](util['format'](_0x8fb6('0x26'),_0x4438c3[_0x8fb6('0x7')],_0x4438c3[_0x8fb6('0x8')],_0x4438c3[_0x8fb6('0x27')]));members[_0x4438c3['interface']]=_[_0x8fb6('0x28')](members[_0x4438c3[_0x8fb6('0x8')]],{'data4':_0x4438c3[_0x8fb6('0x27')],'uniqueid':_0x4438c3[_0x8fb6('0x7')]});}}catch(_0xcdecf0){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')]('[%s][members][agentcomplete]',_0x4438c3[_0x8fb6('0x7')]),_0xcdecf0);}};exports['cdr']=function(_0x44236a){try{utils[_0x8fb6('0x19')](util['format'](_0x8fb6('0x29'),_0x44236a[_0x8fb6('0x7')]),_0x44236a);if(_0x44236a[_0x8fb6('0x9')]){var _0x35898f=_0x44236a[_0x8fb6('0x9')][_0x8fb6('0x12')]('-')[0x0];if(!_['isNil'](members[_0x35898f])){members[_0x35898f]=_[_0x8fb6('0x28')](members[_0x35898f],{'data1':members[_0x35898f]['data1']||_0x44236a[_0x8fb6('0xb')],'data2':members[_0x35898f][_0x8fb6('0x2a')]||_0x44236a['source'],'data3':members[_0x35898f][_0x8fb6('0x2b')]||_0x44236a[_0x8fb6('0x2c')],'uniqueid':members[_0x35898f]['uniqueid']||_0x44236a[_0x8fb6('0x7')]});utils['info'](util['format'](_0x8fb6('0x2d'),_0x44236a[_0x8fb6('0x7')],members[_0x35898f][_0x8fb6('0x2e')],members[_0x35898f]['data2'],members[_0x35898f]['data3']));if(members[_0x35898f][_0x8fb6('0x22')]){writeDB(members[_0x35898f]);}}}if(_0x44236a['destinationchannel']){var _0x5d9a95=_0x44236a['destinationchannel']['split']('-')[0x0];if(!_[_0x8fb6('0x24')](members[_0x5d9a95])){members[_0x5d9a95]=_['assign'](members[_0x5d9a95],{'data1':members[_0x5d9a95][_0x8fb6('0x2e')]||_0x44236a[_0x8fb6('0xb')],'data2':members[_0x5d9a95][_0x8fb6('0x2a')]||_0x44236a[_0x8fb6('0x2f')],'data3':members[_0x5d9a95][_0x8fb6('0x2b')]||_0x44236a['destination'],'uniqueid':members[_0x5d9a95][_0x8fb6('0x7')]||_0x44236a['uniqueid']});utils[_0x8fb6('0x25')](util[_0x8fb6('0x5')](_0x8fb6('0x2d'),_0x44236a[_0x8fb6('0x7')],members[_0x5d9a95][_0x8fb6('0x2e')],members[_0x5d9a95][_0x8fb6('0x2a')],members[_0x5d9a95][_0x8fb6('0x2b')]));if(members[_0x5d9a95]['exitAt']){writeDB(members[_0x5d9a95]);}}}}catch(_0x306f7c){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')](_0x8fb6('0x29'),_0x44236a[_0x8fb6('0x7')]),_0x306f7c);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a46bc68..75d3e79 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 _0x1568=['debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','connectedlinenum','queuecallerleave','diffTime','count','connectedlinename','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1568,0x18a));var _0x8156=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1568[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8156('0x0'));var utils=require(_0x8156('0x1'));var queues={};function writeDB(_0x5df9d8){utils[_0x8156('0x2')](util[_0x8156('0x3')](_0x8156('0x4'),_0x5df9d8[_0x8156('0x5')],_0x5df9d8['channel'],_0x5df9d8['queue'],_0x5df9d8[_0x8156('0x6')],_0x5df9d8[_0x8156('0x7')],_0x5df9d8[_0x8156('0x8')],_0x5df9d8[_0x8156('0x9')]));if(_0x5df9d8[_0x8156('0xa')]){utils[_0x8156('0xb')](_0x5df9d8[_0x8156('0xa')])[_0x8156('0xc')](function(_0x29df96){if(_0x29df96){_0x5df9d8[_0x8156('0xd')]=_0x29df96[_0x8156('0xd')];}utils['request'](_0x8156('0xe'),_0x5df9d8);});}else{utils[_0x8156('0xf')](_0x8156('0xe'),_0x5df9d8);}if(_0x5df9d8[_0x8156('0x10')]){delete queues[_0x5df9d8[_0x8156('0x10')]];}else{delete queues[_0x5df9d8['uniqueid']];}}exports[_0x8156('0x11')]=function(_0x262b48){try{utils[_0x8156('0x12')](util[_0x8156('0x3')](_0x8156('0x13'),_0x262b48[_0x8156('0x5')]),_0x262b48);utils['info'](util[_0x8156('0x3')](_0x8156('0x14'),_0x262b48[_0x8156('0x5')],_0x262b48['queue'],_0x262b48[_0x8156('0x15')]));queues[_0x262b48['uniqueid']]=_[_0x8156('0x16')](_0x262b48,{'originalposition':_0x262b48[_0x8156('0x15')],'queuecallerjoinAt':utils[_0x8156('0x17')](),'mohtime':0x0});}catch(_0x319ded){utils[_0x8156('0x18')](util[_0x8156('0x3')](_0x8156('0x13'),_0x262b48[_0x8156('0x5')]),_0x319ded);}};exports['hangup']=function(_0x6b414b){try{if(!_[_0x8156('0x19')](queues[_0x6b414b[_0x8156('0x5')]])){utils['debug'](util['format'](_0x8156('0x1a'),_0x6b414b[_0x8156('0x5')]),_0x6b414b);if(queues[_0x6b414b[_0x8156('0x5')]][_0x8156('0x1b')]){if(!queues[_0x6b414b['uniqueid']]['queuecallerabandon']&&!queues[_0x6b414b[_0x8156('0x5')]][_0x8156('0x1c')]){queues[_0x6b414b['uniqueid']][_0x8156('0x1d')]=!![];queues[_0x6b414b[_0x8156('0x5')]]['queuecallercompleteAt']=utils[_0x8156('0x17')]();queues[_0x6b414b[_0x8156('0x5')]][_0x8156('0x9')]=_0x8156('0x1e');}utils[_0x8156('0x2')](util[_0x8156('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x6b414b['uniqueid'],queues[_0x6b414b[_0x8156('0x5')]][_0x8156('0x1f')],queues[_0x6b414b[_0x8156('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x6b414b[_0x8156('0x5')]]);}else if(queues[_0x6b414b[_0x8156('0x5')]][_0x8156('0x10')]){utils[_0x8156('0x2')](util['format'](_0x8156('0x20'),_0x6b414b['uniqueid'],queues[_0x6b414b[_0x8156('0x5')]][_0x8156('0x1f')],queues[_0x6b414b['uniqueid']]['transfereduniqueid']));queues[queues[_0x6b414b[_0x8156('0x5')]][_0x8156('0x10')]]=queues[_0x6b414b[_0x8156('0x5')]];queues[queues[_0x6b414b[_0x8156('0x5')]][_0x8156('0x10')]][_0x8156('0x21')]=0x2;delete queues[_0x6b414b[_0x8156('0x5')]];}}}catch(_0x2b987f){utils[_0x8156('0x18')](util['format'](_0x8156('0x1a'),_0x6b414b[_0x8156('0x5')]),_0x2b987f);}};exports[_0x8156('0x22')]=function(_0x52da83){try{utils[_0x8156('0x12')](util[_0x8156('0x3')]('[%s][queues][varset]',_0x52da83[_0x8156('0x5')]),_0x52da83);if(!_[_0x8156('0x19')](_0x52da83[_0x8156('0x23')][_0x8156('0x24')])&&_0x52da83[_0x8156('0x25')][_0x8156('0x26')]()!==_0x8156('0x27')){if(!_['isNil'](queues[_0x52da83[_0x8156('0x5')]])){queues[_0x52da83[_0x8156('0x5')]][_0x8156('0x28')]=![];queues[_0x52da83[_0x8156('0x5')]][_0x8156('0x29')]=null;queues[_0x52da83[_0x8156('0x5')]][_0x8156('0x1c')]=!![];queues[_0x52da83[_0x8156('0x5')]]['queuecallerexitAt']=utils[_0x8156('0x17')]();queues[_0x52da83[_0x8156('0x5')]][_0x8156('0x9')]=_0x52da83[_0x8156('0x25')][_0x8156('0x26')]();utils['info'](util[_0x8156('0x3')](_0x8156('0x2a'),_0x52da83[_0x8156('0x5')],queues[_0x52da83[_0x8156('0x5')]][_0x8156('0x1f')],_0x52da83[_0x8156('0x25')],queues[_0x52da83[_0x8156('0x5')]][_0x8156('0x9')]));writeDB(queues[_0x52da83[_0x8156('0x5')]]);}}else if(!_[_0x8156('0x19')](_0x52da83['variable']['queueposition'])){if(!_[_0x8156('0x19')](queues[_0x52da83[_0x8156('0x5')]])&&!queues[_0x52da83[_0x8156('0x5')]][_0x8156('0x28')]){queues[_0x52da83['uniqueid']]['queuecallerabandon']=![];queues[_0x52da83['uniqueid']][_0x8156('0x29')]=null;queues[_0x52da83[_0x8156('0x5')]]['queuecallerexit']=!![];queues[_0x52da83[_0x8156('0x5')]][_0x8156('0x2b')]=utils[_0x8156('0x17')]();queues[_0x52da83['uniqueid']][_0x8156('0x9')]=_0x8156('0x2c');utils[_0x8156('0x2')](util['format'](_0x8156('0x2d'),_0x52da83['uniqueid'],queues[_0x52da83[_0x8156('0x5')]]['name'],_0x52da83[_0x8156('0x25')],queues[_0x52da83['uniqueid']]['queuecallerexitreason']));}}}catch(_0x50618c){utils['error'](util['format'](_0x8156('0x2e'),_0x52da83[_0x8156('0x5')]),_0x50618c);}};exports[_0x8156('0x28')]=function(_0x477b95){try{if(!_[_0x8156('0x19')](queues[_0x477b95[_0x8156('0x5')]])){utils['debug'](util['format'](_0x8156('0x2f'),_0x477b95[_0x8156('0x5')]),_0x477b95);queues[_0x477b95[_0x8156('0x5')]][_0x8156('0x1c')]=![];queues[_0x477b95[_0x8156('0x5')]][_0x8156('0x2b')]=null;queues[_0x477b95[_0x8156('0x5')]]['queuecallerabandon']=!![];queues[_0x477b95[_0x8156('0x5')]][_0x8156('0x29')]=utils['now']();queues[_0x477b95['uniqueid']]['queuecallerexitreason']=_0x8156('0x30');utils[_0x8156('0x2')](util['format'](_0x8156('0x31'),_0x477b95[_0x8156('0x5')],queues[_0x477b95[_0x8156('0x5')]][_0x8156('0x1f')],queues[_0x477b95[_0x8156('0x5')]]['queuecallerexitreason']));}}catch(_0x1ca69e){utils['error'](util[_0x8156('0x3')]('[%s][queues][queuecallerabandon]',_0x477b95['uniqueid']),_0x1ca69e);}};exports['queuecallerleave']=function(_0x142e9e){try{if(!_['isNil'](queues[_0x142e9e['uniqueid']])){utils['debug'](util[_0x8156('0x3')]('[%s][queues][queuecallerleave]',_0x142e9e[_0x8156('0x5')]),_0x142e9e);utils['info'](util[_0x8156('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x142e9e[_0x8156('0x5')],queues[_0x142e9e[_0x8156('0x5')]][_0x8156('0x1f')],_0x142e9e[_0x8156('0x32')],_0x142e9e['connectedlinename']));queues[_0x142e9e[_0x8156('0x5')]][_0x8156('0x33')]=!![];queues[_0x142e9e['uniqueid']][_0x8156('0x1b')]=utils[_0x8156('0x17')]();queues[_0x142e9e[_0x8156('0x5')]]['holdtime']=utils[_0x8156('0x34')](queues[_0x142e9e['uniqueid']][_0x8156('0x1b')],queues[_0x142e9e[_0x8156('0x5')]]['queuecallerjoinAt']);queues[_0x142e9e[_0x8156('0x5')]]['position']=_0x142e9e['position'];queues[_0x142e9e['uniqueid']][_0x8156('0x35')]=_0x142e9e[_0x8156('0x35')];queues[_0x142e9e[_0x8156('0x5')]][_0x8156('0x32')]=_0x142e9e[_0x8156('0x32')];queues[_0x142e9e[_0x8156('0x5')]][_0x8156('0x36')]=_0x142e9e[_0x8156('0x36')];}}catch(_0x352a00){utils['error'](util[_0x8156('0x3')](_0x8156('0x37'),_0x142e9e[_0x8156('0x5')]),_0x352a00);}};exports[_0x8156('0x38')]=function(_0x108ccb){try{if(!_[_0x8156('0x19')](queues[_0x108ccb[_0x8156('0x5')]])){utils[_0x8156('0x12')](util[_0x8156('0x3')]('[%s][queues][agentconnect]',_0x108ccb[_0x8156('0x5')]),_0x108ccb);utils[_0x8156('0x2')](util[_0x8156('0x3')](_0x8156('0x39'),_0x108ccb[_0x8156('0x5')],queues[_0x108ccb[_0x8156('0x5')]][_0x8156('0x1f')],_0x108ccb[_0x8156('0x3a')],_0x108ccb['destaccountcode']));queues[_0x108ccb[_0x8156('0x5')]][_0x8156('0x28')]=![];queues[_0x108ccb[_0x8156('0x5')]][_0x8156('0x28')]=![];queues[_0x108ccb[_0x8156('0x5')]][_0x8156('0x29')]=null;queues[_0x108ccb['uniqueid']][_0x8156('0x1c')]=![];queues[_0x108ccb[_0x8156('0x5')]][_0x8156('0x9')]=null;queues[_0x108ccb[_0x8156('0x5')]]['queuecallerexitAt']=null;queues[_0x108ccb['uniqueid']]['assigned']=!![];queues[_0x108ccb[_0x8156('0x5')]][_0x8156('0x8')]=_0x108ccb[_0x8156('0x3b')];queues[_0x108ccb[_0x8156('0x5')]]['lastAssignedTo']=_0x108ccb['membername'];}}catch(_0x297356){utils[_0x8156('0x18')](util[_0x8156('0x3')](_0x8156('0x3c'),_0x108ccb[_0x8156('0x5')]),_0x297356);}};exports[_0x8156('0x3d')]=function(_0x42abfe){try{if(!_[_0x8156('0x19')](queues[_0x42abfe[_0x8156('0x5')]])){if(queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x1b')]){utils[_0x8156('0x12')](util['format'](_0x8156('0x3e'),_0x42abfe[_0x8156('0x5')]),_0x42abfe);queues[_0x42abfe['uniqueid']][_0x8156('0x28')]=![];queues[_0x42abfe[_0x8156('0x5')]]['queuecallerabandon']=![];queues[_0x42abfe[_0x8156('0x5')]]['queuecallerabandonAt']=null;queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x1c')]=![];queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x2b')]=null;queues[_0x42abfe['uniqueid']]['assigned']=!![];queues[_0x42abfe['uniqueid']][_0x8156('0x6')]=_0x42abfe[_0x8156('0x3a')];queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x1d')]=!![];queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x3f')]=utils[_0x8156('0x17')]();if(_0x42abfe[_0x8156('0x40')]==_0x8156('0x41')){if(!queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x41')]){queues[_0x42abfe['uniqueid']][_0x8156('0x9')]=_0x8156('0x42');}}else{queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x9')]=_0x8156('0x43')+_0x42abfe[_0x8156('0x40')][_0x8156('0x26')]();}utils['info'](util[_0x8156('0x3')](_0x8156('0x44'),_0x42abfe[_0x8156('0x5')],queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x1f')],_0x42abfe[_0x8156('0x3a')],queues[_0x42abfe[_0x8156('0x5')]][_0x8156('0x9')]));writeDB(queues[_0x42abfe[_0x8156('0x5')]]);}}}catch(_0x4fffac){utils[_0x8156('0x18')](util[_0x8156('0x3')](_0x8156('0x3e'),_0x42abfe[_0x8156('0x5')]),_0x4fffac);}};exports[_0x8156('0x45')]=function(_0x24b61e){try{if(!_[_0x8156('0x19')](queues[_0x24b61e['transfereeuniqueid']])){utils[_0x8156('0x12')](util[_0x8156('0x3')](_0x8156('0x46'),_0x24b61e[_0x8156('0x5')]),_0x24b61e);queues[_0x24b61e['transfereeuniqueid']][_0x8156('0x41')]=!![];queues[_0x24b61e[_0x8156('0x47')]][_0x8156('0x48')]='BLIND';queues[_0x24b61e[_0x8156('0x47')]]['transferexten']=_0x24b61e[_0x8156('0x49')];queues[_0x24b61e[_0x8156('0x47')]][_0x8156('0x4a')]=_0x24b61e[_0x8156('0x47')];queues[_0x24b61e['transfereeuniqueid']][_0x8156('0x9')]='BLINDTRANSFER';utils[_0x8156('0x2')](util[_0x8156('0x3')](_0x8156('0x4b'),_0x24b61e[_0x8156('0x5')],queues[_0x24b61e['transfereeuniqueid']][_0x8156('0x1f')],_0x24b61e['transfereeuniqueid'],_0x24b61e[_0x8156('0x49')]));}}catch(_0x17227c){utils[_0x8156('0x18')](util[_0x8156('0x3')](_0x8156('0x46'),_0x24b61e[_0x8156('0x5')]),_0x17227c);}};exports[_0x8156('0x4c')]=function(_0x525551){try{utils['debug'](util[_0x8156('0x3')](_0x8156('0x4d'),_0x525551['origtransfereruniqueid']),_0x525551);if(_0x525551[_0x8156('0x4e')]==_0x525551[_0x8156('0x4f')]){if(!_[_0x8156('0x19')](queues[_0x525551['secondtransfererlinkedid']])){utils[_0x8156('0x2')](util[_0x8156('0x3')](_0x8156('0x50'),_0x525551['origtransfereruniqueid'],queues[_0x525551['secondtransfererlinkedid']]['name'],_0x525551['origtransfererexten']));queues[_0x525551[_0x8156('0x51')]][_0x8156('0x41')]=!![];queues[_0x525551['secondtransfererlinkedid']][_0x8156('0x48')]='ATTENDED';queues[_0x525551[_0x8156('0x51')]][_0x8156('0x52')]=_0x525551['origtransfererexten'];queues[_0x525551[_0x8156('0x51')]]['transferuniqueid']=_0x525551[_0x8156('0x4e')];queues[_0x525551[_0x8156('0x51')]][_0x8156('0x9')]=_0x8156('0x53');}if(!_['isNil'](queues[_0x525551['origtransfererlinkedid']])){if(_0x525551[_0x8156('0x54')]&&queues[_0x525551['transfereelinkedid']]){queues[_0x525551[_0x8156('0x54')]]['queuecallerenterreason']=0x1;queues[_0x525551[_0x8156('0x47')]]=_[_0x8156('0x55')](queues[_0x525551[_0x8156('0x54')]]);queues[_0x525551['transfereeuniqueid']][_0x8156('0x10')]=_0x525551[_0x8156('0x56')];queues[_0x525551[_0x8156('0x47')]][_0x8156('0x21')]=0x2;queues[_0x525551['transfereeuniqueid']][_0x8156('0x7')]=queues[_0x525551[_0x8156('0x51')]][_0x8156('0x7')];queues[_0x525551['transfereeuniqueid']]['calleridname']=queues[_0x525551[_0x8156('0x51')]][_0x8156('0x57')];queues[_0x525551[_0x8156('0x47')]][_0x8156('0x58')]=utils[_0x8156('0x17')]();queues[_0x525551[_0x8156('0x47')]][_0x8156('0x1b')]=utils[_0x8156('0x17')]();queues[_0x525551['transfereeuniqueid']][_0x8156('0x59')]=0x0;queues[_0x525551[_0x8156('0x47')]][_0x8156('0x5a')]=0x0;utils['info'](util[_0x8156('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x525551[_0x8156('0x4e')],queues[_0x525551['transfereeuniqueid']][_0x8156('0x1f')],queues[_0x525551[_0x8156('0x47')]][_0x8156('0x7')],queues[_0x525551[_0x8156('0x47')]][_0x8156('0x57')]));}else{utils[_0x8156('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x525551[_0x8156('0x4e')],queues[_0x525551['origtransfererlinkedid']]['name'],_0x525551[_0x8156('0x51')]));queues[_0x525551[_0x8156('0x4f')]]['transfereduniqueid']=_0x525551['secondtransfererlinkedid'];}}}else if(_0x525551[_0x8156('0x5b')]==_0x525551['secondtransfererlinkedid']){if(!_[_0x8156('0x19')](queues[_0x525551['origtransfererlinkedid']])){utils['info'](util[_0x8156('0x3')](_0x8156('0x5c'),_0x525551[_0x8156('0x4e')],queues[_0x525551[_0x8156('0x4f')]][_0x8156('0x1f')],_0x525551['secondtransfereruniqueid'],_0x525551[_0x8156('0x5d')]));queues[_0x525551[_0x8156('0x4f')]][_0x8156('0x41')]=!![];queues[_0x525551['origtransfererlinkedid']][_0x8156('0x48')]=_0x8156('0x5e');queues[_0x525551['origtransfererlinkedid']]['transferexten']=_0x525551[_0x8156('0x5d')];queues[_0x525551['origtransfererlinkedid']][_0x8156('0x4a')]=_0x525551['secondtransfereruniqueid'];queues[_0x525551[_0x8156('0x4f')]][_0x8156('0x9')]=_0x8156('0x53');}if(!_[_0x8156('0x19')](queues[_0x525551['secondtransfererlinkedid']])){if(_0x525551[_0x8156('0x5f')]&&queues[_0x525551[_0x8156('0x5f')]]){queues[_0x525551[_0x8156('0x5f')]][_0x8156('0x21')]=0x1;queues[_0x525551[_0x8156('0x56')]]=_['clone'](queues[_0x525551[_0x8156('0x5f')]]);queues[_0x525551[_0x8156('0x56')]][_0x8156('0x10')]=_0x525551[_0x8156('0x56')];queues[_0x525551[_0x8156('0x56')]][_0x8156('0x21')]=0x2;queues[_0x525551['transfertargetuniqueid']][_0x8156('0x7')]=queues[_0x525551[_0x8156('0x4f')]][_0x8156('0x7')];queues[_0x525551[_0x8156('0x56')]][_0x8156('0x57')]=queues[_0x525551['origtransfererlinkedid']]['calleridname'];queues[_0x525551['transfertargetuniqueid']][_0x8156('0x58')]=utils['now']();queues[_0x525551[_0x8156('0x56')]][_0x8156('0x1b')]=utils[_0x8156('0x17')]();queues[_0x525551['transfertargetuniqueid']][_0x8156('0x59')]=0x0;queues[_0x525551[_0x8156('0x56')]][_0x8156('0x5a')]=0x0;utils['info'](util[_0x8156('0x3')](_0x8156('0x60'),_0x525551['origtransfereruniqueid'],queues[_0x525551[_0x8156('0x56')]][_0x8156('0x1f')],queues[_0x525551[_0x8156('0x56')]][_0x8156('0x10')],queues[_0x525551[_0x8156('0x56')]][_0x8156('0x7')],queues[_0x525551[_0x8156('0x56')]][_0x8156('0x57')]));}else{utils[_0x8156('0x2')](util['format'](_0x8156('0x61'),_0x525551[_0x8156('0x4e')],queues[_0x525551[_0x8156('0x51')]]['name'],_0x525551[_0x8156('0x4f')]));queues[_0x525551[_0x8156('0x51')]][_0x8156('0x10')]=_0x525551['origtransfererlinkedid'];}}}}catch(_0x57783c){utils[_0x8156('0x18')](util[_0x8156('0x3')](_0x8156('0x4d'),_0x525551[_0x8156('0x4e')]),_0x57783c);}};exports[_0x8156('0x62')]=function(_0x110715){try{if(!_[_0x8156('0x19')](queues[_0x110715['uniqueid']])){utils[_0x8156('0x12')](util['format'](_0x8156('0x63'),_0x110715[_0x8156('0x5')]),_0x110715);queues[_0x110715[_0x8156('0x5')]]['musiconholdstartAt']=utils[_0x8156('0x17')]();utils[_0x8156('0x2')](util[_0x8156('0x3')](_0x8156('0x64'),_0x110715['uniqueid'],queues[_0x110715[_0x8156('0x5')]][_0x8156('0x1f')],queues[_0x110715[_0x8156('0x5')]][_0x8156('0x65')]));}}catch(_0x4f2c21){utils['error'](util['format'](_0x8156('0x63'),_0x110715[_0x8156('0x5')]),_0x4f2c21);}};exports['musiconholdstop']=function(_0x77360c){try{if(!_[_0x8156('0x19')](queues[_0x77360c[_0x8156('0x5')]])){if(!_[_0x8156('0x19')](queues[_0x77360c[_0x8156('0x5')]][_0x8156('0x65')])){utils[_0x8156('0x12')](util[_0x8156('0x3')](_0x8156('0x66'),_0x77360c[_0x8156('0x5')]),_0x77360c);queues[_0x77360c['uniqueid']][_0x8156('0x5a')]+=utils[_0x8156('0x34')](utils[_0x8156('0x17')](),queues[_0x77360c[_0x8156('0x5')]][_0x8156('0x65')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x77360c['uniqueid'],queues[_0x77360c[_0x8156('0x5')]][_0x8156('0x1f')],queues[_0x77360c[_0x8156('0x5')]][_0x8156('0x5a')]));delete queues[_0x77360c[_0x8156('0x5')]]['musiconholdstartAt'];}}}catch(_0xe8008d){utils[_0x8156('0x18')](util['format'](_0x8156('0x66'),_0x77360c['uniqueid']),_0xe8008d);}}; \ No newline at end of file +var _0x15c9=['origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridname','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','ATTENDEDTRANSFER','transfertargetlinkedid','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','[%s][queues][queuecallerjoin]','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','lastAssignedTo','agentcomplete','queuecallercomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15c9,0x1b1));var _0x915c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x15c9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x915c('0x0'));var utils=require(_0x915c('0x1'));var queues={};function writeDB(_0x3115c3){utils['info'](util[_0x915c('0x2')](_0x915c('0x3'),_0x3115c3[_0x915c('0x4')],_0x3115c3[_0x915c('0x5')],_0x3115c3[_0x915c('0x6')],_0x3115c3['lastAssignedTo'],_0x3115c3[_0x915c('0x7')],_0x3115c3[_0x915c('0x8')],_0x3115c3['queuecallerexitreason']));if(_0x3115c3[_0x915c('0x6')]){utils[_0x915c('0x9')](_0x3115c3[_0x915c('0x6')])[_0x915c('0xa')](function(_0x383056){if(_0x383056){_0x3115c3[_0x915c('0xb')]=_0x383056[_0x915c('0xb')];}utils[_0x915c('0xc')]('CreateVoiceQueueReport',_0x3115c3);});}else{utils[_0x915c('0xc')](_0x915c('0xd'),_0x3115c3);}if(_0x3115c3[_0x915c('0xe')]){delete queues[_0x3115c3['transfereduniqueid']];}else{delete queues[_0x3115c3[_0x915c('0x4')]];}}exports[_0x915c('0xf')]=function(_0x3c6d37){try{utils['debug'](util[_0x915c('0x2')]('[%s][queues][queuecallerjoin]',_0x3c6d37['uniqueid']),_0x3c6d37);utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x11'),_0x3c6d37['uniqueid'],_0x3c6d37[_0x915c('0x6')],_0x3c6d37[_0x915c('0x12')]));queues[_0x3c6d37[_0x915c('0x4')]]=_[_0x915c('0x13')](_0x3c6d37,{'originalposition':_0x3c6d37['position'],'queuecallerjoinAt':utils[_0x915c('0x14')](),'mohtime':0x0});}catch(_0x4d6132){utils['error'](util[_0x915c('0x2')](_0x915c('0x15'),_0x3c6d37[_0x915c('0x4')]),_0x4d6132);}};exports['hangup']=function(_0x53e9b1){try{if(!_[_0x915c('0x16')](queues[_0x53e9b1[_0x915c('0x4')]])){utils[_0x915c('0x17')](util['format']('[%s][queues][hangup]',_0x53e9b1['uniqueid']),_0x53e9b1);if(queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0x18')]){if(!queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0x19')]&&!queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0x1a')]){queues[_0x53e9b1[_0x915c('0x4')]]['queuecallercomplete']=!![];queues[_0x53e9b1['uniqueid']][_0x915c('0x1b')]=utils[_0x915c('0x14')]();queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0x1c')]=_0x915c('0x1d');}utils['info'](util['format'](_0x915c('0x1e'),_0x53e9b1[_0x915c('0x4')],queues[_0x53e9b1[_0x915c('0x4')]]['name'],queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0x1c')]));writeDB(queues[_0x53e9b1['uniqueid']]);}else if(queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0xe')]){utils[_0x915c('0x10')](util['format'](_0x915c('0x1f'),_0x53e9b1[_0x915c('0x4')],queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0x20')],queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0xe')]));queues[queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0xe')]]=queues[_0x53e9b1[_0x915c('0x4')]];queues[queues[_0x53e9b1[_0x915c('0x4')]][_0x915c('0xe')]][_0x915c('0x21')]=0x2;delete queues[_0x53e9b1['uniqueid']];}}}catch(_0x54e771){utils[_0x915c('0x22')](util['format']('[%s][queues][hangup]',_0x53e9b1[_0x915c('0x4')]),_0x54e771);}};exports[_0x915c('0x23')]=function(_0x23fd68){try{utils[_0x915c('0x17')](util[_0x915c('0x2')](_0x915c('0x24'),_0x23fd68[_0x915c('0x4')]),_0x23fd68);if(!_['isNil'](_0x23fd68[_0x915c('0x25')]['queuestatus'])&&_0x23fd68[_0x915c('0x26')][_0x915c('0x27')]()!==_0x915c('0x28')){if(!_[_0x915c('0x16')](queues[_0x23fd68[_0x915c('0x4')]])){queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x19')]=![];queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x29')]=null;queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x1a')]=!![];queues[_0x23fd68['uniqueid']][_0x915c('0x2a')]=utils['now']();queues[_0x23fd68['uniqueid']][_0x915c('0x1c')]=_0x23fd68[_0x915c('0x26')][_0x915c('0x27')]();utils[_0x915c('0x10')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x23fd68[_0x915c('0x4')],queues[_0x23fd68[_0x915c('0x4')]]['name'],_0x23fd68['value'],queues[_0x23fd68['uniqueid']][_0x915c('0x1c')]));writeDB(queues[_0x23fd68[_0x915c('0x4')]]);}}else if(!_[_0x915c('0x16')](_0x23fd68[_0x915c('0x25')]['queueposition'])){if(!_[_0x915c('0x16')](queues[_0x23fd68['uniqueid']])&&!queues[_0x23fd68['uniqueid']][_0x915c('0x19')]){queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x19')]=![];queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x29')]=null;queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x1a')]=!![];queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x2a')]=utils[_0x915c('0x14')]();queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x1c')]='EXITWITHKEY';utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x2b'),_0x23fd68['uniqueid'],queues[_0x23fd68[_0x915c('0x4')]][_0x915c('0x20')],_0x23fd68['value'],queues[_0x23fd68['uniqueid']]['queuecallerexitreason']));}}}catch(_0x43397b){utils[_0x915c('0x22')](util['format'](_0x915c('0x24'),_0x23fd68[_0x915c('0x4')]),_0x43397b);}};exports[_0x915c('0x19')]=function(_0x568039){try{if(!_['isNil'](queues[_0x568039[_0x915c('0x4')]])){utils[_0x915c('0x17')](util[_0x915c('0x2')]('[%s][queues][queuecallerabandon]',_0x568039['uniqueid']),_0x568039);queues[_0x568039[_0x915c('0x4')]][_0x915c('0x1a')]=![];queues[_0x568039[_0x915c('0x4')]][_0x915c('0x2a')]=null;queues[_0x568039[_0x915c('0x4')]]['queuecallerabandon']=!![];queues[_0x568039[_0x915c('0x4')]][_0x915c('0x29')]=utils[_0x915c('0x14')]();queues[_0x568039[_0x915c('0x4')]]['queuecallerexitreason']=_0x915c('0x2c');utils[_0x915c('0x10')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x568039[_0x915c('0x4')],queues[_0x568039[_0x915c('0x4')]][_0x915c('0x20')],queues[_0x568039[_0x915c('0x4')]]['queuecallerexitreason']));}}catch(_0x2d29eb){utils[_0x915c('0x22')](util[_0x915c('0x2')](_0x915c('0x2d'),_0x568039['uniqueid']),_0x2d29eb);}};exports[_0x915c('0x2e')]=function(_0x2b0002){try{if(!_[_0x915c('0x16')](queues[_0x2b0002['uniqueid']])){utils[_0x915c('0x17')](util['format'](_0x915c('0x2f'),_0x2b0002['uniqueid']),_0x2b0002);utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x30'),_0x2b0002[_0x915c('0x4')],queues[_0x2b0002[_0x915c('0x4')]][_0x915c('0x20')],_0x2b0002[_0x915c('0x31')],_0x2b0002[_0x915c('0x32')]));queues[_0x2b0002['uniqueid']][_0x915c('0x2e')]=!![];queues[_0x2b0002[_0x915c('0x4')]][_0x915c('0x18')]=utils['now']();queues[_0x2b0002[_0x915c('0x4')]]['holdtime']=utils[_0x915c('0x33')](queues[_0x2b0002['uniqueid']][_0x915c('0x18')],queues[_0x2b0002[_0x915c('0x4')]][_0x915c('0x34')]);queues[_0x2b0002[_0x915c('0x4')]][_0x915c('0x12')]=_0x2b0002[_0x915c('0x12')];queues[_0x2b0002['uniqueid']][_0x915c('0x35')]=_0x2b0002[_0x915c('0x35')];queues[_0x2b0002[_0x915c('0x4')]][_0x915c('0x31')]=_0x2b0002[_0x915c('0x31')];queues[_0x2b0002[_0x915c('0x4')]][_0x915c('0x32')]=_0x2b0002[_0x915c('0x32')];}}catch(_0x3338e3){utils['error'](util['format'](_0x915c('0x2f'),_0x2b0002[_0x915c('0x4')]),_0x3338e3);}};exports[_0x915c('0x36')]=function(_0x3309bf){try{if(!_[_0x915c('0x16')](queues[_0x3309bf[_0x915c('0x4')]])){utils[_0x915c('0x17')](util[_0x915c('0x2')](_0x915c('0x37'),_0x3309bf['uniqueid']),_0x3309bf);utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x38'),_0x3309bf['uniqueid'],queues[_0x3309bf['uniqueid']][_0x915c('0x20')],_0x3309bf[_0x915c('0x39')],_0x3309bf['destaccountcode']));queues[_0x3309bf['uniqueid']][_0x915c('0x19')]=![];queues[_0x3309bf[_0x915c('0x4')]]['queuecallerabandon']=![];queues[_0x3309bf[_0x915c('0x4')]]['queuecallerabandonAt']=null;queues[_0x3309bf[_0x915c('0x4')]][_0x915c('0x1a')]=![];queues[_0x3309bf[_0x915c('0x4')]]['queuecallerexitreason']=null;queues[_0x3309bf['uniqueid']][_0x915c('0x2a')]=null;queues[_0x3309bf[_0x915c('0x4')]][_0x915c('0x3a')]=!![];queues[_0x3309bf[_0x915c('0x4')]]['accountcode']=_0x3309bf[_0x915c('0x3b')];queues[_0x3309bf['uniqueid']][_0x915c('0x3c')]=_0x3309bf[_0x915c('0x39')];}}catch(_0x818019){utils[_0x915c('0x22')](util[_0x915c('0x2')](_0x915c('0x37'),_0x3309bf[_0x915c('0x4')]),_0x818019);}};exports[_0x915c('0x3d')]=function(_0x3e48c2){try{if(!_['isNil'](queues[_0x3e48c2[_0x915c('0x4')]])){if(queues[_0x3e48c2[_0x915c('0x4')]][_0x915c('0x18')]){utils[_0x915c('0x17')](util['format']('[%s][queues][agentcomplete]',_0x3e48c2[_0x915c('0x4')]),_0x3e48c2);queues[_0x3e48c2[_0x915c('0x4')]]['queuecallerabandon']=![];queues[_0x3e48c2[_0x915c('0x4')]][_0x915c('0x19')]=![];queues[_0x3e48c2[_0x915c('0x4')]]['queuecallerabandonAt']=null;queues[_0x3e48c2[_0x915c('0x4')]][_0x915c('0x1a')]=![];queues[_0x3e48c2[_0x915c('0x4')]][_0x915c('0x2a')]=null;queues[_0x3e48c2['uniqueid']][_0x915c('0x3a')]=!![];queues[_0x3e48c2['uniqueid']][_0x915c('0x3c')]=_0x3e48c2[_0x915c('0x39')];queues[_0x3e48c2['uniqueid']][_0x915c('0x3e')]=!![];queues[_0x3e48c2[_0x915c('0x4')]]['queuecallercompleteAt']=utils[_0x915c('0x14')]();if(_0x3e48c2[_0x915c('0x3f')]=='transfer'){if(!queues[_0x3e48c2[_0x915c('0x4')]][_0x915c('0x40')]){queues[_0x3e48c2[_0x915c('0x4')]][_0x915c('0x1c')]='TRANSFER';}}else{queues[_0x3e48c2['uniqueid']]['queuecallerexitreason']=_0x915c('0x41')+_0x3e48c2['reason']['toUpperCase']();}utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x42'),_0x3e48c2[_0x915c('0x4')],queues[_0x3e48c2[_0x915c('0x4')]][_0x915c('0x20')],_0x3e48c2[_0x915c('0x39')],queues[_0x3e48c2[_0x915c('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x3e48c2[_0x915c('0x4')]]);}}}catch(_0x67b858){utils[_0x915c('0x22')](util[_0x915c('0x2')]('[%s][queues][agentcomplete]',_0x3e48c2[_0x915c('0x4')]),_0x67b858);}};exports['blindtransfer']=function(_0xd6e35d){try{if(!_['isNil'](queues[_0xd6e35d['transfereeuniqueid']])){utils['debug'](util[_0x915c('0x2')]('[%s][queues][blindtransfer]',_0xd6e35d[_0x915c('0x4')]),_0xd6e35d);queues[_0xd6e35d[_0x915c('0x43')]][_0x915c('0x40')]=!![];queues[_0xd6e35d[_0x915c('0x43')]][_0x915c('0x44')]=_0x915c('0x45');queues[_0xd6e35d[_0x915c('0x43')]][_0x915c('0x46')]=_0xd6e35d['extension'];queues[_0xd6e35d['transfereeuniqueid']][_0x915c('0x47')]=_0xd6e35d[_0x915c('0x43')];queues[_0xd6e35d[_0x915c('0x43')]][_0x915c('0x1c')]='BLINDTRANSFER';utils['info'](util[_0x915c('0x2')](_0x915c('0x48'),_0xd6e35d['uniqueid'],queues[_0xd6e35d['transfereeuniqueid']][_0x915c('0x20')],_0xd6e35d['transfereeuniqueid'],_0xd6e35d['extension']));}}catch(_0x38ccae){utils[_0x915c('0x22')](util[_0x915c('0x2')](_0x915c('0x49'),_0xd6e35d[_0x915c('0x4')]),_0x38ccae);}};exports[_0x915c('0x4a')]=function(_0xc5cc15){try{utils[_0x915c('0x17')](util['format'](_0x915c('0x4b'),_0xc5cc15[_0x915c('0x4c')]),_0xc5cc15);if(_0xc5cc15[_0x915c('0x4c')]==_0xc5cc15[_0x915c('0x4d')]){if(!_[_0x915c('0x16')](queues[_0xc5cc15[_0x915c('0x4e')]])){utils['info'](util[_0x915c('0x2')](_0x915c('0x4f'),_0xc5cc15[_0x915c('0x4c')],queues[_0xc5cc15[_0x915c('0x4e')]]['name'],_0xc5cc15['origtransfererexten']));queues[_0xc5cc15['secondtransfererlinkedid']][_0x915c('0x40')]=!![];queues[_0xc5cc15[_0x915c('0x4e')]][_0x915c('0x44')]=_0x915c('0x50');queues[_0xc5cc15[_0x915c('0x4e')]][_0x915c('0x46')]=_0xc5cc15['origtransfererexten'];queues[_0xc5cc15[_0x915c('0x4e')]][_0x915c('0x47')]=_0xc5cc15[_0x915c('0x4c')];queues[_0xc5cc15[_0x915c('0x4e')]][_0x915c('0x1c')]='ATTENDEDTRANSFER';}if(!_[_0x915c('0x16')](queues[_0xc5cc15[_0x915c('0x4d')]])){if(_0xc5cc15[_0x915c('0x51')]&&queues[_0xc5cc15['transfereelinkedid']]){queues[_0xc5cc15[_0x915c('0x51')]][_0x915c('0x21')]=0x1;queues[_0xc5cc15[_0x915c('0x43')]]=_[_0x915c('0x52')](queues[_0xc5cc15['transfereelinkedid']]);queues[_0xc5cc15[_0x915c('0x43')]][_0x915c('0xe')]=_0xc5cc15[_0x915c('0x53')];queues[_0xc5cc15[_0x915c('0x43')]][_0x915c('0x21')]=0x2;queues[_0xc5cc15[_0x915c('0x43')]]['calleridnum']=queues[_0xc5cc15[_0x915c('0x4e')]][_0x915c('0x7')];queues[_0xc5cc15['transfereeuniqueid']]['calleridname']=queues[_0xc5cc15['secondtransfererlinkedid']][_0x915c('0x54')];queues[_0xc5cc15['transfereeuniqueid']][_0x915c('0x34')]=utils[_0x915c('0x14')]();queues[_0xc5cc15[_0x915c('0x43')]][_0x915c('0x18')]=utils[_0x915c('0x14')]();queues[_0xc5cc15['transfereeuniqueid']]['holdtime']=0x0;queues[_0xc5cc15[_0x915c('0x43')]][_0x915c('0x55')]=0x0;utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x56'),_0xc5cc15[_0x915c('0x4c')],queues[_0xc5cc15['transfereeuniqueid']][_0x915c('0x20')],queues[_0xc5cc15[_0x915c('0x43')]][_0x915c('0x7')],queues[_0xc5cc15['transfereeuniqueid']][_0x915c('0x54')]));}else{utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x57'),_0xc5cc15[_0x915c('0x4c')],queues[_0xc5cc15[_0x915c('0x4d')]][_0x915c('0x20')],_0xc5cc15[_0x915c('0x4e')]));queues[_0xc5cc15[_0x915c('0x4d')]]['transfereduniqueid']=_0xc5cc15['secondtransfererlinkedid'];}}}else if(_0xc5cc15[_0x915c('0x58')]==_0xc5cc15[_0x915c('0x4e')]){if(!_['isNil'](queues[_0xc5cc15['origtransfererlinkedid']])){utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x59'),_0xc5cc15[_0x915c('0x4c')],queues[_0xc5cc15[_0x915c('0x4d')]][_0x915c('0x20')],_0xc5cc15['secondtransfereruniqueid'],_0xc5cc15[_0x915c('0x5a')]));queues[_0xc5cc15['origtransfererlinkedid']][_0x915c('0x40')]=!![];queues[_0xc5cc15[_0x915c('0x4d')]][_0x915c('0x44')]='ATTENDED';queues[_0xc5cc15[_0x915c('0x4d')]][_0x915c('0x46')]=_0xc5cc15[_0x915c('0x5a')];queues[_0xc5cc15['origtransfererlinkedid']]['transferuniqueid']=_0xc5cc15['secondtransfereruniqueid'];queues[_0xc5cc15[_0x915c('0x4d')]]['queuecallerexitreason']=_0x915c('0x5b');}if(!_[_0x915c('0x16')](queues[_0xc5cc15[_0x915c('0x4e')]])){if(_0xc5cc15['transfertargetlinkedid']&&queues[_0xc5cc15[_0x915c('0x5c')]]){queues[_0xc5cc15[_0x915c('0x5c')]][_0x915c('0x21')]=0x1;queues[_0xc5cc15['transfertargetuniqueid']]=_[_0x915c('0x52')](queues[_0xc5cc15['transfertargetlinkedid']]);queues[_0xc5cc15[_0x915c('0x53')]]['transfereduniqueid']=_0xc5cc15['transfertargetuniqueid'];queues[_0xc5cc15['transfertargetuniqueid']][_0x915c('0x21')]=0x2;queues[_0xc5cc15[_0x915c('0x53')]]['calleridnum']=queues[_0xc5cc15[_0x915c('0x4d')]][_0x915c('0x7')];queues[_0xc5cc15['transfertargetuniqueid']][_0x915c('0x54')]=queues[_0xc5cc15[_0x915c('0x4d')]]['calleridname'];queues[_0xc5cc15['transfertargetuniqueid']][_0x915c('0x34')]=utils['now']();queues[_0xc5cc15[_0x915c('0x53')]][_0x915c('0x18')]=utils[_0x915c('0x14')]();queues[_0xc5cc15['transfertargetuniqueid']][_0x915c('0x5d')]=0x0;queues[_0xc5cc15['transfertargetuniqueid']][_0x915c('0x55')]=0x0;utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x5e'),_0xc5cc15[_0x915c('0x4c')],queues[_0xc5cc15[_0x915c('0x53')]][_0x915c('0x20')],queues[_0xc5cc15[_0x915c('0x53')]][_0x915c('0xe')],queues[_0xc5cc15[_0x915c('0x53')]][_0x915c('0x7')],queues[_0xc5cc15[_0x915c('0x53')]][_0x915c('0x54')]));}else{utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x57'),_0xc5cc15[_0x915c('0x4c')],queues[_0xc5cc15[_0x915c('0x4e')]][_0x915c('0x20')],_0xc5cc15[_0x915c('0x4d')]));queues[_0xc5cc15[_0x915c('0x4e')]][_0x915c('0xe')]=_0xc5cc15[_0x915c('0x4d')];}}}}catch(_0x2fda9f){utils['error'](util['format'](_0x915c('0x4b'),_0xc5cc15['origtransfereruniqueid']),_0x2fda9f);}};exports[_0x915c('0x5f')]=function(_0xf54ce2){try{if(!_[_0x915c('0x16')](queues[_0xf54ce2[_0x915c('0x4')]])){utils[_0x915c('0x17')](util[_0x915c('0x2')](_0x915c('0x60'),_0xf54ce2[_0x915c('0x4')]),_0xf54ce2);queues[_0xf54ce2[_0x915c('0x4')]][_0x915c('0x61')]=utils[_0x915c('0x14')]();utils['info'](util[_0x915c('0x2')](_0x915c('0x62'),_0xf54ce2[_0x915c('0x4')],queues[_0xf54ce2[_0x915c('0x4')]]['name'],queues[_0xf54ce2['uniqueid']][_0x915c('0x61')]));}}catch(_0x27beaa){utils[_0x915c('0x22')](util['format'](_0x915c('0x60'),_0xf54ce2[_0x915c('0x4')]),_0x27beaa);}};exports[_0x915c('0x63')]=function(_0x5c9396){try{if(!_[_0x915c('0x16')](queues[_0x5c9396[_0x915c('0x4')]])){if(!_[_0x915c('0x16')](queues[_0x5c9396[_0x915c('0x4')]]['musiconholdstartAt'])){utils[_0x915c('0x17')](util['format'](_0x915c('0x64'),_0x5c9396[_0x915c('0x4')]),_0x5c9396);queues[_0x5c9396[_0x915c('0x4')]][_0x915c('0x55')]+=utils[_0x915c('0x33')](utils[_0x915c('0x14')](),queues[_0x5c9396['uniqueid']][_0x915c('0x61')]);utils[_0x915c('0x10')](util[_0x915c('0x2')](_0x915c('0x65'),_0x5c9396['uniqueid'],queues[_0x5c9396['uniqueid']][_0x915c('0x20')],queues[_0x5c9396[_0x915c('0x4')]][_0x915c('0x55')]));delete queues[_0x5c9396[_0x915c('0x4')]]['musiconholdstartAt'];}}}catch(_0x1f87e7){utils[_0x915c('0x22')](util[_0x915c('0x2')](_0x915c('0x64'),_0x5c9396[_0x915c('0x4')]),_0x1f87e7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4928267..3bc59ee 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 _0x0818=['push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','appdata','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','request','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','error','newstate','[%s][recordings][newstate]','isNil','channelstate','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find'];(function(_0x21060f,_0x433842){var _0x526ca7=function(_0xfd3eb3){while(--_0xfd3eb3){_0x21060f['push'](_0x21060f['shift']());}};_0x526ca7(++_0x433842);}(_0x0818,0x64));var _0x8081=function(_0x54ef43,_0x308497){_0x54ef43=_0x54ef43-0x0;var _0x4e3816=_0x0818[_0x54ef43];return _0x4e3816;};'use strict';var _=require(_0x8081('0x0'));var util=require(_0x8081('0x1'));var utils=require('./utils');var transfers=require(_0x8081('0x2'));var recordings={};function writeDB(_0x32f546){var _0x101332;utils[_0x8081('0x3')](util[_0x8081('0x4')](_0x8081('0x5'),_0x32f546[_0x8081('0x6')]));if(transfers[_0x8081('0x7')][_0x32f546[_0x8081('0x6')]]){_0x101332=_0x32f546[_0x8081('0x6')];_0x32f546[_0x8081('0x6')]=transfers[_0x8081('0x7')][_0x32f546[_0x8081('0x6')]][_0x8081('0x8')];}if(_0x32f546[_0x8081('0x9')]){utils[_0x8081('0xa')](_0x32f546['accountcode'])[_0x8081('0xb')](function(_0x2f1e31){if(_0x2f1e31){_0x32f546[_0x8081('0xc')]=_0x2f1e31[_0x8081('0xd')];_0x32f546['UserId']=_0x2f1e31['id'];}utils[_0x8081('0xe')]('CreateVoiceRecording',_0x32f546);});}else{utils[_0x8081('0xe')]('CreateVoiceRecording',_0x32f546);}if(_0x101332)delete transfers[_0x8081('0x7')][_0x101332];}exports['newchannel']=function(_0x18fb7e){try{utils[_0x8081('0xf')](util[_0x8081('0x4')](_0x8081('0x10'),_0x18fb7e['uniqueid']),_0x18fb7e);if(_0x18fb7e['uniqueid']==_0x18fb7e[_0x8081('0x11')]){utils[_0x8081('0x3')](util[_0x8081('0x4')](_0x8081('0x12'),_0x18fb7e[_0x8081('0x6')],_0x18fb7e[_0x8081('0x13')],_0x18fb7e['exten']));recordings[_0x18fb7e[_0x8081('0x6')]]={'uniqueid':_0x18fb7e['uniqueid'],'accountcode':_0x18fb7e['accountcode'],'exten':_0x18fb7e['exten'],'context':_0x18fb7e[_0x8081('0x13')],'channel':_0x18fb7e['channel'],'monitors':[]};}}catch(_0x2e5d65){utils[_0x8081('0x14')](util[_0x8081('0x4')](_0x8081('0x10'),_0x18fb7e[_0x8081('0x6')]),_0x2e5d65);}};exports[_0x8081('0x15')]=function(_0x566d57){try{utils['debug'](util[_0x8081('0x4')](_0x8081('0x16'),_0x566d57[_0x8081('0x6')]),_0x566d57);if(!_[_0x8081('0x17')](recordings[_0x566d57[_0x8081('0x6')]])&&_0x566d57[_0x8081('0x18')]==0x6){utils[_0x8081('0x3')](util[_0x8081('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x566d57['uniqueid'],_0x566d57[_0x8081('0x13')],_0x566d57[_0x8081('0x19')]));}else if(!_[_0x8081('0x17')](recordings[_0x566d57[_0x8081('0x11')]])&&_0x566d57[_0x8081('0x18')]==0x6&&_0x566d57['context']!=_0x8081('0x1a')){utils['info'](util[_0x8081('0x4')](_0x8081('0x1b'),_0x566d57[_0x8081('0x6')],_0x566d57['linkedid'],_0x566d57[_0x8081('0x13')],_0x566d57[_0x8081('0x19')]));recordings[_0x566d57[_0x8081('0x11')]]['accountcode']=_0x566d57[_0x8081('0x9')];}}catch(_0x75c818){utils[_0x8081('0x14')](util['format']('[%s][recordings][newstate]',_0x566d57[_0x8081('0x6')]),_0x75c818);}};exports['varset']=function(_0x24debb){try{if(!_[_0x8081('0x17')](_0x24debb['variable'])&&!_[_0x8081('0x17')](_0x24debb[_0x8081('0x1c')][_0x8081('0x1d')])){utils[_0x8081('0xf')](util[_0x8081('0x4')](_0x8081('0x1e'),_0x24debb['uniqueid']),_0x24debb);utils[_0x8081('0x3')](util[_0x8081('0x4')](_0x8081('0x1f'),_0x24debb[_0x8081('0x6')],_0x24debb['variable'],_0x24debb[_0x8081('0x20')]));if(_[_0x8081('0x21')](_0x24debb[_0x8081('0x20')],_0x8081('0x22'))){_0x24debb[_0x8081('0x20')]=_0x24debb['value'][_0x8081('0x23')](_0x8081('0x22'),_0x8081('0x24'));}if(recordings[_0x24debb[_0x8081('0x11')]]){var _0x4e08e6=_[_0x8081('0x25')](recordings[_0x24debb['linkedid']]['monitors'],{'value':_0x24debb[_0x8081('0x20')]});if(_[_0x8081('0x17')](_0x4e08e6)){recordings[_0x24debb[_0x8081('0x11')]]['monitors'][_0x8081('0x26')]({'value':_0x24debb[_0x8081('0x20')]});}}}}catch(_0x2c9e51){utils[_0x8081('0x14')](util['format'](_0x8081('0x1e'),_0x24debb[_0x8081('0x6')]),_0x2c9e51);}};exports['hangup']=function(_0x11581c){try{if(!_['isNil'](recordings[_0x11581c[_0x8081('0x6')]])){utils['debug'](util[_0x8081('0x4')]('[%s][recordings][hangup]',_0x11581c[_0x8081('0x6')]),_0x11581c);utils[_0x8081('0x3')](util[_0x8081('0x4')](_0x8081('0x27'),_0x11581c['uniqueid'],_0x11581c[_0x8081('0x28')],_0x11581c[_0x8081('0x29')],_0x11581c[_0x8081('0x2a')]));recordings[_0x11581c[_0x8081('0x6')]]['calleridnum']=_0x11581c[_0x8081('0x28')];recordings[_0x11581c[_0x8081('0x6')]][_0x8081('0x29')]=_0x11581c[_0x8081('0x29')];recordings[_0x11581c[_0x8081('0x6')]][_0x8081('0x2b')]=_0x11581c[_0x8081('0x2b')];recordings[_0x11581c[_0x8081('0x6')]][_0x8081('0x2c')]=_0x11581c[_0x8081('0x2c')];if(recordings[_0x11581c[_0x8081('0x6')]][_0x8081('0x2d')]==_0x8081('0x2e')&&recordings[_0x11581c[_0x8081('0x6')]][_0x8081('0x9')]){recordings[_0x11581c[_0x8081('0x6')]][_0x8081('0x2b')]=recordings[_0x11581c[_0x8081('0x6')]][_0x8081('0x9')];recordings[_0x11581c[_0x8081('0x6')]][_0x8081('0x2c')]='';}recordings[_0x11581c[_0x8081('0x6')]]['monitors'][_0x8081('0x2f')](function(_0x59ee55){var _0x4f5cf4=_[_0x8081('0x30')](recordings[_0x11581c['uniqueid']]);_0x4f5cf4[_0x8081('0x20')]=_0x59ee55[_0x8081('0x20')];writeDB(_0x4f5cf4);});delete recordings[_0x11581c['uniqueid']];}}catch(_0x5d2762){utils[_0x8081('0x14')](util[_0x8081('0x4')](_0x8081('0x31'),_0x11581c[_0x8081('0x6')]),_0x5d2762);}};exports[_0x8081('0x32')]=function(_0xb29cad){try{if(!_[_0x8081('0x17')](recordings[_0xb29cad['uniqueid']])){utils['debug'](util[_0x8081('0x4')](_0x8081('0x33'),_0xb29cad[_0x8081('0x6')]),_0xb29cad);utils[_0x8081('0x3')](util[_0x8081('0x4')](_0x8081('0x34'),_0xb29cad[_0x8081('0x6')],_0xb29cad[_0x8081('0x35')],_0xb29cad['appdata']));if(_0xb29cad[_0x8081('0x35')][_0x8081('0x36')]()=='set'&&_['startsWith'](_0xb29cad[_0x8081('0x37')][_0x8081('0x36')](),'cdr')){var _0x5e6235=_0xb29cad[_0x8081('0x37')][_0x8081('0x38')]('=');var _0x3d068c=_0x5e6235[0x0]['substring'](_0x5e6235[0x0][_0x8081('0x39')]('(')+0x1,_0x5e6235[0x0][_0x8081('0x39')](')'));var _0x43df1b=_0x5e6235[0x1];recordings[_0xb29cad[_0x8081('0x6')]][_0x3d068c]=_0x43df1b;}}}catch(_0x81f6dd){utils['error'](util[_0x8081('0x4')](_0x8081('0x33'),_0xb29cad[_0x8081('0x6')]),_0x81f6dd);}};exports[_0x8081('0x3a')]=function(_0x4b6e65){try{if(!_['isNil'](recordings[_0x4b6e65[_0x8081('0x6')]])){utils['debug'](util['format'](_0x8081('0x3b'),_0x4b6e65[_0x8081('0x6')]),_0x4b6e65);utils[_0x8081('0x3')](util['format'](_0x8081('0x3c'),_0x4b6e65[_0x8081('0x6')],_0x4b6e65[_0x8081('0x3d')]));recordings[_0x4b6e65[_0x8081('0x6')]][_0x8081('0x3d')]=_0x4b6e65[_0x8081('0x3d')];}}catch(_0x3aae5b){utils[_0x8081('0x14')](util[_0x8081('0x4')](_0x8081('0x3b'),_0x4b6e65[_0x8081('0x6')]),_0x3aae5b);}};exports[_0x8081('0x3e')]=function(_0x39a942){try{utils[_0x8081('0xf')](util[_0x8081('0x4')](_0x8081('0x3f'),_0x39a942[_0x8081('0x6')]),_0x39a942);utils[_0x8081('0x3')](util[_0x8081('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x39a942['uniqueid'],_0x39a942[_0x8081('0x40')],_0x39a942[_0x8081('0x41')],_0x39a942[_0x8081('0x42')],_0x39a942['transfereecalleridname']));if(recordings[_0x39a942[_0x8081('0x43')]]&&transfers[_0x8081('0x7')][_0x39a942['transfereruniqueid']]){transfers[_0x8081('0x7')][_0x39a942[_0x8081('0x43')]][_0x8081('0x44')]=!![];}}catch(_0xecb5fc){utils[_0x8081('0x14')](util[_0x8081('0x4')]('[%s][recordings][blindtransfer]',_0x39a942[_0x8081('0x6')]),_0xecb5fc);}}; \ No newline at end of file +var _0xacfb=['error','[%s][recordings][newchannel]','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','channelstate','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','[%s][recordings][blindtransfer]','util','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xacfb,0xef));var _0xbacf=function(_0x47e3c0,_0x169d95){_0x47e3c0=_0x47e3c0-0x0;var _0x5c8778=_0xacfb[_0x47e3c0];return _0x5c8778;};'use strict';var _=require('lodash');var util=require(_0xbacf('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x53c5ba){var _0x5c8b8b;utils[_0xbacf('0x1')](util[_0xbacf('0x2')](_0xbacf('0x3'),_0x53c5ba[_0xbacf('0x4')]));if(transfers[_0xbacf('0x5')][_0x53c5ba[_0xbacf('0x4')]]){_0x5c8b8b=_0x53c5ba[_0xbacf('0x4')];_0x53c5ba[_0xbacf('0x4')]=transfers[_0xbacf('0x5')][_0x53c5ba[_0xbacf('0x4')]]['transfereeuniqueid'];}if(_0x53c5ba[_0xbacf('0x6')]){utils[_0xbacf('0x7')](_0x53c5ba['accountcode'])[_0xbacf('0x8')](function(_0xe57683){if(_0xe57683){_0x53c5ba[_0xbacf('0x9')]=_0xe57683['name'];_0x53c5ba[_0xbacf('0xa')]=_0xe57683['id'];}utils[_0xbacf('0xb')](_0xbacf('0xc'),_0x53c5ba);});}else{utils[_0xbacf('0xb')](_0xbacf('0xc'),_0x53c5ba);}if(_0x5c8b8b)delete transfers[_0xbacf('0x5')][_0x5c8b8b];}exports['newchannel']=function(_0x109993){try{utils[_0xbacf('0xd')](util[_0xbacf('0x2')]('[%s][recordings][newchannel]',_0x109993['uniqueid']),_0x109993);if(_0x109993['uniqueid']==_0x109993['linkedid']){utils[_0xbacf('0x1')](util[_0xbacf('0x2')](_0xbacf('0xe'),_0x109993['uniqueid'],_0x109993[_0xbacf('0xf')],_0x109993['exten']));recordings[_0x109993[_0xbacf('0x4')]]={'uniqueid':_0x109993[_0xbacf('0x4')],'accountcode':_0x109993[_0xbacf('0x6')],'exten':_0x109993['exten'],'context':_0x109993[_0xbacf('0xf')],'channel':_0x109993[_0xbacf('0x10')],'monitors':[]};}}catch(_0x9c025a){utils[_0xbacf('0x11')](util[_0xbacf('0x2')](_0xbacf('0x12'),_0x109993[_0xbacf('0x4')]),_0x9c025a);}};exports['newstate']=function(_0x43d773){try{utils[_0xbacf('0xd')](util[_0xbacf('0x2')](_0xbacf('0x13'),_0x43d773['uniqueid']),_0x43d773);if(!_['isNil'](recordings[_0x43d773[_0xbacf('0x4')]])&&_0x43d773['channelstate']==0x6){utils[_0xbacf('0x1')](util[_0xbacf('0x2')](_0xbacf('0x14'),_0x43d773[_0xbacf('0x4')],_0x43d773[_0xbacf('0xf')],_0x43d773['channel']));}else if(!_[_0xbacf('0x15')](recordings[_0x43d773[_0xbacf('0x16')]])&&_0x43d773[_0xbacf('0x17')]==0x6&&_0x43d773[_0xbacf('0xf')]!='transfer'){utils[_0xbacf('0x1')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x43d773['uniqueid'],_0x43d773[_0xbacf('0x16')],_0x43d773[_0xbacf('0xf')],_0x43d773[_0xbacf('0x10')]));recordings[_0x43d773[_0xbacf('0x16')]][_0xbacf('0x6')]=_0x43d773['accountcode'];}}catch(_0x409125){utils['error'](util[_0xbacf('0x2')](_0xbacf('0x13'),_0x43d773['uniqueid']),_0x409125);}};exports[_0xbacf('0x18')]=function(_0x5ccdb3){try{if(!_[_0xbacf('0x15')](_0x5ccdb3[_0xbacf('0x19')])&&!_[_0xbacf('0x15')](_0x5ccdb3['variable']['mixmonitor_filename'])){utils[_0xbacf('0xd')](util['format'](_0xbacf('0x1a'),_0x5ccdb3['uniqueid']),_0x5ccdb3);utils[_0xbacf('0x1')](util['format'](_0xbacf('0x1b'),_0x5ccdb3[_0xbacf('0x4')],_0x5ccdb3[_0xbacf('0x19')],_0x5ccdb3[_0xbacf('0x1c')]));if(_[_0xbacf('0x1d')](_0x5ccdb3['value'],'.wav49')){_0x5ccdb3['value']=_0x5ccdb3[_0xbacf('0x1c')]['replace'](_0xbacf('0x1e'),'.WAV');}if(recordings[_0x5ccdb3[_0xbacf('0x16')]]){var _0x295ff4=_[_0xbacf('0x1f')](recordings[_0x5ccdb3['linkedid']][_0xbacf('0x20')],{'value':_0x5ccdb3['value']});if(_['isNil'](_0x295ff4)){recordings[_0x5ccdb3[_0xbacf('0x16')]][_0xbacf('0x20')][_0xbacf('0x21')]({'value':_0x5ccdb3[_0xbacf('0x1c')]});}}}}catch(_0x5c7cd5){utils['error'](util[_0xbacf('0x2')](_0xbacf('0x1a'),_0x5ccdb3['uniqueid']),_0x5c7cd5);}};exports['hangup']=function(_0x5a0351){try{if(!_[_0xbacf('0x15')](recordings[_0x5a0351[_0xbacf('0x4')]])){utils['debug'](util['format'](_0xbacf('0x22'),_0x5a0351[_0xbacf('0x4')]),_0x5a0351);utils[_0xbacf('0x1')](util['format'](_0xbacf('0x23'),_0x5a0351['uniqueid'],_0x5a0351[_0xbacf('0x24')],_0x5a0351[_0xbacf('0x25')],_0x5a0351[_0xbacf('0x26')]));recordings[_0x5a0351['uniqueid']][_0xbacf('0x24')]=_0x5a0351[_0xbacf('0x24')];recordings[_0x5a0351[_0xbacf('0x4')]][_0xbacf('0x25')]=_0x5a0351[_0xbacf('0x25')];recordings[_0x5a0351[_0xbacf('0x4')]]['connectedlinenum']=_0x5a0351[_0xbacf('0x27')];recordings[_0x5a0351['uniqueid']][_0xbacf('0x28')]=_0x5a0351[_0xbacf('0x28')];if(recordings[_0x5a0351[_0xbacf('0x4')]][_0xbacf('0x29')]=='outbound'&&recordings[_0x5a0351['uniqueid']]['accountcode']){recordings[_0x5a0351[_0xbacf('0x4')]][_0xbacf('0x27')]=recordings[_0x5a0351[_0xbacf('0x4')]][_0xbacf('0x6')];recordings[_0x5a0351['uniqueid']][_0xbacf('0x28')]='';}recordings[_0x5a0351[_0xbacf('0x4')]][_0xbacf('0x20')]['forEach'](function(_0x332050){var _0x1c6823=_['clone'](recordings[_0x5a0351['uniqueid']]);_0x1c6823[_0xbacf('0x1c')]=_0x332050[_0xbacf('0x1c')];writeDB(_0x1c6823);});delete recordings[_0x5a0351[_0xbacf('0x4')]];}}catch(_0x32a213){utils[_0xbacf('0x11')](util[_0xbacf('0x2')](_0xbacf('0x22'),_0x5a0351['uniqueid']),_0x32a213);}};exports['newexten']=function(_0x199b16){try{if(!_['isNil'](recordings[_0x199b16[_0xbacf('0x4')]])){utils['debug'](util[_0xbacf('0x2')]('[%s][recordings][newexten]',_0x199b16['uniqueid']),_0x199b16);utils['info'](util[_0xbacf('0x2')](_0xbacf('0x2a'),_0x199b16[_0xbacf('0x4')],_0x199b16[_0xbacf('0x2b')],_0x199b16[_0xbacf('0x2c')]));if(_0x199b16[_0xbacf('0x2b')][_0xbacf('0x2d')]()==_0xbacf('0x2e')&&_[_0xbacf('0x2f')](_0x199b16[_0xbacf('0x2c')][_0xbacf('0x2d')](),_0xbacf('0x30'))){var _0x444cee=_0x199b16[_0xbacf('0x2c')][_0xbacf('0x31')]('=');var _0x180ae6=_0x444cee[0x0]['substring'](_0x444cee[0x0]['lastIndexOf']('(')+0x1,_0x444cee[0x0][_0xbacf('0x32')](')'));var _0x464d85=_0x444cee[0x1];recordings[_0x199b16[_0xbacf('0x4')]][_0x180ae6]=_0x464d85;}}}catch(_0x4c1358){utils[_0xbacf('0x11')](util['format'](_0xbacf('0x33'),_0x199b16[_0xbacf('0x4')]),_0x4c1358);}};exports[_0xbacf('0x34')]=function(_0x3b3ef3){try{if(!_[_0xbacf('0x15')](recordings[_0x3b3ef3[_0xbacf('0x4')]])){utils['debug'](util[_0xbacf('0x2')](_0xbacf('0x35'),_0x3b3ef3[_0xbacf('0x4')]),_0x3b3ef3);utils[_0xbacf('0x1')](util[_0xbacf('0x2')](_0xbacf('0x36'),_0x3b3ef3['uniqueid'],_0x3b3ef3[_0xbacf('0x37')]));recordings[_0x3b3ef3[_0xbacf('0x4')]][_0xbacf('0x37')]=_0x3b3ef3[_0xbacf('0x37')];}}catch(_0x4a67c5){utils[_0xbacf('0x11')](util['format'](_0xbacf('0x35'),_0x3b3ef3[_0xbacf('0x4')]),_0x4a67c5);}};exports[_0xbacf('0x38')]=function(_0x4bba12){try{utils[_0xbacf('0xd')](util[_0xbacf('0x2')]('[%s][recordings][blindtransfer]',_0x4bba12[_0xbacf('0x4')]),_0x4bba12);utils[_0xbacf('0x1')](util['format'](_0xbacf('0x39'),_0x4bba12[_0xbacf('0x4')],_0x4bba12[_0xbacf('0x3a')],_0x4bba12[_0xbacf('0x3b')],_0x4bba12[_0xbacf('0x3c')],_0x4bba12[_0xbacf('0x3d')]));if(recordings[_0x4bba12[_0xbacf('0x3e')]]&&transfers['blinds'][_0x4bba12[_0xbacf('0x3e')]]){transfers[_0xbacf('0x5')][_0x4bba12[_0xbacf('0x3e')]]['recording']=!![];}}catch(_0x4dce72){utils['error'](util[_0xbacf('0x2')](_0xbacf('0x3f'),_0x4bba12[_0xbacf('0x4')]),_0x4dce72);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2734997..5eca52a 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 _0x54d2=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','CreateVoiceTransferReport','blinds','debug','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','transfereruniqueid','attendedtransfer','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x51627e,_0x594f7d){var _0x6d8cd8=function(_0x50419d){while(--_0x50419d){_0x51627e['push'](_0x51627e['shift']());}};_0x6d8cd8(++_0x594f7d);}(_0x54d2,0xc8));var _0x254d=function(_0x250ffa,_0x31c878){_0x250ffa=_0x250ffa-0x0;var _0x3fc6b1=_0x54d2[_0x250ffa];return _0x3fc6b1;};'use strict';var _=require('lodash');var util=require(_0x254d('0x0'));var utils=require(_0x254d('0x1'));function writeDB(_0x106dff){utils['info'](util[_0x254d('0x2')](_0x254d('0x3'),_0x106dff[_0x254d('0x4')]==='attended'?_0x106dff['origtransfereruniqueid']:_0x106dff[_0x254d('0x5')],_0x106dff[_0x254d('0x4')]));utils[_0x254d('0x6')](_0x254d('0x7'),_0x106dff);}exports[_0x254d('0x8')]={};exports['blindtransfer']=function(_0x3d95d0){try{utils[_0x254d('0x9')](util[_0x254d('0x2')]('[%s][transfers][blindtransfer]',_0x3d95d0['uniqueid']),_0x3d95d0);utils[_0x254d('0xa')](util[_0x254d('0x2')](_0x254d('0xb'),_0x3d95d0['uniqueid'],_0x3d95d0['transferercalleridnum'],_0x3d95d0['transferercalleridname'],_0x3d95d0[_0x254d('0xc')],_0x3d95d0[_0x254d('0xd')]));_0x3d95d0[_0x254d('0x4')]='blind';exports['blinds'][_0x3d95d0[_0x254d('0xe')]]=_0x3d95d0;writeDB(_0x3d95d0);}catch(_0xb9ec9b){utils['error'](util[_0x254d('0x2')]('[%s][transfers][blindtransfer]',_0x3d95d0[_0x254d('0x5')]),_0xb9ec9b);}};exports[_0x254d('0xf')]=function(_0x52aac2){try{utils[_0x254d('0x9')](util[_0x254d('0x2')]('[%s][transfers][attendedtransfer]',_0x52aac2[_0x254d('0x10')]),_0x52aac2);utils[_0x254d('0xa')](util['format'](_0x254d('0x11'),_0x52aac2[_0x254d('0x10')],_0x52aac2['origtransferercalleridnum'],_0x52aac2[_0x254d('0x12')],_0x52aac2['transfertargetcalleridnum'],_0x52aac2['transfertargetcalleridname']));_0x52aac2=_[_0x254d('0x13')](_0x52aac2,{'transfererchannel':_0x52aac2[_0x254d('0x14')],'transferercalleridnum':_0x52aac2['origtransferercalleridnum'],'transferercalleridname':_0x52aac2[_0x254d('0x12')],'transfererconnectedlinenum':_0x52aac2[_0x254d('0x15')],'transfererconnectedlinename':_0x52aac2[_0x254d('0x16')],'transfereraccountcode':_0x52aac2[_0x254d('0x17')],'transferercontext':_0x52aac2[_0x254d('0x18')],'transfererexten':_0x52aac2['secondtransfererexten'],'transfererlinkedid':_0x52aac2[_0x254d('0x19')],'context':_0x52aac2['origtransferercontext'],'extension':_0x52aac2[_0x254d('0x1a')],'type':_0x254d('0x1b')});if(_[_0x254d('0x1c')](_0x52aac2[_0x254d('0x1d')])){_0x52aac2=_[_0x254d('0x13')](_0x52aac2,{'transfereechannel':_0x52aac2['transfertargetchannel'],'transfereecalleridnum':_0x52aac2[_0x254d('0x1e')],'transfereecalleridname':_0x52aac2[_0x254d('0x1f')],'transfereeconnectedlinenum':_0x52aac2[_0x254d('0x20')],'transfereeconnectedlinename':_0x52aac2[_0x254d('0x21')],'transfereeaccountcode':_0x52aac2[_0x254d('0x22')],'transfereecontext':_0x52aac2[_0x254d('0x23')],'transfereeexten':_0x52aac2[_0x254d('0x24')],'transfereelinkedid':_0x52aac2[_0x254d('0x25')]});}writeDB(_0x52aac2);}catch(_0x517986){utils[_0x254d('0x26')](util['format']('[%s][transfers][attendedtransfer]',_0x52aac2[_0x254d('0x10')]),_0x517986);}}; \ No newline at end of file +var _0xd5a9=['transferercalleridname','transfereecalleridnum','transfereecalleridname','blinds','transfereruniqueid','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x65a0db,_0x55c5a0){var _0x987620=function(_0x23d53f){while(--_0x23d53f){_0x65a0db['push'](_0x65a0db['shift']());}};_0x987620(++_0x55c5a0);}(_0xd5a9,0x19f));var _0x9d5a=function(_0x4a9cd7,_0x4b510b){_0x4a9cd7=_0x4a9cd7-0x0;var _0x2b6005=_0xd5a9[_0x4a9cd7];return _0x2b6005;};'use strict';var _=require(_0x9d5a('0x0'));var util=require(_0x9d5a('0x1'));var utils=require(_0x9d5a('0x2'));function writeDB(_0x179143){utils[_0x9d5a('0x3')](util[_0x9d5a('0x4')](_0x9d5a('0x5'),_0x179143[_0x9d5a('0x6')]===_0x9d5a('0x7')?_0x179143['origtransfereruniqueid']:_0x179143[_0x9d5a('0x8')],_0x179143[_0x9d5a('0x6')]));utils[_0x9d5a('0x9')](_0x9d5a('0xa'),_0x179143);}exports['blinds']={};exports[_0x9d5a('0xb')]=function(_0x274714){try{utils['debug'](util[_0x9d5a('0x4')](_0x9d5a('0xc'),_0x274714['uniqueid']),_0x274714);utils[_0x9d5a('0x3')](util[_0x9d5a('0x4')](_0x9d5a('0xd'),_0x274714[_0x9d5a('0x8')],_0x274714['transferercalleridnum'],_0x274714[_0x9d5a('0xe')],_0x274714[_0x9d5a('0xf')],_0x274714[_0x9d5a('0x10')]));_0x274714[_0x9d5a('0x6')]='blind';exports[_0x9d5a('0x11')][_0x274714[_0x9d5a('0x12')]]=_0x274714;writeDB(_0x274714);}catch(_0x2d1b24){utils[_0x9d5a('0x13')](util['format']('[%s][transfers][blindtransfer]',_0x274714['uniqueid']),_0x2d1b24);}};exports['attendedtransfer']=function(_0xc5772f){try{utils['debug'](util[_0x9d5a('0x4')](_0x9d5a('0x14'),_0xc5772f[_0x9d5a('0x15')]),_0xc5772f);utils[_0x9d5a('0x3')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xc5772f[_0x9d5a('0x15')],_0xc5772f['origtransferercalleridnum'],_0xc5772f['origtransferercalleridname'],_0xc5772f[_0x9d5a('0x16')],_0xc5772f[_0x9d5a('0x17')]));_0xc5772f=_[_0x9d5a('0x18')](_0xc5772f,{'transfererchannel':_0xc5772f[_0x9d5a('0x19')],'transferercalleridnum':_0xc5772f[_0x9d5a('0x1a')],'transferercalleridname':_0xc5772f[_0x9d5a('0x1b')],'transfererconnectedlinenum':_0xc5772f[_0x9d5a('0x1c')],'transfererconnectedlinename':_0xc5772f[_0x9d5a('0x1d')],'transfereraccountcode':_0xc5772f['origtransfereraccountcode'],'transferercontext':_0xc5772f['secondtransferercontext'],'transfererexten':_0xc5772f[_0x9d5a('0x1e')],'transfererlinkedid':_0xc5772f[_0x9d5a('0x1f')],'context':_0xc5772f[_0x9d5a('0x20')],'extension':_0xc5772f[_0x9d5a('0x21')],'type':'attended'});if(_[_0x9d5a('0x22')](_0xc5772f[_0x9d5a('0x23')])){_0xc5772f=_['assign'](_0xc5772f,{'transfereechannel':_0xc5772f['transfertargetchannel'],'transfereecalleridnum':_0xc5772f['transfertargetcalleridnum'],'transfereecalleridname':_0xc5772f[_0x9d5a('0x17')],'transfereeconnectedlinenum':_0xc5772f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xc5772f[_0x9d5a('0x24')],'transfereeaccountcode':_0xc5772f[_0x9d5a('0x25')],'transfereecontext':_0xc5772f['transfertargetcontext'],'transfereeexten':_0xc5772f['transfertargetexten'],'transfereelinkedid':_0xc5772f[_0x9d5a('0x26')]});}writeDB(_0xc5772f);}catch(_0x58504f){utils[_0x9d5a('0x13')](util[_0x9d5a('0x4')]('[%s][transfers][attendedtransfer]',_0xc5772f[_0x9d5a('0x15')]),_0x58504f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index debff9b..bb58bdb 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 _0x10f9=['getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','[utils][getUser]\x20where:%s','result','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]'];(function(_0x187e5e,_0x71b20e){var _0x44f0f0=function(_0x2410f7){while(--_0x2410f7){_0x187e5e['push'](_0x187e5e['shift']());}};_0x44f0f0(++_0x71b20e);}(_0x10f9,0x69));var _0x910f=function(_0x61e161,_0x204db0){_0x61e161=_0x61e161-0x0;var _0x261d49=_0x10f9[_0x61e161];return _0x261d49;};'use strict';var BPromise=require(_0x910f('0x0'));var jayson=require(_0x910f('0x1'));var moment=require(_0x910f('0x2'));var util=require(_0x910f('0x3'));var client=jayson[_0x910f('0x4')][_0x910f('0x5')]({'port':0x2329});var logger=require(_0x910f('0x6'))(_0x910f('0x7'));exports['info']=function(_0x3ef428,_0xfcf661){logger[_0x910f('0x8')](_0x3ef428,_0xfcf661?util[_0x910f('0x9')](_0xfcf661,{'showHidden':![],'depth':null}):'');};exports[_0x910f('0xa')]=function(_0x379b6b,_0x42b291){logger[_0x910f('0xa')](_0x379b6b,_0x42b291?util[_0x910f('0x9')](_0x42b291,{'showHidden':![],'depth':null}):'');};exports[_0x910f('0xb')]=function(_0x3ddf9f,_0x13c755){logger[_0x910f('0xb')](_0x3ddf9f,_0x13c755?util[_0x910f('0x9')](_0x13c755,{'showHidden':![],'depth':null}):'');};exports[_0x910f('0xc')]=function(_0x1dc737,_0x52087b){return client[_0x910f('0xc')](_0x1dc737,{'body':_0x52087b})[_0x910f('0xd')](function(_0x3e716a){logger[_0x910f('0xa')](_0x910f('0xe'),_0x1dc737,_0x3e716a?util['inspect'](_0x3e716a,{'showHidden':![],'depth':null}):'');})[_0x910f('0xf')](function(_0x873189){logger[_0x910f('0xb')](_0x910f('0xe'),_0x1dc737,_0x873189?util[_0x910f('0x9')](_0x873189,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1109fc){return client['request'](_0x910f('0x10'),{'options':{'raw':!![],'attributes':['id','internal',_0x910f('0x11'),'interface'],'where':_0x1109fc,'limit':0x1}})[_0x910f('0xd')](function(_0x54cefd){logger[_0x910f('0xa')](_0x910f('0x12'),JSON['stringify'](_0x1109fc),_0x54cefd?util[_0x910f('0x9')](_0x54cefd,{'showHidden':![],'depth':null}):'');return _0x54cefd[_0x910f('0x13')]['length']?_0x54cefd[_0x910f('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x2a7bfe){return new BPromise(function(_0x25c550,_0x366aef){if(_0x2a7bfe){return getUser({'internal':_0x2a7bfe})[_0x910f('0xd')](function(_0x3ae156){logger[_0x910f('0x8')](_0x910f('0x14'),_0x2a7bfe,_0x3ae156?'found':_0x910f('0x15'));return _0x25c550(_0x3ae156);})[_0x910f('0xf')](function(_0x3dbf3b){logger['error'](_0x910f('0x16'),_0x3dbf3b?util[_0x910f('0x9')](_0x3dbf3b,{'showHidden':![],'depth':null}):'');return _0x25c550(null);});}return _0x25c550(null);});};exports['getUserByInterface']=function(_0x5bb973){return new BPromise(function(_0x3520e8,_0x1189f2){if(_0x5bb973){return getUser({'interface':_0x5bb973})[_0x910f('0xd')](function(_0x112e3c){logger[_0x910f('0x8')](_0x910f('0x17'),_0x5bb973,_0x112e3c?_0x910f('0x18'):_0x910f('0x15'));return _0x3520e8(_0x112e3c);})[_0x910f('0xf')](function(_0x27f993){logger['error'](_0x910f('0x19'),_0x27f993?util['inspect'](_0x27f993,{'showHidden':![],'depth':null}):'');return _0x3520e8(null);});}return _0x3520e8(null);});};exports['getUserByName']=function(_0x25c10b){return new BPromise(function(_0x7c91f1,_0x3222b4){if(_0x25c10b){return getUser({'name':_0x25c10b})['then'](function(_0x5cb8b1){logger[_0x910f('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x25c10b,_0x5cb8b1?_0x910f('0x18'):_0x910f('0x15'));return _0x7c91f1(_0x5cb8b1);})['catch'](function(_0xd63646){logger['error'](_0x910f('0x1a'),_0xd63646?util[_0x910f('0x9')](_0xd63646,{'showHidden':![],'depth':null}):'');return _0x7c91f1(null);});}return _0x7c91f1(null);});};exports[_0x910f('0x1b')]=function(_0x330b53){return new BPromise(function(_0x1db15c,_0x32590c){if(_0x330b53){return client[_0x910f('0xc')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x910f('0x1c'),_0x910f('0x1d'),_0x910f('0x1e')],'where':{'name':_0x330b53},'limit':0x1}})[_0x910f('0xd')](function(_0x301f21){logger[_0x910f('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x330b53,_0x301f21?util[_0x910f('0x9')](_0x301f21,{'showHidden':![],'depth':null}):'');logger['info'](_0x910f('0x1f'),_0x330b53,_0x301f21?_0x910f('0x18'):_0x910f('0x15'));return _0x1db15c(_0x301f21[_0x910f('0x13')][_0x910f('0x20')]?_0x301f21[_0x910f('0x13')][0x0]:null);})[_0x910f('0xf')](function(_0x2f1cf7){logger[_0x910f('0xb')](_0x910f('0x21'),_0x2f1cf7?util[_0x910f('0x9')](_0x2f1cf7,{'showHidden':![],'depth':null}):'');return _0x1db15c(null);});}return _0x1db15c(null);});};exports[_0x910f('0x22')]=function(_0x1875fa,_0x225ef4){return moment(_0x1875fa)['add'](_0x225ef4,_0x910f('0x23'))[_0x910f('0x24')](_0x910f('0x25'));};exports['subtractTime']=function(_0x303777,_0x3dfd92){return moment(_0x303777)['subtract'](_0x3dfd92,_0x910f('0x23'))[_0x910f('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x910f('0x26')]=function(_0xe5b1cf,_0x40bc18){return moment(_0xe5b1cf)[_0x910f('0x27')](moment(_0x40bc18),_0x910f('0x23'));};exports[_0x910f('0x28')]=function(_0x44dd16,_0x16865f){return parseInt(_0x44dd16,0xa)+parseInt(_0x16865f,0xa);};exports[_0x910f('0x29')]=function(){return moment()[_0x910f('0x24')](_0x910f('0x25'));};exports[_0x910f('0x2a')]=function(_0x589d25,_0x532245){if(_0x532245){return moment(_0x589d25)['isAfter'](_0x532245);}return!![];};exports[_0x910f('0x2b')]=function(_0x170a01,_0xb70519){if(_0xb70519){return moment(_0x170a01)[_0x910f('0x2b')](_0xb70519);}else if(_0x170a01){return!![];}return![];}; \ No newline at end of file +var _0xc967=['[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','interface','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','getUserByInterface','found','[utils][getUserByInterface]','getUserByName'];(function(_0x130ab,_0x24b8e6){var _0x575ad=function(_0x3f5e29){while(--_0x3f5e29){_0x130ab['push'](_0x130ab['shift']());}};_0x575ad(++_0x24b8e6);}(_0xc967,0x1b3));var _0x7c96=function(_0x3607b5,_0x5dc7d){_0x3607b5=_0x3607b5-0x0;var _0x236348=_0xc967[_0x3607b5];return _0x236348;};'use strict';var BPromise=require(_0x7c96('0x0'));var jayson=require(_0x7c96('0x1'));var moment=require(_0x7c96('0x2'));var util=require(_0x7c96('0x3'));var client=jayson[_0x7c96('0x4')][_0x7c96('0x5')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x7c96('0x6')]=function(_0x37cb3b,_0x578a5d){logger[_0x7c96('0x6')](_0x37cb3b,_0x578a5d?util[_0x7c96('0x7')](_0x578a5d,{'showHidden':![],'depth':null}):'');};exports[_0x7c96('0x8')]=function(_0x34247b,_0x31ddce){logger['debug'](_0x34247b,_0x31ddce?util[_0x7c96('0x7')](_0x31ddce,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x29cbab,_0x151814){logger[_0x7c96('0x9')](_0x29cbab,_0x151814?util[_0x7c96('0x7')](_0x151814,{'showHidden':![],'depth':null}):'');};exports[_0x7c96('0xa')]=function(_0x5223dd,_0x458ec4){return client[_0x7c96('0xa')](_0x5223dd,{'body':_0x458ec4})[_0x7c96('0xb')](function(_0x1c6b3f){logger['debug'](_0x7c96('0xc'),_0x5223dd,_0x1c6b3f?util[_0x7c96('0x7')](_0x1c6b3f,{'showHidden':![],'depth':null}):'');})[_0x7c96('0xd')](function(_0x7d14ea){logger[_0x7c96('0x9')](_0x7c96('0xc'),_0x5223dd,_0x7d14ea?util[_0x7c96('0x7')](_0x7d14ea,{'showHidden':![],'depth':null}):'');});};function getUser(_0x37bf4c){return client[_0x7c96('0xa')](_0x7c96('0xe'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x7c96('0xf')],'where':_0x37bf4c,'limit':0x1}})[_0x7c96('0xb')](function(_0x51f269){logger[_0x7c96('0x8')]('[utils][getUser]\x20where:%s',JSON[_0x7c96('0x10')](_0x37bf4c),_0x51f269?util['inspect'](_0x51f269,{'showHidden':![],'depth':null}):'');return _0x51f269[_0x7c96('0x11')][_0x7c96('0x12')]?_0x51f269['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x248b94){return new BPromise(function(_0x367987,_0x5bf1b6){if(_0x248b94){return getUser({'internal':_0x248b94})[_0x7c96('0xb')](function(_0x24e3e9){logger['info'](_0x7c96('0x13'),_0x248b94,_0x24e3e9?'found':_0x7c96('0x14'));return _0x367987(_0x24e3e9);})[_0x7c96('0xd')](function(_0x1d7c53){logger[_0x7c96('0x9')]('[utils][getUserByInternal]',_0x1d7c53?util[_0x7c96('0x7')](_0x1d7c53,{'showHidden':![],'depth':null}):'');return _0x367987(null);});}return _0x367987(null);});};exports[_0x7c96('0x15')]=function(_0x503f0c){return new BPromise(function(_0x379ce6,_0x1e504f){if(_0x503f0c){return getUser({'interface':_0x503f0c})[_0x7c96('0xb')](function(_0x2a94d5){logger[_0x7c96('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x503f0c,_0x2a94d5?_0x7c96('0x16'):'notfound');return _0x379ce6(_0x2a94d5);})[_0x7c96('0xd')](function(_0xebf36a){logger[_0x7c96('0x9')](_0x7c96('0x17'),_0xebf36a?util[_0x7c96('0x7')](_0xebf36a,{'showHidden':![],'depth':null}):'');return _0x379ce6(null);});}return _0x379ce6(null);});};exports[_0x7c96('0x18')]=function(_0x3ba69b){return new BPromise(function(_0x19e8a6,_0x5e486c){if(_0x3ba69b){return getUser({'name':_0x3ba69b})[_0x7c96('0xb')](function(_0x1947ac){logger['info'](_0x7c96('0x19'),_0x3ba69b,_0x1947ac?_0x7c96('0x16'):_0x7c96('0x14'));return _0x19e8a6(_0x1947ac);})[_0x7c96('0xd')](function(_0x3cddc8){logger[_0x7c96('0x9')](_0x7c96('0x1a'),_0x3cddc8?util[_0x7c96('0x7')](_0x3cddc8,{'showHidden':![],'depth':null}):'');return _0x19e8a6(null);});}return _0x19e8a6(null);});};exports['getVoiceQueueByName']=function(_0x1ca450){return new BPromise(function(_0x36aaf8,_0x2c9383){if(_0x1ca450){return client[_0x7c96('0xa')](_0x7c96('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x7c96('0x1c'),_0x7c96('0x1d'),_0x7c96('0x1e'),_0x7c96('0x1f')],'where':{'name':_0x1ca450},'limit':0x1}})[_0x7c96('0xb')](function(_0x47bdf8){logger[_0x7c96('0x8')](_0x7c96('0x20'),_0x1ca450,_0x47bdf8?util[_0x7c96('0x7')](_0x47bdf8,{'showHidden':![],'depth':null}):'');logger[_0x7c96('0x6')](_0x7c96('0x21'),_0x1ca450,_0x47bdf8?_0x7c96('0x16'):_0x7c96('0x14'));return _0x36aaf8(_0x47bdf8[_0x7c96('0x11')]['length']?_0x47bdf8[_0x7c96('0x11')][0x0]:null);})[_0x7c96('0xd')](function(_0x22584e){logger[_0x7c96('0x9')](_0x7c96('0x22'),_0x22584e?util[_0x7c96('0x7')](_0x22584e,{'showHidden':![],'depth':null}):'');return _0x36aaf8(null);});}return _0x36aaf8(null);});};exports[_0x7c96('0x23')]=function(_0x88436c,_0x286c3f){return moment(_0x88436c)['add'](_0x286c3f,_0x7c96('0x24'))[_0x7c96('0x25')](_0x7c96('0x26'));};exports[_0x7c96('0x27')]=function(_0x93795d,_0x169a2b){return moment(_0x93795d)[_0x7c96('0x28')](_0x169a2b,_0x7c96('0x24'))['format'](_0x7c96('0x26'));};exports[_0x7c96('0x29')]=function(_0x587f8d,_0x565d12){return moment(_0x587f8d)[_0x7c96('0x2a')](moment(_0x565d12),'seconds');};exports['sumTime']=function(_0x4a32a4,_0x1e99b3){return parseInt(_0x4a32a4,0xa)+parseInt(_0x1e99b3,0xa);};exports[_0x7c96('0x2b')]=function(){return moment()[_0x7c96('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7c96('0x2c')]=function(_0x2fd70d,_0x428b99){if(_0x428b99){return moment(_0x2fd70d)['isAfter'](_0x428b99);}return!![];};exports[_0x7c96('0x2d')]=function(_0x5a3fa0,_0x51bddd){if(_0x51bddd){return moment(_0x5a3fa0)[_0x7c96('0x2d')](_0x51bddd);}else if(_0x5a3fa0){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 dec79b7..edfee3f 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 _0x6bd4=['catch','user','no-user','timestamp','error','api','set','client-side-logger','use','logger','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','log','xcally','join','role','name','then','client'];(function(_0x4a8423,_0xcbb6f8){var _0x115747=function(_0x4b0972){while(--_0x4b0972){_0x4a8423['push'](_0x4a8423['shift']());}};_0x115747(++_0xcbb6f8);}(_0x6bd4,0xd2));var _0x46bd=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x6bd4[_0x4fde08];return _0x12e725;};var fs=require(_0x46bd('0x0'));var _=require(_0x46bd('0x1'));var ewinston=require(_0x46bd('0x2'));var path=require('path');var util=require('util');var fileLogger=require(_0x46bd('0x3'))[_0x46bd('0x4')];var safeTemplate=require(_0x46bd('0x5'))[_0x46bd('0x6')];var maskSensitiveData=require(_0x46bd('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x3b0eb9(_0xd30650){var _0x28caea=path['join']('/var',_0x46bd('0x8'),_0x46bd('0x9'));var _0x22f202=path[_0x46bd('0xa')]('client',_0xd30650[_0x46bd('0xb')]+'-'+_0xd30650[_0x46bd('0xc')]);return fs['ensureDir'](path[_0x46bd('0xa')](_0x28caea,_0x22f202))[_0x46bd('0xd')](function(){var _0x212138=fileLogger(_0x46bd('0xe'),path['join'](_0x28caea,_0x22f202));return _0x212138;})[_0x46bd('0xf')](function(_0x25357c){throw _0x25357c;});}this[_0x46bd('0x8')]=function(_0xf22c89,_0x5420fd,_0x5b3f1d,_0x3d3c45){return _0x3b0eb9(_0xf22c89[_0x46bd('0x10')])[_0x46bd('0xd')](function(_0x3592ae){var _0x4f7462=_0x3592ae[_0x5420fd];return _0x4f7462;})[_0x46bd('0xd')](function(_0x136aa8){var _0x327035=_0xf22c89['user']?_0xf22c89[_0x46bd('0x10')]['id']:_0x46bd('0x11');var _0x90f15c=_0x3d3c45['data'];var _0x5170f9=_0x3d3c45[_0x46bd('0x12')];var _0x298b96=new Date(Number(_0x5170f9));return _0x136aa8(_0x327035,_0x298b96,_0x5b3f1d,_0x90f15c);})[_0x46bd('0xf')](function(_0x4f4446){fileLogger(_0x46bd('0xe'))[_0x46bd('0x13')](_0x4f4446);});};}function setupLoggers(_0x303d32){return new Promise(function(_0x5d7f01){var _0x3a13be=new ClientSideLogger();var _0x57f42d=fileLogger(_0x46bd('0x14'));var _0x525692=fileLogger('auth');_0x303d32[_0x46bd('0x15')](_0x46bd('0x16'),_0x3a13be);_0x303d32[_0x46bd('0x17')](ewinston[_0x46bd('0x18')]({'winstonInstance':_0x57f42d,'meta':![],'statusLevels':!![],'msg':function(_0xb74052,_0x19c4c1){var _0x1fd6f0='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x46bd('0x19')](_0xb74052[_0x46bd('0x1a')])){_0x1fd6f0+='\x20body=%s';var _0x4e2ed6=_0xb74052['body'];maskSensitiveData(_0x4e2ed6);}return safeTemplate(util[_0x46bd('0x1b')](_0x1fd6f0,_0xb74052[_0x46bd('0x1c')],_0xb74052[_0x46bd('0x1d')][_0x46bd('0x1e')]?_0xb74052['headers']['x-forwarded-for']:_0xb74052[_0x46bd('0x1f')][_0x46bd('0x20')]||_0xb74052['ip'],_0xb74052[_0x46bd('0x21')],_0x19c4c1[_0x46bd('0x22')],_0x19c4c1[_0x46bd('0x23')],_0xb74052[_0x46bd('0x10')]?_0xb74052[_0x46bd('0x10')]['id']:null,_0xb74052[_0x46bd('0x10')]?_0xb74052[_0x46bd('0x10')][_0x46bd('0xc')]:null,_0xb74052['user']?_0xb74052['user'][_0x46bd('0xb')]:null,_0x4e2ed6?util[_0x46bd('0x24')](_0x4e2ed6,![],null):''));}}));_0x303d32[_0x46bd('0x17')](ewinston[_0x46bd('0x18')]({'winstonInstance':_0x525692,'meta':![],'statusLevels':!![],'msg':function(_0x2b9a0b,_0x182674){var _0x2d9b08=_0x46bd('0x25');if(_0x2b9a0b[_0x46bd('0x1a')]&&_0x2b9a0b[_0x46bd('0x1a')]['device']&&_0x2b9a0b['body'][_0x46bd('0x26')]){_0x2d9b08=_0x46bd('0x27');}return util[_0x46bd('0x1b')](_0x2d9b08,_0x2b9a0b[_0x46bd('0x1c')],_0x2b9a0b[_0x46bd('0x1d')][_0x46bd('0x1e')]?_0x2b9a0b[_0x46bd('0x1d')][_0x46bd('0x1e')]:_0x2b9a0b[_0x46bd('0x1f')][_0x46bd('0x20')]||_0x2b9a0b['ip'],_0x2b9a0b['url'],_0x182674['statusCode'],_0x182674[_0x46bd('0x23')],_0x2b9a0b[_0x46bd('0x10')]?_0x2b9a0b[_0x46bd('0x10')]['id']:null,_0x2b9a0b['user']?_0x2b9a0b[_0x46bd('0x10')][_0x46bd('0xc')]:null,_0x2b9a0b[_0x46bd('0x10')]?_0x2b9a0b[_0x46bd('0x10')][_0x46bd('0xb')]:null,_0x2b9a0b[_0x46bd('0x1a')]&&_0x2b9a0b[_0x46bd('0x1a')]['device']?_0x2b9a0b[_0x46bd('0x1a')][_0x46bd('0x28')]:_0x46bd('0x29'),_0x2b9a0b['body']&&_0x2b9a0b[_0x46bd('0x1a')][_0x46bd('0x26')]?_0x2b9a0b[_0x46bd('0x1a')][_0x46bd('0x26')]:'',_0x2b9a0b[_0x46bd('0x1a')]&&_0x2b9a0b[_0x46bd('0x1a')]['agent_name']?_0x2b9a0b[_0x46bd('0x1a')][_0x46bd('0x2a')]:'');},'ignoreRoute':function(_0x51a624){var _0x2fd278=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2fd278[_0x46bd('0x2b')](_0x51a624[_0x46bd('0x21')]);}}));return _0x5d7f01();});}exports[_0x46bd('0x2c')]=setupLoggers; \ No newline at end of file +var _0xe262=['statusCode','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','responseTime','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','./mask-sensitive-data','join','/var','client','role','ensureDir','catch','user','then','no-user','timestamp','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe262,0x16b));var _0x2e26=function(_0x320580,_0x2d2c3f){_0x320580=_0x320580-0x0;var _0x39346f=_0xe262[_0x320580];return _0x39346f;};var fs=require(_0x2e26('0x0'));var _=require(_0x2e26('0x1'));var ewinston=require(_0x2e26('0x2'));var path=require(_0x2e26('0x3'));var util=require(_0x2e26('0x4'));var fileLogger=require('./loggers')[_0x2e26('0x5')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x2e26('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x1711af(_0x2f987d){var _0x5711a8=path[_0x2e26('0x7')](_0x2e26('0x8'),'log','xcally');var _0x19589c=path[_0x2e26('0x7')](_0x2e26('0x9'),_0x2f987d[_0x2e26('0xa')]+'-'+_0x2f987d['name']);return fs[_0x2e26('0xb')](path['join'](_0x5711a8,_0x19589c))['then'](function(){var _0x495488=fileLogger('client',path[_0x2e26('0x7')](_0x5711a8,_0x19589c));return _0x495488;})[_0x2e26('0xc')](function(_0x508f6f){throw _0x508f6f;});}this['log']=function(_0x26f3f8,_0x1ab1c3,_0x515ac6,_0x4bd2c9){return _0x1711af(_0x26f3f8[_0x2e26('0xd')])[_0x2e26('0xe')](function(_0x1833f6){var _0x69eac2=_0x1833f6[_0x1ab1c3];return _0x69eac2;})[_0x2e26('0xe')](function(_0x36005a){var _0x4ef702=_0x26f3f8[_0x2e26('0xd')]?_0x26f3f8[_0x2e26('0xd')]['id']:_0x2e26('0xf');var _0x48bdde=_0x4bd2c9['data'];var _0xb28bb7=_0x4bd2c9[_0x2e26('0x10')];var _0x2c7487=new Date(Number(_0xb28bb7));return _0x36005a(_0x4ef702,_0x2c7487,_0x515ac6,_0x48bdde);})[_0x2e26('0xc')](function(_0x5f0dfd){fileLogger('client')[_0x2e26('0x11')](_0x5f0dfd);});};}function setupLoggers(_0x4137f2){return new Promise(function(_0x13cfad){var _0x3e4793=new ClientSideLogger();var _0x56dfff=fileLogger(_0x2e26('0x12'));var _0x275962=fileLogger('auth');_0x4137f2[_0x2e26('0x13')](_0x2e26('0x14'),_0x3e4793);_0x4137f2[_0x2e26('0x15')](ewinston[_0x2e26('0x16')]({'winstonInstance':_0x56dfff,'meta':![],'statusLevels':!![],'msg':function(_0x489ff2,_0x51d843){var _0x52d368=_0x2e26('0x17');if(!_[_0x2e26('0x18')](_0x489ff2[_0x2e26('0x19')])){_0x52d368+=_0x2e26('0x1a');var _0x1d030f=_0x489ff2[_0x2e26('0x19')];maskSensitiveData(_0x1d030f);}return safeTemplate(util['format'](_0x52d368,_0x489ff2[_0x2e26('0x1b')],_0x489ff2[_0x2e26('0x1c')]['x-forwarded-for']?_0x489ff2[_0x2e26('0x1c')][_0x2e26('0x1d')]:_0x489ff2[_0x2e26('0x1e')][_0x2e26('0x1f')]||_0x489ff2['ip'],_0x489ff2[_0x2e26('0x20')],_0x51d843[_0x2e26('0x21')],_0x51d843['responseTime'],_0x489ff2[_0x2e26('0xd')]?_0x489ff2['user']['id']:null,_0x489ff2['user']?_0x489ff2[_0x2e26('0xd')][_0x2e26('0x22')]:null,_0x489ff2['user']?_0x489ff2[_0x2e26('0xd')]['role']:null,_0x1d030f?util[_0x2e26('0x23')](_0x1d030f,![],null):''));}}));_0x4137f2['use'](ewinston[_0x2e26('0x16')]({'winstonInstance':_0x275962,'meta':![],'statusLevels':!![],'msg':function(_0x4455f7,_0x2fb115){var _0x9d9264=_0x2e26('0x24');if(_0x4455f7[_0x2e26('0x19')]&&_0x4455f7[_0x2e26('0x19')][_0x2e26('0x25')]&&_0x4455f7[_0x2e26('0x19')][_0x2e26('0x26')]){_0x9d9264=_0x2e26('0x27');}return util[_0x2e26('0x28')](_0x9d9264,_0x4455f7['method'],_0x4455f7[_0x2e26('0x1c')][_0x2e26('0x1d')]?_0x4455f7[_0x2e26('0x1c')][_0x2e26('0x1d')]:_0x4455f7[_0x2e26('0x1e')][_0x2e26('0x1f')]||_0x4455f7['ip'],_0x4455f7[_0x2e26('0x20')],_0x2fb115[_0x2e26('0x21')],_0x2fb115[_0x2e26('0x29')],_0x4455f7[_0x2e26('0xd')]?_0x4455f7[_0x2e26('0xd')]['id']:null,_0x4455f7[_0x2e26('0xd')]?_0x4455f7[_0x2e26('0xd')]['name']:null,_0x4455f7[_0x2e26('0xd')]?_0x4455f7[_0x2e26('0xd')][_0x2e26('0xa')]:null,_0x4455f7['body']&&_0x4455f7['body']['device']?_0x4455f7['body']['device']:'other',_0x4455f7[_0x2e26('0x19')]&&_0x4455f7[_0x2e26('0x19')][_0x2e26('0x26')]?_0x4455f7[_0x2e26('0x19')][_0x2e26('0x26')]:'',_0x4455f7[_0x2e26('0x19')]&&_0x4455f7['body'][_0x2e26('0x2a')]?_0x4455f7['body']['agent_name']:'');},'ignoreRoute':function(_0x5e9438){var _0x1d28ac=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1d28ac['test'](_0x5e9438[_0x2e26('0x20')]);}}));return _0x13cfad();});}exports[_0x2e26('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index e9fdbed..ea1fd39 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d3d=['MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','concat','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','exports','timeCompare','ddd','includes','dowCompare','date','daysInMonth','max','min','format'];(function(_0xc853b0,_0x212665){var _0x3e4d81=function(_0xa5f5e7){while(--_0xa5f5e7){_0xc853b0['push'](_0xc853b0['shift']());}};_0x3e4d81(++_0x212665);}(_0x0d3d,0x1b5));var _0xd0d3=function(_0x63e6ca,_0xe20a){_0x63e6ca=_0x63e6ca-0x0;var _0x2a878f=_0x0d3d[_0x63e6ca];return _0x2a878f;};var _=require('lodash');var moment=require(_0xd0d3('0x0'));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][_0xd0d3('0x1')](function(_0x5c138e){return _0x5c138e[_0xd0d3('0x2')];})[_0xd0d3('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xd0d3('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x52f779){if(!_0x52f779['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4bb174){var _0x1f11fe=_0x4bb174[_0xd0d3('0x5')](':')['map'](function(_0x2c3734){return parseInt(_0x2c3734,0xa);});var _0x2cee6b=_0x1f11fe[0x0];var _0x25856e=_0x1f11fe[0x1];if(_0x2cee6b<0x0||_0x2cee6b>0x17||_0x25856e<0x0||_0x25856e>0x3b){throw new Error(EINVALID_DATE);}return[_0x2cee6b,_0x25856e];}function circularDoWInterval(_0x2875f0,_0x13256c){if(_0x2875f0===_0x13256c){return[_0x2875f0];}else{var _0x517a9f=moment[_0xd0d3('0x6')]();moment['locale']('en');var _0x237a76=moment[_0xd0d3('0x7')]()[_0xd0d3('0x1')](function(_0x1ce428){return _0x1ce428['toLowerCase']();});moment[_0xd0d3('0x6')](_0x517a9f);var _0xda28b2=_0x237a76[_0xd0d3('0x8')](_0x2875f0);var _0xbc5dfc=_0x237a76[_0xd0d3('0x8')](_0x13256c);if(_0xbc5dfc>_0xda28b2){return _0x237a76['slice'](_0xda28b2,_0xbc5dfc+0x1);}else{var _0xb1e73f=_0x237a76[_0xd0d3('0x9')](0x0,_0xbc5dfc+0x1);var _0x18662d=_0x237a76[_0xd0d3('0x9')](_0xda28b2);return _0x18662d[_0xd0d3('0xa')](_0xb1e73f);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x5458f8,_0x3b69ef){if(_0x5458f8===_0x3b69ef){return[_0x5458f8];}else{var _0x59cc8a=moment[_0xd0d3('0x6')]();moment[_0xd0d3('0x6')]('en');var _0x167a17=moment[_0xd0d3('0xb')]()[_0xd0d3('0x1')](function(_0x505418){return _0x505418[_0xd0d3('0xc')]();});moment[_0xd0d3('0x6')](_0x59cc8a);var _0xd7a785=_0x167a17[_0xd0d3('0x8')](_0x5458f8);var _0x57b487=_0x167a17[_0xd0d3('0x8')](_0x3b69ef);if(_0x57b487>_0xd7a785){return _0x167a17['slice'](_0xd7a785,_0x57b487+0x1);}else{var _0x5664ae=_0x167a17[_0xd0d3('0x9')](0x0,_0x57b487+0x1);var _0x5644dc=_0x167a17['slice'](_0xd7a785);return _0x5644dc[_0xd0d3('0xa')](_0x5664ae);}}}module['exports'][_0xd0d3('0xd')]=circularMonthInterval;function parseDom(_0x442819){var _0x460065=parseInt(_0x442819,0xa);if(_0x460065<0x1||_0x460065>0x1f){throw new Error(EINVALID_DATE);}return _0x460065;}function timeCompare(_0x3304f4,_0xf423a0,_0x4c3f63){var _0x54eb80=_0x3304f4[_0xd0d3('0xe')]();var _0x26e14d=extractTime(_0xf423a0);var _0x3596f8=_0x26e14d[0x0];var _0x585b95=_0x26e14d[0x1];var _0x4b932a=_0x3304f4[_0xd0d3('0xe')]()[_0xd0d3('0xf')](_0x3596f8)[_0xd0d3('0x10')](_0x585b95);throwIfDateNotValid(_0x4b932a);var _0x5cb682=extractTime(_0x4c3f63);var _0x5337dc=_0x5cb682[0x0];var _0x35776b=_0x5cb682[0x1];var _0x4a9860=_0x3304f4[_0xd0d3('0xe')]()[_0xd0d3('0xf')](_0x5337dc)['minutes'](_0x35776b);throwIfDateNotValid(_0x4a9860);if(_0x4a9860[_0xd0d3('0x11')](_0x4b932a)){var _0x2dc50c=_0x54eb80['clone']()[_0xd0d3('0x12')](_0xd0d3('0x13'));var _0x230c16=_0x54eb80[_0xd0d3('0xe')]()['endOf'](_0xd0d3('0x13'));return _0x54eb80[_0xd0d3('0x14')](_0x4b932a,_0x230c16,undefined,'[]')||_0x54eb80[_0xd0d3('0x14')](_0x2dc50c,_0x4a9860,undefined,'[]');}else{return _0x54eb80[_0xd0d3('0x14')](_0x4b932a,_0x4a9860,undefined,'[]');}}module[_0xd0d3('0x15')][_0xd0d3('0x16')]=timeCompare;function dowCompare(_0x7b7f1c,_0x38d6b9,_0x50e893){var _0x473694=_0x7b7f1c['locale']('en')['format'](_0xd0d3('0x17'))[_0xd0d3('0xc')]();return circularDoWInterval(_0x38d6b9,_0x50e893)[_0xd0d3('0x18')](_0x473694);}module[_0xd0d3('0x15')][_0xd0d3('0x19')]=dowCompare;function domCompare(_0x2ea4ff,_0x4e5d6e,_0x10c571){var _0xf14e0b=_0x2ea4ff[_0xd0d3('0x1a')]();if(_0x4e5d6e===_0x10c571){return _0xf14e0b===_0x4e5d6e;}else{var _0x2e543f=_0x2ea4ff[_0xd0d3('0x1b')]();var _0x9b9092=_0x4e5d6e<_0x10c571;let _0x307f04=![];var _0x1d3c74=0x0;var _0x2331e7=0x0;if(_0x9b9092){_0x1d3c74=Math[_0xd0d3('0x1c')](0x1,_0x4e5d6e);_0x2331e7=Math[_0xd0d3('0x1d')](_0x10c571,_0x2e543f);_0x307f04=_0xf14e0b>=_0x1d3c74&&_0xf14e0b<=_0x2331e7;}else{_0x1d3c74=Math['min'](_0x4e5d6e,_0x2e543f);_0x2331e7=Math[_0xd0d3('0x1c')](0x1,_0x10c571);_0x307f04=_0xf14e0b>=_0x1d3c74||_0xf14e0b<=_0x2331e7;}return _0x307f04;}}module[_0xd0d3('0x15')]['domCompare']=domCompare;function monthCompare(_0x4eaf17,_0x97b7e7,_0xc77963){var _0x2efc5a=_0x4eaf17[_0xd0d3('0x6')]('en')[_0xd0d3('0x1e')](_0xd0d3('0x1f'))[_0xd0d3('0xc')]();return circularMonthInterval(_0x97b7e7,_0xc77963)[_0xd0d3('0x18')](_0x2efc5a);}module['exports'][_0xd0d3('0x20')]=monthCompare;function iftime(_0x3dca04,_0xf07b08=moment['tz'][_0xd0d3('0x21')](),_0x3297d1=moment()){if(!validateRx[_0xd0d3('0x22')](_0x3dca04)){throw new Error(EINVALID_STRING);}else{var _0xf8cbaa=(moment[_0xd0d3('0x23')](_0x3297d1)?_0x3297d1[_0xd0d3('0xe')]():moment(_0x3297d1))['tz'](_0xf07b08)[_0xd0d3('0x6')]('en');throwIfDateNotValid(_0xf8cbaa);var _0x172095=_0x3dca04[_0xd0d3('0x5')](',');var _0x15968c=_0x172095[0x0];var _0xeb99a2=_0x172095[0x1];var _0x2162a5=_0x172095[0x2];var _0x320149=_0x172095[0x3];let _0x333315=!![];if(_0x15968c!=='*'){var _0x35c1b1=_0x15968c['split']('-');var _0xf0e7b2=_[_0xd0d3('0x24')](_0x35c1b1[0x0],0x5,'0');var _0x400c78=_0x35c1b1[_0xd0d3('0x25')]===0x2?_[_0xd0d3('0x24')](_0x35c1b1[0x1],0x5,'0'):_0xf0e7b2;_0x333315=timeCompare(_0xf8cbaa,_0xf0e7b2,_0x400c78);}let _0x5f547a=!![];if(_0xeb99a2!=='*'){var _0x40a178=_0xeb99a2[_0xd0d3('0x5')]('-');var _0x503a1a=_0x40a178[0x0];var _0xb2d529=_0x40a178[_0xd0d3('0x25')]===0x2?_0x40a178[0x1]:_0x503a1a;_0x5f547a=dowCompare(_0xf8cbaa,_0x503a1a,_0xb2d529);}let _0x13c658=!![];if(_0x2162a5!=='*'){var _0x2d8820=_0x2162a5[_0xd0d3('0x5')]('-');var _0x14afc9=parseDom(_0x2d8820[0x0]);var _0x51b847=_0x2d8820[_0xd0d3('0x25')]===0x2?parseDom(_0x2d8820[0x1]):_0x14afc9;_0x13c658=domCompare(_0xf8cbaa,_0x14afc9,_0x51b847);}let _0x4ef12d=!![];if(_0x320149!=='*'){var _0x1066a4=_0x320149[_0xd0d3('0x5')]('-');var _0x8eaa2e=_0x1066a4[0x0];var _0x5c6179=_0x1066a4[_0xd0d3('0x25')]===0x2?_0x1066a4[0x1]:_0x1066a4[0x0];_0x4ef12d=monthCompare(_0xf8cbaa,_0x8eaa2e,_0x5c6179);}return _0x333315&&_0x5f547a&&_0x13c658&&_0x4ef12d;}}module['exports'][_0xd0d3('0x26')]=iftime; \ No newline at end of file +var _0x7344=['split','padStart','length','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','circularMonthInterval','clone','hours','minutes','startOf','endOf','day','isBetween','timeCompare','format','includes','dowCompare','date','daysInMonth','max','monthCompare','guess','test'];(function(_0x3da841,_0xa5b566){var _0xbc23b7=function(_0x3fa5ee){while(--_0x3fa5ee){_0x3da841['push'](_0x3da841['shift']());}};_0xbc23b7(++_0xa5b566);}(_0x7344,0x8b));var _0x4734=function(_0x55609d,_0x2106d9){_0x55609d=_0x55609d-0x0;var _0x4b05b0=_0x7344[_0x55609d];return _0x4b05b0;};var _=require('lodash');var moment=require(_0x4734('0x0'));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][_0x4734('0x1')](function(_0x4a862b){return _0x4a862b['source'];})[_0x4734('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x4734('0x3');var EINVALID_DATE=_0x4734('0x4');function throwIfDateNotValid(_0x152c5b){if(!_0x152c5b['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1efd74){var _0x392748=_0x1efd74['split'](':')[_0x4734('0x1')](function(_0x1b155d){return parseInt(_0x1b155d,0xa);});var _0x2d1692=_0x392748[0x0];var _0x3b0549=_0x392748[0x1];if(_0x2d1692<0x0||_0x2d1692>0x17||_0x3b0549<0x0||_0x3b0549>0x3b){throw new Error(EINVALID_DATE);}return[_0x2d1692,_0x3b0549];}function circularDoWInterval(_0x4749f6,_0x1cffec){if(_0x4749f6===_0x1cffec){return[_0x4749f6];}else{var _0x7fb167=moment[_0x4734('0x5')]();moment[_0x4734('0x5')]('en');var _0x2a1e80=moment[_0x4734('0x6')]()[_0x4734('0x1')](function(_0x4bf23a){return _0x4bf23a[_0x4734('0x7')]();});moment[_0x4734('0x5')](_0x7fb167);var _0x510e6d=_0x2a1e80[_0x4734('0x8')](_0x4749f6);var _0x453187=_0x2a1e80['indexOf'](_0x1cffec);if(_0x453187>_0x510e6d){return _0x2a1e80[_0x4734('0x9')](_0x510e6d,_0x453187+0x1);}else{var _0x39f84c=_0x2a1e80['slice'](0x0,_0x453187+0x1);var _0x226491=_0x2a1e80[_0x4734('0x9')](_0x510e6d);return _0x226491[_0x4734('0xa')](_0x39f84c);}}}module[_0x4734('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x390db8,_0x444724){if(_0x390db8===_0x444724){return[_0x390db8];}else{var _0x253f71=moment[_0x4734('0x5')]();moment['locale']('en');var _0x26409b=moment[_0x4734('0xc')]()[_0x4734('0x1')](function(_0x5a0bb0){return _0x5a0bb0[_0x4734('0x7')]();});moment['locale'](_0x253f71);var _0x1e4d7b=_0x26409b[_0x4734('0x8')](_0x390db8);var _0x160191=_0x26409b[_0x4734('0x8')](_0x444724);if(_0x160191>_0x1e4d7b){return _0x26409b[_0x4734('0x9')](_0x1e4d7b,_0x160191+0x1);}else{var _0x55a8b9=_0x26409b[_0x4734('0x9')](0x0,_0x160191+0x1);var _0x116487=_0x26409b[_0x4734('0x9')](_0x1e4d7b);return _0x116487[_0x4734('0xa')](_0x55a8b9);}}}module[_0x4734('0xb')][_0x4734('0xd')]=circularMonthInterval;function parseDom(_0x272729){var _0x180244=parseInt(_0x272729,0xa);if(_0x180244<0x1||_0x180244>0x1f){throw new Error(EINVALID_DATE);}return _0x180244;}function timeCompare(_0x5ea8b8,_0x3f163d,_0x259af6){var _0x2cca20=_0x5ea8b8[_0x4734('0xe')]();var _0x4d8406=extractTime(_0x3f163d);var _0x92af60=_0x4d8406[0x0];var _0xead31=_0x4d8406[0x1];var _0x51d9f0=_0x5ea8b8['clone']()[_0x4734('0xf')](_0x92af60)[_0x4734('0x10')](_0xead31);throwIfDateNotValid(_0x51d9f0);var _0x50142f=extractTime(_0x259af6);var _0x295278=_0x50142f[0x0];var _0x15e015=_0x50142f[0x1];var _0x23fb27=_0x5ea8b8['clone']()['hours'](_0x295278)[_0x4734('0x10')](_0x15e015);throwIfDateNotValid(_0x23fb27);if(_0x23fb27['isBefore'](_0x51d9f0)){var _0x86c7c=_0x2cca20['clone']()[_0x4734('0x11')]('day');var _0x510857=_0x2cca20[_0x4734('0xe')]()[_0x4734('0x12')](_0x4734('0x13'));return _0x2cca20[_0x4734('0x14')](_0x51d9f0,_0x510857,undefined,'[]')||_0x2cca20[_0x4734('0x14')](_0x86c7c,_0x23fb27,undefined,'[]');}else{return _0x2cca20[_0x4734('0x14')](_0x51d9f0,_0x23fb27,undefined,'[]');}}module[_0x4734('0xb')][_0x4734('0x15')]=timeCompare;function dowCompare(_0x576077,_0x7d18,_0x72e77d){var _0x4e1f18=_0x576077[_0x4734('0x5')]('en')[_0x4734('0x16')]('ddd')['toLowerCase']();return circularDoWInterval(_0x7d18,_0x72e77d)[_0x4734('0x17')](_0x4e1f18);}module[_0x4734('0xb')][_0x4734('0x18')]=dowCompare;function domCompare(_0x4cabd1,_0x5bdbf7,_0x95ab45){var _0x56e1c6=_0x4cabd1[_0x4734('0x19')]();if(_0x5bdbf7===_0x95ab45){return _0x56e1c6===_0x5bdbf7;}else{var _0x46d6d0=_0x4cabd1[_0x4734('0x1a')]();var _0x236b90=_0x5bdbf7<_0x95ab45;let _0x4c5f7e=![];var _0x58e581=0x0;var _0x30788a=0x0;if(_0x236b90){_0x58e581=Math['max'](0x1,_0x5bdbf7);_0x30788a=Math['min'](_0x95ab45,_0x46d6d0);_0x4c5f7e=_0x56e1c6>=_0x58e581&&_0x56e1c6<=_0x30788a;}else{_0x58e581=Math['min'](_0x5bdbf7,_0x46d6d0);_0x30788a=Math[_0x4734('0x1b')](0x1,_0x95ab45);_0x4c5f7e=_0x56e1c6>=_0x58e581||_0x56e1c6<=_0x30788a;}return _0x4c5f7e;}}module[_0x4734('0xb')]['domCompare']=domCompare;function monthCompare(_0x71fc6d,_0x6655de,_0x2e0800){var _0x26d1e5=_0x71fc6d[_0x4734('0x5')]('en')[_0x4734('0x16')]('MMM')[_0x4734('0x7')]();return circularMonthInterval(_0x6655de,_0x2e0800)['includes'](_0x26d1e5);}module[_0x4734('0xb')][_0x4734('0x1c')]=monthCompare;function iftime(_0xf4e5cf,_0x3ac242=moment['tz'][_0x4734('0x1d')](),_0x661a77=moment()){if(!validateRx[_0x4734('0x1e')](_0xf4e5cf)){throw new Error(EINVALID_STRING);}else{var _0x193e9a=(moment['isMoment'](_0x661a77)?_0x661a77[_0x4734('0xe')]():moment(_0x661a77))['tz'](_0x3ac242)[_0x4734('0x5')]('en');throwIfDateNotValid(_0x193e9a);var _0xdd9016=_0xf4e5cf[_0x4734('0x1f')](',');var _0x3b9a4d=_0xdd9016[0x0];var _0x16c600=_0xdd9016[0x1];var _0x4964d4=_0xdd9016[0x2];var _0xa80332=_0xdd9016[0x3];let _0x5da8a4=!![];if(_0x3b9a4d!=='*'){var _0x4bc2d8=_0x3b9a4d['split']('-');var _0x27f712=_[_0x4734('0x20')](_0x4bc2d8[0x0],0x5,'0');var _0x241878=_0x4bc2d8['length']===0x2?_['padStart'](_0x4bc2d8[0x1],0x5,'0'):_0x27f712;_0x5da8a4=timeCompare(_0x193e9a,_0x27f712,_0x241878);}let _0x58c3ae=!![];if(_0x16c600!=='*'){var _0x495a85=_0x16c600[_0x4734('0x1f')]('-');var _0x274cd7=_0x495a85[0x0];var _0x4b406d=_0x495a85[_0x4734('0x21')]===0x2?_0x495a85[0x1]:_0x274cd7;_0x58c3ae=dowCompare(_0x193e9a,_0x274cd7,_0x4b406d);}let _0x2c22a5=!![];if(_0x4964d4!=='*'){var _0x3a26ad=_0x4964d4[_0x4734('0x1f')]('-');var _0x19f330=parseDom(_0x3a26ad[0x0]);var _0x35b7dc=_0x3a26ad[_0x4734('0x21')]===0x2?parseDom(_0x3a26ad[0x1]):_0x19f330;_0x2c22a5=domCompare(_0x193e9a,_0x19f330,_0x35b7dc);}let _0x553b91=!![];if(_0xa80332!=='*'){var _0x5aabd2=_0xa80332[_0x4734('0x1f')]('-');var _0x22f7de=_0x5aabd2[0x0];var _0x3154be=_0x5aabd2['length']===0x2?_0x5aabd2[0x1]:_0x5aabd2[0x0];_0x553b91=monthCompare(_0x193e9a,_0x22f7de,_0x3154be);}return _0x5da8a4&&_0x58c3ae&&_0x2c22a5&&_0x553b91;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index b299d0a..c5bc4a7 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c74=['bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','{{{','}}}','meta','length','stringify','toUpperCase','Logger','transports','warn','%s-%s','error','File','Console','path','util','../config/environment','debugLevel','toLowerCase','redBG\x20white','red'];(function(_0x4773a4,_0x3959eb){var _0x59988b=function(_0x43eaa0){while(--_0x43eaa0){_0x4773a4['push'](_0x4773a4['shift']());}};_0x59988b(++_0x3959eb);}(_0x3c74,0xd1));var _0x43c7=function(_0x5610a3,_0x475a9b){_0x5610a3=_0x5610a3-0x0;var _0x5e077c=_0x3c74[_0x5610a3];return _0x5e077c;};'use strict';var path=require(_0x43c7('0x0'));var util=require(_0x43c7('0x1'));var moment=require('moment');var winston=require('winston');var config=require(_0x43c7('0x2'));var debugLevel=config[_0x43c7('0x3')]?config['debugLevel'][_0x43c7('0x4')]():'info';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':_0x43c7('0x5'),'error':_0x43c7('0x6'),'warn':_0x43c7('0x7'),'info':_0x43c7('0x8'),'print':_0x43c7('0x9'),'success':_0x43c7('0xa'),'http':_0x43c7('0xb'),'verbose':_0x43c7('0xc'),'debug':_0x43c7('0xd'),'silly':'bold\x20cyan'};winston[_0x43c7('0xe')](XC_LOG_COLORS);function getLogFileName(_0x7d2dd5,_0x53177e,_0x503f7c){var _0xf13a50=_0x7d2dd5||_0x43c7('0xf');return path['join'](_0xf13a50,util[_0x43c7('0x10')](_0x43c7('0x11'),_0x53177e,_0x503f7c));}function formatter(_0x52a066,_0x2a5963){_0x2a5963[_0x43c7('0x12')]=_0x2a5963[_0x43c7('0x12')][_0x43c7('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0x43c7('0x13')](/@{/g,'{{')[_0x43c7('0x13')](/}@/g,'}}');return util[_0x43c7('0x10')](_0x43c7('0x14'),moment()[_0x43c7('0x10')](_0x43c7('0x15')),_0x2a5963[_0x43c7('0x16')]['toUpperCase'](),_0x52a066,_0x2a5963[_0x43c7('0x12')]);}function fileFormat(_0x415622,_0x4a3ac0){_0x4a3ac0[_0x43c7('0x12')]=_0x4a3ac0['message'][_0x43c7('0x13')](/@@{/g,_0x43c7('0x17'))[_0x43c7('0x13')](/}@@/g,_0x43c7('0x18'))[_0x43c7('0x13')](/@{/g,'{{')[_0x43c7('0x13')](/}@/g,'}}');var _0x32910c=_0x4a3ac0['meta']&&Object['keys'](_0x4a3ac0[_0x43c7('0x19')])[_0x43c7('0x1a')]?'\x0a\x09'+JSON[_0x43c7('0x1b')](_0x4a3ac0[_0x43c7('0x19')]):'';return util[_0x43c7('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x43c7('0x10')](_0x43c7('0x15')),_0x4a3ac0['level'][_0x43c7('0x1c')](),_0x415622,_0x4a3ac0['message'],_0x32910c);}function consoleLogger(){var _0x336963=new winston[(_0x43c7('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x43c7('0x1e'))]['Console']({'level':_0x43c7('0x1f'),'json':![],'formatter':function(_0x2b6582){return formatter('',_0x2b6582);}})]});return _0x336963;}function fileLogger(_0x1d3bbb,_0x1cb742){var _0x28dbd8=new winston[(_0x43c7('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x43c7('0x1e'))]['File']({'name':util[_0x43c7('0x10')](_0x43c7('0x20'),_0x1d3bbb,_0x43c7('0x21')),'filename':getLogFileName(_0x1cb742,_0x1d3bbb,'error'),'level':_0x43c7('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x43db18){return fileFormat(_0x1d3bbb,_0x43db18);}}),new winston[(_0x43c7('0x1e'))][(_0x43c7('0x22'))]({'name':util['format'](_0x43c7('0x20'),_0x1d3bbb,debugLevel),'filename':getLogFileName(_0x1cb742,_0x1d3bbb,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3c587f){return fileFormat(_0x1d3bbb,_0x3c587f);}}),new winston[(_0x43c7('0x1e'))][(_0x43c7('0x23'))]({'level':_0x43c7('0x1f'),'json':![],'formatter':function(_0x532477){return fileFormat(_0x1d3bbb,_0x532477);}})]});return _0x28dbd8;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x5e01=['debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','../config/environment'];(function(_0x39caf0,_0x2f65a7){var _0x2a6deb=function(_0x47cf63){while(--_0x47cf63){_0x39caf0['push'](_0x39caf0['shift']());}};_0x2a6deb(++_0x2f65a7);}(_0x5e01,0xa4));var _0x15e0=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0x5e01[_0x114b7c];return _0x47185f;};'use strict';var path=require(_0x15e0('0x0'));var util=require(_0x15e0('0x1'));var moment=require(_0x15e0('0x2'));var winston=require('winston');var config=require(_0x15e0('0x3'));var debugLevel=config[_0x15e0('0x4')]?config['debugLevel'][_0x15e0('0x5')]():_0x15e0('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':_0x15e0('0x7'),'error':_0x15e0('0x8'),'warn':_0x15e0('0x9'),'info':_0x15e0('0xa'),'print':_0x15e0('0xb'),'success':_0x15e0('0xc'),'http':_0x15e0('0xd'),'verbose':_0x15e0('0xe'),'debug':_0x15e0('0xf'),'silly':_0x15e0('0x10')};winston[_0x15e0('0x11')](XC_LOG_COLORS);function getLogFileName(_0x850a3d,_0x20fe89,_0x7be616){var _0x8b8480=_0x850a3d||'/var/log/xcally';return path['join'](_0x8b8480,util[_0x15e0('0x12')](_0x15e0('0x13'),_0x20fe89,_0x7be616));}function formatter(_0x331e9b,_0x44417e){_0x44417e[_0x15e0('0x14')]=_0x44417e[_0x15e0('0x14')][_0x15e0('0x15')](/@@{/g,_0x15e0('0x16'))['replace'](/}@@/g,_0x15e0('0x17'))[_0x15e0('0x15')](/@{/g,'{{')[_0x15e0('0x15')](/}@/g,'}}');return util[_0x15e0('0x12')](_0x15e0('0x18'),moment()[_0x15e0('0x12')](_0x15e0('0x19')),_0x44417e['level'][_0x15e0('0x1a')](),_0x331e9b,_0x44417e[_0x15e0('0x14')]);}function fileFormat(_0x3ae3e6,_0x26f563){_0x26f563['message']=_0x26f563[_0x15e0('0x14')][_0x15e0('0x15')](/@@{/g,_0x15e0('0x16'))['replace'](/}@@/g,_0x15e0('0x17'))[_0x15e0('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x21130b=_0x26f563[_0x15e0('0x1b')]&&Object[_0x15e0('0x1c')](_0x26f563[_0x15e0('0x1b')])[_0x15e0('0x1d')]?'\x0a\x09'+JSON[_0x15e0('0x1e')](_0x26f563[_0x15e0('0x1b')]):'';return util[_0x15e0('0x12')](_0x15e0('0x1f'),moment()['format'](_0x15e0('0x19')),_0x26f563[_0x15e0('0x20')]['toUpperCase'](),_0x3ae3e6,_0x26f563[_0x15e0('0x14')],_0x21130b);}function consoleLogger(){var _0xba19ae=new winston[(_0x15e0('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x15e0('0x22'))][(_0x15e0('0x23'))]({'level':_0x15e0('0x24'),'json':![],'formatter':function(_0x3c49db){return formatter('',_0x3c49db);}})]});return _0xba19ae;}function fileLogger(_0x69779a,_0x4652e6){var _0x561fd9=new winston[(_0x15e0('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x15e0('0x25'))]({'name':util[_0x15e0('0x12')](_0x15e0('0x26'),_0x69779a,_0x15e0('0x27')),'filename':getLogFileName(_0x4652e6,_0x69779a,_0x15e0('0x27')),'level':_0x15e0('0x27'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1a56bc){return fileFormat(_0x69779a,_0x1a56bc);}}),new winston['transports'][(_0x15e0('0x25'))]({'name':util[_0x15e0('0x12')]('%s-%s',_0x69779a,debugLevel),'filename':getLogFileName(_0x4652e6,_0x69779a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ff1ca){return fileFormat(_0x69779a,_0x1ff1ca);}}),new winston[(_0x15e0('0x22'))][(_0x15e0('0x23'))]({'level':_0x15e0('0x24'),'json':![],'formatter':function(_0x14733d){return fileFormat(_0x69779a,_0x14733d);}})]});return _0x561fd9;}exports[_0x15e0('0x28')]=consoleLogger;exports[_0x15e0('0x29')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 627615b..11e082a 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 _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0x1967,0x173));var _0x7196=function(_0x286405,_0x5dda0e){_0x286405=_0x286405-0x0;var _0x4a0812=_0x1967[_0x286405];return _0x4a0812;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0xd7e92f,_0x364491){var _0x126d1a=function(_0x13d4bf){while(--_0x13d4bf){_0xd7e92f['push'](_0xd7e92f['shift']());}};_0x126d1a(++_0x364491);}(_0x2ef3,0xba));var _0x32ef=function(_0x9a1ce8,_0x31170b){_0x9a1ce8=_0x9a1ce8-0x0;var _0x3dae9e=_0x2ef3[_0x9a1ce8];return _0x3dae9e;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 7ee65a6..0025186 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 _0x087b=['exports','safeTemplate','lodash','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0xe5ee44,_0x554e7a){var _0x244dc5=function(_0x3cb46f){while(--_0x3cb46f){_0xe5ee44['push'](_0xe5ee44['shift']());}};_0x244dc5(++_0x554e7a);}(_0x087b,0x11a));var _0xb087=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x087b[_0x7e2eb0];return _0xd92de4;};var _=require(_0xb087('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x35e3d3){return _0x35e3d3==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0x40e6d6){var _0x5aa7a8=_0x40e6d6;if(typeof _0x40e6d6===_0xb087('0x1')){_0x5aa7a8=_0x40e6d6[_0xb087('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xb087('0x3')](_0x40e6d6)){_0x5aa7a8=_0x40e6d6[_0xb087('0x4')](function(_0x183efd){return safeTemplate(_0x183efd);});}else if(_[_0xb087('0x5')](_0x40e6d6)){_0x5aa7a8=Object[_0xb087('0x6')](_0x40e6d6)[_0xb087('0x7')](function(_0xecf080,_0x36ac30){_0xecf080[_0x36ac30]=safeTemplate(_0x40e6d6[_0x36ac30]);return _0xecf080;},{});}return _0x5aa7a8;}module[_0xb087('0x8')][_0xb087('0x9')]=safeTemplate; \ No newline at end of file +var _0xd4a2=['exports','safeTemplate','lodash','\x20}\x20}','replace','map','isPlainObject','keys','reduce'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xd4a2,0x173));var _0x2d4a=function(_0x422381,_0x325b32){_0x422381=_0x422381-0x0;var _0x1b25d4=_0xd4a2[_0x422381];return _0x1b25d4;};var _=require(_0x2d4a('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5d70e1){return _0x5d70e1==='{{'?'{\x20{\x20':_0x2d4a('0x1');}function safeTemplate(_0x576ffe){var _0x2a8a71=_0x576ffe;if(typeof _0x576ffe==='string'){_0x2a8a71=_0x576ffe[_0x2d4a('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x576ffe)){_0x2a8a71=_0x576ffe[_0x2d4a('0x3')](function(_0x40d744){return safeTemplate(_0x40d744);});}else if(_[_0x2d4a('0x4')](_0x576ffe)){_0x2a8a71=Object[_0x2d4a('0x5')](_0x576ffe)[_0x2d4a('0x6')](function(_0x57058f,_0x45fefb){_0x57058f[_0x45fefb]=safeTemplate(_0x576ffe[_0x45fefb]);return _0x57058f;},{});}return _0x2a8a71;}module[_0x2d4a('0x7')][_0x2d4a('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 172990e..34fb8ad 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 _0x5786=['motion2','env','NODE_PATH','string','pathExists','then','updated','info','exports','path','../config/environment','resolve','legacy-libs','isArray','apps','findIndex','name'];(function(_0x36616c,_0x23a468){var _0x56e518=function(_0x2a4d7a){while(--_0x2a4d7a){_0x36616c['push'](_0x36616c['shift']());}};_0x56e518(++_0x23a468);}(_0x5786,0x1c3));var _0x6578=function(_0x571dba,_0x22e3ac){_0x571dba=_0x571dba-0x0;var _0x4d69d8=_0x5786[_0x571dba];return _0x4d69d8;};var fs=require('fs-extra');var path=require(_0x6578('0x0'));var config=require(_0x6578('0x1'));var root=config['root'];var APP_JSON_PATH=path[_0x6578('0x2')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x6578('0x3'));function setLegacyLibsNodeEnvPath(_0x872272){let _0x1b5ae0=![];if(Array[_0x6578('0x4')](_0x872272[_0x6578('0x5')])){var _0x926525=_0x872272[_0x6578('0x5')][_0x6578('0x6')](function(_0x57a68a){return _0x57a68a[_0x6578('0x7')]===_0x6578('0x8');});if(_0x926525>-0x1){var _0x45aff=_0x872272[_0x6578('0x5')][_0x926525];if(typeof _0x45aff[_0x6578('0x9')][_0x6578('0xa')]!==_0x6578('0xb')){_0x45aff[_0x6578('0x9')][_0x6578('0xa')]=NODEPATH;_0x1b5ae0=!![];}}return{'appConfig':_0x872272,'updated':_0x1b5ae0};}}function updateAppConfig(_0x366580){return fs[_0x6578('0xc')](APP_JSON_PATH)[_0x6578('0xd')](function(_0x129b32){if(_0x129b32){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x53480b){var _0xb5ee0a=setLegacyLibsNodeEnvPath(_0x53480b);if(_0xb5ee0a[_0x6578('0xe')]){_0x366580[_0x6578('0xf')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x53480b,{'spaces':0x2});}else{return Promise[_0x6578('0x2')]();}});}else{return Promise[_0x6578('0x2')]();}});}module[_0x6578('0x10')]=updateAppConfig; \ No newline at end of file +var _0xbe52=['findIndex','name','NODE_PATH','string','pathExists','then','readJSON','updated','info','writeJSON','exports','fs-extra','path','../config/environment','server/app.json','resolve','legacy-libs','isArray','apps'];(function(_0x468342,_0x15e0ed){var _0x204a5c=function(_0x20917d){while(--_0x20917d){_0x468342['push'](_0x468342['shift']());}};_0x204a5c(++_0x15e0ed);}(_0xbe52,0x13b));var _0x2be5=function(_0x2a8452,_0x18d25d){_0x2a8452=_0x2a8452-0x0;var _0x46cf81=_0xbe52[_0x2a8452];return _0x46cf81;};var fs=require(_0x2be5('0x0'));var path=require(_0x2be5('0x1'));var config=require(_0x2be5('0x2'));var root=config['root'];var APP_JSON_PATH=path['resolve'](root,_0x2be5('0x3'));var NODEPATH=path[_0x2be5('0x4')](root,_0x2be5('0x5'));function setLegacyLibsNodeEnvPath(_0x2d78e2){let _0x18f356=![];if(Array[_0x2be5('0x6')](_0x2d78e2['apps'])){var _0x19a64b=_0x2d78e2[_0x2be5('0x7')][_0x2be5('0x8')](function(_0x331a3b){return _0x331a3b[_0x2be5('0x9')]==='motion2';});if(_0x19a64b>-0x1){var _0x2cfb07=_0x2d78e2[_0x2be5('0x7')][_0x19a64b];if(typeof _0x2cfb07['env'][_0x2be5('0xa')]!==_0x2be5('0xb')){_0x2cfb07['env'][_0x2be5('0xa')]=NODEPATH;_0x18f356=!![];}}return{'appConfig':_0x2d78e2,'updated':_0x18f356};}}function updateAppConfig(_0x407074){return fs[_0x2be5('0xc')](APP_JSON_PATH)[_0x2be5('0xd')](function(_0x5386cf){if(_0x5386cf){return fs[_0x2be5('0xe')](APP_JSON_PATH)[_0x2be5('0xd')](function(_0x5833d8){var _0x2aa2f5=setLegacyLibsNodeEnvPath(_0x5833d8);if(_0x2aa2f5[_0x2be5('0xf')]){_0x407074[_0x2be5('0x10')]('Updating\x20app.json');return fs[_0x2be5('0x11')](APP_JSON_PATH,_0x5833d8,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x2be5('0x4')]();}});}module[_0x2be5('0x12')]=updateAppConfig; \ No newline at end of file